unleash-server 7.6.2 → 7.6.3

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 (35) hide show
  1. package/dist/lib/types/experimental.d.ts +1 -1
  2. package/dist/lib/types/experimental.d.ts.map +1 -1
  3. package/dist/lib/types/experimental.js +1 -0
  4. package/dist/lib/types/experimental.js.map +1 -1
  5. package/frontend/build/index.html +1 -1
  6. package/frontend/build/static/{AdvancedPlayground-BTPrG6RW.js → AdvancedPlayground-D7wyJyhf.js} +1 -1
  7. package/frontend/build/static/{BackendConnections-CRh8Vxoe.js → BackendConnections-B2fwWxNM.js} +1 -1
  8. package/frontend/build/static/{CreateProject-DEMalH1j.js → CreateProject-DCsDw61O.js} +1 -1
  9. package/frontend/build/static/{EnterpriseEdge-Cp-pGMa0.js → EnterpriseEdge-Bzf3ZWSM.js} +1 -1
  10. package/frontend/build/static/{FeatureMetricsChart-DQOE71LA.js → FeatureMetricsChart-CA7ccj4F.js} +1 -1
  11. package/frontend/build/static/{FeatureStaleDialog-B6BfnDiQ.js → FeatureStaleDialog-DFGtgX-I.js} +1 -1
  12. package/frontend/build/static/{FeatureViewLazyExport-BkNTNFqK.js → FeatureViewLazyExport-CVIpdGgg.js} +3 -3
  13. package/frontend/build/static/{FlagMetricsChart-zYDF9bet.js → FlagMetricsChart-Dcc3RwL2.js} +1 -1
  14. package/frontend/build/static/{FrontendNetworkTrafficUsage-CbxdFXH7.js → FrontendNetworkTrafficUsage-C6ZZ-igE.js} +1 -1
  15. package/frontend/build/static/{GridLayoutWrapper-Cq6Bzm36.js → GridLayoutWrapper-mu3C2OC4.js} +1 -1
  16. package/frontend/build/static/{ImpactMetricsPage-CFYXYXPb.js → ImpactMetricsPage-DQ3DugFo.js} +1 -1
  17. package/frontend/build/static/{LazyAdminExport-ByTh4iFa.js → LazyAdminExport-CEik6N0e.js} +3 -3
  18. package/frontend/build/static/{LazyProjectExport-K12Xy3w9.js → LazyProjectExport-C8B0wkkW.js} +2 -2
  19. package/frontend/build/static/{LifecycleChartComponent-DHvlFNd2.js → LifecycleChartComponent-DgMY7X0Z.js} +1 -1
  20. package/frontend/build/static/{LineChartComponent-BlhKm3cw.js → LineChartComponent-FVKRZKUW.js} +1 -1
  21. package/frontend/build/static/{MarkCompletedDialogue-apmlFjVY.js → MarkCompletedDialogue-BFMzJ-VW.js} +1 -1
  22. package/frontend/build/static/{NetworkOverview-BiLOuQ4c.js → NetworkOverview-D8wtNaRF.js} +1 -1
  23. package/frontend/build/static/{NetworkPrometheusAPIWarning-CYo3j2Tj.js → NetworkPrometheusAPIWarning-D5-OGJsP.js} +1 -1
  24. package/frontend/build/static/{NetworkTraffic-DONL5oIx.js → NetworkTraffic-3cnRG5P0.js} +1 -1
  25. package/frontend/build/static/{NetworkTrafficUsage-DjQiYq0S.js → NetworkTrafficUsage-CSiuPn9W.js} +1 -1
  26. package/frontend/build/static/{PercentageDonut-CA9hYg3v.js → PercentageDonut-C51wuJjA.js} +1 -1
  27. package/frontend/build/static/{ReactJSONEditor-9cJL1vJY.js → ReactJSONEditor-BFCTTSFc.js} +1 -1
  28. package/frontend/build/static/{RoleCell-ZzU5Oqy8.js → RoleCell-CIeC6DEg.js} +1 -1
  29. package/frontend/build/static/{Safeguard-DY1N4aPz.js → Safeguard-C9U0j0cL.js} +1 -1
  30. package/frontend/build/static/{aggregateFeatureMetrics-D6bHft_C.js → aggregateFeatureMetrics-B-7cFh4G.js} +1 -1
  31. package/frontend/build/static/{formatTickValue-BcLsqREh.js → formatTickValue-CaA_jBqg.js} +1 -1
  32. package/frontend/build/static/{index-CoLhlfXP.js → index-C0tV9tYB.js} +10 -10
  33. package/frontend/build/static/{networkTrafficUsageHighlightPlugin-CqEM-cK_.js → networkTrafficUsageHighlightPlugin-D5DxaVbe.js} +1 -1
  34. package/frontend/build/static/{useApiTokens-ClWvohC9.js → useApiTokens-DDEZMbRy.js} +1 -1
  35. package/package.json +1 -1
@@ -295,7 +295,7 @@ Error generating stack: `+s.message+`
295
295
  `)).filter(y=>!y.includes('"')&&!y.includes("'")).map(H_e).sort((y,b)=>y.localeCompare(b));return{name:f.filterName,header:f.Header??f.filterName,options:m,suggestedOption:m[0]??`example-${f.filterName}`,values:rQ(f.filterName,o.searchValue)}}).sort((f,h)=>f.name.localeCompare(h.name)),a=o.columns.filter(f=>f.searchable&&f.accessor),l=a.map(f=>f.Header??f.accessor).join(", "),c=o.data.length&&a.length?B4(a[0],o.data[0]):"example-search-text",u=s.length===0?"":s.map(f=>`${f.name}:${f.suggestedOption}`)[0],d=f=>{t(f),r("search-filter-suggestions",{props:{eventType:"filter"}})},p=()=>{t(`${u} ${c}`.trim()),r("search-filter-suggestions",{props:{eventType:"search and filter"}})};return i.jsxs(aQ,{className:"dropdown-outline",children:[i.jsx(te,{condition:!!n,show:i.jsxs(i.Fragment,{children:[i.jsx(sQ,{onSuggestion:t,savedQuery:n}),i.jsx(mN,{})]})}),i.jsxs(B_e,{children:[i.jsx(z_e,{}),i.jsx(K,{children:i.jsx(te,{condition:!!o.searchValue,show:i.jsx(M_e,{filters:s,getSearchContext:e,searchableColumnsString:l}),elseShow:i.jsx(L_e,{filters:s,searchableColumnsString:l,onClick:d})})})]}),i.jsx(mN,{}),i.jsxs(K,{sx:{lineHeight:1.75},children:[i.jsx(te,{condition:s.length>0,show:"Combine filters and search: "}),i.jsxs(H4,{tabIndex:0,onClick:p,onKeyDown:z4(p),children:[i.jsx("span",{children:u},u)," ",i.jsx("span",{children:c})]})]})]})},V_e=()=>{const[e,t]=g.useState();return g.useEffect(()=>{var r;const n=((r=navigator==null?void 0:navigator.userAgentData)==null?void 0:r.platform)||(navigator==null?void 0:navigator.platform)||"unknown";t(n.toLowerCase().includes("mac")||n==="iPhone"||n==="iPad")},[]),e},j1=({key:e,modifiers:t=[],preventDefault:n=!1},r)=>{const o=V_e();g.useEffect(()=>{const l=c=>{if(e===c.key){if(t.includes("ctrl")){if(o){if(!c.metaKey)return}else if(!c.ctrlKey)return}t.includes("alt")&&!c.altKey||t.includes("shift")&&!c.shiftKey||(n&&c.preventDefault(),r())}};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[o,e,t,n,r]);const s=g.useMemo(()=>t.map(l=>({ctrl:o?"⌘":"Ctrl",alt:"Alt",shift:"Shift"})[l]),[o,t]);return g.useMemo(()=>[...s,`${e[0].toUpperCase()}${e.slice(1)}`].join("+"),[s,e])},iQ=(e,t)=>{g.useEffect(()=>{const n=r=>{e.some(o=>{var s;return(s=o.current)==null?void 0:s.contains(r.target)})||t()};return document.addEventListener("click",n),()=>{document.removeEventListener("click",n)}},[e,t])},U_e=e=>{const{value:t,setValue:n}=g.useMemo(()=>td(`Search:${e||"default"}:v1`,{query:""}),[e]),[r,o]=g.useState(t.query);return g.useEffect(()=>{e&&r.trim().length>0&&n({query:r})},[e,r,n]),{savedQuery:r,setSavedQuery:s=>{s.trim().length>0&&o(s)}}},G_e=(e,t)=>{g.useEffect(()=>{let n=!1;const r=a=>{var l;n=((l=e.current)==null?void 0:l.contains(a.target))||!1},o=a=>{setTimeout(()=>{!n&&e.current&&!e.current.contains(document.activeElement)&&t(),n=!1},0)};document.addEventListener("mousedown",r);const s=e.current;return s&&s.addEventListener("blur",o,!0),()=>{document.removeEventListener("mousedown",r),s&&s.removeEventListener("blur",o,!0)}},[e,t])},aQ=v(qr)(({theme:e})=>({position:"absolute",width:"100%",left:0,top:"20px",zIndex:2,padding:e.spacing(4,1.5,1.5),borderBottomLeftRadius:e.spacing(1),borderBottomRightRadius:e.spacing(1),boxShadow:"0px 8px 20px rgba(33, 33, 33, 0.15)",fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,wordBreak:"break-word"})),q_e=v("div",{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({display:"flex",flexGrow:1,alignItems:"center",position:"relative",backgroundColor:e.palette.background.paper,maxWidth:t?"100%":"400px",[e.breakpoints.down("md")]:{marginTop:e.spacing(1),maxWidth:"100%"}})),Y_e=v("div")(({theme:e})=>({display:"flex",alignItems:"center",backgroundColor:e.palette.background.elevation1,border:`1px solid ${e.palette.neutral.border}`,borderRadius:e.shape.borderRadiusExtraLarge,padding:"3px 5px 3px 12px",width:"100%",zIndex:3,"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:e.boxShadows.main}})),K_e=v(q3)(({theme:e})=>({width:"100%",backgroundColor:e.palette.background.elevation1})),X_e=v(bo)(({theme:e})=>({color:e.palette.neutral.main,fontSize:e.typography.body1.fontSize})),No=({initialValue:e="",id:t,onChange:n,onFocus:r,onBlur:o,className:s,placeholder:a,hasFilters:l,disabled:c,getSearchContext:u,containerStyles:d,expandable:p=!1,debounceTime:f=200,...h})=>{const{trackEvent:m}=zt(),y=g.useRef(null),b=g.useRef(null),[x,C]=g.useState(!1),w=g.useRef(!1),j=()=>{C(!1),o==null||o()},{savedQuery:k,setSavedQuery:S}=U_e(t),[E,T]=g.useState(e),R=on.useAsyncDebounce(n,f),_=A=>{R(A),T(A),S(A)},M=j1({modifiers:["ctrl","shift"],key:"K",preventDefault:!0},()=>{var A,O;w.current=!0,document.activeElement===y.current?(A=y.current)==null||A.blur():(O=y.current)==null||O.focus()});g.useEffect(()=>{x&&(w.current?m("search-opened",{props:{eventType:"hotkey"}}):m("search-opened",{props:{eventType:"manual"}}),w.current=!1)},[x,m]),j1({key:"Escape"},()=>{var A,O;(A=b.current)!=null&&A.contains(document.activeElement)&&((O=y.current)==null||O.blur())});const $=`${a??"Search"} (${M})`;iQ([b],j),G_e(b,j),g.useEffect(()=>{T(e)},[e]);const z=x&&t;return i.jsxs(q_e,{ref:b,style:d,active:p&&x,...h,children:[i.jsxs(Y_e,{className:s,children:[i.jsx(Rf,{sx:{mr:1,color:A=>A.palette.action.disabled}}),i.jsx(K_e,{inputRef:y,placeholder:$,inputProps:{"aria-label":$,"data-testid":DJ},value:E,onChange:A=>_(A.target.value),onFocus:()=>{C(!0),r==null||r()},disabled:c}),i.jsx(K,{sx:{width:A=>A.spacing(4)},children:i.jsx(te,{condition:!!E,show:i.jsx(Rt,{title:"Clear search query",arrow:!0,children:i.jsx(Mt,{size:"small",onClick:A=>{var O;A.stopPropagation(),_(""),(O=y.current)==null||O.focus()},sx:{padding:A=>A.spacing(1)},children:i.jsx(X_e,{})})})})})]}),i.jsx(te,{condition:!!(l&&u)&&x,show:i.jsx(W_e,{onSuggestion:A=>{var O;_(A),(O=y.current)==null||O.focus()},savedQuery:k,getSearchContext:u}),elseShow:z&&i.jsx(aQ,{className:"dropdown-outline",children:i.jsx(sQ,{onSuggestion:_,savedQuery:k})})})]})},_t=()=>{const{setToast:e}=g.useContext(Ef),t=()=>e(o=>({...o,show:!1})),n=g.useCallback((o,s)=>{e({text:o||"Something went wrong.",type:"error",show:!0,autoHideDuration:12e3,...s})},[e]);return{setToastData:g.useCallback(o=>{o.persist?e({...o,show:!0}):e({autoHideDuration:6e3,...o,show:!0})},[e]),setToastApiError:n,hideToast:t}},pt=e=>e instanceof Error?e.message||e.toString():typeof e=="string"?e:"Unknown error",CS="Access denied",iy=(e,t)=>e?t:t?`${t} (${CS})`:CS,J_e=e=>(console.log(`[DEVELOPMENT LOG] Starting timing for request: ${e}`),Date.now()),Z_e=(e,t)=>{const r=Date.now()-e;return console.log(`[DEVELOPMENT LOG] Timing for request ${t}: ${r} ms`),r>500&&console.error("[DEVELOPMENT LOG] API call took over 500ms. This may indicate a rendering performance problem in your React component.",t,r),r},er=({handleBadRequest:e,handleNotFound:t,handleForbidden:n,handleUnauthorized:r,handleUnavailable:o,propagateErrors:s=!1})=>{const[a,l]=g.useState({}),[c,u]=g.useState(!1),d=g.useCallback(async(y,b)=>{var x;if(y.status===t7){if(e)return e(l,y,b);if(l(C=>({...C,badRequest:"Bad request format"})),s){const C=await y.json();throw new dR(y.status,C)}}if(y.status===aZ){if(t)return t(l,y,b);if(l(C=>({...C,notFound:"Could not find the requested resource"})),s)throw new pR(y.status)}if(y.status===cZ){if(r)return r(l,y,b);if(l(C=>({...C,unauthorized:CS})),s)throw new uR(y.status)}if(y.status===lZ){if(n)return n(l,y,b);if(l(C=>({...C,forbidden:"This operation is forbidden"})),s){const C=await y.json();throw new JTe(y.status,C)}}if(y.status===uZ){if(o)return o(l,y,b);if(l(C=>({...C,unavailable:"This operation is unavailable"})),s){const C=await y.json();throw new ZTe(y.status,C)}}if(y.status>399){const C=await y.json();if(((x=C==null?void 0:C.details)==null?void 0:x.length)>0&&s){const w=C.details[0];if(l(j=>({...j,unknown:w})),s)throw new Error(w.message||w.msg);return w}if((C==null?void 0:C.length)>0&&s){const w=C[0];throw new Error(w.message||w.msg)}if(s)throw new Error("Action could not be performed")}},[e,n,t,r,s]),p=y=>async(b,x,C=!0)=>{const w=J_e(x||`Unknown request happening on ${b}`),j=await y(b,x,C);return Z_e(w,x||`Unknown request happening on ${b}`),j},f=g.useCallback(async(y,b,x=!0)=>{x&&u(!0);try{const C=await y();return u(!1),C.status>299&&await d(C,b),C.status===Jg&&l({}),C}catch(C){throw u(!1),C}},[d]),h=g.useCallback(async(y,b,x=!0)=>{try{const C=await y();if(!C.ok)throw new Error;return C}catch{throw new Error("Could not make request | makeLightRequest")}},[]),m=g.useCallback((y,b,x="")=>{const C={headers:pS,credentials:"include"};return{caller:()=>fetch(yt(y),{...C,...b}),id:x}},[]);return g.useCallback(p(f),[f]),g.useCallback(p(h),[h]),{loading:c,makeRequest:f,makeLightRequest:h,createRequest:m,errors:a}},Q_e=()=>{const{makeLightRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),{setToastData:o,setToastApiError:s}=_t(),{trackEvent:a}=zt(),l=g.useCallback(async(u,d)=>{const p=`api/admin/projects/${u}/features/${d}/favorites`,f=t(p,{method:"POST"},"addFavoriteFeature");try{await e(f.caller,f.id),o({text:"Feature flag added to favorites",type:"success"}),a("favorite",{props:{eventType:"feature favorited"}})}catch(h){s(pt(h))}},[t,e]),c=g.useCallback(async(u,d)=>{const p=`api/admin/projects/${u}/features/${d}/favorites`,f=t(p,{method:"DELETE"},"removeFavoriteFeature");try{await e(f.caller,f.id),o({text:"Feature flag removed from favorites",type:"success"}),a("favorite",{props:{eventType:"feature unfavorited"}})}catch(h){s(pt(h))}},[t,e]);return{favorite:l,unfavorite:c,errors:n,loading:r}};var YR={},eIe=je;Object.defineProperty(YR,"__esModule",{value:!0});var s7=YR.default=void 0,tIe=eIe(Ee()),nIe=i,rIe=(0,tIe.default)((0,nIe.jsx)("path",{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}),"Star");s7=YR.default=rIe;var KR={},oIe=je;Object.defineProperty(KR,"__esModule",{value:!0});var i7=KR.default=void 0,sIe=oIe(Ee()),iIe=i,aIe=(0,sIe.default)((0,iIe.jsx)("path",{d:"m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}),"StarBorder");i7=KR.default=aIe;const ra=({title:e,children:t,variant:n="default",titleComponent:r,...o})=>!e&&!r?t:n==="custom"?i.jsx(wr,{...o,title:e||r,arrow:!0,children:t}):i.jsx(Rt,{...o,title:e||r,arrow:!0,children:t}),lIe=({isActive:e=!1,onClick:t})=>{const{trackEvent:n}=zt(),[r,o]=g.useState(e),s=()=>{const a=!r;o(a),n("favorite",{props:{action:a?"pin":"unpin"}}),t(a)};return i.jsx(ra,{title:r?"Unpin favorite features from the top":"Pin favorite features to the top",children:i.jsx(Mt,{sx:a=>({mx:-.75,my:-1,display:"flex",alignItems:"center",justifyContent:"center",padding:1.25,color:a.palette.primary.main}),onClick:s,size:"small",children:i.jsx(te,{condition:r,show:i.jsx(s7,{fontSize:"small"}),elseShow:i.jsx(i7,{fontSize:"small"})})})})},rd=()=>{const{data:e,error:t,mutate:n}=On(yt("api/admin/environments"),cIe),r=g.useMemo(()=>e||[],[e]),o=g.useCallback(async()=>{await n()},[n]),s=g.useCallback(async a=>{await n(a,!1)},[n]);return{environments:r,refetchEnvironments:o,mutateEnvironments:s,loading:!t&&!e,error:t}},cIe=async e=>(await fetch(e).then(en("Environments")).then(n=>n.json())).environments.sort((n,r)=>n.sortOrder-r.sortOrder),uIe=v(Fp)(({theme:e,maxWidth:t})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:t?void 0:e.spacing(85),backgroundColor:"transparent"}})),dIe=v(s4e)(({theme:e})=>({backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,padding:e.spacing(3.5,6),fontWeight:e.fontWeight.medium})),pIe=v("div")(({theme:e})=>({padding:e.spacing(6),backgroundColor:e.palette.background.paper})),fIe=v(t4e)(({theme:e})=>({padding:0,marginBottom:e.spacing(6)})),hIe=v(Yve)(({theme:e})=>({gap:e.spacing(2),padding:0})),Mn=({children:e,open:t,setOpen:n,onClick:r,onClose:o,title:s,primaryButtonText:a,disabledPrimaryButton:l=!1,secondaryButtonText:c,maxWidth:u,fullWidth:d=!1,formId:p,permissionButton:f,customButton:h})=>{const m=p?b=>{b.preventDefault(),r&&r(b)}:r,y=b=>{b.key==="Escape"&&(n==null||n(!1))};return i.jsxs(uIe,{open:t,onClose:o,onKeyDown:y,role:"dialog",fullWidth:d,"aria-labelledby":"simple-modal-title","aria-describedby":"simple-modal-description",maxWidth:u,children:[i.jsx(dIe,{children:s}),i.jsxs(pIe,{children:[i.jsx(te,{condition:!!e,show:i.jsx(fIe,{children:e})}),i.jsxs(hIe,{children:[i.jsx(te,{condition:!!f,show:f,elseShow:i.jsx(te,{condition:!!r,show:i.jsx($e,{form:p,color:"primary",variant:"contained",onClick:m,autoFocus:!p,disabled:l,"data-testid":Oje,type:p?"submit":"button",children:a||"Yes, I'm sure"})})}),i.jsx(te,{condition:!!o,show:i.jsx($e,{onClick:o,children:c||"No, take me back"})}),i.jsx(te,{condition:!!h,show:h})]})]})]})};var XR={},gIe=je;Object.defineProperty(XR,"__esModule",{value:!0});var Pf=XR.default=void 0,mIe=gIe(Ee()),yIe=i,xIe=(0,mIe.default)((0,yIe.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined");Pf=XR.default=xIe;const vIe=e=>{const t=e[0];return t&&"groupHeader"in t},bIe=v(Ko)({maxWidth:"100%"}),yN=e=>i.jsx(wn,{sx:e.sx,value:e.key,title:e.title||"","data-testid":`${pT}-${e.label}`,disabled:e.disabled,children:e.label},e.key);function _f({variant:e="outlined",name:t,value:n,label:r="",options:o,onChange:s,id:a,disabled:l=!1,className:c,classes:u,fullWidth:d,visuallyHideLabel:p,labelId:f,...h}){const m=y=>{y.preventDefault(),s(String(y.target.value))};return i.jsxs(bIe,{variant:e,size:"small",classes:u,fullWidth:d,children:[r?i.jsx(Gl,{sx:p?wK:null,htmlFor:a,id:f,children:r}):null,i.jsx(na,{name:t,disabled:l,onChange:m,className:c,label:p?"":r,id:a,value:n??"",autoWidth:!0,IconComponent:Pf,labelId:f,...h,children:vIe(o)?o.flatMap(y=>[i.jsx(Ik,{children:y.groupHeader},y.groupHeader)].concat(y.options.map(yN))):o.map(yN)})]})}const CIe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),{trackEvent:o}=zt();return{loading:r,errors:n,createExport:async a=>{const c=t("api/admin/features-batch/export",{method:"POST",body:JSON.stringify(a)}),u=await e(c.caller,c.id);return o("export_import",{props:{eventType:"features exported"}}),u}}},Ts=(e,t,n,r,o={})=>{const s=On(e?n:null,r,o);return{...s,error:e?s.error:void 0,data:e?s.data:t}},wIe="api/admin/release-plan-templates",SIe=[],ay=()=>{const{isEnterprise:e}=ut(),{data:t,error:n,mutate:r}=Ts(e(),SIe,yt(wIe),jIe);return g.useMemo(()=>({templates:t??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},jIe=e=>fetch(e).then(en("Release templates")).then(t=>t.json()),EIe=v(_f)(({theme:e})=>({minWidth:"250px",marginTop:e.spacing(2)})),kIe=({showExportDialog:e,data:t,project:n,onClose:r,onConfirm:o,environments:s})=>{const[a,l]=g.useState(s[0]),{createExport:c}=CIe(),u=g.createRef(),{setToastApiError:d}=_t(),{templates:p}=ay(),f=!!p.length,h=()=>s.map(b=>({key:b,label:b})),m=b=>{var k,S;const x=document.createElement("a");(k=u.current)==null||k.appendChild(x),x.style.display="display: none";const C=new Blob([JSON.stringify(b)],{type:"application/json"}),w=window.URL.createObjectURL(C);x.href=w;const j=new Date;x.download=`${j.toISOString()}-export.json`,x.click(),window.URL.revokeObjectURL(w),(S=u.current)==null||S.removeChild(x)},y=async()=>{try{const b={features:t.map(w=>w.name),environment:a,project:n},C=await(await c(b)).json();m(C),r(),o==null||o()}catch(b){d(pt(b))}};return i.jsx(Mn,{open:e,title:"Export feature flag configuration",onClose:r,onClick:y,primaryButtonText:"Export selection",secondaryButtonText:"Cancel",children:i.jsxs(K,{ref:u,children:[f&&i.jsx(Dt,{severity:"warning",sx:{mb:4},children:"Exporting does not include release plans. You may need to set up new release plans for the imported feature flags."}),i.jsx(te,{condition:t.length>0,show:i.jsxs("span",{children:["The current search filter will be used to export feature flags. Currently ",t.length," feature flags will be exported."]}),elseShow:i.jsx("span",{children:"You will export all feature flags from this project."})}),i.jsx("br",{}),i.jsx("br",{}),i.jsx(J,{children:"Select which environment to export feature flag configuration from:"}),i.jsx(EIe,{options:h(),value:a,onChange:b=>l(b)})]})})},TIe=e=>nJ(new Date(e),{addSuffix:!0}).replace("about ","").replace("less than a minute ago","< 1 minute ago"),Kl=({date:e,fallback:t="",refresh:n=!0,timeElement:r=!0})=>{const o=g.useCallback(()=>{try{return e?{description:TIe(e),dateTime:r?new Date(e):void 0}:{description:t}}catch{return{description:t}}},[e,t,r]),[s,a]=g.useState(o);return g.useEffect(()=>{a(o)},[o]),g.useEffect(()=>{if(!e||!n)return;const l=setInterval(()=>{a(o)},Kwe(12));return()=>clearInterval(l)},[e,n,o]),s.dateTime?i.jsx("time",{dateTime:s.dateTime.toISOString(),children:s.description}):s.description},a7=()=>{const e=Bt(),t={background:e.palette.seen.unknown,text:e.palette.grey.A400};return n=>{if(!n)return t;try{const r=Z3(Date.now(),new Date(n));return r<1?{background:e.palette.seen.recent,text:e.palette.success.main}:r<=7?{background:e.palette.seen.inactive,text:e.palette.warning.main}:{background:e.palette.seen.abandoned,text:e.palette.error.main}}catch{}return t}},RIe=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1),width:"20%",justifyContent:"flex-end"})),AIe=v(ZK)(({theme:e})=>({color:e.palette.divider})),PIe=v(ZK)(({theme:e})=>({color:e.palette.primary.main,position:"absolute",left:0})),_Ie=({yes:e,no:t})=>{if(e===void 0||t===void 0||e+t===0)return i.jsx(K,{});const r=Math.round(e/(e+t)*100);return i.jsxs(RIe,{children:[i.jsxs(K,{sx:{position:"relative"},children:[i.jsx(AIe,{variant:"determinate",size:18,thickness:11,value:100}),i.jsx(PIe,{variant:"determinate",size:18,thickness:11,value:r})]}),i.jsxs(K,{children:[r,"%"]})]})},IIe=v("div",{})(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),padding:e.spacing(1),backgroundColor:e.palette.background.paper,color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,borderRadius:e.shape.borderRadiusMedium})),OIe=v("div")(({theme:e})=>({display:"flex",flexWrap:"wrap"})),MIe=v("p")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.fontSizes.smallBody,marginBottom:e.spacing(1)})),$Ie=v("p")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.fontSizes.smallBody,fontWeight:e.fontWeight.bold,marginBottom:e.spacing(1),width:"40%",justifyContent:"flex-start"})),DIe=v("div")(({theme:e})=>({width:"40%",justifyContent:"center",padding:e.spacing(0,1,0,1)})),LIe=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),NIe=v("div",{shouldForwardProp:e=>e!=="color"})(({color:e})=>({textAlign:"left",width:"100%",color:e})),FIe=v("div")(({theme:e})=>({maxHeight:e.spacing(24.5),overflowY:"auto",paddingRight:e.spacing(2)})),BIe=({environments:e,featureLastSeen:t,...n})=>{const r=a7(),o=e==null?void 0:e.some(s=>!!s.lastSeenAt);return i.jsxs(IIe,{...n,"data-loading":!0,children:[i.jsx(MIe,{children:"Last usage reported"}),i.jsx(te,{condition:!!e&&!!o,show:i.jsx(FIe,{children:e==null?void 0:e.map(({name:s,lastSeenAt:a,yes:l,no:c})=>i.jsxs(OIe,{children:[i.jsx($Ie,{children:s}),i.jsx(DIe,{children:i.jsx(NIe,{color:r(a).text,children:i.jsx(Kl,{date:a,refresh:!1,fallback:"no usage"})})}),i.jsx(_Ie,{yes:l,no:c})]},s))}),elseShow:i.jsxs(J,{fontWeight:"bold",color:r(t).text,children:["Reported ",i.jsx(Kl,{date:t})]})}),i.jsx(LIe,{children:"Usage is reported from connected applications through metrics"})]})},lQ=e=>g.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"current",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M7 10H13",stroke:"#6E6E70",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"})),JR=e=>g.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M15 10H12.8571L11.4286 14L8.57143 6L7.14286 10H5",stroke:"current",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"})),zIe=e=>{try{return!Array.isArray(e)||e.length===0?null:e.filter(t=>!!t.lastSeenAt).map(t=>new Date(t.lastSeenAt)).reduce((t,n)=>n>t?n:t).toISOString()}catch{return null}},HIe=v("div")(({theme:e})=>({display:"flex",padding:e.spacing(1)})),WIe=v(K)(({theme:e})=>({width:"28px",height:"28px",background:"transparent",borderRadius:`${e.shape.borderRadius}px`,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",fontSize:e.typography.body2.fontSize,margin:"0 auto"})),ZR=v("div")(({theme:e})=>({width:"20px",height:"20px",background:e.palette.background.paper,borderRadius:`${e.shape.borderRadius}px`,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",fontSize:e.typography.body2.fontSize,margin:"0 auto"})),VIe=v(ra)(({theme:e})=>({maxWidth:e.spacing(47.5)})),xN=({sx:e,tooltip:t,color:n,children:r})=>i.jsx(HIe,{sx:e,children:i.jsx(VIe,{variant:"custom",titleComponent:t,arrow:!0,describeChild:!0,children:i.jsx(WIe,{sx:{"&:hover":{background:n}},children:i.jsx(ZR,{style:{background:n},children:r})})})}),UIe=v(K)({display:"grid",placeItems:"center"}),GIe=({featureLastSeen:e,environments:t,sx:n,...r})=>{const o=a7(),s=zIe(t)||e;if(!s)return i.jsx(xN,{sx:n,tooltip:"No usage reported from connected applications",children:i.jsx(K,{"data-loading":!0,children:i.jsx(UIe,{children:i.jsx(lQ,{})})})});const{background:a,text:l}=o(s);return i.jsx(xN,{sx:n,tooltip:i.jsx(BIe,{featureLastSeen:s,environments:t,...r}),color:a,children:i.jsx(JR,{stroke:l})})},qIe=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},g.createElement("path",{fill:"#F7F7FA",d:"M0 4a4 4 0 0 1 4-4h32a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4Z"}),g.createElement("path",{fill:"#9F9FA1",stroke:"#F7F7FA",strokeWidth:2,d:"M24.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"})),YIe=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},g.createElement("path",{fill:"#EBF7FF",d:"M0 4a4 4 0 0 1 4-4h32a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4Z"}),g.createElement("path",{fill:"#96D2FA",stroke:"#EBF7FF",strokeWidth:2,d:"M21.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#0087E0",stroke:"#EBF7FF",strokeWidth:2,d:"M27.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"})),KIe=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},g.createElement("path",{fill:"#F4FAEB",d:"M0 4a4 4 0 0 1 4-4h32a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4Z"}),g.createElement("path",{fill:"#B0D182",stroke:"#F4FAEB",strokeWidth:2,d:"M18.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.556 5.556 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#B0D182",stroke:"#F4FAEB",strokeWidth:2,d:"M24.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#68A611",stroke:"#F4FAEB",strokeWidth:2,d:"M30.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"})),XIe=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},g.createElement("path",{fill:"#FFF2F3",d:"M0 4a4 4 0 0 1 4-4h32a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4Z"}),g.createElement("path",{fill:"#FEB0B7",d:"M8.541 7.035a4.556 4.556 0 1 1 6.918 5.93 4.556 4.556 0 0 1-6.918-5.93Z"}),g.createElement("path",{fill:"#FEB0B7",stroke:"#FFF2F3",strokeWidth:2,d:"M21.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#FEB0B7",stroke:"#FFF2F3",strokeWidth:2,d:"M26.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#D93644",stroke:"#FFF2F3",strokeWidth:2,d:"M31.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"})),JIe=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},g.createElement("path",{fill:"#F3F3FD",d:"M0 4a4 4 0 0 1 4-4h32a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4Z"}),g.createElement("path",{fill:"#9F9FA1",d:"M6.541 7.035a4.556 4.556 0 1 1 6.918 5.93 4.556 4.556 0 0 1-6.918-5.93Z"}),g.createElement("path",{fill:"#9F9FA1",stroke:"#F7F7FA",strokeWidth:2,d:"M19.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.556 5.556 0 1 0 8.436 0Z"}),g.createElement("path",{fill:"#9F9FA1",stroke:"#F7F7FA",strokeWidth:2,d:"M24.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#9F9FA1",stroke:"#F7F7FA",strokeWidth:2,d:"M29.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"}),g.createElement("path",{fill:"#6E6E70",stroke:"#F7F7FA",strokeWidth:2,d:"M34.218 6.385c-2.217-2.587-6.219-2.587-8.436 0a5.555 5.555 0 0 0 0 7.23c2.217 2.587 6.219 2.587 8.436 0a5.555 5.555 0 0 0 0-7.23Z"})),ly=({stage:e,...t})=>e.name==="archived"?i.jsx(JIe,{...t}):e.name==="pre-live"?i.jsx(YIe,{...t}):e.name==="live"?i.jsx(KIe,{...t}):e.name==="completed"?i.jsx(XIe,{...t}):i.jsx(qIe,{...t});var QR={},ZIe=je;Object.defineProperty(QR,"__esModule",{value:!0});var Zg=QR.default=void 0,QIe=ZIe(Ee()),eOe=i,tOe=(0,QIe.default)((0,eOe.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.5 14H8c-1.66 0-3-1.34-3-3s1.34-3 3-3l.14.01C8.58 8.28 10.13 7 12 7c2.21 0 4 1.79 4 4h.5c1.38 0 2.5 1.12 2.5 2.5S17.88 16 16.5 16z"}),"CloudCircle");Zg=QR.default=tOe;var eA={},nOe=je;Object.defineProperty(eA,"__esModule",{value:!0});var tA=eA.default=void 0,rOe=nOe(Ee()),oOe=i,sOe=(0,rOe.default)((0,oOe.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"}),"Lock");tA=eA.default=sOe;const iOe=()=>{throw new Error("hasAccess called outside AccessContext")},Bo=tt.createContext({isAdmin:!1,hasAccess:iOe}),ni="ADMIN",W4="CREATE_FEATURE",Qg="UPDATE_FEATURE",Eqt="UPDATE_FEATURE_DEPENDENCY",cQ="DELETE_FEATURE",V4="CREATE_STRATEGY",i3="UPDATE_STRATEGY",aOe="DELETE_STRATEGY",vN="UPDATE_APPLICATION",uQ="CREATE_CONTEXT_FIELD",lOe="UPDATE_CONTEXT_FIELD",wS="CREATE_PROJECT",cOe="UPDATE_PROJECT",uOe="DELETE_PROJECT",SS="CREATE_TAG_TYPE",dQ="UPDATE_TAG_TYPE",dOe="DELETE_TAG_TYPE",pOe="CREATE_ADDON",pQ="UPDATE_ADDON",fQ="DELETE_ADDON",fOe="DELETE_ENVIRONMENT",jS="UPDATE_ENVIRONMENT",Nv="CREATE_FEATURE_STRATEGY",wp="UPDATE_FEATURE_STRATEGY",hOe="DELETE_FEATURE_STRATEGY",hQ="UPDATE_FEATURE_ENVIRONMENT",gOe="UPDATE_FEATURE_ENVIRONMENT_VARIANTS",kqt="MOVE_FEATURE_TOGGLE",l7="CREATE_SEGMENT",nA="UPDATE_SEGMENT",mOe="DELETE_SEGMENT",Tqt="APPLY_CHANGE_REQUEST",Rqt="APPROVE_CHANGE_REQUEST",gQ="SKIP_CHANGE_REQUEST",Aqt="CREATE_PROJECT_API_TOKEN",Sp="UPDATE_PROJECT_SEGMENT",Pqt="PROJECT_USER_ACCESS_READ",_qt="PROJECT_DEFAULT_STRATEGY_READ",Iqt="PROJECT_CHANGE_REQUEST_READ",Oqt="PROJECT_SETTINGS_READ",Mqt="PROJECT_USER_ACCESS_WRITE",$qt="PROJECT_DEFAULT_STRATEGY_WRITE",Dqt="PROJECT_CHANGE_REQUEST_WRITE",Lqt="PROJECT_SETTINGS_WRITE",mQ=e=>{const{isEnterprise:t}=ut(),{data:n,error:r,mutate:o}=Ts(!!e&&t(),[],yt(`api/admin/projects/${e}/change-requests/config`),yOe);return{data:n||[],loading:!r&&!n,refetchChangeRequestConfig:o,error:r}},yOe=e=>fetch(e).then(en("Request changes")).then(t=>t.json()),vl=e=>{const{data:t}=mQ(e),n=d7(e),r=tt.useCallback(a=>n(gQ,a)?!1:t.some(c=>c.environment===a&&c.changeRequestEnabled),[JSON.stringify(t)]),o=tt.useCallback(a=>t.some(l=>l.environment===a&&l.changeRequestEnabled),[JSON.stringify(t)]),s=tt.useCallback(()=>t.some(a=>a.changeRequestEnabled),[JSON.stringify(t)]);return{isChangeRequestConfigured:r,isChangeRequestConfiguredInAnyEnv:s,isChangeRequestConfiguredForReview:o}},hg="ADMIN",xOe="CREATE_ADDON",vOe="UPDATE_ADDON",bOe="DELETE_ADDON",COe="UPDATE_CLIENT_API_TOKEN",wOe="CREATE_CLIENT_API_TOKEN",SOe="DELETE_CLIENT_API_TOKEN",yQ="READ_CLIENT_API_TOKEN",jOe="UPDATE_FRONTEND_API_TOKEN",EOe="CREATE_FRONTEND_API_TOKEN",kOe="DELETE_FRONTEND_API_TOKEN",xQ="READ_FRONTEND_API_TOKEN",TOe="UPDATE_APPLICATION",ES="CREATE_CONTEXT_FIELD",vQ="UPDATE_CONTEXT_FIELD",bQ="DELETE_CONTEXT_FIELD",ROe="CREATE_PROJECT",CQ="READ_ROLE",AOe="CREATE_SEGMENT",POe="UPDATE_SEGMENT",_Oe="DELETE_SEGMENT",IOe="CREATE_STRATEGY",OOe="UPDATE_STRATEGY",MOe="DELETE_STRATEGY",$Oe="CREATE_TAG_TYPE",DOe="UPDATE_TAG_TYPE",LOe="DELETE_TAG_TYPE",c7="READ_LOGS",wQ="UPDATE_MAINTENANCE_MODE",NOe="UPDATE_INSTANCE_BANNERS",FOe="UPDATE_CORS",BOe="UPDATE_AUTH_CONFIGURATION",zOe="CREATE_FEATURE",HOe="UPDATE_FEATURE",WOe="UPDATE_FEATURE_DEPENDENCY",VOe="DELETE_FEATURE",hu="UPDATE_PROJECT",UOe="DELETE_PROJECT",GOe="UPDATE_FEATURE_VARIANTS",qOe="MOVE_FEATURE_TOGGLE",YOe="READ_PROJECT_API_TOKEN",KOe="CREATE_PROJECT_API_TOKEN",XOe="DELETE_PROJECT_API_TOKEN",df="UPDATE_PROJECT_CONTEXT",JOe="UPDATE_PROJECT_SEGMENT",ZOe="CREATE_FEATURE_STRATEGY",rA="UPDATE_FEATURE_STRATEGY",oA="DELETE_FEATURE_STRATEGY",QOe="UPDATE_FEATURE_ENVIRONMENT_VARIANTS",eMe="UPDATE_FEATURE_ENVIRONMENT",tMe="PROJECT_USER_ACCESS_READ",nMe="PROJECT_DEFAULT_STRATEGY_READ",rMe="PROJECT_CHANGE_REQUEST_READ",oMe="PROJECT_SETTINGS_READ",sMe="PROJECT_USER_ACCESS_WRITE",iMe="PROJECT_DEFAULT_STRATEGY_WRITE",aMe="PROJECT_CHANGE_REQUEST_WRITE",lMe="PROJECT_SETTINGS_WRITE",u7="RELEASE_PLAN_TEMPLATE_CREATE",SQ="RELEASE_PLAN_TEMPLATE_UPDATE",sA="RELEASE_PLAN_TEMPLATE_DELETE",cMe=[{label:"Integration",permissions:[xOe,vOe,bOe]},{label:"API token",permissions:[COe,wOe,SOe,yQ,jOe,EOe,kOe,xQ]},{label:"Application",permissions:[TOe]},{label:"Context field",permissions:[ES,vQ,bQ]},{label:"Project",permissions:[ROe]},{label:"Role",permissions:[CQ]},{label:"Segment",permissions:[AOe,POe,_Oe]},{label:"Strategy",permissions:[IOe,OOe,MOe]},{label:"Tag type",permissions:[$Oe,DOe,LOe]},{label:"Release plan templates",permissions:[u7,sA,SQ]},{label:"Instance maintenance",permissions:[c7,wQ,NOe,FOe]},{label:"Authentication",permissions:[BOe]}],uMe=[hg,CQ,yQ,xQ,wQ,c7],Nqt=[{label:"Features and strategies",permissions:[[zOe],[HOe],[WOe],[VOe],[GOe],[qOe],[ZOe],[rA],[oA],[eMe],[QOe],[df],[JOe]]},{label:"Project settings",permissions:[[hu],[tMe,hu],[sMe,hu],[nMe,hu],[iMe,hu],[oMe,hu],[lMe,hu],[UOe]]},{label:"API tokens",permissions:[[YOe],[KOe],[XOe]]},{label:"Change requests",permissions:[[aMe,hu],[rMe,hu]]}],dMe=(e,t)=>{let n=e.data&&"permissions"in e.data?e.data.permissions:void 0;return n&&(t!=null&&t.maintenanceMode)&&(n=n.filter(r=>uMe.includes(r.permission))),n},jQ=()=>{const e=Yg(),{uiConfig:t}=ut();return{permissions:dMe(e,t),refetchPermissions:e.refetchAuth,loading:e.loading,error:e.error}},pMe=e=>{const t=()=>{const r=yt(`api/admin/projects/${e}/overview`);return fetch(r,{method:"GET"}).then(en("Project overview")).then(o=>o.json())},n=`api/admin/projects/${e}/overview`;return{fetcher:t,KEY:n}},bN={featureTypeCounts:[],environments:[],name:"",health:0,members:0,version:1,description:"Default",favorite:!1,mode:"open",defaultStickiness:"default",stats:{archivedCurrentWindow:0,archivedPastWindow:0,avgTimeToProdCurrentWindow:0,createdCurrentWindow:0,createdPastWindow:0,projectActivityCurrentWindow:0,projectActivityPastWindow:0,projectMembersAddedCurrentWindow:0},onboardingStatus:{status:"onboarded"}},e0=(e,t={})=>EQ(e,t),EQ=(e="",t={})=>{const{KEY:n,fetcher:r}=pMe(e),{data:o,error:s,mutate:a}=Ts(!!e,bN,n,r,t),l=g.useCallback(()=>{a()},[a]);return{project:o||bN,loading:!s&&!o,error:s,refetch:l}},fMe=e=>e0(e).project.name||e,Fqt=e=>{var t;return(t=e.featureTypeCounts)==null?void 0:t.map(n=>n.count).reduce((n,r)=>n+r,0)},d7=e=>{const{hasAccess:t}=g.useContext(Bo),n=(o,s,a)=>s&&a?t(o,s,a):s?t(o,s):t(o),r=(o,s,a)=>Array.isArray(o)?o.some(l=>n(l,s,a)):n(o,s,a);return(o,s)=>r(o,e,s)},hMe=e=>{const{isChangeRequestConfigured:t}=vl(e),n=d7(e);return(r,o)=>o&&t(o)||n(r,o)},gMe=[Nv,wp,hOe,hQ,gOe],mMe=(e,t)=>e.filter(n=>t.includes(n)).length>0,yMe=e=>{const{permissions:t}=jQ();return t?t.find(r=>r.project===e):!1},xMe=e=>{const t=yMe(e),{project:n}=e0(e);return n.mode==="protected"?t:!0},vMe=e=>mMe(gMe,[].concat(e)),bMe=(e,t,n)=>{const{isChangeRequestConfigured:r}=vl(t),o=r(n),s=xMe(t);return o&&s&&vMe(e)},gg=(e,t,n)=>{const r=d7(t);return bMe(e,t,n)||r(e,n)},pf=(e,t,n)=>d7(t)(e,n),CMe=v($e)({justifySelf:"start",alignSelf:"start","&.Mui-disabled":{pointerEvents:"auto"}}),wMe=(e,t,n)=>!e&&!n?i.jsx(tA,{titleAccess:"Locked"}):t||null,SMe=tt.forwardRef((e,t)=>{const n=gg(e.permission,e.projectId,e.environmentId);return i.jsx(kQ,{...e,access:n,ref:t})}),jMe=tt.forwardRef((e,t)=>{const n=pf(e.permission,e.projectId,e.environmentId);return i.jsx(kQ,{...e,access:n,ref:t})}),kQ=tt.forwardRef(({permission:e,access:t,variant:n="contained",color:r="primary",onClick:o,children:s,disabled:a,projectId:l,environmentId:c,tooltipProps:u,hideLockIcon:d,className:p,...f},h)=>{const m=a||!t,y=Yu(),b=wMe(t,f.endIcon,d),x=C=>{if(m){C.preventDefault(),C.stopPropagation();return}o==null||o(C)};return i.jsx(ra,{...u,title:iy(t,u==null?void 0:u.title),arrow:!0,children:i.jsx(CMe,{ref:h,onClick:x,"aria-disabled":m||void 0,"aria-labelledby":y,variant:n,color:r,className:m?`${p} Mui-disabled`:p,...f,endIcon:b,children:s})})}),lo=tt.forwardRef((e,t)=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?i.jsx(SMe,{...e,environmentId:e.environmentId,projectId:e.projectId,ref:t}):i.jsx(jMe,{...e,ref:t})),EMe=2;function kMe(e){const t=dJ(new Date,EMe);return e.every(n=>{const r=bi(n.lastSeenAt);return e2(r,t)})}const TQ=e=>e==="initial"?"Define":e==="pre-live"?"Develop":e==="live"?"Production":e==="completed"?"Cleanup":e==="archived"?"Archived":e,CN=v("span")(({theme:e})=>({color:e.palette.text.secondary})),Ic=v("p")(({theme:e})=>({paddingBottom:e.spacing(1),color:e.palette.text.primary})),TMe=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",marginBottom:e.spacing(2)})),wN=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",marginBottom:e.spacing(1.5),gap:e.spacing(1)})),RMe=v("footer")(({theme:e})=>({background:e.palette.neutral.light,color:e.palette.text.secondary,borderRadius:`0 0 ${e.shape.borderRadiusMedium}px ${e.shape.borderRadiusMedium}px`,margin:e.spacing(-1,-1.5),padding:e.spacing(2,3.5)})),AMe=v(ZR)(({theme:e})=>({width:e.spacing(2),height:e.spacing(2),marginRight:e.spacing(.75)})),PMe=({lastSeen:e})=>{const t=a7(),{text:n,background:r}=t(e);return i.jsx(AMe,{style:{background:r},children:i.jsx(JR,{stroke:n})})},_Me=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:e.spacing(1),marginBottom:e.spacing(1),marginLeft:e.spacing(3.5)})),IMe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.text.primary})),OMe=v(Zg)(({theme:e})=>({color:e.palette.primary.main,width:e.spacing(2.5),display:"block"})),kS=v(K)(({theme:e})=>({display:"flex",alignItems:"center"})),p7=v(K)(({theme:e})=>({marginTop:e.spacing(2)})),RQ=({environments:e})=>i.jsx(K,{children:e.map(t=>i.jsxs(_Me,{children:[i.jsx(kS,{children:i.jsx(K,{children:t.name})}),i.jsxs(kS,{children:[i.jsx(PMe,{lastSeen:t.lastSeenAt}),i.jsx(Kl,{date:t.lastSeenAt})]})]},t.name))}),iA=v(J)(({theme:e})=>({paddingTop:e.spacing(.5),marginBottom:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.smallerBody,fontWeight:e.typography.fontWeightBold})),MMe=({onComplete:e,loading:t,project:n})=>i.jsxs(p7,{children:[i.jsx(iA,{children:"Is this feature complete?"}),i.jsx(Ic,{sx:{mb:1},children:"Marking the feature flag as complete does not affect any configuration; however, it moves the flag to its next lifecycle stage and indicates that you have learned what you needed in order to progress."}),i.jsx(lo,{variant:"outlined",permission:Qg,size:"small",onClick:e,disabled:t,projectId:n,children:"Mark completed"})]}),$Me=({onComplete:e,loading:t,project:n})=>i.jsxs(p7,{children:[i.jsx(iA,{children:"Ready for cleanup?"}),i.jsx(Ic,{sx:{mb:1},children:"If this flag is no longer needed and ready to be removed from the code, you can mark it as ready for cleanup. This helps reduce technical debt."}),i.jsx(lo,{variant:"outlined",permission:Qg,size:"small",onClick:e,disabled:t,projectId:n,children:"Mark ready for cleanup"})]}),DMe=({onArchive:e,onUncomplete:t,loading:n,project:r})=>i.jsxs(p7,{children:[i.jsx(iA,{children:"Safe to archive"}),i.jsx(Ic,{children:"We haven’t seen this feature flag in any environment for at least two days. It’s likely that it’s safe to archive this flag."}),i.jsxs(K,{sx:o=>({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:o.spacing(2),marginTop:o.spacing(1)}),children:[i.jsx(lo,{variant:"outlined",permission:Qg,size:"small",onClick:t,disabled:n,projectId:r,children:"Revert to previous stage"}),i.jsx(lo,{variant:"outlined",permission:cQ,size:"small",sx:{mb:2},onClick:e,projectId:r,children:"Archive feature"})]})]}),LMe=({onUncomplete:e,loading:t})=>i.jsxs(p7,{children:[i.jsx(Ic,{children:"This feature has been successfully completed, but we are still seeing usage. Clean up the feature flag from your code before archiving it."}),i.jsx(Ic,{children:"If you think this feature was completed too early you can revert to the previous stage."}),i.jsx(lo,{variant:"outlined",permission:Qg,size:"small",sx:{mb:2},onClick:e,disabled:t,children:"Revert to previous stage"})]}),NMe=({environments:e,onArchive:t,onUncomplete:n,loading:r,project:o})=>kMe(e)?i.jsx(DMe,{onArchive:t,onUncomplete:n,loading:r,project:o}):i.jsx(LMe,{onUncomplete:n,loading:r}),FMe=({time:e})=>{const{locationSettings:t}=$r();return i.jsx("span",{children:ji(e,t.locale)})},BMe=({time:e})=>{const t=bi(e),n=nJ(t,{addSuffix:!1});return i.jsx("span",{children:n})},zMe=({stage:e})=>e==="initial"?i.jsx(Ic,{children:"Feature flag has been created, but we have not seen any metrics yet."}):e==="pre-live"?i.jsx(Ic,{children:"Feature is being developed and tested in controlled environments."}):e==="live"?i.jsx(Ic,{children:"Feature is being rolled out in production according to an activation strategy."}):e==="completed"?i.jsx(Ic,{children:"When a flag is no longer needed, clean up the code to minimize technical debt and archive the flag for future reference."}):e==="archived"?i.jsx(Ic,{children:"Flag is archived in Unleash for future reference."}):null,HMe=({stage:e})=>i.jsxs(i.Fragment,{children:[i.jsxs(IMe,{children:[i.jsx(OMe,{})," ",e.environments&&e.environments.length>0?`Seen in environment${e.environments.length>1?"s":""}`:"Not seen in any environments"]}),e.environments&&e.environments.length>0?i.jsx(RQ,{environments:e.environments}):null]}),WMe=({children:e,stage:t,project:n,onArchive:r,onComplete:o,onUncomplete:s,loading:a})=>i.jsx(wr,{maxHeight:800,maxWidth:350,arrow:!0,tabIndex:0,title:i.jsxs(K,{children:[i.jsxs(K,{sx:l=>({padding:l.spacing(2)}),children:[i.jsxs(TMe,{children:[i.jsx(J,{variant:"h3",children:"Lifecycle"}),i.jsxs(K,{sx:{display:"flex",alignItems:"center",gap:1},children:[i.jsx(J,{variant:"body2",children:TQ(t.name)}),i.jsx(ly,{stage:t})]})]}),i.jsx(zMe,{stage:t.name}),i.jsxs(wN,{children:[i.jsx(CN,{children:"Stage entered at"}),i.jsx(FMe,{time:t.enteredStageAt})]}),i.jsxs(wN,{children:[i.jsx(CN,{children:"Time spent in stage"}),i.jsx(BMe,{time:t.enteredStageAt})]})]}),t.name!=="archived"?i.jsxs(RMe,{children:[i.jsx(HMe,{stage:t}),t.name==="live"&&o?i.jsx(MMe,{onComplete:o,loading:a,project:n,children:i.jsx(RQ,{environments:t.environments})}):null,t.name==="completed"&&r&&s?i.jsx(NMe,{environments:t.environments,onArchive:r,onUncomplete:s,loading:a,project:n}):null,(t.name==="initial"||t.name==="pre-live")&&o?i.jsx($Me,{onComplete:o,loading:a,project:n}):null]}):null]}),children:i.jsx(kS,{children:e})}),VMe=e=>{if(!e.lifecycle)return;const t=r=>(e.environments||[]).filter(o=>r(o)&&!!o.lastSeenAt).map(o=>({name:o.name,lastSeenAt:o.lastSeenAt})),n=e.lifecycle.enteredStageAt;switch(e.lifecycle.stage){case"initial":return{name:"initial",enteredStageAt:n};case"pre-live":return{name:"pre-live",environments:t(r=>r.type!=="production"||r.type==="production"&&!r.enabled),enteredStageAt:n};case"live":return{name:"live",environments:t(r=>r.type==="production"&&r.enabled),enteredStageAt:n};case"completed":return{name:"completed",status:e.lifecycle.status==="discarded"?"discarded":"kept",environments:t(()=>!0),enteredStageAt:n};case"archived":return{name:"archived",enteredStageAt:n};default:return}},UMe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{markFeatureCompleted:async(a,l,c)=>{const u=`api/admin/projects/${l}/features/${a}/lifecycle/complete`,d=t(u,{method:"POST",body:JSON.stringify(c)});return e(d.caller,d.id)},markFeatureUncompleted:async(a,l)=>{const c=`api/admin/projects/${l}/features/${a}/lifecycle/uncomplete`,u=t(c,{method:"POST"});return e(u.caller,u.id)},errors:n,loading:r}},GMe=({feature:e,project:t,onChange:n})=>{const{trackEvent:r}=zt(),{setToastApiError:o}=_t(),{markFeatureUncompleted:s,loading:a}=UMe();return{onUncompleteHandler:async()=>{try{await s(e,t),n==null||n(),r("feature-lifecycle",{props:{eventType:"uncomplete"}})}catch(c){o(pt(c))}},loading:a}},qMe=({feature:e,expanded:t,onComplete:n,onUncomplete:r,onArchive:o})=>{const s=VMe(e),{onUncompleteHandler:a,loading:l}=GMe({feature:e.name,project:e.project,onChange:r});return s?i.jsxs(K,{sx:c=>({display:"flex",gap:c.spacing(.5)}),children:[i.jsx(WMe,{stage:s,project:e.project,onArchive:o,onComplete:n,onUncomplete:r?a:void 0,loading:l,children:i.jsx(ly,{stage:s})})," ",i.jsx("p",{children:t?TQ(s.name):null})]}):null},AQ=({feature:e,...t})=>{const n=e.environments?Object.values(e.environments):[];return i.jsx(GIe,{featureLastSeen:e.lastSeenAt||void 0,environments:n,...t})},YMe=({feature:e,onComplete:t,onUncomplete:n,onArchive:r,expanded:o,...s})=>i.jsx(K,{sx:a=>({display:"flex",justifyContent:o?"flex-start":"center",padding:a.spacing(0,o?2:0)}),children:i.jsx(qMe,{onArchive:r,onComplete:t,onUncomplete:n,feature:e,expanded:o})}),Bqt=tt.memo(AQ),Zr=(e={})=>{const t=`api/admin/projects${e.archived?"?archived=true":""}`,n=()=>{const c=yt(t);return fetch(c,{method:"GET"}).then(en("Projects")).then(u=>u.json())},{data:r,error:o}=On(t,n,e),[s,a]=g.useState(!o&&!r),l=()=>{Fo(t)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{projects:(r==null?void 0:r.projects)||[],error:o,loading:s,refetch:l}},od=e=>{const t=yt("api/admin/segments"),{data:n,error:r,mutate:o}=On(t,()=>KMe(t),{refreshInterval:15*1e3}),s=g.useCallback(()=>{o().catch(console.warn)},[o]);return{segments:n,refetchSegments:s,loading:!r&&!n,error:r}},KMe=async e=>fetch(e).then(en("Segments")).then(t=>t.json()).then(t=>t.segments),XMe=(e={})=>{const t=async()=>{const c=yt("api/admin/tags");return(await fetch(c,{method:"GET"}).then(en("Tags"))).json()},n="api/admin/tags",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=()=>{Fo(n)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{tags:(r==null?void 0:r.tags)||[],error:o,loading:s,refetch:l}},JMe=v($e)(({theme:e})=>({padding:e.spacing(0,1.25,0,1.25),height:e.spacing(3.75)})),ZMe=v(Lhe)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),QMe=v(Ta)(({theme:e})=>({color:e.palette.action.active,"&.material-symbols-outlined":{fontSize:e.spacing(2)}})),e$e=({visibleOptions:e,hiddenOptions:t,onSelectedOptionsChange:n,availableFilters:r})=>{const[o,s]=g.useState(null),a=u=>{s(u.currentTarget)},l=()=>{s(null)},c=u=>{n([...t,u]),l()};return i.jsxs("div",{children:[i.jsx(JMe,{onClick:a,startIcon:i.jsx(UR,{}),children:"Add filter"}),i.jsx(jf,{id:"simple-menu","data-testid":Yje,anchorEl:o,keepMounted:!0,open:!!o,onClose:l,children:e.map(u=>{const d=r.find(p=>p.label===u);return i.jsx(wn,{onClick:()=>c(u),children:i.jsxs(ZMe,{children:[i.jsx(QMe,{children:d==null?void 0:d.icon}),u]})},u)})})]})},t$e=v("div")(({theme:e})=>({padding:e.spacing(1.5),display:"flex",flexDirection:"column",gap:e.spacing(1),maxHeight:"70vh"})),n$e=v(Or)(({theme:e})=>({paddingLeft:e.spacing(1),cursor:"pointer","&:hover, &:focus":{backgroundColor:e.palette.action.hover,outline:"none"}})),r$e=v(Si)(({theme:e})=>({padding:e.spacing(1,1,1,1.5)})),PQ=v(ql)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:`${e.shape.borderRadiusMedium}px`}})),o$e=v(xn)(({theme:e})=>({"& .MuiInputBase-root":{padding:e.spacing(0,1.5),borderRadius:`${e.shape.borderRadiusMedium}px`},"& .MuiInputBase-input":{padding:e.spacing(.75,0),fontSize:e.typography.body2.fontSize}}));var aA={},s$e=je;Object.defineProperty(aA,"__esModule",{value:!0});var lA=aA.default=void 0,i$e=s$e(Ee()),a$e=i,l$e=(0,i$e.default)((0,a$e.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");lA=aA.default=l$e;const c$e=v("button")(({theme:e})=>({borderRadius:0,border:"none",cursor:"pointer",color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,padding:e.spacing(0,.75),margin:e.spacing(0,0,0,.75),height:e.spacing(3),display:"flex",alignItems:"center",backgroundColor:"transparent","&:hover":{backgroundColor:e.palette.action.hover,color:e.palette.text.primary}})),u$e=v(jf)(({theme:e})=>({transform:`translateY(${e.spacing(.5)})`})),SN=e=>e.replaceAll("_"," ").toLocaleLowerCase(),d$e=({options:e,value:t,onChange:n})=>{const[r,o]=g.useState(null),s=()=>{o(null)},a=c=>{c.stopPropagation(),o(c.currentTarget)},l=c=>u=>{u.stopPropagation(),n(c),s()};return i.jsxs(i.Fragment,{children:[i.jsx(c$e,{onClick:a,children:SN(t)}),i.jsx(u$e,{anchorEl:r,open:!!r,onClose:s,anchorPosition:{left:0,top:1},onClick:c=>c.stopPropagation(),children:e.map(c=>i.jsx(wn,{onClick:l(c),children:SN(c)},c))})]})},p$e=v(({isActive:e,...t})=>i.jsx(Ti,{"data-testid":Kje,...t}))(({theme:e,isActive:t=!1})=>({borderRadius:`${e.shape.borderRadius}px`,padding:0,fontSize:e.typography.body2.fontSize,height:"auto",...t?{backgroundColor:e.palette.secondary.light}:{},":focus-visible":{outline:`1px solid ${e.palette.primary.main}`,borderColor:e.palette.primary.main}})),f$e=v("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",fontWeight:e.typography.fontWeightBold,minHeight:e.spacing(3.5)})),h$e=v("button")(({theme:e})=>({color:e.palette.text.primary,fontWeight:e.typography.fontWeightRegular,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",maxWidth:"200px",[e.breakpoints.up("md")]:{maxWidth:"800px"},border:"none",cursor:"pointer",backgroundColor:"transparent","&:hover":{backgroundColor:e.palette.action.hover},height:e.spacing(3)})),g$e=v(Mt)(({theme:e})=>({marginLeft:e.spacing(.5),marginRight:e.spacing(-1.25)})),m$e=()=>i.jsx(lA,{fontSize:"small",color:"action",sx:e=>({marginRight:e.spacing(-1),marginLeft:e.spacing(.5)})}),_Q=({name:e,label:t,selectedDisplayOptions:n=[],operatorOptions:r,operator:o,onChangeOperator:s,onClick:a,onDelete:l})=>{const c=n.length>0,u=2,d=n.slice(0,u),p=n.length-u,{trackEvent:f}=zt(),h=m=>{s(m),f("search-filter",{props:{label:e,operator:m}})};return i.jsx(p$e,{isActive:c,label:i.jsxs(f$e,{children:[t,i.jsx(te,{condition:!c,show:()=>i.jsx(m$e,{}),elseShow:()=>i.jsxs(i.Fragment,{children:[i.jsx(d$e,{options:r,value:o,onChange:h}),i.jsxs(h$e,{children:[d.join(", "),p>0?` +${p}`:""]})]})}),i.jsx(te,{condition:!!l,show:()=>i.jsx(g$e,{"aria-label":"delete",color:"primary",onClick:m=>{m.preventDefault(),m.stopPropagation(),l==null||l()},size:"small",children:i.jsx(bo,{fontSize:"inherit",color:"action"})})})]}),color:"primary",variant:"outlined",onClick:a})},f7=typeof window<"u"?g.useLayoutEffect:g.useEffect;let jN=0;function y$e(e){const[t,n]=g.useState(e),r=t;return g.useEffect(()=>{t==null&&(jN+=1,n(`mui-${jN}`))},[t]),r}const x$e={...E2},EN=x$e.useId;function v$e(e){return EN!==void 0?EN():y$e(e)}function mg(e){const{controlled:t,default:n,name:r,state:o="value"}=e,{current:s}=g.useRef(t!==void 0),[a,l]=g.useState(n),c=s?t:a,u=g.useCallback(d=>{s||l(d)},[]);return[c,u]}function Mr(e){const t=g.useRef(e);return f7(()=>{t.current=e}),g.useRef((...n)=>(0,t.current)(...n)).current}function cA(...e){const t=g.useRef(void 0),n=g.useCallback(r=>{const o=e.map(s=>{if(s==null)return null;if(typeof s=="function"){const a=s,l=a(r);return typeof l=="function"?l:()=>{a(null)}}return s.current=r,()=>{s.current=null}});return()=>{o.forEach(s=>s==null?void 0:s())}},e);return g.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}function Ql(e,t,n=void 0){const r={};for(const o in e){const s=e[o];let a="",l=!0;for(let c=0;c<s.length;c+=1){const u=s[c];u&&(a+=(l===!0?"":" ")+t(u),l=!1,n&&n[u]&&(a+=" "+n[u]))}r[o]=a}return r}const kN=e=>e,b$e=()=>{let e=kN;return{configure(t){e=t},generate(t){return e(t)},reset(){e=kN}}},C$e=b$e(),w$e={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function bl(e,t,n="Mui"){const r=w$e[t];return r?`${n}-${r}`:`${C$e.generate(e)}-${t}`}function ec(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=bl(e,o,n)}),r}function S$e(e){return typeof e=="string"}function j$e(e,t,n){return e===void 0||S$e(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function E$e(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function TN(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function k$e(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:s}=e;if(!t){const h=Oe(n==null?void 0:n.className,s,o==null?void 0:o.className,r==null?void 0:r.className),m={...n==null?void 0:n.style,...o==null?void 0:o.style,...r==null?void 0:r.style},y={...n,...o,...r};return h.length>0&&(y.className=h),Object.keys(m).length>0&&(y.style=m),{props:y,internalRef:void 0}}const a=E$e({...o,...r}),l=TN(r),c=TN(o),u=t(a),d=Oe(u==null?void 0:u.className,n==null?void 0:n.className,s,o==null?void 0:o.className,r==null?void 0:r.className),p={...u==null?void 0:u.style,...n==null?void 0:n.style,...o==null?void 0:o.style,...r==null?void 0:r.style},f={...u,...n,...c,...l};return d.length>0&&(f.className=d),Object.keys(p).length>0&&(f.style=p),{props:f,internalRef:u.ref}}function T$e(e,t,n){return typeof e=="function"?e(t,n):e}function Nc(e){var p;const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:o=!1,...s}=e,a=o?{}:T$e(n,r),{props:l,internalRef:c}=k$e({...s,externalSlotProps:a}),u=cA(c,a==null?void 0:a.ref,(p=e.additionalProps)==null?void 0:p.ref);return j$e(t,{...l,ref:u},r)}const R$e=["localeText"],TS=g.createContext(null),A$e=function(t){const{localeText:n}=t,r=He(t,R$e),{utils:o,localeText:s}=g.useContext(TS)??{utils:void 0,localeText:void 0},a=ht({props:r,name:"MuiLocalizationProvider"}),{children:l,dateAdapter:c,dateFormats:u,dateLibInstance:d,adapterLocale:p,localeText:f}=a,h=g.useMemo(()=>D({},f,s,n),[f,s,n]),m=g.useMemo(()=>{if(!c)return o||null;const x=new c({locale:p,formats:u,instance:d});if(!x.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation"].join(`
296
296
  `));return x},[c,p,u,d,o]),y=g.useMemo(()=>m?{minDate:m.date("1900-01-01T00:00:00.000"),maxDate:m.date("2099-12-31T00:00:00.000")}:null,[m]),b=g.useMemo(()=>({utils:m,defaultDates:y,localeText:h}),[y,m,h]);return i.jsx(TS.Provider,{value:b,children:l})},P$e=e=>({components:{MuiLocalizationProvider:{defaultProps:{localeText:D({},e)}}}}),IQ={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:e=>e==="year"?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",clockLabelText:(e,t,n,r)=>`Select ${e}. ${!r&&(t===null||!n.isValid(t))?"No time selected":`Selected time is ${r??n.format(t,"fullTime")}`}`,hoursClockNumberText:e=>`${e} hours`,minutesClockNumberText:e=>`${e} minutes`,secondsClockNumberText:e=>`${e} seconds`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:(e,t,n)=>n||e!==null&&t.isValid(e)?`Choose date, selected date is ${n??t.format(e,"fullDate")}`:"Choose date",openTimePickerDialogue:(e,t,n)=>n||e!==null&&t.isValid(e)?`Choose time, selected time is ${n??t.format(e,"fullTime")}`:"Choose time",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:e=>"Y".repeat(e.digitAmount),fieldMonthPlaceholder:e=>e.contentType==="letter"?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:e=>e.contentType==="letter"?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"},_$e=IQ;P$e(IQ);const h7=()=>{const e=g.useContext(TS);if(e===null)throw new Error(["MUI X: Can not find the date and time pickers localization context.","It looks like you forgot to wrap your component in LocalizationProvider.","This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package"].join(`
297
297
  `));if(e.utils===null)throw new Error(["MUI X: Can not find the date and time pickers adapter from its localization context.","It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider."].join(`
298
- `));const t=g.useMemo(()=>D({},_$e,e.localeText),[e.localeText]);return g.useMemo(()=>D({},e,{localeText:t}),[e,t])},_i=()=>h7().utils,uA=()=>h7().defaultDates,g7=e=>{const t=_i(),n=g.useRef(void 0);return n.current===void 0&&(n.current=t.date(void 0,e)),n.current},OQ=()=>h7().localeText,I$e=Qr(i.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),O$e=Qr(i.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),M$e=Qr(i.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");Qr(i.jsx("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}),"Calendar");Qr(i.jsxs(g.Fragment,{children:[i.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),i.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");Qr(i.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRange");Qr(i.jsxs(g.Fragment,{children:[i.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),i.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time");Qr(i.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");function $$e(e){return bl("MuiPickersArrowSwitcher",e)}ec("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const D$e=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],L$e=["ownerState"],N$e=["ownerState"],F$e=v("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),B$e=v("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),RN=v(Mt,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),z$e=e=>{const{classes:t}=e;return Ql({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},$$e,t)},H$e=g.forwardRef(function(t,n){const r=g5(),o=ht({props:t,name:"MuiPickersArrowSwitcher"}),{children:s,className:a,slots:l,slotProps:c,isNextDisabled:u,isNextHidden:d,onGoToNext:p,nextLabel:f,isPreviousDisabled:h,isPreviousHidden:m,onGoToPrevious:y,previousLabel:b,labelId:x}=o,C=He(o,D$e),w=o,j=z$e(w),k={isDisabled:u,isHidden:d,goTo:p,label:f},S={isDisabled:h,isHidden:m,goTo:y,label:b},E=(l==null?void 0:l.previousIconButton)??RN,T=Nc({elementType:E,externalSlotProps:c==null?void 0:c.previousIconButton,additionalProps:{size:"medium",title:S.label,"aria-label":S.label,disabled:S.isDisabled,edge:"end",onClick:S.goTo},ownerState:D({},w,{hidden:S.isHidden}),className:Oe(j.button,j.previousIconButton)}),R=(l==null?void 0:l.nextIconButton)??RN,_=Nc({elementType:R,externalSlotProps:c==null?void 0:c.nextIconButton,additionalProps:{size:"medium",title:k.label,"aria-label":k.label,disabled:k.isDisabled,edge:"start",onClick:k.goTo},ownerState:D({},w,{hidden:k.isHidden}),className:Oe(j.button,j.nextIconButton)}),M=(l==null?void 0:l.leftArrowIcon)??O$e,$=Nc({elementType:M,externalSlotProps:c==null?void 0:c.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:w,className:j.leftArrowIcon}),z=He($,L$e),A=(l==null?void 0:l.rightArrowIcon)??M$e,O=Nc({elementType:A,externalSlotProps:c==null?void 0:c.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:w,className:j.rightArrowIcon}),L=He(O,N$e);return i.jsxs(F$e,D({ref:n,className:Oe(j.root,a),ownerState:w},C,{children:[i.jsx(E,D({},T,{children:r?i.jsx(A,D({},L)):i.jsx(M,D({},z))})),s?i.jsx(J,{variant:"subtitle1",component:"span",id:x,children:s}):i.jsx(B$e,{className:j.spacer,ownerState:w}),i.jsx(R,D({},_,{children:r?i.jsx(M,D({},z)):i.jsx(A,D({},L))}))]}))}),AN=(e,t)=>t.getHours(e)*3600+t.getMinutes(e)*60+t.getSeconds(e),W$e=(e,t)=>(n,r)=>e?t.isAfter(n,r):AN(n,t)>AN(r,t);function V$e({onChange:e,onViewChange:t,openTo:n,view:r,views:o,autoFocus:s,focusedView:a,onFocusedViewChange:l}){const c=g.useRef(n),u=g.useRef(o),d=g.useRef(o.includes(n)?n:o[0]),[p,f]=mg({name:"useViews",state:"view",controlled:r,default:d.current}),h=g.useRef(s?p:null),[m,y]=mg({name:"useViews",state:"focusedView",controlled:a,default:h.current});g.useEffect(()=>{(c.current&&c.current!==n||u.current&&u.current.some(E=>!o.includes(E)))&&(f(o.includes(n)?n:o[0]),u.current=o,c.current=n)},[n,f,p,o]);const b=o.indexOf(p),x=o[b-1]??null,C=o[b+1]??null,w=Mr((E,T)=>{y(T?E:R=>E===R?null:R),l==null||l(E,T)}),j=Mr(E=>{w(E,!0),E!==p&&(f(E),t&&t(E))}),k=Mr(()=>{C&&j(C)}),S=Mr((E,T,R)=>{const _=T==="finish",M=R?o.indexOf(R)<o.length-1:!!C;if(e(E,_&&M?"partial":T,R),R&&R!==p){const z=o[o.indexOf(R)+1];z&&j(z)}else _&&k()});return{view:p,setView:j,focusedView:m,setFocusedView:w,nextView:C,previousView:x,defaultView:o.includes(n)?n:o[0],goToNextView:k,setValueAndGoToNextView:S}}function U$e(e,{disableFuture:t,maxDate:n,timezone:r}){const o=_i();return g.useMemo(()=>{const s=o.date(void 0,r),a=o.startOfMonth(t&&o.isBefore(s,n)?s:n);return!o.isAfter(a,e)},[t,n,e,o,r])}function G$e(e,{disablePast:t,minDate:n,timezone:r}){const o=_i();return g.useMemo(()=>{const s=o.date(void 0,r),a=o.startOfMonth(t&&o.isAfter(s,n)?s:n);return!o.isBefore(a,e)},[t,n,e,o,r])}const a3=36,m7=2,dA=320,q$e=280,MQ=336,Y$e=v("div")({overflow:"hidden",width:dA,maxHeight:MQ,display:"flex",flexDirection:"column",margin:"0 auto"}),U4=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n)),r},o2=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:s,utils:a,timezone:l})=>{const c=U4(a,a.date(void 0,l),e);n&&a.isBefore(o,c)&&(o=c),t&&a.isAfter(r,c)&&(r=c);let u=e,d=e;for(a.isBefore(e,o)&&(u=o,d=null),a.isAfter(e,r)&&(d&&(d=r),u=null);u||d;){if(u&&a.isAfter(u,r)&&(u=null),d&&a.isBefore(d,o)&&(d=null),u){if(!s(u))return u;u=a.addDays(u,1)}if(d){if(!s(d))return d;d=a.addDays(d,-1)}}return null},K$e=(e,t)=>t==null||!e.isValid(t)?null:t,jp=(e,t,n)=>t==null||!e.isValid(t)?n:t,X$e=(e,t,n)=>!e.isValid(t)&&t!=null&&!e.isValid(n)&&n!=null?!0:e.isEqual(t,n),J$e=(e,t)=>{const r=[e.startOfYear(t)];for(;r.length<12;){const o=r[r.length-1];r.push(e.addMonths(o,1))}return r},$Q=(e,t,n)=>n==="date"?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),Z$e=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(r=>e.addDays(n,r))},Q$e=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:o,valueManager:s})=>{const a=_i(),l=g.useRef(n),c=t??l.current??s.emptyValue,u=g.useMemo(()=>s.getTimezone(a,c),[a,s,c]),d=Mr(m=>u==null?m:s.setTimezone(a,u,m));let p;e?p=e:u?p=u:r?p=a.getTimezone(r):p="default";const f=g.useMemo(()=>s.setTimezone(a,p,c),[s,a,p,c]),h=Mr((m,...y)=>{const b=d(m);o==null||o(b,...y)});return{value:f,handleValueChange:h,timezone:p}},pA=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:o,onChange:s,valueManager:a})=>{const[l,c]=mg({name:e,state:"value",controlled:n,default:r??a.emptyValue}),u=Mr((d,...p)=>{c(d),s==null||s(d,...p)});return Q$e({timezone:t,value:l,defaultValue:void 0,referenceDate:o,onChange:u,valueManager:a})},ku={year:1,month:2,day:3,minutes:5,seconds:6,milliseconds:7},Q0=(e,t,n)=>{if(t===ku.year)return e.startOfYear(n);if(t===ku.month)return e.startOfMonth(n);if(t===ku.day)return e.startOfDay(n);let r=n;return t<ku.minutes&&(r=e.setMinutes(r,0)),t<ku.seconds&&(r=e.setSeconds(r,0)),t<ku.milliseconds&&(r=e.setMilliseconds(r,0)),r},eDe=({props:e,utils:t,granularity:n,timezone:r,getTodayDate:o})=>{let s=o?o():Q0(t,n,$Q(t,r));e.minDate!=null&&t.isAfterDay(e.minDate,s)&&(s=Q0(t,n,e.minDate)),e.maxDate!=null&&t.isBeforeDay(e.maxDate,s)&&(s=Q0(t,n,e.maxDate));const a=W$e(e.disableIgnoringDatePartForTimeValidation??!1,t);return e.minTime!=null&&a(e.minTime,s)&&(s=Q0(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:U4(t,s,e.minTime))),e.maxTime!=null&&a(s,e.maxTime)&&(s=Q0(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:U4(t,s,e.maxTime))),s},tDe=["value","referenceDate"],ff={emptyValue:null,getTodayValue:$Q,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=He(e,tDe);return t!=null&&r.utils.isValid(t)?t:n??eDe(r)},cleanValue:K$e,areValuesEqual:X$e,isSameError:(e,t)=>e===t,hasError:e=>e!=null,defaultErrorState:null,getTimezone:(e,t)=>t==null||!e.isValid(t)?null:e.getTimezone(t),setTimezone:(e,t,n)=>n==null?null:e.setTimezone(n,t)};function nDe(e){return bl("MuiPickersDay",e)}const u1=ec("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),rDe=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],oDe=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:s,outsideCurrentMonth:a,showDaysOutsideCurrentMonth:l,classes:c}=e,u=a&&!l;return Ql({root:["root",t&&!u&&"selected",s&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",a&&l&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},nDe,c)},DQ=({theme:e})=>D({},e.typography.caption,{width:a3,height:a3,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:Wt(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${u1.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${u1.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${u1.disabled}:not(.${u1.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${u1.disabled}&.${u1.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${m7}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${u1.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),LQ=(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.today&&t.today,!n.outsideCurrentMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.outsideCurrentMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},sDe=v(ta,{name:"MuiPickersDay",slot:"Root",overridesResolver:LQ})(DQ),iDe=v("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:LQ})(({theme:e})=>D({},DQ({theme:e}),{opacity:0,pointerEvents:"none"})),em=()=>{},aDe=g.forwardRef(function(t,n){const r=ht({props:t,name:"MuiPickersDay"}),{autoFocus:o=!1,className:s,day:a,disabled:l=!1,disableHighlightToday:c=!1,disableMargin:u=!1,isAnimating:d,onClick:p,onDaySelect:f,onFocus:h=em,onBlur:m=em,onKeyDown:y=em,onMouseDown:b=em,onMouseEnter:x=em,outsideCurrentMonth:C,selected:w=!1,showDaysOutsideCurrentMonth:j=!1,children:k,today:S=!1}=r,E=He(r,rDe),T=D({},r,{autoFocus:o,disabled:l,disableHighlightToday:c,disableMargin:u,selected:w,showDaysOutsideCurrentMonth:j,today:S}),R=oDe(T),_=_i(),M=g.useRef(null),$=cA(M,n);f7(()=>{o&&!l&&!d&&!C&&M.current.focus()},[o,l,d,C]);const z=O=>{b(O),C&&O.preventDefault()},A=O=>{l||f(a),C&&O.currentTarget.focus(),p&&p(O)};return C&&!j?i.jsx(iDe,{className:Oe(R.root,R.hiddenDaySpacingFiller,s),ownerState:T,role:E.role}):i.jsx(sDe,D({className:Oe(R.root,s),ref:$,centerRipple:!0,disabled:l,tabIndex:w?0:-1,onKeyDown:O=>y(O,a),onFocus:O=>h(O,a),onBlur:O=>m(O,a),onMouseEnter:O=>x(O,a),onClick:A,onMouseDown:z},E,{ownerState:T,children:k||_.format(a,"dayOfMonth")}))}),lDe=g.memo(aDe),NQ=({props:e,value:t,timezone:n,adapter:r})=>{if(t===null)return null;const{shouldDisableDate:o,shouldDisableMonth:s,shouldDisableYear:a,disablePast:l,disableFuture:c}=e,u=r.utils.date(void 0,n),d=jp(r.utils,e.minDate,r.defaultDates.minDate),p=jp(r.utils,e.maxDate,r.defaultDates.maxDate);switch(!0){case!r.utils.isValid(t):return"invalidDate";case!!(o&&o(t)):return"shouldDisableDate";case!!(s&&s(t)):return"shouldDisableMonth";case!!(a&&a(t)):return"shouldDisableYear";case!!(c&&r.utils.isAfterDay(t,u)):return"disableFuture";case!!(l&&r.utils.isBeforeDay(t,u)):return"disablePast";case!!(d&&r.utils.isBeforeDay(t,d)):return"minDate";case!!(p&&r.utils.isAfterDay(t,p)):return"maxDate";default:return null}};NQ.valueManager=ff;const FQ=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:s,disablePast:a,timezone:l})=>{const c=h7();return g.useCallback(u=>NQ({adapter:c,value:u,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:s,disablePast:a}})!==null,[c,e,t,n,r,o,s,a,l])},cDe=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return D({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const s=o.newTimezone;if(n.getTimezone(r.currentMonth)===s)return r;let a=n.setTimezone(r.currentMonth,s);return n.getMonth(a)!==n.getMonth(r.currentMonth)&&(a=n.setMonth(a,n.getMonth(r.currentMonth))),D({},r,{currentMonth:a})}case"finishMonthSwitchingAnimation":return D({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const s=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return D({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:s&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:s?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},uDe=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:s=!1,maxDate:a,minDate:l,onMonthChange:c,reduceAnimations:u,shouldDisableDate:d,timezone:p}=e,f=_i(),h=g.useRef(cDe(!!u,s,f)).current,m=g.useMemo(()=>ff.getInitialReferenceValue({value:t,utils:f,timezone:p,props:e,referenceDate:n,granularity:ku.day}),[n,p]),[y,b]=g.useReducer(h,{isMonthSwitchingAnimating:!1,focusedDay:m,currentMonth:f.startOfMonth(m),slideDirection:"left"});g.useEffect(()=>{b({type:"changeMonthTimezone",newTimezone:f.getTimezone(m)})},[m,f]);const x=g.useCallback(S=>{b(D({type:"changeMonth"},S)),c&&c(S.newMonth)},[c]),C=g.useCallback(S=>{const E=S;f.isSameMonth(E,y.currentMonth)||x({newMonth:f.startOfMonth(E),direction:f.isAfterDay(E,y.currentMonth)?"left":"right"})},[y.currentMonth,x,f]),w=FQ({shouldDisableDate:d,minDate:l,maxDate:a,disableFuture:r,disablePast:o,timezone:p}),j=g.useCallback(()=>{b({type:"finishMonthSwitchingAnimation"})},[]),k=Mr((S,E)=>{w(S)||b({type:"changeFocusedDay",focusedDay:S,withoutMonthSwitchingAnimation:E})});return{referenceDate:m,calendarState:y,changeMonth:C,changeFocusedDay:k,isDateDisabled:w,onMonthSwitchingAnimationEnd:j,handleChangeMonth:x}},dDe=e=>bl("MuiPickersFadeTransitionGroup",e);ec("MuiPickersFadeTransitionGroup",["root"]);const pDe=e=>{const{classes:t}=e;return Ql({root:["root"]},dDe,t)},fDe=v(H3,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function BQ(e){const t=ht({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:s}=t,a=pDe(t),l=Bt();return o?n:i.jsx(fDe,{className:Oe(a.root,r),children:i.jsx(zg,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:l.transitions.duration.enteringScreen,enter:l.transitions.duration.enteringScreen,exit:0},children:n},s)})}const hDe=e=>bl("MuiPickersSlideTransition",e),za=ec("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),gDe=["children","className","reduceAnimations","slideDirection","transKey","classes"],mDe=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return Ql(r,hDe,t)},yDe=v(H3,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${za["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${za["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${za.slideEnterActive}`]:t.slideEnterActive},{[`.${za.slideExit}`]:t.slideExit},{[`.${za["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${za["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{const t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${za["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${za["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${za.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${za.slideExit}`]:{transform:"translate(0%)"},[`& .${za["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${za["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function xDe(e){const t=ht({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:s}=t,a=He(t,gDe),l=mDe(t),c=Bt();if(o)return i.jsx("div",{className:Oe(l.root,r),children:n});const u={exit:l.exit,enterActive:l.enterActive,enter:l.enter,exitActive:l.exitActive};return i.jsx(yDe,{className:Oe(l.root,r),childFactory:d=>g.cloneElement(d,{classNames:u}),role:"presentation",children:i.jsx(bk,D({mountOnEnter:!0,unmountOnExit:!0,timeout:c.transitions.duration.complex,classNames:u},a,{children:n}),s)})}const vDe=e=>bl("MuiDayCalendar",e);ec("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const bDe=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],CDe=["ownerState"],wDe=e=>{const{classes:t}=e;return Ql({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},vDe,t)},zQ=(a3+m7*2)*6,SDe=v("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),jDe=v("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),EDe=v(J,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(e,t)=>t.weekDayLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),kDe=v(J,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(e,t)=>t.weekNumberLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),TDe=v(J,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>D({},e.typography.caption,{width:a3,height:a3,padding:0,margin:`0 ${m7}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),RDe=v("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:zQ}),ADe=v(xDe,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:zQ}),PDe=v("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),_De=v("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${m7}px 0`,display:"flex",justifyContent:"center"});function IDe(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:s,currentMonthNumber:a,isViewFocused:l}=e,c=He(e,bDe);const{disabled:u,disableHighlightToday:d,isMonthSwitchingAnimating:p,showDaysOutsideCurrentMonth:f,slots:h,slotProps:m,timezone:y}=t,b=_i(),x=g7(y),C=r!==null&&b.isSameDay(n,r),w=o.some($=>b.isSameDay($,n)),j=b.isSameDay(n,x),k=(h==null?void 0:h.day)??lDe,S=Nc({elementType:k,externalSlotProps:m==null?void 0:m.day,additionalProps:D({disableHighlightToday:d,showDaysOutsideCurrentMonth:f,role:"gridcell",isAnimating:p,"data-timestamp":b.toJsDate(n).valueOf()},c),ownerState:D({},t,{day:n,selected:w})}),E=He(S,CDe),T=g.useMemo(()=>u||s(n),[u,s,n]),R=g.useMemo(()=>b.getMonth(n)!==a,[b,n,a]),_=g.useMemo(()=>{const $=b.startOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.startOfWeek($)):b.isSameDay(n,$)},[a,n,f,b]),M=g.useMemo(()=>{const $=b.endOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.endOfWeek($)):b.isSameDay(n,$)},[a,n,f,b]);return i.jsx(k,D({},E,{day:n,disabled:T,autoFocus:l&&C,today:j,outsideCurrentMonth:R,isFirstVisibleCell:_,isLastVisibleCell:M,selected:w,tabIndex:C?0:-1,"aria-selected":w,"aria-current":j?"date":void 0}))}function ODe(e){const t=ht({props:e,name:"MuiDayCalendar"}),n=_i(),{onFocusedDayChange:r,className:o,currentMonth:s,selectedDays:a,focusedDay:l,loading:c,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:d,readOnly:p,reduceAnimations:f,renderLoading:h=()=>i.jsx("span",{children:"..."}),slideDirection:m,TransitionProps:y,disablePast:b,disableFuture:x,minDate:C,maxDate:w,shouldDisableDate:j,shouldDisableMonth:k,shouldDisableYear:S,dayOfWeekFormatter:E=be=>n.format(be,"weekdayShort").charAt(0).toUpperCase(),hasFocus:T,onFocusedViewChange:R,gridLabelId:_,displayWeekNumber:M,fixedWeekNumber:$,autoFocus:z,timezone:A}=t,O=g7(A),L=wDe(t),B=g5(),H=FQ({shouldDisableDate:j,shouldDisableMonth:k,shouldDisableYear:S,minDate:C,maxDate:w,disablePast:b,disableFuture:x,timezone:A}),N=OQ(),[I,q]=mg({name:"DayCalendar",state:"hasFocus",controlled:T,default:z??!1}),[ne,V]=g.useState(()=>l||O),oe=Mr(be=>{p||u(be)}),se=be=>{H(be)||(r(be),V(be),R==null||R(!0),q(!0))},ae=Mr((be,ze)=>{switch(be.key){case"ArrowUp":se(n.addDays(ze,-7)),be.preventDefault();break;case"ArrowDown":se(n.addDays(ze,7)),be.preventDefault();break;case"ArrowLeft":{const xe=n.addDays(ze,B?1:-1),qe=n.addMonths(ze,B?1:-1),Ve=o2({utils:n,date:xe,minDate:B?xe:n.startOfMonth(qe),maxDate:B?n.endOfMonth(qe):xe,isDateDisabled:H,timezone:A});se(Ve||xe),be.preventDefault();break}case"ArrowRight":{const xe=n.addDays(ze,B?-1:1),qe=n.addMonths(ze,B?-1:1),Ve=o2({utils:n,date:xe,minDate:B?n.startOfMonth(qe):xe,maxDate:B?xe:n.endOfMonth(qe),isDateDisabled:H,timezone:A});se(Ve||xe),be.preventDefault();break}case"Home":se(n.startOfWeek(ze)),be.preventDefault();break;case"End":se(n.endOfWeek(ze)),be.preventDefault();break;case"PageUp":se(n.addMonths(ze,1)),be.preventDefault();break;case"PageDown":se(n.addMonths(ze,-1)),be.preventDefault();break}}),me=Mr((be,ze)=>se(ze)),ce=Mr((be,ze)=>{I&&n.isSameDay(ne,ze)&&(R==null||R(!1))}),_e=n.getMonth(s),we=n.getYear(s),Me=g.useMemo(()=>a.filter(be=>!!be).map(be=>n.startOfDay(be)),[n,a]),Fe=`${we}-${_e}`,Ge=g.useMemo(()=>g.createRef(),[Fe]),Re=g.useMemo(()=>{const be=n.startOfMonth(s),ze=n.endOfMonth(s);return H(ne)||n.isAfterDay(ne,ze)||n.isBeforeDay(ne,be)?o2({utils:n,date:ne,minDate:be,maxDate:ze,disablePast:b,disableFuture:x,isDateDisabled:H,timezone:A}):ne},[s,x,b,ne,H,n,A]),Be=g.useMemo(()=>{const be=n.getWeekArray(s);let ze=n.addMonths(s,1);for(;$&&be.length<$;){const xe=n.getWeekArray(ze),qe=n.isSameDay(be[be.length-1][0],xe[0][0]);xe.slice(qe?1:0).forEach(Ve=>{be.length<$&&be.push(Ve)}),ze=n.addMonths(ze,1)}return be},[s,$,n]);return i.jsxs(SDe,{role:"grid","aria-labelledby":_,className:L.root,children:[i.jsxs(jDe,{role:"row",className:L.header,children:[M&&i.jsx(kDe,{variant:"caption",role:"columnheader","aria-label":N.calendarWeekNumberHeaderLabel,className:L.weekNumberLabel,children:N.calendarWeekNumberHeaderText}),Z$e(n,O).map((be,ze)=>i.jsx(EDe,{variant:"caption",role:"columnheader","aria-label":n.format(be,"weekday"),className:L.weekDayLabel,children:E(be)},ze.toString()))]}),c?i.jsx(RDe,{className:L.loadingContainer,children:h()}):i.jsx(ADe,D({transKey:Fe,onExited:d,reduceAnimations:f,slideDirection:m,className:Oe(o,L.slideTransition)},y,{nodeRef:Ge,children:i.jsx(PDe,{ref:Ge,role:"rowgroup",className:L.monthContainer,children:Be.map((be,ze)=>i.jsxs(_De,{role:"row",className:L.weekContainer,"aria-rowindex":ze+1,children:[M&&i.jsx(TDe,{className:L.weekNumber,role:"rowheader","aria-label":N.calendarWeekNumberAriaLabelText(n.getWeekNumber(be[0])),children:N.calendarWeekNumberText(n.getWeekNumber(be[0]))}),be.map((xe,qe)=>i.jsx(IDe,{parentProps:t,day:xe,selectedDays:Me,focusableDay:Re,onKeyDown:ae,onFocus:me,onBlur:ce,onDaySelect:oe,isDateDisabled:H,currentMonthNumber:_e,isViewFocused:I,"aria-colindex":qe+1},xe.toString()))]},`week-${be[0]}`))})}))]})}function MDe(e){return bl("MuiPickersMonth",e)}const Mx=ec("MuiPickersMonth",["root","monthButton","disabled","selected"]),$De=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],DDe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ql({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},MDe,r)},LDe=v("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),NDe=v("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Mx.disabled}`]:t.disabled},{[`&.${Mx.selected}`]:t.selected}]})(({theme:e})=>D({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Mx.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Mx.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),FDe=g.memo(function(t){const n=ht({props:t,name:"MuiPickersMonth"}),{autoFocus:r,className:o,children:s,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":m,"aria-label":y,slots:b,slotProps:x}=n,C=He(n,$De),w=g.useRef(null),j=DDe(n);f7(()=>{var E;r&&((E=w.current)==null||E.focus())},[r]);const k=(b==null?void 0:b.monthButton)??NDe,S=Nc({elementType:k,externalSlotProps:x==null?void 0:x.monthButton,additionalProps:{children:s,disabled:a,tabIndex:u,ref:w,type:"button",role:"radio","aria-current":m,"aria-checked":l,"aria-label":y,onClick:E=>d(E,c),onKeyDown:E=>p(E,c),onFocus:E=>f(E,c),onBlur:E=>h(E,c)},ownerState:n,className:j.monthButton});return i.jsx(LDe,D({className:Oe(j.root,o),ownerState:n},C,{children:i.jsx(k,D({},S))}))});function BDe(e){return bl("MuiMonthCalendar",e)}ec("MuiMonthCalendar",["root"]);const zDe=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],HDe=e=>{const{classes:t}=e;return Ql({root:["root"]},BDe,t)};function WDe(e,t){const n=_i(),r=uA(),o=ht({props:e,name:t});return D({disableFuture:!1,disablePast:!1},o,{minDate:jp(n,o.minDate,r.minDate),maxDate:jp(n,o.maxDate,r.maxDate)})}const VDe=v("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:dA,boxSizing:"border-box"}),UDe=g.forwardRef(function(t,n){const r=WDe(t,"MuiMonthCalendar"),{className:o,value:s,defaultValue:a,referenceDate:l,disabled:c,disableFuture:u,disablePast:d,maxDate:p,minDate:f,onChange:h,shouldDisableMonth:m,readOnly:y,autoFocus:b=!1,onMonthFocus:x,hasFocus:C,onFocusedViewChange:w,monthsPerRow:j=3,timezone:k,gridLabelId:S,slots:E,slotProps:T}=r,R=He(r,zDe),{value:_,handleValueChange:M,timezone:$}=pA({name:"MonthCalendar",timezone:k,value:s,defaultValue:a,referenceDate:l,onChange:h,valueManager:ff}),z=g7($),A=g5(),O=_i(),L=g.useMemo(()=>ff.getInitialReferenceValue({value:_,utils:O,props:r,timezone:$,referenceDate:l,granularity:ku.month}),[]),B=r,H=HDe(B),N=g.useMemo(()=>O.getMonth(z),[O,z]),I=g.useMemo(()=>_!=null?O.getMonth(_):null,[_,O]),[q,ne]=g.useState(()=>I||O.getMonth(L)),[V,oe]=mg({name:"MonthCalendar",state:"hasFocus",controlled:C,default:b??!1}),se=Mr(Fe=>{oe(Fe),w&&w(Fe)}),ae=g.useCallback(Fe=>{const Ge=O.startOfMonth(d&&O.isAfter(z,f)?z:f),Re=O.startOfMonth(u&&O.isBefore(z,p)?z:p),Be=O.startOfMonth(Fe);return O.isBefore(Be,Ge)||O.isAfter(Be,Re)?!0:m?m(Be):!1},[u,d,p,f,z,m,O]),me=Mr((Fe,Ge)=>{if(y)return;const Re=O.setMonth(_??L,Ge);M(Re)}),ce=Mr(Fe=>{ae(O.setMonth(_??L,Fe))||(ne(Fe),se(!0),x&&x(Fe))});g.useEffect(()=>{ne(Fe=>I!==null&&Fe!==I?I:Fe)},[I]);const _e=Mr((Fe,Ge)=>{switch(Fe.key){case"ArrowUp":ce((12+Ge-3)%12),Fe.preventDefault();break;case"ArrowDown":ce((12+Ge+3)%12),Fe.preventDefault();break;case"ArrowLeft":ce((12+Ge+(A?1:-1))%12),Fe.preventDefault();break;case"ArrowRight":ce((12+Ge+(A?-1:1))%12),Fe.preventDefault();break}}),we=Mr((Fe,Ge)=>{ce(Ge)}),Me=Mr((Fe,Ge)=>{q===Ge&&se(!1)});return i.jsx(VDe,D({ref:n,className:Oe(H.root,o),ownerState:B,role:"radiogroup","aria-labelledby":S},R,{children:J$e(O,_??L).map(Fe=>{const Ge=O.getMonth(Fe),Re=O.format(Fe,"monthShort"),Be=O.format(Fe,"month"),be=Ge===I,ze=c||ae(Fe);return i.jsx(FDe,{selected:be,value:Ge,onClick:me,onKeyDown:_e,autoFocus:V&&Ge===q,disabled:ze,tabIndex:Ge===q&&!ze?0:-1,onFocus:we,onBlur:Me,"aria-current":N===Ge?"date":void 0,"aria-label":Be,monthsPerRow:j,slots:E,slotProps:T,children:Re},Re)})}))});function GDe(e){return bl("MuiPickersYear",e)}const $x=ec("MuiPickersYear",["root","yearButton","selected","disabled"]),qDe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],YDe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ql({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},GDe,r)},KDe=v("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),XDe=v("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${$x.disabled}`]:t.disabled},{[`&.${$x.selected}`]:t.selected}]})(({theme:e})=>D({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:Wt(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${$x.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${$x.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),JDe=g.memo(function(t){const n=ht({props:t,name:"MuiPickersYear"}),{autoFocus:r,className:o,children:s,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":m,slots:y,slotProps:b}=n,x=He(n,qDe),C=g.useRef(null),w=YDe(n);f7(()=>{var S;r&&((S=C.current)==null||S.focus())},[r]);const j=(y==null?void 0:y.yearButton)??XDe,k=Nc({elementType:j,externalSlotProps:b==null?void 0:b.yearButton,additionalProps:{children:s,disabled:a,tabIndex:u,ref:C,type:"button",role:"radio","aria-current":m,"aria-checked":l,onClick:S=>d(S,c),onKeyDown:S=>p(S,c),onFocus:S=>f(S,c),onBlur:S=>h(S,c)},ownerState:n,className:w.yearButton});return i.jsx(KDe,D({className:Oe(w.root,o),ownerState:n},x,{children:i.jsx(j,D({},k))}))});function ZDe(e){return bl("MuiYearCalendar",e)}ec("MuiYearCalendar",["root"]);const QDe=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],eLe=e=>{const{classes:t}=e;return Ql({root:["root"]},ZDe,t)};function tLe(e,t){const n=_i(),r=uA(),o=ht({props:e,name:t});return D({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:jp(n,o.minDate,r.minDate),maxDate:jp(n,o.maxDate,r.maxDate)})}const nLe=v("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:dA,maxHeight:q$e,boxSizing:"border-box",position:"relative"}),rLe=g.forwardRef(function(t,n){const r=tLe(t,"MuiYearCalendar"),{autoFocus:o,className:s,value:a,defaultValue:l,referenceDate:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onChange:m,readOnly:y,shouldDisableYear:b,onYearFocus:x,hasFocus:C,onFocusedViewChange:w,yearsOrder:j="asc",yearsPerRow:k,timezone:S,gridLabelId:E,slots:T,slotProps:R}=r,_=He(r,QDe),{value:M,handleValueChange:$,timezone:z}=pA({name:"YearCalendar",timezone:S,value:a,defaultValue:l,referenceDate:c,onChange:m,valueManager:ff}),A=g7(z),O=g5(),L=_i(),B=g.useMemo(()=>ff.getInitialReferenceValue({value:M,utils:L,props:r,timezone:z,referenceDate:c,granularity:ku.year}),[]),H=r,N=eLe(H),I=g.useMemo(()=>L.getYear(A),[L,A]),q=g.useMemo(()=>M!=null?L.getYear(M):null,[M,L]),[ne,V]=g.useState(()=>q||L.getYear(B)),[oe,se]=mg({name:"YearCalendar",state:"hasFocus",controlled:C,default:o??!1}),ae=Mr(xe=>{se(xe),w&&w(xe)}),me=g.useCallback(xe=>{if(p&&L.isBeforeYear(xe,A)||d&&L.isAfterYear(xe,A)||h&&L.isBeforeYear(xe,h)||f&&L.isAfterYear(xe,f))return!0;if(!b)return!1;const qe=L.startOfYear(xe);return b(qe)},[d,p,f,h,A,b,L]),ce=Mr((xe,qe)=>{if(y)return;const Ve=L.setYear(M??B,qe);$(Ve)}),_e=Mr(xe=>{me(L.setYear(M??B,xe))||(V(xe),ae(!0),x==null||x(xe))});g.useEffect(()=>{V(xe=>q!==null&&xe!==q?q:xe)},[q]);const we=j!=="desc"?k*1:k*-1,Me=O&&j==="asc"||!O&&j==="desc"?-1:1,Fe=Mr((xe,qe)=>{switch(xe.key){case"ArrowUp":_e(qe-we),xe.preventDefault();break;case"ArrowDown":_e(qe+we),xe.preventDefault();break;case"ArrowLeft":_e(qe-Me),xe.preventDefault();break;case"ArrowRight":_e(qe+Me),xe.preventDefault();break}}),Ge=Mr((xe,qe)=>{_e(qe)}),Re=Mr((xe,qe)=>{ne===qe&&ae(!1)}),Be=g.useRef(null),be=cA(n,Be);g.useEffect(()=>{if(o||Be.current===null)return;const xe=Be.current.querySelector('[tabindex="0"]');if(!xe)return;const qe=xe.offsetHeight,Ve=xe.offsetTop,et=Be.current.clientHeight,dt=Be.current.scrollTop,at=Ve+qe;qe>et||Ve<dt||(Be.current.scrollTop=at-et/2-qe/2)},[o]);const ze=L.getYearRange([h,f]);return j==="desc"&&ze.reverse(),i.jsx(nLe,D({ref:be,className:Oe(N.root,s),ownerState:H,role:"radiogroup","aria-labelledby":E},_,{children:ze.map(xe=>{const qe=L.getYear(xe),Ve=qe===q,et=u||me(xe);return i.jsx(JDe,{selected:Ve,value:qe,onClick:ce,onKeyDown:Fe,autoFocus:oe&&qe===ne,disabled:et,tabIndex:qe===ne&&!et?0:-1,onFocus:Ge,onBlur:Re,"aria-current":I===qe?"date":void 0,yearsPerRow:k,slots:T,slotProps:R,children:L.format(xe,"year")},L.format(xe,"year"))})}))}),oLe=e=>bl("MuiPickersCalendarHeader",e),sLe=ec("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),iLe=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],aLe=["ownerState"],lLe=e=>{const{classes:t}=e;return Ql({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},oLe,t)},cLe=v("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),uLe=v("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>D({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),dLe=v("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),pLe=v(Mt,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${sLe.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),fLe=v(I$e,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),hLe=g.forwardRef(function(t,n){const r=OQ(),o=_i(),s=ht({props:t,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:l,currentMonth:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onMonthChange:m,onViewChange:y,view:b,reduceAnimations:x,views:C,labelId:w,className:j,timezone:k,format:S=`${o.formats.month} ${o.formats.year}`}=s,E=He(s,iLe),T=s,R=lLe(s),_=(a==null?void 0:a.switchViewButton)??pLe,M=Nc({elementType:_,externalSlotProps:l==null?void 0:l.switchViewButton,additionalProps:{size:"small","aria-label":r.calendarViewSwitchingButtonAriaLabel(b)},ownerState:T,className:R.switchViewButton}),$=(a==null?void 0:a.switchViewIcon)??fLe,z=Nc({elementType:$,externalSlotProps:l==null?void 0:l.switchViewIcon,ownerState:T,className:R.switchViewIcon}),A=He(z,aLe),O=()=>m(o.addMonths(c,1),"left"),L=()=>m(o.addMonths(c,-1),"right"),B=U$e(c,{disableFuture:d,maxDate:f,timezone:k}),H=G$e(c,{disablePast:p,minDate:h,timezone:k}),N=()=>{if(!(C.length===1||!y||u))if(C.length===2)y(C.find(q=>q!==b)||C[0]);else{const q=C.indexOf(b)!==0?0:1;y(C[q])}};if(C.length===1&&C[0]==="year")return null;const I=o.formatByString(c,S);return i.jsxs(cLe,D({},E,{ownerState:T,className:Oe(R.root,j),ref:n,children:[i.jsxs(uLe,{role:"presentation",onClick:N,ownerState:T,"aria-live":"polite",className:R.labelContainer,children:[i.jsx(BQ,{reduceAnimations:x,transKey:I,children:i.jsx(dLe,{id:w,ownerState:T,className:R.label,children:I})}),C.length>1&&!u&&i.jsx(_,D({},M,{children:i.jsx($,D({},A))}))]}),i.jsx(zg,{in:b==="day",appear:!x,enter:!x,children:i.jsx(H$e,{slots:a,slotProps:l,onGoToPrevious:L,isPreviousDisabled:H,previousLabel:r.previousMonth,onGoToNext:O,isNextDisabled:B,nextLabel:r.nextMonth})})]}))}),gLe="@media (prefers-reduced-motion: reduce)",Hh=typeof navigator<"u"&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),PN=Hh&&Hh[1]?parseInt(Hh[1],10):null,_N=Hh&&Hh[2]?parseInt(Hh[2],10):null,mLe=PN&&PN<10||_N&&_N<13||!1,yLe=()=>Nn(gLe,{defaultMatches:!1})||mLe,xLe=e=>bl("MuiDateCalendar",e);ec("MuiDateCalendar",["root","viewTransitionContainer"]);const vLe=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],bLe=e=>{const{classes:t}=e;return Ql({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},xLe,t)};function CLe(e,t){const n=_i(),r=uA(),o=yLe(),s=ht({props:e,name:t});return D({},s,{loading:s.loading??!1,disablePast:s.disablePast??!1,disableFuture:s.disableFuture??!1,openTo:s.openTo??"day",views:s.views??["year","day"],reduceAnimations:s.reduceAnimations??o,renderLoading:s.renderLoading??(()=>i.jsx("span",{children:"..."})),minDate:jp(n,s.minDate,r.minDate),maxDate:jp(n,s.maxDate,r.maxDate)})}const wLe=v(Y$e,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:MQ}),SLe=v(BQ,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),jLe=g.forwardRef(function(t,n){const r=_i(),o=v$e(),s=CLe(t,"MuiDateCalendar"),{autoFocus:a,onViewChange:l,value:c,defaultValue:u,referenceDate:d,disableFuture:p,disablePast:f,onChange:h,onYearChange:m,onMonthChange:y,reduceAnimations:b,shouldDisableDate:x,shouldDisableMonth:C,shouldDisableYear:w,view:j,views:k,openTo:S,className:E,disabled:T,readOnly:R,minDate:_,maxDate:M,disableHighlightToday:$,focusedView:z,onFocusedViewChange:A,showDaysOutsideCurrentMonth:O,fixedWeekNumber:L,dayOfWeekFormatter:B,slots:H,slotProps:N,loading:I,renderLoading:q,displayWeekNumber:ne,yearsOrder:V,yearsPerRow:oe,monthsPerRow:se,timezone:ae}=s,me=He(s,vLe),{value:ce,handleValueChange:_e,timezone:we}=pA({name:"DateCalendar",timezone:ae,value:c,defaultValue:u,referenceDate:d,onChange:h,valueManager:ff}),{view:Me,setView:Fe,focusedView:Ge,setFocusedView:Re,goToNextView:Be,setValueAndGoToNextView:be}=V$e({view:j,views:k,openTo:S,onChange:_e,onViewChange:l,autoFocus:a,focusedView:z,onFocusedViewChange:A}),{referenceDate:ze,calendarState:xe,changeFocusedDay:qe,changeMonth:Ve,handleChangeMonth:et,isDateDisabled:dt,onMonthSwitchingAnimationEnd:at}=uDe({value:ce,referenceDate:d,reduceAnimations:b,onMonthChange:y,minDate:_,maxDate:M,shouldDisableDate:x,disablePast:f,disableFuture:p,timezone:we}),rt=T&&ce||_,Ae=T&&ce||M,Ye=`${o}-grid-label`,fe=Ge!==null,ge=(H==null?void 0:H.calendarHeader)??hLe,ye=Nc({elementType:ge,externalSlotProps:N==null?void 0:N.calendarHeader,additionalProps:{views:k,view:Me,currentMonth:xe.currentMonth,onViewChange:Fe,onMonthChange:(gt,tn)=>et({newMonth:gt,direction:tn}),minDate:rt,maxDate:Ae,disabled:T,disablePast:f,disableFuture:p,reduceAnimations:b,timezone:we,labelId:Ye},ownerState:s}),Xe=Mr(gt=>{const tn=r.startOfMonth(gt),pn=r.endOfMonth(gt),jn=dt(gt)?o2({utils:r,date:gt,minDate:r.isBefore(_,tn)?tn:_,maxDate:r.isAfter(M,pn)?pn:M,disablePast:f,disableFuture:p,isDateDisabled:dt,timezone:we}):gt;jn?(be(jn,"finish"),y==null||y(tn)):(Be(),Ve(tn)),qe(jn,!0)}),ot=Mr(gt=>{const tn=r.startOfYear(gt),pn=r.endOfYear(gt),jn=dt(gt)?o2({utils:r,date:gt,minDate:r.isBefore(_,tn)?tn:_,maxDate:r.isAfter(M,pn)?pn:M,disablePast:f,disableFuture:p,isDateDisabled:dt,timezone:we}):gt;jn?(be(jn,"finish"),m==null||m(jn)):(Be(),Ve(tn)),qe(jn,!0)}),jt=Mr(gt=>_e(gt&&U4(r,gt,ce??ze),"finish",Me));g.useEffect(()=>{ce!=null&&r.isValid(ce)&&Ve(ce)},[ce]);const Ke=s,bt=bLe(Ke),Ue={disablePast:f,disableFuture:p,maxDate:M,minDate:_},Qe={disableHighlightToday:$,readOnly:R,disabled:T,timezone:we,gridLabelId:Ye,slots:H,slotProps:N},mt=g.useRef(Me);g.useEffect(()=>{mt.current!==Me&&(Ge===mt.current&&Re(Me,!0),mt.current=Me)},[Ge,Re,Me]);const Kt=g.useMemo(()=>[ce],[ce]);return i.jsxs(wLe,D({ref:n,className:Oe(bt.root,E),ownerState:Ke},me,{children:[i.jsx(ge,D({},ye,{slots:H,slotProps:N})),i.jsx(SLe,{reduceAnimations:b,className:bt.viewTransitionContainer,transKey:Me,ownerState:Ke,children:i.jsxs("div",{children:[Me==="year"&&i.jsx(rLe,D({},Ue,Qe,{value:ce,onChange:ot,shouldDisableYear:w,hasFocus:fe,onFocusedViewChange:gt=>Re("year",gt),yearsOrder:V,yearsPerRow:oe,referenceDate:ze})),Me==="month"&&i.jsx(UDe,D({},Ue,Qe,{hasFocus:fe,className:E,value:ce,onChange:Xe,shouldDisableMonth:C,onFocusedViewChange:gt=>Re("month",gt),monthsPerRow:se,referenceDate:ze})),Me==="day"&&i.jsx(ODe,D({},xe,Ue,Qe,{onMonthSwitchingAnimationEnd:at,onFocusedDayChange:qe,reduceAnimations:b,selectedDays:Kt,onSelectedDaysChange:jt,shouldDisableDate:x,shouldDisableMonth:C,shouldDisableYear:w,hasFocus:fe,onFocusedViewChange:gt=>Re("day",gt),showDaysOutsideCurrentMonth:O,fixedWeekNumber:L,dayOfWeekFormatter:B,displayWeekNumber:ne,loading:I,renderLoading:q}))]})})]}))}),ELe={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},kLe={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime:"p",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime:"P p",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class TLe{constructor(t){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=ELe,this.escapedCharacters={start:"'",end:"'"},this.longFormatters=void 0,this.date=a=>typeof a>"u"?new Date:a===null?null:new Date(a),this.getInvalidDate=()=>new Date("Invalid Date"),this.getTimezone=()=>"default",this.setTimezone=a=>a,this.toJsDate=a=>a,this.getCurrentLocaleCode=()=>this.locale.code,this.is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"})),this.expandFormat=a=>{const l=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;return a.match(l).map(c=>{const u=c[0];if(u==="p"||u==="P"){const d=this.longFormatters[u];return d(c,this.locale.formatLong)}return c}).join("")},this.formatNumber=a=>a,this.getDayOfWeek=a=>a.getDay()+1;const{locale:n,formats:r,longFormatters:o,lib:s}=t;this.locale=n,this.formats=D({},kLe,r),this.longFormatters=o,this.lib=s||"date-fns"}}class RLe extends TLe{constructor({locale:t,formats:n}={}){super({locale:t??kf,formats:n,longFormatters:$4}),this.parse=(r,o)=>r===""?null:cJ(r,o,new Date,{locale:this.locale}),this.isValid=r=>r==null?!1:J3(r),this.format=(r,o)=>this.formatByString(r,this.formats[o]),this.formatByString=(r,o)=>Jo(r,o,{locale:this.locale}),this.isEqual=(r,o)=>r===null&&o===null?!0:r===null||o===null?!1:ACe(r,o),this.isSameYear=(r,o)=>Awe(r,o),this.isSameMonth=(r,o)=>Twe(r,o),this.isSameDay=(r,o)=>Kk(r,o),this.isSameHour=(r,o)=>Ewe(r,o),this.isAfter=(r,o)=>Bh(r,o),this.isAfterYear=(r,o)=>Bh(r,r3(o)),this.isAfterDay=(r,o)=>Bh(r,O4(o)),this.isBefore=(r,o)=>e2(r,o),this.isBeforeYear=(r,o)=>e2(r,this.startOfYear(o)),this.isBeforeDay=(r,o)=>e2(r,this.startOfDay(o)),this.isWithinRange=(r,[o,s])=>Iwe(r,{start:o,end:s}),this.startOfYear=r=>o3(r),this.startOfMonth=r=>M4(r),this.startOfWeek=r=>Zs(r,{locale:this.locale}),this.startOfDay=r=>Gu(r),this.endOfYear=r=>r3(r),this.endOfMonth=r=>n3(r),this.endOfWeek=r=>JX(r,{locale:this.locale}),this.endOfDay=r=>O4(r),this.addYears=(r,o)=>Yk(r,o),this.addMonths=(r,o)=>Ug(r,o),this.addWeeks=(r,o)=>qk(r,o),this.addDays=(r,o)=>zp(r,o),this.addHours=(r,o)=>WX(r,o),this.addMinutes=(r,o)=>Gg(r,o),this.addSeconds=(r,o)=>YX(r,o),this.getYear=r=>RCe(r),this.getMonth=r=>kCe(r),this.getDate=r=>bCe(r),this.getHours=r=>wCe(r),this.getMinutes=r=>ECe(r),this.getSeconds=r=>TCe(r),this.getMilliseconds=r=>jCe(r),this.setYear=(r,o)=>nSe(r,o),this.setMonth=(r,o)=>Xwe(r,o),this.setDate=(r,o)=>Jwe(r,o),this.setHours=(r,o)=>Zwe(r,o),this.setMinutes=(r,o)=>eSe(r,o),this.setSeconds=(r,o)=>tSe(r,o),this.setMilliseconds=(r,o)=>Qwe(r,o),this.getDaysInMonth=r=>oJ(r),this.getWeekArray=r=>{const o=this.startOfWeek(this.startOfMonth(r)),s=this.endOfWeek(this.endOfMonth(r));let a=0,l=o;const c=[];for(;this.isBefore(l,s);){const u=Math.floor(a/7);c[u]=c[u]||[],c[u].push(l),l=this.addDays(l,1),a+=1}return c},this.getWeekNumber=r=>nT(r,{locale:this.locale}),this.getYearRange=([r,o])=>{const s=this.startOfYear(r),a=this.endOfYear(o),l=[];let c=s;for(;this.isBefore(c,a);)l.push(c),c=this.addYears(c,1);return l}}}const ALe=(e,t=new Date)=>{let n,r;switch(e){case"thisMonth":{n=M4(t),r=n3(t);break}case"thisQuarter":{n=Xw(t),r=Jw(t);break}case"previousQuarter":{const o=oSe(t,1);n=Xw(o),r=Jw(o);break}case"thisYear":{n=o3(t),r=r3(t);break}case"previousYear":{const o=fJ(t,1);n=o3(o),r=r3(o);break}default:{const o=G5(t,1);n=M4(o),r=n3(o)}}return[Jo(n,"yyyy-MM-dd"),Jo(r,"yyyy-MM-dd")]},PLe=v(J)(({theme:e})=>({paddingLeft:e.spacing(2),paddingBottom:e.spacing(1)})),_Le=({onRangeChange:e})=>{const t=n=>()=>{const[r,o]=ALe(n);e({from:{operator:"IS",values:[r]},to:{operator:"IS",values:[o]}})};return i.jsxs(K,{children:[i.jsx(PLe,{variant:"h3",children:"Presets"}),i.jsxs(Ri,{disablePadding:!0,sx:{pb:2},children:[i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("thisMonth"),children:"This month"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("previousMonth"),children:"Previous month"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("thisQuarter"),children:"This quarter"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("previousQuarter"),children:"Previous quarter"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("thisYear"),children:"This year"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("previousYear"),children:"Previous year"})})]})]})},ILe=({name:e,label:t,onChange:n,onRangeChange:r,onChipClose:o,state:s,operators:a,initMode:l="auto-open"})=>{const c=g.useRef(null),[u,d]=g.useState(null),{locationSettings:p}=$r(),f=()=>d(c.current),h=()=>d(null);g.useEffect(()=>{!s&&l==="auto-open"&&f()},[]);const m=s?[RR(s.values[0],p.locale)||""]:[],y=s?new Date(s.values[0]):null,b=s?s.operator:a[0],x=o?()=>{n({operator:a[0],values:[]}),h(),o()}:void 0;return g.useEffect(()=>{s&&!a.includes(s.operator)&&n({operator:a[0],values:s.values})},[s]),i.jsxs(i.Fragment,{children:[i.jsx(K,{ref:c,children:i.jsx(_Q,{label:t,name:e,selectedDisplayOptions:m,onDelete:x,onClick:f,operator:b,operatorOptions:a,onChangeOperator:C=>{const w=y?Jo(y,"yyyy-MM-dd"):"";n({operator:C,values:[w]})}})}),i.jsx(PQ,{open:!!u,anchorEl:u,onClose:h,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:i.jsxs(A$e,{dateAdapter:RLe,children:[i.jsx(jLe,{displayWeekNumber:!0,value:y,disableFuture:!0,onChange:C=>{const w=C?Jo(C,"yyyy-MM-dd"):"";n({operator:b,values:[w]})}}),r&&i.jsx(_Le,{onRangeChange:r})]})})]})},OLe=({options:e,handleToggle:t})=>{const n=g.useRef([]);return{listRefs:n,handleSelection:(o,s)=>{var a,l,c;if(o.key==="ArrowDown"&&s<n.current.length-1)o.preventDefault(),(a=n.current[s+1])==null||a.focus();else if(o.key==="ArrowUp"&&s>0)o.preventDefault(),(l=n.current[s-1])==null||l.focus();else if(o.key==="Enter"&&s===0&&((c=n.current[0])!=null&&c.value)&&e.length>0)t(e[0].value)();else if((o.key==="Enter"||s!==0&&o.key===" ")&&(o.preventDefault(),s>0)){const u=s-1;t(e[u].value)()}}}},MLe=({name:e,label:t,options:n,onChange:r,onChipClose:o,state:s,singularOperators:a,pluralOperators:l,initMode:c="auto-open"})=>{const u=g.useRef(null),[d,p]=g.useState(),[f,h]=g.useState(""),m=s&&s.values.length>1?l:a,y=()=>{p(u.current)};g.useEffect(()=>{!s&&c==="auto-open"&&y()},[]);const b=()=>{p(null)},x=s?s.values:[],C=x.map(R=>{var _;return(_=n.find(M=>M.value===R))==null?void 0:_.label}).filter(R=>R!==void 0),w=s?s.operator:m[0],j=o?()=>{r({operator:a[0],values:[]}),b(),o()}:void 0,k=n.filter(R=>R.label.toLowerCase().includes(f.toLowerCase())),S=R=>()=>{if(x!=null&&x.some(_=>_===R)){const _=x==null?void 0:x.filter(M=>M!==R);r({operator:w,values:_})}else{const _=[...x??[],(n.find(M=>M.value===R)??{value:""}).value];r({operator:w,values:_})}},{listRefs:E,handleSelection:T}=OLe({options:k,handleToggle:S});return g.useEffect(()=>{s&&!m.includes(s.operator)&&r({operator:m[0],values:s.values})},[s]),i.jsxs(i.Fragment,{children:[i.jsx(K,{ref:u,children:i.jsx(_Q,{name:e,label:t,selectedDisplayOptions:C,onDelete:j,onClick:y,operator:w,operatorOptions:m,onChangeOperator:R=>{r({operator:R,values:x??[]})}})}),i.jsx(PQ,{open:!!d,anchorEl:d,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:i.jsxs(t$e,{children:[i.jsx(o$e,{variant:"outlined",size:"small",value:f,onChange:R=>h(R.target.value),placeholder:"Search",autoFocus:!0,InputProps:{startAdornment:i.jsx(Bp,{position:"start",children:i.jsx(Rf,{fontSize:"small"})})},inputRef:R=>{E.current[0]=R},onKeyDown:R=>T(R,0)}),i.jsx(Ri,{sx:{overflowY:"auto"},disablePadding:!0,children:k.map((R,_)=>{const M=`checkbox-list-label-${R.value}`;return i.jsxs(n$e,{dense:!0,disablePadding:!0,tabIndex:0,onClick:S(R.value),ref:$=>{E.current[_+1]=$},onKeyDown:$=>T($,_+1),children:[i.jsx(r$e,{edge:"start",checked:(x==null?void 0:x.some($=>$===R.value))??!1,tabIndex:-1,inputProps:{"aria-labelledby":M},size:"small",disableRipple:!0}),i.jsx(un,{id:M,primary:R.label})]},R.value)})})]})})]})},HQ=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(1.5,3),gap:e.spacing(1),flexWrap:"wrap"})),WQ=e=>"dateOperators"in e,$Le=e=>WQ(e)&&"fromFilterKey"in e&&"toFilterKey"in e,DLe=v("div")(({theme:e})=>({marginRight:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.spacing(2)})),LLe=v(Ta)(({theme:e})=>({"&.material-symbols-outlined":{fontSize:e.spacing(2)}})),VQ=({filter:e,onChipClose:t,onChange:n,state:r,rangeChangeHandler:o,initMode:s})=>{const a=i.jsxs(i.Fragment,{children:[i.jsx(DLe,{children:i.jsx(LLe,{children:e.icon})}),e.label]});return WQ(e)?i.jsx(ILe,{initMode:s,label:a,name:e.label,state:r,operators:e.dateOperators,onChange:l=>n({[e.filterKey]:l}),onRangeChange:$Le(e)?o(e):void 0,onChipClose:e.persistent?void 0:()=>t==null?void 0:t(e.label)},e.label):i.jsx(MLe,{initMode:s,label:a,name:e.label,state:r,options:e.options,onChange:l=>n({[e.filterKey]:l}),singularOperators:e.singularOperators,pluralOperators:e.pluralOperators,onChipClose:e.persistent?void 0:()=>t==null?void 0:t(e.label)},e.label)},NLe=({state:e,onChange:t,className:n,filter:r,rangeChangeHandler:o})=>i.jsx(HQ,{className:n,children:i.jsx(VQ,{filter:r,state:e[r.filterKey],onChange:t,rangeChangeHandler:o,onChipClose:void 0,initMode:"manual"})}),FLe=(e,t)=>{const n=[...e],r=new Set(e);return t.forEach(o=>{r.has(o)||n.push(o)}),n},BLe=({state:e,onChange:t,availableFilters:n,rangeChangeHandler:r,className:o})=>{const[s,a]=g.useState([]),l=u=>{const d=s.filter(p=>p!==u);a(d)};g.useEffect(()=>{const u=Object.keys(e).map(p=>n.find(f=>p===f.filterKey)).filter(p=>!!p).filter(p=>!!e[p.filterKey]).map(p=>p.label),d=FLe(s,u);a(d)},[JSON.stringify(e),JSON.stringify(n)]);const c=g.useMemo(()=>n.filter(u=>!s.includes(u.label)).map(u=>u.label).sort(),[n,s]);return i.jsxs(HQ,{className:o,children:[s.map(u=>{const d=n.find(p=>p.label===u);return d?i.jsx(VQ,{filter:d,state:e[d.filterKey],onChange:t,rangeChangeHandler:r,onChipClose:()=>l(d.label)},d.filterKey):null}),c.length>0?i.jsx(e$e,{availableFilters:n,visibleOptions:c,hiddenOptions:s,onSelectedOptionsChange:a}):null]})},fA=e=>{const t=n=>{const{fromFilterKey:r,toFilterKey:o}=n;return s=>{const{from:a,to:l}=s;e.onChange({[r]:a,[o]:l})}};if(e.availableFilters.length===1){const n=e.availableFilters[0];return i.jsx(NLe,{filter:n,rangeChangeHandler:t,...e})}return i.jsx(BLe,{rangeChangeHandler:t,...e})},yg=e=>`${e.type}:${e.value}`,UQ=()=>{const{uiConfig:e}=ut();return t=>{var n;return((n=e==null?void 0:e.flags)==null?void 0:n[t])||!1}},Er=e=>UQ()(e),zLe=({state:e,onChange:t})=>{const{projects:n}=Zr(),{segments:r}=od(),{tags:o}=XMe(),s=Er("filterFavorites"),{trackEvent:a}=zt(),l=p=>{p.favorite!==e.favorite&&a("favorite",{props:{action:p.favorite?"filter-enabled":"filter-disabled"}}),t(p)},c=[{label:"Active",value:"active"},{label:"Stale",value:"stale"}],[u,d]=g.useState([]);return g.useEffect(()=>{const p=(n||[]).map(b=>({label:b.name,value:b.id})),f=(r||[]).map(b=>({label:b.name,value:b.name})),h=(o||[]).map(b=>({label:yg(b),value:yg(b)})),m=p.length>1,y=[{label:"State",icon:"hexagon",options:c,filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},...m?[{label:"Project",icon:"topic",options:p,filterKey:"project",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}]:[],{label:"Tags",icon:"label",options:h,filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Segment",icon:"donut_large",options:f,filterKey:"segment",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ANY_OF","INCLUDE_ALL_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},...s?[{label:"Favorite",icon:"star",options:[{label:"True",value:"true"},{label:"False",value:"false"}],filterKey:"favorite",singularOperators:["IS"],pluralOperators:["IS_ANY_OF"]}]:[]];d(y)},[JSON.stringify(n),JSON.stringify(r),JSON.stringify(o),s]),i.jsx(fA,{availableFilters:u,state:e,onChange:l})},HLe=(e,t)=>n=>{if(typeof n=="function"){const r=n([{id:e.sortBy,desc:e.sortOrder==="desc"}])[0];t({sortBy:r==null?void 0:r.id,sortOrder:r!=null&&r.desc?"desc":"asc"})}else{const r=n[0];t({sortBy:r==null?void 0:r.id,sortOrder:r!=null&&r.desc?"desc":"asc"})}},WLe=(e,t)=>n=>{if(typeof n=="function"){const r=n({pageSize:e.limit,pageIndex:e.offset?Math.floor(e.offset/e.limit):0});t({limit:r==null?void 0:r.pageSize,offset:r!=null&&r.pageIndex?(r==null?void 0:r.pageIndex)*(r==null?void 0:r.pageSize):0})}else{const{pageSize:r,pageIndex:o}=n;t({limit:r,offset:o?o*r:0})}},VLe=(e,t)=>n=>{var o;const r=(o=e.columns)==null?void 0:o.reduce((s,a)=>({...s,...a&&{[a]:!0}}),{});if(typeof n=="function"){const s=n(r||{}),a=Object.keys(s).filter(l=>s[l]);t({columns:a})}else{const s=Object.keys(n).filter(a=>n[a]);t({columns:s})}},ULe=e=>({sorting:[{id:e.sortBy,desc:e.sortOrder==="desc"}]}),GLe=e=>({pagination:{pageIndex:e.offset?e.offset/e.limit:0,pageSize:e.limit}}),qLe=e=>{var t;return e.columns?{columnVisibility:(t=e.columns)==null?void 0:t.reduce((n,r)=>({...n,...r&&{[r]:!0}}),{})}:{}},hA=(e,t,n)=>{var a,l;const r=Object.fromEntries(Object.keys(((a=n.state)==null?void 0:a.columnVisibility)||{}).map(c=>[c,!1])),o=Object.fromEntries(n.columns.filter(({enableHiding:c})=>c===!1).map(c=>[c.id,!0])),s=e.columns?{...r,...qLe(e).columnVisibility,...o}:(l=n.state)==null?void 0:l.columnVisibility;return{getCoreRowModel:VAe(),enableSorting:!0,enableMultiSort:!1,manualPagination:!0,manualSorting:!0,enableSortingRemoval:!1,enableHiding:!0,onPaginationChange:WLe(e,t),onSortingChange:HLe(e,t),onColumnVisibilityChange:VLe(e,t),...n,state:{...ULe(e),...GLe(e),...n.state||{},columnVisibility:s}}},YLe=({cache:e,currentKey:t,clearPrefix:n,cacheSize:r=1})=>{const s=[...e.keys()].filter(c=>c.startsWith(n)&&c!==t),a=r-1;(a<=0?s:s.slice(0,-a)).forEach(c=>{e.delete(c)})},cy=({currentKey:e,clearPrefix:t,cacheSize:n=1})=>{const{cache:r}=RJ();YLe({cache:r,currentKey:e,clearPrefix:t,cacheSize:n})},KLe={features:[],total:0},XLe=10,GQ="api/admin/search/features?",JLe=()=>{const e={},t=o=>{e[o]={total:0,initialLoad:!0}},n=(o,s,a)=>{e[o]||t(o),e[o][s]=a},r=o=>(e[o]||t(o),e[o]);return(o,s={},a="")=>{const{KEY:l,fetcher:c}=ZLe(o),u=`${a}${l}`,d=o.project||"";cy({currentKey:u,clearPrefix:GQ,cacheSize:XLe}),g.useEffect(()=>{t(d)},[]);const{data:p,error:f,mutate:h,isLoading:m}=On(u,c,s),y=g.useCallback(()=>{h()},[h]),b=r(d);return(p==null?void 0:p.total)!==void 0&&n(d,"total",p.total),!m&&b.initialLoad&&n(d,"initialLoad",!1),{...p||KLe,loading:m,error:f,refetch:y,total:b.total,initialLoad:m&&b.initialLoad}}},ZLe=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,s])=>!!s).map(([o,s])=>[o,s.toString()]).toSorted())).toString(),n=`${GQ}${t}`;return{fetcher:()=>{const o=yt(n);return fetch(o,{method:"GET"}).then(en("Feature search")).then(s=>s.json())},KEY:n}},y7=JLe(),QLe=e=>e==null?e:e?"true":"false",eNe=e=>e==="true"?!0:e==="false"?!1:null,tNe={encode:QLe,decode:eNe},nNe=e=>e!=null&&e.values.length?`${e.operator}:${e.values.join(",")}`:void 0,rNe=e=>{if(typeof e!="string"||!e)return;const t=/^(IS|IS_NOT|IS_ANY_OF|IS_NONE_OF|INCLUDE|DO_NOT_INCLUDE|INCLUDE_ALL_OF|INCLUDE_ANY_OF|EXCLUDE_IF_ANY_OF|EXCLUDE_ALL|IS_BEFORE|IS_ON_OR_AFTER):(.+)$/,n=e.match(t);if(n)return{operator:n[1],values:n[2].split(",")}},ur={encode:nNe,decode:rNe},IN=(e,t)=>{const n=new Set(t),r={};return t.forEach(o=>{o in e&&(r[o]=e[o])}),Object.keys(e).forEach(o=>{n.has(o)||(r[o]=e[o])}),r},oNe=(e,t)=>{const[n,r]=Mp(),{value:o,setValue:s}=td(e,{});return g.useEffect(()=>{const a=Object.fromEntries(n.entries());Object.keys(a).length>0||Object.keys(o).length!==0&&r($g(t,o),{replace:!0})},[]),s},If=(e,t,n=["offset"])=>{const r=oNe(e,t),[o,s]=XE(t,{updateType:"replaceIn"}),[a]=Mp(),l=g.useMemo(()=>IN(o,[...a.keys()]),[a,o,IN]);g.useEffect(()=>{o.limit&&!yPe(o.limit)&&s(u=>({...u,limit:BR,offset:0}))},[o.limit,s]);const c=g.useCallback(u=>{if(!t.offset)return s(u);if(typeof u=="function")s(d=>{const p=u(d);return t.offset?{offset:t.offset.decode("0"),...p}:p});else{const d=t.offset?{offset:t.offset.decode("0"),...u}:u;s(d)}},[s,t.offset]);return g.useEffect(()=>{const u=Object.fromEntries(Object.entries(l).filter(([d])=>!n.includes(d)));r(u)},[JSON.stringify(l)]),[l,c]};var G4={exports:{}};G4.exports;(function(e,t){var n=200,r="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,l=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object Boolean]",p="[object Date]",f="[object Error]",h="[object Function]",m="[object GeneratorFunction]",y="[object Map]",b="[object Number]",x="[object Object]",C="[object Promise]",w="[object RegExp]",j="[object Set]",k="[object String]",S="[object Symbol]",E="[object WeakMap]",T="[object ArrayBuffer]",R="[object DataView]",_="[object Float32Array]",M="[object Float64Array]",$="[object Int8Array]",z="[object Int16Array]",A="[object Int32Array]",O="[object Uint8Array]",L="[object Uint8ClampedArray]",B="[object Uint16Array]",H="[object Uint32Array]",N=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,I=/^\w*$/,q=/^\./,ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/[\\^$.*+?()[\]{}|]/g,oe=/\\(\\)?/g,se=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,me={};me[_]=me[M]=me[$]=me[z]=me[A]=me[O]=me[L]=me[B]=me[H]=!0,me[c]=me[u]=me[T]=me[d]=me[R]=me[p]=me[f]=me[h]=me[y]=me[b]=me[x]=me[w]=me[j]=me[k]=me[E]=!1;var ce=typeof _n=="object"&&_n&&_n.Object===Object&&_n,_e=typeof self=="object"&&self&&self.Object===Object&&self,we=ce||_e||Function("return this")(),Me=t&&!t.nodeType&&t,Fe=Me&&!0&&e&&!e.nodeType&&e,Ge=Fe&&Fe.exports===Me,Re=Ge&&ce.process,Be=function(){try{return Re&&Re.binding("util")}catch{}}(),be=Be&&Be.isTypedArray;function ze(W,ee){for(var de=-1,ve=W?W.length:0;++de<ve;)if(ee(W[de],de,W))return!0;return!1}function xe(W){return function(ee){return ee==null?void 0:ee[W]}}function qe(W,ee){for(var de=-1,ve=Array(W);++de<W;)ve[de]=ee(de);return ve}function Ve(W){return function(ee){return W(ee)}}function et(W,ee){return W==null?void 0:W[ee]}function dt(W){var ee=!1;if(W!=null&&typeof W.toString!="function")try{ee=!!(W+"")}catch{}return ee}function at(W){var ee=-1,de=Array(W.size);return W.forEach(function(ve,Se){de[++ee]=[Se,ve]}),de}function rt(W,ee){return function(de){return W(ee(de))}}function Ae(W){var ee=-1,de=Array(W.size);return W.forEach(function(ve){de[++ee]=ve}),de}var Ye=Array.prototype,fe=Function.prototype,ge=Object.prototype,ye=we["__core-js_shared__"],Xe=function(){var W=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return W?"Symbol(src)_1."+W:""}(),ot=fe.toString,jt=ge.hasOwnProperty,Ke=ge.toString,bt=RegExp("^"+ot.call(jt).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=we.Symbol,Qe=we.Uint8Array,mt=ge.propertyIsEnumerable,Kt=Ye.splice,gt=rt(Object.keys,Object),tn=Di(we,"DataView"),pn=Di(we,"Map"),jn=Di(we,"Promise"),Hn=Di(we,"Set"),rr=Di(we,"WeakMap"),Dr=Di(Object,"create"),cs=Li(tn),es=Li(pn),ko=Li(jn),zo=Li(Hn),Jn=Li(rr),Wn=Ue?Ue.prototype:void 0,Lr=Wn?Wn.valueOf:void 0,us=Wn?Wn.toString:void 0;function to(W){var ee=-1,de=W?W.length:0;for(this.clear();++ee<de;){var ve=W[ee];this.set(ve[0],ve[1])}}function kr(){this.__data__=Dr?Dr(null):{}}function Yn(W){return this.has(W)&&delete this.__data__[W]}function Fs(W){var ee=this.__data__;if(Dr){var de=ee[W];return de===o?void 0:de}return jt.call(ee,W)?ee[W]:void 0}function uo(W){var ee=this.__data__;return Dr?ee[W]!==void 0:jt.call(ee,W)}function po(W,ee){var de=this.__data__;return de[W]=Dr&&ee===void 0?o:ee,this}to.prototype.clear=kr,to.prototype.delete=Yn,to.prototype.get=Fs,to.prototype.has=uo,to.prototype.set=po;function _r(W){var ee=-1,de=W?W.length:0;for(this.clear();++ee<de;){var ve=W[ee];this.set(ve[0],ve[1])}}function Te(){this.__data__=[]}function he(W){var ee=this.__data__,de=dc(ee,W);if(de<0)return!1;var ve=ee.length-1;return de==ve?ee.pop():Kt.call(ee,de,1),!0}function st(W){var ee=this.__data__,de=dc(ee,W);return de<0?void 0:ee[de][1]}function Pt(W){return dc(this.__data__,W)>-1}function nn(W,ee){var de=this.__data__,ve=dc(de,W);return ve<0?de.push([W,ee]):de[ve][1]=ee,this}_r.prototype.clear=Te,_r.prototype.delete=he,_r.prototype.get=st,_r.prototype.has=Pt,_r.prototype.set=nn;function Dn(W){var ee=-1,de=W?W.length:0;for(this.clear();++ee<de;){var ve=W[ee];this.set(ve[0],ve[1])}}function yr(){this.__data__={hash:new to,map:new(pn||_r),string:new to}}function Nt(W){return gc(this,W).delete(W)}function no(W){return gc(this,W).get(W)}function Kp(W){return gc(this,W).has(W)}function Xp(W,ee){return gc(this,W).set(W,ee),this}Dn.prototype.clear=yr,Dn.prototype.delete=Nt,Dn.prototype.get=no,Dn.prototype.has=Kp,Dn.prototype.set=Xp;function jl(W){var ee=-1,de=W?W.length:0;for(this.__data__=new Dn;++ee<de;)this.add(W[ee])}function cd(W){return this.__data__.set(W,o),this}function uc(W){return this.__data__.has(W)}jl.prototype.add=jl.prototype.push=cd,jl.prototype.has=uc;function Bs(W){this.__data__=new _r(W)}function El(){this.__data__=new _r}function li(W){return this.__data__.delete(W)}function lu(W){return this.__data__.get(W)}function Jp(W){return this.__data__.has(W)}function Zp(W,ee){var de=this.__data__;if(de instanceof _r){var ve=de.__data__;if(!pn||ve.length<n-1)return ve.push([W,ee]),this;de=this.__data__=new Dn(ve)}return de.set(W,ee),this}Bs.prototype.clear=El,Bs.prototype.delete=li,Bs.prototype.get=lu,Bs.prototype.has=Jp,Bs.prototype.set=Zp;function Qp(W,ee){var de=F(W)||gd(W)?qe(W.length,String):[],ve=de.length,Se=!!ve;for(var Pe in W)jt.call(W,Pe)&&!(Se&&(Pe=="length"||uu(Pe,ve)))&&de.push(Pe);return de}function dc(W,ee){for(var de=W.length;de--;)if(hd(W[de][0],ee))return de;return-1}var e1=i1();function pc(W,ee){return W&&e1(W,ee,re)}function fc(W,ee){ee=aa(ee,W)?[ee]:$i(ee);for(var de=0,ve=ee.length;W!=null&&de<ve;)W=W[ms(ee[de++])];return de&&de==ve?W:void 0}function kl(W){return Ke.call(W)}function ud(W,ee){return W!=null&&ee in Object(W)}function hc(W,ee,de,ve,Se){return W===ee?!0:W==null||ee==null||!Vt(W)&&!An(ee)?W!==W&&ee!==ee:dd(W,ee,hc,de,ve,Se)}function dd(W,ee,de,ve,Se,Pe){var Ze=F(W),lt=F(ee),Ct=u,Xt=u;Ze||(Ct=Nr(W),Ct=Ct==c?x:Ct),lt||(Xt=Nr(ee),Xt=Xt==c?x:Xt);var At=Ct==x&&!dt(W),nt=Xt==x&&!dt(ee),Ut=Ct==Xt;if(Ut&&!At)return Pe||(Pe=new Bs),Ze||U(W)?ci(W,ee,de,ve,Se,Pe):pd(W,ee,Ct,de,ve,Se,Pe);if(!(Se&a)){var Et=At&&jt.call(W,"__wrapped__"),qt=nt&&jt.call(ee,"__wrapped__");if(Et||qt){var fn=Et?W.value():W,Yt=qt?ee.value():ee;return Pe||(Pe=new Bs),de(fn,Yt,ve,Se,Pe)}}return Ut?(Pe||(Pe=new Bs),a1(W,ee,de,ve,Se,Pe)):!1}function t1(W,ee,de,ve){var Se=de.length,Pe=Se;if(W==null)return!Pe;for(W=Object(W);Se--;){var Ze=de[Se];if(Ze[2]?Ze[1]!==W[Ze[0]]:!(Ze[0]in W))return!1}for(;++Se<Pe;){Ze=de[Se];var lt=Ze[0],Ct=W[lt],Xt=Ze[1];if(Ze[2]){if(Ct===void 0&&!(lt in W))return!1}else{var At=new Bs,nt;if(!(nt===void 0?hc(Xt,Ct,ve,s|a,At):nt))return!1}}return!0}function n1(W){if(!Vt(W)||Rl(W))return!1;var ee=We(W)||dt(W)?bt:se;return ee.test(Li(W))}function r1(W){return An(W)&&cn(W.length)&&!!me[Ke.call(W)]}function cu(W){return typeof W=="function"?W:W==null?ke:typeof W=="object"?F(W)?Na(W[0],W[1]):s1(W):De(W)}function o1(W){if(!mc(W))return gt(W);var ee=[];for(var de in Object(W))jt.call(W,de)&&de!="constructor"&&ee.push(de);return ee}function s1(W){var ee=l1(W);return ee.length==1&&ee[0][2]?Fa(ee[0][0],ee[0][1]):function(de){return de===W||t1(de,W,ee)}}function Na(W,ee){return aa(W)&&Al(ee)?Fa(ms(W),ee):function(de){var ve=Z(de,W);return ve===void 0&&ve===ee?ie(de,W):hc(ee,ve,void 0,s|a)}}function zs(W){return function(ee){return fc(ee,W)}}function Mi(W){if(typeof W=="string")return W;if(P(W))return us?us.call(W):"";var ee=W+"";return ee=="0"&&1/W==-1/0?"-0":ee}function $i(W){return F(W)?W:du(W)}function i1(W){return function(ee,de,ve){for(var Se=-1,Pe=Object(ee),Ze=ve(ee),lt=Ze.length;lt--;){var Ct=Ze[++Se];if(de(Pe[Ct],Ct,Pe)===!1)break}return ee}}function ci(W,ee,de,ve,Se,Pe){var Ze=Se&a,lt=W.length,Ct=ee.length;if(lt!=Ct&&!(Ze&&Ct>lt))return!1;var Xt=Pe.get(W);if(Xt&&Pe.get(ee))return Xt==ee;var At=-1,nt=!0,Ut=Se&s?new jl:void 0;for(Pe.set(W,ee),Pe.set(ee,W);++At<lt;){var Et=W[At],qt=ee[At];if(ve)var fn=Ze?ve(qt,Et,At,ee,W,Pe):ve(Et,qt,At,W,ee,Pe);if(fn!==void 0){if(fn)continue;nt=!1;break}if(Ut){if(!ze(ee,function(Yt,Zt){if(!Ut.has(Zt)&&(Et===Yt||de(Et,Yt,ve,Se,Pe)))return Ut.add(Zt)})){nt=!1;break}}else if(!(Et===qt||de(Et,qt,ve,Se,Pe))){nt=!1;break}}return Pe.delete(W),Pe.delete(ee),nt}function pd(W,ee,de,ve,Se,Pe,Ze){switch(de){case R:if(W.byteLength!=ee.byteLength||W.byteOffset!=ee.byteOffset)return!1;W=W.buffer,ee=ee.buffer;case T:return!(W.byteLength!=ee.byteLength||!ve(new Qe(W),new Qe(ee)));case d:case p:case b:return hd(+W,+ee);case f:return W.name==ee.name&&W.message==ee.message;case w:case k:return W==ee+"";case y:var lt=at;case j:var Ct=Pe&a;if(lt||(lt=Ae),W.size!=ee.size&&!Ct)return!1;var Xt=Ze.get(W);if(Xt)return Xt==ee;Pe|=s,Ze.set(W,ee);var At=ci(lt(W),lt(ee),ve,Se,Pe,Ze);return Ze.delete(W),At;case S:if(Lr)return Lr.call(W)==Lr.call(ee)}return!1}function a1(W,ee,de,ve,Se,Pe){var Ze=Se&a,lt=re(W),Ct=lt.length,Xt=re(ee),At=Xt.length;if(Ct!=At&&!Ze)return!1;for(var nt=Ct;nt--;){var Ut=lt[nt];if(!(Ze?Ut in ee:jt.call(ee,Ut)))return!1}var Et=Pe.get(W);if(Et&&Pe.get(ee))return Et==ee;var qt=!0;Pe.set(W,ee),Pe.set(ee,W);for(var fn=Ze;++nt<Ct;){Ut=lt[nt];var Yt=W[Ut],Zt=ee[Ut];if(ve)var Vn=Ze?ve(Zt,Yt,Ut,ee,W,Pe):ve(Yt,Zt,Ut,W,ee,Pe);if(!(Vn===void 0?Yt===Zt||de(Yt,Zt,ve,Se,Pe):Vn)){qt=!1;break}fn||(fn=Ut=="constructor")}if(qt&&!fn){var rn=W.constructor,Ln=ee.constructor;rn!=Ln&&"constructor"in W&&"constructor"in ee&&!(typeof rn=="function"&&rn instanceof rn&&typeof Ln=="function"&&Ln instanceof Ln)&&(qt=!1)}return Pe.delete(W),Pe.delete(ee),qt}function gc(W,ee){var de=W.__data__;return Tl(ee)?de[typeof ee=="string"?"string":"hash"]:de.map}function l1(W){for(var ee=re(W),de=ee.length;de--;){var ve=ee[de],Se=W[ve];ee[de]=[ve,Se,Al(Se)]}return ee}function Di(W,ee){var de=et(W,ee);return n1(de)?de:void 0}var Nr=kl;(tn&&Nr(new tn(new ArrayBuffer(1)))!=R||pn&&Nr(new pn)!=y||jn&&Nr(jn.resolve())!=C||Hn&&Nr(new Hn)!=j||rr&&Nr(new rr)!=E)&&(Nr=function(W){var ee=Ke.call(W),de=ee==x?W.constructor:void 0,ve=de?Li(de):void 0;if(ve)switch(ve){case cs:return R;case es:return y;case ko:return C;case zo:return j;case Jn:return E}return ee});function fd(W,ee,de){ee=aa(ee,W)?[ee]:$i(ee);for(var ve,Se=-1,Ze=ee.length;++Se<Ze;){var Pe=ms(ee[Se]);if(!(ve=W!=null&&de(W,Pe)))break;W=W[Pe]}if(ve)return ve;var Ze=W?W.length:0;return!!Ze&&cn(Ze)&&uu(Pe,Ze)&&(F(W)||gd(W))}function uu(W,ee){return ee=ee??l,!!ee&&(typeof W=="number"||ae.test(W))&&W>-1&&W%1==0&&W<ee}function aa(W,ee){if(F(W))return!1;var de=typeof W;return de=="number"||de=="symbol"||de=="boolean"||W==null||P(W)?!0:I.test(W)||!N.test(W)||ee!=null&&W in Object(ee)}function Tl(W){var ee=typeof W;return ee=="string"||ee=="number"||ee=="symbol"||ee=="boolean"?W!=="__proto__":W===null}function Rl(W){return!!Xe&&Xe in W}function mc(W){var ee=W&&W.constructor,de=typeof ee=="function"&&ee.prototype||ge;return W===de}function Al(W){return W===W&&!Vt(W)}function Fa(W,ee){return function(de){return de==null?!1:de[W]===ee&&(ee!==void 0||W in Object(de))}}var du=la(function(W){W=Y(W);var ee=[];return q.test(W)&&ee.push(""),W.replace(ne,function(de,ve,Se,Pe){ee.push(Se?Pe.replace(oe,"$1"):ve||de)}),ee});function ms(W){if(typeof W=="string"||P(W))return W;var ee=W+"";return ee=="0"&&1/W==-1/0?"-0":ee}function Li(W){if(W!=null){try{return ot.call(W)}catch{}try{return W+""}catch{}}return""}function la(W,ee){if(typeof W!="function"||ee&&typeof ee!="function")throw new TypeError(r);var de=function(){var ve=arguments,Se=ee?ee.apply(this,ve):ve[0],Pe=de.cache;if(Pe.has(Se))return Pe.get(Se);var Ze=W.apply(this,ve);return de.cache=Pe.set(Se,Ze),Ze};return de.cache=new(la.Cache||Dn),de}la.Cache=Dn;function hd(W,ee){return W===ee||W!==W&&ee!==ee}function gd(W){return ue(W)&&jt.call(W,"callee")&&(!mt.call(W,"callee")||Ke.call(W)==c)}var F=Array.isArray;function Q(W){return W!=null&&cn(W.length)&&!We(W)}function ue(W){return An(W)&&Q(W)}function We(W){var ee=Vt(W)?Ke.call(W):"";return ee==h||ee==m}function cn(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=l}function Vt(W){var ee=typeof W;return!!W&&(ee=="object"||ee=="function")}function An(W){return!!W&&typeof W=="object"}function P(W){return typeof W=="symbol"||An(W)&&Ke.call(W)==S}var U=be?Ve(be):r1;function Y(W){return W==null?"":Mi(W)}function Z(W,ee,de){var ve=W==null?void 0:fc(W,ee);return ve===void 0?de:ve}function ie(W,ee){return W!=null&&fd(W,ee,ud)}function re(W){return Q(W)?Qp(W):o1(W)}function le(W,ee){var de={};return ee=cu(ee),pc(W,function(ve,Se,Pe){de[Se]=ee(ve,Se,Pe)}),de}function ke(W){return W}function De(W){return aa(W)?xe(ms(W)):zs(W)}e.exports=le})(G4,G4.exports);var sNe=G4.exports;const gA=ls(sNe),q4={encode:$Y,decode:e=>{const t=DY(e);return t==null?t:Number.isNaN(t)?null:t}},iNe=(e=BR)=>{const t="features-list-table",n={offset:Hr(q4,0),limit:Hr(q4,e),query:ei,favoritesFirst:Hr(tNe,!0),sortBy:Hr(ei,"createdAt"),sortOrder:Hr(ei,"desc"),project:ur,tag:ur,state:ur,segment:ur,createdAt:ur,type:ur,lifecycle:ur,createdBy:ur,favorite:ur},[r,o]=If(`${t}`,n),{offset:s,limit:a,query:l,favoritesFirst:c,sortBy:u,sortOrder:d,...p}=r,f=r,{features:h=[],total:m,loading:y,refetch:b,initialLoad:x}=y7(gA($g(n,f),C=>C?`${C}`:void 0));return{features:h,total:m,refetch:b,loading:y,initialLoad:x,tableState:r,setTableState:o,filterState:p}},ON=([e,t],n,r)=>g.useCallback(o=>{const s=n?n[e]:void 0;console.log({key:e,operator:t,state:s,value:o}),s&&s.values.length>0&&!s.values.includes(`${o}`)?r({...n,[e]:{operator:s.operator,values:[...s.values,o]}}):s||r({...n,[e]:{operator:t,values:[o]}})},[n,r,e,t]),aNe=()=>{const{data:e,error:t}=On(yt("api/admin/lifecycle/count"),lNe);return{lifecycleCount:e,error:t,loading:!t&&!e}},lNe=e=>fetch(e).then(en("Lifecycle count")).then(t=>t.json()),cNe=({label:e,icon:t,...n})=>i.jsx($e,{...n,endIcon:i.jsx(Ta,{children:t}),children:e}),uNe=({renderOptions:e,id:t,title:n,callback:r,icon:o=i.jsx(lA,{titleAccess:"Toggle"}),label:s,startIcon:a,selected:l,layout:c,...u})=>{const[d,p]=g.useState(null),f=m=>{p(m.currentTarget)},h=m=>{r&&typeof r=="function"&&r(m),p(null)};return i.jsxs(i.Fragment,{children:[i.jsx(cNe,{id:t,label:l||s,title:n,startIcon:a,onClick:f,"aria-controls":t,"aria-expanded":!!d,icon:o,style:{width:c==null?void 0:c.width,...c==null?void 0:c.button},...u}),i.jsx(jf,{id:t,onClick:h,anchorEl:d,open:!!d,sx:{...c==null?void 0:c.menu,"& .MuiPaper-root":{width:c==null?void 0:c.width}},children:e()})]})},dNe=v(K)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,color:e.palette.text.secondary,padding:e.spacing(0,.5),height:e.spacing(2.5),textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",variant:"outlined",marginLeft:e.spacing(1),marginRight:e.spacing(-.5),fontWeight:"bold",'&[data-selected="true"]':{backgroundColor:e.palette.secondary.light,borderColor:e.palette.primary.main,color:e.palette.primary.main}})),qQ=({count:e,isActive:t})=>i.jsx(dNe,{"data-selected":t,children:e}),pNe=v(Ti,{shouldForwardProp:e=>e!=="isActive"})(({theme:e})=>({borderRadius:0,padding:e.spacing(1,0),fontSize:e.typography.body2.fontSize,height:"auto",'&[data-selected="true"]':{backgroundColor:e.palette.secondary.light,fontWeight:"bold",borderColor:e.palette.primary.main,color:e.palette.primary.main},":focus-visible":{outline:`1px solid ${e.palette.primary.main}`,borderColor:e.palette.primary.main},"&:first-of-type":{borderTopLeftRadius:e.shape.borderRadius,borderBottomLeftRadius:e.shape.borderRadius},"&:last-of-type":{borderTopRightRadius:e.shape.borderRadius,borderBottomRightRadius:e.shape.borderRadius},'&:not(&[data-selected="true"], :last-of-type)':{borderRightWidth:0},'[data-selected="true"] + &':{borderLeftWidth:0},[e.breakpoints.down("md")]:{width:"100%",justifyContent:"flex-start",borderLeft:0,borderRight:0,borderBottom:0,borderTop:`1px solid ${e.palette.divider}`,"& .MuiChip-icon":{marginLeft:e.spacing(1),marginRight:e.spacing(1)},"& .MuiChip-label":{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},'&[data-selected="true"]':{borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.default},'&[data-selected="true"] + &':{borderTop:0},"&:not(:has(.MuiChip-icon)) .MuiChip-label":{paddingLeft:e.spacing(8)},"&:first-of-type":{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTop:0},"&:last-of-type":{borderTopRightRadius:0,borderBottomRightRadius:0}},"& .MuiChip-label":{position:"relative",textAlign:"center",paddingLeft:e.spacing(1)}})),MN=({label:e,value:t,isActive:n,flagsCount:r,onClick:o})=>i.jsx(pNe,{label:i.jsxs(K,{sx:{display:"inline-flex",alignItems:"center"},children:[i.jsx("span",{children:e}),i.jsx(qQ,{isActive:n,count:r??0})]}),variant:"outlined",onClick:o,"data-selected":n,icon:t?i.jsx(ly,{stage:{name:t}}):void 0}),fNe=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2)})),hNe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap"})),gNe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:e.spacing(.5),marginRight:e.spacing(4),width:"100%"})),Dx=[{label:"All lifecycles",value:null},{label:"Develop",value:"pre-live"},{label:"Rollout production",value:"live"},{label:"Cleanup",value:"completed"}],mNe=({label:e,value:t,count:n})=>i.jsxs(gNe,{children:[t?i.jsx(ly,{stage:{name:t}}):i.jsx(K,{sx:r=>({marginLeft:r.spacing(.5)})}),i.jsx("span",{children:e}),i.jsx(qQ,{isActive:!0,count:n??0})]}),yNe=({state:e,onChange:t,children:n,countData:r})=>{var h,m;const o=Bt(),s=Nn(o.breakpoints.down("md")),a=((m=(h=e.lifecycle)==null?void 0:h.values)==null?void 0:m[0])??null,l=y=>y===a,c=Object.entries(r??{}).reduce((y,[b,x])=>b!=="archived"?y+x:y,0),u=y=>y!==null?r==null?void 0:r[y]:c||void 0,d=y=>{t(y===null?{lifecycle:null}:{lifecycle:{operator:"IS",values:[y]}})},p=Dx.find(y=>y.value===a)??Dx[0],f=()=>Dx.map(({label:y,value:b})=>{const x=b!==null?r==null?void 0:r[b]:c||void 0;return i.jsx(MN,{label:y,flagsCount:x,onClick:()=>d(b),value:b,isActive:l(b)},y)});return i.jsx(i.Fragment,{children:s?i.jsx(uNe,{id:"lifecycle-filters-menu",label:"",selected:i.jsx(mNe,{label:p.label,value:p.value,count:u(p.value)}),icon:i.jsx(Pf,{}),renderOptions:()=>i.jsxs(K,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%"},children:[Dx.map(({label:y,value:b})=>{const x=b!==null?r==null?void 0:r[b]:c||void 0;return i.jsx(MN,{label:y,flagsCount:x,onClick:()=>d(b),value:b,isActive:l(b)},y)}),n]}),layout:{width:o.spacing(36),button:{border:`1px solid ${o.palette.divider}`,paddingRight:o.spacing(2)},menu:{"& .MuiMenu-list":{padding:0}}}}):i.jsxs(fNe,{children:[i.jsx(hNe,{children:f()}),n]})})},xNe=({state:e,onChange:t,children:n})=>{const{lifecycleCount:r}=aNe(),o=Object.entries(r||{}).reduce((s,[a,l])=>(s[a==="preLive"?"pre-live":a]=l,s),{});return i.jsx(K,{sx:s=>({padding:s.spacing(1.5,3,0,3)}),children:i.jsx(yNe,{state:e,onChange:t,countData:o,children:n})})};var mA={},vNe=je;Object.defineProperty(mA,"__esModule",{value:!0});var YQ=mA.default=void 0,bNe=vNe(Ee()),CNe=i,wNe=(0,bNe.default)((0,CNe.jsx)("path",{d:"m16 5-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z"}),"IosShare");YQ=mA.default=wNe;const SNe=({onClick:e})=>{const{trackEvent:t}=zt();return i.jsx(Rt,{title:"Export flags",arrow:!0,children:i.jsx(Mt,{onClick:()=>{e(),t("search-feature-buttons",{props:{action:"export"}})},size:"small",children:i.jsx(YQ,{})})})},jNe=v(Mt,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({color:e.palette.primary.main,padding:0,fontSize:e.typography.body2.fontSize,opacity:t?1:0,"&:is(:hover, :focus, :active)":{opacity:1}})),KQ=({isFavorite:e,onClick:t})=>{const{trackEvent:n}=zt(),r=e?{"aria-label":"Remove from favorites"}:{"aria-label":"Add to favorites",className:"show-row-hover"};return i.jsx(jNe,{active:e,size:"small",...r,onClick:o=>{o.preventDefault(),n("favorite",{props:{action:e?"unfavorite":"favorite"}}),t()},children:e?i.jsx(s7,{sx:{fontSize:"inherit"}}):i.jsx(i7,{sx:{fontSize:"inherit"}})})},t0=(e={})=>{const t=async()=>{const c=yt("api/admin/feature-types");return(await fetch(c,{method:"GET"}).then(en("Feature types"))).json()},n="api/admin/feature-types",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=()=>{Fo(n)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{featureTypes:(r==null?void 0:r.types)||[],error:o,loading:s,refetch:l}},ENe="experiment",kNe="release",TNe="operational",RNe="kill-switch",ANe="permission";var yA={},PNe=je;Object.defineProperty(yA,"__esModule",{value:!0});var RS=yA.default=void 0,_Ne=PNe(Ee()),INe=i,ONe=(0,_Ne.default)((0,INe.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"}),"Loop");RS=yA.default=ONe;var xA={},MNe=je;Object.defineProperty(xA,"__esModule",{value:!0});var XQ=xA.default=void 0,$Ne=MNe(Ee()),DNe=i,LNe=(0,$Ne.default)((0,DNe.jsx)("path",{d:"M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2z"}),"Timeline");XQ=xA.default=LNe;var vA={},NNe=je;Object.defineProperty(vA,"__esModule",{value:!0});var x7=vA.default=void 0,FNe=NNe(Ee()),BNe=i,zNe=(0,FNe.default)((0,BNe.jsx)("path",{d:"M13 3h-2v10h2V3zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z"}),"PowerSettingsNew");x7=vA.default=zNe;var bA={},HNe=je;Object.defineProperty(bA,"__esModule",{value:!0});var JQ=bA.default=void 0,WNe=HNe(Ee()),VNe=i,UNe=(0,WNe.default)((0,VNe.jsx)("path",{d:"M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z"}),"PanTool");JQ=bA.default=UNe;var CA={},GNe=je;Object.defineProperty(CA,"__esModule",{value:!0});var ZQ=CA.default=void 0,qNe=GNe(Ee()),YNe=i,KNe=(0,qNe.default)((0,YNe.jsx)("path",{d:"m22.7 19-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"}),"Build");ZQ=CA.default=KNe;const v7=e=>{switch(e){case kNe:return RS;case ENe:return XQ;case RNe:return x7;case TNe:return ZQ;case ANe:return JQ;default:return RS}},XNe=v("span")(({theme:e,color:t="neutral",icon:n})=>({display:"inline-flex",alignItems:"center",gap:e.spacing(.5),padding:e.spacing(n?.375:.625,1),borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,fontWeight:e.fontWeight.bold,lineHeight:1,...t==="disabled"?{color:e.palette.text.secondary,background:e.palette.background.paper,border:`1px solid ${e.palette.divider}`}:{backgroundColor:e.palette[t].light,color:e.palette[t].contrastText,border:`1px solid ${e.palette[t].border}`}})),JNe=v("span")(({theme:e,color:t="neutral"})=>({display:"flex",color:t==="disabled"?e.palette.action.disabled:e.palette[t].main})),$N=(e,t)=>i.jsx(JNe,{color:e,children:i.jsx(te,{condition:!!(t!=null&&t.props.sx),show:t,elseShow:t?g.cloneElement(t,{sx:{fontSize:"16px"}}):null})}),an=g.forwardRef(({as:e="span",color:t="neutral",icon:n,iconRight:r,className:o,sx:s,children:a,...l},c)=>i.jsxs(XNe,{as:e,color:t,icon:n,className:o,sx:s,...l,ref:c,children:[i.jsx(te,{condition:!!n&&!r,show:$N(t,n)}),i.jsx(te,{condition:a!=null&&a!=="",show:i.jsx("span",{children:a})}),i.jsx(te,{condition:!!n&&!!r,show:$N(t,n)})]})),QQ={environments:[],name:"",type:"release",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1,dependencies:[],children:[]},ws=(e,t,n)=>{const r=tee(e,t),{data:o,error:s,mutate:a}=On(["useFeature",r],()=>eee(r),n),l=g.useCallback(()=>{a().catch(console.warn)},[a]);return{feature:(o==null?void 0:o.body)||QQ,refetchFeature:l,loading:!s&&!o,status:o==null?void 0:o.status,error:s}},eee=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await en("Feature flag data")(t),{status:t.status,body:await t.json()})},tee=(e,t)=>yt(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`),ZNe=v(Ti)(({theme:e,$color:t})=>({borderRadius:e.spacing(2),border:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.paper,color:e.palette.text.primary,height:"26px","& .MuiChip-label":{display:"flex",alignItems:"center",gap:e.spacing(1),paddingRight:e.spacing(1)},"& .MuiChip-deleteIcon":{marginLeft:e.spacing(.5),marginRight:e.spacing(.5)}})),QNe=v("div")(({theme:e,$color:t})=>({width:e.spacing(1.3),height:e.spacing(1.3),borderRadius:"50%",backgroundColor:t,border:`1px solid ${t==="#FFFFFF"?e.palette.divider:t}`,flexShrink:0})),nee=({tag:e,onDelete:t,deleteIcon:n,maxLength:r=30})=>{const o=yg(e),s=o.length>r,a=e.color&&e.color!=="#FFFFFF";let l=e.value;if(s){const u=Math.max(0,r-e.type.length-1);l=`${e.value.substring(0,u)}...`}const c=i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[a&&i.jsx(QNe,{$color:e.color}),i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:`${e.type}:${l}`})]});return i.jsx(ZNe,{label:c,onDelete:t,deleteIcon:n,title:s?o:void 0})},eFe=v(ft)(({theme:e})=>({textDecoration:"none",fontWeight:e.typography.fontWeightBold,"&:hover, &:focus":{textDecoration:"underline"}})),tFe=v("button")(({theme:e})=>({marginRight:e.spacing(.5),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,textOverflow:"ellipsis",overflow:"hidden",textWrap:"nowrap",maxWidth:"250px",padding:e.spacing(.25,.5),cursor:"pointer",background:"inherit",color:"inherit"}));v(Ti)(({theme:e})=>({overflowWrap:"anywhere",lineHeight:e.typography.body1.lineHeight,backgroundColor:e.palette.background.paper,color:e.palette.text.primary,padding:e.spacing(.25,.5),height:"auto",fontSize:e.fontSizes.smallerBody,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,"&:hover":{backgroundColor:e.palette.background.paper},"& .MuiChip-label":{padding:0}}));const nFe=({text:e,searchQuery:t})=>i.jsx(te,{condition:!!(e&&e.length>40),show:i.jsx(wr,{title:i.jsx(Pr,{search:t,children:e}),placement:"bottom-start",arrow:!0,children:i.jsx(dN,{"data-loading":!0,children:i.jsx(Pr,{search:t,children:e})})}),elseShow:i.jsx(dN,{"data-loading":!0,children:i.jsx(Pr,{search:t,children:e})})}),rFe=v(K)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5),margin:e.spacing(1.25,0,1,0),paddingLeft:e.spacing(2)})),oFe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.dark})),sFe=v(K)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.25)})),iFe=v(an)(({theme:e})=>({padding:e.spacing(.5),border:0,textTransform:"capitalize"})),aFe=({project:e,feature:t,searchQuery:n})=>i.jsx(K,{sx:r=>({fontWeight:r.typography.fontWeightBold}),children:i.jsx(eFe,{to:`/projects/${e}/features/${t}`,children:i.jsx(mr,{lines:1,title:t,arrow:!0,sx:{overflowWrap:"anywhere"},children:i.jsx("span",{children:i.jsx(Pr,{search:n,children:t})})})})}),lFe=({feature:e,searchQuery:t})=>i.jsx(mr,{lines:1,title:e,arrow:!0,sx:n=>({fontWeight:n.typography.fontWeightBold,color:n.palette.neutral.main,overflowWrap:"anywhere"}),children:i.jsx(Pr,{search:t,children:e})}),W9=({tag:e,onClick:t})=>{const n=yg(e),r=i.jsx(K,{onClick:()=>t(e),sx:{cursor:"pointer"},children:i.jsx(nee,{tag:e,maxLength:30})});return i.jsx(wr,{title:n,arrow:!0,children:i.jsx("span",{children:r})},n)},cFe=({tags:e,onClick:t})=>i.jsx(wr,{title:e.map(n=>{const r=yg(n);return i.jsx(K,{sx:{cursor:"pointer"},onClick:()=>t(r),children:i.jsx(nee,{tag:n,maxLength:30})},r)}),children:i.jsxs(tFe,{sx:{cursor:"initial",borderRadius:n=>n.spacing(2)},children:[e.length," more..."]})}),uFe=({tags:e,onClick:t})=>{if(!e||e.length===0)return null;const[n,r,o,...s]=e,a=l=>{t(yg(l))};return i.jsxs(sFe,{children:[n&&i.jsx(W9,{tag:n,onClick:a}),r&&i.jsx(W9,{tag:r,onClick:a}),o&&i.jsx(W9,{tag:o,onClick:a}),i.jsx(te,{condition:s.length>0,show:i.jsx(cFe,{tags:s,onClick:t})})]})},dFe=v(ft)({display:"block"}),pFe=({feature:e,project:t})=>{const{feature:n}=ws(t,e),r=n.children,o=n.dependencies;if(r.length>0)return i.jsxs(i.Fragment,{children:[i.jsx(K,{children:"Children"}),r.map(s=>i.jsx(dFe,{to:`/projects/${t}/features/${s}`,children:s},s))]});if(o[0]){const s=o[0].feature;return i.jsxs(i.Fragment,{children:[i.jsx(K,{children:"Parent"}),i.jsx(ft,{to:`/projects/${t}/features/${s}`,children:s})]})}return i.jsx(i.Fragment,{children:"Loading..."})},fFe=({project:e,feature:t,archivedAt:n,type:r,searchQuery:o,dependencyType:s,onTypeClick:a,delay:l=500,isFavorite:c,onFavorite:u})=>{var x;const{featureTypes:d}=t0(),p=v7(r),h=`${((x=d.find(C=>C.id===r))==null?void 0:x.name)||r} flag`,{locationSettings:m}=$r(),y=RR(n,m.locale),b=()=>i.jsx(wr,{arrow:!0,title:h,describeChild:!0,children:i.jsx(Mt,{sx:{p:0},"aria-label":`add ${r} flag to filter`,onClick:()=>a(r),children:i.jsx(p,{sx:C=>({fontSize:C.spacing(2)}),"data-testid":"feature-type-icon"})})});return i.jsxs(oFe,{"data-loading":!0,children:[i.jsx(b,{}),n?i.jsx(lFe,{feature:t,searchQuery:o}):i.jsx(aFe,{project:e,feature:t,searchQuery:o}),i.jsx(KQ,{isFavorite:c,onClick:u}),i.jsx(te,{condition:!!s,show:i.jsx(wr,{title:i.jsx(pFe,{feature:t,project:e}),enterDelay:l,enterNextDelay:l,children:i.jsx(iFe,{color:s==="parent"?"warning":"secondary",children:s})})}),n&&i.jsx(wr,{arrow:!0,title:y,describeChild:!0,children:i.jsx(an,{tabIndex:0,color:"neutral",children:"Archived"})})]})},hFe=({description:e,searchQuery:t})=>i.jsx(te,{condition:!!e,show:i.jsx(K,{sx:n=>({display:"flex",gap:n.spacing(1),paddingLeft:n.spacing(3)}),children:i.jsx(nFe,{text:e,searchQuery:t})})}),gFe=(e,t,n)=>({row:r})=>{const{searchQuery:o}=Pi();return i.jsxs(rFe,{children:[i.jsx(fFe,{project:r.original.project||"",feature:r.original.name,archivedAt:r.original.archivedAt,searchQuery:o,type:r.original.type||"",dependencyType:r.original.dependencyType||"",onTypeClick:t,isFavorite:r.original.favorite,onFavorite:()=>n(r.original)}),i.jsx(hFe,{description:r.original.description||"",searchQuery:o}),i.jsx(K,{sx:s=>({paddingLeft:s.spacing(3)}),children:i.jsx(uFe,{tags:r.original.tags,onClick:e})})]})},tc=v("div")(()=>({border:0,clip:"rect(0 0 0 0)",height:"auto",margin:0,overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"})),mFe=v("div")({width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}),yFe=v("button")({border:"none",background:"none",cursor:"pointer",borderRadius:"100%",padding:0}),xFe=v("p")(({theme:e})=>({color:e.palette.text.secondary})),vFe=v(ed)(({theme:e})=>({width:e.spacing(3),height:e.spacing(3)})),bFe=e=>({row:t})=>{var l;const n={id:0,name:"",imageUrl:"",...(l=t==null?void 0:t.original)==null?void 0:l.createdBy},r=n.id===0,o=r?()=>{}:()=>e==null?void 0:e(n.id),s=r?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:n.name}),i.jsx(xFe,{children:"You can't filter by unknown users."})]}):i.jsx("p",{children:n.name}),a=i.jsxs(i.Fragment,{children:[i.jsx(tc,{children:i.jsxs("span",{children:["Show only flags created by ",n.name]})}),i.jsx(vFe,{disableTooltip:!0,user:{id:n.id,name:n.name,imageUrl:n.imageUrl}})]});return i.jsx(mFe,{children:i.jsx(wr,{arrow:!0,describeChild:!0,title:s,children:e?i.jsx(yFe,{"aria-disabled":r,onClick:o,children:a}):i.jsx("div",{children:a})})})},$1="production",CFe=({lifecycle:e,environments:t})=>{if((e==null?void 0:e.stage)==="initial"){if(t!=null&&t.some(r=>r.type!==$1&&r.enabled))return"No traffic";if(!(t!=null&&t.some(r=>r.type!==$1&&r.hasStrategies)))return"No strategies";if(!(t!=null&&t.some(r=>r.type!==$1&&r.hasEnabledStrategies)))return"No enabled strategies"}if((e==null?void 0:e.stage)==="pre-live"&&!(t!=null&&t.some(r=>r.enabled)))return"Paused";const n=t==null?void 0:t.filter(r=>r.type===$1);if((e==null?void 0:e.stage)==="live"||(e==null?void 0:e.stage)==="completed"){if(n.length>1){const o=n.filter(s=>s.enabled).length;if(o===0)return"Paused";if(n.length!==o)return`In ${o} out of ${n.length} production environments`}if(n.length===0)return"No production environments";const r=n[0];if(!(r!=null&&r.hasStrategies))return"No strategies";if(!(r!=null&&r.enabled))return"Paused";if(r.totalMilestones){const o=`${(r.milestoneOrder||0)+1} of ${r.totalMilestones}`;return r.milestoneName?`Milestone: ${r.milestoneName} (${o})`:`Milestone ${o}`}}return"–"};var wA={},wFe=je;Object.defineProperty(wA,"__esModule",{value:!0});var ree=wA.default=void 0,SFe=wFe(Ee()),jFe=i,EFe=(0,SFe.default)((0,jFe.jsx)("path",{d:"M18 23H4c-1.1 0-2-.9-2-2V7h2v14h14v2zM15 1H8c-1.1 0-1.99.9-1.99 2L6 17c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V7l-6-6zm1.5 14h-6v-2h6v2zm0-6h-2v2h-2V9h-2V7h2V5h2v2h2v2z"}),"Difference");ree=wA.default=EFe;const kFe=v("div")(({theme:e})=>({padding:e.spacing(0,2),display:"flex",alignItems:"center",gap:e.spacing(.5),minWidth:"180px"})),TFe=v(ree)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(3.5),padding:e.spacing(.5)})),RFe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",gap:e.spacing(.5),ul:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column"}})),AFe=({lifecycle:e,environments:t,project:n})=>{const r=g.useMemo(()=>CFe({lifecycle:e,environments:t}),[e,t]),o=g.useMemo(()=>t.flatMap(s=>s.changeRequestIds),[t]);return i.jsxs(kFe,{children:[i.jsx(mr,{title:r,lines:2,children:r}),o.length>0&&i.jsx(wr,{arrow:!0,title:i.jsxs(RFe,{children:[i.jsx("div",{children:"Change requests:"}),i.jsx("ul",{children:o.map(s=>i.jsx("li",{children:i.jsx(ft,{to:`/projects/${n}/change-requests/${s}`,target:"_blank",rel:"noopener noreferrer",children:`#${s}`})},s))})]}),children:i.jsx(TFe,{"data-testid":"change-requests-icon",tabIndex:0})})]})},oee=Array(15).fill({name:"Name of the feature",description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1).toISOString(),project:"projectID",createdBy:{id:0,name:"admin",imageUrl:""},archivedAt:null,favorite:!1,stale:!1,dependencyType:null,tags:[],environments:[],impressionData:!1,segments:[]}),Zf=_R(),PFe=()=>{var L;const e=Bt(),{isOss:t}=ut(),{trackEvent:n}=zt(),{environments:r}=rd(),o=r.filter(B=>B.enabled).map(B=>B.name),s=Nn(e.breakpoints.down("md")),a=Nn(e.breakpoints.down("lg")),l=Nn(e.breakpoints.down("xl")),[c,u]=g.useState(!1),{setToastApiError:d}=_t(),{features:p,total:f,refetch:h,loading:m,initialLoad:y,tableState:b,setTableState:x,filterState:C}=iNe(),w=ON(["type","IS"],b,x),j=ON(["tag","INCLUDE"],b,x),{projects:k}=Zr(),S=xl(m),{favorite:E,unfavorite:T}=Q_e(),R=g.useCallback(async B=>{try{B!=null&&B.favorite?await T(B.project,B.name):await E(B.project,B.name),h()}catch{d("Something went wrong, could not update favorite")}},[E,h,T,d]),_=!t(),M=g.useMemo(()=>[Zf.accessor("name",{header:"Name",cell:gFe(j,w,R)}),Zf.accessor("createdBy",{id:"createdBy",header:"By",cell:bFe(),meta:{width:"1%",align:"center"},enableSorting:!1}),Zf.accessor("createdAt",{header:"Created",cell:({getValue:B})=>i.jsx(Cp,{value:B()}),meta:{width:"1%"}}),Zf.accessor("lifecycle",{id:"lifecycle",header:"Lifecycle",cell:({row:{original:B}})=>i.jsx(YMe,{feature:B,expanded:!0,"data-loading":!0}),enableSorting:!1,size:50,meta:{width:"1%"}}),..._?[Zf.accessor("environments",{id:"status",header:"Status",cell:({row:{original:B}})=>i.jsx(AFe,{...B}),enableSorting:!1,size:350})]:[],Zf.accessor("project",{header:"Project",cell:({getValue:B})=>{var I;const H=B(),N=(I=k.find(q=>q.id===H))==null?void 0:I.name;return i.jsx(K,{sx:{minWidth:"180px"},children:i.jsx(Yl,{title:N||H,to:`/projects/${H}`})})}})],[b.favoritesFirst,_]),$=g.useMemo(()=>(p==null?void 0:p.length)===0&&m?oee:p,[y,p,m]),z=$R(hA(b,x,{columns:M,data:$}));g.useEffect(()=>{s?z.setColumnVisibility({type:!1,createdAt:!1,tags:!1,lastSeenAt:!1,stale:!1}):a?z.setColumnVisibility({lastSeenAt:!1,stale:!1}):z.setColumnVisibility({})},[s,a]);const A=(B="")=>{x({query:B}),n("search-bar",{props:{screen:"features",length:B.length}})},O=z.getRowModel().rows;return r.length>0?i.jsxs(ir,{disableLoading:!0,bodyClass:"no-padding",header:i.jsx($n,{title:"Flags overview",actions:i.jsxs(i.Fragment,{children:[i.jsx(Sn,{component:ft,to:"/unknown-flags",underline:"always",sx:{marginRight:2,fontSize:e.typography.body2.fontSize,...Uu(e)},children:"Unknown flags"}),i.jsx(Sn,{component:ft,to:"/archive",underline:"always",sx:{marginRight:2,fontSize:e.typography.body2.fontSize,...Uu(e)},onClick:()=>{n("search-feature-buttons",{props:{action:"archive"}})},children:"Archived flags"}),i.jsx(SNe,{onClick:()=>u(!0)})]})}),children:[i.jsx(xNe,{state:C,onChange:x,children:l?null:i.jsx(No,{placeholder:"Search",initialValue:b.query||"",onChange:A,id:"globalFeatureFlags"})}),i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(zLe,{onChange:x,state:C}),i.jsx(lIe,{isActive:b.favoritesFirst,onClick:()=>x({favoritesFirst:!b.favoritesFirst})})]}),l?i.jsx(K,{sx:B=>({padding:B.spacing(0,3,3)}),children:i.jsx(No,{initialValue:b.query||"",onChange:A,id:"globalFeatureFlags"})}):null,i.jsx(Ai,{value:b.query||"",children:i.jsx("div",{ref:S,children:i.jsx(zR,{tableInstance:z,totalItems:f})})}),i.jsx(te,{condition:O.length===0,show:i.jsx(K,{sx:B=>({padding:B.spacing(0,2,2)}),children:i.jsx(te,{condition:((L=b.query||"")==null?void 0:L.length)>0,show:i.jsxs(Gr,{children:["No feature flags found matching “",b.query,"”"]}),elseShow:i.jsx(Gr,{children:"No feature flags found matching your criteria."})})})}),i.jsx(kIe,{showExportDialog:c,data:$,onClose:()=>u(!1),environments:o})]}):null},_Fe=["flexibleRollout","default"],IFe=e=>e.map(t=>({...t,advanced:!_Fe.includes(t.name)})),Of=()=>{const{data:e,error:t}=On(AS,OFe),n=g.useCallback(()=>{Fo(AS).catch(console.warn)},[]);return{strategies:IFe((e==null?void 0:e.strategies)||$Fe),refetchStrategies:n,loading:!t&&!e,error:t}},OFe=()=>fetch(AS).then(en("Strategy types")).then(e=>e.json()),MFe={deprecated:!1,name:"flexibleRollout",displayName:"Gradual rollout",editable:!1,description:"Roll out to a percentage of your userbase, and ensure that the experience is the same for the user on each visit.",parameters:[{name:"rollout",type:"percentage",description:"",required:!1},{name:"stickiness",type:"string",description:"Used to defined stickiness",required:!0},{name:"groupId",type:"string",description:"",required:!0}]},$Fe=[MFe],AS=yt("api/admin/strategies");function see(e,t=""){return(n={},r="",o={})=>{const s=new URLSearchParams(Array.from(Object.entries(n).filter(([h,m])=>!!m).map(([h,m])=>[h,m.toString()]))).toString(),a=r||t,l=`${a}${s}`;cy({currentKey:l,clearPrefix:a});const c=async()=>fetch(yt(l),{method:"GET"}).then(en("Paginated data")).then(h=>h.json()),{data:u,error:d,isLoading:p}=On(l,c,{...o});return{...u||e,total:(u==null?void 0:u.total)||0,error:d,loading:p}}}const DFe="api/admin/metrics/applications?",iee=see({applications:[],total:0},DFe);var SA={},LFe=je;Object.defineProperty(SA,"__esModule",{value:!0});var Eo=SA.default=void 0,NFe=LFe(Ee()),FFe=i,BFe=(0,NFe.default)((0,FFe.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Eo=SA.default=BFe;var jA={},zFe=je;Object.defineProperty(jA,"__esModule",{value:!0});var aee=jA.default=void 0,HFe=zFe(Ee()),WFe=i,VFe=(0,HFe.default)((0,WFe.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"RadioButtonChecked");aee=jA.default=VFe;var EA={},UFe=je;Object.defineProperty(EA,"__esModule",{value:!0});var lee=EA.default=void 0,GFe=UFe(Ee()),qFe=i,YFe=(0,GFe.default)((0,qFe.jsx)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"}),"Apps");lee=EA.default=YFe;const KFe="_truncate_19sq2_2",XFe="_fullwidth_19sq2_8",JFe="_listLink_19sq2_25",ZFe="_listItem_19sq2_106",Wh={truncate:KFe,fullwidth:XFe,listLink:JFe,listItem:ZFe},cee=({apps:e})=>i.jsx(Ri,{children:i.jsx(te,{condition:e.length>0,show:e.map(({appName:t,description:n,icon:r})=>i.jsxs(Or,{className:Wh.listItem,children:[i.jsx(Kw,{children:i.jsx(N5,{children:i.jsx(te,{condition:r,show:i.jsx(Ta,{children:r}),elseShow:i.jsx(lee,{})},`avatar_conditional_${t}`)})}),i.jsx(un,{primary:i.jsx(ft,{to:`/applications/${encodeURIComponent(t)}`,className:[Wh.listLink,Wh.truncate].join(" "),children:t}),secondary:n||"No description"})]},t))})});cee.propTypes={apps:Le.array.isRequired};Le.string,Le.any;Le.string,Le.func.isRequired,Le.string;Le.string,Le.object;const QFe=tt.forwardRef(({icon:e,label:t,disabled:n,...r},o)=>i.jsxs(wn,{disabled:n,style:{display:"flex",alignItems:"center"},...r,children:[i.jsx(e,{}),t]}));QFe.propTypes={icon:Le.object,label:Le.string,disabled:Le.bool};const eBe="_listcontainer_nqviu_52",tBe={listcontainer:eBe},nBe=({strategy:e,applications:t})=>{const n=Bt(),{parameters:r=[]}=e,o=s=>s.length>0?s.map(({name:a,type:l,description:c,required:u},d)=>i.jsxs(Or,{children:[i.jsx(te,{condition:u,show:i.jsx(Kw,{children:i.jsx(Rt,{title:"Required parameter",arrow:!0,children:i.jsx(Eo,{"aria-hidden":!1})})}),elseShow:i.jsx(Kw,{children:i.jsx(Rt,{title:"Optional parameter",arrow:!0,children:i.jsx(aee,{"aria-hidden":!1})})})}),i.jsx(un,{primary:i.jsxs("div",{children:[a," ",i.jsxs("small",{children:["(",l,")"]})]}),secondary:c})]},`${a}-${d}`)):i.jsx(Or,{children:"No params"});return i.jsx("div",{className:tBe.listcontainer,children:i.jsxs(Uo,{container:!0,children:[i.jsx(te,{condition:e.deprecated,show:i.jsx(Uo,{item:!0,children:i.jsx("h5",{style:{color:n.palette.error.main},children:"Deprecated"})})}),i.jsxs(Uo,{item:!0,sm:12,md:12,children:[i.jsx("h6",{children:"Parameters"}),i.jsx("hr",{}),i.jsx(Ri,{children:o(r)})]}),i.jsxs(Uo,{item:!0,sm:12,md:12,children:[i.jsxs("h6",{children:["Applications using this strategy"," ",t.length>=1e3&&"(Capped at 1000)"]}),i.jsx("hr",{}),i.jsx(cee,{apps:t})]})]})})},rBe=e=>{const t=pf(e.permission,e.projectId,e.environmentId);return i.jsx(uee,{...e,access:t})},oBe=e=>{const t=gg(e.permission,e.projectId,e.environmentId);return i.jsx(uee,{...e,access:t})},uee=({access:e,permission:t,projectId:n,children:r,environmentId:o,tooltipProps:s,disabled:a,...l})=>{const c=Yu();return i.jsx(ra,{...s,title:iy(e,s==null?void 0:s.title),arrow:!0,onClick:u=>u.preventDefault(),children:i.jsx("div",{id:c,children:i.jsx(Mt,{...l,disabled:!e||a,"aria-labelledby":c,size:l.size||"large",children:r})})})},Co=e=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?i.jsx(oBe,{...e,projectId:e.projectId,environmentId:e.environmentId}):i.jsx(rBe,{...e});var kA={},sBe=je;Object.defineProperty(kA,"__esModule",{value:!0});var oi=kA.default=void 0,iBe=sBe(Ee()),aBe=i,lBe=(0,iBe.default)((0,aBe.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),"Edit");oi=kA.default=lBe;const wo=e=>YE()[e],ar=e=>{const t=wo(e);if(!t)throw new Error(`Missing required path param: ${e}`);return t},cBe=()=>{const e=ar("name"),{strategies:t}=Of(),{applications:n}=iee(),r=$t(),o=t.find(a=>a.name===e),s=()=>{r(`/strategies/${e}/edit`)};return o?i.jsx(ir,{header:i.jsx($n,{title:o==null?void 0:o.name,subtitle:o==null?void 0:o.description,actions:i.jsx(te,{condition:o.editable,show:i.jsx(Co,{permission:i3,"data-loading":!0,onClick:s,tooltipProps:{title:"Edit strategy"},children:i.jsx(oi,{})})})}),children:i.jsx(Uo,{container:!0,children:i.jsx(Uo,{item:!0,xs:12,sm:12,children:i.jsx(nBe,{strategy:o,applications:n})})})}):null};var TA={},uBe=je;Object.defineProperty(TA,"__esModule",{value:!0});var dee=TA.default=void 0,dBe=uBe(Ee()),pBe=i,fBe=(0,dBe.default)((0,pBe.jsx)("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"}),"Extension");dee=TA.default=fBe;const hBe=v(K)(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",padding:e.spacing(0,1.5)})),gBe=v(pr)(({theme:e})=>({borderColor:e.palette.divider,height:e.spacing(3),margin:e.spacing(0,2)})),mBe=()=>i.jsx(gBe,{orientation:"vertical",variant:"middle"}),pee=({children:e})=>i.jsx(hBe,{children:e});pee.Divider=mBe;const Ku=pee;var RA={},yBe=je;Object.defineProperty(RA,"__esModule",{value:!0});var fee=RA.default=void 0,xBe=yBe(Ee()),vBe=i,bBe=(0,xBe.default)((0,vBe.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"}),"LocationOn");fee=RA.default=bBe;var AA={},CBe=je;Object.defineProperty(AA,"__esModule",{value:!0});var hee=AA.default=void 0,wBe=CBe(Ee()),SBe=i,jBe=(0,wBe.default)((0,SBe.jsx)("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"Code");hee=AA.default=jBe;const EBe=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:"M16.584 10H22a2 2 0 1 1 0 4h-5.416a5.001 5.001 0 0 1-9.168 0H2a2 2 0 1 1 0-4h5.416a5.001 5.001 0 0 1 9.168 0Z"})),Xl=e=>RBe[e]??e,kBe=e=>i.jsx(X2,{...e,component:t=>i.jsx(EBe,{...t}),inheritViewBox:!0}),TBe=e=>{switch(e){case"default":return x7;case"remoteAddress":return ER;case"flexibleRollout":return kBe;case"applicationHostname":return fee;case"releasePlanTemplate":return ty;default:return hee}},zqt=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress"],RBe={applicationHostname:"Hosts",default:"Standard",flexibleRollout:"Gradual rollout",gradualRolloutRandom:"Randomized",gradualRolloutSessionId:"Sessions",gradualRolloutUserId:"Users",remoteAddress:"IPs"},tm="api/admin/strategies",PA=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),o=g.useCallback(async u=>{const d=t(tm,{method:"POST",body:JSON.stringify(u)});return e(d.caller,d.id)},[t,e]),s=g.useCallback(async u=>{const d=`${tm}/${u.name}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},[t,e]),a=g.useCallback(async u=>{const d=`${tm}/${u.name}`,p=t(d,{method:"DELETE"});return e(p.caller,p.id)},[t,e]),l=g.useCallback(async u=>{const d=`${tm}/${u.name}/deprecate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]),c=g.useCallback(async u=>{const d=`${tm}/${u.name}/reactivate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]);return{createStrategy:o,updateStrategy:s,removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c,errors:n,loading:r}},Ds={date:(e,t,n,r)=>{var a,l;const o=new Date(((a=e==null?void 0:e.values)==null?void 0:a[n])||0),s=new Date(((l=t==null?void 0:t.values)==null?void 0:l[n])||0);return(s==null?void 0:s.getTime())-(o==null?void 0:o.getTime())},boolean:(e,t,n,r)=>{var a,l;const o=(a=e==null?void 0:e.values)==null?void 0:a[n],s=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===s?0:o?1:-1},alphanumeric:(e,t,n,r)=>{var a,l;const o=`${((a=e==null?void 0:e.values)==null?void 0:a[n])||""}`.toLowerCase(),s=`${((l=t==null?void 0:t.values)==null?void 0:l[n])||""}`.toLowerCase();return o==null?void 0:o.localeCompare(s)},playgroundResultState:(e,t,n,r)=>{var a,l;const o=(a=e==null?void 0:e.values)==null?void 0:a[n],s=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===s?0:o==="true"?1:s==="true"||o==="false"?-1:s==="false"?1:0},numericZeroLast:(e,t,n,r)=>{var a,l;const o=Number.parseInt(`${((a=e==null?void 0:e.values)==null?void 0:a[n])||0}`,10)||Number.MAX_SAFE_INTEGER,s=Number.parseInt(`${((l=t==null?void 0:t.values)==null?void 0:l[n])||0}`,10)||Number.MAX_SAFE_INTEGER;return o-s}},ABe=tt.forwardRef((e,t)=>{const n=gg(e.permission,e.projectId,e.environmentId);return i.jsx(gee,{...e,access:n,ref:t})}),PBe=tt.forwardRef((e,t)=>{const n=pf(e.permission,e.projectId,e.environmentId);return i.jsx(gee,{...e,access:n,ref:t})}),gee=tt.forwardRef((e,t)=>{const{access:n,permission:r,tooltip:o,disabled:s,projectId:a,environmentId:l,checked:c,onChange:u,...d}=e;return i.jsx(ra,{title:iy(n,o),arrow:!0,variant:"custom",children:i.jsx("span",{"data-loading":!0,children:i.jsx(oa,{"data-testid":"toggle-switch",onChange:u,disabled:s||!n,checked:c,ref:t,...d})})})}),_Be=tt.forwardRef((e,t)=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?i.jsx(ABe,{...e,projectId:e.projectId,environmentId:e.environmentId,ref:t}):i.jsx(PBe,{...e,ref:t})),IBe=({deprecated:e,disabled:t,onToggle:n})=>{const r=()=>{n(e)},o=Yu(),s=pf(i3),a=g.useMemo(()=>s?t?"You cannot disable default strategy":e?"Excluded from strategy list":"Included in strategy list":"",[e,t,s]);return i.jsx(Rt,{title:a,describeChild:!0,arrow:!0,children:i.jsx("div",{id:o,children:i.jsx(_Be,{checked:!e,permission:i3,onClick:r,disabled:t,inputProps:{"aria-labelledby":o}})})})},OBe=({strategy:e,onClick:t})=>{const n=Yu();return i.jsx(te,{condition:e==null?void 0:e.editable,show:i.jsx(Co,{onClick:t,permission:i3,tooltipProps:{title:"Edit strategy"},children:i.jsx(oi,{})}),elseShow:i.jsx(Rt,{title:"You cannot edit a built-in strategy",arrow:!0,children:i.jsx("div",{id:n,children:i.jsx(Mt,{disabled:!0,size:"large",children:i.jsx(oi,{"aria-labelledby":n})})})})})};var _A={},MBe=je;Object.defineProperty(_A,"__esModule",{value:!0});var So=_A.default=void 0,$Be=MBe(Ee()),DBe=i,LBe=(0,$Be.default)((0,DBe.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");So=_A.default=LBe;const NBe=({strategy:e,onClick:t})=>{const n=Yu();return i.jsx(te,{condition:e==null?void 0:e.editable,show:i.jsx(Co,{onClick:t,permission:aOe,tooltipProps:{title:"Delete strategy"},children:i.jsx(So,{})}),elseShow:i.jsx(Rt,{title:"You cannot delete a built-in strategy",arrow:!0,children:i.jsx("div",{id:n,children:i.jsx(Mt,{disabled:!0,size:"large",children:i.jsx(So,{"aria-labelledby":n})})})})})};var IA={},FBe=je;Object.defineProperty(IA,"__esModule",{value:!0});var Y4=IA.default=void 0,BBe=FBe(Ee()),zBe=i,HBe=(0,BBe.default)((0,zBe.jsx)("path",{d:"M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"}),"HelpOutline");Y4=IA.default=HBe;const DN=v("span")(({theme:e,size:t})=>({display:"inline-grid",alignItems:"center",outline:0,cursor:"pointer","&:is(:focus-visible, :active) > *, &:hover > *":{outlineStyle:"solid",outlineWidth:2,outlineOffset:0,outlineColor:e.palette.primary.main,borderRadius:"100%",color:e.palette.primary.main},"& svg":{fontSize:t||e.fontSizes.mainHeader,color:e.palette.action.active,marginLeft:e.spacing(.5)}})),Zo=({tooltip:e,htmlTooltip:t,tooltipId:n,placement:r,children:o,size:s,...a})=>{if(t){const{htmlTooltipMaxWidth:l}=a;return i.jsx(wr,{id:n,title:e,placement:r,arrow:!0,maxWidth:l,children:i.jsx(DN,{size:s,tabIndex:0,"aria-label":"Help",children:o??i.jsx(Y4,{})})})}return i.jsx(Rt,{title:e,placement:r,arrow:!0,id:n,children:i.jsx(DN,{size:s,tabIndex:0,"aria-label":"Help",children:o??i.jsx(Y4,{})})})},LN=({children:e})=>i.jsx(J,{component:"span",variant:"body2",sx:t=>({marginBottom:t.spacing(2)}),children:e}),mee=({alert:e})=>{const t=i.jsxs(i.Fragment,{children:[i.jsxs(LN,{children:["If you decide to create a custom strategy be aware of the following:",i.jsxs("ul",{children:[i.jsx("li",{children:"They require writing custom code and deployments for each SDK you’re using."}),i.jsx("li",{children:"Differing implementation in each SDK will cause toggles to evaluate differently"}),i.jsx("li",{children:"Custom strategies require a lot of configuration in both Unleash admin UI and the SDK."})]})]}),i.jsx(LN,{children:"Constraints don’t have these problems. They’re configured once in the admin UI and behave in the same way in each SDK without further configuration."})]});return e?i.jsx(Dt,{severity:"info",sx:n=>({marginBottom:n.spacing(3)}),children:t}):i.jsx(K,{sx:n=>({maxWidth:"720px",padding:n.spacing(4,2),margin:"0 auto"}),children:t})},WBe=()=>{const e=Nn("(max-width:700px)"),t=$t();return i.jsx(te,{condition:e,show:i.jsx(Co,{"data-testid":qL,onClick:()=>t("/strategies/create"),permission:V4,size:"large",tooltipProps:{title:"New custom strategy"},children:i.jsx(Eo,{})}),elseShow:i.jsx(lo,{onClick:()=>t("/strategies/create"),color:"primary",permission:V4,"data-testid":qL,children:"New custom strategy"})})},VBe=v(an)(({theme:e})=>({marginLeft:e.spacing(1),display:"inline-block"})),UBe=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.mainHeader,width:"100%"})),NN=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(2),"& > span":{fontWeight:e.fontWeight.bold}})),FN=({title:e,description:t,link:n})=>i.jsxs(UBe,{children:[e,i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body2",component:"p",sx:{mb:1},children:t}),i.jsx(Sn,{href:n,target:"_blank",rel:"noopener noreferrer",variant:"body2",children:"Read more in the documentation"})]})})]}),GBe=()=>i.jsxs(Dt,{severity:"info",sx:{mb:2},children:["We recommend using gradual rollout. You can customize it with"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"constraints"})," ","and"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/activation-strategies#variants",target:"_blank",rel:"noopener noreferrer",children:"variants"}),"."]}),qBe=()=>{const e=$t(),[t,n]=g.useState({show:!1,title:"",onConfirm:()=>{}}),{strategies:r,refetchStrategies:o,loading:s}=Of(),{removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c}=PA(),{setToastData:u,setToastApiError:d}=_t();nd("Strategy types");const p=g.useMemo(()=>{if(s){const N=Array(5).fill({name:"Context name",description:"Context description when loading"});return{all:N,standard:N,advanced:N,custom:N}}const B=r.map(({name:N,description:I,editable:q,deprecated:ne,advanced:V})=>({name:N,description:I,editable:q,deprecated:ne,advanced:V})),H=B.filter(N=>!N.editable);return{all:B,standard:H.filter(N=>!N.advanced),advanced:H.filter(N=>N.advanced),custom:B.filter(N=>N.editable)}},[r,s]),f=g.useCallback(B=>H=>{n(H?{show:!0,title:"Really reactivate strategy?",onConfirm:async()=>{try{await c(B),o(),u({type:"success",text:"Strategy reactivated"})}catch(N){d(pt(N))}}}:{show:!0,title:"Really deprecate strategy?",onConfirm:async()=>{try{await l(B),o(),u({type:"success",text:"Strategy deprecated"})}catch(N){d(pt(N))}}})},[l,c,o,d,u]),h=g.useCallback(B=>{n({show:!0,title:"Really delete strategy?",onConfirm:async()=>{try{await a(B),o(),u({type:"success",text:"Strategy deleted"})}catch(H){d(pt(H))}}})},[a,o,d,u]),m=g.useCallback(B=>{e(`/strategies/${B.name}/edit`)},[e]),y=g.useMemo(()=>[{id:"Icon",Cell:()=>i.jsx(K,{"data-loading":!0,sx:{pl:3,pr:1,display:"flex",alignItems:"center"},children:i.jsx(dee,{color:"disabled"})})},{id:"Name",Header:"Name",accessor:B=>Xl(B.name),width:"90%",Cell:({row:{original:{name:B,description:H,deprecated:N}}})=>i.jsx(Yl,{"data-loading":!0,title:Xl(B),subtitle:H,to:`/strategies/${B}`,children:i.jsx(te,{condition:N,show:()=>i.jsx(VBe,{color:"disabled",children:"Disabled"})})}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>i.jsxs(Ku,{children:[i.jsx(IBe,{deprecated:B.deprecated,onToggle:f(B)}),i.jsx(te,{condition:B.editable,show:i.jsxs(i.Fragment,{children:[i.jsx(Ku.Divider,{}),i.jsx(OBe,{strategy:B,onClick:()=>m(B)}),i.jsx(NBe,{strategy:B,onClick:()=>h(B)})]})})]}),width:150,minWidth:120,disableSortBy:!0},{accessor:"description",disableSortBy:!0},{accessor:"sortOrder",sortType:"number"}],[f,m,h]),b=g.useMemo(()=>({sortBy:[{id:"Name",desc:!1}],hiddenColumns:["description","sortOrder"]}),[]),{getTableProps:x,getTableBodyProps:C,headerGroups:w,rows:j,prepareRow:k}=on.useTable({columns:y,data:p.standard,initialState:b,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},on.useSortBy),{getTableProps:S,getTableBodyProps:E,headerGroups:T,rows:R,prepareRow:_}=on.useTable({columns:y,data:p.advanced,initialState:b,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},on.useSortBy),{getTableProps:M,getTableBodyProps:$,headerGroups:z,rows:A,prepareRow:O}=on.useTable({columns:y,data:p.custom,initialState:b,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},on.useSortBy),L=()=>{t==null||t.onConfirm(),n(B=>({...B,show:!1}))};return i.jsxs(i.Fragment,{children:[i.jsxs(ir,{isLoading:s,header:i.jsx($n,{titleElement:i.jsx(FN,{title:"Standard strategies",description:"Standard strategies let you enable a feature only for a specified audience. Select a starting setup, then customize your strategy with targeting and variants.",link:"https://docs.getunleash.io/concepts/activation-strategies"})}),children:[i.jsxs(K,{children:[i.jsx(GBe,{}),i.jsxs(ja,{...x(),children:[i.jsx(Sa,{headerGroups:w}),i.jsx(Ji,{...C(),children:j.map(B=>{k(B);const{key:H,...N}=B.getRowProps();return i.jsx(ti,{hover:!0,...N,children:B.cells.map(I=>{const{key:q,...ne}=I.getCellProps();return i.jsx(Ci,{...ne,children:I.render("Cell")},q)})},H)})})]}),i.jsx(te,{condition:j.length===0,show:i.jsx(Gr,{children:"No strategies available."})})]}),i.jsx(Mn,{open:t.show,onClick:L,title:t==null?void 0:t.title,onClose:()=>n(B=>({...B,show:!1}))})]}),i.jsxs(ir,{isLoading:s,header:i.jsx($n,{titleElement:i.jsx(FN,{title:"Advanced and custom strategies",description:"Advanced strategies let you target based on specific properties. Custom activation strategies let you define your own activation strategies to use with Unleash.",link:"https://docs.getunleash.io/concepts/activation-strategies#custom-strategies"})}),sx:{mt:2},children:[i.jsxs(K,{children:[i.jsx(NN,{children:i.jsx("span",{children:"Advanced strategies"})}),i.jsxs(ja,{...S(),children:[i.jsx(Sa,{headerGroups:T}),i.jsx(Ji,{...E(),children:R.map(B=>{_(B);const{key:H,...N}=B.getRowProps();return i.jsx(ti,{hover:!0,...N,children:B.cells.map(I=>{const{key:q,...ne}=I.getCellProps();return i.jsx(Ci,{...ne,children:I.render("Cell")},q)})},H)})})]}),i.jsx(te,{condition:R.length===0,show:i.jsx(Gr,{children:"No advanced strategies available."})})]}),i.jsxs(K,{children:[i.jsxs(NN,{sx:{mt:4},children:[i.jsx("span",{children:"Custom strategies"}),i.jsx(WBe,{})]}),i.jsxs(ja,{...M(),children:[i.jsx(Sa,{headerGroups:z}),i.jsx(Ji,{...$(),children:A.map(B=>{O(B);const{key:H,...N}=B.getRowProps();return i.jsx(ti,{hover:!0,...N,children:B.cells.map(I=>{const{key:q,...ne}=I.getCellProps();return i.jsx(Ci,{...ne,children:I.render("Cell")},q)})},H)})})]}),i.jsx(te,{condition:A.length===0,show:i.jsx(mee,{})})]}),i.jsx(Mn,{open:t.show,onClick:L,title:t==null?void 0:t.title,onClose:()=>n(B=>({...B,show:!1}))})]})]})};var OA={},YBe=je;Object.defineProperty(OA,"__esModule",{value:!0});var yee=OA.default=void 0,KBe=YBe(Ee()),XBe=i,JBe=(0,KBe.default)((0,XBe.jsx)("path",{d:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"}),"Label");yee=OA.default=JBe;const b7=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{createTag:async c=>{const d=t("api/admin/tag-types",{method:"POST",body:JSON.stringify(c)});return e(d.caller,d.id)},validateTagName:async c=>{const d=t("api/admin/tag-types/validate",{method:"POST",body:JSON.stringify({name:c})});return e(d.caller,d.id)},updateTagType:async(c,u)=>{const d=`api/admin/tag-types/${c}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},deleteTagType:async c=>{const u=`api/admin/tag-types/${c}`,d=t(u,{method:"DELETE"});return e(d.caller,d.id)},errors:n,loading:r}},ZBe=(e={})=>{const t=async()=>{const c=yt("api/admin/tag-types");return(await fetch(c,{method:"GET"}).then(en("Tag types"))).json()},n="api/admin/tag-types",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=()=>{Fo(n)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{tagTypes:(r==null?void 0:r.tagTypes)||[],error:o,loading:s,refetch:l}},QBe=()=>{const e=$t(),t=Nn("(max-width:700px)");return i.jsx(te,{condition:t,show:i.jsx(Co,{onClick:()=>e("/tag-types/create"),size:"large",permission:SS,children:i.jsx(Eo,{})}),elseShow:i.jsx(lo,{permission:SS,onClick:()=>e("/tag-types/create"),children:"New tag type"})})},eze=v("div")(({theme:e,$color:t})=>({width:"12px",height:"12px",borderRadius:"50%",backgroundColor:t,marginRight:e.spacing(.2),marginLeft:e.spacing(1.5),border:t==="#FFFFFF"?`1px solid ${e.palette.divider}`:`1px solid ${t}`})),tze=()=>{const[e,t]=g.useState({open:!1}),n=$t(),{deleteTagType:r}=b7(),{tagTypes:o,refetch:s,loading:a}=ZBe(),{setToastData:l,setToastApiError:c}=_t(),u=g.useMemo(()=>a?Array(5).fill({name:"Tag type name",description:"Tag type description when loading"}):o.map(({name:j,description:k,color:S})=>({name:j,description:k,color:S})),[o,a]),d=g.useMemo(()=>[{id:"Icon",Cell:()=>i.jsx(K,{"data-loading":!0,sx:{pl:2,pr:1,display:"flex",alignItems:"center"},children:i.jsx(yee,{color:"disabled"})}),disableGlobalFilter:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:j,description:k,color:S}}})=>i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(te,{condition:!!S,show:i.jsx(eze,{$color:S})}),i.jsx(Yl,{"data-loading":!0,title:j,subtitle:k})]}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:j}})=>i.jsxs(K,{sx:{display:"flex",justifyContent:"flex-end"},"data-loading":!0,children:[i.jsx(Co,{onClick:()=>n(`/tag-types/edit/${j.name}`),permission:dQ,tooltipProps:{title:"Edit tag type"},children:i.jsx(oi,{})}),i.jsx(Co,{permission:dOe,tooltipProps:{title:"Delete tag type"},onClick:()=>t({open:!0,name:j.name}),children:i.jsx(So,{})})]}),width:150,disableGlobalFilter:!0,disableSortBy:!0},{accessor:"description",disableSortBy:!0}],[n]),p=g.useMemo(()=>({sortBy:[{id:"name",desc:!1}],hiddenColumns:["description"]}),[]),{getTableProps:f,getTableBodyProps:h,headerGroups:m,rows:y,prepareRow:b,state:{globalFilter:x},setGlobalFilter:C}=on.useTable({columns:d,data:u,initialState:p,sortTypes:Ds,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},on.useGlobalFilter,on.useSortBy),w=async()=>{try{e.name&&(await r(e.name),s(),t({open:!1}),l({type:"success",show:!0,text:"Tag type deleted"}))}catch(j){c(pt(j))}};return i.jsxs(ir,{isLoading:a,header:i.jsx($n,{title:`Tag types (${y.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:x,onChange:C}),i.jsx($n.Divider,{}),i.jsx(QBe,{})]})}),children:[i.jsx(Ai,{value:x,children:i.jsxs(ja,{...f(),children:[i.jsx(Sa,{headerGroups:m}),i.jsx(Ji,{...h(),children:y.map(j=>{b(j);const{key:k,...S}=j.getRowProps();return i.jsx(ti,{hover:!0,...S,children:j.cells.map(E=>{const{key:T,...R}=E.getCellProps();return i.jsx(Ci,{...R,children:E.render("Cell")},T)})},k)})})]})}),i.jsx(te,{condition:y.length===0,show:i.jsx(te,{condition:(x==null?void 0:x.length)>0,show:i.jsxs(Gr,{children:["No tags found matching “",x,"”"]}),elseShow:i.jsx(Gr,{children:"No tags available. Get started by adding one."})})}),i.jsx(Mn,{title:"Really delete Tag type?",open:e.open,onClick:w,onClose:()=>{t({open:!1})}})]})},uy=(e={})=>{const t=async()=>{const c=yt("api/admin/addons");return(await fetch(c,{method:"GET"}).then(en("Addons"))).json()},n="api/admin/addons",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=g.useCallback(()=>{Fo(n)},[n]);return g.useEffect(()=>{a(!o&&!r)},[r,o]),{addons:(r==null?void 0:r.addons)||[],providers:(r==null?void 0:r.providers)||[],error:o,loading:s,refetchAddons:l}};var MA={},nze=je;Object.defineProperty(MA,"__esModule",{value:!0});var xee=MA.default=void 0,rze=nze(Ee()),oze=i,sze=(0,rze.default)((0,oze.jsx)("path",{d:"m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}),"DeviceHub");xee=MA.default=sze;const K4=e=>e.charAt(0).toUpperCase()+e.slice(1),ize="/static/datadog-D7T0xtkO.svg",aze="/static/new-relic-BupjBFL1.svg",lze="/static/jira-l0bo9uCD.svg",cze="/static/jira-comment-Di5ugPYV.svg",uze="/static/signals-CAlQRJwW.svg",dze="/static/terraform-Eb_8o2u1.svg",BN="/static/slack-t0fNwPed.svg",pze="/static/teams-DvQx_FzB.svg",fze="/static/webhooks-Cnts0gfu.svg",hze="/static/unleash-integration-Ctxqm5Ve.svg",gze="/static/Logo-android-C52ktdfV.svg",mze="/static/Logo-net-BsbSafnp.svg",yze="/static/Logo-flutter-B4Npq361.svg",xze="/static/Logo-go-DsgFcp5h.svg",vze="/static/Logo-swift-B2XvejNd.svg",bze="/static/Logo-java-DnZJK2S1.svg",Cze="/static/Logo-javascript-Uv1If6qs.svg",wze="/static/Logo-node-CHfuizy_.svg",Sze="/static/Logo-php-Bn8RVcvR.svg",jze="/static/Logo-python-D_jhkoJJ.svg",Eze="/static/Logo-react-D2SuVol5.svg",kze="/static/Logo-ruby-BlkEeyzc.svg",Tze="/static/Logo-rust-DZ1V0dgh.svg",Rze="/static/Logo-svelte-B-fbfLhe.svg",Aze="/static/Logo-vue-Bc1zMJ6g.svg",V9=v(N5)(({theme:e})=>({background:"transparent",marginRight:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(4),height:e.spacing(4),fontSize:"28px"})),Pze={datadog:{title:"Datadog",icon:ize},"new-relic":{title:"New Relic",icon:aze},jira:{title:"Jira",icon:lze},"jira-comment":{title:"Jira",icon:cze},signals:{title:"Signals",icon:uze},terraform:{title:"Terraform",icon:dze},slack:{title:"Slack",icon:BN},"slack-app":{title:"Slack",icon:BN},teams:{title:"Teams",icon:pze},webhook:{title:"Webhook",icon:fze},unleash:{title:"Unleash",icon:hze},android:{title:"Android",icon:gze},dotnet:{title:"Dotnet",icon:mze},flutter:{title:"Flutter",icon:yze},go:{title:"Go",icon:xze},swift:{title:"Swift",icon:vze},java:{title:"Java",icon:bze},javascript:{title:"Javascript",icon:Cze},node:{title:"Node",icon:wze},php:{title:"PHP",icon:Sze},python:{title:"Python",icon:jze},react:{title:"React",icon:Eze},ruby:{title:"Ruby",icon:kze},rust:{title:"Rust",icon:Tze},svelte:{title:"Svelte",icon:Rze},vue:{title:"Vue",icon:Aze}},vee=({name:e})=>{const t=Pze[e];return t?typeof t.icon=="string"?i.jsx(V9,{src:Do(t.icon),alt:`${K4(t.title)} icon`,variant:"rounded"}):i.jsx(V9,{alt:`${K4(t.title)} icon`,variant:"rounded",children:t.icon}):i.jsx(V9,{variant:"rounded",children:i.jsx(xee,{})})};var $A={},_ze=je;Object.defineProperty($A,"__esModule",{value:!0});var DA=$A.default=void 0,Ize=_ze(Ee()),Oze=i,Mze=(0,Ize.default)((0,Oze.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");DA=$A.default=Mze;var LA={},$ze=je;Object.defineProperty(LA,"__esModule",{value:!0});var Mf=LA.default=void 0,Dze=$ze(Ee()),Lze=i,Nze=(0,Dze.default)((0,Lze.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreVert");Mf=LA.default=Nze;const NA=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),o="api/admin/addons",s=async c=>{const d=t(o,{method:"POST",body:JSON.stringify(c)});return e(d.caller,d.id)},a=async c=>{const u=`${o}/${c}`,d=t(u,{method:"DELETE"});return e(d.caller,d.id)},l=g.useCallback(async c=>{const u=`${o}/${c.id}`,d=t(u,{method:"PUT",body:JSON.stringify(c)});return e(d.caller,d.id)},[t,e]);return{createAddon:s,updateAddon:l,removeAddon:a,errors:n,loading:r}};var FA={},Fze=je;Object.defineProperty(FA,"__esModule",{value:!0});var dy=FA.default=void 0,Bze=Fze(Ee()),zze=i,Hze=(0,Bze.default)((0,zze.jsx)("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"Visibility");dy=FA.default=Hze;const Kd=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:s})=>{const{hasAccess:a}=g.useContext(Bo);let l;return t&&r?l=a(e,t,r):t?l=a(e,t):l=a(e),i.jsx(ra,{...s,title:iy(l,o),children:n({hasAccess:l})})},zN=250,bee=v("div")(({theme:e})=>({position:"absolute",top:0,right:0,bottom:0,height:"100vh",maxWidth:"98vw",overflow:"auto",boxShadow:"0 0 1rem rgba(0, 0, 0, 0.25)",background:e.palette.background.paper})),Wze=v(bee)({width:1300}),Vze=v(Mt)(({theme:e})=>({zIndex:1,position:"absolute",top:e.spacing(3),right:e.spacing(3)})),BA=({open:e,onClose:t,onClick:n,label:r,children:o})=>i.jsx(Hg,{open:e,onClose:t,onClick:n,closeAfterTransition:!0,"aria-label":r,BackdropComponent:F5,BackdropProps:{timeout:zN},"data-testid":Vje,sx:{minHeight:"100vh"},children:i.jsx(zg,{timeout:zN,in:e,children:o})}),hl=e=>i.jsx(BA,{...e,children:i.jsx(Wze,{children:e.children})}),Hqt=e=>i.jsx(BA,{...e,children:i.jsxs(bee,{children:[i.jsx(Rt,{title:"Close",arrow:!0,describeChild:!0,children:i.jsx(Vze,{onClick:e.onClose,children:i.jsx(bo,{})})}),e.children]})}),Uze=()=>{},Gze=Uze(),PS=Object,HN=e=>e===Gze,qze=e=>typeof e=="function",Lx=new WeakMap,Yze=e=>PS.prototype.toString.call(e),U9=(e,t)=>e===`[object ${t}]`;let Kze=0;const _S=e=>{const t=typeof e,n=Yze(e),r=U9(n,"Date"),o=U9(n,"RegExp"),s=U9(n,"Object");let a,l;if(PS(e)===e&&!r&&!o){if(a=Lx.get(e),a)return a;if(a=++Kze+"~",Lx.set(e,a),Array.isArray(e)){for(a="@",l=0;l<e.length;l++)a+=_S(e[l])+",";Lx.set(e,a)}if(s){a="#";const c=PS.keys(e).sort();for(;!HN(l=c.pop());)HN(e[l])||(a+=l+":"+_S(e[l])+",");Lx.set(e,a)}}else a=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return a},Xze=e=>{if(qze(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?_S(e):"",[e,t]},Jze=e=>Xze(e?e(0,null):null)[0],G9=Promise.resolve(),Zze=e=>(t,n,r)=>{const o=g.useRef(!1),{cache:s,initialSize:a=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:p=!1}=r,[,,,f]=_c.get(q5);let h;try{h=Jze(t),h&&(h=EJ+h)}catch{}const[m,y,b]=Id(s,h),x=g.useCallback(()=>En(m()._l)?a:m()._l,[s,h,a]);tS.useSyncExternalStore(g.useCallback(T=>h?b(h,()=>{T()}):()=>{},[s,h]),x,x);const C=g.useCallback(()=>{const T=m()._l;return En(T)?a:T},[h,a]),w=g.useRef(C());t2(()=>{if(!o.current){o.current=!0;return}h&&y({_l:c?w.current:C()})},[h,s]);const j=d&&!o.current,k=e(h,async T=>{const R=m()._i,_=m()._r;y({_r:is});const M=[],$=C(),[z]=Id(s,T),A=z().data,O=[];let L=null;for(let B=0;B<$;++B){const[H,N]=s3(t(B,p?null:L));if(!H)break;const[I,q]=Id(s,H);let ne=I().data;const V=l||R||En(ne)||u&&!B&&!En(A)||j||A&&!En(A[B])&&!r.compare(A[B],ne);if(n&&(typeof _=="function"?_(ne,N):V)){const oe=async()=>{if(!(H in f))ne=await n(N);else{const ae=f[H];delete f[H],ne=await ae}q({data:ne,_k:N}),M[B]=ne};p?O.push(oe):await oe()}else M[B]=ne;p||(L=ne)}return p&&await Promise.all(O.map(B=>B())),y({_i:is}),M},r),S=g.useCallback(function(T,R){const _=typeof R=="boolean"?{revalidate:R}:R||{},M=_.revalidate!==!1;return h?(M&&(En(T)?y({_i:!0,_r:_.revalidate}):y({_i:!1,_r:_.revalidate})),arguments.length?k.mutate(T,{..._,revalidate:M}):k.mutate()):G9},[h,s]),E=g.useCallback(T=>{if(!h)return G9;const[,R]=Id(s,h);let _;if(Ja(T)?_=T(C()):typeof T=="number"&&(_=T),typeof _!="number")return G9;R({_l:_}),w.current=_;const M=[],[$]=Id(s,h);let z=null;for(let A=0;A<_;++A){const[O]=s3(t(A,z)),[L]=Id(s,O),B=O?L().data:is;if(En(B))return S($().data);M.push(B),z=B}return S(M)},[h,s,S,C]);return{size:C(),setSize:E,mutate:S,get data(){return k.data},get error(){return k.error},get isValidating(){return k.isValidating},get isLoading(){return k.isLoading}}},Cee=AJ(On,Zze),Qze=async e=>{const t=await fetch(e);return await en("Integration events")(t),t.json()},wee=(e,t=50,n={})=>{var b;const{isAdmin:r}=g.useContext(Bo),o=(x,C)=>!e||!r||C&&!C.integrationEvents.length?null:yt(`api/admin/addons/${e}/events?limit=${t}&offset=${x*t}`),{data:s,error:a,size:l,setSize:c,mutate:u}=Cee(o,Qze,{...n,revalidateAll:!0}),d=s?s.flatMap(({integrationEvents:x})=>x):[],p=!s&&!a,f=l>0&&!(s!=null&&s[l-1]),h=p||f,m=((b=s==null?void 0:s[l-1])==null?void 0:b.integrationEvents.length)===t;return{integrationEvents:d,hasMore:m,loadMore:()=>{h||!m||c(l+1)},loading:h,refetch:()=>u(),error:a}},eHe=v("div")(({theme:e})=>({backgroundColor:e.palette.codebox,padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium,position:"relative",maxHeight:"500px",overflow:"auto"})),tHe=v("pre")(({theme:e})=>({margin:0,wordBreak:"break-all",whiteSpace:"pre-wrap",color:e.palette.common.white,fontSize:e.fontSizes.smallBody})),nHe=({text:e})=>i.jsx(eHe,{children:i.jsx(tHe,{children:e})});var zA={},rHe=je;Object.defineProperty(zA,"__esModule",{value:!0});var $f=zA.default=void 0,oHe=rHe(Ee()),sHe=i,iHe=(0,oHe.default)((0,sHe.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");$f=zA.default=iHe;var HA={},aHe=je;Object.defineProperty(HA,"__esModule",{value:!0});var See=HA.default=void 0,lHe=aHe(Ee()),cHe=i,uHe=(0,lHe.default)((0,cHe.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}),"Info");See=HA.default=uHe;const dHe="/static/unleashLogoIconDarkAlpha-BbvuC13D.gif",pHe=v("div",{shouldForwardProp:e=>e!=="type"})(({theme:e,type:t})=>({display:"flex",justifyContent:"center",alignItems:"center",height:t==="fullscreen"?"100vh":"100%",backgroundColor:e.palette.background.paper})),fHe=v("img")(({theme:e})=>({width:"100px",height:"100px"})),X4=({type:e="inline"})=>i.jsx(pHe,{role:"alert","aria-label":"Loading",type:e,children:i.jsx(fHe,{src:Do(dHe),alt:""})});var hHe=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},gHe=hHe,WN={"text/plain":"Text","text/html":"Url",default:"Text"},mHe="Copy to clipboard: #{key}, Enter";function yHe(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function xHe(e,t){var n,r,o,s,a,l,c=!1;t||(t={}),n=t.debug||!1;try{o=gHe(),s=document.createRange(),a=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(d){if(d.stopPropagation(),t.format)if(d.preventDefault(),typeof d.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var p=WN[t.format]||WN.default;window.clipboardData.setData(p,e)}else d.clipboardData.clearData(),d.clipboardData.setData(t.format,e);t.onCopy&&(d.preventDefault(),t.onCopy(d.clipboardData))}),document.body.appendChild(l),s.selectNodeContents(l),a.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(d){n&&console.error("unable to copy using execCommand: ",d),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(p){n&&console.error("unable to copy using clipboardData: ",p),n&&console.error("falling back to prompt"),r=yHe("message"in t?t.message:mHe),window.prompt(r,e)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(s):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return c}var vHe=xHe;const C7=ls(vHe),bHe=e=>g.createElement("svg",{width:48,height:50,viewBox:"0 0 48 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M0.5 0.000193412C11 2.00019 17 9 18 18C19 27 23.5 31.5 30.5 34C37.5 36.5 47.34 41.4 48 49.5L48 12.0012C48 5.37332 42.6309 0.000381623 36.003 0.000366343C24.1359 0.000338986 8.66406 -0.000263908 0.5 0.000193412Z",fill:"#6C65E5"})),jee=36,CHe=100-jee,Eee=`${jee}%`,wHe="420px",SHe=`${CHe}%`,jHe=v("section",{shouldForwardProp:e=>!["modal","compact"].includes(e.toString())})(({theme:e,modal:t,compact:n})=>({minHeight:t?"100vh":n?"unset":"80vh",borderRadius:t?0:e.spacing(2),width:"100%",display:"flex",margin:"0 auto",overflow:t||n?"unset":"hidden",[e.breakpoints.down(1100)]:{flexDirection:"column",minHeight:0}})),EHe=v("div",{shouldForwardProp:e=>!["guidanceHeight"].includes(e.toString())})(({theme:e,guidanceHeight:t})=>({...Q9e,...t?{aside:{height:t}}:{}})),kHe=v("div",{shouldForwardProp:e=>e!=="useFixedSidebar"})(({theme:e,useFixedSidebar:t})=>({display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,width:t?"initial":SHe,[e.breakpoints.down(1100)]:{width:"100%"}})),THe=v("div",{shouldForwardProp:e=>!["disablePadding","compactPadding"].includes(e.toString())})(({theme:e,disablePadding:t,compactPadding:n})=>{const r=t?0:n?e.spacing(4):e.spacing(6),o=t?0:e.spacing(4),s=t?0:e.spacing(2),a=t?0:e.spacing(4);return{"--form-content-padding":r,backgroundColor:e.palette.background.paper,display:"flex",flexDirection:"column",flexGrow:1,padding:r,[e.breakpoints.down("lg")]:{padding:o,"--form-content-padding":o},[e.breakpoints.down(1100)]:{width:"100%"},[e.breakpoints.down(500)]:{paddingInline:s,paddingBlock:a,"--form-content-padding":s}}}),RHe=v("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(4,6),[e.breakpoints.down("lg")]:{padding:e.spacing(4)},[e.breakpoints.down(500)]:{padding:e.spacing(4,2)}})),AHe=v("h1")(({theme:e})=>({marginBottom:e.fontSizes.mainHeader,fontWeight:"normal"})),PHe=v(pr)(({theme:e})=>({opacity:.3,marginBottom:e.spacing(.5)})),_He=v("h2")(({theme:e})=>({color:e.palette.common.white,marginBottom:e.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.bodySize})),IHe=v($f)(({theme:e})=>({fill:e.palette.primary.contrastText})),OHe=v("div")(()=>({zIndex:1,position:"absolute",right:-3,top:-3})),MHe=v(bHe)(()=>({width:"75px",height:"75px"})),$He=v(Mt)(()=>({position:"absolute",zIndex:400,right:0})),DHe=v(See)(({theme:e})=>({fill:e.palette.primary.contrastText})),kee=v("aside",{shouldForwardProp:e=>!["sidebarWidth","fixedCodeHeight"].includes(e.toString())})(({theme:e,sidebarWidth:t,fixedCodeHeight:n})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(4),flexGrow:0,flexShrink:0,width:t||Eee,[e.breakpoints.down(1100)]:{width:"100%"},[e.breakpoints.down(500)]:{padding:e.spacing(4,2)},...n?{pre:{height:n}}:{}})),LHe=v("article")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2),alignItems:"center",zIndex:1,color:e.palette.common.white,position:"relative",marginBlockEnd:e.spacing(3)})),NHe=v("div")(()=>({width:"100%"})),FHe=v("div")(({theme:e})=>({margin:e.spacing(3,0),display:"flex",alignItems:"center",width:"100%"})),BHe=v(X5)(({theme:e})=>({marginRight:e.spacing(1),color:e.palette.primary.contrastText})),zHe=v("a")(({theme:e})=>({color:e.palette.primary.contrastText,display:"block","&:hover":{textDecoration:"none"}})),eo=({title:e,description:t,children:n,documentationLink:r,documentationIcon:o,documentationLinkLabel:s,loading:a,modal:l,formatApiCode:c,disablePadding:u,compactPadding:d=!1,showDescription:p=!0,showLink:f=!0,footer:h,compact:m,showGuidance:y=!0,useFixedSidebar:b,sidebarWidth:x})=>{const{setToastData:C}=_t(),w=Nn("(max-width:1099px)"),j=()=>{c!==void 0&&(C7(c())?C({text:"Command copied",autoHideDuration:6e3,type:"success",show:!0}):C({text:"Could not copy the command",autoHideDuration:6e3,type:"error",show:!0}))},k=(E,T=!1)=>{if(!E)return i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!T,show:i.jsx(PHe,{})}),i.jsxs(_He,{children:["API Command"," ",i.jsx(Rt,{title:"Copy command",arrow:!0,children:i.jsx(Mt,{onClick:j,size:"large",children:i.jsx(IHe,{})})})]}),i.jsx(nHe,{text:c()})," "]})},S=b?WHe:Ree;return i.jsxs(jHe,{modal:l,compact:m,children:[i.jsx(te,{condition:y&&w,show:i.jsx(EHe,{guidanceHeight:b?"240px":void 0,children:i.jsx(HHe,{description:t,documentationIcon:o,documentationLink:r,documentationLinkLabel:s})})}),i.jsxs(kHe,{useFixedSidebar:b,children:[i.jsx(THe,{disablePadding:u,compactPadding:d,children:i.jsx(te,{condition:a||!1,show:i.jsx(X4,{}),elseShow:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:e!==void 0,show:i.jsx(AHe,{children:e})}),n]})})}),i.jsx(te,{condition:h!==void 0,show:()=>i.jsxs(i.Fragment,{children:[i.jsx(pr,{}),i.jsx(RHe,{children:h})]})})]}),i.jsx(te,{condition:y&&!w,show:i.jsx(S,{documentationIcon:o,description:t,documentationLink:r,documentationLinkLabel:s,showDescription:p,showLink:f,sidebarWidth:x,children:k(c===void 0,!(p||f))})})]})},HHe=({description:e,documentationLink:t,documentationLinkLabel:n,documentationIcon:r})=>{const[o,s]=g.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(OHe,{children:i.jsx(MHe,{})}),i.jsx(Rt,{title:"Toggle help",arrow:!0,children:i.jsx($He,{onClick:()=>s(a=>!a),size:"large",children:i.jsx(DHe,{})})}),i.jsx(W3,{in:o,timeout:500,children:i.jsx(Ree,{documentationIcon:r,description:e,documentationLink:t,documentationLinkLabel:n})})]})},Tee=({description:e,children:t,documentationLink:n,documentationIcon:r,documentationLinkLabel:o="Learn more",showDescription:s=!0,showLink:a=!0,fixedDocumentationHeight:l})=>{const c=v("div")({height:"2rem",display:"grid",placeItems:"center"}),u=v("div")({height:l,overflowY:"auto"}),d=l?u:tt.Fragment;return i.jsxs(i.Fragment,{children:[i.jsxs(d,{children:[i.jsx(te,{condition:s,show:i.jsxs(LHe,{children:[i.jsx(te,{condition:!!r,show:i.jsx(c,{children:r})}),i.jsx(NHe,{children:e})]})}),i.jsx(te,{condition:a&&!!n,show:i.jsxs(FHe,{children:[i.jsx(BHe,{}),i.jsx(zHe,{href:n,rel:"noopener noreferrer",target:"_blank",children:o})]})})]}),t]})},Ree=({sidebarWidth:e,...t})=>i.jsx(kee,{sidebarWidth:e,children:i.jsx(Tee,{...t})}),WHe=({sidebarWidth:e,...t})=>i.jsx(kee,{sidebarWidth:wHe,fixedCodeHeight:"300px",children:i.jsx(Tee,{...t,fixedDocumentationHeight:"170px"})}),VHe=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",borderTopLeftRadius:e.shape.borderRadiusMedium,borderTopRightRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.table.headerBackground})),VN=v("div",{shouldForwardProp:e=>e!=="maxWidth"})(({maxWidth:e})=>({display:"flex",flex:1,...e&&{maxWidth:e}})),UHe=({columns:e,sidePanelHeader:t,leftPanelMaxWidth:n})=>i.jsxs(VHe,{children:[i.jsx(VN,{maxWidth:n,children:e.map(({header:r,maxWidth:o,align:s})=>i.jsx(IS,{maxWidth:o,align:s,children:r},r))}),i.jsx(VN,{children:i.jsx(IS,{children:t})})]}),GHe=v("div")(({theme:e})=>({borderBottom:`1px solid ${e.palette.divider}`})),qHe=v($e,{shouldForwardProp:e=>e!=="selected"})(({theme:e,selected:t})=>({"&.MuiButton-root":{width:"100%",backgroundColor:t?e.palette.secondary.light:"transparent",borderRight:`${e.spacing(.5)} solid ${t?e.palette.background.alternative:"transparent"}`,padding:0,borderRadius:0,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,overflow:"auto"},"&:hover":{backgroundColor:t?e.palette.secondary.light:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`}})),YHe=({selected:e,onClick:t,children:n})=>i.jsx(GHe,{children:i.jsx(qHe,{selected:e,onClick:t,children:n})}),KHe=v("div")({display:"flex",flexDirection:"column",width:"100%"}),XHe=v("div")({display:"flex",flexDirection:"row"}),Aee=v("div")({display:"flex",flexDirection:"column",flex:1}),JHe=v(Aee,{shouldForwardProp:e=>e!=="height"&&e!=="maxWidth"})(({theme:e,height:t,maxWidth:n})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderBottomLeftRadius:e.shape.borderRadiusMedium,overflow:"auto",...t&&{height:t},...n&&{maxWidth:n}})),ZHe=v(Aee)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderLeft:0,borderBottomRightRadius:e.shape.borderRadiusMedium})),IS=v("div",{shouldForwardProp:e=>e!=="maxWidth"&&e!=="align"})(({theme:e,maxWidth:t,align:n="start"})=>({display:"flex",flex:1,padding:e.spacing(2),fontSize:e.fontSizes.smallBody,justifyContent:n,...t&&{maxWidth:t},textAlign:n,alignItems:"center"})),Pee=({items:e,columns:t,sidePanelHeader:n,renderContent:r,renderItem:o=(l,c)=>c,height:s,listEnd:a})=>{const[l,c]=g.useState(e[0]);if(e.length===0)return null;const u=l||e[0],d=t.every(({maxWidth:p})=>!!p)?t.reduce((p,{maxWidth:f})=>p+(f||0),0):void 0;return i.jsxs(KHe,{children:[i.jsx(UHe,{columns:t,sidePanelHeader:n,leftPanelMaxWidth:d}),i.jsxs(XHe,{children:[i.jsxs(JHe,{height:s,maxWidth:d,children:[e.map(p=>o(p,i.jsx(YHe,{selected:u.id===p.id,onClick:()=>c(p),children:t.map(({header:f,maxWidth:h,align:m,cell:y})=>i.jsx(IS,{maxWidth:h,align:m,children:y(p)},f))},p.id))),a]}),i.jsx(ZHe,{children:r(u)})]})]})};var WA={},QHe=je;Object.defineProperty(WA,"__esModule",{value:!0});var n0=WA.default=void 0,eWe=QHe(Ee()),tWe=i,nWe=(0,eWe.default)((0,tWe.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"CheckCircleOutline");n0=WA.default=nWe;var VA={},rWe=je;Object.defineProperty(VA,"__esModule",{value:!0});var UA=VA.default=void 0,oWe=rWe(Ee()),sWe=i,iWe=(0,oWe.default)((0,sWe.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline");UA=VA.default=iWe;var GA={},aWe=je;Object.defineProperty(GA,"__esModule",{value:!0});var py=GA.default=void 0,lWe=aWe(Ee()),UN=i,cWe=(0,lWe.default)([(0,UN.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2z"},"0"),(0,UN.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");py=GA.default=cWe;const uWe=v(n0)(({theme:e})=>({color:e.palette.success.main})),dWe=v(UA)(({theme:e})=>({color:e.palette.error.main})),pWe=v(py)(({theme:e})=>({color:e.palette.warning.main})),_ee=({state:e})=>e==="success"?i.jsx(uWe,{}):e==="failed"?i.jsx(dWe,{}):i.jsx(pWe,{}),fWe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),hWe=function(e){return"/"+e},GN={},La=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));o=Promise.allSettled(n.map(c=>{if(c=hWe(c),c in GN)return;GN[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":fWe,u||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,h)=>{p.addEventListener("load",f),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},gWe=v(tu)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),mWe=v(ru)({lineHeight:"1.5rem"}),yWe=({header:e,children:t})=>i.jsxs(gWe,{children:[i.jsx(mWe,{expandIcon:i.jsx(Mt,{children:i.jsx(Da,{titleAccess:"Toggle"})}),children:e}),i.jsx(nu,{children:t})]}),qN=g.lazy(()=>La(()=>import("./ReactJSONEditor-9cJL1vJY.js"),[])),xWe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),vWe=v(Dt)({fontSize:"inherit",lineBreak:"anywhere"}),bWe=v(ft)(({theme:e})=>({marginLeft:e.spacing(1)})),Iee=({state:e,stateDetails:t,event:n,details:r})=>{const o=e==="failed"?"error":e==="success"?"success":"warning",s=e==="success"?i.jsx(n0,{}):void 0;return i.jsxs(xWe,{children:[i.jsx(vWe,{severity:o,icon:s,children:t}),i.jsx(yWe,{header:i.jsxs(i.Fragment,{children:["Event:",i.jsx(bWe,{to:"/history",children:n.type})]}),children:i.jsx(g.Suspense,{fallback:null,children:i.jsx(qN,{content:{json:n},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})}),i.jsx(g.Suspense,{fallback:null,children:i.jsx(qN,{content:{json:r},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})]})},CWe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),YN=v("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),wWe=v("h1")({fontWeight:"normal"}),SWe=v("h2")(({theme:e})=>({marginTop:e.spacing(1.5),fontSize:e.fontSizes.smallBody,fontWeight:"normal"})),jWe=v("form")({display:"flex",flexDirection:"column",height:"100%"}),EWe=v("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),kWe=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Oee=({addon:e,open:t,setOpen:n})=>{const r=$t(),{locationSettings:o}=$r(),{integrationEvents:s,hasMore:a,loadMore:l,loading:c}=wee(t?e==null?void 0:e.id:void 0,20,{refreshInterval:5e3});if(!e)return null;const u=`Events: ${e.provider}${e.description?` - ${e.description}`:""} (id: ${e.id})`;return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:u,children:i.jsxs(eo,{loading:c&&s.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[i.jsxs(CWe,{children:[i.jsxs(YN,{children:[i.jsx(wWe,{children:u}),i.jsx(Sn,{onClick:()=>{n(!1),r(`/integrations/edit/${e.id}`)},children:"View configuration"})]}),i.jsx(YN,{children:i.jsx(SWe,{children:"Only the most recent event for each integration and the last 100 events from the past 2 hours will be kept. All other events will be automatically deleted."})})]}),i.jsxs(jWe,{children:[i.jsx(Pee,{height:960,items:s,columns:[{header:"Status",align:"center",maxWidth:100,cell:_ee},{header:"Date",maxWidth:240,cell:({createdAt:d})=>ji(d,o==null?void 0:o.locale)}],sidePanelHeader:"Details",renderContent:Iee,renderItem:({id:d,state:p},f)=>p==="failed"?i.jsx(EWe,{children:f},d):f,listEnd:i.jsx(te,{condition:a,show:i.jsx($e,{onClick:l,children:"Load more"})})}),i.jsx(te,{condition:s.length===0,show:i.jsx("p",{children:"No events have been registered for this integration configuration."})}),i.jsx(kWe,{children:i.jsx($e,{onClick:()=>n(!1),children:"Close"})})]})]})})},TWe=v("div")(({theme:e})=>({marginLeft:e.spacing(1),marginTop:e.spacing(-1),marginBottom:e.spacing(-1),marginRight:e.spacing(-1),display:"flex",alignItems:"center"})),RWe=({addon:e})=>{const[t,n]=g.useState(!1),[r,o]=g.useState(!1),[s,a]=g.useState(!1),[l,c]=g.useState(null),{updateAddon:u,removeAddon:d}=NA(),{refetchAddons:p}=uy(),{setToastData:f,setToastApiError:h}=_t(),[m,y]=g.useState(!1),b=()=>{n(!1),c(null)},x=S=>{t?b():(c(S.currentTarget),n(!0))},C=pf(pQ),w=pf(fQ),j=g.useCallback(async()=>{try{await u({...e,enabled:!e.enabled}),p(),f({type:"success",text:e.enabled?"Integration disabled":"Integration enabled"})}catch(S){h(pt(S))}},[h,p,f,u]),k=g.useCallback(async()=>{try{await d(e.id),p(),f({type:"success",text:"Integration deleted"})}catch(S){h(pt(S))}},[h,p,f,d]);return i.jsxs(TWe,{onClick:S=>S.preventDefault(),children:[i.jsx(Rt,{title:"More actions",arrow:!0,children:i.jsx(Mt,{onClick:x,size:"small","aria-controls":t?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":t?"true":void 0,"data-loading":!0,children:i.jsx(Mf,{sx:{width:32,height:32}})})}),i.jsxs(jf,{id:"project-card-menu",open:!!l,anchorEl:l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},onClose:x,children:[i.jsx(Kd,{permission:ni,children:({hasAccess:S})=>i.jsxs(wn,{onClick:()=>y(!0),disabled:!S,children:[i.jsx(Io,{children:i.jsx(dy,{})}),i.jsx(un,{children:"View events"})]})}),i.jsxs(wn,{onClick:()=>{a(!0),b()},disabled:!C,children:[i.jsx(Io,{children:i.jsx(x7,{})}),i.jsx(un,{children:e.enabled?"Disable":"Enable"})]})," ",i.jsxs(wn,{disabled:!w,onClick:()=>{o(!0),b()},children:[i.jsx(Io,{children:i.jsx(So,{})}),i.jsx(un,{children:"Delete"})]})]}),i.jsx(Oee,{addon:e,open:m,setOpen:y}),i.jsx(Mn,{open:s,onClick:j,onClose:()=>a(!1),title:e.enabled?"Disable integration?":"Enable integration?",children:i.jsxs("div",{children:[e.enabled?"Disabling":"Enabling"," this integration will"," ",e.enabled?"prevent it from sending updates":"allow it to send updates"]})}),i.jsx(Mn,{open:r,onClick:k,onClose:()=>o(!1),title:"Delete integration?",children:i.jsx(Dt,{severity:"warning",children:"Deleting this integration instance will delete all its configuration. It will stop working immediately."})})]})},AWe=v(Sn,{shouldForwardProp:e=>e!=="highlighted"})(({theme:e,highlighted:t})=>({backgroundColor:t?e.palette.highlight:"transparent",color:e.palette.text.primary,textDecorationColor:e.palette.text.disabled,textDecorationStyle:"dashed",textUnderlineOffset:e.spacing(.5),whiteSpace:"nowrap"})),sd=({tooltip:e,highlighted:t,tooltipProps:n,children:r,...o})=>i.jsx(wr,{title:e,...n,arrow:!0,children:i.jsx(AWe,{tabIndex:0,highlighted:t,...o,children:r})}),PWe=v(sd)({display:"flex",alignItems:"center"}),_We=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),IWe=v("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),OWe=({integration:e,...t})=>{const{integrationEvents:n}=wee(e==null?void 0:e.id,1,{refreshInterval:5e3}),{locationSettings:r}=$r();if(n.length===0)return null;const o=n[0];return i.jsx(K,{onClick:s=>s.preventDefault(),...t,children:i.jsx(PWe,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:i.jsxs(i.Fragment,{children:[i.jsxs(_We,{children:[i.jsx(IWe,{children:"Last event"}),i.jsx("span",{children:ji(o.createdAt,r==null?void 0:r.locale)})]}),i.jsx(Iee,{...o})]}),children:i.jsx(_ee,{...o})})})},MWe=v("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:t="default"})=>({display:"flex",flexDirection:"column",padding:e.spacing(3),height:"100%",borderRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.divider}`,boxShadow:e.boxShadows.card,":hover":{backgroundColor:e.palette.action.hover},...t==="stacked"&&{position:"relative",zIndex:0,"&:after":{content:'""',width:"auto",height:e.spacing(1),position:"absolute",zIndex:-1,bottom:e.spacing(-1),left:e.spacing(1),right:e.spacing(1),borderBottomLeftRadius:`${e.shape.borderRadiusMedium}px`,borderBottomRightRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.divider}`,boxShadow:e.boxShadows.card}}})),KN=v(Sn)({textDecoration:"none",color:"inherit",textAlign:"left"}),$We=v(ft)({textDecoration:"none",color:"inherit"}),DWe=v("div")(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),LWe=v(J)(()=>({display:"flex",alignItems:"center",marginRight:"auto"})),NWe=v(J)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.primary.main,fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body2.fontSize,marginTop:"auto",paddingTop:e.spacing(1),gap:e.spacing(.5)})),FWe=v(Hp)(({theme:e})=>({fontSize:e.fontSizes.bodySize})),Su=({variant:e="default",icon:t,title:n,description:r,isEnabled:o,configureActionText:s="Configure",link:a,onClick:l,addon:c,deprecated:u,isExternal:d=!1})=>{const{trackEvent:p}=zt(),f=c!==void 0,h=()=>{p("open-integration",{props:{integrationName:n,isConfigured:f}})},m=i.jsxs(MWe,{variant:e,children:[i.jsxs(DWe,{children:[i.jsxs(LWe,{variant:"h3","data-loading":!0,children:[i.jsx(vee,{name:t})," ",n]}),i.jsx(te,{condition:u!==void 0,show:i.jsx(Rt,{title:u,arrow:!0,children:i.jsx(an,{"data-loading":!0,children:"Deprecated"})})}),i.jsx(te,{condition:o===!0,show:i.jsx(an,{color:"success","data-loading":!0,children:"Enabled"})}),i.jsx(te,{condition:o===!1,show:i.jsx(an,{"data-loading":!0,children:"Disabled"})}),i.jsx(te,{condition:f,show:i.jsx(RWe,{addon:c})})]}),i.jsx(J,{variant:"body2",color:"text.secondary","data-loading":!0,children:r}),i.jsxs(NWe,{"data-loading":!0,children:[s,i.jsx(te,{condition:d,show:i.jsx(FWe,{}),elseShow:i.jsx(DA,{})}),i.jsx(OWe,{integration:c,sx:{ml:"auto"}})]})]});return l?i.jsx(KN,{component:"button",onClick:()=>{h(),l()},children:m}):d?i.jsx(KN,{href:a,target:"_blank",rel:"noreferrer",onClick:h,children:m}):i.jsx($We,{to:a,onClick:h,children:m})};var qA={},BWe=je;Object.defineProperty(qA,"__esModule",{value:!0});var w7=qA.default=void 0,zWe=BWe(Ee()),HWe=i,WWe=(0,zWe.default)((0,HWe.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}),"Launch");w7=qA.default=WWe;const VWe="/static/cr-DbjGV9Hl.png",UWe="/static/cr-DbjGV9Hl.png",GWe="/static/cr-DbjGV9Hl.png",qWe=v("figure")(({theme:e})=>({display:"flex",gap:e.spacing(2),margin:e.spacing(2,0),flexDirection:"column"})),YWe=v("figcaption")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexDirection:"column"})),KWe=v("img")({maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"}),q9=({title:e,description:t,src:n})=>i.jsxs(qWe,{children:[i.jsxs(YWe,{children:[i.jsx(J,{variant:"h3",children:e}),i.jsx(J,{children:t})]}),i.jsx(KWe,{src:Do(n),alt:e})]}),XWe=v("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",gap:e.spacing(2),marginTop:e.spacing(1)})),JWe=v("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),YA=v("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ZWe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),QWe=v("div")({display:"flex",justifyContent:"flex-end"}),eVe=v("section")(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(2)})),XN=v(xn)(({theme:e})=>({width:"100%"})),S7=g.forwardRef(({children:e},t)=>i.jsx(J,{ref:t,component:"h4",variant:"h4",sx:n=>({margin:n.spacing(1,0)}),children:e})),tVe=v("div")({marginTop:"25px"}),nVe=v("section")(({theme:e})=>({borderWidth:"1px",borderStyle:"solid",borderColor:e.palette.neutral.border,borderRadius:`${e.shape.borderRadiusLarge}px`,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(3)})),OS=({...e})=>i.jsx(qr,{elevation:0,sx:t=>({background:t.palette.background.elevation1,padding:t.spacing(2,3),display:"flex",flexDirection:"column",width:"100%",borderRadius:`${t.shape.borderRadiusLarge}px`}),...e}),JN=["http","https","mailto","tel"];function rVe(e){const t=(e||"").trim(),n=t.charAt(0);if(n==="#"||n==="/")return t;const r=t.indexOf(":");if(r===-1)return t;let o=-1;for(;++o<JN.length;){const s=JN[o];if(r===s.length&&t.slice(0,s.length).toLowerCase()===s)return t}return o=t.indexOf("?"),o!==-1&&r>o||(o=t.indexOf("#"),o!==-1&&r>o)?t:"javascript:void(0)"}/*!
298
+ `));const t=g.useMemo(()=>D({},_$e,e.localeText),[e.localeText]);return g.useMemo(()=>D({},e,{localeText:t}),[e,t])},_i=()=>h7().utils,uA=()=>h7().defaultDates,g7=e=>{const t=_i(),n=g.useRef(void 0);return n.current===void 0&&(n.current=t.date(void 0,e)),n.current},OQ=()=>h7().localeText,I$e=Qr(i.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),O$e=Qr(i.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),M$e=Qr(i.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");Qr(i.jsx("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}),"Calendar");Qr(i.jsxs(g.Fragment,{children:[i.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),i.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");Qr(i.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRange");Qr(i.jsxs(g.Fragment,{children:[i.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),i.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time");Qr(i.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");function $$e(e){return bl("MuiPickersArrowSwitcher",e)}ec("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const D$e=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],L$e=["ownerState"],N$e=["ownerState"],F$e=v("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),B$e=v("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),RN=v(Mt,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),z$e=e=>{const{classes:t}=e;return Ql({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},$$e,t)},H$e=g.forwardRef(function(t,n){const r=g5(),o=ht({props:t,name:"MuiPickersArrowSwitcher"}),{children:s,className:a,slots:l,slotProps:c,isNextDisabled:u,isNextHidden:d,onGoToNext:p,nextLabel:f,isPreviousDisabled:h,isPreviousHidden:m,onGoToPrevious:y,previousLabel:b,labelId:x}=o,C=He(o,D$e),w=o,j=z$e(w),k={isDisabled:u,isHidden:d,goTo:p,label:f},S={isDisabled:h,isHidden:m,goTo:y,label:b},E=(l==null?void 0:l.previousIconButton)??RN,T=Nc({elementType:E,externalSlotProps:c==null?void 0:c.previousIconButton,additionalProps:{size:"medium",title:S.label,"aria-label":S.label,disabled:S.isDisabled,edge:"end",onClick:S.goTo},ownerState:D({},w,{hidden:S.isHidden}),className:Oe(j.button,j.previousIconButton)}),R=(l==null?void 0:l.nextIconButton)??RN,_=Nc({elementType:R,externalSlotProps:c==null?void 0:c.nextIconButton,additionalProps:{size:"medium",title:k.label,"aria-label":k.label,disabled:k.isDisabled,edge:"start",onClick:k.goTo},ownerState:D({},w,{hidden:k.isHidden}),className:Oe(j.button,j.nextIconButton)}),M=(l==null?void 0:l.leftArrowIcon)??O$e,$=Nc({elementType:M,externalSlotProps:c==null?void 0:c.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:w,className:j.leftArrowIcon}),z=He($,L$e),A=(l==null?void 0:l.rightArrowIcon)??M$e,O=Nc({elementType:A,externalSlotProps:c==null?void 0:c.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:w,className:j.rightArrowIcon}),L=He(O,N$e);return i.jsxs(F$e,D({ref:n,className:Oe(j.root,a),ownerState:w},C,{children:[i.jsx(E,D({},T,{children:r?i.jsx(A,D({},L)):i.jsx(M,D({},z))})),s?i.jsx(J,{variant:"subtitle1",component:"span",id:x,children:s}):i.jsx(B$e,{className:j.spacer,ownerState:w}),i.jsx(R,D({},_,{children:r?i.jsx(M,D({},z)):i.jsx(A,D({},L))}))]}))}),AN=(e,t)=>t.getHours(e)*3600+t.getMinutes(e)*60+t.getSeconds(e),W$e=(e,t)=>(n,r)=>e?t.isAfter(n,r):AN(n,t)>AN(r,t);function V$e({onChange:e,onViewChange:t,openTo:n,view:r,views:o,autoFocus:s,focusedView:a,onFocusedViewChange:l}){const c=g.useRef(n),u=g.useRef(o),d=g.useRef(o.includes(n)?n:o[0]),[p,f]=mg({name:"useViews",state:"view",controlled:r,default:d.current}),h=g.useRef(s?p:null),[m,y]=mg({name:"useViews",state:"focusedView",controlled:a,default:h.current});g.useEffect(()=>{(c.current&&c.current!==n||u.current&&u.current.some(E=>!o.includes(E)))&&(f(o.includes(n)?n:o[0]),u.current=o,c.current=n)},[n,f,p,o]);const b=o.indexOf(p),x=o[b-1]??null,C=o[b+1]??null,w=Mr((E,T)=>{y(T?E:R=>E===R?null:R),l==null||l(E,T)}),j=Mr(E=>{w(E,!0),E!==p&&(f(E),t&&t(E))}),k=Mr(()=>{C&&j(C)}),S=Mr((E,T,R)=>{const _=T==="finish",M=R?o.indexOf(R)<o.length-1:!!C;if(e(E,_&&M?"partial":T,R),R&&R!==p){const z=o[o.indexOf(R)+1];z&&j(z)}else _&&k()});return{view:p,setView:j,focusedView:m,setFocusedView:w,nextView:C,previousView:x,defaultView:o.includes(n)?n:o[0],goToNextView:k,setValueAndGoToNextView:S}}function U$e(e,{disableFuture:t,maxDate:n,timezone:r}){const o=_i();return g.useMemo(()=>{const s=o.date(void 0,r),a=o.startOfMonth(t&&o.isBefore(s,n)?s:n);return!o.isAfter(a,e)},[t,n,e,o,r])}function G$e(e,{disablePast:t,minDate:n,timezone:r}){const o=_i();return g.useMemo(()=>{const s=o.date(void 0,r),a=o.startOfMonth(t&&o.isAfter(s,n)?s:n);return!o.isBefore(a,e)},[t,n,e,o,r])}const a3=36,m7=2,dA=320,q$e=280,MQ=336,Y$e=v("div")({overflow:"hidden",width:dA,maxHeight:MQ,display:"flex",flexDirection:"column",margin:"0 auto"}),U4=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n)),r},o2=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:s,utils:a,timezone:l})=>{const c=U4(a,a.date(void 0,l),e);n&&a.isBefore(o,c)&&(o=c),t&&a.isAfter(r,c)&&(r=c);let u=e,d=e;for(a.isBefore(e,o)&&(u=o,d=null),a.isAfter(e,r)&&(d&&(d=r),u=null);u||d;){if(u&&a.isAfter(u,r)&&(u=null),d&&a.isBefore(d,o)&&(d=null),u){if(!s(u))return u;u=a.addDays(u,1)}if(d){if(!s(d))return d;d=a.addDays(d,-1)}}return null},K$e=(e,t)=>t==null||!e.isValid(t)?null:t,jp=(e,t,n)=>t==null||!e.isValid(t)?n:t,X$e=(e,t,n)=>!e.isValid(t)&&t!=null&&!e.isValid(n)&&n!=null?!0:e.isEqual(t,n),J$e=(e,t)=>{const r=[e.startOfYear(t)];for(;r.length<12;){const o=r[r.length-1];r.push(e.addMonths(o,1))}return r},$Q=(e,t,n)=>n==="date"?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),Z$e=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(r=>e.addDays(n,r))},Q$e=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:o,valueManager:s})=>{const a=_i(),l=g.useRef(n),c=t??l.current??s.emptyValue,u=g.useMemo(()=>s.getTimezone(a,c),[a,s,c]),d=Mr(m=>u==null?m:s.setTimezone(a,u,m));let p;e?p=e:u?p=u:r?p=a.getTimezone(r):p="default";const f=g.useMemo(()=>s.setTimezone(a,p,c),[s,a,p,c]),h=Mr((m,...y)=>{const b=d(m);o==null||o(b,...y)});return{value:f,handleValueChange:h,timezone:p}},pA=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:o,onChange:s,valueManager:a})=>{const[l,c]=mg({name:e,state:"value",controlled:n,default:r??a.emptyValue}),u=Mr((d,...p)=>{c(d),s==null||s(d,...p)});return Q$e({timezone:t,value:l,defaultValue:void 0,referenceDate:o,onChange:u,valueManager:a})},ku={year:1,month:2,day:3,minutes:5,seconds:6,milliseconds:7},Q0=(e,t,n)=>{if(t===ku.year)return e.startOfYear(n);if(t===ku.month)return e.startOfMonth(n);if(t===ku.day)return e.startOfDay(n);let r=n;return t<ku.minutes&&(r=e.setMinutes(r,0)),t<ku.seconds&&(r=e.setSeconds(r,0)),t<ku.milliseconds&&(r=e.setMilliseconds(r,0)),r},eDe=({props:e,utils:t,granularity:n,timezone:r,getTodayDate:o})=>{let s=o?o():Q0(t,n,$Q(t,r));e.minDate!=null&&t.isAfterDay(e.minDate,s)&&(s=Q0(t,n,e.minDate)),e.maxDate!=null&&t.isBeforeDay(e.maxDate,s)&&(s=Q0(t,n,e.maxDate));const a=W$e(e.disableIgnoringDatePartForTimeValidation??!1,t);return e.minTime!=null&&a(e.minTime,s)&&(s=Q0(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:U4(t,s,e.minTime))),e.maxTime!=null&&a(s,e.maxTime)&&(s=Q0(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:U4(t,s,e.maxTime))),s},tDe=["value","referenceDate"],ff={emptyValue:null,getTodayValue:$Q,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=He(e,tDe);return t!=null&&r.utils.isValid(t)?t:n??eDe(r)},cleanValue:K$e,areValuesEqual:X$e,isSameError:(e,t)=>e===t,hasError:e=>e!=null,defaultErrorState:null,getTimezone:(e,t)=>t==null||!e.isValid(t)?null:e.getTimezone(t),setTimezone:(e,t,n)=>n==null?null:e.setTimezone(n,t)};function nDe(e){return bl("MuiPickersDay",e)}const u1=ec("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),rDe=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],oDe=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:s,outsideCurrentMonth:a,showDaysOutsideCurrentMonth:l,classes:c}=e,u=a&&!l;return Ql({root:["root",t&&!u&&"selected",s&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",a&&l&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},nDe,c)},DQ=({theme:e})=>D({},e.typography.caption,{width:a3,height:a3,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:Wt(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${u1.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${u1.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${u1.disabled}:not(.${u1.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${u1.disabled}&.${u1.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${m7}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${u1.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),LQ=(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.today&&t.today,!n.outsideCurrentMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.outsideCurrentMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},sDe=v(ta,{name:"MuiPickersDay",slot:"Root",overridesResolver:LQ})(DQ),iDe=v("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:LQ})(({theme:e})=>D({},DQ({theme:e}),{opacity:0,pointerEvents:"none"})),em=()=>{},aDe=g.forwardRef(function(t,n){const r=ht({props:t,name:"MuiPickersDay"}),{autoFocus:o=!1,className:s,day:a,disabled:l=!1,disableHighlightToday:c=!1,disableMargin:u=!1,isAnimating:d,onClick:p,onDaySelect:f,onFocus:h=em,onBlur:m=em,onKeyDown:y=em,onMouseDown:b=em,onMouseEnter:x=em,outsideCurrentMonth:C,selected:w=!1,showDaysOutsideCurrentMonth:j=!1,children:k,today:S=!1}=r,E=He(r,rDe),T=D({},r,{autoFocus:o,disabled:l,disableHighlightToday:c,disableMargin:u,selected:w,showDaysOutsideCurrentMonth:j,today:S}),R=oDe(T),_=_i(),M=g.useRef(null),$=cA(M,n);f7(()=>{o&&!l&&!d&&!C&&M.current.focus()},[o,l,d,C]);const z=O=>{b(O),C&&O.preventDefault()},A=O=>{l||f(a),C&&O.currentTarget.focus(),p&&p(O)};return C&&!j?i.jsx(iDe,{className:Oe(R.root,R.hiddenDaySpacingFiller,s),ownerState:T,role:E.role}):i.jsx(sDe,D({className:Oe(R.root,s),ref:$,centerRipple:!0,disabled:l,tabIndex:w?0:-1,onKeyDown:O=>y(O,a),onFocus:O=>h(O,a),onBlur:O=>m(O,a),onMouseEnter:O=>x(O,a),onClick:A,onMouseDown:z},E,{ownerState:T,children:k||_.format(a,"dayOfMonth")}))}),lDe=g.memo(aDe),NQ=({props:e,value:t,timezone:n,adapter:r})=>{if(t===null)return null;const{shouldDisableDate:o,shouldDisableMonth:s,shouldDisableYear:a,disablePast:l,disableFuture:c}=e,u=r.utils.date(void 0,n),d=jp(r.utils,e.minDate,r.defaultDates.minDate),p=jp(r.utils,e.maxDate,r.defaultDates.maxDate);switch(!0){case!r.utils.isValid(t):return"invalidDate";case!!(o&&o(t)):return"shouldDisableDate";case!!(s&&s(t)):return"shouldDisableMonth";case!!(a&&a(t)):return"shouldDisableYear";case!!(c&&r.utils.isAfterDay(t,u)):return"disableFuture";case!!(l&&r.utils.isBeforeDay(t,u)):return"disablePast";case!!(d&&r.utils.isBeforeDay(t,d)):return"minDate";case!!(p&&r.utils.isAfterDay(t,p)):return"maxDate";default:return null}};NQ.valueManager=ff;const FQ=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:s,disablePast:a,timezone:l})=>{const c=h7();return g.useCallback(u=>NQ({adapter:c,value:u,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:s,disablePast:a}})!==null,[c,e,t,n,r,o,s,a,l])},cDe=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return D({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const s=o.newTimezone;if(n.getTimezone(r.currentMonth)===s)return r;let a=n.setTimezone(r.currentMonth,s);return n.getMonth(a)!==n.getMonth(r.currentMonth)&&(a=n.setMonth(a,n.getMonth(r.currentMonth))),D({},r,{currentMonth:a})}case"finishMonthSwitchingAnimation":return D({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const s=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return D({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:s&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:s?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},uDe=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:s=!1,maxDate:a,minDate:l,onMonthChange:c,reduceAnimations:u,shouldDisableDate:d,timezone:p}=e,f=_i(),h=g.useRef(cDe(!!u,s,f)).current,m=g.useMemo(()=>ff.getInitialReferenceValue({value:t,utils:f,timezone:p,props:e,referenceDate:n,granularity:ku.day}),[n,p]),[y,b]=g.useReducer(h,{isMonthSwitchingAnimating:!1,focusedDay:m,currentMonth:f.startOfMonth(m),slideDirection:"left"});g.useEffect(()=>{b({type:"changeMonthTimezone",newTimezone:f.getTimezone(m)})},[m,f]);const x=g.useCallback(S=>{b(D({type:"changeMonth"},S)),c&&c(S.newMonth)},[c]),C=g.useCallback(S=>{const E=S;f.isSameMonth(E,y.currentMonth)||x({newMonth:f.startOfMonth(E),direction:f.isAfterDay(E,y.currentMonth)?"left":"right"})},[y.currentMonth,x,f]),w=FQ({shouldDisableDate:d,minDate:l,maxDate:a,disableFuture:r,disablePast:o,timezone:p}),j=g.useCallback(()=>{b({type:"finishMonthSwitchingAnimation"})},[]),k=Mr((S,E)=>{w(S)||b({type:"changeFocusedDay",focusedDay:S,withoutMonthSwitchingAnimation:E})});return{referenceDate:m,calendarState:y,changeMonth:C,changeFocusedDay:k,isDateDisabled:w,onMonthSwitchingAnimationEnd:j,handleChangeMonth:x}},dDe=e=>bl("MuiPickersFadeTransitionGroup",e);ec("MuiPickersFadeTransitionGroup",["root"]);const pDe=e=>{const{classes:t}=e;return Ql({root:["root"]},dDe,t)},fDe=v(H3,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function BQ(e){const t=ht({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:s}=t,a=pDe(t),l=Bt();return o?n:i.jsx(fDe,{className:Oe(a.root,r),children:i.jsx(zg,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:l.transitions.duration.enteringScreen,enter:l.transitions.duration.enteringScreen,exit:0},children:n},s)})}const hDe=e=>bl("MuiPickersSlideTransition",e),za=ec("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),gDe=["children","className","reduceAnimations","slideDirection","transKey","classes"],mDe=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return Ql(r,hDe,t)},yDe=v(H3,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${za["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${za["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${za.slideEnterActive}`]:t.slideEnterActive},{[`.${za.slideExit}`]:t.slideExit},{[`.${za["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${za["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{const t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${za["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${za["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${za.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${za.slideExit}`]:{transform:"translate(0%)"},[`& .${za["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${za["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function xDe(e){const t=ht({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:s}=t,a=He(t,gDe),l=mDe(t),c=Bt();if(o)return i.jsx("div",{className:Oe(l.root,r),children:n});const u={exit:l.exit,enterActive:l.enterActive,enter:l.enter,exitActive:l.exitActive};return i.jsx(yDe,{className:Oe(l.root,r),childFactory:d=>g.cloneElement(d,{classNames:u}),role:"presentation",children:i.jsx(bk,D({mountOnEnter:!0,unmountOnExit:!0,timeout:c.transitions.duration.complex,classNames:u},a,{children:n}),s)})}const vDe=e=>bl("MuiDayCalendar",e);ec("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const bDe=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],CDe=["ownerState"],wDe=e=>{const{classes:t}=e;return Ql({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},vDe,t)},zQ=(a3+m7*2)*6,SDe=v("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),jDe=v("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),EDe=v(J,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(e,t)=>t.weekDayLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),kDe=v(J,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(e,t)=>t.weekNumberLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),TDe=v(J,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>D({},e.typography.caption,{width:a3,height:a3,padding:0,margin:`0 ${m7}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),RDe=v("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:zQ}),ADe=v(xDe,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:zQ}),PDe=v("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),_De=v("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${m7}px 0`,display:"flex",justifyContent:"center"});function IDe(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:s,currentMonthNumber:a,isViewFocused:l}=e,c=He(e,bDe);const{disabled:u,disableHighlightToday:d,isMonthSwitchingAnimating:p,showDaysOutsideCurrentMonth:f,slots:h,slotProps:m,timezone:y}=t,b=_i(),x=g7(y),C=r!==null&&b.isSameDay(n,r),w=o.some($=>b.isSameDay($,n)),j=b.isSameDay(n,x),k=(h==null?void 0:h.day)??lDe,S=Nc({elementType:k,externalSlotProps:m==null?void 0:m.day,additionalProps:D({disableHighlightToday:d,showDaysOutsideCurrentMonth:f,role:"gridcell",isAnimating:p,"data-timestamp":b.toJsDate(n).valueOf()},c),ownerState:D({},t,{day:n,selected:w})}),E=He(S,CDe),T=g.useMemo(()=>u||s(n),[u,s,n]),R=g.useMemo(()=>b.getMonth(n)!==a,[b,n,a]),_=g.useMemo(()=>{const $=b.startOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.startOfWeek($)):b.isSameDay(n,$)},[a,n,f,b]),M=g.useMemo(()=>{const $=b.endOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.endOfWeek($)):b.isSameDay(n,$)},[a,n,f,b]);return i.jsx(k,D({},E,{day:n,disabled:T,autoFocus:l&&C,today:j,outsideCurrentMonth:R,isFirstVisibleCell:_,isLastVisibleCell:M,selected:w,tabIndex:C?0:-1,"aria-selected":w,"aria-current":j?"date":void 0}))}function ODe(e){const t=ht({props:e,name:"MuiDayCalendar"}),n=_i(),{onFocusedDayChange:r,className:o,currentMonth:s,selectedDays:a,focusedDay:l,loading:c,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:d,readOnly:p,reduceAnimations:f,renderLoading:h=()=>i.jsx("span",{children:"..."}),slideDirection:m,TransitionProps:y,disablePast:b,disableFuture:x,minDate:C,maxDate:w,shouldDisableDate:j,shouldDisableMonth:k,shouldDisableYear:S,dayOfWeekFormatter:E=be=>n.format(be,"weekdayShort").charAt(0).toUpperCase(),hasFocus:T,onFocusedViewChange:R,gridLabelId:_,displayWeekNumber:M,fixedWeekNumber:$,autoFocus:z,timezone:A}=t,O=g7(A),L=wDe(t),B=g5(),H=FQ({shouldDisableDate:j,shouldDisableMonth:k,shouldDisableYear:S,minDate:C,maxDate:w,disablePast:b,disableFuture:x,timezone:A}),N=OQ(),[I,q]=mg({name:"DayCalendar",state:"hasFocus",controlled:T,default:z??!1}),[ne,V]=g.useState(()=>l||O),oe=Mr(be=>{p||u(be)}),se=be=>{H(be)||(r(be),V(be),R==null||R(!0),q(!0))},ae=Mr((be,ze)=>{switch(be.key){case"ArrowUp":se(n.addDays(ze,-7)),be.preventDefault();break;case"ArrowDown":se(n.addDays(ze,7)),be.preventDefault();break;case"ArrowLeft":{const xe=n.addDays(ze,B?1:-1),qe=n.addMonths(ze,B?1:-1),Ve=o2({utils:n,date:xe,minDate:B?xe:n.startOfMonth(qe),maxDate:B?n.endOfMonth(qe):xe,isDateDisabled:H,timezone:A});se(Ve||xe),be.preventDefault();break}case"ArrowRight":{const xe=n.addDays(ze,B?-1:1),qe=n.addMonths(ze,B?-1:1),Ve=o2({utils:n,date:xe,minDate:B?n.startOfMonth(qe):xe,maxDate:B?xe:n.endOfMonth(qe),isDateDisabled:H,timezone:A});se(Ve||xe),be.preventDefault();break}case"Home":se(n.startOfWeek(ze)),be.preventDefault();break;case"End":se(n.endOfWeek(ze)),be.preventDefault();break;case"PageUp":se(n.addMonths(ze,1)),be.preventDefault();break;case"PageDown":se(n.addMonths(ze,-1)),be.preventDefault();break}}),me=Mr((be,ze)=>se(ze)),ce=Mr((be,ze)=>{I&&n.isSameDay(ne,ze)&&(R==null||R(!1))}),_e=n.getMonth(s),we=n.getYear(s),Me=g.useMemo(()=>a.filter(be=>!!be).map(be=>n.startOfDay(be)),[n,a]),Fe=`${we}-${_e}`,Ge=g.useMemo(()=>g.createRef(),[Fe]),Re=g.useMemo(()=>{const be=n.startOfMonth(s),ze=n.endOfMonth(s);return H(ne)||n.isAfterDay(ne,ze)||n.isBeforeDay(ne,be)?o2({utils:n,date:ne,minDate:be,maxDate:ze,disablePast:b,disableFuture:x,isDateDisabled:H,timezone:A}):ne},[s,x,b,ne,H,n,A]),Be=g.useMemo(()=>{const be=n.getWeekArray(s);let ze=n.addMonths(s,1);for(;$&&be.length<$;){const xe=n.getWeekArray(ze),qe=n.isSameDay(be[be.length-1][0],xe[0][0]);xe.slice(qe?1:0).forEach(Ve=>{be.length<$&&be.push(Ve)}),ze=n.addMonths(ze,1)}return be},[s,$,n]);return i.jsxs(SDe,{role:"grid","aria-labelledby":_,className:L.root,children:[i.jsxs(jDe,{role:"row",className:L.header,children:[M&&i.jsx(kDe,{variant:"caption",role:"columnheader","aria-label":N.calendarWeekNumberHeaderLabel,className:L.weekNumberLabel,children:N.calendarWeekNumberHeaderText}),Z$e(n,O).map((be,ze)=>i.jsx(EDe,{variant:"caption",role:"columnheader","aria-label":n.format(be,"weekday"),className:L.weekDayLabel,children:E(be)},ze.toString()))]}),c?i.jsx(RDe,{className:L.loadingContainer,children:h()}):i.jsx(ADe,D({transKey:Fe,onExited:d,reduceAnimations:f,slideDirection:m,className:Oe(o,L.slideTransition)},y,{nodeRef:Ge,children:i.jsx(PDe,{ref:Ge,role:"rowgroup",className:L.monthContainer,children:Be.map((be,ze)=>i.jsxs(_De,{role:"row",className:L.weekContainer,"aria-rowindex":ze+1,children:[M&&i.jsx(TDe,{className:L.weekNumber,role:"rowheader","aria-label":N.calendarWeekNumberAriaLabelText(n.getWeekNumber(be[0])),children:N.calendarWeekNumberText(n.getWeekNumber(be[0]))}),be.map((xe,qe)=>i.jsx(IDe,{parentProps:t,day:xe,selectedDays:Me,focusableDay:Re,onKeyDown:ae,onFocus:me,onBlur:ce,onDaySelect:oe,isDateDisabled:H,currentMonthNumber:_e,isViewFocused:I,"aria-colindex":qe+1},xe.toString()))]},`week-${be[0]}`))})}))]})}function MDe(e){return bl("MuiPickersMonth",e)}const Mx=ec("MuiPickersMonth",["root","monthButton","disabled","selected"]),$De=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],DDe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ql({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},MDe,r)},LDe=v("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),NDe=v("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Mx.disabled}`]:t.disabled},{[`&.${Mx.selected}`]:t.selected}]})(({theme:e})=>D({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Mx.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Mx.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),FDe=g.memo(function(t){const n=ht({props:t,name:"MuiPickersMonth"}),{autoFocus:r,className:o,children:s,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":m,"aria-label":y,slots:b,slotProps:x}=n,C=He(n,$De),w=g.useRef(null),j=DDe(n);f7(()=>{var E;r&&((E=w.current)==null||E.focus())},[r]);const k=(b==null?void 0:b.monthButton)??NDe,S=Nc({elementType:k,externalSlotProps:x==null?void 0:x.monthButton,additionalProps:{children:s,disabled:a,tabIndex:u,ref:w,type:"button",role:"radio","aria-current":m,"aria-checked":l,"aria-label":y,onClick:E=>d(E,c),onKeyDown:E=>p(E,c),onFocus:E=>f(E,c),onBlur:E=>h(E,c)},ownerState:n,className:j.monthButton});return i.jsx(LDe,D({className:Oe(j.root,o),ownerState:n},C,{children:i.jsx(k,D({},S))}))});function BDe(e){return bl("MuiMonthCalendar",e)}ec("MuiMonthCalendar",["root"]);const zDe=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],HDe=e=>{const{classes:t}=e;return Ql({root:["root"]},BDe,t)};function WDe(e,t){const n=_i(),r=uA(),o=ht({props:e,name:t});return D({disableFuture:!1,disablePast:!1},o,{minDate:jp(n,o.minDate,r.minDate),maxDate:jp(n,o.maxDate,r.maxDate)})}const VDe=v("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:dA,boxSizing:"border-box"}),UDe=g.forwardRef(function(t,n){const r=WDe(t,"MuiMonthCalendar"),{className:o,value:s,defaultValue:a,referenceDate:l,disabled:c,disableFuture:u,disablePast:d,maxDate:p,minDate:f,onChange:h,shouldDisableMonth:m,readOnly:y,autoFocus:b=!1,onMonthFocus:x,hasFocus:C,onFocusedViewChange:w,monthsPerRow:j=3,timezone:k,gridLabelId:S,slots:E,slotProps:T}=r,R=He(r,zDe),{value:_,handleValueChange:M,timezone:$}=pA({name:"MonthCalendar",timezone:k,value:s,defaultValue:a,referenceDate:l,onChange:h,valueManager:ff}),z=g7($),A=g5(),O=_i(),L=g.useMemo(()=>ff.getInitialReferenceValue({value:_,utils:O,props:r,timezone:$,referenceDate:l,granularity:ku.month}),[]),B=r,H=HDe(B),N=g.useMemo(()=>O.getMonth(z),[O,z]),I=g.useMemo(()=>_!=null?O.getMonth(_):null,[_,O]),[q,ne]=g.useState(()=>I||O.getMonth(L)),[V,oe]=mg({name:"MonthCalendar",state:"hasFocus",controlled:C,default:b??!1}),se=Mr(Fe=>{oe(Fe),w&&w(Fe)}),ae=g.useCallback(Fe=>{const Ge=O.startOfMonth(d&&O.isAfter(z,f)?z:f),Re=O.startOfMonth(u&&O.isBefore(z,p)?z:p),Be=O.startOfMonth(Fe);return O.isBefore(Be,Ge)||O.isAfter(Be,Re)?!0:m?m(Be):!1},[u,d,p,f,z,m,O]),me=Mr((Fe,Ge)=>{if(y)return;const Re=O.setMonth(_??L,Ge);M(Re)}),ce=Mr(Fe=>{ae(O.setMonth(_??L,Fe))||(ne(Fe),se(!0),x&&x(Fe))});g.useEffect(()=>{ne(Fe=>I!==null&&Fe!==I?I:Fe)},[I]);const _e=Mr((Fe,Ge)=>{switch(Fe.key){case"ArrowUp":ce((12+Ge-3)%12),Fe.preventDefault();break;case"ArrowDown":ce((12+Ge+3)%12),Fe.preventDefault();break;case"ArrowLeft":ce((12+Ge+(A?1:-1))%12),Fe.preventDefault();break;case"ArrowRight":ce((12+Ge+(A?-1:1))%12),Fe.preventDefault();break}}),we=Mr((Fe,Ge)=>{ce(Ge)}),Me=Mr((Fe,Ge)=>{q===Ge&&se(!1)});return i.jsx(VDe,D({ref:n,className:Oe(H.root,o),ownerState:B,role:"radiogroup","aria-labelledby":S},R,{children:J$e(O,_??L).map(Fe=>{const Ge=O.getMonth(Fe),Re=O.format(Fe,"monthShort"),Be=O.format(Fe,"month"),be=Ge===I,ze=c||ae(Fe);return i.jsx(FDe,{selected:be,value:Ge,onClick:me,onKeyDown:_e,autoFocus:V&&Ge===q,disabled:ze,tabIndex:Ge===q&&!ze?0:-1,onFocus:we,onBlur:Me,"aria-current":N===Ge?"date":void 0,"aria-label":Be,monthsPerRow:j,slots:E,slotProps:T,children:Re},Re)})}))});function GDe(e){return bl("MuiPickersYear",e)}const $x=ec("MuiPickersYear",["root","yearButton","selected","disabled"]),qDe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],YDe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ql({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},GDe,r)},KDe=v("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),XDe=v("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${$x.disabled}`]:t.disabled},{[`&.${$x.selected}`]:t.selected}]})(({theme:e})=>D({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:Wt(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Wt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${$x.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${$x.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),JDe=g.memo(function(t){const n=ht({props:t,name:"MuiPickersYear"}),{autoFocus:r,className:o,children:s,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":m,slots:y,slotProps:b}=n,x=He(n,qDe),C=g.useRef(null),w=YDe(n);f7(()=>{var S;r&&((S=C.current)==null||S.focus())},[r]);const j=(y==null?void 0:y.yearButton)??XDe,k=Nc({elementType:j,externalSlotProps:b==null?void 0:b.yearButton,additionalProps:{children:s,disabled:a,tabIndex:u,ref:C,type:"button",role:"radio","aria-current":m,"aria-checked":l,onClick:S=>d(S,c),onKeyDown:S=>p(S,c),onFocus:S=>f(S,c),onBlur:S=>h(S,c)},ownerState:n,className:w.yearButton});return i.jsx(KDe,D({className:Oe(w.root,o),ownerState:n},x,{children:i.jsx(j,D({},k))}))});function ZDe(e){return bl("MuiYearCalendar",e)}ec("MuiYearCalendar",["root"]);const QDe=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],eLe=e=>{const{classes:t}=e;return Ql({root:["root"]},ZDe,t)};function tLe(e,t){const n=_i(),r=uA(),o=ht({props:e,name:t});return D({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:jp(n,o.minDate,r.minDate),maxDate:jp(n,o.maxDate,r.maxDate)})}const nLe=v("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:dA,maxHeight:q$e,boxSizing:"border-box",position:"relative"}),rLe=g.forwardRef(function(t,n){const r=tLe(t,"MuiYearCalendar"),{autoFocus:o,className:s,value:a,defaultValue:l,referenceDate:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onChange:m,readOnly:y,shouldDisableYear:b,onYearFocus:x,hasFocus:C,onFocusedViewChange:w,yearsOrder:j="asc",yearsPerRow:k,timezone:S,gridLabelId:E,slots:T,slotProps:R}=r,_=He(r,QDe),{value:M,handleValueChange:$,timezone:z}=pA({name:"YearCalendar",timezone:S,value:a,defaultValue:l,referenceDate:c,onChange:m,valueManager:ff}),A=g7(z),O=g5(),L=_i(),B=g.useMemo(()=>ff.getInitialReferenceValue({value:M,utils:L,props:r,timezone:z,referenceDate:c,granularity:ku.year}),[]),H=r,N=eLe(H),I=g.useMemo(()=>L.getYear(A),[L,A]),q=g.useMemo(()=>M!=null?L.getYear(M):null,[M,L]),[ne,V]=g.useState(()=>q||L.getYear(B)),[oe,se]=mg({name:"YearCalendar",state:"hasFocus",controlled:C,default:o??!1}),ae=Mr(xe=>{se(xe),w&&w(xe)}),me=g.useCallback(xe=>{if(p&&L.isBeforeYear(xe,A)||d&&L.isAfterYear(xe,A)||h&&L.isBeforeYear(xe,h)||f&&L.isAfterYear(xe,f))return!0;if(!b)return!1;const qe=L.startOfYear(xe);return b(qe)},[d,p,f,h,A,b,L]),ce=Mr((xe,qe)=>{if(y)return;const Ve=L.setYear(M??B,qe);$(Ve)}),_e=Mr(xe=>{me(L.setYear(M??B,xe))||(V(xe),ae(!0),x==null||x(xe))});g.useEffect(()=>{V(xe=>q!==null&&xe!==q?q:xe)},[q]);const we=j!=="desc"?k*1:k*-1,Me=O&&j==="asc"||!O&&j==="desc"?-1:1,Fe=Mr((xe,qe)=>{switch(xe.key){case"ArrowUp":_e(qe-we),xe.preventDefault();break;case"ArrowDown":_e(qe+we),xe.preventDefault();break;case"ArrowLeft":_e(qe-Me),xe.preventDefault();break;case"ArrowRight":_e(qe+Me),xe.preventDefault();break}}),Ge=Mr((xe,qe)=>{_e(qe)}),Re=Mr((xe,qe)=>{ne===qe&&ae(!1)}),Be=g.useRef(null),be=cA(n,Be);g.useEffect(()=>{if(o||Be.current===null)return;const xe=Be.current.querySelector('[tabindex="0"]');if(!xe)return;const qe=xe.offsetHeight,Ve=xe.offsetTop,et=Be.current.clientHeight,dt=Be.current.scrollTop,at=Ve+qe;qe>et||Ve<dt||(Be.current.scrollTop=at-et/2-qe/2)},[o]);const ze=L.getYearRange([h,f]);return j==="desc"&&ze.reverse(),i.jsx(nLe,D({ref:be,className:Oe(N.root,s),ownerState:H,role:"radiogroup","aria-labelledby":E},_,{children:ze.map(xe=>{const qe=L.getYear(xe),Ve=qe===q,et=u||me(xe);return i.jsx(JDe,{selected:Ve,value:qe,onClick:ce,onKeyDown:Fe,autoFocus:oe&&qe===ne,disabled:et,tabIndex:qe===ne&&!et?0:-1,onFocus:Ge,onBlur:Re,"aria-current":I===qe?"date":void 0,yearsPerRow:k,slots:T,slotProps:R,children:L.format(xe,"year")},L.format(xe,"year"))})}))}),oLe=e=>bl("MuiPickersCalendarHeader",e),sLe=ec("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),iLe=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],aLe=["ownerState"],lLe=e=>{const{classes:t}=e;return Ql({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},oLe,t)},cLe=v("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),uLe=v("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>D({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),dLe=v("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),pLe=v(Mt,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${sLe.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),fLe=v(I$e,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),hLe=g.forwardRef(function(t,n){const r=OQ(),o=_i(),s=ht({props:t,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:l,currentMonth:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onMonthChange:m,onViewChange:y,view:b,reduceAnimations:x,views:C,labelId:w,className:j,timezone:k,format:S=`${o.formats.month} ${o.formats.year}`}=s,E=He(s,iLe),T=s,R=lLe(s),_=(a==null?void 0:a.switchViewButton)??pLe,M=Nc({elementType:_,externalSlotProps:l==null?void 0:l.switchViewButton,additionalProps:{size:"small","aria-label":r.calendarViewSwitchingButtonAriaLabel(b)},ownerState:T,className:R.switchViewButton}),$=(a==null?void 0:a.switchViewIcon)??fLe,z=Nc({elementType:$,externalSlotProps:l==null?void 0:l.switchViewIcon,ownerState:T,className:R.switchViewIcon}),A=He(z,aLe),O=()=>m(o.addMonths(c,1),"left"),L=()=>m(o.addMonths(c,-1),"right"),B=U$e(c,{disableFuture:d,maxDate:f,timezone:k}),H=G$e(c,{disablePast:p,minDate:h,timezone:k}),N=()=>{if(!(C.length===1||!y||u))if(C.length===2)y(C.find(q=>q!==b)||C[0]);else{const q=C.indexOf(b)!==0?0:1;y(C[q])}};if(C.length===1&&C[0]==="year")return null;const I=o.formatByString(c,S);return i.jsxs(cLe,D({},E,{ownerState:T,className:Oe(R.root,j),ref:n,children:[i.jsxs(uLe,{role:"presentation",onClick:N,ownerState:T,"aria-live":"polite",className:R.labelContainer,children:[i.jsx(BQ,{reduceAnimations:x,transKey:I,children:i.jsx(dLe,{id:w,ownerState:T,className:R.label,children:I})}),C.length>1&&!u&&i.jsx(_,D({},M,{children:i.jsx($,D({},A))}))]}),i.jsx(zg,{in:b==="day",appear:!x,enter:!x,children:i.jsx(H$e,{slots:a,slotProps:l,onGoToPrevious:L,isPreviousDisabled:H,previousLabel:r.previousMonth,onGoToNext:O,isNextDisabled:B,nextLabel:r.nextMonth})})]}))}),gLe="@media (prefers-reduced-motion: reduce)",Hh=typeof navigator<"u"&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),PN=Hh&&Hh[1]?parseInt(Hh[1],10):null,_N=Hh&&Hh[2]?parseInt(Hh[2],10):null,mLe=PN&&PN<10||_N&&_N<13||!1,yLe=()=>Nn(gLe,{defaultMatches:!1})||mLe,xLe=e=>bl("MuiDateCalendar",e);ec("MuiDateCalendar",["root","viewTransitionContainer"]);const vLe=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],bLe=e=>{const{classes:t}=e;return Ql({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},xLe,t)};function CLe(e,t){const n=_i(),r=uA(),o=yLe(),s=ht({props:e,name:t});return D({},s,{loading:s.loading??!1,disablePast:s.disablePast??!1,disableFuture:s.disableFuture??!1,openTo:s.openTo??"day",views:s.views??["year","day"],reduceAnimations:s.reduceAnimations??o,renderLoading:s.renderLoading??(()=>i.jsx("span",{children:"..."})),minDate:jp(n,s.minDate,r.minDate),maxDate:jp(n,s.maxDate,r.maxDate)})}const wLe=v(Y$e,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:MQ}),SLe=v(BQ,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),jLe=g.forwardRef(function(t,n){const r=_i(),o=v$e(),s=CLe(t,"MuiDateCalendar"),{autoFocus:a,onViewChange:l,value:c,defaultValue:u,referenceDate:d,disableFuture:p,disablePast:f,onChange:h,onYearChange:m,onMonthChange:y,reduceAnimations:b,shouldDisableDate:x,shouldDisableMonth:C,shouldDisableYear:w,view:j,views:k,openTo:S,className:E,disabled:T,readOnly:R,minDate:_,maxDate:M,disableHighlightToday:$,focusedView:z,onFocusedViewChange:A,showDaysOutsideCurrentMonth:O,fixedWeekNumber:L,dayOfWeekFormatter:B,slots:H,slotProps:N,loading:I,renderLoading:q,displayWeekNumber:ne,yearsOrder:V,yearsPerRow:oe,monthsPerRow:se,timezone:ae}=s,me=He(s,vLe),{value:ce,handleValueChange:_e,timezone:we}=pA({name:"DateCalendar",timezone:ae,value:c,defaultValue:u,referenceDate:d,onChange:h,valueManager:ff}),{view:Me,setView:Fe,focusedView:Ge,setFocusedView:Re,goToNextView:Be,setValueAndGoToNextView:be}=V$e({view:j,views:k,openTo:S,onChange:_e,onViewChange:l,autoFocus:a,focusedView:z,onFocusedViewChange:A}),{referenceDate:ze,calendarState:xe,changeFocusedDay:qe,changeMonth:Ve,handleChangeMonth:et,isDateDisabled:dt,onMonthSwitchingAnimationEnd:at}=uDe({value:ce,referenceDate:d,reduceAnimations:b,onMonthChange:y,minDate:_,maxDate:M,shouldDisableDate:x,disablePast:f,disableFuture:p,timezone:we}),rt=T&&ce||_,Ae=T&&ce||M,Ye=`${o}-grid-label`,fe=Ge!==null,ge=(H==null?void 0:H.calendarHeader)??hLe,ye=Nc({elementType:ge,externalSlotProps:N==null?void 0:N.calendarHeader,additionalProps:{views:k,view:Me,currentMonth:xe.currentMonth,onViewChange:Fe,onMonthChange:(gt,tn)=>et({newMonth:gt,direction:tn}),minDate:rt,maxDate:Ae,disabled:T,disablePast:f,disableFuture:p,reduceAnimations:b,timezone:we,labelId:Ye},ownerState:s}),Xe=Mr(gt=>{const tn=r.startOfMonth(gt),pn=r.endOfMonth(gt),jn=dt(gt)?o2({utils:r,date:gt,minDate:r.isBefore(_,tn)?tn:_,maxDate:r.isAfter(M,pn)?pn:M,disablePast:f,disableFuture:p,isDateDisabled:dt,timezone:we}):gt;jn?(be(jn,"finish"),y==null||y(tn)):(Be(),Ve(tn)),qe(jn,!0)}),ot=Mr(gt=>{const tn=r.startOfYear(gt),pn=r.endOfYear(gt),jn=dt(gt)?o2({utils:r,date:gt,minDate:r.isBefore(_,tn)?tn:_,maxDate:r.isAfter(M,pn)?pn:M,disablePast:f,disableFuture:p,isDateDisabled:dt,timezone:we}):gt;jn?(be(jn,"finish"),m==null||m(jn)):(Be(),Ve(tn)),qe(jn,!0)}),jt=Mr(gt=>_e(gt&&U4(r,gt,ce??ze),"finish",Me));g.useEffect(()=>{ce!=null&&r.isValid(ce)&&Ve(ce)},[ce]);const Ke=s,bt=bLe(Ke),Ue={disablePast:f,disableFuture:p,maxDate:M,minDate:_},Qe={disableHighlightToday:$,readOnly:R,disabled:T,timezone:we,gridLabelId:Ye,slots:H,slotProps:N},mt=g.useRef(Me);g.useEffect(()=>{mt.current!==Me&&(Ge===mt.current&&Re(Me,!0),mt.current=Me)},[Ge,Re,Me]);const Kt=g.useMemo(()=>[ce],[ce]);return i.jsxs(wLe,D({ref:n,className:Oe(bt.root,E),ownerState:Ke},me,{children:[i.jsx(ge,D({},ye,{slots:H,slotProps:N})),i.jsx(SLe,{reduceAnimations:b,className:bt.viewTransitionContainer,transKey:Me,ownerState:Ke,children:i.jsxs("div",{children:[Me==="year"&&i.jsx(rLe,D({},Ue,Qe,{value:ce,onChange:ot,shouldDisableYear:w,hasFocus:fe,onFocusedViewChange:gt=>Re("year",gt),yearsOrder:V,yearsPerRow:oe,referenceDate:ze})),Me==="month"&&i.jsx(UDe,D({},Ue,Qe,{hasFocus:fe,className:E,value:ce,onChange:Xe,shouldDisableMonth:C,onFocusedViewChange:gt=>Re("month",gt),monthsPerRow:se,referenceDate:ze})),Me==="day"&&i.jsx(ODe,D({},xe,Ue,Qe,{onMonthSwitchingAnimationEnd:at,onFocusedDayChange:qe,reduceAnimations:b,selectedDays:Kt,onSelectedDaysChange:jt,shouldDisableDate:x,shouldDisableMonth:C,shouldDisableYear:w,hasFocus:fe,onFocusedViewChange:gt=>Re("day",gt),showDaysOutsideCurrentMonth:O,fixedWeekNumber:L,dayOfWeekFormatter:B,displayWeekNumber:ne,loading:I,renderLoading:q}))]})})]}))}),ELe={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},kLe={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime:"p",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime:"P p",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class TLe{constructor(t){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=ELe,this.escapedCharacters={start:"'",end:"'"},this.longFormatters=void 0,this.date=a=>typeof a>"u"?new Date:a===null?null:new Date(a),this.getInvalidDate=()=>new Date("Invalid Date"),this.getTimezone=()=>"default",this.setTimezone=a=>a,this.toJsDate=a=>a,this.getCurrentLocaleCode=()=>this.locale.code,this.is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"})),this.expandFormat=a=>{const l=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;return a.match(l).map(c=>{const u=c[0];if(u==="p"||u==="P"){const d=this.longFormatters[u];return d(c,this.locale.formatLong)}return c}).join("")},this.formatNumber=a=>a,this.getDayOfWeek=a=>a.getDay()+1;const{locale:n,formats:r,longFormatters:o,lib:s}=t;this.locale=n,this.formats=D({},kLe,r),this.longFormatters=o,this.lib=s||"date-fns"}}class RLe extends TLe{constructor({locale:t,formats:n}={}){super({locale:t??kf,formats:n,longFormatters:$4}),this.parse=(r,o)=>r===""?null:cJ(r,o,new Date,{locale:this.locale}),this.isValid=r=>r==null?!1:J3(r),this.format=(r,o)=>this.formatByString(r,this.formats[o]),this.formatByString=(r,o)=>Jo(r,o,{locale:this.locale}),this.isEqual=(r,o)=>r===null&&o===null?!0:r===null||o===null?!1:ACe(r,o),this.isSameYear=(r,o)=>Awe(r,o),this.isSameMonth=(r,o)=>Twe(r,o),this.isSameDay=(r,o)=>Kk(r,o),this.isSameHour=(r,o)=>Ewe(r,o),this.isAfter=(r,o)=>Bh(r,o),this.isAfterYear=(r,o)=>Bh(r,r3(o)),this.isAfterDay=(r,o)=>Bh(r,O4(o)),this.isBefore=(r,o)=>e2(r,o),this.isBeforeYear=(r,o)=>e2(r,this.startOfYear(o)),this.isBeforeDay=(r,o)=>e2(r,this.startOfDay(o)),this.isWithinRange=(r,[o,s])=>Iwe(r,{start:o,end:s}),this.startOfYear=r=>o3(r),this.startOfMonth=r=>M4(r),this.startOfWeek=r=>Zs(r,{locale:this.locale}),this.startOfDay=r=>Gu(r),this.endOfYear=r=>r3(r),this.endOfMonth=r=>n3(r),this.endOfWeek=r=>JX(r,{locale:this.locale}),this.endOfDay=r=>O4(r),this.addYears=(r,o)=>Yk(r,o),this.addMonths=(r,o)=>Ug(r,o),this.addWeeks=(r,o)=>qk(r,o),this.addDays=(r,o)=>zp(r,o),this.addHours=(r,o)=>WX(r,o),this.addMinutes=(r,o)=>Gg(r,o),this.addSeconds=(r,o)=>YX(r,o),this.getYear=r=>RCe(r),this.getMonth=r=>kCe(r),this.getDate=r=>bCe(r),this.getHours=r=>wCe(r),this.getMinutes=r=>ECe(r),this.getSeconds=r=>TCe(r),this.getMilliseconds=r=>jCe(r),this.setYear=(r,o)=>nSe(r,o),this.setMonth=(r,o)=>Xwe(r,o),this.setDate=(r,o)=>Jwe(r,o),this.setHours=(r,o)=>Zwe(r,o),this.setMinutes=(r,o)=>eSe(r,o),this.setSeconds=(r,o)=>tSe(r,o),this.setMilliseconds=(r,o)=>Qwe(r,o),this.getDaysInMonth=r=>oJ(r),this.getWeekArray=r=>{const o=this.startOfWeek(this.startOfMonth(r)),s=this.endOfWeek(this.endOfMonth(r));let a=0,l=o;const c=[];for(;this.isBefore(l,s);){const u=Math.floor(a/7);c[u]=c[u]||[],c[u].push(l),l=this.addDays(l,1),a+=1}return c},this.getWeekNumber=r=>nT(r,{locale:this.locale}),this.getYearRange=([r,o])=>{const s=this.startOfYear(r),a=this.endOfYear(o),l=[];let c=s;for(;this.isBefore(c,a);)l.push(c),c=this.addYears(c,1);return l}}}const ALe=(e,t=new Date)=>{let n,r;switch(e){case"thisMonth":{n=M4(t),r=n3(t);break}case"thisQuarter":{n=Xw(t),r=Jw(t);break}case"previousQuarter":{const o=oSe(t,1);n=Xw(o),r=Jw(o);break}case"thisYear":{n=o3(t),r=r3(t);break}case"previousYear":{const o=fJ(t,1);n=o3(o),r=r3(o);break}default:{const o=G5(t,1);n=M4(o),r=n3(o)}}return[Jo(n,"yyyy-MM-dd"),Jo(r,"yyyy-MM-dd")]},PLe=v(J)(({theme:e})=>({paddingLeft:e.spacing(2),paddingBottom:e.spacing(1)})),_Le=({onRangeChange:e})=>{const t=n=>()=>{const[r,o]=ALe(n);e({from:{operator:"IS",values:[r]},to:{operator:"IS",values:[o]}})};return i.jsxs(K,{children:[i.jsx(PLe,{variant:"h3",children:"Presets"}),i.jsxs(Ri,{disablePadding:!0,sx:{pb:2},children:[i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("thisMonth"),children:"This month"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("previousMonth"),children:"Previous month"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("thisQuarter"),children:"This quarter"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("previousQuarter"),children:"Previous quarter"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("thisYear"),children:"This year"})}),i.jsx(Or,{disablePadding:!0,children:i.jsx(mo,{onClick:t("previousYear"),children:"Previous year"})})]})]})},ILe=({name:e,label:t,onChange:n,onRangeChange:r,onChipClose:o,state:s,operators:a,initMode:l="auto-open"})=>{const c=g.useRef(null),[u,d]=g.useState(null),{locationSettings:p}=$r(),f=()=>d(c.current),h=()=>d(null);g.useEffect(()=>{!s&&l==="auto-open"&&f()},[]);const m=s?[RR(s.values[0],p.locale)||""]:[],y=s?new Date(s.values[0]):null,b=s?s.operator:a[0],x=o?()=>{n({operator:a[0],values:[]}),h(),o()}:void 0;return g.useEffect(()=>{s&&!a.includes(s.operator)&&n({operator:a[0],values:s.values})},[s]),i.jsxs(i.Fragment,{children:[i.jsx(K,{ref:c,children:i.jsx(_Q,{label:t,name:e,selectedDisplayOptions:m,onDelete:x,onClick:f,operator:b,operatorOptions:a,onChangeOperator:C=>{const w=y?Jo(y,"yyyy-MM-dd"):"";n({operator:C,values:[w]})}})}),i.jsx(PQ,{open:!!u,anchorEl:u,onClose:h,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:i.jsxs(A$e,{dateAdapter:RLe,children:[i.jsx(jLe,{displayWeekNumber:!0,value:y,disableFuture:!0,onChange:C=>{const w=C?Jo(C,"yyyy-MM-dd"):"";n({operator:b,values:[w]})}}),r&&i.jsx(_Le,{onRangeChange:r})]})})]})},OLe=({options:e,handleToggle:t})=>{const n=g.useRef([]);return{listRefs:n,handleSelection:(o,s)=>{var a,l,c;if(o.key==="ArrowDown"&&s<n.current.length-1)o.preventDefault(),(a=n.current[s+1])==null||a.focus();else if(o.key==="ArrowUp"&&s>0)o.preventDefault(),(l=n.current[s-1])==null||l.focus();else if(o.key==="Enter"&&s===0&&((c=n.current[0])!=null&&c.value)&&e.length>0)t(e[0].value)();else if((o.key==="Enter"||s!==0&&o.key===" ")&&(o.preventDefault(),s>0)){const u=s-1;t(e[u].value)()}}}},MLe=({name:e,label:t,options:n,onChange:r,onChipClose:o,state:s,singularOperators:a,pluralOperators:l,initMode:c="auto-open"})=>{const u=g.useRef(null),[d,p]=g.useState(),[f,h]=g.useState(""),m=s&&s.values.length>1?l:a,y=()=>{p(u.current)};g.useEffect(()=>{!s&&c==="auto-open"&&y()},[]);const b=()=>{p(null)},x=s?s.values:[],C=x.map(R=>{var _;return(_=n.find(M=>M.value===R))==null?void 0:_.label}).filter(R=>R!==void 0),w=s?s.operator:m[0],j=o?()=>{r({operator:a[0],values:[]}),b(),o()}:void 0,k=n.filter(R=>R.label.toLowerCase().includes(f.toLowerCase())),S=R=>()=>{if(x!=null&&x.some(_=>_===R)){const _=x==null?void 0:x.filter(M=>M!==R);r({operator:w,values:_})}else{const _=[...x??[],(n.find(M=>M.value===R)??{value:""}).value];r({operator:w,values:_})}},{listRefs:E,handleSelection:T}=OLe({options:k,handleToggle:S});return g.useEffect(()=>{s&&!m.includes(s.operator)&&r({operator:m[0],values:s.values})},[s]),i.jsxs(i.Fragment,{children:[i.jsx(K,{ref:u,children:i.jsx(_Q,{name:e,label:t,selectedDisplayOptions:C,onDelete:j,onClick:y,operator:w,operatorOptions:m,onChangeOperator:R=>{r({operator:R,values:x??[]})}})}),i.jsx(PQ,{open:!!d,anchorEl:d,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:i.jsxs(t$e,{children:[i.jsx(o$e,{variant:"outlined",size:"small",value:f,onChange:R=>h(R.target.value),placeholder:"Search",autoFocus:!0,InputProps:{startAdornment:i.jsx(Bp,{position:"start",children:i.jsx(Rf,{fontSize:"small"})})},inputRef:R=>{E.current[0]=R},onKeyDown:R=>T(R,0)}),i.jsx(Ri,{sx:{overflowY:"auto"},disablePadding:!0,children:k.map((R,_)=>{const M=`checkbox-list-label-${R.value}`;return i.jsxs(n$e,{dense:!0,disablePadding:!0,tabIndex:0,onClick:S(R.value),ref:$=>{E.current[_+1]=$},onKeyDown:$=>T($,_+1),children:[i.jsx(r$e,{edge:"start",checked:(x==null?void 0:x.some($=>$===R.value))??!1,tabIndex:-1,inputProps:{"aria-labelledby":M},size:"small",disableRipple:!0}),i.jsx(un,{id:M,primary:R.label})]},R.value)})})]})})]})},HQ=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(1.5,3),gap:e.spacing(1),flexWrap:"wrap"})),WQ=e=>"dateOperators"in e,$Le=e=>WQ(e)&&"fromFilterKey"in e&&"toFilterKey"in e,DLe=v("div")(({theme:e})=>({marginRight:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.spacing(2)})),LLe=v(Ta)(({theme:e})=>({"&.material-symbols-outlined":{fontSize:e.spacing(2)}})),VQ=({filter:e,onChipClose:t,onChange:n,state:r,rangeChangeHandler:o,initMode:s})=>{const a=i.jsxs(i.Fragment,{children:[i.jsx(DLe,{children:i.jsx(LLe,{children:e.icon})}),e.label]});return WQ(e)?i.jsx(ILe,{initMode:s,label:a,name:e.label,state:r,operators:e.dateOperators,onChange:l=>n({[e.filterKey]:l}),onRangeChange:$Le(e)?o(e):void 0,onChipClose:e.persistent?void 0:()=>t==null?void 0:t(e.label)},e.label):i.jsx(MLe,{initMode:s,label:a,name:e.label,state:r,options:e.options,onChange:l=>n({[e.filterKey]:l}),singularOperators:e.singularOperators,pluralOperators:e.pluralOperators,onChipClose:e.persistent?void 0:()=>t==null?void 0:t(e.label)},e.label)},NLe=({state:e,onChange:t,className:n,filter:r,rangeChangeHandler:o})=>i.jsx(HQ,{className:n,children:i.jsx(VQ,{filter:r,state:e[r.filterKey],onChange:t,rangeChangeHandler:o,onChipClose:void 0,initMode:"manual"})}),FLe=(e,t)=>{const n=[...e],r=new Set(e);return t.forEach(o=>{r.has(o)||n.push(o)}),n},BLe=({state:e,onChange:t,availableFilters:n,rangeChangeHandler:r,className:o})=>{const[s,a]=g.useState([]),l=u=>{const d=s.filter(p=>p!==u);a(d)};g.useEffect(()=>{const u=Object.keys(e).map(p=>n.find(f=>p===f.filterKey)).filter(p=>!!p).filter(p=>!!e[p.filterKey]).map(p=>p.label),d=FLe(s,u);a(d)},[JSON.stringify(e),JSON.stringify(n)]);const c=g.useMemo(()=>n.filter(u=>!s.includes(u.label)).map(u=>u.label).sort(),[n,s]);return i.jsxs(HQ,{className:o,children:[s.map(u=>{const d=n.find(p=>p.label===u);return d?i.jsx(VQ,{filter:d,state:e[d.filterKey],onChange:t,rangeChangeHandler:r,onChipClose:()=>l(d.label)},d.filterKey):null}),c.length>0?i.jsx(e$e,{availableFilters:n,visibleOptions:c,hiddenOptions:s,onSelectedOptionsChange:a}):null]})},fA=e=>{const t=n=>{const{fromFilterKey:r,toFilterKey:o}=n;return s=>{const{from:a,to:l}=s;e.onChange({[r]:a,[o]:l})}};if(e.availableFilters.length===1){const n=e.availableFilters[0];return i.jsx(NLe,{filter:n,rangeChangeHandler:t,...e})}return i.jsx(BLe,{rangeChangeHandler:t,...e})},yg=e=>`${e.type}:${e.value}`,UQ=()=>{const{uiConfig:e}=ut();return t=>{var n;return((n=e==null?void 0:e.flags)==null?void 0:n[t])||!1}},Er=e=>UQ()(e),zLe=({state:e,onChange:t})=>{const{projects:n}=Zr(),{segments:r}=od(),{tags:o}=XMe(),s=Er("filterFavorites"),{trackEvent:a}=zt(),l=p=>{p.favorite!==e.favorite&&a("favorite",{props:{action:p.favorite?"filter-enabled":"filter-disabled"}}),t(p)},c=[{label:"Active",value:"active"},{label:"Stale",value:"stale"}],[u,d]=g.useState([]);return g.useEffect(()=>{const p=(n||[]).map(b=>({label:b.name,value:b.id})),f=(r||[]).map(b=>({label:b.name,value:b.name})),h=(o||[]).map(b=>({label:yg(b),value:yg(b)})),m=p.length>1,y=[{label:"State",icon:"hexagon",options:c,filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},...m?[{label:"Project",icon:"topic",options:p,filterKey:"project",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}]:[],{label:"Tags",icon:"label",options:h,filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Segment",icon:"donut_large",options:f,filterKey:"segment",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ANY_OF","INCLUDE_ALL_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},...s?[{label:"Favorite",icon:"star",options:[{label:"True",value:"true"},{label:"False",value:"false"}],filterKey:"favorite",singularOperators:["IS"],pluralOperators:["IS_ANY_OF"]}]:[]];d(y)},[JSON.stringify(n),JSON.stringify(r),JSON.stringify(o),s]),i.jsx(fA,{availableFilters:u,state:e,onChange:l})},HLe=(e,t)=>n=>{if(typeof n=="function"){const r=n([{id:e.sortBy,desc:e.sortOrder==="desc"}])[0];t({sortBy:r==null?void 0:r.id,sortOrder:r!=null&&r.desc?"desc":"asc"})}else{const r=n[0];t({sortBy:r==null?void 0:r.id,sortOrder:r!=null&&r.desc?"desc":"asc"})}},WLe=(e,t)=>n=>{if(typeof n=="function"){const r=n({pageSize:e.limit,pageIndex:e.offset?Math.floor(e.offset/e.limit):0});t({limit:r==null?void 0:r.pageSize,offset:r!=null&&r.pageIndex?(r==null?void 0:r.pageIndex)*(r==null?void 0:r.pageSize):0})}else{const{pageSize:r,pageIndex:o}=n;t({limit:r,offset:o?o*r:0})}},VLe=(e,t)=>n=>{var o;const r=(o=e.columns)==null?void 0:o.reduce((s,a)=>({...s,...a&&{[a]:!0}}),{});if(typeof n=="function"){const s=n(r||{}),a=Object.keys(s).filter(l=>s[l]);t({columns:a})}else{const s=Object.keys(n).filter(a=>n[a]);t({columns:s})}},ULe=e=>({sorting:[{id:e.sortBy,desc:e.sortOrder==="desc"}]}),GLe=e=>({pagination:{pageIndex:e.offset?e.offset/e.limit:0,pageSize:e.limit}}),qLe=e=>{var t;return e.columns?{columnVisibility:(t=e.columns)==null?void 0:t.reduce((n,r)=>({...n,...r&&{[r]:!0}}),{})}:{}},hA=(e,t,n)=>{var a,l;const r=Object.fromEntries(Object.keys(((a=n.state)==null?void 0:a.columnVisibility)||{}).map(c=>[c,!1])),o=Object.fromEntries(n.columns.filter(({enableHiding:c})=>c===!1).map(c=>[c.id,!0])),s=e.columns?{...r,...qLe(e).columnVisibility,...o}:(l=n.state)==null?void 0:l.columnVisibility;return{getCoreRowModel:VAe(),enableSorting:!0,enableMultiSort:!1,manualPagination:!0,manualSorting:!0,enableSortingRemoval:!1,enableHiding:!0,onPaginationChange:WLe(e,t),onSortingChange:HLe(e,t),onColumnVisibilityChange:VLe(e,t),...n,state:{...ULe(e),...GLe(e),...n.state||{},columnVisibility:s}}},YLe=({cache:e,currentKey:t,clearPrefix:n,cacheSize:r=1})=>{const s=[...e.keys()].filter(c=>c.startsWith(n)&&c!==t),a=r-1;(a<=0?s:s.slice(0,-a)).forEach(c=>{e.delete(c)})},cy=({currentKey:e,clearPrefix:t,cacheSize:n=1})=>{const{cache:r}=RJ();YLe({cache:r,currentKey:e,clearPrefix:t,cacheSize:n})},KLe={features:[],total:0},XLe=10,GQ="api/admin/search/features?",JLe=()=>{const e={},t=o=>{e[o]={total:0,initialLoad:!0}},n=(o,s,a)=>{e[o]||t(o),e[o][s]=a},r=o=>(e[o]||t(o),e[o]);return(o,s={},a="")=>{const{KEY:l,fetcher:c}=ZLe(o),u=`${a}${l}`,d=o.project||"";cy({currentKey:u,clearPrefix:GQ,cacheSize:XLe}),g.useEffect(()=>{t(d)},[]);const{data:p,error:f,mutate:h,isLoading:m}=On(u,c,s),y=g.useCallback(()=>{h()},[h]),b=r(d);return(p==null?void 0:p.total)!==void 0&&n(d,"total",p.total),!m&&b.initialLoad&&n(d,"initialLoad",!1),{...p||KLe,loading:m,error:f,refetch:y,total:b.total,initialLoad:m&&b.initialLoad}}},ZLe=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,s])=>!!s).map(([o,s])=>[o,s.toString()]).toSorted())).toString(),n=`${GQ}${t}`;return{fetcher:()=>{const o=yt(n);return fetch(o,{method:"GET"}).then(en("Feature search")).then(s=>s.json())},KEY:n}},y7=JLe(),QLe=e=>e==null?e:e?"true":"false",eNe=e=>e==="true"?!0:e==="false"?!1:null,tNe={encode:QLe,decode:eNe},nNe=e=>e!=null&&e.values.length?`${e.operator}:${e.values.join(",")}`:void 0,rNe=e=>{if(typeof e!="string"||!e)return;const t=/^(IS|IS_NOT|IS_ANY_OF|IS_NONE_OF|INCLUDE|DO_NOT_INCLUDE|INCLUDE_ALL_OF|INCLUDE_ANY_OF|EXCLUDE_IF_ANY_OF|EXCLUDE_ALL|IS_BEFORE|IS_ON_OR_AFTER):(.+)$/,n=e.match(t);if(n)return{operator:n[1],values:n[2].split(",")}},ur={encode:nNe,decode:rNe},IN=(e,t)=>{const n=new Set(t),r={};return t.forEach(o=>{o in e&&(r[o]=e[o])}),Object.keys(e).forEach(o=>{n.has(o)||(r[o]=e[o])}),r},oNe=(e,t)=>{const[n,r]=Mp(),{value:o,setValue:s}=td(e,{});return g.useEffect(()=>{const a=Object.fromEntries(n.entries());Object.keys(a).length>0||Object.keys(o).length!==0&&r($g(t,o),{replace:!0})},[]),s},If=(e,t,n=["offset"])=>{const r=oNe(e,t),[o,s]=XE(t,{updateType:"replaceIn"}),[a]=Mp(),l=g.useMemo(()=>IN(o,[...a.keys()]),[a,o,IN]);g.useEffect(()=>{o.limit&&!yPe(o.limit)&&s(u=>({...u,limit:BR,offset:0}))},[o.limit,s]);const c=g.useCallback(u=>{if(!t.offset)return s(u);if(typeof u=="function")s(d=>{const p=u(d);return t.offset?{offset:t.offset.decode("0"),...p}:p});else{const d=t.offset?{offset:t.offset.decode("0"),...u}:u;s(d)}},[s,t.offset]);return g.useEffect(()=>{const u=Object.fromEntries(Object.entries(l).filter(([d])=>!n.includes(d)));r(u)},[JSON.stringify(l)]),[l,c]};var G4={exports:{}};G4.exports;(function(e,t){var n=200,r="Expected a function",o="__lodash_hash_undefined__",s=1,a=2,l=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object Boolean]",p="[object Date]",f="[object Error]",h="[object Function]",m="[object GeneratorFunction]",y="[object Map]",b="[object Number]",x="[object Object]",C="[object Promise]",w="[object RegExp]",j="[object Set]",k="[object String]",S="[object Symbol]",E="[object WeakMap]",T="[object ArrayBuffer]",R="[object DataView]",_="[object Float32Array]",M="[object Float64Array]",$="[object Int8Array]",z="[object Int16Array]",A="[object Int32Array]",O="[object Uint8Array]",L="[object Uint8ClampedArray]",B="[object Uint16Array]",H="[object Uint32Array]",N=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,I=/^\w*$/,q=/^\./,ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/[\\^$.*+?()[\]{}|]/g,oe=/\\(\\)?/g,se=/^\[object .+?Constructor\]$/,ae=/^(?:0|[1-9]\d*)$/,me={};me[_]=me[M]=me[$]=me[z]=me[A]=me[O]=me[L]=me[B]=me[H]=!0,me[c]=me[u]=me[T]=me[d]=me[R]=me[p]=me[f]=me[h]=me[y]=me[b]=me[x]=me[w]=me[j]=me[k]=me[E]=!1;var ce=typeof _n=="object"&&_n&&_n.Object===Object&&_n,_e=typeof self=="object"&&self&&self.Object===Object&&self,we=ce||_e||Function("return this")(),Me=t&&!t.nodeType&&t,Fe=Me&&!0&&e&&!e.nodeType&&e,Ge=Fe&&Fe.exports===Me,Re=Ge&&ce.process,Be=function(){try{return Re&&Re.binding("util")}catch{}}(),be=Be&&Be.isTypedArray;function ze(W,ee){for(var de=-1,ve=W?W.length:0;++de<ve;)if(ee(W[de],de,W))return!0;return!1}function xe(W){return function(ee){return ee==null?void 0:ee[W]}}function qe(W,ee){for(var de=-1,ve=Array(W);++de<W;)ve[de]=ee(de);return ve}function Ve(W){return function(ee){return W(ee)}}function et(W,ee){return W==null?void 0:W[ee]}function dt(W){var ee=!1;if(W!=null&&typeof W.toString!="function")try{ee=!!(W+"")}catch{}return ee}function at(W){var ee=-1,de=Array(W.size);return W.forEach(function(ve,Se){de[++ee]=[Se,ve]}),de}function rt(W,ee){return function(de){return W(ee(de))}}function Ae(W){var ee=-1,de=Array(W.size);return W.forEach(function(ve){de[++ee]=ve}),de}var Ye=Array.prototype,fe=Function.prototype,ge=Object.prototype,ye=we["__core-js_shared__"],Xe=function(){var W=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return W?"Symbol(src)_1."+W:""}(),ot=fe.toString,jt=ge.hasOwnProperty,Ke=ge.toString,bt=RegExp("^"+ot.call(jt).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=we.Symbol,Qe=we.Uint8Array,mt=ge.propertyIsEnumerable,Kt=Ye.splice,gt=rt(Object.keys,Object),tn=Di(we,"DataView"),pn=Di(we,"Map"),jn=Di(we,"Promise"),Hn=Di(we,"Set"),rr=Di(we,"WeakMap"),Dr=Di(Object,"create"),cs=Li(tn),es=Li(pn),ko=Li(jn),zo=Li(Hn),Jn=Li(rr),Wn=Ue?Ue.prototype:void 0,Lr=Wn?Wn.valueOf:void 0,us=Wn?Wn.toString:void 0;function to(W){var ee=-1,de=W?W.length:0;for(this.clear();++ee<de;){var ve=W[ee];this.set(ve[0],ve[1])}}function kr(){this.__data__=Dr?Dr(null):{}}function Yn(W){return this.has(W)&&delete this.__data__[W]}function Fs(W){var ee=this.__data__;if(Dr){var de=ee[W];return de===o?void 0:de}return jt.call(ee,W)?ee[W]:void 0}function uo(W){var ee=this.__data__;return Dr?ee[W]!==void 0:jt.call(ee,W)}function po(W,ee){var de=this.__data__;return de[W]=Dr&&ee===void 0?o:ee,this}to.prototype.clear=kr,to.prototype.delete=Yn,to.prototype.get=Fs,to.prototype.has=uo,to.prototype.set=po;function _r(W){var ee=-1,de=W?W.length:0;for(this.clear();++ee<de;){var ve=W[ee];this.set(ve[0],ve[1])}}function Te(){this.__data__=[]}function he(W){var ee=this.__data__,de=dc(ee,W);if(de<0)return!1;var ve=ee.length-1;return de==ve?ee.pop():Kt.call(ee,de,1),!0}function st(W){var ee=this.__data__,de=dc(ee,W);return de<0?void 0:ee[de][1]}function Pt(W){return dc(this.__data__,W)>-1}function nn(W,ee){var de=this.__data__,ve=dc(de,W);return ve<0?de.push([W,ee]):de[ve][1]=ee,this}_r.prototype.clear=Te,_r.prototype.delete=he,_r.prototype.get=st,_r.prototype.has=Pt,_r.prototype.set=nn;function Dn(W){var ee=-1,de=W?W.length:0;for(this.clear();++ee<de;){var ve=W[ee];this.set(ve[0],ve[1])}}function yr(){this.__data__={hash:new to,map:new(pn||_r),string:new to}}function Nt(W){return gc(this,W).delete(W)}function no(W){return gc(this,W).get(W)}function Kp(W){return gc(this,W).has(W)}function Xp(W,ee){return gc(this,W).set(W,ee),this}Dn.prototype.clear=yr,Dn.prototype.delete=Nt,Dn.prototype.get=no,Dn.prototype.has=Kp,Dn.prototype.set=Xp;function jl(W){var ee=-1,de=W?W.length:0;for(this.__data__=new Dn;++ee<de;)this.add(W[ee])}function cd(W){return this.__data__.set(W,o),this}function uc(W){return this.__data__.has(W)}jl.prototype.add=jl.prototype.push=cd,jl.prototype.has=uc;function Bs(W){this.__data__=new _r(W)}function El(){this.__data__=new _r}function li(W){return this.__data__.delete(W)}function lu(W){return this.__data__.get(W)}function Jp(W){return this.__data__.has(W)}function Zp(W,ee){var de=this.__data__;if(de instanceof _r){var ve=de.__data__;if(!pn||ve.length<n-1)return ve.push([W,ee]),this;de=this.__data__=new Dn(ve)}return de.set(W,ee),this}Bs.prototype.clear=El,Bs.prototype.delete=li,Bs.prototype.get=lu,Bs.prototype.has=Jp,Bs.prototype.set=Zp;function Qp(W,ee){var de=F(W)||gd(W)?qe(W.length,String):[],ve=de.length,Se=!!ve;for(var Pe in W)jt.call(W,Pe)&&!(Se&&(Pe=="length"||uu(Pe,ve)))&&de.push(Pe);return de}function dc(W,ee){for(var de=W.length;de--;)if(hd(W[de][0],ee))return de;return-1}var e1=i1();function pc(W,ee){return W&&e1(W,ee,re)}function fc(W,ee){ee=aa(ee,W)?[ee]:$i(ee);for(var de=0,ve=ee.length;W!=null&&de<ve;)W=W[ms(ee[de++])];return de&&de==ve?W:void 0}function kl(W){return Ke.call(W)}function ud(W,ee){return W!=null&&ee in Object(W)}function hc(W,ee,de,ve,Se){return W===ee?!0:W==null||ee==null||!Vt(W)&&!An(ee)?W!==W&&ee!==ee:dd(W,ee,hc,de,ve,Se)}function dd(W,ee,de,ve,Se,Pe){var Ze=F(W),lt=F(ee),Ct=u,Xt=u;Ze||(Ct=Nr(W),Ct=Ct==c?x:Ct),lt||(Xt=Nr(ee),Xt=Xt==c?x:Xt);var At=Ct==x&&!dt(W),nt=Xt==x&&!dt(ee),Ut=Ct==Xt;if(Ut&&!At)return Pe||(Pe=new Bs),Ze||U(W)?ci(W,ee,de,ve,Se,Pe):pd(W,ee,Ct,de,ve,Se,Pe);if(!(Se&a)){var Et=At&&jt.call(W,"__wrapped__"),qt=nt&&jt.call(ee,"__wrapped__");if(Et||qt){var fn=Et?W.value():W,Yt=qt?ee.value():ee;return Pe||(Pe=new Bs),de(fn,Yt,ve,Se,Pe)}}return Ut?(Pe||(Pe=new Bs),a1(W,ee,de,ve,Se,Pe)):!1}function t1(W,ee,de,ve){var Se=de.length,Pe=Se;if(W==null)return!Pe;for(W=Object(W);Se--;){var Ze=de[Se];if(Ze[2]?Ze[1]!==W[Ze[0]]:!(Ze[0]in W))return!1}for(;++Se<Pe;){Ze=de[Se];var lt=Ze[0],Ct=W[lt],Xt=Ze[1];if(Ze[2]){if(Ct===void 0&&!(lt in W))return!1}else{var At=new Bs,nt;if(!(nt===void 0?hc(Xt,Ct,ve,s|a,At):nt))return!1}}return!0}function n1(W){if(!Vt(W)||Rl(W))return!1;var ee=We(W)||dt(W)?bt:se;return ee.test(Li(W))}function r1(W){return An(W)&&cn(W.length)&&!!me[Ke.call(W)]}function cu(W){return typeof W=="function"?W:W==null?ke:typeof W=="object"?F(W)?Na(W[0],W[1]):s1(W):De(W)}function o1(W){if(!mc(W))return gt(W);var ee=[];for(var de in Object(W))jt.call(W,de)&&de!="constructor"&&ee.push(de);return ee}function s1(W){var ee=l1(W);return ee.length==1&&ee[0][2]?Fa(ee[0][0],ee[0][1]):function(de){return de===W||t1(de,W,ee)}}function Na(W,ee){return aa(W)&&Al(ee)?Fa(ms(W),ee):function(de){var ve=Z(de,W);return ve===void 0&&ve===ee?ie(de,W):hc(ee,ve,void 0,s|a)}}function zs(W){return function(ee){return fc(ee,W)}}function Mi(W){if(typeof W=="string")return W;if(P(W))return us?us.call(W):"";var ee=W+"";return ee=="0"&&1/W==-1/0?"-0":ee}function $i(W){return F(W)?W:du(W)}function i1(W){return function(ee,de,ve){for(var Se=-1,Pe=Object(ee),Ze=ve(ee),lt=Ze.length;lt--;){var Ct=Ze[++Se];if(de(Pe[Ct],Ct,Pe)===!1)break}return ee}}function ci(W,ee,de,ve,Se,Pe){var Ze=Se&a,lt=W.length,Ct=ee.length;if(lt!=Ct&&!(Ze&&Ct>lt))return!1;var Xt=Pe.get(W);if(Xt&&Pe.get(ee))return Xt==ee;var At=-1,nt=!0,Ut=Se&s?new jl:void 0;for(Pe.set(W,ee),Pe.set(ee,W);++At<lt;){var Et=W[At],qt=ee[At];if(ve)var fn=Ze?ve(qt,Et,At,ee,W,Pe):ve(Et,qt,At,W,ee,Pe);if(fn!==void 0){if(fn)continue;nt=!1;break}if(Ut){if(!ze(ee,function(Yt,Zt){if(!Ut.has(Zt)&&(Et===Yt||de(Et,Yt,ve,Se,Pe)))return Ut.add(Zt)})){nt=!1;break}}else if(!(Et===qt||de(Et,qt,ve,Se,Pe))){nt=!1;break}}return Pe.delete(W),Pe.delete(ee),nt}function pd(W,ee,de,ve,Se,Pe,Ze){switch(de){case R:if(W.byteLength!=ee.byteLength||W.byteOffset!=ee.byteOffset)return!1;W=W.buffer,ee=ee.buffer;case T:return!(W.byteLength!=ee.byteLength||!ve(new Qe(W),new Qe(ee)));case d:case p:case b:return hd(+W,+ee);case f:return W.name==ee.name&&W.message==ee.message;case w:case k:return W==ee+"";case y:var lt=at;case j:var Ct=Pe&a;if(lt||(lt=Ae),W.size!=ee.size&&!Ct)return!1;var Xt=Ze.get(W);if(Xt)return Xt==ee;Pe|=s,Ze.set(W,ee);var At=ci(lt(W),lt(ee),ve,Se,Pe,Ze);return Ze.delete(W),At;case S:if(Lr)return Lr.call(W)==Lr.call(ee)}return!1}function a1(W,ee,de,ve,Se,Pe){var Ze=Se&a,lt=re(W),Ct=lt.length,Xt=re(ee),At=Xt.length;if(Ct!=At&&!Ze)return!1;for(var nt=Ct;nt--;){var Ut=lt[nt];if(!(Ze?Ut in ee:jt.call(ee,Ut)))return!1}var Et=Pe.get(W);if(Et&&Pe.get(ee))return Et==ee;var qt=!0;Pe.set(W,ee),Pe.set(ee,W);for(var fn=Ze;++nt<Ct;){Ut=lt[nt];var Yt=W[Ut],Zt=ee[Ut];if(ve)var Vn=Ze?ve(Zt,Yt,Ut,ee,W,Pe):ve(Yt,Zt,Ut,W,ee,Pe);if(!(Vn===void 0?Yt===Zt||de(Yt,Zt,ve,Se,Pe):Vn)){qt=!1;break}fn||(fn=Ut=="constructor")}if(qt&&!fn){var rn=W.constructor,Ln=ee.constructor;rn!=Ln&&"constructor"in W&&"constructor"in ee&&!(typeof rn=="function"&&rn instanceof rn&&typeof Ln=="function"&&Ln instanceof Ln)&&(qt=!1)}return Pe.delete(W),Pe.delete(ee),qt}function gc(W,ee){var de=W.__data__;return Tl(ee)?de[typeof ee=="string"?"string":"hash"]:de.map}function l1(W){for(var ee=re(W),de=ee.length;de--;){var ve=ee[de],Se=W[ve];ee[de]=[ve,Se,Al(Se)]}return ee}function Di(W,ee){var de=et(W,ee);return n1(de)?de:void 0}var Nr=kl;(tn&&Nr(new tn(new ArrayBuffer(1)))!=R||pn&&Nr(new pn)!=y||jn&&Nr(jn.resolve())!=C||Hn&&Nr(new Hn)!=j||rr&&Nr(new rr)!=E)&&(Nr=function(W){var ee=Ke.call(W),de=ee==x?W.constructor:void 0,ve=de?Li(de):void 0;if(ve)switch(ve){case cs:return R;case es:return y;case ko:return C;case zo:return j;case Jn:return E}return ee});function fd(W,ee,de){ee=aa(ee,W)?[ee]:$i(ee);for(var ve,Se=-1,Ze=ee.length;++Se<Ze;){var Pe=ms(ee[Se]);if(!(ve=W!=null&&de(W,Pe)))break;W=W[Pe]}if(ve)return ve;var Ze=W?W.length:0;return!!Ze&&cn(Ze)&&uu(Pe,Ze)&&(F(W)||gd(W))}function uu(W,ee){return ee=ee??l,!!ee&&(typeof W=="number"||ae.test(W))&&W>-1&&W%1==0&&W<ee}function aa(W,ee){if(F(W))return!1;var de=typeof W;return de=="number"||de=="symbol"||de=="boolean"||W==null||P(W)?!0:I.test(W)||!N.test(W)||ee!=null&&W in Object(ee)}function Tl(W){var ee=typeof W;return ee=="string"||ee=="number"||ee=="symbol"||ee=="boolean"?W!=="__proto__":W===null}function Rl(W){return!!Xe&&Xe in W}function mc(W){var ee=W&&W.constructor,de=typeof ee=="function"&&ee.prototype||ge;return W===de}function Al(W){return W===W&&!Vt(W)}function Fa(W,ee){return function(de){return de==null?!1:de[W]===ee&&(ee!==void 0||W in Object(de))}}var du=la(function(W){W=Y(W);var ee=[];return q.test(W)&&ee.push(""),W.replace(ne,function(de,ve,Se,Pe){ee.push(Se?Pe.replace(oe,"$1"):ve||de)}),ee});function ms(W){if(typeof W=="string"||P(W))return W;var ee=W+"";return ee=="0"&&1/W==-1/0?"-0":ee}function Li(W){if(W!=null){try{return ot.call(W)}catch{}try{return W+""}catch{}}return""}function la(W,ee){if(typeof W!="function"||ee&&typeof ee!="function")throw new TypeError(r);var de=function(){var ve=arguments,Se=ee?ee.apply(this,ve):ve[0],Pe=de.cache;if(Pe.has(Se))return Pe.get(Se);var Ze=W.apply(this,ve);return de.cache=Pe.set(Se,Ze),Ze};return de.cache=new(la.Cache||Dn),de}la.Cache=Dn;function hd(W,ee){return W===ee||W!==W&&ee!==ee}function gd(W){return ue(W)&&jt.call(W,"callee")&&(!mt.call(W,"callee")||Ke.call(W)==c)}var F=Array.isArray;function Q(W){return W!=null&&cn(W.length)&&!We(W)}function ue(W){return An(W)&&Q(W)}function We(W){var ee=Vt(W)?Ke.call(W):"";return ee==h||ee==m}function cn(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=l}function Vt(W){var ee=typeof W;return!!W&&(ee=="object"||ee=="function")}function An(W){return!!W&&typeof W=="object"}function P(W){return typeof W=="symbol"||An(W)&&Ke.call(W)==S}var U=be?Ve(be):r1;function Y(W){return W==null?"":Mi(W)}function Z(W,ee,de){var ve=W==null?void 0:fc(W,ee);return ve===void 0?de:ve}function ie(W,ee){return W!=null&&fd(W,ee,ud)}function re(W){return Q(W)?Qp(W):o1(W)}function le(W,ee){var de={};return ee=cu(ee),pc(W,function(ve,Se,Pe){de[Se]=ee(ve,Se,Pe)}),de}function ke(W){return W}function De(W){return aa(W)?xe(ms(W)):zs(W)}e.exports=le})(G4,G4.exports);var sNe=G4.exports;const gA=ls(sNe),q4={encode:$Y,decode:e=>{const t=DY(e);return t==null?t:Number.isNaN(t)?null:t}},iNe=(e=BR)=>{const t="features-list-table",n={offset:Hr(q4,0),limit:Hr(q4,e),query:ei,favoritesFirst:Hr(tNe,!0),sortBy:Hr(ei,"createdAt"),sortOrder:Hr(ei,"desc"),project:ur,tag:ur,state:ur,segment:ur,createdAt:ur,type:ur,lifecycle:ur,createdBy:ur,favorite:ur},[r,o]=If(`${t}`,n),{offset:s,limit:a,query:l,favoritesFirst:c,sortBy:u,sortOrder:d,...p}=r,f=r,{features:h=[],total:m,loading:y,refetch:b,initialLoad:x}=y7(gA($g(n,f),C=>C?`${C}`:void 0));return{features:h,total:m,refetch:b,loading:y,initialLoad:x,tableState:r,setTableState:o,filterState:p}},ON=([e,t],n,r)=>g.useCallback(o=>{const s=n?n[e]:void 0;console.log({key:e,operator:t,state:s,value:o}),s&&s.values.length>0&&!s.values.includes(`${o}`)?r({...n,[e]:{operator:s.operator,values:[...s.values,o]}}):s||r({...n,[e]:{operator:t,values:[o]}})},[n,r,e,t]),aNe=()=>{const{data:e,error:t}=On(yt("api/admin/lifecycle/count"),lNe);return{lifecycleCount:e,error:t,loading:!t&&!e}},lNe=e=>fetch(e).then(en("Lifecycle count")).then(t=>t.json()),cNe=({label:e,icon:t,...n})=>i.jsx($e,{...n,endIcon:i.jsx(Ta,{children:t}),children:e}),uNe=({renderOptions:e,id:t,title:n,callback:r,icon:o=i.jsx(lA,{titleAccess:"Toggle"}),label:s,startIcon:a,selected:l,layout:c,...u})=>{const[d,p]=g.useState(null),f=m=>{p(m.currentTarget)},h=m=>{r&&typeof r=="function"&&r(m),p(null)};return i.jsxs(i.Fragment,{children:[i.jsx(cNe,{id:t,label:l||s,title:n,startIcon:a,onClick:f,"aria-controls":t,"aria-expanded":!!d,icon:o,style:{width:c==null?void 0:c.width,...c==null?void 0:c.button},...u}),i.jsx(jf,{id:t,onClick:h,anchorEl:d,open:!!d,sx:{...c==null?void 0:c.menu,"& .MuiPaper-root":{width:c==null?void 0:c.width}},children:e()})]})},dNe=v(K)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,color:e.palette.text.secondary,padding:e.spacing(0,.5),height:e.spacing(2.5),textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",variant:"outlined",marginLeft:e.spacing(1),marginRight:e.spacing(-.5),fontWeight:"bold",'&[data-selected="true"]':{backgroundColor:e.palette.secondary.light,borderColor:e.palette.primary.main,color:e.palette.primary.main}})),qQ=({count:e,isActive:t})=>i.jsx(dNe,{"data-selected":t,children:e}),pNe=v(Ti,{shouldForwardProp:e=>e!=="isActive"})(({theme:e})=>({borderRadius:0,padding:e.spacing(1,0),fontSize:e.typography.body2.fontSize,height:"auto",'&[data-selected="true"]':{backgroundColor:e.palette.secondary.light,fontWeight:"bold",borderColor:e.palette.primary.main,color:e.palette.primary.main},":focus-visible":{outline:`1px solid ${e.palette.primary.main}`,borderColor:e.palette.primary.main},"&:first-of-type":{borderTopLeftRadius:e.shape.borderRadius,borderBottomLeftRadius:e.shape.borderRadius},"&:last-of-type":{borderTopRightRadius:e.shape.borderRadius,borderBottomRightRadius:e.shape.borderRadius},'&:not(&[data-selected="true"], :last-of-type)':{borderRightWidth:0},'[data-selected="true"] + &':{borderLeftWidth:0},[e.breakpoints.down("md")]:{width:"100%",justifyContent:"flex-start",borderLeft:0,borderRight:0,borderBottom:0,borderTop:`1px solid ${e.palette.divider}`,"& .MuiChip-icon":{marginLeft:e.spacing(1),marginRight:e.spacing(1)},"& .MuiChip-label":{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},'&[data-selected="true"]':{borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.default},'&[data-selected="true"] + &':{borderTop:0},"&:not(:has(.MuiChip-icon)) .MuiChip-label":{paddingLeft:e.spacing(8)},"&:first-of-type":{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTop:0},"&:last-of-type":{borderTopRightRadius:0,borderBottomRightRadius:0}},"& .MuiChip-label":{position:"relative",textAlign:"center",paddingLeft:e.spacing(1)}})),MN=({label:e,value:t,isActive:n,flagsCount:r,onClick:o})=>i.jsx(pNe,{label:i.jsxs(K,{sx:{display:"inline-flex",alignItems:"center"},children:[i.jsx("span",{children:e}),i.jsx(qQ,{isActive:n,count:r??0})]}),variant:"outlined",onClick:o,"data-selected":n,icon:t?i.jsx(ly,{stage:{name:t}}):void 0}),fNe=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2)})),hNe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap"})),gNe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:e.spacing(.5),marginRight:e.spacing(4),width:"100%"})),Dx=[{label:"All lifecycles",value:null},{label:"Develop",value:"pre-live"},{label:"Rollout production",value:"live"},{label:"Cleanup",value:"completed"}],mNe=({label:e,value:t,count:n})=>i.jsxs(gNe,{children:[t?i.jsx(ly,{stage:{name:t}}):i.jsx(K,{sx:r=>({marginLeft:r.spacing(.5)})}),i.jsx("span",{children:e}),i.jsx(qQ,{isActive:!0,count:n??0})]}),yNe=({state:e,onChange:t,children:n,countData:r})=>{var h,m;const o=Bt(),s=Nn(o.breakpoints.down("md")),a=((m=(h=e.lifecycle)==null?void 0:h.values)==null?void 0:m[0])??null,l=y=>y===a,c=Object.entries(r??{}).reduce((y,[b,x])=>b!=="archived"?y+x:y,0),u=y=>y!==null?r==null?void 0:r[y]:c||void 0,d=y=>{t(y===null?{lifecycle:null}:{lifecycle:{operator:"IS",values:[y]}})},p=Dx.find(y=>y.value===a)??Dx[0],f=()=>Dx.map(({label:y,value:b})=>{const x=b!==null?r==null?void 0:r[b]:c||void 0;return i.jsx(MN,{label:y,flagsCount:x,onClick:()=>d(b),value:b,isActive:l(b)},y)});return i.jsx(i.Fragment,{children:s?i.jsx(uNe,{id:"lifecycle-filters-menu",label:"",selected:i.jsx(mNe,{label:p.label,value:p.value,count:u(p.value)}),icon:i.jsx(Pf,{}),renderOptions:()=>i.jsxs(K,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%"},children:[Dx.map(({label:y,value:b})=>{const x=b!==null?r==null?void 0:r[b]:c||void 0;return i.jsx(MN,{label:y,flagsCount:x,onClick:()=>d(b),value:b,isActive:l(b)},y)}),n]}),layout:{width:o.spacing(36),button:{border:`1px solid ${o.palette.divider}`,paddingRight:o.spacing(2)},menu:{"& .MuiMenu-list":{padding:0}}}}):i.jsxs(fNe,{children:[i.jsx(hNe,{children:f()}),n]})})},xNe=({state:e,onChange:t,children:n})=>{const{lifecycleCount:r}=aNe(),o=Object.entries(r||{}).reduce((s,[a,l])=>(s[a==="preLive"?"pre-live":a]=l,s),{});return i.jsx(K,{sx:s=>({padding:s.spacing(1.5,3,0,3)}),children:i.jsx(yNe,{state:e,onChange:t,countData:o,children:n})})};var mA={},vNe=je;Object.defineProperty(mA,"__esModule",{value:!0});var YQ=mA.default=void 0,bNe=vNe(Ee()),CNe=i,wNe=(0,bNe.default)((0,CNe.jsx)("path",{d:"m16 5-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z"}),"IosShare");YQ=mA.default=wNe;const SNe=({onClick:e})=>{const{trackEvent:t}=zt();return i.jsx(Rt,{title:"Export flags",arrow:!0,children:i.jsx(Mt,{onClick:()=>{e(),t("search-feature-buttons",{props:{action:"export"}})},size:"small",children:i.jsx(YQ,{})})})},jNe=v(Mt,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({color:e.palette.primary.main,padding:0,fontSize:e.typography.body2.fontSize,opacity:t?1:0,"&:is(:hover, :focus, :active)":{opacity:1}})),KQ=({isFavorite:e,onClick:t})=>{const{trackEvent:n}=zt(),r=e?{"aria-label":"Remove from favorites"}:{"aria-label":"Add to favorites",className:"show-row-hover"};return i.jsx(jNe,{active:e,size:"small",...r,onClick:o=>{o.preventDefault(),n("favorite",{props:{action:e?"unfavorite":"favorite"}}),t()},children:e?i.jsx(s7,{sx:{fontSize:"inherit"}}):i.jsx(i7,{sx:{fontSize:"inherit"}})})},t0=(e={})=>{const t=async()=>{const c=yt("api/admin/feature-types");return(await fetch(c,{method:"GET"}).then(en("Feature types"))).json()},n="api/admin/feature-types",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=()=>{Fo(n)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{featureTypes:(r==null?void 0:r.types)||[],error:o,loading:s,refetch:l}},ENe="experiment",kNe="release",TNe="operational",RNe="kill-switch",ANe="permission";var yA={},PNe=je;Object.defineProperty(yA,"__esModule",{value:!0});var RS=yA.default=void 0,_Ne=PNe(Ee()),INe=i,ONe=(0,_Ne.default)((0,INe.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"}),"Loop");RS=yA.default=ONe;var xA={},MNe=je;Object.defineProperty(xA,"__esModule",{value:!0});var XQ=xA.default=void 0,$Ne=MNe(Ee()),DNe=i,LNe=(0,$Ne.default)((0,DNe.jsx)("path",{d:"M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2z"}),"Timeline");XQ=xA.default=LNe;var vA={},NNe=je;Object.defineProperty(vA,"__esModule",{value:!0});var x7=vA.default=void 0,FNe=NNe(Ee()),BNe=i,zNe=(0,FNe.default)((0,BNe.jsx)("path",{d:"M13 3h-2v10h2V3zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z"}),"PowerSettingsNew");x7=vA.default=zNe;var bA={},HNe=je;Object.defineProperty(bA,"__esModule",{value:!0});var JQ=bA.default=void 0,WNe=HNe(Ee()),VNe=i,UNe=(0,WNe.default)((0,VNe.jsx)("path",{d:"M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z"}),"PanTool");JQ=bA.default=UNe;var CA={},GNe=je;Object.defineProperty(CA,"__esModule",{value:!0});var ZQ=CA.default=void 0,qNe=GNe(Ee()),YNe=i,KNe=(0,qNe.default)((0,YNe.jsx)("path",{d:"m22.7 19-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"}),"Build");ZQ=CA.default=KNe;const v7=e=>{switch(e){case kNe:return RS;case ENe:return XQ;case RNe:return x7;case TNe:return ZQ;case ANe:return JQ;default:return RS}},XNe=v("span")(({theme:e,color:t="neutral",icon:n})=>({display:"inline-flex",alignItems:"center",gap:e.spacing(.5),padding:e.spacing(n?.375:.625,1),borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,fontWeight:e.fontWeight.bold,lineHeight:1,...t==="disabled"?{color:e.palette.text.secondary,background:e.palette.background.paper,border:`1px solid ${e.palette.divider}`}:{backgroundColor:e.palette[t].light,color:e.palette[t].contrastText,border:`1px solid ${e.palette[t].border}`}})),JNe=v("span")(({theme:e,color:t="neutral"})=>({display:"flex",color:t==="disabled"?e.palette.action.disabled:e.palette[t].main})),$N=(e,t)=>i.jsx(JNe,{color:e,children:i.jsx(te,{condition:!!(t!=null&&t.props.sx),show:t,elseShow:t?g.cloneElement(t,{sx:{fontSize:"16px"}}):null})}),an=g.forwardRef(({as:e="span",color:t="neutral",icon:n,iconRight:r,className:o,sx:s,children:a,...l},c)=>i.jsxs(XNe,{as:e,color:t,icon:n,className:o,sx:s,...l,ref:c,children:[i.jsx(te,{condition:!!n&&!r,show:$N(t,n)}),i.jsx(te,{condition:a!=null&&a!=="",show:i.jsx("span",{children:a})}),i.jsx(te,{condition:!!n&&!!r,show:$N(t,n)})]})),QQ={environments:[],name:"",type:"release",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1,dependencies:[],children:[]},ws=(e,t,n)=>{const r=tee(e,t),{data:o,error:s,mutate:a}=On(["useFeature",r],()=>eee(r),n),l=g.useCallback(()=>{a().catch(console.warn)},[a]);return{feature:(o==null?void 0:o.body)||QQ,refetchFeature:l,loading:!s&&!o,status:o==null?void 0:o.status,error:s}},eee=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await en("Feature flag data")(t),{status:t.status,body:await t.json()})},tee=(e,t)=>yt(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`),ZNe=v(Ti)(({theme:e,$color:t})=>({borderRadius:e.spacing(2),border:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.paper,color:e.palette.text.primary,height:"26px","& .MuiChip-label":{display:"flex",alignItems:"center",gap:e.spacing(1),paddingRight:e.spacing(1)},"& .MuiChip-deleteIcon":{marginLeft:e.spacing(.5),marginRight:e.spacing(.5)}})),QNe=v("div")(({theme:e,$color:t})=>({width:e.spacing(1.3),height:e.spacing(1.3),borderRadius:"50%",backgroundColor:t,border:`1px solid ${t==="#FFFFFF"?e.palette.divider:t}`,flexShrink:0})),nee=({tag:e,onDelete:t,deleteIcon:n,maxLength:r=30})=>{const o=yg(e),s=o.length>r,a=e.color&&e.color!=="#FFFFFF";let l=e.value;if(s){const u=Math.max(0,r-e.type.length-1);l=`${e.value.substring(0,u)}...`}const c=i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[a&&i.jsx(QNe,{$color:e.color}),i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:`${e.type}:${l}`})]});return i.jsx(ZNe,{label:c,onDelete:t,deleteIcon:n,title:s?o:void 0})},eFe=v(ft)(({theme:e})=>({textDecoration:"none",fontWeight:e.typography.fontWeightBold,"&:hover, &:focus":{textDecoration:"underline"}})),tFe=v("button")(({theme:e})=>({marginRight:e.spacing(.5),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,textOverflow:"ellipsis",overflow:"hidden",textWrap:"nowrap",maxWidth:"250px",padding:e.spacing(.25,.5),cursor:"pointer",background:"inherit",color:"inherit"}));v(Ti)(({theme:e})=>({overflowWrap:"anywhere",lineHeight:e.typography.body1.lineHeight,backgroundColor:e.palette.background.paper,color:e.palette.text.primary,padding:e.spacing(.25,.5),height:"auto",fontSize:e.fontSizes.smallerBody,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,"&:hover":{backgroundColor:e.palette.background.paper},"& .MuiChip-label":{padding:0}}));const nFe=({text:e,searchQuery:t})=>i.jsx(te,{condition:!!(e&&e.length>40),show:i.jsx(wr,{title:i.jsx(Pr,{search:t,children:e}),placement:"bottom-start",arrow:!0,children:i.jsx(dN,{"data-loading":!0,children:i.jsx(Pr,{search:t,children:e})})}),elseShow:i.jsx(dN,{"data-loading":!0,children:i.jsx(Pr,{search:t,children:e})})}),rFe=v(K)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5),margin:e.spacing(1.25,0,1,0),paddingLeft:e.spacing(2)})),oFe=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.dark})),sFe=v(K)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.25)})),iFe=v(an)(({theme:e})=>({padding:e.spacing(.5),border:0,textTransform:"capitalize"})),aFe=({project:e,feature:t,searchQuery:n})=>i.jsx(K,{sx:r=>({fontWeight:r.typography.fontWeightBold}),children:i.jsx(eFe,{to:`/projects/${e}/features/${t}`,children:i.jsx(mr,{lines:1,title:t,arrow:!0,sx:{overflowWrap:"anywhere"},children:i.jsx("span",{children:i.jsx(Pr,{search:n,children:t})})})})}),lFe=({feature:e,searchQuery:t})=>i.jsx(mr,{lines:1,title:e,arrow:!0,sx:n=>({fontWeight:n.typography.fontWeightBold,color:n.palette.neutral.main,overflowWrap:"anywhere"}),children:i.jsx(Pr,{search:t,children:e})}),W9=({tag:e,onClick:t})=>{const n=yg(e),r=i.jsx(K,{onClick:()=>t(e),sx:{cursor:"pointer"},children:i.jsx(nee,{tag:e,maxLength:30})});return i.jsx(wr,{title:n,arrow:!0,children:i.jsx("span",{children:r})},n)},cFe=({tags:e,onClick:t})=>i.jsx(wr,{title:e.map(n=>{const r=yg(n);return i.jsx(K,{sx:{cursor:"pointer"},onClick:()=>t(r),children:i.jsx(nee,{tag:n,maxLength:30})},r)}),children:i.jsxs(tFe,{sx:{cursor:"initial",borderRadius:n=>n.spacing(2)},children:[e.length," more..."]})}),uFe=({tags:e,onClick:t})=>{if(!e||e.length===0)return null;const[n,r,o,...s]=e,a=l=>{t(yg(l))};return i.jsxs(sFe,{children:[n&&i.jsx(W9,{tag:n,onClick:a}),r&&i.jsx(W9,{tag:r,onClick:a}),o&&i.jsx(W9,{tag:o,onClick:a}),i.jsx(te,{condition:s.length>0,show:i.jsx(cFe,{tags:s,onClick:t})})]})},dFe=v(ft)({display:"block"}),pFe=({feature:e,project:t})=>{const{feature:n}=ws(t,e),r=n.children,o=n.dependencies;if(r.length>0)return i.jsxs(i.Fragment,{children:[i.jsx(K,{children:"Children"}),r.map(s=>i.jsx(dFe,{to:`/projects/${t}/features/${s}`,children:s},s))]});if(o[0]){const s=o[0].feature;return i.jsxs(i.Fragment,{children:[i.jsx(K,{children:"Parent"}),i.jsx(ft,{to:`/projects/${t}/features/${s}`,children:s})]})}return i.jsx(i.Fragment,{children:"Loading..."})},fFe=({project:e,feature:t,archivedAt:n,type:r,searchQuery:o,dependencyType:s,onTypeClick:a,delay:l=500,isFavorite:c,onFavorite:u})=>{var x;const{featureTypes:d}=t0(),p=v7(r),h=`${((x=d.find(C=>C.id===r))==null?void 0:x.name)||r} flag`,{locationSettings:m}=$r(),y=RR(n,m.locale),b=()=>i.jsx(wr,{arrow:!0,title:h,describeChild:!0,children:i.jsx(Mt,{sx:{p:0},"aria-label":`add ${r} flag to filter`,onClick:()=>a(r),children:i.jsx(p,{sx:C=>({fontSize:C.spacing(2)}),"data-testid":"feature-type-icon"})})});return i.jsxs(oFe,{"data-loading":!0,children:[i.jsx(b,{}),n?i.jsx(lFe,{feature:t,searchQuery:o}):i.jsx(aFe,{project:e,feature:t,searchQuery:o}),i.jsx(KQ,{isFavorite:c,onClick:u}),i.jsx(te,{condition:!!s,show:i.jsx(wr,{title:i.jsx(pFe,{feature:t,project:e}),enterDelay:l,enterNextDelay:l,children:i.jsx(iFe,{color:s==="parent"?"warning":"secondary",children:s})})}),n&&i.jsx(wr,{arrow:!0,title:y,describeChild:!0,children:i.jsx(an,{tabIndex:0,color:"neutral",children:"Archived"})})]})},hFe=({description:e,searchQuery:t})=>i.jsx(te,{condition:!!e,show:i.jsx(K,{sx:n=>({display:"flex",gap:n.spacing(1),paddingLeft:n.spacing(3)}),children:i.jsx(nFe,{text:e,searchQuery:t})})}),gFe=(e,t,n)=>({row:r})=>{const{searchQuery:o}=Pi();return i.jsxs(rFe,{children:[i.jsx(fFe,{project:r.original.project||"",feature:r.original.name,archivedAt:r.original.archivedAt,searchQuery:o,type:r.original.type||"",dependencyType:r.original.dependencyType||"",onTypeClick:t,isFavorite:r.original.favorite,onFavorite:()=>n(r.original)}),i.jsx(hFe,{description:r.original.description||"",searchQuery:o}),i.jsx(K,{sx:s=>({paddingLeft:s.spacing(3)}),children:i.jsx(uFe,{tags:r.original.tags,onClick:e})})]})},tc=v("div")(()=>({border:0,clip:"rect(0 0 0 0)",height:"auto",margin:0,overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"})),mFe=v("div")({width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}),yFe=v("button")({border:"none",background:"none",cursor:"pointer",borderRadius:"100%",padding:0}),xFe=v("p")(({theme:e})=>({color:e.palette.text.secondary})),vFe=v(ed)(({theme:e})=>({width:e.spacing(3),height:e.spacing(3)})),bFe=e=>({row:t})=>{var l;const n={id:0,name:"",imageUrl:"",...(l=t==null?void 0:t.original)==null?void 0:l.createdBy},r=n.id===0,o=r?()=>{}:()=>e==null?void 0:e(n.id),s=r?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:n.name}),i.jsx(xFe,{children:"You can't filter by unknown users."})]}):i.jsx("p",{children:n.name}),a=i.jsxs(i.Fragment,{children:[i.jsx(tc,{children:i.jsxs("span",{children:["Show only flags created by ",n.name]})}),i.jsx(vFe,{disableTooltip:!0,user:{id:n.id,name:n.name,imageUrl:n.imageUrl}})]});return i.jsx(mFe,{children:i.jsx(wr,{arrow:!0,describeChild:!0,title:s,children:e?i.jsx(yFe,{"aria-disabled":r,onClick:o,children:a}):i.jsx("div",{children:a})})})},$1="production",CFe=({lifecycle:e,environments:t})=>{if((e==null?void 0:e.stage)==="initial"){if(t!=null&&t.some(r=>r.type!==$1&&r.enabled))return"No traffic";if(!(t!=null&&t.some(r=>r.type!==$1&&r.hasStrategies)))return"No strategies";if(!(t!=null&&t.some(r=>r.type!==$1&&r.hasEnabledStrategies)))return"No enabled strategies"}if((e==null?void 0:e.stage)==="pre-live"&&!(t!=null&&t.some(r=>r.enabled)))return"Paused";const n=t==null?void 0:t.filter(r=>r.type===$1);if((e==null?void 0:e.stage)==="live"||(e==null?void 0:e.stage)==="completed"){if(n.length>1){const o=n.filter(s=>s.enabled).length;if(o===0)return"Paused";if(n.length!==o)return`In ${o} out of ${n.length} production environments`}if(n.length===0)return"No production environments";const r=n[0];if(!(r!=null&&r.hasStrategies))return"No strategies";if(!(r!=null&&r.enabled))return"Paused";if(r.totalMilestones){const o=`${(r.milestoneOrder||0)+1} of ${r.totalMilestones}`;return r.milestoneName?`Milestone: ${r.milestoneName} (${o})`:`Milestone ${o}`}}return"–"};var wA={},wFe=je;Object.defineProperty(wA,"__esModule",{value:!0});var ree=wA.default=void 0,SFe=wFe(Ee()),jFe=i,EFe=(0,SFe.default)((0,jFe.jsx)("path",{d:"M18 23H4c-1.1 0-2-.9-2-2V7h2v14h14v2zM15 1H8c-1.1 0-1.99.9-1.99 2L6 17c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V7l-6-6zm1.5 14h-6v-2h6v2zm0-6h-2v2h-2V9h-2V7h2V5h2v2h2v2z"}),"Difference");ree=wA.default=EFe;const kFe=v("div")(({theme:e})=>({padding:e.spacing(0,2),display:"flex",alignItems:"center",gap:e.spacing(.5),minWidth:"180px"})),TFe=v(ree)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(3.5),padding:e.spacing(.5)})),RFe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",gap:e.spacing(.5),ul:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column"}})),AFe=({lifecycle:e,environments:t,project:n})=>{const r=g.useMemo(()=>CFe({lifecycle:e,environments:t}),[e,t]),o=g.useMemo(()=>t.flatMap(s=>s.changeRequestIds),[t]);return i.jsxs(kFe,{children:[i.jsx(mr,{title:r,lines:2,children:r}),o.length>0&&i.jsx(wr,{arrow:!0,title:i.jsxs(RFe,{children:[i.jsx("div",{children:"Change requests:"}),i.jsx("ul",{children:o.map(s=>i.jsx("li",{children:i.jsx(ft,{to:`/projects/${n}/change-requests/${s}`,target:"_blank",rel:"noopener noreferrer",children:`#${s}`})},s))})]}),children:i.jsx(TFe,{"data-testid":"change-requests-icon",tabIndex:0})})]})},oee=Array(15).fill({name:"Name of the feature",description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1).toISOString(),project:"projectID",createdBy:{id:0,name:"admin",imageUrl:""},archivedAt:null,favorite:!1,stale:!1,dependencyType:null,tags:[],environments:[],impressionData:!1,segments:[]}),Zf=_R(),PFe=()=>{var L;const e=Bt(),{isOss:t}=ut(),{trackEvent:n}=zt(),{environments:r}=rd(),o=r.filter(B=>B.enabled).map(B=>B.name),s=Nn(e.breakpoints.down("md")),a=Nn(e.breakpoints.down("lg")),l=Nn(e.breakpoints.down("xl")),[c,u]=g.useState(!1),{setToastApiError:d}=_t(),{features:p,total:f,refetch:h,loading:m,initialLoad:y,tableState:b,setTableState:x,filterState:C}=iNe(),w=ON(["type","IS"],b,x),j=ON(["tag","INCLUDE"],b,x),{projects:k}=Zr(),S=xl(m),{favorite:E,unfavorite:T}=Q_e(),R=g.useCallback(async B=>{try{B!=null&&B.favorite?await T(B.project,B.name):await E(B.project,B.name),h()}catch{d("Something went wrong, could not update favorite")}},[E,h,T,d]),_=!t(),M=g.useMemo(()=>[Zf.accessor("name",{header:"Name",cell:gFe(j,w,R)}),Zf.accessor("createdBy",{id:"createdBy",header:"By",cell:bFe(),meta:{width:"1%",align:"center"},enableSorting:!1}),Zf.accessor("createdAt",{header:"Created",cell:({getValue:B})=>i.jsx(Cp,{value:B()}),meta:{width:"1%"}}),Zf.accessor("lifecycle",{id:"lifecycle",header:"Lifecycle",cell:({row:{original:B}})=>i.jsx(YMe,{feature:B,expanded:!0,"data-loading":!0}),enableSorting:!1,size:50,meta:{width:"1%"}}),..._?[Zf.accessor("environments",{id:"status",header:"Status",cell:({row:{original:B}})=>i.jsx(AFe,{...B}),enableSorting:!1,size:350})]:[],Zf.accessor("project",{header:"Project",cell:({getValue:B})=>{var I;const H=B(),N=(I=k.find(q=>q.id===H))==null?void 0:I.name;return i.jsx(K,{sx:{minWidth:"180px"},children:i.jsx(Yl,{title:N||H,to:`/projects/${H}`})})}})],[b.favoritesFirst,_]),$=g.useMemo(()=>(p==null?void 0:p.length)===0&&m?oee:p,[y,p,m]),z=$R(hA(b,x,{columns:M,data:$}));g.useEffect(()=>{s?z.setColumnVisibility({type:!1,createdAt:!1,tags:!1,lastSeenAt:!1,stale:!1}):a?z.setColumnVisibility({lastSeenAt:!1,stale:!1}):z.setColumnVisibility({})},[s,a]);const A=(B="")=>{x({query:B}),n("search-bar",{props:{screen:"features",length:B.length}})},O=z.getRowModel().rows;return r.length>0?i.jsxs(ir,{disableLoading:!0,bodyClass:"no-padding",header:i.jsx($n,{title:"Flags overview",actions:i.jsxs(i.Fragment,{children:[i.jsx(Sn,{component:ft,to:"/unknown-flags",underline:"always",sx:{marginRight:2,fontSize:e.typography.body2.fontSize,...Uu(e)},children:"Unknown flags"}),i.jsx(Sn,{component:ft,to:"/archive",underline:"always",sx:{marginRight:2,fontSize:e.typography.body2.fontSize,...Uu(e)},onClick:()=>{n("search-feature-buttons",{props:{action:"archive"}})},children:"Archived flags"}),i.jsx(SNe,{onClick:()=>u(!0)})]})}),children:[i.jsx(xNe,{state:C,onChange:x,children:l?null:i.jsx(No,{placeholder:"Search",initialValue:b.query||"",onChange:A,id:"globalFeatureFlags"})}),i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(zLe,{onChange:x,state:C}),i.jsx(lIe,{isActive:b.favoritesFirst,onClick:()=>x({favoritesFirst:!b.favoritesFirst})})]}),l?i.jsx(K,{sx:B=>({padding:B.spacing(0,3,3)}),children:i.jsx(No,{initialValue:b.query||"",onChange:A,id:"globalFeatureFlags"})}):null,i.jsx(Ai,{value:b.query||"",children:i.jsx("div",{ref:S,children:i.jsx(zR,{tableInstance:z,totalItems:f})})}),i.jsx(te,{condition:O.length===0,show:i.jsx(K,{sx:B=>({padding:B.spacing(0,2,2)}),children:i.jsx(te,{condition:((L=b.query||"")==null?void 0:L.length)>0,show:i.jsxs(Gr,{children:["No feature flags found matching “",b.query,"”"]}),elseShow:i.jsx(Gr,{children:"No feature flags found matching your criteria."})})})}),i.jsx(kIe,{showExportDialog:c,data:$,onClose:()=>u(!1),environments:o})]}):null},_Fe=["flexibleRollout","default"],IFe=e=>e.map(t=>({...t,advanced:!_Fe.includes(t.name)})),Of=()=>{const{data:e,error:t}=On(AS,OFe),n=g.useCallback(()=>{Fo(AS).catch(console.warn)},[]);return{strategies:IFe((e==null?void 0:e.strategies)||$Fe),refetchStrategies:n,loading:!t&&!e,error:t}},OFe=()=>fetch(AS).then(en("Strategy types")).then(e=>e.json()),MFe={deprecated:!1,name:"flexibleRollout",displayName:"Gradual rollout",editable:!1,description:"Roll out to a percentage of your userbase, and ensure that the experience is the same for the user on each visit.",parameters:[{name:"rollout",type:"percentage",description:"",required:!1},{name:"stickiness",type:"string",description:"Used to defined stickiness",required:!0},{name:"groupId",type:"string",description:"",required:!0}]},$Fe=[MFe],AS=yt("api/admin/strategies");function see(e,t=""){return(n={},r="",o={})=>{const s=new URLSearchParams(Array.from(Object.entries(n).filter(([h,m])=>!!m).map(([h,m])=>[h,m.toString()]))).toString(),a=r||t,l=`${a}${s}`;cy({currentKey:l,clearPrefix:a});const c=async()=>fetch(yt(l),{method:"GET"}).then(en("Paginated data")).then(h=>h.json()),{data:u,error:d,isLoading:p}=On(l,c,{...o});return{...u||e,total:(u==null?void 0:u.total)||0,error:d,loading:p}}}const DFe="api/admin/metrics/applications?",iee=see({applications:[],total:0},DFe);var SA={},LFe=je;Object.defineProperty(SA,"__esModule",{value:!0});var Eo=SA.default=void 0,NFe=LFe(Ee()),FFe=i,BFe=(0,NFe.default)((0,FFe.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Eo=SA.default=BFe;var jA={},zFe=je;Object.defineProperty(jA,"__esModule",{value:!0});var aee=jA.default=void 0,HFe=zFe(Ee()),WFe=i,VFe=(0,HFe.default)((0,WFe.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"RadioButtonChecked");aee=jA.default=VFe;var EA={},UFe=je;Object.defineProperty(EA,"__esModule",{value:!0});var lee=EA.default=void 0,GFe=UFe(Ee()),qFe=i,YFe=(0,GFe.default)((0,qFe.jsx)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"}),"Apps");lee=EA.default=YFe;const KFe="_truncate_19sq2_2",XFe="_fullwidth_19sq2_8",JFe="_listLink_19sq2_25",ZFe="_listItem_19sq2_106",Wh={truncate:KFe,fullwidth:XFe,listLink:JFe,listItem:ZFe},cee=({apps:e})=>i.jsx(Ri,{children:i.jsx(te,{condition:e.length>0,show:e.map(({appName:t,description:n,icon:r})=>i.jsxs(Or,{className:Wh.listItem,children:[i.jsx(Kw,{children:i.jsx(N5,{children:i.jsx(te,{condition:r,show:i.jsx(Ta,{children:r}),elseShow:i.jsx(lee,{})},`avatar_conditional_${t}`)})}),i.jsx(un,{primary:i.jsx(ft,{to:`/applications/${encodeURIComponent(t)}`,className:[Wh.listLink,Wh.truncate].join(" "),children:t}),secondary:n||"No description"})]},t))})});cee.propTypes={apps:Le.array.isRequired};Le.string,Le.any;Le.string,Le.func.isRequired,Le.string;Le.string,Le.object;const QFe=tt.forwardRef(({icon:e,label:t,disabled:n,...r},o)=>i.jsxs(wn,{disabled:n,style:{display:"flex",alignItems:"center"},...r,children:[i.jsx(e,{}),t]}));QFe.propTypes={icon:Le.object,label:Le.string,disabled:Le.bool};const eBe="_listcontainer_nqviu_52",tBe={listcontainer:eBe},nBe=({strategy:e,applications:t})=>{const n=Bt(),{parameters:r=[]}=e,o=s=>s.length>0?s.map(({name:a,type:l,description:c,required:u},d)=>i.jsxs(Or,{children:[i.jsx(te,{condition:u,show:i.jsx(Kw,{children:i.jsx(Rt,{title:"Required parameter",arrow:!0,children:i.jsx(Eo,{"aria-hidden":!1})})}),elseShow:i.jsx(Kw,{children:i.jsx(Rt,{title:"Optional parameter",arrow:!0,children:i.jsx(aee,{"aria-hidden":!1})})})}),i.jsx(un,{primary:i.jsxs("div",{children:[a," ",i.jsxs("small",{children:["(",l,")"]})]}),secondary:c})]},`${a}-${d}`)):i.jsx(Or,{children:"No params"});return i.jsx("div",{className:tBe.listcontainer,children:i.jsxs(Uo,{container:!0,children:[i.jsx(te,{condition:e.deprecated,show:i.jsx(Uo,{item:!0,children:i.jsx("h5",{style:{color:n.palette.error.main},children:"Deprecated"})})}),i.jsxs(Uo,{item:!0,sm:12,md:12,children:[i.jsx("h6",{children:"Parameters"}),i.jsx("hr",{}),i.jsx(Ri,{children:o(r)})]}),i.jsxs(Uo,{item:!0,sm:12,md:12,children:[i.jsxs("h6",{children:["Applications using this strategy"," ",t.length>=1e3&&"(Capped at 1000)"]}),i.jsx("hr",{}),i.jsx(cee,{apps:t})]})]})})},rBe=e=>{const t=pf(e.permission,e.projectId,e.environmentId);return i.jsx(uee,{...e,access:t})},oBe=e=>{const t=gg(e.permission,e.projectId,e.environmentId);return i.jsx(uee,{...e,access:t})},uee=({access:e,permission:t,projectId:n,children:r,environmentId:o,tooltipProps:s,disabled:a,...l})=>{const c=Yu();return i.jsx(ra,{...s,title:iy(e,s==null?void 0:s.title),arrow:!0,onClick:u=>u.preventDefault(),children:i.jsx("div",{id:c,children:i.jsx(Mt,{...l,disabled:!e||a,"aria-labelledby":c,size:l.size||"large",children:r})})})},Co=e=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?i.jsx(oBe,{...e,projectId:e.projectId,environmentId:e.environmentId}):i.jsx(rBe,{...e});var kA={},sBe=je;Object.defineProperty(kA,"__esModule",{value:!0});var oi=kA.default=void 0,iBe=sBe(Ee()),aBe=i,lBe=(0,iBe.default)((0,aBe.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),"Edit");oi=kA.default=lBe;const wo=e=>YE()[e],ar=e=>{const t=wo(e);if(!t)throw new Error(`Missing required path param: ${e}`);return t},cBe=()=>{const e=ar("name"),{strategies:t}=Of(),{applications:n}=iee(),r=$t(),o=t.find(a=>a.name===e),s=()=>{r(`/strategies/${e}/edit`)};return o?i.jsx(ir,{header:i.jsx($n,{title:o==null?void 0:o.name,subtitle:o==null?void 0:o.description,actions:i.jsx(te,{condition:o.editable,show:i.jsx(Co,{permission:i3,"data-loading":!0,onClick:s,tooltipProps:{title:"Edit strategy"},children:i.jsx(oi,{})})})}),children:i.jsx(Uo,{container:!0,children:i.jsx(Uo,{item:!0,xs:12,sm:12,children:i.jsx(nBe,{strategy:o,applications:n})})})}):null};var TA={},uBe=je;Object.defineProperty(TA,"__esModule",{value:!0});var dee=TA.default=void 0,dBe=uBe(Ee()),pBe=i,fBe=(0,dBe.default)((0,pBe.jsx)("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"}),"Extension");dee=TA.default=fBe;const hBe=v(K)(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",padding:e.spacing(0,1.5)})),gBe=v(pr)(({theme:e})=>({borderColor:e.palette.divider,height:e.spacing(3),margin:e.spacing(0,2)})),mBe=()=>i.jsx(gBe,{orientation:"vertical",variant:"middle"}),pee=({children:e})=>i.jsx(hBe,{children:e});pee.Divider=mBe;const Ku=pee;var RA={},yBe=je;Object.defineProperty(RA,"__esModule",{value:!0});var fee=RA.default=void 0,xBe=yBe(Ee()),vBe=i,bBe=(0,xBe.default)((0,vBe.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"}),"LocationOn");fee=RA.default=bBe;var AA={},CBe=je;Object.defineProperty(AA,"__esModule",{value:!0});var hee=AA.default=void 0,wBe=CBe(Ee()),SBe=i,jBe=(0,wBe.default)((0,SBe.jsx)("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"Code");hee=AA.default=jBe;const EBe=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:"M16.584 10H22a2 2 0 1 1 0 4h-5.416a5.001 5.001 0 0 1-9.168 0H2a2 2 0 1 1 0-4h5.416a5.001 5.001 0 0 1 9.168 0Z"})),Xl=e=>RBe[e]??e,kBe=e=>i.jsx(X2,{...e,component:t=>i.jsx(EBe,{...t}),inheritViewBox:!0}),TBe=e=>{switch(e){case"default":return x7;case"remoteAddress":return ER;case"flexibleRollout":return kBe;case"applicationHostname":return fee;case"releasePlanTemplate":return ty;default:return hee}},zqt=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress"],RBe={applicationHostname:"Hosts",default:"Standard",flexibleRollout:"Gradual rollout",gradualRolloutRandom:"Randomized",gradualRolloutSessionId:"Sessions",gradualRolloutUserId:"Users",remoteAddress:"IPs"},tm="api/admin/strategies",PA=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),o=g.useCallback(async u=>{const d=t(tm,{method:"POST",body:JSON.stringify(u)});return e(d.caller,d.id)},[t,e]),s=g.useCallback(async u=>{const d=`${tm}/${u.name}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},[t,e]),a=g.useCallback(async u=>{const d=`${tm}/${u.name}`,p=t(d,{method:"DELETE"});return e(p.caller,p.id)},[t,e]),l=g.useCallback(async u=>{const d=`${tm}/${u.name}/deprecate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]),c=g.useCallback(async u=>{const d=`${tm}/${u.name}/reactivate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]);return{createStrategy:o,updateStrategy:s,removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c,errors:n,loading:r}},Ds={date:(e,t,n,r)=>{var a,l;const o=new Date(((a=e==null?void 0:e.values)==null?void 0:a[n])||0),s=new Date(((l=t==null?void 0:t.values)==null?void 0:l[n])||0);return(s==null?void 0:s.getTime())-(o==null?void 0:o.getTime())},boolean:(e,t,n,r)=>{var a,l;const o=(a=e==null?void 0:e.values)==null?void 0:a[n],s=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===s?0:o?1:-1},alphanumeric:(e,t,n,r)=>{var a,l;const o=`${((a=e==null?void 0:e.values)==null?void 0:a[n])||""}`.toLowerCase(),s=`${((l=t==null?void 0:t.values)==null?void 0:l[n])||""}`.toLowerCase();return o==null?void 0:o.localeCompare(s)},playgroundResultState:(e,t,n,r)=>{var a,l;const o=(a=e==null?void 0:e.values)==null?void 0:a[n],s=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===s?0:o==="true"?1:s==="true"||o==="false"?-1:s==="false"?1:0},numericZeroLast:(e,t,n,r)=>{var a,l;const o=Number.parseInt(`${((a=e==null?void 0:e.values)==null?void 0:a[n])||0}`,10)||Number.MAX_SAFE_INTEGER,s=Number.parseInt(`${((l=t==null?void 0:t.values)==null?void 0:l[n])||0}`,10)||Number.MAX_SAFE_INTEGER;return o-s}},ABe=tt.forwardRef((e,t)=>{const n=gg(e.permission,e.projectId,e.environmentId);return i.jsx(gee,{...e,access:n,ref:t})}),PBe=tt.forwardRef((e,t)=>{const n=pf(e.permission,e.projectId,e.environmentId);return i.jsx(gee,{...e,access:n,ref:t})}),gee=tt.forwardRef((e,t)=>{const{access:n,permission:r,tooltip:o,disabled:s,projectId:a,environmentId:l,checked:c,onChange:u,...d}=e;return i.jsx(ra,{title:iy(n,o),arrow:!0,variant:"custom",children:i.jsx("span",{"data-loading":!0,children:i.jsx(oa,{"data-testid":"toggle-switch",onChange:u,disabled:s||!n,checked:c,ref:t,...d})})})}),_Be=tt.forwardRef((e,t)=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?i.jsx(ABe,{...e,projectId:e.projectId,environmentId:e.environmentId,ref:t}):i.jsx(PBe,{...e,ref:t})),IBe=({deprecated:e,disabled:t,onToggle:n})=>{const r=()=>{n(e)},o=Yu(),s=pf(i3),a=g.useMemo(()=>s?t?"You cannot disable default strategy":e?"Excluded from strategy list":"Included in strategy list":"",[e,t,s]);return i.jsx(Rt,{title:a,describeChild:!0,arrow:!0,children:i.jsx("div",{id:o,children:i.jsx(_Be,{checked:!e,permission:i3,onClick:r,disabled:t,inputProps:{"aria-labelledby":o}})})})},OBe=({strategy:e,onClick:t})=>{const n=Yu();return i.jsx(te,{condition:e==null?void 0:e.editable,show:i.jsx(Co,{onClick:t,permission:i3,tooltipProps:{title:"Edit strategy"},children:i.jsx(oi,{})}),elseShow:i.jsx(Rt,{title:"You cannot edit a built-in strategy",arrow:!0,children:i.jsx("div",{id:n,children:i.jsx(Mt,{disabled:!0,size:"large",children:i.jsx(oi,{"aria-labelledby":n})})})})})};var _A={},MBe=je;Object.defineProperty(_A,"__esModule",{value:!0});var So=_A.default=void 0,$Be=MBe(Ee()),DBe=i,LBe=(0,$Be.default)((0,DBe.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");So=_A.default=LBe;const NBe=({strategy:e,onClick:t})=>{const n=Yu();return i.jsx(te,{condition:e==null?void 0:e.editable,show:i.jsx(Co,{onClick:t,permission:aOe,tooltipProps:{title:"Delete strategy"},children:i.jsx(So,{})}),elseShow:i.jsx(Rt,{title:"You cannot delete a built-in strategy",arrow:!0,children:i.jsx("div",{id:n,children:i.jsx(Mt,{disabled:!0,size:"large",children:i.jsx(So,{"aria-labelledby":n})})})})})};var IA={},FBe=je;Object.defineProperty(IA,"__esModule",{value:!0});var Y4=IA.default=void 0,BBe=FBe(Ee()),zBe=i,HBe=(0,BBe.default)((0,zBe.jsx)("path",{d:"M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"}),"HelpOutline");Y4=IA.default=HBe;const DN=v("span")(({theme:e,size:t})=>({display:"inline-grid",alignItems:"center",outline:0,cursor:"pointer","&:is(:focus-visible, :active) > *, &:hover > *":{outlineStyle:"solid",outlineWidth:2,outlineOffset:0,outlineColor:e.palette.primary.main,borderRadius:"100%",color:e.palette.primary.main},"& svg":{fontSize:t||e.fontSizes.mainHeader,color:e.palette.action.active,marginLeft:e.spacing(.5)}})),Zo=({tooltip:e,htmlTooltip:t,tooltipId:n,placement:r,children:o,size:s,...a})=>{if(t){const{htmlTooltipMaxWidth:l}=a;return i.jsx(wr,{id:n,title:e,placement:r,arrow:!0,maxWidth:l,children:i.jsx(DN,{size:s,tabIndex:0,"aria-label":"Help",children:o??i.jsx(Y4,{})})})}return i.jsx(Rt,{title:e,placement:r,arrow:!0,id:n,children:i.jsx(DN,{size:s,tabIndex:0,"aria-label":"Help",children:o??i.jsx(Y4,{})})})},LN=({children:e})=>i.jsx(J,{component:"span",variant:"body2",sx:t=>({marginBottom:t.spacing(2)}),children:e}),mee=({alert:e})=>{const t=i.jsxs(i.Fragment,{children:[i.jsxs(LN,{children:["If you decide to create a custom strategy be aware of the following:",i.jsxs("ul",{children:[i.jsx("li",{children:"They require writing custom code and deployments for each SDK you’re using."}),i.jsx("li",{children:"Differing implementation in each SDK will cause toggles to evaluate differently"}),i.jsx("li",{children:"Custom strategies require a lot of configuration in both Unleash admin UI and the SDK."})]})]}),i.jsx(LN,{children:"Constraints don’t have these problems. They’re configured once in the admin UI and behave in the same way in each SDK without further configuration."})]});return e?i.jsx(Dt,{severity:"info",sx:n=>({marginBottom:n.spacing(3)}),children:t}):i.jsx(K,{sx:n=>({maxWidth:"720px",padding:n.spacing(4,2),margin:"0 auto"}),children:t})},WBe=()=>{const e=Nn("(max-width:700px)"),t=$t();return i.jsx(te,{condition:e,show:i.jsx(Co,{"data-testid":qL,onClick:()=>t("/strategies/create"),permission:V4,size:"large",tooltipProps:{title:"New custom strategy"},children:i.jsx(Eo,{})}),elseShow:i.jsx(lo,{onClick:()=>t("/strategies/create"),color:"primary",permission:V4,"data-testid":qL,children:"New custom strategy"})})},VBe=v(an)(({theme:e})=>({marginLeft:e.spacing(1),display:"inline-block"})),UBe=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.mainHeader,width:"100%"})),NN=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(2),"& > span":{fontWeight:e.fontWeight.bold}})),FN=({title:e,description:t,link:n})=>i.jsxs(UBe,{children:[e,i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body2",component:"p",sx:{mb:1},children:t}),i.jsx(Sn,{href:n,target:"_blank",rel:"noopener noreferrer",variant:"body2",children:"Read more in the documentation"})]})})]}),GBe=()=>i.jsxs(Dt,{severity:"info",sx:{mb:2},children:["We recommend using gradual rollout. You can customize it with"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"constraints"})," ","and"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/activation-strategies#variants",target:"_blank",rel:"noopener noreferrer",children:"variants"}),"."]}),qBe=()=>{const e=$t(),[t,n]=g.useState({show:!1,title:"",onConfirm:()=>{}}),{strategies:r,refetchStrategies:o,loading:s}=Of(),{removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c}=PA(),{setToastData:u,setToastApiError:d}=_t();nd("Strategy types");const p=g.useMemo(()=>{if(s){const N=Array(5).fill({name:"Context name",description:"Context description when loading"});return{all:N,standard:N,advanced:N,custom:N}}const B=r.map(({name:N,description:I,editable:q,deprecated:ne,advanced:V})=>({name:N,description:I,editable:q,deprecated:ne,advanced:V})),H=B.filter(N=>!N.editable);return{all:B,standard:H.filter(N=>!N.advanced),advanced:H.filter(N=>N.advanced),custom:B.filter(N=>N.editable)}},[r,s]),f=g.useCallback(B=>H=>{n(H?{show:!0,title:"Really reactivate strategy?",onConfirm:async()=>{try{await c(B),o(),u({type:"success",text:"Strategy reactivated"})}catch(N){d(pt(N))}}}:{show:!0,title:"Really deprecate strategy?",onConfirm:async()=>{try{await l(B),o(),u({type:"success",text:"Strategy deprecated"})}catch(N){d(pt(N))}}})},[l,c,o,d,u]),h=g.useCallback(B=>{n({show:!0,title:"Really delete strategy?",onConfirm:async()=>{try{await a(B),o(),u({type:"success",text:"Strategy deleted"})}catch(H){d(pt(H))}}})},[a,o,d,u]),m=g.useCallback(B=>{e(`/strategies/${B.name}/edit`)},[e]),y=g.useMemo(()=>[{id:"Icon",Cell:()=>i.jsx(K,{"data-loading":!0,sx:{pl:3,pr:1,display:"flex",alignItems:"center"},children:i.jsx(dee,{color:"disabled"})})},{id:"Name",Header:"Name",accessor:B=>Xl(B.name),width:"90%",Cell:({row:{original:{name:B,description:H,deprecated:N}}})=>i.jsx(Yl,{"data-loading":!0,title:Xl(B),subtitle:H,to:`/strategies/${B}`,children:i.jsx(te,{condition:N,show:()=>i.jsx(VBe,{color:"disabled",children:"Disabled"})})}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>i.jsxs(Ku,{children:[i.jsx(IBe,{deprecated:B.deprecated,onToggle:f(B)}),i.jsx(te,{condition:B.editable,show:i.jsxs(i.Fragment,{children:[i.jsx(Ku.Divider,{}),i.jsx(OBe,{strategy:B,onClick:()=>m(B)}),i.jsx(NBe,{strategy:B,onClick:()=>h(B)})]})})]}),width:150,minWidth:120,disableSortBy:!0},{accessor:"description",disableSortBy:!0},{accessor:"sortOrder",sortType:"number"}],[f,m,h]),b=g.useMemo(()=>({sortBy:[{id:"Name",desc:!1}],hiddenColumns:["description","sortOrder"]}),[]),{getTableProps:x,getTableBodyProps:C,headerGroups:w,rows:j,prepareRow:k}=on.useTable({columns:y,data:p.standard,initialState:b,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},on.useSortBy),{getTableProps:S,getTableBodyProps:E,headerGroups:T,rows:R,prepareRow:_}=on.useTable({columns:y,data:p.advanced,initialState:b,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},on.useSortBy),{getTableProps:M,getTableBodyProps:$,headerGroups:z,rows:A,prepareRow:O}=on.useTable({columns:y,data:p.custom,initialState:b,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},on.useSortBy),L=()=>{t==null||t.onConfirm(),n(B=>({...B,show:!1}))};return i.jsxs(i.Fragment,{children:[i.jsxs(ir,{isLoading:s,header:i.jsx($n,{titleElement:i.jsx(FN,{title:"Standard strategies",description:"Standard strategies let you enable a feature only for a specified audience. Select a starting setup, then customize your strategy with targeting and variants.",link:"https://docs.getunleash.io/concepts/activation-strategies"})}),children:[i.jsxs(K,{children:[i.jsx(GBe,{}),i.jsxs(ja,{...x(),children:[i.jsx(Sa,{headerGroups:w}),i.jsx(Ji,{...C(),children:j.map(B=>{k(B);const{key:H,...N}=B.getRowProps();return i.jsx(ti,{hover:!0,...N,children:B.cells.map(I=>{const{key:q,...ne}=I.getCellProps();return i.jsx(Ci,{...ne,children:I.render("Cell")},q)})},H)})})]}),i.jsx(te,{condition:j.length===0,show:i.jsx(Gr,{children:"No strategies available."})})]}),i.jsx(Mn,{open:t.show,onClick:L,title:t==null?void 0:t.title,onClose:()=>n(B=>({...B,show:!1}))})]}),i.jsxs(ir,{isLoading:s,header:i.jsx($n,{titleElement:i.jsx(FN,{title:"Advanced and custom strategies",description:"Advanced strategies let you target based on specific properties. Custom activation strategies let you define your own activation strategies to use with Unleash.",link:"https://docs.getunleash.io/concepts/activation-strategies#custom-strategies"})}),sx:{mt:2},children:[i.jsxs(K,{children:[i.jsx(NN,{children:i.jsx("span",{children:"Advanced strategies"})}),i.jsxs(ja,{...S(),children:[i.jsx(Sa,{headerGroups:T}),i.jsx(Ji,{...E(),children:R.map(B=>{_(B);const{key:H,...N}=B.getRowProps();return i.jsx(ti,{hover:!0,...N,children:B.cells.map(I=>{const{key:q,...ne}=I.getCellProps();return i.jsx(Ci,{...ne,children:I.render("Cell")},q)})},H)})})]}),i.jsx(te,{condition:R.length===0,show:i.jsx(Gr,{children:"No advanced strategies available."})})]}),i.jsxs(K,{children:[i.jsxs(NN,{sx:{mt:4},children:[i.jsx("span",{children:"Custom strategies"}),i.jsx(WBe,{})]}),i.jsxs(ja,{...M(),children:[i.jsx(Sa,{headerGroups:z}),i.jsx(Ji,{...$(),children:A.map(B=>{O(B);const{key:H,...N}=B.getRowProps();return i.jsx(ti,{hover:!0,...N,children:B.cells.map(I=>{const{key:q,...ne}=I.getCellProps();return i.jsx(Ci,{...ne,children:I.render("Cell")},q)})},H)})})]}),i.jsx(te,{condition:A.length===0,show:i.jsx(mee,{})})]}),i.jsx(Mn,{open:t.show,onClick:L,title:t==null?void 0:t.title,onClose:()=>n(B=>({...B,show:!1}))})]})]})};var OA={},YBe=je;Object.defineProperty(OA,"__esModule",{value:!0});var yee=OA.default=void 0,KBe=YBe(Ee()),XBe=i,JBe=(0,KBe.default)((0,XBe.jsx)("path",{d:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"}),"Label");yee=OA.default=JBe;const b7=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{createTag:async c=>{const d=t("api/admin/tag-types",{method:"POST",body:JSON.stringify(c)});return e(d.caller,d.id)},validateTagName:async c=>{const d=t("api/admin/tag-types/validate",{method:"POST",body:JSON.stringify({name:c})});return e(d.caller,d.id)},updateTagType:async(c,u)=>{const d=`api/admin/tag-types/${c}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},deleteTagType:async c=>{const u=`api/admin/tag-types/${c}`,d=t(u,{method:"DELETE"});return e(d.caller,d.id)},errors:n,loading:r}},ZBe=(e={})=>{const t=async()=>{const c=yt("api/admin/tag-types");return(await fetch(c,{method:"GET"}).then(en("Tag types"))).json()},n="api/admin/tag-types",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=()=>{Fo(n)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{tagTypes:(r==null?void 0:r.tagTypes)||[],error:o,loading:s,refetch:l}},QBe=()=>{const e=$t(),t=Nn("(max-width:700px)");return i.jsx(te,{condition:t,show:i.jsx(Co,{onClick:()=>e("/tag-types/create"),size:"large",permission:SS,children:i.jsx(Eo,{})}),elseShow:i.jsx(lo,{permission:SS,onClick:()=>e("/tag-types/create"),children:"New tag type"})})},eze=v("div")(({theme:e,$color:t})=>({width:"12px",height:"12px",borderRadius:"50%",backgroundColor:t,marginRight:e.spacing(.2),marginLeft:e.spacing(1.5),border:t==="#FFFFFF"?`1px solid ${e.palette.divider}`:`1px solid ${t}`})),tze=()=>{const[e,t]=g.useState({open:!1}),n=$t(),{deleteTagType:r}=b7(),{tagTypes:o,refetch:s,loading:a}=ZBe(),{setToastData:l,setToastApiError:c}=_t(),u=g.useMemo(()=>a?Array(5).fill({name:"Tag type name",description:"Tag type description when loading"}):o.map(({name:j,description:k,color:S})=>({name:j,description:k,color:S})),[o,a]),d=g.useMemo(()=>[{id:"Icon",Cell:()=>i.jsx(K,{"data-loading":!0,sx:{pl:2,pr:1,display:"flex",alignItems:"center"},children:i.jsx(yee,{color:"disabled"})}),disableGlobalFilter:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:j,description:k,color:S}}})=>i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(te,{condition:!!S,show:i.jsx(eze,{$color:S})}),i.jsx(Yl,{"data-loading":!0,title:j,subtitle:k})]}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:j}})=>i.jsxs(K,{sx:{display:"flex",justifyContent:"flex-end"},"data-loading":!0,children:[i.jsx(Co,{onClick:()=>n(`/tag-types/edit/${j.name}`),permission:dQ,tooltipProps:{title:"Edit tag type"},children:i.jsx(oi,{})}),i.jsx(Co,{permission:dOe,tooltipProps:{title:"Delete tag type"},onClick:()=>t({open:!0,name:j.name}),children:i.jsx(So,{})})]}),width:150,disableGlobalFilter:!0,disableSortBy:!0},{accessor:"description",disableSortBy:!0}],[n]),p=g.useMemo(()=>({sortBy:[{id:"name",desc:!1}],hiddenColumns:["description"]}),[]),{getTableProps:f,getTableBodyProps:h,headerGroups:m,rows:y,prepareRow:b,state:{globalFilter:x},setGlobalFilter:C}=on.useTable({columns:d,data:u,initialState:p,sortTypes:Ds,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},on.useGlobalFilter,on.useSortBy),w=async()=>{try{e.name&&(await r(e.name),s(),t({open:!1}),l({type:"success",show:!0,text:"Tag type deleted"}))}catch(j){c(pt(j))}};return i.jsxs(ir,{isLoading:a,header:i.jsx($n,{title:`Tag types (${y.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:x,onChange:C}),i.jsx($n.Divider,{}),i.jsx(QBe,{})]})}),children:[i.jsx(Ai,{value:x,children:i.jsxs(ja,{...f(),children:[i.jsx(Sa,{headerGroups:m}),i.jsx(Ji,{...h(),children:y.map(j=>{b(j);const{key:k,...S}=j.getRowProps();return i.jsx(ti,{hover:!0,...S,children:j.cells.map(E=>{const{key:T,...R}=E.getCellProps();return i.jsx(Ci,{...R,children:E.render("Cell")},T)})},k)})})]})}),i.jsx(te,{condition:y.length===0,show:i.jsx(te,{condition:(x==null?void 0:x.length)>0,show:i.jsxs(Gr,{children:["No tags found matching “",x,"”"]}),elseShow:i.jsx(Gr,{children:"No tags available. Get started by adding one."})})}),i.jsx(Mn,{title:"Really delete Tag type?",open:e.open,onClick:w,onClose:()=>{t({open:!1})}})]})},uy=(e={})=>{const t=async()=>{const c=yt("api/admin/addons");return(await fetch(c,{method:"GET"}).then(en("Addons"))).json()},n="api/admin/addons",{data:r,error:o}=On(n,t,e),[s,a]=g.useState(!o&&!r),l=g.useCallback(()=>{Fo(n)},[n]);return g.useEffect(()=>{a(!o&&!r)},[r,o]),{addons:(r==null?void 0:r.addons)||[],providers:(r==null?void 0:r.providers)||[],error:o,loading:s,refetchAddons:l}};var MA={},nze=je;Object.defineProperty(MA,"__esModule",{value:!0});var xee=MA.default=void 0,rze=nze(Ee()),oze=i,sze=(0,rze.default)((0,oze.jsx)("path",{d:"m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}),"DeviceHub");xee=MA.default=sze;const K4=e=>e.charAt(0).toUpperCase()+e.slice(1),ize="/static/datadog-D7T0xtkO.svg",aze="/static/new-relic-BupjBFL1.svg",lze="/static/jira-l0bo9uCD.svg",cze="/static/jira-comment-Di5ugPYV.svg",uze="/static/signals-CAlQRJwW.svg",dze="/static/terraform-Eb_8o2u1.svg",BN="/static/slack-t0fNwPed.svg",pze="/static/teams-DvQx_FzB.svg",fze="/static/webhooks-Cnts0gfu.svg",hze="/static/unleash-integration-Ctxqm5Ve.svg",gze="/static/Logo-android-C52ktdfV.svg",mze="/static/Logo-net-BsbSafnp.svg",yze="/static/Logo-flutter-B4Npq361.svg",xze="/static/Logo-go-DsgFcp5h.svg",vze="/static/Logo-swift-B2XvejNd.svg",bze="/static/Logo-java-DnZJK2S1.svg",Cze="/static/Logo-javascript-Uv1If6qs.svg",wze="/static/Logo-node-CHfuizy_.svg",Sze="/static/Logo-php-Bn8RVcvR.svg",jze="/static/Logo-python-D_jhkoJJ.svg",Eze="/static/Logo-react-D2SuVol5.svg",kze="/static/Logo-ruby-BlkEeyzc.svg",Tze="/static/Logo-rust-DZ1V0dgh.svg",Rze="/static/Logo-svelte-B-fbfLhe.svg",Aze="/static/Logo-vue-Bc1zMJ6g.svg",V9=v(N5)(({theme:e})=>({background:"transparent",marginRight:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(4),height:e.spacing(4),fontSize:"28px"})),Pze={datadog:{title:"Datadog",icon:ize},"new-relic":{title:"New Relic",icon:aze},jira:{title:"Jira",icon:lze},"jira-comment":{title:"Jira",icon:cze},signals:{title:"Signals",icon:uze},terraform:{title:"Terraform",icon:dze},slack:{title:"Slack",icon:BN},"slack-app":{title:"Slack",icon:BN},teams:{title:"Teams",icon:pze},webhook:{title:"Webhook",icon:fze},unleash:{title:"Unleash",icon:hze},android:{title:"Android",icon:gze},dotnet:{title:"Dotnet",icon:mze},flutter:{title:"Flutter",icon:yze},go:{title:"Go",icon:xze},swift:{title:"Swift",icon:vze},java:{title:"Java",icon:bze},javascript:{title:"Javascript",icon:Cze},node:{title:"Node",icon:wze},php:{title:"PHP",icon:Sze},python:{title:"Python",icon:jze},react:{title:"React",icon:Eze},ruby:{title:"Ruby",icon:kze},rust:{title:"Rust",icon:Tze},svelte:{title:"Svelte",icon:Rze},vue:{title:"Vue",icon:Aze}},vee=({name:e})=>{const t=Pze[e];return t?typeof t.icon=="string"?i.jsx(V9,{src:Do(t.icon),alt:`${K4(t.title)} icon`,variant:"rounded"}):i.jsx(V9,{alt:`${K4(t.title)} icon`,variant:"rounded",children:t.icon}):i.jsx(V9,{variant:"rounded",children:i.jsx(xee,{})})};var $A={},_ze=je;Object.defineProperty($A,"__esModule",{value:!0});var DA=$A.default=void 0,Ize=_ze(Ee()),Oze=i,Mze=(0,Ize.default)((0,Oze.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");DA=$A.default=Mze;var LA={},$ze=je;Object.defineProperty(LA,"__esModule",{value:!0});var Mf=LA.default=void 0,Dze=$ze(Ee()),Lze=i,Nze=(0,Dze.default)((0,Lze.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreVert");Mf=LA.default=Nze;const NA=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),o="api/admin/addons",s=async c=>{const d=t(o,{method:"POST",body:JSON.stringify(c)});return e(d.caller,d.id)},a=async c=>{const u=`${o}/${c}`,d=t(u,{method:"DELETE"});return e(d.caller,d.id)},l=g.useCallback(async c=>{const u=`${o}/${c.id}`,d=t(u,{method:"PUT",body:JSON.stringify(c)});return e(d.caller,d.id)},[t,e]);return{createAddon:s,updateAddon:l,removeAddon:a,errors:n,loading:r}};var FA={},Fze=je;Object.defineProperty(FA,"__esModule",{value:!0});var dy=FA.default=void 0,Bze=Fze(Ee()),zze=i,Hze=(0,Bze.default)((0,zze.jsx)("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"Visibility");dy=FA.default=Hze;const Kd=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:s})=>{const{hasAccess:a}=g.useContext(Bo);let l;return t&&r?l=a(e,t,r):t?l=a(e,t):l=a(e),i.jsx(ra,{...s,title:iy(l,o),children:n({hasAccess:l})})},zN=250,bee=v("div")(({theme:e})=>({position:"absolute",top:0,right:0,bottom:0,height:"100vh",maxWidth:"98vw",overflow:"auto",boxShadow:"0 0 1rem rgba(0, 0, 0, 0.25)",background:e.palette.background.paper})),Wze=v(bee)({width:1300}),Vze=v(Mt)(({theme:e})=>({zIndex:1,position:"absolute",top:e.spacing(3),right:e.spacing(3)})),BA=({open:e,onClose:t,onClick:n,label:r,children:o})=>i.jsx(Hg,{open:e,onClose:t,onClick:n,closeAfterTransition:!0,"aria-label":r,BackdropComponent:F5,BackdropProps:{timeout:zN},"data-testid":Vje,sx:{minHeight:"100vh"},children:i.jsx(zg,{timeout:zN,in:e,children:o})}),hl=e=>i.jsx(BA,{...e,children:i.jsx(Wze,{children:e.children})}),Hqt=e=>i.jsx(BA,{...e,children:i.jsxs(bee,{children:[i.jsx(Rt,{title:"Close",arrow:!0,describeChild:!0,children:i.jsx(Vze,{onClick:e.onClose,children:i.jsx(bo,{})})}),e.children]})}),Uze=()=>{},Gze=Uze(),PS=Object,HN=e=>e===Gze,qze=e=>typeof e=="function",Lx=new WeakMap,Yze=e=>PS.prototype.toString.call(e),U9=(e,t)=>e===`[object ${t}]`;let Kze=0;const _S=e=>{const t=typeof e,n=Yze(e),r=U9(n,"Date"),o=U9(n,"RegExp"),s=U9(n,"Object");let a,l;if(PS(e)===e&&!r&&!o){if(a=Lx.get(e),a)return a;if(a=++Kze+"~",Lx.set(e,a),Array.isArray(e)){for(a="@",l=0;l<e.length;l++)a+=_S(e[l])+",";Lx.set(e,a)}if(s){a="#";const c=PS.keys(e).sort();for(;!HN(l=c.pop());)HN(e[l])||(a+=l+":"+_S(e[l])+",");Lx.set(e,a)}}else a=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return a},Xze=e=>{if(qze(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?_S(e):"",[e,t]},Jze=e=>Xze(e?e(0,null):null)[0],G9=Promise.resolve(),Zze=e=>(t,n,r)=>{const o=g.useRef(!1),{cache:s,initialSize:a=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:p=!1}=r,[,,,f]=_c.get(q5);let h;try{h=Jze(t),h&&(h=EJ+h)}catch{}const[m,y,b]=Id(s,h),x=g.useCallback(()=>En(m()._l)?a:m()._l,[s,h,a]);tS.useSyncExternalStore(g.useCallback(T=>h?b(h,()=>{T()}):()=>{},[s,h]),x,x);const C=g.useCallback(()=>{const T=m()._l;return En(T)?a:T},[h,a]),w=g.useRef(C());t2(()=>{if(!o.current){o.current=!0;return}h&&y({_l:c?w.current:C()})},[h,s]);const j=d&&!o.current,k=e(h,async T=>{const R=m()._i,_=m()._r;y({_r:is});const M=[],$=C(),[z]=Id(s,T),A=z().data,O=[];let L=null;for(let B=0;B<$;++B){const[H,N]=s3(t(B,p?null:L));if(!H)break;const[I,q]=Id(s,H);let ne=I().data;const V=l||R||En(ne)||u&&!B&&!En(A)||j||A&&!En(A[B])&&!r.compare(A[B],ne);if(n&&(typeof _=="function"?_(ne,N):V)){const oe=async()=>{if(!(H in f))ne=await n(N);else{const ae=f[H];delete f[H],ne=await ae}q({data:ne,_k:N}),M[B]=ne};p?O.push(oe):await oe()}else M[B]=ne;p||(L=ne)}return p&&await Promise.all(O.map(B=>B())),y({_i:is}),M},r),S=g.useCallback(function(T,R){const _=typeof R=="boolean"?{revalidate:R}:R||{},M=_.revalidate!==!1;return h?(M&&(En(T)?y({_i:!0,_r:_.revalidate}):y({_i:!1,_r:_.revalidate})),arguments.length?k.mutate(T,{..._,revalidate:M}):k.mutate()):G9},[h,s]),E=g.useCallback(T=>{if(!h)return G9;const[,R]=Id(s,h);let _;if(Ja(T)?_=T(C()):typeof T=="number"&&(_=T),typeof _!="number")return G9;R({_l:_}),w.current=_;const M=[],[$]=Id(s,h);let z=null;for(let A=0;A<_;++A){const[O]=s3(t(A,z)),[L]=Id(s,O),B=O?L().data:is;if(En(B))return S($().data);M.push(B),z=B}return S(M)},[h,s,S,C]);return{size:C(),setSize:E,mutate:S,get data(){return k.data},get error(){return k.error},get isValidating(){return k.isValidating},get isLoading(){return k.isLoading}}},Cee=AJ(On,Zze),Qze=async e=>{const t=await fetch(e);return await en("Integration events")(t),t.json()},wee=(e,t=50,n={})=>{var b;const{isAdmin:r}=g.useContext(Bo),o=(x,C)=>!e||!r||C&&!C.integrationEvents.length?null:yt(`api/admin/addons/${e}/events?limit=${t}&offset=${x*t}`),{data:s,error:a,size:l,setSize:c,mutate:u}=Cee(o,Qze,{...n,revalidateAll:!0}),d=s?s.flatMap(({integrationEvents:x})=>x):[],p=!s&&!a,f=l>0&&!(s!=null&&s[l-1]),h=p||f,m=((b=s==null?void 0:s[l-1])==null?void 0:b.integrationEvents.length)===t;return{integrationEvents:d,hasMore:m,loadMore:()=>{h||!m||c(l+1)},loading:h,refetch:()=>u(),error:a}},eHe=v("div")(({theme:e})=>({backgroundColor:e.palette.codebox,padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium,position:"relative",maxHeight:"500px",overflow:"auto"})),tHe=v("pre")(({theme:e})=>({margin:0,wordBreak:"break-all",whiteSpace:"pre-wrap",color:e.palette.common.white,fontSize:e.fontSizes.smallBody})),nHe=({text:e})=>i.jsx(eHe,{children:i.jsx(tHe,{children:e})});var zA={},rHe=je;Object.defineProperty(zA,"__esModule",{value:!0});var $f=zA.default=void 0,oHe=rHe(Ee()),sHe=i,iHe=(0,oHe.default)((0,sHe.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");$f=zA.default=iHe;var HA={},aHe=je;Object.defineProperty(HA,"__esModule",{value:!0});var See=HA.default=void 0,lHe=aHe(Ee()),cHe=i,uHe=(0,lHe.default)((0,cHe.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}),"Info");See=HA.default=uHe;const dHe="/static/unleashLogoIconDarkAlpha-BbvuC13D.gif",pHe=v("div",{shouldForwardProp:e=>e!=="type"})(({theme:e,type:t})=>({display:"flex",justifyContent:"center",alignItems:"center",height:t==="fullscreen"?"100vh":"100%",backgroundColor:e.palette.background.paper})),fHe=v("img")(({theme:e})=>({width:"100px",height:"100px"})),X4=({type:e="inline"})=>i.jsx(pHe,{role:"alert","aria-label":"Loading",type:e,children:i.jsx(fHe,{src:Do(dHe),alt:""})});var hHe=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},gHe=hHe,WN={"text/plain":"Text","text/html":"Url",default:"Text"},mHe="Copy to clipboard: #{key}, Enter";function yHe(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function xHe(e,t){var n,r,o,s,a,l,c=!1;t||(t={}),n=t.debug||!1;try{o=gHe(),s=document.createRange(),a=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(d){if(d.stopPropagation(),t.format)if(d.preventDefault(),typeof d.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var p=WN[t.format]||WN.default;window.clipboardData.setData(p,e)}else d.clipboardData.clearData(),d.clipboardData.setData(t.format,e);t.onCopy&&(d.preventDefault(),t.onCopy(d.clipboardData))}),document.body.appendChild(l),s.selectNodeContents(l),a.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(d){n&&console.error("unable to copy using execCommand: ",d),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(p){n&&console.error("unable to copy using clipboardData: ",p),n&&console.error("falling back to prompt"),r=yHe("message"in t?t.message:mHe),window.prompt(r,e)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(s):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return c}var vHe=xHe;const C7=ls(vHe),bHe=e=>g.createElement("svg",{width:48,height:50,viewBox:"0 0 48 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M0.5 0.000193412C11 2.00019 17 9 18 18C19 27 23.5 31.5 30.5 34C37.5 36.5 47.34 41.4 48 49.5L48 12.0012C48 5.37332 42.6309 0.000381623 36.003 0.000366343C24.1359 0.000338986 8.66406 -0.000263908 0.5 0.000193412Z",fill:"#6C65E5"})),jee=36,CHe=100-jee,Eee=`${jee}%`,wHe="420px",SHe=`${CHe}%`,jHe=v("section",{shouldForwardProp:e=>!["modal","compact"].includes(e.toString())})(({theme:e,modal:t,compact:n})=>({minHeight:t?"100vh":n?"unset":"80vh",borderRadius:t?0:e.spacing(2),width:"100%",display:"flex",margin:"0 auto",overflow:t||n?"unset":"hidden",[e.breakpoints.down(1100)]:{flexDirection:"column",minHeight:0}})),EHe=v("div",{shouldForwardProp:e=>!["guidanceHeight"].includes(e.toString())})(({theme:e,guidanceHeight:t})=>({...Q9e,...t?{aside:{height:t}}:{}})),kHe=v("div",{shouldForwardProp:e=>e!=="useFixedSidebar"})(({theme:e,useFixedSidebar:t})=>({display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,width:t?"initial":SHe,[e.breakpoints.down(1100)]:{width:"100%"}})),THe=v("div",{shouldForwardProp:e=>!["disablePadding","compactPadding"].includes(e.toString())})(({theme:e,disablePadding:t,compactPadding:n})=>{const r=t?0:n?e.spacing(4):e.spacing(6),o=t?0:e.spacing(4),s=t?0:e.spacing(2),a=t?0:e.spacing(4);return{"--form-content-padding":r,backgroundColor:e.palette.background.paper,display:"flex",flexDirection:"column",flexGrow:1,padding:r,[e.breakpoints.down("lg")]:{padding:o,"--form-content-padding":o},[e.breakpoints.down(1100)]:{width:"100%"},[e.breakpoints.down(500)]:{paddingInline:s,paddingBlock:a,"--form-content-padding":s}}}),RHe=v("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(4,6),[e.breakpoints.down("lg")]:{padding:e.spacing(4)},[e.breakpoints.down(500)]:{padding:e.spacing(4,2)}})),AHe=v("h1")(({theme:e})=>({marginBottom:e.fontSizes.mainHeader,fontWeight:"normal"})),PHe=v(pr)(({theme:e})=>({opacity:.3,marginBottom:e.spacing(.5)})),_He=v("h2")(({theme:e})=>({color:e.palette.common.white,marginBottom:e.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.bodySize})),IHe=v($f)(({theme:e})=>({fill:e.palette.primary.contrastText})),OHe=v("div")(()=>({zIndex:1,position:"absolute",right:-3,top:-3})),MHe=v(bHe)(()=>({width:"75px",height:"75px"})),$He=v(Mt)(()=>({position:"absolute",zIndex:400,right:0})),DHe=v(See)(({theme:e})=>({fill:e.palette.primary.contrastText})),kee=v("aside",{shouldForwardProp:e=>!["sidebarWidth","fixedCodeHeight"].includes(e.toString())})(({theme:e,sidebarWidth:t,fixedCodeHeight:n})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(4),flexGrow:0,flexShrink:0,width:t||Eee,[e.breakpoints.down(1100)]:{width:"100%"},[e.breakpoints.down(500)]:{padding:e.spacing(4,2)},...n?{pre:{height:n}}:{}})),LHe=v("article")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2),alignItems:"center",zIndex:1,color:e.palette.common.white,position:"relative",marginBlockEnd:e.spacing(3)})),NHe=v("div")(()=>({width:"100%"})),FHe=v("div")(({theme:e})=>({margin:e.spacing(3,0),display:"flex",alignItems:"center",width:"100%"})),BHe=v(X5)(({theme:e})=>({marginRight:e.spacing(1),color:e.palette.primary.contrastText})),zHe=v("a")(({theme:e})=>({color:e.palette.primary.contrastText,display:"block","&:hover":{textDecoration:"none"}})),eo=({title:e,description:t,children:n,documentationLink:r,documentationIcon:o,documentationLinkLabel:s,loading:a,modal:l,formatApiCode:c,disablePadding:u,compactPadding:d=!1,showDescription:p=!0,showLink:f=!0,footer:h,compact:m,showGuidance:y=!0,useFixedSidebar:b,sidebarWidth:x})=>{const{setToastData:C}=_t(),w=Nn("(max-width:1099px)"),j=()=>{c!==void 0&&(C7(c())?C({text:"Command copied",autoHideDuration:6e3,type:"success",show:!0}):C({text:"Could not copy the command",autoHideDuration:6e3,type:"error",show:!0}))},k=(E,T=!1)=>{if(!E)return i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!T,show:i.jsx(PHe,{})}),i.jsxs(_He,{children:["API Command"," ",i.jsx(Rt,{title:"Copy command",arrow:!0,children:i.jsx(Mt,{onClick:j,size:"large",children:i.jsx(IHe,{})})})]}),i.jsx(nHe,{text:c()})," "]})},S=b?WHe:Ree;return i.jsxs(jHe,{modal:l,compact:m,children:[i.jsx(te,{condition:y&&w,show:i.jsx(EHe,{guidanceHeight:b?"240px":void 0,children:i.jsx(HHe,{description:t,documentationIcon:o,documentationLink:r,documentationLinkLabel:s})})}),i.jsxs(kHe,{useFixedSidebar:b,children:[i.jsx(THe,{disablePadding:u,compactPadding:d,children:i.jsx(te,{condition:a||!1,show:i.jsx(X4,{}),elseShow:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:e!==void 0,show:i.jsx(AHe,{children:e})}),n]})})}),i.jsx(te,{condition:h!==void 0,show:()=>i.jsxs(i.Fragment,{children:[i.jsx(pr,{}),i.jsx(RHe,{children:h})]})})]}),i.jsx(te,{condition:y&&!w,show:i.jsx(S,{documentationIcon:o,description:t,documentationLink:r,documentationLinkLabel:s,showDescription:p,showLink:f,sidebarWidth:x,children:k(c===void 0,!(p||f))})})]})},HHe=({description:e,documentationLink:t,documentationLinkLabel:n,documentationIcon:r})=>{const[o,s]=g.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(OHe,{children:i.jsx(MHe,{})}),i.jsx(Rt,{title:"Toggle help",arrow:!0,children:i.jsx($He,{onClick:()=>s(a=>!a),size:"large",children:i.jsx(DHe,{})})}),i.jsx(W3,{in:o,timeout:500,children:i.jsx(Ree,{documentationIcon:r,description:e,documentationLink:t,documentationLinkLabel:n})})]})},Tee=({description:e,children:t,documentationLink:n,documentationIcon:r,documentationLinkLabel:o="Learn more",showDescription:s=!0,showLink:a=!0,fixedDocumentationHeight:l})=>{const c=v("div")({height:"2rem",display:"grid",placeItems:"center"}),u=v("div")({height:l,overflowY:"auto"}),d=l?u:tt.Fragment;return i.jsxs(i.Fragment,{children:[i.jsxs(d,{children:[i.jsx(te,{condition:s,show:i.jsxs(LHe,{children:[i.jsx(te,{condition:!!r,show:i.jsx(c,{children:r})}),i.jsx(NHe,{children:e})]})}),i.jsx(te,{condition:a&&!!n,show:i.jsxs(FHe,{children:[i.jsx(BHe,{}),i.jsx(zHe,{href:n,rel:"noopener noreferrer",target:"_blank",children:o})]})})]}),t]})},Ree=({sidebarWidth:e,...t})=>i.jsx(kee,{sidebarWidth:e,children:i.jsx(Tee,{...t})}),WHe=({sidebarWidth:e,...t})=>i.jsx(kee,{sidebarWidth:wHe,fixedCodeHeight:"300px",children:i.jsx(Tee,{...t,fixedDocumentationHeight:"170px"})}),VHe=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",borderTopLeftRadius:e.shape.borderRadiusMedium,borderTopRightRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.table.headerBackground})),VN=v("div",{shouldForwardProp:e=>e!=="maxWidth"})(({maxWidth:e})=>({display:"flex",flex:1,...e&&{maxWidth:e}})),UHe=({columns:e,sidePanelHeader:t,leftPanelMaxWidth:n})=>i.jsxs(VHe,{children:[i.jsx(VN,{maxWidth:n,children:e.map(({header:r,maxWidth:o,align:s})=>i.jsx(IS,{maxWidth:o,align:s,children:r},r))}),i.jsx(VN,{children:i.jsx(IS,{children:t})})]}),GHe=v("div")(({theme:e})=>({borderBottom:`1px solid ${e.palette.divider}`})),qHe=v($e,{shouldForwardProp:e=>e!=="selected"})(({theme:e,selected:t})=>({"&.MuiButton-root":{width:"100%",backgroundColor:t?e.palette.secondary.light:"transparent",borderRight:`${e.spacing(.5)} solid ${t?e.palette.background.alternative:"transparent"}`,padding:0,borderRadius:0,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,overflow:"auto"},"&:hover":{backgroundColor:t?e.palette.secondary.light:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`}})),YHe=({selected:e,onClick:t,children:n})=>i.jsx(GHe,{children:i.jsx(qHe,{selected:e,onClick:t,children:n})}),KHe=v("div")({display:"flex",flexDirection:"column",width:"100%"}),XHe=v("div")({display:"flex",flexDirection:"row"}),Aee=v("div")({display:"flex",flexDirection:"column",flex:1}),JHe=v(Aee,{shouldForwardProp:e=>e!=="height"&&e!=="maxWidth"})(({theme:e,height:t,maxWidth:n})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderBottomLeftRadius:e.shape.borderRadiusMedium,overflow:"auto",...t&&{height:t},...n&&{maxWidth:n}})),ZHe=v(Aee)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderLeft:0,borderBottomRightRadius:e.shape.borderRadiusMedium})),IS=v("div",{shouldForwardProp:e=>e!=="maxWidth"&&e!=="align"})(({theme:e,maxWidth:t,align:n="start"})=>({display:"flex",flex:1,padding:e.spacing(2),fontSize:e.fontSizes.smallBody,justifyContent:n,...t&&{maxWidth:t},textAlign:n,alignItems:"center"})),Pee=({items:e,columns:t,sidePanelHeader:n,renderContent:r,renderItem:o=(l,c)=>c,height:s,listEnd:a})=>{const[l,c]=g.useState(e[0]);if(e.length===0)return null;const u=l||e[0],d=t.every(({maxWidth:p})=>!!p)?t.reduce((p,{maxWidth:f})=>p+(f||0),0):void 0;return i.jsxs(KHe,{children:[i.jsx(UHe,{columns:t,sidePanelHeader:n,leftPanelMaxWidth:d}),i.jsxs(XHe,{children:[i.jsxs(JHe,{height:s,maxWidth:d,children:[e.map(p=>o(p,i.jsx(YHe,{selected:u.id===p.id,onClick:()=>c(p),children:t.map(({header:f,maxWidth:h,align:m,cell:y})=>i.jsx(IS,{maxWidth:h,align:m,children:y(p)},f))},p.id))),a]}),i.jsx(ZHe,{children:r(u)})]})]})};var WA={},QHe=je;Object.defineProperty(WA,"__esModule",{value:!0});var n0=WA.default=void 0,eWe=QHe(Ee()),tWe=i,nWe=(0,eWe.default)((0,tWe.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"CheckCircleOutline");n0=WA.default=nWe;var VA={},rWe=je;Object.defineProperty(VA,"__esModule",{value:!0});var UA=VA.default=void 0,oWe=rWe(Ee()),sWe=i,iWe=(0,oWe.default)((0,sWe.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline");UA=VA.default=iWe;var GA={},aWe=je;Object.defineProperty(GA,"__esModule",{value:!0});var py=GA.default=void 0,lWe=aWe(Ee()),UN=i,cWe=(0,lWe.default)([(0,UN.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2z"},"0"),(0,UN.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");py=GA.default=cWe;const uWe=v(n0)(({theme:e})=>({color:e.palette.success.main})),dWe=v(UA)(({theme:e})=>({color:e.palette.error.main})),pWe=v(py)(({theme:e})=>({color:e.palette.warning.main})),_ee=({state:e})=>e==="success"?i.jsx(uWe,{}):e==="failed"?i.jsx(dWe,{}):i.jsx(pWe,{}),fWe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),hWe=function(e){return"/"+e},GN={},La=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));o=Promise.allSettled(n.map(c=>{if(c=hWe(c),c in GN)return;GN[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":fWe,u||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,h)=>{p.addEventListener("load",f),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},gWe=v(tu)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),mWe=v(ru)({lineHeight:"1.5rem"}),yWe=({header:e,children:t})=>i.jsxs(gWe,{children:[i.jsx(mWe,{expandIcon:i.jsx(Mt,{children:i.jsx(Da,{titleAccess:"Toggle"})}),children:e}),i.jsx(nu,{children:t})]}),qN=g.lazy(()=>La(()=>import("./ReactJSONEditor-BFCTTSFc.js"),[])),xWe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),vWe=v(Dt)({fontSize:"inherit",lineBreak:"anywhere"}),bWe=v(ft)(({theme:e})=>({marginLeft:e.spacing(1)})),Iee=({state:e,stateDetails:t,event:n,details:r})=>{const o=e==="failed"?"error":e==="success"?"success":"warning",s=e==="success"?i.jsx(n0,{}):void 0;return i.jsxs(xWe,{children:[i.jsx(vWe,{severity:o,icon:s,children:t}),i.jsx(yWe,{header:i.jsxs(i.Fragment,{children:["Event:",i.jsx(bWe,{to:"/history",children:n.type})]}),children:i.jsx(g.Suspense,{fallback:null,children:i.jsx(qN,{content:{json:n},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})}),i.jsx(g.Suspense,{fallback:null,children:i.jsx(qN,{content:{json:r},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})]})},CWe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),YN=v("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),wWe=v("h1")({fontWeight:"normal"}),SWe=v("h2")(({theme:e})=>({marginTop:e.spacing(1.5),fontSize:e.fontSizes.smallBody,fontWeight:"normal"})),jWe=v("form")({display:"flex",flexDirection:"column",height:"100%"}),EWe=v("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),kWe=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Oee=({addon:e,open:t,setOpen:n})=>{const r=$t(),{locationSettings:o}=$r(),{integrationEvents:s,hasMore:a,loadMore:l,loading:c}=wee(t?e==null?void 0:e.id:void 0,20,{refreshInterval:5e3});if(!e)return null;const u=`Events: ${e.provider}${e.description?` - ${e.description}`:""} (id: ${e.id})`;return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:u,children:i.jsxs(eo,{loading:c&&s.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[i.jsxs(CWe,{children:[i.jsxs(YN,{children:[i.jsx(wWe,{children:u}),i.jsx(Sn,{onClick:()=>{n(!1),r(`/integrations/edit/${e.id}`)},children:"View configuration"})]}),i.jsx(YN,{children:i.jsx(SWe,{children:"Only the most recent event for each integration and the last 100 events from the past 2 hours will be kept. All other events will be automatically deleted."})})]}),i.jsxs(jWe,{children:[i.jsx(Pee,{height:960,items:s,columns:[{header:"Status",align:"center",maxWidth:100,cell:_ee},{header:"Date",maxWidth:240,cell:({createdAt:d})=>ji(d,o==null?void 0:o.locale)}],sidePanelHeader:"Details",renderContent:Iee,renderItem:({id:d,state:p},f)=>p==="failed"?i.jsx(EWe,{children:f},d):f,listEnd:i.jsx(te,{condition:a,show:i.jsx($e,{onClick:l,children:"Load more"})})}),i.jsx(te,{condition:s.length===0,show:i.jsx("p",{children:"No events have been registered for this integration configuration."})}),i.jsx(kWe,{children:i.jsx($e,{onClick:()=>n(!1),children:"Close"})})]})]})})},TWe=v("div")(({theme:e})=>({marginLeft:e.spacing(1),marginTop:e.spacing(-1),marginBottom:e.spacing(-1),marginRight:e.spacing(-1),display:"flex",alignItems:"center"})),RWe=({addon:e})=>{const[t,n]=g.useState(!1),[r,o]=g.useState(!1),[s,a]=g.useState(!1),[l,c]=g.useState(null),{updateAddon:u,removeAddon:d}=NA(),{refetchAddons:p}=uy(),{setToastData:f,setToastApiError:h}=_t(),[m,y]=g.useState(!1),b=()=>{n(!1),c(null)},x=S=>{t?b():(c(S.currentTarget),n(!0))},C=pf(pQ),w=pf(fQ),j=g.useCallback(async()=>{try{await u({...e,enabled:!e.enabled}),p(),f({type:"success",text:e.enabled?"Integration disabled":"Integration enabled"})}catch(S){h(pt(S))}},[h,p,f,u]),k=g.useCallback(async()=>{try{await d(e.id),p(),f({type:"success",text:"Integration deleted"})}catch(S){h(pt(S))}},[h,p,f,d]);return i.jsxs(TWe,{onClick:S=>S.preventDefault(),children:[i.jsx(Rt,{title:"More actions",arrow:!0,children:i.jsx(Mt,{onClick:x,size:"small","aria-controls":t?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":t?"true":void 0,"data-loading":!0,children:i.jsx(Mf,{sx:{width:32,height:32}})})}),i.jsxs(jf,{id:"project-card-menu",open:!!l,anchorEl:l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},onClose:x,children:[i.jsx(Kd,{permission:ni,children:({hasAccess:S})=>i.jsxs(wn,{onClick:()=>y(!0),disabled:!S,children:[i.jsx(Io,{children:i.jsx(dy,{})}),i.jsx(un,{children:"View events"})]})}),i.jsxs(wn,{onClick:()=>{a(!0),b()},disabled:!C,children:[i.jsx(Io,{children:i.jsx(x7,{})}),i.jsx(un,{children:e.enabled?"Disable":"Enable"})]})," ",i.jsxs(wn,{disabled:!w,onClick:()=>{o(!0),b()},children:[i.jsx(Io,{children:i.jsx(So,{})}),i.jsx(un,{children:"Delete"})]})]}),i.jsx(Oee,{addon:e,open:m,setOpen:y}),i.jsx(Mn,{open:s,onClick:j,onClose:()=>a(!1),title:e.enabled?"Disable integration?":"Enable integration?",children:i.jsxs("div",{children:[e.enabled?"Disabling":"Enabling"," this integration will"," ",e.enabled?"prevent it from sending updates":"allow it to send updates"]})}),i.jsx(Mn,{open:r,onClick:k,onClose:()=>o(!1),title:"Delete integration?",children:i.jsx(Dt,{severity:"warning",children:"Deleting this integration instance will delete all its configuration. It will stop working immediately."})})]})},AWe=v(Sn,{shouldForwardProp:e=>e!=="highlighted"})(({theme:e,highlighted:t})=>({backgroundColor:t?e.palette.highlight:"transparent",color:e.palette.text.primary,textDecorationColor:e.palette.text.disabled,textDecorationStyle:"dashed",textUnderlineOffset:e.spacing(.5),whiteSpace:"nowrap"})),sd=({tooltip:e,highlighted:t,tooltipProps:n,children:r,...o})=>i.jsx(wr,{title:e,...n,arrow:!0,children:i.jsx(AWe,{tabIndex:0,highlighted:t,...o,children:r})}),PWe=v(sd)({display:"flex",alignItems:"center"}),_We=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),IWe=v("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),OWe=({integration:e,...t})=>{const{integrationEvents:n}=wee(e==null?void 0:e.id,1,{refreshInterval:5e3}),{locationSettings:r}=$r();if(n.length===0)return null;const o=n[0];return i.jsx(K,{onClick:s=>s.preventDefault(),...t,children:i.jsx(PWe,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:i.jsxs(i.Fragment,{children:[i.jsxs(_We,{children:[i.jsx(IWe,{children:"Last event"}),i.jsx("span",{children:ji(o.createdAt,r==null?void 0:r.locale)})]}),i.jsx(Iee,{...o})]}),children:i.jsx(_ee,{...o})})})},MWe=v("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:t="default"})=>({display:"flex",flexDirection:"column",padding:e.spacing(3),height:"100%",borderRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.divider}`,boxShadow:e.boxShadows.card,":hover":{backgroundColor:e.palette.action.hover},...t==="stacked"&&{position:"relative",zIndex:0,"&:after":{content:'""',width:"auto",height:e.spacing(1),position:"absolute",zIndex:-1,bottom:e.spacing(-1),left:e.spacing(1),right:e.spacing(1),borderBottomLeftRadius:`${e.shape.borderRadiusMedium}px`,borderBottomRightRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.divider}`,boxShadow:e.boxShadows.card}}})),KN=v(Sn)({textDecoration:"none",color:"inherit",textAlign:"left"}),$We=v(ft)({textDecoration:"none",color:"inherit"}),DWe=v("div")(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),LWe=v(J)(()=>({display:"flex",alignItems:"center",marginRight:"auto"})),NWe=v(J)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.primary.main,fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body2.fontSize,marginTop:"auto",paddingTop:e.spacing(1),gap:e.spacing(.5)})),FWe=v(Hp)(({theme:e})=>({fontSize:e.fontSizes.bodySize})),Su=({variant:e="default",icon:t,title:n,description:r,isEnabled:o,configureActionText:s="Configure",link:a,onClick:l,addon:c,deprecated:u,isExternal:d=!1})=>{const{trackEvent:p}=zt(),f=c!==void 0,h=()=>{p("open-integration",{props:{integrationName:n,isConfigured:f}})},m=i.jsxs(MWe,{variant:e,children:[i.jsxs(DWe,{children:[i.jsxs(LWe,{variant:"h3","data-loading":!0,children:[i.jsx(vee,{name:t})," ",n]}),i.jsx(te,{condition:u!==void 0,show:i.jsx(Rt,{title:u,arrow:!0,children:i.jsx(an,{"data-loading":!0,children:"Deprecated"})})}),i.jsx(te,{condition:o===!0,show:i.jsx(an,{color:"success","data-loading":!0,children:"Enabled"})}),i.jsx(te,{condition:o===!1,show:i.jsx(an,{"data-loading":!0,children:"Disabled"})}),i.jsx(te,{condition:f,show:i.jsx(RWe,{addon:c})})]}),i.jsx(J,{variant:"body2",color:"text.secondary","data-loading":!0,children:r}),i.jsxs(NWe,{"data-loading":!0,children:[s,i.jsx(te,{condition:d,show:i.jsx(FWe,{}),elseShow:i.jsx(DA,{})}),i.jsx(OWe,{integration:c,sx:{ml:"auto"}})]})]});return l?i.jsx(KN,{component:"button",onClick:()=>{h(),l()},children:m}):d?i.jsx(KN,{href:a,target:"_blank",rel:"noreferrer",onClick:h,children:m}):i.jsx($We,{to:a,onClick:h,children:m})};var qA={},BWe=je;Object.defineProperty(qA,"__esModule",{value:!0});var w7=qA.default=void 0,zWe=BWe(Ee()),HWe=i,WWe=(0,zWe.default)((0,HWe.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}),"Launch");w7=qA.default=WWe;const VWe="/static/cr-DbjGV9Hl.png",UWe="/static/cr-DbjGV9Hl.png",GWe="/static/cr-DbjGV9Hl.png",qWe=v("figure")(({theme:e})=>({display:"flex",gap:e.spacing(2),margin:e.spacing(2,0),flexDirection:"column"})),YWe=v("figcaption")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexDirection:"column"})),KWe=v("img")({maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"}),q9=({title:e,description:t,src:n})=>i.jsxs(qWe,{children:[i.jsxs(YWe,{children:[i.jsx(J,{variant:"h3",children:e}),i.jsx(J,{children:t})]}),i.jsx(KWe,{src:Do(n),alt:e})]}),XWe=v("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",gap:e.spacing(2),marginTop:e.spacing(1)})),JWe=v("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),YA=v("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ZWe=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),QWe=v("div")({display:"flex",justifyContent:"flex-end"}),eVe=v("section")(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(2)})),XN=v(xn)(({theme:e})=>({width:"100%"})),S7=g.forwardRef(({children:e},t)=>i.jsx(J,{ref:t,component:"h4",variant:"h4",sx:n=>({margin:n.spacing(1,0)}),children:e})),tVe=v("div")({marginTop:"25px"}),nVe=v("section")(({theme:e})=>({borderWidth:"1px",borderStyle:"solid",borderColor:e.palette.neutral.border,borderRadius:`${e.shape.borderRadiusLarge}px`,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(3)})),OS=({...e})=>i.jsx(qr,{elevation:0,sx:t=>({background:t.palette.background.elevation1,padding:t.spacing(2,3),display:"flex",flexDirection:"column",width:"100%",borderRadius:`${t.shape.borderRadiusLarge}px`}),...e}),JN=["http","https","mailto","tel"];function rVe(e){const t=(e||"").trim(),n=t.charAt(0);if(n==="#"||n==="/")return t;const r=t.indexOf(":");if(r===-1)return t;let o=-1;for(;++o<JN.length;){const s=JN[o];if(r===s.length&&t.slice(0,s.length).toLowerCase()===s)return t}return o=t.indexOf("?"),o!==-1&&r>o||(o=t.indexOf("#"),o!==-1&&r>o)?t:"javascript:void(0)"}/*!
299
299
  * Determine if an object is a Buffer
300
300
  *
301
301
  * @author Feross Aboukhadijeh <https://feross.org>
@@ -376,7 +376,7 @@ Error generating stack: `+s.message+`
376
376
  `)-1&&t.runes[2]===Ie.CODES.get(`
377
377
  `)+1&&t.runes[3]===dn.MAX_RUNE&&(t.runes=[],t.op=Ne.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let l of t)r+=l.op===n?l.subs.length:1;let o=new Array(r).fill(null),s=0;for(let l of t)l.op===n?(o.splice(s,l.subs.length,...l.subs),s+=l.subs.length,this.reuse(l)):o[s++]=l;let a=this.newRegexp(n);if(a.subs=o,n===Ne.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){const l=a;a=a.subs[0],this.reuse(l)}return a}factor(t){if(t.length<2)return t;let n=0,r=t.length,o=0,s=null,a=0,l=0,c=0;for(let d=0;d<=r;d++){let p=null,f=0,h=0;if(d<r){let m=t[n+d];if(m.op===Ne.Op.CONCAT&&m.subs.length>0&&(m=m.subs[0]),m.op===Ne.Op.LITERAL&&(p=m.runes,f=m.runes.length,h=m.flags&It.FOLD_CASE),h===l){let y=0;for(;y<a&&y<f&&s[y]===p[y];)y++;if(y>0){a=y;continue}}}if(d!==c)if(d===c+1)t[o++]=t[n+c];else{const m=this.newRegexp(Ne.Op.LITERAL);m.flags=l,m.runes=s.slice(0,a);for(let x=c;x<d;x++)t[n+x]=this.removeLeadingString(t[n+x],a),this.checkLimits(t[n+x]);const y=this.collapse(t.slice(n+c,n+d),Ne.Op.ALTERNATE),b=this.newRegexp(Ne.Op.CONCAT);b.subs=[m,y],t[o++]=b}c=d,s=p,a=f,l=h}r=o,n=0,c=0,o=0;let u=null;for(let d=0;d<=r;d++){let p=null;if(!(d<r&&(p=Tt.leadingRegexp(t[n+d]),u!==null&&u.equals(p)&&(Tt.isCharClass(u)||u.op===Ne.Op.REPEAT&&u.min===u.max&&Tt.isCharClass(u.subs[0]))))){if(d!==c)if(d===c+1)t[o++]=t[n+c];else{const f=u;for(let y=c;y<d;y++){const b=y!==c;t[n+y]=this.removeLeadingRegexp(t[n+y],b),this.checkLimits(t[n+y])}const h=this.collapse(t.slice(n+c,n+d),Ne.Op.ALTERNATE),m=this.newRegexp(Ne.Op.CONCAT);m.subs=[f,h],t[o++]=m}c=d,u=p}}r=o,n=0,c=0,o=0;for(let d=0;d<=r;d++)if(!(d<r&&Tt.isCharClass(t[n+d]))){if(d!==c)if(d===c+1)t[o++]=t[n+c];else{let p=c;for(let h=c+1;h<d;h++){const m=t[n+p],y=t[n+h];(m.op<y.op||m.op===y.op&&(m.runes!==null?m.runes.length:0)<(y.runes!==null?y.runes.length:0))&&(p=h)}const f=t[n+c];t[n+c]=t[n+p],t[n+p]=f;for(let h=c+1;h<d;h++)Tt.mergeCharClass(t[n+c],t[n+h]),this.reuse(t[n+h]);this.cleanAlt(t[n+c]),t[o++]=t[n+c]}d<r&&(t[o++]=t[n+d]),c=d+1}r=o,n=0,c=0,o=0;for(let d=0;d<r;++d)d+1<r&&t[n+d].op===Ne.Op.EMPTY_MATCH&&t[n+d+1].op===Ne.Op.EMPTY_MATCH||(t[o++]=t[n+d]);return r=o,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===Ne.Op.CONCAT&&t.subs.length>0){const r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===Ne.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=Ne.Op.EMPTY_MATCH,t.subs=null;break;case 2:{const o=t;t=t.subs[1],this.reuse(o);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===Ne.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=Ne.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===Ne.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=Ne.Op.EMPTY_MATCH,t.subs=Ne.emptySubs();break}case 1:{const r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(Ne.Op.EMPTY_MATCH)}parseInternal(){if(this.flags&It.LITERAL)return Tt.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1;const o=new krt(this.wholeRegexp);for(;o.more();){let a=-1;e:switch(o.peek()){case Ie.CODES.get("("):if(this.flags&It.PERL_X&&o.lookingAt("(?")){this.parsePerlFlags(o);break}this.op(Ne.Op.LEFT_PAREN).cap=++this.numCap,o.skip(1);break;case Ie.CODES.get("|"):this.parseVerticalBar(),o.skip(1);break;case Ie.CODES.get(")"):this.parseRightParen(),o.skip(1);break;case Ie.CODES.get("^"):this.flags&It.ONE_LINE?this.op(Ne.Op.BEGIN_TEXT):this.op(Ne.Op.BEGIN_LINE),o.skip(1);break;case Ie.CODES.get("$"):this.flags&It.ONE_LINE?this.op(Ne.Op.END_TEXT).flags|=It.WAS_DOLLAR:this.op(Ne.Op.END_LINE),o.skip(1);break;case Ie.CODES.get("."):this.flags&It.DOT_NL?this.op(Ne.Op.ANY_CHAR):this.op(Ne.Op.ANY_CHAR_NOT_NL),o.skip(1);break;case Ie.CODES.get("["):this.parseClass(o);break;case Ie.CODES.get("*"):case Ie.CODES.get("+"):case Ie.CODES.get("?"):{a=o.pos();let l=null;switch(o.pop()){case Ie.CODES.get("*"):l=Ne.Op.STAR;break;case Ie.CODES.get("+"):l=Ne.Op.PLUS;break;case Ie.CODES.get("?"):l=Ne.Op.QUEST;break}this.repeat(l,n,r,a,o,t);break}case Ie.CODES.get("{"):{a=o.pos();const l=Tt.parseRepeat(o);if(l<0){o.rewindTo(a),this.literal(o.pop());break}n=l>>16,r=(l&dn.MAX_BMP)<<16>>16,this.repeat(Ne.Op.REPEAT,n,r,a,o,t);break}case Ie.CODES.get("\\"):{const l=o.pos();if(o.skip(1),this.flags&It.PERL_X&&o.more())switch(o.pop()){case Ie.CODES.get("A"):this.op(Ne.Op.BEGIN_TEXT);break e;case Ie.CODES.get("b"):this.op(Ne.Op.WORD_BOUNDARY);break e;case Ie.CODES.get("B"):this.op(Ne.Op.NO_WORD_BOUNDARY);break e;case Ie.CODES.get("C"):throw new Kr(Tt.ERR_INVALID_ESCAPE,"\\C");case Ie.CODES.get("Q"):{let p=o.rest();const f=p.indexOf("\\E");f>=0&&(p=p.substring(0,f)),o.skipString(p),o.skipString("\\E");let h=0;for(;h<p.length;){const m=p.codePointAt(h);this.literal(m),h+=Rn.charCount(m)}break e}case Ie.CODES.get("z"):this.op(Ne.Op.END_TEXT);break e;default:o.rewindTo(l);break}const c=this.newRegexp(Ne.Op.CHAR_CLASS);if(c.flags=this.flags,o.lookingAt("\\p")||o.lookingAt("\\P")){const d=new Ys;if(this.parseUnicodeClass(o,d)){c.runes=d.toArray(),this.push(c);break e}}const u=new Ys;if(this.parsePerlClassEscape(o,u)){c.runes=u.toArray(),this.push(c);break e}o.rewindTo(l),this.reuse(c),this.literal(Tt.parseEscape(o));break}default:this.literal(o.pop());break}t=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Kr(Tt.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){const n=t.pos(),r=t.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){const l=r.charAt(2)==="P"?4:3,c=r.indexOf(">");if(c<0)throw new Kr(Tt.ERR_INVALID_NAMED_CAPTURE,r);const u=r.substring(l,c);if(t.skipString(u),t.skip(l+1),!Tt.isValidCaptureName(u))throw new Kr(Tt.ERR_INVALID_NAMED_CAPTURE,r.substring(0,c+1));const d=this.op(Ne.Op.LEFT_PAREN);if(d.cap=++this.numCap,this.namedGroups[u])throw new Kr(Tt.ERR_DUPLICATE_NAMED_CAPTURE,u);this.namedGroups[u]=this.numCap,d.name=u;return}t.skip(2);let o=this.flags,s=1,a=!1;e:for(;t.more();){const l=t.pop();switch(l){case Ie.CODES.get("i"):o|=It.FOLD_CASE,a=!0;break;case Ie.CODES.get("m"):o&=-17,a=!0;break;case Ie.CODES.get("s"):o|=It.DOT_NL,a=!0;break;case Ie.CODES.get("U"):o|=It.NON_GREEDY,a=!0;break;case Ie.CODES.get("-"):if(s<0)break e;s=-1,o=~o,a=!1;break;case Ie.CODES.get(":"):case Ie.CODES.get(")"):if(s<0){if(!a)break e;o=~o}l===Ie.CODES.get(":")&&this.op(Ne.Op.LEFT_PAREN),this.flags=o;return;default:break e}}throw new Kr(Tt.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(Ne.Op.VERTICAL_BAR)}swapVerticalBar(){const t=this.stack.length;if(t>=3&&this.stack[t-2].op===Ne.Op.VERTICAL_BAR&&Tt.isCharClass(this.stack[t-1])&&Tt.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){const o=r;r=n,n=o,this.stack[t-3]=r}return Tt.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){const n=this.stack[t-1],r=this.stack[t-2];if(r.op===Ne.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Kr(Tt.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const n=this.pop(),r=this.pop();if(r.op!==Ne.Op.LEFT_PAREN)throw new Kr(Tt.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=Ne.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){const r=t.pos();if(!(this.flags&It.PERL_X)||!t.more()||t.pop()!==Ie.CODES.get("\\")||!t.more())return!1;t.pop();const o=t.from(r),s=LB.has(o)?LB.get(o):null;return s===null?!1:(n.appendGroup(s,(this.flags&It.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){const r=t.rest(),o=r.indexOf(":]");if(o<0)return!1;const s=r.substring(0,o+2);t.skipString(s);const a=ZB.has(s)?ZB.get(s):null;if(a===null)throw new Kr(Tt.ERR_INVALID_CHAR_RANGE,s);return n.appendGroup(a,(this.flags&It.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){const r=t.pos();if(!(this.flags&It.UNICODE_GROUPS)||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let o=1,s=t.pop();if(s===Ie.CODES.get("P")&&(o=-1),!t.more())throw t.rewindTo(r),new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.rest());s=t.pop();let a;if(s!==Ie.CODES.get("{"))a=Rn.runeToString(s);else{const d=t.rest(),p=d.indexOf("}");if(p<0)throw t.rewindTo(r),new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.rest());a=d.substring(0,p),t.skipString(a),t.skip(1)}a.length!==0&&a.codePointAt(0)===Ie.CODES.get("^")&&(o=0-o,a=a.substring(1));const l=Tt.unicodeTable(a);if(l===null)throw new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.from(r));const c=l.first,u=l.second;if(!(this.flags&It.FOLD_CASE)||u===null)n.appendTableWithSign(c,o);else{const d=new Ys().appendTable(c).appendTable(u).cleanClass().toArray();n.appendClassWithSign(d,o)}return!0}parseClass(t){const n=t.pos();t.skip(1);const r=this.newRegexp(Ne.Op.CHAR_CLASS);r.flags=this.flags;const o=new Ys;let s=1;t.more()&&t.lookingAt("^")&&(s=-1,t.skip(1),this.flags&It.CLASS_NL||o.appendRange(Ie.CODES.get(`
378
378
  `),Ie.CODES.get(`
379
- `)));let a=!0;for(;!t.more()||t.peek()!==Ie.CODES.get("]")||a;){if(t.more()&&t.lookingAt("-")&&!(this.flags&It.PERL_X)&&!a){const d=t.rest();if(d==="-"||!d.startsWith("-]"))throw t.rewindTo(n),new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.rest())}a=!1;const l=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,o))continue;t.rewindTo(l)}if(this.parseUnicodeClass(t,o)||this.parsePerlClassEscape(t,o))continue;t.rewindTo(l);const c=Tt.parseClassChar(t,n);let u=c;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(u=Tt.parseClassChar(t,n),u<c)throw new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.from(l))}this.flags&It.FOLD_CASE?o.appendFoldedRange(c,u):o.appendRange(c,u)}t.skip(1),o.cleanClass(),s<0&&o.negateClass(),r.runes=o.toArray(),this.push(r)}};X(Tt,"ERR_INTERNAL_ERROR","regexp/syntax: internal error"),X(Tt,"ERR_INVALID_CHAR_RANGE","invalid character class range"),X(Tt,"ERR_INVALID_ESCAPE","invalid escape sequence"),X(Tt,"ERR_INVALID_NAMED_CAPTURE","invalid named capture"),X(Tt,"ERR_INVALID_PERL_OP","invalid or unsupported Perl syntax"),X(Tt,"ERR_INVALID_REPEAT_OP","invalid nested repetition operator"),X(Tt,"ERR_INVALID_REPEAT_SIZE","invalid repeat count"),X(Tt,"ERR_MISSING_BRACKET","missing closing ]"),X(Tt,"ERR_MISSING_PAREN","missing closing )"),X(Tt,"ERR_MISSING_REPEAT_ARGUMENT","missing argument to repetition operator"),X(Tt,"ERR_TRAILING_BACKSLASH","trailing backslash at end of expression"),X(Tt,"ERR_DUPLICATE_NAMED_CAPTURE","duplicate capture group name"),X(Tt,"ERR_UNEXPECTED_PAREN","unexpected )"),X(Tt,"ERR_NESTING_DEPTH","expression nests too deeply"),X(Tt,"ERR_LARGE","expression too large"),X(Tt,"MAX_HEIGHT",1e3),X(Tt,"MAX_SIZE",3355443),X(Tt,"MAX_RUNES",33554432),X(Tt,"ANY_TABLE",new pe(new Uint32Array([0,dn.MAX_RUNE,1])));let rj=Tt;class Trt{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}}class $d{static initTest(t){const n=$d.compile(t),r=new $d(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return $d.compileImpl(t,It.PERL,!1)}static compilePOSIX(t){return $d.compileImpl(t,It.POSIX,!0)}static compileImpl(t,n,r){let o=rj.parse(t,n);const s=o.maxCap();o=_l.simplify(o);const a=u2.compileRegexp(o),l=new $d(t,a,s,r),[c,u]=a.prefix();return l.prefixComplete=c,l.prefix=u,l.prefixUTF8=Rn.stringToUtf8ByteArray(l.prefix),l.prefix.length>0&&(l.prefixRune=l.prefix.codePointAt(0)),l.namedGroups=o.namedGroups,l}static match(t,n){return $d.compile(t).match(n)}constructor(t,n,r=0,o=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=o,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new Trt}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=Gh.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecute(t,n,r,o){let s=this.get(),a=!1;s?s.next!==null&&(s=Gh.fromMachine(s),a=!0):(s=Gh.fromRE2(this),a=!0),s.init(o);const l=s.match(t,n,r)?s.submatches():null;return this.put(s,a),l}match(t){return this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,0)!==null}matchWithGroup(t,n,r,o,s){return t instanceof kp||(t=t6.utf16(t)),this.matchMachineInput(t,n,r,o,s)}matchMachineInput(t,n,r,o,s){if(n>r)return[!1,null];const a=t.isUTF16Encoding()?Ho.fromUTF16(t.asCharSequence(),0,r):Ho.fromUTF8(t.asBytes(),0,r),l=this.doExecute(a,n,o,2*s);return l===null?[!1,null]:[!0,l]}matchUTF8(t){return this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let o=0,s=0,a="";const l=Ho.fromUTF16(t);let c=0;for(;s<=t.length;){const u=this.doExecute(l,s,It.UNANCHORED,2);if(u===null||u.length===0)break;a+=t.substring(o,u[0]),(u[1]>o||u[0]===0)&&(a+=n(t.substring(u[0],u[1])),c++),o=u[1];const d=l.step(s)&7;if(s+d>u[1]?s+=d:s+1>u[1]?s++:s=u[1],c>=r)break}return a+=t.substring(o),a}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let o=0;o<t.length;o++)r[o]=t[o];t=r}return t}allMatches(t,n,r=o=>o){let o=[];const s=t.endPos();n<0&&(n=s+1);let a=0,l=0,c=-1;for(;l<n&&a<=s;){const u=this.doExecute(t,a,It.UNANCHORED,this.prog.numCap);if(u===null||u.length===0)break;let d=!0;if(u[1]===a){u[0]===c&&(d=!1);const p=t.step(a);p<0?a=s+1:a+=p&7}else a=u[1];c=u[1],d&&(o.push(r(this.pad(u))),l++)}return o}findUTF8(t){const n=this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){const n=this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){const n=this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,2)}findUTF8Submatch(t){const n=this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,this.prog.numCap);if(n===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let o=0;o<r.length;o++)2*o<n.length&&n[2*o]>=0&&(r[o]=t.slice(n[2*o],n[2*o+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,this.prog.numCap))}findSubmatch(t){const n=this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,this.prog.numCap);if(n===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let o=0;o<r.length;o++)2*o<n.length&&n[2*o]>=0&&(r[o]=t.substring(n[2*o],n[2*o+1]));return r}findSubmatchIndex(t){return this.pad(this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){const r=this.allMatches(Ho.fromUTF8(t),n,o=>t.slice(o[0],o[1]));return r.length===0?null:r}findAllUTF8Index(t,n){const r=this.allMatches(Ho.fromUTF8(t),n,o=>o.slice(0,2));return r.length===0?null:r}findAll(t,n){const r=this.allMatches(Ho.fromUTF16(t),n,o=>t.substring(o[0],o[1]));return r.length===0?null:r}findAllIndex(t,n){const r=this.allMatches(Ho.fromUTF16(t),n,o=>o.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){const r=this.allMatches(Ho.fromUTF8(t),n,o=>{let s=new Array(o.length/2|0).fill(null);for(let a=0;a<s.length;a++)o[2*a]>=0&&(s[a]=t.slice(o[2*a],o[2*a+1]));return s});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){const r=this.allMatches(Ho.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){const r=this.allMatches(Ho.fromUTF16(t),n,o=>{let s=new Array(o.length/2|0).fill(null);for(let a=0;a<s.length;a++)o[2*a]>=0&&(s[a]=t.substring(o[2*a],o[2*a+1]));return s});return r.length===0?null:r}findAllSubmatchIndex(t,n){const r=this.allMatches(Ho.fromUTF16(t),n);return r.length===0?null:r}}class k1{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){const n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,o=t.length;o===0&&(n="(?:)",r=!0);let s=0;for(;s<o;){let a=t[s];if(a==="\\"){if(s+1<o)switch(a=t[s+1],a){case"\\":{n+="\\\\",s+=2;continue}case"c":{if(s+2<o){let c=t[s+2];if(k1.isUpperCaseAlpha(c)){n+="\\x",n+=(c.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(c.charCodeAt(0)-64&15).toString(16).toUpperCase(),s+=3,r=!0;continue}}n+="\\c",s+=2;continue}case"u":{if(s+2<o){let c=t[s+2];if(k1.isHexadecimal(c)){n+="\\x{"+c,s+=3;for(let u=0;u<3&&s<o&&(c=t[s],!!k1.isHexadecimal(c));++s,++u)n+=c;n+="}",r=!0;continue}else if(c==="{"){n+="\\x",s+=2,r=!0;continue}}n+="\\u",s+=2;continue}default:{n+="\\";let c=k1.getUtf8CharSize(a);n+=t.substring(s+1,s+1+c),s+=c+1;continue}}}else if(a==="/"){n+="\\/",s+=1,r=!0;continue}else if(a==="("&&s+2<o&&t[s+1]==="?"&&t[s+2]==="<"&&(s+3>=o||t[s+3]!=="="&&t[s+3]!=="!")){n+="(?P<",s+=3,r=!0;continue}let l=k1.getUtf8CharSize(a);n+=t.substring(s,s+l),s+=l}return r?n:t}}const fi=class fi{static quote(t){return Rn.quoteMeta(t)}static translateRegExp(t){return k1.translate(t)}static compile(t,n=0){let r=t;if(n&fi.CASE_INSENSITIVE&&(r=`(?i)${r}`),n&fi.DOTALL&&(r=`(?s)${r}`),n&fi.MULTILINE&&(r=`(?m)${r}`),n&-32)throw new brt("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let o=It.PERL;n&fi.DISABLE_UNICODE_GROUPS&&(o&=-129);const s=new fi(t,n);return s.re2Input=$d.compileImpl(r,o,(n&fi.LONGEST_MATCH)!==0),s}static matches(t,n){return fi.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");const o=new fi(t,n);return o.re2Input=r,o}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.matcher(t).matches()}matcher(t){return Array.isArray(t)&&(t=t6.utf8(t)),new Crt(this,t)}split(t,n=0){const r=this.matcher(t),o=[];let s=0,a=0;for(;r.find();){if(a===0&&r.end()===0){a=r.end();continue}if(n>0&&o.length===n-1)break;if(a===r.start()){if(n===0){s+=1,a=r.end();continue}}else for(;s>0;)o.push(""),s-=1;o.push(r.substring(a,r.start())),a=r.end()}if(n===0&&a!==r.inputLength()){for(;s>0;)o.push(""),s-=1;o.push(r.substring(a,r.inputLength()))}return(n!==0||o.length===0)&&o.push(r.substring(a,r.inputLength())),o}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}};X(fi,"CASE_INSENSITIVE",1),X(fi,"DOTALL",2),X(fi,"MULTILINE",4),X(fi,"DISABLE_UNICODE_GROUPS",8),X(fi,"LONGEST_MATCH",16);let h3=fi;var oj={exports:{}};const Rrt="2.0.0",tre=256,Art=Number.MAX_SAFE_INTEGER||9007199254740991,Prt=16,_rt=tre-6,Irt=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var z7={MAX_LENGTH:tre,MAX_SAFE_COMPONENT_LENGTH:Prt,MAX_SAFE_BUILD_LENGTH:_rt,MAX_SAFE_INTEGER:Art,RELEASE_TYPES:Irt,SEMVER_SPEC_VERSION:Rrt,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},vb={};const Ort=typeof process=="object"&&vb&&vb.NODE_DEBUG&&/\bsemver\b/i.test(vb.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var H7=Ort;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=z7,s=H7;t=e.exports={};const a=t.re=[],l=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],d=t.t={};let p=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[f,r]],m=b=>{for(const[x,C]of h)b=b.split(`${x}*`).join(`${x}{0,${C}}`).split(`${x}+`).join(`${x}{1,${C}}`);return b},y=(b,x,C)=>{const w=m(x),j=p++;s(b,j,x),d[b]=j,c[j]=x,u[j]=w,a[j]=new RegExp(x,C?"g":void 0),l[j]=new RegExp(w,C?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),y("FULL",`^${c[d.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),y("LOOSE",`^${c[d.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),y("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),y("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?(?:${c[d.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",c[d.COERCE],!0),y("COERCERTLFULL",c[d.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",y("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",y("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(oj,oj.exports);var vy=oj.exports;const Mrt=Object.freeze({loose:!0}),$rt=Object.freeze({}),Drt=e=>e?typeof e!="object"?Mrt:e:$rt;var d_=Drt;const QB=/^[0-9]+$/,nre=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;const n=QB.test(e),r=QB.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},Lrt=(e,t)=>nre(t,e);var rre={compareIdentifiers:nre,rcompareIdentifiers:Lrt};const Vx=H7,{MAX_LENGTH:ez,MAX_SAFE_INTEGER:Ux}=z7,{safeRe:Gx,t:qx}=vy,Nrt=d_,{compareIdentifiers:bb}=rre;let Frt=class vc{constructor(t,n){if(n=Nrt(n),t instanceof vc){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>ez)throw new TypeError(`version is longer than ${ez} characters`);Vx("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?Gx[qx.LOOSE]:Gx[qx.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>Ux||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ux||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ux||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){const s=+o;if(s>=0&&s<Ux)return s}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(Vx("SemVer.compare",this.version,this.options,t),!(t instanceof vc)){if(typeof t=="string"&&t===this.version)return 0;t=new vc(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof vc||(t=new vc(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof vc||(t=new vc(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(Vx("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 bb(r,o)}while(++n)}compareBuild(t){t instanceof vc||(t=new vc(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(Vx("build 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 bb(r,o)}while(++n)}inc(t,n,r){if(t.startsWith("pre")){if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(n){const o=`-${n}`.match(this.options.loose?Gx[qx.PRERELEASELOOSE]:Gx[qx.PRERELEASE]);if(!o||o[1]!==n)throw new Error(`invalid identifier: ${n}`)}}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"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];r===!1&&(s=[n]),bb(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Oi=Frt;const tz=Oi,Brt=(e,t,n=!1)=>{if(e instanceof tz)return e;try{return new tz(e,t)}catch(r){if(!n)return null;throw r}};var g0=Brt;const zrt=g0,Hrt=(e,t)=>{const n=zrt(e,t);return n?n.version:null};var Wrt=Hrt;const Vrt=g0,Urt=(e,t)=>{const n=Vrt(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var Grt=Urt;const nz=Oi,qrt=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new nz(e instanceof nz?e.version:e,n).inc(t,r,o).version}catch{return null}};var Yrt=qrt;const rz=g0,Krt=(e,t)=>{const n=rz(e,null,!0),r=rz(t,null,!0),o=n.compare(r);if(o===0)return null;const s=o>0,a=s?n:r,l=s?r:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c){if(!l.patch&&!l.minor)return"major";if(l.compareMain(a)===0)return l.minor&&!l.patch?"minor":"patch"}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 Xrt=Krt;const Jrt=Oi,Zrt=(e,t)=>new Jrt(e,t).major;var Qrt=Zrt;const eot=Oi,tot=(e,t)=>new eot(e,t).minor;var not=tot;const rot=Oi,oot=(e,t)=>new rot(e,t).patch;var sot=oot;const iot=g0,aot=(e,t)=>{const n=iot(e,t);return n&&n.prerelease.length?n.prerelease:null};var lot=aot;const oz=Oi,cot=(e,t,n)=>new oz(e,n).compare(new oz(t,n));var rc=cot;const uot=rc,dot=(e,t,n)=>uot(t,e,n);var pot=dot;const fot=rc,hot=(e,t)=>fot(e,t,!0);var got=hot;const sz=Oi,mot=(e,t,n)=>{const r=new sz(e,n),o=new sz(t,n);return r.compare(o)||r.compareBuild(o)};var p_=mot;const yot=p_,xot=(e,t)=>e.sort((n,r)=>yot(n,r,t));var vot=xot;const bot=p_,Cot=(e,t)=>e.sort((n,r)=>bot(r,n,t));var wot=Cot;const Sot=rc,jot=(e,t,n)=>Sot(e,t,n)>0;var W7=jot;const Eot=rc,kot=(e,t,n)=>Eot(e,t,n)<0;var V7=kot;const ore=ls(V7),Tot=rc,Rot=(e,t,n)=>Tot(e,t,n)===0;var sre=Rot;const Aot=rc,Pot=(e,t,n)=>Aot(e,t,n)!==0;var ire=Pot;const _ot=rc,Iot=(e,t,n)=>_ot(e,t,n)>=0;var f_=Iot;const Oot=rc,Mot=(e,t,n)=>Oot(e,t,n)<=0;var h_=Mot;const $ot=sre,Dot=ire,Lot=W7,Not=f_,Fot=V7,Bot=h_,zot=(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 $ot(e,n,r);case"!=":return Dot(e,n,r);case">":return Lot(e,n,r);case">=":return Not(e,n,r);case"<":return Fot(e,n,r);case"<=":return Bot(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var are=zot;const Hot=Oi,Wot=g0,{safeRe:Yx,t:Kx}=vy,Vot=(e,t)=>{if(e instanceof Hot)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(t.includePrerelease?Yx[Kx.COERCEFULL]:Yx[Kx.COERCE]);else{const c=t.includePrerelease?Yx[Kx.COERCERTLFULL]:Yx[Kx.COERCERTL];let u;for(;(u=c.exec(e))&&(!n||n.index+n[0].length!==e.length);)(!n||u.index+u[0].length!==n.index+n[0].length)&&(n=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(n===null)return null;const r=n[2],o=n[3]||"0",s=n[4]||"0",a=t.includePrerelease&&n[5]?`-${n[5]}`:"",l=t.includePrerelease&&n[6]?`+${n[6]}`:"";return Wot(`${r}.${o}.${s}${a}${l}`,t)};var Uot=Vot;class Got{constructor(){this.max=1e3,this.map=new Map}get(t){const n=this.map.get(t);if(n!==void 0)return this.map.delete(t),this.map.set(t,n),n}delete(t){return this.map.delete(t)}set(t,n){if(!this.delete(t)&&n!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(t,n)}return this}}var qot=Got,Cb,iz;function oc(){if(iz)return Cb;iz=1;const e=/\s+/g;class t{constructor(O,L){if(L=o(L),O instanceof t)return O.loose===!!L.loose&&O.includePrerelease===!!L.includePrerelease?O:new t(O.raw,L);if(O instanceof s)return this.raw=O.value,this.set=[[O]],this.formatted=void 0,this;if(this.options=L,this.loose=!!L.loose,this.includePrerelease=!!L.includePrerelease,this.raw=O.trim().replace(e," "),this.set=this.raw.split("||").map(B=>this.parseRange(B.trim())).filter(B=>B.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const B=this.set[0];if(this.set=this.set.filter(H=>!y(H[0])),this.set.length===0)this.set=[B];else if(this.set.length>1){for(const H of this.set)if(H.length===1&&b(H[0])){this.set=[H];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let O=0;O<this.set.length;O++){O>0&&(this.formatted+="||");const L=this.set[O];for(let B=0;B<L.length;B++)B>0&&(this.formatted+=" "),this.formatted+=L[B].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(O){const B=((this.options.includePrerelease&&h)|(this.options.loose&&m))+":"+O,H=r.get(B);if(H)return H;const N=this.options.loose,I=N?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];O=O.replace(I,$(this.options.includePrerelease)),a("hyphen replace",O),O=O.replace(c[u.COMPARATORTRIM],d),a("comparator trim",O),O=O.replace(c[u.TILDETRIM],p),a("tilde trim",O),O=O.replace(c[u.CARETTRIM],f),a("caret trim",O);let q=O.split(" ").map(se=>C(se,this.options)).join(" ").split(/\s+/).map(se=>M(se,this.options));N&&(q=q.filter(se=>(a("loose invalid filter",se,this.options),!!se.match(c[u.COMPARATORLOOSE])))),a("range list",q);const ne=new Map,V=q.map(se=>new s(se,this.options));for(const se of V){if(y(se))return[se];ne.set(se.value,se)}ne.size>1&&ne.has("")&&ne.delete("");const oe=[...ne.values()];return r.set(B,oe),oe}intersects(O,L){if(!(O instanceof t))throw new TypeError("a Range is required");return this.set.some(B=>x(B,L)&&O.set.some(H=>x(H,L)&&B.every(N=>H.every(I=>N.intersects(I,L)))))}test(O){if(!O)return!1;if(typeof O=="string")try{O=new l(O,this.options)}catch{return!1}for(let L=0;L<this.set.length;L++)if(z(this.set[L],O,this.options))return!0;return!1}}Cb=t;const n=qot,r=new n,o=d_,s=U7(),a=H7,l=Oi,{safeRe:c,t:u,comparatorTrimReplace:d,tildeTrimReplace:p,caretTrimReplace:f}=vy,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:m}=z7,y=A=>A.value==="<0.0.0-0",b=A=>A.value==="",x=(A,O)=>{let L=!0;const B=A.slice();let H=B.pop();for(;L&&B.length;)L=B.every(N=>H.intersects(N,O)),H=B.pop();return L},C=(A,O)=>(A=A.replace(c[u.BUILD],""),a("comp",A,O),A=S(A,O),a("caret",A),A=j(A,O),a("tildes",A),A=T(A,O),a("xrange",A),A=_(A,O),a("stars",A),A),w=A=>!A||A.toLowerCase()==="x"||A==="*",j=(A,O)=>A.trim().split(/\s+/).map(L=>k(L,O)).join(" "),k=(A,O)=>{const L=O.loose?c[u.TILDELOOSE]:c[u.TILDE];return A.replace(L,(B,H,N,I,q)=>{a("tilde",A,B,H,N,I,q);let ne;return w(H)?ne="":w(N)?ne=`>=${H}.0.0 <${+H+1}.0.0-0`:w(I)?ne=`>=${H}.${N}.0 <${H}.${+N+1}.0-0`:q?(a("replaceTilde pr",q),ne=`>=${H}.${N}.${I}-${q} <${H}.${+N+1}.0-0`):ne=`>=${H}.${N}.${I} <${H}.${+N+1}.0-0`,a("tilde return",ne),ne})},S=(A,O)=>A.trim().split(/\s+/).map(L=>E(L,O)).join(" "),E=(A,O)=>{a("caret",A,O);const L=O.loose?c[u.CARETLOOSE]:c[u.CARET],B=O.includePrerelease?"-0":"";return A.replace(L,(H,N,I,q,ne)=>{a("caret",A,H,N,I,q,ne);let V;return w(N)?V="":w(I)?V=`>=${N}.0.0${B} <${+N+1}.0.0-0`:w(q)?N==="0"?V=`>=${N}.${I}.0${B} <${N}.${+I+1}.0-0`:V=`>=${N}.${I}.0${B} <${+N+1}.0.0-0`:ne?(a("replaceCaret pr",ne),N==="0"?I==="0"?V=`>=${N}.${I}.${q}-${ne} <${N}.${I}.${+q+1}-0`:V=`>=${N}.${I}.${q}-${ne} <${N}.${+I+1}.0-0`:V=`>=${N}.${I}.${q}-${ne} <${+N+1}.0.0-0`):(a("no pr"),N==="0"?I==="0"?V=`>=${N}.${I}.${q}${B} <${N}.${I}.${+q+1}-0`:V=`>=${N}.${I}.${q}${B} <${N}.${+I+1}.0-0`:V=`>=${N}.${I}.${q} <${+N+1}.0.0-0`),a("caret return",V),V})},T=(A,O)=>(a("replaceXRanges",A,O),A.split(/\s+/).map(L=>R(L,O)).join(" ")),R=(A,O)=>{A=A.trim();const L=O.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return A.replace(L,(B,H,N,I,q,ne)=>{a("xRange",A,B,H,N,I,q,ne);const V=w(N),oe=V||w(I),se=oe||w(q),ae=se;return H==="="&&ae&&(H=""),ne=O.includePrerelease?"-0":"",V?H===">"||H==="<"?B="<0.0.0-0":B="*":H&&ae?(oe&&(I=0),q=0,H===">"?(H=">=",oe?(N=+N+1,I=0,q=0):(I=+I+1,q=0)):H==="<="&&(H="<",oe?N=+N+1:I=+I+1),H==="<"&&(ne="-0"),B=`${H+N}.${I}.${q}${ne}`):oe?B=`>=${N}.0.0${ne} <${+N+1}.0.0-0`:se&&(B=`>=${N}.${I}.0${ne} <${N}.${+I+1}.0-0`),a("xRange return",B),B})},_=(A,O)=>(a("replaceStars",A,O),A.trim().replace(c[u.STAR],"")),M=(A,O)=>(a("replaceGTE0",A,O),A.trim().replace(c[O.includePrerelease?u.GTE0PRE:u.GTE0],"")),$=A=>(O,L,B,H,N,I,q,ne,V,oe,se,ae)=>(w(B)?L="":w(H)?L=`>=${B}.0.0${A?"-0":""}`:w(N)?L=`>=${B}.${H}.0${A?"-0":""}`:I?L=`>=${L}`:L=`>=${L}${A?"-0":""}`,w(V)?ne="":w(oe)?ne=`<${+V+1}.0.0-0`:w(se)?ne=`<${V}.${+oe+1}.0-0`:ae?ne=`<=${V}.${oe}.${se}-${ae}`:A?ne=`<${V}.${oe}.${+se+1}-0`:ne=`<=${ne}`,`${L} ${ne}`.trim()),z=(A,O,L)=>{for(let B=0;B<A.length;B++)if(!A[B].test(O))return!1;if(O.prerelease.length&&!L.includePrerelease){for(let B=0;B<A.length;B++)if(a(A[B].semver),A[B].semver!==s.ANY&&A[B].semver.prerelease.length>0){const H=A[B].semver;if(H.major===O.major&&H.minor===O.minor&&H.patch===O.patch)return!0}return!1}return!0};return Cb}var wb,az;function U7(){if(az)return wb;az=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],f=d.match(p);if(!f)throw new TypeError(`Invalid comparator: ${d}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new l(f[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 s(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("=")||s(this.semver,"<",d.semver,p)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||s(this.semver,">",d.semver,p)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}wb=t;const n=d_,{safeRe:r,t:o}=vy,s=are,a=H7,l=Oi,c=oc();return wb}const Yot=oc(),Kot=(e,t,n)=>{try{t=new Yot(t,n)}catch{return!1}return t.test(e)};var G7=Kot;const Xot=oc(),Jot=(e,t)=>new Xot(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var Zot=Jot;const Qot=Oi,est=oc(),tst=(e,t,n)=>{let r=null,o=null,s=null;try{s=new est(t,n)}catch{return null}return e.forEach(a=>{s.test(a)&&(!r||o.compare(a)===-1)&&(r=a,o=new Qot(r,n))}),r};var nst=tst;const rst=Oi,ost=oc(),sst=(e,t,n)=>{let r=null,o=null,s=null;try{s=new ost(t,n)}catch{return null}return e.forEach(a=>{s.test(a)&&(!r||o.compare(a)===1)&&(r=a,o=new rst(r,n))}),r};var ist=sst;const Sb=Oi,ast=oc(),lz=W7,lst=(e,t)=>{e=new ast(e,t);let n=new Sb("0.0.0");if(e.test(n)||(n=new Sb("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 s=null;o.forEach(a=>{const l=new Sb(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||lz(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||lz(n,s))&&(n=s)}return n&&e.test(n)?n:null};var cst=lst;const ust=oc(),dst=(e,t)=>{try{return new ust(e,t).range||"*"}catch{return null}};var pst=dst;const fst=Oi,lre=U7(),{ANY:hst}=lre,gst=oc(),mst=G7,cz=W7,uz=V7,yst=h_,xst=f_,vst=(e,t,n,r)=>{e=new fst(e,r),t=new gst(t,r);let o,s,a,l,c;switch(n){case">":o=cz,s=yst,a=uz,l=">",c=">=";break;case"<":o=uz,s=xst,a=cz,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(mst(e,t,r))return!1;for(let u=0;u<t.set.length;++u){const d=t.set[u];let p=null,f=null;if(d.forEach(h=>{h.semver===hst&&(h=new lre(">=0.0.0")),p=p||h,f=f||h,o(h.semver,p.semver,r)?p=h:a(h.semver,f.semver,r)&&(f=h)}),p.operator===l||p.operator===c||(!f.operator||f.operator===l)&&s(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};var g_=vst;const bst=g_,Cst=(e,t,n)=>bst(e,t,">",n);var wst=Cst;const Sst=g_,jst=(e,t,n)=>Sst(e,t,"<",n);var Est=jst;const dz=oc(),kst=(e,t,n)=>(e=new dz(e,n),t=new dz(t,n),e.intersects(t,n));var Tst=kst;const Rst=G7,Ast=rc;var Pst=(e,t,n)=>{const r=[];let o=null,s=null;const a=e.sort((d,p)=>Ast(d,p,n));for(const d of a)Rst(d,t,n)?(s=d,o||(o=d)):(s&&r.push([o,s]),s=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 pz=oc(),m_=U7(),{ANY:jb}=m_,om=G7,y_=rc,_st=(e,t,n={})=>{if(e===t)return!0;e=new pz(e,n),t=new pz(t,n);let r=!1;e:for(const o of e.set){for(const s of t.set){const a=Ost(o,s,n);if(r=r||a!==null,a)continue e}if(r)return!1}return!0},Ist=[new m_(">=0.0.0-0")],fz=[new m_(">=0.0.0")],Ost=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===jb){if(t.length===1&&t[0].semver===jb)return!0;n.includePrerelease?e=Ist:e=fz}if(t.length===1&&t[0].semver===jb){if(n.includePrerelease)return!0;t=fz}const r=new Set;let o,s;for(const h of e)h.operator===">"||h.operator===">="?o=hz(o,h,n):h.operator==="<"||h.operator==="<="?s=gz(s,h,n):r.add(h.semver);if(r.size>1)return null;let a;if(o&&s){if(a=y_(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(const h of r){if(o&&!om(h,String(o),n)||s&&!om(h,String(s),n))return null;for(const m of t)if(!om(h,String(m),n))return!1;return!0}let l,c,u,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(const h of t){if(d=d||h.operator===">"||h.operator===">=",u=u||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(l=hz(o,h,n),l===h&&l!==o)return!1}else if(o.operator===">="&&!om(o.semver,String(h),n))return!1}if(s){if(p&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===p.major&&h.semver.minor===p.minor&&h.semver.patch===p.patch&&(p=!1),h.operator==="<"||h.operator==="<="){if(c=gz(s,h,n),c===h&&c!==s)return!1}else if(s.operator==="<="&&!om(s.semver,String(h),n))return!1}if(!h.operator&&(s||o)&&a!==0)return!1}return!(o&&u&&!s&&a!==0||s&&d&&!o&&a!==0||f||p)},hz=(e,t,n)=>{if(!e)return t;const r=y_(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},gz=(e,t,n)=>{if(!e)return t;const r=y_(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var Mst=_st;const Eb=vy,mz=z7,$st=Oi,yz=rre,Dst=g0,Lst=Wrt,Nst=Grt,Fst=Yrt,Bst=Xrt,zst=Qrt,Hst=not,Wst=sot,Vst=lot,Ust=rc,Gst=pot,qst=got,Yst=p_,Kst=vot,Xst=wot,Jst=W7,Zst=V7,Qst=sre,eit=ire,tit=f_,nit=h_,rit=are,oit=Uot,sit=U7(),iit=oc(),ait=G7,lit=Zot,cit=nst,uit=ist,dit=cst,pit=pst,fit=g_,hit=wst,git=Est,mit=Tst,yit=Pst,xit=Mst;var vit={parse:Dst,valid:Lst,clean:Nst,inc:Fst,diff:Bst,major:zst,minor:Hst,patch:Wst,prerelease:Vst,compare:Ust,rcompare:Gst,compareLoose:qst,compareBuild:Yst,sort:Kst,rsort:Xst,gt:Jst,lt:Zst,eq:Qst,neq:eit,gte:tit,lte:nit,cmp:rit,coerce:oit,Comparator:sit,Range:iit,satisfies:ait,toComparators:lit,maxSatisfying:cit,minSatisfying:uit,minVersion:dit,validRange:pit,outside:fit,gtr:hit,ltr:git,intersects:mit,simplifyRange:yit,subset:xit,SemVer:$st,re:Eb.re,src:Eb.src,tokens:Eb.t,SEMVER_SPEC_VERSION:mz.SEMVER_SPEC_VERSION,RELEASE_TYPES:mz.RELEASE_TYPES,compareIdentifiers:yz.compareIdentifiers,rcompareIdentifiers:yz.rcompareIdentifiers};const xz=ls(vit),bit=e=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?typeof e=="string"&&e.includes(",")?[!1,'Comma (",") is not valid as a decimal separator. Use a period (".") instead.']:[!1,"Value must be a number"]:[!0,""]},Cit=(...e)=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},wit=e=>{const t=xz.clean(e)===e;return!xz.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},Sit=e=>J3(bi(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],jit=e=>{const t="Value must be a valid RE2 regex",n=e instanceof Error?e.message:"";if(!n)return t;const r=n.startsWith("error")?`Error${n.slice(5)}`:n;return`${t}. ${r}`},Eit=e=>{try{h3.compile(e)}catch(t){return[!1,jit(t)]}return[!0,""]},kit=e=>{if(lp(e))return Sit;if(Hne(e))return wit;if(zne(e))return bit;if(h0(e))return Eit;if(QP(e)||Bne(e))return Cit;throw new Error(`Unknown operator: ${e}`)},Tit=(e,t)=>{const n=new Set(e.map(({value:o})=>o));return nj(t,n)},Rit=(e,t)=>new Set(t.filter(({value:n})=>!e(n)).map(({value:n})=>n)),Ait=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},Pit=(e,t)=>{var m;const[n,r]=g.useReducer(yrt,hrt(e)),{deletedLegalValues:o,localConstraint:s}=g.useMemo(()=>{const{deletedLegalValues:y,...b}=n;return{deletedLegalValues:y,localConstraint:b}},[n]),a=g.useRef(t);g.useLayoutEffect(()=>{a.current=t}),g.useEffect(()=>{a.current(grt(s))},[s]);const{context:l}=iu(),c=g.useMemo(()=>Ait(l,s.contextName),[l,s.contextName]),u=g.useMemo(()=>kit(s.operator),[s.operator]),d=(...y)=>xy(s)&&y.every(b=>s.values.has(b))?y.length===1?[!1,`${y[0]} is already added.`]:[!1,"All the values are already added"]:u(...y);g.useEffect(()=>{var y,b;if((y=c.legalValues)!=null&&y.length&&((b=e.values)!=null&&b.length)){const x=Tit(c.legalValues,e.values);r({type:"deleted legal values update",payload:x})}},[e.values,c.legalValues]);const p=g.useMemo(()=>{var y;if((y=c.legalValues)!=null&&y.length&&c2(s))return Rit(b=>u(b)[0],c.legalValues)},[u,c.legalValues,s]),f=(m=c.legalValues)!=null&&m.length?{legalValues:c.legalValues,invalidLegalValues:p,deletedLegalValues:o}:void 0,h=u_(s);return{updateConstraint:r,constraint:s,validator:d,legalValueData:f,invertedDisabled:h}},_it=(e,t)=>{const r=!t.map(a=>a.name).includes(e.contextName),o=t.reduce(({project:a,global:l},c)=>(c.project?a.push(c):l.push(c),{project:a,global:l}),{project:[],global:[]}),s=a=>a.toSorted((l,c)=>l.name.localeCompare(c.name)).map(l=>({key:l.name,label:l.name}));return[o.project.length>0&&{groupHeader:"Project context fields",options:s(o.project)},o.global.length>0&&{groupHeader:"Global context fields",options:s(o.global)},r&&{groupHeader:"Deleted context fields",options:s([{name:e.contextName}])}].filter(Boolean)},Iit=v(a_,{shouldForwardProp:e=>e!=="hasValue"})(({theme:e,hasValue:t})=>({color:t?"inherit":e.palette.primary.main,width:"max-content",".MuiChip-icon":{transform:"translateX(50%)",fill:e.palette.primary.main,height:e.fontSizes.smallerBody,width:e.fontSizes.smallerBody}})),Oit=({currentValue:e,removeValue:t,setEditingOpen:n,editingOpen:r,validator:o})=>{const[s]=e?o(e):[!0],a=()=>{if(!e||!s){n(!0);return}n(!r)};return i.jsx(Iit,{hasValue:!!e,label:e||"Add value",onClick:a,icon:e?void 0:i.jsx(Eo,{}),onDelete:e?t:void 0})},Mit=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},g.createElement("path",{fill:"#615BC2",d:"M6.29 11.887V10.48h4.581v1.407H6.29Zm0 2.343v-1.406h4.581v1.406H6.29Zm7.147-2.343V10.48h4.583v1.407h-4.582Zm0 2.343v-1.406h4.583v1.406h-4.582Z"})),$it=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},g.createElement("path",{fill:"#9F9FA1",d:"M9.29 11.887V10.48h4.581v1.407H9.29Zm0 2.343v-1.406h4.581v1.406H9.29Z"}),g.createElement("rect",{width:1,height:18.374,x:16.453,y:3.949,fill:"#6E6E70",rx:.5,transform:"rotate(32.071 16.453 3.95)"})),Dit=v("button")(({theme:e})=>({display:"grid",placeItems:"center",padding:0,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,background:e.palette.secondary.light,border:`1px solid ${e.palette.secondary.border}`,color:e.palette.secondary.dark,fontWeight:e.typography.fontWeightBold,transition:"all 0.03s ease","&:not(:disabled):is(:hover, :focus-visible)":{outline:`1px solid ${e.palette.primary.main}`},"&:disabled":{color:e.palette.action.disabled,background:"transparent",border:`1px solid ${e.palette.action.disabledBackground}`,cursor:"not-allowed"}})),Lit=v(Mit)({path:{fill:"currentcolor"}}),Nit=v($it)(({theme:e})=>({path:{fill:e.palette.text.disabled},rect:{fill:e.palette.text.secondary}})),Fit=({inverted:e})=>e?i.jsx(Nit,{"aria-hidden":"true"}):i.jsx(Lit,{"aria-hidden":"true"}),Bit=({inverted:e,onToggleInverted:t,disabledText:n})=>{const r=!!n,o=n??`Make the selected operator${e?" inclusive":" exclusive"}`,s=n??(e?"The constraint operator is exclusive.":"The constraint operator is inclusive.");return i.jsx(wr,{title:o,arrow:!0,children:i.jsx("span",{children:i.jsx(Dit,{type:"button",onClick:t,disabled:r,"aria-label":s,children:i.jsx(Fit,{inverted:!!e})})})})},zit=({open:e,onClose:t})=>i.jsx(W3,{in:e,children:i.jsx(Dt,{severity:"info",icon:!1,onClose:t,sx:{mb:2},children:"Regex requires these SDK versions or newer: Node.js 6.10.0, Java 12.2.0, Ruby 6.5.0, Python 6.6.0, .NET 6.1.0, Go 6.2.0 - or a frontend SDK connected to Unleash or Unleash Enterpirse Edge 20.1.10."})}),Hit=({open:e,onOpen:t})=>e?null:i.jsx(Sn,{component:"button",variant:"body2",onClick:t,children:"View SDK requirements"}),Wit=()=>{const[e,t]=ai("regexSdkVersionAlert","open");return{open:e==="open",onClose:()=>t("closed"),onOpen:()=>t("open")}},Vit=v(K)(({theme:e})=>({padding:e.spacing(2),marginBottom:e.spacing(1)})),Uit=v(K)(({theme:e})=>({marginTop:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(1)})),Git=v("ul")(({theme:e})=>({listStyle:"none",padding:0,margin:e.spacing(1,0,0),display:"flex",flexDirection:"column",gap:e.spacing(.5)})),qit=v("li")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"stretch",gap:e.spacing(1),marginBottom:e.spacing(1)})),Yit=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),cre=v(xn)(({theme:e})=>({flexGrow:1,display:"flex",width:"100%","& .MuiFormHelperText-root":{marginLeft:0,marginTop:e.spacing(1)}})),Kit=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start",width:"100%",marginBlock:e.spacing(.5)})),Xit=v(K)(({theme:e})=>({display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:e.spacing(1)})),vz=v(K,{shouldForwardProp:e=>e!=="match"})(({theme:e,match:t})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),fontSize:e.fontSizes.smallBody,color:t?e.palette.success.main:e.palette.warning.main})),Jit=v(n0)(({theme:e})=>({color:e.palette.success.main,fontSize:e.fontSizes.mainHeader})),Zit=v(UA)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.mainHeader})),Qit=({match:e,testString:t})=>{const n=t==="";return e?i.jsxs(vz,{match:e,children:[i.jsx(Jit,{"aria-hidden":!0}),"Your regular expression matches",n?" an empty string.":""]}):i.jsxs(vz,{match:e,children:[i.jsx(Zit,{"aria-hidden":!0}),"Your regular expression does not match",n?" empty strings.":""]})},eat=v("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.caption.fontSize,marginTop:e.spacing(1)})),tat=g.memo(({input:e,index:t,totalCount:n,onEdit:r,onRemove:o,inputRefs:s})=>{const a=g.useCallback(u=>{s.current[t]=u},[s,t]),l=g.useCallback(u=>{r(e.id,u.target.value)},[e.id,r]),c=g.useCallback(u=>{u.key==="Enter"&&u.preventDefault()},[]);return i.jsxs(qit,{children:[i.jsxs(Yit,{children:[i.jsx(cre,{type:"text",placeholder:"Enter test value",size:"small",fullWidth:!0,value:e.testString,id:`test-input-${e.id}`,inputProps:{"aria-describedby":"test-strings-description"},inputRef:a,onChange:l,onKeyDown:c}),n>1&&i.jsx(wr,{title:"Remove test string",arrow:!0,children:i.jsx(Mt,{type:"button",size:"small","aria-label":`Remove test string ${t}: ${e.testString===""?"empty string":""}`,sx:{ml:"auto"},onClick:()=>o(e.id),children:i.jsx(So,{fontSize:"inherit"})})})]}),i.jsx(Qit,{match:e.match,testString:e.testString})]})}),nat=({matchesRegex:e})=>{const[t,n]=g.useState([{id:1,testString:"",match:!1}]),r=g.useRef([]),[o,s]=g.useState(null);g.useEffect(()=>{n(u=>u.map(d=>({...d,match:e(d.testString)})))},[e]),g.useEffect(()=>{var u;o!==null&&(o>-1&&((u=r.current[o])==null||u.focus()),s(null))},[o]);const a=g.useCallback((u,d)=>{n(p=>p.map(f=>f.id!==u?f:{...f,testString:d,match:e(d)}))},[e]),l=g.useCallback(()=>{s(t.length),n(u=>{const d=u.reduce((f,h)=>Math.max(f,h.id),0),p="";return[...u,{id:d+1,testString:p,match:e(p)}]})},[t.length,e]),c=g.useCallback(u=>{const d=t.findIndex(p=>p.id===u);t.length<=1||(s(Math.min(d,t.length-2)),n(p=>p.filter(f=>f.id!==u)))},[t]);return i.jsxs(Uit,{children:[i.jsx(J,{variant:"h3",children:"Test regex"}),i.jsx(J,{id:"test-strings-description",variant:"body2",children:"Enter test values to check Regex matching."}),i.jsx(Git,{children:t.map((u,d)=>i.jsx(tat,{input:u,index:d,totalCount:t.length,onEdit:a,onRemove:c,inputRefs:r},u.id))}),i.jsx(K,{children:i.jsx($e,{type:"button",variant:"text",size:"small",startIcon:i.jsx(Eo,{}),onClick:l,children:"Add test string"})})]})},rat=({initialValue:e,addValue:t,helpText:n,caseInsensitive:r,validator:o,editingOpen:s})=>{const{open:a,onClose:l,onOpen:c}=Wit(),[u,d]=g.useState(e||""),[p,f]=g.useState(""),h=g.useId(),m=g.useId(),y=g.useCallback(w=>{try{return h3.compile(u,r?h3.CASE_INSENSITIVE:void 0).matcher(w).find()}catch{return!1}},[u,r]),b=g.useCallback(w=>{if(w.length>100)return`Values cannot be longer than 100 characters (current: ${w.length})`;const[j,k]=o(w);return j?"":k},[o]),x=g.useCallback(w=>{if(w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),!(u!=null&&u.trim()))){f("Value cannot be empty or whitespace");return}},[u]),C=g.useCallback(w=>{d(w.target.value),f(b(w.target.value)),t(w.target.value)},[t,b]);return g.useEffect(()=>{s&&(d(e||""),f(b(e||"")))},[s,e,b]),i.jsxs(Vit,{children:[i.jsx(zit,{open:a,onClose:l}),i.jsxs(Xit,{children:[i.jsx(J,{variant:"h2",children:"Regular expression"}),i.jsx(Hit,{open:a,onOpen:c})]}),i.jsxs(Kit,{children:[i.jsx(tc,{children:i.jsx("label",{htmlFor:h,children:"Constraint Value"})}),i.jsxs(K,{sx:{display:"flex",flexDirection:"column",flexGrow:1},children:[i.jsx(cre,{id:h,multiline:!0,placeholder:"Enter RE2 regex value e.g.: [xyz]",value:u,onChange:C,onKeyDown:x,size:"small",variant:"outlined",fullWidth:!0,autoFocus:!0,error:!!p,helperText:p,"aria-describedby":m,"data-testid":"CONSTRAINT_VALUES_INPUT"}),n&&i.jsx(eat,{id:m,children:n})]})]}),i.jsx(nat,{matchesRegex:y})]})},oat={REGEX:"The REGEX operator does not support inversion"},sat=(e,t)=>{if(e)return oat[t]??"This operator does not support inversion"},iat=v("article")(({theme:e})=>({"--padding":e.spacing(2),backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`})),aat=v("div")(({theme:e})=>({"--gap":e.spacing(1),padding:"var(--padding)",display:"flex",flexFlow:"row nowrap",alignItems:"flex-start",justifyItems:"space-between",gap:"var(--gap)"})),ure=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:"var(--gap)",alignSelf:"flex-start"})),lat=v(ure)(({theme:e})=>({flexFlow:"row wrap"})),cat=v("div")(({theme:e})=>({display:"flex",gap:"var(--gap)",flexFlow:"row wrap",width:"100%",height:"min-content"})),uat=v("div")(({theme:e})=>({padding:"var(--padding)",borderTop:`1px dashed ${e.palette.divider}`})),dat=v(_f)(({theme:e})=>({fieldset:{border:"none",borderRadius:0},maxWidth:"25ch",minWidth:"7ch",":focus-within .MuiSelect-select":{background:"none"},":focus-within fieldset":{borderBottomStyle:"solid"},"label + &":{margin:0},"&::before":{borderColor:e.palette.divider},"&&:hover::before":{borderColor:e.palette.primary.main}})),pat=v(Mt)(({theme:e})=>({position:"absolute",right:e.spacing(1)})),fat=v(Sn)(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:.25})),hat=v("div")(({theme:e})=>({width:e.spacing(2)})),gat=({addValues:e,clearValues:t,localConstraint:n,validator:r,addValuesButtonRef:o,setEditingOpen:s,editingOpen:a})=>Qne(n)?i.jsx(ert,{setValue:e,value:n.value,validator:r}):frt(n)?i.jsx(RB,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"A semver value should be of the format X.Y.Z",inputType:"text"}):c_(n)?i.jsx(Oit,{removeValue:t,currentValue:n.value,validator:r,editingOpen:a,setEditingOpen:s}):prt(n)?i.jsx(RB,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"Add a single number",inputType:"number"}):i.jsx(Dnt,{validator:r,helpText:"Maximum 100 char length per value",ref:o,onAddValues:e}),mat=({addValues:e,localConstraint:t,legalValueData:n,toggleValue:r,clearAll:o,editingOpen:s,validator:a})=>n?i.jsx(uat,{children:xy(t)?i.jsx(urt,{values:t.values,toggleValue:r,clearAll:o,addValues:e,...n}):i.jsx(drt,{toggleValue:r,value:t.value,...n})}):c_(t)&&s?i.jsx(rat,{initialValue:t.value,caseInsensitive:!!t.caseInsensitive,addValue:e,validator:a,editingOpen:s,helpText:i.jsxs(i.Fragment,{children:["A regex value should be a valid"," ",i.jsxs(fat,{href:"https://github.com/google/re2/wiki/Syntax",target:"_blank",rel:"noopener noreferrer",children:["RE2 regular expression",i.jsx(Hp,{sx:{fontSize:"inherit"}})]})]})}):null,yat=({onDelete:e,constraint:t,onUpdate:n})=>{const{constraint:r,updateConstraint:o,validator:s,legalValueData:a,invertedDisabled:l}=Pit(t,n);let c=!1;if(c2(r)&&c_(r)){const[R]=r.value?s(r.value):[!0];c=!r.value||!R}const[u,d]=g.useState(c);g.useEffect(()=>{c&&d(!0)},[c]);const p=g.useCallback(R=>o({type:"add value(s)",payload:R}),[o]),f=g.useCallback(R=>o({type:"remove value",payload:R}),[o]),h=g.useCallback(()=>o({type:"clear values"}),[o]),m=g.useCallback(R=>o({type:"toggle value",payload:R}),[o]),y=g.useCallback(R=>{o({type:"set operator",payload:R})},[o]),b=g.useCallback(()=>o({type:"toggle inverted operator"}),[o]),x=g.useCallback(()=>{o({type:"toggle case sensitivity"})},[o]),{context:C}=iu(),{contextName:w,operator:j}=r,k=QP(j)||h0(j),S=g.useRef(null),E=g.useRef(null);if(!C)return null;const T=_it(r,C);return i.jsxs(iat,{children:[i.jsxs(aat,{children:[i.jsxs(cat,{children:[i.jsxs(ure,{children:[i.jsx(dat,{visuallyHideLabel:!0,id:"context-field-select",name:"contextName",label:"Context Field",options:T,value:w||"",onChange:R=>o({type:"set context field",payload:R}),variant:"standard"}),i.jsxs(lat,{children:[i.jsx(Bit,{inverted:!!r.inverted,onToggleInverted:b,disabledText:sat(l,j)}),i.jsx(bnt,{options:Une(w),value:j,onChange:y,inverted:r.inverted}),k?i.jsx(znt,{caseInsensitive:!!r.caseInsensitive,onToggleCaseSensitivity:x}):null]})]}),i.jsx(Ant,{values:xy(r)?Array.from(r.values):a&&r.value?[r.value]:void 0,removeValue:f,getExternalFocusTarget:()=>E.current??S.current,children:a?null:i.jsx(gat,{localConstraint:r,addValues:p,clearValues:h,validator:s,addValuesButtonRef:E,editingOpen:u,setEditingOpen:d})})]}),i.jsx(hat,{}),i.jsx(wr,{title:"Delete constraint",arrow:!0,children:i.jsx(pat,{type:"button","data-testid":"DELETE_CONSTRAINT_BUTTON",size:"small",onClick:e,ref:S,children:i.jsx(So,{fontSize:"inherit"})})})]}),i.jsx(mat,{localConstraint:r,legalValueData:a,editingOpen:u,toggleValue:m,addValues:p,clearAll:h,validator:s})]})},dre=e=>{const t=Une(e)[0],n=lp(t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1,[Vl]:crypto.randomUUID()}},xat=v("div")({width:"100%",display:"flex",flexDirection:"column"}),vat=g.memo(({constraint:e,setConstraints:t,index:n})=>{const r=g.useCallback(()=>t(Nl(s=>{s.splice(n,1)})),[t,n]),o=g.useCallback(s=>t(Nl(a=>{a.splice(n,1,s)})),[t,n]);return i.jsx(yat,{constraint:e,onDelete:r,onUpdate:o})}),pre=g.forwardRef(({constraints:e,setConstraints:t},n)=>{const{context:r}=iu();return g.useImperativeHandle(n,()=>({addConstraint(o){if(t){const s=dre(o);t(a=>[...a,s])}}})),g.useEffect(()=>{e.every(o=>Vl in o)||t(e.map(o=>({[Vl]:crypto.randomUUID(),...o})))},[e,t]),r.length===0?null:i.jsx(xat,{children:i.jsx(L7,{children:e.map((o,s)=>i.jsx(vat,{constraint:o,setConstraints:t,index:s},o[Vl]))})})}),fre=(e,t)=>e.value&&e.contextName===f3?ji(e.value,t.locale):e.value,bat=v(D7)({whiteSpace:"pre"}),Cat=v(Ti)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),wat=v("div")(({theme:e})=>({width:"300px",marginBottom:e.spacing(2)})),Sat=({values:e})=>{const[t,n]=g.useState("");return!e||e.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:e.length>20,show:i.jsx(wat,{children:i.jsx(Jne,{filter:t,setFilter:n})})}),e.filter(r=>r.includes(t)).map((r,o)=>i.jsx(Cat,{label:i.jsx(bat,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},jat=v("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),Eat=v("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),kat=v(Ti)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),Tat=({value:e,operator:t})=>e?i.jsxs(jat,{children:[i.jsxs(Eat,{children:["Value must be ",t]})," ",i.jsx(kat,{label:i.jsx(D7,{maxWidth:"400",text:e,maxLength:50})})]}):null,Rat=v("div")(({theme:e})=>({padding:e.spacing(1,0),maxHeight:"400px",overflowY:"auto"})),Aat=({constraint:e})=>{const{locationSettings:t}=$r();return i.jsx("div",{children:i.jsxs(Rat,{children:[i.jsx(Sat,{values:e.values}),i.jsx(Tat,{value:fre(e,t),operator:e.operator})]})})},n6="disabled-strategy-55d37c31-ca3f-4c19-bf86-9158824899bf",Pat=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",fontSize:e.typography.body2.fontSize,minHeight:e.spacing(4),[e.breakpoints.down("sm")]:{flexDirection:"column"}})),_at=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",flexGrow:1,position:"relative",[`.${n6} &`]:{filter:"grayscale(1)",color:e.palette.text.secondary},[e.breakpoints.down("sm")]:{width:"100%"}})),Iat=v("span")(({theme:e,align:t})=>({display:"block",flexShrink:0,fontSize:e.fontSizes.smallerBody,fontWeight:e.typography.fontWeightBold,color:e.palette.text.secondary,width:e.spacing(10),[e.breakpoints.down("sm")]:{width:"100%"},...t==="top"&&{alignSelf:"flex-start"}})),Mc=({type:e,children:t,alignType:n})=>i.jsxs(Pat,{children:[i.jsx(Iat,{align:n,children:e}),i.jsx(_at,{children:t})]}),Oat=v(Ti,{shouldForwardProp:e=>e!=="multiline"})(({theme:e,multiline:t})=>({borderRadius:`${e.shape.borderRadius}px`,padding:e.spacing(.25,0),fontSize:e.fontSizes.smallerBody,height:"auto",background:e.palette.secondary.light,border:`1px solid ${e.palette.secondary.border}`,color:e.palette.secondary.dark,fontWeight:e.typography.fontWeightBold,...t?{".MuiChip-label":{whiteSpace:"collapse"}}:{}})),vg=g.forwardRef((e,t)=>i.jsx(Oat,{size:"small",ref:t,...e})),Mat=v("div")(({theme:e})=>({flex:"1 1 0",[e.breakpoints.down("sm")]:{display:"block",float:"left"}})),$at=v(mr)({padding:0,margin:0}),Dat=v("li")(({theme:e})=>({padding:e.spacing(.25),display:"inline-block",span:{background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,display:"inline-block",padding:e.spacing(.25,1)}})),Lat=v("div")(({theme:e})=>({padding:e.spacing(.25,1),background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge})),p2=({values:e,tooltips:t,onSetTruncated:n})=>i.jsxs(Mat,{children:[e&&(e==null?void 0:e.length)===1?i.jsx(Lat,{children:i.jsx(mr,{title:e[0],arrow:!0,lines:2,onSetTruncated:()=>n==null?void 0:n(!1),children:i.jsx(ra,{title:(t==null?void 0:t[e[0]])||"",children:i.jsx("span",{children:e[0]})})})}):null,e&&(e==null?void 0:e.length)>1?i.jsx($at,{title:"",lines:2,onSetTruncated:n,component:"ul",children:e.map(r=>i.jsx(ra,{title:(t==null?void 0:t[r])||"",children:i.jsx(Dat,{children:i.jsx("span",{children:r})})},r))}):null]}),Nat=(e,t)=>{const{context:n}=iu(),r=g.useMemo(()=>n.find(({name:o})=>o===e),[e,n]);return g.useMemo(()=>Object.fromEntries((t==null?void 0:t.map(o=>{var s,a;return[o,(a=(s=r==null?void 0:r.legalValues)==null?void 0:s.find(({value:l})=>l===o))==null?void 0:a.description]}).filter(([o,s])=>!!s))||[]),[r,t])},Fat=(e,t)=>Bne(e)||QP(e)&&!t,Bat=({label:e,inverted:t})=>i.jsx(Rt,{title:t?`Not ${e}`:e,arrow:!0,children:i.jsx(vg,{label:ej(e,t),multiline:!0})}),zat=v(vg)(({theme:e})=>({alignSelf:"stretch",height:"auto",padding:0,"> span":{paddingInline:e.spacing(0)},svg:{path:{fill:"currentColor"},"--size":e.spacing(2.5),width:"var(--size)",height:"var(--size)"}})),Hat=()=>i.jsx(Rt,{title:"The match is case sensitive",arrow:!0,children:i.jsx(zat,{"aria-label":"The match is case sensitive",label:i.jsx(Yne,{style:{verticalAlign:"middle"},fill:"currentColor","aria-hidden":!0})})}),Wat=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),[e.breakpoints.up("sm")]:{gap:e.spacing(2),display:"grid",gridTemplateColumns:"repeat(3, auto)",placeItems:"center"}})),Vat=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5)})),Uat=v("div")(({theme:e})=>({maxWidth:"150px",paddingRight:e.spacing(.5),overflow:"hidden",[e.breakpoints.down("sm")]:{maxWidth:"unset"}})),Gat=({onSetTruncated:e,viewMore:t,...n})=>{const{caseInsensitive:r,contextName:o,inverted:s,operator:a,value:l,values:c}=n,{locationSettings:u}=$r(),d=l?[fre(n,u)||"",...c||[]]:c||[],p=Nat(o,c||[]);return i.jsx(Mc,{type:"Constraint",children:i.jsxs(Wat,{children:[i.jsx(Uat,{children:i.jsx(mr,{title:o,arrow:!0,children:o})}),i.jsxs(Vat,{children:[i.jsx(Bat,{label:a,inverted:s}),Fat(a,r)?i.jsx(Hat,{}):null]}),i.jsxs("div",{children:[i.jsx(p2,{values:d,onSetTruncated:e,tooltips:p}),t]})]})})},qat=v("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),Yat=v("div")(({theme:e})=>({display:"flex",alignItems:"stretch",[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",width:"100%"}})),Kat=v("p")(({theme:e})=>({color:e.palette.secondary.main,margin:e.spacing(.25,0,0,.75),fontSize:e.fontSizes.smallerBody})),Xat=({constraint:e,allowExpand:t,expanded:n})=>{var s;const[r,o]=g.useState(!1);return i.jsx(qat,{children:i.jsx(Yat,{children:i.jsx(Gat,{...e,onSetTruncated:a=>{o(a),t(a)},viewMore:r?i.jsx(Kat,{children:n?"View less":`View all (${(s=e.values)==null?void 0:s.length})`}):null})})})},Jat=v("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),Zat=v($e)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),Qat=({onUse:e})=>{const t=e&&(n=>{n.stopPropagation(),e()});return i.jsx(Jat,{children:i.jsx(te,{condition:!!t,show:i.jsx(Rt,{title:"Use constraint",arrow:!0,children:i.jsx(Zat,{variant:"text",color:"primary",onClick:t,"data-testid":"USE_CONSTRAINT_BUTTON",children:"Use this"})})})})},elt=Dp("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),tlt=({constraint:e,onUse:t,allowExpand:n,expanded:r,disabled:o})=>i.jsxs(elt,{children:[i.jsx(Xat,{constraint:e,allowExpand:n,expanded:r,disabled:o}),t?i.jsx(Qat,{onUse:t}):null]}),nlt=v(tu,{shouldForwardProp:e=>e!=="borderStyle"})(({theme:e,borderStyle:t="solid"})=>({border:`1px ${t} ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,boxShadow:"none",margin:0,"&:before":{opacity:"0"},overflow:"hidden"})),rlt=v(ru)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),olt=v(nu)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),slt=v("div")({display:"flex",flexDirection:"column",width:"100%"}),q7=({constraint:e,onUse:t,sx:n=void 0,disabled:r=!1,renderAfter:o,borderStyle:s="solid"})=>{const[a,l]=g.useState(!0),[c,u]=g.useState(!1),d=()=>{a&&u(!c)};return i.jsxs(nlt,{expanded:c,sx:n,borderStyle:s,children:[i.jsx(rlt,{expandIcon:null,onClick:d,sx:{cursor:a?"pointer":"default!important","&:hover":{cursor:a?"pointer":"default!important"}},tabIndex:a?0:-1,children:i.jsxs(slt,{children:[i.jsx(tlt,{constraint:e,onUse:t,allowExpand:l,disabled:r,expanded:c}),o]})}),i.jsx(olt,{children:i.jsx(Aat,{constraint:e})})]})},ilt=v("div")(({theme:e})=>({marginTop:e.spacing(3)})),alt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),llt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),clt=({setConstraints:e,constraints:t=[]})=>{const{items:n}=pne();if(n.length===0||!e)return null;const r=n.filter(o=>!t.some(s=>dne(s,o)));return r.length===0?null:i.jsxs(ilt,{children:[i.jsx(alt,{children:"Recently used constraints"}),i.jsx(llt,{children:r.map(o=>i.jsx(q7,{constraint:o,borderStyle:"dashed",onUse:()=>{e(s=>[...s,o])}},GS(o)))})]})},ult=e=>{const t=g.useRef(new WeakMap),[,n]=g.useState(0),r=g.useCallback((s,a)=>{t.current.set(s,a),n(l=>l+1)},[]),o=g.useCallback(s=>t.current.get(s),[]);return g.useMemo(()=>({set:r,get:o}),[r,o])},dlt=v("div")({width:"100%",display:"flex",flexDirection:"column"}),plt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),flt=e=>{var o;const{uiConfig:t}=ut(),n=((o=t.resourceLimits)==null?void 0:o.constraints)||30,r=e>=n;return{limit:n,limitReached:r}},hlt=(e,t)=>{const n=ult(),{context:r}=iu(),o=a=>{const l=dre(a);n.set(l,{editing:!0,new:!0}),e(c=>[...c,l])};return g.useImperativeHandle(t,()=>({addConstraint:o})),{onAdd:o&&(()=>{o(r[0].name)}),state:n,context:r}},glt=g.forwardRef(({constraints:e,setConstraints:t},n)=>{const{onAdd:r,context:o}=hlt(t,n),{limit:s,limitReached:a}=flt(e.length);return o.length===0?null:i.jsx(dlt,{children:i.jsxs("div",{children:[i.jsxs(plt,{children:[i.jsx(J,{children:"Constraints"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsx(K,{children:i.jsxs(J,{variant:"body2",children:["Constraints are advanced targeting rules that you can use to enable a feature flag for a subset of your users. Read more about constraints"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),t?i.jsx(pre,{ref:n,setConstraints:t,constraints:e}):null,i.jsx(K,{sx:l=>({marginTop:l.spacing(2),marginBottom:l.spacing(2)}),children:i.jsx(yy,{name:"constraints in this strategy",shortName:"constraints",currentValue:e.length,limit:s})}),i.jsx($e,{type:"button",onClick:r,startIcon:i.jsx(Eo,{}),variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",disabled:!!a,children:"Add constraint"}),i.jsx(clt,{setConstraints:t,constraints:e})]})})}),mlt=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},ylt=({strategy:e,setStrategy:t})=>{g.useEffect(()=>()=>{t(o=>o.constraints?{...o,constraints:o.constraints.filter(mlt)}:o)},[t]);const n=e.constraints||[],r=o=>{t(s=>({...s,constraints:o instanceof Function?o(s.constraints||[]):o}))};return i.jsx(glt,{constraints:n,setConstraints:r})},xlt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),vlt=v(Zl)({flex:1}),hre=({label:e,options:t,value:n=[],onChange:r,disabled:o,icon:s,width:a="215px"})=>{const l=Bt(),c=u=>{const{InputProps:d}=u;let p;return s!==null&&(p=i.jsx(Bp,{position:"start",children:s||i.jsx(Eo,{sx:{height:20,width:20,color:l.palette.primary.main}})})),i.jsx(xn,{...u,InputProps:{...d,startAdornment:p},variant:"outlined",sx:{width:a,"& .MuiOutlinedInput-root":{"& .MuiInputBase-input":{color:l.palette.primary.main,opacity:1,"&::placeholder":{color:l.palette.primary.main,fontWeight:"bold",opacity:1}},"& .MuiOutlinedInput-notchedOutline":{borderColor:l.palette.primary.main,opacity:.5},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"1px"}}},placeholder:e})};return i.jsx(xlt,{children:i.jsx(vlt,{options:t,value:n,onChange:(u,d)=>r(d||[]),renderInput:c,getOptionLabel:u=>u.label,disabled:o,size:"small",multiple:!0})})},blt=v("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.background.elevation1,color:e.palette.text.primary})),bz=v("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer",color:e.palette.secondary.dark})),Clt=v(ft)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),kb=e=>({fontSize:e.fontSizes.bodySize}),wlt=({segment:e,setSegments:t,preview:n,setPreview:r,"aria-controls":o})=>{const s=()=>{t(u=>u.filter(d=>d.id!==e.id)),r(u=>u===e?void 0:u)},a=()=>{r(u=>u===e?void 0:e)},l=i.jsx(te,{condition:e===n,show:i.jsx(uP,{titleAccess:"Hide",sx:kb}),elseShow:i.jsx(dy,{titleAccess:"Show",sx:kb})}),c=e===n?"Hide segment constraints":"Preview segment constraints";return i.jsxs(blt,{children:[i.jsx(Clt,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),i.jsx(Rt,{title:c,arrow:!0,children:i.jsx(bz,{type:"button",onClick:a,"aria-expanded":e===n,"aria-controls":o,children:l})}),i.jsx(Rt,{title:"Remove segment",arrow:!0,children:i.jsx(bz,{type:"button",onClick:s,children:i.jsx(i_,{titleAccess:"Remove",sx:kb})})})]})},Slt=v(Ene)(()=>({padding:0})),jlt=v(tu)(()=>({boxShadow:"none",margin:0,padding:0,"::before":{display:"none"}})),Elt=v(ru)(({theme:e})=>({fontSize:e.typography.body2.fontSize,minHeight:"unset",":focus-within":{backgroundColor:"inherit"}})),klt=v(nu)(({theme:e})=>({padding:e.spacing(.5,3,2.5)})),Tlt=v(ft)(({theme:e})=>({textDecoration:"none",paddingRight:e.spacing(.5),"&:hover":{textDecoration:"underline"}})),Rlt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:"auto"})),Alt=v($e)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),Plt=v("p")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),gre=({segment:e,isExpanded:t,headerContent:n,constraintList:r})=>{const[o,s]=g.useState(t||!1),a=g.useId(),l=g.useMemo(()=>{var c;return r||((c=e.constraints)!=null&&c.length?i.jsx(L7,{children:e.constraints.map((u,d)=>i.jsx(q7,{constraint:u},`${a0(u)}-${d}`))}):i.jsx(Plt,{children:"This segment has no constraints."}))},[r,e.constraints]);return i.jsx(Slt,{children:i.jsxs(jlt,{expanded:o,disableGutters:!0,TransitionProps:{mountOnEnter:!0,unmountOnExit:!0},children:[i.jsxs(Elt,{id:`segment-accordion-${e.id}`,tabIndex:-1,"aria-controls":a,children:[i.jsx(Mc,{type:"Segment",children:i.jsx(Tlt,{to:`/segments/edit/${e.id}`,children:e.name})}),n||null,t?null:i.jsx(Rlt,{children:i.jsx(Alt,{"aria-controls":a,size:"small",variant:"outlined",onClick:()=>s(c=>!c),children:o?"Close preview":"Preview"})})]}),i.jsx(klt,{children:l})]})})},_lt=v("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),Ilt=v("p")(({theme:e})=>({color:e.palette.text.secondary})),Olt=v("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})),Mlt=v("div")({display:"contents"}),$lt=v(Dt)(({theme:e})=>({marginTop:e.spacing(1.5),marginBottom:e.spacing(.5)})),Dlt=({segments:e,setSegments:t})=>{const[n,r]=g.useState(),o=e.length-1,s=g.useId();if(e.length===0)return null;const a=e.filter(c=>!c.constraints||c.constraints.length===0),l=a.length>0;return i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:e&&e.length>0,show:i.jsx(Ilt,{children:"Selected Segments"})}),i.jsx(te,{condition:l,show:i.jsxs($lt,{severity:"warning",children:[i.jsx("strong",{children:"Warning!"})," You are adding an empty segment",a.length>1?"s":""," (",a.map(c=>c.name).join(", "),"). This will activate this feature for ALL USERS."]})}),i.jsx(_lt,{children:e.map((c,u)=>i.jsxs(g.Fragment,{children:[i.jsx(wlt,{segment:c,setSegments:t,preview:n,setPreview:r,"aria-controls":s}),i.jsx(te,{condition:u<o,show:i.jsx(Olt,{children:"AND"})})]},c.id))}),i.jsx(Mlt,{id:s,children:i.jsx(te,{condition:!!n,show:i.jsx(gre,{segment:n,isExpanded:!0})})})]})},Ff=()=>{const{uiConfig:e}=ut();return{segmentValuesLimit:e.resourceLimits.segmentValues,strategySegmentsLimit:e.resourceLimits.strategySegments}},Llt=()=>{const{segmentValuesLimit:e}=Ff();return typeof e>"u"?null:i.jsxs(Dt,{severity:"info",children:["A segment can have"," ",i.jsxs("a",{href:"https://docs.getunleash.io/concepts/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," values across all of its constraints"]}),". ",i.jsx(mre,{})]})},Nlt=e=>{const{segmentValuesLimit:t}=Ff();return typeof t>"u"?null:i.jsxs(Dt,{severity:"error",children:["A segment can have"," ",i.jsxs("a",{href:"https://docs.getunleash.io/concepts/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","."]})},Flt=()=>{const{strategySegmentsLimit:e}=Ff();return typeof e>"u"?null:i.jsxs(Dt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",i.jsx(mre,{})]})},mre=()=>i.jsxs(i.Fragment,{children:[i.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),yre="https://docs.getunleash.io/concepts/segments",Blt=v(Ti)(({theme:e})=>({background:"transparent",height:"auto",fontSize:e.typography.body2.fontSize,padding:e.spacing(.5),border:`1px dashed ${e.palette.divider}`,"& .MuiChip-icon":{color:e.palette.neutral.main}})),zlt=({segment:e,setSegments:t})=>{const n=()=>{t(r=>r.some(o=>o.id===e.id)?r:[...r,e])};return i.jsx(Rt,{title:"Add segment",arrow:!0,children:i.jsx(Blt,{label:e.name,icon:i.jsx(Eo,{}),onClick:n,size:"small",variant:"outlined"})})},Hlt=v("div")(({theme:e})=>({marginTop:e.spacing(3)})),Wlt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Vlt=v("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),Ult=({setSegments:e,segments:t})=>i.jsxs(Hlt,{children:[i.jsx(Wlt,{children:"Recently used segments"}),i.jsx(Vlt,{children:t.map(n=>i.jsx(zlt,{segment:n,setSegments:e},n.id))})]}),Glt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),qlt=({segments:e,setSegments:t,availableSegments:n})=>{const{strategySegmentsLimit:r}=Ff(),{items:o}=fne(),s=n.filter(d=>o.includes(d.id)&&!e.find(p=>p.id===d.id)),a=!!(r&&e.length>=r),c=n.filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name})),u=([d])=>{const p=n.find(f=>String(f.id)===d.value);p&&t(f=>[...f,p])};return i.jsxs(i.Fragment,{children:[i.jsxs(Glt,{children:[i.jsx(J,{children:"Segments"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsx(K,{children:i.jsxs(J,{variant:"body2",children:["Segments are reusable sets of constraints that can be defined once and reused across feature toggle configurations. You can create a segment on the global or the project level. Read more about segments"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),a&&i.jsx(Flt,{}),i.jsx(hre,{label:"Select segments",options:c,onChange:u,disabled:a,icon:null,width:"175px"}),i.jsx(Dlt,{segments:e,setSegments:t}),s.length>0?i.jsx(Ult,{setSegments:t,segments:s}):null]})},Ylt=({title:e,setTitle:t})=>i.jsxs(K,{sx:{paddingBottom:n=>n.spacing(2)},children:[i.jsx(J,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),i.jsx(Yr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),Klt=e=>{const n=wo("projectId"),{segments:r,...o}=od(),s=n?({project:a})=>!a||a===n:({project:a})=>!a;return{segments:r==null?void 0:r.filter(s),...o}},x_=({name:e,value:t="",label:n="",options:r,onChange:o,id:s,disabled:a=!1,className:l,classes:c,formControlStyles:u={},...d})=>{const p=()=>r.map(f=>i.jsx(wn,{value:f.key,title:f.title||"","data-testid":`${pT}-${f.label}`,children:f.label},f.key));return i.jsxs(Ko,{variant:"outlined",size:"small",classes:c,style:u,children:[i.jsx(Gl,{htmlFor:s,children:n}),i.jsx(na,{name:e,disabled:a,onChange:o,className:l,label:n,id:s,value:t,...d,children:p()})]})},Xlt=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const s=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 i.jsx(xn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:s,style:{width:"100%"},variant:"outlined",size:"small"})},Jlt=v("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"}}})),Zlt=v(x_)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),Qlt=v("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),ect=v(Xlt)(()=>({width:"100%"})),tct=v(xn)(()=>({width:"100%"})),nct=({overrides:e,overridesDispatch:t})=>{const{context:n}=iu(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},s=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return i.jsx(i.Fragment,{children:e.map((a,l)=>{var p;const c=n.find(({name:f})=>f===a.contextName),u=((p=c==null?void 0:c.legalValues)==null?void 0:p.map(({value:f})=>f))||[],d=a.values.filter(f=>u.includes(f));return i.jsxs(Jlt,{children:[i.jsx(Zlt,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:a.contextName,options:r,onChange:f=>t({type:"UPDATE_TYPE_AT",payload:[l,f.target.value]})}),i.jsxs(Qlt,{children:[i.jsx(te,{condition:!!(u&&u.length>0),show:i.jsx(Zl,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(f,h)=>f===h,options:u,onChange:s(l),getOptionLabel:f=>f,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:f=>i.jsx(tct,{...f,variant:"outlined",label:"Legal values"})}),elseShow:i.jsx(ect,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),i.jsx(Rt,{title:"Remove",arrow:!0,children:i.jsx(Mt,{onClick:f=>{f.preventDefault(),t({type:"REMOVE",payload:l})},children:i.jsx(So,{})})})]})]},`override=${l}`)})})},rct=(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,s)=>s===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,s)=>s===n?{...o,contextName:r}:o)}}},oct=(e=[])=>g.useReducer(rct,e);var ju=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(ju||{});const sct=tt.lazy(()=>La(()=>import("./ReactJSONEditor-9cJL1vJY.js"),[])),ict=v("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"})),act=v("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),lct=v(Rt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),xre=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Cz=v(xre)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),cct=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),uct=v(Ur)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),dct=v("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),wz=v(Yr)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),pct=v("div")(({theme:e})=>({marginLeft:e.spacing(3)})),fct=v(Yr)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),hct=v("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),vre=v("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%"}}})),gct=v(vre)({alignItems:"end",justifyContent:"space-between"}),mct=v(x_)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),yct=v($e)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),xct=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"},{key:"number",label:"number"}],vct={type:"string",value:""},bct=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:s=!1,decorationColor:a,weightsError:l})=>{const[c,u]=g.useState(e.name),[d,p]=g.useState(e.weightType===ju.FIX),[f,h]=g.useState(String(e.weight/10)),[m,y]=g.useState(e.payload||vct),[b,x]=oct("overrides"in e?e.overrides||[]:[]),{context:C}=iu(),[w,j]=g.useState({}),k=N=>{j(I=>({...I,[N]:void 0}))},S=(N,I)=>{j(q=>({...q,[N]:I}))};g.useEffect(()=>{k("percentage"),o!=null&&o.includes("%")&&S("percentage","Total weight must equal 100%")},[o]);const E=!e.new,T=t.filter(({id:N,weightType:I})=>N!==e.id&&I===ju.VARIABLE).length>0,R=N=>{const I=N.weightType===ju.VARIABLE,q=t.some(V=>V.weightType===ju.FIX),ne=t.filter(V=>V.weightType===ju.VARIABLE).length===1;return q&&ne&&I},_=N=>{k("name"),O(N,e.id)||S("name","A variant with that name already exists for this environment."),u(N.trim())},M=N=>{(N===""||L(N))&&h(N)},$=N=>{B(N)||S("payload",N.type==="json"?"Invalid json":"Invalid number")},z=()=>{C.length>0&&x({type:"ADD",payload:{contextName:C[0].name,values:[]}})},A=N=>!!N.length,O=(N,I)=>E||!t.some(q=>q.name===N&&q.id!==I),L=N=>{if(!d)return!0;if(N===""||N.match(/\.[0-9]{2,}$/))return!1;const I=Number(N);return I>=0&&I<=100},B=N=>{try{return N.type==="json"&&JSON.parse(N.value),N.type==="number"?!Number.isNaN(Number(N.value)):!0}catch{return!1}};g.useEffect(()=>{const N={...e,name:c,weight:Number(d?f:100)*10,weightType:d?ju.FIX:ju.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:m.value?m:void 0,isValid:A(c)&&O(c,e.id)&&L(f)&&B(m)&&!o};s||(N.overrides=b.map(I=>({contextName:I.contextName,values:I.values})).filter(I=>I.values&&I.values.length>0)),n(N)},[c,d,f,m,b]),g.useEffect(()=>{d||h(String(e.weight/10))},[e.weight]);const H=w!=null&&w.percentage||l?"Total weight may not exceed 100%":"";return i.jsxs(ict,{"data-testid":"VARIANT",children:[i.jsx(act,{color:a}),i.jsx(lct,{arrow:!0,title:R(e)?"You need to have at least one variable variant":"Delete variant",children:i.jsx("div",{children:i.jsx(Mt,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:R(e),children:i.jsx(So,{})})})}),i.jsxs(gct,{children:[i.jsxs(hct,{children:[i.jsx(xre,{children:"Variant name"}),i.jsx(cct,{children:"This will be used to identify the variant in your code"}),i.jsx(wz,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:c,onChange:N=>_(N.target.value),disabled:E,required:!0})]}),i.jsx(te,{condition:T,show:i.jsxs(pct,{children:[i.jsx(uct,{label:"Custom percentage",control:i.jsx(oa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:d,onChange:N=>p(N.target.checked)})}),i.jsx(fct,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!H,errorText:H,value:f,onChange:N=>M(N.target.value),required:d,disabled:!d,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:i.jsx(Bp,{position:"end",children:"%"})}})]})})]}),i.jsxs(Cz,{children:["Payload",i.jsx(Zo,{tooltip:"Passed along with the the variant object."})]}),i.jsxs(vre,{children:[i.jsx(mct,{id:"variant-payload-type",name:"type",label:"Type",value:m.type,options:xct,onChange:N=>{k("payload"),y(I=>({...I,type:N.target.value}))}}),i.jsx(dct,{children:i.jsx(te,{condition:m.type==="json",show:i.jsx(g.Suspense,{fallback:null,children:i.jsx(sct,{content:{text:m.value},onChange:N=>y(I=>{var q;return{...I,value:"json"in N?((q=N.json)==null?void 0:q.toString())||"":N.text}})})}),elseShow:i.jsx(wz,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:m.type!=="string",rows:m.type==="string"||m.type==="number"?1:4,value:m.value,onChange:N=>{k("payload"),y(I=>({...I,value:N.target.value}))},placeholder:"",onBlur:()=>$(m),error:!!w.payload,errorText:w.payload})})})]}),s?null:i.jsxs(i.Fragment,{children:[i.jsxs(Cz,{children:["Overrides",i.jsx(Zo,{tooltip:"Here you can specify which users should get this variant."})]}),i.jsx(nct,{overrides:b,overridesDispatch:x}),i.jsx("div",{children:i.jsx(yct,{onClick:z,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})},Cct=v(K)(({theme:e})=>({display:"flex",flexDirection:"column"})),wct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",minWidth:"250px",gap:e.spacing(1)})),Sct=v(K)(({theme:e})=>({padding:e.spacing(1,0,.75,0),flexDirection:"column"})),jct=v("span")(({theme:e})=>({marginBottom:e.spacing(1),fontSize:e.typography.body2.fontSize})),Ect=v(K,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({display:"flex",alignItems:"center",figure:{margin:0,padding:0,width:e.spacing(1.6),height:e.spacing(1.6),borderRadius:"50%",background:e.palette.variants[t%e.palette.variants.length]}})),kct=v("span")(({theme:e})=>({display:"inline-block",background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.25,1),align:"center",fontSize:e.fontSizes.smallBody})),Tct=v("code")(({theme:e})=>({display:"inline-block",background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.25,1),fontSize:e.fontSizes.smallerBody})),Rct=({variant:{name:e,weight:t,payload:n},index:r,selected:o})=>i.jsxs(Cct,{children:[i.jsxs(wct,{children:[i.jsx(Ect,{index:r,children:i.jsx("figure",{})}),i.jsxs(J,{variant:"subtitle2",children:[t/10,"% - ",e]})]}),n?i.jsxs(Sct,{sx:{display:["json","csv"].includes(n.type)?"flex":"block"},children:[i.jsxs(jct,{children:[i.jsx(kct,{children:n.type})," payload: "]}),i.jsx(Tct,{children:n.value})]}):null]}),Act=v(K)(()=>({display:"flex",width:"100%",position:"relative"})),Pct=v(K)(({theme:e,selected:t})=>({position:"relative",fontSize:e.fontSizes.smallerBody,...t?{fontWeight:e.typography.fontWeightBold}:{}})),_ct=v(K,{shouldForwardProp:e=>!["index","hasError","isFirst","isLast"].includes(e)})(({theme:e,index:t,hasError:n,isFirst:r,isLast:o})=>({height:e.spacing(2),width:"100%",position:"relative",color:n?e.palette.error.main:"inherit",background:e.palette.variants[t%e.palette.variants.length],...r?{borderTopLeftRadius:e.shape.borderRadius,borderBottomLeftRadius:e.shape.borderRadius}:{},...o?{borderTopRightRadius:e.shape.borderRadius,borderBottomRightRadius:e.shape.borderRadius}:{}})),Ict=v(K)(({theme:e})=>({padding:e.spacing(.25,.25),lineHeight:1})),Oct=v(K)(({theme:e})=>({padding:e.spacing(.125,.25,0),overflow:"hidden",color:e.palette.text.secondary})),Mct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),$ct=v(J)(({theme:e})=>({marginY:e.spacing(1)})),bre=({variants:e,weightsError:t,header:n=!0,selected:r})=>e.length<1?null:i.jsxs(K,{sx:o=>({marginTop:o.spacing(n?2:0)}),children:[n?i.jsx(Mct,{children:i.jsxs($ct,{variant:"body2",children:["Flag variants (",e.length,")"]})}):null,i.jsx(Act,{children:e.map((o,s)=>{const a=o.weight/10;return a===0?null:i.jsx(ra,{variant:"custom",arrow:!0,onClick:l=>l.preventDefault(),titleComponent:i.jsx(Rct,{variant:o,index:s,selected:r===o.name}),children:i.jsxs(Pct,{sx:{width:`${a}%`},selected:r===o.name,children:[i.jsx(_ct,{index:s,isFirst:s===0,isLast:s===e.length-1,hasError:t,children:i.jsx(Ict,{children:i.jsx(mr,{lines:1,children:`${a}%`})})}),i.jsx(Oct,{children:i.jsx(mr,{lines:1,children:o.name})})]})},s)})})]}),Dct=()=>i.jsxs(Dt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",i.jsx(Lct,{}),"."]}),qqt=()=>i.jsxs(Dt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",i.jsx("b",{children:"variants inside strategies"}),". ",i.jsx(Nct,{})]}),Lct=()=>i.jsx("a",{href:"https://docs.getunleash.io/concepts/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),Nct=()=>i.jsx("a",{href:"https://docs.getunleash.io/concepts/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),Fct=v("div")({display:"flex",flexDirection:"column"}),Bct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),zct=({strategy:e,setStrategy:t,canRenamePreexistingVariants:n})=>{const{trackEvent:r}=zt(),o=(e.variants||[]).map(f=>({...f,new:n||!1,isValid:!0,id:crypto.randomUUID(),overrides:[]})),[s,a]=g.useState(o),l=Bt(),c=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>()=>{t(f=>({...f,variants:s.filter(h=>!!h.name)}))},[JSON.stringify(s)]),g.useEffect(()=>{t(f=>({...f,variants:s.map(h=>({stickiness:c,name:h.name,weight:h.weight,payload:h.payload,weightType:h.weightType}))}))},[c,JSON.stringify(s)]);const u=(f,h)=>{a(m=>tN(m.map(y=>y.id===h?f:y),1e3))},d=()=>{const f=crypto.randomUUID();a(h=>[...h,{name:"",weightType:ju.VARIABLE,weight:0,stickiness:c,new:!0,isValid:!1,id:f}]),r("strategy-variants",{props:{eventType:"variant added"}})},p=s.reduce((f,h)=>f+(h.weight||0),0)!==1e3;return i.jsxs(i.Fragment,{children:[i.jsx(Dt,{severity:"info",icon:!1,children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),i.jsxs(Bct,{children:[i.jsx(J,{children:"Variants"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsx(K,{children:i.jsxs(J,{variant:"body2",children:["Variants in feature flagging allow you to serve different versions of a feature to different users. This can be used for A/B testing, gradual rollouts, and canary releases. Variants provide a way to control the user experience at a granular level, enabling you to test and optimize different aspects of your features. Read more about variants"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),i.jsxs(Fct,{children:[s.length>0&&i.jsx(Dct,{}),s.map((f,h)=>i.jsx(bct,{disableOverrides:!0,variant:f,variants:s,updateVariant:m=>u(m,f.id),removeVariant:()=>a(m=>tN(m.filter(y=>y.id!==f.id),1e3)),decorationColor:l.palette.variants[h%l.palette.variants.length],weightsError:p},f.id))]}),i.jsx($e,{sx:{width:"fit-content"},onClick:d,variant:"outlined","data-testid":"ADD_STRATEGY_VARIANT_BUTTON",startIcon:i.jsx(Eo,{}),children:"Add variant"}),i.jsx(bre,{variants:s,weightsError:p})]})},Hct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),Wct=v("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),Vct=v(xX)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),Uct=v(_4)(({theme:e})=>({width:"100px"})),Sz=v(an)(({theme:e})=>({marginLeft:e.spacing(1)})),Gct=v(K)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),qct=v(pr)(({theme:e})=>({width:"100%"})),Yct=v(jne)({top:"-10px",left:"0",transform:"translateY(0)"}),Kct=v("form")(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(6),paddingBottom:e.spacing(16),paddingTop:e.spacing(4),overflow:"auto",height:"100%"})),Xct=v("div")(({theme:e})=>({bottom:0,right:0,left:0,position:"absolute",display:"flex",gap:e.spacing(1),paddingTop:e.spacing(3),paddingRight:e.spacing(6),paddingLeft:e.spacing(6),paddingBottom:e.spacing(6),backgroundColor:e.palette.background.paper,justifyContent:"end",borderTop:`1px solid ${e.palette.divider}`})),Cre=({strategy:e,setStrategy:t,strategyDefinition:n,errors:r,validateParameter:o,canRenamePreexistingVariants:s,alertContent:a,generalTabExtras:l,beforeFooter:c,groupIdTooltip:u,children:d,onSubmit:p})=>{var $,z;const[f,h]=g.useState(0),m=(e==null?void 0:e.name)||(e==null?void 0:e.strategyName),{segments:y=[]}=Klt(),{segments:b=[]}=od(),x=g.useMemo(()=>new Map(b.map(A=>[A.id,A])),[b]),C=A=>A.map(O=>x.get(O)).filter(O=>!!O),w=C(e.segments||[]),j=A=>{t(O=>{const L=C(O.segments||[]),B=typeof A=="function"?A(L):A;return{...O,segments:B.map(H=>H.id)}})},k=y.length>0||((($=e.segments)==null?void 0:$.length)??0)>0,S=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>{t(A=>({...A,variants:(e.variants||[]).map(O=>({stickiness:S,name:O.name,weight:O.weight,payload:O.payload,weightType:O.weightType}))}))},[S,JSON.stringify(e.variants)]);const E=!!(e.parameters&&"stickiness"in e.parameters),T=(A,O)=>{h(O)},R=()=>{var L,B;const A=((L=e.constraints)==null?void 0:L.length)||0,O=((B=e.segments)==null?void 0:B.length)||0;return A+O},_=(A,O)=>{t(Nl(L=>{L.parameters=L.parameters??{},L.parameters[A]=O})),o==null||o(A,O)},M=A=>{t(O=>({...O,title:A}))};return i.jsxs(i.Fragment,{children:[i.jsx(Hct,{children:i.jsx(Wct,{children:Xl(m||"")})}),a,i.jsxs(Vct,{value:f,onChange:T,children:[i.jsx(Uct,{label:"General"}),i.jsx(_4,{"data-testid":"STRATEGY_TARGETING_TAB",label:i.jsxs(J,{children:["Targeting",i.jsx(Sz,{children:R()})]})}),E&&i.jsx(_4,{"data-testid":"STRATEGY_VARIANTS_TAB",label:i.jsxs(J,{children:["Variants",i.jsx(Sz,{children:((z=e.variants)==null?void 0:z.length)||0})]})})]}),i.jsxs(Kct,{onSubmit:A=>{A.preventDefault(),A.stopPropagation(),p(A)},children:[f===0&&i.jsxs(i.Fragment,{children:[i.jsx(Ylt,{title:e.title||"",setTitle:M}),i.jsx(unt,{strategy:e,strategyDefinition:n,updateParameter:_,errors:r,groupIdTooltip:u}),l]}),f===1&&i.jsxs(i.Fragment,{children:[i.jsx(Dt,{severity:"info",sx:{mb:2},icon:!1,children:"Segmentation and constraints allow you to set filters on your strategies, so that they will only be evaluated for users and applications that match the specified preconditions."}),k?i.jsxs(i.Fragment,{children:[i.jsx(qlt,{segments:w,setSegments:j,availableSegments:y}),i.jsxs(Gct,{children:[i.jsx(qct,{}),i.jsx(Yct,{})]})]}):null,i.jsx(ylt,{strategy:e,setStrategy:t})]}),f===2&&E&&i.jsx(zct,{strategy:e,setStrategy:t,canRenamePreexistingVariants:s}),c,i.jsx(Xct,{children:d})]})]})},Jct=v(K)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),wre=({feature:e,environmentId:t,permission:n,onSubmit:r,onCancel:o,loading:s,strategy:a,setStrategy:l,errors:c,changeRequestsEnabled:u,canRenamePreexistingVariants:d,Limit:p,disabled:f})=>{const{trackEvent:h}=zt(),[m,y]=g.useState(!1),b=$7(a.constraints),x=Stt(e,t),{strategyDefinition:C}=O7(a.name);g.useEffect(()=>{h("new-strategy-form",{props:{eventType:"seen"}})},[]);const w=e.environments.find(I=>I.name===t),{data:j}=nc(e.project),{changeRequestInReviewOrApproved:k,alert:S}=Cne(j),E=k(t||""),T=E?"Add to existing change request":"Add change to draft",{isOss:R}=ut(),_=(w==null?void 0:w.type)==="production"&&R(),M=$t(),{error:$,loading:z}=ut();if($)throw $;if(z||!C)return null;const A=I=>C.parameters.find(q=>q.name===I),O=(I,q)=>{const ne=btt(A(I),q);return ne?(c.setFormError(I,ne),!1):(c.removeFormError(I),!0)},L=()=>C.parameters.map(I=>I.name).map(I=>{var q;return O(I,(q=a.parameters)==null?void 0:q[I])}).every(Boolean),B=()=>{M(K7(e.project,e.name))},H=async()=>{var I;Array.isArray(a.variants)&&((I=a.variants)==null?void 0:I.length)>0&&h("strategy-variants",{props:{eventType:"submitted"}}),L()&&(h("new-strategy-form",{props:{eventType:"submitted"}}),x&&!u?y(!0):r())},N=E?S:u?i.jsx(bne,{environment:t}):null;return i.jsxs(Cre,{strategy:a,setStrategy:l,strategyDefinition:C,errors:c,validateParameter:O,canRenamePreexistingVariants:d,alertContent:N?i.jsx(Jct,{children:N}):null,generalTabExtras:i.jsxs(i.Fragment,{children:[i.jsx(Ttt,{enabled:!(a!=null&&a.disabled),onToggleEnabled:()=>l(I=>({...I,disabled:!I.disabled}))}),u?null:i.jsx(xtt,{projectId:e.project,featureId:e.name,environmentId:t})]}),onSubmit:H,beforeFooter:i.jsxs(i.Fragment,{children:[i.jsx(K,{sx:{flex:1,display:"flex",alignItems:"flex-end"},children:p}),_?i.jsx($tt,{}):null]}),children:[i.jsx(lo,{permission:n,projectId:e.project,environmentId:t,variant:"contained",color:"primary",type:"submit",disabled:f||s||!b||c.hasFormErrors(),"data-testid":Nje,children:u?T:"Save strategy"}),i.jsx($e,{type:"button",color:"primary",onClick:o||B,disabled:s,children:"Cancel"}),i.jsx(wtt,{open:m,onClose:()=>y(!1),onClick:r,loading:s,label:"Save strategy"})]})},Zct=e=>fetch(e).then(en("ChangeRequest")).then(t=>t.json()),v_=(e,t)=>{const{data:n,error:r,mutate:o}=f0([],yt(`api/admin/projects/${e}/change-requests/scheduled?strategyId=${t}`),Zct);return{changeRequests:n,loading:!r&&!n,refetch:o,error:r}},Qct=(e,t,n,r)=>(e==null?void 0:e.filter(o=>{var s;return(s=o.features.find(a=>a.name===t))==null?void 0:s.changes.some(a=>a.action==="updateStrategy"&&a.payload.id===n)}).map(o=>({changeRequest:KP(r,o.id),state:o.state})))??[],eut=(e,t)=>(e==null?void 0:e.map(n=>({changeRequest:KP(t,n.id),state:"Scheduled"})))??[],tut=({value:e,values:t,inverted:n,operator:r,contextName:o,caseInsensitive:s})=>{const a=l=>({contextName:o,operator:r,...l,caseInsensitive:s,inverted:n});return o_(r)?a({value:e||""}):a({values:t||[]})},Y7=(e,t)=>e!=="constraints"||!Array.isArray(t)?t:t.map(tut),nut="default",rut=e=>{const{project:t,loading:n,error:r}=e0(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:nut,mode:t.mode,loading:n,error:r}},Sre=(e,t,n="default")=>{const r={};return t.parameters.forEach(o=>{r[o.name]=out(e,o,n)}),{name:t.name,constraints:[],parameters:r}},out=(e,t,n)=>t.name==="rollout"||t.name==="percentage"||t.type==="percentage"?"50":t.name==="stickiness"?n:t.name==="groupId"?e:t.type==="boolean"?"false":"",sj=(e,t)=>Fo(n=>typeof n!="string"?!1:n.includes(`projects/${e}/change-requests/pending/${t}`),void 0,{revalidate:!0}),sut=()=>{const[e,t]=g.useState(""),{trackEvent:n}=zt();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"}})}}},iut=e=>{if(e)return e==null?void 0:e.constraints.map(t=>({...t,[Vl]:crypto.randomUUID()}))},Yqt=()=>{const e=ar("projectId"),t=ar("featureId"),n=pB("environmentId"),r=pB("strategyId"),[o,s]=g.useState({name:""}),[a,l]=g.useState("default"),{updateStrategyOnFeature:c,updateMilestoneStrategyOnFeature:u,loading:d}=I7(),{strategyDefinition:p}=O7(o.name),{defaultStickiness:f}=rut(e),{setToastData:h,setToastApiError:m}=_t(),y=YP(),{uiConfig:b}=ut(),{unleashUrl:x}=b,C=$t(),{addChange:w}=ia(),{isChangeRequestConfigured:j}=vl(e),{refetch:k,data:S}=nc(e),E=wo("featureId"),{setPreviousTitle:T}=sut(),{feature:R,refetchFeature:_}=ws(e,t),M=g.useRef(R),{data:$,staleDataNotification:z,forceRefreshCache:A}=yne({unleashGetter:ws,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},R,{afterSubmitAction:_},xne);g.useEffect(()=>{M.current.name===""&&R.name&&(A(R),M.current=R)},[R]);const{trackEvent:O}=zt(),{changeRequests:L}=v_(e,r),B=Qct(S,t,r,b),H=eut(L,b),N=()=>[...B,...H].forEach(oe=>{O("change_request",{props:{...oe,action:"edit-strategy",eventType:"conflict-created"}})});g.useEffect(()=>{var _e;const oe=$==null?void 0:$.environments.find(we=>we.name===n);if(!oe)return;const ae=oe.strategies.find(we=>we.id===r)??((_e=oe.releasePlans)==null?void 0:_e.flatMap(we=>we.milestones.flatMap(Me=>Me.strategies)).find(we=>we.id===r));ae&&"milestoneId"in ae&&l("milestone");const me=iut(ae),ce={...ae,constraints:me,name:(ae==null?void 0:ae.name)||(ae==null?void 0:ae.strategyName)};s(we=>({...we,...ce})),T((ae==null?void 0:ae.title)||"")},[r,$]),g.useEffect(()=>{if(!p)return;const oe=Sre(t,p,f).parameters;s(se=>({...se,parameters:{...oe,...se.parameters}}))},[f,p==null?void 0:p.name]);const I=aut(o),q=async oe=>{await(a==="milestone"?u:c)(e,t,n,r,oe),h({text:"Strategy updated",type:"success"})},ne=async oe=>{await w(e,n,{action:a==="milestone"?"updateMilestoneStrategy":"updateStrategy",feature:t,payload:{...oe,id:r}}),h({text:"Change added to draft",type:"success"}),k(),await Promise.all([k(),E?sj(e,E):Promise.resolve()])},V=async()=>{a==="milestone"&&O("edit-milestone-strategy",{props:{eventType:"form submitted"}});try{j(n)?await ne(I):await q(I),N(),_(),C(K7(e,t))}catch(oe){m(pt(oe))}};return!o.id||!p||!$?null:i.jsxs(eo,{modal:!0,disablePadding:!0,description:jre,documentationLink:Ere,documentationLinkLabel:kre,formatApiCode:()=>lut({strategyScope:a,projectId:e,featureId:t,environmentId:n,strategyId:r,strategy:I,strategyDefinition:p,unleashUrl:x}),children:[i.jsx(wre,{feature:$,strategy:o,setStrategy:s,environmentId:n,onSubmit:V,loading:d,permission:wp,errors:y,changeRequestsEnabled:j(n)}),z]})},aut=e=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:e.segments??[],disabled:e.disabled??!1}),K7=(e,t)=>`/projects/${e}/features/${t}`,X7=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},lut=({strategyScope:e="default",projectId:t,featureId:n,environmentId:r,strategyId:o,strategy:s,strategyDefinition:a,unleashUrl:l})=>{if(!l)return"";const c={...s,parameters:Ket(s.parameters??{},a)},u=`${l}/api/admin/projects/${t}/features/${n}/environments/${r}`,d=e==="milestone"?`${u}/milestone-strategies/${o}`:`${u}/strategies/${o}`,p=JSON.stringify(c,Y7,2);return`curl --location --request PUT '${d}' \\
379
+ `)));let a=!0;for(;!t.more()||t.peek()!==Ie.CODES.get("]")||a;){if(t.more()&&t.lookingAt("-")&&!(this.flags&It.PERL_X)&&!a){const d=t.rest();if(d==="-"||!d.startsWith("-]"))throw t.rewindTo(n),new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.rest())}a=!1;const l=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,o))continue;t.rewindTo(l)}if(this.parseUnicodeClass(t,o)||this.parsePerlClassEscape(t,o))continue;t.rewindTo(l);const c=Tt.parseClassChar(t,n);let u=c;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(u=Tt.parseClassChar(t,n),u<c)throw new Kr(Tt.ERR_INVALID_CHAR_RANGE,t.from(l))}this.flags&It.FOLD_CASE?o.appendFoldedRange(c,u):o.appendRange(c,u)}t.skip(1),o.cleanClass(),s<0&&o.negateClass(),r.runes=o.toArray(),this.push(r)}};X(Tt,"ERR_INTERNAL_ERROR","regexp/syntax: internal error"),X(Tt,"ERR_INVALID_CHAR_RANGE","invalid character class range"),X(Tt,"ERR_INVALID_ESCAPE","invalid escape sequence"),X(Tt,"ERR_INVALID_NAMED_CAPTURE","invalid named capture"),X(Tt,"ERR_INVALID_PERL_OP","invalid or unsupported Perl syntax"),X(Tt,"ERR_INVALID_REPEAT_OP","invalid nested repetition operator"),X(Tt,"ERR_INVALID_REPEAT_SIZE","invalid repeat count"),X(Tt,"ERR_MISSING_BRACKET","missing closing ]"),X(Tt,"ERR_MISSING_PAREN","missing closing )"),X(Tt,"ERR_MISSING_REPEAT_ARGUMENT","missing argument to repetition operator"),X(Tt,"ERR_TRAILING_BACKSLASH","trailing backslash at end of expression"),X(Tt,"ERR_DUPLICATE_NAMED_CAPTURE","duplicate capture group name"),X(Tt,"ERR_UNEXPECTED_PAREN","unexpected )"),X(Tt,"ERR_NESTING_DEPTH","expression nests too deeply"),X(Tt,"ERR_LARGE","expression too large"),X(Tt,"MAX_HEIGHT",1e3),X(Tt,"MAX_SIZE",3355443),X(Tt,"MAX_RUNES",33554432),X(Tt,"ANY_TABLE",new pe(new Uint32Array([0,dn.MAX_RUNE,1])));let rj=Tt;class Trt{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}}class $d{static initTest(t){const n=$d.compile(t),r=new $d(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return $d.compileImpl(t,It.PERL,!1)}static compilePOSIX(t){return $d.compileImpl(t,It.POSIX,!0)}static compileImpl(t,n,r){let o=rj.parse(t,n);const s=o.maxCap();o=_l.simplify(o);const a=u2.compileRegexp(o),l=new $d(t,a,s,r),[c,u]=a.prefix();return l.prefixComplete=c,l.prefix=u,l.prefixUTF8=Rn.stringToUtf8ByteArray(l.prefix),l.prefix.length>0&&(l.prefixRune=l.prefix.codePointAt(0)),l.namedGroups=o.namedGroups,l}static match(t,n){return $d.compile(t).match(n)}constructor(t,n,r=0,o=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=o,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new Trt}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=Gh.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecute(t,n,r,o){let s=this.get(),a=!1;s?s.next!==null&&(s=Gh.fromMachine(s),a=!0):(s=Gh.fromRE2(this),a=!0),s.init(o);const l=s.match(t,n,r)?s.submatches():null;return this.put(s,a),l}match(t){return this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,0)!==null}matchWithGroup(t,n,r,o,s){return t instanceof kp||(t=t6.utf16(t)),this.matchMachineInput(t,n,r,o,s)}matchMachineInput(t,n,r,o,s){if(n>r)return[!1,null];const a=t.isUTF16Encoding()?Ho.fromUTF16(t.asCharSequence(),0,r):Ho.fromUTF8(t.asBytes(),0,r),l=this.doExecute(a,n,o,2*s);return l===null?[!1,null]:[!0,l]}matchUTF8(t){return this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let o=0,s=0,a="";const l=Ho.fromUTF16(t);let c=0;for(;s<=t.length;){const u=this.doExecute(l,s,It.UNANCHORED,2);if(u===null||u.length===0)break;a+=t.substring(o,u[0]),(u[1]>o||u[0]===0)&&(a+=n(t.substring(u[0],u[1])),c++),o=u[1];const d=l.step(s)&7;if(s+d>u[1]?s+=d:s+1>u[1]?s++:s=u[1],c>=r)break}return a+=t.substring(o),a}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let o=0;o<t.length;o++)r[o]=t[o];t=r}return t}allMatches(t,n,r=o=>o){let o=[];const s=t.endPos();n<0&&(n=s+1);let a=0,l=0,c=-1;for(;l<n&&a<=s;){const u=this.doExecute(t,a,It.UNANCHORED,this.prog.numCap);if(u===null||u.length===0)break;let d=!0;if(u[1]===a){u[0]===c&&(d=!1);const p=t.step(a);p<0?a=s+1:a+=p&7}else a=u[1];c=u[1],d&&(o.push(r(this.pad(u))),l++)}return o}findUTF8(t){const n=this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){const n=this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){const n=this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,2)}findUTF8Submatch(t){const n=this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,this.prog.numCap);if(n===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let o=0;o<r.length;o++)2*o<n.length&&n[2*o]>=0&&(r[o]=t.slice(n[2*o],n[2*o+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.doExecute(Ho.fromUTF8(t),0,It.UNANCHORED,this.prog.numCap))}findSubmatch(t){const n=this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,this.prog.numCap);if(n===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let o=0;o<r.length;o++)2*o<n.length&&n[2*o]>=0&&(r[o]=t.substring(n[2*o],n[2*o+1]));return r}findSubmatchIndex(t){return this.pad(this.doExecute(Ho.fromUTF16(t),0,It.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){const r=this.allMatches(Ho.fromUTF8(t),n,o=>t.slice(o[0],o[1]));return r.length===0?null:r}findAllUTF8Index(t,n){const r=this.allMatches(Ho.fromUTF8(t),n,o=>o.slice(0,2));return r.length===0?null:r}findAll(t,n){const r=this.allMatches(Ho.fromUTF16(t),n,o=>t.substring(o[0],o[1]));return r.length===0?null:r}findAllIndex(t,n){const r=this.allMatches(Ho.fromUTF16(t),n,o=>o.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){const r=this.allMatches(Ho.fromUTF8(t),n,o=>{let s=new Array(o.length/2|0).fill(null);for(let a=0;a<s.length;a++)o[2*a]>=0&&(s[a]=t.slice(o[2*a],o[2*a+1]));return s});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){const r=this.allMatches(Ho.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){const r=this.allMatches(Ho.fromUTF16(t),n,o=>{let s=new Array(o.length/2|0).fill(null);for(let a=0;a<s.length;a++)o[2*a]>=0&&(s[a]=t.substring(o[2*a],o[2*a+1]));return s});return r.length===0?null:r}findAllSubmatchIndex(t,n){const r=this.allMatches(Ho.fromUTF16(t),n);return r.length===0?null:r}}class k1{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){const n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,o=t.length;o===0&&(n="(?:)",r=!0);let s=0;for(;s<o;){let a=t[s];if(a==="\\"){if(s+1<o)switch(a=t[s+1],a){case"\\":{n+="\\\\",s+=2;continue}case"c":{if(s+2<o){let c=t[s+2];if(k1.isUpperCaseAlpha(c)){n+="\\x",n+=(c.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(c.charCodeAt(0)-64&15).toString(16).toUpperCase(),s+=3,r=!0;continue}}n+="\\c",s+=2;continue}case"u":{if(s+2<o){let c=t[s+2];if(k1.isHexadecimal(c)){n+="\\x{"+c,s+=3;for(let u=0;u<3&&s<o&&(c=t[s],!!k1.isHexadecimal(c));++s,++u)n+=c;n+="}",r=!0;continue}else if(c==="{"){n+="\\x",s+=2,r=!0;continue}}n+="\\u",s+=2;continue}default:{n+="\\";let c=k1.getUtf8CharSize(a);n+=t.substring(s+1,s+1+c),s+=c+1;continue}}}else if(a==="/"){n+="\\/",s+=1,r=!0;continue}else if(a==="("&&s+2<o&&t[s+1]==="?"&&t[s+2]==="<"&&(s+3>=o||t[s+3]!=="="&&t[s+3]!=="!")){n+="(?P<",s+=3,r=!0;continue}let l=k1.getUtf8CharSize(a);n+=t.substring(s,s+l),s+=l}return r?n:t}}const fi=class fi{static quote(t){return Rn.quoteMeta(t)}static translateRegExp(t){return k1.translate(t)}static compile(t,n=0){let r=t;if(n&fi.CASE_INSENSITIVE&&(r=`(?i)${r}`),n&fi.DOTALL&&(r=`(?s)${r}`),n&fi.MULTILINE&&(r=`(?m)${r}`),n&-32)throw new brt("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let o=It.PERL;n&fi.DISABLE_UNICODE_GROUPS&&(o&=-129);const s=new fi(t,n);return s.re2Input=$d.compileImpl(r,o,(n&fi.LONGEST_MATCH)!==0),s}static matches(t,n){return fi.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");const o=new fi(t,n);return o.re2Input=r,o}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.matcher(t).matches()}matcher(t){return Array.isArray(t)&&(t=t6.utf8(t)),new Crt(this,t)}split(t,n=0){const r=this.matcher(t),o=[];let s=0,a=0;for(;r.find();){if(a===0&&r.end()===0){a=r.end();continue}if(n>0&&o.length===n-1)break;if(a===r.start()){if(n===0){s+=1,a=r.end();continue}}else for(;s>0;)o.push(""),s-=1;o.push(r.substring(a,r.start())),a=r.end()}if(n===0&&a!==r.inputLength()){for(;s>0;)o.push(""),s-=1;o.push(r.substring(a,r.inputLength()))}return(n!==0||o.length===0)&&o.push(r.substring(a,r.inputLength())),o}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}};X(fi,"CASE_INSENSITIVE",1),X(fi,"DOTALL",2),X(fi,"MULTILINE",4),X(fi,"DISABLE_UNICODE_GROUPS",8),X(fi,"LONGEST_MATCH",16);let h3=fi;var oj={exports:{}};const Rrt="2.0.0",tre=256,Art=Number.MAX_SAFE_INTEGER||9007199254740991,Prt=16,_rt=tre-6,Irt=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var z7={MAX_LENGTH:tre,MAX_SAFE_COMPONENT_LENGTH:Prt,MAX_SAFE_BUILD_LENGTH:_rt,MAX_SAFE_INTEGER:Art,RELEASE_TYPES:Irt,SEMVER_SPEC_VERSION:Rrt,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},vb={};const Ort=typeof process=="object"&&vb&&vb.NODE_DEBUG&&/\bsemver\b/i.test(vb.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var H7=Ort;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=z7,s=H7;t=e.exports={};const a=t.re=[],l=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],d=t.t={};let p=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[f,r]],m=b=>{for(const[x,C]of h)b=b.split(`${x}*`).join(`${x}{0,${C}}`).split(`${x}+`).join(`${x}{1,${C}}`);return b},y=(b,x,C)=>{const w=m(x),j=p++;s(b,j,x),d[b]=j,c[j]=x,u[j]=w,a[j]=new RegExp(x,C?"g":void 0),l[j]=new RegExp(w,C?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),y("FULL",`^${c[d.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),y("LOOSE",`^${c[d.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),y("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),y("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?(?:${c[d.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",c[d.COERCE],!0),y("COERCERTLFULL",c[d.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",y("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",y("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(oj,oj.exports);var vy=oj.exports;const Mrt=Object.freeze({loose:!0}),$rt=Object.freeze({}),Drt=e=>e?typeof e!="object"?Mrt:e:$rt;var d_=Drt;const QB=/^[0-9]+$/,nre=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;const n=QB.test(e),r=QB.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},Lrt=(e,t)=>nre(t,e);var rre={compareIdentifiers:nre,rcompareIdentifiers:Lrt};const Vx=H7,{MAX_LENGTH:ez,MAX_SAFE_INTEGER:Ux}=z7,{safeRe:Gx,t:qx}=vy,Nrt=d_,{compareIdentifiers:bb}=rre;let Frt=class vc{constructor(t,n){if(n=Nrt(n),t instanceof vc){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>ez)throw new TypeError(`version is longer than ${ez} characters`);Vx("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?Gx[qx.LOOSE]:Gx[qx.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>Ux||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ux||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ux||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){const s=+o;if(s>=0&&s<Ux)return s}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(Vx("SemVer.compare",this.version,this.options,t),!(t instanceof vc)){if(typeof t=="string"&&t===this.version)return 0;t=new vc(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof vc||(t=new vc(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof vc||(t=new vc(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(Vx("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 bb(r,o)}while(++n)}compareBuild(t){t instanceof vc||(t=new vc(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(Vx("build 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 bb(r,o)}while(++n)}inc(t,n,r){if(t.startsWith("pre")){if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(n){const o=`-${n}`.match(this.options.loose?Gx[qx.PRERELEASELOOSE]:Gx[qx.PRERELEASE]);if(!o||o[1]!==n)throw new Error(`invalid identifier: ${n}`)}}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"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];r===!1&&(s=[n]),bb(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Oi=Frt;const tz=Oi,Brt=(e,t,n=!1)=>{if(e instanceof tz)return e;try{return new tz(e,t)}catch(r){if(!n)return null;throw r}};var g0=Brt;const zrt=g0,Hrt=(e,t)=>{const n=zrt(e,t);return n?n.version:null};var Wrt=Hrt;const Vrt=g0,Urt=(e,t)=>{const n=Vrt(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var Grt=Urt;const nz=Oi,qrt=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new nz(e instanceof nz?e.version:e,n).inc(t,r,o).version}catch{return null}};var Yrt=qrt;const rz=g0,Krt=(e,t)=>{const n=rz(e,null,!0),r=rz(t,null,!0),o=n.compare(r);if(o===0)return null;const s=o>0,a=s?n:r,l=s?r:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c){if(!l.patch&&!l.minor)return"major";if(l.compareMain(a)===0)return l.minor&&!l.patch?"minor":"patch"}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 Xrt=Krt;const Jrt=Oi,Zrt=(e,t)=>new Jrt(e,t).major;var Qrt=Zrt;const eot=Oi,tot=(e,t)=>new eot(e,t).minor;var not=tot;const rot=Oi,oot=(e,t)=>new rot(e,t).patch;var sot=oot;const iot=g0,aot=(e,t)=>{const n=iot(e,t);return n&&n.prerelease.length?n.prerelease:null};var lot=aot;const oz=Oi,cot=(e,t,n)=>new oz(e,n).compare(new oz(t,n));var rc=cot;const uot=rc,dot=(e,t,n)=>uot(t,e,n);var pot=dot;const fot=rc,hot=(e,t)=>fot(e,t,!0);var got=hot;const sz=Oi,mot=(e,t,n)=>{const r=new sz(e,n),o=new sz(t,n);return r.compare(o)||r.compareBuild(o)};var p_=mot;const yot=p_,xot=(e,t)=>e.sort((n,r)=>yot(n,r,t));var vot=xot;const bot=p_,Cot=(e,t)=>e.sort((n,r)=>bot(r,n,t));var wot=Cot;const Sot=rc,jot=(e,t,n)=>Sot(e,t,n)>0;var W7=jot;const Eot=rc,kot=(e,t,n)=>Eot(e,t,n)<0;var V7=kot;const ore=ls(V7),Tot=rc,Rot=(e,t,n)=>Tot(e,t,n)===0;var sre=Rot;const Aot=rc,Pot=(e,t,n)=>Aot(e,t,n)!==0;var ire=Pot;const _ot=rc,Iot=(e,t,n)=>_ot(e,t,n)>=0;var f_=Iot;const Oot=rc,Mot=(e,t,n)=>Oot(e,t,n)<=0;var h_=Mot;const $ot=sre,Dot=ire,Lot=W7,Not=f_,Fot=V7,Bot=h_,zot=(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 $ot(e,n,r);case"!=":return Dot(e,n,r);case">":return Lot(e,n,r);case">=":return Not(e,n,r);case"<":return Fot(e,n,r);case"<=":return Bot(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var are=zot;const Hot=Oi,Wot=g0,{safeRe:Yx,t:Kx}=vy,Vot=(e,t)=>{if(e instanceof Hot)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(t.includePrerelease?Yx[Kx.COERCEFULL]:Yx[Kx.COERCE]);else{const c=t.includePrerelease?Yx[Kx.COERCERTLFULL]:Yx[Kx.COERCERTL];let u;for(;(u=c.exec(e))&&(!n||n.index+n[0].length!==e.length);)(!n||u.index+u[0].length!==n.index+n[0].length)&&(n=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(n===null)return null;const r=n[2],o=n[3]||"0",s=n[4]||"0",a=t.includePrerelease&&n[5]?`-${n[5]}`:"",l=t.includePrerelease&&n[6]?`+${n[6]}`:"";return Wot(`${r}.${o}.${s}${a}${l}`,t)};var Uot=Vot;class Got{constructor(){this.max=1e3,this.map=new Map}get(t){const n=this.map.get(t);if(n!==void 0)return this.map.delete(t),this.map.set(t,n),n}delete(t){return this.map.delete(t)}set(t,n){if(!this.delete(t)&&n!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(t,n)}return this}}var qot=Got,Cb,iz;function oc(){if(iz)return Cb;iz=1;const e=/\s+/g;class t{constructor(O,L){if(L=o(L),O instanceof t)return O.loose===!!L.loose&&O.includePrerelease===!!L.includePrerelease?O:new t(O.raw,L);if(O instanceof s)return this.raw=O.value,this.set=[[O]],this.formatted=void 0,this;if(this.options=L,this.loose=!!L.loose,this.includePrerelease=!!L.includePrerelease,this.raw=O.trim().replace(e," "),this.set=this.raw.split("||").map(B=>this.parseRange(B.trim())).filter(B=>B.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const B=this.set[0];if(this.set=this.set.filter(H=>!y(H[0])),this.set.length===0)this.set=[B];else if(this.set.length>1){for(const H of this.set)if(H.length===1&&b(H[0])){this.set=[H];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let O=0;O<this.set.length;O++){O>0&&(this.formatted+="||");const L=this.set[O];for(let B=0;B<L.length;B++)B>0&&(this.formatted+=" "),this.formatted+=L[B].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(O){const B=((this.options.includePrerelease&&h)|(this.options.loose&&m))+":"+O,H=r.get(B);if(H)return H;const N=this.options.loose,I=N?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];O=O.replace(I,$(this.options.includePrerelease)),a("hyphen replace",O),O=O.replace(c[u.COMPARATORTRIM],d),a("comparator trim",O),O=O.replace(c[u.TILDETRIM],p),a("tilde trim",O),O=O.replace(c[u.CARETTRIM],f),a("caret trim",O);let q=O.split(" ").map(se=>C(se,this.options)).join(" ").split(/\s+/).map(se=>M(se,this.options));N&&(q=q.filter(se=>(a("loose invalid filter",se,this.options),!!se.match(c[u.COMPARATORLOOSE])))),a("range list",q);const ne=new Map,V=q.map(se=>new s(se,this.options));for(const se of V){if(y(se))return[se];ne.set(se.value,se)}ne.size>1&&ne.has("")&&ne.delete("");const oe=[...ne.values()];return r.set(B,oe),oe}intersects(O,L){if(!(O instanceof t))throw new TypeError("a Range is required");return this.set.some(B=>x(B,L)&&O.set.some(H=>x(H,L)&&B.every(N=>H.every(I=>N.intersects(I,L)))))}test(O){if(!O)return!1;if(typeof O=="string")try{O=new l(O,this.options)}catch{return!1}for(let L=0;L<this.set.length;L++)if(z(this.set[L],O,this.options))return!0;return!1}}Cb=t;const n=qot,r=new n,o=d_,s=U7(),a=H7,l=Oi,{safeRe:c,t:u,comparatorTrimReplace:d,tildeTrimReplace:p,caretTrimReplace:f}=vy,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:m}=z7,y=A=>A.value==="<0.0.0-0",b=A=>A.value==="",x=(A,O)=>{let L=!0;const B=A.slice();let H=B.pop();for(;L&&B.length;)L=B.every(N=>H.intersects(N,O)),H=B.pop();return L},C=(A,O)=>(A=A.replace(c[u.BUILD],""),a("comp",A,O),A=S(A,O),a("caret",A),A=j(A,O),a("tildes",A),A=T(A,O),a("xrange",A),A=_(A,O),a("stars",A),A),w=A=>!A||A.toLowerCase()==="x"||A==="*",j=(A,O)=>A.trim().split(/\s+/).map(L=>k(L,O)).join(" "),k=(A,O)=>{const L=O.loose?c[u.TILDELOOSE]:c[u.TILDE];return A.replace(L,(B,H,N,I,q)=>{a("tilde",A,B,H,N,I,q);let ne;return w(H)?ne="":w(N)?ne=`>=${H}.0.0 <${+H+1}.0.0-0`:w(I)?ne=`>=${H}.${N}.0 <${H}.${+N+1}.0-0`:q?(a("replaceTilde pr",q),ne=`>=${H}.${N}.${I}-${q} <${H}.${+N+1}.0-0`):ne=`>=${H}.${N}.${I} <${H}.${+N+1}.0-0`,a("tilde return",ne),ne})},S=(A,O)=>A.trim().split(/\s+/).map(L=>E(L,O)).join(" "),E=(A,O)=>{a("caret",A,O);const L=O.loose?c[u.CARETLOOSE]:c[u.CARET],B=O.includePrerelease?"-0":"";return A.replace(L,(H,N,I,q,ne)=>{a("caret",A,H,N,I,q,ne);let V;return w(N)?V="":w(I)?V=`>=${N}.0.0${B} <${+N+1}.0.0-0`:w(q)?N==="0"?V=`>=${N}.${I}.0${B} <${N}.${+I+1}.0-0`:V=`>=${N}.${I}.0${B} <${+N+1}.0.0-0`:ne?(a("replaceCaret pr",ne),N==="0"?I==="0"?V=`>=${N}.${I}.${q}-${ne} <${N}.${I}.${+q+1}-0`:V=`>=${N}.${I}.${q}-${ne} <${N}.${+I+1}.0-0`:V=`>=${N}.${I}.${q}-${ne} <${+N+1}.0.0-0`):(a("no pr"),N==="0"?I==="0"?V=`>=${N}.${I}.${q}${B} <${N}.${I}.${+q+1}-0`:V=`>=${N}.${I}.${q}${B} <${N}.${+I+1}.0-0`:V=`>=${N}.${I}.${q} <${+N+1}.0.0-0`),a("caret return",V),V})},T=(A,O)=>(a("replaceXRanges",A,O),A.split(/\s+/).map(L=>R(L,O)).join(" ")),R=(A,O)=>{A=A.trim();const L=O.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return A.replace(L,(B,H,N,I,q,ne)=>{a("xRange",A,B,H,N,I,q,ne);const V=w(N),oe=V||w(I),se=oe||w(q),ae=se;return H==="="&&ae&&(H=""),ne=O.includePrerelease?"-0":"",V?H===">"||H==="<"?B="<0.0.0-0":B="*":H&&ae?(oe&&(I=0),q=0,H===">"?(H=">=",oe?(N=+N+1,I=0,q=0):(I=+I+1,q=0)):H==="<="&&(H="<",oe?N=+N+1:I=+I+1),H==="<"&&(ne="-0"),B=`${H+N}.${I}.${q}${ne}`):oe?B=`>=${N}.0.0${ne} <${+N+1}.0.0-0`:se&&(B=`>=${N}.${I}.0${ne} <${N}.${+I+1}.0-0`),a("xRange return",B),B})},_=(A,O)=>(a("replaceStars",A,O),A.trim().replace(c[u.STAR],"")),M=(A,O)=>(a("replaceGTE0",A,O),A.trim().replace(c[O.includePrerelease?u.GTE0PRE:u.GTE0],"")),$=A=>(O,L,B,H,N,I,q,ne,V,oe,se,ae)=>(w(B)?L="":w(H)?L=`>=${B}.0.0${A?"-0":""}`:w(N)?L=`>=${B}.${H}.0${A?"-0":""}`:I?L=`>=${L}`:L=`>=${L}${A?"-0":""}`,w(V)?ne="":w(oe)?ne=`<${+V+1}.0.0-0`:w(se)?ne=`<${V}.${+oe+1}.0-0`:ae?ne=`<=${V}.${oe}.${se}-${ae}`:A?ne=`<${V}.${oe}.${+se+1}-0`:ne=`<=${ne}`,`${L} ${ne}`.trim()),z=(A,O,L)=>{for(let B=0;B<A.length;B++)if(!A[B].test(O))return!1;if(O.prerelease.length&&!L.includePrerelease){for(let B=0;B<A.length;B++)if(a(A[B].semver),A[B].semver!==s.ANY&&A[B].semver.prerelease.length>0){const H=A[B].semver;if(H.major===O.major&&H.minor===O.minor&&H.patch===O.patch)return!0}return!1}return!0};return Cb}var wb,az;function U7(){if(az)return wb;az=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],f=d.match(p);if(!f)throw new TypeError(`Invalid comparator: ${d}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new l(f[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 s(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("=")||s(this.semver,"<",d.semver,p)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||s(this.semver,">",d.semver,p)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}wb=t;const n=d_,{safeRe:r,t:o}=vy,s=are,a=H7,l=Oi,c=oc();return wb}const Yot=oc(),Kot=(e,t,n)=>{try{t=new Yot(t,n)}catch{return!1}return t.test(e)};var G7=Kot;const Xot=oc(),Jot=(e,t)=>new Xot(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var Zot=Jot;const Qot=Oi,est=oc(),tst=(e,t,n)=>{let r=null,o=null,s=null;try{s=new est(t,n)}catch{return null}return e.forEach(a=>{s.test(a)&&(!r||o.compare(a)===-1)&&(r=a,o=new Qot(r,n))}),r};var nst=tst;const rst=Oi,ost=oc(),sst=(e,t,n)=>{let r=null,o=null,s=null;try{s=new ost(t,n)}catch{return null}return e.forEach(a=>{s.test(a)&&(!r||o.compare(a)===1)&&(r=a,o=new rst(r,n))}),r};var ist=sst;const Sb=Oi,ast=oc(),lz=W7,lst=(e,t)=>{e=new ast(e,t);let n=new Sb("0.0.0");if(e.test(n)||(n=new Sb("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 s=null;o.forEach(a=>{const l=new Sb(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||lz(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||lz(n,s))&&(n=s)}return n&&e.test(n)?n:null};var cst=lst;const ust=oc(),dst=(e,t)=>{try{return new ust(e,t).range||"*"}catch{return null}};var pst=dst;const fst=Oi,lre=U7(),{ANY:hst}=lre,gst=oc(),mst=G7,cz=W7,uz=V7,yst=h_,xst=f_,vst=(e,t,n,r)=>{e=new fst(e,r),t=new gst(t,r);let o,s,a,l,c;switch(n){case">":o=cz,s=yst,a=uz,l=">",c=">=";break;case"<":o=uz,s=xst,a=cz,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(mst(e,t,r))return!1;for(let u=0;u<t.set.length;++u){const d=t.set[u];let p=null,f=null;if(d.forEach(h=>{h.semver===hst&&(h=new lre(">=0.0.0")),p=p||h,f=f||h,o(h.semver,p.semver,r)?p=h:a(h.semver,f.semver,r)&&(f=h)}),p.operator===l||p.operator===c||(!f.operator||f.operator===l)&&s(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};var g_=vst;const bst=g_,Cst=(e,t,n)=>bst(e,t,">",n);var wst=Cst;const Sst=g_,jst=(e,t,n)=>Sst(e,t,"<",n);var Est=jst;const dz=oc(),kst=(e,t,n)=>(e=new dz(e,n),t=new dz(t,n),e.intersects(t,n));var Tst=kst;const Rst=G7,Ast=rc;var Pst=(e,t,n)=>{const r=[];let o=null,s=null;const a=e.sort((d,p)=>Ast(d,p,n));for(const d of a)Rst(d,t,n)?(s=d,o||(o=d)):(s&&r.push([o,s]),s=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 pz=oc(),m_=U7(),{ANY:jb}=m_,om=G7,y_=rc,_st=(e,t,n={})=>{if(e===t)return!0;e=new pz(e,n),t=new pz(t,n);let r=!1;e:for(const o of e.set){for(const s of t.set){const a=Ost(o,s,n);if(r=r||a!==null,a)continue e}if(r)return!1}return!0},Ist=[new m_(">=0.0.0-0")],fz=[new m_(">=0.0.0")],Ost=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===jb){if(t.length===1&&t[0].semver===jb)return!0;n.includePrerelease?e=Ist:e=fz}if(t.length===1&&t[0].semver===jb){if(n.includePrerelease)return!0;t=fz}const r=new Set;let o,s;for(const h of e)h.operator===">"||h.operator===">="?o=hz(o,h,n):h.operator==="<"||h.operator==="<="?s=gz(s,h,n):r.add(h.semver);if(r.size>1)return null;let a;if(o&&s){if(a=y_(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(const h of r){if(o&&!om(h,String(o),n)||s&&!om(h,String(s),n))return null;for(const m of t)if(!om(h,String(m),n))return!1;return!0}let l,c,u,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(const h of t){if(d=d||h.operator===">"||h.operator===">=",u=u||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(l=hz(o,h,n),l===h&&l!==o)return!1}else if(o.operator===">="&&!om(o.semver,String(h),n))return!1}if(s){if(p&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===p.major&&h.semver.minor===p.minor&&h.semver.patch===p.patch&&(p=!1),h.operator==="<"||h.operator==="<="){if(c=gz(s,h,n),c===h&&c!==s)return!1}else if(s.operator==="<="&&!om(s.semver,String(h),n))return!1}if(!h.operator&&(s||o)&&a!==0)return!1}return!(o&&u&&!s&&a!==0||s&&d&&!o&&a!==0||f||p)},hz=(e,t,n)=>{if(!e)return t;const r=y_(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},gz=(e,t,n)=>{if(!e)return t;const r=y_(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var Mst=_st;const Eb=vy,mz=z7,$st=Oi,yz=rre,Dst=g0,Lst=Wrt,Nst=Grt,Fst=Yrt,Bst=Xrt,zst=Qrt,Hst=not,Wst=sot,Vst=lot,Ust=rc,Gst=pot,qst=got,Yst=p_,Kst=vot,Xst=wot,Jst=W7,Zst=V7,Qst=sre,eit=ire,tit=f_,nit=h_,rit=are,oit=Uot,sit=U7(),iit=oc(),ait=G7,lit=Zot,cit=nst,uit=ist,dit=cst,pit=pst,fit=g_,hit=wst,git=Est,mit=Tst,yit=Pst,xit=Mst;var vit={parse:Dst,valid:Lst,clean:Nst,inc:Fst,diff:Bst,major:zst,minor:Hst,patch:Wst,prerelease:Vst,compare:Ust,rcompare:Gst,compareLoose:qst,compareBuild:Yst,sort:Kst,rsort:Xst,gt:Jst,lt:Zst,eq:Qst,neq:eit,gte:tit,lte:nit,cmp:rit,coerce:oit,Comparator:sit,Range:iit,satisfies:ait,toComparators:lit,maxSatisfying:cit,minSatisfying:uit,minVersion:dit,validRange:pit,outside:fit,gtr:hit,ltr:git,intersects:mit,simplifyRange:yit,subset:xit,SemVer:$st,re:Eb.re,src:Eb.src,tokens:Eb.t,SEMVER_SPEC_VERSION:mz.SEMVER_SPEC_VERSION,RELEASE_TYPES:mz.RELEASE_TYPES,compareIdentifiers:yz.compareIdentifiers,rcompareIdentifiers:yz.rcompareIdentifiers};const xz=ls(vit),bit=e=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?typeof e=="string"&&e.includes(",")?[!1,'Comma (",") is not valid as a decimal separator. Use a period (".") instead.']:[!1,"Value must be a number"]:[!0,""]},Cit=(...e)=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},wit=e=>{const t=xz.clean(e)===e;return!xz.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},Sit=e=>J3(bi(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],jit=e=>{const t="Value must be a valid RE2 regex",n=e instanceof Error?e.message:"";if(!n)return t;const r=n.startsWith("error")?`Error${n.slice(5)}`:n;return`${t}. ${r}`},Eit=e=>{try{h3.compile(e)}catch(t){return[!1,jit(t)]}return[!0,""]},kit=e=>{if(lp(e))return Sit;if(Hne(e))return wit;if(zne(e))return bit;if(h0(e))return Eit;if(QP(e)||Bne(e))return Cit;throw new Error(`Unknown operator: ${e}`)},Tit=(e,t)=>{const n=new Set(e.map(({value:o})=>o));return nj(t,n)},Rit=(e,t)=>new Set(t.filter(({value:n})=>!e(n)).map(({value:n})=>n)),Ait=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},Pit=(e,t)=>{var m;const[n,r]=g.useReducer(yrt,hrt(e)),{deletedLegalValues:o,localConstraint:s}=g.useMemo(()=>{const{deletedLegalValues:y,...b}=n;return{deletedLegalValues:y,localConstraint:b}},[n]),a=g.useRef(t);g.useLayoutEffect(()=>{a.current=t}),g.useEffect(()=>{a.current(grt(s))},[s]);const{context:l}=iu(),c=g.useMemo(()=>Ait(l,s.contextName),[l,s.contextName]),u=g.useMemo(()=>kit(s.operator),[s.operator]),d=(...y)=>xy(s)&&y.every(b=>s.values.has(b))?y.length===1?[!1,`${y[0]} is already added.`]:[!1,"All the values are already added"]:u(...y);g.useEffect(()=>{var y,b;if((y=c.legalValues)!=null&&y.length&&((b=e.values)!=null&&b.length)){const x=Tit(c.legalValues,e.values);r({type:"deleted legal values update",payload:x})}},[e.values,c.legalValues]);const p=g.useMemo(()=>{var y;if((y=c.legalValues)!=null&&y.length&&c2(s))return Rit(b=>u(b)[0],c.legalValues)},[u,c.legalValues,s]),f=(m=c.legalValues)!=null&&m.length?{legalValues:c.legalValues,invalidLegalValues:p,deletedLegalValues:o}:void 0,h=u_(s);return{updateConstraint:r,constraint:s,validator:d,legalValueData:f,invertedDisabled:h}},_it=(e,t)=>{const r=!t.map(a=>a.name).includes(e.contextName),o=t.reduce(({project:a,global:l},c)=>(c.project?a.push(c):l.push(c),{project:a,global:l}),{project:[],global:[]}),s=a=>a.toSorted((l,c)=>l.name.localeCompare(c.name)).map(l=>({key:l.name,label:l.name}));return[o.project.length>0&&{groupHeader:"Project context fields",options:s(o.project)},o.global.length>0&&{groupHeader:"Global context fields",options:s(o.global)},r&&{groupHeader:"Deleted context fields",options:s([{name:e.contextName}])}].filter(Boolean)},Iit=v(a_,{shouldForwardProp:e=>e!=="hasValue"})(({theme:e,hasValue:t})=>({color:t?"inherit":e.palette.primary.main,width:"max-content",".MuiChip-icon":{transform:"translateX(50%)",fill:e.palette.primary.main,height:e.fontSizes.smallerBody,width:e.fontSizes.smallerBody}})),Oit=({currentValue:e,removeValue:t,setEditingOpen:n,editingOpen:r,validator:o})=>{const[s]=e?o(e):[!0],a=()=>{if(!e||!s){n(!0);return}n(!r)};return i.jsx(Iit,{hasValue:!!e,label:e||"Add value",onClick:a,icon:e?void 0:i.jsx(Eo,{}),onDelete:e?t:void 0})},Mit=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},g.createElement("path",{fill:"#615BC2",d:"M6.29 11.887V10.48h4.581v1.407H6.29Zm0 2.343v-1.406h4.581v1.406H6.29Zm7.147-2.343V10.48h4.583v1.407h-4.582Zm0 2.343v-1.406h4.583v1.406h-4.582Z"})),$it=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},g.createElement("path",{fill:"#9F9FA1",d:"M9.29 11.887V10.48h4.581v1.407H9.29Zm0 2.343v-1.406h4.581v1.406H9.29Z"}),g.createElement("rect",{width:1,height:18.374,x:16.453,y:3.949,fill:"#6E6E70",rx:.5,transform:"rotate(32.071 16.453 3.95)"})),Dit=v("button")(({theme:e})=>({display:"grid",placeItems:"center",padding:0,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,background:e.palette.secondary.light,border:`1px solid ${e.palette.secondary.border}`,color:e.palette.secondary.dark,fontWeight:e.typography.fontWeightBold,transition:"all 0.03s ease","&:not(:disabled):is(:hover, :focus-visible)":{outline:`1px solid ${e.palette.primary.main}`},"&:disabled":{color:e.palette.action.disabled,background:"transparent",border:`1px solid ${e.palette.action.disabledBackground}`,cursor:"not-allowed"}})),Lit=v(Mit)({path:{fill:"currentcolor"}}),Nit=v($it)(({theme:e})=>({path:{fill:e.palette.text.disabled},rect:{fill:e.palette.text.secondary}})),Fit=({inverted:e})=>e?i.jsx(Nit,{"aria-hidden":"true"}):i.jsx(Lit,{"aria-hidden":"true"}),Bit=({inverted:e,onToggleInverted:t,disabledText:n})=>{const r=!!n,o=n??`Make the selected operator${e?" inclusive":" exclusive"}`,s=n??(e?"The constraint operator is exclusive.":"The constraint operator is inclusive.");return i.jsx(wr,{title:o,arrow:!0,children:i.jsx("span",{children:i.jsx(Dit,{type:"button",onClick:t,disabled:r,"aria-label":s,children:i.jsx(Fit,{inverted:!!e})})})})},zit=({open:e,onClose:t})=>i.jsx(W3,{in:e,children:i.jsx(Dt,{severity:"info",icon:!1,onClose:t,sx:{mb:2},children:"Regex requires these SDK versions or newer: Node.js 6.10.0, Java 12.2.0, Ruby 6.5.0, Python 6.6.0, .NET 6.1.0, Go 6.2.0 - or a frontend SDK connected to Unleash or Unleash Enterpirse Edge 20.1.10."})}),Hit=({open:e,onOpen:t})=>e?null:i.jsx(Sn,{component:"button",variant:"body2",onClick:t,children:"View SDK requirements"}),Wit=()=>{const[e,t]=ai("regexSdkVersionAlert","open");return{open:e==="open",onClose:()=>t("closed"),onOpen:()=>t("open")}},Vit=v(K)(({theme:e})=>({padding:e.spacing(2),marginBottom:e.spacing(1)})),Uit=v(K)(({theme:e})=>({marginTop:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(1)})),Git=v("ul")(({theme:e})=>({listStyle:"none",padding:0,margin:e.spacing(1,0,0),display:"flex",flexDirection:"column",gap:e.spacing(.5)})),qit=v("li")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"stretch",gap:e.spacing(1),marginBottom:e.spacing(1)})),Yit=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),cre=v(xn)(({theme:e})=>({flexGrow:1,display:"flex",width:"100%","& .MuiFormHelperText-root":{marginLeft:0,marginTop:e.spacing(1)}})),Kit=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start",width:"100%",marginBlock:e.spacing(.5)})),Xit=v(K)(({theme:e})=>({display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:e.spacing(1)})),vz=v(K,{shouldForwardProp:e=>e!=="match"})(({theme:e,match:t})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),fontSize:e.fontSizes.smallBody,color:t?e.palette.success.main:e.palette.warning.main})),Jit=v(n0)(({theme:e})=>({color:e.palette.success.main,fontSize:e.fontSizes.mainHeader})),Zit=v(UA)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.mainHeader})),Qit=({match:e,testString:t})=>{const n=t==="";return e?i.jsxs(vz,{match:e,children:[i.jsx(Jit,{"aria-hidden":!0}),"Your regular expression matches",n?" an empty string.":""]}):i.jsxs(vz,{match:e,children:[i.jsx(Zit,{"aria-hidden":!0}),"Your regular expression does not match",n?" empty strings.":""]})},eat=v("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.caption.fontSize,marginTop:e.spacing(1)})),tat=g.memo(({input:e,index:t,totalCount:n,onEdit:r,onRemove:o,inputRefs:s})=>{const a=g.useCallback(u=>{s.current[t]=u},[s,t]),l=g.useCallback(u=>{r(e.id,u.target.value)},[e.id,r]),c=g.useCallback(u=>{u.key==="Enter"&&u.preventDefault()},[]);return i.jsxs(qit,{children:[i.jsxs(Yit,{children:[i.jsx(cre,{type:"text",placeholder:"Enter test value",size:"small",fullWidth:!0,value:e.testString,id:`test-input-${e.id}`,inputProps:{"aria-describedby":"test-strings-description"},inputRef:a,onChange:l,onKeyDown:c}),n>1&&i.jsx(wr,{title:"Remove test string",arrow:!0,children:i.jsx(Mt,{type:"button",size:"small","aria-label":`Remove test string ${t}: ${e.testString===""?"empty string":""}`,sx:{ml:"auto"},onClick:()=>o(e.id),children:i.jsx(So,{fontSize:"inherit"})})})]}),i.jsx(Qit,{match:e.match,testString:e.testString})]})}),nat=({matchesRegex:e})=>{const[t,n]=g.useState([{id:1,testString:"",match:!1}]),r=g.useRef([]),[o,s]=g.useState(null);g.useEffect(()=>{n(u=>u.map(d=>({...d,match:e(d.testString)})))},[e]),g.useEffect(()=>{var u;o!==null&&(o>-1&&((u=r.current[o])==null||u.focus()),s(null))},[o]);const a=g.useCallback((u,d)=>{n(p=>p.map(f=>f.id!==u?f:{...f,testString:d,match:e(d)}))},[e]),l=g.useCallback(()=>{s(t.length),n(u=>{const d=u.reduce((f,h)=>Math.max(f,h.id),0),p="";return[...u,{id:d+1,testString:p,match:e(p)}]})},[t.length,e]),c=g.useCallback(u=>{const d=t.findIndex(p=>p.id===u);t.length<=1||(s(Math.min(d,t.length-2)),n(p=>p.filter(f=>f.id!==u)))},[t]);return i.jsxs(Uit,{children:[i.jsx(J,{variant:"h3",children:"Test regex"}),i.jsx(J,{id:"test-strings-description",variant:"body2",children:"Enter test values to check Regex matching."}),i.jsx(Git,{children:t.map((u,d)=>i.jsx(tat,{input:u,index:d,totalCount:t.length,onEdit:a,onRemove:c,inputRefs:r},u.id))}),i.jsx(K,{children:i.jsx($e,{type:"button",variant:"text",size:"small",startIcon:i.jsx(Eo,{}),onClick:l,children:"Add test string"})})]})},rat=({initialValue:e,addValue:t,helpText:n,caseInsensitive:r,validator:o,editingOpen:s})=>{const{open:a,onClose:l,onOpen:c}=Wit(),[u,d]=g.useState(e||""),[p,f]=g.useState(""),h=g.useId(),m=g.useId(),y=g.useCallback(w=>{try{return h3.compile(u,r?h3.CASE_INSENSITIVE:void 0).matcher(w).find()}catch{return!1}},[u,r]),b=g.useCallback(w=>{if(w.length>100)return`Values cannot be longer than 100 characters (current: ${w.length})`;const[j,k]=o(w);return j?"":k},[o]),x=g.useCallback(w=>{if(w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),!(u!=null&&u.trim()))){f("Value cannot be empty or whitespace");return}},[u]),C=g.useCallback(w=>{d(w.target.value),f(b(w.target.value)),t(w.target.value)},[t,b]);return g.useEffect(()=>{s&&(d(e||""),f(b(e||"")))},[s,e,b]),i.jsxs(Vit,{children:[i.jsx(zit,{open:a,onClose:l}),i.jsxs(Xit,{children:[i.jsx(J,{variant:"h2",children:"Regular expression"}),i.jsx(Hit,{open:a,onOpen:c})]}),i.jsxs(Kit,{children:[i.jsx(tc,{children:i.jsx("label",{htmlFor:h,children:"Constraint Value"})}),i.jsxs(K,{sx:{display:"flex",flexDirection:"column",flexGrow:1},children:[i.jsx(cre,{id:h,multiline:!0,placeholder:"Enter RE2 regex value e.g.: [xyz]",value:u,onChange:C,onKeyDown:x,size:"small",variant:"outlined",fullWidth:!0,autoFocus:!0,error:!!p,helperText:p,"aria-describedby":m,"data-testid":"CONSTRAINT_VALUES_INPUT"}),n&&i.jsx(eat,{id:m,children:n})]})]}),i.jsx(nat,{matchesRegex:y})]})},oat={REGEX:"The REGEX operator does not support inversion"},sat=(e,t)=>{if(e)return oat[t]??"This operator does not support inversion"},iat=v("article")(({theme:e})=>({"--padding":e.spacing(2),backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`})),aat=v("div")(({theme:e})=>({"--gap":e.spacing(1),padding:"var(--padding)",display:"flex",flexFlow:"row nowrap",alignItems:"flex-start",justifyItems:"space-between",gap:"var(--gap)"})),ure=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:"var(--gap)",alignSelf:"flex-start"})),lat=v(ure)(({theme:e})=>({flexFlow:"row wrap"})),cat=v("div")(({theme:e})=>({display:"flex",gap:"var(--gap)",flexFlow:"row wrap",width:"100%",height:"min-content"})),uat=v("div")(({theme:e})=>({padding:"var(--padding)",borderTop:`1px dashed ${e.palette.divider}`})),dat=v(_f)(({theme:e})=>({fieldset:{border:"none",borderRadius:0},maxWidth:"25ch",minWidth:"7ch",":focus-within .MuiSelect-select":{background:"none"},":focus-within fieldset":{borderBottomStyle:"solid"},"label + &":{margin:0},"&::before":{borderColor:e.palette.divider},"&&:hover::before":{borderColor:e.palette.primary.main}})),pat=v(Mt)(({theme:e})=>({position:"absolute",right:e.spacing(1)})),fat=v(Sn)(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:.25})),hat=v("div")(({theme:e})=>({width:e.spacing(2)})),gat=({addValues:e,clearValues:t,localConstraint:n,validator:r,addValuesButtonRef:o,setEditingOpen:s,editingOpen:a})=>Qne(n)?i.jsx(ert,{setValue:e,value:n.value,validator:r}):frt(n)?i.jsx(RB,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"A semver value should be of the format X.Y.Z",inputType:"text"}):c_(n)?i.jsx(Oit,{removeValue:t,currentValue:n.value,validator:r,editingOpen:a,setEditingOpen:s}):prt(n)?i.jsx(RB,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"Add a single number",inputType:"number"}):i.jsx(Dnt,{validator:r,helpText:"Maximum 100 char length per value",ref:o,onAddValues:e}),mat=({addValues:e,localConstraint:t,legalValueData:n,toggleValue:r,clearAll:o,editingOpen:s,validator:a})=>n?i.jsx(uat,{children:xy(t)?i.jsx(urt,{values:t.values,toggleValue:r,clearAll:o,addValues:e,...n}):i.jsx(drt,{toggleValue:r,value:t.value,...n})}):c_(t)&&s?i.jsx(rat,{initialValue:t.value,caseInsensitive:!!t.caseInsensitive,addValue:e,validator:a,editingOpen:s,helpText:i.jsxs(i.Fragment,{children:["A regex value should be a valid"," ",i.jsxs(fat,{href:"https://github.com/google/re2/wiki/Syntax",target:"_blank",rel:"noopener noreferrer",children:["RE2 regular expression",i.jsx(Hp,{sx:{fontSize:"inherit"}})]})]})}):null,yat=({onDelete:e,constraint:t,onUpdate:n})=>{const{constraint:r,updateConstraint:o,validator:s,legalValueData:a,invertedDisabled:l}=Pit(t,n);let c=!1;if(c2(r)&&c_(r)){const[R]=r.value?s(r.value):[!0];c=!r.value||!R}const[u,d]=g.useState(c);g.useEffect(()=>{c&&d(!0)},[c]);const p=g.useCallback(R=>o({type:"add value(s)",payload:R}),[o]),f=g.useCallback(R=>o({type:"remove value",payload:R}),[o]),h=g.useCallback(()=>o({type:"clear values"}),[o]),m=g.useCallback(R=>o({type:"toggle value",payload:R}),[o]),y=g.useCallback(R=>{o({type:"set operator",payload:R})},[o]),b=g.useCallback(()=>o({type:"toggle inverted operator"}),[o]),x=g.useCallback(()=>{o({type:"toggle case sensitivity"})},[o]),{context:C}=iu(),{contextName:w,operator:j}=r,k=QP(j)||h0(j),S=g.useRef(null),E=g.useRef(null);if(!C)return null;const T=_it(r,C);return i.jsxs(iat,{children:[i.jsxs(aat,{children:[i.jsxs(cat,{children:[i.jsxs(ure,{children:[i.jsx(dat,{visuallyHideLabel:!0,id:"context-field-select",name:"contextName",label:"Context Field",options:T,value:w||"",onChange:R=>o({type:"set context field",payload:R}),variant:"standard"}),i.jsxs(lat,{children:[i.jsx(Bit,{inverted:!!r.inverted,onToggleInverted:b,disabledText:sat(l,j)}),i.jsx(bnt,{options:Une(w),value:j,onChange:y,inverted:r.inverted}),k?i.jsx(znt,{caseInsensitive:!!r.caseInsensitive,onToggleCaseSensitivity:x}):null]})]}),i.jsx(Ant,{values:xy(r)?Array.from(r.values):a&&r.value?[r.value]:void 0,removeValue:f,getExternalFocusTarget:()=>E.current??S.current,children:a?null:i.jsx(gat,{localConstraint:r,addValues:p,clearValues:h,validator:s,addValuesButtonRef:E,editingOpen:u,setEditingOpen:d})})]}),i.jsx(hat,{}),i.jsx(wr,{title:"Delete constraint",arrow:!0,children:i.jsx(pat,{type:"button","data-testid":"DELETE_CONSTRAINT_BUTTON",size:"small",onClick:e,ref:S,children:i.jsx(So,{fontSize:"inherit"})})})]}),i.jsx(mat,{localConstraint:r,legalValueData:a,editingOpen:u,toggleValue:m,addValues:p,clearAll:h,validator:s})]})},dre=e=>{const t=Une(e)[0],n=lp(t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1,[Vl]:crypto.randomUUID()}},xat=v("div")({width:"100%",display:"flex",flexDirection:"column"}),vat=g.memo(({constraint:e,setConstraints:t,index:n})=>{const r=g.useCallback(()=>t(Nl(s=>{s.splice(n,1)})),[t,n]),o=g.useCallback(s=>t(Nl(a=>{a.splice(n,1,s)})),[t,n]);return i.jsx(yat,{constraint:e,onDelete:r,onUpdate:o})}),pre=g.forwardRef(({constraints:e,setConstraints:t},n)=>{const{context:r}=iu();return g.useImperativeHandle(n,()=>({addConstraint(o){if(t){const s=dre(o);t(a=>[...a,s])}}})),g.useEffect(()=>{e.every(o=>Vl in o)||t(e.map(o=>({[Vl]:crypto.randomUUID(),...o})))},[e,t]),r.length===0?null:i.jsx(xat,{children:i.jsx(L7,{children:e.map((o,s)=>i.jsx(vat,{constraint:o,setConstraints:t,index:s},o[Vl]))})})}),fre=(e,t)=>e.value&&e.contextName===f3?ji(e.value,t.locale):e.value,bat=v(D7)({whiteSpace:"pre"}),Cat=v(Ti)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),wat=v("div")(({theme:e})=>({width:"300px",marginBottom:e.spacing(2)})),Sat=({values:e})=>{const[t,n]=g.useState("");return!e||e.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:e.length>20,show:i.jsx(wat,{children:i.jsx(Jne,{filter:t,setFilter:n})})}),e.filter(r=>r.includes(t)).map((r,o)=>i.jsx(Cat,{label:i.jsx(bat,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},jat=v("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),Eat=v("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),kat=v(Ti)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),Tat=({value:e,operator:t})=>e?i.jsxs(jat,{children:[i.jsxs(Eat,{children:["Value must be ",t]})," ",i.jsx(kat,{label:i.jsx(D7,{maxWidth:"400",text:e,maxLength:50})})]}):null,Rat=v("div")(({theme:e})=>({padding:e.spacing(1,0),maxHeight:"400px",overflowY:"auto"})),Aat=({constraint:e})=>{const{locationSettings:t}=$r();return i.jsx("div",{children:i.jsxs(Rat,{children:[i.jsx(Sat,{values:e.values}),i.jsx(Tat,{value:fre(e,t),operator:e.operator})]})})},n6="disabled-strategy-55d37c31-ca3f-4c19-bf86-9158824899bf",Pat=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",fontSize:e.typography.body2.fontSize,minHeight:e.spacing(4),[e.breakpoints.down("sm")]:{flexDirection:"column"}})),_at=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",flexGrow:1,position:"relative",[`.${n6} &`]:{filter:"grayscale(1)",color:e.palette.text.secondary},[e.breakpoints.down("sm")]:{width:"100%"}})),Iat=v("span")(({theme:e,align:t})=>({display:"block",flexShrink:0,fontSize:e.fontSizes.smallerBody,fontWeight:e.typography.fontWeightBold,color:e.palette.text.secondary,width:e.spacing(10),[e.breakpoints.down("sm")]:{width:"100%"},...t==="top"&&{alignSelf:"flex-start"}})),Mc=({type:e,children:t,alignType:n})=>i.jsxs(Pat,{children:[i.jsx(Iat,{align:n,children:e}),i.jsx(_at,{children:t})]}),Oat=v(Ti,{shouldForwardProp:e=>e!=="multiline"})(({theme:e,multiline:t})=>({borderRadius:`${e.shape.borderRadius}px`,padding:e.spacing(.25,0),fontSize:e.fontSizes.smallerBody,height:"auto",background:e.palette.secondary.light,border:`1px solid ${e.palette.secondary.border}`,color:e.palette.secondary.dark,fontWeight:e.typography.fontWeightBold,...t?{".MuiChip-label":{whiteSpace:"collapse"}}:{}})),vg=g.forwardRef((e,t)=>i.jsx(Oat,{size:"small",ref:t,...e})),Mat=v("div")(({theme:e})=>({flex:"1 1 0",[e.breakpoints.down("sm")]:{display:"block",float:"left"}})),$at=v(mr)({padding:0,margin:0}),Dat=v("li")(({theme:e})=>({padding:e.spacing(.25),display:"inline-block",span:{background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,display:"inline-block",padding:e.spacing(.25,1)}})),Lat=v("div")(({theme:e})=>({padding:e.spacing(.25,1),background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge})),p2=({values:e,tooltips:t,onSetTruncated:n})=>i.jsxs(Mat,{children:[e&&(e==null?void 0:e.length)===1?i.jsx(Lat,{children:i.jsx(mr,{title:e[0],arrow:!0,lines:2,onSetTruncated:()=>n==null?void 0:n(!1),children:i.jsx(ra,{title:(t==null?void 0:t[e[0]])||"",children:i.jsx("span",{children:e[0]})})})}):null,e&&(e==null?void 0:e.length)>1?i.jsx($at,{title:"",lines:2,onSetTruncated:n,component:"ul",children:e.map(r=>i.jsx(ra,{title:(t==null?void 0:t[r])||"",children:i.jsx(Dat,{children:i.jsx("span",{children:r})})},r))}):null]}),Nat=(e,t)=>{const{context:n}=iu(),r=g.useMemo(()=>n.find(({name:o})=>o===e),[e,n]);return g.useMemo(()=>Object.fromEntries((t==null?void 0:t.map(o=>{var s,a;return[o,(a=(s=r==null?void 0:r.legalValues)==null?void 0:s.find(({value:l})=>l===o))==null?void 0:a.description]}).filter(([o,s])=>!!s))||[]),[r,t])},Fat=(e,t)=>Bne(e)||QP(e)&&!t,Bat=({label:e,inverted:t})=>i.jsx(Rt,{title:t?`Not ${e}`:e,arrow:!0,children:i.jsx(vg,{label:ej(e,t),multiline:!0})}),zat=v(vg)(({theme:e})=>({alignSelf:"stretch",height:"auto",padding:0,"> span":{paddingInline:e.spacing(0)},svg:{path:{fill:"currentColor"},"--size":e.spacing(2.5),width:"var(--size)",height:"var(--size)"}})),Hat=()=>i.jsx(Rt,{title:"The match is case sensitive",arrow:!0,children:i.jsx(zat,{"aria-label":"The match is case sensitive",label:i.jsx(Yne,{style:{verticalAlign:"middle"},fill:"currentColor","aria-hidden":!0})})}),Wat=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),[e.breakpoints.up("sm")]:{gap:e.spacing(2),display:"grid",gridTemplateColumns:"repeat(3, auto)",placeItems:"center"}})),Vat=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5)})),Uat=v("div")(({theme:e})=>({maxWidth:"150px",paddingRight:e.spacing(.5),overflow:"hidden",[e.breakpoints.down("sm")]:{maxWidth:"unset"}})),Gat=({onSetTruncated:e,viewMore:t,...n})=>{const{caseInsensitive:r,contextName:o,inverted:s,operator:a,value:l,values:c}=n,{locationSettings:u}=$r(),d=l?[fre(n,u)||"",...c||[]]:c||[],p=Nat(o,c||[]);return i.jsx(Mc,{type:"Constraint",children:i.jsxs(Wat,{children:[i.jsx(Uat,{children:i.jsx(mr,{title:o,arrow:!0,children:o})}),i.jsxs(Vat,{children:[i.jsx(Bat,{label:a,inverted:s}),Fat(a,r)?i.jsx(Hat,{}):null]}),i.jsxs("div",{children:[i.jsx(p2,{values:d,onSetTruncated:e,tooltips:p}),t]})]})})},qat=v("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),Yat=v("div")(({theme:e})=>({display:"flex",alignItems:"stretch",[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",width:"100%"}})),Kat=v("p")(({theme:e})=>({color:e.palette.secondary.main,margin:e.spacing(.25,0,0,.75),fontSize:e.fontSizes.smallerBody})),Xat=({constraint:e,allowExpand:t,expanded:n})=>{var s;const[r,o]=g.useState(!1);return i.jsx(qat,{children:i.jsx(Yat,{children:i.jsx(Gat,{...e,onSetTruncated:a=>{o(a),t(a)},viewMore:r?i.jsx(Kat,{children:n?"View less":`View all (${(s=e.values)==null?void 0:s.length})`}):null})})})},Jat=v("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),Zat=v($e)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),Qat=({onUse:e})=>{const t=e&&(n=>{n.stopPropagation(),e()});return i.jsx(Jat,{children:i.jsx(te,{condition:!!t,show:i.jsx(Rt,{title:"Use constraint",arrow:!0,children:i.jsx(Zat,{variant:"text",color:"primary",onClick:t,"data-testid":"USE_CONSTRAINT_BUTTON",children:"Use this"})})})})},elt=Dp("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),tlt=({constraint:e,onUse:t,allowExpand:n,expanded:r,disabled:o})=>i.jsxs(elt,{children:[i.jsx(Xat,{constraint:e,allowExpand:n,expanded:r,disabled:o}),t?i.jsx(Qat,{onUse:t}):null]}),nlt=v(tu,{shouldForwardProp:e=>e!=="borderStyle"})(({theme:e,borderStyle:t="solid"})=>({border:`1px ${t} ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,boxShadow:"none",margin:0,"&:before":{opacity:"0"},overflow:"hidden"})),rlt=v(ru)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),olt=v(nu)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),slt=v("div")({display:"flex",flexDirection:"column",width:"100%"}),q7=({constraint:e,onUse:t,sx:n=void 0,disabled:r=!1,renderAfter:o,borderStyle:s="solid"})=>{const[a,l]=g.useState(!0),[c,u]=g.useState(!1),d=()=>{a&&u(!c)};return i.jsxs(nlt,{expanded:c,sx:n,borderStyle:s,children:[i.jsx(rlt,{expandIcon:null,onClick:d,sx:{cursor:a?"pointer":"default!important","&:hover":{cursor:a?"pointer":"default!important"}},tabIndex:a?0:-1,children:i.jsxs(slt,{children:[i.jsx(tlt,{constraint:e,onUse:t,allowExpand:l,disabled:r,expanded:c}),o]})}),i.jsx(olt,{children:i.jsx(Aat,{constraint:e})})]})},ilt=v("div")(({theme:e})=>({marginTop:e.spacing(3)})),alt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),llt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),clt=({setConstraints:e,constraints:t=[]})=>{const{items:n}=pne();if(n.length===0||!e)return null;const r=n.filter(o=>!t.some(s=>dne(s,o)));return r.length===0?null:i.jsxs(ilt,{children:[i.jsx(alt,{children:"Recently used constraints"}),i.jsx(llt,{children:r.map(o=>i.jsx(q7,{constraint:o,borderStyle:"dashed",onUse:()=>{e(s=>[...s,o])}},GS(o)))})]})},ult=e=>{const t=g.useRef(new WeakMap),[,n]=g.useState(0),r=g.useCallback((s,a)=>{t.current.set(s,a),n(l=>l+1)},[]),o=g.useCallback(s=>t.current.get(s),[]);return g.useMemo(()=>({set:r,get:o}),[r,o])},dlt=v("div")({width:"100%",display:"flex",flexDirection:"column"}),plt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),flt=e=>{var o;const{uiConfig:t}=ut(),n=((o=t.resourceLimits)==null?void 0:o.constraints)||30,r=e>=n;return{limit:n,limitReached:r}},hlt=(e,t)=>{const n=ult(),{context:r}=iu(),o=a=>{const l=dre(a);n.set(l,{editing:!0,new:!0}),e(c=>[...c,l])};return g.useImperativeHandle(t,()=>({addConstraint:o})),{onAdd:o&&(()=>{o(r[0].name)}),state:n,context:r}},glt=g.forwardRef(({constraints:e,setConstraints:t},n)=>{const{onAdd:r,context:o}=hlt(t,n),{limit:s,limitReached:a}=flt(e.length);return o.length===0?null:i.jsx(dlt,{children:i.jsxs("div",{children:[i.jsxs(plt,{children:[i.jsx(J,{children:"Constraints"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsx(K,{children:i.jsxs(J,{variant:"body2",children:["Constraints are advanced targeting rules that you can use to enable a feature flag for a subset of your users. Read more about constraints"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),t?i.jsx(pre,{ref:n,setConstraints:t,constraints:e}):null,i.jsx(K,{sx:l=>({marginTop:l.spacing(2),marginBottom:l.spacing(2)}),children:i.jsx(yy,{name:"constraints in this strategy",shortName:"constraints",currentValue:e.length,limit:s})}),i.jsx($e,{type:"button",onClick:r,startIcon:i.jsx(Eo,{}),variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",disabled:!!a,children:"Add constraint"}),i.jsx(clt,{setConstraints:t,constraints:e})]})})}),mlt=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},ylt=({strategy:e,setStrategy:t})=>{g.useEffect(()=>()=>{t(o=>o.constraints?{...o,constraints:o.constraints.filter(mlt)}:o)},[t]);const n=e.constraints||[],r=o=>{t(s=>({...s,constraints:o instanceof Function?o(s.constraints||[]):o}))};return i.jsx(glt,{constraints:n,setConstraints:r})},xlt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),vlt=v(Zl)({flex:1}),hre=({label:e,options:t,value:n=[],onChange:r,disabled:o,icon:s,width:a="215px"})=>{const l=Bt(),c=u=>{const{InputProps:d}=u;let p;return s!==null&&(p=i.jsx(Bp,{position:"start",children:s||i.jsx(Eo,{sx:{height:20,width:20,color:l.palette.primary.main}})})),i.jsx(xn,{...u,InputProps:{...d,startAdornment:p},variant:"outlined",sx:{width:a,"& .MuiOutlinedInput-root":{"& .MuiInputBase-input":{color:l.palette.primary.main,opacity:1,"&::placeholder":{color:l.palette.primary.main,fontWeight:"bold",opacity:1}},"& .MuiOutlinedInput-notchedOutline":{borderColor:l.palette.primary.main,opacity:.5},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"1px"}}},placeholder:e})};return i.jsx(xlt,{children:i.jsx(vlt,{options:t,value:n,onChange:(u,d)=>r(d||[]),renderInput:c,getOptionLabel:u=>u.label,disabled:o,size:"small",multiple:!0})})},blt=v("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.background.elevation1,color:e.palette.text.primary})),bz=v("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer",color:e.palette.secondary.dark})),Clt=v(ft)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),kb=e=>({fontSize:e.fontSizes.bodySize}),wlt=({segment:e,setSegments:t,preview:n,setPreview:r,"aria-controls":o})=>{const s=()=>{t(u=>u.filter(d=>d.id!==e.id)),r(u=>u===e?void 0:u)},a=()=>{r(u=>u===e?void 0:e)},l=i.jsx(te,{condition:e===n,show:i.jsx(uP,{titleAccess:"Hide",sx:kb}),elseShow:i.jsx(dy,{titleAccess:"Show",sx:kb})}),c=e===n?"Hide segment constraints":"Preview segment constraints";return i.jsxs(blt,{children:[i.jsx(Clt,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),i.jsx(Rt,{title:c,arrow:!0,children:i.jsx(bz,{type:"button",onClick:a,"aria-expanded":e===n,"aria-controls":o,children:l})}),i.jsx(Rt,{title:"Remove segment",arrow:!0,children:i.jsx(bz,{type:"button",onClick:s,children:i.jsx(i_,{titleAccess:"Remove",sx:kb})})})]})},Slt=v(Ene)(()=>({padding:0})),jlt=v(tu)(()=>({boxShadow:"none",margin:0,padding:0,"::before":{display:"none"}})),Elt=v(ru)(({theme:e})=>({fontSize:e.typography.body2.fontSize,minHeight:"unset",":focus-within":{backgroundColor:"inherit"}})),klt=v(nu)(({theme:e})=>({padding:e.spacing(.5,3,2.5)})),Tlt=v(ft)(({theme:e})=>({textDecoration:"none",paddingRight:e.spacing(.5),"&:hover":{textDecoration:"underline"}})),Rlt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:"auto"})),Alt=v($e)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),Plt=v("p")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),gre=({segment:e,isExpanded:t,headerContent:n,constraintList:r})=>{const[o,s]=g.useState(t||!1),a=g.useId(),l=g.useMemo(()=>{var c;return r||((c=e.constraints)!=null&&c.length?i.jsx(L7,{children:e.constraints.map((u,d)=>i.jsx(q7,{constraint:u},`${a0(u)}-${d}`))}):i.jsx(Plt,{children:"This segment has no constraints."}))},[r,e.constraints]);return i.jsx(Slt,{children:i.jsxs(jlt,{expanded:o,disableGutters:!0,TransitionProps:{mountOnEnter:!0,unmountOnExit:!0},children:[i.jsxs(Elt,{id:`segment-accordion-${e.id}`,tabIndex:-1,"aria-controls":a,children:[i.jsx(Mc,{type:"Segment",children:i.jsx(Tlt,{to:`/segments/edit/${e.id}`,children:e.name})}),n||null,t?null:i.jsx(Rlt,{children:i.jsx(Alt,{"aria-controls":a,size:"small",variant:"outlined",onClick:()=>s(c=>!c),children:o?"Close preview":"Preview"})})]}),i.jsx(klt,{children:l})]})})},_lt=v("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),Ilt=v("p")(({theme:e})=>({color:e.palette.text.secondary})),Olt=v("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})),Mlt=v("div")({display:"contents"}),$lt=v(Dt)(({theme:e})=>({marginTop:e.spacing(1.5),marginBottom:e.spacing(.5)})),Dlt=({segments:e,setSegments:t})=>{const[n,r]=g.useState(),o=e.length-1,s=g.useId();if(e.length===0)return null;const a=e.filter(c=>!c.constraints||c.constraints.length===0),l=a.length>0;return i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:e&&e.length>0,show:i.jsx(Ilt,{children:"Selected Segments"})}),i.jsx(te,{condition:l,show:i.jsxs($lt,{severity:"warning",children:[i.jsx("strong",{children:"Warning!"})," You are adding an empty segment",a.length>1?"s":""," (",a.map(c=>c.name).join(", "),"). This will activate this feature for ALL USERS."]})}),i.jsx(_lt,{children:e.map((c,u)=>i.jsxs(g.Fragment,{children:[i.jsx(wlt,{segment:c,setSegments:t,preview:n,setPreview:r,"aria-controls":s}),i.jsx(te,{condition:u<o,show:i.jsx(Olt,{children:"AND"})})]},c.id))}),i.jsx(Mlt,{id:s,children:i.jsx(te,{condition:!!n,show:i.jsx(gre,{segment:n,isExpanded:!0})})})]})},Ff=()=>{const{uiConfig:e}=ut();return{segmentValuesLimit:e.resourceLimits.segmentValues,strategySegmentsLimit:e.resourceLimits.strategySegments}},Llt=()=>{const{segmentValuesLimit:e}=Ff();return typeof e>"u"?null:i.jsxs(Dt,{severity:"info",children:["A segment can have"," ",i.jsxs("a",{href:"https://docs.getunleash.io/concepts/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," values across all of its constraints"]}),". ",i.jsx(mre,{})]})},Nlt=e=>{const{segmentValuesLimit:t}=Ff();return typeof t>"u"?null:i.jsxs(Dt,{severity:"error",children:["A segment can have"," ",i.jsxs("a",{href:"https://docs.getunleash.io/concepts/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","."]})},Flt=()=>{const{strategySegmentsLimit:e}=Ff();return typeof e>"u"?null:i.jsxs(Dt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",i.jsx(mre,{})]})},mre=()=>i.jsxs(i.Fragment,{children:[i.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),yre="https://docs.getunleash.io/concepts/segments",Blt=v(Ti)(({theme:e})=>({background:"transparent",height:"auto",fontSize:e.typography.body2.fontSize,padding:e.spacing(.5),border:`1px dashed ${e.palette.divider}`,"& .MuiChip-icon":{color:e.palette.neutral.main}})),zlt=({segment:e,setSegments:t})=>{const n=()=>{t(r=>r.some(o=>o.id===e.id)?r:[...r,e])};return i.jsx(Rt,{title:"Add segment",arrow:!0,children:i.jsx(Blt,{label:e.name,icon:i.jsx(Eo,{}),onClick:n,size:"small",variant:"outlined"})})},Hlt=v("div")(({theme:e})=>({marginTop:e.spacing(3)})),Wlt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Vlt=v("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),Ult=({setSegments:e,segments:t})=>i.jsxs(Hlt,{children:[i.jsx(Wlt,{children:"Recently used segments"}),i.jsx(Vlt,{children:t.map(n=>i.jsx(zlt,{segment:n,setSegments:e},n.id))})]}),Glt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),qlt=({segments:e,setSegments:t,availableSegments:n})=>{const{strategySegmentsLimit:r}=Ff(),{items:o}=fne(),s=n.filter(d=>o.includes(d.id)&&!e.find(p=>p.id===d.id)),a=!!(r&&e.length>=r),c=n.filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name})),u=([d])=>{const p=n.find(f=>String(f.id)===d.value);p&&t(f=>[...f,p])};return i.jsxs(i.Fragment,{children:[i.jsxs(Glt,{children:[i.jsx(J,{children:"Segments"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsx(K,{children:i.jsxs(J,{variant:"body2",children:["Segments are reusable sets of constraints that can be defined once and reused across feature toggle configurations. You can create a segment on the global or the project level. Read more about segments"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),a&&i.jsx(Flt,{}),i.jsx(hre,{label:"Select segments",options:c,onChange:u,disabled:a,icon:null,width:"175px"}),i.jsx(Dlt,{segments:e,setSegments:t}),s.length>0?i.jsx(Ult,{setSegments:t,segments:s}):null]})},Ylt=({title:e,setTitle:t})=>i.jsxs(K,{sx:{paddingBottom:n=>n.spacing(2)},children:[i.jsx(J,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),i.jsx(Yr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),Klt=e=>{const n=wo("projectId"),{segments:r,...o}=od(),s=n?({project:a})=>!a||a===n:({project:a})=>!a;return{segments:r==null?void 0:r.filter(s),...o}},x_=({name:e,value:t="",label:n="",options:r,onChange:o,id:s,disabled:a=!1,className:l,classes:c,formControlStyles:u={},...d})=>{const p=()=>r.map(f=>i.jsx(wn,{value:f.key,title:f.title||"","data-testid":`${pT}-${f.label}`,children:f.label},f.key));return i.jsxs(Ko,{variant:"outlined",size:"small",classes:c,style:u,children:[i.jsx(Gl,{htmlFor:s,children:n}),i.jsx(na,{name:e,disabled:a,onChange:o,className:l,label:n,id:s,value:t,...d,children:p()})]})},Xlt=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const s=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 i.jsx(xn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:s,style:{width:"100%"},variant:"outlined",size:"small"})},Jlt=v("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"}}})),Zlt=v(x_)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),Qlt=v("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),ect=v(Xlt)(()=>({width:"100%"})),tct=v(xn)(()=>({width:"100%"})),nct=({overrides:e,overridesDispatch:t})=>{const{context:n}=iu(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},s=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return i.jsx(i.Fragment,{children:e.map((a,l)=>{var p;const c=n.find(({name:f})=>f===a.contextName),u=((p=c==null?void 0:c.legalValues)==null?void 0:p.map(({value:f})=>f))||[],d=a.values.filter(f=>u.includes(f));return i.jsxs(Jlt,{children:[i.jsx(Zlt,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:a.contextName,options:r,onChange:f=>t({type:"UPDATE_TYPE_AT",payload:[l,f.target.value]})}),i.jsxs(Qlt,{children:[i.jsx(te,{condition:!!(u&&u.length>0),show:i.jsx(Zl,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(f,h)=>f===h,options:u,onChange:s(l),getOptionLabel:f=>f,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:f=>i.jsx(tct,{...f,variant:"outlined",label:"Legal values"})}),elseShow:i.jsx(ect,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),i.jsx(Rt,{title:"Remove",arrow:!0,children:i.jsx(Mt,{onClick:f=>{f.preventDefault(),t({type:"REMOVE",payload:l})},children:i.jsx(So,{})})})]})]},`override=${l}`)})})},rct=(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,s)=>s===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,s)=>s===n?{...o,contextName:r}:o)}}},oct=(e=[])=>g.useReducer(rct,e);var ju=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(ju||{});const sct=tt.lazy(()=>La(()=>import("./ReactJSONEditor-BFCTTSFc.js"),[])),ict=v("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"})),act=v("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),lct=v(Rt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),xre=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Cz=v(xre)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),cct=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),uct=v(Ur)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),dct=v("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),wz=v(Yr)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),pct=v("div")(({theme:e})=>({marginLeft:e.spacing(3)})),fct=v(Yr)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),hct=v("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),vre=v("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%"}}})),gct=v(vre)({alignItems:"end",justifyContent:"space-between"}),mct=v(x_)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),yct=v($e)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),xct=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"},{key:"number",label:"number"}],vct={type:"string",value:""},bct=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:s=!1,decorationColor:a,weightsError:l})=>{const[c,u]=g.useState(e.name),[d,p]=g.useState(e.weightType===ju.FIX),[f,h]=g.useState(String(e.weight/10)),[m,y]=g.useState(e.payload||vct),[b,x]=oct("overrides"in e?e.overrides||[]:[]),{context:C}=iu(),[w,j]=g.useState({}),k=N=>{j(I=>({...I,[N]:void 0}))},S=(N,I)=>{j(q=>({...q,[N]:I}))};g.useEffect(()=>{k("percentage"),o!=null&&o.includes("%")&&S("percentage","Total weight must equal 100%")},[o]);const E=!e.new,T=t.filter(({id:N,weightType:I})=>N!==e.id&&I===ju.VARIABLE).length>0,R=N=>{const I=N.weightType===ju.VARIABLE,q=t.some(V=>V.weightType===ju.FIX),ne=t.filter(V=>V.weightType===ju.VARIABLE).length===1;return q&&ne&&I},_=N=>{k("name"),O(N,e.id)||S("name","A variant with that name already exists for this environment."),u(N.trim())},M=N=>{(N===""||L(N))&&h(N)},$=N=>{B(N)||S("payload",N.type==="json"?"Invalid json":"Invalid number")},z=()=>{C.length>0&&x({type:"ADD",payload:{contextName:C[0].name,values:[]}})},A=N=>!!N.length,O=(N,I)=>E||!t.some(q=>q.name===N&&q.id!==I),L=N=>{if(!d)return!0;if(N===""||N.match(/\.[0-9]{2,}$/))return!1;const I=Number(N);return I>=0&&I<=100},B=N=>{try{return N.type==="json"&&JSON.parse(N.value),N.type==="number"?!Number.isNaN(Number(N.value)):!0}catch{return!1}};g.useEffect(()=>{const N={...e,name:c,weight:Number(d?f:100)*10,weightType:d?ju.FIX:ju.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:m.value?m:void 0,isValid:A(c)&&O(c,e.id)&&L(f)&&B(m)&&!o};s||(N.overrides=b.map(I=>({contextName:I.contextName,values:I.values})).filter(I=>I.values&&I.values.length>0)),n(N)},[c,d,f,m,b]),g.useEffect(()=>{d||h(String(e.weight/10))},[e.weight]);const H=w!=null&&w.percentage||l?"Total weight may not exceed 100%":"";return i.jsxs(ict,{"data-testid":"VARIANT",children:[i.jsx(act,{color:a}),i.jsx(lct,{arrow:!0,title:R(e)?"You need to have at least one variable variant":"Delete variant",children:i.jsx("div",{children:i.jsx(Mt,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:R(e),children:i.jsx(So,{})})})}),i.jsxs(gct,{children:[i.jsxs(hct,{children:[i.jsx(xre,{children:"Variant name"}),i.jsx(cct,{children:"This will be used to identify the variant in your code"}),i.jsx(wz,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:c,onChange:N=>_(N.target.value),disabled:E,required:!0})]}),i.jsx(te,{condition:T,show:i.jsxs(pct,{children:[i.jsx(uct,{label:"Custom percentage",control:i.jsx(oa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:d,onChange:N=>p(N.target.checked)})}),i.jsx(fct,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!H,errorText:H,value:f,onChange:N=>M(N.target.value),required:d,disabled:!d,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:i.jsx(Bp,{position:"end",children:"%"})}})]})})]}),i.jsxs(Cz,{children:["Payload",i.jsx(Zo,{tooltip:"Passed along with the the variant object."})]}),i.jsxs(vre,{children:[i.jsx(mct,{id:"variant-payload-type",name:"type",label:"Type",value:m.type,options:xct,onChange:N=>{k("payload"),y(I=>({...I,type:N.target.value}))}}),i.jsx(dct,{children:i.jsx(te,{condition:m.type==="json",show:i.jsx(g.Suspense,{fallback:null,children:i.jsx(sct,{content:{text:m.value},onChange:N=>y(I=>{var q;return{...I,value:"json"in N?((q=N.json)==null?void 0:q.toString())||"":N.text}})})}),elseShow:i.jsx(wz,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:m.type!=="string",rows:m.type==="string"||m.type==="number"?1:4,value:m.value,onChange:N=>{k("payload"),y(I=>({...I,value:N.target.value}))},placeholder:"",onBlur:()=>$(m),error:!!w.payload,errorText:w.payload})})})]}),s?null:i.jsxs(i.Fragment,{children:[i.jsxs(Cz,{children:["Overrides",i.jsx(Zo,{tooltip:"Here you can specify which users should get this variant."})]}),i.jsx(nct,{overrides:b,overridesDispatch:x}),i.jsx("div",{children:i.jsx(yct,{onClick:z,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})},Cct=v(K)(({theme:e})=>({display:"flex",flexDirection:"column"})),wct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",minWidth:"250px",gap:e.spacing(1)})),Sct=v(K)(({theme:e})=>({padding:e.spacing(1,0,.75,0),flexDirection:"column"})),jct=v("span")(({theme:e})=>({marginBottom:e.spacing(1),fontSize:e.typography.body2.fontSize})),Ect=v(K,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({display:"flex",alignItems:"center",figure:{margin:0,padding:0,width:e.spacing(1.6),height:e.spacing(1.6),borderRadius:"50%",background:e.palette.variants[t%e.palette.variants.length]}})),kct=v("span")(({theme:e})=>({display:"inline-block",background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.25,1),align:"center",fontSize:e.fontSizes.smallBody})),Tct=v("code")(({theme:e})=>({display:"inline-block",background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.25,1),fontSize:e.fontSizes.smallerBody})),Rct=({variant:{name:e,weight:t,payload:n},index:r,selected:o})=>i.jsxs(Cct,{children:[i.jsxs(wct,{children:[i.jsx(Ect,{index:r,children:i.jsx("figure",{})}),i.jsxs(J,{variant:"subtitle2",children:[t/10,"% - ",e]})]}),n?i.jsxs(Sct,{sx:{display:["json","csv"].includes(n.type)?"flex":"block"},children:[i.jsxs(jct,{children:[i.jsx(kct,{children:n.type})," payload: "]}),i.jsx(Tct,{children:n.value})]}):null]}),Act=v(K)(()=>({display:"flex",width:"100%",position:"relative"})),Pct=v(K)(({theme:e,selected:t})=>({position:"relative",fontSize:e.fontSizes.smallerBody,...t?{fontWeight:e.typography.fontWeightBold}:{}})),_ct=v(K,{shouldForwardProp:e=>!["index","hasError","isFirst","isLast"].includes(e)})(({theme:e,index:t,hasError:n,isFirst:r,isLast:o})=>({height:e.spacing(2),width:"100%",position:"relative",color:n?e.palette.error.main:"inherit",background:e.palette.variants[t%e.palette.variants.length],...r?{borderTopLeftRadius:e.shape.borderRadius,borderBottomLeftRadius:e.shape.borderRadius}:{},...o?{borderTopRightRadius:e.shape.borderRadius,borderBottomRightRadius:e.shape.borderRadius}:{}})),Ict=v(K)(({theme:e})=>({padding:e.spacing(.25,.25),lineHeight:1})),Oct=v(K)(({theme:e})=>({padding:e.spacing(.125,.25,0),overflow:"hidden",color:e.palette.text.secondary})),Mct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),$ct=v(J)(({theme:e})=>({marginY:e.spacing(1)})),bre=({variants:e,weightsError:t,header:n=!0,selected:r})=>e.length<1?null:i.jsxs(K,{sx:o=>({marginTop:o.spacing(n?2:0)}),children:[n?i.jsx(Mct,{children:i.jsxs($ct,{variant:"body2",children:["Flag variants (",e.length,")"]})}):null,i.jsx(Act,{children:e.map((o,s)=>{const a=o.weight/10;return a===0?null:i.jsx(ra,{variant:"custom",arrow:!0,onClick:l=>l.preventDefault(),titleComponent:i.jsx(Rct,{variant:o,index:s,selected:r===o.name}),children:i.jsxs(Pct,{sx:{width:`${a}%`},selected:r===o.name,children:[i.jsx(_ct,{index:s,isFirst:s===0,isLast:s===e.length-1,hasError:t,children:i.jsx(Ict,{children:i.jsx(mr,{lines:1,children:`${a}%`})})}),i.jsx(Oct,{children:i.jsx(mr,{lines:1,children:o.name})})]})},s)})})]}),Dct=()=>i.jsxs(Dt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",i.jsx(Lct,{}),"."]}),qqt=()=>i.jsxs(Dt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",i.jsx("b",{children:"variants inside strategies"}),". ",i.jsx(Nct,{})]}),Lct=()=>i.jsx("a",{href:"https://docs.getunleash.io/concepts/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),Nct=()=>i.jsx("a",{href:"https://docs.getunleash.io/concepts/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),Fct=v("div")({display:"flex",flexDirection:"column"}),Bct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),zct=({strategy:e,setStrategy:t,canRenamePreexistingVariants:n})=>{const{trackEvent:r}=zt(),o=(e.variants||[]).map(f=>({...f,new:n||!1,isValid:!0,id:crypto.randomUUID(),overrides:[]})),[s,a]=g.useState(o),l=Bt(),c=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>()=>{t(f=>({...f,variants:s.filter(h=>!!h.name)}))},[JSON.stringify(s)]),g.useEffect(()=>{t(f=>({...f,variants:s.map(h=>({stickiness:c,name:h.name,weight:h.weight,payload:h.payload,weightType:h.weightType}))}))},[c,JSON.stringify(s)]);const u=(f,h)=>{a(m=>tN(m.map(y=>y.id===h?f:y),1e3))},d=()=>{const f=crypto.randomUUID();a(h=>[...h,{name:"",weightType:ju.VARIABLE,weight:0,stickiness:c,new:!0,isValid:!1,id:f}]),r("strategy-variants",{props:{eventType:"variant added"}})},p=s.reduce((f,h)=>f+(h.weight||0),0)!==1e3;return i.jsxs(i.Fragment,{children:[i.jsx(Dt,{severity:"info",icon:!1,children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),i.jsxs(Bct,{children:[i.jsx(J,{children:"Variants"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsx(K,{children:i.jsxs(J,{variant:"body2",children:["Variants in feature flagging allow you to serve different versions of a feature to different users. This can be used for A/B testing, gradual rollouts, and canary releases. Variants provide a way to control the user experience at a granular level, enabling you to test and optimize different aspects of your features. Read more about variants"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),i.jsxs(Fct,{children:[s.length>0&&i.jsx(Dct,{}),s.map((f,h)=>i.jsx(bct,{disableOverrides:!0,variant:f,variants:s,updateVariant:m=>u(m,f.id),removeVariant:()=>a(m=>tN(m.filter(y=>y.id!==f.id),1e3)),decorationColor:l.palette.variants[h%l.palette.variants.length],weightsError:p},f.id))]}),i.jsx($e,{sx:{width:"fit-content"},onClick:d,variant:"outlined","data-testid":"ADD_STRATEGY_VARIANT_BUTTON",startIcon:i.jsx(Eo,{}),children:"Add variant"}),i.jsx(bre,{variants:s,weightsError:p})]})},Hct=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),Wct=v("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),Vct=v(xX)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),Uct=v(_4)(({theme:e})=>({width:"100px"})),Sz=v(an)(({theme:e})=>({marginLeft:e.spacing(1)})),Gct=v(K)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),qct=v(pr)(({theme:e})=>({width:"100%"})),Yct=v(jne)({top:"-10px",left:"0",transform:"translateY(0)"}),Kct=v("form")(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(6),paddingBottom:e.spacing(16),paddingTop:e.spacing(4),overflow:"auto",height:"100%"})),Xct=v("div")(({theme:e})=>({bottom:0,right:0,left:0,position:"absolute",display:"flex",gap:e.spacing(1),paddingTop:e.spacing(3),paddingRight:e.spacing(6),paddingLeft:e.spacing(6),paddingBottom:e.spacing(6),backgroundColor:e.palette.background.paper,justifyContent:"end",borderTop:`1px solid ${e.palette.divider}`})),Cre=({strategy:e,setStrategy:t,strategyDefinition:n,errors:r,validateParameter:o,canRenamePreexistingVariants:s,alertContent:a,generalTabExtras:l,beforeFooter:c,groupIdTooltip:u,children:d,onSubmit:p})=>{var $,z;const[f,h]=g.useState(0),m=(e==null?void 0:e.name)||(e==null?void 0:e.strategyName),{segments:y=[]}=Klt(),{segments:b=[]}=od(),x=g.useMemo(()=>new Map(b.map(A=>[A.id,A])),[b]),C=A=>A.map(O=>x.get(O)).filter(O=>!!O),w=C(e.segments||[]),j=A=>{t(O=>{const L=C(O.segments||[]),B=typeof A=="function"?A(L):A;return{...O,segments:B.map(H=>H.id)}})},k=y.length>0||((($=e.segments)==null?void 0:$.length)??0)>0,S=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>{t(A=>({...A,variants:(e.variants||[]).map(O=>({stickiness:S,name:O.name,weight:O.weight,payload:O.payload,weightType:O.weightType}))}))},[S,JSON.stringify(e.variants)]);const E=!!(e.parameters&&"stickiness"in e.parameters),T=(A,O)=>{h(O)},R=()=>{var L,B;const A=((L=e.constraints)==null?void 0:L.length)||0,O=((B=e.segments)==null?void 0:B.length)||0;return A+O},_=(A,O)=>{t(Nl(L=>{L.parameters=L.parameters??{},L.parameters[A]=O})),o==null||o(A,O)},M=A=>{t(O=>({...O,title:A}))};return i.jsxs(i.Fragment,{children:[i.jsx(Hct,{children:i.jsx(Wct,{children:Xl(m||"")})}),a,i.jsxs(Vct,{value:f,onChange:T,children:[i.jsx(Uct,{label:"General"}),i.jsx(_4,{"data-testid":"STRATEGY_TARGETING_TAB",label:i.jsxs(J,{children:["Targeting",i.jsx(Sz,{children:R()})]})}),E&&i.jsx(_4,{"data-testid":"STRATEGY_VARIANTS_TAB",label:i.jsxs(J,{children:["Variants",i.jsx(Sz,{children:((z=e.variants)==null?void 0:z.length)||0})]})})]}),i.jsxs(Kct,{onSubmit:A=>{A.preventDefault(),A.stopPropagation(),p(A)},children:[f===0&&i.jsxs(i.Fragment,{children:[i.jsx(Ylt,{title:e.title||"",setTitle:M}),i.jsx(unt,{strategy:e,strategyDefinition:n,updateParameter:_,errors:r,groupIdTooltip:u}),l]}),f===1&&i.jsxs(i.Fragment,{children:[i.jsx(Dt,{severity:"info",sx:{mb:2},icon:!1,children:"Segmentation and constraints allow you to set filters on your strategies, so that they will only be evaluated for users and applications that match the specified preconditions."}),k?i.jsxs(i.Fragment,{children:[i.jsx(qlt,{segments:w,setSegments:j,availableSegments:y}),i.jsxs(Gct,{children:[i.jsx(qct,{}),i.jsx(Yct,{})]})]}):null,i.jsx(ylt,{strategy:e,setStrategy:t})]}),f===2&&E&&i.jsx(zct,{strategy:e,setStrategy:t,canRenamePreexistingVariants:s}),c,i.jsx(Xct,{children:d})]})]})},Jct=v(K)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),wre=({feature:e,environmentId:t,permission:n,onSubmit:r,onCancel:o,loading:s,strategy:a,setStrategy:l,errors:c,changeRequestsEnabled:u,canRenamePreexistingVariants:d,Limit:p,disabled:f})=>{const{trackEvent:h}=zt(),[m,y]=g.useState(!1),b=$7(a.constraints),x=Stt(e,t),{strategyDefinition:C}=O7(a.name);g.useEffect(()=>{h("new-strategy-form",{props:{eventType:"seen"}})},[]);const w=e.environments.find(I=>I.name===t),{data:j}=nc(e.project),{changeRequestInReviewOrApproved:k,alert:S}=Cne(j),E=k(t||""),T=E?"Add to existing change request":"Add change to draft",{isOss:R}=ut(),_=(w==null?void 0:w.type)==="production"&&R(),M=$t(),{error:$,loading:z}=ut();if($)throw $;if(z||!C)return null;const A=I=>C.parameters.find(q=>q.name===I),O=(I,q)=>{const ne=btt(A(I),q);return ne?(c.setFormError(I,ne),!1):(c.removeFormError(I),!0)},L=()=>C.parameters.map(I=>I.name).map(I=>{var q;return O(I,(q=a.parameters)==null?void 0:q[I])}).every(Boolean),B=()=>{M(K7(e.project,e.name))},H=async()=>{var I;Array.isArray(a.variants)&&((I=a.variants)==null?void 0:I.length)>0&&h("strategy-variants",{props:{eventType:"submitted"}}),L()&&(h("new-strategy-form",{props:{eventType:"submitted"}}),x&&!u?y(!0):r())},N=E?S:u?i.jsx(bne,{environment:t}):null;return i.jsxs(Cre,{strategy:a,setStrategy:l,strategyDefinition:C,errors:c,validateParameter:O,canRenamePreexistingVariants:d,alertContent:N?i.jsx(Jct,{children:N}):null,generalTabExtras:i.jsxs(i.Fragment,{children:[i.jsx(Ttt,{enabled:!(a!=null&&a.disabled),onToggleEnabled:()=>l(I=>({...I,disabled:!I.disabled}))}),u?null:i.jsx(xtt,{projectId:e.project,featureId:e.name,environmentId:t})]}),onSubmit:H,beforeFooter:i.jsxs(i.Fragment,{children:[i.jsx(K,{sx:{flex:1,display:"flex",alignItems:"flex-end"},children:p}),_?i.jsx($tt,{}):null]}),children:[i.jsx(lo,{permission:n,projectId:e.project,environmentId:t,variant:"contained",color:"primary",type:"submit",disabled:f||s||!b||c.hasFormErrors(),"data-testid":Nje,children:u?T:"Save strategy"}),i.jsx($e,{type:"button",color:"primary",onClick:o||B,disabled:s,children:"Cancel"}),i.jsx(wtt,{open:m,onClose:()=>y(!1),onClick:r,loading:s,label:"Save strategy"})]})},Zct=e=>fetch(e).then(en("ChangeRequest")).then(t=>t.json()),v_=(e,t)=>{const{data:n,error:r,mutate:o}=f0([],yt(`api/admin/projects/${e}/change-requests/scheduled?strategyId=${t}`),Zct);return{changeRequests:n,loading:!r&&!n,refetch:o,error:r}},Qct=(e,t,n,r)=>(e==null?void 0:e.filter(o=>{var s;return(s=o.features.find(a=>a.name===t))==null?void 0:s.changes.some(a=>a.action==="updateStrategy"&&a.payload.id===n)}).map(o=>({changeRequest:KP(r,o.id),state:o.state})))??[],eut=(e,t)=>(e==null?void 0:e.map(n=>({changeRequest:KP(t,n.id),state:"Scheduled"})))??[],tut=({value:e,values:t,inverted:n,operator:r,contextName:o,caseInsensitive:s})=>{const a=l=>({contextName:o,operator:r,...l,caseInsensitive:s,inverted:n});return o_(r)?a({value:e||""}):a({values:t||[]})},Y7=(e,t)=>e!=="constraints"||!Array.isArray(t)?t:t.map(tut),nut="default",rut=e=>{const{project:t,loading:n,error:r}=e0(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:nut,mode:t.mode,loading:n,error:r}},Sre=(e,t,n="default")=>{const r={};return t.parameters.forEach(o=>{r[o.name]=out(e,o,n)}),{name:t.name,constraints:[],parameters:r}},out=(e,t,n)=>t.name==="rollout"||t.name==="percentage"||t.type==="percentage"?"50":t.name==="stickiness"?n:t.name==="groupId"?e:t.type==="boolean"?"false":"",sj=(e,t)=>Fo(n=>typeof n!="string"?!1:n.includes(`projects/${e}/change-requests/pending/${t}`),void 0,{revalidate:!0}),sut=()=>{const[e,t]=g.useState(""),{trackEvent:n}=zt();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"}})}}},iut=e=>{if(e)return e==null?void 0:e.constraints.map(t=>({...t,[Vl]:crypto.randomUUID()}))},Yqt=()=>{const e=ar("projectId"),t=ar("featureId"),n=pB("environmentId"),r=pB("strategyId"),[o,s]=g.useState({name:""}),[a,l]=g.useState("default"),{updateStrategyOnFeature:c,updateMilestoneStrategyOnFeature:u,loading:d}=I7(),{strategyDefinition:p}=O7(o.name),{defaultStickiness:f}=rut(e),{setToastData:h,setToastApiError:m}=_t(),y=YP(),{uiConfig:b}=ut(),{unleashUrl:x}=b,C=$t(),{addChange:w}=ia(),{isChangeRequestConfigured:j}=vl(e),{refetch:k,data:S}=nc(e),E=wo("featureId"),{setPreviousTitle:T}=sut(),{feature:R,refetchFeature:_}=ws(e,t),M=g.useRef(R),{data:$,staleDataNotification:z,forceRefreshCache:A}=yne({unleashGetter:ws,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},R,{afterSubmitAction:_},xne);g.useEffect(()=>{M.current.name===""&&R.name&&(A(R),M.current=R)},[R]);const{trackEvent:O}=zt(),{changeRequests:L}=v_(e,r),B=Qct(S,t,r,b),H=eut(L,b),N=()=>[...B,...H].forEach(oe=>{O("change_request",{props:{...oe,action:"edit-strategy",eventType:"conflict-created"}})});g.useEffect(()=>{var _e;const oe=$==null?void 0:$.environments.find(we=>we.name===n);if(!oe)return;const ae=oe.strategies.find(we=>we.id===r)??((_e=oe.releasePlans)==null?void 0:_e.flatMap(we=>we.milestones.flatMap(Me=>Me.strategies)).find(we=>we.id===r));ae&&"milestoneId"in ae&&l("milestone");const me=iut(ae),ce={...ae,constraints:me,name:(ae==null?void 0:ae.name)||(ae==null?void 0:ae.strategyName)};s(we=>({...we,...ce})),T((ae==null?void 0:ae.title)||"")},[r,$]),g.useEffect(()=>{if(!p)return;const oe=Sre(t,p,f).parameters;s(se=>({...se,parameters:{...oe,...se.parameters}}))},[f,p==null?void 0:p.name]);const I=aut(o),q=async oe=>{await(a==="milestone"?u:c)(e,t,n,r,oe),h({text:"Strategy updated",type:"success"})},ne=async oe=>{await w(e,n,{action:a==="milestone"?"updateMilestoneStrategy":"updateStrategy",feature:t,payload:{...oe,id:r}}),h({text:"Change added to draft",type:"success"}),k(),await Promise.all([k(),E?sj(e,E):Promise.resolve()])},V=async()=>{a==="milestone"&&O("edit-milestone-strategy",{props:{eventType:"form submitted"}});try{j(n)?await ne(I):await q(I),N(),_(),C(K7(e,t))}catch(oe){m(pt(oe))}};return!o.id||!p||!$?null:i.jsxs(eo,{modal:!0,disablePadding:!0,description:jre,documentationLink:Ere,documentationLinkLabel:kre,formatApiCode:()=>lut({strategyScope:a,projectId:e,featureId:t,environmentId:n,strategyId:r,strategy:I,strategyDefinition:p,unleashUrl:x}),children:[i.jsx(wre,{feature:$,strategy:o,setStrategy:s,environmentId:n,onSubmit:V,loading:d,permission:wp,errors:y,changeRequestsEnabled:j(n)}),z]})},aut=e=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:e.segments??[],disabled:e.disabled??!1}),K7=(e,t)=>`/projects/${e}/features/${t}`,X7=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},lut=({strategyScope:e="default",projectId:t,featureId:n,environmentId:r,strategyId:o,strategy:s,strategyDefinition:a,unleashUrl:l})=>{if(!l)return"";const c={...s,parameters:Ket(s.parameters??{},a)},u=`${l}/api/admin/projects/${t}/features/${n}/environments/${r}`,d=e==="milestone"?`${u}/milestone-strategies/${o}`:`${u}/strategies/${o}`,p=JSON.stringify(c,Y7,2);return`curl --location --request PUT '${d}' \\
380
380
  --header 'Authorization: INSERT_API_KEY' \\
381
381
  --header 'Content-Type: application/json' \\
382
382
  --data-raw '${p}'`},jre=`
@@ -439,18 +439,18 @@ Error generating stack: `+s.message+`
439
439
  --data-raw '${JSON.stringify(j(),Y7,2)}'`,z=soe(o==null?void 0:o.project)(),{addChange:A}=ia(),O=async L=>{if(o){L.preventDefault(),S();try{z?await A(o.project||"",z,{action:"updateSegment",feature:null,payload:{id:o.id,...j()}}):await u(o.id,j()),p(),c(t?`/projects/${t}/settings/segments/`:"/segments/"),a({text:`Segment ${z?"change added to draft":"updated"}`,type:"success"})}catch(B){l(pt(B))}}};return i.jsx(eo,{loading:d,modal:e,title:"Edit segment",description:ooe,documentationLink:yre,documentationLinkLabel:"Segments documentation",formatApiCode:M,children:i.jsx(roe,{handleSubmit:O,name:f,setName:h,description:m,setDescription:y,project:b,setProject:x,constraints:C,setConstraints:w,errors:k,clearErrors:S,mode:"edit",children:i.jsx(Nf,{permission:[nA,Sp],projectId:t,disabled:!E||_,"data-testid":kje,children:z?"Add to draft":"Save"})})})},zft=()=>{const e=$t(),t=!Er("EEA"),n=t?i.jsx(Ra,{darkmode:i.jsx(sy,{}),lightmode:i.jsx(oy,{})}):void 0,r=t?{titleComponent:i.jsx(c0,{feature:"environments",tooltip:!0}),sx:{maxWidth:"320px"},variant:"custom"}:void 0;return i.jsx(kP,{onClick:()=>e("/environments/create"),maxWidth:"700px",Icon:Eo,permission:ni,disabled:t,endIcon:n,tooltipProps:r,children:"New environment"})};let th;const ioe=(e,t,n)=>{const r=g.useRef(null);return g.useEffect(()=>{if(r.current)return r.current.dataset.index=String(e),Hft(r.current,t,(n==null?void 0:n.current)??void 0)},[e,t]),r},Hft=(e,t,n)=>{const r=n??e,o=(f,h)=>{if(th){const m=Number(th.dataset.index),y=Number(e.dataset.index);t({dragIndex:m,dropIndex:y,save:f,event:h,draggedElement:th})}},s=f=>{f.target===r&&(e.draggable=!0)},a=()=>{e.draggable=!1},l=()=>{e.draggable=!0,th=e},c=f=>{o(!1,f)},u=f=>{f.preventDefault()},d=f=>{o(!0,f),th=null},p=()=>{th=null};return r.addEventListener("mouseenter",s),r.addEventListener("mouseleave",a),n&&e.addEventListener("mouseenter",a),e.addEventListener("dragstart",l),e.addEventListener("dragenter",c),e.addEventListener("dragover",u),e.addEventListener("drop",d),e.addEventListener("dragend",p),()=>{r.removeEventListener("mouseenter",s),r.removeEventListener("mouseleave",a),n&&e.removeEventListener("mouseenter",a),e.removeEventListener("dragstart",l),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",u),e.removeEventListener("drop",d),e.removeEventListener("dragend",p)}},Wft=v(ti)(()=>({"&:hover":{".drag-handle .drag-icon":{display:"inherit",cursor:"grab"}}})),Vft=({row:e,onMoveItem:t})=>{const{hasAccess:n}=g.useContext(Bo),r=g.useRef(null),{searchQuery:o}=Pi(),s=!o&&n(jS),a=ioe(e.index,t,r),l=(c,u)=>{const{key:d,...p}=c.getCellProps();return s&&c.column.isDragHandle?i.jsx(Ci,{...p,ref:u,className:"drag-handle",children:c.render("Cell")},d):i.jsx(Ci,{...p,children:c.render("Cell")},d)};return i.jsx(Wft,{hover:!0,ref:s?a:void 0,children:e.cells.map(c=>l(c,r))})},Uft=v(J)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallerBody})),Gft=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Nz=v(an)(({theme:e})=>({marginLeft:e.spacing(1)})),qft=({environment:e})=>{const{searchQuery:t}=Pi();return i.jsx(vn,{sx:n=>({[n.breakpoints.up("sm")]:{minWidth:"350px"}}),children:i.jsxs("div",{children:[i.jsx(Pr,{search:t,children:e.name}),i.jsx(te,{condition:e.protected,show:i.jsx(Nz,{color:"success",children:"Predefined"})}),i.jsx(te,{condition:!e.enabled,show:i.jsx(wr,{maxWidth:"270px",title:i.jsxs(i.Fragment,{children:[i.jsx(Uft,{children:"Deprecated environment"}),i.jsx(Gft,{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:i.jsx(Nz,{color:"neutral",children:"Deprecated"})})})]})})};var N_={},Yft=je;Object.defineProperty(N_,"__esModule",{value:!0});var F_=N_.default=void 0,Kft=Yft(Ee()),Xft=i,Jft=(0,Kft.default)((0,Xft.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"AddToPhotos");F_=N_.default=Jft;var B_={},Zft=je;Object.defineProperty(B_,"__esModule",{value:!0});var aoe=B_.default=void 0,Qft=Zft(Ee()),eht=i,tht=(0,Qft.default)((0,eht.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"}),"VisibilityOutlined");aoe=B_.default=tht;const nht=v(Vg)(({theme:e})=>({padding:e.spacing(1)})),zv=v(wn)(({theme:e})=>({borderRadius:e.shape.borderRadius})),rht=v(zv)(({theme:e})=>({color:e.palette.error.main})),oht=v(Io)(({theme:e})=>({color:e.palette.error.main})),sht=({environment:e,onEdit:t,onDeprecateToggle:n,onClone:r,onDelete:o})=>{const[s,a]=g.useState(null),l=!!s,c=f=>{a(f.currentTarget)},u=()=>{a(null)},d=`environment-${e.name}-actions`,p=`${d}-menu`;return i.jsxs(i.Fragment,{children:[i.jsx(Rt,{title:"Environment actions",arrow:!0,describeChild:!0,children:i.jsx(Mt,{id:d,"aria-controls":l?p:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:i.jsx(Mf,{})})}),i.jsx(ql,{id:p,anchorEl:s,open:l,onClose:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:i.jsxs(nht,{"aria-labelledby":d,children:[i.jsx(Kd,{permission:jS,children:({hasAccess:f})=>i.jsxs(zv,{onClick:()=>{t(),u()},disabled:!f||e.protected,children:[i.jsx(Io,{children:i.jsx(oi,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Edit"})})]})}),i.jsx(Kd,{permission:ni,children:({hasAccess:f})=>i.jsxs(zv,{onClick:()=>{r(),u()},disabled:!f,children:[i.jsx(Io,{children:i.jsx(F_,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Clone"})})]})}),i.jsx(Kd,{permission:jS,children:({hasAccess:f})=>i.jsxs(zv,{onClick:()=>{n(),u()},disabled:!f,children:[i.jsx(Io,{children:i.jsx(te,{condition:e.enabled,show:i.jsx(SP,{}),elseShow:i.jsx(aoe,{})})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:e.enabled?"Deprecate":"Undeprecate"})})]})}),i.jsx(Kd,{permission:fOe,children:({hasAccess:f})=>i.jsxs(rht,{onClick:()=>{o(),u()},disabled:!f||e.protected,children:[i.jsx(oht,{children:i.jsx(So,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Delete"})})]})})]})})]})},f2=(e,t)=>{var n;return!!((n=t==null?void 0:t.toLowerCase())!=null&&n.includes(e.toLowerCase()))},iht=v(Sn)(({theme:e})=>({cursor:"pointer",fontSize:e.fontSizes.bodySize})),loe=({isAllSelected:e,onClick:t})=>i.jsx(K,{sx:{ml:3.5,my:.5},children:i.jsx(iht,{onClick:t,component:"button",underline:"hover",children:e?"Deselect all":"Select all"})}),aht=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",color:e.palette.text.secondary,"& > span:first-of-type":{color:e.palette.text.primary}})),lht=v("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),cht=v("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginRight:e.spacing(1)}})),uht=(e,t,n)=>i.jsxs("li",{...e,children:[i.jsx(Si,{icon:i.jsx(m0,{fontSize:"small"}),checkedIcon:i.jsx(y0,{fontSize:"small"}),style:{marginRight:8},checked:n}),i.jsxs(aht,{children:[i.jsx("span",{children:t.name}),i.jsx("span",{children:t.description})]})]}),dht=e=>i.jsx(lht,{children:e.length>1?`${e.length} projects selected`:e[0].name}),pht=({projects:e,setProjects:t})=>{const{projects:n}=Zr(),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)),s=e.length>0&&e.length===r.length,a=()=>{const c=s?[]:r.map(({id:u})=>u);t(c)},l=({key:c,children:u})=>i.jsxs(g.Fragment,{children:[i.jsx(te,{condition:r.length>2,show:i.jsx(loe,{isAllSelected:s,onClick:a})}),u]},c);return i.jsx(cht,{children:i.jsx(Zl,{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})=>uht(c,u,d),filterOptions:(c,{inputValue:u})=>c.filter(({name:d,description:p})=>f2(u,d)||f2(u,p)),isOptionEqualToValue:(c,u)=>c.id===u.id,getOptionLabel:c=>c.name||c.description||"",renderInput:c=>i.jsx(xn,{...c,label:"Projects"}),renderTags:c=>dht(c),groupBy:()=>"Select/Deselect all",renderGroup:l})})},sm="*",fht=({...e})=>i.jsx(qr,{elevation:8,...e}),hht=v(Si)(({theme:e})=>({marginRight:e.spacing(.4)})),ght=({options:e,defaultValue:t=[sm],onChange:n,disabled:r,error:o,onFocus:s})=>{const[a,l]=g.useState(typeof t=="string"?[t]:t),[c,u]=g.useState(typeof t=="string"||t.includes(sm)),d=a.length>0&&a.length===e.length&&a[0]!==sm,p=(b,x)=>{x?(u(!0),n([sm])):(u(!1),n(a.includes(sm)?[]:a))},f=()=>{const b=d?[]:e.map(({value:x})=>x);l(b),n(b)},h=(b,x,{selected:C})=>{const{key:w,...j}=b;return i.jsxs("li",{...j,children:[i.jsx(hht,{icon:i.jsx(m0,{fontSize:"small"}),checkedIcon:i.jsx(y0,{fontSize:"small"}),checked:C}),x.label]},w)},m=({key:b,children:x})=>i.jsxs(g.Fragment,{children:[i.jsx(te,{condition:e.length>2,show:i.jsx(loe,{isAllSelected:d,onClick:f})}),x]},b),y=b=>i.jsx(xn,{...b,error:!!o,helperText:o,variant:"outlined",label:"Projects",placeholder:"Select one or more projects",onFocus:s,"data-testid":"select-input"});return i.jsxs(K,{sx:{mt:-1,mb:3},children:[i.jsx(K,{sx:{mt:1,mb:.25,ml:1.5},children:i.jsx(Ur,{disabled:r,"data-testid":"select-all-projects",control:i.jsx(Si,{checked:r||c,onChange:p}),label:"ALL current and future projects"})}),i.jsx(Zl,{disabled:r||c,multiple:!0,limitTags:2,options:e,disableCloseOnSelect:!0,getOptionLabel:({label:b})=>b,groupBy:()=>"Select/Deselect all",renderGroup:m,fullWidth:!0,PaperComponent:fht,renderOption:h,renderTags:(b,x)=>b.map((C,w)=>{const{key:j,...k}=x({index:w});return i.jsx(Ti,{size:"small",...k,label:C.label},j)}),renderInput:y,value:c||r?e:e.filter(b=>a.includes(b.value)),onChange:(b,x)=>{const C=x.map(({value:w})=>w);l(C),n(C)}})]})},mht=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({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}},yht=v("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),nh=v("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(4)}})),Mb=v("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),xht=v(Yr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),vht=v("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4)})),bht=v("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),Cht=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),wht=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),Sht=({environment:e,open:t,setOpen:n,newToken:r})=>{const{environments:o,refetchEnvironments:s}=rd(),{cloneEnvironment:a,loading:l}=d0(),{createToken:c}=mht(),{projects:u}=Zr(),{setToastData:d,setToastApiError:p}=_t(),{uiConfig:f}=ut(),[h,m]=g.useState(`${e.name}_clone`),[y,b]=g.useState("development"),[x,C]=g.useState([]),[w,j]=g.useState(["*"]),[k,S]=g.useState(!0),[E,T]=g.useState("later"),[R,_]=g.useState({}),M=V=>{_(oe=>({...oe,[V]:void 0}))},$=(V,oe)=>{_(se=>({...se,[V]:oe}))};g.useEffect(()=>{m(z(e.name)),b("development"),C([]),j(["*"]),S(!0),T("later"),_({})},[e]);const z=V=>{let oe=`${V}_clone`,se=2;for(;!N(oe);)oe=`${e.name}_clone_${se}`,se++;return oe},A=()=>({name:h,type:y,projects:x,clonePermissions:k}),O=()=>({tokenName:`${h}_token`,type:"CLIENT",environment:h,projects:w}),L=async V=>{V.preventDefault();try{if(await a(e.name,A()),E==="now"){const se=await(await c(O())).json();r(se)}d({text:"Environment cloned",type:"success"}),s(),n(!1)}catch(oe){p(pt(oe))}},B=()=>`curl --location --request POST '${f.unleashUrl}/api/admin/environments/${e.name}/clone' \\
440
440
  --header 'Authorization: INSERT_API_KEY' \\
441
441
  --header 'Content-Type: application/json' \\
442
- --data-raw '${JSON.stringify(A(),void 0,2)}'`,H=V=>V.length,N=V=>!(o!=null&&o.some(oe=>oe.name===V)),I=H(h)&&N(h)&&w.length,q=V=>{M("name"),N(V)||$("name","An environment with that name already exists."),m(V)},ne=u.map(V=>({value:V.id,label:V.name}));return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:i.jsx(eo,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature flags and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/concepts/environments#clone-an-environment",documentationLinkLabel:"Cloning environments documentation",formatApiCode:B,children:i.jsxs(yht,{onSubmit:L,children:[i.jsxs("div",{children:[i.jsx(nh,{children:"What is your new environment name? (Can't be changed later)"}),i.jsx(xht,{autoFocus:!0,label:"Environment name",error:!!R.name,errorText:R.name,value:h,onChange:V=>q(V.target.value),required:!0}),i.jsx(nh,{children:"What type of environment do you want to create?"}),i.jsx(cne,{onChange:V=>b(V.currentTarget.value),value:y}),i.jsxs(nh,{children:["Select which projects you want to clone the environment configuration in?",i.jsx(Zo,{tooltip:"The cloned environment will keep the feature flag state for the selected projects, where it will be enabled by default."})]}),i.jsx(pht,{projects:x,setProjects:C}),i.jsx(nh,{children:"Keep the users permission for this environment?"}),i.jsx(Mb,{children:"If you turn it off, the permission for this environment across all projects and feature flags will remain only for admin and editor roles."}),i.jsx(Ur,{label:k?"Yes":"No",control:i.jsx(oa,{onChange:V=>S(V.target.checked),checked:k})}),i.jsxs(vht,{children:[i.jsx(nh,{children:"API Token"}),i.jsxs(Mb,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),i.jsx(Ko,{children:i.jsxs(K3,{value:E,onChange:V=>T(V.target.value),name:"api-token-generation",children:[i.jsx(Ur,{value:"later",control:i.jsx(el,{}),label:"I want to generate an API token later"}),i.jsx(Ur,{value:"now",control:i.jsx(el,{}),label:"Generate an API token now"})]})}),i.jsxs(bht,{children:[i.jsx(Mb,{children:"A new backend API token will be generated for the cloned environment, so you can get started right away."}),i.jsx(te,{condition:E==="now",show:i.jsxs(i.Fragment,{children:[i.jsx(nh,{children:"Which projects do you want this token to give access to?"}),i.jsx(ght,{options:ne,defaultValue:w,onChange:j,error:R.projects,onFocus:()=>M("projects")})]})})]})]})]}),i.jsxs(Cht,{children:[i.jsx($e,{type:"submit",variant:"contained",color:"primary",disabled:!I,children:"Clone environment"}),i.jsx(wht,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},z_=({token:e})=>{const{setToastData:t}=_t(),n=()=>{C7(e)?t({type:"success",text:"Token copied to clipboard"}):t({type:"error",text:"Could not copy token"})};return i.jsxs(K,{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,i.jsx(Rt,{title:"Copy token",arrow:!0,children:i.jsx(Mt,{onClick:n,size:"large",children:i.jsx($f,{})})})]})},jht=({open:e,setOpen:t,token:n})=>i.jsxs(Mn,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[i.jsx(J,{variant:"body1",children:"Your new token has been created successfully."}),i.jsxs(J,{variant:"body1",children:['You can also find it as "',i.jsx("strong",{children:n==null?void 0:n.tokenName}),'" in the'," ",i.jsx(ft,{to:"/admin/api",children:"API access page"}),"."]}),i.jsx(z_,{token:(n==null?void 0:n.secret)||""})]});var H_={},Eht=je;Object.defineProperty(H_,"__esModule",{value:!0});var e8=H_.default=void 0,kht=Eht(Ee()),Tht=i,Rht=(0,kht.default)((0,Tht.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicator");e8=H_.default=Rht;const Aht=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),Pht=v(Mt)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),_ht=v(Zg,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),coe=({environment:e})=>i.jsxs(Aht,{children:[i.jsx(Pht,{size:"large",disableRipple:!0,className:"drag-icon",children:i.jsx(e8,{titleAccess:"Drag to reorder"})}),i.jsx(_ht,{deprecated:!e.enabled})]}),Iht=v(ja)(({theme:e})=>({marginTop:e.spacing(3)})),Oht=v("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),uoe=({environment:e,warnEnabledToggles:t})=>{const n=g.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>i.jsx(coe,{environment:c})},{Header:"Name",accessor:"name",Cell:vn},{Header:"Type",accessor:"type",Cell:vn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>i.jsxs(vn,{children:[u,i.jsx(te,{condition:!!t,show:i.jsx(Oht,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:s,rows:a,prepareRow:l}=on.useTable({columns:n,data:[e],disableSortBy:!0});return i.jsxs(Iht,{...r(),rowHeight:"compact",children:[i.jsx(Sa,{headerGroups:s}),i.jsx(Ji,{...o(),children:a.map(c=>{l(c);const{key:u,...d}=c.getRowProps();return i.jsx(ti,{hover:!0,...d,children:c.cells.map(p=>{const{key:f,...h}=p.getCellProps();return i.jsx(Ci,{...h,children:p.render("Cell")},f)})},u)})})]})},Mht=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,s=o?"Deprecate":"Undeprecate";return i.jsxs(Mn,{title:`${s} environment?`,open:t,primaryButtonText:s,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[i.jsx(te,{condition:o,show:i.jsx(Dt,{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:i.jsx(Dt,{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."})}),i.jsx(uoe,{environment:e})]})},$ht=v("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),Dht=v(Yr)(()=>({width:"100%"})),Lht=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,s]=g.useState("");return g.useEffect(()=>{s("")},[t]),i.jsxs(Mn,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[i.jsxs(Dt,{severity:"error",children:[i.jsx("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 flags."]}),i.jsx(uoe,{environment:e,warnEnabledToggles:!0}),i.jsxs($ht,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",i.jsx("strong",{children:e.name})]}),i.jsx(Dht,{label:"Environment name",value:o,onChange:a=>s(a.target.value)})]})},Nht=({environment:e})=>{const t=$t(),{uiConfig:n}=ut(),r=n.resourceLimits.environments,{setToastApiError:o,setToastData:s}=_t(),{environments:a,refetchEnvironments:l}=rd(),{refetch:c}=BP(),{deleteEnvironment:u,toggleEnvironmentOn:d,toggleEnvironmentOff:p}=d0(),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,x]=g.useState(!1),[C,w]=g.useState(!1),[j,k]=g.useState(),S=async()=>{try{await u(e.name),c(),s({type:"success",text:"Environment deleted"})}catch(T){o(pt(T))}finally{h(!1),await l()}},E=async()=>{try{e.enabled?(await p(e.name),s({type:"success",text:"Environment deprecated"})):(await d(e.name),s({type:"success",text:"Environment undeprecated"}))}catch(T){o(pt(T))}finally{y(!1),await l()}};return i.jsxs(Ku,{children:[i.jsx(sht,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>y(!0),onClone:()=>{a.length<r?x(!0):s({type:"error",text:`Environment limit (${r}) reached`})},onDelete:()=>h(!0)}),i.jsx(Lht,{environment:e,open:f,setOpen:h,onConfirm:S}),i.jsx(Mht,{environment:e,open:m,setOpen:y,onConfirm:E}),i.jsx(Sht,{environment:e,open:b,setOpen:x,newToken:T=>{k(T),w(!0)}}),i.jsx(jht,{open:C,setOpen:w,token:j})]})},Fht=v(Dt)(({theme:e})=>({marginBottom:e.spacing(4)})),Bht=()=>{const{changeSortOrder:e}=d0(),{setToastApiError:t}=_t(),{environments:n,mutateEnvironments:r}=rd(),o=Er("EEA"),{isEnterprise:s}=ut(),a=g.useCallback(async({dragIndex:w,dropIndex:j,save:k})=>{const E=[...n||[]],T=E.splice(w,1)[0];if(E.splice(j,0,T),await r(E),k)try{await e(uet(E))}catch(R){t(pt(R))}},[e,n,r,t]),l=g.useMemo(()=>{const w=[...zht,...o?[{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:j}})=>i.jsx(Nht,{environment:j}),disableGlobalFilter:!0}]:[]];return s()&&w.splice(2,0,{Header:"Change request",accessor:j=>Number.isInteger(j.requiredApprovals)?"yes":"no",Cell:vn}),w},[o]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f,state:{globalFilter:h},setGlobalFilter:m}=on.useTable({columns:l,data:n,disableSortBy:!0},on.useGlobalFilter),y=i.jsx(No,{initialValue:h,onChange:m}),b=i.jsxs(i.Fragment,{children:[y,i.jsx($n.Divider,{}),i.jsx(zft,{})]}),x=p.length,C=i.jsx($n,{title:`Environments (${x})`,actions:b});return o?i.jsxs(ir,{header:C,children:[i.jsx(Fht,{severity:"info",children:"This is the order of environments that you have today in each feature flag. Rearranging them here will change also the order inside each feature flag."}),i.jsx(Ai,{value:h,children:i.jsxs(ja,{...c(),rowHeight:"compact",children:[i.jsx(Sa,{headerGroups:d}),i.jsx(Ji,{...u(),children:p.map(w=>(f(w),i.jsx(Vft,{row:w,onMoveItem:a},w.original.name)))})]})}),i.jsx(te,{condition:p.length===0,show:i.jsx(te,{condition:(h==null?void 0:h.length)>0,show:i.jsxs(Gr,{children:["No environments found matching “",h,"”"]}),elseShow:i.jsx(Gr,{children:"No environments available. Get started by adding one."})})})]}):i.jsx(ir,{header:C,children:i.jsx(c0,{feature:"environments"})})},zht=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>i.jsx(coe,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>i.jsx(qft,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:wi},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:vn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:vn}],Hht=()=>{const e=wo("projectId"),t=$t();return i.jsx(lo,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[l7,Sp],projectId:e,"data-testid":vje,children:"New segment"})},Wht=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),Vht=v(J)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),Uht=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),Ght=v(ft)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),qht=()=>{const e=wo("projectId"),{hasAccess:t}=g.useContext(Bo);return i.jsxs(Wht,{children:[i.jsx(Vht,{children:"No segments yet!"}),i.jsx(Uht,{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."}),i.jsx(te,{condition:t([l7,Sp],e),show:i.jsx(Ght,{to:"/segments/create",children:"Create your first segment"})})]})};var W_={},Yht=je;Object.defineProperty(W_,"__esModule",{value:!0});var doe=W_.default=void 0,Kht=Yht(Ee()),Xht=i,Jht=(0,Kht.default)((0,Xht.jsx)("path",{d:"M11 5.08V2c-5 .5-9 4.81-9 10s4 9.5 9 10v-3.08c-3-.48-6-3.4-6-6.92s3-6.44 6-6.92zM18.97 11H22c-.47-5-4-8.53-9-9v3.08C16 5.51 18.54 8 18.97 11zM13 18.92V22c5-.47 8.53-4 9-9h-3.03c-.43 3-2.97 5.49-5.97 5.92z"}),"DonutLarge");doe=W_.default=Jht;const Zht=v(Yr)(({theme:e})=>({marginTop:e.spacing(2)})),Qht=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const[s,a]=g.useState(""),l=d=>a(d.currentTarget.value),c=()=>{n(),a("")},u="delete-segment-confirmation-form";return i.jsxs(Mn,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:o,secondaryButtonText:"Cancel",onClick:()=>{r(),a("")},disabledPrimaryButton:(e==null?void 0:e.name)!==s,onClose:c,formId:u,children:[i.jsx(Dt,{sx:{marginBottom:2},severity:"warning",children:"Deleted segments may be referenced in strategies if the feature flag is archived. Removing the segment will also remove the segments from strategies of archived flags."}),i.jsxs("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",i.jsx("strong",{children:e==null?void 0:e.name})]}),i.jsx("form",{id:u,children:i.jsx(Zht,{autoFocus:!0,onChange:l,value:s,label:"Segment name","data-testid":Rje})})]})},egt=v("ul")({marginBottom:0}),Fz=v(ft)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),tgt=(e,t)=>`/projects/${e}/change-requests/${t}`,ngt=({segment:e,open:t,onClose:n,strategies:r,changeRequestStrategies:o})=>{const s=toe(r??[],o??[]);return i.jsxs(Mn,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[i.jsxs("p",{children:["The following feature flags are using the"," ",i.jsx("strong",{children:e.name})," segment for their strategies:"]}),i.jsx(egt,{children:s.map((a,l)=>rgt(a,l))})]})},Bz=e=>e.strategyName?`(${Xl(e.strategyName)})`:"",rgt=(e,t)=>{if((r=>"changeRequest"in r)(e)){const{id:r,title:o}=e.changeRequest,s=o?`#${r} (${o})`:`#${r}`;return i.jsx("li",{children:i.jsxs("p",{children:[e.featureName," ",`${Bz(e)} — in change request `,i.jsx(Fz,{to:tgt(e.projectId,r),target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:s})]})},`#${e.changeRequest.id}@${t}`)}else return i.jsx("li",{children:i.jsxs(Fz,{to:X7(e.projectId,e.featureName,e.environment,e.id),target:"_blank",rel:"noopener noreferrer",children:[e.featureName," ",Bz(e)]})},e.id)},ogt=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const{strategies:s,changeRequestStrategies:a,loading:l}=eoe(e.id),c=(s==null?void 0:s.length)===0&&(a==null?void 0:a.length)===0;return l?null:i.jsx(te,{condition:c,show:i.jsx(Qht,{segment:e,open:t,onClose:n,onRemove:r,title:o}),elseShow:i.jsx(ngt,{segment:e,open:t,onClose:n,strategies:s,changeRequestStrategies:a})})},sgt=({segment:e})=>{const t=wo("projectId"),{refetchSegments:n}=od(),{deleteSegment:r}=I_(),{setToastData:o,setToastApiError:s}=_t(),[a,l]=g.useState(!1),u=soe(e==null?void 0:e.project)(),{addChange:d}=ia(),p=async()=>{try{u&&e.project?await d(e.project,u,{action:"deleteSegment",feature:null,payload:{id:e.id}}):await r(e.id),await n(),o({text:`Segment ${u?"change added to draft":"deleted"}`,type:"success"})}catch(f){s(pt(f))}finally{l(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Co,{onClick:()=>l(!0),permission:[mOe,Sp],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${Tje}_${e.name}`,children:i.jsx(So,{"data-loading":!0})}),i.jsx(te,{condition:a,show:()=>i.jsx(ogt,{segment:e,open:a,onClose:()=>l(!1),onRemove:p,title:u?"Add to draft":"Save"})})]})},igt=({segment:e})=>{const t=wo("projectId"),n=$t();return i.jsx(Co,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[nA,Sp],projectId:t,tooltipProps:{title:"Edit segment"},children:i.jsx(oi,{"data-loading":!0})})},agt=({segment:e})=>i.jsxs(Ku,{children:[i.jsx(igt,{segment:e}),i.jsx(sgt,{segment:e})]}),Bf=(e,t,n)=>{g.useEffect(()=>{const r=e.filter(({condition:s})=>s).flatMap(({columns:s})=>s),o=e.flatMap(({columns:s})=>s).filter(s=>!r.includes(s));t(s=>[...new Set([...s,...r].filter(a=>!o.includes(a)))])},[...e.map(({condition:r})=>r),t,n])},lgt=()=>{const e=wo("projectId"),{segments:t,loading:n}=od(),r=Nn(br.breakpoints.down("md")),[o]=g.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),s=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(()=>cgt(e),[e]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:f},setGlobalFilter:h,setHiddenColumns:m}=on.useTable({initialState:o,columns:a,data:s,sortTypes:Ds,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:wi},getRowId:y=>y.id},on.useGlobalFilter,on.useSortBy);return Bf([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],m,a),i.jsx(ir,{header:i.jsx($n,{title:`Segments (${d.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:f,onChange:h}),i.jsx($n.Divider,{}),i.jsx(Hht,{})]})}),isLoading:n,children:i.jsx(te,{condition:!n&&s.length===0,show:i.jsx(Gr,{children:i.jsx(qht,{})}),elseShow:()=>i.jsxs(i.Fragment,{children:[i.jsx(Ai,{value:f,children:i.jsxs(ja,{...l(),rowHeight:"standard",children:[i.jsx(Sa,{headerGroups:u}),i.jsx(Ji,{...c(),children:d.map(y=>{p(y);const{key:b,...x}=y.getRowProps();return i.jsx(ti,{hover:!0,...x,children:y.cells.map(C=>{const{key:w,...j}=C.getCellProps();return i.jsx(Ci,{...j,children:C.render("Cell")},w)})},b)})})]})}),i.jsx(te,{condition:d.length===0&&(f==null?void 0:f.length)>0,show:i.jsxs(Gr,{children:["No segments found matching “",f,"”"]})})]})})})},cgt=e=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>i.jsx(J7,{icon:i.jsx(doe,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:t,description:n,id:r}}})=>i.jsx(Yl,{title:t,to:e?`/projects/${e}/settings/segments/edit/${r}`:`/segments/edit/${r}`,subtitle:n})},{Header:"Used in",width:"60%",Cell:({row:{original:t}})=>i.jsx(Dre,{original:t})},{Header:"Project",accessor:"project",Cell:({value:t})=>i.jsx(te,{condition:!!t,show:i.jsx(Yl,{title:t,to:`/projects/${t}`}),elseShow:i.jsx(vn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Cp,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:t}})=>i.jsx(agt,{segment:t})},{accessor:"description"}],ugt=v("div")(({theme:e})=>({padding:e.spacing(1.5),display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),dgt=({value:e,getValue:t})=>{var l;const n=e||(t==null?void 0:t())||void 0,{featureTypes:r}=t0(),o=v7(n),a=`This is a "${((l=r.find(c=>c.id===n))==null?void 0:l.name)||n}" toggle`;return i.jsx(ugt,{children:i.jsx(Rt,{arrow:!0,title:a,describeChild:!0,children:i.jsx(o,{"data-loading":!0})})})},pgt=({onRevive:e,onDelete:t,project:n})=>i.jsxs(Ku,{children:[i.jsx(Co,{onClick:e,projectId:n,permission:Qg,tooltipProps:{title:"Revive feature flag"},"data-testid":"revive-feature-flag-button",children:i.jsx(FP,{})}),i.jsx(Co,{permission:cQ,projectId:n,tooltipProps:{title:"Delete feature flag"},onClick:t,children:i.jsx(So,{})})]}),fgt=({value:e})=>{const{locationSettings:t}=$r(),n=Bt();return e?i.jsx(vn,{children:i.jsx(Rt,{title:`Archived on: ${Zc(e,t.locale)}`,arrow:!0,children:i.jsx(J,{noWrap:!0,variant:"body2","data-loading":!0,children:i.jsx(Kl,{date:new Date(e),refresh:!1})})})}):i.jsx(vn,{children:i.jsx(J,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},zz=v("p")(({theme:e})=>({marginTop:e.spacing(3)})),hgt=v(Yr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),ggt="I want to delete",mgt=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[s,a]=g.useState(""),{setToastData:l,setToastApiError:c}=_t(),{deleteFeatures:u}=u0(),d=e.length>1?"flags":"flag",p=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",text:`Feature ${d} deleted`})}catch(m){c(pt(m))}finally{f()}},f=()=>{r(!1),a("")},h="delete-feature-toggle-confirmation-form";return i.jsxs(Mn,{title:`Delete feature ${d}?`,open:n,primaryButtonText:`Delete feature ${d}`,secondaryButtonText:"Cancel",onClick:p,onClose:f,disabledPrimaryButton:ggt!==s,formId:h,children:[i.jsxs(Dt,{severity:"warning",children:[i.jsx("b",{children:"Warning!"})," Before you delete a feature flag, make sure all in-code references to that feature flag have been removed. Otherwise, a new feature flag with the same name could activate the old code paths."]}),i.jsxs(zz,{children:["You are about to delete the following feature"," ",d,":"," ",i.jsx("strong",{children:e.join(", ")}),"."]}),i.jsxs(zz,{sx:m=>({marginTop:m.spacing(2)}),children:["In order to delete the feature ",d,", please enter the following confirmation text in the text field below:"," ",i.jsx("strong",{children:"I want to delete"})]}),i.jsx("form",{id:h,children:i.jsx(hgt,{autoFocus:!0,onChange:m=>{a(m.currentTarget.value)},value:s,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},Hz=v("p")(({theme:e})=>({marginTop:e.spacing(2)})),ygt=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:s,setToastApiError:a}=_t(),{reviveFeatures:l}=u0(),{project:c,loading:u}=e0(t),d=async()=>{try{if(e.length===0)return;await l(t,e),await o(),s({type:"success",text:"Feature flags revived"})}catch(m){a(pt(m))}finally{p()}},p=()=>{r(!1)},f=`Revive feature flag${e.length>1?"s":""}?`,h=`Revive feature flag${e.length>1?"s":""}`;return i.jsxs(Mn,{title:f,open:n,primaryButtonText:h,secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:u||!!c.archivedAt,children:[i.jsx(te,{condition:!!c.archivedAt,show:i.jsxs(Dt,{severity:"warning",children:["Cannot revive feature flag in archived project (Project ID: ",t,")"]}),elseShow:i.jsx(Dt,{severity:"info",children:"Revived feature flags will be automatically disabled in all environments"})}),i.jsx(te,{condition:e.length>1,show:i.jsxs(i.Fragment,{children:[i.jsx(Hz,{children:"You are about to revive feature flags:"}),i.jsx("ul",{children:e.map(m=>i.jsx("li",{children:m},`revive-${m}`))})]}),elseShow:i.jsxs(Hz,{children:["You are about to revive feature flag:"," ",e[0]]})})]})},xgt=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:s})=>{const a=Nn(br.breakpoints.down("md")),l=Nn(br.breakpoints.down("lg")),[c,u]=g.useState(!1),[d,p]=g.useState(),[f,h]=g.useState(!1),[m,y]=g.useState(),[b,x]=Mp(),[C,w]=g.useState(b.get("search")||""),j=g.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({row:{original:L}})=>i.jsx(AQ,{feature:L}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:dgt,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:L,row:{original:B}})=>i.jsx(wi,{value:L,subtitle:B.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Cp},{Header:"Archived",accessor:"archivedAt",width:150,Cell:fgt},{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:L})=>i.jsx(Yl,{title:L,to:`/projects/${L}`})},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:L}})=>i.jsx(pgt,{project:L.project,onRevive:()=>{y(L),h(!0)},onDelete:()=>{p(L),u(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[]),{data:k,getSearchText:S,getSearchContext:E}=Af(j,C,e),T=g.useMemo(()=>t?oee:k,[k,t]),[R]=g.useState(()=>({sortBy:[{id:b.get("sort")||r.id,desc:b.has("order")?b.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),_=g.useCallback(L=>L.name,[]),{headerGroups:M,rows:$,state:{sortBy:z},prepareRow:A,setHiddenColumns:O}=on.useTable({columns:j,data:T,initialState:R,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:_},on.useFlexLayout,on.useSortBy,on.useRowSelect);return Bf([{condition:a,columns:["type","createdAt"]},{condition:l,columns:["lastSeenAt","stale"]}],O,j),g.useEffect(()=>{if(t)return;const L={};L.sort=z[0].id,z[0].desc&&(L.order="desc"),C&&(L.search=C),x(L,{replace:!0}),o({id:z[0].id,desc:z[0].desc||!1})},[t,z,C]),i.jsx(i.Fragment,{children:i.jsxs(ir,{isLoading:t,header:i.jsx($n,{titleElement:`${s} (${$.length})`,actions:i.jsx(No,{initialValue:C,onChange:w,hasFilters:!0,getSearchContext:E})}),children:[$.length>=50&&i.jsx(Dt,{color:"info",sx:{mb:2},children:"A maximum of 50 archived flags are displayed. If you don't see the one you're looking for, try using search."}),i.jsx(Ai,{value:S(C),children:i.jsx(Wp,{rows:$,headerGroups:M,prepareRow:A})}),i.jsx(te,{condition:$.length===0,show:()=>i.jsx(te,{condition:(C==null?void 0:C.length)>0,show:i.jsxs(Gr,{children:["No feature flags found matching “",C,"”"]}),elseShow:i.jsx(Gr,{children:"None of the feature flags were archived yet."})})}),i.jsx(mgt,{deletedFeatures:[d==null?void 0:d.name],projectId:d==null?void 0:d.project,open:c,setOpen:u,refetch:n}),i.jsx(ygt,{revivedFeatures:[m==null?void 0:m.name],projectId:m==null?void 0:m.project,open:f,setOpen:h,refetch:n})]})})},vgt={id:"createdAt"},{value:bgt,setValue:Cgt}=td("FeaturesArchiveTable:v1",vgt),wgt=()=>{nd("Archive");const[e]=Mp(),{features:t,loading:n,refetch:r}=y7({query:e.get("search")||void 0,archived:"IS:true"});return i.jsx(xgt,{title:"Archive",archivedFeatures:t,loading:n,storedParams:bgt,setStoredParams:Cgt,refetch:r})},Sgt=g.lazy(()=>La(()=>import("./AdvancedPlayground-BTPrG6RW.js"),[])),jgt=v($e)(({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(0,2),gap:e.spacing(1),fontSize:e.typography.body2.fontSize,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}})),Egt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),kgt=v("div")(({theme:e})=>({fontWeight:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),Tgt=({label:e,description:t,selected:n,onClick:r,startIcon:o,endIcon:s})=>i.jsxs(jgt,{selected:!!n,className:n?"selected":"",onClick:r,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[o,i.jsxs(Egt,{children:[e,i.jsx(te,{condition:!!t,show:i.jsx(kgt,{children:t})})]}),s]}),Rgt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("xl")]:{flexDirection:"column"}})),Agt=v("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),Wz=v("div",{shouldForwardProp:e=>e!=="fullWidth"})(({theme:e,fullWidth:t})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:t?"100%":e.spacing(30),flexShrink:0,[e.breakpoints.down("xl")]:{width:"100%"}})),Pgt=({tabs:e,value:t,onChange:n,children:r,...o})=>{const s=e.filter(a=>!a.hidden).map(a=>i.jsx(Tgt,{label:a.label,description:a.description,selected:a.id===t,onClick:()=>n(a),startIcon:a.startIcon,endIcon:a.endIcon},a.id));return r?i.jsxs(Rgt,{children:[i.jsx(Wz,{...o,children:s}),i.jsx(Agt,{children:r})]}):i.jsx(Wz,{fullWidth:!0,...o,children:s})},poe=(e,t={})=>{const n=async()=>{const u=yt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(en("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:s}=f0({},r,n,t),[a,l]=g.useState(!s&&!o),c=()=>{Fo(r)};return g.useEffect(()=>{l(!s&&!o)},[o,s]),{config:o||{},error:s,loading:a,refetch:c}},_gt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{changePassword:async s=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(s)});await e(a.caller,a.id)},errors:n,loading:r}},Igt=v("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),Ogt=()=>{const{config:e,loading:t}=poe("simple"),[n,r]=g.useState(!1),{setToastData:o,setToastApiError:s}=_t(),[a,l]=g.useState(!1),[c,u]=g.useState(),[d,p]=g.useState(),[f,h]=g.useState(""),[m,y]=g.useState(""),[b,x]=g.useState(""),{changePassword:C}=_gt(),w=f!==m,j=b===m,k=f.length>0&&m.length>0&&b.length>0,S=!k||w||j,E=async T=>{if(T.preventDefault(),!S){if(!a)u(Tte);else{r(!0),u(void 0),p(void 0);try{await C({password:f,confirmPassword:m,oldPassword:b}),o({text:"Password changed",type:"success"})}catch(R){const _=pt(R);R instanceof uR?p(_):u(_),s(_)}}r(!1)}};return t?null:i.jsx(ir,{isLoading:n,header:"Change password",children:i.jsx(te,{condition:e.disabled,show:i.jsx(Dt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:i.jsxs(Igt,{children:[i.jsx(Rte,{password:f,callback:l,"data-loading":!0}),i.jsx(Nu,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:T=>x(T.target.value)}),i.jsx(Nu,{"data-loading":!0,label:"Password",name:"password",value:f,error:!!c,helperText:c,autoComplete:"new-password",onChange:T=>h(T.target.value)}),i.jsx(Nu,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:m,autoComplete:"new-password",onChange:T=>y(T.target.value)}),i.jsx(Ate,{"data-loading":!0,started:k,passwordsDoNotMatch:w,sameAsOldPassword:j}),i.jsx($e,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:E,disabled:S,children:"Save"})]})})})},Mgt=/^[a-z0-9\-_]*$/,$gt="environment",Dgt="project",foe="root",hoe="project",Lgt="root-custom",Ngt="custom",Fgt=[foe,hoe],Jqt=[foe,Lgt],Bgt=[hoe,Ngt],goe=10,V_=()=>{const{data:e,error:t,mutate:n}=On(yt("api/admin/user/tokens"),zgt);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},zgt=e=>fetch(e).then(en("Personal API Tokens")).then(t=>t.json()),moe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({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}},Hgt=e=>{const t=new Date(e);return Jo(t,"yyyy-MM-dd")},Wgt=e=>{const t=new Date(e);return`${Jo(t,"yyyy-MM-dd")}T${Jo(t,"HH:mm")}`},Vgt=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:s,value:a,onChange:l,...c})=>{const u=t==="datetime"?Wgt:Hgt,d=t==="datetime"?"datetime-local":"date";return i.jsx(xn,{type:d,size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=AR(p.target.value);l(f??a)},FormHelperTextProps:{"data-testid":$J},inputProps:{min:o&&u(o.toISOString()),max:s&&u(s.toISOString())},...c})},Vz=v("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Ugt=v(Yr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),Ggt=v("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"}})),qgt=v(x_)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Ygt=v(Vgt)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Kgt=v(Dt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var yoe=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(yoe||{});const xoe=[{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"}],fj=e=>{const t=new Date,n=xoe.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},Xgt=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:s,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=$r(),d=y=>{c(b=>({...b,[y]:void 0}))},p=(y,b)=>{c(x=>({...x,[y]:b}))};g.useEffect(()=>{d("expiresAt"),a(fj(r))},[r]);const f=y=>{d("description"),n&&!n(y)&&p("description","A token with that description already exists."),t(y)},h=r==="custom",m=s.getFullYear()>new Date().getFullYear()+100;return i.jsxs(i.Fragment,{children:[i.jsx(Vz,{children:"Describe what this token will be used for"}),i.jsx(Ugt,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:y=>f(y.target.value),required:!0}),i.jsx(Vz,{children:"Token expiration date"}),i.jsxs(Ggt,{custom:h,children:[i.jsx(qgt,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:y=>o(y.target.value),options:xoe}),i.jsx(te,{condition:h,show:()=>i.jsx(Ygt,{label:"Date",value:s,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:i.jsx(te,{condition:m,show:i.jsxs(J,{variant:"body2",children:["The token will ",i.jsx("strong",{children:"never"})," ","expire!"]}),elseShow:()=>i.jsxs(J,{variant:"body2",children:["Token will expire on"," ",i.jsx("strong",{children:Zc(s,u.locale)})]})})})]}),i.jsx(te,{condition:m,show:i.jsx(Kgt,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},Jgt=v("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Zgt=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Qgt=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),Jx=yoe["30DAYS"],e0t=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=V_(),{createPersonalAPIToken:s,loading:a}=moe(),{setToastApiError:l}=_t(),{uiConfig:c}=ut(),[u,d]=g.useState(""),[p,f]=g.useState(Jx),[h,m]=g.useState(fj(Jx)),[y,b]=g.useState({});g.useEffect(()=>{d(""),f(Jx),m(fj(Jx)),b({})},[e]);const x=()=>({description:u,expiresAt:h}),C=async E=>{E.preventDefault();try{const T=await s(x());n(T),o(),t(!1)}catch(T){l(pt(T))}},w=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
442
+ --data-raw '${JSON.stringify(A(),void 0,2)}'`,H=V=>V.length,N=V=>!(o!=null&&o.some(oe=>oe.name===V)),I=H(h)&&N(h)&&w.length,q=V=>{M("name"),N(V)||$("name","An environment with that name already exists."),m(V)},ne=u.map(V=>({value:V.id,label:V.name}));return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:i.jsx(eo,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature flags and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/concepts/environments#clone-an-environment",documentationLinkLabel:"Cloning environments documentation",formatApiCode:B,children:i.jsxs(yht,{onSubmit:L,children:[i.jsxs("div",{children:[i.jsx(nh,{children:"What is your new environment name? (Can't be changed later)"}),i.jsx(xht,{autoFocus:!0,label:"Environment name",error:!!R.name,errorText:R.name,value:h,onChange:V=>q(V.target.value),required:!0}),i.jsx(nh,{children:"What type of environment do you want to create?"}),i.jsx(cne,{onChange:V=>b(V.currentTarget.value),value:y}),i.jsxs(nh,{children:["Select which projects you want to clone the environment configuration in?",i.jsx(Zo,{tooltip:"The cloned environment will keep the feature flag state for the selected projects, where it will be enabled by default."})]}),i.jsx(pht,{projects:x,setProjects:C}),i.jsx(nh,{children:"Keep the users permission for this environment?"}),i.jsx(Mb,{children:"If you turn it off, the permission for this environment across all projects and feature flags will remain only for admin and editor roles."}),i.jsx(Ur,{label:k?"Yes":"No",control:i.jsx(oa,{onChange:V=>S(V.target.checked),checked:k})}),i.jsxs(vht,{children:[i.jsx(nh,{children:"API Token"}),i.jsxs(Mb,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),i.jsx(Ko,{children:i.jsxs(K3,{value:E,onChange:V=>T(V.target.value),name:"api-token-generation",children:[i.jsx(Ur,{value:"later",control:i.jsx(el,{}),label:"I want to generate an API token later"}),i.jsx(Ur,{value:"now",control:i.jsx(el,{}),label:"Generate an API token now"})]})}),i.jsxs(bht,{children:[i.jsx(Mb,{children:"A new backend API token will be generated for the cloned environment, so you can get started right away."}),i.jsx(te,{condition:E==="now",show:i.jsxs(i.Fragment,{children:[i.jsx(nh,{children:"Which projects do you want this token to give access to?"}),i.jsx(ght,{options:ne,defaultValue:w,onChange:j,error:R.projects,onFocus:()=>M("projects")})]})})]})]})]}),i.jsxs(Cht,{children:[i.jsx($e,{type:"submit",variant:"contained",color:"primary",disabled:!I,children:"Clone environment"}),i.jsx(wht,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},z_=({token:e})=>{const{setToastData:t}=_t(),n=()=>{C7(e)?t({type:"success",text:"Token copied to clipboard"}):t({type:"error",text:"Could not copy token"})};return i.jsxs(K,{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,i.jsx(Rt,{title:"Copy token",arrow:!0,children:i.jsx(Mt,{onClick:n,size:"large",children:i.jsx($f,{})})})]})},jht=({open:e,setOpen:t,token:n})=>i.jsxs(Mn,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[i.jsx(J,{variant:"body1",children:"Your new token has been created successfully."}),i.jsxs(J,{variant:"body1",children:['You can also find it as "',i.jsx("strong",{children:n==null?void 0:n.tokenName}),'" in the'," ",i.jsx(ft,{to:"/admin/api",children:"API access page"}),"."]}),i.jsx(z_,{token:(n==null?void 0:n.secret)||""})]});var H_={},Eht=je;Object.defineProperty(H_,"__esModule",{value:!0});var e8=H_.default=void 0,kht=Eht(Ee()),Tht=i,Rht=(0,kht.default)((0,Tht.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicator");e8=H_.default=Rht;const Aht=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),Pht=v(Mt)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),_ht=v(Zg,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),coe=({environment:e})=>i.jsxs(Aht,{children:[i.jsx(Pht,{size:"large",disableRipple:!0,className:"drag-icon",children:i.jsx(e8,{titleAccess:"Drag to reorder"})}),i.jsx(_ht,{deprecated:!e.enabled})]}),Iht=v(ja)(({theme:e})=>({marginTop:e.spacing(3)})),Oht=v("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),uoe=({environment:e,warnEnabledToggles:t})=>{const n=g.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>i.jsx(coe,{environment:c})},{Header:"Name",accessor:"name",Cell:vn},{Header:"Type",accessor:"type",Cell:vn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>i.jsxs(vn,{children:[u,i.jsx(te,{condition:!!t,show:i.jsx(Oht,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:s,rows:a,prepareRow:l}=on.useTable({columns:n,data:[e],disableSortBy:!0});return i.jsxs(Iht,{...r(),rowHeight:"compact",children:[i.jsx(Sa,{headerGroups:s}),i.jsx(Ji,{...o(),children:a.map(c=>{l(c);const{key:u,...d}=c.getRowProps();return i.jsx(ti,{hover:!0,...d,children:c.cells.map(p=>{const{key:f,...h}=p.getCellProps();return i.jsx(Ci,{...h,children:p.render("Cell")},f)})},u)})})]})},Mht=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,s=o?"Deprecate":"Undeprecate";return i.jsxs(Mn,{title:`${s} environment?`,open:t,primaryButtonText:s,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[i.jsx(te,{condition:o,show:i.jsx(Dt,{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:i.jsx(Dt,{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."})}),i.jsx(uoe,{environment:e})]})},$ht=v("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),Dht=v(Yr)(()=>({width:"100%"})),Lht=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,s]=g.useState("");return g.useEffect(()=>{s("")},[t]),i.jsxs(Mn,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[i.jsxs(Dt,{severity:"error",children:[i.jsx("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 flags."]}),i.jsx(uoe,{environment:e,warnEnabledToggles:!0}),i.jsxs($ht,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",i.jsx("strong",{children:e.name})]}),i.jsx(Dht,{label:"Environment name",value:o,onChange:a=>s(a.target.value)})]})},Nht=({environment:e})=>{const t=$t(),{uiConfig:n}=ut(),r=n.resourceLimits.environments,{setToastApiError:o,setToastData:s}=_t(),{environments:a,refetchEnvironments:l}=rd(),{refetch:c}=BP(),{deleteEnvironment:u,toggleEnvironmentOn:d,toggleEnvironmentOff:p}=d0(),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,x]=g.useState(!1),[C,w]=g.useState(!1),[j,k]=g.useState(),S=async()=>{try{await u(e.name),c(),s({type:"success",text:"Environment deleted"})}catch(T){o(pt(T))}finally{h(!1),await l()}},E=async()=>{try{e.enabled?(await p(e.name),s({type:"success",text:"Environment deprecated"})):(await d(e.name),s({type:"success",text:"Environment undeprecated"}))}catch(T){o(pt(T))}finally{y(!1),await l()}};return i.jsxs(Ku,{children:[i.jsx(sht,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>y(!0),onClone:()=>{a.length<r?x(!0):s({type:"error",text:`Environment limit (${r}) reached`})},onDelete:()=>h(!0)}),i.jsx(Lht,{environment:e,open:f,setOpen:h,onConfirm:S}),i.jsx(Mht,{environment:e,open:m,setOpen:y,onConfirm:E}),i.jsx(Sht,{environment:e,open:b,setOpen:x,newToken:T=>{k(T),w(!0)}}),i.jsx(jht,{open:C,setOpen:w,token:j})]})},Fht=v(Dt)(({theme:e})=>({marginBottom:e.spacing(4)})),Bht=()=>{const{changeSortOrder:e}=d0(),{setToastApiError:t}=_t(),{environments:n,mutateEnvironments:r}=rd(),o=Er("EEA"),{isEnterprise:s}=ut(),a=g.useCallback(async({dragIndex:w,dropIndex:j,save:k})=>{const E=[...n||[]],T=E.splice(w,1)[0];if(E.splice(j,0,T),await r(E),k)try{await e(uet(E))}catch(R){t(pt(R))}},[e,n,r,t]),l=g.useMemo(()=>{const w=[...zht,...o?[{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:j}})=>i.jsx(Nht,{environment:j}),disableGlobalFilter:!0}]:[]];return s()&&w.splice(2,0,{Header:"Change request",accessor:j=>Number.isInteger(j.requiredApprovals)?"yes":"no",Cell:vn}),w},[o]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f,state:{globalFilter:h},setGlobalFilter:m}=on.useTable({columns:l,data:n,disableSortBy:!0},on.useGlobalFilter),y=i.jsx(No,{initialValue:h,onChange:m}),b=i.jsxs(i.Fragment,{children:[y,i.jsx($n.Divider,{}),i.jsx(zft,{})]}),x=p.length,C=i.jsx($n,{title:`Environments (${x})`,actions:b});return o?i.jsxs(ir,{header:C,children:[i.jsx(Fht,{severity:"info",children:"This is the order of environments that you have today in each feature flag. Rearranging them here will change also the order inside each feature flag."}),i.jsx(Ai,{value:h,children:i.jsxs(ja,{...c(),rowHeight:"compact",children:[i.jsx(Sa,{headerGroups:d}),i.jsx(Ji,{...u(),children:p.map(w=>(f(w),i.jsx(Vft,{row:w,onMoveItem:a},w.original.name)))})]})}),i.jsx(te,{condition:p.length===0,show:i.jsx(te,{condition:(h==null?void 0:h.length)>0,show:i.jsxs(Gr,{children:["No environments found matching “",h,"”"]}),elseShow:i.jsx(Gr,{children:"No environments available. Get started by adding one."})})})]}):i.jsx(ir,{header:C,children:i.jsx(c0,{feature:"environments"})})},zht=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>i.jsx(coe,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>i.jsx(qft,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:wi},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:vn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:vn}],Hht=()=>{const e=wo("projectId"),t=$t();return i.jsx(lo,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[l7,Sp],projectId:e,"data-testid":vje,children:"New segment"})},Wht=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),Vht=v(J)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),Uht=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),Ght=v(ft)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),qht=()=>{const e=wo("projectId"),{hasAccess:t}=g.useContext(Bo);return i.jsxs(Wht,{children:[i.jsx(Vht,{children:"No segments yet!"}),i.jsx(Uht,{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."}),i.jsx(te,{condition:t([l7,Sp],e),show:i.jsx(Ght,{to:"/segments/create",children:"Create your first segment"})})]})};var W_={},Yht=je;Object.defineProperty(W_,"__esModule",{value:!0});var doe=W_.default=void 0,Kht=Yht(Ee()),Xht=i,Jht=(0,Kht.default)((0,Xht.jsx)("path",{d:"M11 5.08V2c-5 .5-9 4.81-9 10s4 9.5 9 10v-3.08c-3-.48-6-3.4-6-6.92s3-6.44 6-6.92zM18.97 11H22c-.47-5-4-8.53-9-9v3.08C16 5.51 18.54 8 18.97 11zM13 18.92V22c5-.47 8.53-4 9-9h-3.03c-.43 3-2.97 5.49-5.97 5.92z"}),"DonutLarge");doe=W_.default=Jht;const Zht=v(Yr)(({theme:e})=>({marginTop:e.spacing(2)})),Qht=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const[s,a]=g.useState(""),l=d=>a(d.currentTarget.value),c=()=>{n(),a("")},u="delete-segment-confirmation-form";return i.jsxs(Mn,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:o,secondaryButtonText:"Cancel",onClick:()=>{r(),a("")},disabledPrimaryButton:(e==null?void 0:e.name)!==s,onClose:c,formId:u,children:[i.jsx(Dt,{sx:{marginBottom:2},severity:"warning",children:"Deleted segments may be referenced in strategies if the feature flag is archived. Removing the segment will also remove the segments from strategies of archived flags."}),i.jsxs("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",i.jsx("strong",{children:e==null?void 0:e.name})]}),i.jsx("form",{id:u,children:i.jsx(Zht,{autoFocus:!0,onChange:l,value:s,label:"Segment name","data-testid":Rje})})]})},egt=v("ul")({marginBottom:0}),Fz=v(ft)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),tgt=(e,t)=>`/projects/${e}/change-requests/${t}`,ngt=({segment:e,open:t,onClose:n,strategies:r,changeRequestStrategies:o})=>{const s=toe(r??[],o??[]);return i.jsxs(Mn,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[i.jsxs("p",{children:["The following feature flags are using the"," ",i.jsx("strong",{children:e.name})," segment for their strategies:"]}),i.jsx(egt,{children:s.map((a,l)=>rgt(a,l))})]})},Bz=e=>e.strategyName?`(${Xl(e.strategyName)})`:"",rgt=(e,t)=>{if((r=>"changeRequest"in r)(e)){const{id:r,title:o}=e.changeRequest,s=o?`#${r} (${o})`:`#${r}`;return i.jsx("li",{children:i.jsxs("p",{children:[e.featureName," ",`${Bz(e)} — in change request `,i.jsx(Fz,{to:tgt(e.projectId,r),target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:s})]})},`#${e.changeRequest.id}@${t}`)}else return i.jsx("li",{children:i.jsxs(Fz,{to:X7(e.projectId,e.featureName,e.environment,e.id),target:"_blank",rel:"noopener noreferrer",children:[e.featureName," ",Bz(e)]})},e.id)},ogt=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const{strategies:s,changeRequestStrategies:a,loading:l}=eoe(e.id),c=(s==null?void 0:s.length)===0&&(a==null?void 0:a.length)===0;return l?null:i.jsx(te,{condition:c,show:i.jsx(Qht,{segment:e,open:t,onClose:n,onRemove:r,title:o}),elseShow:i.jsx(ngt,{segment:e,open:t,onClose:n,strategies:s,changeRequestStrategies:a})})},sgt=({segment:e})=>{const t=wo("projectId"),{refetchSegments:n}=od(),{deleteSegment:r}=I_(),{setToastData:o,setToastApiError:s}=_t(),[a,l]=g.useState(!1),u=soe(e==null?void 0:e.project)(),{addChange:d}=ia(),p=async()=>{try{u&&e.project?await d(e.project,u,{action:"deleteSegment",feature:null,payload:{id:e.id}}):await r(e.id),await n(),o({text:`Segment ${u?"change added to draft":"deleted"}`,type:"success"})}catch(f){s(pt(f))}finally{l(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Co,{onClick:()=>l(!0),permission:[mOe,Sp],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${Tje}_${e.name}`,children:i.jsx(So,{"data-loading":!0})}),i.jsx(te,{condition:a,show:()=>i.jsx(ogt,{segment:e,open:a,onClose:()=>l(!1),onRemove:p,title:u?"Add to draft":"Save"})})]})},igt=({segment:e})=>{const t=wo("projectId"),n=$t();return i.jsx(Co,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[nA,Sp],projectId:t,tooltipProps:{title:"Edit segment"},children:i.jsx(oi,{"data-loading":!0})})},agt=({segment:e})=>i.jsxs(Ku,{children:[i.jsx(igt,{segment:e}),i.jsx(sgt,{segment:e})]}),Bf=(e,t,n)=>{g.useEffect(()=>{const r=e.filter(({condition:s})=>s).flatMap(({columns:s})=>s),o=e.flatMap(({columns:s})=>s).filter(s=>!r.includes(s));t(s=>[...new Set([...s,...r].filter(a=>!o.includes(a)))])},[...e.map(({condition:r})=>r),t,n])},lgt=()=>{const e=wo("projectId"),{segments:t,loading:n}=od(),r=Nn(br.breakpoints.down("md")),[o]=g.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),s=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(()=>cgt(e),[e]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:f},setGlobalFilter:h,setHiddenColumns:m}=on.useTable({initialState:o,columns:a,data:s,sortTypes:Ds,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:wi},getRowId:y=>y.id},on.useGlobalFilter,on.useSortBy);return Bf([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],m,a),i.jsx(ir,{header:i.jsx($n,{title:`Segments (${d.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:f,onChange:h}),i.jsx($n.Divider,{}),i.jsx(Hht,{})]})}),isLoading:n,children:i.jsx(te,{condition:!n&&s.length===0,show:i.jsx(Gr,{children:i.jsx(qht,{})}),elseShow:()=>i.jsxs(i.Fragment,{children:[i.jsx(Ai,{value:f,children:i.jsxs(ja,{...l(),rowHeight:"standard",children:[i.jsx(Sa,{headerGroups:u}),i.jsx(Ji,{...c(),children:d.map(y=>{p(y);const{key:b,...x}=y.getRowProps();return i.jsx(ti,{hover:!0,...x,children:y.cells.map(C=>{const{key:w,...j}=C.getCellProps();return i.jsx(Ci,{...j,children:C.render("Cell")},w)})},b)})})]})}),i.jsx(te,{condition:d.length===0&&(f==null?void 0:f.length)>0,show:i.jsxs(Gr,{children:["No segments found matching “",f,"”"]})})]})})})},cgt=e=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>i.jsx(J7,{icon:i.jsx(doe,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:t,description:n,id:r}}})=>i.jsx(Yl,{title:t,to:e?`/projects/${e}/settings/segments/edit/${r}`:`/segments/edit/${r}`,subtitle:n})},{Header:"Used in",width:"60%",Cell:({row:{original:t}})=>i.jsx(Dre,{original:t})},{Header:"Project",accessor:"project",Cell:({value:t})=>i.jsx(te,{condition:!!t,show:i.jsx(Yl,{title:t,to:`/projects/${t}`}),elseShow:i.jsx(vn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Cp,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:t}})=>i.jsx(agt,{segment:t})},{accessor:"description"}],ugt=v("div")(({theme:e})=>({padding:e.spacing(1.5),display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),dgt=({value:e,getValue:t})=>{var l;const n=e||(t==null?void 0:t())||void 0,{featureTypes:r}=t0(),o=v7(n),a=`This is a "${((l=r.find(c=>c.id===n))==null?void 0:l.name)||n}" toggle`;return i.jsx(ugt,{children:i.jsx(Rt,{arrow:!0,title:a,describeChild:!0,children:i.jsx(o,{"data-loading":!0})})})},pgt=({onRevive:e,onDelete:t,project:n})=>i.jsxs(Ku,{children:[i.jsx(Co,{onClick:e,projectId:n,permission:Qg,tooltipProps:{title:"Revive feature flag"},"data-testid":"revive-feature-flag-button",children:i.jsx(FP,{})}),i.jsx(Co,{permission:cQ,projectId:n,tooltipProps:{title:"Delete feature flag"},onClick:t,children:i.jsx(So,{})})]}),fgt=({value:e})=>{const{locationSettings:t}=$r(),n=Bt();return e?i.jsx(vn,{children:i.jsx(Rt,{title:`Archived on: ${Zc(e,t.locale)}`,arrow:!0,children:i.jsx(J,{noWrap:!0,variant:"body2","data-loading":!0,children:i.jsx(Kl,{date:new Date(e),refresh:!1})})})}):i.jsx(vn,{children:i.jsx(J,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},zz=v("p")(({theme:e})=>({marginTop:e.spacing(3)})),hgt=v(Yr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),ggt="I want to delete",mgt=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[s,a]=g.useState(""),{setToastData:l,setToastApiError:c}=_t(),{deleteFeatures:u}=u0(),d=e.length>1?"flags":"flag",p=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",text:`Feature ${d} deleted`})}catch(m){c(pt(m))}finally{f()}},f=()=>{r(!1),a("")},h="delete-feature-toggle-confirmation-form";return i.jsxs(Mn,{title:`Delete feature ${d}?`,open:n,primaryButtonText:`Delete feature ${d}`,secondaryButtonText:"Cancel",onClick:p,onClose:f,disabledPrimaryButton:ggt!==s,formId:h,children:[i.jsxs(Dt,{severity:"warning",children:[i.jsx("b",{children:"Warning!"})," Before you delete a feature flag, make sure all in-code references to that feature flag have been removed. Otherwise, a new feature flag with the same name could activate the old code paths."]}),i.jsxs(zz,{children:["You are about to delete the following feature"," ",d,":"," ",i.jsx("strong",{children:e.join(", ")}),"."]}),i.jsxs(zz,{sx:m=>({marginTop:m.spacing(2)}),children:["In order to delete the feature ",d,", please enter the following confirmation text in the text field below:"," ",i.jsx("strong",{children:"I want to delete"})]}),i.jsx("form",{id:h,children:i.jsx(hgt,{autoFocus:!0,onChange:m=>{a(m.currentTarget.value)},value:s,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},Hz=v("p")(({theme:e})=>({marginTop:e.spacing(2)})),ygt=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:s,setToastApiError:a}=_t(),{reviveFeatures:l}=u0(),{project:c,loading:u}=e0(t),d=async()=>{try{if(e.length===0)return;await l(t,e),await o(),s({type:"success",text:"Feature flags revived"})}catch(m){a(pt(m))}finally{p()}},p=()=>{r(!1)},f=`Revive feature flag${e.length>1?"s":""}?`,h=`Revive feature flag${e.length>1?"s":""}`;return i.jsxs(Mn,{title:f,open:n,primaryButtonText:h,secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:u||!!c.archivedAt,children:[i.jsx(te,{condition:!!c.archivedAt,show:i.jsxs(Dt,{severity:"warning",children:["Cannot revive feature flag in archived project (Project ID: ",t,")"]}),elseShow:i.jsx(Dt,{severity:"info",children:"Revived feature flags will be automatically disabled in all environments"})}),i.jsx(te,{condition:e.length>1,show:i.jsxs(i.Fragment,{children:[i.jsx(Hz,{children:"You are about to revive feature flags:"}),i.jsx("ul",{children:e.map(m=>i.jsx("li",{children:m},`revive-${m}`))})]}),elseShow:i.jsxs(Hz,{children:["You are about to revive feature flag:"," ",e[0]]})})]})},xgt=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:s})=>{const a=Nn(br.breakpoints.down("md")),l=Nn(br.breakpoints.down("lg")),[c,u]=g.useState(!1),[d,p]=g.useState(),[f,h]=g.useState(!1),[m,y]=g.useState(),[b,x]=Mp(),[C,w]=g.useState(b.get("search")||""),j=g.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({row:{original:L}})=>i.jsx(AQ,{feature:L}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:dgt,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:L,row:{original:B}})=>i.jsx(wi,{value:L,subtitle:B.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Cp},{Header:"Archived",accessor:"archivedAt",width:150,Cell:fgt},{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:L})=>i.jsx(Yl,{title:L,to:`/projects/${L}`})},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:L}})=>i.jsx(pgt,{project:L.project,onRevive:()=>{y(L),h(!0)},onDelete:()=>{p(L),u(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[]),{data:k,getSearchText:S,getSearchContext:E}=Af(j,C,e),T=g.useMemo(()=>t?oee:k,[k,t]),[R]=g.useState(()=>({sortBy:[{id:b.get("sort")||r.id,desc:b.has("order")?b.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),_=g.useCallback(L=>L.name,[]),{headerGroups:M,rows:$,state:{sortBy:z},prepareRow:A,setHiddenColumns:O}=on.useTable({columns:j,data:T,initialState:R,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:_},on.useFlexLayout,on.useSortBy,on.useRowSelect);return Bf([{condition:a,columns:["type","createdAt"]},{condition:l,columns:["lastSeenAt","stale"]}],O,j),g.useEffect(()=>{if(t)return;const L={};L.sort=z[0].id,z[0].desc&&(L.order="desc"),C&&(L.search=C),x(L,{replace:!0}),o({id:z[0].id,desc:z[0].desc||!1})},[t,z,C]),i.jsx(i.Fragment,{children:i.jsxs(ir,{isLoading:t,header:i.jsx($n,{titleElement:`${s} (${$.length})`,actions:i.jsx(No,{initialValue:C,onChange:w,hasFilters:!0,getSearchContext:E})}),children:[$.length>=50&&i.jsx(Dt,{color:"info",sx:{mb:2},children:"A maximum of 50 archived flags are displayed. If you don't see the one you're looking for, try using search."}),i.jsx(Ai,{value:S(C),children:i.jsx(Wp,{rows:$,headerGroups:M,prepareRow:A})}),i.jsx(te,{condition:$.length===0,show:()=>i.jsx(te,{condition:(C==null?void 0:C.length)>0,show:i.jsxs(Gr,{children:["No feature flags found matching “",C,"”"]}),elseShow:i.jsx(Gr,{children:"None of the feature flags were archived yet."})})}),i.jsx(mgt,{deletedFeatures:[d==null?void 0:d.name],projectId:d==null?void 0:d.project,open:c,setOpen:u,refetch:n}),i.jsx(ygt,{revivedFeatures:[m==null?void 0:m.name],projectId:m==null?void 0:m.project,open:f,setOpen:h,refetch:n})]})})},vgt={id:"createdAt"},{value:bgt,setValue:Cgt}=td("FeaturesArchiveTable:v1",vgt),wgt=()=>{nd("Archive");const[e]=Mp(),{features:t,loading:n,refetch:r}=y7({query:e.get("search")||void 0,archived:"IS:true"});return i.jsx(xgt,{title:"Archive",archivedFeatures:t,loading:n,storedParams:bgt,setStoredParams:Cgt,refetch:r})},Sgt=g.lazy(()=>La(()=>import("./AdvancedPlayground-D7wyJyhf.js"),[])),jgt=v($e)(({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(0,2),gap:e.spacing(1),fontSize:e.typography.body2.fontSize,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}})),Egt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),kgt=v("div")(({theme:e})=>({fontWeight:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),Tgt=({label:e,description:t,selected:n,onClick:r,startIcon:o,endIcon:s})=>i.jsxs(jgt,{selected:!!n,className:n?"selected":"",onClick:r,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[o,i.jsxs(Egt,{children:[e,i.jsx(te,{condition:!!t,show:i.jsx(kgt,{children:t})})]}),s]}),Rgt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("xl")]:{flexDirection:"column"}})),Agt=v("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),Wz=v("div",{shouldForwardProp:e=>e!=="fullWidth"})(({theme:e,fullWidth:t})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:t?"100%":e.spacing(30),flexShrink:0,[e.breakpoints.down("xl")]:{width:"100%"}})),Pgt=({tabs:e,value:t,onChange:n,children:r,...o})=>{const s=e.filter(a=>!a.hidden).map(a=>i.jsx(Tgt,{label:a.label,description:a.description,selected:a.id===t,onClick:()=>n(a),startIcon:a.startIcon,endIcon:a.endIcon},a.id));return r?i.jsxs(Rgt,{children:[i.jsx(Wz,{...o,children:s}),i.jsx(Agt,{children:r})]}):i.jsx(Wz,{fullWidth:!0,...o,children:s})},poe=(e,t={})=>{const n=async()=>{const u=yt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(en("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:s}=f0({},r,n,t),[a,l]=g.useState(!s&&!o),c=()=>{Fo(r)};return g.useEffect(()=>{l(!s&&!o)},[o,s]),{config:o||{},error:s,loading:a,refetch:c}},_gt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{changePassword:async s=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(s)});await e(a.caller,a.id)},errors:n,loading:r}},Igt=v("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),Ogt=()=>{const{config:e,loading:t}=poe("simple"),[n,r]=g.useState(!1),{setToastData:o,setToastApiError:s}=_t(),[a,l]=g.useState(!1),[c,u]=g.useState(),[d,p]=g.useState(),[f,h]=g.useState(""),[m,y]=g.useState(""),[b,x]=g.useState(""),{changePassword:C}=_gt(),w=f!==m,j=b===m,k=f.length>0&&m.length>0&&b.length>0,S=!k||w||j,E=async T=>{if(T.preventDefault(),!S){if(!a)u(Tte);else{r(!0),u(void 0),p(void 0);try{await C({password:f,confirmPassword:m,oldPassword:b}),o({text:"Password changed",type:"success"})}catch(R){const _=pt(R);R instanceof uR?p(_):u(_),s(_)}}r(!1)}};return t?null:i.jsx(ir,{isLoading:n,header:"Change password",children:i.jsx(te,{condition:e.disabled,show:i.jsx(Dt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:i.jsxs(Igt,{children:[i.jsx(Rte,{password:f,callback:l,"data-loading":!0}),i.jsx(Nu,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:T=>x(T.target.value)}),i.jsx(Nu,{"data-loading":!0,label:"Password",name:"password",value:f,error:!!c,helperText:c,autoComplete:"new-password",onChange:T=>h(T.target.value)}),i.jsx(Nu,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:m,autoComplete:"new-password",onChange:T=>y(T.target.value)}),i.jsx(Ate,{"data-loading":!0,started:k,passwordsDoNotMatch:w,sameAsOldPassword:j}),i.jsx($e,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:E,disabled:S,children:"Save"})]})})})},Mgt=/^[a-z0-9\-_]*$/,$gt="environment",Dgt="project",foe="root",hoe="project",Lgt="root-custom",Ngt="custom",Fgt=[foe,hoe],Jqt=[foe,Lgt],Bgt=[hoe,Ngt],goe=10,V_=()=>{const{data:e,error:t,mutate:n}=On(yt("api/admin/user/tokens"),zgt);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},zgt=e=>fetch(e).then(en("Personal API Tokens")).then(t=>t.json()),moe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({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}},Hgt=e=>{const t=new Date(e);return Jo(t,"yyyy-MM-dd")},Wgt=e=>{const t=new Date(e);return`${Jo(t,"yyyy-MM-dd")}T${Jo(t,"HH:mm")}`},Vgt=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:s,value:a,onChange:l,...c})=>{const u=t==="datetime"?Wgt:Hgt,d=t==="datetime"?"datetime-local":"date";return i.jsx(xn,{type:d,size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=AR(p.target.value);l(f??a)},FormHelperTextProps:{"data-testid":$J},inputProps:{min:o&&u(o.toISOString()),max:s&&u(s.toISOString())},...c})},Vz=v("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Ugt=v(Yr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),Ggt=v("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"}})),qgt=v(x_)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Ygt=v(Vgt)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Kgt=v(Dt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var yoe=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(yoe||{});const xoe=[{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"}],fj=e=>{const t=new Date,n=xoe.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},Xgt=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:s,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=$r(),d=y=>{c(b=>({...b,[y]:void 0}))},p=(y,b)=>{c(x=>({...x,[y]:b}))};g.useEffect(()=>{d("expiresAt"),a(fj(r))},[r]);const f=y=>{d("description"),n&&!n(y)&&p("description","A token with that description already exists."),t(y)},h=r==="custom",m=s.getFullYear()>new Date().getFullYear()+100;return i.jsxs(i.Fragment,{children:[i.jsx(Vz,{children:"Describe what this token will be used for"}),i.jsx(Ugt,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:y=>f(y.target.value),required:!0}),i.jsx(Vz,{children:"Token expiration date"}),i.jsxs(Ggt,{custom:h,children:[i.jsx(qgt,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:y=>o(y.target.value),options:xoe}),i.jsx(te,{condition:h,show:()=>i.jsx(Ygt,{label:"Date",value:s,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:i.jsx(te,{condition:m,show:i.jsxs(J,{variant:"body2",children:["The token will ",i.jsx("strong",{children:"never"})," ","expire!"]}),elseShow:()=>i.jsxs(J,{variant:"body2",children:["Token will expire on"," ",i.jsx("strong",{children:Zc(s,u.locale)})]})})})]}),i.jsx(te,{condition:m,show:i.jsx(Kgt,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},Jgt=v("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Zgt=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Qgt=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),Jx=yoe["30DAYS"],e0t=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=V_(),{createPersonalAPIToken:s,loading:a}=moe(),{setToastApiError:l}=_t(),{uiConfig:c}=ut(),[u,d]=g.useState(""),[p,f]=g.useState(Jx),[h,m]=g.useState(fj(Jx)),[y,b]=g.useState({});g.useEffect(()=>{d(""),f(Jx),m(fj(Jx)),b({})},[e]);const x=()=>({description:u,expiresAt:h}),C=async E=>{E.preventDefault();try{const T=await s(x());n(T),o(),t(!1)}catch(T){l(pt(T))}},w=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
443
443
  --header 'Authorization: INSERT_API_KEY' \\
444
444
  --header 'Content-Type: application/json' \\
445
445
  --data-raw '${JSON.stringify(x(),void 0,2)}'`,j=E=>E.length,k=E=>!(r!=null&&r.some(T=>T.description===E)),S=j(u)&&k(u)&&h>new Date;return i.jsx(hl,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:i.jsx(eo,{loading:a,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
446
446
  yourself. A personal API token has the same access privileges as
447
- your user.`,documentationLink:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys#personal-access-tokens",documentationLinkLabel:"Personal access tokens documentation",formatApiCode:w,children:i.jsxs(Jgt,{onSubmit:C,children:[i.jsx("div",{children:i.jsx(Xgt,{description:u,setDescription:d,isDescriptionUnique:k,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:m,errors:y,setErrors:b})}),i.jsxs(Zgt,{children:[i.jsx($e,{type:"submit",variant:"contained",color:"primary",disabled:!S,children:"Create token"}),i.jsx(Qgt,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},t0t=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=V_(),{deletePersonalAPIToken:o}=moe(),{setToastData:s,setToastApiError:a}=_t(),l=async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),s({text:"Token deleted",type:"success"})}catch(c){a(pt(c))}};return i.jsx(Mn,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:l,onClose:()=>{t(!1)},title:"Delete token?",children:i.jsxs(J,{children:['Any applications or scripts using this token "',i.jsx("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},n0t=v(Dt)(({theme:e})=>({marginBottom:e.spacing(3)})),r0t=({open:e,setOpen:t,token:n})=>i.jsxs(Mn,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[i.jsx(n0t,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),i.jsx(J,{variant:"body1",children:"Your token:"}),i.jsx(z_,{token:(n==null?void 0:n.secret)||""})]}),o0t=v(Dt)(({theme:e})=>({marginBottom:e.spacing(3)})),s0t=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),i0t=v(J)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),a0t=v(J)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),l0t=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),c0t={id:"createdAt",desc:!0},{value:Uz,setValue:u0t}=td("PersonalAPITokensTable:v1",c0t),d0t=()=>{const e=Bt(),t=Nn(e.breakpoints.down("md")),n=Nn(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=V_(),[s,a]=Mp(),[l]=g.useState(()=>({sortBy:[{id:s.get("sort")||Uz.id,desc:s.has("order")?s.get("order")==="desc":Uz.desc}],globalFilter:s.get("search")||""})),[c,u]=g.useState(l.globalFilter),[d,p]=g.useState(!1),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,x]=g.useState(),[C,w]=g.useState(),j=g.useMemo(()=>[{Header:"Description",accessor:"description",Cell:wi,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:A})=>new Date(A).getFullYear()>new Date().getFullYear()+100?i.jsx(vn,{children:"Never"}):i.jsx(Cp,{value:A}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Cp,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:l0,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:A}})=>i.jsx(Ku,{children:i.jsx(Rt,{title:"Delete token",arrow:!0,describeChild:!0,children:i.jsx("span",{children:i.jsx(Mt,{onClick:()=>{w(A),y(!0)},children:i.jsx(So,{})})})})}),maxWidth:100,disableSortBy:!0}],[w,y]),{data:k,getSearchText:S,getSearchContext:E}=Af(j,c,r),T=g.useMemo(()=>(k==null?void 0:k.length)===0&&o?l0t:k,[k,o]),{headerGroups:R,rows:_,prepareRow:M,state:{sortBy:$},setHiddenColumns:z}=on.useTable({columns:j,data:T,initialState:l,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},on.useSortBy,on.useFlexLayout);return Bf([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],z,j),g.useEffect(()=>{const A={};A.sort=$[0].id,$[0].desc&&(A.order="desc"),c&&(A.search=c),a(A,{replace:!0}),u0t({id:$[0].id,desc:$[0].desc||!1})},[$,c,a]),i.jsxs(ir,{isLoading:o,header:i.jsx($n,{title:`Personal API tokens (${_.length<T.length?`${_.length} of ${T.length}`:T.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!t,show:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:c,onChange:u,getSearchContext:E}),i.jsx($n.Divider,{})]})}),i.jsx($e,{variant:"contained",color:"primary",disabled:r.length>=goe,onClick:()=>p(!0),children:"New token"})]}),children:i.jsx(te,{condition:t,show:i.jsx(No,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:E})})}),children:[i.jsx(o0t,{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."}),i.jsx(Ai,{value:S(c),children:i.jsx(Wp,{rows:_,headerGroups:R,prepareRow:M})}),i.jsx(te,{condition:_.length===0,show:i.jsx(te,{condition:(c==null?void 0:c.length)>0,show:i.jsxs(Gr,{children:["No tokens found matching “",c,"”"]}),elseShow:i.jsxs(s0t,{children:[i.jsx(i0t,{children:"You have no personal API tokens yet."}),i.jsx(a0t,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),i.jsx($e,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),i.jsx(e0t,{open:d,setOpen:p,newToken:A=>{x(A),h(!0)}}),i.jsx(r0t,{open:f,setOpen:h,token:b}),i.jsx(t0t,{open:m,setOpen:y,token:C})]})};var U_={},p0t=je;Object.defineProperty(U_,"__esModule",{value:!0});var G_=U_.default=void 0,f0t=p0t(Ee()),h0t=i,g0t=(0,f0t.default)((0,h0t.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");G_=U_.default=g0t;const voe=(e,t={})=>{const{isEnterprise:n}=ut(),{data:r,error:o,mutate:s}=Ts(!!e&&n(),void 0,yt(`api/admin/roles/${e}`),m0t,t);return g.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>s(),error:o}),[r,o,s])},m0t=e=>fetch(e).then(en("Role")).then(t=>t.json());var q_={},y0t=je;Object.defineProperty(q_,"__esModule",{value:!0});var boe=q_.default=void 0,x0t=y0t(Ee()),v0t=i,b0t=(0,x0t.default)((0,v0t.jsx)("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person");boe=q_.default=b0t;var Y_={},C0t=je;Object.defineProperty(Y_,"__esModule",{value:!0});var Coe=Y_.default=void 0,w0t=C0t(Ee()),S0t=i,j0t=(0,w0t.default)((0,S0t.jsx)("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm3.61 6.34c1.07 0 1.93.86 1.93 1.93 0 1.07-.86 1.93-1.93 1.93-1.07 0-1.93-.86-1.93-1.93-.01-1.07.86-1.93 1.93-1.93zm-6-1.58c1.3 0 2.36 1.06 2.36 2.36 0 1.3-1.06 2.36-2.36 2.36s-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36zm0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68zM11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09z"}),"SupervisedUserCircle");Coe=Y_.default=j0t;const G1=e=>e.environment?`${e.name}-${e.environment}`:`${e.name}`,Zqt=e=>e.reduce((t,n)=>(t[G1(n)]=n,t),{}),Qqt=(e,t)=>{const n=by(e);return n[G1(t)]?delete n[G1(t)]:n[G1(t)]={...t},n},eYt=(e,t)=>{const n=by(e);return t.every(o=>n[G1(o)])?t.forEach(o=>{delete n[G1(o)]}):t.forEach(o=>{n[G1(o)]={...o}}),n},E0t=e=>e.filter(({name:r})=>r!=="ADMIN").reduce((r,o)=>{var l;const s=((l=cMe.find(c=>c.permissions.includes(o.name)))==null?void 0:l.label)||"Other",a=r.find(({label:c})=>c===s);return a?a.permissions.push(o):r.push({label:s,type:"root",permissions:[o]}),r},[]).map(r=>({...r,permissions:[...new Set(r.permissions.sort((o,s)=>o.displayName.localeCompare(s.displayName)))]})).sort(T0t),k0t=e=>{const t=e.filter(({type:o})=>o===Dgt),n=e.filter(({type:o})=>o===$gt),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,s)=>{const a=s.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(s):o.push({label:a,type:"environment",permissions:[s]}),o},[])),r.map(o=>({...o,permissions:[...new Set(o.permissions.sort((s,a)=>s.displayName.localeCompare(a.displayName)))]}))},tYt=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],T0t=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),R0t=v("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})),A0t=v("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),P0t=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),_0t=v("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),I0t=v(Coe)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),O0t=v("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),M0t=v("p")(({theme:e})=>({marginTop:e.spacing(.5)})),$0t=v("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),D0t=({roleId:e,tooltip:t,...n})=>{const{role:r}=voe(e.toString());if(!r)return null;const{name:o,description:s,permissions:a,type:l}=r,u=Bgt.includes(l)?k0t(a):E0t(a);return i.jsxs(R0t,{tooltip:t,...n,children:[i.jsxs(_0t,{children:[i.jsx(I0t,{color:"disabled"}),o]}),i.jsx(M0t,{children:s}),i.jsx(te,{condition:!Fgt.includes(r.type),show:()=>i.jsxs(i.Fragment,{children:[i.jsx(A0t,{children:"Role permissions:"}),i.jsx(P0t,{children:u.map(({label:d,permissions:p})=>i.jsxs("div",{children:[i.jsx(O0t,{children:d}),i.jsx($0t,{children:p.map(f=>i.jsx("li",{children:f.displayName},f.name))})]},d))})]})})]})},L0t=({roleId:e,hideIcon:t,children:n})=>{const{role:r}=voe(e.toString()),o=t?void 0:i.jsx(boe,{});return r?i.jsx(wr,{title:i.jsx(D0t,{roleId:e,tooltip:!0}),arrow:!0,children:i.jsx(an,{tabIndex:0,color:"success",icon:o,sx:{cursor:"pointer"},children:r.name})}):n?i.jsx(an,{color:"success",icon:o,children:n}):null},N0t=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{subscribe:async a=>{const l=`api/admin/email-subscription/${a}`,c=t(l,{method:"PUT"});await e(c.caller,c.id)},unsubscribe:async a=>{const l=`api/admin/email-subscription/${a}`,c=t(l,{method:"DELETE"});await e(c.caller,c.id)},errors:n,loading:r}},F0t=({status:e,onChange:t})=>{const{subscribe:n,unsubscribe:r,loading:o}=N0t(),{setToastData:s,setToastApiError:a}=_t(),{trackEvent:l}=zt();return i.jsx(K,{children:i.jsx(Ur,{label:"Productivity Email Subscription",control:i.jsx(oa,{onChange:async()=>{try{e==="subscribed"?(await r("productivity-report"),s({text:"Unsubscribed from productivity report",type:"success"}),l("productivity-report",{props:{eventType:"unsubscribe"}})):(await n("productivity-report"),s({text:"Subscribed to productivity report",type:"success"}),l("productivity-report",{props:{eventType:"subscribe"}}))}catch(c){a(pt(c))}t()},name:"productivity-email",checked:e==="subscribed",disabled:o})})})},B0t=["cs","da-DK","de","en-GB","en-IN","en-US","fr-FR","ja","nb-NO","pt-BR","sv-SE"],z0t=v("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})),H0t=v("div")(()=>({flexGrow:1})),W0t=v(J)(({theme:e})=>({fontSize:e.spacing(3.75)})),V0t=v(ed)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),$b=v(J)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),U0t=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),"& > div > p":{marginBottom:e.spacing(1.5)}})),G0t=v(ft)(({theme:e})=>({":hover,:focus-visible":{outline:"none","> *":{outline:`2px solid ${e.palette.primary.main}`}}})),Gz=v("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),q0t=v(Ko)(({theme:e})=>({width:e.spacing(30)})),Y0t=v(Gl)(({theme:e})=>({backgroundColor:e.palette.background.paper})),K0t=v("ul")(({theme:e})=>({listStyle:"none",padding:0,display:"flex",flexFlow:"row wrap",gap:e.spacing(1)})),woe="2014-09-29T14:50:46",X0t=new Date(woe),J0t=v("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",flexFlow:"row wrap",gap:e.spacing(1),alignItems:"center"})),Z0t=({user:e})=>{const{profile:t,refetchProfile:n}=Nte(),{locationSettings:r,setLocationSettings:o}=$r(),[s,a]=g.useState(),l=g.useId(),[c,u]=g.useState([...B0t]);g.useEffect(()=>{const f=c.find(h=>h.toLowerCase().includes(r.locale.toLowerCase()));a(f),f||u(h=>[...h,r.locale])},[r]);const d=f=>{const h=f.target.value;a(h),o({locale:h})},p=Er("productivityReportEmail");return i.jsxs(i.Fragment,{children:[i.jsxs(z0t,{children:[i.jsx(V0t,{user:e}),i.jsxs(H0t,{children:[i.jsx(W0t,{children:e.name||e.email||e.username}),i.jsx(J,{variant:"body1",children:e.email})]})]}),i.jsxs(ir,{children:[i.jsx($b,{children:"Access"}),i.jsxs(U0t,{children:[i.jsx(K,{sx:{width:"50%"},children:(t==null?void 0:t.rootRole)&&i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body2",children:"Your root role"}),i.jsx(L0t,{roleId:t.rootRole.id,children:t.rootRole.name})]})}),i.jsxs(K,{children:[i.jsx(J,{variant:"body2",children:"Projects"}),i.jsx(te,{condition:!!(t!=null&&t.projects.length),show:i.jsx(K0t,{children:t==null?void 0:t.projects.map(f=>i.jsx("li",{children:i.jsx(Rt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:i.jsx(G0t,{to:`/projects/${f}`,children:i.jsx(an,{color:"secondary",icon:i.jsx(G_,{}),children:f})})})},f))}),elseShow:i.jsx(Rt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:i.jsx(an,{tabIndex:0,children:"No projects"})})})]})]}),i.jsx(Gz,{}),i.jsx($b,{children:"Date/Time Settings"}),i.jsx(J,{variant:"body2",children:"This is the format used across the system for time and date"}),i.jsxs(J0t,{children:[i.jsxs(q0t,{variant:"outlined",size:"small",children:[i.jsx(Y0t,{htmlFor:"locale-select",children:"Date/Time formatting"}),i.jsx(na,{"aria-details":l,id:"locale-select",value:s||"",native:!0,onChange:d,MenuProps:{style:{zIndex:9999}},children:c.map(f=>i.jsx("option",{value:f,children:f},f))})]}),i.jsxs(J,{id:l,children:["Example:"," ",i.jsx("time",{dateTime:woe,children:ry(X0t,s)})]})]}),p?i.jsxs(i.Fragment,{children:[i.jsx(Gz,{}),i.jsx($b,{children:"Email Settings"}),(t==null?void 0:t.subscriptions)&&i.jsx(F0t,{status:t.subscriptions.includes("productivity-report")?"subscribed":"unsubscribed",onChange:n})]}):null]})]})},Q0t=()=>{const{user:e}=gs(),t=jo(),n=$t(),{config:r,loading:o}=poe("simple"),{uiConfig:s}=ut(),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:s.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:h})=>h&&p.includes(h))||a[0]).id},[u,d]=g.useState(c());return g.useEffect(()=>{d(c())},[t]),o?null:i.jsxs(Pgt,{tabs:a,value:u,onChange:l,children:[i.jsx(te,{condition:u==="profile",show:i.jsx(Z0t,{user:e})}),i.jsx(te,{condition:u==="password",show:i.jsx(Ogt,{})}),i.jsx(te,{condition:u==="pat",show:i.jsx(d0t,{})})]})},emt=g.lazy(()=>La(()=>import("./FeatureViewLazyExport-BkNTNFqK.js").then(e=>e.F),[])),tmt=g.lazy(()=>La(()=>import("./LazyAdminExport-ByTh4iFa.js").then(e=>e.L),[])),nmt=g.lazy(()=>La(()=>import("./LazyProjectExport-K12Xy3w9.js"),[])),rmt=()=>{const{isEnterprise:e}=ut(),{data:t,error:n,mutate:r}=Ts(e(),{events:[]},yt("api/admin/logins"),omt);return g.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},omt=e=>fetch(e).then(en("Login History")).then(t=>t.json()),qz=v(K)(()=>({display:"flex",justifyContent:"center"})),smt=({row:e,value:t})=>{const{searchQuery:n}=Pi();return t?i.jsx(qz,{children:i.jsx(an,{color:"success",children:"True"})}):i.jsx(qz,{children:i.jsx(wr,{arrow:!0,title:i.jsx(Pr,{search:n,children:e.original.failure_reason}),children:i.jsx(an,{color:"error",children:"False"})})})},imt=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=er({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}};var K_={},amt=je;Object.defineProperty(K_,"__esModule",{value:!0});var Soe=K_.default=void 0,lmt=amt(Ee()),cmt=i,umt=(0,lmt.default)((0,cmt.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");Soe=K_.default=umt;const dmt={id:"created_at",desc:!0},{value:Yz,setValue:pmt}=td("LoginHistoryTable:v1",dmt),fmt={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google",github:"GitHub"},hmt=()=>{const{events:e,loading:t}=rmt(),{downloadCSV:n}=imt(),[r,o]=Mp(),[s]=g.useState(()=>({sortBy:[{id:r.get("sort")||Yz.id,desc:r.has("order")?r.get("order")==="desc":Yz.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=g.useState(s.globalFilter),c=Nn(br.breakpoints.down("sm")),u=Nn(br.breakpoints.down("md")),d=g.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:w,column:j})=>i.jsx(l0,{value:w,column:j,dateFormat:ji}),maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:wi,searchable:!0},{Header:"Authentication",accessor:w=>fmt[w.auth_type]||w.auth_type,width:150,maxWidth:150,Cell:wi,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:wi,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:smt,filterName:"success",filterParsing:w=>w.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:f,getSearchContext:h}=Af(d,a,e),{headerGroups:m,rows:y,prepareRow:b,state:{sortBy:x},setHiddenColumns:C}=on.useTable({columns:d,data:p,initialState:s,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:vn}},on.useSortBy,on.useFlexLayout);return Bf([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],C,d),g.useEffect(()=>{const w={};w.sort=x[0].id,x[0].desc&&(w.order="desc"),a&&(w.search=a),o(w,{replace:!0}),pmt({id:x[0].id,desc:x[0].desc||!1})},[x,a,o]),i.jsxs(ir,{isLoading:t,header:i.jsx($n,{title:`Login history (${y.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!u,show:i.jsx(No,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})}),i.jsx(te,{condition:y.length>0,show:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!u,show:i.jsx($n.Divider,{})}),i.jsx(Rt,{title:"Download login history",arrow:!0,children:i.jsx(Mt,{onClick:n,children:i.jsx(Soe,{})})})]})})]}),children:i.jsx(te,{condition:u,show:i.jsx(No,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[i.jsx(Ai,{value:f(a),children:i.jsx(Wp,{rows:y,headerGroups:m,prepareRow:b})}),i.jsx(te,{condition:y.length===0,show:i.jsx(te,{condition:(a==null?void 0:a.length)>0,show:i.jsxs(Gr,{children:["No login events found matching “",a,"”"]}),elseShow:i.jsx(Gr,{children:"No login events available."})})})]})},gmt=()=>{const{isEnterprise:e}=ut();return e()?i.jsx("div",{children:i.jsx(E_,{permissions:[ni,c7],children:i.jsx(hmt,{})})}):i.jsx(c0,{feature:"login-history",page:!0})},mmt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{updateFeatureTypeLifetime:async(s,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${s}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},joe=(e,t)=>{const n=g.useCallback(()=>{const r=new CustomEvent(e);document.dispatchEvent(r)},[e]);return g.useEffect(()=>{const r=o=>t(o);return document.addEventListener(e,r),()=>{document.removeEventListener(e,r)}},[e,t]),{emitEvent:n}},ymt=()=>{const e=`${Js}:unleash-lastViewedProject`,[t,n]=g.useState(()=>sf(e)),{emitEvent:r}=joe("lastViewedProjectUpdated",()=>{n(sf(e))});return g.useEffect(()=>{t&&(af(e,t),r())},[t,e,r]),{lastViewed:t,setLastViewed:n}},hj="/personal",X_=e=>{const[t,n]=ai("lastViewedPage",hj,6048e5);return g.useEffect(()=>{if(e){const o=["/personal","/projects","/search","/playground","/insights","/admin"].find(s=>s===e.pathname||e.pathname.startsWith(`${s}/`));o&&n(o)}},[e]),{lastViewedPage:t,resetLastViewedPage:()=>n(hj)}},xmt=()=>{const{user:e,loading:t}=gs(),{loading:n}=Zr(),r=!!(e!=null&&e.id),{lastViewedPage:o}=X_(),{lastViewed:s}=ymt();return t||n?i.jsx(X4,{type:"fullscreen"}):r?o==="/projects"&&s?i.jsx(I1,{to:`/projects/${s}`,replace:!0}):o&&o!=="/"?i.jsx(I1,{to:o,replace:!0}):i.jsx(I1,{to:hj,replace:!0}):i.jsx(I1,{to:"/login",replace:!0})},vmt=v("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%"})),bmt=v(NX)(({theme:e})=>({height:"80px"})),Cmt=v("div")(({theme:e})=>({display:"flex",position:"relative"})),wmt=v("div")(({theme:e})=>({marginTop:e.spacing(4)})),Smt=v($e)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),J_=({children:e})=>{const t=$t(),{resetLastViewedPage:n}=X_(),r=()=>{n(),t("/")},o=()=>{t(Ii)};return i.jsxs(vmt,{children:[i.jsxs("div",{children:[i.jsx(bmt,{}),i.jsx(Cmt,{children:i.jsx(J,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),i.jsxs(wmt,{children:[i.jsx($e,{variant:"contained",color:"primary",onClick:o,children:"Go back"}),i.jsx(Smt,{onClick:r,children:"Go home"})]})]}),e]})},jmt=v(K)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),Emt=v(K)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),kmt=({featureType:e,loading:t})=>{const n=$t(),{uiConfig:r}=ut(),{refetch:o}=t0(),{updateFeatureTypeLifetime:s,loading:a}=mmt(),[l,c]=g.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=g.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:f}=_t(),h=zt(),m=w=>{const j=Number.parseInt(uf(w.target.value),10);c(j),j===0&&d(!0)},y=w=>{d(w.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),x=async w=>{w.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature flag type loaded");const j=u?0:l;await s(e.id,j),o(),p({text:"Feature type updated",type:"success"}),n("/feature-toggle-type"),h.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:j}})}catch(j){f(pt(j))}},C=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 '{
447
+ your user.`,documentationLink:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys#personal-access-tokens",documentationLinkLabel:"Personal access tokens documentation",formatApiCode:w,children:i.jsxs(Jgt,{onSubmit:C,children:[i.jsx("div",{children:i.jsx(Xgt,{description:u,setDescription:d,isDescriptionUnique:k,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:m,errors:y,setErrors:b})}),i.jsxs(Zgt,{children:[i.jsx($e,{type:"submit",variant:"contained",color:"primary",disabled:!S,children:"Create token"}),i.jsx(Qgt,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},t0t=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=V_(),{deletePersonalAPIToken:o}=moe(),{setToastData:s,setToastApiError:a}=_t(),l=async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),s({text:"Token deleted",type:"success"})}catch(c){a(pt(c))}};return i.jsx(Mn,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:l,onClose:()=>{t(!1)},title:"Delete token?",children:i.jsxs(J,{children:['Any applications or scripts using this token "',i.jsx("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},n0t=v(Dt)(({theme:e})=>({marginBottom:e.spacing(3)})),r0t=({open:e,setOpen:t,token:n})=>i.jsxs(Mn,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[i.jsx(n0t,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),i.jsx(J,{variant:"body1",children:"Your token:"}),i.jsx(z_,{token:(n==null?void 0:n.secret)||""})]}),o0t=v(Dt)(({theme:e})=>({marginBottom:e.spacing(3)})),s0t=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),i0t=v(J)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),a0t=v(J)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),l0t=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),c0t={id:"createdAt",desc:!0},{value:Uz,setValue:u0t}=td("PersonalAPITokensTable:v1",c0t),d0t=()=>{const e=Bt(),t=Nn(e.breakpoints.down("md")),n=Nn(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=V_(),[s,a]=Mp(),[l]=g.useState(()=>({sortBy:[{id:s.get("sort")||Uz.id,desc:s.has("order")?s.get("order")==="desc":Uz.desc}],globalFilter:s.get("search")||""})),[c,u]=g.useState(l.globalFilter),[d,p]=g.useState(!1),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,x]=g.useState(),[C,w]=g.useState(),j=g.useMemo(()=>[{Header:"Description",accessor:"description",Cell:wi,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:A})=>new Date(A).getFullYear()>new Date().getFullYear()+100?i.jsx(vn,{children:"Never"}):i.jsx(Cp,{value:A}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Cp,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:l0,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:A}})=>i.jsx(Ku,{children:i.jsx(Rt,{title:"Delete token",arrow:!0,describeChild:!0,children:i.jsx("span",{children:i.jsx(Mt,{onClick:()=>{w(A),y(!0)},children:i.jsx(So,{})})})})}),maxWidth:100,disableSortBy:!0}],[w,y]),{data:k,getSearchText:S,getSearchContext:E}=Af(j,c,r),T=g.useMemo(()=>(k==null?void 0:k.length)===0&&o?l0t:k,[k,o]),{headerGroups:R,rows:_,prepareRow:M,state:{sortBy:$},setHiddenColumns:z}=on.useTable({columns:j,data:T,initialState:l,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},on.useSortBy,on.useFlexLayout);return Bf([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],z,j),g.useEffect(()=>{const A={};A.sort=$[0].id,$[0].desc&&(A.order="desc"),c&&(A.search=c),a(A,{replace:!0}),u0t({id:$[0].id,desc:$[0].desc||!1})},[$,c,a]),i.jsxs(ir,{isLoading:o,header:i.jsx($n,{title:`Personal API tokens (${_.length<T.length?`${_.length} of ${T.length}`:T.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!t,show:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:c,onChange:u,getSearchContext:E}),i.jsx($n.Divider,{})]})}),i.jsx($e,{variant:"contained",color:"primary",disabled:r.length>=goe,onClick:()=>p(!0),children:"New token"})]}),children:i.jsx(te,{condition:t,show:i.jsx(No,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:E})})}),children:[i.jsx(o0t,{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."}),i.jsx(Ai,{value:S(c),children:i.jsx(Wp,{rows:_,headerGroups:R,prepareRow:M})}),i.jsx(te,{condition:_.length===0,show:i.jsx(te,{condition:(c==null?void 0:c.length)>0,show:i.jsxs(Gr,{children:["No tokens found matching “",c,"”"]}),elseShow:i.jsxs(s0t,{children:[i.jsx(i0t,{children:"You have no personal API tokens yet."}),i.jsx(a0t,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),i.jsx($e,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),i.jsx(e0t,{open:d,setOpen:p,newToken:A=>{x(A),h(!0)}}),i.jsx(r0t,{open:f,setOpen:h,token:b}),i.jsx(t0t,{open:m,setOpen:y,token:C})]})};var U_={},p0t=je;Object.defineProperty(U_,"__esModule",{value:!0});var G_=U_.default=void 0,f0t=p0t(Ee()),h0t=i,g0t=(0,f0t.default)((0,h0t.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");G_=U_.default=g0t;const voe=(e,t={})=>{const{isEnterprise:n}=ut(),{data:r,error:o,mutate:s}=Ts(!!e&&n(),void 0,yt(`api/admin/roles/${e}`),m0t,t);return g.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>s(),error:o}),[r,o,s])},m0t=e=>fetch(e).then(en("Role")).then(t=>t.json());var q_={},y0t=je;Object.defineProperty(q_,"__esModule",{value:!0});var boe=q_.default=void 0,x0t=y0t(Ee()),v0t=i,b0t=(0,x0t.default)((0,v0t.jsx)("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person");boe=q_.default=b0t;var Y_={},C0t=je;Object.defineProperty(Y_,"__esModule",{value:!0});var Coe=Y_.default=void 0,w0t=C0t(Ee()),S0t=i,j0t=(0,w0t.default)((0,S0t.jsx)("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm3.61 6.34c1.07 0 1.93.86 1.93 1.93 0 1.07-.86 1.93-1.93 1.93-1.07 0-1.93-.86-1.93-1.93-.01-1.07.86-1.93 1.93-1.93zm-6-1.58c1.3 0 2.36 1.06 2.36 2.36 0 1.3-1.06 2.36-2.36 2.36s-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36zm0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68zM11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09z"}),"SupervisedUserCircle");Coe=Y_.default=j0t;const G1=e=>e.environment?`${e.name}-${e.environment}`:`${e.name}`,Zqt=e=>e.reduce((t,n)=>(t[G1(n)]=n,t),{}),Qqt=(e,t)=>{const n=by(e);return n[G1(t)]?delete n[G1(t)]:n[G1(t)]={...t},n},eYt=(e,t)=>{const n=by(e);return t.every(o=>n[G1(o)])?t.forEach(o=>{delete n[G1(o)]}):t.forEach(o=>{n[G1(o)]={...o}}),n},E0t=e=>e.filter(({name:r})=>r!=="ADMIN").reduce((r,o)=>{var l;const s=((l=cMe.find(c=>c.permissions.includes(o.name)))==null?void 0:l.label)||"Other",a=r.find(({label:c})=>c===s);return a?a.permissions.push(o):r.push({label:s,type:"root",permissions:[o]}),r},[]).map(r=>({...r,permissions:[...new Set(r.permissions.sort((o,s)=>o.displayName.localeCompare(s.displayName)))]})).sort(T0t),k0t=e=>{const t=e.filter(({type:o})=>o===Dgt),n=e.filter(({type:o})=>o===$gt),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,s)=>{const a=s.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(s):o.push({label:a,type:"environment",permissions:[s]}),o},[])),r.map(o=>({...o,permissions:[...new Set(o.permissions.sort((s,a)=>s.displayName.localeCompare(a.displayName)))]}))},tYt=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],T0t=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),R0t=v("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})),A0t=v("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),P0t=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),_0t=v("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),I0t=v(Coe)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),O0t=v("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),M0t=v("p")(({theme:e})=>({marginTop:e.spacing(.5)})),$0t=v("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),D0t=({roleId:e,tooltip:t,...n})=>{const{role:r}=voe(e.toString());if(!r)return null;const{name:o,description:s,permissions:a,type:l}=r,u=Bgt.includes(l)?k0t(a):E0t(a);return i.jsxs(R0t,{tooltip:t,...n,children:[i.jsxs(_0t,{children:[i.jsx(I0t,{color:"disabled"}),o]}),i.jsx(M0t,{children:s}),i.jsx(te,{condition:!Fgt.includes(r.type),show:()=>i.jsxs(i.Fragment,{children:[i.jsx(A0t,{children:"Role permissions:"}),i.jsx(P0t,{children:u.map(({label:d,permissions:p})=>i.jsxs("div",{children:[i.jsx(O0t,{children:d}),i.jsx($0t,{children:p.map(f=>i.jsx("li",{children:f.displayName},f.name))})]},d))})]})})]})},L0t=({roleId:e,hideIcon:t,children:n})=>{const{role:r}=voe(e.toString()),o=t?void 0:i.jsx(boe,{});return r?i.jsx(wr,{title:i.jsx(D0t,{roleId:e,tooltip:!0}),arrow:!0,children:i.jsx(an,{tabIndex:0,color:"success",icon:o,sx:{cursor:"pointer"},children:r.name})}):n?i.jsx(an,{color:"success",icon:o,children:n}):null},N0t=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{subscribe:async a=>{const l=`api/admin/email-subscription/${a}`,c=t(l,{method:"PUT"});await e(c.caller,c.id)},unsubscribe:async a=>{const l=`api/admin/email-subscription/${a}`,c=t(l,{method:"DELETE"});await e(c.caller,c.id)},errors:n,loading:r}},F0t=({status:e,onChange:t})=>{const{subscribe:n,unsubscribe:r,loading:o}=N0t(),{setToastData:s,setToastApiError:a}=_t(),{trackEvent:l}=zt();return i.jsx(K,{children:i.jsx(Ur,{label:"Productivity Email Subscription",control:i.jsx(oa,{onChange:async()=>{try{e==="subscribed"?(await r("productivity-report"),s({text:"Unsubscribed from productivity report",type:"success"}),l("productivity-report",{props:{eventType:"unsubscribe"}})):(await n("productivity-report"),s({text:"Subscribed to productivity report",type:"success"}),l("productivity-report",{props:{eventType:"subscribe"}}))}catch(c){a(pt(c))}t()},name:"productivity-email",checked:e==="subscribed",disabled:o})})})},B0t=["cs","da-DK","de","en-GB","en-IN","en-US","fr-FR","ja","nb-NO","pt-BR","sv-SE"],z0t=v("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})),H0t=v("div")(()=>({flexGrow:1})),W0t=v(J)(({theme:e})=>({fontSize:e.spacing(3.75)})),V0t=v(ed)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),$b=v(J)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),U0t=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),"& > div > p":{marginBottom:e.spacing(1.5)}})),G0t=v(ft)(({theme:e})=>({":hover,:focus-visible":{outline:"none","> *":{outline:`2px solid ${e.palette.primary.main}`}}})),Gz=v("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),q0t=v(Ko)(({theme:e})=>({width:e.spacing(30)})),Y0t=v(Gl)(({theme:e})=>({backgroundColor:e.palette.background.paper})),K0t=v("ul")(({theme:e})=>({listStyle:"none",padding:0,display:"flex",flexFlow:"row wrap",gap:e.spacing(1)})),woe="2014-09-29T14:50:46",X0t=new Date(woe),J0t=v("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",flexFlow:"row wrap",gap:e.spacing(1),alignItems:"center"})),Z0t=({user:e})=>{const{profile:t,refetchProfile:n}=Nte(),{locationSettings:r,setLocationSettings:o}=$r(),[s,a]=g.useState(),l=g.useId(),[c,u]=g.useState([...B0t]);g.useEffect(()=>{const f=c.find(h=>h.toLowerCase().includes(r.locale.toLowerCase()));a(f),f||u(h=>[...h,r.locale])},[r]);const d=f=>{const h=f.target.value;a(h),o({locale:h})},p=Er("productivityReportEmail");return i.jsxs(i.Fragment,{children:[i.jsxs(z0t,{children:[i.jsx(V0t,{user:e}),i.jsxs(H0t,{children:[i.jsx(W0t,{children:e.name||e.email||e.username}),i.jsx(J,{variant:"body1",children:e.email})]})]}),i.jsxs(ir,{children:[i.jsx($b,{children:"Access"}),i.jsxs(U0t,{children:[i.jsx(K,{sx:{width:"50%"},children:(t==null?void 0:t.rootRole)&&i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body2",children:"Your root role"}),i.jsx(L0t,{roleId:t.rootRole.id,children:t.rootRole.name})]})}),i.jsxs(K,{children:[i.jsx(J,{variant:"body2",children:"Projects"}),i.jsx(te,{condition:!!(t!=null&&t.projects.length),show:i.jsx(K0t,{children:t==null?void 0:t.projects.map(f=>i.jsx("li",{children:i.jsx(Rt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:i.jsx(G0t,{to:`/projects/${f}`,children:i.jsx(an,{color:"secondary",icon:i.jsx(G_,{}),children:f})})})},f))}),elseShow:i.jsx(Rt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:i.jsx(an,{tabIndex:0,children:"No projects"})})})]})]}),i.jsx(Gz,{}),i.jsx($b,{children:"Date/Time Settings"}),i.jsx(J,{variant:"body2",children:"This is the format used across the system for time and date"}),i.jsxs(J0t,{children:[i.jsxs(q0t,{variant:"outlined",size:"small",children:[i.jsx(Y0t,{htmlFor:"locale-select",children:"Date/Time formatting"}),i.jsx(na,{"aria-details":l,id:"locale-select",value:s||"",native:!0,onChange:d,MenuProps:{style:{zIndex:9999}},children:c.map(f=>i.jsx("option",{value:f,children:f},f))})]}),i.jsxs(J,{id:l,children:["Example:"," ",i.jsx("time",{dateTime:woe,children:ry(X0t,s)})]})]}),p?i.jsxs(i.Fragment,{children:[i.jsx(Gz,{}),i.jsx($b,{children:"Email Settings"}),(t==null?void 0:t.subscriptions)&&i.jsx(F0t,{status:t.subscriptions.includes("productivity-report")?"subscribed":"unsubscribed",onChange:n})]}):null]})]})},Q0t=()=>{const{user:e}=gs(),t=jo(),n=$t(),{config:r,loading:o}=poe("simple"),{uiConfig:s}=ut(),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:s.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:h})=>h&&p.includes(h))||a[0]).id},[u,d]=g.useState(c());return g.useEffect(()=>{d(c())},[t]),o?null:i.jsxs(Pgt,{tabs:a,value:u,onChange:l,children:[i.jsx(te,{condition:u==="profile",show:i.jsx(Z0t,{user:e})}),i.jsx(te,{condition:u==="password",show:i.jsx(Ogt,{})}),i.jsx(te,{condition:u==="pat",show:i.jsx(d0t,{})})]})},emt=g.lazy(()=>La(()=>import("./FeatureViewLazyExport-CVIpdGgg.js").then(e=>e.F),[])),tmt=g.lazy(()=>La(()=>import("./LazyAdminExport-CEik6N0e.js").then(e=>e.L),[])),nmt=g.lazy(()=>La(()=>import("./LazyProjectExport-C8B0wkkW.js"),[])),rmt=()=>{const{isEnterprise:e}=ut(),{data:t,error:n,mutate:r}=Ts(e(),{events:[]},yt("api/admin/logins"),omt);return g.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},omt=e=>fetch(e).then(en("Login History")).then(t=>t.json()),qz=v(K)(()=>({display:"flex",justifyContent:"center"})),smt=({row:e,value:t})=>{const{searchQuery:n}=Pi();return t?i.jsx(qz,{children:i.jsx(an,{color:"success",children:"True"})}):i.jsx(qz,{children:i.jsx(wr,{arrow:!0,title:i.jsx(Pr,{search:n,children:e.original.failure_reason}),children:i.jsx(an,{color:"error",children:"False"})})})},imt=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=er({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}};var K_={},amt=je;Object.defineProperty(K_,"__esModule",{value:!0});var Soe=K_.default=void 0,lmt=amt(Ee()),cmt=i,umt=(0,lmt.default)((0,cmt.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");Soe=K_.default=umt;const dmt={id:"created_at",desc:!0},{value:Yz,setValue:pmt}=td("LoginHistoryTable:v1",dmt),fmt={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google",github:"GitHub"},hmt=()=>{const{events:e,loading:t}=rmt(),{downloadCSV:n}=imt(),[r,o]=Mp(),[s]=g.useState(()=>({sortBy:[{id:r.get("sort")||Yz.id,desc:r.has("order")?r.get("order")==="desc":Yz.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=g.useState(s.globalFilter),c=Nn(br.breakpoints.down("sm")),u=Nn(br.breakpoints.down("md")),d=g.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:w,column:j})=>i.jsx(l0,{value:w,column:j,dateFormat:ji}),maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:wi,searchable:!0},{Header:"Authentication",accessor:w=>fmt[w.auth_type]||w.auth_type,width:150,maxWidth:150,Cell:wi,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:wi,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:smt,filterName:"success",filterParsing:w=>w.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:f,getSearchContext:h}=Af(d,a,e),{headerGroups:m,rows:y,prepareRow:b,state:{sortBy:x},setHiddenColumns:C}=on.useTable({columns:d,data:p,initialState:s,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:vn}},on.useSortBy,on.useFlexLayout);return Bf([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],C,d),g.useEffect(()=>{const w={};w.sort=x[0].id,x[0].desc&&(w.order="desc"),a&&(w.search=a),o(w,{replace:!0}),pmt({id:x[0].id,desc:x[0].desc||!1})},[x,a,o]),i.jsxs(ir,{isLoading:t,header:i.jsx($n,{title:`Login history (${y.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!u,show:i.jsx(No,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})}),i.jsx(te,{condition:y.length>0,show:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!u,show:i.jsx($n.Divider,{})}),i.jsx(Rt,{title:"Download login history",arrow:!0,children:i.jsx(Mt,{onClick:n,children:i.jsx(Soe,{})})})]})})]}),children:i.jsx(te,{condition:u,show:i.jsx(No,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[i.jsx(Ai,{value:f(a),children:i.jsx(Wp,{rows:y,headerGroups:m,prepareRow:b})}),i.jsx(te,{condition:y.length===0,show:i.jsx(te,{condition:(a==null?void 0:a.length)>0,show:i.jsxs(Gr,{children:["No login events found matching “",a,"”"]}),elseShow:i.jsx(Gr,{children:"No login events available."})})})]})},gmt=()=>{const{isEnterprise:e}=ut();return e()?i.jsx("div",{children:i.jsx(E_,{permissions:[ni,c7],children:i.jsx(hmt,{})})}):i.jsx(c0,{feature:"login-history",page:!0})},mmt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{updateFeatureTypeLifetime:async(s,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${s}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},joe=(e,t)=>{const n=g.useCallback(()=>{const r=new CustomEvent(e);document.dispatchEvent(r)},[e]);return g.useEffect(()=>{const r=o=>t(o);return document.addEventListener(e,r),()=>{document.removeEventListener(e,r)}},[e,t]),{emitEvent:n}},ymt=()=>{const e=`${Js}:unleash-lastViewedProject`,[t,n]=g.useState(()=>sf(e)),{emitEvent:r}=joe("lastViewedProjectUpdated",()=>{n(sf(e))});return g.useEffect(()=>{t&&(af(e,t),r())},[t,e,r]),{lastViewed:t,setLastViewed:n}},hj="/personal",X_=e=>{const[t,n]=ai("lastViewedPage",hj,6048e5);return g.useEffect(()=>{if(e){const o=["/personal","/projects","/search","/playground","/insights","/admin"].find(s=>s===e.pathname||e.pathname.startsWith(`${s}/`));o&&n(o)}},[e]),{lastViewedPage:t,resetLastViewedPage:()=>n(hj)}},xmt=()=>{const{user:e,loading:t}=gs(),{loading:n}=Zr(),r=!!(e!=null&&e.id),{lastViewedPage:o}=X_(),{lastViewed:s}=ymt();return t||n?i.jsx(X4,{type:"fullscreen"}):r?o==="/projects"&&s?i.jsx(I1,{to:`/projects/${s}`,replace:!0}):o&&o!=="/"?i.jsx(I1,{to:o,replace:!0}):i.jsx(I1,{to:hj,replace:!0}):i.jsx(I1,{to:"/login",replace:!0})},vmt=v("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%"})),bmt=v(NX)(({theme:e})=>({height:"80px"})),Cmt=v("div")(({theme:e})=>({display:"flex",position:"relative"})),wmt=v("div")(({theme:e})=>({marginTop:e.spacing(4)})),Smt=v($e)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),J_=({children:e})=>{const t=$t(),{resetLastViewedPage:n}=X_(),r=()=>{n(),t("/")},o=()=>{t(Ii)};return i.jsxs(vmt,{children:[i.jsxs("div",{children:[i.jsx(bmt,{}),i.jsx(Cmt,{children:i.jsx(J,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),i.jsxs(wmt,{children:[i.jsx($e,{variant:"contained",color:"primary",onClick:o,children:"Go back"}),i.jsx(Smt,{onClick:r,children:"Go home"})]})]}),e]})},jmt=v(K)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),Emt=v(K)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),kmt=({featureType:e,loading:t})=>{const n=$t(),{uiConfig:r}=ut(),{refetch:o}=t0(),{updateFeatureTypeLifetime:s,loading:a}=mmt(),[l,c]=g.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=g.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:f}=_t(),h=zt(),m=w=>{const j=Number.parseInt(uf(w.target.value),10);c(j),j===0&&d(!0)},y=w=>{d(w.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),x=async w=>{w.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature flag type loaded");const j=u?0:l;await s(e.id,j),o(),p({text:"Feature type updated",type:"success"}),n("/feature-toggle-type"),h.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:j}})}catch(j){f(pt(j))}},C=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 '{
448
448
  "lifetimeDays": ${u?0:l}
449
449
  }'`].join(` \\
450
450
  `),[r,e==null?void 0:e.id,l,u]);return!t&&!e?i.jsx(J_,{children:i.jsx("div",{"data-testid":"404_NOT_FOUND"})}):i.jsx(eo,{modal:!0,title:t?"Edit flag type":`Edit flag type: ${e==null?void 0:e.name}`,description:(e==null?void 0:e.description)||"",documentationLink:"https://docs.getunleash.io/concepts/feature-flags#feature-flag-types",documentationLinkLabel:"Feature flag types documentation",formatApiCode:C,children:i.jsxs(Emt,{component:"form",onSubmit:x,children:[i.jsxs(J,{sx:w=>({margin:w.spacing(3,0,1),display:"flex",alignItems:"center"}),children:[i.jsx(K,{component:"label",htmlFor:"feature-flag-lifetime",children:"Expected lifetime"}),i.jsx(Zo,{htmlTooltip:!0,tooltip:i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"If your flag exceeds the expected lifetime of its flag type it will be marked as potentially stale."}),i.jsx("br",{}),i.jsx("a",{href:"https://docs.getunleash.io/concepts/feature-flags#feature-flag-types",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})]})})]}),i.jsxs(K,{component:"label",sx:w=>({display:"flex",alignItems:"center",cursor:"pointer",marginBottom:w.spacing(1),marginRight:"auto"}),htmlFor:"feature-flag-expire",children:[i.jsx(Si,{checked:u||l===0,id:"feature-flag-expire",onChange:y,disabled:t}),i.jsx(K,{children:"doesn't expire"})]}),i.jsx(Yr,{autoFocus:!0,disabled:u||t,type:"number",label:"Lifetime in days",id:"feature-flag-lifetime",value:u?"0":`${l}`,onChange:m,error:b}),i.jsxs(jmt,{children:[i.jsx(lo,{permission:ni,variant:"contained",color:"primary",type:"submit",disabled:t||a,children:"Save feature flag type"}),i.jsx($e,{type:"button",color:"primary",onClick:()=>n(Ii),children:"Cancel"})]})]})})},Tmt=({featureTypes:e,loading:t})=>{const{featureTypeId:n}=YE(),r=e.find(o=>o.id===n);return i.jsx(kmt,{featureType:r,loading:t})},Rmt="/feature-toggle-type",Amt=()=>{const{featureTypes:e,loading:t}=t0(),n=$t(),r=g.useMemo(()=>[{accessor:"id",Cell:({value:d})=>{const p=v7(d);return i.jsx(J7,{icon:i.jsx(p,{"data-loading":"true",color:"action"})})},width:50,disableSortBy:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:d,description:p}}})=>i.jsx(Yl,{"data-loading":!0,title:d,subtitle:p}),sortType:"alphanumeric"},{Header:"Lifetime",accessor:"lifetimeDays",Cell:({value:d})=>d?i.jsx(vn,{children:d===1?"1 day":`${d} days`}):i.jsx(vn,{children:"doesn't expire"}),minWidth:150,sortType:"numericZeroLast"},{Header:"Actions",Cell:({row:{original:d}})=>i.jsx(K,{sx:p=>({padding:p.spacing(.5,0)}),children:i.jsx(Ku,{children:i.jsx(Co,{disabled:!d.id,"data-loading":"true",onClick:()=>n(`/feature-toggle-type/edit/${d.id}`),permission:ni,tooltipProps:{title:`Edit ${d.name} feature flag type`},children:i.jsx(oi,{})})})}),disableSortBy:!0}],[n]),o=g.useMemo(()=>t?Array(5).fill({id:"",name:"Loading...",description:"Loading...",lifetimeDays:1}):e,[t,e]),{getTableProps:s,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u}=on.useTable({columns:r,data:o,sortTypes:Ds,autoResetSortBy:!1,disableSortRemove:!0,initialState:{sortBy:[{id:"lifetimeDays"}]}},on.useSortBy);return i.jsxs(ir,{isLoading:t,header:i.jsx($n,{title:"Feature flag types"}),children:[i.jsxs(ja,{...s(),children:[i.jsx(Sa,{headerGroups:l}),i.jsx(Ji,{...a(),children:c.map(d=>{u(d);const{key:p,...f}=d.getRowProps();return i.jsx(ti,{hover:!0,...f,children:d.cells.map(h=>{const{key:m,...y}=h.getCellProps();return i.jsx(Ci,{...y,children:h.render("Cell")},m)})},p)})})]}),i.jsx(KE,{children:i.jsx(z1,{path:"edit/:featureTypeId",element:i.jsx(hl,{label:"Edit feature flag type",onClose:()=>n(Rmt),open:!0,children:i.jsx(Tmt,{featureTypes:e,loading:t})})})})]})},Pmt="/static/edge-mode-CxSIDLbZ.svg",_mt="/static/edge-offline-C6xyGCqC.svg",Imt="/static/edge-daisy-chaining-CATtRukP.svg",Omt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),Mmt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3)})),$mt=v("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(1)})),Db=v(J)(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1)})),Dmt=v("a")({textDecoration:"none","&:hover":{textDecoration:"underline"}}),Lb=v("figure")(({theme:e})=>({display:"flex",marginLeft:0,marginRight:0,marginTop:e.spacing(1.5),marginBottom:e.spacing(3),gap:e.spacing(1),flexDirection:"column"})),Nb=v("figcaption")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary,textAlign:"center"})),Kz={name:"unleash",displayName:"Unleash Edge",description:"Unleash Edge is the successor to the Unleash Proxy.",documentationUrl:"https://docs.getunleash.io/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.
451
451
  Unleash Edge offers two important features:
452
452
  - **Performance:** Unleash Edge caches in memory and can run close to your end-users. A single instance can handle tens to hundreds of thousands of requests per second.
453
- - **Resilience:** Unleash Edge is designed to survive restarts and operate properly even if you lose connection to your Unleash server.`},Lmt=()=>{const{displayName:e,description:t,documentationUrl:n}=Kz;return i.jsx(eo,{title:`${e}`,description:t||"",documentationLink:n,documentationLinkLabel:"Unleash Edge documentation",children:i.jsxs(Omt,{children:[i.jsx(oP,{provider:Kz,title:"Why would you need Edge?"}),i.jsx($mt,{children:i.jsxs(Dmt,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash-edge#readme",children:["View Unleash Edge on GitHub"," ",i.jsx(w7,{fontSize:"inherit",sx:{verticalAlign:"middle",marginBottom:"2px"}})]})}),i.jsx(pr,{sx:r=>({marginTop:r.spacing(2),marginBottom:r.spacing(2)})}),i.jsx("iframe",{src:"https://www.youtube-nocookie.com/embed/6uIdF-yByWs?si=rPzsFCM_2IheaTUo",title:"YouTube video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,style:{width:"100%",aspectRatio:"16/9"}}),i.jsxs(Mmt,{children:[i.jsxs("section",{children:[i.jsx(Db,{variant:"h3",children:"Modes"}),i.jsxs(J,{variant:"body1",children:["Edge currently supports 2 different modes:"," ",i.jsxs("ul",{children:[i.jsxs("li",{children:[i.jsx("a",{href:"https://docs.getunleash.io/unleash-edge#edge",target:"_blank",rel:"noopener noreferrer",children:"Edge"})," ","Edge – Connection to upstream node (Unleash instance or another Edge). Supports dynamic tokens, metrics and other advanced features;"]}),i.jsxs("li",{children:[i.jsx("a",{href:"https://docs.getunleash.io/unleash-edge#offline",target:"_blank",rel:"noopener noreferrer",children:"Offline"})," ","– No connection to upstream node. Full control of data and tokens;"]})]})]})]}),i.jsxs("section",{children:[i.jsx(Db,{variant:"h3",children:"Edge"}),i.jsx(J,{variant:"body1",children:'Edge mode is the "standard" mode for Unleash Edge and the one you should default to in most cases. It connects to an upstream node, such as your Unleash instance, and uses that as the source of truth for feature flags.'}),i.jsxs(Lb,{children:[i.jsx("img",{src:Do(Pmt),alt:"test"}),i.jsx(Nb,{children:"Edge mode"})]}),i.jsx(J,{children:"Other than connecting Edge directly to your Unleash instance, it's also possible to connect to another Edge instance (daisy chaining). You can have as many Edge nodes as you'd like between the Edge node your clients are accessing and the Unleash server, and it's also possible for multiple nodes to connect to a single upstream one."}),i.jsxs(Lb,{children:[i.jsx("img",{src:Do(Imt),alt:"test"}),i.jsx(Nb,{children:"Edge daisy chaining"})]})]}),i.jsxs("section",{children:[i.jsx(Db,{variant:"h3",children:"Offline"}),i.jsx(J,{children:"Offline mode is useful when there is no connection to an upstream node, such as your Unleash instance or another Edge instance, or as a tool to make working with Unleash easier during development."}),i.jsxs(Lb,{children:[i.jsx("img",{src:Do(_mt),alt:"test"}),i.jsx(Nb,{children:"Edge offline"})]})]})]})]})})},Nmt=()=>{const{providerId:e}=YE();return e==="jira"?i.jsx(cYe,{}):e==="edge"?i.jsx(Lmt,{}):i.jsx(J_,{})},Fmt=v(ft)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Bmt=(e,t)=>{const n=t!==0?", ":"",r=e.project,o=e.project!=="*"?i.jsx(Fmt,{to:`/projects/${e.project}`,children:e.project},r):i.jsx("span",{children:e.project},r),s=` (${e.environments.join(", ")})`;return[n,o,s]},zmt=({usage:e})=>{const t=Bt(),n=e==null?void 0:e.flatMap((r,o)=>Bmt(r,o));return i.jsx(vn,{children:i.jsx(te,{condition:e!==void 0&&e.length>0,show:i.jsx(J,{variant:"body2",children:n}),elseShow:i.jsx(J,{variant:"body2",color:t.palette.text.secondary,children:"not connected"})})})},Hmt=25,Wmt=e=>`api/admin/projects/${e}/applications?`,Vmt=see({applications:[],total:0}),nYt=(e,t)=>Vmt(e,Wmt(t)),Eoe=v("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(9,0,9,0),minHeight:"150px"})),Umt=e=>typeof e=="string"&&e.length>0?Gmt(e):i.jsxs(Eoe,{children:["You don't have have any connected applications. To connect your application to Unleash you will require a"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/docs/sdks/",children:"Client SDK"}),".",i.jsx("br",{}),"You can read more about how to use Unleash in your application in the"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/docs/sdks/",children:"documentation."})]}),Gmt=e=>i.jsxs(Eoe,{children:['No application found matching "',e,'"']}),Fb=_R(),qmt=()=>{const e={offset:Hr(C4,0),limit:Hr(C4,Hmt),query:ei,sortBy:Hr(ei,"appName"),sortOrder:Hr(ei,"asc")},[t,n]=If("applications-table",e),{applications:r,total:o,loading:s}=iee(gA($g(e,t),b=>b?`${b}`:void 0)),a=g.useMemo(()=>[Fb.accessor("icon",{id:"Icon",header:()=>"",cell:({row:{original:{icon:b}}})=>i.jsx(J7,{icon:i.jsx(N5,{children:i.jsx(Ta,{children:b||"apps"})})}),enableSorting:!1}),Fb.accessor("appName",{header:"Name",meta:{width:"50%"},cell:({row:{original:{appName:b,description:x}}})=>i.jsx(Yl,{title:b,to:`/applications/${encodeURIComponent(b)}`,subtitle:x})}),Fb.accessor("usage",{header:"Project(environment)",meta:{width:"50%"},enableSorting:!1,cell:({row:{original:b}})=>i.jsx(zmt,{usage:b.usage})})],[]),l=$R(hA(t,n,{columns:a,data:r})),{offset:c,limit:u,query:d,sortBy:p,sortOrder:f,...h}=t,m=(b="")=>{n({query:b})},y=xl(s);return i.jsx(i.Fragment,{children:i.jsx(ir,{bodyClass:"no-padding",header:i.jsx($n,{title:`Applications (${o})`,actions:i.jsx(No,{initialValue:d||"",onChange:m})}),children:i.jsx("div",{className:Wh.fullwidth,children:i.jsx(te,{condition:r.length>0||s,show:i.jsx(Ai,{value:d||"",children:i.jsx("div",{ref:y,children:i.jsx(zR,{tableInstance:l,totalItems:o})})}),elseShow:Umt(d)})})})})},Bb=()=>{const e=jo(),t=$t();return g.useEffect(()=>{t(`/integrations${e.pathname.replace("/addons","")}`)},[e.pathname,t]),i.jsxs(ir,{children:["Addons where renamed to"," ",i.jsx(ft,{to:"/integrations",children:"/integrations"})]})},koe=e=>{const t=`unleash-userSubmittedFeedback:${e}`,{value:n,setValue:r}=td(t,!1);return{hasSubmittedFeedback:n,setHasSubmittedFeedback:r}},Toe=g.createContext(void 0),Roe=()=>{const e=g.useContext(Toe);if(!e)throw new Error("useFeedbackContext must be used within a FeedbackProvider");return e},Z_=(e,t,n="")=>{const r=Roe(),{hasSubmittedFeedback:o}=koe(e);return{...r,hasSubmittedFeedback:o,openFeedback:s=>{r.openFeedback({...s,category:e},t,n)}}};var Q_={},Ymt=je;Object.defineProperty(Q_,"__esModule",{value:!0});var t8=Q_.default=void 0,Kmt=Ymt(Ee()),Xz=i,Xmt=(0,Kmt.default)([(0,Xz.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17L4 17.17V4h16v12z"},"0"),(0,Xz.jsx)("path",{d:"m12 15 1.57-3.43L17 10l-3.43-1.57L12 5l-1.57 3.43L7 10l3.43 1.57z"},"1")],"ReviewsOutlined");t8=Q_.default=Xmt;const Jmt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("md")]:{flexDirection:"column",gap:e.spacing(1)}})),Zmt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),Qmt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),[e.breakpoints.down("md")]:{width:"100%"}})),e2t=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-end",gap:e.spacing(1),marginTop:e.spacing(2)})),t2t=({actions:e})=>{const t=Er("showInactiveUsers"),n="Analytics",r=Bt(),o=Nn(r.breakpoints.down("md")),{openFeedback:s}=Z_("insights","automatic",t?"withInactiveUsers":"withoutInactiveUsers"),a=()=>{s({title:"How easy was it to use insights?",positiveLabel:"What do you like most about insights?",areasForImprovementsLabel:"What should be improved in insights?"})};return i.jsxs(i.Fragment,{children:[i.jsx($n,{title:n,titleElement:i.jsx(J,{variant:"h1",component:"span",sx:l=>({display:"flex",alignItems:"center",gap:l.spacing(1)}),children:n}),actions:i.jsxs(Jmt,{children:[i.jsx(te,{condition:!o,show:i.jsx(Qmt,{children:e})}),i.jsx(Zmt,{children:i.jsx($e,{startIcon:i.jsx(t8,{}),variant:"outlined",onClick:a,children:"Provide feedback"})})]})}),i.jsx(te,{condition:o,show:i.jsx(e2t,{children:e})})]})},n2t=v(K)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),Tu=v(qr)(({theme:e})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,boxShadow:"none",display:"flex",flexWrap:"wrap",[e.breakpoints.up("md")]:{flexDirection:"row",flexWrap:"nowrap"}})),Jz=v(K)(({theme:e})=>({padding:e.spacing(3),width:"100%"})),D1=v(K)(({theme:e,width:t=300,padding:n=3})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(n),minWidth:"100%",[e.breakpoints.up("md")]:{minWidth:`${t}px`,borderRight:`1px solid ${e.palette.background.application}`}})),Hd=v(K)(({theme:e})=>({position:"relative",minWidth:0,flexGrow:1,margin:"auto 0",padding:e.spacing(3)})),r2t=v(J)(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(.5),color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.body2.fontWeight})),o2t=v("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),s2t=v("div")(({theme:e})=>({position:"sticky",top:0,zIndex:e.zIndex.sticky,paddingBlock:e.spacing(2),background:e.palette.background.application,transition:"padding 0.3s ease",display:"flex",justifyContent:"space-between",alignItems:"center",flexFlow:"row wrap",rowGap:e.spacing(2)})),eI=g.forwardRef(({title:e,children:t,filters:n},r)=>i.jsxs(o2t,{ref:r,children:[i.jsxs(s2t,{children:[i.jsx(J,{variant:"h2",children:e}),n]}),t]})),i2t=g.lazy(()=>La(()=>import("./LifecycleChartComponent-DHvlFNd2.js"),[])),n8=(e=1e6,t=2)=>n=>n<e?n.toLocaleString():Wte(n,{precision:t}),a2t=({value:e,threshold:t=1e6,precision:n=2,"data-loading":r})=>{const o=n8(t,n)(e),s=e>t,a=i.jsx("span",{"data-loading":r,"data-testid":qje,children:o});return i.jsx(te,{condition:s,show:i.jsx(Rt,{title:e.toLocaleString(),arrow:!0,children:a}),elseShow:a})},l2t=n8(1e3,2),Zz=e=>{if(e<=0)return"No data";if(e<1)return"<1 day";const t=Math.round(e);return t===1?"1 day":`${l2t(t)} days`},zb={categories:{experimental:{flagsOlderThanWeek:0,newFlagsThisWeek:0},permanent:{flagsOlderThanWeek:0,newFlagsThisWeek:0},release:{flagsOlderThanWeek:0,newFlagsThisWeek:0}},medianDaysHistorically:0,medianDaysInCurrentStage:0,totalFlags:0},c2t={lifecycleTrends:{cleanup:zb,develop:zb,production:zb}},u2t=(e,t)=>{const n=yt(`api/admin/insights/lifecycle?projects=${e==null?void 0:e.join(",")}`),{data:r,error:o}=On(n,d2t,t),s=g.useCallback(()=>{Fo(n).catch(console.warn)},[n]);return{data:r||c2t,refetchInsights:s,loading:!o&&!r,error:o}},d2t=e=>fetch(e).then(en("Lifecycle Insights data")).then(t=>t.json()),p2t=v(fA)({padding:0}),tI=({filterNamePrefix:e,state:t,...n})=>{const{projects:r}=Zr(),[o,s]=g.useState([]);return g.useEffect(()=>{const a=(r||[]).map(d=>({label:d.name,value:d.id})),l=a.length>1,c=e??"",u=[{label:"Date From",icon:"today",options:[],filterKey:`${c}from`,dateOperators:["IS"],fromFilterKey:`${c}from`,toFilterKey:`${c}to`,persistent:!0},{label:"Date To",icon:"today",options:[],filterKey:`${c}to`,dateOperators:["IS"],fromFilterKey:`${c}from`,toFilterKey:`${c}to`,persistent:!0},...l?[{label:"Project",icon:"topic",options:a,filterKey:`${c}project`,singularOperators:["IS"],pluralOperators:["IS_ANY_OF"]}]:[]].filter(({filterKey:d})=>d in t);s(u)},[JSON.stringify(r)]),i.jsx(p2t,{...n,state:t,availableFilters:o})},f2t=()=>{const e=Bt();return{olderThanWeek:e.palette.charts.A2,newThisWeek:e.palette.charts.A1}},h2t=v("div")(({theme:e})=>({display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(auto-fit, minmax(380px, 1fr))"})),g2t=v("article")(({theme:e})=>({background:e.palette.background.default,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),minWidth:0,".skeleton":{"&::after":{"--base-color":e.palette.neutral.border,"--initial":"rgb(from var(--base-color) r g b / 0)","--middle":"rgb(from var(--base-color) r g b / 0.2)","--peak":"rgb(from var(--base-color) r g b / 0.5)",background:"linear-gradient(90deg, var(--initial) 0, var(--middle) 50%, var(--peak) 100%, var(--initial))"}}})),m2t={develop:"pre-live",production:"live",cleanup:"completed"},y2t=v("h3")(({theme:e})=>({margin:0,fontSize:e.typography.body1.fontSize,fontWeight:"normal",padding:e.spacing(1),marginBottom:e.spacing(3)})),x2t=v("span")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",alignItems:"center",gap:e.spacing(2),fontSize:e.typography.h1.fontSize,fontWeight:"bold"})),v2t=v("span")({textTransform:"capitalize"}),b2t=v("dl")(({theme:e})=>({background:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusMedium,fontSize:e.typography.body2.fontSize,"& dt::after":{content:'":"'},"& dd":{margin:0,fontWeight:"bold"},paddingInline:e.spacing(2),paddingBlock:e.spacing(1.5),gap:e.spacing(1.5),margin:0,marginTop:e.spacing(2)})),Qz=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:e.spacing(.5),fontSize:e.typography.body2.fontSize})),C2t=()=>{var u;const e="lifecycle-",t={[`${e}project`]:ur},[n,r]=If("insights-lifecycle",t),o="lifecycle-trend-charts",s=((u=n[`${e}project`])==null?void 0:u.values)??[],{data:{lifecycleTrends:a},loading:l}=u2t(s),c=xl(l,`[data-loading="${o}"]`);return i.jsx(eI,{ref:c,title:"Flags lifecycle currently",filters:i.jsx(tI,{state:n,onChange:r,filterNamePrefix:e}),children:i.jsx(h2t,{children:Object.entries(a).map(([d,p])=>i.jsxs(g2t,{children:[i.jsxs(y2t,{children:[i.jsxs(x2t,{children:[i.jsx(a2t,{"data-loading":o,value:p.totalFlags??0,threshold:1e3,precision:1}),i.jsx(ly,{"aria-hidden":"true",stage:{name:m2t[d]}})]}),i.jsxs("span",{children:["Flags in ",i.jsx(v2t,{children:d})]})]}),i.jsx("div",{children:i.jsx(w2t,{data:p,stage:d})}),i.jsxs(b2t,{children:[i.jsxs(Qz,{children:[i.jsx("dt",{children:"Median time for flags currently in stage"}),i.jsx("dd",{"data-loading":o,children:Zz(p.medianDaysInCurrentStage)})]}),i.jsxs(Qz,{children:[i.jsx("dt",{children:"Historical median time for flags in stage"}),i.jsx("dd",{"data-loading":o,children:Zz(p.medianDaysHistorically)})]})]})]},d))})})},Hb=n8(1e3,2),w2t=({stage:e,data:t})=>{const n=f2t(),r=[t.categories.experimental.flagsOlderThanWeek,t.categories.release.flagsOlderThanWeek,t.categories.permanent.flagsOlderThanWeek],o={experimental:t.categories.experimental.flagsOlderThanWeek+t.categories.experimental.newFlagsThisWeek,release:t.categories.release.flagsOlderThanWeek+t.categories.release.newFlagsThisWeek,permanent:t.categories.permanent.flagsOlderThanWeek+t.categories.permanent.newFlagsThisWeek},s=`Bar chart; the number of flags in the ${e} stage, separated by flag type. Experimental: ${o.experimental}, Release: ${o.release}, Other: ${o.permanent}`,a=`Flag counts are further separated into flags that have entered the stage within the last week (new) and flags that have been in the stage for more than a week (old). Experimental flags: ${t.categories.experimental.flagsOlderThanWeek} old, ${t.categories.experimental.newFlagsThisWeek} new. Release flags: ${t.categories.release.flagsOlderThanWeek} old, ${t.categories.release.newFlagsThisWeek} new. Other flags: ${t.categories.permanent.flagsOlderThanWeek} old, ${t.categories.permanent.newFlagsThisWeek} new.`;return i.jsx(i2t,{ariaLabel:s,ariaDescription:a,data:{labels:["Experimental","Release","Other flags"],datasets:[{label:"Flags > 1 week old",data:r,stack:"1",backgroundColor:n.olderThanWeek,borderRadius:4,datalabels:{labels:{value:{formatter:(l,c)=>{var u,d;return(d=(u=c.chart.legend)==null?void 0:u.legendItems)!=null&&d[1].hidden?Hb(l):""}}}}},{label:"New flags this week",data:[t.categories.experimental.newFlagsThisWeek,t.categories.release.newFlagsThisWeek,t.categories.permanent.newFlagsThisWeek],stack:"1",backgroundColor:n.newThisWeek,borderRadius:4,datalabels:{labels:{value:{formatter:(l,c)=>{var u,d;return(d=(u=c.chart.legend)==null?void 0:u.legendItems)!=null&&d[0].hidden?Hb(l):Hb(l+r[c.dataIndex])}}}}}]}})},S2t=v(Si)(({theme:e})=>({marginRight:e.spacing(.4)})),j2t=(e,t,{selected:n})=>{const{key:r,...o}=e;return i.jsxs("li",{...o,children:[i.jsx(S2t,{icon:i.jsx(m0,{fontSize:"small"}),checkedIcon:i.jsx(y0,{fontSize:"small"}),checked:n}),t.label]},r)},pa={label:"ALL",id:"*"};function E2t(e,t){const n=[];return e.forEach((r,o)=>{r===t&&n.push(o)}),n}const rYt=g.forwardRef(({limitTags:e,selectedProjects:t,onChange:n,dataTestId:r,sx:o,disabled:s,...a},l)=>{const{projects:c}=Zr(),u=c.map(({name:h})=>h),d=[pa,...c.map(({name:h,id:m})=>({label:E2t(u,h).length>1?`${h} - (${m})`:h,id:m}))],p=t&&(t.length===0||t.length===1&&t[0]==="*"),f=(h,m,y)=>{const b=m;return y==="clear"||b===null?n([pa.id]):Array.isArray(b)?b.length===0?n([pa.id]):b.find(({id:x})=>x===pa.id)!==void 0?n([pa.id]):n(b.map(({id:x})=>x)):b.id===pa.id?n([pa.id]):n([b.id])};return i.jsx(Zl,{...a,ref:l,disablePortal:!0,id:"projects",limitTags:e,multiple:!p,options:d,sx:o,renderInput:h=>i.jsx(xn,{...h,label:"Projects"}),renderOption:j2t,getOptionLabel:({label:h})=>h,disableCloseOnSelect:!0,size:"small",disabled:s,value:p?pa:d.filter(({id:h})=>t.includes(h)),onChange:f,"data-testid":r||"PROJECT_SELECT",renderTags:(h,m)=>{const y=h.length;return i.jsxs(i.Fragment,{children:[h.slice(0,e).map((b,x)=>g.createElement(Ti,{...m({index:x}),size:"small",key:x,label:b.label})),y>e&&` +${y-e}`]})}})}),k2t=(e,t)=>Abe({start:bi(e),end:bi(t)},{weekStartsOn:1}).map(n=>({week:Jo(n,"RRRR-II"),date:Gu(Owe(n,{weekStartsOn:1})).toISOString()})),Aoe=(e="",t="",n)=>{const r=yt(`api/admin/insights?from=${e}&to=${t}`),{data:o,error:s}=On(r,T2t,n),a=g.useCallback(()=>{Fo(r).catch(console.warn)},[r]),l=k2t(e,t);return{insights:o?{...o,labels:l}:{labels:l,userTrends:[],flagTrends:[],projectFlagTrends:[],metricsSummaryTrends:[],environmentTypeTrends:[],lifecycleTrends:[],creationArchiveTrends:[]},refetchInsights:a,loading:!s&&!o,error:s}},T2t=e=>fetch(e).then(en("Executive Dashboard Data")).then(t=>t.json()),Ru=({title:e,tooltip:t})=>i.jsxs(J,{variant:"h3",sx:n=>({display:"flex",alignItems:"center",gap:n.spacing(.5)}),children:[e,i.jsx(te,{condition:!!t,show:i.jsx(Zo,{htmlTooltip:!0,tooltip:t,children:i.jsx(yi,{})})})]});/*!
453
+ - **Resilience:** Unleash Edge is designed to survive restarts and operate properly even if you lose connection to your Unleash server.`},Lmt=()=>{const{displayName:e,description:t,documentationUrl:n}=Kz;return i.jsx(eo,{title:`${e}`,description:t||"",documentationLink:n,documentationLinkLabel:"Unleash Edge documentation",children:i.jsxs(Omt,{children:[i.jsx(oP,{provider:Kz,title:"Why would you need Edge?"}),i.jsx($mt,{children:i.jsxs(Dmt,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash-edge#readme",children:["View Unleash Edge on GitHub"," ",i.jsx(w7,{fontSize:"inherit",sx:{verticalAlign:"middle",marginBottom:"2px"}})]})}),i.jsx(pr,{sx:r=>({marginTop:r.spacing(2),marginBottom:r.spacing(2)})}),i.jsx("iframe",{src:"https://www.youtube-nocookie.com/embed/6uIdF-yByWs?si=rPzsFCM_2IheaTUo",title:"YouTube video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,style:{width:"100%",aspectRatio:"16/9"}}),i.jsxs(Mmt,{children:[i.jsxs("section",{children:[i.jsx(Db,{variant:"h3",children:"Modes"}),i.jsxs(J,{variant:"body1",children:["Edge currently supports 2 different modes:"," ",i.jsxs("ul",{children:[i.jsxs("li",{children:[i.jsx("a",{href:"https://docs.getunleash.io/unleash-edge#edge",target:"_blank",rel:"noopener noreferrer",children:"Edge"})," ","Edge – Connection to upstream node (Unleash instance or another Edge). Supports dynamic tokens, metrics and other advanced features;"]}),i.jsxs("li",{children:[i.jsx("a",{href:"https://docs.getunleash.io/unleash-edge#offline",target:"_blank",rel:"noopener noreferrer",children:"Offline"})," ","– No connection to upstream node. Full control of data and tokens;"]})]})]})]}),i.jsxs("section",{children:[i.jsx(Db,{variant:"h3",children:"Edge"}),i.jsx(J,{variant:"body1",children:'Edge mode is the "standard" mode for Unleash Edge and the one you should default to in most cases. It connects to an upstream node, such as your Unleash instance, and uses that as the source of truth for feature flags.'}),i.jsxs(Lb,{children:[i.jsx("img",{src:Do(Pmt),alt:"test"}),i.jsx(Nb,{children:"Edge mode"})]}),i.jsx(J,{children:"Other than connecting Edge directly to your Unleash instance, it's also possible to connect to another Edge instance (daisy chaining). You can have as many Edge nodes as you'd like between the Edge node your clients are accessing and the Unleash server, and it's also possible for multiple nodes to connect to a single upstream one."}),i.jsxs(Lb,{children:[i.jsx("img",{src:Do(Imt),alt:"test"}),i.jsx(Nb,{children:"Edge daisy chaining"})]})]}),i.jsxs("section",{children:[i.jsx(Db,{variant:"h3",children:"Offline"}),i.jsx(J,{children:"Offline mode is useful when there is no connection to an upstream node, such as your Unleash instance or another Edge instance, or as a tool to make working with Unleash easier during development."}),i.jsxs(Lb,{children:[i.jsx("img",{src:Do(_mt),alt:"test"}),i.jsx(Nb,{children:"Edge offline"})]})]})]})]})})},Nmt=()=>{const{providerId:e}=YE();return e==="jira"?i.jsx(cYe,{}):e==="edge"?i.jsx(Lmt,{}):i.jsx(J_,{})},Fmt=v(ft)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Bmt=(e,t)=>{const n=t!==0?", ":"",r=e.project,o=e.project!=="*"?i.jsx(Fmt,{to:`/projects/${e.project}`,children:e.project},r):i.jsx("span",{children:e.project},r),s=` (${e.environments.join(", ")})`;return[n,o,s]},zmt=({usage:e})=>{const t=Bt(),n=e==null?void 0:e.flatMap((r,o)=>Bmt(r,o));return i.jsx(vn,{children:i.jsx(te,{condition:e!==void 0&&e.length>0,show:i.jsx(J,{variant:"body2",children:n}),elseShow:i.jsx(J,{variant:"body2",color:t.palette.text.secondary,children:"not connected"})})})},Hmt=25,Wmt=e=>`api/admin/projects/${e}/applications?`,Vmt=see({applications:[],total:0}),nYt=(e,t)=>Vmt(e,Wmt(t)),Eoe=v("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(9,0,9,0),minHeight:"150px"})),Umt=e=>typeof e=="string"&&e.length>0?Gmt(e):i.jsxs(Eoe,{children:["You don't have have any connected applications. To connect your application to Unleash you will require a"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/docs/sdks/",children:"Client SDK"}),".",i.jsx("br",{}),"You can read more about how to use Unleash in your application in the"," ",i.jsx(Sn,{href:"https://docs.getunleash.io/docs/sdks/",children:"documentation."})]}),Gmt=e=>i.jsxs(Eoe,{children:['No application found matching "',e,'"']}),Fb=_R(),qmt=()=>{const e={offset:Hr(C4,0),limit:Hr(C4,Hmt),query:ei,sortBy:Hr(ei,"appName"),sortOrder:Hr(ei,"asc")},[t,n]=If("applications-table",e),{applications:r,total:o,loading:s}=iee(gA($g(e,t),b=>b?`${b}`:void 0)),a=g.useMemo(()=>[Fb.accessor("icon",{id:"Icon",header:()=>"",cell:({row:{original:{icon:b}}})=>i.jsx(J7,{icon:i.jsx(N5,{children:i.jsx(Ta,{children:b||"apps"})})}),enableSorting:!1}),Fb.accessor("appName",{header:"Name",meta:{width:"50%"},cell:({row:{original:{appName:b,description:x}}})=>i.jsx(Yl,{title:b,to:`/applications/${encodeURIComponent(b)}`,subtitle:x})}),Fb.accessor("usage",{header:"Project(environment)",meta:{width:"50%"},enableSorting:!1,cell:({row:{original:b}})=>i.jsx(zmt,{usage:b.usage})})],[]),l=$R(hA(t,n,{columns:a,data:r})),{offset:c,limit:u,query:d,sortBy:p,sortOrder:f,...h}=t,m=(b="")=>{n({query:b})},y=xl(s);return i.jsx(i.Fragment,{children:i.jsx(ir,{bodyClass:"no-padding",header:i.jsx($n,{title:`Applications (${o})`,actions:i.jsx(No,{initialValue:d||"",onChange:m})}),children:i.jsx("div",{className:Wh.fullwidth,children:i.jsx(te,{condition:r.length>0||s,show:i.jsx(Ai,{value:d||"",children:i.jsx("div",{ref:y,children:i.jsx(zR,{tableInstance:l,totalItems:o})})}),elseShow:Umt(d)})})})})},Bb=()=>{const e=jo(),t=$t();return g.useEffect(()=>{t(`/integrations${e.pathname.replace("/addons","")}`)},[e.pathname,t]),i.jsxs(ir,{children:["Addons where renamed to"," ",i.jsx(ft,{to:"/integrations",children:"/integrations"})]})},koe=e=>{const t=`unleash-userSubmittedFeedback:${e}`,{value:n,setValue:r}=td(t,!1);return{hasSubmittedFeedback:n,setHasSubmittedFeedback:r}},Toe=g.createContext(void 0),Roe=()=>{const e=g.useContext(Toe);if(!e)throw new Error("useFeedbackContext must be used within a FeedbackProvider");return e},Z_=(e,t,n="")=>{const r=Roe(),{hasSubmittedFeedback:o}=koe(e);return{...r,hasSubmittedFeedback:o,openFeedback:s=>{r.openFeedback({...s,category:e},t,n)}}};var Q_={},Ymt=je;Object.defineProperty(Q_,"__esModule",{value:!0});var t8=Q_.default=void 0,Kmt=Ymt(Ee()),Xz=i,Xmt=(0,Kmt.default)([(0,Xz.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17L4 17.17V4h16v12z"},"0"),(0,Xz.jsx)("path",{d:"m12 15 1.57-3.43L17 10l-3.43-1.57L12 5l-1.57 3.43L7 10l3.43 1.57z"},"1")],"ReviewsOutlined");t8=Q_.default=Xmt;const Jmt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("md")]:{flexDirection:"column",gap:e.spacing(1)}})),Zmt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),Qmt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),[e.breakpoints.down("md")]:{width:"100%"}})),e2t=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-end",gap:e.spacing(1),marginTop:e.spacing(2)})),t2t=({actions:e})=>{const t=Er("showInactiveUsers"),n="Analytics",r=Bt(),o=Nn(r.breakpoints.down("md")),{openFeedback:s}=Z_("insights","automatic",t?"withInactiveUsers":"withoutInactiveUsers"),a=()=>{s({title:"How easy was it to use insights?",positiveLabel:"What do you like most about insights?",areasForImprovementsLabel:"What should be improved in insights?"})};return i.jsxs(i.Fragment,{children:[i.jsx($n,{title:n,titleElement:i.jsx(J,{variant:"h1",component:"span",sx:l=>({display:"flex",alignItems:"center",gap:l.spacing(1)}),children:n}),actions:i.jsxs(Jmt,{children:[i.jsx(te,{condition:!o,show:i.jsx(Qmt,{children:e})}),i.jsx(Zmt,{children:i.jsx($e,{startIcon:i.jsx(t8,{}),variant:"outlined",onClick:a,children:"Provide feedback"})})]})}),i.jsx(te,{condition:o,show:i.jsx(e2t,{children:e})})]})},n2t=v(K)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),Tu=v(qr)(({theme:e})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,boxShadow:"none",display:"flex",flexWrap:"wrap",[e.breakpoints.up("md")]:{flexDirection:"row",flexWrap:"nowrap"}})),Jz=v(K)(({theme:e})=>({padding:e.spacing(3),width:"100%"})),D1=v(K)(({theme:e,width:t=300,padding:n=3})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(n),minWidth:"100%",[e.breakpoints.up("md")]:{minWidth:`${t}px`,borderRight:`1px solid ${e.palette.background.application}`}})),Hd=v(K)(({theme:e})=>({position:"relative",minWidth:0,flexGrow:1,margin:"auto 0",padding:e.spacing(3)})),r2t=v(J)(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(.5),color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.body2.fontWeight})),o2t=v("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),s2t=v("div")(({theme:e})=>({position:"sticky",top:0,zIndex:e.zIndex.sticky,paddingBlock:e.spacing(2),background:e.palette.background.application,transition:"padding 0.3s ease",display:"flex",justifyContent:"space-between",alignItems:"center",flexFlow:"row wrap",rowGap:e.spacing(2)})),eI=g.forwardRef(({title:e,children:t,filters:n},r)=>i.jsxs(o2t,{ref:r,children:[i.jsxs(s2t,{children:[i.jsx(J,{variant:"h2",children:e}),n]}),t]})),i2t=g.lazy(()=>La(()=>import("./LifecycleChartComponent-DgMY7X0Z.js"),[])),n8=(e=1e6,t=2)=>n=>n<e?n.toLocaleString():Wte(n,{precision:t}),a2t=({value:e,threshold:t=1e6,precision:n=2,"data-loading":r})=>{const o=n8(t,n)(e),s=e>t,a=i.jsx("span",{"data-loading":r,"data-testid":qje,children:o});return i.jsx(te,{condition:s,show:i.jsx(Rt,{title:e.toLocaleString(),arrow:!0,children:a}),elseShow:a})},l2t=n8(1e3,2),Zz=e=>{if(e<=0)return"No data";if(e<1)return"<1 day";const t=Math.round(e);return t===1?"1 day":`${l2t(t)} days`},zb={categories:{experimental:{flagsOlderThanWeek:0,newFlagsThisWeek:0},permanent:{flagsOlderThanWeek:0,newFlagsThisWeek:0},release:{flagsOlderThanWeek:0,newFlagsThisWeek:0}},medianDaysHistorically:0,medianDaysInCurrentStage:0,totalFlags:0},c2t={lifecycleTrends:{cleanup:zb,develop:zb,production:zb}},u2t=(e,t)=>{const n=yt(`api/admin/insights/lifecycle?projects=${e==null?void 0:e.join(",")}`),{data:r,error:o}=On(n,d2t,t),s=g.useCallback(()=>{Fo(n).catch(console.warn)},[n]);return{data:r||c2t,refetchInsights:s,loading:!o&&!r,error:o}},d2t=e=>fetch(e).then(en("Lifecycle Insights data")).then(t=>t.json()),p2t=v(fA)({padding:0}),tI=({filterNamePrefix:e,state:t,...n})=>{const{projects:r}=Zr(),[o,s]=g.useState([]);return g.useEffect(()=>{const a=(r||[]).map(d=>({label:d.name,value:d.id})),l=a.length>1,c=e??"",u=[{label:"Date From",icon:"today",options:[],filterKey:`${c}from`,dateOperators:["IS"],fromFilterKey:`${c}from`,toFilterKey:`${c}to`,persistent:!0},{label:"Date To",icon:"today",options:[],filterKey:`${c}to`,dateOperators:["IS"],fromFilterKey:`${c}from`,toFilterKey:`${c}to`,persistent:!0},...l?[{label:"Project",icon:"topic",options:a,filterKey:`${c}project`,singularOperators:["IS"],pluralOperators:["IS_ANY_OF"]}]:[]].filter(({filterKey:d})=>d in t);s(u)},[JSON.stringify(r)]),i.jsx(p2t,{...n,state:t,availableFilters:o})},f2t=()=>{const e=Bt();return{olderThanWeek:e.palette.charts.A2,newThisWeek:e.palette.charts.A1}},h2t=v("div")(({theme:e})=>({display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(auto-fit, minmax(380px, 1fr))"})),g2t=v("article")(({theme:e})=>({background:e.palette.background.default,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),minWidth:0,".skeleton":{"&::after":{"--base-color":e.palette.neutral.border,"--initial":"rgb(from var(--base-color) r g b / 0)","--middle":"rgb(from var(--base-color) r g b / 0.2)","--peak":"rgb(from var(--base-color) r g b / 0.5)",background:"linear-gradient(90deg, var(--initial) 0, var(--middle) 50%, var(--peak) 100%, var(--initial))"}}})),m2t={develop:"pre-live",production:"live",cleanup:"completed"},y2t=v("h3")(({theme:e})=>({margin:0,fontSize:e.typography.body1.fontSize,fontWeight:"normal",padding:e.spacing(1),marginBottom:e.spacing(3)})),x2t=v("span")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",alignItems:"center",gap:e.spacing(2),fontSize:e.typography.h1.fontSize,fontWeight:"bold"})),v2t=v("span")({textTransform:"capitalize"}),b2t=v("dl")(({theme:e})=>({background:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusMedium,fontSize:e.typography.body2.fontSize,"& dt::after":{content:'":"'},"& dd":{margin:0,fontWeight:"bold"},paddingInline:e.spacing(2),paddingBlock:e.spacing(1.5),gap:e.spacing(1.5),margin:0,marginTop:e.spacing(2)})),Qz=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:e.spacing(.5),fontSize:e.typography.body2.fontSize})),C2t=()=>{var u;const e="lifecycle-",t={[`${e}project`]:ur},[n,r]=If("insights-lifecycle",t),o="lifecycle-trend-charts",s=((u=n[`${e}project`])==null?void 0:u.values)??[],{data:{lifecycleTrends:a},loading:l}=u2t(s),c=xl(l,`[data-loading="${o}"]`);return i.jsx(eI,{ref:c,title:"Flags lifecycle currently",filters:i.jsx(tI,{state:n,onChange:r,filterNamePrefix:e}),children:i.jsx(h2t,{children:Object.entries(a).map(([d,p])=>i.jsxs(g2t,{children:[i.jsxs(y2t,{children:[i.jsxs(x2t,{children:[i.jsx(a2t,{"data-loading":o,value:p.totalFlags??0,threshold:1e3,precision:1}),i.jsx(ly,{"aria-hidden":"true",stage:{name:m2t[d]}})]}),i.jsxs("span",{children:["Flags in ",i.jsx(v2t,{children:d})]})]}),i.jsx("div",{children:i.jsx(w2t,{data:p,stage:d})}),i.jsxs(b2t,{children:[i.jsxs(Qz,{children:[i.jsx("dt",{children:"Median time for flags currently in stage"}),i.jsx("dd",{"data-loading":o,children:Zz(p.medianDaysInCurrentStage)})]}),i.jsxs(Qz,{children:[i.jsx("dt",{children:"Historical median time for flags in stage"}),i.jsx("dd",{"data-loading":o,children:Zz(p.medianDaysHistorically)})]})]})]},d))})})},Hb=n8(1e3,2),w2t=({stage:e,data:t})=>{const n=f2t(),r=[t.categories.experimental.flagsOlderThanWeek,t.categories.release.flagsOlderThanWeek,t.categories.permanent.flagsOlderThanWeek],o={experimental:t.categories.experimental.flagsOlderThanWeek+t.categories.experimental.newFlagsThisWeek,release:t.categories.release.flagsOlderThanWeek+t.categories.release.newFlagsThisWeek,permanent:t.categories.permanent.flagsOlderThanWeek+t.categories.permanent.newFlagsThisWeek},s=`Bar chart; the number of flags in the ${e} stage, separated by flag type. Experimental: ${o.experimental}, Release: ${o.release}, Other: ${o.permanent}`,a=`Flag counts are further separated into flags that have entered the stage within the last week (new) and flags that have been in the stage for more than a week (old). Experimental flags: ${t.categories.experimental.flagsOlderThanWeek} old, ${t.categories.experimental.newFlagsThisWeek} new. Release flags: ${t.categories.release.flagsOlderThanWeek} old, ${t.categories.release.newFlagsThisWeek} new. Other flags: ${t.categories.permanent.flagsOlderThanWeek} old, ${t.categories.permanent.newFlagsThisWeek} new.`;return i.jsx(i2t,{ariaLabel:s,ariaDescription:a,data:{labels:["Experimental","Release","Other flags"],datasets:[{label:"Flags > 1 week old",data:r,stack:"1",backgroundColor:n.olderThanWeek,borderRadius:4,datalabels:{labels:{value:{formatter:(l,c)=>{var u,d;return(d=(u=c.chart.legend)==null?void 0:u.legendItems)!=null&&d[1].hidden?Hb(l):""}}}}},{label:"New flags this week",data:[t.categories.experimental.newFlagsThisWeek,t.categories.release.newFlagsThisWeek,t.categories.permanent.newFlagsThisWeek],stack:"1",backgroundColor:n.newThisWeek,borderRadius:4,datalabels:{labels:{value:{formatter:(l,c)=>{var u,d;return(d=(u=c.chart.legend)==null?void 0:u.legendItems)!=null&&d[0].hidden?Hb(l):Hb(l+r[c.dataIndex])}}}}}]}})},S2t=v(Si)(({theme:e})=>({marginRight:e.spacing(.4)})),j2t=(e,t,{selected:n})=>{const{key:r,...o}=e;return i.jsxs("li",{...o,children:[i.jsx(S2t,{icon:i.jsx(m0,{fontSize:"small"}),checkedIcon:i.jsx(y0,{fontSize:"small"}),checked:n}),t.label]},r)},pa={label:"ALL",id:"*"};function E2t(e,t){const n=[];return e.forEach((r,o)=>{r===t&&n.push(o)}),n}const rYt=g.forwardRef(({limitTags:e,selectedProjects:t,onChange:n,dataTestId:r,sx:o,disabled:s,...a},l)=>{const{projects:c}=Zr(),u=c.map(({name:h})=>h),d=[pa,...c.map(({name:h,id:m})=>({label:E2t(u,h).length>1?`${h} - (${m})`:h,id:m}))],p=t&&(t.length===0||t.length===1&&t[0]==="*"),f=(h,m,y)=>{const b=m;return y==="clear"||b===null?n([pa.id]):Array.isArray(b)?b.length===0?n([pa.id]):b.find(({id:x})=>x===pa.id)!==void 0?n([pa.id]):n(b.map(({id:x})=>x)):b.id===pa.id?n([pa.id]):n([b.id])};return i.jsx(Zl,{...a,ref:l,disablePortal:!0,id:"projects",limitTags:e,multiple:!p,options:d,sx:o,renderInput:h=>i.jsx(xn,{...h,label:"Projects"}),renderOption:j2t,getOptionLabel:({label:h})=>h,disableCloseOnSelect:!0,size:"small",disabled:s,value:p?pa:d.filter(({id:h})=>t.includes(h)),onChange:f,"data-testid":r||"PROJECT_SELECT",renderTags:(h,m)=>{const y=h.length;return i.jsxs(i.Fragment,{children:[h.slice(0,e).map((b,x)=>g.createElement(Ti,{...m({index:x}),size:"small",key:x,label:b.label})),y>e&&` +${y-e}`]})}})}),k2t=(e,t)=>Abe({start:bi(e),end:bi(t)},{weekStartsOn:1}).map(n=>({week:Jo(n,"RRRR-II"),date:Gu(Owe(n,{weekStartsOn:1})).toISOString()})),Aoe=(e="",t="",n)=>{const r=yt(`api/admin/insights?from=${e}&to=${t}`),{data:o,error:s}=On(r,T2t,n),a=g.useCallback(()=>{Fo(r).catch(console.warn)},[r]),l=k2t(e,t);return{insights:o?{...o,labels:l}:{labels:l,userTrends:[],flagTrends:[],projectFlagTrends:[],metricsSummaryTrends:[],environmentTypeTrends:[],lifecycleTrends:[],creationArchiveTrends:[]},refetchInsights:a,loading:!s&&!o,error:s}},T2t=e=>fetch(e).then(en("Executive Dashboard Data")).then(t=>t.json()),Ru=({title:e,tooltip:t})=>i.jsxs(J,{variant:"h3",sx:n=>({display:"flex",alignItems:"center",gap:n.spacing(.5)}),children:[e,i.jsx(te,{condition:!!t,show:i.jsx(Zo,{htmlTooltip:!0,tooltip:t,children:i.jsx(yi,{})})})]});/*!
454
454
  * Chart.js v3.9.1
455
455
  * https://www.chartjs.org
456
456
  * (c) 2022 Chart.js Contributors
@@ -472,7 +472,7 @@ Unleash Edge offers two important features:
472
472
  * https://www.chartjs.org
473
473
  * (c) 2022 chartjs-adapter-date-fns Contributors
474
474
  * Released under the MIT license
475
- */const r4t={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};use._date.override({_id:"date-fns",formats:function(){return r4t},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=Ot(e):n==="string"&&(typeof t=="string"?e=cJ(e,t,new Date,this.options):e=bi(e,this.options)),J3(e)?e.getTime():null},format:function(e,t){return Jo(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Gk(e,t);case"second":return YX(e,t);case"minute":return Gg(e,t);case"hour":return WX(e,t);case"day":return zp(e,t);case"week":return qk(e,t);case"month":return Ug(e,t);case"quarter":return qX(e,t);case"year":return Yk(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return Xk(e,t);case"second":return XX(e,t);case"minute":return KX(e,t);case"hour":return Sbe(e,t);case"day":return Z3(e,t);case"week":return kbe(e,t);case"month":return U5(e,t);case"quarter":return Ebe(e,t);case"year":return Tbe(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Rwe(e);case"minute":return kwe(e);case"hour":return eS(e);case"day":return Gu(e);case"week":return Zs(e);case"isoWeek":return Zs(e,{weekStartsOn:+n});case"month":return M4(e);case"quarter":return Xw(e);case"year":return o3(e);default:return e}},endOf:function(e,t){switch(t){case"second":return Ibe(e);case"minute":return _be(e);case"hour":return Pbe(e);case"day":return O4(e);case"week":return JX(e);case"month":return n3(e);case"quarter":return Jw(e);case"year":return r3(e);default:return e}}});const ad=g.lazy(()=>La(()=>import("./LineChartComponent-BlhKm3cw.js"),[])),o4t=(e,t)=>n=>{const r=n.chart,{ctx:o,chartArea:s}=r;if(!s)return;const a=o.createLinearGradient(0,s.bottom,0,s.top);return a.addColorStop(0,e),a.addColorStop(1,t),a},Ey=o4t("rgba(129, 122, 254, 0)","rgba(129, 122, 254, 0.12)"),Jl=({title:e="Not enough data",description:t="Two or more weeks of data are needed to show a chart."})=>i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body1",component:"h4",sx:n=>({paddingBottom:n.spacing(1)}),children:e}),i.jsx(J,{variant:"body2",children:t})]}),ld=e=>{const{fill:t=!1,type:n="constant"}=e||{},r=Bt();return g.useMemo(()=>({labels:Array.from({length:15},(o,s)=>s+1).map(o=>new Date(Date.now()-(15-o)*7*24*60*60*1e3)),datasets:n==="double"?[{label:"Total flags",data:[43,66,55,65,62,72,75,73,80,65,62,61,69,70,77],borderColor:r.palette.primary.light,backgroundColor:r.palette.primary.light},{label:"Stale",data:[3,5,4,6,2,7,5,3,8,3,5,11,8,4,3],borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border}]:[{label:"",data:n==="rising"?[3,5,15,17,25,40,47,48,55,65,62,72,75,73,80]:[54,52,53,49,54,50,47,46,51,51,50,51,49,49,51],borderColor:r.palette.primary.light,backgroundColor:t?Ey:r.palette.primary.light,fill:t}]}),[r,t])},s4t=({flagTrends:e,isLoading:t})=>{const n=Bt(),r=!t&&e.length<2,o=ld({fill:!0,type:"double"}),s=g.useMemo(()=>({labels:e.map(a=>a.date),datasets:[{label:"Total flags",data:e.map(a=>a.total),borderColor:n.palette.primary.light,backgroundColor:n.palette.primary.light},{label:"Stale",data:e.map(a=>a.stale),borderColor:n.palette.warning.border,backgroundColor:n.palette.warning.border}]}),[n,e]);return i.jsx(ad,{data:r||t?o:s,cover:r?i.jsx(Jl,{}):t})},Ose=()=>{const{projects:e}=Zr(),n=Bt().palette.charts.series,r=g.useMemo(()=>e.sort((s,a)=>s.createdAt&&a.createdAt?new Date(s.createdAt).getTime()-new Date(a.createdAt).getTime():0).map(s=>s.id),[e]);return s=>{const a=r.indexOf(s);return n[a%n.length]}},i4t=e=>e.total?((e.stale+e.potentiallyStale)/e.total*100).toFixed(2):"0",ky=e=>{const t=Bt(),n=Ose(),{projects:r}=Zr(),o=new Map(r.map(a=>[a.id,a.name]));return g.useMemo(()=>({datasets:Object.entries(e).map(([l,c])=>{const u=n(l);return{label:o.get(l)||l,data:c,borderColor:u,backgroundColor:u,fill:!1}})}),[t,e])},a4t=({projectFlagTrends:e,isLoading:t})=>{const n=ld({type:"constant"}),r=ky(e),o=g.useMemo(()=>!t&&!r.datasets.some(s=>s.data.length>1),[r,t]);return i.jsx(ad,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"total",xAxisKey:"date"}},cover:o?i.jsx(Jl,{}):t})},l4t=v(qr)(({theme:e})=>({padding:e.spacing(2)})),c4t=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),nC=({iconChar:e,title:t,color:n})=>i.jsxs(J,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[i.jsx(J,{component:"span",children:e}),i.jsx("strong",{children:t})]}),u4t=({data:e})=>i.jsx(K,{display:"flex",flexDirection:"row",children:e.map(({key:t,value:n})=>i.jsxs("div",{style:{flex:1,flexDirection:"column"},children:[i.jsx("div",{style:{flex:1,textAlign:"center",marginBottom:"4px"},children:i.jsx(J,{variant:"body1",component:"p",children:t})}),i.jsx("div",{style:{flex:1,textAlign:"center"},children:n})]},t))}),d4t=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return i.jsx(K,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>i.jsxs(l4t,{elevation:3,children:[i.jsxs(c4t,{children:[i.jsxs(J,{variant:"body2",component:"span",children:[i.jsx(J,{sx:{color:r.color},component:"span",children:"● "}),i.jsx("strong",{children:r.title})]}),i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsx(nC,{iconChar:"▣ ",title:`Total requests: ${(r.value.totalRequests??0).toLocaleString()}`,color:"info"}),i.jsx(nC,{iconChar:"▲ ",title:`Exposed: ${(r.value.totalYes??0).toLocaleString()}`,color:"success"}),i.jsx(nC,{iconChar:"▼ ",title:`Not exposed: ${(r.value.totalNo??0).toLocaleString()}`,color:"error"}),i.jsx(te,{condition:!!r.value.totalApps&&!!r.value.totalEnvironments&&!!r.value.totalFlags,show:i.jsxs(i.Fragment,{children:[i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsx(u4t,{data:[{key:"Flags",value:r.value.totalFlags},{key:"Environments",value:r.value.totalEnvironments},{key:"Apps",value:r.value.totalApps}]})]})})]},`${r.title}-${o}`)))||null})};function p4t(e){return e.reduce((t,n)=>(t[n.date]||(t[n.date]={totalFlags:0,totalNo:0,totalRequests:0,totalYes:0}),t[n.date].totalFlags+=n.totalFlags,t[n.date].totalNo+=n.totalNo,t[n.date].totalRequests+=n.totalRequests,t[n.date].totalYes+=n.totalYes,t),{})}const f4t=e=>Jo(new Date(e),"yyyy-ww"),h4t=(e,t)=>{const n=Bt(),r=Ose();return g.useMemo(()=>({datasets:Object.entries(e).map(([a,l])=>{const c=new Map(l.map(p=>[p.date,p])),u=t.map(p=>c.get(p)||{date:p,totalRequests:0,totalNo:0,project:a,totalApps:0,totalYes:0,totalEnvironments:0,totalFlags:0,week:f4t(p)}),d=r(a);return{label:a,data:u,borderColor:d,backgroundColor:d,fill:!1}})}),[n,e,r])},g4t=({metricsSummaryTrends:e,isAggregate:t,allDatapointsSorted:n,isLoading:r})=>{const o=Bt(),s=h4t(e,n),a=g.useMemo(()=>!r&&!s.datasets.some(d=>d.data.length>1),[s,r]),l=ld(),c=g.useMemo(()=>{const d=p4t(Object.values(s.datasets).flatMap(f=>f.data));return{datasets:[{label:"Total Requests",data:Object.entries(d).map(([f,h])=>({date:f,...h})).sort((f,h)=>new Date(f.date).getTime()-new Date(h.date).getTime()),borderColor:o.palette.primary.light,backgroundColor:Ey,fill:!0,order:3}]}},[JSON.stringify(e),o]),u=t?c:s;return i.jsx(ad,{data:a||r?l:u,TooltipComponent:d4t,overrideOptions:a?{}:{parsing:{yAxisKey:"totalRequests",xAxisKey:"date"}},cover:a?i.jsx(Jl,{}):r})},m4t=v(K)(({theme:e,type:t,size:n="large"})=>{const r={default:e.palette.secondary.border,success:e.palette.success.border,warning:e.palette.warning.border,error:e.palette.error.border};return{borderRadius:e.shape.borderRadius,height:n==="large"?e.spacing(2):e.spacing(1),backgroundColor:r[t],marginBottom:e.spacing(.5)}}),Mse=({sections:e,size:t})=>i.jsx(K,{sx:n=>({display:"flex",gap:n.spacing(.5)}),children:e.map((n,r)=>n.value?i.jsx(m4t,{type:n.type,sx:{width:`${n.value}%`},size:t},`${n.type}-${r}`):null)}),y4t=e=>e>=50?"error":e>=25?"warning":"success",x4t=v(qr)(({theme:e})=>({padding:e.spacing(2)})),fW=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),v4t=e=>e==null?"info":y4t(e),b4t=({stale:e=0,potentiallyStale:t=0,total:n=0})=>{const r=n-e-t;return i.jsxs(i.Fragment,{children:[i.jsx(Mse,{sections:[{type:"error",value:e/n*100},{type:"warning",value:t/n*100},{type:"success",value:r/n*100}],size:"small"}),i.jsxs(J,{variant:"body2",component:"p",sx:o=>({marginTop:o.spacing(.5)}),children:[i.jsx(J,{component:"span",sx:o=>({color:o.palette.error.border}),children:"● "}),"Stale flags: ",e]}),i.jsxs(J,{variant:"body2",component:"p",children:[i.jsx(J,{component:"span",sx:o=>({color:o.palette.warning.border}),children:"● "}),"Potentially stale flags: ",t]}),i.jsxs(J,{variant:"body2",component:"p",children:[i.jsx(J,{component:"span",sx:o=>({color:o.palette.success.border}),children:"● "}),"Healthy flags: ",r]})]})},C4t=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return i.jsx(K,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>i.jsxs(x4t,{elevation:3,children:[i.jsxs(fW,{children:[i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:r.label}),i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:"Technical debt"})]}),i.jsxs(fW,{children:[i.jsxs(J,{variant:"body2",component:"span",children:[i.jsx(J,{sx:{color:r.color},component:"span",children:"● "}),i.jsx("strong",{children:r.title})]}),i.jsxs(an,{color:v4t(r.value.technicalDebt),children:[r.value.technicalDebt,"%"]})]})," ",i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsxs(J,{variant:"body2",component:"p",sx:s=>({marginBottom:s.spacing(.5)}),children:["Total flags: ",r.value.total]}),i.jsx(te,{condition:!!(r.value.stale||r.value.potentiallyStale),show:i.jsx(b4t,{...r.value})})]},`${r.title}-${o}`)))||null})},w4t=e=>((e.total-e.stale-e.potentiallyStale)/e.total*100).toFixed(2),S4t=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=ky(e),o=Bt(),s=ld(),a=g.useMemo(()=>({datasets:[{label:"Technical debt",data:Array.from(new Set(r.datasets.flatMap(f=>f.data.map(h=>h.week)))).map(f=>r.datasets.map(h=>h.data.find(m=>m.week===f)).reduce((h,m)=>(m&&(h.total+=m.total,h.stale+=m.stale,h.potentiallyStale+=m.potentiallyStale),h.date||(h.date=m==null?void 0:m.date),h),{total:0,stale:0,potentiallyStale:0,week:f})).sort((f,h)=>f.week>h.week?1:-1).map(f=>({health:f.total?w4t(f):void 0,technicalDebt:f.total?i4t(f):void 0,date:f.date,total:f.total,stale:f.stale,potentiallyStale:f.potentiallyStale})),borderColor:o.palette.primary.light,backgroundColor:Ey,fill:!0,order:3}]}),[r,o]),l=t?a:r,c=g.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?s:l;return i.jsx(ad,{data:u,TooltipComponent:C4t,overrideOptions:c?{}:{parsing:{yAxisKey:"technicalDebt",xAxisKey:"date"},plugins:{legend:{display:!t}},scales:{y:{min:0,max:100,beginAtZero:!0,type:"linear",grid:{color:o.palette.divider,borderColor:o.palette.divider},ticks:{color:o.palette.text.secondary,display:!0,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:o.palette.text.secondary,display:!0,source:"data",maxRotation:90,minRotation:23.5}}}},cover:c?i.jsx(Jl,{}):n},t?"aggregate":"project")},j4t=v(qr)(({theme:e})=>({padding:e.spacing(2)})),E4t=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),k4t=({iconChar:e,title:t,color:n})=>i.jsxs(J,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[i.jsx(J,{component:"span",children:e}),i.jsx("strong",{children:t})]}),T4t=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return i.jsx(K,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>i.jsxs(j4t,{elevation:3,children:[i.jsxs(E4t,{children:[i.jsxs(J,{variant:"body2",component:"span",children:[i.jsx(J,{sx:{color:r.color},component:"span",children:"● "}),i.jsx("strong",{children:r.title})]}),i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsx(k4t,{iconChar:"● ",title:`Total updates: ${r.value.totalUpdates}`,color:"info"})]},`${r.title}-${o}`)))||null})},R4t=e=>{if(!e.length)return{};const t={};for(const o of e)t[o.date]||(t[o.date]=[]),t[o.date].push(o);const n=Array.from(new Set(e.map(o=>o.environmentType))),r={};return Object.entries(t).forEach(([o,s])=>{const a=n.map(l=>{var u;const c=s.find(d=>d.environmentType===l);if(c)return c;{const d=((u=e.find(p=>p.date===o))==null?void 0:u.week)||"";return{date:o,environmentType:l,totalUpdates:0,week:d}}});r[o]=a}),r},A4t=()=>{const e=Bt();return t=>{switch(t){case"production":return e.palette.charts.series[3];case"staging":return e.palette.charts.series[1];case"development":return e.palette.charts.series[0];case"test":return e.palette.charts.series[2];default:return e.palette.charts.series[4]}}},P4t=({environmentTypeTrends:e,isLoading:t})=>{const n=Bt(),r=A4t(),o=!t&&(e==null?void 0:e.length)<2,s=ld({fill:!0,type:"double"}),a=g.useMemo(()=>{const l=R4t(e),c={};return Object.entries(l).forEach(([d,p])=>{p.forEach(f=>{c[f.environmentType]||(c[f.environmentType]=[]),c[f.environmentType].push(f)})}),{datasets:Object.entries(c).map(([d,p])=>{const f=r(d);return{label:d,data:p,borderColor:f,backgroundColor:f,fill:!1}})}},[n,e]);return i.jsx(ad,{data:o||t?s:a,overrideOptions:o?{}:{parsing:{yAxisKey:"totalUpdates",xAxisKey:"date"}},TooltipComponent:T4t,cover:o?i.jsx(Jl,{}):t})},_4t=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center"})),I4t=v(K)(({theme:e})=>({borderRadius:"50%",width:"200px",height:"200px",border:`10px solid ${e.palette.secondary.border}`,display:"flex",alignItems:"center",justifyContent:"center"})),O4t=v(K)(({theme:e})=>({borderRadius:"50%",width:"180px",height:"180px",backgroundColor:e.palette.secondary.light,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,border:`10px solid ${e.palette.background.paper}`}));v(K)(({theme:e})=>({marginTop:e.spacing(4),padding:e.spacing(1.5,2),background:e.palette.background.elevation2,borderRadius:`${e.shape.borderRadiusMedium}px`,display:"flex",alignItems:"center"}));v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(.5)}));v(K)(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start"}));v(J)(({theme:e})=>({marginLeft:"auto",fontSize:e.fontSizes.mainHeader}));v(Ta)(({theme:e})=>({color:e.palette.primary.main,width:"15px",height:"15px",marginRight:e.spacing(.5),fontSize:"15px!important"}));const M4t=v("div")({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}),hW=({count:e,isLoading:t})=>{const n=Yu(),r=Yu();return i.jsxs(i.Fragment,{children:[i.jsx(_4t,{children:i.jsx(I4t,{children:i.jsx(O4t,{"aria-labelledby":n,"aria-describedby":r,children:t?i.jsx(tc,{children:"Loading total flag count"}):e})})}),i.jsxs(M4t,{children:[i.jsx(J,{id:n,variant:"body2",children:"Total number of flags"}),i.jsx(Zo,{htmlTooltip:!0,tooltipId:r,tooltip:"This includes the four lifecycle stages define, develop, production, and cleanup",children:i.jsx(yi,{})})]})]})},$4t=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20",fill:"none",...e},g.createElement("path",{d:"M5 20V15H0V5H5V0H15V5H20V15H15V20H5ZM2 9H7C7.16667 9 7.325 9.04167 7.475 9.125C7.625 9.20833 7.74167 9.31667 7.825 9.45L8.7 10.75L10.05 6.7C10.1167 6.5 10.2375 6.33333 10.4125 6.2C10.5875 6.06667 10.7833 6 11 6C11.1667 6 11.325 6.04167 11.475 6.125C11.625 6.20833 11.7417 6.31667 11.825 6.45L13.525 9H18V7H13V2H7V7H2V9ZM7 18H13V13H18V11H13C12.8333 11 12.675 10.9583 12.525 10.875C12.375 10.7917 12.25 10.6833 12.15 10.55L11.3 9.25L9.95 13.3C9.88333 13.5 9.75833 13.6667 9.575 13.8C9.39167 13.9333 9.19167 14 8.975 14C8.80833 14 8.65 13.9583 8.5 13.875C8.35 13.7917 8.23333 13.6833 8.15 13.55L6.45 11H2V13H7V18Z",fill:"currentColor"})),D4t=v(K)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",height:"100%"})),Dm=v(K)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(.5,2,.5,2)})),L4t=v(Dm)(({theme:e})=>({flex:1,justifyContent:"flex-end",alignItems:"flex-end"})),N4t=v($4t)(({theme:e})=>({color:e.palette.primary.light,marginRight:e.spacing(1.5)})),Wv=v(K)(({theme:e})=>({display:"block",marginLeft:"auto",color:e.palette.primary.main,fontWeight:e.typography.fontWeightBold,fontSize:e.fontSizes.mediumHeader})),Tj=v("div")(({theme:e})=>({padding:e.spacing(3),fontSize:e.fontSizes.smallBody})),F4t=v(Tj)(({theme:e})=>({flexGrow:1,display:"flex",flexDirection:"column"})),B4t=v("div")(()=>({display:"flex",justifyContent:"space-between",alignItems:"center"})),z4t=v(Wv)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),H4t=({value:e,technicalDebt:t,healthy:n,stale:r,potentiallyStale:o,title:s})=>i.jsxs(D4t,{children:[i.jsx(B4t,{children:i.jsx(Tj,{children:s})}),i.jsx(pr,{}),i.jsx(Tj,{children:i.jsxs(Dm,{children:[i.jsx(N4t,{}),"Technical debt",i.jsx(z4t,{children:`${t}%`})]})}),i.jsx(pr,{}),i.jsxs(F4t,{children:[i.jsxs(Dm,{children:["Healthy flags",i.jsx(Wv,{children:n||0})]}),i.jsxs(Dm,{children:["Stale flags",i.jsx(Wv,{children:r||0})]}),i.jsxs(Dm,{children:["Potentially stale flags",i.jsx(Wv,{children:o||0})]}),i.jsx(L4t,{children:i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/insights#health",target:"_blank",rel:"noreferrer",children:"What affects technical debt?"})})]})]}),uv=(e,t)=>g.useMemo(()=>t.length<1||t[0]===pa.id?e:e.filter(r=>t.includes(r.project)),[e,t]);function W4t(e){if(!e||e.length===0||!("project"in e[0]))return{};const t={};return e.forEach(n=>{const{project:r}=n;t[r]||(t[r]=[]),t[r].push(n)}),t}const dv=e=>g.useMemo(()=>W4t(e),[JSON.stringify(e)]),V4t=e=>!!e&&typeof e.timeToProduction=="number"&&e.timeToProduction!==0,U4t=e=>g.useMemo(()=>{const t=e.reduce((u,d)=>d.week>u?d.week:u,""),n=e.filter(u=>u.week===t),r=n.reduce((u,d)=>u+(d.users||0),0)/n.length||0,o=n.reduce((u,d)=>({total:u.total+d.total,active:u.active+d.active,stale:u.stale+d.stale,potentiallyStale:u.potentiallyStale+d.potentiallyStale,averageUsers:r}),{total:0,active:0,stale:0,potentiallyStale:0}),s=n.filter(V4t).map(u=>u.timeToProduction);s.sort((u,d)=>u-d);const a=Math.floor(s.length/2),l=s.length%2===0?(s[a-1]+s[a])/2:s[a],c=Number.isNaN(l)?void 0:l;return{...o,averageUsers:r,averageHealth:o.total?(o.active/(o.total||1)*100).toFixed(0):"100",technicalDebt:o.total?((o.stale+o.potentiallyStale)/o.total*100).toFixed(0):"0",medianTimeToProduction:c}},[e]),G4t=e=>g.useMemo(()=>{const t=new Set;return e.forEach(n=>{t.add(n.date)}),Array.from(t).sort()},[e]),$se=(e,t)=>{const n=G4t(e.metricsSummaryTrends),r=uv(e.projectFlagTrends,t),o=dv(r),s=uv(e.metricsSummaryTrends,t),a=dv(s),l=U4t(r),c=uv(e.lifecycleTrends,t),u=dv(c),d=uv(e.creationArchiveTrends,t),p=dv(d);return g.useMemo(()=>({...e,projectsData:r,groupedProjectsData:o,metricsData:s,groupedMetricsData:a,environmentTypeTrends:e.environmentTypeTrends,summary:l,allMetricsDatapoints:n,lifecycleData:c,groupedLifecycleData:u,groupedCreationArchiveData:p}),[e,t,r,o,s,a,l,c,u,p])},q4t={lessThanXSeconds:{one:{regular:"méně než 1 sekunda",past:"před méně než 1 sekundou",future:"za méně než 1 sekundu"},few:{regular:"méně než {{count}} sekundy",past:"před méně než {{count}} sekundami",future:"za méně než {{count}} sekundy"},many:{regular:"méně než {{count}} sekund",past:"před méně než {{count}} sekundami",future:"za méně než {{count}} sekund"}},xSeconds:{one:{regular:"1 sekunda",past:"před 1 sekundou",future:"za 1 sekundu"},few:{regular:"{{count}} sekundy",past:"před {{count}} sekundami",future:"za {{count}} sekundy"},many:{regular:"{{count}} sekund",past:"před {{count}} sekundami",future:"za {{count}} sekund"}},halfAMinute:{type:"other",other:{regular:"půl minuty",past:"před půl minutou",future:"za půl minuty"}},lessThanXMinutes:{one:{regular:"méně než 1 minuta",past:"před méně než 1 minutou",future:"za méně než 1 minutu"},few:{regular:"méně než {{count}} minuty",past:"před méně než {{count}} minutami",future:"za méně než {{count}} minuty"},many:{regular:"méně než {{count}} minut",past:"před méně než {{count}} minutami",future:"za méně než {{count}} minut"}},xMinutes:{one:{regular:"1 minuta",past:"před 1 minutou",future:"za 1 minutu"},few:{regular:"{{count}} minuty",past:"před {{count}} minutami",future:"za {{count}} minuty"},many:{regular:"{{count}} minut",past:"před {{count}} minutami",future:"za {{count}} minut"}},aboutXHours:{one:{regular:"přibližně 1 hodina",past:"přibližně před 1 hodinou",future:"přibližně za 1 hodinu"},few:{regular:"přibližně {{count}} hodiny",past:"přibližně před {{count}} hodinami",future:"přibližně za {{count}} hodiny"},many:{regular:"přibližně {{count}} hodin",past:"přibližně před {{count}} hodinami",future:"přibližně za {{count}} hodin"}},xHours:{one:{regular:"1 hodina",past:"před 1 hodinou",future:"za 1 hodinu"},few:{regular:"{{count}} hodiny",past:"před {{count}} hodinami",future:"za {{count}} hodiny"},many:{regular:"{{count}} hodin",past:"před {{count}} hodinami",future:"za {{count}} hodin"}},xDays:{one:{regular:"1 den",past:"před 1 dnem",future:"za 1 den"},few:{regular:"{{count}} dny",past:"před {{count}} dny",future:"za {{count}} dny"},many:{regular:"{{count}} dní",past:"před {{count}} dny",future:"za {{count}} dní"}},aboutXWeeks:{one:{regular:"přibližně 1 týden",past:"přibližně před 1 týdnem",future:"přibližně za 1 týden"},few:{regular:"přibližně {{count}} týdny",past:"přibližně před {{count}} týdny",future:"přibližně za {{count}} týdny"},many:{regular:"přibližně {{count}} týdnů",past:"přibližně před {{count}} týdny",future:"přibližně za {{count}} týdnů"}},xWeeks:{one:{regular:"1 týden",past:"před 1 týdnem",future:"za 1 týden"},few:{regular:"{{count}} týdny",past:"před {{count}} týdny",future:"za {{count}} týdny"},many:{regular:"{{count}} týdnů",past:"před {{count}} týdny",future:"za {{count}} týdnů"}},aboutXMonths:{one:{regular:"přibližně 1 měsíc",past:"přibližně před 1 měsícem",future:"přibližně za 1 měsíc"},few:{regular:"přibližně {{count}} měsíce",past:"přibližně před {{count}} měsíci",future:"přibližně za {{count}} měsíce"},many:{regular:"přibližně {{count}} měsíců",past:"přibližně před {{count}} měsíci",future:"přibližně za {{count}} měsíců"}},xMonths:{one:{regular:"1 měsíc",past:"před 1 měsícem",future:"za 1 měsíc"},few:{regular:"{{count}} měsíce",past:"před {{count}} měsíci",future:"za {{count}} měsíce"},many:{regular:"{{count}} měsíců",past:"před {{count}} měsíci",future:"za {{count}} měsíců"}},aboutXYears:{one:{regular:"přibližně 1 rok",past:"přibližně před 1 rokem",future:"přibližně za 1 rok"},few:{regular:"přibližně {{count}} roky",past:"přibližně před {{count}} roky",future:"přibližně za {{count}} roky"},many:{regular:"přibližně {{count}} roků",past:"přibližně před {{count}} roky",future:"přibližně za {{count}} roků"}},xYears:{one:{regular:"1 rok",past:"před 1 rokem",future:"za 1 rok"},few:{regular:"{{count}} roky",past:"před {{count}} roky",future:"za {{count}} roky"},many:{regular:"{{count}} roků",past:"před {{count}} roky",future:"za {{count}} roků"}},overXYears:{one:{regular:"více než 1 rok",past:"před více než 1 rokem",future:"za více než 1 rok"},few:{regular:"více než {{count}} roky",past:"před více než {{count}} roky",future:"za více než {{count}} roky"},many:{regular:"více než {{count}} roků",past:"před více než {{count}} roky",future:"za více než {{count}} roků"}},almostXYears:{one:{regular:"skoro 1 rok",past:"skoro před 1 rokem",future:"skoro za 1 rok"},few:{regular:"skoro {{count}} roky",past:"skoro před {{count}} roky",future:"skoro za {{count}} roky"},many:{regular:"skoro {{count}} roků",past:"skoro před {{count}} roky",future:"skoro za {{count}} roků"}}},Y4t=(e,t,n)=>{let r;const o=q4t[e];o.type==="other"?r=o.other:t===1?r=o.one:t>1&&t<5?r=o.few:r=o.many;const s=(n==null?void 0:n.addSuffix)===!0,a=n==null?void 0:n.comparison;let l;return s&&a===-1?l=r.past:s&&a===1?l=r.future:l=r.regular,l.replace("{{count}}",String(t))},K4t={full:"EEEE, d. MMMM yyyy",long:"d. MMMM yyyy",medium:"d. M. yyyy",short:"dd.MM.yyyy"},X4t={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},J4t={full:"{{date}} 'v' {{time}}",long:"{{date}} 'v' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Z4t={date:nr({formats:K4t,defaultWidth:"full"}),time:nr({formats:X4t,defaultWidth:"full"}),dateTime:nr({formats:J4t,defaultWidth:"full"})},Q4t=["neděli","pondělí","úterý","středu","čtvrtek","pátek","sobotu"],e6t={lastWeek:"'poslední' eeee 've' p",yesterday:"'včera v' p",today:"'dnes v' p",tomorrow:"'zítra v' p",nextWeek:e=>{const t=e.getDay();return"'v "+Q4t[t]+" o' p"},other:"P"},t6t=(e,t)=>{const n=e6t[e];return typeof n=="function"?n(t):n},n6t={narrow:["př. n. l.","n. l."],abbreviated:["př. n. l.","n. l."],wide:["před naším letopočtem","našeho letopočtu"]},r6t={narrow:["1","2","3","4"],abbreviated:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"],wide:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"]},o6t={narrow:["L","Ú","B","D","K","Č","Č","S","Z","Ř","L","P"],abbreviated:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],wide:["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"]},s6t={narrow:["L","Ú","B","D","K","Č","Č","S","Z","Ř","L","P"],abbreviated:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],wide:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"]},i6t={narrow:["ne","po","út","st","čt","pá","so"],short:["ne","po","út","st","čt","pá","so"],abbreviated:["ned","pon","úte","stř","čtv","pát","sob"],wide:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"]},a6t={narrow:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},abbreviated:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},wide:{am:"dopoledne",pm:"odpoledne",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"}},l6t={narrow:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},abbreviated:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},wide:{am:"dopoledne",pm:"odpoledne",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"}},c6t=(e,t)=>Number(e)+".",u6t={ordinalNumber:c6t,era:bn({values:n6t,defaultWidth:"wide"}),quarter:bn({values:r6t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:o6t,defaultWidth:"wide",formattingValues:s6t,defaultFormattingWidth:"wide"}),day:bn({values:i6t,defaultWidth:"wide"}),dayPeriod:bn({values:a6t,defaultWidth:"wide",formattingValues:l6t,defaultFormattingWidth:"wide"})},d6t=/^(\d+)\.?/i,p6t=/\d+/i,f6t={narrow:/^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,abbreviated:/^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,wide:/^(p[řr](\.|ed) Kristem|p[řr](\.|ed) na[šs][íi]m letopo[čc]tem|po Kristu|na[šs]eho letopo[čc]tu)/i},h6t={any:[/^p[řr]/i,/^(po|n)/i]},g6t={narrow:/^[1234]/i,abbreviated:/^[1234]\. [čc]tvrtlet[íi]/i,wide:/^[1234]\. [čc]tvrtlet[íi]/i},m6t={any:[/1/i,/2/i,/3/i,/4/i]},y6t={narrow:/^[lúubdkčcszřrlp]/i,abbreviated:/^(led|[úu]no|b[řr]e|dub|kv[ěe]|[čc]vn|[čc]vc|srp|z[áa][řr]|[řr][íi]j|lis|pro)/i,wide:/^(leden|ledna|[úu]nora?|b[řr]ezen|b[řr]ezna|duben|dubna|kv[ěe]ten|kv[ěe]tna|[čc]erven(ec|ce)?|[čc]ervna|srpen|srpna|z[áa][řr][íi]|[řr][íi]jen|[řr][íi]jna|listopad(a|u)?|prosinec|prosince)/i},x6t={narrow:[/^l/i,/^[úu]/i,/^b/i,/^d/i,/^k/i,/^[čc]/i,/^[čc]/i,/^s/i,/^z/i,/^[řr]/i,/^l/i,/^p/i],any:[/^led/i,/^[úu]n/i,/^b[řr]e/i,/^dub/i,/^kv[ěe]/i,/^[čc]vn|[čc]erven(?!\w)|[čc]ervna/i,/^[čc]vc|[čc]erven(ec|ce)/i,/^srp/i,/^z[áa][řr]/i,/^[řr][íi]j/i,/^lis/i,/^pro/i]},v6t={narrow:/^[npuúsčps]/i,short:/^(ne|po|[úu]t|st|[čc]t|p[áa]|so)/i,abbreviated:/^(ned|pon|[úu]te|st[rř]|[čc]tv|p[áa]t|sob)/i,wide:/^(ned[ěe]le|pond[ěe]l[íi]|[úu]ter[ýy]|st[řr]eda|[čc]tvrtek|p[áa]tek|sobota)/i},b6t={narrow:[/^n/i,/^p/i,/^[úu]/i,/^s/i,/^[čc]/i,/^p/i,/^s/i],any:[/^ne/i,/^po/i,/^[úu]t/i,/^st/i,/^[čc]t/i,/^p[áa]/i,/^so/i]},C6t={any:/^dopoledne|dop\.?|odpoledne|odp\.?|p[ůu]lnoc|poledne|r[áa]no|odpoledne|ve[čc]er|(v )?noci?/i},w6t={any:{am:/^dop/i,pm:/^odp/i,midnight:/^p[ůu]lnoc/i,noon:/^poledne/i,morning:/r[áa]no/i,afternoon:/odpoledne/i,evening:/ve[čc]er/i,night:/noc/i}},S6t={ordinalNumber:Qu({matchPattern:d6t,parsePattern:p6t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:f6t,defaultMatchWidth:"wide",parsePatterns:h6t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:g6t,defaultMatchWidth:"wide",parsePatterns:m6t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:y6t,defaultMatchWidth:"wide",parsePatterns:x6t,defaultParseWidth:"any"}),day:Cn({matchPatterns:v6t,defaultMatchWidth:"wide",parsePatterns:b6t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:C6t,defaultMatchWidth:"any",parsePatterns:w6t,defaultParseWidth:"any"})},j6t={code:"cs",formatDistance:Y4t,formatLong:Z4t,formatRelative:t6t,localize:u6t,match:S6t,options:{weekStartsOn:1,firstWeekContainsDate:4}},E6t={lessThanXSeconds:{one:"mindre end ét sekund",other:"mindre end {{count}} sekunder"},xSeconds:{one:"1 sekund",other:"{{count}} sekunder"},halfAMinute:"ét halvt minut",lessThanXMinutes:{one:"mindre end ét minut",other:"mindre end {{count}} minutter"},xMinutes:{one:"1 minut",other:"{{count}} minutter"},aboutXHours:{one:"cirka 1 time",other:"cirka {{count}} timer"},xHours:{one:"1 time",other:"{{count}} timer"},xDays:{one:"1 dag",other:"{{count}} dage"},aboutXWeeks:{one:"cirka 1 uge",other:"cirka {{count}} uger"},xWeeks:{one:"1 uge",other:"{{count}} uger"},aboutXMonths:{one:"cirka 1 måned",other:"cirka {{count}} måneder"},xMonths:{one:"1 måned",other:"{{count}} måneder"},aboutXYears:{one:"cirka 1 år",other:"cirka {{count}} år"},xYears:{one:"1 år",other:"{{count}} år"},overXYears:{one:"over 1 år",other:"over {{count}} år"},almostXYears:{one:"næsten 1 år",other:"næsten {{count}} år"}},k6t=(e,t,n)=>{let r;const o=E6t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"om "+r:r+" siden":r},T6t={full:"EEEE 'den' d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd/MM/y"},R6t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},A6t={full:"{{date}} 'kl'. {{time}}",long:"{{date}} 'kl'. {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},P6t={date:nr({formats:T6t,defaultWidth:"full"}),time:nr({formats:R6t,defaultWidth:"full"}),dateTime:nr({formats:A6t,defaultWidth:"full"})},_6t={lastWeek:"'sidste' eeee 'kl.' p",yesterday:"'i går kl.' p",today:"'i dag kl.' p",tomorrow:"'i morgen kl.' p",nextWeek:"'på' eeee 'kl.' p",other:"P"},I6t=(e,t,n,r)=>_6t[e],O6t={narrow:["fvt","vt"],abbreviated:["f.v.t.","v.t."],wide:["før vesterlandsk tidsregning","vesterlandsk tidsregning"]},M6t={narrow:["1","2","3","4"],abbreviated:["1. kvt.","2. kvt.","3. kvt.","4. kvt."],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},$6t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],wide:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},D6t={narrow:["S","M","T","O","T","F","L"],short:["sø","ma","ti","on","to","fr","lø"],abbreviated:["søn.","man.","tir.","ons.","tor.","fre.","lør."],wide:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},L6t={narrow:{am:"a",pm:"p",midnight:"midnat",noon:"middag",morning:"morgen",afternoon:"eftermiddag",evening:"aften",night:"nat"},abbreviated:{am:"AM",pm:"PM",midnight:"midnat",noon:"middag",morning:"morgen",afternoon:"eftermiddag",evening:"aften",night:"nat"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnat",noon:"middag",morning:"morgen",afternoon:"eftermiddag",evening:"aften",night:"nat"}},N6t={narrow:{am:"a",pm:"p",midnight:"midnat",noon:"middag",morning:"om morgenen",afternoon:"om eftermiddagen",evening:"om aftenen",night:"om natten"},abbreviated:{am:"AM",pm:"PM",midnight:"midnat",noon:"middag",morning:"om morgenen",afternoon:"om eftermiddagen",evening:"om aftenen",night:"om natten"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnat",noon:"middag",morning:"om morgenen",afternoon:"om eftermiddagen",evening:"om aftenen",night:"om natten"}},F6t=(e,t)=>Number(e)+".",B6t={ordinalNumber:F6t,era:bn({values:O6t,defaultWidth:"wide"}),quarter:bn({values:M6t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:$6t,defaultWidth:"wide"}),day:bn({values:D6t,defaultWidth:"wide"}),dayPeriod:bn({values:L6t,defaultWidth:"wide",formattingValues:N6t,defaultFormattingWidth:"wide"})},z6t=/^(\d+)(\.)?/i,H6t=/\d+/i,W6t={narrow:/^(fKr|fvt|eKr|vt)/i,abbreviated:/^(f\.Kr\.?|f\.v\.t\.?|e\.Kr\.?|v\.t\.)/i,wide:/^(f.Kr.|før vesterlandsk tidsregning|e.Kr.|vesterlandsk tidsregning)/i},V6t={any:[/^f/i,/^(v|e)/i]},U6t={narrow:/^[1234]/i,abbreviated:/^[1234]. kvt\./i,wide:/^[1234]\.? kvartal/i},G6t={any:[/1/i,/2/i,/3/i,/4/i]},q6t={narrow:/^[jfmasond]/i,abbreviated:/^(jan.|feb.|mar.|apr.|maj|jun.|jul.|aug.|sep.|okt.|nov.|dec.)/i,wide:/^(januar|februar|marts|april|maj|juni|juli|august|september|oktober|november|december)/i},Y6t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^maj/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},K6t={narrow:/^[smtofl]/i,short:/^(søn.|man.|tir.|ons.|tor.|fre.|lør.)/i,abbreviated:/^(søn|man|tir|ons|tor|fre|lør)/i,wide:/^(søndag|mandag|tirsdag|onsdag|torsdag|fredag|lørdag)/i},X6t={narrow:[/^s/i,/^m/i,/^t/i,/^o/i,/^t/i,/^f/i,/^l/i],any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},J6t={narrow:/^(a|p|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i,any:/^([ap]\.?\s?m\.?|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i},Z6t={any:{am:/^a/i,pm:/^p/i,midnight:/midnat/i,noon:/middag/i,morning:/morgen/i,afternoon:/eftermiddag/i,evening:/aften/i,night:/nat/i}},Q6t={ordinalNumber:Qu({matchPattern:z6t,parsePattern:H6t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:W6t,defaultMatchWidth:"wide",parsePatterns:V6t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:U6t,defaultMatchWidth:"wide",parsePatterns:G6t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:q6t,defaultMatchWidth:"wide",parsePatterns:Y6t,defaultParseWidth:"any"}),day:Cn({matchPatterns:K6t,defaultMatchWidth:"wide",parsePatterns:X6t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:J6t,defaultMatchWidth:"any",parsePatterns:Z6t,defaultParseWidth:"any"})},e5t={code:"da",formatDistance:k6t,formatLong:P6t,formatRelative:I6t,localize:B6t,match:Q6t,options:{weekStartsOn:1,firstWeekContainsDate:4}},gW={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},t5t=(e,t,n)=>{let r;const o=n!=null&&n.addSuffix?gW[e].withPreposition:gW[e].standalone;return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:"vor "+r:r},n5t={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},r5t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},o5t={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},s5t={date:nr({formats:n5t,defaultWidth:"full"}),time:nr({formats:r5t,defaultWidth:"full"}),dateTime:nr({formats:o5t,defaultWidth:"full"})},i5t={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},a5t=(e,t,n,r)=>i5t[e],l5t={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},c5t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},Rj={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},u5t={narrow:Rj.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:Rj.wide},d5t={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},p5t={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},f5t={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},h5t=e=>Number(e)+".",g5t={ordinalNumber:h5t,era:bn({values:l5t,defaultWidth:"wide"}),quarter:bn({values:c5t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:Rj,formattingValues:u5t,defaultWidth:"wide"}),day:bn({values:d5t,defaultWidth:"wide"}),dayPeriod:bn({values:p5t,defaultWidth:"wide",formattingValues:f5t,defaultFormattingWidth:"wide"})},m5t=/^(\d+)(\.)?/i,y5t=/\d+/i,x5t={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},v5t={any:[/^v/i,/^n/i]},b5t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},C5t={any:[/1/i,/2/i,/3/i,/4/i]},w5t={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},S5t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},j5t={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},E5t={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},k5t={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},T5t={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},R5t={ordinalNumber:Qu({matchPattern:m5t,parsePattern:y5t,valueCallback:e=>parseInt(e)}),era:Cn({matchPatterns:x5t,defaultMatchWidth:"wide",parsePatterns:v5t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:b5t,defaultMatchWidth:"wide",parsePatterns:C5t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:w5t,defaultMatchWidth:"wide",parsePatterns:S5t,defaultParseWidth:"any"}),day:Cn({matchPatterns:j5t,defaultMatchWidth:"wide",parsePatterns:E5t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:k5t,defaultMatchWidth:"wide",parsePatterns:T5t,defaultParseWidth:"any"})},A5t={code:"de",formatDistance:t5t,formatLong:s5t,formatRelative:a5t,localize:g5t,match:R5t,options:{weekStartsOn:1,firstWeekContainsDate:4}},P5t={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},_5t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},I5t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},O5t={date:nr({formats:P5t,defaultWidth:"full"}),time:nr({formats:_5t,defaultWidth:"full"}),dateTime:nr({formats:I5t,defaultWidth:"full"})},M5t={code:"en-GB",formatDistance:Jk,formatLong:O5t,formatRelative:Zk,localize:Qk,match:eT,options:{weekStartsOn:1,firstWeekContainsDate:4}},$5t={full:"EEEE, d MMMM yyyy",long:"d MMMM, yyyy",medium:"d MMM, yyyy",short:"dd/MM/yyyy"},D5t={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},L5t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},N5t={date:nr({formats:$5t,defaultWidth:"full"}),time:nr({formats:D5t,defaultWidth:"full"}),dateTime:nr({formats:L5t,defaultWidth:"full"})},F5t={code:"en-IN",formatDistance:Jk,formatLong:N5t,formatRelative:Zk,localize:Qk,match:eT,options:{weekStartsOn:1,firstWeekContainsDate:4}},B5t={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},z5t=(e,t,n)=>{let r;const o=B5t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"dans "+r:"il y a "+r:r},H5t={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},W5t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},V5t={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},U5t={date:nr({formats:H5t,defaultWidth:"full"}),time:nr({formats:W5t,defaultWidth:"full"}),dateTime:nr({formats:V5t,defaultWidth:"full"})},G5t={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},q5t=(e,t,n,r)=>G5t[e],Y5t={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},K5t={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},X5t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},J5t={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},Z5t={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},Q5t=(e,t)=>{const n=Number(e),r=t==null?void 0:t.unit;if(n===0)return"0";const o=["year","week","hour","minute","second"];let s;return n===1?s=r&&o.includes(r)?"ère":"er":s="ème",n+s},e7t=["MMM","MMMM"],t7t={preprocessor:(e,t)=>e.getDate()===1||!t.some(r=>r.isToken&&e7t.includes(r.value))?t:t.map(r=>r.isToken&&r.value==="do"?{isToken:!0,value:"d"}:r),ordinalNumber:Q5t,era:bn({values:Y5t,defaultWidth:"wide"}),quarter:bn({values:K5t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:X5t,defaultWidth:"wide"}),day:bn({values:J5t,defaultWidth:"wide"}),dayPeriod:bn({values:Z5t,defaultWidth:"wide"})},n7t=/^(\d+)(ième|ère|ème|er|e)?/i,r7t=/\d+/i,o7t={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},s7t={any:[/^av/i,/^ap/i]},i7t={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},a7t={any:[/1/i,/2/i,/3/i,/4/i]},l7t={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},c7t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},u7t={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},d7t={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},p7t={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},f7t={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},h7t={ordinalNumber:Qu({matchPattern:n7t,parsePattern:r7t,valueCallback:e=>parseInt(e)}),era:Cn({matchPatterns:o7t,defaultMatchWidth:"wide",parsePatterns:s7t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:i7t,defaultMatchWidth:"wide",parsePatterns:a7t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:l7t,defaultMatchWidth:"wide",parsePatterns:c7t,defaultParseWidth:"any"}),day:Cn({matchPatterns:u7t,defaultMatchWidth:"wide",parsePatterns:d7t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:p7t,defaultMatchWidth:"any",parsePatterns:f7t,defaultParseWidth:"any"})},g7t={code:"fr",formatDistance:z5t,formatLong:U5t,formatRelative:q5t,localize:t7t,match:h7t,options:{weekStartsOn:1,firstWeekContainsDate:4}},m7t={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},y7t=(e,t,n)=>{n=n||{};let r;const o=m7t[e];return typeof o=="string"?r=o:t===1?n.addSuffix&&o.oneWithSuffix?r=o.oneWithSuffix:r=o.one:n.addSuffix&&o.otherWithSuffix?r=o.otherWithSuffix.replace("{{count}}",String(t)):r=o.other.replace("{{count}}",String(t)),n.addSuffix?n.comparison&&n.comparison>0?r+"後":r+"前":r},x7t={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},v7t={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},b7t={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},C7t={date:nr({formats:x7t,defaultWidth:"full"}),time:nr({formats:v7t,defaultWidth:"full"}),dateTime:nr({formats:b7t,defaultWidth:"full"})},w7t={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},S7t=(e,t,n,r)=>w7t[e],j7t={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},E7t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},k7t={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},T7t={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},R7t={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},A7t={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},P7t=(e,t)=>{const n=Number(e);switch(String(t==null?void 0:t.unit)){case"year":return`${n}年`;case"quarter":return`第${n}四半期`;case"month":return`${n}月`;case"week":return`第${n}週`;case"date":return`${n}日`;case"hour":return`${n}時`;case"minute":return`${n}分`;case"second":return`${n}秒`;default:return`${n}`}},_7t={ordinalNumber:P7t,era:bn({values:j7t,defaultWidth:"wide"}),quarter:bn({values:E7t,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:bn({values:k7t,defaultWidth:"wide"}),day:bn({values:T7t,defaultWidth:"wide"}),dayPeriod:bn({values:R7t,defaultWidth:"wide",formattingValues:A7t,defaultFormattingWidth:"wide"})},I7t=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,O7t=/\d+/i,M7t={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},$7t={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},D7t={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},L7t={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},N7t={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},F7t={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},B7t={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},z7t={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},H7t={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},W7t={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},V7t={ordinalNumber:Qu({matchPattern:I7t,parsePattern:O7t,valueCallback:function(e){return parseInt(e,10)}}),era:Cn({matchPatterns:M7t,defaultMatchWidth:"wide",parsePatterns:$7t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:D7t,defaultMatchWidth:"wide",parsePatterns:L7t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:N7t,defaultMatchWidth:"wide",parsePatterns:F7t,defaultParseWidth:"any"}),day:Cn({matchPatterns:B7t,defaultMatchWidth:"wide",parsePatterns:z7t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:H7t,defaultMatchWidth:"any",parsePatterns:W7t,defaultParseWidth:"any"})},U7t={code:"ja",formatDistance:y7t,formatLong:C7t,formatRelative:S7t,localize:_7t,match:V7t,options:{weekStartsOn:0,firstWeekContainsDate:1}},G7t={lessThanXSeconds:{one:"mindre enn ett sekund",other:"mindre enn {{count}} sekunder"},xSeconds:{one:"ett sekund",other:"{{count}} sekunder"},halfAMinute:"et halvt minutt",lessThanXMinutes:{one:"mindre enn ett minutt",other:"mindre enn {{count}} minutter"},xMinutes:{one:"ett minutt",other:"{{count}} minutter"},aboutXHours:{one:"omtrent en time",other:"omtrent {{count}} timer"},xHours:{one:"en time",other:"{{count}} timer"},xDays:{one:"en dag",other:"{{count}} dager"},aboutXWeeks:{one:"omtrent en uke",other:"omtrent {{count}} uker"},xWeeks:{one:"en uke",other:"{{count}} uker"},aboutXMonths:{one:"omtrent en måned",other:"omtrent {{count}} måneder"},xMonths:{one:"en måned",other:"{{count}} måneder"},aboutXYears:{one:"omtrent ett år",other:"omtrent {{count}} år"},xYears:{one:"ett år",other:"{{count}} år"},overXYears:{one:"over ett år",other:"over {{count}} år"},almostXYears:{one:"nesten ett år",other:"nesten {{count}} år"}},q7t=(e,t,n)=>{let r;const o=G7t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"om "+r:r+" siden":r},Y7t={full:"EEEE d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd.MM.y"},K7t={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},X7t={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},J7t={date:nr({formats:Y7t,defaultWidth:"full"}),time:nr({formats:K7t,defaultWidth:"full"}),dateTime:nr({formats:X7t,defaultWidth:"full"})},Z7t={lastWeek:"'forrige' eeee 'kl.' p",yesterday:"'i går kl.' p",today:"'i dag kl.' p",tomorrow:"'i morgen kl.' p",nextWeek:"EEEE 'kl.' p",other:"P"},Q7t=(e,t,n,r)=>Z7t[e],e8t={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["før Kristus","etter Kristus"]},t8t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},n8t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mars","apr.","mai","juni","juli","aug.","sep.","okt.","nov.","des."],wide:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"]},r8t={narrow:["S","M","T","O","T","F","L"],short:["sø","ma","ti","on","to","fr","lø"],abbreviated:["søn","man","tir","ons","tor","fre","lør"],wide:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},o8t={narrow:{am:"a",pm:"p",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},abbreviated:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morgenen",afternoon:"på ettermiddagen",evening:"på kvelden",night:"på natten"}},s8t=(e,t)=>Number(e)+".",i8t={ordinalNumber:s8t,era:bn({values:e8t,defaultWidth:"wide"}),quarter:bn({values:t8t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:n8t,defaultWidth:"wide"}),day:bn({values:r8t,defaultWidth:"wide"}),dayPeriod:bn({values:o8t,defaultWidth:"wide"})},a8t=/^(\d+)\.?/i,l8t=/\d+/i,c8t={narrow:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,abbreviated:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,wide:/^(før Kristus|før vår tid|etter Kristus|vår tid)/i},u8t={any:[/^f/i,/^e/i]},d8t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? kvartal/i},p8t={any:[/1/i,/2/i,/3/i,/4/i]},f8t={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mars?|apr|mai|juni?|juli?|aug|sep|okt|nov|des)\.?/i,wide:/^(januar|februar|mars|april|mai|juni|juli|august|september|oktober|november|desember)/i},h8t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^aug/i,/^s/i,/^o/i,/^n/i,/^d/i]},g8t={narrow:/^[smtofl]/i,short:/^(sø|ma|ti|on|to|fr|lø)/i,abbreviated:/^(søn|man|tir|ons|tor|fre|lør)/i,wide:/^(søndag|mandag|tirsdag|onsdag|torsdag|fredag|lørdag)/i},m8t={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},y8t={narrow:/^(midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten)|[ap])/i,any:/^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten))/i},x8t={any:{am:/^a(\.?\s?m\.?)?$/i,pm:/^p(\.?\s?m\.?)?$/i,midnight:/^midn/i,noon:/^midd/i,morning:/morgen/i,afternoon:/ettermiddag/i,evening:/kveld/i,night:/natt/i}},v8t={ordinalNumber:Qu({matchPattern:a8t,parsePattern:l8t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:c8t,defaultMatchWidth:"wide",parsePatterns:u8t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:d8t,defaultMatchWidth:"wide",parsePatterns:p8t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:f8t,defaultMatchWidth:"wide",parsePatterns:h8t,defaultParseWidth:"any"}),day:Cn({matchPatterns:g8t,defaultMatchWidth:"wide",parsePatterns:m8t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:y8t,defaultMatchWidth:"any",parsePatterns:x8t,defaultParseWidth:"any"})},b8t={code:"nb",formatDistance:q7t,formatLong:J7t,formatRelative:Q7t,localize:i8t,match:v8t,options:{weekStartsOn:1,firstWeekContainsDate:4}},C8t={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},w8t=(e,t,n)=>{let r;const o=C8t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+r:"há "+r:r},S8t={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},j8t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},E8t={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},k8t={date:nr({formats:S8t,defaultWidth:"full"}),time:nr({formats:j8t,defaultWidth:"full"}),dateTime:nr({formats:E8t,defaultWidth:"full"})},T8t={lastWeek:e=>{const t=e.getDay();return"'"+(t===0||t===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},R8t=(e,t,n,r)=>{const o=T8t[e];return typeof o=="function"?o(t):o},A8t={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},P8t={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},_8t={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},I8t={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},O8t={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},M8t={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},$8t=(e,t)=>{const n=Number(e);return(t==null?void 0:t.unit)==="week"?n+"ª":n+"º"},D8t={ordinalNumber:$8t,era:bn({values:A8t,defaultWidth:"wide"}),quarter:bn({values:P8t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:_8t,defaultWidth:"wide"}),day:bn({values:I8t,defaultWidth:"wide"}),dayPeriod:bn({values:O8t,defaultWidth:"wide",formattingValues:M8t,defaultFormattingWidth:"wide"})},L8t=/^(\d+)[ºªo]?/i,N8t=/\d+/i,F8t={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},B8t={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},z8t={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},H8t={any:[/1/i,/2/i,/3/i,/4/i]},W8t={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},V8t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},U8t={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},G8t={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},q8t={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},Y8t={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},K8t={ordinalNumber:Qu({matchPattern:L8t,parsePattern:N8t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:F8t,defaultMatchWidth:"wide",parsePatterns:B8t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:z8t,defaultMatchWidth:"wide",parsePatterns:H8t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:W8t,defaultMatchWidth:"wide",parsePatterns:V8t,defaultParseWidth:"any"}),day:Cn({matchPatterns:U8t,defaultMatchWidth:"wide",parsePatterns:G8t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:q8t,defaultMatchWidth:"any",parsePatterns:Y8t,defaultParseWidth:"any"})},X8t={code:"pt-BR",formatDistance:w8t,formatLong:k8t,formatRelative:R8t,localize:D8t,match:K8t,options:{weekStartsOn:0,firstWeekContainsDate:1}},J8t={lessThanXSeconds:{one:"mindre än en sekund",other:"mindre än {{count}} sekunder"},xSeconds:{one:"en sekund",other:"{{count}} sekunder"},halfAMinute:"en halv minut",lessThanXMinutes:{one:"mindre än en minut",other:"mindre än {{count}} minuter"},xMinutes:{one:"en minut",other:"{{count}} minuter"},aboutXHours:{one:"ungefär en timme",other:"ungefär {{count}} timmar"},xHours:{one:"en timme",other:"{{count}} timmar"},xDays:{one:"en dag",other:"{{count}} dagar"},aboutXWeeks:{one:"ungefär en vecka",other:"ungefär {{count}} veckor"},xWeeks:{one:"en vecka",other:"{{count}} veckor"},aboutXMonths:{one:"ungefär en månad",other:"ungefär {{count}} månader"},xMonths:{one:"en månad",other:"{{count}} månader"},aboutXYears:{one:"ungefär ett år",other:"ungefär {{count}} år"},xYears:{one:"ett år",other:"{{count}} år"},overXYears:{one:"över ett år",other:"över {{count}} år"},almostXYears:{one:"nästan ett år",other:"nästan {{count}} år"}},Z8t=["noll","en","två","tre","fyra","fem","sex","sju","åtta","nio","tio","elva","tolv"],Q8t=(e,t,n)=>{let r;const o=J8t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t<13?Z8t[t]:String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"om "+r:r+" sedan":r},e9t={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"y-MM-dd"},t9t={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},n9t={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},r9t={date:nr({formats:e9t,defaultWidth:"full"}),time:nr({formats:t9t,defaultWidth:"full"}),dateTime:nr({formats:n9t,defaultWidth:"full"})},o9t={lastWeek:"'i' EEEE's kl.' p",yesterday:"'igår kl.' p",today:"'idag kl.' p",tomorrow:"'imorgon kl.' p",nextWeek:"EEEE 'kl.' p",other:"P"},s9t=(e,t,n,r)=>o9t[e],i9t={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["före Kristus","efter Kristus"]},a9t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1:a kvartalet","2:a kvartalet","3:e kvartalet","4:e kvartalet"]},l9t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],wide:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},c9t={narrow:["S","M","T","O","T","F","L"],short:["sö","må","ti","on","to","fr","lö"],abbreviated:["sön","mån","tis","ons","tors","fre","lör"],wide:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},u9t={narrow:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"morg.",afternoon:"efterm.",evening:"kväll",night:"natt"},abbreviated:{am:"f.m.",pm:"e.m.",midnight:"midnatt",noon:"middag",morning:"morgon",afternoon:"efterm.",evening:"kväll",night:"natt"},wide:{am:"förmiddag",pm:"eftermiddag",midnight:"midnatt",noon:"middag",morning:"morgon",afternoon:"eftermiddag",evening:"kväll",night:"natt"}},d9t={narrow:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på efterm.",evening:"på kvällen",night:"på natten"},abbreviated:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på efterm.",evening:"på kvällen",night:"på natten"},wide:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"på morgonen",afternoon:"på eftermiddagen",evening:"på kvällen",night:"på natten"}},p9t=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:case 2:return n+":a"}return n+":e"},f9t={ordinalNumber:p9t,era:bn({values:i9t,defaultWidth:"wide"}),quarter:bn({values:a9t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:l9t,defaultWidth:"wide"}),day:bn({values:c9t,defaultWidth:"wide"}),dayPeriod:bn({values:u9t,defaultWidth:"wide",formattingValues:d9t,defaultFormattingWidth:"wide"})},h9t=/^(\d+)(:a|:e)?/i,g9t=/\d+/i,m9t={narrow:/^(f\.? ?Kr\.?|f\.? ?v\.? ?t\.?|e\.? ?Kr\.?|v\.? ?t\.?)/i,abbreviated:/^(f\.? ?Kr\.?|f\.? ?v\.? ?t\.?|e\.? ?Kr\.?|v\.? ?t\.?)/i,wide:/^(före Kristus|före vår tid|efter Kristus|vår tid)/i},y9t={any:[/^f/i,/^[ev]/i]},x9t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](:a|:e)? kvartalet/i},v9t={any:[/1/i,/2/i,/3/i,/4/i]},b9t={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar[s]?|apr|maj|jun[i]?|jul[i]?|aug|sep|okt|nov|dec)\.?/i,wide:/^(januari|februari|mars|april|maj|juni|juli|augusti|september|oktober|november|december)/i},C9t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^maj/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},w9t={narrow:/^[smtofl]/i,short:/^(sö|må|ti|on|to|fr|lö)/i,abbreviated:/^(sön|mån|tis|ons|tors|fre|lör)/i,wide:/^(söndag|måndag|tisdag|onsdag|torsdag|fredag|lördag)/i},S9t={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},j9t={any:/^([fe]\.?\s?m\.?|midn(att)?|midd(ag)?|(på) (morgonen|eftermiddagen|kvällen|natten))/i},E9t={any:{am:/^f/i,pm:/^e/i,midnight:/^midn/i,noon:/^midd/i,morning:/morgon/i,afternoon:/eftermiddag/i,evening:/kväll/i,night:/natt/i}},k9t={ordinalNumber:Qu({matchPattern:h9t,parsePattern:g9t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:m9t,defaultMatchWidth:"wide",parsePatterns:y9t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:x9t,defaultMatchWidth:"wide",parsePatterns:v9t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:b9t,defaultMatchWidth:"wide",parsePatterns:C9t,defaultParseWidth:"any"}),day:Cn({matchPatterns:w9t,defaultMatchWidth:"wide",parsePatterns:S9t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:j9t,defaultMatchWidth:"any",parsePatterns:E9t,defaultParseWidth:"any"})},T9t={code:"sv",formatDistance:Q8t,formatLong:r9t,formatRelative:s9t,localize:f9t,match:k9t,options:{weekStartsOn:1,firstWeekContainsDate:4}},R9t={cs:j6t,"da-DK":e5t,de:A5t,"en-GB":M5t,"en-IN":F5t,"en-US":kf,"fr-FR":g7t,ja:U7t,"nb-NO":b8t,"pt-BR":X8t,"sv-SE":T9t},Dse=e=>R9t[e]??kf,Lse=(e="Unknown date range")=>{const{locationSettings:t}=$r(),n=Dse(t.locale);return r=>{const o=r[0].raw;if("date"in o&&typeof o.date=="string"&&"endDate"in o&&typeof o.endDate=="string"){const s=Jo(Zs(new Date(o.date),{locale:n,weekStartsOn:1}),"PP",{locale:n}),a=Jo(new Date(o.endDate),"PP",{locale:n});return`${s} – ${a}`}return e}},A9t=e=>{const t=Lse(),n={parsing:{yAxisKey:"newProductionFlags",xAxisKey:"date"}};switch(e.state){case"Batched":return{...n,scales:{x:{time:{unit:"month",tooltipFormat:"P"},ticks:{source:"auto"}}},plugins:{tooltip:{callbacks:{title:t}}}};case"Weekly":return n;case"Not Enough Data":case"Loading":return{}}},P9t=({chartData:e})=>{const t=A9t(e);return i.jsx(ad,{data:e.value,overrideOptions:t,cover:e.state==="Not Enough Data"?i.jsx(Jl,{}):e.state==="Loading"})},_9t=e=>t=>{var r,o;const n=t.tooltip;if(n.opacity===0){e(null);return}e({caretX:n==null?void 0:n.caretX,caretY:n==null?void 0:n.caretY,title:((r=n==null?void 0:n.title)==null?void 0:r.join(" "))||"",align:n==null?void 0:n.xAlign,body:((o=n==null?void 0:n.body)==null?void 0:o.map((s,a)=>{var l,c,u;return{title:(l=s==null?void 0:s.lines)==null?void 0:l.join(" "),color:(u=(c=n==null?void 0:n.labelColors)==null?void 0:c[a])==null?void 0:u.borderColor,value:""}}))||[],dataPoints:(n==null?void 0:n.dataPoints)||[]})},I9t=v("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),O9t=v("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.typography.body2.fontSize})),M9t=v("span")(({theme:e})=>({display:"inline-block",minWidth:8,minHeight:8,borderRadius:"50%",marginRight:e.spacing(1)})),Aj=16,$9t=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",D9t=(e=0,t)=>t==="left"?e+Aj:t==="right"?e-Aj:e,Nse=({tooltip:e,children:t})=>i.jsx(K,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+Aj,left:D9t(e==null?void 0:e.caretX,e==null?void 0:e.align),width:"1px",position:"absolute",display:e?"flex":"none",pointerEvents:"none",zIndex:n.zIndex.tooltip,flexDirection:"column",alignItems:$9t(e==null?void 0:e.align)}),children:t}),aYt=({tooltip:e})=>i.jsx(Nse,{tooltip:e,children:i.jsxs(qr,{elevation:3,sx:t=>({width:"max-content",padding:t.spacing(1.5,2)}),children:[i.jsx(J,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),i.jsx(I9t,{children:e==null?void 0:e.body.map(t=>i.jsxs(O9t,{children:[i.jsx(M9t,{sx:{backgroundColor:t.color},children:" "}),i.jsx(mr,{lines:2,children:t.title})]},a0(t)))})]})}),Fse=(e,t)=>t===0?"N/A":`${Math.round(e/t*100)}%`,L9t=v(qr)(({theme:e})=>({padding:e.spacing(1.5),display:"flex",flexFlow:"column",gap:e.spacing(.5)})),N9t=v("dl")(({theme:e})=>({margin:0})),mW=v("div",{shouldForwardProp:e=>e!=="dataType"})(({theme:e,dataType:t})=>({display:"flex",justifyContent:"space-between",alignItems:"center",whiteSpace:"nowrap",fontSize:e.typography.body2.fontSize,"dt::before":{content:'" "',display:"inline-block",height:".65rem",aspectRatio:"1/1",borderRadius:"50%",marginInlineEnd:e.spacing(.5),backgroundColor:t==="archived"?e.palette.charts.A2:e.palette.charts.A1}})),F9t=v("span")(({theme:e})=>({whiteSpace:"nowrap",fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),B9t=({tooltip:e})=>{if(!(e!=null&&e.dataPoints))return null;const t=e.dataPoints[0].raw,{archivedFlags:n,totalCreatedFlags:r}=t.state==="withRatio"?t:{archivedFlags:0,totalCreatedFlags:0},o=Fse(n,r);return i.jsx(Nse,{tooltip:e,children:i.jsxs(L9t,{elevation:3,children:[i.jsxs(J,{variant:"body2",component:"span",fontWeight:"bold",children:["Ratio ",o]}),i.jsxs(N9t,{children:[i.jsxs(mW,{dataType:"archived",children:[i.jsx("dt",{children:"Flags archived"}),i.jsx("dd",{children:n})]}),i.jsxs(mW,{dataType:"created",children:[i.jsx("dt",{children:"Flags created"}),i.jsx("dd",{children:r})]})]}),i.jsx(F9t,{children:e.title})]})})},z9t=.8,H9t=e=>{var n,r,o;const t=((n=e.data.datasets[0])==null?void 0:n.data)??e.scales.x.ticks;return e.width/t.length*(((o=(r=e.options.datasets)==null?void 0:r.bar)==null?void 0:o.categoryPercentage)??z9t)},W9t=e=>({id:"customLine",beforeDraw:t=>{var a;const{width:n=H9t,maxHighlightOpacity:r=.12,bottomOverflow:o=0}=e??{},s=typeof n=="function"?n(t):n;if((a=t.tooltip)!=null&&a.opacity&&t.tooltip.x){const l=t.tooltip.caretX,c=t.scales.y,u=t.ctx;u.save();const d=u.createLinearGradient(l,c.top,l,c.bottom+o);d.addColorStop(0,"rgba(129, 122, 254, 0)"),d.addColorStop(1,`rgba(129, 122, 254, ${r})`),u.fillStyle=d;const p=[l-s/2,c.top,s,c.bottom-c.top+o];o?(u.roundRect(...p,5),u.fill()):u.fillRect(...p),u.restore()}}}),yW=[{archivedFlags:3,totalCreatedFlags:4,archivePercentage:75,week:"2025-30",date:"2025-07-27T01:00:00.000Z"},{archivedFlags:7,totalCreatedFlags:3,archivePercentage:140,week:"2025-31",date:"2025-08-03T01:00:00.000Z"},{archivedFlags:2,totalCreatedFlags:3,archivePercentage:50,week:"2025-32",date:"2025-08-10T01:00:00.000Z"},{archivedFlags:2,totalCreatedFlags:6,archivePercentage:25,week:"2025-33",date:"2025-08-17T00:40:40.606Z"},{archivedFlags:4,totalCreatedFlags:9,archivePercentage:66.66666666666666,week:"2025-34",date:"2025-08-24T00:29:19.583Z"}],xW={datasets:[{label:"Flags archived",data:yW,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},order:1},{label:"Flags created",data:yW,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},order:2}]},Bse="label";function vW(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function V9t(e,t){Object.assign(e.options,t)}function zse(e,t){e.labels=t}function Hse(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bse;const r=[];e.datasets=t.map(o=>{const s=e.datasets.find(a=>a[n]===o[n]);return!s||!o.data||r.includes(s)?{...o}:(r.push(s),Object.assign(s,o),s)})}function U9t(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bse;const n={labels:[],datasets:[]};return zse(n,e.labels),Hse(n,e.datasets,t),n}function G9t(e,t){let{height:n=150,width:r=300,redraw:o=!1,datasetIdKey:s,type:a,data:l,options:c,plugins:u=[],fallbackContent:d,updateMode:p,...f}=e;const h=g.useRef(null),m=g.useRef(),y=()=>{h.current&&(m.current=new x0(h.current,{type:a,data:U9t(l,s),options:c&&{...c},plugins:u}),vW(t,m.current))},b=()=>{vW(t,null),m.current&&(m.current.destroy(),m.current=null)};return g.useEffect(()=>{!o&&m.current&&c&&V9t(m.current,c)},[o,c]),g.useEffect(()=>{!o&&m.current&&zse(m.current.config.data,l.labels)},[o,l.labels]),g.useEffect(()=>{!o&&m.current&&l.datasets&&Hse(m.current.config.data,l.datasets,s)},[o,l.datasets]),g.useEffect(()=>{m.current&&(o?(b(),setTimeout(y)):m.current.update(p))},[o,c,l.labels,l.datasets,p]),g.useEffect(()=>{m.current&&(b(),setTimeout(y))},[a]),g.useEffect(()=>(y(),()=>b()),[]),tt.createElement("canvas",Object.assign({ref:h,role:"img",height:n,width:r},f),d)}const q9t=g.forwardRef(G9t);function Wse(e,t){return x0.register(t),g.forwardRef((n,r)=>tt.createElement(q9t,Object.assign({},n,{ref:r,type:e})))}const Y9t=Wse("line",a8),K9t=Wse("bar",i8),X9t=v("div")(({theme:e})=>({position:"absolute",inset:0,display:"flex",zIndex:e.zIndex.appBar,"&::before":{zIndex:e.zIndex.fab,content:'""',position:"absolute",inset:0,backgroundColor:e.palette.background.paper,opacity:.8}})),J9t=v("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),Z9t=({children:e})=>i.jsx(X9t,{children:i.jsx(J9t,{children:e})}),Q9t=4,Vse=({merge:e,map:t,batchSize:n=Q9t})=>r=>r.reduce((o,s,a)=>{const l=Math.floor(a/n),c=o[l];return c?o[l]=e(c,s):o[l]=t(s),o},[]),ebt=e=>({merge:(t,n)=>{if(n.state==="empty")return{...t,endDate:n.date};switch(t.state){case"empty":return{...t,state:"withRatio",totalCreatedFlags:n.totalCreatedFlags,archivedFlags:n.archivedFlags,archivePercentage:n.archivePercentage,endDate:n.date};case"withRatio":{const r=t.totalCreatedFlags+n.totalCreatedFlags,o=t.archivedFlags+n.archivedFlags,s=r>0?o/r*100:0;return{...t,endDate:n.date,totalCreatedFlags:r,archivedFlags:o,archivePercentage:s}}}},map:t=>{const{week:n,...r}=t;return{...r,endDate:t.date}},batchSize:e}),tbt=(e,t)=>Vse(ebt(t))(e),nbt=(e,t)=>{if(!t)return e;const n=Object.values(t.createdFlags).reduce((r,o)=>r+o);switch(e.state){case"empty":return{...e,state:"populated",archivedFlags:t.archivedFlags,totalCreatedFlags:n};case"populated":return{...e,archivedFlags:e.archivedFlags+t.archivedFlags,totalCreatedFlags:e.totalCreatedFlags+n}}},rbt=e=>({...e,state:"withRatio",archivePercentage:e.totalCreatedFlags>0?e.archivedFlags/e.totalCreatedFlags*100:0}),obt=(e,t)=>e.map(({week:n,date:r})=>t.map(a=>a.data.find(l=>l.week===n)).reduce(nbt,{week:n,date:r,state:"empty"})??{week:n,date:r,state:"empty"}).map(n=>n.state==="empty"?n:rbt(n));x0.register(w3,d8,jy,id,u8,v0,Ase,Tse,kvt);const bW=4,CW=e=>({backgroundColor:e,borderColor:e,hoverBackgroundColor:e,hoverBorderColor:e}),wW=(e,t)=>({datasets:[{label:"Flags archived",data:e,order:1,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},...CW(t.palette.charts.A2)},{label:"Flags created",data:e,order:2,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},...CW(t.palette.charts.A1)}]}),sbt=({creationArchiveTrends:e,isLoading:t,labels:n})=>{const r=ky(e),o=Bt(),{locationSettings:s}=$r(),[a,l]=g.useState(null),c=g.useMemo(()=>{if(t)return{state:"Loading",value:xW};const m=obt(n,r.datasets);return m.length<2?{state:"Not Enough Data",value:xW}:m.length>=12?{state:"Batched",batchSize:bW,value:wW(tbt(m,bW),o)}:{state:"Weekly",value:wW(m,o)}},[r,o]),u=["Loading","Not Enough Data"].includes(c.state),d=c.state==="Not Enough Data",p=Dse(s.locale),f=Lse(),h=g.useMemo(()=>({responsive:!0,...u?{animation:{duration:0}}:{},interaction:{mode:"index",intersect:!1},datasets:{bar:{borderRadius:4}},plugins:{legend:{position:"bottom",labels:{color:o.palette.text.secondary,usePointStyle:!0,padding:21,boxHeight:8},display:!u},tooltip:{enabled:!1,position:"average",external:_9t(l),callbacks:{title:c.state==="Batched"?f:void 0}}},locale:s.locale,scales:{x:{adapters:{date:{locale:p}},type:"time",display:!0,time:{unit:c.state==="Batched"?"month":"week",tooltipFormat:"P"},grid:{display:!1},ticks:{source:c.state==="Batched"?"auto":"data",display:!u}},y:{type:"linear",position:"left",beginAtZero:!0,title:{display:!0,text:"Number of flags"},ticks:{stepSize:1,display:!u}}}}),[o,s,l,u]);return i.jsxs(i.Fragment,{children:[i.jsx(K9t,{data:c.value,options:h,height:100,width:250,plugins:[W9t({maxHighlightOpacity:.24})]}),i.jsx(B9t,{tooltip:a}),u?i.jsx(Z9t,{children:d?i.jsx(Jl,{}):t}):null]})},ibt=e=>{const{totalCreated:t,totalArchived:n}=Object.values(e).reduce((r,o)=>{const{created:s,archived:a}=o.reduce((l,c)=>{const u=c.createdFlags?Object.values(c.createdFlags).reduce((d,p)=>d+p,0):0;return{created:l.created+u,archived:l.archived+(c.archivedFlags??0)}},{created:0,archived:0});return{totalCreated:r.totalCreated+s,totalArchived:r.totalArchived+a}},{totalCreated:0,totalArchived:0});return Fse(n,t)};var bI={},abt=je;Object.defineProperty(bI,"__esModule",{value:!0});var CI=bI.default=void 0,lbt=abt(Ee()),cbt=i,ubt=(0,lbt.default)((0,cbt.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"}),"LightbulbOutlined");CI=bI.default=ubt;const dbt=v(K)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.spacing(2),padding:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(.5)})),pbt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between"})),fbt=v(J)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(2.5),fontWeight:"bold"})),hbt=v(yi)(({theme:e})=>({color:e.palette.text.secondary})),gbt=v(ft)(({theme:e})=>({color:e.palette.primary.main,textDecoration:"none","&:hover":{textDecoration:"underline"},fontSize:e.spacing(1.75)})),Use=({value:e,label:t,tooltip:n,explanation:r,link:o,isLoading:s})=>i.jsxs(i.Fragment,{children:[i.jsxs(dbt,{children:[i.jsxs(pbt,{children:[i.jsx(fbt,{children:s?"...":e}),i.jsx(Zo,{tooltip:n,children:i.jsx(hbt,{})})]}),i.jsx(J,{variant:"body2",children:t})]}),i.jsxs(r2t,{children:[i.jsx(CI,{color:"primary"}),r]}),o&&i.jsx(gbt,{to:o.to,children:o.text})]}),mbt=({groupedCreationArchiveData:e,isLoading:t})=>{const n=ibt(e);return i.jsx(Use,{value:n,label:"Average ratio",tooltip:"Ratio of archived flags to created flags in the selected period",explanation:"Do you create more flags than you archive? Or do you have good process for cleaning up?",link:{to:"/search?lifecycle=IS:completed",text:"View flags in cleanup stage"},isLoading:t})},ybt=({median:e,chartData:t})=>{const n=t.state==="Batched"?`Median per ${t.batchSize} weeks`:"Median per week";return i.jsx(Use,{value:e,label:n,tooltip:"The median number of flags that have entered production for the selected time range.",explanation:"How often do flags go live in production?",isLoading:t.state==="Loading"})},xbt=e=>({merge:(t,n)=>(n.newProductionFlags&&(t.newProductionFlags=(t.newProductionFlags??0)+n.newProductionFlags),n.date&&(t.date||(t.date=n.date),t.endDate=n.date),t),map:t=>({...t,endDate:t.date}),batchSize:e}),Gse=(e,t)=>Vse(xbt(t))(e),vbt=e=>{const t={};for(const o of e)for(const{week:s,newProductionFlags:a}of o.data)a!==void 0&&(t[s]=(t[s]??0)+a);const n=Object.values(t).toSorted((o,s)=>o-s);if(n.length===0)return"N/A";const r=Math.floor(n.length/2);return n.length%2===0?(n[r-1]+n[r])/2:n[r]},bbt=e=>e.state==="Weekly"||e.state==="Batched",Pj=4,Cbt=({labels:e,lifecycleData:t,shouldBatchData:n})=>{if(t.datasets.length===0)return[{label:"No data",data:e}];const r=o=>{const s=e.map(({date:a,week:l})=>o.find(c=>(c==null?void 0:c.week)===l)??{date:a,week:l});return n?Gse(s,Pj):s};return t.datasets.map(({data:o,...s})=>({...s,data:r(o)}))},wbt=({groupedLifecycleData:e,showAllProjects:t,loading:n,labels:r})=>{const o=ky(e),s=Bt(),a=ld(),l=r.length>=12,c=g.useMemo(()=>{if(n)return{state:"Loading",value:a};if(r.length<2)return{state:"Not Enough Data",value:a};const h=r.map(({week:y,date:b})=>o.datasets.map(x=>x.data.find(C=>C.week===y)).reduce((x,C)=>(C&&C.newProductionFlags!==void 0&&(x.newProductionFlags=(x.newProductionFlags??0)+C.newProductionFlags),x),{date:b,week:y})),m=y=>({datasets:[{label:"Number of new flags",data:y,borderColor:s.palette.primary.light,backgroundColor:Ey,fill:!0,order:3}]});return l?{state:"Batched",value:m(Gse(h,Pj)),batchSize:Pj}:{state:"Weekly",value:m(h)}},[o,s,n]);if(!bbt(c))return{chartData:c,median:"N/A"};const{value:u,...d}=c,p=t?u:{datasets:Cbt({labels:r,lifecycleData:o,shouldBatchData:l})},f=vbt(p.datasets);return{chartData:{...d,value:p},median:f}},Sbt=({groupedLifecycleData:e,loading:t,showAllProjects:n,labels:r})=>{const{median:o,chartData:s}=wbt({groupedLifecycleData:e,labels:r,loading:t,showAllProjects:n});return i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"New flags in production"}),i.jsx(ybt,{chartData:s,median:o})]}),i.jsx(Hd,{children:i.jsx(P9t,{chartData:s})})]})},jbt=()=>{var S,E,T;const e="performance-",t=`${e}from`,n=`${e}to`,r={[`${e}project`]:ur,[t]:Hr(ur,{values:[Jo(G5(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[n]:Hr(ur,{values:[Jo(new Date,"yyyy-MM-dd")],operator:"IS"})},[o,s]=If("insights",r,[t,n]),a=R=>{s(_=>k_(_,R,{fromKey:t,toKey:n}))},{insights:l,loading:c}=Aoe((S=o[t])==null?void 0:S.values[0],(E=o[n])==null?void 0:E.values[0]),u=((T=o[`${e}project`])==null?void 0:T.values)??[pa.id],d=u[0]===pa.id,{flagTrends:p,summary:f,groupedProjectsData:h,groupedLifecycleData:m,groupedMetricsData:y,allMetricsDatapoints:b,environmentTypeTrends:x,groupedCreationArchiveData:C}=$se(l,u),{isEnterprise:w}=ut(),j=p[p.length-1],k=(j==null?void 0:j.total)??0;return i.jsxs(eI,{title:"Performance insights",filters:i.jsx(tI,{state:o,onChange:a,filterNamePrefix:e}),children:[w()?i.jsx(Sbt,{groupedLifecycleData:m,loading:c,showAllProjects:d,labels:l.labels}):null,w()?i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"Flags archived vs flags created"}),i.jsx(mbt,{groupedCreationArchiveData:C,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(sbt,{labels:l.labels,creationArchiveTrends:C,isLoading:c})})]}):null,d?i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"Flags"}),i.jsx(hW,{count:k,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(s4t,{flagTrends:p,isLoading:c})})]}):i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"Flags"}),i.jsx(hW,{count:f.total,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(a4t,{projectFlagTrends:h,isLoading:c})})]}),w()?i.jsxs(Tu,{children:[i.jsx(D1,{width:350,padding:0,children:i.jsx(H4t,{value:f.averageHealth,technicalDebt:f.technicalDebt,healthy:f.active,stale:f.stale,potentiallyStale:f.potentiallyStale,title:i.jsx(Ru,{title:"Technical debt",tooltip:"Percentage of flags that are stale or potentially stale."})})}),i.jsx(Hd,{children:i.jsx(S4t,{projectFlagTrends:h,isAggregate:d,isLoading:c})})]}):null,w()?i.jsxs(i.Fragment,{children:[i.jsx(Tu,{children:i.jsxs(Jz,{children:[i.jsx(Ru,{title:"Flag evaluation metrics",tooltip:"Summary of all flag evaluations reported by SDKs."}),i.jsx(Hd,{children:i.jsx(g4t,{metricsSummaryTrends:y,allDatapointsSorted:b,isAggregate:d,isLoading:c})})]})}),i.jsx(Tu,{children:i.jsxs(Jz,{children:[i.jsx(Ru,{title:"Updates per environment type",tooltip:"Summary of all configuration updates per environment type."}),i.jsx(P4t,{environmentTypeTrends:x,isLoading:c})]})})]}):null]})},Ebt=({userTrends:e,isLoading:t})=>{const n=Er("showInactiveUsers"),r=Bt(),o=!t&&e.length<2,s=ld({fill:!0,type:"rising"}),a=g.useMemo(()=>({labels:e.map(l=>l.date),datasets:[{label:"Total users",data:e.map(l=>l.total),borderColor:r.palette.primary.light,backgroundColor:Ey,pointBackgroundColor:r.palette.primary.main,fill:!0,order:3},...n?[{label:"Active users",data:e.map(l=>l.active),borderColor:r.palette.success.border,backgroundColor:r.palette.success.border,order:2},{label:"Inactive users",data:e.map(l=>l.inactive),borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border,order:1}]:[]]}),[r,e]);return i.jsx(ad,{data:o||t?s:a,cover:o?i.jsx(Jl,{}):t})},kbt=({projectFlagTrends:e,isLoading:t})=>{const n=ld({type:"constant"}),r=ky(e),o=g.useMemo(()=>!t&&!r.datasets.some(s=>s.data.length>1),[r,t]);return i.jsx(ad,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"users",xAxisKey:"date"}},cover:o?i.jsx(Jl,{}):t})},Tbt=v(K)(({theme:e})=>({padding:`${e.spacing(1.5)} ${e.spacing(2)}`,borderRadius:`${e.shape.borderRadius}px`,border:`1px solid ${e.palette.divider}`})),Rbt=v(K)(({theme:e,type:t})=>({width:8,height:8,backgroundColor:t==="active"?e.palette.success.border:e.palette.warning.border,borderRadius:"2px",marginRight:e.spacing(1)})),Abt=v(K)(()=>({display:"flex",alignItems:"center",width:"100%"})),Pbt=v(K)(()=>({display:"flex",flexDirection:"column"})),_bt=v(J)(()=>({marginLeft:"auto",fontWeight:"normal"})),SW=({type:e,count:t,percentage:n})=>i.jsx(Tbt,{children:i.jsxs(Abt,{children:[i.jsxs(Pbt,{children:[i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(Rbt,{type:e}),i.jsxs(J,{variant:"body1",component:"span",children:[e==="active"?"Active":"Inactive"," users"]})]}),i.jsxs(J,{variant:"body2",children:[n,"%"]})]}),i.jsx(_bt,{variant:"h2",children:t})]})}),Ibt=v(K)(({theme:e})=>({position:"relative"})),Obt=v(K)(({theme:e})=>({borderRadius:`${e.shape.borderRadiusExtraLarge}px`,backgroundColor:e.palette.background.alternative,maxWidth:300,padding:e.spacing(2),margin:`0 auto ${e.spacing(3)}`,position:"relative",zIndex:2})),Mbt=v(K)(({theme:e})=>({maxWidth:270,height:"54px",backgroundColor:"rgba(108, 101, 229, 0.30)",position:"absolute",margin:"0 auto",top:"45px",left:"15px",right:"15px",borderRadius:`${e.shape.borderRadiusExtraLarge}px`,zIndex:1})),$bt=v(K)(({theme:e})=>({marginBottom:e.spacing(2.5)})),Dbt=v(J)(({theme:e})=>({color:e.palette.primary.contrastText,fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,margin:0,padding:0})),Lbt=v(K)({display:"flex",flexDirection:"column",gap:"12px"}),Nbt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(3)})),Fbt=v(ft)({fontWeight:"bold",textDecoration:"none",display:"flex",justifyContent:"center"}),Bbt=v(K)(()=>({"&:before":{background:"transparent"}})),jW=({count:e,active:t,inactive:n,isLoading:r})=>{const s=Er("showInactiveUsers")&&t!==void 0&&n!==void 0,a=(t||0)/e*100;return i.jsxs(i.Fragment,{children:[i.jsxs(Ibt,{children:[i.jsx(Obt,{children:i.jsx(Dbt,{variant:"h2",children:i.jsx(te,{condition:r!==!0,show:Number.parseInt(`${e}`,10)===e?e:e.toFixed(2),elseShow:i.jsx(Bbt,{className:"skeleton",children:" "})})})}),i.jsx(Mbt,{})]}),i.jsx(te,{condition:s,show:i.jsxs(i.Fragment,{children:[i.jsx($bt,{children:i.jsx(Mse,{sections:[{type:"success",value:a},{type:"warning",value:100-a}]})}),i.jsxs(Lbt,{children:[i.jsx(SW,{type:"active",percentage:`${a}`,count:`${t}`}),i.jsx(SW,{type:"inactive",percentage:`${100-a}`,count:`${n}`})]})]})}),i.jsx(Nbt,{children:i.jsxs(Fbt,{to:"/admin/users",children:["View users ",i.jsx(DA,{})]})})]})},zbt=()=>{var w,j,k;const e="users-",t=`${e}from`,n=`${e}to`,r={[`${e}project`]:ur,[t]:Hr(ur,{values:[Jo(G5(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[n]:Hr(ur,{values:[Jo(new Date,"yyyy-MM-dd")],operator:"IS"})},[o,s]=If("insights-users",r,[t,n]),a=S=>{s(E=>k_(E,S,{fromKey:t,toKey:n}))},{insights:l,loading:c}=Aoe((w=o[t])==null?void 0:w.values[0],(j=o[n])==null?void 0:j.values[0]),u=((k=o["users-project"])==null?void 0:k.values)??[pa.id],d=u[0]===pa.id,{summary:p,groupedProjectsData:f,userTrends:h}=$se(l,u),m=h[h.length-1],y=(m==null?void 0:m.total)??0,b=(m==null?void 0:m.active)??0,x=(m==null?void 0:m.inactive)??0,C=u.length===1;return i.jsx(eI,{title:"User insights",filters:i.jsx(tI,{state:o,onChange:a,filterNamePrefix:e}),children:d?i.jsxs(Tu,{children:[i.jsxs(D1,{children:[i.jsx(Ru,{title:"Total users"}),i.jsx(jW,{count:y,active:b,inactive:x,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(Ebt,{userTrends:h,isLoading:c})})]}):i.jsxs(Tu,{children:[i.jsxs(D1,{children:[i.jsx(Ru,{title:C?"Users in project":"Users per project on average",tooltip:C?"Number of users in selected projects.":"Average number of users for selected projects."}),i.jsx(jW,{count:p.averageUsers,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(kbt,{projectFlagTrends:f,isLoading:c})})]})})},Hbt=v("div")(({theme:e})=>({paddingTop:e.spacing(2)})),Wbt=()=>i.jsxs(Hbt,{children:[i.jsx(t2t,{}),i.jsxs(n2t,{children:[i.jsx(C2t,{}),i.jsx(jbt,{}),i.jsx(zbt,{})]})]}),Vbt=g.lazy(()=>La(()=>import("./ImpactMetricsPage-CFYXYXPb.js"),[]).then(e=>({default:e.ImpactMetricsPage}))),_j="api/admin/feedback",Ubt=yt(_j),Gbt=(e={})=>{const t=()=>fetch(Ubt,{method:"GET"}).then(en("FeedbackPosted")).then(l=>l.json()),{data:n,error:r}=On(_j,t,e),[o,s]=g.useState(!r&&!n),a=()=>{Fo(_j)};return g.useEffect(()=>{s(!r&&!n)},[n,r]),{feedback:n||[],error:r,loading:o,refetchFeedback:a}};function qbt(e){if(!e||e.length===0)return[];const t=new Date;t.setMonth(t.getMonth()-3);const r=e.filter(o=>new Date(o.createdAt)>=t).reduce((o,s)=>{const a=s.category;return o[a]||(o[a]=[]),o[a].push(s),o},{});return Object.entries(r).map(([o,s])=>{const a=s.length,l=s.filter(u=>u.difficultyScore!==null).map(u=>u.difficultyScore),c=l.length>0?(l.reduce((u,d)=>u+d,0)/l.length).toFixed(1):"N/A";return{category:o,commentCount:a,averageScore:c}})}const rC=v(J)(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(1)})),Ybt=v("div")(({theme:e})=>({fontSize:e.fontSizes.mediumHeader})),Kbt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexWrap:"wrap",marginBottom:e.spacing(4)})),Xbt=v("div")(({theme:e})=>({backgroundColor:e.palette.secondary.light,borderRadius:`${e.shape.borderRadiusLarge}px`,padding:e.spacing(3),display:"flex",alignItems:"flex-start",gap:e.spacing(10)})),Jbt=()=>{const{feedback:e}=Gbt(),[t,n]=g.useState(""),r=[{Header:"Feature",accessor:"category",minWidth:100,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.category}),searchable:!0},{Header:"User Type",accessor:"userType",Cell:({row:{original:p}})=>i.jsx(vn,{children:p.userType}),searchable:!0},{Header:"Score",accessor:"difficultyScore",maxWidth:90,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.difficultyScore})},{Header:"What do you like most?",accessor:"positive",minWidth:100,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.positive}),disableSortBy:!0,searchable:!0},{Header:"What should be improved?",accessor:"areasForImprovement",minWidth:100,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.areasForImprovement}),disableSortBy:!0,searchable:!0},{Header:"Date",accessor:"createdAt",Cell:Cp}],{data:o,getSearchText:s}=Af(r,t,e),a=g.useMemo(()=>qbt(o),[o]),{headerGroups:l,rows:c,prepareRow:u}=on.useTable({columns:r,data:o,initialState:{sortBy:[{id:"createdAt",desc:!0}]},sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:vn}},on.useSortBy,on.useFlexLayout),d=Nn(br.breakpoints.down("md"));return i.jsxs(ir,{header:i.jsx($n,{title:"Feedback",actions:i.jsx(i.Fragment,{children:i.jsx(te,{condition:!d,show:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:t,onChange:n}),i.jsx($n.Divider,{})]})})}),children:i.jsx(te,{condition:d,show:i.jsx(No,{initialValue:t,onChange:n})})}),children:[i.jsx(rC,{children:"Active experiments"}),i.jsx(Kbt,{children:a.length>0?a.map(p=>i.jsxs(Xbt,{children:[i.jsxs(K,{children:[i.jsx(rC,{children:p.category}),i.jsxs(K,{children:[p.commentCount," comments"]})]}),i.jsx(Ybt,{children:isNaN(Number(p.averageScore))?"N/A":`${p.averageScore}/7`})]},p.category)):i.jsx(K,{sx:{py:2},children:"No feedback data from the last three months"})}),i.jsxs(rC,{children:["All feedback (",c.length,")"]}),i.jsx(Ai,{value:s(t),children:i.jsx(Wp,{rows:c,headerGroups:l,prepareRow:u})})]})};var wI={},Zbt=je;Object.defineProperty(wI,"__esModule",{value:!0});var qse=wI.default=void 0,Qbt=Zbt(Ee()),eCt=i,tCt=(0,Qbt.default)((0,eCt.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"}),"Link");qse=wI.default=tCt;const nCt=e=>{const t=g.useMemo(()=>({sortBy:[{id:"lastSeen",desc:!0}]}),[]),n=g.useMemo(()=>[{Header:"Instances",accessor:"instanceId",Cell:wi,styles:{width:"45%"}},{Header:"SDK",accessor:"sdkVersion",Cell:wi,styles:{width:"20%"}},{Header:"Last seen",accessor:"lastSeen",Cell:l0,styles:{width:"20%"}},{Header:"IP",accessor:"ip",Cell:wi,styles:{width:"15%"}}],[]),{getTableProps:r,getTableBodyProps:o,headerGroups:s,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d}=on.useTable({columns:n,data:e,initialState:t,sortTypes:Ds,autoResetHiddenColumns:!1,disableSortRemove:!0},on.useGlobalFilter,on.useSortBy);return{getTableProps:r,getTableBodyProps:o,headerGroups:s,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d,columns:n}},rCt=({loading:e,rows:t,getTableProps:n,getTableBodyProps:r,headerGroups:o,prepareRow:s})=>i.jsxs(i.Fragment,{children:[i.jsx(K,{sx:{overflowX:"auto"},children:i.jsxs(gX,{...n(),children:[i.jsx(Sa,{headerGroups:o}),i.jsx(Ji,{...r(),children:t.map(a=>{s(a);const{key:l,...c}=a.getRowProps();return i.jsx(ti,{hover:!0,...c,children:a.cells.map(u=>{const{key:d,...p}=u.getCellProps();return i.jsx(Ci,{...p,children:u.render("Cell")},d)})},l)})})]})}),i.jsx(te,{condition:t.length===0&&!e,show:i.jsx(Gr,{children:i.jsx("p",{children:"There's no data for any connected instances to display. Have you configured your clients correctly?"})})})]}),oCt={environments:[],featureCount:0,projects:[],issues:{missingStrategies:[]}},Yse=(e,t={})=>{const n=encodeURIComponent(e),r=yt(`api/admin/metrics/applications/${n}/overview`),{data:o,error:s}=On(r,sCt,t);return{data:o||oCt,error:s,loading:!s&&!o}},sCt=async e=>await(await fetch(e).then(en("Application overview"))).json(),iCt=(e,t,n={})=>{const r=encodeURIComponent(e),o=yt(`api/admin/metrics/instances/${r}/environment/${t}`),{data:s,error:a}=Ts(!!t,{instances:[]},o,aCt,n);return{data:s||{instances:[]},error:a,loading:!a&&!s}},aCt=async e=>await(await fetch(e).then(en("Connected instances"))).json(),lCt=e=>{const{data:t}=Yse(e),n=t.environments.map(s=>s.name).sort(),[r,o]=C1e("environment",Hr(ei,n[0]));return g.useEffect(()=>{!r&&n.length>0&&o(n[0])},[JSON.stringify(n)]),{currentEnvironment:r,setCurrentEnvironment:o,environments:n}},cCt=()=>{const{trackEvent:e}=zt();return g.useEffect(()=>{e("sdk-reporting",{props:{eventType:"connected instances opened"}})},[]),()=>{e("sdk-reporting",{props:{eventType:"connected instances environment changed"}})}},uCt=()=>{const e=cCt(),t=ar("name"),{currentEnvironment:n,setCurrentEnvironment:r,environments:o}=lCt(t),{data:s,loading:a}=iCt(t,n),l=g.useMemo(()=>{const h=({instanceId:m,sdkVersion:y,clientIp:b,lastSeen:x})=>({instanceId:m,ip:b||"",sdkVersion:y||"",lastSeen:x||""});return n?s.instances.map(h):[]},[JSON.stringify(s),n]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f}=nCt(l);return i.jsxs(K,{children:[i.jsxs(K,{sx:{mb:3},children:[i.jsx(K,{sx:{mb:2},children:"Select which environment to display data for. Only environments that have received traffic for this application will be shown here."}),i.jsx(te,{condition:!!n,show:i.jsx(P9e,{color:"primary",value:n,exclusive:!0,onChange:(h,m)=>{m!==null&&(e(),r(m))},children:o.map(h=>i.jsx(j9e,{value:h,children:h},h))})})]}),i.jsx(rCt,{loading:a,headerGroups:d,prepareRow:f,getTableBodyProps:u,getTableProps:c,rows:p})]})},dCt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),o="api/admin/metrics/applications";return{deleteApplication:async a=>{const l=`${o}/${encodeURIComponent(a)}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},pCt=(e,t={})=>{const n=encodeURIComponent(e),r=yt(`api/admin/metrics/applications/${n}`),o=async()=>fetch(r,{method:"GET"}).then(en("Application")).then(p=>p.json()),s=`api/admin/metrics/applications/${n}`,{data:a,error:l}=On(s,o,{...t}),[c,u]=g.useState(!l&&!a),d=()=>{Fo(s)};return g.useEffect(()=>{u(!l&&!a)},[a,l]),{application:a||{appName:n,color:"",createdAt:"2022-02-02T21:04:00.268Z",description:"",instances:[],strategies:[],seenToggles:[],url:""},error:l,loading:c,refetchApplication:d,APPLICATION_CACHE_KEY:s}};var SI={},fCt=je;Object.defineProperty(SI,"__esModule",{value:!0});var jI=SI.default=void 0,hCt=fCt(Ee()),gCt=i,mCt=(0,hCt.default)((0,gCt.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zm0 5h2v2h-2z"}),"WarningAmberRounded");jI=SI.default=mCt;const yCt=v(K)(({theme:e})=>({display:"flex",flexDirection:"column",alignSelf:"stretch",fontSize:e.fontSizes.smallBody})),xCt=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(2,3,2,3),alignItems:"center",gap:e.spacing(1.5),alignSelf:"stretch",borderRadius:`${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px 0 0`,border:`1px solid ${e.palette.warning.border}`,background:e.palette.warning.light,color:e.palette.warning.main})),vCt=v(K)(({theme:e})=>({color:e.palette.warning.dark,fontWeight:e.fontWeight.bold})),EI=v("ul")(({theme:e})=>({padding:e.spacing(0,0,0,2)})),kI=v("li")(({theme:e})=>({fontWeight:e.fontWeight.bold})),bCt=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(3),flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(3),borderRadius:` 0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`,border:`1px solid ${e.palette.warning.border}`})),TI=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(2),flexDirection:"column",justifyContent:"center",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(.5),borderRadius:e.spacing(1),border:`1px solid ${e.palette.divider}`})),RI=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1.5),alignItems:"center"})),Kse=v(ft)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"underline"})),CCt=({features:e})=>{const{hasAccess:t}=g.useContext(Bo),n=e.length;return n===0?null:i.jsxs(TI,{children:[i.jsx(K,{children:`We detected ${n} feature flag${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),i.jsx(EI,{children:e.map(r=>i.jsxs(RI,{children:[i.jsx(kI,{children:r}),i.jsx(te,{condition:t(W4),show:i.jsx(Kse,{to:`/projects/default?create=true&name=${r}`,children:"Create feature flag"},r)})]},r))})]})},wCt=({strategies:e})=>{const{hasAccess:t}=g.useContext(Bo),n=e.length;return n===0?null:i.jsxs(TI,{children:[i.jsx(K,{children:`We detected ${n} strategy type${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),i.jsx(EI,{children:e.map(r=>i.jsxs(RI,{children:[i.jsx(kI,{children:r}),i.jsx(te,{condition:t(V4),show:i.jsx(Kse,{to:"/strategies/create",children:"Create strategy type"},r)})]},r))})]})},SCt=({sdks:e})=>e.length===0?null:i.jsxs(TI,{children:[i.jsx(K,{children:"We detected the following outdated SDKs"}),i.jsx(EI,{children:e.map(t=>i.jsx(RI,{children:i.jsx(kI,{children:t})},t))})]}),Xse=e=>{const t=[...new Set(e.environments.flatMap(o=>o.issues.outdatedSdks))],n=[...new Set(e.environments.flatMap(o=>o.issues.missingFeatures))],r=t.length+n.length+e.issues.missingStrategies.length;return{issueCount:r,outdatedSdks:t,missingFeatures:n,applicationMode:r>0?"warning":"success"}},jCt=({application:e})=>{const t=Xse(e);if(t.applicationMode==="success")return null;const{issueCount:n,outdatedSdks:r,missingFeatures:o}=t;return i.jsxs(yCt,{children:[i.jsxs(xCt,{children:[i.jsx(jI,{}),i.jsxs(vCt,{children:["We detected ",n," issue",n!==1?"s":""," in this application"]})]}),i.jsxs(bCt,{children:[i.jsx(SCt,{sdks:r}),i.jsx(CCt,{features:o}),i.jsx(wCt,{strategies:e.issues.missingStrategies})]})]})};var Jse={exports:{}};(function(e,t){(function(n,r){e.exports=r(g)})(typeof self<"u"?self:_n,function(n){return function(r){var o={};function s(a){if(o[a])return o[a].exports;var l=o[a]={i:a,l:!1,exports:{}};return r[a].call(l.exports,l,l.exports,s),l.l=!0,l.exports}return s.m=r,s.c=o,s.d=function(a,l,c){s.o(a,l)||Object.defineProperty(a,l,{enumerable:!0,get:c})},s.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},s.t=function(a,l){if(1&l&&(a=s(a)),8&l||4&l&&typeof a=="object"&&a&&a.__esModule)return a;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:a}),2&l&&typeof a!="string")for(var u in a)s.d(c,u,(function(d){return a[d]}).bind(null,u));return c},s.n=function(a){var l=a&&a.__esModule?function(){return a.default}:function(){return a};return s.d(l,"a",l),l},s.o=function(a,l){return Object.prototype.hasOwnProperty.call(a,l)},s.p="lib/",s(s.s=5)}([function(r,o){r.exports=n},function(r,o,s){var a=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainerContextProvider=o.ArcherContainerContext=void 0;var l=a(s(0));o.ArcherContainerContext=l.default.createContext(null),o.ArcherContainerContextProvider=o.ArcherContainerContext.Provider},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.encodeId=void 0,o.encodeId=function(a){return encodeURI(a).replace(/%/g,"_")}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.getMarkerId=o.createShapeObj=o.getSourceToTargets=o.getEndShapeFromStyle=void 0;var a=["arrow","circle"];o.getEndShapeFromStyle=function(l){return l.endShape&&Object.keys(l.endShape).filter(function(c){return a.includes(c)})[0]||a[0]},o.getSourceToTargets=function(l){var c=Object.keys(l).map(function(u){return l[u]});return[].concat.apply([],c).sort(function(u,d){return u.order-d.order})},o.createShapeObj=function(l,c){return{arrow:function(){var u;return{arrow:Object.assign(Object.assign({},c==null?void 0:c.arrow),(u=l.endShape)===null||u===void 0?void 0:u.arrow)}},circle:function(){var u;return{circle:Object.assign(Object.assign({},c==null?void 0:c.circle),(u=l.endShape)===null||u===void 0?void 0:u.circle)}}}[(0,o.getEndShapeFromStyle)(l)]()},o.getMarkerId=function(l,c,u){return"".concat(l).concat(c.id).concat(u.id)}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.endShapeDefaultProp=void 0,o.endShapeDefaultProp={arrow:{arrowLength:10,arrowThickness:6},circle:{radius:2,fillColor:"#f00",strokeColor:"#0ff",strokeWidth:1}}},function(r,o,s){var a=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainer=o.ArcherElement=void 0;var l=s(6);Object.defineProperty(o,"ArcherElement",{enumerable:!0,get:function(){return a(l).default}});var c=s(11);Object.defineProperty(o,"ArcherContainer",{enumerable:!0,get:function(){return a(c).default}})},function(r,o,s){var a=this&&this.__createBinding||(Object.create?function(y,b,x,C){C===void 0&&(C=x);var w=Object.getOwnPropertyDescriptor(b,x);w&&("get"in w?b.__esModule:!w.writable&&!w.configurable)||(w={enumerable:!0,get:function(){return b[x]}}),Object.defineProperty(y,C,w)}:function(y,b,x,C){C===void 0&&(C=x),y[C]=b[x]}),l=this&&this.__setModuleDefault||(Object.create?function(y,b){Object.defineProperty(y,"default",{enumerable:!0,value:b})}:function(y,b){y.default=b}),c=this&&this.__importStar||function(y){if(y&&y.__esModule)return y;var b={};if(y!=null)for(var x in y)x!=="default"&&Object.prototype.hasOwnProperty.call(y,x)&&a(b,y,x);return l(b,y),b};Object.defineProperty(o,"__esModule",{value:!0});var u=c(s(0)),d=s(7),p=s(1),f=s(2),h=s(8),m=s(10);o.default=function(y){var b=y.id,x=y.relations,C=x===void 0?[]:x,w=y.children,j=(0,u.useMemo)(function(){return(0,f.encodeId)(b)},[b]),k=(0,u.useContext)(p.ArcherContainerContext),S=(0,u.useRef)(),E=(0,u.useCallback)(function($){var z=(0,m.generateSourceToTarget)(j,$);(0,m.assertContextExists)(k),k.registerTransitions(j,z)},[k,j]),T=(0,u.useCallback)(function(){(0,m.assertContextExists)(k),k.unregisterTransitions(j)},[k,j]),R=(0,u.useCallback)(function($){$&&((0,m.assertContextExists)(k),k.registerChild(j,$))},[j,k]),_=(0,u.useCallback)(function(){(0,m.assertContextExists)(k),k.unregisterChild(j)},[k,j]);(0,d.useIsomorphicLayoutEffect)(function(){return R(S.current),function(){return _()}},[R,_]),(0,h.useDeepCompareEffect)(function(){return E(C),function(){return T()}},[E,C,T]),u.default.Children.only(w);var M=w;return u.default.cloneElement(M,Object.assign(Object.assign({},M.props),{ref:S}))}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.useIsomorphicLayoutEffect=void 0;var a=s(0);o.useIsomorphicLayoutEffect=typeof window<"u"?a.useLayoutEffect:a.useEffect},function(r,o,s){var a=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(o,"__esModule",{value:!0}),o.useDeepCompareEffect=void 0;var l=s(0),c=a(s(9));function u(d){var p=(0,l.useRef)();return(0,c.default)(d,p.current)||(p.current=d),p.current}o.useDeepCompareEffect=function(d,p){(0,l.useEffect)(d,p.map(u))}},function(r,o,s){var a=Array.isArray,l=Object.keys,c=Object.prototype.hasOwnProperty,u=typeof Element<"u";r.exports=function(d,p){try{return function f(h,m){if(h===m)return!0;if(h&&m&&typeof h=="object"&&typeof m=="object"){var y,b,x,C=a(h),w=a(m);if(C&&w){if((b=h.length)!=m.length)return!1;for(y=b;y--!=0;)if(!f(h[y],m[y]))return!1;return!0}if(C!=w)return!1;var j=h instanceof Date,k=m instanceof Date;if(j!=k)return!1;if(j&&k)return h.getTime()==m.getTime();var S=h instanceof RegExp,E=m instanceof RegExp;if(S!=E)return!1;if(S&&E)return h.toString()==m.toString();var T=l(h);if((b=T.length)!==l(m).length)return!1;for(y=b;y--!=0;)if(!c.call(m,T[y]))return!1;if(u&&h instanceof Element&&m instanceof Element)return h===m;for(y=b;y--!=0;)if(!((x=T[y])==="_owner"&&h.$$typeof||f(h[x],m[x])))return!1;return!0}return h!=h&&m!=m}(d,p)}catch(f){if(f.message&&f.message.match(/stack|recursion/i)||f.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",f.name,f.message),!1;throw f}}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.generateSourceToTarget=o.assertContextExists=void 0;var a=s(2);o.assertContextExists=function(l){if(!l)throw new Error("Could not find ArcherContainerContext in <ArcherElement>. Please wrap the component in a <ArcherContainer>.")},o.generateSourceToTarget=function(l,c){return c.map(function(u){var d=u.targetId,p=u.sourceAnchor,f=u.targetAnchor,h=u.label,m=u.className,y=u.style,b=u.order,x=b===void 0?0:b,C=u.domAttributes,w=u.cursor,j=u.hitSlop;return{source:{id:(0,a.encodeId)(l),anchor:p},target:{id:(0,a.encodeId)(d),anchor:f},className:m,label:h,style:y,order:x,domAttributes:C,cursor:w,hitSlop:j}})}},function(r,o,s){function a(S,E,T){return E in S?Object.defineProperty(S,E,{value:T,enumerable:!0,configurable:!0,writable:!0}):S[E]=T,S}function l(S,E){return function(T){if(Array.isArray(T))return T}(S)||function(T,R){var _=T==null?null:typeof Symbol<"u"&&T[Symbol.iterator]||T["@@iterator"];if(_!=null){var M,$,z=[],A=!0,O=!1;try{for(_=_.call(T);!(A=(M=_.next()).done)&&(z.push(M.value),!R||z.length!==R);A=!0);}catch(L){O=!0,$=L}finally{try{A||_.return==null||_.return()}finally{if(O)throw $}}return z}}(S,E)||function(T,R){if(T){if(typeof T=="string")return c(T,R);var _=Object.prototype.toString.call(T).slice(8,-1);if(_==="Object"&&T.constructor&&(_=T.constructor.name),_==="Map"||_==="Set")return Array.from(T);if(_==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_))return c(T,R)}}(S,E)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
475
+ */const r4t={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};use._date.override({_id:"date-fns",formats:function(){return r4t},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=Ot(e):n==="string"&&(typeof t=="string"?e=cJ(e,t,new Date,this.options):e=bi(e,this.options)),J3(e)?e.getTime():null},format:function(e,t){return Jo(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Gk(e,t);case"second":return YX(e,t);case"minute":return Gg(e,t);case"hour":return WX(e,t);case"day":return zp(e,t);case"week":return qk(e,t);case"month":return Ug(e,t);case"quarter":return qX(e,t);case"year":return Yk(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return Xk(e,t);case"second":return XX(e,t);case"minute":return KX(e,t);case"hour":return Sbe(e,t);case"day":return Z3(e,t);case"week":return kbe(e,t);case"month":return U5(e,t);case"quarter":return Ebe(e,t);case"year":return Tbe(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Rwe(e);case"minute":return kwe(e);case"hour":return eS(e);case"day":return Gu(e);case"week":return Zs(e);case"isoWeek":return Zs(e,{weekStartsOn:+n});case"month":return M4(e);case"quarter":return Xw(e);case"year":return o3(e);default:return e}},endOf:function(e,t){switch(t){case"second":return Ibe(e);case"minute":return _be(e);case"hour":return Pbe(e);case"day":return O4(e);case"week":return JX(e);case"month":return n3(e);case"quarter":return Jw(e);case"year":return r3(e);default:return e}}});const ad=g.lazy(()=>La(()=>import("./LineChartComponent-FVKRZKUW.js"),[])),o4t=(e,t)=>n=>{const r=n.chart,{ctx:o,chartArea:s}=r;if(!s)return;const a=o.createLinearGradient(0,s.bottom,0,s.top);return a.addColorStop(0,e),a.addColorStop(1,t),a},Ey=o4t("rgba(129, 122, 254, 0)","rgba(129, 122, 254, 0.12)"),Jl=({title:e="Not enough data",description:t="Two or more weeks of data are needed to show a chart."})=>i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body1",component:"h4",sx:n=>({paddingBottom:n.spacing(1)}),children:e}),i.jsx(J,{variant:"body2",children:t})]}),ld=e=>{const{fill:t=!1,type:n="constant"}=e||{},r=Bt();return g.useMemo(()=>({labels:Array.from({length:15},(o,s)=>s+1).map(o=>new Date(Date.now()-(15-o)*7*24*60*60*1e3)),datasets:n==="double"?[{label:"Total flags",data:[43,66,55,65,62,72,75,73,80,65,62,61,69,70,77],borderColor:r.palette.primary.light,backgroundColor:r.palette.primary.light},{label:"Stale",data:[3,5,4,6,2,7,5,3,8,3,5,11,8,4,3],borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border}]:[{label:"",data:n==="rising"?[3,5,15,17,25,40,47,48,55,65,62,72,75,73,80]:[54,52,53,49,54,50,47,46,51,51,50,51,49,49,51],borderColor:r.palette.primary.light,backgroundColor:t?Ey:r.palette.primary.light,fill:t}]}),[r,t])},s4t=({flagTrends:e,isLoading:t})=>{const n=Bt(),r=!t&&e.length<2,o=ld({fill:!0,type:"double"}),s=g.useMemo(()=>({labels:e.map(a=>a.date),datasets:[{label:"Total flags",data:e.map(a=>a.total),borderColor:n.palette.primary.light,backgroundColor:n.palette.primary.light},{label:"Stale",data:e.map(a=>a.stale),borderColor:n.palette.warning.border,backgroundColor:n.palette.warning.border}]}),[n,e]);return i.jsx(ad,{data:r||t?o:s,cover:r?i.jsx(Jl,{}):t})},Ose=()=>{const{projects:e}=Zr(),n=Bt().palette.charts.series,r=g.useMemo(()=>e.sort((s,a)=>s.createdAt&&a.createdAt?new Date(s.createdAt).getTime()-new Date(a.createdAt).getTime():0).map(s=>s.id),[e]);return s=>{const a=r.indexOf(s);return n[a%n.length]}},i4t=e=>e.total?((e.stale+e.potentiallyStale)/e.total*100).toFixed(2):"0",ky=e=>{const t=Bt(),n=Ose(),{projects:r}=Zr(),o=new Map(r.map(a=>[a.id,a.name]));return g.useMemo(()=>({datasets:Object.entries(e).map(([l,c])=>{const u=n(l);return{label:o.get(l)||l,data:c,borderColor:u,backgroundColor:u,fill:!1}})}),[t,e])},a4t=({projectFlagTrends:e,isLoading:t})=>{const n=ld({type:"constant"}),r=ky(e),o=g.useMemo(()=>!t&&!r.datasets.some(s=>s.data.length>1),[r,t]);return i.jsx(ad,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"total",xAxisKey:"date"}},cover:o?i.jsx(Jl,{}):t})},l4t=v(qr)(({theme:e})=>({padding:e.spacing(2)})),c4t=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),nC=({iconChar:e,title:t,color:n})=>i.jsxs(J,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[i.jsx(J,{component:"span",children:e}),i.jsx("strong",{children:t})]}),u4t=({data:e})=>i.jsx(K,{display:"flex",flexDirection:"row",children:e.map(({key:t,value:n})=>i.jsxs("div",{style:{flex:1,flexDirection:"column"},children:[i.jsx("div",{style:{flex:1,textAlign:"center",marginBottom:"4px"},children:i.jsx(J,{variant:"body1",component:"p",children:t})}),i.jsx("div",{style:{flex:1,textAlign:"center"},children:n})]},t))}),d4t=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return i.jsx(K,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>i.jsxs(l4t,{elevation:3,children:[i.jsxs(c4t,{children:[i.jsxs(J,{variant:"body2",component:"span",children:[i.jsx(J,{sx:{color:r.color},component:"span",children:"● "}),i.jsx("strong",{children:r.title})]}),i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsx(nC,{iconChar:"▣ ",title:`Total requests: ${(r.value.totalRequests??0).toLocaleString()}`,color:"info"}),i.jsx(nC,{iconChar:"▲ ",title:`Exposed: ${(r.value.totalYes??0).toLocaleString()}`,color:"success"}),i.jsx(nC,{iconChar:"▼ ",title:`Not exposed: ${(r.value.totalNo??0).toLocaleString()}`,color:"error"}),i.jsx(te,{condition:!!r.value.totalApps&&!!r.value.totalEnvironments&&!!r.value.totalFlags,show:i.jsxs(i.Fragment,{children:[i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsx(u4t,{data:[{key:"Flags",value:r.value.totalFlags},{key:"Environments",value:r.value.totalEnvironments},{key:"Apps",value:r.value.totalApps}]})]})})]},`${r.title}-${o}`)))||null})};function p4t(e){return e.reduce((t,n)=>(t[n.date]||(t[n.date]={totalFlags:0,totalNo:0,totalRequests:0,totalYes:0}),t[n.date].totalFlags+=n.totalFlags,t[n.date].totalNo+=n.totalNo,t[n.date].totalRequests+=n.totalRequests,t[n.date].totalYes+=n.totalYes,t),{})}const f4t=e=>Jo(new Date(e),"yyyy-ww"),h4t=(e,t)=>{const n=Bt(),r=Ose();return g.useMemo(()=>({datasets:Object.entries(e).map(([a,l])=>{const c=new Map(l.map(p=>[p.date,p])),u=t.map(p=>c.get(p)||{date:p,totalRequests:0,totalNo:0,project:a,totalApps:0,totalYes:0,totalEnvironments:0,totalFlags:0,week:f4t(p)}),d=r(a);return{label:a,data:u,borderColor:d,backgroundColor:d,fill:!1}})}),[n,e,r])},g4t=({metricsSummaryTrends:e,isAggregate:t,allDatapointsSorted:n,isLoading:r})=>{const o=Bt(),s=h4t(e,n),a=g.useMemo(()=>!r&&!s.datasets.some(d=>d.data.length>1),[s,r]),l=ld(),c=g.useMemo(()=>{const d=p4t(Object.values(s.datasets).flatMap(f=>f.data));return{datasets:[{label:"Total Requests",data:Object.entries(d).map(([f,h])=>({date:f,...h})).sort((f,h)=>new Date(f.date).getTime()-new Date(h.date).getTime()),borderColor:o.palette.primary.light,backgroundColor:Ey,fill:!0,order:3}]}},[JSON.stringify(e),o]),u=t?c:s;return i.jsx(ad,{data:a||r?l:u,TooltipComponent:d4t,overrideOptions:a?{}:{parsing:{yAxisKey:"totalRequests",xAxisKey:"date"}},cover:a?i.jsx(Jl,{}):r})},m4t=v(K)(({theme:e,type:t,size:n="large"})=>{const r={default:e.palette.secondary.border,success:e.palette.success.border,warning:e.palette.warning.border,error:e.palette.error.border};return{borderRadius:e.shape.borderRadius,height:n==="large"?e.spacing(2):e.spacing(1),backgroundColor:r[t],marginBottom:e.spacing(.5)}}),Mse=({sections:e,size:t})=>i.jsx(K,{sx:n=>({display:"flex",gap:n.spacing(.5)}),children:e.map((n,r)=>n.value?i.jsx(m4t,{type:n.type,sx:{width:`${n.value}%`},size:t},`${n.type}-${r}`):null)}),y4t=e=>e>=50?"error":e>=25?"warning":"success",x4t=v(qr)(({theme:e})=>({padding:e.spacing(2)})),fW=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),v4t=e=>e==null?"info":y4t(e),b4t=({stale:e=0,potentiallyStale:t=0,total:n=0})=>{const r=n-e-t;return i.jsxs(i.Fragment,{children:[i.jsx(Mse,{sections:[{type:"error",value:e/n*100},{type:"warning",value:t/n*100},{type:"success",value:r/n*100}],size:"small"}),i.jsxs(J,{variant:"body2",component:"p",sx:o=>({marginTop:o.spacing(.5)}),children:[i.jsx(J,{component:"span",sx:o=>({color:o.palette.error.border}),children:"● "}),"Stale flags: ",e]}),i.jsxs(J,{variant:"body2",component:"p",children:[i.jsx(J,{component:"span",sx:o=>({color:o.palette.warning.border}),children:"● "}),"Potentially stale flags: ",t]}),i.jsxs(J,{variant:"body2",component:"p",children:[i.jsx(J,{component:"span",sx:o=>({color:o.palette.success.border}),children:"● "}),"Healthy flags: ",r]})]})},C4t=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return i.jsx(K,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>i.jsxs(x4t,{elevation:3,children:[i.jsxs(fW,{children:[i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:r.label}),i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:"Technical debt"})]}),i.jsxs(fW,{children:[i.jsxs(J,{variant:"body2",component:"span",children:[i.jsx(J,{sx:{color:r.color},component:"span",children:"● "}),i.jsx("strong",{children:r.title})]}),i.jsxs(an,{color:v4t(r.value.technicalDebt),children:[r.value.technicalDebt,"%"]})]})," ",i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsxs(J,{variant:"body2",component:"p",sx:s=>({marginBottom:s.spacing(.5)}),children:["Total flags: ",r.value.total]}),i.jsx(te,{condition:!!(r.value.stale||r.value.potentiallyStale),show:i.jsx(b4t,{...r.value})})]},`${r.title}-${o}`)))||null})},w4t=e=>((e.total-e.stale-e.potentiallyStale)/e.total*100).toFixed(2),S4t=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=ky(e),o=Bt(),s=ld(),a=g.useMemo(()=>({datasets:[{label:"Technical debt",data:Array.from(new Set(r.datasets.flatMap(f=>f.data.map(h=>h.week)))).map(f=>r.datasets.map(h=>h.data.find(m=>m.week===f)).reduce((h,m)=>(m&&(h.total+=m.total,h.stale+=m.stale,h.potentiallyStale+=m.potentiallyStale),h.date||(h.date=m==null?void 0:m.date),h),{total:0,stale:0,potentiallyStale:0,week:f})).sort((f,h)=>f.week>h.week?1:-1).map(f=>({health:f.total?w4t(f):void 0,technicalDebt:f.total?i4t(f):void 0,date:f.date,total:f.total,stale:f.stale,potentiallyStale:f.potentiallyStale})),borderColor:o.palette.primary.light,backgroundColor:Ey,fill:!0,order:3}]}),[r,o]),l=t?a:r,c=g.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?s:l;return i.jsx(ad,{data:u,TooltipComponent:C4t,overrideOptions:c?{}:{parsing:{yAxisKey:"technicalDebt",xAxisKey:"date"},plugins:{legend:{display:!t}},scales:{y:{min:0,max:100,beginAtZero:!0,type:"linear",grid:{color:o.palette.divider,borderColor:o.palette.divider},ticks:{color:o.palette.text.secondary,display:!0,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:o.palette.text.secondary,display:!0,source:"data",maxRotation:90,minRotation:23.5}}}},cover:c?i.jsx(Jl,{}):n},t?"aggregate":"project")},j4t=v(qr)(({theme:e})=>({padding:e.spacing(2)})),E4t=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),k4t=({iconChar:e,title:t,color:n})=>i.jsxs(J,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[i.jsx(J,{component:"span",children:e}),i.jsx("strong",{children:t})]}),T4t=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return i.jsx(K,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>i.jsxs(j4t,{elevation:3,children:[i.jsxs(E4t,{children:[i.jsxs(J,{variant:"body2",component:"span",children:[i.jsx(J,{sx:{color:r.color},component:"span",children:"● "}),i.jsx("strong",{children:r.title})]}),i.jsx(J,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),i.jsx(pr,{sx:s=>({margin:s.spacing(1.5,0)})}),i.jsx(k4t,{iconChar:"● ",title:`Total updates: ${r.value.totalUpdates}`,color:"info"})]},`${r.title}-${o}`)))||null})},R4t=e=>{if(!e.length)return{};const t={};for(const o of e)t[o.date]||(t[o.date]=[]),t[o.date].push(o);const n=Array.from(new Set(e.map(o=>o.environmentType))),r={};return Object.entries(t).forEach(([o,s])=>{const a=n.map(l=>{var u;const c=s.find(d=>d.environmentType===l);if(c)return c;{const d=((u=e.find(p=>p.date===o))==null?void 0:u.week)||"";return{date:o,environmentType:l,totalUpdates:0,week:d}}});r[o]=a}),r},A4t=()=>{const e=Bt();return t=>{switch(t){case"production":return e.palette.charts.series[3];case"staging":return e.palette.charts.series[1];case"development":return e.palette.charts.series[0];case"test":return e.palette.charts.series[2];default:return e.palette.charts.series[4]}}},P4t=({environmentTypeTrends:e,isLoading:t})=>{const n=Bt(),r=A4t(),o=!t&&(e==null?void 0:e.length)<2,s=ld({fill:!0,type:"double"}),a=g.useMemo(()=>{const l=R4t(e),c={};return Object.entries(l).forEach(([d,p])=>{p.forEach(f=>{c[f.environmentType]||(c[f.environmentType]=[]),c[f.environmentType].push(f)})}),{datasets:Object.entries(c).map(([d,p])=>{const f=r(d);return{label:d,data:p,borderColor:f,backgroundColor:f,fill:!1}})}},[n,e]);return i.jsx(ad,{data:o||t?s:a,overrideOptions:o?{}:{parsing:{yAxisKey:"totalUpdates",xAxisKey:"date"}},TooltipComponent:T4t,cover:o?i.jsx(Jl,{}):t})},_4t=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center"})),I4t=v(K)(({theme:e})=>({borderRadius:"50%",width:"200px",height:"200px",border:`10px solid ${e.palette.secondary.border}`,display:"flex",alignItems:"center",justifyContent:"center"})),O4t=v(K)(({theme:e})=>({borderRadius:"50%",width:"180px",height:"180px",backgroundColor:e.palette.secondary.light,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,border:`10px solid ${e.palette.background.paper}`}));v(K)(({theme:e})=>({marginTop:e.spacing(4),padding:e.spacing(1.5,2),background:e.palette.background.elevation2,borderRadius:`${e.shape.borderRadiusMedium}px`,display:"flex",alignItems:"center"}));v(K)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(.5)}));v(K)(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start"}));v(J)(({theme:e})=>({marginLeft:"auto",fontSize:e.fontSizes.mainHeader}));v(Ta)(({theme:e})=>({color:e.palette.primary.main,width:"15px",height:"15px",marginRight:e.spacing(.5),fontSize:"15px!important"}));const M4t=v("div")({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}),hW=({count:e,isLoading:t})=>{const n=Yu(),r=Yu();return i.jsxs(i.Fragment,{children:[i.jsx(_4t,{children:i.jsx(I4t,{children:i.jsx(O4t,{"aria-labelledby":n,"aria-describedby":r,children:t?i.jsx(tc,{children:"Loading total flag count"}):e})})}),i.jsxs(M4t,{children:[i.jsx(J,{id:n,variant:"body2",children:"Total number of flags"}),i.jsx(Zo,{htmlTooltip:!0,tooltipId:r,tooltip:"This includes the four lifecycle stages define, develop, production, and cleanup",children:i.jsx(yi,{})})]})]})},$4t=e=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20",fill:"none",...e},g.createElement("path",{d:"M5 20V15H0V5H5V0H15V5H20V15H15V20H5ZM2 9H7C7.16667 9 7.325 9.04167 7.475 9.125C7.625 9.20833 7.74167 9.31667 7.825 9.45L8.7 10.75L10.05 6.7C10.1167 6.5 10.2375 6.33333 10.4125 6.2C10.5875 6.06667 10.7833 6 11 6C11.1667 6 11.325 6.04167 11.475 6.125C11.625 6.20833 11.7417 6.31667 11.825 6.45L13.525 9H18V7H13V2H7V7H2V9ZM7 18H13V13H18V11H13C12.8333 11 12.675 10.9583 12.525 10.875C12.375 10.7917 12.25 10.6833 12.15 10.55L11.3 9.25L9.95 13.3C9.88333 13.5 9.75833 13.6667 9.575 13.8C9.39167 13.9333 9.19167 14 8.975 14C8.80833 14 8.65 13.9583 8.5 13.875C8.35 13.7917 8.23333 13.6833 8.15 13.55L6.45 11H2V13H7V18Z",fill:"currentColor"})),D4t=v(K)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",height:"100%"})),Dm=v(K)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(.5,2,.5,2)})),L4t=v(Dm)(({theme:e})=>({flex:1,justifyContent:"flex-end",alignItems:"flex-end"})),N4t=v($4t)(({theme:e})=>({color:e.palette.primary.light,marginRight:e.spacing(1.5)})),Wv=v(K)(({theme:e})=>({display:"block",marginLeft:"auto",color:e.palette.primary.main,fontWeight:e.typography.fontWeightBold,fontSize:e.fontSizes.mediumHeader})),Tj=v("div")(({theme:e})=>({padding:e.spacing(3),fontSize:e.fontSizes.smallBody})),F4t=v(Tj)(({theme:e})=>({flexGrow:1,display:"flex",flexDirection:"column"})),B4t=v("div")(()=>({display:"flex",justifyContent:"space-between",alignItems:"center"})),z4t=v(Wv)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),H4t=({value:e,technicalDebt:t,healthy:n,stale:r,potentiallyStale:o,title:s})=>i.jsxs(D4t,{children:[i.jsx(B4t,{children:i.jsx(Tj,{children:s})}),i.jsx(pr,{}),i.jsx(Tj,{children:i.jsxs(Dm,{children:[i.jsx(N4t,{}),"Technical debt",i.jsx(z4t,{children:`${t}%`})]})}),i.jsx(pr,{}),i.jsxs(F4t,{children:[i.jsxs(Dm,{children:["Healthy flags",i.jsx(Wv,{children:n||0})]}),i.jsxs(Dm,{children:["Stale flags",i.jsx(Wv,{children:r||0})]}),i.jsxs(Dm,{children:["Potentially stale flags",i.jsx(Wv,{children:o||0})]}),i.jsx(L4t,{children:i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/insights#health",target:"_blank",rel:"noreferrer",children:"What affects technical debt?"})})]})]}),uv=(e,t)=>g.useMemo(()=>t.length<1||t[0]===pa.id?e:e.filter(r=>t.includes(r.project)),[e,t]);function W4t(e){if(!e||e.length===0||!("project"in e[0]))return{};const t={};return e.forEach(n=>{const{project:r}=n;t[r]||(t[r]=[]),t[r].push(n)}),t}const dv=e=>g.useMemo(()=>W4t(e),[JSON.stringify(e)]),V4t=e=>!!e&&typeof e.timeToProduction=="number"&&e.timeToProduction!==0,U4t=e=>g.useMemo(()=>{const t=e.reduce((u,d)=>d.week>u?d.week:u,""),n=e.filter(u=>u.week===t),r=n.reduce((u,d)=>u+(d.users||0),0)/n.length||0,o=n.reduce((u,d)=>({total:u.total+d.total,active:u.active+d.active,stale:u.stale+d.stale,potentiallyStale:u.potentiallyStale+d.potentiallyStale,averageUsers:r}),{total:0,active:0,stale:0,potentiallyStale:0}),s=n.filter(V4t).map(u=>u.timeToProduction);s.sort((u,d)=>u-d);const a=Math.floor(s.length/2),l=s.length%2===0?(s[a-1]+s[a])/2:s[a],c=Number.isNaN(l)?void 0:l;return{...o,averageUsers:r,averageHealth:o.total?(o.active/(o.total||1)*100).toFixed(0):"100",technicalDebt:o.total?((o.stale+o.potentiallyStale)/o.total*100).toFixed(0):"0",medianTimeToProduction:c}},[e]),G4t=e=>g.useMemo(()=>{const t=new Set;return e.forEach(n=>{t.add(n.date)}),Array.from(t).sort()},[e]),$se=(e,t)=>{const n=G4t(e.metricsSummaryTrends),r=uv(e.projectFlagTrends,t),o=dv(r),s=uv(e.metricsSummaryTrends,t),a=dv(s),l=U4t(r),c=uv(e.lifecycleTrends,t),u=dv(c),d=uv(e.creationArchiveTrends,t),p=dv(d);return g.useMemo(()=>({...e,projectsData:r,groupedProjectsData:o,metricsData:s,groupedMetricsData:a,environmentTypeTrends:e.environmentTypeTrends,summary:l,allMetricsDatapoints:n,lifecycleData:c,groupedLifecycleData:u,groupedCreationArchiveData:p}),[e,t,r,o,s,a,l,c,u,p])},q4t={lessThanXSeconds:{one:{regular:"méně než 1 sekunda",past:"před méně než 1 sekundou",future:"za méně než 1 sekundu"},few:{regular:"méně než {{count}} sekundy",past:"před méně než {{count}} sekundami",future:"za méně než {{count}} sekundy"},many:{regular:"méně než {{count}} sekund",past:"před méně než {{count}} sekundami",future:"za méně než {{count}} sekund"}},xSeconds:{one:{regular:"1 sekunda",past:"před 1 sekundou",future:"za 1 sekundu"},few:{regular:"{{count}} sekundy",past:"před {{count}} sekundami",future:"za {{count}} sekundy"},many:{regular:"{{count}} sekund",past:"před {{count}} sekundami",future:"za {{count}} sekund"}},halfAMinute:{type:"other",other:{regular:"půl minuty",past:"před půl minutou",future:"za půl minuty"}},lessThanXMinutes:{one:{regular:"méně než 1 minuta",past:"před méně než 1 minutou",future:"za méně než 1 minutu"},few:{regular:"méně než {{count}} minuty",past:"před méně než {{count}} minutami",future:"za méně než {{count}} minuty"},many:{regular:"méně než {{count}} minut",past:"před méně než {{count}} minutami",future:"za méně než {{count}} minut"}},xMinutes:{one:{regular:"1 minuta",past:"před 1 minutou",future:"za 1 minutu"},few:{regular:"{{count}} minuty",past:"před {{count}} minutami",future:"za {{count}} minuty"},many:{regular:"{{count}} minut",past:"před {{count}} minutami",future:"za {{count}} minut"}},aboutXHours:{one:{regular:"přibližně 1 hodina",past:"přibližně před 1 hodinou",future:"přibližně za 1 hodinu"},few:{regular:"přibližně {{count}} hodiny",past:"přibližně před {{count}} hodinami",future:"přibližně za {{count}} hodiny"},many:{regular:"přibližně {{count}} hodin",past:"přibližně před {{count}} hodinami",future:"přibližně za {{count}} hodin"}},xHours:{one:{regular:"1 hodina",past:"před 1 hodinou",future:"za 1 hodinu"},few:{regular:"{{count}} hodiny",past:"před {{count}} hodinami",future:"za {{count}} hodiny"},many:{regular:"{{count}} hodin",past:"před {{count}} hodinami",future:"za {{count}} hodin"}},xDays:{one:{regular:"1 den",past:"před 1 dnem",future:"za 1 den"},few:{regular:"{{count}} dny",past:"před {{count}} dny",future:"za {{count}} dny"},many:{regular:"{{count}} dní",past:"před {{count}} dny",future:"za {{count}} dní"}},aboutXWeeks:{one:{regular:"přibližně 1 týden",past:"přibližně před 1 týdnem",future:"přibližně za 1 týden"},few:{regular:"přibližně {{count}} týdny",past:"přibližně před {{count}} týdny",future:"přibližně za {{count}} týdny"},many:{regular:"přibližně {{count}} týdnů",past:"přibližně před {{count}} týdny",future:"přibližně za {{count}} týdnů"}},xWeeks:{one:{regular:"1 týden",past:"před 1 týdnem",future:"za 1 týden"},few:{regular:"{{count}} týdny",past:"před {{count}} týdny",future:"za {{count}} týdny"},many:{regular:"{{count}} týdnů",past:"před {{count}} týdny",future:"za {{count}} týdnů"}},aboutXMonths:{one:{regular:"přibližně 1 měsíc",past:"přibližně před 1 měsícem",future:"přibližně za 1 měsíc"},few:{regular:"přibližně {{count}} měsíce",past:"přibližně před {{count}} měsíci",future:"přibližně za {{count}} měsíce"},many:{regular:"přibližně {{count}} měsíců",past:"přibližně před {{count}} měsíci",future:"přibližně za {{count}} měsíců"}},xMonths:{one:{regular:"1 měsíc",past:"před 1 měsícem",future:"za 1 měsíc"},few:{regular:"{{count}} měsíce",past:"před {{count}} měsíci",future:"za {{count}} měsíce"},many:{regular:"{{count}} měsíců",past:"před {{count}} měsíci",future:"za {{count}} měsíců"}},aboutXYears:{one:{regular:"přibližně 1 rok",past:"přibližně před 1 rokem",future:"přibližně za 1 rok"},few:{regular:"přibližně {{count}} roky",past:"přibližně před {{count}} roky",future:"přibližně za {{count}} roky"},many:{regular:"přibližně {{count}} roků",past:"přibližně před {{count}} roky",future:"přibližně za {{count}} roků"}},xYears:{one:{regular:"1 rok",past:"před 1 rokem",future:"za 1 rok"},few:{regular:"{{count}} roky",past:"před {{count}} roky",future:"za {{count}} roky"},many:{regular:"{{count}} roků",past:"před {{count}} roky",future:"za {{count}} roků"}},overXYears:{one:{regular:"více než 1 rok",past:"před více než 1 rokem",future:"za více než 1 rok"},few:{regular:"více než {{count}} roky",past:"před více než {{count}} roky",future:"za více než {{count}} roky"},many:{regular:"více než {{count}} roků",past:"před více než {{count}} roky",future:"za více než {{count}} roků"}},almostXYears:{one:{regular:"skoro 1 rok",past:"skoro před 1 rokem",future:"skoro za 1 rok"},few:{regular:"skoro {{count}} roky",past:"skoro před {{count}} roky",future:"skoro za {{count}} roky"},many:{regular:"skoro {{count}} roků",past:"skoro před {{count}} roky",future:"skoro za {{count}} roků"}}},Y4t=(e,t,n)=>{let r;const o=q4t[e];o.type==="other"?r=o.other:t===1?r=o.one:t>1&&t<5?r=o.few:r=o.many;const s=(n==null?void 0:n.addSuffix)===!0,a=n==null?void 0:n.comparison;let l;return s&&a===-1?l=r.past:s&&a===1?l=r.future:l=r.regular,l.replace("{{count}}",String(t))},K4t={full:"EEEE, d. MMMM yyyy",long:"d. MMMM yyyy",medium:"d. M. yyyy",short:"dd.MM.yyyy"},X4t={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},J4t={full:"{{date}} 'v' {{time}}",long:"{{date}} 'v' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Z4t={date:nr({formats:K4t,defaultWidth:"full"}),time:nr({formats:X4t,defaultWidth:"full"}),dateTime:nr({formats:J4t,defaultWidth:"full"})},Q4t=["neděli","pondělí","úterý","středu","čtvrtek","pátek","sobotu"],e6t={lastWeek:"'poslední' eeee 've' p",yesterday:"'včera v' p",today:"'dnes v' p",tomorrow:"'zítra v' p",nextWeek:e=>{const t=e.getDay();return"'v "+Q4t[t]+" o' p"},other:"P"},t6t=(e,t)=>{const n=e6t[e];return typeof n=="function"?n(t):n},n6t={narrow:["př. n. l.","n. l."],abbreviated:["př. n. l.","n. l."],wide:["před naším letopočtem","našeho letopočtu"]},r6t={narrow:["1","2","3","4"],abbreviated:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"],wide:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"]},o6t={narrow:["L","Ú","B","D","K","Č","Č","S","Z","Ř","L","P"],abbreviated:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],wide:["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"]},s6t={narrow:["L","Ú","B","D","K","Č","Č","S","Z","Ř","L","P"],abbreviated:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],wide:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"]},i6t={narrow:["ne","po","út","st","čt","pá","so"],short:["ne","po","út","st","čt","pá","so"],abbreviated:["ned","pon","úte","stř","čtv","pát","sob"],wide:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"]},a6t={narrow:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},abbreviated:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},wide:{am:"dopoledne",pm:"odpoledne",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"}},l6t={narrow:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},abbreviated:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},wide:{am:"dopoledne",pm:"odpoledne",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"}},c6t=(e,t)=>Number(e)+".",u6t={ordinalNumber:c6t,era:bn({values:n6t,defaultWidth:"wide"}),quarter:bn({values:r6t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:o6t,defaultWidth:"wide",formattingValues:s6t,defaultFormattingWidth:"wide"}),day:bn({values:i6t,defaultWidth:"wide"}),dayPeriod:bn({values:a6t,defaultWidth:"wide",formattingValues:l6t,defaultFormattingWidth:"wide"})},d6t=/^(\d+)\.?/i,p6t=/\d+/i,f6t={narrow:/^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,abbreviated:/^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,wide:/^(p[řr](\.|ed) Kristem|p[řr](\.|ed) na[šs][íi]m letopo[čc]tem|po Kristu|na[šs]eho letopo[čc]tu)/i},h6t={any:[/^p[řr]/i,/^(po|n)/i]},g6t={narrow:/^[1234]/i,abbreviated:/^[1234]\. [čc]tvrtlet[íi]/i,wide:/^[1234]\. [čc]tvrtlet[íi]/i},m6t={any:[/1/i,/2/i,/3/i,/4/i]},y6t={narrow:/^[lúubdkčcszřrlp]/i,abbreviated:/^(led|[úu]no|b[řr]e|dub|kv[ěe]|[čc]vn|[čc]vc|srp|z[áa][řr]|[řr][íi]j|lis|pro)/i,wide:/^(leden|ledna|[úu]nora?|b[řr]ezen|b[řr]ezna|duben|dubna|kv[ěe]ten|kv[ěe]tna|[čc]erven(ec|ce)?|[čc]ervna|srpen|srpna|z[áa][řr][íi]|[řr][íi]jen|[řr][íi]jna|listopad(a|u)?|prosinec|prosince)/i},x6t={narrow:[/^l/i,/^[úu]/i,/^b/i,/^d/i,/^k/i,/^[čc]/i,/^[čc]/i,/^s/i,/^z/i,/^[řr]/i,/^l/i,/^p/i],any:[/^led/i,/^[úu]n/i,/^b[řr]e/i,/^dub/i,/^kv[ěe]/i,/^[čc]vn|[čc]erven(?!\w)|[čc]ervna/i,/^[čc]vc|[čc]erven(ec|ce)/i,/^srp/i,/^z[áa][řr]/i,/^[řr][íi]j/i,/^lis/i,/^pro/i]},v6t={narrow:/^[npuúsčps]/i,short:/^(ne|po|[úu]t|st|[čc]t|p[áa]|so)/i,abbreviated:/^(ned|pon|[úu]te|st[rř]|[čc]tv|p[áa]t|sob)/i,wide:/^(ned[ěe]le|pond[ěe]l[íi]|[úu]ter[ýy]|st[řr]eda|[čc]tvrtek|p[áa]tek|sobota)/i},b6t={narrow:[/^n/i,/^p/i,/^[úu]/i,/^s/i,/^[čc]/i,/^p/i,/^s/i],any:[/^ne/i,/^po/i,/^[úu]t/i,/^st/i,/^[čc]t/i,/^p[áa]/i,/^so/i]},C6t={any:/^dopoledne|dop\.?|odpoledne|odp\.?|p[ůu]lnoc|poledne|r[áa]no|odpoledne|ve[čc]er|(v )?noci?/i},w6t={any:{am:/^dop/i,pm:/^odp/i,midnight:/^p[ůu]lnoc/i,noon:/^poledne/i,morning:/r[áa]no/i,afternoon:/odpoledne/i,evening:/ve[čc]er/i,night:/noc/i}},S6t={ordinalNumber:Qu({matchPattern:d6t,parsePattern:p6t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:f6t,defaultMatchWidth:"wide",parsePatterns:h6t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:g6t,defaultMatchWidth:"wide",parsePatterns:m6t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:y6t,defaultMatchWidth:"wide",parsePatterns:x6t,defaultParseWidth:"any"}),day:Cn({matchPatterns:v6t,defaultMatchWidth:"wide",parsePatterns:b6t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:C6t,defaultMatchWidth:"any",parsePatterns:w6t,defaultParseWidth:"any"})},j6t={code:"cs",formatDistance:Y4t,formatLong:Z4t,formatRelative:t6t,localize:u6t,match:S6t,options:{weekStartsOn:1,firstWeekContainsDate:4}},E6t={lessThanXSeconds:{one:"mindre end ét sekund",other:"mindre end {{count}} sekunder"},xSeconds:{one:"1 sekund",other:"{{count}} sekunder"},halfAMinute:"ét halvt minut",lessThanXMinutes:{one:"mindre end ét minut",other:"mindre end {{count}} minutter"},xMinutes:{one:"1 minut",other:"{{count}} minutter"},aboutXHours:{one:"cirka 1 time",other:"cirka {{count}} timer"},xHours:{one:"1 time",other:"{{count}} timer"},xDays:{one:"1 dag",other:"{{count}} dage"},aboutXWeeks:{one:"cirka 1 uge",other:"cirka {{count}} uger"},xWeeks:{one:"1 uge",other:"{{count}} uger"},aboutXMonths:{one:"cirka 1 måned",other:"cirka {{count}} måneder"},xMonths:{one:"1 måned",other:"{{count}} måneder"},aboutXYears:{one:"cirka 1 år",other:"cirka {{count}} år"},xYears:{one:"1 år",other:"{{count}} år"},overXYears:{one:"over 1 år",other:"over {{count}} år"},almostXYears:{one:"næsten 1 år",other:"næsten {{count}} år"}},k6t=(e,t,n)=>{let r;const o=E6t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"om "+r:r+" siden":r},T6t={full:"EEEE 'den' d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd/MM/y"},R6t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},A6t={full:"{{date}} 'kl'. {{time}}",long:"{{date}} 'kl'. {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},P6t={date:nr({formats:T6t,defaultWidth:"full"}),time:nr({formats:R6t,defaultWidth:"full"}),dateTime:nr({formats:A6t,defaultWidth:"full"})},_6t={lastWeek:"'sidste' eeee 'kl.' p",yesterday:"'i går kl.' p",today:"'i dag kl.' p",tomorrow:"'i morgen kl.' p",nextWeek:"'på' eeee 'kl.' p",other:"P"},I6t=(e,t,n,r)=>_6t[e],O6t={narrow:["fvt","vt"],abbreviated:["f.v.t.","v.t."],wide:["før vesterlandsk tidsregning","vesterlandsk tidsregning"]},M6t={narrow:["1","2","3","4"],abbreviated:["1. kvt.","2. kvt.","3. kvt.","4. kvt."],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},$6t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],wide:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},D6t={narrow:["S","M","T","O","T","F","L"],short:["sø","ma","ti","on","to","fr","lø"],abbreviated:["søn.","man.","tir.","ons.","tor.","fre.","lør."],wide:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},L6t={narrow:{am:"a",pm:"p",midnight:"midnat",noon:"middag",morning:"morgen",afternoon:"eftermiddag",evening:"aften",night:"nat"},abbreviated:{am:"AM",pm:"PM",midnight:"midnat",noon:"middag",morning:"morgen",afternoon:"eftermiddag",evening:"aften",night:"nat"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnat",noon:"middag",morning:"morgen",afternoon:"eftermiddag",evening:"aften",night:"nat"}},N6t={narrow:{am:"a",pm:"p",midnight:"midnat",noon:"middag",morning:"om morgenen",afternoon:"om eftermiddagen",evening:"om aftenen",night:"om natten"},abbreviated:{am:"AM",pm:"PM",midnight:"midnat",noon:"middag",morning:"om morgenen",afternoon:"om eftermiddagen",evening:"om aftenen",night:"om natten"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnat",noon:"middag",morning:"om morgenen",afternoon:"om eftermiddagen",evening:"om aftenen",night:"om natten"}},F6t=(e,t)=>Number(e)+".",B6t={ordinalNumber:F6t,era:bn({values:O6t,defaultWidth:"wide"}),quarter:bn({values:M6t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:$6t,defaultWidth:"wide"}),day:bn({values:D6t,defaultWidth:"wide"}),dayPeriod:bn({values:L6t,defaultWidth:"wide",formattingValues:N6t,defaultFormattingWidth:"wide"})},z6t=/^(\d+)(\.)?/i,H6t=/\d+/i,W6t={narrow:/^(fKr|fvt|eKr|vt)/i,abbreviated:/^(f\.Kr\.?|f\.v\.t\.?|e\.Kr\.?|v\.t\.)/i,wide:/^(f.Kr.|før vesterlandsk tidsregning|e.Kr.|vesterlandsk tidsregning)/i},V6t={any:[/^f/i,/^(v|e)/i]},U6t={narrow:/^[1234]/i,abbreviated:/^[1234]. kvt\./i,wide:/^[1234]\.? kvartal/i},G6t={any:[/1/i,/2/i,/3/i,/4/i]},q6t={narrow:/^[jfmasond]/i,abbreviated:/^(jan.|feb.|mar.|apr.|maj|jun.|jul.|aug.|sep.|okt.|nov.|dec.)/i,wide:/^(januar|februar|marts|april|maj|juni|juli|august|september|oktober|november|december)/i},Y6t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^maj/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},K6t={narrow:/^[smtofl]/i,short:/^(søn.|man.|tir.|ons.|tor.|fre.|lør.)/i,abbreviated:/^(søn|man|tir|ons|tor|fre|lør)/i,wide:/^(søndag|mandag|tirsdag|onsdag|torsdag|fredag|lørdag)/i},X6t={narrow:[/^s/i,/^m/i,/^t/i,/^o/i,/^t/i,/^f/i,/^l/i],any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},J6t={narrow:/^(a|p|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i,any:/^([ap]\.?\s?m\.?|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i},Z6t={any:{am:/^a/i,pm:/^p/i,midnight:/midnat/i,noon:/middag/i,morning:/morgen/i,afternoon:/eftermiddag/i,evening:/aften/i,night:/nat/i}},Q6t={ordinalNumber:Qu({matchPattern:z6t,parsePattern:H6t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:W6t,defaultMatchWidth:"wide",parsePatterns:V6t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:U6t,defaultMatchWidth:"wide",parsePatterns:G6t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:q6t,defaultMatchWidth:"wide",parsePatterns:Y6t,defaultParseWidth:"any"}),day:Cn({matchPatterns:K6t,defaultMatchWidth:"wide",parsePatterns:X6t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:J6t,defaultMatchWidth:"any",parsePatterns:Z6t,defaultParseWidth:"any"})},e5t={code:"da",formatDistance:k6t,formatLong:P6t,formatRelative:I6t,localize:B6t,match:Q6t,options:{weekStartsOn:1,firstWeekContainsDate:4}},gW={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},t5t=(e,t,n)=>{let r;const o=n!=null&&n.addSuffix?gW[e].withPreposition:gW[e].standalone;return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:"vor "+r:r},n5t={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},r5t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},o5t={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},s5t={date:nr({formats:n5t,defaultWidth:"full"}),time:nr({formats:r5t,defaultWidth:"full"}),dateTime:nr({formats:o5t,defaultWidth:"full"})},i5t={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},a5t=(e,t,n,r)=>i5t[e],l5t={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},c5t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},Rj={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},u5t={narrow:Rj.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:Rj.wide},d5t={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},p5t={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},f5t={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},h5t=e=>Number(e)+".",g5t={ordinalNumber:h5t,era:bn({values:l5t,defaultWidth:"wide"}),quarter:bn({values:c5t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:Rj,formattingValues:u5t,defaultWidth:"wide"}),day:bn({values:d5t,defaultWidth:"wide"}),dayPeriod:bn({values:p5t,defaultWidth:"wide",formattingValues:f5t,defaultFormattingWidth:"wide"})},m5t=/^(\d+)(\.)?/i,y5t=/\d+/i,x5t={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},v5t={any:[/^v/i,/^n/i]},b5t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},C5t={any:[/1/i,/2/i,/3/i,/4/i]},w5t={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},S5t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},j5t={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},E5t={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},k5t={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},T5t={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},R5t={ordinalNumber:Qu({matchPattern:m5t,parsePattern:y5t,valueCallback:e=>parseInt(e)}),era:Cn({matchPatterns:x5t,defaultMatchWidth:"wide",parsePatterns:v5t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:b5t,defaultMatchWidth:"wide",parsePatterns:C5t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:w5t,defaultMatchWidth:"wide",parsePatterns:S5t,defaultParseWidth:"any"}),day:Cn({matchPatterns:j5t,defaultMatchWidth:"wide",parsePatterns:E5t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:k5t,defaultMatchWidth:"wide",parsePatterns:T5t,defaultParseWidth:"any"})},A5t={code:"de",formatDistance:t5t,formatLong:s5t,formatRelative:a5t,localize:g5t,match:R5t,options:{weekStartsOn:1,firstWeekContainsDate:4}},P5t={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},_5t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},I5t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},O5t={date:nr({formats:P5t,defaultWidth:"full"}),time:nr({formats:_5t,defaultWidth:"full"}),dateTime:nr({formats:I5t,defaultWidth:"full"})},M5t={code:"en-GB",formatDistance:Jk,formatLong:O5t,formatRelative:Zk,localize:Qk,match:eT,options:{weekStartsOn:1,firstWeekContainsDate:4}},$5t={full:"EEEE, d MMMM yyyy",long:"d MMMM, yyyy",medium:"d MMM, yyyy",short:"dd/MM/yyyy"},D5t={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},L5t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},N5t={date:nr({formats:$5t,defaultWidth:"full"}),time:nr({formats:D5t,defaultWidth:"full"}),dateTime:nr({formats:L5t,defaultWidth:"full"})},F5t={code:"en-IN",formatDistance:Jk,formatLong:N5t,formatRelative:Zk,localize:Qk,match:eT,options:{weekStartsOn:1,firstWeekContainsDate:4}},B5t={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},z5t=(e,t,n)=>{let r;const o=B5t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"dans "+r:"il y a "+r:r},H5t={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},W5t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},V5t={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},U5t={date:nr({formats:H5t,defaultWidth:"full"}),time:nr({formats:W5t,defaultWidth:"full"}),dateTime:nr({formats:V5t,defaultWidth:"full"})},G5t={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},q5t=(e,t,n,r)=>G5t[e],Y5t={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},K5t={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},X5t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},J5t={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},Z5t={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},Q5t=(e,t)=>{const n=Number(e),r=t==null?void 0:t.unit;if(n===0)return"0";const o=["year","week","hour","minute","second"];let s;return n===1?s=r&&o.includes(r)?"ère":"er":s="ème",n+s},e7t=["MMM","MMMM"],t7t={preprocessor:(e,t)=>e.getDate()===1||!t.some(r=>r.isToken&&e7t.includes(r.value))?t:t.map(r=>r.isToken&&r.value==="do"?{isToken:!0,value:"d"}:r),ordinalNumber:Q5t,era:bn({values:Y5t,defaultWidth:"wide"}),quarter:bn({values:K5t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:X5t,defaultWidth:"wide"}),day:bn({values:J5t,defaultWidth:"wide"}),dayPeriod:bn({values:Z5t,defaultWidth:"wide"})},n7t=/^(\d+)(ième|ère|ème|er|e)?/i,r7t=/\d+/i,o7t={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},s7t={any:[/^av/i,/^ap/i]},i7t={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},a7t={any:[/1/i,/2/i,/3/i,/4/i]},l7t={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},c7t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},u7t={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},d7t={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},p7t={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},f7t={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},h7t={ordinalNumber:Qu({matchPattern:n7t,parsePattern:r7t,valueCallback:e=>parseInt(e)}),era:Cn({matchPatterns:o7t,defaultMatchWidth:"wide",parsePatterns:s7t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:i7t,defaultMatchWidth:"wide",parsePatterns:a7t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:l7t,defaultMatchWidth:"wide",parsePatterns:c7t,defaultParseWidth:"any"}),day:Cn({matchPatterns:u7t,defaultMatchWidth:"wide",parsePatterns:d7t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:p7t,defaultMatchWidth:"any",parsePatterns:f7t,defaultParseWidth:"any"})},g7t={code:"fr",formatDistance:z5t,formatLong:U5t,formatRelative:q5t,localize:t7t,match:h7t,options:{weekStartsOn:1,firstWeekContainsDate:4}},m7t={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},y7t=(e,t,n)=>{n=n||{};let r;const o=m7t[e];return typeof o=="string"?r=o:t===1?n.addSuffix&&o.oneWithSuffix?r=o.oneWithSuffix:r=o.one:n.addSuffix&&o.otherWithSuffix?r=o.otherWithSuffix.replace("{{count}}",String(t)):r=o.other.replace("{{count}}",String(t)),n.addSuffix?n.comparison&&n.comparison>0?r+"後":r+"前":r},x7t={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},v7t={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},b7t={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},C7t={date:nr({formats:x7t,defaultWidth:"full"}),time:nr({formats:v7t,defaultWidth:"full"}),dateTime:nr({formats:b7t,defaultWidth:"full"})},w7t={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},S7t=(e,t,n,r)=>w7t[e],j7t={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},E7t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},k7t={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},T7t={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},R7t={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},A7t={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},P7t=(e,t)=>{const n=Number(e);switch(String(t==null?void 0:t.unit)){case"year":return`${n}年`;case"quarter":return`第${n}四半期`;case"month":return`${n}月`;case"week":return`第${n}週`;case"date":return`${n}日`;case"hour":return`${n}時`;case"minute":return`${n}分`;case"second":return`${n}秒`;default:return`${n}`}},_7t={ordinalNumber:P7t,era:bn({values:j7t,defaultWidth:"wide"}),quarter:bn({values:E7t,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:bn({values:k7t,defaultWidth:"wide"}),day:bn({values:T7t,defaultWidth:"wide"}),dayPeriod:bn({values:R7t,defaultWidth:"wide",formattingValues:A7t,defaultFormattingWidth:"wide"})},I7t=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,O7t=/\d+/i,M7t={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},$7t={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},D7t={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},L7t={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},N7t={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},F7t={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},B7t={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},z7t={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},H7t={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},W7t={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},V7t={ordinalNumber:Qu({matchPattern:I7t,parsePattern:O7t,valueCallback:function(e){return parseInt(e,10)}}),era:Cn({matchPatterns:M7t,defaultMatchWidth:"wide",parsePatterns:$7t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:D7t,defaultMatchWidth:"wide",parsePatterns:L7t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:N7t,defaultMatchWidth:"wide",parsePatterns:F7t,defaultParseWidth:"any"}),day:Cn({matchPatterns:B7t,defaultMatchWidth:"wide",parsePatterns:z7t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:H7t,defaultMatchWidth:"any",parsePatterns:W7t,defaultParseWidth:"any"})},U7t={code:"ja",formatDistance:y7t,formatLong:C7t,formatRelative:S7t,localize:_7t,match:V7t,options:{weekStartsOn:0,firstWeekContainsDate:1}},G7t={lessThanXSeconds:{one:"mindre enn ett sekund",other:"mindre enn {{count}} sekunder"},xSeconds:{one:"ett sekund",other:"{{count}} sekunder"},halfAMinute:"et halvt minutt",lessThanXMinutes:{one:"mindre enn ett minutt",other:"mindre enn {{count}} minutter"},xMinutes:{one:"ett minutt",other:"{{count}} minutter"},aboutXHours:{one:"omtrent en time",other:"omtrent {{count}} timer"},xHours:{one:"en time",other:"{{count}} timer"},xDays:{one:"en dag",other:"{{count}} dager"},aboutXWeeks:{one:"omtrent en uke",other:"omtrent {{count}} uker"},xWeeks:{one:"en uke",other:"{{count}} uker"},aboutXMonths:{one:"omtrent en måned",other:"omtrent {{count}} måneder"},xMonths:{one:"en måned",other:"{{count}} måneder"},aboutXYears:{one:"omtrent ett år",other:"omtrent {{count}} år"},xYears:{one:"ett år",other:"{{count}} år"},overXYears:{one:"over ett år",other:"over {{count}} år"},almostXYears:{one:"nesten ett år",other:"nesten {{count}} år"}},q7t=(e,t,n)=>{let r;const o=G7t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"om "+r:r+" siden":r},Y7t={full:"EEEE d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd.MM.y"},K7t={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},X7t={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},J7t={date:nr({formats:Y7t,defaultWidth:"full"}),time:nr({formats:K7t,defaultWidth:"full"}),dateTime:nr({formats:X7t,defaultWidth:"full"})},Z7t={lastWeek:"'forrige' eeee 'kl.' p",yesterday:"'i går kl.' p",today:"'i dag kl.' p",tomorrow:"'i morgen kl.' p",nextWeek:"EEEE 'kl.' p",other:"P"},Q7t=(e,t,n,r)=>Z7t[e],e8t={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["før Kristus","etter Kristus"]},t8t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},n8t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mars","apr.","mai","juni","juli","aug.","sep.","okt.","nov.","des."],wide:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"]},r8t={narrow:["S","M","T","O","T","F","L"],short:["sø","ma","ti","on","to","fr","lø"],abbreviated:["søn","man","tir","ons","tor","fre","lør"],wide:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},o8t={narrow:{am:"a",pm:"p",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},abbreviated:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morgenen",afternoon:"på ettermiddagen",evening:"på kvelden",night:"på natten"}},s8t=(e,t)=>Number(e)+".",i8t={ordinalNumber:s8t,era:bn({values:e8t,defaultWidth:"wide"}),quarter:bn({values:t8t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:n8t,defaultWidth:"wide"}),day:bn({values:r8t,defaultWidth:"wide"}),dayPeriod:bn({values:o8t,defaultWidth:"wide"})},a8t=/^(\d+)\.?/i,l8t=/\d+/i,c8t={narrow:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,abbreviated:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,wide:/^(før Kristus|før vår tid|etter Kristus|vår tid)/i},u8t={any:[/^f/i,/^e/i]},d8t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? kvartal/i},p8t={any:[/1/i,/2/i,/3/i,/4/i]},f8t={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mars?|apr|mai|juni?|juli?|aug|sep|okt|nov|des)\.?/i,wide:/^(januar|februar|mars|april|mai|juni|juli|august|september|oktober|november|desember)/i},h8t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^aug/i,/^s/i,/^o/i,/^n/i,/^d/i]},g8t={narrow:/^[smtofl]/i,short:/^(sø|ma|ti|on|to|fr|lø)/i,abbreviated:/^(søn|man|tir|ons|tor|fre|lør)/i,wide:/^(søndag|mandag|tirsdag|onsdag|torsdag|fredag|lørdag)/i},m8t={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},y8t={narrow:/^(midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten)|[ap])/i,any:/^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten))/i},x8t={any:{am:/^a(\.?\s?m\.?)?$/i,pm:/^p(\.?\s?m\.?)?$/i,midnight:/^midn/i,noon:/^midd/i,morning:/morgen/i,afternoon:/ettermiddag/i,evening:/kveld/i,night:/natt/i}},v8t={ordinalNumber:Qu({matchPattern:a8t,parsePattern:l8t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:c8t,defaultMatchWidth:"wide",parsePatterns:u8t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:d8t,defaultMatchWidth:"wide",parsePatterns:p8t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:f8t,defaultMatchWidth:"wide",parsePatterns:h8t,defaultParseWidth:"any"}),day:Cn({matchPatterns:g8t,defaultMatchWidth:"wide",parsePatterns:m8t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:y8t,defaultMatchWidth:"any",parsePatterns:x8t,defaultParseWidth:"any"})},b8t={code:"nb",formatDistance:q7t,formatLong:J7t,formatRelative:Q7t,localize:i8t,match:v8t,options:{weekStartsOn:1,firstWeekContainsDate:4}},C8t={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},w8t=(e,t,n)=>{let r;const o=C8t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+r:"há "+r:r},S8t={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},j8t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},E8t={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},k8t={date:nr({formats:S8t,defaultWidth:"full"}),time:nr({formats:j8t,defaultWidth:"full"}),dateTime:nr({formats:E8t,defaultWidth:"full"})},T8t={lastWeek:e=>{const t=e.getDay();return"'"+(t===0||t===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},R8t=(e,t,n,r)=>{const o=T8t[e];return typeof o=="function"?o(t):o},A8t={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},P8t={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},_8t={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},I8t={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},O8t={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},M8t={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},$8t=(e,t)=>{const n=Number(e);return(t==null?void 0:t.unit)==="week"?n+"ª":n+"º"},D8t={ordinalNumber:$8t,era:bn({values:A8t,defaultWidth:"wide"}),quarter:bn({values:P8t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:_8t,defaultWidth:"wide"}),day:bn({values:I8t,defaultWidth:"wide"}),dayPeriod:bn({values:O8t,defaultWidth:"wide",formattingValues:M8t,defaultFormattingWidth:"wide"})},L8t=/^(\d+)[ºªo]?/i,N8t=/\d+/i,F8t={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},B8t={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},z8t={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},H8t={any:[/1/i,/2/i,/3/i,/4/i]},W8t={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},V8t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},U8t={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},G8t={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},q8t={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},Y8t={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},K8t={ordinalNumber:Qu({matchPattern:L8t,parsePattern:N8t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:F8t,defaultMatchWidth:"wide",parsePatterns:B8t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:z8t,defaultMatchWidth:"wide",parsePatterns:H8t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:W8t,defaultMatchWidth:"wide",parsePatterns:V8t,defaultParseWidth:"any"}),day:Cn({matchPatterns:U8t,defaultMatchWidth:"wide",parsePatterns:G8t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:q8t,defaultMatchWidth:"any",parsePatterns:Y8t,defaultParseWidth:"any"})},X8t={code:"pt-BR",formatDistance:w8t,formatLong:k8t,formatRelative:R8t,localize:D8t,match:K8t,options:{weekStartsOn:0,firstWeekContainsDate:1}},J8t={lessThanXSeconds:{one:"mindre än en sekund",other:"mindre än {{count}} sekunder"},xSeconds:{one:"en sekund",other:"{{count}} sekunder"},halfAMinute:"en halv minut",lessThanXMinutes:{one:"mindre än en minut",other:"mindre än {{count}} minuter"},xMinutes:{one:"en minut",other:"{{count}} minuter"},aboutXHours:{one:"ungefär en timme",other:"ungefär {{count}} timmar"},xHours:{one:"en timme",other:"{{count}} timmar"},xDays:{one:"en dag",other:"{{count}} dagar"},aboutXWeeks:{one:"ungefär en vecka",other:"ungefär {{count}} veckor"},xWeeks:{one:"en vecka",other:"{{count}} veckor"},aboutXMonths:{one:"ungefär en månad",other:"ungefär {{count}} månader"},xMonths:{one:"en månad",other:"{{count}} månader"},aboutXYears:{one:"ungefär ett år",other:"ungefär {{count}} år"},xYears:{one:"ett år",other:"{{count}} år"},overXYears:{one:"över ett år",other:"över {{count}} år"},almostXYears:{one:"nästan ett år",other:"nästan {{count}} år"}},Z8t=["noll","en","två","tre","fyra","fem","sex","sju","åtta","nio","tio","elva","tolv"],Q8t=(e,t,n)=>{let r;const o=J8t[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t<13?Z8t[t]:String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"om "+r:r+" sedan":r},e9t={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"y-MM-dd"},t9t={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},n9t={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},r9t={date:nr({formats:e9t,defaultWidth:"full"}),time:nr({formats:t9t,defaultWidth:"full"}),dateTime:nr({formats:n9t,defaultWidth:"full"})},o9t={lastWeek:"'i' EEEE's kl.' p",yesterday:"'igår kl.' p",today:"'idag kl.' p",tomorrow:"'imorgon kl.' p",nextWeek:"EEEE 'kl.' p",other:"P"},s9t=(e,t,n,r)=>o9t[e],i9t={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["före Kristus","efter Kristus"]},a9t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1:a kvartalet","2:a kvartalet","3:e kvartalet","4:e kvartalet"]},l9t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],wide:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},c9t={narrow:["S","M","T","O","T","F","L"],short:["sö","må","ti","on","to","fr","lö"],abbreviated:["sön","mån","tis","ons","tors","fre","lör"],wide:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},u9t={narrow:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"morg.",afternoon:"efterm.",evening:"kväll",night:"natt"},abbreviated:{am:"f.m.",pm:"e.m.",midnight:"midnatt",noon:"middag",morning:"morgon",afternoon:"efterm.",evening:"kväll",night:"natt"},wide:{am:"förmiddag",pm:"eftermiddag",midnight:"midnatt",noon:"middag",morning:"morgon",afternoon:"eftermiddag",evening:"kväll",night:"natt"}},d9t={narrow:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på efterm.",evening:"på kvällen",night:"på natten"},abbreviated:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på efterm.",evening:"på kvällen",night:"på natten"},wide:{am:"fm",pm:"em",midnight:"midnatt",noon:"middag",morning:"på morgonen",afternoon:"på eftermiddagen",evening:"på kvällen",night:"på natten"}},p9t=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:case 2:return n+":a"}return n+":e"},f9t={ordinalNumber:p9t,era:bn({values:i9t,defaultWidth:"wide"}),quarter:bn({values:a9t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:bn({values:l9t,defaultWidth:"wide"}),day:bn({values:c9t,defaultWidth:"wide"}),dayPeriod:bn({values:u9t,defaultWidth:"wide",formattingValues:d9t,defaultFormattingWidth:"wide"})},h9t=/^(\d+)(:a|:e)?/i,g9t=/\d+/i,m9t={narrow:/^(f\.? ?Kr\.?|f\.? ?v\.? ?t\.?|e\.? ?Kr\.?|v\.? ?t\.?)/i,abbreviated:/^(f\.? ?Kr\.?|f\.? ?v\.? ?t\.?|e\.? ?Kr\.?|v\.? ?t\.?)/i,wide:/^(före Kristus|före vår tid|efter Kristus|vår tid)/i},y9t={any:[/^f/i,/^[ev]/i]},x9t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](:a|:e)? kvartalet/i},v9t={any:[/1/i,/2/i,/3/i,/4/i]},b9t={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar[s]?|apr|maj|jun[i]?|jul[i]?|aug|sep|okt|nov|dec)\.?/i,wide:/^(januari|februari|mars|april|maj|juni|juli|augusti|september|oktober|november|december)/i},C9t={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^maj/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},w9t={narrow:/^[smtofl]/i,short:/^(sö|må|ti|on|to|fr|lö)/i,abbreviated:/^(sön|mån|tis|ons|tors|fre|lör)/i,wide:/^(söndag|måndag|tisdag|onsdag|torsdag|fredag|lördag)/i},S9t={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},j9t={any:/^([fe]\.?\s?m\.?|midn(att)?|midd(ag)?|(på) (morgonen|eftermiddagen|kvällen|natten))/i},E9t={any:{am:/^f/i,pm:/^e/i,midnight:/^midn/i,noon:/^midd/i,morning:/morgon/i,afternoon:/eftermiddag/i,evening:/kväll/i,night:/natt/i}},k9t={ordinalNumber:Qu({matchPattern:h9t,parsePattern:g9t,valueCallback:e=>parseInt(e,10)}),era:Cn({matchPatterns:m9t,defaultMatchWidth:"wide",parsePatterns:y9t,defaultParseWidth:"any"}),quarter:Cn({matchPatterns:x9t,defaultMatchWidth:"wide",parsePatterns:v9t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Cn({matchPatterns:b9t,defaultMatchWidth:"wide",parsePatterns:C9t,defaultParseWidth:"any"}),day:Cn({matchPatterns:w9t,defaultMatchWidth:"wide",parsePatterns:S9t,defaultParseWidth:"any"}),dayPeriod:Cn({matchPatterns:j9t,defaultMatchWidth:"any",parsePatterns:E9t,defaultParseWidth:"any"})},T9t={code:"sv",formatDistance:Q8t,formatLong:r9t,formatRelative:s9t,localize:f9t,match:k9t,options:{weekStartsOn:1,firstWeekContainsDate:4}},R9t={cs:j6t,"da-DK":e5t,de:A5t,"en-GB":M5t,"en-IN":F5t,"en-US":kf,"fr-FR":g7t,ja:U7t,"nb-NO":b8t,"pt-BR":X8t,"sv-SE":T9t},Dse=e=>R9t[e]??kf,Lse=(e="Unknown date range")=>{const{locationSettings:t}=$r(),n=Dse(t.locale);return r=>{const o=r[0].raw;if("date"in o&&typeof o.date=="string"&&"endDate"in o&&typeof o.endDate=="string"){const s=Jo(Zs(new Date(o.date),{locale:n,weekStartsOn:1}),"PP",{locale:n}),a=Jo(new Date(o.endDate),"PP",{locale:n});return`${s} – ${a}`}return e}},A9t=e=>{const t=Lse(),n={parsing:{yAxisKey:"newProductionFlags",xAxisKey:"date"}};switch(e.state){case"Batched":return{...n,scales:{x:{time:{unit:"month",tooltipFormat:"P"},ticks:{source:"auto"}}},plugins:{tooltip:{callbacks:{title:t}}}};case"Weekly":return n;case"Not Enough Data":case"Loading":return{}}},P9t=({chartData:e})=>{const t=A9t(e);return i.jsx(ad,{data:e.value,overrideOptions:t,cover:e.state==="Not Enough Data"?i.jsx(Jl,{}):e.state==="Loading"})},_9t=e=>t=>{var r,o;const n=t.tooltip;if(n.opacity===0){e(null);return}e({caretX:n==null?void 0:n.caretX,caretY:n==null?void 0:n.caretY,title:((r=n==null?void 0:n.title)==null?void 0:r.join(" "))||"",align:n==null?void 0:n.xAlign,body:((o=n==null?void 0:n.body)==null?void 0:o.map((s,a)=>{var l,c,u;return{title:(l=s==null?void 0:s.lines)==null?void 0:l.join(" "),color:(u=(c=n==null?void 0:n.labelColors)==null?void 0:c[a])==null?void 0:u.borderColor,value:""}}))||[],dataPoints:(n==null?void 0:n.dataPoints)||[]})},I9t=v("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),O9t=v("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.typography.body2.fontSize})),M9t=v("span")(({theme:e})=>({display:"inline-block",minWidth:8,minHeight:8,borderRadius:"50%",marginRight:e.spacing(1)})),Aj=16,$9t=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",D9t=(e=0,t)=>t==="left"?e+Aj:t==="right"?e-Aj:e,Nse=({tooltip:e,children:t})=>i.jsx(K,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+Aj,left:D9t(e==null?void 0:e.caretX,e==null?void 0:e.align),width:"1px",position:"absolute",display:e?"flex":"none",pointerEvents:"none",zIndex:n.zIndex.tooltip,flexDirection:"column",alignItems:$9t(e==null?void 0:e.align)}),children:t}),aYt=({tooltip:e})=>i.jsx(Nse,{tooltip:e,children:i.jsxs(qr,{elevation:3,sx:t=>({width:"max-content",padding:t.spacing(1.5,2)}),children:[i.jsx(J,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),i.jsx(I9t,{children:e==null?void 0:e.body.map(t=>i.jsxs(O9t,{children:[i.jsx(M9t,{sx:{backgroundColor:t.color},children:" "}),i.jsx(mr,{lines:2,children:t.title})]},a0(t)))})]})}),Fse=(e,t)=>t===0?"N/A":`${Math.round(e/t*100)}%`,L9t=v(qr)(({theme:e})=>({padding:e.spacing(1.5),display:"flex",flexFlow:"column",gap:e.spacing(.5)})),N9t=v("dl")(({theme:e})=>({margin:0})),mW=v("div",{shouldForwardProp:e=>e!=="dataType"})(({theme:e,dataType:t})=>({display:"flex",justifyContent:"space-between",alignItems:"center",whiteSpace:"nowrap",fontSize:e.typography.body2.fontSize,"dt::before":{content:'" "',display:"inline-block",height:".65rem",aspectRatio:"1/1",borderRadius:"50%",marginInlineEnd:e.spacing(.5),backgroundColor:t==="archived"?e.palette.charts.A2:e.palette.charts.A1}})),F9t=v("span")(({theme:e})=>({whiteSpace:"nowrap",fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),B9t=({tooltip:e})=>{if(!(e!=null&&e.dataPoints))return null;const t=e.dataPoints[0].raw,{archivedFlags:n,totalCreatedFlags:r}=t.state==="withRatio"?t:{archivedFlags:0,totalCreatedFlags:0},o=Fse(n,r);return i.jsx(Nse,{tooltip:e,children:i.jsxs(L9t,{elevation:3,children:[i.jsxs(J,{variant:"body2",component:"span",fontWeight:"bold",children:["Ratio ",o]}),i.jsxs(N9t,{children:[i.jsxs(mW,{dataType:"archived",children:[i.jsx("dt",{children:"Flags archived"}),i.jsx("dd",{children:n})]}),i.jsxs(mW,{dataType:"created",children:[i.jsx("dt",{children:"Flags created"}),i.jsx("dd",{children:r})]})]}),i.jsx(F9t,{children:e.title})]})})},z9t=.8,H9t=e=>{var n,r,o;const t=((n=e.data.datasets[0])==null?void 0:n.data)??e.scales.x.ticks;return e.width/t.length*(((o=(r=e.options.datasets)==null?void 0:r.bar)==null?void 0:o.categoryPercentage)??z9t)},W9t=e=>({id:"customLine",beforeDraw:t=>{var a;const{width:n=H9t,maxHighlightOpacity:r=.12,bottomOverflow:o=0}=e??{},s=typeof n=="function"?n(t):n;if((a=t.tooltip)!=null&&a.opacity&&t.tooltip.x){const l=t.tooltip.caretX,c=t.scales.y,u=t.ctx;u.save();const d=u.createLinearGradient(l,c.top,l,c.bottom+o);d.addColorStop(0,"rgba(129, 122, 254, 0)"),d.addColorStop(1,`rgba(129, 122, 254, ${r})`),u.fillStyle=d;const p=[l-s/2,c.top,s,c.bottom-c.top+o];o?(u.roundRect(...p,5),u.fill()):u.fillRect(...p),u.restore()}}}),yW=[{archivedFlags:3,totalCreatedFlags:4,archivePercentage:75,week:"2025-30",date:"2025-07-27T01:00:00.000Z"},{archivedFlags:7,totalCreatedFlags:3,archivePercentage:140,week:"2025-31",date:"2025-08-03T01:00:00.000Z"},{archivedFlags:2,totalCreatedFlags:3,archivePercentage:50,week:"2025-32",date:"2025-08-10T01:00:00.000Z"},{archivedFlags:2,totalCreatedFlags:6,archivePercentage:25,week:"2025-33",date:"2025-08-17T00:40:40.606Z"},{archivedFlags:4,totalCreatedFlags:9,archivePercentage:66.66666666666666,week:"2025-34",date:"2025-08-24T00:29:19.583Z"}],xW={datasets:[{label:"Flags archived",data:yW,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},order:1},{label:"Flags created",data:yW,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},order:2}]},Bse="label";function vW(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function V9t(e,t){Object.assign(e.options,t)}function zse(e,t){e.labels=t}function Hse(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bse;const r=[];e.datasets=t.map(o=>{const s=e.datasets.find(a=>a[n]===o[n]);return!s||!o.data||r.includes(s)?{...o}:(r.push(s),Object.assign(s,o),s)})}function U9t(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bse;const n={labels:[],datasets:[]};return zse(n,e.labels),Hse(n,e.datasets,t),n}function G9t(e,t){let{height:n=150,width:r=300,redraw:o=!1,datasetIdKey:s,type:a,data:l,options:c,plugins:u=[],fallbackContent:d,updateMode:p,...f}=e;const h=g.useRef(null),m=g.useRef(),y=()=>{h.current&&(m.current=new x0(h.current,{type:a,data:U9t(l,s),options:c&&{...c},plugins:u}),vW(t,m.current))},b=()=>{vW(t,null),m.current&&(m.current.destroy(),m.current=null)};return g.useEffect(()=>{!o&&m.current&&c&&V9t(m.current,c)},[o,c]),g.useEffect(()=>{!o&&m.current&&zse(m.current.config.data,l.labels)},[o,l.labels]),g.useEffect(()=>{!o&&m.current&&l.datasets&&Hse(m.current.config.data,l.datasets,s)},[o,l.datasets]),g.useEffect(()=>{m.current&&(o?(b(),setTimeout(y)):m.current.update(p))},[o,c,l.labels,l.datasets,p]),g.useEffect(()=>{m.current&&(b(),setTimeout(y))},[a]),g.useEffect(()=>(y(),()=>b()),[]),tt.createElement("canvas",Object.assign({ref:h,role:"img",height:n,width:r},f),d)}const q9t=g.forwardRef(G9t);function Wse(e,t){return x0.register(t),g.forwardRef((n,r)=>tt.createElement(q9t,Object.assign({},n,{ref:r,type:e})))}const Y9t=Wse("line",a8),K9t=Wse("bar",i8),X9t=v("div")(({theme:e})=>({position:"absolute",inset:0,display:"flex",zIndex:e.zIndex.appBar,"&::before":{zIndex:e.zIndex.fab,content:'""',position:"absolute",inset:0,backgroundColor:e.palette.background.paper,opacity:.8}})),J9t=v("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),Z9t=({children:e})=>i.jsx(X9t,{children:i.jsx(J9t,{children:e})}),Q9t=4,Vse=({merge:e,map:t,batchSize:n=Q9t})=>r=>r.reduce((o,s,a)=>{const l=Math.floor(a/n),c=o[l];return c?o[l]=e(c,s):o[l]=t(s),o},[]),ebt=e=>({merge:(t,n)=>{if(n.state==="empty")return{...t,endDate:n.date};switch(t.state){case"empty":return{...t,state:"withRatio",totalCreatedFlags:n.totalCreatedFlags,archivedFlags:n.archivedFlags,archivePercentage:n.archivePercentage,endDate:n.date};case"withRatio":{const r=t.totalCreatedFlags+n.totalCreatedFlags,o=t.archivedFlags+n.archivedFlags,s=r>0?o/r*100:0;return{...t,endDate:n.date,totalCreatedFlags:r,archivedFlags:o,archivePercentage:s}}}},map:t=>{const{week:n,...r}=t;return{...r,endDate:t.date}},batchSize:e}),tbt=(e,t)=>Vse(ebt(t))(e),nbt=(e,t)=>{if(!t)return e;const n=Object.values(t.createdFlags).reduce((r,o)=>r+o);switch(e.state){case"empty":return{...e,state:"populated",archivedFlags:t.archivedFlags,totalCreatedFlags:n};case"populated":return{...e,archivedFlags:e.archivedFlags+t.archivedFlags,totalCreatedFlags:e.totalCreatedFlags+n}}},rbt=e=>({...e,state:"withRatio",archivePercentage:e.totalCreatedFlags>0?e.archivedFlags/e.totalCreatedFlags*100:0}),obt=(e,t)=>e.map(({week:n,date:r})=>t.map(a=>a.data.find(l=>l.week===n)).reduce(nbt,{week:n,date:r,state:"empty"})??{week:n,date:r,state:"empty"}).map(n=>n.state==="empty"?n:rbt(n));x0.register(w3,d8,jy,id,u8,v0,Ase,Tse,kvt);const bW=4,CW=e=>({backgroundColor:e,borderColor:e,hoverBackgroundColor:e,hoverBorderColor:e}),wW=(e,t)=>({datasets:[{label:"Flags archived",data:e,order:1,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},...CW(t.palette.charts.A2)},{label:"Flags created",data:e,order:2,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},...CW(t.palette.charts.A1)}]}),sbt=({creationArchiveTrends:e,isLoading:t,labels:n})=>{const r=ky(e),o=Bt(),{locationSettings:s}=$r(),[a,l]=g.useState(null),c=g.useMemo(()=>{if(t)return{state:"Loading",value:xW};const m=obt(n,r.datasets);return m.length<2?{state:"Not Enough Data",value:xW}:m.length>=12?{state:"Batched",batchSize:bW,value:wW(tbt(m,bW),o)}:{state:"Weekly",value:wW(m,o)}},[r,o]),u=["Loading","Not Enough Data"].includes(c.state),d=c.state==="Not Enough Data",p=Dse(s.locale),f=Lse(),h=g.useMemo(()=>({responsive:!0,...u?{animation:{duration:0}}:{},interaction:{mode:"index",intersect:!1},datasets:{bar:{borderRadius:4}},plugins:{legend:{position:"bottom",labels:{color:o.palette.text.secondary,usePointStyle:!0,padding:21,boxHeight:8},display:!u},tooltip:{enabled:!1,position:"average",external:_9t(l),callbacks:{title:c.state==="Batched"?f:void 0}}},locale:s.locale,scales:{x:{adapters:{date:{locale:p}},type:"time",display:!0,time:{unit:c.state==="Batched"?"month":"week",tooltipFormat:"P"},grid:{display:!1},ticks:{source:c.state==="Batched"?"auto":"data",display:!u}},y:{type:"linear",position:"left",beginAtZero:!0,title:{display:!0,text:"Number of flags"},ticks:{stepSize:1,display:!u}}}}),[o,s,l,u]);return i.jsxs(i.Fragment,{children:[i.jsx(K9t,{data:c.value,options:h,height:100,width:250,plugins:[W9t({maxHighlightOpacity:.24})]}),i.jsx(B9t,{tooltip:a}),u?i.jsx(Z9t,{children:d?i.jsx(Jl,{}):t}):null]})},ibt=e=>{const{totalCreated:t,totalArchived:n}=Object.values(e).reduce((r,o)=>{const{created:s,archived:a}=o.reduce((l,c)=>{const u=c.createdFlags?Object.values(c.createdFlags).reduce((d,p)=>d+p,0):0;return{created:l.created+u,archived:l.archived+(c.archivedFlags??0)}},{created:0,archived:0});return{totalCreated:r.totalCreated+s,totalArchived:r.totalArchived+a}},{totalCreated:0,totalArchived:0});return Fse(n,t)};var bI={},abt=je;Object.defineProperty(bI,"__esModule",{value:!0});var CI=bI.default=void 0,lbt=abt(Ee()),cbt=i,ubt=(0,lbt.default)((0,cbt.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"}),"LightbulbOutlined");CI=bI.default=ubt;const dbt=v(K)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.spacing(2),padding:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(.5)})),pbt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between"})),fbt=v(J)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(2.5),fontWeight:"bold"})),hbt=v(yi)(({theme:e})=>({color:e.palette.text.secondary})),gbt=v(ft)(({theme:e})=>({color:e.palette.primary.main,textDecoration:"none","&:hover":{textDecoration:"underline"},fontSize:e.spacing(1.75)})),Use=({value:e,label:t,tooltip:n,explanation:r,link:o,isLoading:s})=>i.jsxs(i.Fragment,{children:[i.jsxs(dbt,{children:[i.jsxs(pbt,{children:[i.jsx(fbt,{children:s?"...":e}),i.jsx(Zo,{tooltip:n,children:i.jsx(hbt,{})})]}),i.jsx(J,{variant:"body2",children:t})]}),i.jsxs(r2t,{children:[i.jsx(CI,{color:"primary"}),r]}),o&&i.jsx(gbt,{to:o.to,children:o.text})]}),mbt=({groupedCreationArchiveData:e,isLoading:t})=>{const n=ibt(e);return i.jsx(Use,{value:n,label:"Average ratio",tooltip:"Ratio of archived flags to created flags in the selected period",explanation:"Do you create more flags than you archive? Or do you have good process for cleaning up?",link:{to:"/search?lifecycle=IS:completed",text:"View flags in cleanup stage"},isLoading:t})},ybt=({median:e,chartData:t})=>{const n=t.state==="Batched"?`Median per ${t.batchSize} weeks`:"Median per week";return i.jsx(Use,{value:e,label:n,tooltip:"The median number of flags that have entered production for the selected time range.",explanation:"How often do flags go live in production?",isLoading:t.state==="Loading"})},xbt=e=>({merge:(t,n)=>(n.newProductionFlags&&(t.newProductionFlags=(t.newProductionFlags??0)+n.newProductionFlags),n.date&&(t.date||(t.date=n.date),t.endDate=n.date),t),map:t=>({...t,endDate:t.date}),batchSize:e}),Gse=(e,t)=>Vse(xbt(t))(e),vbt=e=>{const t={};for(const o of e)for(const{week:s,newProductionFlags:a}of o.data)a!==void 0&&(t[s]=(t[s]??0)+a);const n=Object.values(t).toSorted((o,s)=>o-s);if(n.length===0)return"N/A";const r=Math.floor(n.length/2);return n.length%2===0?(n[r-1]+n[r])/2:n[r]},bbt=e=>e.state==="Weekly"||e.state==="Batched",Pj=4,Cbt=({labels:e,lifecycleData:t,shouldBatchData:n})=>{if(t.datasets.length===0)return[{label:"No data",data:e}];const r=o=>{const s=e.map(({date:a,week:l})=>o.find(c=>(c==null?void 0:c.week)===l)??{date:a,week:l});return n?Gse(s,Pj):s};return t.datasets.map(({data:o,...s})=>({...s,data:r(o)}))},wbt=({groupedLifecycleData:e,showAllProjects:t,loading:n,labels:r})=>{const o=ky(e),s=Bt(),a=ld(),l=r.length>=12,c=g.useMemo(()=>{if(n)return{state:"Loading",value:a};if(r.length<2)return{state:"Not Enough Data",value:a};const h=r.map(({week:y,date:b})=>o.datasets.map(x=>x.data.find(C=>C.week===y)).reduce((x,C)=>(C&&C.newProductionFlags!==void 0&&(x.newProductionFlags=(x.newProductionFlags??0)+C.newProductionFlags),x),{date:b,week:y})),m=y=>({datasets:[{label:"Number of new flags",data:y,borderColor:s.palette.primary.light,backgroundColor:Ey,fill:!0,order:3}]});return l?{state:"Batched",value:m(Gse(h,Pj)),batchSize:Pj}:{state:"Weekly",value:m(h)}},[o,s,n]);if(!bbt(c))return{chartData:c,median:"N/A"};const{value:u,...d}=c,p=t?u:{datasets:Cbt({labels:r,lifecycleData:o,shouldBatchData:l})},f=vbt(p.datasets);return{chartData:{...d,value:p},median:f}},Sbt=({groupedLifecycleData:e,loading:t,showAllProjects:n,labels:r})=>{const{median:o,chartData:s}=wbt({groupedLifecycleData:e,labels:r,loading:t,showAllProjects:n});return i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"New flags in production"}),i.jsx(ybt,{chartData:s,median:o})]}),i.jsx(Hd,{children:i.jsx(P9t,{chartData:s})})]})},jbt=()=>{var S,E,T;const e="performance-",t=`${e}from`,n=`${e}to`,r={[`${e}project`]:ur,[t]:Hr(ur,{values:[Jo(G5(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[n]:Hr(ur,{values:[Jo(new Date,"yyyy-MM-dd")],operator:"IS"})},[o,s]=If("insights",r,[t,n]),a=R=>{s(_=>k_(_,R,{fromKey:t,toKey:n}))},{insights:l,loading:c}=Aoe((S=o[t])==null?void 0:S.values[0],(E=o[n])==null?void 0:E.values[0]),u=((T=o[`${e}project`])==null?void 0:T.values)??[pa.id],d=u[0]===pa.id,{flagTrends:p,summary:f,groupedProjectsData:h,groupedLifecycleData:m,groupedMetricsData:y,allMetricsDatapoints:b,environmentTypeTrends:x,groupedCreationArchiveData:C}=$se(l,u),{isEnterprise:w}=ut(),j=p[p.length-1],k=(j==null?void 0:j.total)??0;return i.jsxs(eI,{title:"Performance insights",filters:i.jsx(tI,{state:o,onChange:a,filterNamePrefix:e}),children:[w()?i.jsx(Sbt,{groupedLifecycleData:m,loading:c,showAllProjects:d,labels:l.labels}):null,w()?i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"Flags archived vs flags created"}),i.jsx(mbt,{groupedCreationArchiveData:C,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(sbt,{labels:l.labels,creationArchiveTrends:C,isLoading:c})})]}):null,d?i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"Flags"}),i.jsx(hW,{count:k,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(s4t,{flagTrends:p,isLoading:c})})]}):i.jsxs(Tu,{children:[i.jsxs(D1,{width:275,children:[i.jsx(Ru,{title:"Flags"}),i.jsx(hW,{count:f.total,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(a4t,{projectFlagTrends:h,isLoading:c})})]}),w()?i.jsxs(Tu,{children:[i.jsx(D1,{width:350,padding:0,children:i.jsx(H4t,{value:f.averageHealth,technicalDebt:f.technicalDebt,healthy:f.active,stale:f.stale,potentiallyStale:f.potentiallyStale,title:i.jsx(Ru,{title:"Technical debt",tooltip:"Percentage of flags that are stale or potentially stale."})})}),i.jsx(Hd,{children:i.jsx(S4t,{projectFlagTrends:h,isAggregate:d,isLoading:c})})]}):null,w()?i.jsxs(i.Fragment,{children:[i.jsx(Tu,{children:i.jsxs(Jz,{children:[i.jsx(Ru,{title:"Flag evaluation metrics",tooltip:"Summary of all flag evaluations reported by SDKs."}),i.jsx(Hd,{children:i.jsx(g4t,{metricsSummaryTrends:y,allDatapointsSorted:b,isAggregate:d,isLoading:c})})]})}),i.jsx(Tu,{children:i.jsxs(Jz,{children:[i.jsx(Ru,{title:"Updates per environment type",tooltip:"Summary of all configuration updates per environment type."}),i.jsx(P4t,{environmentTypeTrends:x,isLoading:c})]})})]}):null]})},Ebt=({userTrends:e,isLoading:t})=>{const n=Er("showInactiveUsers"),r=Bt(),o=!t&&e.length<2,s=ld({fill:!0,type:"rising"}),a=g.useMemo(()=>({labels:e.map(l=>l.date),datasets:[{label:"Total users",data:e.map(l=>l.total),borderColor:r.palette.primary.light,backgroundColor:Ey,pointBackgroundColor:r.palette.primary.main,fill:!0,order:3},...n?[{label:"Active users",data:e.map(l=>l.active),borderColor:r.palette.success.border,backgroundColor:r.palette.success.border,order:2},{label:"Inactive users",data:e.map(l=>l.inactive),borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border,order:1}]:[]]}),[r,e]);return i.jsx(ad,{data:o||t?s:a,cover:o?i.jsx(Jl,{}):t})},kbt=({projectFlagTrends:e,isLoading:t})=>{const n=ld({type:"constant"}),r=ky(e),o=g.useMemo(()=>!t&&!r.datasets.some(s=>s.data.length>1),[r,t]);return i.jsx(ad,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"users",xAxisKey:"date"}},cover:o?i.jsx(Jl,{}):t})},Tbt=v(K)(({theme:e})=>({padding:`${e.spacing(1.5)} ${e.spacing(2)}`,borderRadius:`${e.shape.borderRadius}px`,border:`1px solid ${e.palette.divider}`})),Rbt=v(K)(({theme:e,type:t})=>({width:8,height:8,backgroundColor:t==="active"?e.palette.success.border:e.palette.warning.border,borderRadius:"2px",marginRight:e.spacing(1)})),Abt=v(K)(()=>({display:"flex",alignItems:"center",width:"100%"})),Pbt=v(K)(()=>({display:"flex",flexDirection:"column"})),_bt=v(J)(()=>({marginLeft:"auto",fontWeight:"normal"})),SW=({type:e,count:t,percentage:n})=>i.jsx(Tbt,{children:i.jsxs(Abt,{children:[i.jsxs(Pbt,{children:[i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(Rbt,{type:e}),i.jsxs(J,{variant:"body1",component:"span",children:[e==="active"?"Active":"Inactive"," users"]})]}),i.jsxs(J,{variant:"body2",children:[n,"%"]})]}),i.jsx(_bt,{variant:"h2",children:t})]})}),Ibt=v(K)(({theme:e})=>({position:"relative"})),Obt=v(K)(({theme:e})=>({borderRadius:`${e.shape.borderRadiusExtraLarge}px`,backgroundColor:e.palette.background.alternative,maxWidth:300,padding:e.spacing(2),margin:`0 auto ${e.spacing(3)}`,position:"relative",zIndex:2})),Mbt=v(K)(({theme:e})=>({maxWidth:270,height:"54px",backgroundColor:"rgba(108, 101, 229, 0.30)",position:"absolute",margin:"0 auto",top:"45px",left:"15px",right:"15px",borderRadius:`${e.shape.borderRadiusExtraLarge}px`,zIndex:1})),$bt=v(K)(({theme:e})=>({marginBottom:e.spacing(2.5)})),Dbt=v(J)(({theme:e})=>({color:e.palette.primary.contrastText,fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,margin:0,padding:0})),Lbt=v(K)({display:"flex",flexDirection:"column",gap:"12px"}),Nbt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(3)})),Fbt=v(ft)({fontWeight:"bold",textDecoration:"none",display:"flex",justifyContent:"center"}),Bbt=v(K)(()=>({"&:before":{background:"transparent"}})),jW=({count:e,active:t,inactive:n,isLoading:r})=>{const s=Er("showInactiveUsers")&&t!==void 0&&n!==void 0,a=(t||0)/e*100;return i.jsxs(i.Fragment,{children:[i.jsxs(Ibt,{children:[i.jsx(Obt,{children:i.jsx(Dbt,{variant:"h2",children:i.jsx(te,{condition:r!==!0,show:Number.parseInt(`${e}`,10)===e?e:e.toFixed(2),elseShow:i.jsx(Bbt,{className:"skeleton",children:" "})})})}),i.jsx(Mbt,{})]}),i.jsx(te,{condition:s,show:i.jsxs(i.Fragment,{children:[i.jsx($bt,{children:i.jsx(Mse,{sections:[{type:"success",value:a},{type:"warning",value:100-a}]})}),i.jsxs(Lbt,{children:[i.jsx(SW,{type:"active",percentage:`${a}`,count:`${t}`}),i.jsx(SW,{type:"inactive",percentage:`${100-a}`,count:`${n}`})]})]})}),i.jsx(Nbt,{children:i.jsxs(Fbt,{to:"/admin/users",children:["View users ",i.jsx(DA,{})]})})]})},zbt=()=>{var w,j,k;const e="users-",t=`${e}from`,n=`${e}to`,r={[`${e}project`]:ur,[t]:Hr(ur,{values:[Jo(G5(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[n]:Hr(ur,{values:[Jo(new Date,"yyyy-MM-dd")],operator:"IS"})},[o,s]=If("insights-users",r,[t,n]),a=S=>{s(E=>k_(E,S,{fromKey:t,toKey:n}))},{insights:l,loading:c}=Aoe((w=o[t])==null?void 0:w.values[0],(j=o[n])==null?void 0:j.values[0]),u=((k=o["users-project"])==null?void 0:k.values)??[pa.id],d=u[0]===pa.id,{summary:p,groupedProjectsData:f,userTrends:h}=$se(l,u),m=h[h.length-1],y=(m==null?void 0:m.total)??0,b=(m==null?void 0:m.active)??0,x=(m==null?void 0:m.inactive)??0,C=u.length===1;return i.jsx(eI,{title:"User insights",filters:i.jsx(tI,{state:o,onChange:a,filterNamePrefix:e}),children:d?i.jsxs(Tu,{children:[i.jsxs(D1,{children:[i.jsx(Ru,{title:"Total users"}),i.jsx(jW,{count:y,active:b,inactive:x,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(Ebt,{userTrends:h,isLoading:c})})]}):i.jsxs(Tu,{children:[i.jsxs(D1,{children:[i.jsx(Ru,{title:C?"Users in project":"Users per project on average",tooltip:C?"Number of users in selected projects.":"Average number of users for selected projects."}),i.jsx(jW,{count:p.averageUsers,isLoading:c})]}),i.jsx(Hd,{children:i.jsx(kbt,{projectFlagTrends:f,isLoading:c})})]})})},Hbt=v("div")(({theme:e})=>({paddingTop:e.spacing(2)})),Wbt=()=>i.jsxs(Hbt,{children:[i.jsx(t2t,{}),i.jsxs(n2t,{children:[i.jsx(C2t,{}),i.jsx(jbt,{}),i.jsx(zbt,{})]})]}),Vbt=g.lazy(()=>La(()=>import("./ImpactMetricsPage-DQ3DugFo.js"),[]).then(e=>({default:e.ImpactMetricsPage}))),_j="api/admin/feedback",Ubt=yt(_j),Gbt=(e={})=>{const t=()=>fetch(Ubt,{method:"GET"}).then(en("FeedbackPosted")).then(l=>l.json()),{data:n,error:r}=On(_j,t,e),[o,s]=g.useState(!r&&!n),a=()=>{Fo(_j)};return g.useEffect(()=>{s(!r&&!n)},[n,r]),{feedback:n||[],error:r,loading:o,refetchFeedback:a}};function qbt(e){if(!e||e.length===0)return[];const t=new Date;t.setMonth(t.getMonth()-3);const r=e.filter(o=>new Date(o.createdAt)>=t).reduce((o,s)=>{const a=s.category;return o[a]||(o[a]=[]),o[a].push(s),o},{});return Object.entries(r).map(([o,s])=>{const a=s.length,l=s.filter(u=>u.difficultyScore!==null).map(u=>u.difficultyScore),c=l.length>0?(l.reduce((u,d)=>u+d,0)/l.length).toFixed(1):"N/A";return{category:o,commentCount:a,averageScore:c}})}const rC=v(J)(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(1)})),Ybt=v("div")(({theme:e})=>({fontSize:e.fontSizes.mediumHeader})),Kbt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexWrap:"wrap",marginBottom:e.spacing(4)})),Xbt=v("div")(({theme:e})=>({backgroundColor:e.palette.secondary.light,borderRadius:`${e.shape.borderRadiusLarge}px`,padding:e.spacing(3),display:"flex",alignItems:"flex-start",gap:e.spacing(10)})),Jbt=()=>{const{feedback:e}=Gbt(),[t,n]=g.useState(""),r=[{Header:"Feature",accessor:"category",minWidth:100,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.category}),searchable:!0},{Header:"User Type",accessor:"userType",Cell:({row:{original:p}})=>i.jsx(vn,{children:p.userType}),searchable:!0},{Header:"Score",accessor:"difficultyScore",maxWidth:90,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.difficultyScore})},{Header:"What do you like most?",accessor:"positive",minWidth:100,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.positive}),disableSortBy:!0,searchable:!0},{Header:"What should be improved?",accessor:"areasForImprovement",minWidth:100,Cell:({row:{original:p}})=>i.jsx(vn,{children:p.areasForImprovement}),disableSortBy:!0,searchable:!0},{Header:"Date",accessor:"createdAt",Cell:Cp}],{data:o,getSearchText:s}=Af(r,t,e),a=g.useMemo(()=>qbt(o),[o]),{headerGroups:l,rows:c,prepareRow:u}=on.useTable({columns:r,data:o,initialState:{sortBy:[{id:"createdAt",desc:!0}]},sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:vn}},on.useSortBy,on.useFlexLayout),d=Nn(br.breakpoints.down("md"));return i.jsxs(ir,{header:i.jsx($n,{title:"Feedback",actions:i.jsx(i.Fragment,{children:i.jsx(te,{condition:!d,show:i.jsxs(i.Fragment,{children:[i.jsx(No,{initialValue:t,onChange:n}),i.jsx($n.Divider,{})]})})}),children:i.jsx(te,{condition:d,show:i.jsx(No,{initialValue:t,onChange:n})})}),children:[i.jsx(rC,{children:"Active experiments"}),i.jsx(Kbt,{children:a.length>0?a.map(p=>i.jsxs(Xbt,{children:[i.jsxs(K,{children:[i.jsx(rC,{children:p.category}),i.jsxs(K,{children:[p.commentCount," comments"]})]}),i.jsx(Ybt,{children:isNaN(Number(p.averageScore))?"N/A":`${p.averageScore}/7`})]},p.category)):i.jsx(K,{sx:{py:2},children:"No feedback data from the last three months"})}),i.jsxs(rC,{children:["All feedback (",c.length,")"]}),i.jsx(Ai,{value:s(t),children:i.jsx(Wp,{rows:c,headerGroups:l,prepareRow:u})})]})};var wI={},Zbt=je;Object.defineProperty(wI,"__esModule",{value:!0});var qse=wI.default=void 0,Qbt=Zbt(Ee()),eCt=i,tCt=(0,Qbt.default)((0,eCt.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"}),"Link");qse=wI.default=tCt;const nCt=e=>{const t=g.useMemo(()=>({sortBy:[{id:"lastSeen",desc:!0}]}),[]),n=g.useMemo(()=>[{Header:"Instances",accessor:"instanceId",Cell:wi,styles:{width:"45%"}},{Header:"SDK",accessor:"sdkVersion",Cell:wi,styles:{width:"20%"}},{Header:"Last seen",accessor:"lastSeen",Cell:l0,styles:{width:"20%"}},{Header:"IP",accessor:"ip",Cell:wi,styles:{width:"15%"}}],[]),{getTableProps:r,getTableBodyProps:o,headerGroups:s,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d}=on.useTable({columns:n,data:e,initialState:t,sortTypes:Ds,autoResetHiddenColumns:!1,disableSortRemove:!0},on.useGlobalFilter,on.useSortBy);return{getTableProps:r,getTableBodyProps:o,headerGroups:s,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d,columns:n}},rCt=({loading:e,rows:t,getTableProps:n,getTableBodyProps:r,headerGroups:o,prepareRow:s})=>i.jsxs(i.Fragment,{children:[i.jsx(K,{sx:{overflowX:"auto"},children:i.jsxs(gX,{...n(),children:[i.jsx(Sa,{headerGroups:o}),i.jsx(Ji,{...r(),children:t.map(a=>{s(a);const{key:l,...c}=a.getRowProps();return i.jsx(ti,{hover:!0,...c,children:a.cells.map(u=>{const{key:d,...p}=u.getCellProps();return i.jsx(Ci,{...p,children:u.render("Cell")},d)})},l)})})]})}),i.jsx(te,{condition:t.length===0&&!e,show:i.jsx(Gr,{children:i.jsx("p",{children:"There's no data for any connected instances to display. Have you configured your clients correctly?"})})})]}),oCt={environments:[],featureCount:0,projects:[],issues:{missingStrategies:[]}},Yse=(e,t={})=>{const n=encodeURIComponent(e),r=yt(`api/admin/metrics/applications/${n}/overview`),{data:o,error:s}=On(r,sCt,t);return{data:o||oCt,error:s,loading:!s&&!o}},sCt=async e=>await(await fetch(e).then(en("Application overview"))).json(),iCt=(e,t,n={})=>{const r=encodeURIComponent(e),o=yt(`api/admin/metrics/instances/${r}/environment/${t}`),{data:s,error:a}=Ts(!!t,{instances:[]},o,aCt,n);return{data:s||{instances:[]},error:a,loading:!a&&!s}},aCt=async e=>await(await fetch(e).then(en("Connected instances"))).json(),lCt=e=>{const{data:t}=Yse(e),n=t.environments.map(s=>s.name).sort(),[r,o]=C1e("environment",Hr(ei,n[0]));return g.useEffect(()=>{!r&&n.length>0&&o(n[0])},[JSON.stringify(n)]),{currentEnvironment:r,setCurrentEnvironment:o,environments:n}},cCt=()=>{const{trackEvent:e}=zt();return g.useEffect(()=>{e("sdk-reporting",{props:{eventType:"connected instances opened"}})},[]),()=>{e("sdk-reporting",{props:{eventType:"connected instances environment changed"}})}},uCt=()=>{const e=cCt(),t=ar("name"),{currentEnvironment:n,setCurrentEnvironment:r,environments:o}=lCt(t),{data:s,loading:a}=iCt(t,n),l=g.useMemo(()=>{const h=({instanceId:m,sdkVersion:y,clientIp:b,lastSeen:x})=>({instanceId:m,ip:b||"",sdkVersion:y||"",lastSeen:x||""});return n?s.instances.map(h):[]},[JSON.stringify(s),n]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f}=nCt(l);return i.jsxs(K,{children:[i.jsxs(K,{sx:{mb:3},children:[i.jsx(K,{sx:{mb:2},children:"Select which environment to display data for. Only environments that have received traffic for this application will be shown here."}),i.jsx(te,{condition:!!n,show:i.jsx(P9e,{color:"primary",value:n,exclusive:!0,onChange:(h,m)=>{m!==null&&(e(),r(m))},children:o.map(h=>i.jsx(j9e,{value:h,children:h},h))})})]}),i.jsx(rCt,{loading:a,headerGroups:d,prepareRow:f,getTableBodyProps:u,getTableProps:c,rows:p})]})},dCt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0}),o="api/admin/metrics/applications";return{deleteApplication:async a=>{const l=`${o}/${encodeURIComponent(a)}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},pCt=(e,t={})=>{const n=encodeURIComponent(e),r=yt(`api/admin/metrics/applications/${n}`),o=async()=>fetch(r,{method:"GET"}).then(en("Application")).then(p=>p.json()),s=`api/admin/metrics/applications/${n}`,{data:a,error:l}=On(s,o,{...t}),[c,u]=g.useState(!l&&!a),d=()=>{Fo(s)};return g.useEffect(()=>{u(!l&&!a)},[a,l]),{application:a||{appName:n,color:"",createdAt:"2022-02-02T21:04:00.268Z",description:"",instances:[],strategies:[],seenToggles:[],url:""},error:l,loading:c,refetchApplication:d,APPLICATION_CACHE_KEY:s}};var SI={},fCt=je;Object.defineProperty(SI,"__esModule",{value:!0});var jI=SI.default=void 0,hCt=fCt(Ee()),gCt=i,mCt=(0,hCt.default)((0,gCt.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zm0 5h2v2h-2z"}),"WarningAmberRounded");jI=SI.default=mCt;const yCt=v(K)(({theme:e})=>({display:"flex",flexDirection:"column",alignSelf:"stretch",fontSize:e.fontSizes.smallBody})),xCt=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(2,3,2,3),alignItems:"center",gap:e.spacing(1.5),alignSelf:"stretch",borderRadius:`${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px 0 0`,border:`1px solid ${e.palette.warning.border}`,background:e.palette.warning.light,color:e.palette.warning.main})),vCt=v(K)(({theme:e})=>({color:e.palette.warning.dark,fontWeight:e.fontWeight.bold})),EI=v("ul")(({theme:e})=>({padding:e.spacing(0,0,0,2)})),kI=v("li")(({theme:e})=>({fontWeight:e.fontWeight.bold})),bCt=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(3),flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(3),borderRadius:` 0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`,border:`1px solid ${e.palette.warning.border}`})),TI=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(2),flexDirection:"column",justifyContent:"center",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(.5),borderRadius:e.spacing(1),border:`1px solid ${e.palette.divider}`})),RI=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1.5),alignItems:"center"})),Kse=v(ft)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"underline"})),CCt=({features:e})=>{const{hasAccess:t}=g.useContext(Bo),n=e.length;return n===0?null:i.jsxs(TI,{children:[i.jsx(K,{children:`We detected ${n} feature flag${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),i.jsx(EI,{children:e.map(r=>i.jsxs(RI,{children:[i.jsx(kI,{children:r}),i.jsx(te,{condition:t(W4),show:i.jsx(Kse,{to:`/projects/default?create=true&name=${r}`,children:"Create feature flag"},r)})]},r))})]})},wCt=({strategies:e})=>{const{hasAccess:t}=g.useContext(Bo),n=e.length;return n===0?null:i.jsxs(TI,{children:[i.jsx(K,{children:`We detected ${n} strategy type${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),i.jsx(EI,{children:e.map(r=>i.jsxs(RI,{children:[i.jsx(kI,{children:r}),i.jsx(te,{condition:t(V4),show:i.jsx(Kse,{to:"/strategies/create",children:"Create strategy type"},r)})]},r))})]})},SCt=({sdks:e})=>e.length===0?null:i.jsxs(TI,{children:[i.jsx(K,{children:"We detected the following outdated SDKs"}),i.jsx(EI,{children:e.map(t=>i.jsx(RI,{children:i.jsx(kI,{children:t})},t))})]}),Xse=e=>{const t=[...new Set(e.environments.flatMap(o=>o.issues.outdatedSdks))],n=[...new Set(e.environments.flatMap(o=>o.issues.missingFeatures))],r=t.length+n.length+e.issues.missingStrategies.length;return{issueCount:r,outdatedSdks:t,missingFeatures:n,applicationMode:r>0?"warning":"success"}},jCt=({application:e})=>{const t=Xse(e);if(t.applicationMode==="success")return null;const{issueCount:n,outdatedSdks:r,missingFeatures:o}=t;return i.jsxs(yCt,{children:[i.jsxs(xCt,{children:[i.jsx(jI,{}),i.jsxs(vCt,{children:["We detected ",n," issue",n!==1?"s":""," in this application"]})]}),i.jsxs(bCt,{children:[i.jsx(SCt,{sdks:r}),i.jsx(CCt,{features:o}),i.jsx(wCt,{strategies:e.issues.missingStrategies})]})]})};var Jse={exports:{}};(function(e,t){(function(n,r){e.exports=r(g)})(typeof self<"u"?self:_n,function(n){return function(r){var o={};function s(a){if(o[a])return o[a].exports;var l=o[a]={i:a,l:!1,exports:{}};return r[a].call(l.exports,l,l.exports,s),l.l=!0,l.exports}return s.m=r,s.c=o,s.d=function(a,l,c){s.o(a,l)||Object.defineProperty(a,l,{enumerable:!0,get:c})},s.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},s.t=function(a,l){if(1&l&&(a=s(a)),8&l||4&l&&typeof a=="object"&&a&&a.__esModule)return a;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:a}),2&l&&typeof a!="string")for(var u in a)s.d(c,u,(function(d){return a[d]}).bind(null,u));return c},s.n=function(a){var l=a&&a.__esModule?function(){return a.default}:function(){return a};return s.d(l,"a",l),l},s.o=function(a,l){return Object.prototype.hasOwnProperty.call(a,l)},s.p="lib/",s(s.s=5)}([function(r,o){r.exports=n},function(r,o,s){var a=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainerContextProvider=o.ArcherContainerContext=void 0;var l=a(s(0));o.ArcherContainerContext=l.default.createContext(null),o.ArcherContainerContextProvider=o.ArcherContainerContext.Provider},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.encodeId=void 0,o.encodeId=function(a){return encodeURI(a).replace(/%/g,"_")}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.getMarkerId=o.createShapeObj=o.getSourceToTargets=o.getEndShapeFromStyle=void 0;var a=["arrow","circle"];o.getEndShapeFromStyle=function(l){return l.endShape&&Object.keys(l.endShape).filter(function(c){return a.includes(c)})[0]||a[0]},o.getSourceToTargets=function(l){var c=Object.keys(l).map(function(u){return l[u]});return[].concat.apply([],c).sort(function(u,d){return u.order-d.order})},o.createShapeObj=function(l,c){return{arrow:function(){var u;return{arrow:Object.assign(Object.assign({},c==null?void 0:c.arrow),(u=l.endShape)===null||u===void 0?void 0:u.arrow)}},circle:function(){var u;return{circle:Object.assign(Object.assign({},c==null?void 0:c.circle),(u=l.endShape)===null||u===void 0?void 0:u.circle)}}}[(0,o.getEndShapeFromStyle)(l)]()},o.getMarkerId=function(l,c,u){return"".concat(l).concat(c.id).concat(u.id)}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.endShapeDefaultProp=void 0,o.endShapeDefaultProp={arrow:{arrowLength:10,arrowThickness:6},circle:{radius:2,fillColor:"#f00",strokeColor:"#0ff",strokeWidth:1}}},function(r,o,s){var a=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainer=o.ArcherElement=void 0;var l=s(6);Object.defineProperty(o,"ArcherElement",{enumerable:!0,get:function(){return a(l).default}});var c=s(11);Object.defineProperty(o,"ArcherContainer",{enumerable:!0,get:function(){return a(c).default}})},function(r,o,s){var a=this&&this.__createBinding||(Object.create?function(y,b,x,C){C===void 0&&(C=x);var w=Object.getOwnPropertyDescriptor(b,x);w&&("get"in w?b.__esModule:!w.writable&&!w.configurable)||(w={enumerable:!0,get:function(){return b[x]}}),Object.defineProperty(y,C,w)}:function(y,b,x,C){C===void 0&&(C=x),y[C]=b[x]}),l=this&&this.__setModuleDefault||(Object.create?function(y,b){Object.defineProperty(y,"default",{enumerable:!0,value:b})}:function(y,b){y.default=b}),c=this&&this.__importStar||function(y){if(y&&y.__esModule)return y;var b={};if(y!=null)for(var x in y)x!=="default"&&Object.prototype.hasOwnProperty.call(y,x)&&a(b,y,x);return l(b,y),b};Object.defineProperty(o,"__esModule",{value:!0});var u=c(s(0)),d=s(7),p=s(1),f=s(2),h=s(8),m=s(10);o.default=function(y){var b=y.id,x=y.relations,C=x===void 0?[]:x,w=y.children,j=(0,u.useMemo)(function(){return(0,f.encodeId)(b)},[b]),k=(0,u.useContext)(p.ArcherContainerContext),S=(0,u.useRef)(),E=(0,u.useCallback)(function($){var z=(0,m.generateSourceToTarget)(j,$);(0,m.assertContextExists)(k),k.registerTransitions(j,z)},[k,j]),T=(0,u.useCallback)(function(){(0,m.assertContextExists)(k),k.unregisterTransitions(j)},[k,j]),R=(0,u.useCallback)(function($){$&&((0,m.assertContextExists)(k),k.registerChild(j,$))},[j,k]),_=(0,u.useCallback)(function(){(0,m.assertContextExists)(k),k.unregisterChild(j)},[k,j]);(0,d.useIsomorphicLayoutEffect)(function(){return R(S.current),function(){return _()}},[R,_]),(0,h.useDeepCompareEffect)(function(){return E(C),function(){return T()}},[E,C,T]),u.default.Children.only(w);var M=w;return u.default.cloneElement(M,Object.assign(Object.assign({},M.props),{ref:S}))}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.useIsomorphicLayoutEffect=void 0;var a=s(0);o.useIsomorphicLayoutEffect=typeof window<"u"?a.useLayoutEffect:a.useEffect},function(r,o,s){var a=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(o,"__esModule",{value:!0}),o.useDeepCompareEffect=void 0;var l=s(0),c=a(s(9));function u(d){var p=(0,l.useRef)();return(0,c.default)(d,p.current)||(p.current=d),p.current}o.useDeepCompareEffect=function(d,p){(0,l.useEffect)(d,p.map(u))}},function(r,o,s){var a=Array.isArray,l=Object.keys,c=Object.prototype.hasOwnProperty,u=typeof Element<"u";r.exports=function(d,p){try{return function f(h,m){if(h===m)return!0;if(h&&m&&typeof h=="object"&&typeof m=="object"){var y,b,x,C=a(h),w=a(m);if(C&&w){if((b=h.length)!=m.length)return!1;for(y=b;y--!=0;)if(!f(h[y],m[y]))return!1;return!0}if(C!=w)return!1;var j=h instanceof Date,k=m instanceof Date;if(j!=k)return!1;if(j&&k)return h.getTime()==m.getTime();var S=h instanceof RegExp,E=m instanceof RegExp;if(S!=E)return!1;if(S&&E)return h.toString()==m.toString();var T=l(h);if((b=T.length)!==l(m).length)return!1;for(y=b;y--!=0;)if(!c.call(m,T[y]))return!1;if(u&&h instanceof Element&&m instanceof Element)return h===m;for(y=b;y--!=0;)if(!((x=T[y])==="_owner"&&h.$$typeof||f(h[x],m[x])))return!1;return!0}return h!=h&&m!=m}(d,p)}catch(f){if(f.message&&f.message.match(/stack|recursion/i)||f.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",f.name,f.message),!1;throw f}}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.generateSourceToTarget=o.assertContextExists=void 0;var a=s(2);o.assertContextExists=function(l){if(!l)throw new Error("Could not find ArcherContainerContext in <ArcherElement>. Please wrap the component in a <ArcherContainer>.")},o.generateSourceToTarget=function(l,c){return c.map(function(u){var d=u.targetId,p=u.sourceAnchor,f=u.targetAnchor,h=u.label,m=u.className,y=u.style,b=u.order,x=b===void 0?0:b,C=u.domAttributes,w=u.cursor,j=u.hitSlop;return{source:{id:(0,a.encodeId)(l),anchor:p},target:{id:(0,a.encodeId)(d),anchor:f},className:m,label:h,style:y,order:x,domAttributes:C,cursor:w,hitSlop:j}})}},function(r,o,s){function a(S,E,T){return E in S?Object.defineProperty(S,E,{value:T,enumerable:!0,configurable:!0,writable:!0}):S[E]=T,S}function l(S,E){return function(T){if(Array.isArray(T))return T}(S)||function(T,R){var _=T==null?null:typeof Symbol<"u"&&T[Symbol.iterator]||T["@@iterator"];if(_!=null){var M,$,z=[],A=!0,O=!1;try{for(_=_.call(T);!(A=(M=_.next()).done)&&(z.push(M.value),!R||z.length!==R);A=!0);}catch(L){O=!0,$=L}finally{try{A||_.return==null||_.return()}finally{if(O)throw $}}return z}}(S,E)||function(T,R){if(T){if(typeof T=="string")return c(T,R);var _=Object.prototype.toString.call(T).slice(8,-1);if(_==="Object"&&T.constructor&&(_=T.constructor.name),_==="Map"||_==="Set")return Array.from(T);if(_==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_))return c(T,R)}}(S,E)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
476
476
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function c(S,E){(E==null||E>S.length)&&(E=S.length);for(var T=0,R=new Array(E);T<E;T++)R[T]=S[T];return R}var u=this&&this.__createBinding||(Object.create?function(S,E,T,R){R===void 0&&(R=T);var _=Object.getOwnPropertyDescriptor(E,T);_&&("get"in _?E.__esModule:!_.writable&&!_.configurable)||(_={enumerable:!0,get:function(){return E[T]}}),Object.defineProperty(S,R,_)}:function(S,E,T,R){R===void 0&&(R=T),S[R]=E[T]}),d=this&&this.__setModuleDefault||(Object.create?function(S,E){Object.defineProperty(S,"default",{enumerable:!0,value:E})}:function(S,E){S.default=E}),p=this&&this.__importStar||function(S){if(S&&S.__esModule)return S;var E={};if(S!=null)for(var T in S)T!=="default"&&Object.prototype.hasOwnProperty.call(S,T)&&u(E,S,T);return d(E,S),E},f=this&&this.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(o,"__esModule",{value:!0});var h=p(s(0)),m=f(s(12)),y=s(1),b=s(14),x=s(4),C=s(19),w=s(20),j={position:"absolute",width:"100%",height:"100%",top:0,left:0,pointerEvents:"none"},k=h.default.forwardRef(function(S,E){var T=S.endShape,R=T===void 0?x.endShapeDefaultProp:T,_=S.strokeColor,M=_===void 0?"#f00":_,$=S.strokeWidth,z=$===void 0?2:$,A=S.svgContainerStyle,O=A===void 0?{}:A,L=S.noCurves,B=S.children,H=S.className,N=S.endMarker,I=S.lineStyle,q=S.offset,ne=S.startMarker,V=S.strokeDasharray,oe=S.style,se=l((0,h.useState)({}),2),ae=se[0],me=se[1],ce=l((0,h.useState)({}),2),_e=ce[0],we=ce[1],Me=(0,h.useRef)(new m.default(function(){be()})).current,Fe=(0,h.useRef)(null),Ge=l(h.default.useState(),2)[1],Re=(0,h.useRef)("arrow".concat(Math.random().toString().slice(2))).current;(0,h.useImperativeHandle)(E,function(){return{refreshScreen:be,arrowMarkerUniquePrefix:Re}});var Be,be=h.default.useCallback(function(){return Ge({})},[]),ze=(0,h.useCallback)(function(at,rt){we(function(Ae){return Object.assign(Object.assign({},Ae),a({},at,rt))})},[]),xe=(0,h.useCallback)(function(at){we(function(rt){var Ae=Object.assign({},rt);return delete Ae[at],Ae})},[]),qe=(0,h.useCallback)(function(at,rt){me(function(Ae){return Ae[at]===rt?Ae:Object.assign(Object.assign({},Ae),a({},at,rt))})},[]),Ve=(0,h.useCallback)(function(at){me(function(rt){var Ae=Object.assign({},rt);return delete Ae[at],Ae})},[]),et=(0,h.useMemo)(function(){return Object.assign(Object.assign({},j),O)},[O]);Be=typeof B=="function"?B(y.ArcherContainerContext):B,(0,w.useResizeListener)(be),(0,w.useObserveElements)(ae,Me);var dt=(0,h.useMemo)(function(){return{registerTransitions:ze,unregisterTransitions:xe,registerChild:qe,unregisterChild:Ve}},[ze,xe,qe,Ve]);return h.default.createElement(y.ArcherContainerContextProvider,{value:dt},h.default.createElement("div",{style:Object.assign(Object.assign({},oe),{position:"relative"}),className:H},h.default.createElement("svg",{style:et},h.default.createElement("defs",null,h.default.createElement(C.ArrowMarkers,{endShape:R,sourceToTargetsMap:_e,strokeColor:M,uniqueId:Re})),h.default.createElement(b.SvgArrows,{startMarker:ne,endMarker:N,endShape:R,strokeColor:M,strokeWidth:z,strokeDasharray:V,noCurves:L,lineStyle:I,offset:q,parentCurrent:Fe.current,refs:ae,uniqueId:Re,sourceToTargetsMap:_e})),h.default.createElement("div",{style:{height:"100%"},ref:Fe},Be)))});o.default=k},function(r,o,s){s.r(o),(function(a){var l=function(){if(typeof Map<"u")return Map;function A(O,L){var B=-1;return O.some(function(H,N){return H[0]===L&&(B=N,!0)}),B}return function(){function O(){this.__entries__=[]}var L={size:{configurable:!0}};return L.size.get=function(){return this.__entries__.length},O.prototype.get=function(B){var H=A(this.__entries__,B),N=this.__entries__[H];return N&&N[1]},O.prototype.set=function(B,H){var N=A(this.__entries__,B);~N?this.__entries__[N][1]=H:this.__entries__.push([B,H])},O.prototype.delete=function(B){var H=this.__entries__,N=A(H,B);~N&&H.splice(N,1)},O.prototype.has=function(B){return!!~A(this.__entries__,B)},O.prototype.clear=function(){this.__entries__.splice(0)},O.prototype.forEach=function(B,H){H===void 0&&(H=null);for(var N=0,I=this.__entries__;N<I.length;N+=1){var q=I[N];B.call(H,q[1],q[0])}},Object.defineProperties(O.prototype,L),O}()}(),c=typeof window<"u"&&typeof document<"u"&&window.document===document,u=function(){return a!==void 0&&a.Math===Math?a:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),d=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(u):function(A){return setTimeout(function(){return A(Date.now())},1e3/60)}}(),p=2,f=["top","right","bottom","left","width","height","size","weight"],h=typeof MutationObserver<"u",m=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(A,O){var L=!1,B=!1,H=0;function N(){L&&(L=!1,A()),B&&q()}function I(){d(N)}function q(){var ne=Date.now();if(L){if(ne-H<p)return;B=!0}else L=!0,B=!1,setTimeout(I,O);H=ne}return q}(this.refresh.bind(this),20)};m.prototype.addObserver=function(A){~this.observers_.indexOf(A)||this.observers_.push(A),this.connected_||this.connect_()},m.prototype.removeObserver=function(A){var O=this.observers_,L=O.indexOf(A);~L&&O.splice(L,1),!O.length&&this.connected_&&this.disconnect_()},m.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},m.prototype.updateObservers_=function(){var A=this.observers_.filter(function(O){return O.gatherActive(),O.hasActive()});return A.forEach(function(O){return O.broadcastActive()}),A.length>0},m.prototype.connect_=function(){c&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),h?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},m.prototype.disconnect_=function(){c&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},m.prototype.onTransitionEnd_=function(A){var O=A.propertyName;O===void 0&&(O=""),f.some(function(L){return!!~O.indexOf(L)})&&this.refresh()},m.getInstance=function(){return this.instance_||(this.instance_=new m),this.instance_},m.instance_=null;var y=function(A,O){for(var L=0,B=Object.keys(O);L<B.length;L+=1){var H=B[L];Object.defineProperty(A,H,{value:O[H],enumerable:!1,writable:!1,configurable:!0})}return A},b=function(A){return A&&A.ownerDocument&&A.ownerDocument.defaultView||u},x=E(0,0,0,0);function C(A){return parseFloat(A)||0}function w(A){for(var O=[],L=arguments.length-1;L-- >0;)O[L]=arguments[L+1];return O.reduce(function(B,H){return B+C(A["border-"+H+"-width"])},0)}function j(A){var O=A.clientWidth,L=A.clientHeight;if(!O&&!L)return x;var B=b(A).getComputedStyle(A),H=function(se){for(var ae={},me=0,ce=["top","right","bottom","left"];me<ce.length;me+=1){var _e=ce[me],we=se["padding-"+_e];ae[_e]=C(we)}return ae}(B),N=H.left+H.right,I=H.top+H.bottom,q=C(B.width),ne=C(B.height);if(B.boxSizing==="border-box"&&(Math.round(q+N)!==O&&(q-=w(B,"left","right")+N),Math.round(ne+I)!==L&&(ne-=w(B,"top","bottom")+I)),!function(se){return se===b(se).document.documentElement}(A)){var V=Math.round(q+N)-O,oe=Math.round(ne+I)-L;Math.abs(V)!==1&&(q-=V),Math.abs(oe)!==1&&(ne-=oe)}return E(H.left,H.top,q,ne)}var k=function(){return typeof SVGGraphicsElement<"u"?function(A){return A instanceof b(A).SVGGraphicsElement}:function(A){return A instanceof b(A).SVGElement&&typeof A.getBBox=="function"}}();function S(A){return c?k(A)?function(O){var L=O.getBBox();return E(0,0,L.width,L.height)}(A):j(A):x}function E(A,O,L,B){return{x:A,y:O,width:L,height:B}}var T=function(A){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=E(0,0,0,0),this.target=A};T.prototype.isActive=function(){var A=S(this.target);return this.contentRect_=A,A.width!==this.broadcastWidth||A.height!==this.broadcastHeight},T.prototype.broadcastRect=function(){var A=this.contentRect_;return this.broadcastWidth=A.width,this.broadcastHeight=A.height,A};var R=function(A,O){var L=function(B){var H=B.x,N=B.y,I=B.width,q=B.height,ne=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,V=Object.create(ne.prototype);return y(V,{x:H,y:N,width:I,height:q,top:N,right:H+I,bottom:q+N,left:H}),V}(O);y(this,{target:A,contentRect:L})},_=function(A,O,L){if(this.activeObservations_=[],this.observations_=new l,typeof A!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=A,this.controller_=O,this.callbackCtx_=L};_.prototype.observe=function(A){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element<"u"&&Element instanceof Object){if(!(A instanceof b(A).Element))throw new TypeError('parameter 1 is not of type "Element".');var O=this.observations_;O.has(A)||(O.set(A,new T(A)),this.controller_.addObserver(this),this.controller_.refresh())}},_.prototype.unobserve=function(A){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element<"u"&&Element instanceof Object){if(!(A instanceof b(A).Element))throw new TypeError('parameter 1 is not of type "Element".');var O=this.observations_;O.has(A)&&(O.delete(A),O.size||this.controller_.removeObserver(this))}},_.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},_.prototype.gatherActive=function(){var A=this;this.clearActive(),this.observations_.forEach(function(O){O.isActive()&&A.activeObservations_.push(O)})},_.prototype.broadcastActive=function(){if(this.hasActive()){var A=this.callbackCtx_,O=this.activeObservations_.map(function(L){return new R(L.target,L.broadcastRect())});this.callback_.call(A,O,A),this.clearActive()}},_.prototype.clearActive=function(){this.activeObservations_.splice(0)},_.prototype.hasActive=function(){return this.activeObservations_.length>0};var M=typeof WeakMap<"u"?new WeakMap:new l,$=function(A){if(!(this instanceof $))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var O=m.getInstance(),L=new _(A,O,this);M.set(this,L)};["observe","unobserve","disconnect"].forEach(function(A){$.prototype[A]=function(){return(O=M.get(this))[A].apply(O,arguments);var O}});var z=function(){return u.ResizeObserver!==void 0?u.ResizeObserver:$}();o.default=z}).call(this,s(13))},function(r,o){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch{typeof window=="object"&&(s=window)}r.exports=s},function(r,o,s){var a=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(o,"__esModule",{value:!0}),o.SvgArrows=void 0;var l=a(s(0)),c=s(15),u=a(s(17)),d=s(3),p=function(f){var h,m,y=f.style||{},b=y.startMarker||f.startMarker,x=(m=(h=y.endMarker)!==null&&h!==void 0?h:f.endMarker)===null||m===void 0||m,C=(0,d.createShapeObj)(y,f.endShape),w=f.domAttributes,j=f.cursor,k=f.hitSlop,S=y.strokeColor||f.strokeColor,E=y.strokeWidth||f.strokeWidth,T=y.strokeDasharray||f.strokeDasharray,R=!(!y.noCurves&&!f.noCurves),_=y.lineStyle||f.lineStyle||(R?"angle":"curve"),M=f.offset||0,$=f.source.anchor,z=(0,c.getPointCoordinatesFromAnchorPosition)(f.source.anchor,f.source.id,f.parentCoordinates,f.refs),A=f.target.anchor,O=(0,c.getPointCoordinatesFromAnchorPosition)(f.target.anchor,f.target.id,f.parentCoordinates,f.refs);return z?O?l.default.createElement(u.default,{className:f.className,startingPoint:z,startingAnchorOrientation:$,endingPoint:O,endingAnchorOrientation:A,strokeColor:S,strokeWidth:E,strokeDasharray:T,arrowLabel:f.label,arrowMarkerId:(0,d.getMarkerId)(f.uniqueId,f.source,f.target),lineStyle:_,offset:M,enableStartMarker:!!b,disableEndMarker:!x,endShape:C,domAttributes:w,hitSlop:k,cursor:j}):(console.warn("[React Archer] Could not find target element! Not drawing the arrow."),null):(console.warn("[React Archer] Could not find starting point of element! Not drawing the arrow."),null)};o.SvgArrows=function(f){var h=(0,c.getPointFromElement)(f.parentCurrent);return h?l.default.createElement(l.default.Fragment,null,(0,d.getSourceToTargets)(f.sourceToTargetsMap).map(function(m){return l.default.createElement(p,{key:JSON.stringify({source:m.source,target:m.target}),source:m.source,target:m.target,className:m.className,label:m.label,style:m.style||{},domAttributes:m.domAttributes,hitSlop:m.hitSlop,cursor:m.cursor,startMarker:f.startMarker,endMarker:f.endMarker,endShape:f.endShape,strokeColor:f.strokeColor,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,noCurves:f.noCurves,lineStyle:f.lineStyle,offset:f.offset,parentCoordinates:h,refs:f.refs,uniqueId:f.uniqueId})})):null}},function(r,o,s){var a=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(o,"__esModule",{value:!0}),o.getPointCoordinatesFromAnchorPosition=o.getPointFromElement=void 0;var l=a(s(16));function c(d){return new l.default(d.left,d.top)}var u=function(d){return d?d.getBoundingClientRect():null};o.getPointFromElement=function(d){var p=u(d);return p?c(p):null},o.getPointCoordinatesFromAnchorPosition=function(d,p,f,h){var m=u(h[p]);if(!m)return null;var y=function(b,x){switch(b){case"top":return c(x).add(new l.default(x.width/2,0));case"bottom":return c(x).add(new l.default(x.width/2,x.height));case"left":return c(x).add(new l.default(0,x.height/2));case"right":return c(x).add(new l.default(x.width,x.height/2));case"middle":return c(x).add(new l.default(x.width/2,x.height/2));default:return console.error("[React Archer] Invalid anchor position was provided. Not drawing the arrow."),null}}(d,m);return y?y.substract(f):null}},function(r,o,s){function a(c,u){for(var d=0;d<u.length;d++){var p=u[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}Object.defineProperty(o,"__esModule",{value:!0});var l=function(){function c(u,d){(function(p,f){if(!(p instanceof f))throw new TypeError("Cannot call a class as a function")})(this,c),this.x=u,this.y=d}return function(u,d,p){d&&a(u.prototype,d),Object.defineProperty(u,"prototype",{writable:!1})}(c,[{key:"add",value:function(u){return new c(this.x+u.x,this.y+u.y)}},{key:"substract",value:function(u){return new c(this.x-u.x,this.y-u.y)}}]),c}();o.default=l},function(r,o,s){var a=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(o,"__esModule",{value:!0}),o.computeLabelDimensions=o.computeEndingAnchorPosition=o.computeStartingAnchorPosition=o.computeArrowPointAccordingToArrowHead=void 0;var l=a(s(0)),c=s(18);function u(h,m,y,b,x,C,w,j){var k=(0,c.computeArrowDirectionVector)(x),S=k.arrowX,E=k.arrowY;if(C==="straight"&&w!==void 0&&j!==void 0){var T=Math.atan2(j-m,w-h);S=Math.cos(T),E=Math.sin(T)}return{xPoint:h+S*y*b/2,yPoint:m+E*y*b/2}}function d(h,m,y,b,x){return x==="top"||x==="bottom"?{xAnchor1:h,yAnchor1:m+(b-m)/2}:x==="left"||x==="right"?{xAnchor1:h+(y-h)/2,yAnchor1:m}:{xAnchor1:h,yAnchor1:m}}function p(h,m,y,b,x){return x==="top"||x==="bottom"?{xAnchor2:y,yAnchor2:b-(b-m)/2}:x==="left"||x==="right"?{xAnchor2:y-(y-h)/2,yAnchor2:b}:{xAnchor2:y,yAnchor2:b}}function f(h,m,y,b){return{xLabel:y>h?h:y,yLabel:b>m?m:b,labelWidth:Math.max(Math.abs(y-h),1),labelHeight:Math.max(Math.abs(b-m),1)}}o.computeArrowPointAccordingToArrowHead=u,o.computeStartingAnchorPosition=d,o.computeEndingAnchorPosition=p,o.computeLabelDimensions=f,o.default=function(h){var m=h.className,y=h.startingPoint,b=h.startingAnchorOrientation,x=h.endingPoint,C=h.endingAnchorOrientation,w=h.strokeColor,j=h.strokeWidth,k=h.strokeDasharray,S=h.arrowLabel,E=h.arrowMarkerId,T=h.lineStyle,R=h.offset,_=h.enableStartMarker,M=h.disableEndMarker,$=h.endShape,z=h.domAttributes,A=h.hitSlop,O=A===void 0?10:A,L=h.cursor,B=L===void 0?"pointer":L,H=$.circle?2*$.circle.radius:2*$.arrow.arrowLength,N=u(y.x,y.y,_?H:0,j,b,T,x.x,x.y),I=N.xPoint,q=N.yPoint,ne=u(x.x,x.y,M?0:H,j,C,T,y.x,y.y),V=ne.xPoint,oe=ne.yPoint,se=d(I,q,V,oe,b),ae=se.xAnchor1,me=se.yAnchor1,ce=p(I,q,V,oe,C),_e=function(be){var ze=be.xStart,xe=be.yStart,qe=be.xAnchor1,Ve=be.yAnchor1,et=be.xAnchor2,dt=be.yAnchor2,at=be.xEnd,rt=be.yEnd,Ae=be.lineStyle,Ye=be.offset;if(Ye&&Ye!==0){var fe=Ae==="straight"?Math.atan2(rt-xe,at-ze):Math.atan2(Ve-xe,qe-ze),ge=Ye*Math.cos(fe),ye=Ye*Math.sin(fe);Ae!=="straight"&&(ze+=ge,xe+=ye),at-=ge,rt-=ye}var Xe="M".concat(ze,",").concat(xe," ");return["curve","angle"].includes(Ae)&&(Xe+="".concat(Ae==="curve"?"C":"").concat(qe,",").concat(Ve," ").concat(et,",").concat(dt," ")),Xe+="".concat(at,",").concat(rt)}({xStart:I,yStart:q,xAnchor1:ae,yAnchor1:me,xAnchor2:ce.xAnchor2,yAnchor2:ce.yAnchor2,xEnd:V,yEnd:oe,lineStyle:T,offset:R}),we=f(I,q,V,oe),Me=we.xLabel,Fe=we.yLabel,Ge=we.labelWidth,Re=we.labelHeight,Be="url(#".concat(E,")");return l.default.createElement("g",{className:m},l.default.createElement("path",{d:_e,style:{fill:"none",stroke:w,strokeWidth:j,strokeDasharray:k},markerStart:_?Be:void 0,markerEnd:M?void 0:Be}),z&&l.default.createElement("path",Object.assign({d:_e,style:{fill:"none",stroke:"rgba(0, 0, 0, 0)",strokeWidth:O,cursor:z?B:"initial",pointerEvents:"all"}},z)),S&&l.default.createElement("foreignObject",{x:Me,y:Fe,width:Ge,height:Re,style:{overflow:"visible",pointerEvents:"none"}},l.default.createElement("div",{style:{position:"absolute",left:"50%",top:"50%",transform:"translateX(-50%) translateY(-50%)",pointerEvents:"all"}},l.default.createElement("div",null,S))))}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.computeArrowDirectionVector=void 0,o.computeArrowDirectionVector=function(a){switch(a){case"left":return{arrowX:-1,arrowY:0};case"right":return{arrowX:1,arrowY:0};case"top":return{arrowX:0,arrowY:-1};case"bottom":return{arrowX:0,arrowY:1};default:return{arrowX:0,arrowY:0}}}},function(r,o,s){var a=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArrowMarkers=void 0;var l=a(s(0)),c=s(4),u=s(3),d=function(f,h){return function(){var m,y,b,x,C,w,j,k,S,E,T,R,_=((y=(m=f.endShape)===null||m===void 0?void 0:m.circle)===null||y===void 0?void 0:y.radius)||((b=h.circle)===null||b===void 0?void 0:b.radius)||c.endShapeDefaultProp.circle.radius,M=((C=(x=f.endShape)===null||x===void 0?void 0:x.circle)===null||C===void 0?void 0:C.strokeWidth)||((w=h.circle)===null||w===void 0?void 0:w.strokeWidth)||c.endShapeDefaultProp.circle.strokeWidth,$=((k=(j=f.endShape)===null||j===void 0?void 0:j.circle)===null||k===void 0?void 0:k.strokeColor)||((S=h.circle)===null||S===void 0?void 0:S.strokeColor)||c.endShapeDefaultProp.circle.strokeColor,z=((T=(E=f.endShape)===null||E===void 0?void 0:E.circle)===null||T===void 0?void 0:T.fillColor)||((R=h.circle)===null||R===void 0?void 0:R.fillColor)||c.endShapeDefaultProp.circle.fillColor;return{markerWidth:4*_,markerHeight:4*_,refX:2*_+M,refY:2*_,path:l.default.createElement("circle",{cx:2*_,cy:2*_,r:_,fill:z,stroke:$,strokeWidth:M})}}},p=function(f,h,m){return function(){var y,b,x,C,w,j,k,S,E=f.strokeColor||m,T=(w=(x=(b=(y=f.endShape)===null||y===void 0?void 0:y.arrow)===null||b===void 0?void 0:b.arrowLength)!==null&&x!==void 0?x:(C=h==null?void 0:h.arrow)===null||C===void 0?void 0:C.arrowLength)!==null&&w!==void 0?w:c.endShapeDefaultProp.arrow.arrowLength,R=((k=(j=f.endShape)===null||j===void 0?void 0:j.arrow)===null||k===void 0?void 0:k.arrowThickness)||((S=h==null?void 0:h.arrow)===null||S===void 0?void 0:S.arrowThickness)||c.endShapeDefaultProp.arrow.arrowThickness,_="M0,0 L0,".concat(R," L").concat(T,",").concat(R/2," z");return{markerWidth:T,markerHeight:R,refX:0,refY:R/2,path:l.default.createElement("path",{d:_,fill:E})}}};o.ArrowMarkers=function(f){var h=f.sourceToTargetsMap,m=f.endShape,y=f.strokeColor,b=f.uniqueId;return l.default.createElement(l.default.Fragment,null,(0,u.getSourceToTargets)(h).map(function(x){var C=x.source,w=x.target,j=x.style,k=function(M){var $=M.style,z=M.strokeColor,A=M.endShape,O=(0,u.getEndShapeFromStyle)($);return{circle:d($,A),arrow:p($,A,z)}[O]()}({style:j===void 0?{}:j,endShape:m,strokeColor:y}),S=k.markerHeight,E=k.markerWidth,T=k.path,R=k.refX,_=k.refY;return l.default.createElement("marker",{id:(0,u.getMarkerId)(b,C,w),key:(0,u.getMarkerId)(b,C,w),markerWidth:E,markerHeight:S,refX:R,refY:_,orient:"auto-start-reverse",markerUnits:"strokeWidth"},T)}))}},function(r,o,s){Object.defineProperty(o,"__esModule",{value:!0}),o.useResizeListener=o.useObserveElements=void 0;var a=s(0);o.useObserveElements=function(l,c){(0,a.useEffect)(function(){return Object.keys(l).map(function(u){c.observe(l[u])}),function(){Object.keys(l).map(function(u){c.unobserve(l[u])})}},[l,c])},o.useResizeListener=function(l){(0,a.useEffect)(function(){return window&&window.addEventListener("resize",l),function(){window&&window.removeEventListener("resize",l)}},[l])}}])})})(Jse);var oC=Jse.exports,AI={},ECt=je;Object.defineProperty(AI,"__esModule",{value:!0});var b0=AI.default=void 0,kCt=ECt(Ee()),TCt=i,RCt=(0,kCt.default)((0,TCt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckCircle");b0=AI.default=RCt;var PI={},ACt=je;Object.defineProperty(PI,"__esModule",{value:!0});var Zse=PI.default=void 0,PCt=ACt(Ee()),_Ct=i,ICt=(0,PCt.default)((0,_Ct.jsx)("path",{d:"M14.4 6 14 4H5v17h2v-7h5.6l.4 2h7V6z"}),"Flag");Zse=PI.default=ICt;const OCt=v("table")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,marginTop:e.spacing(1)})),kd=v("td")(({theme:e})=>({verticalAlign:"top",paddingLeft:0,paddingRight:e.spacing(1)})),MCt=v(K)(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),$Ct=v(K)(({theme:e,mode:t})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette[t].border,backgroundColor:e.palette[t].light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5,3,2,3)})),DCt=v(K)(({theme:e,mode:t})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette[t==="success"?"secondary":"warning"].border,backgroundColor:e.palette[t==="success"?"secondary":"warning"].light,display:"inline-block",padding:e.spacing(1.5,1.5,1.5,1.5),zIndex:1,opacity:.9})),LCt=v(pr)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),NCt=v(K)({display:"flex",justifyContent:"center",flexWrap:"wrap",gap:"60px 20px"}),FCt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,fontWeight:e.fontWeight.bold})),Qse=v(J)(({theme:e,mode:t})=>({gap:e.spacing(1),fontSize:e.fontSizes.smallBody,color:e.palette[t].dark,display:"flex",alignItems:"center"})),BCt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(3),color:e.palette.secondary.main,paddingTop:e.spacing(2)})),EW=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(.5)})),kW=v(K)(({theme:e})=>({color:e.palette.text.primary,display:"flex",alignItems:"center"})),zCt=()=>{const e=g.useRef(null),[t,n]=g.useState("100%");return g.useLayoutEffect(()=>{var r;n(`${(r=e.current)==null?void 0:r.scrollWidth}px`)},[e,n]),{elementRef:e,width:t}},HCt=()=>i.jsxs(Qse,{mode:"success",children:[i.jsx(b0,{sx:e=>({color:e.palette.success.main})})," ","Everything looks good!"]}),WCt=({children:e})=>i.jsxs(Qse,{mode:"warning",children:[i.jsx(jI,{sx:t=>({color:t.palette.warning.main})})," ",e]}),VCt=({environmentCount:e,featureCount:t})=>i.jsxs(BCt,{children:[i.jsxs(EW,{children:[i.jsx(Zg,{}),i.jsx(kW,{children:e})]}),i.jsxs(EW,{children:[i.jsx(Zse,{}),i.jsx(kW,{children:t})]})]}),UCt=()=>{const{trackEvent:e}=zt();return()=>{e("sdk-reporting",{props:{eventType:"environment box clicked"}})}},TW=e=>e.issues.missingFeatures.length+e.issues.outdatedSdks.length===0?"success":"warning",GCt=({data:e})=>{const t=UCt(),n=ar("name"),{elementRef:r,width:o}=zCt(),s=$t(),a=Bt(),l=Xse(e);return i.jsx(K,{sx:{width:o},children:i.jsxs(oC.ArcherContainer,{strokeColor:a.palette.secondary.border,endMarker:!1,children:[i.jsx(MCt,{children:i.jsx(oC.ArcherElement,{id:"application",relations:e.environments.map(c=>({targetId:c.name,targetAnchor:"top",sourceAnchor:"bottom",style:{strokeColor:TW(c)==="success"?a.palette.secondary.border:a.palette.warning.border}})),children:i.jsxs($Ct,{mode:l.applicationMode,children:[i.jsx(J,{sx:c=>({fontSize:c.fontSizes.smallerBody}),color:"text.secondary",children:"Application"}),i.jsx(J,{sx:c=>({fontSize:c.fontSizes.bodySize,fontWeight:c.fontWeight.bold}),children:n}),i.jsx(VCt,{environmentCount:e.environments.length,featureCount:e.featureCount}),i.jsx(LCt,{}),l.applicationMode==="success"?i.jsx(HCt,{}):i.jsxs(WCt,{children:[l.issueCount," issues detected"]})]})})}),i.jsx(NCt,{ref:r,children:e.environments.map(c=>i.jsx(oC.ArcherElement,{id:c.name,children:i.jsxs(DCt,{mode:TW(c),sx:{cursor:"pointer"},onClick:u=>{t(),s(`/applications/${n}/instances?environment=${c.name}`)},children:[i.jsxs(FCt,{children:[c.name," environment"]}),i.jsx(OCt,{children:i.jsxs("tbody",{children:[i.jsxs("tr",{children:[i.jsxs(kd,{sx:{display:"flex"},children:["Instances:"," ",i.jsx(Zo,{size:a.fontSizes.smallBody,tooltip:"Active instances in the last 24 hours"})]}),i.jsx(kd,{children:c.instanceCount})]}),c.backendSdks.length>0?i.jsxs("tr",{children:[i.jsx(kd,{children:"Backend SDK:"}),i.jsx(kd,{children:c.backendSdks.map(u=>i.jsx("div",{children:u},u))})]}):null,c.frontendSdks.length>0?i.jsxs("tr",{children:[i.jsx(kd,{children:"Frontend SDK:"}),i.jsx(kd,{children:c.frontendSdks.map(u=>i.jsx("div",{children:u},u))})]}):null,i.jsxs("tr",{children:[i.jsx(kd,{children:"Last seen:"}),i.jsx(kd,{children:i.jsx(Kl,{date:c.lastSeen})})]})]})})]},c.name)},c.name))})]})})},qCt=v(pr)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),YCt=v(K)(({theme:e})=>({display:"flex",padding:e.spacing(1),flexDirection:"column",alignItems:"center",gap:e.spacing(2),alignSelf:"stretch"})),KCt=v("ul")(({theme:e})=>({padding:0,display:"flex",alignItems:"center",gap:e.spacing(2),alignSelf:"stretch",listStyle:"none"})),XCt=v(ft)(({theme:e})=>({":hover,:focus-visible":{outline:"none","> *":{outline:`1px solid ${e.palette.primary.main}`}}})),JCt=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignSelf:"stretch"})),ZCt=()=>{const{trackEvent:e}=zt();g.useEffect(()=>{e("sdk-reporting",{props:{eventType:"application overview opened"}})},[])},QCt=()=>{nd("Applications - Overview"),ZCt();const e=ar("name");$t();const{data:t,loading:n}=Yse(e),{openFeedback:r}=Z_("applicationOverview","automatic"),o=()=>{r({title:"How easy was it to use the application overview page?",positiveLabel:"What do you like most about the new application overview page?",areasForImprovementsLabel:"What should be improved on the application overview page?"})};return n?i.jsxs("div",{children:[i.jsx("p",{children:"Loading..."}),i.jsx(z5,{})]}):i.jsx(te,{condition:!n&&t.environments.length===0,show:i.jsx(Dt,{severity:"warning",children:"No data available."}),elseShow:i.jsxs(YCt,{children:[i.jsxs(JCt,{children:[i.jsxs(KCt,{children:["Application is connected to these projects:",t.projects.map(s=>i.jsx("li",{children:i.jsx(XCt,{to:`/projects/${s}`,children:i.jsx(an,{color:"secondary",icon:i.jsx(G_,{}),children:s})})},s))]}),i.jsx($e,{startIcon:i.jsx(t8,{}),variant:"outlined",onClick:o,size:"small",children:"Provide feedback"})]}),i.jsx(qCt,{}),i.jsx(jCt,{application:t}),i.jsx(GCt,{data:t})]})})},ewt=v("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(3)})),twt=v("div")(({theme:e})=>({padding:e.spacing(0,4)})),nwt=v("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),rwt=v(_4)(({theme:e})=>({textTransform:"none",flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),owt=()=>{const e=$t(),t=ar("name"),{application:n,loading:r}=pCt(t),{appName:o,url:s,createdAt:a}=n,{hasAccess:l}=g.useContext(Bo),{deleteApplication:c}=dCt(),{locationSettings:u}=$r(),{setToastData:d,setToastApiError:p}=_t(),{pathname:f}=jo(),h=`/applications/${encodeURIComponent(t)}`,[m,y]=g.useState(!1),b=()=>{y(!m)},x=S=>Zc(S,u.locale),C=async S=>{S.preventDefault();try{await c(o),d({text:"Deleted Successfully",type:"success"}),e("/applications")}catch(E){p(pt(E))}},w=()=>i.jsx(Mn,{open:m,onClose:b,onClick:C,title:"Are you sure you want to delete this application?"});if(r)return i.jsxs("div",{children:[i.jsx("p",{children:"Loading..."}),i.jsx(z5,{})]});if(!n)return i.jsxs("p",{children:["Application (",o,") not found"]});const j=[{title:"Overview",path:h,name:"overview"},{title:"Last seen instances (24h)",path:`${h}/instances`,name:"instances"}],k=j.find(S=>S.path===f);return i.jsxs(i.Fragment,{children:[i.jsxs(ewt,{children:[i.jsxs(ir,{children:[i.jsx($n,{title:o,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!!s,show:i.jsx(Mt,{component:Sn,href:s,size:"large",children:i.jsx(qse,{titleAccess:s})})}),i.jsx(Co,{tooltipProps:{title:"Delete application"},onClick:b,permission:vN,children:i.jsx(So,{})})]})}),i.jsx(K,{sx:S=>({marginTop:S.spacing(1)}),children:i.jsxs(J,{variant:"body2",children:["Created: ",x(a)]})})]}),i.jsx(nwt,{}),i.jsx(twt,{children:i.jsx(xX,{value:k==null?void 0:k.path,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:j.map(S=>i.jsx(rwt,{label:S.title,value:S.path,onClick:()=>e(S.path),"data-testid":`TAB_${S.title}`},S.title))})})]}),i.jsxs(ir,{children:[i.jsx(te,{condition:l(vN),show:i.jsx("div",{children:w()})}),i.jsxs(KE,{children:[i.jsx(z1,{path:"instances",element:i.jsx(uCt,{})}),i.jsx(z1,{path:"*",element:i.jsx(QCt,{})})]})]})]})},pm="api/admin/signal-endpoints",eie=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=er({propagateErrors:!0}),o=async d=>{const f=n(pm,{method:"POST",body:JSON.stringify(d)},"addSignalEndpoint");return(await t(f.caller,f.id)).json()},s=async(d,p)=>{const h=n(`${pm}/${d}`,{method:"PUT",body:JSON.stringify(p)},"updateSignalEndpoint");await t(h.caller,h.id)},a=async d=>{const f=n(`${pm}/${d}/on`,{method:"POST"},"enableSignalEndpoint");await t(f.caller,f.id)},l=async d=>{const f=n(`${pm}/${d}/off`,{method:"POST"},"disableSignalEndpoint");await t(f.caller,f.id)};return{addSignalEndpoint:o,updateSignalEndpoint:s,removeSignalEndpoint:async d=>{const f=n(`${pm}/${d}`,{method:"DELETE"},"removeSignalEndpoint");await t(f.caller,f.id)},toggleSignalEndpoint:async(d,p)=>{p?await a(d):await l(d)},errors:r,loading:e}},swt=v(K)({display:"flex",justifyContent:"center"}),iwt=({signalEndpointId:e,onCopyToClipboard:t,onOpenSignals:n,onEdit:r,onDelete:o})=>{const[s,a]=g.useState(null),l=!!s,c=f=>{a(f.currentTarget)},u=()=>{a(null)},d=`signal-endpoint-${e}-actions`,p=`${d}-menu`;return i.jsxs(swt,{children:[i.jsx(Rt,{title:"Signal endpoint actions",arrow:!0,describeChild:!0,children:i.jsx(Mt,{id:d,"data-loading":!0,"aria-controls":l?p:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:i.jsx(Mf,{})})}),i.jsx(ql,{id:p,anchorEl:s,open:l,onClose:u,onClick:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:i.jsxs(Vg,{"aria-labelledby":d,children:[i.jsxs(wn,{sx:Ex,onClick:t,children:[i.jsx(Io,{children:i.jsx($f,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Copy URL"})})]}),i.jsx(Kd,{permission:ni,children:({hasAccess:f})=>i.jsxs(wn,{sx:Ex,onClick:n,disabled:!f,children:[i.jsx(Io,{children:i.jsx(dy,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"View signals"})})]})}),i.jsx(Kd,{permission:ni,children:({hasAccess:f})=>i.jsxs(wn,{sx:Ex,onClick:r,disabled:!f,children:[i.jsx(Io,{children:i.jsx(oi,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Edit"})})]})}),i.jsx(Kd,{permission:ni,children:({hasAccess:f})=>i.jsxs(wn,{sx:Ex,onClick:o,disabled:!f,children:[i.jsx(Io,{children:i.jsx(So,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Remove"})})]})})]})})]})},awt=({signalEndpoint:e,open:t,setOpen:n,onConfirm:r})=>i.jsx(Mn,{title:"Delete signal endpoint?",open:t,primaryButtonText:"Delete signal endpoint",secondaryButtonText:"Cancel",onClick:()=>r(e),onClose:()=>{n(!1)},children:i.jsxs("p",{children:["You are about to delete signal endpoint:"," ",i.jsx("strong",{children:e==null?void 0:e.name})]})}),lwt=({checked:e,setChecked:t,title:n})=>i.jsx(vn,{children:i.jsx(Rt,{title:n||(e?"Disable":"Enable"),arrow:!0,children:i.jsx(oa,{checked:e,onChange:r=>t(r.target.checked)})})}),cwt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),uwt=({signalEndpoint:{tokens:e},value:t,onCreateToken:n})=>{const{searchQuery:r}=Pi();return!e||e.length===0?n?i.jsx(Yl,{title:"Create token",onClick:n}):i.jsx(vn,{children:"0 tokens"}):i.jsx(vn,{children:i.jsx(sd,{tooltip:i.jsx(i.Fragment,{children:e==null?void 0:e.map(({id:o,name:s})=>i.jsx(cwt,{children:i.jsx(Pr,{search:r,children:s})},o))}),highlighted:r.length>0&&t.toLowerCase().includes(r.toLowerCase()),children:(e==null?void 0:e.length)===1?"1 token":`${e==null?void 0:e.length} tokens`})})},sC="api/admin/signal-endpoints",tie=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=er({propagateErrors:!0});return{addSignalEndpointToken:async(l,c)=>{const d=n(`${sC}/${l}/tokens`,{method:"POST",body:JSON.stringify(c)},"addSignalEndpointToken");return(await t(d.caller,d.id)).json()},updateSignalEndpointToken:async(l,c,u)=>{const p=n(`${sC}/${l}/tokens/${c}`,{method:"PUT",body:JSON.stringify(u)},"updateSignalEndpointToken");await t(p.caller,p.id)},removeSignalEndpointToken:async(l,c)=>{const d=n(`${sC}/${l}/tokens/${c}`,{method:"DELETE"},"removeSignalEndpointToken");await t(d.caller,d.id)},errors:r,loading:e}},dwt=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",lineHeight:e.spacing(2.75)})),pwt=v(Ur)({marginRight:0}),fwt=v("span")(({theme:e})=>({marginLeft:e.spacing(.5),fontSize:e.fontSizes.smallBody})),hwt=({checked:e,setChecked:t,children:n,...r})=>i.jsxs(dwt,{...r,children:[n,i.jsx(pwt,{control:i.jsx(oa,{checked:e,onChange:o=>t(o.target.checked)}),label:i.jsx(fwt,{children:e?"Enabled":"Disabled"})})]}),RW={name:void 0,tokenName:void 0};var v2=(e=>(e.LATER="later",e.NOW="now",e))(v2||{});const gwt=e=>{const{signalEndpoints:t}=s0(),[n,r]=g.useState(!1),[o,s]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState("later"),[d,p]=g.useState(""),f=()=>{r((e==null?void 0:e.enabled)??!0),s((e==null?void 0:e.name)||""),l((e==null?void 0:e.description)||""),u("later"),p(""),b(!1),m(RW)};g.useEffect(()=>{f()},[e]);const[h,m]=g.useState(RW),[y,b]=g.useState(!1),x=R=>{m(_=>({..._,[R]:void 0}))},C=(R,_)=>{m(M=>({...M,[R]:_}))},w=R=>!R.length,j=R=>t==null?void 0:t.some(({id:_,name:M})=>_!==(e==null?void 0:e.id)&&M===R),k=R=>!Mgt.test(R),S=R=>w(R)?(C("name","Name is required."),!1):j(R)?(C("name","Name must be unique."),!1):k(R)?(C("name","Name must only contain alphanumeric lowercase characters, dashes and underscores."),!1):(x("name"),!0),E=(R,_)=>R==="now"&&w(_)?(C("tokenName","Token name is required."),!1):(x("tokenName"),!0);return{enabled:n,setEnabled:r,name:o,setName:s,description:a,setDescription:l,tokenGeneration:c,setTokenGeneration:u,tokenName:d,setTokenName:p,errors:h,setErrors:m,validated:y,validateName:S,validateTokenName:E,validate:()=>{const R=S(o),_=E(c,d);return b(!0),R&&_},reloadForm:f}},mwt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(1.5),gap:e.spacing(1.5),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,marginBottom:e.spacing(4),marginTop:e.spacing(3)})),ywt=v("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),xwt=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,backgroundColor:e.palette.background.elevation2,padding:e.spacing(.5,1,.5,2),width:"100%",borderRadius:e.shape.borderRadiusMedium,display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"})),vwt=({name:e})=>{const{uiConfig:t}=ut(),{setToastData:n}=_t(),r=`${t.unleashUrl}/api/signal-endpoint/${e}`,o=()=>{C7(r),n({type:"success",text:"Copied to clipboard"})};return i.jsxs(mwt,{children:[i.jsx(ywt,{children:"Signal endpoint URL:"}),i.jsxs(xwt,{children:[r,i.jsx(Rt,{title:"Copy URL",arrow:!0,children:i.jsx(Mt,{onClick:o,size:"large",children:i.jsx($f,{})})})]})]})},bwt="api/admin/signal-endpoints",Cwt={signalEndpointTokens:[]},wwt=e=>{const{isEnterprise:t}=ut(),n=Er("signals"),{data:r,error:o,mutate:s}=Ts(t()&&n,Cwt,yt(`${bwt}/${e}/tokens`),Swt);return g.useMemo(()=>({signalEndpointTokens:(r==null?void 0:r.signalEndpointTokens)??[],loading:!o&&!r,refetch:()=>s(),error:o}),[r,o,s])},Swt=e=>fetch(e).then(en("Signal endpoint tokens")).then(t=>t.json()),jwt=v("div")(({theme:e})=>({minHeight:e.spacing(12)})),Ewt=v("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),kwt=v(Yr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),Twt=({open:e,setOpen:t,tokens:n,onCreateClick:r})=>{const[o,s]=g.useState(""),[a,l]=g.useState("");g.useEffect(()=>{s(""),l("")},[e]);const c=p=>!(n!=null&&n.some(f=>f.name===p)),u=p=>{p.length?c(p)?l(""):l("Name must be unique"):l("Name is required")},d=o.length&&c(o);return i.jsx(Mn,{open:e,primaryButtonText:"Create token",secondaryButtonText:"Cancel",onClick:()=>r({name:o}),disabledPrimaryButton:!d,onClose:()=>{t(!1)},title:"New token",children:i.jsxs(jwt,{children:[i.jsx(Ewt,{children:"What is your new token name?"}),i.jsx(kwt,{autoFocus:!0,label:"Token name",error:!!a,errorText:a,value:o,onChange:p=>{u(p.target.value),s(p.target.value)},autoComplete:"off"})]})})},Rwt=v(Dt)(({theme:e})=>({marginBottom:e.spacing(3)})),Awt=v("pre")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"auto",fontSize:e.fontSizes.smallerBody})),nie=({open:e,setOpen:t,token:n,signalEndpoint:r})=>{const{uiConfig:o}=ut();return i.jsxs(Mn,{open:e,secondaryButtonText:"Close",onClose:(s,a)=>{a||t(!1)},title:"Signal endpoint token created",children:[i.jsx(Rwt,{severity:"info",children:"Make sure to copy your signal endpoint token now. You won't be able to see it again!"}),i.jsx(J,{variant:"body1",children:"Your token:"}),i.jsx(z_,{token:n||""}),i.jsx(te,{condition:!!r,show:()=>i.jsxs(i.Fragment,{children:[i.jsx(J,{variant:"body1",sx:{marginTop:3,marginBottom:2},children:"You can call your signal endpoint with the newly created token like this:"}),i.jsx(Awt,{children:`curl --request POST '${o.unleashUrl}/api/signal-endpoint/${r.name}' \\
477
477
  --header 'Authorization: Bearer ${n||"YOUR_TOKEN"}' \\
478
478
  --header 'Content-Type: application/json' \\
@@ -481,8 +481,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
481
481
  }'`})]})})]})},Pwt=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2),gap:e.spacing(2),"& > div":{[e.breakpoints.down("md")]:{marginTop:0}}})),_wt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(3)})),Iwt=v(J)(({theme:e})=>({fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(.5)})),Owt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(1.5)})),Mwt={id:"createdAt",desc:!0},$wt=({signalEndpoint:e})=>{const t=Bt(),{setToastData:n,setToastApiError:r}=_t(),o=Nn(t.breakpoints.down("md")),{signalEndpointTokens:s,refetch:a}=wwt(e.id),{refetch:l}=s0(),{addSignalEndpointToken:c,removeSignalEndpointToken:u}=tie(),[d]=g.useState(()=>({sortBy:[Mwt]})),[p,f]=g.useState(""),[h,m]=g.useState(!1),[y,b]=g.useState(!1),[x,C]=g.useState(!1),[w,j]=g.useState(""),[k,S]=g.useState(),E=async B=>{try{const{token:H}=await c(e.id,B);l(),a(),m(!1),j(H),b(!0),n({text:"Token created",type:"success"})}catch(H){r(pt(H))}},T=async()=>{if(k)try{await u(e.id,k.id),l(),a(),C(!1),n({text:"Token deleted",type:"success"})}catch(B){r(pt(B))}},R=g.useMemo(()=>[{Header:"Name",accessor:"name",Cell:wi,minWidth:100,searchable:!0},{Header:"Created",accessor:"createdAt",Cell:Cp,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>i.jsx(Ku,{children:i.jsx(Rt,{title:"Delete token",arrow:!0,describeChild:!0,children:i.jsx("span",{children:i.jsx(Mt,{onClick:()=>{S(B),C(!0)},children:i.jsx(So,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,C]),{data:_,getSearchText:M,getSearchContext:$}=Af(R,p,s),{headerGroups:z,rows:A,prepareRow:O,setHiddenColumns:L}=on.useTable({columns:R,data:_,initialState:d,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},on.useSortBy,on.useFlexLayout);return Bf([{condition:o,columns:["createdAt"]}],L,R),i.jsxs(i.Fragment,{children:[i.jsxs(Pwt,{children:[i.jsx(No,{initialValue:p,onChange:f,getSearchContext:$}),i.jsx($e,{variant:"contained",color:"primary",disabled:s.length>=goe,onClick:()=>m(!0),children:"New token"})]}),i.jsx(Ai,{value:M(p),children:i.jsx(Wp,{rows:A,headerGroups:z,prepareRow:O})}),i.jsx(te,{condition:A.length===0,show:i.jsx(te,{condition:(p==null?void 0:p.length)>0,show:i.jsxs(Gr,{children:["No tokens found matching “",p,"”"]}),elseShow:i.jsxs(_wt,{children:[i.jsx(Iwt,{children:"You have no tokens for this signal endpoint yet."}),i.jsx(Owt,{children:"Create a token to start using this signal endpoint."}),i.jsx($e,{variant:"outlined",onClick:()=>m(!0),children:"Create new signal endpoint token"})]})})}),i.jsx(Twt,{open:h,setOpen:m,tokens:s,onCreateClick:E}),i.jsx(nie,{open:y,setOpen:b,token:w,signalEndpoint:e}),i.jsx(Mn,{open:x,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:T,onClose:()=>{C(!1)},title:"Delete token?",children:i.jsxs(J,{children:['Any applications or scripts using this token "',i.jsx("strong",{children:k==null?void 0:k.name}),'" will no longer be able to make requests to this signal endpoint. You cannot undo this action.']})})]})},Dwt=v("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),pv=v("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),iC=v("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),aC=v(Yr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),Lwt=v("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4),marginBottom:e.spacing(2)})),Nwt=v("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),Fwt=({signalEndpoint:e,enabled:t,setEnabled:n,name:r,setName:o,description:s,setDescription:a,tokenGeneration:l,setTokenGeneration:c,tokenName:u,setTokenName:d,errors:p,validateName:f,validateTokenName:h,validated:m})=>{const y=x=>{setTimeout(()=>x(),300)},b=m&&Object.values(p).some(Boolean);return i.jsxs("div",{children:[i.jsx(Dwt,{children:i.jsx(hwt,{checked:t,setChecked:n,children:"Signal endpoint status"})}),i.jsx(pv,{children:"What is your new signal endpoint name?"}),i.jsx(aC,{autoFocus:!0,label:"Signal endpoint name",error:!!p.name,errorText:p.name,value:r,onChange:x=>{f(x.target.value),o(x.target.value)},onBlur:x=>y(()=>f(x.target.value)),autoComplete:"off"}),i.jsx(pv,{children:"What is your new signal endpoint description?"}),i.jsx(aC,{label:"Signal endpoint description",value:s,onChange:x=>a(x.target.value),autoComplete:"off"}),i.jsx(vwt,{name:r}),i.jsx(te,{condition:e===void 0,show:i.jsxs(Lwt,{children:[i.jsx(pv,{children:"Token"}),i.jsxs(iC,{children:["In order to connect your newly created signal endpoint, you will also need a token."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),i.jsx(Ko,{children:i.jsxs(K3,{value:l,onChange:x=>{const C=x.target.value;m&&h(C,u),c(C)},name:"token-generation",children:[i.jsx(Ur,{value:v2.LATER,control:i.jsx(el,{}),label:"I want to generate a token later"}),i.jsx(Ur,{value:v2.NOW,control:i.jsx(el,{}),label:"Generate a token now"})]})}),i.jsxs(Nwt,{children:[i.jsx(iC,{children:"A new signal endpoint token will be generated for the signal endpoint, so you can get started right away."}),i.jsx(te,{condition:l===v2.NOW,show:i.jsxs(i.Fragment,{children:[i.jsx(iC,{children:"What is your new token name?"}),i.jsx(aC,{autoFocus:!0,label:"Token name",error:!!p.tokenName,errorText:p.tokenName,value:u,onChange:x=>{h(l,x.target.value),d(x.target.value)},autoComplete:"off"})]})})]})]}),elseShow:i.jsxs(i.Fragment,{children:[i.jsx(pv,{children:"Signal endpoint tokens"}),i.jsx($wt,{signalEndpoint:e})]})}),i.jsx(te,{condition:b,show:()=>i.jsx(Dt,{severity:"error",icon:!1,children:i.jsx("ul",{children:Object.values(p).filter(Boolean).map(x=>i.jsx("li",{children:x},x))})})})]})},Bwt=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),zwt=v("h1")({fontWeight:"normal"}),Hwt=v("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Wwt=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Vwt=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),Uwt=({signalEndpoint:e,open:t,setOpen:n,newToken:r,onOpenSignals:o})=>{const{refetch:s}=s0(),{addSignalEndpoint:a,updateSignalEndpoint:l,loading:c}=eie(),{addSignalEndpointToken:u}=tie(),{setToastData:d,setToastApiError:p}=_t(),{uiConfig:f}=ut(),{enabled:h,setEnabled:m,name:y,setName:b,description:x,setDescription:C,tokenGeneration:w,setTokenGeneration:j,tokenName:k,setTokenName:S,errors:E,validateName:T,validateTokenName:R,validate:_,validated:M,reloadForm:$}=gwt(e);g.useEffect(()=>{$()},[t]);const z=e!==void 0,A=`${z?"Edit":"New"} signal endpoint`,O={enabled:h,name:y,description:x},L=()=>`curl --location --request ${z?"PUT":"POST"} '${f.unleashUrl}/api/admin/signal-endpoints${z?`/${e.id}`:""}' \\
482
482
  --header 'Authorization: INSERT_API_KEY' \\
483
483
  --header 'Content-Type: application/json' \\
484
- --data-raw '${JSON.stringify(O,void 0,2)}'`,B=async H=>{if(H.preventDefault(),!!_())try{if(z)await l(e.id,O);else{const N=await a(O);if(w===v2.NOW){const{token:I}=await u(N.id,{name:k});r(I,N)}}d({text:`Signal endpoint ${z?"updated":"added"}`,type:"success"}),s(),n(!1)}catch(N){p(pt(N))}};return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:A,children:i.jsxs(eo,{loading:c,modal:!0,description:"Signal endpoints allow third-party services to send signals to Unleash.",documentationLink:"https://docs.getunleash.io/concepts/signals",documentationLinkLabel:"Signals documentation",formatApiCode:L,children:[i.jsxs(Bwt,{children:[i.jsx(zwt,{children:A}),i.jsx(te,{condition:z,show:i.jsx(Sn,{onClick:o,children:"View signals"})})]}),i.jsxs(Hwt,{onSubmit:B,children:[i.jsx(Fwt,{signalEndpoint:e,enabled:h,setEnabled:m,name:y,setName:b,description:x,setDescription:C,tokenGeneration:w,setTokenGeneration:j,tokenName:k,setTokenName:S,errors:E,validateName:T,validateTokenName:R,validated:M}),i.jsxs(Wwt,{children:[i.jsxs($e,{type:"submit",variant:"contained",color:"primary",children:[z?"Save":"Add"," signal endpoint"]}),i.jsx(Vwt,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},Gwt="api/admin/signal-endpoints",qwt=async e=>{const t=await fetch(e);return await en("Signals")(t),t.json()},Ywt=(e,t=50,n={})=>{var x;const{isEnterprise:r}=ut(),o=Er("signals"),s=(C,w)=>!e||!r||!o||w&&!w.signalEndpointSignals.length?null:yt(`${Gwt}/${e}/signals?limit=${t}&offset=${C*t}`),{data:a,error:l,size:c,setSize:u,mutate:d}=Cee(s,qwt,{...n,revalidateAll:!0}),p=a?a.flatMap(({signalEndpointSignals:C})=>C):[],f=!a&&!l,h=c>0&&!(a!=null&&a[c-1]),m=f||h,y=((x=a==null?void 0:a[c-1])==null?void 0:x.signalEndpointSignals.length)===t;return{signalEndpointSignals:p,hasMore:y,loadMore:()=>{m||!y||u(c+1)},loading:m,refetch:()=>d(),error:l}},Kwt=g.lazy(()=>La(()=>import("./ReactJSONEditor-9cJL1vJY.js"),[])),Xwt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),Jwt=v("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Zwt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginTop:e.spacing(2),fontSize:e.fontSizes.smallBody})),Qwt=v("p")(({theme:e})=>({color:e.palette.text.secondary})),eSt=v("h1")({fontWeight:"normal"}),tSt=v("form")({display:"flex",flexDirection:"column",height:"100%"}),nSt=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),rSt=({signalEndpoint:e,open:t,setOpen:n,onOpenConfiguration:r})=>{const{uiConfig:o}=ut(),{locationSettings:s}=$r(),{signalEndpointSignals:a,hasMore:l,loadMore:c,loading:u}=Ywt(e==null?void 0:e.id,20,{refreshInterval:5e3});if(!e)return null;const d=`Signals: ${e.name}`;return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:d,children:i.jsxs(eo,{loading:u&&a.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[i.jsxs(Xwt,{children:[i.jsxs(Jwt,{children:[i.jsx(eSt,{children:d}),i.jsx(Sn,{onClick:r,children:"View configuration"})]}),i.jsxs(Zwt,{children:[i.jsxs("p",{children:[o.unleashUrl,"/api/signal-endpoint/",e.name]}),i.jsx(Qwt,{children:e.description})]})]}),i.jsxs(tSt,{children:[i.jsx(Pee,{height:960,items:a,columns:[{header:"Date",maxWidth:220,cell:({createdAt:p})=>ji(p,s==null?void 0:s.locale)},{header:"Token",maxWidth:300,cell:({tokenName:p})=>p}],sidePanelHeader:"Payload",renderContent:p=>i.jsx(g.Suspense,{fallback:null,children:i.jsx(Kwt,{content:{json:p.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})}),listEnd:i.jsx(te,{condition:l,show:i.jsx($e,{onClick:c,children:"Load more"})})}),i.jsx(te,{condition:a.length===0,show:i.jsx("p",{children:"No signals have been received on this signal endpoint."})}),i.jsx(nSt,{children:i.jsx($e,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},oSt=()=>{const{setToastData:e,setToastApiError:t}=_t(),{uiConfig:n}=ut(),{openFeedback:r,hasSubmittedFeedback:o}=Z_("signals","automatic"),{signalEndpoints:s,refetch:a}=s0(),{toggleSignalEndpoint:l,removeSignalEndpoint:c}=eie(),[u,d]=g.useState(),[p,f]=g.useState(!1),[h,m]=g.useState(!1),[y,b]=g.useState(""),[x,C]=g.useState(!1),[w,j]=g.useState(!1),k=v(Dt)(({theme:L})=>({marginBottom:L.spacing(3)})),S=v("p")(({theme:L})=>({marginBottom:L.spacing(2)})),E=async({id:L,name:B},H)=>{try{await l(L,H),e({text:`"${B}" ${H?"enabled":"disabled"}`,type:"success"}),a()}catch(N){t(pt(N))}},T=async({id:L,name:B})=>{try{await c(L),e({text:`"${B}" deleted`,type:"success"}),a(),C(!1)}catch(H){t(pt(H))}},R=Nn(br.breakpoints.down("md")),_=g.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:L}})=>i.jsx(Yl,{title:L.name,onClick:()=>{d(L),f(!0)},subtitle:L.description}),width:240},{Header:"URL",accessor:L=>`${n.unleashUrl}/api/signal-endpoint/${L.name}`,minWidth:200},{id:"tokens",Header:"Tokens",accessor:L=>{var B;return((B=L.tokens)==null?void 0:B.map(({name:H})=>H).join(`
485
- `))||""},Cell:({row:{original:L},value:B})=>i.jsx(uwt,{signalEndpoint:L,value:B,onCreateToken:()=>{d(L),f(!0)}}),searchable:!0,maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:Cp,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:L}})=>i.jsx(lwt,{checked:L.enabled,setChecked:B=>E(L,B)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:L}})=>i.jsx(iwt,{signalEndpointId:L.id,onCopyToClipboard:()=>{C7(`${n.unleashUrl}/api/signal-endpoint/${L.name}`),e({type:"success",text:"Copied to clipboard"})},onOpenSignals:()=>{d(L),j(!0)},onEdit:()=>{d(L),f(!0)},onDelete:()=>{d(L),C(!0)}}),width:90,disableSortBy:!0}],[]),[M]=g.useState({sortBy:[{id:"createdAt",desc:!0}]}),{headerGroups:$,rows:z,prepareRow:A,setHiddenColumns:O}=on.useTable({columns:_,data:s,initialState:M,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:vn}},on.useSortBy,on.useFlexLayout);return Bf([{condition:R,columns:["createdAt"]}],O,_),i.jsxs(ir,{header:i.jsx($n,{title:`Signal endpoints (${s.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!o,show:i.jsx($e,{startIcon:i.jsx(t8,{}),variant:"outlined",onClick:()=>{r({title:"Do you find signals and actions easy to use?",positiveLabel:"What do you like most about signals and actions?",areasForImprovementsLabel:"What needs to change to use signals and actions the way you want?"})},children:"Provide feedback"})}),i.jsx(lo,{variant:"contained",color:"primary",permission:hg,onClick:()=>{d(void 0),f(!0)},children:"New signal endpoint"})]})}),children:[i.jsxs(k,{severity:"info",children:[i.jsx(S,{children:"Signals and actions allow you to respond to events in your real-time monitoring system by automating tasks such as disabling a beta feature in response to an increase in errors or a drop in conversion rates."}),i.jsx(S,{children:i.jsxs("ul",{children:[i.jsxs("li",{children:[i.jsx("b",{children:"Signal endpoints"})," are used to send signals to Unleash. This allows you to integrate Unleash with any external tool."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Actions"}),", which are configured inside projects, allow you to react to those signals and enable or disable flags based on certain conditions."]})]})}),i.jsxs(S,{children:["Read more about these features in our documentation:"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/signals",target:"_blank",rel:"noreferrer",children:"Signals"})," ","and"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/actions",target:"_blank",rel:"noreferrer",children:"Actions"})]})]}),i.jsx(E_,{permissions:hg,children:i.jsxs(i.Fragment,{children:[i.jsx(Wp,{rows:z,headerGroups:$,prepareRow:A}),i.jsx(te,{condition:z.length===0,show:i.jsx(Gr,{children:"No signal endpoints available. Get started by adding one."})}),i.jsx(Uwt,{signalEndpoint:u,open:p,setOpen:f,newToken:(L,B)=>{b(L),d(B),m(!0)},onOpenSignals:()=>{f(!1),j(!0)}}),i.jsx(rSt,{signalEndpoint:u,open:w,setOpen:j,onOpenConfiguration:()=>{j(!1),f(!0)}}),i.jsx(nie,{open:h,setOpen:m,token:y,signalEndpoint:u}),i.jsx(awt,{signalEndpoint:u,open:x,setOpen:C,onConfirm:T})]})})]})},sSt=()=>{const{isEnterprise:e}=ut();return e()?i.jsx(oSt,{}):i.jsx(c0,{feature:"signals"})},iSt=g.lazy(()=>La(()=>import("./CreateProject-DEMalH1j.js"),[])),_I=()=>{const{data:e,error:t,mutate:n}=On(yt("api/admin/personal-dashboard"),aSt);return{personalDashboard:e,loading:!t&&!e,refetch:()=>n(),error:t}},aSt=e=>fetch(e).then(en("Personal Dashboard")).then(t=>t.json()),lSt=e=>{const{data:t,error:n,mutate:r}=Ts(!!e,{latestEvents:[],onboardingStatus:{status:"onboarding-started"},owners:[],roles:[]},yt(`api/admin/personal-dashboard/${e}`),cSt);return{personalDashboardProjectDetails:t,loading:!n&&!t,refetch:()=>r(),error:n}},cSt=e=>fetch(e).then(en("Personal Dashboard Project Details")).then(t=>t.json()),uSt=v("article")(({theme:e})=>({padding:e.spacing(1,2),display:"flex",gap:e.spacing(3),flexDirection:"column"})),dSt=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center",fontSize:e.spacing(1.75),fontWeight:"bold"})),au=({title:e,children:t})=>i.jsxs(uSt,{children:[e?i.jsx(dSt,{children:e}):null,t]}),sh=v("span")(({theme:e})=>({fontWeight:e.typography.fontWeightBold})),pSt=({project:e})=>i.jsxs(i.Fragment,{children:[i.jsx(J,{children:"This project already has connected SDKs and existing feature flags."}),i.jsxs(J,{children:[i.jsx(ft,{to:`/projects/${e}?create=true`,children:"Create a new feature flag"})," ","or go to the"," ",i.jsx(ft,{to:`/projects/${e}`,title:e,children:"go to the project"})," ","to work with existing flags"]})]}),fSt=e=>{const{avgHealthCurrentWindow:t,avgHealthPastWindow:n}=e;return t===null||n===null?"unknown":t>n?"improved":t<n?"declined":"consistent"},hSt=({trend:e,insights:t,project:n})=>{const{avgHealthCurrentWindow:r,avgHealthPastWindow:o}=t,s="Remember to archive your stale feature flags to keep the technical debt low.",a="This indicates that you are doing a good job of archiving your feature flags.",l=100-(r??0),c=100-(o??0);return e==="improved"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["On average, your project technical debt went down from"," ",i.jsxs(sh,{children:[c,"%"]})," ","to"," ",i.jsxs(sh,{children:[l,"%"]})," ","during the last 4 weeks."]}),i.jsx(J,{children:a})]}):e==="declined"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["On average, your project technical debt went up from"," ",i.jsxs(sh,{children:[c,"%"]})," ","to"," ",i.jsxs(sh,{children:[l,"%"]})," ","during the last 4 weeks."]}),i.jsx(J,{children:s})]}):e==="consistent"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["On average, your project technical debt has remained at"," ",i.jsxs(sh,{children:[l,"%"]})," ","during the last 4 weeks."]}),i.jsx(J,{children:a})]}):e==="unknown"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["Your current project technical debt is"," ",i.jsxs(sh,{children:[l,"%"]}),"."]}),i.jsx(J,{children:s})]}):i.jsx(pSt,{project:n})},gSt=({project:e,insights:t})=>{const n=fSt(t);return i.jsxs(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(CI,{color:"primary"}),i.jsx(J,{sx:{fontWeight:"bold"},component:"h4",children:"Technical debt"})]}),children:[i.jsx(hSt,{trend:n,insights:t,project:e}),n!=="unknown"&&i.jsx(ft,{to:`/projects/${e}?project-status`,children:"View more insights"})]})};function ih(e,t,n){let r=n.initialDeps??[],o,s=!0;function a(){var l,c,u;let d;n.key&&((l=n.debug)!=null&&l.call(n))&&(d=Date.now());const p=e();if(!(p.length!==r.length||p.some((m,y)=>r[y]!==m)))return o;r=p;let h;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(h=Date.now()),o=t(...p),n.key&&((u=n.debug)!=null&&u.call(n))){const m=Math.round((Date.now()-d)*100)/100,y=Math.round((Date.now()-h)*100)/100,b=y/16,x=(C,w)=>{for(C=String(C);C.length<w;)C=" "+C;return C};console.info(`%c⏱ ${x(y,5)} /${x(m,5)} ms`,`
484
+ --data-raw '${JSON.stringify(O,void 0,2)}'`,B=async H=>{if(H.preventDefault(),!!_())try{if(z)await l(e.id,O);else{const N=await a(O);if(w===v2.NOW){const{token:I}=await u(N.id,{name:k});r(I,N)}}d({text:`Signal endpoint ${z?"updated":"added"}`,type:"success"}),s(),n(!1)}catch(N){p(pt(N))}};return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:A,children:i.jsxs(eo,{loading:c,modal:!0,description:"Signal endpoints allow third-party services to send signals to Unleash.",documentationLink:"https://docs.getunleash.io/concepts/signals",documentationLinkLabel:"Signals documentation",formatApiCode:L,children:[i.jsxs(Bwt,{children:[i.jsx(zwt,{children:A}),i.jsx(te,{condition:z,show:i.jsx(Sn,{onClick:o,children:"View signals"})})]}),i.jsxs(Hwt,{onSubmit:B,children:[i.jsx(Fwt,{signalEndpoint:e,enabled:h,setEnabled:m,name:y,setName:b,description:x,setDescription:C,tokenGeneration:w,setTokenGeneration:j,tokenName:k,setTokenName:S,errors:E,validateName:T,validateTokenName:R,validated:M}),i.jsxs(Wwt,{children:[i.jsxs($e,{type:"submit",variant:"contained",color:"primary",children:[z?"Save":"Add"," signal endpoint"]}),i.jsx(Vwt,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},Gwt="api/admin/signal-endpoints",qwt=async e=>{const t=await fetch(e);return await en("Signals")(t),t.json()},Ywt=(e,t=50,n={})=>{var x;const{isEnterprise:r}=ut(),o=Er("signals"),s=(C,w)=>!e||!r||!o||w&&!w.signalEndpointSignals.length?null:yt(`${Gwt}/${e}/signals?limit=${t}&offset=${C*t}`),{data:a,error:l,size:c,setSize:u,mutate:d}=Cee(s,qwt,{...n,revalidateAll:!0}),p=a?a.flatMap(({signalEndpointSignals:C})=>C):[],f=!a&&!l,h=c>0&&!(a!=null&&a[c-1]),m=f||h,y=((x=a==null?void 0:a[c-1])==null?void 0:x.signalEndpointSignals.length)===t;return{signalEndpointSignals:p,hasMore:y,loadMore:()=>{m||!y||u(c+1)},loading:m,refetch:()=>d(),error:l}},Kwt=g.lazy(()=>La(()=>import("./ReactJSONEditor-BFCTTSFc.js"),[])),Xwt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),Jwt=v("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Zwt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginTop:e.spacing(2),fontSize:e.fontSizes.smallBody})),Qwt=v("p")(({theme:e})=>({color:e.palette.text.secondary})),eSt=v("h1")({fontWeight:"normal"}),tSt=v("form")({display:"flex",flexDirection:"column",height:"100%"}),nSt=v("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),rSt=({signalEndpoint:e,open:t,setOpen:n,onOpenConfiguration:r})=>{const{uiConfig:o}=ut(),{locationSettings:s}=$r(),{signalEndpointSignals:a,hasMore:l,loadMore:c,loading:u}=Ywt(e==null?void 0:e.id,20,{refreshInterval:5e3});if(!e)return null;const d=`Signals: ${e.name}`;return i.jsx(hl,{open:t,onClose:()=>{n(!1)},label:d,children:i.jsxs(eo,{loading:u&&a.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[i.jsxs(Xwt,{children:[i.jsxs(Jwt,{children:[i.jsx(eSt,{children:d}),i.jsx(Sn,{onClick:r,children:"View configuration"})]}),i.jsxs(Zwt,{children:[i.jsxs("p",{children:[o.unleashUrl,"/api/signal-endpoint/",e.name]}),i.jsx(Qwt,{children:e.description})]})]}),i.jsxs(tSt,{children:[i.jsx(Pee,{height:960,items:a,columns:[{header:"Date",maxWidth:220,cell:({createdAt:p})=>ji(p,s==null?void 0:s.locale)},{header:"Token",maxWidth:300,cell:({tokenName:p})=>p}],sidePanelHeader:"Payload",renderContent:p=>i.jsx(g.Suspense,{fallback:null,children:i.jsx(Kwt,{content:{json:p.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})}),listEnd:i.jsx(te,{condition:l,show:i.jsx($e,{onClick:c,children:"Load more"})})}),i.jsx(te,{condition:a.length===0,show:i.jsx("p",{children:"No signals have been received on this signal endpoint."})}),i.jsx(nSt,{children:i.jsx($e,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},oSt=()=>{const{setToastData:e,setToastApiError:t}=_t(),{uiConfig:n}=ut(),{openFeedback:r,hasSubmittedFeedback:o}=Z_("signals","automatic"),{signalEndpoints:s,refetch:a}=s0(),{toggleSignalEndpoint:l,removeSignalEndpoint:c}=eie(),[u,d]=g.useState(),[p,f]=g.useState(!1),[h,m]=g.useState(!1),[y,b]=g.useState(""),[x,C]=g.useState(!1),[w,j]=g.useState(!1),k=v(Dt)(({theme:L})=>({marginBottom:L.spacing(3)})),S=v("p")(({theme:L})=>({marginBottom:L.spacing(2)})),E=async({id:L,name:B},H)=>{try{await l(L,H),e({text:`"${B}" ${H?"enabled":"disabled"}`,type:"success"}),a()}catch(N){t(pt(N))}},T=async({id:L,name:B})=>{try{await c(L),e({text:`"${B}" deleted`,type:"success"}),a(),C(!1)}catch(H){t(pt(H))}},R=Nn(br.breakpoints.down("md")),_=g.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:L}})=>i.jsx(Yl,{title:L.name,onClick:()=>{d(L),f(!0)},subtitle:L.description}),width:240},{Header:"URL",accessor:L=>`${n.unleashUrl}/api/signal-endpoint/${L.name}`,minWidth:200},{id:"tokens",Header:"Tokens",accessor:L=>{var B;return((B=L.tokens)==null?void 0:B.map(({name:H})=>H).join(`
485
+ `))||""},Cell:({row:{original:L},value:B})=>i.jsx(uwt,{signalEndpoint:L,value:B,onCreateToken:()=>{d(L),f(!0)}}),searchable:!0,maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:Cp,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:L}})=>i.jsx(lwt,{checked:L.enabled,setChecked:B=>E(L,B)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:L}})=>i.jsx(iwt,{signalEndpointId:L.id,onCopyToClipboard:()=>{C7(`${n.unleashUrl}/api/signal-endpoint/${L.name}`),e({type:"success",text:"Copied to clipboard"})},onOpenSignals:()=>{d(L),j(!0)},onEdit:()=>{d(L),f(!0)},onDelete:()=>{d(L),C(!0)}}),width:90,disableSortBy:!0}],[]),[M]=g.useState({sortBy:[{id:"createdAt",desc:!0}]}),{headerGroups:$,rows:z,prepareRow:A,setHiddenColumns:O}=on.useTable({columns:_,data:s,initialState:M,sortTypes:Ds,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:vn}},on.useSortBy,on.useFlexLayout);return Bf([{condition:R,columns:["createdAt"]}],O,_),i.jsxs(ir,{header:i.jsx($n,{title:`Signal endpoints (${s.length})`,actions:i.jsxs(i.Fragment,{children:[i.jsx(te,{condition:!o,show:i.jsx($e,{startIcon:i.jsx(t8,{}),variant:"outlined",onClick:()=>{r({title:"Do you find signals and actions easy to use?",positiveLabel:"What do you like most about signals and actions?",areasForImprovementsLabel:"What needs to change to use signals and actions the way you want?"})},children:"Provide feedback"})}),i.jsx(lo,{variant:"contained",color:"primary",permission:hg,onClick:()=>{d(void 0),f(!0)},children:"New signal endpoint"})]})}),children:[i.jsxs(k,{severity:"info",children:[i.jsx(S,{children:"Signals and actions allow you to respond to events in your real-time monitoring system by automating tasks such as disabling a beta feature in response to an increase in errors or a drop in conversion rates."}),i.jsx(S,{children:i.jsxs("ul",{children:[i.jsxs("li",{children:[i.jsx("b",{children:"Signal endpoints"})," are used to send signals to Unleash. This allows you to integrate Unleash with any external tool."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Actions"}),", which are configured inside projects, allow you to react to those signals and enable or disable flags based on certain conditions."]})]})}),i.jsxs(S,{children:["Read more about these features in our documentation:"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/signals",target:"_blank",rel:"noreferrer",children:"Signals"})," ","and"," ",i.jsx("a",{href:"https://docs.getunleash.io/concepts/actions",target:"_blank",rel:"noreferrer",children:"Actions"})]})]}),i.jsx(E_,{permissions:hg,children:i.jsxs(i.Fragment,{children:[i.jsx(Wp,{rows:z,headerGroups:$,prepareRow:A}),i.jsx(te,{condition:z.length===0,show:i.jsx(Gr,{children:"No signal endpoints available. Get started by adding one."})}),i.jsx(Uwt,{signalEndpoint:u,open:p,setOpen:f,newToken:(L,B)=>{b(L),d(B),m(!0)},onOpenSignals:()=>{f(!1),j(!0)}}),i.jsx(rSt,{signalEndpoint:u,open:w,setOpen:j,onOpenConfiguration:()=>{j(!1),f(!0)}}),i.jsx(nie,{open:h,setOpen:m,token:y,signalEndpoint:u}),i.jsx(awt,{signalEndpoint:u,open:x,setOpen:C,onConfirm:T})]})})]})},sSt=()=>{const{isEnterprise:e}=ut();return e()?i.jsx(oSt,{}):i.jsx(c0,{feature:"signals"})},iSt=g.lazy(()=>La(()=>import("./CreateProject-DCsDw61O.js"),[])),_I=()=>{const{data:e,error:t,mutate:n}=On(yt("api/admin/personal-dashboard"),aSt);return{personalDashboard:e,loading:!t&&!e,refetch:()=>n(),error:t}},aSt=e=>fetch(e).then(en("Personal Dashboard")).then(t=>t.json()),lSt=e=>{const{data:t,error:n,mutate:r}=Ts(!!e,{latestEvents:[],onboardingStatus:{status:"onboarding-started"},owners:[],roles:[]},yt(`api/admin/personal-dashboard/${e}`),cSt);return{personalDashboardProjectDetails:t,loading:!n&&!t,refetch:()=>r(),error:n}},cSt=e=>fetch(e).then(en("Personal Dashboard Project Details")).then(t=>t.json()),uSt=v("article")(({theme:e})=>({padding:e.spacing(1,2),display:"flex",gap:e.spacing(3),flexDirection:"column"})),dSt=v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center",fontSize:e.spacing(1.75),fontWeight:"bold"})),au=({title:e,children:t})=>i.jsxs(uSt,{children:[e?i.jsx(dSt,{children:e}):null,t]}),sh=v("span")(({theme:e})=>({fontWeight:e.typography.fontWeightBold})),pSt=({project:e})=>i.jsxs(i.Fragment,{children:[i.jsx(J,{children:"This project already has connected SDKs and existing feature flags."}),i.jsxs(J,{children:[i.jsx(ft,{to:`/projects/${e}?create=true`,children:"Create a new feature flag"})," ","or go to the"," ",i.jsx(ft,{to:`/projects/${e}`,title:e,children:"go to the project"})," ","to work with existing flags"]})]}),fSt=e=>{const{avgHealthCurrentWindow:t,avgHealthPastWindow:n}=e;return t===null||n===null?"unknown":t>n?"improved":t<n?"declined":"consistent"},hSt=({trend:e,insights:t,project:n})=>{const{avgHealthCurrentWindow:r,avgHealthPastWindow:o}=t,s="Remember to archive your stale feature flags to keep the technical debt low.",a="This indicates that you are doing a good job of archiving your feature flags.",l=100-(r??0),c=100-(o??0);return e==="improved"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["On average, your project technical debt went down from"," ",i.jsxs(sh,{children:[c,"%"]})," ","to"," ",i.jsxs(sh,{children:[l,"%"]})," ","during the last 4 weeks."]}),i.jsx(J,{children:a})]}):e==="declined"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["On average, your project technical debt went up from"," ",i.jsxs(sh,{children:[c,"%"]})," ","to"," ",i.jsxs(sh,{children:[l,"%"]})," ","during the last 4 weeks."]}),i.jsx(J,{children:s})]}):e==="consistent"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["On average, your project technical debt has remained at"," ",i.jsxs(sh,{children:[l,"%"]})," ","during the last 4 weeks."]}),i.jsx(J,{children:a})]}):e==="unknown"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{children:["Your current project technical debt is"," ",i.jsxs(sh,{children:[l,"%"]}),"."]}),i.jsx(J,{children:s})]}):i.jsx(pSt,{project:n})},gSt=({project:e,insights:t})=>{const n=fSt(t);return i.jsxs(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(CI,{color:"primary"}),i.jsx(J,{sx:{fontWeight:"bold"},component:"h4",children:"Technical debt"})]}),children:[i.jsx(hSt,{trend:n,insights:t,project:e}),n!=="unknown"&&i.jsx(ft,{to:`/projects/${e}?project-status`,children:"View more insights"})]})};function ih(e,t,n){let r=n.initialDeps??[],o,s=!0;function a(){var l,c,u;let d;n.key&&((l=n.debug)!=null&&l.call(n))&&(d=Date.now());const p=e();if(!(p.length!==r.length||p.some((m,y)=>r[y]!==m)))return o;r=p;let h;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(h=Date.now()),o=t(...p),n.key&&((u=n.debug)!=null&&u.call(n))){const m=Math.round((Date.now()-d)*100)/100,y=Math.round((Date.now()-h)*100)/100,b=y/16,x=(C,w)=>{for(C=String(C);C.length<w;)C=" "+C;return C};console.info(`%c⏱ ${x(y,5)} /${x(m,5)} ms`,`
486
486
  font-size: .6rem;
487
487
  font-weight: bold;
488
488
  color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1,o}return a.updateDeps=l=>{r=l},a}function AW(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const mSt=(e,t)=>Math.abs(e-t)<1.01,ySt=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},PW=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},xSt=e=>e,vSt=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},bSt=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:l,height:c}=a;t({width:Math.round(l),height:Math.round(c)})};if(o(PW(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c!=null&&c.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(PW(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},_W={passive:!0},IW=typeof window>"u"?!0:"onscrollend"in window,CSt=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=e.options.useScrollendEvent&&IW?()=>{}:ySt(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=d=>()=>{const{horizontal:p,isRtl:f}=e.options;o=p?n.scrollLeft*(f&&-1||1):n.scrollTop,s(),t(o,d)},l=a(!0),c=a(!1);n.addEventListener("scroll",l,_W);const u=e.options.useScrollendEvent&&IW;return u&&n.addEventListener("scrollend",c,_W),()=>{n.removeEventListener("scroll",l),u&&n.removeEventListener("scrollend",c)}},wSt=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},SSt=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class jSt{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const a=()=>{const l=s.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:xSt,rangeExtractor:vSt,onChange:()=>{},measureElement:wSt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=ih(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let a=r-1;a>=0;a--){const l=n[a];if(o.has(l.lane))continue;const c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=ih(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,o,s,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a,lanes:l}),{key:!1}),this.getMeasurements=ih(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a,lanes:l},c)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),p=new Array(l).fill(void 0);for(let f=0;f<u;f++){const h=d[f];h&&(p[h.lane]=f)}for(let f=u;f<n;f++){const h=s(f),m=this.laneAssignments.get(f);let y,b;if(m!==void 0&&this.options.lanes>1){y=m;const j=p[y],k=j!==void 0?d[j]:void 0;b=k?k.end+this.options.gap:r+o}else{const j=this.options.lanes===1?d[f-1]:this.getFurthestMeasurement(d,f);b=j?j.end+this.options.gap:r+o,y=j?j.lane:f%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(f,y)}const x=c.get(h),C=typeof x=="number"?x:this.options.estimateSize(f),w=b+C;d[f]={index:f,start:b,size:C,end:w,key:h,lane:y},p[y]=f}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ih(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?ESt({measurements:n,outerSize:r,scrollOffset:o,lanes:s}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ih(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-s),l=Math.min(this.options.count-1,o+s);return n>=a&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o;const s=this.measurementsCache[n];if(!s)return;const a=this.itemSizeCache.get(s.key)??s.size,l=r-a;l!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,l,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.getVirtualItems=ih(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const l=n[s],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return AW(r[rie(0,r.length-1,o=>AW(r[o]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),s=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(r==="auto")if(a.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(a.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,l]=s,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((n=r[r.length-1])==null?void 0:n.end)??0;else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(l=>l===null);){const l=r[a];s[l.lane]===null&&(s[l.lane]=l.end),a--}o=Math.max(...s.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,s=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&mSt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const rie=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function ESt({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1,s=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:o};let a=rie(0,o,s,n),l=a;if(r===1)for(;l<o&&e[l].end<n+t;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<o&&c.some(d=>d<n+t);){const d=e[l];c[d.lane]=d.end,l++}const u=Array(r).fill(n+t);for(;a>=0&&u.some(d=>d>=n);){const d=e[a];u[d.lane]=d.start,a--}a=Math.max(0,a-a%r),l=Math.min(o,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const OW=typeof document<"u"?g.useLayoutEffect:g.useEffect;function kSt({useFlushSync:e=!0,...t}){const n=g.useReducer(()=>({}),{})[1],r={...t,onChange:(s,a)=>{var l;e&&a?Du.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,a)}},[o]=g.useState(()=>new jSt(r));return o.setOptions(r),OW(()=>o._didMount(),[]),OW(()=>o._willUpdate()),o}function oie(e){return kSt({observeElementRect:bSt,observeElementOffset:CSt,scrollToFn:SSt,...e})}const sie=v("div")({containerType:"inline-size"}),iie=v("article")(({theme:e})=>({backgroundColor:e.palette.divider,borderRadius:`${e.shape.borderRadiusLarge}px`,gap:"1px",display:"flex",flexFlow:"column nowrap","&>*":{backgroundColor:e.palette.background.paper}})),h8=e=>({theme:t})=>{const n="1000px",r=t.breakpoints.up("lg");return{[`@container (min-width: ${n})`]:e,"@supports not (container-type: inline-size)":{[r]:e}}},TSt=v(iie)(h8({gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"410px auto",display:"grid",gridTemplateAreas:`
@@ -490,7 +490,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
490
490
  ". owners owners"
491
491
  `})),RSt=v(iie)(h8({gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"410px",display:"grid",gridTemplateAreas:`
492
492
  "flags chart chart"
493
- `})),aie=v("div")(({theme:e})=>({padding:e.spacing(2,4)})),ASt=v(aie,{shouldForwardProp:e=>!["gridArea"].includes(e.toString())})(({theme:e,gridArea:t})=>({maxHeight:"100%",overflowY:"auto",gridArea:t})),b2=v("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({padding:e.spacing(3,4),maxHeight:"100%",overflowY:"auto",gridArea:t})),PSt=v("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({display:"none",gridArea:t,...h8({display:"block"})({theme:e})})),lie=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",width:"100%"})),cie=e=>({borderRadius:e.spacing(.5),borderLeft:`${e.spacing(.5)} solid transparent`,"&.Mui-selected":{borderLeft:`${e.spacing(.5)} solid ${e.palette.primary.main}`},display:"flex",flexDirection:"column",alignItems:"flex-start",gap:e.spacing(1)}),_St=v(Ri)(({theme:e})=>({maxHeight:"400px",overflowY:"auto",...h8({maxHeight:"100%"})({theme:e})})),ISt=48;function uie({items:e,activeIndex:t,itemKey:n,renderItem:r}){const o=g.useRef(null),s=g.useRef(!1),a=oie({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>ISt,overscan:5});return g.useEffect(()=>{t>=0&&(s.current?a.scrollToIndex(t,{align:"auto"}):(s.current=!0,a.scrollToIndex(t,{align:"start"})))},[t,a]),i.jsx(_St,{ref:o,children:i.jsx("div",{style:{height:`${a.getTotalSize()}px`,position:"relative",width:"100%"},children:a.getVirtualItems().map(l=>{const c=e[l.index];return i.jsx("div",{ref:a.measureElement,"data-index":l.index,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${l.start}px)`},children:r(c)},n(c))})})})}const die=v("div")(({theme:e,lines:t=2})=>({fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body1.fontSize,lineClamp:`${t}`,WebkitLineClamp:t,lineHeight:"1.2",display:"-webkit-box",boxOrient:"vertical",textOverflow:"ellipsis",overflow:"hidden",alignItems:"flex-start",WebkitBoxOrient:"vertical",wordBreak:"break-word"})),Ty=v("span")(({theme:e})=>({width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.neutral.border,borderRadius:"50%"})),OSt=v(Ty)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper})),MSt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.spacing(1.75),fontWeight:"bold",backgroundColor:e.palette.success.light,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(2,2,2,2)})),$St=({project:e})=>{const{trackEvent:t}=zt();return i.jsxs(au,{"data-loading":!0,title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"1"}),"Create a feature flag"]}),children:[i.jsxs("div",{children:[i.jsx("p",{children:"The project currently holds no feature flags."}),i.jsx("p",{children:"Create one to get started."})]}),i.jsx("div",{children:i.jsx($e,{href:`projects/${e}`,onClick:()=>{t("personal-dashboard",{props:{eventType:"Go to project from onboarding"}})},variant:"contained",children:"Go to project"})})]})},DSt=({project:e})=>i.jsxs(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(OSt,{children:"1"}),"Create a feature flag"]}),children:[i.jsxs(MSt,{children:[i.jsx(J,{fontWeight:"bold",variant:"body2",children:"You have created your first flag"}),i.jsx(J,{variant:"body2",children:"Go to the project to customize the flag further."})]}),i.jsx("div",{children:i.jsx($e,{component:ft,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),MW=({project:e})=>i.jsxs(au,{"data-loading":!0,title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"2"}),"Connect an SDK"]}),children:[i.jsxs("div",{children:[i.jsx("p",{children:"Your project is not yet connected to any SDK."}),i.jsx("p",{children:"To start using your feature flag, connect an SDK to the project."})]}),i.jsx("div",{children:i.jsx($e,{component:ft,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),LSt=v("ul")(({theme:e})=>({padding:0,alignItems:"flex-start",display:"flex",flexFlow:"column nowrap",gap:e.spacing(2)})),NSt=v("li")(({theme:e})=>({listStyleType:"none",padding:e.spacing(0),display:"inline-flex",gap:e.spacing(2),fontSize:e.typography.body2.fontSize,"*":{fontWeight:"normal"}}));v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center"}));const FSt=v("time")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.fontSize,marginBottom:e.spacing(1)})),BSt=v(ed)(({theme:e})=>({marginTop:e.spacing(.5)})),zSt=v(Ep)({overflowWrap:"anywhere"}),HSt=({children:e})=>e,WSt=({latestEvents:e})=>{const{locationSettings:t}=$r();return i.jsx(au,{title:i.jsx(J,{sx:{fontWeight:"bold"},component:"h4",children:"Latest events"}),children:i.jsx(LSt,{children:e.map(n=>i.jsxs(NSt,{children:[i.jsx(BSt,{src:n.createdByImageUrl}),i.jsxs("div",{children:[i.jsx(FSt,{dateTime:n.createdAt,children:ry(n.createdAt,t.locale)}),i.jsx(zSt,{components:{strong:HSt},children:n.summary||"No preview available for this event"})]})]},n.id))})})},pie=3.5,VSt=v("div")(({theme:e})=>({width:"100%",display:"flex",flexFlow:"row wrap",gap:e.spacing(1),justifyContent:"space-between"})),$W=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",minHeight:e.spacing(pie)})),USt=v("ul")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexFlow:"row wrap",listStyle:"none",padding:0})),GSt=v("ul")(({theme:e})=>({gap:e.spacing(1),flexFlow:"column",display:"flex",listStyle:"none",padding:0})),lC=v(an)({whitespace:"nowrap"}),qSt=v(vP)(({theme:e})=>({width:"max-content",height:e.spacing(pie)})),YSt=({roles:e,owners:t})=>{const n=e.slice(0,3),r=e.slice(3),o=t.filter(s=>s.ownerType!=="system");return i.jsxs(VSt,{"data-loading":!0,children:[i.jsx($W,{children:e.length>0?i.jsxs(i.Fragment,{children:[i.jsx(J,{sx:{whiteSpace:"nowrap"},variant:"body1",component:"h4",children:"Your roles in this project:"}),i.jsxs(USt,{children:[n.map(s=>i.jsx("li",{children:i.jsx(lC,{color:"secondary",children:s})},s)),r.length?i.jsx("li",{children:i.jsx(wr,{arrow:!0,title:i.jsx(GSt,{children:r.map(s=>i.jsx("li",{children:i.jsx(lC,{children:s})},s))}),children:i.jsx(lC,{color:"secondary",children:`+ ${r.length} more`},"extra-roles")})}):null]})]}):i.jsx("span",{children:"You have no project roles in this project."})}),i.jsx($W,{children:o.length>0?i.jsxs(i.Fragment,{children:[i.jsxs(J,{variant:"body1",component:"h4",sx:{whiteSpace:"nowrap"},children:["Project owner",o.length>1?"s":""]}),i.jsx(qSt,{users:o,avatarLimit:3})]}):null})]})},KSt=v("ul")(({theme:e})=>({padding:0,"li + li":{marginTop:e.spacing(2)}})),XSt=v("li")(({theme:e})=>({display:"flex",flexFlow:"row",gap:e.spacing(2)})),JSt=v("article")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),fie=({admins:e})=>i.jsx(JSt,{children:e.length?i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Your Unleash administrator",e.length>1?"s are":" is",":"]}),i.jsx(KSt,{children:e.map(t=>i.jsxs(XSt,{children:[i.jsx(ed,{sx:{margin:0},user:t}),i.jsx(J,{children:t.name||t.username||t.email})]},t.id))})]}):i.jsx("p",{children:"You have no Unleash administrators to contact."})}),ZSt=({project:e})=>i.jsxs(au,{title:`Couldn't fetch data for project "${e}".`,children:[i.jsx("p",{children:"The API request to get data for this project returned with an error."}),i.jsxs("p",{children:[`This may be due to an intermittent error or it may be due to issues with the project's id ("`,e,'"). You can try reloading to see if that helps.']})]}),QSt=({admins:e})=>i.jsx(au,{title:"Consider contacting one of your Unleash admins for help.",children:i.jsx(fie,{admins:e})}),ejt=({admins:e})=>i.jsx(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"1"}),"Contact Unleash admin"]}),children:i.jsx(fie,{admins:e})}),tjt=({owners:e})=>i.jsx(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"2"}),"Ask a project owner to add you to their project"]}),children:e.length?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Project owners in Unleash:"}),i.jsx(vP,{users:e,avatarLimit:9})]}):i.jsx("p",{children:"There are no project owners in Unleash to ask for access."})}),njt=({project:e})=>{const t=e.technicalDebt;return i.jsxs(K,{sx:{display:"flex",gap:2},children:[i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(J,{variant:"subtitle2",color:"primary",children:e.featureCount}),i.jsx(J,{variant:"caption",color:"text.secondary",children:"flags"})]}),i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(J,{variant:"subtitle2",color:"primary",children:e.memberCount}),i.jsx(J,{variant:"caption",color:"text.secondary",children:"members"})]}),i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsxs(J,{variant:"subtitle2",color:"primary",children:[t,"%"]}),i.jsx(J,{variant:"caption",color:"text.secondary",children:"technical debt"})]})]})},DW=v("div")({height:"80%"}),rjt=({project:e,selected:t,onClick:n})=>{const{trackEvent:r}=zt();return i.jsx(Or,{disablePadding:!0,sx:{mb:1},children:i.jsxs(mo,{sx:cie,selected:t,onClick:n,children:[i.jsxs(lie,{children:[i.jsx(cf,{color:"primary"}),i.jsx(die,{children:e.name}),i.jsx(Mt,{component:ft,to:`/projects/${e.id}`,size:"small",sx:{ml:"auto"},onClick:()=>{r("personal-dashboard",{props:{eventType:"Go to project from list"}})},children:i.jsx(my,{titleAccess:`projects/${e.id}`})})]}),t?i.jsx(njt,{project:e}):null]})})},ojt=({projects:e,personalDashboardProjectDetails:t,setActiveProject:n,activeProject:r,admins:o,owners:s})=>{const a=xl(t.state==="loading"),l=()=>{if(e.length===0)return{list:i.jsxs(au,{children:[i.jsx(J,{children:"You don't currently have access to any projects in the system."}),i.jsxs(J,{children:["To get started, you can"," ",i.jsx(ft,{to:"/projects?create=true",children:"create your own project"}),". Alternatively, you can review the available projects in the system and ask the owner for access."]})]}),box1:i.jsx(ejt,{admins:o}),box2:i.jsx(tjt,{owners:s})};const p=e.findIndex(y=>y.id===r),f=i.jsx(uie,{items:e,activeIndex:p,itemKey:y=>y.id,renderItem:y=>i.jsx(rjt,{project:y,selected:y.id===r,onClick:()=>n(y.id)})}),[h,m]=(()=>{switch(t.state){case"success":{const y=t.data.onboardingStatus.status??"loading",b=y==="onboarding-started";return y==="onboarded"?[i.jsx(gSt,{project:r,insights:t.data.insights}),i.jsx(WSt,{latestEvents:t.data.latestEvents})]:b?[i.jsx($St,{project:r}),i.jsx(MW,{project:r})]:[i.jsx(DSt,{project:r}),i.jsx(MW,{project:r})]}case"error":return[i.jsx(ZSt,{project:r}),i.jsx(QSt,{admins:o})];default:return[i.jsx(DW,{"data-loading":!0}),i.jsx(DW,{"data-loading":!0})]}})();return{list:f,box1:h,box2:m}},{list:c,box1:u,box2:d}=l();return i.jsx(sie,{ref:a,children:i.jsxs(TSt,{children:[i.jsx(b2,{gridArea:"projects",children:c}),i.jsx(b2,{gridArea:"box1",children:u}),i.jsx(b2,{gridArea:"box2",children:d}),i.jsx(PSt,{}),i.jsx(ASt,{gridArea:"owners",children:i.jsx(YSt,{roles:t.state==="success"?t.data.roles.map(p=>p.name):[],owners:t.state==="success"?t.data.owners:[{ownerType:"user",name:"?"}]})})]})})},II=e=>{const t={activeProject:void 0,activeFlag:void 0,expandProjects:!0,expandFlags:!0,expandTimeline:!1},[n,r]=ai("personal-dashboard:v1",t),o=d=>r({...t,...n,...d});g.useEffect(()=>{var p,f;const d={};(p=e==null?void 0:e.flags)!=null&&p.length&&(!n.activeFlag||!e.flags.some(h=>{var m;return h.name===((m=n.activeFlag)==null?void 0:m.name)}))&&(d.activeFlag=e.flags[0]),(f=e==null?void 0:e.projects)!=null&&f.length&&(!n.activeProject||!e.projects.some(h=>h.id===n.activeProject))&&(d.activeProject=e.projects[0].id),Object.keys(d).length&&o(d)},[JSON.stringify(e),JSON.stringify(n)]);const{activeFlag:s,activeProject:a}=n,l=d=>{o({activeFlag:d})},c=d=>{o({activeProject:d})},u=d=>{const f=(()=>{switch(d){case"flags":return"expandFlags";case"projects":return"expandProjects";case"timeline":return"expandTimeline"}})();o({[f]:!(n[f]??!0)})};return{activeFlag:s,setActiveFlag:l,activeProject:a,setActiveProject:c,expandFlags:n.expandFlags??!0,expandProjects:n.expandProjects??!0,expandTimeline:n.expandTimeline??!1,toggleSectionState:u}},sjt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),ijt=({flag:e,selected:t,onClick:n})=>{const{trackEvent:r}=zt(),o=v7(e.type),s=`projects/${e.project}/features/${e.name}`;return i.jsx(Or,{disablePadding:!0,sx:{mb:1},children:i.jsx(mo,{sx:cie,selected:t,onClick:n,children:i.jsxs(lie,{children:[i.jsx(o,{color:"primary"}),i.jsx(die,{children:e.name}),i.jsx(Mt,{component:Sn,href:s,onClick:()=>{r("personal-dashboard",{props:{eventType:"Go to flag from list"}})},size:"small",sx:{ml:"auto"},children:i.jsx(my,{titleAccess:s})})]})})},e.name)},ajt=({hasProjects:e,flagData:t,setActiveFlag:n,refetchDashboard:r})=>{const o=s=>{const{activeFlag:a}=s;return a?s.flags.findIndex(l=>l.name===a.name):-1};return i.jsx(sie,{children:i.jsxs(RSt,{children:[i.jsx(b2,{gridArea:"flags",children:t.state==="flags"?i.jsx(uie,{items:t.flags,activeIndex:o(t),itemKey:s=>s.name,renderItem:s=>{var a;return i.jsx(ijt,{flag:s,selected:s.name===((a=t.activeFlag)==null?void 0:a.name),onClick:()=>n(s)})}}):e?i.jsxs(sjt,{children:[i.jsx(J,{children:"You have not created or favorited any feature flags. Once you do, they will show up here."}),i.jsx(J,{children:"To create a new flag, go to one of your projects."})]}):i.jsx(Dt,{severity:"info",children:"You need to create or join a project to be able to add a flag, or you must be given the rights by your admin to add feature flags."})}),i.jsx(b2,{gridArea:"chart",children:t.state==="flags"&&t.activeFlag?i.jsx(ljt,{flag:t.activeFlag,onArchive:r}):i.jsx(cjt,{label:"Metrics for your feature flags will be shown here"})})]})})},ljt=tt.lazy(()=>La(()=>import("./FlagMetricsChart-zYDF9bet.js"),[]).then(e=>({default:e.FlagMetricsChart}))),cjt=tt.lazy(()=>La(()=>import("./FlagMetricsChart-zYDF9bet.js"),[]).then(e=>({default:e.PlaceholderFlagMetricsChartWithWrapper}))),ujt=({personalDashboardProjectDetails:e,error:t})=>t?{state:"error",error:t}:e?{state:"success",data:e}:{state:"loading"},djt="/static/upgradeHosted-D8epFMuP.png",pjt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2),padding:e.spacing(3,4),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none",position:"relative"})),fjt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center"})),hjt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(1)})),gjt=v("h2")(({theme:e})=>({margin:e.spacing(0,0,.5),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold,display:"flex",alignItems:"center",gap:e.spacing(1)})),mjt=v("ul")(({theme:e})=>({listStyle:"none",padding:0,margin:0,fontSize:e.typography.body2.fontSize,"& li":{}})),fm=v("li")(({theme:e})=>({position:"relative",paddingLeft:e.spacing(2.5),marginBottom:e.spacing(.5),"&::before":{content:'""',position:"absolute",left:0,top:e.spacing(.375),width:e.spacing(1.5),height:e.spacing(1.5),borderRadius:e.spacing(.5),backgroundColor:e.palette.primary.main}})),yjt=v(Mt)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1)})),xjt=v("img")(({theme:e})=>({width:235,margin:e.spacing(1),[e.breakpoints.down("md")]:{display:"none"}})),vjt=()=>{const[e,t]=ai("upgrade-dashboard:v1","open");if(e==="closed")return null;const n=()=>{t("closed")};return i.jsxs(pjt,{children:[i.jsx(Rt,{title:"Dismiss",arrow:!0,children:i.jsx(yjt,{"aria-label":"dismiss",onClick:n,size:"small",children:i.jsx(bo,{fontSize:"inherit"})})}),i.jsxs(fjt,{children:[i.jsxs(hjt,{children:[i.jsxs(gjt,{children:[i.jsx(Ra,{darkmode:i.jsx(sy,{}),lightmode:i.jsx(oy,{})}),"Explore our Enterprise solution"]}),i.jsx(J,{children:"Increase efficiency and improve the development process in your company with the full experience of Unleash with some key advantages like:"}),i.jsxs(mjt,{children:[i.jsx(fm,{children:"Unlimited projects and environments"}),i.jsx(fm,{children:"Priority support for managed and self-hosted options"}),i.jsx(fm,{children:"SSO/SCIM - streamlined access and account management"}),i.jsx(fm,{children:"RBAC - precise access control"}),i.jsx(fm,{children:"Change requests - reduce error risk with pull-request like experience"})]}),i.jsx("div",{children:i.jsx($e,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=dashboard",children:"View full Enterprise offering"})})]}),i.jsx(xjt,{src:Do(djt),alt:"Upgrade Unleash"})]})]})};var OI={},bjt=je;Object.defineProperty(OI,"__esModule",{value:!0});var hie=OI.default=void 0,Cjt=bjt(Ee()),wjt=i,Sjt=(0,Cjt.default)((0,wjt.jsx)("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5zm0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"}),"ToggleOn");hie=OI.default=Sjt;var MI={},jjt=je;Object.defineProperty(MI,"__esModule",{value:!0});var gie=MI.default=void 0,Ejt=jjt(Ee()),kjt=i,Tjt=(0,Ejt.default)((0,kjt.jsx)("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5zM7 15c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"}),"ToggleOff");gie=MI.default=Tjt;var $I={},Rjt=je;Object.defineProperty($I,"__esModule",{value:!0});var DI=$I.default=void 0,Ajt=Rjt(Ee()),Pjt=i,_jt=(0,Ajt.default)((0,Pjt.jsx)("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMark");DI=$I.default=_jt;var LI={},Ijt=je;Object.defineProperty(LI,"__esModule",{value:!0});var mie=LI.default=void 0,Ojt=Ijt(Ee()),Mjt=i,$jt=(0,Ojt.default)((0,Mjt.jsx)("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");mie=LI.default=$jt;var NI={},Djt=je;Object.defineProperty(NI,"__esModule",{value:!0});var FI=NI.default=void 0,Ljt=Djt(Ee()),Njt=i,Fjt=(0,Ljt.default)((0,Njt.jsx)("path",{d:"M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12c0 1.1.45 2.1 1.17 2.83l-1.41 1.41zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12c0 1.1-.45 2.1-1.17 2.83l1.41 1.41zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12zM6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65z"}),"Sensors");FI=NI.default=Fjt;const LW=v("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:t="secondary"})=>({height:e.spacing(3),width:e.spacing(3),borderRadius:"50%",backgroundColor:e.palette[t].light,border:`1px solid ${e.palette[t].main}`,display:"flex",alignItems:"center",justifyContent:"center",transition:"transform 0.2s","& svg, span":{color:e.palette[t].main},"& svg":{height:e.spacing(2.5),width:e.spacing(2.5)},"& span":{fontSize:e.fontSizes.bodySize},"&:hover":{transform:"scale(1.5)"}})),Bjt=({icon:e,type:t})=>e?i.jsx(Ta,{children:e}):t==="signal"?i.jsx(FI,{}):t==="feature-environment-enabled"?i.jsx(hie,{}):t==="feature-environment-disabled"?i.jsx(gie,{}):t.startsWith("strategy-")||t.startsWith("feature-strategy-")||t.startsWith("release-plan-")?i.jsx(TT,{sx:{marginTop:"-2px",marginRight:"-2px"}}):t.startsWith("feature-")?i.jsx(sR,{}):t.startsWith("segment-")?i.jsx(ET,{}):i.jsx(DI,{}),zjt={signal:"warning","feature-environment-enabled":"success","feature-environment-disabled":"neutral","feature-archived":"neutral"},Hjt=e=>e!==void 0&&["secondary","success","neutral","warning","error"].includes(e),yie=({group:e,...t})=>{if(e.length===1||!e.some(({type:n,icon:r})=>n!==e[0].type||r!==e[0].icon)){const n=e[0];return i.jsx(LW,{variant:Hjt(n.variant)?n.variant:zjt[n.type],...t,children:Bjt(n)})}return i.jsx(LW,{...t,children:i.jsx(mie,{})})},NW=v("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(1),gap:e.spacing(2),flexWrap:"wrap"})),FW=v("div")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.smallBody,wordBreak:"break-word",flex:1})),Wjt=v("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),BW=v("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),Vjt=v("div")(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column",gap:e.spacing(2)})),Ujt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),Gjt=v(yie)(({theme:e})=>({flexShrink:0,marginTop:e.spacing(.125),height:e.spacing(2.5),width:e.spacing(2.5),transition:"none","& > svg":{height:e.spacing(1.75)},"& > span":{fontSize:e.fontSizes.smallBody},"&:hover":{transform:"none"}})),zW=({children:e})=>e,qjt=({group:e})=>{const{locationSettings:t}=$r();if(e.length===1){const o=e[0],s=ji(o.timestamp,t==null?void 0:t.locale);return i.jsxs(i.Fragment,{children:[i.jsxs(NW,{children:[i.jsx(FW,{children:o.label}),i.jsx(Wjt,{children:s})]}),i.jsx(Ep,{components:{strong:zW},children:o.summary})]})}const n=e[0],r=Zc(n.timestamp,t==null?void 0:t.locale);return i.jsxs(i.Fragment,{children:[i.jsxs(NW,{children:[i.jsxs(FW,{children:[e.length," events occurred"]}),i.jsx(BW,{children:r})]}),i.jsx(Vjt,{children:e.map(o=>i.jsxs(Ujt,{children:[i.jsx(Gjt,{group:[o]}),i.jsxs("div",{children:[i.jsx(BW,{children:HRe(o.timestamp,t==null?void 0:t.locale)}),i.jsx(Ep,{components:{strong:zW},children:o.summary})]})]},o.id))})]})},Yjt=v("div",{shouldForwardProp:e=>e!=="position"})(({position:e})=>({position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",left:e,transform:"translateX(-50%)",zIndex:1})),Kjt=v(Ok)(({theme:e})=>({".MuiBadge-badge":{backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText}})),Xjt=({group:e,startTime:t,endTime:n})=>{const{trackEvent:r}=zt(),o=n-t,a=`${(e[0].timestamp-t)/o*100}%`,l=()=>{r("event-timeline",{props:{eventType:"event hover"}})};return i.jsx(Yjt,{position:a,onMouseEnter:l,children:i.jsx(wr,{title:i.jsx(qjt,{group:e}),maxWidth:350,arrow:!0,children:i.jsx(Kjt,{badgeContent:e.length,invisible:e.length<2,children:i.jsx(yie,{group:e})})})})},xie=g.createContext(void 0),vie=()=>{const e=g.useContext(xie);if(!e)throw new Error("useEventTimelineContext must be used within a EventTimelineProvider");return e},Vv=[{key:"30m",label:"last 30 min",value:{minutes:30},markers:["30 min ago"]},{key:"1h",label:"last hour",value:{hours:1},markers:["1 hour ago","30 min ago"]},{key:"3h",label:"last 3 hours",value:{hours:3},markers:["3 hours ago","2 hours ago","1 hour ago"]},{key:"12h",label:"last 12 hours",value:{hours:12},markers:["12 hours ago","9 hours ago","6 hours ago","3 hours ago"]},{key:"24h",label:"last 24 hours",value:{hours:24},markers:["24 hours ago","18 hours ago","12 hours ago","6 hours ago"]},{key:"48h",label:"last 48 hours",value:{hours:48},markers:["48 hours ago","36 hours ago","24 hours ago","12 hours ago"]}],Jjt={open:!1,timeSpan:Vv[0]},Zjt=({children:e})=>{const[t,n]=ai("event-timeline:v1",Jjt),r=(s,a)=>{n(l=>({...l,[s]:a}))},o={...t,setOpen:s=>r("open",s),setTimeSpan:s=>r("timeSpan",s),setEnvironment:s=>r("environment",s),setSignalsSuggestionSeen:s=>r("signalsSuggestionSeen",s)};return i.jsx(xie.Provider,{value:o,children:e})},HW=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),WW=v(xn)(({theme:e})=>({"& > div":{background:"transparent",color:e.palette.text.secondary,"& > .MuiSelect-select":{padding:e.spacing(.5,4,.5,1),background:"transparent"},"& > fieldset":{borderColor:"transparent"}}})),Qjt=v("span")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(.25)})),eEt=({totalEvents:e})=>{const{timeSpan:t,environment:n,setTimeSpan:r,setEnvironment:o}=vie(),{environments:s}=rd(),a=g.useMemo(()=>s.filter(({enabled:u})=>u),[s]);g.useEffect(()=>{if(a.length>0&&!n){const u=a.find(({type:d})=>d==="production")||a[0];o(u)}},[a]);const l=()=>i.jsx(te,{condition:!!n&&s.length>0,show:()=>i.jsx(WW,{select:!0,size:"small",variant:"outlined",value:n.name,onChange:u=>o(s.find(({name:d})=>d===u.target.value)||s[0]),children:s.map(({name:u})=>i.jsx(wn,{value:u,children:u},u))})}),c=()=>i.jsx(WW,{select:!0,size:"small",variant:"outlined",value:t.key,onChange:u=>r(Vv.find(({key:d})=>d===u.target.value)||Vv[0]),children:Vv.map(({key:u,label:d})=>i.jsx(wn,{value:u,children:d},u))});return i.jsxs(i.Fragment,{children:[i.jsx(HW,{children:i.jsxs(Qjt,{children:[e," event",e===1?"":"s",i.jsx(Zo,{tooltip:"These are key events per environment across all your projects. For more details, visit the event log."})]})}),i.jsxs(HW,{children:[i.jsx(c,{}),i.jsx(l,{})]})]})},VW={signals:[],total:0},tEt=10,bie="api/admin/signals?",nEt=()=>{const e={total:0,initialLoad:!0},t=(n,r)=>{e[n]=r};return(n,r={},o="")=>{const{isEnterprise:s}=ut(),a=Er("signals"),{KEY:l,fetcher:c}=rEt(n),u=`${o}${l}`;cy({currentKey:u,clearPrefix:bie,cacheSize:tEt});const{data:d,error:p,mutate:f,isLoading:h}=Ts(s()&&a,VW,u,c,r),m=g.useCallback(()=>{f()},[f]);return(d==null?void 0:d.total)!==void 0&&t("total",d.total),!h&&e.initialLoad&&t("initialLoad",!1),{...d||VW,loading:h,error:p,refetch:m,total:e.total,initialLoad:h&&e.initialLoad}}},rEt=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,s])=>!!s).map(([o,s])=>[o,s.toString()]))).toString(),n=`${bie}${t}`;return{fetcher:()=>{const o=yt(n);return fetch(o,{method:"GET"}).then(en("Signal query")).then(s=>s.json())},KEY:n}},oEt=nEt(),UW=v("div")({display:"flex",flexDirection:"row",justifyContent:"space-between"}),sEt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(1.5,0)})),iEt=v("div")(({theme:e})=>({position:"relative",height:e.spacing(1),width:"100%",display:"flex",alignItems:"center",padding:e.spacing(1.5,0)})),aEt=v("div")(({theme:e})=>({backgroundColor:e.palette.divider,height:e.spacing(.5),width:"100%"})),lEt=v("div")({display:"flex",alignItems:"center",justifyContent:"center",position:"relative"}),BI=v("div")(({theme:e})=>({position:"absolute",height:e.spacing(1),width:e.spacing(.25),backgroundColor:e.palette.text.secondary})),cEt=v(BI)(({theme:e})=>({top:e.spacing(-2)})),cC=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),uEt=v(BI)({left:0}),dEt=v(BI)({right:0}),pEt=["strategy-reactivated","strategy-updated","segment-updated","segment-deleted","feature-created","feature-updated","feature-variants-updated","feature-archived","feature-revived","feature-strategy-update","feature-strategy-add","feature-strategy-remove","feature-environment-enabled","feature-environment-disabled","release-plan-added","release-plan-removed","release-plan-milestone-started"],fv=e=>e.toISOString().split("T")[0],fEt=e=>"sourceId"in e,hEt=e=>new Date(e.createdAt).getTime(),gEt=(e,t,n)=>e>=t&&e<=n,GW=e=>typeof e=="string"&&e.trim().length>0,mEt=(e,t,n)=>{if(fEt(e)){const{id:r,sourceName:o="unknown source",sourceDescription:s,tokenName:a,payload:{unleashTitle:l,unleashDescription:c,unleashIcon:u,unleashVariant:d}}=e,p=l||o,f=`Signal: ${p}`,h=c?`Signal: **[${p}](/integrations/signals)** ${c}`:`Signal originated from **[${o} (${a})](/integrations/signals)** endpoint${s?`: ${s}`:""}`;return{id:r,timestamp:t,type:"signal",label:f,summary:h,...GW(u)?{icon:u}:{},...GW(d)?{variant:d}:{}}}if(!e.environment||!n||e.environment===n.name){const{id:r,type:o,label:s,summary:a,createdBy:l}=e,c=s||o,u=a||`**${l}** triggered **${o}**`;return{id:r,timestamp:t,type:o,label:c,summary:u}}},yEt=()=>{const{timeSpan:e,environment:t}=vie(),n=new Date,r=rSe(n,e.value),o=n.getTime(),s=r.getTime(),{events:a}=Bre({from:`IS:${fv(Gu(r))}`,to:`IS:${fv(n)}`,type:`IS_ANY_OF:${pEt.join(",")}`},{refreshInterval:10*1e3}),{signals:l}=oEt({from:`IS:${fv(Gu(r))}`,to:`IS:${fv(n)}`},{refreshInterval:10*1e3}),c=g.useMemo(()=>[...a,...l].reduce((f,h)=>{const m=hEt(h);if(gEt(m,s,o)){const y=mEt(h,m,t);y&&f.push(y)}return f},[]).sort((f,h)=>f.timestamp-h.timestamp),[a,l,s,o,t]),u=o-s,d=g.useMemo(()=>u*.02,[u]),p=g.useMemo(()=>c.reduce((f,h)=>{if(f.length===0)f.push([h]);else{const m=f[f.length-1],y=m[m.length-1];h.timestamp-y.timestamp<=d?m.push(h):f.push([h])}return f},[]),[c,d]);return i.jsxs(i.Fragment,{children:[i.jsx(UW,{children:i.jsx(eEt,{totalEvents:c.length})}),i.jsxs(sEt,{children:[i.jsxs(iEt,{children:[i.jsx(aEt,{}),i.jsx(uEt,{}),p.map(f=>i.jsx(Xjt,{group:f,startTime:s,endTime:o},f[0].id)),i.jsx(dEt,{})]}),i.jsxs(UW,{children:[i.jsx(cC,{children:e.markers[0]}),e.markers.slice(1).map(f=>i.jsxs(lEt,{children:[i.jsx(cEt,{}),i.jsx(cC,{children:f})]},f)),i.jsx(cC,{children:"now"})]})]})]})},xEt="/static/banner-progression-B6JPzTEE.svg",vEt=v(K)(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2),padding:e.spacing(3,4),border:`1px solid ${e.palette.secondary.border}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.secondary.light,boxShadow:"none",position:"relative"})),bEt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",justifyContent:"space-between"})),CEt=v(K)(()=>({display:"flex",flexFlow:"column nowrap"})),wEt=v(J)(({theme:e})=>({margin:0,marginBottom:e.spacing(.5),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),SEt=v(K)(({theme:e})=>({marginTop:e.spacing(2)})),jEt=v(Mt)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1)})),EEt=v(K)(({theme:e})=>({flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",[e.breakpoints.down("md")]:{display:"none"}})),kEt=()=>{const{trackEvent:e}=zt(),t=$t(),[n,r]=ai("release-templates-banner:v1","open");if(g.useEffect(()=>{n==="open"&&e("release-templates-banner",{props:{eventType:"seen"}})},[]),n==="closed")return null;const o=()=>{e("release-templates-banner",{props:{eventType:"dismissed"}}),r("closed")},s=()=>{e("release-templates-banner",{props:{eventType:"create-clicked"}}),t("/release-templates/create-template")};return i.jsxs(vEt,{children:[i.jsx(Rt,{title:"Dismiss",arrow:!0,children:i.jsx(jEt,{"aria-label":"dismiss",onClick:o,size:"small",children:i.jsx(bo,{fontSize:"inherit"})})}),i.jsxs(bEt,{children:[i.jsxs(CEt,{children:[i.jsx(wEt,{variant:"h2",children:"Get started with release templates"}),i.jsx(J,{color:"text.secondary",children:"Control your releases with milestones that can be automatically enabled or paused."}),i.jsx(SEt,{children:i.jsx($e,{variant:"contained",onClick:s,children:"Create template"})})]}),i.jsx(EEt,{children:i.jsx("img",{src:Do(xEt),alt:"Release progression"})})]})]})},Cie=g.createContext(void 0),zI=()=>{const e=g.useContext(Cie);if(!e)throw new Error("useWelcomeDialogContext must be used within a WelcomeDialogProvider");return e},TEt=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(1),flexFlow:"row wrap",alignItems:"baseline"})),REt=v($e)({fontWeight:"normal",padding:0,margin:0}),HI=v(tu,{shouldForwardProp:e=>e!=="withSummaryContentBorder"})(({theme:e,withSummaryContentBorder:t=!0})=>{const n=`1px solid ${e.palette.divider}`;return{border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none","& .expanded":{"&:before":{opacity:"0 !important"}},...t&&{"[aria-expanded='false']+.MuiCollapse-root .MuiAccordion-region":{borderTop:n},"&>.MuiAccordionSummary-root[aria-expanded='true']":{borderBottom:n}},overflow:"hidden"}}),WI=v(ru)(({theme:e})=>({border:"none",padding:e.spacing(2,4),margin:0,"&>.MuiAccordionSummary-content.MuiAccordionSummary-content":{margin:"0"}})),VI=v(nu)({padding:0}),AEt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),UI=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),GI=v("h3")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold,margin:0})),qI=v(J)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.body2.fontWeight})),PEt=()=>{const{toggleSectionState:e,expandTimeline:t}=II(),{trackEvent:n}=zt();return i.jsxs(HI,{disableGutters:!0,expanded:t??!1,onChange:()=>e("timeline"),withSummaryContentBorder:!1,children:[i.jsx(WI,{expandIcon:i.jsx(Da,{titleAccess:"Toggle timeline section"}),id:"timeline-panel-header","aria-controls":"timeline-panel-content",children:i.jsxs(UI,{children:[i.jsx(GI,{children:"Event timeline"}),i.jsxs(qI,{children:["Overview of recent activities across all projects in Unleash. Make debugging easier and"," ",i.jsx(ft,{to:"/integrations/signals",onClick:()=>{n("event-timeline",{props:{eventType:"signals clicked"}})},children:"include external signals"})," ","to get a fuller overview."]})]})}),i.jsx(VI,{children:i.jsx(aie,{children:i.jsx(yEt,{})})})]})},_Et=()=>{const{personalDashboard:e,refetch:t}=_I(),n=(e==null?void 0:e.projects)||[],{activeFlag:r,setActiveFlag:o,toggleSectionState:s,expandFlags:a}=II({flags:(e==null?void 0:e.flags)??[]});return i.jsxs(HI,{expanded:a??!0,onChange:()=>s("flags"),children:[i.jsx(WI,{expandIcon:i.jsx(Da,{titleAccess:"Toggle flags section"}),id:"flags-panel-header","aria-controls":"flags-panel-content",children:i.jsxs(UI,{children:[i.jsx(GI,{children:"My feature flags"}),i.jsx(qI,{children:"Feature flags you have created or favorited"})]})}),i.jsx(VI,{children:i.jsx(ajt,{hasProjects:(n==null?void 0:n.length)>0,flagData:e!=null&&e.flags.length?{state:"flags",activeFlag:r,flags:e.flags}:{state:"no flags"},setActiveFlag:o,refetchDashboard:t})})]})},IEt=()=>{const{personalDashboard:e}=_I(),t=(e==null?void 0:e.projects)||[],{activeProject:n,setActiveProject:r,toggleSectionState:o,expandProjects:s}=II({projects:t}),a=ujt(lSt(n));return i.jsxs(HI,{disableGutters:!0,expanded:s??!0,onChange:()=>o("projects"),children:[i.jsx(WI,{expandIcon:i.jsx(Da,{titleAccess:"Toggle projects section"}),id:"projects-panel-header","aria-controls":"projects-panel-content",children:i.jsxs(UI,{children:[i.jsx(GI,{children:"My projects"}),i.jsx(qI,{children:"Favorite projects, projects you own, and projects you are a member of"})]})}),i.jsx(VI,{children:i.jsx(ojt,{owners:(e==null?void 0:e.projectOwners)??[],admins:(e==null?void 0:e.admins)??[],projects:t,activeProject:n||"",setActiveProject:r,personalDashboardProjectDetails:a})})]})},OEt=()=>{const{user:e}=gs(),{trackEvent:t}=zt(),{setWelcomeDialog:n}=zI(),{isOss:r,isEnterprise:o}=ut(),s=Er("gtmReleaseManagement"),{personalDashboard:a}=_I(),l=(a==null?void 0:a.flags.length)===0,c=(e==null?void 0:e.name)||"";return nd(c?`Dashboard: ${c}`:"Dashboard"),g.useEffect(()=>{t("personal-dashboard",{props:{eventType:"seen"}})},[]),i.jsxs(AEt,{children:[o()&&s&&!l&&i.jsx(kEt,{}),r()&&i.jsx(vjt,{}),i.jsxs(TEt,{children:[i.jsxs(J,{component:"h2",variant:"h2",children:["Welcome ",c]}),i.jsx(REt,{sx:{fontWeight:"normal"},size:"small",variant:"text",onClick:()=>{t("personal-dashboard",{props:{eventType:"open key concepts"}}),n("open")},children:"View key concepts"})]}),i.jsx(PEt,{}),i.jsx(IEt,{}),i.jsx(_Et,{})]})},wie=e=>g.createElement("svg",{width:80,height:80,viewBox:"0 0 80 80",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...e},g.createElement("g",{clipPath:"url(#clip0_28054_15343)"},g.createElement("path",{d:"M62.9208 75.54C69.8033 75.54 75.3826 69.9606 75.3826 63.0781C75.3826 56.1957 69.8033 50.6163 62.9208 50.6163C56.0383 50.6163 50.459 56.1957 50.459 63.0781C50.459 69.9606 56.0383 75.54 62.9208 75.54Z",fill:"#194049"}),g.createElement("path",{d:"M16.834 71.409V67.2181H12.6431V71.409H16.834Z",fill:"#F5A69A"}),g.createElement("path",{d:"M37.8536 15.4618H12.6445V67.2163H37.8536V15.4618Z",fill:"#1A4049"}),g.createElement("path",{d:"M37.8554 67.2181H63.0645L63.0645 15.4636H37.8554L37.8554 67.2181Z",fill:"#31545C"}),g.createElement("path",{d:"M55.4316 46.9564H21.668V55.1928H55.4316V46.9564Z",fill:"#B3DAED"}),g.createElement("g",{opacity:.8},g.createElement("mask",{id:"mask0_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:46,width:17,height:10},g.createElement("path",{d:"M37.8389 46.9564V55.2346L21.668 55.1491V46.9564H37.8389Z",fill:"white"})),g.createElement("g",{mask:"url(#mask0_28054_15343)"},g.createElement("rect",{width:114.233,height:158.028,transform:"matrix(-0.851658 0.524097 0.524097 0.851658 44.8789 -54.2181)",fill:"url(#pattern0_28054_15343)"}))),g.createElement("path",{d:"M55.4316 27.4454H21.668V35.6818H55.4316V27.4454Z",fill:"#B3DAED"}),g.createElement("g",{opacity:.8},g.createElement("mask",{id:"mask1_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:27,width:17,height:9},g.createElement("path",{d:"M37.8389 27.4454V35.7236L21.668 35.6382V27.4454H37.8389Z",fill:"white"})),g.createElement("g",{mask:"url(#mask1_28054_15343)"},g.createElement("rect",{width:114.233,height:158.028,transform:"matrix(-0.851658 0.524097 0.524097 0.851658 44.8789 -73.731)",fill:"url(#pattern1_28054_15343)"}))),g.createElement("path",{d:"M56.5577 15.4636H63.0723V8.94908H56.5577V15.4636Z",fill:"#F5A69A"}),g.createElement("path",{d:"M63.0728 19.6545H67.2637V15.4636H63.0728V19.6545Z",fill:"#F5A69A"})),g.createElement("defs",null,g.createElement("pattern",{id:"pattern0_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},g.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),g.createElement("pattern",{id:"pattern1_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},g.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),g.createElement("clipPath",{id:"clip0_28054_15343"},g.createElement("rect",{width:80,height:80,fill:"white"})))),MEt=v("article")(({theme:e})=>({paddingBlock:e.spacing(5),display:"flex",gap:e.spacing(2),flexFlow:"column nowrap",alignItems:"center",maxWidth:e.spacing(40),margin:"auto",textAlign:"center"})),$Et=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",columnGap:e.spacing(3),rowGap:e.spacing(2),justifyContent:"center"})),DEt=()=>{const e=$t();return i.jsxs(MEt,{children:[i.jsx(wie,{}),i.jsx(J,{component:"h2",variant:"h3",children:"Get started with release templates"}),i.jsx(J,{component:"p",color:"text.secondary",children:"Control your releases with milestones that can be reused by the entire team."}),i.jsxs($Et,{children:[i.jsx($e,{component:ft,sx:{whiteSpace:"nowrap"},to:"https://docs.getunleash.io/reference/release-templates",variant:"text",rel:"noopener noreferrer",target:"_blank",children:"Read docs"}),i.jsx(lo,{sx:{whiteSpace:"nowrap"},onClick:()=>{e("/release-templates/create-template")},permission:u7,children:"New template"})]})]})},g8={primary:{card:e=>({backgroundColor:e.palette.background.default,background:e.palette.secondary.light,"&:hover":{backgroundColor:e.palette.neutral.light}}),header:e=>({fontWeight:e.typography.fontWeightRegular}),body:e=>({backgroundColor:e.palette.background.default,color:e.palette.text.secondary,"&:hover":{backgroundColor:e.palette.neutral.light},fontSize:e.fontSizes.smallBody}),footer:e=>({borderTop:`1px solid ${e.palette.divider}`,background:e.palette.background.elevation1,boxShadow:e.boxShadows.accordionFooter,color:e.palette.text.secondary})},secondary:{card:e=>({backgroundColor:e.palette.secondary.light,borderColor:e.palette.secondary.border,color:e.palette.text.primary}),header:e=>({fontWeight:e.typography.fontWeightBold}),body:e=>({backgroundColor:e.palette.secondary.light,color:e.palette.text.primary}),footer:e=>({background:e.palette.secondary.light,fontSize:e.fontSizes.bodySize})}},LEt=v(Y3,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({display:"flex",flexDirection:"column",justifyContent:"space-between",height:"100%",boxShadow:"none",border:`1px solid ${e.palette.divider}`,[e.breakpoints.down("sm")]:{justifyContent:"center"},transition:"background-color 0.2s ease-in-out",borderRadius:e.shape.borderRadiusMedium,...g8[t].card(e)})),NEt=v(K,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({padding:e.spacing(2),display:"flex",flexFlow:"column",height:"100%",position:"relative",...g8[t].body(e)})),FEt=v(K,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({display:"flex",gap:e.spacing(1),width:"100%",alignItems:"center",justifyContent:"space-between",fontSize:e.typography.body1.fontSize,color:e.palette.text.primary,lineHeight:"1.2",...g8[t].header(e)})),BEt=v(K)(({theme:e})=>({display:"grid",placeItems:"center",padding:e.spacing(.5),alignSelf:"baseline",backgroundColor:e.palette.secondary.light,color:e.palette.primary.main,borderRadius:e.shape.borderRadiusMedium,"& > svg":{height:e.spacing(2),width:e.spacing(2)}})),zEt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginLeft:"auto"})),HEt=v(K)(({theme:e})=>({marginTop:e.spacing(2)})),WEt=v(K,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({padding:e.spacing(0,2),display:"flex",alignItems:"center",justifyContent:"space-between",minHeight:e.spacing(6.25),fontSize:e.fontSizes.smallerBody,textWrap:"nowrap",...g8[t].footer(e)})),VEt=({icon:e,title:t,headerActions:n,footer:r,cardVariant:o="primary",children:s,...a})=>i.jsxs(LEt,{cardVariant:o,...a,children:[i.jsxs(NEt,{cardVariant:o,children:[i.jsxs(FEt,{cardVariant:o,children:[e&&i.jsx(BEt,{children:e}),t,n&&i.jsx(zEt,{children:n})]}),s&&i.jsx(HEt,{children:s})]}),r&&i.jsx(WEt,{cardVariant:o,children:r})]}),YI=()=>{const{makeRequest:e,createRequest:t}=er({propagateErrors:!0});return{deleteReleasePlanTemplate:async a=>{const l="deleteReleasePlanTemplate",c=`api/admin/release-plan-templates/${a}`,u=t(c,{method:"DELETE"},l);return e(u.caller,u.id)},updateReleasePlanTemplate:async(a,l)=>{const c="updateReleasePlanTemplate",u=`api/admin/release-plan-templates/${a}`,d=t(u,{method:"PUT",body:JSON.stringify(l)},c);return e(d.caller,d.id)},createReleasePlanTemplate:async a=>{const u=t("api/admin/release-plan-templates",{method:"POST",body:JSON.stringify(a)},"createReleasePlanTemplate");return(await e(u.caller,u.id)).json()},archiveReleasePlanTemplate:async a=>{const l="updateReleasePlanTemplate",c=`api/admin/release-plan-templates/archive/${a}`,u=t(c,{method:"POST"},l);return e(u.caller,u.id)}}},UEt=({template:e,open:t,setOpen:n,onConfirm:r})=>i.jsx(Mn,{title:"Archive release template?",open:t,secondaryButtonText:"Cancel",onClose:()=>{n(!1)},permissionButton:i.jsx(lo,{variant:"contained",onClick:()=>r(e),permission:sA,children:"Archive template"}),children:i.jsxs("p",{children:["You are about to archive release template:"," ",i.jsx("strong",{children:e==null?void 0:e.name})]})}),GEt=v("div")(({theme:e})=>({margin:e.spacing(-1),marginLeft:e.spacing(-.5),display:"flex",justifyContent:"center",alignItems:"center"})),qEt=v(ql)(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(1,1.5)})),YEt=({template:e})=>{const[t,n]=g.useState(null),{archiveReleasePlanTemplate:r}=YI(),{refetch:o}=ay(),{setToastData:s,setToastApiError:a}=_t(),{trackEvent:l}=zt(),[c,u]=g.useState(!1),d=pf(sA),p=g.useCallback(async()=>{try{await r(e.id),o(),s({type:"success",text:"Release template archived"}),l("release-management",{props:{eventType:"archive-template",template:e.name}})}catch(x){a(pt(x))}},[a,o,s,r]),f=!!t,h=x=>{n(x.currentTarget)},m=()=>{n(null)},y=`release-plan-template-${e.id}-actions`,b=`${y}-menu`;return i.jsxs(GEt,{onClick:x=>{x.preventDefault(),x.stopPropagation()},children:[i.jsx(Rt,{title:"Release template actions",arrow:!0,describeChild:!0,children:i.jsx(Mt,{id:y,"aria-controls":f?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":f?"true":void 0,onClick:h,type:"button",size:"small",children:i.jsx(Mf,{})})}),i.jsx(qEt,{id:b,anchorEl:t,open:f,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:i.jsxs(Vg,{"aria-labelledby":y,children:[i.jsxs(wn,{onClick:m,component:ft,to:`/release-templates/edit/${e.id}`,children:[i.jsx(Io,{children:i.jsx(oi,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Edit template"})})]}),i.jsxs(wn,{onClick:()=>{u(!0),m()},disabled:!d,children:[i.jsx(Io,{children:i.jsx(So,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Archive template"})})]})]})}),i.jsx(UEt,{template:e,open:c,setOpen:u,onConfirm:p})]})},KEt=(e,t={})=>{const n=()=>{const c=yt(`api/admin/user-admin/${e}`);return fetch(c,{method:"GET"}).then(en("Users")).then(u=>u.json())},{data:r,error:o}=On(`api/admin/user-admin/${e}`,n,t),[s,a]=g.useState(!o&&!r),l=()=>{Fo(`api/admin/user-admin/${e}`)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{user:r||{},error:o,loading:s,refetch:l}},XEt=v(K)({display:"flex",alignItems:"center",gap:br.spacing(1)}),JEt=v(xP)(({theme:e})=>({height:e.spacing(3.5),width:e.spacing(3.5),marginLeft:0})),ZEt=v(K)({display:"flex",flexDirection:"column"}),QEt=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,lineHeight:1,lineClamp:"1",WebkitLineClamp:1,display:"-webkit-box",boxOrient:"vertical",textOverflow:"ellipsis",overflow:"hidden",alignItems:"flex-start",WebkitBoxOrient:"vertical",wordBreak:"break-word",maxWidth:"100%",color:e.palette.text.primary})),ekt=({template:e})=>{const{user:t}=KEt(`${e.createdByUserId}`);return i.jsxs(XEt,{children:[i.jsx(JEt,{user:t}),i.jsxs(ZEt,{children:[i.jsx("span",{children:"Created by"}),i.jsx(QEt,{children:t.name||t.username||t.email})]})]})},tkt=v(ft)(({theme:e})=>({color:"inherit",textDecoration:"none",border:"none",padding:"0",background:"transparent",fontFamily:e.typography.fontFamily,pointer:"cursor"})),nkt=v("h3")(({theme:e})=>({margin:0,marginRight:"auto",fontSize:e.typography.body1.fontSize,lineHeight:"1.2"})),rkt=({template:e})=>i.jsx(tkt,{to:`/release-templates/edit/${e.id}`,children:i.jsx(VEt,{icon:i.jsx(wie,{}),title:i.jsx(mr,{title:e.name,arrow:!0,component:nkt,children:e.name}),headerActions:i.jsx(YEt,{template:e}),footer:i.jsx(ekt,{template:e}),children:e.description&&i.jsx(mr,{lines:2,title:e.description,arrow:!0,children:e.description})})}),okt=v(Uo)({minHeight:"180px"}),skt=({templates:e})=>i.jsx(i.Fragment,{children:e.map(t=>i.jsx(okt,{item:!0,xs:6,md:4,children:i.jsx(rkt,{template:t})},t.id))}),ikt=v(ft)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:0,color:e.palette.links,fontWeight:e.fontWeight.medium,textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"},width:"max-content"})),akt=v(X5)(({theme:e})=>({fontSize:e.spacing(2.25)})),lkt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2)})),ckt=v(Dt)(({theme:e})=>({fontSize:e.typography.body1.fontSize,"& > .MuiAlert-icon":{paddingBlock:"7px"},"& > .MuiAlert-message":{padding:e.spacing(1),display:"flex",flexFlow:"row wrap",justifyContent:"space-between",width:"100%",gap:e.spacing(1)}})),ukt=v($e)(({theme:e})=>({"&&":{color:e.palette.primary.main}})),dkt=()=>{nd("Release templates");const e=$t(),t=ay(),[n,r]=ai("releaseManagementInfoAlert","open"),{isEnterprise:o}=ut();return o()?i.jsxs(lkt,{children:[i.jsx(W3,{in:n==="open",children:i.jsxs(ckt,{severity:"info",onClose:()=>r("closed"),children:[i.jsxs(J,{component:"p",display:"inline",children:[i.jsx(J,{fontWeight:"bold",display:"block",component:"span",children:"Standardize your rollouts with Release templates."}),i.jsx(J,{component:"span",children:"Define your release process once, then reuse it across all feature flags with sequential milestones."})]}),i.jsx(ukt,{component:ft,variant:"outlined",target:"_blank",rel:"noopener noreferrer",to:"https://docs.getunleash.io/reference/release-templates",children:"Learn about release templates"})]})}),i.jsxs(ir,{header:i.jsx($n,{title:"Release templates",actions:i.jsx(kP,{Icon:Eo,onClick:()=>{e("/release-templates/create-template")},maxWidth:"700px",permission:u7,disabled:!o(),children:"New template"})}),children:[t.templates.length>0&&i.jsx(Uo,{container:!0,spacing:2,children:i.jsx(skt,{templates:t.templates})}),t.templates.length===0&&i.jsx("div",{className:Wh.fullwidth,children:i.jsx(DEt,{})})]}),i.jsxs(ikt,{to:"https://docs.getunleash.io/concepts/release-templates",rel:"noopener noreferrer",target:"_blank",children:[i.jsx(akt,{})," Read more in our documentation"]})]}):i.jsx(c0,{feature:"releaseManagement",page:!0})},uC=e=>g.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M4.48149 0.771598C5.27968 -0.159625 6.72032 -0.159624 7.51851 0.771599L10.8844 4.69842C11.5263 5.4474 11.5263 6.5526 10.8844 7.30158L7.51851 11.2284C6.72032 12.1596 5.27968 12.1596 4.48149 11.2284L1.11564 7.30158C0.47366 6.5526 0.47366 5.4474 1.11564 4.69842L4.48149 0.771598Z",fill:"#FFC46F"})),pkt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),fontSize:e.fontSizes.smallBody})),fkt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),hkt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),gkt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),mkt=v("p")(({theme:e})=>({fontWeight:e.fontWeight.bold})),dC=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),ykt=()=>i.jsxs(pkt,{children:[i.jsxs(fkt,{children:[i.jsx(ty,{}),"Release templates"]}),i.jsx("p",{children:"Standardize your team's approach to rolling out new functionality with release templates. These templates allow you to predefine strategies, or groups of strategies, making it easier to set up new flags and ensure alignment in how rollouts are managed."}),i.jsx("p",{children:"Customize templates to suit your needs by adding strategies to specific milestones. Each milestone will execute sequentially, streamlining your release process."}),i.jsxs(hkt,{children:[i.jsx(mkt,{children:"Example usage"}),i.jsxs(gkt,{children:[i.jsxs("div",{children:[i.jsxs(dC,{children:[i.jsx(uC,{}),"Milestone 1"]}),i.jsx("p",{children:"Enable the feature for internal teams to test functionality and resolve initial issues."})]}),i.jsxs("div",{children:[i.jsxs(dC,{children:[i.jsx(uC,{}),"Milestone 2"]}),i.jsx("p",{children:"Expand the rollout to 20% of beta users to gather feedback and monitor performance."})]}),i.jsxs("div",{children:[i.jsxs(dC,{children:[i.jsx(uC,{}),"Milestone 3"]}),i.jsx("p",{children:"Release the feature to all users after confirming stability and addressing earlier feedback."})]})]})]})]}),xkt=v(Yr)({width:"100%"}),vkt=v("div")(({theme:e})=>({width:"100%",height:"auto",marginRight:e.spacing(2)})),bkt=v("span")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.bodySize})),Ckt=v(oi,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t=!1})=>({cursor:"pointer",marginTop:e.spacing(-.5),marginLeft:e.spacing(.5),height:e.spacing(2.5),width:e.spacing(2.5),color:t?e.palette.error.main:e.palette.text.secondary})),wkt=v("div")({display:"inline-flex",alignItems:"center"}),qW=({milestone:e,errors:t,clearErrors:n,milestoneNameChanged:r})=>{const[o,s]=g.useState(!1);return i.jsxs(vkt,{children:[o&&i.jsx(xkt,{label:"",value:e.name,onChange:a=>r(a.target.value),error:!!(t!=null&&t[`${e.id}_name`]),errorText:t==null?void 0:t[`${e.id}_name`],onFocus:()=>n(),onBlur:()=>s(!1),autoFocus:!0,onKeyDownCapture:a=>{a.code==="Enter"&&(a.preventDefault(),a.stopPropagation(),s(!1))},onClick:a=>{a.preventDefault(),a.stopPropagation()}}),!o&&i.jsx(i.Fragment,{children:i.jsxs(wkt,{children:[i.jsx(bkt,{onClick:a=>{s(!0),a.preventDefault(),a.stopPropagation()},children:e.name}),i.jsx(Ckt,{hasError:!!(t!=null&&t[`${e.id}_name`]),onClick:a=>{s(!0),a.preventDefault(),a.stopPropagation()}})]})})]})},Skt=v("div")(({theme:e})=>({width:e.spacing(4),height:"auto","& > svg":{fill:e.palette.primary.main},"& > div":{height:e.spacing(2),marginLeft:"-.75rem",color:e.palette.primary.main}})),jkt=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Ekt=v(D7)(({theme:e})=>({fontWeight:e.fontWeight.bold})),kkt=v("div")(({theme:e})=>({display:"grid",cursor:"pointer",gridTemplateColumns:"3rem 1fr",width:"20rem",padding:e.spacing(2),color:"inherit",textDecoration:"inherit",lineHeight:1.25,borderWidth:"1px",borderStyle:"solid",borderColor:e.palette.divider,borderRadius:e.spacing(1),"&:hover, &:focus":{borderColor:e.palette.primary.main}})),Tkt=({strategy:e,onClick:t})=>{const n=TBe(e.name),r=Xl(e.name);return i.jsxs(kkt,{onClick:()=>{const o=Sre("",e);o.name==="flexibleRollout"&&(o.parameters={...o.parameters,groupId:"{{featureName}}"}),t({id:crypto.randomUUID(),name:o.name,title:"",constraints:o.constraints,parameters:o.parameters})},children:[i.jsx(Skt,{children:i.jsx(n,{})}),i.jsxs("div",{children:[i.jsx(Ekt,{text:e.displayName||r,maxWidth:"200",maxLength:25}),i.jsx(jkt,{children:e.description})]})]})},Rkt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallBody,padding:e.spacing(1,2)})),YW=({openEditAddStrategy:e})=>{const{strategies:t}=Of(),n=t.filter(o=>!o.deprecated&&!o.editable),r=o=>{e(o)};return i.jsx(Ri,{dense:!0,children:i.jsxs(i.Fragment,{children:[i.jsx(Rkt,{color:"textSecondary",children:"Predefined strategy types"}),n.map(o=>i.jsx(Or,{children:i.jsx(Tkt,{strategy:o,onClick:r})},o.name))]})})},KW=({onCancel:e,strategy:t,onAddUpdateStrategy:n,editMode:r})=>{const o=t.name||t.strategyName,[s,a]=g.useState({...t,name:o||""}),l=$7(s==null?void 0:s.constraints),c=YP(),{strategyDefinition:u}=O7(o);return u?i.jsx(eo,{modal:!0,disablePadding:!0,description:jre,documentationLink:Ere,documentationLinkLabel:kre,children:i.jsxs(Cre,{strategy:s,setStrategy:a,strategyDefinition:u,errors:c,canRenamePreexistingVariants:!0,groupIdTooltip:i.jsxs(i.Fragment,{children:["Supports ",i.jsx("strong",{children:"{{featureName}}"})," as a template variable. If not set, defaults to the feature flag name."]}),onSubmit:d=>{n(s)},children:[i.jsx($e,{variant:"contained",color:"primary",type:"submit",disabled:!l||c.hasFormErrors(),children:r?"Add changes":"Add strategy"}),i.jsx($e,{onClick:e,children:"Cancel"})]})}):null},Akt=v("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,position:"absolute",zIndex:e.zIndex.fab,top:0,transform:"translateY(-50%)",lineHeight:1,borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.secondary.border,left:e.spacing(4),[`&:has(+ * .${n6}, + .${n6})`]:{filter:"grayscale(.8)"}})),Sie=()=>i.jsx(Akt,{role:"separator",children:"OR"});var KI={},Pkt=je;Object.defineProperty(KI,"__esModule",{value:!0});var Uv=KI.default=void 0,_kt=Pkt(Ee()),Ikt=i,Okt=(0,_kt.default)((0,Ikt.jsx)("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined");Uv=KI.default=Okt;const Mkt=(e,t)=>{const{parameters:n}=e,r=g.useMemo(()=>t.find(a=>a.name===e.name),[t,e.name]),o=r==null?void 0:r.editable,s=(a,l)=>{if(!n||!a.name)return null;const{type:c,name:u}=a,d=i.jsx(mr,{title:u,children:u}),p=`${c}${l}`;switch(c){case"list":{const f=p3(n[u]);return!f||f.length===0?null:i.jsxs(Mc,{type:d,children:[f.length===1?"has 1 item:":`has ${f.length} items:`,i.jsx(p2,{values:f})]},p)}case"percentage":{const f=d3(n[u]);return i.jsxs(Mc,{type:d,children:["is set to ",i.jsx(vg,{label:`${f}%`})]},p)}case"boolean":{const f=n[u];return i.jsxs(Mc,{type:d,children:["is set to ",i.jsx(vg,{label:f})]},p)}case"string":{const f=Fu(n[u]);return i.jsxs(Mc,{type:d,children:[f===""?"is an empty string":"is set to",i.jsx(p2,{values:f===""?void 0:[f]})]},p)}case"number":{const f=d3(n[u]);return i.jsxs(Mc,{type:d,children:["is a number set to",i.jsx(p2,{values:[`${f}`]})]},p)}case"default":return null}return null};return g.useMemo(()=>{var a;return{isCustomStrategy:o,customStrategyParameters:o?(a=r==null?void 0:r.parameters)==null?void 0:a.map(s).filter(Boolean):[]}},[r,o,n])},XW=({value:e,parameters:t,hasConstraints:n,displayGroupId:r})=>{const o=d3(e),a=typeof(t==null?void 0:t.stickiness)=="string"&&(t==null?void 0:t.stickiness)!=="default"?i.jsxs(i.Fragment,{children:["with ",i.jsx("strong",{children:t.stickiness})]}):"";return i.jsx(i.Fragment,{children:i.jsxs(Mc,{type:"Rollout %",children:[i.jsx(vg,{label:`${o}%`}),i.jsxs("p",{children:["of your base ",a," ",i.jsxs("span",{children:[n?"who match constraints ":" ","is included."]}),r&&(t!=null&&t.groupId)?i.jsx(vg,{label:`groupId: ${t==null?void 0:t.groupId}`,component:"span"}):null]})]})})},$kt=(e,t)=>{const{constraints:n}=e,{parameters:r}=e,o=!!(n!=null&&n.length),s=r?Object.keys(r):[],a=l=>{const c=l.toLocaleLowerCase(),u=(r==null?void 0:r[l])||"";return c==="rollout"?i.jsx(XW,{value:u,parameters:r,hasConstraints:o,displayGroupId:t},l):["userids","hostnames","ips"].includes(c)?i.jsx(Mc,{type:l,children:i.jsx(p2,{values:p3(u)})},l):null};return g.useMemo(()=>[...s.map(a),e.name==="default"?i.jsx(XW,{value:"100"}):null].filter(Boolean),[r,o,t])},Dkt=v("div")(({theme:e})=>({padding:e.spacing(3.5,2,.5)})),Lkt=v("div")(()=>({width:"100%",position:"relative"})),Nkt=({variants:e,selected:t})=>e!=null&&e.length?i.jsx(Dkt,{children:i.jsx(Mc,{type:`Variants (${e.length})`,alignType:"top",children:i.jsx(Lkt,{children:i.jsx(bre,{variants:e,header:!1,selected:t})})})}):null,Ry=({strategy:e,displayGroupId:t=!1})=>{const{strategies:n}=Of(),{segments:r}=od(),{isCustomStrategy:o,customStrategyParameters:s}=Mkt(e,n),a=$kt(e,t),{constraints:l}=e,c=r==null?void 0:r.filter(u=>{var d;return(d=e.segments)==null?void 0:d.includes(u.id)});return i.jsxs(i.Fragment,{children:[i.jsxs(L7,{children:[c==null?void 0:c.map(u=>i.jsx(gre,{segment:u},u.id)),l==null?void 0:l.map((u,d)=>i.jsx(q7,{constraint:u},`${a0(u)}-${d}`)),(o?s:a).map((u,d)=>i.jsx(Ene,{children:u},d))]}),i.jsx(Nkt,{variants:e.variants})]})},jie=3,Fkt=v(Mt)(({theme:e})=>({marginLeft:e.spacing(-jie),padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"})),Bkt=v("hgroup")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",columnGap:"1ch",fontSize:e.typography.body1.fontSize,".strategy-name":{fontWeight:"bold",whiteSpace:"nowrap"}})),zkt=v("article")(({theme:e})=>({background:"inherit",padding:e.spacing(jie),paddingTop:e.spacing(.5),display:"flex",flexDirection:"column",rowGap:e.spacing(.5)})),Hkt=v(mr)(({theme:e})=>({fontSize:e.typography.body1.fontSize,fontWeight:"normal",margin:0})),Wkt=v("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"center",color:t?e.palette.text.secondary:e.palette.text.primary,minHeight:e.spacing(5)})),Vkt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),Ukt=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,headerItemsLeft:o,strategyHeaderLevel:s=3,children:a,style:l={},className:c})=>{const u="links"in e?({children:d})=>i.jsx(ft,{to:e.links.edit,children:d}):({children:d})=>i.jsxs(i.Fragment,{children:[" ",d," "]});return i.jsx(K,{className:e.disabled?n6:"",sx:{position:"relative"},children:i.jsxs(zkt,{style:l,className:c,children:[i.jsxs(Wkt,{disabled:!!(e!=null&&e.disabled),children:[t?i.jsx(Fkt,{tabIndex:-1,className:"strategy-drag-handle",draggable:!0,disableRipple:!0,size:"small",onDragStart:t,onDragEnd:n,sx:{cursor:"move"},children:i.jsx(e8,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})}):null,i.jsxs(Vkt,{children:[i.jsx(u,{children:i.jsx(Bkt,{children:e.title?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"strategy-name",children:[Xl(String(e.name)),":"]}),i.jsx(Hkt,{component:`h${s}`,children:e.title})]}):i.jsx(J,{className:"strategy-name",component:`h${s}`,children:Xl(String(e.name))})})}),o]}),i.jsxs(K,{sx:{marginLeft:"auto",display:"flex",alignItems:"center"},children:[e.disabled?i.jsx(an,{color:"warning",children:"Strategy disabled"}):null,r]})]}),i.jsx(K,{children:a})]})})},m8=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,strategyHeaderLevel:o})=>i.jsx(Ukt,{strategyHeaderLevel:o,strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,children:i.jsx(Ry,{strategy:e})}),Eie=({strategy:e,index:t,isDragging:n,onDragStartRef:r,onDragOver:o,onDragEnd:s,headerItemsRight:a})=>{const l=g.useRef(null);return i.jsx(K,{ref:l,onDragOver:o==null?void 0:o(l,t),sx:{opacity:n?"0.5":"1"},children:i.jsx(m8,{headerItemsRight:a,strategy:e,onDragStart:r==null?void 0:r(l,t),onDragEnd:s})},e.id)},kie=v("ol")(({theme:e})=>({listStyle:"none",padding:0,margin:0,"& > li":{paddingBlock:e.spacing(2.5),position:"relative"},"& > li + li":{borderTop:`1px solid ${e.palette.divider}`},"& > li:first-of-type":{paddingTop:e.spacing(1)}})),Gkt=e=>e.palette.background.elevation2,qkt=e=>e.palette.background.elevation1,Tie=v("li")(({theme:e,...t})=>({background:t["data-type"]==="release-plan"?Gkt(e):qkt(e)})),Ykt=v("button")(({theme:e})=>({padding:0,cursor:"grab",transition:"background-color 0.2s ease-in-out",backgroundColor:"inherit",border:"none",borderRadius:e.shape.borderRadiusMedium,color:e.palette.text.secondary,":hover, :focus-visible":{outline:"none",".draggable-hover-indicator":{background:e.palette.table.headerHover}}})),Kkt=v("span")(({theme:e})=>({paddingTop:e.spacing(2),paddingInline:e.spacing(.5),display:"block",height:"100%",width:"100%"})),Xkt=v("span")(({theme:e})=>({display:"block",paddingBlock:e.spacing(.75),borderRadius:e.shape.borderRadiusMedium,"> svg":{verticalAlign:"bottom"}})),JW=({dragItemRef:e})=>i.jsx(Ykt,{tabIndex:-1,type:"button",children:i.jsxs(Kkt,{ref:e,children:[i.jsx(Xkt,{className:"draggable-hover-indicator",children:i.jsx(e8,{"aria-hidden":!0})}),i.jsx(tc,{children:"Drag to reorder"})]})}),Rie=3,ZW=v("div")(({theme:e})=>({marginTop:e.spacing(2),"--left-padding":`var(--form-content-padding, ${e.spacing(4)})`,"--drag-column-width":`max(var(--left-padding), ${e.spacing(4)})`,"--left-offset":"calc(var(--left-padding) * -1)",marginLeft:"var(--left-offset)",display:"grid",gridTemplateColumns:"var(--drag-column-width) 1fr"})),Jkt=v(Y3,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t})=>({position:"relative",overflow:"initial",display:"flex",alignItems:"center",padding:e.spacing(2,2),paddingLeft:e.spacing(Rie),flexDirection:"row",justifyContent:"space-between",boxShadow:"none",border:`1px solid ${t?e.palette.error.border:e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down("sm")]:{justifyContent:"center"},transition:"background-color 0.2s ease-in-out",backgroundColor:e.palette.background.default})),QW=v("div")(({theme:e})=>({display:"flex",flexFlow:"row",alignItems:"center"})),Zkt=v($e)(({theme:e})=>({})),Qkt=v(tu)(({theme:e})=>({boxShadow:"none",background:"none",display:"flex",flexDirection:"column",justifyContent:"space-between",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down("sm")]:{justifyContent:"center"},backgroundColor:e.palette.background.default,"&:before":{opacity:"0 !important"},overflow:"hidden"})),eTt=v(ru)(({theme:e})=>({boxShadow:"none",padding:e.spacing(1.5,2),paddingLeft:e.spacing(Rie),borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down(400)]:{padding:e.spacing(1,2)},"&:focus-visible":{background:e.palette.table.headerHover}})),tTt=v(nu)(({theme:e})=>({borderBottomLeftRadius:e.shape.borderRadiusMedium,borderBottomRightRadius:e.shape.borderRadiusMedium,padding:e.spacing(0),backgroundColor:e.palette.background.elevation1})),nTt=v("div")(({theme:e})=>({padding:e.spacing(2),display:"flex",justifyContent:"flex-end",gap:e.spacing(3),backgroundColor:"inherit",borderTop:`1px solid ${e.palette.divider}`})),rTt=v(Mt)(({theme:e})=>({marginLeft:e.spacing(1),color:e.palette.primary.main})),oTt=({milestone:e,milestoneChanged:t,errors:n,clearErrors:r,removable:o,onDeleteMilestone:s,index:a,onMoveItem:l})=>{const[c,u]=g.useState(),[d,p]=g.useState(null),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,x]=g.useState(!!e.startExpanded),C=!!c,w=C?"MilestoneStrategyMenuPopover":void 0,j=ioe(a,l),k=()=>{u(void 0)},[S,E]=g.useState({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),T=H=>{const N=e.strategies||[];t({...e,strategies:[...N.map(I=>I.id===H.id?H:I)]})},R=H=>{var N;t({...e,strategies:[...e.strategies||[],{...H,sortOrder:((N=e.strategies)==null?void 0:N.length)||0}]})},_=H=>{var I;((I=e.strategies)==null?void 0:I.find(q=>q.id===H.id))?T(H):(R(H),x(!0)),h(!1),y(!1),E({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),r()},M=(H,N)=>{y(N),E(H),h(!0)},$=H=>(N,I)=>q=>{if(d===null||N.current===null||d.index===I||H===d.id)return;const{top:ne,bottom:V}=N.current.getBoundingClientRect(),oe=q.clientY-ne<d.height,se=V-q.clientY<d.height,ae=d.index>I;if(oe&&ae||se&&!ae){const ce=[...e.strategies||[]],_e=ce.splice(d.index,1)[0];ce.splice(I,0,_e),t({...e,strategies:ce}),p({...d,index:I})}},z=(H,N)=>I=>{var q,ne;!H.current||!e.strategies||(p({id:(q=e.strategies[N])==null?void 0:q.id,index:N,height:((ne=H.current)==null?void 0:ne.offsetHeight)||0}),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/html",H.current.outerHTML),I.dataTransfer.setDragImage(H.current,20,20))},A=()=>{p(null),O()},O=()=>{if(!e.strategies)return;const H=[...e.strategies];H.forEach((N,I)=>{N.sortOrder=I}),t({...e,strategies:H})},L=H=>{const N=e.strategies||[];t({...e,strategies:[...N.filter(I=>I.id!==H)]})},B=H=>{t({...e,name:H})};return!e.strategies||e.strategies.length===0?i.jsxs(i.Fragment,{children:[i.jsxs(ZW,{children:[i.jsx(JW,{dragItemRef:j}),i.jsxs(Jkt,{hasError:!!(n!=null&&n[e.id])||!!(n!=null&&n[`${e.id}_name`]),children:[i.jsx(QW,{children:i.jsx(qW,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:B})}),i.jsxs(QW,{children:[i.jsx($e,{variant:"outlined",color:"primary",onClick:H=>u(H.currentTarget),children:"Add strategy"}),i.jsx(rTt,{title:"Remove milestone",onClick:s,disabled:!o,children:i.jsx(Uv,{})}),i.jsx(ql,{id:w,open:C,anchorEl:c,onClose:k,onClick:k,PaperProps:{sx:H=>({paddingBottom:H.spacing(1)})},children:i.jsx(YW,{openEditAddStrategy:H=>{M(H,!1)}})})]})]})]}),i.jsx(Gw,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),i.jsx(hl,{label:"Add strategy to template milestone",onClose:()=>{h(!1),y(!1)},open:f,children:i.jsx(KW,{strategy:S,onAddUpdateStrategy:_,onCancel:()=>{h(!1),y(!1)},editMode:m})})]}):i.jsxs(i.Fragment,{children:[i.jsxs(ZW,{children:[i.jsx(JW,{dragItemRef:j}),i.jsxs(Qkt,{expanded:b,onChange:(H,N)=>x(N),children:[i.jsx(eTt,{expandIcon:i.jsx(Da,{titleAccess:`${b?"Hide":"Show"} milestone strategies`}),id:`milestone-accordion-summary-${e.id}`,"aria-controls":`milestone-accordion-details-${e.id}`,children:i.jsx(qW,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:B})}),i.jsxs(tTt,{children:[i.jsx(kie,{children:e.strategies.map((H,N)=>i.jsxs(Tie,{children:[N>0?i.jsx(Sie,{}):null,i.jsx(Eie,{index:N,onDragEnd:A,onDragStartRef:z,onDragOver:$(H.id),isDragging:(d==null?void 0:d.id)===H.id,strategy:{...H,name:H.name||H.strategyName||""},headerItemsRight:i.jsxs(i.Fragment,{children:[i.jsx(Mt,{title:"Edit strategy",onClick:()=>{M(H,!0)},children:i.jsx(oi,{})}),i.jsx(Mt,{title:"Remove strategy",onClick:()=>L(H.id),children:i.jsx(Uv,{})})]})})]},H.id))}),i.jsxs(nTt,{children:[i.jsxs($e,{variant:"text",color:"primary",onClick:s,disabled:!o,children:[i.jsx(Uv,{})," Remove milestone"]}),i.jsx(Zkt,{variant:"outlined",color:"primary",onClick:H=>u(H.currentTarget),children:"Add strategy"}),i.jsx(ql,{id:w,open:C,anchorEl:c,onClose:k,onClick:k,PaperProps:{sx:H=>({paddingBottom:H.spacing(1)})},children:i.jsx(YW,{openEditAddStrategy:H=>{M(H,!1)}})})]})]})]})]}),i.jsx(Gw,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),i.jsx(hl,{label:"Add strategy to template milestone",onClose:()=>{h(!1),y(!1)},open:f,children:i.jsx(KW,{strategy:S,onAddUpdateStrategy:_,onCancel:()=>{h(!1),y(!1)},editMode:m})})]})},sTt=v($e)(({theme:e})=>({marginTop:e.spacing(1),maxWidth:e.spacing(20)})),iTt=({milestones:e,setMilestones:t,errors:n,clearErrors:r,milestoneChanged:o})=>{const s=g.useCallback(async({dragIndex:l,dropIndex:c,event:u,draggedElement:d})=>{if(u.type!=="drop"&&u.type==="dragenter"&&l!==c){const p=u.target,f=d.getBoundingClientRect().height,{top:h,bottom:m}=p.getBoundingClientRect(),y=u.clientY-h<f,b=m-u.clientY<f;if(l>c?y:b){const j=[...e||[]],k=j.splice(l,1)[0];j.splice(c,0,k),j.forEach((S,E)=>{S.sortOrder=E}),t(j)}}},[e]),a=l=>()=>{t(c=>c.filter(u=>u.id!==l).map((u,d)=>({...u,sortOrder:d})))};return i.jsxs(i.Fragment,{children:[e.map((l,c)=>i.jsx(oTt,{index:c,onMoveItem:s,milestone:l,milestoneChanged:o,errors:n,clearErrors:r,removable:e.length>1,onDeleteMilestone:a(l.id)},l.id)),i.jsx(sTt,{variant:"text",color:"primary",startIcon:i.jsx(Eo,{}),onClick:()=>t(l=>{var c;return[...l,{id:crypto.randomUUID(),name:`Milestone ${l.length+1}`,sortOrder:l.length,strategies:(c=l[l.length-1].strategies)==null?void 0:c.map(u=>({...u,id:crypto.randomUUID()})),startExpanded:!0}]}),children:"Add milestone"})]})},Aie=v(Yr)(({theme:e})=>({width:"100%",fieldset:{border:"none"},"label::first-letter":{textTransform:"uppercase"},marginBottom:e.spacing(2),padding:e.spacing(0)})),aTt=v(Aie)(({theme:e})=>({padding:e.spacing(2,5,1,1.75)})),lTt=v("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",paddingTop:e.spacing(5)})),cTt=v(K)(({theme:e})=>({flex:1,display:"flex",alignItems:"flex-end",marginTop:e.spacing(3),marginBottom:e.spacing(3)})),Pie=({name:e,setName:t,description:n,setDescription:r,milestones:o,setMilestones:s,errors:a,clearErrors:l,formTitle:c,archived:u,formatApiCode:d,handleSubmit:p,Limit:f,children:h})=>{const m=Bt(),y=b=>{s(x=>x.map(C=>C.id===b.id?{...b}:C))};return i.jsxs(eo,{title:c,description:i.jsx(ykt,{}),formatApiCode:d,children:[u&&i.jsx(Dt,{severity:"warning",children:"This template has been archived and can no longer be edited."}),i.jsxs(lTt,{onSubmit:p,children:[i.jsx(Aie,{label:"Template name","aria-required":!0,value:e,onChange:b=>t(b.target.value),error:!!a.name,errorText:a.name,onFocus:()=>{delete a.name},autoFocus:!0,InputProps:{style:{fontSize:m.typography.h1.fontSize}},InputLabelProps:{style:{fontSize:m.typography.h1.fontSize}},size:"medium"}),i.jsx(aTt,{label:"Template description (optional)",multiline:!0,value:n,onChange:b=>r(b.target.value),InputProps:{style:{fontSize:m.typography.h2.fontSize,padding:0}},InputLabelProps:{style:{fontSize:m.typography.h2.fontSize,padding:0}},size:"small"}),i.jsx(iTt,{milestones:o,setMilestones:s,errors:a,clearErrors:l,milestoneChanged:y}),i.jsx(cTt,{children:f}),h]})]})},_ie=(e="",t="",n=[{id:crypto.randomUUID(),name:"Milestone 1",sortOrder:0}])=>{const r=wo("templateId"),{templates:o}=ay(),[s,a]=g.useState(e),[l,c]=g.useState(t),[u,d]=g.useState(n),[p,f]=g.useState({});return g.useEffect(()=>{a(e)},[e]),g.useEffect(()=>{c(t)},[t]),g.useEffect(()=>{d(n)},[n.length]),{name:s,setName:a,description:l,setDescription:c,milestones:u,setMilestones:d,errors:p,clearErrors:()=>{f({})},validate:()=>{let b=!0;s.length===0&&(f(w=>({...w,name:"Name can not be empty."})),b=!1),o.some(w=>w.name===s&&w.id!==r)&&(f(w=>({...w,name:"A template with this name already exists."})),b=!1),u.length===0&&(f(w=>({...w,milestones:"At least one milestone is required."})),b=!1);const x={},C=new Set;return u.forEach(w=>{(!w.name||w.name.length===0)&&(x[w.id]="Milestone must have a valid name.",x[`${w.id}_name`]="Milestone must have a valid name."),(!w.strategies||w.strategies.length===0)&&(x[w.id]="Milestone must have at least one strategy."),C.has(w.name)?x[w.id]="Milestone names must be unique.":w.name&&C.add(w.name)}),Object.keys(x).length>0&&(f(w=>({...w,...x,milestones:"All milestones must have unique names and at least one strategy each."})),b=!1),b},getTemplatePayload:()=>({name:s,description:l,milestones:u.map(({startExpanded:b,...x})=>{var C;return{...x,strategies:(C=x.strategies)==null?void 0:C.map(({strategyName:w,name:j,...k})=>({name:j||w||"",...k}))}})})}},uTt=v("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),dTt=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),pTt=()=>{const{uiConfig:e,isEnterprise:t}=ut(),{setToastApiError:n,setToastData:r}=_t(),o=$t(),{createReleasePlanTemplate:s}=YI(),{trackEvent:a}=zt(),{templates:l}=ay(),c=e.resourceLimits.releaseTemplates,u=l.length<c;nd("Create release template");const{name:d,setName:p,description:f,setDescription:h,milestones:m,setMilestones:y,errors:b,clearErrors:x,validate:C,getTemplatePayload:w}=_ie(),j=()=>{o(Ii)},k=async E=>{if(E.preventDefault(),x(),C())try{const R=await s(w());vZ(),r({type:"success",text:u?"Release template created":"You have reached the limit of release templates.",persist:!u}),a("release-management",{props:{eventType:"create-template",template:R.name}}),o("/release-templates")}catch(R){n(pt(R))}},S=()=>`curl --location --request POST '${e.unleashUrl}/api/admin/release-plan-templates' \\
493
+ `})),aie=v("div")(({theme:e})=>({padding:e.spacing(2,4)})),ASt=v(aie,{shouldForwardProp:e=>!["gridArea"].includes(e.toString())})(({theme:e,gridArea:t})=>({maxHeight:"100%",overflowY:"auto",gridArea:t})),b2=v("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({padding:e.spacing(3,4),maxHeight:"100%",overflowY:"auto",gridArea:t})),PSt=v("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({display:"none",gridArea:t,...h8({display:"block"})({theme:e})})),lie=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",width:"100%"})),cie=e=>({borderRadius:e.spacing(.5),borderLeft:`${e.spacing(.5)} solid transparent`,"&.Mui-selected":{borderLeft:`${e.spacing(.5)} solid ${e.palette.primary.main}`},display:"flex",flexDirection:"column",alignItems:"flex-start",gap:e.spacing(1)}),_St=v(Ri)(({theme:e})=>({maxHeight:"400px",overflowY:"auto",...h8({maxHeight:"100%"})({theme:e})})),ISt=48;function uie({items:e,activeIndex:t,itemKey:n,renderItem:r}){const o=g.useRef(null),s=g.useRef(!1),a=oie({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>ISt,overscan:5});return g.useEffect(()=>{t>=0&&(s.current?a.scrollToIndex(t,{align:"auto"}):(s.current=!0,a.scrollToIndex(t,{align:"start"})))},[t,a]),i.jsx(_St,{ref:o,children:i.jsx("div",{style:{height:`${a.getTotalSize()}px`,position:"relative",width:"100%"},children:a.getVirtualItems().map(l=>{const c=e[l.index];return i.jsx("div",{ref:a.measureElement,"data-index":l.index,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${l.start}px)`},children:r(c)},n(c))})})})}const die=v("div")(({theme:e,lines:t=2})=>({fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body1.fontSize,lineClamp:`${t}`,WebkitLineClamp:t,lineHeight:"1.2",display:"-webkit-box",boxOrient:"vertical",textOverflow:"ellipsis",overflow:"hidden",alignItems:"flex-start",WebkitBoxOrient:"vertical",wordBreak:"break-word"})),Ty=v("span")(({theme:e})=>({width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.neutral.border,borderRadius:"50%"})),OSt=v(Ty)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper})),MSt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.spacing(1.75),fontWeight:"bold",backgroundColor:e.palette.success.light,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(2,2,2,2)})),$St=({project:e})=>{const{trackEvent:t}=zt();return i.jsxs(au,{"data-loading":!0,title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"1"}),"Create a feature flag"]}),children:[i.jsxs("div",{children:[i.jsx("p",{children:"The project currently holds no feature flags."}),i.jsx("p",{children:"Create one to get started."})]}),i.jsx("div",{children:i.jsx($e,{href:`projects/${e}`,onClick:()=>{t("personal-dashboard",{props:{eventType:"Go to project from onboarding"}})},variant:"contained",children:"Go to project"})})]})},DSt=({project:e})=>i.jsxs(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(OSt,{children:"1"}),"Create a feature flag"]}),children:[i.jsxs(MSt,{children:[i.jsx(J,{fontWeight:"bold",variant:"body2",children:"You have created your first flag"}),i.jsx(J,{variant:"body2",children:"Go to the project to customize the flag further."})]}),i.jsx("div",{children:i.jsx($e,{component:ft,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),MW=({project:e})=>i.jsxs(au,{"data-loading":!0,title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"2"}),"Connect an SDK"]}),children:[i.jsxs("div",{children:[i.jsx("p",{children:"Your project is not yet connected to any SDK."}),i.jsx("p",{children:"To start using your feature flag, connect an SDK to the project."})]}),i.jsx("div",{children:i.jsx($e,{component:ft,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),LSt=v("ul")(({theme:e})=>({padding:0,alignItems:"flex-start",display:"flex",flexFlow:"column nowrap",gap:e.spacing(2)})),NSt=v("li")(({theme:e})=>({listStyleType:"none",padding:e.spacing(0),display:"inline-flex",gap:e.spacing(2),fontSize:e.typography.body2.fontSize,"*":{fontWeight:"normal"}}));v("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center"}));const FSt=v("time")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.fontSize,marginBottom:e.spacing(1)})),BSt=v(ed)(({theme:e})=>({marginTop:e.spacing(.5)})),zSt=v(Ep)({overflowWrap:"anywhere"}),HSt=({children:e})=>e,WSt=({latestEvents:e})=>{const{locationSettings:t}=$r();return i.jsx(au,{title:i.jsx(J,{sx:{fontWeight:"bold"},component:"h4",children:"Latest events"}),children:i.jsx(LSt,{children:e.map(n=>i.jsxs(NSt,{children:[i.jsx(BSt,{src:n.createdByImageUrl}),i.jsxs("div",{children:[i.jsx(FSt,{dateTime:n.createdAt,children:ry(n.createdAt,t.locale)}),i.jsx(zSt,{components:{strong:HSt},children:n.summary||"No preview available for this event"})]})]},n.id))})})},pie=3.5,VSt=v("div")(({theme:e})=>({width:"100%",display:"flex",flexFlow:"row wrap",gap:e.spacing(1),justifyContent:"space-between"})),$W=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",minHeight:e.spacing(pie)})),USt=v("ul")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexFlow:"row wrap",listStyle:"none",padding:0})),GSt=v("ul")(({theme:e})=>({gap:e.spacing(1),flexFlow:"column",display:"flex",listStyle:"none",padding:0})),lC=v(an)({whitespace:"nowrap"}),qSt=v(vP)(({theme:e})=>({width:"max-content",height:e.spacing(pie)})),YSt=({roles:e,owners:t})=>{const n=e.slice(0,3),r=e.slice(3),o=t.filter(s=>s.ownerType!=="system");return i.jsxs(VSt,{"data-loading":!0,children:[i.jsx($W,{children:e.length>0?i.jsxs(i.Fragment,{children:[i.jsx(J,{sx:{whiteSpace:"nowrap"},variant:"body1",component:"h4",children:"Your roles in this project:"}),i.jsxs(USt,{children:[n.map(s=>i.jsx("li",{children:i.jsx(lC,{color:"secondary",children:s})},s)),r.length?i.jsx("li",{children:i.jsx(wr,{arrow:!0,title:i.jsx(GSt,{children:r.map(s=>i.jsx("li",{children:i.jsx(lC,{children:s})},s))}),children:i.jsx(lC,{color:"secondary",children:`+ ${r.length} more`},"extra-roles")})}):null]})]}):i.jsx("span",{children:"You have no project roles in this project."})}),i.jsx($W,{children:o.length>0?i.jsxs(i.Fragment,{children:[i.jsxs(J,{variant:"body1",component:"h4",sx:{whiteSpace:"nowrap"},children:["Project owner",o.length>1?"s":""]}),i.jsx(qSt,{users:o,avatarLimit:3})]}):null})]})},KSt=v("ul")(({theme:e})=>({padding:0,"li + li":{marginTop:e.spacing(2)}})),XSt=v("li")(({theme:e})=>({display:"flex",flexFlow:"row",gap:e.spacing(2)})),JSt=v("article")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),fie=({admins:e})=>i.jsx(JSt,{children:e.length?i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Your Unleash administrator",e.length>1?"s are":" is",":"]}),i.jsx(KSt,{children:e.map(t=>i.jsxs(XSt,{children:[i.jsx(ed,{sx:{margin:0},user:t}),i.jsx(J,{children:t.name||t.username||t.email})]},t.id))})]}):i.jsx("p",{children:"You have no Unleash administrators to contact."})}),ZSt=({project:e})=>i.jsxs(au,{title:`Couldn't fetch data for project "${e}".`,children:[i.jsx("p",{children:"The API request to get data for this project returned with an error."}),i.jsxs("p",{children:[`This may be due to an intermittent error or it may be due to issues with the project's id ("`,e,'"). You can try reloading to see if that helps.']})]}),QSt=({admins:e})=>i.jsx(au,{title:"Consider contacting one of your Unleash admins for help.",children:i.jsx(fie,{admins:e})}),ejt=({admins:e})=>i.jsx(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"1"}),"Contact Unleash admin"]}),children:i.jsx(fie,{admins:e})}),tjt=({owners:e})=>i.jsx(au,{title:i.jsxs(i.Fragment,{children:[i.jsx(Ty,{children:"2"}),"Ask a project owner to add you to their project"]}),children:e.length?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Project owners in Unleash:"}),i.jsx(vP,{users:e,avatarLimit:9})]}):i.jsx("p",{children:"There are no project owners in Unleash to ask for access."})}),njt=({project:e})=>{const t=e.technicalDebt;return i.jsxs(K,{sx:{display:"flex",gap:2},children:[i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(J,{variant:"subtitle2",color:"primary",children:e.featureCount}),i.jsx(J,{variant:"caption",color:"text.secondary",children:"flags"})]}),i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(J,{variant:"subtitle2",color:"primary",children:e.memberCount}),i.jsx(J,{variant:"caption",color:"text.secondary",children:"members"})]}),i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsxs(J,{variant:"subtitle2",color:"primary",children:[t,"%"]}),i.jsx(J,{variant:"caption",color:"text.secondary",children:"technical debt"})]})]})},DW=v("div")({height:"80%"}),rjt=({project:e,selected:t,onClick:n})=>{const{trackEvent:r}=zt();return i.jsx(Or,{disablePadding:!0,sx:{mb:1},children:i.jsxs(mo,{sx:cie,selected:t,onClick:n,children:[i.jsxs(lie,{children:[i.jsx(cf,{color:"primary"}),i.jsx(die,{children:e.name}),i.jsx(Mt,{component:ft,to:`/projects/${e.id}`,size:"small",sx:{ml:"auto"},onClick:()=>{r("personal-dashboard",{props:{eventType:"Go to project from list"}})},children:i.jsx(my,{titleAccess:`projects/${e.id}`})})]}),t?i.jsx(njt,{project:e}):null]})})},ojt=({projects:e,personalDashboardProjectDetails:t,setActiveProject:n,activeProject:r,admins:o,owners:s})=>{const a=xl(t.state==="loading"),l=()=>{if(e.length===0)return{list:i.jsxs(au,{children:[i.jsx(J,{children:"You don't currently have access to any projects in the system."}),i.jsxs(J,{children:["To get started, you can"," ",i.jsx(ft,{to:"/projects?create=true",children:"create your own project"}),". Alternatively, you can review the available projects in the system and ask the owner for access."]})]}),box1:i.jsx(ejt,{admins:o}),box2:i.jsx(tjt,{owners:s})};const p=e.findIndex(y=>y.id===r),f=i.jsx(uie,{items:e,activeIndex:p,itemKey:y=>y.id,renderItem:y=>i.jsx(rjt,{project:y,selected:y.id===r,onClick:()=>n(y.id)})}),[h,m]=(()=>{switch(t.state){case"success":{const y=t.data.onboardingStatus.status??"loading",b=y==="onboarding-started";return y==="onboarded"?[i.jsx(gSt,{project:r,insights:t.data.insights}),i.jsx(WSt,{latestEvents:t.data.latestEvents})]:b?[i.jsx($St,{project:r}),i.jsx(MW,{project:r})]:[i.jsx(DSt,{project:r}),i.jsx(MW,{project:r})]}case"error":return[i.jsx(ZSt,{project:r}),i.jsx(QSt,{admins:o})];default:return[i.jsx(DW,{"data-loading":!0}),i.jsx(DW,{"data-loading":!0})]}})();return{list:f,box1:h,box2:m}},{list:c,box1:u,box2:d}=l();return i.jsx(sie,{ref:a,children:i.jsxs(TSt,{children:[i.jsx(b2,{gridArea:"projects",children:c}),i.jsx(b2,{gridArea:"box1",children:u}),i.jsx(b2,{gridArea:"box2",children:d}),i.jsx(PSt,{}),i.jsx(ASt,{gridArea:"owners",children:i.jsx(YSt,{roles:t.state==="success"?t.data.roles.map(p=>p.name):[],owners:t.state==="success"?t.data.owners:[{ownerType:"user",name:"?"}]})})]})})},II=e=>{const t={activeProject:void 0,activeFlag:void 0,expandProjects:!0,expandFlags:!0,expandTimeline:!1},[n,r]=ai("personal-dashboard:v1",t),o=d=>r({...t,...n,...d});g.useEffect(()=>{var p,f;const d={};(p=e==null?void 0:e.flags)!=null&&p.length&&(!n.activeFlag||!e.flags.some(h=>{var m;return h.name===((m=n.activeFlag)==null?void 0:m.name)}))&&(d.activeFlag=e.flags[0]),(f=e==null?void 0:e.projects)!=null&&f.length&&(!n.activeProject||!e.projects.some(h=>h.id===n.activeProject))&&(d.activeProject=e.projects[0].id),Object.keys(d).length&&o(d)},[JSON.stringify(e),JSON.stringify(n)]);const{activeFlag:s,activeProject:a}=n,l=d=>{o({activeFlag:d})},c=d=>{o({activeProject:d})},u=d=>{const f=(()=>{switch(d){case"flags":return"expandFlags";case"projects":return"expandProjects";case"timeline":return"expandTimeline"}})();o({[f]:!(n[f]??!0)})};return{activeFlag:s,setActiveFlag:l,activeProject:a,setActiveProject:c,expandFlags:n.expandFlags??!0,expandProjects:n.expandProjects??!0,expandTimeline:n.expandTimeline??!1,toggleSectionState:u}},sjt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),ijt=({flag:e,selected:t,onClick:n})=>{const{trackEvent:r}=zt(),o=v7(e.type),s=`projects/${e.project}/features/${e.name}`;return i.jsx(Or,{disablePadding:!0,sx:{mb:1},children:i.jsx(mo,{sx:cie,selected:t,onClick:n,children:i.jsxs(lie,{children:[i.jsx(o,{color:"primary"}),i.jsx(die,{children:e.name}),i.jsx(Mt,{component:Sn,href:s,onClick:()=>{r("personal-dashboard",{props:{eventType:"Go to flag from list"}})},size:"small",sx:{ml:"auto"},children:i.jsx(my,{titleAccess:s})})]})})},e.name)},ajt=({hasProjects:e,flagData:t,setActiveFlag:n,refetchDashboard:r})=>{const o=s=>{const{activeFlag:a}=s;return a?s.flags.findIndex(l=>l.name===a.name):-1};return i.jsx(sie,{children:i.jsxs(RSt,{children:[i.jsx(b2,{gridArea:"flags",children:t.state==="flags"?i.jsx(uie,{items:t.flags,activeIndex:o(t),itemKey:s=>s.name,renderItem:s=>{var a;return i.jsx(ijt,{flag:s,selected:s.name===((a=t.activeFlag)==null?void 0:a.name),onClick:()=>n(s)})}}):e?i.jsxs(sjt,{children:[i.jsx(J,{children:"You have not created or favorited any feature flags. Once you do, they will show up here."}),i.jsx(J,{children:"To create a new flag, go to one of your projects."})]}):i.jsx(Dt,{severity:"info",children:"You need to create or join a project to be able to add a flag, or you must be given the rights by your admin to add feature flags."})}),i.jsx(b2,{gridArea:"chart",children:t.state==="flags"&&t.activeFlag?i.jsx(ljt,{flag:t.activeFlag,onArchive:r}):i.jsx(cjt,{label:"Metrics for your feature flags will be shown here"})})]})})},ljt=tt.lazy(()=>La(()=>import("./FlagMetricsChart-Dcc3RwL2.js"),[]).then(e=>({default:e.FlagMetricsChart}))),cjt=tt.lazy(()=>La(()=>import("./FlagMetricsChart-Dcc3RwL2.js"),[]).then(e=>({default:e.PlaceholderFlagMetricsChartWithWrapper}))),ujt=({personalDashboardProjectDetails:e,error:t})=>t?{state:"error",error:t}:e?{state:"success",data:e}:{state:"loading"},djt="/static/upgradeHosted-D8epFMuP.png",pjt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2),padding:e.spacing(3,4),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none",position:"relative"})),fjt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center"})),hjt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(1)})),gjt=v("h2")(({theme:e})=>({margin:e.spacing(0,0,.5),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold,display:"flex",alignItems:"center",gap:e.spacing(1)})),mjt=v("ul")(({theme:e})=>({listStyle:"none",padding:0,margin:0,fontSize:e.typography.body2.fontSize,"& li":{}})),fm=v("li")(({theme:e})=>({position:"relative",paddingLeft:e.spacing(2.5),marginBottom:e.spacing(.5),"&::before":{content:'""',position:"absolute",left:0,top:e.spacing(.375),width:e.spacing(1.5),height:e.spacing(1.5),borderRadius:e.spacing(.5),backgroundColor:e.palette.primary.main}})),yjt=v(Mt)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1)})),xjt=v("img")(({theme:e})=>({width:235,margin:e.spacing(1),[e.breakpoints.down("md")]:{display:"none"}})),vjt=()=>{const[e,t]=ai("upgrade-dashboard:v1","open");if(e==="closed")return null;const n=()=>{t("closed")};return i.jsxs(pjt,{children:[i.jsx(Rt,{title:"Dismiss",arrow:!0,children:i.jsx(yjt,{"aria-label":"dismiss",onClick:n,size:"small",children:i.jsx(bo,{fontSize:"inherit"})})}),i.jsxs(fjt,{children:[i.jsxs(hjt,{children:[i.jsxs(gjt,{children:[i.jsx(Ra,{darkmode:i.jsx(sy,{}),lightmode:i.jsx(oy,{})}),"Explore our Enterprise solution"]}),i.jsx(J,{children:"Increase efficiency and improve the development process in your company with the full experience of Unleash with some key advantages like:"}),i.jsxs(mjt,{children:[i.jsx(fm,{children:"Unlimited projects and environments"}),i.jsx(fm,{children:"Priority support for managed and self-hosted options"}),i.jsx(fm,{children:"SSO/SCIM - streamlined access and account management"}),i.jsx(fm,{children:"RBAC - precise access control"}),i.jsx(fm,{children:"Change requests - reduce error risk with pull-request like experience"})]}),i.jsx("div",{children:i.jsx($e,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=dashboard",children:"View full Enterprise offering"})})]}),i.jsx(xjt,{src:Do(djt),alt:"Upgrade Unleash"})]})]})};var OI={},bjt=je;Object.defineProperty(OI,"__esModule",{value:!0});var hie=OI.default=void 0,Cjt=bjt(Ee()),wjt=i,Sjt=(0,Cjt.default)((0,wjt.jsx)("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5zm0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"}),"ToggleOn");hie=OI.default=Sjt;var MI={},jjt=je;Object.defineProperty(MI,"__esModule",{value:!0});var gie=MI.default=void 0,Ejt=jjt(Ee()),kjt=i,Tjt=(0,Ejt.default)((0,kjt.jsx)("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5zM7 15c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"}),"ToggleOff");gie=MI.default=Tjt;var $I={},Rjt=je;Object.defineProperty($I,"__esModule",{value:!0});var DI=$I.default=void 0,Ajt=Rjt(Ee()),Pjt=i,_jt=(0,Ajt.default)((0,Pjt.jsx)("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15zM14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2z"}),"QuestionMark");DI=$I.default=_jt;var LI={},Ijt=je;Object.defineProperty(LI,"__esModule",{value:!0});var mie=LI.default=void 0,Ojt=Ijt(Ee()),Mjt=i,$jt=(0,Ojt.default)((0,Mjt.jsx)("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");mie=LI.default=$jt;var NI={},Djt=je;Object.defineProperty(NI,"__esModule",{value:!0});var FI=NI.default=void 0,Ljt=Djt(Ee()),Njt=i,Fjt=(0,Ljt.default)((0,Njt.jsx)("path",{d:"M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12c0 1.1.45 2.1 1.17 2.83l-1.41 1.41zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12c0 1.1-.45 2.1-1.17 2.83l1.41 1.41zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12zM6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65z"}),"Sensors");FI=NI.default=Fjt;const LW=v("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:t="secondary"})=>({height:e.spacing(3),width:e.spacing(3),borderRadius:"50%",backgroundColor:e.palette[t].light,border:`1px solid ${e.palette[t].main}`,display:"flex",alignItems:"center",justifyContent:"center",transition:"transform 0.2s","& svg, span":{color:e.palette[t].main},"& svg":{height:e.spacing(2.5),width:e.spacing(2.5)},"& span":{fontSize:e.fontSizes.bodySize},"&:hover":{transform:"scale(1.5)"}})),Bjt=({icon:e,type:t})=>e?i.jsx(Ta,{children:e}):t==="signal"?i.jsx(FI,{}):t==="feature-environment-enabled"?i.jsx(hie,{}):t==="feature-environment-disabled"?i.jsx(gie,{}):t.startsWith("strategy-")||t.startsWith("feature-strategy-")||t.startsWith("release-plan-")?i.jsx(TT,{sx:{marginTop:"-2px",marginRight:"-2px"}}):t.startsWith("feature-")?i.jsx(sR,{}):t.startsWith("segment-")?i.jsx(ET,{}):i.jsx(DI,{}),zjt={signal:"warning","feature-environment-enabled":"success","feature-environment-disabled":"neutral","feature-archived":"neutral"},Hjt=e=>e!==void 0&&["secondary","success","neutral","warning","error"].includes(e),yie=({group:e,...t})=>{if(e.length===1||!e.some(({type:n,icon:r})=>n!==e[0].type||r!==e[0].icon)){const n=e[0];return i.jsx(LW,{variant:Hjt(n.variant)?n.variant:zjt[n.type],...t,children:Bjt(n)})}return i.jsx(LW,{...t,children:i.jsx(mie,{})})},NW=v("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(1),gap:e.spacing(2),flexWrap:"wrap"})),FW=v("div")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.smallBody,wordBreak:"break-word",flex:1})),Wjt=v("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),BW=v("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),Vjt=v("div")(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column",gap:e.spacing(2)})),Ujt=v("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),Gjt=v(yie)(({theme:e})=>({flexShrink:0,marginTop:e.spacing(.125),height:e.spacing(2.5),width:e.spacing(2.5),transition:"none","& > svg":{height:e.spacing(1.75)},"& > span":{fontSize:e.fontSizes.smallBody},"&:hover":{transform:"none"}})),zW=({children:e})=>e,qjt=({group:e})=>{const{locationSettings:t}=$r();if(e.length===1){const o=e[0],s=ji(o.timestamp,t==null?void 0:t.locale);return i.jsxs(i.Fragment,{children:[i.jsxs(NW,{children:[i.jsx(FW,{children:o.label}),i.jsx(Wjt,{children:s})]}),i.jsx(Ep,{components:{strong:zW},children:o.summary})]})}const n=e[0],r=Zc(n.timestamp,t==null?void 0:t.locale);return i.jsxs(i.Fragment,{children:[i.jsxs(NW,{children:[i.jsxs(FW,{children:[e.length," events occurred"]}),i.jsx(BW,{children:r})]}),i.jsx(Vjt,{children:e.map(o=>i.jsxs(Ujt,{children:[i.jsx(Gjt,{group:[o]}),i.jsxs("div",{children:[i.jsx(BW,{children:HRe(o.timestamp,t==null?void 0:t.locale)}),i.jsx(Ep,{components:{strong:zW},children:o.summary})]})]},o.id))})]})},Yjt=v("div",{shouldForwardProp:e=>e!=="position"})(({position:e})=>({position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",left:e,transform:"translateX(-50%)",zIndex:1})),Kjt=v(Ok)(({theme:e})=>({".MuiBadge-badge":{backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText}})),Xjt=({group:e,startTime:t,endTime:n})=>{const{trackEvent:r}=zt(),o=n-t,a=`${(e[0].timestamp-t)/o*100}%`,l=()=>{r("event-timeline",{props:{eventType:"event hover"}})};return i.jsx(Yjt,{position:a,onMouseEnter:l,children:i.jsx(wr,{title:i.jsx(qjt,{group:e}),maxWidth:350,arrow:!0,children:i.jsx(Kjt,{badgeContent:e.length,invisible:e.length<2,children:i.jsx(yie,{group:e})})})})},xie=g.createContext(void 0),vie=()=>{const e=g.useContext(xie);if(!e)throw new Error("useEventTimelineContext must be used within a EventTimelineProvider");return e},Vv=[{key:"30m",label:"last 30 min",value:{minutes:30},markers:["30 min ago"]},{key:"1h",label:"last hour",value:{hours:1},markers:["1 hour ago","30 min ago"]},{key:"3h",label:"last 3 hours",value:{hours:3},markers:["3 hours ago","2 hours ago","1 hour ago"]},{key:"12h",label:"last 12 hours",value:{hours:12},markers:["12 hours ago","9 hours ago","6 hours ago","3 hours ago"]},{key:"24h",label:"last 24 hours",value:{hours:24},markers:["24 hours ago","18 hours ago","12 hours ago","6 hours ago"]},{key:"48h",label:"last 48 hours",value:{hours:48},markers:["48 hours ago","36 hours ago","24 hours ago","12 hours ago"]}],Jjt={open:!1,timeSpan:Vv[0]},Zjt=({children:e})=>{const[t,n]=ai("event-timeline:v1",Jjt),r=(s,a)=>{n(l=>({...l,[s]:a}))},o={...t,setOpen:s=>r("open",s),setTimeSpan:s=>r("timeSpan",s),setEnvironment:s=>r("environment",s),setSignalsSuggestionSeen:s=>r("signalsSuggestionSeen",s)};return i.jsx(xie.Provider,{value:o,children:e})},HW=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),WW=v(xn)(({theme:e})=>({"& > div":{background:"transparent",color:e.palette.text.secondary,"& > .MuiSelect-select":{padding:e.spacing(.5,4,.5,1),background:"transparent"},"& > fieldset":{borderColor:"transparent"}}})),Qjt=v("span")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(.25)})),eEt=({totalEvents:e})=>{const{timeSpan:t,environment:n,setTimeSpan:r,setEnvironment:o}=vie(),{environments:s}=rd(),a=g.useMemo(()=>s.filter(({enabled:u})=>u),[s]);g.useEffect(()=>{if(a.length>0&&!n){const u=a.find(({type:d})=>d==="production")||a[0];o(u)}},[a]);const l=()=>i.jsx(te,{condition:!!n&&s.length>0,show:()=>i.jsx(WW,{select:!0,size:"small",variant:"outlined",value:n.name,onChange:u=>o(s.find(({name:d})=>d===u.target.value)||s[0]),children:s.map(({name:u})=>i.jsx(wn,{value:u,children:u},u))})}),c=()=>i.jsx(WW,{select:!0,size:"small",variant:"outlined",value:t.key,onChange:u=>r(Vv.find(({key:d})=>d===u.target.value)||Vv[0]),children:Vv.map(({key:u,label:d})=>i.jsx(wn,{value:u,children:d},u))});return i.jsxs(i.Fragment,{children:[i.jsx(HW,{children:i.jsxs(Qjt,{children:[e," event",e===1?"":"s",i.jsx(Zo,{tooltip:"These are key events per environment across all your projects. For more details, visit the event log."})]})}),i.jsxs(HW,{children:[i.jsx(c,{}),i.jsx(l,{})]})]})},VW={signals:[],total:0},tEt=10,bie="api/admin/signals?",nEt=()=>{const e={total:0,initialLoad:!0},t=(n,r)=>{e[n]=r};return(n,r={},o="")=>{const{isEnterprise:s}=ut(),a=Er("signals"),{KEY:l,fetcher:c}=rEt(n),u=`${o}${l}`;cy({currentKey:u,clearPrefix:bie,cacheSize:tEt});const{data:d,error:p,mutate:f,isLoading:h}=Ts(s()&&a,VW,u,c,r),m=g.useCallback(()=>{f()},[f]);return(d==null?void 0:d.total)!==void 0&&t("total",d.total),!h&&e.initialLoad&&t("initialLoad",!1),{...d||VW,loading:h,error:p,refetch:m,total:e.total,initialLoad:h&&e.initialLoad}}},rEt=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,s])=>!!s).map(([o,s])=>[o,s.toString()]))).toString(),n=`${bie}${t}`;return{fetcher:()=>{const o=yt(n);return fetch(o,{method:"GET"}).then(en("Signal query")).then(s=>s.json())},KEY:n}},oEt=nEt(),UW=v("div")({display:"flex",flexDirection:"row",justifyContent:"space-between"}),sEt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(1.5,0)})),iEt=v("div")(({theme:e})=>({position:"relative",height:e.spacing(1),width:"100%",display:"flex",alignItems:"center",padding:e.spacing(1.5,0)})),aEt=v("div")(({theme:e})=>({backgroundColor:e.palette.divider,height:e.spacing(.5),width:"100%"})),lEt=v("div")({display:"flex",alignItems:"center",justifyContent:"center",position:"relative"}),BI=v("div")(({theme:e})=>({position:"absolute",height:e.spacing(1),width:e.spacing(.25),backgroundColor:e.palette.text.secondary})),cEt=v(BI)(({theme:e})=>({top:e.spacing(-2)})),cC=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),uEt=v(BI)({left:0}),dEt=v(BI)({right:0}),pEt=["strategy-reactivated","strategy-updated","segment-updated","segment-deleted","feature-created","feature-updated","feature-variants-updated","feature-archived","feature-revived","feature-strategy-update","feature-strategy-add","feature-strategy-remove","feature-environment-enabled","feature-environment-disabled","release-plan-added","release-plan-removed","release-plan-milestone-started"],fv=e=>e.toISOString().split("T")[0],fEt=e=>"sourceId"in e,hEt=e=>new Date(e.createdAt).getTime(),gEt=(e,t,n)=>e>=t&&e<=n,GW=e=>typeof e=="string"&&e.trim().length>0,mEt=(e,t,n)=>{if(fEt(e)){const{id:r,sourceName:o="unknown source",sourceDescription:s,tokenName:a,payload:{unleashTitle:l,unleashDescription:c,unleashIcon:u,unleashVariant:d}}=e,p=l||o,f=`Signal: ${p}`,h=c?`Signal: **[${p}](/integrations/signals)** ${c}`:`Signal originated from **[${o} (${a})](/integrations/signals)** endpoint${s?`: ${s}`:""}`;return{id:r,timestamp:t,type:"signal",label:f,summary:h,...GW(u)?{icon:u}:{},...GW(d)?{variant:d}:{}}}if(!e.environment||!n||e.environment===n.name){const{id:r,type:o,label:s,summary:a,createdBy:l}=e,c=s||o,u=a||`**${l}** triggered **${o}**`;return{id:r,timestamp:t,type:o,label:c,summary:u}}},yEt=()=>{const{timeSpan:e,environment:t}=vie(),n=new Date,r=rSe(n,e.value),o=n.getTime(),s=r.getTime(),{events:a}=Bre({from:`IS:${fv(Gu(r))}`,to:`IS:${fv(n)}`,type:`IS_ANY_OF:${pEt.join(",")}`},{refreshInterval:10*1e3}),{signals:l}=oEt({from:`IS:${fv(Gu(r))}`,to:`IS:${fv(n)}`},{refreshInterval:10*1e3}),c=g.useMemo(()=>[...a,...l].reduce((f,h)=>{const m=hEt(h);if(gEt(m,s,o)){const y=mEt(h,m,t);y&&f.push(y)}return f},[]).sort((f,h)=>f.timestamp-h.timestamp),[a,l,s,o,t]),u=o-s,d=g.useMemo(()=>u*.02,[u]),p=g.useMemo(()=>c.reduce((f,h)=>{if(f.length===0)f.push([h]);else{const m=f[f.length-1],y=m[m.length-1];h.timestamp-y.timestamp<=d?m.push(h):f.push([h])}return f},[]),[c,d]);return i.jsxs(i.Fragment,{children:[i.jsx(UW,{children:i.jsx(eEt,{totalEvents:c.length})}),i.jsxs(sEt,{children:[i.jsxs(iEt,{children:[i.jsx(aEt,{}),i.jsx(uEt,{}),p.map(f=>i.jsx(Xjt,{group:f,startTime:s,endTime:o},f[0].id)),i.jsx(dEt,{})]}),i.jsxs(UW,{children:[i.jsx(cC,{children:e.markers[0]}),e.markers.slice(1).map(f=>i.jsxs(lEt,{children:[i.jsx(cEt,{}),i.jsx(cC,{children:f})]},f)),i.jsx(cC,{children:"now"})]})]})]})},xEt="/static/banner-progression-B6JPzTEE.svg",vEt=v(K)(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2),padding:e.spacing(3,4),border:`1px solid ${e.palette.secondary.border}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.secondary.light,boxShadow:"none",position:"relative"})),bEt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",justifyContent:"space-between"})),CEt=v(K)(()=>({display:"flex",flexFlow:"column nowrap"})),wEt=v(J)(({theme:e})=>({margin:0,marginBottom:e.spacing(.5),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),SEt=v(K)(({theme:e})=>({marginTop:e.spacing(2)})),jEt=v(Mt)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1)})),EEt=v(K)(({theme:e})=>({flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",[e.breakpoints.down("md")]:{display:"none"}})),kEt=()=>{const{trackEvent:e}=zt(),t=$t(),[n,r]=ai("release-templates-banner:v1","open");if(g.useEffect(()=>{n==="open"&&e("release-templates-banner",{props:{eventType:"seen"}})},[]),n==="closed")return null;const o=()=>{e("release-templates-banner",{props:{eventType:"dismissed"}}),r("closed")},s=()=>{e("release-templates-banner",{props:{eventType:"create-clicked"}}),t("/release-templates/create-template")};return i.jsxs(vEt,{children:[i.jsx(Rt,{title:"Dismiss",arrow:!0,children:i.jsx(jEt,{"aria-label":"dismiss",onClick:o,size:"small",children:i.jsx(bo,{fontSize:"inherit"})})}),i.jsxs(bEt,{children:[i.jsxs(CEt,{children:[i.jsx(wEt,{variant:"h2",children:"Get started with release templates"}),i.jsx(J,{color:"text.secondary",children:"Control your releases with milestones that can be automatically enabled or paused."}),i.jsx(SEt,{children:i.jsx($e,{variant:"contained",onClick:s,children:"Create template"})})]}),i.jsx(EEt,{children:i.jsx("img",{src:Do(xEt),alt:"Release progression"})})]})]})},Cie=g.createContext(void 0),zI=()=>{const e=g.useContext(Cie);if(!e)throw new Error("useWelcomeDialogContext must be used within a WelcomeDialogProvider");return e},TEt=v("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(1),flexFlow:"row wrap",alignItems:"baseline"})),REt=v($e)({fontWeight:"normal",padding:0,margin:0}),HI=v(tu,{shouldForwardProp:e=>e!=="withSummaryContentBorder"})(({theme:e,withSummaryContentBorder:t=!0})=>{const n=`1px solid ${e.palette.divider}`;return{border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none","& .expanded":{"&:before":{opacity:"0 !important"}},...t&&{"[aria-expanded='false']+.MuiCollapse-root .MuiAccordion-region":{borderTop:n},"&>.MuiAccordionSummary-root[aria-expanded='true']":{borderBottom:n}},overflow:"hidden"}}),WI=v(ru)(({theme:e})=>({border:"none",padding:e.spacing(2,4),margin:0,"&>.MuiAccordionSummary-content.MuiAccordionSummary-content":{margin:"0"}})),VI=v(nu)({padding:0}),AEt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),UI=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),GI=v("h3")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold,margin:0})),qI=v(J)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.body2.fontWeight})),PEt=()=>{const{toggleSectionState:e,expandTimeline:t}=II(),{trackEvent:n}=zt();return i.jsxs(HI,{disableGutters:!0,expanded:t??!1,onChange:()=>e("timeline"),withSummaryContentBorder:!1,children:[i.jsx(WI,{expandIcon:i.jsx(Da,{titleAccess:"Toggle timeline section"}),id:"timeline-panel-header","aria-controls":"timeline-panel-content",children:i.jsxs(UI,{children:[i.jsx(GI,{children:"Event timeline"}),i.jsxs(qI,{children:["Overview of recent activities across all projects in Unleash. Make debugging easier and"," ",i.jsx(ft,{to:"/integrations/signals",onClick:()=>{n("event-timeline",{props:{eventType:"signals clicked"}})},children:"include external signals"})," ","to get a fuller overview."]})]})}),i.jsx(VI,{children:i.jsx(aie,{children:i.jsx(yEt,{})})})]})},_Et=()=>{const{personalDashboard:e,refetch:t}=_I(),n=(e==null?void 0:e.projects)||[],{activeFlag:r,setActiveFlag:o,toggleSectionState:s,expandFlags:a}=II({flags:(e==null?void 0:e.flags)??[]});return i.jsxs(HI,{expanded:a??!0,onChange:()=>s("flags"),children:[i.jsx(WI,{expandIcon:i.jsx(Da,{titleAccess:"Toggle flags section"}),id:"flags-panel-header","aria-controls":"flags-panel-content",children:i.jsxs(UI,{children:[i.jsx(GI,{children:"My feature flags"}),i.jsx(qI,{children:"Feature flags you have created or favorited"})]})}),i.jsx(VI,{children:i.jsx(ajt,{hasProjects:(n==null?void 0:n.length)>0,flagData:e!=null&&e.flags.length?{state:"flags",activeFlag:r,flags:e.flags}:{state:"no flags"},setActiveFlag:o,refetchDashboard:t})})]})},IEt=()=>{const{personalDashboard:e}=_I(),t=(e==null?void 0:e.projects)||[],{activeProject:n,setActiveProject:r,toggleSectionState:o,expandProjects:s}=II({projects:t}),a=ujt(lSt(n));return i.jsxs(HI,{disableGutters:!0,expanded:s??!0,onChange:()=>o("projects"),children:[i.jsx(WI,{expandIcon:i.jsx(Da,{titleAccess:"Toggle projects section"}),id:"projects-panel-header","aria-controls":"projects-panel-content",children:i.jsxs(UI,{children:[i.jsx(GI,{children:"My projects"}),i.jsx(qI,{children:"Favorite projects, projects you own, and projects you are a member of"})]})}),i.jsx(VI,{children:i.jsx(ojt,{owners:(e==null?void 0:e.projectOwners)??[],admins:(e==null?void 0:e.admins)??[],projects:t,activeProject:n||"",setActiveProject:r,personalDashboardProjectDetails:a})})]})},OEt=()=>{const{user:e}=gs(),{trackEvent:t}=zt(),{setWelcomeDialog:n}=zI(),{isOss:r,isEnterprise:o}=ut(),s=Er("gtmReleaseManagement"),{personalDashboard:a}=_I(),l=(a==null?void 0:a.flags.length)===0,c=(e==null?void 0:e.name)||"";return nd(c?`Dashboard: ${c}`:"Dashboard"),g.useEffect(()=>{t("personal-dashboard",{props:{eventType:"seen"}})},[]),i.jsxs(AEt,{children:[o()&&s&&!l&&i.jsx(kEt,{}),r()&&i.jsx(vjt,{}),i.jsxs(TEt,{children:[i.jsxs(J,{component:"h2",variant:"h2",children:["Welcome ",c]}),i.jsx(REt,{sx:{fontWeight:"normal"},size:"small",variant:"text",onClick:()=>{t("personal-dashboard",{props:{eventType:"open key concepts"}}),n("open")},children:"View key concepts"})]}),i.jsx(PEt,{}),i.jsx(IEt,{}),i.jsx(_Et,{})]})},wie=e=>g.createElement("svg",{width:80,height:80,viewBox:"0 0 80 80",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...e},g.createElement("g",{clipPath:"url(#clip0_28054_15343)"},g.createElement("path",{d:"M62.9208 75.54C69.8033 75.54 75.3826 69.9606 75.3826 63.0781C75.3826 56.1957 69.8033 50.6163 62.9208 50.6163C56.0383 50.6163 50.459 56.1957 50.459 63.0781C50.459 69.9606 56.0383 75.54 62.9208 75.54Z",fill:"#194049"}),g.createElement("path",{d:"M16.834 71.409V67.2181H12.6431V71.409H16.834Z",fill:"#F5A69A"}),g.createElement("path",{d:"M37.8536 15.4618H12.6445V67.2163H37.8536V15.4618Z",fill:"#1A4049"}),g.createElement("path",{d:"M37.8554 67.2181H63.0645L63.0645 15.4636H37.8554L37.8554 67.2181Z",fill:"#31545C"}),g.createElement("path",{d:"M55.4316 46.9564H21.668V55.1928H55.4316V46.9564Z",fill:"#B3DAED"}),g.createElement("g",{opacity:.8},g.createElement("mask",{id:"mask0_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:46,width:17,height:10},g.createElement("path",{d:"M37.8389 46.9564V55.2346L21.668 55.1491V46.9564H37.8389Z",fill:"white"})),g.createElement("g",{mask:"url(#mask0_28054_15343)"},g.createElement("rect",{width:114.233,height:158.028,transform:"matrix(-0.851658 0.524097 0.524097 0.851658 44.8789 -54.2181)",fill:"url(#pattern0_28054_15343)"}))),g.createElement("path",{d:"M55.4316 27.4454H21.668V35.6818H55.4316V27.4454Z",fill:"#B3DAED"}),g.createElement("g",{opacity:.8},g.createElement("mask",{id:"mask1_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:27,width:17,height:9},g.createElement("path",{d:"M37.8389 27.4454V35.7236L21.668 35.6382V27.4454H37.8389Z",fill:"white"})),g.createElement("g",{mask:"url(#mask1_28054_15343)"},g.createElement("rect",{width:114.233,height:158.028,transform:"matrix(-0.851658 0.524097 0.524097 0.851658 44.8789 -73.731)",fill:"url(#pattern1_28054_15343)"}))),g.createElement("path",{d:"M56.5577 15.4636H63.0723V8.94908H56.5577V15.4636Z",fill:"#F5A69A"}),g.createElement("path",{d:"M63.0728 19.6545H67.2637V15.4636H63.0728V19.6545Z",fill:"#F5A69A"})),g.createElement("defs",null,g.createElement("pattern",{id:"pattern0_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},g.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),g.createElement("pattern",{id:"pattern1_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},g.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),g.createElement("clipPath",{id:"clip0_28054_15343"},g.createElement("rect",{width:80,height:80,fill:"white"})))),MEt=v("article")(({theme:e})=>({paddingBlock:e.spacing(5),display:"flex",gap:e.spacing(2),flexFlow:"column nowrap",alignItems:"center",maxWidth:e.spacing(40),margin:"auto",textAlign:"center"})),$Et=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",columnGap:e.spacing(3),rowGap:e.spacing(2),justifyContent:"center"})),DEt=()=>{const e=$t();return i.jsxs(MEt,{children:[i.jsx(wie,{}),i.jsx(J,{component:"h2",variant:"h3",children:"Get started with release templates"}),i.jsx(J,{component:"p",color:"text.secondary",children:"Control your releases with milestones that can be reused by the entire team."}),i.jsxs($Et,{children:[i.jsx($e,{component:ft,sx:{whiteSpace:"nowrap"},to:"https://docs.getunleash.io/reference/release-templates",variant:"text",rel:"noopener noreferrer",target:"_blank",children:"Read docs"}),i.jsx(lo,{sx:{whiteSpace:"nowrap"},onClick:()=>{e("/release-templates/create-template")},permission:u7,children:"New template"})]})]})},g8={primary:{card:e=>({backgroundColor:e.palette.background.default,background:e.palette.secondary.light,"&:hover":{backgroundColor:e.palette.neutral.light}}),header:e=>({fontWeight:e.typography.fontWeightRegular}),body:e=>({backgroundColor:e.palette.background.default,color:e.palette.text.secondary,"&:hover":{backgroundColor:e.palette.neutral.light},fontSize:e.fontSizes.smallBody}),footer:e=>({borderTop:`1px solid ${e.palette.divider}`,background:e.palette.background.elevation1,boxShadow:e.boxShadows.accordionFooter,color:e.palette.text.secondary})},secondary:{card:e=>({backgroundColor:e.palette.secondary.light,borderColor:e.palette.secondary.border,color:e.palette.text.primary}),header:e=>({fontWeight:e.typography.fontWeightBold}),body:e=>({backgroundColor:e.palette.secondary.light,color:e.palette.text.primary}),footer:e=>({background:e.palette.secondary.light,fontSize:e.fontSizes.bodySize})}},LEt=v(Y3,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({display:"flex",flexDirection:"column",justifyContent:"space-between",height:"100%",boxShadow:"none",border:`1px solid ${e.palette.divider}`,[e.breakpoints.down("sm")]:{justifyContent:"center"},transition:"background-color 0.2s ease-in-out",borderRadius:e.shape.borderRadiusMedium,...g8[t].card(e)})),NEt=v(K,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({padding:e.spacing(2),display:"flex",flexFlow:"column",height:"100%",position:"relative",...g8[t].body(e)})),FEt=v(K,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({display:"flex",gap:e.spacing(1),width:"100%",alignItems:"center",justifyContent:"space-between",fontSize:e.typography.body1.fontSize,color:e.palette.text.primary,lineHeight:"1.2",...g8[t].header(e)})),BEt=v(K)(({theme:e})=>({display:"grid",placeItems:"center",padding:e.spacing(.5),alignSelf:"baseline",backgroundColor:e.palette.secondary.light,color:e.palette.primary.main,borderRadius:e.shape.borderRadiusMedium,"& > svg":{height:e.spacing(2),width:e.spacing(2)}})),zEt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginLeft:"auto"})),HEt=v(K)(({theme:e})=>({marginTop:e.spacing(2)})),WEt=v(K,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({padding:e.spacing(0,2),display:"flex",alignItems:"center",justifyContent:"space-between",minHeight:e.spacing(6.25),fontSize:e.fontSizes.smallerBody,textWrap:"nowrap",...g8[t].footer(e)})),VEt=({icon:e,title:t,headerActions:n,footer:r,cardVariant:o="primary",children:s,...a})=>i.jsxs(LEt,{cardVariant:o,...a,children:[i.jsxs(NEt,{cardVariant:o,children:[i.jsxs(FEt,{cardVariant:o,children:[e&&i.jsx(BEt,{children:e}),t,n&&i.jsx(zEt,{children:n})]}),s&&i.jsx(HEt,{children:s})]}),r&&i.jsx(WEt,{cardVariant:o,children:r})]}),YI=()=>{const{makeRequest:e,createRequest:t}=er({propagateErrors:!0});return{deleteReleasePlanTemplate:async a=>{const l="deleteReleasePlanTemplate",c=`api/admin/release-plan-templates/${a}`,u=t(c,{method:"DELETE"},l);return e(u.caller,u.id)},updateReleasePlanTemplate:async(a,l)=>{const c="updateReleasePlanTemplate",u=`api/admin/release-plan-templates/${a}`,d=t(u,{method:"PUT",body:JSON.stringify(l)},c);return e(d.caller,d.id)},createReleasePlanTemplate:async a=>{const u=t("api/admin/release-plan-templates",{method:"POST",body:JSON.stringify(a)},"createReleasePlanTemplate");return(await e(u.caller,u.id)).json()},archiveReleasePlanTemplate:async a=>{const l="updateReleasePlanTemplate",c=`api/admin/release-plan-templates/archive/${a}`,u=t(c,{method:"POST"},l);return e(u.caller,u.id)}}},UEt=({template:e,open:t,setOpen:n,onConfirm:r})=>i.jsx(Mn,{title:"Archive release template?",open:t,secondaryButtonText:"Cancel",onClose:()=>{n(!1)},permissionButton:i.jsx(lo,{variant:"contained",onClick:()=>r(e),permission:sA,children:"Archive template"}),children:i.jsxs("p",{children:["You are about to archive release template:"," ",i.jsx("strong",{children:e==null?void 0:e.name})]})}),GEt=v("div")(({theme:e})=>({margin:e.spacing(-1),marginLeft:e.spacing(-.5),display:"flex",justifyContent:"center",alignItems:"center"})),qEt=v(ql)(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(1,1.5)})),YEt=({template:e})=>{const[t,n]=g.useState(null),{archiveReleasePlanTemplate:r}=YI(),{refetch:o}=ay(),{setToastData:s,setToastApiError:a}=_t(),{trackEvent:l}=zt(),[c,u]=g.useState(!1),d=pf(sA),p=g.useCallback(async()=>{try{await r(e.id),o(),s({type:"success",text:"Release template archived"}),l("release-management",{props:{eventType:"archive-template",template:e.name}})}catch(x){a(pt(x))}},[a,o,s,r]),f=!!t,h=x=>{n(x.currentTarget)},m=()=>{n(null)},y=`release-plan-template-${e.id}-actions`,b=`${y}-menu`;return i.jsxs(GEt,{onClick:x=>{x.preventDefault(),x.stopPropagation()},children:[i.jsx(Rt,{title:"Release template actions",arrow:!0,describeChild:!0,children:i.jsx(Mt,{id:y,"aria-controls":f?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":f?"true":void 0,onClick:h,type:"button",size:"small",children:i.jsx(Mf,{})})}),i.jsx(qEt,{id:b,anchorEl:t,open:f,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:i.jsxs(Vg,{"aria-labelledby":y,children:[i.jsxs(wn,{onClick:m,component:ft,to:`/release-templates/edit/${e.id}`,children:[i.jsx(Io,{children:i.jsx(oi,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Edit template"})})]}),i.jsxs(wn,{onClick:()=>{u(!0),m()},disabled:!d,children:[i.jsx(Io,{children:i.jsx(So,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Archive template"})})]})]})}),i.jsx(UEt,{template:e,open:c,setOpen:u,onConfirm:p})]})},KEt=(e,t={})=>{const n=()=>{const c=yt(`api/admin/user-admin/${e}`);return fetch(c,{method:"GET"}).then(en("Users")).then(u=>u.json())},{data:r,error:o}=On(`api/admin/user-admin/${e}`,n,t),[s,a]=g.useState(!o&&!r),l=()=>{Fo(`api/admin/user-admin/${e}`)};return g.useEffect(()=>{a(!o&&!r)},[r,o]),{user:r||{},error:o,loading:s,refetch:l}},XEt=v(K)({display:"flex",alignItems:"center",gap:br.spacing(1)}),JEt=v(xP)(({theme:e})=>({height:e.spacing(3.5),width:e.spacing(3.5),marginLeft:0})),ZEt=v(K)({display:"flex",flexDirection:"column"}),QEt=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,lineHeight:1,lineClamp:"1",WebkitLineClamp:1,display:"-webkit-box",boxOrient:"vertical",textOverflow:"ellipsis",overflow:"hidden",alignItems:"flex-start",WebkitBoxOrient:"vertical",wordBreak:"break-word",maxWidth:"100%",color:e.palette.text.primary})),ekt=({template:e})=>{const{user:t}=KEt(`${e.createdByUserId}`);return i.jsxs(XEt,{children:[i.jsx(JEt,{user:t}),i.jsxs(ZEt,{children:[i.jsx("span",{children:"Created by"}),i.jsx(QEt,{children:t.name||t.username||t.email})]})]})},tkt=v(ft)(({theme:e})=>({color:"inherit",textDecoration:"none",border:"none",padding:"0",background:"transparent",fontFamily:e.typography.fontFamily,pointer:"cursor"})),nkt=v("h3")(({theme:e})=>({margin:0,marginRight:"auto",fontSize:e.typography.body1.fontSize,lineHeight:"1.2"})),rkt=({template:e})=>i.jsx(tkt,{to:`/release-templates/edit/${e.id}`,children:i.jsx(VEt,{icon:i.jsx(wie,{}),title:i.jsx(mr,{title:e.name,arrow:!0,component:nkt,children:e.name}),headerActions:i.jsx(YEt,{template:e}),footer:i.jsx(ekt,{template:e}),children:e.description&&i.jsx(mr,{lines:2,title:e.description,arrow:!0,children:e.description})})}),okt=v(Uo)({minHeight:"180px"}),skt=({templates:e})=>i.jsx(i.Fragment,{children:e.map(t=>i.jsx(okt,{item:!0,xs:6,md:4,children:i.jsx(rkt,{template:t})},t.id))}),ikt=v(ft)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:0,color:e.palette.links,fontWeight:e.fontWeight.medium,textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"},width:"max-content"})),akt=v(X5)(({theme:e})=>({fontSize:e.spacing(2.25)})),lkt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(2)})),ckt=v(Dt)(({theme:e})=>({fontSize:e.typography.body1.fontSize,"& > .MuiAlert-icon":{paddingBlock:"7px"},"& > .MuiAlert-message":{padding:e.spacing(1),display:"flex",flexFlow:"row wrap",justifyContent:"space-between",width:"100%",gap:e.spacing(1)}})),ukt=v($e)(({theme:e})=>({"&&":{color:e.palette.primary.main}})),dkt=()=>{nd("Release templates");const e=$t(),t=ay(),[n,r]=ai("releaseManagementInfoAlert","open"),{isEnterprise:o}=ut();return o()?i.jsxs(lkt,{children:[i.jsx(W3,{in:n==="open",children:i.jsxs(ckt,{severity:"info",onClose:()=>r("closed"),children:[i.jsxs(J,{component:"p",display:"inline",children:[i.jsx(J,{fontWeight:"bold",display:"block",component:"span",children:"Standardize your rollouts with Release templates."}),i.jsx(J,{component:"span",children:"Define your release process once, then reuse it across all feature flags with sequential milestones."})]}),i.jsx(ukt,{component:ft,variant:"outlined",target:"_blank",rel:"noopener noreferrer",to:"https://docs.getunleash.io/reference/release-templates",children:"Learn about release templates"})]})}),i.jsxs(ir,{header:i.jsx($n,{title:"Release templates",actions:i.jsx(kP,{Icon:Eo,onClick:()=>{e("/release-templates/create-template")},maxWidth:"700px",permission:u7,disabled:!o(),children:"New template"})}),children:[t.templates.length>0&&i.jsx(Uo,{container:!0,spacing:2,children:i.jsx(skt,{templates:t.templates})}),t.templates.length===0&&i.jsx("div",{className:Wh.fullwidth,children:i.jsx(DEt,{})})]}),i.jsxs(ikt,{to:"https://docs.getunleash.io/concepts/release-templates",rel:"noopener noreferrer",target:"_blank",children:[i.jsx(akt,{})," Read more in our documentation"]})]}):i.jsx(c0,{feature:"releaseManagement",page:!0})},uC=e=>g.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M4.48149 0.771598C5.27968 -0.159625 6.72032 -0.159624 7.51851 0.771599L10.8844 4.69842C11.5263 5.4474 11.5263 6.5526 10.8844 7.30158L7.51851 11.2284C6.72032 12.1596 5.27968 12.1596 4.48149 11.2284L1.11564 7.30158C0.47366 6.5526 0.47366 5.4474 1.11564 4.69842L4.48149 0.771598Z",fill:"#FFC46F"})),pkt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),fontSize:e.fontSizes.smallBody})),fkt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),hkt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),gkt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),mkt=v("p")(({theme:e})=>({fontWeight:e.fontWeight.bold})),dC=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),ykt=()=>i.jsxs(pkt,{children:[i.jsxs(fkt,{children:[i.jsx(ty,{}),"Release templates"]}),i.jsx("p",{children:"Standardize your team's approach to rolling out new functionality with release templates. These templates allow you to predefine strategies, or groups of strategies, making it easier to set up new flags and ensure alignment in how rollouts are managed."}),i.jsx("p",{children:"Customize templates to suit your needs by adding strategies to specific milestones. Each milestone will execute sequentially, streamlining your release process."}),i.jsxs(hkt,{children:[i.jsx(mkt,{children:"Example usage"}),i.jsxs(gkt,{children:[i.jsxs("div",{children:[i.jsxs(dC,{children:[i.jsx(uC,{}),"Milestone 1"]}),i.jsx("p",{children:"Enable the feature for internal teams to test functionality and resolve initial issues."})]}),i.jsxs("div",{children:[i.jsxs(dC,{children:[i.jsx(uC,{}),"Milestone 2"]}),i.jsx("p",{children:"Expand the rollout to 20% of beta users to gather feedback and monitor performance."})]}),i.jsxs("div",{children:[i.jsxs(dC,{children:[i.jsx(uC,{}),"Milestone 3"]}),i.jsx("p",{children:"Release the feature to all users after confirming stability and addressing earlier feedback."})]})]})]})]}),xkt=v(Yr)({width:"100%"}),vkt=v("div")(({theme:e})=>({width:"100%",height:"auto",marginRight:e.spacing(2)})),bkt=v("span")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.bodySize})),Ckt=v(oi,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t=!1})=>({cursor:"pointer",marginTop:e.spacing(-.5),marginLeft:e.spacing(.5),height:e.spacing(2.5),width:e.spacing(2.5),color:t?e.palette.error.main:e.palette.text.secondary})),wkt=v("div")({display:"inline-flex",alignItems:"center"}),qW=({milestone:e,errors:t,clearErrors:n,milestoneNameChanged:r})=>{const[o,s]=g.useState(!1);return i.jsxs(vkt,{children:[o&&i.jsx(xkt,{label:"",value:e.name,onChange:a=>r(a.target.value),error:!!(t!=null&&t[`${e.id}_name`]),errorText:t==null?void 0:t[`${e.id}_name`],onFocus:()=>n(),onBlur:()=>s(!1),autoFocus:!0,onKeyDownCapture:a=>{a.code==="Enter"&&(a.preventDefault(),a.stopPropagation(),s(!1))},onClick:a=>{a.preventDefault(),a.stopPropagation()}}),!o&&i.jsx(i.Fragment,{children:i.jsxs(wkt,{children:[i.jsx(bkt,{onClick:a=>{s(!0),a.preventDefault(),a.stopPropagation()},children:e.name}),i.jsx(Ckt,{hasError:!!(t!=null&&t[`${e.id}_name`]),onClick:a=>{s(!0),a.preventDefault(),a.stopPropagation()}})]})})]})},Skt=v("div")(({theme:e})=>({width:e.spacing(4),height:"auto","& > svg":{fill:e.palette.primary.main},"& > div":{height:e.spacing(2),marginLeft:"-.75rem",color:e.palette.primary.main}})),jkt=v("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Ekt=v(D7)(({theme:e})=>({fontWeight:e.fontWeight.bold})),kkt=v("div")(({theme:e})=>({display:"grid",cursor:"pointer",gridTemplateColumns:"3rem 1fr",width:"20rem",padding:e.spacing(2),color:"inherit",textDecoration:"inherit",lineHeight:1.25,borderWidth:"1px",borderStyle:"solid",borderColor:e.palette.divider,borderRadius:e.spacing(1),"&:hover, &:focus":{borderColor:e.palette.primary.main}})),Tkt=({strategy:e,onClick:t})=>{const n=TBe(e.name),r=Xl(e.name);return i.jsxs(kkt,{onClick:()=>{const o=Sre("",e);o.name==="flexibleRollout"&&(o.parameters={...o.parameters,groupId:"{{featureName}}"}),t({id:crypto.randomUUID(),name:o.name,title:"",constraints:o.constraints,parameters:o.parameters})},children:[i.jsx(Skt,{children:i.jsx(n,{})}),i.jsxs("div",{children:[i.jsx(Ekt,{text:e.displayName||r,maxWidth:"200",maxLength:25}),i.jsx(jkt,{children:e.description})]})]})},Rkt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallBody,padding:e.spacing(1,2)})),YW=({openEditAddStrategy:e})=>{const{strategies:t}=Of(),n=t.filter(o=>!o.deprecated&&!o.editable),r=o=>{e(o)};return i.jsx(Ri,{dense:!0,children:i.jsxs(i.Fragment,{children:[i.jsx(Rkt,{color:"textSecondary",children:"Predefined strategy types"}),n.map(o=>i.jsx(Or,{children:i.jsx(Tkt,{strategy:o,onClick:r})},o.name))]})})},KW=({onCancel:e,strategy:t,onAddUpdateStrategy:n,editMode:r})=>{const o=t.name||t.strategyName,[s,a]=g.useState({...t,name:o||""}),l=$7(s==null?void 0:s.constraints),c=YP(),{strategyDefinition:u}=O7(o);return u?i.jsx(eo,{modal:!0,disablePadding:!0,description:jre,documentationLink:Ere,documentationLinkLabel:kre,children:i.jsxs(Cre,{strategy:s,setStrategy:a,strategyDefinition:u,errors:c,canRenamePreexistingVariants:!0,groupIdTooltip:i.jsxs(i.Fragment,{children:["Supports ",i.jsx("strong",{children:"{{featureName}}"})," as a template variable. If not set, defaults to the feature flag name."]}),onSubmit:d=>{n(s)},children:[i.jsx($e,{variant:"contained",color:"primary",type:"submit",disabled:!l||c.hasFormErrors(),children:r?"Add changes":"Add strategy"}),i.jsx($e,{onClick:e,children:"Cancel"})]})}):null},Akt=v("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,position:"absolute",zIndex:e.zIndex.fab,top:0,transform:"translateY(-50%)",lineHeight:1,borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.secondary.border,left:e.spacing(4),[`&:has(+ * .${n6}, + .${n6})`]:{filter:"grayscale(.8)"}})),Sie=()=>i.jsx(Akt,{role:"separator",children:"OR"});var KI={},Pkt=je;Object.defineProperty(KI,"__esModule",{value:!0});var Uv=KI.default=void 0,_kt=Pkt(Ee()),Ikt=i,Okt=(0,_kt.default)((0,Ikt.jsx)("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined");Uv=KI.default=Okt;const Mkt=(e,t)=>{const{parameters:n}=e,r=g.useMemo(()=>t.find(a=>a.name===e.name),[t,e.name]),o=r==null?void 0:r.editable,s=(a,l)=>{if(!n||!a.name)return null;const{type:c,name:u}=a,d=i.jsx(mr,{title:u,children:u}),p=`${c}${l}`;switch(c){case"list":{const f=p3(n[u]);return!f||f.length===0?null:i.jsxs(Mc,{type:d,children:[f.length===1?"has 1 item:":`has ${f.length} items:`,i.jsx(p2,{values:f})]},p)}case"percentage":{const f=d3(n[u]);return i.jsxs(Mc,{type:d,children:["is set to ",i.jsx(vg,{label:`${f}%`})]},p)}case"boolean":{const f=n[u];return i.jsxs(Mc,{type:d,children:["is set to ",i.jsx(vg,{label:f})]},p)}case"string":{const f=Fu(n[u]);return i.jsxs(Mc,{type:d,children:[f===""?"is an empty string":"is set to",i.jsx(p2,{values:f===""?void 0:[f]})]},p)}case"number":{const f=d3(n[u]);return i.jsxs(Mc,{type:d,children:["is a number set to",i.jsx(p2,{values:[`${f}`]})]},p)}case"default":return null}return null};return g.useMemo(()=>{var a;return{isCustomStrategy:o,customStrategyParameters:o?(a=r==null?void 0:r.parameters)==null?void 0:a.map(s).filter(Boolean):[]}},[r,o,n])},XW=({value:e,parameters:t,hasConstraints:n,displayGroupId:r})=>{const o=d3(e),a=typeof(t==null?void 0:t.stickiness)=="string"&&(t==null?void 0:t.stickiness)!=="default"?i.jsxs(i.Fragment,{children:["with ",i.jsx("strong",{children:t.stickiness})]}):"";return i.jsx(i.Fragment,{children:i.jsxs(Mc,{type:"Rollout %",children:[i.jsx(vg,{label:`${o}%`}),i.jsxs("p",{children:["of your base ",a," ",i.jsxs("span",{children:[n?"who match constraints ":" ","is included."]}),r&&(t!=null&&t.groupId)?i.jsx(vg,{label:`groupId: ${t==null?void 0:t.groupId}`,component:"span"}):null]})]})})},$kt=(e,t)=>{const{constraints:n}=e,{parameters:r}=e,o=!!(n!=null&&n.length),s=r?Object.keys(r):[],a=l=>{const c=l.toLocaleLowerCase(),u=(r==null?void 0:r[l])||"";return c==="rollout"?i.jsx(XW,{value:u,parameters:r,hasConstraints:o,displayGroupId:t},l):["userids","hostnames","ips"].includes(c)?i.jsx(Mc,{type:l,children:i.jsx(p2,{values:p3(u)})},l):null};return g.useMemo(()=>[...s.map(a),e.name==="default"?i.jsx(XW,{value:"100"}):null].filter(Boolean),[r,o,t])},Dkt=v("div")(({theme:e})=>({padding:e.spacing(3.5,2,.5)})),Lkt=v("div")(()=>({width:"100%",position:"relative"})),Nkt=({variants:e,selected:t})=>e!=null&&e.length?i.jsx(Dkt,{children:i.jsx(Mc,{type:`Variants (${e.length})`,alignType:"top",children:i.jsx(Lkt,{children:i.jsx(bre,{variants:e,header:!1,selected:t})})})}):null,Ry=({strategy:e,displayGroupId:t=!1})=>{const{strategies:n}=Of(),{segments:r}=od(),{isCustomStrategy:o,customStrategyParameters:s}=Mkt(e,n),a=$kt(e,t),{constraints:l}=e,c=r==null?void 0:r.filter(u=>{var d;return(d=e.segments)==null?void 0:d.includes(u.id)});return i.jsxs(i.Fragment,{children:[i.jsxs(L7,{children:[c==null?void 0:c.map(u=>i.jsx(gre,{segment:u},u.id)),l==null?void 0:l.map((u,d)=>i.jsx(q7,{constraint:u},`${a0(u)}-${d}`)),(o?s:a).map((u,d)=>i.jsx(Ene,{children:u},d))]}),i.jsx(Nkt,{variants:e.variants})]})},jie=3,Fkt=v(Mt)(({theme:e})=>({marginLeft:e.spacing(-jie),padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"})),Bkt=v("hgroup")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",columnGap:"1ch",fontSize:e.typography.body1.fontSize,".strategy-name":{fontWeight:"bold",whiteSpace:"nowrap"}})),zkt=v("article")(({theme:e})=>({background:"inherit",padding:e.spacing(jie),paddingTop:e.spacing(.5),display:"flex",flexDirection:"column",rowGap:e.spacing(.5)})),Hkt=v(mr)(({theme:e})=>({fontSize:e.typography.body1.fontSize,fontWeight:"normal",margin:0})),Wkt=v("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"center",color:t?e.palette.text.secondary:e.palette.text.primary,minHeight:e.spacing(5)})),Vkt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),Ukt=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,headerItemsLeft:o,strategyHeaderLevel:s=3,children:a,style:l={},className:c})=>{const u="links"in e?({children:d})=>i.jsx(ft,{to:e.links.edit,children:d}):({children:d})=>i.jsxs(i.Fragment,{children:[" ",d," "]});return i.jsx(K,{className:e.disabled?n6:"",sx:{position:"relative"},children:i.jsxs(zkt,{style:l,className:c,children:[i.jsxs(Wkt,{disabled:!!(e!=null&&e.disabled),children:[t?i.jsx(Fkt,{tabIndex:-1,className:"strategy-drag-handle",draggable:!0,disableRipple:!0,size:"small",onDragStart:t,onDragEnd:n,sx:{cursor:"move"},children:i.jsx(e8,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})}):null,i.jsxs(Vkt,{children:[i.jsx(u,{children:i.jsx(Bkt,{children:e.title?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"strategy-name",children:[Xl(String(e.name)),":"]}),i.jsx(Hkt,{component:`h${s}`,children:e.title})]}):i.jsx(J,{className:"strategy-name",component:`h${s}`,children:Xl(String(e.name))})})}),o]}),i.jsxs(K,{sx:{marginLeft:"auto",display:"flex",alignItems:"center"},children:[e.disabled?i.jsx(an,{color:"warning",children:"Strategy disabled"}):null,r]})]}),i.jsx(K,{children:a})]})})},m8=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,strategyHeaderLevel:o})=>i.jsx(Ukt,{strategyHeaderLevel:o,strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,children:i.jsx(Ry,{strategy:e})}),Eie=({strategy:e,index:t,isDragging:n,onDragStartRef:r,onDragOver:o,onDragEnd:s,headerItemsRight:a})=>{const l=g.useRef(null);return i.jsx(K,{ref:l,onDragOver:o==null?void 0:o(l,t),sx:{opacity:n?"0.5":"1"},children:i.jsx(m8,{headerItemsRight:a,strategy:e,onDragStart:r==null?void 0:r(l,t),onDragEnd:s})},e.id)},kie=v("ol")(({theme:e})=>({listStyle:"none",padding:0,margin:0,"& > li":{paddingBlock:e.spacing(2.5),position:"relative"},"& > li + li":{borderTop:`1px solid ${e.palette.divider}`},"& > li:first-of-type":{paddingTop:e.spacing(1)}})),Gkt=e=>e.palette.background.elevation2,qkt=e=>e.palette.background.elevation1,Tie=v("li")(({theme:e,...t})=>({background:t["data-type"]==="release-plan"?Gkt(e):qkt(e)})),Ykt=v("button")(({theme:e})=>({padding:0,cursor:"grab",transition:"background-color 0.2s ease-in-out",backgroundColor:"inherit",border:"none",borderRadius:e.shape.borderRadiusMedium,color:e.palette.text.secondary,":hover, :focus-visible":{outline:"none",".draggable-hover-indicator":{background:e.palette.table.headerHover}}})),Kkt=v("span")(({theme:e})=>({paddingTop:e.spacing(2),paddingInline:e.spacing(.5),display:"block",height:"100%",width:"100%"})),Xkt=v("span")(({theme:e})=>({display:"block",paddingBlock:e.spacing(.75),borderRadius:e.shape.borderRadiusMedium,"> svg":{verticalAlign:"bottom"}})),JW=({dragItemRef:e})=>i.jsx(Ykt,{tabIndex:-1,type:"button",children:i.jsxs(Kkt,{ref:e,children:[i.jsx(Xkt,{className:"draggable-hover-indicator",children:i.jsx(e8,{"aria-hidden":!0})}),i.jsx(tc,{children:"Drag to reorder"})]})}),Rie=3,ZW=v("div")(({theme:e})=>({marginTop:e.spacing(2),"--left-padding":`var(--form-content-padding, ${e.spacing(4)})`,"--drag-column-width":`max(var(--left-padding), ${e.spacing(4)})`,"--left-offset":"calc(var(--left-padding) * -1)",marginLeft:"var(--left-offset)",display:"grid",gridTemplateColumns:"var(--drag-column-width) 1fr"})),Jkt=v(Y3,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t})=>({position:"relative",overflow:"initial",display:"flex",alignItems:"center",padding:e.spacing(2,2),paddingLeft:e.spacing(Rie),flexDirection:"row",justifyContent:"space-between",boxShadow:"none",border:`1px solid ${t?e.palette.error.border:e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down("sm")]:{justifyContent:"center"},transition:"background-color 0.2s ease-in-out",backgroundColor:e.palette.background.default})),QW=v("div")(({theme:e})=>({display:"flex",flexFlow:"row",alignItems:"center"})),Zkt=v($e)(({theme:e})=>({})),Qkt=v(tu)(({theme:e})=>({boxShadow:"none",background:"none",display:"flex",flexDirection:"column",justifyContent:"space-between",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down("sm")]:{justifyContent:"center"},backgroundColor:e.palette.background.default,"&:before":{opacity:"0 !important"},overflow:"hidden"})),eTt=v(ru)(({theme:e})=>({boxShadow:"none",padding:e.spacing(1.5,2),paddingLeft:e.spacing(Rie),borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down(400)]:{padding:e.spacing(1,2)},"&:focus-visible":{background:e.palette.table.headerHover}})),tTt=v(nu)(({theme:e})=>({borderBottomLeftRadius:e.shape.borderRadiusMedium,borderBottomRightRadius:e.shape.borderRadiusMedium,padding:e.spacing(0),backgroundColor:e.palette.background.elevation1})),nTt=v("div")(({theme:e})=>({padding:e.spacing(2),display:"flex",justifyContent:"flex-end",gap:e.spacing(3),backgroundColor:"inherit",borderTop:`1px solid ${e.palette.divider}`})),rTt=v(Mt)(({theme:e})=>({marginLeft:e.spacing(1),color:e.palette.primary.main})),oTt=({milestone:e,milestoneChanged:t,errors:n,clearErrors:r,removable:o,onDeleteMilestone:s,index:a,onMoveItem:l})=>{const[c,u]=g.useState(),[d,p]=g.useState(null),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,x]=g.useState(!!e.startExpanded),C=!!c,w=C?"MilestoneStrategyMenuPopover":void 0,j=ioe(a,l),k=()=>{u(void 0)},[S,E]=g.useState({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),T=H=>{const N=e.strategies||[];t({...e,strategies:[...N.map(I=>I.id===H.id?H:I)]})},R=H=>{var N;t({...e,strategies:[...e.strategies||[],{...H,sortOrder:((N=e.strategies)==null?void 0:N.length)||0}]})},_=H=>{var I;((I=e.strategies)==null?void 0:I.find(q=>q.id===H.id))?T(H):(R(H),x(!0)),h(!1),y(!1),E({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),r()},M=(H,N)=>{y(N),E(H),h(!0)},$=H=>(N,I)=>q=>{if(d===null||N.current===null||d.index===I||H===d.id)return;const{top:ne,bottom:V}=N.current.getBoundingClientRect(),oe=q.clientY-ne<d.height,se=V-q.clientY<d.height,ae=d.index>I;if(oe&&ae||se&&!ae){const ce=[...e.strategies||[]],_e=ce.splice(d.index,1)[0];ce.splice(I,0,_e),t({...e,strategies:ce}),p({...d,index:I})}},z=(H,N)=>I=>{var q,ne;!H.current||!e.strategies||(p({id:(q=e.strategies[N])==null?void 0:q.id,index:N,height:((ne=H.current)==null?void 0:ne.offsetHeight)||0}),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/html",H.current.outerHTML),I.dataTransfer.setDragImage(H.current,20,20))},A=()=>{p(null),O()},O=()=>{if(!e.strategies)return;const H=[...e.strategies];H.forEach((N,I)=>{N.sortOrder=I}),t({...e,strategies:H})},L=H=>{const N=e.strategies||[];t({...e,strategies:[...N.filter(I=>I.id!==H)]})},B=H=>{t({...e,name:H})};return!e.strategies||e.strategies.length===0?i.jsxs(i.Fragment,{children:[i.jsxs(ZW,{children:[i.jsx(JW,{dragItemRef:j}),i.jsxs(Jkt,{hasError:!!(n!=null&&n[e.id])||!!(n!=null&&n[`${e.id}_name`]),children:[i.jsx(QW,{children:i.jsx(qW,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:B})}),i.jsxs(QW,{children:[i.jsx($e,{variant:"outlined",color:"primary",onClick:H=>u(H.currentTarget),children:"Add strategy"}),i.jsx(rTt,{title:"Remove milestone",onClick:s,disabled:!o,children:i.jsx(Uv,{})}),i.jsx(ql,{id:w,open:C,anchorEl:c,onClose:k,onClick:k,PaperProps:{sx:H=>({paddingBottom:H.spacing(1)})},children:i.jsx(YW,{openEditAddStrategy:H=>{M(H,!1)}})})]})]})]}),i.jsx(Gw,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),i.jsx(hl,{label:"Add strategy to template milestone",onClose:()=>{h(!1),y(!1)},open:f,children:i.jsx(KW,{strategy:S,onAddUpdateStrategy:_,onCancel:()=>{h(!1),y(!1)},editMode:m})})]}):i.jsxs(i.Fragment,{children:[i.jsxs(ZW,{children:[i.jsx(JW,{dragItemRef:j}),i.jsxs(Qkt,{expanded:b,onChange:(H,N)=>x(N),children:[i.jsx(eTt,{expandIcon:i.jsx(Da,{titleAccess:`${b?"Hide":"Show"} milestone strategies`}),id:`milestone-accordion-summary-${e.id}`,"aria-controls":`milestone-accordion-details-${e.id}`,children:i.jsx(qW,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:B})}),i.jsxs(tTt,{children:[i.jsx(kie,{children:e.strategies.map((H,N)=>i.jsxs(Tie,{children:[N>0?i.jsx(Sie,{}):null,i.jsx(Eie,{index:N,onDragEnd:A,onDragStartRef:z,onDragOver:$(H.id),isDragging:(d==null?void 0:d.id)===H.id,strategy:{...H,name:H.name||H.strategyName||""},headerItemsRight:i.jsxs(i.Fragment,{children:[i.jsx(Mt,{title:"Edit strategy",onClick:()=>{M(H,!0)},children:i.jsx(oi,{})}),i.jsx(Mt,{title:"Remove strategy",onClick:()=>L(H.id),children:i.jsx(Uv,{})})]})})]},H.id))}),i.jsxs(nTt,{children:[i.jsxs($e,{variant:"text",color:"primary",onClick:s,disabled:!o,children:[i.jsx(Uv,{})," Remove milestone"]}),i.jsx(Zkt,{variant:"outlined",color:"primary",onClick:H=>u(H.currentTarget),children:"Add strategy"}),i.jsx(ql,{id:w,open:C,anchorEl:c,onClose:k,onClick:k,PaperProps:{sx:H=>({paddingBottom:H.spacing(1)})},children:i.jsx(YW,{openEditAddStrategy:H=>{M(H,!1)}})})]})]})]})]}),i.jsx(Gw,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),i.jsx(hl,{label:"Add strategy to template milestone",onClose:()=>{h(!1),y(!1)},open:f,children:i.jsx(KW,{strategy:S,onAddUpdateStrategy:_,onCancel:()=>{h(!1),y(!1)},editMode:m})})]})},sTt=v($e)(({theme:e})=>({marginTop:e.spacing(1),maxWidth:e.spacing(20)})),iTt=({milestones:e,setMilestones:t,errors:n,clearErrors:r,milestoneChanged:o})=>{const s=g.useCallback(async({dragIndex:l,dropIndex:c,event:u,draggedElement:d})=>{if(u.type!=="drop"&&u.type==="dragenter"&&l!==c){const p=u.target,f=d.getBoundingClientRect().height,{top:h,bottom:m}=p.getBoundingClientRect(),y=u.clientY-h<f,b=m-u.clientY<f;if(l>c?y:b){const j=[...e||[]],k=j.splice(l,1)[0];j.splice(c,0,k),j.forEach((S,E)=>{S.sortOrder=E}),t(j)}}},[e]),a=l=>()=>{t(c=>c.filter(u=>u.id!==l).map((u,d)=>({...u,sortOrder:d})))};return i.jsxs(i.Fragment,{children:[e.map((l,c)=>i.jsx(oTt,{index:c,onMoveItem:s,milestone:l,milestoneChanged:o,errors:n,clearErrors:r,removable:e.length>1,onDeleteMilestone:a(l.id)},l.id)),i.jsx(sTt,{variant:"text",color:"primary",startIcon:i.jsx(Eo,{}),onClick:()=>t(l=>{var c;return[...l,{id:crypto.randomUUID(),name:`Milestone ${l.length+1}`,sortOrder:l.length,strategies:(c=l[l.length-1].strategies)==null?void 0:c.map(u=>({...u,id:crypto.randomUUID()})),startExpanded:!0}]}),children:"Add milestone"})]})},Aie=v(Yr)(({theme:e})=>({width:"100%",fieldset:{border:"none"},"label::first-letter":{textTransform:"uppercase"},marginBottom:e.spacing(2),padding:e.spacing(0)})),aTt=v(Aie)(({theme:e})=>({padding:e.spacing(2,5,1,1.75)})),lTt=v("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",paddingTop:e.spacing(5)})),cTt=v(K)(({theme:e})=>({flex:1,display:"flex",alignItems:"flex-end",marginTop:e.spacing(3),marginBottom:e.spacing(3)})),Pie=({name:e,setName:t,description:n,setDescription:r,milestones:o,setMilestones:s,errors:a,clearErrors:l,formTitle:c,archived:u,formatApiCode:d,handleSubmit:p,Limit:f,children:h})=>{const m=Bt(),y=b=>{s(x=>x.map(C=>C.id===b.id?{...b}:C))};return i.jsxs(eo,{title:c,description:i.jsx(ykt,{}),formatApiCode:d,children:[u&&i.jsx(Dt,{severity:"warning",children:"This template has been archived and can no longer be edited."}),i.jsxs(lTt,{onSubmit:p,children:[i.jsx(Aie,{label:"Template name","aria-required":!0,value:e,onChange:b=>t(b.target.value),error:!!a.name,errorText:a.name,onFocus:()=>{delete a.name},autoFocus:!0,InputProps:{style:{fontSize:m.typography.h1.fontSize}},InputLabelProps:{style:{fontSize:m.typography.h1.fontSize}},size:"medium"}),i.jsx(aTt,{label:"Template description (optional)",multiline:!0,value:n,onChange:b=>r(b.target.value),InputProps:{style:{fontSize:m.typography.h2.fontSize,padding:0}},InputLabelProps:{style:{fontSize:m.typography.h2.fontSize,padding:0}},size:"small"}),i.jsx(iTt,{milestones:o,setMilestones:s,errors:a,clearErrors:l,milestoneChanged:y}),i.jsx(cTt,{children:f}),h]})]})},_ie=(e="",t="",n=[{id:crypto.randomUUID(),name:"Milestone 1",sortOrder:0}])=>{const r=wo("templateId"),{templates:o}=ay(),[s,a]=g.useState(e),[l,c]=g.useState(t),[u,d]=g.useState(n),[p,f]=g.useState({});return g.useEffect(()=>{a(e)},[e]),g.useEffect(()=>{c(t)},[t]),g.useEffect(()=>{d(n)},[n.length]),{name:s,setName:a,description:l,setDescription:c,milestones:u,setMilestones:d,errors:p,clearErrors:()=>{f({})},validate:()=>{let b=!0;s.length===0&&(f(w=>({...w,name:"Name can not be empty."})),b=!1),o.some(w=>w.name===s&&w.id!==r)&&(f(w=>({...w,name:"A template with this name already exists."})),b=!1),u.length===0&&(f(w=>({...w,milestones:"At least one milestone is required."})),b=!1);const x={},C=new Set;return u.forEach(w=>{(!w.name||w.name.length===0)&&(x[w.id]="Milestone must have a valid name.",x[`${w.id}_name`]="Milestone must have a valid name."),(!w.strategies||w.strategies.length===0)&&(x[w.id]="Milestone must have at least one strategy."),C.has(w.name)?x[w.id]="Milestone names must be unique.":w.name&&C.add(w.name)}),Object.keys(x).length>0&&(f(w=>({...w,...x,milestones:"All milestones must have unique names and at least one strategy each."})),b=!1),b},getTemplatePayload:()=>({name:s,description:l,milestones:u.map(({startExpanded:b,...x})=>{var C;return{...x,strategies:(C=x.strategies)==null?void 0:C.map(({strategyName:w,name:j,...k})=>({name:j||w||"",...k}))}})})}},uTt=v("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),dTt=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),pTt=()=>{const{uiConfig:e,isEnterprise:t}=ut(),{setToastApiError:n,setToastData:r}=_t(),o=$t(),{createReleasePlanTemplate:s}=YI(),{trackEvent:a}=zt(),{templates:l}=ay(),c=e.resourceLimits.releaseTemplates,u=l.length<c;nd("Create release template");const{name:d,setName:p,description:f,setDescription:h,milestones:m,setMilestones:y,errors:b,clearErrors:x,validate:C,getTemplatePayload:w}=_ie(),j=()=>{o(Ii)},k=async E=>{if(E.preventDefault(),x(),C())try{const R=await s(w());vZ(),r({type:"success",text:u?"Release template created":"You have reached the limit of release templates.",persist:!u}),a("release-management",{props:{eventType:"create-template",template:R.name}}),o("/release-templates")}catch(R){n(pt(R))}},S=()=>`curl --location --request POST '${e.unleashUrl}/api/admin/release-plan-templates' \\
494
494
  --header 'Authorization: INSERT_API_KEY' \\
495
495
  --header 'Content-Type: application/json' \\
496
496
  --data-raw '${JSON.stringify(w(),void 0,2)}'`;return t()?i.jsx(Pie,{name:d,setName:p,description:f,setDescription:h,milestones:m,setMilestones:y,errors:b,clearErrors:x,formTitle:"Create release template",formatApiCode:S,handleSubmit:k,Limit:!u&&i.jsx(yy,{name:"release templates",limit:c,currentValue:l.length}),children:i.jsxs(uTt,{children:[i.jsx(Lf,{name:"template",permission:u7,disabled:!u,children:"Save template"}),i.jsx(dTt,{onClick:j,children:"Cancel"})]})}):null},fTt=e=>`api/admin/release-plan-templates/${e}`,eV={id:"",name:"",description:"",milestones:[],createdAt:"",createdByUserId:0},Iie=e=>{const{isEnterprise:t}=ut(),{data:n,error:r,mutate:o}=Ts(t(),eV,yt(fTt(e)),hTt);return g.useMemo(()=>({template:n??eV,loading:!r&&!n,refetch:()=>o(),error:r}),[n,r,o])},hTt=e=>fetch(e).then(en("Release template")).then(t=>t.json()),gTt=v("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),mTt=v($e)(({theme:e})=>({marginLeft:e.spacing(3)})),yTt=()=>{const{uiConfig:e,isEnterprise:t}=ut(),n=ar("templateId"),{template:r,loading:o,refetch:s}=Iie(n),{trackEvent:a}=zt();nd("Edit release template");const l=$t(),{setToastApiError:c,setToastData:u}=_t(),{updateReleasePlanTemplate:d}=YI(),{name:p,setName:f,description:h,setDescription:m,errors:y,clearErrors:b,milestones:x,setMilestones:C,validate:w,getTemplatePayload:j}=_ie(r.name,r.description,r.milestones),k=()=>{l("/release-templates")},S=async T=>{if(T.preventDefault(),b(),w())try{await d(n,j()),await s(),u({type:"success",text:"Release template updated"}),a("release-management",{props:{eventType:"edit-template",template:r.name}}),l("/release-templates")}catch(_){c(pt(_))}},E=()=>`curl --location --request PUT '${e.unleashUrl}/api/admin/release-plan-templates/${n}' \\
@@ -510,7 +510,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
510
510
  If any of a feature flag's activation strategies returns true, the user will get access.
511
511
  `,o$t="https://docs.getunleash.io/concepts/activation-strategies",s$t="Strategies documentation",i$t=(e,t)=>{const{isChangeRequestConfigured:n}=vl(e.project),r=n(e.environment),o=!["Cancelled","Applied","Scheduled"].includes(e.state),{user:s}=gs(),a=(s==null?void 0:s.id)===e.createdBy.id,l=r&&o&&a,c=l&&["addStrategy","updateStrategy","updateMilestoneStrategy"].includes(t.action),u=l&&_O(e)>1;return{showEdit:c,showDiscard:u}},a$t=v(ql)(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(1,1.5)})),l$t=v(Mt)(({theme:e})=>({marginLeft:"auto"})),$j=({changeRequest:e,feature:t,change:n,onRefetch:r})=>{const{showDiscard:o,showEdit:s}=i$t(e,n),{discardChange:a}=ia(),{setToastData:l,setToastApiError:c}=_t(),[u,d]=g.useState(!1),p=`cr-${n.id}-actions`,f=`${p}-menu`,[h,m]=g.useState(null),y=!!h,b=j=>{m(j.currentTarget)},x=()=>{m(null)},C=()=>{d(!0)},w=async()=>{try{x(),await a(e.project,e.id,n.id),l({text:"Change discarded from change request draft.",type:"success"}),r==null||r()}catch(j){c(pt(j))}};return i.jsx(te,{condition:s||o,show:i.jsxs(i.Fragment,{children:[i.jsx(Rt,{title:"Change request actions",arrow:!0,describeChild:!0,children:i.jsx(l$t,{id:p,"aria-controls":y?f:void 0,"aria-haspopup":"true","aria-expanded":y?"true":void 0,onClick:b,type:"button",children:i.jsx(Mf,{})})}),i.jsx(a$t,{id:f,anchorEl:h,open:y,onClose:x,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:i.jsxs(Vg,{"aria-labelledby":p,children:[i.jsx(te,{condition:s,show:i.jsxs(wn,{onClick:C,children:[i.jsx(Io,{children:i.jsx(oi,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Edit change"})}),i.jsx(t$t,{changeRequestId:e.id,featureId:t,change:n,environment:e.environment,open:u,onSubmit:()=>{d(!1),r==null||r()},onClose:()=>{d(!1)}})]})}),i.jsx(te,{condition:o,show:i.jsxs(wn,{onClick:()=>{w()},children:[i.jsx(Io,{children:i.jsx(So,{})}),i.jsx(un,{children:i.jsx(J,{variant:"body2",children:"Discard change"})})]})})]})})]})})},c$t=v("div")(({theme:e})=>({width:2,height:e.spacing(2),backgroundColor:e.palette.divider,marginLeft:e.spacing(3.5)})),Lae=({plan:e,readonly:t,changesByMilestone:n,onUpdateAutomation:r,onDeleteAutomation:o,renderStrategy:s})=>{const a={type:"not-started",progression:"active"};return i.jsx(i.Fragment,{children:e.milestones.map((l,c)=>{var w;const u=n[l.id]??[],d=u.some(j=>j.change.action==="changeMilestoneProgression"),p=u.some(j=>j.change.action==="deleteMilestoneProgression"),f=u.some(j=>j.change.action==="updateMilestoneStrategy"),h=c<e.milestones.length-1,m=((w=e.milestones[c+1])==null?void 0:w.id)||"",y=t?l.transitionCondition!==void 0:d||p,b=h&&y,x=p?i.jsx(an,{color:"error",children:"Deleted in draft"}):d?i.jsx(an,{color:"warning",children:"Modified in draft"}):void 0,C=b&&l.transitionCondition?i.jsx(Cae,{status:a,children:t?i.jsx(HOt,{intervalMinutes:l.transitionCondition.intervalMinutes,status:a}):i.jsx(Tae,{intervalMinutes:l.transitionCondition.intervalMinutes,targetMilestoneId:m,sourceMilestoneStartedAt:l.startedAt,onSave:async j=>(await r(l.id,j),{shouldReset:!0}),onDelete:()=>o(l.id),milestoneName:l.name,status:a,badge:x,environment:e.environment})}):void 0;return i.jsxs("div",{children:[i.jsx(bO,{featureId:e.featureName,readonly:t,milestone:l,environmentId:e.environment,automationSection:C,defaultExpanded:f,renderStrategy:s}),h&&i.jsx(c$t,{})]},l.id)})})},u$t=({plan:e,changesByMilestone:t={}})=>i.jsx(Lae,{plan:e,readonly:!0,changesByMilestone:t,onUpdateAutomation:async()=>{},onDeleteAutomation:()=>{},renderStrategy:n=>i.jsx(m8,{strategy:n})}),d$t=v(Dae)(({theme:e})=>({paddingInline:e.spacing(3),paddingBlockStart:e.spacing(.5),paddingBlockEnd:e.spacing(3)})),p$t=({plan:e,changesByMilestone:t={},onUpdateAutomation:n,onDeleteAutomation:r,changeRequest:o,onRefetch:s})=>{const a=new Map(Object.values(t).flat().map(({change:c})=>c).filter(c=>c.action==="updateMilestoneStrategy").map(c=>[c.payload.id,c])),l=c=>{const u=a.get(c.id);return u?i.jsx(d$t,{change:u,featureName:e.featureName,environmentName:e.environment,projectId:o.project,changeRequestState:o.state,actions:i.jsx($j,{changeRequest:o,feature:e.featureName,change:u,onRefetch:s})}):i.jsx(m8,{strategy:c})};return i.jsx(Lae,{plan:e,readonly:!1,changesByMilestone:t,onUpdateAutomation:n,onDeleteAutomation:r,renderStrategy:l})},f$t=(e,t={})=>{const{snapshot:n,...r}=t;return{...e,...r}},h$t=(e,t)=>{const n=new Map(t.map(r=>[r.payload.id,r.payload]));return e.map(r=>f$t(r,n.get(r.id)))},g$t=e=>e.action==="updateMilestoneStrategy",m$t=(e,t)=>({...e,milestones:e.milestones.map(n=>{const r=t.find(a=>a.action==="changeMilestoneProgression"&&a.payload.sourceMilestone===n.id),o=t.find(a=>a.action==="deleteMilestoneProgression"&&a.payload.sourceMilestone===n.id);let s={strategies:h$t(n.strategies,t.filter(g$t))};return o&&(s={...s,transitionCondition:null}),r&&(s={...s,transitionCondition:r.payload.transitionCondition}),{...n,...s}})}),y$t=v(R0)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),x$t=(e,t)=>{const n={},r=new Map(t.milestones.flatMap(a=>a.strategies.map(l=>[l.id,{milestone:a,strategy:l}]))),o=a=>{var l;return((l=t.milestones.find(c=>c.id===a))==null?void 0:l.name)||a},s=(a,l,c)=>{const u=n[a]??[];u.push({change:l,description:c}),n[a]=u};for(const a of e)switch(a.action){case"changeMilestoneProgression":case"deleteMilestoneProgression":{const l=a.payload.sourceMilestone,c=a.action==="changeMilestoneProgression"?"Editing":"Deleting";s(l,a,{text:`${c} automation for ${o(l)}`,action:a.action});break}case"updateMilestoneStrategy":{const l=r.get(a.payload.id);if(l){const c=a.payload.title||l.strategy.name||"strategy";s(l.milestone.id,a,{text:`Editing ${c} in ${l.milestone.name||l.milestone.id}`,action:a.action})}break}}return n},v$t=v("ul")(({theme:e})=>({padding:e.spacing(1.5),alignItems:"flex-start",'li[data-action="deleteMilestoneProgression"]':{color:aO(e).deleted,"::marker":{content:'"- "'}}})),b$t=({feature:e,currentReleasePlan:t,changeRequest:n,onUpdateChangeRequestSubmit:r,onDeleteChangeRequestSubmit:o,onRefetch:s})=>{var m;const a=n.state,l=e.changes.filter(y=>y.action==="changeMilestoneProgression"||y.action==="deleteMilestoneProgression"||y.action==="updateMilestoneStrategy"),c=y=>y instanceof Object&&"milestones"in y,u=(m=l.find(y=>c(y.payload.snapshot)))==null?void 0:m.payload.snapshot,d=(Ns(a)||!t)&&u?u:t;if(!d)return null;const p=m$t(d,l),f=x$t(l,d),h=Ns(a);return i.jsxs(y$t,{children:[i.jsxs(js,{children:[i.jsx(Ss,{component:"div",children:i.jsx(v$t,{children:d.milestones.flatMap(({id:y})=>{const b=f[y];return b?b.map(({description:x})=>i.jsx("li",{"data-action":x.action,children:x.text})):null})})}),i.jsx("div",{children:i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]})})]}),i.jsx(Mo,{children:h?i.jsx(u$t,{plan:p,changesByMilestone:f}):i.jsx(p$t,{plan:p,changesByMilestone:f,onUpdateAutomation:r,onDeleteAutomation:o,changeRequest:n,onRefetch:s})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:d,data:p}})})]})},C$t="count",w$t="internal",IO=e=>{const t=!!(e!=null&&e.metricName&&(e!=null&&e.range)),r=(()=>{if(!e)return"";const c=new URLSearchParams({metricName:e.metricName,range:e.range,aggregationMode:e.aggregationMode??C$t,source:e.source??w$t});if(e.mode&&c.append("mode",e.mode),e.labels&&Object.keys(e.labels).length>0){const u=Object.entries(e.labels).reduce((d,[p,f])=>(f.length>0&&(d[p]=f),d),{});Object.keys(u).length>0&&c.append("labels",JSON.stringify(u))}return`api/admin/impact-metrics/?${c.toString()}`})(),{data:o,refetch:s,loading:a,error:l}=n7(t?yt(r):null,t?()=>kR(yt(r),"Impact metrics data"):()=>Promise.resolve([]),{refreshInterval:30*1e3,revalidateOnFocus:!0});return{data:o||{series:[],labels:{},start:"",end:"",step:""},refetch:s,loading:t?a:!1,error:l}},WV=e=>{switch(e){case"hour":return"minute";case"day":return"hour";case"week":return"day";case"month":return"week";default:return"day"}},S$t=e=>{switch(e){case"hour":return"HH:mm";case"day":return"HH:mm";case"week":return"MMM dd";case"month":return"MMM dd";default:return"MMM dd"}},VV=e=>{const{__name__:t,...n}=e,r=Object.entries(n).filter(([o,s])=>o!=="__name__"&&s).map(([o,s])=>`${o}=${s}`).join(", ");return!t&&!r?"Value":t?r?`${t} (${r})`:t:r},j$t=n8(1e3,1),E$t=["counter","gauge","histogram"],k$t=(e,t)=>(t==null?void 0:t.length)===1&&E$t.includes(t[0])?t[0]:e.startsWith("unleash_counter_")?"counter":e.startsWith("unleash_gauge_")?"gauge":e.startsWith("unleash_histogram_")||e.endsWith("_bucket")?"histogram":e.endsWith("_count")?"counter":"unknown",T$t=e=>e==="counter"?"count":e==="histogram"?"p50":"avg",R$t=(e,t)=>{if(!t||t.length===0||e<=0)return 0;let n=0;for(let r=0;r<t.length;r++){const o=t.charCodeAt(r);n=(n<<5)-n+o,n=n&n}return Math.abs(n)%e},Nae=({timeSeriesData:e,colorIndexBy:t,threshold:n})=>{const r=Bt(),o=r.palette.charts.series,s=R$t(o.length,t);return g.useMemo(()=>{if(!e||e.length===0)return{labels:[],datasets:[{data:[],borderColor:r.palette.primary.main,backgroundColor:r.palette.primary.light}]};if(e.length===1){const a=e[0],l=a.data.map(([d])=>new Date(d*1e3)),u=[{data:a.data.map(([,d])=>Number(d)),borderColor:r.palette.primary.main,backgroundColor:r.palette.primary.light,label:VV(a.metric)}];if(n!==void 0){const d=l.map(()=>n);u.push({data:d,borderColor:r.palette.error.main,backgroundColor:"transparent",borderDash:[4,3],label:"Threshold"})}return{labels:l,datasets:u}}else{const a=new Set;if(e.forEach(d=>{d.data.forEach(([p])=>{a.add(p)})}),a.size===0)return{labels:[],datasets:[]};const l=Array.from(a).sort((d,p)=>d-p),c=l.map(d=>new Date(d*1e3)),u=e.map((d,p)=>{const f=VV(d.metric),h=o[(p+s)%o.length],m=new Map(d.data),y=l.map(b=>{const x=m.get(b);return x!==void 0?Number(x):null});return{label:f,data:y,borderColor:h,backgroundColor:h,fill:!1}});return{labels:c,datasets:u}}},[e,r,n,s])},Dj=({metricName:e,timeRange:t,labelSelectors:n,yAxisMin:r,aggregationMode:o,aspectRatio:s,overrideOptions:a={},errorTitle:l="Failed to load impact metrics.",emptyDataDescription:c="Send impact metrics using Unleash SDK and select data series to view the chart.",noSeriesPlaceholder:u,isPreview:d,showComponents:p=["xAxis","yAxis","debugInfo","legend","notEnoughDataMessage"],threshold:f,source:h})=>{const m=q=>p.includes(q),{data:{start:y,end:b,series:x,debug:C},loading:w,error:j}=IO(e?{metricName:e,range:t,aggregationMode:o,labels:Object.keys(n).length>0?n:void 0,source:h,mode:"display"}:void 0),k=ld({fill:!0,type:"constant"}),S=Nae({timeSeriesData:x,colorIndexBy:C==null?void 0:C.query,threshold:f}),E=!!j,T=w,R=!e||T||E,_=g.useMemo(()=>!T&&(!x||x.length===0||!S.datasets.some(q=>q.data.length>1)),[S,T,x]),M=y?LL(Number.parseInt(y,10)):void 0,$=b?LL(Number.parseInt(b,10)):void 0,A=m("notEnoughDataMessage")?e?i.jsx(Jl,{description:c}):u||i.jsx(Jl,{title:"Select a metric series to view the chart.",description:""}):i.jsx("div",{}),O=Object.keys(n).length>0,L=_?A:T,{scales:B={},plugins:H={},...N}=a,I=R?a:{...N,scales:{x:m("xAxis")?{type:"time",min:M==null?void 0:M.getTime(),max:$==null?void 0:$.getTime(),time:{unit:WV(t),displayFormats:{[WV(t)]:S$t(t)},tooltipFormat:"PPpp"},ticks:{maxRotation:45,minRotation:45,maxTicksLimit:8},...B.x}:{display:!1},y:m("yAxis")?{beginAtZero:r==="zero",title:{display:o==="rps",text:o==="rps"?"Rate per second":""},ticks:{precision:0,callback:q=>typeof q=="number"?`${j$t(q)}${o==="rps"?"/s":""}`:q},...B.y}:{display:!1}},plugins:{legend:{display:m("legend")&&x&&(O||x.length>1),position:"bottom",labels:{usePointStyle:!0,boxWidth:8,padding:12}},...H},animations:{x:{duration:0},y:{duration:0}}};return i.jsxs(i.Fragment,{children:[i.jsx(K,{sx:d?{}:{height:"100%",width:"100%","& > div":{height:"100% !important",width:"100% !important"}},children:i.jsx(ad,{data:_||T?k:S,aspectRatio:s,overrideOptions:I,cover:E?i.jsx(Dt,{severity:"error",children:l}):L})}),m("debugInfo")&&d&&(C!=null&&C.query)?i.jsx(K,{sx:q=>({margin:q.spacing(2),padding:q.spacing(2),background:q.palette.background.elevation1}),children:i.jsx(J,{variant:"caption",color:"text.secondary",sx:{wordBreak:"break-all"},children:i.jsx("code",{children:C.query})})}):null,m("debugInfo")&&d&&(C!=null&&C.isTruncated)?i.jsx(K,{sx:q=>({padding:q.spacing(0,2)}),children:i.jsxs(Dt,{severity:"warning",children:["Showing only ",x.length," series due to performance. Please change filters for more accurate results."]})}):null]})},A$t=v(K)(({theme:e})=>({width:60,marginRight:e.spacing(1),cursor:"pointer",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,padding:e.spacing(.75)})),P$t=v(K)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",padding:e.spacing(2)})),_$t=v(K)(({theme:e})=>({padding:e.spacing(2),paddingBottom:e.spacing(7),overflow:"hidden"})),I$t=v(Sn)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.25),whiteSpace:"nowrap",textDecoration:"none",fontWeight:e.fontWeight.bold,fontSize:e.typography.body2.fontSize,color:e.palette.primary.main,"&:hover":{textDecoration:"none"}})),O$t=({metricName:e,metricDisplayName:t,timeRange:n,labelSelectors:r,aggregationMode:o,threshold:s,projectId:a,featureId:l,source:c})=>{const u=i.jsxs(K,{sx:{width:400},children:[i.jsxs(P$t,{children:[i.jsx(J,{variant:"body2",sx:{fontWeight:"bold"},children:t||e}),i.jsxs(I$t,{component:ft,to:`/projects/${a}/features/${l}/metrics`,children:["View",i.jsx(my,{sx:{fontSize:16}})]})]}),i.jsx(pr,{}),i.jsx(_$t,{children:i.jsx(Dj,{metricName:e,timeRange:n,labelSelectors:r,yAxisMin:"auto",aggregationMode:o,source:c,isPreview:!1,showComponents:["xAxis","yAxis","notEnoughDataMessage"],threshold:s})})]});return i.jsx(wr,{title:u,placement:"left",arrow:!0,maxWidth:450,children:i.jsx(A$t,{children:i.jsx(Dj,{metricName:e,timeRange:n,labelSelectors:r,yAxisMin:"auto",aggregationMode:o,source:c,isPreview:!0,showComponents:[],threshold:s,overrideOptions:{interaction:{mode:"nearest",intersect:!1},plugins:{tooltip:{enabled:!1}},elements:{line:{borderWidth:1.25},point:{radius:0,hoverRadius:0}}}})})})},M$t=v(K)(({theme:e})=>({width:60,marginRight:e.spacing(1),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,padding:e.spacing(.75),display:"flex",alignItems:"center",gap:e.spacing(.5)})),$$t=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:e.palette.secondary.main,color:e.palette.common.white,"& svg":{fontSize:"14px"}})),D$t=v(K)({flex:1,minWidth:0}),L$t=({metricName:e,timeRange:t,labelSelectors:n,aggregationMode:r,threshold:o,source:s})=>i.jsx(ra,{title:"Not enough data",placement:"top",arrow:!0,children:i.jsxs(M$t,{children:[i.jsx(D$t,{children:i.jsx(Dj,{metricName:e,timeRange:t,labelSelectors:n,yAxisMin:"auto",aggregationMode:r,source:s,isPreview:!0,showComponents:[],threshold:o,overrideOptions:{interaction:{mode:"nearest",intersect:!1},plugins:{tooltip:{enabled:!1}},elements:{line:{borderWidth:1.25},point:{radius:0,hoverRadius:0}}}})}),i.jsx($$t,{children:i.jsx(DI,{})})]})}),N$t=({metricName:e,metricDisplayName:t,timeRange:n,labelSelectors:r,aggregationMode:o,threshold:s,projectId:a,featureId:l,source:c})=>{const{data:{series:u},loading:d}=IO(e?{metricName:e,range:n,aggregationMode:o,labels:Object.keys(r).length>0?r:void 0,source:c,mode:"display"}:void 0),p=Nae({timeSeriesData:u,colorIndexBy:void 0,threshold:s});return g.useMemo(()=>!d&&(!u||u.length===0||!p.datasets.some(h=>h.data.length>1)),[p,d,u])?i.jsx(L$t,{metricName:e,timeRange:n,labelSelectors:r,aggregationMode:o,threshold:s,source:c}):i.jsx(O$t,{metricName:e,metricDisplayName:t,timeRange:n,labelSelectors:r,aggregationMode:o,threshold:s,projectId:a,featureId:l,source:c})},F$t=()=>{const e="api/admin/impact-metrics/metadata",{data:t,refetch:n,loading:r,error:o}=n7(yt(e),()=>kR(yt(e),"Impact metrics metadata"));return{metadata:t,refetch:n,loading:r,error:o}},B$t=()=>{const{metadata:e,loading:t,error:n}=F$t();return{metricOptions:(e==null?void 0:e.metrics)??[],loading:t,error:n}},z$t=({value:e,onChange:t,label:n="Time",children:r})=>i.jsxs(Ko,{variant:"outlined",size:"small",children:[n?i.jsx(Gl,{id:"range-select-label",children:n}):null,i.jsx(na,{labelId:"range-select-label",value:e,onChange:o=>t(o.target.value),label:n,children:r})]}),UV=[i.jsx(wn,{value:"rps",children:"Rate per second"},"rps"),i.jsx(wn,{value:"count",children:"Count"},"count")],GV=[i.jsx(wn,{value:"avg",children:"Average"},"avg"),i.jsx(wn,{value:"sum",children:"Sum"},"sum")],qV=[i.jsx(wn,{value:"p50",children:"50th percentile"},"p50"),i.jsx(wn,{value:"p95",children:"95th percentile"},"p95"),i.jsx(wn,{value:"p99",children:"99th percentile"},"p99")],YV={counter:UV,gauge:GV,histogram:qV,unknown:[...UV,...GV,...qV]},H$t=({value:e,onChange:t,metricType:n,label:r="Aggregation Mode"})=>{const o=YV[n]??YV.unknown;return i.jsxs(Ko,{variant:"outlined",size:"small",children:[r?i.jsx(Gl,{id:"mode-select-label",children:r}):null,i.jsx(na,{labelId:"mode-select-label",value:e,onChange:s=>t(s.target.value),label:r,children:o})]})};var Lj=function(e,t){return Lj=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Lj(e,t)};function Fae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Lj(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ho=function(){return ho=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ho.apply(this,arguments)};function Ps(e,t,n,r){return new(n||(n=Promise))(function(o,s){function a(u){try{c(r.next(u))}catch(d){s(d)}}function l(u){try{c(r.throw(u))}catch(d){s(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(p){p(d)})).then(a,l)}c((r=r.apply(e,t||[])).next())})}function _s(e,t){var n,r,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(c){return function(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,d[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(p){d=[6,p],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}}function E3(e,t,n){if(n||arguments.length===2)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var Bae={exports:{}};function Nj(){}Nj.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var s=0,a=r.length;s<a;s++)r[s].fn!==t&&r[s].fn._!==t&&o.push(r[s]);return o.length?n[e]=o:delete n[e],this}},Bae.exports=Nj;var zae=Bae.exports.TinyEmitter=Nj,Fj=function(e){var t=e[1];return t!=null},W$t=function(e){var t=e.properties,n=t===void 0?{}:t,r=function(s,a){var l={};for(var c in s)Object.prototype.hasOwnProperty.call(s,c)&&a.indexOf(c)<0&&(l[c]=s[c]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var u=0;for(c=Object.getOwnPropertySymbols(s);u<c.length;u++)a.indexOf(c[u])<0&&Object.prototype.propertyIsEnumerable.call(s,c[u])&&(l[c[u]]=s[c[u]])}return l}(e,["properties"]),o=function(s){return Object.entries(s).sort(function(a,l){var c=a[0],u=l[0];return c.localeCompare(u,void 0)})};return JSON.stringify([o(r),o(n)])},KV=function(e){return Ps(void 0,void 0,void 0,function(){var t;return _s(this,function(n){switch(n.label){case 0:t=W$t(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(r=t,Ps(void 0,void 0,void 0,function(){var o,s,a,l,c;return _s(this,function(u){switch(u.label){case 0:if(o=typeof globalThis<"u"&&(!((l=globalThis.crypto)===null||l===void 0)&&l.subtle)?(c=globalThis.crypto)===null||c===void 0?void 0:c.subtle:void 0,typeof TextEncoder>"u"||!(o!=null&&o.digest)||typeof Uint8Array>"u")throw new Error("Hashing function not available");return s=new TextEncoder().encode(r),[4,o.digest("SHA-256",s)];case 1:return a=u.sent(),[2,Array.from(new Uint8Array(a)).map(function(d){return d.toString(16).padStart(2,"0")}).join("")]}})}))];case 2:return[2,n.sent()];case 3:return n.sent(),[2,t];case 4:return[2]}var r})})},Hae=function(e){var t,n=e.clientKey,r=e.appName,o=e.connectionId,s=e.customHeaders,a=e.headerName,l=a===void 0?"authorization":a,c=e.etag,u=e.isPost,d=((t={accept:"application/json"})[l.toLocaleLowerCase()]=n,t["unleash-sdk"]="unleash-js-sdk:3.8.0-beta.3",t["unleash-appname"]=r,t);return u&&(d["content-type"]="application/json"),c&&(d["if-none-match"]=c),Object.entries(s||{}).filter(Fj).forEach(function(p){var f=p[0],h=p[1];return d[f.toLocaleLowerCase()]=h}),d["unleash-connection-id"]=o,d},V$t=function(){},U$t=function(){function e(t){var n=t.onError,r=t.onSent,o=t.appName,s=t.metricsInterval,a=t.disableMetrics,l=a!==void 0&&a,c=t.url,u=t.clientKey,d=t.fetch,p=t.headerName,f=t.customHeaders,h=f===void 0?{}:f,m=t.metricsIntervalInitial,y=t.connectionId,b=t.metricRegistry;this.onError=n,this.onSent=r||V$t,this.disabled=l,this.metricsInterval=1e3*s,this.metricsIntervalInitial=1e3*m,this.appName=o,this.url=c instanceof URL?c:new URL(c),this.clientKey=u,this.bucket=this.createEmptyBucket(),this.fetch=d,this.headerName=p,this.customHeaders=h,this.connectionId=y,this.metricRegistry=b}return e.prototype.start=function(){var t=this;if(this.disabled)return!1;this.setupMetricsFlushOnPageUnload(),typeof this.metricsInterval=="number"&&this.metricsInterval>0&&(this.metricsIntervalInitial>0?setTimeout(function(){t.startTimer(),t.sendMetrics()},this.metricsIntervalInitial):this.startTimer())},e.prototype.stop=function(){this.timer&&(clearInterval(this.timer),delete this.timer),this.removeMetricsFlushOnPageUnload()},e.prototype.createEmptyBucket=function(){return{start:new Date,stop:null,toggles:{}}},e.prototype.getHeaders=function(){return Hae({clientKey:this.clientKey,appName:this.appName,connectionId:this.connectionId,customHeaders:this.customHeaders,headerName:this.headerName,isPost:!0})},e.prototype.sendMetrics=function(){return Ps(this,arguments,void 0,function(t){var n,r,o,s=(t===void 0?{}:t).fireAndForget,a=s!==void 0&&s;return _s(this,function(l){switch(l.label){case 0:if(n="".concat(this.url,"/client/metrics"),r=this.getPayload(),this.bucketIsEmpty(r)&&(!r.impactMetrics||r.impactMetrics.length===0))return[2];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.fetch(n,{cache:"no-cache",method:"POST",headers:this.getHeaders(),body:JSON.stringify(r),keepalive:a})];case 2:return l.sent(),this.onSent(r),[3,4];case 3:return o=l.sent(),console.error("Unleash: unable to send feature metrics",o),this.onError(o),[3,4];case 4:return[2]}})})},e.prototype.count=function(t,n){return!(this.disabled||!this.bucket)&&(this.assertBucket(t),this.bucket.toggles[t][n?"yes":"no"]++,!0)},e.prototype.countVariant=function(t,n){return!(this.disabled||!this.bucket)&&(this.assertBucket(t),this.bucket.toggles[t].variants[n]?this.bucket.toggles[t].variants[n]+=1:this.bucket.toggles[t].variants[n]=1,!0)},e.prototype.assertBucket=function(t){if(this.disabled||!this.bucket)return!1;this.bucket.toggles[t]||(this.bucket.toggles[t]={yes:0,no:0,variants:{}})},e.prototype.startTimer=function(){var t=this;this.timer=setInterval(function(){t.sendMetrics()},this.metricsInterval)},e.prototype.bucketIsEmpty=function(t){return Object.keys(t.bucket.toggles).length===0},e.prototype.getPayload=function(){var t,n=ho(ho({},this.bucket),{stop:new Date});this.bucket=this.createEmptyBucket();var r={bucket:n,appName:this.appName,instanceId:"browser"},o=((t=this.metricRegistry)===null||t===void 0?void 0:t.collect())||[];return r.impactMetrics=o,r},e.prototype.setupMetricsFlushOnPageUnload=function(){var t=this;typeof document>"u"||typeof window>"u"||typeof document.addEventListener!="function"||document.addEventListener("visibilitychange",this.flushMetricsOnPageUnload=function(){document.visibilityState==="hidden"&&t.sendMetrics({fireAndForget:!0})})},e.prototype.removeMetricsFlushOnPageUnload=function(){this.flushMetricsOnPageUnload&&(document.removeEventListener("visibilitychange",this.flushMetricsOnPageUnload),this.flushMetricsOnPageUnload=void 0)},e}(),Wae=function(){function e(){this.store=new Map}return e.prototype.save=function(t,n){return Ps(this,void 0,void 0,function(){return _s(this,function(r){return this.store.set(t,n),[2]})})},e.prototype.get=function(t){return Ps(this,void 0,void 0,function(){return _s(this,function(n){return[2,this.store.get(t)]})})},e}(),Vae=function(){function e(t){t===void 0&&(t="unleash:repository"),this.prefix=t}return e.prototype.save=function(t,n){return Ps(this,void 0,void 0,function(){var r,o;return _s(this,function(s){r=JSON.stringify(n),o="".concat(this.prefix,":").concat(t);try{window.localStorage.setItem(o,r)}catch(a){console.error(a)}return[2]})})},e.prototype.get=function(t){try{var n="".concat(this.prefix,":").concat(t),r=window.localStorage.getItem(n);return r?JSON.parse(r):void 0}catch(o){console.error(o)}},e}();let hv;const G$t=new Uint8Array(16);function q$t(){if(!hv&&(hv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hv))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hv(G$t)}const Rs=[];for(let e=0;e<256;++e)Rs.push((e+256).toString(16).slice(1));var XV={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Y$t(e,t,n){if(XV.randomUUID&&!t&&!e)return XV.randomUUID();const r=(e=e||{}).random||(e.rng||q$t)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(o,s=0){return Rs[o[s+0]]+Rs[o[s+1]]+Rs[o[s+2]]+Rs[o[s+3]]+"-"+Rs[o[s+4]]+Rs[o[s+5]]+"-"+Rs[o[s+6]]+Rs[o[s+7]]+"-"+Rs[o[s+8]]+Rs[o[s+9]]+"-"+Rs[o[s+10]]+Rs[o[s+11]]+Rs[o[s+12]]+Rs[o[s+13]]+Rs[o[s+14]]+Rs[o[s+15]]}(r)}var K$t=function(){function e(){}return e.prototype.generateEventId=function(){return Y$t()},e.prototype.createImpressionEvent=function(t,n,r,o,s,a){var l=this.createBaseEvent(t,n,r,o,s);return a?ho(ho({},l),{variant:a}):l},e.prototype.createBaseEvent=function(t,n,r,o,s){return{eventType:o,eventId:this.generateEventId(),context:t,enabled:n,featureName:r,impressionData:s}},e}();function Uae(e){return e!==void 0&&!Number.isFinite(e)}function Bj(e){return e?Object.keys(e).sort().map(function(t){return"".concat(t,"=").concat(e[t])}).join(","):""}function Gae(e){var t={};if(!e)return t;for(var n=0,r=e.split(",");n<r.length;n++){var o=r[n].split("="),s=o[0],a=o[1];t[s]=a}return t}var X$t=function(e){return"value"in e},JV=function(e){return"buckets"in e},J$t=function(){function e(t){this.opts=t,this.values=new Map}return e.prototype.inc=function(t,n){var r;if(!Uae(t)){var o=t??1;if(!(o<=0)){var s=Bj(n),a=(r=this.values.get(s))!==null&&r!==void 0?r:0;this.values.set(s,a+o)}}},e.prototype.collect=function(){var t=Array.from(this.values.entries()).map(function(n){var r=n[0],o=n[1];return{labels:Gae(r),value:o}});return this.values.clear(),t.length===0&&t.push({labels:{},value:0}),{name:this.opts.name,help:this.opts.help,type:"counter",samples:t}},e}(),Z$t=function(){function e(t){this.opts=t,this.values=new Map;var n=t.buckets&&t.buckets.length>0?t.buckets:[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10],r=Array.from(new Set(n.filter(function(o){return o!==1/0}))).sort(function(o,s){return o-s});this.buckets=E3(E3([],r,!0),[1/0],!1)}return e.prototype.restore=function(t){var n=Bj(t.labels),r={count:t.count,sum:t.sum,buckets:new Map(t.buckets.map(function(o){return[o.le==="+Inf"?1/0:o.le,o.count]}))};this.values.set(n,r)},e.prototype.observe=function(t,n){var r;if(!Uae(t)){var o=Bj(n),s=this.values.get(o);if(!s){for(var a=new Map,l=0,c=this.buckets;l<c.length;l++){var u=c[l];a.set(u,0)}s={count:0,sum:0,buckets:a},this.values.set(o,s)}s.count++,s.sum+=t;for(var d=0,p=this.buckets;d<p.length;d++)if(t<=(u=p[d])){var f=(r=s.buckets.get(u))!==null&&r!==void 0?r:0;s.buckets.set(u,f+1)}}},e.prototype.collect=function(){var t=Array.from(this.values.entries()).map(function(n){var r=n[0],o=n[1];return{labels:Gae(r),count:o.count,sum:o.sum,buckets:Array.from(o.buckets.entries()).map(function(s){var a=s[0];return{le:a===1/0?"+Inf":a,count:s[1]}})}});return this.values.clear(),t.length===0&&t.push({labels:{},count:0,sum:0,buckets:this.buckets.map(function(n){return{le:n===1/0?"+Inf":n,count:0}})}),{name:this.opts.name,help:this.opts.help,type:"histogram",samples:t}},e}(),Q$t=function(){function e(){this.counters=new Map,this.histograms=new Map}return e.prototype.getCounter=function(t){return this.counters.get(t)},e.prototype.getHistogram=function(t){return this.histograms.get(t)},e.prototype.counter=function(t){var n=t.name,r=this.counters.get(n);return r||(r=new J$t(t),this.counters.set(n,r)),r},e.prototype.histogram=function(t){var n=t.name,r=this.histograms.get(n);return r||(r=new Z$t(t),this.histograms.set(n,r)),r},e.prototype.collect=function(){var t=Array.from(this.counters.values()).map(function(o){return o.collect()}),n=Array.from(this.histograms.values()).map(function(o){return o.collect()}),r=E3(E3([],t,!0),n,!0).filter(function(o){return o.samples.length>0});return r.length>0?r:[]},e.prototype.restore=function(t){for(var n=function(a){switch(a.type){case"counter":for(var l=r.counter({name:a.name,help:a.help}),c=0,u=a.samples;c<u.length;c++){var d=u[c];X$t(d)&&l.inc(d.value,d.labels)}break;case"histogram":var p=a.samples.find(JV);if(p){var f=p.buckets.map(function(m){return m.le==="+Inf"?1/0:m.le}),h=r.histogram({name:a.name,help:a.help,buckets:f});a.samples.filter(JV).forEach(function(m){h.restore(m)})}}},r=this,o=0,s=t;o<s.length;o++)n(s[o])},e}(),xs={INIT:"initialized",ERROR:"error",READY:"ready",UPDATE:"update",IMPRESSION:"impression",SENT:"sent",RECOVERED:"recovered",WARN:"warn"},eDt=function(e){function t(n,r,o){var s=e.call(this)||this;return s.metricRegistry=n,s.appName=r,s.environment=o,s}return Fae(t,e),t.prototype.defineCounter=function(n,r){n&&r?this.metricRegistry.counter({name:n,help:r,labelNames:["featureName","appName","environment"]}):this.emit(xs.WARN,"Counter name or help cannot be empty: ".concat(n,", ").concat(r,"."))},t.prototype.defineHistogram=function(n,r,o){n&&r?this.metricRegistry.histogram({name:n,help:r,labelNames:["featureName","appName","environment"],buckets:o}):this.emit(xs.WARN,"Histogram name or help cannot be empty: ".concat(n,", ").concat(r,"."))},t.prototype.incrementCounter=function(n,r){var o=this.metricRegistry.getCounter(n);if(o){var s={appName:this.appName,environment:this.environment};o.inc(r,s)}else this.emit(xs.WARN,"Counter ".concat(n," not defined, this counter will not be incremented."))},t.prototype.observeHistogram=function(n,r){var o=this.metricRegistry.getHistogram(n);if(o){var s={appName:this.appName,environment:this.environment};o.observe(r,s)}else this.emit(xs.WARN,"Histogram ".concat(n," not defined, this histogram will not be updated."))},t}(zae),tDt=["userId","sessionId","remoteAddress","currentTime"],ZV=function(e){return tDt.includes(e)},nDt="isEnabled",rDt="getVariant",oDt={name:"disabled",enabled:!1,feature_enabled:!1},CC="repo",QV="repoLastUpdateTimestamp",sDt=function(){try{if(typeof window<"u"&&"fetch"in window)return fetch.bind(window);if("fetch"in globalThis)return fetch.bind(globalThis)}catch(e){console.error('Unleash failed to resolve "fetch"',e)}},qae=function(e){function t(n){var r,o=n.storageProvider,s=n.url,a=n.clientKey,l=n.disableRefresh,c=l!==void 0&&l,u=n.refreshInterval,d=u===void 0?30:u,p=n.metricsInterval,f=p===void 0?30:p,h=n.metricsIntervalInitial,m=h===void 0?2:h,y=n.disableMetrics,b=y!==void 0&&y,x=n.appName,C=n.environment,w=C===void 0?"default":C,j=n.context,k=n.fetch,S=k===void 0?sDt():k,E=n.createAbortController,T=E===void 0?function(){try{if(typeof window<"u"&&"AbortController"in window)return function(){return new window.AbortController};if("fetch"in globalThis)return function(){return new globalThis.AbortController}}catch(oe){console.error('Unleash failed to resolve "AbortController" factory',oe)}}():E,R=n.bootstrap,_=n.bootstrapOverride,M=_===void 0||_,$=n.headerName,z=$===void 0?"Authorization":$,A=n.customHeaders,O=A===void 0?{}:A,L=n.impressionDataAll,B=L!==void 0&&L,H=n.usePOSTrequests,N=H!==void 0&&H,I=n.experimental,q=e.call(this)||this;if(q.toggles=[],q.etag="",q.readyEventEmitted=!1,q.fetchedFromServer=!1,q.usePOSTrequests=!1,q.started=!1,!s)throw new Error("url is required");if(!a)throw new Error("clientKey is required");if(!x)throw new Error("appName is required.");q.eventsHandler=new K$t,q.impressionDataAll=B,q.toggles=R&&R.length>0?R:[],q.url=s instanceof URL?s:new URL(s),q.clientKey=a,q.headerName=z,q.customHeaders=O,q.storage=o||(typeof window<"u"?new Vae:new Wae),q.refreshInterval=c?0:1e3*d,q.context=ho({appName:x,environment:w},j),q.usePOSTrequests=N,q.sdkState="initializing";var ne=I==null?void 0:I.metricsUrl;!ne||ne instanceof URL||(ne=new URL(ne)),q.experimental=ho(ho({},I),{metricsUrl:ne}),I!=null&&I.togglesStorageTTL&&(I==null?void 0:I.togglesStorageTTL)>0&&(q.experimental.togglesStorageTTL=1e3*I.togglesStorageTTL),q.lastRefreshTimestamp=0,q.ready=new Promise(function(oe){q.init().then(oe).catch(function(se){console.error(se),q.sdkState="error",q.emit(xs.ERROR,se),q.lastError=se,oe()})}),S||console.error('Unleash: You must either provide your own "fetch" implementation or run in an environment where "fetch" is available.'),T||console.error('Unleash: You must either provide your own "AbortController" implementation or run in an environment where "AbortController" is available.'),q.fetch=S,q.createAbortController=T,q.bootstrap=R&&R.length>0?R:void 0,q.bootstrapOverride=M,q.connectionId="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(oe){var se=16*Math.random()|0;return(oe==="x"?se:3&se|8).toString(16)}),q.metricRegistry=new Q$t;var V=q.resolveEnvironment(a,w);return q.impactMetrics=new eDt(q.metricRegistry,x,V),q.metrics=new U$t({onError:function(oe){return q.emit(xs.ERROR,{type:"metrics",error:oe})},onSent:q.emit.bind(q,xs.SENT),appName:x,metricsInterval:f,disableMetrics:b,url:((r=q.experimental)===null||r===void 0?void 0:r.metricsUrl)||q.url,clientKey:a,fetch:S,headerName:z,customHeaders:O,metricsIntervalInitial:m,connectionId:q.connectionId,metricRegistry:q.metricRegistry}),q}return Fae(t,e),t.prototype.getAllToggles=function(){return E3([],this.toggles,!0)},t.prototype.isEnabled=function(n){var r,o=this.toggles.find(function(l){return l.name===n}),s=!!o&&o.enabled;if(this.metrics.count(n,s),(o==null?void 0:o.impressionData)||this.impressionDataAll){var a=this.eventsHandler.createImpressionEvent(this.context,s,n,nDt,(r=o==null?void 0:o.impressionData)!==null&&r!==void 0?r:void 0);this.emit(xs.IMPRESSION,a)}return s},t.prototype.getVariant=function(n){var r,o=this.toggles.find(function(c){return c.name===n}),s=(o==null?void 0:o.enabled)||!1,a=o?o.variant:oDt;if(a.name&&this.metrics.countVariant(n,a.name),this.metrics.count(n,s),(o==null?void 0:o.impressionData)||this.impressionDataAll){var l=this.eventsHandler.createImpressionEvent(this.context,s,n,rDt,(r=o==null?void 0:o.impressionData)!==null&&r!==void 0?r:void 0,a.name);this.emit(xs.IMPRESSION,l)}return ho(ho({},a),{feature_enabled:s})},t.prototype.updateToggles=function(){return Ps(this,void 0,void 0,function(){var n=this;return _s(this,function(r){switch(r.label){case 0:return this.timerRef||this.fetchedFromServer?[4,this.fetchToggles()]:[3,2];case 1:return r.sent(),[3,4];case 2:return this.started?[4,new Promise(function(o){var s=function(){n.fetchToggles().then(function(){n.off(xs.READY,s),o()})};n.once(xs.READY,s)})]:[3,4];case 3:r.sent(),r.label=4;case 4:return[2]}})})},t.prototype.updateContext=function(n){return Ps(this,void 0,void 0,function(){var r;return _s(this,function(o){switch(o.label){case 0:return(n.appName||n.environment)&&this.emit(xs.WARN,"appName and environment are static. They can't be updated with updateContext."),r={environment:this.context.environment,appName:this.context.appName,sessionId:this.context.sessionId},this.context=ho(ho({},r),n),[4,this.updateToggles()];case 1:return o.sent(),[2]}})})},t.prototype.getContext=function(){return ho({},this.context)},t.prototype.setContextField=function(n,r){return Ps(this,void 0,void 0,function(){var o,s,a;return _s(this,function(l){switch(l.label){case 0:return ZV(n)?this.context=ho(ho({},this.context),((s={})[n]=r,s)):(o=ho(ho({},this.context.properties),((a={})[n]=r,a)),this.context=ho(ho({},this.context),{properties:o})),[4,this.updateToggles()];case 1:return l.sent(),[2]}})})},t.prototype.removeContextField=function(n){return Ps(this,void 0,void 0,function(){var r;return _s(this,function(o){switch(o.label){case 0:return ZV(n)?this.context=ho(ho({},this.context),((r={})[n]=void 0,r)):typeof this.context.properties=="object"&&delete this.context.properties[n],[4,this.updateToggles()];case 1:return o.sent(),[2]}})})},t.prototype.setReady=function(){this.readyEventEmitted=!0,this.emit(xs.READY)},t.prototype.init=function(){return Ps(this,void 0,void 0,function(){var n,r,o;return _s(this,function(s){switch(s.label){case 0:return[4,this.resolveSessionId()];case 1:return n=s.sent(),this.context=ho({sessionId:n},this.context),[4,this.storage.get(CC)];case 2:return r=s.sent()||[],o=this,[4,this.getLastRefreshTimestamp()];case 3:return o.lastRefreshTimestamp=s.sent(),!this.bootstrap||!this.bootstrapOverride&&r.length!==0?[3,6]:[4,this.storage.save(CC,this.bootstrap)];case 4:return s.sent(),this.toggles=this.bootstrap,this.sdkState="healthy",[4,this.storeLastRefreshTimestamp()];case 5:return s.sent(),this.setReady(),[3,7];case 6:this.toggles=r,s.label=7;case 7:return this.sdkState="healthy",this.emit(xs.INIT),[2]}})})},t.prototype.start=function(){return Ps(this,void 0,void 0,function(){var n,r=this;return _s(this,function(o){switch(o.label){case 0:return this.started=!0,this.timerRef?(console.error("Unleash SDK has already started, if you want to restart the SDK you should call client.stop() before starting again."),[2]):[4,this.ready];case 1:return o.sent(),this.metrics.start(),n=this.refreshInterval,[4,this.initialFetchToggles()];case 2:return o.sent(),n>0&&(this.timerRef=setInterval(function(){return r.fetchToggles()},n)),[2]}})})},t.prototype.stop=function(){this.timerRef&&(clearInterval(this.timerRef),this.timerRef=void 0),this.metrics.stop()},t.prototype.isReady=function(){return this.readyEventEmitted},t.prototype.getError=function(){return this.sdkState==="error"?this.lastError:void 0},t.prototype.sendMetrics=function(){return this.metrics.sendMetrics()},t.prototype.resolveSessionId=function(){return Ps(this,void 0,void 0,function(){var n;return _s(this,function(r){switch(r.label){case 0:return this.context.sessionId?[2,this.context.sessionId]:[4,this.storage.get("sessionId")];case 1:return(n=r.sent())?[3,3]:(n=Math.floor(1e9*Math.random()),[4,this.storage.save("sessionId",n.toString(10))]);case 2:r.sent(),r.label=3;case 3:return[2,n.toString(10)]}})})},t.prototype.getHeaders=function(){return Hae({clientKey:this.clientKey,connectionId:this.connectionId,appName:this.context.appName,customHeaders:this.customHeaders,headerName:this.headerName,etag:this.etag,isPost:this.usePOSTrequests})},t.prototype.storeToggles=function(n){return Ps(this,void 0,void 0,function(){return _s(this,function(r){switch(r.label){case 0:return this.toggles=n,this.emit(xs.UPDATE),[4,this.storage.save(CC,n)];case 1:return r.sent(),[2]}})})},t.prototype.isTogglesStorageTTLEnabled=function(){var n;return!!(!((n=this.experimental)===null||n===void 0)&&n.togglesStorageTTL&&this.experimental.togglesStorageTTL>0)},t.prototype.isUpToDate=function(){var n;if(!this.isTogglesStorageTTLEnabled())return!1;var r=Date.now(),o=((n=this.experimental)===null||n===void 0?void 0:n.togglesStorageTTL)||0;return this.lastRefreshTimestamp>0&&this.lastRefreshTimestamp<=r&&r-this.lastRefreshTimestamp<=o},t.prototype.getLastRefreshTimestamp=function(){return Ps(this,void 0,void 0,function(){var n,r;return _s(this,function(o){switch(o.label){case 0:return this.isTogglesStorageTTLEnabled()?[4,this.storage.get(QV)]:[3,3];case 1:return n=o.sent(),[4,KV(this.context)];case 2:return r=o.sent(),[2,(n==null?void 0:n.key)===r?n.timestamp:0];case 3:return[2,0]}})})},t.prototype.storeLastRefreshTimestamp=function(){return Ps(this,void 0,void 0,function(){var n,r;return _s(this,function(o){switch(o.label){case 0:return this.isTogglesStorageTTLEnabled()?(this.lastRefreshTimestamp=Date.now(),r={},[4,KV(this.context)]):[3,3];case 1:return r.key=o.sent(),r.timestamp=this.lastRefreshTimestamp,n=r,[4,this.storage.save(QV,n)];case 2:o.sent(),o.label=3;case 3:return[2]}})})},t.prototype.initialFetchToggles=function(){if(!this.isUpToDate())return this.fetchToggles();this.fetchedFromServer||(this.fetchedFromServer=!0,this.setReady())},t.prototype.fetchToggles=function(){return Ps(this,void 0,void 0,function(){var n,r,o,s,a,l,c,u,d;return _s(this,function(p){switch(p.label){case 0:if(!this.fetch)return[3,9];this.abortController&&!this.abortController.signal.aborted&&this.abortController.abort(),this.abortController=(d=this.createAbortController)===null||d===void 0?void 0:d.call(this),n=this.abortController?this.abortController.signal:void 0,p.label=1;case 1:return p.trys.push([1,7,8,9]),r=this.usePOSTrequests,o=r?this.url:function(f,h){var m=new URL(f.toString());return Object.entries(h).filter(Fj).forEach(function(y){var b=y[0],x=y[1];b==="properties"&&x?Object.entries(x).filter(Fj).forEach(function(C){var w=C[0],j=C[1];return m.searchParams.append("properties[".concat(w,"]"),j)}):m.searchParams.append(b,x)}),m}(this.url,this.context),s=r?"POST":"GET",a=r?JSON.stringify({context:this.context}):void 0,[4,this.fetch(o.toString(),{method:s,cache:"no-cache",headers:this.getHeaders(),body:a,signal:n})];case 2:return l=p.sent(),this.sdkState==="error"&&l.status<400&&(this.sdkState="healthy",this.emit(xs.RECOVERED)),l.ok?(this.etag=l.headers.get("ETag")||"",[4,l.json()]):[3,5];case 3:return c=p.sent(),[4,this.storeToggles(c.toggles)];case 4:return p.sent(),this.sdkState!=="healthy"&&(this.sdkState="healthy"),this.fetchedFromServer||(this.fetchedFromServer=!0,this.setReady()),this.storeLastRefreshTimestamp(),[3,6];case 5:l.status===304?this.storeLastRefreshTimestamp():(console.error("Unleash: Fetching feature toggles did not have an ok response"),this.sdkState="error",this.emit(xs.ERROR,{type:"HttpError",code:l.status}),this.lastError={type:"HttpError",code:l.status}),p.label=6;case 6:return[3,9];case 7:return typeof(u=p.sent())=="object"&&u!==null&&"name"in u&&u.name==="AbortError"||(console.error("Unleash: unable to fetch feature toggles",u),this.sdkState="error",this.emit(xs.ERROR,{type:"fetch-toggles",error:u}),this.lastError=u),[3,9];case 8:return this.abortController=null,[7];case 9:return[2]}})})},t.prototype.resolveEnvironment=function(n,r){return function(o){var s=o.indexOf(":");if(s!==-1){var a=o.slice(s+1),l=a.lastIndexOf(".");if(l!==-1)return a.slice(0,l)}}(n)||r},t}(zae);const Yae=tt.createContext(null),iDt={bootstrap:[],disableRefresh:!0,disableMetrics:!0,url:"http://localhost",appName:"offline",clientKey:"not-used"},aDt="startTransition",lDt=tt[aDt]||(e=>e()),cDt=({config:e,children:t,unleashClient:n,startClient:r=!0,stopClient:o=!0,startTransition:s=lDt})=>{var a,l,c;const u=e||iDt,d=tt.useRef(n||new qae(u)),[p,f]=tt.useState(!!(n?e!=null&&e.bootstrap&&(e==null?void 0:e.bootstrapOverride)!==!1||(a=n.isReady)!=null&&a.call(n):u.bootstrap&&u.bootstrapOverride!==!1)),[h,m]=g.useState(((c=(l=d.current).getError)==null?void 0:c.call(l))||null);g.useEffect(()=>{!u&&!n&&console.error(`You must provide either a config or an unleash client to the flag provider.
512
512
  If you are initializing the client in useEffect, you can avoid this warning
513
- by checking if the client exists before rendering.`);const b=j=>{s(()=>{m(k=>k||j)})},x=j=>{s(()=>{m(null)})};let C=null;const w=()=>{C=setTimeout(()=>{s(()=>{f(!0)})},0)};return d.current.on("ready",w),d.current.on("error",b),d.current.on("recovered",x),r&&(d.current.stop(),d.current.start()),function(){d.current&&(d.current.off("error",b),d.current.off("ready",w),d.current.off("recovered",x),o&&d.current.stop()),C&&clearTimeout(C)}},[]);const y=g.useMemo(()=>({on:(...b)=>d.current.on(...b),off:(...b)=>d.current.off(...b),isEnabled:(...b)=>d.current.isEnabled(...b),updateContext:async(...b)=>await d.current.updateContext(...b),getVariant:(...b)=>d.current.getVariant(...b),client:d.current,flagsReady:p,flagsError:h,setFlagsReady:f,setFlagsError:m}),[p,h]);return tt.createElement(Yae.Provider,{value:y},t)},Kae={on:(e,t,n)=>(console.error("on() must be used within a FlagProvider"),zj),off:(e,t)=>(console.error("off() must be used within a FlagProvider"),zj),updateContext:async()=>{console.error("updateContext() must be used within a FlagProvider")},isEnabled:()=>(console.error("isEnabled() must be used within a FlagProvider"),!1),getVariant:()=>(console.error("getVariant() must be used within a FlagProvider"),{name:"disabled",enabled:!1})},zj={...Kae,toggles:[],impressionDataAll:{},context:{},storage:{},start:()=>{},stop:()=>{},isReady:()=>!1,getError:()=>null,getAllToggles:()=>[]},uDt={...Kae,client:zj,flagsReady:!1,setFlagsReady:()=>{console.error("setFlagsReady() must be used within a FlagProvider")},flagsError:null,setFlagsError:()=>{console.error("setFlagsError() must be used within a FlagProvider")}};function Xae(){return g.useContext(Yae)||(console.error("useFlagContext() must be used within a FlagProvider"),uDt)}const Jae=e=>{const{isEnabled:t,client:n}=Xae(),[r,o]=g.useState(!!t(e)),s=g.useRef();return s.current=r,g.useEffect(()=>{if(!n)return;const a=()=>{const c=t(e);c!==s.current&&(s.current=c,o(!!c))},l=()=>{const c=t(e);s.current=c,o(c)};return n.on("update",a),n.on("ready",l),()=>{n.off("update",a),n.off("ready",l)}},[n]),r},dDt=()=>{const{client:e}=Xae();return e},gv=(e,t)=>{const n=dDt();return g.useEffect(()=>{var o;(o=n==null?void 0:n.impactMetrics)==null||o.defineCounter(e,t)},[n,e,t]),{increment:g.useCallback(o=>{var s;(s=n==null?void 0:n.impactMetrics)==null||s.incrementCounter(e,o)},[n,e])}},mv="Tracks user journey from flag page accordion through impact chart creation",pDt=()=>{const{increment:e}=gv("flagpage_funnel_accordion_opened",mv),{increment:t}=gv("flagpage_funnel_modal_opened",mv),{increment:n}=gv("flagpage_funnel_docs_clicked",mv),{increment:r}=gv("flagpage_funnel_metric_saved",mv);return{trackAccordionOpened:()=>e(),trackAddMetricClicked:()=>t(),trackDocsClicked:()=>n(),trackMetricSaved:()=>r()}},fDt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{registerImpactMetric:g.useCallback(async s=>{const a=t("api/admin/impact-metrics/register",{method:"POST",body:JSON.stringify(s)},"registerImpactMetric");return e(a.caller,a.id)},[e,t]),errors:n,loading:r}},hDt=v("form")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(2)})),eU=v(rX)(({theme:e})=>({color:e.palette.text.primary,marginBottom:e.spacing(1)})),gDt=v("div")(({theme:e})=>({display:"flex",alignItems:"flex-start",padding:e.spacing(2),background:e.palette.background.default,gap:"11px",border:`1.5px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusLarge,transition:"border-color 0.3s",position:"relative",":hover, :focus-within":{borderColor:e.palette.primary.main},label:{textTransform:"capitalize",fontWeight:"bold","::before":{content:"''",position:"absolute",inset:0,zIndex:1}}})),wC=({value:e,description:t,examples:n})=>{const r=g.useId(),o=g.useId(),s=g.useId();return i.jsxs(gDt,{children:[i.jsx(el,{sx:{padding:0},id:r,value:e,"aria-describedby":`${o} ${s}`}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:r,children:e}),i.jsx(J,{id:o,children:t}),i.jsxs(J,{variant:"body2",color:"text.secondary",sx:{mt:1},id:s,children:["Examples: ",n]})]})]})},mDt=v(K3)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),yDt=({formId:e,onSubmitted:t})=>{const n="counter",[r,o]=g.useState(""),[s,a]=g.useState(n),{registerImpactMetric:l,loading:c}=fDt(),u=g.useId(),d=g.useId(),p=async f=>{f.preventDefault(),!c&&(await l({name:r.trim(),type:s}),t(r.trim()))};return i.jsxs(hDt,{id:e,onSubmit:p,children:[i.jsxs(Ko,{children:[i.jsx(eU,{htmlFor:u,children:"Metric name"}),i.jsx(xn,{id:u,value:r,onChange:f=>o(f.target.value),inputProps:{pattern:"^[a-zA-Z_:][a-zA-Z0-9_:]*$",title:"The name must contain only alphanumeric characters, underscores, and colons. It must start with a letter."},placeholder:"e.g., checkout_error_count",variant:"outlined",size:"small",fullWidth:!0,required:!0,helperText:"Use letters, numbers, colons, and underscores. Be descriptive and specific.",sx:{".MuiFormHelperText-root":{marginInline:0}}})]}),i.jsxs(Ko,{children:[i.jsx(eU,{htmlFor:d,children:"Metric type"}),i.jsxs(mDt,{onChange:f=>a(f.target.value),id:d,defaultValue:n,name:"metricType",children:[i.jsx(wC,{value:"counter",description:"Tracks values that only increase (e.g., error counts, request counts)",examples:"client_error_count, total_purchases"}),i.jsx(wC,{value:"gauge",description:"Tracks values that can go up or down (e.g., active users, queue size",examples:"active_connections, memory_usage"}),i.jsx(wC,{value:"histogram",description:"Tracks the distribution of values, (e.g., response times, payload sizes)",examples:"request_duration_ms, payload_size_bytes"})]})]})]})},xDt=({metricName:e})=>i.jsxs(K,{sx:{display:"flex",flexDirection:"column",gap:3},children:[i.jsxs(K,{children:[i.jsx(J,{variant:"h2",sx:{mb:1},children:"Metric registered"}),i.jsxs(J,{variant:"body2",color:"text.secondary",children:["Your impact metric"," ",i.jsx(J,{component:"span",variant:"body2",fontWeight:"bold",children:e})," ","has been created. Your impact metrics will be available in a few seconds."]})]}),i.jsxs(K,{children:[i.jsx(J,{variant:"body2",fontWeight:"bold",sx:{mb:1},children:"Implement in your code"}),i.jsxs(J,{variant:"body2",color:"text.secondary",children:["To start collecting data, you need to implement the metric in your application code using one of our SDKs."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",children:"View the documentation"})," ","for setup instructions."]})]})]});var OO={},vDt=je;Object.defineProperty(OO,"__esModule",{value:!0});var Zae=OO.default=void 0,bDt=vDt(Ee()),CDt=i,wDt=(0,bDt.default)((0,CDt.jsx)("path",{d:"M7 20h4c0 1.1-.9 2-2 2s-2-.9-2-2zm-2-1h8v-2H5v2zm11.5-9.5c0 3.82-2.66 5.86-3.77 6.5H5.27c-1.11-.64-3.77-2.68-3.77-6.5C1.5 5.36 4.86 2 9 2s7.5 3.36 7.5 7.5zm-2 0C14.5 6.47 12.03 4 9 4S3.5 6.47 3.5 9.5c0 2.47 1.49 3.89 2.35 4.5h6.3c.86-.61 2.35-2.03 2.35-4.5zm6.87-2.13L20 8l1.37.63L22 10l.63-1.37L24 8l-1.37-.63L22 6l-.63 1.37zM19 6l.94-2.06L22 3l-2.06-.94L19 0l-.94 2.06L16 3l2.06.94L19 6z"}),"TipsAndUpdatesOutlined");Zae=OO.default=wDt;const SDt=v(K)(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(6),minWidth:"300px",maxWidth:"350px",display:"flex",flexDirection:"column",gap:e.spacing(3)})),yv=v(J)(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize})),tU=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.contrastText,fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(1)})),nU={fontSize:"1.2rem"},jDt=()=>i.jsxs(SDt,{children:[i.jsxs(K,{children:[i.jsxs(tU,{children:[i.jsx(yi,{sx:nU}),"What are impact metrics?"]}),i.jsx(yv,{children:"Impact metrics are numerical measurements that track the impact of your feature flags. They help you understand if a feature is performing as expected and can be set up to trigger automated safeguards when issues arise."})]}),i.jsx(pr,{sx:{borderColor:"rgba(255,255,255,0.2)"}}),i.jsxs(K,{children:[i.jsxs(tU,{children:[i.jsx(Zae,{sx:nU}),"Best practices"]}),i.jsxs(Ri,{dense:!0,disablePadding:!0,sx:{pl:2},children:[i.jsx(Or,{disableGutters:!0,sx:{display:"list-item",listStyleType:"disc",p:0},children:i.jsx(yv,{children:"Use descriptive, specific names that indicate what you're measuring"})}),i.jsx(Or,{disableGutters:!0,sx:{display:"list-item",listStyleType:"disc",p:0},children:i.jsx(yv,{children:"Choose the metric type that matches how the value changes over time"})}),i.jsx(Or,{disableGutters:!0,sx:{display:"list-item",listStyleType:"disc",p:0},children:i.jsx(yv,{children:"Track both positive indicators (success) and negative indicators (errors)"})})]})]}),i.jsx(pr,{sx:{borderColor:"rgba(255,255,255,0.2)"}}),i.jsxs(Sn,{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",sx:{color:"primary.contrastText",display:"flex",alignItems:"center",gap:.5,fontSize:"body2.fontSize"},children:["View full documentation",i.jsx(Hp,{sx:{fontSize:"1rem"}})]})]}),EDt=v(Fp)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:e.spacing(170),width:"100%",backgroundColor:"transparent",flexDirection:"row"},padding:0})),kDt=v("div")(({theme:e})=>({minHeight:"min(718px, 100vh)",maxHeight:"100vh",flex:"auto",backgroundColor:e.palette.background.paper,display:"grid",gridTemplateRows:"1fr auto",'&:has(form:invalid) button[type="submit"]':{color:e.palette.action.disabled,backgroundColor:e.palette.action.disabledBackground,cursor:"auto",boxShadow:"none"}})),TDt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:e.spacing(4,6,4,6),h3:{marginBlockEnd:e.spacing(1)},h4:{marginBlockEnd:e.spacing(.5)}})),RDt=v("div")(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,display:"flex",justifyContent:"flex-end",gap:e.spacing(3),alignItems:"center",padding:e.spacing(2,6)})),ADt=({onClose:e})=>{const t=Bt(),n=Nn(t.breakpoints.up("lg")),[r,o]=g.useState("define"),[s,a]=g.useState(""),l=g.useId(),c=r==="define";return i.jsxs(EDt,{open:!0,onClose:e,children:[i.jsxs(kDt,{children:[i.jsxs(TDt,{children:[i.jsxs("div",{children:[i.jsx(J,{variant:"h1",component:"h3",children:"Create an impact metric"}),i.jsxs(J,{variant:"body2",color:"text.secondary",children:["Follow this setup guide to implement and verify your impact metric."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",children:"View docs"})," ","for alternative ways to set it up."]})]}),c?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx(J,{variant:"h3",component:"h4",children:"Define your metric"}),i.jsx(J,{variant:"body2",color:"text.secondary",children:"Start by choosing a name and type for your metric. This will help you track the right data for your feature flags."})]}),i.jsx(yDt,{formId:l,onSubmitted:u=>{a(u),o("success")}})]}):i.jsx(xDt,{metricName:s})]}),i.jsx(RDt,{children:c?i.jsxs(i.Fragment,{children:[i.jsx($e,{variant:"text",color:"inherit",onClick:e,children:"Cancel"}),i.jsx($e,{form:l,type:"submit",variant:"contained",children:"Next step"})]}):i.jsx($e,{variant:"contained",onClick:e,children:"Done"})})]}),n?i.jsx(jDt,{}):null]})},PDt=({open:e,...t})=>e?i.jsx(ADt,{...t}):null,Qae=(e,t,n)=>e.name===t&&e.source===(n??"internal"),_Dt=({onRegisterClick:e})=>{const{trackEvent:t}=zt(),{trackDocsClicked:n}=pDt(),r=e?{onClick:()=>{t("impact-metrics",{props:{eventType:"No option setup form opened"}}),e()}}:{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",onClick:()=>{t("impact-metrics",{props:{eventType:"No options docs clicked"}}),n()}};return i.jsxs(K,{sx:{display:"flex",flexDirection:"column",gap:1},children:[i.jsx(J,{variant:"body2",fontWeight:"bold",children:"No impact metrics found"}),i.jsx(J,{variant:"body2",color:"text.secondary",children:"Impact metrics need to be implemented in your code before they can be used in safeguards."}),i.jsx($e,{variant:"contained",size:"small",sx:{alignSelf:"flex-start",mt:1},...r,children:"Set up your first metric"})]})},IDt=(e,t,n)=>{if(t&&!e.some(r=>Qae(r,t,n))){const r={name:t,displayName:t,help:"",source:n??"internal"};return n==="external"?[...e,r]:[r,...e]}return e},ODt=e=>e==="external"?"External metrics":"Internal metrics",MDt=({value:e,valueSource:t,onChange:n,options:r,loading:o=!1,label:s="Metric name"})=>{const a=IDt(r,e,t),l=Er("registerImpactMetrics"),[c,u]=g.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(Zl,{options:a,groupBy:d=>ODt(d.source),getOptionLabel:d=>d.displayName,value:a.find(d=>Qae(d,e,t))||null,onChange:(d,p)=>{const f=p||r[0];n({metricName:(f==null?void 0:f.name)||"",source:f==null?void 0:f.source})},disabled:o,renderOption:(d,p,{inputValue:f})=>g.createElement(K,{component:"li",...d,key:`${p.source}__${p.name}`},i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(J,{variant:"body2",children:i.jsx(Pr,{search:f,children:p.displayName})}),i.jsx(J,{variant:"caption",color:"text.secondary",children:i.jsx(Pr,{search:f,children:p.help})})]})),renderInput:d=>i.jsx(xn,{...d,label:s,placeholder:"Search for a metric…",variant:"outlined",size:"small",required:!0}),noOptionsText:i.jsx(_Dt,{onRegisterClick:l?()=>u(!0):void 0}),sx:{minWidth:300}}),i.jsx(PDt,{open:c,onClose:()=>u(!1)})]})},$Dt=EO(e7),DDt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(2)})),LDt=v(K)({flex:1,minWidth:0}),NDt=(e,t)=>{const n={};return t&&(n.environment=[t]),e!=="*"&&(n.appName=[e]),n},FDt=e=>{var t,n,r;return{metric:{metricName:(e==null?void 0:e.impactMetric.metricName)||"",source:e==null?void 0:e.impactMetric.source},appName:((t=e==null?void 0:e.impactMetric.labelSelectors.appName)==null?void 0:t[0])||"*",aggregationMode:(e==null?void 0:e.impactMetric.aggregationMode)||"rps",operator:((n=e==null?void 0:e.triggerCondition)==null?void 0:n.operator)||">",threshold:((r=e==null?void 0:e.triggerCondition)==null?void 0:r.threshold)||0,timeRange:(e==null?void 0:e.impactMetric.timeRange)||"day"}},BDt=e=>{const t=g.useMemo(()=>FDt(e),[e]),[n,r]=g.useState(t.metric),[o,s]=g.useState(t.appName),[a,l]=g.useState(t.aggregationMode),[c,u]=g.useState(t.operator),[d,p]=g.useState(t.threshold),[f,h]=g.useState(t.timeRange);return{metric:n,setMetric:r,appName:o,setAppName:s,aggregationMode:a,setAggregationMode:l,operator:c,setOperator:u,threshold:d,setThreshold:p,timeRange:f,setTimeRange:h,resetToOriginalValues:()=>{e&&(r(t.metric),s(t.appName),l(t.aggregationMode),u(t.operator),p(t.threshold),h(t.timeRange))},initialValues:t}},zDt=e=>{const[t,n]=g.useState(e?"display":"create");return{mode:t,setMode:n,enterEditMode:()=>{t==="display"&&n("edit")}}},HDt=(e,t,n,r,o)=>{var p,f,h;const{metricOptions:s,loading:a}=B$t(),{data:l}=IO(e?{metricName:e,range:t,aggregationMode:n,source:o,mode:"edit"}:void 0),c=g.useMemo(()=>{var y;return["*",...((y=l==null?void 0:l.labels)==null?void 0:y.appName)||[]]},[(p=l==null?void 0:l.labels)==null?void 0:p.appName]),u=k$t(e,(f=l==null?void 0:l.labels)==null?void 0:f.metric_type),d=(h=l==null?void 0:l.labels)!=null&&h.environment?r:void 0;return{metricOptions:s,loading:a,applicationNames:c,metricType:u,metricEnvironment:d}},WDt=(e,t,n,r)=>{const{setMetric:o,setAppName:s,setAggregationMode:a,setOperator:l,setThreshold:c,setTimeRange:u}=e,{enterEditMode:d}=t,p=e.initialValues.metric.metricName;return g.useEffect(()=>{n.length>0&&!e.metric.metricName&&o({metricName:n[0].name,source:n[0].source})},[n,e.metric.metricName,o]),g.useEffect(()=>{e.metric.metricName!==p&&r!=="unknown"&&a(T$t(r))},[e.metric.metricName,p,r]),{handleMetricChange:C=>{d(),o(C),s("*")},handleApplicationChange:C=>{d(),s(C)},handleAggregationModeChange:C=>{d(),a(C)},handleOperatorChange:C=>{d(),l(C)},handleThresholdChange:C=>{d(),c(C)},handleTimeRangeChange:C=>{d(),u(C)}}},VDt=(e,t,n,r)=>{const o=ar("projectId"),s=BDt(e),a=zDt(e),l=HDt(s.metric.metricName,s.timeRange,s.aggregationMode,n,s.metric.source),c=WDt(s,a,l.metricOptions,l.metricType),u=g.useMemo(()=>NDt(s.appName,l.metricEnvironment),[s.appName,l.metricEnvironment]),d=g.useMemo(()=>({impactMetric:{metricName:s.metric.metricName,timeRange:s.timeRange,aggregationMode:s.aggregationMode,labelSelectors:u,source:s.metric.source??"internal"},triggerCondition:{operator:s.operator,threshold:Number(s.threshold)}}),[s.metric,s.timeRange,s.aggregationMode,u,s.operator,s.threshold]);return{...s,...a,...l,...c,projectId:o,featureId:t,labelSelectors:u,handleSubmit:f=>{f.preventDefault(),!Number.isNaN(Number(s.threshold))&&(r(d),(a.mode==="edit"||a.mode==="create")&&a.setMode("display"))}}},UDt={releasePlan:"Pause automation when",featureEnvironment:"Disable environment when"},GDt=({formState:e,onSubmit:t,onCancel:n,onDelete:r,environment:o,badge:s,children:a,safeguardType:l="releasePlan"})=>{var se;const{metric:c,appName:u,aggregationMode:d,operator:p,threshold:f,timeRange:h,mode:m,setMode:y,metricOptions:b,loading:x,applicationNames:C,metricType:w,projectId:j,featureId:k,handleMetricChange:S,handleApplicationChange:E,handleAggregationModeChange:T,handleOperatorChange:R,handleThresholdChange:_,handleTimeRangeChange:M,resetToOriginalValues:$,enterEditMode:z,labelSelectors:A}=e,O=l==="featureEnvironment"?hQ:wp,L=()=>{if(m==="create"){n==null||n();return}$(),y("display")},B=()=>{r&&r()},H=m==="create"||m==="edit",N=(se=b.find(ae=>ae.name===c.metricName&&ae.source===(c.source??"internal")))==null?void 0:se.displayName,{inputValue:I,handleInputChange:q,handleInputBlur:ne,handleKeyDown:V,handleFocus:oe}=wne(f,_,{onEditStart:z});return i.jsxs(Rae,{onSubmit:t,mode:m,children:[i.jsxs(Rd,{children:[i.jsx($Dt,{}),i.jsx(R1,{sx:{mr:"auto"},children:UDt[l]}),m==="display"&&s,c.metricName&&i.jsx(N$t,{metricName:c.metricName,metricDisplayName:N,timeRange:h,labelSelectors:A,aggregationMode:d,threshold:f,projectId:j,featureId:k,source:c.source}),m!=="create"&&r&&i.jsx(Co,{permission:O,projectId:j,environmentId:o,onClick:B,size:"small","aria-label":"Remove safeguard",tooltipProps:{title:"Remove safeguard"},sx:{padding:.5},children:i.jsx(jO,{fontSize:"small"})})]}),i.jsx(DDt,{children:i.jsxs(LDt,{children:[i.jsxs(Rd,{sx:{ml:3,mb:1.5},children:[i.jsx(MDt,{value:c.metricName,valueSource:c.source,onChange:S,options:b,loading:x,label:""}),i.jsxs(Rd,{children:[i.jsx(R1,{children:"filtered by"}),i.jsx(Ko,{variant:"outlined",size:"small",children:i.jsx(BV,{value:u,onChange:ae=>E(String(ae.target.value)),variant:"outlined",size:"small",children:C.map(ae=>i.jsx(bC,{value:ae,children:ae==="*"?"All":ae},ae))})})]}),i.jsxs(Rd,{children:[i.jsx(R1,{children:"aggregated by"}),i.jsx(H$t,{value:d,onChange:T,metricType:w,label:""})]})]}),i.jsxs(Rd,{sx:{ml:.75},children:[i.jsxs(Rd,{children:[i.jsx(R1,{sx:{ml:2.5},children:"is"}),i.jsx(Ko,{variant:"outlined",size:"small",children:i.jsxs(BV,{value:p,onChange:ae=>R(ae.target.value),variant:"outlined",size:"small",children:[i.jsx(bC,{value:">",children:"More than"}),i.jsx(bC,{value:"<",children:"Less than"})]})}),i.jsx(Ko,{variant:"outlined",size:"small",children:i.jsx(xn,{type:"number",inputProps:{step:.1},value:I,onChange:q,onFocus:oe,onBlur:ne,onKeyDown:V,placeholder:"Value",variant:"outlined",size:"small",required:!0})})]}),i.jsxs(Rd,{children:[i.jsx(R1,{children:"over"}),i.jsxs(z$t,{value:h,onChange:M,label:"",children:[i.jsx(wn,{value:"hour",children:"Last minute"}),i.jsx(wn,{value:"day",children:"Last 15 minutes"}),i.jsx(wn,{value:"week",children:"Last 3 hours"}),i.jsx(wn,{value:"month",children:"Last day"})]})]})]})]})}),H&&i.jsxs(Aae,{children:[i.jsx($e,{variant:"outlined",onClick:L,size:"small",children:"Cancel"}),i.jsx(lo,{permission:O,projectId:j,environmentId:o,variant:"contained",color:"primary",size:"small",type:"submit",disabled:Number.isNaN(Number(f)),children:"Save"})]}),a]})},ele=({onSubmit:e,onCancel:t,onDelete:n,safeguard:r,environment:o,featureId:s,badge:a,safeguardType:l})=>{const c=VDt(r,s,o,e);return i.jsx(GDt,{formState:c,onSubmit:c.handleSubmit,onCancel:t,onDelete:n,environment:o,badge:a,safeguardType:l})},qDt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),justifyContent:"space-between",width:"100%",padding:e.spacing(1.5,2),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.divider}`,borderRadius:`${e.shape.borderRadiusLarge}px`})),YDt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),flexWrap:"wrap"})),KDt=EO(e7),hm=v("span")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body2.fontSize,flexShrink:0})),gm=v("span")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold})),XDt={releasePlan:"Pause automation when",featureEnvironment:"Disable environment when"},tle=({safeguard:e,badge:t,safeguardType:n="releasePlan"})=>{var s,a,l;const r=((s=e.impactMetric.labelSelectors.appName)==null?void 0:s[0])||"*",o=((a=e.triggerCondition)==null?void 0:a.operator)===">"?"More than":"Less than";return i.jsxs(qDt,{children:[i.jsxs(YDt,{children:[i.jsx(KDt,{}),i.jsx(hm,{children:XDt[n]}),i.jsx(gm,{children:e.impactMetric.metricName}),r!=="*"&&i.jsxs(i.Fragment,{children:[i.jsx(hm,{children:"filtered by"}),i.jsx(gm,{children:r})]}),i.jsx(hm,{children:"aggregated by"}),i.jsx(gm,{children:e.impactMetric.aggregationMode}),i.jsx(hm,{children:"is"}),i.jsxs(gm,{children:[o," ",(l=e.triggerCondition)==null?void 0:l.threshold]}),i.jsx(hm,{children:"over"}),i.jsx(gm,{children:e.impactMetric.timeRange})]}),t]})},nle=v(R0)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),rle=({safeguard:e,currentSafeguard:t,changeRequestState:n,environmentName:r,featureName:o,safeguardType:s,actions:a,onSubmit:l,onDelete:c})=>{const u=Ns(n);return i.jsxs(nle,{children:[i.jsxs(js,{children:[i.jsx(Ss,{children:i.jsx(E0,{children:"Change safeguard"})}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),a]})]}),i.jsx(Mo,{children:u?i.jsx(tle,{safeguard:e,safeguardType:s}):i.jsx(ele,{onSubmit:l,onDelete:t!=null&&t.id?()=>c(t.id):void 0,safeguard:e,environment:r,featureId:o,safeguardType:s})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:Sg(t,["id","action","impactMetric.id"]),data:e}})})]})},ole=({safeguard:e,changeRequestState:t,environmentName:n,featureName:r,safeguardType:o,actions:s,onSubmit:a,onDelete:l})=>{const c=Ns(t);return i.jsxs(nle,{children:[i.jsxs(js,{children:[i.jsx(Ss,{children:i.jsx(Py,{children:"Delete safeguard"})}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),s]})]}),i.jsx(Mo,{children:c?i.jsx(tle,{safeguard:e,safeguardType:o}):i.jsx(ele,{onSubmit:a,onDelete:e!=null&&e.id?()=>l(e.id):void 0,safeguard:e,environment:n,featureId:r,safeguardType:o})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:e,data:{}}})})]})},sle=v(R0)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),JDt=({change:e,currentReleasePlan:t,changeRequestState:n,actions:r})=>{const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t;if(o)return i.jsxs(i.Fragment,{children:[i.jsx(js,{children:i.jsxs(Ss,{children:[i.jsx(Py,{children:"Deleting release plan"}),i.jsx(J,{component:"span",children:o.name}),r]})}),i.jsx(qv,{plan:o,readonly:!0})]})},ZDt=e=>{const{change:t,currentReleasePlan:n,changeRequestState:r,environmentName:o,featureName:s,actions:a}=e,l=(Ns(r)||!n)&&t.payload.snapshot?t.payload.snapshot:n;if(l)return i.jsx(js,{children:i.jsxs(Ss,{children:[i.jsx(E0,{children:"Resume automation"}),i.jsxs(J,{component:"span",children:["Resume automation for release plan ",l.name," for"," ",s," in ",o]}),a]})})},QDt=({change:e,currentReleasePlan:t,changeRequestState:n,actions:r})=>{const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t;if(!o)return;const s=o.milestones.find(l=>l.id===o.activeMilestoneId),a=o.milestones.find(l=>l.id===e.payload.milestoneId);if(a)return i.jsxs(sle,{children:[i.jsxs(js,{children:[i.jsxs(Ss,{children:[i.jsx(E0,{children:"Start milestone"}),i.jsx(J,{component:"span",children:a.name})]}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),r]})]}),i.jsx(Mo,{children:i.jsx(bO,{readonly:!0,milestone:a,environmentId:o.environment,featureId:o.featureName,renderStrategy:l=>i.jsx(m8,{strategyHeaderLevel:4,strategy:{...l,name:l.name||l.strategyName||""}})})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:s,data:a}})})]})},eLt=({change:e,currentReleasePlan:t,changeRequestState:n,...r})=>{var s;const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t;if(!(!o||!e.payload.safeguard))return i.jsx(rle,{safeguard:e.payload.safeguard,currentSafeguard:(s=o.safeguards)==null?void 0:s[0],changeRequestState:n,...r})},tLt=({change:e,currentReleasePlan:t,changeRequestState:n,...r})=>{var a;const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t,s=(a=o==null?void 0:o.safeguards)==null?void 0:a[0];if(s)return i.jsx(ole,{safeguard:s,changeRequestState:n,...r})},nLt=({change:e,currentReleasePlan:t,environmentName:n,featureName:r,actions:o})=>{const[s,a]=g.useState(!1),l=g.useRef(),c=()=>{l.current&&clearTimeout(l.current),a(!0)},u=()=>{l.current=setTimeout(()=>{a(!1)},100)},d=VIt(e.payload.templateId,r,n),p={...d,discriminator:"plan",releasePlanTemplateId:e.payload.templateId};return t?i.jsxs(sle,{children:[i.jsxs(js,{children:[i.jsx(Ss,{children:i.jsxs(Bl,{children:["Replacing"," ",i.jsx(sd,{tooltip:i.jsx("div",{onMouseEnter:()=>c(),onMouseLeave:()=>u(),children:i.jsx(qv,{plan:t,readonly:!0})}),tooltipProps:{open:s,maxWidth:500,maxHeight:600},children:i.jsx("span",{onMouseEnter:()=>c(),onMouseLeave:()=>u(),children:"current"})})," ","release plan with ",d.name]})}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),o]})]}),i.jsx(Mo,{children:i.jsx(qv,{plan:d,readonly:!0})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:t,data:p}})})]}):i.jsxs(i.Fragment,{children:[i.jsx(js,{children:i.jsxs(Ss,{children:[i.jsx(E0,{children:"Adding release plan"}),i.jsx(J,{component:"span",children:d.name}),o]})}),i.jsx(qv,{plan:d,readonly:!0})]})},rLt=({actions:e,change:t,featureName:n,environmentName:r,projectId:o,changeRequestState:s,changeRequest:a,feature:l,onRefetch:c})=>{const{releasePlans:u}=UIt(o,n,r),d=u[0],{addChange:p}=ia(),{refetch:f}=nc(o),{setToastData:h,setToastApiError:m}=_t(),y=async w=>{try{await p(o,r,{feature:n,action:"changeReleasePlanSafeguard",payload:{planId:d.id,safeguard:w}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(j){m(pt(j))}},b=async w=>{try{await p(o,r,{feature:n,action:"deleteReleasePlanSafeguard",payload:{planId:d.id,safeguardId:w}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(j){m(pt(j))}},x=async(w,j)=>{try{await p(o,r,{feature:n,action:"changeMilestoneProgression",payload:{sourceMilestone:w,...j}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(k){m(pt(k))}},C=async w=>{try{await p(o,r,{feature:n,action:"deleteMilestoneProgression",payload:{sourceMilestone:w}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(j){m(pt(j))}};if(l&&(t.action==="changeMilestoneProgression"||t.action==="deleteMilestoneProgression"||t.action==="updateMilestoneStrategy")){const w=l.changes.filter(k=>k.action==="changeMilestoneProgression"||k.action==="deleteMilestoneProgression"||k.action==="updateMilestoneStrategy");return w.length>0&&w[0]===t?i.jsx(b$t,{feature:l,currentReleasePlan:d,changeRequest:a,onUpdateChangeRequestSubmit:x,onDeleteChangeRequestSubmit:C,onRefetch:c}):null}return i.jsxs(i.Fragment,{children:[t.action==="addReleasePlan"&&i.jsx(nLt,{change:t,currentReleasePlan:d,environmentName:r,featureName:n,actions:e}),t.action==="deleteReleasePlan"&&i.jsx(JDt,{change:t,currentReleasePlan:d,changeRequestState:s,actions:e}),t.action==="resumeMilestoneProgression"&&i.jsx(ZDt,{change:t,currentReleasePlan:d,changeRequestState:s,environmentName:r,featureName:n,actions:e}),t.action==="startMilestone"&&i.jsx(QDt,{change:t,currentReleasePlan:d,changeRequestState:s,actions:e}),t.action==="changeReleasePlanSafeguard"&&i.jsx(eLt,{change:t,currentReleasePlan:d,changeRequestState:s,environmentName:r,featureName:n,onSubmit:y,onDelete:b,actions:e}),t.action==="deleteReleasePlanSafeguard"&&i.jsx(tLt,{change:t,currentReleasePlan:d,changeRequestState:s,environmentName:r,featureName:n,onSubmit:y,onDelete:b,actions:e})]})},oLt=({change:e,changeRequestState:t,projectId:n,featureName:r,environmentName:o,...s})=>{var u,d;const{feature:a}=ws(n,r),l=(d=(u=a.environments.find(p=>p.name===o))==null?void 0:u.safeguards)==null?void 0:d[0],c=Ns(t)?e.payload.snapshot??void 0:l;if(e.payload.safeguard)return i.jsx(rle,{safeguard:e.payload.safeguard,currentSafeguard:c,changeRequestState:t,environmentName:o,featureName:r,safeguardType:"featureEnvironment",...s})},sLt=({change:e,changeRequestState:t,projectId:n,featureName:r,environmentName:o,...s})=>{var u,d;const{feature:a}=ws(n,r),l=(d=(u=a.environments.find(p=>p.name===o))==null?void 0:u.safeguards)==null?void 0:d[0],c=Ns(t)?e.payload.snapshot??void 0:l;if(c)return i.jsx(ole,{safeguard:c,changeRequestState:t,environmentName:o,featureName:r,safeguardType:"featureEnvironment",...s})},iLt=({actions:e,change:t,featureName:n,environmentName:r,projectId:o,changeRequestState:s,onRefetch:a})=>{const{addChange:l}=ia(),{refetch:c}=nc(o),{setToastData:u,setToastApiError:d}=_t(),p=async h=>{try{await l(o,r,{feature:n,action:"changeFeatureEnvSafeguard",payload:{safeguard:h}}),await c(),u({type:"success",text:"Added to draft"}),a==null||a()}catch(m){d(pt(m))}},f=async h=>{try{await l(o,r,{feature:n,action:"deleteFeatureEnvSafeguard",payload:{safeguardId:h}}),await c(),u({type:"success",text:"Added to draft"}),a==null||a()}catch(m){d(pt(m))}};return i.jsxs(i.Fragment,{children:[t.action==="changeFeatureEnvSafeguard"&&i.jsx(oLt,{change:t,changeRequestState:s,environmentName:r,featureName:n,projectId:o,onSubmit:p,onDelete:f,actions:e}),t.action==="deleteFeatureEnvSafeguard"&&i.jsx(sLt,{change:t,changeRequestState:s,environmentName:r,featureName:n,projectId:o,onSubmit:p,onDelete:f,actions:e})]})},aLt=v(K)(({theme:e})=>({overflow:"hidden",border:"1px solid",borderBottom:"none",borderRadius:0,borderColor:e.palette.divider,'&[data-conflict="change"]':{borderColor:e.palette.warning.border},'[data-conflict="change"] + &':{borderTopColor:e.palette.warning.border},'[data-conflict="feature"] &':{borderTopColor:e.palette.divider},"&:last-child":{borderBottomStyle:"solid",borderRadius:`0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`}})),rU=v(Dt)(({theme:e})=>({borderRadius:0,padding:e.spacing(1,2),"&.MuiAlert-standardWarning":{borderStyle:"none none solid none"}})),lLt=v("ul")(({theme:e})=>({display:"inline",padding:0,li:{display:"inline"},"li + li::before":{content:'", "'}})),cLt=v(K)(({theme:e})=>({padding:e.spacing(3),"&:empty":{display:"none"}})),oU=({change:e,feature:t,changeRequest:n,actions:r,onNavigate:o,isDefaultChange:s,onRefetch:a})=>{const l=e.conflict||e.scheduleConflicts;return i.jsxs(aLt,{"data-conflict":l?"change":void 0,children:[i.jsx(te,{condition:!!e.conflict&&!t.conflict,show:i.jsxs(rU,{severity:"warning",children:[i.jsx("strong",{children:"Conflict!"})," This change can’t be applied."," ",e.conflict,"."]})}),i.jsx(te,{condition:!!e.scheduleConflicts,show:i.jsxs(rU,{severity:"warning",children:[i.jsx("strong",{children:"Potential conflict!"})," This change would create conflicts with the following scheduled change request(s):"," ",i.jsxs(lLt,{children:[(e.scheduleConflicts??{changeRequests:[]}).changeRequests.map(({id:c,title:u})=>{const d=u?`#${c} (${u})`:`#${c}`;return i.jsx("li",{children:i.jsx(ft,{to:`/projects/${n.project}/change-requests/${c}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${c}`,children:d})},c)}),"."]})]})}),i.jsxs(cLt,{children:[(e.action==="addDependency"||e.action==="deleteDependency")&&i.jsx(WIt,{actions:r,change:e,projectId:n.project,onNavigate:o}),e.action==="updateEnabled"&&i.jsx(XPt,{isDefaultChange:s,enabled:e.payload.enabled,actions:r}),e.action==="archiveFeature"&&i.jsx(zIt,{actions:r}),e.action==="addStrategy"||e.action==="deleteStrategy"||e.action==="updateStrategy"?i.jsx(Dae,{actions:r,isDefaultChange:s,change:e,featureName:t.name,environmentName:n.environment,projectId:n.project,changeRequestState:n.state}):null,e.action==="patchVariant"&&i.jsx(OIt,{feature:t.name,project:n.project,changeRequestState:n.state,environment:n.environment,change:e,actions:r}),e.action==="reorderStrategy"&&i.jsx(BIt,{feature:t.name,project:n.project,environment:n.environment,change:e,actions:r}),(e.action==="addReleasePlan"||e.action==="deleteReleasePlan"||e.action==="startMilestone"||e.action==="changeMilestoneProgression"||e.action==="deleteMilestoneProgression"||e.action==="changeReleasePlanSafeguard"||e.action==="deleteReleasePlanSafeguard"||e.action==="resumeMilestoneProgression"||e.action==="updateMilestoneStrategy")&&i.jsx(rLt,{actions:r,change:e,featureName:t.name,environmentName:n.environment,projectId:n.project,changeRequestState:n.state,changeRequest:n,feature:t,onRefetch:a}),(e.action==="changeFeatureEnvSafeguard"||e.action==="deleteFeatureEnvSafeguard")&&i.jsx(iLt,{actions:r,change:e,featureName:t.name,environmentName:n.environment,projectId:n.project,changeRequestState:n.state,onRefetch:a})]})]},a0(e))},uLt=v("div")({width:"100%",display:"flex",flexDirection:"column"}),dLt=({constraints:e})=>{const{context:t}=iu();return t.length===0?null:i.jsx(uLt,{children:i.jsx(L7,{children:e.map(n=>i.jsx(q7,{constraint:n},n[Vl]||a0(n)))})})},sU=({change:e,currentSegment:t})=>{const n=e.action==="deleteSegment"?void 0:e.payload;return i.jsx(Sl,{entry:{preData:Sg(t,["createdAt","createdBy"]),data:Sg(n,["snapshot"])}})},pLt=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",alignItems:"center",columnGap:e.spacing(1)})),fLt=v(K,{shouldForwardProp:e=>e!=="conflict"})(({theme:e,conflict:t})=>({display:"flex",flexFlow:"column",gap:e.spacing(1),border:`1px solid ${t?e.palette.warning.border:e.palette.divider}`,borderTopColor:e.palette.divider,padding:e.spacing(3),borderRadius:`0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`})),hLt=({actions:e,change:t,changeRequestState:n})=>{var c,u;const{segment:r}=L_(t.payload.id),o=t.payload.snapshot,s=Ns(n)?(u=(c=t.payload)==null?void 0:c.snapshot)==null?void 0:u.name:r==null?void 0:r.name,a=Ns(n)?o:r,l=i.jsxs(pLt,{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),e]});return i.jsx(R0,{children:i.jsxs(fLt,{conflict:t.conflict,children:[t.action==="deleteSegment"&&i.jsxs(i.Fragment,{children:[i.jsxs(js,{children:[i.jsxs(Ss,{children:[i.jsx(Py,{children:"Deleting segment"}),i.jsx(j3,{newName:t.payload.name,previousName:s})]}),l]}),i.jsx(Mo,{sx:{display:"contents"}}),i.jsx(Mo,{sx:{mt:1},variant:"diff",children:i.jsx(sU,{change:t,currentSegment:a})})]}),t.action==="updateSegment"&&i.jsxs(i.Fragment,{children:[i.jsx(gO,{data:{current:r,change:t,changeType:"segment"},changeRequestState:n}),i.jsxs(js,{children:[i.jsxs(Ss,{children:[i.jsx(Bl,{children:"Editing segment"}),i.jsx(j3,{newName:t.payload.name,previousName:s})]}),l]}),i.jsx(Mo,{children:i.jsx(dLt,{constraints:t.payload.constraints})}),i.jsx(Mo,{variant:"diff",children:i.jsx(sU,{change:t,currentSegment:a})})]})]})})},gLt=({segmentChange:e,onNavigate:t,actions:n,changeRequestState:r})=>{const{segment:o}=L_(e.payload.id);return i.jsxs(Y3,{elevation:0,sx:s=>({marginTop:s.spacing(2),marginBottom:s.spacing(2),overflow:"hidden"}),children:[i.jsxs(K,{sx:s=>({backgroundColor:s.palette.neutral.light,borderRadius:`${s.shape.borderRadiusLarge}px ${s.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:e.conflict?s.palette.warning.border:s.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[i.jsx(rae,{conflict:e.conflict}),i.jsxs(K,{sx:{display:"flex",pt:2,pb:2,px:3},children:[i.jsx(J,{children:"Segment name:"}),i.jsx(Sn,{component:ft,to:`/segments/edit/${e.payload.id}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:t,children:i.jsx("strong",{children:e.payload.name||(o==null?void 0:o.name)})})]})]}),i.jsx(hLt,{change:e,actions:n,changeRequestState:r})]})},mLt=({changeRequest:e,onRefetch:t,onNavigate:n})=>{var r,o;return i.jsxs(K,{children:[i.jsx(te,{condition:e.segments.length>0,show:i.jsx(J,{variant:"body2",color:"text.secondary",children:"You request changes for these segments:"})}),(r=e.segments)==null?void 0:r.map(s=>i.jsx(gLt,{segmentChange:s,onNavigate:n,changeRequestState:e.state,actions:i.jsx($j,{changeRequest:e,feature:"Unused",change:s,onRefetch:t})},s.payload.id)),i.jsx(te,{condition:e.features.length>0,show:i.jsx(J,{variant:"body2",color:"text.secondary",children:"You request changes for these feature flags:"})}),(o=e.features)==null?void 0:o.map(s=>i.jsxs(GPt,{featureName:s.name,projectId:e.project,onNavigate:n,conflict:s.conflict,children:[s.changes.map((a,l)=>i.jsx(oU,{actions:i.jsx($j,{changeRequest:e,feature:s.name,change:a,onRefetch:t}),changeRequest:e,change:a,feature:s,onNavigate:n,onRefetch:t},l)),s.defaultChange?i.jsx(oU,{isDefaultChange:!0,changeRequest:e,change:s.defaultChange,feature:s}):null]},s.name))]})},yLt=v(ed)(({theme:e})=>({height:"32px",width:"32px",marginTop:e.spacing(1),marginRight:e.spacing(2)})),xLt=v(K)(({theme:e})=>({display:"flex",marginTop:e.spacing(2),marginBottom:e.spacing(1)})),vLt=({user:e,commentText:t,onTypeComment:n,children:r})=>i.jsxs(i.Fragment,{children:[i.jsxs(xLt,{children:[i.jsx(yLt,{user:e}),i.jsx(xn,{variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>n(o.target.value),value:t})]}),i.jsx(K,{sx:{display:"flex",justifyContent:"flex-end"},children:r})]}),bLt=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",width:"100%","& > div":{width:"100%"},justifyContent:"space-between",marginBottom:e.spacing(1)}));v(J)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader}));const CLt=v(Mt)(({theme:e})=>({borderRadius:e.shape.borderRadius})),wLt=({environmentChangeRequest:e,title:t,setTitle:n,children:r})=>{const[o,s]=g.useState(!0),{updateTitle:a}=ia(),{setToastData:l,setToastApiError:c}=_t(),u=()=>{s(!o)},d=async()=>{u();try{await a(e.project,e.id,t),l({type:"success",text:"Change request title updated!"})}catch(p){c(pt(p))}};return i.jsxs(bLt,{children:[i.jsx(te,{condition:o,show:r,elseShow:i.jsx(Yr,{label:"Change request title",id:"group-name",value:t,fullWidth:!0,onChange:p=>n(p.target.value),disabled:o})}),i.jsx(te,{condition:o,show:i.jsx(CLt,{onClick:u,children:i.jsx(oi,{})})}),i.jsx(te,{condition:!o,show:i.jsxs(i.Fragment,{children:[i.jsx($e,{variant:"contained",color:"primary",sx:p=>({marginLeft:p.spacing(2)}),onClick:()=>d(),children:"Save"}),i.jsx($e,{sx:p=>({marginLeft:p.spacing(1)}),variant:"outlined",onClick:u,children:"Cancel"})," "]})})]})},SLt=({featuresCount:e,segmentsCount:t})=>i.jsxs(K,{component:"span",sx:{display:"inline",pl:.5},children:[i.jsxs(J,{component:"span",variant:"body2",fontWeight:"bold",display:"inline",children:[e," ",e===1?"feature flag":"feature flags"]}),i.jsx(te,{condition:t>0,show:i.jsxs(i.Fragment,{children:[i.jsx(J,{component:"span",variant:"body2",children:" and "}),i.jsxs(J,{component:"span",variant:"body2",fontWeight:"bold",display:"inline",children:[t," ",t===1?"segment":"segments"]})]})})]}),jLt=g.forwardRef(function(t,n){const{children:r,...o}=t,s=g.useRef(null),a=g.Children.toArray(r),l=oie({count:g.Children.count(r),getScrollElement:()=>s.current,estimateSize:()=>56,overscan:3});return i.jsx("div",{ref:n,children:i.jsx("div",{ref:s,...o,children:i.jsx("ul",{style:{height:`${l.getTotalSize()}px`,width:"100%",position:"relative"},children:l.getVirtualItems().map(c=>{const u=a[c.index];if(!u)return null;const d={position:"absolute",left:0,width:"100%",top:`${c.start}px`};return g.cloneElement(u,{ref:l.measureElement,key:c.key,"data-index":c.index,style:d})})})})})});function ELt(e){const{virtualThreshold:t=250,getOptionLabel:n,className:r,...o}=e,s=e.options.length>t,a={...o,getOptionLabel:n,disableListWrap:!0,...s&&{ListboxComponent:jLt,groupBy:void 0}};return i.jsx(Zl,{...a})}const kLt=(e,t)=>{const{data:n,error:r,mutate:o}=On(yt(`api/admin/projects/${e}/change-requests/available-reviewers/${t}`),TLt);return g.useMemo(()=>({reviewers:(n==null?void 0:n.reviewers)||[],loading:!r&&!n,refetchReviewers:()=>o(),error:r}),[n,r,o])},TLt=e=>fetch(e).then(en("Available Change Request Reviewers")).then(t=>t.json()),RLt=({onClick:e,count:t,disabled:n=!1})=>i.jsxs($e,{sx:{ml:2},variant:"contained",onClick:e,disabled:n,children:["Submit change request (",t,")"]}),ALt=v("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),PLt=v("li")({width:"100%"}),_Lt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),ILt=(e,t,{selected:n})=>g.createElement(PLt,{...e,key:t.id},i.jsx(Si,{icon:i.jsx(m0,{fontSize:"small"}),checkedIcon:i.jsx(y0,{fontSize:"small"}),style:{marginRight:8},checked:n}),i.jsxs(_Lt,{children:[i.jsx("span",{children:t.name||t.username}),i.jsx("span",{children:t.name&&t.username?t.username:t.email})]})),OLt=e=>i.jsx(ALt,{children:e.length>1?`${e.length} reviewers`:e[0].name||e[0].username||e[0].email}),MLt=({environmentChangeRequest:e,reviewers:t,setReviewers:n,onReview:r,onDiscard:o,sendToReview:s,disabled:a,setDisabled:l})=>{const c=Bt(),{reviewers:u,loading:d}=kLt(e.project,e.environment),p=(h,m,y)=>{h.type==="keydown"&&h.key==="Backspace"&&y==="removeOption"||n(m)},f=(h,{inputValue:m})=>h.filter(({name:y,username:b,email:x})=>f2(m,x)||f2(m,y)||f2(m,b));return i.jsxs(i.Fragment,{children:[i.jsx(ELt,{sx:{ml:"auto",width:c.spacing(40)},size:"small",limitTags:3,openOnFocus:!0,multiple:!0,disableCloseOnSelect:!0,value:t,onChange:p,options:u,renderOption:ILt,filterOptions:f,freeSolo:t.length>=10?!1:void 0,getOptionDisabled:h=>t.length>=10&&!t.find(m=>m.id===h.id),isOptionEqualToValue:(h,m)=>h.id===m.id,getOptionLabel:h=>h.email||h.name||h.username||"",renderInput:h=>i.jsx(xn,{...h,label:`Reviewers (${t.length})`}),renderTags:h=>OLt(h),noOptionsText:d?"Loading…":"No options"}),i.jsx(RLt,{onClick:()=>r(s),count:_O(e),disabled:a}),i.jsx($e,{sx:{ml:2},variant:"outlined",disabled:a,onClick:()=>{l(!0),o(e.id)},children:"Discard changes"})]})},$Lt=v(K)(({theme:e})=>({padding:e.spacing(3,3,1,3),border:"2px solid",borderColor:e.palette.divider,borderRadius:`${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px 0 0`,borderBottom:"none",overflow:"hidden",backgroundColor:e.palette.neutral.light})),DLt=v(K)(({theme:e})=>({padding:e.spacing(3,3,3,3),border:"2px solid",marginBottom:e.spacing(5),borderColor:e.palette.divider,borderRadius:`0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`,borderTop:"none",overflow:"hidden"})),LLt=({environmentChangeRequest:e,onClose:t,onReview:n,onDiscard:r,children:o})=>{const s=Bt(),[a,l]=g.useState(""),{user:c}=gs(),[u,d]=g.useState(e.title),{changeState:p,updateRequestedApprovers:f}=ia(),[h,m]=g.useState([]),[y,b]=g.useState(!1),x=async C=>{b(!0);try{await p(C,e.id,"Draft",{state:"In review",comment:a}),h&&h.length>0&&await f(C,e.id,h.map(w=>w.id))}catch{b(!1)}};return i.jsxs(K,{children:[i.jsxs($Lt,{children:[i.jsxs(K,{sx:{display:"flex",alignItems:"end"},children:[i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(J,{component:"span",variant:"h2",children:e.environment}),i.jsx(VLt,{}),i.jsx(J,{component:"span",variant:"body2",color:"text.secondary",children:"Updates:"}),i.jsx(SLt,{featuresCount:e.features.length,segmentsCount:e.segments.length})]}),i.jsx(K,{sx:{ml:"auto"},children:i.jsx($ie,{changeRequest:e})})]}),i.jsx(pr,{sx:{my:3}}),i.jsx(wLt,{environmentChangeRequest:e,title:u,setTitle:d,children:i.jsx(Yr,{label:"Change request title",id:"group-name",fullWidth:!0,value:u,onChange:()=>{},disabled:!0})})]}),i.jsxs(DLt,{children:[o,i.jsx(te,{condition:(e==null?void 0:e.state)==="Draft",show:i.jsx(vLt,{user:c,commentText:a,onTypeComment:l})}),i.jsxs(K,{sx:{display:"flex",mt:3},children:[i.jsx(te,{condition:(e==null?void 0:e.state)==="Draft",show:i.jsx(MLt,{environmentChangeRequest:e,reviewers:h,setReviewers:m,onReview:n,onDiscard:r,sendToReview:x,disabled:y,setDisabled:b})}),i.jsx(te,{condition:e.state==="In review"||e.state==="Approved",show:i.jsx(i.Fragment,{children:i.jsxs(WLt,{children:[i.jsx(HLt,{}),i.jsx(J,{color:s.palette.success.dark,children:"Draft successfully sent to review"}),i.jsx($e,{sx:{marginLeft:2},variant:"outlined",component:ft,to:`/projects/${e.project}/change-requests/${e.id}`,onClick:()=>{t()},children:"View change request page"})]})})})]})]})]},e.id)},NLt=v(Y4)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginLeft:"0.3rem",color:e.palette.action.active})),FLt=v("div")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody})),BLt=()=>i.jsx($n,{actions:"",titleElement:i.jsxs(i.Fragment,{children:[i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:["Review your changes",i.jsx(Rt,{title:"Here you can see all the changes that you are suggesting and you can send them for review. You can still discard the changes after you sent them for review or even cancel the entire review if you need it",arrow:!0,children:i.jsx(NLt,{})})]}),i.jsx(FLt,{children:"Make sure you are sending the right changes to be reviewed"})]})}),iU=v(ir)(({theme:e})=>({height:"100vh",overflow:"auto",padding:e.spacing(6),[e.breakpoints.down("md")]:{padding:e.spacing(4,2)},"& .header":{padding:e.spacing(0,0,2,0)},"& .body":{padding:e.spacing(3,0,0,0)},borderRadius:`${e.spacing(1.5,0,0,1.5)} !important`})),zLt=v($e)(({theme:e})=>({marginTop:e.spacing(2),marginLeft:"auto"})),HLt=v(b0)(({theme:e})=>({color:e.palette.success.main,height:"32px",width:"32px",marginRight:e.spacing(1)})),WLt=v(K)(()=>({marginLeft:"auto",display:"flex",alignItems:"center"})),VLt=()=>i.jsx(J,{component:"span",sx:{marginLeft:1.5,marginRight:1.5,color:"divider"},children:"|"}),ULt=({open:e,project:t,onClose:n})=>{const{data:r,loading:o,refetch:s}=nc(t),a=wo("featureId"),{discardDraft:l}=ia(),{setToastApiError:c}=_t(),[u,d]=g.useState(!1),p=async h=>{try{await h(t),await Promise.all([s(),a?sj(t,a):Promise.resolve()]),n()}catch(m){c(pt(m))}},f=async h=>{try{await l(t,h),await Promise.all([s(),a?sj(t,a):Promise.resolve()]),n()}catch(m){c(pt(m))}};return!o&&!r?i.jsx(hl,{open:e,onClose:n,label:"Review changes",children:i.jsxs(iU,{disableBorder:!0,header:i.jsx($n,{titleElement:"Review your changes"}),children:["There are no changes to review.",i.jsx(zLt,{onClick:n,children:"Close"})]})}):i.jsx(hl,{open:e,onClose:n,label:"Review changes",children:i.jsx(iU,{disableBorder:!0,header:i.jsx(BLt,{}),children:r==null?void 0:r.map(h=>i.jsx(gtt,{value:{willOverwriteStrategyChanges:u,registerWillOverwriteStrategyChanges:()=>d(!0)},children:i.jsx(LLt,{environmentChangeRequest:h,onClose:n,onReview:p,onDiscard:f,children:i.jsx(mLt,{changeRequest:h,onNavigate:n,onRefetch:s})},h.id)},h.id))})})},ile=g.createContext(void 0),GLt=v("div",{shouldForwardProp:e=>e!=="top"})(({theme:e,top:t})=>({position:"sticky",zIndex:e.zIndex.sticky-100,...t!==void 0?{"&":{top:t}}:{}})),MO=({children:e,...t})=>{const n=g.useContext(ile),r=g.useRef(null),[o,s]=g.useState(null),[a,l]=g.useState();if(!n)throw new Error("Sticky component must be used within a StickyProvider");const{registerStickyItem:c,unregisterStickyItem:u,getTopOffset:d}=n;return g.useEffect(()=>{r.current&&o===null&&s(Number.parseInt(getComputedStyle(r.current).getPropertyValue("top"),10))},[]),g.useEffect(()=>{l(d(r)+(o||0))},[d,o]),g.useEffect(()=>{if(r.current)return c(r),()=>{u(r)}},[c,u]),i.jsx(GLt,{ref:r,top:a,...t,children:e})},qLt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(1,0)})),YLt=v(K)(({theme:e})=>({width:"100%",paddingLeft:e.spacing(3),paddingRight:e.spacing(9),marginLeft:"auto",marginRight:"auto",[e.breakpoints.down("lg")]:{marginLeft:0,marginRight:0,paddingLeft:e.spacing(2),paddingRight:e.spacing(2)},[e.breakpoints.down("sm")]:{minWidth:"100%"}})),KLt=({changeRequests:e,onClick:t})=>{const n=e.map(({environment:a})=>a),r=e.reduce((a,l)=>a+_O(l),0),s=e.length===1&&["Draft","In review","Approved"].includes(e[0].state)?{Draft:" that need to be reviewed","In review":" that are in review",Approved:" that are approved. Adding more changes will clear the approvals and require a new review"}[e[0].state]:"";return i.jsx(YLt,{children:i.jsxs(qLt,{children:[i.jsxs(J,{variant:"body2",sx:{mr:4},children:[i.jsx("strong",{children:"Change request mode"})," – You have changes"," ",i.jsx(te,{condition:!!n,show:i.jsxs(i.Fragment,{children:["in"," ",n.map((a,l)=>l===0?i.jsx(g.Fragment,{children:i.jsx("strong",{children:a})},a):i.jsxs(g.Fragment,{children:[l===n.length-1?" and ":", ",i.jsx("strong",{children:a})]},a))]})}),s,"."]}),i.jsxs($e,{variant:"contained",onClick:t,sx:{ml:"auto"},children:["View changes (",r,")"]})]})})},XLt=v(MO)(({theme:e})=>({borderBottom:`1px solid ${e.palette.warning.border}`,color:e.palette.warning.contrastText,backgroundColor:e.palette.warning.light,zIndex:250})),JLt=({project:e})=>{const[t,n]=g.useState(!1),{data:r,loading:o}=nc(e),s=g.useMemo(()=>r==null?void 0:r.filter(a=>["Draft","In review","Approved"].includes(a.state)),[r]);return!o&&!r||(r==null?void 0:r.length)===0?null:i.jsxs(XLt,{children:[i.jsx(te,{condition:!!(s!=null&&s.length),show:i.jsx(KLt,{changeRequests:s,onClick:()=>{n(!0)}})}),i.jsx(ULt,{project:e,open:t,onClose:()=>{n(!1)}})]})},ZLt=()=>{const[e,t]=ai("navigation-mode:v1","full");return g.useEffect(()=>{const n=r=>{r.key==="b"&&(r.metaKey||r.ctrlKey)&&(r.preventDefault(),t(e==="mini"?"full":"mini"))};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e]),[e,t]};var $O={},QLt=je;Object.defineProperty($O,"__esModule",{value:!0});var ale=$O.default=void 0,eNt=QLt(Ee()),aU=i,tNt=(0,eNt.default)([(0,aU.jsx)("path",{d:"M17.59 18 19 16.59 14.42 12 19 7.41 17.59 6l-6 6z"},"0"),(0,aU.jsx)("path",{d:"m11 18 1.41-1.41L7.83 12l4.58-4.59L11 6l-6 6z"},"1")],"KeyboardDoubleArrowLeft");ale=$O.default=tNt;var DO={},nNt=je;Object.defineProperty(DO,"__esModule",{value:!0});var lle=DO.default=void 0,rNt=nNt(Ee()),lU=i,oNt=(0,rNt.default)([(0,lU.jsx)("path",{d:"M6.41 6 5 7.41 9.58 12 5 16.59 6.41 18l6-6z"},"0"),(0,lU.jsx)("path",{d:"m13 6-1.41 1.41L16.17 12l-4.58 4.59L13 18l6-6z"},"1")],"KeyboardDoubleArrowRight");lle=DO.default=oNt;const sNt=v(K,{shouldForwardProp:e=>e!=="mode"})(({theme:e,mode:t})=>({display:"flex",justifyContent:"space-between",alignItems:"center",padding:e.spacing(0,1,0,t==="mini"?1.5:2),cursor:"pointer"})),iNt=({mode:e,onChange:t})=>i.jsxs(sNt,{onClick:t,mode:e,children:[e==="full"&&i.jsx(K,{sx:n=>({color:n.palette.neutral.main,fontSize:"small"}),children:"Hide (⌘ + B)"}),i.jsx(Mt,{"aria-label":`${e==="full"?"Collapse":"Expand"} (⌘ + B)`,children:e==="full"?i.jsx(ale,{color:"primary"}):i.jsx(Rt,{title:"Expand (⌘ + B)",placement:"right",children:i.jsx(lle,{"data-testid":"expand-navigation",color:"primary"})})})]});v(K)(({theme:e})=>({padding:e.spacing(2,1,0,1.5)}));const aNt=e=>{const t=e.split("/").filter(o=>o);return t.length===0||t[0]==="admin"&&t.length===1?"/projects":t[0]==="admin"&&t.length>1?`/${t[0]}/${t[1]}`:`/${t[0]}`},lNt=()=>{const{pathname:e}=jo();return aNt(e)},cNt=e=>g.createElement("svg",{width:150,height:58,viewBox:"0 0 150 58",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{clipPath:"url(#clip0_2239_6192)"},g.createElement("path",{d:"M28.8381 47.2041C38.9811 47.2041 47.2036 38.9816 47.2036 28.8386C47.2036 18.6956 38.9811 10.4731 28.8381 10.4731C18.6952 10.4731 10.4727 18.6956 10.4727 28.8386C10.4727 38.9816 18.6952 47.2041 28.8381 47.2041Z",fill:"#1A4049"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"white"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"white"}),g.createElement("path",{d:"M31.4619 31.4624H36.7098V36.7103H31.4619V31.4624Z",fill:"#817AFE"}),g.createElement("path",{d:"M57.7549 31.9398V25.8884H60.4936V31.6414C60.4936 33.331 61.3912 34.4421 63.0809 34.4421C64.7705 34.4421 65.6681 33.331 65.6681 31.6414V25.8884H68.4229V31.9398C68.4229 34.8485 66.4762 36.9444 63.1199 36.9444C59.7016 36.9444 57.7549 34.8485 57.7549 31.9398ZM73.9004 36.708H71.1846V25.8884H73.9004V27.7066C74.263 27.0752 74.7866 26.5513 75.4178 26.1884C76.049 25.8254 76.7651 25.6363 77.4932 25.6405C80.209 25.6405 82.0065 27.6308 82.0065 30.3879V36.708H79.2517V30.9343C79.2517 29.224 78.2462 28.09 76.6208 28.09C74.9955 28.09 73.905 29.2378 73.905 30.9343L73.9004 36.708ZM84.8072 20.9688H87.5437V36.708H84.8072V20.9688ZM101.295 31.4508V31.7493H92.6975C92.8054 33.4389 94.0451 34.7337 95.8403 34.7337C97.5735 34.7337 98.2783 33.8567 98.4711 33.5583H101.166C100.994 34.6694 99.5203 37.0018 95.8403 37.0018C92.3348 37.0018 89.961 34.5661 89.961 31.3154C89.961 27.9568 92.3118 25.6267 95.6268 25.6267C98.9417 25.6267 101.295 27.9201 101.295 31.4508ZM92.7824 29.8668H98.4298C98.0235 28.4894 97.018 27.7295 95.6268 27.7295C94.1507 27.7272 93.1245 28.5193 92.7824 29.8645V29.8668ZM107.388 29.9288H110.939C110.939 28.6249 109.954 27.7915 108.352 27.7915C106.832 27.7915 106.286 28.6042 106.107 28.882H103.352C103.581 27.7479 104.933 25.6106 108.356 25.6106C111.713 25.6106 113.574 27.3645 113.574 29.9288V33.5858C113.574 34.2493 113.804 34.5041 114.428 34.5707V36.7722H113.574C112.183 36.7516 111.35 36.2373 111.049 35.2755C110.537 36.0675 109.383 36.9444 107.544 36.9444C104.998 36.9444 103.074 35.5119 103.074 33.2874C103.074 31.0629 104.715 29.9288 107.388 29.9288ZM110.939 32.7089V31.7906H107.838C106.554 31.7906 105.771 32.2497 105.771 33.2438C105.771 34.2929 106.756 34.9127 108.124 34.9127C109.656 34.9127 110.939 34.1643 110.939 32.7089ZM120.092 32.2819C117.718 32.112 116.113 30.9986 116.113 28.9026C116.113 26.871 117.973 25.5877 120.882 25.5877C124.784 25.5877 125.886 27.5987 126.185 28.6455H123.299C123.106 28.4159 122.486 27.663 120.861 27.663C119.557 27.663 118.873 28.09 118.873 28.7534C118.873 29.3526 119.332 29.7383 120.411 29.8875L122.248 30.0803C125.179 30.3351 126.38 31.4577 126.38 33.5858C126.38 35.6175 124.69 37.0087 121.375 37.0087C117.355 37.0087 116.051 34.6763 115.838 33.6731H118.767C118.875 33.9279 119.536 34.8921 121.375 34.8921C122.895 34.8921 123.6 34.3778 123.6 33.6937C123.6 33.0096 123.216 32.6239 121.993 32.4747C121.224 32.4104 120.84 32.3691 120.092 32.2819ZM131.21 36.708H128.494V20.9688H131.21V27.7066C131.572 27.0752 132.096 26.5513 132.727 26.1884C133.358 25.8254 134.075 25.6363 134.803 25.6405C137.518 25.6405 139.316 27.6308 139.316 30.3879V36.708H136.561V30.9343C136.561 29.224 135.556 28.09 133.93 28.09C132.305 28.09 131.214 29.2378 131.214 30.9343L131.21 36.708Z",fill:"#1A4049"}),g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"}),g.createElement("path",{d:"M32.001 11.0002C32.001 11.0002 33.001 12.5 36.001 14C39.7281 15.8636 44.001 12 44.001 12L57.1748 1.8667L32.001 11.0002Z",fill:"white",fillOpacity:.2}),g.createElement("mask",{id:"mask0_2239_6192",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:32,y:1,width:26,height:26},g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"})),g.createElement("g",{mask:"url(#mask0_2239_6192)"},g.createElement("rect",{x:39.2578,y:15.4331,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:35.8115,y:7.39209,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:9.68945,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:47.2998,y:1.64795,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:51.8945,y:8.54053,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:17.7305,width:5.74371,height:5.74371,fill:"#FFC800"})),g.createElement("path",{d:"M57.0708 -0.0906984L55.2288 1.72138L52.7073 1.18911L53.8435 3.54975L52.5881 5.82592L55.1321 5.4726L56.8782 7.4116L57.3142 4.83262L59.6484 3.75494L57.3742 2.51594L57.0708 -0.0906984Z",fill:"#817AFE"}),g.createElement("rect",{x:96,y:12,width:5,height:5,fill:"#817AFE"}),g.createElement("rect",{x:117,y:15,width:4,height:4,fill:"#FFC800"}),g.createElement("rect",{x:61,y:11,width:3,height:3,fill:"#8AD323"}),g.createElement("rect",{x:135,y:11,width:4,height:4,fill:"#FF458F"}),g.createElement("rect",{x:75,y:4,width:4,height:4,fill:"#FF458F"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_2239_6192"},g.createElement("rect",{width:150,height:57.6768,fill:"white"})))),uNt=e=>g.createElement("svg",{width:150,height:58,viewBox:"0 0 150 58",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{clipPath:"url(#clip0_2244_6496)"},g.createElement("path",{d:"M28.8381 47.2041C38.9811 47.2041 47.2036 38.9816 47.2036 28.8386C47.2036 18.6956 38.9811 10.4731 28.8381 10.4731C18.6952 10.4731 10.4727 18.6956 10.4727 28.8386C10.4727 38.9816 18.6952 47.2041 28.8381 47.2041Z",fill:"white"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"white"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"#1A4049"}),g.createElement("path",{d:"M31.4619 31.4624H36.7098V36.7103H31.4619V31.4624Z",fill:"#817AFE"}),g.createElement("path",{d:"M57.7549 31.9398V25.8884H60.4936V31.6414C60.4936 33.331 61.3912 34.4421 63.0809 34.4421C64.7705 34.4421 65.6681 33.331 65.6681 31.6414V25.8884H68.4229V31.9398C68.4229 34.8485 66.4762 36.9444 63.1199 36.9444C59.7016 36.9444 57.7549 34.8485 57.7549 31.9398ZM73.9004 36.708H71.1846V25.8884H73.9004V27.7066C74.263 27.0752 74.7866 26.5513 75.4178 26.1884C76.049 25.8254 76.7651 25.6363 77.4932 25.6405C80.209 25.6405 82.0065 27.6308 82.0065 30.3879V36.708H79.2517V30.9343C79.2517 29.224 78.2462 28.09 76.6208 28.09C74.9955 28.09 73.905 29.2378 73.905 30.9343L73.9004 36.708ZM84.8072 20.9688H87.5437V36.708H84.8072V20.9688ZM101.295 31.4508V31.7493H92.6975C92.8054 33.4389 94.0451 34.7337 95.8403 34.7337C97.5735 34.7337 98.2783 33.8567 98.4711 33.5583H101.166C100.994 34.6694 99.5203 37.0018 95.8403 37.0018C92.3348 37.0018 89.961 34.5661 89.961 31.3154C89.961 27.9568 92.3118 25.6267 95.6268 25.6267C98.9417 25.6267 101.295 27.9201 101.295 31.4508ZM92.7824 29.8668H98.4298C98.0235 28.4894 97.018 27.7295 95.6268 27.7295C94.1507 27.7272 93.1245 28.5193 92.7824 29.8645V29.8668ZM107.388 29.9288H110.939C110.939 28.6249 109.954 27.7915 108.352 27.7915C106.832 27.7915 106.286 28.6042 106.107 28.882H103.352C103.581 27.7479 104.933 25.6106 108.356 25.6106C111.713 25.6106 113.574 27.3645 113.574 29.9288V33.5858C113.574 34.2493 113.804 34.5041 114.428 34.5707V36.7722H113.574C112.183 36.7516 111.35 36.2373 111.049 35.2755C110.537 36.0675 109.383 36.9444 107.544 36.9444C104.998 36.9444 103.074 35.5119 103.074 33.2874C103.074 31.0629 104.715 29.9288 107.388 29.9288ZM110.939 32.7089V31.7906H107.838C106.554 31.7906 105.771 32.2497 105.771 33.2438C105.771 34.2929 106.756 34.9127 108.124 34.9127C109.656 34.9127 110.939 34.1643 110.939 32.7089ZM120.092 32.2819C117.718 32.112 116.113 30.9986 116.113 28.9026C116.113 26.871 117.973 25.5877 120.882 25.5877C124.784 25.5877 125.886 27.5987 126.185 28.6455H123.299C123.106 28.4159 122.486 27.663 120.861 27.663C119.557 27.663 118.873 28.09 118.873 28.7534C118.873 29.3526 119.332 29.7383 120.411 29.8875L122.248 30.0803C125.179 30.3351 126.38 31.4577 126.38 33.5858C126.38 35.6175 124.69 37.0087 121.375 37.0087C117.355 37.0087 116.051 34.6763 115.838 33.6731H118.767C118.875 33.9279 119.536 34.8921 121.375 34.8921C122.895 34.8921 123.6 34.3778 123.6 33.6937C123.6 33.0096 123.216 32.6239 121.993 32.4747C121.224 32.4104 120.84 32.3691 120.092 32.2819ZM131.21 36.708H128.494V20.9688H131.21V27.7066C131.572 27.0752 132.096 26.5513 132.727 26.1884C133.358 25.8254 134.075 25.6363 134.803 25.6405C137.518 25.6405 139.316 27.6308 139.316 30.3879V36.708H136.561V30.9343C136.561 29.224 135.556 28.09 133.93 28.09C132.305 28.09 131.214 29.2378 131.214 30.9343L131.21 36.708Z",fill:"white"}),g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"}),g.createElement("path",{d:"M32.001 11.0002C32.001 11.0002 33.001 12.5 36.001 14C39.7281 15.8636 44.001 12 44.001 12L57.1748 1.8667L32.001 11.0002Z",fill:"white",fillOpacity:.2}),g.createElement("mask",{id:"mask0_2244_6496",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:32,y:1,width:26,height:26},g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"})),g.createElement("g",{mask:"url(#mask0_2244_6496)"},g.createElement("rect",{x:39.2578,y:15.4331,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:35.8115,y:7.39209,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:9.68945,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:47.2998,y:1.64795,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:51.8945,y:8.54053,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:17.7305,width:5.74371,height:5.74371,fill:"#FFC800"})),g.createElement("path",{d:"M57.0708 -0.0906984L55.2288 1.72138L52.7073 1.18911L53.8435 3.54975L52.5881 5.82592L55.1321 5.4726L56.8782 7.4116L57.3142 4.83262L59.6484 3.75494L57.3742 2.51594L57.0708 -0.0906984Z",fill:"#817AFE"}),g.createElement("rect",{x:96,y:12,width:5,height:5,fill:"#817AFE"}),g.createElement("rect",{x:117,y:15,width:4,height:4,fill:"#FFC800"}),g.createElement("rect",{x:61,y:11,width:3,height:3,fill:"#8AD323"}),g.createElement("rect",{x:135,y:11,width:4,height:4,fill:"#FF458F"}),g.createElement("rect",{x:75,y:4,width:4,height:4,fill:"#FF458F"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_2244_6496"},g.createElement("rect",{width:150,height:57.6768,fill:"white"})))),dNt=e=>g.createElement("svg",{id:"bg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 251.43 251.03",...e},g.createElement("defs",null,g.createElement("style",null,".cls-1{fill:#1a4049;}.cls-2{fill:#fff;}.cls-3{fill:#817afe;}")),g.createElement("circle",{className:"cls-1",cx:125.71,cy:125.31,r:80}),g.createElement("polygon",{className:"cls-2",points:"137.14 91.03 137.14 113.88 137.14 136.74 160 136.74 160 113.88 160 91.03 137.14 91.03"}),g.createElement("polygon",{className:"cls-2",points:"114.29 113.88 114.29 91.03 91.43 91.03 91.43 113.88 91.43 136.74 91.43 159.6 114.29 159.6 137.14 159.6 137.14 136.74 114.29 136.74 114.29 113.88"}),g.createElement("rect",{className:"cls-3",x:137.14,y:136.74,width:22.86,height:22.86})),pNt=v(K,{shouldForwardProp:e=>e!=="mode"&&e!=="admin"})(({theme:e,mode:t,admin:n})=>({backgroundColor:n?e.palette.background.application:e.palette.background.paper,borderRight:`1px solid ${e.palette.divider}`,alignSelf:"stretch",display:"flex",flexDirection:"column",zIndex:1,overflowAnchor:"none",position:"sticky",top:0,height:"100vh",minWidth:t==="full"?e.spacing(34):"auto",width:t==="full"?e.spacing(34):"auto"})),fNt=v(K,{shouldForwardProp:e=>e!=="admin"})(({theme:e,admin:t})=>({position:"sticky",top:0,width:"100%",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),backgroundColor:t?e.palette.background.application:e.palette.background.paper,zIndex:2})),hNt=v(K)(({theme:e})=>({flex:1,width:"100%",overflowY:"auto",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),display:"flex",flexDirection:"column",gap:e.spacing(2)})),gNt=v(K,{shouldForwardProp:e=>e!=="admin"})(({theme:e,admin:t})=>({position:"sticky",bottom:0,width:"100%",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),backgroundColor:t?e.palette.background.application:e.palette.background.paper,borderTop:`1px solid ${e.palette.divider}`,zIndex:2})),cU=v(ft)(({theme:e})=>Uu(e)),mNt=v(Kg)({width:"150px"}),yNt=v(ey)({width:"150px"}),xNt=v(cNt)({width:"150px"}),vNt=v(dNt)(({theme:e})=>({width:"58px",marginTop:e.spacing(.5),margin:"0 auto"})),bNt=v(Cte)(({theme:e})=>({width:"37px",marginTop:e.spacing(1),margin:"0 auto"})),CNt=({NewInUnleash:e})=>{const{routes:t}=y8(),n=Jae("celebrateUnleashFrontend"),{showOnlyAdminMenu:r}=fR(),[o,s]=ZLt(),[a,l]=EZ(),c=lNt(),[u,d]=g.useState(c);return g.useEffect(()=>{d(c)},[c]),i.jsxs(pNt,{mode:o,admin:r,children:[i.jsx(fNt,{admin:r,children:i.jsx(te,{condition:o==="full",show:i.jsx(cU,{to:"/",sx:t3,"aria-label":"Home",children:i.jsx(Ra,{darkmode:i.jsx(te,{condition:n,show:i.jsx(uNt,{}),elseShow:i.jsx(mNt,{"aria-label":"Unleash logo"})}),lightmode:i.jsx(te,{condition:n,show:i.jsx(xNt,{}),elseShow:i.jsx(yNt,{"aria-label":"Unleash logo"})})})}),elseShow:i.jsx(cU,{to:"/",sx:t3,"aria-label":"Home",children:i.jsx(Ra,{darkmode:i.jsx(bNt,{}),lightmode:i.jsx(vNt,{})})})})}),i.jsx(hNt,{children:i.jsx(te,{condition:!r,show:i.jsxs(i.Fragment,{children:[i.jsx(Wie,{mode:o,setMode:s,onClick:d,activeItem:u}),i.jsx(iV,{onClick:d,mode:o,onSetFullMode:()=>s("full"),activeItem:u,onExpandChange:p=>{l("admin",p)},expanded:a.includes("admin"),routes:t.adminRoutes})]}),elseShow:i.jsx(iV,{onClick:d,mode:o,onSetFullMode:()=>s("full"),activeItem:u,onExpandChange:p=>{l("admin",p)},expanded:a.includes("admin"),routes:t.adminRoutes})})}),i.jsxs(gNt,{admin:r,children:[e?i.jsx(e,{mode:o,onMiniModeClick:()=>s("full")}):null,i.jsx(iNt,{mode:o,onChange:()=>{s(o==="full"?"mini":"full")}})]})]})},wNt=v("img")(()=>({maxWidth:"100%"})),SNt=[{label:"Release templates",summary:"Put your rollouts on autopilot",preview:i.jsx(wNt,{src:Do(qie),alt:"Release templates preview"}),appLink:"?splash=release-management-v3",docsLink:"https://docs.getunleash.io/reference/release-templates",filter:{enterpriseOnly:!0,versionLowerThan:"7.5.0"},beta:!1,modal:!1}];var LO={},jNt=je;Object.defineProperty(LO,"__esModule",{value:!0});var cle=LO.default=void 0,ENt=jNt(Ee()),kNt=i,TNt=(0,ENt.default)((0,kNt.jsx)("path",{d:"m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}),"NewReleases");cle=LO.default=TNt;const RNt=v("span")(({theme:e})=>({position:"relative",display:"flex","::before":{content:'" "',position:"absolute",borderRadius:"50%",top:"15%",left:"15%",width:"70%",height:"70%",display:"block",backgroundColor:e.palette.common.white}})),ANt=v(cle)(({theme:e})=>({color:e.palette.primary.main,fontSize:"1.3em",position:"relative"})),PNt=v("article")(({theme:e})=>({backgroundColor:e.palette.inverse.main,color:e.palette.inverse.contrastText,padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusLarge,position:"relative",width:"290px","&:has(.read-more:focus-visible)":{outline:`2px solid ${e.palette.primary.main}`,outlineOffset:"2px"}})),_Nt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",rowGap:e.spacing(.75)})),INt=v(Mt)(({theme:e})=>({position:"absolute",top:-6,right:-6,borderRadius:"50%",padding:e.spacing(.25),border:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.elevation1,color:e.palette.text.secondary,zIndex:1,":hover":{backgroundColor:e.palette.background.elevation2}})),ONt=v(J)(({theme:e})=>({display:"flex",flexFlow:"row nowrap",alignItems:"center",columnGap:".5ch",fontSize:e.typography.caption.fontSize})),MNt=v("button")(({theme:e})=>({border:"none",backgroundColor:"transparent",textAlign:"start",color:"inherit",":focus-visible":{outline:"none"},"::after":{content:'""',position:"absolute",inset:0,zIndex:1,cursor:"pointer"}})),$Nt=({item:e})=>{const t=$t(),[n,r]=ai("new-in-unleash-seen:v2",new Set),o=({label:d})=>{r(new Set([...n,d]))},[s,a]=g.useState(!1),[l,c]=g.useState(!1);g.useEffect(()=>{const d=setTimeout(()=>{a(!0)},500);return()=>clearTimeout(d)},[]);const u=()=>{e.modal===!1&&e.appLink?t(e.appLink):c(!0)};return i.jsxs(i.Fragment,{children:[i.jsx(i8e,{sx:d=>({zIndex:d.zIndex.modal}),open:!n.has(e.label)&&s,message:"New in Unleash",onClose:(d,p)=>{p==="escapeKeyDown"&&o(e)},TransitionComponent:eX,children:i.jsx(PNt,{children:i.jsxs(_Nt,{children:[i.jsxs(ONt,{component:"p",variant:"body2",children:[i.jsx(RNt,{children:i.jsx(ANt,{})}),"New in Unleash"]}),i.jsx(J,{className:"read-more",component:MNt,onClick:u,variant:"body2",fontWeight:"bold",children:e.summary}),i.jsx(INt,{"aria-label":"close",onClick:()=>{o(e)},size:"small",children:i.jsx(bo,{fontSize:"inherit"})})]})})}),i.jsx(Uie,{open:l,onClose:()=>{c(!1)},title:e.label,longDescription:e.longDescription,appLink:e.appLink,docsLink:e.docsLink,preview:e.preview,beta:e.beta})]})},DNt=({isEnterprise:e,isEnabled:t,version:n})=>({filter:{enterpriseOnly:r,flag:o,versionLowerThan:s}})=>r&&!e()||o&&!t(o)?!1:ore(n,s),LNt=e=>{const{isEnterprise:t,uiConfig:{version:n}}=ut(),r=UQ();return e.toReversed().find(DNt({isEnterprise:t,isEnabled:r,version:n}))},NNt=()=>{const e=LNt(SNt);return e?i.jsx($Nt,{item:e}):null},FNt=v(Uo)(()=>({display:"flex",flexDirection:"column",flexGrow:1,position:"relative"})),BNt=v(Uo)(({theme:e})=>({minWidth:0,maxWidth:"1512px",margin:"0 auto",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(1856)]:{width:"100%"},[e.breakpoints.down(1856)]:{marginLeft:e.spacing(7),marginRight:e.spacing(7)},[e.breakpoints.down("lg")]:{maxWidth:"1250px",paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.down(1024)]:{marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"}})),zNt=v("div")(({theme:e})=>({margin:e.spacing(0,"auto"),flexGrow:1,width:"100%",backgroundColor:e.palette.background.application,position:"relative",display:"flex",flexDirection:"column"})),uU=v("img")(()=>({display:"block",position:"fixed",bottom:0,right:0,width:400,pointerEvents:"none",userSelect:"none",zIndex:0})),HNt=v("main")(({theme:e})=>({padding:e.spacing(0,0,6.5,0),position:"relative",[e.breakpoints.down("md")]:{padding:e.spacing(0,1.5,6.5,1.5)},zIndex:200})),WNt=v(K)(()=>({display:"flex",marginTop:0})),VNt=v(K)(()=>({display:"flex",flexDirection:"column",flexGrow:1,minWidth:0})),UNt=v(K)(()=>({display:"flex",flexDirection:"column",minHeight:"100vh",flexShrink:0})),GNt=v(K)(()=>({flex:1,display:"flex",flexDirection:"column",minHeight:0})),qNt=v(BNt)(()=>({display:"flex",flexDirection:"column",flex:1})),YNt=g.forwardRef(({children:e},t)=>{const n=wo("projectId"),{isChangeRequestConfiguredInAnyEnv:r}=vl(n||""),o=Bt(),s=Nn(o.breakpoints.down("lg")),a=Er("gtmReleaseManagement");return i.jsxs(Zjt,{children:[i.jsx(FNt,{children:i.jsxs(zNt,{children:[i.jsxs(WNt,{children:[i.jsx(te,{condition:!s,show:i.jsx(CNt,{NewInUnleash:a?void 0:Yie})}),i.jsxs(VNt,{children:[i.jsx(te,{condition:!!(n&&r()),show:i.jsx(JLt,{project:n||""})}),i.jsxs(UNt,{children:[i.jsx(_Pt,{}),i.jsx(GNt,{children:i.jsxs(qNt,{children:[i.jsx(UPt,{}),i.jsxs(HNt,{ref:t,children:[i.jsx(WPt,{}),e]})]})})]}),i.jsx(NPt,{})]})]}),i.jsx(Ra,{darkmode:i.jsx(uU,{style:{opacity:.06},src:Do(bV),alt:""}),lightmode:i.jsx(uU,{src:Do(bV),alt:""})})]})}),a&&i.jsx(NNt,{})]})}),KNt=({isStandalone:e,children:t})=>i.jsx(te,{condition:e===!0,show:t,elseShow:i.jsx(YNt,{children:t})}),ule=()=>{const{pathname:e,search:t}=jo(),r=`/login?redirect=${encodeURIComponent(e+t)}`;return i.jsx(I1,{to:r,replace:!0})},XNt=({route:e})=>{const{user:t}=gs();return!!!(t!=null&&t.id)&&e.type==="protected"?i.jsx(ule,{}):i.jsx(e.component,{})},JNt=({children:e})=>{const{refetchUser:t}=gs(),n=r=>{r instanceof dZ&&r.status===401&&t()};return i.jsx(NSe,{value:{onError:n},children:e})},ZNt=W5()(e=>({container:{alignItems:"center",background:e.mode==="light"?"#201E42":e.palette.background.paper,borderRadius:e.shape.borderRadiusMedium,boxShadow:e.boxShadows.popup,display:"flex",flexDirection:"row",gap:e.spacing(2),margin:"0 0.8rem",maxWidth:"450px",padding:e.spacing(1),paddingLeft:e.spacing(2),zIndex:e.zIndex.snackbar,color:e.palette.common.white},starting:{opacity:0},headerStyles:{fontSize:e.typography.body1.fontSize,fontWeight:"normal",margin:0,maxHeight:"75vh",overflowY:"auto","&::first-letter":{textTransform:"uppercase"}},anim:{animation:"$drop 10s 3s"},checkMark:{marginLeft:e.spacing(1)},buttonStyle:{color:e.palette.common.white,svg:{fontSize:"1em"}},"@keyframes drop":{"0%":{opacity:"0%",top:"0%"},"10%":{opacity:"100%"},"100%":{top:"100%"}}}));var NO={},QNt=je;Object.defineProperty(NO,"__esModule",{value:!0});var dle=NO.default=void 0,eFt=QNt(Ee()),tFt=i,nFt=(0,eFt.default)((0,tFt.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"Warning");dle=NO.default=nFt;const rFt=v(b0)(({theme:e})=>({color:e.mode==="light"?e.palette.secondary.border:e.palette.primary.main})),oFt=v(dle)(({theme:e})=>({color:e.mode==="light"?e.palette.warning.border:e.palette.warning.main})),sFt=({type:e})=>e==="error"?i.jsx(oFt,{titleAccess:"Error"}):i.jsx(rFt,{}),iFt=({text:e,type:t})=>{const{setToast:n}=g.useContext(Ef),{classes:r}=ZNt(),o=()=>{n(s=>({...s,show:!1}))};return i.jsxs("div",{className:Lu(r.container,"dropdown-outline"),children:[i.jsx(sFt,{type:t,className:r.checkMark}),i.jsx("h3",{className:r.headerStyles,children:i.jsx(Ep,{children:e})}),i.jsx(Rt,{title:"Close",arrow:!0,children:i.jsx(Mt,{onClick:o,className:r.buttonStyle,size:"small",children:i.jsx(bo,{})})})]})},aFt=()=>{const{toastData:e,setToast:t}=g.useContext(Ef),n=()=>{t(o=>({...o,show:!1}))};g.useEffect(()=>{if(!e.autoHideDuration)return;const o=setTimeout(()=>{n()},e.autoHideDuration);return()=>{clearTimeout(o)}},[e==null?void 0:e.show]);const r=g.useMemo(()=>({start:{...OX,right:0,left:0,margin:"0 auto",width:"fit-content"},enter:MX,leave:ebe}),[]);return i.jsx(Pk,{children:i.jsx(Uk,{mounted:!!(e!=null&&e.show),start:r.start,enter:r.enter,leave:r.leave,children:i.jsx(iFt,{...e})})})};var FO={},lFt=je;Object.defineProperty(FO,"__esModule",{value:!0});var ple=FO.default=void 0,cFt=lFt(Ee()),uFt=i,dFt=(0,cFt.default)((0,uFt.jsx)("path",{d:"M8 5v14l11-7z"}),"PlayArrow");ple=FO.default=dFt;const pFt="https://cdn.getunleash.io/impact-metrics.mp4",fFt="https://docs.getunleash.io/guides/getting-started-release-management",hFt=v(K)(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,display:"flex",flexDirection:"column",boxShadow:e.shadows[5],maxWidth:e.spacing(100),width:"100%",maxHeight:"90vh",overflow:"hidden",margin:e.spacing(2),position:"relative",zIndex:1})),gFt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1,3),borderBottom:`1px solid ${e.palette.divider}`})),mFt=v(Mt)(({theme:e})=>({padding:e.spacing(.5)})),yFt=v(ey)(({theme:e})=>({height:e.spacing(6)})),xFt=v(Kg)(({theme:e})=>({height:e.spacing(6)})),vFt=v(K)(({theme:e})=>({padding:`${e.spacing(3)} ${e.spacing(3)} ${e.spacing(3.5)} ${e.spacing(3)}`,overflowY:"auto",flex:1})),bFt=v(J)(({theme:e})=>({fontSize:e.typography.h1.fontSize,fontWeight:e.typography.fontWeightBold,color:e.palette.text.primary,marginBottom:e.spacing(1)})),CFt=v(J)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(3)})),wFt=v(K)(({theme:e})=>({position:"relative",width:"100%",paddingBottom:"56.25%",marginBottom:e.spacing(4),borderRadius:e.shape.borderRadiusLarge,overflow:"hidden",backgroundColor:e.palette.background.elevation1})),SFt=v("video")({position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover"}),jFt=v("button")({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:"none",background:"transparent",padding:0,outline:"none","&:focus-visible > div":{outline:"2px solid white",outlineOffset:"2px"}}),EFt=v(K)(({theme:e})=>({width:e.spacing(10),height:e.spacing(10),borderRadius:"50%",backgroundColor:e.palette.primary.main,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:e.shadows[4],transition:"transform 0.2s ease, box-shadow 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:e.shadows[8]},"& svg":{fontSize:e.spacing(5),color:e.palette.common.white}})),kFt=v(K)(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(2)})),TFt=({onClose:e})=>{const{trackEvent:t}=zt(),n=g.useRef(null),[r,o]=g.useState(!1);g.useEffect(()=>{t("release-management-splash",{props:{eventType:"displayed"}})},[]);const s=()=>{t("release-management-splash",{props:{eventType:"getting-started-click"}}),window.open(fFt,"_blank","noopener,noreferrer"),e()},a=()=>{var l;t("release-management-splash",{props:{eventType:"play-video"}}),o(!0),(l=n.current)==null||l.play()};return i.jsxs(hFt,{children:[i.jsxs(gFt,{children:[i.jsx(Ra,{darkmode:i.jsx(xFt,{"aria-label":"Unleash"}),lightmode:i.jsx(yFt,{"aria-label":"Unleash"})}),i.jsx(Rt,{title:"Close",arrow:!0,children:i.jsx(mFt,{onClick:e,size:"small","aria-label":"close",children:i.jsx(bo,{})})})]}),i.jsxs(vFt,{children:[i.jsx(bFt,{variant:"h1",children:"Put your rollouts on autopilot"}),i.jsx(CFt,{children:"Define your milestones once and reuse everywhere. Add automations and watch them go from 5% canary to full release, while safeguards catch issues before your users do."}),i.jsxs(wFt,{children:[i.jsx(SFt,{ref:n,src:pFt,controls:r,preload:"metadata"}),!r&&i.jsx(jFt,{onClick:a,"aria-label":"Play video",type:"button",children:i.jsx(EFt,{children:i.jsx(ple,{})})})]}),i.jsxs(kFt,{children:[i.jsx($e,{variant:"contained",color:"primary",onClick:s,children:"View the getting started guide"}),i.jsx($e,{variant:"text",onClick:e,children:"Cancel"})]})]})]})},dU=250,RFt=v(F5)({backgroundColor:"rgba(0, 0, 0, 0.5)"}),AFt=v("div")({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",outline:"none"}),PFt=e=>Jre.includes(e),_Ft=()=>{const[e,t]=Mp(),{user:n}=gs(),{splash:r,refetchSplash:o}=__(),{setSplashSeen:s}=R_(),[a,l]=g.useState(!1),c=Jae("releaseManagementV3Splash"),u=e.get("splash"),d=u?PFt(u):!1;g.useEffect(()=>{if(!n||!r||u||n.isAPI||a)return;const m=!!r["release-management-v3"];c&&!m&&(e.set("splash","release-management-v3"),t(e,{replace:!0}))},[n,r,u,e,t,c,a]);const p=()=>{const m=u,y=d;l(!0),e.delete("splash"),t(e,{replace:!0}),m&&y&&s(m).then(()=>o()).catch(console.warn)};if(!u)return null;const h=(()=>{switch(u){case"release-management-v3":return i.jsx(TFt,{onClose:p});default:return null}})();return h?i.jsx(Hg,{open:!!u,onClose:p,closeAfterTransition:!0,slots:{backdrop:RFt},slotProps:{backdrop:{timeout:dU}},sx:{zIndex:m=>m.zIndex.modal},children:i.jsx(zg,{timeout:dU,in:!!u,children:i.jsx(AFt,{children:h})})}):null};var BO={},IFt=je;Object.defineProperty(BO,"__esModule",{value:!0});var fle=BO.default=void 0,OFt=IFt(Ee()),MFt=i,$Ft=(0,OFt.default)((0,MFt.jsx)("path",{d:"M12 7c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1s-1-.45-1-1V8c0-.55.45-1 1-1zm-.01-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm1-3h-2v-2h2v2z"}),"ErrorOutlineRounded");fle=BO.default=$Ft;const DFt=v(Ep)(({theme:e})=>({"h1, h2, h3":{margin:e.spacing(2,0)}})),LFt=({open:e,setOpen:t,title:n,children:r})=>{const o=()=>{t(!1)};return i.jsx(Mn,{title:n,open:e,secondaryButtonText:"Close",onClose:o,children:i.jsx(K,{onClick:s=>{s.target.nodeName==="A"&&o()},children:typeof r=="string"?i.jsx(DFt,{children:r}):r})})},w2="info",NFt=v("aside",{shouldForwardProp:e=>e!=="variant"&&e!=="inline"&&e!=="maxHeight"})(({theme:e,variant:t,inline:n,maxHeight:r})=>{var o,s,a;return{display:"flex",alignItems:"center",justifyContent:"center",padding:e.spacing(1),gap:e.spacing(1),width:"100%",...n?{border:"1px solid",borderRadius:e.shape.borderRadiusMedium}:{borderBottom:"1px solid"},...r&&{maxHeight:r,overflow:"auto"},borderColor:((o=e.palette[t])==null?void 0:o.border)??e.palette[w2].border,background:((s=e.palette[t])==null?void 0:s.light)??e.palette[w2].light,color:((a=e.palette[t])==null?void 0:a.dark)??e.palette[w2].dark,fontSize:e.fontSizes.smallBody}}),FFt=v("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:t})=>{var n;return{display:"flex",alignItems:"center",color:((n=e.palette[t])==null?void 0:n.main)??e.palette[w2].main}}),xf=({banner:e,inline:t,maxHeight:n})=>{const[r,o]=g.useState(!1),{message:s,variant:a=w2,sticky:l,icon:c,link:u,linkText:d="More info",linkClicked:p,plausibleEvent:f,dialogTitle:h,dialog:m}=e,y=()=>{o(!0),p==null||p()},b=i.jsxs(NFt,{variant:a,inline:t,maxHeight:n,children:[i.jsx(FFt,{variant:a,children:i.jsx(zFt,{icon:c,variant:a})}),i.jsx(Ep,{children:s}),i.jsx(HFt,{link:u,plausibleEvent:f,openDialog:y,children:d}),i.jsx(LFt,{open:r,setOpen:o,title:h||d,children:m})]});return l?i.jsx(MO,{children:b}):b},BFt={warning:i.jsx(py,{}),info:i.jsx(yi,{}),error:i.jsx(fle,{}),success:i.jsx(l3,{})},zFt=({icon:e,variant:t})=>e==="none"?null:e?i.jsx(Ta,{children:e}):BFt[t]??i.jsx(yi,{}),HFt=({link:e,plausibleEvent:t,openDialog:n,children:r})=>{const o=$t(),s=zt();if(!e)return null;const a=e==="dialog",l=e.startsWith("/"),c=()=>{t&&s.trackEvent("banner",{props:{event:t}})};return a?i.jsx(Sn,{onClick:()=>{c(),n()},children:r}):l?i.jsx(Sn,{onClick:()=>{c(),o(e)},children:r}):i.jsx(Sn,{href:e,target:"_blank",rel:"noreferrer",onClick:c,children:r})},SC="**Maintenance mode!** During maintenance mode, any changes made will not be saved and you may receive an error. We apologize for any inconvenience this may cause.",WFt=()=>{var n;const e=Er("maintenanceMode"),t=y6(e);return typeof e=="boolean"?SC:((n=e==null?void 0:e.payload)==null?void 0:n.type)===zie.STRING&&t||SC},VFt=()=>{const e=WFt();return i.jsx(xf,{banner:{message:e,variant:"error"}})},UFt="api/admin/banners",GFt=()=>{const{isEnterprise:e}=ut(),{data:t,error:n,mutate:r}=Ts(e(),{banners:[]},yt(UFt),qFt);return g.useMemo(()=>({banners:(t==null?void 0:t.banners)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},qFt=e=>fetch(e).then(en("Banners")).then(t=>t.json()),YFt=()=>{const{banners:e}=GFt();return i.jsx(i.Fragment,{children:e.filter(({enabled:t})=>t).map(t=>i.jsx(xf,{banner:t},t.id))})},KFt=()=>{const{uiConfig:e}=ut(),t=y6(e.flags.messageBanner),n=y6(e.flags.banner),r=t||n||[],o=Array.isArray(r)?r:[r];return i.jsx(i.Fragment,{children:o.map(s=>i.jsx(xf,{banner:s},s.message))})},XFt={isValid:!0,message:"",loading:!1},JFt=()=>{const{data:e,error:t,mutate:n}=f0(XFt,yt("api/admin/license/check"),hle);return{isValid:e==null?void 0:e.isValid,message:e==null?void 0:e.message,messageType:e==null?void 0:e.messageType,loading:!t&&!e,reCheckLicense:()=>n(),error:t}},lYt=()=>{const{data:e,error:t,mutate:n}=f0(void 0,yt("api/admin/license"),hle);return{license:e,loading:!t&&!e,refetchLicense:()=>n(),error:t}},hle=e=>fetch(e).then(en("License")).then(t=>t.json()),ZFt=()=>{const{isEnterprise:e}=ut(),t=JFt();if(e()&&t&&!t.loading&&!t.error)if(t.isValid){if(t.message){const n={message:t.message,variant:QFt(t.messageType),sticky:!0};return i.jsx(xf,{banner:n},n.message)}}else{const n={message:t.message||"You have an invalid Unleash license.",variant:"error",sticky:!0};return i.jsx(xf,{banner:n},n.message)}return null};function QFt(e){if(e)switch(e){case"warn":return"warning";default:return e}}const zO=e=>g.createElement("svg",{width:45,height:61,viewBox:"0 0 45 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{opacity:.789,d:"M29.701 38.852C25.591 37.941 24.679 37.007 23.764 32.915C23.664 32.469 23.764 32 23.306 32C22.848 32 22.937 32.469 22.848 32.915C21.937 37.044 21.022 37.94 16.911 38.852C16.465 38.952 16 38.852 16 39.31C16 39.768 16.465 39.679 16.911 39.768C21.021 40.679 21.936 41.613 22.848 45.705C22.948 46.151 22.848 46.62 23.306 46.62C23.764 46.62 23.675 46.151 23.764 45.705C24.679 41.595 25.609 40.68 29.701 39.768C30.147 39.668 30.616 39.768 30.616 39.31C30.616 38.852 30.148 38.952 29.701 38.852Z",fill:"white"}),g.createElement("path",{opacity:.4,d:"M10.686 52.1838C7.46503 51.4728 6.75403 50.7558 6.06003 47.5578C5.97903 47.2048 6.06003 46.8408 5.70103 46.8408C5.34203 46.8408 5.41803 47.2048 5.34203 47.5578C4.62503 50.7788 3.90803 51.4958 0.716026 52.1838C0.369026 52.2648 -0.000976562 52.1838 -0.000976562 52.5428C-0.000976562 52.9018 0.369026 52.8258 0.716026 52.9018C3.93703 53.6188 4.65403 54.3358 5.34203 57.5568C5.41703 57.9038 5.34203 58.2738 5.70103 58.2738C6.06003 58.2738 5.97903 57.9038 6.06003 57.5568C6.77703 54.3358 7.48803 53.6188 10.686 52.9018C11.039 52.8268 11.403 52.9018 11.403 52.5428C11.403 52.1838 11.039 52.2648 10.686 52.1838Z",fill:"white"}),g.createElement("path",{opacity:.739,d:"M34.19 12.595C31.434 11.981 30.825 11.37 30.209 8.612C30.142 8.312 30.209 8 29.902 8C29.595 8 29.662 8.313 29.595 8.612C28.983 11.37 28.37 11.977 25.614 12.595C25.314 12.66 25 12.595 25 12.902C25 13.209 25.315 13.142 25.614 13.202C28.37 13.816 28.979 14.427 29.595 17.185C29.662 17.485 29.595 17.797 29.902 17.797C30.209 17.797 30.142 17.484 30.209 17.185C30.821 14.427 31.434 13.82 34.19 13.202C34.49 13.137 34.804 13.202 34.804 12.902C34.804 12.602 34.49 12.66 34.19 12.595Z",fill:"white"}),g.createElement("path",{opacity:.7,d:"M38.666 55.832C36.366 55.32 35.859 54.81 35.345 52.51C35.289 52.261 35.345 52 35.089 52C34.833 52 34.889 52.261 34.833 52.51C34.323 54.81 33.811 55.317 31.512 55.832C31.263 55.886 31 55.832 31 56.088C31 56.344 31.263 56.288 31.512 56.342C33.812 56.854 34.319 57.364 34.833 59.664C34.889 59.913 34.833 60.174 35.089 60.174C35.345 60.174 35.289 59.913 35.345 59.664C35.855 57.364 36.367 56.857 38.666 56.342C38.917 56.287 39.178 56.342 39.178 56.088C39.178 55.834 38.917 55.886 38.666 55.832Z",fill:"white"}),g.createElement("path",{opacity:.855,d:"M19.336 2.668C17.736 2.312 17.382 1.95598 17.024 0.35498C16.985 0.18098 17.024 0 16.846 0C16.668 0 16.707 0.18198 16.668 0.35498C16.313 1.95498 15.956 2.309 14.356 2.668C14.182 2.706 14 2.66798 14 2.84598C14 3.02398 14.183 2.98498 14.356 3.02298C15.956 3.37898 16.31 3.735 16.668 5.336C16.707 5.51 16.668 5.69098 16.846 5.69098C17.024 5.69098 16.985 5.509 17.024 5.336C17.379 3.736 17.736 3.38198 19.336 3.02298C19.511 2.98498 19.692 3.02298 19.692 2.84598C19.692 2.66898 19.511 2.706 19.336 2.668Z",fill:"white"}),g.createElement("path",{opacity:.855,d:"M11.336 25.668C9.736 25.312 9.382 24.956 9.024 23.355C8.985 23.181 9.024 23 8.846 23C8.668 23 8.707 23.182 8.668 23.355C8.313 24.955 7.956 25.309 6.356 25.668C6.182 25.706 6 25.668 6 25.846C6 26.024 6.183 25.985 6.356 26.023C7.956 26.379 8.31 26.735 8.668 28.336C8.707 28.51 8.668 28.691 8.846 28.691C9.024 28.691 8.985 28.509 9.024 28.336C9.379 26.736 9.736 26.382 11.336 26.023C11.511 25.985 11.692 26.023 11.692 25.846C11.692 25.669 11.511 25.706 11.336 25.668Z",fill:"white"}),g.createElement("path",{opacity:.5,d:"M44.336 28.668C42.736 28.312 42.382 27.956 42.024 26.355C41.985 26.181 42.024 26 41.846 26C41.668 26 41.707 26.182 41.668 26.355C41.313 27.955 40.956 28.309 39.356 28.668C39.182 28.706 39 28.668 39 28.846C39 29.024 39.183 28.985 39.356 29.023C40.956 29.379 41.31 29.735 41.668 31.336C41.707 31.51 41.668 31.691 41.846 31.691C42.024 31.691 41.985 31.509 42.024 31.336C42.379 29.736 42.736 29.382 44.336 29.023C44.511 28.985 44.692 29.023 44.692 28.846C44.692 28.669 44.511 28.706 44.336 28.668Z",fill:"white"})),eBt=v(tu)(({theme:e})=>({position:"fixed",bottom:0,right:0,width:"100%",maxWidth:e.spacing(30),zIndex:e.zIndex.sticky,boxShadow:e.boxShadows.popup,"&&&":{borderRadius:0,borderTopLeftRadius:e.shape.borderRadiusLarge,borderTopRightRadius:e.shape.borderRadiusLarge},"&:before":{display:"none"},"& .expand-icon":{position:"absolute",right:e.spacing(2),fontSize:e.fontSizes.mainHeader,transition:"transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",transform:"rotate(180deg)"},"&.Mui-expanded .expand-icon":{transform:"rotate(0)"}})),tBt=v(ru)(({theme:e})=>({"& .MuiAccordionSummary-content":{flexDirection:"column",alignItems:"center"},backgroundColor:e.palette.web.main,color:e.palette.web.contrastText,borderTopLeftRadius:e.shape.borderRadiusLarge,borderTopRightRadius:e.shape.borderRadiusLarge,height:91})),nBt=v(zO)({position:"absolute",left:6,top:-24}),rBt=v(Da)(({theme:e})=>({color:e.palette.primary.contrastText})),oBt=v("div")({display:"flex",alignItems:"center"}),sBt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,marginTop:e.spacing(.5),marginBottom:e.spacing(.5)})),iBt=v("div")(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:e.spacing(1.5)})),aBt=v(z5)(({theme:e})=>({width:"100%",height:e.spacing(1),borderRadius:e.shape.borderRadius,[`&.${XD.colorPrimary}`]:{backgroundColor:Wt(e.palette.web.contrastText,.1)},[`& .${XD.bar}`]:{borderRadius:e.shape.borderRadius,backgroundColor:e.palette.web.contrastText}})),lBt=v("li",{shouldForwardProp:e=>e!=="selected"&&e!=="completed"})(({theme:e,selected:t,completed:n})=>({padding:e.spacing(1),cursor:"pointer",display:"flex",alignItems:"center",marginTop:e.spacing(1),borderRadius:e.shape.borderRadius,gap:e.spacing(1),backgroundColor:e.palette.background.elevation2,...t&&{backgroundColor:e.palette.secondary.light,fontWeight:e.typography.fontWeightBold,outline:`1px solid ${e.palette.primary.main}`},...n&&{backgroundColor:e.palette.background.elevation1,textDecoration:"line-through"}})),cBt=v(b0)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.bodySize})),uBt=v(ZI)(({theme:e})=>({color:e.palette.neutral.main,fontSize:e.fontSizes.bodySize})),dBt=v(Da)(({theme:e})=>({transform:"rotate(-90deg)",fontSize:e.fontSizes.bodySize})),pBt=v($e)(({theme:e})=>({width:"100%",marginTop:e.spacing(2),"&&&":{fontSize:e.fontSizes.smallBody}})),fBt=({expanded:e,setExpanded:t,stepsCompletion:n,currentTopic:r,setCurrentTopic:o,topics:s,onWelcome:a})=>{const l=n.reduce((d,p)=>d+(p||0),0),c=s.flatMap(({steps:d})=>d).length,u=l/c*100;return i.jsxs(eBt,{expanded:e,onChange:()=>t(d=>!d),children:[i.jsxs(tBt,{children:[i.jsx(nBt,{}),i.jsxs(oBt,{children:[i.jsx(J,{fontWeight:"bold",children:"Unleash demo"}),i.jsx(rBt,{className:"expand-icon"})]}),i.jsx(sBt,{children:"Complete all steps to finish demo"}),i.jsxs(iBt,{children:[i.jsxs(J,{variant:"body2",children:[u.toFixed(),"%"]}),i.jsx(aBt,{variant:"determinate",value:u})]})]}),i.jsxs(nu,{children:[i.jsx(J,{variant:"body2",paddingTop:1,children:"The steps will guide you"}),s.map((d,p)=>{const f=r===p,h=n[p]===d.steps.length;return i.jsxs(lBt,{onClick:()=>o(p),selected:f,completed:h,children:[i.jsx(te,{condition:h,show:i.jsx(cBt,{}),elseShow:i.jsx(uBt,{})}),i.jsx(J,{variant:"body2",sx:{flex:1},children:d.title}),i.jsx(dBt,{})]},d.title)}),i.jsx(pBt,{variant:"outlined",onClick:a,children:"View demo page"})]})]})};function gle(e){return t=>typeof t===e}var hBt=gle("function"),gBt=e=>e===null,pU=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",fU=e=>!mBt(e)&&!gBt(e)&&(hBt(e)||typeof e=="object"),mBt=gle("undefined");function yBt(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!xi(e[r],t[r]))return!1;return!0}function xBt(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function vBt(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!xi(n[1],t.get(n[0])))return!1;return!0}function bBt(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function xi(e,t){if(e===t)return!0;if(e&&fU(e)&&t&&fU(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return yBt(e,t);if(e instanceof Map&&t instanceof Map)return vBt(e,t);if(e instanceof Set&&t instanceof Set)return bBt(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return xBt(e,t);if(pU(e)&&pU(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const s=n[o];if(!(s==="_owner"&&e.$$typeof)&&!xi(e[s],t[s]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var CBt=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],wBt=["bigint","boolean","null","number","string","symbol","undefined"];function w8(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(SBt(t))return t}function ac(e){return t=>w8(t)===e}function SBt(e){return CBt.includes(e)}function A0(e){return t=>typeof t===e}function jBt(e){return wBt.includes(e)}var EBt=["innerHTML","ownerDocument","style","attributes","nodeValue"];function Lt(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(Lt.array(e))return"Array";if(Lt.plainFunction(e))return"Function";const t=w8(e);return t||"Object"}Lt.array=Array.isArray;Lt.arrayOf=(e,t)=>!Lt.array(e)&&!Lt.function(t)?!1:e.every(n=>t(n));Lt.asyncGeneratorFunction=e=>w8(e)==="AsyncGeneratorFunction";Lt.asyncFunction=ac("AsyncFunction");Lt.bigint=A0("bigint");Lt.boolean=e=>e===!0||e===!1;Lt.date=ac("Date");Lt.defined=e=>!Lt.undefined(e);Lt.domElement=e=>Lt.object(e)&&!Lt.plainObject(e)&&e.nodeType===1&&Lt.string(e.nodeName)&&EBt.every(t=>t in e);Lt.empty=e=>Lt.string(e)&&e.length===0||Lt.array(e)&&e.length===0||Lt.object(e)&&!Lt.map(e)&&!Lt.set(e)&&Object.keys(e).length===0||Lt.set(e)&&e.size===0||Lt.map(e)&&e.size===0;Lt.error=ac("Error");Lt.function=A0("function");Lt.generator=e=>Lt.iterable(e)&&Lt.function(e.next)&&Lt.function(e.throw);Lt.generatorFunction=ac("GeneratorFunction");Lt.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;Lt.iterable=e=>!Lt.nullOrUndefined(e)&&Lt.function(e[Symbol.iterator]);Lt.map=ac("Map");Lt.nan=e=>Number.isNaN(e);Lt.null=e=>e===null;Lt.nullOrUndefined=e=>Lt.null(e)||Lt.undefined(e);Lt.number=e=>A0("number")(e)&&!Lt.nan(e);Lt.numericString=e=>Lt.string(e)&&e.length>0&&!Number.isNaN(Number(e));Lt.object=e=>!Lt.nullOrUndefined(e)&&(Lt.function(e)||typeof e=="object");Lt.oneOf=(e,t)=>Lt.array(e)?e.indexOf(t)>-1:!1;Lt.plainFunction=ac("Function");Lt.plainObject=e=>{if(w8(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};Lt.primitive=e=>Lt.null(e)||jBt(typeof e);Lt.promise=ac("Promise");Lt.propertyOf=(e,t,n)=>{if(!Lt.object(e)||!t)return!1;const r=e[t];return Lt.function(n)?n(r):Lt.defined(r)};Lt.regexp=ac("RegExp");Lt.set=ac("Set");Lt.string=A0("string");Lt.symbol=A0("symbol");Lt.undefined=A0("undefined");Lt.weakMap=ac("WeakMap");Lt.weakSet=ac("WeakSet");var Ht=Lt;function kBt(...e){return e.every(t=>Ht.string(t)||Ht.array(t)||Ht.plainObject(t))}function TBt(e,t,n){return mle(e,t)?[e,t].every(Ht.array)?!e.some(xU(n))&&t.some(xU(n)):[e,t].every(Ht.plainObject)?!Object.entries(e).some(yU(n))&&Object.entries(t).some(yU(n)):t===n:!1}function hU(e,t,n){const{actual:r,key:o,previous:s,type:a}=n,l=zc(e,o),c=zc(t,o);let u=[l,c].every(Ht.number)&&(a==="increased"?l<c:l>c);return Ht.undefined(r)||(u=u&&c===r),Ht.undefined(s)||(u=u&&l===s),u}function gU(e,t,n){const{key:r,type:o,value:s}=n,a=zc(e,r),l=zc(t,r),c=o==="added"?a:l,u=o==="added"?l:a;if(!Ht.nullOrUndefined(s)){if(Ht.defined(c)){if(Ht.array(c)||Ht.plainObject(c))return TBt(c,u,s)}else return xi(u,s);return!1}return[a,l].every(Ht.array)?!u.every(HO(c)):[a,l].every(Ht.plainObject)?RBt(Object.keys(c),Object.keys(u)):![a,l].every(d=>Ht.primitive(d)&&Ht.defined(d))&&(o==="added"?!Ht.defined(a)&&Ht.defined(l):Ht.defined(a)&&!Ht.defined(l))}function mU(e,t,{key:n}={}){let r=zc(e,n),o=zc(t,n);if(!mle(r,o))throw new TypeError("Inputs have different types");if(!kBt(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(Ht.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function yU(e){return([t,n])=>Ht.array(e)?xi(e,n)||e.some(r=>xi(r,n)||Ht.array(n)&&HO(n)(r)):Ht.plainObject(e)&&e[t]?!!e[t]&&xi(e[t],n):xi(e,n)}function RBt(e,t){return t.some(n=>!e.includes(n))}function xU(e){return t=>Ht.array(e)?e.some(n=>xi(n,t)||Ht.array(t)&&HO(t)(n)):xi(e,t)}function mm(e,t){return Ht.array(e)?e.some(n=>xi(n,t)):xi(e,t)}function HO(e){return t=>e.some(n=>xi(n,t))}function mle(...e){return e.every(Ht.array)||e.every(Ht.number)||e.every(Ht.plainObject)||e.every(Ht.string)}function zc(e,t){return Ht.plainObject(e)||Ht.array(e)?Ht.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):Ht.number(t)?e[t]:e:e}function C6(e,t){if([e,t].some(Ht.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(d=>Ht.plainObject(d)||Ht.array(d)))throw new Error("Expected plain objects or array");return{added:(d,p)=>{try{return gU(e,t,{key:d,type:"added",value:p})}catch{return!1}},changed:(d,p,f)=>{try{const h=zc(e,d),m=zc(t,d),y=Ht.defined(p),b=Ht.defined(f);if(y||b){const x=b?mm(f,h):!mm(p,h),C=mm(p,m);return x&&C}return[h,m].every(Ht.array)||[h,m].every(Ht.plainObject)?!xi(h,m):h!==m}catch{return!1}},changedFrom:(d,p,f)=>{if(!Ht.defined(d))return!1;try{const h=zc(e,d),m=zc(t,d),y=Ht.defined(f);return mm(p,h)&&(y?mm(f,m):!y)}catch{return!1}},decreased:(d,p,f)=>{if(!Ht.defined(d))return!1;try{return hU(e,t,{key:d,actual:p,previous:f,type:"decreased"})}catch{return!1}},emptied:d=>{try{const[p,f]=mU(e,t,{key:d});return!!p.length&&!f.length}catch{return!1}},filled:d=>{try{const[p,f]=mU(e,t,{key:d});return!p.length&&!!f.length}catch{return!1}},increased:(d,p,f)=>{if(!Ht.defined(d))return!1;try{return hU(e,t,{key:d,actual:p,previous:f,type:"increased"})}catch{return!1}},removed:(d,p)=>{try{return gU(e,t,{key:d,type:"removed",value:p})}catch{return!1}}}}var ABt=new Error("Element already at target scroll position"),PBt=new Error("Scroll cancelled"),_Bt=Math.min,vU=Date.now,IBt={left:bU("scrollLeft"),top:bU("scrollTop")};function bU(e){return function(n,r,o,s){o=o||{},typeof o=="function"&&(s=o,o={}),typeof s!="function"&&(s=MBt);var a=vU(),l=n[e],c=o.ease||OBt,u=isNaN(o.duration)?350:+o.duration,d=!1;return l===r?s(ABt,n[e]):requestAnimationFrame(f),p;function p(){d=!0}function f(h){if(d)return s(PBt,n[e]);var m=vU(),y=_Bt(1,(m-a)/u),b=c(y);n[e]=b*(r-l)+l,y<1?requestAnimationFrame(f):requestAnimationFrame(function(){s(null,n[e])})}}}function OBt(e){return .5*(1-Math.cos(Math.PI*e))}function MBt(){}const $Bt=ls(IBt);var yle={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(_n,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(yle);var DBt=yle.exports;const xle=ls(DBt);var LBt=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},NBt=function(e,t){return e+k3(t)},k3=function(e){return e===null||typeof e=="boolean"||typeof e>"u"?"":typeof e=="number"?e.toString():typeof e=="string"?e:Array.isArray(e)?e.reduce(NBt,""):LBt(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?k3(e.props.children):""};k3.default=k3;var FBt=k3;const CU=ls(FBt);var BBt=function(t){return zBt(t)&&!HBt(t)};function zBt(e){return!!e&&typeof e=="object"}function HBt(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||UBt(e)}var WBt=typeof Symbol=="function"&&Symbol.for,VBt=WBt?Symbol.for("react.element"):60103;function UBt(e){return e.$$typeof===VBt}function GBt(e){return Array.isArray(e)?[]:{}}function T3(e,t){return t.clone!==!1&&t.isMergeableObject(e)?jg(GBt(e),e,t):e}function qBt(e,t,n){return e.concat(t).map(function(r){return T3(r,n)})}function YBt(e,t){if(!t.customMerge)return jg;var n=t.customMerge(e);return typeof n=="function"?n:jg}function KBt(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function wU(e){return Object.keys(e).concat(KBt(e))}function vle(e,t){try{return t in e}catch{return!1}}function XBt(e,t){return vle(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function JBt(e,t,n){var r={};return n.isMergeableObject(e)&&wU(e).forEach(function(o){r[o]=T3(e[o],n)}),wU(t).forEach(function(o){XBt(e,o)||(vle(e,o)&&n.isMergeableObject(t[o])?r[o]=YBt(o,n)(e[o],t[o],n):r[o]=T3(t[o],n))}),r}function jg(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||qBt,n.isMergeableObject=n.isMergeableObject||BBt,n.cloneUnlessOtherwiseSpecified=T3;var r=Array.isArray(t),o=Array.isArray(e),s=r===o;return s?r?n.arrayMerge(e,t,n):JBt(e,t,n):T3(t,n)}jg.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return jg(r,o,n)},{})};var ZBt=jg,QBt=ZBt;const nl=ls(QBt);/**!
513
+ by checking if the client exists before rendering.`);const b=j=>{s(()=>{m(k=>k||j)})},x=j=>{s(()=>{m(null)})};let C=null;const w=()=>{C=setTimeout(()=>{s(()=>{f(!0)})},0)};return d.current.on("ready",w),d.current.on("error",b),d.current.on("recovered",x),r&&(d.current.stop(),d.current.start()),function(){d.current&&(d.current.off("error",b),d.current.off("ready",w),d.current.off("recovered",x),o&&d.current.stop()),C&&clearTimeout(C)}},[]);const y=g.useMemo(()=>({on:(...b)=>d.current.on(...b),off:(...b)=>d.current.off(...b),isEnabled:(...b)=>d.current.isEnabled(...b),updateContext:async(...b)=>await d.current.updateContext(...b),getVariant:(...b)=>d.current.getVariant(...b),client:d.current,flagsReady:p,flagsError:h,setFlagsReady:f,setFlagsError:m}),[p,h]);return tt.createElement(Yae.Provider,{value:y},t)},Kae={on:(e,t,n)=>(console.error("on() must be used within a FlagProvider"),zj),off:(e,t)=>(console.error("off() must be used within a FlagProvider"),zj),updateContext:async()=>{console.error("updateContext() must be used within a FlagProvider")},isEnabled:()=>(console.error("isEnabled() must be used within a FlagProvider"),!1),getVariant:()=>(console.error("getVariant() must be used within a FlagProvider"),{name:"disabled",enabled:!1})},zj={...Kae,toggles:[],impressionDataAll:{},context:{},storage:{},start:()=>{},stop:()=>{},isReady:()=>!1,getError:()=>null,getAllToggles:()=>[]},uDt={...Kae,client:zj,flagsReady:!1,setFlagsReady:()=>{console.error("setFlagsReady() must be used within a FlagProvider")},flagsError:null,setFlagsError:()=>{console.error("setFlagsError() must be used within a FlagProvider")}};function Xae(){return g.useContext(Yae)||(console.error("useFlagContext() must be used within a FlagProvider"),uDt)}const Jae=e=>{const{isEnabled:t,client:n}=Xae(),[r,o]=g.useState(!!t(e)),s=g.useRef();return s.current=r,g.useEffect(()=>{if(!n)return;const a=()=>{const c=t(e);c!==s.current&&(s.current=c,o(!!c))},l=()=>{const c=t(e);s.current=c,o(c)};return n.on("update",a),n.on("ready",l),()=>{n.off("update",a),n.off("ready",l)}},[n]),r},dDt=()=>{const{client:e}=Xae();return e},gv=(e,t)=>{const n=dDt();return g.useEffect(()=>{var o;(o=n==null?void 0:n.impactMetrics)==null||o.defineCounter(e,t)},[n,e,t]),{increment:g.useCallback(o=>{var s;(s=n==null?void 0:n.impactMetrics)==null||s.incrementCounter(e,o)},[n,e])}},mv="Tracks user journey from flag page accordion through impact chart creation",pDt=()=>{const{increment:e}=gv("flagpage_funnel_accordion_opened",mv),{increment:t}=gv("flagpage_funnel_modal_opened",mv),{increment:n}=gv("flagpage_funnel_docs_clicked",mv),{increment:r}=gv("flagpage_funnel_metric_saved",mv);return{trackAccordionOpened:()=>e(),trackAddMetricClicked:()=>t(),trackDocsClicked:()=>n(),trackMetricSaved:()=>r()}},fDt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=er({propagateErrors:!0});return{registerImpactMetric:g.useCallback(async s=>{const a=t("api/admin/impact-metrics/register",{method:"POST",body:JSON.stringify(s)},"registerImpactMetric");return e(a.caller,a.id)},[e,t]),errors:n,loading:r}},hDt=v("form")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(2)})),eU=v(rX)(({theme:e})=>({color:e.palette.text.primary,marginBottom:e.spacing(1)})),gDt=v("div")(({theme:e})=>({display:"flex",alignItems:"flex-start",padding:e.spacing(2),background:e.palette.background.default,gap:"11px",border:`1.5px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusLarge,transition:"border-color 0.3s",position:"relative",":hover, :focus-within":{borderColor:e.palette.primary.main},label:{textTransform:"capitalize",fontWeight:"bold","::before":{content:"''",position:"absolute",inset:0,zIndex:1}}})),wC=({value:e,description:t,examples:n})=>{const r=g.useId(),o=g.useId(),s=g.useId();return i.jsxs(gDt,{children:[i.jsx(el,{sx:{padding:0},id:r,value:e,"aria-describedby":`${o} ${s}`}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:r,children:e}),i.jsx(J,{id:o,children:t}),i.jsxs(J,{variant:"body2",color:"text.secondary",sx:{mt:1},id:s,children:["Examples: ",n]})]})]})},mDt=v(K3)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),yDt=({formId:e,onSubmitted:t})=>{const n="counter",[r,o]=g.useState(""),[s,a]=g.useState(n),{registerImpactMetric:l,loading:c}=fDt(),u=g.useId(),d=g.useId(),p=async f=>{f.preventDefault(),!c&&(await l({name:r.trim(),type:s}),t(r.trim()))};return i.jsxs(hDt,{id:e,onSubmit:p,children:[i.jsxs(Ko,{sx:f=>({".MuiFormHelperText-root, label":{transition:"color 0.2s ease"},":has(input:invalid:not(:placeholder-shown))":{".MuiFormHelperText-root, label":{color:f.palette.error.main}}}),children:[i.jsx(eU,{htmlFor:u,children:"Metric name"}),i.jsx(xn,{id:u,value:r,onChange:f=>o(f.target.value),inputProps:{pattern:"^[a-zA-Z_:][a-zA-Z0-9_:]*$",title:"The name must contain only alphanumeric characters, underscores, and colons. It must start with a letter."},placeholder:"e.g., checkout_error_count",variant:"outlined",size:"small",fullWidth:!0,required:!0,helperText:"Use letters, numbers, colons, and underscores. Be descriptive and specific.",sx:{".MuiFormHelperText-root":{marginInline:0}}})]}),i.jsxs(Ko,{children:[i.jsx(eU,{htmlFor:d,children:"Metric type"}),i.jsxs(mDt,{onChange:f=>a(f.target.value),id:d,defaultValue:n,name:"metricType",children:[i.jsx(wC,{value:"counter",description:"Tracks values that only increase (e.g., error counts, request counts)",examples:"client_error_count, total_purchases"}),i.jsx(wC,{value:"gauge",description:"Tracks values that can go up or down (e.g., active users, queue size",examples:"active_connections, memory_usage"}),i.jsx(wC,{value:"histogram",description:"Tracks the distribution of values, (e.g., response times, payload sizes)",examples:"request_duration_ms, payload_size_bytes"})]})]})]})},xDt=({metricName:e})=>i.jsxs(K,{sx:{display:"flex",flexDirection:"column",gap:3},children:[i.jsxs(K,{children:[i.jsx(J,{variant:"h2",sx:{mb:1},children:"Metric registered"}),i.jsxs(J,{variant:"body2",color:"text.secondary",children:["Your impact metric"," ",i.jsx(J,{component:"span",variant:"body2",fontWeight:"bold",children:e})," ","has been created. Your impact metrics will be available in a few seconds."]})]}),i.jsxs(K,{children:[i.jsx(J,{variant:"body2",fontWeight:"bold",sx:{mb:1},children:"Implement in your code"}),i.jsxs(J,{variant:"body2",color:"text.secondary",children:["To start collecting data, you need to implement the metric in your application code using one of our SDKs."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",children:"View the documentation"})," ","for setup instructions."]})]})]});var OO={},vDt=je;Object.defineProperty(OO,"__esModule",{value:!0});var Zae=OO.default=void 0,bDt=vDt(Ee()),CDt=i,wDt=(0,bDt.default)((0,CDt.jsx)("path",{d:"M7 20h4c0 1.1-.9 2-2 2s-2-.9-2-2zm-2-1h8v-2H5v2zm11.5-9.5c0 3.82-2.66 5.86-3.77 6.5H5.27c-1.11-.64-3.77-2.68-3.77-6.5C1.5 5.36 4.86 2 9 2s7.5 3.36 7.5 7.5zm-2 0C14.5 6.47 12.03 4 9 4S3.5 6.47 3.5 9.5c0 2.47 1.49 3.89 2.35 4.5h6.3c.86-.61 2.35-2.03 2.35-4.5zm6.87-2.13L20 8l1.37.63L22 10l.63-1.37L24 8l-1.37-.63L22 6l-.63 1.37zM19 6l.94-2.06L22 3l-2.06-.94L19 0l-.94 2.06L16 3l2.06.94L19 6z"}),"TipsAndUpdatesOutlined");Zae=OO.default=wDt;const SDt=v(K)(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(6),minWidth:"300px",maxWidth:"350px",display:"flex",flexDirection:"column",gap:e.spacing(3)})),yv=v(J)(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize})),tU=v(K)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.contrastText,fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(1)})),nU={fontSize:"1.2rem"},jDt=()=>i.jsxs(SDt,{children:[i.jsxs(K,{children:[i.jsxs(tU,{children:[i.jsx(yi,{sx:nU}),"What are impact metrics?"]}),i.jsx(yv,{children:"Impact metrics are numerical measurements that track the impact of your feature flags. They help you understand if a feature is performing as expected and can be set up to trigger automated safeguards when issues arise."})]}),i.jsx(pr,{sx:{borderColor:"rgba(255,255,255,0.2)"}}),i.jsxs(K,{children:[i.jsxs(tU,{children:[i.jsx(Zae,{sx:nU}),"Best practices"]}),i.jsxs(Ri,{dense:!0,disablePadding:!0,sx:{pl:2},children:[i.jsx(Or,{disableGutters:!0,sx:{display:"list-item",listStyleType:"disc",p:0},children:i.jsx(yv,{children:"Use descriptive, specific names that indicate what you're measuring"})}),i.jsx(Or,{disableGutters:!0,sx:{display:"list-item",listStyleType:"disc",p:0},children:i.jsx(yv,{children:"Choose the metric type that matches how the value changes over time"})}),i.jsx(Or,{disableGutters:!0,sx:{display:"list-item",listStyleType:"disc",p:0},children:i.jsx(yv,{children:"Track both positive indicators (success) and negative indicators (errors)"})})]})]}),i.jsx(pr,{sx:{borderColor:"rgba(255,255,255,0.2)"}}),i.jsxs(Sn,{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",sx:{color:"primary.contrastText",display:"flex",alignItems:"center",gap:.5,fontSize:"body2.fontSize"},children:["View full documentation",i.jsx(Hp,{sx:{fontSize:"1rem"}})]})]}),EDt=v(Fp)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:e.spacing(170),width:"100%",backgroundColor:"transparent",flexDirection:"row"},padding:0})),kDt=v("div")(({theme:e})=>({minHeight:"min(718px, 100vh)",maxHeight:"100vh",flex:"auto",backgroundColor:e.palette.background.paper,display:"grid",gridTemplateRows:"1fr auto",'&:has(form:invalid) button[type="submit"]':{color:e.palette.action.disabled,backgroundColor:e.palette.action.disabledBackground,cursor:"auto",boxShadow:"none"}})),TDt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:e.spacing(4,6,4,6),h3:{marginBlockEnd:e.spacing(1)},h4:{marginBlockEnd:e.spacing(.5)}})),RDt=v("div")(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,display:"flex",justifyContent:"flex-end",gap:e.spacing(3),alignItems:"center",padding:e.spacing(2,6)})),ADt=({onClose:e})=>{const t=Bt(),n=Nn(t.breakpoints.up("lg")),[r,o]=g.useState("define"),[s,a]=g.useState(""),l=g.useId(),c=r==="define";return i.jsxs(EDt,{open:!0,onClose:e,children:[i.jsxs(kDt,{children:[i.jsxs(TDt,{children:[i.jsxs("div",{children:[i.jsx(J,{variant:"h1",component:"h3",children:"Create an impact metric"}),i.jsxs(J,{variant:"body2",color:"text.secondary",children:["Follow this setup guide to implement and verify your impact metric."," ",i.jsx(Sn,{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",children:"View docs"})," ","for alternative ways to set it up."]})]}),c?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx(J,{variant:"h3",component:"h4",children:"Define your metric"}),i.jsx(J,{variant:"body2",color:"text.secondary",children:"Start by choosing a name and type for your metric. This will help you track the right data for your feature flags."})]}),i.jsx(yDt,{formId:l,onSubmitted:u=>{a(u),o("success")}})]}):i.jsx(xDt,{metricName:s})]}),i.jsx(RDt,{children:c?i.jsxs(i.Fragment,{children:[i.jsx($e,{variant:"text",color:"inherit",onClick:e,children:"Cancel"}),i.jsx($e,{form:l,type:"submit",variant:"contained",children:"Next step"})]}):i.jsx($e,{variant:"contained",onClick:e,children:"Done"})})]}),n?i.jsx(jDt,{}):null]})},PDt=({open:e,...t})=>e?i.jsx(ADt,{...t}):null,Qae=(e,t,n)=>e.name===t&&e.source===(n??"internal"),_Dt=({onRegisterClick:e})=>{const{trackEvent:t}=zt(),{trackDocsClicked:n}=pDt(),r=e?{onClick:()=>{t("impact-metrics",{props:{eventType:"No option setup form opened"}}),e()}}:{href:"https://docs.getunleash.io/reference/impact-metrics",target:"_blank",rel:"noopener noreferrer",onClick:()=>{t("impact-metrics",{props:{eventType:"No options docs clicked"}}),n()}};return i.jsxs(K,{sx:{display:"flex",flexDirection:"column",gap:1},children:[i.jsx(J,{variant:"body2",fontWeight:"bold",children:"No impact metrics found"}),i.jsx(J,{variant:"body2",color:"text.secondary",children:"Impact metrics need to be implemented in your code before they can be used in safeguards."}),i.jsx($e,{variant:"contained",size:"small",sx:{alignSelf:"flex-start",mt:1},...r,children:"Set up your first metric"})]})},IDt=(e,t,n)=>{if(t&&!e.some(r=>Qae(r,t,n))){const r={name:t,displayName:t,help:"",source:n??"internal"};return n==="external"?[...e,r]:[r,...e]}return e},ODt=e=>e==="external"?"External metrics":"Internal metrics",MDt=({value:e,valueSource:t,onChange:n,options:r,loading:o=!1,label:s="Metric name"})=>{const a=IDt(r,e,t),l=Er("registerImpactMetrics"),[c,u]=g.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(Zl,{options:a,groupBy:d=>ODt(d.source),getOptionLabel:d=>d.displayName,value:a.find(d=>Qae(d,e,t))||null,onChange:(d,p)=>{const f=p||r[0];n({metricName:(f==null?void 0:f.name)||"",source:f==null?void 0:f.source})},disabled:o,renderOption:(d,p,{inputValue:f})=>g.createElement(K,{component:"li",...d,key:`${p.source}__${p.name}`},i.jsxs(K,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(J,{variant:"body2",children:i.jsx(Pr,{search:f,children:p.displayName})}),i.jsx(J,{variant:"caption",color:"text.secondary",children:i.jsx(Pr,{search:f,children:p.help})})]})),renderInput:d=>i.jsx(xn,{...d,label:s,placeholder:"Search for a metric…",variant:"outlined",size:"small",required:!0}),noOptionsText:i.jsx(_Dt,{onRegisterClick:l?()=>u(!0):void 0}),sx:{minWidth:300}}),i.jsx(PDt,{open:c,onClose:()=>u(!1)})]})},$Dt=EO(e7),DDt=v(K)(({theme:e})=>({display:"flex",gap:e.spacing(2)})),LDt=v(K)({flex:1,minWidth:0}),NDt=(e,t)=>{const n={};return t&&(n.environment=[t]),e!=="*"&&(n.appName=[e]),n},FDt=e=>{var t,n,r;return{metric:{metricName:(e==null?void 0:e.impactMetric.metricName)||"",source:e==null?void 0:e.impactMetric.source},appName:((t=e==null?void 0:e.impactMetric.labelSelectors.appName)==null?void 0:t[0])||"*",aggregationMode:(e==null?void 0:e.impactMetric.aggregationMode)||"rps",operator:((n=e==null?void 0:e.triggerCondition)==null?void 0:n.operator)||">",threshold:((r=e==null?void 0:e.triggerCondition)==null?void 0:r.threshold)||0,timeRange:(e==null?void 0:e.impactMetric.timeRange)||"day"}},BDt=e=>{const t=g.useMemo(()=>FDt(e),[e]),[n,r]=g.useState(t.metric),[o,s]=g.useState(t.appName),[a,l]=g.useState(t.aggregationMode),[c,u]=g.useState(t.operator),[d,p]=g.useState(t.threshold),[f,h]=g.useState(t.timeRange);return{metric:n,setMetric:r,appName:o,setAppName:s,aggregationMode:a,setAggregationMode:l,operator:c,setOperator:u,threshold:d,setThreshold:p,timeRange:f,setTimeRange:h,resetToOriginalValues:()=>{e&&(r(t.metric),s(t.appName),l(t.aggregationMode),u(t.operator),p(t.threshold),h(t.timeRange))},initialValues:t}},zDt=e=>{const[t,n]=g.useState(e?"display":"create");return{mode:t,setMode:n,enterEditMode:()=>{t==="display"&&n("edit")}}},HDt=(e,t,n,r,o)=>{var p,f,h;const{metricOptions:s,loading:a}=B$t(),{data:l}=IO(e?{metricName:e,range:t,aggregationMode:n,source:o,mode:"edit"}:void 0),c=g.useMemo(()=>{var y;return["*",...((y=l==null?void 0:l.labels)==null?void 0:y.appName)||[]]},[(p=l==null?void 0:l.labels)==null?void 0:p.appName]),u=k$t(e,(f=l==null?void 0:l.labels)==null?void 0:f.metric_type),d=(h=l==null?void 0:l.labels)!=null&&h.environment?r:void 0;return{metricOptions:s,loading:a,applicationNames:c,metricType:u,metricEnvironment:d}},WDt=(e,t,n,r)=>{const{setMetric:o,setAppName:s,setAggregationMode:a,setOperator:l,setThreshold:c,setTimeRange:u}=e,{enterEditMode:d}=t,p=e.initialValues.metric.metricName;return g.useEffect(()=>{n.length>0&&!e.metric.metricName&&o({metricName:n[0].name,source:n[0].source})},[n,e.metric.metricName,o]),g.useEffect(()=>{e.metric.metricName!==p&&r!=="unknown"&&a(T$t(r))},[e.metric.metricName,p,r]),{handleMetricChange:C=>{d(),o(C),s("*")},handleApplicationChange:C=>{d(),s(C)},handleAggregationModeChange:C=>{d(),a(C)},handleOperatorChange:C=>{d(),l(C)},handleThresholdChange:C=>{d(),c(C)},handleTimeRangeChange:C=>{d(),u(C)}}},VDt=(e,t,n,r)=>{const o=ar("projectId"),s=BDt(e),a=zDt(e),l=HDt(s.metric.metricName,s.timeRange,s.aggregationMode,n,s.metric.source),c=WDt(s,a,l.metricOptions,l.metricType),u=g.useMemo(()=>NDt(s.appName,l.metricEnvironment),[s.appName,l.metricEnvironment]),d=g.useMemo(()=>({impactMetric:{metricName:s.metric.metricName,timeRange:s.timeRange,aggregationMode:s.aggregationMode,labelSelectors:u,source:s.metric.source??"internal"},triggerCondition:{operator:s.operator,threshold:Number(s.threshold)}}),[s.metric,s.timeRange,s.aggregationMode,u,s.operator,s.threshold]);return{...s,...a,...l,...c,projectId:o,featureId:t,labelSelectors:u,handleSubmit:f=>{f.preventDefault(),!Number.isNaN(Number(s.threshold))&&(r(d),(a.mode==="edit"||a.mode==="create")&&a.setMode("display"))}}},UDt={releasePlan:"Pause automation when",featureEnvironment:"Disable environment when"},GDt=({formState:e,onSubmit:t,onCancel:n,onDelete:r,environment:o,badge:s,children:a,safeguardType:l="releasePlan"})=>{var se;const{metric:c,appName:u,aggregationMode:d,operator:p,threshold:f,timeRange:h,mode:m,setMode:y,metricOptions:b,loading:x,applicationNames:C,metricType:w,projectId:j,featureId:k,handleMetricChange:S,handleApplicationChange:E,handleAggregationModeChange:T,handleOperatorChange:R,handleThresholdChange:_,handleTimeRangeChange:M,resetToOriginalValues:$,enterEditMode:z,labelSelectors:A}=e,O=l==="featureEnvironment"?hQ:wp,L=()=>{if(m==="create"){n==null||n();return}$(),y("display")},B=()=>{r&&r()},H=m==="create"||m==="edit",N=(se=b.find(ae=>ae.name===c.metricName&&ae.source===(c.source??"internal")))==null?void 0:se.displayName,{inputValue:I,handleInputChange:q,handleInputBlur:ne,handleKeyDown:V,handleFocus:oe}=wne(f,_,{onEditStart:z});return i.jsxs(Rae,{onSubmit:t,mode:m,children:[i.jsxs(Rd,{children:[i.jsx($Dt,{}),i.jsx(R1,{sx:{mr:"auto"},children:UDt[l]}),m==="display"&&s,c.metricName&&i.jsx(N$t,{metricName:c.metricName,metricDisplayName:N,timeRange:h,labelSelectors:A,aggregationMode:d,threshold:f,projectId:j,featureId:k,source:c.source}),m!=="create"&&r&&i.jsx(Co,{permission:O,projectId:j,environmentId:o,onClick:B,size:"small","aria-label":"Remove safeguard",tooltipProps:{title:"Remove safeguard"},sx:{padding:.5},children:i.jsx(jO,{fontSize:"small"})})]}),i.jsx(DDt,{children:i.jsxs(LDt,{children:[i.jsxs(Rd,{sx:{ml:3,mb:1.5},children:[i.jsx(MDt,{value:c.metricName,valueSource:c.source,onChange:S,options:b,loading:x,label:""}),i.jsxs(Rd,{children:[i.jsx(R1,{children:"filtered by"}),i.jsx(Ko,{variant:"outlined",size:"small",children:i.jsx(BV,{value:u,onChange:ae=>E(String(ae.target.value)),variant:"outlined",size:"small",children:C.map(ae=>i.jsx(bC,{value:ae,children:ae==="*"?"All":ae},ae))})})]}),i.jsxs(Rd,{children:[i.jsx(R1,{children:"aggregated by"}),i.jsx(H$t,{value:d,onChange:T,metricType:w,label:""})]})]}),i.jsxs(Rd,{sx:{ml:.75},children:[i.jsxs(Rd,{children:[i.jsx(R1,{sx:{ml:2.5},children:"is"}),i.jsx(Ko,{variant:"outlined",size:"small",children:i.jsxs(BV,{value:p,onChange:ae=>R(ae.target.value),variant:"outlined",size:"small",children:[i.jsx(bC,{value:">",children:"More than"}),i.jsx(bC,{value:"<",children:"Less than"})]})}),i.jsx(Ko,{variant:"outlined",size:"small",children:i.jsx(xn,{type:"number",inputProps:{step:.1},value:I,onChange:q,onFocus:oe,onBlur:ne,onKeyDown:V,placeholder:"Value",variant:"outlined",size:"small",required:!0})})]}),i.jsxs(Rd,{children:[i.jsx(R1,{children:"over"}),i.jsxs(z$t,{value:h,onChange:M,label:"",children:[i.jsx(wn,{value:"hour",children:"Last minute"}),i.jsx(wn,{value:"day",children:"Last 15 minutes"}),i.jsx(wn,{value:"week",children:"Last 3 hours"}),i.jsx(wn,{value:"month",children:"Last day"})]})]})]})]})}),H&&i.jsxs(Aae,{children:[i.jsx($e,{variant:"outlined",onClick:L,size:"small",children:"Cancel"}),i.jsx(lo,{permission:O,projectId:j,environmentId:o,variant:"contained",color:"primary",size:"small",type:"submit",disabled:Number.isNaN(Number(f)),children:"Save"})]}),a]})},ele=({onSubmit:e,onCancel:t,onDelete:n,safeguard:r,environment:o,featureId:s,badge:a,safeguardType:l})=>{const c=VDt(r,s,o,e);return i.jsx(GDt,{formState:c,onSubmit:c.handleSubmit,onCancel:t,onDelete:n,environment:o,badge:a,safeguardType:l})},qDt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),justifyContent:"space-between",width:"100%",padding:e.spacing(1.5,2),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.divider}`,borderRadius:`${e.shape.borderRadiusLarge}px`})),YDt=v("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),flexWrap:"wrap"})),KDt=EO(e7),hm=v("span")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body2.fontSize,flexShrink:0})),gm=v("span")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold})),XDt={releasePlan:"Pause automation when",featureEnvironment:"Disable environment when"},tle=({safeguard:e,badge:t,safeguardType:n="releasePlan"})=>{var s,a,l;const r=((s=e.impactMetric.labelSelectors.appName)==null?void 0:s[0])||"*",o=((a=e.triggerCondition)==null?void 0:a.operator)===">"?"More than":"Less than";return i.jsxs(qDt,{children:[i.jsxs(YDt,{children:[i.jsx(KDt,{}),i.jsx(hm,{children:XDt[n]}),i.jsx(gm,{children:e.impactMetric.metricName}),r!=="*"&&i.jsxs(i.Fragment,{children:[i.jsx(hm,{children:"filtered by"}),i.jsx(gm,{children:r})]}),i.jsx(hm,{children:"aggregated by"}),i.jsx(gm,{children:e.impactMetric.aggregationMode}),i.jsx(hm,{children:"is"}),i.jsxs(gm,{children:[o," ",(l=e.triggerCondition)==null?void 0:l.threshold]}),i.jsx(hm,{children:"over"}),i.jsx(gm,{children:e.impactMetric.timeRange})]}),t]})},nle=v(R0)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),rle=({safeguard:e,currentSafeguard:t,changeRequestState:n,environmentName:r,featureName:o,safeguardType:s,actions:a,onSubmit:l,onDelete:c})=>{const u=Ns(n);return i.jsxs(nle,{children:[i.jsxs(js,{children:[i.jsx(Ss,{children:i.jsx(E0,{children:"Change safeguard"})}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),a]})]}),i.jsx(Mo,{children:u?i.jsx(tle,{safeguard:e,safeguardType:s}):i.jsx(ele,{onSubmit:l,onDelete:t!=null&&t.id?()=>c(t.id):void 0,safeguard:e,environment:r,featureId:o,safeguardType:s})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:Sg(t,["id","action","impactMetric.id"]),data:e}})})]})},ole=({safeguard:e,changeRequestState:t,environmentName:n,featureName:r,safeguardType:o,actions:s,onSubmit:a,onDelete:l})=>{const c=Ns(t);return i.jsxs(nle,{children:[i.jsxs(js,{children:[i.jsx(Ss,{children:i.jsx(Py,{children:"Delete safeguard"})}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),s]})]}),i.jsx(Mo,{children:c?i.jsx(tle,{safeguard:e,safeguardType:o}):i.jsx(ele,{onSubmit:a,onDelete:e!=null&&e.id?()=>l(e.id):void 0,safeguard:e,environment:n,featureId:r,safeguardType:o})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:e,data:{}}})})]})},sle=v(R0)(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(1)})),JDt=({change:e,currentReleasePlan:t,changeRequestState:n,actions:r})=>{const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t;if(o)return i.jsxs(i.Fragment,{children:[i.jsx(js,{children:i.jsxs(Ss,{children:[i.jsx(Py,{children:"Deleting release plan"}),i.jsx(J,{component:"span",children:o.name}),r]})}),i.jsx(qv,{plan:o,readonly:!0})]})},ZDt=e=>{const{change:t,currentReleasePlan:n,changeRequestState:r,environmentName:o,featureName:s,actions:a}=e,l=(Ns(r)||!n)&&t.payload.snapshot?t.payload.snapshot:n;if(l)return i.jsx(js,{children:i.jsxs(Ss,{children:[i.jsx(E0,{children:"Resume automation"}),i.jsxs(J,{component:"span",children:["Resume automation for release plan ",l.name," for"," ",s," in ",o]}),a]})})},QDt=({change:e,currentReleasePlan:t,changeRequestState:n,actions:r})=>{const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t;if(!o)return;const s=o.milestones.find(l=>l.id===o.activeMilestoneId),a=o.milestones.find(l=>l.id===e.payload.milestoneId);if(a)return i.jsxs(sle,{children:[i.jsxs(js,{children:[i.jsxs(Ss,{children:[i.jsx(E0,{children:"Start milestone"}),i.jsx(J,{component:"span",children:a.name})]}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),r]})]}),i.jsx(Mo,{children:i.jsx(bO,{readonly:!0,milestone:a,environmentId:o.environment,featureId:o.featureName,renderStrategy:l=>i.jsx(m8,{strategyHeaderLevel:4,strategy:{...l,name:l.name||l.strategyName||""}})})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:s,data:a}})})]})},eLt=({change:e,currentReleasePlan:t,changeRequestState:n,...r})=>{var s;const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t;if(!(!o||!e.payload.safeguard))return i.jsx(rle,{safeguard:e.payload.safeguard,currentSafeguard:(s=o.safeguards)==null?void 0:s[0],changeRequestState:n,...r})},tLt=({change:e,currentReleasePlan:t,changeRequestState:n,...r})=>{var a;const o=(Ns(n)||!t)&&e.payload.snapshot?e.payload.snapshot:t,s=(a=o==null?void 0:o.safeguards)==null?void 0:a[0];if(s)return i.jsx(ole,{safeguard:s,changeRequestState:n,...r})},nLt=({change:e,currentReleasePlan:t,environmentName:n,featureName:r,actions:o})=>{const[s,a]=g.useState(!1),l=g.useRef(),c=()=>{l.current&&clearTimeout(l.current),a(!0)},u=()=>{l.current=setTimeout(()=>{a(!1)},100)},d=VIt(e.payload.templateId,r,n),p={...d,discriminator:"plan",releasePlanTemplateId:e.payload.templateId};return t?i.jsxs(sle,{children:[i.jsxs(js,{children:[i.jsx(Ss,{children:i.jsxs(Bl,{children:["Replacing"," ",i.jsx(sd,{tooltip:i.jsx("div",{onMouseEnter:()=>c(),onMouseLeave:()=>u(),children:i.jsx(qv,{plan:t,readonly:!0})}),tooltipProps:{open:s,maxWidth:500,maxHeight:600},children:i.jsx("span",{onMouseEnter:()=>c(),onMouseLeave:()=>u(),children:"current"})})," ","release plan with ",d.name]})}),i.jsxs("div",{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),o]})]}),i.jsx(Mo,{children:i.jsx(qv,{plan:d,readonly:!0})}),i.jsx(Mo,{variant:"diff",children:i.jsx(Sl,{entry:{preData:t,data:p}})})]}):i.jsxs(i.Fragment,{children:[i.jsx(js,{children:i.jsxs(Ss,{children:[i.jsx(E0,{children:"Adding release plan"}),i.jsx(J,{component:"span",children:d.name}),o]})}),i.jsx(qv,{plan:d,readonly:!0})]})},rLt=({actions:e,change:t,featureName:n,environmentName:r,projectId:o,changeRequestState:s,changeRequest:a,feature:l,onRefetch:c})=>{const{releasePlans:u}=UIt(o,n,r),d=u[0],{addChange:p}=ia(),{refetch:f}=nc(o),{setToastData:h,setToastApiError:m}=_t(),y=async w=>{try{await p(o,r,{feature:n,action:"changeReleasePlanSafeguard",payload:{planId:d.id,safeguard:w}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(j){m(pt(j))}},b=async w=>{try{await p(o,r,{feature:n,action:"deleteReleasePlanSafeguard",payload:{planId:d.id,safeguardId:w}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(j){m(pt(j))}},x=async(w,j)=>{try{await p(o,r,{feature:n,action:"changeMilestoneProgression",payload:{sourceMilestone:w,...j}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(k){m(pt(k))}},C=async w=>{try{await p(o,r,{feature:n,action:"deleteMilestoneProgression",payload:{sourceMilestone:w}}),await f(),h({type:"success",text:"Added to draft"}),c==null||c()}catch(j){m(pt(j))}};if(l&&(t.action==="changeMilestoneProgression"||t.action==="deleteMilestoneProgression"||t.action==="updateMilestoneStrategy")){const w=l.changes.filter(k=>k.action==="changeMilestoneProgression"||k.action==="deleteMilestoneProgression"||k.action==="updateMilestoneStrategy");return w.length>0&&w[0]===t?i.jsx(b$t,{feature:l,currentReleasePlan:d,changeRequest:a,onUpdateChangeRequestSubmit:x,onDeleteChangeRequestSubmit:C,onRefetch:c}):null}return i.jsxs(i.Fragment,{children:[t.action==="addReleasePlan"&&i.jsx(nLt,{change:t,currentReleasePlan:d,environmentName:r,featureName:n,actions:e}),t.action==="deleteReleasePlan"&&i.jsx(JDt,{change:t,currentReleasePlan:d,changeRequestState:s,actions:e}),t.action==="resumeMilestoneProgression"&&i.jsx(ZDt,{change:t,currentReleasePlan:d,changeRequestState:s,environmentName:r,featureName:n,actions:e}),t.action==="startMilestone"&&i.jsx(QDt,{change:t,currentReleasePlan:d,changeRequestState:s,actions:e}),t.action==="changeReleasePlanSafeguard"&&i.jsx(eLt,{change:t,currentReleasePlan:d,changeRequestState:s,environmentName:r,featureName:n,onSubmit:y,onDelete:b,actions:e}),t.action==="deleteReleasePlanSafeguard"&&i.jsx(tLt,{change:t,currentReleasePlan:d,changeRequestState:s,environmentName:r,featureName:n,onSubmit:y,onDelete:b,actions:e})]})},oLt=({change:e,changeRequestState:t,projectId:n,featureName:r,environmentName:o,...s})=>{var u,d;const{feature:a}=ws(n,r),l=(d=(u=a.environments.find(p=>p.name===o))==null?void 0:u.safeguards)==null?void 0:d[0],c=Ns(t)?e.payload.snapshot??void 0:l;if(e.payload.safeguard)return i.jsx(rle,{safeguard:e.payload.safeguard,currentSafeguard:c,changeRequestState:t,environmentName:o,featureName:r,safeguardType:"featureEnvironment",...s})},sLt=({change:e,changeRequestState:t,projectId:n,featureName:r,environmentName:o,...s})=>{var u,d;const{feature:a}=ws(n,r),l=(d=(u=a.environments.find(p=>p.name===o))==null?void 0:u.safeguards)==null?void 0:d[0],c=Ns(t)?e.payload.snapshot??void 0:l;if(c)return i.jsx(ole,{safeguard:c,changeRequestState:t,environmentName:o,featureName:r,safeguardType:"featureEnvironment",...s})},iLt=({actions:e,change:t,featureName:n,environmentName:r,projectId:o,changeRequestState:s,onRefetch:a})=>{const{addChange:l}=ia(),{refetch:c}=nc(o),{setToastData:u,setToastApiError:d}=_t(),p=async h=>{try{await l(o,r,{feature:n,action:"changeFeatureEnvSafeguard",payload:{safeguard:h}}),await c(),u({type:"success",text:"Added to draft"}),a==null||a()}catch(m){d(pt(m))}},f=async h=>{try{await l(o,r,{feature:n,action:"deleteFeatureEnvSafeguard",payload:{safeguardId:h}}),await c(),u({type:"success",text:"Added to draft"}),a==null||a()}catch(m){d(pt(m))}};return i.jsxs(i.Fragment,{children:[t.action==="changeFeatureEnvSafeguard"&&i.jsx(oLt,{change:t,changeRequestState:s,environmentName:r,featureName:n,projectId:o,onSubmit:p,onDelete:f,actions:e}),t.action==="deleteFeatureEnvSafeguard"&&i.jsx(sLt,{change:t,changeRequestState:s,environmentName:r,featureName:n,projectId:o,onSubmit:p,onDelete:f,actions:e})]})},aLt=v(K)(({theme:e})=>({overflow:"hidden",border:"1px solid",borderBottom:"none",borderRadius:0,borderColor:e.palette.divider,'&[data-conflict="change"]':{borderColor:e.palette.warning.border},'[data-conflict="change"] + &':{borderTopColor:e.palette.warning.border},'[data-conflict="feature"] &':{borderTopColor:e.palette.divider},"&:last-child":{borderBottomStyle:"solid",borderRadius:`0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`}})),rU=v(Dt)(({theme:e})=>({borderRadius:0,padding:e.spacing(1,2),"&.MuiAlert-standardWarning":{borderStyle:"none none solid none"}})),lLt=v("ul")(({theme:e})=>({display:"inline",padding:0,li:{display:"inline"},"li + li::before":{content:'", "'}})),cLt=v(K)(({theme:e})=>({padding:e.spacing(3),"&:empty":{display:"none"}})),oU=({change:e,feature:t,changeRequest:n,actions:r,onNavigate:o,isDefaultChange:s,onRefetch:a})=>{const l=e.conflict||e.scheduleConflicts;return i.jsxs(aLt,{"data-conflict":l?"change":void 0,children:[i.jsx(te,{condition:!!e.conflict&&!t.conflict,show:i.jsxs(rU,{severity:"warning",children:[i.jsx("strong",{children:"Conflict!"})," This change can’t be applied."," ",e.conflict,"."]})}),i.jsx(te,{condition:!!e.scheduleConflicts,show:i.jsxs(rU,{severity:"warning",children:[i.jsx("strong",{children:"Potential conflict!"})," This change would create conflicts with the following scheduled change request(s):"," ",i.jsxs(lLt,{children:[(e.scheduleConflicts??{changeRequests:[]}).changeRequests.map(({id:c,title:u})=>{const d=u?`#${c} (${u})`:`#${c}`;return i.jsx("li",{children:i.jsx(ft,{to:`/projects/${n.project}/change-requests/${c}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${c}`,children:d})},c)}),"."]})]})}),i.jsxs(cLt,{children:[(e.action==="addDependency"||e.action==="deleteDependency")&&i.jsx(WIt,{actions:r,change:e,projectId:n.project,onNavigate:o}),e.action==="updateEnabled"&&i.jsx(XPt,{isDefaultChange:s,enabled:e.payload.enabled,actions:r}),e.action==="archiveFeature"&&i.jsx(zIt,{actions:r}),e.action==="addStrategy"||e.action==="deleteStrategy"||e.action==="updateStrategy"?i.jsx(Dae,{actions:r,isDefaultChange:s,change:e,featureName:t.name,environmentName:n.environment,projectId:n.project,changeRequestState:n.state}):null,e.action==="patchVariant"&&i.jsx(OIt,{feature:t.name,project:n.project,changeRequestState:n.state,environment:n.environment,change:e,actions:r}),e.action==="reorderStrategy"&&i.jsx(BIt,{feature:t.name,project:n.project,environment:n.environment,change:e,actions:r}),(e.action==="addReleasePlan"||e.action==="deleteReleasePlan"||e.action==="startMilestone"||e.action==="changeMilestoneProgression"||e.action==="deleteMilestoneProgression"||e.action==="changeReleasePlanSafeguard"||e.action==="deleteReleasePlanSafeguard"||e.action==="resumeMilestoneProgression"||e.action==="updateMilestoneStrategy")&&i.jsx(rLt,{actions:r,change:e,featureName:t.name,environmentName:n.environment,projectId:n.project,changeRequestState:n.state,changeRequest:n,feature:t,onRefetch:a}),(e.action==="changeFeatureEnvSafeguard"||e.action==="deleteFeatureEnvSafeguard")&&i.jsx(iLt,{actions:r,change:e,featureName:t.name,environmentName:n.environment,projectId:n.project,changeRequestState:n.state,onRefetch:a})]})]},a0(e))},uLt=v("div")({width:"100%",display:"flex",flexDirection:"column"}),dLt=({constraints:e})=>{const{context:t}=iu();return t.length===0?null:i.jsx(uLt,{children:i.jsx(L7,{children:e.map(n=>i.jsx(q7,{constraint:n},n[Vl]||a0(n)))})})},sU=({change:e,currentSegment:t})=>{const n=e.action==="deleteSegment"?void 0:e.payload;return i.jsx(Sl,{entry:{preData:Sg(t,["createdAt","createdBy"]),data:Sg(n,["snapshot"])}})},pLt=v("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",alignItems:"center",columnGap:e.spacing(1)})),fLt=v(K,{shouldForwardProp:e=>e!=="conflict"})(({theme:e,conflict:t})=>({display:"flex",flexFlow:"column",gap:e.spacing(1),border:`1px solid ${t?e.palette.warning.border:e.palette.divider}`,borderTopColor:e.palette.divider,padding:e.spacing(3),borderRadius:`0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`})),hLt=({actions:e,change:t,changeRequestState:n})=>{var c,u;const{segment:r}=L_(t.payload.id),o=t.payload.snapshot,s=Ns(n)?(u=(c=t.payload)==null?void 0:c.snapshot)==null?void 0:u.name:r==null?void 0:r.name,a=Ns(n)?o:r,l=i.jsxs(pLt,{children:[i.jsxs(Yp,{children:[i.jsx(ii,{children:"View change"}),i.jsx(ii,{children:"View diff"})]}),e]});return i.jsx(R0,{children:i.jsxs(fLt,{conflict:t.conflict,children:[t.action==="deleteSegment"&&i.jsxs(i.Fragment,{children:[i.jsxs(js,{children:[i.jsxs(Ss,{children:[i.jsx(Py,{children:"Deleting segment"}),i.jsx(j3,{newName:t.payload.name,previousName:s})]}),l]}),i.jsx(Mo,{sx:{display:"contents"}}),i.jsx(Mo,{sx:{mt:1},variant:"diff",children:i.jsx(sU,{change:t,currentSegment:a})})]}),t.action==="updateSegment"&&i.jsxs(i.Fragment,{children:[i.jsx(gO,{data:{current:r,change:t,changeType:"segment"},changeRequestState:n}),i.jsxs(js,{children:[i.jsxs(Ss,{children:[i.jsx(Bl,{children:"Editing segment"}),i.jsx(j3,{newName:t.payload.name,previousName:s})]}),l]}),i.jsx(Mo,{children:i.jsx(dLt,{constraints:t.payload.constraints})}),i.jsx(Mo,{variant:"diff",children:i.jsx(sU,{change:t,currentSegment:a})})]})]})})},gLt=({segmentChange:e,onNavigate:t,actions:n,changeRequestState:r})=>{const{segment:o}=L_(e.payload.id);return i.jsxs(Y3,{elevation:0,sx:s=>({marginTop:s.spacing(2),marginBottom:s.spacing(2),overflow:"hidden"}),children:[i.jsxs(K,{sx:s=>({backgroundColor:s.palette.neutral.light,borderRadius:`${s.shape.borderRadiusLarge}px ${s.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:e.conflict?s.palette.warning.border:s.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[i.jsx(rae,{conflict:e.conflict}),i.jsxs(K,{sx:{display:"flex",pt:2,pb:2,px:3},children:[i.jsx(J,{children:"Segment name:"}),i.jsx(Sn,{component:ft,to:`/segments/edit/${e.payload.id}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:t,children:i.jsx("strong",{children:e.payload.name||(o==null?void 0:o.name)})})]})]}),i.jsx(hLt,{change:e,actions:n,changeRequestState:r})]})},mLt=({changeRequest:e,onRefetch:t,onNavigate:n})=>{var r,o;return i.jsxs(K,{children:[i.jsx(te,{condition:e.segments.length>0,show:i.jsx(J,{variant:"body2",color:"text.secondary",children:"You request changes for these segments:"})}),(r=e.segments)==null?void 0:r.map(s=>i.jsx(gLt,{segmentChange:s,onNavigate:n,changeRequestState:e.state,actions:i.jsx($j,{changeRequest:e,feature:"Unused",change:s,onRefetch:t})},s.payload.id)),i.jsx(te,{condition:e.features.length>0,show:i.jsx(J,{variant:"body2",color:"text.secondary",children:"You request changes for these feature flags:"})}),(o=e.features)==null?void 0:o.map(s=>i.jsxs(GPt,{featureName:s.name,projectId:e.project,onNavigate:n,conflict:s.conflict,children:[s.changes.map((a,l)=>i.jsx(oU,{actions:i.jsx($j,{changeRequest:e,feature:s.name,change:a,onRefetch:t}),changeRequest:e,change:a,feature:s,onNavigate:n,onRefetch:t},l)),s.defaultChange?i.jsx(oU,{isDefaultChange:!0,changeRequest:e,change:s.defaultChange,feature:s}):null]},s.name))]})},yLt=v(ed)(({theme:e})=>({height:"32px",width:"32px",marginTop:e.spacing(1),marginRight:e.spacing(2)})),xLt=v(K)(({theme:e})=>({display:"flex",marginTop:e.spacing(2),marginBottom:e.spacing(1)})),vLt=({user:e,commentText:t,onTypeComment:n,children:r})=>i.jsxs(i.Fragment,{children:[i.jsxs(xLt,{children:[i.jsx(yLt,{user:e}),i.jsx(xn,{variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>n(o.target.value),value:t})]}),i.jsx(K,{sx:{display:"flex",justifyContent:"flex-end"},children:r})]}),bLt=v(K)(({theme:e})=>({display:"flex",flexDirection:"row",width:"100%","& > div":{width:"100%"},justifyContent:"space-between",marginBottom:e.spacing(1)}));v(J)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader}));const CLt=v(Mt)(({theme:e})=>({borderRadius:e.shape.borderRadius})),wLt=({environmentChangeRequest:e,title:t,setTitle:n,children:r})=>{const[o,s]=g.useState(!0),{updateTitle:a}=ia(),{setToastData:l,setToastApiError:c}=_t(),u=()=>{s(!o)},d=async()=>{u();try{await a(e.project,e.id,t),l({type:"success",text:"Change request title updated!"})}catch(p){c(pt(p))}};return i.jsxs(bLt,{children:[i.jsx(te,{condition:o,show:r,elseShow:i.jsx(Yr,{label:"Change request title",id:"group-name",value:t,fullWidth:!0,onChange:p=>n(p.target.value),disabled:o})}),i.jsx(te,{condition:o,show:i.jsx(CLt,{onClick:u,children:i.jsx(oi,{})})}),i.jsx(te,{condition:!o,show:i.jsxs(i.Fragment,{children:[i.jsx($e,{variant:"contained",color:"primary",sx:p=>({marginLeft:p.spacing(2)}),onClick:()=>d(),children:"Save"}),i.jsx($e,{sx:p=>({marginLeft:p.spacing(1)}),variant:"outlined",onClick:u,children:"Cancel"})," "]})})]})},SLt=({featuresCount:e,segmentsCount:t})=>i.jsxs(K,{component:"span",sx:{display:"inline",pl:.5},children:[i.jsxs(J,{component:"span",variant:"body2",fontWeight:"bold",display:"inline",children:[e," ",e===1?"feature flag":"feature flags"]}),i.jsx(te,{condition:t>0,show:i.jsxs(i.Fragment,{children:[i.jsx(J,{component:"span",variant:"body2",children:" and "}),i.jsxs(J,{component:"span",variant:"body2",fontWeight:"bold",display:"inline",children:[t," ",t===1?"segment":"segments"]})]})})]}),jLt=g.forwardRef(function(t,n){const{children:r,...o}=t,s=g.useRef(null),a=g.Children.toArray(r),l=oie({count:g.Children.count(r),getScrollElement:()=>s.current,estimateSize:()=>56,overscan:3});return i.jsx("div",{ref:n,children:i.jsx("div",{ref:s,...o,children:i.jsx("ul",{style:{height:`${l.getTotalSize()}px`,width:"100%",position:"relative"},children:l.getVirtualItems().map(c=>{const u=a[c.index];if(!u)return null;const d={position:"absolute",left:0,width:"100%",top:`${c.start}px`};return g.cloneElement(u,{ref:l.measureElement,key:c.key,"data-index":c.index,style:d})})})})})});function ELt(e){const{virtualThreshold:t=250,getOptionLabel:n,className:r,...o}=e,s=e.options.length>t,a={...o,getOptionLabel:n,disableListWrap:!0,...s&&{ListboxComponent:jLt,groupBy:void 0}};return i.jsx(Zl,{...a})}const kLt=(e,t)=>{const{data:n,error:r,mutate:o}=On(yt(`api/admin/projects/${e}/change-requests/available-reviewers/${t}`),TLt);return g.useMemo(()=>({reviewers:(n==null?void 0:n.reviewers)||[],loading:!r&&!n,refetchReviewers:()=>o(),error:r}),[n,r,o])},TLt=e=>fetch(e).then(en("Available Change Request Reviewers")).then(t=>t.json()),RLt=({onClick:e,count:t,disabled:n=!1})=>i.jsxs($e,{sx:{ml:2},variant:"contained",onClick:e,disabled:n,children:["Submit change request (",t,")"]}),ALt=v("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),PLt=v("li")({width:"100%"}),_Lt=v("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),ILt=(e,t,{selected:n})=>g.createElement(PLt,{...e,key:t.id},i.jsx(Si,{icon:i.jsx(m0,{fontSize:"small"}),checkedIcon:i.jsx(y0,{fontSize:"small"}),style:{marginRight:8},checked:n}),i.jsxs(_Lt,{children:[i.jsx("span",{children:t.name||t.username}),i.jsx("span",{children:t.name&&t.username?t.username:t.email})]})),OLt=e=>i.jsx(ALt,{children:e.length>1?`${e.length} reviewers`:e[0].name||e[0].username||e[0].email}),MLt=({environmentChangeRequest:e,reviewers:t,setReviewers:n,onReview:r,onDiscard:o,sendToReview:s,disabled:a,setDisabled:l})=>{const c=Bt(),{reviewers:u,loading:d}=kLt(e.project,e.environment),p=(h,m,y)=>{h.type==="keydown"&&h.key==="Backspace"&&y==="removeOption"||n(m)},f=(h,{inputValue:m})=>h.filter(({name:y,username:b,email:x})=>f2(m,x)||f2(m,y)||f2(m,b));return i.jsxs(i.Fragment,{children:[i.jsx(ELt,{sx:{ml:"auto",width:c.spacing(40)},size:"small",limitTags:3,openOnFocus:!0,multiple:!0,disableCloseOnSelect:!0,value:t,onChange:p,options:u,renderOption:ILt,filterOptions:f,freeSolo:t.length>=10?!1:void 0,getOptionDisabled:h=>t.length>=10&&!t.find(m=>m.id===h.id),isOptionEqualToValue:(h,m)=>h.id===m.id,getOptionLabel:h=>h.email||h.name||h.username||"",renderInput:h=>i.jsx(xn,{...h,label:`Reviewers (${t.length})`}),renderTags:h=>OLt(h),noOptionsText:d?"Loading…":"No options"}),i.jsx(RLt,{onClick:()=>r(s),count:_O(e),disabled:a}),i.jsx($e,{sx:{ml:2},variant:"outlined",disabled:a,onClick:()=>{l(!0),o(e.id)},children:"Discard changes"})]})},$Lt=v(K)(({theme:e})=>({padding:e.spacing(3,3,1,3),border:"2px solid",borderColor:e.palette.divider,borderRadius:`${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px 0 0`,borderBottom:"none",overflow:"hidden",backgroundColor:e.palette.neutral.light})),DLt=v(K)(({theme:e})=>({padding:e.spacing(3,3,3,3),border:"2px solid",marginBottom:e.spacing(5),borderColor:e.palette.divider,borderRadius:`0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`,borderTop:"none",overflow:"hidden"})),LLt=({environmentChangeRequest:e,onClose:t,onReview:n,onDiscard:r,children:o})=>{const s=Bt(),[a,l]=g.useState(""),{user:c}=gs(),[u,d]=g.useState(e.title),{changeState:p,updateRequestedApprovers:f}=ia(),[h,m]=g.useState([]),[y,b]=g.useState(!1),x=async C=>{b(!0);try{await p(C,e.id,"Draft",{state:"In review",comment:a}),h&&h.length>0&&await f(C,e.id,h.map(w=>w.id))}catch{b(!1)}};return i.jsxs(K,{children:[i.jsxs($Lt,{children:[i.jsxs(K,{sx:{display:"flex",alignItems:"end"},children:[i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:[i.jsx(J,{component:"span",variant:"h2",children:e.environment}),i.jsx(VLt,{}),i.jsx(J,{component:"span",variant:"body2",color:"text.secondary",children:"Updates:"}),i.jsx(SLt,{featuresCount:e.features.length,segmentsCount:e.segments.length})]}),i.jsx(K,{sx:{ml:"auto"},children:i.jsx($ie,{changeRequest:e})})]}),i.jsx(pr,{sx:{my:3}}),i.jsx(wLt,{environmentChangeRequest:e,title:u,setTitle:d,children:i.jsx(Yr,{label:"Change request title",id:"group-name",fullWidth:!0,value:u,onChange:()=>{},disabled:!0})})]}),i.jsxs(DLt,{children:[o,i.jsx(te,{condition:(e==null?void 0:e.state)==="Draft",show:i.jsx(vLt,{user:c,commentText:a,onTypeComment:l})}),i.jsxs(K,{sx:{display:"flex",mt:3},children:[i.jsx(te,{condition:(e==null?void 0:e.state)==="Draft",show:i.jsx(MLt,{environmentChangeRequest:e,reviewers:h,setReviewers:m,onReview:n,onDiscard:r,sendToReview:x,disabled:y,setDisabled:b})}),i.jsx(te,{condition:e.state==="In review"||e.state==="Approved",show:i.jsx(i.Fragment,{children:i.jsxs(WLt,{children:[i.jsx(HLt,{}),i.jsx(J,{color:s.palette.success.dark,children:"Draft successfully sent to review"}),i.jsx($e,{sx:{marginLeft:2},variant:"outlined",component:ft,to:`/projects/${e.project}/change-requests/${e.id}`,onClick:()=>{t()},children:"View change request page"})]})})})]})]})]},e.id)},NLt=v(Y4)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginLeft:"0.3rem",color:e.palette.action.active})),FLt=v("div")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody})),BLt=()=>i.jsx($n,{actions:"",titleElement:i.jsxs(i.Fragment,{children:[i.jsxs(K,{sx:{display:"flex",alignItems:"center"},children:["Review your changes",i.jsx(Rt,{title:"Here you can see all the changes that you are suggesting and you can send them for review. You can still discard the changes after you sent them for review or even cancel the entire review if you need it",arrow:!0,children:i.jsx(NLt,{})})]}),i.jsx(FLt,{children:"Make sure you are sending the right changes to be reviewed"})]})}),iU=v(ir)(({theme:e})=>({height:"100vh",overflow:"auto",padding:e.spacing(6),[e.breakpoints.down("md")]:{padding:e.spacing(4,2)},"& .header":{padding:e.spacing(0,0,2,0)},"& .body":{padding:e.spacing(3,0,0,0)},borderRadius:`${e.spacing(1.5,0,0,1.5)} !important`})),zLt=v($e)(({theme:e})=>({marginTop:e.spacing(2),marginLeft:"auto"})),HLt=v(b0)(({theme:e})=>({color:e.palette.success.main,height:"32px",width:"32px",marginRight:e.spacing(1)})),WLt=v(K)(()=>({marginLeft:"auto",display:"flex",alignItems:"center"})),VLt=()=>i.jsx(J,{component:"span",sx:{marginLeft:1.5,marginRight:1.5,color:"divider"},children:"|"}),ULt=({open:e,project:t,onClose:n})=>{const{data:r,loading:o,refetch:s}=nc(t),a=wo("featureId"),{discardDraft:l}=ia(),{setToastApiError:c}=_t(),[u,d]=g.useState(!1),p=async h=>{try{await h(t),await Promise.all([s(),a?sj(t,a):Promise.resolve()]),n()}catch(m){c(pt(m))}},f=async h=>{try{await l(t,h),await Promise.all([s(),a?sj(t,a):Promise.resolve()]),n()}catch(m){c(pt(m))}};return!o&&!r?i.jsx(hl,{open:e,onClose:n,label:"Review changes",children:i.jsxs(iU,{disableBorder:!0,header:i.jsx($n,{titleElement:"Review your changes"}),children:["There are no changes to review.",i.jsx(zLt,{onClick:n,children:"Close"})]})}):i.jsx(hl,{open:e,onClose:n,label:"Review changes",children:i.jsx(iU,{disableBorder:!0,header:i.jsx(BLt,{}),children:r==null?void 0:r.map(h=>i.jsx(gtt,{value:{willOverwriteStrategyChanges:u,registerWillOverwriteStrategyChanges:()=>d(!0)},children:i.jsx(LLt,{environmentChangeRequest:h,onClose:n,onReview:p,onDiscard:f,children:i.jsx(mLt,{changeRequest:h,onNavigate:n,onRefetch:s})},h.id)},h.id))})})},ile=g.createContext(void 0),GLt=v("div",{shouldForwardProp:e=>e!=="top"})(({theme:e,top:t})=>({position:"sticky",zIndex:e.zIndex.sticky-100,...t!==void 0?{"&":{top:t}}:{}})),MO=({children:e,...t})=>{const n=g.useContext(ile),r=g.useRef(null),[o,s]=g.useState(null),[a,l]=g.useState();if(!n)throw new Error("Sticky component must be used within a StickyProvider");const{registerStickyItem:c,unregisterStickyItem:u,getTopOffset:d}=n;return g.useEffect(()=>{r.current&&o===null&&s(Number.parseInt(getComputedStyle(r.current).getPropertyValue("top"),10))},[]),g.useEffect(()=>{l(d(r)+(o||0))},[d,o]),g.useEffect(()=>{if(r.current)return c(r),()=>{u(r)}},[c,u]),i.jsx(GLt,{ref:r,top:a,...t,children:e})},qLt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(1,0)})),YLt=v(K)(({theme:e})=>({width:"100%",paddingLeft:e.spacing(3),paddingRight:e.spacing(9),marginLeft:"auto",marginRight:"auto",[e.breakpoints.down("lg")]:{marginLeft:0,marginRight:0,paddingLeft:e.spacing(2),paddingRight:e.spacing(2)},[e.breakpoints.down("sm")]:{minWidth:"100%"}})),KLt=({changeRequests:e,onClick:t})=>{const n=e.map(({environment:a})=>a),r=e.reduce((a,l)=>a+_O(l),0),s=e.length===1&&["Draft","In review","Approved"].includes(e[0].state)?{Draft:" that need to be reviewed","In review":" that are in review",Approved:" that are approved. Adding more changes will clear the approvals and require a new review"}[e[0].state]:"";return i.jsx(YLt,{children:i.jsxs(qLt,{children:[i.jsxs(J,{variant:"body2",sx:{mr:4},children:[i.jsx("strong",{children:"Change request mode"})," – You have changes"," ",i.jsx(te,{condition:!!n,show:i.jsxs(i.Fragment,{children:["in"," ",n.map((a,l)=>l===0?i.jsx(g.Fragment,{children:i.jsx("strong",{children:a})},a):i.jsxs(g.Fragment,{children:[l===n.length-1?" and ":", ",i.jsx("strong",{children:a})]},a))]})}),s,"."]}),i.jsxs($e,{variant:"contained",onClick:t,sx:{ml:"auto"},children:["View changes (",r,")"]})]})})},XLt=v(MO)(({theme:e})=>({borderBottom:`1px solid ${e.palette.warning.border}`,color:e.palette.warning.contrastText,backgroundColor:e.palette.warning.light,zIndex:250})),JLt=({project:e})=>{const[t,n]=g.useState(!1),{data:r,loading:o}=nc(e),s=g.useMemo(()=>r==null?void 0:r.filter(a=>["Draft","In review","Approved"].includes(a.state)),[r]);return!o&&!r||(r==null?void 0:r.length)===0?null:i.jsxs(XLt,{children:[i.jsx(te,{condition:!!(s!=null&&s.length),show:i.jsx(KLt,{changeRequests:s,onClick:()=>{n(!0)}})}),i.jsx(ULt,{project:e,open:t,onClose:()=>{n(!1)}})]})},ZLt=()=>{const[e,t]=ai("navigation-mode:v1","full");return g.useEffect(()=>{const n=r=>{r.key==="b"&&(r.metaKey||r.ctrlKey)&&(r.preventDefault(),t(e==="mini"?"full":"mini"))};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e]),[e,t]};var $O={},QLt=je;Object.defineProperty($O,"__esModule",{value:!0});var ale=$O.default=void 0,eNt=QLt(Ee()),aU=i,tNt=(0,eNt.default)([(0,aU.jsx)("path",{d:"M17.59 18 19 16.59 14.42 12 19 7.41 17.59 6l-6 6z"},"0"),(0,aU.jsx)("path",{d:"m11 18 1.41-1.41L7.83 12l4.58-4.59L11 6l-6 6z"},"1")],"KeyboardDoubleArrowLeft");ale=$O.default=tNt;var DO={},nNt=je;Object.defineProperty(DO,"__esModule",{value:!0});var lle=DO.default=void 0,rNt=nNt(Ee()),lU=i,oNt=(0,rNt.default)([(0,lU.jsx)("path",{d:"M6.41 6 5 7.41 9.58 12 5 16.59 6.41 18l6-6z"},"0"),(0,lU.jsx)("path",{d:"m13 6-1.41 1.41L16.17 12l-4.58 4.59L13 18l6-6z"},"1")],"KeyboardDoubleArrowRight");lle=DO.default=oNt;const sNt=v(K,{shouldForwardProp:e=>e!=="mode"})(({theme:e,mode:t})=>({display:"flex",justifyContent:"space-between",alignItems:"center",padding:e.spacing(0,1,0,t==="mini"?1.5:2),cursor:"pointer"})),iNt=({mode:e,onChange:t})=>i.jsxs(sNt,{onClick:t,mode:e,children:[e==="full"&&i.jsx(K,{sx:n=>({color:n.palette.neutral.main,fontSize:"small"}),children:"Hide (⌘ + B)"}),i.jsx(Mt,{"aria-label":`${e==="full"?"Collapse":"Expand"} (⌘ + B)`,children:e==="full"?i.jsx(ale,{color:"primary"}):i.jsx(Rt,{title:"Expand (⌘ + B)",placement:"right",children:i.jsx(lle,{"data-testid":"expand-navigation",color:"primary"})})})]});v(K)(({theme:e})=>({padding:e.spacing(2,1,0,1.5)}));const aNt=e=>{const t=e.split("/").filter(o=>o);return t.length===0||t[0]==="admin"&&t.length===1?"/projects":t[0]==="admin"&&t.length>1?`/${t[0]}/${t[1]}`:`/${t[0]}`},lNt=()=>{const{pathname:e}=jo();return aNt(e)},cNt=e=>g.createElement("svg",{width:150,height:58,viewBox:"0 0 150 58",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{clipPath:"url(#clip0_2239_6192)"},g.createElement("path",{d:"M28.8381 47.2041C38.9811 47.2041 47.2036 38.9816 47.2036 28.8386C47.2036 18.6956 38.9811 10.4731 28.8381 10.4731C18.6952 10.4731 10.4727 18.6956 10.4727 28.8386C10.4727 38.9816 18.6952 47.2041 28.8381 47.2041Z",fill:"#1A4049"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"white"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"white"}),g.createElement("path",{d:"M31.4619 31.4624H36.7098V36.7103H31.4619V31.4624Z",fill:"#817AFE"}),g.createElement("path",{d:"M57.7549 31.9398V25.8884H60.4936V31.6414C60.4936 33.331 61.3912 34.4421 63.0809 34.4421C64.7705 34.4421 65.6681 33.331 65.6681 31.6414V25.8884H68.4229V31.9398C68.4229 34.8485 66.4762 36.9444 63.1199 36.9444C59.7016 36.9444 57.7549 34.8485 57.7549 31.9398ZM73.9004 36.708H71.1846V25.8884H73.9004V27.7066C74.263 27.0752 74.7866 26.5513 75.4178 26.1884C76.049 25.8254 76.7651 25.6363 77.4932 25.6405C80.209 25.6405 82.0065 27.6308 82.0065 30.3879V36.708H79.2517V30.9343C79.2517 29.224 78.2462 28.09 76.6208 28.09C74.9955 28.09 73.905 29.2378 73.905 30.9343L73.9004 36.708ZM84.8072 20.9688H87.5437V36.708H84.8072V20.9688ZM101.295 31.4508V31.7493H92.6975C92.8054 33.4389 94.0451 34.7337 95.8403 34.7337C97.5735 34.7337 98.2783 33.8567 98.4711 33.5583H101.166C100.994 34.6694 99.5203 37.0018 95.8403 37.0018C92.3348 37.0018 89.961 34.5661 89.961 31.3154C89.961 27.9568 92.3118 25.6267 95.6268 25.6267C98.9417 25.6267 101.295 27.9201 101.295 31.4508ZM92.7824 29.8668H98.4298C98.0235 28.4894 97.018 27.7295 95.6268 27.7295C94.1507 27.7272 93.1245 28.5193 92.7824 29.8645V29.8668ZM107.388 29.9288H110.939C110.939 28.6249 109.954 27.7915 108.352 27.7915C106.832 27.7915 106.286 28.6042 106.107 28.882H103.352C103.581 27.7479 104.933 25.6106 108.356 25.6106C111.713 25.6106 113.574 27.3645 113.574 29.9288V33.5858C113.574 34.2493 113.804 34.5041 114.428 34.5707V36.7722H113.574C112.183 36.7516 111.35 36.2373 111.049 35.2755C110.537 36.0675 109.383 36.9444 107.544 36.9444C104.998 36.9444 103.074 35.5119 103.074 33.2874C103.074 31.0629 104.715 29.9288 107.388 29.9288ZM110.939 32.7089V31.7906H107.838C106.554 31.7906 105.771 32.2497 105.771 33.2438C105.771 34.2929 106.756 34.9127 108.124 34.9127C109.656 34.9127 110.939 34.1643 110.939 32.7089ZM120.092 32.2819C117.718 32.112 116.113 30.9986 116.113 28.9026C116.113 26.871 117.973 25.5877 120.882 25.5877C124.784 25.5877 125.886 27.5987 126.185 28.6455H123.299C123.106 28.4159 122.486 27.663 120.861 27.663C119.557 27.663 118.873 28.09 118.873 28.7534C118.873 29.3526 119.332 29.7383 120.411 29.8875L122.248 30.0803C125.179 30.3351 126.38 31.4577 126.38 33.5858C126.38 35.6175 124.69 37.0087 121.375 37.0087C117.355 37.0087 116.051 34.6763 115.838 33.6731H118.767C118.875 33.9279 119.536 34.8921 121.375 34.8921C122.895 34.8921 123.6 34.3778 123.6 33.6937C123.6 33.0096 123.216 32.6239 121.993 32.4747C121.224 32.4104 120.84 32.3691 120.092 32.2819ZM131.21 36.708H128.494V20.9688H131.21V27.7066C131.572 27.0752 132.096 26.5513 132.727 26.1884C133.358 25.8254 134.075 25.6363 134.803 25.6405C137.518 25.6405 139.316 27.6308 139.316 30.3879V36.708H136.561V30.9343C136.561 29.224 135.556 28.09 133.93 28.09C132.305 28.09 131.214 29.2378 131.214 30.9343L131.21 36.708Z",fill:"#1A4049"}),g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"}),g.createElement("path",{d:"M32.001 11.0002C32.001 11.0002 33.001 12.5 36.001 14C39.7281 15.8636 44.001 12 44.001 12L57.1748 1.8667L32.001 11.0002Z",fill:"white",fillOpacity:.2}),g.createElement("mask",{id:"mask0_2239_6192",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:32,y:1,width:26,height:26},g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"})),g.createElement("g",{mask:"url(#mask0_2239_6192)"},g.createElement("rect",{x:39.2578,y:15.4331,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:35.8115,y:7.39209,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:9.68945,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:47.2998,y:1.64795,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:51.8945,y:8.54053,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:17.7305,width:5.74371,height:5.74371,fill:"#FFC800"})),g.createElement("path",{d:"M57.0708 -0.0906984L55.2288 1.72138L52.7073 1.18911L53.8435 3.54975L52.5881 5.82592L55.1321 5.4726L56.8782 7.4116L57.3142 4.83262L59.6484 3.75494L57.3742 2.51594L57.0708 -0.0906984Z",fill:"#817AFE"}),g.createElement("rect",{x:96,y:12,width:5,height:5,fill:"#817AFE"}),g.createElement("rect",{x:117,y:15,width:4,height:4,fill:"#FFC800"}),g.createElement("rect",{x:61,y:11,width:3,height:3,fill:"#8AD323"}),g.createElement("rect",{x:135,y:11,width:4,height:4,fill:"#FF458F"}),g.createElement("rect",{x:75,y:4,width:4,height:4,fill:"#FF458F"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_2239_6192"},g.createElement("rect",{width:150,height:57.6768,fill:"white"})))),uNt=e=>g.createElement("svg",{width:150,height:58,viewBox:"0 0 150 58",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{clipPath:"url(#clip0_2244_6496)"},g.createElement("path",{d:"M28.8381 47.2041C38.9811 47.2041 47.2036 38.9816 47.2036 28.8386C47.2036 18.6956 38.9811 10.4731 28.8381 10.4731C18.6952 10.4731 10.4727 18.6956 10.4727 28.8386C10.4727 38.9816 18.6952 47.2041 28.8381 47.2041Z",fill:"white"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"white"}),g.createElement("path",{d:"M31.4627 20.9663V31.4622H36.7083V20.9663H31.4627ZM26.2147 26.2142V20.9663H20.9668V36.7078H31.4627V31.4622H26.2147V26.2142Z",fill:"#1A4049"}),g.createElement("path",{d:"M31.4619 31.4624H36.7098V36.7103H31.4619V31.4624Z",fill:"#817AFE"}),g.createElement("path",{d:"M57.7549 31.9398V25.8884H60.4936V31.6414C60.4936 33.331 61.3912 34.4421 63.0809 34.4421C64.7705 34.4421 65.6681 33.331 65.6681 31.6414V25.8884H68.4229V31.9398C68.4229 34.8485 66.4762 36.9444 63.1199 36.9444C59.7016 36.9444 57.7549 34.8485 57.7549 31.9398ZM73.9004 36.708H71.1846V25.8884H73.9004V27.7066C74.263 27.0752 74.7866 26.5513 75.4178 26.1884C76.049 25.8254 76.7651 25.6363 77.4932 25.6405C80.209 25.6405 82.0065 27.6308 82.0065 30.3879V36.708H79.2517V30.9343C79.2517 29.224 78.2462 28.09 76.6208 28.09C74.9955 28.09 73.905 29.2378 73.905 30.9343L73.9004 36.708ZM84.8072 20.9688H87.5437V36.708H84.8072V20.9688ZM101.295 31.4508V31.7493H92.6975C92.8054 33.4389 94.0451 34.7337 95.8403 34.7337C97.5735 34.7337 98.2783 33.8567 98.4711 33.5583H101.166C100.994 34.6694 99.5203 37.0018 95.8403 37.0018C92.3348 37.0018 89.961 34.5661 89.961 31.3154C89.961 27.9568 92.3118 25.6267 95.6268 25.6267C98.9417 25.6267 101.295 27.9201 101.295 31.4508ZM92.7824 29.8668H98.4298C98.0235 28.4894 97.018 27.7295 95.6268 27.7295C94.1507 27.7272 93.1245 28.5193 92.7824 29.8645V29.8668ZM107.388 29.9288H110.939C110.939 28.6249 109.954 27.7915 108.352 27.7915C106.832 27.7915 106.286 28.6042 106.107 28.882H103.352C103.581 27.7479 104.933 25.6106 108.356 25.6106C111.713 25.6106 113.574 27.3645 113.574 29.9288V33.5858C113.574 34.2493 113.804 34.5041 114.428 34.5707V36.7722H113.574C112.183 36.7516 111.35 36.2373 111.049 35.2755C110.537 36.0675 109.383 36.9444 107.544 36.9444C104.998 36.9444 103.074 35.5119 103.074 33.2874C103.074 31.0629 104.715 29.9288 107.388 29.9288ZM110.939 32.7089V31.7906H107.838C106.554 31.7906 105.771 32.2497 105.771 33.2438C105.771 34.2929 106.756 34.9127 108.124 34.9127C109.656 34.9127 110.939 34.1643 110.939 32.7089ZM120.092 32.2819C117.718 32.112 116.113 30.9986 116.113 28.9026C116.113 26.871 117.973 25.5877 120.882 25.5877C124.784 25.5877 125.886 27.5987 126.185 28.6455H123.299C123.106 28.4159 122.486 27.663 120.861 27.663C119.557 27.663 118.873 28.09 118.873 28.7534C118.873 29.3526 119.332 29.7383 120.411 29.8875L122.248 30.0803C125.179 30.3351 126.38 31.4577 126.38 33.5858C126.38 35.6175 124.69 37.0087 121.375 37.0087C117.355 37.0087 116.051 34.6763 115.838 33.6731H118.767C118.875 33.9279 119.536 34.8921 121.375 34.8921C122.895 34.8921 123.6 34.3778 123.6 33.6937C123.6 33.0096 123.216 32.6239 121.993 32.4747C121.224 32.4104 120.84 32.3691 120.092 32.2819ZM131.21 36.708H128.494V20.9688H131.21V27.7066C131.572 27.0752 132.096 26.5513 132.727 26.1884C133.358 25.8254 134.075 25.6363 134.803 25.6405C137.518 25.6405 139.316 27.6308 139.316 30.3879V36.708H136.561V30.9343C136.561 29.224 135.556 28.09 133.93 28.09C132.305 28.09 131.214 29.2378 131.214 30.9343L131.21 36.708Z",fill:"white"}),g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"}),g.createElement("path",{d:"M32.001 11.0002C32.001 11.0002 33.001 12.5 36.001 14C39.7281 15.8636 44.001 12 44.001 12L57.1748 1.8667L32.001 11.0002Z",fill:"white",fillOpacity:.2}),g.createElement("mask",{id:"mask0_2244_6496",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:32,y:1,width:26,height:26},g.createElement("path",{d:"M32.001 11C32.001 11 34.7574 17.3405 37.8341 20.398C40.7899 23.3353 47.0406 26.1269 47.0406 26.1269L47.0433 26.1216L54.5 6.5L57.1747 1.86646L53 4L32.001 11Z",fill:"#FF458F"})),g.createElement("g",{mask:"url(#mask0_2244_6496)"},g.createElement("rect",{x:39.2578,y:15.4331,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:35.8115,y:7.39209,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:9.68945,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:47.2998,y:1.64795,width:4.59497,height:4.59497,fill:"#FFC800"}),g.createElement("rect",{x:51.8945,y:8.54053,width:3.44623,height:3.44623,fill:"#FFC800"}),g.createElement("rect",{x:45.002,y:17.7305,width:5.74371,height:5.74371,fill:"#FFC800"})),g.createElement("path",{d:"M57.0708 -0.0906984L55.2288 1.72138L52.7073 1.18911L53.8435 3.54975L52.5881 5.82592L55.1321 5.4726L56.8782 7.4116L57.3142 4.83262L59.6484 3.75494L57.3742 2.51594L57.0708 -0.0906984Z",fill:"#817AFE"}),g.createElement("rect",{x:96,y:12,width:5,height:5,fill:"#817AFE"}),g.createElement("rect",{x:117,y:15,width:4,height:4,fill:"#FFC800"}),g.createElement("rect",{x:61,y:11,width:3,height:3,fill:"#8AD323"}),g.createElement("rect",{x:135,y:11,width:4,height:4,fill:"#FF458F"}),g.createElement("rect",{x:75,y:4,width:4,height:4,fill:"#FF458F"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_2244_6496"},g.createElement("rect",{width:150,height:57.6768,fill:"white"})))),dNt=e=>g.createElement("svg",{id:"bg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 251.43 251.03",...e},g.createElement("defs",null,g.createElement("style",null,".cls-1{fill:#1a4049;}.cls-2{fill:#fff;}.cls-3{fill:#817afe;}")),g.createElement("circle",{className:"cls-1",cx:125.71,cy:125.31,r:80}),g.createElement("polygon",{className:"cls-2",points:"137.14 91.03 137.14 113.88 137.14 136.74 160 136.74 160 113.88 160 91.03 137.14 91.03"}),g.createElement("polygon",{className:"cls-2",points:"114.29 113.88 114.29 91.03 91.43 91.03 91.43 113.88 91.43 136.74 91.43 159.6 114.29 159.6 137.14 159.6 137.14 136.74 114.29 136.74 114.29 113.88"}),g.createElement("rect",{className:"cls-3",x:137.14,y:136.74,width:22.86,height:22.86})),pNt=v(K,{shouldForwardProp:e=>e!=="mode"&&e!=="admin"})(({theme:e,mode:t,admin:n})=>({backgroundColor:n?e.palette.background.application:e.palette.background.paper,borderRight:`1px solid ${e.palette.divider}`,alignSelf:"stretch",display:"flex",flexDirection:"column",zIndex:1,overflowAnchor:"none",position:"sticky",top:0,height:"100vh",minWidth:t==="full"?e.spacing(34):"auto",width:t==="full"?e.spacing(34):"auto"})),fNt=v(K,{shouldForwardProp:e=>e!=="admin"})(({theme:e,admin:t})=>({position:"sticky",top:0,width:"100%",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),backgroundColor:t?e.palette.background.application:e.palette.background.paper,zIndex:2})),hNt=v(K)(({theme:e})=>({flex:1,width:"100%",overflowY:"auto",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),display:"flex",flexDirection:"column",gap:e.spacing(2)})),gNt=v(K,{shouldForwardProp:e=>e!=="admin"})(({theme:e,admin:t})=>({position:"sticky",bottom:0,width:"100%",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),backgroundColor:t?e.palette.background.application:e.palette.background.paper,borderTop:`1px solid ${e.palette.divider}`,zIndex:2})),cU=v(ft)(({theme:e})=>Uu(e)),mNt=v(Kg)({width:"150px"}),yNt=v(ey)({width:"150px"}),xNt=v(cNt)({width:"150px"}),vNt=v(dNt)(({theme:e})=>({width:"58px",marginTop:e.spacing(.5),margin:"0 auto"})),bNt=v(Cte)(({theme:e})=>({width:"37px",marginTop:e.spacing(1),margin:"0 auto"})),CNt=({NewInUnleash:e})=>{const{routes:t}=y8(),n=Jae("celebrateUnleashFrontend"),{showOnlyAdminMenu:r}=fR(),[o,s]=ZLt(),[a,l]=EZ(),c=lNt(),[u,d]=g.useState(c);return g.useEffect(()=>{d(c)},[c]),i.jsxs(pNt,{mode:o,admin:r,children:[i.jsx(fNt,{admin:r,children:i.jsx(te,{condition:o==="full",show:i.jsx(cU,{to:"/",sx:t3,"aria-label":"Home",children:i.jsx(Ra,{darkmode:i.jsx(te,{condition:n,show:i.jsx(uNt,{}),elseShow:i.jsx(mNt,{"aria-label":"Unleash logo"})}),lightmode:i.jsx(te,{condition:n,show:i.jsx(xNt,{}),elseShow:i.jsx(yNt,{"aria-label":"Unleash logo"})})})}),elseShow:i.jsx(cU,{to:"/",sx:t3,"aria-label":"Home",children:i.jsx(Ra,{darkmode:i.jsx(bNt,{}),lightmode:i.jsx(vNt,{})})})})}),i.jsx(hNt,{children:i.jsx(te,{condition:!r,show:i.jsxs(i.Fragment,{children:[i.jsx(Wie,{mode:o,setMode:s,onClick:d,activeItem:u}),i.jsx(iV,{onClick:d,mode:o,onSetFullMode:()=>s("full"),activeItem:u,onExpandChange:p=>{l("admin",p)},expanded:a.includes("admin"),routes:t.adminRoutes})]}),elseShow:i.jsx(iV,{onClick:d,mode:o,onSetFullMode:()=>s("full"),activeItem:u,onExpandChange:p=>{l("admin",p)},expanded:a.includes("admin"),routes:t.adminRoutes})})}),i.jsxs(gNt,{admin:r,children:[e?i.jsx(e,{mode:o,onMiniModeClick:()=>s("full")}):null,i.jsx(iNt,{mode:o,onChange:()=>{s(o==="full"?"mini":"full")}})]})]})},wNt=v("img")(()=>({maxWidth:"100%"})),SNt=[{label:"Release templates",summary:"Put your rollouts on autopilot",preview:i.jsx(wNt,{src:Do(qie),alt:"Release templates preview"}),appLink:"?splash=release-management-v3",docsLink:"https://docs.getunleash.io/reference/release-templates",filter:{enterpriseOnly:!0,versionLowerThan:"7.5.0"},beta:!1,modal:!1}];var LO={},jNt=je;Object.defineProperty(LO,"__esModule",{value:!0});var cle=LO.default=void 0,ENt=jNt(Ee()),kNt=i,TNt=(0,ENt.default)((0,kNt.jsx)("path",{d:"m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}),"NewReleases");cle=LO.default=TNt;const RNt=v("span")(({theme:e})=>({position:"relative",display:"flex","::before":{content:'" "',position:"absolute",borderRadius:"50%",top:"15%",left:"15%",width:"70%",height:"70%",display:"block",backgroundColor:e.palette.common.white}})),ANt=v(cle)(({theme:e})=>({color:e.palette.primary.main,fontSize:"1.3em",position:"relative"})),PNt=v("article")(({theme:e})=>({backgroundColor:e.palette.inverse.main,color:e.palette.inverse.contrastText,padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusLarge,position:"relative",width:"290px","&:has(.read-more:focus-visible)":{outline:`2px solid ${e.palette.primary.main}`,outlineOffset:"2px"}})),_Nt=v("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",rowGap:e.spacing(.75)})),INt=v(Mt)(({theme:e})=>({position:"absolute",top:-6,right:-6,borderRadius:"50%",padding:e.spacing(.25),border:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.elevation1,color:e.palette.text.secondary,zIndex:1,":hover":{backgroundColor:e.palette.background.elevation2}})),ONt=v(J)(({theme:e})=>({display:"flex",flexFlow:"row nowrap",alignItems:"center",columnGap:".5ch",fontSize:e.typography.caption.fontSize})),MNt=v("button")(({theme:e})=>({border:"none",backgroundColor:"transparent",textAlign:"start",color:"inherit",":focus-visible":{outline:"none"},"::after":{content:'""',position:"absolute",inset:0,zIndex:1,cursor:"pointer"}})),$Nt=({item:e})=>{const t=$t(),[n,r]=ai("new-in-unleash-seen:v2",new Set),o=({label:d})=>{r(new Set([...n,d]))},[s,a]=g.useState(!1),[l,c]=g.useState(!1);g.useEffect(()=>{const d=setTimeout(()=>{a(!0)},500);return()=>clearTimeout(d)},[]);const u=()=>{e.modal===!1&&e.appLink?t(e.appLink):c(!0)};return i.jsxs(i.Fragment,{children:[i.jsx(i8e,{sx:d=>({zIndex:d.zIndex.modal}),open:!n.has(e.label)&&s,message:"New in Unleash",onClose:(d,p)=>{p==="escapeKeyDown"&&o(e)},TransitionComponent:eX,children:i.jsx(PNt,{children:i.jsxs(_Nt,{children:[i.jsxs(ONt,{component:"p",variant:"body2",children:[i.jsx(RNt,{children:i.jsx(ANt,{})}),"New in Unleash"]}),i.jsx(J,{className:"read-more",component:MNt,onClick:u,variant:"body2",fontWeight:"bold",children:e.summary}),i.jsx(INt,{"aria-label":"close",onClick:()=>{o(e)},size:"small",children:i.jsx(bo,{fontSize:"inherit"})})]})})}),i.jsx(Uie,{open:l,onClose:()=>{c(!1)},title:e.label,longDescription:e.longDescription,appLink:e.appLink,docsLink:e.docsLink,preview:e.preview,beta:e.beta})]})},DNt=({isEnterprise:e,isEnabled:t,version:n})=>({filter:{enterpriseOnly:r,flag:o,versionLowerThan:s}})=>r&&!e()||o&&!t(o)?!1:ore(n,s),LNt=e=>{const{isEnterprise:t,uiConfig:{version:n}}=ut(),r=UQ();return e.toReversed().find(DNt({isEnterprise:t,isEnabled:r,version:n}))},NNt=()=>{const e=LNt(SNt);return e?i.jsx($Nt,{item:e}):null},FNt=v(Uo)(()=>({display:"flex",flexDirection:"column",flexGrow:1,position:"relative"})),BNt=v(Uo)(({theme:e})=>({minWidth:0,maxWidth:"1512px",margin:"0 auto",paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(1856)]:{width:"100%"},[e.breakpoints.down(1856)]:{marginLeft:e.spacing(7),marginRight:e.spacing(7)},[e.breakpoints.down("lg")]:{maxWidth:"1250px",paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.down(1024)]:{marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"}})),zNt=v("div")(({theme:e})=>({margin:e.spacing(0,"auto"),flexGrow:1,width:"100%",backgroundColor:e.palette.background.application,position:"relative",display:"flex",flexDirection:"column"})),uU=v("img")(()=>({display:"block",position:"fixed",bottom:0,right:0,width:400,pointerEvents:"none",userSelect:"none",zIndex:0})),HNt=v("main")(({theme:e})=>({padding:e.spacing(0,0,6.5,0),position:"relative",[e.breakpoints.down("md")]:{padding:e.spacing(0,1.5,6.5,1.5)},zIndex:200})),WNt=v(K)(()=>({display:"flex",marginTop:0})),VNt=v(K)(()=>({display:"flex",flexDirection:"column",flexGrow:1,minWidth:0})),UNt=v(K)(()=>({display:"flex",flexDirection:"column",minHeight:"100vh",flexShrink:0})),GNt=v(K)(()=>({flex:1,display:"flex",flexDirection:"column",minHeight:0})),qNt=v(BNt)(()=>({display:"flex",flexDirection:"column",flex:1})),YNt=g.forwardRef(({children:e},t)=>{const n=wo("projectId"),{isChangeRequestConfiguredInAnyEnv:r}=vl(n||""),o=Bt(),s=Nn(o.breakpoints.down("lg")),a=Er("gtmReleaseManagement");return i.jsxs(Zjt,{children:[i.jsx(FNt,{children:i.jsxs(zNt,{children:[i.jsxs(WNt,{children:[i.jsx(te,{condition:!s,show:i.jsx(CNt,{NewInUnleash:a?void 0:Yie})}),i.jsxs(VNt,{children:[i.jsx(te,{condition:!!(n&&r()),show:i.jsx(JLt,{project:n||""})}),i.jsxs(UNt,{children:[i.jsx(_Pt,{}),i.jsx(GNt,{children:i.jsxs(qNt,{children:[i.jsx(UPt,{}),i.jsxs(HNt,{ref:t,children:[i.jsx(WPt,{}),e]})]})})]}),i.jsx(NPt,{})]})]}),i.jsx(Ra,{darkmode:i.jsx(uU,{style:{opacity:.06},src:Do(bV),alt:""}),lightmode:i.jsx(uU,{src:Do(bV),alt:""})})]})}),a&&i.jsx(NNt,{})]})}),KNt=({isStandalone:e,children:t})=>i.jsx(te,{condition:e===!0,show:t,elseShow:i.jsx(YNt,{children:t})}),ule=()=>{const{pathname:e,search:t}=jo(),r=`/login?redirect=${encodeURIComponent(e+t)}`;return i.jsx(I1,{to:r,replace:!0})},XNt=({route:e})=>{const{user:t}=gs();return!!!(t!=null&&t.id)&&e.type==="protected"?i.jsx(ule,{}):i.jsx(e.component,{})},JNt=({children:e})=>{const{refetchUser:t}=gs(),n=r=>{r instanceof dZ&&r.status===401&&t()};return i.jsx(NSe,{value:{onError:n},children:e})},ZNt=W5()(e=>({container:{alignItems:"center",background:e.mode==="light"?"#201E42":e.palette.background.paper,borderRadius:e.shape.borderRadiusMedium,boxShadow:e.boxShadows.popup,display:"flex",flexDirection:"row",gap:e.spacing(2),margin:"0 0.8rem",maxWidth:"450px",padding:e.spacing(1),paddingLeft:e.spacing(2),zIndex:e.zIndex.snackbar,color:e.palette.common.white},starting:{opacity:0},headerStyles:{fontSize:e.typography.body1.fontSize,fontWeight:"normal",margin:0,maxHeight:"75vh",overflowY:"auto","&::first-letter":{textTransform:"uppercase"}},anim:{animation:"$drop 10s 3s"},checkMark:{marginLeft:e.spacing(1)},buttonStyle:{color:e.palette.common.white,svg:{fontSize:"1em"}},"@keyframes drop":{"0%":{opacity:"0%",top:"0%"},"10%":{opacity:"100%"},"100%":{top:"100%"}}}));var NO={},QNt=je;Object.defineProperty(NO,"__esModule",{value:!0});var dle=NO.default=void 0,eFt=QNt(Ee()),tFt=i,nFt=(0,eFt.default)((0,tFt.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"Warning");dle=NO.default=nFt;const rFt=v(b0)(({theme:e})=>({color:e.mode==="light"?e.palette.secondary.border:e.palette.primary.main})),oFt=v(dle)(({theme:e})=>({color:e.mode==="light"?e.palette.warning.border:e.palette.warning.main})),sFt=({type:e})=>e==="error"?i.jsx(oFt,{titleAccess:"Error"}):i.jsx(rFt,{}),iFt=({text:e,type:t})=>{const{setToast:n}=g.useContext(Ef),{classes:r}=ZNt(),o=()=>{n(s=>({...s,show:!1}))};return i.jsxs("div",{className:Lu(r.container,"dropdown-outline"),children:[i.jsx(sFt,{type:t,className:r.checkMark}),i.jsx("h3",{className:r.headerStyles,children:i.jsx(Ep,{children:e})}),i.jsx(Rt,{title:"Close",arrow:!0,children:i.jsx(Mt,{onClick:o,className:r.buttonStyle,size:"small",children:i.jsx(bo,{})})})]})},aFt=()=>{const{toastData:e,setToast:t}=g.useContext(Ef),n=()=>{t(o=>({...o,show:!1}))};g.useEffect(()=>{if(!e.autoHideDuration)return;const o=setTimeout(()=>{n()},e.autoHideDuration);return()=>{clearTimeout(o)}},[e==null?void 0:e.show]);const r=g.useMemo(()=>({start:{...OX,right:0,left:0,margin:"0 auto",width:"fit-content"},enter:MX,leave:ebe}),[]);return i.jsx(Pk,{children:i.jsx(Uk,{mounted:!!(e!=null&&e.show),start:r.start,enter:r.enter,leave:r.leave,children:i.jsx(iFt,{...e})})})};var FO={},lFt=je;Object.defineProperty(FO,"__esModule",{value:!0});var ple=FO.default=void 0,cFt=lFt(Ee()),uFt=i,dFt=(0,cFt.default)((0,uFt.jsx)("path",{d:"M8 5v14l11-7z"}),"PlayArrow");ple=FO.default=dFt;const pFt="https://cdn.getunleash.io/impact-metrics.mp4",fFt="https://docs.getunleash.io/guides/getting-started-release-management",hFt=v(K)(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,display:"flex",flexDirection:"column",boxShadow:e.shadows[5],maxWidth:e.spacing(100),width:"100%",maxHeight:"90vh",overflow:"hidden",margin:e.spacing(2),position:"relative",zIndex:1})),gFt=v(K)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1,3),borderBottom:`1px solid ${e.palette.divider}`})),mFt=v(Mt)(({theme:e})=>({padding:e.spacing(.5)})),yFt=v(ey)(({theme:e})=>({height:e.spacing(6)})),xFt=v(Kg)(({theme:e})=>({height:e.spacing(6)})),vFt=v(K)(({theme:e})=>({padding:`${e.spacing(3)} ${e.spacing(3)} ${e.spacing(3.5)} ${e.spacing(3)}`,overflowY:"auto",flex:1})),bFt=v(J)(({theme:e})=>({fontSize:e.typography.h1.fontSize,fontWeight:e.typography.fontWeightBold,color:e.palette.text.primary,marginBottom:e.spacing(1)})),CFt=v(J)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(3)})),wFt=v(K)(({theme:e})=>({position:"relative",width:"100%",paddingBottom:"56.25%",marginBottom:e.spacing(4),borderRadius:e.shape.borderRadiusLarge,overflow:"hidden",backgroundColor:e.palette.background.elevation1})),SFt=v("video")({position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover"}),jFt=v("button")({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:"none",background:"transparent",padding:0,outline:"none","&:focus-visible > div":{outline:"2px solid white",outlineOffset:"2px"}}),EFt=v(K)(({theme:e})=>({width:e.spacing(10),height:e.spacing(10),borderRadius:"50%",backgroundColor:e.palette.primary.main,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:e.shadows[4],transition:"transform 0.2s ease, box-shadow 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:e.shadows[8]},"& svg":{fontSize:e.spacing(5),color:e.palette.common.white}})),kFt=v(K)(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(2)})),TFt=({onClose:e})=>{const{trackEvent:t}=zt(),n=g.useRef(null),[r,o]=g.useState(!1);g.useEffect(()=>{t("release-management-splash",{props:{eventType:"displayed"}})},[]);const s=()=>{t("release-management-splash",{props:{eventType:"getting-started-click"}}),window.open(fFt,"_blank","noopener,noreferrer"),e()},a=()=>{var l;t("release-management-splash",{props:{eventType:"play-video"}}),o(!0),(l=n.current)==null||l.play()};return i.jsxs(hFt,{children:[i.jsxs(gFt,{children:[i.jsx(Ra,{darkmode:i.jsx(xFt,{"aria-label":"Unleash"}),lightmode:i.jsx(yFt,{"aria-label":"Unleash"})}),i.jsx(Rt,{title:"Close",arrow:!0,children:i.jsx(mFt,{onClick:e,size:"small","aria-label":"close",children:i.jsx(bo,{})})})]}),i.jsxs(vFt,{children:[i.jsx(bFt,{variant:"h1",children:"Put your rollouts on autopilot"}),i.jsx(CFt,{children:"Define your milestones once and reuse everywhere. Add automations and watch them go from 5% canary to full release, while safeguards catch issues before your users do."}),i.jsxs(wFt,{children:[i.jsx(SFt,{ref:n,src:pFt,controls:r,preload:"metadata"}),!r&&i.jsx(jFt,{onClick:a,"aria-label":"Play video",type:"button",children:i.jsx(EFt,{children:i.jsx(ple,{})})})]}),i.jsxs(kFt,{children:[i.jsx($e,{variant:"contained",color:"primary",onClick:s,children:"View the getting started guide"}),i.jsx($e,{variant:"text",onClick:e,children:"Cancel"})]})]})]})},dU=250,RFt=v(F5)({backgroundColor:"rgba(0, 0, 0, 0.5)"}),AFt=v("div")({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",outline:"none"}),PFt=e=>Jre.includes(e),_Ft=()=>{const[e,t]=Mp(),{user:n}=gs(),{splash:r,refetchSplash:o}=__(),{setSplashSeen:s}=R_(),[a,l]=g.useState(!1),c=Jae("releaseManagementV3Splash"),u=e.get("splash"),d=u?PFt(u):!1;g.useEffect(()=>{if(!n||!r||u||n.isAPI||a)return;const m=!!r["release-management-v3"];c&&!m&&(e.set("splash","release-management-v3"),t(e,{replace:!0}))},[n,r,u,e,t,c,a]);const p=()=>{const m=u,y=d;l(!0),e.delete("splash"),t(e,{replace:!0}),m&&y&&s(m).then(()=>o()).catch(console.warn)};if(!u)return null;const h=(()=>{switch(u){case"release-management-v3":return i.jsx(TFt,{onClose:p});default:return null}})();return h?i.jsx(Hg,{open:!!u,onClose:p,closeAfterTransition:!0,slots:{backdrop:RFt},slotProps:{backdrop:{timeout:dU}},sx:{zIndex:m=>m.zIndex.modal},children:i.jsx(zg,{timeout:dU,in:!!u,children:i.jsx(AFt,{children:h})})}):null};var BO={},IFt=je;Object.defineProperty(BO,"__esModule",{value:!0});var fle=BO.default=void 0,OFt=IFt(Ee()),MFt=i,$Ft=(0,OFt.default)((0,MFt.jsx)("path",{d:"M12 7c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1s-1-.45-1-1V8c0-.55.45-1 1-1zm-.01-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm1-3h-2v-2h2v2z"}),"ErrorOutlineRounded");fle=BO.default=$Ft;const DFt=v(Ep)(({theme:e})=>({"h1, h2, h3":{margin:e.spacing(2,0)}})),LFt=({open:e,setOpen:t,title:n,children:r})=>{const o=()=>{t(!1)};return i.jsx(Mn,{title:n,open:e,secondaryButtonText:"Close",onClose:o,children:i.jsx(K,{onClick:s=>{s.target.nodeName==="A"&&o()},children:typeof r=="string"?i.jsx(DFt,{children:r}):r})})},w2="info",NFt=v("aside",{shouldForwardProp:e=>e!=="variant"&&e!=="inline"&&e!=="maxHeight"})(({theme:e,variant:t,inline:n,maxHeight:r})=>{var o,s,a;return{display:"flex",alignItems:"center",justifyContent:"center",padding:e.spacing(1),gap:e.spacing(1),width:"100%",...n?{border:"1px solid",borderRadius:e.shape.borderRadiusMedium}:{borderBottom:"1px solid"},...r&&{maxHeight:r,overflow:"auto"},borderColor:((o=e.palette[t])==null?void 0:o.border)??e.palette[w2].border,background:((s=e.palette[t])==null?void 0:s.light)??e.palette[w2].light,color:((a=e.palette[t])==null?void 0:a.dark)??e.palette[w2].dark,fontSize:e.fontSizes.smallBody}}),FFt=v("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:t})=>{var n;return{display:"flex",alignItems:"center",color:((n=e.palette[t])==null?void 0:n.main)??e.palette[w2].main}}),xf=({banner:e,inline:t,maxHeight:n})=>{const[r,o]=g.useState(!1),{message:s,variant:a=w2,sticky:l,icon:c,link:u,linkText:d="More info",linkClicked:p,plausibleEvent:f,dialogTitle:h,dialog:m}=e,y=()=>{o(!0),p==null||p()},b=i.jsxs(NFt,{variant:a,inline:t,maxHeight:n,children:[i.jsx(FFt,{variant:a,children:i.jsx(zFt,{icon:c,variant:a})}),i.jsx(Ep,{children:s}),i.jsx(HFt,{link:u,plausibleEvent:f,openDialog:y,children:d}),i.jsx(LFt,{open:r,setOpen:o,title:h||d,children:m})]});return l?i.jsx(MO,{children:b}):b},BFt={warning:i.jsx(py,{}),info:i.jsx(yi,{}),error:i.jsx(fle,{}),success:i.jsx(l3,{})},zFt=({icon:e,variant:t})=>e==="none"?null:e?i.jsx(Ta,{children:e}):BFt[t]??i.jsx(yi,{}),HFt=({link:e,plausibleEvent:t,openDialog:n,children:r})=>{const o=$t(),s=zt();if(!e)return null;const a=e==="dialog",l=e.startsWith("/"),c=()=>{t&&s.trackEvent("banner",{props:{event:t}})};return a?i.jsx(Sn,{onClick:()=>{c(),n()},children:r}):l?i.jsx(Sn,{onClick:()=>{c(),o(e)},children:r}):i.jsx(Sn,{href:e,target:"_blank",rel:"noreferrer",onClick:c,children:r})},SC="**Maintenance mode!** During maintenance mode, any changes made will not be saved and you may receive an error. We apologize for any inconvenience this may cause.",WFt=()=>{var n;const e=Er("maintenanceMode"),t=y6(e);return typeof e=="boolean"?SC:((n=e==null?void 0:e.payload)==null?void 0:n.type)===zie.STRING&&t||SC},VFt=()=>{const e=WFt();return i.jsx(xf,{banner:{message:e,variant:"error"}})},UFt="api/admin/banners",GFt=()=>{const{isEnterprise:e}=ut(),{data:t,error:n,mutate:r}=Ts(e(),{banners:[]},yt(UFt),qFt);return g.useMemo(()=>({banners:(t==null?void 0:t.banners)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},qFt=e=>fetch(e).then(en("Banners")).then(t=>t.json()),YFt=()=>{const{banners:e}=GFt();return i.jsx(i.Fragment,{children:e.filter(({enabled:t})=>t).map(t=>i.jsx(xf,{banner:t},t.id))})},KFt=()=>{const{uiConfig:e}=ut(),t=y6(e.flags.messageBanner),n=y6(e.flags.banner),r=t||n||[],o=Array.isArray(r)?r:[r];return i.jsx(i.Fragment,{children:o.map(s=>i.jsx(xf,{banner:s},s.message))})},XFt={isValid:!0,message:"",loading:!1},JFt=()=>{const{data:e,error:t,mutate:n}=f0(XFt,yt("api/admin/license/check"),hle);return{isValid:e==null?void 0:e.isValid,message:e==null?void 0:e.message,messageType:e==null?void 0:e.messageType,loading:!t&&!e,reCheckLicense:()=>n(),error:t}},lYt=()=>{const{data:e,error:t,mutate:n}=f0(void 0,yt("api/admin/license"),hle);return{license:e,loading:!t&&!e,refetchLicense:()=>n(),error:t}},hle=e=>fetch(e).then(en("License")).then(t=>t.json()),ZFt=()=>{const{isEnterprise:e}=ut(),t=JFt();if(e()&&t&&!t.loading&&!t.error)if(t.isValid){if(t.message){const n={message:t.message,variant:QFt(t.messageType),sticky:!0};return i.jsx(xf,{banner:n},n.message)}}else{const n={message:t.message||"You have an invalid Unleash license.",variant:"error",sticky:!0};return i.jsx(xf,{banner:n},n.message)}return null};function QFt(e){if(e)switch(e){case"warn":return"warning";default:return e}}const zO=e=>g.createElement("svg",{width:45,height:61,viewBox:"0 0 45 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{opacity:.789,d:"M29.701 38.852C25.591 37.941 24.679 37.007 23.764 32.915C23.664 32.469 23.764 32 23.306 32C22.848 32 22.937 32.469 22.848 32.915C21.937 37.044 21.022 37.94 16.911 38.852C16.465 38.952 16 38.852 16 39.31C16 39.768 16.465 39.679 16.911 39.768C21.021 40.679 21.936 41.613 22.848 45.705C22.948 46.151 22.848 46.62 23.306 46.62C23.764 46.62 23.675 46.151 23.764 45.705C24.679 41.595 25.609 40.68 29.701 39.768C30.147 39.668 30.616 39.768 30.616 39.31C30.616 38.852 30.148 38.952 29.701 38.852Z",fill:"white"}),g.createElement("path",{opacity:.4,d:"M10.686 52.1838C7.46503 51.4728 6.75403 50.7558 6.06003 47.5578C5.97903 47.2048 6.06003 46.8408 5.70103 46.8408C5.34203 46.8408 5.41803 47.2048 5.34203 47.5578C4.62503 50.7788 3.90803 51.4958 0.716026 52.1838C0.369026 52.2648 -0.000976562 52.1838 -0.000976562 52.5428C-0.000976562 52.9018 0.369026 52.8258 0.716026 52.9018C3.93703 53.6188 4.65403 54.3358 5.34203 57.5568C5.41703 57.9038 5.34203 58.2738 5.70103 58.2738C6.06003 58.2738 5.97903 57.9038 6.06003 57.5568C6.77703 54.3358 7.48803 53.6188 10.686 52.9018C11.039 52.8268 11.403 52.9018 11.403 52.5428C11.403 52.1838 11.039 52.2648 10.686 52.1838Z",fill:"white"}),g.createElement("path",{opacity:.739,d:"M34.19 12.595C31.434 11.981 30.825 11.37 30.209 8.612C30.142 8.312 30.209 8 29.902 8C29.595 8 29.662 8.313 29.595 8.612C28.983 11.37 28.37 11.977 25.614 12.595C25.314 12.66 25 12.595 25 12.902C25 13.209 25.315 13.142 25.614 13.202C28.37 13.816 28.979 14.427 29.595 17.185C29.662 17.485 29.595 17.797 29.902 17.797C30.209 17.797 30.142 17.484 30.209 17.185C30.821 14.427 31.434 13.82 34.19 13.202C34.49 13.137 34.804 13.202 34.804 12.902C34.804 12.602 34.49 12.66 34.19 12.595Z",fill:"white"}),g.createElement("path",{opacity:.7,d:"M38.666 55.832C36.366 55.32 35.859 54.81 35.345 52.51C35.289 52.261 35.345 52 35.089 52C34.833 52 34.889 52.261 34.833 52.51C34.323 54.81 33.811 55.317 31.512 55.832C31.263 55.886 31 55.832 31 56.088C31 56.344 31.263 56.288 31.512 56.342C33.812 56.854 34.319 57.364 34.833 59.664C34.889 59.913 34.833 60.174 35.089 60.174C35.345 60.174 35.289 59.913 35.345 59.664C35.855 57.364 36.367 56.857 38.666 56.342C38.917 56.287 39.178 56.342 39.178 56.088C39.178 55.834 38.917 55.886 38.666 55.832Z",fill:"white"}),g.createElement("path",{opacity:.855,d:"M19.336 2.668C17.736 2.312 17.382 1.95598 17.024 0.35498C16.985 0.18098 17.024 0 16.846 0C16.668 0 16.707 0.18198 16.668 0.35498C16.313 1.95498 15.956 2.309 14.356 2.668C14.182 2.706 14 2.66798 14 2.84598C14 3.02398 14.183 2.98498 14.356 3.02298C15.956 3.37898 16.31 3.735 16.668 5.336C16.707 5.51 16.668 5.69098 16.846 5.69098C17.024 5.69098 16.985 5.509 17.024 5.336C17.379 3.736 17.736 3.38198 19.336 3.02298C19.511 2.98498 19.692 3.02298 19.692 2.84598C19.692 2.66898 19.511 2.706 19.336 2.668Z",fill:"white"}),g.createElement("path",{opacity:.855,d:"M11.336 25.668C9.736 25.312 9.382 24.956 9.024 23.355C8.985 23.181 9.024 23 8.846 23C8.668 23 8.707 23.182 8.668 23.355C8.313 24.955 7.956 25.309 6.356 25.668C6.182 25.706 6 25.668 6 25.846C6 26.024 6.183 25.985 6.356 26.023C7.956 26.379 8.31 26.735 8.668 28.336C8.707 28.51 8.668 28.691 8.846 28.691C9.024 28.691 8.985 28.509 9.024 28.336C9.379 26.736 9.736 26.382 11.336 26.023C11.511 25.985 11.692 26.023 11.692 25.846C11.692 25.669 11.511 25.706 11.336 25.668Z",fill:"white"}),g.createElement("path",{opacity:.5,d:"M44.336 28.668C42.736 28.312 42.382 27.956 42.024 26.355C41.985 26.181 42.024 26 41.846 26C41.668 26 41.707 26.182 41.668 26.355C41.313 27.955 40.956 28.309 39.356 28.668C39.182 28.706 39 28.668 39 28.846C39 29.024 39.183 28.985 39.356 29.023C40.956 29.379 41.31 29.735 41.668 31.336C41.707 31.51 41.668 31.691 41.846 31.691C42.024 31.691 41.985 31.509 42.024 31.336C42.379 29.736 42.736 29.382 44.336 29.023C44.511 28.985 44.692 29.023 44.692 28.846C44.692 28.669 44.511 28.706 44.336 28.668Z",fill:"white"})),eBt=v(tu)(({theme:e})=>({position:"fixed",bottom:0,right:0,width:"100%",maxWidth:e.spacing(30),zIndex:e.zIndex.sticky,boxShadow:e.boxShadows.popup,"&&&":{borderRadius:0,borderTopLeftRadius:e.shape.borderRadiusLarge,borderTopRightRadius:e.shape.borderRadiusLarge},"&:before":{display:"none"},"& .expand-icon":{position:"absolute",right:e.spacing(2),fontSize:e.fontSizes.mainHeader,transition:"transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",transform:"rotate(180deg)"},"&.Mui-expanded .expand-icon":{transform:"rotate(0)"}})),tBt=v(ru)(({theme:e})=>({"& .MuiAccordionSummary-content":{flexDirection:"column",alignItems:"center"},backgroundColor:e.palette.web.main,color:e.palette.web.contrastText,borderTopLeftRadius:e.shape.borderRadiusLarge,borderTopRightRadius:e.shape.borderRadiusLarge,height:91})),nBt=v(zO)({position:"absolute",left:6,top:-24}),rBt=v(Da)(({theme:e})=>({color:e.palette.primary.contrastText})),oBt=v("div")({display:"flex",alignItems:"center"}),sBt=v(J)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,marginTop:e.spacing(.5),marginBottom:e.spacing(.5)})),iBt=v("div")(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:e.spacing(1.5)})),aBt=v(z5)(({theme:e})=>({width:"100%",height:e.spacing(1),borderRadius:e.shape.borderRadius,[`&.${XD.colorPrimary}`]:{backgroundColor:Wt(e.palette.web.contrastText,.1)},[`& .${XD.bar}`]:{borderRadius:e.shape.borderRadius,backgroundColor:e.palette.web.contrastText}})),lBt=v("li",{shouldForwardProp:e=>e!=="selected"&&e!=="completed"})(({theme:e,selected:t,completed:n})=>({padding:e.spacing(1),cursor:"pointer",display:"flex",alignItems:"center",marginTop:e.spacing(1),borderRadius:e.shape.borderRadius,gap:e.spacing(1),backgroundColor:e.palette.background.elevation2,...t&&{backgroundColor:e.palette.secondary.light,fontWeight:e.typography.fontWeightBold,outline:`1px solid ${e.palette.primary.main}`},...n&&{backgroundColor:e.palette.background.elevation1,textDecoration:"line-through"}})),cBt=v(b0)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.bodySize})),uBt=v(ZI)(({theme:e})=>({color:e.palette.neutral.main,fontSize:e.fontSizes.bodySize})),dBt=v(Da)(({theme:e})=>({transform:"rotate(-90deg)",fontSize:e.fontSizes.bodySize})),pBt=v($e)(({theme:e})=>({width:"100%",marginTop:e.spacing(2),"&&&":{fontSize:e.fontSizes.smallBody}})),fBt=({expanded:e,setExpanded:t,stepsCompletion:n,currentTopic:r,setCurrentTopic:o,topics:s,onWelcome:a})=>{const l=n.reduce((d,p)=>d+(p||0),0),c=s.flatMap(({steps:d})=>d).length,u=l/c*100;return i.jsxs(eBt,{expanded:e,onChange:()=>t(d=>!d),children:[i.jsxs(tBt,{children:[i.jsx(nBt,{}),i.jsxs(oBt,{children:[i.jsx(J,{fontWeight:"bold",children:"Unleash demo"}),i.jsx(rBt,{className:"expand-icon"})]}),i.jsx(sBt,{children:"Complete all steps to finish demo"}),i.jsxs(iBt,{children:[i.jsxs(J,{variant:"body2",children:[u.toFixed(),"%"]}),i.jsx(aBt,{variant:"determinate",value:u})]})]}),i.jsxs(nu,{children:[i.jsx(J,{variant:"body2",paddingTop:1,children:"The steps will guide you"}),s.map((d,p)=>{const f=r===p,h=n[p]===d.steps.length;return i.jsxs(lBt,{onClick:()=>o(p),selected:f,completed:h,children:[i.jsx(te,{condition:h,show:i.jsx(cBt,{}),elseShow:i.jsx(uBt,{})}),i.jsx(J,{variant:"body2",sx:{flex:1},children:d.title}),i.jsx(dBt,{})]},d.title)}),i.jsx(pBt,{variant:"outlined",onClick:a,children:"View demo page"})]})]})};function gle(e){return t=>typeof t===e}var hBt=gle("function"),gBt=e=>e===null,pU=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",fU=e=>!mBt(e)&&!gBt(e)&&(hBt(e)||typeof e=="object"),mBt=gle("undefined");function yBt(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!xi(e[r],t[r]))return!1;return!0}function xBt(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function vBt(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!xi(n[1],t.get(n[0])))return!1;return!0}function bBt(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function xi(e,t){if(e===t)return!0;if(e&&fU(e)&&t&&fU(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return yBt(e,t);if(e instanceof Map&&t instanceof Map)return vBt(e,t);if(e instanceof Set&&t instanceof Set)return bBt(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return xBt(e,t);if(pU(e)&&pU(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const s=n[o];if(!(s==="_owner"&&e.$$typeof)&&!xi(e[s],t[s]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var CBt=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],wBt=["bigint","boolean","null","number","string","symbol","undefined"];function w8(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(SBt(t))return t}function ac(e){return t=>w8(t)===e}function SBt(e){return CBt.includes(e)}function A0(e){return t=>typeof t===e}function jBt(e){return wBt.includes(e)}var EBt=["innerHTML","ownerDocument","style","attributes","nodeValue"];function Lt(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(Lt.array(e))return"Array";if(Lt.plainFunction(e))return"Function";const t=w8(e);return t||"Object"}Lt.array=Array.isArray;Lt.arrayOf=(e,t)=>!Lt.array(e)&&!Lt.function(t)?!1:e.every(n=>t(n));Lt.asyncGeneratorFunction=e=>w8(e)==="AsyncGeneratorFunction";Lt.asyncFunction=ac("AsyncFunction");Lt.bigint=A0("bigint");Lt.boolean=e=>e===!0||e===!1;Lt.date=ac("Date");Lt.defined=e=>!Lt.undefined(e);Lt.domElement=e=>Lt.object(e)&&!Lt.plainObject(e)&&e.nodeType===1&&Lt.string(e.nodeName)&&EBt.every(t=>t in e);Lt.empty=e=>Lt.string(e)&&e.length===0||Lt.array(e)&&e.length===0||Lt.object(e)&&!Lt.map(e)&&!Lt.set(e)&&Object.keys(e).length===0||Lt.set(e)&&e.size===0||Lt.map(e)&&e.size===0;Lt.error=ac("Error");Lt.function=A0("function");Lt.generator=e=>Lt.iterable(e)&&Lt.function(e.next)&&Lt.function(e.throw);Lt.generatorFunction=ac("GeneratorFunction");Lt.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;Lt.iterable=e=>!Lt.nullOrUndefined(e)&&Lt.function(e[Symbol.iterator]);Lt.map=ac("Map");Lt.nan=e=>Number.isNaN(e);Lt.null=e=>e===null;Lt.nullOrUndefined=e=>Lt.null(e)||Lt.undefined(e);Lt.number=e=>A0("number")(e)&&!Lt.nan(e);Lt.numericString=e=>Lt.string(e)&&e.length>0&&!Number.isNaN(Number(e));Lt.object=e=>!Lt.nullOrUndefined(e)&&(Lt.function(e)||typeof e=="object");Lt.oneOf=(e,t)=>Lt.array(e)?e.indexOf(t)>-1:!1;Lt.plainFunction=ac("Function");Lt.plainObject=e=>{if(w8(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};Lt.primitive=e=>Lt.null(e)||jBt(typeof e);Lt.promise=ac("Promise");Lt.propertyOf=(e,t,n)=>{if(!Lt.object(e)||!t)return!1;const r=e[t];return Lt.function(n)?n(r):Lt.defined(r)};Lt.regexp=ac("RegExp");Lt.set=ac("Set");Lt.string=A0("string");Lt.symbol=A0("symbol");Lt.undefined=A0("undefined");Lt.weakMap=ac("WeakMap");Lt.weakSet=ac("WeakSet");var Ht=Lt;function kBt(...e){return e.every(t=>Ht.string(t)||Ht.array(t)||Ht.plainObject(t))}function TBt(e,t,n){return mle(e,t)?[e,t].every(Ht.array)?!e.some(xU(n))&&t.some(xU(n)):[e,t].every(Ht.plainObject)?!Object.entries(e).some(yU(n))&&Object.entries(t).some(yU(n)):t===n:!1}function hU(e,t,n){const{actual:r,key:o,previous:s,type:a}=n,l=zc(e,o),c=zc(t,o);let u=[l,c].every(Ht.number)&&(a==="increased"?l<c:l>c);return Ht.undefined(r)||(u=u&&c===r),Ht.undefined(s)||(u=u&&l===s),u}function gU(e,t,n){const{key:r,type:o,value:s}=n,a=zc(e,r),l=zc(t,r),c=o==="added"?a:l,u=o==="added"?l:a;if(!Ht.nullOrUndefined(s)){if(Ht.defined(c)){if(Ht.array(c)||Ht.plainObject(c))return TBt(c,u,s)}else return xi(u,s);return!1}return[a,l].every(Ht.array)?!u.every(HO(c)):[a,l].every(Ht.plainObject)?RBt(Object.keys(c),Object.keys(u)):![a,l].every(d=>Ht.primitive(d)&&Ht.defined(d))&&(o==="added"?!Ht.defined(a)&&Ht.defined(l):Ht.defined(a)&&!Ht.defined(l))}function mU(e,t,{key:n}={}){let r=zc(e,n),o=zc(t,n);if(!mle(r,o))throw new TypeError("Inputs have different types");if(!kBt(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(Ht.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function yU(e){return([t,n])=>Ht.array(e)?xi(e,n)||e.some(r=>xi(r,n)||Ht.array(n)&&HO(n)(r)):Ht.plainObject(e)&&e[t]?!!e[t]&&xi(e[t],n):xi(e,n)}function RBt(e,t){return t.some(n=>!e.includes(n))}function xU(e){return t=>Ht.array(e)?e.some(n=>xi(n,t)||Ht.array(t)&&HO(t)(n)):xi(e,t)}function mm(e,t){return Ht.array(e)?e.some(n=>xi(n,t)):xi(e,t)}function HO(e){return t=>e.some(n=>xi(n,t))}function mle(...e){return e.every(Ht.array)||e.every(Ht.number)||e.every(Ht.plainObject)||e.every(Ht.string)}function zc(e,t){return Ht.plainObject(e)||Ht.array(e)?Ht.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):Ht.number(t)?e[t]:e:e}function C6(e,t){if([e,t].some(Ht.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(d=>Ht.plainObject(d)||Ht.array(d)))throw new Error("Expected plain objects or array");return{added:(d,p)=>{try{return gU(e,t,{key:d,type:"added",value:p})}catch{return!1}},changed:(d,p,f)=>{try{const h=zc(e,d),m=zc(t,d),y=Ht.defined(p),b=Ht.defined(f);if(y||b){const x=b?mm(f,h):!mm(p,h),C=mm(p,m);return x&&C}return[h,m].every(Ht.array)||[h,m].every(Ht.plainObject)?!xi(h,m):h!==m}catch{return!1}},changedFrom:(d,p,f)=>{if(!Ht.defined(d))return!1;try{const h=zc(e,d),m=zc(t,d),y=Ht.defined(f);return mm(p,h)&&(y?mm(f,m):!y)}catch{return!1}},decreased:(d,p,f)=>{if(!Ht.defined(d))return!1;try{return hU(e,t,{key:d,actual:p,previous:f,type:"decreased"})}catch{return!1}},emptied:d=>{try{const[p,f]=mU(e,t,{key:d});return!!p.length&&!f.length}catch{return!1}},filled:d=>{try{const[p,f]=mU(e,t,{key:d});return!p.length&&!!f.length}catch{return!1}},increased:(d,p,f)=>{if(!Ht.defined(d))return!1;try{return hU(e,t,{key:d,actual:p,previous:f,type:"increased"})}catch{return!1}},removed:(d,p)=>{try{return gU(e,t,{key:d,type:"removed",value:p})}catch{return!1}}}}var ABt=new Error("Element already at target scroll position"),PBt=new Error("Scroll cancelled"),_Bt=Math.min,vU=Date.now,IBt={left:bU("scrollLeft"),top:bU("scrollTop")};function bU(e){return function(n,r,o,s){o=o||{},typeof o=="function"&&(s=o,o={}),typeof s!="function"&&(s=MBt);var a=vU(),l=n[e],c=o.ease||OBt,u=isNaN(o.duration)?350:+o.duration,d=!1;return l===r?s(ABt,n[e]):requestAnimationFrame(f),p;function p(){d=!0}function f(h){if(d)return s(PBt,n[e]);var m=vU(),y=_Bt(1,(m-a)/u),b=c(y);n[e]=b*(r-l)+l,y<1?requestAnimationFrame(f):requestAnimationFrame(function(){s(null,n[e])})}}}function OBt(e){return .5*(1-Math.cos(Math.PI*e))}function MBt(){}const $Bt=ls(IBt);var yle={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(_n,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(yle);var DBt=yle.exports;const xle=ls(DBt);var LBt=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},NBt=function(e,t){return e+k3(t)},k3=function(e){return e===null||typeof e=="boolean"||typeof e>"u"?"":typeof e=="number"?e.toString():typeof e=="string"?e:Array.isArray(e)?e.reduce(NBt,""):LBt(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?k3(e.props.children):""};k3.default=k3;var FBt=k3;const CU=ls(FBt);var BBt=function(t){return zBt(t)&&!HBt(t)};function zBt(e){return!!e&&typeof e=="object"}function HBt(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||UBt(e)}var WBt=typeof Symbol=="function"&&Symbol.for,VBt=WBt?Symbol.for("react.element"):60103;function UBt(e){return e.$$typeof===VBt}function GBt(e){return Array.isArray(e)?[]:{}}function T3(e,t){return t.clone!==!1&&t.isMergeableObject(e)?jg(GBt(e),e,t):e}function qBt(e,t,n){return e.concat(t).map(function(r){return T3(r,n)})}function YBt(e,t){if(!t.customMerge)return jg;var n=t.customMerge(e);return typeof n=="function"?n:jg}function KBt(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function wU(e){return Object.keys(e).concat(KBt(e))}function vle(e,t){try{return t in e}catch{return!1}}function XBt(e,t){return vle(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function JBt(e,t,n){var r={};return n.isMergeableObject(e)&&wU(e).forEach(function(o){r[o]=T3(e[o],n)}),wU(t).forEach(function(o){XBt(e,o)||(vle(e,o)&&n.isMergeableObject(t[o])?r[o]=YBt(o,n)(e[o],t[o],n):r[o]=T3(t[o],n))}),r}function jg(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||qBt,n.isMergeableObject=n.isMergeableObject||BBt,n.cloneUnlessOtherwiseSpecified=T3;var r=Array.isArray(t),o=Array.isArray(e),s=r===o;return s?r?n.arrayMerge(e,t,n):JBt(e,t,n):T3(t,n)}jg.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return jg(r,o,n)},{})};var ZBt=jg,QBt=ZBt;const nl=ls(QBt);/**!
514
514
  * @fileOverview Kickass library to create and place poppers near their reference elements.
515
515
  * @version 1.16.1
516
516
  * @license