unleash-server 7.2.0 → 7.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/lib/db/feature-environment-store.d.ts.map +1 -1
  2. package/dist/lib/db/feature-environment-store.js +7 -0
  3. package/dist/lib/db/feature-environment-store.js.map +1 -1
  4. package/dist/lib/db/feature-environment-store.test.d.ts +2 -0
  5. package/dist/lib/db/feature-environment-store.test.d.ts.map +1 -0
  6. package/dist/lib/db/feature-environment-store.test.js +24 -0
  7. package/dist/lib/db/feature-environment-store.test.js.map +1 -0
  8. package/frontend/build/index.html +1 -1
  9. package/frontend/build/static/{AdvancedPlayground-CUkOz1YF.js → AdvancedPlayground-D2Y0O_LK.js} +1 -1
  10. package/frontend/build/static/{BackendConnections-Bi1Fsohi.js → BackendConnections-C9HcQ9To.js} +1 -1
  11. package/frontend/build/static/{ChartItem-Ci-KFL7s.js → ChartItem-COMyVdgD.js} +1 -1
  12. package/frontend/build/static/{CreateProject-COHPsP3X.js → CreateProject-jRfRrbUO.js} +1 -1
  13. package/frontend/build/static/{FeatureMetricsChart-ClbKeGOa.js → FeatureMetricsChart-CQkGp91T.js} +1 -1
  14. package/frontend/build/static/{FeatureStaleDialog-DZvKjxPB.js → FeatureStaleDialog-DKeGFuL1.js} +1 -1
  15. package/frontend/build/static/{FeatureViewLazyExport-yCIrczZt.js → FeatureViewLazyExport-CgntSCvS.js} +2 -2
  16. package/frontend/build/static/{FlagMetricsChart-D0GI-ltv.js → FlagMetricsChart-oDTQTkxU.js} +1 -1
  17. package/frontend/build/static/{FrontendNetworkTrafficUsage-DlRkx8CV.js → FrontendNetworkTrafficUsage-E4pIeMFQ.js} +1 -1
  18. package/frontend/build/static/{ImpactMetricsPage-BYcbHNWC.js → ImpactMetricsPage-B3STis_H.js} +1 -1
  19. package/frontend/build/static/{LazyAdminExport-BjSYZTvt.js → LazyAdminExport-CsCsRIwk.js} +2 -2
  20. package/frontend/build/static/{LazyProjectExport-9mNkV9Jq.js → LazyProjectExport-DkN0UegC.js} +2 -2
  21. package/frontend/build/static/{LifecycleChartComponent-BigwXcU3.js → LifecycleChartComponent-Dz1wdYkW.js} +1 -1
  22. package/frontend/build/static/{LineChartComponent-CPcDsiNa.js → LineChartComponent-DG1LdcL_.js} +1 -1
  23. package/frontend/build/static/{MarkCompletedDialogue-CS-kM4vW.js → MarkCompletedDialogue-Bw9Iccid.js} +1 -1
  24. package/frontend/build/static/{NetworkConnectedEdges-C2nfTRKM.js → NetworkConnectedEdges-HU923-QZ.js} +1 -1
  25. package/frontend/build/static/{NetworkOverview-BKozpi8w.js → NetworkOverview-_igGCPCJ.js} +1 -1
  26. package/frontend/build/static/{NetworkPrometheusAPIWarning-wqCXwcem.js → NetworkPrometheusAPIWarning-BS9PGbzI.js} +1 -1
  27. package/frontend/build/static/{NetworkTraffic-Co7oakIE.js → NetworkTraffic-BpNEMFBl.js} +1 -1
  28. package/frontend/build/static/{NetworkTrafficUsage-DNDJZGXi.js → NetworkTrafficUsage-bSUVPjoc.js} +1 -1
  29. package/frontend/build/static/{ReactJSONEditor-BDMT4-_1.js → ReactJSONEditor-DZ9l5V9S.js} +1 -1
  30. package/frontend/build/static/{RoleCell-COtuTPWk.js → RoleCell-C-hJFmul.js} +1 -1
  31. package/frontend/build/static/{aggregateFeatureMetrics-ClblY5Ev.js → aggregateFeatureMetrics-Dli6i5No.js} +1 -1
  32. package/frontend/build/static/{formatTickValue-DojfJagm.js → formatTickValue-D3KZyzeb.js} +1 -1
  33. package/frontend/build/static/{index-CqYZiU1N.js → index-A5We7bvX.js} +9 -9
  34. package/frontend/build/static/{networkTrafficUsageHighlightPlugin-BMMmh5e_.js → networkTrafficUsageHighlightPlugin-DLE_BBMN.js} +1 -1
  35. package/frontend/build/static/{useApiTokens-B6vbGXUF.js → useApiTokens-DNIDLJlc.js} +1 -1
  36. package/package.json +1 -1
@@ -296,7 +296,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
296
296
  `)).filter(v=>!v.includes('"')&&!v.includes("'")).map(SAe).sort((v,b)=>v.localeCompare(b));return{name:f.filterName,header:f.Header??f.filterName,options:g,suggestedOption:g[0]??`example-${f.filterName}`,values:eX(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?D2(a[0],o.data[0]):"example-search-text",u=i.length===0?"":i.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 s.jsxs(oX,{className:"dropdown-outline",children:[s.jsx(X,{condition:!!n,show:s.jsxs(s.Fragment,{children:[s.jsx(nX,{onSuggestion:t,savedQuery:n}),s.jsx(rD,{})]})}),s.jsxs(bAe,{children:[s.jsx(wAe,{}),s.jsx(J,{children:s.jsx(X,{condition:!!o.searchValue,show:s.jsx(hAe,{filters:i,getSearchContext:e,searchableColumnsString:l}),elseShow:s.jsx(vAe,{filters:i,searchableColumnsString:l,onClick:d})})})]}),s.jsx(rD,{}),s.jsxs(J,{sx:{lineHeight:1.75},children:[s.jsx(X,{condition:i.length>0,show:"Combine filters and search: "}),s.jsxs(F2,{tabIndex:0,onClick:p,onKeyDown:L2(p),children:[s.jsx("span",{children:u},u)," ",s.jsx("span",{children:c})]})]})]})},jAe=()=>{const[e,t]=m.useState();return m.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},Zp=({key:e,modifiers:t=[],preventDefault:n=!1},r)=>{const o=jAe();m.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 i=m.useMemo(()=>t.map(l=>({ctrl:o?"⌘":"Ctrl",alt:"Alt",shift:"Shift"})[l]),[o,t]);return m.useMemo(()=>[...i,`${e[0].toUpperCase()}${e.slice(1)}`].join("+"),[i,e])},rX=(e,t)=>{m.useEffect(()=>{const n=r=>{e.some(o=>{var i;return(i=o.current)==null?void 0:i.contains(r.target)})||t()};return document.addEventListener("click",n),()=>{document.removeEventListener("click",n)}},[e,t])},EAe=e=>{const{value:t,setValue:n}=Au(`Search:${e||"default"}:v1`,{query:""}),[r,o]=m.useState(t.query);return m.useEffect(()=>{e&&r.trim().length>0&&n({query:r})},[e,r]),{savedQuery:r,setSavedQuery:i=>{i.trim().length>0&&o(i)}}},TAe=(e,t)=>{m.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 i=e.current;return i&&i.addEventListener("blur",o,!0),()=>{document.removeEventListener("mousedown",r),i&&i.removeEventListener("blur",o,!0)}},[e,t])},oX=x(Lr)(({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"})),kAe=x("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%"}})),_Ae=x("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}})),RAe=x(B0)(({theme:e})=>({width:"100%",backgroundColor:e.palette.background.elevation1})),PAe=x(Ho)(({theme:e})=>({color:e.palette.neutral.main,fontSize:e.typography.body1.fontSize})),xo=({initialValue:e="",id:t,onChange:n,onFocus:r,onBlur:o,className:i,placeholder:a,hasFilters:l,disabled:c,getSearchContext:u,containerStyles:d,expandable:p=!1,debounceTime:f=200,...h})=>{const{trackEvent:g}=Kt(),v=m.useRef(null),b=m.useRef(null),[y,w]=m.useState(!1),[S,j]=m.useState(!1),E=()=>{w(!1),o==null||o()},{savedQuery:C,setSavedQuery:T}=EAe(t),[k,_]=m.useState(e),A=Zt.useAsyncDebounce(n,f),O=$=>{A($),_($),T($)},M=Zp({modifiers:["ctrl","shift"],key:"K",preventDefault:!0},()=>{var $,D;j(!0),document.activeElement===v.current?($=v.current)==null||$.blur():(D=v.current)==null||D.focus()});m.useEffect(()=>{y&&(S?g("search-opened",{props:{eventType:"hotkey"}}):g("search-opened",{props:{eventType:"manual"}}),j(!1))},[y]),Zp({key:"Escape"},()=>{var $,D;($=b.current)!=null&&$.contains(document.activeElement)&&((D=v.current)==null||D.blur())});const H=`${a??"Search"} (${M})`;rX([b],E),TAe(b,E),m.useEffect(()=>{_(e)},[e]);const P=y&&t;return s.jsxs(kAe,{ref:b,style:d,active:p&&y,...h,children:[s.jsxs(_Ae,{className:i,children:[s.jsx(Zf,{sx:{mr:1,color:$=>$.palette.action.disabled}}),s.jsx(RAe,{inputRef:v,placeholder:H,inputProps:{"aria-label":H,"data-testid":nY},value:k,onChange:$=>O($.target.value),onFocus:()=>{w(!0),r==null||r()},disabled:c}),s.jsx(J,{sx:{width:$=>$.spacing(4)},children:s.jsx(X,{condition:!!k,show:s.jsx(kt,{title:"Clear search query",arrow:!0,children:s.jsx($t,{size:"small",onClick:$=>{var D;$.stopPropagation(),O(""),(D=v.current)==null||D.focus()},sx:{padding:$=>$.spacing(1)},children:s.jsx(PAe,{})})})})})]}),s.jsx(X,{condition:!!(l&&u)&&y,show:s.jsx(CAe,{onSuggestion:$=>{var D;O($),(D=v.current)==null||D.focus()},savedQuery:C,getSearchContext:u}),elseShow:P&&s.jsx(oX,{className:"dropdown-outline",children:s.jsx(nX,{onSuggestion:O,savedQuery:C})})})]})},Nt=()=>{const{setToast:e}=m.useContext(Jf),t=()=>e(o=>({...o,show:!1})),n=m.useCallback((o,i)=>{e({text:o||"Something went wrong.",type:"error",show:!0,autoHideDuration:12e3,...i})},[e]);return{setToastData:m.useCallback(o=>{o.persist?e({...o,show:!0}):e({autoHideDuration:6e3,...o,show:!0})},[e]),setToastApiError:n,hideToast:t}},Tt=e=>e instanceof Error?e.message||e.toString():typeof e=="string"?e:"Unknown error",cT="Access denied",oC=(e,t)=>e?t:t?`${t} (${cT})`:cT,AAe=e=>(console.log(`[DEVELOPMENT LOG] Starting timing for request: ${e}`),Date.now()),IAe=(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},ar=({handleBadRequest:e,handleNotFound:t,handleForbidden:n,handleUnauthorized:r,handleUnavailable:o,propagateErrors:i=!1})=>{const[a,l]=m.useState({}),[c,u]=m.useState(!1),d=m.useCallback(async(w,S)=>{var j;if(w.status===_P){if(e)return e(l,w,S);if(l(E=>({...E,badRequest:"Bad request format"})),i){const E=await w.json();throw new AP(w.status,E)}}if(w.status===kY){if(t)return t(l,w,S);if(l(E=>({...E,notFound:"Could not find the requested resource"})),i)throw new IP(w.status)}if(w.status===RY){if(r)return r(l,w,S);if(l(E=>({...E,unauthorized:cT})),i)throw new PP(w.status)}if(w.status===_Y){if(n)return n(l,w,S);if(l(E=>({...E,forbidden:"This operation is forbidden"})),i){const E=await w.json();throw new LEe(w.status,E)}}if(w.status===PY){if(o)return o(l,w,S);if(l(E=>({...E,unavailable:"This operation is unavailable"})),i){const E=await w.json();throw new FEe(w.status,E)}}if(w.status>399){const E=await w.json();if(((j=E==null?void 0:E.details)==null?void 0:j.length)>0&&i){const C=E.details[0];if(l(T=>({...T,unknown:C})),i)throw new Error(C.message||C.msg);return C}if((E==null?void 0:E.length)>0&&i){const C=E[0];throw new Error(C.message||C.msg)}if(i)throw new Error("Action could not be performed")}},[e,n,t,r,i]),p=w=>async(S,j,E=!0)=>{const C=AAe(j||`Unknown request happening on ${S}`),T=await w(S,j,E);return IAe(C,j||`Unknown request happening on ${S}`),T},f=m.useCallback(async(w,S,j=!0)=>{j&&u(!0);try{const E=await w();return u(!1),E.status>299&&await d(E,S),E.status===K0&&l({}),E}catch(E){throw u(!1),E}},[d]),h=m.useCallback(async(w,S,j=!0)=>{try{const E=await w();if(!E.ok)throw new Error;return E}catch{throw new Error("Could not make request | makeLightRequest")}},[]),g=m.useCallback((w,S,j="")=>{const E={headers:J4,credentials:"include"};return{caller:()=>fetch(bt(w),{...E,...S}),id:j}},[]),v=p(f),b=p(h),y=!1;return{loading:c,makeRequest:y?v:f,makeLightRequest:y?b:h,createRequest:g,errors:a}},$Ae=()=>{const{makeLightRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),{setToastData:o,setToastApiError:i}=Nt(),{trackEvent:a}=Kt(),l=m.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){i(Tt(h))}},[t,e]),c=m.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){i(Tt(h))}},[t,e]);return{favorite:l,unfavorite:c,errors:n,loading:r}};var gA={},OAe=Te;Object.defineProperty(gA,"__esModule",{value:!0});var iC=gA.default=void 0,MAe=OAe(ke()),DAe=s,LAe=(0,MAe.default)((0,DAe.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");iC=gA.default=LAe;var mA={},FAe=Te;Object.defineProperty(mA,"__esModule",{value:!0});var sC=mA.default=void 0,NAe=FAe(ke()),BAe=s,zAe=(0,NAe.default)((0,BAe.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");sC=mA.default=zAe;const HAe=x(J)(({theme:e})=>({paddingLeft:e.spacing(2),paddingRight:e.spacing(.5)})),iX=x($t)(({theme:e})=>({color:e.palette.primary.main,paddingRight:e.spacing(.5)})),WAe=x(iX)({opacity:0,"&:hover":{opacity:1},"&:focus":{opacity:1},"&:active":{opacity:1}}),sX=({value:e,onClick:t})=>s.jsx(HAe,{children:s.jsx(X,{condition:!!e,show:s.jsx(iX,{onClick:t,size:"small",children:s.jsx(iC,{fontSize:"small"})}),elseShow:s.jsx(WAe,{className:"show-row-hover",onClick:t,size:"small",children:s.jsx(sC,{fontSize:"small"})})})}),Qa=({title:e,children:t,variant:n="default",titleComponent:r,...o})=>!e&&!r?t:n==="custom"?s.jsx(hr,{...o,title:e||r,arrow:!0,children:t}):s.jsx(kt,{...o,title:e||r,arrow:!0,children:t}),VAe=({isActive:e=!1,onClick:t})=>{const[n,r]=m.useState(e),o=()=>{r(!n),t(!n)};return s.jsx(Qa,{title:n?"Unpin favorite features from the top":"Pin favorite features to the top",children:s.jsx($t,{sx:{mx:-.75,my:-1,display:"flex",alignItems:"center",justifyContent:"center",padding:1.25},onClick:o,size:"small",children:s.jsx(X,{condition:n,show:s.jsx(iC,{fontSize:"small"}),elseShow:s.jsx(sC,{fontSize:"small"})})})})},$u=()=>{const{data:e,error:t,mutate:n}=_n(bt("api/admin/environments"),UAe),r=m.useMemo(()=>e||[],[e]),o=m.useCallback(async()=>{await n()},[n]),i=m.useCallback(async a=>{await n(a,!1)},[n]);return{environments:r,refetchEnvironments:o,mutateEnvironments:i,loading:!t&&!e,error:t}},UAe=async e=>(await fetch(e).then(Jt("Environments")).then(n=>n.json())).environments.sort((n,r)=>n.sortOrder-r.sortOrder),GAe=x(nm)(({theme:e,maxWidth:t})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:t?void 0:e.spacing(85),backgroundColor:"transparent"}})),qAe=x(X0e)(({theme:e})=>({backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,padding:e.spacing(3.5,6),fontWeight:e.fontWeight.medium})),YAe=x("div")(({theme:e})=>({padding:e.spacing(6),backgroundColor:e.palette.background.paper})),KAe=x(G0e)(({theme:e})=>({padding:0,marginBottom:e.spacing(6)})),XAe=x(N0e)(({theme:e})=>({gap:e.spacing(2),padding:0})),Gn=({children:e,open:t,setOpen:n,onClick:r,onClose:o,title:i,primaryButtonText:a,disabledPrimaryButton:l=!1,secondaryButtonText:c,maxWidth:u,fullWidth:d=!1,formId:p,permissionButton:f,customButton:h})=>{const g=p?b=>{b.preventDefault(),r&&r(b)}:r,v=b=>{b.key==="Escape"&&(n==null||n(!1))};return s.jsxs(GAe,{open:t,onClose:o,onKeyDown:v,role:"dialog",fullWidth:d,"aria-labelledby":"simple-modal-title","aria-describedby":"simple-modal-description",maxWidth:u,children:[s.jsx(qAe,{children:i}),s.jsxs(YAe,{children:[s.jsx(X,{condition:!!e,show:s.jsx(KAe,{children:e})}),s.jsxs(XAe,{children:[s.jsx(X,{condition:!!f,show:f,elseShow:s.jsx(X,{condition:!!r,show:s.jsx(Ue,{form:p,color:"primary",variant:"contained",onClick:g,autoFocus:!p,disabled:l,"data-testid":Sje,type:p?"submit":"button",children:a||"Yes, I'm sure"})})}),s.jsx(X,{condition:!!o,show:s.jsx(Ue,{onClick:o,children:c||"No, take me back"})}),s.jsx(X,{condition:!!h,show:h})]})]})]})};var vA={},JAe=Te;Object.defineProperty(vA,"__esModule",{value:!0});var am=vA.default=void 0,QAe=JAe(ke()),ZAe=s,e9e=(0,QAe.default)((0,ZAe.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined");am=vA.default=e9e;const t9e=x(Is)({maxWidth:"100%"});function th({variant:e="outlined",name:t,value:n,label:r="",options:o,onChange:i,id:a,disabled:l=!1,className:c,classes:u,fullWidth:d,visuallyHideLabel:p,labelId:f,...h}){const g=v=>{v.preventDefault(),i(String(v.target.value))};return s.jsxs(t9e,{variant:e,size:"small",classes:u,fullWidth:d,children:[r?s.jsx(Su,{sx:p?yG:null,htmlFor:a,id:f,children:r}):null,s.jsx($c,{name:t,disabled:l,onChange:g,className:c,label:p?"":r,id:a,value:n??"",MenuProps:{sx:{".MuiPopover-paper.MuiMenu-paper":{width:"min-content"}}},IconComponent:am,labelId:f,...h,children:o.map(v=>s.jsx(Cr,{sx:v.sx,value:v.key,title:v.title||"","data-testid":`${$R}-${v.label}`,disabled:v.disabled,children:v.label},v.key))})]})}const n9e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),{trackEvent:o}=Kt();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}}},r9e=x(th)(({theme:e})=>({minWidth:"250px",marginTop:e.spacing(2)})),o9e=({showExportDialog:e,data:t,project:n,onClose:r,onConfirm:o,environments:i})=>{const[a,l]=m.useState(i[0]),{createExport:c}=n9e(),u=m.createRef(),{setToastApiError:d}=Nt(),p=()=>i.map(g=>({key:g,label:g})),f=g=>{var S,j;const v=document.createElement("a");(S=u.current)==null||S.appendChild(v),v.style.display="display: none";const b=new Blob([JSON.stringify(g)],{type:"application/json"}),y=window.URL.createObjectURL(b);v.href=y;const w=new Date;v.download=`${w.toISOString()}-export.json`,v.click(),window.URL.revokeObjectURL(y),(j=u.current)==null||j.removeChild(v)},h=async()=>{try{const g={features:t.map(y=>y.name),environment:a,project:n},b=await(await c(g)).json();f(b),r(),o==null||o()}catch(g){d(Tt(g))}};return s.jsx(Gn,{open:e,title:"Export feature flag configuration",onClose:r,onClick:h,primaryButtonText:"Export selection",secondaryButtonText:"Cancel",children:s.jsxs(J,{ref:u,children:[s.jsx(X,{condition:t.length>0,show:s.jsxs("span",{children:["The current search filter will be used to export feature flags. Currently ",t.length," feature flags will be exported."]}),elseShow:s.jsx("span",{children:"You will export all feature flags from this project."})}),s.jsx("br",{}),s.jsx("br",{}),s.jsx(Z,{children:"Select which environment to export feature flag configuration from:"}),s.jsx(r9e,{options:p(),value:a,onChange:g=>l(g)})]})})},i9e=e=>nK(new Date(e),{addSuffix:!0}).replace("about ","").replace("less than a minute ago","< 1 minute ago"),Pl=({date:e,fallback:t="",refresh:n=!0,timeElement:r=!0})=>{const o=()=>{try{return e?{description:i9e(e),dateTime:r?new Date(e):void 0}:{description:t}}catch{return{description:t}}},[i,a]=m.useState(o);return m.useEffect(()=>{a(o)},[e,t]),m.useEffect(()=>{if(!e||!n)return;const l=setInterval(()=>{a(o)},p_e(12));return()=>clearInterval(l)},[n]),i.dateTime?s.jsx("time",{dateTime:i.dateTime.toISOString(),children:i.description}):i.description},aC=()=>{const e=qt(),t={background:e.palette.seen.unknown,text:e.palette.grey.A400};return n=>{if(!n)return t;try{const r=V0(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}},s9e=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1),width:"20%",justifyContent:"flex-end"})),a9e=x(YG)(({theme:e})=>({color:e.palette.divider})),l9e=x(YG)(({theme:e})=>({color:e.palette.primary.main,position:"absolute",left:0})),c9e=({yes:e,no:t})=>{if(e===void 0||t===void 0||e+t===0)return s.jsx(J,{});const r=Math.round(e/(e+t)*100);return s.jsxs(s9e,{children:[s.jsxs(J,{sx:{position:"relative"},children:[s.jsx(a9e,{variant:"determinate",size:18,thickness:11,value:100}),s.jsx(l9e,{variant:"determinate",size:18,thickness:11,value:r})]}),s.jsxs(J,{children:[r,"%"]})]})},u9e=x("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})),d9e=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap"})),p9e=x("p")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.fontSizes.smallBody,marginBottom:e.spacing(1)})),f9e=x("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"})),h9e=x("div")(({theme:e})=>({width:"40%",justifyContent:"center",padding:e.spacing(0,1,0,1)})),g9e=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),m9e=x("div",{shouldForwardProp:e=>e!=="color"})(({color:e})=>({textAlign:"left",width:"100%",color:e})),v9e=x("div")(({theme:e})=>({maxHeight:e.spacing(24.5),overflowY:"auto",paddingRight:e.spacing(2)})),y9e=({environments:e,featureLastSeen:t,...n})=>{const r=aC(),o=e==null?void 0:e.some(i=>!!i.lastSeenAt);return s.jsxs(u9e,{...n,"data-loading":!0,children:[s.jsx(p9e,{children:"Last usage reported"}),s.jsx(X,{condition:!!e&&!!o,show:s.jsx(v9e,{children:e==null?void 0:e.map(({name:i,lastSeenAt:a,yes:l,no:c})=>s.jsxs(d9e,{children:[s.jsx(f9e,{children:i}),s.jsx(h9e,{children:s.jsx(m9e,{color:r(a).text,children:s.jsx(Pl,{date:a,refresh:!1,fallback:"no usage"})})}),s.jsx(c9e,{yes:l,no:c})]},i))}),elseShow:s.jsxs(Z,{fontWeight:"bold",color:r(t).text,children:["Reported ",s.jsx(Pl,{date:t})]})}),s.jsx(g9e,{children:"Usage is reported from connected applications through metrics"})]})},aX=e=>m.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"current",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{d:"M7 10H13",stroke:"#6E6E70",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"})),yA=e=>m.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{d:"M15 10H12.8571L11.4286 14L8.57143 6L7.14286 10H5",stroke:"current",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"})),x9e=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}},b9e=x("div")(({theme:e})=>({display:"flex",padding:e.spacing(1)})),w9e=x(J)(({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"})),xA=x("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"})),S9e=x(Qa)(({theme:e})=>({maxWidth:e.spacing(47.5)})),oD=({sx:e,tooltip:t,color:n,children:r})=>s.jsx(b9e,{sx:e,children:s.jsx(S9e,{variant:"custom",titleComponent:t,arrow:!0,describeChild:!0,children:s.jsx(w9e,{sx:{"&:hover":{background:n}},children:s.jsx(xA,{style:{background:n},children:r})})})}),C9e=x(J)({display:"grid",placeItems:"center"}),j9e=({featureLastSeen:e,environments:t,sx:n,...r})=>{const o=aC(),i=x9e(t)||e;if(!i)return s.jsx(oD,{sx:n,tooltip:"No usage reported from connected applications",children:s.jsx(J,{"data-loading":!0,children:s.jsx(C9e,{children:s.jsx(aX,{})})})});const{background:a,text:l}=o(i);return s.jsx(oD,{sx:n,tooltip:s.jsx(y9e,{featureLastSeen:i,environments:t,...r}),color:a,children:s.jsx(yA,{stroke:l})})},E9e=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},m.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"}),m.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"})),T9e=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},m.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"}),m.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"}),m.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"})),k9e=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},m.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"}),m.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"}),m.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"}),m.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"})),_9e=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},m.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"}),m.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"}),m.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"}),m.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"}),m.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"})),R9e=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:40,height:20,fill:"none",...e},m.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"}),m.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"}),m.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"}),m.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"}),m.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"}),m.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"})),bA=({stage:e,...t})=>e.name==="archived"?s.jsx(R9e,{...t}):e.name==="pre-live"?s.jsx(T9e,{...t}):e.name==="live"?s.jsx(k9e,{...t}):e.name==="completed"?s.jsx(_9e,{...t}):s.jsx(E9e,{...t});var wA={},P9e=Te;Object.defineProperty(wA,"__esModule",{value:!0});var lm=wA.default=void 0,A9e=P9e(ke()),I9e=s,$9e=(0,A9e.default)((0,I9e.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");lm=wA.default=$9e;var SA={},O9e=Te;Object.defineProperty(SA,"__esModule",{value:!0});var lX=SA.default=void 0,M9e=O9e(ke()),D9e=s,L9e=(0,M9e.default)((0,D9e.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");lX=SA.default=L9e;const F9e=()=>{throw new Error("hasAccess called outside AccessContext")},$o=Je.createContext({isAdmin:!1,hasAccess:F9e}),ts="ADMIN",N2="CREATE_FEATURE",cm="UPDATE_FEATURE",rLt="UPDATE_FEATURE_DEPENDENCY",cX="DELETE_FEATURE",B2="CREATE_STRATEGY",n0="UPDATE_STRATEGY",N9e="DELETE_STRATEGY",iD="UPDATE_APPLICATION",z2="CREATE_CONTEXT_FIELD",uX="UPDATE_CONTEXT_FIELD",B9e="DELETE_CONTEXT_FIELD",uT="CREATE_PROJECT",z9e="UPDATE_PROJECT",H9e="DELETE_PROJECT",dT="CREATE_TAG_TYPE",dX="UPDATE_TAG_TYPE",W9e="DELETE_TAG_TYPE",V9e="CREATE_ADDON",pX="UPDATE_ADDON",fX="DELETE_ADDON",U9e="DELETE_ENVIRONMENT",pT="UPDATE_ENVIRONMENT",hX="CREATE_FEATURE_STRATEGY",lC="UPDATE_FEATURE_STRATEGY",G9e="DELETE_FEATURE_STRATEGY",q9e="UPDATE_FEATURE_ENVIRONMENT",gX="UPDATE_FEATURE_ENVIRONMENT_VARIANTS",oLt="MOVE_FEATURE_TOGGLE",cC="CREATE_SEGMENT",CA="UPDATE_SEGMENT",Y9e="DELETE_SEGMENT",iLt="APPLY_CHANGE_REQUEST",sLt="APPROVE_CHANGE_REQUEST",mX="SKIP_CHANGE_REQUEST",aLt="CREATE_PROJECT_API_TOKEN",Qd="UPDATE_PROJECT_SEGMENT",lLt="PROJECT_USER_ACCESS_READ",cLt="PROJECT_DEFAULT_STRATEGY_READ",uLt="PROJECT_CHANGE_REQUEST_READ",dLt="PROJECT_SETTINGS_READ",pLt="PROJECT_USER_ACCESS_WRITE",fLt="PROJECT_DEFAULT_STRATEGY_WRITE",hLt="PROJECT_CHANGE_REQUEST_WRITE",gLt="PROJECT_SETTINGS_WRITE",Bi=(e,t,n,r,o={})=>{const i=_n(e?n:null,r,o);return{...i,error:e?i.error:void 0,data:e?i.data:t}},vX=e=>{const{isEnterprise:t}=rt(),{data:n,error:r,mutate:o}=Bi(!!e&&t(),[],bt(`api/admin/projects/${e}/change-requests/config`),K9e);return{data:n||[],loading:!r&&!n,refetchChangeRequestConfig:o,error:r}},K9e=e=>fetch(e).then(Jt("Request changes")).then(t=>t.json()),mp=e=>{const{data:t}=vX(e),n=dC(e),r=Je.useCallback(a=>n(mX,a)?!1:t.some(c=>c.environment===a&&c.changeRequestEnabled),[JSON.stringify(t)]),o=Je.useCallback(a=>t.some(l=>l.environment===a&&l.changeRequestEnabled),[JSON.stringify(t)]),i=Je.useCallback(()=>t.some(a=>a.changeRequestEnabled),[JSON.stringify(t)]);return{isChangeRequestConfigured:r,isChangeRequestConfiguredInAnyEnv:i,isChangeRequestConfiguredForReview:o}},Rg="ADMIN",X9e="CREATE_ADDON",J9e="UPDATE_ADDON",Q9e="DELETE_ADDON",Z9e="UPDATE_CLIENT_API_TOKEN",eIe="CREATE_CLIENT_API_TOKEN",tIe="DELETE_CLIENT_API_TOKEN",yX="READ_CLIENT_API_TOKEN",nIe="UPDATE_FRONTEND_API_TOKEN",rIe="CREATE_FRONTEND_API_TOKEN",oIe="DELETE_FRONTEND_API_TOKEN",xX="READ_FRONTEND_API_TOKEN",iIe="UPDATE_APPLICATION",sIe="CREATE_CONTEXT_FIELD",aIe="UPDATE_CONTEXT_FIELD",lIe="DELETE_CONTEXT_FIELD",cIe="CREATE_PROJECT",bX="READ_ROLE",uIe="CREATE_SEGMENT",dIe="UPDATE_SEGMENT",pIe="DELETE_SEGMENT",fIe="CREATE_STRATEGY",hIe="UPDATE_STRATEGY",gIe="DELETE_STRATEGY",mIe="CREATE_TAG_TYPE",vIe="UPDATE_TAG_TYPE",yIe="DELETE_TAG_TYPE",uC="READ_LOGS",wX="UPDATE_MAINTENANCE_MODE",xIe="UPDATE_INSTANCE_BANNERS",bIe="UPDATE_CORS",wIe="UPDATE_AUTH_CONFIGURATION",SIe="CREATE_FEATURE",CIe="UPDATE_FEATURE",jIe="UPDATE_FEATURE_DEPENDENCY",EIe="DELETE_FEATURE",Xc="UPDATE_PROJECT",TIe="DELETE_PROJECT",kIe="UPDATE_FEATURE_VARIANTS",_Ie="MOVE_FEATURE_TOGGLE",RIe="READ_PROJECT_API_TOKEN",PIe="CREATE_PROJECT_API_TOKEN",AIe="DELETE_PROJECT_API_TOKEN",IIe="UPDATE_PROJECT_SEGMENT",$Ie="CREATE_FEATURE_STRATEGY",OIe="UPDATE_FEATURE_STRATEGY",SX="DELETE_FEATURE_STRATEGY",MIe="UPDATE_FEATURE_ENVIRONMENT_VARIANTS",DIe="UPDATE_FEATURE_ENVIRONMENT",LIe="PROJECT_USER_ACCESS_READ",FIe="PROJECT_DEFAULT_STRATEGY_READ",NIe="PROJECT_CHANGE_REQUEST_READ",BIe="PROJECT_SETTINGS_READ",zIe="PROJECT_USER_ACCESS_WRITE",HIe="PROJECT_DEFAULT_STRATEGY_WRITE",WIe="PROJECT_CHANGE_REQUEST_WRITE",VIe="PROJECT_SETTINGS_WRITE",jA="RELEASE_PLAN_TEMPLATE_CREATE",CX="RELEASE_PLAN_TEMPLATE_UPDATE",EA="RELEASE_PLAN_TEMPLATE_DELETE",UIe=[{label:"Integration",permissions:[X9e,J9e,Q9e]},{label:"API token",permissions:[Z9e,eIe,tIe,yX,nIe,rIe,oIe,xX]},{label:"Application",permissions:[iIe]},{label:"Context field",permissions:[sIe,aIe,lIe]},{label:"Project",permissions:[cIe]},{label:"Role",permissions:[bX]},{label:"Segment",permissions:[uIe,dIe,pIe]},{label:"Strategy",permissions:[fIe,hIe,gIe]},{label:"Tag type",permissions:[mIe,vIe,yIe]},{label:"Release plan templates",permissions:[jA,EA,CX]},{label:"Instance maintenance",permissions:[uC,wX,xIe,bIe]},{label:"Authentication",permissions:[wIe]}],GIe=[Rg,bX,yX,xX,wX,uC],mLt=[{label:"Features and strategies",permissions:[[SIe],[CIe],[jIe],[EIe],[kIe],[_Ie],[$Ie],[OIe],[SX],[DIe],[MIe],[IIe]]},{label:"Project settings",permissions:[[Xc],[LIe,Xc],[zIe,Xc],[FIe,Xc],[HIe,Xc],[BIe,Xc],[VIe,Xc],[TIe]]},{label:"API tokens",permissions:[[RIe],[PIe],[AIe]]},{label:"Change requests",permissions:[[WIe,Xc],[NIe,Xc]]}],qIe=(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=>GIe.includes(r.permission))),n},jX=()=>{const e=G0(),{uiConfig:t}=rt();return{permissions:qIe(e,t),refetchPermissions:e.refetchAuth,loading:e.loading,error:e.error}},YIe=e=>{const t=()=>{const r=bt(`api/admin/projects/${e}/overview`);return fetch(r,{method:"GET"}).then(Jt("Project overview")).then(o=>o.json())},n=`api/admin/projects/${e}/overview`;return{fetcher:t,KEY:n}},KIe={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"}},um=(e,t={})=>{const{KEY:n,fetcher:r}=YIe(e),{data:o,error:i,mutate:a}=_n(n,r,t),l=m.useCallback(()=>{a()},[a]);return{project:o||KIe,loading:!i&&!o,error:i,refetch:l}},vLt=e=>um(e).project.name||e,yLt=e=>{var t;return(t=e.featureTypeCounts)==null?void 0:t.map(n=>n.count).reduce((n,r)=>n+r,0)},dC=e=>{const{hasAccess:t}=m.useContext($o),n=(o,i,a)=>i&&a?t(o,i,a):i?t(o,i):t(o),r=(o,i,a)=>Array.isArray(o)?o.some(l=>n(l,i,a)):n(o,i,a);return(o,i)=>r(o,e,i)},xLt=e=>{const{isChangeRequestConfigured:t}=mp(e),n=dC(e);return(r,o)=>o&&t(o)||n(r,o)},XIe=[hX,lC,G9e,q9e,gX],JIe=(e,t)=>e.filter(n=>t.includes(n)).length>0,QIe=e=>{const{permissions:t}=jX();return t?t.find(r=>r.project===e):!1},ZIe=e=>{const t=QIe(e),{project:n}=um(e);return n.mode==="protected"?t:!0},e$e=e=>JIe(XIe,[].concat(e)),t$e=(e,t,n)=>{const{isChangeRequestConfigured:r}=mp(t),o=r(n),i=ZIe(t);return o&&i&&e$e(e)},Pg=(e,t,n)=>{const r=dC(t);return t$e(e,t,n)||r(e,n)},Nf=(e,t,n)=>dC(t)(e,n),n$e=x(Ue)({justifySelf:"start",alignSelf:"start","&.Mui-disabled":{pointerEvents:"auto"}}),r$e=(e,t,n)=>!e&&!n?s.jsx(lX,{titleAccess:"Locked"}):t||null,o$e=Je.forwardRef((e,t)=>{const n=Pg(e.permission,e.projectId,e.environmentId);return s.jsx(EX,{...e,access:n,ref:t})}),i$e=Je.forwardRef((e,t)=>{const n=Nf(e.permission,e.projectId,e.environmentId);return s.jsx(EX,{...e,access:n,ref:t})}),EX=Je.forwardRef(({permission:e,access:t,variant:n="contained",color:r="primary",onClick:o,children:i,disabled:a,projectId:l,environmentId:c,tooltipProps:u,hideLockIcon:d,className:p,...f},h)=>{const g=a||!t,v=Eu(),b=r$e(t,f.endIcon,d);return s.jsx(Qa,{...u,title:oC(t,u==null?void 0:u.title),arrow:!0,children:s.jsx(n$e,{ref:h,onClick:g?void 0:o,"aria-disabled":g||void 0,"aria-labelledby":v,variant:n,color:r,className:g?`${p} Mui-disabled`:p,...f,endIcon:b,children:i})})}),Ro=Je.forwardRef((e,t)=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?s.jsx(o$e,{...e,environmentId:e.environmentId,projectId:e.projectId,ref:t}):s.jsx(i$e,{...e,ref:t})),s$e=2;function a$e(e){const t=dK(new Date,s$e);return e.every(n=>{const r=Ha(n.lastSeenAt);return kb(r,t)})}const TX=e=>e==="initial"?"Define":e==="pre-live"?"Develop":e==="live"?"Production":e==="completed"?"Cleanup":e==="archived"?"Archived":e,sD=x("span")(({theme:e})=>({color:e.palette.text.secondary})),fc=x("p")(({theme:e})=>({paddingBottom:e.spacing(1),color:e.palette.text.primary})),l$e=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",marginBottom:e.spacing(2)})),aD=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",marginBottom:e.spacing(1.5),gap:e.spacing(1)})),c$e=x("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)})),u$e=x(xA)(({theme:e})=>({width:e.spacing(2),height:e.spacing(2),marginRight:e.spacing(.75)})),d$e=({lastSeen:e})=>{const t=aC(),{text:n,background:r}=t(e);return s.jsx(u$e,{style:{background:r},children:s.jsx(yA,{stroke:n})})},p$e=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:e.spacing(1),marginBottom:e.spacing(1),marginLeft:e.spacing(3.5)})),f$e=x(J)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.text.primary})),h$e=x(lm)(({theme:e})=>({color:e.palette.primary.main,width:e.spacing(2.5),display:"block"})),fT=x(J)(({theme:e})=>({display:"flex",alignItems:"center"})),pC=x(J)(({theme:e})=>({marginTop:e.spacing(2)})),kX=({environments:e})=>s.jsx(J,{children:e.map(t=>s.jsxs(p$e,{children:[s.jsx(fT,{children:s.jsx(J,{children:t.name})}),s.jsxs(fT,{children:[s.jsx(d$e,{lastSeen:t.lastSeenAt}),s.jsx(Pl,{date:t.lastSeenAt})]})]},t.name))}),TA=x(Z)(({theme:e})=>({paddingTop:e.spacing(.5),marginBottom:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.smallerBody,fontWeight:e.typography.fontWeightBold})),g$e=({onComplete:e,loading:t,project:n})=>s.jsxs(pC,{children:[s.jsx(TA,{children:"Is this feature complete?"}),s.jsx(fc,{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."}),s.jsx(Ro,{variant:"outlined",permission:cm,size:"small",onClick:e,disabled:t,projectId:n,children:"Mark completed"})]}),m$e=({onComplete:e,loading:t,project:n})=>s.jsxs(pC,{children:[s.jsx(TA,{children:"Ready for cleanup?"}),s.jsx(fc,{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."}),s.jsx(Ro,{variant:"outlined",permission:cm,size:"small",onClick:e,disabled:t,projectId:n,children:"Mark ready for cleanup"})]}),v$e=({onArchive:e,onUncomplete:t,loading:n,project:r})=>s.jsxs(pC,{children:[s.jsx(TA,{children:"Safe to archive"}),s.jsx(fc,{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."}),s.jsxs(J,{sx:o=>({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:o.spacing(2),marginTop:o.spacing(1)}),children:[s.jsx(Ro,{variant:"outlined",permission:cm,size:"small",onClick:t,disabled:n,projectId:r,children:"Revert to previous stage"}),s.jsx(Ro,{variant:"outlined",permission:cX,size:"small",sx:{mb:2},onClick:e,projectId:r,children:"Archive feature"})]})]}),y$e=({onUncomplete:e,loading:t})=>s.jsxs(pC,{children:[s.jsx(fc,{children:"This feature has been successfully completed, but we are still seeing usage. Clean up the feature flag from your code before archiving it."}),s.jsx(fc,{children:"If you think this feature was completed too early you can revert to the previous stage."}),s.jsx(Ro,{variant:"outlined",permission:cm,size:"small",sx:{mb:2},onClick:e,disabled:t,children:"Revert to previous stage"})]}),x$e=({environments:e,onArchive:t,onUncomplete:n,loading:r,project:o})=>a$e(e)?s.jsx(v$e,{onArchive:t,onUncomplete:n,loading:r,project:o}):s.jsx(y$e,{onUncomplete:n,loading:r}),b$e=({time:e})=>{const{locationSettings:t}=wo();return s.jsx("span",{children:Ja(e,t.locale)})},w$e=({time:e})=>{const t=Ha(e),n=nK(t,{addSuffix:!1});return s.jsx("span",{children:n})},S$e=({stage:e})=>e==="initial"?s.jsx(fc,{children:"Feature flag has been created, but we have not seen any metrics yet."}):e==="pre-live"?s.jsx(fc,{children:"Feature is being developed and tested in controlled environments."}):e==="live"?s.jsx(fc,{children:"Feature is being rolled out in production according to an activation strategy."}):e==="completed"?s.jsx(fc,{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"?s.jsx(fc,{children:"Flag is archived in Unleash for future reference."}):null,C$e=({stage:e})=>s.jsxs(s.Fragment,{children:[s.jsxs(f$e,{children:[s.jsx(h$e,{})," ",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?s.jsx(kX,{environments:e.environments}):null]}),j$e=({children:e,stage:t,project:n,onArchive:r,onComplete:o,onUncomplete:i,loading:a})=>s.jsx(hr,{maxHeight:800,maxWidth:350,arrow:!0,tabIndex:0,title:s.jsxs(J,{children:[s.jsxs(J,{sx:l=>({padding:l.spacing(2)}),children:[s.jsxs(l$e,{children:[s.jsx(Z,{variant:"h3",children:"Lifecycle"}),s.jsxs(J,{sx:{display:"flex",alignItems:"center",gap:1},children:[s.jsx(Z,{variant:"body2",children:TX(t.name)}),s.jsx(bA,{stage:t})]})]}),s.jsx(S$e,{stage:t.name}),s.jsxs(aD,{children:[s.jsx(sD,{children:"Stage entered at"}),s.jsx(b$e,{time:t.enteredStageAt})]}),s.jsxs(aD,{children:[s.jsx(sD,{children:"Time spent in stage"}),s.jsx(w$e,{time:t.enteredStageAt})]})]}),t.name!=="archived"?s.jsxs(c$e,{children:[s.jsx(C$e,{stage:t}),t.name==="live"&&o?s.jsx(g$e,{onComplete:o,loading:a,project:n,children:s.jsx(kX,{environments:t.environments})}):null,t.name==="completed"&&r&&i?s.jsx(x$e,{environments:t.environments,onArchive:r,onUncomplete:i,loading:a,project:n}):null,(t.name==="initial"||t.name==="pre-live")&&o?s.jsx(m$e,{onComplete:o,loading:a,project:n}):null]}):null]}),children:s.jsx(fT,{children:e})}),E$e=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}},T$e=()=>{const{makeRequest:e,makeLightRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0});return{markFeatureCompleted:async(l,c,u)=>{const d=`api/admin/projects/${c}/features/${l}/lifecycle/complete`,p=n(d,{method:"POST",body:JSON.stringify(u)});return e(p.caller,p.id)},markFeatureUncompleted:async(l,c)=>{const u=`api/admin/projects/${c}/features/${l}/lifecycle/uncomplete`,d=n(u,{method:"POST"});return e(d.caller,d.id)},errors:r,loading:o}},k$e=({feature:e,project:t,onChange:n})=>{const{trackEvent:r}=Kt(),{setToastApiError:o}=Nt(),{markFeatureUncompleted:i,loading:a}=T$e();return{onUncompleteHandler:async()=>{try{await i(e,t),n==null||n(),r("feature-lifecycle",{props:{eventType:"uncomplete"}})}catch(c){o(Tt(c))}},loading:a}},_$e=({feature:e,expanded:t,onComplete:n,onUncomplete:r,onArchive:o})=>{const i=E$e(e),{onUncompleteHandler:a,loading:l}=k$e({feature:e.name,project:e.project,onChange:r});return i?s.jsxs(J,{sx:c=>({display:"flex",gap:c.spacing(.5)}),children:[s.jsx(j$e,{stage:i,project:e.project,onArchive:o,onComplete:n,onUncomplete:r?a:void 0,loading:l,children:s.jsx(bA,{stage:i})})," ",s.jsx("p",{children:t?TX(i.name):null})]}):null},_X=({feature:e,...t})=>{const n=e.environments?Object.values(e.environments):[];return s.jsx(j9e,{featureLastSeen:e.lastSeenAt||void 0,environments:n,...t})},R$e=({feature:e,onComplete:t,onUncomplete:n,onArchive:r,expanded:o,...i})=>s.jsx(J,{sx:a=>({display:"flex",justifyContent:o?"flex-start":"center",padding:a.spacing(0,o?2:0)}),children:s.jsx(_$e,{onArchive:r,onComplete:t,onUncomplete:n,feature:e,expanded:o})}),bLt=Je.memo(_X),Xr=(e={})=>{const t=`api/admin/projects${e.archived?"?archived=true":""}`,n=()=>{const c=bt(t);return fetch(c,{method:"GET"}).then(Jt("Projects")).then(u=>u.json())},{data:r,error:o}=_n(t,n,e),[i,a]=m.useState(!o&&!r),l=()=>{Io(t)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{projects:(r==null?void 0:r.projects)||[],error:o,loading:i,refetch:l}},ma=e=>{rt();const t=bt(e?`api/admin/segments/strategies/${e}`:"api/admin/segments"),{data:n,error:r,mutate:o}=_n(t,()=>P$e(t),{refreshInterval:15*1e3}),i=m.useCallback(()=>{o().catch(console.warn)},[o]);return{segments:n,refetchSegments:i,loading:!r&&!n,error:r}},P$e=async e=>fetch(e).then(Jt("Segments")).then(t=>t.json()).then(t=>t.segments),A$e=(e={})=>{const t=async()=>{const c=bt("api/admin/tags");return(await fetch(c,{method:"GET"}).then(Jt("Tags"))).json()},n="api/admin/tags",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=()=>{Io(n)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{tags:(r==null?void 0:r.tags)||[],error:o,loading:i,refetch:l}},kA=()=>{const{makeRequest:e,createRequest:t}=ar({propagateErrors:!0});return{setSplashSeen:async r=>{const o=`api/admin/splash/${r}`,i=t(o,{method:"POST"});try{return await e(i.caller,i.id)}catch{console.log("An exception was caught and handled.")}}}},fC=()=>{const e=G0();return{splash:e.data&&"splash"in e.data?e.data.splash:void 0,refetchSplash:e.refetchAuth,loading:e.loading,error:e.error}},$s=e=>P_()[e],lD=x(Ue)(({theme:e})=>({padding:e.spacing(0,1.25,0,1.25),height:e.spacing(3.75)})),I$e=x(hr)(({theme:e})=>({zIndex:e.zIndex.drawer})),$$e=x(Cb)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),O$e=x(Ka)(({theme:e})=>({color:e.palette.action.active,"&.material-symbols-outlined":{fontSize:e.spacing(2)}})),M$e=({visibleOptions:e,hiddenOptions:t,onSelectedOptionsChange:n,availableFilters:r})=>{const o=$s("projectId"),{user:i}=Si(),{setSplashSeen:a}=kA(),{splash:l}=fC(),[c,u]=m.useState(null),[d,p]=m.useState(!(l!=null&&l.simplifyProjectOverview)),f=w=>{u(w.currentTarget)},h=()=>{u(null)},g=w=>{n([...t,w]),h()},b=o&&(w=>{if(!w)return!1;const S=new Date("2024-11-08T00:00:00.000Z");return new Date(w)<S})(i==null?void 0:i.createdAt),y=()=>s.jsxs(Cb,{children:[s.jsxs(Cb,{children:["Archived flags are now accessible via the"," ",s.jsx("b",{children:"Show only archived"})," filter option."]}),s.jsx(Cb,{onClick:()=>{p(!1),a("simplifyProjectOverview")},sx:w=>({color:w.palette.primary.dark,cursor:"pointer"}),children:"Got it"})]});return s.jsxs("div",{children:[b?s.jsx(I$e,{placement:"right",arrow:!0,title:s.jsx(y,{}),describeChild:!0,open:d,children:s.jsx(lD,{onClick:f,startIcon:s.jsx(M2,{}),children:"Filter"})}):s.jsx(lD,{onClick:f,startIcon:s.jsx(M2,{}),children:"Filter"}),s.jsx(MS,{id:"simple-menu","data-testid":$je,anchorEl:c,keepMounted:!0,open:!!c,onClose:h,children:e.map(w=>{const S=r.find(j=>j.label===w);return s.jsx(Cr,{onClick:()=>g(w),children:s.jsxs($$e,{children:[s.jsx(O$e,{children:S==null?void 0:S.icon}),w]})},w)})})]})},D$e=x("div")(({theme:e})=>({padding:e.spacing(1.5),display:"flex",flexDirection:"column",gap:e.spacing(1),maxHeight:"70vh"})),L$e=x(Gr)(({theme:e})=>({paddingLeft:e.spacing(1),cursor:"pointer","&:hover, &:focus":{backgroundColor:e.palette.action.hover,outline:"none"}})),F$e=x(pa)(({theme:e})=>({padding:e.spacing(1,1,1,1.5)})),RX=x(_l)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:`${e.shape.borderRadiusMedium}px`}})),N$e=x(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 _A={},B$e=Te;Object.defineProperty(_A,"__esModule",{value:!0});var PX=_A.default=void 0,z$e=B$e(ke()),H$e=s,W$e=(0,z$e.default)((0,H$e.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");PX=_A.default=W$e;const V$e=x("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=x(MS)(({theme:e})=>({transform:`translateY(${e.spacing(.5)})`})),cD=e=>e.replaceAll("_"," ").toLocaleLowerCase(),G$e=({options:e,value:t,onChange:n})=>{const[r,o]=m.useState(null),i=()=>{o(null)},a=c=>{c.stopPropagation(),o(c.currentTarget)},l=c=>u=>{u.stopPropagation(),n(c),i()};return s.jsxs(s.Fragment,{children:[s.jsx(V$e,{onClick:a,children:cD(t)}),s.jsx(U$e,{anchorEl:r,open:!!r,onClose:i,anchorPosition:{left:0,top:1},onClick:c=>c.stopPropagation(),children:e.map(c=>s.jsx(Cr,{onClick:l(c),children:cD(c)},c))})]})},q$e=x(({isActive:e,...t})=>s.jsx(da,{"data-testid":Oje,...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}})),Y$e=x("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",fontWeight:e.typography.fontWeightBold,minHeight:e.spacing(3.5)})),K$e=x("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)})),X$e=x($t)(({theme:e})=>({marginLeft:e.spacing(.5),marginRight:e.spacing(-1.25)})),J$e=()=>s.jsx(PX,{fontSize:"small",color:"action",sx:e=>({marginRight:e.spacing(-1),marginLeft:e.spacing(.5)})}),AX=({name:e,label:t,selectedDisplayOptions:n=[],operatorOptions:r,operator:o,onChangeOperator:i,onClick:a,onDelete:l})=>{const c=n.length>0,u=2,d=n.slice(0,u),p=n.length-u,{trackEvent:f}=Kt(),h=g=>{i(g),f("search-filter",{props:{label:e,operator:g}})};return s.jsx(q$e,{isActive:c,label:s.jsxs(Y$e,{children:[t,s.jsx(X,{condition:!c,show:()=>s.jsx(J$e,{}),elseShow:()=>s.jsxs(s.Fragment,{children:[s.jsx(G$e,{options:r,value:o,onChange:h}),s.jsxs(K$e,{children:[d.join(", "),p>0?` +${p}`:""]})]})}),s.jsx(X,{condition:!!l,show:()=>s.jsx(X$e,{"aria-label":"delete",color:"primary",onClick:g=>{g.preventDefault(),g.stopPropagation(),l==null||l()},size:"small",children:s.jsx(Ho,{fontSize:"inherit",color:"action"})})})]}),color:"primary",variant:"outlined",onClick:a})};function on(){return on=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},on.apply(null,arguments)}function Di(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Q$e(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const hC=typeof window<"u"?m.useLayoutEffect:m.useEffect;let uD=0;function Z$e(e){const[t,n]=m.useState(e),r=t;return m.useEffect(()=>{t==null&&(uD+=1,n(`mui-${uD}`))},[t]),r}const e6e={...S1},dD=e6e.useId;function t6e(e){return dD!==void 0?dD():Z$e(e)}function Ag({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=m.useRef(e!==void 0),[i,a]=m.useState(t),l=o?e:i,c=m.useCallback(u=>{o||a(u)},[]);return[l,c]}function Sr(e){const t=m.useRef(e);return hC(()=>{t.current=e}),m.useRef((...n)=>(0,t.current)(...n)).current}function RA(...e){return m.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{Q$e(n,t)})},e)}function Ol(e,t,n=void 0){const r={};for(const o in e){const i=e[o];let a="",l=!0;for(let c=0;c<i.length;c+=1){const u=i[c];u&&(a+=(l===!0?"":" ")+t(u),l=!1,n&&n[u]&&(a+=" "+n[u]))}r[o]=a}return r}const pD=e=>e,n6e=()=>{let e=pD;return{configure(t){e=t},generate(t){return e(t)},reset(){e=pD}}},r6e=n6e(),o6e={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 il(e,t,n="Mui"){const r=o6e[t];return r?`${n}-${r}`:`${r6e.generate(e)}-${t}`}function Ml(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=il(e,o,n)}),r}function i6e(e){return typeof e=="string"}function s6e(e,t,n){return e===void 0||i6e(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function a6e(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 fD(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 l6e(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:i}=e;if(!t){const h=Ae(n==null?void 0:n.className,i,o==null?void 0:o.className,r==null?void 0:r.className),g={...n==null?void 0:n.style,...o==null?void 0:o.style,...r==null?void 0:r.style},v={...n,...o,...r};return h.length>0&&(v.className=h),Object.keys(g).length>0&&(v.style=g),{props:v,internalRef:void 0}}const a=a6e({...o,...r}),l=fD(r),c=fD(o),u=t(a),d=Ae(u==null?void 0:u.className,n==null?void 0:n.className,i,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 c6e(e,t,n){return typeof e=="function"?e(t,n):e}function vc(e){var p;const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:o=!1,...i}=e,a=o?{}:c6e(n,r),{props:l,internalRef:c}=l6e({...i,externalSlotProps:a}),u=RA(c,a==null?void 0:a.ref,(p=e.additionalProps)==null?void 0:p.ref);return s6e(t,{...l,ref:u},r)}const u6e=["localeText"],hT=m.createContext(null),d6e=function(t){const{localeText:n}=t,r=Di(t,u6e),{utils:o,localeText:i}=m.useContext(hT)??{utils:void 0,localeText:void 0},a=ct({props:r,name:"MuiLocalizationProvider"}),{children:l,dateAdapter:c,dateFormats:u,dateLibInstance:d,adapterLocale:p,localeText:f}=a,h=m.useMemo(()=>on({},f,i,n),[f,i,n]),g=m.useMemo(()=>{if(!c)return o||null;const y=new c({locale:p,formats:u,instance:d});if(!y.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(`
297
297
  `));return y},[c,p,u,d,o]),v=m.useMemo(()=>g?{minDate:g.date("1900-01-01T00:00:00.000"),maxDate:g.date("2099-12-31T00:00:00.000")}:null,[g]),b=m.useMemo(()=>({utils:g,defaultDates:v,localeText:h}),[v,g,h]);return s.jsx(hT.Provider,{value:b,children:l})},p6e=e=>({components:{MuiLocalizationProvider:{defaultProps:{localeText:on({},e)}}}}),IX={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"},f6e=IX;p6e(IX);const gC=()=>{const e=m.useContext(hT);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(`
298
298
  `));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(`
299
- `));const t=m.useMemo(()=>on({},f6e,e.localeText),[e.localeText]);return m.useMemo(()=>on({},e,{localeText:t}),[e,t])},ss=()=>gC().utils,PA=()=>gC().defaultDates,mC=e=>{const t=ss(),n=m.useRef(void 0);return n.current===void 0&&(n.current=t.date(void 0,e)),n.current},$X=()=>gC().localeText,h6e=Dr(s.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),g6e=Dr(s.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),m6e=Dr(s.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");Dr(s.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");Dr(s.jsxs(m.Fragment,{children:[s.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"}),s.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");Dr(s.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");Dr(s.jsxs(m.Fragment,{children:[s.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"}),s.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time");Dr(s.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 v6e(e){return il("MuiPickersArrowSwitcher",e)}Ml("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const y6e=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],x6e=["ownerState"],b6e=["ownerState"],w6e=x("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),S6e=x("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),hD=x($t,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),C6e=e=>{const{classes:t}=e;return Ol({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},v6e,t)},j6e=m.forwardRef(function(t,n){const r=xS(),o=ct({props:t,name:"MuiPickersArrowSwitcher"}),{children:i,className:a,slots:l,slotProps:c,isNextDisabled:u,isNextHidden:d,onGoToNext:p,nextLabel:f,isPreviousDisabled:h,isPreviousHidden:g,onGoToPrevious:v,previousLabel:b,labelId:y}=o,w=Di(o,y6e),S=o,j=C6e(S),E={isDisabled:u,isHidden:d,goTo:p,label:f},C={isDisabled:h,isHidden:g,goTo:v,label:b},T=(l==null?void 0:l.previousIconButton)??hD,k=vc({elementType:T,externalSlotProps:c==null?void 0:c.previousIconButton,additionalProps:{size:"medium",title:C.label,"aria-label":C.label,disabled:C.isDisabled,edge:"end",onClick:C.goTo},ownerState:on({},S,{hidden:C.isHidden}),className:Ae(j.button,j.previousIconButton)}),_=(l==null?void 0:l.nextIconButton)??hD,A=vc({elementType:_,externalSlotProps:c==null?void 0:c.nextIconButton,additionalProps:{size:"medium",title:E.label,"aria-label":E.label,disabled:E.isDisabled,edge:"start",onClick:E.goTo},ownerState:on({},S,{hidden:E.isHidden}),className:Ae(j.button,j.nextIconButton)}),O=(l==null?void 0:l.leftArrowIcon)??g6e,M=vc({elementType:O,externalSlotProps:c==null?void 0:c.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:S,className:j.leftArrowIcon}),H=Di(M,x6e),P=(l==null?void 0:l.rightArrowIcon)??m6e,$=vc({elementType:P,externalSlotProps:c==null?void 0:c.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:S,className:j.rightArrowIcon}),D=Di($,b6e);return s.jsxs(w6e,on({ref:n,className:Ae(j.root,a),ownerState:S},w,{children:[s.jsx(T,on({},k,{children:r?s.jsx(P,on({},D)):s.jsx(O,on({},H))})),i?s.jsx(Z,{variant:"subtitle1",component:"span",id:y,children:i}):s.jsx(S6e,{className:j.spacer,ownerState:S}),s.jsx(_,on({},A,{children:r?s.jsx(O,on({},H)):s.jsx(P,on({},D))}))]}))}),gD=(e,t)=>t.getHours(e)*3600+t.getMinutes(e)*60+t.getSeconds(e),E6e=(e,t)=>(n,r)=>e?t.isAfter(n,r):gD(n,t)>gD(r,t);function T6e({onChange:e,onViewChange:t,openTo:n,view:r,views:o,autoFocus:i,focusedView:a,onFocusedViewChange:l}){const c=m.useRef(n),u=m.useRef(o),d=m.useRef(o.includes(n)?n:o[0]),[p,f]=Ag({name:"useViews",state:"view",controlled:r,default:d.current}),h=m.useRef(i?p:null),[g,v]=Ag({name:"useViews",state:"focusedView",controlled:a,default:h.current});m.useEffect(()=>{(c.current&&c.current!==n||u.current&&u.current.some(T=>!o.includes(T)))&&(f(o.includes(n)?n:o[0]),u.current=o,c.current=n)},[n,f,p,o]);const b=o.indexOf(p),y=o[b-1]??null,w=o[b+1]??null,S=Sr((T,k)=>{v(k?T:_=>T===_?null:_),l==null||l(T,k)}),j=Sr(T=>{S(T,!0),T!==p&&(f(T),t&&t(T))}),E=Sr(()=>{w&&j(w)}),C=Sr((T,k,_)=>{const A=k==="finish",O=_?o.indexOf(_)<o.length-1:!!w;if(e(T,A&&O?"partial":k,_),_&&_!==p){const H=o[o.indexOf(_)+1];H&&j(H)}else A&&E()});return{view:p,setView:j,focusedView:g,setFocusedView:S,nextView:w,previousView:y,defaultView:o.includes(n)?n:o[0],goToNextView:E,setValueAndGoToNextView:C}}function k6e(e,{disableFuture:t,maxDate:n,timezone:r}){const o=ss();return m.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isBefore(i,n)?i:n);return!o.isAfter(a,e)},[t,n,e,o,r])}function _6e(e,{disablePast:t,minDate:n,timezone:r}){const o=ss();return m.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isAfter(i,n)?i:n);return!o.isBefore(a,e)},[t,n,e,o,r])}const r0=36,vC=2,AA=320,R6e=280,OX=336,P6e=x("div")({overflow:"hidden",width:AA,maxHeight:OX,display:"flex",flexDirection:"column",margin:"0 auto"}),H2=(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},i1=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:i,utils:a,timezone:l})=>{const c=H2(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(!i(u))return u;u=a.addDays(u,1)}if(d){if(!i(d))return d;d=a.addDays(d,-1)}}return null},A6e=(e,t)=>t==null||!e.isValid(t)?null:t,Zd=(e,t,n)=>t==null||!e.isValid(t)?n:t,I6e=(e,t,n)=>!e.isValid(t)&&t!=null&&!e.isValid(n)&&n!=null?!0:e.isEqual(t,n),$6e=(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},MX=(e,t,n)=>n==="date"?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),O6e=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(r=>e.addDays(n,r))},M6e=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:o,valueManager:i})=>{const a=ss(),l=m.useRef(n),c=t??l.current??i.emptyValue,u=m.useMemo(()=>i.getTimezone(a,c),[a,i,c]),d=Sr(g=>u==null?g:i.setTimezone(a,u,g));let p;e?p=e:u?p=u:r?p=a.getTimezone(r):p="default";const f=m.useMemo(()=>i.setTimezone(a,p,c),[i,a,p,c]),h=Sr((g,...v)=>{const b=d(g);o==null||o(b,...v)});return{value:f,handleValueChange:h,timezone:p}},IA=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:o,onChange:i,valueManager:a})=>{const[l,c]=Ag({name:e,state:"value",controlled:n,default:r??a.emptyValue}),u=Sr((d,...p)=>{c(d),i==null||i(d,...p)});return M6e({timezone:t,value:l,defaultValue:void 0,referenceDate:o,onChange:u,valueManager:a})},lu={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},nv=(e,t,n)=>{if(t===lu.year)return e.startOfYear(n);if(t===lu.month)return e.startOfMonth(n);if(t===lu.day)return e.startOfDay(n);let r=n;return t<lu.minutes&&(r=e.setMinutes(r,0)),t<lu.seconds&&(r=e.setSeconds(r,0)),t<lu.milliseconds&&(r=e.setMilliseconds(r,0)),r},D6e=({props:e,utils:t,granularity:n,timezone:r,getTodayDate:o})=>{let i=o?o():nv(t,n,MX(t,r));e.minDate!=null&&t.isAfterDay(e.minDate,i)&&(i=nv(t,n,e.minDate)),e.maxDate!=null&&t.isBeforeDay(e.maxDate,i)&&(i=nv(t,n,e.maxDate));const a=E6e(e.disableIgnoringDatePartForTimeValidation??!1,t);return e.minTime!=null&&a(e.minTime,i)&&(i=nv(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:H2(t,i,e.minTime))),e.maxTime!=null&&a(i,e.maxTime)&&(i=nv(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:H2(t,i,e.maxTime))),i},L6e=["value","referenceDate"],Bf={emptyValue:null,getTodayValue:MX,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=Di(e,L6e);return t!=null&&r.utils.isValid(t)?t:n??D6e(r)},cleanValue:A6e,areValuesEqual:I6e,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 F6e(e){return il("MuiPickersDay",e)}const Fp=Ml("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),N6e=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],B6e=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:i,outsideCurrentMonth:a,showDaysOutsideCurrentMonth:l,classes:c}=e,u=a&&!l;return Ol({root:["root",t&&!u&&"selected",i&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",a&&l&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},F6e,c)},DX=({theme:e})=>on({},e.typography.caption,{width:r0,height:r0,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})`:Dt(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:Dt(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${Fp.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${Fp.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}},[`&.${Fp.disabled}:not(.${Fp.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${Fp.disabled}&.${Fp.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${vC}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${Fp.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),LX=(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]},z6e=x(As,{name:"MuiPickersDay",slot:"Root",overridesResolver:LX})(DX),H6e=x("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:LX})(({theme:e})=>on({},DX({theme:e}),{opacity:0,pointerEvents:"none"})),rv=()=>{},W6e=m.forwardRef(function(t,n){const r=ct({props:t,name:"MuiPickersDay"}),{autoFocus:o=!1,className:i,day:a,disabled:l=!1,disableHighlightToday:c=!1,disableMargin:u=!1,isAnimating:d,onClick:p,onDaySelect:f,onFocus:h=rv,onBlur:g=rv,onKeyDown:v=rv,onMouseDown:b=rv,onMouseEnter:y=rv,outsideCurrentMonth:w,selected:S=!1,showDaysOutsideCurrentMonth:j=!1,children:E,today:C=!1}=r,T=Di(r,N6e),k=on({},r,{autoFocus:o,disabled:l,disableHighlightToday:c,disableMargin:u,selected:S,showDaysOutsideCurrentMonth:j,today:C}),_=B6e(k),A=ss(),O=m.useRef(null),M=RA(O,n);hC(()=>{o&&!l&&!d&&!w&&O.current.focus()},[o,l,d,w]);const H=$=>{b($),w&&$.preventDefault()},P=$=>{l||f(a),w&&$.currentTarget.focus(),p&&p($)};return w&&!j?s.jsx(H6e,{className:Ae(_.root,_.hiddenDaySpacingFiller,i),ownerState:k,role:T.role}):s.jsx(z6e,on({className:Ae(_.root,i),ref:M,centerRipple:!0,disabled:l,tabIndex:S?0:-1,onKeyDown:$=>v($,a),onFocus:$=>h($,a),onBlur:$=>g($,a),onMouseEnter:$=>y($,a),onClick:P,onMouseDown:H},T,{ownerState:k,children:E||A.format(a,"dayOfMonth")}))}),V6e=m.memo(W6e),FX=({props:e,value:t,timezone:n,adapter:r})=>{if(t===null)return null;const{shouldDisableDate:o,shouldDisableMonth:i,shouldDisableYear:a,disablePast:l,disableFuture:c}=e,u=r.utils.date(void 0,n),d=Zd(r.utils,e.minDate,r.defaultDates.minDate),p=Zd(r.utils,e.maxDate,r.defaultDates.maxDate);switch(!0){case!r.utils.isValid(t):return"invalidDate";case!!(o&&o(t)):return"shouldDisableDate";case!!(i&&i(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}};FX.valueManager=Bf;const NX=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a,timezone:l})=>{const c=gC();return m.useCallback(u=>FX({adapter:c,value:u,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a}})!==null,[c,e,t,n,r,o,i,a,l])},U6e=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return on({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const i=o.newTimezone;if(n.getTimezone(r.currentMonth)===i)return r;let a=n.setTimezone(r.currentMonth,i);return n.getMonth(a)!==n.getMonth(r.currentMonth)&&(a=n.setMonth(a,n.getMonth(r.currentMonth))),on({},r,{currentMonth:a})}case"finishMonthSwitchingAnimation":return on({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const i=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return on({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:i&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:i?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},G6e=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:i=!1,maxDate:a,minDate:l,onMonthChange:c,reduceAnimations:u,shouldDisableDate:d,timezone:p}=e,f=ss(),h=m.useRef(U6e(!!u,i,f)).current,g=m.useMemo(()=>Bf.getInitialReferenceValue({value:t,utils:f,timezone:p,props:e,referenceDate:n,granularity:lu.day}),[n,p]),[v,b]=m.useReducer(h,{isMonthSwitchingAnimating:!1,focusedDay:g,currentMonth:f.startOfMonth(g),slideDirection:"left"});m.useEffect(()=>{b({type:"changeMonthTimezone",newTimezone:f.getTimezone(g)})},[g,f]);const y=m.useCallback(C=>{b(on({type:"changeMonth"},C)),c&&c(C.newMonth)},[c]),w=m.useCallback(C=>{const T=C;f.isSameMonth(T,v.currentMonth)||y({newMonth:f.startOfMonth(T),direction:f.isAfterDay(T,v.currentMonth)?"left":"right"})},[v.currentMonth,y,f]),S=NX({shouldDisableDate:d,minDate:l,maxDate:a,disableFuture:r,disablePast:o,timezone:p}),j=m.useCallback(()=>{b({type:"finishMonthSwitchingAnimation"})},[]),E=Sr((C,T)=>{S(C)||b({type:"changeFocusedDay",focusedDay:C,withoutMonthSwitchingAnimation:T})});return{referenceDate:g,calendarState:v,changeMonth:w,changeFocusedDay:E,isDateDisabled:S,onMonthSwitchingAnimationEnd:j,handleChangeMonth:y}},q6e=e=>il("MuiPickersFadeTransitionGroup",e);Ml("MuiPickersFadeTransitionGroup",["root"]);const Y6e=e=>{const{classes:t}=e;return Ol({root:["root"]},q6e,t)},K6e=x(D0,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function BX(e){const t=ct({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:i}=t,a=Y6e(t),l=qt();return o?n:s.jsx(K6e,{className:Ae(a.root,r),children:s.jsx(z0,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:l.transitions.duration.enteringScreen,enter:l.transitions.duration.enteringScreen,exit:0},children:n},i)})}const X6e=e=>il("MuiPickersSlideTransition",e),Ca=Ml("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),J6e=["children","className","reduceAnimations","slideDirection","transKey","classes"],Q6e=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return Ol(r,X6e,t)},Z6e=x(D0,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${Ca["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${Ca["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${Ca.slideEnterActive}`]:t.slideEnterActive},{[`.${Ca.slideExit}`]:t.slideExit},{[`.${Ca["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${Ca["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},[`& .${Ca["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${Ca["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${Ca.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${Ca.slideExit}`]:{transform:"translate(0%)"},[`& .${Ca["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${Ca["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function eOe(e){const t=ct({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:i}=t,a=Di(t,J6e),l=Q6e(t),c=qt();if(o)return s.jsx("div",{className:Ae(l.root,r),children:n});const u={exit:l.exit,enterActive:l.enterActive,enter:l.enter,exitActive:l.exitActive};return s.jsx(Z6e,{className:Ae(l.root,r),childFactory:d=>m.cloneElement(d,{classNames:u}),role:"presentation",children:s.jsx(Q_,on({mountOnEnter:!0,unmountOnExit:!0,timeout:c.transitions.duration.complex,classNames:u},a,{children:n}),i)})}const tOe=e=>il("MuiDayCalendar",e);Ml("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const nOe=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],rOe=["ownerState"],oOe=e=>{const{classes:t}=e;return Ol({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},tOe,t)},zX=(r0+vC*2)*6,iOe=x("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),sOe=x("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),aOe=x(Z,{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})),lOe=x(Z,{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})),cOe=x(Z,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>on({},e.typography.caption,{width:r0,height:r0,padding:0,margin:`0 ${vC}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),uOe=x("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:zX}),dOe=x(eOe,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:zX}),pOe=x("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),fOe=x("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${vC}px 0`,display:"flex",justifyContent:"center"});function hOe(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:i,currentMonthNumber:a,isViewFocused:l}=e,c=Di(e,nOe);const{disabled:u,disableHighlightToday:d,isMonthSwitchingAnimating:p,showDaysOutsideCurrentMonth:f,slots:h,slotProps:g,timezone:v}=t,b=ss(),y=mC(v),w=r!==null&&b.isSameDay(n,r),S=o.some(M=>b.isSameDay(M,n)),j=b.isSameDay(n,y),E=(h==null?void 0:h.day)??V6e,C=vc({elementType:E,externalSlotProps:g==null?void 0:g.day,additionalProps:on({disableHighlightToday:d,showDaysOutsideCurrentMonth:f,role:"gridcell",isAnimating:p,"data-timestamp":b.toJsDate(n).valueOf()},c),ownerState:on({},t,{day:n,selected:S})}),T=Di(C,rOe),k=m.useMemo(()=>u||i(n),[u,i,n]),_=m.useMemo(()=>b.getMonth(n)!==a,[b,n,a]),A=m.useMemo(()=>{const M=b.startOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.startOfWeek(M)):b.isSameDay(n,M)},[a,n,f,b]),O=m.useMemo(()=>{const M=b.endOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.endOfWeek(M)):b.isSameDay(n,M)},[a,n,f,b]);return s.jsx(E,on({},T,{day:n,disabled:k,autoFocus:l&&w,today:j,outsideCurrentMonth:_,isFirstVisibleCell:A,isLastVisibleCell:O,selected:S,tabIndex:w?0:-1,"aria-selected":S,"aria-current":j?"date":void 0}))}function gOe(e){const t=ct({props:e,name:"MuiDayCalendar"}),n=ss(),{onFocusedDayChange:r,className:o,currentMonth:i,selectedDays:a,focusedDay:l,loading:c,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:d,readOnly:p,reduceAnimations:f,renderLoading:h=()=>s.jsx("span",{children:"..."}),slideDirection:g,TransitionProps:v,disablePast:b,disableFuture:y,minDate:w,maxDate:S,shouldDisableDate:j,shouldDisableMonth:E,shouldDisableYear:C,dayOfWeekFormatter:T=ge=>n.format(ge,"weekdayShort").charAt(0).toUpperCase(),hasFocus:k,onFocusedViewChange:_,gridLabelId:A,displayWeekNumber:O,fixedWeekNumber:M,autoFocus:H,timezone:P}=t,$=mC(P),D=oOe(t),z=xS(),B=NX({shouldDisableDate:j,shouldDisableMonth:E,shouldDisableYear:C,minDate:w,maxDate:S,disablePast:b,disableFuture:y,timezone:P}),L=$X(),[I,q]=Ag({name:"DayCalendar",state:"hasFocus",controlled:k,default:H??!1}),[ee,W]=m.useState(()=>l||$),oe=Sr(ge=>{p||u(ge)}),ne=ge=>{B(ge)||(r(ge),W(ge),_==null||_(!0),q(!0))},ce=Sr((ge,ze)=>{switch(ge.key){case"ArrowUp":ne(n.addDays(ze,-7)),ge.preventDefault();break;case"ArrowDown":ne(n.addDays(ze,7)),ge.preventDefault();break;case"ArrowLeft":{const Se=n.addDays(ze,z?1:-1),Ve=n.addMonths(ze,z?1:-1),Ne=i1({utils:n,date:Se,minDate:z?Se:n.startOfMonth(Ve),maxDate:z?n.endOfMonth(Ve):Se,isDateDisabled:B,timezone:P});ne(Ne||Se),ge.preventDefault();break}case"ArrowRight":{const Se=n.addDays(ze,z?-1:1),Ve=n.addMonths(ze,z?-1:1),Ne=i1({utils:n,date:Se,minDate:z?n.startOfMonth(Ve):Se,maxDate:z?Se:n.endOfMonth(Ve),isDateDisabled:B,timezone:P});ne(Ne||Se),ge.preventDefault();break}case"Home":ne(n.startOfWeek(ze)),ge.preventDefault();break;case"End":ne(n.endOfWeek(ze)),ge.preventDefault();break;case"PageUp":ne(n.addMonths(ze,1)),ge.preventDefault();break;case"PageDown":ne(n.addMonths(ze,-1)),ge.preventDefault();break}}),xe=Sr((ge,ze)=>ne(ze)),re=Sr((ge,ze)=>{I&&n.isSameDay(ee,ze)&&(_==null||_(!1))}),ve=n.getMonth(i),he=n.getYear(i),ye=m.useMemo(()=>a.filter(ge=>!!ge).map(ge=>n.startOfDay(ge)),[n,a]),Pe=`${he}-${ve}`,Ee=m.useMemo(()=>m.createRef(),[Pe]),Re=m.useMemo(()=>{const ge=n.startOfMonth(i),ze=n.endOfMonth(i);return B(ee)||n.isAfterDay(ee,ze)||n.isBeforeDay(ee,ge)?i1({utils:n,date:ee,minDate:ge,maxDate:ze,disablePast:b,disableFuture:y,isDateDisabled:B,timezone:P}):ee},[i,y,b,ee,B,n,P]),_e=m.useMemo(()=>{const ge=n.getWeekArray(i);let ze=n.addMonths(i,1);for(;M&&ge.length<M;){const Se=n.getWeekArray(ze),Ve=n.isSameDay(ge[ge.length-1][0],Se[0][0]);Se.slice(Ve?1:0).forEach(Ne=>{ge.length<M&&ge.push(Ne)}),ze=n.addMonths(ze,1)}return ge},[i,M,n]);return s.jsxs(iOe,{role:"grid","aria-labelledby":A,className:D.root,children:[s.jsxs(sOe,{role:"row",className:D.header,children:[O&&s.jsx(lOe,{variant:"caption",role:"columnheader","aria-label":L.calendarWeekNumberHeaderLabel,className:D.weekNumberLabel,children:L.calendarWeekNumberHeaderText}),O6e(n,$).map((ge,ze)=>s.jsx(aOe,{variant:"caption",role:"columnheader","aria-label":n.format(ge,"weekday"),className:D.weekDayLabel,children:T(ge)},ze.toString()))]}),c?s.jsx(uOe,{className:D.loadingContainer,children:h()}):s.jsx(dOe,on({transKey:Pe,onExited:d,reduceAnimations:f,slideDirection:g,className:Ae(o,D.slideTransition)},v,{nodeRef:Ee,children:s.jsx(pOe,{ref:Ee,role:"rowgroup",className:D.monthContainer,children:_e.map((ge,ze)=>s.jsxs(fOe,{role:"row",className:D.weekContainer,"aria-rowindex":ze+1,children:[O&&s.jsx(cOe,{className:D.weekNumber,role:"rowheader","aria-label":L.calendarWeekNumberAriaLabelText(n.getWeekNumber(ge[0])),children:L.calendarWeekNumberText(n.getWeekNumber(ge[0]))}),ge.map((Se,Ve)=>s.jsx(hOe,{parentProps:t,day:Se,selectedDays:ye,focusableDay:Re,onKeyDown:ce,onFocus:xe,onBlur:re,onDaySelect:oe,isDateDisabled:B,currentMonthNumber:ve,isViewFocused:I,"aria-colindex":Ve+1},Se.toString()))]},`week-${ge[0]}`))})}))]})}function mOe(e){return il("MuiPickersMonth",e)}const kx=Ml("MuiPickersMonth",["root","monthButton","disabled","selected"]),vOe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],yOe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ol({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},mOe,r)},xOe=x("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%"}}]}),bOe=x("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${kx.disabled}`]:t.disabled},{[`&.${kx.selected}`]:t.selected}]})(({theme:e})=>on({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})`:Dt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Dt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${kx.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${kx.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),wOe=m.memo(function(t){const n=ct({props:t,name:"MuiPickersMonth"}),{autoFocus:r,className:o,children:i,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":g,"aria-label":v,slots:b,slotProps:y}=n,w=Di(n,vOe),S=m.useRef(null),j=yOe(n);hC(()=>{var T;r&&((T=S.current)==null||T.focus())},[r]);const E=(b==null?void 0:b.monthButton)??bOe,C=vc({elementType:E,externalSlotProps:y==null?void 0:y.monthButton,additionalProps:{children:i,disabled:a,tabIndex:u,ref:S,type:"button",role:"radio","aria-current":g,"aria-checked":l,"aria-label":v,onClick:T=>d(T,c),onKeyDown:T=>p(T,c),onFocus:T=>f(T,c),onBlur:T=>h(T,c)},ownerState:n,className:j.monthButton});return s.jsx(xOe,on({className:Ae(j.root,o),ownerState:n},w,{children:s.jsx(E,on({},C))}))});function SOe(e){return il("MuiMonthCalendar",e)}Ml("MuiMonthCalendar",["root"]);const COe=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],jOe=e=>{const{classes:t}=e;return Ol({root:["root"]},SOe,t)};function EOe(e,t){const n=ss(),r=PA(),o=ct({props:e,name:t});return on({disableFuture:!1,disablePast:!1},o,{minDate:Zd(n,o.minDate,r.minDate),maxDate:Zd(n,o.maxDate,r.maxDate)})}const TOe=x("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:AA,boxSizing:"border-box"}),kOe=m.forwardRef(function(t,n){const r=EOe(t,"MuiMonthCalendar"),{className:o,value:i,defaultValue:a,referenceDate:l,disabled:c,disableFuture:u,disablePast:d,maxDate:p,minDate:f,onChange:h,shouldDisableMonth:g,readOnly:v,autoFocus:b=!1,onMonthFocus:y,hasFocus:w,onFocusedViewChange:S,monthsPerRow:j=3,timezone:E,gridLabelId:C,slots:T,slotProps:k}=r,_=Di(r,COe),{value:A,handleValueChange:O,timezone:M}=IA({name:"MonthCalendar",timezone:E,value:i,defaultValue:a,referenceDate:l,onChange:h,valueManager:Bf}),H=mC(M),P=xS(),$=ss(),D=m.useMemo(()=>Bf.getInitialReferenceValue({value:A,utils:$,props:r,timezone:M,referenceDate:l,granularity:lu.month}),[]),z=r,B=jOe(z),L=m.useMemo(()=>$.getMonth(H),[$,H]),I=m.useMemo(()=>A!=null?$.getMonth(A):null,[A,$]),[q,ee]=m.useState(()=>I||$.getMonth(D)),[W,oe]=Ag({name:"MonthCalendar",state:"hasFocus",controlled:w,default:b??!1}),ne=Sr(Pe=>{oe(Pe),S&&S(Pe)}),ce=m.useCallback(Pe=>{const Ee=$.startOfMonth(d&&$.isAfter(H,f)?H:f),Re=$.startOfMonth(u&&$.isBefore(H,p)?H:p),_e=$.startOfMonth(Pe);return $.isBefore(_e,Ee)||$.isAfter(_e,Re)?!0:g?g(_e):!1},[u,d,p,f,H,g,$]),xe=Sr((Pe,Ee)=>{if(v)return;const Re=$.setMonth(A??D,Ee);O(Re)}),re=Sr(Pe=>{ce($.setMonth(A??D,Pe))||(ee(Pe),ne(!0),y&&y(Pe))});m.useEffect(()=>{ee(Pe=>I!==null&&Pe!==I?I:Pe)},[I]);const ve=Sr((Pe,Ee)=>{switch(Pe.key){case"ArrowUp":re((12+Ee-3)%12),Pe.preventDefault();break;case"ArrowDown":re((12+Ee+3)%12),Pe.preventDefault();break;case"ArrowLeft":re((12+Ee+(P?1:-1))%12),Pe.preventDefault();break;case"ArrowRight":re((12+Ee+(P?-1:1))%12),Pe.preventDefault();break}}),he=Sr((Pe,Ee)=>{re(Ee)}),ye=Sr((Pe,Ee)=>{q===Ee&&ne(!1)});return s.jsx(TOe,on({ref:n,className:Ae(B.root,o),ownerState:z,role:"radiogroup","aria-labelledby":C},_,{children:$6e($,A??D).map(Pe=>{const Ee=$.getMonth(Pe),Re=$.format(Pe,"monthShort"),_e=$.format(Pe,"month"),ge=Ee===I,ze=c||ce(Pe);return s.jsx(wOe,{selected:ge,value:Ee,onClick:xe,onKeyDown:ve,autoFocus:W&&Ee===q,disabled:ze,tabIndex:Ee===q&&!ze?0:-1,onFocus:he,onBlur:ye,"aria-current":L===Ee?"date":void 0,"aria-label":_e,monthsPerRow:j,slots:T,slotProps:k,children:Re},Re)})}))});function _Oe(e){return il("MuiPickersYear",e)}const _x=Ml("MuiPickersYear",["root","yearButton","selected","disabled"]),ROe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],POe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ol({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},_Oe,r)},AOe=x("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%"}}]}),IOe=x("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${_x.disabled}`]:t.disabled},{[`&.${_x.selected}`]:t.selected}]})(({theme:e})=>on({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})`:Dt(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Dt(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}}})),$Oe=m.memo(function(t){const n=ct({props:t,name:"MuiPickersYear"}),{autoFocus:r,className:o,children:i,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":g,slots:v,slotProps:b}=n,y=Di(n,ROe),w=m.useRef(null),S=POe(n);hC(()=>{var C;r&&((C=w.current)==null||C.focus())},[r]);const j=(v==null?void 0:v.yearButton)??IOe,E=vc({elementType:j,externalSlotProps:b==null?void 0:b.yearButton,additionalProps:{children:i,disabled:a,tabIndex:u,ref:w,type:"button",role:"radio","aria-current":g,"aria-checked":l,onClick:C=>d(C,c),onKeyDown:C=>p(C,c),onFocus:C=>f(C,c),onBlur:C=>h(C,c)},ownerState:n,className:S.yearButton});return s.jsx(AOe,on({className:Ae(S.root,o),ownerState:n},y,{children:s.jsx(j,on({},E))}))});function OOe(e){return il("MuiYearCalendar",e)}Ml("MuiYearCalendar",["root"]);const MOe=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],DOe=e=>{const{classes:t}=e;return Ol({root:["root"]},OOe,t)};function LOe(e,t){const n=ss(),r=PA(),o=ct({props:e,name:t});return on({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:Zd(n,o.minDate,r.minDate),maxDate:Zd(n,o.maxDate,r.maxDate)})}const FOe=x("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:AA,maxHeight:R6e,boxSizing:"border-box",position:"relative"}),NOe=m.forwardRef(function(t,n){const r=LOe(t,"MuiYearCalendar"),{autoFocus:o,className:i,value:a,defaultValue:l,referenceDate:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onChange:g,readOnly:v,shouldDisableYear:b,onYearFocus:y,hasFocus:w,onFocusedViewChange:S,yearsOrder:j="asc",yearsPerRow:E,timezone:C,gridLabelId:T,slots:k,slotProps:_}=r,A=Di(r,MOe),{value:O,handleValueChange:M,timezone:H}=IA({name:"YearCalendar",timezone:C,value:a,defaultValue:l,referenceDate:c,onChange:g,valueManager:Bf}),P=mC(H),$=xS(),D=ss(),z=m.useMemo(()=>Bf.getInitialReferenceValue({value:O,utils:D,props:r,timezone:H,referenceDate:c,granularity:lu.year}),[]),B=r,L=DOe(B),I=m.useMemo(()=>D.getYear(P),[D,P]),q=m.useMemo(()=>O!=null?D.getYear(O):null,[O,D]),[ee,W]=m.useState(()=>q||D.getYear(z)),[oe,ne]=Ag({name:"YearCalendar",state:"hasFocus",controlled:w,default:o??!1}),ce=Sr(Se=>{ne(Se),S&&S(Se)}),xe=m.useCallback(Se=>{if(p&&D.isBeforeYear(Se,P)||d&&D.isAfterYear(Se,P)||h&&D.isBeforeYear(Se,h)||f&&D.isAfterYear(Se,f))return!0;if(!b)return!1;const Ve=D.startOfYear(Se);return b(Ve)},[d,p,f,h,P,b,D]),re=Sr((Se,Ve)=>{if(v)return;const Ne=D.setYear(O??z,Ve);M(Ne)}),ve=Sr(Se=>{xe(D.setYear(O??z,Se))||(W(Se),ce(!0),y==null||y(Se))});m.useEffect(()=>{W(Se=>q!==null&&Se!==q?q:Se)},[q]);const he=j!=="desc"?E*1:E*-1,ye=$&&j==="asc"||!$&&j==="desc"?-1:1,Pe=Sr((Se,Ve)=>{switch(Se.key){case"ArrowUp":ve(Ve-he),Se.preventDefault();break;case"ArrowDown":ve(Ve+he),Se.preventDefault();break;case"ArrowLeft":ve(Ve-ye),Se.preventDefault();break;case"ArrowRight":ve(Ve+ye),Se.preventDefault();break}}),Ee=Sr((Se,Ve)=>{ve(Ve)}),Re=Sr((Se,Ve)=>{ee===Ve&&ce(!1)}),_e=m.useRef(null),ge=RA(n,_e);m.useEffect(()=>{if(o||_e.current===null)return;const Se=_e.current.querySelector('[tabindex="0"]');if(!Se)return;const Ve=Se.offsetHeight,Ne=Se.offsetTop,Xe=_e.current.clientHeight,yt=_e.current.scrollTop,wt=Ne+Ve;Ve>Xe||Ne<yt||(_e.current.scrollTop=wt-Xe/2-Ve/2)},[o]);const ze=D.getYearRange([h,f]);return j==="desc"&&ze.reverse(),s.jsx(FOe,on({ref:ge,className:Ae(L.root,i),ownerState:B,role:"radiogroup","aria-labelledby":T},A,{children:ze.map(Se=>{const Ve=D.getYear(Se),Ne=Ve===q,Xe=u||xe(Se);return s.jsx($Oe,{selected:Ne,value:Ve,onClick:re,onKeyDown:Pe,autoFocus:oe&&Ve===ee,disabled:Xe,tabIndex:Ve===ee&&!Xe?0:-1,onFocus:Ee,onBlur:Re,"aria-current":I===Ve?"date":void 0,yearsPerRow:E,slots:k,slotProps:_,children:D.format(Se,"year")},D.format(Se,"year"))})}))}),BOe=e=>il("MuiPickersCalendarHeader",e),zOe=Ml("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),HOe=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],WOe=["ownerState"],VOe=e=>{const{classes:t}=e;return Ol({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},BOe,t)},UOe=x("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}),GOe=x("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>on({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),qOe=x("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),YOe=x($t,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${zOe.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),KOe=x(h6e,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),XOe=m.forwardRef(function(t,n){const r=$X(),o=ss(),i=ct({props:t,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:l,currentMonth:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onMonthChange:g,onViewChange:v,view:b,reduceAnimations:y,views:w,labelId:S,className:j,timezone:E,format:C=`${o.formats.month} ${o.formats.year}`}=i,T=Di(i,HOe),k=i,_=VOe(i),A=(a==null?void 0:a.switchViewButton)??YOe,O=vc({elementType:A,externalSlotProps:l==null?void 0:l.switchViewButton,additionalProps:{size:"small","aria-label":r.calendarViewSwitchingButtonAriaLabel(b)},ownerState:k,className:_.switchViewButton}),M=(a==null?void 0:a.switchViewIcon)??KOe,H=vc({elementType:M,externalSlotProps:l==null?void 0:l.switchViewIcon,ownerState:k,className:_.switchViewIcon}),P=Di(H,WOe),$=()=>g(o.addMonths(c,1),"left"),D=()=>g(o.addMonths(c,-1),"right"),z=k6e(c,{disableFuture:d,maxDate:f,timezone:E}),B=_6e(c,{disablePast:p,minDate:h,timezone:E}),L=()=>{if(!(w.length===1||!v||u))if(w.length===2)v(w.find(q=>q!==b)||w[0]);else{const q=w.indexOf(b)!==0?0:1;v(w[q])}};if(w.length===1&&w[0]==="year")return null;const I=o.formatByString(c,C);return s.jsxs(UOe,on({},T,{ownerState:k,className:Ae(_.root,j),ref:n,children:[s.jsxs(GOe,{role:"presentation",onClick:L,ownerState:k,"aria-live":"polite",className:_.labelContainer,children:[s.jsx(BX,{reduceAnimations:y,transKey:I,children:s.jsx(qOe,{id:S,ownerState:k,className:_.label,children:I})}),w.length>1&&!u&&s.jsx(A,on({},O,{children:s.jsx(M,on({},P))}))]}),s.jsx(z0,{in:b==="day",appear:!y,enter:!y,children:s.jsx(j6e,{slots:a,slotProps:l,onGoToPrevious:D,isPreviousDisabled:B,previousLabel:r.previousMonth,onGoToNext:$,isNextDisabled:z,nextLabel:r.nextMonth})})]}))}),JOe="@media (prefers-reduced-motion: reduce)",sg=typeof navigator<"u"&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),mD=sg&&sg[1]?parseInt(sg[1],10):null,vD=sg&&sg[2]?parseInt(sg[2],10):null,QOe=mD&&mD<10||vD&&vD<13||!1,ZOe=()=>Xn(JOe,{defaultMatches:!1})||QOe,e8e=e=>il("MuiDateCalendar",e);Ml("MuiDateCalendar",["root","viewTransitionContainer"]);const t8e=["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"],n8e=e=>{const{classes:t}=e;return Ol({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},e8e,t)};function r8e(e,t){const n=ss(),r=PA(),o=ZOe(),i=ct({props:e,name:t});return on({},i,{loading:i.loading??!1,disablePast:i.disablePast??!1,disableFuture:i.disableFuture??!1,openTo:i.openTo??"day",views:i.views??["year","day"],reduceAnimations:i.reduceAnimations??o,renderLoading:i.renderLoading??(()=>s.jsx("span",{children:"..."})),minDate:Zd(n,i.minDate,r.minDate),maxDate:Zd(n,i.maxDate,r.maxDate)})}const o8e=x(P6e,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:OX}),i8e=x(BX,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),s8e=m.forwardRef(function(t,n){const r=ss(),o=t6e(),i=r8e(t,"MuiDateCalendar"),{autoFocus:a,onViewChange:l,value:c,defaultValue:u,referenceDate:d,disableFuture:p,disablePast:f,onChange:h,onYearChange:g,onMonthChange:v,reduceAnimations:b,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:S,view:j,views:E,openTo:C,className:T,disabled:k,readOnly:_,minDate:A,maxDate:O,disableHighlightToday:M,focusedView:H,onFocusedViewChange:P,showDaysOutsideCurrentMonth:$,fixedWeekNumber:D,dayOfWeekFormatter:z,slots:B,slotProps:L,loading:I,renderLoading:q,displayWeekNumber:ee,yearsOrder:W,yearsPerRow:oe,monthsPerRow:ne,timezone:ce}=i,xe=Di(i,t8e),{value:re,handleValueChange:ve,timezone:he}=IA({name:"DateCalendar",timezone:ce,value:c,defaultValue:u,referenceDate:d,onChange:h,valueManager:Bf}),{view:ye,setView:Pe,focusedView:Ee,setFocusedView:Re,goToNextView:_e,setValueAndGoToNextView:ge}=T6e({view:j,views:E,openTo:C,onChange:ve,onViewChange:l,autoFocus:a,focusedView:H,onFocusedViewChange:P}),{referenceDate:ze,calendarState:Se,changeFocusedDay:Ve,changeMonth:Ne,handleChangeMonth:Xe,isDateDisabled:yt,onMonthSwitchingAnimationEnd:wt}=G6e({value:re,referenceDate:d,reduceAnimations:b,onMonthChange:v,minDate:A,maxDate:O,shouldDisableDate:y,disablePast:f,disableFuture:p,timezone:he}),st=k&&re||A,Ce=k&&re||O,Be=`${o}-grid-label`,ue=Ee!==null,fe=(B==null?void 0:B.calendarHeader)??XOe,me=vc({elementType:fe,externalSlotProps:L==null?void 0:L.calendarHeader,additionalProps:{views:E,view:ye,currentMonth:Se.currentMonth,onViewChange:Pe,onMonthChange:(at,Qt)=>Xe({newMonth:at,direction:Qt}),minDate:st,maxDate:Ce,disabled:k,disablePast:f,disableFuture:p,reduceAnimations:b,timezone:he,labelId:Be},ownerState:i}),Ye=Sr(at=>{const Qt=r.startOfMonth(at),fn=r.endOfMonth(at),hn=yt(at)?i1({utils:r,date:at,minDate:r.isBefore(A,Qt)?Qt:A,maxDate:r.isAfter(O,fn)?fn:O,disablePast:f,disableFuture:p,isDateDisabled:yt,timezone:he}):at;hn?(ge(hn,"finish"),v==null||v(Qt)):(_e(),Ne(Qt)),Ve(hn,!0)}),nt=Sr(at=>{const Qt=r.startOfYear(at),fn=r.endOfYear(at),hn=yt(at)?i1({utils:r,date:at,minDate:r.isBefore(A,Qt)?Qt:A,maxDate:r.isAfter(O,fn)?fn:O,disablePast:f,disableFuture:p,isDateDisabled:yt,timezone:he}):at;hn?(ge(hn,"finish"),g==null||g(hn)):(_e(),Ne(Qt)),Ve(hn,!0)}),jt=Sr(at=>ve(at&&H2(r,at,re??ze),"finish",ye));m.useEffect(()=>{re!=null&&r.isValid(re)&&Ne(re)},[re]);const We=i,ut=n8e(We),Fe={disablePast:f,disableFuture:p,maxDate:O,minDate:A},Ke={disableHighlightToday:M,readOnly:_,disabled:k,timezone:he,gridLabelId:Be,slots:B,slotProps:L},lt=m.useRef(ye);m.useEffect(()=>{lt.current!==ye&&(Ee===lt.current&&Re(ye,!0),lt.current=ye)},[Ee,Re,ye]);const Vt=m.useMemo(()=>[re],[re]);return s.jsxs(o8e,on({ref:n,className:Ae(ut.root,T),ownerState:We},xe,{children:[s.jsx(fe,on({},me,{slots:B,slotProps:L})),s.jsx(i8e,{reduceAnimations:b,className:ut.viewTransitionContainer,transKey:ye,ownerState:We,children:s.jsxs("div",{children:[ye==="year"&&s.jsx(NOe,on({},Fe,Ke,{value:re,onChange:nt,shouldDisableYear:S,hasFocus:ue,onFocusedViewChange:at=>Re("year",at),yearsOrder:W,yearsPerRow:oe,referenceDate:ze})),ye==="month"&&s.jsx(kOe,on({},Fe,Ke,{hasFocus:ue,className:T,value:re,onChange:Ye,shouldDisableMonth:w,onFocusedViewChange:at=>Re("month",at),monthsPerRow:ne,referenceDate:ze})),ye==="day"&&s.jsx(gOe,on({},Se,Fe,Ke,{onMonthSwitchingAnimationEnd:wt,onFocusedDayChange:Ve,reduceAnimations:b,selectedDays:Vt,onSelectedDaysChange:jt,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:S,hasFocus:ue,onFocusedViewChange:at=>Re("day",at),showDaysOutsideCurrentMonth:$,fixedWeekNumber:D,dayOfWeekFormatter:z,displayWeekNumber:ee,loading:I,renderLoading:q}))]})})]}))});var gT={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(c,u){switch(c){case"P":return u.date({width:"short"});case"PP":return u.date({width:"medium"});case"PPP":return u.date({width:"long"});case"PPPP":default:return u.date({width:"full"})}},r=function(c,u){switch(c){case"p":return u.time({width:"short"});case"pp":return u.time({width:"medium"});case"ppp":return u.time({width:"long"});case"pppp":default:return u.time({width:"full"})}},o=function(c,u){var d=c.match(/(P+)(p+)?/)||[],p=d[1],f=d[2];if(!f)return n(c,u);var h;switch(p){case"P":h=u.dateTime({width:"short"});break;case"PP":h=u.dateTime({width:"medium"});break;case"PPP":h=u.dateTime({width:"long"});break;case"PPPP":default:h=u.dateTime({width:"full"});break}return h.replace("{{date}}",n(p,u)).replace("{{time}}",r(f,u))},i={p:r,P:o},a=i;t.default=a,e.exports=t.default})(gT,gT.exports);var a8e=gT.exports;const l8e=Vo(a8e),c8e={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"},u8e={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 d8e{constructor(t){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=c8e,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:i}=t;this.locale=n,this.formats=on({},u8e,r),this.longFormatters=o,this.lib=i||"date-fns"}}class p8e extends d8e{constructor({locale:t,formats:n}={}){super({locale:t??Qf,formats:n,longFormatters:l8e}),this.parse=(r,o)=>r===""?null:uK(r,o,new Date,{locale:this.locale}),this.isValid=r=>r==null?!1:Z0(r),this.format=(r,o)=>this.formatByString(r,this.formats[o]),this.formatByString=(r,o)=>si(r,o,{locale:this.locale}),this.isEqual=(r,o)=>r===null&&o===null?!0:r===null||o===null?!1:YTe(r,o),this.isSameYear=(r,o)=>Kke(r,o),this.isSameMonth=(r,o)=>qke(r,o),this.isSameDay=(r,o)=>R4e(r,o),this.isSameHour=(r,o)=>Gke(r,o),this.isAfter=(r,o)=>r1(r,o),this.isAfterYear=(r,o)=>r1(r,t0(o)),this.isAfterDay=(r,o)=>r1(r,E2(o)),this.isBefore=(r,o)=>kb(r,o),this.isBeforeYear=(r,o)=>kb(r,this.startOfYear(o)),this.isBeforeDay=(r,o)=>kb(r,this.startOfDay(o)),this.isWithinRange=(r,[o,i])=>Xke(r,{start:o,end:i}),this.startOfYear=r=>k2(r),this.startOfMonth=r=>T2(r),this.startOfWeek=r=>Df(r,{locale:this.locale}),this.startOfDay=r=>Yd(r),this.endOfYear=r=>t0(r),this.endOfMonth=r=>e0(r),this.endOfWeek=r=>qY(r,{locale:this.locale}),this.endOfDay=r=>E2(r),this.addYears=(r,o)=>VP(r,o),this.addMonths=(r,o)=>sm(r,o),this.addWeeks=(r,o)=>VY(r,o),this.addDays=(r,o)=>J0(r,o),this.addHours=(r,o)=>BY(r,o),this.addMinutes=(r,o)=>zY(r,o),this.addSeconds=(r,o)=>WY(r,o),this.getYear=r=>qTe(r),this.getMonth=r=>zTe(r),this.getDate=r=>LTe(r),this.getHours=r=>FTe(r),this.getMinutes=r=>BTe(r),this.getSeconds=r=>HTe(r),this.getMilliseconds=r=>NTe(r),this.setYear=(r,o)=>x_e(r,o),this.setMonth=(r,o)=>f_e(r,o),this.setDate=(r,o)=>h_e(r,o),this.setHours=(r,o)=>g_e(r,o),this.setMinutes=(r,o)=>v_e(r,o),this.setSeconds=(r,o)=>y_e(r,o),this.setMilliseconds=(r,o)=>m_e(r,o),this.getDaysInMonth=r=>oK(r),this.getWeekArray=r=>{const o=this.startOfWeek(this.startOfMonth(r)),i=this.endOfWeek(this.endOfMonth(r));let a=0,l=o;const c=[];for(;this.isBefore(l,i);){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=>GTe(r,{locale:this.locale}),this.getYearRange=([r,o])=>{const i=this.startOfYear(r),a=this.endOfYear(o),l=[];let c=i;for(;this.isBefore(c,a);)l.push(c),c=this.addYears(c,1);return l}}}const f8e=(e,t=new Date)=>{let n,r;switch(e){case"thisMonth":{n=T2(t),r=e0(t);break}case"thisQuarter":{n=Q4(t),r=Z4(t);break}case"previousQuarter":{const o=w_e(t,1);n=Q4(o),r=Z4(o);break}case"thisYear":{n=k2(t),r=t0(t);break}case"previousYear":{const o=fK(t,1);n=k2(o),r=t0(o);break}default:{const o=tC(t,1);n=T2(o),r=e0(o)}}return[si(n,"yyyy-MM-dd"),si(r,"yyyy-MM-dd")]},h8e=x(Z)(({theme:e})=>({paddingLeft:e.spacing(2),paddingBottom:e.spacing(1)})),g8e=({onRangeChange:e})=>{const t=n=>()=>{const[r,o]=f8e(n);e({from:{operator:"IS",values:[r]},to:{operator:"IS",values:[o]}})};return s.jsxs(J,{children:[s.jsx(h8e,{variant:"h3",children:"Presets"}),s.jsxs(Ni,{disablePadding:!0,sx:{pb:2},children:[s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("thisMonth"),children:"This month"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("previousMonth"),children:"Previous month"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("thisQuarter"),children:"This quarter"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("previousQuarter"),children:"Previous quarter"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("thisYear"),children:"This year"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("previousYear"),children:"Previous year"})})]})]})},m8e=({name:e,label:t,onChange:n,onRangeChange:r,onChipClose:o,state:i,operators:a,initMode:l="auto-open"})=>{const c=m.useRef(null),[u,d]=m.useState(null),{locationSettings:p}=wo(),f=()=>{d(c.current)};m.useEffect(()=>{!i&&l==="auto-open"&&f()},[]);const h=()=>{d(null)},g=i?[eA(i.values[0],p.locale)||""]:[],v=i?new Date(i.values[0]):null,b=i?i.operator:a[0],y=o?()=>{n({operator:a[0],values:[]}),h(),o()}:void 0;return m.useEffect(()=>{i&&!a.includes(i.operator)&&n({operator:a[0],values:i.values})},[i]),s.jsxs(s.Fragment,{children:[s.jsx(J,{ref:c,children:s.jsx(AX,{label:t,name:e,selectedDisplayOptions:g,onDelete:y,onClick:f,operator:b,operatorOptions:a,onChangeOperator:w=>{const S=v?si(v,"yyyy-MM-dd"):"";n({operator:w,values:[S]})}})}),s.jsx(RX,{open:!!u,anchorEl:u,onClose:h,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:s.jsxs(d6e,{dateAdapter:p8e,children:[s.jsx(s8e,{displayWeekNumber:!0,value:v,onChange:w=>{const S=w?si(w,"yyyy-MM-dd"):"";n({operator:b,values:[S]})}}),r&&s.jsx(g8e,{onRangeChange:r})]})})]})},v8e=({options:e,handleToggle:t})=>{const n=m.useRef([]);return{listRefs:n,handleSelection:(o,i)=>{var a,l,c;if(o.key==="ArrowDown"&&i<n.current.length-1)o.preventDefault(),(a=n.current[i+1])==null||a.focus();else if(o.key==="ArrowUp"&&i>0)o.preventDefault(),(l=n.current[i-1])==null||l.focus();else if(o.key==="Enter"&&i===0&&((c=n.current[0])!=null&&c.value)&&e.length>0)t(e[0].value)();else if((o.key==="Enter"||i!==0&&o.key===" ")&&(o.preventDefault(),i>0)){const u=i-1;t(e[u].value)()}}}},y8e=({name:e,label:t,options:n,onChange:r,onChipClose:o,state:i,singularOperators:a,pluralOperators:l,initMode:c="auto-open"})=>{const u=m.useRef(null),[d,p]=m.useState(),[f,h]=m.useState(""),g=i&&i.values.length>1?l:a,v=()=>{p(u.current)};m.useEffect(()=>{!i&&c==="auto-open"&&v()},[]);const b=()=>{p(null)},y=i?i.values:[],w=y.map(_=>{var A;return(A=n.find(O=>O.value===_))==null?void 0:A.label}).filter(_=>_!==void 0),S=i?i.operator:g[0],j=o?()=>{r({operator:a[0],values:[]}),b(),o()}:void 0,E=n.filter(_=>_.label.toLowerCase().includes(f.toLowerCase())),C=_=>()=>{if(y!=null&&y.some(A=>A===_)){const A=y==null?void 0:y.filter(O=>O!==_);r({operator:S,values:A})}else{const A=[...y??[],(n.find(O=>O.value===_)??{label:"",value:""}).value];r({operator:S,values:A})}},{listRefs:T,handleSelection:k}=v8e({options:E,handleToggle:C});return m.useEffect(()=>{i&&!g.includes(i.operator)&&r({operator:g[0],values:i.values})},[i]),s.jsxs(s.Fragment,{children:[s.jsx(J,{ref:u,children:s.jsx(AX,{name:e,label:t,selectedDisplayOptions:w,onDelete:j,onClick:v,operator:S,operatorOptions:g,onChangeOperator:_=>{r({operator:_,values:y??[]})}})}),s.jsx(RX,{open:!!d,anchorEl:d,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:s.jsxs(D$e,{children:[s.jsx(N$e,{variant:"outlined",size:"small",value:f,onChange:_=>h(_.target.value),placeholder:"Search",autoFocus:!0,InputProps:{startAdornment:s.jsx(fp,{position:"start",children:s.jsx(Zf,{fontSize:"small"})})},inputRef:_=>{T.current[0]=_},onKeyDown:_=>k(_,0)}),s.jsx(Ni,{sx:{overflowY:"auto"},disablePadding:!0,children:E.map((_,A)=>{const O=`checkbox-list-label-${_.value}`;return s.jsxs(L$e,{dense:!0,disablePadding:!0,tabIndex:0,onClick:C(_.value),ref:M=>{T.current[A+1]=M},onKeyDown:M=>k(M,A+1),children:[s.jsx(F$e,{edge:"start",checked:(y==null?void 0:y.some(M=>M===_.value))??!1,tabIndex:-1,inputProps:{"aria-labelledby":O},size:"small",disableRipple:!0}),s.jsx(dn,{id:O,primary:_.label})]},_.value)})})]})})]})},HX=x(J)(({theme:e})=>({display:"flex",padding:e.spacing(1.5,3),gap:e.spacing(1),flexWrap:"wrap"})),x8e=x("div")(({theme:e})=>({marginRight:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.spacing(2)})),b8e=x(Ka)(({theme:e})=>({"&.material-symbols-outlined":{fontSize:e.spacing(2)}})),WX=({filter:e,onChipClose:t,onChange:n,state:r,rangeChangeHandler:o,initMode:i})=>{const a=s.jsxs(s.Fragment,{children:[s.jsx(x8e,{children:s.jsx(b8e,{children:e.icon})}),e.label]});return"dateOperators"in e?s.jsx(m8e,{initMode:i,label:a,name:e.label,state:r,onChange:l=>{n({[e.filterKey]:l})},onRangeChange:o==null?void 0:o(e),operators:e.dateOperators,onChipClose:e.persistent?void 0:()=>t==null?void 0:t(e.label)},e.label):s.jsx(y8e,{initMode:i,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)},w8e=({state:e,onChange:t,className:n,filter:r,rangeChangeHandler:o})=>s.jsx(HX,{className:n,children:s.jsx(WX,{filter:r,state:e[r.filterKey],onChange:t,rangeChangeHandler:o,onChipClose:void 0,initMode:"manual"})}),S8e=(e,t)=>{const n=[...e],r=new Set(e);return t.forEach(o=>{r.has(o)||n.push(o)}),n},C8e=({state:e,onChange:t,availableFilters:n,rangeChangeHandler:r,className:o})=>{const[i,a]=m.useState([]),l=u=>{const d=i.filter(p=>p!==u);a(d)};m.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=S8e(i,u);a(d)},[JSON.stringify(e),JSON.stringify(n)]);const c=m.useMemo(()=>n.filter(u=>!i.includes(u.label)).map(u=>u.label).sort(),[n,i]);return s.jsxs(HX,{className:o,children:[i.map(u=>{const d=n.find(p=>p.label===u);return d?s.jsx(WX,{filter:d,state:e[d.filterKey],onChange:t,rangeChangeHandler:r,onChipClose:()=>l(d.label)},d.filterKey):null}),c.length>0?s.jsx(M$e,{availableFilters:n,visibleOptions:c,hiddenOptions:i,onSelectedOptionsChange:a}):null]})},$A=e=>{const t=n=>{const r=n.fromFilterKey,o=n.toFilterKey;if(r&&o)return i=>{e.onChange({[r]:i.from}),e.onChange({[o]:i.to})}};if(e.availableFilters.length===1){const n=e.availableFilters[0];return s.jsx(w8e,{rangeChangeHandler:t,filter:n,...e})}return s.jsx(C8e,{rangeChangeHandler:t,...e})},Ig=e=>`${e.type}:${e.value}`,j8e=({state:e,onChange:t})=>{const{projects:n}=Xr(),{segments:r}=ma(),{tags:o}=A$e(),i=[{label:"Active",value:"active"},{label:"Stale",value:"stale"}],[a,l]=m.useState([]);return m.useEffect(()=>{const c=(n||[]).map(h=>({label:h.name,value:h.id})),u=(r||[]).map(h=>({label:h.name,value:h.name})),d=(o||[]).map(h=>({label:Ig(h),value:Ig(h)})),p=c.length>1,f=[{label:"State",icon:"hexagon",options:i,filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},...p?[{label:"Project",icon:"topic",options:c,filterKey:"project",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}]:[],{label:"Tags",icon:"label",options:d,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:u,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"]}];l(f)},[JSON.stringify(n),JSON.stringify(r),JSON.stringify(o)]),s.jsx($A,{availableFilters:a,state:e,onChange:t})},E8e=(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"})}},T8e=(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})}},k8e=(e,t)=>n=>{var o;const r=(o=e.columns)==null?void 0:o.reduce((i,a)=>({...i,...a&&{[a]:!0}}),{});if(typeof n=="function"){const i=n(r||{}),a=Object.keys(i).filter(l=>i[l]);t({columns:a})}else{const i=Object.keys(n).filter(a=>n[a]);t({columns:i})}},_8e=e=>({sorting:[{id:e.sortBy,desc:e.sortOrder==="desc"}]}),R8e=e=>({pagination:{pageIndex:e.offset?e.offset/e.limit:0,pageSize:e.limit}}),P8e=e=>{var t;return e.columns?{columnVisibility:(t=e.columns)==null?void 0:t.reduce((n,r)=>({...n,...r&&{[r]:!0}}),{})}:{}},VX=(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])),i=e.columns?{...r,...P8e(e).columnVisibility,...o}:(l=n.state)==null?void 0:l.columnVisibility;return{getCoreRowModel:ERe(),enableSorting:!0,enableMultiSort:!1,manualPagination:!0,manualSorting:!0,enableSortingRemoval:!1,enableHiding:!0,onPaginationChange:T8e(e,t),onSortingChange:E8e(e,t),onColumnVisibilityChange:k8e(e,t),...n,state:{..._8e(e),...R8e(e),...n.state||{},columnVisibility:i}}},A8e=(e,t,n,r=1)=>{[...e.keys()].filter(l=>l.startsWith(n)&&l!==t).slice(r-1).forEach(l=>e.delete(l))},yC=(e,t,n=1)=>{const{cache:r}=Kq();A8e(r,e,t,n)},I8e={features:[],total:0},$8e=10,UX="api/admin/search/features?",O8e=()=>{const e={},t=o=>{e[o]={total:0,initialLoad:!0}},n=(o,i,a)=>{e[o]||t(o),e[o][i]=a},r=o=>(e[o]||t(o),e[o]);return(o,i={},a="")=>{const{KEY:l,fetcher:c}=D8e(o),u=`${a}${l}`,d=o.project||"";yC(u,UX,$8e),m.useEffect(()=>{t(o.project||"")},[]);const{data:p,error:f,mutate:h,isLoading:g}=_n(u,c,i),v=m.useCallback(()=>{h()},[h]),b=r(d);return(p==null?void 0:p.total)!==void 0&&n(d,"total",p.total),!g&&b.initialLoad&&n(d,"initialLoad",!1),{...p||I8e,loading:g,error:f,refetch:v,total:b.total,initialLoad:g&&b.initialLoad}}},M8e=25,D8e=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,i])=>!!i).map(([o,i])=>[o,i.toString()]))).toString(),n=`${UX}${t}`;return{fetcher:()=>{const o=bt(n);return fetch(o,{method:"GET"}).then(Jt("Feature search")).then(i=>i.json())},KEY:n}},xC=O8e(),L8e=e=>e==null?e:e?"true":"false",F8e=e=>e==="true"?!0:e==="false"?!1:null,N8e={encode:L8e,decode:F8e},B8e=e=>e!=null&&e.values.length?`${e.operator}:${e.values.join(",")}`:void 0,z8e=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(",")}},wr={encode:B8e,decode:z8e},yD=(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},H8e=(e,t)=>{const[n,r]=Xf(),{value:o,setValue:i}=Au(e,{});return m.useEffect(()=>{const a=Object.fromEntries(n.entries());Object.keys(a).length>0||Object.keys(o).length!==0&&r(I0(t,o),{replace:!0})},[]),i},nh=(e,t,n=["offset"])=>{const r=H8e(e,t),[o,i]=DU(t,{updateType:"replaceIn"}),[a]=Xf(),l=m.useMemo(()=>yD(o,[...a.keys()]),[a,o,yD]),c=m.useCallback(u=>{if(!t.offset)return i(u);if(typeof u=="function")i(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;i(d)}},[i,t.offset]);return m.useEffect(()=>{const u=Object.fromEntries(Object.entries(l).filter(([d])=>!n.includes(d)));r(u)},[JSON.stringify(l)]),[l,c]};var W2={exports:{}};W2.exports;(function(e,t){var n=200,r="Expected a function",o="__lodash_hash_undefined__",i=1,a=2,l=1/0,c=9007199254740991,u="[object Arguments]",d="[object Array]",p="[object Boolean]",f="[object Date]",h="[object Error]",g="[object Function]",v="[object GeneratorFunction]",b="[object Map]",y="[object Number]",w="[object Object]",S="[object Promise]",j="[object RegExp]",E="[object Set]",C="[object String]",T="[object Symbol]",k="[object WeakMap]",_="[object ArrayBuffer]",A="[object DataView]",O="[object Float32Array]",M="[object Float64Array]",H="[object Int8Array]",P="[object Int16Array]",$="[object Int32Array]",D="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",L="[object Uint32Array]",I=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q=/^\w*$/,ee=/^\./,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oe=/[\\^$.*+?()[\]{}|]/g,ne=/\\(\\)?/g,ce=/^\[object .+?Constructor\]$/,xe=/^(?:0|[1-9]\d*)$/,re={};re[O]=re[M]=re[H]=re[P]=re[$]=re[D]=re[z]=re[B]=re[L]=!0,re[u]=re[d]=re[_]=re[p]=re[A]=re[f]=re[h]=re[g]=re[b]=re[y]=re[w]=re[j]=re[E]=re[C]=re[k]=!1;var ve=typeof Cn=="object"&&Cn&&Cn.Object===Object&&Cn,he=typeof self=="object"&&self&&self.Object===Object&&self,ye=ve||he||Function("return this")(),Pe=t&&!t.nodeType&&t,Ee=Pe&&!0&&e&&!e.nodeType&&e,Re=Ee&&Ee.exports===Pe,_e=Re&&ve.process,ge=function(){try{return _e&&_e.binding("util")}catch{}}(),ze=ge&&ge.isTypedArray;function Se(V,Q){for(var le=-1,pe=V?V.length:0;++le<pe;)if(Q(V[le],le,V))return!0;return!1}function Ve(V){return function(Q){return Q==null?void 0:Q[V]}}function Ne(V,Q){for(var le=-1,pe=Array(V);++le<V;)pe[le]=Q(le);return pe}function Xe(V){return function(Q){return V(Q)}}function yt(V,Q){return V==null?void 0:V[Q]}function wt(V){var Q=!1;if(V!=null&&typeof V.toString!="function")try{Q=!!(V+"")}catch{}return Q}function st(V){var Q=-1,le=Array(V.size);return V.forEach(function(pe,Me){le[++Q]=[Me,pe]}),le}function Ce(V,Q){return function(le){return V(Q(le))}}function Be(V){var Q=-1,le=Array(V.size);return V.forEach(function(pe){le[++Q]=pe}),le}var ue=Array.prototype,fe=Function.prototype,me=Object.prototype,Ye=ye["__core-js_shared__"],nt=function(){var V=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||"");return V?"Symbol(src)_1."+V:""}(),jt=fe.toString,We=me.hasOwnProperty,ut=me.toString,Fe=RegExp("^"+jt.call(We).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ke=ye.Symbol,lt=ye.Uint8Array,Vt=me.propertyIsEnumerable,at=ue.splice,Qt=Ce(Object.keys,Object),fn=zr(ye,"DataView"),hn=zr(ye,"Map"),Mn=zr(ye,"Promise"),Zn=zr(ye,"Set"),Nr=zr(ye,"WeakMap"),Qr=zr(Object,"create"),Mo=ui(fn),so=ui(hn),So=ui(Mn),Wn=ui(Zn),qn=ui(Nr),br=Ke?Ke.prototype:void 0,Do=br?br.valueOf:void 0,Uo=br?br.toString:void 0;function Vn(V){var Q=-1,le=V?V.length:0;for(this.clear();++Q<le;){var pe=V[Q];this.set(pe[0],pe[1])}}function Fn(){this.__data__=Qr?Qr(null):{}}function Ci(V){return this.has(V)&&delete this.__data__[V]}function Zr(V){var Q=this.__data__;if(Qr){var le=Q[V];return le===o?void 0:le}return We.call(Q,V)?Q[V]:void 0}function eo(V){var Q=this.__data__;return Qr?Q[V]!==void 0:We.call(Q,V)}function Go(V,Q){var le=this.__data__;return le[V]=Qr&&Q===void 0?o:Q,this}Vn.prototype.clear=Fn,Vn.prototype.delete=Ci,Vn.prototype.get=Zr,Vn.prototype.has=eo,Vn.prototype.set=Go;function we(V){var Q=-1,le=V?V.length:0;for(this.clear();++Q<le;){var pe=V[Q];this.set(pe[0],pe[1])}}function de(){this.__data__=[]}function et(V){var Q=this.__data__,le=Vl(Q,V);if(le<0)return!1;var pe=Q.length-1;return le==pe?Q.pop():at.call(Q,le,1),!0}function Ct(V){var Q=this.__data__,le=Vl(Q,V);return le<0?void 0:Q[le][1]}function Xt(V){return Vl(this.__data__,V)>-1}function nr(V,Q){var le=this.__data__,pe=Vl(le,V);return pe<0?le.push([V,Q]):le[pe][1]=Q,this}we.prototype.clear=de,we.prototype.delete=et,we.prototype.get=Ct,we.prototype.has=Xt,we.prototype.set=nr;function An(V){var Q=-1,le=V?V.length:0;for(this.clear();++Q<le;){var pe=V[Q];this.set(pe[0],pe[1])}}function Pt(){this.__data__={hash:new Vn,map:new(hn||we),string:new Vn}}function Br(V){return ql(this,V).delete(V)}function jp(V){return ql(this,V).get(V)}function Ep(V){return ql(this,V).has(V)}function Lu(V,Q){return ql(this,V).set(V,Q),this}An.prototype.clear=Pt,An.prototype.delete=Br,An.prototype.get=jp,An.prototype.has=Ep,An.prototype.set=Lu;function ll(V){var Q=-1,le=V?V.length:0;for(this.__data__=new An;++Q<le;)this.add(V[Q])}function Wl(V){return this.__data__.set(V,o),this}function Fu(V){return this.__data__.has(V)}ll.prototype.add=ll.prototype.push=Wl,ll.prototype.has=Fu;function qo(V){this.__data__=new we(V)}function zi(){this.__data__=new we}function Hc(V){return this.__data__.delete(V)}function Tp(V){return this.__data__.get(V)}function kp(V){return this.__data__.has(V)}function _p(V,Q){var le=this.__data__;if(le instanceof we){var pe=le.__data__;if(!hn||pe.length<n-1)return pe.push([V,Q]),this;le=this.__data__=new An(pe)}return le.set(V,Q),this}qo.prototype.clear=zi,qo.prototype.delete=Hc,qo.prototype.get=Tp,qo.prototype.has=kp,qo.prototype.set=_p;function Rp(V,Q){var le=K(V)||N(V)?Ne(V.length,String):[],pe=le.length,Me=!!pe;for(var Oe in V)We.call(V,Oe)&&!(Me&&(Oe=="length"||cl(Oe,pe)))&&le.push(Oe);return le}function Vl(V,Q){for(var le=V.length;le--;)if(Wu(V[le][0],Q))return le;return-1}var Ul=us();function Wc(V,Q){return V&&Ul(V,Q,se)}function xa(V,Q){Q=ds(Q,V)?[Q]:zu(Q);for(var le=0,pe=Q.length;V!=null&&le<pe;)V=V[dl(Q[le++])];return le&&le==pe?V:void 0}function Nu(V){return ut.call(V)}function Bu(V,Q){return V!=null&&Q in Object(V)}function Gl(V,Q,le,pe,Me){return V===Q?!0:V==null||Q==null||!bn(V)&&!R(Q)?V!==V&&Q!==Q:Pp(V,Q,Gl,le,pe,Me)}function Pp(V,Q,le,pe,Me,Oe){var qe=K(V),mt=K(Q),At=d,St=d;qe||(At=Hi(V),At=At==u?w:At),mt||(St=Hi(Q),St=St==u?w:St);var Qe=At==w&&!wt(V),zt=St==w&&!wt(Q),dt=At==St;if(dt&&!Qe)return Oe||(Oe=new qo),qe||G(V)?Uc(V,Q,le,pe,Me,Oe):Mp(V,Q,At,le,pe,Me,Oe);if(!(Me&a)){var Ht=Qe&&We.call(V,"__wrapped__"),nn=zt&&We.call(Q,"__wrapped__");if(Ht||nn){var Wt=Ht?V.value():V,Ut=nn?Q.value():Q;return Oe||(Oe=new qo),le(Wt,Ut,pe,Me,Oe)}}return dt?(Oe||(Oe=new qo),Dp(V,Q,le,pe,Me,Oe)):!1}function Ap(V,Q,le,pe){var Me=le.length,Oe=Me;if(V==null)return!Oe;for(V=Object(V);Me--;){var qe=le[Me];if(qe[2]?qe[1]!==V[qe[0]]:!(qe[0]in V))return!1}for(;++Me<Oe;){qe=le[Me];var mt=qe[0],At=V[mt],St=qe[1];if(qe[2]){if(At===void 0&&!(mt in V))return!1}else{var Qe=new qo,zt;if(!(zt===void 0?Gl(St,At,pe,i|a,Qe):zt))return!1}}return!0}function Ip(V){if(!bn(V)||Yl(V))return!1;var Q=an(V)||wt(V)?Fe:ce;return Q.test(ui(V))}function Vc(V){return R(V)&&Bt(V.length)&&!!re[ut.call(V)]}function $p(V){return typeof V=="function"?V:V==null?Ie:typeof V=="object"?K(V)?ji(V[0],V[1]):ba(V):De(V)}function Op(V){if(!Kl(V))return Qt(V);var Q=[];for(var le in Object(V))We.call(V,le)&&le!="constructor"&&Q.push(le);return Q}function ba(V){var Q=Gc(V);return Q.length==1&&Q[0][2]?Xl(Q[0][0],Q[0][1]):function(le){return le===V||Ap(le,V,Q)}}function ji(V,Q){return ds(V)&&wa(Q)?Xl(dl(V),Q):function(le){var pe=ie(le,V);return pe===void 0&&pe===Q?te(le,V):Gl(Q,pe,void 0,i|a)}}function cs(V){return function(Q){return xa(Q,V)}}function Ds(V){if(typeof V=="string")return V;if(U(V))return Uo?Uo.call(V):"";var Q=V+"";return Q=="0"&&1/V==-l?"-0":Q}function zu(V){return K(V)?V:Wi(V)}function us(V){return function(Q,le,pe){for(var Me=-1,Oe=Object(Q),qe=pe(Q),mt=qe.length;mt--;){var At=qe[++Me];if(le(Oe[At],At,Oe)===!1)break}return Q}}function Uc(V,Q,le,pe,Me,Oe){var qe=Me&a,mt=V.length,At=Q.length;if(mt!=At&&!(qe&&At>mt))return!1;var St=Oe.get(V);if(St&&Oe.get(Q))return St==Q;var Qe=-1,zt=!0,dt=Me&i?new ll:void 0;for(Oe.set(V,Q),Oe.set(Q,V);++Qe<mt;){var Ht=V[Qe],nn=Q[Qe];if(pe)var Wt=qe?pe(nn,Ht,Qe,Q,V,Oe):pe(Ht,nn,Qe,V,Q,Oe);if(Wt!==void 0){if(Wt)continue;zt=!1;break}if(dt){if(!Se(Q,function(Ut,wn){if(!dt.has(wn)&&(Ht===Ut||le(Ht,Ut,pe,Me,Oe)))return dt.add(wn)})){zt=!1;break}}else if(!(Ht===nn||le(Ht,nn,pe,Me,Oe))){zt=!1;break}}return Oe.delete(V),Oe.delete(Q),zt}function Mp(V,Q,le,pe,Me,Oe,qe){switch(le){case A:if(V.byteLength!=Q.byteLength||V.byteOffset!=Q.byteOffset)return!1;V=V.buffer,Q=Q.buffer;case _:return!(V.byteLength!=Q.byteLength||!pe(new lt(V),new lt(Q)));case p:case f:case y:return Wu(+V,+Q);case h:return V.name==Q.name&&V.message==Q.message;case j:case C:return V==Q+"";case b:var mt=st;case E:var At=Oe&a;if(mt||(mt=Be),V.size!=Q.size&&!At)return!1;var St=qe.get(V);if(St)return St==Q;Oe|=i,qe.set(V,Q);var Qe=Uc(mt(V),mt(Q),pe,Me,Oe,qe);return qe.delete(V),Qe;case T:if(Do)return Do.call(V)==Do.call(Q)}return!1}function Dp(V,Q,le,pe,Me,Oe){var qe=Me&a,mt=se(V),At=mt.length,St=se(Q),Qe=St.length;if(At!=Qe&&!qe)return!1;for(var zt=At;zt--;){var dt=mt[zt];if(!(qe?dt in Q:We.call(Q,dt)))return!1}var Ht=Oe.get(V);if(Ht&&Oe.get(Q))return Ht==Q;var nn=!0;Oe.set(V,Q),Oe.set(Q,V);for(var Wt=qe;++zt<At;){dt=mt[zt];var Ut=V[dt],wn=Q[dt];if(pe)var rn=qe?pe(wn,Ut,dt,Q,V,Oe):pe(Ut,wn,dt,V,Q,Oe);if(!(rn===void 0?Ut===wn||le(Ut,wn,pe,Me,Oe):rn)){nn=!1;break}Wt||(Wt=dt=="constructor")}if(nn&&!Wt){var Rn=V.constructor,Sn=Q.constructor;Rn!=Sn&&"constructor"in V&&"constructor"in Q&&!(typeof Rn=="function"&&Rn instanceof Rn&&typeof Sn=="function"&&Sn instanceof Sn)&&(nn=!1)}return Oe.delete(V),Oe.delete(Q),nn}function ql(V,Q){var le=V.__data__;return ul(Q)?le[typeof Q=="string"?"string":"hash"]:le.map}function Gc(V){for(var Q=se(V),le=Q.length;le--;){var pe=Q[le],Me=V[pe];Q[le]=[pe,Me,wa(Me)]}return Q}function zr(V,Q){var le=yt(V,Q);return Ip(le)?le:void 0}var Hi=Nu;(fn&&Hi(new fn(new ArrayBuffer(1)))!=A||hn&&Hi(new hn)!=b||Mn&&Hi(Mn.resolve())!=S||Zn&&Hi(new Zn)!=E||Nr&&Hi(new Nr)!=k)&&(Hi=function(V){var Q=ut.call(V),le=Q==w?V.constructor:void 0,pe=le?ui(le):void 0;if(pe)switch(pe){case Mo:return A;case so:return b;case So:return S;case Wn:return E;case qn:return k}return Q});function Hu(V,Q,le){Q=ds(Q,V)?[Q]:zu(Q);for(var pe,Me=-1,qe=Q.length;++Me<qe;){var Oe=dl(Q[Me]);if(!(pe=V!=null&&le(V,Oe)))break;V=V[Oe]}if(pe)return pe;var qe=V?V.length:0;return!!qe&&Bt(qe)&&cl(Oe,qe)&&(K(V)||N(V))}function cl(V,Q){return Q=Q??c,!!Q&&(typeof V=="number"||xe.test(V))&&V>-1&&V%1==0&&V<Q}function ds(V,Q){if(K(V))return!1;var le=typeof V;return le=="number"||le=="symbol"||le=="boolean"||V==null||U(V)?!0:q.test(V)||!I.test(V)||Q!=null&&V in Object(Q)}function ul(V){var Q=typeof V;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?V!=="__proto__":V===null}function Yl(V){return!!nt&&nt in V}function Kl(V){var Q=V&&V.constructor,le=typeof Q=="function"&&Q.prototype||me;return V===le}function wa(V){return V===V&&!bn(V)}function Xl(V,Q){return function(le){return le==null?!1:le[V]===Q&&(Q!==void 0||V in Object(le))}}var Wi=qc(function(V){V=Y(V);var Q=[];return ee.test(V)&&Q.push(""),V.replace(W,function(le,pe,Me,Oe){Q.push(Me?Oe.replace(ne,"$1"):pe||le)}),Q});function dl(V){if(typeof V=="string"||U(V))return V;var Q=V+"";return Q=="0"&&1/V==-l?"-0":Q}function ui(V){if(V!=null){try{return jt.call(V)}catch{}try{return V+""}catch{}}return""}function qc(V,Q){if(typeof V!="function"||Q&&typeof Q!="function")throw new TypeError(r);var le=function(){var pe=arguments,Me=Q?Q.apply(this,pe):pe[0],Oe=le.cache;if(Oe.has(Me))return Oe.get(Me);var qe=V.apply(this,pe);return le.cache=Oe.set(Me,qe),qe};return le.cache=new(qc.Cache||An),le}qc.Cache=An;function Wu(V,Q){return V===Q||V!==V&&Q!==Q}function N(V){return Le(V)&&We.call(V,"callee")&&(!Vt.call(V,"callee")||ut.call(V)==u)}var K=Array.isArray;function ae(V){return V!=null&&Bt(V.length)&&!an(V)}function Le(V){return R(V)&&ae(V)}function an(V){var Q=bn(V)?ut.call(V):"";return Q==g||Q==v}function Bt(V){return typeof V=="number"&&V>-1&&V%1==0&&V<=c}function bn(V){var Q=typeof V;return!!V&&(Q=="object"||Q=="function")}function R(V){return!!V&&typeof V=="object"}function U(V){return typeof V=="symbol"||R(V)&&ut.call(V)==T}var G=ze?Xe(ze):Vc;function Y(V){return V==null?"":Ds(V)}function ie(V,Q,le){var pe=V==null?void 0:xa(V,Q);return pe===void 0?le:pe}function te(V,Q){return V!=null&&Hu(V,Q,Bu)}function se(V){return ae(V)?Rp(V):Op(V)}function je(V,Q){var le={};return Q=$p(Q),Wc(V,function(pe,Me,Oe){le[Me]=Q(pe,Me,Oe)}),le}function Ie(V){return V}function De(V){return ds(V)?Ve(dl(V)):cs(V)}e.exports=je})(W2,W2.exports);var W8e=W2.exports;const OA=Vo(W8e),V8e=(e=M8e)=>{const t="features-list-table",n={offset:ho(yg,0),limit:ho(yg,e),query:Ss,favoritesFirst:ho(N8e,!0),sortBy:ho(Ss,"createdAt"),sortOrder:ho(Ss,"desc"),project:wr,tag:wr,state:wr,segment:wr,createdAt:wr,type:wr,lifecycle:wr,createdBy:wr},[r,o]=nh(`${t}`,n),{offset:i,limit:a,query:l,favoritesFirst:c,sortBy:u,sortOrder:d,...p}=r,{features:f=[],total:h,loading:g,refetch:v,initialLoad:b}=xC(OA(I0(n,r),y=>y?`${y}`:void 0));return{features:f,total:h,refetch:v,loading:g,initialLoad:b,tableState:r,setTableState:o,filterState:p}},xD=([e,t],n,r)=>m.useCallback(o=>{const i=n?n[e]:void 0;console.log({key:e,operator:t,state:i,value:o}),i&&i.values.length>0&&!i.values.includes(`${o}`)?r({...n,[e]:{operator:i.operator,values:[...i.values,o]}}):i||r({...n,[e]:{operator:t,values:[o]}})},[n,r,e,t]),U8e=()=>{const{data:e,error:t}=_n(bt("api/admin/lifecycle/count"),G8e);return{lifecycleCount:e,error:t,loading:!t&&!e}},G8e=e=>fetch(e).then(Jt("Lifecycle count")).then(t=>t.json()),q8e=x(da,{shouldForwardProp:e=>e!=="isActive"})(({theme:e,isActive:t=!1})=>({borderRadius:`${e.shape.borderRadius}px`,padding:e.spacing(.5),fontSize:e.typography.body2.fontSize,height:"auto",...t&&{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}})),Y8e=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",padding:e.spacing(1.5,3,0,3),minHeight:e.spacing(7),gap:e.spacing(2)})),K8e=x(J)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",gap:e.spacing(1)})),X8e=[{label:"All flags",value:null},{label:"Develop",value:"pre-live"},{label:"Rollout production",value:"live"},{label:"Cleanup",value:"completed"}],J8e=(e,t)=>t?e===null?(t.initial||0)+(t.preLive||0)+(t.live||0)+(t.completed||0):t[e==="pre-live"?"preLive":e]:void 0,Q8e=({state:e,onChange:t,total:n,children:r})=>{var a;const{lifecycleCount:o}=U8e(),i=((a=e.lifecycle)==null?void 0:a.values)??[];return s.jsxs(Y8e,{children:[s.jsx(K8e,{children:X8e.map(({label:l,value:c})=>{const u=c===null?!e.lifecycle:i.includes(c),d=J8e(c,o),p=u&&Number.isInteger(n)?`${l} (${n===d?n:`${n} of ${d}`})`:`${l}${d!==void 0?` (${d})`:""}`,f=()=>t(c===null?{lifecycle:null}:{lifecycle:{operator:"IS",values:[c]}});return s.jsx(q8e,{label:p,variant:"outlined",isActive:u,onClick:f},l)})}),r]})};var MA={},Z8e=Te;Object.defineProperty(MA,"__esModule",{value:!0});var GX=MA.default=void 0,eMe=Z8e(ke()),tMe=s,nMe=(0,eMe.default)((0,tMe.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");GX=MA.default=nMe;const rMe=({onClick:e})=>{const{trackEvent:t}=Kt();return s.jsx(kt,{title:"Export flags",arrow:!0,children:s.jsx($t,{onClick:()=>{e(),t("search-feature-buttons",{props:{action:"export"}})},size:"small",children:s.jsx(GX,{})})})},dm=(e={})=>{const t=async()=>{const c=bt("api/admin/feature-types");return(await fetch(c,{method:"GET"}).then(Jt("Feature types"))).json()},n="api/admin/feature-types",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=()=>{Io(n)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{featureTypes:(r==null?void 0:r.types)||[],error:o,loading:i,refetch:l}},oMe="experiment",iMe="release",sMe="operational",aMe="kill-switch",lMe="permission";var DA={},cMe=Te;Object.defineProperty(DA,"__esModule",{value:!0});var mT=DA.default=void 0,uMe=cMe(ke()),dMe=s,pMe=(0,uMe.default)((0,dMe.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");mT=DA.default=pMe;var LA={},fMe=Te;Object.defineProperty(LA,"__esModule",{value:!0});var qX=LA.default=void 0,hMe=fMe(ke()),gMe=s,mMe=(0,hMe.default)((0,gMe.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");qX=LA.default=mMe;var FA={},vMe=Te;Object.defineProperty(FA,"__esModule",{value:!0});var bC=FA.default=void 0,yMe=vMe(ke()),xMe=s,bMe=(0,yMe.default)((0,xMe.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");bC=FA.default=bMe;var NA={},wMe=Te;Object.defineProperty(NA,"__esModule",{value:!0});var YX=NA.default=void 0,SMe=wMe(ke()),CMe=s,jMe=(0,SMe.default)((0,CMe.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");YX=NA.default=jMe;var BA={},EMe=Te;Object.defineProperty(BA,"__esModule",{value:!0});var KX=BA.default=void 0,TMe=EMe(ke()),kMe=s,_Me=(0,TMe.default)((0,kMe.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");KX=BA.default=_Me;const wC=e=>{switch(e){case iMe:return mT;case oMe:return qX;case aMe:return bC;case sMe:return KX;case lMe:return YX;default:return mT}},RMe=x("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}`}})),PMe=x("span")(({theme:e,color:t="neutral"})=>({display:"flex",color:t==="disabled"?e.palette.action.disabled:e.palette[t].main})),bD=(e,t)=>s.jsx(PMe,{color:e,children:s.jsx(X,{condition:!!(t!=null&&t.props.sx),show:t,elseShow:t?m.cloneElement(t,{sx:{fontSize:"16px"}}):null})}),sn=m.forwardRef(({as:e="span",color:t="neutral",icon:n,iconRight:r,className:o,sx:i,children:a,...l},c)=>s.jsxs(RMe,{as:e,color:t,icon:n,className:o,sx:i,...l,ref:c,children:[s.jsx(X,{condition:!!n&&!r,show:bD(t,n)}),s.jsx(X,{condition:a!=null&&a!=="",show:s.jsx("span",{children:a})}),s.jsx(X,{condition:!!n&&!!r,show:bD(t,n)})]})),AMe={environments:[],name:"",type:"release",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1,dependencies:[],children:[]},Al=(e,t,n)=>{const r=$Me(e,t),{data:o,error:i,mutate:a}=_n(["useFeature",r],()=>IMe(r),n),l=m.useCallback(()=>{a().catch(console.warn)},[a]);return{feature:(o==null?void 0:o.body)||AMe,refetchFeature:l,loading:!i&&!o,status:o==null?void 0:o.status,error:i}},IMe=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await Jt("Feature flag data")(t),{status:t.status,body:await t.json()})},$Me=(e,t)=>bt(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`),OMe=x(da)(({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)}})),MMe=x("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})),XX=({tag:e,onDelete:t,deleteIcon:n,maxLength:r=30})=>{const o=Ig(e),i=o.length>r,a=e.color&&e.color!=="#FFFFFF";let l=e.value;if(i){const u=Math.max(0,r-e.type.length-1);l=`${e.value.substring(0,u)}...`}const c=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[a&&s.jsx(MMe,{$color:e.color}),s.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:`${e.type}:${l}`})]});return s.jsx(OMe,{label:c,onDelete:t,deleteIcon:n,title:i?o:void 0})},DMe=x(xt)({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}}),LMe=x("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"}));x(da)(({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 FMe=({text:e,searchQuery:t})=>s.jsx(X,{condition:!!(e&&e.length>40),show:s.jsx(hr,{title:s.jsx(Kr,{search:t,children:e}),placement:"bottom-start",arrow:!0,children:s.jsx(O2,{"data-loading":!0,children:s.jsx(Kr,{search:t,children:e})})}),elseShow:s.jsx(O2,{"data-loading":!0,children:s.jsx(Kr,{search:t,children:e})})}),NMe=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5),margin:e.spacing(1.25,0,1,0),paddingLeft:e.spacing(2)})),BMe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.dark})),zMe=x(J)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.25)})),HMe=x(sn)(({theme:e})=>({padding:e.spacing(.5),border:0,textTransform:"capitalize"})),WMe=({project:e,feature:t,searchQuery:n})=>s.jsx(J,{sx:r=>({fontWeight:r.typography.fontWeightBold}),children:s.jsx(DMe,{to:`/projects/${e}/features/${t}`,children:s.jsx(yo,{lines:1,title:t,arrow:!0,sx:{overflowWrap:"anywhere"},children:s.jsx("span",{children:s.jsx(Kr,{search:n,children:t})})})})}),VMe=({feature:e,searchQuery:t})=>s.jsx(yo,{lines:1,title:e,arrow:!0,sx:n=>({fontWeight:n.typography.fontWeightBold,color:n.palette.neutral.main,overflowWrap:"anywhere"}),children:s.jsx(Kr,{search:t,children:e})}),q3=({tag:e,onClick:t})=>{const n=Ig(e),r=s.jsx(J,{onClick:()=>t(e),sx:{cursor:"pointer"},children:s.jsx(XX,{tag:e,maxLength:30})});return s.jsx(hr,{title:n,arrow:!0,children:s.jsx("span",{children:r})},n)},UMe=({tags:e,onClick:t})=>s.jsx(hr,{title:e.map(n=>{const r=Ig(n);return s.jsx(J,{sx:{cursor:"pointer"},onClick:()=>t(r),children:s.jsx(XX,{tag:n,maxLength:30})},r)}),children:s.jsxs(LMe,{sx:{cursor:"initial",borderRadius:n=>n.spacing(2)},children:[e.length," more..."]})}),GMe=({tags:e,onClick:t})=>{if(!e||e.length===0)return null;const[n,r,o,...i]=e,a=l=>{t(Ig(l))};return s.jsxs(zMe,{children:[n&&s.jsx(q3,{tag:n,onClick:a}),r&&s.jsx(q3,{tag:r,onClick:a}),o&&s.jsx(q3,{tag:o,onClick:a}),s.jsx(X,{condition:i.length>0,show:s.jsx(UMe,{tags:i,onClick:t})})]})},qMe=x(xt)({display:"block"}),YMe=({feature:e,project:t})=>{const{feature:n}=Al(t,e),r=n.children,o=n.dependencies;if(r.length>0)return s.jsxs(s.Fragment,{children:[s.jsx(J,{children:"Children"}),r.map(i=>s.jsx(qMe,{to:`/projects/${t}/features/${i}`,children:i},i))]});if(o[0]){const i=o[0].feature;return s.jsxs(s.Fragment,{children:[s.jsx(J,{children:"Parent"}),s.jsx(xt,{to:`/projects/${t}/features/${i}`,children:i})]})}return s.jsx(s.Fragment,{children:"Loading..."})},KMe=({project:e,feature:t,archivedAt:n,type:r,searchQuery:o,dependencyType:i,onTypeClick:a,delay:l=500})=>{var v;const{featureTypes:c}=dm(),u=wC(r),p=`${((v=c.find(b=>b.id===r))==null?void 0:v.name)||r} flag`,{locationSettings:f}=wo(),h=eA(n,f.locale),g=()=>s.jsx(hr,{arrow:!0,title:p,describeChild:!0,children:s.jsx($t,{sx:{p:0},"aria-label":`add ${r} flag to filter`,onClick:()=>a(r),children:s.jsx(u,{sx:b=>({fontSize:b.spacing(2)}),"data-testid":"feature-type-icon"})})});return s.jsxs(BMe,{"data-loading":!0,children:[s.jsx(g,{}),n?s.jsx(VMe,{feature:t,searchQuery:o}):s.jsx(WMe,{project:e,feature:t,searchQuery:o}),s.jsx(X,{condition:!!i,show:s.jsx(hr,{title:s.jsx(YMe,{feature:t,project:e}),enterDelay:l,enterNextDelay:l,children:s.jsx(HMe,{color:i==="parent"?"warning":"secondary",children:i})})}),n&&s.jsx(hr,{arrow:!0,title:h,describeChild:!0,children:s.jsx(sn,{tabIndex:0,color:"neutral",children:"Archived"})})]})},XMe=({description:e,searchQuery:t})=>s.jsx(X,{condition:!!e,show:s.jsx(J,{sx:n=>({display:"flex",gap:n.spacing(1)}),children:s.jsx(FMe,{text:e,searchQuery:t})})}),JMe=(e,t)=>({row:n})=>{const{searchQuery:r}=ga();return s.jsxs(NMe,{children:[s.jsx(KMe,{project:n.original.project||"",feature:n.original.name,archivedAt:n.original.archivedAt,searchQuery:r,type:n.original.type||"",dependencyType:n.original.dependencyType||"",onTypeClick:t}),s.jsx(XMe,{description:n.original.description||"",searchQuery:r}),s.jsx(GMe,{tags:n.original.tags,onClick:e})]})},Bc=x("div")(()=>({border:0,clip:"rect(0 0 0 0)",height:"auto",margin:0,overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"})),QMe=x("div")({width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}),ZMe=x("button")({border:"none",background:"none",cursor:"pointer",borderRadius:"100%",padding:0}),e7e=x("p")(({theme:e})=>({color:e.palette.text.secondary})),t7e=x(hp)(({theme:e})=>({width:e.spacing(3),height:e.spacing(3)})),n7e=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),i=r?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:n.name}),s.jsx(e7e,{children:"You can't filter by unknown users."})]}):s.jsx("p",{children:n.name}),a=s.jsxs(s.Fragment,{children:[s.jsx(Bc,{children:s.jsxs("span",{children:["Show only flags created by ",n.name]})}),s.jsx(t7e,{disableTooltip:!0,user:{id:n.id,name:n.name,imageUrl:n.imageUrl}})]});return s.jsx(QMe,{children:s.jsx(hr,{arrow:!0,describeChild:!0,title:i,children:e?s.jsx(ZMe,{"aria-disabled":r,onClick:o,children:a}):s.jsx("div",{children:a})})})},lf="production",r7e=({lifecycle:e,environments:t})=>{if((e==null?void 0:e.stage)==="initial"){if(t!=null&&t.some(r=>r.type!==lf&&r.enabled))return"No traffic";if(!(t!=null&&t.some(r=>r.type!==lf&&r.hasStrategies)))return"No strategies";if(!(t!=null&&t.some(r=>r.type!==lf&&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===lf);if((e==null?void 0:e.stage)==="live"||(e==null?void 0:e.stage)==="completed"){if(n.length>1){const o=n.filter(i=>i.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 zA={},o7e=Te;Object.defineProperty(zA,"__esModule",{value:!0});var JX=zA.default=void 0,i7e=o7e(ke()),s7e=s,a7e=(0,i7e.default)((0,s7e.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");JX=zA.default=a7e;const l7e=x("div")(({theme:e})=>({padding:e.spacing(0,2),display:"flex",alignItems:"center",gap:e.spacing(.5),minWidth:"180px"})),c7e=x(JX)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(3.5),padding:e.spacing(.5)})),u7e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",gap:e.spacing(.5),ul:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column"}})),d7e=({lifecycle:e,environments:t,project:n})=>{const r=m.useMemo(()=>r7e({lifecycle:e,environments:t}),[e,t]),o=m.useMemo(()=>t.flatMap(i=>i.changeRequestIds),[t]);return s.jsxs(l7e,{children:[s.jsx(yo,{title:r,lines:2,children:r}),o.length>0&&s.jsx(hr,{arrow:!0,title:s.jsxs(u7e,{children:[s.jsx("div",{children:"Change requests:"}),s.jsx("ul",{children:o.map(i=>s.jsx("li",{children:s.jsx(xt,{to:`/projects/${n}/change-requests/${i}`,target:"_blank",rel:"noopener noreferrer",children:`#${i}`})},i))})]}),children:s.jsx(c7e,{"data-testid":"change-requests-icon",tabIndex:0})})]})},QX=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:[]}),Np=wK(),p7e=()=>{var $;const e=qt(),{isOss:t}=rt(),{trackEvent:n}=Kt(),{environments:r}=$u(),o=r.filter(D=>D.enabled).map(D=>D.name),i=Xn(e.breakpoints.down("md")),a=Xn(e.breakpoints.down("lg")),[l,c]=m.useState(!1),{setToastApiError:u}=Nt(),{features:d,total:p,refetch:f,loading:h,initialLoad:g,tableState:v,setTableState:b,filterState:y}=V8e(),w=xD(["type","IS"],v,b),S=xD(["tag","INCLUDE"],v,b),{projects:j}=Xr(),E=$l(h),{favorite:C,unfavorite:T}=$Ae(),k=m.useCallback(async D=>{try{D!=null&&D.favorite?await T(D.project,D.name):await C(D.project,D.name),f()}catch{u("Something went wrong, could not update favorite")}},[C,f,T,u]),_=!t(),A=m.useMemo(()=>[Np.accessor("favorite",{header:()=>s.jsx(VAe,{isActive:v.favoritesFirst,onClick:()=>b({favoritesFirst:!v.favoritesFirst})}),cell:({getValue:D,row:z})=>s.jsx(sX,{value:D(),onClick:()=>k(z.original)}),enableSorting:!1,meta:{width:48}}),Np.accessor("name",{header:"Name",cell:JMe(S,w),meta:{width:"40%"}}),Np.accessor("createdAt",{header:"Created",cell:({getValue:D})=>s.jsx(Jd,{value:D()}),meta:{width:"1%"}}),Np.accessor("createdBy",{id:"createdBy",header:"By",cell:n7e(),meta:{width:"1%",align:"center"},enableSorting:!1}),Np.accessor("lifecycle",{id:"lifecycle",header:"Lifecycle",cell:({row:{original:D}})=>s.jsx(R$e,{feature:D,expanded:!0,"data-loading":!0}),enableSorting:!1,size:50,meta:{width:"1%"}}),..._?[Np.accessor("environments",{id:"status",header:"Status",cell:({row:{original:D}})=>s.jsx(d7e,{...D}),enableSorting:!1,size:350})]:[],Np.accessor("project",{header:"Project",cell:({getValue:D})=>{var L;const z=D(),B=(L=j.find(I=>I.id===z))==null?void 0:L.name;return s.jsx(J,{sx:{minWidth:"180px"},children:s.jsx(Rl,{title:B||z,to:`/projects/${z}`})})}})],[v.favoritesFirst,_]),O=m.useMemo(()=>(d==null?void 0:d.length)===0&&h?QX:d,[g,d,h]),M=IK(VX(v,b,{columns:A,data:O}));m.useEffect(()=>{i?M.setColumnVisibility({type:!1,createdAt:!1,tags:!1,lastSeenAt:!1,stale:!1}):a?M.setColumnVisibility({lastSeenAt:!1,stale:!1}):M.setColumnVisibility({})},[i,a]);const H=(D="")=>{b({query:D}),n("search-bar",{props:{screen:"features",length:D.length}})},P=M.getRowModel().rows;return r.length>0?s.jsxs(cr,{disableLoading:!0,bodyClass:"no-padding",header:s.jsx(Pn,{title:"Flags overview",actions:s.jsxs(s.Fragment,{children:[s.jsx(kn,{component:xt,to:"/unknown-flags",underline:"always",sx:{marginRight:2,...Cu(e)},children:"Unknown flags"}),s.jsx(kn,{component:xt,to:"/archive",underline:"always",sx:{marginRight:2,...Cu(e)},onClick:()=>{n("search-feature-buttons",{props:{action:"archive"}})},children:"Archived flags"}),s.jsx(rMe,{onClick:()=>c(!0)})]})}),children:[s.jsx(Q8e,{state:y,onChange:b,total:h?void 0:p,children:i?null:s.jsx(xo,{placeholder:"Search",initialValue:v.query||"",onChange:H,id:"globalFeatureFlags"})}),s.jsx(j8e,{onChange:b,state:y}),i?s.jsx(J,{sx:D=>({padding:D.spacing(0,3,3)}),children:s.jsx(xo,{initialValue:v.query||"",onChange:H,id:"globalFeatureFlags"})}):null,s.jsx(is,{value:v.query||"",children:s.jsx("div",{ref:E,children:s.jsx(NK,{tableInstance:M,totalItems:p})})}),s.jsx(X,{condition:P.length===0,show:s.jsx(J,{sx:D=>({padding:D.spacing(0,2,2)}),children:s.jsx(X,{condition:(($=v.query||"")==null?void 0:$.length)>0,show:s.jsxs($r,{children:["No feature flags found matching “",v.query,"”"]}),elseShow:s.jsx($r,{children:"No feature flags found matching your criteria."})})})}),s.jsx(o9e,{showExportDialog:l,data:O,onClose:()=>c(!1),environments:o})]}):null},f7e=["flexibleRollout","default"],h7e=e=>e.map(t=>({...t,advanced:!f7e.includes(t.name)})),rh=()=>{const{data:e,error:t}=_n(vT,g7e),n=m.useCallback(()=>{Io(vT).catch(console.warn)},[]);return{strategies:h7e((e==null?void 0:e.strategies)||v7e),refetchStrategies:n,loading:!t&&!e,error:t}},g7e=()=>fetch(vT).then(Jt("Strategy types")).then(e=>e.json()),m7e={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}]},v7e=[m7e],vT=bt("api/admin/strategies");function ZX(e,t=""){return(n={},r="",o={})=>{const i=new URLSearchParams(Array.from(Object.entries(n).filter(([h,g])=>!!g).map(([h,g])=>[h,g.toString()]))).toString(),a=r||t,l=`${a}${i}`;yC(l,a);const c=async()=>fetch(bt(l),{method:"GET"}).then(Jt("Paginated data")).then(h=>h.json()),{data:u,error:d,isLoading:p}=_n(l,c,{...o});return{...u||e,total:(u==null?void 0:u.total)||0,error:d,loading:p}}}const y7e="api/admin/metrics/applications?",eJ=ZX({applications:[],total:0},y7e);var HA={},x7e=Te;Object.defineProperty(HA,"__esModule",{value:!0});var Oo=HA.default=void 0,b7e=x7e(ke()),w7e=s,S7e=(0,b7e.default)((0,w7e.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Oo=HA.default=S7e;var WA={},C7e=Te;Object.defineProperty(WA,"__esModule",{value:!0});var tJ=WA.default=void 0,j7e=C7e(ke()),E7e=s,T7e=(0,j7e.default)((0,E7e.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");tJ=WA.default=T7e;var VA={},k7e=Te;Object.defineProperty(VA,"__esModule",{value:!0});var nJ=VA.default=void 0,_7e=k7e(ke()),R7e=s,P7e=(0,_7e.default)((0,R7e.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");nJ=VA.default=P7e;const A7e="_truncate_19sq2_2",I7e="_fullwidth_19sq2_8",$7e="_sectionPadding_19sq2_12",O7e="_horisontalScroll_19sq2_16",M7e="_listLink_19sq2_25",D7e="_hideLt920_19sq2_36",L7e="_hideLt600_19sq2_41",F7e="_dataTableHeader_19sq2_45",N7e="_titleText_19sq2_50",B7e="_actions_19sq2_55",z7e="_switchWithLabel_19sq2_59",H7e="_label_19sq2_62",W7e="_emptyState_19sq2_71",V7e="_toggleName_19sq2_79",U7e="_toolbar_19sq2_84",G7e="_toolbarButton_19sq2_90",q7e="_error_19sq2_97",Y7e="_headerTitle_19sq2_101",K7e="_listItem_19sq2_106",X7e="_section_19sq2_12",J7e="_contentPadding_19sq2_114",Q7e="_contentSpacing_19sq2_118",Z7e="_searchField_19sq2_122",s1={truncate:A7e,fullwidth:I7e,sectionPadding:$7e,horisontalScroll:O7e,listLink:M7e,hideLt920:D7e,hideLt600:L7e,dataTableHeader:F7e,titleText:N7e,actions:B7e,switchWithLabel:z7e,label:H7e,switch:"_switch_19sq2_59",emptyState:W7e,toggleName:V7e,toolbar:U7e,toolbarButton:G7e,error:q7e,headerTitle:Y7e,listItem:K7e,section:X7e,contentPadding:J7e,contentSpacing:Q7e,searchField:Z7e},rJ=({apps:e})=>s.jsx(Ni,{children:s.jsx(X,{condition:e.length>0,show:e.map(({appName:t,description:n,icon:r})=>s.jsxs(Gr,{className:s1.listItem,children:[s.jsx(B4,{children:s.jsx(IS,{children:s.jsx(X,{condition:r,show:s.jsx(Ka,{children:r}),elseShow:s.jsx(nJ,{})},`avatar_conditional_${t}`)})}),s.jsx(dn,{primary:s.jsx(xt,{to:`/applications/${encodeURIComponent(t)}`,className:[s1.listLink,s1.truncate].join(" "),children:t}),secondary:n||"No description"})]},t))})});rJ.propTypes={apps:$e.array.isRequired};$e.string,$e.any;$e.string,$e.func.isRequired,$e.string;$e.string,$e.object;const eDe=Je.forwardRef(({icon:e,label:t,disabled:n,...r},o)=>s.jsxs(Cr,{disabled:n,style:{display:"flex",alignItems:"center"},...r,children:[s.jsx(e,{}),t]}));eDe.propTypes={icon:$e.object,label:$e.string,disabled:$e.bool};const tDe="_deprecated_nqviu_10",nDe="_formButtons_nqviu_14",rDe="_header_nqviu_18",oDe="_formContainer_nqviu_32",iDe="_inset_nqviu_38",sDe="_parameter_menu_nqviu_42",aDe="_listcontainer_nqviu_52",lDe="_listItem_nqviu_56",cDe={"non-style-button":"_non-style-button_nqviu_1",deprecated:tDe,formButtons:nDe,header:rDe,formContainer:oDe,inset:iDe,parameter_menu:sDe,listcontainer:aDe,listItem:lDe},uDe=({strategy:e,applications:t})=>{const n=qt(),{parameters:r=[]}=e,o=i=>i.length>0?i.map(({name:a,type:l,description:c,required:u},d)=>s.jsxs(Gr,{children:[s.jsx(X,{condition:u,show:s.jsx(B4,{children:s.jsx(kt,{title:"Required parameter",arrow:!0,children:s.jsx(Oo,{"aria-hidden":!1})})}),elseShow:s.jsx(B4,{children:s.jsx(kt,{title:"Optional parameter",arrow:!0,children:s.jsx(tJ,{"aria-hidden":!1})})})}),s.jsx(dn,{primary:s.jsxs("div",{children:[a," ",s.jsxs("small",{children:["(",l,")"]})]}),secondary:c})]},`${a}-${d}`)):s.jsx(Gr,{children:"No params"});return s.jsx("div",{className:cDe.listcontainer,children:s.jsxs(jo,{container:!0,children:[s.jsx(X,{condition:e.deprecated,show:s.jsx(jo,{item:!0,children:s.jsx("h5",{style:{color:n.palette.error.main},children:"Deprecated"})})}),s.jsxs(jo,{item:!0,sm:12,md:12,children:[s.jsx("h6",{children:"Parameters"}),s.jsx("hr",{}),s.jsx(Ni,{children:o(r)})]}),s.jsxs(jo,{item:!0,sm:12,md:12,children:[s.jsxs("h6",{children:["Applications using this strategy"," ",t.length>=1e3&&"(Capped at 1000)"]}),s.jsx("hr",{}),s.jsx(rJ,{apps:t})]})]})})},dDe=e=>{const t=Nf(e.permission,e.projectId,e.environmentId);return s.jsx(oJ,{...e,access:t})},pDe=e=>{const t=Pg(e.permission,e.projectId,e.environmentId);return s.jsx(oJ,{...e,access:t})},oJ=({access:e,permission:t,projectId:n,children:r,environmentId:o,tooltipProps:i,disabled:a,...l})=>{const c=Eu();return s.jsx(Qa,{...i,title:oC(e,i==null?void 0:i.title),arrow:!0,onClick:u=>u.preventDefault(),children:s.jsx("div",{id:c,children:s.jsx($t,{...l,disabled:!e||a,"aria-labelledby":c,size:l.size||"large",children:r})})})},Wo=e=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?s.jsx(pDe,{...e,projectId:e.projectId,environmentId:e.environmentId}):s.jsx(dDe,{...e});var UA={},fDe=Te;Object.defineProperty(UA,"__esModule",{value:!0});var ns=UA.default=void 0,hDe=fDe(ke()),gDe=s,mDe=(0,hDe.default)((0,gDe.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");ns=UA.default=mDe;const Or=e=>{const t=$s(e);if(!t)throw new Error(`Missing required path param: ${e}`);return t},vDe=()=>{const e=Or("name"),{strategies:t}=rh(),{applications:n}=eJ(),r=Ot(),o=t.find(a=>a.name===e),i=()=>{r(`/strategies/${e}/edit`)};return o?s.jsx(cr,{header:s.jsx(Pn,{title:o==null?void 0:o.name,subtitle:o==null?void 0:o.description,actions:s.jsx(X,{condition:o.editable,show:s.jsx(Wo,{permission:n0,"data-loading":!0,onClick:i,tooltipProps:{title:"Edit strategy"},children:s.jsx(ns,{})})})}),children:s.jsx(jo,{container:!0,children:s.jsx(jo,{item:!0,xs:12,sm:12,children:s.jsx(uDe,{strategy:o,applications:n})})})}):null};var GA={},yDe=Te;Object.defineProperty(GA,"__esModule",{value:!0});var iJ=GA.default=void 0,xDe=yDe(ke()),bDe=s,wDe=(0,xDe.default)((0,bDe.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");iJ=GA.default=wDe;const SDe=x(J)(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",padding:e.spacing(0,1.5)})),CDe=x(jr)(({theme:e})=>({borderColor:e.palette.divider,height:e.spacing(3),margin:e.spacing(0,2)})),jDe=()=>s.jsx(CDe,{orientation:"vertical",variant:"middle"}),sJ=({children:e})=>s.jsx(SDe,{children:e});sJ.Divider=jDe;const Tu=sJ;var qA={},EDe=Te;Object.defineProperty(qA,"__esModule",{value:!0});var aJ=qA.default=void 0,TDe=EDe(ke()),kDe=s,_De=(0,TDe.default)((0,kDe.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");aJ=qA.default=_De;var YA={},RDe=Te;Object.defineProperty(YA,"__esModule",{value:!0});var lJ=YA.default=void 0,PDe=RDe(ke()),ADe=s,IDe=(0,PDe.default)((0,ADe.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 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"}),"Language");lJ=YA.default=IDe;var KA={},$De=Te;Object.defineProperty(KA,"__esModule",{value:!0});var cJ=KA.default=void 0,ODe=$De(ke()),MDe=s,DDe=(0,ODe.default)((0,MDe.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");cJ=KA.default=DDe;const LDe=e=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),Il=e=>BDe[e]??e,FDe=e=>s.jsx(G1,{...e,component:t=>s.jsx(LDe,{...t}),inheritViewBox:!0}),NDe=e=>{switch(e){case"default":return bC;case"remoteAddress":return lJ;case"flexibleRollout":return FDe;case"applicationHostname":return aJ;case"releasePlanTemplate":return Y0;default:return cJ}},uJ=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress"],BDe={applicationHostname:"Hosts",default:"Standard",flexibleRollout:"Gradual rollout",gradualRolloutRandom:"Randomized",gradualRolloutSessionId:"Sessions",gradualRolloutUserId:"Users",remoteAddress:"IPs"},ov="api/admin/strategies",XA=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),o=m.useCallback(async u=>{const d=t(ov,{method:"POST",body:JSON.stringify(u)});return e(d.caller,d.id)},[t,e]),i=m.useCallback(async u=>{const d=`${ov}/${u.name}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},[t,e]),a=m.useCallback(async u=>{const d=`${ov}/${u.name}`,p=t(d,{method:"DELETE"});return e(p.caller,p.id)},[t,e]),l=m.useCallback(async u=>{const d=`${ov}/${u.name}/deprecate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]),c=m.useCallback(async u=>{const d=`${ov}/${u.name}/reactivate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]);return{createStrategy:o,updateStrategy:i,removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c,errors:n,loading:r}},yi={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),i=new Date(((l=t==null?void 0:t.values)==null?void 0:l[n])||0);return(i==null?void 0:i.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],i=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===i?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(),i=`${((l=t==null?void 0:t.values)==null?void 0:l[n])||""}`.toLowerCase();return o==null?void 0:o.localeCompare(i)},playgroundResultState:(e,t,n,r)=>{var a,l;const o=(a=e==null?void 0:e.values)==null?void 0:a[n],i=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===i?0:o==="true"?1:i==="true"||o==="false"?-1:i==="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,i=Number.parseInt(`${((l=t==null?void 0:t.values)==null?void 0:l[n])||0}`,10)||Number.MAX_SAFE_INTEGER;return o-i}},zDe=Je.forwardRef((e,t)=>{const n=Pg(e.permission,e.projectId,e.environmentId);return s.jsx(dJ,{...e,access:n,ref:t})}),HDe=Je.forwardRef((e,t)=>{const n=Nf(e.permission,e.projectId,e.environmentId);return s.jsx(dJ,{...e,access:n,ref:t})}),dJ=Je.forwardRef((e,t)=>{const{access:n,permission:r,tooltip:o,disabled:i,projectId:a,environmentId:l,checked:c,onChange:u,...d}=e;return s.jsx(Qa,{title:oC(n,o),arrow:!0,variant:"custom",children:s.jsx("span",{"data-loading":!0,children:s.jsx(fa,{"data-testid":"toggle-switch",onChange:u,disabled:i||!n,checked:c,ref:t,...d})})})}),WDe=Je.forwardRef((e,t)=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?s.jsx(zDe,{...e,projectId:e.projectId,environmentId:e.environmentId,ref:t}):s.jsx(HDe,{...e,ref:t})),VDe=({deprecated:e,disabled:t,onToggle:n})=>{const r=()=>{n(e)},o=Eu(),i=Nf(n0),a=m.useMemo(()=>i?t?"You cannot disable default strategy":e?"Excluded from strategy list":"Included in strategy list":"",[e,t,i]);return s.jsx(kt,{title:a,describeChild:!0,arrow:!0,children:s.jsx("div",{id:o,children:s.jsx(WDe,{checked:!e,permission:n0,onClick:r,disabled:t,inputProps:{"aria-labelledby":o}})})})},UDe=({strategy:e,onClick:t})=>{const n=Eu();return s.jsx(X,{condition:e==null?void 0:e.editable,show:s.jsx(Wo,{onClick:t,permission:n0,tooltipProps:{title:"Edit strategy"},children:s.jsx(ns,{})}),elseShow:s.jsx(kt,{title:"You cannot edit a built-in strategy",arrow:!0,children:s.jsx("div",{id:n,children:s.jsx($t,{disabled:!0,size:"large",children:s.jsx(ns,{"aria-labelledby":n})})})})})};var JA={},GDe=Te;Object.defineProperty(JA,"__esModule",{value:!0});var Po=JA.default=void 0,qDe=GDe(ke()),YDe=s,KDe=(0,qDe.default)((0,YDe.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");Po=JA.default=KDe;const XDe=({strategy:e,onClick:t})=>{const n=Eu();return s.jsx(X,{condition:e==null?void 0:e.editable,show:s.jsx(Wo,{onClick:t,permission:N9e,tooltipProps:{title:"Delete strategy"},children:s.jsx(Po,{})}),elseShow:s.jsx(kt,{title:"You cannot delete a built-in strategy",arrow:!0,children:s.jsx("div",{id:n,children:s.jsx($t,{disabled:!0,size:"large",children:s.jsx(Po,{"aria-labelledby":n})})})})})};var QA={},JDe=Te;Object.defineProperty(QA,"__esModule",{value:!0});var V2=QA.default=void 0,QDe=JDe(ke()),ZDe=s,eLe=(0,QDe.default)((0,ZDe.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");V2=QA.default=eLe;const wD=x("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)}})),bo=({tooltip:e,htmlTooltip:t,tooltipId:n,placement:r,children:o,size:i,...a})=>{if(t){const{htmlTooltipMaxWidth:l}=a;return s.jsx(hr,{id:n,title:e,placement:r,arrow:!0,maxWidth:l,children:s.jsx(wD,{size:i,tabIndex:0,"aria-label":"Help",children:o??s.jsx(V2,{})})})}return s.jsx(kt,{title:e,placement:r,arrow:!0,id:n,children:s.jsx(wD,{size:i,tabIndex:0,"aria-label":"Help",children:o??s.jsx(V2,{})})})},SD=({children:e})=>s.jsx(Z,{component:"span",variant:"body2",sx:t=>({marginBottom:t.spacing(2)}),children:e}),pJ=({alert:e})=>{const t=s.jsxs(s.Fragment,{children:[s.jsxs(SD,{children:["If you decide to create a custom strategy be aware of the following:",s.jsxs("ul",{children:[s.jsx("li",{children:"They require writing custom code and deployments for each SDK you’re using."}),s.jsx("li",{children:"Differing implementation in each SDK will cause toggles to evaluate differently"}),s.jsx("li",{children:"Custom strategies require a lot of configuration in both Unleash admin UI and the SDK."})]})]}),s.jsx(SD,{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?s.jsx(Lt,{severity:"info",sx:n=>({marginBottom:n.spacing(3)}),children:t}):s.jsx(J,{sx:n=>({maxWidth:"720px",padding:n.spacing(4,2),margin:"0 auto"}),children:t})},tLe=()=>{const e=Xn("(max-width:700px)"),t=Ot();return s.jsx(X,{condition:e,show:s.jsx(Wo,{"data-testid":T7,onClick:()=>t("/strategies/create"),permission:B2,size:"large",tooltipProps:{title:"New custom strategy"},children:s.jsx(Oo,{})}),elseShow:s.jsx(Ro,{onClick:()=>t("/strategies/create"),color:"primary",permission:B2,"data-testid":T7,children:"New custom strategy"})})},nLe=x(sn)(({theme:e})=>({marginLeft:e.spacing(1),display:"inline-block"})),rLe=x(J)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.mainHeader,width:"100%"})),CD=x(J)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(2),"& > span":{fontWeight:e.fontWeight.bold}})),jD=({title:e,description:t,link:n})=>s.jsxs(rLe,{children:[e,s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body2",component:"p",sx:{mb:1},children:t}),s.jsx(kn,{href:n,target:"_blank",rel:"noopener noreferrer",variant:"body2",children:"Read more in the documentation"})]})})]}),oLe=()=>s.jsxs(Lt,{severity:"warning",sx:{mb:2},children:["Custom strategies are deprecated and may be removed in a future major version. We recommend not using custom strategies going forward and instead using the gradual rollout strategy with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"constraints"}),". If you have a need for custom strategies that you cannot support with constraints, please reach out to us."]}),iLe=()=>s.jsxs(Lt,{severity:"info",sx:{mb:2},children:["We recommend using gradual rollout. You can customize it with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"constraints"})," ","and"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#variants",target:"_blank",rel:"noopener noreferrer",children:"variants"}),"."]}),sLe=()=>{const e=Ot(),[t,n]=m.useState({show:!1,title:"",onConfirm:()=>{}}),{strategies:r,refetchStrategies:o,loading:i}=rh(),{removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c}=XA(),{setToastData:u,setToastApiError:d}=Nt();Iu("Strategy types");const p=m.useMemo(()=>{if(i){const L=Array(5).fill({name:"Context name",description:"Context description when loading"});return{all:L,standard:L,advanced:L,custom:L}}const z=r.map(({name:L,description:I,editable:q,deprecated:ee,advanced:W})=>({name:L,description:I,editable:q,deprecated:ee,advanced:W})),B=z.filter(L=>!L.editable);return{all:z,standard:B.filter(L=>!L.advanced),advanced:B.filter(L=>L.advanced),custom:z.filter(L=>L.editable)}},[r,i]),f=m.useCallback(z=>B=>{n(B?{show:!0,title:"Really reactivate strategy?",onConfirm:async()=>{try{await c(z),o(),u({type:"success",text:"Strategy reactivated"})}catch(L){d(Tt(L))}}}:{show:!0,title:"Really deprecate strategy?",onConfirm:async()=>{try{await l(z),o(),u({type:"success",text:"Strategy deprecated"})}catch(L){d(Tt(L))}}})},[l,c,o,d,u]),h=m.useCallback(z=>{n({show:!0,title:"Really delete strategy?",onConfirm:async()=>{try{await a(z),o(),u({type:"success",text:"Strategy deleted"})}catch(B){d(Tt(B))}}})},[a,o,d,u]),g=m.useCallback(z=>{e(`/strategies/${z.name}/edit`)},[e]),v=m.useMemo(()=>[{id:"Icon",Cell:()=>s.jsx(J,{"data-loading":!0,sx:{pl:3,pr:1,display:"flex",alignItems:"center"},children:s.jsx(iJ,{color:"disabled"})})},{id:"Name",Header:"Name",accessor:z=>Il(z.name),width:"90%",Cell:({row:{original:{name:z,description:B,deprecated:L}}})=>s.jsx(Rl,{"data-loading":!0,title:Il(z),subtitle:B,to:`/strategies/${z}`,children:s.jsx(X,{condition:L,show:()=>s.jsx(nLe,{color:"disabled",children:"Disabled"})})}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:z}})=>s.jsxs(Tu,{children:[s.jsx(VDe,{deprecated:z.deprecated,onToggle:f(z)}),s.jsx(X,{condition:z.editable,show:s.jsxs(s.Fragment,{children:[s.jsx(Tu.Divider,{}),s.jsx(UDe,{strategy:z,onClick:()=>g(z)}),s.jsx(XDe,{strategy:z,onClick:()=>h(z)})]})})]}),width:150,minWidth:120,disableSortBy:!0},{accessor:"description",disableSortBy:!0},{accessor:"sortOrder",sortType:"number"}],[f,g,h]),b=m.useMemo(()=>({sortBy:[{id:"Name",desc:!1}],hiddenColumns:["description","sortOrder"]}),[]),{getTableProps:y,getTableBodyProps:w,headerGroups:S,rows:j,prepareRow:E}=Zt.useTable({columns:v,data:p.standard,initialState:b,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},Zt.useSortBy),{getTableProps:C,getTableBodyProps:T,headerGroups:k,rows:_,prepareRow:A}=Zt.useTable({columns:v,data:p.advanced,initialState:b,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},Zt.useSortBy),{getTableProps:O,getTableBodyProps:M,headerGroups:H,rows:P,prepareRow:$}=Zt.useTable({columns:v,data:p.custom,initialState:b,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},Zt.useSortBy),D=()=>{t==null||t.onConfirm(),n(z=>({...z,show:!1}))};return s.jsxs(s.Fragment,{children:[s.jsxs(cr,{isLoading:i,header:s.jsx(Pn,{children:s.jsx(jD,{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/reference/activation-strategies"})}),children:[s.jsxs(J,{children:[s.jsx(iLe,{}),s.jsxs(ta,{...y(),children:[s.jsx(ea,{headerGroups:S}),s.jsx(Ts,{...w(),children:j.map(z=>{E(z);const{key:B,...L}=z.getRowProps();return s.jsx(Mi,{hover:!0,...L,children:z.cells.map(I=>{const{key:q,...ee}=I.getCellProps();return s.jsx(es,{...ee,children:I.render("Cell")},q)})},B)})})]}),s.jsx(X,{condition:j.length===0,show:s.jsx($r,{children:"No strategies available."})})]}),s.jsx(Gn,{open:t.show,onClick:D,title:t==null?void 0:t.title,onClose:()=>n(z=>({...z,show:!1}))})]}),s.jsxs(cr,{isLoading:i,header:s.jsx(Pn,{children:s.jsx(jD,{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/reference/custom-activation-strategies"})}),sx:{mt:2},children:[s.jsxs(J,{children:[s.jsx(CD,{children:s.jsx("span",{children:"Advanced strategies"})}),s.jsxs(ta,{...C(),children:[s.jsx(ea,{headerGroups:k}),s.jsx(Ts,{...T(),children:_.map(z=>{A(z);const{key:B,...L}=z.getRowProps();return s.jsx(Mi,{hover:!0,...L,children:z.cells.map(I=>{const{key:q,...ee}=I.getCellProps();return s.jsx(es,{...ee,children:I.render("Cell")},q)})},B)})})]}),s.jsx(X,{condition:_.length===0,show:s.jsx($r,{children:"No advanced strategies available."})})]}),s.jsxs(J,{children:[s.jsxs(CD,{sx:{mt:4},children:[s.jsx("span",{children:"Custom strategies"}),s.jsx(tLe,{})]}),s.jsx(oLe,{}),s.jsxs(ta,{...O(),children:[s.jsx(ea,{headerGroups:H}),s.jsx(Ts,{...M(),children:P.map(z=>{$(z);const{key:B,...L}=z.getRowProps();return s.jsx(Mi,{hover:!0,...L,children:z.cells.map(I=>{const{key:q,...ee}=I.getCellProps();return s.jsx(es,{...ee,children:I.render("Cell")},q)})},B)})})]}),s.jsx(X,{condition:P.length===0,show:s.jsx(pJ,{})})]}),s.jsx(Gn,{open:t.show,onClick:D,title:t==null?void 0:t.title,onClose:()=>n(z=>({...z,show:!1}))})]})]})};var ZA={},aLe=Te;Object.defineProperty(ZA,"__esModule",{value:!0});var fJ=ZA.default=void 0,lLe=aLe(ke()),cLe=s,uLe=(0,lLe.default)((0,cLe.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");fJ=ZA.default=uLe;const SC=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},dLe=(e={})=>{const t=async()=>{const c=bt("api/admin/tag-types");return(await fetch(c,{method:"GET"}).then(Jt("Tag types"))).json()},n="api/admin/tag-types",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=()=>{Io(n)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{tagTypes:(r==null?void 0:r.tagTypes)||[],error:o,loading:i,refetch:l}},pLe=()=>{const e=Ot(),t=Xn("(max-width:700px)");return s.jsx(X,{condition:t,show:s.jsx(Wo,{onClick:()=>e("/tag-types/create"),size:"large",permission:dT,children:s.jsx(Oo,{})}),elseShow:s.jsx(Ro,{permission:dT,onClick:()=>e("/tag-types/create"),children:"New tag type"})})},fLe=x("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}`})),hLe=()=>{const[e,t]=m.useState({open:!1}),n=Ot(),{deleteTagType:r}=SC(),{tagTypes:o,refetch:i,loading:a}=dLe(),{setToastData:l,setToastApiError:c}=Nt(),u=m.useMemo(()=>a?Array(5).fill({name:"Tag type name",description:"Tag type description when loading"}):o.map(({name:j,description:E,color:C})=>({name:j,description:E,color:C})),[o,a]),d=m.useMemo(()=>[{id:"Icon",Cell:()=>s.jsx(J,{"data-loading":!0,sx:{pl:2,pr:1,display:"flex",alignItems:"center"},children:s.jsx(fJ,{color:"disabled"})}),disableGlobalFilter:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:j,description:E,color:C}}})=>s.jsxs(J,{sx:{display:"flex",alignItems:"center"},children:[s.jsx(X,{condition:!!C,show:s.jsx(fLe,{$color:C})}),s.jsx(Rl,{"data-loading":!0,title:j,subtitle:E})]}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:j}})=>s.jsxs(J,{sx:{display:"flex",justifyContent:"flex-end"},"data-loading":!0,children:[s.jsx(Wo,{onClick:()=>n(`/tag-types/edit/${j.name}`),permission:dX,tooltipProps:{title:"Edit tag type"},children:s.jsx(ns,{})}),s.jsx(Wo,{permission:W9e,tooltipProps:{title:"Delete tag type"},onClick:()=>t({open:!0,name:j.name}),children:s.jsx(Po,{})})]}),width:150,disableGlobalFilter:!0,disableSortBy:!0},{accessor:"description",disableSortBy:!0}],[n]),p=m.useMemo(()=>({sortBy:[{id:"name",desc:!1}],hiddenColumns:["description"]}),[]),{getTableProps:f,getTableBodyProps:h,headerGroups:g,rows:v,prepareRow:b,state:{globalFilter:y},setGlobalFilter:w}=Zt.useTable({columns:d,data:u,initialState:p,sortTypes:yi,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},Zt.useGlobalFilter,Zt.useSortBy),S=async()=>{try{e.name&&(await r(e.name),i(),t({open:!1}),l({type:"success",show:!0,text:"Tag type deleted"}))}catch(j){c(Tt(j))}};return s.jsxs(cr,{isLoading:a,header:s.jsx(Pn,{title:`Tag types (${v.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:y,onChange:w}),s.jsx(Pn.Divider,{}),s.jsx(pLe,{})]})}),children:[s.jsx(is,{value:y,children:s.jsxs(ta,{...f(),children:[s.jsx(ea,{headerGroups:g}),s.jsx(Ts,{...h(),children:v.map(j=>{b(j);const{key:E,...C}=j.getRowProps();return s.jsx(Mi,{hover:!0,...C,children:j.cells.map(T=>{const{key:k,..._}=T.getCellProps();return s.jsx(es,{..._,children:T.render("Cell")},k)})},E)})})]})}),s.jsx(X,{condition:v.length===0,show:s.jsx(X,{condition:(y==null?void 0:y.length)>0,show:s.jsxs($r,{children:["No tags found matching “",y,"”"]}),elseShow:s.jsx($r,{children:"No tags available. Get started by adding one."})})}),s.jsx(Gn,{title:"Really delete Tag type?",open:e.open,onClick:S,onClose:()=>{t({open:!1})}})]})},ry=(e={})=>{const t=async()=>{const c=bt("api/admin/addons");return(await fetch(c,{method:"GET"}).then(Jt("Addons"))).json()},n="api/admin/addons",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=m.useCallback(()=>{Io(n)},[n]);return m.useEffect(()=>{a(!o&&!r)},[r,o]),{addons:(r==null?void 0:r.addons)||[],providers:(r==null?void 0:r.providers)||[],error:o,loading:i,refetchAddons:l}};var e9={},gLe=Te;Object.defineProperty(e9,"__esModule",{value:!0});var hJ=e9.default=void 0,mLe=gLe(ke()),vLe=s,yLe=(0,mLe.default)((0,vLe.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");hJ=e9.default=yLe;const U2=e=>e.charAt(0).toUpperCase()+e.slice(1),xLe="/static/datadog-D7T0xtkO.svg",bLe="/static/new-relic-BupjBFL1.svg",wLe="/static/jira-l0bo9uCD.svg",SLe="/static/jira-comment-Di5ugPYV.svg",CLe="/static/signals-CAlQRJwW.svg",jLe="/static/terraform-Eb_8o2u1.svg",ED="/static/slack-t0fNwPed.svg",ELe="/static/teams-DvQx_FzB.svg",TLe="/static/webhooks-Cnts0gfu.svg",kLe="/static/unleash-integration-Ctxqm5Ve.svg",_Le="/static/Logo-android-C52ktdfV.svg",RLe="/static/Logo-net-BsbSafnp.svg",PLe="/static/Logo-flutter-B4Npq361.svg",ALe="/static/Logo-go-DsgFcp5h.svg",ILe="/static/Logo-swift-B2XvejNd.svg",$Le="/static/Logo-java-DnZJK2S1.svg",OLe="/static/Logo-javascript-Uv1If6qs.svg",MLe="/static/Logo-node-CHfuizy_.svg",DLe="/static/Logo-php-Bn8RVcvR.svg",LLe="/static/Logo-python-D_jhkoJJ.svg",FLe="/static/Logo-react-D2SuVol5.svg",NLe="/static/Logo-ruby-BlkEeyzc.svg",BLe="/static/Logo-rust-DZ1V0dgh.svg",zLe="/static/Logo-svelte-B-fbfLhe.svg",HLe="/static/Logo-vue-Bc1zMJ6g.svg",Y3=x(IS)(({theme:e})=>({background:"transparent",marginRight:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(4),height:e.spacing(4),fontSize:"28px"})),WLe={datadog:{title:"Datadog",icon:xLe},"new-relic":{title:"New Relic",icon:bLe},jira:{title:"Jira",icon:wLe},"jira-comment":{title:"Jira",icon:SLe},signals:{title:"Signals",icon:CLe},terraform:{title:"Terraform",icon:jLe},slack:{title:"Slack",icon:ED},"slack-app":{title:"Slack",icon:ED},teams:{title:"Teams",icon:ELe},webhook:{title:"Webhook",icon:TLe},unleash:{title:"Unleash",icon:kLe},android:{title:"Android",icon:_Le},dotnet:{title:"Dotnet",icon:RLe},flutter:{title:"Flutter",icon:PLe},go:{title:"Go",icon:ALe},swift:{title:"Swift",icon:ILe},java:{title:"Java",icon:$Le},javascript:{title:"Javascript",icon:OLe},node:{title:"Node",icon:MLe},php:{title:"PHP",icon:DLe},python:{title:"Python",icon:LLe},react:{title:"React",icon:FLe},ruby:{title:"Ruby",icon:NLe},rust:{title:"Rust",icon:BLe},svelte:{title:"Svelte",icon:zLe},vue:{title:"Vue",icon:HLe}},gJ=({name:e})=>{const t=WLe[e];return t?typeof t.icon=="string"?s.jsx(Y3,{src:ti(t.icon),alt:`${U2(t.title)} icon`,variant:"rounded"}):s.jsx(Y3,{alt:`${U2(t.title)} icon`,variant:"rounded",children:t.icon}):s.jsx(Y3,{variant:"rounded",children:s.jsx(hJ,{})})};var t9={},VLe=Te;Object.defineProperty(t9,"__esModule",{value:!0});var n9=t9.default=void 0,ULe=VLe(ke()),GLe=s,qLe=(0,ULe.default)((0,GLe.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");n9=t9.default=qLe;var r9={},YLe=Te;Object.defineProperty(r9,"__esModule",{value:!0});var pm=r9.default=void 0,KLe=YLe(ke()),XLe=s,JLe=(0,KLe.default)((0,XLe.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");pm=r9.default=JLe;const o9=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),o="api/admin/addons",i=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=m.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:i,updateAddon:l,removeAddon:a,errors:n,loading:r}};var i9={},QLe=Te;Object.defineProperty(i9,"__esModule",{value:!0});var oy=i9.default=void 0,ZLe=QLe(ke()),eFe=s,tFe=(0,ZLe.default)((0,eFe.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");oy=i9.default=tFe;const Cd=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:i})=>{const{hasAccess:a}=m.useContext($o);let l;return t&&r?l=a(e,t,r):t?l=a(e,t):l=a(e),s.jsx(Qa,{...i,title:oC(l,o),children:n({hasAccess:l})})},TD=250,mJ=x("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})),nFe=x(mJ)({width:1300}),rFe=x($t)(({theme:e})=>({zIndex:1,position:"absolute",top:e.spacing(3),right:e.spacing(3)})),s9=({open:e,onClose:t,onClick:n,label:r,children:o})=>s.jsx(W0,{open:e,onClose:t,onClick:n,closeAfterTransition:!0,"aria-label":r,BackdropComponent:dR,BackdropProps:{timeout:TD},"data-testid":Rje,sx:{minHeight:"100vh"},children:s.jsx(z0,{timeout:TD,in:e,children:o})}),Za=e=>s.jsx(s9,{...e,children:s.jsx(nFe,{children:e.children})}),wLt=e=>s.jsx(s9,{...e,children:s.jsxs(mJ,{children:[s.jsx(kt,{title:"Close",arrow:!0,describeChild:!0,children:s.jsx(rFe,{onClick:e.onClose,children:s.jsx(Ho,{})})}),e.children]})}),oFe=()=>{},iFe=oFe(),yT=Object,kD=e=>e===iFe,sFe=e=>typeof e=="function",Rx=new WeakMap,K3=(e,t)=>yT.prototype.toString.call(e)===`[object ${t}]`;let aFe=0;const xT=e=>{const t=typeof e,n=K3(e,"Date"),r=K3(e,"RegExp"),o=K3(e,"Object");let i,a;if(yT(e)===e&&!n&&!r){if(i=Rx.get(e),i)return i;if(i=++aFe+"~",Rx.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=xT(e[a])+",";Rx.set(e,i)}if(o){i="#";const l=yT.keys(e).sort();for(;!kD(a=l.pop());)kD(e[a])||(i+=a+":"+xT(e[a])+",");Rx.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},lFe=e=>{if(sFe(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?xT(e):"",[e,t]},cFe=e=>lFe(e?e(0,null):null)[0],X3=Promise.resolve(),uFe=e=>(t,n,r)=>{const o=m.useRef(!1),{cache:i,initialSize:a=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:p=!1}=r,[,,,f]=uc.get(zS);let h;try{h=cFe(t),h&&(h=Gq+h)}catch{}const[g,v,b]=id(i,h),y=m.useCallback(()=>Tn(g()._l)?a:g()._l,[i,h,a]);Lq.useSyncExternalStore(m.useCallback(k=>h?b(h,()=>{k()}):()=>{},[i,h]),y,y);const w=m.useCallback(()=>{const k=g()._l;return Tn(k)?a:k},[h,a]),S=m.useRef(w());t1(()=>{if(!o.current){o.current=!0;return}h&&v({_l:c?S.current:w()})},[h,i]);const j=d&&!o.current,E=e(h,async k=>{const _=g()._i,A=g()._r;v({_r:Xo});const O=[],M=w(),[H]=id(i,k),P=H().data,$=[];let D=null;for(let z=0;z<M;++z){const[B,L]=Z1(t(z,p?null:D));if(!B)break;const[I,q]=id(i,B);let ee=I().data;const W=l||_||Tn(ee)||u&&!z&&!Tn(P)||j||P&&!Tn(P[z])&&!r.compare(P[z],ee);if(n&&(typeof A=="function"?A(ee,L):W)){const oe=async()=>{if(!(B in f))ee=await n(L);else{const ce=f[B];delete f[B],ee=await ce}q({data:ee,_k:L}),O[z]=ee};p?$.push(oe):await oe()}else O[z]=ee;p||(D=ee)}return p&&await Promise.all($.map(z=>z())),v({_i:Xo}),O},r),C=m.useCallback(function(k,_){const A=typeof _=="boolean"?{revalidate:_}:_||{},O=A.revalidate!==!1;return h?(O&&(Tn(k)?v({_i:!0,_r:A.revalidate}):v({_i:!1,_r:A.revalidate})),arguments.length?E.mutate(k,{...A,revalidate:O}):E.mutate()):X3},[h,i]),T=m.useCallback(k=>{if(!h)return X3;const[,_]=id(i,h);let A;if(Ia(k)?A=k(w()):typeof k=="number"&&(A=k),typeof A!="number")return X3;_({_l:A}),S.current=A;const O=[],[M]=id(i,h);let H=null;for(let P=0;P<A;++P){const[$]=Z1(t(P,H)),[D]=id(i,$),z=$?D().data:Xo;if(Tn(z))return C(M().data);O.push(z),H=z}return C(O)},[h,i,C,w]);return{size:w(),setSize:T,mutate:C,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}},vJ=ECe(_n,uFe),dFe=async e=>{const t=await fetch(e);return await Jt("Integration events")(t),t.json()},yJ=(e,t=50,n={})=>{var b;const{isAdmin:r}=m.useContext($o),o=(y,w)=>!e||!r||w&&!w.integrationEvents.length?null:bt(`api/admin/addons/${e}/events?limit=${t}&offset=${y*t}`),{data:i,error:a,size:l,setSize:c,mutate:u}=vJ(o,dFe,{...n,revalidateAll:!0}),d=i?i.flatMap(({integrationEvents:y})=>y):[],p=!i&&!a,f=l>0&&!(i!=null&&i[l-1]),h=p||f,g=((b=i==null?void 0:i[l-1])==null?void 0:b.integrationEvents.length)===t;return{integrationEvents:d,hasMore:g,loadMore:()=>{h||!g||c(l+1)},loading:h,refetch:()=>u(),error:a}},pFe=x("div")(({theme:e})=>({backgroundColor:e.palette.codebox,padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium,position:"relative",maxHeight:"500px",overflow:"auto"})),fFe=x("pre")(({theme:e})=>({margin:0,wordBreak:"break-all",whiteSpace:"pre-wrap",color:e.palette.common.white,fontSize:e.fontSizes.smallBody})),hFe=({text:e})=>s.jsx(pFe,{children:s.jsx(fFe,{children:e})});var a9={},gFe=Te;Object.defineProperty(a9,"__esModule",{value:!0});var oh=a9.default=void 0,mFe=gFe(ke()),vFe=s,yFe=(0,mFe.default)((0,vFe.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");oh=a9.default=yFe;var l9={},xFe=Te;Object.defineProperty(l9,"__esModule",{value:!0});var xJ=l9.default=void 0,bFe=xFe(ke()),wFe=s,SFe=(0,bFe.default)((0,wFe.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");xJ=l9.default=SFe;const CFe="/static/unleashLogoIconDarkAlpha-BbvuC13D.gif",jFe=x("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})),EFe=x("img")(({theme:e})=>({width:"100px",height:"100px"})),o0=({type:e="inline"})=>s.jsx(jFe,{role:"alert","aria-label":"Loading",type:e,children:s.jsx(EFe,{src:ti(CFe),alt:""})});var TFe=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()}},kFe=TFe,_D={"text/plain":"Text","text/html":"Url",default:"Text"},_Fe="Copy to clipboard: #{key}, Enter";function RFe(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function PFe(e,t){var n,r,o,i,a,l,c=!1;t||(t={}),n=t.debug||!1;try{o=kFe(),i=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=_D[t.format]||_D.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),i.selectNodeContents(l),a.addRange(i);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=RFe("message"in t?t.message:_Fe),window.prompt(r,e)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return c}var AFe=PFe;const CC=Vo(AFe),IFe=e=>m.createElement("svg",{width:48,height:50,viewBox:"0 0 48 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),bJ=36,$Fe=100-bJ,wJ=`${bJ}%`,OFe="420px",MFe=`${$Fe}%`,DFe=x("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}})),LFe=x("div",{shouldForwardProp:e=>!["guidanceHeight"].includes(e.toString())})(({theme:e,guidanceHeight:t})=>({...OSe,...t?{aside:{height:t}}:{}})),FFe=x("div",{shouldForwardProp:e=>e!=="useFixedSidebar"})(({theme:e,useFixedSidebar:t})=>({display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,width:t?"initial":MFe,[e.breakpoints.down(1100)]:{width:"100%"}})),NFe=x("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),i=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:i,paddingBlock:a,"--form-content-padding":i}}}),BFe=x("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)}})),zFe=x("h1")(({theme:e})=>({marginBottom:e.fontSizes.mainHeader,fontWeight:"normal"})),HFe=x(jr)(({theme:e})=>({opacity:.3,marginBottom:e.spacing(.5)})),WFe=x("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})),VFe=x(oh)(({theme:e})=>({fill:e.palette.primary.contrastText})),UFe=x("div")(()=>({zIndex:1,position:"absolute",right:-3,top:-3})),GFe=x(IFe)(()=>({width:"75px",height:"75px"})),qFe=x($t)(()=>({position:"absolute",zIndex:400,right:0})),YFe=x(xJ)(({theme:e})=>({fill:e.palette.primary.contrastText})),SJ=x("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||wJ,[e.breakpoints.down(1100)]:{width:"100%"},[e.breakpoints.down(500)]:{padding:e.spacing(4,2)},...n?{pre:{height:n}}:{}})),KFe=x("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)})),XFe=x("div")(()=>({width:"100%"})),JFe=x("div")(({theme:e})=>({margin:e.spacing(3,0),display:"flex",alignItems:"center",width:"100%"})),QFe=x(VS)(({theme:e})=>({marginRight:e.spacing(1),color:e.palette.primary.contrastText})),ZFe=x("a")(({theme:e})=>({color:e.palette.primary.contrastText,display:"block","&:hover":{textDecoration:"none"}})),Fr=({title:e,description:t,children:n,documentationLink:r,documentationIcon:o,documentationLinkLabel:i,loading:a,modal:l,formatApiCode:c,disablePadding:u,compactPadding:d=!1,showDescription:p=!0,showLink:f=!0,footer:h,compact:g,showGuidance:v=!0,useFixedSidebar:b})=>{const{setToastData:y}=Nt(),w=Xn("(max-width:1099px)"),S=()=>{c!==void 0&&(CC(c())?y({text:"Command copied",autoHideDuration:6e3,type:"success",show:!0}):y({text:"Could not copy the command",autoHideDuration:6e3,type:"error",show:!0}))},j=(C,T=!1)=>{if(!C)return s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!T,show:s.jsx(HFe,{})}),s.jsxs(WFe,{children:["API Command"," ",s.jsx(kt,{title:"Copy command",arrow:!0,children:s.jsx($t,{onClick:S,size:"large",children:s.jsx(VFe,{})})})]}),s.jsx(hFe,{text:c()})," "]})},E=b?tNe:jJ;return s.jsxs(DFe,{modal:l,compact:g,children:[s.jsx(X,{condition:v&&w,show:s.jsx(LFe,{guidanceHeight:b?"240px":void 0,children:s.jsx(eNe,{description:t,documentationIcon:o,documentationLink:r,documentationLinkLabel:i})})}),s.jsxs(FFe,{useFixedSidebar:b,children:[s.jsx(NFe,{disablePadding:u,compactPadding:d,children:s.jsx(X,{condition:a||!1,show:s.jsx(o0,{}),elseShow:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e!==void 0,show:s.jsx(zFe,{children:e})}),n]})})}),s.jsx(X,{condition:h!==void 0,show:()=>s.jsxs(s.Fragment,{children:[s.jsx(jr,{}),s.jsx(BFe,{children:h})]})})]}),s.jsx(X,{condition:v&&!w,show:s.jsx(E,{documentationIcon:o,description:t,documentationLink:r,documentationLinkLabel:i,showDescription:p,showLink:f,children:j(c===void 0,!(p||f))})})]})},eNe=({description:e,documentationLink:t,documentationLinkLabel:n,documentationIcon:r})=>{const[o,i]=m.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(UFe,{children:s.jsx(GFe,{})}),s.jsx(kt,{title:"Toggle help",arrow:!0,children:s.jsx(qFe,{onClick:()=>i(a=>!a),size:"large",children:s.jsx(YFe,{})})}),s.jsx(tR,{in:o,timeout:500,children:s.jsx(jJ,{documentationIcon:r,description:e,documentationLink:t,documentationLinkLabel:n})})]})},CJ=({description:e,children:t,documentationLink:n,documentationIcon:r,documentationLinkLabel:o="Learn more",showDescription:i=!0,showLink:a=!0,fixedDocumentationHeight:l})=>{const c=x("div")({height:"2rem",display:"grid",placeItems:"center"}),u=x("div")({height:l,overflowY:"auto"}),d=l?u:Je.Fragment;return s.jsxs(s.Fragment,{children:[s.jsxs(d,{children:[s.jsx(X,{condition:i,show:s.jsxs(KFe,{children:[s.jsx(X,{condition:!!r,show:s.jsx(c,{children:r})}),s.jsx(XFe,{children:e})]})}),s.jsx(X,{condition:a&&!!n,show:s.jsxs(JFe,{children:[s.jsx(QFe,{}),s.jsx(ZFe,{href:n,rel:"noopener noreferrer",target:"_blank",children:o})]})})]}),t]})},jJ=e=>s.jsx(SJ,{children:s.jsx(CJ,{...e})}),tNe=e=>s.jsx(SJ,{sidebarWidth:OFe,fixedCodeHeight:"300px",children:s.jsx(CJ,{...e,fixedDocumentationHeight:"170px"})}),nNe=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",borderTopLeftRadius:e.shape.borderRadiusMedium,borderTopRightRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.table.headerBackground})),RD=x("div",{shouldForwardProp:e=>e!=="maxWidth"})(({maxWidth:e})=>({display:"flex",flex:1,...e&&{maxWidth:e}})),rNe=({columns:e,sidePanelHeader:t,leftPanelMaxWidth:n})=>s.jsxs(nNe,{children:[s.jsx(RD,{maxWidth:n,children:e.map(({header:r,maxWidth:o,align:i})=>s.jsx(bT,{maxWidth:o,align:i,children:r},r))}),s.jsx(RD,{children:s.jsx(bT,{children:t})})]}),oNe=x("div")(({theme:e})=>({borderBottom:`1px solid ${e.palette.divider}`})),iNe=x(Ue,{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}`}})),sNe=({selected:e,onClick:t,children:n})=>s.jsx(oNe,{children:s.jsx(iNe,{selected:e,onClick:t,children:n})}),aNe=x("div")({display:"flex",flexDirection:"column",width:"100%"}),lNe=x("div")({display:"flex",flexDirection:"row"}),EJ=x("div")({display:"flex",flexDirection:"column",flex:1}),cNe=x(EJ,{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}})),uNe=x(EJ)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderLeft:0,borderBottomRightRadius:e.shape.borderRadiusMedium})),bT=x("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"})),TJ=({items:e,columns:t,sidePanelHeader:n,renderContent:r,renderItem:o=(l,c)=>c,height:i,listEnd:a})=>{const[l,c]=m.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 s.jsxs(aNe,{children:[s.jsx(rNe,{columns:t,sidePanelHeader:n,leftPanelMaxWidth:d}),s.jsxs(lNe,{children:[s.jsxs(cNe,{height:i,maxWidth:d,children:[e.map(p=>o(p,s.jsx(sNe,{selected:u.id===p.id,onClick:()=>c(p),children:t.map(({header:f,maxWidth:h,align:g,cell:v})=>s.jsx(bT,{maxWidth:h,align:g,children:v(p)},f))},p.id))),a]}),s.jsx(uNe,{children:r(u)})]})]})};var c9={},dNe=Te;Object.defineProperty(c9,"__esModule",{value:!0});var u9=c9.default=void 0,pNe=dNe(ke()),fNe=s,hNe=(0,pNe.default)((0,fNe.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");u9=c9.default=hNe;var d9={},gNe=Te;Object.defineProperty(d9,"__esModule",{value:!0});var kJ=d9.default=void 0,mNe=gNe(ke()),vNe=s,yNe=(0,mNe.default)((0,vNe.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");kJ=d9.default=yNe;var p9={},xNe=Te;Object.defineProperty(p9,"__esModule",{value:!0});var jC=p9.default=void 0,bNe=xNe(ke()),PD=s,wNe=(0,bNe.default)([(0,PD.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2z"},"0"),(0,PD.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");jC=p9.default=wNe;const SNe=x(u9)(({theme:e})=>({color:e.palette.success.main})),CNe=x(kJ)(({theme:e})=>({color:e.palette.error.main})),jNe=x(jC)(({theme:e})=>({color:e.palette.warning.main})),_J=({state:e})=>e==="success"?s.jsx(SNe,{}):e==="failed"?s.jsx(CNe,{}):s.jsx(jNe,{}),ENe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),TNe=function(e){return"/"+e},AD={},va=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=TNe(c),c in AD)return;AD[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":ENe,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 i(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"&&i(l.reason);return t().catch(i)})},kNe=x(Dc)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),_Ne=x(Fc)({lineHeight:"1.5rem"}),RNe=({header:e,children:t})=>s.jsxs(kNe,{children:[s.jsx(_Ne,{expandIcon:s.jsx($t,{children:s.jsx(ha,{titleAccess:"Toggle"})}),children:e}),s.jsx(Lc,{children:t})]}),ID=m.lazy(()=>va(()=>import("./ReactJSONEditor-BDMT4-_1.js"),[])),PNe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),ANe=x(Lt)({fontSize:"inherit",lineBreak:"anywhere"}),INe=x(xt)(({theme:e})=>({marginLeft:e.spacing(1)})),RJ=({state:e,stateDetails:t,event:n,details:r})=>{const o=e==="failed"?"error":e==="success"?"success":"warning",i=e==="success"?s.jsx(u9,{}):void 0;return s.jsxs(PNe,{children:[s.jsx(ANe,{severity:o,icon:i,children:t}),s.jsx(RNe,{header:s.jsxs(s.Fragment,{children:["Event:",s.jsx(INe,{to:"/history",children:n.type})]}),children:s.jsx(m.Suspense,{fallback:null,children:s.jsx(ID,{content:{json:n},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})}),s.jsx(m.Suspense,{fallback:null,children:s.jsx(ID,{content:{json:r},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})]})},$Ne=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),$D=x("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),ONe=x("h1")({fontWeight:"normal"}),MNe=x("h2")(({theme:e})=>({marginTop:e.spacing(1.5),fontSize:e.fontSizes.smallBody,fontWeight:"normal"})),DNe=x("form")({display:"flex",flexDirection:"column",height:"100%"}),LNe=x("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),FNe=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),PJ=({addon:e,open:t,setOpen:n})=>{const r=Ot(),{locationSettings:o}=wo(),{integrationEvents:i,hasMore:a,loadMore:l,loading:c}=yJ(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 s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:u,children:s.jsxs(Fr,{loading:c&&i.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[s.jsxs($Ne,{children:[s.jsxs($D,{children:[s.jsx(ONe,{children:u}),s.jsx(kn,{onClick:()=>{n(!1),r(`/integrations/edit/${e.id}`)},children:"View configuration"})]}),s.jsx($D,{children:s.jsx(MNe,{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."})})]}),s.jsxs(DNe,{children:[s.jsx(TJ,{height:960,items:i,columns:[{header:"Status",align:"center",maxWidth:100,cell:_J},{header:"Date",maxWidth:240,cell:({createdAt:d})=>Ja(d,o==null?void 0:o.locale)}],sidePanelHeader:"Details",renderContent:RJ,renderItem:({id:d,state:p},f)=>p==="failed"?s.jsx(LNe,{children:f},d):f,listEnd:s.jsx(X,{condition:a,show:s.jsx(Ue,{onClick:l,children:"Load more"})})}),s.jsx(X,{condition:i.length===0,show:s.jsx("p",{children:"No events have been registered for this integration configuration."})}),s.jsx(FNe,{children:s.jsx(Ue,{onClick:()=>n(!1),children:"Close"})})]})]})})},NNe=x("div")(({theme:e})=>({marginLeft:e.spacing(1),marginTop:e.spacing(-1),marginBottom:e.spacing(-1),marginRight:e.spacing(-1),display:"flex",alignItems:"center"})),BNe=({addon:e})=>{const[t,n]=m.useState(!1),[r,o]=m.useState(!1),[i,a]=m.useState(!1),[l,c]=m.useState(null),{updateAddon:u,removeAddon:d}=o9(),{refetchAddons:p}=ry(),{setToastData:f,setToastApiError:h}=Nt(),[g,v]=m.useState(!1),b=()=>{n(!1),c(null)},y=C=>{t?b():(c(C.currentTarget),n(!0))},w=Nf(pX),S=Nf(fX),j=m.useCallback(async()=>{try{await u({...e,enabled:!e.enabled}),p(),f({type:"success",text:e.enabled?"Integration disabled":"Integration enabled"})}catch(C){h(Tt(C))}},[h,p,f,u]),E=m.useCallback(async()=>{try{await d(e.id),p(),f({type:"success",text:"Integration deleted"})}catch(C){h(Tt(C))}},[h,p,f,d]);return s.jsxs(NNe,{onClick:C=>C.preventDefault(),children:[s.jsx(kt,{title:"More actions",arrow:!0,children:s.jsx($t,{onClick:y,size:"small","aria-controls":t?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":t?"true":void 0,"data-loading":!0,children:s.jsx(pm,{sx:{width:32,height:32}})})}),s.jsxs(MS,{id:"project-card-menu",open:!!l,anchorEl:l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},onClose:y,children:[s.jsx(Cd,{permission:ts,children:({hasAccess:C})=>s.jsxs(Cr,{onClick:()=>v(!0),disabled:!C,children:[s.jsx(Zo,{children:s.jsx(oy,{})}),s.jsx(dn,{children:"View events"})]})}),s.jsxs(Cr,{onClick:()=>{a(!0),b()},disabled:!w,children:[s.jsx(Zo,{children:s.jsx(bC,{})}),s.jsx(dn,{children:e.enabled?"Disable":"Enable"})]})," ",s.jsxs(Cr,{disabled:!S,onClick:()=>{o(!0),b()},children:[s.jsx(Zo,{children:s.jsx(Po,{})}),s.jsx(dn,{children:"Delete"})]})]}),s.jsx(PJ,{addon:e,open:g,setOpen:v}),s.jsx(Gn,{open:i,onClick:j,onClose:()=>a(!1),title:e.enabled?"Disable integration?":"Enable integration?",children:s.jsxs("div",{children:[e.enabled?"Disabling":"Enabling"," this integration will"," ",e.enabled?"prevent it from sending updates":"allow it to send updates"]})}),s.jsx(Gn,{open:r,onClick:E,onClose:()=>o(!1),title:"Delete integration?",children:s.jsx(Lt,{severity:"warning",children:"Deleting this integration instance will delete all its configuration. It will stop working immediately."})})]})},zNe=x(kn,{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"})),ih=({tooltip:e,highlighted:t,tooltipProps:n,children:r,...o})=>s.jsx(hr,{title:e,...n,arrow:!0,children:s.jsx(zNe,{tabIndex:0,highlighted:t,...o,children:r})}),HNe=x(ih)({display:"flex",alignItems:"center"}),WNe=x("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),VNe=x("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),UNe=({integration:e,...t})=>{const{integrationEvents:n}=yJ(e==null?void 0:e.id,1,{refreshInterval:5e3}),{locationSettings:r}=wo();if(n.length===0)return null;const o=n[0];return s.jsx(J,{onClick:i=>i.preventDefault(),...t,children:s.jsx(HNe,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:s.jsxs(s.Fragment,{children:[s.jsxs(WNe,{children:[s.jsx(VNe,{children:"Last event"}),s.jsx("span",{children:Ja(o.createdAt,r==null?void 0:r.locale)})]}),s.jsx(RJ,{...o})]}),children:s.jsx(_J,{...o})})})},GNe=x("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}}})),OD=x(kn)({textDecoration:"none",color:"inherit",textAlign:"left"}),qNe=x(xt)({textDecoration:"none",color:"inherit"}),YNe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),KNe=x(Z)(()=>({display:"flex",alignItems:"center",marginRight:"auto"})),XNe=x(Z)(({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)})),JNe=x(q0)(({theme:e})=>({fontSize:e.fontSizes.bodySize})),ou=({variant:e="default",icon:t,title:n,description:r,isEnabled:o,configureActionText:i="Configure",link:a,onClick:l,addon:c,deprecated:u,isExternal:d=!1})=>{const{trackEvent:p}=Kt(),f=c!==void 0,h=()=>{p("open-integration",{props:{integrationName:n,isConfigured:f}})},g=s.jsxs(GNe,{variant:e,children:[s.jsxs(YNe,{children:[s.jsxs(KNe,{variant:"h3","data-loading":!0,children:[s.jsx(gJ,{name:t})," ",n]}),s.jsx(X,{condition:u!==void 0,show:s.jsx(kt,{title:u,arrow:!0,children:s.jsx(sn,{"data-loading":!0,children:"Deprecated"})})}),s.jsx(X,{condition:o===!0,show:s.jsx(sn,{color:"success","data-loading":!0,children:"Enabled"})}),s.jsx(X,{condition:o===!1,show:s.jsx(sn,{"data-loading":!0,children:"Disabled"})}),s.jsx(X,{condition:f,show:s.jsx(BNe,{addon:c})})]}),s.jsx(Z,{variant:"body2",color:"text.secondary","data-loading":!0,children:r}),s.jsxs(XNe,{"data-loading":!0,children:[i,s.jsx(X,{condition:d,show:s.jsx(JNe,{}),elseShow:s.jsx(n9,{})}),s.jsx(UNe,{integration:c,sx:{ml:"auto"}})]})]});return l?s.jsx(OD,{component:"button",onClick:()=>{h(),l()},children:g}):d?s.jsx(OD,{href:a,target:"_blank",rel:"noreferrer",onClick:h,children:g}):s.jsx(qNe,{to:a,onClick:h,children:g})};var f9={},QNe=Te;Object.defineProperty(f9,"__esModule",{value:!0});var EC=f9.default=void 0,ZNe=QNe(ke()),eBe=s,tBe=(0,ZNe.default)((0,eBe.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");EC=f9.default=tBe;const nBe="/static/cr-DbjGV9Hl.png",rBe="/static/cr-DbjGV9Hl.png",oBe="/static/cr-DbjGV9Hl.png",iBe=x("figure")(({theme:e})=>({display:"flex",gap:e.spacing(2),margin:e.spacing(2,0),flexDirection:"column"})),sBe=x("figcaption")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexDirection:"column"})),aBe=x("img")({maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"}),J3=({title:e,description:t,src:n})=>s.jsxs(iBe,{children:[s.jsxs(sBe,{children:[s.jsx(Z,{variant:"h3",children:e}),s.jsx(Z,{children:t})]}),s.jsx(aBe,{src:ti(n),alt:e})]}),lBe=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",gap:e.spacing(2),marginTop:e.spacing(1)})),cBe=x("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),h9=x("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),uBe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),dBe=x("div")({display:"flex",justifyContent:"flex-end"}),pBe=x("section")(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(2)})),MD=x(xn)(({theme:e})=>({width:"100%"})),TC=m.forwardRef(({children:e},t)=>s.jsx(Z,{ref:t,component:"h4",variant:"h4",sx:n=>({margin:n.spacing(1,0)}),children:e})),fBe=x("div")({marginTop:"25px"}),hBe=x("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)})),wT=({...e})=>s.jsx(Lr,{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}),DD=["http","https","mailto","tel"];function gBe(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<DD.length;){const i=DD[o];if(r===i.length&&t.slice(0,i.length).toLowerCase()===i)return t}return o=t.indexOf("?"),o!==-1&&r>o||(o=t.indexOf("#"),o!==-1&&r>o)?t:"javascript:void(0)"}/*!
299
+ `));const t=m.useMemo(()=>on({},f6e,e.localeText),[e.localeText]);return m.useMemo(()=>on({},e,{localeText:t}),[e,t])},ss=()=>gC().utils,PA=()=>gC().defaultDates,mC=e=>{const t=ss(),n=m.useRef(void 0);return n.current===void 0&&(n.current=t.date(void 0,e)),n.current},$X=()=>gC().localeText,h6e=Dr(s.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),g6e=Dr(s.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),m6e=Dr(s.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");Dr(s.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");Dr(s.jsxs(m.Fragment,{children:[s.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"}),s.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");Dr(s.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");Dr(s.jsxs(m.Fragment,{children:[s.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"}),s.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time");Dr(s.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 v6e(e){return il("MuiPickersArrowSwitcher",e)}Ml("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const y6e=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],x6e=["ownerState"],b6e=["ownerState"],w6e=x("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),S6e=x("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),hD=x($t,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),C6e=e=>{const{classes:t}=e;return Ol({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},v6e,t)},j6e=m.forwardRef(function(t,n){const r=xS(),o=ct({props:t,name:"MuiPickersArrowSwitcher"}),{children:i,className:a,slots:l,slotProps:c,isNextDisabled:u,isNextHidden:d,onGoToNext:p,nextLabel:f,isPreviousDisabled:h,isPreviousHidden:g,onGoToPrevious:v,previousLabel:b,labelId:y}=o,w=Di(o,y6e),S=o,j=C6e(S),E={isDisabled:u,isHidden:d,goTo:p,label:f},C={isDisabled:h,isHidden:g,goTo:v,label:b},T=(l==null?void 0:l.previousIconButton)??hD,k=vc({elementType:T,externalSlotProps:c==null?void 0:c.previousIconButton,additionalProps:{size:"medium",title:C.label,"aria-label":C.label,disabled:C.isDisabled,edge:"end",onClick:C.goTo},ownerState:on({},S,{hidden:C.isHidden}),className:Ae(j.button,j.previousIconButton)}),_=(l==null?void 0:l.nextIconButton)??hD,A=vc({elementType:_,externalSlotProps:c==null?void 0:c.nextIconButton,additionalProps:{size:"medium",title:E.label,"aria-label":E.label,disabled:E.isDisabled,edge:"start",onClick:E.goTo},ownerState:on({},S,{hidden:E.isHidden}),className:Ae(j.button,j.nextIconButton)}),O=(l==null?void 0:l.leftArrowIcon)??g6e,M=vc({elementType:O,externalSlotProps:c==null?void 0:c.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:S,className:j.leftArrowIcon}),H=Di(M,x6e),P=(l==null?void 0:l.rightArrowIcon)??m6e,$=vc({elementType:P,externalSlotProps:c==null?void 0:c.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:S,className:j.rightArrowIcon}),D=Di($,b6e);return s.jsxs(w6e,on({ref:n,className:Ae(j.root,a),ownerState:S},w,{children:[s.jsx(T,on({},k,{children:r?s.jsx(P,on({},D)):s.jsx(O,on({},H))})),i?s.jsx(Z,{variant:"subtitle1",component:"span",id:y,children:i}):s.jsx(S6e,{className:j.spacer,ownerState:S}),s.jsx(_,on({},A,{children:r?s.jsx(O,on({},H)):s.jsx(P,on({},D))}))]}))}),gD=(e,t)=>t.getHours(e)*3600+t.getMinutes(e)*60+t.getSeconds(e),E6e=(e,t)=>(n,r)=>e?t.isAfter(n,r):gD(n,t)>gD(r,t);function T6e({onChange:e,onViewChange:t,openTo:n,view:r,views:o,autoFocus:i,focusedView:a,onFocusedViewChange:l}){const c=m.useRef(n),u=m.useRef(o),d=m.useRef(o.includes(n)?n:o[0]),[p,f]=Ag({name:"useViews",state:"view",controlled:r,default:d.current}),h=m.useRef(i?p:null),[g,v]=Ag({name:"useViews",state:"focusedView",controlled:a,default:h.current});m.useEffect(()=>{(c.current&&c.current!==n||u.current&&u.current.some(T=>!o.includes(T)))&&(f(o.includes(n)?n:o[0]),u.current=o,c.current=n)},[n,f,p,o]);const b=o.indexOf(p),y=o[b-1]??null,w=o[b+1]??null,S=Sr((T,k)=>{v(k?T:_=>T===_?null:_),l==null||l(T,k)}),j=Sr(T=>{S(T,!0),T!==p&&(f(T),t&&t(T))}),E=Sr(()=>{w&&j(w)}),C=Sr((T,k,_)=>{const A=k==="finish",O=_?o.indexOf(_)<o.length-1:!!w;if(e(T,A&&O?"partial":k,_),_&&_!==p){const H=o[o.indexOf(_)+1];H&&j(H)}else A&&E()});return{view:p,setView:j,focusedView:g,setFocusedView:S,nextView:w,previousView:y,defaultView:o.includes(n)?n:o[0],goToNextView:E,setValueAndGoToNextView:C}}function k6e(e,{disableFuture:t,maxDate:n,timezone:r}){const o=ss();return m.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isBefore(i,n)?i:n);return!o.isAfter(a,e)},[t,n,e,o,r])}function _6e(e,{disablePast:t,minDate:n,timezone:r}){const o=ss();return m.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isAfter(i,n)?i:n);return!o.isBefore(a,e)},[t,n,e,o,r])}const r0=36,vC=2,AA=320,R6e=280,OX=336,P6e=x("div")({overflow:"hidden",width:AA,maxHeight:OX,display:"flex",flexDirection:"column",margin:"0 auto"}),H2=(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},i1=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:i,utils:a,timezone:l})=>{const c=H2(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(!i(u))return u;u=a.addDays(u,1)}if(d){if(!i(d))return d;d=a.addDays(d,-1)}}return null},A6e=(e,t)=>t==null||!e.isValid(t)?null:t,Zd=(e,t,n)=>t==null||!e.isValid(t)?n:t,I6e=(e,t,n)=>!e.isValid(t)&&t!=null&&!e.isValid(n)&&n!=null?!0:e.isEqual(t,n),$6e=(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},MX=(e,t,n)=>n==="date"?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),O6e=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(r=>e.addDays(n,r))},M6e=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:o,valueManager:i})=>{const a=ss(),l=m.useRef(n),c=t??l.current??i.emptyValue,u=m.useMemo(()=>i.getTimezone(a,c),[a,i,c]),d=Sr(g=>u==null?g:i.setTimezone(a,u,g));let p;e?p=e:u?p=u:r?p=a.getTimezone(r):p="default";const f=m.useMemo(()=>i.setTimezone(a,p,c),[i,a,p,c]),h=Sr((g,...v)=>{const b=d(g);o==null||o(b,...v)});return{value:f,handleValueChange:h,timezone:p}},IA=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:o,onChange:i,valueManager:a})=>{const[l,c]=Ag({name:e,state:"value",controlled:n,default:r??a.emptyValue}),u=Sr((d,...p)=>{c(d),i==null||i(d,...p)});return M6e({timezone:t,value:l,defaultValue:void 0,referenceDate:o,onChange:u,valueManager:a})},lu={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},nv=(e,t,n)=>{if(t===lu.year)return e.startOfYear(n);if(t===lu.month)return e.startOfMonth(n);if(t===lu.day)return e.startOfDay(n);let r=n;return t<lu.minutes&&(r=e.setMinutes(r,0)),t<lu.seconds&&(r=e.setSeconds(r,0)),t<lu.milliseconds&&(r=e.setMilliseconds(r,0)),r},D6e=({props:e,utils:t,granularity:n,timezone:r,getTodayDate:o})=>{let i=o?o():nv(t,n,MX(t,r));e.minDate!=null&&t.isAfterDay(e.minDate,i)&&(i=nv(t,n,e.minDate)),e.maxDate!=null&&t.isBeforeDay(e.maxDate,i)&&(i=nv(t,n,e.maxDate));const a=E6e(e.disableIgnoringDatePartForTimeValidation??!1,t);return e.minTime!=null&&a(e.minTime,i)&&(i=nv(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:H2(t,i,e.minTime))),e.maxTime!=null&&a(i,e.maxTime)&&(i=nv(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:H2(t,i,e.maxTime))),i},L6e=["value","referenceDate"],Bf={emptyValue:null,getTodayValue:MX,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=Di(e,L6e);return t!=null&&r.utils.isValid(t)?t:n??D6e(r)},cleanValue:A6e,areValuesEqual:I6e,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 F6e(e){return il("MuiPickersDay",e)}const Fp=Ml("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),N6e=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],B6e=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:i,outsideCurrentMonth:a,showDaysOutsideCurrentMonth:l,classes:c}=e,u=a&&!l;return Ol({root:["root",t&&!u&&"selected",i&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",a&&l&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},F6e,c)},DX=({theme:e})=>on({},e.typography.caption,{width:r0,height:r0,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})`:Dt(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:Dt(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${Fp.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${Fp.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}},[`&.${Fp.disabled}:not(.${Fp.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${Fp.disabled}&.${Fp.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${vC}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${Fp.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),LX=(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]},z6e=x(As,{name:"MuiPickersDay",slot:"Root",overridesResolver:LX})(DX),H6e=x("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:LX})(({theme:e})=>on({},DX({theme:e}),{opacity:0,pointerEvents:"none"})),rv=()=>{},W6e=m.forwardRef(function(t,n){const r=ct({props:t,name:"MuiPickersDay"}),{autoFocus:o=!1,className:i,day:a,disabled:l=!1,disableHighlightToday:c=!1,disableMargin:u=!1,isAnimating:d,onClick:p,onDaySelect:f,onFocus:h=rv,onBlur:g=rv,onKeyDown:v=rv,onMouseDown:b=rv,onMouseEnter:y=rv,outsideCurrentMonth:w,selected:S=!1,showDaysOutsideCurrentMonth:j=!1,children:E,today:C=!1}=r,T=Di(r,N6e),k=on({},r,{autoFocus:o,disabled:l,disableHighlightToday:c,disableMargin:u,selected:S,showDaysOutsideCurrentMonth:j,today:C}),_=B6e(k),A=ss(),O=m.useRef(null),M=RA(O,n);hC(()=>{o&&!l&&!d&&!w&&O.current.focus()},[o,l,d,w]);const H=$=>{b($),w&&$.preventDefault()},P=$=>{l||f(a),w&&$.currentTarget.focus(),p&&p($)};return w&&!j?s.jsx(H6e,{className:Ae(_.root,_.hiddenDaySpacingFiller,i),ownerState:k,role:T.role}):s.jsx(z6e,on({className:Ae(_.root,i),ref:M,centerRipple:!0,disabled:l,tabIndex:S?0:-1,onKeyDown:$=>v($,a),onFocus:$=>h($,a),onBlur:$=>g($,a),onMouseEnter:$=>y($,a),onClick:P,onMouseDown:H},T,{ownerState:k,children:E||A.format(a,"dayOfMonth")}))}),V6e=m.memo(W6e),FX=({props:e,value:t,timezone:n,adapter:r})=>{if(t===null)return null;const{shouldDisableDate:o,shouldDisableMonth:i,shouldDisableYear:a,disablePast:l,disableFuture:c}=e,u=r.utils.date(void 0,n),d=Zd(r.utils,e.minDate,r.defaultDates.minDate),p=Zd(r.utils,e.maxDate,r.defaultDates.maxDate);switch(!0){case!r.utils.isValid(t):return"invalidDate";case!!(o&&o(t)):return"shouldDisableDate";case!!(i&&i(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}};FX.valueManager=Bf;const NX=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a,timezone:l})=>{const c=gC();return m.useCallback(u=>FX({adapter:c,value:u,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a}})!==null,[c,e,t,n,r,o,i,a,l])},U6e=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return on({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const i=o.newTimezone;if(n.getTimezone(r.currentMonth)===i)return r;let a=n.setTimezone(r.currentMonth,i);return n.getMonth(a)!==n.getMonth(r.currentMonth)&&(a=n.setMonth(a,n.getMonth(r.currentMonth))),on({},r,{currentMonth:a})}case"finishMonthSwitchingAnimation":return on({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const i=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return on({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:i&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:i?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},G6e=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:i=!1,maxDate:a,minDate:l,onMonthChange:c,reduceAnimations:u,shouldDisableDate:d,timezone:p}=e,f=ss(),h=m.useRef(U6e(!!u,i,f)).current,g=m.useMemo(()=>Bf.getInitialReferenceValue({value:t,utils:f,timezone:p,props:e,referenceDate:n,granularity:lu.day}),[n,p]),[v,b]=m.useReducer(h,{isMonthSwitchingAnimating:!1,focusedDay:g,currentMonth:f.startOfMonth(g),slideDirection:"left"});m.useEffect(()=>{b({type:"changeMonthTimezone",newTimezone:f.getTimezone(g)})},[g,f]);const y=m.useCallback(C=>{b(on({type:"changeMonth"},C)),c&&c(C.newMonth)},[c]),w=m.useCallback(C=>{const T=C;f.isSameMonth(T,v.currentMonth)||y({newMonth:f.startOfMonth(T),direction:f.isAfterDay(T,v.currentMonth)?"left":"right"})},[v.currentMonth,y,f]),S=NX({shouldDisableDate:d,minDate:l,maxDate:a,disableFuture:r,disablePast:o,timezone:p}),j=m.useCallback(()=>{b({type:"finishMonthSwitchingAnimation"})},[]),E=Sr((C,T)=>{S(C)||b({type:"changeFocusedDay",focusedDay:C,withoutMonthSwitchingAnimation:T})});return{referenceDate:g,calendarState:v,changeMonth:w,changeFocusedDay:E,isDateDisabled:S,onMonthSwitchingAnimationEnd:j,handleChangeMonth:y}},q6e=e=>il("MuiPickersFadeTransitionGroup",e);Ml("MuiPickersFadeTransitionGroup",["root"]);const Y6e=e=>{const{classes:t}=e;return Ol({root:["root"]},q6e,t)},K6e=x(D0,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function BX(e){const t=ct({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:i}=t,a=Y6e(t),l=qt();return o?n:s.jsx(K6e,{className:Ae(a.root,r),children:s.jsx(z0,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:l.transitions.duration.enteringScreen,enter:l.transitions.duration.enteringScreen,exit:0},children:n},i)})}const X6e=e=>il("MuiPickersSlideTransition",e),Ca=Ml("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),J6e=["children","className","reduceAnimations","slideDirection","transKey","classes"],Q6e=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return Ol(r,X6e,t)},Z6e=x(D0,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${Ca["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${Ca["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${Ca.slideEnterActive}`]:t.slideEnterActive},{[`.${Ca.slideExit}`]:t.slideExit},{[`.${Ca["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${Ca["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},[`& .${Ca["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${Ca["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${Ca.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${Ca.slideExit}`]:{transform:"translate(0%)"},[`& .${Ca["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${Ca["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function eOe(e){const t=ct({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:i}=t,a=Di(t,J6e),l=Q6e(t),c=qt();if(o)return s.jsx("div",{className:Ae(l.root,r),children:n});const u={exit:l.exit,enterActive:l.enterActive,enter:l.enter,exitActive:l.exitActive};return s.jsx(Z6e,{className:Ae(l.root,r),childFactory:d=>m.cloneElement(d,{classNames:u}),role:"presentation",children:s.jsx(Q_,on({mountOnEnter:!0,unmountOnExit:!0,timeout:c.transitions.duration.complex,classNames:u},a,{children:n}),i)})}const tOe=e=>il("MuiDayCalendar",e);Ml("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const nOe=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],rOe=["ownerState"],oOe=e=>{const{classes:t}=e;return Ol({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},tOe,t)},zX=(r0+vC*2)*6,iOe=x("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),sOe=x("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),aOe=x(Z,{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})),lOe=x(Z,{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})),cOe=x(Z,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>on({},e.typography.caption,{width:r0,height:r0,padding:0,margin:`0 ${vC}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),uOe=x("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:zX}),dOe=x(eOe,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:zX}),pOe=x("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),fOe=x("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${vC}px 0`,display:"flex",justifyContent:"center"});function hOe(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:i,currentMonthNumber:a,isViewFocused:l}=e,c=Di(e,nOe);const{disabled:u,disableHighlightToday:d,isMonthSwitchingAnimating:p,showDaysOutsideCurrentMonth:f,slots:h,slotProps:g,timezone:v}=t,b=ss(),y=mC(v),w=r!==null&&b.isSameDay(n,r),S=o.some(M=>b.isSameDay(M,n)),j=b.isSameDay(n,y),E=(h==null?void 0:h.day)??V6e,C=vc({elementType:E,externalSlotProps:g==null?void 0:g.day,additionalProps:on({disableHighlightToday:d,showDaysOutsideCurrentMonth:f,role:"gridcell",isAnimating:p,"data-timestamp":b.toJsDate(n).valueOf()},c),ownerState:on({},t,{day:n,selected:S})}),T=Di(C,rOe),k=m.useMemo(()=>u||i(n),[u,i,n]),_=m.useMemo(()=>b.getMonth(n)!==a,[b,n,a]),A=m.useMemo(()=>{const M=b.startOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.startOfWeek(M)):b.isSameDay(n,M)},[a,n,f,b]),O=m.useMemo(()=>{const M=b.endOfMonth(b.setMonth(n,a));return f?b.isSameDay(n,b.endOfWeek(M)):b.isSameDay(n,M)},[a,n,f,b]);return s.jsx(E,on({},T,{day:n,disabled:k,autoFocus:l&&w,today:j,outsideCurrentMonth:_,isFirstVisibleCell:A,isLastVisibleCell:O,selected:S,tabIndex:w?0:-1,"aria-selected":S,"aria-current":j?"date":void 0}))}function gOe(e){const t=ct({props:e,name:"MuiDayCalendar"}),n=ss(),{onFocusedDayChange:r,className:o,currentMonth:i,selectedDays:a,focusedDay:l,loading:c,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:d,readOnly:p,reduceAnimations:f,renderLoading:h=()=>s.jsx("span",{children:"..."}),slideDirection:g,TransitionProps:v,disablePast:b,disableFuture:y,minDate:w,maxDate:S,shouldDisableDate:j,shouldDisableMonth:E,shouldDisableYear:C,dayOfWeekFormatter:T=ge=>n.format(ge,"weekdayShort").charAt(0).toUpperCase(),hasFocus:k,onFocusedViewChange:_,gridLabelId:A,displayWeekNumber:O,fixedWeekNumber:M,autoFocus:H,timezone:P}=t,$=mC(P),D=oOe(t),z=xS(),B=NX({shouldDisableDate:j,shouldDisableMonth:E,shouldDisableYear:C,minDate:w,maxDate:S,disablePast:b,disableFuture:y,timezone:P}),L=$X(),[I,q]=Ag({name:"DayCalendar",state:"hasFocus",controlled:k,default:H??!1}),[ee,W]=m.useState(()=>l||$),oe=Sr(ge=>{p||u(ge)}),ne=ge=>{B(ge)||(r(ge),W(ge),_==null||_(!0),q(!0))},ce=Sr((ge,ze)=>{switch(ge.key){case"ArrowUp":ne(n.addDays(ze,-7)),ge.preventDefault();break;case"ArrowDown":ne(n.addDays(ze,7)),ge.preventDefault();break;case"ArrowLeft":{const Se=n.addDays(ze,z?1:-1),Ve=n.addMonths(ze,z?1:-1),Ne=i1({utils:n,date:Se,minDate:z?Se:n.startOfMonth(Ve),maxDate:z?n.endOfMonth(Ve):Se,isDateDisabled:B,timezone:P});ne(Ne||Se),ge.preventDefault();break}case"ArrowRight":{const Se=n.addDays(ze,z?-1:1),Ve=n.addMonths(ze,z?-1:1),Ne=i1({utils:n,date:Se,minDate:z?n.startOfMonth(Ve):Se,maxDate:z?Se:n.endOfMonth(Ve),isDateDisabled:B,timezone:P});ne(Ne||Se),ge.preventDefault();break}case"Home":ne(n.startOfWeek(ze)),ge.preventDefault();break;case"End":ne(n.endOfWeek(ze)),ge.preventDefault();break;case"PageUp":ne(n.addMonths(ze,1)),ge.preventDefault();break;case"PageDown":ne(n.addMonths(ze,-1)),ge.preventDefault();break}}),xe=Sr((ge,ze)=>ne(ze)),re=Sr((ge,ze)=>{I&&n.isSameDay(ee,ze)&&(_==null||_(!1))}),ve=n.getMonth(i),he=n.getYear(i),ye=m.useMemo(()=>a.filter(ge=>!!ge).map(ge=>n.startOfDay(ge)),[n,a]),Pe=`${he}-${ve}`,Ee=m.useMemo(()=>m.createRef(),[Pe]),Re=m.useMemo(()=>{const ge=n.startOfMonth(i),ze=n.endOfMonth(i);return B(ee)||n.isAfterDay(ee,ze)||n.isBeforeDay(ee,ge)?i1({utils:n,date:ee,minDate:ge,maxDate:ze,disablePast:b,disableFuture:y,isDateDisabled:B,timezone:P}):ee},[i,y,b,ee,B,n,P]),_e=m.useMemo(()=>{const ge=n.getWeekArray(i);let ze=n.addMonths(i,1);for(;M&&ge.length<M;){const Se=n.getWeekArray(ze),Ve=n.isSameDay(ge[ge.length-1][0],Se[0][0]);Se.slice(Ve?1:0).forEach(Ne=>{ge.length<M&&ge.push(Ne)}),ze=n.addMonths(ze,1)}return ge},[i,M,n]);return s.jsxs(iOe,{role:"grid","aria-labelledby":A,className:D.root,children:[s.jsxs(sOe,{role:"row",className:D.header,children:[O&&s.jsx(lOe,{variant:"caption",role:"columnheader","aria-label":L.calendarWeekNumberHeaderLabel,className:D.weekNumberLabel,children:L.calendarWeekNumberHeaderText}),O6e(n,$).map((ge,ze)=>s.jsx(aOe,{variant:"caption",role:"columnheader","aria-label":n.format(ge,"weekday"),className:D.weekDayLabel,children:T(ge)},ze.toString()))]}),c?s.jsx(uOe,{className:D.loadingContainer,children:h()}):s.jsx(dOe,on({transKey:Pe,onExited:d,reduceAnimations:f,slideDirection:g,className:Ae(o,D.slideTransition)},v,{nodeRef:Ee,children:s.jsx(pOe,{ref:Ee,role:"rowgroup",className:D.monthContainer,children:_e.map((ge,ze)=>s.jsxs(fOe,{role:"row",className:D.weekContainer,"aria-rowindex":ze+1,children:[O&&s.jsx(cOe,{className:D.weekNumber,role:"rowheader","aria-label":L.calendarWeekNumberAriaLabelText(n.getWeekNumber(ge[0])),children:L.calendarWeekNumberText(n.getWeekNumber(ge[0]))}),ge.map((Se,Ve)=>s.jsx(hOe,{parentProps:t,day:Se,selectedDays:ye,focusableDay:Re,onKeyDown:ce,onFocus:xe,onBlur:re,onDaySelect:oe,isDateDisabled:B,currentMonthNumber:ve,isViewFocused:I,"aria-colindex":Ve+1},Se.toString()))]},`week-${ge[0]}`))})}))]})}function mOe(e){return il("MuiPickersMonth",e)}const kx=Ml("MuiPickersMonth",["root","monthButton","disabled","selected"]),vOe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],yOe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ol({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},mOe,r)},xOe=x("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%"}}]}),bOe=x("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${kx.disabled}`]:t.disabled},{[`&.${kx.selected}`]:t.selected}]})(({theme:e})=>on({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})`:Dt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Dt(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${kx.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${kx.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),wOe=m.memo(function(t){const n=ct({props:t,name:"MuiPickersMonth"}),{autoFocus:r,className:o,children:i,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":g,"aria-label":v,slots:b,slotProps:y}=n,w=Di(n,vOe),S=m.useRef(null),j=yOe(n);hC(()=>{var T;r&&((T=S.current)==null||T.focus())},[r]);const E=(b==null?void 0:b.monthButton)??bOe,C=vc({elementType:E,externalSlotProps:y==null?void 0:y.monthButton,additionalProps:{children:i,disabled:a,tabIndex:u,ref:S,type:"button",role:"radio","aria-current":g,"aria-checked":l,"aria-label":v,onClick:T=>d(T,c),onKeyDown:T=>p(T,c),onFocus:T=>f(T,c),onBlur:T=>h(T,c)},ownerState:n,className:j.monthButton});return s.jsx(xOe,on({className:Ae(j.root,o),ownerState:n},w,{children:s.jsx(E,on({},C))}))});function SOe(e){return il("MuiMonthCalendar",e)}Ml("MuiMonthCalendar",["root"]);const COe=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],jOe=e=>{const{classes:t}=e;return Ol({root:["root"]},SOe,t)};function EOe(e,t){const n=ss(),r=PA(),o=ct({props:e,name:t});return on({disableFuture:!1,disablePast:!1},o,{minDate:Zd(n,o.minDate,r.minDate),maxDate:Zd(n,o.maxDate,r.maxDate)})}const TOe=x("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:AA,boxSizing:"border-box"}),kOe=m.forwardRef(function(t,n){const r=EOe(t,"MuiMonthCalendar"),{className:o,value:i,defaultValue:a,referenceDate:l,disabled:c,disableFuture:u,disablePast:d,maxDate:p,minDate:f,onChange:h,shouldDisableMonth:g,readOnly:v,autoFocus:b=!1,onMonthFocus:y,hasFocus:w,onFocusedViewChange:S,monthsPerRow:j=3,timezone:E,gridLabelId:C,slots:T,slotProps:k}=r,_=Di(r,COe),{value:A,handleValueChange:O,timezone:M}=IA({name:"MonthCalendar",timezone:E,value:i,defaultValue:a,referenceDate:l,onChange:h,valueManager:Bf}),H=mC(M),P=xS(),$=ss(),D=m.useMemo(()=>Bf.getInitialReferenceValue({value:A,utils:$,props:r,timezone:M,referenceDate:l,granularity:lu.month}),[]),z=r,B=jOe(z),L=m.useMemo(()=>$.getMonth(H),[$,H]),I=m.useMemo(()=>A!=null?$.getMonth(A):null,[A,$]),[q,ee]=m.useState(()=>I||$.getMonth(D)),[W,oe]=Ag({name:"MonthCalendar",state:"hasFocus",controlled:w,default:b??!1}),ne=Sr(Pe=>{oe(Pe),S&&S(Pe)}),ce=m.useCallback(Pe=>{const Ee=$.startOfMonth(d&&$.isAfter(H,f)?H:f),Re=$.startOfMonth(u&&$.isBefore(H,p)?H:p),_e=$.startOfMonth(Pe);return $.isBefore(_e,Ee)||$.isAfter(_e,Re)?!0:g?g(_e):!1},[u,d,p,f,H,g,$]),xe=Sr((Pe,Ee)=>{if(v)return;const Re=$.setMonth(A??D,Ee);O(Re)}),re=Sr(Pe=>{ce($.setMonth(A??D,Pe))||(ee(Pe),ne(!0),y&&y(Pe))});m.useEffect(()=>{ee(Pe=>I!==null&&Pe!==I?I:Pe)},[I]);const ve=Sr((Pe,Ee)=>{switch(Pe.key){case"ArrowUp":re((12+Ee-3)%12),Pe.preventDefault();break;case"ArrowDown":re((12+Ee+3)%12),Pe.preventDefault();break;case"ArrowLeft":re((12+Ee+(P?1:-1))%12),Pe.preventDefault();break;case"ArrowRight":re((12+Ee+(P?-1:1))%12),Pe.preventDefault();break}}),he=Sr((Pe,Ee)=>{re(Ee)}),ye=Sr((Pe,Ee)=>{q===Ee&&ne(!1)});return s.jsx(TOe,on({ref:n,className:Ae(B.root,o),ownerState:z,role:"radiogroup","aria-labelledby":C},_,{children:$6e($,A??D).map(Pe=>{const Ee=$.getMonth(Pe),Re=$.format(Pe,"monthShort"),_e=$.format(Pe,"month"),ge=Ee===I,ze=c||ce(Pe);return s.jsx(wOe,{selected:ge,value:Ee,onClick:xe,onKeyDown:ve,autoFocus:W&&Ee===q,disabled:ze,tabIndex:Ee===q&&!ze?0:-1,onFocus:he,onBlur:ye,"aria-current":L===Ee?"date":void 0,"aria-label":_e,monthsPerRow:j,slots:T,slotProps:k,children:Re},Re)})}))});function _Oe(e){return il("MuiPickersYear",e)}const _x=Ml("MuiPickersYear",["root","yearButton","selected","disabled"]),ROe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],POe=e=>{const{disabled:t,selected:n,classes:r}=e;return Ol({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},_Oe,r)},AOe=x("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%"}}]}),IOe=x("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${_x.disabled}`]:t.disabled},{[`&.${_x.selected}`]:t.selected}]})(({theme:e})=>on({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})`:Dt(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Dt(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}}})),$Oe=m.memo(function(t){const n=ct({props:t,name:"MuiPickersYear"}),{autoFocus:r,className:o,children:i,disabled:a,selected:l,value:c,tabIndex:u,onClick:d,onKeyDown:p,onFocus:f,onBlur:h,"aria-current":g,slots:v,slotProps:b}=n,y=Di(n,ROe),w=m.useRef(null),S=POe(n);hC(()=>{var C;r&&((C=w.current)==null||C.focus())},[r]);const j=(v==null?void 0:v.yearButton)??IOe,E=vc({elementType:j,externalSlotProps:b==null?void 0:b.yearButton,additionalProps:{children:i,disabled:a,tabIndex:u,ref:w,type:"button",role:"radio","aria-current":g,"aria-checked":l,onClick:C=>d(C,c),onKeyDown:C=>p(C,c),onFocus:C=>f(C,c),onBlur:C=>h(C,c)},ownerState:n,className:S.yearButton});return s.jsx(AOe,on({className:Ae(S.root,o),ownerState:n},y,{children:s.jsx(j,on({},E))}))});function OOe(e){return il("MuiYearCalendar",e)}Ml("MuiYearCalendar",["root"]);const MOe=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],DOe=e=>{const{classes:t}=e;return Ol({root:["root"]},OOe,t)};function LOe(e,t){const n=ss(),r=PA(),o=ct({props:e,name:t});return on({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:Zd(n,o.minDate,r.minDate),maxDate:Zd(n,o.maxDate,r.maxDate)})}const FOe=x("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:AA,maxHeight:R6e,boxSizing:"border-box",position:"relative"}),NOe=m.forwardRef(function(t,n){const r=LOe(t,"MuiYearCalendar"),{autoFocus:o,className:i,value:a,defaultValue:l,referenceDate:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onChange:g,readOnly:v,shouldDisableYear:b,onYearFocus:y,hasFocus:w,onFocusedViewChange:S,yearsOrder:j="asc",yearsPerRow:E,timezone:C,gridLabelId:T,slots:k,slotProps:_}=r,A=Di(r,MOe),{value:O,handleValueChange:M,timezone:H}=IA({name:"YearCalendar",timezone:C,value:a,defaultValue:l,referenceDate:c,onChange:g,valueManager:Bf}),P=mC(H),$=xS(),D=ss(),z=m.useMemo(()=>Bf.getInitialReferenceValue({value:O,utils:D,props:r,timezone:H,referenceDate:c,granularity:lu.year}),[]),B=r,L=DOe(B),I=m.useMemo(()=>D.getYear(P),[D,P]),q=m.useMemo(()=>O!=null?D.getYear(O):null,[O,D]),[ee,W]=m.useState(()=>q||D.getYear(z)),[oe,ne]=Ag({name:"YearCalendar",state:"hasFocus",controlled:w,default:o??!1}),ce=Sr(Se=>{ne(Se),S&&S(Se)}),xe=m.useCallback(Se=>{if(p&&D.isBeforeYear(Se,P)||d&&D.isAfterYear(Se,P)||h&&D.isBeforeYear(Se,h)||f&&D.isAfterYear(Se,f))return!0;if(!b)return!1;const Ve=D.startOfYear(Se);return b(Ve)},[d,p,f,h,P,b,D]),re=Sr((Se,Ve)=>{if(v)return;const Ne=D.setYear(O??z,Ve);M(Ne)}),ve=Sr(Se=>{xe(D.setYear(O??z,Se))||(W(Se),ce(!0),y==null||y(Se))});m.useEffect(()=>{W(Se=>q!==null&&Se!==q?q:Se)},[q]);const he=j!=="desc"?E*1:E*-1,ye=$&&j==="asc"||!$&&j==="desc"?-1:1,Pe=Sr((Se,Ve)=>{switch(Se.key){case"ArrowUp":ve(Ve-he),Se.preventDefault();break;case"ArrowDown":ve(Ve+he),Se.preventDefault();break;case"ArrowLeft":ve(Ve-ye),Se.preventDefault();break;case"ArrowRight":ve(Ve+ye),Se.preventDefault();break}}),Ee=Sr((Se,Ve)=>{ve(Ve)}),Re=Sr((Se,Ve)=>{ee===Ve&&ce(!1)}),_e=m.useRef(null),ge=RA(n,_e);m.useEffect(()=>{if(o||_e.current===null)return;const Se=_e.current.querySelector('[tabindex="0"]');if(!Se)return;const Ve=Se.offsetHeight,Ne=Se.offsetTop,Xe=_e.current.clientHeight,yt=_e.current.scrollTop,wt=Ne+Ve;Ve>Xe||Ne<yt||(_e.current.scrollTop=wt-Xe/2-Ve/2)},[o]);const ze=D.getYearRange([h,f]);return j==="desc"&&ze.reverse(),s.jsx(FOe,on({ref:ge,className:Ae(L.root,i),ownerState:B,role:"radiogroup","aria-labelledby":T},A,{children:ze.map(Se=>{const Ve=D.getYear(Se),Ne=Ve===q,Xe=u||xe(Se);return s.jsx($Oe,{selected:Ne,value:Ve,onClick:re,onKeyDown:Pe,autoFocus:oe&&Ve===ee,disabled:Xe,tabIndex:Ve===ee&&!Xe?0:-1,onFocus:Ee,onBlur:Re,"aria-current":I===Ve?"date":void 0,yearsPerRow:E,slots:k,slotProps:_,children:D.format(Se,"year")},D.format(Se,"year"))})}))}),BOe=e=>il("MuiPickersCalendarHeader",e),zOe=Ml("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),HOe=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],WOe=["ownerState"],VOe=e=>{const{classes:t}=e;return Ol({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},BOe,t)},UOe=x("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}),GOe=x("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>on({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),qOe=x("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),YOe=x($t,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${zOe.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),KOe=x(h6e,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),XOe=m.forwardRef(function(t,n){const r=$X(),o=ss(),i=ct({props:t,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:l,currentMonth:c,disabled:u,disableFuture:d,disablePast:p,maxDate:f,minDate:h,onMonthChange:g,onViewChange:v,view:b,reduceAnimations:y,views:w,labelId:S,className:j,timezone:E,format:C=`${o.formats.month} ${o.formats.year}`}=i,T=Di(i,HOe),k=i,_=VOe(i),A=(a==null?void 0:a.switchViewButton)??YOe,O=vc({elementType:A,externalSlotProps:l==null?void 0:l.switchViewButton,additionalProps:{size:"small","aria-label":r.calendarViewSwitchingButtonAriaLabel(b)},ownerState:k,className:_.switchViewButton}),M=(a==null?void 0:a.switchViewIcon)??KOe,H=vc({elementType:M,externalSlotProps:l==null?void 0:l.switchViewIcon,ownerState:k,className:_.switchViewIcon}),P=Di(H,WOe),$=()=>g(o.addMonths(c,1),"left"),D=()=>g(o.addMonths(c,-1),"right"),z=k6e(c,{disableFuture:d,maxDate:f,timezone:E}),B=_6e(c,{disablePast:p,minDate:h,timezone:E}),L=()=>{if(!(w.length===1||!v||u))if(w.length===2)v(w.find(q=>q!==b)||w[0]);else{const q=w.indexOf(b)!==0?0:1;v(w[q])}};if(w.length===1&&w[0]==="year")return null;const I=o.formatByString(c,C);return s.jsxs(UOe,on({},T,{ownerState:k,className:Ae(_.root,j),ref:n,children:[s.jsxs(GOe,{role:"presentation",onClick:L,ownerState:k,"aria-live":"polite",className:_.labelContainer,children:[s.jsx(BX,{reduceAnimations:y,transKey:I,children:s.jsx(qOe,{id:S,ownerState:k,className:_.label,children:I})}),w.length>1&&!u&&s.jsx(A,on({},O,{children:s.jsx(M,on({},P))}))]}),s.jsx(z0,{in:b==="day",appear:!y,enter:!y,children:s.jsx(j6e,{slots:a,slotProps:l,onGoToPrevious:D,isPreviousDisabled:B,previousLabel:r.previousMonth,onGoToNext:$,isNextDisabled:z,nextLabel:r.nextMonth})})]}))}),JOe="@media (prefers-reduced-motion: reduce)",sg=typeof navigator<"u"&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),mD=sg&&sg[1]?parseInt(sg[1],10):null,vD=sg&&sg[2]?parseInt(sg[2],10):null,QOe=mD&&mD<10||vD&&vD<13||!1,ZOe=()=>Xn(JOe,{defaultMatches:!1})||QOe,e8e=e=>il("MuiDateCalendar",e);Ml("MuiDateCalendar",["root","viewTransitionContainer"]);const t8e=["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"],n8e=e=>{const{classes:t}=e;return Ol({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},e8e,t)};function r8e(e,t){const n=ss(),r=PA(),o=ZOe(),i=ct({props:e,name:t});return on({},i,{loading:i.loading??!1,disablePast:i.disablePast??!1,disableFuture:i.disableFuture??!1,openTo:i.openTo??"day",views:i.views??["year","day"],reduceAnimations:i.reduceAnimations??o,renderLoading:i.renderLoading??(()=>s.jsx("span",{children:"..."})),minDate:Zd(n,i.minDate,r.minDate),maxDate:Zd(n,i.maxDate,r.maxDate)})}const o8e=x(P6e,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:OX}),i8e=x(BX,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),s8e=m.forwardRef(function(t,n){const r=ss(),o=t6e(),i=r8e(t,"MuiDateCalendar"),{autoFocus:a,onViewChange:l,value:c,defaultValue:u,referenceDate:d,disableFuture:p,disablePast:f,onChange:h,onYearChange:g,onMonthChange:v,reduceAnimations:b,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:S,view:j,views:E,openTo:C,className:T,disabled:k,readOnly:_,minDate:A,maxDate:O,disableHighlightToday:M,focusedView:H,onFocusedViewChange:P,showDaysOutsideCurrentMonth:$,fixedWeekNumber:D,dayOfWeekFormatter:z,slots:B,slotProps:L,loading:I,renderLoading:q,displayWeekNumber:ee,yearsOrder:W,yearsPerRow:oe,monthsPerRow:ne,timezone:ce}=i,xe=Di(i,t8e),{value:re,handleValueChange:ve,timezone:he}=IA({name:"DateCalendar",timezone:ce,value:c,defaultValue:u,referenceDate:d,onChange:h,valueManager:Bf}),{view:ye,setView:Pe,focusedView:Ee,setFocusedView:Re,goToNextView:_e,setValueAndGoToNextView:ge}=T6e({view:j,views:E,openTo:C,onChange:ve,onViewChange:l,autoFocus:a,focusedView:H,onFocusedViewChange:P}),{referenceDate:ze,calendarState:Se,changeFocusedDay:Ve,changeMonth:Ne,handleChangeMonth:Xe,isDateDisabled:yt,onMonthSwitchingAnimationEnd:wt}=G6e({value:re,referenceDate:d,reduceAnimations:b,onMonthChange:v,minDate:A,maxDate:O,shouldDisableDate:y,disablePast:f,disableFuture:p,timezone:he}),st=k&&re||A,Ce=k&&re||O,Be=`${o}-grid-label`,ue=Ee!==null,fe=(B==null?void 0:B.calendarHeader)??XOe,me=vc({elementType:fe,externalSlotProps:L==null?void 0:L.calendarHeader,additionalProps:{views:E,view:ye,currentMonth:Se.currentMonth,onViewChange:Pe,onMonthChange:(at,Qt)=>Xe({newMonth:at,direction:Qt}),minDate:st,maxDate:Ce,disabled:k,disablePast:f,disableFuture:p,reduceAnimations:b,timezone:he,labelId:Be},ownerState:i}),Ye=Sr(at=>{const Qt=r.startOfMonth(at),fn=r.endOfMonth(at),hn=yt(at)?i1({utils:r,date:at,minDate:r.isBefore(A,Qt)?Qt:A,maxDate:r.isAfter(O,fn)?fn:O,disablePast:f,disableFuture:p,isDateDisabled:yt,timezone:he}):at;hn?(ge(hn,"finish"),v==null||v(Qt)):(_e(),Ne(Qt)),Ve(hn,!0)}),nt=Sr(at=>{const Qt=r.startOfYear(at),fn=r.endOfYear(at),hn=yt(at)?i1({utils:r,date:at,minDate:r.isBefore(A,Qt)?Qt:A,maxDate:r.isAfter(O,fn)?fn:O,disablePast:f,disableFuture:p,isDateDisabled:yt,timezone:he}):at;hn?(ge(hn,"finish"),g==null||g(hn)):(_e(),Ne(Qt)),Ve(hn,!0)}),jt=Sr(at=>ve(at&&H2(r,at,re??ze),"finish",ye));m.useEffect(()=>{re!=null&&r.isValid(re)&&Ne(re)},[re]);const We=i,ut=n8e(We),Fe={disablePast:f,disableFuture:p,maxDate:O,minDate:A},Ke={disableHighlightToday:M,readOnly:_,disabled:k,timezone:he,gridLabelId:Be,slots:B,slotProps:L},lt=m.useRef(ye);m.useEffect(()=>{lt.current!==ye&&(Ee===lt.current&&Re(ye,!0),lt.current=ye)},[Ee,Re,ye]);const Vt=m.useMemo(()=>[re],[re]);return s.jsxs(o8e,on({ref:n,className:Ae(ut.root,T),ownerState:We},xe,{children:[s.jsx(fe,on({},me,{slots:B,slotProps:L})),s.jsx(i8e,{reduceAnimations:b,className:ut.viewTransitionContainer,transKey:ye,ownerState:We,children:s.jsxs("div",{children:[ye==="year"&&s.jsx(NOe,on({},Fe,Ke,{value:re,onChange:nt,shouldDisableYear:S,hasFocus:ue,onFocusedViewChange:at=>Re("year",at),yearsOrder:W,yearsPerRow:oe,referenceDate:ze})),ye==="month"&&s.jsx(kOe,on({},Fe,Ke,{hasFocus:ue,className:T,value:re,onChange:Ye,shouldDisableMonth:w,onFocusedViewChange:at=>Re("month",at),monthsPerRow:ne,referenceDate:ze})),ye==="day"&&s.jsx(gOe,on({},Se,Fe,Ke,{onMonthSwitchingAnimationEnd:wt,onFocusedDayChange:Ve,reduceAnimations:b,selectedDays:Vt,onSelectedDaysChange:jt,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:S,hasFocus:ue,onFocusedViewChange:at=>Re("day",at),showDaysOutsideCurrentMonth:$,fixedWeekNumber:D,dayOfWeekFormatter:z,displayWeekNumber:ee,loading:I,renderLoading:q}))]})})]}))});var gT={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(c,u){switch(c){case"P":return u.date({width:"short"});case"PP":return u.date({width:"medium"});case"PPP":return u.date({width:"long"});case"PPPP":default:return u.date({width:"full"})}},r=function(c,u){switch(c){case"p":return u.time({width:"short"});case"pp":return u.time({width:"medium"});case"ppp":return u.time({width:"long"});case"pppp":default:return u.time({width:"full"})}},o=function(c,u){var d=c.match(/(P+)(p+)?/)||[],p=d[1],f=d[2];if(!f)return n(c,u);var h;switch(p){case"P":h=u.dateTime({width:"short"});break;case"PP":h=u.dateTime({width:"medium"});break;case"PPP":h=u.dateTime({width:"long"});break;case"PPPP":default:h=u.dateTime({width:"full"});break}return h.replace("{{date}}",n(p,u)).replace("{{time}}",r(f,u))},i={p:r,P:o},a=i;t.default=a,e.exports=t.default})(gT,gT.exports);var a8e=gT.exports;const l8e=Vo(a8e),c8e={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"},u8e={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 d8e{constructor(t){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=c8e,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:i}=t;this.locale=n,this.formats=on({},u8e,r),this.longFormatters=o,this.lib=i||"date-fns"}}class p8e extends d8e{constructor({locale:t,formats:n}={}){super({locale:t??Qf,formats:n,longFormatters:l8e}),this.parse=(r,o)=>r===""?null:uK(r,o,new Date,{locale:this.locale}),this.isValid=r=>r==null?!1:Z0(r),this.format=(r,o)=>this.formatByString(r,this.formats[o]),this.formatByString=(r,o)=>si(r,o,{locale:this.locale}),this.isEqual=(r,o)=>r===null&&o===null?!0:r===null||o===null?!1:YTe(r,o),this.isSameYear=(r,o)=>Kke(r,o),this.isSameMonth=(r,o)=>qke(r,o),this.isSameDay=(r,o)=>R4e(r,o),this.isSameHour=(r,o)=>Gke(r,o),this.isAfter=(r,o)=>r1(r,o),this.isAfterYear=(r,o)=>r1(r,t0(o)),this.isAfterDay=(r,o)=>r1(r,E2(o)),this.isBefore=(r,o)=>kb(r,o),this.isBeforeYear=(r,o)=>kb(r,this.startOfYear(o)),this.isBeforeDay=(r,o)=>kb(r,this.startOfDay(o)),this.isWithinRange=(r,[o,i])=>Xke(r,{start:o,end:i}),this.startOfYear=r=>k2(r),this.startOfMonth=r=>T2(r),this.startOfWeek=r=>Df(r,{locale:this.locale}),this.startOfDay=r=>Yd(r),this.endOfYear=r=>t0(r),this.endOfMonth=r=>e0(r),this.endOfWeek=r=>qY(r,{locale:this.locale}),this.endOfDay=r=>E2(r),this.addYears=(r,o)=>VP(r,o),this.addMonths=(r,o)=>sm(r,o),this.addWeeks=(r,o)=>VY(r,o),this.addDays=(r,o)=>J0(r,o),this.addHours=(r,o)=>BY(r,o),this.addMinutes=(r,o)=>zY(r,o),this.addSeconds=(r,o)=>WY(r,o),this.getYear=r=>qTe(r),this.getMonth=r=>zTe(r),this.getDate=r=>LTe(r),this.getHours=r=>FTe(r),this.getMinutes=r=>BTe(r),this.getSeconds=r=>HTe(r),this.getMilliseconds=r=>NTe(r),this.setYear=(r,o)=>x_e(r,o),this.setMonth=(r,o)=>f_e(r,o),this.setDate=(r,o)=>h_e(r,o),this.setHours=(r,o)=>g_e(r,o),this.setMinutes=(r,o)=>v_e(r,o),this.setSeconds=(r,o)=>y_e(r,o),this.setMilliseconds=(r,o)=>m_e(r,o),this.getDaysInMonth=r=>oK(r),this.getWeekArray=r=>{const o=this.startOfWeek(this.startOfMonth(r)),i=this.endOfWeek(this.endOfMonth(r));let a=0,l=o;const c=[];for(;this.isBefore(l,i);){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=>GTe(r,{locale:this.locale}),this.getYearRange=([r,o])=>{const i=this.startOfYear(r),a=this.endOfYear(o),l=[];let c=i;for(;this.isBefore(c,a);)l.push(c),c=this.addYears(c,1);return l}}}const f8e=(e,t=new Date)=>{let n,r;switch(e){case"thisMonth":{n=T2(t),r=e0(t);break}case"thisQuarter":{n=Q4(t),r=Z4(t);break}case"previousQuarter":{const o=w_e(t,1);n=Q4(o),r=Z4(o);break}case"thisYear":{n=k2(t),r=t0(t);break}case"previousYear":{const o=fK(t,1);n=k2(o),r=t0(o);break}default:{const o=tC(t,1);n=T2(o),r=e0(o)}}return[si(n,"yyyy-MM-dd"),si(r,"yyyy-MM-dd")]},h8e=x(Z)(({theme:e})=>({paddingLeft:e.spacing(2),paddingBottom:e.spacing(1)})),g8e=({onRangeChange:e})=>{const t=n=>()=>{const[r,o]=f8e(n);e({from:{operator:"IS",values:[r]},to:{operator:"IS",values:[o]}})};return s.jsxs(J,{children:[s.jsx(h8e,{variant:"h3",children:"Presets"}),s.jsxs(Ni,{disablePadding:!0,sx:{pb:2},children:[s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("thisMonth"),children:"This month"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("previousMonth"),children:"Previous month"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("thisQuarter"),children:"This quarter"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("previousQuarter"),children:"Previous quarter"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("thisYear"),children:"This year"})}),s.jsx(Gr,{disablePadding:!0,children:s.jsx(no,{onClick:t("previousYear"),children:"Previous year"})})]})]})},m8e=({name:e,label:t,onChange:n,onRangeChange:r,onChipClose:o,state:i,operators:a,initMode:l="auto-open"})=>{const c=m.useRef(null),[u,d]=m.useState(null),{locationSettings:p}=wo(),f=()=>{d(c.current)};m.useEffect(()=>{!i&&l==="auto-open"&&f()},[]);const h=()=>{d(null)},g=i?[eA(i.values[0],p.locale)||""]:[],v=i?new Date(i.values[0]):null,b=i?i.operator:a[0],y=o?()=>{n({operator:a[0],values:[]}),h(),o()}:void 0;return m.useEffect(()=>{i&&!a.includes(i.operator)&&n({operator:a[0],values:i.values})},[i]),s.jsxs(s.Fragment,{children:[s.jsx(J,{ref:c,children:s.jsx(AX,{label:t,name:e,selectedDisplayOptions:g,onDelete:y,onClick:f,operator:b,operatorOptions:a,onChangeOperator:w=>{const S=v?si(v,"yyyy-MM-dd"):"";n({operator:w,values:[S]})}})}),s.jsx(RX,{open:!!u,anchorEl:u,onClose:h,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:s.jsxs(d6e,{dateAdapter:p8e,children:[s.jsx(s8e,{displayWeekNumber:!0,value:v,onChange:w=>{const S=w?si(w,"yyyy-MM-dd"):"";n({operator:b,values:[S]})}}),r&&s.jsx(g8e,{onRangeChange:r})]})})]})},v8e=({options:e,handleToggle:t})=>{const n=m.useRef([]);return{listRefs:n,handleSelection:(o,i)=>{var a,l,c;if(o.key==="ArrowDown"&&i<n.current.length-1)o.preventDefault(),(a=n.current[i+1])==null||a.focus();else if(o.key==="ArrowUp"&&i>0)o.preventDefault(),(l=n.current[i-1])==null||l.focus();else if(o.key==="Enter"&&i===0&&((c=n.current[0])!=null&&c.value)&&e.length>0)t(e[0].value)();else if((o.key==="Enter"||i!==0&&o.key===" ")&&(o.preventDefault(),i>0)){const u=i-1;t(e[u].value)()}}}},y8e=({name:e,label:t,options:n,onChange:r,onChipClose:o,state:i,singularOperators:a,pluralOperators:l,initMode:c="auto-open"})=>{const u=m.useRef(null),[d,p]=m.useState(),[f,h]=m.useState(""),g=i&&i.values.length>1?l:a,v=()=>{p(u.current)};m.useEffect(()=>{!i&&c==="auto-open"&&v()},[]);const b=()=>{p(null)},y=i?i.values:[],w=y.map(_=>{var A;return(A=n.find(O=>O.value===_))==null?void 0:A.label}).filter(_=>_!==void 0),S=i?i.operator:g[0],j=o?()=>{r({operator:a[0],values:[]}),b(),o()}:void 0,E=n.filter(_=>_.label.toLowerCase().includes(f.toLowerCase())),C=_=>()=>{if(y!=null&&y.some(A=>A===_)){const A=y==null?void 0:y.filter(O=>O!==_);r({operator:S,values:A})}else{const A=[...y??[],(n.find(O=>O.value===_)??{label:"",value:""}).value];r({operator:S,values:A})}},{listRefs:T,handleSelection:k}=v8e({options:E,handleToggle:C});return m.useEffect(()=>{i&&!g.includes(i.operator)&&r({operator:g[0],values:i.values})},[i]),s.jsxs(s.Fragment,{children:[s.jsx(J,{ref:u,children:s.jsx(AX,{name:e,label:t,selectedDisplayOptions:w,onDelete:j,onClick:v,operator:S,operatorOptions:g,onChangeOperator:_=>{r({operator:_,values:y??[]})}})}),s.jsx(RX,{open:!!d,anchorEl:d,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:s.jsxs(D$e,{children:[s.jsx(N$e,{variant:"outlined",size:"small",value:f,onChange:_=>h(_.target.value),placeholder:"Search",autoFocus:!0,InputProps:{startAdornment:s.jsx(fp,{position:"start",children:s.jsx(Zf,{fontSize:"small"})})},inputRef:_=>{T.current[0]=_},onKeyDown:_=>k(_,0)}),s.jsx(Ni,{sx:{overflowY:"auto"},disablePadding:!0,children:E.map((_,A)=>{const O=`checkbox-list-label-${_.value}`;return s.jsxs(L$e,{dense:!0,disablePadding:!0,tabIndex:0,onClick:C(_.value),ref:M=>{T.current[A+1]=M},onKeyDown:M=>k(M,A+1),children:[s.jsx(F$e,{edge:"start",checked:(y==null?void 0:y.some(M=>M===_.value))??!1,tabIndex:-1,inputProps:{"aria-labelledby":O},size:"small",disableRipple:!0}),s.jsx(dn,{id:O,primary:_.label})]},_.value)})})]})})]})},HX=x(J)(({theme:e})=>({display:"flex",padding:e.spacing(1.5,3),gap:e.spacing(1),flexWrap:"wrap"})),x8e=x("div")(({theme:e})=>({marginRight:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.spacing(2)})),b8e=x(Ka)(({theme:e})=>({"&.material-symbols-outlined":{fontSize:e.spacing(2)}})),WX=({filter:e,onChipClose:t,onChange:n,state:r,rangeChangeHandler:o,initMode:i})=>{const a=s.jsxs(s.Fragment,{children:[s.jsx(x8e,{children:s.jsx(b8e,{children:e.icon})}),e.label]});return"dateOperators"in e?s.jsx(m8e,{initMode:i,label:a,name:e.label,state:r,onChange:l=>{n({[e.filterKey]:l})},onRangeChange:o==null?void 0:o(e),operators:e.dateOperators,onChipClose:e.persistent?void 0:()=>t==null?void 0:t(e.label)},e.label):s.jsx(y8e,{initMode:i,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)},w8e=({state:e,onChange:t,className:n,filter:r,rangeChangeHandler:o})=>s.jsx(HX,{className:n,children:s.jsx(WX,{filter:r,state:e[r.filterKey],onChange:t,rangeChangeHandler:o,onChipClose:void 0,initMode:"manual"})}),S8e=(e,t)=>{const n=[...e],r=new Set(e);return t.forEach(o=>{r.has(o)||n.push(o)}),n},C8e=({state:e,onChange:t,availableFilters:n,rangeChangeHandler:r,className:o})=>{const[i,a]=m.useState([]),l=u=>{const d=i.filter(p=>p!==u);a(d)};m.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=S8e(i,u);a(d)},[JSON.stringify(e),JSON.stringify(n)]);const c=m.useMemo(()=>n.filter(u=>!i.includes(u.label)).map(u=>u.label).sort(),[n,i]);return s.jsxs(HX,{className:o,children:[i.map(u=>{const d=n.find(p=>p.label===u);return d?s.jsx(WX,{filter:d,state:e[d.filterKey],onChange:t,rangeChangeHandler:r,onChipClose:()=>l(d.label)},d.filterKey):null}),c.length>0?s.jsx(M$e,{availableFilters:n,visibleOptions:c,hiddenOptions:i,onSelectedOptionsChange:a}):null]})},$A=e=>{const t=n=>{const r=n.fromFilterKey,o=n.toFilterKey;if(r&&o)return i=>{e.onChange({[r]:i.from}),e.onChange({[o]:i.to})}};if(e.availableFilters.length===1){const n=e.availableFilters[0];return s.jsx(w8e,{rangeChangeHandler:t,filter:n,...e})}return s.jsx(C8e,{rangeChangeHandler:t,...e})},Ig=e=>`${e.type}:${e.value}`,j8e=({state:e,onChange:t})=>{const{projects:n}=Xr(),{segments:r}=ma(),{tags:o}=A$e(),i=[{label:"Active",value:"active"},{label:"Stale",value:"stale"}],[a,l]=m.useState([]);return m.useEffect(()=>{const c=(n||[]).map(h=>({label:h.name,value:h.id})),u=(r||[]).map(h=>({label:h.name,value:h.name})),d=(o||[]).map(h=>({label:Ig(h),value:Ig(h)})),p=c.length>1,f=[{label:"State",icon:"hexagon",options:i,filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},...p?[{label:"Project",icon:"topic",options:c,filterKey:"project",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}]:[],{label:"Tags",icon:"label",options:d,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:u,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"]}];l(f)},[JSON.stringify(n),JSON.stringify(r),JSON.stringify(o)]),s.jsx($A,{availableFilters:a,state:e,onChange:t})},E8e=(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"})}},T8e=(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})}},k8e=(e,t)=>n=>{var o;const r=(o=e.columns)==null?void 0:o.reduce((i,a)=>({...i,...a&&{[a]:!0}}),{});if(typeof n=="function"){const i=n(r||{}),a=Object.keys(i).filter(l=>i[l]);t({columns:a})}else{const i=Object.keys(n).filter(a=>n[a]);t({columns:i})}},_8e=e=>({sorting:[{id:e.sortBy,desc:e.sortOrder==="desc"}]}),R8e=e=>({pagination:{pageIndex:e.offset?e.offset/e.limit:0,pageSize:e.limit}}),P8e=e=>{var t;return e.columns?{columnVisibility:(t=e.columns)==null?void 0:t.reduce((n,r)=>({...n,...r&&{[r]:!0}}),{})}:{}},VX=(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])),i=e.columns?{...r,...P8e(e).columnVisibility,...o}:(l=n.state)==null?void 0:l.columnVisibility;return{getCoreRowModel:ERe(),enableSorting:!0,enableMultiSort:!1,manualPagination:!0,manualSorting:!0,enableSortingRemoval:!1,enableHiding:!0,onPaginationChange:T8e(e,t),onSortingChange:E8e(e,t),onColumnVisibilityChange:k8e(e,t),...n,state:{..._8e(e),...R8e(e),...n.state||{},columnVisibility:i}}},A8e=(e,t,n,r=1)=>{const i=[...e.keys()].filter(c=>c.startsWith(n)&&c!==t),a=r-1;(a<=0?i:i.slice(0,-a)).forEach(c=>e.delete(c))},yC=(e,t,n=1)=>{const{cache:r}=Kq();A8e(r,e,t,n)},I8e={features:[],total:0},$8e=10,UX="api/admin/search/features?",O8e=()=>{const e={},t=o=>{e[o]={total:0,initialLoad:!0}},n=(o,i,a)=>{e[o]||t(o),e[o][i]=a},r=o=>(e[o]||t(o),e[o]);return(o,i={},a="")=>{const{KEY:l,fetcher:c}=D8e(o),u=`${a}${l}`,d=o.project||"";yC(u,UX,$8e),m.useEffect(()=>{t(o.project||"")},[]);const{data:p,error:f,mutate:h,isLoading:g}=_n(u,c,i),v=m.useCallback(()=>{h()},[h]),b=r(d);return(p==null?void 0:p.total)!==void 0&&n(d,"total",p.total),!g&&b.initialLoad&&n(d,"initialLoad",!1),{...p||I8e,loading:g,error:f,refetch:v,total:b.total,initialLoad:g&&b.initialLoad}}},M8e=25,D8e=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,i])=>!!i).map(([o,i])=>[o,i.toString()]).toSorted())).toString(),n=`${UX}${t}`;return{fetcher:()=>{const o=bt(n);return fetch(o,{method:"GET"}).then(Jt("Feature search")).then(i=>i.json())},KEY:n}},xC=O8e(),L8e=e=>e==null?e:e?"true":"false",F8e=e=>e==="true"?!0:e==="false"?!1:null,N8e={encode:L8e,decode:F8e},B8e=e=>e!=null&&e.values.length?`${e.operator}:${e.values.join(",")}`:void 0,z8e=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(",")}},wr={encode:B8e,decode:z8e},yD=(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},H8e=(e,t)=>{const[n,r]=Xf(),{value:o,setValue:i}=Au(e,{});return m.useEffect(()=>{const a=Object.fromEntries(n.entries());Object.keys(a).length>0||Object.keys(o).length!==0&&r(I0(t,o),{replace:!0})},[]),i},nh=(e,t,n=["offset"])=>{const r=H8e(e,t),[o,i]=DU(t,{updateType:"replaceIn"}),[a]=Xf(),l=m.useMemo(()=>yD(o,[...a.keys()]),[a,o,yD]),c=m.useCallback(u=>{if(!t.offset)return i(u);if(typeof u=="function")i(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;i(d)}},[i,t.offset]);return m.useEffect(()=>{const u=Object.fromEntries(Object.entries(l).filter(([d])=>!n.includes(d)));r(u)},[JSON.stringify(l)]),[l,c]};var W2={exports:{}};W2.exports;(function(e,t){var n=200,r="Expected a function",o="__lodash_hash_undefined__",i=1,a=2,l=1/0,c=9007199254740991,u="[object Arguments]",d="[object Array]",p="[object Boolean]",f="[object Date]",h="[object Error]",g="[object Function]",v="[object GeneratorFunction]",b="[object Map]",y="[object Number]",w="[object Object]",S="[object Promise]",j="[object RegExp]",E="[object Set]",C="[object String]",T="[object Symbol]",k="[object WeakMap]",_="[object ArrayBuffer]",A="[object DataView]",O="[object Float32Array]",M="[object Float64Array]",H="[object Int8Array]",P="[object Int16Array]",$="[object Int32Array]",D="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",L="[object Uint32Array]",I=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q=/^\w*$/,ee=/^\./,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oe=/[\\^$.*+?()[\]{}|]/g,ne=/\\(\\)?/g,ce=/^\[object .+?Constructor\]$/,xe=/^(?:0|[1-9]\d*)$/,re={};re[O]=re[M]=re[H]=re[P]=re[$]=re[D]=re[z]=re[B]=re[L]=!0,re[u]=re[d]=re[_]=re[p]=re[A]=re[f]=re[h]=re[g]=re[b]=re[y]=re[w]=re[j]=re[E]=re[C]=re[k]=!1;var ve=typeof Cn=="object"&&Cn&&Cn.Object===Object&&Cn,he=typeof self=="object"&&self&&self.Object===Object&&self,ye=ve||he||Function("return this")(),Pe=t&&!t.nodeType&&t,Ee=Pe&&!0&&e&&!e.nodeType&&e,Re=Ee&&Ee.exports===Pe,_e=Re&&ve.process,ge=function(){try{return _e&&_e.binding("util")}catch{}}(),ze=ge&&ge.isTypedArray;function Se(V,Q){for(var le=-1,pe=V?V.length:0;++le<pe;)if(Q(V[le],le,V))return!0;return!1}function Ve(V){return function(Q){return Q==null?void 0:Q[V]}}function Ne(V,Q){for(var le=-1,pe=Array(V);++le<V;)pe[le]=Q(le);return pe}function Xe(V){return function(Q){return V(Q)}}function yt(V,Q){return V==null?void 0:V[Q]}function wt(V){var Q=!1;if(V!=null&&typeof V.toString!="function")try{Q=!!(V+"")}catch{}return Q}function st(V){var Q=-1,le=Array(V.size);return V.forEach(function(pe,Me){le[++Q]=[Me,pe]}),le}function Ce(V,Q){return function(le){return V(Q(le))}}function Be(V){var Q=-1,le=Array(V.size);return V.forEach(function(pe){le[++Q]=pe}),le}var ue=Array.prototype,fe=Function.prototype,me=Object.prototype,Ye=ye["__core-js_shared__"],nt=function(){var V=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||"");return V?"Symbol(src)_1."+V:""}(),jt=fe.toString,We=me.hasOwnProperty,ut=me.toString,Fe=RegExp("^"+jt.call(We).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ke=ye.Symbol,lt=ye.Uint8Array,Vt=me.propertyIsEnumerable,at=ue.splice,Qt=Ce(Object.keys,Object),fn=zr(ye,"DataView"),hn=zr(ye,"Map"),Mn=zr(ye,"Promise"),Zn=zr(ye,"Set"),Nr=zr(ye,"WeakMap"),Qr=zr(Object,"create"),Mo=ui(fn),so=ui(hn),So=ui(Mn),Wn=ui(Zn),qn=ui(Nr),br=Ke?Ke.prototype:void 0,Do=br?br.valueOf:void 0,Uo=br?br.toString:void 0;function Vn(V){var Q=-1,le=V?V.length:0;for(this.clear();++Q<le;){var pe=V[Q];this.set(pe[0],pe[1])}}function Fn(){this.__data__=Qr?Qr(null):{}}function Ci(V){return this.has(V)&&delete this.__data__[V]}function Zr(V){var Q=this.__data__;if(Qr){var le=Q[V];return le===o?void 0:le}return We.call(Q,V)?Q[V]:void 0}function eo(V){var Q=this.__data__;return Qr?Q[V]!==void 0:We.call(Q,V)}function Go(V,Q){var le=this.__data__;return le[V]=Qr&&Q===void 0?o:Q,this}Vn.prototype.clear=Fn,Vn.prototype.delete=Ci,Vn.prototype.get=Zr,Vn.prototype.has=eo,Vn.prototype.set=Go;function we(V){var Q=-1,le=V?V.length:0;for(this.clear();++Q<le;){var pe=V[Q];this.set(pe[0],pe[1])}}function de(){this.__data__=[]}function et(V){var Q=this.__data__,le=Vl(Q,V);if(le<0)return!1;var pe=Q.length-1;return le==pe?Q.pop():at.call(Q,le,1),!0}function Ct(V){var Q=this.__data__,le=Vl(Q,V);return le<0?void 0:Q[le][1]}function Xt(V){return Vl(this.__data__,V)>-1}function nr(V,Q){var le=this.__data__,pe=Vl(le,V);return pe<0?le.push([V,Q]):le[pe][1]=Q,this}we.prototype.clear=de,we.prototype.delete=et,we.prototype.get=Ct,we.prototype.has=Xt,we.prototype.set=nr;function An(V){var Q=-1,le=V?V.length:0;for(this.clear();++Q<le;){var pe=V[Q];this.set(pe[0],pe[1])}}function Pt(){this.__data__={hash:new Vn,map:new(hn||we),string:new Vn}}function Br(V){return ql(this,V).delete(V)}function jp(V){return ql(this,V).get(V)}function Ep(V){return ql(this,V).has(V)}function Lu(V,Q){return ql(this,V).set(V,Q),this}An.prototype.clear=Pt,An.prototype.delete=Br,An.prototype.get=jp,An.prototype.has=Ep,An.prototype.set=Lu;function ll(V){var Q=-1,le=V?V.length:0;for(this.__data__=new An;++Q<le;)this.add(V[Q])}function Wl(V){return this.__data__.set(V,o),this}function Fu(V){return this.__data__.has(V)}ll.prototype.add=ll.prototype.push=Wl,ll.prototype.has=Fu;function qo(V){this.__data__=new we(V)}function zi(){this.__data__=new we}function Hc(V){return this.__data__.delete(V)}function Tp(V){return this.__data__.get(V)}function kp(V){return this.__data__.has(V)}function _p(V,Q){var le=this.__data__;if(le instanceof we){var pe=le.__data__;if(!hn||pe.length<n-1)return pe.push([V,Q]),this;le=this.__data__=new An(pe)}return le.set(V,Q),this}qo.prototype.clear=zi,qo.prototype.delete=Hc,qo.prototype.get=Tp,qo.prototype.has=kp,qo.prototype.set=_p;function Rp(V,Q){var le=K(V)||N(V)?Ne(V.length,String):[],pe=le.length,Me=!!pe;for(var Oe in V)We.call(V,Oe)&&!(Me&&(Oe=="length"||cl(Oe,pe)))&&le.push(Oe);return le}function Vl(V,Q){for(var le=V.length;le--;)if(Wu(V[le][0],Q))return le;return-1}var Ul=us();function Wc(V,Q){return V&&Ul(V,Q,se)}function xa(V,Q){Q=ds(Q,V)?[Q]:zu(Q);for(var le=0,pe=Q.length;V!=null&&le<pe;)V=V[dl(Q[le++])];return le&&le==pe?V:void 0}function Nu(V){return ut.call(V)}function Bu(V,Q){return V!=null&&Q in Object(V)}function Gl(V,Q,le,pe,Me){return V===Q?!0:V==null||Q==null||!bn(V)&&!R(Q)?V!==V&&Q!==Q:Pp(V,Q,Gl,le,pe,Me)}function Pp(V,Q,le,pe,Me,Oe){var qe=K(V),mt=K(Q),At=d,St=d;qe||(At=Hi(V),At=At==u?w:At),mt||(St=Hi(Q),St=St==u?w:St);var Qe=At==w&&!wt(V),zt=St==w&&!wt(Q),dt=At==St;if(dt&&!Qe)return Oe||(Oe=new qo),qe||G(V)?Uc(V,Q,le,pe,Me,Oe):Mp(V,Q,At,le,pe,Me,Oe);if(!(Me&a)){var Ht=Qe&&We.call(V,"__wrapped__"),nn=zt&&We.call(Q,"__wrapped__");if(Ht||nn){var Wt=Ht?V.value():V,Ut=nn?Q.value():Q;return Oe||(Oe=new qo),le(Wt,Ut,pe,Me,Oe)}}return dt?(Oe||(Oe=new qo),Dp(V,Q,le,pe,Me,Oe)):!1}function Ap(V,Q,le,pe){var Me=le.length,Oe=Me;if(V==null)return!Oe;for(V=Object(V);Me--;){var qe=le[Me];if(qe[2]?qe[1]!==V[qe[0]]:!(qe[0]in V))return!1}for(;++Me<Oe;){qe=le[Me];var mt=qe[0],At=V[mt],St=qe[1];if(qe[2]){if(At===void 0&&!(mt in V))return!1}else{var Qe=new qo,zt;if(!(zt===void 0?Gl(St,At,pe,i|a,Qe):zt))return!1}}return!0}function Ip(V){if(!bn(V)||Yl(V))return!1;var Q=an(V)||wt(V)?Fe:ce;return Q.test(ui(V))}function Vc(V){return R(V)&&Bt(V.length)&&!!re[ut.call(V)]}function $p(V){return typeof V=="function"?V:V==null?Ie:typeof V=="object"?K(V)?ji(V[0],V[1]):ba(V):De(V)}function Op(V){if(!Kl(V))return Qt(V);var Q=[];for(var le in Object(V))We.call(V,le)&&le!="constructor"&&Q.push(le);return Q}function ba(V){var Q=Gc(V);return Q.length==1&&Q[0][2]?Xl(Q[0][0],Q[0][1]):function(le){return le===V||Ap(le,V,Q)}}function ji(V,Q){return ds(V)&&wa(Q)?Xl(dl(V),Q):function(le){var pe=ie(le,V);return pe===void 0&&pe===Q?te(le,V):Gl(Q,pe,void 0,i|a)}}function cs(V){return function(Q){return xa(Q,V)}}function Ds(V){if(typeof V=="string")return V;if(U(V))return Uo?Uo.call(V):"";var Q=V+"";return Q=="0"&&1/V==-l?"-0":Q}function zu(V){return K(V)?V:Wi(V)}function us(V){return function(Q,le,pe){for(var Me=-1,Oe=Object(Q),qe=pe(Q),mt=qe.length;mt--;){var At=qe[++Me];if(le(Oe[At],At,Oe)===!1)break}return Q}}function Uc(V,Q,le,pe,Me,Oe){var qe=Me&a,mt=V.length,At=Q.length;if(mt!=At&&!(qe&&At>mt))return!1;var St=Oe.get(V);if(St&&Oe.get(Q))return St==Q;var Qe=-1,zt=!0,dt=Me&i?new ll:void 0;for(Oe.set(V,Q),Oe.set(Q,V);++Qe<mt;){var Ht=V[Qe],nn=Q[Qe];if(pe)var Wt=qe?pe(nn,Ht,Qe,Q,V,Oe):pe(Ht,nn,Qe,V,Q,Oe);if(Wt!==void 0){if(Wt)continue;zt=!1;break}if(dt){if(!Se(Q,function(Ut,wn){if(!dt.has(wn)&&(Ht===Ut||le(Ht,Ut,pe,Me,Oe)))return dt.add(wn)})){zt=!1;break}}else if(!(Ht===nn||le(Ht,nn,pe,Me,Oe))){zt=!1;break}}return Oe.delete(V),Oe.delete(Q),zt}function Mp(V,Q,le,pe,Me,Oe,qe){switch(le){case A:if(V.byteLength!=Q.byteLength||V.byteOffset!=Q.byteOffset)return!1;V=V.buffer,Q=Q.buffer;case _:return!(V.byteLength!=Q.byteLength||!pe(new lt(V),new lt(Q)));case p:case f:case y:return Wu(+V,+Q);case h:return V.name==Q.name&&V.message==Q.message;case j:case C:return V==Q+"";case b:var mt=st;case E:var At=Oe&a;if(mt||(mt=Be),V.size!=Q.size&&!At)return!1;var St=qe.get(V);if(St)return St==Q;Oe|=i,qe.set(V,Q);var Qe=Uc(mt(V),mt(Q),pe,Me,Oe,qe);return qe.delete(V),Qe;case T:if(Do)return Do.call(V)==Do.call(Q)}return!1}function Dp(V,Q,le,pe,Me,Oe){var qe=Me&a,mt=se(V),At=mt.length,St=se(Q),Qe=St.length;if(At!=Qe&&!qe)return!1;for(var zt=At;zt--;){var dt=mt[zt];if(!(qe?dt in Q:We.call(Q,dt)))return!1}var Ht=Oe.get(V);if(Ht&&Oe.get(Q))return Ht==Q;var nn=!0;Oe.set(V,Q),Oe.set(Q,V);for(var Wt=qe;++zt<At;){dt=mt[zt];var Ut=V[dt],wn=Q[dt];if(pe)var rn=qe?pe(wn,Ut,dt,Q,V,Oe):pe(Ut,wn,dt,V,Q,Oe);if(!(rn===void 0?Ut===wn||le(Ut,wn,pe,Me,Oe):rn)){nn=!1;break}Wt||(Wt=dt=="constructor")}if(nn&&!Wt){var Rn=V.constructor,Sn=Q.constructor;Rn!=Sn&&"constructor"in V&&"constructor"in Q&&!(typeof Rn=="function"&&Rn instanceof Rn&&typeof Sn=="function"&&Sn instanceof Sn)&&(nn=!1)}return Oe.delete(V),Oe.delete(Q),nn}function ql(V,Q){var le=V.__data__;return ul(Q)?le[typeof Q=="string"?"string":"hash"]:le.map}function Gc(V){for(var Q=se(V),le=Q.length;le--;){var pe=Q[le],Me=V[pe];Q[le]=[pe,Me,wa(Me)]}return Q}function zr(V,Q){var le=yt(V,Q);return Ip(le)?le:void 0}var Hi=Nu;(fn&&Hi(new fn(new ArrayBuffer(1)))!=A||hn&&Hi(new hn)!=b||Mn&&Hi(Mn.resolve())!=S||Zn&&Hi(new Zn)!=E||Nr&&Hi(new Nr)!=k)&&(Hi=function(V){var Q=ut.call(V),le=Q==w?V.constructor:void 0,pe=le?ui(le):void 0;if(pe)switch(pe){case Mo:return A;case so:return b;case So:return S;case Wn:return E;case qn:return k}return Q});function Hu(V,Q,le){Q=ds(Q,V)?[Q]:zu(Q);for(var pe,Me=-1,qe=Q.length;++Me<qe;){var Oe=dl(Q[Me]);if(!(pe=V!=null&&le(V,Oe)))break;V=V[Oe]}if(pe)return pe;var qe=V?V.length:0;return!!qe&&Bt(qe)&&cl(Oe,qe)&&(K(V)||N(V))}function cl(V,Q){return Q=Q??c,!!Q&&(typeof V=="number"||xe.test(V))&&V>-1&&V%1==0&&V<Q}function ds(V,Q){if(K(V))return!1;var le=typeof V;return le=="number"||le=="symbol"||le=="boolean"||V==null||U(V)?!0:q.test(V)||!I.test(V)||Q!=null&&V in Object(Q)}function ul(V){var Q=typeof V;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?V!=="__proto__":V===null}function Yl(V){return!!nt&&nt in V}function Kl(V){var Q=V&&V.constructor,le=typeof Q=="function"&&Q.prototype||me;return V===le}function wa(V){return V===V&&!bn(V)}function Xl(V,Q){return function(le){return le==null?!1:le[V]===Q&&(Q!==void 0||V in Object(le))}}var Wi=qc(function(V){V=Y(V);var Q=[];return ee.test(V)&&Q.push(""),V.replace(W,function(le,pe,Me,Oe){Q.push(Me?Oe.replace(ne,"$1"):pe||le)}),Q});function dl(V){if(typeof V=="string"||U(V))return V;var Q=V+"";return Q=="0"&&1/V==-l?"-0":Q}function ui(V){if(V!=null){try{return jt.call(V)}catch{}try{return V+""}catch{}}return""}function qc(V,Q){if(typeof V!="function"||Q&&typeof Q!="function")throw new TypeError(r);var le=function(){var pe=arguments,Me=Q?Q.apply(this,pe):pe[0],Oe=le.cache;if(Oe.has(Me))return Oe.get(Me);var qe=V.apply(this,pe);return le.cache=Oe.set(Me,qe),qe};return le.cache=new(qc.Cache||An),le}qc.Cache=An;function Wu(V,Q){return V===Q||V!==V&&Q!==Q}function N(V){return Le(V)&&We.call(V,"callee")&&(!Vt.call(V,"callee")||ut.call(V)==u)}var K=Array.isArray;function ae(V){return V!=null&&Bt(V.length)&&!an(V)}function Le(V){return R(V)&&ae(V)}function an(V){var Q=bn(V)?ut.call(V):"";return Q==g||Q==v}function Bt(V){return typeof V=="number"&&V>-1&&V%1==0&&V<=c}function bn(V){var Q=typeof V;return!!V&&(Q=="object"||Q=="function")}function R(V){return!!V&&typeof V=="object"}function U(V){return typeof V=="symbol"||R(V)&&ut.call(V)==T}var G=ze?Xe(ze):Vc;function Y(V){return V==null?"":Ds(V)}function ie(V,Q,le){var pe=V==null?void 0:xa(V,Q);return pe===void 0?le:pe}function te(V,Q){return V!=null&&Hu(V,Q,Bu)}function se(V){return ae(V)?Rp(V):Op(V)}function je(V,Q){var le={};return Q=$p(Q),Wc(V,function(pe,Me,Oe){le[Me]=Q(pe,Me,Oe)}),le}function Ie(V){return V}function De(V){return ds(V)?Ve(dl(V)):cs(V)}e.exports=je})(W2,W2.exports);var W8e=W2.exports;const OA=Vo(W8e),V8e=(e=M8e)=>{const t="features-list-table",n={offset:ho(yg,0),limit:ho(yg,e),query:Ss,favoritesFirst:ho(N8e,!0),sortBy:ho(Ss,"createdAt"),sortOrder:ho(Ss,"desc"),project:wr,tag:wr,state:wr,segment:wr,createdAt:wr,type:wr,lifecycle:wr,createdBy:wr},[r,o]=nh(`${t}`,n),{offset:i,limit:a,query:l,favoritesFirst:c,sortBy:u,sortOrder:d,...p}=r,{features:f=[],total:h,loading:g,refetch:v,initialLoad:b}=xC(OA(I0(n,r),y=>y?`${y}`:void 0));return{features:f,total:h,refetch:v,loading:g,initialLoad:b,tableState:r,setTableState:o,filterState:p}},xD=([e,t],n,r)=>m.useCallback(o=>{const i=n?n[e]:void 0;console.log({key:e,operator:t,state:i,value:o}),i&&i.values.length>0&&!i.values.includes(`${o}`)?r({...n,[e]:{operator:i.operator,values:[...i.values,o]}}):i||r({...n,[e]:{operator:t,values:[o]}})},[n,r,e,t]),U8e=()=>{const{data:e,error:t}=_n(bt("api/admin/lifecycle/count"),G8e);return{lifecycleCount:e,error:t,loading:!t&&!e}},G8e=e=>fetch(e).then(Jt("Lifecycle count")).then(t=>t.json()),q8e=x(da,{shouldForwardProp:e=>e!=="isActive"})(({theme:e,isActive:t=!1})=>({borderRadius:`${e.shape.borderRadius}px`,padding:e.spacing(.5),fontSize:e.typography.body2.fontSize,height:"auto",...t&&{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}})),Y8e=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",padding:e.spacing(1.5,3,0,3),minHeight:e.spacing(7),gap:e.spacing(2)})),K8e=x(J)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",gap:e.spacing(1)})),X8e=[{label:"All flags",value:null},{label:"Develop",value:"pre-live"},{label:"Rollout production",value:"live"},{label:"Cleanup",value:"completed"}],J8e=(e,t)=>t?e===null?(t.initial||0)+(t.preLive||0)+(t.live||0)+(t.completed||0):t[e==="pre-live"?"preLive":e]:void 0,Q8e=({state:e,onChange:t,total:n,children:r})=>{var a;const{lifecycleCount:o}=U8e(),i=((a=e.lifecycle)==null?void 0:a.values)??[];return s.jsxs(Y8e,{children:[s.jsx(K8e,{children:X8e.map(({label:l,value:c})=>{const u=c===null?!e.lifecycle:i.includes(c),d=J8e(c,o),p=u&&Number.isInteger(n)?`${l} (${n===d?n:`${n} of ${d}`})`:`${l}${d!==void 0?` (${d})`:""}`,f=()=>t(c===null?{lifecycle:null}:{lifecycle:{operator:"IS",values:[c]}});return s.jsx(q8e,{label:p,variant:"outlined",isActive:u,onClick:f},l)})}),r]})};var MA={},Z8e=Te;Object.defineProperty(MA,"__esModule",{value:!0});var GX=MA.default=void 0,eMe=Z8e(ke()),tMe=s,nMe=(0,eMe.default)((0,tMe.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");GX=MA.default=nMe;const rMe=({onClick:e})=>{const{trackEvent:t}=Kt();return s.jsx(kt,{title:"Export flags",arrow:!0,children:s.jsx($t,{onClick:()=>{e(),t("search-feature-buttons",{props:{action:"export"}})},size:"small",children:s.jsx(GX,{})})})},dm=(e={})=>{const t=async()=>{const c=bt("api/admin/feature-types");return(await fetch(c,{method:"GET"}).then(Jt("Feature types"))).json()},n="api/admin/feature-types",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=()=>{Io(n)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{featureTypes:(r==null?void 0:r.types)||[],error:o,loading:i,refetch:l}},oMe="experiment",iMe="release",sMe="operational",aMe="kill-switch",lMe="permission";var DA={},cMe=Te;Object.defineProperty(DA,"__esModule",{value:!0});var mT=DA.default=void 0,uMe=cMe(ke()),dMe=s,pMe=(0,uMe.default)((0,dMe.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");mT=DA.default=pMe;var LA={},fMe=Te;Object.defineProperty(LA,"__esModule",{value:!0});var qX=LA.default=void 0,hMe=fMe(ke()),gMe=s,mMe=(0,hMe.default)((0,gMe.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");qX=LA.default=mMe;var FA={},vMe=Te;Object.defineProperty(FA,"__esModule",{value:!0});var bC=FA.default=void 0,yMe=vMe(ke()),xMe=s,bMe=(0,yMe.default)((0,xMe.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");bC=FA.default=bMe;var NA={},wMe=Te;Object.defineProperty(NA,"__esModule",{value:!0});var YX=NA.default=void 0,SMe=wMe(ke()),CMe=s,jMe=(0,SMe.default)((0,CMe.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");YX=NA.default=jMe;var BA={},EMe=Te;Object.defineProperty(BA,"__esModule",{value:!0});var KX=BA.default=void 0,TMe=EMe(ke()),kMe=s,_Me=(0,TMe.default)((0,kMe.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");KX=BA.default=_Me;const wC=e=>{switch(e){case iMe:return mT;case oMe:return qX;case aMe:return bC;case sMe:return KX;case lMe:return YX;default:return mT}},RMe=x("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}`}})),PMe=x("span")(({theme:e,color:t="neutral"})=>({display:"flex",color:t==="disabled"?e.palette.action.disabled:e.palette[t].main})),bD=(e,t)=>s.jsx(PMe,{color:e,children:s.jsx(X,{condition:!!(t!=null&&t.props.sx),show:t,elseShow:t?m.cloneElement(t,{sx:{fontSize:"16px"}}):null})}),sn=m.forwardRef(({as:e="span",color:t="neutral",icon:n,iconRight:r,className:o,sx:i,children:a,...l},c)=>s.jsxs(RMe,{as:e,color:t,icon:n,className:o,sx:i,...l,ref:c,children:[s.jsx(X,{condition:!!n&&!r,show:bD(t,n)}),s.jsx(X,{condition:a!=null&&a!=="",show:s.jsx("span",{children:a})}),s.jsx(X,{condition:!!n&&!!r,show:bD(t,n)})]})),AMe={environments:[],name:"",type:"release",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1,dependencies:[],children:[]},Al=(e,t,n)=>{const r=$Me(e,t),{data:o,error:i,mutate:a}=_n(["useFeature",r],()=>IMe(r),n),l=m.useCallback(()=>{a().catch(console.warn)},[a]);return{feature:(o==null?void 0:o.body)||AMe,refetchFeature:l,loading:!i&&!o,status:o==null?void 0:o.status,error:i}},IMe=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await Jt("Feature flag data")(t),{status:t.status,body:await t.json()})},$Me=(e,t)=>bt(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`),OMe=x(da)(({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)}})),MMe=x("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})),XX=({tag:e,onDelete:t,deleteIcon:n,maxLength:r=30})=>{const o=Ig(e),i=o.length>r,a=e.color&&e.color!=="#FFFFFF";let l=e.value;if(i){const u=Math.max(0,r-e.type.length-1);l=`${e.value.substring(0,u)}...`}const c=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[a&&s.jsx(MMe,{$color:e.color}),s.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:`${e.type}:${l}`})]});return s.jsx(OMe,{label:c,onDelete:t,deleteIcon:n,title:i?o:void 0})},DMe=x(xt)({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}}),LMe=x("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"}));x(da)(({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 FMe=({text:e,searchQuery:t})=>s.jsx(X,{condition:!!(e&&e.length>40),show:s.jsx(hr,{title:s.jsx(Kr,{search:t,children:e}),placement:"bottom-start",arrow:!0,children:s.jsx(O2,{"data-loading":!0,children:s.jsx(Kr,{search:t,children:e})})}),elseShow:s.jsx(O2,{"data-loading":!0,children:s.jsx(Kr,{search:t,children:e})})}),NMe=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5),margin:e.spacing(1.25,0,1,0),paddingLeft:e.spacing(2)})),BMe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.dark})),zMe=x(J)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.25)})),HMe=x(sn)(({theme:e})=>({padding:e.spacing(.5),border:0,textTransform:"capitalize"})),WMe=({project:e,feature:t,searchQuery:n})=>s.jsx(J,{sx:r=>({fontWeight:r.typography.fontWeightBold}),children:s.jsx(DMe,{to:`/projects/${e}/features/${t}`,children:s.jsx(yo,{lines:1,title:t,arrow:!0,sx:{overflowWrap:"anywhere"},children:s.jsx("span",{children:s.jsx(Kr,{search:n,children:t})})})})}),VMe=({feature:e,searchQuery:t})=>s.jsx(yo,{lines:1,title:e,arrow:!0,sx:n=>({fontWeight:n.typography.fontWeightBold,color:n.palette.neutral.main,overflowWrap:"anywhere"}),children:s.jsx(Kr,{search:t,children:e})}),q3=({tag:e,onClick:t})=>{const n=Ig(e),r=s.jsx(J,{onClick:()=>t(e),sx:{cursor:"pointer"},children:s.jsx(XX,{tag:e,maxLength:30})});return s.jsx(hr,{title:n,arrow:!0,children:s.jsx("span",{children:r})},n)},UMe=({tags:e,onClick:t})=>s.jsx(hr,{title:e.map(n=>{const r=Ig(n);return s.jsx(J,{sx:{cursor:"pointer"},onClick:()=>t(r),children:s.jsx(XX,{tag:n,maxLength:30})},r)}),children:s.jsxs(LMe,{sx:{cursor:"initial",borderRadius:n=>n.spacing(2)},children:[e.length," more..."]})}),GMe=({tags:e,onClick:t})=>{if(!e||e.length===0)return null;const[n,r,o,...i]=e,a=l=>{t(Ig(l))};return s.jsxs(zMe,{children:[n&&s.jsx(q3,{tag:n,onClick:a}),r&&s.jsx(q3,{tag:r,onClick:a}),o&&s.jsx(q3,{tag:o,onClick:a}),s.jsx(X,{condition:i.length>0,show:s.jsx(UMe,{tags:i,onClick:t})})]})},qMe=x(xt)({display:"block"}),YMe=({feature:e,project:t})=>{const{feature:n}=Al(t,e),r=n.children,o=n.dependencies;if(r.length>0)return s.jsxs(s.Fragment,{children:[s.jsx(J,{children:"Children"}),r.map(i=>s.jsx(qMe,{to:`/projects/${t}/features/${i}`,children:i},i))]});if(o[0]){const i=o[0].feature;return s.jsxs(s.Fragment,{children:[s.jsx(J,{children:"Parent"}),s.jsx(xt,{to:`/projects/${t}/features/${i}`,children:i})]})}return s.jsx(s.Fragment,{children:"Loading..."})},KMe=({project:e,feature:t,archivedAt:n,type:r,searchQuery:o,dependencyType:i,onTypeClick:a,delay:l=500})=>{var v;const{featureTypes:c}=dm(),u=wC(r),p=`${((v=c.find(b=>b.id===r))==null?void 0:v.name)||r} flag`,{locationSettings:f}=wo(),h=eA(n,f.locale),g=()=>s.jsx(hr,{arrow:!0,title:p,describeChild:!0,children:s.jsx($t,{sx:{p:0},"aria-label":`add ${r} flag to filter`,onClick:()=>a(r),children:s.jsx(u,{sx:b=>({fontSize:b.spacing(2)}),"data-testid":"feature-type-icon"})})});return s.jsxs(BMe,{"data-loading":!0,children:[s.jsx(g,{}),n?s.jsx(VMe,{feature:t,searchQuery:o}):s.jsx(WMe,{project:e,feature:t,searchQuery:o}),s.jsx(X,{condition:!!i,show:s.jsx(hr,{title:s.jsx(YMe,{feature:t,project:e}),enterDelay:l,enterNextDelay:l,children:s.jsx(HMe,{color:i==="parent"?"warning":"secondary",children:i})})}),n&&s.jsx(hr,{arrow:!0,title:h,describeChild:!0,children:s.jsx(sn,{tabIndex:0,color:"neutral",children:"Archived"})})]})},XMe=({description:e,searchQuery:t})=>s.jsx(X,{condition:!!e,show:s.jsx(J,{sx:n=>({display:"flex",gap:n.spacing(1)}),children:s.jsx(FMe,{text:e,searchQuery:t})})}),JMe=(e,t)=>({row:n})=>{const{searchQuery:r}=ga();return s.jsxs(NMe,{children:[s.jsx(KMe,{project:n.original.project||"",feature:n.original.name,archivedAt:n.original.archivedAt,searchQuery:r,type:n.original.type||"",dependencyType:n.original.dependencyType||"",onTypeClick:t}),s.jsx(XMe,{description:n.original.description||"",searchQuery:r}),s.jsx(GMe,{tags:n.original.tags,onClick:e})]})},Bc=x("div")(()=>({border:0,clip:"rect(0 0 0 0)",height:"auto",margin:0,overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"})),QMe=x("div")({width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}),ZMe=x("button")({border:"none",background:"none",cursor:"pointer",borderRadius:"100%",padding:0}),e7e=x("p")(({theme:e})=>({color:e.palette.text.secondary})),t7e=x(hp)(({theme:e})=>({width:e.spacing(3),height:e.spacing(3)})),n7e=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),i=r?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:n.name}),s.jsx(e7e,{children:"You can't filter by unknown users."})]}):s.jsx("p",{children:n.name}),a=s.jsxs(s.Fragment,{children:[s.jsx(Bc,{children:s.jsxs("span",{children:["Show only flags created by ",n.name]})}),s.jsx(t7e,{disableTooltip:!0,user:{id:n.id,name:n.name,imageUrl:n.imageUrl}})]});return s.jsx(QMe,{children:s.jsx(hr,{arrow:!0,describeChild:!0,title:i,children:e?s.jsx(ZMe,{"aria-disabled":r,onClick:o,children:a}):s.jsx("div",{children:a})})})},lf="production",r7e=({lifecycle:e,environments:t})=>{if((e==null?void 0:e.stage)==="initial"){if(t!=null&&t.some(r=>r.type!==lf&&r.enabled))return"No traffic";if(!(t!=null&&t.some(r=>r.type!==lf&&r.hasStrategies)))return"No strategies";if(!(t!=null&&t.some(r=>r.type!==lf&&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===lf);if((e==null?void 0:e.stage)==="live"||(e==null?void 0:e.stage)==="completed"){if(n.length>1){const o=n.filter(i=>i.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 zA={},o7e=Te;Object.defineProperty(zA,"__esModule",{value:!0});var JX=zA.default=void 0,i7e=o7e(ke()),s7e=s,a7e=(0,i7e.default)((0,s7e.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");JX=zA.default=a7e;const l7e=x("div")(({theme:e})=>({padding:e.spacing(0,2),display:"flex",alignItems:"center",gap:e.spacing(.5),minWidth:"180px"})),c7e=x(JX)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(3.5),padding:e.spacing(.5)})),u7e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",gap:e.spacing(.5),ul:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column"}})),d7e=({lifecycle:e,environments:t,project:n})=>{const r=m.useMemo(()=>r7e({lifecycle:e,environments:t}),[e,t]),o=m.useMemo(()=>t.flatMap(i=>i.changeRequestIds),[t]);return s.jsxs(l7e,{children:[s.jsx(yo,{title:r,lines:2,children:r}),o.length>0&&s.jsx(hr,{arrow:!0,title:s.jsxs(u7e,{children:[s.jsx("div",{children:"Change requests:"}),s.jsx("ul",{children:o.map(i=>s.jsx("li",{children:s.jsx(xt,{to:`/projects/${n}/change-requests/${i}`,target:"_blank",rel:"noopener noreferrer",children:`#${i}`})},i))})]}),children:s.jsx(c7e,{"data-testid":"change-requests-icon",tabIndex:0})})]})},QX=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:[]}),Np=wK(),p7e=()=>{var $;const e=qt(),{isOss:t}=rt(),{trackEvent:n}=Kt(),{environments:r}=$u(),o=r.filter(D=>D.enabled).map(D=>D.name),i=Xn(e.breakpoints.down("md")),a=Xn(e.breakpoints.down("lg")),[l,c]=m.useState(!1),{setToastApiError:u}=Nt(),{features:d,total:p,refetch:f,loading:h,initialLoad:g,tableState:v,setTableState:b,filterState:y}=V8e(),w=xD(["type","IS"],v,b),S=xD(["tag","INCLUDE"],v,b),{projects:j}=Xr(),E=$l(h),{favorite:C,unfavorite:T}=$Ae(),k=m.useCallback(async D=>{try{D!=null&&D.favorite?await T(D.project,D.name):await C(D.project,D.name),f()}catch{u("Something went wrong, could not update favorite")}},[C,f,T,u]),_=!t(),A=m.useMemo(()=>[Np.accessor("favorite",{header:()=>s.jsx(VAe,{isActive:v.favoritesFirst,onClick:()=>b({favoritesFirst:!v.favoritesFirst})}),cell:({getValue:D,row:z})=>s.jsx(sX,{value:D(),onClick:()=>k(z.original)}),enableSorting:!1,meta:{width:48}}),Np.accessor("name",{header:"Name",cell:JMe(S,w),meta:{width:"40%"}}),Np.accessor("createdAt",{header:"Created",cell:({getValue:D})=>s.jsx(Jd,{value:D()}),meta:{width:"1%"}}),Np.accessor("createdBy",{id:"createdBy",header:"By",cell:n7e(),meta:{width:"1%",align:"center"},enableSorting:!1}),Np.accessor("lifecycle",{id:"lifecycle",header:"Lifecycle",cell:({row:{original:D}})=>s.jsx(R$e,{feature:D,expanded:!0,"data-loading":!0}),enableSorting:!1,size:50,meta:{width:"1%"}}),..._?[Np.accessor("environments",{id:"status",header:"Status",cell:({row:{original:D}})=>s.jsx(d7e,{...D}),enableSorting:!1,size:350})]:[],Np.accessor("project",{header:"Project",cell:({getValue:D})=>{var L;const z=D(),B=(L=j.find(I=>I.id===z))==null?void 0:L.name;return s.jsx(J,{sx:{minWidth:"180px"},children:s.jsx(Rl,{title:B||z,to:`/projects/${z}`})})}})],[v.favoritesFirst,_]),O=m.useMemo(()=>(d==null?void 0:d.length)===0&&h?QX:d,[g,d,h]),M=IK(VX(v,b,{columns:A,data:O}));m.useEffect(()=>{i?M.setColumnVisibility({type:!1,createdAt:!1,tags:!1,lastSeenAt:!1,stale:!1}):a?M.setColumnVisibility({lastSeenAt:!1,stale:!1}):M.setColumnVisibility({})},[i,a]);const H=(D="")=>{b({query:D}),n("search-bar",{props:{screen:"features",length:D.length}})},P=M.getRowModel().rows;return r.length>0?s.jsxs(cr,{disableLoading:!0,bodyClass:"no-padding",header:s.jsx(Pn,{title:"Flags overview",actions:s.jsxs(s.Fragment,{children:[s.jsx(kn,{component:xt,to:"/unknown-flags",underline:"always",sx:{marginRight:2,...Cu(e)},children:"Unknown flags"}),s.jsx(kn,{component:xt,to:"/archive",underline:"always",sx:{marginRight:2,...Cu(e)},onClick:()=>{n("search-feature-buttons",{props:{action:"archive"}})},children:"Archived flags"}),s.jsx(rMe,{onClick:()=>c(!0)})]})}),children:[s.jsx(Q8e,{state:y,onChange:b,total:h?void 0:p,children:i?null:s.jsx(xo,{placeholder:"Search",initialValue:v.query||"",onChange:H,id:"globalFeatureFlags"})}),s.jsx(j8e,{onChange:b,state:y}),i?s.jsx(J,{sx:D=>({padding:D.spacing(0,3,3)}),children:s.jsx(xo,{initialValue:v.query||"",onChange:H,id:"globalFeatureFlags"})}):null,s.jsx(is,{value:v.query||"",children:s.jsx("div",{ref:E,children:s.jsx(NK,{tableInstance:M,totalItems:p})})}),s.jsx(X,{condition:P.length===0,show:s.jsx(J,{sx:D=>({padding:D.spacing(0,2,2)}),children:s.jsx(X,{condition:(($=v.query||"")==null?void 0:$.length)>0,show:s.jsxs($r,{children:["No feature flags found matching “",v.query,"”"]}),elseShow:s.jsx($r,{children:"No feature flags found matching your criteria."})})})}),s.jsx(o9e,{showExportDialog:l,data:O,onClose:()=>c(!1),environments:o})]}):null},f7e=["flexibleRollout","default"],h7e=e=>e.map(t=>({...t,advanced:!f7e.includes(t.name)})),rh=()=>{const{data:e,error:t}=_n(vT,g7e),n=m.useCallback(()=>{Io(vT).catch(console.warn)},[]);return{strategies:h7e((e==null?void 0:e.strategies)||v7e),refetchStrategies:n,loading:!t&&!e,error:t}},g7e=()=>fetch(vT).then(Jt("Strategy types")).then(e=>e.json()),m7e={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}]},v7e=[m7e],vT=bt("api/admin/strategies");function ZX(e,t=""){return(n={},r="",o={})=>{const i=new URLSearchParams(Array.from(Object.entries(n).filter(([h,g])=>!!g).map(([h,g])=>[h,g.toString()]))).toString(),a=r||t,l=`${a}${i}`;yC(l,a);const c=async()=>fetch(bt(l),{method:"GET"}).then(Jt("Paginated data")).then(h=>h.json()),{data:u,error:d,isLoading:p}=_n(l,c,{...o});return{...u||e,total:(u==null?void 0:u.total)||0,error:d,loading:p}}}const y7e="api/admin/metrics/applications?",eJ=ZX({applications:[],total:0},y7e);var HA={},x7e=Te;Object.defineProperty(HA,"__esModule",{value:!0});var Oo=HA.default=void 0,b7e=x7e(ke()),w7e=s,S7e=(0,b7e.default)((0,w7e.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Oo=HA.default=S7e;var WA={},C7e=Te;Object.defineProperty(WA,"__esModule",{value:!0});var tJ=WA.default=void 0,j7e=C7e(ke()),E7e=s,T7e=(0,j7e.default)((0,E7e.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");tJ=WA.default=T7e;var VA={},k7e=Te;Object.defineProperty(VA,"__esModule",{value:!0});var nJ=VA.default=void 0,_7e=k7e(ke()),R7e=s,P7e=(0,_7e.default)((0,R7e.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");nJ=VA.default=P7e;const A7e="_truncate_19sq2_2",I7e="_fullwidth_19sq2_8",$7e="_sectionPadding_19sq2_12",O7e="_horisontalScroll_19sq2_16",M7e="_listLink_19sq2_25",D7e="_hideLt920_19sq2_36",L7e="_hideLt600_19sq2_41",F7e="_dataTableHeader_19sq2_45",N7e="_titleText_19sq2_50",B7e="_actions_19sq2_55",z7e="_switchWithLabel_19sq2_59",H7e="_label_19sq2_62",W7e="_emptyState_19sq2_71",V7e="_toggleName_19sq2_79",U7e="_toolbar_19sq2_84",G7e="_toolbarButton_19sq2_90",q7e="_error_19sq2_97",Y7e="_headerTitle_19sq2_101",K7e="_listItem_19sq2_106",X7e="_section_19sq2_12",J7e="_contentPadding_19sq2_114",Q7e="_contentSpacing_19sq2_118",Z7e="_searchField_19sq2_122",s1={truncate:A7e,fullwidth:I7e,sectionPadding:$7e,horisontalScroll:O7e,listLink:M7e,hideLt920:D7e,hideLt600:L7e,dataTableHeader:F7e,titleText:N7e,actions:B7e,switchWithLabel:z7e,label:H7e,switch:"_switch_19sq2_59",emptyState:W7e,toggleName:V7e,toolbar:U7e,toolbarButton:G7e,error:q7e,headerTitle:Y7e,listItem:K7e,section:X7e,contentPadding:J7e,contentSpacing:Q7e,searchField:Z7e},rJ=({apps:e})=>s.jsx(Ni,{children:s.jsx(X,{condition:e.length>0,show:e.map(({appName:t,description:n,icon:r})=>s.jsxs(Gr,{className:s1.listItem,children:[s.jsx(B4,{children:s.jsx(IS,{children:s.jsx(X,{condition:r,show:s.jsx(Ka,{children:r}),elseShow:s.jsx(nJ,{})},`avatar_conditional_${t}`)})}),s.jsx(dn,{primary:s.jsx(xt,{to:`/applications/${encodeURIComponent(t)}`,className:[s1.listLink,s1.truncate].join(" "),children:t}),secondary:n||"No description"})]},t))})});rJ.propTypes={apps:$e.array.isRequired};$e.string,$e.any;$e.string,$e.func.isRequired,$e.string;$e.string,$e.object;const eDe=Je.forwardRef(({icon:e,label:t,disabled:n,...r},o)=>s.jsxs(Cr,{disabled:n,style:{display:"flex",alignItems:"center"},...r,children:[s.jsx(e,{}),t]}));eDe.propTypes={icon:$e.object,label:$e.string,disabled:$e.bool};const tDe="_deprecated_nqviu_10",nDe="_formButtons_nqviu_14",rDe="_header_nqviu_18",oDe="_formContainer_nqviu_32",iDe="_inset_nqviu_38",sDe="_parameter_menu_nqviu_42",aDe="_listcontainer_nqviu_52",lDe="_listItem_nqviu_56",cDe={"non-style-button":"_non-style-button_nqviu_1",deprecated:tDe,formButtons:nDe,header:rDe,formContainer:oDe,inset:iDe,parameter_menu:sDe,listcontainer:aDe,listItem:lDe},uDe=({strategy:e,applications:t})=>{const n=qt(),{parameters:r=[]}=e,o=i=>i.length>0?i.map(({name:a,type:l,description:c,required:u},d)=>s.jsxs(Gr,{children:[s.jsx(X,{condition:u,show:s.jsx(B4,{children:s.jsx(kt,{title:"Required parameter",arrow:!0,children:s.jsx(Oo,{"aria-hidden":!1})})}),elseShow:s.jsx(B4,{children:s.jsx(kt,{title:"Optional parameter",arrow:!0,children:s.jsx(tJ,{"aria-hidden":!1})})})}),s.jsx(dn,{primary:s.jsxs("div",{children:[a," ",s.jsxs("small",{children:["(",l,")"]})]}),secondary:c})]},`${a}-${d}`)):s.jsx(Gr,{children:"No params"});return s.jsx("div",{className:cDe.listcontainer,children:s.jsxs(jo,{container:!0,children:[s.jsx(X,{condition:e.deprecated,show:s.jsx(jo,{item:!0,children:s.jsx("h5",{style:{color:n.palette.error.main},children:"Deprecated"})})}),s.jsxs(jo,{item:!0,sm:12,md:12,children:[s.jsx("h6",{children:"Parameters"}),s.jsx("hr",{}),s.jsx(Ni,{children:o(r)})]}),s.jsxs(jo,{item:!0,sm:12,md:12,children:[s.jsxs("h6",{children:["Applications using this strategy"," ",t.length>=1e3&&"(Capped at 1000)"]}),s.jsx("hr",{}),s.jsx(rJ,{apps:t})]})]})})},dDe=e=>{const t=Nf(e.permission,e.projectId,e.environmentId);return s.jsx(oJ,{...e,access:t})},pDe=e=>{const t=Pg(e.permission,e.projectId,e.environmentId);return s.jsx(oJ,{...e,access:t})},oJ=({access:e,permission:t,projectId:n,children:r,environmentId:o,tooltipProps:i,disabled:a,...l})=>{const c=Eu();return s.jsx(Qa,{...i,title:oC(e,i==null?void 0:i.title),arrow:!0,onClick:u=>u.preventDefault(),children:s.jsx("div",{id:c,children:s.jsx($t,{...l,disabled:!e||a,"aria-labelledby":c,size:l.size||"large",children:r})})})},Wo=e=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?s.jsx(pDe,{...e,projectId:e.projectId,environmentId:e.environmentId}):s.jsx(dDe,{...e});var UA={},fDe=Te;Object.defineProperty(UA,"__esModule",{value:!0});var ns=UA.default=void 0,hDe=fDe(ke()),gDe=s,mDe=(0,hDe.default)((0,gDe.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");ns=UA.default=mDe;const Or=e=>{const t=$s(e);if(!t)throw new Error(`Missing required path param: ${e}`);return t},vDe=()=>{const e=Or("name"),{strategies:t}=rh(),{applications:n}=eJ(),r=Ot(),o=t.find(a=>a.name===e),i=()=>{r(`/strategies/${e}/edit`)};return o?s.jsx(cr,{header:s.jsx(Pn,{title:o==null?void 0:o.name,subtitle:o==null?void 0:o.description,actions:s.jsx(X,{condition:o.editable,show:s.jsx(Wo,{permission:n0,"data-loading":!0,onClick:i,tooltipProps:{title:"Edit strategy"},children:s.jsx(ns,{})})})}),children:s.jsx(jo,{container:!0,children:s.jsx(jo,{item:!0,xs:12,sm:12,children:s.jsx(uDe,{strategy:o,applications:n})})})}):null};var GA={},yDe=Te;Object.defineProperty(GA,"__esModule",{value:!0});var iJ=GA.default=void 0,xDe=yDe(ke()),bDe=s,wDe=(0,xDe.default)((0,bDe.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");iJ=GA.default=wDe;const SDe=x(J)(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",padding:e.spacing(0,1.5)})),CDe=x(jr)(({theme:e})=>({borderColor:e.palette.divider,height:e.spacing(3),margin:e.spacing(0,2)})),jDe=()=>s.jsx(CDe,{orientation:"vertical",variant:"middle"}),sJ=({children:e})=>s.jsx(SDe,{children:e});sJ.Divider=jDe;const Tu=sJ;var qA={},EDe=Te;Object.defineProperty(qA,"__esModule",{value:!0});var aJ=qA.default=void 0,TDe=EDe(ke()),kDe=s,_De=(0,TDe.default)((0,kDe.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");aJ=qA.default=_De;var YA={},RDe=Te;Object.defineProperty(YA,"__esModule",{value:!0});var lJ=YA.default=void 0,PDe=RDe(ke()),ADe=s,IDe=(0,PDe.default)((0,ADe.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 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"}),"Language");lJ=YA.default=IDe;var KA={},$De=Te;Object.defineProperty(KA,"__esModule",{value:!0});var cJ=KA.default=void 0,ODe=$De(ke()),MDe=s,DDe=(0,ODe.default)((0,MDe.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");cJ=KA.default=DDe;const LDe=e=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),Il=e=>BDe[e]??e,FDe=e=>s.jsx(G1,{...e,component:t=>s.jsx(LDe,{...t}),inheritViewBox:!0}),NDe=e=>{switch(e){case"default":return bC;case"remoteAddress":return lJ;case"flexibleRollout":return FDe;case"applicationHostname":return aJ;case"releasePlanTemplate":return Y0;default:return cJ}},uJ=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress"],BDe={applicationHostname:"Hosts",default:"Standard",flexibleRollout:"Gradual rollout",gradualRolloutRandom:"Randomized",gradualRolloutSessionId:"Sessions",gradualRolloutUserId:"Users",remoteAddress:"IPs"},ov="api/admin/strategies",XA=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),o=m.useCallback(async u=>{const d=t(ov,{method:"POST",body:JSON.stringify(u)});return e(d.caller,d.id)},[t,e]),i=m.useCallback(async u=>{const d=`${ov}/${u.name}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},[t,e]),a=m.useCallback(async u=>{const d=`${ov}/${u.name}`,p=t(d,{method:"DELETE"});return e(p.caller,p.id)},[t,e]),l=m.useCallback(async u=>{const d=`${ov}/${u.name}/deprecate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]),c=m.useCallback(async u=>{const d=`${ov}/${u.name}/reactivate`,p=t(d,{method:"POST"});return e(p.caller,p.id)},[t,e]);return{createStrategy:o,updateStrategy:i,removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c,errors:n,loading:r}},yi={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),i=new Date(((l=t==null?void 0:t.values)==null?void 0:l[n])||0);return(i==null?void 0:i.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],i=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===i?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(),i=`${((l=t==null?void 0:t.values)==null?void 0:l[n])||""}`.toLowerCase();return o==null?void 0:o.localeCompare(i)},playgroundResultState:(e,t,n,r)=>{var a,l;const o=(a=e==null?void 0:e.values)==null?void 0:a[n],i=(l=t==null?void 0:t.values)==null?void 0:l[n];return o===i?0:o==="true"?1:i==="true"||o==="false"?-1:i==="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,i=Number.parseInt(`${((l=t==null?void 0:t.values)==null?void 0:l[n])||0}`,10)||Number.MAX_SAFE_INTEGER;return o-i}},zDe=Je.forwardRef((e,t)=>{const n=Pg(e.permission,e.projectId,e.environmentId);return s.jsx(dJ,{...e,access:n,ref:t})}),HDe=Je.forwardRef((e,t)=>{const n=Nf(e.permission,e.projectId,e.environmentId);return s.jsx(dJ,{...e,access:n,ref:t})}),dJ=Je.forwardRef((e,t)=>{const{access:n,permission:r,tooltip:o,disabled:i,projectId:a,environmentId:l,checked:c,onChange:u,...d}=e;return s.jsx(Qa,{title:oC(n,o),arrow:!0,variant:"custom",children:s.jsx("span",{"data-loading":!0,children:s.jsx(fa,{"data-testid":"toggle-switch",onChange:u,disabled:i||!n,checked:c,ref:t,...d})})})}),WDe=Je.forwardRef((e,t)=>typeof e.projectId<"u"&&typeof e.environmentId<"u"?s.jsx(zDe,{...e,projectId:e.projectId,environmentId:e.environmentId,ref:t}):s.jsx(HDe,{...e,ref:t})),VDe=({deprecated:e,disabled:t,onToggle:n})=>{const r=()=>{n(e)},o=Eu(),i=Nf(n0),a=m.useMemo(()=>i?t?"You cannot disable default strategy":e?"Excluded from strategy list":"Included in strategy list":"",[e,t,i]);return s.jsx(kt,{title:a,describeChild:!0,arrow:!0,children:s.jsx("div",{id:o,children:s.jsx(WDe,{checked:!e,permission:n0,onClick:r,disabled:t,inputProps:{"aria-labelledby":o}})})})},UDe=({strategy:e,onClick:t})=>{const n=Eu();return s.jsx(X,{condition:e==null?void 0:e.editable,show:s.jsx(Wo,{onClick:t,permission:n0,tooltipProps:{title:"Edit strategy"},children:s.jsx(ns,{})}),elseShow:s.jsx(kt,{title:"You cannot edit a built-in strategy",arrow:!0,children:s.jsx("div",{id:n,children:s.jsx($t,{disabled:!0,size:"large",children:s.jsx(ns,{"aria-labelledby":n})})})})})};var JA={},GDe=Te;Object.defineProperty(JA,"__esModule",{value:!0});var Po=JA.default=void 0,qDe=GDe(ke()),YDe=s,KDe=(0,qDe.default)((0,YDe.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");Po=JA.default=KDe;const XDe=({strategy:e,onClick:t})=>{const n=Eu();return s.jsx(X,{condition:e==null?void 0:e.editable,show:s.jsx(Wo,{onClick:t,permission:N9e,tooltipProps:{title:"Delete strategy"},children:s.jsx(Po,{})}),elseShow:s.jsx(kt,{title:"You cannot delete a built-in strategy",arrow:!0,children:s.jsx("div",{id:n,children:s.jsx($t,{disabled:!0,size:"large",children:s.jsx(Po,{"aria-labelledby":n})})})})})};var QA={},JDe=Te;Object.defineProperty(QA,"__esModule",{value:!0});var V2=QA.default=void 0,QDe=JDe(ke()),ZDe=s,eLe=(0,QDe.default)((0,ZDe.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");V2=QA.default=eLe;const wD=x("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)}})),bo=({tooltip:e,htmlTooltip:t,tooltipId:n,placement:r,children:o,size:i,...a})=>{if(t){const{htmlTooltipMaxWidth:l}=a;return s.jsx(hr,{id:n,title:e,placement:r,arrow:!0,maxWidth:l,children:s.jsx(wD,{size:i,tabIndex:0,"aria-label":"Help",children:o??s.jsx(V2,{})})})}return s.jsx(kt,{title:e,placement:r,arrow:!0,id:n,children:s.jsx(wD,{size:i,tabIndex:0,"aria-label":"Help",children:o??s.jsx(V2,{})})})},SD=({children:e})=>s.jsx(Z,{component:"span",variant:"body2",sx:t=>({marginBottom:t.spacing(2)}),children:e}),pJ=({alert:e})=>{const t=s.jsxs(s.Fragment,{children:[s.jsxs(SD,{children:["If you decide to create a custom strategy be aware of the following:",s.jsxs("ul",{children:[s.jsx("li",{children:"They require writing custom code and deployments for each SDK you’re using."}),s.jsx("li",{children:"Differing implementation in each SDK will cause toggles to evaluate differently"}),s.jsx("li",{children:"Custom strategies require a lot of configuration in both Unleash admin UI and the SDK."})]})]}),s.jsx(SD,{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?s.jsx(Lt,{severity:"info",sx:n=>({marginBottom:n.spacing(3)}),children:t}):s.jsx(J,{sx:n=>({maxWidth:"720px",padding:n.spacing(4,2),margin:"0 auto"}),children:t})},tLe=()=>{const e=Xn("(max-width:700px)"),t=Ot();return s.jsx(X,{condition:e,show:s.jsx(Wo,{"data-testid":T7,onClick:()=>t("/strategies/create"),permission:B2,size:"large",tooltipProps:{title:"New custom strategy"},children:s.jsx(Oo,{})}),elseShow:s.jsx(Ro,{onClick:()=>t("/strategies/create"),color:"primary",permission:B2,"data-testid":T7,children:"New custom strategy"})})},nLe=x(sn)(({theme:e})=>({marginLeft:e.spacing(1),display:"inline-block"})),rLe=x(J)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.mainHeader,width:"100%"})),CD=x(J)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(2),"& > span":{fontWeight:e.fontWeight.bold}})),jD=({title:e,description:t,link:n})=>s.jsxs(rLe,{children:[e,s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body2",component:"p",sx:{mb:1},children:t}),s.jsx(kn,{href:n,target:"_blank",rel:"noopener noreferrer",variant:"body2",children:"Read more in the documentation"})]})})]}),oLe=()=>s.jsxs(Lt,{severity:"warning",sx:{mb:2},children:["Custom strategies are deprecated and may be removed in a future major version. We recommend not using custom strategies going forward and instead using the gradual rollout strategy with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"constraints"}),". If you have a need for custom strategies that you cannot support with constraints, please reach out to us."]}),iLe=()=>s.jsxs(Lt,{severity:"info",sx:{mb:2},children:["We recommend using gradual rollout. You can customize it with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"constraints"})," ","and"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#variants",target:"_blank",rel:"noopener noreferrer",children:"variants"}),"."]}),sLe=()=>{const e=Ot(),[t,n]=m.useState({show:!1,title:"",onConfirm:()=>{}}),{strategies:r,refetchStrategies:o,loading:i}=rh(),{removeStrategy:a,deprecateStrategy:l,reactivateStrategy:c}=XA(),{setToastData:u,setToastApiError:d}=Nt();Iu("Strategy types");const p=m.useMemo(()=>{if(i){const L=Array(5).fill({name:"Context name",description:"Context description when loading"});return{all:L,standard:L,advanced:L,custom:L}}const z=r.map(({name:L,description:I,editable:q,deprecated:ee,advanced:W})=>({name:L,description:I,editable:q,deprecated:ee,advanced:W})),B=z.filter(L=>!L.editable);return{all:z,standard:B.filter(L=>!L.advanced),advanced:B.filter(L=>L.advanced),custom:z.filter(L=>L.editable)}},[r,i]),f=m.useCallback(z=>B=>{n(B?{show:!0,title:"Really reactivate strategy?",onConfirm:async()=>{try{await c(z),o(),u({type:"success",text:"Strategy reactivated"})}catch(L){d(Tt(L))}}}:{show:!0,title:"Really deprecate strategy?",onConfirm:async()=>{try{await l(z),o(),u({type:"success",text:"Strategy deprecated"})}catch(L){d(Tt(L))}}})},[l,c,o,d,u]),h=m.useCallback(z=>{n({show:!0,title:"Really delete strategy?",onConfirm:async()=>{try{await a(z),o(),u({type:"success",text:"Strategy deleted"})}catch(B){d(Tt(B))}}})},[a,o,d,u]),g=m.useCallback(z=>{e(`/strategies/${z.name}/edit`)},[e]),v=m.useMemo(()=>[{id:"Icon",Cell:()=>s.jsx(J,{"data-loading":!0,sx:{pl:3,pr:1,display:"flex",alignItems:"center"},children:s.jsx(iJ,{color:"disabled"})})},{id:"Name",Header:"Name",accessor:z=>Il(z.name),width:"90%",Cell:({row:{original:{name:z,description:B,deprecated:L}}})=>s.jsx(Rl,{"data-loading":!0,title:Il(z),subtitle:B,to:`/strategies/${z}`,children:s.jsx(X,{condition:L,show:()=>s.jsx(nLe,{color:"disabled",children:"Disabled"})})}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:z}})=>s.jsxs(Tu,{children:[s.jsx(VDe,{deprecated:z.deprecated,onToggle:f(z)}),s.jsx(X,{condition:z.editable,show:s.jsxs(s.Fragment,{children:[s.jsx(Tu.Divider,{}),s.jsx(UDe,{strategy:z,onClick:()=>g(z)}),s.jsx(XDe,{strategy:z,onClick:()=>h(z)})]})})]}),width:150,minWidth:120,disableSortBy:!0},{accessor:"description",disableSortBy:!0},{accessor:"sortOrder",sortType:"number"}],[f,g,h]),b=m.useMemo(()=>({sortBy:[{id:"Name",desc:!1}],hiddenColumns:["description","sortOrder"]}),[]),{getTableProps:y,getTableBodyProps:w,headerGroups:S,rows:j,prepareRow:E}=Zt.useTable({columns:v,data:p.standard,initialState:b,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},Zt.useSortBy),{getTableProps:C,getTableBodyProps:T,headerGroups:k,rows:_,prepareRow:A}=Zt.useTable({columns:v,data:p.advanced,initialState:b,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},Zt.useSortBy),{getTableProps:O,getTableBodyProps:M,headerGroups:H,rows:P,prepareRow:$}=Zt.useTable({columns:v,data:p.custom,initialState:b,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,autoResetHiddenColumns:!1},Zt.useSortBy),D=()=>{t==null||t.onConfirm(),n(z=>({...z,show:!1}))};return s.jsxs(s.Fragment,{children:[s.jsxs(cr,{isLoading:i,header:s.jsx(Pn,{children:s.jsx(jD,{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/reference/activation-strategies"})}),children:[s.jsxs(J,{children:[s.jsx(iLe,{}),s.jsxs(ta,{...y(),children:[s.jsx(ea,{headerGroups:S}),s.jsx(Ts,{...w(),children:j.map(z=>{E(z);const{key:B,...L}=z.getRowProps();return s.jsx(Mi,{hover:!0,...L,children:z.cells.map(I=>{const{key:q,...ee}=I.getCellProps();return s.jsx(es,{...ee,children:I.render("Cell")},q)})},B)})})]}),s.jsx(X,{condition:j.length===0,show:s.jsx($r,{children:"No strategies available."})})]}),s.jsx(Gn,{open:t.show,onClick:D,title:t==null?void 0:t.title,onClose:()=>n(z=>({...z,show:!1}))})]}),s.jsxs(cr,{isLoading:i,header:s.jsx(Pn,{children:s.jsx(jD,{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/reference/custom-activation-strategies"})}),sx:{mt:2},children:[s.jsxs(J,{children:[s.jsx(CD,{children:s.jsx("span",{children:"Advanced strategies"})}),s.jsxs(ta,{...C(),children:[s.jsx(ea,{headerGroups:k}),s.jsx(Ts,{...T(),children:_.map(z=>{A(z);const{key:B,...L}=z.getRowProps();return s.jsx(Mi,{hover:!0,...L,children:z.cells.map(I=>{const{key:q,...ee}=I.getCellProps();return s.jsx(es,{...ee,children:I.render("Cell")},q)})},B)})})]}),s.jsx(X,{condition:_.length===0,show:s.jsx($r,{children:"No advanced strategies available."})})]}),s.jsxs(J,{children:[s.jsxs(CD,{sx:{mt:4},children:[s.jsx("span",{children:"Custom strategies"}),s.jsx(tLe,{})]}),s.jsx(oLe,{}),s.jsxs(ta,{...O(),children:[s.jsx(ea,{headerGroups:H}),s.jsx(Ts,{...M(),children:P.map(z=>{$(z);const{key:B,...L}=z.getRowProps();return s.jsx(Mi,{hover:!0,...L,children:z.cells.map(I=>{const{key:q,...ee}=I.getCellProps();return s.jsx(es,{...ee,children:I.render("Cell")},q)})},B)})})]}),s.jsx(X,{condition:P.length===0,show:s.jsx(pJ,{})})]}),s.jsx(Gn,{open:t.show,onClick:D,title:t==null?void 0:t.title,onClose:()=>n(z=>({...z,show:!1}))})]})]})};var ZA={},aLe=Te;Object.defineProperty(ZA,"__esModule",{value:!0});var fJ=ZA.default=void 0,lLe=aLe(ke()),cLe=s,uLe=(0,lLe.default)((0,cLe.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");fJ=ZA.default=uLe;const SC=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},dLe=(e={})=>{const t=async()=>{const c=bt("api/admin/tag-types");return(await fetch(c,{method:"GET"}).then(Jt("Tag types"))).json()},n="api/admin/tag-types",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=()=>{Io(n)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{tagTypes:(r==null?void 0:r.tagTypes)||[],error:o,loading:i,refetch:l}},pLe=()=>{const e=Ot(),t=Xn("(max-width:700px)");return s.jsx(X,{condition:t,show:s.jsx(Wo,{onClick:()=>e("/tag-types/create"),size:"large",permission:dT,children:s.jsx(Oo,{})}),elseShow:s.jsx(Ro,{permission:dT,onClick:()=>e("/tag-types/create"),children:"New tag type"})})},fLe=x("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}`})),hLe=()=>{const[e,t]=m.useState({open:!1}),n=Ot(),{deleteTagType:r}=SC(),{tagTypes:o,refetch:i,loading:a}=dLe(),{setToastData:l,setToastApiError:c}=Nt(),u=m.useMemo(()=>a?Array(5).fill({name:"Tag type name",description:"Tag type description when loading"}):o.map(({name:j,description:E,color:C})=>({name:j,description:E,color:C})),[o,a]),d=m.useMemo(()=>[{id:"Icon",Cell:()=>s.jsx(J,{"data-loading":!0,sx:{pl:2,pr:1,display:"flex",alignItems:"center"},children:s.jsx(fJ,{color:"disabled"})}),disableGlobalFilter:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:j,description:E,color:C}}})=>s.jsxs(J,{sx:{display:"flex",alignItems:"center"},children:[s.jsx(X,{condition:!!C,show:s.jsx(fLe,{$color:C})}),s.jsx(Rl,{"data-loading":!0,title:j,subtitle:E})]}),sortType:"alphanumeric"},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:j}})=>s.jsxs(J,{sx:{display:"flex",justifyContent:"flex-end"},"data-loading":!0,children:[s.jsx(Wo,{onClick:()=>n(`/tag-types/edit/${j.name}`),permission:dX,tooltipProps:{title:"Edit tag type"},children:s.jsx(ns,{})}),s.jsx(Wo,{permission:W9e,tooltipProps:{title:"Delete tag type"},onClick:()=>t({open:!0,name:j.name}),children:s.jsx(Po,{})})]}),width:150,disableGlobalFilter:!0,disableSortBy:!0},{accessor:"description",disableSortBy:!0}],[n]),p=m.useMemo(()=>({sortBy:[{id:"name",desc:!1}],hiddenColumns:["description"]}),[]),{getTableProps:f,getTableBodyProps:h,headerGroups:g,rows:v,prepareRow:b,state:{globalFilter:y},setGlobalFilter:w}=Zt.useTable({columns:d,data:u,initialState:p,sortTypes:yi,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},Zt.useGlobalFilter,Zt.useSortBy),S=async()=>{try{e.name&&(await r(e.name),i(),t({open:!1}),l({type:"success",show:!0,text:"Tag type deleted"}))}catch(j){c(Tt(j))}};return s.jsxs(cr,{isLoading:a,header:s.jsx(Pn,{title:`Tag types (${v.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:y,onChange:w}),s.jsx(Pn.Divider,{}),s.jsx(pLe,{})]})}),children:[s.jsx(is,{value:y,children:s.jsxs(ta,{...f(),children:[s.jsx(ea,{headerGroups:g}),s.jsx(Ts,{...h(),children:v.map(j=>{b(j);const{key:E,...C}=j.getRowProps();return s.jsx(Mi,{hover:!0,...C,children:j.cells.map(T=>{const{key:k,..._}=T.getCellProps();return s.jsx(es,{..._,children:T.render("Cell")},k)})},E)})})]})}),s.jsx(X,{condition:v.length===0,show:s.jsx(X,{condition:(y==null?void 0:y.length)>0,show:s.jsxs($r,{children:["No tags found matching “",y,"”"]}),elseShow:s.jsx($r,{children:"No tags available. Get started by adding one."})})}),s.jsx(Gn,{title:"Really delete Tag type?",open:e.open,onClick:S,onClose:()=>{t({open:!1})}})]})},ry=(e={})=>{const t=async()=>{const c=bt("api/admin/addons");return(await fetch(c,{method:"GET"}).then(Jt("Addons"))).json()},n="api/admin/addons",{data:r,error:o}=_n(n,t,e),[i,a]=m.useState(!o&&!r),l=m.useCallback(()=>{Io(n)},[n]);return m.useEffect(()=>{a(!o&&!r)},[r,o]),{addons:(r==null?void 0:r.addons)||[],providers:(r==null?void 0:r.providers)||[],error:o,loading:i,refetchAddons:l}};var e9={},gLe=Te;Object.defineProperty(e9,"__esModule",{value:!0});var hJ=e9.default=void 0,mLe=gLe(ke()),vLe=s,yLe=(0,mLe.default)((0,vLe.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");hJ=e9.default=yLe;const U2=e=>e.charAt(0).toUpperCase()+e.slice(1),xLe="/static/datadog-D7T0xtkO.svg",bLe="/static/new-relic-BupjBFL1.svg",wLe="/static/jira-l0bo9uCD.svg",SLe="/static/jira-comment-Di5ugPYV.svg",CLe="/static/signals-CAlQRJwW.svg",jLe="/static/terraform-Eb_8o2u1.svg",ED="/static/slack-t0fNwPed.svg",ELe="/static/teams-DvQx_FzB.svg",TLe="/static/webhooks-Cnts0gfu.svg",kLe="/static/unleash-integration-Ctxqm5Ve.svg",_Le="/static/Logo-android-C52ktdfV.svg",RLe="/static/Logo-net-BsbSafnp.svg",PLe="/static/Logo-flutter-B4Npq361.svg",ALe="/static/Logo-go-DsgFcp5h.svg",ILe="/static/Logo-swift-B2XvejNd.svg",$Le="/static/Logo-java-DnZJK2S1.svg",OLe="/static/Logo-javascript-Uv1If6qs.svg",MLe="/static/Logo-node-CHfuizy_.svg",DLe="/static/Logo-php-Bn8RVcvR.svg",LLe="/static/Logo-python-D_jhkoJJ.svg",FLe="/static/Logo-react-D2SuVol5.svg",NLe="/static/Logo-ruby-BlkEeyzc.svg",BLe="/static/Logo-rust-DZ1V0dgh.svg",zLe="/static/Logo-svelte-B-fbfLhe.svg",HLe="/static/Logo-vue-Bc1zMJ6g.svg",Y3=x(IS)(({theme:e})=>({background:"transparent",marginRight:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(4),height:e.spacing(4),fontSize:"28px"})),WLe={datadog:{title:"Datadog",icon:xLe},"new-relic":{title:"New Relic",icon:bLe},jira:{title:"Jira",icon:wLe},"jira-comment":{title:"Jira",icon:SLe},signals:{title:"Signals",icon:CLe},terraform:{title:"Terraform",icon:jLe},slack:{title:"Slack",icon:ED},"slack-app":{title:"Slack",icon:ED},teams:{title:"Teams",icon:ELe},webhook:{title:"Webhook",icon:TLe},unleash:{title:"Unleash",icon:kLe},android:{title:"Android",icon:_Le},dotnet:{title:"Dotnet",icon:RLe},flutter:{title:"Flutter",icon:PLe},go:{title:"Go",icon:ALe},swift:{title:"Swift",icon:ILe},java:{title:"Java",icon:$Le},javascript:{title:"Javascript",icon:OLe},node:{title:"Node",icon:MLe},php:{title:"PHP",icon:DLe},python:{title:"Python",icon:LLe},react:{title:"React",icon:FLe},ruby:{title:"Ruby",icon:NLe},rust:{title:"Rust",icon:BLe},svelte:{title:"Svelte",icon:zLe},vue:{title:"Vue",icon:HLe}},gJ=({name:e})=>{const t=WLe[e];return t?typeof t.icon=="string"?s.jsx(Y3,{src:ti(t.icon),alt:`${U2(t.title)} icon`,variant:"rounded"}):s.jsx(Y3,{alt:`${U2(t.title)} icon`,variant:"rounded",children:t.icon}):s.jsx(Y3,{variant:"rounded",children:s.jsx(hJ,{})})};var t9={},VLe=Te;Object.defineProperty(t9,"__esModule",{value:!0});var n9=t9.default=void 0,ULe=VLe(ke()),GLe=s,qLe=(0,ULe.default)((0,GLe.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");n9=t9.default=qLe;var r9={},YLe=Te;Object.defineProperty(r9,"__esModule",{value:!0});var pm=r9.default=void 0,KLe=YLe(ke()),XLe=s,JLe=(0,KLe.default)((0,XLe.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");pm=r9.default=JLe;const o9=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),o="api/admin/addons",i=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=m.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:i,updateAddon:l,removeAddon:a,errors:n,loading:r}};var i9={},QLe=Te;Object.defineProperty(i9,"__esModule",{value:!0});var oy=i9.default=void 0,ZLe=QLe(ke()),eFe=s,tFe=(0,ZLe.default)((0,eFe.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");oy=i9.default=tFe;const Cd=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:i})=>{const{hasAccess:a}=m.useContext($o);let l;return t&&r?l=a(e,t,r):t?l=a(e,t):l=a(e),s.jsx(Qa,{...i,title:oC(l,o),children:n({hasAccess:l})})},TD=250,mJ=x("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})),nFe=x(mJ)({width:1300}),rFe=x($t)(({theme:e})=>({zIndex:1,position:"absolute",top:e.spacing(3),right:e.spacing(3)})),s9=({open:e,onClose:t,onClick:n,label:r,children:o})=>s.jsx(W0,{open:e,onClose:t,onClick:n,closeAfterTransition:!0,"aria-label":r,BackdropComponent:dR,BackdropProps:{timeout:TD},"data-testid":Rje,sx:{minHeight:"100vh"},children:s.jsx(z0,{timeout:TD,in:e,children:o})}),Za=e=>s.jsx(s9,{...e,children:s.jsx(nFe,{children:e.children})}),wLt=e=>s.jsx(s9,{...e,children:s.jsxs(mJ,{children:[s.jsx(kt,{title:"Close",arrow:!0,describeChild:!0,children:s.jsx(rFe,{onClick:e.onClose,children:s.jsx(Ho,{})})}),e.children]})}),oFe=()=>{},iFe=oFe(),yT=Object,kD=e=>e===iFe,sFe=e=>typeof e=="function",Rx=new WeakMap,K3=(e,t)=>yT.prototype.toString.call(e)===`[object ${t}]`;let aFe=0;const xT=e=>{const t=typeof e,n=K3(e,"Date"),r=K3(e,"RegExp"),o=K3(e,"Object");let i,a;if(yT(e)===e&&!n&&!r){if(i=Rx.get(e),i)return i;if(i=++aFe+"~",Rx.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=xT(e[a])+",";Rx.set(e,i)}if(o){i="#";const l=yT.keys(e).sort();for(;!kD(a=l.pop());)kD(e[a])||(i+=a+":"+xT(e[a])+",");Rx.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},lFe=e=>{if(sFe(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?xT(e):"",[e,t]},cFe=e=>lFe(e?e(0,null):null)[0],X3=Promise.resolve(),uFe=e=>(t,n,r)=>{const o=m.useRef(!1),{cache:i,initialSize:a=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:p=!1}=r,[,,,f]=uc.get(zS);let h;try{h=cFe(t),h&&(h=Gq+h)}catch{}const[g,v,b]=id(i,h),y=m.useCallback(()=>Tn(g()._l)?a:g()._l,[i,h,a]);Lq.useSyncExternalStore(m.useCallback(k=>h?b(h,()=>{k()}):()=>{},[i,h]),y,y);const w=m.useCallback(()=>{const k=g()._l;return Tn(k)?a:k},[h,a]),S=m.useRef(w());t1(()=>{if(!o.current){o.current=!0;return}h&&v({_l:c?S.current:w()})},[h,i]);const j=d&&!o.current,E=e(h,async k=>{const _=g()._i,A=g()._r;v({_r:Xo});const O=[],M=w(),[H]=id(i,k),P=H().data,$=[];let D=null;for(let z=0;z<M;++z){const[B,L]=Z1(t(z,p?null:D));if(!B)break;const[I,q]=id(i,B);let ee=I().data;const W=l||_||Tn(ee)||u&&!z&&!Tn(P)||j||P&&!Tn(P[z])&&!r.compare(P[z],ee);if(n&&(typeof A=="function"?A(ee,L):W)){const oe=async()=>{if(!(B in f))ee=await n(L);else{const ce=f[B];delete f[B],ee=await ce}q({data:ee,_k:L}),O[z]=ee};p?$.push(oe):await oe()}else O[z]=ee;p||(D=ee)}return p&&await Promise.all($.map(z=>z())),v({_i:Xo}),O},r),C=m.useCallback(function(k,_){const A=typeof _=="boolean"?{revalidate:_}:_||{},O=A.revalidate!==!1;return h?(O&&(Tn(k)?v({_i:!0,_r:A.revalidate}):v({_i:!1,_r:A.revalidate})),arguments.length?E.mutate(k,{...A,revalidate:O}):E.mutate()):X3},[h,i]),T=m.useCallback(k=>{if(!h)return X3;const[,_]=id(i,h);let A;if(Ia(k)?A=k(w()):typeof k=="number"&&(A=k),typeof A!="number")return X3;_({_l:A}),S.current=A;const O=[],[M]=id(i,h);let H=null;for(let P=0;P<A;++P){const[$]=Z1(t(P,H)),[D]=id(i,$),z=$?D().data:Xo;if(Tn(z))return C(M().data);O.push(z),H=z}return C(O)},[h,i,C,w]);return{size:w(),setSize:T,mutate:C,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}},vJ=ECe(_n,uFe),dFe=async e=>{const t=await fetch(e);return await Jt("Integration events")(t),t.json()},yJ=(e,t=50,n={})=>{var b;const{isAdmin:r}=m.useContext($o),o=(y,w)=>!e||!r||w&&!w.integrationEvents.length?null:bt(`api/admin/addons/${e}/events?limit=${t}&offset=${y*t}`),{data:i,error:a,size:l,setSize:c,mutate:u}=vJ(o,dFe,{...n,revalidateAll:!0}),d=i?i.flatMap(({integrationEvents:y})=>y):[],p=!i&&!a,f=l>0&&!(i!=null&&i[l-1]),h=p||f,g=((b=i==null?void 0:i[l-1])==null?void 0:b.integrationEvents.length)===t;return{integrationEvents:d,hasMore:g,loadMore:()=>{h||!g||c(l+1)},loading:h,refetch:()=>u(),error:a}},pFe=x("div")(({theme:e})=>({backgroundColor:e.palette.codebox,padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium,position:"relative",maxHeight:"500px",overflow:"auto"})),fFe=x("pre")(({theme:e})=>({margin:0,wordBreak:"break-all",whiteSpace:"pre-wrap",color:e.palette.common.white,fontSize:e.fontSizes.smallBody})),hFe=({text:e})=>s.jsx(pFe,{children:s.jsx(fFe,{children:e})});var a9={},gFe=Te;Object.defineProperty(a9,"__esModule",{value:!0});var oh=a9.default=void 0,mFe=gFe(ke()),vFe=s,yFe=(0,mFe.default)((0,vFe.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");oh=a9.default=yFe;var l9={},xFe=Te;Object.defineProperty(l9,"__esModule",{value:!0});var xJ=l9.default=void 0,bFe=xFe(ke()),wFe=s,SFe=(0,bFe.default)((0,wFe.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");xJ=l9.default=SFe;const CFe="/static/unleashLogoIconDarkAlpha-BbvuC13D.gif",jFe=x("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})),EFe=x("img")(({theme:e})=>({width:"100px",height:"100px"})),o0=({type:e="inline"})=>s.jsx(jFe,{role:"alert","aria-label":"Loading",type:e,children:s.jsx(EFe,{src:ti(CFe),alt:""})});var TFe=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()}},kFe=TFe,_D={"text/plain":"Text","text/html":"Url",default:"Text"},_Fe="Copy to clipboard: #{key}, Enter";function RFe(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function PFe(e,t){var n,r,o,i,a,l,c=!1;t||(t={}),n=t.debug||!1;try{o=kFe(),i=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=_D[t.format]||_D.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),i.selectNodeContents(l),a.addRange(i);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=RFe("message"in t?t.message:_Fe),window.prompt(r,e)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return c}var AFe=PFe;const CC=Vo(AFe),IFe=e=>m.createElement("svg",{width:48,height:50,viewBox:"0 0 48 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),bJ=36,$Fe=100-bJ,wJ=`${bJ}%`,OFe="420px",MFe=`${$Fe}%`,DFe=x("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}})),LFe=x("div",{shouldForwardProp:e=>!["guidanceHeight"].includes(e.toString())})(({theme:e,guidanceHeight:t})=>({...OSe,...t?{aside:{height:t}}:{}})),FFe=x("div",{shouldForwardProp:e=>e!=="useFixedSidebar"})(({theme:e,useFixedSidebar:t})=>({display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,width:t?"initial":MFe,[e.breakpoints.down(1100)]:{width:"100%"}})),NFe=x("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),i=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:i,paddingBlock:a,"--form-content-padding":i}}}),BFe=x("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)}})),zFe=x("h1")(({theme:e})=>({marginBottom:e.fontSizes.mainHeader,fontWeight:"normal"})),HFe=x(jr)(({theme:e})=>({opacity:.3,marginBottom:e.spacing(.5)})),WFe=x("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})),VFe=x(oh)(({theme:e})=>({fill:e.palette.primary.contrastText})),UFe=x("div")(()=>({zIndex:1,position:"absolute",right:-3,top:-3})),GFe=x(IFe)(()=>({width:"75px",height:"75px"})),qFe=x($t)(()=>({position:"absolute",zIndex:400,right:0})),YFe=x(xJ)(({theme:e})=>({fill:e.palette.primary.contrastText})),SJ=x("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||wJ,[e.breakpoints.down(1100)]:{width:"100%"},[e.breakpoints.down(500)]:{padding:e.spacing(4,2)},...n?{pre:{height:n}}:{}})),KFe=x("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)})),XFe=x("div")(()=>({width:"100%"})),JFe=x("div")(({theme:e})=>({margin:e.spacing(3,0),display:"flex",alignItems:"center",width:"100%"})),QFe=x(VS)(({theme:e})=>({marginRight:e.spacing(1),color:e.palette.primary.contrastText})),ZFe=x("a")(({theme:e})=>({color:e.palette.primary.contrastText,display:"block","&:hover":{textDecoration:"none"}})),Fr=({title:e,description:t,children:n,documentationLink:r,documentationIcon:o,documentationLinkLabel:i,loading:a,modal:l,formatApiCode:c,disablePadding:u,compactPadding:d=!1,showDescription:p=!0,showLink:f=!0,footer:h,compact:g,showGuidance:v=!0,useFixedSidebar:b})=>{const{setToastData:y}=Nt(),w=Xn("(max-width:1099px)"),S=()=>{c!==void 0&&(CC(c())?y({text:"Command copied",autoHideDuration:6e3,type:"success",show:!0}):y({text:"Could not copy the command",autoHideDuration:6e3,type:"error",show:!0}))},j=(C,T=!1)=>{if(!C)return s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!T,show:s.jsx(HFe,{})}),s.jsxs(WFe,{children:["API Command"," ",s.jsx(kt,{title:"Copy command",arrow:!0,children:s.jsx($t,{onClick:S,size:"large",children:s.jsx(VFe,{})})})]}),s.jsx(hFe,{text:c()})," "]})},E=b?tNe:jJ;return s.jsxs(DFe,{modal:l,compact:g,children:[s.jsx(X,{condition:v&&w,show:s.jsx(LFe,{guidanceHeight:b?"240px":void 0,children:s.jsx(eNe,{description:t,documentationIcon:o,documentationLink:r,documentationLinkLabel:i})})}),s.jsxs(FFe,{useFixedSidebar:b,children:[s.jsx(NFe,{disablePadding:u,compactPadding:d,children:s.jsx(X,{condition:a||!1,show:s.jsx(o0,{}),elseShow:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e!==void 0,show:s.jsx(zFe,{children:e})}),n]})})}),s.jsx(X,{condition:h!==void 0,show:()=>s.jsxs(s.Fragment,{children:[s.jsx(jr,{}),s.jsx(BFe,{children:h})]})})]}),s.jsx(X,{condition:v&&!w,show:s.jsx(E,{documentationIcon:o,description:t,documentationLink:r,documentationLinkLabel:i,showDescription:p,showLink:f,children:j(c===void 0,!(p||f))})})]})},eNe=({description:e,documentationLink:t,documentationLinkLabel:n,documentationIcon:r})=>{const[o,i]=m.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(UFe,{children:s.jsx(GFe,{})}),s.jsx(kt,{title:"Toggle help",arrow:!0,children:s.jsx(qFe,{onClick:()=>i(a=>!a),size:"large",children:s.jsx(YFe,{})})}),s.jsx(tR,{in:o,timeout:500,children:s.jsx(jJ,{documentationIcon:r,description:e,documentationLink:t,documentationLinkLabel:n})})]})},CJ=({description:e,children:t,documentationLink:n,documentationIcon:r,documentationLinkLabel:o="Learn more",showDescription:i=!0,showLink:a=!0,fixedDocumentationHeight:l})=>{const c=x("div")({height:"2rem",display:"grid",placeItems:"center"}),u=x("div")({height:l,overflowY:"auto"}),d=l?u:Je.Fragment;return s.jsxs(s.Fragment,{children:[s.jsxs(d,{children:[s.jsx(X,{condition:i,show:s.jsxs(KFe,{children:[s.jsx(X,{condition:!!r,show:s.jsx(c,{children:r})}),s.jsx(XFe,{children:e})]})}),s.jsx(X,{condition:a&&!!n,show:s.jsxs(JFe,{children:[s.jsx(QFe,{}),s.jsx(ZFe,{href:n,rel:"noopener noreferrer",target:"_blank",children:o})]})})]}),t]})},jJ=e=>s.jsx(SJ,{children:s.jsx(CJ,{...e})}),tNe=e=>s.jsx(SJ,{sidebarWidth:OFe,fixedCodeHeight:"300px",children:s.jsx(CJ,{...e,fixedDocumentationHeight:"170px"})}),nNe=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",borderTopLeftRadius:e.shape.borderRadiusMedium,borderTopRightRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.table.headerBackground})),RD=x("div",{shouldForwardProp:e=>e!=="maxWidth"})(({maxWidth:e})=>({display:"flex",flex:1,...e&&{maxWidth:e}})),rNe=({columns:e,sidePanelHeader:t,leftPanelMaxWidth:n})=>s.jsxs(nNe,{children:[s.jsx(RD,{maxWidth:n,children:e.map(({header:r,maxWidth:o,align:i})=>s.jsx(bT,{maxWidth:o,align:i,children:r},r))}),s.jsx(RD,{children:s.jsx(bT,{children:t})})]}),oNe=x("div")(({theme:e})=>({borderBottom:`1px solid ${e.palette.divider}`})),iNe=x(Ue,{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}`}})),sNe=({selected:e,onClick:t,children:n})=>s.jsx(oNe,{children:s.jsx(iNe,{selected:e,onClick:t,children:n})}),aNe=x("div")({display:"flex",flexDirection:"column",width:"100%"}),lNe=x("div")({display:"flex",flexDirection:"row"}),EJ=x("div")({display:"flex",flexDirection:"column",flex:1}),cNe=x(EJ,{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}})),uNe=x(EJ)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderLeft:0,borderBottomRightRadius:e.shape.borderRadiusMedium})),bT=x("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"})),TJ=({items:e,columns:t,sidePanelHeader:n,renderContent:r,renderItem:o=(l,c)=>c,height:i,listEnd:a})=>{const[l,c]=m.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 s.jsxs(aNe,{children:[s.jsx(rNe,{columns:t,sidePanelHeader:n,leftPanelMaxWidth:d}),s.jsxs(lNe,{children:[s.jsxs(cNe,{height:i,maxWidth:d,children:[e.map(p=>o(p,s.jsx(sNe,{selected:u.id===p.id,onClick:()=>c(p),children:t.map(({header:f,maxWidth:h,align:g,cell:v})=>s.jsx(bT,{maxWidth:h,align:g,children:v(p)},f))},p.id))),a]}),s.jsx(uNe,{children:r(u)})]})]})};var c9={},dNe=Te;Object.defineProperty(c9,"__esModule",{value:!0});var u9=c9.default=void 0,pNe=dNe(ke()),fNe=s,hNe=(0,pNe.default)((0,fNe.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");u9=c9.default=hNe;var d9={},gNe=Te;Object.defineProperty(d9,"__esModule",{value:!0});var kJ=d9.default=void 0,mNe=gNe(ke()),vNe=s,yNe=(0,mNe.default)((0,vNe.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");kJ=d9.default=yNe;var p9={},xNe=Te;Object.defineProperty(p9,"__esModule",{value:!0});var jC=p9.default=void 0,bNe=xNe(ke()),PD=s,wNe=(0,bNe.default)([(0,PD.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2z"},"0"),(0,PD.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");jC=p9.default=wNe;const SNe=x(u9)(({theme:e})=>({color:e.palette.success.main})),CNe=x(kJ)(({theme:e})=>({color:e.palette.error.main})),jNe=x(jC)(({theme:e})=>({color:e.palette.warning.main})),_J=({state:e})=>e==="success"?s.jsx(SNe,{}):e==="failed"?s.jsx(CNe,{}):s.jsx(jNe,{}),ENe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),TNe=function(e){return"/"+e},AD={},va=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=TNe(c),c in AD)return;AD[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":ENe,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 i(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"&&i(l.reason);return t().catch(i)})},kNe=x(Dc)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),_Ne=x(Fc)({lineHeight:"1.5rem"}),RNe=({header:e,children:t})=>s.jsxs(kNe,{children:[s.jsx(_Ne,{expandIcon:s.jsx($t,{children:s.jsx(ha,{titleAccess:"Toggle"})}),children:e}),s.jsx(Lc,{children:t})]}),ID=m.lazy(()=>va(()=>import("./ReactJSONEditor-DZ9l5V9S.js"),[])),PNe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),ANe=x(Lt)({fontSize:"inherit",lineBreak:"anywhere"}),INe=x(xt)(({theme:e})=>({marginLeft:e.spacing(1)})),RJ=({state:e,stateDetails:t,event:n,details:r})=>{const o=e==="failed"?"error":e==="success"?"success":"warning",i=e==="success"?s.jsx(u9,{}):void 0;return s.jsxs(PNe,{children:[s.jsx(ANe,{severity:o,icon:i,children:t}),s.jsx(RNe,{header:s.jsxs(s.Fragment,{children:["Event:",s.jsx(INe,{to:"/history",children:n.type})]}),children:s.jsx(m.Suspense,{fallback:null,children:s.jsx(ID,{content:{json:n},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})}),s.jsx(m.Suspense,{fallback:null,children:s.jsx(ID,{content:{json:r},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})]})},$Ne=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),$D=x("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),ONe=x("h1")({fontWeight:"normal"}),MNe=x("h2")(({theme:e})=>({marginTop:e.spacing(1.5),fontSize:e.fontSizes.smallBody,fontWeight:"normal"})),DNe=x("form")({display:"flex",flexDirection:"column",height:"100%"}),LNe=x("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),FNe=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),PJ=({addon:e,open:t,setOpen:n})=>{const r=Ot(),{locationSettings:o}=wo(),{integrationEvents:i,hasMore:a,loadMore:l,loading:c}=yJ(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 s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:u,children:s.jsxs(Fr,{loading:c&&i.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[s.jsxs($Ne,{children:[s.jsxs($D,{children:[s.jsx(ONe,{children:u}),s.jsx(kn,{onClick:()=>{n(!1),r(`/integrations/edit/${e.id}`)},children:"View configuration"})]}),s.jsx($D,{children:s.jsx(MNe,{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."})})]}),s.jsxs(DNe,{children:[s.jsx(TJ,{height:960,items:i,columns:[{header:"Status",align:"center",maxWidth:100,cell:_J},{header:"Date",maxWidth:240,cell:({createdAt:d})=>Ja(d,o==null?void 0:o.locale)}],sidePanelHeader:"Details",renderContent:RJ,renderItem:({id:d,state:p},f)=>p==="failed"?s.jsx(LNe,{children:f},d):f,listEnd:s.jsx(X,{condition:a,show:s.jsx(Ue,{onClick:l,children:"Load more"})})}),s.jsx(X,{condition:i.length===0,show:s.jsx("p",{children:"No events have been registered for this integration configuration."})}),s.jsx(FNe,{children:s.jsx(Ue,{onClick:()=>n(!1),children:"Close"})})]})]})})},NNe=x("div")(({theme:e})=>({marginLeft:e.spacing(1),marginTop:e.spacing(-1),marginBottom:e.spacing(-1),marginRight:e.spacing(-1),display:"flex",alignItems:"center"})),BNe=({addon:e})=>{const[t,n]=m.useState(!1),[r,o]=m.useState(!1),[i,a]=m.useState(!1),[l,c]=m.useState(null),{updateAddon:u,removeAddon:d}=o9(),{refetchAddons:p}=ry(),{setToastData:f,setToastApiError:h}=Nt(),[g,v]=m.useState(!1),b=()=>{n(!1),c(null)},y=C=>{t?b():(c(C.currentTarget),n(!0))},w=Nf(pX),S=Nf(fX),j=m.useCallback(async()=>{try{await u({...e,enabled:!e.enabled}),p(),f({type:"success",text:e.enabled?"Integration disabled":"Integration enabled"})}catch(C){h(Tt(C))}},[h,p,f,u]),E=m.useCallback(async()=>{try{await d(e.id),p(),f({type:"success",text:"Integration deleted"})}catch(C){h(Tt(C))}},[h,p,f,d]);return s.jsxs(NNe,{onClick:C=>C.preventDefault(),children:[s.jsx(kt,{title:"More actions",arrow:!0,children:s.jsx($t,{onClick:y,size:"small","aria-controls":t?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":t?"true":void 0,"data-loading":!0,children:s.jsx(pm,{sx:{width:32,height:32}})})}),s.jsxs(MS,{id:"project-card-menu",open:!!l,anchorEl:l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},onClose:y,children:[s.jsx(Cd,{permission:ts,children:({hasAccess:C})=>s.jsxs(Cr,{onClick:()=>v(!0),disabled:!C,children:[s.jsx(Zo,{children:s.jsx(oy,{})}),s.jsx(dn,{children:"View events"})]})}),s.jsxs(Cr,{onClick:()=>{a(!0),b()},disabled:!w,children:[s.jsx(Zo,{children:s.jsx(bC,{})}),s.jsx(dn,{children:e.enabled?"Disable":"Enable"})]})," ",s.jsxs(Cr,{disabled:!S,onClick:()=>{o(!0),b()},children:[s.jsx(Zo,{children:s.jsx(Po,{})}),s.jsx(dn,{children:"Delete"})]})]}),s.jsx(PJ,{addon:e,open:g,setOpen:v}),s.jsx(Gn,{open:i,onClick:j,onClose:()=>a(!1),title:e.enabled?"Disable integration?":"Enable integration?",children:s.jsxs("div",{children:[e.enabled?"Disabling":"Enabling"," this integration will"," ",e.enabled?"prevent it from sending updates":"allow it to send updates"]})}),s.jsx(Gn,{open:r,onClick:E,onClose:()=>o(!1),title:"Delete integration?",children:s.jsx(Lt,{severity:"warning",children:"Deleting this integration instance will delete all its configuration. It will stop working immediately."})})]})},zNe=x(kn,{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"})),ih=({tooltip:e,highlighted:t,tooltipProps:n,children:r,...o})=>s.jsx(hr,{title:e,...n,arrow:!0,children:s.jsx(zNe,{tabIndex:0,highlighted:t,...o,children:r})}),HNe=x(ih)({display:"flex",alignItems:"center"}),WNe=x("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),VNe=x("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),UNe=({integration:e,...t})=>{const{integrationEvents:n}=yJ(e==null?void 0:e.id,1,{refreshInterval:5e3}),{locationSettings:r}=wo();if(n.length===0)return null;const o=n[0];return s.jsx(J,{onClick:i=>i.preventDefault(),...t,children:s.jsx(HNe,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:s.jsxs(s.Fragment,{children:[s.jsxs(WNe,{children:[s.jsx(VNe,{children:"Last event"}),s.jsx("span",{children:Ja(o.createdAt,r==null?void 0:r.locale)})]}),s.jsx(RJ,{...o})]}),children:s.jsx(_J,{...o})})})},GNe=x("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}}})),OD=x(kn)({textDecoration:"none",color:"inherit",textAlign:"left"}),qNe=x(xt)({textDecoration:"none",color:"inherit"}),YNe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),KNe=x(Z)(()=>({display:"flex",alignItems:"center",marginRight:"auto"})),XNe=x(Z)(({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)})),JNe=x(q0)(({theme:e})=>({fontSize:e.fontSizes.bodySize})),ou=({variant:e="default",icon:t,title:n,description:r,isEnabled:o,configureActionText:i="Configure",link:a,onClick:l,addon:c,deprecated:u,isExternal:d=!1})=>{const{trackEvent:p}=Kt(),f=c!==void 0,h=()=>{p("open-integration",{props:{integrationName:n,isConfigured:f}})},g=s.jsxs(GNe,{variant:e,children:[s.jsxs(YNe,{children:[s.jsxs(KNe,{variant:"h3","data-loading":!0,children:[s.jsx(gJ,{name:t})," ",n]}),s.jsx(X,{condition:u!==void 0,show:s.jsx(kt,{title:u,arrow:!0,children:s.jsx(sn,{"data-loading":!0,children:"Deprecated"})})}),s.jsx(X,{condition:o===!0,show:s.jsx(sn,{color:"success","data-loading":!0,children:"Enabled"})}),s.jsx(X,{condition:o===!1,show:s.jsx(sn,{"data-loading":!0,children:"Disabled"})}),s.jsx(X,{condition:f,show:s.jsx(BNe,{addon:c})})]}),s.jsx(Z,{variant:"body2",color:"text.secondary","data-loading":!0,children:r}),s.jsxs(XNe,{"data-loading":!0,children:[i,s.jsx(X,{condition:d,show:s.jsx(JNe,{}),elseShow:s.jsx(n9,{})}),s.jsx(UNe,{integration:c,sx:{ml:"auto"}})]})]});return l?s.jsx(OD,{component:"button",onClick:()=>{h(),l()},children:g}):d?s.jsx(OD,{href:a,target:"_blank",rel:"noreferrer",onClick:h,children:g}):s.jsx(qNe,{to:a,onClick:h,children:g})};var f9={},QNe=Te;Object.defineProperty(f9,"__esModule",{value:!0});var EC=f9.default=void 0,ZNe=QNe(ke()),eBe=s,tBe=(0,ZNe.default)((0,eBe.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");EC=f9.default=tBe;const nBe="/static/cr-DbjGV9Hl.png",rBe="/static/cr-DbjGV9Hl.png",oBe="/static/cr-DbjGV9Hl.png",iBe=x("figure")(({theme:e})=>({display:"flex",gap:e.spacing(2),margin:e.spacing(2,0),flexDirection:"column"})),sBe=x("figcaption")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexDirection:"column"})),aBe=x("img")({maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"}),J3=({title:e,description:t,src:n})=>s.jsxs(iBe,{children:[s.jsxs(sBe,{children:[s.jsx(Z,{variant:"h3",children:e}),s.jsx(Z,{children:t})]}),s.jsx(aBe,{src:ti(n),alt:e})]}),lBe=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",gap:e.spacing(2),marginTop:e.spacing(1)})),cBe=x("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),h9=x("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),uBe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),dBe=x("div")({display:"flex",justifyContent:"flex-end"}),pBe=x("section")(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:e.spacing(2)})),MD=x(xn)(({theme:e})=>({width:"100%"})),TC=m.forwardRef(({children:e},t)=>s.jsx(Z,{ref:t,component:"h4",variant:"h4",sx:n=>({margin:n.spacing(1,0)}),children:e})),fBe=x("div")({marginTop:"25px"}),hBe=x("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)})),wT=({...e})=>s.jsx(Lr,{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}),DD=["http","https","mailto","tel"];function gBe(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<DD.length;){const i=DD[o];if(r===i.length&&t.slice(0,i.length).toLowerCase()===i)return t}return o=t.indexOf("?"),o!==-1&&r>o||(o=t.indexOf("#"),o!==-1&&r>o)?t:"javascript:void(0)"}/*!
300
300
  * Determine if an object is a Buffer
301
301
  *
302
302
  * @author Feross Aboukhadijeh <https://feross.org>
@@ -351,7 +351,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
351
351
  `),M.push("+ "+k),A.length&&M.push(`? ${Array(O+1).join(" ")}${A}
352
352
  `),M}},r=function(C,T=/^\s*#?\s*$/){return T.test(C)},n=function(C,T=" "){return E.call(T,C)>=0},d=function(C,T){var k,_;return k=C+1,_=T-C,_===1?`${k}`:(_||k--,`${k},${_}`)},j=function(C,T,{fromfile:k,tofile:_,fromfiledate:A,tofiledate:O,n:M,lineterm:H}={}){var P,$,D,z,B,L,I,q,ee,W,oe,ne,ce,xe,re,ve,he,ye,Pe,Ee,Re,_e,ge,ze,Se,Ve,Ne,Xe,yt;for(k==null&&(k=""),_==null&&(_=""),A==null&&(A=""),O==null&&(O=""),M==null&&(M=3),H==null&&(H=`
353
353
  `),ye=[],Ne=!1,ge=new o(null,C,T).getGroupedOpcodes(),W=0,ne=ge.length;W<ne;W++)for(B=ge[W],Ne||(Ne=!0,z=A?` ${A}`:"",yt=O?` ${O}`:"",ye.push(`--- ${k}${z}${H}`),ye.push(`+++ ${_}${yt}${H}`)),[D,oe]=[B[0],B[B.length-1]],P=d(D[1],oe[2]),$=d(D[3],oe[4]),ye.push(`@@ -${P} +${$} @@${H}`),Pe=0,ce=B.length;Pe<ce;Pe++){if([Xe,L,I,q,ee]=B[Pe],Xe==="equal"){for(ze=C.slice(L,I),Ee=0,xe=ze.length;Ee<xe;Ee++)he=ze[Ee],ye.push(" "+he);continue}if(Xe==="replace"||Xe==="delete")for(Se=C.slice(L,I),Re=0,re=Se.length;Re<re;Re++)he=Se[Re],ye.push("-"+he);if(Xe==="replace"||Xe==="insert")for(Ve=T.slice(q,ee),_e=0,ve=Ve.length;_e<ve;_e++)he=Ve[_e],ye.push("+"+he)}return ye},u=function(C,T){var k,_;return k=C+1,_=T-C,_||k--,_<=1?`${k}`:`${k},${k+_-1}`},h=function(C,T,{fromfile:k,tofile:_,fromfiledate:A,tofiledate:O,n:M,lineterm:H}={}){var P,$,D,z,B,L,I,q,ee,W,oe,ne,ce,xe,re,ve,he,ye,Pe,Ee,Re,_e,ge,ze,Se,Ve,Ne,Xe,yt,wt;for(k==null&&(k=""),_==null&&(_=""),A==null&&(A=""),O==null&&(O=""),M==null&&(M=3),H==null&&(H=`
354
- `),ge={insert:"+ ",delete:"- ",replace:"! ",equal:" "},Xe=!1,Pe=[],Se=new o(null,C,T).getGroupedOpcodes(),oe=0,ce=Se.length;oe<ce;oe++)if(L=Se[oe],!Xe){if(Xe=!0,B=A?` ${A}`:"",wt=O?` ${O}`:"",Pe.push(`*** ${k}${B}${H}`),Pe.push(`--- ${_}${wt}${H}`),[z,ne]=[L[0],L[L.length-1]],Pe.push("***************"+H),$=u(z[1],ne[2]),Pe.push(`*** ${$} ****${H}`),i(function(){var st,Ce,Be;for(Be=[],Ce=0,st=L.length;Ce<st;Ce++)[yt,P,P,P,P]=L[Ce],Be.push(yt==="replace"||yt==="delete");return Be}())){for(Ee=0,xe=L.length;Ee<xe;Ee++)if([yt,I,q,P,P]=L[Ee],yt!=="insert")for(Ve=C.slice(I,q),Re=0,re=Ve.length;Re<re;Re++)ye=Ve[Re],Pe.push(ge[yt]+ye)}if(D=u(z[3],ne[4]),Pe.push(`--- ${D} ----${H}`),i(function(){var st,Ce,Be;for(Be=[],Ce=0,st=L.length;Ce<st;Ce++)[yt,P,P,P,P]=L[Ce],Be.push(yt==="replace"||yt==="insert");return Be}())){for(_e=0,ve=L.length;_e<ve;_e++)if([yt,P,P,ee,W]=L[_e],yt!=="delete")for(Ne=T.slice(ee,W),ze=0,he=Ne.length;ze<he;ze++)ye=Ne[ze],Pe.push(ge[yt]+ye)}}return Pe},w=function(C,T,k,_=n){return new e(k,_).compare(C,T)},S=function(C,T){var k,_,A,O,M,H,P;if(P={1:"- ",2:"+ "}[T],!P)throw new Error(`unknow delta choice (must be 1 or 2): ${T}`);for(M=[" ",P],O=[],k=0,_=C.length;k<_;k++)A=C[k],H=A.slice(0,2),E.call(M,H)>=0&&O.push(A.slice(2));return O},fs._arrayCmp=a,fs.SequenceMatcher=o,fs.getCloseMatches=v,fs._countLeading=c,fs.Differ=e,fs.IS_LINE_JUNK=r,fs.IS_CHARACTER_JUNK=n,fs._formatRangeUnified=d,fs.unifiedDiff=j,fs._formatRangeContext=u,fs.contextDiff=h,fs.ndiff=w,fs.restore=S}).call(Cn);var wXe=fs;class SXe{constructor(t){var n;t.outputKeys=t.outputKeys||[],t.excludeKeys=t.excludeKeys||[],t.showElisionsForObjects=(n=t.showElisionsForObjects)!==null&&n!==void 0?n:!0,this.options=t}isScalar(t){return typeof t!="object"||t===null}objectDiff(t,n){let r={},o=0,i=!0;for(const[a,l]of Object.entries(t))if(!this.options.outputNewOnly){const c="__deleted";!(a in n)&&!this.options.excludeKeys.includes(a)&&(r[`${a}${c}`]=l,o-=30,i=!1)}for(const[a,l]of Object.entries(n)){const c=this.options.outputNewOnly?"":"__added";!(a in t)&&!this.options.excludeKeys.includes(a)&&(r[`${a}${c}`]=l,o-=30,i=!1)}for(const[a,l]of Object.entries(t))if(a in n){if(this.options.excludeKeys.includes(a))continue;o+=20;const c=n[a],u=this.diff(l,c);u.equal?this.options.full||this.options.outputKeys.includes(a)?r[a]=l:this.options.showElisionsForObjects&&(r[a]=cZ):(r[a]=u.result,i=!1),o+=Math.min(20,Math.max(-10,u.score/5))}return i?(o=100*Math.max(Object.keys(t).length,.5),this.options.full||(r=void 0)):o=Math.max(0,o),{score:o,result:r,equal:i}}findMatchingObject(t,n,r){let o=null;for(const[i,{item:a,index:l}]of Object.entries(r))if(i!=="__next"){const c=Math.abs(l-n);if(Kh(t)===Kh(a)){const{score:u}=this.diff(t,a);(!o||u>o.score||u===o.score&&c<o.indexDistance)&&(o={score:u,key:i,indexDistance:c})}}return o}scalarize(t,n,r){const o=[];if(r){const a={};for(let l=0;l<t.length;l++){const c=t[l];if(this.isScalar(c))continue;const u=this.findMatchingObject(c,l,r);u&&(!a[u.key]||u.score>a[u.key].score)&&(a[u.key]={score:u.score,index:l})}for(const[l,c]of Object.entries(a))o[c.index]=l}const i=[];for(let a=0;a<t.length;a++){const l=t[a];if(this.isScalar(l))i.push(l);else{const c=o[a]||"__$!SCALAR"+n.__next++;n[c]={item:l,index:a},i.push(c)}}return i}isScalarized(t,n){return typeof t=="string"&&t in n}descalarize(t,n){return this.isScalarized(t,n)?n[t].item:t}arrayDiff(t,n){const r={__next:1},o=this.scalarize(t,r),i={__next:r.__next},a=this.scalarize(n,i,r);this.options.sort&&(o.sort(),a.sort());const l=new wXe.SequenceMatcher(null,o,a).getOpcodes();let c=[],u=0,d=!0;for(const[p,f,h,g,v]of l){let b,y,w,S,j,E,C,T;switch(p==="equal"||this.options.keysOnly&&p==="replace"||(d=!1),p){case"equal":for(b=f,S=h,w=f<=S;w?b<S:b>S;w?b++:b--){const k=o[b];if(this.isScalarized(k,r)){if(!this.isScalarized(k,i))throw new Error(`internal bug: isScalarized(item, originals1) != isScalarized(item, originals2) for item ${JSON.stringify(k)}`);const _=this.descalarize(k,r),A=this.descalarize(k,i),O=this.diff(_,A);O.equal?this.options.full||this.options.keepUnchangedValues?c.push([" ",_]):c.push([" "]):(c.push(["~",O.result]),d=!1)}else this.options.full||this.options.keepUnchangedValues?c.push([" ",k]):c.push([" "]);u+=10}break;case"delete":for(b=f,E=h,j=f<=E;j?b<E:b>E;j?b++:b--)c.push(["-",this.descalarize(o[b],r)]),u-=5;break;case"insert":for(y=g,T=v,C=g<=T;C?y<T:y>T;C?y++:y--)c.push(["+",this.descalarize(a[y],i)]),u-=5;break;case"replace":if(this.options.keysOnly){let k,_;for(b=f,_=h,k=f<=_;k?b<_:b>_;k?b++:b--){const A=this.diff(this.descalarize(o[b],r),this.descalarize(a[b-f+g],i));A.equal?c.push([" "]):(c.push(["~",A.result]),d=!1)}}else{let k,_,A,O;for(b=f,_=h,k=f<=_;k?b<_:b>_;k?b++:b--)c.push(["-",this.descalarize(o[b],r)]),u-=5;for(y=g,O=v,A=g<=O;A?y<O:y>O;A?y++:y--)c.push(["+",this.descalarize(a[y],i)]),u-=5}break}}return d||l.length===0?(this.options.full?c=t:c=void 0,u=100):u=Math.max(0,u),{score:u,result:c,equal:d}}diff(t,n){const r=Kh(t),o=Kh(n);if(r===o)switch(r){case"object":return this.objectDiff(t,n);case"array":return this.arrayDiff(t,n)}let i=100,a=t,l;return this.options.keysOnly?(l=!0,a=void 0):(r==="date"&&o==="date"?l=t.getTime()===n.getTime():l=t===n,l?this.options.full||(a=void 0):(i=0,this.options.outputNewOnly?a=n:a={__old:t,__new:n})),{score:i,result:a,equal:l}}}const td=function(e,t,n,r,o,i){var a;let l;const c=t?`${t}: `:"",u=i+" ",d=e.maxElisions===void 0?1/0:e.maxElisions,p=(a=e.renderElision)!==null&&a!==void 0?a:(h,g)=>h<g?[...Array(h)].map(()=>"..."):`... (${h} entries)`,f=h=>{const g=p(h,d);typeof g=="string"?r(" ",u+g):g.forEach(v=>{r(" ",u+v)})};switch(Kh(n)){case"object":if("__old"in n&&"__new"in n&&Object.keys(n).length===2)return td(e,t,n.__old,r,"-",i),td(e,t,n.__new,r,"+",i);{r(o,`${i}${c}{`);let h=0;for(const g of Object.keys(n)){let v;if(l=n[g],l===cZ){h++;continue}else h>0&&(f(h),h=0);(v=g.match(/^(.*)__deleted$/))?td(e,v[1],l,r,"-",u):(v=g.match(/^(.*)__added$/))?td(e,v[1],l,r,"+",u):td(e,g,l,r,o,u)}return h>0&&f(h),r(o,`${i}}`)}case"array":{r(o,`${i}${c}[`);let h=!0;for(const g of n)(Kh(g)!=="array"||!(g.length===2||g.length===1&&g[0]===" ")||typeof g[0]!="string"||g[0].length!==1||![" ","-","+","~"].includes(g[0]))&&(h=!1);if(h){let g,v=0;for([g,l]of n)if(g===" "&&l==null)v++;else{if(v>0&&f(v),v=0,![" ","~","+","-"].includes(g))throw new Error(`Unexpected op '${g}' in ${JSON.stringify(n,null,2)}`);g==="~"&&(g=" "),td(e,"",l,r,g,u)}v>0&&f(v)}else for(l of n)td(e,"",l,r,o,u);return r(o,`${i}]`)}default:if(n===0||n===null||n===!1||n===""||n)return r(o,i+c+JSON.stringify(n))}},CXe=(e,t,n)=>td(t,"",e,n," ",""),jXe=function(e,t={},n){const r=[];return CXe(e,t,function(o,i){let a,l;o===" "?(a=n.unchangedClassName,l=n.unchangedLineStyle):o==="+"?(a=n.additionClassName,l=n.additionLineStyle):(a=n.deletionClassName,l=n.deletionLineStyle);let c=s.jsx("div",Object.assign({className:a,style:l},{children:i}),r.length);return r.push(c)}),s.jsx("div",Object.assign({className:n.frameClassName,style:n.frameStyle},{children:r}))};function EXe(e,t,n={}){return n.precision!==void 0&&(e=BT(e,n.precision),t=BT(t,n.precision)),new SXe(n).diff(e,t).result}function TXe(e,t,n={},r){return jXe(EXe(e,t,n),n,r)}const kXe={additionLineStyle:null,additionClassName:"addition",deletionLineStyle:null,deletionClassName:"deletion",unchangedLineStyle:null,unchangedClassName:"unchanged",frameStyle:null,frameClassName:"diff"};function _Xe(e){return Object.assign(Object.assign({},kXe),e)}function RXe(e){var t;return TXe(e.jsonA,e.jsonB,e.jsonDiffOptions,_Xe((t=e.styleCustomization)!==null&&t!==void 0?t:{}))}const PXe=x("div")(({theme:e})=>({color:e.palette.text.secondary,fontFamily:"monospace",whiteSpace:"pre-wrap",fontSize:e.typography.body2.fontSize,".deletion, .addition":{position:"relative","::before":{position:"absolute",left:0,top:0}},".addition":{color:e.palette.eventLog.diffAdd,"::before":{content:'"+"'}},".deletion":{color:e.palette.eventLog.diffSub,"::before":{content:'"-"'}},'&[data-change-type="replacement"]':{":has(.addition)":{color:e.palette.eventLog.diffAdd},":has(.deletion)":{color:e.palette.eventLog.diffSub},".addition::before, .deletion::before":{content:"none"}},".diff:not(:has(*))":{"::before":{content:'"(no changes)"'}}})),AXe=x("span")(({theme:e})=>({marginInlineEnd:e.spacing(.5)})),xp=({entry:e,excludeKeys:t})=>{const n=e.preData&&e.data?"edit":"replacement",r=n==="edit",[o,i]=m.useState(!1),a=m.useId();return s.jsxs(s.Fragment,{children:[r?s.jsxs(Ue,{onClick:()=>i(!o),"aria-controls":a,"aria-expanded":o,children:[s.jsx(AXe,{"aria-hidden":!0,children:o?"-":"+"}),o?"Show only changed properties":"Show all properties"]}):null,s.jsx(PXe,{"data-change-type":n,id:a,children:s.jsx(RXe,{jsonA:e.preData??{},jsonB:e.data??{},jsonDiffOptions:{full:o,maxElisions:2,excludeKeys:t}})})]})},IXe=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=qt(),a=Xn(i.breakpoints.down("sm")),l=m.useMemo(()=>{const c={...Tq,padding:`${i.spacing(3)} ${i.spacing(4)}`,boxShadow:i.boxShadows.elevated,borderRadius:i.shape.borderRadiusLarge,backgroundColor:i.palette.background.paper,maxWidth:i.spacing(75),zIndex:i.zIndex.mobileStepper};return a?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,a]);return s.jsxs(ER,{mounted:t,start:l,enter:kq,children:[s.jsx(Z,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),s.jsx(Z,{variant:"body1",sx:{my:2,mb:3},children:"The data you have been working on is stale, would you like to refresh your data? This may happen if someone has been making changes to the data while you were working."}),s.jsx(xp,{entry:{preData:o,data:r}}),s.jsx(Ue,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},$Xe=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},uZ=(e,t,n,r)=>{const{data:o,refetch:i}=$Xe(e),[a,l]=m.useState(t||null),[c,u]=m.useState(!1),d=f=>{u(!1),l(f)},p=f=>f&&(r&&typeof r=="function"?r(f):f);return m.useEffect(()=>{a===null&&l(t)},[t]),m.useEffect(()=>{if(!a||!o)return;c1(p(a),p(o))||u(!0)},[o]),{data:a,refetch:i,staleDataNotification:s.jsx(IXe,{cache:p(a),data:p(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}};function zT(e,...t){const n=new Set(t);if(Array.isArray(e))return e.map(r=>zT(r,...t));if(typeof e=="object"&&e!==null){const r={};for(const[o,i]of Object.entries(e))n.has(o)||(r[o]=zT(i,...t));return r}return e}const dZ=e=>{const t={...e};return zT(t,"lastSeenAt","yes","no","lifecycle","collaborators")},uI=(e,t)=>{var n;return`${e.baseUriPath||((n=e.versionInfo)==null?void 0:n.instanceId)}#${t}`},OXe={willOverwriteStrategyChanges:!1,registerWillOverwriteStrategyChanges:()=>{}},pZ=m.createContext(OXe),MXe=pZ.Provider,DXe=()=>m.useContext(pZ),Ou=()=>{const{trackEvent:e}=Kt(),{makeRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0}),{uiConfig:i}=rt(),{willOverwriteStrategyChanges:a}=DXe();return{addChange:async(b,y,w)=>{e("change_request",{props:{eventType:"change added"}});const S=`api/admin/projects/${b}/environments/${y}/change-requests`,j=n(S,{method:"POST",body:JSON.stringify(w)});return(await t(j.caller,j.id)).json()},editChange:async(b,y,w,S)=>{const j=`api/admin/projects/${b}/change-requests/${y}/changes/${w}`,E=n(j,{method:"PUT",body:JSON.stringify(S)});return t(E.caller,E.id)},changeState:async(b,y,w,S)=>{e("change_request",{props:{eventType:S.state,previousState:w,willOverwriteStrategyChanges:a,id:uI(i,y)}});const j=`api/admin/projects/${b}/change-requests/${y}/state`,E=n(j,{method:"PUT",body:JSON.stringify(S)});return(await t(E.caller,E.id)).json()},discardChange:async(b,y,w)=>{const S=`api/admin/projects/${b}/change-requests/${y}/changes/${w}`,j=n(S,{method:"DELETE"});return t(j.caller,j.id)},updateChangeRequestEnvironmentConfig:async({project:b,enabled:y,environment:w,requiredApprovals:S})=>{const j=`api/admin/projects/${b}/environments/${w}/change-requests/config`,E=n(j,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:y,requiredApprovals:S})});return t(E.caller,E.id)},discardDraft:async(b,y)=>{const w=`api/admin/projects/${b}/change-requests/${y}`,S=n(w,{method:"DELETE"});return t(S.caller,S.id)},addComment:async(b,y,w)=>{e("change_request",{props:{eventType:"comment added"}});const S=`/api/admin/projects/${b}/change-requests/${y}/comments`,j=n(S,{method:"POST",body:JSON.stringify({text:w})});return t(j.caller,j.id)},updateTitle:async(b,y,w)=>{e("change_request",{props:{eventType:"title updated"}});const S=`api/admin/projects/${b}/change-requests/${y}/title`,j=n(S,{method:"PUT",body:JSON.stringify({title:w})});return t(j.caller,j.id)},updateRequestedApprovers:async(b,y,w)=>{e("change_request",{props:{eventType:"approvers updated"}});const S=`api/admin/projects/${b}/change-requests/${y}/approvers`,j=n(S,{method:"PUT",body:JSON.stringify({reviewers:w})});return t(j.caller,j.id)},errors:r,loading:o}},cy=(e,t,n,r={})=>{const{isEnterprise:o}=rt();return Bi(o(),e,t,n,r)},LXe=e=>fetch(e).then(Jt("ChangeRequest")).then(t=>t.json()),uy=e=>{const{data:t,error:n,mutate:r}=cy([],bt(`api/admin/projects/${e}/change-requests/pending`),LXe);return{data:t,loading:!n&&!t,refetch:r,error:n}},fZ=({strategyDefinition:e})=>s.jsx("p",{children:e==null?void 0:e.description}),FXe=ASe(z2e,e=>({root:{height:8},thumb:{height:24,width:24,backgroundColor:e.palette.background.paper,border:"2px solid currentColor"},active:{},valueLabel:{},track:{height:8,borderRadius:e.shape.borderRadius},rail:{height:8,borderRadius:e.shape.borderRadius}})),NXe=x(Z)(({theme:e})=>({marginBottom:e.spacing(1)})),aF=x(Z)(({theme:e})=>({marginBottom:e.spacing(1),marginTop:e.spacing(1)})),BXe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),zXe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",gap:e.spacing(4),marginBottom:e.spacing(1)})),HXe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",width:"100px",flexShrink:0})),WXe=x("div")(({theme:e})=>({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"column",gap:e.spacing(2)})),VXe=x("div")(({theme:e})=>({flexGrow:1})),UXe=x(xn)(({theme:e})=>({width:"90px"})),GXe=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}],qXe=({name:e,value:t,onChange:n,disabled:r=!1})=>{const[o,i]=m.useState(t.toString());m.useEffect(()=>{i(t.toString())},[t]);const a=d=>`${d}%`,l=d=>{i(d.target.value)},c=()=>{const d=Number.parseInt(o,10);if(!Number.isNaN(d)&&d>=0&&d<=100){const p=new Event("input",{bubbles:!0});n(p,d)}else i(t.toString())},u=d=>{d.key==="Enter"&&(d.preventDefault(),c())};return s.jsxs(WXe,{children:[s.jsxs(BXe,{children:[s.jsx(Z,{id:"discrete-slider-always",children:e}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(J,{children:[s.jsx(NXe,{variant:"h3",children:"Rollout percentage"}),s.jsx(Z,{variant:"body2",children:"The rollout percentage determines the proportion of users exposed to a feature. It's based on the MurmurHash of a user's unique identifier, normalized to a number between 1 and 100. If the normalized hash is less than or equal to the rollout percentage, the user sees the feature. This ensures a consistent, random distribution of the feature among users."}),s.jsx(aF,{variant:"h3",children:"Stickiness"}),s.jsxs(Z,{variant:"body2",children:["Stickiness refers to the value used for hashing to ensure a consistent user experience. It determines the input for the MurmurHash, ensuring that a user's feature exposure remains consistent across sessions.",s.jsx("br",{}),"By default Unleash will use the first value present in the context in the order of"," ",s.jsx("b",{children:"userId, sessionId and random"}),"."]}),s.jsx(aF,{variant:"h3",children:"GroupId"}),s.jsx(Z,{variant:"body2",children:"The groupId is used as a seed for the hash function, ensuring consistent feature exposure across different feature flags for a uniform user experience."})]})})]}),s.jsxs(zXe,{children:[s.jsx(VXe,{children:s.jsx(FXe,{min:0,max:100,value:t,getAriaValueText:a,"aria-labelledby":"discrete-slider-always",step:1,"data-testid":wje,marks:GXe,onChange:n,valueLabelDisplay:"on",disabled:r})}),s.jsx(HXe,{children:s.jsx(UXe,{size:"small","aria-labelledby":"discrete-slider-always",type:"number",value:o,onChange:l,onBlur:c,onKeyDown:u,disabled:r,inputProps:{min:0,max:100,step:1},InputProps:{endAdornment:s.jsx(fp,{position:"end",children:"%"})}})})]})]})},dI=e=>s.jsx(qXe,{...e}),Og=e=>{const t=Number(Wa(e));return Number.isFinite(t)?t:0},Wa=e=>String(e??"").trim(),l0=e=>Wa(e).split(",").map(t=>t.trim()).filter(Boolean),YXe=x("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),lF=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),KXe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),XXe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"normal",wordBreak:"break-word"})),JXe=x("div")(({theme:e})=>({lineHeight:1.2,width:"100%"})),hZ=({label:e,editable:t,value:n,onChange:r,dataTestId:o})=>{const i=qt(),a=XQ(n),l=c=>{const u=a.find(d=>d.key===c);return s.jsxs(YXe,{children:[s.jsx(lF,{children:(u==null?void 0:u.label)||c}),(u==null?void 0:u.description)&&s.jsx(KXe,{children:u.description})]})};return s.jsxs(Is,{variant:"outlined",size:"small",sx:{width:"100%",marginBottom:i.spacing(2)},children:[s.jsx(Su,{htmlFor:"stickiness-select",children:e}),s.jsx($c,{id:"stickiness-select",name:"stickiness",label:e,value:n||"",disabled:!t,"data-testid":o,onChange:r,renderValue:l,MenuProps:{anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{width:"18%"}}},children:a.map(c=>s.jsx(Cr,{value:c.key,"data-testid":`${$R}-${c.label}`,sx:{padding:i.spacing(1,2)},children:s.jsxs(JXe,{children:[s.jsx(lF,{children:c.label}),c.description&&s.jsx(XXe,{children:c.description})]})},c.key))})]})},QXe="default",ZXe=e=>{const{project:t,loading:n,error:r}=um(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:QXe,mode:t.mode,loading:n,error:r}},eJe=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),tJe=x(J)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",width:"100%",justifyContent:"space-between"})),nJe=x(J)(({theme:e})=>({width:"50%",marginRight:e.spacing(.5)})),rJe=x(J)(({theme:e})=>({width:"50%",marginLeft:e.spacing(.5)})),oJe=({updateParameter:e,parameters:t,editable:n=!0,errors:r})=>{const o=Or("projectId"),i=$s("featureId"),{defaultStickiness:a,loading:l}=ZXe(o),{pathname:c}=Mr(),u=c.includes("default-strategy"),d=(g,v)=>{e("rollout",v.toString())},p=t.rollout!==void 0?Og(t.rollout):100,f=m.useMemo(()=>(!t.stickiness&&!l&&e("stickiness",a),Wa(t.stickiness)),[l,a,t.stickiness]);m.useEffect(()=>{!t.groupId&&!l&&(u||!i?e("groupId",""):e("groupId",i))},[u,i,l]);const h=Wa(t.groupId);return l?s.jsx(o0,{}):s.jsxs(eJe,{children:[s.jsx(dI,{name:"Rollout",value:p,disabled:!n,onChange:d}),s.jsxs(tJe,{children:[s.jsx(nJe,{children:s.jsx(hZ,{label:"Stickiness",value:f,editable:n,dataTestId:Cje,onChange:g=>e("stickiness",g.target.value)})}),s.jsx(rJe,{children:s.jsx(vr,{label:"groupId",sx:{width:"100%"},id:"groupId-input",value:h,disabled:!n,onChange:g=>e("groupId",Wa(g.target.value)),"data-testid":jje,error:!!(r!=null&&r.getFormError("groupId")),helperText:r==null?void 0:r.getFormError("groupId")})})]})]})},FC=({text:e,maxWidth:t,maxLength:n,className:r,...o})=>s.jsx(X,{condition:((e==null?void 0:e.length)??0)>n,show:s.jsx(kt,{title:e,arrow:!0,children:s.jsx("span",{"data-loading":!0,className:r,style:{maxWidth:`${t}px`,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},...o,children:e})}),elseShow:s.jsx("span",{className:r,children:e})}),iJe=x("div")(({theme:e})=>({display:"grid",gap:e.spacing(1)})),sJe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexWrap:"wrap"})),aJe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start"})),lJe=({name:e,list:t,setConfig:n,disabled:r,errors:o})=>{const[i,a]=m.useState(""),l="Enter",c=h=>{d(h)},u=h=>{(h==null?void 0:h.key)===l&&(d(h),h.preventDefault(),h.stopPropagation())},d=h=>{h.preventDefault();const g=h.target.value;if(g){const v=g.split(/,\s*/).filter(b=>!t.includes(b));if(v.length>0){const b=t.concat(v).filter(y=>y);n(e,b.join(","))}a("")}},p=h=>{t[h]=null,n(e,t.length===1?"":t.filter(Boolean).join(","))},f=h=>{a(h.currentTarget.value)};return s.jsxs(iJe,{children:[s.jsxs(Z,{variant:"subtitle2",component:"h2",children:["List of ",e]}),s.jsx(X,{condition:t.length>0,show:s.jsx(sJe,{children:t.map((h,g)=>s.jsx(da,{label:s.jsx(FC,{maxWidth:"300",text:h,maxLength:50}),onDelete:r?void 0:()=>p(g),title:"Remove value"},g+h))})}),s.jsx(X,{condition:!r,show:s.jsxs(aJe,{children:[s.jsx(xn,{error:!!o.getFormError(e),helperText:o.getFormError(e),name:"input_field",variant:"outlined",label:"Add items",id:"input-add-items",value:i,size:"small",placeholder:"",onBlur:c,onChange:f,onKeyDown:u,"data-testid":Eje}),s.jsx(Ue,{onClick:d,"data-testid":Tje,variant:"outlined",color:"secondary",startIcon:s.jsx(Oo,{}),children:"Add"})]})})]})},sv=({text:e})=>e?s.jsx(J,{sx:t=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallerBody,marginTop:t.spacing(1)}),children:e}):null,cJe=({definition:e,parameters:t,updateParameter:n,editable:r,errors:o})=>{const{type:i,name:a,description:l,required:c}=e,u=t[a],d=o.getFormError(a),p=c?`${a} * `:a,f=y=>{n(a,y.target.value)},h=y=>{n(a,Wa(y.target.value))},g=(y,w)=>{n(a,w.toString())},v=(y,w)=>{n(a,String(w))},b=(y,w)=>{n(y,l0(w).join(","))};if(i==="percentage")return s.jsxs("div",{children:[s.jsx(dI,{name:a,onChange:g,disabled:!r,value:Og(t[a]),minLabel:"off",maxLabel:"on"}),s.jsx(sv,{text:l})]});if(i==="list")return s.jsxs("div",{children:[s.jsx(lJe,{name:a,list:l0(t[a]),disabled:!r,setConfig:b,errors:o}),s.jsx(sv,{text:l})]});if(i==="number")return s.jsxs("div",{children:[s.jsx(xn,{error:!!d,helperText:d,variant:"outlined",size:"small","aria-required":c,style:{width:"100%"},disabled:!r,label:p,onChange:f,value:u}),s.jsx(sv,{text:l})]});if(i==="boolean"){const w=Wa(t[a])==="true";return s.jsxs("div",{children:[s.jsx(qr,{label:a,control:s.jsx(fa,{name:a,onChange:v,checked:w})}),s.jsx(sv,{text:l})]})}return s.jsxs("div",{children:[s.jsx(xn,{rows:1,placeholder:"",variant:"outlined",size:"small",style:{width:"100%"},"aria-required":c,disabled:!r,error:!!d,helperText:d,name:a,label:p,onChange:h,value:Wa(t[a])}),s.jsx(sv,{text:l})]})},uJe=cp("div")(({theme:e})=>({display:"grid",gap:e.spacing(4)})),gZ=({parameters:e,strategyDefinition:t,updateParameter:n,editable:r,errors:o})=>!t||t.parameters.length===0?null:s.jsx(uJe,{children:t.parameters.map((i,a)=>s.jsx("div",{children:s.jsx(cJe,{definition:i,parameters:e,updateParameter:n,editable:r,errors:o})},a))}),dJe=({hasAccess:e,strategy:t,strategyDefinition:n,setStrategy:r,validateParameter:o,errors:i})=>{const{context:a}=ya(),l=(c,u)=>{r(Ma(d=>{d.parameters=d.parameters??{},d.parameters[c]=u})),o(c,u)};switch(t.name){case"default":return s.jsx(fZ,{strategyDefinition:n});case"flexibleRollout":return s.jsx(oJe,{context:a,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i});default:return s.jsx(gZ,{strategyDefinition:n,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i})}},pJe=({projectId:e,featureId:t,environmentId:n})=>{const r=MI(e,t),{feature:o}=Al(e,t),i=s.jsx(xt,{to:r,children:"feature flag page"});return s.jsx(X,{condition:fJe(o,n),show:s.jsxs(Lt,{severity:"success",children:["This feature flag is currently enabled in the"," ",s.jsx("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit"," ",s.jsx("strong",{children:"save"}),"."]}),elseShow:s.jsxs(Lt,{severity:"info",children:["This feature flag is currently disabled in the"," ",s.jsx("strong",{children:n})," environment. Any changes made here will not take effect until the flag has been enabled on the ",i,"."]})})},fJe=(e,t)=>{const n=e.environments.find(r=>r.name===t);return n?n.enabled:!1},pI=x(({...e})=>s.jsx(J,{role:"separator",...e,children:"and"}))(({theme:e})=>({position:"absolute",top:e.spacing(-.5),left:e.spacing(2),transform:"translateY(-50%)",padding:e.spacing(.75,1),lineHeight:1,fontSize:e.fontSizes.smallerBody,color:e.palette.text.primary,background:e.palette.background.application,borderRadius:e.shape.borderRadiusExtraLarge,zIndex:e.zIndex.fab,textTransform:"uppercase"})),hJe=x("ul")(({theme:e})=>({display:"flex",flexDirection:"column",listStyle:"none",padding:0,margin:0,gap:e.spacing(1)})),mZ=x("div")(({theme:e})=>({position:"relative",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,background:e.palette.background.default,padding:e.spacing(1.5,2),display:"flex",flexFlow:"column",gap:e.spacing(1)})),gJe=x("li")({position:"relative"}),NC=({children:e})=>{const t=[];return m.Children.forEach(e,(n,r)=>{m.isValidElement(n)&&t.push(s.jsxs(gJe,{children:[r>0?s.jsx(pI,{},`${r}-divider`):null,n]},r))}),s.jsx(hJe,{children:t})},vZ="NOT_IN",fI="IN",yZ="STR_ENDS_WITH",xZ="STR_STARTS_WITH",bZ="STR_CONTAINS",wZ="NUM_EQ",SZ="NUM_GT",CZ="NUM_GTE",jZ="NUM_LT",EZ="NUM_LTE",hI="DATE_AFTER",TZ="DATE_BEFORE",kZ="SEMVER_EQ",_Z="SEMVER_GT",RZ="SEMVER_LT",mJe=[fI,vZ,bZ,xZ,yZ,wZ,SZ,CZ,jZ,EZ,TZ,hI,kZ,_Z,RZ],ch=e=>t=>e.includes(t),BC=[bZ,xZ,yZ],PZ=ch(BC),gI=[fI,vZ],vJe=ch(gI),mI=[wZ,SZ,CZ,jZ,EZ],AZ=ch(mI),zC=[TZ,hI],Dd=ch(zC),vI=[kZ,_Z,RZ],IZ=ch(vI),$Z=[...vI,...zC,...mI],yI=ch($Z),yJe=[...BC,...gI],OZ=ch(yJe);[...BC,...zC,...$Z];const c0="currentTime",MZ=e=>mJe.filter(t=>!(Dd(t)&&e!==c0||!Dd(t)&&e===c0)),HT=(e,t)=>t?bJe[e]:xJe[e],xJe={IN:"is one of",NOT_IN:"is not one of",STR_CONTAINS:"is a string that contains",STR_STARTS_WITH:"is a string that starts with",STR_ENDS_WITH:"is a string that ends with",NUM_EQ:"is a number equal to",NUM_GT:"is a number greater than",NUM_GTE:"is a number greater than or equal to",NUM_LT:"is a number less than",NUM_LTE:"is a number less than or equal to",DATE_BEFORE:"is a date before",DATE_AFTER:"is a date after",SEMVER_EQ:"is a SemVer equal to",SEMVER_GT:"is a SemVer greater than",SEMVER_LT:"is a SemVer less than"},bJe={IN:"is not one of",NOT_IN:"is one of",STR_CONTAINS:"is a string that does not contain",STR_STARTS_WITH:"is a string that does not start with",STR_ENDS_WITH:"is a string that does not end with",NUM_EQ:"is a number not equal to",NUM_GT:"is a number not greater than",NUM_GTE:"is a number less than",NUM_LT:"is a number not less than",NUM_LTE:"is a number greater than",DATE_BEFORE:"is a date not before",DATE_AFTER:"is a date not after",SEMVER_EQ:"is a SemVer not equal to",SEMVER_GT:"is a SemVer not greater than",SEMVER_LT:"is a SemVer not less than"},wJe=x($c)(({theme:e})=>({borderRadius:e.shape.borderRadius,padding:e.spacing(.25,0),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,fieldset:{border:"none"},transition:"all 0.03s ease","&:is(:hover, :focus-within)":{outline:`1px solid ${e.palette.primary.main}`},"&::before,&::after":{border:"none"},".MuiInput-input":{paddingBlock:e.spacing(.25)},":focus-within .MuiSelect-select":{background:"none"}})),SJe=x(Cr,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),CJe=x("span")(({theme:e})=>({paddingInline:e.spacing(1)})),jJe=({options:e,value:t,onChange:n,inverted:r})=>{const o=m.useId(),i=m.useId(),a=c=>{n(c.target.value)},l=()=>s.jsx(CJe,{children:HT(t,r)});return s.jsxs(Is,{variant:"standard",size:"small",hiddenLabel:!0,children:[s.jsx(Bc,{children:s.jsx(Su,{id:i,htmlFor:o,children:"Operator"})}),s.jsx(wJe,{id:o,labelId:i,name:"operator",disableUnderline:!0,value:t,onChange:a,renderValue:l,IconComponent:am,children:e.map(c=>s.jsx(SJe,{value:c,separator:EJe(e,c),children:HT(c,r)},c))})]})},EJe=(e,t)=>t===e[0]?!1:TJe.some(n=>n[0]===t),TJe=[gI,BC,mI,zC,vI];var xI={},kJe=Te;Object.defineProperty(xI,"__esModule",{value:!0});var bI=xI.default=void 0,_Je=kJe(ke()),RJe=s,PJe=(0,_Je.default)((0,RJe.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");bI=xI.default=PJe;const AJe=x("div")({display:"contents"}),IJe=x("ul")({listStyle:"none",display:"contents"}),DZ=e=>({":hover":{background:e.palette.secondary.light},":focus-visible":{background:e.palette.background.elevation1,outlineColor:e.palette.secondary.dark},background:e.palette.background.elevation1,color:e.palette.text.primary,height:"auto",outline:"1px solid #0000",transition:"all 0.3s ease"}),LZ=x(m.forwardRef((e,t)=>s.jsx(da,{size:"small",...e,ref:t,deleteIcon:s.jsx(bI,{})})))(({theme:e})=>({...DZ(e),color:e.palette.text.primary,padding:0,height:"auto","& .MuiChip-label":{paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),paddingLeft:e.spacing(1.5)},"& .MuiChip-deleteIcon":{marginRight:e.spacing(1)},svg:{fill:e.palette.secondary.dark,borderRadius:"50%",outline:"2px solid #0000",transition:"inherit",":focus-visible,:hover":{backgroundColor:e.palette.table.headerHover,outlineColor:e.palette.table.headerHover}}})),$Je=({values:e=[],removeValue:t,getExternalFocusTarget:n,children:r})=>{const o=m.useRef([]),i=a=>a===e.length-1?a===0?n():o.current[a-1]:o.current[a+1];return s.jsxs(AJe,{children:[s.jsx(IJe,{children:e.map((a,l)=>s.jsx("li",{children:s.jsx(LZ,{ref:c=>{o.current[l]=c},sx:{height:"auto","& .MuiChip-label":{display:"block",whiteSpace:"normal"}},label:a,onDelete:()=>{var c;(c=i(l))==null||c.focus(),t(a)}})},a))}),r]})},FZ=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},m.createElement("path",{fill:"#6C65E5",d:"m6.324 14.25-.739 1.971a.68.68 0 0 1-.28.378.816.816 0 0 1-.458.133.814.814 0 0 1-.688-.34.713.713 0 0 1-.102-.73l3.21-8.127a.89.89 0 0 1 .305-.389A.809.809 0 0 1 8.056 7h.662c.187 0 .348.049.484.146a.89.89 0 0 1 .305.39l3.21 8.15a.705.705 0 0 1-.09.718.79.79 0 0 1-.675.328.809.809 0 0 1-.484-.146.89.89 0 0 1-.305-.389l-.713-1.946H6.324Zm.535-1.41h3.056L8.438 8.8h-.102l-1.477 4.04ZM16.256 17c-.832 0-1.485-.207-1.96-.62-.476-.414-.714-.978-.714-1.691 0-.682.276-1.237.828-1.667.552-.43 1.26-.645 2.126-.645.39 0 .752.028 1.083.085.33.057.615.15.853.28v-.34c0-.438-.157-.787-.471-1.047-.314-.26-.743-.39-1.286-.39a2.377 2.377 0 0 0-1.35.415.981.981 0 0 1-.51.194.723.723 0 0 1-.509-.146.636.636 0 0 1-.267-.426.494.494 0 0 1 .165-.45 3.474 3.474 0 0 1 1.095-.632 4.141 4.141 0 0 1 1.401-.22c1.053 0 1.86.24 2.42.719.56.478.84 1.171.84 2.08v3.698c0 .195-.072.361-.216.499a.729.729 0 0 1-.523.207.75.75 0 0 1-.534-.22.686.686 0 0 1-.23-.51v-.22h-.076c-.22.325-.518.58-.891.767-.374.187-.798.28-1.274.28Zm.255-1.216c.543 0 1.006-.183 1.388-.548.382-.365.573-.807.573-1.326a2.985 2.985 0 0 0-.815-.292 4.071 4.071 0 0 0-.84-.097c-.544 0-.96.101-1.248.304-.289.203-.433.49-.433.864 0 .324.127.588.382.79.254.203.585.305.993.305Z"})),OJe=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},m.createElement("path",{fill:"#9F9FA1",d:"m6.324 14.25-.739 1.971a.68.68 0 0 1-.28.378.816.816 0 0 1-.458.133.814.814 0 0 1-.688-.34.713.713 0 0 1-.102-.73l3.21-8.127a.89.89 0 0 1 .305-.389A.809.809 0 0 1 8.056 7h.662c.187 0 .348.049.484.146a.89.89 0 0 1 .305.39l3.21 8.15a.705.705 0 0 1-.09.718.79.79 0 0 1-.675.328.809.809 0 0 1-.484-.146.89.89 0 0 1-.305-.389l-.713-1.946H6.324Zm.535-1.41h3.056L8.438 8.8h-.102l-1.477 4.04ZM16.256 17c-.832 0-1.485-.207-1.96-.62-.476-.414-.714-.978-.714-1.691 0-.682.276-1.237.828-1.667.552-.43 1.26-.645 2.126-.645.39 0 .752.028 1.083.085.33.057.615.15.853.28v-.34c0-.438-.157-.787-.471-1.047-.314-.26-.743-.39-1.286-.39a2.377 2.377 0 0 0-1.35.415.981.981 0 0 1-.51.194.723.723 0 0 1-.509-.146.636.636 0 0 1-.267-.426.494.494 0 0 1 .165-.45 3.474 3.474 0 0 1 1.095-.632 4.141 4.141 0 0 1 1.401-.22c1.053 0 1.86.24 2.42.719.56.478.84 1.171.84 2.08v3.698c0 .195-.072.361-.216.499a.729.729 0 0 1-.523.207.75.75 0 0 1-.534-.22.686.686 0 0 1-.23-.51v-.22h-.076c-.22.325-.518.58-.891.767-.374.187-.798.28-1.274.28Zm.255-1.216c.543 0 1.006-.183 1.388-.548.382-.365.573-.807.573-1.326a2.985 2.985 0 0 0-.815-.292 4.071 4.071 0 0 0-.84-.097c-.544 0-.96.101-1.248.304-.289.203-.433.49-.433.864 0 .324.127.588.382.79.254.203.585.305.993.305Z"}),m.createElement("rect",{width:1,height:15.9,x:15.442,y:5,fill:"#6E6E70",rx:.5,transform:"rotate(32.071 15.442 5)"})),MJe=x(_l)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),width:"250px"},"&.MuiPopover-root":{pointerEvents:"none"},"& .MuiPopover-paper":{pointerEvents:"all"}})),DJe=x(xn)(({theme:e})=>({flexGrow:1})),LJe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start",width:"100%"})),FJe=x("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.caption.fontSize})),NJe=x(Ue)(({theme:e})=>({minWidth:e.spacing(4)})),NZ=({initialValue:e,onAdd:t,anchorEl:n,open:r,onClose:o,helpText:i,inputProps:a})=>{const[l,c]=m.useState(e||""),[u,d]=m.useState(""),p=m.useRef(null),f=m.useId(),h=m.useId();return s.jsx(MJe,{open:r,onTransitionEnter:()=>{var g;(g=p==null?void 0:p.current)==null||g.select()},disableScrollLock:!0,anchorEl:n,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:s.jsx(tm,{onClickAway:o,children:s.jsxs("form",{onSubmit:g=>{if(g.stopPropagation(),g.preventDefault(),l!=null&&l.trim())t(l,{setError:d,clearInput:()=>c("")});else{d("Value cannot be empty or whitespace");return}},children:[s.jsxs(LJe,{children:[s.jsx(Bc,{children:s.jsx("label",{htmlFor:f,children:"Constraint Value"})}),s.jsx(DJe,{id:f,placeholder:"Enter value",value:l,onChange:g=>{c(g.target.value),d("")},size:"small",variant:"standard",fullWidth:!0,inputRef:p,autoFocus:!0,error:!!u,helperText:u,"aria-describedby":h,inputProps:{...a},"data-testid":"CONSTRAINT_VALUES_INPUT"}),s.jsx(NJe,{variant:"text",type:"submit",size:"small",color:"primary",disabled:!(l!=null&&l.trim()),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add"})]}),s.jsx(FJe,{id:h,children:i})]})})})},BJe=x("button")(({theme:e})=>({...DZ(e),color:e.palette.primary.main,svg:{fill:e.palette.primary.main,height:e.fontSizes.smallerBody,width:e.fontSizes.smallerBody},border:"none",borderRadius:e.shape.borderRadiusExtraLarge,display:"flex",flexFlow:"row nowrap",whiteSpace:"nowrap",gap:e.spacing(.25),alignItems:"center",padding:e.spacing(.5,1.5,.5,1.5),height:"auto",cursor:"pointer"})),zJe=m.forwardRef(({onAddValues:e,helpText:t,validator:n},r)=>{const[o,i]=m.useState(!1),a=m.useRef(null);m.useImperativeHandle(r,()=>a.current);const l=(c,{setError:u,clearInput:d})=>{const p=l0(c);if(p.length===0){u("Values cannot be empty");return}if(p.some(g=>g.length>100)){u("Values cannot be longer than 100 characters");return}const[f,h]=n(...p);f?(e(p),d(),u("")):u(h)};return s.jsxs(s.Fragment,{children:[s.jsxs(BJe,{ref:a,onClick:()=>i(!0),type:"button","data-testid":"CONSTRAINT_ADD_VALUES_BUTTON",children:[s.jsx(Oo,{}),s.jsx("span",{children:"Add values"})]}),s.jsx(NZ,{onAdd:l,helpText:t,open:o,anchorEl:a.current,onClose:()=>i(!1)})]})}),HJe=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},m.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"})),WJe=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},m.createElement("path",{fill:"#9F9FA1",d:"M9.29 11.887V10.48h4.581v1.407H9.29Zm0 2.343v-1.406h4.581v1.406H9.29Z"}),m.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)"})),VJe=x(LZ,{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}})),cF=m.forwardRef(({currentValue:e,onAddValue:t,removeValue:n,helpText:r,inputType:o,validator:i},a)=>{const[l,c]=m.useState(!1),u=m.useRef(null);m.useImperativeHandle(a,()=>u.current);const d=(p,{setError:f})=>{if(p.length>100){f("Values cannot be longer than 100 characters");return}const[h,g]=i(p);if(h)t(p),f(""),c(!1);else{f(g);return}};return s.jsxs(s.Fragment,{children:[s.jsx(VJe,{hasValue:!!e,ref:u,label:e||"Add value",onClick:()=>c(!0),icon:e?void 0:s.jsx(Oo,{}),onDelete:e?n:void 0}),s.jsx(NZ,{inputProps:{inputMode:o==="number"?"decimal":"text"},initialValue:e,onAdd:d,helpText:r,open:l,anchorEl:u.current,onClose:()=>c(!1)})]})});function BZ(e,t,n){return(t=GJe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function WT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uF(Object(n),!0).forEach(function(r){BZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uF(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function UJe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function GJe(e){var t=UJe(e,"string");return typeof t=="symbol"?t:t+""}var qJe={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestine",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Türkiye",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands (UK)",VI:"Virgin Islands (US)",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},YJe={"Africa/Abidjan":{u:0,c:["CI","BF","GH","GM","GN","IS","ML","MR","SH","SL","SN","TG"]},"Africa/Accra":{a:"Africa/Abidjan",c:["GH"],r:1},"Africa/Addis_Ababa":{a:"Africa/Nairobi",c:["ET"],r:1},"Africa/Algiers":{u:60,c:["DZ"]},"Africa/Asmara":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Asmera":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Bamako":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Bangui":{a:"Africa/Lagos",c:["CF"],r:1},"Africa/Banjul":{a:"Africa/Abidjan",c:["GM"],r:1},"Africa/Bissau":{u:0,c:["GW"]},"Africa/Blantyre":{a:"Africa/Maputo",c:["MW"],r:1},"Africa/Brazzaville":{a:"Africa/Lagos",c:["CG"],r:1},"Africa/Bujumbura":{a:"Africa/Maputo",c:["BI"],r:1},"Africa/Cairo":{u:120,d:180,c:["EG"]},"Africa/Casablanca":{u:60,d:0,c:["MA"]},"Africa/Ceuta":{u:60,d:120,c:["ES"]},"Africa/Conakry":{a:"Africa/Abidjan",c:["GN"],r:1},"Africa/Dakar":{a:"Africa/Abidjan",c:["SN"],r:1},"Africa/Dar_es_Salaam":{a:"Africa/Nairobi",c:["TZ"],r:1},"Africa/Djibouti":{a:"Africa/Nairobi",c:["DJ"],r:1},"Africa/Douala":{a:"Africa/Lagos",c:["CM"],r:1},"Africa/El_Aaiun":{u:60,d:0,c:["EH"]},"Africa/Freetown":{a:"Africa/Abidjan",c:["SL"],r:1},"Africa/Gaborone":{a:"Africa/Maputo",c:["BW"],r:1},"Africa/Harare":{a:"Africa/Maputo",c:["ZW"],r:1},"Africa/Johannesburg":{u:120,c:["ZA","LS","SZ"]},"Africa/Juba":{u:120,c:["SS"]},"Africa/Kampala":{a:"Africa/Nairobi",c:["UG"],r:1},"Africa/Khartoum":{u:120,c:["SD"]},"Africa/Kigali":{a:"Africa/Maputo",c:["RW"],r:1},"Africa/Kinshasa":{a:"Africa/Lagos",c:["CD"],r:1},"Africa/Lagos":{u:60,c:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"Africa/Libreville":{a:"Africa/Lagos",c:["GA"],r:1},"Africa/Lome":{a:"Africa/Abidjan",c:["TG"],r:1},"Africa/Luanda":{a:"Africa/Lagos",c:["AO"],r:1},"Africa/Lubumbashi":{a:"Africa/Maputo",c:["CD"],r:1},"Africa/Lusaka":{a:"Africa/Maputo",c:["ZM"],r:1},"Africa/Malabo":{a:"Africa/Lagos",c:["GQ"],r:1},"Africa/Maputo":{u:120,c:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Maseru":{a:"Africa/Johannesburg",c:["LS"],r:1},"Africa/Mbabane":{a:"Africa/Johannesburg",c:["SZ"],r:1},"Africa/Mogadishu":{a:"Africa/Nairobi",c:["SO"],r:1},"Africa/Monrovia":{u:0,c:["LR"]},"Africa/Nairobi":{u:180,c:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Africa/Ndjamena":{u:60,c:["TD"]},"Africa/Niamey":{a:"Africa/Lagos",c:["NE"],r:1},"Africa/Nouakchott":{a:"Africa/Abidjan",c:["MR"],r:1},"Africa/Ouagadougou":{a:"Africa/Abidjan",c:["BF"],r:1},"Africa/Porto-Novo":{a:"Africa/Lagos",c:["BJ"],r:1},"Africa/Sao_Tome":{u:0,c:["ST"]},"Africa/Timbuktu":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Tripoli":{u:120,c:["LY"]},"Africa/Tunis":{u:60,c:["TN"]},"Africa/Windhoek":{u:120,c:["NA"]},"America/Adak":{u:-600,d:-540,c:["US"]},"America/Anchorage":{u:-540,d:-480,c:["US"]},"America/Anguilla":{a:"America/Puerto_Rico",c:["AI"],r:1},"America/Antigua":{a:"America/Puerto_Rico",c:["AG"],r:1},"America/Araguaina":{u:-180,c:["BR"]},"America/Argentina/Buenos_Aires":{u:-180,c:["AR"]},"America/Argentina/Catamarca":{u:-180,c:["AR"]},"America/Argentina/ComodRivadavia":{a:"America/Argentina/Catamarca",r:1},"America/Argentina/Cordoba":{u:-180,c:["AR"]},"America/Argentina/Jujuy":{u:-180,c:["AR"]},"America/Argentina/La_Rioja":{u:-180,c:["AR"]},"America/Argentina/Mendoza":{u:-180,c:["AR"]},"America/Argentina/Rio_Gallegos":{u:-180,c:["AR"]},"America/Argentina/Salta":{u:-180,c:["AR"]},"America/Argentina/San_Juan":{u:-180,c:["AR"]},"America/Argentina/San_Luis":{u:-180,c:["AR"]},"America/Argentina/Tucuman":{u:-180,c:["AR"]},"America/Argentina/Ushuaia":{u:-180,c:["AR"]},"America/Aruba":{a:"America/Puerto_Rico",c:["AW"],r:1},"America/Asuncion":{u:-240,d:-180,c:["PY"]},"America/Atikokan":{a:"America/Panama",c:["CA"],r:1},"America/Atka":{a:"America/Adak",r:1},"America/Bahia":{u:-180,c:["BR"]},"America/Bahia_Banderas":{u:-360,c:["MX"]},"America/Barbados":{u:-240,c:["BB"]},"America/Belem":{u:-180,c:["BR"]},"America/Belize":{u:-360,c:["BZ"]},"America/Blanc-Sablon":{a:"America/Puerto_Rico",c:["CA"],r:1},"America/Boa_Vista":{u:-240,c:["BR"]},"America/Bogota":{u:-300,c:["CO"]},"America/Boise":{u:-420,d:-360,c:["US"]},"America/Buenos_Aires":{a:"America/Argentina/Buenos_Aires",r:1},"America/Cambridge_Bay":{u:-420,d:-360,c:["CA"]},"America/Campo_Grande":{u:-240,c:["BR"]},"America/Cancun":{u:-300,c:["MX"]},"America/Caracas":{u:-240,c:["VE"]},"America/Catamarca":{a:"America/Argentina/Catamarca",r:1},"America/Cayenne":{u:-180,c:["GF"]},"America/Cayman":{a:"America/Panama",c:["KY"],r:1},"America/Chicago":{u:-360,d:-300,c:["US"]},"America/Chihuahua":{u:-360,c:["MX"]},"America/Ciudad_Juarez":{u:-420,d:-360,c:["MX"]},"America/Coral_Harbour":{a:"America/Panama",c:["CA"],r:1},"America/Cordoba":{a:"America/Argentina/Cordoba",r:1},"America/Costa_Rica":{u:-360,c:["CR"]},"America/Creston":{a:"America/Phoenix",c:["CA"],r:1},"America/Cuiaba":{u:-240,c:["BR"]},"America/Curacao":{a:"America/Puerto_Rico",c:["CW"],r:1},"America/Danmarkshavn":{u:0,c:["GL"]},"America/Dawson":{u:-420,c:["CA"]},"America/Dawson_Creek":{u:-420,c:["CA"]},"America/Denver":{u:-420,d:-360,c:["US"]},"America/Detroit":{u:-300,d:-240,c:["US"]},"America/Dominica":{a:"America/Puerto_Rico",c:["DM"],r:1},"America/Edmonton":{u:-420,d:-360,c:["CA"]},"America/Eirunepe":{u:-300,c:["BR"]},"America/El_Salvador":{u:-360,c:["SV"]},"America/Ensenada":{a:"America/Tijuana",r:1},"America/Fort_Nelson":{u:-420,c:["CA"]},"America/Fort_Wayne":{a:"America/Indiana/Indianapolis",r:1},"America/Fortaleza":{u:-180,c:["BR"]},"America/Glace_Bay":{u:-240,d:-180,c:["CA"]},"America/Godthab":{a:"America/Nuuk",r:1},"America/Goose_Bay":{u:-240,d:-180,c:["CA"]},"America/Grand_Turk":{u:-300,d:-240,c:["TC"]},"America/Grenada":{a:"America/Puerto_Rico",c:["GD"],r:1},"America/Guadeloupe":{a:"America/Puerto_Rico",c:["GP"],r:1},"America/Guatemala":{u:-360,c:["GT"]},"America/Guayaquil":{u:-300,c:["EC"]},"America/Guyana":{u:-240,c:["GY"]},"America/Halifax":{u:-240,d:-180,c:["CA"]},"America/Havana":{u:-300,d:-240,c:["CU"]},"America/Hermosillo":{u:-420,c:["MX"]},"America/Indiana/Indianapolis":{u:-300,d:-240,c:["US"]},"America/Indiana/Knox":{u:-360,d:-300,c:["US"]},"America/Indiana/Marengo":{u:-300,d:-240,c:["US"]},"America/Indiana/Petersburg":{u:-300,d:-240,c:["US"]},"America/Indiana/Tell_City":{u:-360,d:-300,c:["US"]},"America/Indiana/Vevay":{u:-300,d:-240,c:["US"]},"America/Indiana/Vincennes":{u:-300,d:-240,c:["US"]},"America/Indiana/Winamac":{u:-300,d:-240,c:["US"]},"America/Indianapolis":{a:"America/Indiana/Indianapolis",r:1},"America/Inuvik":{u:-420,d:-360,c:["CA"]},"America/Iqaluit":{u:-300,d:-240,c:["CA"]},"America/Jamaica":{u:-300,c:["JM"]},"America/Jujuy":{a:"America/Argentina/Jujuy",r:1},"America/Juneau":{u:-540,d:-480,c:["US"]},"America/Kentucky/Louisville":{u:-300,d:-240,c:["US"]},"America/Kentucky/Monticello":{u:-300,d:-240,c:["US"]},"America/Knox_IN":{a:"America/Indiana/Knox",r:1},"America/Kralendijk":{a:"America/Puerto_Rico",c:["BQ"],r:1},"America/La_Paz":{u:-240,c:["BO"]},"America/Lima":{u:-300,c:["PE"]},"America/Los_Angeles":{u:-480,d:-420,c:["US"]},"America/Louisville":{a:"America/Kentucky/Louisville",r:1},"America/Lower_Princes":{a:"America/Puerto_Rico",c:["SX"],r:1},"America/Maceio":{u:-180,c:["BR"]},"America/Managua":{u:-360,c:["NI"]},"America/Manaus":{u:-240,c:["BR"]},"America/Marigot":{a:"America/Puerto_Rico",c:["MF"],r:1},"America/Martinique":{u:-240,c:["MQ"]},"America/Matamoros":{u:-360,d:-300,c:["MX"]},"America/Mazatlan":{u:-420,c:["MX"]},"America/Mendoza":{a:"America/Argentina/Mendoza",r:1},"America/Menominee":{u:-360,d:-300,c:["US"]},"America/Merida":{u:-360,c:["MX"]},"America/Metlakatla":{u:-540,d:-480,c:["US"]},"America/Mexico_City":{u:-360,c:["MX"]},"America/Miquelon":{u:-180,d:-120,c:["PM"]},"America/Moncton":{u:-240,d:-180,c:["CA"]},"America/Monterrey":{u:-360,c:["MX"]},"America/Montevideo":{u:-180,c:["UY"]},"America/Montreal":{a:"America/Toronto",c:["CA"],r:1},"America/Montserrat":{a:"America/Puerto_Rico",c:["MS"],r:1},"America/Nassau":{a:"America/Toronto",c:["BS"],r:1},"America/New_York":{u:-300,d:-240,c:["US"]},"America/Nipigon":{a:"America/Toronto",c:["CA"],r:1},"America/Nome":{u:-540,d:-480,c:["US"]},"America/Noronha":{u:-120,c:["BR"]},"America/North_Dakota/Beulah":{u:-360,d:-300,c:["US"]},"America/North_Dakota/Center":{u:-360,d:-300,c:["US"]},"America/North_Dakota/New_Salem":{u:-360,d:-300,c:["US"]},"America/Nuuk":{u:-120,d:-60,c:["GL"]},"America/Ojinaga":{u:-360,d:-300,c:["MX"]},"America/Panama":{u:-300,c:["PA","CA","KY"]},"America/Pangnirtung":{a:"America/Iqaluit",r:1},"America/Paramaribo":{u:-180,c:["SR"]},"America/Phoenix":{u:-420,c:["US","CA"]},"America/Port-au-Prince":{u:-300,d:-240,c:["HT"]},"America/Port_of_Spain":{a:"America/Puerto_Rico",c:["TT"],r:1},"America/Porto_Acre":{a:"America/Rio_Branco",r:1},"America/Porto_Velho":{u:-240,c:["BR"]},"America/Puerto_Rico":{u:-240,c:["PR","AG","CA","AI","AW","BL","BQ","CW","DM","GD","GP","KN","LC","MF","MS","SX","TT","VC","VG","VI"]},"America/Punta_Arenas":{u:-180,c:["CL"]},"America/Rainy_River":{a:"America/Winnipeg",r:1},"America/Rankin_Inlet":{u:-360,d:-300,c:["CA"]},"America/Recife":{u:-180,c:["BR"]},"America/Regina":{u:-360,c:["CA"]},"America/Resolute":{u:-360,d:-300,c:["CA"]},"America/Rio_Branco":{u:-300,c:["BR"]},"America/Rosario":{a:"America/Argentina/Cordoba",r:1},"America/Santa_Isabel":{a:"America/Tijuana",r:1},"America/Santarem":{u:-180,c:["BR"]},"America/Santiago":{u:-240,d:-180,c:["CL"]},"America/Santo_Domingo":{u:-240,c:["DO"]},"America/Sao_Paulo":{u:-180,c:["BR"]},"America/Scoresbysund":{u:-120,d:-60,c:["GL"]},"America/Shiprock":{a:"America/Denver",r:1},"America/Sitka":{u:-540,d:-480,c:["US"]},"America/St_Barthelemy":{a:"America/Puerto_Rico",c:["BL"],r:1},"America/St_Johns":{u:-210,d:-150,c:["CA"]},"America/St_Kitts":{a:"America/Puerto_Rico",c:["KN"],r:1},"America/St_Lucia":{a:"America/Puerto_Rico",c:["LC"],r:1},"America/St_Thomas":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/St_Vincent":{a:"America/Puerto_Rico",c:["VC"],r:1},"America/Swift_Current":{u:-360,c:["CA"]},"America/Tegucigalpa":{u:-360,c:["HN"]},"America/Thule":{u:-240,d:-180,c:["GL"]},"America/Thunder_Bay":{a:"America/Toronto",c:["CA"],r:1},"America/Tijuana":{u:-480,d:-420,c:["MX"]},"America/Toronto":{u:-300,d:-240,c:["CA","BS"]},"America/Tortola":{a:"America/Puerto_Rico",c:["VG"],r:1},"America/Vancouver":{u:-480,d:-420,c:["CA"]},"America/Virgin":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/Whitehorse":{u:-420,c:["CA"]},"America/Winnipeg":{u:-360,d:-300,c:["CA"]},"America/Yakutat":{u:-540,d:-480,c:["US"]},"America/Yellowknife":{a:"America/Edmonton",r:1},"Antarctica/Casey":{u:480,c:["AQ"]},"Antarctica/Davis":{u:420,c:["AQ"]},"Antarctica/DumontDUrville":{a:"Pacific/Port_Moresby",c:["AQ"],r:1},"Antarctica/Macquarie":{u:600,d:660,c:["AU"]},"Antarctica/Mawson":{u:300,c:["AQ"]},"Antarctica/McMurdo":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Palmer":{u:-180,c:["AQ"]},"Antarctica/Rothera":{u:-180,c:["AQ"]},"Antarctica/South_Pole":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Syowa":{a:"Asia/Riyadh",c:["AQ"],r:1},"Antarctica/Troll":{u:0,d:120,c:["AQ"]},"Antarctica/Vostok":{u:300,c:["AQ"]},"Arctic/Longyearbyen":{a:"Europe/Berlin",c:["SJ"],r:1},"Asia/Aden":{a:"Asia/Riyadh",c:["YE"],r:1},"Asia/Almaty":{u:300,c:["KZ"]},"Asia/Amman":{u:180,c:["JO"]},"Asia/Anadyr":{u:720,c:["RU"]},"Asia/Aqtau":{u:300,c:["KZ"]},"Asia/Aqtobe":{u:300,c:["KZ"]},"Asia/Ashgabat":{u:300,c:["TM"]},"Asia/Ashkhabad":{a:"Asia/Ashgabat",r:1},"Asia/Atyrau":{u:300,c:["KZ"]},"Asia/Baghdad":{u:180,c:["IQ"]},"Asia/Bahrain":{a:"Asia/Qatar",c:["BH"],r:1},"Asia/Baku":{u:240,c:["AZ"]},"Asia/Bangkok":{u:420,c:["TH","CX","KH","LA","VN"]},"Asia/Barnaul":{u:420,c:["RU"]},"Asia/Beirut":{u:120,d:180,c:["LB"]},"Asia/Bishkek":{u:360,c:["KG"]},"Asia/Brunei":{a:"Asia/Kuching",c:["BN"],r:1},"Asia/Calcutta":{a:"Asia/Kolkata",r:1},"Asia/Chita":{u:540,c:["RU"]},"Asia/Choibalsan":{a:"Asia/Ulaanbaatar",r:1},"Asia/Chongqing":{a:"Asia/Shanghai",r:1},"Asia/Chungking":{a:"Asia/Shanghai",r:1},"Asia/Colombo":{u:330,c:["LK"]},"Asia/Dacca":{a:"Asia/Dhaka",r:1},"Asia/Damascus":{u:180,c:["SY"]},"Asia/Dhaka":{u:360,c:["BD"]},"Asia/Dili":{u:540,c:["TL"]},"Asia/Dubai":{u:240,c:["AE","OM","RE","SC","TF"]},"Asia/Dushanbe":{u:300,c:["TJ"]},"Asia/Famagusta":{u:120,d:180,c:["CY"]},"Asia/Gaza":{u:120,d:180,c:["PS"]},"Asia/Harbin":{a:"Asia/Shanghai",r:1},"Asia/Hebron":{u:120,d:180,c:["PS"]},"Asia/Ho_Chi_Minh":{u:420,c:["VN"]},"Asia/Hong_Kong":{u:480,c:["HK"]},"Asia/Hovd":{u:420,c:["MN"]},"Asia/Irkutsk":{u:480,c:["RU"]},"Asia/Istanbul":{a:"Europe/Istanbul",r:1},"Asia/Jakarta":{u:420,c:["ID"]},"Asia/Jayapura":{u:540,c:["ID"]},"Asia/Jerusalem":{u:120,d:180,c:["IL"]},"Asia/Kabul":{u:270,c:["AF"]},"Asia/Kamchatka":{u:720,c:["RU"]},"Asia/Karachi":{u:300,c:["PK"]},"Asia/Kashgar":{a:"Asia/Urumqi",r:1},"Asia/Kathmandu":{u:345,c:["NP"]},"Asia/Katmandu":{a:"Asia/Kathmandu",r:1},"Asia/Khandyga":{u:540,c:["RU"]},"Asia/Kolkata":{u:330,c:["IN"]},"Asia/Krasnoyarsk":{u:420,c:["RU"]},"Asia/Kuala_Lumpur":{a:"Asia/Singapore",c:["MY"],r:1},"Asia/Kuching":{u:480,c:["MY","BN"]},"Asia/Kuwait":{a:"Asia/Riyadh",c:["KW"],r:1},"Asia/Macao":{a:"Asia/Macau",r:1},"Asia/Macau":{u:480,c:["MO"]},"Asia/Magadan":{u:660,c:["RU"]},"Asia/Makassar":{u:480,c:["ID"]},"Asia/Manila":{u:480,c:["PH"]},"Asia/Muscat":{a:"Asia/Dubai",c:["OM"],r:1},"Asia/Nicosia":{u:120,d:180,c:["CY"]},"Asia/Novokuznetsk":{u:420,c:["RU"]},"Asia/Novosibirsk":{u:420,c:["RU"]},"Asia/Omsk":{u:360,c:["RU"]},"Asia/Oral":{u:300,c:["KZ"]},"Asia/Phnom_Penh":{a:"Asia/Bangkok",c:["KH"],r:1},"Asia/Pontianak":{u:420,c:["ID"]},"Asia/Pyongyang":{u:540,c:["KP"]},"Asia/Qatar":{u:180,c:["QA","BH"]},"Asia/Qostanay":{u:300,c:["KZ"]},"Asia/Qyzylorda":{u:300,c:["KZ"]},"Asia/Rangoon":{a:"Asia/Yangon",c:["MM"],r:1},"Asia/Riyadh":{u:180,c:["SA","AQ","KW","YE"]},"Asia/Saigon":{a:"Asia/Ho_Chi_Minh",r:1},"Asia/Sakhalin":{u:660,c:["RU"]},"Asia/Samarkand":{u:300,c:["UZ"]},"Asia/Seoul":{u:540,c:["KR"]},"Asia/Shanghai":{u:480,c:["CN"]},"Asia/Singapore":{u:480,c:["SG","MY"]},"Asia/Srednekolymsk":{u:660,c:["RU"]},"Asia/Taipei":{u:480,c:["TW"]},"Asia/Tashkent":{u:300,c:["UZ"]},"Asia/Tbilisi":{u:240,c:["GE"]},"Asia/Tehran":{u:210,c:["IR"]},"Asia/Tel_Aviv":{a:"Asia/Jerusalem",r:1},"Asia/Thimbu":{a:"Asia/Thimphu",r:1},"Asia/Thimphu":{u:360,c:["BT"]},"Asia/Tokyo":{u:540,c:["JP"]},"Asia/Tomsk":{u:420,c:["RU"]},"Asia/Ujung_Pandang":{a:"Asia/Makassar",r:1},"Asia/Ulaanbaatar":{u:480,c:["MN"]},"Asia/Ulan_Bator":{a:"Asia/Ulaanbaatar",r:1},"Asia/Urumqi":{u:360,c:["CN"]},"Asia/Ust-Nera":{u:600,c:["RU"]},"Asia/Vientiane":{a:"Asia/Bangkok",c:["LA"],r:1},"Asia/Vladivostok":{u:600,c:["RU"]},"Asia/Yakutsk":{u:540,c:["RU"]},"Asia/Yangon":{u:390,c:["MM","CC"]},"Asia/Yekaterinburg":{u:300,c:["RU"]},"Asia/Yerevan":{u:240,c:["AM"]},"Atlantic/Azores":{u:-60,d:0,c:["PT"]},"Atlantic/Bermuda":{u:-240,d:-180,c:["BM"]},"Atlantic/Canary":{u:0,d:60,c:["ES"]},"Atlantic/Cape_Verde":{u:-60,c:["CV"]},"Atlantic/Faeroe":{a:"Atlantic/Faroe",r:1},"Atlantic/Faroe":{u:0,d:60,c:["FO"]},"Atlantic/Jan_Mayen":{a:"Europe/Berlin",c:["SJ"],r:1},"Atlantic/Madeira":{u:0,d:60,c:["PT"]},"Atlantic/Reykjavik":{a:"Africa/Abidjan",c:["IS"],r:1},"Atlantic/South_Georgia":{u:-120,c:["GS"]},"Atlantic/St_Helena":{a:"Africa/Abidjan",c:["SH"],r:1},"Atlantic/Stanley":{u:-180,c:["FK"]},"Australia/ACT":{a:"Australia/Sydney",r:1},"Australia/Adelaide":{u:570,d:630,c:["AU"]},"Australia/Brisbane":{u:600,c:["AU"]},"Australia/Broken_Hill":{u:570,d:630,c:["AU"]},"Australia/Canberra":{a:"Australia/Sydney",r:1},"Australia/Currie":{a:"Australia/Hobart",r:1},"Australia/Darwin":{u:570,c:["AU"]},"Australia/Eucla":{u:525,c:["AU"]},"Australia/Hobart":{u:600,d:660,c:["AU"]},"Australia/LHI":{a:"Australia/Lord_Howe",r:1},"Australia/Lindeman":{u:600,c:["AU"]},"Australia/Lord_Howe":{u:630,d:660,c:["AU"]},"Australia/Melbourne":{u:600,d:660,c:["AU"]},"Australia/NSW":{a:"Australia/Sydney",r:1},"Australia/North":{a:"Australia/Darwin",r:1},"Australia/Perth":{u:480,c:["AU"]},"Australia/Queensland":{a:"Australia/Brisbane",r:1},"Australia/South":{a:"Australia/Adelaide",r:1},"Australia/Sydney":{u:600,d:660,c:["AU"]},"Australia/Tasmania":{a:"Australia/Hobart",r:1},"Australia/Victoria":{a:"Australia/Melbourne",r:1},"Australia/West":{a:"Australia/Perth",r:1},"Australia/Yancowinna":{a:"Australia/Broken_Hill",r:1},"Brazil/Acre":{a:"America/Rio_Branco",r:1},"Brazil/DeNoronha":{a:"America/Noronha",r:1},"Brazil/East":{a:"America/Sao_Paulo",r:1},"Brazil/West":{a:"America/Manaus",r:1},CET:{a:"Europe/Brussels",r:1},CST6CDT:{a:"America/Chicago",r:1},"Canada/Atlantic":{a:"America/Halifax",r:1},"Canada/Central":{a:"America/Winnipeg",r:1},"Canada/Eastern":{a:"America/Toronto",c:["CA"],r:1},"Canada/Mountain":{a:"America/Edmonton",r:1},"Canada/Newfoundland":{a:"America/St_Johns",r:1},"Canada/Pacific":{a:"America/Vancouver",r:1},"Canada/Saskatchewan":{a:"America/Regina",r:1},"Canada/Yukon":{a:"America/Whitehorse",r:1},"Chile/Continental":{a:"America/Santiago",r:1},"Chile/EasterIsland":{a:"Pacific/Easter",r:1},Cuba:{a:"America/Havana",r:1},EET:{a:"Europe/Athens",r:1},EST:{a:"America/Panama",r:1},EST5EDT:{a:"America/New_York",r:1},Egypt:{a:"Africa/Cairo",r:1},Eire:{a:"Europe/Dublin",r:1},"Etc/GMT":{u:0},"Etc/GMT+0":{a:"Etc/GMT",r:1},"Etc/GMT+1":{u:-60},"Etc/GMT+10":{u:-600},"Etc/GMT+11":{u:-660},"Etc/GMT+12":{u:-720},"Etc/GMT+2":{u:-120},"Etc/GMT+3":{u:-180},"Etc/GMT+4":{u:-240},"Etc/GMT+5":{u:-300},"Etc/GMT+6":{u:-360},"Etc/GMT+7":{u:-420},"Etc/GMT+8":{u:-480},"Etc/GMT+9":{u:-540},"Etc/GMT-0":{a:"Etc/GMT",r:1},"Etc/GMT-1":{u:60},"Etc/GMT-10":{u:600},"Etc/GMT-11":{u:660},"Etc/GMT-12":{u:720},"Etc/GMT-13":{u:780},"Etc/GMT-14":{u:840},"Etc/GMT-2":{u:120},"Etc/GMT-3":{u:180},"Etc/GMT-4":{u:240},"Etc/GMT-5":{u:300},"Etc/GMT-6":{u:360},"Etc/GMT-7":{u:420},"Etc/GMT-8":{u:480},"Etc/GMT-9":{u:540},"Etc/GMT0":{a:"Etc/GMT",r:1},"Etc/Greenwich":{a:"Etc/GMT",r:1},"Etc/UCT":{a:"Etc/UTC",r:1},"Etc/UTC":{u:0},"Etc/Universal":{a:"Etc/UTC",r:1},"Etc/Zulu":{a:"Etc/UTC",r:1},"Europe/Amsterdam":{a:"Europe/Brussels",c:["NL"],r:1},"Europe/Andorra":{u:60,d:120,c:["AD"]},"Europe/Astrakhan":{u:240,c:["RU"]},"Europe/Athens":{u:120,d:180,c:["GR"]},"Europe/Belfast":{a:"Europe/London",c:["GB"],r:1},"Europe/Belgrade":{u:60,d:120,c:["RS","BA","HR","ME","MK","SI"]},"Europe/Berlin":{u:60,d:120,c:["DE","DK","NO","SE","SJ"]},"Europe/Bratislava":{a:"Europe/Prague",c:["SK"],r:1},"Europe/Brussels":{u:60,d:120,c:["BE","LU","NL"]},"Europe/Bucharest":{u:120,d:180,c:["RO"]},"Europe/Budapest":{u:60,d:120,c:["HU"]},"Europe/Busingen":{a:"Europe/Zurich",c:["DE"],r:1},"Europe/Chisinau":{u:120,d:180,c:["MD"]},"Europe/Copenhagen":{a:"Europe/Berlin",c:["DK"],r:1},"Europe/Dublin":{u:0,d:60,c:["IE"]},"Europe/Gibraltar":{u:60,d:120,c:["GI"]},"Europe/Guernsey":{a:"Europe/London",c:["GG"],r:1},"Europe/Helsinki":{u:120,d:180,c:["FI","AX"]},"Europe/Isle_of_Man":{a:"Europe/London",c:["IM"],r:1},"Europe/Istanbul":{u:180,c:["TR"]},"Europe/Jersey":{a:"Europe/London",c:["JE"],r:1},"Europe/Kaliningrad":{u:120,c:["RU"]},"Europe/Kiev":{a:"Europe/Kyiv",r:1},"Europe/Kirov":{u:180,c:["RU"]},"Europe/Kyiv":{u:120,d:180,c:["UA"]},"Europe/Lisbon":{u:0,d:60,c:["PT"]},"Europe/Ljubljana":{a:"Europe/Belgrade",c:["SI"],r:1},"Europe/London":{u:0,d:60,c:["GB","GG","IM","JE"]},"Europe/Luxembourg":{a:"Europe/Brussels",c:["LU"],r:1},"Europe/Madrid":{u:60,d:120,c:["ES"]},"Europe/Malta":{u:60,d:120,c:["MT"]},"Europe/Mariehamn":{a:"Europe/Helsinki",c:["AX"],r:1},"Europe/Minsk":{u:180,c:["BY"]},"Europe/Monaco":{a:"Europe/Paris",c:["MC"],r:1},"Europe/Moscow":{u:180,c:["RU"]},"Europe/Nicosia":{a:"Asia/Nicosia",r:1},"Europe/Oslo":{a:"Europe/Berlin",c:["NO"],r:1},"Europe/Paris":{u:60,d:120,c:["FR","MC"]},"Europe/Podgorica":{a:"Europe/Belgrade",c:["ME"],r:1},"Europe/Prague":{u:60,d:120,c:["CZ","SK"]},"Europe/Riga":{u:120,d:180,c:["LV"]},"Europe/Rome":{u:60,d:120,c:["IT","SM","VA"]},"Europe/Samara":{u:240,c:["RU"]},"Europe/San_Marino":{a:"Europe/Rome",c:["SM"],r:1},"Europe/Sarajevo":{a:"Europe/Belgrade",c:["BA"],r:1},"Europe/Saratov":{u:240,c:["RU"]},"Europe/Simferopol":{u:180,c:["RU","UA"]},"Europe/Skopje":{a:"Europe/Belgrade",c:["MK"],r:1},"Europe/Sofia":{u:120,d:180,c:["BG"]},"Europe/Stockholm":{a:"Europe/Berlin",c:["SE"],r:1},"Europe/Tallinn":{u:120,d:180,c:["EE"]},"Europe/Tirane":{u:60,d:120,c:["AL"]},"Europe/Tiraspol":{a:"Europe/Chisinau",r:1},"Europe/Ulyanovsk":{u:240,c:["RU"]},"Europe/Uzhgorod":{a:"Europe/Kyiv",r:1},"Europe/Vaduz":{a:"Europe/Zurich",c:["LI"],r:1},"Europe/Vatican":{a:"Europe/Rome",c:["VA"],r:1},"Europe/Vienna":{u:60,d:120,c:["AT"]},"Europe/Vilnius":{u:120,d:180,c:["LT"]},"Europe/Volgograd":{u:180,c:["RU"]},"Europe/Warsaw":{u:60,d:120,c:["PL"]},"Europe/Zagreb":{a:"Europe/Belgrade",c:["HR"],r:1},"Europe/Zaporozhye":{a:"Europe/Kyiv",r:1},"Europe/Zurich":{u:60,d:120,c:["CH","DE","LI"]},Factory:{u:0},GB:{a:"Europe/London",c:["GB"],r:1},"GB-Eire":{a:"Europe/London",c:["GB"],r:1},GMT:{a:"Etc/GMT",r:1},"GMT+0":{a:"Etc/GMT",r:1},"GMT-0":{a:"Etc/GMT",r:1},GMT0:{a:"Etc/GMT",r:1},Greenwich:{a:"Etc/GMT",r:1},HST:{a:"Pacific/Honolulu",r:1},Hongkong:{a:"Asia/Hong_Kong",r:1},Iceland:{a:"Africa/Abidjan",c:["IS"],r:1},"Indian/Antananarivo":{a:"Africa/Nairobi",c:["MG"],r:1},"Indian/Chagos":{u:360,c:["IO"]},"Indian/Christmas":{a:"Asia/Bangkok",c:["CX"],r:1},"Indian/Cocos":{a:"Asia/Yangon",c:["CC"],r:1},"Indian/Comoro":{a:"Africa/Nairobi",c:["KM"],r:1},"Indian/Kerguelen":{a:"Indian/Maldives",c:["TF"],r:1},"Indian/Mahe":{a:"Asia/Dubai",c:["SC"],r:1},"Indian/Maldives":{u:300,c:["MV","TF"]},"Indian/Mauritius":{u:240,c:["MU"]},"Indian/Mayotte":{a:"Africa/Nairobi",c:["YT"],r:1},"Indian/Reunion":{a:"Asia/Dubai",c:["RE"],r:1},Iran:{a:"Asia/Tehran",r:1},Israel:{a:"Asia/Jerusalem",r:1},Jamaica:{a:"America/Jamaica",r:1},Japan:{a:"Asia/Tokyo",r:1},Kwajalein:{a:"Pacific/Kwajalein",r:1},Libya:{a:"Africa/Tripoli",r:1},MET:{a:"Europe/Brussels",r:1},MST:{a:"America/Phoenix",r:1},MST7MDT:{a:"America/Denver",r:1},"Mexico/BajaNorte":{a:"America/Tijuana",r:1},"Mexico/BajaSur":{a:"America/Mazatlan",r:1},"Mexico/General":{a:"America/Mexico_City",r:1},NZ:{a:"Pacific/Auckland",c:["NZ"],r:1},"NZ-CHAT":{a:"Pacific/Chatham",r:1},Navajo:{a:"America/Denver",r:1},PRC:{a:"Asia/Shanghai",r:1},PST8PDT:{a:"America/Los_Angeles",r:1},"Pacific/Apia":{u:780,c:["WS"]},"Pacific/Auckland":{u:720,d:780,c:["NZ","AQ"]},"Pacific/Bougainville":{u:660,c:["PG"]},"Pacific/Chatham":{u:765,d:825,c:["NZ"]},"Pacific/Chuuk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Easter":{u:-360,d:-300,c:["CL"]},"Pacific/Efate":{u:660,c:["VU"]},"Pacific/Enderbury":{a:"Pacific/Kanton",r:1},"Pacific/Fakaofo":{u:780,c:["TK"]},"Pacific/Fiji":{u:720,c:["FJ"]},"Pacific/Funafuti":{a:"Pacific/Tarawa",c:["TV"],r:1},"Pacific/Galapagos":{u:-360,c:["EC"]},"Pacific/Gambier":{u:-540,c:["PF"]},"Pacific/Guadalcanal":{u:660,c:["SB","FM"]},"Pacific/Guam":{u:600,c:["GU","MP"]},"Pacific/Honolulu":{u:-600,c:["US"]},"Pacific/Johnston":{a:"Pacific/Honolulu",c:["UM"],r:1},"Pacific/Kanton":{u:780,c:["KI"]},"Pacific/Kiritimati":{u:840,c:["KI"]},"Pacific/Kosrae":{u:660,c:["FM"]},"Pacific/Kwajalein":{u:720,c:["MH"]},"Pacific/Majuro":{a:"Pacific/Tarawa",c:["MH"],r:1},"Pacific/Marquesas":{u:-570,c:["PF"]},"Pacific/Midway":{a:"Pacific/Pago_Pago",c:["UM"],r:1},"Pacific/Nauru":{u:720,c:["NR"]},"Pacific/Niue":{u:-660,c:["NU"]},"Pacific/Norfolk":{u:660,d:720,c:["NF"]},"Pacific/Noumea":{u:660,c:["NC"]},"Pacific/Pago_Pago":{u:-660,c:["AS","UM"]},"Pacific/Palau":{u:540,c:["PW"]},"Pacific/Pitcairn":{u:-480,c:["PN"]},"Pacific/Pohnpei":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Ponape":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Port_Moresby":{u:600,c:["PG","AQ","FM"]},"Pacific/Rarotonga":{u:-600,c:["CK"]},"Pacific/Saipan":{a:"Pacific/Guam",c:["MP"],r:1},"Pacific/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},"Pacific/Tahiti":{u:-600,c:["PF"]},"Pacific/Tarawa":{u:720,c:["KI","MH","TV","UM","WF"]},"Pacific/Tongatapu":{u:780,c:["TO"]},"Pacific/Truk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Wake":{a:"Pacific/Tarawa",c:["UM"],r:1},"Pacific/Wallis":{a:"Pacific/Tarawa",c:["WF"],r:1},"Pacific/Yap":{a:"Pacific/Port_Moresby",c:["FM"],r:1},Poland:{a:"Europe/Warsaw",r:1},Portugal:{a:"Europe/Lisbon",r:1},ROC:{a:"Asia/Taipei",r:1},ROK:{a:"Asia/Seoul",r:1},Singapore:{a:"Asia/Singapore",c:["SG"],r:1},Turkey:{a:"Europe/Istanbul",r:1},UCT:{a:"Etc/UTC",r:1},"US/Alaska":{a:"America/Anchorage",r:1},"US/Aleutian":{a:"America/Adak",r:1},"US/Arizona":{a:"America/Phoenix",c:["US"],r:1},"US/Central":{a:"America/Chicago",r:1},"US/East-Indiana":{a:"America/Indiana/Indianapolis",r:1},"US/Eastern":{a:"America/New_York",r:1},"US/Hawaii":{a:"Pacific/Honolulu",r:1},"US/Indiana-Starke":{a:"America/Indiana/Knox",r:1},"US/Michigan":{a:"America/Detroit",r:1},"US/Mountain":{a:"America/Denver",r:1},"US/Pacific":{a:"America/Los_Angeles",r:1},"US/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},UTC:{a:"Etc/UTC",r:1},Universal:{a:"Etc/UTC",r:1},"W-SU":{a:"Europe/Moscow",r:1},WET:{a:"Europe/Lisbon",r:1},Zulu:{a:"Etc/UTC",r:1}},wI={countries:qJe,timezones:YJe};function KJe(e,t){var n=e.timezones[t];if(!n)return null;var r=n.a,o=r===void 0?null:r,i=o?e.timezones[o]:{},a=WT(WT({},i),e.timezones[t]),l=a.c||[],c=a.u,u=Number.isInteger(a.d)?a.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:dF(c),dstOffset:u,dstOffsetStr:dF(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function dF(e){var t=Math.floor(Math.abs(e)/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(pF(t),":").concat(pF(n))}function pF(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var XJe=Object.keys(wI.timezones).length,u1={},zZ=0;function JJe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(XJe!==zZ)for(var t=0,n=Object.keys(wI.timezones);t<n.length;t++){var r=n[t];QJe(r)}return eQe(u1,e)}function QJe(e){return u1[e]||ZJe(KJe(wI,e)),u1[e]?WT({},u1[e]):null}function ZJe(e){e&&(u1[e.name]=e,zZ=Object.keys(e).length)}function eQe(e,t){var n=t||{},r=n.deprecated;return r===!0?e:Object.keys(e).reduce(function(o,i){return e[i].deprecated||Object.assign(o,BZ({},i,e[i])),o},{})}const tQe=x(vr)({border:"none","*":{border:"none",padding:0}}),nQe=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",alignItems:"center"})),rQe=({setValue:e,value:t,validator:n})=>{const[r,o]=m.useState(""),i=Object.values(JJe({deprecated:!1})).map(f=>({key:f.name,label:`${f.name}`,utcOffset:f.utcOffsetStr})),{timeZone:a}=Intl.DateTimeFormat().resolvedOptions(),[l,c]=m.useState(t||""),u=m.useId(),d=m.useId(),p=m.useMemo(()=>{const f=i.find(h=>h.key===a);return f!=null?`${f.key} (UTC ${f.utcOffset})`:"The time shown is in your local time zone according to your browser."},[i,a]);return t?s.jsxs(nQe,{children:[s.jsx("label",{htmlFor:u,children:s.jsx(Bc,{children:"Date"})}),s.jsx(tQe,{id:u,"aria-describedby":d,hiddenLabel:!0,label:"",size:"small",type:"datetime-local",value:j_e(l),onChange:f=>{o("");const h=tA(f.target.value),g=h==null?void 0:h.toISOString();if(!g)o("Invalid date format");else{c(g);const[v,b]=n(g);v?g&&e(g):o(b)}},InputLabelProps:{shrink:!0},error:!!r,errorText:r,required:!0}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx("p",{id:d,children:p})})]}):null},oQe=x("div")(({theme:e})=>({display:"inline-block",wordBreak:"break-word",padding:e.spacing(.5,1),background:e.palette.background.paper,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,transition:"all 0.1s ease-in-out","&:hover":{borderColor:e.palette.primary.main}})),iQe=x("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallBody,overflowX:"hidden",textOverflow:"ellipsis"})),sQe=x("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active})),aQe=({legal:e,control:t,filter:n,value:r})=>s.jsx(oQe,{children:s.jsx(qr,{value:r||e.value,control:t,sx:{width:"100%",overflowX:"hidden"},label:s.jsxs(s.Fragment,{children:[s.jsx(iQe,{children:s.jsx(yo,{title:e.value,arrow:!0,lines:1,children:s.jsx(Kr,{search:n,children:e.value})})}),s.jsx(sQe,{children:s.jsx(yo,{title:e.description,arrow:!0,lines:1,children:s.jsx(Kr,{search:n,children:e.description})})})]})})}),lQe=(e,t)=>e.filter(n=>{var r;return n.value.toLowerCase().includes(t.toLowerCase())||((r=n.description)==null?void 0:r.toLowerCase().includes(t.toLowerCase()))}),HZ=({filter:e,setFilter:t,onKeyDown:n})=>{const r=m.useId();return s.jsxs("div",{style:{display:"flex",alignItems:"center",minWidth:"120px"},children:[s.jsx(Bc,{children:s.jsx("label",{htmlFor:r,children:"Search"})}),s.jsx(xn,{id:r,name:"search",value:e,onChange:o=>t(o.target.value),placeholder:"Filter values",onKeyDown:n,sx:{width:"100%"},variant:"outlined",size:"small",InputProps:{startAdornment:s.jsx(fp,{position:"start",children:s.jsx(Zf,{})})}})]})},cQe=x("div")(({theme:e})=>({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:e.spacing(1),maxHeight:"378px",overflow:"auto"})),uQe=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",alignItems:"center",gap:e.spacing(1)})),dQe=x("article")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),WZ=({legalValues:e,onChange:t,deletedLegalValues:n,invalidLegalValues:r,isInputSelected:o,multiSelect:i})=>{const[a,l]=m.useState(""),c=m.useId(),u=m.useId(),d=m.useId(),p=m.useId(),f=lQe(e,a),h=i&&e.length===i.values.size+((n==null?void 0:n.size)??0),g=b=>{if(b.key==="Enter"&&(b.preventDefault(),f.length>0)){const y=f[0].value;t(y)}},v=i?pa:yl;return s.jsxs(dQe,{children:[n!=null&&n.size?s.jsxs(Lt,{id:p,severity:"warning",children:["This constraint is currently using values that were valid in the past but have since been deleted. If you save changes on this constraint and then save the strategy the following values will be removed:",s.jsx("ul",{children:[...n].map(b=>s.jsx("li",{children:b},b))})]}):null,s.jsxs("p",{children:[s.jsx("span",{id:c,children:"Select values from a predefined set"}),r!=null&&r.size?s.jsx("span",{id:u,children:"Values that are not valid for your chosen operator have been disabled."}):null]}),s.jsxs(uQe,{children:[s.jsx(HZ,{onKeyDown:g,filter:a,setFilter:l}),i?s.jsx(Ue,{sx:{whiteSpace:"nowrap"},variant:"text",onClick:()=>{if(h){i.clearAll();return}else i.selectAll()},children:h?"Unselect all":"Select all"}):null]}),s.jsx(cQe,{"aria-labelledby":c,"aria-describedby":u,"aria-details":p,role:i?void 0:"radiogroup",children:f.map(b=>s.jsx(pQe,{legal:b,filter:a,Control:v,onChange:t,groupNameId:d,checked:o(b.value),disabled:r==null?void 0:r.has(b.value)},b.value))})]})},pQe=Je.memo(function({legal:t,filter:n,Control:r,onChange:o,groupNameId:i,checked:a,disabled:l}){return s.jsx(aQe,{legal:t,filter:n,control:s.jsx(r,{color:"primary",name:`legal-value-${i}`,checked:a,onChange:()=>o(t.value),disabled:l})})}),fQe=({legalValues:e,values:t,addValues:n,toggleValue:r,clearAll:o,...i})=>s.jsx(WZ,{legalValues:e,isInputSelected:a=>t.has(a),onChange:r,multiSelect:{clearAll:o,selectAll:()=>{n(e.map(({value:a})=>a))},values:t},...i}),hQe=({value:e,toggleValue:t,...n})=>s.jsx(WZ,{onChange:t,isInputSelected:r=>r===e,...n}),qs=Symbol("id"),u0=e=>OZ(e.operator),Pb=e=>!u0(e),VZ=e=>Dd(e.operator),gQe=e=>AZ(e.operator),mQe=e=>IZ(e.operator),vQe=e=>{const{value:t,values:n,operator:r,...o}=e;return yI(r)?{[qs]:wi(),...o,operator:r,value:t??""}:{[qs]:wi(),...o,operator:r,values:new Set(n)}},yQe=e=>{if("value"in e)return e;{const{values:t,...n}=e;return{...n,values:Array.from(e.values)}}},xQe=(e,t)=>{const n=new Set(e);for(const r of t)n.add(r);return n},VT=(e,t)=>{const n=new Set;for(const r of e)t.has(r)||n.add(r);return n},Ch=(e,t)=>{const{value:n,values:r,...o}=t;return OZ(t.operator)?{...o,values:new Set([e].filter(Boolean))}:{...o,value:e??""}},bQe=(e,t)=>{const n=o=>{if(Pb(e))return e.value===o?{...e,value:""}:e;const i=VT(e.values,new Set([o]));return{...e,values:i??new Set}},r=o=>{var c,u;if(Pb(e)){const d=Array.isArray(o)?o[0]:o;return(c=e.deletedLegalValues)!=null&&c.has(d)?(u=e.deletedLegalValues)!=null&&u.has(e.value)?{...e,value:""}:e:{...e,value:d??""}}const i=new Set(Array.isArray(o)?o:[o]),a=xQe(e.values,i),l=e.deletedLegalValues?VT(a,e.deletedLegalValues):a;return{...e,values:l}};switch(t.type){case"set context field":return t.payload===e.contextName?e:t.payload===c0&&!Dd(e.operator)?Ch(new Date().toISOString(),{...e,contextName:t.payload,operator:hI}):t.payload!==c0&&Dd(e.operator)?Ch(null,{...e,operator:fI,contextName:t.payload}):Ch(null,{...e,contextName:t.payload});case"set operator":return t.payload===e.operator?e:VZ(e)&&Dd(t.payload)?{...e,operator:t.payload}:yI(t.payload)?Ch(null,{...e,operator:t.payload}):Ch(null,{...e,operator:t.payload});case"add value(s)":return r(t.payload);case"toggle inverted operator":return{...e,inverted:!e.inverted};case"toggle case sensitivity":return{...e,caseInsensitive:!e.caseInsensitive};case"remove value":return n(t.payload);case"clear values":return Ch(null,e);case"toggle value":return Pb(e)&&e.value===t.payload||u0(e)&&e.values.has(t.payload)?n(t.payload):r(t.payload);case"deleted legal values update":return{...e,deletedLegalValues:t.payload}}};var UT={exports:{}};const wQe="2.0.0",UZ=256,SQe=Number.MAX_SAFE_INTEGER||9007199254740991,CQe=16,jQe=UZ-6,EQe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var HC={MAX_LENGTH:UZ,MAX_SAFE_COMPONENT_LENGTH:CQe,MAX_SAFE_BUILD_LENGTH:jQe,MAX_SAFE_INTEGER:SQe,RELEASE_TYPES:EQe,SEMVER_SPEC_VERSION:wQe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},C5={};const TQe=typeof process=="object"&&C5&&C5.NODE_DEBUG&&/\bsemver\b/i.test(C5.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var WC=TQe;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=HC,i=WC;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]],g=b=>{for(const[y,w]of h)b=b.split(`${y}*`).join(`${y}{0,${w}}`).split(`${y}+`).join(`${y}{1,${w}}`);return b},v=(b,y,w)=>{const S=g(y),j=p++;i(b,j,y),d[b]=j,c[j]=y,u[j]=S,a[j]=new RegExp(y,w?"g":void 0),l[j]=new RegExp(S,w?"g":void 0)};v("NUMERICIDENTIFIER","0|[1-9]\\d*"),v("NUMERICIDENTIFIERLOOSE","\\d+"),v("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),v("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),v("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),v("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),v("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),v("BUILDIDENTIFIER",`${f}+`),v("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),v("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),v("FULL",`^${c[d.FULLPLAIN]}$`),v("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),v("LOOSE",`^${c[d.LOOSEPLAIN]}$`),v("GTLT","((?:<|>)?=?)"),v("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),v("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),v("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),v("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),v("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),v("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),v("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),v("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),v("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?(?:${c[d.BUILD]})?(?:$|[^\\d])`),v("COERCERTL",c[d.COERCE],!0),v("COERCERTLFULL",c[d.COERCEFULL],!0),v("LONETILDE","(?:~>?)"),v("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",v("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),v("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),v("LONECARET","(?:\\^)"),v("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",v("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),v("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),v("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),v("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),v("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",v("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),v("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),v("STAR","(<|>)?=?\\s*\\*"),v("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),v("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(UT,UT.exports);var dy=UT.exports;const kQe=Object.freeze({loose:!0}),_Qe=Object.freeze({}),RQe=e=>e?typeof e!="object"?kQe:e:_Qe;var SI=RQe;const fF=/^[0-9]+$/,GZ=(e,t)=>{const n=fF.test(e),r=fF.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},PQe=(e,t)=>GZ(t,e);var qZ={compareIdentifiers:GZ,rcompareIdentifiers:PQe};const Mx=WC,{MAX_LENGTH:hF,MAX_SAFE_INTEGER:Dx}=HC,{safeRe:Lx,t:Fx}=dy,AQe=SI,{compareIdentifiers:jh}=qZ;let IQe=class Zl{constructor(t,n){if(n=AQe(n),t instanceof Zl){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>hF)throw new TypeError(`version is longer than ${hF} characters`);Mx("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?Lx[Fx.LOOSE]:Lx[Fx.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>Dx||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Dx||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Dx||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){const i=+o;if(i>=0&&i<Dx)return i}return o}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Mx("SemVer.compare",this.version,this.options,t),!(t instanceof Zl)){if(typeof t=="string"&&t===this.version)return 0;t=new Zl(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof Zl||(t=new Zl(t,this.options)),jh(this.major,t.major)||jh(this.minor,t.minor)||jh(this.patch,t.patch)}comparePre(t){if(t instanceof Zl||(t=new Zl(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(Mx("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 jh(r,o)}while(++n)}compareBuild(t){t instanceof Zl||(t=new Zl(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(Mx("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 jh(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?Lx[Fx.PRERELEASELOOSE]:Lx[Fx.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 i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let i=[n,o];r===!1&&(i=[n]),jh(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var ls=IQe;const gF=ls,$Qe=(e,t,n=!1)=>{if(e instanceof gF)return e;try{return new gF(e,t)}catch(r){if(!n)return null;throw r}};var Sm=$Qe;const OQe=Sm,MQe=(e,t)=>{const n=OQe(e,t);return n?n.version:null};var DQe=MQe;const LQe=Sm,FQe=(e,t)=>{const n=LQe(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var NQe=FQe;const mF=ls,BQe=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new mF(e instanceof mF?e.version:e,n).inc(t,r,o).version}catch{return null}};var zQe=BQe;const vF=Sm,HQe=(e,t)=>{const n=vF(e,null,!0),r=vF(t,null,!0),o=n.compare(r);if(o===0)return null;const i=o>0,a=i?n:r,l=i?r:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c){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 WQe=HQe;const VQe=ls,UQe=(e,t)=>new VQe(e,t).major;var GQe=UQe;const qQe=ls,YQe=(e,t)=>new qQe(e,t).minor;var KQe=YQe;const XQe=ls,JQe=(e,t)=>new XQe(e,t).patch;var QQe=JQe;const ZQe=Sm,eZe=(e,t)=>{const n=ZQe(e,t);return n&&n.prerelease.length?n.prerelease:null};var tZe=eZe;const yF=ls,nZe=(e,t,n)=>new yF(e,n).compare(new yF(t,n));var Dl=nZe;const rZe=Dl,oZe=(e,t,n)=>rZe(t,e,n);var iZe=oZe;const sZe=Dl,aZe=(e,t)=>sZe(e,t,!0);var lZe=aZe;const xF=ls,cZe=(e,t,n)=>{const r=new xF(e,n),o=new xF(t,n);return r.compare(o)||r.compareBuild(o)};var CI=cZe;const uZe=CI,dZe=(e,t)=>e.sort((n,r)=>uZe(n,r,t));var pZe=dZe;const fZe=CI,hZe=(e,t)=>e.sort((n,r)=>fZe(r,n,t));var gZe=hZe;const mZe=Dl,vZe=(e,t,n)=>mZe(e,t,n)>0;var VC=vZe;const yZe=Dl,xZe=(e,t,n)=>yZe(e,t,n)<0;var jI=xZe;const bZe=Dl,wZe=(e,t,n)=>bZe(e,t,n)===0;var YZ=wZe;const SZe=Dl,CZe=(e,t,n)=>SZe(e,t,n)!==0;var KZ=CZe;const jZe=Dl,EZe=(e,t,n)=>jZe(e,t,n)>=0;var EI=EZe;const TZe=Dl,kZe=(e,t,n)=>TZe(e,t,n)<=0;var TI=kZe;const _Ze=YZ,RZe=KZ,PZe=VC,AZe=EI,IZe=jI,$Ze=TI,OZe=(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 _Ze(e,n,r);case"!=":return RZe(e,n,r);case">":return PZe(e,n,r);case">=":return AZe(e,n,r);case"<":return IZe(e,n,r);case"<=":return $Ze(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var XZ=OZe;const MZe=ls,DZe=Sm,{safeRe:Nx,t:Bx}=dy,LZe=(e,t)=>{if(e instanceof MZe)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?Nx[Bx.COERCEFULL]:Nx[Bx.COERCE]);else{const c=t.includePrerelease?Nx[Bx.COERCERTLFULL]:Nx[Bx.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",i=n[4]||"0",a=t.includePrerelease&&n[5]?`-${n[5]}`:"",l=t.includePrerelease&&n[6]?`+${n[6]}`:"";return DZe(`${r}.${o}.${i}${a}${l}`,t)};var FZe=LZe;class NZe{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 BZe=NZe,j5,bF;function Ll(){if(bF)return j5;bF=1;const e=/\s+/g;class t{constructor($,D){if(D=o(D),$ instanceof t)return $.loose===!!D.loose&&$.includePrerelease===!!D.includePrerelease?$:new t($.raw,D);if($ instanceof i)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=D,this.loose=!!D.loose,this.includePrerelease=!!D.includePrerelease,this.raw=$.trim().replace(e," "),this.set=this.raw.split("||").map(z=>this.parseRange(z.trim())).filter(z=>z.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const z=this.set[0];if(this.set=this.set.filter(B=>!v(B[0])),this.set.length===0)this.set=[z];else if(this.set.length>1){for(const B of this.set)if(B.length===1&&b(B[0])){this.set=[B];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){$>0&&(this.formatted+="||");const D=this.set[$];for(let z=0;z<D.length;z++)z>0&&(this.formatted+=" "),this.formatted+=D[z].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){const z=((this.options.includePrerelease&&h)|(this.options.loose&&g))+":"+$,B=r.get(z);if(B)return B;const L=this.options.loose,I=L?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];$=$.replace(I,M(this.options.includePrerelease)),a("hyphen replace",$),$=$.replace(c[u.COMPARATORTRIM],d),a("comparator trim",$),$=$.replace(c[u.TILDETRIM],p),a("tilde trim",$),$=$.replace(c[u.CARETTRIM],f),a("caret trim",$);let q=$.split(" ").map(ne=>w(ne,this.options)).join(" ").split(/\s+/).map(ne=>O(ne,this.options));L&&(q=q.filter(ne=>(a("loose invalid filter",ne,this.options),!!ne.match(c[u.COMPARATORLOOSE])))),a("range list",q);const ee=new Map,W=q.map(ne=>new i(ne,this.options));for(const ne of W){if(v(ne))return[ne];ee.set(ne.value,ne)}ee.size>1&&ee.has("")&&ee.delete("");const oe=[...ee.values()];return r.set(z,oe),oe}intersects($,D){if(!($ instanceof t))throw new TypeError("a Range is required");return this.set.some(z=>y(z,D)&&$.set.some(B=>y(B,D)&&z.every(L=>B.every(I=>L.intersects(I,D)))))}test($){if(!$)return!1;if(typeof $=="string")try{$=new l($,this.options)}catch{return!1}for(let D=0;D<this.set.length;D++)if(H(this.set[D],$,this.options))return!0;return!1}}j5=t;const n=BZe,r=new n,o=SI,i=UC(),a=WC,l=ls,{safeRe:c,t:u,comparatorTrimReplace:d,tildeTrimReplace:p,caretTrimReplace:f}=dy,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:g}=HC,v=P=>P.value==="<0.0.0-0",b=P=>P.value==="",y=(P,$)=>{let D=!0;const z=P.slice();let B=z.pop();for(;D&&z.length;)D=z.every(L=>B.intersects(L,$)),B=z.pop();return D},w=(P,$)=>(a("comp",P,$),P=C(P,$),a("caret",P),P=j(P,$),a("tildes",P),P=k(P,$),a("xrange",P),P=A(P,$),a("stars",P),P),S=P=>!P||P.toLowerCase()==="x"||P==="*",j=(P,$)=>P.trim().split(/\s+/).map(D=>E(D,$)).join(" "),E=(P,$)=>{const D=$.loose?c[u.TILDELOOSE]:c[u.TILDE];return P.replace(D,(z,B,L,I,q)=>{a("tilde",P,z,B,L,I,q);let ee;return S(B)?ee="":S(L)?ee=`>=${B}.0.0 <${+B+1}.0.0-0`:S(I)?ee=`>=${B}.${L}.0 <${B}.${+L+1}.0-0`:q?(a("replaceTilde pr",q),ee=`>=${B}.${L}.${I}-${q} <${B}.${+L+1}.0-0`):ee=`>=${B}.${L}.${I} <${B}.${+L+1}.0-0`,a("tilde return",ee),ee})},C=(P,$)=>P.trim().split(/\s+/).map(D=>T(D,$)).join(" "),T=(P,$)=>{a("caret",P,$);const D=$.loose?c[u.CARETLOOSE]:c[u.CARET],z=$.includePrerelease?"-0":"";return P.replace(D,(B,L,I,q,ee)=>{a("caret",P,B,L,I,q,ee);let W;return S(L)?W="":S(I)?W=`>=${L}.0.0${z} <${+L+1}.0.0-0`:S(q)?L==="0"?W=`>=${L}.${I}.0${z} <${L}.${+I+1}.0-0`:W=`>=${L}.${I}.0${z} <${+L+1}.0.0-0`:ee?(a("replaceCaret pr",ee),L==="0"?I==="0"?W=`>=${L}.${I}.${q}-${ee} <${L}.${I}.${+q+1}-0`:W=`>=${L}.${I}.${q}-${ee} <${L}.${+I+1}.0-0`:W=`>=${L}.${I}.${q}-${ee} <${+L+1}.0.0-0`):(a("no pr"),L==="0"?I==="0"?W=`>=${L}.${I}.${q}${z} <${L}.${I}.${+q+1}-0`:W=`>=${L}.${I}.${q}${z} <${L}.${+I+1}.0-0`:W=`>=${L}.${I}.${q} <${+L+1}.0.0-0`),a("caret return",W),W})},k=(P,$)=>(a("replaceXRanges",P,$),P.split(/\s+/).map(D=>_(D,$)).join(" ")),_=(P,$)=>{P=P.trim();const D=$.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return P.replace(D,(z,B,L,I,q,ee)=>{a("xRange",P,z,B,L,I,q,ee);const W=S(L),oe=W||S(I),ne=oe||S(q),ce=ne;return B==="="&&ce&&(B=""),ee=$.includePrerelease?"-0":"",W?B===">"||B==="<"?z="<0.0.0-0":z="*":B&&ce?(oe&&(I=0),q=0,B===">"?(B=">=",oe?(L=+L+1,I=0,q=0):(I=+I+1,q=0)):B==="<="&&(B="<",oe?L=+L+1:I=+I+1),B==="<"&&(ee="-0"),z=`${B+L}.${I}.${q}${ee}`):oe?z=`>=${L}.0.0${ee} <${+L+1}.0.0-0`:ne&&(z=`>=${L}.${I}.0${ee} <${L}.${+I+1}.0-0`),a("xRange return",z),z})},A=(P,$)=>(a("replaceStars",P,$),P.trim().replace(c[u.STAR],"")),O=(P,$)=>(a("replaceGTE0",P,$),P.trim().replace(c[$.includePrerelease?u.GTE0PRE:u.GTE0],"")),M=P=>($,D,z,B,L,I,q,ee,W,oe,ne,ce)=>(S(z)?D="":S(B)?D=`>=${z}.0.0${P?"-0":""}`:S(L)?D=`>=${z}.${B}.0${P?"-0":""}`:I?D=`>=${D}`:D=`>=${D}${P?"-0":""}`,S(W)?ee="":S(oe)?ee=`<${+W+1}.0.0-0`:S(ne)?ee=`<${W}.${+oe+1}.0-0`:ce?ee=`<=${W}.${oe}.${ne}-${ce}`:P?ee=`<${W}.${oe}.${+ne+1}-0`:ee=`<=${ee}`,`${D} ${ee}`.trim()),H=(P,$,D)=>{for(let z=0;z<P.length;z++)if(!P[z].test($))return!1;if($.prerelease.length&&!D.includePrerelease){for(let z=0;z<P.length;z++)if(a(P[z].semver),P[z].semver!==i.ANY&&P[z].semver.prerelease.length>0){const B=P[z].semver;if(B.major===$.major&&B.minor===$.minor&&B.patch===$.patch)return!0}return!1}return!0};return j5}var E5,wF;function UC(){if(wF)return E5;wF=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 i(d,this.operator,this.semver,this.options)}intersects(d,p){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,p).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,p).test(d.semver):(p=n(p),p.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!p.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||i(this.semver,"<",d.semver,p)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||i(this.semver,">",d.semver,p)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}E5=t;const n=SI,{safeRe:r,t:o}=dy,i=XZ,a=WC,l=ls,c=Ll();return E5}const zZe=Ll(),HZe=(e,t,n)=>{try{t=new zZe(t,n)}catch{return!1}return t.test(e)};var GC=HZe;const WZe=Ll(),VZe=(e,t)=>new WZe(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var UZe=VZe;const GZe=ls,qZe=Ll(),YZe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new qZe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===-1)&&(r=a,o=new GZe(r,n))}),r};var KZe=YZe;const XZe=ls,JZe=Ll(),QZe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new JZe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===1)&&(r=a,o=new XZe(r,n))}),r};var ZZe=QZe;const T5=ls,eet=Ll(),SF=VC,tet=(e,t)=>{e=new eet(e,t);let n=new T5("0.0.0");if(e.test(n)||(n=new T5("0.0.0-0"),e.test(n)))return n;n=null;for(let r=0;r<e.set.length;++r){const o=e.set[r];let i=null;o.forEach(a=>{const l=new T5(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!i||SF(l,i))&&(i=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!n||SF(n,i))&&(n=i)}return n&&e.test(n)?n:null};var net=tet;const ret=Ll(),oet=(e,t)=>{try{return new ret(e,t).range||"*"}catch{return null}};var iet=oet;const set=ls,JZ=UC(),{ANY:aet}=JZ,cet=Ll(),uet=GC,CF=VC,jF=jI,det=TI,pet=EI,fet=(e,t,n,r)=>{e=new set(e,r),t=new cet(t,r);let o,i,a,l,c;switch(n){case">":o=CF,i=det,a=jF,l=">",c=">=";break;case"<":o=jF,i=pet,a=CF,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(uet(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===aet&&(h=new JZ(">=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)&&i(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};var kI=fet;const het=kI,get=(e,t,n)=>het(e,t,">",n);var met=get;const vet=kI,yet=(e,t,n)=>vet(e,t,"<",n);var xet=yet;const EF=Ll(),bet=(e,t,n)=>(e=new EF(e,n),t=new EF(t,n),e.intersects(t,n));var wet=bet;const Cet=GC,jet=Dl;var Eet=(e,t,n)=>{const r=[];let o=null,i=null;const a=e.sort((d,p)=>jet(d,p,n));for(const d of a)Cet(d,t,n)?(i=d,o||(o=d)):(i&&r.push([o,i]),i=null,o=null);o&&r.push([o,null]);const l=[];for(const[d,p]of r)d===p?l.push(d):!p&&d===a[0]?l.push("*"):p?d===a[0]?l.push(`<=${p}`):l.push(`${d} - ${p}`):l.push(`>=${d}`);const c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t};const TF=Ll(),_I=UC(),{ANY:k5}=_I,av=GC,RI=Dl,Tet=(e,t,n={})=>{if(e===t)return!0;e=new TF(e,n),t=new TF(t,n);let r=!1;e:for(const o of e.set){for(const i of t.set){const a=_et(o,i,n);if(r=r||a!==null,a)continue e}if(r)return!1}return!0},ket=[new _I(">=0.0.0-0")],kF=[new _I(">=0.0.0")],_et=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===k5){if(t.length===1&&t[0].semver===k5)return!0;n.includePrerelease?e=ket:e=kF}if(t.length===1&&t[0].semver===k5){if(n.includePrerelease)return!0;t=kF}const r=new Set;let o,i;for(const h of e)h.operator===">"||h.operator===">="?o=_F(o,h,n):h.operator==="<"||h.operator==="<="?i=RF(i,h,n):r.add(h.semver);if(r.size>1)return null;let a;if(o&&i){if(a=RI(o.semver,i.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||i.operator!=="<="))return null}for(const h of r){if(o&&!av(h,String(o),n)||i&&!av(h,String(i),n))return null;for(const g of t)if(!av(h,String(g),n))return!1;return!0}let l,c,u,d,p=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(const 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=_F(o,h,n),l===h&&l!==o)return!1}else if(o.operator===">="&&!av(o.semver,String(h),n))return!1}if(i){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=RF(i,h,n),c===h&&c!==i)return!1}else if(i.operator==="<="&&!av(i.semver,String(h),n))return!1}if(!h.operator&&(i||o)&&a!==0)return!1}return!(o&&u&&!i&&a!==0||i&&d&&!o&&a!==0||f||p)},_F=(e,t,n)=>{if(!e)return t;const r=RI(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},RF=(e,t,n)=>{if(!e)return t;const r=RI(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var Ret=Tet;const _5=dy,PF=HC,Pet=ls,AF=qZ,Aet=Sm,Iet=DQe,$et=NQe,Oet=zQe,Met=WQe,Det=GQe,Let=KQe,Fet=QQe,Net=tZe,Bet=Dl,zet=iZe,Het=lZe,Wet=CI,Vet=pZe,Uet=gZe,Get=VC,qet=jI,Yet=YZ,Ket=KZ,Xet=EI,Jet=TI,Qet=XZ,Zet=FZe,ett=UC(),ttt=Ll(),ntt=GC,rtt=UZe,ott=KZe,itt=ZZe,stt=net,att=iet,ltt=kI,ctt=met,utt=xet,dtt=wet,ptt=Eet,ftt=Ret;var htt={parse:Aet,valid:Iet,clean:$et,inc:Oet,diff:Met,major:Det,minor:Let,patch:Fet,prerelease:Net,compare:Bet,rcompare:zet,compareLoose:Het,compareBuild:Wet,sort:Vet,rsort:Uet,gt:Get,lt:qet,eq:Yet,neq:Ket,gte:Xet,lte:Jet,cmp:Qet,coerce:Zet,Comparator:ett,Range:ttt,satisfies:ntt,toComparators:rtt,maxSatisfying:ott,minSatisfying:itt,minVersion:stt,validRange:att,outside:ltt,gtr:ctt,ltr:utt,intersects:dtt,simplifyRange:ptt,subset:ftt,SemVer:Pet,re:_5.re,src:_5.src,tokens:_5.t,SEMVER_SPEC_VERSION:PF.SEMVER_SPEC_VERSION,RELEASE_TYPES:PF.RELEASE_TYPES,compareIdentifiers:AF.compareIdentifiers,rcompareIdentifiers:AF.rcompareIdentifiers};const IF=Vo(htt),gtt=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,""]},mtt=(...e)=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},vtt=e=>{const t=IF.clean(e)===e;return!IF.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},ytt=e=>Z0(Ha(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],xtt=e=>Dd(e)?ytt:IZ(e)?vtt:AZ(e)?gtt:mtt,btt=(e,t)=>{const n=new Set(e.map(({value:o})=>o));return VT(t,n)},wtt=(e,t)=>new Set(t.filter(({value:n})=>!e(n)).map(({value:n})=>n)),Stt=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},Ctt=(e,t)=>{var f;const[n,r]=m.useReducer(bQe,vQe(e)),{deletedLegalValues:o,...i}=n;m.useEffect(()=>{t(yQe(i))},[n]);const{context:a}=ya(),l=m.useMemo(()=>Stt(a,i.contextName),[JSON.stringify(a),i.contextName]),c=xtt(i.operator),u=(...h)=>u0(i)&&h.every(g=>i.values.has(g))?h.length===1?[!1,`${h[0]} is already added.`]:[!1,"All the values are already added"]:c(...h);m.useEffect(()=>{var h,g;if((h=l.legalValues)!=null&&h.length&&((g=e.values)!=null&&g.length)){const v=btt(l.legalValues,e.values);r({type:"deleted legal values update",payload:v})}},[JSON.stringify(l.legalValues),JSON.stringify(e.values)]);const d=m.useMemo(()=>{var h;if((h=l.legalValues)!=null&&h.length&&Pb(i))return wtt(g=>c(g)[0],l.legalValues)},[JSON.stringify(l.legalValues),JSON.stringify(i.operator)]),p=(f=l.legalValues)!=null&&f.length?{legalValues:l.legalValues,invalidLegalValues:d,deletedLegalValues:o}:void 0;return{updateConstraint:r,constraint:i,validator:u,legalValueData:p}},jtt=x("article")(({theme:e})=>({"--padding":e.spacing(2),backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`})),Ett=x("div")(({theme:e})=>({"--gap":e.spacing(1),padding:"var(--padding)",display:"flex",flexFlow:"row nowrap",alignItems:"flex-start",justifyItems:"space-between",gap:"var(--gap)"})),QZ=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:"var(--gap)",alignSelf:"flex-start"})),Ttt=x(QZ)(({theme:e})=>({flexFlow:"row wrap"})),ktt=x("div")(({theme:e})=>({display:"flex",gap:"var(--gap)",flexFlow:"row wrap",width:"100%",height:"min-content"})),_tt=x("div")(({theme:e})=>({padding:"var(--padding)",borderTop:`1px dashed ${e.palette.divider}`})),Rtt=x(th)(({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}})),Ptt=x($t)(({theme:e})=>({position:"absolute",right:e.spacing(1)})),$F=x("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","&:is(:hover, :focus-visible)":{outline:`1px solid ${e.palette.primary.main}`}})),Att=x(HJe)(({theme:e})=>({path:{fill:"currentcolor"}})),Itt=x(WJe)(({theme:e})=>({path:{fill:e.palette.text.disabled},rect:{fill:e.palette.text.secondary}})),$tt=x("div")(({theme:e})=>({width:e.spacing(2)})),Ott=x(OJe)(({theme:e})=>({path:{fill:e.palette.text.disabled},rect:{fill:e.palette.text.secondary}})),Mtt=x(FZ)(({theme:e})=>({path:{fill:"currentColor"}})),Dtt=({addValues:e,clearValues:t,localConstraint:n,validator:r,addValuesButtonRef:o})=>VZ(n)?s.jsx(rQe,{setValue:e,value:n.value,validator:r}):mQe(n)?s.jsx(cF,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"A semver value should be of the format X.Y.Z",inputType:"text"}):gQe(n)?s.jsx(cF,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"Add a single number",inputType:"number"}):s.jsx(zJe,{validator:r,helpText:"Maximum 100 char length per value",ref:o,onAddValues:e}),Ltt=({onDelete:e,constraint:t,onUpdate:n})=>{const{constraint:r,updateConstraint:o,validator:i,legalValueData:a}=Ctt(t,n),l=m.useCallback(C=>o({type:"add value(s)",payload:C}),[o]),c=m.useCallback(C=>o({type:"remove value",payload:C}),[o]),u=m.useCallback(()=>o({type:"clear values"}),[o]),d=m.useCallback(C=>o({type:"toggle value",payload:C}),[o]),p=m.useCallback(C=>{o({type:"set operator",payload:C})},[o]),{context:f}=ya(),{contextName:h,operator:g}=r,v=PZ(g),b=m.useRef(null),y=m.useRef(null);if(!f)return null;const w=f.map(C=>C.name),E=(!w.includes(r.contextName)?[...w,r.contextName].toSorted():w).map(C=>({key:C,label:C}));return s.jsxs(jtt,{children:[s.jsxs(Ett,{children:[s.jsxs(ktt,{children:[s.jsxs(QZ,{children:[s.jsx(Rtt,{visuallyHideLabel:!0,id:"context-field-select",name:"contextName",label:"Context Field",options:E,value:h||"",onChange:C=>o({type:"set context field",payload:C}),variant:"standard"}),s.jsxs(Ttt,{children:[s.jsx(hr,{title:`Make the selected operator${r.inverted?" inclusive":" exclusive"}`,arrow:!0,describeChild:!0,children:s.jsx($F,{type:"button",onClick:()=>o({type:"toggle inverted operator"}),children:r.inverted?s.jsx(Itt,{"aria-label":"The constraint operator is exclusive."}):s.jsx(Att,{"aria-label":"The constraint operator is inclusive."})})}),s.jsx(jJe,{options:MZ(h),value:g,onChange:p,inverted:r.inverted}),v?s.jsx(hr,{title:`Make match${r.caseInsensitive?" ":" not "}case sensitive`,arrow:!0,describeChild:!0,children:s.jsx($F,{type:"button",onClick:()=>o({type:"toggle case sensitivity"}),children:r.caseInsensitive?s.jsx(Ott,{"aria-label":"The match is not case sensitive."}):s.jsx(Mtt,{"aria-label":"The match is case sensitive."})})}):null]})]}),s.jsx($Je,{values:u0(r)?Array.from(r.values):a&&r.value?[r.value]:void 0,removeValue:c,getExternalFocusTarget:()=>y.current??b.current,children:a?null:s.jsx(Dtt,{localConstraint:r,addValues:l,clearValues:u,validator:i,addValuesButtonRef:y})})]}),s.jsx($tt,{}),s.jsx(hr,{title:"Delete constraint",arrow:!0,children:s.jsx(Ptt,{type:"button","data-testid":"DELETE_CONSTRAINT_BUTTON",size:"small",onClick:e,ref:b,children:s.jsx(Po,{fontSize:"inherit"})})})]}),a?s.jsx(_tt,{children:u0(r)?s.jsx(fQe,{values:r.values,toggleValue:d,clearAll:u,addValues:l,...a}):s.jsx(hQe,{toggleValue:d,value:r.value,...a})}):null]})},ZZ=e=>{const t=MZ(e)[0],n=Dd(t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1,[qs]:wi()}},Ftt=x("div")({width:"100%",display:"flex",flexDirection:"column"}),eee=m.forwardRef(({constraints:e,setConstraints:t},n)=>{const{context:r}=ya();m.useImperativeHandle(n,()=>({addConstraint(a){if(t){const l=ZZ(a);t(c=>[...c,l])}}})),m.useEffect(()=>{e.every(a=>qs in a)||t(e.map(a=>({[qs]:wi(),...a})))},[e,t]);const o=a=>{t(Ma(l=>{l.splice(a,1)}))},i=a=>l=>{t(Ma(c=>c.map(u=>u[qs]===a?l:u)))};return r.length===0?null:s.jsx(Ftt,{children:s.jsx(NC,{children:e.map((a,l)=>s.jsx(Ltt,{constraint:a,onDelete:()=>o(l),onUpdate:i(a[qs])},a[qs]))})})}),tee=(e,t)=>e.value&&e.contextName===c0?Ja(e.value,t.locale):e.value,Ntt=x(FC)({whiteSpace:"pre"}),Btt=x(da)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),ztt=x("div")(({theme:e})=>({width:"300px",marginBottom:e.spacing(2)})),Htt=({values:e})=>{const[t,n]=m.useState("");return!e||e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e.length>20,show:s.jsx(ztt,{children:s.jsx(HZ,{filter:t,setFilter:n})})}),e.filter(r=>r.includes(t)).map((r,o)=>s.jsx(Btt,{label:s.jsx(Ntt,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},Wtt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),Vtt=x("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),Utt=x(da)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),Gtt=({value:e,operator:t})=>e?s.jsxs(Wtt,{children:[s.jsxs(Vtt,{children:["Value must be ",t]})," ",s.jsx(Utt,{label:s.jsx(FC,{maxWidth:"400",text:e,maxLength:50})})]}):null,qtt=x("div")(({theme:e})=>({padding:e.spacing(1,0),maxHeight:"400px",overflowY:"auto"})),Ytt=({constraint:e})=>{const{locationSettings:t}=wo();return s.jsx("div",{children:s.jsxs(qtt,{children:[s.jsx(Htt,{values:e.values}),s.jsx(Gtt,{value:tee(e,t),operator:e.operator})]})})},X2="disabled-strategy-55d37c31-ca3f-4c19-bf86-9158824899bf",Ktt=x("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"}})),Xtt=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",flexGrow:1,position:"relative",[`.${X2} &`]:{filter:"grayscale(1)",color:e.palette.text.secondary},[e.breakpoints.down("sm")]:{width:"100%"}})),Jtt=x("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"}})),gc=({type:e,children:t,alignType:n})=>s.jsxs(Ktt,{children:[s.jsx(Jtt,{align:n,children:e}),s.jsx(Xtt,{children:t})]}),Qtt=x(da,{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"}}:{}})),Mg=m.forwardRef((e,t)=>s.jsx(Qtt,{size:"small",ref:t,...e})),Ztt=x("div")(({theme:e})=>({flex:"1 1 0",[e.breakpoints.down("sm")]:{display:"block",float:"left"}})),ent=x(yo)({padding:0,margin:0}),tnt=x("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)}})),nnt=x("div")(({theme:e})=>({padding:e.spacing(.25,1),background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge})),d1=({values:e,tooltips:t,onSetTruncated:n})=>s.jsxs(Ztt,{children:[e&&(e==null?void 0:e.length)===1?s.jsx(nnt,{children:s.jsx(yo,{title:e[0],arrow:!0,lines:2,onSetTruncated:()=>n==null?void 0:n(!1),children:s.jsx(Qa,{title:(t==null?void 0:t[e[0]])||"",children:s.jsx("span",{children:e[0]})})})}):null,e&&(e==null?void 0:e.length)>1?s.jsx(ent,{title:"",lines:2,onSetTruncated:n,component:"ul",children:e.map(r=>s.jsx(Qa,{title:(t==null?void 0:t[r])||"",children:s.jsx(tnt,{children:s.jsx("span",{children:r})})},r))}):null]}),rnt=(e,t)=>{const{context:n}=ya(),r=m.useMemo(()=>n.find(({name:o})=>o===e),[e,n]);return m.useMemo(()=>Object.fromEntries((t==null?void 0:t.map(o=>{var i,a;return[o,(a=(i=r==null?void 0:r.legalValues)==null?void 0:i.find(({value:l})=>l===o))==null?void 0:a.description]}).filter(([o,i])=>!!i))||[]),[n,t])},ont=(e,t)=>vJe(e)||PZ(e)&&!t,int=({label:e,inverted:t})=>s.jsx(kt,{title:t?`Not ${e}`:e,arrow:!0,children:s.jsx(Mg,{label:HT(e,t),multiline:!0})}),snt=x(Mg)(({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)"}})),ant=()=>s.jsx(kt,{title:"The match is case sensitive",arrow:!0,children:s.jsx(snt,{"aria-label":"The match is case sensitive",label:s.jsx(FZ,{style:{verticalAlign:"middle"},fill:"currentColor","aria-hidden":!0})})}),lnt=x("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"}})),cnt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5)})),unt=x("div")(({theme:e})=>({maxWidth:"150px",paddingRight:e.spacing(.5),overflow:"hidden",[e.breakpoints.down("sm")]:{maxWidth:"unset"}})),dnt=({onSetTruncated:e,viewMore:t,...n})=>{const{caseInsensitive:r,contextName:o,inverted:i,operator:a,value:l,values:c}=n,{locationSettings:u}=wo(),d=l?[tee(n,u)||"",...c||[]]:c||[],p=rnt(o,c||[]);return s.jsx(gc,{type:"Constraint",children:s.jsxs(lnt,{children:[s.jsx(unt,{children:s.jsx(yo,{title:o,arrow:!0,children:o})}),s.jsxs(cnt,{children:[s.jsx(int,{label:a,inverted:i}),ont(a,r)?s.jsx(ant,{}):null]}),s.jsxs("div",{children:[s.jsx(d1,{values:d,onSetTruncated:e,tooltips:p}),t]})]})})},pnt=x("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),fnt=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",width:"100%"}})),hnt=x("p")(({theme:e})=>({color:e.palette.secondary.main,margin:e.spacing(.25,0,0,.75),fontSize:e.fontSizes.smallerBody})),gnt=({constraint:e,allowExpand:t,expanded:n})=>{var i;const[r,o]=m.useState(!1);return s.jsx(pnt,{children:s.jsx(fnt,{children:s.jsx(dnt,{...e,onSetTruncated:a=>{o(a),t(a)},viewMore:r?s.jsx(hnt,{children:n?"View less":`View all (${(i=e.values)==null?void 0:i.length})`}):null})})})},mnt=x("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),vnt=x(Ue)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),ynt=({onUse:e})=>{const t=e&&(n=>{n.stopPropagation(),e()});return s.jsx(mnt,{children:s.jsx(X,{condition:!!t,show:s.jsx(kt,{title:"Use constraint",arrow:!0,children:s.jsx(vnt,{variant:"text",color:"primary",onClick:t,"data-testid":"USE_CONSTRAINT_BUTTON",children:"Use this"})})})})},xnt=cp("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),bnt=({constraint:e,onUse:t,allowExpand:n,expanded:r,disabled:o})=>s.jsxs(xnt,{children:[s.jsx(gnt,{constraint:e,allowExpand:n,expanded:r,disabled:o}),t?s.jsx(ynt,{onUse:t}):null]}),wnt=x(Dc,{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"})),Snt=x(Fc)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),Cnt=x(Lc)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),jnt=x("div")({display:"flex",flexDirection:"column",width:"100%"}),qC=({constraint:e,onUse:t,sx:n=void 0,disabled:r=!1,renderAfter:o,borderStyle:i="solid"})=>{const[a,l]=m.useState(!0),[c,u]=m.useState(!1),d=()=>{a&&u(!c)};return s.jsxs(wnt,{expanded:c,sx:n,borderStyle:i,children:[s.jsx(Snt,{expandIcon:null,onClick:d,sx:{cursor:a?"pointer":"default!important","&:hover":{cursor:a?"pointer":"default!important"}},tabIndex:a?0:-1,children:s.jsxs(jnt,{children:[s.jsx(bnt,{constraint:e,onUse:t,allowExpand:l,disabled:r,expanded:c}),o]})}),s.jsx(Cnt,{children:s.jsx(Ytt,{constraint:e})})]})},Ent=x("div")(({theme:e})=>({marginTop:e.spacing(3)})),Tnt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),knt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),_nt=({setConstraints:e,constraints:t=[]})=>{const{items:n}=iZ();if(n.length===0||!e)return null;const r=n.filter(o=>!t.some(i=>oZ(i,o)));return r.length===0?null:s.jsxs(Ent,{children:[s.jsx(Tnt,{children:"Recently used constraints"}),s.jsx(knt,{children:r.map(o=>s.jsx(qC,{constraint:o,borderStyle:"dashed",onUse:()=>{e(i=>[...i,o])}},OT(o)))})]})},Rnt=e=>{const t=m.useRef(new WeakMap),[,n]=m.useState(0),r=m.useCallback((i,a)=>{t.current.set(i,a),n(l=>l+1)},[]),o=m.useCallback(i=>t.current.get(i),[]);return m.useMemo(()=>({set:r,get:o}),[r,o])},Pnt=x("div")({width:"100%",display:"flex",flexDirection:"column"}),Ant=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),Int=e=>{var o;const{uiConfig:t}=rt(),n=((o=t.resourceLimits)==null?void 0:o.constraints)||30,r=e>=n;return{limit:n,limitReached:r}},$nt=(e,t)=>{const n=Rnt(),{context:r}=ya(),o=e&&(a=>{const l=ZZ(a);n.set(l,{editing:!0,new:!0}),e(c=>[...c,l])});return m.useImperativeHandle(t,()=>({addConstraint:o})),{onAdd:o&&(()=>{o(r[0].name)}),state:n,context:r}},nee=m.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n},r)=>{const{onAdd:o,context:i}=$nt(t,r),{limit:a,limitReached:l}=Int(e.length);return i.length===0?null:s.jsx(Pnt,{children:s.jsx(X,{condition:!!(n&&o),show:s.jsxs("div",{children:[s.jsxs(Ant,{children:[s.jsx(Z,{children:"Constraints"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),t?s.jsx(eee,{ref:r,setConstraints:t,constraints:e}):null,s.jsx(J,{sx:c=>({marginTop:c.spacing(2),marginBottom:c.spacing(2)}),children:s.jsx(ly,{name:"constraints in this strategy",shortName:"constraints",currentValue:e.length,limit:a})}),s.jsx(Ue,{type:"button",onClick:o,startIcon:s.jsx(Oo,{}),variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",disabled:!!l,children:"Add constraint"}),s.jsx(_nt,{setConstraints:t,constraints:e})]})})})}),Ont=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},Mnt=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{m.useEffect(()=>()=>{n.constraints&&r(c=>{var u;return{...c,constraints:(u=c.constraints)==null?void 0:u.filter(Ont)}})},[]);const o=n.constraints||[],i=c=>{r(u=>({...u,constraints:c instanceof Function?c(u.constraints||[]):c}))},a=Pg(hX,e,t),l=Pg(lC,e,t);return s.jsx(nee,{constraints:o,setConstraints:l?i:void 0,showCreateButton:a})},YC=()=>{const{makeRequest:e,makeLightRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0}),i=async(E,C)=>{const k=n("api/admin/features/validate",{method:"POST",body:JSON.stringify({name:E,projectId:C})});return e(k.caller,k.id)},a=async E=>{const T=n("api/admin/constraints/validate",{method:"POST",body:JSON.stringify(E)});await e(T.caller,T.id)},l=async(E,C)=>{const T=`/api/admin/projects/${E}/features`,k=n(T,{method:"POST",body:JSON.stringify(C)});await e(k.caller,k.id)},c=m.useCallback(async(E,C,T,k=!1)=>{const _=`api/admin/projects/${E}/features/${C}/environments/${T}/on?shouldActivateDisabledStrategies=${k}`,A=n(_,{method:"POST"},"toggleFeatureEnvironmentOn");return t(A.caller,A.id)},[n,t]),u=m.useCallback(async(E,C,T,k=!1)=>{const _=`api/admin/projects/${E}/bulk_features/environments/${T}/on?shouldActivateDisabledStrategies=${k}`,A=n(_,{method:"POST",body:JSON.stringify({features:C})},"bulkToggleFeaturesEnvironmentOn");return e(A.caller,A.id)},[n,e]),d=m.useCallback(async(E,C,T,k=!1)=>{const _=`api/admin/projects/${E}/bulk_features/environments/${T}/off?shouldActivateDisabledStrategies=${k}`,A=n(_,{method:"POST",body:JSON.stringify({features:C})},"bulkToggleFeaturesEnvironmentOff");return e(A.caller,A.id)},[n,e]),p=m.useCallback(async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}/environments/${T}/off`,_=n(k,{method:"POST"},"toggleFeatureEnvironmentOff");return t(_.caller,_.id)},[n,t]);return{validateFeatureToggleName:i,validateConstraint:a,createFeatureToggle:l,changeFeatureProject:async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}/changeProject`,_=n(k,{method:"POST",body:JSON.stringify({newProjectId:T})});return e(_.caller,_.id)},errors:r,toggleFeatureEnvironmentOn:c,toggleFeatureEnvironmentOff:p,addTagToFeature:async(E,C)=>{const T=`api/admin/features/${E}/tags`,k=n(T,{method:"POST",body:JSON.stringify({...C})});return e(k.caller,k.id)},deleteTagFromFeature:async(E,C,T)=>{const k=`${encodeURIComponent(C)}/${encodeURIComponent(T)}`,_=`api/admin/features/${E}/tags/${k}`,A=n(_,{method:"DELETE"});return e(A.caller,A.id)},updateFeatureTags:async(E,C)=>{const T=`api/admin/features/${E}/tags`,k=n(T,{method:"PUT",body:JSON.stringify({...C})});return e(k.caller,k.id)},archiveFeatureToggle:async(E,C)=>{const T=`api/admin/projects/${E}/features/${C}`,k=n(T,{method:"DELETE"});return e(k.caller,k.id)},patchFeatureToggle:async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}`,_=n(k,{method:"PATCH",body:JSON.stringify(T)});return e(_.caller,_.id)},patchFeatureEnvironmentVariants:async(E,C,T,k)=>{const _=`api/admin/projects/${E}/features/${C}/environments/${T}/variants`,A=n(_,{method:"PATCH",body:JSON.stringify(k)});return e(A.caller,A.id)},overrideVariantsInEnvironments:async(E,C,T,k)=>{const _=`api/admin/projects/${E}/features/${C}/variants-batch`,A=n(_,{method:"PUT",body:JSON.stringify({variants:T,environments:k})});return e(A.caller,A.id)},cloneFeatureToggle:async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}/clone`,_=n(k,{method:"POST",body:JSON.stringify(T)});return e(_.caller,_.id)},loading:o,bulkToggleFeaturesEnvironmentOn:u,bulkToggleFeaturesEnvironmentOff:d}},OF=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},KC=e=>{const t=!!(e&&e.length===0),[n,r]=m.useState(t),{validateConstraint:o}=YC();return m.useEffect(()=>{if(!e)return;if(e.find(l=>!OF(l))){r(!1);return}const a=e.filter(OF).map(l=>o(l));Promise.all(a).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},Dnt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),Lnt=x(pp)({flex:1}),PI=({label:e,options:t,value:n=[],onChange:r,disabled:o,icon:i,width:a="215px"})=>{const l=qt(),c=u=>{const{InputProps:d}=u;let p;return i!==null&&(p=s.jsx(fp,{position:"start",children:i||s.jsx(Oo,{sx:{height:20,width:20,color:l.palette.primary.main}})})),s.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 s.jsx(Dnt,{children:s.jsx(Lnt,{options:t,value:n,onChange:(u,d)=>r(d||[]),renderInput:c,getOptionLabel:u=>u.label,disabled:o,size:"small",multiple:!0})})},Fnt=x("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})),MF=x("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer",color:e.palette.secondary.dark})),Nnt=x(xt)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),R5=e=>({fontSize:e.fontSizes.bodySize}),ree=({segment:e,setSegments:t,preview:n,setPreview:r,"aria-controls":o})=>{const i=()=>{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=s.jsx(X,{condition:e===n,show:s.jsx(R9,{titleAccess:"Hide",sx:R5}),elseShow:s.jsx(oy,{titleAccess:"Show",sx:R5})}),c=e===n?"Hide segment constraints":"Preview segment constraints";return s.jsxs(Fnt,{children:[s.jsx(Nnt,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),s.jsx(kt,{title:c,arrow:!0,children:s.jsx(MF,{type:"button",onClick:a,"aria-expanded":e===n,"aria-controls":o,children:l})}),s.jsx(kt,{title:"Remove segment",arrow:!0,children:s.jsx(MF,{type:"button",onClick:i,children:s.jsx(bI,{titleAccess:"Remove",sx:R5})})})]})},Bnt=x(mZ)(()=>({padding:0})),znt=x(Dc)(()=>({boxShadow:"none",margin:0,padding:0,"::before":{display:"none"}})),Hnt=x(Fc)(({theme:e})=>({fontSize:e.typography.body2.fontSize,minHeight:"unset",":focus-within":{backgroundColor:"inherit"}})),Wnt=x(Lc)(({theme:e})=>({padding:e.spacing(.5,3,2.5)})),Vnt=x(xt)(({theme:e})=>({textDecoration:"none",paddingRight:e.spacing(.5),"&:hover":{textDecoration:"underline"}})),Unt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:"auto"})),Gnt=x(Ue)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),qnt=x("p")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),AI=({segment:e,isExpanded:t,headerContent:n,constraintList:r})=>{const[o,i]=m.useState(t||!1),a=m.useId(),l=m.useMemo(()=>{var c;return r||((c=e.constraints)!=null&&c.length?s.jsx(NC,{children:e.constraints.map((u,d)=>s.jsx(qC,{constraint:u},`${vm(u)}-${d}`))}):s.jsx(qnt,{children:"This segment has no constraints."}))},[r,e.constraints]);return s.jsx(Bnt,{children:s.jsxs(znt,{expanded:o,disableGutters:!0,TransitionProps:{mountOnEnter:!0,unmountOnExit:!0},children:[s.jsxs(Hnt,{id:`segment-accordion-${e.id}`,tabIndex:-1,"aria-controls":a,children:[s.jsx(gc,{type:"Segment",children:s.jsx(Vnt,{to:`/segments/edit/${e.id}`,children:e.name})}),n||null,t?null:s.jsx(Unt,{children:s.jsx(Gnt,{"aria-controls":a,size:"small",variant:"outlined",onClick:()=>i(c=>!c),children:o?"Close preview":"Preview"})})]}),s.jsx(Wnt,{children:l})]})})},Ynt=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),Knt=x("p")(({theme:e})=>({color:e.palette.text.secondary})),Xnt=x("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})),Jnt=x("div")({display:"contents"}),Qnt=({segments:e,setSegments:t})=>{const[n,r]=m.useState(),o=e.length-1,i=m.useId();return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e&&e.length>0,show:s.jsx(Knt,{children:"Selected Segments"})}),s.jsx(Ynt,{children:e.map((a,l)=>s.jsxs(m.Fragment,{children:[s.jsx(ree,{segment:a,setSegments:t,preview:n,setPreview:r,"aria-controls":i}),s.jsx(X,{condition:l<o,show:s.jsx(Xnt,{children:"AND"})})]},a.id))}),s.jsx(Jnt,{id:i,children:s.jsx(X,{condition:!!n,show:s.jsx(AI,{segment:n,isExpanded:!0})})})]})},bp=()=>{const{uiConfig:e}=rt();return{segmentValuesLimit:e.resourceLimits.segmentValues,strategySegmentsLimit:e.resourceLimits.strategySegments}},Znt=()=>{const{segmentValuesLimit:e}=bp();return typeof e>"u"?null:s.jsxs(Lt,{severity:"info",children:["A segment can have"," ",s.jsxs("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," values across all of its constraints"]}),". ",s.jsx(iee,{})]})},ert=e=>{const{segmentValuesLimit:t}=bp();return typeof t>"u"?null:s.jsxs(Lt,{severity:"error",children:["A segment can have"," ",s.jsxs("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",t," across all of its contraints"]}),". This segment has ",e.values," ",e.values===1?"value":"values","."]})},oee=()=>{const{strategySegmentsLimit:e}=bp();return typeof e>"u"?null:s.jsxs(Lt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",s.jsx(iee,{})]})},iee=()=>s.jsxs(s.Fragment,{children:[s.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),see="https://docs.getunleash.io/reference/segments",trt=x(da)(({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}})),nrt=({segment:e,setSegments:t})=>{const n=()=>{t(r=>r.some(o=>o.id===e.id)?r:[...r,e])};return s.jsx(kt,{title:"Add segment",arrow:!0,children:s.jsx(trt,{label:e.name,icon:s.jsx(Oo,{}),onClick:n,size:"small",variant:"outlined"})})},rrt=x("div")(({theme:e})=>({marginTop:e.spacing(3)})),ort=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),irt=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),srt=({setSegments:e,segments:t=[]})=>{const{items:n}=sZ(),{segments:r}=ma();if(n.length===0||!e||!r)return null;const i=n.map(a=>r.find(l=>l.id===a)).filter(a=>a!==void 0).filter(a=>!t.some(l=>l.id===a.id));return i.length===0?null:s.jsxs(rrt,{children:[s.jsx(ort,{children:"Recently used segments"}),s.jsx(irt,{children:i.map(a=>s.jsx(nrt,{segment:a,setSegments:e},a.id))})]})},art=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),lrt=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=ma(),{strategySegmentsLimit:o}=bp(),i=!!(o&&e.length>=o);if(!r||r.length===0)return null;const c=r.filter(({project:d})=>!d||d===n).filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name})),u=([d])=>{const p=r.find(f=>String(f.id)===d.value);p&&t(f=>[...f,p])};return s.jsxs(s.Fragment,{children:[s.jsxs(art,{children:[s.jsx(Z,{children:"Segments"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),i&&s.jsx(oee,{}),s.jsx(PI,{label:"Select segments",options:c,onChange:u,disabled:i,icon:null,width:"175px"}),s.jsx(Qnt,{segments:e,setSegments:t}),s.jsx(srt,{setSegments:t,segments:e})]})},crt=(e,t)=>{const{type:n,required:r}=e;if(!(n!=="string"&&n!=="list"&&n!=="number")){if(r&&(typeof t>"u"||t===""))return"Field is required";if(n==="number"&&!urt(t))return"Not a valid number."}},urt=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),drt=({environment:e})=>s.jsxs(Lt,{severity:"info",children:[s.jsx("strong",{children:"Change requests"})," are enabled",e?` for ${e}`:"",". Your changes needs to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]}),prt=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const{value:i,setValue:a}=II(),[l,c]=m.useState(i.hide),u=()=>{a(d=>({hide:!d.hide})),c(d=>!d)};return s.jsxs(Gn,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[s.jsx(Lt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),s.jsx("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),s.jsx(qr,{label:"Don't show again",control:s.jsx(pa,{checked:l,onChange:u})})]})},frt=(e,t)=>{var r;const{value:n}=II();return n.hide?!1:typeof e=="string"?e===lf:(r=e==null?void 0:e.environments)==null?void 0:r.some(o=>o.name===t&&o.type===lf)},hrt="useFeatureStrategyProdGuardSettings:v2",II=()=>Au(hrt,{hide:!1}),ELt=e=>{const{value:t}=II();return e===lf&&!t.hide},grt=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&["In review","Approved"].includes(r.state)):!1,alert:s.jsx(Lt,{sx:{margin:"1rem 0"},severity:"warning",children:"You currently have a change request in review for this environment. Adding a new change will add the change to the existing change request, and all existing approvals will be reset. Are you sure you want to continue?"})}),mrt=({title:e,setTitle:t})=>s.jsxs(J,{sx:{paddingBottom:n=>n.spacing(2)},children:[s.jsx(Z,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),s.jsx(vr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),vrt=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium})),yrt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1)})),xrt=({enabled:e,onToggleEnabled:t})=>s.jsxs(vrt,{children:[s.jsx(Z,{variant:"body2",fontWeight:"bold",children:"Strategy Status"}),s.jsxs(yrt,{children:[s.jsx(qr,{control:s.jsx(pa,{name:"enabled",onChange:t,checked:e}),label:s.jsx(Z,{variant:"body2",children:"Active"})}),s.jsx(Z,{variant:"body2",color:"text.secondary",children:"Strategy will be exposed when environment is enabled"})]})]}),brt="/static/upgradeChangeRequests-B-dEhRV6.png",wrt=x(J)(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.secondary.border}`,padding:e.spacing(2),display:"flex",position:"relative"})),Srt=x(kn)(({theme:e})=>({textDecoration:"none",fontWeight:e.typography.fontWeightBold})),Crt=x("img")(({theme:e})=>({height:e.spacing(6)})),jrt=x($t)(({theme:e})=>({position:"absolute",top:e.spacing(.5),right:e.spacing(.5)})),Ert=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(3),marginLeft:e.spacing(.5),marginRight:e.spacing(1)})),Trt=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",gap:e.spacing(.5)})),krt=()=>{const[e,t]=ol("upgrade-change-requests:v1","open");return e==="closed"?null:s.jsxs(wrt,{children:[s.jsxs(Ert,{children:[s.jsx(Crt,{src:ti(brt),alt:"Change requests"}),s.jsxs(Trt,{children:[s.jsxs("p",{children:["Include ",s.jsx("b",{children:"Change Requests"})," in your process to bring a pull request-like experience to your feature flags. Reduce the risk of errors with the four-eyes approval principle."]}),s.jsx(Srt,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=change-requests",target:"_blank",children:"View our Enterprise offering"})]})]}),s.jsx(kt,{title:"Dismiss",arrow:!0,children:s.jsx(jrt,{"aria-label":"dismiss",onClick:()=>{t("closed")},size:"small",children:s.jsx(Ho,{fontSize:"inherit"})})})]})},_rt=x("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%"})),Rrt=x("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),Prt=x("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}`})),Art=x(bR)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),Irt=x(J)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),$rt=x(jr)(({theme:e})=>({width:"100%"})),Ort=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),Mrt=x(J)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),Drt=x(If)(({theme:e})=>({width:"100px"})),DF=x(sn)(({theme:e})=>({marginLeft:e.spacing(1)})),Lrt=x(pI)({top:"-10px",left:"0",transform:"translateY(0)"}),aee=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:a,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:p,isChangeRequest:f,tab:h,setTab:g,StrategyVariants:v,Limit:b,disabled:y})=>{var ve;const{trackEvent:w}=Kt(),[S,j]=m.useState(!1),E=KC(l.constraints),C=frt(t,n),T=Pg(r,e,n),{strategyDefinition:k}=LC(l==null?void 0:l.name);m.useEffect(()=>{w("new-strategy-form",{props:{eventType:"seen"}})},[]);const _=l!=null&&l.parameters&&"stickiness"in(l==null?void 0:l.parameters)?String(l.parameters.stickiness):"default";m.useEffect(()=>{c(he=>({...he,variants:(l.variants||[]).map(ye=>({stickiness:_,name:ye.name,weight:ye.weight,payload:ye.payload,weightType:ye.weightType}))}))},[_,JSON.stringify(l.variants)]);const A=t.environments.find(he=>he.name===n),{data:O}=uy(t.project),{changeRequestInReviewOrApproved:M,alert:H}=grt(O),P=M(n||""),$=P?"Add to existing change request":"Add change to draft",{isOss:D}=rt(),z=(A==null?void 0:A.type)==="production"&&D(),B=Ot(),{error:L,loading:I}=rt();if(L)throw L;if(I||!k)return null;const q=he=>k.parameters.find(ye=>ye.name===he),ee=(he,ye)=>{const Pe=crt(q(he),ye);return Pe?(p.setFormError(he,Pe),!1):(p.removeFormError(he),!0)},W=()=>k.parameters.map(he=>he.name).map(he=>{var ye;return ee(he,(ye=l.parameters)==null?void 0:ye[he])}).every(Boolean),oe=()=>{B(MI(t.project,t.name))},ne=async he=>{var ye;Array.isArray(l.variants)&&((ye=l.variants)==null?void 0:ye.length)>0&&w("strategy-variants",{props:{eventType:"submitted"}}),he.preventDefault(),W()&&(w("new-strategy-form",{props:{eventType:"submitted"}}),C&&!f?j(!0):o())},ce=(he,ye)=>{g(ye)},xe=()=>{var Pe;const he=((Pe=l.constraints)==null?void 0:Pe.length)||0,ye=u.length||0;return he+ye},re=!!(l.parameters&&"stickiness"in l.parameters);return s.jsxs(s.Fragment,{children:[s.jsx(Ort,{children:s.jsx(Rrt,{children:Il(l.name||"")})}),s.jsxs(Mrt,{children:[s.jsx(X,{condition:P,show:H,elseShow:s.jsx(X,{condition:f,show:s.jsx(drt,{environment:n})})}),s.jsx(X,{condition:!uJ.includes(l.name||"default"),show:s.jsxs(Lt,{severity:"warning",children:["Custom strategies are deprecated. We recommend not adding them to any flags going forward and using the predefined strategies like Gradual rollout with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",variant:"body2",children:"constraints"})," ","instead."]})})]}),s.jsxs(Art,{value:h,onChange:ce,children:[s.jsx(Drt,{label:"General"}),s.jsx(If,{"data-testid":"STRATEGY_TARGETING_TAB",label:s.jsxs(Z,{children:["Targeting",s.jsx(DF,{children:xe()})]})}),re&&s.jsx(If,{"data-testid":"STRATEGY_VARIANTS_TAB",label:s.jsxs(Z,{children:["Variants",s.jsx(DF,{children:((ve=l.variants)==null?void 0:ve.length)||0})]})})]}),s.jsxs(_rt,{onSubmit:ne,children:[s.jsx(X,{condition:h===0,show:s.jsxs(s.Fragment,{children:[s.jsx(mrt,{title:l.title||"",setTitle:he=>{c(ye=>({...ye,title:he}))}}),s.jsx(dJe,{strategy:l,strategyDefinition:k,setStrategy:c,validateParameter:ee,errors:p,hasAccess:T}),s.jsx(xrt,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(he=>({...he,disabled:!he.disabled}))}),s.jsx(X,{condition:!f,show:s.jsx(pJe,{projectId:t.project,featureId:t.name,environmentId:n})})]})}),s.jsx(X,{condition:h===1,show:s.jsxs(s.Fragment,{children:[s.jsx(Lt,{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."}),s.jsx(lrt,{segments:u,setSegments:d,projectId:e}),s.jsxs(Irt,{children:[s.jsx($rt,{}),s.jsx(Lrt,{})]}),s.jsx(Mnt,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c})]})}),s.jsx(X,{condition:h===2,show:s.jsx(X,{condition:re,show:v})}),s.jsx(J,{sx:{flex:1,display:"flex",alignItems:"flex-end"},children:b}),z?s.jsx(krt,{}):null,s.jsxs(Prt,{children:[s.jsx(Ro,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:y||a||!E||p.hasFormErrors(),"data-testid":kje,children:f?$:"Save strategy"}),s.jsx(Ue,{type:"button",color:"primary",onClick:i||oe,disabled:a,children:"Cancel"}),s.jsx(prt,{open:S,onClose:()=>j(!1),onClick:o,loading:a,label:"Save strategy"})]})]})]})},$I=({name:e,value:t="",label:n="",options:r,onChange:o,id:i,disabled:a=!1,className:l,classes:c,formControlStyles:u={},...d})=>{const p=()=>r.map(f=>s.jsx(Cr,{value:f.key,title:f.title||"","data-testid":`${$R}-${f.label}`,children:f.label},f.key));return s.jsxs(Is,{variant:"outlined",size:"small",classes:c,style:u,children:[s.jsx(Su,{htmlFor:i,children:n}),s.jsx($c,{name:e,disabled:a,onChange:o,className:l,label:n,id:i,value:t,...d,children:p()})]})},Frt=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const i=l=>{const u=l.target.value.split(/,\s?/).map(d=>d.trim());t(u)},a=l=>{if(l.key==="Backspace"){const c=l.target.value;if(c.endsWith(", ")){l.preventDefault();const u=c.slice(0,-2);t(u.split(/,\s*/))}}};return s.jsx(xn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},Nrt=x("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"}}})),Brt=x($I)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),zrt=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),Hrt=x(Frt)(()=>({width:"100%"})),Wrt=x(xn)(()=>({width:"100%"})),Vrt=({overrides:e,overridesDispatch:t})=>{const{context:n}=ya(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},i=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return s.jsx(s.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 s.jsxs(Nrt,{children:[s.jsx(Brt,{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]})}),s.jsxs(zrt,{children:[s.jsx(X,{condition:!!(u&&u.length>0),show:s.jsx(pp,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(f,h)=>f===h,options:u,onChange:i(l),getOptionLabel:f=>f,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:f=>s.jsx(Wrt,{...f,variant:"outlined",label:"Legal values"})}),elseShow:s.jsx(Hrt,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),s.jsx(kt,{title:"Remove",arrow:!0,children:s.jsx($t,{onClick:f=>{f.preventDefault(),t({type:"REMOVE",payload:l})},children:s.jsx(Po,{})})})]})]},`override=${l}`)})})},Urt=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((n,r)=>r!==t.payload);case"UPDATE_VALUES_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,contextName:r}:o)}}},Grt=(e=[])=>m.useReducer(Urt,e);var oc=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(oc||{});const qrt=Je.lazy(()=>va(()=>import("./ReactJSONEditor-BDMT4-_1.js"),[])),Yrt=x("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"})),Krt=x("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),Xrt=x(kt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),lee=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),LF=x(lee)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),Jrt=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),Qrt=x(qr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),Zrt=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),FF=x(vr)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),eot=x("div")(({theme:e})=>({marginLeft:e.spacing(3)})),tot=x(vr)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),not=x("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),cee=x("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%"}}})),rot=x(cee)({alignItems:"end",justifyContent:"space-between"}),oot=x($I)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),iot=x(Ue)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),sot=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"},{key:"number",label:"number"}],aot={type:"string",value:""},uee=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:a,weightsError:l})=>{const[c,u]=m.useState(e.name),[d,p]=m.useState(e.weightType===oc.FIX),[f,h]=m.useState(String(e.weight/10)),[g,v]=m.useState(e.payload||aot),[b,y]=Grt("overrides"in e?e.overrides||[]:[]),{context:w}=ya(),[S,j]=m.useState({}),E=L=>{j(I=>({...I,[L]:void 0}))},C=(L,I)=>{j(q=>({...q,[L]:I}))};m.useEffect(()=>{E("percentage"),o!=null&&o.includes("%")&&C("percentage","Total weight must equal 100%")},[o]);const T=!e.new,k=t.filter(({id:L,weightType:I})=>L!==e.id&&I===oc.VARIABLE).length>0,_=L=>{const I=L.weightType===oc.VARIABLE,q=t.some(W=>W.weightType===oc.FIX),ee=t.filter(W=>W.weightType===oc.VARIABLE).length===1;return q&&ee&&I},A=L=>{E("name"),$(L,e.id)||C("name","A variant with that name already exists for this environment."),u(L.trim())},O=L=>{(L===""||D(L))&&h(L)},M=L=>{z(L)||C("payload",L.type==="json"?"Invalid json":"Invalid number")},H=()=>{w.length>0&&y({type:"ADD",payload:{contextName:w[0].name,values:[]}})},P=L=>!!L.length,$=(L,I)=>T||!t.some(q=>q.name===L&&q.id!==I),D=L=>{if(!d)return!0;if(L===""||L.match(/\.[0-9]{2,}$/))return!1;const I=Number(L);return I>=0&&I<=100},z=L=>{try{return L.type==="json"&&JSON.parse(L.value),L.type==="number"?!Number.isNaN(Number(L.value)):!0}catch{return!1}};m.useEffect(()=>{const L={...e,name:c,weight:Number(d?f:100)*10,weightType:d?oc.FIX:oc.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:g.value?g:void 0,isValid:P(c)&&$(c,e.id)&&D(f)&&z(g)&&!o};i||(L.overrides=b.map(I=>({contextName:I.contextName,values:I.values})).filter(I=>I.values&&I.values.length>0)),n(L)},[c,d,f,g,b]),m.useEffect(()=>{d||h(String(e.weight/10))},[e.weight]);const B=S!=null&&S.percentage||l?"Total weight may not exceed 100%":"";return s.jsxs(Yrt,{"data-testid":"VARIANT",children:[s.jsx(Krt,{color:a}),s.jsx(Xrt,{arrow:!0,title:_(e)?"You need to have at least one variable variant":"Delete variant",children:s.jsx("div",{children:s.jsx($t,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:_(e),children:s.jsx(Po,{})})})}),s.jsxs(rot,{children:[s.jsxs(not,{children:[s.jsx(lee,{children:"Variant name"}),s.jsx(Jrt,{children:"This will be used to identify the variant in your code"}),s.jsx(FF,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!S.name,errorText:S.name,value:c,onChange:L=>A(L.target.value),disabled:T,required:!0})]}),s.jsx(X,{condition:k,show:s.jsxs(eot,{children:[s.jsx(Qrt,{label:"Custom percentage",control:s.jsx(fa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:d,onChange:L=>p(L.target.checked)})}),s.jsx(tot,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!B,errorText:B,value:f,onChange:L=>O(L.target.value),required:d,disabled:!d,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:s.jsx(fp,{position:"end",children:"%"})}})]})})]}),s.jsxs(LF,{children:["Payload",s.jsx(bo,{tooltip:"Passed along with the the variant object."})]}),s.jsxs(cee,{children:[s.jsx(oot,{id:"variant-payload-type",name:"type",label:"Type",value:g.type,options:sot,onChange:L=>{E("payload"),v(I=>({...I,type:L.target.value}))}}),s.jsx(Zrt,{children:s.jsx(X,{condition:g.type==="json",show:s.jsx(m.Suspense,{fallback:null,children:s.jsx(qrt,{content:{text:g.value},onChange:L=>v(I=>{var q;return{...I,value:"json"in L?((q=L.json)==null?void 0:q.toString())||"":L.text}})})}),elseShow:s.jsx(FF,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:g.type!=="string",rows:g.type==="string"||g.type==="number"?1:4,value:g.value,onChange:L=>{E("payload"),v(I=>({...I,value:L.target.value}))},placeholder:"",onBlur:()=>M(g),error:!!S.payload,errorText:S.payload})})})]}),i?null:s.jsxs(s.Fragment,{children:[s.jsxs(LF,{children:["Overrides",s.jsx(bo,{tooltip:"Here you can specify which users should get this variant."})]}),s.jsx(Vrt,{overrides:b,overridesDispatch:y}),s.jsx("div",{children:s.jsx(iot,{onClick:H,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})},lot=x(J)(({theme:e})=>({display:"flex",flexDirection:"column"})),cot=x(J)(({theme:e})=>({display:"flex",alignItems:"center",minWidth:"250px",gap:e.spacing(1)})),uot=x(J)(({theme:e})=>({padding:e.spacing(1,0,.75,0),flexDirection:"column"})),dot=x("span")(({theme:e})=>({marginBottom:e.spacing(1),fontSize:e.typography.body2.fontSize})),pot=x(J,{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]}})),fot=x("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})),hot=x("code")(({theme:e})=>({display:"inline-block",background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.25,1),fontSize:e.fontSizes.smallerBody})),got=({variant:{name:e,weight:t,payload:n},index:r,selected:o})=>s.jsxs(lot,{children:[s.jsxs(cot,{children:[s.jsx(pot,{index:r,children:s.jsx("figure",{})}),s.jsxs(Z,{variant:"subtitle2",children:[t/10,"% - ",e]})]}),n?s.jsxs(uot,{sx:{display:["json","csv"].includes(n.type)?"flex":"block"},children:[s.jsxs(dot,{children:[s.jsx(fot,{children:n.type})," payload: "]}),s.jsx(hot,{children:n.value})]}):null]}),mot=x(J)(()=>({display:"flex",width:"100%",position:"relative"})),vot=x(J)(({theme:e,selected:t})=>({position:"relative",fontSize:e.fontSizes.smallerBody,...t?{fontWeight:e.typography.fontWeightBold}:{}})),yot=x(J,{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}:{}})),xot=x(J)(({theme:e})=>({padding:e.spacing(.25,.25),lineHeight:1})),bot=x(J)(({theme:e})=>({padding:e.spacing(.125,.25,0),overflow:"hidden",color:e.palette.text.secondary})),wot=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),Sot=x(Z)(({theme:e})=>({marginY:e.spacing(1)})),OI=({variants:e,weightsError:t,header:n=!0,selected:r})=>e.length<1?null:s.jsxs(J,{sx:o=>({marginTop:o.spacing(n?2:0)}),children:[n?s.jsx(wot,{children:s.jsxs(Sot,{variant:"body2",children:["Flag variants (",e.length,")"]})}):null,s.jsx(mot,{children:e.map((o,i)=>{const a=o.weight/10;return a===0?null:s.jsx(Qa,{variant:"custom",arrow:!0,onClick:l=>l.preventDefault(),titleComponent:s.jsx(got,{variant:o,index:i,selected:r===o.name}),children:s.jsxs(vot,{sx:{width:`${a}%`},selected:r===o.name,children:[s.jsx(yot,{index:i,isFirst:i===0,isLast:i===e.length-1,hasError:t,children:s.jsx(xot,{children:s.jsx(yo,{lines:1,children:`${a}%`})})}),s.jsx(bot,{children:s.jsx(yo,{lines:1,children:o.name})})]})},i)})})]}),dee=()=>s.jsxs(Lt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",s.jsx(Cot,{}),"."]}),TLt=()=>s.jsxs(Lt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",s.jsx("b",{children:"variants inside strategies"}),". ",s.jsx(jot,{})]}),Cot=()=>s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),jot=()=>s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),Eot=x("div")({display:"flex",flexDirection:"column"}),Tot=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),pee=({strategy:e,setStrategy:t,projectId:n,environment:r,editable:o})=>{const{trackEvent:i}=Kt(),a=(e.variants||[]).map(g=>({...g,new:o||!1,isValid:!0,id:wi(),overrides:[]})),[l,c]=m.useState(a),u=qt(),d=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";m.useEffect(()=>()=>{t(g=>({...g,variants:l.filter(v=>!!v.name)}))},[JSON.stringify(l)]),m.useEffect(()=>{t(g=>({...g,variants:l.map(v=>({stickiness:d,name:v.name,weight:v.weight,payload:v.payload,weightType:v.weightType}))}))},[d,JSON.stringify(l)]);const p=(g,v)=>{c(b=>I2(b.map(y=>y.id===v?g:y),1e3))},f=()=>{const g=wi();c(v=>[...v,{name:"",weightType:oc.VARIABLE,weight:0,stickiness:d,new:!0,isValid:!1,id:g}]),i("strategy-variants",{props:{eventType:"variant added"}})},h=l.reduce((g,v)=>g+(v.weight||0),0)!==1e3;return s.jsxs(s.Fragment,{children:[s.jsx(Lt,{severity:"info",icon:!1,children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),s.jsxs(Tot,{children:[s.jsx(Z,{children:"Variants"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),s.jsxs(Eot,{children:[s.jsx(X,{condition:l.length>0,show:s.jsx(dee,{})}),l.map((g,v)=>s.jsx(uee,{disableOverrides:!0,variant:g,variants:l,updateVariant:b=>p(b,g.id),removeVariant:()=>c(b=>I2(b.filter(y=>y.id!==g.id),1e3)),decorationColor:u.palette.variants[v%u.palette.variants.length],weightsError:h},g.id))]}),s.jsx(Ro,{onClick:f,variant:"outlined",permission:gX,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",startIcon:s.jsx(Oo,{}),children:"Add variant"}),s.jsx(OI,{variants:l,weightsError:h})]})},kot=e=>fetch(e).then(Jt("ChangeRequest")).then(t=>t.json()),_ot=(e,t)=>{const{data:n,error:r,mutate:o}=cy([],bt(`api/admin/projects/${e}/change-requests/scheduled?strategyId=${t}`),kot);return{changeRequests:n,loading:!r&&!n,refetch:o,error:r}},Rot=(e,t,n,r)=>(e==null?void 0:e.filter(o=>{var i;return(i=o.features.find(a=>a.name===t))==null?void 0:i.changes.some(a=>a.action==="updateStrategy"&&a.payload.id===n)}).map(o=>({changeRequest:uI(r,o.id),state:o.state})))??[],Pot=(e,t)=>(e==null?void 0:e.map(n=>({changeRequest:uI(t,n.id),state:"Scheduled"})))??[],Aot=({value:e,values:t,inverted:n,operator:r,contextName:o,caseInsensitive:i})=>{const a=l=>({contextName:o,operator:r,...l,caseInsensitive:i,inverted:n});return yI(r)?a({value:e||""}):a({values:t||[]})},XC=(e,t)=>e!=="constraints"||!Array.isArray(t)?t:t.map(Aot),Iot=()=>{const[e,t]=m.useState(""),{trackEvent:n}=Kt();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"}})}}},$ot=e=>{if(e)return e==null?void 0:e.constraints.map(t=>({...t,[qs]:wi()}))},kLt=()=>{const e=Or("projectId"),t=Or("featureId"),n=YL("environmentId"),r=YL("strategyId"),[o,i]=m.useState(0),[a,l]=m.useState({}),[c,u]=m.useState([]),{updateStrategyOnFeature:d,loading:p}=nXe(),{strategyDefinition:f}=LC(a.name),{setToastData:h,setToastApiError:g}=Nt(),v=cI(),{uiConfig:b}=rt(),{unleashUrl:y}=b,w=Ot(),{addChange:S}=Ou(),{isChangeRequestConfigured:j}=mp(e),{refetch:E,data:C}=uy(e),{setPreviousTitle:T}=Iot(),{feature:k,refetchFeature:_}=Al(e,t),A=m.useRef(k),{data:O,staleDataNotification:M,forceRefreshCache:H}=uZ({unleashGetter:Al,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},k,{afterSubmitAction:_},dZ);m.useEffect(()=>{A.current.name===""&&k.name&&(H(k),A.current=k)},[k]);const{trackEvent:P}=Kt(),{changeRequests:$}=_ot(e,r),D=Rot(C,t,r,b),z=Pot($,b),B=()=>[...D,...z].forEach(ne=>P("change_request",{props:{...ne,action:"edit-strategy",eventType:"conflict-created"}})),{segments:L,refetchSegments:I}=ma(r);m.useEffect(()=>{const ne=O==null?void 0:O.environments.flatMap(re=>re.strategies).find(re=>re.id===r),ce=$ot(ne),xe={...ne,constraints:ce};l(re=>({...re,...xe})),T((ne==null?void 0:ne.title)||"")},[r,O]),m.useEffect(()=>{L&&u(L)},[JSON.stringify(L)]);const q=Oot(a,c),ee=async ne=>{await d(e,t,n,r,ne),await I(),h({text:"Strategy updated",type:"success"})},W=async ne=>{await S(e,n,{action:"updateStrategy",feature:t,payload:{...ne,id:r}}),h({text:"Change added to draft",type:"success"}),E()},oe=async()=>{try{j(n)?await W(q):await ee(q),B(),_(),w(MI(e,t))}catch(ne){g(Tt(ne))}};return!a.id||!f||!O?null:s.jsxs(Fr,{modal:!0,disablePadding:!0,description:fee,documentationLink:hee,documentationLinkLabel:gee,formatApiCode:()=>Mot(e,t,n,r,q,f,y),children:[s.jsx(aee,{projectId:e,feature:O,strategy:a,setStrategy:l,segments:c,setSegments:u,environmentId:n,onSubmit:oe,loading:p,permission:lC,errors:v,isChangeRequest:j(n),tab:o,setTab:i,StrategyVariants:s.jsx(pee,{strategy:a,setStrategy:l,environment:n,projectId:e})}),M]})},Oot=(e,t)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:t.map(n=>n.id),disabled:e.disabled??!1}),MI=(e,t)=>`/projects/${e}/features/${t}`,DI=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},Mot=(e,t,n,r,o,i,a)=>{if(!a)return"";const l={...o,parameters:gXe(o.parameters??{},i)},c=`${a}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,XC,2);return`curl --location --request PUT '${c}' \\
354
+ `),ge={insert:"+ ",delete:"- ",replace:"! ",equal:" "},Xe=!1,Pe=[],Se=new o(null,C,T).getGroupedOpcodes(),oe=0,ce=Se.length;oe<ce;oe++)if(L=Se[oe],!Xe){if(Xe=!0,B=A?` ${A}`:"",wt=O?` ${O}`:"",Pe.push(`*** ${k}${B}${H}`),Pe.push(`--- ${_}${wt}${H}`),[z,ne]=[L[0],L[L.length-1]],Pe.push("***************"+H),$=u(z[1],ne[2]),Pe.push(`*** ${$} ****${H}`),i(function(){var st,Ce,Be;for(Be=[],Ce=0,st=L.length;Ce<st;Ce++)[yt,P,P,P,P]=L[Ce],Be.push(yt==="replace"||yt==="delete");return Be}())){for(Ee=0,xe=L.length;Ee<xe;Ee++)if([yt,I,q,P,P]=L[Ee],yt!=="insert")for(Ve=C.slice(I,q),Re=0,re=Ve.length;Re<re;Re++)ye=Ve[Re],Pe.push(ge[yt]+ye)}if(D=u(z[3],ne[4]),Pe.push(`--- ${D} ----${H}`),i(function(){var st,Ce,Be;for(Be=[],Ce=0,st=L.length;Ce<st;Ce++)[yt,P,P,P,P]=L[Ce],Be.push(yt==="replace"||yt==="insert");return Be}())){for(_e=0,ve=L.length;_e<ve;_e++)if([yt,P,P,ee,W]=L[_e],yt!=="delete")for(Ne=T.slice(ee,W),ze=0,he=Ne.length;ze<he;ze++)ye=Ne[ze],Pe.push(ge[yt]+ye)}}return Pe},w=function(C,T,k,_=n){return new e(k,_).compare(C,T)},S=function(C,T){var k,_,A,O,M,H,P;if(P={1:"- ",2:"+ "}[T],!P)throw new Error(`unknow delta choice (must be 1 or 2): ${T}`);for(M=[" ",P],O=[],k=0,_=C.length;k<_;k++)A=C[k],H=A.slice(0,2),E.call(M,H)>=0&&O.push(A.slice(2));return O},fs._arrayCmp=a,fs.SequenceMatcher=o,fs.getCloseMatches=v,fs._countLeading=c,fs.Differ=e,fs.IS_LINE_JUNK=r,fs.IS_CHARACTER_JUNK=n,fs._formatRangeUnified=d,fs.unifiedDiff=j,fs._formatRangeContext=u,fs.contextDiff=h,fs.ndiff=w,fs.restore=S}).call(Cn);var wXe=fs;class SXe{constructor(t){var n;t.outputKeys=t.outputKeys||[],t.excludeKeys=t.excludeKeys||[],t.showElisionsForObjects=(n=t.showElisionsForObjects)!==null&&n!==void 0?n:!0,this.options=t}isScalar(t){return typeof t!="object"||t===null}objectDiff(t,n){let r={},o=0,i=!0;for(const[a,l]of Object.entries(t))if(!this.options.outputNewOnly){const c="__deleted";!(a in n)&&!this.options.excludeKeys.includes(a)&&(r[`${a}${c}`]=l,o-=30,i=!1)}for(const[a,l]of Object.entries(n)){const c=this.options.outputNewOnly?"":"__added";!(a in t)&&!this.options.excludeKeys.includes(a)&&(r[`${a}${c}`]=l,o-=30,i=!1)}for(const[a,l]of Object.entries(t))if(a in n){if(this.options.excludeKeys.includes(a))continue;o+=20;const c=n[a],u=this.diff(l,c);u.equal?this.options.full||this.options.outputKeys.includes(a)?r[a]=l:this.options.showElisionsForObjects&&(r[a]=cZ):(r[a]=u.result,i=!1),o+=Math.min(20,Math.max(-10,u.score/5))}return i?(o=100*Math.max(Object.keys(t).length,.5),this.options.full||(r=void 0)):o=Math.max(0,o),{score:o,result:r,equal:i}}findMatchingObject(t,n,r){let o=null;for(const[i,{item:a,index:l}]of Object.entries(r))if(i!=="__next"){const c=Math.abs(l-n);if(Kh(t)===Kh(a)){const{score:u}=this.diff(t,a);(!o||u>o.score||u===o.score&&c<o.indexDistance)&&(o={score:u,key:i,indexDistance:c})}}return o}scalarize(t,n,r){const o=[];if(r){const a={};for(let l=0;l<t.length;l++){const c=t[l];if(this.isScalar(c))continue;const u=this.findMatchingObject(c,l,r);u&&(!a[u.key]||u.score>a[u.key].score)&&(a[u.key]={score:u.score,index:l})}for(const[l,c]of Object.entries(a))o[c.index]=l}const i=[];for(let a=0;a<t.length;a++){const l=t[a];if(this.isScalar(l))i.push(l);else{const c=o[a]||"__$!SCALAR"+n.__next++;n[c]={item:l,index:a},i.push(c)}}return i}isScalarized(t,n){return typeof t=="string"&&t in n}descalarize(t,n){return this.isScalarized(t,n)?n[t].item:t}arrayDiff(t,n){const r={__next:1},o=this.scalarize(t,r),i={__next:r.__next},a=this.scalarize(n,i,r);this.options.sort&&(o.sort(),a.sort());const l=new wXe.SequenceMatcher(null,o,a).getOpcodes();let c=[],u=0,d=!0;for(const[p,f,h,g,v]of l){let b,y,w,S,j,E,C,T;switch(p==="equal"||this.options.keysOnly&&p==="replace"||(d=!1),p){case"equal":for(b=f,S=h,w=f<=S;w?b<S:b>S;w?b++:b--){const k=o[b];if(this.isScalarized(k,r)){if(!this.isScalarized(k,i))throw new Error(`internal bug: isScalarized(item, originals1) != isScalarized(item, originals2) for item ${JSON.stringify(k)}`);const _=this.descalarize(k,r),A=this.descalarize(k,i),O=this.diff(_,A);O.equal?this.options.full||this.options.keepUnchangedValues?c.push([" ",_]):c.push([" "]):(c.push(["~",O.result]),d=!1)}else this.options.full||this.options.keepUnchangedValues?c.push([" ",k]):c.push([" "]);u+=10}break;case"delete":for(b=f,E=h,j=f<=E;j?b<E:b>E;j?b++:b--)c.push(["-",this.descalarize(o[b],r)]),u-=5;break;case"insert":for(y=g,T=v,C=g<=T;C?y<T:y>T;C?y++:y--)c.push(["+",this.descalarize(a[y],i)]),u-=5;break;case"replace":if(this.options.keysOnly){let k,_;for(b=f,_=h,k=f<=_;k?b<_:b>_;k?b++:b--){const A=this.diff(this.descalarize(o[b],r),this.descalarize(a[b-f+g],i));A.equal?c.push([" "]):(c.push(["~",A.result]),d=!1)}}else{let k,_,A,O;for(b=f,_=h,k=f<=_;k?b<_:b>_;k?b++:b--)c.push(["-",this.descalarize(o[b],r)]),u-=5;for(y=g,O=v,A=g<=O;A?y<O:y>O;A?y++:y--)c.push(["+",this.descalarize(a[y],i)]),u-=5}break}}return d||l.length===0?(this.options.full?c=t:c=void 0,u=100):u=Math.max(0,u),{score:u,result:c,equal:d}}diff(t,n){const r=Kh(t),o=Kh(n);if(r===o)switch(r){case"object":return this.objectDiff(t,n);case"array":return this.arrayDiff(t,n)}let i=100,a=t,l;return this.options.keysOnly?(l=!0,a=void 0):(r==="date"&&o==="date"?l=t.getTime()===n.getTime():l=t===n,l?this.options.full||(a=void 0):(i=0,this.options.outputNewOnly?a=n:a={__old:t,__new:n})),{score:i,result:a,equal:l}}}const td=function(e,t,n,r,o,i){var a;let l;const c=t?`${t}: `:"",u=i+" ",d=e.maxElisions===void 0?1/0:e.maxElisions,p=(a=e.renderElision)!==null&&a!==void 0?a:(h,g)=>h<g?[...Array(h)].map(()=>"..."):`... (${h} entries)`,f=h=>{const g=p(h,d);typeof g=="string"?r(" ",u+g):g.forEach(v=>{r(" ",u+v)})};switch(Kh(n)){case"object":if("__old"in n&&"__new"in n&&Object.keys(n).length===2)return td(e,t,n.__old,r,"-",i),td(e,t,n.__new,r,"+",i);{r(o,`${i}${c}{`);let h=0;for(const g of Object.keys(n)){let v;if(l=n[g],l===cZ){h++;continue}else h>0&&(f(h),h=0);(v=g.match(/^(.*)__deleted$/))?td(e,v[1],l,r,"-",u):(v=g.match(/^(.*)__added$/))?td(e,v[1],l,r,"+",u):td(e,g,l,r,o,u)}return h>0&&f(h),r(o,`${i}}`)}case"array":{r(o,`${i}${c}[`);let h=!0;for(const g of n)(Kh(g)!=="array"||!(g.length===2||g.length===1&&g[0]===" ")||typeof g[0]!="string"||g[0].length!==1||![" ","-","+","~"].includes(g[0]))&&(h=!1);if(h){let g,v=0;for([g,l]of n)if(g===" "&&l==null)v++;else{if(v>0&&f(v),v=0,![" ","~","+","-"].includes(g))throw new Error(`Unexpected op '${g}' in ${JSON.stringify(n,null,2)}`);g==="~"&&(g=" "),td(e,"",l,r,g,u)}v>0&&f(v)}else for(l of n)td(e,"",l,r,o,u);return r(o,`${i}]`)}default:if(n===0||n===null||n===!1||n===""||n)return r(o,i+c+JSON.stringify(n))}},CXe=(e,t,n)=>td(t,"",e,n," ",""),jXe=function(e,t={},n){const r=[];return CXe(e,t,function(o,i){let a,l;o===" "?(a=n.unchangedClassName,l=n.unchangedLineStyle):o==="+"?(a=n.additionClassName,l=n.additionLineStyle):(a=n.deletionClassName,l=n.deletionLineStyle);let c=s.jsx("div",Object.assign({className:a,style:l},{children:i}),r.length);return r.push(c)}),s.jsx("div",Object.assign({className:n.frameClassName,style:n.frameStyle},{children:r}))};function EXe(e,t,n={}){return n.precision!==void 0&&(e=BT(e,n.precision),t=BT(t,n.precision)),new SXe(n).diff(e,t).result}function TXe(e,t,n={},r){return jXe(EXe(e,t,n),n,r)}const kXe={additionLineStyle:null,additionClassName:"addition",deletionLineStyle:null,deletionClassName:"deletion",unchangedLineStyle:null,unchangedClassName:"unchanged",frameStyle:null,frameClassName:"diff"};function _Xe(e){return Object.assign(Object.assign({},kXe),e)}function RXe(e){var t;return TXe(e.jsonA,e.jsonB,e.jsonDiffOptions,_Xe((t=e.styleCustomization)!==null&&t!==void 0?t:{}))}const PXe=x("div")(({theme:e})=>({color:e.palette.text.secondary,fontFamily:"monospace",whiteSpace:"pre-wrap",fontSize:e.typography.body2.fontSize,".deletion, .addition":{position:"relative","::before":{position:"absolute",left:0,top:0}},".addition":{color:e.palette.eventLog.diffAdd,"::before":{content:'"+"'}},".deletion":{color:e.palette.eventLog.diffSub,"::before":{content:'"-"'}},'&[data-change-type="replacement"]':{":has(.addition)":{color:e.palette.eventLog.diffAdd},":has(.deletion)":{color:e.palette.eventLog.diffSub},".addition::before, .deletion::before":{content:"none"}},".diff:not(:has(*))":{"::before":{content:'"(no changes)"'}}})),AXe=x("span")(({theme:e})=>({marginInlineEnd:e.spacing(.5)})),xp=({entry:e,excludeKeys:t})=>{const n=e.preData&&e.data?"edit":"replacement",r=n==="edit",[o,i]=m.useState(!1),a=m.useId();return s.jsxs(s.Fragment,{children:[r?s.jsxs(Ue,{onClick:()=>i(!o),"aria-controls":a,"aria-expanded":o,children:[s.jsx(AXe,{"aria-hidden":!0,children:o?"-":"+"}),o?"Show only changed properties":"Show all properties"]}):null,s.jsx(PXe,{"data-change-type":n,id:a,children:s.jsx(RXe,{jsonA:e.preData??{},jsonB:e.data??{},jsonDiffOptions:{full:o,maxElisions:2,excludeKeys:t}})})]})},IXe=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=qt(),a=Xn(i.breakpoints.down("sm")),l=m.useMemo(()=>{const c={...Tq,padding:`${i.spacing(3)} ${i.spacing(4)}`,boxShadow:i.boxShadows.elevated,borderRadius:i.shape.borderRadiusLarge,backgroundColor:i.palette.background.paper,maxWidth:i.spacing(75),zIndex:i.zIndex.mobileStepper};return a?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,a]);return s.jsxs(ER,{mounted:t,start:l,enter:kq,children:[s.jsx(Z,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),s.jsx(Z,{variant:"body1",sx:{my:2,mb:3},children:"The data you have been working on is stale, would you like to refresh your data? This may happen if someone has been making changes to the data while you were working."}),s.jsx(xp,{entry:{preData:o,data:r}}),s.jsx(Ue,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},$Xe=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},uZ=(e,t,n,r)=>{const{data:o,refetch:i}=$Xe(e),[a,l]=m.useState(t||null),[c,u]=m.useState(!1),d=f=>{u(!1),l(f)},p=f=>f&&(r&&typeof r=="function"?r(f):f);return m.useEffect(()=>{a===null&&l(t)},[t]),m.useEffect(()=>{if(!a||!o)return;c1(p(a),p(o))||u(!0)},[o]),{data:a,refetch:i,staleDataNotification:s.jsx(IXe,{cache:p(a),data:p(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}};function zT(e,...t){const n=new Set(t);if(Array.isArray(e))return e.map(r=>zT(r,...t));if(typeof e=="object"&&e!==null){const r={};for(const[o,i]of Object.entries(e))n.has(o)||(r[o]=zT(i,...t));return r}return e}const dZ=e=>{const t={...e};return zT(t,"lastSeenAt","yes","no","lifecycle","collaborators")},uI=(e,t)=>{var n;return`${e.baseUriPath||((n=e.versionInfo)==null?void 0:n.instanceId)}#${t}`},OXe={willOverwriteStrategyChanges:!1,registerWillOverwriteStrategyChanges:()=>{}},pZ=m.createContext(OXe),MXe=pZ.Provider,DXe=()=>m.useContext(pZ),Ou=()=>{const{trackEvent:e}=Kt(),{makeRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0}),{uiConfig:i}=rt(),{willOverwriteStrategyChanges:a}=DXe();return{addChange:async(b,y,w)=>{e("change_request",{props:{eventType:"change added"}});const S=`api/admin/projects/${b}/environments/${y}/change-requests`,j=n(S,{method:"POST",body:JSON.stringify(w)});return(await t(j.caller,j.id)).json()},editChange:async(b,y,w,S)=>{const j=`api/admin/projects/${b}/change-requests/${y}/changes/${w}`,E=n(j,{method:"PUT",body:JSON.stringify(S)});return t(E.caller,E.id)},changeState:async(b,y,w,S)=>{e("change_request",{props:{eventType:S.state,previousState:w,willOverwriteStrategyChanges:a,id:uI(i,y)}});const j=`api/admin/projects/${b}/change-requests/${y}/state`,E=n(j,{method:"PUT",body:JSON.stringify(S)});return(await t(E.caller,E.id)).json()},discardChange:async(b,y,w)=>{const S=`api/admin/projects/${b}/change-requests/${y}/changes/${w}`,j=n(S,{method:"DELETE"});return t(j.caller,j.id)},updateChangeRequestEnvironmentConfig:async({project:b,enabled:y,environment:w,requiredApprovals:S})=>{const j=`api/admin/projects/${b}/environments/${w}/change-requests/config`,E=n(j,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:y,requiredApprovals:S})});return t(E.caller,E.id)},discardDraft:async(b,y)=>{const w=`api/admin/projects/${b}/change-requests/${y}`,S=n(w,{method:"DELETE"});return t(S.caller,S.id)},addComment:async(b,y,w)=>{e("change_request",{props:{eventType:"comment added"}});const S=`/api/admin/projects/${b}/change-requests/${y}/comments`,j=n(S,{method:"POST",body:JSON.stringify({text:w})});return t(j.caller,j.id)},updateTitle:async(b,y,w)=>{e("change_request",{props:{eventType:"title updated"}});const S=`api/admin/projects/${b}/change-requests/${y}/title`,j=n(S,{method:"PUT",body:JSON.stringify({title:w})});return t(j.caller,j.id)},updateRequestedApprovers:async(b,y,w)=>{e("change_request",{props:{eventType:"approvers updated"}});const S=`api/admin/projects/${b}/change-requests/${y}/approvers`,j=n(S,{method:"PUT",body:JSON.stringify({reviewers:w})});return t(j.caller,j.id)},errors:r,loading:o}},cy=(e,t,n,r={})=>{const{isEnterprise:o}=rt();return Bi(o(),e,t,n,r)},LXe=e=>fetch(e).then(Jt("ChangeRequest")).then(t=>t.json()),uy=e=>{const{data:t,error:n,mutate:r}=cy([],bt(`api/admin/projects/${e}/change-requests/pending`),LXe);return{data:t,loading:!n&&!t,refetch:r,error:n}},fZ=({strategyDefinition:e})=>s.jsx("p",{children:e==null?void 0:e.description}),FXe=ASe(z2e,e=>({root:{height:8},thumb:{height:24,width:24,backgroundColor:e.palette.background.paper,border:"2px solid currentColor"},active:{},valueLabel:{},track:{height:8,borderRadius:e.shape.borderRadius},rail:{height:8,borderRadius:e.shape.borderRadius}})),NXe=x(Z)(({theme:e})=>({marginBottom:e.spacing(1)})),aF=x(Z)(({theme:e})=>({marginBottom:e.spacing(1),marginTop:e.spacing(1)})),BXe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),zXe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",gap:e.spacing(4),marginBottom:e.spacing(1)})),HXe=x(J)(({theme:e})=>({display:"flex",alignItems:"center",width:"100px",flexShrink:0})),WXe=x("div")(({theme:e})=>({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"column",gap:e.spacing(2)})),VXe=x("div")(({theme:e})=>({flexGrow:1})),UXe=x(xn)(({theme:e})=>({width:"90px"})),GXe=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}],qXe=({name:e,value:t,onChange:n,disabled:r=!1})=>{const[o,i]=m.useState(t.toString());m.useEffect(()=>{i(t.toString())},[t]);const a=d=>`${d}%`,l=d=>{i(d.target.value)},c=()=>{const d=Number.parseInt(o,10);if(!Number.isNaN(d)&&d>=0&&d<=100){const p=new Event("input",{bubbles:!0});n(p,d)}else i(t.toString())},u=d=>{d.key==="Enter"&&(d.preventDefault(),c())};return s.jsxs(WXe,{children:[s.jsxs(BXe,{children:[s.jsx(Z,{id:"discrete-slider-always",children:e}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(J,{children:[s.jsx(NXe,{variant:"h3",children:"Rollout percentage"}),s.jsx(Z,{variant:"body2",children:"The rollout percentage determines the proportion of users exposed to a feature. It's based on the MurmurHash of a user's unique identifier, normalized to a number between 1 and 100. If the normalized hash is less than or equal to the rollout percentage, the user sees the feature. This ensures a consistent, random distribution of the feature among users."}),s.jsx(aF,{variant:"h3",children:"Stickiness"}),s.jsxs(Z,{variant:"body2",children:["Stickiness refers to the value used for hashing to ensure a consistent user experience. It determines the input for the MurmurHash, ensuring that a user's feature exposure remains consistent across sessions.",s.jsx("br",{}),"By default Unleash will use the first value present in the context in the order of"," ",s.jsx("b",{children:"userId, sessionId and random"}),"."]}),s.jsx(aF,{variant:"h3",children:"GroupId"}),s.jsx(Z,{variant:"body2",children:"The groupId is used as a seed for the hash function, ensuring consistent feature exposure across different feature flags for a uniform user experience."})]})})]}),s.jsxs(zXe,{children:[s.jsx(VXe,{children:s.jsx(FXe,{min:0,max:100,value:t,getAriaValueText:a,"aria-labelledby":"discrete-slider-always",step:1,"data-testid":wje,marks:GXe,onChange:n,valueLabelDisplay:"on",disabled:r})}),s.jsx(HXe,{children:s.jsx(UXe,{size:"small","aria-labelledby":"discrete-slider-always",type:"number",value:o,onChange:l,onBlur:c,onKeyDown:u,disabled:r,inputProps:{min:0,max:100,step:1},InputProps:{endAdornment:s.jsx(fp,{position:"end",children:"%"})}})})]})]})},dI=e=>s.jsx(qXe,{...e}),Og=e=>{const t=Number(Wa(e));return Number.isFinite(t)?t:0},Wa=e=>String(e??"").trim(),l0=e=>Wa(e).split(",").map(t=>t.trim()).filter(Boolean),YXe=x("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),lF=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),KXe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),XXe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"normal",wordBreak:"break-word"})),JXe=x("div")(({theme:e})=>({lineHeight:1.2,width:"100%"})),hZ=({label:e,editable:t,value:n,onChange:r,dataTestId:o})=>{const i=qt(),a=XQ(n),l=c=>{const u=a.find(d=>d.key===c);return s.jsxs(YXe,{children:[s.jsx(lF,{children:(u==null?void 0:u.label)||c}),(u==null?void 0:u.description)&&s.jsx(KXe,{children:u.description})]})};return s.jsxs(Is,{variant:"outlined",size:"small",sx:{width:"100%",marginBottom:i.spacing(2)},children:[s.jsx(Su,{htmlFor:"stickiness-select",children:e}),s.jsx($c,{id:"stickiness-select",name:"stickiness",label:e,value:n||"",disabled:!t,"data-testid":o,onChange:r,renderValue:l,MenuProps:{anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{width:"18%"}}},children:a.map(c=>s.jsx(Cr,{value:c.key,"data-testid":`${$R}-${c.label}`,sx:{padding:i.spacing(1,2)},children:s.jsxs(JXe,{children:[s.jsx(lF,{children:c.label}),c.description&&s.jsx(XXe,{children:c.description})]})},c.key))})]})},QXe="default",ZXe=e=>{const{project:t,loading:n,error:r}=um(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:QXe,mode:t.mode,loading:n,error:r}},eJe=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),tJe=x(J)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",width:"100%",justifyContent:"space-between"})),nJe=x(J)(({theme:e})=>({width:"50%",marginRight:e.spacing(.5)})),rJe=x(J)(({theme:e})=>({width:"50%",marginLeft:e.spacing(.5)})),oJe=({updateParameter:e,parameters:t,editable:n=!0,errors:r})=>{const o=Or("projectId"),i=$s("featureId"),{defaultStickiness:a,loading:l}=ZXe(o),{pathname:c}=Mr(),u=c.includes("default-strategy"),d=(g,v)=>{e("rollout",v.toString())},p=t.rollout!==void 0?Og(t.rollout):100,f=m.useMemo(()=>(!t.stickiness&&!l&&e("stickiness",a),Wa(t.stickiness)),[l,a,t.stickiness]);m.useEffect(()=>{!t.groupId&&!l&&(u||!i?e("groupId",""):e("groupId",i))},[u,i,l]);const h=Wa(t.groupId);return l?s.jsx(o0,{}):s.jsxs(eJe,{children:[s.jsx(dI,{name:"Rollout",value:p,disabled:!n,onChange:d}),s.jsxs(tJe,{children:[s.jsx(nJe,{children:s.jsx(hZ,{label:"Stickiness",value:f,editable:n,dataTestId:Cje,onChange:g=>e("stickiness",g.target.value)})}),s.jsx(rJe,{children:s.jsx(vr,{label:"groupId",sx:{width:"100%"},id:"groupId-input",value:h,disabled:!n,onChange:g=>e("groupId",Wa(g.target.value)),"data-testid":jje,error:!!(r!=null&&r.getFormError("groupId")),helperText:r==null?void 0:r.getFormError("groupId")})})]})]})},FC=({text:e,maxWidth:t,maxLength:n,className:r,...o})=>s.jsx(X,{condition:((e==null?void 0:e.length)??0)>n,show:s.jsx(kt,{title:e,arrow:!0,children:s.jsx("span",{"data-loading":!0,className:r,style:{maxWidth:`${t}px`,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},...o,children:e})}),elseShow:s.jsx("span",{className:r,children:e})}),iJe=x("div")(({theme:e})=>({display:"grid",gap:e.spacing(1)})),sJe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexWrap:"wrap"})),aJe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start"})),lJe=({name:e,list:t,setConfig:n,disabled:r,errors:o})=>{const[i,a]=m.useState(""),l="Enter",c=h=>{d(h)},u=h=>{(h==null?void 0:h.key)===l&&(d(h),h.preventDefault(),h.stopPropagation())},d=h=>{h.preventDefault();const g=h.target.value;if(g){const v=g.split(/,\s*/).filter(b=>!t.includes(b));if(v.length>0){const b=t.concat(v).filter(y=>y);n(e,b.join(","))}a("")}},p=h=>{t[h]=null,n(e,t.length===1?"":t.filter(Boolean).join(","))},f=h=>{a(h.currentTarget.value)};return s.jsxs(iJe,{children:[s.jsxs(Z,{variant:"subtitle2",component:"h2",children:["List of ",e]}),s.jsx(X,{condition:t.length>0,show:s.jsx(sJe,{children:t.map((h,g)=>s.jsx(da,{label:s.jsx(FC,{maxWidth:"300",text:h,maxLength:50}),onDelete:r?void 0:()=>p(g),title:"Remove value"},g+h))})}),s.jsx(X,{condition:!r,show:s.jsxs(aJe,{children:[s.jsx(xn,{error:!!o.getFormError(e),helperText:o.getFormError(e),name:"input_field",variant:"outlined",label:"Add items",id:"input-add-items",value:i,size:"small",placeholder:"",onBlur:c,onChange:f,onKeyDown:u,"data-testid":Eje}),s.jsx(Ue,{onClick:d,"data-testid":Tje,variant:"outlined",color:"secondary",startIcon:s.jsx(Oo,{}),children:"Add"})]})})]})},sv=({text:e})=>e?s.jsx(J,{sx:t=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallerBody,marginTop:t.spacing(1)}),children:e}):null,cJe=({definition:e,parameters:t,updateParameter:n,editable:r,errors:o})=>{const{type:i,name:a,description:l,required:c}=e,u=t[a],d=o.getFormError(a),p=c?`${a} * `:a,f=y=>{n(a,y.target.value)},h=y=>{n(a,Wa(y.target.value))},g=(y,w)=>{n(a,w.toString())},v=(y,w)=>{n(a,String(w))},b=(y,w)=>{n(y,l0(w).join(","))};if(i==="percentage")return s.jsxs("div",{children:[s.jsx(dI,{name:a,onChange:g,disabled:!r,value:Og(t[a]),minLabel:"off",maxLabel:"on"}),s.jsx(sv,{text:l})]});if(i==="list")return s.jsxs("div",{children:[s.jsx(lJe,{name:a,list:l0(t[a]),disabled:!r,setConfig:b,errors:o}),s.jsx(sv,{text:l})]});if(i==="number")return s.jsxs("div",{children:[s.jsx(xn,{error:!!d,helperText:d,variant:"outlined",size:"small","aria-required":c,style:{width:"100%"},disabled:!r,label:p,onChange:f,value:u}),s.jsx(sv,{text:l})]});if(i==="boolean"){const w=Wa(t[a])==="true";return s.jsxs("div",{children:[s.jsx(qr,{label:a,control:s.jsx(fa,{name:a,onChange:v,checked:w})}),s.jsx(sv,{text:l})]})}return s.jsxs("div",{children:[s.jsx(xn,{rows:1,placeholder:"",variant:"outlined",size:"small",style:{width:"100%"},"aria-required":c,disabled:!r,error:!!d,helperText:d,name:a,label:p,onChange:h,value:Wa(t[a])}),s.jsx(sv,{text:l})]})},uJe=cp("div")(({theme:e})=>({display:"grid",gap:e.spacing(4)})),gZ=({parameters:e,strategyDefinition:t,updateParameter:n,editable:r,errors:o})=>!t||t.parameters.length===0?null:s.jsx(uJe,{children:t.parameters.map((i,a)=>s.jsx("div",{children:s.jsx(cJe,{definition:i,parameters:e,updateParameter:n,editable:r,errors:o})},a))}),dJe=({hasAccess:e,strategy:t,strategyDefinition:n,setStrategy:r,validateParameter:o,errors:i})=>{const{context:a}=ya(),l=(c,u)=>{r(Ma(d=>{d.parameters=d.parameters??{},d.parameters[c]=u})),o(c,u)};switch(t.name){case"default":return s.jsx(fZ,{strategyDefinition:n});case"flexibleRollout":return s.jsx(oJe,{context:a,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i});default:return s.jsx(gZ,{strategyDefinition:n,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i})}},pJe=({projectId:e,featureId:t,environmentId:n})=>{const r=MI(e,t),{feature:o}=Al(e,t),i=s.jsx(xt,{to:r,children:"feature flag page"});return s.jsx(X,{condition:fJe(o,n),show:s.jsxs(Lt,{severity:"success",children:["This feature flag is currently enabled in the"," ",s.jsx("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit"," ",s.jsx("strong",{children:"save"}),"."]}),elseShow:s.jsxs(Lt,{severity:"info",children:["This feature flag is currently disabled in the"," ",s.jsx("strong",{children:n})," environment. Any changes made here will not take effect until the flag has been enabled on the ",i,"."]})})},fJe=(e,t)=>{const n=e.environments.find(r=>r.name===t);return n?n.enabled:!1},pI=x(({...e})=>s.jsx(J,{role:"separator",...e,children:"and"}))(({theme:e})=>({position:"absolute",top:e.spacing(-.5),left:e.spacing(2),transform:"translateY(-50%)",padding:e.spacing(.75,1),lineHeight:1,fontSize:e.fontSizes.smallerBody,color:e.palette.text.primary,background:e.palette.background.application,borderRadius:e.shape.borderRadiusExtraLarge,zIndex:e.zIndex.fab,textTransform:"uppercase"})),hJe=x("ul")(({theme:e})=>({display:"flex",flexDirection:"column",listStyle:"none",padding:0,margin:0,gap:e.spacing(1)})),mZ=x("div")(({theme:e})=>({position:"relative",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,background:e.palette.background.default,padding:e.spacing(1.5,2),display:"flex",flexFlow:"column",gap:e.spacing(1)})),gJe=x("li")({position:"relative"}),NC=({children:e})=>{const t=[];return m.Children.forEach(e,(n,r)=>{m.isValidElement(n)&&t.push(s.jsxs(gJe,{children:[r>0?s.jsx(pI,{},`${r}-divider`):null,n]},r))}),s.jsx(hJe,{children:t})},vZ="NOT_IN",fI="IN",yZ="STR_ENDS_WITH",xZ="STR_STARTS_WITH",bZ="STR_CONTAINS",wZ="NUM_EQ",SZ="NUM_GT",CZ="NUM_GTE",jZ="NUM_LT",EZ="NUM_LTE",hI="DATE_AFTER",TZ="DATE_BEFORE",kZ="SEMVER_EQ",_Z="SEMVER_GT",RZ="SEMVER_LT",mJe=[fI,vZ,bZ,xZ,yZ,wZ,SZ,CZ,jZ,EZ,TZ,hI,kZ,_Z,RZ],ch=e=>t=>e.includes(t),BC=[bZ,xZ,yZ],PZ=ch(BC),gI=[fI,vZ],vJe=ch(gI),mI=[wZ,SZ,CZ,jZ,EZ],AZ=ch(mI),zC=[TZ,hI],Dd=ch(zC),vI=[kZ,_Z,RZ],IZ=ch(vI),$Z=[...vI,...zC,...mI],yI=ch($Z),yJe=[...BC,...gI],OZ=ch(yJe);[...BC,...zC,...$Z];const c0="currentTime",MZ=e=>mJe.filter(t=>!(Dd(t)&&e!==c0||!Dd(t)&&e===c0)),HT=(e,t)=>t?bJe[e]:xJe[e],xJe={IN:"is one of",NOT_IN:"is not one of",STR_CONTAINS:"is a string that contains",STR_STARTS_WITH:"is a string that starts with",STR_ENDS_WITH:"is a string that ends with",NUM_EQ:"is a number equal to",NUM_GT:"is a number greater than",NUM_GTE:"is a number greater than or equal to",NUM_LT:"is a number less than",NUM_LTE:"is a number less than or equal to",DATE_BEFORE:"is a date before",DATE_AFTER:"is a date after",SEMVER_EQ:"is a SemVer equal to",SEMVER_GT:"is a SemVer greater than",SEMVER_LT:"is a SemVer less than"},bJe={IN:"is not one of",NOT_IN:"is one of",STR_CONTAINS:"is a string that does not contain",STR_STARTS_WITH:"is a string that does not start with",STR_ENDS_WITH:"is a string that does not end with",NUM_EQ:"is a number not equal to",NUM_GT:"is a number not greater than",NUM_GTE:"is a number less than",NUM_LT:"is a number not less than",NUM_LTE:"is a number greater than",DATE_BEFORE:"is a date not before",DATE_AFTER:"is a date not after",SEMVER_EQ:"is a SemVer not equal to",SEMVER_GT:"is a SemVer not greater than",SEMVER_LT:"is a SemVer not less than"},wJe=x($c)(({theme:e})=>({borderRadius:e.shape.borderRadius,padding:e.spacing(.25,0),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,fieldset:{border:"none"},transition:"all 0.03s ease","&:is(:hover, :focus-within)":{outline:`1px solid ${e.palette.primary.main}`},"&::before,&::after":{border:"none"},".MuiInput-input":{paddingBlock:e.spacing(.25)},":focus-within .MuiSelect-select":{background:"none"}})),SJe=x(Cr,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),CJe=x("span")(({theme:e})=>({paddingInline:e.spacing(1)})),jJe=({options:e,value:t,onChange:n,inverted:r})=>{const o=m.useId(),i=m.useId(),a=c=>{n(c.target.value)},l=()=>s.jsx(CJe,{children:HT(t,r)});return s.jsxs(Is,{variant:"standard",size:"small",hiddenLabel:!0,children:[s.jsx(Bc,{children:s.jsx(Su,{id:i,htmlFor:o,children:"Operator"})}),s.jsx(wJe,{id:o,labelId:i,name:"operator",disableUnderline:!0,value:t,onChange:a,renderValue:l,IconComponent:am,children:e.map(c=>s.jsx(SJe,{value:c,separator:EJe(e,c),children:HT(c,r)},c))})]})},EJe=(e,t)=>t===e[0]?!1:TJe.some(n=>n[0]===t),TJe=[gI,BC,mI,zC,vI];var xI={},kJe=Te;Object.defineProperty(xI,"__esModule",{value:!0});var bI=xI.default=void 0,_Je=kJe(ke()),RJe=s,PJe=(0,_Je.default)((0,RJe.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");bI=xI.default=PJe;const AJe=x("div")({display:"contents"}),IJe=x("ul")({listStyle:"none",display:"contents"}),DZ=e=>({":hover":{background:e.palette.secondary.light},":focus-visible":{background:e.palette.background.elevation1,outlineColor:e.palette.secondary.dark},background:e.palette.background.elevation1,color:e.palette.text.primary,height:"auto",outline:"1px solid #0000",transition:"all 0.3s ease"}),LZ=x(m.forwardRef((e,t)=>s.jsx(da,{size:"small",...e,ref:t,deleteIcon:s.jsx(bI,{})})))(({theme:e})=>({...DZ(e),color:e.palette.text.primary,padding:0,height:"auto","& .MuiChip-label":{paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),paddingLeft:e.spacing(1.5)},"& .MuiChip-deleteIcon":{marginRight:e.spacing(1)},svg:{fill:e.palette.secondary.dark,borderRadius:"50%",outline:"2px solid #0000",transition:"inherit",":focus-visible,:hover":{backgroundColor:e.palette.table.headerHover,outlineColor:e.palette.table.headerHover}}})),$Je=({values:e=[],removeValue:t,getExternalFocusTarget:n,children:r})=>{const o=m.useRef([]),i=a=>a===e.length-1?a===0?n():o.current[a-1]:o.current[a+1];return s.jsxs(AJe,{children:[s.jsx(IJe,{children:e.map((a,l)=>s.jsx("li",{children:s.jsx(LZ,{ref:c=>{o.current[l]=c},sx:{height:"auto","& .MuiChip-label":{display:"block",whiteSpace:"normal"}},label:a,onDelete:()=>{var c;(c=i(l))==null||c.focus(),t(a)}})},a))}),r]})},FZ=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},m.createElement("path",{fill:"#6C65E5",d:"m6.324 14.25-.739 1.971a.68.68 0 0 1-.28.378.816.816 0 0 1-.458.133.814.814 0 0 1-.688-.34.713.713 0 0 1-.102-.73l3.21-8.127a.89.89 0 0 1 .305-.389A.809.809 0 0 1 8.056 7h.662c.187 0 .348.049.484.146a.89.89 0 0 1 .305.39l3.21 8.15a.705.705 0 0 1-.09.718.79.79 0 0 1-.675.328.809.809 0 0 1-.484-.146.89.89 0 0 1-.305-.389l-.713-1.946H6.324Zm.535-1.41h3.056L8.438 8.8h-.102l-1.477 4.04ZM16.256 17c-.832 0-1.485-.207-1.96-.62-.476-.414-.714-.978-.714-1.691 0-.682.276-1.237.828-1.667.552-.43 1.26-.645 2.126-.645.39 0 .752.028 1.083.085.33.057.615.15.853.28v-.34c0-.438-.157-.787-.471-1.047-.314-.26-.743-.39-1.286-.39a2.377 2.377 0 0 0-1.35.415.981.981 0 0 1-.51.194.723.723 0 0 1-.509-.146.636.636 0 0 1-.267-.426.494.494 0 0 1 .165-.45 3.474 3.474 0 0 1 1.095-.632 4.141 4.141 0 0 1 1.401-.22c1.053 0 1.86.24 2.42.719.56.478.84 1.171.84 2.08v3.698c0 .195-.072.361-.216.499a.729.729 0 0 1-.523.207.75.75 0 0 1-.534-.22.686.686 0 0 1-.23-.51v-.22h-.076c-.22.325-.518.58-.891.767-.374.187-.798.28-1.274.28Zm.255-1.216c.543 0 1.006-.183 1.388-.548.382-.365.573-.807.573-1.326a2.985 2.985 0 0 0-.815-.292 4.071 4.071 0 0 0-.84-.097c-.544 0-.96.101-1.248.304-.289.203-.433.49-.433.864 0 .324.127.588.382.79.254.203.585.305.993.305Z"})),OJe=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},m.createElement("path",{fill:"#9F9FA1",d:"m6.324 14.25-.739 1.971a.68.68 0 0 1-.28.378.816.816 0 0 1-.458.133.814.814 0 0 1-.688-.34.713.713 0 0 1-.102-.73l3.21-8.127a.89.89 0 0 1 .305-.389A.809.809 0 0 1 8.056 7h.662c.187 0 .348.049.484.146a.89.89 0 0 1 .305.39l3.21 8.15a.705.705 0 0 1-.09.718.79.79 0 0 1-.675.328.809.809 0 0 1-.484-.146.89.89 0 0 1-.305-.389l-.713-1.946H6.324Zm.535-1.41h3.056L8.438 8.8h-.102l-1.477 4.04ZM16.256 17c-.832 0-1.485-.207-1.96-.62-.476-.414-.714-.978-.714-1.691 0-.682.276-1.237.828-1.667.552-.43 1.26-.645 2.126-.645.39 0 .752.028 1.083.085.33.057.615.15.853.28v-.34c0-.438-.157-.787-.471-1.047-.314-.26-.743-.39-1.286-.39a2.377 2.377 0 0 0-1.35.415.981.981 0 0 1-.51.194.723.723 0 0 1-.509-.146.636.636 0 0 1-.267-.426.494.494 0 0 1 .165-.45 3.474 3.474 0 0 1 1.095-.632 4.141 4.141 0 0 1 1.401-.22c1.053 0 1.86.24 2.42.719.56.478.84 1.171.84 2.08v3.698c0 .195-.072.361-.216.499a.729.729 0 0 1-.523.207.75.75 0 0 1-.534-.22.686.686 0 0 1-.23-.51v-.22h-.076c-.22.325-.518.58-.891.767-.374.187-.798.28-1.274.28Zm.255-1.216c.543 0 1.006-.183 1.388-.548.382-.365.573-.807.573-1.326a2.985 2.985 0 0 0-.815-.292 4.071 4.071 0 0 0-.84-.097c-.544 0-.96.101-1.248.304-.289.203-.433.49-.433.864 0 .324.127.588.382.79.254.203.585.305.993.305Z"}),m.createElement("rect",{width:1,height:15.9,x:15.442,y:5,fill:"#6E6E70",rx:.5,transform:"rotate(32.071 15.442 5)"})),MJe=x(_l)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),width:"250px"},"&.MuiPopover-root":{pointerEvents:"none"},"& .MuiPopover-paper":{pointerEvents:"all"}})),DJe=x(xn)(({theme:e})=>({flexGrow:1})),LJe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start",width:"100%"})),FJe=x("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.caption.fontSize})),NJe=x(Ue)(({theme:e})=>({minWidth:e.spacing(4)})),NZ=({initialValue:e,onAdd:t,anchorEl:n,open:r,onClose:o,helpText:i,inputProps:a})=>{const[l,c]=m.useState(e||""),[u,d]=m.useState(""),p=m.useRef(null),f=m.useId(),h=m.useId();return s.jsx(MJe,{open:r,onTransitionEnter:()=>{var g;(g=p==null?void 0:p.current)==null||g.select()},disableScrollLock:!0,anchorEl:n,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:s.jsx(tm,{onClickAway:o,children:s.jsxs("form",{onSubmit:g=>{if(g.stopPropagation(),g.preventDefault(),l!=null&&l.trim())t(l,{setError:d,clearInput:()=>c("")});else{d("Value cannot be empty or whitespace");return}},children:[s.jsxs(LJe,{children:[s.jsx(Bc,{children:s.jsx("label",{htmlFor:f,children:"Constraint Value"})}),s.jsx(DJe,{id:f,placeholder:"Enter value",value:l,onChange:g=>{c(g.target.value),d("")},size:"small",variant:"standard",fullWidth:!0,inputRef:p,autoFocus:!0,error:!!u,helperText:u,"aria-describedby":h,inputProps:{...a},"data-testid":"CONSTRAINT_VALUES_INPUT"}),s.jsx(NJe,{variant:"text",type:"submit",size:"small",color:"primary",disabled:!(l!=null&&l.trim()),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add"})]}),s.jsx(FJe,{id:h,children:i})]})})})},BJe=x("button")(({theme:e})=>({...DZ(e),color:e.palette.primary.main,svg:{fill:e.palette.primary.main,height:e.fontSizes.smallerBody,width:e.fontSizes.smallerBody},border:"none",borderRadius:e.shape.borderRadiusExtraLarge,display:"flex",flexFlow:"row nowrap",whiteSpace:"nowrap",gap:e.spacing(.25),alignItems:"center",padding:e.spacing(.5,1.5,.5,1.5),height:"auto",cursor:"pointer"})),zJe=m.forwardRef(({onAddValues:e,helpText:t,validator:n},r)=>{const[o,i]=m.useState(!1),a=m.useRef(null);m.useImperativeHandle(r,()=>a.current);const l=(c,{setError:u,clearInput:d})=>{const p=l0(c);if(p.length===0){u("Values cannot be empty");return}if(p.some(g=>g.length>100)){u("Values cannot be longer than 100 characters");return}const[f,h]=n(...p);f?(e(p),d(),u("")):u(h)};return s.jsxs(s.Fragment,{children:[s.jsxs(BJe,{ref:a,onClick:()=>i(!0),type:"button","data-testid":"CONSTRAINT_ADD_VALUES_BUTTON",children:[s.jsx(Oo,{}),s.jsx("span",{children:"Add values"})]}),s.jsx(NZ,{onAdd:l,helpText:t,open:o,anchorEl:a.current,onClose:()=>i(!1)})]})}),HJe=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},m.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"})),WJe=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},m.createElement("path",{fill:"#9F9FA1",d:"M9.29 11.887V10.48h4.581v1.407H9.29Zm0 2.343v-1.406h4.581v1.406H9.29Z"}),m.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)"})),VJe=x(LZ,{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}})),cF=m.forwardRef(({currentValue:e,onAddValue:t,removeValue:n,helpText:r,inputType:o,validator:i},a)=>{const[l,c]=m.useState(!1),u=m.useRef(null);m.useImperativeHandle(a,()=>u.current);const d=(p,{setError:f})=>{if(p.length>100){f("Values cannot be longer than 100 characters");return}const[h,g]=i(p);if(h)t(p),f(""),c(!1);else{f(g);return}};return s.jsxs(s.Fragment,{children:[s.jsx(VJe,{hasValue:!!e,ref:u,label:e||"Add value",onClick:()=>c(!0),icon:e?void 0:s.jsx(Oo,{}),onDelete:e?n:void 0}),s.jsx(NZ,{inputProps:{inputMode:o==="number"?"decimal":"text"},initialValue:e,onAdd:d,helpText:r,open:l,anchorEl:u.current,onClose:()=>c(!1)})]})});function BZ(e,t,n){return(t=GJe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function WT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uF(Object(n),!0).forEach(function(r){BZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uF(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function UJe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function GJe(e){var t=UJe(e,"string");return typeof t=="symbol"?t:t+""}var qJe={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestine",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Türkiye",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands (UK)",VI:"Virgin Islands (US)",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},YJe={"Africa/Abidjan":{u:0,c:["CI","BF","GH","GM","GN","IS","ML","MR","SH","SL","SN","TG"]},"Africa/Accra":{a:"Africa/Abidjan",c:["GH"],r:1},"Africa/Addis_Ababa":{a:"Africa/Nairobi",c:["ET"],r:1},"Africa/Algiers":{u:60,c:["DZ"]},"Africa/Asmara":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Asmera":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Bamako":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Bangui":{a:"Africa/Lagos",c:["CF"],r:1},"Africa/Banjul":{a:"Africa/Abidjan",c:["GM"],r:1},"Africa/Bissau":{u:0,c:["GW"]},"Africa/Blantyre":{a:"Africa/Maputo",c:["MW"],r:1},"Africa/Brazzaville":{a:"Africa/Lagos",c:["CG"],r:1},"Africa/Bujumbura":{a:"Africa/Maputo",c:["BI"],r:1},"Africa/Cairo":{u:120,d:180,c:["EG"]},"Africa/Casablanca":{u:60,d:0,c:["MA"]},"Africa/Ceuta":{u:60,d:120,c:["ES"]},"Africa/Conakry":{a:"Africa/Abidjan",c:["GN"],r:1},"Africa/Dakar":{a:"Africa/Abidjan",c:["SN"],r:1},"Africa/Dar_es_Salaam":{a:"Africa/Nairobi",c:["TZ"],r:1},"Africa/Djibouti":{a:"Africa/Nairobi",c:["DJ"],r:1},"Africa/Douala":{a:"Africa/Lagos",c:["CM"],r:1},"Africa/El_Aaiun":{u:60,d:0,c:["EH"]},"Africa/Freetown":{a:"Africa/Abidjan",c:["SL"],r:1},"Africa/Gaborone":{a:"Africa/Maputo",c:["BW"],r:1},"Africa/Harare":{a:"Africa/Maputo",c:["ZW"],r:1},"Africa/Johannesburg":{u:120,c:["ZA","LS","SZ"]},"Africa/Juba":{u:120,c:["SS"]},"Africa/Kampala":{a:"Africa/Nairobi",c:["UG"],r:1},"Africa/Khartoum":{u:120,c:["SD"]},"Africa/Kigali":{a:"Africa/Maputo",c:["RW"],r:1},"Africa/Kinshasa":{a:"Africa/Lagos",c:["CD"],r:1},"Africa/Lagos":{u:60,c:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"Africa/Libreville":{a:"Africa/Lagos",c:["GA"],r:1},"Africa/Lome":{a:"Africa/Abidjan",c:["TG"],r:1},"Africa/Luanda":{a:"Africa/Lagos",c:["AO"],r:1},"Africa/Lubumbashi":{a:"Africa/Maputo",c:["CD"],r:1},"Africa/Lusaka":{a:"Africa/Maputo",c:["ZM"],r:1},"Africa/Malabo":{a:"Africa/Lagos",c:["GQ"],r:1},"Africa/Maputo":{u:120,c:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Maseru":{a:"Africa/Johannesburg",c:["LS"],r:1},"Africa/Mbabane":{a:"Africa/Johannesburg",c:["SZ"],r:1},"Africa/Mogadishu":{a:"Africa/Nairobi",c:["SO"],r:1},"Africa/Monrovia":{u:0,c:["LR"]},"Africa/Nairobi":{u:180,c:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Africa/Ndjamena":{u:60,c:["TD"]},"Africa/Niamey":{a:"Africa/Lagos",c:["NE"],r:1},"Africa/Nouakchott":{a:"Africa/Abidjan",c:["MR"],r:1},"Africa/Ouagadougou":{a:"Africa/Abidjan",c:["BF"],r:1},"Africa/Porto-Novo":{a:"Africa/Lagos",c:["BJ"],r:1},"Africa/Sao_Tome":{u:0,c:["ST"]},"Africa/Timbuktu":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Tripoli":{u:120,c:["LY"]},"Africa/Tunis":{u:60,c:["TN"]},"Africa/Windhoek":{u:120,c:["NA"]},"America/Adak":{u:-600,d:-540,c:["US"]},"America/Anchorage":{u:-540,d:-480,c:["US"]},"America/Anguilla":{a:"America/Puerto_Rico",c:["AI"],r:1},"America/Antigua":{a:"America/Puerto_Rico",c:["AG"],r:1},"America/Araguaina":{u:-180,c:["BR"]},"America/Argentina/Buenos_Aires":{u:-180,c:["AR"]},"America/Argentina/Catamarca":{u:-180,c:["AR"]},"America/Argentina/ComodRivadavia":{a:"America/Argentina/Catamarca",r:1},"America/Argentina/Cordoba":{u:-180,c:["AR"]},"America/Argentina/Jujuy":{u:-180,c:["AR"]},"America/Argentina/La_Rioja":{u:-180,c:["AR"]},"America/Argentina/Mendoza":{u:-180,c:["AR"]},"America/Argentina/Rio_Gallegos":{u:-180,c:["AR"]},"America/Argentina/Salta":{u:-180,c:["AR"]},"America/Argentina/San_Juan":{u:-180,c:["AR"]},"America/Argentina/San_Luis":{u:-180,c:["AR"]},"America/Argentina/Tucuman":{u:-180,c:["AR"]},"America/Argentina/Ushuaia":{u:-180,c:["AR"]},"America/Aruba":{a:"America/Puerto_Rico",c:["AW"],r:1},"America/Asuncion":{u:-240,d:-180,c:["PY"]},"America/Atikokan":{a:"America/Panama",c:["CA"],r:1},"America/Atka":{a:"America/Adak",r:1},"America/Bahia":{u:-180,c:["BR"]},"America/Bahia_Banderas":{u:-360,c:["MX"]},"America/Barbados":{u:-240,c:["BB"]},"America/Belem":{u:-180,c:["BR"]},"America/Belize":{u:-360,c:["BZ"]},"America/Blanc-Sablon":{a:"America/Puerto_Rico",c:["CA"],r:1},"America/Boa_Vista":{u:-240,c:["BR"]},"America/Bogota":{u:-300,c:["CO"]},"America/Boise":{u:-420,d:-360,c:["US"]},"America/Buenos_Aires":{a:"America/Argentina/Buenos_Aires",r:1},"America/Cambridge_Bay":{u:-420,d:-360,c:["CA"]},"America/Campo_Grande":{u:-240,c:["BR"]},"America/Cancun":{u:-300,c:["MX"]},"America/Caracas":{u:-240,c:["VE"]},"America/Catamarca":{a:"America/Argentina/Catamarca",r:1},"America/Cayenne":{u:-180,c:["GF"]},"America/Cayman":{a:"America/Panama",c:["KY"],r:1},"America/Chicago":{u:-360,d:-300,c:["US"]},"America/Chihuahua":{u:-360,c:["MX"]},"America/Ciudad_Juarez":{u:-420,d:-360,c:["MX"]},"America/Coral_Harbour":{a:"America/Panama",c:["CA"],r:1},"America/Cordoba":{a:"America/Argentina/Cordoba",r:1},"America/Costa_Rica":{u:-360,c:["CR"]},"America/Creston":{a:"America/Phoenix",c:["CA"],r:1},"America/Cuiaba":{u:-240,c:["BR"]},"America/Curacao":{a:"America/Puerto_Rico",c:["CW"],r:1},"America/Danmarkshavn":{u:0,c:["GL"]},"America/Dawson":{u:-420,c:["CA"]},"America/Dawson_Creek":{u:-420,c:["CA"]},"America/Denver":{u:-420,d:-360,c:["US"]},"America/Detroit":{u:-300,d:-240,c:["US"]},"America/Dominica":{a:"America/Puerto_Rico",c:["DM"],r:1},"America/Edmonton":{u:-420,d:-360,c:["CA"]},"America/Eirunepe":{u:-300,c:["BR"]},"America/El_Salvador":{u:-360,c:["SV"]},"America/Ensenada":{a:"America/Tijuana",r:1},"America/Fort_Nelson":{u:-420,c:["CA"]},"America/Fort_Wayne":{a:"America/Indiana/Indianapolis",r:1},"America/Fortaleza":{u:-180,c:["BR"]},"America/Glace_Bay":{u:-240,d:-180,c:["CA"]},"America/Godthab":{a:"America/Nuuk",r:1},"America/Goose_Bay":{u:-240,d:-180,c:["CA"]},"America/Grand_Turk":{u:-300,d:-240,c:["TC"]},"America/Grenada":{a:"America/Puerto_Rico",c:["GD"],r:1},"America/Guadeloupe":{a:"America/Puerto_Rico",c:["GP"],r:1},"America/Guatemala":{u:-360,c:["GT"]},"America/Guayaquil":{u:-300,c:["EC"]},"America/Guyana":{u:-240,c:["GY"]},"America/Halifax":{u:-240,d:-180,c:["CA"]},"America/Havana":{u:-300,d:-240,c:["CU"]},"America/Hermosillo":{u:-420,c:["MX"]},"America/Indiana/Indianapolis":{u:-300,d:-240,c:["US"]},"America/Indiana/Knox":{u:-360,d:-300,c:["US"]},"America/Indiana/Marengo":{u:-300,d:-240,c:["US"]},"America/Indiana/Petersburg":{u:-300,d:-240,c:["US"]},"America/Indiana/Tell_City":{u:-360,d:-300,c:["US"]},"America/Indiana/Vevay":{u:-300,d:-240,c:["US"]},"America/Indiana/Vincennes":{u:-300,d:-240,c:["US"]},"America/Indiana/Winamac":{u:-300,d:-240,c:["US"]},"America/Indianapolis":{a:"America/Indiana/Indianapolis",r:1},"America/Inuvik":{u:-420,d:-360,c:["CA"]},"America/Iqaluit":{u:-300,d:-240,c:["CA"]},"America/Jamaica":{u:-300,c:["JM"]},"America/Jujuy":{a:"America/Argentina/Jujuy",r:1},"America/Juneau":{u:-540,d:-480,c:["US"]},"America/Kentucky/Louisville":{u:-300,d:-240,c:["US"]},"America/Kentucky/Monticello":{u:-300,d:-240,c:["US"]},"America/Knox_IN":{a:"America/Indiana/Knox",r:1},"America/Kralendijk":{a:"America/Puerto_Rico",c:["BQ"],r:1},"America/La_Paz":{u:-240,c:["BO"]},"America/Lima":{u:-300,c:["PE"]},"America/Los_Angeles":{u:-480,d:-420,c:["US"]},"America/Louisville":{a:"America/Kentucky/Louisville",r:1},"America/Lower_Princes":{a:"America/Puerto_Rico",c:["SX"],r:1},"America/Maceio":{u:-180,c:["BR"]},"America/Managua":{u:-360,c:["NI"]},"America/Manaus":{u:-240,c:["BR"]},"America/Marigot":{a:"America/Puerto_Rico",c:["MF"],r:1},"America/Martinique":{u:-240,c:["MQ"]},"America/Matamoros":{u:-360,d:-300,c:["MX"]},"America/Mazatlan":{u:-420,c:["MX"]},"America/Mendoza":{a:"America/Argentina/Mendoza",r:1},"America/Menominee":{u:-360,d:-300,c:["US"]},"America/Merida":{u:-360,c:["MX"]},"America/Metlakatla":{u:-540,d:-480,c:["US"]},"America/Mexico_City":{u:-360,c:["MX"]},"America/Miquelon":{u:-180,d:-120,c:["PM"]},"America/Moncton":{u:-240,d:-180,c:["CA"]},"America/Monterrey":{u:-360,c:["MX"]},"America/Montevideo":{u:-180,c:["UY"]},"America/Montreal":{a:"America/Toronto",c:["CA"],r:1},"America/Montserrat":{a:"America/Puerto_Rico",c:["MS"],r:1},"America/Nassau":{a:"America/Toronto",c:["BS"],r:1},"America/New_York":{u:-300,d:-240,c:["US"]},"America/Nipigon":{a:"America/Toronto",c:["CA"],r:1},"America/Nome":{u:-540,d:-480,c:["US"]},"America/Noronha":{u:-120,c:["BR"]},"America/North_Dakota/Beulah":{u:-360,d:-300,c:["US"]},"America/North_Dakota/Center":{u:-360,d:-300,c:["US"]},"America/North_Dakota/New_Salem":{u:-360,d:-300,c:["US"]},"America/Nuuk":{u:-120,d:-60,c:["GL"]},"America/Ojinaga":{u:-360,d:-300,c:["MX"]},"America/Panama":{u:-300,c:["PA","CA","KY"]},"America/Pangnirtung":{a:"America/Iqaluit",r:1},"America/Paramaribo":{u:-180,c:["SR"]},"America/Phoenix":{u:-420,c:["US","CA"]},"America/Port-au-Prince":{u:-300,d:-240,c:["HT"]},"America/Port_of_Spain":{a:"America/Puerto_Rico",c:["TT"],r:1},"America/Porto_Acre":{a:"America/Rio_Branco",r:1},"America/Porto_Velho":{u:-240,c:["BR"]},"America/Puerto_Rico":{u:-240,c:["PR","AG","CA","AI","AW","BL","BQ","CW","DM","GD","GP","KN","LC","MF","MS","SX","TT","VC","VG","VI"]},"America/Punta_Arenas":{u:-180,c:["CL"]},"America/Rainy_River":{a:"America/Winnipeg",r:1},"America/Rankin_Inlet":{u:-360,d:-300,c:["CA"]},"America/Recife":{u:-180,c:["BR"]},"America/Regina":{u:-360,c:["CA"]},"America/Resolute":{u:-360,d:-300,c:["CA"]},"America/Rio_Branco":{u:-300,c:["BR"]},"America/Rosario":{a:"America/Argentina/Cordoba",r:1},"America/Santa_Isabel":{a:"America/Tijuana",r:1},"America/Santarem":{u:-180,c:["BR"]},"America/Santiago":{u:-240,d:-180,c:["CL"]},"America/Santo_Domingo":{u:-240,c:["DO"]},"America/Sao_Paulo":{u:-180,c:["BR"]},"America/Scoresbysund":{u:-120,d:-60,c:["GL"]},"America/Shiprock":{a:"America/Denver",r:1},"America/Sitka":{u:-540,d:-480,c:["US"]},"America/St_Barthelemy":{a:"America/Puerto_Rico",c:["BL"],r:1},"America/St_Johns":{u:-210,d:-150,c:["CA"]},"America/St_Kitts":{a:"America/Puerto_Rico",c:["KN"],r:1},"America/St_Lucia":{a:"America/Puerto_Rico",c:["LC"],r:1},"America/St_Thomas":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/St_Vincent":{a:"America/Puerto_Rico",c:["VC"],r:1},"America/Swift_Current":{u:-360,c:["CA"]},"America/Tegucigalpa":{u:-360,c:["HN"]},"America/Thule":{u:-240,d:-180,c:["GL"]},"America/Thunder_Bay":{a:"America/Toronto",c:["CA"],r:1},"America/Tijuana":{u:-480,d:-420,c:["MX"]},"America/Toronto":{u:-300,d:-240,c:["CA","BS"]},"America/Tortola":{a:"America/Puerto_Rico",c:["VG"],r:1},"America/Vancouver":{u:-480,d:-420,c:["CA"]},"America/Virgin":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/Whitehorse":{u:-420,c:["CA"]},"America/Winnipeg":{u:-360,d:-300,c:["CA"]},"America/Yakutat":{u:-540,d:-480,c:["US"]},"America/Yellowknife":{a:"America/Edmonton",r:1},"Antarctica/Casey":{u:480,c:["AQ"]},"Antarctica/Davis":{u:420,c:["AQ"]},"Antarctica/DumontDUrville":{a:"Pacific/Port_Moresby",c:["AQ"],r:1},"Antarctica/Macquarie":{u:600,d:660,c:["AU"]},"Antarctica/Mawson":{u:300,c:["AQ"]},"Antarctica/McMurdo":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Palmer":{u:-180,c:["AQ"]},"Antarctica/Rothera":{u:-180,c:["AQ"]},"Antarctica/South_Pole":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Syowa":{a:"Asia/Riyadh",c:["AQ"],r:1},"Antarctica/Troll":{u:0,d:120,c:["AQ"]},"Antarctica/Vostok":{u:300,c:["AQ"]},"Arctic/Longyearbyen":{a:"Europe/Berlin",c:["SJ"],r:1},"Asia/Aden":{a:"Asia/Riyadh",c:["YE"],r:1},"Asia/Almaty":{u:300,c:["KZ"]},"Asia/Amman":{u:180,c:["JO"]},"Asia/Anadyr":{u:720,c:["RU"]},"Asia/Aqtau":{u:300,c:["KZ"]},"Asia/Aqtobe":{u:300,c:["KZ"]},"Asia/Ashgabat":{u:300,c:["TM"]},"Asia/Ashkhabad":{a:"Asia/Ashgabat",r:1},"Asia/Atyrau":{u:300,c:["KZ"]},"Asia/Baghdad":{u:180,c:["IQ"]},"Asia/Bahrain":{a:"Asia/Qatar",c:["BH"],r:1},"Asia/Baku":{u:240,c:["AZ"]},"Asia/Bangkok":{u:420,c:["TH","CX","KH","LA","VN"]},"Asia/Barnaul":{u:420,c:["RU"]},"Asia/Beirut":{u:120,d:180,c:["LB"]},"Asia/Bishkek":{u:360,c:["KG"]},"Asia/Brunei":{a:"Asia/Kuching",c:["BN"],r:1},"Asia/Calcutta":{a:"Asia/Kolkata",r:1},"Asia/Chita":{u:540,c:["RU"]},"Asia/Choibalsan":{a:"Asia/Ulaanbaatar",r:1},"Asia/Chongqing":{a:"Asia/Shanghai",r:1},"Asia/Chungking":{a:"Asia/Shanghai",r:1},"Asia/Colombo":{u:330,c:["LK"]},"Asia/Dacca":{a:"Asia/Dhaka",r:1},"Asia/Damascus":{u:180,c:["SY"]},"Asia/Dhaka":{u:360,c:["BD"]},"Asia/Dili":{u:540,c:["TL"]},"Asia/Dubai":{u:240,c:["AE","OM","RE","SC","TF"]},"Asia/Dushanbe":{u:300,c:["TJ"]},"Asia/Famagusta":{u:120,d:180,c:["CY"]},"Asia/Gaza":{u:120,d:180,c:["PS"]},"Asia/Harbin":{a:"Asia/Shanghai",r:1},"Asia/Hebron":{u:120,d:180,c:["PS"]},"Asia/Ho_Chi_Minh":{u:420,c:["VN"]},"Asia/Hong_Kong":{u:480,c:["HK"]},"Asia/Hovd":{u:420,c:["MN"]},"Asia/Irkutsk":{u:480,c:["RU"]},"Asia/Istanbul":{a:"Europe/Istanbul",r:1},"Asia/Jakarta":{u:420,c:["ID"]},"Asia/Jayapura":{u:540,c:["ID"]},"Asia/Jerusalem":{u:120,d:180,c:["IL"]},"Asia/Kabul":{u:270,c:["AF"]},"Asia/Kamchatka":{u:720,c:["RU"]},"Asia/Karachi":{u:300,c:["PK"]},"Asia/Kashgar":{a:"Asia/Urumqi",r:1},"Asia/Kathmandu":{u:345,c:["NP"]},"Asia/Katmandu":{a:"Asia/Kathmandu",r:1},"Asia/Khandyga":{u:540,c:["RU"]},"Asia/Kolkata":{u:330,c:["IN"]},"Asia/Krasnoyarsk":{u:420,c:["RU"]},"Asia/Kuala_Lumpur":{a:"Asia/Singapore",c:["MY"],r:1},"Asia/Kuching":{u:480,c:["MY","BN"]},"Asia/Kuwait":{a:"Asia/Riyadh",c:["KW"],r:1},"Asia/Macao":{a:"Asia/Macau",r:1},"Asia/Macau":{u:480,c:["MO"]},"Asia/Magadan":{u:660,c:["RU"]},"Asia/Makassar":{u:480,c:["ID"]},"Asia/Manila":{u:480,c:["PH"]},"Asia/Muscat":{a:"Asia/Dubai",c:["OM"],r:1},"Asia/Nicosia":{u:120,d:180,c:["CY"]},"Asia/Novokuznetsk":{u:420,c:["RU"]},"Asia/Novosibirsk":{u:420,c:["RU"]},"Asia/Omsk":{u:360,c:["RU"]},"Asia/Oral":{u:300,c:["KZ"]},"Asia/Phnom_Penh":{a:"Asia/Bangkok",c:["KH"],r:1},"Asia/Pontianak":{u:420,c:["ID"]},"Asia/Pyongyang":{u:540,c:["KP"]},"Asia/Qatar":{u:180,c:["QA","BH"]},"Asia/Qostanay":{u:300,c:["KZ"]},"Asia/Qyzylorda":{u:300,c:["KZ"]},"Asia/Rangoon":{a:"Asia/Yangon",c:["MM"],r:1},"Asia/Riyadh":{u:180,c:["SA","AQ","KW","YE"]},"Asia/Saigon":{a:"Asia/Ho_Chi_Minh",r:1},"Asia/Sakhalin":{u:660,c:["RU"]},"Asia/Samarkand":{u:300,c:["UZ"]},"Asia/Seoul":{u:540,c:["KR"]},"Asia/Shanghai":{u:480,c:["CN"]},"Asia/Singapore":{u:480,c:["SG","MY"]},"Asia/Srednekolymsk":{u:660,c:["RU"]},"Asia/Taipei":{u:480,c:["TW"]},"Asia/Tashkent":{u:300,c:["UZ"]},"Asia/Tbilisi":{u:240,c:["GE"]},"Asia/Tehran":{u:210,c:["IR"]},"Asia/Tel_Aviv":{a:"Asia/Jerusalem",r:1},"Asia/Thimbu":{a:"Asia/Thimphu",r:1},"Asia/Thimphu":{u:360,c:["BT"]},"Asia/Tokyo":{u:540,c:["JP"]},"Asia/Tomsk":{u:420,c:["RU"]},"Asia/Ujung_Pandang":{a:"Asia/Makassar",r:1},"Asia/Ulaanbaatar":{u:480,c:["MN"]},"Asia/Ulan_Bator":{a:"Asia/Ulaanbaatar",r:1},"Asia/Urumqi":{u:360,c:["CN"]},"Asia/Ust-Nera":{u:600,c:["RU"]},"Asia/Vientiane":{a:"Asia/Bangkok",c:["LA"],r:1},"Asia/Vladivostok":{u:600,c:["RU"]},"Asia/Yakutsk":{u:540,c:["RU"]},"Asia/Yangon":{u:390,c:["MM","CC"]},"Asia/Yekaterinburg":{u:300,c:["RU"]},"Asia/Yerevan":{u:240,c:["AM"]},"Atlantic/Azores":{u:-60,d:0,c:["PT"]},"Atlantic/Bermuda":{u:-240,d:-180,c:["BM"]},"Atlantic/Canary":{u:0,d:60,c:["ES"]},"Atlantic/Cape_Verde":{u:-60,c:["CV"]},"Atlantic/Faeroe":{a:"Atlantic/Faroe",r:1},"Atlantic/Faroe":{u:0,d:60,c:["FO"]},"Atlantic/Jan_Mayen":{a:"Europe/Berlin",c:["SJ"],r:1},"Atlantic/Madeira":{u:0,d:60,c:["PT"]},"Atlantic/Reykjavik":{a:"Africa/Abidjan",c:["IS"],r:1},"Atlantic/South_Georgia":{u:-120,c:["GS"]},"Atlantic/St_Helena":{a:"Africa/Abidjan",c:["SH"],r:1},"Atlantic/Stanley":{u:-180,c:["FK"]},"Australia/ACT":{a:"Australia/Sydney",r:1},"Australia/Adelaide":{u:570,d:630,c:["AU"]},"Australia/Brisbane":{u:600,c:["AU"]},"Australia/Broken_Hill":{u:570,d:630,c:["AU"]},"Australia/Canberra":{a:"Australia/Sydney",r:1},"Australia/Currie":{a:"Australia/Hobart",r:1},"Australia/Darwin":{u:570,c:["AU"]},"Australia/Eucla":{u:525,c:["AU"]},"Australia/Hobart":{u:600,d:660,c:["AU"]},"Australia/LHI":{a:"Australia/Lord_Howe",r:1},"Australia/Lindeman":{u:600,c:["AU"]},"Australia/Lord_Howe":{u:630,d:660,c:["AU"]},"Australia/Melbourne":{u:600,d:660,c:["AU"]},"Australia/NSW":{a:"Australia/Sydney",r:1},"Australia/North":{a:"Australia/Darwin",r:1},"Australia/Perth":{u:480,c:["AU"]},"Australia/Queensland":{a:"Australia/Brisbane",r:1},"Australia/South":{a:"Australia/Adelaide",r:1},"Australia/Sydney":{u:600,d:660,c:["AU"]},"Australia/Tasmania":{a:"Australia/Hobart",r:1},"Australia/Victoria":{a:"Australia/Melbourne",r:1},"Australia/West":{a:"Australia/Perth",r:1},"Australia/Yancowinna":{a:"Australia/Broken_Hill",r:1},"Brazil/Acre":{a:"America/Rio_Branco",r:1},"Brazil/DeNoronha":{a:"America/Noronha",r:1},"Brazil/East":{a:"America/Sao_Paulo",r:1},"Brazil/West":{a:"America/Manaus",r:1},CET:{a:"Europe/Brussels",r:1},CST6CDT:{a:"America/Chicago",r:1},"Canada/Atlantic":{a:"America/Halifax",r:1},"Canada/Central":{a:"America/Winnipeg",r:1},"Canada/Eastern":{a:"America/Toronto",c:["CA"],r:1},"Canada/Mountain":{a:"America/Edmonton",r:1},"Canada/Newfoundland":{a:"America/St_Johns",r:1},"Canada/Pacific":{a:"America/Vancouver",r:1},"Canada/Saskatchewan":{a:"America/Regina",r:1},"Canada/Yukon":{a:"America/Whitehorse",r:1},"Chile/Continental":{a:"America/Santiago",r:1},"Chile/EasterIsland":{a:"Pacific/Easter",r:1},Cuba:{a:"America/Havana",r:1},EET:{a:"Europe/Athens",r:1},EST:{a:"America/Panama",r:1},EST5EDT:{a:"America/New_York",r:1},Egypt:{a:"Africa/Cairo",r:1},Eire:{a:"Europe/Dublin",r:1},"Etc/GMT":{u:0},"Etc/GMT+0":{a:"Etc/GMT",r:1},"Etc/GMT+1":{u:-60},"Etc/GMT+10":{u:-600},"Etc/GMT+11":{u:-660},"Etc/GMT+12":{u:-720},"Etc/GMT+2":{u:-120},"Etc/GMT+3":{u:-180},"Etc/GMT+4":{u:-240},"Etc/GMT+5":{u:-300},"Etc/GMT+6":{u:-360},"Etc/GMT+7":{u:-420},"Etc/GMT+8":{u:-480},"Etc/GMT+9":{u:-540},"Etc/GMT-0":{a:"Etc/GMT",r:1},"Etc/GMT-1":{u:60},"Etc/GMT-10":{u:600},"Etc/GMT-11":{u:660},"Etc/GMT-12":{u:720},"Etc/GMT-13":{u:780},"Etc/GMT-14":{u:840},"Etc/GMT-2":{u:120},"Etc/GMT-3":{u:180},"Etc/GMT-4":{u:240},"Etc/GMT-5":{u:300},"Etc/GMT-6":{u:360},"Etc/GMT-7":{u:420},"Etc/GMT-8":{u:480},"Etc/GMT-9":{u:540},"Etc/GMT0":{a:"Etc/GMT",r:1},"Etc/Greenwich":{a:"Etc/GMT",r:1},"Etc/UCT":{a:"Etc/UTC",r:1},"Etc/UTC":{u:0},"Etc/Universal":{a:"Etc/UTC",r:1},"Etc/Zulu":{a:"Etc/UTC",r:1},"Europe/Amsterdam":{a:"Europe/Brussels",c:["NL"],r:1},"Europe/Andorra":{u:60,d:120,c:["AD"]},"Europe/Astrakhan":{u:240,c:["RU"]},"Europe/Athens":{u:120,d:180,c:["GR"]},"Europe/Belfast":{a:"Europe/London",c:["GB"],r:1},"Europe/Belgrade":{u:60,d:120,c:["RS","BA","HR","ME","MK","SI"]},"Europe/Berlin":{u:60,d:120,c:["DE","DK","NO","SE","SJ"]},"Europe/Bratislava":{a:"Europe/Prague",c:["SK"],r:1},"Europe/Brussels":{u:60,d:120,c:["BE","LU","NL"]},"Europe/Bucharest":{u:120,d:180,c:["RO"]},"Europe/Budapest":{u:60,d:120,c:["HU"]},"Europe/Busingen":{a:"Europe/Zurich",c:["DE"],r:1},"Europe/Chisinau":{u:120,d:180,c:["MD"]},"Europe/Copenhagen":{a:"Europe/Berlin",c:["DK"],r:1},"Europe/Dublin":{u:0,d:60,c:["IE"]},"Europe/Gibraltar":{u:60,d:120,c:["GI"]},"Europe/Guernsey":{a:"Europe/London",c:["GG"],r:1},"Europe/Helsinki":{u:120,d:180,c:["FI","AX"]},"Europe/Isle_of_Man":{a:"Europe/London",c:["IM"],r:1},"Europe/Istanbul":{u:180,c:["TR"]},"Europe/Jersey":{a:"Europe/London",c:["JE"],r:1},"Europe/Kaliningrad":{u:120,c:["RU"]},"Europe/Kiev":{a:"Europe/Kyiv",r:1},"Europe/Kirov":{u:180,c:["RU"]},"Europe/Kyiv":{u:120,d:180,c:["UA"]},"Europe/Lisbon":{u:0,d:60,c:["PT"]},"Europe/Ljubljana":{a:"Europe/Belgrade",c:["SI"],r:1},"Europe/London":{u:0,d:60,c:["GB","GG","IM","JE"]},"Europe/Luxembourg":{a:"Europe/Brussels",c:["LU"],r:1},"Europe/Madrid":{u:60,d:120,c:["ES"]},"Europe/Malta":{u:60,d:120,c:["MT"]},"Europe/Mariehamn":{a:"Europe/Helsinki",c:["AX"],r:1},"Europe/Minsk":{u:180,c:["BY"]},"Europe/Monaco":{a:"Europe/Paris",c:["MC"],r:1},"Europe/Moscow":{u:180,c:["RU"]},"Europe/Nicosia":{a:"Asia/Nicosia",r:1},"Europe/Oslo":{a:"Europe/Berlin",c:["NO"],r:1},"Europe/Paris":{u:60,d:120,c:["FR","MC"]},"Europe/Podgorica":{a:"Europe/Belgrade",c:["ME"],r:1},"Europe/Prague":{u:60,d:120,c:["CZ","SK"]},"Europe/Riga":{u:120,d:180,c:["LV"]},"Europe/Rome":{u:60,d:120,c:["IT","SM","VA"]},"Europe/Samara":{u:240,c:["RU"]},"Europe/San_Marino":{a:"Europe/Rome",c:["SM"],r:1},"Europe/Sarajevo":{a:"Europe/Belgrade",c:["BA"],r:1},"Europe/Saratov":{u:240,c:["RU"]},"Europe/Simferopol":{u:180,c:["RU","UA"]},"Europe/Skopje":{a:"Europe/Belgrade",c:["MK"],r:1},"Europe/Sofia":{u:120,d:180,c:["BG"]},"Europe/Stockholm":{a:"Europe/Berlin",c:["SE"],r:1},"Europe/Tallinn":{u:120,d:180,c:["EE"]},"Europe/Tirane":{u:60,d:120,c:["AL"]},"Europe/Tiraspol":{a:"Europe/Chisinau",r:1},"Europe/Ulyanovsk":{u:240,c:["RU"]},"Europe/Uzhgorod":{a:"Europe/Kyiv",r:1},"Europe/Vaduz":{a:"Europe/Zurich",c:["LI"],r:1},"Europe/Vatican":{a:"Europe/Rome",c:["VA"],r:1},"Europe/Vienna":{u:60,d:120,c:["AT"]},"Europe/Vilnius":{u:120,d:180,c:["LT"]},"Europe/Volgograd":{u:180,c:["RU"]},"Europe/Warsaw":{u:60,d:120,c:["PL"]},"Europe/Zagreb":{a:"Europe/Belgrade",c:["HR"],r:1},"Europe/Zaporozhye":{a:"Europe/Kyiv",r:1},"Europe/Zurich":{u:60,d:120,c:["CH","DE","LI"]},Factory:{u:0},GB:{a:"Europe/London",c:["GB"],r:1},"GB-Eire":{a:"Europe/London",c:["GB"],r:1},GMT:{a:"Etc/GMT",r:1},"GMT+0":{a:"Etc/GMT",r:1},"GMT-0":{a:"Etc/GMT",r:1},GMT0:{a:"Etc/GMT",r:1},Greenwich:{a:"Etc/GMT",r:1},HST:{a:"Pacific/Honolulu",r:1},Hongkong:{a:"Asia/Hong_Kong",r:1},Iceland:{a:"Africa/Abidjan",c:["IS"],r:1},"Indian/Antananarivo":{a:"Africa/Nairobi",c:["MG"],r:1},"Indian/Chagos":{u:360,c:["IO"]},"Indian/Christmas":{a:"Asia/Bangkok",c:["CX"],r:1},"Indian/Cocos":{a:"Asia/Yangon",c:["CC"],r:1},"Indian/Comoro":{a:"Africa/Nairobi",c:["KM"],r:1},"Indian/Kerguelen":{a:"Indian/Maldives",c:["TF"],r:1},"Indian/Mahe":{a:"Asia/Dubai",c:["SC"],r:1},"Indian/Maldives":{u:300,c:["MV","TF"]},"Indian/Mauritius":{u:240,c:["MU"]},"Indian/Mayotte":{a:"Africa/Nairobi",c:["YT"],r:1},"Indian/Reunion":{a:"Asia/Dubai",c:["RE"],r:1},Iran:{a:"Asia/Tehran",r:1},Israel:{a:"Asia/Jerusalem",r:1},Jamaica:{a:"America/Jamaica",r:1},Japan:{a:"Asia/Tokyo",r:1},Kwajalein:{a:"Pacific/Kwajalein",r:1},Libya:{a:"Africa/Tripoli",r:1},MET:{a:"Europe/Brussels",r:1},MST:{a:"America/Phoenix",r:1},MST7MDT:{a:"America/Denver",r:1},"Mexico/BajaNorte":{a:"America/Tijuana",r:1},"Mexico/BajaSur":{a:"America/Mazatlan",r:1},"Mexico/General":{a:"America/Mexico_City",r:1},NZ:{a:"Pacific/Auckland",c:["NZ"],r:1},"NZ-CHAT":{a:"Pacific/Chatham",r:1},Navajo:{a:"America/Denver",r:1},PRC:{a:"Asia/Shanghai",r:1},PST8PDT:{a:"America/Los_Angeles",r:1},"Pacific/Apia":{u:780,c:["WS"]},"Pacific/Auckland":{u:720,d:780,c:["NZ","AQ"]},"Pacific/Bougainville":{u:660,c:["PG"]},"Pacific/Chatham":{u:765,d:825,c:["NZ"]},"Pacific/Chuuk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Easter":{u:-360,d:-300,c:["CL"]},"Pacific/Efate":{u:660,c:["VU"]},"Pacific/Enderbury":{a:"Pacific/Kanton",r:1},"Pacific/Fakaofo":{u:780,c:["TK"]},"Pacific/Fiji":{u:720,c:["FJ"]},"Pacific/Funafuti":{a:"Pacific/Tarawa",c:["TV"],r:1},"Pacific/Galapagos":{u:-360,c:["EC"]},"Pacific/Gambier":{u:-540,c:["PF"]},"Pacific/Guadalcanal":{u:660,c:["SB","FM"]},"Pacific/Guam":{u:600,c:["GU","MP"]},"Pacific/Honolulu":{u:-600,c:["US"]},"Pacific/Johnston":{a:"Pacific/Honolulu",c:["UM"],r:1},"Pacific/Kanton":{u:780,c:["KI"]},"Pacific/Kiritimati":{u:840,c:["KI"]},"Pacific/Kosrae":{u:660,c:["FM"]},"Pacific/Kwajalein":{u:720,c:["MH"]},"Pacific/Majuro":{a:"Pacific/Tarawa",c:["MH"],r:1},"Pacific/Marquesas":{u:-570,c:["PF"]},"Pacific/Midway":{a:"Pacific/Pago_Pago",c:["UM"],r:1},"Pacific/Nauru":{u:720,c:["NR"]},"Pacific/Niue":{u:-660,c:["NU"]},"Pacific/Norfolk":{u:660,d:720,c:["NF"]},"Pacific/Noumea":{u:660,c:["NC"]},"Pacific/Pago_Pago":{u:-660,c:["AS","UM"]},"Pacific/Palau":{u:540,c:["PW"]},"Pacific/Pitcairn":{u:-480,c:["PN"]},"Pacific/Pohnpei":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Ponape":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Port_Moresby":{u:600,c:["PG","AQ","FM"]},"Pacific/Rarotonga":{u:-600,c:["CK"]},"Pacific/Saipan":{a:"Pacific/Guam",c:["MP"],r:1},"Pacific/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},"Pacific/Tahiti":{u:-600,c:["PF"]},"Pacific/Tarawa":{u:720,c:["KI","MH","TV","UM","WF"]},"Pacific/Tongatapu":{u:780,c:["TO"]},"Pacific/Truk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Wake":{a:"Pacific/Tarawa",c:["UM"],r:1},"Pacific/Wallis":{a:"Pacific/Tarawa",c:["WF"],r:1},"Pacific/Yap":{a:"Pacific/Port_Moresby",c:["FM"],r:1},Poland:{a:"Europe/Warsaw",r:1},Portugal:{a:"Europe/Lisbon",r:1},ROC:{a:"Asia/Taipei",r:1},ROK:{a:"Asia/Seoul",r:1},Singapore:{a:"Asia/Singapore",c:["SG"],r:1},Turkey:{a:"Europe/Istanbul",r:1},UCT:{a:"Etc/UTC",r:1},"US/Alaska":{a:"America/Anchorage",r:1},"US/Aleutian":{a:"America/Adak",r:1},"US/Arizona":{a:"America/Phoenix",c:["US"],r:1},"US/Central":{a:"America/Chicago",r:1},"US/East-Indiana":{a:"America/Indiana/Indianapolis",r:1},"US/Eastern":{a:"America/New_York",r:1},"US/Hawaii":{a:"Pacific/Honolulu",r:1},"US/Indiana-Starke":{a:"America/Indiana/Knox",r:1},"US/Michigan":{a:"America/Detroit",r:1},"US/Mountain":{a:"America/Denver",r:1},"US/Pacific":{a:"America/Los_Angeles",r:1},"US/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},UTC:{a:"Etc/UTC",r:1},Universal:{a:"Etc/UTC",r:1},"W-SU":{a:"Europe/Moscow",r:1},WET:{a:"Europe/Lisbon",r:1},Zulu:{a:"Etc/UTC",r:1}},wI={countries:qJe,timezones:YJe};function KJe(e,t){var n=e.timezones[t];if(!n)return null;var r=n.a,o=r===void 0?null:r,i=o?e.timezones[o]:{},a=WT(WT({},i),e.timezones[t]),l=a.c||[],c=a.u,u=Number.isInteger(a.d)?a.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:dF(c),dstOffset:u,dstOffsetStr:dF(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function dF(e){var t=Math.floor(Math.abs(e)/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(pF(t),":").concat(pF(n))}function pF(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var XJe=Object.keys(wI.timezones).length,u1={},zZ=0;function JJe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(XJe!==zZ)for(var t=0,n=Object.keys(wI.timezones);t<n.length;t++){var r=n[t];QJe(r)}return eQe(u1,e)}function QJe(e){return u1[e]||ZJe(KJe(wI,e)),u1[e]?WT({},u1[e]):null}function ZJe(e){e&&(u1[e.name]=e,zZ=Object.keys(e).length)}function eQe(e,t){var n=t||{},r=n.deprecated;return r===!0?e:Object.keys(e).reduce(function(o,i){return e[i].deprecated||Object.assign(o,BZ({},i,e[i])),o},{})}const tQe=x(vr)({border:"none","*":{border:"none",padding:0}}),nQe=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",alignItems:"center"})),rQe=({setValue:e,value:t,validator:n})=>{const[r,o]=m.useState(""),i=Object.values(JJe({deprecated:!1})).map(f=>({key:f.name,label:`${f.name}`,utcOffset:f.utcOffsetStr})),{timeZone:a}=Intl.DateTimeFormat().resolvedOptions(),[l,c]=m.useState(t||""),u=m.useId(),d=m.useId(),p=m.useMemo(()=>{const f=i.find(h=>h.key===a);return f!=null?`${f.key} (UTC ${f.utcOffset})`:"The time shown is in your local time zone according to your browser."},[i,a]);return t?s.jsxs(nQe,{children:[s.jsx("label",{htmlFor:u,children:s.jsx(Bc,{children:"Date"})}),s.jsx(tQe,{id:u,"aria-describedby":d,hiddenLabel:!0,label:"",size:"small",type:"datetime-local",value:j_e(l),onChange:f=>{o("");const h=tA(f.target.value),g=h==null?void 0:h.toISOString();if(!g)o("Invalid date format");else{c(g);const[v,b]=n(g);v?g&&e(g):o(b)}},InputLabelProps:{shrink:!0},error:!!r,errorText:r,required:!0}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx("p",{id:d,children:p})})]}):null},oQe=x("div")(({theme:e})=>({display:"inline-block",wordBreak:"break-word",padding:e.spacing(.5,1),background:e.palette.background.paper,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,transition:"all 0.1s ease-in-out","&:hover":{borderColor:e.palette.primary.main}})),iQe=x("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallBody,overflowX:"hidden",textOverflow:"ellipsis"})),sQe=x("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active})),aQe=({legal:e,control:t,filter:n,value:r})=>s.jsx(oQe,{children:s.jsx(qr,{value:r||e.value,control:t,sx:{width:"100%",overflowX:"hidden"},label:s.jsxs(s.Fragment,{children:[s.jsx(iQe,{children:s.jsx(yo,{title:e.value,arrow:!0,lines:1,children:s.jsx(Kr,{search:n,children:e.value})})}),s.jsx(sQe,{children:s.jsx(yo,{title:e.description,arrow:!0,lines:1,children:s.jsx(Kr,{search:n,children:e.description})})})]})})}),lQe=(e,t)=>e.filter(n=>{var r;return n.value.toLowerCase().includes(t.toLowerCase())||((r=n.description)==null?void 0:r.toLowerCase().includes(t.toLowerCase()))}),HZ=({filter:e,setFilter:t,onKeyDown:n})=>{const r=m.useId();return s.jsxs("div",{style:{display:"flex",alignItems:"center",minWidth:"120px"},children:[s.jsx(Bc,{children:s.jsx("label",{htmlFor:r,children:"Search"})}),s.jsx(xn,{id:r,name:"search",value:e,onChange:o=>t(o.target.value),placeholder:"Filter values",onKeyDown:n,sx:{width:"100%"},variant:"outlined",size:"small",InputProps:{startAdornment:s.jsx(fp,{position:"start",children:s.jsx(Zf,{})})}})]})},cQe=x("div")(({theme:e})=>({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:e.spacing(1),maxHeight:"378px",overflow:"auto"})),uQe=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",alignItems:"center",gap:e.spacing(1)})),dQe=x("article")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),WZ=({legalValues:e,onChange:t,deletedLegalValues:n,invalidLegalValues:r,isInputSelected:o,multiSelect:i})=>{const[a,l]=m.useState(""),c=m.useId(),u=m.useId(),d=m.useId(),p=m.useId(),f=lQe(e,a),h=i&&e.length===i.values.size+((n==null?void 0:n.size)??0),g=b=>{if(b.key==="Enter"&&(b.preventDefault(),f.length>0)){const y=f[0].value;t(y)}},v=i?pa:yl;return s.jsxs(dQe,{children:[n!=null&&n.size?s.jsxs(Lt,{id:p,severity:"warning",children:["This constraint is currently using values that were valid in the past but have since been deleted. If you save changes on this constraint and then save the strategy the following values will be removed:",s.jsx("ul",{children:[...n].map(b=>s.jsx("li",{children:b},b))})]}):null,s.jsxs("p",{children:[s.jsx("span",{id:c,children:"Select values from a predefined set"}),r!=null&&r.size?s.jsx("span",{id:u,children:"Values that are not valid for your chosen operator have been disabled."}):null]}),s.jsxs(uQe,{children:[s.jsx(HZ,{onKeyDown:g,filter:a,setFilter:l}),i?s.jsx(Ue,{sx:{whiteSpace:"nowrap"},variant:"text",onClick:()=>{if(h){i.clearAll();return}else i.selectAll()},children:h?"Unselect all":"Select all"}):null]}),s.jsx(cQe,{"aria-labelledby":c,"aria-describedby":u,"aria-details":p,role:i?void 0:"radiogroup",children:f.map(b=>s.jsx(pQe,{legal:b,filter:a,Control:v,onChange:t,groupNameId:d,checked:o(b.value),disabled:r==null?void 0:r.has(b.value)},b.value))})]})},pQe=Je.memo(function({legal:t,filter:n,Control:r,onChange:o,groupNameId:i,checked:a,disabled:l}){return s.jsx(aQe,{legal:t,filter:n,control:s.jsx(r,{color:"primary",name:`legal-value-${i}`,checked:a,onChange:()=>o(t.value),disabled:l})})}),fQe=({legalValues:e,values:t,addValues:n,toggleValue:r,clearAll:o,...i})=>s.jsx(WZ,{legalValues:e,isInputSelected:a=>t.has(a),onChange:r,multiSelect:{clearAll:o,selectAll:()=>{n(e.map(({value:a})=>a))},values:t},...i}),hQe=({value:e,toggleValue:t,...n})=>s.jsx(WZ,{onChange:t,isInputSelected:r=>r===e,...n}),qs=Symbol("id"),u0=e=>OZ(e.operator),Pb=e=>!u0(e),VZ=e=>Dd(e.operator),gQe=e=>AZ(e.operator),mQe=e=>IZ(e.operator),vQe=e=>{const{value:t,values:n,operator:r,...o}=e;return yI(r)?{[qs]:wi(),...o,operator:r,value:t??""}:{[qs]:wi(),...o,operator:r,values:new Set(n)}},yQe=e=>{if("value"in e)return e;{const{values:t,...n}=e;return{...n,values:Array.from(e.values)}}},xQe=(e,t)=>{const n=new Set(e);for(const r of t)n.add(r);return n},VT=(e,t)=>{const n=new Set;for(const r of e)t.has(r)||n.add(r);return n},Ch=(e,t)=>{const{value:n,values:r,...o}=t;return OZ(t.operator)?{...o,values:new Set([e].filter(Boolean))}:{...o,value:e??""}},bQe=(e,t)=>{const n=o=>{if(Pb(e))return e.value===o?{...e,value:""}:e;const i=VT(e.values,new Set([o]));return{...e,values:i??new Set}},r=o=>{var c,u;if(Pb(e)){const d=Array.isArray(o)?o[0]:o;return(c=e.deletedLegalValues)!=null&&c.has(d)?(u=e.deletedLegalValues)!=null&&u.has(e.value)?{...e,value:""}:e:{...e,value:d??""}}const i=new Set(Array.isArray(o)?o:[o]),a=xQe(e.values,i),l=e.deletedLegalValues?VT(a,e.deletedLegalValues):a;return{...e,values:l}};switch(t.type){case"set context field":return t.payload===e.contextName?e:t.payload===c0&&!Dd(e.operator)?Ch(new Date().toISOString(),{...e,contextName:t.payload,operator:hI}):t.payload!==c0&&Dd(e.operator)?Ch(null,{...e,operator:fI,contextName:t.payload}):Ch(null,{...e,contextName:t.payload});case"set operator":return t.payload===e.operator?e:VZ(e)&&Dd(t.payload)?{...e,operator:t.payload}:yI(t.payload)?Ch(null,{...e,operator:t.payload}):Ch(null,{...e,operator:t.payload});case"add value(s)":return r(t.payload);case"toggle inverted operator":return{...e,inverted:!e.inverted};case"toggle case sensitivity":return{...e,caseInsensitive:!e.caseInsensitive};case"remove value":return n(t.payload);case"clear values":return Ch(null,e);case"toggle value":return Pb(e)&&e.value===t.payload||u0(e)&&e.values.has(t.payload)?n(t.payload):r(t.payload);case"deleted legal values update":return{...e,deletedLegalValues:t.payload}}};var UT={exports:{}};const wQe="2.0.0",UZ=256,SQe=Number.MAX_SAFE_INTEGER||9007199254740991,CQe=16,jQe=UZ-6,EQe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var HC={MAX_LENGTH:UZ,MAX_SAFE_COMPONENT_LENGTH:CQe,MAX_SAFE_BUILD_LENGTH:jQe,MAX_SAFE_INTEGER:SQe,RELEASE_TYPES:EQe,SEMVER_SPEC_VERSION:wQe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},C5={};const TQe=typeof process=="object"&&C5&&C5.NODE_DEBUG&&/\bsemver\b/i.test(C5.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var WC=TQe;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=HC,i=WC;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]],g=b=>{for(const[y,w]of h)b=b.split(`${y}*`).join(`${y}{0,${w}}`).split(`${y}+`).join(`${y}{1,${w}}`);return b},v=(b,y,w)=>{const S=g(y),j=p++;i(b,j,y),d[b]=j,c[j]=y,u[j]=S,a[j]=new RegExp(y,w?"g":void 0),l[j]=new RegExp(S,w?"g":void 0)};v("NUMERICIDENTIFIER","0|[1-9]\\d*"),v("NUMERICIDENTIFIERLOOSE","\\d+"),v("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),v("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),v("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),v("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),v("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),v("BUILDIDENTIFIER",`${f}+`),v("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),v("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),v("FULL",`^${c[d.FULLPLAIN]}$`),v("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),v("LOOSE",`^${c[d.LOOSEPLAIN]}$`),v("GTLT","((?:<|>)?=?)"),v("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),v("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),v("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),v("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),v("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),v("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),v("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),v("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),v("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?(?:${c[d.BUILD]})?(?:$|[^\\d])`),v("COERCERTL",c[d.COERCE],!0),v("COERCERTLFULL",c[d.COERCEFULL],!0),v("LONETILDE","(?:~>?)"),v("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",v("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),v("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),v("LONECARET","(?:\\^)"),v("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",v("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),v("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),v("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),v("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),v("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",v("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),v("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),v("STAR","(<|>)?=?\\s*\\*"),v("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),v("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(UT,UT.exports);var dy=UT.exports;const kQe=Object.freeze({loose:!0}),_Qe=Object.freeze({}),RQe=e=>e?typeof e!="object"?kQe:e:_Qe;var SI=RQe;const fF=/^[0-9]+$/,GZ=(e,t)=>{const n=fF.test(e),r=fF.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},PQe=(e,t)=>GZ(t,e);var qZ={compareIdentifiers:GZ,rcompareIdentifiers:PQe};const Mx=WC,{MAX_LENGTH:hF,MAX_SAFE_INTEGER:Dx}=HC,{safeRe:Lx,t:Fx}=dy,AQe=SI,{compareIdentifiers:jh}=qZ;let IQe=class Zl{constructor(t,n){if(n=AQe(n),t instanceof Zl){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>hF)throw new TypeError(`version is longer than ${hF} characters`);Mx("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?Lx[Fx.LOOSE]:Lx[Fx.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>Dx||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Dx||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Dx||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){const i=+o;if(i>=0&&i<Dx)return i}return o}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Mx("SemVer.compare",this.version,this.options,t),!(t instanceof Zl)){if(typeof t=="string"&&t===this.version)return 0;t=new Zl(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof Zl||(t=new Zl(t,this.options)),jh(this.major,t.major)||jh(this.minor,t.minor)||jh(this.patch,t.patch)}comparePre(t){if(t instanceof Zl||(t=new Zl(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(Mx("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 jh(r,o)}while(++n)}compareBuild(t){t instanceof Zl||(t=new Zl(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(Mx("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 jh(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?Lx[Fx.PRERELEASELOOSE]:Lx[Fx.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 i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let i=[n,o];r===!1&&(i=[n]),jh(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var ls=IQe;const gF=ls,$Qe=(e,t,n=!1)=>{if(e instanceof gF)return e;try{return new gF(e,t)}catch(r){if(!n)return null;throw r}};var Sm=$Qe;const OQe=Sm,MQe=(e,t)=>{const n=OQe(e,t);return n?n.version:null};var DQe=MQe;const LQe=Sm,FQe=(e,t)=>{const n=LQe(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var NQe=FQe;const mF=ls,BQe=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new mF(e instanceof mF?e.version:e,n).inc(t,r,o).version}catch{return null}};var zQe=BQe;const vF=Sm,HQe=(e,t)=>{const n=vF(e,null,!0),r=vF(t,null,!0),o=n.compare(r);if(o===0)return null;const i=o>0,a=i?n:r,l=i?r:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c){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 WQe=HQe;const VQe=ls,UQe=(e,t)=>new VQe(e,t).major;var GQe=UQe;const qQe=ls,YQe=(e,t)=>new qQe(e,t).minor;var KQe=YQe;const XQe=ls,JQe=(e,t)=>new XQe(e,t).patch;var QQe=JQe;const ZQe=Sm,eZe=(e,t)=>{const n=ZQe(e,t);return n&&n.prerelease.length?n.prerelease:null};var tZe=eZe;const yF=ls,nZe=(e,t,n)=>new yF(e,n).compare(new yF(t,n));var Dl=nZe;const rZe=Dl,oZe=(e,t,n)=>rZe(t,e,n);var iZe=oZe;const sZe=Dl,aZe=(e,t)=>sZe(e,t,!0);var lZe=aZe;const xF=ls,cZe=(e,t,n)=>{const r=new xF(e,n),o=new xF(t,n);return r.compare(o)||r.compareBuild(o)};var CI=cZe;const uZe=CI,dZe=(e,t)=>e.sort((n,r)=>uZe(n,r,t));var pZe=dZe;const fZe=CI,hZe=(e,t)=>e.sort((n,r)=>fZe(r,n,t));var gZe=hZe;const mZe=Dl,vZe=(e,t,n)=>mZe(e,t,n)>0;var VC=vZe;const yZe=Dl,xZe=(e,t,n)=>yZe(e,t,n)<0;var jI=xZe;const bZe=Dl,wZe=(e,t,n)=>bZe(e,t,n)===0;var YZ=wZe;const SZe=Dl,CZe=(e,t,n)=>SZe(e,t,n)!==0;var KZ=CZe;const jZe=Dl,EZe=(e,t,n)=>jZe(e,t,n)>=0;var EI=EZe;const TZe=Dl,kZe=(e,t,n)=>TZe(e,t,n)<=0;var TI=kZe;const _Ze=YZ,RZe=KZ,PZe=VC,AZe=EI,IZe=jI,$Ze=TI,OZe=(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 _Ze(e,n,r);case"!=":return RZe(e,n,r);case">":return PZe(e,n,r);case">=":return AZe(e,n,r);case"<":return IZe(e,n,r);case"<=":return $Ze(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var XZ=OZe;const MZe=ls,DZe=Sm,{safeRe:Nx,t:Bx}=dy,LZe=(e,t)=>{if(e instanceof MZe)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?Nx[Bx.COERCEFULL]:Nx[Bx.COERCE]);else{const c=t.includePrerelease?Nx[Bx.COERCERTLFULL]:Nx[Bx.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",i=n[4]||"0",a=t.includePrerelease&&n[5]?`-${n[5]}`:"",l=t.includePrerelease&&n[6]?`+${n[6]}`:"";return DZe(`${r}.${o}.${i}${a}${l}`,t)};var FZe=LZe;class NZe{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 BZe=NZe,j5,bF;function Ll(){if(bF)return j5;bF=1;const e=/\s+/g;class t{constructor($,D){if(D=o(D),$ instanceof t)return $.loose===!!D.loose&&$.includePrerelease===!!D.includePrerelease?$:new t($.raw,D);if($ instanceof i)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=D,this.loose=!!D.loose,this.includePrerelease=!!D.includePrerelease,this.raw=$.trim().replace(e," "),this.set=this.raw.split("||").map(z=>this.parseRange(z.trim())).filter(z=>z.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const z=this.set[0];if(this.set=this.set.filter(B=>!v(B[0])),this.set.length===0)this.set=[z];else if(this.set.length>1){for(const B of this.set)if(B.length===1&&b(B[0])){this.set=[B];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){$>0&&(this.formatted+="||");const D=this.set[$];for(let z=0;z<D.length;z++)z>0&&(this.formatted+=" "),this.formatted+=D[z].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){const z=((this.options.includePrerelease&&h)|(this.options.loose&&g))+":"+$,B=r.get(z);if(B)return B;const L=this.options.loose,I=L?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];$=$.replace(I,M(this.options.includePrerelease)),a("hyphen replace",$),$=$.replace(c[u.COMPARATORTRIM],d),a("comparator trim",$),$=$.replace(c[u.TILDETRIM],p),a("tilde trim",$),$=$.replace(c[u.CARETTRIM],f),a("caret trim",$);let q=$.split(" ").map(ne=>w(ne,this.options)).join(" ").split(/\s+/).map(ne=>O(ne,this.options));L&&(q=q.filter(ne=>(a("loose invalid filter",ne,this.options),!!ne.match(c[u.COMPARATORLOOSE])))),a("range list",q);const ee=new Map,W=q.map(ne=>new i(ne,this.options));for(const ne of W){if(v(ne))return[ne];ee.set(ne.value,ne)}ee.size>1&&ee.has("")&&ee.delete("");const oe=[...ee.values()];return r.set(z,oe),oe}intersects($,D){if(!($ instanceof t))throw new TypeError("a Range is required");return this.set.some(z=>y(z,D)&&$.set.some(B=>y(B,D)&&z.every(L=>B.every(I=>L.intersects(I,D)))))}test($){if(!$)return!1;if(typeof $=="string")try{$=new l($,this.options)}catch{return!1}for(let D=0;D<this.set.length;D++)if(H(this.set[D],$,this.options))return!0;return!1}}j5=t;const n=BZe,r=new n,o=SI,i=UC(),a=WC,l=ls,{safeRe:c,t:u,comparatorTrimReplace:d,tildeTrimReplace:p,caretTrimReplace:f}=dy,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:g}=HC,v=P=>P.value==="<0.0.0-0",b=P=>P.value==="",y=(P,$)=>{let D=!0;const z=P.slice();let B=z.pop();for(;D&&z.length;)D=z.every(L=>B.intersects(L,$)),B=z.pop();return D},w=(P,$)=>(a("comp",P,$),P=C(P,$),a("caret",P),P=j(P,$),a("tildes",P),P=k(P,$),a("xrange",P),P=A(P,$),a("stars",P),P),S=P=>!P||P.toLowerCase()==="x"||P==="*",j=(P,$)=>P.trim().split(/\s+/).map(D=>E(D,$)).join(" "),E=(P,$)=>{const D=$.loose?c[u.TILDELOOSE]:c[u.TILDE];return P.replace(D,(z,B,L,I,q)=>{a("tilde",P,z,B,L,I,q);let ee;return S(B)?ee="":S(L)?ee=`>=${B}.0.0 <${+B+1}.0.0-0`:S(I)?ee=`>=${B}.${L}.0 <${B}.${+L+1}.0-0`:q?(a("replaceTilde pr",q),ee=`>=${B}.${L}.${I}-${q} <${B}.${+L+1}.0-0`):ee=`>=${B}.${L}.${I} <${B}.${+L+1}.0-0`,a("tilde return",ee),ee})},C=(P,$)=>P.trim().split(/\s+/).map(D=>T(D,$)).join(" "),T=(P,$)=>{a("caret",P,$);const D=$.loose?c[u.CARETLOOSE]:c[u.CARET],z=$.includePrerelease?"-0":"";return P.replace(D,(B,L,I,q,ee)=>{a("caret",P,B,L,I,q,ee);let W;return S(L)?W="":S(I)?W=`>=${L}.0.0${z} <${+L+1}.0.0-0`:S(q)?L==="0"?W=`>=${L}.${I}.0${z} <${L}.${+I+1}.0-0`:W=`>=${L}.${I}.0${z} <${+L+1}.0.0-0`:ee?(a("replaceCaret pr",ee),L==="0"?I==="0"?W=`>=${L}.${I}.${q}-${ee} <${L}.${I}.${+q+1}-0`:W=`>=${L}.${I}.${q}-${ee} <${L}.${+I+1}.0-0`:W=`>=${L}.${I}.${q}-${ee} <${+L+1}.0.0-0`):(a("no pr"),L==="0"?I==="0"?W=`>=${L}.${I}.${q}${z} <${L}.${I}.${+q+1}-0`:W=`>=${L}.${I}.${q}${z} <${L}.${+I+1}.0-0`:W=`>=${L}.${I}.${q} <${+L+1}.0.0-0`),a("caret return",W),W})},k=(P,$)=>(a("replaceXRanges",P,$),P.split(/\s+/).map(D=>_(D,$)).join(" ")),_=(P,$)=>{P=P.trim();const D=$.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return P.replace(D,(z,B,L,I,q,ee)=>{a("xRange",P,z,B,L,I,q,ee);const W=S(L),oe=W||S(I),ne=oe||S(q),ce=ne;return B==="="&&ce&&(B=""),ee=$.includePrerelease?"-0":"",W?B===">"||B==="<"?z="<0.0.0-0":z="*":B&&ce?(oe&&(I=0),q=0,B===">"?(B=">=",oe?(L=+L+1,I=0,q=0):(I=+I+1,q=0)):B==="<="&&(B="<",oe?L=+L+1:I=+I+1),B==="<"&&(ee="-0"),z=`${B+L}.${I}.${q}${ee}`):oe?z=`>=${L}.0.0${ee} <${+L+1}.0.0-0`:ne&&(z=`>=${L}.${I}.0${ee} <${L}.${+I+1}.0-0`),a("xRange return",z),z})},A=(P,$)=>(a("replaceStars",P,$),P.trim().replace(c[u.STAR],"")),O=(P,$)=>(a("replaceGTE0",P,$),P.trim().replace(c[$.includePrerelease?u.GTE0PRE:u.GTE0],"")),M=P=>($,D,z,B,L,I,q,ee,W,oe,ne,ce)=>(S(z)?D="":S(B)?D=`>=${z}.0.0${P?"-0":""}`:S(L)?D=`>=${z}.${B}.0${P?"-0":""}`:I?D=`>=${D}`:D=`>=${D}${P?"-0":""}`,S(W)?ee="":S(oe)?ee=`<${+W+1}.0.0-0`:S(ne)?ee=`<${W}.${+oe+1}.0-0`:ce?ee=`<=${W}.${oe}.${ne}-${ce}`:P?ee=`<${W}.${oe}.${+ne+1}-0`:ee=`<=${ee}`,`${D} ${ee}`.trim()),H=(P,$,D)=>{for(let z=0;z<P.length;z++)if(!P[z].test($))return!1;if($.prerelease.length&&!D.includePrerelease){for(let z=0;z<P.length;z++)if(a(P[z].semver),P[z].semver!==i.ANY&&P[z].semver.prerelease.length>0){const B=P[z].semver;if(B.major===$.major&&B.minor===$.minor&&B.patch===$.patch)return!0}return!1}return!0};return j5}var E5,wF;function UC(){if(wF)return E5;wF=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 i(d,this.operator,this.semver,this.options)}intersects(d,p){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,p).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,p).test(d.semver):(p=n(p),p.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!p.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||i(this.semver,"<",d.semver,p)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||i(this.semver,">",d.semver,p)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}E5=t;const n=SI,{safeRe:r,t:o}=dy,i=XZ,a=WC,l=ls,c=Ll();return E5}const zZe=Ll(),HZe=(e,t,n)=>{try{t=new zZe(t,n)}catch{return!1}return t.test(e)};var GC=HZe;const WZe=Ll(),VZe=(e,t)=>new WZe(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var UZe=VZe;const GZe=ls,qZe=Ll(),YZe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new qZe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===-1)&&(r=a,o=new GZe(r,n))}),r};var KZe=YZe;const XZe=ls,JZe=Ll(),QZe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new JZe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===1)&&(r=a,o=new XZe(r,n))}),r};var ZZe=QZe;const T5=ls,eet=Ll(),SF=VC,tet=(e,t)=>{e=new eet(e,t);let n=new T5("0.0.0");if(e.test(n)||(n=new T5("0.0.0-0"),e.test(n)))return n;n=null;for(let r=0;r<e.set.length;++r){const o=e.set[r];let i=null;o.forEach(a=>{const l=new T5(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!i||SF(l,i))&&(i=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!n||SF(n,i))&&(n=i)}return n&&e.test(n)?n:null};var net=tet;const ret=Ll(),oet=(e,t)=>{try{return new ret(e,t).range||"*"}catch{return null}};var iet=oet;const set=ls,JZ=UC(),{ANY:aet}=JZ,cet=Ll(),uet=GC,CF=VC,jF=jI,det=TI,pet=EI,fet=(e,t,n,r)=>{e=new set(e,r),t=new cet(t,r);let o,i,a,l,c;switch(n){case">":o=CF,i=det,a=jF,l=">",c=">=";break;case"<":o=jF,i=pet,a=CF,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(uet(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===aet&&(h=new JZ(">=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)&&i(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};var kI=fet;const het=kI,get=(e,t,n)=>het(e,t,">",n);var met=get;const vet=kI,yet=(e,t,n)=>vet(e,t,"<",n);var xet=yet;const EF=Ll(),bet=(e,t,n)=>(e=new EF(e,n),t=new EF(t,n),e.intersects(t,n));var wet=bet;const Cet=GC,jet=Dl;var Eet=(e,t,n)=>{const r=[];let o=null,i=null;const a=e.sort((d,p)=>jet(d,p,n));for(const d of a)Cet(d,t,n)?(i=d,o||(o=d)):(i&&r.push([o,i]),i=null,o=null);o&&r.push([o,null]);const l=[];for(const[d,p]of r)d===p?l.push(d):!p&&d===a[0]?l.push("*"):p?d===a[0]?l.push(`<=${p}`):l.push(`${d} - ${p}`):l.push(`>=${d}`);const c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t};const TF=Ll(),_I=UC(),{ANY:k5}=_I,av=GC,RI=Dl,Tet=(e,t,n={})=>{if(e===t)return!0;e=new TF(e,n),t=new TF(t,n);let r=!1;e:for(const o of e.set){for(const i of t.set){const a=_et(o,i,n);if(r=r||a!==null,a)continue e}if(r)return!1}return!0},ket=[new _I(">=0.0.0-0")],kF=[new _I(">=0.0.0")],_et=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===k5){if(t.length===1&&t[0].semver===k5)return!0;n.includePrerelease?e=ket:e=kF}if(t.length===1&&t[0].semver===k5){if(n.includePrerelease)return!0;t=kF}const r=new Set;let o,i;for(const h of e)h.operator===">"||h.operator===">="?o=_F(o,h,n):h.operator==="<"||h.operator==="<="?i=RF(i,h,n):r.add(h.semver);if(r.size>1)return null;let a;if(o&&i){if(a=RI(o.semver,i.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||i.operator!=="<="))return null}for(const h of r){if(o&&!av(h,String(o),n)||i&&!av(h,String(i),n))return null;for(const g of t)if(!av(h,String(g),n))return!1;return!0}let l,c,u,d,p=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(const 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=_F(o,h,n),l===h&&l!==o)return!1}else if(o.operator===">="&&!av(o.semver,String(h),n))return!1}if(i){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=RF(i,h,n),c===h&&c!==i)return!1}else if(i.operator==="<="&&!av(i.semver,String(h),n))return!1}if(!h.operator&&(i||o)&&a!==0)return!1}return!(o&&u&&!i&&a!==0||i&&d&&!o&&a!==0||f||p)},_F=(e,t,n)=>{if(!e)return t;const r=RI(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},RF=(e,t,n)=>{if(!e)return t;const r=RI(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var Ret=Tet;const _5=dy,PF=HC,Pet=ls,AF=qZ,Aet=Sm,Iet=DQe,$et=NQe,Oet=zQe,Met=WQe,Det=GQe,Let=KQe,Fet=QQe,Net=tZe,Bet=Dl,zet=iZe,Het=lZe,Wet=CI,Vet=pZe,Uet=gZe,Get=VC,qet=jI,Yet=YZ,Ket=KZ,Xet=EI,Jet=TI,Qet=XZ,Zet=FZe,ett=UC(),ttt=Ll(),ntt=GC,rtt=UZe,ott=KZe,itt=ZZe,stt=net,att=iet,ltt=kI,ctt=met,utt=xet,dtt=wet,ptt=Eet,ftt=Ret;var htt={parse:Aet,valid:Iet,clean:$et,inc:Oet,diff:Met,major:Det,minor:Let,patch:Fet,prerelease:Net,compare:Bet,rcompare:zet,compareLoose:Het,compareBuild:Wet,sort:Vet,rsort:Uet,gt:Get,lt:qet,eq:Yet,neq:Ket,gte:Xet,lte:Jet,cmp:Qet,coerce:Zet,Comparator:ett,Range:ttt,satisfies:ntt,toComparators:rtt,maxSatisfying:ott,minSatisfying:itt,minVersion:stt,validRange:att,outside:ltt,gtr:ctt,ltr:utt,intersects:dtt,simplifyRange:ptt,subset:ftt,SemVer:Pet,re:_5.re,src:_5.src,tokens:_5.t,SEMVER_SPEC_VERSION:PF.SEMVER_SPEC_VERSION,RELEASE_TYPES:PF.RELEASE_TYPES,compareIdentifiers:AF.compareIdentifiers,rcompareIdentifiers:AF.rcompareIdentifiers};const IF=Vo(htt),gtt=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,""]},mtt=(...e)=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},vtt=e=>{const t=IF.clean(e)===e;return!IF.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},ytt=e=>Z0(Ha(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],xtt=e=>Dd(e)?ytt:IZ(e)?vtt:AZ(e)?gtt:mtt,btt=(e,t)=>{const n=new Set(e.map(({value:o})=>o));return VT(t,n)},wtt=(e,t)=>new Set(t.filter(({value:n})=>!e(n)).map(({value:n})=>n)),Stt=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},Ctt=(e,t)=>{var f;const[n,r]=m.useReducer(bQe,vQe(e)),{deletedLegalValues:o,...i}=n;m.useEffect(()=>{t(yQe(i))},[n]);const{context:a}=ya(),l=m.useMemo(()=>Stt(a,i.contextName),[JSON.stringify(a),i.contextName]),c=xtt(i.operator),u=(...h)=>u0(i)&&h.every(g=>i.values.has(g))?h.length===1?[!1,`${h[0]} is already added.`]:[!1,"All the values are already added"]:c(...h);m.useEffect(()=>{var h,g;if((h=l.legalValues)!=null&&h.length&&((g=e.values)!=null&&g.length)){const v=btt(l.legalValues,e.values);r({type:"deleted legal values update",payload:v})}},[JSON.stringify(l.legalValues),JSON.stringify(e.values)]);const d=m.useMemo(()=>{var h;if((h=l.legalValues)!=null&&h.length&&Pb(i))return wtt(g=>c(g)[0],l.legalValues)},[JSON.stringify(l.legalValues),JSON.stringify(i.operator)]),p=(f=l.legalValues)!=null&&f.length?{legalValues:l.legalValues,invalidLegalValues:d,deletedLegalValues:o}:void 0;return{updateConstraint:r,constraint:i,validator:u,legalValueData:p}},jtt=x("article")(({theme:e})=>({"--padding":e.spacing(2),backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`})),Ett=x("div")(({theme:e})=>({"--gap":e.spacing(1),padding:"var(--padding)",display:"flex",flexFlow:"row nowrap",alignItems:"flex-start",justifyItems:"space-between",gap:"var(--gap)"})),QZ=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:"var(--gap)",alignSelf:"flex-start"})),Ttt=x(QZ)(({theme:e})=>({flexFlow:"row wrap"})),ktt=x("div")(({theme:e})=>({display:"flex",gap:"var(--gap)",flexFlow:"row wrap",width:"100%",height:"min-content"})),_tt=x("div")(({theme:e})=>({padding:"var(--padding)",borderTop:`1px dashed ${e.palette.divider}`})),Rtt=x(th)(({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}})),Ptt=x($t)(({theme:e})=>({position:"absolute",right:e.spacing(1)})),$F=x("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","&:is(:hover, :focus-visible)":{outline:`1px solid ${e.palette.primary.main}`}})),Att=x(HJe)(({theme:e})=>({path:{fill:"currentcolor"}})),Itt=x(WJe)(({theme:e})=>({path:{fill:e.palette.text.disabled},rect:{fill:e.palette.text.secondary}})),$tt=x("div")(({theme:e})=>({width:e.spacing(2)})),Ott=x(OJe)(({theme:e})=>({path:{fill:e.palette.text.disabled},rect:{fill:e.palette.text.secondary}})),Mtt=x(FZ)(({theme:e})=>({path:{fill:"currentColor"}})),Dtt=({addValues:e,clearValues:t,localConstraint:n,validator:r,addValuesButtonRef:o})=>VZ(n)?s.jsx(rQe,{setValue:e,value:n.value,validator:r}):mQe(n)?s.jsx(cF,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"A semver value should be of the format X.Y.Z",inputType:"text"}):gQe(n)?s.jsx(cF,{validator:r,onAddValue:e,removeValue:t,currentValue:n.value,helpText:"Add a single number",inputType:"number"}):s.jsx(zJe,{validator:r,helpText:"Maximum 100 char length per value",ref:o,onAddValues:e}),Ltt=({onDelete:e,constraint:t,onUpdate:n})=>{const{constraint:r,updateConstraint:o,validator:i,legalValueData:a}=Ctt(t,n),l=m.useCallback(C=>o({type:"add value(s)",payload:C}),[o]),c=m.useCallback(C=>o({type:"remove value",payload:C}),[o]),u=m.useCallback(()=>o({type:"clear values"}),[o]),d=m.useCallback(C=>o({type:"toggle value",payload:C}),[o]),p=m.useCallback(C=>{o({type:"set operator",payload:C})},[o]),{context:f}=ya(),{contextName:h,operator:g}=r,v=PZ(g),b=m.useRef(null),y=m.useRef(null);if(!f)return null;const w=f.map(C=>C.name),E=(!w.includes(r.contextName)?[...w,r.contextName].toSorted():w).map(C=>({key:C,label:C}));return s.jsxs(jtt,{children:[s.jsxs(Ett,{children:[s.jsxs(ktt,{children:[s.jsxs(QZ,{children:[s.jsx(Rtt,{visuallyHideLabel:!0,id:"context-field-select",name:"contextName",label:"Context Field",options:E,value:h||"",onChange:C=>o({type:"set context field",payload:C}),variant:"standard"}),s.jsxs(Ttt,{children:[s.jsx(hr,{title:`Make the selected operator${r.inverted?" inclusive":" exclusive"}`,arrow:!0,describeChild:!0,children:s.jsx($F,{type:"button",onClick:()=>o({type:"toggle inverted operator"}),children:r.inverted?s.jsx(Itt,{"aria-label":"The constraint operator is exclusive."}):s.jsx(Att,{"aria-label":"The constraint operator is inclusive."})})}),s.jsx(jJe,{options:MZ(h),value:g,onChange:p,inverted:r.inverted}),v?s.jsx(hr,{title:`Make match${r.caseInsensitive?" ":" not "}case sensitive`,arrow:!0,describeChild:!0,children:s.jsx($F,{type:"button",onClick:()=>o({type:"toggle case sensitivity"}),children:r.caseInsensitive?s.jsx(Ott,{"aria-label":"The match is not case sensitive."}):s.jsx(Mtt,{"aria-label":"The match is case sensitive."})})}):null]})]}),s.jsx($Je,{values:u0(r)?Array.from(r.values):a&&r.value?[r.value]:void 0,removeValue:c,getExternalFocusTarget:()=>y.current??b.current,children:a?null:s.jsx(Dtt,{localConstraint:r,addValues:l,clearValues:u,validator:i,addValuesButtonRef:y})})]}),s.jsx($tt,{}),s.jsx(hr,{title:"Delete constraint",arrow:!0,children:s.jsx(Ptt,{type:"button","data-testid":"DELETE_CONSTRAINT_BUTTON",size:"small",onClick:e,ref:b,children:s.jsx(Po,{fontSize:"inherit"})})})]}),a?s.jsx(_tt,{children:u0(r)?s.jsx(fQe,{values:r.values,toggleValue:d,clearAll:u,addValues:l,...a}):s.jsx(hQe,{toggleValue:d,value:r.value,...a})}):null]})},ZZ=e=>{const t=MZ(e)[0],n=Dd(t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1,[qs]:wi()}},Ftt=x("div")({width:"100%",display:"flex",flexDirection:"column"}),eee=m.forwardRef(({constraints:e,setConstraints:t},n)=>{const{context:r}=ya();m.useImperativeHandle(n,()=>({addConstraint(a){if(t){const l=ZZ(a);t(c=>[...c,l])}}})),m.useEffect(()=>{e.every(a=>qs in a)||t(e.map(a=>({[qs]:wi(),...a})))},[e,t]);const o=a=>{t(Ma(l=>{l.splice(a,1)}))},i=a=>l=>{t(Ma(c=>c.map(u=>u[qs]===a?l:u)))};return r.length===0?null:s.jsx(Ftt,{children:s.jsx(NC,{children:e.map((a,l)=>s.jsx(Ltt,{constraint:a,onDelete:()=>o(l),onUpdate:i(a[qs])},a[qs]))})})}),tee=(e,t)=>e.value&&e.contextName===c0?Ja(e.value,t.locale):e.value,Ntt=x(FC)({whiteSpace:"pre"}),Btt=x(da)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),ztt=x("div")(({theme:e})=>({width:"300px",marginBottom:e.spacing(2)})),Htt=({values:e})=>{const[t,n]=m.useState("");return!e||e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e.length>20,show:s.jsx(ztt,{children:s.jsx(HZ,{filter:t,setFilter:n})})}),e.filter(r=>r.includes(t)).map((r,o)=>s.jsx(Btt,{label:s.jsx(Ntt,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},Wtt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),Vtt=x("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),Utt=x(da)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),Gtt=({value:e,operator:t})=>e?s.jsxs(Wtt,{children:[s.jsxs(Vtt,{children:["Value must be ",t]})," ",s.jsx(Utt,{label:s.jsx(FC,{maxWidth:"400",text:e,maxLength:50})})]}):null,qtt=x("div")(({theme:e})=>({padding:e.spacing(1,0),maxHeight:"400px",overflowY:"auto"})),Ytt=({constraint:e})=>{const{locationSettings:t}=wo();return s.jsx("div",{children:s.jsxs(qtt,{children:[s.jsx(Htt,{values:e.values}),s.jsx(Gtt,{value:tee(e,t),operator:e.operator})]})})},X2="disabled-strategy-55d37c31-ca3f-4c19-bf86-9158824899bf",Ktt=x("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"}})),Xtt=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",flexGrow:1,position:"relative",[`.${X2} &`]:{filter:"grayscale(1)",color:e.palette.text.secondary},[e.breakpoints.down("sm")]:{width:"100%"}})),Jtt=x("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"}})),gc=({type:e,children:t,alignType:n})=>s.jsxs(Ktt,{children:[s.jsx(Jtt,{align:n,children:e}),s.jsx(Xtt,{children:t})]}),Qtt=x(da,{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"}}:{}})),Mg=m.forwardRef((e,t)=>s.jsx(Qtt,{size:"small",ref:t,...e})),Ztt=x("div")(({theme:e})=>({flex:"1 1 0",[e.breakpoints.down("sm")]:{display:"block",float:"left"}})),ent=x(yo)({padding:0,margin:0}),tnt=x("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)}})),nnt=x("div")(({theme:e})=>({padding:e.spacing(.25,1),background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge})),d1=({values:e,tooltips:t,onSetTruncated:n})=>s.jsxs(Ztt,{children:[e&&(e==null?void 0:e.length)===1?s.jsx(nnt,{children:s.jsx(yo,{title:e[0],arrow:!0,lines:2,onSetTruncated:()=>n==null?void 0:n(!1),children:s.jsx(Qa,{title:(t==null?void 0:t[e[0]])||"",children:s.jsx("span",{children:e[0]})})})}):null,e&&(e==null?void 0:e.length)>1?s.jsx(ent,{title:"",lines:2,onSetTruncated:n,component:"ul",children:e.map(r=>s.jsx(Qa,{title:(t==null?void 0:t[r])||"",children:s.jsx(tnt,{children:s.jsx("span",{children:r})})},r))}):null]}),rnt=(e,t)=>{const{context:n}=ya(),r=m.useMemo(()=>n.find(({name:o})=>o===e),[e,n]);return m.useMemo(()=>Object.fromEntries((t==null?void 0:t.map(o=>{var i,a;return[o,(a=(i=r==null?void 0:r.legalValues)==null?void 0:i.find(({value:l})=>l===o))==null?void 0:a.description]}).filter(([o,i])=>!!i))||[]),[n,t])},ont=(e,t)=>vJe(e)||PZ(e)&&!t,int=({label:e,inverted:t})=>s.jsx(kt,{title:t?`Not ${e}`:e,arrow:!0,children:s.jsx(Mg,{label:HT(e,t),multiline:!0})}),snt=x(Mg)(({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)"}})),ant=()=>s.jsx(kt,{title:"The match is case sensitive",arrow:!0,children:s.jsx(snt,{"aria-label":"The match is case sensitive",label:s.jsx(FZ,{style:{verticalAlign:"middle"},fill:"currentColor","aria-hidden":!0})})}),lnt=x("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"}})),cnt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5)})),unt=x("div")(({theme:e})=>({maxWidth:"150px",paddingRight:e.spacing(.5),overflow:"hidden",[e.breakpoints.down("sm")]:{maxWidth:"unset"}})),dnt=({onSetTruncated:e,viewMore:t,...n})=>{const{caseInsensitive:r,contextName:o,inverted:i,operator:a,value:l,values:c}=n,{locationSettings:u}=wo(),d=l?[tee(n,u)||"",...c||[]]:c||[],p=rnt(o,c||[]);return s.jsx(gc,{type:"Constraint",children:s.jsxs(lnt,{children:[s.jsx(unt,{children:s.jsx(yo,{title:o,arrow:!0,children:o})}),s.jsxs(cnt,{children:[s.jsx(int,{label:a,inverted:i}),ont(a,r)?s.jsx(ant,{}):null]}),s.jsxs("div",{children:[s.jsx(d1,{values:d,onSetTruncated:e,tooltips:p}),t]})]})})},pnt=x("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),fnt=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",width:"100%"}})),hnt=x("p")(({theme:e})=>({color:e.palette.secondary.main,margin:e.spacing(.25,0,0,.75),fontSize:e.fontSizes.smallerBody})),gnt=({constraint:e,allowExpand:t,expanded:n})=>{var i;const[r,o]=m.useState(!1);return s.jsx(pnt,{children:s.jsx(fnt,{children:s.jsx(dnt,{...e,onSetTruncated:a=>{o(a),t(a)},viewMore:r?s.jsx(hnt,{children:n?"View less":`View all (${(i=e.values)==null?void 0:i.length})`}):null})})})},mnt=x("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),vnt=x(Ue)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),ynt=({onUse:e})=>{const t=e&&(n=>{n.stopPropagation(),e()});return s.jsx(mnt,{children:s.jsx(X,{condition:!!t,show:s.jsx(kt,{title:"Use constraint",arrow:!0,children:s.jsx(vnt,{variant:"text",color:"primary",onClick:t,"data-testid":"USE_CONSTRAINT_BUTTON",children:"Use this"})})})})},xnt=cp("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),bnt=({constraint:e,onUse:t,allowExpand:n,expanded:r,disabled:o})=>s.jsxs(xnt,{children:[s.jsx(gnt,{constraint:e,allowExpand:n,expanded:r,disabled:o}),t?s.jsx(ynt,{onUse:t}):null]}),wnt=x(Dc,{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"})),Snt=x(Fc)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),Cnt=x(Lc)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),jnt=x("div")({display:"flex",flexDirection:"column",width:"100%"}),qC=({constraint:e,onUse:t,sx:n=void 0,disabled:r=!1,renderAfter:o,borderStyle:i="solid"})=>{const[a,l]=m.useState(!0),[c,u]=m.useState(!1),d=()=>{a&&u(!c)};return s.jsxs(wnt,{expanded:c,sx:n,borderStyle:i,children:[s.jsx(Snt,{expandIcon:null,onClick:d,sx:{cursor:a?"pointer":"default!important","&:hover":{cursor:a?"pointer":"default!important"}},tabIndex:a?0:-1,children:s.jsxs(jnt,{children:[s.jsx(bnt,{constraint:e,onUse:t,allowExpand:l,disabled:r,expanded:c}),o]})}),s.jsx(Cnt,{children:s.jsx(Ytt,{constraint:e})})]})},Ent=x("div")(({theme:e})=>({marginTop:e.spacing(3)})),Tnt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),knt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),_nt=({setConstraints:e,constraints:t=[]})=>{const{items:n}=iZ();if(n.length===0||!e)return null;const r=n.filter(o=>!t.some(i=>oZ(i,o)));return r.length===0?null:s.jsxs(Ent,{children:[s.jsx(Tnt,{children:"Recently used constraints"}),s.jsx(knt,{children:r.map(o=>s.jsx(qC,{constraint:o,borderStyle:"dashed",onUse:()=>{e(i=>[...i,o])}},OT(o)))})]})},Rnt=e=>{const t=m.useRef(new WeakMap),[,n]=m.useState(0),r=m.useCallback((i,a)=>{t.current.set(i,a),n(l=>l+1)},[]),o=m.useCallback(i=>t.current.get(i),[]);return m.useMemo(()=>({set:r,get:o}),[r,o])},Pnt=x("div")({width:"100%",display:"flex",flexDirection:"column"}),Ant=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),Int=e=>{var o;const{uiConfig:t}=rt(),n=((o=t.resourceLimits)==null?void 0:o.constraints)||30,r=e>=n;return{limit:n,limitReached:r}},$nt=(e,t)=>{const n=Rnt(),{context:r}=ya(),o=e&&(a=>{const l=ZZ(a);n.set(l,{editing:!0,new:!0}),e(c=>[...c,l])});return m.useImperativeHandle(t,()=>({addConstraint:o})),{onAdd:o&&(()=>{o(r[0].name)}),state:n,context:r}},nee=m.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n},r)=>{const{onAdd:o,context:i}=$nt(t,r),{limit:a,limitReached:l}=Int(e.length);return i.length===0?null:s.jsx(Pnt,{children:s.jsx(X,{condition:!!(n&&o),show:s.jsxs("div",{children:[s.jsxs(Ant,{children:[s.jsx(Z,{children:"Constraints"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),t?s.jsx(eee,{ref:r,setConstraints:t,constraints:e}):null,s.jsx(J,{sx:c=>({marginTop:c.spacing(2),marginBottom:c.spacing(2)}),children:s.jsx(ly,{name:"constraints in this strategy",shortName:"constraints",currentValue:e.length,limit:a})}),s.jsx(Ue,{type:"button",onClick:o,startIcon:s.jsx(Oo,{}),variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",disabled:!!l,children:"Add constraint"}),s.jsx(_nt,{setConstraints:t,constraints:e})]})})})}),Ont=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},Mnt=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{m.useEffect(()=>()=>{n.constraints&&r(c=>{var u;return{...c,constraints:(u=c.constraints)==null?void 0:u.filter(Ont)}})},[]);const o=n.constraints||[],i=c=>{r(u=>({...u,constraints:c instanceof Function?c(u.constraints||[]):c}))},a=Pg(hX,e,t),l=Pg(lC,e,t);return s.jsx(nee,{constraints:o,setConstraints:l?i:void 0,showCreateButton:a})},YC=()=>{const{makeRequest:e,makeLightRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0}),i=async(E,C)=>{const k=n("api/admin/features/validate",{method:"POST",body:JSON.stringify({name:E,projectId:C})});return e(k.caller,k.id)},a=async E=>{const T=n("api/admin/constraints/validate",{method:"POST",body:JSON.stringify(E)});await e(T.caller,T.id)},l=async(E,C)=>{const T=`/api/admin/projects/${E}/features`,k=n(T,{method:"POST",body:JSON.stringify(C)});await e(k.caller,k.id)},c=m.useCallback(async(E,C,T,k=!1)=>{const _=`api/admin/projects/${E}/features/${C}/environments/${T}/on?shouldActivateDisabledStrategies=${k}`,A=n(_,{method:"POST"},"toggleFeatureEnvironmentOn");return t(A.caller,A.id)},[n,t]),u=m.useCallback(async(E,C,T,k=!1)=>{const _=`api/admin/projects/${E}/bulk_features/environments/${T}/on?shouldActivateDisabledStrategies=${k}`,A=n(_,{method:"POST",body:JSON.stringify({features:C})},"bulkToggleFeaturesEnvironmentOn");return e(A.caller,A.id)},[n,e]),d=m.useCallback(async(E,C,T,k=!1)=>{const _=`api/admin/projects/${E}/bulk_features/environments/${T}/off?shouldActivateDisabledStrategies=${k}`,A=n(_,{method:"POST",body:JSON.stringify({features:C})},"bulkToggleFeaturesEnvironmentOff");return e(A.caller,A.id)},[n,e]),p=m.useCallback(async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}/environments/${T}/off`,_=n(k,{method:"POST"},"toggleFeatureEnvironmentOff");return t(_.caller,_.id)},[n,t]);return{validateFeatureToggleName:i,validateConstraint:a,createFeatureToggle:l,changeFeatureProject:async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}/changeProject`,_=n(k,{method:"POST",body:JSON.stringify({newProjectId:T})});return e(_.caller,_.id)},errors:r,toggleFeatureEnvironmentOn:c,toggleFeatureEnvironmentOff:p,addTagToFeature:async(E,C)=>{const T=`api/admin/features/${E}/tags`,k=n(T,{method:"POST",body:JSON.stringify({...C})});return e(k.caller,k.id)},deleteTagFromFeature:async(E,C,T)=>{const k=`${encodeURIComponent(C)}/${encodeURIComponent(T)}`,_=`api/admin/features/${E}/tags/${k}`,A=n(_,{method:"DELETE"});return e(A.caller,A.id)},updateFeatureTags:async(E,C)=>{const T=`api/admin/features/${E}/tags`,k=n(T,{method:"PUT",body:JSON.stringify({...C})});return e(k.caller,k.id)},archiveFeatureToggle:async(E,C)=>{const T=`api/admin/projects/${E}/features/${C}`,k=n(T,{method:"DELETE"});return e(k.caller,k.id)},patchFeatureToggle:async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}`,_=n(k,{method:"PATCH",body:JSON.stringify(T)});return e(_.caller,_.id)},patchFeatureEnvironmentVariants:async(E,C,T,k)=>{const _=`api/admin/projects/${E}/features/${C}/environments/${T}/variants`,A=n(_,{method:"PATCH",body:JSON.stringify(k)});return e(A.caller,A.id)},overrideVariantsInEnvironments:async(E,C,T,k)=>{const _=`api/admin/projects/${E}/features/${C}/variants-batch`,A=n(_,{method:"PUT",body:JSON.stringify({variants:T,environments:k})});return e(A.caller,A.id)},cloneFeatureToggle:async(E,C,T)=>{const k=`api/admin/projects/${E}/features/${C}/clone`,_=n(k,{method:"POST",body:JSON.stringify(T)});return e(_.caller,_.id)},loading:o,bulkToggleFeaturesEnvironmentOn:u,bulkToggleFeaturesEnvironmentOff:d}},OF=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},KC=e=>{const t=!!(e&&e.length===0),[n,r]=m.useState(t),{validateConstraint:o}=YC();return m.useEffect(()=>{if(!e)return;if(e.find(l=>!OF(l))){r(!1);return}const a=e.filter(OF).map(l=>o(l));Promise.all(a).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},Dnt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),Lnt=x(pp)({flex:1}),PI=({label:e,options:t,value:n=[],onChange:r,disabled:o,icon:i,width:a="215px"})=>{const l=qt(),c=u=>{const{InputProps:d}=u;let p;return i!==null&&(p=s.jsx(fp,{position:"start",children:i||s.jsx(Oo,{sx:{height:20,width:20,color:l.palette.primary.main}})})),s.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 s.jsx(Dnt,{children:s.jsx(Lnt,{options:t,value:n,onChange:(u,d)=>r(d||[]),renderInput:c,getOptionLabel:u=>u.label,disabled:o,size:"small",multiple:!0})})},Fnt=x("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})),MF=x("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer",color:e.palette.secondary.dark})),Nnt=x(xt)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),R5=e=>({fontSize:e.fontSizes.bodySize}),ree=({segment:e,setSegments:t,preview:n,setPreview:r,"aria-controls":o})=>{const i=()=>{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=s.jsx(X,{condition:e===n,show:s.jsx(R9,{titleAccess:"Hide",sx:R5}),elseShow:s.jsx(oy,{titleAccess:"Show",sx:R5})}),c=e===n?"Hide segment constraints":"Preview segment constraints";return s.jsxs(Fnt,{children:[s.jsx(Nnt,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),s.jsx(kt,{title:c,arrow:!0,children:s.jsx(MF,{type:"button",onClick:a,"aria-expanded":e===n,"aria-controls":o,children:l})}),s.jsx(kt,{title:"Remove segment",arrow:!0,children:s.jsx(MF,{type:"button",onClick:i,children:s.jsx(bI,{titleAccess:"Remove",sx:R5})})})]})},Bnt=x(mZ)(()=>({padding:0})),znt=x(Dc)(()=>({boxShadow:"none",margin:0,padding:0,"::before":{display:"none"}})),Hnt=x(Fc)(({theme:e})=>({fontSize:e.typography.body2.fontSize,minHeight:"unset",":focus-within":{backgroundColor:"inherit"}})),Wnt=x(Lc)(({theme:e})=>({padding:e.spacing(.5,3,2.5)})),Vnt=x(xt)(({theme:e})=>({textDecoration:"none",paddingRight:e.spacing(.5),"&:hover":{textDecoration:"underline"}})),Unt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:"auto"})),Gnt=x(Ue)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),qnt=x("p")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),AI=({segment:e,isExpanded:t,headerContent:n,constraintList:r})=>{const[o,i]=m.useState(t||!1),a=m.useId(),l=m.useMemo(()=>{var c;return r||((c=e.constraints)!=null&&c.length?s.jsx(NC,{children:e.constraints.map((u,d)=>s.jsx(qC,{constraint:u},`${vm(u)}-${d}`))}):s.jsx(qnt,{children:"This segment has no constraints."}))},[r,e.constraints]);return s.jsx(Bnt,{children:s.jsxs(znt,{expanded:o,disableGutters:!0,TransitionProps:{mountOnEnter:!0,unmountOnExit:!0},children:[s.jsxs(Hnt,{id:`segment-accordion-${e.id}`,tabIndex:-1,"aria-controls":a,children:[s.jsx(gc,{type:"Segment",children:s.jsx(Vnt,{to:`/segments/edit/${e.id}`,children:e.name})}),n||null,t?null:s.jsx(Unt,{children:s.jsx(Gnt,{"aria-controls":a,size:"small",variant:"outlined",onClick:()=>i(c=>!c),children:o?"Close preview":"Preview"})})]}),s.jsx(Wnt,{children:l})]})})},Ynt=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),Knt=x("p")(({theme:e})=>({color:e.palette.text.secondary})),Xnt=x("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})),Jnt=x("div")({display:"contents"}),Qnt=({segments:e,setSegments:t})=>{const[n,r]=m.useState(),o=e.length-1,i=m.useId();return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e&&e.length>0,show:s.jsx(Knt,{children:"Selected Segments"})}),s.jsx(Ynt,{children:e.map((a,l)=>s.jsxs(m.Fragment,{children:[s.jsx(ree,{segment:a,setSegments:t,preview:n,setPreview:r,"aria-controls":i}),s.jsx(X,{condition:l<o,show:s.jsx(Xnt,{children:"AND"})})]},a.id))}),s.jsx(Jnt,{id:i,children:s.jsx(X,{condition:!!n,show:s.jsx(AI,{segment:n,isExpanded:!0})})})]})},bp=()=>{const{uiConfig:e}=rt();return{segmentValuesLimit:e.resourceLimits.segmentValues,strategySegmentsLimit:e.resourceLimits.strategySegments}},Znt=()=>{const{segmentValuesLimit:e}=bp();return typeof e>"u"?null:s.jsxs(Lt,{severity:"info",children:["A segment can have"," ",s.jsxs("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," values across all of its constraints"]}),". ",s.jsx(iee,{})]})},ert=e=>{const{segmentValuesLimit:t}=bp();return typeof t>"u"?null:s.jsxs(Lt,{severity:"error",children:["A segment can have"," ",s.jsxs("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",t," across all of its contraints"]}),". This segment has ",e.values," ",e.values===1?"value":"values","."]})},oee=()=>{const{strategySegmentsLimit:e}=bp();return typeof e>"u"?null:s.jsxs(Lt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",s.jsx(iee,{})]})},iee=()=>s.jsxs(s.Fragment,{children:[s.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),see="https://docs.getunleash.io/reference/segments",trt=x(da)(({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}})),nrt=({segment:e,setSegments:t})=>{const n=()=>{t(r=>r.some(o=>o.id===e.id)?r:[...r,e])};return s.jsx(kt,{title:"Add segment",arrow:!0,children:s.jsx(trt,{label:e.name,icon:s.jsx(Oo,{}),onClick:n,size:"small",variant:"outlined"})})},rrt=x("div")(({theme:e})=>({marginTop:e.spacing(3)})),ort=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary,marginBottom:e.spacing(1)})),irt=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),srt=({setSegments:e,segments:t=[]})=>{const{items:n}=sZ(),{segments:r}=ma();if(n.length===0||!e||!r)return null;const i=n.map(a=>r.find(l=>l.id===a)).filter(a=>a!==void 0).filter(a=>!t.some(l=>l.id===a.id));return i.length===0?null:s.jsxs(rrt,{children:[s.jsx(ort,{children:"Recently used segments"}),s.jsx(irt,{children:i.map(a=>s.jsx(nrt,{segment:a,setSegments:e},a.id))})]})},art=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),lrt=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=ma(),{strategySegmentsLimit:o}=bp(),i=!!(o&&e.length>=o);if(!r||r.length===0)return null;const c=r.filter(({project:d})=>!d||d===n).filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name})),u=([d])=>{const p=r.find(f=>String(f.id)===d.value);p&&t(f=>[...f,p])};return s.jsxs(s.Fragment,{children:[s.jsxs(art,{children:[s.jsx(Z,{children:"Segments"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),i&&s.jsx(oee,{}),s.jsx(PI,{label:"Select segments",options:c,onChange:u,disabled:i,icon:null,width:"175px"}),s.jsx(Qnt,{segments:e,setSegments:t}),s.jsx(srt,{setSegments:t,segments:e})]})},crt=(e,t)=>{const{type:n,required:r}=e;if(!(n!=="string"&&n!=="list"&&n!=="number")){if(r&&(typeof t>"u"||t===""))return"Field is required";if(n==="number"&&!urt(t))return"Not a valid number."}},urt=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),drt=({environment:e})=>s.jsxs(Lt,{severity:"info",children:[s.jsx("strong",{children:"Change requests"})," are enabled",e?` for ${e}`:"",". Your changes needs to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]}),prt=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const{value:i,setValue:a}=II(),[l,c]=m.useState(i.hide),u=()=>{a(d=>({hide:!d.hide})),c(d=>!d)};return s.jsxs(Gn,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[s.jsx(Lt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),s.jsx("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),s.jsx(qr,{label:"Don't show again",control:s.jsx(pa,{checked:l,onChange:u})})]})},frt=(e,t)=>{var r;const{value:n}=II();return n.hide?!1:typeof e=="string"?e===lf:(r=e==null?void 0:e.environments)==null?void 0:r.some(o=>o.name===t&&o.type===lf)},hrt="useFeatureStrategyProdGuardSettings:v2",II=()=>Au(hrt,{hide:!1}),ELt=e=>{const{value:t}=II();return e===lf&&!t.hide},grt=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&["In review","Approved"].includes(r.state)):!1,alert:s.jsx(Lt,{sx:{margin:"1rem 0"},severity:"warning",children:"You currently have a change request in review for this environment. Adding a new change will add the change to the existing change request, and all existing approvals will be reset. Are you sure you want to continue?"})}),mrt=({title:e,setTitle:t})=>s.jsxs(J,{sx:{paddingBottom:n=>n.spacing(2)},children:[s.jsx(Z,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),s.jsx(vr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),vrt=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium})),yrt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1)})),xrt=({enabled:e,onToggleEnabled:t})=>s.jsxs(vrt,{children:[s.jsx(Z,{variant:"body2",fontWeight:"bold",children:"Strategy Status"}),s.jsxs(yrt,{children:[s.jsx(qr,{control:s.jsx(pa,{name:"enabled",onChange:t,checked:e}),label:s.jsx(Z,{variant:"body2",children:"Active"})}),s.jsx(Z,{variant:"body2",color:"text.secondary",children:"Strategy will be exposed when environment is enabled"})]})]}),brt="/static/upgradeChangeRequests-B-dEhRV6.png",wrt=x(J)(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.secondary.border}`,padding:e.spacing(2),display:"flex",position:"relative"})),Srt=x(kn)(({theme:e})=>({textDecoration:"none",fontWeight:e.typography.fontWeightBold})),Crt=x("img")(({theme:e})=>({height:e.spacing(6)})),jrt=x($t)(({theme:e})=>({position:"absolute",top:e.spacing(.5),right:e.spacing(.5)})),Ert=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(3),marginLeft:e.spacing(.5),marginRight:e.spacing(1)})),Trt=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",gap:e.spacing(.5)})),krt=()=>{const[e,t]=ol("upgrade-change-requests:v1","open");return e==="closed"?null:s.jsxs(wrt,{children:[s.jsxs(Ert,{children:[s.jsx(Crt,{src:ti(brt),alt:"Change requests"}),s.jsxs(Trt,{children:[s.jsxs("p",{children:["Include ",s.jsx("b",{children:"Change Requests"})," in your process to bring a pull request-like experience to your feature flags. Reduce the risk of errors with the four-eyes approval principle."]}),s.jsx(Srt,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=change-requests",target:"_blank",children:"View our Enterprise offering"})]})]}),s.jsx(kt,{title:"Dismiss",arrow:!0,children:s.jsx(jrt,{"aria-label":"dismiss",onClick:()=>{t("closed")},size:"small",children:s.jsx(Ho,{fontSize:"inherit"})})})]})},_rt=x("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%"})),Rrt=x("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),Prt=x("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}`})),Art=x(bR)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),Irt=x(J)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),$rt=x(jr)(({theme:e})=>({width:"100%"})),Ort=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),Mrt=x(J)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),Drt=x(If)(({theme:e})=>({width:"100px"})),DF=x(sn)(({theme:e})=>({marginLeft:e.spacing(1)})),Lrt=x(pI)({top:"-10px",left:"0",transform:"translateY(0)"}),aee=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:a,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:p,isChangeRequest:f,tab:h,setTab:g,StrategyVariants:v,Limit:b,disabled:y})=>{var ve;const{trackEvent:w}=Kt(),[S,j]=m.useState(!1),E=KC(l.constraints),C=frt(t,n),T=Pg(r,e,n),{strategyDefinition:k}=LC(l==null?void 0:l.name);m.useEffect(()=>{w("new-strategy-form",{props:{eventType:"seen"}})},[]);const _=l!=null&&l.parameters&&"stickiness"in(l==null?void 0:l.parameters)?String(l.parameters.stickiness):"default";m.useEffect(()=>{c(he=>({...he,variants:(l.variants||[]).map(ye=>({stickiness:_,name:ye.name,weight:ye.weight,payload:ye.payload,weightType:ye.weightType}))}))},[_,JSON.stringify(l.variants)]);const A=t.environments.find(he=>he.name===n),{data:O}=uy(t.project),{changeRequestInReviewOrApproved:M,alert:H}=grt(O),P=M(n||""),$=P?"Add to existing change request":"Add change to draft",{isOss:D}=rt(),z=(A==null?void 0:A.type)==="production"&&D(),B=Ot(),{error:L,loading:I}=rt();if(L)throw L;if(I||!k)return null;const q=he=>k.parameters.find(ye=>ye.name===he),ee=(he,ye)=>{const Pe=crt(q(he),ye);return Pe?(p.setFormError(he,Pe),!1):(p.removeFormError(he),!0)},W=()=>k.parameters.map(he=>he.name).map(he=>{var ye;return ee(he,(ye=l.parameters)==null?void 0:ye[he])}).every(Boolean),oe=()=>{B(MI(t.project,t.name))},ne=async he=>{var ye;Array.isArray(l.variants)&&((ye=l.variants)==null?void 0:ye.length)>0&&w("strategy-variants",{props:{eventType:"submitted"}}),he.preventDefault(),W()&&(w("new-strategy-form",{props:{eventType:"submitted"}}),C&&!f?j(!0):o())},ce=(he,ye)=>{g(ye)},xe=()=>{var Pe;const he=((Pe=l.constraints)==null?void 0:Pe.length)||0,ye=u.length||0;return he+ye},re=!!(l.parameters&&"stickiness"in l.parameters);return s.jsxs(s.Fragment,{children:[s.jsx(Ort,{children:s.jsx(Rrt,{children:Il(l.name||"")})}),s.jsxs(Mrt,{children:[s.jsx(X,{condition:P,show:H,elseShow:s.jsx(X,{condition:f,show:s.jsx(drt,{environment:n})})}),s.jsx(X,{condition:!uJ.includes(l.name||"default"),show:s.jsxs(Lt,{severity:"warning",children:["Custom strategies are deprecated. We recommend not adding them to any flags going forward and using the predefined strategies like Gradual rollout with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",variant:"body2",children:"constraints"})," ","instead."]})})]}),s.jsxs(Art,{value:h,onChange:ce,children:[s.jsx(Drt,{label:"General"}),s.jsx(If,{"data-testid":"STRATEGY_TARGETING_TAB",label:s.jsxs(Z,{children:["Targeting",s.jsx(DF,{children:xe()})]})}),re&&s.jsx(If,{"data-testid":"STRATEGY_VARIANTS_TAB",label:s.jsxs(Z,{children:["Variants",s.jsx(DF,{children:((ve=l.variants)==null?void 0:ve.length)||0})]})})]}),s.jsxs(_rt,{onSubmit:ne,children:[s.jsx(X,{condition:h===0,show:s.jsxs(s.Fragment,{children:[s.jsx(mrt,{title:l.title||"",setTitle:he=>{c(ye=>({...ye,title:he}))}}),s.jsx(dJe,{strategy:l,strategyDefinition:k,setStrategy:c,validateParameter:ee,errors:p,hasAccess:T}),s.jsx(xrt,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(he=>({...he,disabled:!he.disabled}))}),s.jsx(X,{condition:!f,show:s.jsx(pJe,{projectId:t.project,featureId:t.name,environmentId:n})})]})}),s.jsx(X,{condition:h===1,show:s.jsxs(s.Fragment,{children:[s.jsx(Lt,{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."}),s.jsx(lrt,{segments:u,setSegments:d,projectId:e}),s.jsxs(Irt,{children:[s.jsx($rt,{}),s.jsx(Lrt,{})]}),s.jsx(Mnt,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c})]})}),s.jsx(X,{condition:h===2,show:s.jsx(X,{condition:re,show:v})}),s.jsx(J,{sx:{flex:1,display:"flex",alignItems:"flex-end"},children:b}),z?s.jsx(krt,{}):null,s.jsxs(Prt,{children:[s.jsx(Ro,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:y||a||!E||p.hasFormErrors(),"data-testid":kje,children:f?$:"Save strategy"}),s.jsx(Ue,{type:"button",color:"primary",onClick:i||oe,disabled:a,children:"Cancel"}),s.jsx(prt,{open:S,onClose:()=>j(!1),onClick:o,loading:a,label:"Save strategy"})]})]})]})},$I=({name:e,value:t="",label:n="",options:r,onChange:o,id:i,disabled:a=!1,className:l,classes:c,formControlStyles:u={},...d})=>{const p=()=>r.map(f=>s.jsx(Cr,{value:f.key,title:f.title||"","data-testid":`${$R}-${f.label}`,children:f.label},f.key));return s.jsxs(Is,{variant:"outlined",size:"small",classes:c,style:u,children:[s.jsx(Su,{htmlFor:i,children:n}),s.jsx($c,{name:e,disabled:a,onChange:o,className:l,label:n,id:i,value:t,...d,children:p()})]})},Frt=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const i=l=>{const u=l.target.value.split(/,\s?/).map(d=>d.trim());t(u)},a=l=>{if(l.key==="Backspace"){const c=l.target.value;if(c.endsWith(", ")){l.preventDefault();const u=c.slice(0,-2);t(u.split(/,\s*/))}}};return s.jsx(xn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},Nrt=x("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"}}})),Brt=x($I)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),zrt=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),Hrt=x(Frt)(()=>({width:"100%"})),Wrt=x(xn)(()=>({width:"100%"})),Vrt=({overrides:e,overridesDispatch:t})=>{const{context:n}=ya(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},i=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return s.jsx(s.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 s.jsxs(Nrt,{children:[s.jsx(Brt,{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]})}),s.jsxs(zrt,{children:[s.jsx(X,{condition:!!(u&&u.length>0),show:s.jsx(pp,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(f,h)=>f===h,options:u,onChange:i(l),getOptionLabel:f=>f,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:f=>s.jsx(Wrt,{...f,variant:"outlined",label:"Legal values"})}),elseShow:s.jsx(Hrt,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),s.jsx(kt,{title:"Remove",arrow:!0,children:s.jsx($t,{onClick:f=>{f.preventDefault(),t({type:"REMOVE",payload:l})},children:s.jsx(Po,{})})})]})]},`override=${l}`)})})},Urt=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((n,r)=>r!==t.payload);case"UPDATE_VALUES_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,contextName:r}:o)}}},Grt=(e=[])=>m.useReducer(Urt,e);var oc=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(oc||{});const qrt=Je.lazy(()=>va(()=>import("./ReactJSONEditor-DZ9l5V9S.js"),[])),Yrt=x("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"})),Krt=x("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),Xrt=x(kt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),lee=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),LF=x(lee)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),Jrt=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),Qrt=x(qr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),Zrt=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),FF=x(vr)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),eot=x("div")(({theme:e})=>({marginLeft:e.spacing(3)})),tot=x(vr)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),not=x("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),cee=x("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%"}}})),rot=x(cee)({alignItems:"end",justifyContent:"space-between"}),oot=x($I)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),iot=x(Ue)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),sot=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"},{key:"number",label:"number"}],aot={type:"string",value:""},uee=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:a,weightsError:l})=>{const[c,u]=m.useState(e.name),[d,p]=m.useState(e.weightType===oc.FIX),[f,h]=m.useState(String(e.weight/10)),[g,v]=m.useState(e.payload||aot),[b,y]=Grt("overrides"in e?e.overrides||[]:[]),{context:w}=ya(),[S,j]=m.useState({}),E=L=>{j(I=>({...I,[L]:void 0}))},C=(L,I)=>{j(q=>({...q,[L]:I}))};m.useEffect(()=>{E("percentage"),o!=null&&o.includes("%")&&C("percentage","Total weight must equal 100%")},[o]);const T=!e.new,k=t.filter(({id:L,weightType:I})=>L!==e.id&&I===oc.VARIABLE).length>0,_=L=>{const I=L.weightType===oc.VARIABLE,q=t.some(W=>W.weightType===oc.FIX),ee=t.filter(W=>W.weightType===oc.VARIABLE).length===1;return q&&ee&&I},A=L=>{E("name"),$(L,e.id)||C("name","A variant with that name already exists for this environment."),u(L.trim())},O=L=>{(L===""||D(L))&&h(L)},M=L=>{z(L)||C("payload",L.type==="json"?"Invalid json":"Invalid number")},H=()=>{w.length>0&&y({type:"ADD",payload:{contextName:w[0].name,values:[]}})},P=L=>!!L.length,$=(L,I)=>T||!t.some(q=>q.name===L&&q.id!==I),D=L=>{if(!d)return!0;if(L===""||L.match(/\.[0-9]{2,}$/))return!1;const I=Number(L);return I>=0&&I<=100},z=L=>{try{return L.type==="json"&&JSON.parse(L.value),L.type==="number"?!Number.isNaN(Number(L.value)):!0}catch{return!1}};m.useEffect(()=>{const L={...e,name:c,weight:Number(d?f:100)*10,weightType:d?oc.FIX:oc.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:g.value?g:void 0,isValid:P(c)&&$(c,e.id)&&D(f)&&z(g)&&!o};i||(L.overrides=b.map(I=>({contextName:I.contextName,values:I.values})).filter(I=>I.values&&I.values.length>0)),n(L)},[c,d,f,g,b]),m.useEffect(()=>{d||h(String(e.weight/10))},[e.weight]);const B=S!=null&&S.percentage||l?"Total weight may not exceed 100%":"";return s.jsxs(Yrt,{"data-testid":"VARIANT",children:[s.jsx(Krt,{color:a}),s.jsx(Xrt,{arrow:!0,title:_(e)?"You need to have at least one variable variant":"Delete variant",children:s.jsx("div",{children:s.jsx($t,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:_(e),children:s.jsx(Po,{})})})}),s.jsxs(rot,{children:[s.jsxs(not,{children:[s.jsx(lee,{children:"Variant name"}),s.jsx(Jrt,{children:"This will be used to identify the variant in your code"}),s.jsx(FF,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!S.name,errorText:S.name,value:c,onChange:L=>A(L.target.value),disabled:T,required:!0})]}),s.jsx(X,{condition:k,show:s.jsxs(eot,{children:[s.jsx(Qrt,{label:"Custom percentage",control:s.jsx(fa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:d,onChange:L=>p(L.target.checked)})}),s.jsx(tot,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!B,errorText:B,value:f,onChange:L=>O(L.target.value),required:d,disabled:!d,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:s.jsx(fp,{position:"end",children:"%"})}})]})})]}),s.jsxs(LF,{children:["Payload",s.jsx(bo,{tooltip:"Passed along with the the variant object."})]}),s.jsxs(cee,{children:[s.jsx(oot,{id:"variant-payload-type",name:"type",label:"Type",value:g.type,options:sot,onChange:L=>{E("payload"),v(I=>({...I,type:L.target.value}))}}),s.jsx(Zrt,{children:s.jsx(X,{condition:g.type==="json",show:s.jsx(m.Suspense,{fallback:null,children:s.jsx(qrt,{content:{text:g.value},onChange:L=>v(I=>{var q;return{...I,value:"json"in L?((q=L.json)==null?void 0:q.toString())||"":L.text}})})}),elseShow:s.jsx(FF,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:g.type!=="string",rows:g.type==="string"||g.type==="number"?1:4,value:g.value,onChange:L=>{E("payload"),v(I=>({...I,value:L.target.value}))},placeholder:"",onBlur:()=>M(g),error:!!S.payload,errorText:S.payload})})})]}),i?null:s.jsxs(s.Fragment,{children:[s.jsxs(LF,{children:["Overrides",s.jsx(bo,{tooltip:"Here you can specify which users should get this variant."})]}),s.jsx(Vrt,{overrides:b,overridesDispatch:y}),s.jsx("div",{children:s.jsx(iot,{onClick:H,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})},lot=x(J)(({theme:e})=>({display:"flex",flexDirection:"column"})),cot=x(J)(({theme:e})=>({display:"flex",alignItems:"center",minWidth:"250px",gap:e.spacing(1)})),uot=x(J)(({theme:e})=>({padding:e.spacing(1,0,.75,0),flexDirection:"column"})),dot=x("span")(({theme:e})=>({marginBottom:e.spacing(1),fontSize:e.typography.body2.fontSize})),pot=x(J,{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]}})),fot=x("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})),hot=x("code")(({theme:e})=>({display:"inline-block",background:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.25,1),fontSize:e.fontSizes.smallerBody})),got=({variant:{name:e,weight:t,payload:n},index:r,selected:o})=>s.jsxs(lot,{children:[s.jsxs(cot,{children:[s.jsx(pot,{index:r,children:s.jsx("figure",{})}),s.jsxs(Z,{variant:"subtitle2",children:[t/10,"% - ",e]})]}),n?s.jsxs(uot,{sx:{display:["json","csv"].includes(n.type)?"flex":"block"},children:[s.jsxs(dot,{children:[s.jsx(fot,{children:n.type})," payload: "]}),s.jsx(hot,{children:n.value})]}):null]}),mot=x(J)(()=>({display:"flex",width:"100%",position:"relative"})),vot=x(J)(({theme:e,selected:t})=>({position:"relative",fontSize:e.fontSizes.smallerBody,...t?{fontWeight:e.typography.fontWeightBold}:{}})),yot=x(J,{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}:{}})),xot=x(J)(({theme:e})=>({padding:e.spacing(.25,.25),lineHeight:1})),bot=x(J)(({theme:e})=>({padding:e.spacing(.125,.25,0),overflow:"hidden",color:e.palette.text.secondary})),wot=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),Sot=x(Z)(({theme:e})=>({marginY:e.spacing(1)})),OI=({variants:e,weightsError:t,header:n=!0,selected:r})=>e.length<1?null:s.jsxs(J,{sx:o=>({marginTop:o.spacing(n?2:0)}),children:[n?s.jsx(wot,{children:s.jsxs(Sot,{variant:"body2",children:["Flag variants (",e.length,")"]})}):null,s.jsx(mot,{children:e.map((o,i)=>{const a=o.weight/10;return a===0?null:s.jsx(Qa,{variant:"custom",arrow:!0,onClick:l=>l.preventDefault(),titleComponent:s.jsx(got,{variant:o,index:i,selected:r===o.name}),children:s.jsxs(vot,{sx:{width:`${a}%`},selected:r===o.name,children:[s.jsx(yot,{index:i,isFirst:i===0,isLast:i===e.length-1,hasError:t,children:s.jsx(xot,{children:s.jsx(yo,{lines:1,children:`${a}%`})})}),s.jsx(bot,{children:s.jsx(yo,{lines:1,children:o.name})})]})},i)})})]}),dee=()=>s.jsxs(Lt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",s.jsx(Cot,{}),"."]}),TLt=()=>s.jsxs(Lt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",s.jsx("b",{children:"variants inside strategies"}),". ",s.jsx(jot,{})]}),Cot=()=>s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),jot=()=>s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),Eot=x("div")({display:"flex",flexDirection:"column"}),Tot=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),pee=({strategy:e,setStrategy:t,projectId:n,environment:r,editable:o})=>{const{trackEvent:i}=Kt(),a=(e.variants||[]).map(g=>({...g,new:o||!1,isValid:!0,id:wi(),overrides:[]})),[l,c]=m.useState(a),u=qt(),d=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";m.useEffect(()=>()=>{t(g=>({...g,variants:l.filter(v=>!!v.name)}))},[JSON.stringify(l)]),m.useEffect(()=>{t(g=>({...g,variants:l.map(v=>({stickiness:d,name:v.name,weight:v.weight,payload:v.payload,weightType:v.weightType}))}))},[d,JSON.stringify(l)]);const p=(g,v)=>{c(b=>I2(b.map(y=>y.id===v?g:y),1e3))},f=()=>{const g=wi();c(v=>[...v,{name:"",weightType:oc.VARIABLE,weight:0,stickiness:d,new:!0,isValid:!1,id:g}]),i("strategy-variants",{props:{eventType:"variant added"}})},h=l.reduce((g,v)=>g+(v.weight||0),0)!==1e3;return s.jsxs(s.Fragment,{children:[s.jsx(Lt,{severity:"info",icon:!1,children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),s.jsxs(Tot,{children:[s.jsx(Z,{children:"Variants"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),s.jsxs(Eot,{children:[s.jsx(X,{condition:l.length>0,show:s.jsx(dee,{})}),l.map((g,v)=>s.jsx(uee,{disableOverrides:!0,variant:g,variants:l,updateVariant:b=>p(b,g.id),removeVariant:()=>c(b=>I2(b.filter(y=>y.id!==g.id),1e3)),decorationColor:u.palette.variants[v%u.palette.variants.length],weightsError:h},g.id))]}),s.jsx(Ro,{onClick:f,variant:"outlined",permission:gX,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",startIcon:s.jsx(Oo,{}),children:"Add variant"}),s.jsx(OI,{variants:l,weightsError:h})]})},kot=e=>fetch(e).then(Jt("ChangeRequest")).then(t=>t.json()),_ot=(e,t)=>{const{data:n,error:r,mutate:o}=cy([],bt(`api/admin/projects/${e}/change-requests/scheduled?strategyId=${t}`),kot);return{changeRequests:n,loading:!r&&!n,refetch:o,error:r}},Rot=(e,t,n,r)=>(e==null?void 0:e.filter(o=>{var i;return(i=o.features.find(a=>a.name===t))==null?void 0:i.changes.some(a=>a.action==="updateStrategy"&&a.payload.id===n)}).map(o=>({changeRequest:uI(r,o.id),state:o.state})))??[],Pot=(e,t)=>(e==null?void 0:e.map(n=>({changeRequest:uI(t,n.id),state:"Scheduled"})))??[],Aot=({value:e,values:t,inverted:n,operator:r,contextName:o,caseInsensitive:i})=>{const a=l=>({contextName:o,operator:r,...l,caseInsensitive:i,inverted:n});return yI(r)?a({value:e||""}):a({values:t||[]})},XC=(e,t)=>e!=="constraints"||!Array.isArray(t)?t:t.map(Aot),Iot=()=>{const[e,t]=m.useState(""),{trackEvent:n}=Kt();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"}})}}},$ot=e=>{if(e)return e==null?void 0:e.constraints.map(t=>({...t,[qs]:wi()}))},kLt=()=>{const e=Or("projectId"),t=Or("featureId"),n=YL("environmentId"),r=YL("strategyId"),[o,i]=m.useState(0),[a,l]=m.useState({}),[c,u]=m.useState([]),{updateStrategyOnFeature:d,loading:p}=nXe(),{strategyDefinition:f}=LC(a.name),{setToastData:h,setToastApiError:g}=Nt(),v=cI(),{uiConfig:b}=rt(),{unleashUrl:y}=b,w=Ot(),{addChange:S}=Ou(),{isChangeRequestConfigured:j}=mp(e),{refetch:E,data:C}=uy(e),{setPreviousTitle:T}=Iot(),{feature:k,refetchFeature:_}=Al(e,t),A=m.useRef(k),{data:O,staleDataNotification:M,forceRefreshCache:H}=uZ({unleashGetter:Al,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},k,{afterSubmitAction:_},dZ);m.useEffect(()=>{A.current.name===""&&k.name&&(H(k),A.current=k)},[k]);const{trackEvent:P}=Kt(),{changeRequests:$}=_ot(e,r),D=Rot(C,t,r,b),z=Pot($,b),B=()=>[...D,...z].forEach(ne=>P("change_request",{props:{...ne,action:"edit-strategy",eventType:"conflict-created"}})),{segments:L,refetchSegments:I}=ma(r);m.useEffect(()=>{const ne=O==null?void 0:O.environments.flatMap(re=>re.strategies).find(re=>re.id===r),ce=$ot(ne),xe={...ne,constraints:ce};l(re=>({...re,...xe})),T((ne==null?void 0:ne.title)||"")},[r,O]),m.useEffect(()=>{L&&u(L)},[JSON.stringify(L)]);const q=Oot(a,c),ee=async ne=>{await d(e,t,n,r,ne),await I(),h({text:"Strategy updated",type:"success"})},W=async ne=>{await S(e,n,{action:"updateStrategy",feature:t,payload:{...ne,id:r}}),h({text:"Change added to draft",type:"success"}),E()},oe=async()=>{try{j(n)?await W(q):await ee(q),B(),_(),w(MI(e,t))}catch(ne){g(Tt(ne))}};return!a.id||!f||!O?null:s.jsxs(Fr,{modal:!0,disablePadding:!0,description:fee,documentationLink:hee,documentationLinkLabel:gee,formatApiCode:()=>Mot(e,t,n,r,q,f,y),children:[s.jsx(aee,{projectId:e,feature:O,strategy:a,setStrategy:l,segments:c,setSegments:u,environmentId:n,onSubmit:oe,loading:p,permission:lC,errors:v,isChangeRequest:j(n),tab:o,setTab:i,StrategyVariants:s.jsx(pee,{strategy:a,setStrategy:l,environment:n,projectId:e})}),M]})},Oot=(e,t)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:t.map(n=>n.id),disabled:e.disabled??!1}),MI=(e,t)=>`/projects/${e}/features/${t}`,DI=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},Mot=(e,t,n,r,o,i,a)=>{if(!a)return"";const l={...o,parameters:gXe(o.parameters??{},i)},c=`${a}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,XC,2);return`curl --location --request PUT '${c}' \\
355
355
  --header 'Authorization: INSERT_API_KEY' \\
356
356
  --header 'Content-Type: application/json' \\
357
357
  --data-raw '${u}'`},fee=`
@@ -414,18 +414,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
414
414
  --data-raw '${JSON.stringify(j(),XC,2)}'`,H=Gee(o==null?void 0:o.project)(),{addChange:P}=Ou(),$=async D=>{if(o){D.preventDefault(),C();try{H?await P(o.project||"",H,{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 ${H?"change added to draft":"updated"}`,type:"success"})}catch(z){l(Tt(z))}}};return s.jsx(Fr,{loading:d,modal:e,title:"Edit segment",description:Uee,documentationLink:see,documentationLinkLabel:"Segments documentation",formatApiCode:O,children:s.jsx(Vee,{handleSubmit:$,name:f,setName:h,description:g,setDescription:v,project:b,setProject:y,constraints:w,setConstraints:S,errors:E,clearErrors:C,mode:"edit",children:s.jsx(lh,{permission:[CA,Qd],projectId:t,disabled:!T||A,"data-testid":gje,children:H?"Add to draft":"Save"})})})},xct=()=>{const e=Ot(),t=!ci("EEA"),n=t?s.jsx(Xa,{darkmode:s.jsx(ny,{}),lightmode:s.jsx(ty,{})}):void 0,r=t?{titleComponent:s.jsx(ym,{feature:"environments",tooltip:!0}),sx:{maxWidth:"320px"},variant:"custom"}:void 0;return s.jsx(z9,{onClick:()=>e("/environments/create"),maxWidth:"700px",Icon:Oo,permission:ts,disabled:t,endIcon:n,tooltipProps:r,children:"New environment"})};let Eh;const qee=(e,t,n)=>{const r=m.useRef(null);return m.useEffect(()=>{if(r.current)return r.current.dataset.index=String(e),bct(r.current,t,(n==null?void 0:n.current)??void 0)},[e,t]),r},bct=(e,t,n)=>{const r=n??e,o=(f,h)=>{if(Eh){const g=Number(Eh.dataset.index),v=Number(e.dataset.index);t({dragIndex:g,dropIndex:v,save:f,event:h,draggedElement:Eh})}},i=f=>{f.target===r&&(e.draggable=!0)},a=()=>{e.draggable=!1},l=()=>{e.draggable=!0,Eh=e},c=f=>{o(!1,f)},u=f=>{f.preventDefault()},d=f=>{o(!0,f),Eh=null},p=()=>{Eh=null};return r.addEventListener("mouseenter",i),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",i),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)}},wct=x(Mi)(()=>({"&:hover":{".drag-handle .drag-icon":{display:"inherit",cursor:"grab"}}})),Sct=({row:e,onMoveItem:t})=>{const{hasAccess:n}=m.useContext($o),r=m.useRef(null),{searchQuery:o}=ga(),i=!o&&n(pT),a=qee(e.index,t,r),l=(c,u)=>{const{key:d,...p}=c.getCellProps();return i&&c.column.isDragHandle?s.jsx(es,{...p,ref:u,className:"drag-handle",children:c.render("Cell")},d):s.jsx(es,{...p,children:c.render("Cell")},d)};return s.jsx(wct,{hover:!0,ref:i?a:void 0,children:e.cells.map(c=>l(c,r))})},Cct=x(Z)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallerBody})),jct=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),QF=x(sn)(({theme:e})=>({marginLeft:e.spacing(1)})),Ect=({environment:e})=>{const{searchQuery:t}=ga();return s.jsx(En,{sx:n=>({[n.breakpoints.up("sm")]:{minWidth:"350px"}}),children:s.jsxs("div",{children:[s.jsx(Kr,{search:t,children:e.name}),s.jsx(X,{condition:e.protected,show:s.jsx(QF,{color:"success",children:"Predefined"})}),s.jsx(X,{condition:!e.enabled,show:s.jsx(hr,{maxWidth:"270px",title:s.jsxs(s.Fragment,{children:[s.jsx(Cct,{children:"Deprecated environment"}),s.jsx(jct,{children:"This environment is not auto-enabled for new projects. The project owner will need to manually enable it in the project."})]}),describeChild:!0,arrow:!0,children:s.jsx(QF,{color:"neutral",children:"Deprecated"})})})]})})};var QI={},Tct=Te;Object.defineProperty(QI,"__esModule",{value:!0});var Yee=QI.default=void 0,kct=Tct(ke()),_ct=s,Rct=(0,kct.default)((0,_ct.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");Yee=QI.default=Rct;var ZI={},Pct=Te;Object.defineProperty(ZI,"__esModule",{value:!0});var Kee=ZI.default=void 0,Act=Pct(ke()),Ict=s,$ct=(0,Act.default)((0,Ict.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");Kee=ZI.default=$ct;const Oct=x(om)(({theme:e})=>({padding:e.spacing(1)})),Ab=x(Cr)(({theme:e})=>({borderRadius:e.shape.borderRadius})),Mct=x(Ab)(({theme:e})=>({color:e.palette.error.main})),Dct=x(Zo)(({theme:e})=>({color:e.palette.error.main})),Lct=({environment:e,onEdit:t,onDeprecateToggle:n,onClone:r,onDelete:o})=>{const[i,a]=m.useState(null),l=!!i,c=f=>{a(f.currentTarget)},u=()=>{a(null)},d=`environment-${e.name}-actions`,p=`${d}-menu`;return s.jsxs(s.Fragment,{children:[s.jsx(kt,{title:"Environment actions",arrow:!0,describeChild:!0,children:s.jsx($t,{id:d,"aria-controls":l?p:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:s.jsx(pm,{})})}),s.jsx(_l,{id:p,anchorEl:i,open:l,onClose:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:s.jsxs(Oct,{"aria-labelledby":d,children:[s.jsx(Cd,{permission:pT,children:({hasAccess:f})=>s.jsxs(Ab,{onClick:()=>{t(),u()},disabled:!f||e.protected,children:[s.jsx(Zo,{children:s.jsx(ns,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Edit"})})]})}),s.jsx(Cd,{permission:ts,children:({hasAccess:f})=>s.jsxs(Ab,{onClick:()=>{r(),u()},disabled:!f,children:[s.jsx(Zo,{children:s.jsx(Yee,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Clone"})})]})}),s.jsx(Cd,{permission:pT,children:({hasAccess:f})=>s.jsxs(Ab,{onClick:()=>{n(),u()},disabled:!f,children:[s.jsx(Zo,{children:s.jsx(X,{condition:e.enabled,show:s.jsx(F9,{}),elseShow:s.jsx(Kee,{})})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:e.enabled?"Deprecate":"Undeprecate"})})]})}),s.jsx(Cd,{permission:U9e,children:({hasAccess:f})=>s.jsxs(Mct,{onClick:()=>{o(),u()},disabled:!f||e.protected,children:[s.jsx(Dct,{children:s.jsx(Po,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Delete"})})]})})]})})]})},p1=(e,t)=>{var n;return!!((n=t==null?void 0:t.toLowerCase())!=null&&n.includes(e.toLowerCase()))},Fct=x(kn)(({theme:e})=>({cursor:"pointer",fontSize:e.fontSizes.bodySize})),Xee=({isAllSelected:e,onClick:t})=>s.jsx(J,{sx:{ml:3.5,my:.5},children:s.jsx(Fct,{onClick:t,component:"button",underline:"hover",children:e?"Deselect all":"Select all"})}),Nct=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",color:e.palette.text.secondary,"& > span:first-of-type":{color:e.palette.text.primary}})),Bct=x("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),zct=x("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginRight:e.spacing(1)}})),Hct=(e,t,n)=>s.jsxs("li",{...e,children:[s.jsx(pa,{icon:s.jsx(Cm,{fontSize:"small"}),checkedIcon:s.jsx(jm,{fontSize:"small"}),style:{marginRight:8},checked:n}),s.jsxs(Nct,{children:[s.jsx("span",{children:t.name}),s.jsx("span",{children:t.description})]})]}),Wct=e=>s.jsx(Bct,{children:e.length>1?`${e.length} projects selected`:e[0].name}),Vct=({projects:e,setProjects:t})=>{const{projects:n}=Xr(),r=n.sort((c,u)=>c.name.localeCompare(u.name)).map(({id:c,name:u,description:d})=>({id:c,name:u,description:d})),o=r.filter(({id:c})=>e.includes(c)),i=e.length>0&&e.length===r.length,a=()=>{const c=i?[]:r.map(({id:u})=>u);t(c)},l=({key:c,children:u})=>s.jsxs(m.Fragment,{children:[s.jsx(X,{condition:r.length>2,show:s.jsx(Xee,{isAllSelected:i,onClick:a})}),u]},c);return s.jsx(zct,{children:s.jsx(pp,{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})=>Hct(c,u,d),filterOptions:(c,{inputValue:u})=>c.filter(({name:d,description:p})=>p1(u,d)||p1(u,p)),isOptionEqualToValue:(c,u)=>c.id===u.id,getOptionLabel:c=>c.name||c.description||"",renderInput:c=>s.jsx(xn,{...c,label:"Projects"}),renderTags:c=>Wct(c),groupBy:()=>"Select/Deselect all",renderGroup:l})})},lv="*",Uct=({...e})=>s.jsx(Lr,{elevation:8,...e}),Gct=x(pa)(({theme:e})=>({marginRight:e.spacing(.4)})),qct=({options:e,defaultValue:t=[lv],onChange:n,disabled:r,error:o,onFocus:i})=>{const[a,l]=m.useState(typeof t=="string"?[t]:t),[c,u]=m.useState(typeof t=="string"||t.includes(lv)),d=a.length>0&&a.length===e.length&&a[0]!==lv,p=(b,y)=>{y?(u(!0),n([lv])):(u(!1),n(a.includes(lv)?[]:a))},f=()=>{const b=d?[]:e.map(({value:y})=>y);l(b),n(b)},h=(b,y,{selected:w})=>{const{key:S,...j}=b;return s.jsxs("li",{...j,children:[s.jsx(Gct,{icon:s.jsx(Cm,{fontSize:"small"}),checkedIcon:s.jsx(jm,{fontSize:"small"}),checked:w}),y.label]},S)},g=({key:b,children:y})=>s.jsxs(m.Fragment,{children:[s.jsx(X,{condition:e.length>2,show:s.jsx(Xee,{isAllSelected:d,onClick:f})}),y]},b),v=b=>s.jsx(xn,{...b,error:!!o,helperText:o,variant:"outlined",label:"Projects",placeholder:"Select one or more projects",onFocus:i,"data-testid":"select-input"});return s.jsxs(J,{sx:{mt:-1,mb:3},children:[s.jsx(J,{sx:{mt:1,mb:.25,ml:1.5},children:s.jsx(qr,{disabled:r,"data-testid":"select-all-projects",control:s.jsx(pa,{checked:r||c,onChange:p}),label:"ALL current and future projects"})}),s.jsx(pp,{disabled:r||c,multiple:!0,limitTags:2,options:e,disableCloseOnSelect:!0,getOptionLabel:({label:b})=>b,groupBy:()=>"Select/Deselect all",renderGroup:g,fullWidth:!0,PaperComponent:Uct,renderOption:h,renderTags:(b,y)=>b.map((w,S)=>{const{key:j,...E}=y({index:S});return s.jsx(da,{size:"small",...E,label:w.label},j)}),renderInput:v,value:c||r?e:e.filter(b=>a.includes(b.value)),onChange:(b,y)=>{const w=y.map(({value:S})=>S);l(w),n(w)}})]})},Yct=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},Kct=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Th=x("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(4)}})),L5=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Xct=x(vr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),Jct=x("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4)})),Qct=x("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),Zct=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),eut=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),tut=({environment:e,open:t,setOpen:n,newToken:r})=>{const{environments:o,refetchEnvironments:i}=$u(),{cloneEnvironment:a,loading:l}=bm(),{createToken:c}=Yct(),{projects:u}=Xr(),{setToastData:d,setToastApiError:p}=Nt(),{uiConfig:f}=rt(),[h,g]=m.useState(`${e.name}_clone`),[v,b]=m.useState("development"),[y,w]=m.useState([]),[S,j]=m.useState(["*"]),[E,C]=m.useState(!0),[T,k]=m.useState("later"),[_,A]=m.useState({}),O=W=>{A(oe=>({...oe,[W]:void 0}))},M=(W,oe)=>{A(ne=>({...ne,[W]:oe}))};m.useEffect(()=>{g(H(e.name)),b("development"),w([]),j(["*"]),C(!0),k("later"),A({})},[e]);const H=W=>{let oe=`${W}_clone`,ne=2;for(;!L(oe);)oe=`${e.name}_clone_${ne}`,ne++;return oe},P=()=>({name:h,type:v,projects:y,clonePermissions:E}),$=()=>({tokenName:`${h}_token`,type:"CLIENT",environment:h,projects:S}),D=async W=>{W.preventDefault();try{if(await a(e.name,P()),T==="now"){const ne=await(await c($())).json();r(ne)}d({text:"Environment cloned",type:"success"}),i(),n(!1)}catch(oe){p(Tt(oe))}},z=()=>`curl --location --request POST '${f.unleashUrl}/api/admin/environments/${e.name}/clone' \\
415
415
  --header 'Authorization: INSERT_API_KEY' \\
416
416
  --header 'Content-Type: application/json' \\
417
- --data-raw '${JSON.stringify(P(),void 0,2)}'`,B=W=>W.length,L=W=>!(o!=null&&o.some(oe=>oe.name===W)),I=B(h)&&L(h)&&S.length,q=W=>{O("name"),L(W)||M("name","An environment with that name already exists."),g(W)},ee=u.map(W=>({value:W.id,label:W.name}));return s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:s.jsx(Fr,{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/reference/environments#clone-an-environment",documentationLinkLabel:"Cloning environments documentation",formatApiCode:z,children:s.jsxs(Kct,{onSubmit:D,children:[s.jsxs("div",{children:[s.jsx(Th,{children:"What is your new environment name? (Can't be changed later)"}),s.jsx(Xct,{autoFocus:!0,label:"Environment name",error:!!_.name,errorText:_.name,value:h,onChange:W=>q(W.target.value),required:!0}),s.jsx(Th,{children:"What type of environment do you want to create?"}),s.jsx(nZ,{onChange:W=>b(W.currentTarget.value),value:v}),s.jsxs(Th,{children:["Select which projects you want to clone the environment configuration in?",s.jsx(bo,{tooltip:"The cloned environment will keep the feature flag state for the selected projects, where it will be enabled by default."})]}),s.jsx(Vct,{projects:y,setProjects:w}),s.jsx(Th,{children:"Keep the users permission for this environment?"}),s.jsx(L5,{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."}),s.jsx(qr,{label:E?"Yes":"No",control:s.jsx(fa,{onChange:W=>C(W.target.checked),checked:E})}),s.jsxs(Jct,{children:[s.jsx(Th,{children:"API Token"}),s.jsxs(L5,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s.jsx(Is,{children:s.jsxs(DS,{value:T,onChange:W=>k(W.target.value),name:"api-token-generation",children:[s.jsx(qr,{value:"later",control:s.jsx(yl,{}),label:"I want to generate an API token later"}),s.jsx(qr,{value:"now",control:s.jsx(yl,{}),label:"Generate an API token now"})]})}),s.jsxs(Qct,{children:[s.jsx(L5,{children:"A new backend API token will be generated for the cloned environment, so you can get started right away."}),s.jsx(X,{condition:T==="now",show:s.jsxs(s.Fragment,{children:[s.jsx(Th,{children:"Which projects do you want this token to give access to?"}),s.jsx(qct,{options:ee,defaultValue:S,onChange:j,error:_.projects,onFocus:()=>O("projects")})]})})]})]})]}),s.jsxs(Zct,{children:[s.jsx(Ue,{type:"submit",variant:"contained",color:"primary",disabled:!I,children:"Clone environment"}),s.jsx(eut,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},e$=({token:e})=>{const{setToastData:t}=Nt(),n=()=>{CC(e)?t({type:"success",text:"Token copied to clipboard"}):t({type:"error",text:"Could not copy token"})};return s.jsxs(J,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,s.jsx(kt,{title:"Copy token",arrow:!0,children:s.jsx($t,{onClick:n,size:"large",children:s.jsx(oh,{})})})]})},nut=({open:e,setOpen:t,token:n})=>s.jsxs(Gn,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[s.jsx(Z,{variant:"body1",children:"Your new token has been created successfully."}),s.jsxs(Z,{variant:"body1",children:['You can also find it as "',s.jsx("strong",{children:n==null?void 0:n.tokenName}),'" in the'," ",s.jsx(xt,{to:"/admin/api",children:"API access page"}),"."]}),s.jsx(e$,{token:(n==null?void 0:n.secret)||""})]});var t$={},rut=Te;Object.defineProperty(t$,"__esModule",{value:!0});var ej=t$.default=void 0,out=rut(ke()),iut=s,sut=(0,out.default)((0,iut.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");ej=t$.default=sut;const aut=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),lut=x($t)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),cut=x(lm,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),Jee=({environment:e})=>s.jsxs(aut,{children:[s.jsx(lut,{size:"large",disableRipple:!0,className:"drag-icon",children:s.jsx(ej,{titleAccess:"Drag to reorder"})}),s.jsx(cut,{deprecated:!e.enabled})]}),uut=x(ta)(({theme:e})=>({marginTop:e.spacing(3)})),dut=x("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),Qee=({environment:e,warnEnabledToggles:t})=>{const n=m.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>s.jsx(Jee,{environment:c})},{Header:"Name",accessor:"name",Cell:En},{Header:"Type",accessor:"type",Cell:En},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>s.jsxs(En,{children:[u,s.jsx(X,{condition:!!t,show:s.jsx(dut,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l}=Zt.useTable({columns:n,data:[e],disableSortBy:!0});return s.jsxs(uut,{...r(),rowHeight:"compact",children:[s.jsx(ea,{headerGroups:i}),s.jsx(Ts,{...o(),children:a.map(c=>{l(c);const{key:u,...d}=c.getRowProps();return s.jsx(Mi,{hover:!0,...d,children:c.cells.map(p=>{const{key:f,...h}=p.getCellProps();return s.jsx(es,{...h,children:p.render("Cell")},f)})},u)})})]})},put=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return s.jsxs(Gn,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s.jsx(X,{condition:o,show:s.jsx(Lt,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:s.jsx(Lt,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),s.jsx(Qee,{environment:e})]})},fut=x("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),hut=x(vr)(()=>({width:"100%"})),gut=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=m.useState("");return m.useEffect(()=>{i("")},[t]),s.jsxs(Gn,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s.jsxs(Lt,{severity:"error",children:[s.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."]}),s.jsx(Qee,{environment:e,warnEnabledToggles:!0}),s.jsxs(fut,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",s.jsx("strong",{children:e.name})]}),s.jsx(hut,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},mut=({environment:e})=>{const t=Ot(),{uiConfig:n}=rt(),r=n.resourceLimits.environments,{setToastApiError:o,setToastData:i}=Nt(),{environments:a,refetchEnvironments:l}=$u(),{refetch:c}=tI(),{deleteEnvironment:u,toggleEnvironmentOn:d,toggleEnvironmentOff:p}=bm(),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[b,y]=m.useState(!1),[w,S]=m.useState(!1),[j,E]=m.useState(),C=async()=>{try{await u(e.name),c(),i({type:"success",text:"Environment deleted"})}catch(k){o(Tt(k))}finally{h(!1),await l()}},T=async()=>{try{e.enabled?(await p(e.name),i({type:"success",text:"Environment deprecated"})):(await d(e.name),i({type:"success",text:"Environment undeprecated"}))}catch(k){o(Tt(k))}finally{v(!1),await l()}};return s.jsxs(Tu,{children:[s.jsx(Lct,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>v(!0),onClone:()=>{a.length<r?y(!0):i({type:"error",text:`Environment limit (${r}) reached`})},onDelete:()=>h(!0)}),s.jsx(gut,{environment:e,open:f,setOpen:h,onConfirm:C}),s.jsx(put,{environment:e,open:g,setOpen:v,onConfirm:T}),s.jsx(tut,{environment:e,open:b,setOpen:y,newToken:k=>{E(k),S(!0)}}),s.jsx(nut,{open:w,setOpen:S,token:j})]})},vut=x(Lt)(({theme:e})=>({marginBottom:e.spacing(4)})),yut=()=>{const{changeSortOrder:e}=bm(),{setToastApiError:t}=Nt(),{environments:n,mutateEnvironments:r}=$u(),o=ci("EEA"),{isEnterprise:i}=rt(),a=m.useCallback(async({dragIndex:S,dropIndex:j,save:E})=>{const T=[...n||[]],k=T.splice(S,1)[0];if(T.splice(j,0,k),await r(T),E)try{await e(RKe(T))}catch(_){t(Tt(_))}},[e,n,r,t]),l=m.useMemo(()=>{const S=[...xut,...o?[{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:j}})=>s.jsx(mut,{environment:j}),disableGlobalFilter:!0}]:[]];return i()&&S.splice(2,0,{Header:"Change request",accessor:j=>Number.isInteger(j.requiredApprovals)?"yes":"no",Cell:En}),S},[o]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f,state:{globalFilter:h},setGlobalFilter:g}=Zt.useTable({columns:l,data:n,disableSortBy:!0},Zt.useGlobalFilter),v=s.jsx(xo,{initialValue:h,onChange:g}),b=s.jsxs(s.Fragment,{children:[v,s.jsx(Pn.Divider,{}),s.jsx(xct,{})]}),y=p.length,w=s.jsx(Pn,{title:`Environments (${y})`,actions:b});return o?s.jsxs(cr,{header:w,children:[s.jsx(vut,{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."}),s.jsx(is,{value:h,children:s.jsxs(ta,{...c(),rowHeight:"compact",children:[s.jsx(ea,{headerGroups:d}),s.jsx(Ts,{...u(),children:p.map(S=>(f(S),s.jsx(Sct,{row:S,onMoveItem:a},S.original.name)))})]})}),s.jsx(X,{condition:p.length===0,show:s.jsx(X,{condition:(h==null?void 0:h.length)>0,show:s.jsxs($r,{children:["No environments found matching “",h,"”"]}),elseShow:s.jsx($r,{children:"No environments available. Get started by adding one."})})})]}):s.jsx(cr,{header:w,children:s.jsx(ym,{feature:"environments"})})},xut=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>s.jsx(Jee,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>s.jsx(Ect,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:_s},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:En},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:En}],but=()=>{const e=$s("projectId"),t=Ot();return s.jsx(Ro,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[cC,Qd],projectId:e,"data-testid":lje,children:"New segment"})},wut=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),Sut=x(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),Cut=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),jut=x(xt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Eut=()=>{const e=$s("projectId"),{hasAccess:t}=m.useContext($o);return s.jsxs(wut,{children:[s.jsx(Sut,{children:"No segments yet!"}),s.jsx(Cut,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),s.jsx(X,{condition:t([cC,Qd],e),show:s.jsx(jut,{to:"/segments/create",children:"Create your first segment"})})]})};var n$={},Tut=Te;Object.defineProperty(n$,"__esModule",{value:!0});var Zee=n$.default=void 0,kut=Tut(ke()),_ut=s,Rut=(0,kut.default)((0,_ut.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");Zee=n$.default=Rut;const Put=x(vr)(({theme:e})=>({marginTop:e.spacing(2)})),Aut=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const[i,a]=m.useState(""),l=d=>a(d.currentTarget.value),c=()=>{n(),a("")},u="delete-segment-confirmation-form";return s.jsxs(Gn,{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)!==i,onClose:c,formId:u,children:[s.jsx(Lt,{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."}),s.jsxs("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",s.jsx("strong",{children:e==null?void 0:e.name})]}),s.jsx("form",{id:u,children:s.jsx(Put,{autoFocus:!0,onChange:l,value:i,label:"Segment name","data-testid":vje})})]})},Iut=x("ul")({marginBottom:0}),ZF=x(xt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),$ut=(e,t)=>`/projects/${e}/change-requests/${t}`,Out=({segment:e,open:t,onClose:n,strategies:r,changeRequestStrategies:o})=>{const i=Hee(r??[],o??[]);return s.jsxs(Gn,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[s.jsxs("p",{children:["The following feature flags are using the"," ",s.jsx("strong",{children:e.name})," segment for their strategies:"]}),s.jsx(Iut,{children:i.map((a,l)=>Mut(a,l))})]})},eN=e=>e.strategyName?`(${Il(e.strategyName)})`:"",Mut=(e,t)=>{if((r=>"changeRequest"in r)(e)){const{id:r,title:o}=e.changeRequest,i=o?`#${r} (${o})`:`#${r}`;return s.jsx("li",{children:s.jsxs("p",{children:[e.featureName," ",`${eN(e)} — in change request `,s.jsx(ZF,{to:$ut(e.projectId,r),target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:i})]})},`#${e.changeRequest.id}@${t}`)}else return s.jsx("li",{children:s.jsxs(ZF,{to:DI(e.projectId,e.featureName,e.environment,e.id),target:"_blank",rel:"noopener noreferrer",children:[e.featureName," ",eN(e)]})},e.id)},Dut=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const{strategies:i,changeRequestStrategies:a,loading:l}=zee(e.id),c=(i==null?void 0:i.length)===0&&(a==null?void 0:a.length)===0;return l?null:s.jsx(X,{condition:c,show:s.jsx(Aut,{segment:e,open:t,onClose:n,onRemove:r,title:o}),elseShow:s.jsx(Out,{segment:e,open:t,onClose:n,strategies:i,changeRequestStrategies:a})})},Lut=({segment:e})=>{const t=$s("projectId"),{refetchSegments:n}=ma(),{deleteSegment:r}=GI(),{setToastData:o,setToastApiError:i}=Nt(),[a,l]=m.useState(!1),u=Gee(e==null?void 0:e.project)(),{addChange:d}=Ou(),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){i(Tt(f))}finally{l(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(Wo,{onClick:()=>l(!0),permission:[Y9e,Qd],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${mje}_${e.name}`,children:s.jsx(Po,{"data-loading":!0})}),s.jsx(X,{condition:a,show:()=>s.jsx(Dut,{segment:e,open:a,onClose:()=>l(!1),onRemove:p,title:u?"Add to draft":"Save"})})]})},Fut=({segment:e})=>{const t=$s("projectId"),n=Ot();return s.jsx(Wo,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[CA,Qd],projectId:t,tooltipProps:{title:"Edit segment"},children:s.jsx(ns,{"data-loading":!0})})},Nut=({segment:e})=>s.jsxs(Tu,{children:[s.jsx(Fut,{segment:e}),s.jsx(Lut,{segment:e})]}),uh=(e,t,n)=>{m.useEffect(()=>{const r=e.filter(({condition:i})=>i).flatMap(({columns:i})=>i),o=e.flatMap(({columns:i})=>i).filter(i=>!r.includes(i));t(i=>[...new Set([...i,...r].filter(a=>!o.includes(a)))])},[...e.map(({condition:r})=>r),t,n])},But=()=>{const e=$s("projectId"),{segments:t,loading:n}=ma(),r=Xn(pr.breakpoints.down("md")),[o]=m.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=m.useMemo(()=>t?e?t.filter(({project:v})=>v===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),a=m.useMemo(()=>zut(e),[e]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:f},setGlobalFilter:h,setHiddenColumns:g}=Zt.useTable({initialState:o,columns:a,data:i,sortTypes:yi,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:_s},getRowId:v=>v.id},Zt.useGlobalFilter,Zt.useSortBy);return uh([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],g,a),s.jsx(cr,{header:s.jsx(Pn,{title:`Segments (${d.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:f,onChange:h}),s.jsx(Pn.Divider,{}),s.jsx(but,{})]})}),isLoading:n,children:s.jsx(X,{condition:!n&&i.length===0,show:s.jsx($r,{children:s.jsx(Eut,{})}),elseShow:()=>s.jsxs(s.Fragment,{children:[s.jsx(is,{value:f,children:s.jsxs(ta,{...l(),rowHeight:"standard",children:[s.jsx(ea,{headerGroups:u}),s.jsx(Ts,{...c(),children:d.map(v=>{p(v);const{key:b,...y}=v.getRowProps();return s.jsx(Mi,{hover:!0,...y,children:v.cells.map(w=>{const{key:S,...j}=w.getCellProps();return s.jsx(es,{...j,children:w.render("Cell")},S)})},b)})})]})}),s.jsx(X,{condition:d.length===0&&(f==null?void 0:f.length)>0,show:s.jsxs($r,{children:["No segments found matching “",f,"”"]})})]})})})},zut=e=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s.jsx(JC,{icon:s.jsx(Zee,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:t,description:n,id:r}}})=>s.jsx(Rl,{title:t,to:e?`/projects/${e}/settings/segments/edit/${r}`:`/segments/edit/${r}`,subtitle:n})},{Header:"Used in",width:"60%",Cell:({row:{original:t}})=>s.jsx(jee,{original:t})},{Header:"Project",accessor:"project",Cell:({value:t})=>s.jsx(X,{condition:!!t,show:s.jsx(Rl,{title:t,to:`/projects/${t}`}),elseShow:s.jsx(En,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Jd,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}})=>s.jsx(Nut,{segment:t})},{accessor:"description"}],Hut=x("div")(({theme:e})=>({padding:e.spacing(1.5),display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),Wut=({value:e,getValue:t})=>{var l;const n=e||(t==null?void 0:t())||void 0,{featureTypes:r}=dm(),o=wC(n),a=`This is a "${((l=r.find(c=>c.id===n))==null?void 0:l.name)||n}" toggle`;return s.jsx(Hut,{children:s.jsx(kt,{arrow:!0,title:a,describeChild:!0,children:s.jsx(o,{"data-loading":!0})})})},Vut=({onRevive:e,onDelete:t,project:n})=>s.jsxs(Tu,{children:[s.jsx(Wo,{onClick:e,projectId:n,permission:cm,tooltipProps:{title:"Revive feature flag"},"data-testid":"revive-feature-flag-button",children:s.jsx(eI,{})}),s.jsx(Wo,{permission:cX,projectId:n,tooltipProps:{title:"Delete feature flag"},onClick:t,children:s.jsx(Po,{})})]}),Uut=({value:e})=>{const{locationSettings:t}=wo(),n=qt();return e?s.jsx(En,{children:s.jsx(kt,{title:`Archived on: ${Kd(e,t.locale)}`,arrow:!0,children:s.jsx(Z,{noWrap:!0,variant:"body2","data-loading":!0,children:s.jsx(Pl,{date:new Date(e),refresh:!1})})})}):s.jsx(En,{children:s.jsx(Z,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},tN=x("p")(({theme:e})=>({marginTop:e.spacing(3)})),Gut=x(vr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),qut="I want to delete",Yut=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=m.useState(""),{setToastData:l,setToastApiError:c}=Nt(),{deleteFeatures:u}=xm(),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(g){c(Tt(g))}finally{f()}},f=()=>{r(!1),a("")},h="delete-feature-toggle-confirmation-form";return s.jsxs(Gn,{title:`Delete feature ${d}?`,open:n,primaryButtonText:`Delete feature ${d}`,secondaryButtonText:"Cancel",onClick:p,onClose:f,disabledPrimaryButton:qut!==i,formId:h,children:[s.jsxs(Lt,{severity:"warning",children:[s.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."]}),s.jsxs(tN,{children:["You are about to delete the following feature"," ",d,":"," ",s.jsx("strong",{children:e.join(", ")}),"."]}),s.jsxs(tN,{sx:g=>({marginTop:g.spacing(2)}),children:["In order to delete the feature ",d,", please enter the following confirmation text in the text field below:"," ",s.jsx("strong",{children:"I want to delete"})]}),s.jsx("form",{id:h,children:s.jsx(Gut,{autoFocus:!0,onChange:g=>{a(g.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},nN=x("p")(({theme:e})=>({marginTop:e.spacing(2)})),Kut=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:i,setToastApiError:a}=Nt(),{reviveFeatures:l}=xm(),{project:c,loading:u}=um(t),d=async()=>{try{if(e.length===0)return;await l(t,e),await o(),i({type:"success",text:"Feature flags revived"})}catch(g){a(Tt(g))}finally{p()}},p=()=>{r(!1)},f=`Revive feature flag${e.length>1?"s":""}?`,h=`Revive feature flag${e.length>1?"s":""}`;return s.jsxs(Gn,{title:f,open:n,primaryButtonText:h,secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:u||!!c.archivedAt,children:[s.jsx(X,{condition:!!c.archivedAt,show:s.jsxs(Lt,{severity:"warning",children:["Cannot revive feature flag in archived project (Project ID: ",t,")"]}),elseShow:s.jsx(Lt,{severity:"info",children:"Revived feature flags will be automatically disabled in all environments"})}),s.jsx(X,{condition:e.length>1,show:s.jsxs(s.Fragment,{children:[s.jsx(nN,{children:"You are about to revive feature flags:"}),s.jsx("ul",{children:e.map(g=>s.jsx("li",{children:g},`revive-${g}`))})]}),elseShow:s.jsxs(nN,{children:["You are about to revive feature flag:"," ",e[0]]})})]})},Xut=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i})=>{const a=Xn(pr.breakpoints.down("md")),l=Xn(pr.breakpoints.down("lg")),[c,u]=m.useState(!1),[d,p]=m.useState(),[f,h]=m.useState(!1),[g,v]=m.useState(),[b,y]=Xf(),[w,S]=m.useState(b.get("search")||""),j=m.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({row:{original:D}})=>s.jsx(_X,{feature:D}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:Wut,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:D,row:{original:z}})=>s.jsx(_s,{value:D,subtitle:z.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Jd},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Uut},{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:D})=>s.jsx(Rl,{title:D,to:`/projects/${D}`})},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:D}})=>s.jsx(Vut,{project:D.project,onRevive:()=>{v(D),h(!0)},onDelete:()=>{p(D),u(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[]),{data:E,getSearchText:C,getSearchContext:T}=eh(j,w,e),k=m.useMemo(()=>t?QX:E,[E,t]),[_]=m.useState(()=>({sortBy:[{id:b.get("sort")||r.id,desc:b.has("order")?b.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),A=m.useCallback(D=>D.name,[]),{headerGroups:O,rows:M,state:{sortBy:H},prepareRow:P,setHiddenColumns:$}=Zt.useTable({columns:j,data:k,initialState:_,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:A},Zt.useFlexLayout,Zt.useSortBy,Zt.useRowSelect);return uh([{condition:a,columns:["type","createdAt"]},{condition:l,columns:["lastSeenAt","stale"]}],$,j),m.useEffect(()=>{if(t)return;const D={};D.sort=H[0].id,H[0].desc&&(D.order="desc"),w&&(D.search=w),y(D,{replace:!0}),o({id:H[0].id,desc:H[0].desc||!1})},[t,H,w]),s.jsx(s.Fragment,{children:s.jsxs(cr,{isLoading:t,header:s.jsx(Pn,{titleElement:`${i} (${M.length})`,actions:s.jsx(xo,{initialValue:w,onChange:S,hasFilters:!0,getSearchContext:T})}),children:[M.length>=50&&s.jsx(Lt,{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."}),s.jsx(is,{value:C(w),children:s.jsx(gp,{rows:M,headerGroups:O,prepareRow:P})}),s.jsx(X,{condition:M.length===0,show:()=>s.jsx(X,{condition:(w==null?void 0:w.length)>0,show:s.jsxs($r,{children:["No feature flags found matching “",w,"”"]}),elseShow:s.jsx($r,{children:"None of the feature flags were archived yet."})})}),s.jsx(Yut,{deletedFeatures:[d==null?void 0:d.name],projectId:d==null?void 0:d.project,open:c,setOpen:u,refetch:n}),s.jsx(Kut,{revivedFeatures:[g==null?void 0:g.name],projectId:g==null?void 0:g.project,open:f,setOpen:h,refetch:n})]})})},Jut={id:"createdAt"},{value:Qut,setValue:Zut}=Au("FeaturesArchiveTable:v1",Jut),edt=()=>{Iu("Archive");const[e]=Xf(),{features:t,loading:n,refetch:r}=xC({query:e.get("search")||void 0,archived:"IS:true"});return s.jsx(Xut,{title:"Archive",archivedFeatures:t,loading:n,storedParams:Qut,setStoredParams:Zut,refetch:r})},tdt=m.lazy(()=>va(()=>import("./AdvancedPlayground-CUkOz1YF.js"),[])),ndt=x(Ue)(({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.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`},justifyContent:"space-between","& > span":{borderTopLeftRadius:0,borderBottomLeftRadius:0}})),rdt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),odt=x("div")(({theme:e})=>({fontWeight:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),idt=({label:e,description:t,selected:n,onClick:r,startIcon:o,endIcon:i})=>s.jsxs(ndt,{selected:!!n,className:n?"selected":"",onClick:r,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[o,s.jsxs(rdt,{children:[e,s.jsx(X,{condition:!!t,show:s.jsx(odt,{children:t})})]}),i]}),sdt=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("xl")]:{flexDirection:"column"}})),adt=x("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),rN=x("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%"}})),ldt=({tabs:e,value:t,onChange:n,children:r,...o})=>{const i=e.filter(a=>!a.hidden).map(a=>s.jsx(idt,{label:a.label,description:a.description,selected:a.id===t,onClick:()=>n(a),startIcon:a.startIcon,endIcon:a.endIcon},a.id));return r?s.jsxs(sdt,{children:[s.jsx(rN,{...o,children:i}),s.jsx(adt,{children:r})]}):s.jsx(rN,{fullWidth:!0,...o,children:i})},ete=(e,t={})=>{const n=async()=>{const u=bt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(Jt("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=cy({},r,n,t),[a,l]=m.useState(!i&&!o),c=()=>{Io(r)};return m.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},cdt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});await e(a.caller,a.id)},errors:n,loading:r}},udt=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),ddt=()=>{const{config:e,loading:t}=ete("simple"),[n,r]=m.useState(!1),{setToastData:o,setToastApiError:i}=Nt(),[a,l]=m.useState(!1),[c,u]=m.useState(),[d,p]=m.useState(),[f,h]=m.useState(""),[g,v]=m.useState(""),[b,y]=m.useState(""),{changePassword:w}=cdt(),S=f!==g,j=b===g,E=f.length>0&&g.length>0&&b.length>0,C=!E||S||j,T=async k=>{if(k.preventDefault(),!C){if(!a)u(jQ);else{r(!0),u(void 0),p(void 0);try{await w({password:f,confirmPassword:g,oldPassword:b}),o({text:"Password changed",type:"success"})}catch(_){const A=Tt(_);_ instanceof PP?p(A):u(A),i(A)}}r(!1)}};return t?null:s.jsx(cr,{isLoading:n,header:"Change password",children:s.jsx(X,{condition:e.disabled,show:s.jsx(Lt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:s.jsxs(udt,{children:[s.jsx(EQ,{password:f,callback:l,"data-loading":!0}),s.jsx(vf,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:k=>y(k.target.value)}),s.jsx(vf,{"data-loading":!0,label:"Password",name:"password",value:f,error:!!c,helperText:c,autoComplete:"new-password",onChange:k=>h(k.target.value)}),s.jsx(vf,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:g,autoComplete:"new-password",onChange:k=>v(k.target.value)}),s.jsx(TQ,{"data-loading":!0,started:E,passwordsDoNotMatch:S,sameAsOldPassword:j}),s.jsx(Ue,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:T,disabled:C,children:"Save"})]})})})},pdt=/^[a-z0-9\-_]*$/,fdt="environment",hdt="project",tte="root",nte="project",gdt="root-custom",mdt="custom",vdt=[tte,nte],PLt=[tte,gdt],ydt=[nte,mdt],rte=10,r$=()=>{const{data:e,error:t,mutate:n}=_n(bt("api/admin/user/tokens"),xdt);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},xdt=e=>fetch(e).then(Jt("Personal API Tokens")).then(t=>t.json()),ote=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},bdt=e=>{const t=new Date(e);return si(t,"yyyy-MM-dd")},wdt=e=>{const t=new Date(e);return`${si(t,"yyyy-MM-dd")}T${si(t,"HH:mm")}`},Sdt=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?wdt:bdt,d=t==="datetime"?"datetime-local":"date";return s.jsx(xn,{type:d,size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=tA(p.target.value);l(f??a)},FormHelperTextProps:{"data-testid":tY},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},oN=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Cdt=x(vr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),jdt=x("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"}})),Edt=x($I)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Tdt=x(Sdt)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),kdt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var ite=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(ite||{});const ste=[{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"}],ZT=e=>{const t=new Date,n=ste.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},_dt=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=wo(),d=v=>{c(b=>({...b,[v]:void 0}))},p=(v,b)=>{c(y=>({...y,[v]:b}))};m.useEffect(()=>{d("expiresAt"),a(ZT(r))},[r]);const f=v=>{d("description"),n&&!n(v)&&p("description","A token with that description already exists."),t(v)},h=r==="custom",g=i.getFullYear()>new Date().getFullYear()+100;return s.jsxs(s.Fragment,{children:[s.jsx(oN,{children:"Describe what this token will be used for"}),s.jsx(Cdt,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:v=>f(v.target.value),required:!0}),s.jsx(oN,{children:"Token expiration date"}),s.jsxs(jdt,{custom:h,children:[s.jsx(Edt,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:ste}),s.jsx(X,{condition:h,show:()=>s.jsx(Tdt,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&p("expiresAt","Invalid date, must be in the future"),a(v)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:s.jsx(X,{condition:g,show:s.jsxs(Z,{variant:"body2",children:["The token will ",s.jsx("strong",{children:"never"})," ","expire!"]}),elseShow:()=>s.jsxs(Z,{variant:"body2",children:["Token will expire on"," ",s.jsx("strong",{children:Kd(i,u.locale)})]})})})]}),s.jsx(X,{condition:g,show:s.jsx(kdt,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},Rdt=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Pdt=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Adt=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),zx=ite["30DAYS"],Idt=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=r$(),{createPersonalAPIToken:i,loading:a}=ote(),{setToastApiError:l}=Nt(),{uiConfig:c}=rt(),[u,d]=m.useState(""),[p,f]=m.useState(zx),[h,g]=m.useState(ZT(zx)),[v,b]=m.useState({});m.useEffect(()=>{d(""),f(zx),g(ZT(zx)),b({})},[e]);const y=()=>({description:u,expiresAt:h}),w=async T=>{T.preventDefault();try{const k=await i(y());n(k),o(),t(!1)}catch(k){l(Tt(k))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
417
+ --data-raw '${JSON.stringify(P(),void 0,2)}'`,B=W=>W.length,L=W=>!(o!=null&&o.some(oe=>oe.name===W)),I=B(h)&&L(h)&&S.length,q=W=>{O("name"),L(W)||M("name","An environment with that name already exists."),g(W)},ee=u.map(W=>({value:W.id,label:W.name}));return s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:s.jsx(Fr,{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/reference/environments#clone-an-environment",documentationLinkLabel:"Cloning environments documentation",formatApiCode:z,children:s.jsxs(Kct,{onSubmit:D,children:[s.jsxs("div",{children:[s.jsx(Th,{children:"What is your new environment name? (Can't be changed later)"}),s.jsx(Xct,{autoFocus:!0,label:"Environment name",error:!!_.name,errorText:_.name,value:h,onChange:W=>q(W.target.value),required:!0}),s.jsx(Th,{children:"What type of environment do you want to create?"}),s.jsx(nZ,{onChange:W=>b(W.currentTarget.value),value:v}),s.jsxs(Th,{children:["Select which projects you want to clone the environment configuration in?",s.jsx(bo,{tooltip:"The cloned environment will keep the feature flag state for the selected projects, where it will be enabled by default."})]}),s.jsx(Vct,{projects:y,setProjects:w}),s.jsx(Th,{children:"Keep the users permission for this environment?"}),s.jsx(L5,{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."}),s.jsx(qr,{label:E?"Yes":"No",control:s.jsx(fa,{onChange:W=>C(W.target.checked),checked:E})}),s.jsxs(Jct,{children:[s.jsx(Th,{children:"API Token"}),s.jsxs(L5,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s.jsx(Is,{children:s.jsxs(DS,{value:T,onChange:W=>k(W.target.value),name:"api-token-generation",children:[s.jsx(qr,{value:"later",control:s.jsx(yl,{}),label:"I want to generate an API token later"}),s.jsx(qr,{value:"now",control:s.jsx(yl,{}),label:"Generate an API token now"})]})}),s.jsxs(Qct,{children:[s.jsx(L5,{children:"A new backend API token will be generated for the cloned environment, so you can get started right away."}),s.jsx(X,{condition:T==="now",show:s.jsxs(s.Fragment,{children:[s.jsx(Th,{children:"Which projects do you want this token to give access to?"}),s.jsx(qct,{options:ee,defaultValue:S,onChange:j,error:_.projects,onFocus:()=>O("projects")})]})})]})]})]}),s.jsxs(Zct,{children:[s.jsx(Ue,{type:"submit",variant:"contained",color:"primary",disabled:!I,children:"Clone environment"}),s.jsx(eut,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},e$=({token:e})=>{const{setToastData:t}=Nt(),n=()=>{CC(e)?t({type:"success",text:"Token copied to clipboard"}):t({type:"error",text:"Could not copy token"})};return s.jsxs(J,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,s.jsx(kt,{title:"Copy token",arrow:!0,children:s.jsx($t,{onClick:n,size:"large",children:s.jsx(oh,{})})})]})},nut=({open:e,setOpen:t,token:n})=>s.jsxs(Gn,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[s.jsx(Z,{variant:"body1",children:"Your new token has been created successfully."}),s.jsxs(Z,{variant:"body1",children:['You can also find it as "',s.jsx("strong",{children:n==null?void 0:n.tokenName}),'" in the'," ",s.jsx(xt,{to:"/admin/api",children:"API access page"}),"."]}),s.jsx(e$,{token:(n==null?void 0:n.secret)||""})]});var t$={},rut=Te;Object.defineProperty(t$,"__esModule",{value:!0});var ej=t$.default=void 0,out=rut(ke()),iut=s,sut=(0,out.default)((0,iut.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");ej=t$.default=sut;const aut=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),lut=x($t)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),cut=x(lm,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),Jee=({environment:e})=>s.jsxs(aut,{children:[s.jsx(lut,{size:"large",disableRipple:!0,className:"drag-icon",children:s.jsx(ej,{titleAccess:"Drag to reorder"})}),s.jsx(cut,{deprecated:!e.enabled})]}),uut=x(ta)(({theme:e})=>({marginTop:e.spacing(3)})),dut=x("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),Qee=({environment:e,warnEnabledToggles:t})=>{const n=m.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>s.jsx(Jee,{environment:c})},{Header:"Name",accessor:"name",Cell:En},{Header:"Type",accessor:"type",Cell:En},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>s.jsxs(En,{children:[u,s.jsx(X,{condition:!!t,show:s.jsx(dut,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l}=Zt.useTable({columns:n,data:[e],disableSortBy:!0});return s.jsxs(uut,{...r(),rowHeight:"compact",children:[s.jsx(ea,{headerGroups:i}),s.jsx(Ts,{...o(),children:a.map(c=>{l(c);const{key:u,...d}=c.getRowProps();return s.jsx(Mi,{hover:!0,...d,children:c.cells.map(p=>{const{key:f,...h}=p.getCellProps();return s.jsx(es,{...h,children:p.render("Cell")},f)})},u)})})]})},put=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return s.jsxs(Gn,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s.jsx(X,{condition:o,show:s.jsx(Lt,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:s.jsx(Lt,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),s.jsx(Qee,{environment:e})]})},fut=x("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),hut=x(vr)(()=>({width:"100%"})),gut=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=m.useState("");return m.useEffect(()=>{i("")},[t]),s.jsxs(Gn,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s.jsxs(Lt,{severity:"error",children:[s.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."]}),s.jsx(Qee,{environment:e,warnEnabledToggles:!0}),s.jsxs(fut,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",s.jsx("strong",{children:e.name})]}),s.jsx(hut,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},mut=({environment:e})=>{const t=Ot(),{uiConfig:n}=rt(),r=n.resourceLimits.environments,{setToastApiError:o,setToastData:i}=Nt(),{environments:a,refetchEnvironments:l}=$u(),{refetch:c}=tI(),{deleteEnvironment:u,toggleEnvironmentOn:d,toggleEnvironmentOff:p}=bm(),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[b,y]=m.useState(!1),[w,S]=m.useState(!1),[j,E]=m.useState(),C=async()=>{try{await u(e.name),c(),i({type:"success",text:"Environment deleted"})}catch(k){o(Tt(k))}finally{h(!1),await l()}},T=async()=>{try{e.enabled?(await p(e.name),i({type:"success",text:"Environment deprecated"})):(await d(e.name),i({type:"success",text:"Environment undeprecated"}))}catch(k){o(Tt(k))}finally{v(!1),await l()}};return s.jsxs(Tu,{children:[s.jsx(Lct,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>v(!0),onClone:()=>{a.length<r?y(!0):i({type:"error",text:`Environment limit (${r}) reached`})},onDelete:()=>h(!0)}),s.jsx(gut,{environment:e,open:f,setOpen:h,onConfirm:C}),s.jsx(put,{environment:e,open:g,setOpen:v,onConfirm:T}),s.jsx(tut,{environment:e,open:b,setOpen:y,newToken:k=>{E(k),S(!0)}}),s.jsx(nut,{open:w,setOpen:S,token:j})]})},vut=x(Lt)(({theme:e})=>({marginBottom:e.spacing(4)})),yut=()=>{const{changeSortOrder:e}=bm(),{setToastApiError:t}=Nt(),{environments:n,mutateEnvironments:r}=$u(),o=ci("EEA"),{isEnterprise:i}=rt(),a=m.useCallback(async({dragIndex:S,dropIndex:j,save:E})=>{const T=[...n||[]],k=T.splice(S,1)[0];if(T.splice(j,0,k),await r(T),E)try{await e(RKe(T))}catch(_){t(Tt(_))}},[e,n,r,t]),l=m.useMemo(()=>{const S=[...xut,...o?[{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:j}})=>s.jsx(mut,{environment:j}),disableGlobalFilter:!0}]:[]];return i()&&S.splice(2,0,{Header:"Change request",accessor:j=>Number.isInteger(j.requiredApprovals)?"yes":"no",Cell:En}),S},[o]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f,state:{globalFilter:h},setGlobalFilter:g}=Zt.useTable({columns:l,data:n,disableSortBy:!0},Zt.useGlobalFilter),v=s.jsx(xo,{initialValue:h,onChange:g}),b=s.jsxs(s.Fragment,{children:[v,s.jsx(Pn.Divider,{}),s.jsx(xct,{})]}),y=p.length,w=s.jsx(Pn,{title:`Environments (${y})`,actions:b});return o?s.jsxs(cr,{header:w,children:[s.jsx(vut,{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."}),s.jsx(is,{value:h,children:s.jsxs(ta,{...c(),rowHeight:"compact",children:[s.jsx(ea,{headerGroups:d}),s.jsx(Ts,{...u(),children:p.map(S=>(f(S),s.jsx(Sct,{row:S,onMoveItem:a},S.original.name)))})]})}),s.jsx(X,{condition:p.length===0,show:s.jsx(X,{condition:(h==null?void 0:h.length)>0,show:s.jsxs($r,{children:["No environments found matching “",h,"”"]}),elseShow:s.jsx($r,{children:"No environments available. Get started by adding one."})})})]}):s.jsx(cr,{header:w,children:s.jsx(ym,{feature:"environments"})})},xut=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>s.jsx(Jee,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>s.jsx(Ect,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:_s},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:En},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:En}],but=()=>{const e=$s("projectId"),t=Ot();return s.jsx(Ro,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[cC,Qd],projectId:e,"data-testid":lje,children:"New segment"})},wut=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),Sut=x(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),Cut=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),jut=x(xt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Eut=()=>{const e=$s("projectId"),{hasAccess:t}=m.useContext($o);return s.jsxs(wut,{children:[s.jsx(Sut,{children:"No segments yet!"}),s.jsx(Cut,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),s.jsx(X,{condition:t([cC,Qd],e),show:s.jsx(jut,{to:"/segments/create",children:"Create your first segment"})})]})};var n$={},Tut=Te;Object.defineProperty(n$,"__esModule",{value:!0});var Zee=n$.default=void 0,kut=Tut(ke()),_ut=s,Rut=(0,kut.default)((0,_ut.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");Zee=n$.default=Rut;const Put=x(vr)(({theme:e})=>({marginTop:e.spacing(2)})),Aut=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const[i,a]=m.useState(""),l=d=>a(d.currentTarget.value),c=()=>{n(),a("")},u="delete-segment-confirmation-form";return s.jsxs(Gn,{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)!==i,onClose:c,formId:u,children:[s.jsx(Lt,{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."}),s.jsxs("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",s.jsx("strong",{children:e==null?void 0:e.name})]}),s.jsx("form",{id:u,children:s.jsx(Put,{autoFocus:!0,onChange:l,value:i,label:"Segment name","data-testid":vje})})]})},Iut=x("ul")({marginBottom:0}),ZF=x(xt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),$ut=(e,t)=>`/projects/${e}/change-requests/${t}`,Out=({segment:e,open:t,onClose:n,strategies:r,changeRequestStrategies:o})=>{const i=Hee(r??[],o??[]);return s.jsxs(Gn,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[s.jsxs("p",{children:["The following feature flags are using the"," ",s.jsx("strong",{children:e.name})," segment for their strategies:"]}),s.jsx(Iut,{children:i.map((a,l)=>Mut(a,l))})]})},eN=e=>e.strategyName?`(${Il(e.strategyName)})`:"",Mut=(e,t)=>{if((r=>"changeRequest"in r)(e)){const{id:r,title:o}=e.changeRequest,i=o?`#${r} (${o})`:`#${r}`;return s.jsx("li",{children:s.jsxs("p",{children:[e.featureName," ",`${eN(e)} — in change request `,s.jsx(ZF,{to:$ut(e.projectId,r),target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:i})]})},`#${e.changeRequest.id}@${t}`)}else return s.jsx("li",{children:s.jsxs(ZF,{to:DI(e.projectId,e.featureName,e.environment,e.id),target:"_blank",rel:"noopener noreferrer",children:[e.featureName," ",eN(e)]})},e.id)},Dut=({segment:e,open:t,onClose:n,onRemove:r,title:o})=>{const{strategies:i,changeRequestStrategies:a,loading:l}=zee(e.id),c=(i==null?void 0:i.length)===0&&(a==null?void 0:a.length)===0;return l?null:s.jsx(X,{condition:c,show:s.jsx(Aut,{segment:e,open:t,onClose:n,onRemove:r,title:o}),elseShow:s.jsx(Out,{segment:e,open:t,onClose:n,strategies:i,changeRequestStrategies:a})})},Lut=({segment:e})=>{const t=$s("projectId"),{refetchSegments:n}=ma(),{deleteSegment:r}=GI(),{setToastData:o,setToastApiError:i}=Nt(),[a,l]=m.useState(!1),u=Gee(e==null?void 0:e.project)(),{addChange:d}=Ou(),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){i(Tt(f))}finally{l(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(Wo,{onClick:()=>l(!0),permission:[Y9e,Qd],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${mje}_${e.name}`,children:s.jsx(Po,{"data-loading":!0})}),s.jsx(X,{condition:a,show:()=>s.jsx(Dut,{segment:e,open:a,onClose:()=>l(!1),onRemove:p,title:u?"Add to draft":"Save"})})]})},Fut=({segment:e})=>{const t=$s("projectId"),n=Ot();return s.jsx(Wo,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[CA,Qd],projectId:t,tooltipProps:{title:"Edit segment"},children:s.jsx(ns,{"data-loading":!0})})},Nut=({segment:e})=>s.jsxs(Tu,{children:[s.jsx(Fut,{segment:e}),s.jsx(Lut,{segment:e})]}),uh=(e,t,n)=>{m.useEffect(()=>{const r=e.filter(({condition:i})=>i).flatMap(({columns:i})=>i),o=e.flatMap(({columns:i})=>i).filter(i=>!r.includes(i));t(i=>[...new Set([...i,...r].filter(a=>!o.includes(a)))])},[...e.map(({condition:r})=>r),t,n])},But=()=>{const e=$s("projectId"),{segments:t,loading:n}=ma(),r=Xn(pr.breakpoints.down("md")),[o]=m.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=m.useMemo(()=>t?e?t.filter(({project:v})=>v===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),a=m.useMemo(()=>zut(e),[e]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:f},setGlobalFilter:h,setHiddenColumns:g}=Zt.useTable({initialState:o,columns:a,data:i,sortTypes:yi,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:_s},getRowId:v=>v.id},Zt.useGlobalFilter,Zt.useSortBy);return uh([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],g,a),s.jsx(cr,{header:s.jsx(Pn,{title:`Segments (${d.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:f,onChange:h}),s.jsx(Pn.Divider,{}),s.jsx(but,{})]})}),isLoading:n,children:s.jsx(X,{condition:!n&&i.length===0,show:s.jsx($r,{children:s.jsx(Eut,{})}),elseShow:()=>s.jsxs(s.Fragment,{children:[s.jsx(is,{value:f,children:s.jsxs(ta,{...l(),rowHeight:"standard",children:[s.jsx(ea,{headerGroups:u}),s.jsx(Ts,{...c(),children:d.map(v=>{p(v);const{key:b,...y}=v.getRowProps();return s.jsx(Mi,{hover:!0,...y,children:v.cells.map(w=>{const{key:S,...j}=w.getCellProps();return s.jsx(es,{...j,children:w.render("Cell")},S)})},b)})})]})}),s.jsx(X,{condition:d.length===0&&(f==null?void 0:f.length)>0,show:s.jsxs($r,{children:["No segments found matching “",f,"”"]})})]})})})},zut=e=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s.jsx(JC,{icon:s.jsx(Zee,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:t,description:n,id:r}}})=>s.jsx(Rl,{title:t,to:e?`/projects/${e}/settings/segments/edit/${r}`:`/segments/edit/${r}`,subtitle:n})},{Header:"Used in",width:"60%",Cell:({row:{original:t}})=>s.jsx(jee,{original:t})},{Header:"Project",accessor:"project",Cell:({value:t})=>s.jsx(X,{condition:!!t,show:s.jsx(Rl,{title:t,to:`/projects/${t}`}),elseShow:s.jsx(En,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Jd,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}})=>s.jsx(Nut,{segment:t})},{accessor:"description"}],Hut=x("div")(({theme:e})=>({padding:e.spacing(1.5),display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),Wut=({value:e,getValue:t})=>{var l;const n=e||(t==null?void 0:t())||void 0,{featureTypes:r}=dm(),o=wC(n),a=`This is a "${((l=r.find(c=>c.id===n))==null?void 0:l.name)||n}" toggle`;return s.jsx(Hut,{children:s.jsx(kt,{arrow:!0,title:a,describeChild:!0,children:s.jsx(o,{"data-loading":!0})})})},Vut=({onRevive:e,onDelete:t,project:n})=>s.jsxs(Tu,{children:[s.jsx(Wo,{onClick:e,projectId:n,permission:cm,tooltipProps:{title:"Revive feature flag"},"data-testid":"revive-feature-flag-button",children:s.jsx(eI,{})}),s.jsx(Wo,{permission:cX,projectId:n,tooltipProps:{title:"Delete feature flag"},onClick:t,children:s.jsx(Po,{})})]}),Uut=({value:e})=>{const{locationSettings:t}=wo(),n=qt();return e?s.jsx(En,{children:s.jsx(kt,{title:`Archived on: ${Kd(e,t.locale)}`,arrow:!0,children:s.jsx(Z,{noWrap:!0,variant:"body2","data-loading":!0,children:s.jsx(Pl,{date:new Date(e),refresh:!1})})})}):s.jsx(En,{children:s.jsx(Z,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},tN=x("p")(({theme:e})=>({marginTop:e.spacing(3)})),Gut=x(vr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),qut="I want to delete",Yut=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=m.useState(""),{setToastData:l,setToastApiError:c}=Nt(),{deleteFeatures:u}=xm(),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(g){c(Tt(g))}finally{f()}},f=()=>{r(!1),a("")},h="delete-feature-toggle-confirmation-form";return s.jsxs(Gn,{title:`Delete feature ${d}?`,open:n,primaryButtonText:`Delete feature ${d}`,secondaryButtonText:"Cancel",onClick:p,onClose:f,disabledPrimaryButton:qut!==i,formId:h,children:[s.jsxs(Lt,{severity:"warning",children:[s.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."]}),s.jsxs(tN,{children:["You are about to delete the following feature"," ",d,":"," ",s.jsx("strong",{children:e.join(", ")}),"."]}),s.jsxs(tN,{sx:g=>({marginTop:g.spacing(2)}),children:["In order to delete the feature ",d,", please enter the following confirmation text in the text field below:"," ",s.jsx("strong",{children:"I want to delete"})]}),s.jsx("form",{id:h,children:s.jsx(Gut,{autoFocus:!0,onChange:g=>{a(g.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},nN=x("p")(({theme:e})=>({marginTop:e.spacing(2)})),Kut=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:i,setToastApiError:a}=Nt(),{reviveFeatures:l}=xm(),{project:c,loading:u}=um(t),d=async()=>{try{if(e.length===0)return;await l(t,e),await o(),i({type:"success",text:"Feature flags revived"})}catch(g){a(Tt(g))}finally{p()}},p=()=>{r(!1)},f=`Revive feature flag${e.length>1?"s":""}?`,h=`Revive feature flag${e.length>1?"s":""}`;return s.jsxs(Gn,{title:f,open:n,primaryButtonText:h,secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:u||!!c.archivedAt,children:[s.jsx(X,{condition:!!c.archivedAt,show:s.jsxs(Lt,{severity:"warning",children:["Cannot revive feature flag in archived project (Project ID: ",t,")"]}),elseShow:s.jsx(Lt,{severity:"info",children:"Revived feature flags will be automatically disabled in all environments"})}),s.jsx(X,{condition:e.length>1,show:s.jsxs(s.Fragment,{children:[s.jsx(nN,{children:"You are about to revive feature flags:"}),s.jsx("ul",{children:e.map(g=>s.jsx("li",{children:g},`revive-${g}`))})]}),elseShow:s.jsxs(nN,{children:["You are about to revive feature flag:"," ",e[0]]})})]})},Xut=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i})=>{const a=Xn(pr.breakpoints.down("md")),l=Xn(pr.breakpoints.down("lg")),[c,u]=m.useState(!1),[d,p]=m.useState(),[f,h]=m.useState(!1),[g,v]=m.useState(),[b,y]=Xf(),[w,S]=m.useState(b.get("search")||""),j=m.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({row:{original:D}})=>s.jsx(_X,{feature:D}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:Wut,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:D,row:{original:z}})=>s.jsx(_s,{value:D,subtitle:z.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Jd},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Uut},{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:D})=>s.jsx(Rl,{title:D,to:`/projects/${D}`})},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:D}})=>s.jsx(Vut,{project:D.project,onRevive:()=>{v(D),h(!0)},onDelete:()=>{p(D),u(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[]),{data:E,getSearchText:C,getSearchContext:T}=eh(j,w,e),k=m.useMemo(()=>t?QX:E,[E,t]),[_]=m.useState(()=>({sortBy:[{id:b.get("sort")||r.id,desc:b.has("order")?b.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),A=m.useCallback(D=>D.name,[]),{headerGroups:O,rows:M,state:{sortBy:H},prepareRow:P,setHiddenColumns:$}=Zt.useTable({columns:j,data:k,initialState:_,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:A},Zt.useFlexLayout,Zt.useSortBy,Zt.useRowSelect);return uh([{condition:a,columns:["type","createdAt"]},{condition:l,columns:["lastSeenAt","stale"]}],$,j),m.useEffect(()=>{if(t)return;const D={};D.sort=H[0].id,H[0].desc&&(D.order="desc"),w&&(D.search=w),y(D,{replace:!0}),o({id:H[0].id,desc:H[0].desc||!1})},[t,H,w]),s.jsx(s.Fragment,{children:s.jsxs(cr,{isLoading:t,header:s.jsx(Pn,{titleElement:`${i} (${M.length})`,actions:s.jsx(xo,{initialValue:w,onChange:S,hasFilters:!0,getSearchContext:T})}),children:[M.length>=50&&s.jsx(Lt,{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."}),s.jsx(is,{value:C(w),children:s.jsx(gp,{rows:M,headerGroups:O,prepareRow:P})}),s.jsx(X,{condition:M.length===0,show:()=>s.jsx(X,{condition:(w==null?void 0:w.length)>0,show:s.jsxs($r,{children:["No feature flags found matching “",w,"”"]}),elseShow:s.jsx($r,{children:"None of the feature flags were archived yet."})})}),s.jsx(Yut,{deletedFeatures:[d==null?void 0:d.name],projectId:d==null?void 0:d.project,open:c,setOpen:u,refetch:n}),s.jsx(Kut,{revivedFeatures:[g==null?void 0:g.name],projectId:g==null?void 0:g.project,open:f,setOpen:h,refetch:n})]})})},Jut={id:"createdAt"},{value:Qut,setValue:Zut}=Au("FeaturesArchiveTable:v1",Jut),edt=()=>{Iu("Archive");const[e]=Xf(),{features:t,loading:n,refetch:r}=xC({query:e.get("search")||void 0,archived:"IS:true"});return s.jsx(Xut,{title:"Archive",archivedFeatures:t,loading:n,storedParams:Qut,setStoredParams:Zut,refetch:r})},tdt=m.lazy(()=>va(()=>import("./AdvancedPlayground-D2Y0O_LK.js"),[])),ndt=x(Ue)(({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.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`},justifyContent:"space-between","& > span":{borderTopLeftRadius:0,borderBottomLeftRadius:0}})),rdt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),odt=x("div")(({theme:e})=>({fontWeight:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),idt=({label:e,description:t,selected:n,onClick:r,startIcon:o,endIcon:i})=>s.jsxs(ndt,{selected:!!n,className:n?"selected":"",onClick:r,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[o,s.jsxs(rdt,{children:[e,s.jsx(X,{condition:!!t,show:s.jsx(odt,{children:t})})]}),i]}),sdt=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("xl")]:{flexDirection:"column"}})),adt=x("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),rN=x("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%"}})),ldt=({tabs:e,value:t,onChange:n,children:r,...o})=>{const i=e.filter(a=>!a.hidden).map(a=>s.jsx(idt,{label:a.label,description:a.description,selected:a.id===t,onClick:()=>n(a),startIcon:a.startIcon,endIcon:a.endIcon},a.id));return r?s.jsxs(sdt,{children:[s.jsx(rN,{...o,children:i}),s.jsx(adt,{children:r})]}):s.jsx(rN,{fullWidth:!0,...o,children:i})},ete=(e,t={})=>{const n=async()=>{const u=bt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(Jt("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=cy({},r,n,t),[a,l]=m.useState(!i&&!o),c=()=>{Io(r)};return m.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},cdt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});await e(a.caller,a.id)},errors:n,loading:r}},udt=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),ddt=()=>{const{config:e,loading:t}=ete("simple"),[n,r]=m.useState(!1),{setToastData:o,setToastApiError:i}=Nt(),[a,l]=m.useState(!1),[c,u]=m.useState(),[d,p]=m.useState(),[f,h]=m.useState(""),[g,v]=m.useState(""),[b,y]=m.useState(""),{changePassword:w}=cdt(),S=f!==g,j=b===g,E=f.length>0&&g.length>0&&b.length>0,C=!E||S||j,T=async k=>{if(k.preventDefault(),!C){if(!a)u(jQ);else{r(!0),u(void 0),p(void 0);try{await w({password:f,confirmPassword:g,oldPassword:b}),o({text:"Password changed",type:"success"})}catch(_){const A=Tt(_);_ instanceof PP?p(A):u(A),i(A)}}r(!1)}};return t?null:s.jsx(cr,{isLoading:n,header:"Change password",children:s.jsx(X,{condition:e.disabled,show:s.jsx(Lt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:s.jsxs(udt,{children:[s.jsx(EQ,{password:f,callback:l,"data-loading":!0}),s.jsx(vf,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:k=>y(k.target.value)}),s.jsx(vf,{"data-loading":!0,label:"Password",name:"password",value:f,error:!!c,helperText:c,autoComplete:"new-password",onChange:k=>h(k.target.value)}),s.jsx(vf,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:g,autoComplete:"new-password",onChange:k=>v(k.target.value)}),s.jsx(TQ,{"data-loading":!0,started:E,passwordsDoNotMatch:S,sameAsOldPassword:j}),s.jsx(Ue,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:T,disabled:C,children:"Save"})]})})})},pdt=/^[a-z0-9\-_]*$/,fdt="environment",hdt="project",tte="root",nte="project",gdt="root-custom",mdt="custom",vdt=[tte,nte],PLt=[tte,gdt],ydt=[nte,mdt],rte=10,r$=()=>{const{data:e,error:t,mutate:n}=_n(bt("api/admin/user/tokens"),xdt);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},xdt=e=>fetch(e).then(Jt("Personal API Tokens")).then(t=>t.json()),ote=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},bdt=e=>{const t=new Date(e);return si(t,"yyyy-MM-dd")},wdt=e=>{const t=new Date(e);return`${si(t,"yyyy-MM-dd")}T${si(t,"HH:mm")}`},Sdt=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?wdt:bdt,d=t==="datetime"?"datetime-local":"date";return s.jsx(xn,{type:d,size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=tA(p.target.value);l(f??a)},FormHelperTextProps:{"data-testid":tY},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},oN=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Cdt=x(vr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),jdt=x("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"}})),Edt=x($I)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Tdt=x(Sdt)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),kdt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var ite=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(ite||{});const ste=[{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"}],ZT=e=>{const t=new Date,n=ste.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},_dt=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=wo(),d=v=>{c(b=>({...b,[v]:void 0}))},p=(v,b)=>{c(y=>({...y,[v]:b}))};m.useEffect(()=>{d("expiresAt"),a(ZT(r))},[r]);const f=v=>{d("description"),n&&!n(v)&&p("description","A token with that description already exists."),t(v)},h=r==="custom",g=i.getFullYear()>new Date().getFullYear()+100;return s.jsxs(s.Fragment,{children:[s.jsx(oN,{children:"Describe what this token will be used for"}),s.jsx(Cdt,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:v=>f(v.target.value),required:!0}),s.jsx(oN,{children:"Token expiration date"}),s.jsxs(jdt,{custom:h,children:[s.jsx(Edt,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:ste}),s.jsx(X,{condition:h,show:()=>s.jsx(Tdt,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&p("expiresAt","Invalid date, must be in the future"),a(v)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:s.jsx(X,{condition:g,show:s.jsxs(Z,{variant:"body2",children:["The token will ",s.jsx("strong",{children:"never"})," ","expire!"]}),elseShow:()=>s.jsxs(Z,{variant:"body2",children:["Token will expire on"," ",s.jsx("strong",{children:Kd(i,u.locale)})]})})})]}),s.jsx(X,{condition:g,show:s.jsx(kdt,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},Rdt=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Pdt=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Adt=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),zx=ite["30DAYS"],Idt=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=r$(),{createPersonalAPIToken:i,loading:a}=ote(),{setToastApiError:l}=Nt(),{uiConfig:c}=rt(),[u,d]=m.useState(""),[p,f]=m.useState(zx),[h,g]=m.useState(ZT(zx)),[v,b]=m.useState({});m.useEffect(()=>{d(""),f(zx),g(ZT(zx)),b({})},[e]);const y=()=>({description:u,expiresAt:h}),w=async T=>{T.preventDefault();try{const k=await i(y());n(k),o(),t(!1)}catch(k){l(Tt(k))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
418
418
  --header 'Authorization: INSERT_API_KEY' \\
419
419
  --header 'Content-Type: application/json' \\
420
420
  --data-raw '${JSON.stringify(y(),void 0,2)}'`,j=T=>T.length,E=T=>!(r!=null&&r.some(k=>k.description===T)),C=j(u)&&E(u)&&h>new Date;return s.jsx(Za,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:s.jsx(Fr,{loading:a,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
421
421
  yourself. A personal API token has the same access privileges as
422
- your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens",documentationLinkLabel:"Personal access tokens documentation",formatApiCode:S,children:s.jsxs(Rdt,{onSubmit:w,children:[s.jsx("div",{children:s.jsx(_dt,{description:u,setDescription:d,isDescriptionUnique:E,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:g,errors:v,setErrors:b})}),s.jsxs(Pdt,{children:[s.jsx(Ue,{type:"submit",variant:"contained",color:"primary",disabled:!C,children:"Create token"}),s.jsx(Adt,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},$dt=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=r$(),{deletePersonalAPIToken:o}=ote(),{setToastData:i,setToastApiError:a}=Nt(),l=async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({text:"Token deleted",type:"success"})}catch(c){a(Tt(c))}};return s.jsx(Gn,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:l,onClose:()=>{t(!1)},title:"Delete token?",children:s.jsxs(Z,{children:['Any applications or scripts using this token "',s.jsx("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},Odt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),Mdt=({open:e,setOpen:t,token:n})=>s.jsxs(Gn,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s.jsx(Odt,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s.jsx(Z,{variant:"body1",children:"Your token:"}),s.jsx(e$,{token:(n==null?void 0:n.secret)||""})]}),Ddt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),Ldt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),Fdt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),Ndt=x(Z)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),Bdt=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),zdt={id:"createdAt",desc:!0},{value:iN,setValue:Hdt}=Au("PersonalAPITokensTable:v1",zdt),Wdt=()=>{const e=qt(),t=Xn(e.breakpoints.down("md")),n=Xn(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=r$(),[i,a]=Xf(),[l]=m.useState(()=>({sortBy:[{id:i.get("sort")||iN.id,desc:i.has("order")?i.get("order")==="desc":iN.desc}],globalFilter:i.get("search")||""})),[c,u]=m.useState(l.globalFilter),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[b,y]=m.useState(),[w,S]=m.useState(),j=m.useMemo(()=>[{Header:"Description",accessor:"description",Cell:_s,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:P})=>new Date(P).getFullYear()>new Date().getFullYear()+100?s.jsx(En,{children:"Never"}):s.jsx(Jd,{value:P}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Jd,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:ay,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:P}})=>s.jsx(Tu,{children:s.jsx(kt,{title:"Delete token",arrow:!0,describeChild:!0,children:s.jsx("span",{children:s.jsx($t,{onClick:()=>{S(P),v(!0)},children:s.jsx(Po,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:E,getSearchText:C,getSearchContext:T}=eh(j,c,r),k=m.useMemo(()=>(E==null?void 0:E.length)===0&&o?Bdt:E,[E,o]),{headerGroups:_,rows:A,prepareRow:O,state:{sortBy:M},setHiddenColumns:H}=Zt.useTable({columns:j,data:k,initialState:l,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],H,j),m.useEffect(()=>{const P={};P.sort=M[0].id,M[0].desc&&(P.order="desc"),c&&(P.search=c),a(P,{replace:!0}),Hdt({id:M[0].id,desc:M[0].desc||!1})},[M,c,a]),s.jsxs(cr,{isLoading:o,header:s.jsx(Pn,{title:`Personal API tokens (${A.length<k.length?`${A.length} of ${k.length}`:k.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!t,show:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:c,onChange:u,getSearchContext:T}),s.jsx(Pn.Divider,{})]})}),s.jsx(Ue,{variant:"contained",color:"primary",disabled:r.length>=rte,onClick:()=>p(!0),children:"New token"})]}),children:s.jsx(X,{condition:t,show:s.jsx(xo,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:T})})}),children:[s.jsx(Ddt,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s.jsx(is,{value:C(c),children:s.jsx(gp,{rows:A,headerGroups:_,prepareRow:O})}),s.jsx(X,{condition:A.length===0,show:s.jsx(X,{condition:(c==null?void 0:c.length)>0,show:s.jsxs($r,{children:["No tokens found matching “",c,"”"]}),elseShow:s.jsxs(Ldt,{children:[s.jsx(Fdt,{children:"You have no personal API tokens yet."}),s.jsx(Ndt,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s.jsx(Ue,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s.jsx(Idt,{open:d,setOpen:p,newToken:P=>{y(P),h(!0)}}),s.jsx(Mdt,{open:f,setOpen:h,token:b}),s.jsx($dt,{open:g,setOpen:v,token:w})]})};var o$={},Vdt=Te;Object.defineProperty(o$,"__esModule",{value:!0});var i$=o$.default=void 0,Udt=Vdt(ke()),Gdt=s,qdt=(0,Udt.default)((0,Gdt.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");i$=o$.default=qdt;const ate=(e,t={})=>{const{isEnterprise:n}=rt(),{data:r,error:o,mutate:i}=Bi(!!e&&n(),void 0,bt(`api/admin/roles/${e}`),Ydt,t);return m.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},Ydt=e=>fetch(e).then(Jt("Role")).then(t=>t.json());var s$={},Kdt=Te;Object.defineProperty(s$,"__esModule",{value:!0});var lte=s$.default=void 0,Xdt=Kdt(ke()),Jdt=s,Qdt=(0,Xdt.default)((0,Jdt.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");lte=s$.default=Qdt;var a$={},Zdt=Te;Object.defineProperty(a$,"__esModule",{value:!0});var cte=a$.default=void 0,ept=Zdt(ke()),tpt=s,npt=(0,ept.default)((0,tpt.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");cte=a$.default=npt;const xf=e=>e.environment?`${e.name}-${e.environment}`:`${e.name}`,ALt=e=>e.reduce((t,n)=>(t[xf(n)]=n,t),{}),ILt=(e,t)=>{const n=py(e);return n[xf(t)]?delete n[xf(t)]:n[xf(t)]={...t},n},$Lt=(e,t)=>{const n=py(e);return t.every(o=>n[xf(o)])?t.forEach(o=>{delete n[xf(o)]}):t.forEach(o=>{n[xf(o)]={...o}}),n},rpt=e=>e.filter(({name:r})=>r!=="ADMIN").reduce((r,o)=>{var l;const i=((l=UIe.find(c=>c.permissions.includes(o.name)))==null?void 0:l.label)||"Other",a=r.find(({label:c})=>c===i);return a?a.permissions.push(o):r.push({label:i,type:"root",permissions:[o]}),r},[]).map(r=>({...r,permissions:[...new Set(r.permissions.sort((o,i)=>o.displayName.localeCompare(i.displayName)))]})).sort(ipt),opt=e=>{const t=e.filter(({type:o})=>o===hdt),n=e.filter(({type:o})=>o===fdt),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const a=i.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(i):o.push({label:a,type:"environment",permissions:[i]}),o},[])),r.map(o=>({...o,permissions:[...new Set(o.permissions.sort((i,a)=>i.displayName.localeCompare(a.displayName)))]}))},OLt=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],ipt=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),spt=x("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})),apt=x("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),lpt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),cpt=x("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),upt=x(cte)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),dpt=x("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),ppt=x("p")(({theme:e})=>({marginTop:e.spacing(.5)})),fpt=x("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),hpt=({roleId:e,tooltip:t,...n})=>{const{role:r}=ate(e.toString());if(!r)return null;const{name:o,description:i,permissions:a,type:l}=r,u=ydt.includes(l)?opt(a):rpt(a);return s.jsxs(spt,{tooltip:t,...n,children:[s.jsxs(cpt,{children:[s.jsx(upt,{color:"disabled"}),o]}),s.jsx(ppt,{children:i}),s.jsx(X,{condition:!vdt.includes(r.type),show:()=>s.jsxs(s.Fragment,{children:[s.jsx(apt,{children:"Role permissions:"}),s.jsx(lpt,{children:u.map(({label:d,permissions:p})=>s.jsxs("div",{children:[s.jsx(dpt,{children:d}),s.jsx(fpt,{children:p.map(f=>s.jsx("li",{children:f.displayName},f.name))})]},d))})]})})]})},gpt=({roleId:e,hideIcon:t,children:n})=>{const{role:r}=ate(e.toString()),o=t?void 0:s.jsx(lte,{});return r?s.jsx(hr,{title:s.jsx(hpt,{roleId:e,tooltip:!0}),arrow:!0,children:s.jsx(sn,{tabIndex:0,color:"success",icon:o,sx:{cursor:"pointer"},children:r.name})}):n?s.jsx(sn,{color:"success",icon:o,children:n}):null},mpt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},vpt=({status:e,onChange:t})=>{const{subscribe:n,unsubscribe:r,loading:o}=mpt(),{setToastData:i,setToastApiError:a}=Nt(),{trackEvent:l}=Kt();return s.jsx(J,{children:s.jsx(qr,{label:"Productivity Email Subscription",control:s.jsx(fa,{onChange:async()=>{try{e==="subscribed"?(await r("productivity-report"),i({text:"Unsubscribed from productivity report",type:"success"}),l("productivity-report",{props:{eventType:"unsubscribe"}})):(await n("productivity-report"),i({text:"Subscribed to productivity report",type:"success"}),l("productivity-report",{props:{eventType:"subscribe"}}))}catch(c){a(Tt(c))}t()},name:"productivity-email",checked:e==="subscribed",disabled:o})})})},ypt=["cs","da-DK","de","en-GB","en-IN","en-US","fr-FR","ja","nb-NO","pt-BR","sv-SE"],xpt=x("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})),bpt=x("div")(()=>({flexGrow:1})),wpt=x(Z)(({theme:e})=>({fontSize:e.spacing(3.75)})),Spt=x(hp)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),F5=x(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),Cpt=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),"& > div > p":{marginBottom:e.spacing(1.5)}})),jpt=x(xt)(({theme:e})=>({":hover,:focus-visible":{outline:"none","> *":{outline:`2px solid ${e.palette.primary.main}`}}})),sN=x("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),Ept=x(Is)(({theme:e})=>({width:e.spacing(30)})),Tpt=x(Su)(({theme:e})=>({backgroundColor:e.palette.background.paper})),kpt=x("ul")(({theme:e})=>({listStyle:"none",padding:0,display:"flex",flexFlow:"row wrap",gap:e.spacing(1)})),ute="2014-09-29T14:50:46",_pt=new Date(ute),Rpt=x("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",flexFlow:"row wrap",gap:e.spacing(1),alignItems:"center"})),Ppt=({user:e})=>{const{profile:t,refetchProfile:n}=AQ(),{locationSettings:r,setLocationSettings:o}=wo(),[i,a]=m.useState(),l=m.useId(),[c,u]=m.useState([...ypt]);m.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=ci("productivityReportEmail");return s.jsxs(s.Fragment,{children:[s.jsxs(xpt,{children:[s.jsx(Spt,{user:e}),s.jsxs(bpt,{children:[s.jsx(wpt,{children:e.name||e.email||e.username}),s.jsx(Z,{variant:"body1",children:e.email})]})]}),s.jsxs(cr,{children:[s.jsx(F5,{children:"Access"}),s.jsxs(Cpt,{children:[s.jsx(J,{sx:{width:"50%"},children:s.jsx(X,{condition:!!(t!=null&&t.rootRole),show:()=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body2",children:"Your root role"}),s.jsx(gpt,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),s.jsxs(J,{children:[s.jsx(Z,{variant:"body2",children:"Projects"}),s.jsx(X,{condition:!!(t!=null&&t.projects.length),show:s.jsx(kpt,{children:t==null?void 0:t.projects.map(f=>s.jsx("li",{children:s.jsx(kt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s.jsx(jpt,{to:`/projects/${f}`,children:s.jsx(sn,{color:"secondary",icon:s.jsx(i$,{}),children:f})})})},f))}),elseShow:s.jsx(kt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s.jsx(sn,{tabIndex:0,children:"No projects"})})})]})]}),s.jsx(sN,{}),s.jsx(F5,{children:"Date/Time Settings"}),s.jsx(Z,{variant:"body2",children:"This is the format used across the system for time and date"}),s.jsxs(Rpt,{children:[s.jsxs(Ept,{variant:"outlined",size:"small",children:[s.jsx(Tpt,{htmlFor:"locale-select",children:"Date/Time formatting"}),s.jsx($c,{"aria-details":l,id:"locale-select",value:i||"",native:!0,onChange:d,MenuProps:{style:{zIndex:9999}},children:c.map(f=>s.jsx("option",{value:f,children:f},f))})]}),s.jsxs(Z,{id:l,children:["Example:"," ",s.jsx("time",{dateTime:ute,children:QP(_pt,i)})]})]}),p?s.jsxs(s.Fragment,{children:[s.jsx(sN,{}),s.jsx(F5,{children:"Email Settings"}),(t==null?void 0:t.subscriptions)&&s.jsx(vpt,{status:t.subscriptions.includes("productivity-report")?"subscribed":"unsubscribed",onChange:n})]}):null]})]})},Apt=()=>{const{user:e}=Si(),t=Mr(),n=Ot(),{config:r,loading:o}=ete("simple"),{uiConfig:i}=rt(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],l=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:h})=>h&&p.includes(h))||a[0]).id},[u,d]=m.useState(c());return m.useEffect(()=>{d(c())},[t]),o?null:s.jsxs(ldt,{tabs:a,value:u,onChange:l,children:[s.jsx(X,{condition:u==="profile",show:s.jsx(Ppt,{user:e})}),s.jsx(X,{condition:u==="password",show:s.jsx(ddt,{})}),s.jsx(X,{condition:u==="pat",show:s.jsx(Wdt,{})})]})},Ipt=m.lazy(()=>va(()=>import("./FeatureViewLazyExport-yCIrczZt.js").then(e=>e.F),[])),$pt=m.lazy(()=>va(()=>import("./LazyAdminExport-BjSYZTvt.js").then(e=>e.L),[])),Opt=m.lazy(()=>va(()=>import("./LazyProjectExport-9mNkV9Jq.js"),[])),Mpt=()=>{const{isEnterprise:e}=rt(),{data:t,error:n,mutate:r}=Bi(e(),{events:[]},bt("api/admin/logins"),Dpt);return m.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},Dpt=e=>fetch(e).then(Jt("Login History")).then(t=>t.json()),aN=x(J)(()=>({display:"flex",justifyContent:"center"})),Lpt=({row:e,value:t})=>{const{searchQuery:n}=ga();return t?s.jsx(aN,{children:s.jsx(sn,{color:"success",children:"True"})}):s.jsx(aN,{children:s.jsx(hr,{arrow:!0,title:s.jsx(Kr,{search:n,children:e.original.failure_reason}),children:s.jsx(sn,{color:"error",children:"False"})})})},Fpt=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=ar({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 l$={},Npt=Te;Object.defineProperty(l$,"__esModule",{value:!0});var dte=l$.default=void 0,Bpt=Npt(ke()),zpt=s,Hpt=(0,Bpt.default)((0,zpt.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");dte=l$.default=Hpt;const Wpt={id:"created_at",desc:!0},{value:lN,setValue:Vpt}=Au("LoginHistoryTable:v1",Wpt),Upt={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google",github:"GitHub"},Gpt=()=>{const{events:e,loading:t}=Mpt(),{downloadCSV:n}=Fpt(),[r,o]=Xf(),[i]=m.useState(()=>({sortBy:[{id:r.get("sort")||lN.id,desc:r.has("order")?r.get("order")==="desc":lN.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=m.useState(i.globalFilter),c=Xn(pr.breakpoints.down("sm")),u=Xn(pr.breakpoints.down("md")),d=m.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:S,column:j})=>s.jsx(ay,{value:S,column:j,dateFormat:Ja}),maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:_s,searchable:!0},{Header:"Authentication",accessor:S=>Upt[S.auth_type]||S.auth_type,width:150,maxWidth:150,Cell:_s,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:_s,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:Lpt,filterName:"success",filterParsing:S=>S.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:f,getSearchContext:h}=eh(d,a,e),{headerGroups:g,rows:v,prepareRow:b,state:{sortBy:y},setHiddenColumns:w}=Zt.useTable({columns:d,data:p,initialState:i,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:En}},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),m.useEffect(()=>{const S={};S.sort=y[0].id,y[0].desc&&(S.order="desc"),a&&(S.search=a),o(S,{replace:!0}),Vpt({id:y[0].id,desc:y[0].desc||!1})},[y,a,o]),s.jsxs(cr,{isLoading:t,header:s.jsx(Pn,{title:`Login history (${v.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!u,show:s.jsx(xo,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})}),s.jsx(X,{condition:v.length>0,show:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!u,show:s.jsx(Pn.Divider,{})}),s.jsx(kt,{title:"Download login history",arrow:!0,children:s.jsx($t,{onClick:n,children:s.jsx(dte,{})})})]})})]}),children:s.jsx(X,{condition:u,show:s.jsx(xo,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[s.jsx(is,{value:f(a),children:s.jsx(gp,{rows:v,headerGroups:g,prepareRow:b})}),s.jsx(X,{condition:v.length===0,show:s.jsx(X,{condition:(a==null?void 0:a.length)>0,show:s.jsxs($r,{children:["No login events found matching “",a,"”"]}),elseShow:s.jsx($r,{children:"No login events available."})})})]})},qpt=()=>{const{isEnterprise:e}=rt();return e()?s.jsx("div",{children:s.jsx(HI,{permissions:[ts,uC],children:s.jsx(Gpt,{})})}):s.jsx(ym,{feature:"login-history",page:!0})},Ypt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},Kpt=x("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%"})),Xpt=x(Iq)(({theme:e})=>({height:"80px"})),Jpt=x("div")(({theme:e})=>({display:"flex",position:"relative"})),Qpt=x("div")(({theme:e})=>({marginTop:e.spacing(4)})),Zpt=x(Ue)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),c$=({children:e})=>{const t=Ot(),n=()=>{t("/")},r=()=>{t(as)};return s.jsxs(Kpt,{children:[s.jsxs("div",{children:[s.jsx(Xpt,{}),s.jsx(Jpt,{children:s.jsx(Z,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),s.jsxs(Qpt,{children:[s.jsx(Ue,{variant:"contained",color:"primary",onClick:r,children:"Go back"}),s.jsx(Zpt,{onClick:n,children:"Go home"})]})]}),e]})},eft=x(J)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),tft=x(J)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),nft=({featureType:e,loading:t})=>{const n=Ot(),{uiConfig:r}=rt(),{refetch:o}=dm(),{updateFeatureTypeLifetime:i,loading:a}=Ypt(),[l,c]=m.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=m.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:f}=Nt(),h=Kt(),g=S=>{const j=Number.parseInt(Ff(S.target.value),10);c(j),j===0&&d(!0)},v=S=>{d(S.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),y=async S=>{S.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature flag type loaded");const j=u?0:l;await i(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(Tt(j))}},w=m.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 '{
422
+ your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens",documentationLinkLabel:"Personal access tokens documentation",formatApiCode:S,children:s.jsxs(Rdt,{onSubmit:w,children:[s.jsx("div",{children:s.jsx(_dt,{description:u,setDescription:d,isDescriptionUnique:E,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:g,errors:v,setErrors:b})}),s.jsxs(Pdt,{children:[s.jsx(Ue,{type:"submit",variant:"contained",color:"primary",disabled:!C,children:"Create token"}),s.jsx(Adt,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},$dt=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=r$(),{deletePersonalAPIToken:o}=ote(),{setToastData:i,setToastApiError:a}=Nt(),l=async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({text:"Token deleted",type:"success"})}catch(c){a(Tt(c))}};return s.jsx(Gn,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:l,onClose:()=>{t(!1)},title:"Delete token?",children:s.jsxs(Z,{children:['Any applications or scripts using this token "',s.jsx("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},Odt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),Mdt=({open:e,setOpen:t,token:n})=>s.jsxs(Gn,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s.jsx(Odt,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s.jsx(Z,{variant:"body1",children:"Your token:"}),s.jsx(e$,{token:(n==null?void 0:n.secret)||""})]}),Ddt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),Ldt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),Fdt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),Ndt=x(Z)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),Bdt=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),zdt={id:"createdAt",desc:!0},{value:iN,setValue:Hdt}=Au("PersonalAPITokensTable:v1",zdt),Wdt=()=>{const e=qt(),t=Xn(e.breakpoints.down("md")),n=Xn(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=r$(),[i,a]=Xf(),[l]=m.useState(()=>({sortBy:[{id:i.get("sort")||iN.id,desc:i.has("order")?i.get("order")==="desc":iN.desc}],globalFilter:i.get("search")||""})),[c,u]=m.useState(l.globalFilter),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[b,y]=m.useState(),[w,S]=m.useState(),j=m.useMemo(()=>[{Header:"Description",accessor:"description",Cell:_s,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:P})=>new Date(P).getFullYear()>new Date().getFullYear()+100?s.jsx(En,{children:"Never"}):s.jsx(Jd,{value:P}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Jd,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:ay,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:P}})=>s.jsx(Tu,{children:s.jsx(kt,{title:"Delete token",arrow:!0,describeChild:!0,children:s.jsx("span",{children:s.jsx($t,{onClick:()=>{S(P),v(!0)},children:s.jsx(Po,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:E,getSearchText:C,getSearchContext:T}=eh(j,c,r),k=m.useMemo(()=>(E==null?void 0:E.length)===0&&o?Bdt:E,[E,o]),{headerGroups:_,rows:A,prepareRow:O,state:{sortBy:M},setHiddenColumns:H}=Zt.useTable({columns:j,data:k,initialState:l,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],H,j),m.useEffect(()=>{const P={};P.sort=M[0].id,M[0].desc&&(P.order="desc"),c&&(P.search=c),a(P,{replace:!0}),Hdt({id:M[0].id,desc:M[0].desc||!1})},[M,c,a]),s.jsxs(cr,{isLoading:o,header:s.jsx(Pn,{title:`Personal API tokens (${A.length<k.length?`${A.length} of ${k.length}`:k.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!t,show:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:c,onChange:u,getSearchContext:T}),s.jsx(Pn.Divider,{})]})}),s.jsx(Ue,{variant:"contained",color:"primary",disabled:r.length>=rte,onClick:()=>p(!0),children:"New token"})]}),children:s.jsx(X,{condition:t,show:s.jsx(xo,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:T})})}),children:[s.jsx(Ddt,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s.jsx(is,{value:C(c),children:s.jsx(gp,{rows:A,headerGroups:_,prepareRow:O})}),s.jsx(X,{condition:A.length===0,show:s.jsx(X,{condition:(c==null?void 0:c.length)>0,show:s.jsxs($r,{children:["No tokens found matching “",c,"”"]}),elseShow:s.jsxs(Ldt,{children:[s.jsx(Fdt,{children:"You have no personal API tokens yet."}),s.jsx(Ndt,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s.jsx(Ue,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s.jsx(Idt,{open:d,setOpen:p,newToken:P=>{y(P),h(!0)}}),s.jsx(Mdt,{open:f,setOpen:h,token:b}),s.jsx($dt,{open:g,setOpen:v,token:w})]})};var o$={},Vdt=Te;Object.defineProperty(o$,"__esModule",{value:!0});var i$=o$.default=void 0,Udt=Vdt(ke()),Gdt=s,qdt=(0,Udt.default)((0,Gdt.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");i$=o$.default=qdt;const ate=(e,t={})=>{const{isEnterprise:n}=rt(),{data:r,error:o,mutate:i}=Bi(!!e&&n(),void 0,bt(`api/admin/roles/${e}`),Ydt,t);return m.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},Ydt=e=>fetch(e).then(Jt("Role")).then(t=>t.json());var s$={},Kdt=Te;Object.defineProperty(s$,"__esModule",{value:!0});var lte=s$.default=void 0,Xdt=Kdt(ke()),Jdt=s,Qdt=(0,Xdt.default)((0,Jdt.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");lte=s$.default=Qdt;var a$={},Zdt=Te;Object.defineProperty(a$,"__esModule",{value:!0});var cte=a$.default=void 0,ept=Zdt(ke()),tpt=s,npt=(0,ept.default)((0,tpt.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");cte=a$.default=npt;const xf=e=>e.environment?`${e.name}-${e.environment}`:`${e.name}`,ALt=e=>e.reduce((t,n)=>(t[xf(n)]=n,t),{}),ILt=(e,t)=>{const n=py(e);return n[xf(t)]?delete n[xf(t)]:n[xf(t)]={...t},n},$Lt=(e,t)=>{const n=py(e);return t.every(o=>n[xf(o)])?t.forEach(o=>{delete n[xf(o)]}):t.forEach(o=>{n[xf(o)]={...o}}),n},rpt=e=>e.filter(({name:r})=>r!=="ADMIN").reduce((r,o)=>{var l;const i=((l=UIe.find(c=>c.permissions.includes(o.name)))==null?void 0:l.label)||"Other",a=r.find(({label:c})=>c===i);return a?a.permissions.push(o):r.push({label:i,type:"root",permissions:[o]}),r},[]).map(r=>({...r,permissions:[...new Set(r.permissions.sort((o,i)=>o.displayName.localeCompare(i.displayName)))]})).sort(ipt),opt=e=>{const t=e.filter(({type:o})=>o===hdt),n=e.filter(({type:o})=>o===fdt),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const a=i.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(i):o.push({label:a,type:"environment",permissions:[i]}),o},[])),r.map(o=>({...o,permissions:[...new Set(o.permissions.sort((i,a)=>i.displayName.localeCompare(a.displayName)))]}))},OLt=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],ipt=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),spt=x("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})),apt=x("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),lpt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),cpt=x("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),upt=x(cte)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),dpt=x("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),ppt=x("p")(({theme:e})=>({marginTop:e.spacing(.5)})),fpt=x("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),hpt=({roleId:e,tooltip:t,...n})=>{const{role:r}=ate(e.toString());if(!r)return null;const{name:o,description:i,permissions:a,type:l}=r,u=ydt.includes(l)?opt(a):rpt(a);return s.jsxs(spt,{tooltip:t,...n,children:[s.jsxs(cpt,{children:[s.jsx(upt,{color:"disabled"}),o]}),s.jsx(ppt,{children:i}),s.jsx(X,{condition:!vdt.includes(r.type),show:()=>s.jsxs(s.Fragment,{children:[s.jsx(apt,{children:"Role permissions:"}),s.jsx(lpt,{children:u.map(({label:d,permissions:p})=>s.jsxs("div",{children:[s.jsx(dpt,{children:d}),s.jsx(fpt,{children:p.map(f=>s.jsx("li",{children:f.displayName},f.name))})]},d))})]})})]})},gpt=({roleId:e,hideIcon:t,children:n})=>{const{role:r}=ate(e.toString()),o=t?void 0:s.jsx(lte,{});return r?s.jsx(hr,{title:s.jsx(hpt,{roleId:e,tooltip:!0}),arrow:!0,children:s.jsx(sn,{tabIndex:0,color:"success",icon:o,sx:{cursor:"pointer"},children:r.name})}):n?s.jsx(sn,{color:"success",icon:o,children:n}):null},mpt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({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}},vpt=({status:e,onChange:t})=>{const{subscribe:n,unsubscribe:r,loading:o}=mpt(),{setToastData:i,setToastApiError:a}=Nt(),{trackEvent:l}=Kt();return s.jsx(J,{children:s.jsx(qr,{label:"Productivity Email Subscription",control:s.jsx(fa,{onChange:async()=>{try{e==="subscribed"?(await r("productivity-report"),i({text:"Unsubscribed from productivity report",type:"success"}),l("productivity-report",{props:{eventType:"unsubscribe"}})):(await n("productivity-report"),i({text:"Subscribed to productivity report",type:"success"}),l("productivity-report",{props:{eventType:"subscribe"}}))}catch(c){a(Tt(c))}t()},name:"productivity-email",checked:e==="subscribed",disabled:o})})})},ypt=["cs","da-DK","de","en-GB","en-IN","en-US","fr-FR","ja","nb-NO","pt-BR","sv-SE"],xpt=x("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})),bpt=x("div")(()=>({flexGrow:1})),wpt=x(Z)(({theme:e})=>({fontSize:e.spacing(3.75)})),Spt=x(hp)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),F5=x(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),Cpt=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),"& > div > p":{marginBottom:e.spacing(1.5)}})),jpt=x(xt)(({theme:e})=>({":hover,:focus-visible":{outline:"none","> *":{outline:`2px solid ${e.palette.primary.main}`}}})),sN=x("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),Ept=x(Is)(({theme:e})=>({width:e.spacing(30)})),Tpt=x(Su)(({theme:e})=>({backgroundColor:e.palette.background.paper})),kpt=x("ul")(({theme:e})=>({listStyle:"none",padding:0,display:"flex",flexFlow:"row wrap",gap:e.spacing(1)})),ute="2014-09-29T14:50:46",_pt=new Date(ute),Rpt=x("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",flexFlow:"row wrap",gap:e.spacing(1),alignItems:"center"})),Ppt=({user:e})=>{const{profile:t,refetchProfile:n}=AQ(),{locationSettings:r,setLocationSettings:o}=wo(),[i,a]=m.useState(),l=m.useId(),[c,u]=m.useState([...ypt]);m.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=ci("productivityReportEmail");return s.jsxs(s.Fragment,{children:[s.jsxs(xpt,{children:[s.jsx(Spt,{user:e}),s.jsxs(bpt,{children:[s.jsx(wpt,{children:e.name||e.email||e.username}),s.jsx(Z,{variant:"body1",children:e.email})]})]}),s.jsxs(cr,{children:[s.jsx(F5,{children:"Access"}),s.jsxs(Cpt,{children:[s.jsx(J,{sx:{width:"50%"},children:s.jsx(X,{condition:!!(t!=null&&t.rootRole),show:()=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body2",children:"Your root role"}),s.jsx(gpt,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),s.jsxs(J,{children:[s.jsx(Z,{variant:"body2",children:"Projects"}),s.jsx(X,{condition:!!(t!=null&&t.projects.length),show:s.jsx(kpt,{children:t==null?void 0:t.projects.map(f=>s.jsx("li",{children:s.jsx(kt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s.jsx(jpt,{to:`/projects/${f}`,children:s.jsx(sn,{color:"secondary",icon:s.jsx(i$,{}),children:f})})})},f))}),elseShow:s.jsx(kt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s.jsx(sn,{tabIndex:0,children:"No projects"})})})]})]}),s.jsx(sN,{}),s.jsx(F5,{children:"Date/Time Settings"}),s.jsx(Z,{variant:"body2",children:"This is the format used across the system for time and date"}),s.jsxs(Rpt,{children:[s.jsxs(Ept,{variant:"outlined",size:"small",children:[s.jsx(Tpt,{htmlFor:"locale-select",children:"Date/Time formatting"}),s.jsx($c,{"aria-details":l,id:"locale-select",value:i||"",native:!0,onChange:d,MenuProps:{style:{zIndex:9999}},children:c.map(f=>s.jsx("option",{value:f,children:f},f))})]}),s.jsxs(Z,{id:l,children:["Example:"," ",s.jsx("time",{dateTime:ute,children:QP(_pt,i)})]})]}),p?s.jsxs(s.Fragment,{children:[s.jsx(sN,{}),s.jsx(F5,{children:"Email Settings"}),(t==null?void 0:t.subscriptions)&&s.jsx(vpt,{status:t.subscriptions.includes("productivity-report")?"subscribed":"unsubscribed",onChange:n})]}):null]})]})},Apt=()=>{const{user:e}=Si(),t=Mr(),n=Ot(),{config:r,loading:o}=ete("simple"),{uiConfig:i}=rt(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],l=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:h})=>h&&p.includes(h))||a[0]).id},[u,d]=m.useState(c());return m.useEffect(()=>{d(c())},[t]),o?null:s.jsxs(ldt,{tabs:a,value:u,onChange:l,children:[s.jsx(X,{condition:u==="profile",show:s.jsx(Ppt,{user:e})}),s.jsx(X,{condition:u==="password",show:s.jsx(ddt,{})}),s.jsx(X,{condition:u==="pat",show:s.jsx(Wdt,{})})]})},Ipt=m.lazy(()=>va(()=>import("./FeatureViewLazyExport-CgntSCvS.js").then(e=>e.F),[])),$pt=m.lazy(()=>va(()=>import("./LazyAdminExport-CsCsRIwk.js").then(e=>e.L),[])),Opt=m.lazy(()=>va(()=>import("./LazyProjectExport-DkN0UegC.js"),[])),Mpt=()=>{const{isEnterprise:e}=rt(),{data:t,error:n,mutate:r}=Bi(e(),{events:[]},bt("api/admin/logins"),Dpt);return m.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},Dpt=e=>fetch(e).then(Jt("Login History")).then(t=>t.json()),aN=x(J)(()=>({display:"flex",justifyContent:"center"})),Lpt=({row:e,value:t})=>{const{searchQuery:n}=ga();return t?s.jsx(aN,{children:s.jsx(sn,{color:"success",children:"True"})}):s.jsx(aN,{children:s.jsx(hr,{arrow:!0,title:s.jsx(Kr,{search:n,children:e.original.failure_reason}),children:s.jsx(sn,{color:"error",children:"False"})})})},Fpt=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=ar({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 l$={},Npt=Te;Object.defineProperty(l$,"__esModule",{value:!0});var dte=l$.default=void 0,Bpt=Npt(ke()),zpt=s,Hpt=(0,Bpt.default)((0,zpt.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");dte=l$.default=Hpt;const Wpt={id:"created_at",desc:!0},{value:lN,setValue:Vpt}=Au("LoginHistoryTable:v1",Wpt),Upt={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google",github:"GitHub"},Gpt=()=>{const{events:e,loading:t}=Mpt(),{downloadCSV:n}=Fpt(),[r,o]=Xf(),[i]=m.useState(()=>({sortBy:[{id:r.get("sort")||lN.id,desc:r.has("order")?r.get("order")==="desc":lN.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=m.useState(i.globalFilter),c=Xn(pr.breakpoints.down("sm")),u=Xn(pr.breakpoints.down("md")),d=m.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:S,column:j})=>s.jsx(ay,{value:S,column:j,dateFormat:Ja}),maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:_s,searchable:!0},{Header:"Authentication",accessor:S=>Upt[S.auth_type]||S.auth_type,width:150,maxWidth:150,Cell:_s,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:_s,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:Lpt,filterName:"success",filterParsing:S=>S.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:f,getSearchContext:h}=eh(d,a,e),{headerGroups:g,rows:v,prepareRow:b,state:{sortBy:y},setHiddenColumns:w}=Zt.useTable({columns:d,data:p,initialState:i,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:En}},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),m.useEffect(()=>{const S={};S.sort=y[0].id,y[0].desc&&(S.order="desc"),a&&(S.search=a),o(S,{replace:!0}),Vpt({id:y[0].id,desc:y[0].desc||!1})},[y,a,o]),s.jsxs(cr,{isLoading:t,header:s.jsx(Pn,{title:`Login history (${v.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!u,show:s.jsx(xo,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})}),s.jsx(X,{condition:v.length>0,show:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!u,show:s.jsx(Pn.Divider,{})}),s.jsx(kt,{title:"Download login history",arrow:!0,children:s.jsx($t,{onClick:n,children:s.jsx(dte,{})})})]})})]}),children:s.jsx(X,{condition:u,show:s.jsx(xo,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[s.jsx(is,{value:f(a),children:s.jsx(gp,{rows:v,headerGroups:g,prepareRow:b})}),s.jsx(X,{condition:v.length===0,show:s.jsx(X,{condition:(a==null?void 0:a.length)>0,show:s.jsxs($r,{children:["No login events found matching “",a,"”"]}),elseShow:s.jsx($r,{children:"No login events available."})})})]})},qpt=()=>{const{isEnterprise:e}=rt();return e()?s.jsx("div",{children:s.jsx(HI,{permissions:[ts,uC],children:s.jsx(Gpt,{})})}):s.jsx(ym,{feature:"login-history",page:!0})},Ypt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},Kpt=x("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%"})),Xpt=x(Iq)(({theme:e})=>({height:"80px"})),Jpt=x("div")(({theme:e})=>({display:"flex",position:"relative"})),Qpt=x("div")(({theme:e})=>({marginTop:e.spacing(4)})),Zpt=x(Ue)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),c$=({children:e})=>{const t=Ot(),n=()=>{t("/")},r=()=>{t(as)};return s.jsxs(Kpt,{children:[s.jsxs("div",{children:[s.jsx(Xpt,{}),s.jsx(Jpt,{children:s.jsx(Z,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),s.jsxs(Qpt,{children:[s.jsx(Ue,{variant:"contained",color:"primary",onClick:r,children:"Go back"}),s.jsx(Zpt,{onClick:n,children:"Go home"})]})]}),e]})},eft=x(J)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),tft=x(J)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),nft=({featureType:e,loading:t})=>{const n=Ot(),{uiConfig:r}=rt(),{refetch:o}=dm(),{updateFeatureTypeLifetime:i,loading:a}=Ypt(),[l,c]=m.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=m.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:f}=Nt(),h=Kt(),g=S=>{const j=Number.parseInt(Ff(S.target.value),10);c(j),j===0&&d(!0)},v=S=>{d(S.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),y=async S=>{S.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature flag type loaded");const j=u?0:l;await i(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(Tt(j))}},w=m.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 '{
423
423
  "lifetimeDays": ${u?0:l}
424
424
  }'`].join(` \\
425
425
  `),[r,e==null?void 0:e.id,l,u]);return!t&&!e?s.jsx(c$,{children:s.jsx("div",{"data-testid":"404_NOT_FOUND"})}):s.jsx(Fr,{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/reference/feature-toggles#feature-flag-types",documentationLinkLabel:"Feature flag types documentation",formatApiCode:w,children:s.jsxs(tft,{component:"form",onSubmit:y,children:[s.jsxs(Z,{sx:S=>({margin:S.spacing(3,0,1),display:"flex",alignItems:"center"}),children:[s.jsx(J,{component:"label",htmlFor:"feature-flag-lifetime",children:"Expected lifetime"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"If your flag exceeds the expected lifetime of its flag type it will be marked as potentially stale."}),s.jsx("br",{}),s.jsx("a",{href:"https://docs.getunleash.io/reference/feature-toggles#feature-flag-types",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})]})})]}),s.jsxs(J,{component:"label",sx:S=>({display:"flex",alignItems:"center",cursor:"pointer",marginBottom:S.spacing(1),marginRight:"auto"}),htmlFor:"feature-flag-expire",children:[s.jsx(pa,{checked:u||l===0,id:"feature-flag-expire",onChange:v,disabled:t}),s.jsx(J,{children:"doesn't expire"})]}),s.jsx(vr,{autoFocus:!0,disabled:u||t,type:"number",label:"Lifetime in days",id:"feature-flag-lifetime",value:u?"0":`${l}`,onChange:g,error:b}),s.jsxs(eft,{children:[s.jsx(Ro,{permission:ts,variant:"contained",color:"primary",type:"submit",disabled:t||a,children:"Save feature flag type"}),s.jsx(Ue,{type:"button",color:"primary",onClick:()=>n(as),children:"Cancel"})]})]})})},rft=({featureTypes:e,loading:t})=>{const{featureTypeId:n}=P_(),r=e.find(o=>o.id===n);return s.jsx(nft,{featureType:r,loading:t})},oft="/feature-toggle-type",ift=()=>{const{featureTypes:e,loading:t}=dm(),n=Ot(),r=m.useMemo(()=>[{accessor:"id",Cell:({value:d})=>{const p=wC(d);return s.jsx(JC,{icon:s.jsx(p,{"data-loading":"true",color:"action"})})},width:50,disableSortBy:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:d,description:p}}})=>s.jsx(Rl,{"data-loading":!0,title:d,subtitle:p}),sortType:"alphanumeric"},{Header:"Lifetime",accessor:"lifetimeDays",Cell:({value:d})=>d?s.jsx(En,{children:d===1?"1 day":`${d} days`}):s.jsx(En,{children:"doesn't expire"}),minWidth:150,sortType:"numericZeroLast"},{Header:"Actions",Cell:({row:{original:d}})=>s.jsx(J,{sx:p=>({padding:p.spacing(.5,0)}),children:s.jsx(Tu,{children:s.jsx(Wo,{disabled:!d.id,"data-loading":"true",onClick:()=>n(`/feature-toggle-type/edit/${d.id}`),permission:ts,tooltipProps:{title:`Edit ${d.name} feature flag type`},children:s.jsx(ns,{})})})}),disableSortBy:!0}],[n]),o=m.useMemo(()=>t?Array(5).fill({id:"",name:"Loading...",description:"Loading...",lifetimeDays:1}):e,[t,e]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u}=Zt.useTable({columns:r,data:o,sortTypes:yi,autoResetSortBy:!1,disableSortRemove:!0,initialState:{sortBy:[{id:"lifetimeDays"}]}},Zt.useSortBy);return s.jsxs(cr,{isLoading:t,header:s.jsx(Pn,{title:"Feature flag types"}),children:[s.jsxs(ta,{...i(),children:[s.jsx(ea,{headerGroups:l}),s.jsx(Ts,{...a(),children:c.map(d=>{u(d);const{key:p,...f}=d.getRowProps();return s.jsx(Mi,{hover:!0,...f,children:d.cells.map(h=>{const{key:g,...v}=h.getCellProps();return s.jsx(es,{...v,children:h.render("Cell")},g)})},p)})})]}),s.jsx(A_,{children:s.jsx(ff,{path:"edit/:featureTypeId",element:s.jsx(Za,{label:"Edit feature flag type",onClose:()=>n(oft),open:!0,children:s.jsx(rft,{featureTypes:e,loading:t})})})})]})},sft="/static/edge-mode-CxSIDLbZ.svg",aft="/static/edge-offline-C6xyGCqC.svg",lft="/static/edge-daisy-chaining-CATtRukP.svg",cft=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),uft=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3)})),dft=x("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(1)})),N5=x(Z)(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1)})),pft=x("a")({textDecoration:"none","&:hover":{textDecoration:"underline"}}),B5=x("figure")(({theme:e})=>({display:"flex",marginLeft:0,marginRight:0,marginTop:e.spacing(1.5),marginBottom:e.spacing(3),gap:e.spacing(1),flexDirection:"column"})),z5=x("figcaption")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary,textAlign:"center"})),cN={name:"unleash",displayName:"Unleash Edge",description:"Unleash Edge is the successor to the Unleash Proxy.",documentationUrl:"https://docs.getunleash.io/reference/unleash-edge",howTo:`Unleash Edge sits between the Unleash API and your SDKs and provides a cached read-replica of your Unleash instance. This means you can scale up your Unleash instance to thousands of connected SDKs without increasing the number of requests you make to your Unleash instance.
426
426
  Unleash Edge offers two important features:
427
427
  - **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.
428
- - **Resilience:** Unleash Edge is designed to survive restarts and operate properly even if you lose connection to your Unleash server.`},fft=()=>{const{displayName:e,description:t,documentationUrl:n}=cN;return s.jsx(Fr,{title:`${e}`,description:t||"",documentationLink:n,documentationLinkLabel:"Unleash Edge documentation",children:s.jsxs(cft,{children:[s.jsx(j9,{provider:cN,title:"Why would you need Edge?"}),s.jsx(dft,{children:s.jsxs(pft,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash-edge#readme",children:["View Unleash Edge on GitHub"," ",s.jsx(EC,{fontSize:"inherit",sx:{verticalAlign:"middle",marginBottom:"2px"}})]})}),s.jsx(jr,{sx:r=>({marginTop:r.spacing(2),marginBottom:r.spacing(2)})}),s.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"}}),s.jsxs(uft,{children:[s.jsxs("section",{children:[s.jsx(N5,{variant:"h3",children:"Modes"}),s.jsxs(Z,{variant:"body1",children:["Edge currently supports 2 different modes:"," ",s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("a",{href:"https://docs.getunleash.io/reference/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;"]}),s.jsxs("li",{children:[s.jsx("a",{href:"https://docs.getunleash.io/reference/unleash-edge#offline",target:"_blank",rel:"noopener noreferrer",children:"Offline"})," ","– No connection to upstream node. Full control of data and tokens;"]})]})]})]}),s.jsxs("section",{children:[s.jsx(N5,{variant:"h3",children:"Edge"}),s.jsx(Z,{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.'}),s.jsxs(B5,{children:[s.jsx("img",{src:ti(sft),alt:"test"}),s.jsx(z5,{children:"Edge mode"})]}),s.jsx(Z,{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."}),s.jsxs(B5,{children:[s.jsx("img",{src:ti(lft),alt:"test"}),s.jsx(z5,{children:"Edge daisy chaining"})]})]}),s.jsxs("section",{children:[s.jsx(N5,{variant:"h3",children:"Offline"}),s.jsx(Z,{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."}),s.jsxs(B5,{children:[s.jsx("img",{src:ti(aft),alt:"test"}),s.jsx(z5,{children:"Edge offline"})]})]})]})]})})},hft=()=>{const{providerId:e}=P_();return e==="jira"?s.jsx(wVe,{}):e==="edge"?s.jsx(fft,{}):s.jsx(c$,{})},gft=x(xt)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),mft=(e,t)=>{const n=t!==0?", ":"",r=e.project,o=e.project!=="*"?s.jsx(gft,{to:`/projects/${e.project}`,children:e.project},r):s.jsx("span",{children:e.project},r),i=` (${e.environments.join(", ")})`;return[n,o,i]},vft=({usage:e})=>{const t=qt(),n=e==null?void 0:e.flatMap((r,o)=>mft(r,o));return s.jsx(En,{children:s.jsx(X,{condition:e!==void 0&&e.length>0,show:s.jsx(Z,{variant:"body2",children:n}),elseShow:s.jsx(Z,{variant:"body2",color:t.palette.text.secondary,children:"not connected"})})})},yft=25,xft=e=>`api/admin/projects/${e}/applications?`,bft=ZX({applications:[],total:0}),MLt=(e,t)=>bft(e,xft(t)),pte=x("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(9,0,9,0),minHeight:"150px"})),wft=e=>typeof e=="string"&&e.length>0?Sft(e):s.jsxs(pte,{children:["You don't have have any connected applications. To connect your application to Unleash you will require a"," ",s.jsx(kn,{href:"https://docs.getunleash.io/docs/sdks/",children:"Client SDK"}),".",s.jsx("br",{}),"You can read more about how to use Unleash in your application in the"," ",s.jsx(kn,{href:"https://docs.getunleash.io/docs/sdks/",children:"documentation."})]}),Sft=e=>s.jsxs(pte,{children:['No application found matching "',e,'"']}),H5=wK(),Cft=()=>{const e={offset:ho(yg,0),limit:ho(yg,yft),query:Ss,sortBy:ho(Ss,"appName"),sortOrder:ho(Ss,"asc")},[t,n]=nh("applications-table",e),{applications:r,total:o,loading:i}=eJ(OA(I0(e,t),b=>b?`${b}`:void 0)),a=m.useMemo(()=>[H5.accessor("icon",{id:"Icon",header:()=>"",cell:({row:{original:{icon:b}}})=>s.jsx(JC,{icon:s.jsx(IS,{children:s.jsx(Ka,{children:b||"apps"})})}),enableSorting:!1}),H5.accessor("appName",{header:"Name",meta:{width:"50%"},cell:({row:{original:{appName:b,description:y}}})=>s.jsx(Rl,{title:b,to:`/applications/${b}`,subtitle:y})}),H5.accessor("usage",{header:"Project(environment)",meta:{width:"50%"},enableSorting:!1,cell:({row:{original:b}})=>s.jsx(vft,{usage:b.usage})})],[]),l=IK(VX(t,n,{columns:a,data:r})),{offset:c,limit:u,query:d,sortBy:p,sortOrder:f,...h}=t,g=(b="")=>{n({query:b})},v=$l(i);return s.jsx(s.Fragment,{children:s.jsx(cr,{bodyClass:"no-padding",header:s.jsx(Pn,{title:`Applications (${o})`,actions:s.jsx(xo,{initialValue:d||"",onChange:g})}),children:s.jsx("div",{className:s1.fullwidth,children:s.jsx(X,{condition:r.length>0||i,show:s.jsx(is,{value:d||"",children:s.jsx("div",{ref:v,children:s.jsx(NK,{tableInstance:l,totalItems:o})})}),elseShow:wft(d)})})})})},W5=()=>{const e=Mr(),t=Ot();return m.useEffect(()=>{t(`/integrations${e.pathname.replace("/addons","")}`)},[e.pathname,t]),s.jsxs(cr,{children:["Addons where renamed to"," ",s.jsx(xt,{to:"/integrations",children:"/integrations"})]})},fte=e=>{const t=`unleash-userSubmittedFeedback:${e}`,{value:n,setValue:r}=Au(t,!1);return{hasSubmittedFeedback:n,setHasSubmittedFeedback:r}},hte=m.createContext(void 0),gte=()=>{const e=m.useContext(hte);if(!e)throw new Error("useFeedbackContext must be used within a FeedbackProvider");return e},u$=(e,t,n="")=>{const r=gte(),{hasSubmittedFeedback:o}=fte(e);return{...r,hasSubmittedFeedback:o,openFeedback:i=>{r.openFeedback({...i,category:e},t,n)}}};var d$={},jft=Te;Object.defineProperty(d$,"__esModule",{value:!0});var tj=d$.default=void 0,Eft=jft(ke()),uN=s,Tft=(0,Eft.default)([(0,uN.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,uN.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");tj=d$.default=Tft;const kft=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("md")]:{flexDirection:"column",gap:e.spacing(1)}})),_ft=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),Rft=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),[e.breakpoints.down("md")]:{width:"100%"}})),Pft=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-end",gap:e.spacing(1),marginTop:e.spacing(2)})),Aft=({actions:e})=>{const t=ci("showInactiveUsers"),n="Analytics",r=qt(),o=Xn(r.breakpoints.down("md")),{openFeedback:i}=u$("insights","automatic",t?"withInactiveUsers":"withoutInactiveUsers"),a=()=>{i({title:"How easy was it to use insights?",positiveLabel:"What do you like most about insights?",areasForImprovementsLabel:"What should be improved in insights?"})};return s.jsxs(s.Fragment,{children:[s.jsx(Pn,{title:n,titleElement:s.jsx(Z,{variant:"h1",component:"span",sx:l=>({display:"flex",alignItems:"center",gap:l.spacing(1)}),children:n}),actions:s.jsxs(kft,{children:[s.jsx(X,{condition:!o,show:s.jsx(Rft,{children:e})}),s.jsx(_ft,{children:s.jsx(Ue,{startIcon:s.jsx(tj,{}),variant:"outlined",onClick:a,children:"Provide feedback"})})]})}),s.jsx(X,{condition:o,show:s.jsx(Pft,{children:e})})]})},Ift=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),iu=x(Lr)(({theme:e})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,boxShadow:"none",display:"flex",flexWrap:"wrap",[e.breakpoints.up("md")]:{flexDirection:"row",flexWrap:"nowrap"}})),dN=x(J)(({theme:e})=>({padding:e.spacing(3),width:"100%"})),tf=x(J)(({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}`}})),ld=x(J)(({theme:e})=>({position:"relative",minWidth:0,flexGrow:1,margin:"auto 0",padding:e.spacing(3)})),mte=x(Z)(({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})),$ft=x("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),Oft=x("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)})),p$=m.forwardRef(({title:e,children:t,filters:n},r)=>s.jsxs($ft,{ref:r,children:[s.jsxs(Oft,{children:[s.jsx(Z,{variant:"h2",children:e}),n]}),t]})),Mft=m.lazy(()=>va(()=>import("./LifecycleChartComponent-BigwXcU3.js"),[])),f$=(e=1e6,t=2)=>n=>n<e?n.toLocaleString():DQ(n,{precision:t}),Dft=({value:e,threshold:t=1e6,precision:n=2,"data-loading":r})=>{const o=f$(t,n)(e),i=e>t,a=s.jsx("span",{"data-loading":r,"data-testid":Ije,children:o});return s.jsx(X,{condition:i,show:s.jsx(kt,{title:e.toLocaleString(),arrow:!0,children:a}),elseShow:a})},Lft=f$(1e3,2),pN=e=>{if(e<=0)return"No data";if(e<1)return"<1 day";const t=Math.round(e);return t===1?"1 day":`${Lft(t)} days`},V5={categories:{experimental:{flagsOlderThanWeek:0,newFlagsThisWeek:0},permanent:{flagsOlderThanWeek:0,newFlagsThisWeek:0},release:{flagsOlderThanWeek:0,newFlagsThisWeek:0}},medianDaysHistorically:0,medianDaysInCurrentStage:0,totalFlags:0},Fft={lifecycleTrends:{cleanup:V5,develop:V5,production:V5}},Nft=(e,t)=>{const n=bt(`api/admin/insights/lifecycle?projects=${e==null?void 0:e.join(",")}`),{data:r,error:o}=_n(n,Bft,t),i=m.useCallback(()=>{Io(n).catch(console.warn)},[n]);return{data:r||Fft,refetchInsights:i,loading:!o&&!r,error:o}},Bft=e=>fetch(e).then(Jt("Lifecycle Insights data")).then(t=>t.json()),zft=x($A)({padding:0}),h$=({filterNamePrefix:e,state:t,...n})=>{const{projects:r}=Xr(),[o,i]=m.useState([]);return m.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);i(u)},[JSON.stringify(r)]),s.jsx(zft,{...n,state:t,availableFilters:o})},Hft=()=>{const e=qt();return{olderThanWeek:e.palette.charts.A2,newThisWeek:e.palette.charts.A1}},Wft=x("div")(({theme:e})=>({display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(auto-fit, minmax(380px, 1fr))"})),Vft=x("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))"}}})),Uft={develop:"pre-live",production:"live",cleanup:"completed"},Gft=x("h3")(({theme:e})=>({margin:0,fontSize:e.typography.body1.fontSize,fontWeight:"normal",padding:e.spacing(1),marginBottom:e.spacing(3)})),qft=x("span")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",alignItems:"center",gap:e.spacing(2),fontSize:e.typography.h1.fontSize,fontWeight:"bold"})),Yft=x("span")({textTransform:"capitalize"}),Kft=x("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)})),fN=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:e.spacing(.5),fontSize:e.typography.body2.fontSize})),Xft=()=>{var u;const e="lifecycle-",t={[`${e}project`]:wr},[n,r]=nh("insights-lifecycle",t),o="lifecycle-trend-charts",i=((u=n[`${e}project`])==null?void 0:u.values)??[],{data:{lifecycleTrends:a},loading:l}=Nft(i),c=$l(l,`[data-loading="${o}"]`);return s.jsx(p$,{ref:c,title:"Flags lifecycle currently",filters:s.jsx(h$,{state:n,onChange:r,filterNamePrefix:e}),children:s.jsx(Wft,{children:Object.entries(a).map(([d,p])=>s.jsxs(Vft,{children:[s.jsxs(Gft,{children:[s.jsxs(qft,{children:[s.jsx(Dft,{"data-loading":o,value:p.totalFlags??0,threshold:1e3,precision:1}),s.jsx(bA,{"aria-hidden":"true",stage:{name:Uft[d]}})]}),s.jsxs("span",{children:["Flags in ",s.jsx(Yft,{children:d})]})]}),s.jsx("div",{children:s.jsx(Jft,{data:p,stage:d})}),s.jsxs(Kft,{children:[s.jsxs(fN,{children:[s.jsx("dt",{children:"Median time for flags currently in stage"}),s.jsx("dd",{"data-loading":o,children:pN(p.medianDaysInCurrentStage)})]}),s.jsxs(fN,{children:[s.jsx("dt",{children:"Historical median time for flags in stage"}),s.jsx("dd",{"data-loading":o,children:pN(p.medianDaysHistorically)})]})]})]},d))})})},U5=f$(1e3,2),Jft=({stage:e,data:t})=>{const n=Hft(),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},i=`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 s.jsx(Mft,{ariaLabel:i,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?U5(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?U5(l):U5(l+r[c.dataIndex])}}}}}]}})},Qft=x(pa)(({theme:e})=>({marginRight:e.spacing(.4)})),Zft=(e,t,{selected:n})=>{const{key:r,...o}=e;return s.jsxs("li",{...o,children:[s.jsx(Qft,{icon:s.jsx(Cm,{fontSize:"small"}),checkedIcon:s.jsx(jm,{fontSize:"small"}),checked:n}),t.label]},r)},zs={label:"ALL",id:"*"};function eht(e,t){const n=[];return e.forEach((r,o)=>{r===t&&n.push(o)}),n}const DLt=m.forwardRef(({limitTags:e,selectedProjects:t,onChange:n,dataTestId:r,sx:o,disabled:i,...a},l)=>{const{projects:c}=Xr(),u=c.map(({name:h})=>h),d=[zs,...c.map(({name:h,id:g})=>({label:eht(u,h).length>1?`${h} - (${g})`:h,id:g}))],p=t&&(t.length===0||t.length===1&&t[0]==="*"),f=(h,g,v)=>{const b=g;return v==="clear"||b===null?n([zs.id]):Array.isArray(b)?b.length===0?n([zs.id]):b.find(({id:y})=>y===zs.id)!==void 0?n([zs.id]):n(b.map(({id:y})=>y)):b.id===zs.id?n([zs.id]):n([b.id])};return s.jsx(pp,{...a,ref:l,disablePortal:!0,id:"projects",limitTags:e,multiple:!p,options:d,sx:o,renderInput:h=>s.jsx(xn,{...h,label:"Projects"}),renderOption:Zft,getOptionLabel:({label:h})=>h,disableCloseOnSelect:!0,size:"small",disabled:i,value:p?zs:d.filter(({id:h})=>t.includes(h)),onChange:f,"data-testid":r||"PROJECT_SELECT",renderTags:(h,g)=>{const v=h.length;return s.jsxs(s.Fragment,{children:[h.slice(0,e).map((b,y)=>m.createElement(da,{...g({index:y}),size:"small",key:y,label:b.label})),v>e&&` +${v-e}`]})}})}),vte=(e="",t="",n)=>{const r=bt(`api/admin/insights?from=${e}&to=${t}`),{data:o,error:i}=_n(r,tht,n),a=m.useCallback(()=>{Io(r).catch(console.warn)},[r]);return{insights:o||{userTrends:[],flagTrends:[],projectFlagTrends:[],metricsSummaryTrends:[],environmentTypeTrends:[],lifecycleTrends:[],creationArchiveTrends:[]},refetchInsights:a,loading:!i&&!o,error:i}},tht=e=>fetch(e).then(Jt("Executive Dashboard Data")).then(t=>t.json());var g$={},nht=Te;Object.defineProperty(g$,"__esModule",{value:!0});var Us=g$.default=void 0,rht=nht(ke()),oht=s,iht=(0,rht.default)((0,oht.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");Us=g$.default=iht;const su=({title:e,tooltip:t})=>s.jsxs(Z,{variant:"h3",sx:n=>({display:"flex",alignItems:"center",gap:n.spacing(.5)}),children:[e,s.jsx(X,{condition:!!t,show:s.jsx(bo,{htmlTooltip:!0,tooltip:t,children:s.jsx(Us,{})})})]});/*!
428
+ - **Resilience:** Unleash Edge is designed to survive restarts and operate properly even if you lose connection to your Unleash server.`},fft=()=>{const{displayName:e,description:t,documentationUrl:n}=cN;return s.jsx(Fr,{title:`${e}`,description:t||"",documentationLink:n,documentationLinkLabel:"Unleash Edge documentation",children:s.jsxs(cft,{children:[s.jsx(j9,{provider:cN,title:"Why would you need Edge?"}),s.jsx(dft,{children:s.jsxs(pft,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash-edge#readme",children:["View Unleash Edge on GitHub"," ",s.jsx(EC,{fontSize:"inherit",sx:{verticalAlign:"middle",marginBottom:"2px"}})]})}),s.jsx(jr,{sx:r=>({marginTop:r.spacing(2),marginBottom:r.spacing(2)})}),s.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"}}),s.jsxs(uft,{children:[s.jsxs("section",{children:[s.jsx(N5,{variant:"h3",children:"Modes"}),s.jsxs(Z,{variant:"body1",children:["Edge currently supports 2 different modes:"," ",s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("a",{href:"https://docs.getunleash.io/reference/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;"]}),s.jsxs("li",{children:[s.jsx("a",{href:"https://docs.getunleash.io/reference/unleash-edge#offline",target:"_blank",rel:"noopener noreferrer",children:"Offline"})," ","– No connection to upstream node. Full control of data and tokens;"]})]})]})]}),s.jsxs("section",{children:[s.jsx(N5,{variant:"h3",children:"Edge"}),s.jsx(Z,{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.'}),s.jsxs(B5,{children:[s.jsx("img",{src:ti(sft),alt:"test"}),s.jsx(z5,{children:"Edge mode"})]}),s.jsx(Z,{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."}),s.jsxs(B5,{children:[s.jsx("img",{src:ti(lft),alt:"test"}),s.jsx(z5,{children:"Edge daisy chaining"})]})]}),s.jsxs("section",{children:[s.jsx(N5,{variant:"h3",children:"Offline"}),s.jsx(Z,{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."}),s.jsxs(B5,{children:[s.jsx("img",{src:ti(aft),alt:"test"}),s.jsx(z5,{children:"Edge offline"})]})]})]})]})})},hft=()=>{const{providerId:e}=P_();return e==="jira"?s.jsx(wVe,{}):e==="edge"?s.jsx(fft,{}):s.jsx(c$,{})},gft=x(xt)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),mft=(e,t)=>{const n=t!==0?", ":"",r=e.project,o=e.project!=="*"?s.jsx(gft,{to:`/projects/${e.project}`,children:e.project},r):s.jsx("span",{children:e.project},r),i=` (${e.environments.join(", ")})`;return[n,o,i]},vft=({usage:e})=>{const t=qt(),n=e==null?void 0:e.flatMap((r,o)=>mft(r,o));return s.jsx(En,{children:s.jsx(X,{condition:e!==void 0&&e.length>0,show:s.jsx(Z,{variant:"body2",children:n}),elseShow:s.jsx(Z,{variant:"body2",color:t.palette.text.secondary,children:"not connected"})})})},yft=25,xft=e=>`api/admin/projects/${e}/applications?`,bft=ZX({applications:[],total:0}),MLt=(e,t)=>bft(e,xft(t)),pte=x("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(9,0,9,0),minHeight:"150px"})),wft=e=>typeof e=="string"&&e.length>0?Sft(e):s.jsxs(pte,{children:["You don't have have any connected applications. To connect your application to Unleash you will require a"," ",s.jsx(kn,{href:"https://docs.getunleash.io/docs/sdks/",children:"Client SDK"}),".",s.jsx("br",{}),"You can read more about how to use Unleash in your application in the"," ",s.jsx(kn,{href:"https://docs.getunleash.io/docs/sdks/",children:"documentation."})]}),Sft=e=>s.jsxs(pte,{children:['No application found matching "',e,'"']}),H5=wK(),Cft=()=>{const e={offset:ho(yg,0),limit:ho(yg,yft),query:Ss,sortBy:ho(Ss,"appName"),sortOrder:ho(Ss,"asc")},[t,n]=nh("applications-table",e),{applications:r,total:o,loading:i}=eJ(OA(I0(e,t),b=>b?`${b}`:void 0)),a=m.useMemo(()=>[H5.accessor("icon",{id:"Icon",header:()=>"",cell:({row:{original:{icon:b}}})=>s.jsx(JC,{icon:s.jsx(IS,{children:s.jsx(Ka,{children:b||"apps"})})}),enableSorting:!1}),H5.accessor("appName",{header:"Name",meta:{width:"50%"},cell:({row:{original:{appName:b,description:y}}})=>s.jsx(Rl,{title:b,to:`/applications/${b}`,subtitle:y})}),H5.accessor("usage",{header:"Project(environment)",meta:{width:"50%"},enableSorting:!1,cell:({row:{original:b}})=>s.jsx(vft,{usage:b.usage})})],[]),l=IK(VX(t,n,{columns:a,data:r})),{offset:c,limit:u,query:d,sortBy:p,sortOrder:f,...h}=t,g=(b="")=>{n({query:b})},v=$l(i);return s.jsx(s.Fragment,{children:s.jsx(cr,{bodyClass:"no-padding",header:s.jsx(Pn,{title:`Applications (${o})`,actions:s.jsx(xo,{initialValue:d||"",onChange:g})}),children:s.jsx("div",{className:s1.fullwidth,children:s.jsx(X,{condition:r.length>0||i,show:s.jsx(is,{value:d||"",children:s.jsx("div",{ref:v,children:s.jsx(NK,{tableInstance:l,totalItems:o})})}),elseShow:wft(d)})})})})},W5=()=>{const e=Mr(),t=Ot();return m.useEffect(()=>{t(`/integrations${e.pathname.replace("/addons","")}`)},[e.pathname,t]),s.jsxs(cr,{children:["Addons where renamed to"," ",s.jsx(xt,{to:"/integrations",children:"/integrations"})]})},fte=e=>{const t=`unleash-userSubmittedFeedback:${e}`,{value:n,setValue:r}=Au(t,!1);return{hasSubmittedFeedback:n,setHasSubmittedFeedback:r}},hte=m.createContext(void 0),gte=()=>{const e=m.useContext(hte);if(!e)throw new Error("useFeedbackContext must be used within a FeedbackProvider");return e},u$=(e,t,n="")=>{const r=gte(),{hasSubmittedFeedback:o}=fte(e);return{...r,hasSubmittedFeedback:o,openFeedback:i=>{r.openFeedback({...i,category:e},t,n)}}};var d$={},jft=Te;Object.defineProperty(d$,"__esModule",{value:!0});var tj=d$.default=void 0,Eft=jft(ke()),uN=s,Tft=(0,Eft.default)([(0,uN.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,uN.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");tj=d$.default=Tft;const kft=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("md")]:{flexDirection:"column",gap:e.spacing(1)}})),_ft=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),Rft=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),[e.breakpoints.down("md")]:{width:"100%"}})),Pft=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-end",gap:e.spacing(1),marginTop:e.spacing(2)})),Aft=({actions:e})=>{const t=ci("showInactiveUsers"),n="Analytics",r=qt(),o=Xn(r.breakpoints.down("md")),{openFeedback:i}=u$("insights","automatic",t?"withInactiveUsers":"withoutInactiveUsers"),a=()=>{i({title:"How easy was it to use insights?",positiveLabel:"What do you like most about insights?",areasForImprovementsLabel:"What should be improved in insights?"})};return s.jsxs(s.Fragment,{children:[s.jsx(Pn,{title:n,titleElement:s.jsx(Z,{variant:"h1",component:"span",sx:l=>({display:"flex",alignItems:"center",gap:l.spacing(1)}),children:n}),actions:s.jsxs(kft,{children:[s.jsx(X,{condition:!o,show:s.jsx(Rft,{children:e})}),s.jsx(_ft,{children:s.jsx(Ue,{startIcon:s.jsx(tj,{}),variant:"outlined",onClick:a,children:"Provide feedback"})})]})}),s.jsx(X,{condition:o,show:s.jsx(Pft,{children:e})})]})},Ift=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(4)})),iu=x(Lr)(({theme:e})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,boxShadow:"none",display:"flex",flexWrap:"wrap",[e.breakpoints.up("md")]:{flexDirection:"row",flexWrap:"nowrap"}})),dN=x(J)(({theme:e})=>({padding:e.spacing(3),width:"100%"})),tf=x(J)(({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}`}})),ld=x(J)(({theme:e})=>({position:"relative",minWidth:0,flexGrow:1,margin:"auto 0",padding:e.spacing(3)})),mte=x(Z)(({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})),$ft=x("section")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),Oft=x("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)})),p$=m.forwardRef(({title:e,children:t,filters:n},r)=>s.jsxs($ft,{ref:r,children:[s.jsxs(Oft,{children:[s.jsx(Z,{variant:"h2",children:e}),n]}),t]})),Mft=m.lazy(()=>va(()=>import("./LifecycleChartComponent-Dz1wdYkW.js"),[])),f$=(e=1e6,t=2)=>n=>n<e?n.toLocaleString():DQ(n,{precision:t}),Dft=({value:e,threshold:t=1e6,precision:n=2,"data-loading":r})=>{const o=f$(t,n)(e),i=e>t,a=s.jsx("span",{"data-loading":r,"data-testid":Ije,children:o});return s.jsx(X,{condition:i,show:s.jsx(kt,{title:e.toLocaleString(),arrow:!0,children:a}),elseShow:a})},Lft=f$(1e3,2),pN=e=>{if(e<=0)return"No data";if(e<1)return"<1 day";const t=Math.round(e);return t===1?"1 day":`${Lft(t)} days`},V5={categories:{experimental:{flagsOlderThanWeek:0,newFlagsThisWeek:0},permanent:{flagsOlderThanWeek:0,newFlagsThisWeek:0},release:{flagsOlderThanWeek:0,newFlagsThisWeek:0}},medianDaysHistorically:0,medianDaysInCurrentStage:0,totalFlags:0},Fft={lifecycleTrends:{cleanup:V5,develop:V5,production:V5}},Nft=(e,t)=>{const n=bt(`api/admin/insights/lifecycle?projects=${e==null?void 0:e.join(",")}`),{data:r,error:o}=_n(n,Bft,t),i=m.useCallback(()=>{Io(n).catch(console.warn)},[n]);return{data:r||Fft,refetchInsights:i,loading:!o&&!r,error:o}},Bft=e=>fetch(e).then(Jt("Lifecycle Insights data")).then(t=>t.json()),zft=x($A)({padding:0}),h$=({filterNamePrefix:e,state:t,...n})=>{const{projects:r}=Xr(),[o,i]=m.useState([]);return m.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);i(u)},[JSON.stringify(r)]),s.jsx(zft,{...n,state:t,availableFilters:o})},Hft=()=>{const e=qt();return{olderThanWeek:e.palette.charts.A2,newThisWeek:e.palette.charts.A1}},Wft=x("div")(({theme:e})=>({display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(auto-fit, minmax(380px, 1fr))"})),Vft=x("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))"}}})),Uft={develop:"pre-live",production:"live",cleanup:"completed"},Gft=x("h3")(({theme:e})=>({margin:0,fontSize:e.typography.body1.fontSize,fontWeight:"normal",padding:e.spacing(1),marginBottom:e.spacing(3)})),qft=x("span")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",alignItems:"center",gap:e.spacing(2),fontSize:e.typography.h1.fontSize,fontWeight:"bold"})),Yft=x("span")({textTransform:"capitalize"}),Kft=x("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)})),fN=x("div")(({theme:e})=>({display:"flex",flexFlow:"row wrap",gap:e.spacing(.5),fontSize:e.typography.body2.fontSize})),Xft=()=>{var u;const e="lifecycle-",t={[`${e}project`]:wr},[n,r]=nh("insights-lifecycle",t),o="lifecycle-trend-charts",i=((u=n[`${e}project`])==null?void 0:u.values)??[],{data:{lifecycleTrends:a},loading:l}=Nft(i),c=$l(l,`[data-loading="${o}"]`);return s.jsx(p$,{ref:c,title:"Flags lifecycle currently",filters:s.jsx(h$,{state:n,onChange:r,filterNamePrefix:e}),children:s.jsx(Wft,{children:Object.entries(a).map(([d,p])=>s.jsxs(Vft,{children:[s.jsxs(Gft,{children:[s.jsxs(qft,{children:[s.jsx(Dft,{"data-loading":o,value:p.totalFlags??0,threshold:1e3,precision:1}),s.jsx(bA,{"aria-hidden":"true",stage:{name:Uft[d]}})]}),s.jsxs("span",{children:["Flags in ",s.jsx(Yft,{children:d})]})]}),s.jsx("div",{children:s.jsx(Jft,{data:p,stage:d})}),s.jsxs(Kft,{children:[s.jsxs(fN,{children:[s.jsx("dt",{children:"Median time for flags currently in stage"}),s.jsx("dd",{"data-loading":o,children:pN(p.medianDaysInCurrentStage)})]}),s.jsxs(fN,{children:[s.jsx("dt",{children:"Historical median time for flags in stage"}),s.jsx("dd",{"data-loading":o,children:pN(p.medianDaysHistorically)})]})]})]},d))})})},U5=f$(1e3,2),Jft=({stage:e,data:t})=>{const n=Hft(),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},i=`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 s.jsx(Mft,{ariaLabel:i,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?U5(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?U5(l):U5(l+r[c.dataIndex])}}}}}]}})},Qft=x(pa)(({theme:e})=>({marginRight:e.spacing(.4)})),Zft=(e,t,{selected:n})=>{const{key:r,...o}=e;return s.jsxs("li",{...o,children:[s.jsx(Qft,{icon:s.jsx(Cm,{fontSize:"small"}),checkedIcon:s.jsx(jm,{fontSize:"small"}),checked:n}),t.label]},r)},zs={label:"ALL",id:"*"};function eht(e,t){const n=[];return e.forEach((r,o)=>{r===t&&n.push(o)}),n}const DLt=m.forwardRef(({limitTags:e,selectedProjects:t,onChange:n,dataTestId:r,sx:o,disabled:i,...a},l)=>{const{projects:c}=Xr(),u=c.map(({name:h})=>h),d=[zs,...c.map(({name:h,id:g})=>({label:eht(u,h).length>1?`${h} - (${g})`:h,id:g}))],p=t&&(t.length===0||t.length===1&&t[0]==="*"),f=(h,g,v)=>{const b=g;return v==="clear"||b===null?n([zs.id]):Array.isArray(b)?b.length===0?n([zs.id]):b.find(({id:y})=>y===zs.id)!==void 0?n([zs.id]):n(b.map(({id:y})=>y)):b.id===zs.id?n([zs.id]):n([b.id])};return s.jsx(pp,{...a,ref:l,disablePortal:!0,id:"projects",limitTags:e,multiple:!p,options:d,sx:o,renderInput:h=>s.jsx(xn,{...h,label:"Projects"}),renderOption:Zft,getOptionLabel:({label:h})=>h,disableCloseOnSelect:!0,size:"small",disabled:i,value:p?zs:d.filter(({id:h})=>t.includes(h)),onChange:f,"data-testid":r||"PROJECT_SELECT",renderTags:(h,g)=>{const v=h.length;return s.jsxs(s.Fragment,{children:[h.slice(0,e).map((b,y)=>m.createElement(da,{...g({index:y}),size:"small",key:y,label:b.label})),v>e&&` +${v-e}`]})}})}),vte=(e="",t="",n)=>{const r=bt(`api/admin/insights?from=${e}&to=${t}`),{data:o,error:i}=_n(r,tht,n),a=m.useCallback(()=>{Io(r).catch(console.warn)},[r]);return{insights:o||{userTrends:[],flagTrends:[],projectFlagTrends:[],metricsSummaryTrends:[],environmentTypeTrends:[],lifecycleTrends:[],creationArchiveTrends:[]},refetchInsights:a,loading:!i&&!o,error:i}},tht=e=>fetch(e).then(Jt("Executive Dashboard Data")).then(t=>t.json());var g$={},nht=Te;Object.defineProperty(g$,"__esModule",{value:!0});var Us=g$.default=void 0,rht=nht(ke()),oht=s,iht=(0,rht.default)((0,oht.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");Us=g$.default=iht;const su=({title:e,tooltip:t})=>s.jsxs(Z,{variant:"h3",sx:n=>({display:"flex",alignItems:"center",gap:n.spacing(.5)}),children:[e,s.jsx(X,{condition:!!t,show:s.jsx(bo,{htmlTooltip:!0,tooltip:t,children:s.jsx(Us,{})})})]});/*!
429
429
  * Chart.js v3.9.1
430
430
  * https://www.chartjs.org
431
431
  * (c) 2022 Chart.js Contributors
@@ -447,7 +447,7 @@ Unleash Edge offers two important features:
447
447
  * https://www.chartjs.org
448
448
  * (c) 2022 chartjs-adapter-date-fns Contributors
449
449
  * Released under the MIT license
450
- */const M1t={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"};Qte._date.override({_id:"date-fns",formats:function(){return M1t},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=it(e):n==="string"&&(typeof t=="string"?e=uK(e,t,new Date,this.options):e=Ha(e,this.options)),Z0(e)?e.getTime():null},format:function(e,t){return si(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Q0(e,t);case"second":return WY(e,t);case"minute":return zY(e,t);case"hour":return BY(e,t);case"day":return J0(e,t);case"week":return VY(e,t);case"month":return sm(e,t);case"quarter":return HY(e,t);case"year":return VP(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return QS(e,t);case"second":return GY(e,t);case"minute":return M4e(e,t);case"hour":return O4e(e,t);case"day":return V0(e,t);case"week":return F4e(e,t);case"month":return ZS(e,t);case"quarter":return L4e(e,t);case"year":return N4e(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Yke(e);case"minute":return B4e(e);case"hour":return tT(e);case"day":return Yd(e);case"week":return Df(e);case"isoWeek":return Df(e,{weekStartsOn:+n});case"month":return T2(e);case"quarter":return Q4(e);case"year":return k2(e);default:return e}},endOf:function(e,t){switch(t){case"second":return W4e(e);case"minute":return H4e(e);case"hour":return z4e(e);case"day":return E2(e);case"week":return qY(e);case"month":return e0(e);case"quarter":return Z4(e);case"year":return t0(e);default:return e}}});const Sp=m.lazy(()=>va(()=>import("./LineChartComponent-CPcDsiNa.js"),[])),D1t=(e,t)=>n=>{const r=n.chart,{ctx:o,chartArea:i}=r;if(!i)return;const a=o.createLinearGradient(0,i.bottom,0,i.top);return a.addColorStop(0,e),a.addColorStop(1,t),a},yy=D1t("rgba(129, 122, 254, 0)","rgba(129, 122, 254, 0.12)"),Du=({title:e="Not enough data",description:t="Two or more weeks of data are needed to show a chart."})=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body1",component:"h4",sx:n=>({paddingBottom:n.spacing(1)}),children:e}),s.jsx(Z,{variant:"body2",children:t})]}),Cp=e=>{const{fill:t=!1,type:n="constant"}=e||{},r=qt();return m.useMemo(()=>({labels:Array.from({length:15},(o,i)=>i+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?yy:r.palette.primary.light,fill:t}]}),[r,t])},L1t=({flagTrends:e,isLoading:t})=>{const n=qt(),r=!t&&e.length<2,o=Cp({fill:!0,type:"double"}),i=m.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 s.jsx(Sp,{data:r||t?o:i,cover:r?s.jsx(Du,{}):t})},wne=()=>{const{projects:e}=Xr(),n=qt().palette.charts.series,r=m.useMemo(()=>e.sort((i,a)=>i.createdAt&&a.createdAt?new Date(i.createdAt).getTime()-new Date(a.createdAt).getTime():0).map(i=>i.id),[e]);return i=>{const a=r.indexOf(i);return n[a%n.length]}},F1t=e=>e.total?((e.stale+e.potentiallyStale)/e.total*100).toFixed(2):"0",xy=e=>{const t=qt(),n=wne(),{projects:r}=Xr(),o=new Map(r.map(a=>[a.id,a.name]));return m.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])},N1t=({projectFlagTrends:e,isLoading:t})=>{const n=Cp({type:"constant"}),r=xy(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return s.jsx(Sp,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"total",xAxisKey:"date"}},cover:o?s.jsx(Du,{}):t})},B1t=x(Lr)(({theme:e})=>({padding:e.spacing(2)})),z1t=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),iE=({iconChar:e,title:t,color:n})=>s.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[s.jsx(Z,{component:"span",children:e}),s.jsx("strong",{children:t})]}),H1t=({data:e})=>s.jsx(J,{display:"flex",flexDirection:"row",children:e.map(({key:t,value:n})=>s.jsxs("div",{style:{flex:1,flexDirection:"column"},children:[s.jsx("div",{style:{flex:1,textAlign:"center",marginBottom:"4px"},children:s.jsx(Z,{variant:"body1",component:"p",children:t})}),s.jsx("div",{style:{flex:1,textAlign:"center"},children:n})]},t))}),W1t=({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 s.jsx(J,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>s.jsxs(B1t,{elevation:3,children:[s.jsxs(z1t,{children:[s.jsxs(Z,{variant:"body2",component:"span",children:[s.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),s.jsx("strong",{children:r.title})]}),s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsx(iE,{iconChar:"▣ ",title:`Total requests: ${(r.value.totalRequests??0).toLocaleString()}`,color:"info"}),s.jsx(iE,{iconChar:"▲ ",title:`Exposed: ${(r.value.totalYes??0).toLocaleString()}`,color:"success"}),s.jsx(iE,{iconChar:"▼ ",title:`Not exposed: ${(r.value.totalNo??0).toLocaleString()}`,color:"error"}),s.jsx(X,{condition:!!r.value.totalApps&&!!r.value.totalEnvironments&&!!r.value.totalFlags,show:s.jsxs(s.Fragment,{children:[s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsx(H1t,{data:[{key:"Flags",value:r.value.totalFlags},{key:"Environments",value:r.value.totalEnvironments},{key:"Apps",value:r.value.totalApps}]})]})})]},`${r.title}-${o}`)))||null})};function V1t(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 U1t=e=>si(new Date(e),"yyyy-ww"),G1t=(e,t)=>{const n=qt(),r=wne();return m.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:U1t(p)}),d=r(a);return{label:a,data:u,borderColor:d,backgroundColor:d,fill:!1}})}),[n,e,r])},q1t=({metricsSummaryTrends:e,isAggregate:t,allDatapointsSorted:n,isLoading:r})=>{const o=qt(),i=G1t(e,n),a=m.useMemo(()=>!r&&!i.datasets.some(d=>d.data.length>1),[i,r]),l=Cp(),c=m.useMemo(()=>{const d=V1t(Object.values(i.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:yy,fill:!0,order:3}]}},[JSON.stringify(e),o]),u=t?c:i;return s.jsx(Sp,{data:a||r?l:u,TooltipComponent:W1t,overrideOptions:a?{}:{parsing:{yAxisKey:"totalRequests",xAxisKey:"date"}},cover:a?s.jsx(Du,{}):r})},Y1t=x(J)(({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)}}),Sne=({sections:e,size:t})=>s.jsx(J,{sx:n=>({display:"flex",gap:n.spacing(.5)}),children:e.map((n,r)=>n.value?s.jsx(Y1t,{type:n.type,sx:{width:`${n.value}%`},size:t},`${n.type}-${r}`):null)}),K1t=e=>e>=50?"error":e>=25?"warning":"success",X1t=x(Lr)(({theme:e})=>({padding:e.spacing(2)})),kB=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),J1t=e=>e==null?"info":K1t(e),Q1t=({stale:e=0,potentiallyStale:t=0,total:n=0})=>{const r=n-e-t;return s.jsxs(s.Fragment,{children:[s.jsx(Sne,{sections:[{type:"error",value:e/n*100},{type:"warning",value:t/n*100},{type:"success",value:r/n*100}],size:"small"}),s.jsxs(Z,{variant:"body2",component:"p",sx:o=>({marginTop:o.spacing(.5)}),children:[s.jsx(Z,{component:"span",sx:o=>({color:o.palette.error.border}),children:"● "}),"Stale flags: ",e]}),s.jsxs(Z,{variant:"body2",component:"p",children:[s.jsx(Z,{component:"span",sx:o=>({color:o.palette.warning.border}),children:"● "}),"Potentially stale flags: ",t]}),s.jsxs(Z,{variant:"body2",component:"p",children:[s.jsx(Z,{component:"span",sx:o=>({color:o.palette.success.border}),children:"● "}),"Healthy flags: ",r]})]})},Z1t=({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 s.jsx(J,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>s.jsxs(X1t,{elevation:3,children:[s.jsxs(kB,{children:[s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label}),s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:"Technical debt"})]}),s.jsxs(kB,{children:[s.jsxs(Z,{variant:"body2",component:"span",children:[s.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),s.jsx("strong",{children:r.title})]}),s.jsxs(sn,{color:J1t(r.value.technicalDebt),children:[r.value.technicalDebt,"%"]})]})," ",s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsxs(Z,{variant:"body2",component:"p",sx:i=>({marginBottom:i.spacing(.5)}),children:["Total flags: ",r.value.total]}),s.jsx(X,{condition:!!(r.value.stale||r.value.potentiallyStale),show:s.jsx(Q1t,{...r.value})})]},`${r.title}-${o}`)))||null})},e0t=e=>((e.total-e.stale-e.potentiallyStale)/e.total*100).toFixed(2),t0t=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=xy(e),o=qt(),i=Cp(),a=m.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(g=>g.week===f)).reduce((h,g)=>(g&&(h.total+=g.total,h.stale+=g.stale,h.potentiallyStale+=g.potentiallyStale),h.date||(h.date=g==null?void 0:g.date),h),{total:0,stale:0,potentiallyStale:0,week:f})).sort((f,h)=>f.week>h.week?1:-1).map(f=>({health:f.total?e0t(f):void 0,technicalDebt:f.total?F1t(f):void 0,date:f.date,total:f.total,stale:f.stale,potentiallyStale:f.potentiallyStale})),borderColor:o.palette.primary.light,backgroundColor:yy,fill:!0,order:3}]}),[r,o]),l=t?a:r,c=m.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?i:l;return s.jsx(Sp,{data:u,TooltipComponent:Z1t,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?s.jsx(Du,{}):n},t?"aggregate":"project")},n0t=x(Lr)(({theme:e})=>({padding:e.spacing(2)})),r0t=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),o0t=({iconChar:e,title:t,color:n})=>s.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[s.jsx(Z,{component:"span",children:e}),s.jsx("strong",{children:t})]}),i0t=({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 s.jsx(J,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>s.jsxs(n0t,{elevation:3,children:[s.jsxs(r0t,{children:[s.jsxs(Z,{variant:"body2",component:"span",children:[s.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),s.jsx("strong",{children:r.title})]}),s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsx(o0t,{iconChar:"● ",title:`Total updates: ${r.value.totalUpdates}`,color:"info"})]},`${r.title}-${o}`)))||null})},s0t=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,i])=>{const a=n.map(l=>{var u;const c=i.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},a0t=()=>{const e=qt();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]}}},l0t=({environmentTypeTrends:e,isLoading:t})=>{const n=qt(),r=a0t(),o=!t&&(e==null?void 0:e.length)<2,i=Cp({fill:!0,type:"double"}),a=m.useMemo(()=>{const l=s0t(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 s.jsx(Sp,{data:o||t?i:a,overrideOptions:o?{}:{parsing:{yAxisKey:"totalUpdates",xAxisKey:"date"}},TooltipComponent:i0t,cover:o?s.jsx(Du,{}):t})},c0t=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center"})),u0t=x(J)(({theme:e})=>({borderRadius:"50%",width:"200px",height:"200px",border:`10px solid ${e.palette.secondary.border}`,display:"flex",alignItems:"center",justifyContent:"center"})),d0t=x(J)(({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}`}));x(J)(({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"}));x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(.5)}));x(J)(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start"}));x(Z)(({theme:e})=>({marginLeft:"auto",fontSize:e.fontSizes.mainHeader}));x(Ka)(({theme:e})=>({color:e.palette.primary.main,width:"15px",height:"15px",marginRight:e.spacing(.5),fontSize:"15px!important"}));const p0t=x("div")({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}),_B=({count:e,isLoading:t})=>{const n=Eu(),r=Eu();return s.jsxs(s.Fragment,{children:[s.jsx(c0t,{children:s.jsx(u0t,{children:s.jsx(d0t,{"aria-labelledby":n,"aria-describedby":r,children:t?s.jsx(Bc,{children:"Loading total flag count"}):e})})}),s.jsxs(p0t,{children:[s.jsx(Z,{id:n,variant:"body2",children:"Total number of flags"}),s.jsx(bo,{htmlTooltip:!0,tooltipId:r,tooltip:"This includes the four lifecycle stages define, develop, production, and cleanup",children:s.jsx(Us,{})})]})]})},f0t=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20",fill:"none",...e},m.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"})),h0t=x(J)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",height:"100%"})),Lv=x(J)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(.5,2,.5,2)})),g0t=x(Lv)(({theme:e})=>({flex:1,justifyContent:"flex-end",alignItems:"flex-end"})),m0t=x(f0t)(({theme:e})=>({color:e.palette.primary.light,marginRight:e.spacing(1.5)})),$b=x(J)(({theme:e})=>({display:"block",marginLeft:"auto",color:e.palette.primary.main,fontWeight:e.typography.fontWeightBold,fontSize:e.fontSizes.mediumHeader})),pk=x("div")(({theme:e})=>({padding:e.spacing(3),fontSize:e.fontSizes.smallBody})),v0t=x(pk)(({theme:e})=>({flexGrow:1,display:"flex",flexDirection:"column"})),y0t=x("div")(()=>({display:"flex",justifyContent:"space-between",alignItems:"center"})),x0t=x($b)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),b0t=({value:e,technicalDebt:t,healthy:n,stale:r,potentiallyStale:o,title:i})=>s.jsxs(h0t,{children:[s.jsx(y0t,{children:s.jsx(pk,{children:i})}),s.jsx(jr,{}),s.jsx(pk,{children:s.jsxs(Lv,{children:[s.jsx(m0t,{}),"Technical debt",s.jsx(x0t,{children:`${t}%`})]})}),s.jsx(jr,{}),s.jsxs(v0t,{children:[s.jsxs(Lv,{children:["Healthy flags",s.jsx($b,{children:n||0})]}),s.jsxs(Lv,{children:["Stale flags",s.jsx($b,{children:r||0})]}),s.jsxs(Lv,{children:["Potentially stale flags",s.jsx($b,{children:o||0})]}),s.jsx(g0t,{children:s.jsx(kn,{href:"https://docs.getunleash.io/reference/insights#health",target:"_blank",rel:"noreferrer",children:"What affects technical debt?"})})]})]}),eb=(e,t)=>m.useMemo(()=>t.length<1||t[0]===zs.id?e:e.filter(r=>t.includes(r.project)),[e,t]);function w0t(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 tb=e=>m.useMemo(()=>w0t(e),[JSON.stringify(e)]),S0t=e=>!!e&&typeof e.timeToProduction=="number"&&e.timeToProduction!==0,C0t=e=>m.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}),i=n.filter(S0t).map(u=>u.timeToProduction);i.sort((u,d)=>u-d);const a=Math.floor(i.length/2),l=i.length%2===0?(i[a-1]+i[a])/2:i[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]),j0t=e=>m.useMemo(()=>{const t=new Set;return e.forEach(n=>{t.add(n.date)}),Array.from(t).sort()},[e]),Cne=(e,t)=>{const n=j0t(e.metricsSummaryTrends),r=eb(e.projectFlagTrends,t),o=eb(e.lifecycleTrends,t),i=eb(e.creationArchiveTrends,t),a=tb(r),l=eb(e.metricsSummaryTrends,t),c=tb(l),u=C0t(r),d=tb(o),p=tb(i);return m.useMemo(()=>({...e,projectsData:r,groupedProjectsData:a,metricsData:l,groupedMetricsData:c,environmentTypeTrends:e.environmentTypeTrends,summary:u,allMetricsDatapoints:n,lifecycleData:o,groupedLifecycleData:d,groupedCreationArchiveData:p}),[e,t,r,a,l,c,u,o,d,p])},E0t=({lifecycleTrends:e,isAggregate:t,isLoading:n})=>{const r=xy(e),o=qt(),i=Cp(),a=m.useMemo(()=>({datasets:[{label:"Number of new flags",data:Array.from(new Set(r.datasets.flatMap(f=>f.data.map(h=>h.week)))).map(f=>r.datasets.map(h=>h.data.find(g=>g.week===f)).reduce((h,g)=>(g&&(h.newProductionFlags+=g.newProductionFlags),h.date||(h.date=g==null?void 0:g.date),h),{newProductionFlags:0,week:f})).sort((f,h)=>f.week>h.week?1:-1),borderColor:o.palette.primary.light,backgroundColor:yy,fill:!0,order:3}]}),[r,o]),l=t?a:r,c=m.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?i:l;return s.jsx(Sp,{data:u,overrideOptions:c?{}:{parsing:{yAxisKey:"newProductionFlags",xAxisKey:"date"}},cover:c?s.jsx(Du,{}):n},t?"aggregate":"project")};var O$={},T0t=Te;Object.defineProperty(O$,"__esModule",{value:!0});var pj=O$.default=void 0,k0t=T0t(ke()),_0t=s,R0t=(0,k0t.default)((0,_0t.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");pj=O$.default=R0t;const P0t=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((i,a)=>{var l,c,u;return{title:(l=i==null?void 0:i.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)||[]})},A0t=x("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),I0t=x("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.typography.body2.fontSize})),$0t=x("span")(({theme:e})=>({display:"inline-block",minWidth:8,minHeight:8,borderRadius:"50%",marginRight:e.spacing(1)})),fk=16,O0t=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",M0t=(e=0,t)=>t==="left"?e+fk:t==="right"?e-fk:e,jne=({tooltip:e,children:t})=>s.jsx(J,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+fk,left:M0t(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:O0t(e==null?void 0:e.align)}),children:t}),BLt=({tooltip:e})=>s.jsx(jne,{tooltip:e,children:s.jsxs(Lr,{elevation:3,sx:t=>({width:220,padding:t.spacing(1.5,2)}),children:[s.jsx(Z,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),s.jsx(A0t,{children:e==null?void 0:e.body.map(t=>s.jsxs(I0t,{children:[s.jsx($0t,{sx:{backgroundColor:t.color},children:" "}),s.jsx(yo,{lines:2,children:t.title})]},vm(t)))})]})}),Ene=(e,t)=>t===0?"N/A":`${Math.round(e/t*100)}%`,D0t=x(Lr)(({theme:e})=>({padding:e.spacing(1.5),display:"flex",flexFlow:"column",gap:e.spacing(.5)})),L0t=x("dl")(({theme:e})=>({margin:0})),RB=x("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}})),F0t=x("span")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),N0t=({tooltip:e})=>{if(!(e!=null&&e.dataPoints))return null;const t=e.dataPoints[0].raw,n=t.archivedFlags||0,r=t.totalCreatedFlags||0,o=Ene(n,r);return s.jsx(jne,{tooltip:e,children:s.jsxs(D0t,{elevation:3,children:[s.jsxs(Z,{variant:"body2",component:"span",fontWeight:"bold",children:["Ratio ",o]}),s.jsxs(L0t,{children:[s.jsxs(RB,{dataType:"archived",children:[s.jsx("dt",{children:"Flags archived"}),s.jsx("dd",{children:n})]}),s.jsxs(RB,{dataType:"created",children:[s.jsx("dt",{children:"Flags created"}),s.jsx("dd",{children:r})]})]}),s.jsx(F0t,{children:e.title})]})})};var B0t={lessThanXSeconds:{one:{regular:"méně než sekunda",past:"před méně než sekundou",future:"za méně než 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:"sekunda",past:"před sekundou",future:"za 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ž minuta",past:"před méně než minutou",future:"za méně než 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:"minuta",past:"před minutou",future:"za 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ě hodina",past:"přibližně před hodinou",future:"přibližně za 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:"hodina",past:"před hodinou",future:"za 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:"den",past:"před dnem",future:"za 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ě týden",past:"přibližně před týdnem",future:"přibližně za 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:"týden",past:"před týdnem",future:"za 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ě měsíc",past:"přibližně před měsícem",future:"přibližně za 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:"měsíc",past:"před měsícem",future:"za 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ě rok",past:"přibližně před rokem",future:"přibližně za 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:"rok",past:"před rokem",future:"za 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ž rok",past:"před více než rokem",future:"za více než 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 rok",past:"skoro před rokem",future:"skoro za 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ů"}}},z0t=function(t,n,r){var o,i=B0t[t];i.type==="other"?o=i.other:n===1?o=i.one:n>1&&n<5?o=i.few:o=i.many;var a=(r==null?void 0:r.addSuffix)===!0,l=r==null?void 0:r.comparison,c;return a&&l===-1?c=o.past:a&&l===1?c=o.future:c=o.regular,c.replace("{{count}}",String(n))},H0t={full:"EEEE, d. MMMM yyyy",long:"d. MMMM yyyy",medium:"d. M. yyyy",short:"dd.MM.yyyy"},W0t={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},V0t={full:"{{date}} 'v' {{time}}",long:"{{date}} 'v' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},U0t={date:Kn({formats:H0t,defaultWidth:"full"}),time:Kn({formats:W0t,defaultWidth:"full"}),dateTime:Kn({formats:V0t,defaultWidth:"full"})},G0t=["neděli","pondělí","úterý","středu","čtvrtek","pátek","sobotu"],q0t={lastWeek:"'poslední' eeee 've' p",yesterday:"'včera v' p",today:"'dnes v' p",tomorrow:"'zítra v' p",nextWeek:function(t){var n=t.getUTCDay();return"'v "+G0t[n]+" o' p"},other:"P"},Y0t=function(t,n){var r=q0t[t];return typeof r=="function"?r(n):r},K0t={narrow:["př. n. l.","n. l."],abbreviated:["př. n. l.","n. l."],wide:["před naším letopočtem","našeho letopočtu"]},X0t={narrow:["1","2","3","4"],abbreviated:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"],wide:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"]},J0t={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"]},Q0t={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"]},Z0t={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"]},eyt={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"}},tyt={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"}},nyt=function(t,n){var r=Number(t);return r+"."},ryt={ordinalNumber:nyt,era:gn({values:K0t,defaultWidth:"wide"}),quarter:gn({values:X0t,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:J0t,defaultWidth:"wide",formattingValues:Q0t,defaultFormattingWidth:"wide"}),day:gn({values:Z0t,defaultWidth:"wide"}),dayPeriod:gn({values:eyt,defaultWidth:"wide",formattingValues:tyt,defaultFormattingWidth:"wide"})},oyt=/^(\d+)\.?/i,iyt=/\d+/i,syt={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},ayt={any:[/^p[řr]/i,/^(po|n)/i]},lyt={narrow:/^[1234]/i,abbreviated:/^[1234]\. [čc]tvrtlet[íi]/i,wide:/^[1234]\. [čc]tvrtlet[íi]/i},cyt={any:[/1/i,/2/i,/3/i,/4/i]},uyt={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},dyt={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]},pyt={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},fyt={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]},hyt={any:/^dopoledne|dop\.?|odpoledne|odp\.?|p[ůu]lnoc|poledne|r[áa]no|odpoledne|ve[čc]er|(v )?noci?/i},gyt={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}},myt={ordinalNumber:Pu({matchPattern:oyt,parsePattern:iyt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:syt,defaultMatchWidth:"wide",parsePatterns:ayt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:lyt,defaultMatchWidth:"wide",parsePatterns:cyt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:uyt,defaultMatchWidth:"wide",parsePatterns:dyt,defaultParseWidth:"any"}),day:mn({matchPatterns:pyt,defaultMatchWidth:"wide",parsePatterns:fyt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:hyt,defaultMatchWidth:"any",parsePatterns:gyt,defaultParseWidth:"any"})},vyt={code:"cs",formatDistance:z0t,formatLong:U0t,formatRelative:Y0t,localize:ryt,match:myt,options:{weekStartsOn:1,firstWeekContainsDate:4}},yyt={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"}},xyt=function(t,n,r){var o,i=yyt[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+o:o+" siden":o},byt={full:"EEEE 'den' d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd/MM/y"},wyt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Syt={full:"{{date}} 'kl'. {{time}}",long:"{{date}} 'kl'. {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Cyt={date:Kn({formats:byt,defaultWidth:"full"}),time:Kn({formats:wyt,defaultWidth:"full"}),dateTime:Kn({formats:Syt,defaultWidth:"full"})},jyt={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"},Eyt=function(t,n,r,o){return jyt[t]},Tyt={narrow:["fvt","vt"],abbreviated:["f.v.t.","v.t."],wide:["før vesterlandsk tidsregning","vesterlandsk tidsregning"]},kyt={narrow:["1","2","3","4"],abbreviated:["1. kvt.","2. kvt.","3. kvt.","4. kvt."],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},_yt={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"]},Ryt={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"]},Pyt={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"}},Ayt={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"}},Iyt=function(t,n){var r=Number(t);return r+"."},$yt={ordinalNumber:Iyt,era:gn({values:Tyt,defaultWidth:"wide"}),quarter:gn({values:kyt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:_yt,defaultWidth:"wide"}),day:gn({values:Ryt,defaultWidth:"wide"}),dayPeriod:gn({values:Pyt,defaultWidth:"wide",formattingValues:Ayt,defaultFormattingWidth:"wide"})},Oyt=/^(\d+)(\.)?/i,Myt=/\d+/i,Dyt={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},Lyt={any:[/^f/i,/^(v|e)/i]},Fyt={narrow:/^[1234]/i,abbreviated:/^[1234]. kvt\./i,wide:/^[1234]\.? kvartal/i},Nyt={any:[/1/i,/2/i,/3/i,/4/i]},Byt={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},zyt={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]},Hyt={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},Wyt={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]},Vyt={narrow:/^(a|p|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i,any:/^([ap]\.?\s?m\.?|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i},Uyt={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}},Gyt={ordinalNumber:Pu({matchPattern:Oyt,parsePattern:Myt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:Dyt,defaultMatchWidth:"wide",parsePatterns:Lyt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:Fyt,defaultMatchWidth:"wide",parsePatterns:Nyt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:Byt,defaultMatchWidth:"wide",parsePatterns:zyt,defaultParseWidth:"any"}),day:mn({matchPatterns:Hyt,defaultMatchWidth:"wide",parsePatterns:Wyt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:Vyt,defaultMatchWidth:"any",parsePatterns:Uyt,defaultParseWidth:"any"})},qyt={code:"da",formatDistance:xyt,formatLong:Cyt,formatRelative:Eyt,localize:$yt,match:Gyt,options:{weekStartsOn:1,firstWeekContainsDate:4}},PB={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:"halbe Minute",withPreposition:"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"}}},Yyt=function(t,n,r){var o,i=r!=null&&r.addSuffix?PB[t].withPreposition:PB[t].standalone;return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:"vor "+o:o},Kyt={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},Xyt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Jyt={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Qyt={date:Kn({formats:Kyt,defaultWidth:"full"}),time:Kn({formats:Xyt,defaultWidth:"full"}),dateTime:Kn({formats:Jyt,defaultWidth:"full"})},Zyt={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},ext=function(t,n,r,o){return Zyt[t]},txt={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},nxt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},hk={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"]},rxt={narrow:hk.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:hk.wide},oxt={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"]},ixt={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"}},sxt={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"}},axt=function(t){var n=Number(t);return n+"."},lxt={ordinalNumber:axt,era:gn({values:txt,defaultWidth:"wide"}),quarter:gn({values:nxt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:hk,formattingValues:rxt,defaultWidth:"wide"}),day:gn({values:oxt,defaultWidth:"wide"}),dayPeriod:gn({values:ixt,defaultWidth:"wide",formattingValues:sxt,defaultFormattingWidth:"wide"})},cxt=/^(\d+)(\.)?/i,uxt=/\d+/i,dxt={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},pxt={any:[/^v/i,/^n/i]},fxt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},hxt={any:[/1/i,/2/i,/3/i,/4/i]},gxt={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},mxt={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]},vxt={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},yxt={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},xxt={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},bxt={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}},wxt={ordinalNumber:Pu({matchPattern:cxt,parsePattern:uxt,valueCallback:function(t){return parseInt(t)}}),era:mn({matchPatterns:dxt,defaultMatchWidth:"wide",parsePatterns:pxt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:fxt,defaultMatchWidth:"wide",parsePatterns:hxt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:gxt,defaultMatchWidth:"wide",parsePatterns:mxt,defaultParseWidth:"any"}),day:mn({matchPatterns:vxt,defaultMatchWidth:"wide",parsePatterns:yxt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:xxt,defaultMatchWidth:"wide",parsePatterns:bxt,defaultParseWidth:"any"})},Sxt={code:"de",formatDistance:Yyt,formatLong:Qyt,formatRelative:ext,localize:lxt,match:wxt,options:{weekStartsOn:1,firstWeekContainsDate:4}},Cxt={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},jxt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Ext={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Txt={date:Kn({formats:Cxt,defaultWidth:"full"}),time:Kn({formats:jxt,defaultWidth:"full"}),dateTime:Kn({formats:Ext,defaultWidth:"full"})},kxt={code:"en-GB",formatDistance:GP,formatLong:Txt,formatRelative:qP,localize:YP,match:KP,options:{weekStartsOn:1,firstWeekContainsDate:4}},_xt={full:"EEEE, d MMMM yyyy",long:"d MMMM, yyyy",medium:"d MMM, yyyy",short:"dd/MM/yyyy"},Rxt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Pxt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Axt={date:Kn({formats:_xt,defaultWidth:"full"}),time:Kn({formats:Rxt,defaultWidth:"full"}),dateTime:Kn({formats:Pxt,defaultWidth:"full"})},Ixt={code:"en-IN",formatDistance:GP,formatLong:Axt,formatRelative:qP,localize:YP,match:KP,options:{weekStartsOn:1,firstWeekContainsDate:4}},$xt={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"}},Oxt=function(t,n,r){var o,i=$xt[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"dans "+o:"il y a "+o:o},Mxt={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Dxt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Lxt={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Fxt={date:Kn({formats:Mxt,defaultWidth:"full"}),time:Kn({formats:Dxt,defaultWidth:"full"}),dateTime:Kn({formats:Lxt,defaultWidth:"full"})},Nxt={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Bxt=function(t,n,r,o){return Nxt[t]},zxt={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},Hxt={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"]},Wxt={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"]},Vxt={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"]},Uxt={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"}},Gxt=function(t,n){var r=Number(t),o=n==null?void 0:n.unit;if(r===0)return"0";var i=["year","week","hour","minute","second"],a;return r===1?a=o&&i.includes(o)?"ère":"er":a="ème",r+a},qxt={ordinalNumber:Gxt,era:gn({values:zxt,defaultWidth:"wide"}),quarter:gn({values:Hxt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:Wxt,defaultWidth:"wide"}),day:gn({values:Vxt,defaultWidth:"wide"}),dayPeriod:gn({values:Uxt,defaultWidth:"wide"})},Yxt=/^(\d+)(ième|ère|ème|er|e)?/i,Kxt=/\d+/i,Xxt={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},Jxt={any:[/^av/i,/^ap/i]},Qxt={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},Zxt={any:[/1/i,/2/i,/3/i,/4/i]},ebt={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},tbt={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]},nbt={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},rbt={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]},obt={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},ibt={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}},sbt={ordinalNumber:Pu({matchPattern:Yxt,parsePattern:Kxt,valueCallback:function(t){return parseInt(t)}}),era:mn({matchPatterns:Xxt,defaultMatchWidth:"wide",parsePatterns:Jxt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:Qxt,defaultMatchWidth:"wide",parsePatterns:Zxt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:ebt,defaultMatchWidth:"wide",parsePatterns:tbt,defaultParseWidth:"any"}),day:mn({matchPatterns:nbt,defaultMatchWidth:"wide",parsePatterns:rbt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:obt,defaultMatchWidth:"any",parsePatterns:ibt,defaultParseWidth:"any"})},abt={code:"fr",formatDistance:Oxt,formatLong:Fxt,formatRelative:Bxt,localize:qxt,match:sbt,options:{weekStartsOn:1,firstWeekContainsDate:4}},lbt={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}}年近く"}},cbt=function(t,n,r){r=r||{};var o,i=lbt[t];return typeof i=="string"?o=i:n===1?r.addSuffix&&i.oneWithSuffix?o=i.oneWithSuffix:o=i.one:r.addSuffix&&i.otherWithSuffix?o=i.otherWithSuffix.replace("{{count}}",String(n)):o=i.other.replace("{{count}}",String(n)),r.addSuffix?r.comparison&&r.comparison>0?o+"後":o+"前":o},ubt={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},dbt={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},pbt={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},fbt={date:Kn({formats:ubt,defaultWidth:"full"}),time:Kn({formats:dbt,defaultWidth:"full"}),dateTime:Kn({formats:pbt,defaultWidth:"full"})},hbt={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},gbt=function(t,n,r,o){return hbt[t]},mbt={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},vbt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},ybt={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月"]},xbt={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},bbt={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:"深夜"}},wbt={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:"深夜"}},Sbt=function(t,n){var r=Number(t),o=String(n==null?void 0:n.unit);switch(o){case"year":return"".concat(r,"年");case"quarter":return"第".concat(r,"四半期");case"month":return"".concat(r,"月");case"week":return"第".concat(r,"週");case"date":return"".concat(r,"日");case"hour":return"".concat(r,"時");case"minute":return"".concat(r,"分");case"second":return"".concat(r,"秒");default:return"".concat(r)}},Cbt={ordinalNumber:Sbt,era:gn({values:mbt,defaultWidth:"wide"}),quarter:gn({values:vbt,defaultWidth:"wide",argumentCallback:function(t){return Number(t)-1}}),month:gn({values:ybt,defaultWidth:"wide"}),day:gn({values:xbt,defaultWidth:"wide"}),dayPeriod:gn({values:bbt,defaultWidth:"wide",formattingValues:wbt,defaultFormattingWidth:"wide"})},jbt=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,Ebt=/\d+/i,Tbt={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},kbt={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},_bt={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},Rbt={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},Pbt={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},Abt={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},Ibt={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},$bt={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},Obt={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},Mbt={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},Dbt={ordinalNumber:Pu({matchPattern:jbt,parsePattern:Ebt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:Tbt,defaultMatchWidth:"wide",parsePatterns:kbt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:_bt,defaultMatchWidth:"wide",parsePatterns:Rbt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:Pbt,defaultMatchWidth:"wide",parsePatterns:Abt,defaultParseWidth:"any"}),day:mn({matchPatterns:Ibt,defaultMatchWidth:"wide",parsePatterns:$bt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:Obt,defaultMatchWidth:"any",parsePatterns:Mbt,defaultParseWidth:"any"})},Lbt={code:"ja",formatDistance:cbt,formatLong:fbt,formatRelative:gbt,localize:Cbt,match:Dbt,options:{weekStartsOn:0,firstWeekContainsDate:1}},Fbt={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"}},Nbt=function(t,n,r){var o,i=Fbt[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+o:o+" siden":o},Bbt={full:"EEEE d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd.MM.y"},zbt={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Hbt={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Wbt={date:Kn({formats:Bbt,defaultWidth:"full"}),time:Kn({formats:zbt,defaultWidth:"full"}),dateTime:Kn({formats:Hbt,defaultWidth:"full"})},Vbt={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"},Ubt=function(t,n,r,o){return Vbt[t]},Gbt={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["før Kristus","etter Kristus"]},qbt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},Ybt={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"]},Kbt={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"]},Xbt={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"}},Jbt=function(t,n){var r=Number(t);return r+"."},Qbt={ordinalNumber:Jbt,era:gn({values:Gbt,defaultWidth:"wide"}),quarter:gn({values:qbt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:Ybt,defaultWidth:"wide"}),day:gn({values:Kbt,defaultWidth:"wide"}),dayPeriod:gn({values:Xbt,defaultWidth:"wide"})},Zbt=/^(\d+)\.?/i,e2t=/\d+/i,t2t={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},n2t={any:[/^f/i,/^e/i]},r2t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? kvartal/i},o2t={any:[/1/i,/2/i,/3/i,/4/i]},i2t={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},s2t={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]},a2t={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},l2t={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},c2t={narrow:/^(midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten)|[ap])/i,any:/^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten))/i},u2t={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}},d2t={ordinalNumber:Pu({matchPattern:Zbt,parsePattern:e2t,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:t2t,defaultMatchWidth:"wide",parsePatterns:n2t,defaultParseWidth:"any"}),quarter:mn({matchPatterns:r2t,defaultMatchWidth:"wide",parsePatterns:o2t,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:i2t,defaultMatchWidth:"wide",parsePatterns:s2t,defaultParseWidth:"any"}),day:mn({matchPatterns:a2t,defaultMatchWidth:"wide",parsePatterns:l2t,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:c2t,defaultMatchWidth:"any",parsePatterns:u2t,defaultParseWidth:"any"})},p2t={code:"nb",formatDistance:Nbt,formatLong:Wbt,formatRelative:Ubt,localize:Qbt,match:d2t,options:{weekStartsOn:1,firstWeekContainsDate:4}},f2t={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"}},h2t=function(t,n,r){var o,i=f2t[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"em "+o:"há "+o:o},g2t={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},m2t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},v2t={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},y2t={date:Kn({formats:g2t,defaultWidth:"full"}),time:Kn({formats:m2t,defaultWidth:"full"}),dateTime:Kn({formats:v2t,defaultWidth:"full"})},x2t={lastWeek:function(t){var n=t.getUTCDay(),r=n===0||n===6?"último":"última";return"'"+r+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},b2t=function(t,n,r,o){var i=x2t[t];return typeof i=="function"?i(n):i},w2t={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},S2t={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},C2t={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"]},j2t={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"]},E2t={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"}},T2t={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"}},k2t=function(t,n){var r=Number(t);return(n==null?void 0:n.unit)==="week"?r+"ª":r+"º"},_2t={ordinalNumber:k2t,era:gn({values:w2t,defaultWidth:"wide"}),quarter:gn({values:S2t,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:C2t,defaultWidth:"wide"}),day:gn({values:j2t,defaultWidth:"wide"}),dayPeriod:gn({values:E2t,defaultWidth:"wide",formattingValues:T2t,defaultFormattingWidth:"wide"})},R2t=/^(\d+)[ºªo]?/i,P2t=/\d+/i,A2t={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},I2t={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},$2t={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},O2t={any:[/1/i,/2/i,/3/i,/4/i]},M2t={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},D2t={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]},L2t={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},F2t={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]},N2t={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},B2t={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}},z2t={ordinalNumber:Pu({matchPattern:R2t,parsePattern:P2t,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:A2t,defaultMatchWidth:"wide",parsePatterns:I2t,defaultParseWidth:"any"}),quarter:mn({matchPatterns:$2t,defaultMatchWidth:"wide",parsePatterns:O2t,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:M2t,defaultMatchWidth:"wide",parsePatterns:D2t,defaultParseWidth:"any"}),day:mn({matchPatterns:L2t,defaultMatchWidth:"wide",parsePatterns:F2t,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:N2t,defaultMatchWidth:"any",parsePatterns:B2t,defaultParseWidth:"any"})},H2t={code:"pt-BR",formatDistance:h2t,formatLong:y2t,formatRelative:b2t,localize:_2t,match:z2t,options:{weekStartsOn:0,firstWeekContainsDate:1}},W2t={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}} vecka"},xWeeks:{one:"en vecka",other:"{{count}} vecka"},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"}},V2t=["noll","en","två","tre","fyra","fem","sex","sju","åtta","nio","tio","elva","tolv"],U2t=function(t,n,r){var o,i=W2t[t];return typeof i=="string"?o=i:n===1?o=i.one:r&&r.onlyNumeric?o=i.other.replace("{{count}}",String(n)):o=i.other.replace("{{count}}",n<13?V2t[n]:String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+o:o+" sedan":o},G2t={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"y-MM-dd"},q2t={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Y2t={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},K2t={date:Kn({formats:G2t,defaultWidth:"full"}),time:Kn({formats:q2t,defaultWidth:"full"}),dateTime:Kn({formats:Y2t,defaultWidth:"full"})},X2t={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"},J2t=function(t,n,r,o){return X2t[t]},Q2t={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["före Kristus","efter Kristus"]},Z2t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1:a kvartalet","2:a kvartalet","3:e kvartalet","4:e kvartalet"]},ewt={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"]},twt={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"]},nwt={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"}},rwt={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"}},owt=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:case 2:return r+":a"}return r+":e"},iwt={ordinalNumber:owt,era:gn({values:Q2t,defaultWidth:"wide"}),quarter:gn({values:Z2t,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:ewt,defaultWidth:"wide"}),day:gn({values:twt,defaultWidth:"wide"}),dayPeriod:gn({values:nwt,defaultWidth:"wide",formattingValues:rwt,defaultFormattingWidth:"wide"})},swt=/^(\d+)(:a|:e)?/i,awt=/\d+/i,lwt={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},cwt={any:[/^f/i,/^[ev]/i]},uwt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](:a|:e)? kvartalet/i},dwt={any:[/1/i,/2/i,/3/i,/4/i]},pwt={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},fwt={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]},hwt={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},gwt={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},mwt={any:/^([fe]\.?\s?m\.?|midn(att)?|midd(ag)?|(på) (morgonen|eftermiddagen|kvällen|natten))/i},vwt={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}},ywt={ordinalNumber:Pu({matchPattern:swt,parsePattern:awt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:lwt,defaultMatchWidth:"wide",parsePatterns:cwt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:uwt,defaultMatchWidth:"wide",parsePatterns:dwt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:pwt,defaultMatchWidth:"wide",parsePatterns:fwt,defaultParseWidth:"any"}),day:mn({matchPatterns:hwt,defaultMatchWidth:"wide",parsePatterns:gwt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:mwt,defaultMatchWidth:"any",parsePatterns:vwt,defaultParseWidth:"any"})},xwt={code:"sv",formatDistance:U2t,formatLong:K2t,formatRelative:J2t,localize:iwt,match:ywt,options:{weekStartsOn:1,firstWeekContainsDate:4}};const bwt={cs:vyt,"da-DK":qyt,de:Sxt,"en-GB":kxt,"en-IN":Ixt,"en-US":Qf,"fr-FR":abt,ja:Lbt,"nb-NO":p2t,"pt-BR":H2t,"sv-SE":xwt},wwt=e=>bwt[e]??Qf,Swt=.8,Cwt=e=>{var t,n;return e.width/e.scales.x.ticks.length*(((n=(t=e.options.datasets)==null?void 0:t.bar)==null?void 0:n.categoryPercentage)??Swt)},jwt=e=>({id:"customLine",beforeDraw:t=>{var a;const{width:n=Cwt,maxHighlightOpacity:r=.12,bottomOverflow:o=0}=e??{},i=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-i/2,c.top,i,c.bottom-c.top+o];o?(u.roundRect(...p,5),u.fill()):u.fillRect(...p),u.restore()}}}),AB=[{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"}],Ewt={datasets:[{label:"Flags archived",data:AB,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},order:1},{label:"Flags created",data:AB,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},order:2}]},Tne="label";function IB(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Twt(e,t){Object.assign(e.options,t)}function kne(e,t){e.labels=t}function _ne(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Tne;const r=[];e.datasets=t.map(o=>{const i=e.datasets.find(a=>a[n]===o[n]);return!i||!o.data||r.includes(i)?{...o}:(r.push(i),Object.assign(i,o),i)})}function kwt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tne;const n={labels:[],datasets:[]};return kne(n,e.labels),_ne(n,e.datasets,t),n}function _wt(e,t){let{height:n=150,width:r=300,redraw:o=!1,datasetIdKey:i,type:a,data:l,options:c,plugins:u=[],fallbackContent:d,updateMode:p,...f}=e;const h=m.useRef(null),g=m.useRef(),v=()=>{h.current&&(g.current=new Em(h.current,{type:a,data:kwt(l,i),options:c&&{...c},plugins:u}),IB(t,g.current))},b=()=>{IB(t,null),g.current&&(g.current.destroy(),g.current=null)};return m.useEffect(()=>{!o&&g.current&&c&&Twt(g.current,c)},[o,c]),m.useEffect(()=>{!o&&g.current&&kne(g.current.config.data,l.labels)},[o,l.labels]),m.useEffect(()=>{!o&&g.current&&l.datasets&&_ne(g.current.config.data,l.datasets,i)},[o,l.datasets]),m.useEffect(()=>{g.current&&(o?(b(),setTimeout(v)):g.current.update(p))},[o,c,l.labels,l.datasets,p]),m.useEffect(()=>{g.current&&(b(),setTimeout(v))},[a]),m.useEffect(()=>(v(),()=>b()),[]),Je.createElement("canvas",Object.assign({ref:h,role:"img",height:n,width:r},f),d)}const Rwt=m.forwardRef(_wt);function Rne(e,t){return Em.register(t),m.forwardRef((n,r)=>Je.createElement(Rwt,Object.assign({},n,{ref:r,type:e})))}const Pwt=Rne("line",sj),Awt=Rne("bar",ij),Iwt=x("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}})),$wt=x("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),Owt=({children:e})=>s.jsx(Iwt,{children:s.jsx($wt,{children:e})});Em.register(y0,cj,vy,Mu,lj,Tm,vne,gne,o1t);const Mwt=({creationArchiveTrends:e,isLoading:t})=>{const n=xy(e),r=qt(),{locationSettings:o}=wo(),[i,a]=m.useState(null),{notEnoughData:l,aggregateOrProjectData:c}=m.useMemo(()=>{const h=Array.from(new Set(n.datasets.flatMap(y=>y.data.map(w=>w.week)))),g=(y,w)=>(w&&(y.archivedFlags+=w.archivedFlags||0,w.createdFlags&&Object.entries(w.createdFlags).forEach(([S,j])=>{y.totalCreatedFlags+=j})),y.date||(y.date=w==null?void 0:w.date),y),v=y=>({archivedFlags:0,totalCreatedFlags:0,archivePercentage:0,week:y}),b=h.map(y=>n.datasets.map(w=>w.data.find(S=>S.week===y)).reduce(g,v(y))).map(y=>({...y,archivePercentage:y.totalCreatedFlags>0?y.archivedFlags/y.totalCreatedFlags*100:0})).sort((y,w)=>y.week>w.week?1:-1);return{notEnoughData:b.length<2,aggregateOrProjectData:{datasets:[{label:"Flags archived",data:b,backgroundColor:r.palette.charts.A2,borderColor:r.palette.charts.A2,hoverBackgroundColor:r.palette.charts.A2,hoverBorderColor:r.palette.charts.A2,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},order:1},{label:"Flags created",data:b,backgroundColor:r.palette.charts.A1,borderColor:r.palette.charts.A1,hoverBackgroundColor:r.palette.charts.A1,hoverBorderColor:r.palette.charts.A1,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},order:2}]}}},[n,r]),u=l||t,d=l&&!t,p=u?Ewt:c,f=m.useMemo(()=>({responsive:!0,...u?{animation:{duration:0}}:{},interaction:{mode:"index",intersect:!1},datasets:{bar:{borderRadius:4}},plugins:{legend:{position:"bottom",labels:{color:r.palette.text.secondary,usePointStyle:!0,padding:21,boxHeight:8},display:!u},tooltip:{enabled:!1,position:"average",external:P0t(a)}},locale:o.locale,scales:{x:{adapters:{date:{locale:wwt(o.locale)}},type:"time",display:!0,time:{unit:"week",tooltipFormat:"P"},grid:{display:!1},ticks:{source:"data",display:!u}},y:{type:"linear",position:"left",beginAtZero:!0,title:{display:!0,text:"Number of flags"},ticks:{stepSize:1,display:!u}}}}),[r,o,a,u]);return s.jsxs(s.Fragment,{children:[s.jsx(Awt,{data:p,options:f,height:100,width:250,plugins:[jwt({maxHighlightOpacity:.24})]}),s.jsx(N0t,{tooltip:i}),u?s.jsx(Owt,{children:d?s.jsx(Du,{}):t}):null]})};function Dwt(e){if(!e)return 0;let t=0,n=0;return Object.values(e).forEach(r=>{const o=r[0];if(o){t+=o.archivedFlags||0;const i=o.createdFlags?Object.values(o.createdFlags).reduce((a,l)=>a+l,0):0;n+=i}}),Ene(t,n)}const Lwt=x(J)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.spacing(2),padding:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(.5)})),Fwt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between"})),Nwt=x(Z)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(2.5),fontWeight:"bold"})),Bwt=x(Us)(({theme:e})=>({color:e.palette.text.secondary})),zwt=x(xt)(({theme:e})=>({color:e.palette.primary.main,textDecoration:"none","&:hover":{textDecoration:"underline"},fontSize:e.spacing(1.75)})),Hwt=({groupedCreationArchiveData:e,isLoading:t})=>{const n=Dwt(e);return s.jsxs(s.Fragment,{children:[s.jsxs(Lwt,{children:[s.jsxs(Fwt,{children:[s.jsx(Nwt,{children:t?"...":n}),s.jsx(bo,{tooltip:"Ratio of archived flags to created flags",children:s.jsx(Bwt,{})})]}),s.jsx(Z,{variant:"body2",children:"Current ratio"})]}),s.jsxs(mte,{children:[s.jsx(pj,{color:"primary"}),"Do you create more flags than you archive? Or do you have good process for cleaning up?"]}),s.jsx(zwt,{to:"/search?lifecycle=IS:completed",children:"View flags in cleanup stage"})]})},Wwt=()=>{var j,E,C;const e="performance-",t={[`${e}project`]:wr,[`${e}from`]:ho(wr,{values:[si(tC(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[`${e}to`]:ho(wr,{values:[si(new Date,"yyyy-MM-dd")],operator:"IS"})},[n,r]=nh("insights",t,["performance-from","performance-to"]),{insights:o,loading:i}=vte((j=n[`${e}from`])==null?void 0:j.values[0],(E=n[`${e}to`])==null?void 0:E.values[0]),a=((C=n[`${e}project`])==null?void 0:C.values)??[zs.id],l=a[0]===zs.id,{flagTrends:c,summary:u,groupedProjectsData:d,groupedLifecycleData:p,groupedMetricsData:f,allMetricsDatapoints:h,environmentTypeTrends:g,groupedCreationArchiveData:v}=Cne(o,a),{isEnterprise:b}=rt(),y=c[c.length-1],w=(y==null?void 0:y.total)??0,S=ci("lifecycleGraphs");return s.jsxs(p$,{title:"Performance insights",filters:s.jsx(h$,{state:n,onChange:r,filterNamePrefix:e}),children:[S&&b()?s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"New flags in production"}),s.jsxs(mte,{children:[s.jsx(pj,{color:"primary"}),"How often do flags go live in production?"]})]}),s.jsx(ld,{children:s.jsx(E0t,{lifecycleTrends:p,isAggregate:l,isLoading:i})})]}):null,S&&b()?s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"Flags archived vs flags created"}),s.jsx(Hwt,{groupedCreationArchiveData:v,isLoading:i})]}),s.jsx(ld,{children:s.jsx(Mwt,{creationArchiveTrends:v,isLoading:i})})]}):null,l?s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"Flags"}),s.jsx(_B,{count:w,isLoading:i})]}),s.jsx(ld,{children:s.jsx(L1t,{flagTrends:c,isLoading:i})})]}):s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"Flags"}),s.jsx(_B,{count:u.total,isLoading:i})]}),s.jsx(ld,{children:s.jsx(N1t,{projectFlagTrends:d,isLoading:i})})]}),b()?s.jsxs(iu,{children:[s.jsx(tf,{width:350,padding:0,children:s.jsx(b0t,{value:u.averageHealth,technicalDebt:u.technicalDebt,healthy:u.active,stale:u.stale,potentiallyStale:u.potentiallyStale,title:s.jsx(su,{title:"Technical debt",tooltip:"Percentage of flags that are stale or potentially stale."})})}),s.jsx(ld,{children:s.jsx(t0t,{projectFlagTrends:d,isAggregate:l,isLoading:i})})]}):null,b()?s.jsxs(s.Fragment,{children:[s.jsx(iu,{children:s.jsxs(dN,{children:[s.jsx(su,{title:"Flag evaluation metrics",tooltip:"Summary of all flag evaluations reported by SDKs."}),s.jsx(ld,{children:s.jsx(q1t,{metricsSummaryTrends:f,allDatapointsSorted:h,isAggregate:l,isLoading:i})})]})}),s.jsx(iu,{children:s.jsxs(dN,{children:[s.jsx(su,{title:"Updates per environment type",tooltip:"Summary of all configuration updates per environment type."}),s.jsx(l0t,{environmentTypeTrends:g,isLoading:i})]})})]}):null]})},Vwt=({userTrends:e,isLoading:t})=>{const n=ci("showInactiveUsers"),r=qt(),o=!t&&e.length<2,i=Cp({fill:!0,type:"rising"}),a=m.useMemo(()=>({labels:e.map(l=>l.date),datasets:[{label:"Total users",data:e.map(l=>l.total),borderColor:r.palette.primary.light,backgroundColor:yy,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 s.jsx(Sp,{data:o||t?i:a,cover:o?s.jsx(Du,{}):t})},Uwt=({projectFlagTrends:e,isLoading:t})=>{const n=Cp({type:"constant"}),r=xy(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return s.jsx(Sp,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"users",xAxisKey:"date"}},cover:o?s.jsx(Du,{}):t})},Gwt=x(J)(({theme:e})=>({padding:`${e.spacing(1.5)} ${e.spacing(2)}`,borderRadius:`${e.shape.borderRadius}px`,border:`1px solid ${e.palette.divider}`})),qwt=x(J)(({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)})),Ywt=x(J)(()=>({display:"flex",alignItems:"center",width:"100%"})),Kwt=x(J)(()=>({display:"flex",flexDirection:"column"})),Xwt=x(Z)(()=>({marginLeft:"auto",fontWeight:"normal"})),$B=({type:e,count:t,percentage:n})=>s.jsx(Gwt,{children:s.jsxs(Ywt,{children:[s.jsxs(Kwt,{children:[s.jsxs(J,{sx:{display:"flex",alignItems:"center"},children:[s.jsx(qwt,{type:e}),s.jsxs(Z,{variant:"body1",component:"span",children:[e==="active"?"Active":"Inactive"," users"]})]}),s.jsxs(Z,{variant:"body2",children:[n,"%"]})]}),s.jsx(Xwt,{variant:"h2",children:t})]})}),Jwt=x(J)(({theme:e})=>({position:"relative"})),Qwt=x(J)(({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})),Zwt=x(J)(({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})),eSt=x(J)(({theme:e})=>({marginBottom:e.spacing(2.5)})),tSt=x(Z)(({theme:e})=>({color:e.palette.primary.contrastText,fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,margin:0,padding:0})),nSt=x(J)({display:"flex",flexDirection:"column",gap:"12px"}),rSt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(3)})),oSt=x(xt)({fontWeight:"bold",textDecoration:"none",display:"flex",justifyContent:"center"}),iSt=x(J)(()=>({"&:before":{background:"transparent"}})),OB=({count:e,active:t,inactive:n,isLoading:r})=>{const i=ci("showInactiveUsers")&&t!==void 0&&n!==void 0,a=(t||0)/e*100;return s.jsxs(s.Fragment,{children:[s.jsxs(Jwt,{children:[s.jsx(Qwt,{children:s.jsx(tSt,{variant:"h2",children:s.jsx(X,{condition:r!==!0,show:Number.parseInt(`${e}`,10)===e?e:e.toFixed(2),elseShow:s.jsx(iSt,{className:"skeleton",children:" "})})})}),s.jsx(Zwt,{})]}),s.jsx(X,{condition:i,show:s.jsxs(s.Fragment,{children:[s.jsx(eSt,{children:s.jsx(Sne,{sections:[{type:"success",value:a},{type:"warning",value:100-a}]})}),s.jsxs(nSt,{children:[s.jsx($B,{type:"active",percentage:`${a}`,count:`${t}`}),s.jsx($B,{type:"inactive",percentage:`${100-a}`,count:`${n}`})]})]})}),s.jsx(rSt,{children:s.jsxs(oSt,{to:"/admin/users",children:["View users ",s.jsx(n9,{})]})})]})},sSt=()=>{var b,y,w;const e="users-",t={[`${e}project`]:wr,[`${e}from`]:ho(wr,{values:[si(tC(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[`${e}to`]:ho(wr,{values:[si(new Date,"yyyy-MM-dd")],operator:"IS"})},[n,r]=nh("insights-users",t,["users-from","users-to"]),{insights:o,loading:i}=vte((b=n["users-from"])==null?void 0:b.values[0],(y=n["users-to"])==null?void 0:y.values[0]),a=((w=n["users-project"])==null?void 0:w.values)??[zs.id],l=a[0]===zs.id,{summary:c,groupedProjectsData:u,userTrends:d}=Cne(o,a),p=d[d.length-1],f=(p==null?void 0:p.total)??0,h=(p==null?void 0:p.active)??0,g=(p==null?void 0:p.inactive)??0,v=a.length===1;return s.jsx(p$,{title:"User insights",filters:s.jsx(h$,{state:n,onChange:r,filterNamePrefix:e}),children:l?s.jsxs(iu,{children:[s.jsxs(tf,{children:[s.jsx(su,{title:"Total users"}),s.jsx(OB,{count:f,active:h,inactive:g,isLoading:i})]}),s.jsx(ld,{children:s.jsx(Vwt,{userTrends:d,isLoading:i})})]}):s.jsxs(iu,{children:[s.jsxs(tf,{children:[s.jsx(su,{title:v?"Users in project":"Users per project on average",tooltip:v?"Number of users in selected projects.":"Average number of users for selected projects."}),s.jsx(OB,{count:c.averageUsers,isLoading:i})]}),s.jsx(ld,{children:s.jsx(Uwt,{projectFlagTrends:u,isLoading:i})})]})})},aSt=x("div")(({theme:e})=>({paddingTop:e.spacing(2)})),lSt=()=>s.jsxs(aSt,{children:[s.jsx(Aft,{}),s.jsxs(Ift,{children:[s.jsx(Xft,{}),s.jsx(Wwt,{}),s.jsx(sSt,{})]})]}),cSt=m.lazy(()=>va(()=>import("./ImpactMetricsPage-BYcbHNWC.js"),[]).then(e=>({default:e.ImpactMetricsPage}))),gk="api/admin/feedback",uSt=bt(gk),dSt=(e={})=>{const t=()=>fetch(uSt,{method:"GET"}).then(Jt("FeedbackPosted")).then(l=>l.json()),{data:n,error:r}=_n(gk,t,e),[o,i]=m.useState(!r&&!n),a=()=>{Io(gk)};return m.useEffect(()=>{i(!r&&!n)},[n,r]),{feedback:n||[],error:r,loading:o,refetchFeedback:a}};function pSt(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,i)=>{const a=i.category;return o[a]||(o[a]=[]),o[a].push(i),o},{});return Object.entries(r).map(([o,i])=>{const a=i.length,l=i.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 sE=x(Z)(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(1)})),fSt=x("div")(({theme:e})=>({fontSize:e.fontSizes.mediumHeader})),hSt=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexWrap:"wrap",marginBottom:e.spacing(4)})),gSt=x("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)})),mSt=()=>{const{feedback:e}=dSt(),[t,n]=m.useState(""),r=[{Header:"Feature",accessor:"category",minWidth:100,Cell:({row:{original:p}})=>s.jsx(En,{children:p.category}),searchable:!0},{Header:"User Type",accessor:"userType",Cell:({row:{original:p}})=>s.jsx(En,{children:p.userType}),searchable:!0},{Header:"Score",accessor:"difficultyScore",maxWidth:90,Cell:({row:{original:p}})=>s.jsx(En,{children:p.difficultyScore})},{Header:"What do you like most?",accessor:"positive",minWidth:100,Cell:({row:{original:p}})=>s.jsx(En,{children:p.positive}),disableSortBy:!0,searchable:!0},{Header:"What should be improved?",accessor:"areasForImprovement",minWidth:100,Cell:({row:{original:p}})=>s.jsx(En,{children:p.areasForImprovement}),disableSortBy:!0,searchable:!0},{Header:"Date",accessor:"createdAt",Cell:Jd}],{data:o,getSearchText:i}=eh(r,t,e),a=m.useMemo(()=>pSt(o),[o]),{headerGroups:l,rows:c,prepareRow:u}=Zt.useTable({columns:r,data:o,initialState:{sortBy:[{id:"createdAt",desc:!0}]},sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:En}},Zt.useSortBy,Zt.useFlexLayout),d=Xn(pr.breakpoints.down("md"));return s.jsxs(cr,{header:s.jsx(Pn,{title:"Feedback",actions:s.jsx(s.Fragment,{children:s.jsx(X,{condition:!d,show:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:t,onChange:n}),s.jsx(Pn.Divider,{})]})})}),children:s.jsx(X,{condition:d,show:s.jsx(xo,{initialValue:t,onChange:n})})}),children:[s.jsx(sE,{children:"Active experiments"}),s.jsx(hSt,{children:a.length>0?a.map(p=>s.jsxs(gSt,{children:[s.jsxs(J,{children:[s.jsx(sE,{children:p.category}),s.jsxs(J,{children:[p.commentCount," comments"]})]}),s.jsx(fSt,{children:isNaN(Number(p.averageScore))?"N/A":`${p.averageScore}/7`})]},p.category)):s.jsx(J,{sx:{py:2},children:"No feedback data from the last three months"})}),s.jsxs(sE,{children:["All feedback (",c.length,")"]}),s.jsx(is,{value:i(t),children:s.jsx(gp,{rows:c,headerGroups:l,prepareRow:u})})]})};var M$={},vSt=Te;Object.defineProperty(M$,"__esModule",{value:!0});var Pne=M$.default=void 0,ySt=vSt(ke()),xSt=s,bSt=(0,ySt.default)((0,xSt.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");Pne=M$.default=bSt;const wSt=e=>{const t=m.useMemo(()=>({sortBy:[{id:"lastSeen",desc:!0}]}),[]),n=m.useMemo(()=>[{Header:"Instances",accessor:"instanceId",Cell:_s,styles:{width:"45%"}},{Header:"SDK",accessor:"sdkVersion",Cell:_s,styles:{width:"20%"}},{Header:"Last seen",accessor:"lastSeen",Cell:ay,styles:{width:"20%"}},{Header:"IP",accessor:"ip",Cell:_s,styles:{width:"15%"}}],[]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d}=Zt.useTable({columns:n,data:e,initialState:t,sortTypes:yi,autoResetHiddenColumns:!1,disableSortRemove:!0},Zt.useGlobalFilter,Zt.useSortBy);return{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d,columns:n}},SSt=({loading:e,rows:t,getTableProps:n,getTableBodyProps:r,headerGroups:o,prepareRow:i})=>s.jsxs(s.Fragment,{children:[s.jsx(J,{sx:{overflowX:"auto"},children:s.jsxs(cq,{...n(),children:[s.jsx(ea,{headerGroups:o}),s.jsx(Ts,{...r(),children:t.map(a=>{i(a);const{key:l,...c}=a.getRowProps();return s.jsx(Mi,{hover:!0,...c,children:a.cells.map(u=>{const{key:d,...p}=u.getCellProps();return s.jsx(es,{...p,children:u.render("Cell")},d)})},l)})})]})}),s.jsx(X,{condition:t.length===0&&!e,show:s.jsx($r,{children:s.jsx("p",{children:"There's no data for any connected instances to display. Have you configured your clients correctly?"})})})]}),CSt={environments:[],featureCount:0,projects:[],issues:{missingStrategies:[]}},Ane=(e,t={})=>{const n=bt(`api/admin/metrics/applications/${e}/overview`),{data:r,error:o}=_n(n,jSt,t);return{data:r||CSt,error:o,loading:!o&&!r}},jSt=async e=>await(await fetch(e).then(Jt("Application overview"))).json(),ESt=(e,t,n={})=>{const r=bt(`api/admin/metrics/instances/${e}/environment/${t}`),{data:o,error:i}=Bi(!!t,{instances:[]},r,TSt,n);return{data:o||{instances:[]},error:i,loading:!i&&!o}},TSt=async e=>await(await fetch(e).then(Jt("Connected instances"))).json(),kSt=e=>{const{data:t}=Ane(e),n=t.environments.map(i=>i.name).sort(),[r,o]=xce("environment",ho(Ss,n[0]));return m.useEffect(()=>{!r&&n.length>0&&o(n[0])},[JSON.stringify(n)]),{currentEnvironment:r,setCurrentEnvironment:o,environments:n}},_St=()=>{const{trackEvent:e}=Kt();return m.useEffect(()=>{e("sdk-reporting",{props:{eventType:"connected instances opened"}})},[]),()=>{e("sdk-reporting",{props:{eventType:"connected instances environment changed"}})}},RSt=()=>{const e=_St(),t=Or("name"),{currentEnvironment:n,setCurrentEnvironment:r,environments:o}=kSt(t),{data:i,loading:a}=ESt(t,n),l=m.useMemo(()=>{const h=({instanceId:g,sdkVersion:v,clientIp:b,lastSeen:y})=>({instanceId:g,ip:b||"",sdkVersion:v||"",lastSeen:y||""});return n?i.instances.map(h):[]},[JSON.stringify(i),n]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f}=wSt(l);return s.jsxs(J,{children:[s.jsxs(J,{sx:{mb:3},children:[s.jsx(J,{sx:{mb:2},children:"Select which environment to display data for. Only environments that have received traffic for this application will be shown here."}),s.jsx(X,{condition:!!n,show:s.jsx(dSe,{color:"primary",value:n,exclusive:!0,onChange:(h,g)=>{g!==null&&(e(),r(g))},children:o.map(h=>s.jsx(iSe,{value:h,children:h},h))})})]}),s.jsx(SSt,{loading:a,headerGroups:d,prepareRow:f,getTableBodyProps:u,getTableProps:c,rows:p})]})},PSt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),o="api/admin/metrics/applications";return{storeApplicationMetaData:async(l,c,u)=>{const d={};d[c]=u;const p=`${o}/${l}`,f=t(p,{method:"POST",body:JSON.stringify(d)});return e(f.caller,f.id)},deleteApplication:async l=>{const c=`${o}/${encodeURIComponent(l)}`,u=t(c,{method:"DELETE"});return e(u.caller,u.id)},errors:n,loading:r}},ASt=(e,t={})=>{const n=bt(`api/admin/metrics/applications/${e}`),r=async()=>fetch(n,{method:"GET"}).then(Jt("Application")).then(d=>d.json()),o=`api/admin/metrics/applications/${e}`,{data:i,error:a}=_n(o,r,{...t}),[l,c]=m.useState(!a&&!i),u=()=>{Io(o)};return m.useEffect(()=>{c(!a&&!i)},[i,a]),{application:i||{appName:e,color:"",createdAt:"2022-02-02T21:04:00.268Z",description:"",instances:[],strategies:[],seenToggles:[],url:""},error:a,loading:l,refetchApplication:u,APPLICATION_CACHE_KEY:o}};var D$={},ISt=Te;Object.defineProperty(D$,"__esModule",{value:!0});var L$=D$.default=void 0,$St=ISt(ke()),OSt=s,MSt=(0,$St.default)((0,OSt.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");L$=D$.default=MSt;const DSt=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",alignSelf:"stretch",fontSize:e.fontSizes.smallBody})),LSt=x(J)(({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})),FSt=x(J)(({theme:e})=>({color:e.palette.warning.dark,fontWeight:e.fontWeight.bold})),F$=x("ul")(({theme:e})=>({padding:e.spacing(0,0,0,2)})),N$=x("li")(({theme:e})=>({fontWeight:e.fontWeight.bold})),NSt=x(J)(({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}`})),B$=x(J)(({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}`})),z$=x(J)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1.5),alignItems:"center"})),Ine=x(xt)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"underline"})),BSt=({features:e})=>{const{hasAccess:t}=m.useContext($o),n=e.length;return n===0?null:s.jsxs(B$,{children:[s.jsx(J,{children:`We detected ${n} feature flag${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),s.jsx(F$,{children:e.map(r=>s.jsxs(z$,{children:[s.jsx(N$,{children:r}),s.jsx(X,{condition:t(N2),show:s.jsx(Ine,{to:`/projects/default?create=true&name=${r}`,children:"Create feature flag"},r)})]},r))})]})},zSt=({strategies:e})=>{const{hasAccess:t}=m.useContext($o),n=e.length;return n===0?null:s.jsxs(B$,{children:[s.jsx(J,{children:`We detected ${n} strategy type${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),s.jsx(F$,{children:e.map(r=>s.jsxs(z$,{children:[s.jsx(N$,{children:r}),s.jsx(X,{condition:t(B2),show:s.jsx(Ine,{to:"/strategies/create",children:"Create strategy type"},r)})]},r))})]})},HSt=({sdks:e})=>e.length===0?null:s.jsxs(B$,{children:[s.jsx(J,{children:"We detected the following outdated SDKs"}),s.jsx(F$,{children:e.map(t=>s.jsx(z$,{children:s.jsx(N$,{children:t})},t))})]}),$ne=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"}},WSt=({application:e})=>{const t=$ne(e);if(t.applicationMode==="success")return null;const{issueCount:n,outdatedSdks:r,missingFeatures:o}=t;return s.jsxs(DSt,{children:[s.jsxs(LSt,{children:[s.jsx(L$,{}),s.jsxs(FSt,{children:["We detected ",n," issue",n!==1?"s":""," in this application"]})]}),s.jsxs(NSt,{children:[s.jsx(HSt,{sdks:r}),s.jsx(BSt,{features:o}),s.jsx(zSt,{strategies:e.issues.missingStrategies})]})]})};var One={exports:{}};(function(e,t){(function(n,r){e.exports=r(m)})(typeof self<"u"?self:Cn,function(n){return function(r){var o={};function i(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,i),l.l=!0,l.exports}return i.m=r,i.c=o,i.d=function(a,l,c){i.o(a,l)||Object.defineProperty(a,l,{enumerable:!0,get:c})},i.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},i.t=function(a,l){if(1&l&&(a=i(a)),8&l||4&l&&typeof a=="object"&&a&&a.__esModule)return a;var c=Object.create(null);if(i.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:a}),2&l&&typeof a!="string")for(var u in a)i.d(c,u,(function(d){return a[d]}).bind(null,u));return c},i.n=function(a){var l=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(l,"a",l),l},i.o=function(a,l){return Object.prototype.hasOwnProperty.call(a,l)},i.p="lib/",i(i.s=5)}([function(r,o){r.exports=n},function(r,o,i){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(i(0));o.ArcherContainerContext=l.default.createContext(null),o.ArcherContainerContextProvider=o.ArcherContainerContext.Provider},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.encodeId=void 0,o.encodeId=function(a){return encodeURI(a).replace(/%/g,"_")}},function(r,o,i){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,i){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,i){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=i(6);Object.defineProperty(o,"ArcherElement",{enumerable:!0,get:function(){return a(l).default}});var c=i(11);Object.defineProperty(o,"ArcherContainer",{enumerable:!0,get:function(){return a(c).default}})},function(r,o,i){var a=this&&this.__createBinding||(Object.create?function(v,b,y,w){w===void 0&&(w=y);var S=Object.getOwnPropertyDescriptor(b,y);S&&("get"in S?b.__esModule:!S.writable&&!S.configurable)||(S={enumerable:!0,get:function(){return b[y]}}),Object.defineProperty(v,w,S)}:function(v,b,y,w){w===void 0&&(w=y),v[w]=b[y]}),l=this&&this.__setModuleDefault||(Object.create?function(v,b){Object.defineProperty(v,"default",{enumerable:!0,value:b})}:function(v,b){v.default=b}),c=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var b={};if(v!=null)for(var y in v)y!=="default"&&Object.prototype.hasOwnProperty.call(v,y)&&a(b,v,y);return l(b,v),b};Object.defineProperty(o,"__esModule",{value:!0});var u=c(i(0)),d=i(7),p=i(1),f=i(2),h=i(8),g=i(10);o.default=function(v){var b=v.id,y=v.relations,w=y===void 0?[]:y,S=v.children,j=(0,u.useMemo)(function(){return(0,f.encodeId)(b)},[b]),E=(0,u.useContext)(p.ArcherContainerContext),C=(0,u.useRef)(),T=(0,u.useCallback)(function(M){var H=(0,g.generateSourceToTarget)(j,M);(0,g.assertContextExists)(E),E.registerTransitions(j,H)},[E,j]),k=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterTransitions(j)},[E,j]),_=(0,u.useCallback)(function(M){M&&((0,g.assertContextExists)(E),E.registerChild(j,M))},[j,E]),A=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterChild(j)},[E,j]);(0,d.useIsomorphicLayoutEffect)(function(){return _(C.current),function(){return A()}},[_,A]),(0,h.useDeepCompareEffect)(function(){return T(w),function(){return k()}},[T,w,k]),u.default.Children.only(S);var O=S;return u.default.cloneElement(O,Object.assign(Object.assign({},O.props),{ref:C}))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.useIsomorphicLayoutEffect=void 0;var a=i(0);o.useIsomorphicLayoutEffect=typeof window<"u"?a.useLayoutEffect:a.useEffect},function(r,o,i){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=i(0),c=a(i(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,i){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,g){if(h===g)return!0;if(h&&g&&typeof h=="object"&&typeof g=="object"){var v,b,y,w=a(h),S=a(g);if(w&&S){if((b=h.length)!=g.length)return!1;for(v=b;v--!=0;)if(!f(h[v],g[v]))return!1;return!0}if(w!=S)return!1;var j=h instanceof Date,E=g instanceof Date;if(j!=E)return!1;if(j&&E)return h.getTime()==g.getTime();var C=h instanceof RegExp,T=g instanceof RegExp;if(C!=T)return!1;if(C&&T)return h.toString()==g.toString();var k=l(h);if((b=k.length)!==l(g).length)return!1;for(v=b;v--!=0;)if(!c.call(g,k[v]))return!1;if(u&&h instanceof Element&&g instanceof Element)return h===g;for(v=b;v--!=0;)if(!((y=k[v])==="_owner"&&h.$$typeof||f(h[y],g[y])))return!1;return!0}return h!=h&&g!=g}(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,i){Object.defineProperty(o,"__esModule",{value:!0}),o.generateSourceToTarget=o.assertContextExists=void 0;var a=i(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,g=u.className,v=u.style,b=u.order,y=b===void 0?0:b,w=u.domAttributes,S=u.cursor,j=u.hitSlop;return{source:{id:(0,a.encodeId)(l),anchor:p},target:{id:(0,a.encodeId)(d),anchor:f},className:g,label:h,style:v,order:y,domAttributes:w,cursor:S,hitSlop:j}})}},function(r,o,i){function a(C,T,k){return T in C?Object.defineProperty(C,T,{value:k,enumerable:!0,configurable:!0,writable:!0}):C[T]=k,C}function l(C,T){return function(k){if(Array.isArray(k))return k}(C)||function(k,_){var A=k==null?null:typeof Symbol<"u"&&k[Symbol.iterator]||k["@@iterator"];if(A!=null){var O,M,H=[],P=!0,$=!1;try{for(A=A.call(k);!(P=(O=A.next()).done)&&(H.push(O.value),!_||H.length!==_);P=!0);}catch(D){$=!0,M=D}finally{try{P||A.return==null||A.return()}finally{if($)throw M}}return H}}(C,T)||function(k,_){if(k){if(typeof k=="string")return c(k,_);var A=Object.prototype.toString.call(k).slice(8,-1);if(A==="Object"&&k.constructor&&(A=k.constructor.name),A==="Map"||A==="Set")return Array.from(k);if(A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return c(k,_)}}(C,T)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
450
+ */const M1t={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"};Qte._date.override({_id:"date-fns",formats:function(){return M1t},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=it(e):n==="string"&&(typeof t=="string"?e=uK(e,t,new Date,this.options):e=Ha(e,this.options)),Z0(e)?e.getTime():null},format:function(e,t){return si(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Q0(e,t);case"second":return WY(e,t);case"minute":return zY(e,t);case"hour":return BY(e,t);case"day":return J0(e,t);case"week":return VY(e,t);case"month":return sm(e,t);case"quarter":return HY(e,t);case"year":return VP(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return QS(e,t);case"second":return GY(e,t);case"minute":return M4e(e,t);case"hour":return O4e(e,t);case"day":return V0(e,t);case"week":return F4e(e,t);case"month":return ZS(e,t);case"quarter":return L4e(e,t);case"year":return N4e(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Yke(e);case"minute":return B4e(e);case"hour":return tT(e);case"day":return Yd(e);case"week":return Df(e);case"isoWeek":return Df(e,{weekStartsOn:+n});case"month":return T2(e);case"quarter":return Q4(e);case"year":return k2(e);default:return e}},endOf:function(e,t){switch(t){case"second":return W4e(e);case"minute":return H4e(e);case"hour":return z4e(e);case"day":return E2(e);case"week":return qY(e);case"month":return e0(e);case"quarter":return Z4(e);case"year":return t0(e);default:return e}}});const Sp=m.lazy(()=>va(()=>import("./LineChartComponent-DG1LdcL_.js"),[])),D1t=(e,t)=>n=>{const r=n.chart,{ctx:o,chartArea:i}=r;if(!i)return;const a=o.createLinearGradient(0,i.bottom,0,i.top);return a.addColorStop(0,e),a.addColorStop(1,t),a},yy=D1t("rgba(129, 122, 254, 0)","rgba(129, 122, 254, 0.12)"),Du=({title:e="Not enough data",description:t="Two or more weeks of data are needed to show a chart."})=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body1",component:"h4",sx:n=>({paddingBottom:n.spacing(1)}),children:e}),s.jsx(Z,{variant:"body2",children:t})]}),Cp=e=>{const{fill:t=!1,type:n="constant"}=e||{},r=qt();return m.useMemo(()=>({labels:Array.from({length:15},(o,i)=>i+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?yy:r.palette.primary.light,fill:t}]}),[r,t])},L1t=({flagTrends:e,isLoading:t})=>{const n=qt(),r=!t&&e.length<2,o=Cp({fill:!0,type:"double"}),i=m.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 s.jsx(Sp,{data:r||t?o:i,cover:r?s.jsx(Du,{}):t})},wne=()=>{const{projects:e}=Xr(),n=qt().palette.charts.series,r=m.useMemo(()=>e.sort((i,a)=>i.createdAt&&a.createdAt?new Date(i.createdAt).getTime()-new Date(a.createdAt).getTime():0).map(i=>i.id),[e]);return i=>{const a=r.indexOf(i);return n[a%n.length]}},F1t=e=>e.total?((e.stale+e.potentiallyStale)/e.total*100).toFixed(2):"0",xy=e=>{const t=qt(),n=wne(),{projects:r}=Xr(),o=new Map(r.map(a=>[a.id,a.name]));return m.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])},N1t=({projectFlagTrends:e,isLoading:t})=>{const n=Cp({type:"constant"}),r=xy(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return s.jsx(Sp,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"total",xAxisKey:"date"}},cover:o?s.jsx(Du,{}):t})},B1t=x(Lr)(({theme:e})=>({padding:e.spacing(2)})),z1t=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),iE=({iconChar:e,title:t,color:n})=>s.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[s.jsx(Z,{component:"span",children:e}),s.jsx("strong",{children:t})]}),H1t=({data:e})=>s.jsx(J,{display:"flex",flexDirection:"row",children:e.map(({key:t,value:n})=>s.jsxs("div",{style:{flex:1,flexDirection:"column"},children:[s.jsx("div",{style:{flex:1,textAlign:"center",marginBottom:"4px"},children:s.jsx(Z,{variant:"body1",component:"p",children:t})}),s.jsx("div",{style:{flex:1,textAlign:"center"},children:n})]},t))}),W1t=({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 s.jsx(J,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>s.jsxs(B1t,{elevation:3,children:[s.jsxs(z1t,{children:[s.jsxs(Z,{variant:"body2",component:"span",children:[s.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),s.jsx("strong",{children:r.title})]}),s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsx(iE,{iconChar:"▣ ",title:`Total requests: ${(r.value.totalRequests??0).toLocaleString()}`,color:"info"}),s.jsx(iE,{iconChar:"▲ ",title:`Exposed: ${(r.value.totalYes??0).toLocaleString()}`,color:"success"}),s.jsx(iE,{iconChar:"▼ ",title:`Not exposed: ${(r.value.totalNo??0).toLocaleString()}`,color:"error"}),s.jsx(X,{condition:!!r.value.totalApps&&!!r.value.totalEnvironments&&!!r.value.totalFlags,show:s.jsxs(s.Fragment,{children:[s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsx(H1t,{data:[{key:"Flags",value:r.value.totalFlags},{key:"Environments",value:r.value.totalEnvironments},{key:"Apps",value:r.value.totalApps}]})]})})]},`${r.title}-${o}`)))||null})};function V1t(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 U1t=e=>si(new Date(e),"yyyy-ww"),G1t=(e,t)=>{const n=qt(),r=wne();return m.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:U1t(p)}),d=r(a);return{label:a,data:u,borderColor:d,backgroundColor:d,fill:!1}})}),[n,e,r])},q1t=({metricsSummaryTrends:e,isAggregate:t,allDatapointsSorted:n,isLoading:r})=>{const o=qt(),i=G1t(e,n),a=m.useMemo(()=>!r&&!i.datasets.some(d=>d.data.length>1),[i,r]),l=Cp(),c=m.useMemo(()=>{const d=V1t(Object.values(i.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:yy,fill:!0,order:3}]}},[JSON.stringify(e),o]),u=t?c:i;return s.jsx(Sp,{data:a||r?l:u,TooltipComponent:W1t,overrideOptions:a?{}:{parsing:{yAxisKey:"totalRequests",xAxisKey:"date"}},cover:a?s.jsx(Du,{}):r})},Y1t=x(J)(({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)}}),Sne=({sections:e,size:t})=>s.jsx(J,{sx:n=>({display:"flex",gap:n.spacing(.5)}),children:e.map((n,r)=>n.value?s.jsx(Y1t,{type:n.type,sx:{width:`${n.value}%`},size:t},`${n.type}-${r}`):null)}),K1t=e=>e>=50?"error":e>=25?"warning":"success",X1t=x(Lr)(({theme:e})=>({padding:e.spacing(2)})),kB=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),J1t=e=>e==null?"info":K1t(e),Q1t=({stale:e=0,potentiallyStale:t=0,total:n=0})=>{const r=n-e-t;return s.jsxs(s.Fragment,{children:[s.jsx(Sne,{sections:[{type:"error",value:e/n*100},{type:"warning",value:t/n*100},{type:"success",value:r/n*100}],size:"small"}),s.jsxs(Z,{variant:"body2",component:"p",sx:o=>({marginTop:o.spacing(.5)}),children:[s.jsx(Z,{component:"span",sx:o=>({color:o.palette.error.border}),children:"● "}),"Stale flags: ",e]}),s.jsxs(Z,{variant:"body2",component:"p",children:[s.jsx(Z,{component:"span",sx:o=>({color:o.palette.warning.border}),children:"● "}),"Potentially stale flags: ",t]}),s.jsxs(Z,{variant:"body2",component:"p",children:[s.jsx(Z,{component:"span",sx:o=>({color:o.palette.success.border}),children:"● "}),"Healthy flags: ",r]})]})},Z1t=({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 s.jsx(J,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>s.jsxs(X1t,{elevation:3,children:[s.jsxs(kB,{children:[s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label}),s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:"Technical debt"})]}),s.jsxs(kB,{children:[s.jsxs(Z,{variant:"body2",component:"span",children:[s.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),s.jsx("strong",{children:r.title})]}),s.jsxs(sn,{color:J1t(r.value.technicalDebt),children:[r.value.technicalDebt,"%"]})]})," ",s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsxs(Z,{variant:"body2",component:"p",sx:i=>({marginBottom:i.spacing(.5)}),children:["Total flags: ",r.value.total]}),s.jsx(X,{condition:!!(r.value.stale||r.value.potentiallyStale),show:s.jsx(Q1t,{...r.value})})]},`${r.title}-${o}`)))||null})},e0t=e=>((e.total-e.stale-e.potentiallyStale)/e.total*100).toFixed(2),t0t=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=xy(e),o=qt(),i=Cp(),a=m.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(g=>g.week===f)).reduce((h,g)=>(g&&(h.total+=g.total,h.stale+=g.stale,h.potentiallyStale+=g.potentiallyStale),h.date||(h.date=g==null?void 0:g.date),h),{total:0,stale:0,potentiallyStale:0,week:f})).sort((f,h)=>f.week>h.week?1:-1).map(f=>({health:f.total?e0t(f):void 0,technicalDebt:f.total?F1t(f):void 0,date:f.date,total:f.total,stale:f.stale,potentiallyStale:f.potentiallyStale})),borderColor:o.palette.primary.light,backgroundColor:yy,fill:!0,order:3}]}),[r,o]),l=t?a:r,c=m.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?i:l;return s.jsx(Sp,{data:u,TooltipComponent:Z1t,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?s.jsx(Du,{}):n},t?"aggregate":"project")},n0t=x(Lr)(({theme:e})=>({padding:e.spacing(2)})),r0t=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),o0t=({iconChar:e,title:t,color:n})=>s.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[s.jsx(Z,{component:"span",children:e}),s.jsx("strong",{children:t})]}),i0t=({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 s.jsx(J,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>s.jsxs(n0t,{elevation:3,children:[s.jsxs(r0t,{children:[s.jsxs(Z,{variant:"body2",component:"span",children:[s.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),s.jsx("strong",{children:r.title})]}),s.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),s.jsx(jr,{sx:i=>({margin:i.spacing(1.5,0)})}),s.jsx(o0t,{iconChar:"● ",title:`Total updates: ${r.value.totalUpdates}`,color:"info"})]},`${r.title}-${o}`)))||null})},s0t=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,i])=>{const a=n.map(l=>{var u;const c=i.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},a0t=()=>{const e=qt();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]}}},l0t=({environmentTypeTrends:e,isLoading:t})=>{const n=qt(),r=a0t(),o=!t&&(e==null?void 0:e.length)<2,i=Cp({fill:!0,type:"double"}),a=m.useMemo(()=>{const l=s0t(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 s.jsx(Sp,{data:o||t?i:a,overrideOptions:o?{}:{parsing:{yAxisKey:"totalUpdates",xAxisKey:"date"}},TooltipComponent:i0t,cover:o?s.jsx(Du,{}):t})},c0t=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center"})),u0t=x(J)(({theme:e})=>({borderRadius:"50%",width:"200px",height:"200px",border:`10px solid ${e.palette.secondary.border}`,display:"flex",alignItems:"center",justifyContent:"center"})),d0t=x(J)(({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}`}));x(J)(({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"}));x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(.5)}));x(J)(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start"}));x(Z)(({theme:e})=>({marginLeft:"auto",fontSize:e.fontSizes.mainHeader}));x(Ka)(({theme:e})=>({color:e.palette.primary.main,width:"15px",height:"15px",marginRight:e.spacing(.5),fontSize:"15px!important"}));const p0t=x("div")({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}),_B=({count:e,isLoading:t})=>{const n=Eu(),r=Eu();return s.jsxs(s.Fragment,{children:[s.jsx(c0t,{children:s.jsx(u0t,{children:s.jsx(d0t,{"aria-labelledby":n,"aria-describedby":r,children:t?s.jsx(Bc,{children:"Loading total flag count"}):e})})}),s.jsxs(p0t,{children:[s.jsx(Z,{id:n,variant:"body2",children:"Total number of flags"}),s.jsx(bo,{htmlTooltip:!0,tooltipId:r,tooltip:"This includes the four lifecycle stages define, develop, production, and cleanup",children:s.jsx(Us,{})})]})]})},f0t=e=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20",fill:"none",...e},m.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"})),h0t=x(J)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",height:"100%"})),Lv=x(J)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(.5,2,.5,2)})),g0t=x(Lv)(({theme:e})=>({flex:1,justifyContent:"flex-end",alignItems:"flex-end"})),m0t=x(f0t)(({theme:e})=>({color:e.palette.primary.light,marginRight:e.spacing(1.5)})),$b=x(J)(({theme:e})=>({display:"block",marginLeft:"auto",color:e.palette.primary.main,fontWeight:e.typography.fontWeightBold,fontSize:e.fontSizes.mediumHeader})),pk=x("div")(({theme:e})=>({padding:e.spacing(3),fontSize:e.fontSizes.smallBody})),v0t=x(pk)(({theme:e})=>({flexGrow:1,display:"flex",flexDirection:"column"})),y0t=x("div")(()=>({display:"flex",justifyContent:"space-between",alignItems:"center"})),x0t=x($b)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),b0t=({value:e,technicalDebt:t,healthy:n,stale:r,potentiallyStale:o,title:i})=>s.jsxs(h0t,{children:[s.jsx(y0t,{children:s.jsx(pk,{children:i})}),s.jsx(jr,{}),s.jsx(pk,{children:s.jsxs(Lv,{children:[s.jsx(m0t,{}),"Technical debt",s.jsx(x0t,{children:`${t}%`})]})}),s.jsx(jr,{}),s.jsxs(v0t,{children:[s.jsxs(Lv,{children:["Healthy flags",s.jsx($b,{children:n||0})]}),s.jsxs(Lv,{children:["Stale flags",s.jsx($b,{children:r||0})]}),s.jsxs(Lv,{children:["Potentially stale flags",s.jsx($b,{children:o||0})]}),s.jsx(g0t,{children:s.jsx(kn,{href:"https://docs.getunleash.io/reference/insights#health",target:"_blank",rel:"noreferrer",children:"What affects technical debt?"})})]})]}),eb=(e,t)=>m.useMemo(()=>t.length<1||t[0]===zs.id?e:e.filter(r=>t.includes(r.project)),[e,t]);function w0t(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 tb=e=>m.useMemo(()=>w0t(e),[JSON.stringify(e)]),S0t=e=>!!e&&typeof e.timeToProduction=="number"&&e.timeToProduction!==0,C0t=e=>m.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}),i=n.filter(S0t).map(u=>u.timeToProduction);i.sort((u,d)=>u-d);const a=Math.floor(i.length/2),l=i.length%2===0?(i[a-1]+i[a])/2:i[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]),j0t=e=>m.useMemo(()=>{const t=new Set;return e.forEach(n=>{t.add(n.date)}),Array.from(t).sort()},[e]),Cne=(e,t)=>{const n=j0t(e.metricsSummaryTrends),r=eb(e.projectFlagTrends,t),o=eb(e.lifecycleTrends,t),i=eb(e.creationArchiveTrends,t),a=tb(r),l=eb(e.metricsSummaryTrends,t),c=tb(l),u=C0t(r),d=tb(o),p=tb(i);return m.useMemo(()=>({...e,projectsData:r,groupedProjectsData:a,metricsData:l,groupedMetricsData:c,environmentTypeTrends:e.environmentTypeTrends,summary:u,allMetricsDatapoints:n,lifecycleData:o,groupedLifecycleData:d,groupedCreationArchiveData:p}),[e,t,r,a,l,c,u,o,d,p])},E0t=({lifecycleTrends:e,isAggregate:t,isLoading:n})=>{const r=xy(e),o=qt(),i=Cp(),a=m.useMemo(()=>({datasets:[{label:"Number of new flags",data:Array.from(new Set(r.datasets.flatMap(f=>f.data.map(h=>h.week)))).map(f=>r.datasets.map(h=>h.data.find(g=>g.week===f)).reduce((h,g)=>(g&&(h.newProductionFlags+=g.newProductionFlags),h.date||(h.date=g==null?void 0:g.date),h),{newProductionFlags:0,week:f})).sort((f,h)=>f.week>h.week?1:-1),borderColor:o.palette.primary.light,backgroundColor:yy,fill:!0,order:3}]}),[r,o]),l=t?a:r,c=m.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?i:l;return s.jsx(Sp,{data:u,overrideOptions:c?{}:{parsing:{yAxisKey:"newProductionFlags",xAxisKey:"date"}},cover:c?s.jsx(Du,{}):n},t?"aggregate":"project")};var O$={},T0t=Te;Object.defineProperty(O$,"__esModule",{value:!0});var pj=O$.default=void 0,k0t=T0t(ke()),_0t=s,R0t=(0,k0t.default)((0,_0t.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");pj=O$.default=R0t;const P0t=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((i,a)=>{var l,c,u;return{title:(l=i==null?void 0:i.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)||[]})},A0t=x("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),I0t=x("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center",fontSize:e.typography.body2.fontSize})),$0t=x("span")(({theme:e})=>({display:"inline-block",minWidth:8,minHeight:8,borderRadius:"50%",marginRight:e.spacing(1)})),fk=16,O0t=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",M0t=(e=0,t)=>t==="left"?e+fk:t==="right"?e-fk:e,jne=({tooltip:e,children:t})=>s.jsx(J,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+fk,left:M0t(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:O0t(e==null?void 0:e.align)}),children:t}),BLt=({tooltip:e})=>s.jsx(jne,{tooltip:e,children:s.jsxs(Lr,{elevation:3,sx:t=>({width:220,padding:t.spacing(1.5,2)}),children:[s.jsx(Z,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),s.jsx(A0t,{children:e==null?void 0:e.body.map(t=>s.jsxs(I0t,{children:[s.jsx($0t,{sx:{backgroundColor:t.color},children:" "}),s.jsx(yo,{lines:2,children:t.title})]},vm(t)))})]})}),Ene=(e,t)=>t===0?"N/A":`${Math.round(e/t*100)}%`,D0t=x(Lr)(({theme:e})=>({padding:e.spacing(1.5),display:"flex",flexFlow:"column",gap:e.spacing(.5)})),L0t=x("dl")(({theme:e})=>({margin:0})),RB=x("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}})),F0t=x("span")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),N0t=({tooltip:e})=>{if(!(e!=null&&e.dataPoints))return null;const t=e.dataPoints[0].raw,n=t.archivedFlags||0,r=t.totalCreatedFlags||0,o=Ene(n,r);return s.jsx(jne,{tooltip:e,children:s.jsxs(D0t,{elevation:3,children:[s.jsxs(Z,{variant:"body2",component:"span",fontWeight:"bold",children:["Ratio ",o]}),s.jsxs(L0t,{children:[s.jsxs(RB,{dataType:"archived",children:[s.jsx("dt",{children:"Flags archived"}),s.jsx("dd",{children:n})]}),s.jsxs(RB,{dataType:"created",children:[s.jsx("dt",{children:"Flags created"}),s.jsx("dd",{children:r})]})]}),s.jsx(F0t,{children:e.title})]})})};var B0t={lessThanXSeconds:{one:{regular:"méně než sekunda",past:"před méně než sekundou",future:"za méně než 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:"sekunda",past:"před sekundou",future:"za 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ž minuta",past:"před méně než minutou",future:"za méně než 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:"minuta",past:"před minutou",future:"za 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ě hodina",past:"přibližně před hodinou",future:"přibližně za 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:"hodina",past:"před hodinou",future:"za 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:"den",past:"před dnem",future:"za 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ě týden",past:"přibližně před týdnem",future:"přibližně za 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:"týden",past:"před týdnem",future:"za 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ě měsíc",past:"přibližně před měsícem",future:"přibližně za 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:"měsíc",past:"před měsícem",future:"za 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ě rok",past:"přibližně před rokem",future:"přibližně za 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:"rok",past:"před rokem",future:"za 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ž rok",past:"před více než rokem",future:"za více než 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 rok",past:"skoro před rokem",future:"skoro za 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ů"}}},z0t=function(t,n,r){var o,i=B0t[t];i.type==="other"?o=i.other:n===1?o=i.one:n>1&&n<5?o=i.few:o=i.many;var a=(r==null?void 0:r.addSuffix)===!0,l=r==null?void 0:r.comparison,c;return a&&l===-1?c=o.past:a&&l===1?c=o.future:c=o.regular,c.replace("{{count}}",String(n))},H0t={full:"EEEE, d. MMMM yyyy",long:"d. MMMM yyyy",medium:"d. M. yyyy",short:"dd.MM.yyyy"},W0t={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},V0t={full:"{{date}} 'v' {{time}}",long:"{{date}} 'v' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},U0t={date:Kn({formats:H0t,defaultWidth:"full"}),time:Kn({formats:W0t,defaultWidth:"full"}),dateTime:Kn({formats:V0t,defaultWidth:"full"})},G0t=["neděli","pondělí","úterý","středu","čtvrtek","pátek","sobotu"],q0t={lastWeek:"'poslední' eeee 've' p",yesterday:"'včera v' p",today:"'dnes v' p",tomorrow:"'zítra v' p",nextWeek:function(t){var n=t.getUTCDay();return"'v "+G0t[n]+" o' p"},other:"P"},Y0t=function(t,n){var r=q0t[t];return typeof r=="function"?r(n):r},K0t={narrow:["př. n. l.","n. l."],abbreviated:["př. n. l.","n. l."],wide:["před naším letopočtem","našeho letopočtu"]},X0t={narrow:["1","2","3","4"],abbreviated:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"],wide:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"]},J0t={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"]},Q0t={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"]},Z0t={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"]},eyt={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"}},tyt={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"}},nyt=function(t,n){var r=Number(t);return r+"."},ryt={ordinalNumber:nyt,era:gn({values:K0t,defaultWidth:"wide"}),quarter:gn({values:X0t,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:J0t,defaultWidth:"wide",formattingValues:Q0t,defaultFormattingWidth:"wide"}),day:gn({values:Z0t,defaultWidth:"wide"}),dayPeriod:gn({values:eyt,defaultWidth:"wide",formattingValues:tyt,defaultFormattingWidth:"wide"})},oyt=/^(\d+)\.?/i,iyt=/\d+/i,syt={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},ayt={any:[/^p[řr]/i,/^(po|n)/i]},lyt={narrow:/^[1234]/i,abbreviated:/^[1234]\. [čc]tvrtlet[íi]/i,wide:/^[1234]\. [čc]tvrtlet[íi]/i},cyt={any:[/1/i,/2/i,/3/i,/4/i]},uyt={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},dyt={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]},pyt={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},fyt={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]},hyt={any:/^dopoledne|dop\.?|odpoledne|odp\.?|p[ůu]lnoc|poledne|r[áa]no|odpoledne|ve[čc]er|(v )?noci?/i},gyt={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}},myt={ordinalNumber:Pu({matchPattern:oyt,parsePattern:iyt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:syt,defaultMatchWidth:"wide",parsePatterns:ayt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:lyt,defaultMatchWidth:"wide",parsePatterns:cyt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:uyt,defaultMatchWidth:"wide",parsePatterns:dyt,defaultParseWidth:"any"}),day:mn({matchPatterns:pyt,defaultMatchWidth:"wide",parsePatterns:fyt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:hyt,defaultMatchWidth:"any",parsePatterns:gyt,defaultParseWidth:"any"})},vyt={code:"cs",formatDistance:z0t,formatLong:U0t,formatRelative:Y0t,localize:ryt,match:myt,options:{weekStartsOn:1,firstWeekContainsDate:4}},yyt={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"}},xyt=function(t,n,r){var o,i=yyt[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+o:o+" siden":o},byt={full:"EEEE 'den' d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd/MM/y"},wyt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Syt={full:"{{date}} 'kl'. {{time}}",long:"{{date}} 'kl'. {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Cyt={date:Kn({formats:byt,defaultWidth:"full"}),time:Kn({formats:wyt,defaultWidth:"full"}),dateTime:Kn({formats:Syt,defaultWidth:"full"})},jyt={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"},Eyt=function(t,n,r,o){return jyt[t]},Tyt={narrow:["fvt","vt"],abbreviated:["f.v.t.","v.t."],wide:["før vesterlandsk tidsregning","vesterlandsk tidsregning"]},kyt={narrow:["1","2","3","4"],abbreviated:["1. kvt.","2. kvt.","3. kvt.","4. kvt."],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},_yt={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"]},Ryt={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"]},Pyt={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"}},Ayt={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"}},Iyt=function(t,n){var r=Number(t);return r+"."},$yt={ordinalNumber:Iyt,era:gn({values:Tyt,defaultWidth:"wide"}),quarter:gn({values:kyt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:_yt,defaultWidth:"wide"}),day:gn({values:Ryt,defaultWidth:"wide"}),dayPeriod:gn({values:Pyt,defaultWidth:"wide",formattingValues:Ayt,defaultFormattingWidth:"wide"})},Oyt=/^(\d+)(\.)?/i,Myt=/\d+/i,Dyt={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},Lyt={any:[/^f/i,/^(v|e)/i]},Fyt={narrow:/^[1234]/i,abbreviated:/^[1234]. kvt\./i,wide:/^[1234]\.? kvartal/i},Nyt={any:[/1/i,/2/i,/3/i,/4/i]},Byt={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},zyt={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]},Hyt={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},Wyt={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]},Vyt={narrow:/^(a|p|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i,any:/^([ap]\.?\s?m\.?|midnat|middag|(om) (morgenen|eftermiddagen|aftenen|natten))/i},Uyt={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}},Gyt={ordinalNumber:Pu({matchPattern:Oyt,parsePattern:Myt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:Dyt,defaultMatchWidth:"wide",parsePatterns:Lyt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:Fyt,defaultMatchWidth:"wide",parsePatterns:Nyt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:Byt,defaultMatchWidth:"wide",parsePatterns:zyt,defaultParseWidth:"any"}),day:mn({matchPatterns:Hyt,defaultMatchWidth:"wide",parsePatterns:Wyt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:Vyt,defaultMatchWidth:"any",parsePatterns:Uyt,defaultParseWidth:"any"})},qyt={code:"da",formatDistance:xyt,formatLong:Cyt,formatRelative:Eyt,localize:$yt,match:Gyt,options:{weekStartsOn:1,firstWeekContainsDate:4}},PB={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:"halbe Minute",withPreposition:"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"}}},Yyt=function(t,n,r){var o,i=r!=null&&r.addSuffix?PB[t].withPreposition:PB[t].standalone;return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:"vor "+o:o},Kyt={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},Xyt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Jyt={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Qyt={date:Kn({formats:Kyt,defaultWidth:"full"}),time:Kn({formats:Xyt,defaultWidth:"full"}),dateTime:Kn({formats:Jyt,defaultWidth:"full"})},Zyt={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},ext=function(t,n,r,o){return Zyt[t]},txt={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},nxt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},hk={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"]},rxt={narrow:hk.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:hk.wide},oxt={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"]},ixt={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"}},sxt={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"}},axt=function(t){var n=Number(t);return n+"."},lxt={ordinalNumber:axt,era:gn({values:txt,defaultWidth:"wide"}),quarter:gn({values:nxt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:hk,formattingValues:rxt,defaultWidth:"wide"}),day:gn({values:oxt,defaultWidth:"wide"}),dayPeriod:gn({values:ixt,defaultWidth:"wide",formattingValues:sxt,defaultFormattingWidth:"wide"})},cxt=/^(\d+)(\.)?/i,uxt=/\d+/i,dxt={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},pxt={any:[/^v/i,/^n/i]},fxt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},hxt={any:[/1/i,/2/i,/3/i,/4/i]},gxt={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},mxt={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]},vxt={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},yxt={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},xxt={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},bxt={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}},wxt={ordinalNumber:Pu({matchPattern:cxt,parsePattern:uxt,valueCallback:function(t){return parseInt(t)}}),era:mn({matchPatterns:dxt,defaultMatchWidth:"wide",parsePatterns:pxt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:fxt,defaultMatchWidth:"wide",parsePatterns:hxt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:gxt,defaultMatchWidth:"wide",parsePatterns:mxt,defaultParseWidth:"any"}),day:mn({matchPatterns:vxt,defaultMatchWidth:"wide",parsePatterns:yxt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:xxt,defaultMatchWidth:"wide",parsePatterns:bxt,defaultParseWidth:"any"})},Sxt={code:"de",formatDistance:Yyt,formatLong:Qyt,formatRelative:ext,localize:lxt,match:wxt,options:{weekStartsOn:1,firstWeekContainsDate:4}},Cxt={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"dd/MM/yyyy"},jxt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Ext={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Txt={date:Kn({formats:Cxt,defaultWidth:"full"}),time:Kn({formats:jxt,defaultWidth:"full"}),dateTime:Kn({formats:Ext,defaultWidth:"full"})},kxt={code:"en-GB",formatDistance:GP,formatLong:Txt,formatRelative:qP,localize:YP,match:KP,options:{weekStartsOn:1,firstWeekContainsDate:4}},_xt={full:"EEEE, d MMMM yyyy",long:"d MMMM, yyyy",medium:"d MMM, yyyy",short:"dd/MM/yyyy"},Rxt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Pxt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Axt={date:Kn({formats:_xt,defaultWidth:"full"}),time:Kn({formats:Rxt,defaultWidth:"full"}),dateTime:Kn({formats:Pxt,defaultWidth:"full"})},Ixt={code:"en-IN",formatDistance:GP,formatLong:Axt,formatRelative:qP,localize:YP,match:KP,options:{weekStartsOn:1,firstWeekContainsDate:4}},$xt={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"}},Oxt=function(t,n,r){var o,i=$xt[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"dans "+o:"il y a "+o:o},Mxt={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Dxt={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Lxt={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Fxt={date:Kn({formats:Mxt,defaultWidth:"full"}),time:Kn({formats:Dxt,defaultWidth:"full"}),dateTime:Kn({formats:Lxt,defaultWidth:"full"})},Nxt={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Bxt=function(t,n,r,o){return Nxt[t]},zxt={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},Hxt={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"]},Wxt={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"]},Vxt={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"]},Uxt={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"}},Gxt=function(t,n){var r=Number(t),o=n==null?void 0:n.unit;if(r===0)return"0";var i=["year","week","hour","minute","second"],a;return r===1?a=o&&i.includes(o)?"ère":"er":a="ème",r+a},qxt={ordinalNumber:Gxt,era:gn({values:zxt,defaultWidth:"wide"}),quarter:gn({values:Hxt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:Wxt,defaultWidth:"wide"}),day:gn({values:Vxt,defaultWidth:"wide"}),dayPeriod:gn({values:Uxt,defaultWidth:"wide"})},Yxt=/^(\d+)(ième|ère|ème|er|e)?/i,Kxt=/\d+/i,Xxt={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},Jxt={any:[/^av/i,/^ap/i]},Qxt={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},Zxt={any:[/1/i,/2/i,/3/i,/4/i]},ebt={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},tbt={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]},nbt={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},rbt={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]},obt={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},ibt={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}},sbt={ordinalNumber:Pu({matchPattern:Yxt,parsePattern:Kxt,valueCallback:function(t){return parseInt(t)}}),era:mn({matchPatterns:Xxt,defaultMatchWidth:"wide",parsePatterns:Jxt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:Qxt,defaultMatchWidth:"wide",parsePatterns:Zxt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:ebt,defaultMatchWidth:"wide",parsePatterns:tbt,defaultParseWidth:"any"}),day:mn({matchPatterns:nbt,defaultMatchWidth:"wide",parsePatterns:rbt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:obt,defaultMatchWidth:"any",parsePatterns:ibt,defaultParseWidth:"any"})},abt={code:"fr",formatDistance:Oxt,formatLong:Fxt,formatRelative:Bxt,localize:qxt,match:sbt,options:{weekStartsOn:1,firstWeekContainsDate:4}},lbt={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}}年近く"}},cbt=function(t,n,r){r=r||{};var o,i=lbt[t];return typeof i=="string"?o=i:n===1?r.addSuffix&&i.oneWithSuffix?o=i.oneWithSuffix:o=i.one:r.addSuffix&&i.otherWithSuffix?o=i.otherWithSuffix.replace("{{count}}",String(n)):o=i.other.replace("{{count}}",String(n)),r.addSuffix?r.comparison&&r.comparison>0?o+"後":o+"前":o},ubt={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},dbt={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},pbt={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},fbt={date:Kn({formats:ubt,defaultWidth:"full"}),time:Kn({formats:dbt,defaultWidth:"full"}),dateTime:Kn({formats:pbt,defaultWidth:"full"})},hbt={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},gbt=function(t,n,r,o){return hbt[t]},mbt={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},vbt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},ybt={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月"]},xbt={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},bbt={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:"深夜"}},wbt={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:"深夜"}},Sbt=function(t,n){var r=Number(t),o=String(n==null?void 0:n.unit);switch(o){case"year":return"".concat(r,"年");case"quarter":return"第".concat(r,"四半期");case"month":return"".concat(r,"月");case"week":return"第".concat(r,"週");case"date":return"".concat(r,"日");case"hour":return"".concat(r,"時");case"minute":return"".concat(r,"分");case"second":return"".concat(r,"秒");default:return"".concat(r)}},Cbt={ordinalNumber:Sbt,era:gn({values:mbt,defaultWidth:"wide"}),quarter:gn({values:vbt,defaultWidth:"wide",argumentCallback:function(t){return Number(t)-1}}),month:gn({values:ybt,defaultWidth:"wide"}),day:gn({values:xbt,defaultWidth:"wide"}),dayPeriod:gn({values:bbt,defaultWidth:"wide",formattingValues:wbt,defaultFormattingWidth:"wide"})},jbt=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,Ebt=/\d+/i,Tbt={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},kbt={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},_bt={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},Rbt={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},Pbt={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},Abt={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},Ibt={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},$bt={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},Obt={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},Mbt={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},Dbt={ordinalNumber:Pu({matchPattern:jbt,parsePattern:Ebt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:Tbt,defaultMatchWidth:"wide",parsePatterns:kbt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:_bt,defaultMatchWidth:"wide",parsePatterns:Rbt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:Pbt,defaultMatchWidth:"wide",parsePatterns:Abt,defaultParseWidth:"any"}),day:mn({matchPatterns:Ibt,defaultMatchWidth:"wide",parsePatterns:$bt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:Obt,defaultMatchWidth:"any",parsePatterns:Mbt,defaultParseWidth:"any"})},Lbt={code:"ja",formatDistance:cbt,formatLong:fbt,formatRelative:gbt,localize:Cbt,match:Dbt,options:{weekStartsOn:0,firstWeekContainsDate:1}},Fbt={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"}},Nbt=function(t,n,r){var o,i=Fbt[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+o:o+" siden":o},Bbt={full:"EEEE d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd.MM.y"},zbt={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Hbt={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Wbt={date:Kn({formats:Bbt,defaultWidth:"full"}),time:Kn({formats:zbt,defaultWidth:"full"}),dateTime:Kn({formats:Hbt,defaultWidth:"full"})},Vbt={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"},Ubt=function(t,n,r,o){return Vbt[t]},Gbt={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["før Kristus","etter Kristus"]},qbt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},Ybt={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"]},Kbt={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"]},Xbt={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"}},Jbt=function(t,n){var r=Number(t);return r+"."},Qbt={ordinalNumber:Jbt,era:gn({values:Gbt,defaultWidth:"wide"}),quarter:gn({values:qbt,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:Ybt,defaultWidth:"wide"}),day:gn({values:Kbt,defaultWidth:"wide"}),dayPeriod:gn({values:Xbt,defaultWidth:"wide"})},Zbt=/^(\d+)\.?/i,e2t=/\d+/i,t2t={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},n2t={any:[/^f/i,/^e/i]},r2t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? kvartal/i},o2t={any:[/1/i,/2/i,/3/i,/4/i]},i2t={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},s2t={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]},a2t={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},l2t={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},c2t={narrow:/^(midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten)|[ap])/i,any:/^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten))/i},u2t={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}},d2t={ordinalNumber:Pu({matchPattern:Zbt,parsePattern:e2t,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:t2t,defaultMatchWidth:"wide",parsePatterns:n2t,defaultParseWidth:"any"}),quarter:mn({matchPatterns:r2t,defaultMatchWidth:"wide",parsePatterns:o2t,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:i2t,defaultMatchWidth:"wide",parsePatterns:s2t,defaultParseWidth:"any"}),day:mn({matchPatterns:a2t,defaultMatchWidth:"wide",parsePatterns:l2t,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:c2t,defaultMatchWidth:"any",parsePatterns:u2t,defaultParseWidth:"any"})},p2t={code:"nb",formatDistance:Nbt,formatLong:Wbt,formatRelative:Ubt,localize:Qbt,match:d2t,options:{weekStartsOn:1,firstWeekContainsDate:4}},f2t={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"}},h2t=function(t,n,r){var o,i=f2t[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"em "+o:"há "+o:o},g2t={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},m2t={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},v2t={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},y2t={date:Kn({formats:g2t,defaultWidth:"full"}),time:Kn({formats:m2t,defaultWidth:"full"}),dateTime:Kn({formats:v2t,defaultWidth:"full"})},x2t={lastWeek:function(t){var n=t.getUTCDay(),r=n===0||n===6?"último":"última";return"'"+r+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},b2t=function(t,n,r,o){var i=x2t[t];return typeof i=="function"?i(n):i},w2t={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},S2t={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},C2t={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"]},j2t={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"]},E2t={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"}},T2t={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"}},k2t=function(t,n){var r=Number(t);return(n==null?void 0:n.unit)==="week"?r+"ª":r+"º"},_2t={ordinalNumber:k2t,era:gn({values:w2t,defaultWidth:"wide"}),quarter:gn({values:S2t,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:C2t,defaultWidth:"wide"}),day:gn({values:j2t,defaultWidth:"wide"}),dayPeriod:gn({values:E2t,defaultWidth:"wide",formattingValues:T2t,defaultFormattingWidth:"wide"})},R2t=/^(\d+)[ºªo]?/i,P2t=/\d+/i,A2t={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},I2t={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},$2t={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},O2t={any:[/1/i,/2/i,/3/i,/4/i]},M2t={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},D2t={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]},L2t={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},F2t={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]},N2t={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},B2t={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}},z2t={ordinalNumber:Pu({matchPattern:R2t,parsePattern:P2t,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:A2t,defaultMatchWidth:"wide",parsePatterns:I2t,defaultParseWidth:"any"}),quarter:mn({matchPatterns:$2t,defaultMatchWidth:"wide",parsePatterns:O2t,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:M2t,defaultMatchWidth:"wide",parsePatterns:D2t,defaultParseWidth:"any"}),day:mn({matchPatterns:L2t,defaultMatchWidth:"wide",parsePatterns:F2t,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:N2t,defaultMatchWidth:"any",parsePatterns:B2t,defaultParseWidth:"any"})},H2t={code:"pt-BR",formatDistance:h2t,formatLong:y2t,formatRelative:b2t,localize:_2t,match:z2t,options:{weekStartsOn:0,firstWeekContainsDate:1}},W2t={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}} vecka"},xWeeks:{one:"en vecka",other:"{{count}} vecka"},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"}},V2t=["noll","en","två","tre","fyra","fem","sex","sju","åtta","nio","tio","elva","tolv"],U2t=function(t,n,r){var o,i=W2t[t];return typeof i=="string"?o=i:n===1?o=i.one:r&&r.onlyNumeric?o=i.other.replace("{{count}}",String(n)):o=i.other.replace("{{count}}",n<13?V2t[n]:String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+o:o+" sedan":o},G2t={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"y-MM-dd"},q2t={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Y2t={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},K2t={date:Kn({formats:G2t,defaultWidth:"full"}),time:Kn({formats:q2t,defaultWidth:"full"}),dateTime:Kn({formats:Y2t,defaultWidth:"full"})},X2t={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"},J2t=function(t,n,r,o){return X2t[t]},Q2t={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["före Kristus","efter Kristus"]},Z2t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1:a kvartalet","2:a kvartalet","3:e kvartalet","4:e kvartalet"]},ewt={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"]},twt={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"]},nwt={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"}},rwt={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"}},owt=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:case 2:return r+":a"}return r+":e"},iwt={ordinalNumber:owt,era:gn({values:Q2t,defaultWidth:"wide"}),quarter:gn({values:Z2t,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:gn({values:ewt,defaultWidth:"wide"}),day:gn({values:twt,defaultWidth:"wide"}),dayPeriod:gn({values:nwt,defaultWidth:"wide",formattingValues:rwt,defaultFormattingWidth:"wide"})},swt=/^(\d+)(:a|:e)?/i,awt=/\d+/i,lwt={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},cwt={any:[/^f/i,/^[ev]/i]},uwt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](:a|:e)? kvartalet/i},dwt={any:[/1/i,/2/i,/3/i,/4/i]},pwt={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},fwt={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]},hwt={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},gwt={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},mwt={any:/^([fe]\.?\s?m\.?|midn(att)?|midd(ag)?|(på) (morgonen|eftermiddagen|kvällen|natten))/i},vwt={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}},ywt={ordinalNumber:Pu({matchPattern:swt,parsePattern:awt,valueCallback:function(t){return parseInt(t,10)}}),era:mn({matchPatterns:lwt,defaultMatchWidth:"wide",parsePatterns:cwt,defaultParseWidth:"any"}),quarter:mn({matchPatterns:uwt,defaultMatchWidth:"wide",parsePatterns:dwt,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:mn({matchPatterns:pwt,defaultMatchWidth:"wide",parsePatterns:fwt,defaultParseWidth:"any"}),day:mn({matchPatterns:hwt,defaultMatchWidth:"wide",parsePatterns:gwt,defaultParseWidth:"any"}),dayPeriod:mn({matchPatterns:mwt,defaultMatchWidth:"any",parsePatterns:vwt,defaultParseWidth:"any"})},xwt={code:"sv",formatDistance:U2t,formatLong:K2t,formatRelative:J2t,localize:iwt,match:ywt,options:{weekStartsOn:1,firstWeekContainsDate:4}};const bwt={cs:vyt,"da-DK":qyt,de:Sxt,"en-GB":kxt,"en-IN":Ixt,"en-US":Qf,"fr-FR":abt,ja:Lbt,"nb-NO":p2t,"pt-BR":H2t,"sv-SE":xwt},wwt=e=>bwt[e]??Qf,Swt=.8,Cwt=e=>{var t,n;return e.width/e.scales.x.ticks.length*(((n=(t=e.options.datasets)==null?void 0:t.bar)==null?void 0:n.categoryPercentage)??Swt)},jwt=e=>({id:"customLine",beforeDraw:t=>{var a;const{width:n=Cwt,maxHighlightOpacity:r=.12,bottomOverflow:o=0}=e??{},i=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-i/2,c.top,i,c.bottom-c.top+o];o?(u.roundRect(...p,5),u.fill()):u.fillRect(...p),u.restore()}}}),AB=[{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"}],Ewt={datasets:[{label:"Flags archived",data:AB,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},order:1},{label:"Flags created",data:AB,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},order:2}]},Tne="label";function IB(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Twt(e,t){Object.assign(e.options,t)}function kne(e,t){e.labels=t}function _ne(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Tne;const r=[];e.datasets=t.map(o=>{const i=e.datasets.find(a=>a[n]===o[n]);return!i||!o.data||r.includes(i)?{...o}:(r.push(i),Object.assign(i,o),i)})}function kwt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tne;const n={labels:[],datasets:[]};return kne(n,e.labels),_ne(n,e.datasets,t),n}function _wt(e,t){let{height:n=150,width:r=300,redraw:o=!1,datasetIdKey:i,type:a,data:l,options:c,plugins:u=[],fallbackContent:d,updateMode:p,...f}=e;const h=m.useRef(null),g=m.useRef(),v=()=>{h.current&&(g.current=new Em(h.current,{type:a,data:kwt(l,i),options:c&&{...c},plugins:u}),IB(t,g.current))},b=()=>{IB(t,null),g.current&&(g.current.destroy(),g.current=null)};return m.useEffect(()=>{!o&&g.current&&c&&Twt(g.current,c)},[o,c]),m.useEffect(()=>{!o&&g.current&&kne(g.current.config.data,l.labels)},[o,l.labels]),m.useEffect(()=>{!o&&g.current&&l.datasets&&_ne(g.current.config.data,l.datasets,i)},[o,l.datasets]),m.useEffect(()=>{g.current&&(o?(b(),setTimeout(v)):g.current.update(p))},[o,c,l.labels,l.datasets,p]),m.useEffect(()=>{g.current&&(b(),setTimeout(v))},[a]),m.useEffect(()=>(v(),()=>b()),[]),Je.createElement("canvas",Object.assign({ref:h,role:"img",height:n,width:r},f),d)}const Rwt=m.forwardRef(_wt);function Rne(e,t){return Em.register(t),m.forwardRef((n,r)=>Je.createElement(Rwt,Object.assign({},n,{ref:r,type:e})))}const Pwt=Rne("line",sj),Awt=Rne("bar",ij),Iwt=x("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}})),$wt=x("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),Owt=({children:e})=>s.jsx(Iwt,{children:s.jsx($wt,{children:e})});Em.register(y0,cj,vy,Mu,lj,Tm,vne,gne,o1t);const Mwt=({creationArchiveTrends:e,isLoading:t})=>{const n=xy(e),r=qt(),{locationSettings:o}=wo(),[i,a]=m.useState(null),{notEnoughData:l,aggregateOrProjectData:c}=m.useMemo(()=>{const h=Array.from(new Set(n.datasets.flatMap(y=>y.data.map(w=>w.week)))),g=(y,w)=>(w&&(y.archivedFlags+=w.archivedFlags||0,w.createdFlags&&Object.entries(w.createdFlags).forEach(([S,j])=>{y.totalCreatedFlags+=j})),y.date||(y.date=w==null?void 0:w.date),y),v=y=>({archivedFlags:0,totalCreatedFlags:0,archivePercentage:0,week:y}),b=h.map(y=>n.datasets.map(w=>w.data.find(S=>S.week===y)).reduce(g,v(y))).map(y=>({...y,archivePercentage:y.totalCreatedFlags>0?y.archivedFlags/y.totalCreatedFlags*100:0})).sort((y,w)=>y.week>w.week?1:-1);return{notEnoughData:b.length<2,aggregateOrProjectData:{datasets:[{label:"Flags archived",data:b,backgroundColor:r.palette.charts.A2,borderColor:r.palette.charts.A2,hoverBackgroundColor:r.palette.charts.A2,hoverBorderColor:r.palette.charts.A2,parsing:{yAxisKey:"archivedFlags",xAxisKey:"date"},order:1},{label:"Flags created",data:b,backgroundColor:r.palette.charts.A1,borderColor:r.palette.charts.A1,hoverBackgroundColor:r.palette.charts.A1,hoverBorderColor:r.palette.charts.A1,parsing:{yAxisKey:"totalCreatedFlags",xAxisKey:"date"},order:2}]}}},[n,r]),u=l||t,d=l&&!t,p=u?Ewt:c,f=m.useMemo(()=>({responsive:!0,...u?{animation:{duration:0}}:{},interaction:{mode:"index",intersect:!1},datasets:{bar:{borderRadius:4}},plugins:{legend:{position:"bottom",labels:{color:r.palette.text.secondary,usePointStyle:!0,padding:21,boxHeight:8},display:!u},tooltip:{enabled:!1,position:"average",external:P0t(a)}},locale:o.locale,scales:{x:{adapters:{date:{locale:wwt(o.locale)}},type:"time",display:!0,time:{unit:"week",tooltipFormat:"P"},grid:{display:!1},ticks:{source:"data",display:!u}},y:{type:"linear",position:"left",beginAtZero:!0,title:{display:!0,text:"Number of flags"},ticks:{stepSize:1,display:!u}}}}),[r,o,a,u]);return s.jsxs(s.Fragment,{children:[s.jsx(Awt,{data:p,options:f,height:100,width:250,plugins:[jwt({maxHighlightOpacity:.24})]}),s.jsx(N0t,{tooltip:i}),u?s.jsx(Owt,{children:d?s.jsx(Du,{}):t}):null]})};function Dwt(e){if(!e)return 0;let t=0,n=0;return Object.values(e).forEach(r=>{const o=r[0];if(o){t+=o.archivedFlags||0;const i=o.createdFlags?Object.values(o.createdFlags).reduce((a,l)=>a+l,0):0;n+=i}}),Ene(t,n)}const Lwt=x(J)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.spacing(2),padding:e.spacing(2),display:"flex",flexDirection:"column",gap:e.spacing(.5)})),Fwt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between"})),Nwt=x(Z)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.spacing(2.5),fontWeight:"bold"})),Bwt=x(Us)(({theme:e})=>({color:e.palette.text.secondary})),zwt=x(xt)(({theme:e})=>({color:e.palette.primary.main,textDecoration:"none","&:hover":{textDecoration:"underline"},fontSize:e.spacing(1.75)})),Hwt=({groupedCreationArchiveData:e,isLoading:t})=>{const n=Dwt(e);return s.jsxs(s.Fragment,{children:[s.jsxs(Lwt,{children:[s.jsxs(Fwt,{children:[s.jsx(Nwt,{children:t?"...":n}),s.jsx(bo,{tooltip:"Ratio of archived flags to created flags",children:s.jsx(Bwt,{})})]}),s.jsx(Z,{variant:"body2",children:"Current ratio"})]}),s.jsxs(mte,{children:[s.jsx(pj,{color:"primary"}),"Do you create more flags than you archive? Or do you have good process for cleaning up?"]}),s.jsx(zwt,{to:"/search?lifecycle=IS:completed",children:"View flags in cleanup stage"})]})},Wwt=()=>{var j,E,C;const e="performance-",t={[`${e}project`]:wr,[`${e}from`]:ho(wr,{values:[si(tC(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[`${e}to`]:ho(wr,{values:[si(new Date,"yyyy-MM-dd")],operator:"IS"})},[n,r]=nh("insights",t,["performance-from","performance-to"]),{insights:o,loading:i}=vte((j=n[`${e}from`])==null?void 0:j.values[0],(E=n[`${e}to`])==null?void 0:E.values[0]),a=((C=n[`${e}project`])==null?void 0:C.values)??[zs.id],l=a[0]===zs.id,{flagTrends:c,summary:u,groupedProjectsData:d,groupedLifecycleData:p,groupedMetricsData:f,allMetricsDatapoints:h,environmentTypeTrends:g,groupedCreationArchiveData:v}=Cne(o,a),{isEnterprise:b}=rt(),y=c[c.length-1],w=(y==null?void 0:y.total)??0,S=ci("lifecycleGraphs");return s.jsxs(p$,{title:"Performance insights",filters:s.jsx(h$,{state:n,onChange:r,filterNamePrefix:e}),children:[S&&b()?s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"New flags in production"}),s.jsxs(mte,{children:[s.jsx(pj,{color:"primary"}),"How often do flags go live in production?"]})]}),s.jsx(ld,{children:s.jsx(E0t,{lifecycleTrends:p,isAggregate:l,isLoading:i})})]}):null,S&&b()?s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"Flags archived vs flags created"}),s.jsx(Hwt,{groupedCreationArchiveData:v,isLoading:i})]}),s.jsx(ld,{children:s.jsx(Mwt,{creationArchiveTrends:v,isLoading:i})})]}):null,l?s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"Flags"}),s.jsx(_B,{count:w,isLoading:i})]}),s.jsx(ld,{children:s.jsx(L1t,{flagTrends:c,isLoading:i})})]}):s.jsxs(iu,{children:[s.jsxs(tf,{width:275,children:[s.jsx(su,{title:"Flags"}),s.jsx(_B,{count:u.total,isLoading:i})]}),s.jsx(ld,{children:s.jsx(N1t,{projectFlagTrends:d,isLoading:i})})]}),b()?s.jsxs(iu,{children:[s.jsx(tf,{width:350,padding:0,children:s.jsx(b0t,{value:u.averageHealth,technicalDebt:u.technicalDebt,healthy:u.active,stale:u.stale,potentiallyStale:u.potentiallyStale,title:s.jsx(su,{title:"Technical debt",tooltip:"Percentage of flags that are stale or potentially stale."})})}),s.jsx(ld,{children:s.jsx(t0t,{projectFlagTrends:d,isAggregate:l,isLoading:i})})]}):null,b()?s.jsxs(s.Fragment,{children:[s.jsx(iu,{children:s.jsxs(dN,{children:[s.jsx(su,{title:"Flag evaluation metrics",tooltip:"Summary of all flag evaluations reported by SDKs."}),s.jsx(ld,{children:s.jsx(q1t,{metricsSummaryTrends:f,allDatapointsSorted:h,isAggregate:l,isLoading:i})})]})}),s.jsx(iu,{children:s.jsxs(dN,{children:[s.jsx(su,{title:"Updates per environment type",tooltip:"Summary of all configuration updates per environment type."}),s.jsx(l0t,{environmentTypeTrends:g,isLoading:i})]})})]}):null]})},Vwt=({userTrends:e,isLoading:t})=>{const n=ci("showInactiveUsers"),r=qt(),o=!t&&e.length<2,i=Cp({fill:!0,type:"rising"}),a=m.useMemo(()=>({labels:e.map(l=>l.date),datasets:[{label:"Total users",data:e.map(l=>l.total),borderColor:r.palette.primary.light,backgroundColor:yy,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 s.jsx(Sp,{data:o||t?i:a,cover:o?s.jsx(Du,{}):t})},Uwt=({projectFlagTrends:e,isLoading:t})=>{const n=Cp({type:"constant"}),r=xy(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return s.jsx(Sp,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"users",xAxisKey:"date"}},cover:o?s.jsx(Du,{}):t})},Gwt=x(J)(({theme:e})=>({padding:`${e.spacing(1.5)} ${e.spacing(2)}`,borderRadius:`${e.shape.borderRadius}px`,border:`1px solid ${e.palette.divider}`})),qwt=x(J)(({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)})),Ywt=x(J)(()=>({display:"flex",alignItems:"center",width:"100%"})),Kwt=x(J)(()=>({display:"flex",flexDirection:"column"})),Xwt=x(Z)(()=>({marginLeft:"auto",fontWeight:"normal"})),$B=({type:e,count:t,percentage:n})=>s.jsx(Gwt,{children:s.jsxs(Ywt,{children:[s.jsxs(Kwt,{children:[s.jsxs(J,{sx:{display:"flex",alignItems:"center"},children:[s.jsx(qwt,{type:e}),s.jsxs(Z,{variant:"body1",component:"span",children:[e==="active"?"Active":"Inactive"," users"]})]}),s.jsxs(Z,{variant:"body2",children:[n,"%"]})]}),s.jsx(Xwt,{variant:"h2",children:t})]})}),Jwt=x(J)(({theme:e})=>({position:"relative"})),Qwt=x(J)(({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})),Zwt=x(J)(({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})),eSt=x(J)(({theme:e})=>({marginBottom:e.spacing(2.5)})),tSt=x(Z)(({theme:e})=>({color:e.palette.primary.contrastText,fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,margin:0,padding:0})),nSt=x(J)({display:"flex",flexDirection:"column",gap:"12px"}),rSt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(3)})),oSt=x(xt)({fontWeight:"bold",textDecoration:"none",display:"flex",justifyContent:"center"}),iSt=x(J)(()=>({"&:before":{background:"transparent"}})),OB=({count:e,active:t,inactive:n,isLoading:r})=>{const i=ci("showInactiveUsers")&&t!==void 0&&n!==void 0,a=(t||0)/e*100;return s.jsxs(s.Fragment,{children:[s.jsxs(Jwt,{children:[s.jsx(Qwt,{children:s.jsx(tSt,{variant:"h2",children:s.jsx(X,{condition:r!==!0,show:Number.parseInt(`${e}`,10)===e?e:e.toFixed(2),elseShow:s.jsx(iSt,{className:"skeleton",children:" "})})})}),s.jsx(Zwt,{})]}),s.jsx(X,{condition:i,show:s.jsxs(s.Fragment,{children:[s.jsx(eSt,{children:s.jsx(Sne,{sections:[{type:"success",value:a},{type:"warning",value:100-a}]})}),s.jsxs(nSt,{children:[s.jsx($B,{type:"active",percentage:`${a}`,count:`${t}`}),s.jsx($B,{type:"inactive",percentage:`${100-a}`,count:`${n}`})]})]})}),s.jsx(rSt,{children:s.jsxs(oSt,{to:"/admin/users",children:["View users ",s.jsx(n9,{})]})})]})},sSt=()=>{var b,y,w;const e="users-",t={[`${e}project`]:wr,[`${e}from`]:ho(wr,{values:[si(tC(new Date,1),"yyyy-MM-dd")],operator:"IS"}),[`${e}to`]:ho(wr,{values:[si(new Date,"yyyy-MM-dd")],operator:"IS"})},[n,r]=nh("insights-users",t,["users-from","users-to"]),{insights:o,loading:i}=vte((b=n["users-from"])==null?void 0:b.values[0],(y=n["users-to"])==null?void 0:y.values[0]),a=((w=n["users-project"])==null?void 0:w.values)??[zs.id],l=a[0]===zs.id,{summary:c,groupedProjectsData:u,userTrends:d}=Cne(o,a),p=d[d.length-1],f=(p==null?void 0:p.total)??0,h=(p==null?void 0:p.active)??0,g=(p==null?void 0:p.inactive)??0,v=a.length===1;return s.jsx(p$,{title:"User insights",filters:s.jsx(h$,{state:n,onChange:r,filterNamePrefix:e}),children:l?s.jsxs(iu,{children:[s.jsxs(tf,{children:[s.jsx(su,{title:"Total users"}),s.jsx(OB,{count:f,active:h,inactive:g,isLoading:i})]}),s.jsx(ld,{children:s.jsx(Vwt,{userTrends:d,isLoading:i})})]}):s.jsxs(iu,{children:[s.jsxs(tf,{children:[s.jsx(su,{title:v?"Users in project":"Users per project on average",tooltip:v?"Number of users in selected projects.":"Average number of users for selected projects."}),s.jsx(OB,{count:c.averageUsers,isLoading:i})]}),s.jsx(ld,{children:s.jsx(Uwt,{projectFlagTrends:u,isLoading:i})})]})})},aSt=x("div")(({theme:e})=>({paddingTop:e.spacing(2)})),lSt=()=>s.jsxs(aSt,{children:[s.jsx(Aft,{}),s.jsxs(Ift,{children:[s.jsx(Xft,{}),s.jsx(Wwt,{}),s.jsx(sSt,{})]})]}),cSt=m.lazy(()=>va(()=>import("./ImpactMetricsPage-B3STis_H.js"),[]).then(e=>({default:e.ImpactMetricsPage}))),gk="api/admin/feedback",uSt=bt(gk),dSt=(e={})=>{const t=()=>fetch(uSt,{method:"GET"}).then(Jt("FeedbackPosted")).then(l=>l.json()),{data:n,error:r}=_n(gk,t,e),[o,i]=m.useState(!r&&!n),a=()=>{Io(gk)};return m.useEffect(()=>{i(!r&&!n)},[n,r]),{feedback:n||[],error:r,loading:o,refetchFeedback:a}};function pSt(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,i)=>{const a=i.category;return o[a]||(o[a]=[]),o[a].push(i),o},{});return Object.entries(r).map(([o,i])=>{const a=i.length,l=i.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 sE=x(Z)(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(1)})),fSt=x("div")(({theme:e})=>({fontSize:e.fontSizes.mediumHeader})),hSt=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),flexWrap:"wrap",marginBottom:e.spacing(4)})),gSt=x("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)})),mSt=()=>{const{feedback:e}=dSt(),[t,n]=m.useState(""),r=[{Header:"Feature",accessor:"category",minWidth:100,Cell:({row:{original:p}})=>s.jsx(En,{children:p.category}),searchable:!0},{Header:"User Type",accessor:"userType",Cell:({row:{original:p}})=>s.jsx(En,{children:p.userType}),searchable:!0},{Header:"Score",accessor:"difficultyScore",maxWidth:90,Cell:({row:{original:p}})=>s.jsx(En,{children:p.difficultyScore})},{Header:"What do you like most?",accessor:"positive",minWidth:100,Cell:({row:{original:p}})=>s.jsx(En,{children:p.positive}),disableSortBy:!0,searchable:!0},{Header:"What should be improved?",accessor:"areasForImprovement",minWidth:100,Cell:({row:{original:p}})=>s.jsx(En,{children:p.areasForImprovement}),disableSortBy:!0,searchable:!0},{Header:"Date",accessor:"createdAt",Cell:Jd}],{data:o,getSearchText:i}=eh(r,t,e),a=m.useMemo(()=>pSt(o),[o]),{headerGroups:l,rows:c,prepareRow:u}=Zt.useTable({columns:r,data:o,initialState:{sortBy:[{id:"createdAt",desc:!0}]},sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:En}},Zt.useSortBy,Zt.useFlexLayout),d=Xn(pr.breakpoints.down("md"));return s.jsxs(cr,{header:s.jsx(Pn,{title:"Feedback",actions:s.jsx(s.Fragment,{children:s.jsx(X,{condition:!d,show:s.jsxs(s.Fragment,{children:[s.jsx(xo,{initialValue:t,onChange:n}),s.jsx(Pn.Divider,{})]})})}),children:s.jsx(X,{condition:d,show:s.jsx(xo,{initialValue:t,onChange:n})})}),children:[s.jsx(sE,{children:"Active experiments"}),s.jsx(hSt,{children:a.length>0?a.map(p=>s.jsxs(gSt,{children:[s.jsxs(J,{children:[s.jsx(sE,{children:p.category}),s.jsxs(J,{children:[p.commentCount," comments"]})]}),s.jsx(fSt,{children:isNaN(Number(p.averageScore))?"N/A":`${p.averageScore}/7`})]},p.category)):s.jsx(J,{sx:{py:2},children:"No feedback data from the last three months"})}),s.jsxs(sE,{children:["All feedback (",c.length,")"]}),s.jsx(is,{value:i(t),children:s.jsx(gp,{rows:c,headerGroups:l,prepareRow:u})})]})};var M$={},vSt=Te;Object.defineProperty(M$,"__esModule",{value:!0});var Pne=M$.default=void 0,ySt=vSt(ke()),xSt=s,bSt=(0,ySt.default)((0,xSt.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");Pne=M$.default=bSt;const wSt=e=>{const t=m.useMemo(()=>({sortBy:[{id:"lastSeen",desc:!0}]}),[]),n=m.useMemo(()=>[{Header:"Instances",accessor:"instanceId",Cell:_s,styles:{width:"45%"}},{Header:"SDK",accessor:"sdkVersion",Cell:_s,styles:{width:"20%"}},{Header:"Last seen",accessor:"lastSeen",Cell:ay,styles:{width:"20%"}},{Header:"IP",accessor:"ip",Cell:_s,styles:{width:"15%"}}],[]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d}=Zt.useTable({columns:n,data:e,initialState:t,sortTypes:yi,autoResetHiddenColumns:!1,disableSortRemove:!0},Zt.useGlobalFilter,Zt.useSortBy);return{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d,columns:n}},SSt=({loading:e,rows:t,getTableProps:n,getTableBodyProps:r,headerGroups:o,prepareRow:i})=>s.jsxs(s.Fragment,{children:[s.jsx(J,{sx:{overflowX:"auto"},children:s.jsxs(cq,{...n(),children:[s.jsx(ea,{headerGroups:o}),s.jsx(Ts,{...r(),children:t.map(a=>{i(a);const{key:l,...c}=a.getRowProps();return s.jsx(Mi,{hover:!0,...c,children:a.cells.map(u=>{const{key:d,...p}=u.getCellProps();return s.jsx(es,{...p,children:u.render("Cell")},d)})},l)})})]})}),s.jsx(X,{condition:t.length===0&&!e,show:s.jsx($r,{children:s.jsx("p",{children:"There's no data for any connected instances to display. Have you configured your clients correctly?"})})})]}),CSt={environments:[],featureCount:0,projects:[],issues:{missingStrategies:[]}},Ane=(e,t={})=>{const n=bt(`api/admin/metrics/applications/${e}/overview`),{data:r,error:o}=_n(n,jSt,t);return{data:r||CSt,error:o,loading:!o&&!r}},jSt=async e=>await(await fetch(e).then(Jt("Application overview"))).json(),ESt=(e,t,n={})=>{const r=bt(`api/admin/metrics/instances/${e}/environment/${t}`),{data:o,error:i}=Bi(!!t,{instances:[]},r,TSt,n);return{data:o||{instances:[]},error:i,loading:!i&&!o}},TSt=async e=>await(await fetch(e).then(Jt("Connected instances"))).json(),kSt=e=>{const{data:t}=Ane(e),n=t.environments.map(i=>i.name).sort(),[r,o]=xce("environment",ho(Ss,n[0]));return m.useEffect(()=>{!r&&n.length>0&&o(n[0])},[JSON.stringify(n)]),{currentEnvironment:r,setCurrentEnvironment:o,environments:n}},_St=()=>{const{trackEvent:e}=Kt();return m.useEffect(()=>{e("sdk-reporting",{props:{eventType:"connected instances opened"}})},[]),()=>{e("sdk-reporting",{props:{eventType:"connected instances environment changed"}})}},RSt=()=>{const e=_St(),t=Or("name"),{currentEnvironment:n,setCurrentEnvironment:r,environments:o}=kSt(t),{data:i,loading:a}=ESt(t,n),l=m.useMemo(()=>{const h=({instanceId:g,sdkVersion:v,clientIp:b,lastSeen:y})=>({instanceId:g,ip:b||"",sdkVersion:v||"",lastSeen:y||""});return n?i.instances.map(h):[]},[JSON.stringify(i),n]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:p,prepareRow:f}=wSt(l);return s.jsxs(J,{children:[s.jsxs(J,{sx:{mb:3},children:[s.jsx(J,{sx:{mb:2},children:"Select which environment to display data for. Only environments that have received traffic for this application will be shown here."}),s.jsx(X,{condition:!!n,show:s.jsx(dSe,{color:"primary",value:n,exclusive:!0,onChange:(h,g)=>{g!==null&&(e(),r(g))},children:o.map(h=>s.jsx(iSe,{value:h,children:h},h))})})]}),s.jsx(SSt,{loading:a,headerGroups:d,prepareRow:f,getTableBodyProps:u,getTableProps:c,rows:p})]})},PSt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=ar({propagateErrors:!0}),o="api/admin/metrics/applications";return{storeApplicationMetaData:async(l,c,u)=>{const d={};d[c]=u;const p=`${o}/${l}`,f=t(p,{method:"POST",body:JSON.stringify(d)});return e(f.caller,f.id)},deleteApplication:async l=>{const c=`${o}/${encodeURIComponent(l)}`,u=t(c,{method:"DELETE"});return e(u.caller,u.id)},errors:n,loading:r}},ASt=(e,t={})=>{const n=bt(`api/admin/metrics/applications/${e}`),r=async()=>fetch(n,{method:"GET"}).then(Jt("Application")).then(d=>d.json()),o=`api/admin/metrics/applications/${e}`,{data:i,error:a}=_n(o,r,{...t}),[l,c]=m.useState(!a&&!i),u=()=>{Io(o)};return m.useEffect(()=>{c(!a&&!i)},[i,a]),{application:i||{appName:e,color:"",createdAt:"2022-02-02T21:04:00.268Z",description:"",instances:[],strategies:[],seenToggles:[],url:""},error:a,loading:l,refetchApplication:u,APPLICATION_CACHE_KEY:o}};var D$={},ISt=Te;Object.defineProperty(D$,"__esModule",{value:!0});var L$=D$.default=void 0,$St=ISt(ke()),OSt=s,MSt=(0,$St.default)((0,OSt.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");L$=D$.default=MSt;const DSt=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",alignSelf:"stretch",fontSize:e.fontSizes.smallBody})),LSt=x(J)(({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})),FSt=x(J)(({theme:e})=>({color:e.palette.warning.dark,fontWeight:e.fontWeight.bold})),F$=x("ul")(({theme:e})=>({padding:e.spacing(0,0,0,2)})),N$=x("li")(({theme:e})=>({fontWeight:e.fontWeight.bold})),NSt=x(J)(({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}`})),B$=x(J)(({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}`})),z$=x(J)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1.5),alignItems:"center"})),Ine=x(xt)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"underline"})),BSt=({features:e})=>{const{hasAccess:t}=m.useContext($o),n=e.length;return n===0?null:s.jsxs(B$,{children:[s.jsx(J,{children:`We detected ${n} feature flag${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),s.jsx(F$,{children:e.map(r=>s.jsxs(z$,{children:[s.jsx(N$,{children:r}),s.jsx(X,{condition:t(N2),show:s.jsx(Ine,{to:`/projects/default?create=true&name=${r}`,children:"Create feature flag"},r)})]},r))})]})},zSt=({strategies:e})=>{const{hasAccess:t}=m.useContext($o),n=e.length;return n===0?null:s.jsxs(B$,{children:[s.jsx(J,{children:`We detected ${n} strategy type${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),s.jsx(F$,{children:e.map(r=>s.jsxs(z$,{children:[s.jsx(N$,{children:r}),s.jsx(X,{condition:t(B2),show:s.jsx(Ine,{to:"/strategies/create",children:"Create strategy type"},r)})]},r))})]})},HSt=({sdks:e})=>e.length===0?null:s.jsxs(B$,{children:[s.jsx(J,{children:"We detected the following outdated SDKs"}),s.jsx(F$,{children:e.map(t=>s.jsx(z$,{children:s.jsx(N$,{children:t})},t))})]}),$ne=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"}},WSt=({application:e})=>{const t=$ne(e);if(t.applicationMode==="success")return null;const{issueCount:n,outdatedSdks:r,missingFeatures:o}=t;return s.jsxs(DSt,{children:[s.jsxs(LSt,{children:[s.jsx(L$,{}),s.jsxs(FSt,{children:["We detected ",n," issue",n!==1?"s":""," in this application"]})]}),s.jsxs(NSt,{children:[s.jsx(HSt,{sdks:r}),s.jsx(BSt,{features:o}),s.jsx(zSt,{strategies:e.issues.missingStrategies})]})]})};var One={exports:{}};(function(e,t){(function(n,r){e.exports=r(m)})(typeof self<"u"?self:Cn,function(n){return function(r){var o={};function i(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,i),l.l=!0,l.exports}return i.m=r,i.c=o,i.d=function(a,l,c){i.o(a,l)||Object.defineProperty(a,l,{enumerable:!0,get:c})},i.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},i.t=function(a,l){if(1&l&&(a=i(a)),8&l||4&l&&typeof a=="object"&&a&&a.__esModule)return a;var c=Object.create(null);if(i.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:a}),2&l&&typeof a!="string")for(var u in a)i.d(c,u,(function(d){return a[d]}).bind(null,u));return c},i.n=function(a){var l=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(l,"a",l),l},i.o=function(a,l){return Object.prototype.hasOwnProperty.call(a,l)},i.p="lib/",i(i.s=5)}([function(r,o){r.exports=n},function(r,o,i){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(i(0));o.ArcherContainerContext=l.default.createContext(null),o.ArcherContainerContextProvider=o.ArcherContainerContext.Provider},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.encodeId=void 0,o.encodeId=function(a){return encodeURI(a).replace(/%/g,"_")}},function(r,o,i){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,i){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,i){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=i(6);Object.defineProperty(o,"ArcherElement",{enumerable:!0,get:function(){return a(l).default}});var c=i(11);Object.defineProperty(o,"ArcherContainer",{enumerable:!0,get:function(){return a(c).default}})},function(r,o,i){var a=this&&this.__createBinding||(Object.create?function(v,b,y,w){w===void 0&&(w=y);var S=Object.getOwnPropertyDescriptor(b,y);S&&("get"in S?b.__esModule:!S.writable&&!S.configurable)||(S={enumerable:!0,get:function(){return b[y]}}),Object.defineProperty(v,w,S)}:function(v,b,y,w){w===void 0&&(w=y),v[w]=b[y]}),l=this&&this.__setModuleDefault||(Object.create?function(v,b){Object.defineProperty(v,"default",{enumerable:!0,value:b})}:function(v,b){v.default=b}),c=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var b={};if(v!=null)for(var y in v)y!=="default"&&Object.prototype.hasOwnProperty.call(v,y)&&a(b,v,y);return l(b,v),b};Object.defineProperty(o,"__esModule",{value:!0});var u=c(i(0)),d=i(7),p=i(1),f=i(2),h=i(8),g=i(10);o.default=function(v){var b=v.id,y=v.relations,w=y===void 0?[]:y,S=v.children,j=(0,u.useMemo)(function(){return(0,f.encodeId)(b)},[b]),E=(0,u.useContext)(p.ArcherContainerContext),C=(0,u.useRef)(),T=(0,u.useCallback)(function(M){var H=(0,g.generateSourceToTarget)(j,M);(0,g.assertContextExists)(E),E.registerTransitions(j,H)},[E,j]),k=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterTransitions(j)},[E,j]),_=(0,u.useCallback)(function(M){M&&((0,g.assertContextExists)(E),E.registerChild(j,M))},[j,E]),A=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterChild(j)},[E,j]);(0,d.useIsomorphicLayoutEffect)(function(){return _(C.current),function(){return A()}},[_,A]),(0,h.useDeepCompareEffect)(function(){return T(w),function(){return k()}},[T,w,k]),u.default.Children.only(S);var O=S;return u.default.cloneElement(O,Object.assign(Object.assign({},O.props),{ref:C}))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.useIsomorphicLayoutEffect=void 0;var a=i(0);o.useIsomorphicLayoutEffect=typeof window<"u"?a.useLayoutEffect:a.useEffect},function(r,o,i){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=i(0),c=a(i(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,i){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,g){if(h===g)return!0;if(h&&g&&typeof h=="object"&&typeof g=="object"){var v,b,y,w=a(h),S=a(g);if(w&&S){if((b=h.length)!=g.length)return!1;for(v=b;v--!=0;)if(!f(h[v],g[v]))return!1;return!0}if(w!=S)return!1;var j=h instanceof Date,E=g instanceof Date;if(j!=E)return!1;if(j&&E)return h.getTime()==g.getTime();var C=h instanceof RegExp,T=g instanceof RegExp;if(C!=T)return!1;if(C&&T)return h.toString()==g.toString();var k=l(h);if((b=k.length)!==l(g).length)return!1;for(v=b;v--!=0;)if(!c.call(g,k[v]))return!1;if(u&&h instanceof Element&&g instanceof Element)return h===g;for(v=b;v--!=0;)if(!((y=k[v])==="_owner"&&h.$$typeof||f(h[y],g[y])))return!1;return!0}return h!=h&&g!=g}(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,i){Object.defineProperty(o,"__esModule",{value:!0}),o.generateSourceToTarget=o.assertContextExists=void 0;var a=i(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,g=u.className,v=u.style,b=u.order,y=b===void 0?0:b,w=u.domAttributes,S=u.cursor,j=u.hitSlop;return{source:{id:(0,a.encodeId)(l),anchor:p},target:{id:(0,a.encodeId)(d),anchor:f},className:g,label:h,style:v,order:y,domAttributes:w,cursor:S,hitSlop:j}})}},function(r,o,i){function a(C,T,k){return T in C?Object.defineProperty(C,T,{value:k,enumerable:!0,configurable:!0,writable:!0}):C[T]=k,C}function l(C,T){return function(k){if(Array.isArray(k))return k}(C)||function(k,_){var A=k==null?null:typeof Symbol<"u"&&k[Symbol.iterator]||k["@@iterator"];if(A!=null){var O,M,H=[],P=!0,$=!1;try{for(A=A.call(k);!(P=(O=A.next()).done)&&(H.push(O.value),!_||H.length!==_);P=!0);}catch(D){$=!0,M=D}finally{try{P||A.return==null||A.return()}finally{if($)throw M}}return H}}(C,T)||function(k,_){if(k){if(typeof k=="string")return c(k,_);var A=Object.prototype.toString.call(k).slice(8,-1);if(A==="Object"&&k.constructor&&(A=k.constructor.name),A==="Map"||A==="Set")return Array.from(k);if(A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return c(k,_)}}(C,T)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
451
451
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function c(C,T){(T==null||T>C.length)&&(T=C.length);for(var k=0,_=new Array(T);k<T;k++)_[k]=C[k];return _}var u=this&&this.__createBinding||(Object.create?function(C,T,k,_){_===void 0&&(_=k);var A=Object.getOwnPropertyDescriptor(T,k);A&&("get"in A?T.__esModule:!A.writable&&!A.configurable)||(A={enumerable:!0,get:function(){return T[k]}}),Object.defineProperty(C,_,A)}:function(C,T,k,_){_===void 0&&(_=k),C[_]=T[k]}),d=this&&this.__setModuleDefault||(Object.create?function(C,T){Object.defineProperty(C,"default",{enumerable:!0,value:T})}:function(C,T){C.default=T}),p=this&&this.__importStar||function(C){if(C&&C.__esModule)return C;var T={};if(C!=null)for(var k in C)k!=="default"&&Object.prototype.hasOwnProperty.call(C,k)&&u(T,C,k);return d(T,C),T},f=this&&this.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(o,"__esModule",{value:!0});var h=p(i(0)),g=f(i(12)),v=i(1),b=i(14),y=i(4),w=i(19),S=i(20),j={position:"absolute",width:"100%",height:"100%",top:0,left:0,pointerEvents:"none"},E=h.default.forwardRef(function(C,T){var k=C.endShape,_=k===void 0?y.endShapeDefaultProp:k,A=C.strokeColor,O=A===void 0?"#f00":A,M=C.strokeWidth,H=M===void 0?2:M,P=C.svgContainerStyle,$=P===void 0?{}:P,D=C.noCurves,z=C.children,B=C.className,L=C.endMarker,I=C.lineStyle,q=C.offset,ee=C.startMarker,W=C.strokeDasharray,oe=C.style,ne=l((0,h.useState)({}),2),ce=ne[0],xe=ne[1],re=l((0,h.useState)({}),2),ve=re[0],he=re[1],ye=(0,h.useRef)(new g.default(function(){ge()})).current,Pe=(0,h.useRef)(null),Ee=l(h.default.useState(),2)[1],Re=(0,h.useRef)("arrow".concat(Math.random().toString().slice(2))).current;(0,h.useImperativeHandle)(T,function(){return{refreshScreen:ge,arrowMarkerUniquePrefix:Re}});var _e,ge=h.default.useCallback(function(){return Ee({})},[]),ze=(0,h.useCallback)(function(wt,st){he(function(Ce){return Object.assign(Object.assign({},Ce),a({},wt,st))})},[]),Se=(0,h.useCallback)(function(wt){he(function(st){var Ce=Object.assign({},st);return delete Ce[wt],Ce})},[]),Ve=(0,h.useCallback)(function(wt,st){xe(function(Ce){return Ce[wt]===st?Ce:Object.assign(Object.assign({},Ce),a({},wt,st))})},[]),Ne=(0,h.useCallback)(function(wt){xe(function(st){var Ce=Object.assign({},st);return delete Ce[wt],Ce})},[]),Xe=(0,h.useMemo)(function(){return Object.assign(Object.assign({},j),$)},[$]);_e=typeof z=="function"?z(v.ArcherContainerContext):z,(0,S.useResizeListener)(ge),(0,S.useObserveElements)(ce,ye);var yt=(0,h.useMemo)(function(){return{registerTransitions:ze,unregisterTransitions:Se,registerChild:Ve,unregisterChild:Ne}},[ze,Se,Ve,Ne]);return h.default.createElement(v.ArcherContainerContextProvider,{value:yt},h.default.createElement("div",{style:Object.assign(Object.assign({},oe),{position:"relative"}),className:B},h.default.createElement("svg",{style:Xe},h.default.createElement("defs",null,h.default.createElement(w.ArrowMarkers,{endShape:_,sourceToTargetsMap:ve,strokeColor:O,uniqueId:Re})),h.default.createElement(b.SvgArrows,{startMarker:ee,endMarker:L,endShape:_,strokeColor:O,strokeWidth:H,strokeDasharray:W,noCurves:D,lineStyle:I,offset:q,parentCurrent:Pe.current,refs:ce,uniqueId:Re,sourceToTargetsMap:ve})),h.default.createElement("div",{style:{height:"100%"},ref:Pe},_e)))});o.default=E},function(r,o,i){i.r(o),(function(a){var l=function(){if(typeof Map<"u")return Map;function P($,D){var z=-1;return $.some(function(B,L){return B[0]===D&&(z=L,!0)}),z}return function(){function $(){this.__entries__=[]}var D={size:{configurable:!0}};return D.size.get=function(){return this.__entries__.length},$.prototype.get=function(z){var B=P(this.__entries__,z),L=this.__entries__[B];return L&&L[1]},$.prototype.set=function(z,B){var L=P(this.__entries__,z);~L?this.__entries__[L][1]=B:this.__entries__.push([z,B])},$.prototype.delete=function(z){var B=this.__entries__,L=P(B,z);~L&&B.splice(L,1)},$.prototype.has=function(z){return!!~P(this.__entries__,z)},$.prototype.clear=function(){this.__entries__.splice(0)},$.prototype.forEach=function(z,B){B===void 0&&(B=null);for(var L=0,I=this.__entries__;L<I.length;L+=1){var q=I[L];z.call(B,q[1],q[0])}},Object.defineProperties($.prototype,D),$}()}(),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(P){return setTimeout(function(){return P(Date.now())},1e3/60)}}(),p=2,f=["top","right","bottom","left","width","height","size","weight"],h=typeof MutationObserver<"u",g=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(P,$){var D=!1,z=!1,B=0;function L(){D&&(D=!1,P()),z&&q()}function I(){d(L)}function q(){var ee=Date.now();if(D){if(ee-B<p)return;z=!0}else D=!0,z=!1,setTimeout(I,$);B=ee}return q}(this.refresh.bind(this),20)};g.prototype.addObserver=function(P){~this.observers_.indexOf(P)||this.observers_.push(P),this.connected_||this.connect_()},g.prototype.removeObserver=function(P){var $=this.observers_,D=$.indexOf(P);~D&&$.splice(D,1),!$.length&&this.connected_&&this.disconnect_()},g.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},g.prototype.updateObservers_=function(){var P=this.observers_.filter(function($){return $.gatherActive(),$.hasActive()});return P.forEach(function($){return $.broadcastActive()}),P.length>0},g.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)},g.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)},g.prototype.onTransitionEnd_=function(P){var $=P.propertyName;$===void 0&&($=""),f.some(function(D){return!!~$.indexOf(D)})&&this.refresh()},g.getInstance=function(){return this.instance_||(this.instance_=new g),this.instance_},g.instance_=null;var v=function(P,$){for(var D=0,z=Object.keys($);D<z.length;D+=1){var B=z[D];Object.defineProperty(P,B,{value:$[B],enumerable:!1,writable:!1,configurable:!0})}return P},b=function(P){return P&&P.ownerDocument&&P.ownerDocument.defaultView||u},y=T(0,0,0,0);function w(P){return parseFloat(P)||0}function S(P){for(var $=[],D=arguments.length-1;D-- >0;)$[D]=arguments[D+1];return $.reduce(function(z,B){return z+w(P["border-"+B+"-width"])},0)}function j(P){var $=P.clientWidth,D=P.clientHeight;if(!$&&!D)return y;var z=b(P).getComputedStyle(P),B=function(ne){for(var ce={},xe=0,re=["top","right","bottom","left"];xe<re.length;xe+=1){var ve=re[xe],he=ne["padding-"+ve];ce[ve]=w(he)}return ce}(z),L=B.left+B.right,I=B.top+B.bottom,q=w(z.width),ee=w(z.height);if(z.boxSizing==="border-box"&&(Math.round(q+L)!==$&&(q-=S(z,"left","right")+L),Math.round(ee+I)!==D&&(ee-=S(z,"top","bottom")+I)),!function(ne){return ne===b(ne).document.documentElement}(P)){var W=Math.round(q+L)-$,oe=Math.round(ee+I)-D;Math.abs(W)!==1&&(q-=W),Math.abs(oe)!==1&&(ee-=oe)}return T(B.left,B.top,q,ee)}var E=function(){return typeof SVGGraphicsElement<"u"?function(P){return P instanceof b(P).SVGGraphicsElement}:function(P){return P instanceof b(P).SVGElement&&typeof P.getBBox=="function"}}();function C(P){return c?E(P)?function($){var D=$.getBBox();return T(0,0,D.width,D.height)}(P):j(P):y}function T(P,$,D,z){return{x:P,y:$,width:D,height:z}}var k=function(P){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=T(0,0,0,0),this.target=P};k.prototype.isActive=function(){var P=C(this.target);return this.contentRect_=P,P.width!==this.broadcastWidth||P.height!==this.broadcastHeight},k.prototype.broadcastRect=function(){var P=this.contentRect_;return this.broadcastWidth=P.width,this.broadcastHeight=P.height,P};var _=function(P,$){var D=function(z){var B=z.x,L=z.y,I=z.width,q=z.height,ee=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,W=Object.create(ee.prototype);return v(W,{x:B,y:L,width:I,height:q,top:L,right:B+I,bottom:q+L,left:B}),W}($);v(this,{target:P,contentRect:D})},A=function(P,$,D){if(this.activeObservations_=[],this.observations_=new l,typeof P!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=P,this.controller_=$,this.callbackCtx_=D};A.prototype.observe=function(P){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element<"u"&&Element instanceof Object){if(!(P instanceof b(P).Element))throw new TypeError('parameter 1 is not of type "Element".');var $=this.observations_;$.has(P)||($.set(P,new k(P)),this.controller_.addObserver(this),this.controller_.refresh())}},A.prototype.unobserve=function(P){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element<"u"&&Element instanceof Object){if(!(P instanceof b(P).Element))throw new TypeError('parameter 1 is not of type "Element".');var $=this.observations_;$.has(P)&&($.delete(P),$.size||this.controller_.removeObserver(this))}},A.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},A.prototype.gatherActive=function(){var P=this;this.clearActive(),this.observations_.forEach(function($){$.isActive()&&P.activeObservations_.push($)})},A.prototype.broadcastActive=function(){if(this.hasActive()){var P=this.callbackCtx_,$=this.activeObservations_.map(function(D){return new _(D.target,D.broadcastRect())});this.callback_.call(P,$,P),this.clearActive()}},A.prototype.clearActive=function(){this.activeObservations_.splice(0)},A.prototype.hasActive=function(){return this.activeObservations_.length>0};var O=typeof WeakMap<"u"?new WeakMap:new l,M=function(P){if(!(this instanceof M))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var $=g.getInstance(),D=new A(P,$,this);O.set(this,D)};["observe","unobserve","disconnect"].forEach(function(P){M.prototype[P]=function(){return($=O.get(this))[P].apply($,arguments);var $}});var H=function(){return u.ResizeObserver!==void 0?u.ResizeObserver:M}();o.default=H}).call(this,i(13))},function(r,o){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch{typeof window=="object"&&(i=window)}r.exports=i},function(r,o,i){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(i(0)),c=i(15),u=a(i(17)),d=i(3),p=function(f){var h,g,v=f.style||{},b=v.startMarker||f.startMarker,y=(g=(h=v.endMarker)!==null&&h!==void 0?h:f.endMarker)===null||g===void 0||g,w=(0,d.createShapeObj)(v,f.endShape),S=f.domAttributes,j=f.cursor,E=f.hitSlop,C=v.strokeColor||f.strokeColor,T=v.strokeWidth||f.strokeWidth,k=v.strokeDasharray||f.strokeDasharray,_=!(!v.noCurves&&!f.noCurves),A=v.lineStyle||f.lineStyle||(_?"angle":"curve"),O=f.offset||0,M=f.source.anchor,H=(0,c.getPointCoordinatesFromAnchorPosition)(f.source.anchor,f.source.id,f.parentCoordinates,f.refs),P=f.target.anchor,$=(0,c.getPointCoordinatesFromAnchorPosition)(f.target.anchor,f.target.id,f.parentCoordinates,f.refs);return H?$?l.default.createElement(u.default,{className:f.className,startingPoint:H,startingAnchorOrientation:M,endingPoint:$,endingAnchorOrientation:P,strokeColor:C,strokeWidth:T,strokeDasharray:k,arrowLabel:f.label,arrowMarkerId:(0,d.getMarkerId)(f.uniqueId,f.source,f.target),lineStyle:A,offset:O,enableStartMarker:!!b,disableEndMarker:!y,endShape:w,domAttributes:S,hitSlop:E,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(g){return l.default.createElement(p,{key:JSON.stringify({source:g.source,target:g.target}),source:g.source,target:g.target,className:g.className,label:g.label,style:g.style||{},domAttributes:g.domAttributes,hitSlop:g.hitSlop,cursor:g.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,i){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(i(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 g=u(h[p]);if(!g)return null;var v=function(b,y){switch(b){case"top":return c(y).add(new l.default(y.width/2,0));case"bottom":return c(y).add(new l.default(y.width/2,y.height));case"left":return c(y).add(new l.default(0,y.height/2));case"right":return c(y).add(new l.default(y.width,y.height/2));case"middle":return c(y).add(new l.default(y.width/2,y.height/2));default:return console.error("[React Archer] Invalid anchor position was provided. Not drawing the arrow."),null}}(d,g);return v?v.substract(f):null}},function(r,o,i){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,i){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(i(0)),c=i(18);function u(h,g,v,b,y,w,S,j){var E=(0,c.computeArrowDirectionVector)(y),C=E.arrowX,T=E.arrowY;if(w==="straight"&&S!==void 0&&j!==void 0){var k=Math.atan2(j-g,S-h);C=Math.cos(k),T=Math.sin(k)}return{xPoint:h+C*v*b/2,yPoint:g+T*v*b/2}}function d(h,g,v,b,y){return y==="top"||y==="bottom"?{xAnchor1:h,yAnchor1:g+(b-g)/2}:y==="left"||y==="right"?{xAnchor1:h+(v-h)/2,yAnchor1:g}:{xAnchor1:h,yAnchor1:g}}function p(h,g,v,b,y){return y==="top"||y==="bottom"?{xAnchor2:v,yAnchor2:b-(b-g)/2}:y==="left"||y==="right"?{xAnchor2:v-(v-h)/2,yAnchor2:b}:{xAnchor2:v,yAnchor2:b}}function f(h,g,v,b){return{xLabel:v>h?h:v,yLabel:b>g?g:b,labelWidth:Math.max(Math.abs(v-h),1),labelHeight:Math.max(Math.abs(b-g),1)}}o.computeArrowPointAccordingToArrowHead=u,o.computeStartingAnchorPosition=d,o.computeEndingAnchorPosition=p,o.computeLabelDimensions=f,o.default=function(h){var g=h.className,v=h.startingPoint,b=h.startingAnchorOrientation,y=h.endingPoint,w=h.endingAnchorOrientation,S=h.strokeColor,j=h.strokeWidth,E=h.strokeDasharray,C=h.arrowLabel,T=h.arrowMarkerId,k=h.lineStyle,_=h.offset,A=h.enableStartMarker,O=h.disableEndMarker,M=h.endShape,H=h.domAttributes,P=h.hitSlop,$=P===void 0?10:P,D=h.cursor,z=D===void 0?"pointer":D,B=M.circle?2*M.circle.radius:2*M.arrow.arrowLength,L=u(v.x,v.y,A?B:0,j,b,k,y.x,y.y),I=L.xPoint,q=L.yPoint,ee=u(y.x,y.y,O?0:B,j,w,k,v.x,v.y),W=ee.xPoint,oe=ee.yPoint,ne=d(I,q,W,oe,b),ce=ne.xAnchor1,xe=ne.yAnchor1,re=p(I,q,W,oe,w),ve=function(ge){var ze=ge.xStart,Se=ge.yStart,Ve=ge.xAnchor1,Ne=ge.yAnchor1,Xe=ge.xAnchor2,yt=ge.yAnchor2,wt=ge.xEnd,st=ge.yEnd,Ce=ge.lineStyle,Be=ge.offset;if(Be&&Be!==0){var ue=Ce==="straight"?Math.atan2(st-Se,wt-ze):Math.atan2(Ne-Se,Ve-ze),fe=Be*Math.cos(ue),me=Be*Math.sin(ue);Ce!=="straight"&&(ze+=fe,Se+=me),wt-=fe,st-=me}var Ye="M".concat(ze,",").concat(Se," ");return["curve","angle"].includes(Ce)&&(Ye+="".concat(Ce==="curve"?"C":"").concat(Ve,",").concat(Ne," ").concat(Xe,",").concat(yt," ")),Ye+="".concat(wt,",").concat(st)}({xStart:I,yStart:q,xAnchor1:ce,yAnchor1:xe,xAnchor2:re.xAnchor2,yAnchor2:re.yAnchor2,xEnd:W,yEnd:oe,lineStyle:k,offset:_}),he=f(I,q,W,oe),ye=he.xLabel,Pe=he.yLabel,Ee=he.labelWidth,Re=he.labelHeight,_e="url(#".concat(T,")");return l.default.createElement("g",{className:g},l.default.createElement("path",{d:ve,style:{fill:"none",stroke:S,strokeWidth:j,strokeDasharray:E},markerStart:A?_e:void 0,markerEnd:O?void 0:_e}),H&&l.default.createElement("path",Object.assign({d:ve,style:{fill:"none",stroke:"rgba(0, 0, 0, 0)",strokeWidth:$,cursor:H?z:"initial",pointerEvents:"all"}},H)),C&&l.default.createElement("foreignObject",{x:ye,y:Pe,width:Ee,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,C))))}},function(r,o,i){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,i){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(i(0)),c=i(4),u=i(3),d=function(f,h){return function(){var g,v,b,y,w,S,j,E,C,T,k,_,A=((v=(g=f.endShape)===null||g===void 0?void 0:g.circle)===null||v===void 0?void 0:v.radius)||((b=h.circle)===null||b===void 0?void 0:b.radius)||c.endShapeDefaultProp.circle.radius,O=((w=(y=f.endShape)===null||y===void 0?void 0:y.circle)===null||w===void 0?void 0:w.strokeWidth)||((S=h.circle)===null||S===void 0?void 0:S.strokeWidth)||c.endShapeDefaultProp.circle.strokeWidth,M=((E=(j=f.endShape)===null||j===void 0?void 0:j.circle)===null||E===void 0?void 0:E.strokeColor)||((C=h.circle)===null||C===void 0?void 0:C.strokeColor)||c.endShapeDefaultProp.circle.strokeColor,H=((k=(T=f.endShape)===null||T===void 0?void 0:T.circle)===null||k===void 0?void 0:k.fillColor)||((_=h.circle)===null||_===void 0?void 0:_.fillColor)||c.endShapeDefaultProp.circle.fillColor;return{markerWidth:4*A,markerHeight:4*A,refX:2*A+O,refY:2*A,path:l.default.createElement("circle",{cx:2*A,cy:2*A,r:A,fill:H,stroke:M,strokeWidth:O})}}},p=function(f,h,g){return function(){var v,b,y,w,S,j,E,C,T=f.strokeColor||g,k=(S=(y=(b=(v=f.endShape)===null||v===void 0?void 0:v.arrow)===null||b===void 0?void 0:b.arrowLength)!==null&&y!==void 0?y:(w=h==null?void 0:h.arrow)===null||w===void 0?void 0:w.arrowLength)!==null&&S!==void 0?S:c.endShapeDefaultProp.arrow.arrowLength,_=((E=(j=f.endShape)===null||j===void 0?void 0:j.arrow)===null||E===void 0?void 0:E.arrowThickness)||((C=h==null?void 0:h.arrow)===null||C===void 0?void 0:C.arrowThickness)||c.endShapeDefaultProp.arrow.arrowThickness,A="M0,0 L0,".concat(_," L").concat(k,",").concat(_/2," z");return{markerWidth:k,markerHeight:_,refX:0,refY:_/2,path:l.default.createElement("path",{d:A,fill:T})}}};o.ArrowMarkers=function(f){var h=f.sourceToTargetsMap,g=f.endShape,v=f.strokeColor,b=f.uniqueId;return l.default.createElement(l.default.Fragment,null,(0,u.getSourceToTargets)(h).map(function(y){var w=y.source,S=y.target,j=y.style,E=function(O){var M=O.style,H=O.strokeColor,P=O.endShape,$=(0,u.getEndShapeFromStyle)(M);return{circle:d(M,P),arrow:p(M,P,H)}[$]()}({style:j===void 0?{}:j,endShape:g,strokeColor:v}),C=E.markerHeight,T=E.markerWidth,k=E.path,_=E.refX,A=E.refY;return l.default.createElement("marker",{id:(0,u.getMarkerId)(b,w,S),key:(0,u.getMarkerId)(b,w,S),markerWidth:T,markerHeight:C,refX:_,refY:A,orient:"auto-start-reverse",markerUnits:"strokeWidth"},k)}))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.useResizeListener=o.useObserveElements=void 0;var a=i(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])}}])})})(One);var aE=One.exports,H$={},VSt=Te;Object.defineProperty(H$,"__esModule",{value:!0});var by=H$.default=void 0,USt=VSt(ke()),GSt=s,qSt=(0,USt.default)((0,GSt.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");by=H$.default=qSt;var W$={},YSt=Te;Object.defineProperty(W$,"__esModule",{value:!0});var Mne=W$.default=void 0,KSt=YSt(ke()),XSt=s,JSt=(0,KSt.default)((0,XSt.jsx)("path",{d:"M14.4 6 14 4H5v17h2v-7h5.6l.4 2h7V6z"}),"Flag");Mne=W$.default=JSt;const QSt=x("table")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,marginTop:e.spacing(1)})),ed=x("td")(({theme:e})=>({verticalAlign:"top",paddingLeft:0,paddingRight:e.spacing(1)})),ZSt=x(J)(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),eCt=x(J)(({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)})),tCt=x(J)(({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})),nCt=x(jr)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),rCt=x(J)({display:"flex",justifyContent:"center",flexWrap:"wrap",gap:"60px 20px"}),oCt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,fontWeight:e.fontWeight.bold})),Dne=x(Z)(({theme:e,mode:t})=>({gap:e.spacing(1),fontSize:e.fontSizes.smallBody,color:e.palette[t].dark,display:"flex",alignItems:"center"})),iCt=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(3),color:e.palette.secondary.main,paddingTop:e.spacing(2)})),MB=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(.5)})),DB=x(J)(({theme:e})=>({color:e.palette.text.primary,display:"flex",alignItems:"center"})),sCt=()=>{const e=m.useRef(null),[t,n]=m.useState("100%");return m.useLayoutEffect(()=>{var r;n(`${(r=e.current)==null?void 0:r.scrollWidth}px`)},[e,n]),{elementRef:e,width:t}},aCt=()=>s.jsxs(Dne,{mode:"success",children:[s.jsx(by,{sx:e=>({color:e.palette.success.main})})," ","Everything looks good!"]}),lCt=({children:e})=>s.jsxs(Dne,{mode:"warning",children:[s.jsx(L$,{sx:t=>({color:t.palette.warning.main})})," ",e]}),cCt=({environmentCount:e,featureCount:t})=>s.jsxs(iCt,{children:[s.jsxs(MB,{children:[s.jsx(lm,{}),s.jsx(DB,{children:e})]}),s.jsxs(MB,{children:[s.jsx(Mne,{}),s.jsx(DB,{children:t})]})]}),uCt=()=>{const{trackEvent:e}=Kt();return()=>{e("sdk-reporting",{props:{eventType:"environment box clicked"}})}},LB=e=>e.issues.missingFeatures.length+e.issues.outdatedSdks.length===0?"success":"warning",dCt=({data:e})=>{const t=uCt(),n=Or("name"),{elementRef:r,width:o}=sCt(),i=Ot(),a=qt(),l=$ne(e);return s.jsx(J,{sx:{width:o},children:s.jsxs(aE.ArcherContainer,{strokeColor:a.palette.secondary.border,endMarker:!1,children:[s.jsx(ZSt,{children:s.jsx(aE.ArcherElement,{id:"application",relations:e.environments.map(c=>({targetId:c.name,targetAnchor:"top",sourceAnchor:"bottom",style:{strokeColor:LB(c)==="success"?a.palette.secondary.border:a.palette.warning.border}})),children:s.jsxs(eCt,{mode:l.applicationMode,children:[s.jsx(Z,{sx:c=>({fontSize:c.fontSizes.smallerBody}),color:"text.secondary",children:"Application"}),s.jsx(Z,{sx:c=>({fontSize:c.fontSizes.bodySize,fontWeight:c.fontWeight.bold}),children:n}),s.jsx(cCt,{environmentCount:e.environments.length,featureCount:e.featureCount}),s.jsx(nCt,{}),l.applicationMode==="success"?s.jsx(aCt,{}):s.jsxs(lCt,{children:[l.issueCount," issues detected"]})]})})}),s.jsx(rCt,{ref:r,children:e.environments.map(c=>s.jsx(aE.ArcherElement,{id:c.name,children:s.jsxs(tCt,{mode:LB(c),sx:{cursor:"pointer"},onClick:u=>{t(),i(`/applications/${n}/instances?environment=${c.name}`)},children:[s.jsxs(oCt,{children:[c.name," environment"]}),s.jsx(QSt,{children:s.jsxs("tbody",{children:[s.jsxs("tr",{children:[s.jsxs(ed,{sx:{display:"flex"},children:["Instances:"," ",s.jsx(bo,{size:a.fontSizes.smallBody,tooltip:"Active instances in the last 24 hours"})]}),s.jsx(ed,{children:c.instanceCount})]}),c.backendSdks.length>0?s.jsxs("tr",{children:[s.jsx(ed,{children:"Backend SDK:"}),s.jsx(ed,{children:c.backendSdks.map(u=>s.jsx("div",{children:u},u))})]}):null,c.frontendSdks.length>0?s.jsxs("tr",{children:[s.jsx(ed,{children:"Frontend SDK:"}),s.jsx(ed,{children:c.frontendSdks.map(u=>s.jsx("div",{children:u},u))})]}):null,s.jsxs("tr",{children:[s.jsx(ed,{children:"Last seen:"}),s.jsx(ed,{children:s.jsx(Pl,{date:c.lastSeen})})]})]})})]},c.name)},c.name))})]})})},pCt=x(jr)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),fCt=x(J)(({theme:e})=>({display:"flex",padding:e.spacing(1),flexDirection:"column",alignItems:"center",gap:e.spacing(2),alignSelf:"stretch"})),hCt=x("ul")(({theme:e})=>({padding:0,display:"flex",alignItems:"center",gap:e.spacing(2),alignSelf:"stretch",listStyle:"none"})),gCt=x(xt)(({theme:e})=>({":hover,:focus-visible":{outline:"none","> *":{outline:`1px solid ${e.palette.primary.main}`}}})),mCt=x("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignSelf:"stretch"})),vCt=()=>{const{trackEvent:e}=Kt();m.useEffect(()=>{e("sdk-reporting",{props:{eventType:"application overview opened"}})},[])},yCt=()=>{Iu("Applications - Overview"),vCt();const e=Or("name");Ot();const{data:t,loading:n}=Ane(e),{openFeedback:r}=u$("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?s.jsxs("div",{children:[s.jsx("p",{children:"Loading..."}),s.jsx(OS,{})]}):s.jsx(X,{condition:!n&&t.environments.length===0,show:s.jsx(Lt,{severity:"warning",children:"No data available."}),elseShow:s.jsxs(fCt,{children:[s.jsxs(mCt,{children:[s.jsxs(hCt,{children:["Application is connected to these projects:",t.projects.map(i=>s.jsx("li",{children:s.jsx(gCt,{to:`/projects/${i}`,children:s.jsx(sn,{color:"secondary",icon:s.jsx(i$,{}),children:i})})},i))]}),s.jsx(Ue,{startIcon:s.jsx(tj,{}),variant:"outlined",onClick:o,size:"small",children:"Provide feedback"})]}),s.jsx(pCt,{}),s.jsx(WSt,{application:t}),s.jsx(dCt,{data:t})]})})},xCt=x("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(3)})),bCt=x("div")(({theme:e})=>({padding:e.spacing(0,4)})),wCt=x("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),SCt=x(If)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),CCt=()=>{const e=Ot(),t=Or("name"),{application:n,loading:r}=ASt(t),{appName:o,url:i,description:a,icon:l="apps",createdAt:c}=n,{hasAccess:u}=m.useContext($o),{deleteApplication:d}=PSt(),{locationSettings:p}=wo(),{setToastData:f,setToastApiError:h}=Nt(),{pathname:g}=Mr(),v=`/applications/${t}`,[b,y]=m.useState(!1),w=()=>{y(!b)},S=k=>Kd(k,p.locale),j=async k=>{k.preventDefault();try{await d(o),f({text:"Deleted Successfully",type:"success"}),e("/applications")}catch(_){h(Tt(_))}},E=()=>s.jsx(Gn,{open:b,onClose:w,onClick:j,title:"Are you sure you want to delete this application?"});if(r)return s.jsxs("div",{children:[s.jsx("p",{children:"Loading..."}),s.jsx(OS,{})]});if(!n)return s.jsxs("p",{children:["Application (",o,") not found"]});const C=[{title:"Overview",path:v,name:"overview"},{title:"Last seen instances (24h)",path:`${v}/instances`,name:"instances"}],T=C.find(k=>k.path===g);return s.jsxs(s.Fragment,{children:[s.jsxs(xCt,{children:[s.jsxs(cr,{children:[s.jsx(Pn,{title:o,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!!i,show:s.jsx($t,{component:kn,href:i,size:"large",children:s.jsx(Pne,{titleAccess:i})})}),s.jsx(Wo,{tooltipProps:{title:"Delete application"},onClick:w,permission:iD,children:s.jsx(Po,{})})]})}),s.jsx(J,{sx:k=>({marginTop:k.spacing(1)}),children:s.jsxs(Z,{variant:"body2",children:["Created: ",S(c)]})})]}),s.jsx(wCt,{}),s.jsx(bCt,{children:s.jsx(bR,{value:T==null?void 0:T.path,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:C.map(k=>s.jsx(SCt,{label:k.title,value:k.path,onClick:()=>e(k.path),"data-testid":`TAB_${k.title}`},k.title))})})]}),s.jsxs(cr,{children:[s.jsx(X,{condition:u(iD),show:s.jsx("div",{children:E()})}),s.jsxs(A_,{children:[s.jsx(ff,{path:"instances",element:s.jsx(RSt,{})}),s.jsx(ff,{path:"*",element:s.jsx(yCt,{})})]})]})]})},gv="api/admin/signal-endpoints",Lne=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=ar({propagateErrors:!0}),o=async d=>{const f=n(gv,{method:"POST",body:JSON.stringify(d)},"addSignalEndpoint");return(await t(f.caller,f.id)).json()},i=async(d,p)=>{const h=n(`${gv}/${d}`,{method:"PUT",body:JSON.stringify(p)},"updateSignalEndpoint");await t(h.caller,h.id)},a=async d=>{const f=n(`${gv}/${d}/on`,{method:"POST"},"enableSignalEndpoint");await t(f.caller,f.id)},l=async d=>{const f=n(`${gv}/${d}/off`,{method:"POST"},"disableSignalEndpoint");await t(f.caller,f.id)};return{addSignalEndpoint:o,updateSignalEndpoint:i,removeSignalEndpoint:async d=>{const f=n(`${gv}/${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}},jCt=x(J)({display:"flex",justifyContent:"center"}),ECt=({signalEndpointId:e,onCopyToClipboard:t,onOpenSignals:n,onEdit:r,onDelete:o})=>{const[i,a]=m.useState(null),l=!!i,c=f=>{a(f.currentTarget)},u=()=>{a(null)},d=`signal-endpoint-${e}-actions`,p=`${d}-menu`;return s.jsxs(jCt,{children:[s.jsx(kt,{title:"Signal endpoint actions",arrow:!0,describeChild:!0,children:s.jsx($t,{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:s.jsx(pm,{})})}),s.jsx(_l,{id:p,anchorEl:i,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:s.jsxs(om,{"aria-labelledby":d,children:[s.jsxs(Cr,{sx:yx,onClick:t,children:[s.jsx(Zo,{children:s.jsx(oh,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Copy URL"})})]}),s.jsx(Cd,{permission:ts,children:({hasAccess:f})=>s.jsxs(Cr,{sx:yx,onClick:n,disabled:!f,children:[s.jsx(Zo,{children:s.jsx(oy,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"View signals"})})]})}),s.jsx(Cd,{permission:ts,children:({hasAccess:f})=>s.jsxs(Cr,{sx:yx,onClick:r,disabled:!f,children:[s.jsx(Zo,{children:s.jsx(ns,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Edit"})})]})}),s.jsx(Cd,{permission:ts,children:({hasAccess:f})=>s.jsxs(Cr,{sx:yx,onClick:o,disabled:!f,children:[s.jsx(Zo,{children:s.jsx(Po,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Remove"})})]})})]})})]})},TCt=({signalEndpoint:e,open:t,setOpen:n,onConfirm:r})=>s.jsx(Gn,{title:"Delete signal endpoint?",open:t,primaryButtonText:"Delete signal endpoint",secondaryButtonText:"Cancel",onClick:()=>r(e),onClose:()=>{n(!1)},children:s.jsxs("p",{children:["You are about to delete signal endpoint:"," ",s.jsx("strong",{children:e==null?void 0:e.name})]})}),kCt=({checked:e,setChecked:t,title:n})=>s.jsx(En,{children:s.jsx(kt,{title:n||(e?"Disable":"Enable"),arrow:!0,children:s.jsx(fa,{checked:e,onChange:r=>t(r.target.checked)})})}),_Ct=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),RCt=({signalEndpoint:{tokens:e},value:t,onCreateToken:n})=>{const{searchQuery:r}=ga();return!e||e.length===0?n?s.jsx(Rl,{title:"Create token",onClick:n}):s.jsx(En,{children:"0 tokens"}):s.jsx(En,{children:s.jsx(ih,{tooltip:s.jsx(s.Fragment,{children:e==null?void 0:e.map(({id:o,name:i})=>s.jsx(_Ct,{children:s.jsx(Kr,{search:r,children:i})},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`})})},lE="api/admin/signal-endpoints",Fne=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=ar({propagateErrors:!0});return{addSignalEndpointToken:async(l,c)=>{const d=n(`${lE}/${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(`${lE}/${l}/tokens/${c}`,{method:"PUT",body:JSON.stringify(u)},"updateSignalEndpointToken");await t(p.caller,p.id)},removeSignalEndpointToken:async(l,c)=>{const d=n(`${lE}/${l}/tokens/${c}`,{method:"DELETE"},"removeSignalEndpointToken");await t(d.caller,d.id)},errors:r,loading:e}},PCt=x(J)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",lineHeight:e.spacing(2.75)})),ACt=x(qr)({marginRight:0}),ICt=x("span")(({theme:e})=>({marginLeft:e.spacing(.5),fontSize:e.fontSizes.smallBody})),$Ct=({checked:e,setChecked:t,children:n,...r})=>s.jsxs(PCt,{...r,children:[n,s.jsx(ACt,{control:s.jsx(fa,{checked:e,onChange:o=>t(o.target.checked)}),label:s.jsx(ICt,{children:e?"Enabled":"Disabled"})})]}),FB={name:void 0,tokenName:void 0};var y1=(e=>(e.LATER="later",e.NOW="now",e))(y1||{});const OCt=e=>{const{signalEndpoints:t}=gm(),[n,r]=m.useState(!1),[o,i]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState("later"),[d,p]=m.useState(""),f=()=>{r((e==null?void 0:e.enabled)??!0),i((e==null?void 0:e.name)||""),l((e==null?void 0:e.description)||""),u("later"),p(""),b(!1),g(FB)};m.useEffect(()=>{f()},[e]);const[h,g]=m.useState(FB),[v,b]=m.useState(!1),y=_=>{g(A=>({...A,[_]:void 0}))},w=(_,A)=>{g(O=>({...O,[_]:A}))},S=_=>!_.length,j=_=>t==null?void 0:t.some(({id:A,name:O})=>A!==(e==null?void 0:e.id)&&O===_),E=_=>!pdt.test(_),C=_=>S(_)?(w("name","Name is required."),!1):j(_)?(w("name","Name must be unique."),!1):E(_)?(w("name","Name must only contain alphanumeric lowercase characters, dashes and underscores."),!1):(y("name"),!0),T=(_,A)=>_==="now"&&S(A)?(w("tokenName","Token name is required."),!1):(y("tokenName"),!0);return{enabled:n,setEnabled:r,name:o,setName:i,description:a,setDescription:l,tokenGeneration:c,setTokenGeneration:u,tokenName:d,setTokenName:p,errors:h,setErrors:g,validated:v,validateName:C,validateTokenName:T,validate:()=>{const _=C(o),A=T(c,d);return b(!0),_&&A},reloadForm:f}},MCt=x("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)})),DCt=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),LCt=x("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"})),FCt=({name:e})=>{const{uiConfig:t}=rt(),{setToastData:n}=Nt(),r=`${t.unleashUrl}/api/signal-endpoint/${e}`,o=()=>{CC(r),n({type:"success",text:"Copied to clipboard"})};return s.jsxs(MCt,{children:[s.jsx(DCt,{children:"Signal endpoint URL:"}),s.jsxs(LCt,{children:[r,s.jsx(kt,{title:"Copy URL",arrow:!0,children:s.jsx($t,{onClick:o,size:"large",children:s.jsx(oh,{})})})]})]})},NCt="api/admin/signal-endpoints",BCt={signalEndpointTokens:[]},zCt=e=>{const{isEnterprise:t}=rt(),n=ci("signals"),{data:r,error:o,mutate:i}=Bi(t()&&n,BCt,bt(`${NCt}/${e}/tokens`),HCt);return m.useMemo(()=>({signalEndpointTokens:(r==null?void 0:r.signalEndpointTokens)??[],loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},HCt=e=>fetch(e).then(Jt("Signal endpoint tokens")).then(t=>t.json()),WCt=x("div")(({theme:e})=>({minHeight:e.spacing(12)})),VCt=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),UCt=x(vr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),GCt=({open:e,setOpen:t,tokens:n,onCreateClick:r})=>{const[o,i]=m.useState(""),[a,l]=m.useState("");m.useEffect(()=>{i(""),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 s.jsx(Gn,{open:e,primaryButtonText:"Create token",secondaryButtonText:"Cancel",onClick:()=>r({name:o}),disabledPrimaryButton:!d,onClose:()=>{t(!1)},title:"New token",children:s.jsxs(WCt,{children:[s.jsx(VCt,{children:"What is your new token name?"}),s.jsx(UCt,{autoFocus:!0,label:"Token name",error:!!a,errorText:a,value:o,onChange:p=>{u(p.target.value),i(p.target.value)},autoComplete:"off"})]})})},qCt=x(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),YCt=x("pre")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"auto",fontSize:e.fontSizes.smallerBody})),Nne=({open:e,setOpen:t,token:n,signalEndpoint:r})=>{const{uiConfig:o}=rt();return s.jsxs(Gn,{open:e,secondaryButtonText:"Close",onClose:(i,a)=>{a||t(!1)},title:"Signal endpoint token created",children:[s.jsx(qCt,{severity:"info",children:"Make sure to copy your signal endpoint token now. You won't be able to see it again!"}),s.jsx(Z,{variant:"body1",children:"Your token:"}),s.jsx(e$,{token:n||""}),s.jsx(X,{condition:!!r,show:()=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{variant:"body1",sx:{marginTop:3,marginBottom:2},children:"You can call your signal endpoint with the newly created token like this:"}),s.jsx(YCt,{children:`curl --request POST '${o.unleashUrl}/api/signal-endpoint/${r.name}' \\
452
452
  --header 'Authorization: Bearer ${n||"YOUR_TOKEN"}' \\
453
453
  --header 'Content-Type: application/json' \\
@@ -456,13 +456,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
456
456
  }'`})]})})]})},KCt=x("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}}})),XCt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(3)})),JCt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(.5)})),QCt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(1.5)})),ZCt={id:"createdAt",desc:!0},ejt=({signalEndpoint:e})=>{const t=qt(),{setToastData:n,setToastApiError:r}=Nt(),o=Xn(t.breakpoints.down("md")),{signalEndpointTokens:i,refetch:a}=zCt(e.id),{refetch:l}=gm(),{addSignalEndpointToken:c,removeSignalEndpointToken:u}=Fne(),[d]=m.useState(()=>({sortBy:[ZCt]})),[p,f]=m.useState(""),[h,g]=m.useState(!1),[v,b]=m.useState(!1),[y,w]=m.useState(!1),[S,j]=m.useState(""),[E,C]=m.useState(),T=async z=>{try{const{token:B}=await c(e.id,z);l(),a(),g(!1),j(B),b(!0),n({text:"Token created",type:"success"})}catch(B){r(Tt(B))}},k=async()=>{if(E)try{await u(e.id,E.id),l(),a(),w(!1),n({text:"Token deleted",type:"success"})}catch(z){r(Tt(z))}},_=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:_s,minWidth:100,searchable:!0},{Header:"Created",accessor:"createdAt",Cell:Jd,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:z}})=>s.jsx(Tu,{children:s.jsx(kt,{title:"Delete token",arrow:!0,describeChild:!0,children:s.jsx("span",{children:s.jsx($t,{onClick:()=>{C(z),w(!0)},children:s.jsx(Po,{})})})})}),maxWidth:100,disableSortBy:!0}],[C,w]),{data:A,getSearchText:O,getSearchContext:M}=eh(_,p,i),{headerGroups:H,rows:P,prepareRow:$,setHiddenColumns:D}=Zt.useTable({columns:_,data:A,initialState:d,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:o,columns:["createdAt"]}],D,_),s.jsxs(s.Fragment,{children:[s.jsxs(KCt,{children:[s.jsx(xo,{initialValue:p,onChange:f,getSearchContext:M}),s.jsx(Ue,{variant:"contained",color:"primary",disabled:i.length>=rte,onClick:()=>g(!0),children:"New token"})]}),s.jsx(is,{value:O(p),children:s.jsx(gp,{rows:P,headerGroups:H,prepareRow:$})}),s.jsx(X,{condition:P.length===0,show:s.jsx(X,{condition:(p==null?void 0:p.length)>0,show:s.jsxs($r,{children:["No tokens found matching “",p,"”"]}),elseShow:s.jsxs(XCt,{children:[s.jsx(JCt,{children:"You have no tokens for this signal endpoint yet."}),s.jsx(QCt,{children:"Create a token to start using this signal endpoint."}),s.jsx(Ue,{variant:"outlined",onClick:()=>g(!0),children:"Create new signal endpoint token"})]})})}),s.jsx(GCt,{open:h,setOpen:g,tokens:i,onCreateClick:T}),s.jsx(Nne,{open:v,setOpen:b,token:S,signalEndpoint:e}),s.jsx(Gn,{open:y,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:k,onClose:()=>{w(!1)},title:"Delete token?",children:s.jsxs(Z,{children:['Any applications or scripts using this token "',s.jsx("strong",{children:E==null?void 0:E.name}),'" will no longer be able to make requests to this signal endpoint. You cannot undo this action.']})})]})},tjt=x("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),nb=x("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),cE=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),uE=x(vr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),njt=x("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4),marginBottom:e.spacing(2)})),rjt=x("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),ojt=({signalEndpoint:e,enabled:t,setEnabled:n,name:r,setName:o,description:i,setDescription:a,tokenGeneration:l,setTokenGeneration:c,tokenName:u,setTokenName:d,errors:p,validateName:f,validateTokenName:h,validated:g})=>{const v=y=>{setTimeout(()=>y(),300)},b=g&&Object.values(p).some(Boolean);return s.jsxs("div",{children:[s.jsx(tjt,{children:s.jsx($Ct,{checked:t,setChecked:n,children:"Signal endpoint status"})}),s.jsx(nb,{children:"What is your new signal endpoint name?"}),s.jsx(uE,{autoFocus:!0,label:"Signal endpoint name",error:!!p.name,errorText:p.name,value:r,onChange:y=>{f(y.target.value),o(y.target.value)},onBlur:y=>v(()=>f(y.target.value)),autoComplete:"off"}),s.jsx(nb,{children:"What is your new signal endpoint description?"}),s.jsx(uE,{label:"Signal endpoint description",value:i,onChange:y=>a(y.target.value),autoComplete:"off"}),s.jsx(FCt,{name:r}),s.jsx(X,{condition:e===void 0,show:s.jsxs(njt,{children:[s.jsx(nb,{children:"Token"}),s.jsxs(cE,{children:["In order to connect your newly created signal endpoint, you will also need a token."," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s.jsx(Is,{children:s.jsxs(DS,{value:l,onChange:y=>{const w=y.target.value;g&&h(w,u),c(w)},name:"token-generation",children:[s.jsx(qr,{value:y1.LATER,control:s.jsx(yl,{}),label:"I want to generate a token later"}),s.jsx(qr,{value:y1.NOW,control:s.jsx(yl,{}),label:"Generate a token now"})]})}),s.jsxs(rjt,{children:[s.jsx(cE,{children:"A new signal endpoint token will be generated for the signal endpoint, so you can get started right away."}),s.jsx(X,{condition:l===y1.NOW,show:s.jsxs(s.Fragment,{children:[s.jsx(cE,{children:"What is your new token name?"}),s.jsx(uE,{autoFocus:!0,label:"Token name",error:!!p.tokenName,errorText:p.tokenName,value:u,onChange:y=>{h(l,y.target.value),d(y.target.value)},autoComplete:"off"})]})})]})]}),elseShow:s.jsxs(s.Fragment,{children:[s.jsx(nb,{children:"Signal endpoint tokens"}),s.jsx(ejt,{signalEndpoint:e})]})}),s.jsx(X,{condition:b,show:()=>s.jsx(Lt,{severity:"error",icon:!1,children:s.jsx("ul",{children:Object.values(p).filter(Boolean).map(y=>s.jsx("li",{children:y},y))})})})]})},ijt=x("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),sjt=x("h1")({fontWeight:"normal"}),ajt=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ljt=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),cjt=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),ujt=({signalEndpoint:e,open:t,setOpen:n,newToken:r,onOpenSignals:o})=>{const{refetch:i}=gm(),{addSignalEndpoint:a,updateSignalEndpoint:l,loading:c}=Lne(),{addSignalEndpointToken:u}=Fne(),{setToastData:d,setToastApiError:p}=Nt(),{uiConfig:f}=rt(),{enabled:h,setEnabled:g,name:v,setName:b,description:y,setDescription:w,tokenGeneration:S,setTokenGeneration:j,tokenName:E,setTokenName:C,errors:T,validateName:k,validateTokenName:_,validate:A,validated:O,reloadForm:M}=OCt(e);m.useEffect(()=>{M()},[t]);const H=e!==void 0,P=`${H?"Edit":"New"} signal endpoint`,$={enabled:h,name:v,description:y},D=()=>`curl --location --request ${H?"PUT":"POST"} '${f.unleashUrl}/api/admin/signal-endpoints${H?`/${e.id}`:""}' \\
457
457
  --header 'Authorization: INSERT_API_KEY' \\
458
458
  --header 'Content-Type: application/json' \\
459
- --data-raw '${JSON.stringify($,void 0,2)}'`,z=async B=>{if(B.preventDefault(),!!A())try{if(H)await l(e.id,$);else{const L=await a($);if(S===y1.NOW){const{token:I}=await u(L.id,{name:E});r(I,L)}}d({text:`Signal endpoint ${H?"updated":"added"}`,type:"success"}),i(),n(!1)}catch(L){p(Tt(L))}};return s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:P,children:s.jsxs(Fr,{loading:c,modal:!0,description:"Signal endpoints allow third-party services to send signals to Unleash.",documentationLink:"https://docs.getunleash.io/reference/signals",documentationLinkLabel:"Signals documentation",formatApiCode:D,children:[s.jsxs(ijt,{children:[s.jsx(sjt,{children:P}),s.jsx(X,{condition:H,show:s.jsx(kn,{onClick:o,children:"View signals"})})]}),s.jsxs(ajt,{onSubmit:z,children:[s.jsx(ojt,{signalEndpoint:e,enabled:h,setEnabled:g,name:v,setName:b,description:y,setDescription:w,tokenGeneration:S,setTokenGeneration:j,tokenName:E,setTokenName:C,errors:T,validateName:k,validateTokenName:_,validated:O}),s.jsxs(ljt,{children:[s.jsxs(Ue,{type:"submit",variant:"contained",color:"primary",children:[H?"Save":"Add"," signal endpoint"]}),s.jsx(cjt,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},djt="api/admin/signal-endpoints",pjt=async e=>{const t=await fetch(e);return await Jt("Signals")(t),t.json()},fjt=(e,t=50,n={})=>{var y;const{isEnterprise:r}=rt(),o=ci("signals"),i=(w,S)=>!e||!r||!o||S&&!S.signalEndpointSignals.length?null:bt(`${djt}/${e}/signals?limit=${t}&offset=${w*t}`),{data:a,error:l,size:c,setSize:u,mutate:d}=vJ(i,pjt,{...n,revalidateAll:!0}),p=a?a.flatMap(({signalEndpointSignals:w})=>w):[],f=!a&&!l,h=c>0&&!(a!=null&&a[c-1]),g=f||h,v=((y=a==null?void 0:a[c-1])==null?void 0:y.signalEndpointSignals.length)===t;return{signalEndpointSignals:p,hasMore:v,loadMore:()=>{g||!v||u(c+1)},loading:g,refetch:()=>d(),error:l}},hjt=m.lazy(()=>va(()=>import("./ReactJSONEditor-BDMT4-_1.js"),[])),gjt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),mjt=x("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),vjt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginTop:e.spacing(2),fontSize:e.fontSizes.smallBody})),yjt=x("p")(({theme:e})=>({color:e.palette.text.secondary})),xjt=x("h1")({fontWeight:"normal"}),bjt=x("form")({display:"flex",flexDirection:"column",height:"100%"}),wjt=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Sjt=({signalEndpoint:e,open:t,setOpen:n,onOpenConfiguration:r})=>{const{uiConfig:o}=rt(),{locationSettings:i}=wo(),{signalEndpointSignals:a,hasMore:l,loadMore:c,loading:u}=fjt(e==null?void 0:e.id,20,{refreshInterval:5e3});if(!e)return null;const d=`Signals: ${e.name}`;return s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:d,children:s.jsxs(Fr,{loading:u&&a.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[s.jsxs(gjt,{children:[s.jsxs(mjt,{children:[s.jsx(xjt,{children:d}),s.jsx(kn,{onClick:r,children:"View configuration"})]}),s.jsxs(vjt,{children:[s.jsxs("p",{children:[o.unleashUrl,"/api/signal-endpoint/",e.name]}),s.jsx(yjt,{children:e.description})]})]}),s.jsxs(bjt,{children:[s.jsx(TJ,{height:960,items:a,columns:[{header:"Date",maxWidth:220,cell:({createdAt:p})=>Ja(p,i==null?void 0:i.locale)},{header:"Token",maxWidth:300,cell:({tokenName:p})=>p}],sidePanelHeader:"Payload",renderContent:p=>s.jsx(m.Suspense,{fallback:null,children:s.jsx(hjt,{content:{json:p.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})}),listEnd:s.jsx(X,{condition:l,show:s.jsx(Ue,{onClick:c,children:"Load more"})})}),s.jsx(X,{condition:a.length===0,show:s.jsx("p",{children:"No signals have been received on this signal endpoint."})}),s.jsx(wjt,{children:s.jsx(Ue,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},Cjt=()=>{const{setToastData:e,setToastApiError:t}=Nt(),{uiConfig:n}=rt(),{openFeedback:r,hasSubmittedFeedback:o}=u$("signals","automatic"),{signalEndpoints:i,refetch:a}=gm(),{toggleSignalEndpoint:l,removeSignalEndpoint:c}=Lne(),[u,d]=m.useState(),[p,f]=m.useState(!1),[h,g]=m.useState(!1),[v,b]=m.useState(""),[y,w]=m.useState(!1),[S,j]=m.useState(!1),E=x(Lt)(({theme:D})=>({marginBottom:D.spacing(3)})),C=x("p")(({theme:D})=>({marginBottom:D.spacing(2)})),T=async({id:D,name:z},B)=>{try{await l(D,B),e({text:`"${z}" ${B?"enabled":"disabled"}`,type:"success"}),a()}catch(L){t(Tt(L))}},k=async({id:D,name:z})=>{try{await c(D),e({text:`"${z}" deleted`,type:"success"}),a(),w(!1)}catch(B){t(Tt(B))}},_=Xn(pr.breakpoints.down("md")),A=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:D}})=>s.jsx(Rl,{title:D.name,onClick:()=>{d(D),f(!0)},subtitle:D.description}),width:240},{Header:"URL",accessor:D=>`${n.unleashUrl}/api/signal-endpoint/${D.name}`,minWidth:200},{id:"tokens",Header:"Tokens",accessor:D=>{var z;return((z=D.tokens)==null?void 0:z.map(({name:B})=>B).join(`
460
- `))||""},Cell:({row:{original:D},value:z})=>s.jsx(RCt,{signalEndpoint:D,value:z,onCreateToken:()=>{d(D),f(!0)}}),searchable:!0,maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:Jd,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:D}})=>s.jsx(kCt,{checked:D.enabled,setChecked:z=>T(D,z)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:D}})=>s.jsx(ECt,{signalEndpointId:D.id,onCopyToClipboard:()=>{CC(`${n.unleashUrl}/api/signal-endpoint/${D.name}`),e({type:"success",text:"Copied to clipboard"})},onOpenSignals:()=>{d(D),j(!0)},onEdit:()=>{d(D),f(!0)},onDelete:()=>{d(D),w(!0)}}),width:90,disableSortBy:!0}],[]),[O]=m.useState({sortBy:[{id:"createdAt",desc:!0}]}),{headerGroups:M,rows:H,prepareRow:P,setHiddenColumns:$}=Zt.useTable({columns:A,data:i,initialState:O,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:En}},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:_,columns:["createdAt"]}],$,A),s.jsxs(cr,{header:s.jsx(Pn,{title:`Signal endpoints (${i.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!o,show:s.jsx(Ue,{startIcon:s.jsx(tj,{}),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"})}),s.jsx(Ro,{variant:"contained",color:"primary",permission:Rg,onClick:()=>{d(void 0),f(!0)},children:"New signal endpoint"})]})}),children:[s.jsxs(E,{severity:"info",children:[s.jsx(C,{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."}),s.jsx(C,{children:s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("b",{children:"Signal endpoints"})," are used to send signals to Unleash. This allows you to integrate Unleash with any external tool."]}),s.jsxs("li",{children:[s.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."]})]})}),s.jsxs(C,{children:["Read more about these features in our documentation:"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/signals",target:"_blank",rel:"noreferrer",children:"Signals"})," ","and"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/actions",target:"_blank",rel:"noreferrer",children:"Actions"})]})]}),s.jsx(HI,{permissions:Rg,children:s.jsxs(s.Fragment,{children:[s.jsx(gp,{rows:H,headerGroups:M,prepareRow:P}),s.jsx(X,{condition:H.length===0,show:s.jsx($r,{children:"No signal endpoints available. Get started by adding one."})}),s.jsx(ujt,{signalEndpoint:u,open:p,setOpen:f,newToken:(D,z)=>{b(D),d(z),g(!0)},onOpenSignals:()=>{f(!1),j(!0)}}),s.jsx(Sjt,{signalEndpoint:u,open:S,setOpen:j,onOpenConfiguration:()=>{j(!1),f(!0)}}),s.jsx(Nne,{open:h,setOpen:g,token:v,signalEndpoint:u}),s.jsx(TCt,{signalEndpoint:u,open:y,setOpen:w,onConfirm:k})]})})]})},jjt=()=>{const{isEnterprise:e}=rt();return e()?s.jsx(Cjt,{}):s.jsx(ym,{feature:"signals"})},Ejt=m.lazy(()=>va(()=>import("./CreateProject-COHPsP3X.js"),[])),Tjt="/static/onboardingConcepts-D4dTAWaa.png",kjt=x(nm)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,width:"65vw",maxWidth:"1800px",backgroundColor:"transparent"},padding:0,"& .MuiPaper-root > section":{overflowX:"hidden"}})),_jt=x(US)({width:"150px"}),Rjt=x(DR)({width:"150px"}),Pjt=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(4),flexDirection:"column",padding:e.spacing(4,12),alignItems:"center",backgroundColor:e.palette.background.paper})),Ajt=x(J)({display:"flex",alignItems:"center",justifyContent:"center"}),Ijt=x("img")({width:"100%"}),$jt=({open:e,onClose:t})=>s.jsx(kjt,{open:e,onClose:t,children:s.jsxs(Pjt,{children:[s.jsxs(Ajt,{children:[s.jsx(Z,{variant:"h2",children:"Welcome to"}),s.jsx(Xa,{darkmode:s.jsx(_jt,{}),lightmode:s.jsx(Rjt,{})})]}),s.jsxs(J,{children:["Here are the"," ",s.jsx(Z,{component:"span",color:"primary",fontWeight:"bold",children:"key concepts"})," ","you'll need when working with Unleash"]}),s.jsx(Ijt,{src:ti(Tjt)}),s.jsxs(Bc,{children:[s.jsx("h2",{children:"Environments"}),s.jsx("p",{children:"Environments represent different stages in your development lifecycle. The default environments are development and production."}),s.jsx("h2",{children:"Projects"}),s.jsx("p",{children:"Projects help you organize feature flags and define access for users and applications. SDKs use a combination of environment and project to retrieve feature flag configurations."}),s.jsx("h2",{children:"Feature flags"}),s.jsx("p",{children:"Feature flags exist within a project and have distinct configurations for each of the project's active environments."}),s.jsx("h2",{children:"Activation strategy"}),s.jsx("p",{children:"Activation strategies are rulesets that determine if a feature flag is enabled in a specific environment. You can configure multiple activation strategies per environment."})]}),s.jsx(Ue,{variant:"contained",onClick:t,children:"Got it, let's get started!"})]})}),Bne=()=>{const{data:e,error:t,mutate:n}=_n(bt("api/admin/personal-dashboard"),Ojt);return{personalDashboard:e,loading:!t&&!e,refetch:()=>n(),error:t}},Ojt=e=>fetch(e).then(Jt("Personal Dashboard")).then(t=>t.json()),Mjt=e=>{const{data:t,error:n,mutate:r}=Bi(!!e,{latestEvents:[],onboardingStatus:{status:"onboarding-started"},owners:[],roles:[]},bt(`api/admin/personal-dashboard/${e}`),Djt);return{personalDashboardProjectDetails:t,loading:!n&&!t,refetch:()=>r(),error:n}},Djt=e=>fetch(e).then(Jt("Personal Dashboard Project Details")).then(t=>t.json()),Ljt=x("article")(({theme:e})=>({padding:e.spacing(1,2),display:"flex",gap:e.spacing(3),flexDirection:"column"})),Fjt=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center",fontSize:e.spacing(1.75),fontWeight:"bold"})),zc=({title:e,children:t})=>s.jsxs(Ljt,{children:[e?s.jsx(Fjt,{children:e}):null,t]}),Rh=x("span")(({theme:e})=>({fontWeight:e.typography.fontWeightBold})),Njt=({project:e})=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{children:"This project already has connected SDKs and existing feature flags."}),s.jsxs(Z,{children:[s.jsx(xt,{to:`/projects/${e}?create=true`,children:"Create a new feature flag"})," ","or go to the"," ",s.jsx(xt,{to:`/projects/${e}`,title:e,children:"go to the project"})," ","to work with existing flags"]})]}),Bjt=e=>{const{avgHealthCurrentWindow:t,avgHealthPastWindow:n}=e;return t===null||n===null?"unknown":t>n?"improved":t<n?"declined":"consistent"},zjt=({trend:e,insights:t,project:n})=>{const{avgHealthCurrentWindow:r,avgHealthPastWindow:o}=t,i="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"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["On average, your project technical debt went down from"," ",s.jsxs(Rh,{children:[c,"%"]})," ","to"," ",s.jsxs(Rh,{children:[l,"%"]})," ","during the last 4 weeks."]}),s.jsx(Z,{children:a})]}):e==="declined"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["On average, your project technical debt went up from"," ",s.jsxs(Rh,{children:[c,"%"]})," ","to"," ",s.jsxs(Rh,{children:[l,"%"]})," ","during the last 4 weeks."]}),s.jsx(Z,{children:i})]}):e==="consistent"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["On average, your project technical debt has remained at"," ",s.jsxs(Rh,{children:[l,"%"]})," ","during the last 4 weeks."]}),s.jsx(Z,{children:a})]}):e==="unknown"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["Your current project technical debt is"," ",s.jsxs(Rh,{children:[l,"%"]}),"."]}),s.jsx(Z,{children:i})]}):s.jsx(Njt,{project:n})},Hjt=({project:e,insights:t})=>{const n=Bjt(t);return s.jsxs(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(pj,{color:"primary"}),s.jsx(Z,{sx:{fontWeight:"bold"},component:"h4",children:"Technical debt"})]}),children:[s.jsx(zjt,{trend:n,insights:t,project:e}),n!=="unknown"&&s.jsx(xt,{to:`/projects/${e}?project-status`,children:"View more insights"})]})},zne=x("div")({containerType:"inline-size"}),Hne=x("article")(({theme:e})=>({backgroundColor:e.palette.divider,borderRadius:`${e.shape.borderRadiusLarge}px`,gap:"1px",display:"flex",flexFlow:"column nowrap","&>*":{backgroundColor:e.palette.background.paper}})),fj=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}}},Wjt=x(Hne)(fj({gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"410px auto",display:"grid",gridTemplateAreas:`
459
+ --data-raw '${JSON.stringify($,void 0,2)}'`,z=async B=>{if(B.preventDefault(),!!A())try{if(H)await l(e.id,$);else{const L=await a($);if(S===y1.NOW){const{token:I}=await u(L.id,{name:E});r(I,L)}}d({text:`Signal endpoint ${H?"updated":"added"}`,type:"success"}),i(),n(!1)}catch(L){p(Tt(L))}};return s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:P,children:s.jsxs(Fr,{loading:c,modal:!0,description:"Signal endpoints allow third-party services to send signals to Unleash.",documentationLink:"https://docs.getunleash.io/reference/signals",documentationLinkLabel:"Signals documentation",formatApiCode:D,children:[s.jsxs(ijt,{children:[s.jsx(sjt,{children:P}),s.jsx(X,{condition:H,show:s.jsx(kn,{onClick:o,children:"View signals"})})]}),s.jsxs(ajt,{onSubmit:z,children:[s.jsx(ojt,{signalEndpoint:e,enabled:h,setEnabled:g,name:v,setName:b,description:y,setDescription:w,tokenGeneration:S,setTokenGeneration:j,tokenName:E,setTokenName:C,errors:T,validateName:k,validateTokenName:_,validated:O}),s.jsxs(ljt,{children:[s.jsxs(Ue,{type:"submit",variant:"contained",color:"primary",children:[H?"Save":"Add"," signal endpoint"]}),s.jsx(cjt,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},djt="api/admin/signal-endpoints",pjt=async e=>{const t=await fetch(e);return await Jt("Signals")(t),t.json()},fjt=(e,t=50,n={})=>{var y;const{isEnterprise:r}=rt(),o=ci("signals"),i=(w,S)=>!e||!r||!o||S&&!S.signalEndpointSignals.length?null:bt(`${djt}/${e}/signals?limit=${t}&offset=${w*t}`),{data:a,error:l,size:c,setSize:u,mutate:d}=vJ(i,pjt,{...n,revalidateAll:!0}),p=a?a.flatMap(({signalEndpointSignals:w})=>w):[],f=!a&&!l,h=c>0&&!(a!=null&&a[c-1]),g=f||h,v=((y=a==null?void 0:a[c-1])==null?void 0:y.signalEndpointSignals.length)===t;return{signalEndpointSignals:p,hasMore:v,loadMore:()=>{g||!v||u(c+1)},loading:g,refetch:()=>d(),error:l}},hjt=m.lazy(()=>va(()=>import("./ReactJSONEditor-DZ9l5V9S.js"),[])),gjt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),mjt=x("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),vjt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginTop:e.spacing(2),fontSize:e.fontSizes.smallBody})),yjt=x("p")(({theme:e})=>({color:e.palette.text.secondary})),xjt=x("h1")({fontWeight:"normal"}),bjt=x("form")({display:"flex",flexDirection:"column",height:"100%"}),wjt=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Sjt=({signalEndpoint:e,open:t,setOpen:n,onOpenConfiguration:r})=>{const{uiConfig:o}=rt(),{locationSettings:i}=wo(),{signalEndpointSignals:a,hasMore:l,loadMore:c,loading:u}=fjt(e==null?void 0:e.id,20,{refreshInterval:5e3});if(!e)return null;const d=`Signals: ${e.name}`;return s.jsx(Za,{open:t,onClose:()=>{n(!1)},label:d,children:s.jsxs(Fr,{loading:u&&a.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[s.jsxs(gjt,{children:[s.jsxs(mjt,{children:[s.jsx(xjt,{children:d}),s.jsx(kn,{onClick:r,children:"View configuration"})]}),s.jsxs(vjt,{children:[s.jsxs("p",{children:[o.unleashUrl,"/api/signal-endpoint/",e.name]}),s.jsx(yjt,{children:e.description})]})]}),s.jsxs(bjt,{children:[s.jsx(TJ,{height:960,items:a,columns:[{header:"Date",maxWidth:220,cell:({createdAt:p})=>Ja(p,i==null?void 0:i.locale)},{header:"Token",maxWidth:300,cell:({tokenName:p})=>p}],sidePanelHeader:"Payload",renderContent:p=>s.jsx(m.Suspense,{fallback:null,children:s.jsx(hjt,{content:{json:p.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})}),listEnd:s.jsx(X,{condition:l,show:s.jsx(Ue,{onClick:c,children:"Load more"})})}),s.jsx(X,{condition:a.length===0,show:s.jsx("p",{children:"No signals have been received on this signal endpoint."})}),s.jsx(wjt,{children:s.jsx(Ue,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},Cjt=()=>{const{setToastData:e,setToastApiError:t}=Nt(),{uiConfig:n}=rt(),{openFeedback:r,hasSubmittedFeedback:o}=u$("signals","automatic"),{signalEndpoints:i,refetch:a}=gm(),{toggleSignalEndpoint:l,removeSignalEndpoint:c}=Lne(),[u,d]=m.useState(),[p,f]=m.useState(!1),[h,g]=m.useState(!1),[v,b]=m.useState(""),[y,w]=m.useState(!1),[S,j]=m.useState(!1),E=x(Lt)(({theme:D})=>({marginBottom:D.spacing(3)})),C=x("p")(({theme:D})=>({marginBottom:D.spacing(2)})),T=async({id:D,name:z},B)=>{try{await l(D,B),e({text:`"${z}" ${B?"enabled":"disabled"}`,type:"success"}),a()}catch(L){t(Tt(L))}},k=async({id:D,name:z})=>{try{await c(D),e({text:`"${z}" deleted`,type:"success"}),a(),w(!1)}catch(B){t(Tt(B))}},_=Xn(pr.breakpoints.down("md")),A=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:D}})=>s.jsx(Rl,{title:D.name,onClick:()=>{d(D),f(!0)},subtitle:D.description}),width:240},{Header:"URL",accessor:D=>`${n.unleashUrl}/api/signal-endpoint/${D.name}`,minWidth:200},{id:"tokens",Header:"Tokens",accessor:D=>{var z;return((z=D.tokens)==null?void 0:z.map(({name:B})=>B).join(`
460
+ `))||""},Cell:({row:{original:D},value:z})=>s.jsx(RCt,{signalEndpoint:D,value:z,onCreateToken:()=>{d(D),f(!0)}}),searchable:!0,maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:Jd,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:D}})=>s.jsx(kCt,{checked:D.enabled,setChecked:z=>T(D,z)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:D}})=>s.jsx(ECt,{signalEndpointId:D.id,onCopyToClipboard:()=>{CC(`${n.unleashUrl}/api/signal-endpoint/${D.name}`),e({type:"success",text:"Copied to clipboard"})},onOpenSignals:()=>{d(D),j(!0)},onEdit:()=>{d(D),f(!0)},onDelete:()=>{d(D),w(!0)}}),width:90,disableSortBy:!0}],[]),[O]=m.useState({sortBy:[{id:"createdAt",desc:!0}]}),{headerGroups:M,rows:H,prepareRow:P,setHiddenColumns:$}=Zt.useTable({columns:A,data:i,initialState:O,sortTypes:yi,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:En}},Zt.useSortBy,Zt.useFlexLayout);return uh([{condition:_,columns:["createdAt"]}],$,A),s.jsxs(cr,{header:s.jsx(Pn,{title:`Signal endpoints (${i.length})`,actions:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:!o,show:s.jsx(Ue,{startIcon:s.jsx(tj,{}),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"})}),s.jsx(Ro,{variant:"contained",color:"primary",permission:Rg,onClick:()=>{d(void 0),f(!0)},children:"New signal endpoint"})]})}),children:[s.jsxs(E,{severity:"info",children:[s.jsx(C,{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."}),s.jsx(C,{children:s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("b",{children:"Signal endpoints"})," are used to send signals to Unleash. This allows you to integrate Unleash with any external tool."]}),s.jsxs("li",{children:[s.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."]})]})}),s.jsxs(C,{children:["Read more about these features in our documentation:"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/signals",target:"_blank",rel:"noreferrer",children:"Signals"})," ","and"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/actions",target:"_blank",rel:"noreferrer",children:"Actions"})]})]}),s.jsx(HI,{permissions:Rg,children:s.jsxs(s.Fragment,{children:[s.jsx(gp,{rows:H,headerGroups:M,prepareRow:P}),s.jsx(X,{condition:H.length===0,show:s.jsx($r,{children:"No signal endpoints available. Get started by adding one."})}),s.jsx(ujt,{signalEndpoint:u,open:p,setOpen:f,newToken:(D,z)=>{b(D),d(z),g(!0)},onOpenSignals:()=>{f(!1),j(!0)}}),s.jsx(Sjt,{signalEndpoint:u,open:S,setOpen:j,onOpenConfiguration:()=>{j(!1),f(!0)}}),s.jsx(Nne,{open:h,setOpen:g,token:v,signalEndpoint:u}),s.jsx(TCt,{signalEndpoint:u,open:y,setOpen:w,onConfirm:k})]})})]})},jjt=()=>{const{isEnterprise:e}=rt();return e()?s.jsx(Cjt,{}):s.jsx(ym,{feature:"signals"})},Ejt=m.lazy(()=>va(()=>import("./CreateProject-jRfRrbUO.js"),[])),Tjt="/static/onboardingConcepts-D4dTAWaa.png",kjt=x(nm)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,width:"65vw",maxWidth:"1800px",backgroundColor:"transparent"},padding:0,"& .MuiPaper-root > section":{overflowX:"hidden"}})),_jt=x(US)({width:"150px"}),Rjt=x(DR)({width:"150px"}),Pjt=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(4),flexDirection:"column",padding:e.spacing(4,12),alignItems:"center",backgroundColor:e.palette.background.paper})),Ajt=x(J)({display:"flex",alignItems:"center",justifyContent:"center"}),Ijt=x("img")({width:"100%"}),$jt=({open:e,onClose:t})=>s.jsx(kjt,{open:e,onClose:t,children:s.jsxs(Pjt,{children:[s.jsxs(Ajt,{children:[s.jsx(Z,{variant:"h2",children:"Welcome to"}),s.jsx(Xa,{darkmode:s.jsx(_jt,{}),lightmode:s.jsx(Rjt,{})})]}),s.jsxs(J,{children:["Here are the"," ",s.jsx(Z,{component:"span",color:"primary",fontWeight:"bold",children:"key concepts"})," ","you'll need when working with Unleash"]}),s.jsx(Ijt,{src:ti(Tjt)}),s.jsxs(Bc,{children:[s.jsx("h2",{children:"Environments"}),s.jsx("p",{children:"Environments represent different stages in your development lifecycle. The default environments are development and production."}),s.jsx("h2",{children:"Projects"}),s.jsx("p",{children:"Projects help you organize feature flags and define access for users and applications. SDKs use a combination of environment and project to retrieve feature flag configurations."}),s.jsx("h2",{children:"Feature flags"}),s.jsx("p",{children:"Feature flags exist within a project and have distinct configurations for each of the project's active environments."}),s.jsx("h2",{children:"Activation strategy"}),s.jsx("p",{children:"Activation strategies are rulesets that determine if a feature flag is enabled in a specific environment. You can configure multiple activation strategies per environment."})]}),s.jsx(Ue,{variant:"contained",onClick:t,children:"Got it, let's get started!"})]})}),Bne=()=>{const{data:e,error:t,mutate:n}=_n(bt("api/admin/personal-dashboard"),Ojt);return{personalDashboard:e,loading:!t&&!e,refetch:()=>n(),error:t}},Ojt=e=>fetch(e).then(Jt("Personal Dashboard")).then(t=>t.json()),Mjt=e=>{const{data:t,error:n,mutate:r}=Bi(!!e,{latestEvents:[],onboardingStatus:{status:"onboarding-started"},owners:[],roles:[]},bt(`api/admin/personal-dashboard/${e}`),Djt);return{personalDashboardProjectDetails:t,loading:!n&&!t,refetch:()=>r(),error:n}},Djt=e=>fetch(e).then(Jt("Personal Dashboard Project Details")).then(t=>t.json()),Ljt=x("article")(({theme:e})=>({padding:e.spacing(1,2),display:"flex",gap:e.spacing(3),flexDirection:"column"})),Fjt=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center",fontSize:e.spacing(1.75),fontWeight:"bold"})),zc=({title:e,children:t})=>s.jsxs(Ljt,{children:[e?s.jsx(Fjt,{children:e}):null,t]}),Rh=x("span")(({theme:e})=>({fontWeight:e.typography.fontWeightBold})),Njt=({project:e})=>s.jsxs(s.Fragment,{children:[s.jsx(Z,{children:"This project already has connected SDKs and existing feature flags."}),s.jsxs(Z,{children:[s.jsx(xt,{to:`/projects/${e}?create=true`,children:"Create a new feature flag"})," ","or go to the"," ",s.jsx(xt,{to:`/projects/${e}`,title:e,children:"go to the project"})," ","to work with existing flags"]})]}),Bjt=e=>{const{avgHealthCurrentWindow:t,avgHealthPastWindow:n}=e;return t===null||n===null?"unknown":t>n?"improved":t<n?"declined":"consistent"},zjt=({trend:e,insights:t,project:n})=>{const{avgHealthCurrentWindow:r,avgHealthPastWindow:o}=t,i="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"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["On average, your project technical debt went down from"," ",s.jsxs(Rh,{children:[c,"%"]})," ","to"," ",s.jsxs(Rh,{children:[l,"%"]})," ","during the last 4 weeks."]}),s.jsx(Z,{children:a})]}):e==="declined"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["On average, your project technical debt went up from"," ",s.jsxs(Rh,{children:[c,"%"]})," ","to"," ",s.jsxs(Rh,{children:[l,"%"]})," ","during the last 4 weeks."]}),s.jsx(Z,{children:i})]}):e==="consistent"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["On average, your project technical debt has remained at"," ",s.jsxs(Rh,{children:[l,"%"]})," ","during the last 4 weeks."]}),s.jsx(Z,{children:a})]}):e==="unknown"?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{children:["Your current project technical debt is"," ",s.jsxs(Rh,{children:[l,"%"]}),"."]}),s.jsx(Z,{children:i})]}):s.jsx(Njt,{project:n})},Hjt=({project:e,insights:t})=>{const n=Bjt(t);return s.jsxs(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(pj,{color:"primary"}),s.jsx(Z,{sx:{fontWeight:"bold"},component:"h4",children:"Technical debt"})]}),children:[s.jsx(zjt,{trend:n,insights:t,project:e}),n!=="unknown"&&s.jsx(xt,{to:`/projects/${e}?project-status`,children:"View more insights"})]})},zne=x("div")({containerType:"inline-size"}),Hne=x("article")(({theme:e})=>({backgroundColor:e.palette.divider,borderRadius:`${e.shape.borderRadiusLarge}px`,gap:"1px",display:"flex",flexFlow:"column nowrap","&>*":{backgroundColor:e.palette.background.paper}})),fj=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}}},Wjt=x(Hne)(fj({gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"410px auto",display:"grid",gridTemplateAreas:`
461
461
  "projects box1 box2"
462
462
  ". owners owners"
463
463
  `})),Vjt=x(Hne)(fj({gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"410px",display:"grid",gridTemplateAreas:`
464
464
  "flags chart chart"
465
- `})),Wne=x("div")(({theme:e})=>({padding:e.spacing(2,4)})),Ujt=x(Wne,{shouldForwardProp:e=>!["gridArea"].includes(e.toString())})(({theme:e,gridArea:t})=>({maxHeight:"100%",overflowY:"auto",gridArea:t})),x1=x("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({padding:e.spacing(3,4),maxHeight:"100%",overflowY:"auto",gridArea:t})),Gjt=x("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({display:"none",gridArea:t,...fj({display:"block"})({theme:e})})),Vne=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",width:"100%"})),Une=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)}),Gne=x(Ni)(({theme:e})=>({maxHeight:"400px",...fj({maxHeight:"100%"})({theme:e})})),qne=x("div")(({theme:e,lines:t=2})=>({fontWeight:e.typography.fontWeightRegular,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"})),wy=x("span")(({theme:e})=>({width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.neutral.border,borderRadius:"50%"})),qjt=x(wy)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper})),Yjt=x("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)})),Kjt=({project:e})=>{const{trackEvent:t}=Kt();return s.jsxs(zc,{"data-loading":!0,title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"1"}),"Create a feature flag"]}),children:[s.jsxs("div",{children:[s.jsx("p",{children:"The project currently holds no feature flags."}),s.jsx("p",{children:"Create one to get started."})]}),s.jsx("div",{children:s.jsx(Ue,{href:`projects/${e}`,onClick:()=>{t("personal-dashboard",{props:{eventType:"Go to project from onboarding"}})},variant:"contained",children:"Go to project"})})]})},Xjt=({project:e})=>s.jsxs(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(qjt,{children:"1"}),"Create a feature flag"]}),children:[s.jsxs(Yjt,{children:[s.jsx(Z,{fontWeight:"bold",variant:"body2",children:"You have created your first flag"}),s.jsx(Z,{variant:"body2",children:"Go to the project to customize the flag further."})]}),s.jsx("div",{children:s.jsx(Ue,{component:xt,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),NB=({project:e})=>s.jsxs(zc,{"data-loading":!0,title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"2"}),"Connect an SDK"]}),children:[s.jsxs("div",{children:[s.jsx("p",{children:"Your project is not yet connected to any SDK."}),s.jsx("p",{children:"To start using your feature flag, connect an SDK to the project."})]}),s.jsx("div",{children:s.jsx(Ue,{component:xt,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),Jjt=x("ul")(({theme:e})=>({padding:0,alignItems:"flex-start",display:"flex",flexFlow:"column nowrap",gap:e.spacing(2)})),Qjt=x("li")(({theme:e})=>({listStyleType:"none",padding:e.spacing(0),display:"inline-flex",gap:e.spacing(2),fontSize:e.typography.body2.fontSize,"*":{fontWeight:"normal"}}));x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center"}));const Zjt=x("time")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.fontSize,marginBottom:e.spacing(1)})),e3t=x(hp)(({theme:e})=>({marginTop:e.spacing(.5)})),t3t=x(ep)({overflowWrap:"anywhere"}),n3t=({children:e})=>e,r3t=({latestEvents:e})=>{const{locationSettings:t}=wo();return s.jsx(zc,{title:s.jsx(Z,{sx:{fontWeight:"bold"},component:"h4",children:"Latest events"}),children:s.jsx(Jjt,{children:e.map(n=>s.jsxs(Qjt,{children:[s.jsx(e3t,{src:n.createdByImageUrl}),s.jsxs("div",{children:[s.jsx(Zjt,{dateTime:n.createdAt,children:QP(n.createdAt,t.locale)}),s.jsx(t3t,{components:{strong:n3t},children:n.summary||"No preview available for this event"})]})]},n.id))})})},Yne=3.5,o3t=x("div")(({theme:e})=>({width:"100%",display:"flex",flexFlow:"row wrap",gap:e.spacing(1),justifyContent:"space-between"})),BB=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",minHeight:e.spacing(Yne)})),i3t=x("ul")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexFlow:"row wrap",listStyle:"none",padding:0})),s3t=x("ul")(({theme:e})=>({gap:e.spacing(1),flexFlow:"column",display:"flex",listStyle:"none",padding:0})),dE=x(sn)({whitespace:"nowrap"}),a3t=x(O9)(({theme:e})=>({width:"max-content",height:e.spacing(Yne)})),l3t=({roles:e,owners:t})=>{const n=e.slice(0,3),r=e.slice(3),o=t.filter(i=>i.ownerType!=="system");return s.jsxs(o3t,{"data-loading":!0,children:[s.jsx(BB,{children:e.length>0?s.jsxs(s.Fragment,{children:[s.jsx(Z,{sx:{whiteSpace:"nowrap"},variant:"body1",component:"h4",children:"Your roles in this project:"}),s.jsxs(i3t,{children:[n.map(i=>s.jsx("li",{children:s.jsx(dE,{color:"secondary",children:i})},i)),r.length?s.jsx("li",{children:s.jsx(hr,{arrow:!0,title:s.jsx(s3t,{children:r.map(i=>s.jsx("li",{children:s.jsx(dE,{children:i})},i))}),children:s.jsx(dE,{color:"secondary",children:`+ ${r.length} more`},"extra-roles")})}):null]})]}):s.jsx("span",{children:"You have no project roles in this project."})}),s.jsx(BB,{children:o.length>0?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{variant:"body1",component:"h4",sx:{whiteSpace:"nowrap"},children:["Project owner",o.length>1?"s":""]}),s.jsx(a3t,{users:o,avatarLimit:3})]}):null})]})},c3t=x("ul")(({theme:e})=>({padding:0,"li + li":{marginTop:e.spacing(2)}})),u3t=x("li")(({theme:e})=>({display:"flex",flexFlow:"row",gap:e.spacing(2)})),d3t=x("article")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),Kne=({admins:e})=>s.jsx(d3t,{children:e.length?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Your Unleash administrator",e.length>1?"s are":" is",":"]}),s.jsx(c3t,{children:e.map(t=>s.jsxs(u3t,{children:[s.jsx(hp,{sx:{margin:0},user:t}),s.jsx(Z,{children:t.name||t.username||t.email})]},t.id))})]}):s.jsx("p",{children:"You have no Unleash administrators to contact."})}),p3t=({project:e})=>s.jsxs(zc,{title:`Couldn't fetch data for project "${e}".`,children:[s.jsx("p",{children:"The API request to get data for this project returned with an error."}),s.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.']})]}),f3t=({admins:e})=>s.jsx(zc,{title:"Consider contacting one of your Unleash admins for help.",children:s.jsx(Kne,{admins:e})}),h3t=({admins:e})=>s.jsx(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"1"}),"Contact Unleash admin"]}),children:s.jsx(Kne,{admins:e})}),g3t=({owners:e})=>s.jsx(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"2"}),"Ask a project owner to add you to their project"]}),children:e.length?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Project owners in Unleash:"}),s.jsx(O9,{users:e,avatarLimit:9})]}):s.jsx("p",{children:"There are no project owners in Unleash to ask for access."})}),m3t=({project:e})=>{const t=e.technicalDebt;return s.jsxs(J,{sx:{display:"flex",gap:2},children:[s.jsxs(J,{sx:{display:"flex",flexDirection:"column"},children:[s.jsx(Z,{variant:"subtitle2",color:"primary",children:e.featureCount}),s.jsx(Z,{variant:"caption",color:"text.secondary",children:"flags"})]}),s.jsxs(J,{sx:{display:"flex",flexDirection:"column"},children:[s.jsx(Z,{variant:"subtitle2",color:"primary",children:e.memberCount}),s.jsx(Z,{variant:"caption",color:"text.secondary",children:"members"})]}),s.jsxs(J,{sx:{display:"flex",flexDirection:"column"},children:[s.jsxs(Z,{variant:"subtitle2",color:"primary",children:[t,"%"]}),s.jsx(Z,{variant:"caption",color:"text.secondary",children:"technical debt"})]})]})},zB=x("div")({height:"80%"}),v3t=({project:e,selected:t,onClick:n})=>{const r=m.useRef(null),{trackEvent:o}=Kt();return m.useEffect(()=>{r.current&&(r.current.scrollIntoView({block:"start",inline:"start"}),window.scrollTo({top:0}))},[]),s.jsx(Gr,{disablePadding:!0,sx:{mb:1},ref:t?r:null,children:s.jsxs(no,{sx:Une,selected:t,onClick:n,children:[s.jsxs(Vne,{children:[s.jsx(Mf,{color:"primary"}),s.jsx(qne,{children:e.name}),s.jsx($t,{component:xt,to:`/projects/${e.id}`,size:"small",sx:{ml:"auto"},onClick:()=>{o("personal-dashboard",{props:{eventType:"Go to project from list"}})},children:s.jsx(OC,{titleAccess:`projects/${e.id}`})})]}),t?s.jsx(m3t,{project:e}):null]})})},y3t=({projects:e,personalDashboardProjectDetails:t,setActiveProject:n,activeProject:r,admins:o,owners:i})=>{const a=$l(t.state==="loading"),l=()=>{if(e.length===0)return{list:s.jsxs(zc,{children:[s.jsx(Z,{children:"You don't currently have access to any projects in the system."}),s.jsxs(Z,{children:["To get started, you can"," ",s.jsx(xt,{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:s.jsx(h3t,{admins:o}),box2:s.jsx(g3t,{owners:i})};const p=s.jsx(Gne,{children:e.map(g=>s.jsx(v3t,{project:g,selected:g.id===r,onClick:()=>n(g.id)},g.id))}),[f,h]=(()=>{switch(t.state){case"success":{const g=t.data.onboardingStatus.status??"loading",v=g==="onboarding-started";return g==="onboarded"?[s.jsx(Hjt,{project:r,insights:t.data.insights}),s.jsx(r3t,{latestEvents:t.data.latestEvents})]:v?[s.jsx(Kjt,{project:r}),s.jsx(NB,{project:r})]:[s.jsx(Xjt,{project:r}),s.jsx(NB,{project:r})]}case"error":return[s.jsx(p3t,{project:r}),s.jsx(f3t,{admins:o})];default:return[s.jsx(zB,{"data-loading":!0}),s.jsx(zB,{"data-loading":!0})]}})();return{list:p,box1:f,box2:h}},{list:c,box1:u,box2:d}=l();return s.jsx(zne,{ref:a,children:s.jsxs(Wjt,{children:[s.jsx(x1,{gridArea:"projects",children:c}),s.jsx(x1,{gridArea:"box1",children:u}),s.jsx(x1,{gridArea:"box2",children:d}),s.jsx(Gjt,{}),s.jsx(Ujt,{gridArea:"owners",children:s.jsx(l3t,{roles:t.state==="success"?t.data.roles.map(p=>p.name):[],owners:t.state==="success"?t.data.owners:[{ownerType:"user",name:"?"}]})})]})})},V$=e=>{const t={activeProject:void 0,activeFlag:void 0,expandProjects:!0,expandFlags:!0,expandTimeline:!1},[n,r]=ol("personal-dashboard:v1",t),o=d=>r({...t,...n,...d});m.useEffect(()=>{var p,f;const d={};(p=e==null?void 0:e.flags)!=null&&p.length&&(!n.activeFlag||!e.flags.some(h=>{var g;return h.name===((g=n.activeFlag)==null?void 0:g.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:i,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:i,setActiveFlag:l,activeProject:a,setActiveProject:c,expandFlags:n.expandFlags??!0,expandProjects:n.expandProjects??!0,expandTimeline:n.expandTimeline??!1,toggleSectionState:u}},x3t=x("div")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),b3t=({flag:e,selected:t,onClick:n})=>{const r=m.useRef(null),{trackEvent:o}=Kt();m.useEffect(()=>{r.current&&(r.current.scrollIntoView({block:"start",inline:"start"}),window.scrollTo({top:0}))},[]);const i=wC(e.type),a=`projects/${e.project}/features/${e.name}`;return s.jsx(Gr,{disablePadding:!0,sx:{mb:1},ref:t?r:null,children:s.jsx(no,{sx:Une,selected:t,onClick:n,children:s.jsxs(Vne,{children:[s.jsx(i,{color:"primary"}),s.jsx(qne,{children:e.name}),s.jsx($t,{component:kn,href:a,onClick:()=>{o("personal-dashboard",{props:{eventType:"Go to flag from list"}})},size:"small",sx:{ml:"auto"},children:s.jsx(OC,{titleAccess:a})})]})})},e.name)},w3t=({hasProjects:e,flagData:t,setActiveFlag:n,refetchDashboard:r})=>s.jsx(zne,{children:s.jsxs(Vjt,{children:[s.jsx(x1,{gridArea:"flags",children:t.state==="flags"?s.jsx(Gne,{disablePadding:!0,sx:{height:"100%"},children:t.flags.map(o=>{var i;return s.jsx(b3t,{flag:o,selected:o.name===((i=t.activeFlag)==null?void 0:i.name),onClick:()=>n(o)},o.name)})}):e?s.jsxs(x3t,{children:[s.jsx(Z,{children:"You have not created or favorited any feature flags. Once you do, they will show up here."}),s.jsx(Z,{children:"To create a new flag, go to one of your projects."})]}):s.jsx(Lt,{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."})}),s.jsx(x1,{gridArea:"chart",children:t.state==="flags"&&t.activeFlag?s.jsx(S3t,{flag:t.activeFlag,onArchive:r}):s.jsx(C3t,{label:"Metrics for your feature flags will be shown here"})})]})}),S3t=Je.lazy(()=>va(()=>import("./FlagMetricsChart-D0GI-ltv.js"),[]).then(e=>({default:e.FlagMetricsChart}))),C3t=Je.lazy(()=>va(()=>import("./FlagMetricsChart-D0GI-ltv.js"),[]).then(e=>({default:e.PlaceholderFlagMetricsChartWithWrapper}))),j3t=({personalDashboardProjectDetails:e,error:t})=>t?{state:"error",error:t}:e?{state:"success",data:e}:{state:"loading"},E3t="/static/upgradeHosted-D8epFMuP.png",T3t=x("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"})),k3t=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center"})),_3t=x("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(1)})),R3t=x("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)})),P3t=x("ul")(({theme:e})=>({listStyle:"none",padding:0,margin:0,fontSize:e.typography.body2.fontSize,"& li":{}})),mv=x("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}})),A3t=x($t)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1)})),I3t=x("img")(({theme:e})=>({width:235,margin:e.spacing(1),[e.breakpoints.down("md")]:{display:"none"}})),$3t=()=>{const[e,t]=ol("upgrade-dashboard:v1","open");if(e==="closed")return null;const n=()=>{t("closed")};return s.jsxs(T3t,{children:[s.jsx(kt,{title:"Dismiss",arrow:!0,children:s.jsx(A3t,{"aria-label":"dismiss",onClick:n,size:"small",children:s.jsx(Ho,{fontSize:"inherit"})})}),s.jsxs(k3t,{children:[s.jsxs(_3t,{children:[s.jsxs(R3t,{children:[s.jsx(Xa,{darkmode:s.jsx(ny,{}),lightmode:s.jsx(ty,{})}),"Explore our Enterprise solution"]}),s.jsx(Z,{children:"Increase efficiency and improve the development process in your company with the full experience of Unleash with some key advantages like:"}),s.jsxs(P3t,{children:[s.jsx(mv,{children:"Unlimited projects and environments"}),s.jsx(mv,{children:"Priority support for managed and self-hosted options"}),s.jsx(mv,{children:"SSO/SCIM - streamlined access and account management"}),s.jsx(mv,{children:"RBAC - precise access control"}),s.jsx(mv,{children:"Change requests - reduce error risk with pull-request like experience"})]}),s.jsx("div",{children:s.jsx(Ue,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=dashboard",children:"View full Enterprise offering"})})]}),s.jsx(I3t,{src:ti(E3t),alt:"Upgrade Unleash"})]})]})};var U$={},O3t=Te;Object.defineProperty(U$,"__esModule",{value:!0});var Xne=U$.default=void 0,M3t=O3t(ke()),D3t=s,L3t=(0,M3t.default)((0,D3t.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");Xne=U$.default=L3t;var G$={},F3t=Te;Object.defineProperty(G$,"__esModule",{value:!0});var Jne=G$.default=void 0,N3t=F3t(ke()),B3t=s,z3t=(0,N3t.default)((0,B3t.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");Jne=G$.default=z3t;var q$={},H3t=Te;Object.defineProperty(q$,"__esModule",{value:!0});var Qne=q$.default=void 0,W3t=H3t(ke()),V3t=s,U3t=(0,W3t.default)((0,V3t.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");Qne=q$.default=U3t;var Y$={},G3t=Te;Object.defineProperty(Y$,"__esModule",{value:!0});var Zne=Y$.default=void 0,q3t=G3t(ke()),Y3t=s,K3t=(0,q3t.default)((0,Y3t.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");Zne=Y$.default=K3t;var K$={},X3t=Te;Object.defineProperty(K$,"__esModule",{value:!0});var X$=K$.default=void 0,J3t=X3t(ke()),Q3t=s,Z3t=(0,J3t.default)((0,Q3t.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");X$=K$.default=Z3t;const HB=x("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)"}})),e5t=({icon:e,type:t})=>e?s.jsx(Ka,{children:e}):t==="signal"?s.jsx(X$,{}):t==="feature-environment-enabled"?s.jsx(Xne,{}):t==="feature-environment-disabled"?s.jsx(Jne,{}):t.startsWith("strategy-")||t.startsWith("feature-strategy-")||t.startsWith("release-plan-")?s.jsx(YR,{sx:{marginTop:"-2px",marginRight:"-2px"}}):t.startsWith("feature-")?s.jsx(TP,{}):t.startsWith("segment-")?s.jsx(GR,{}):s.jsx(Qne,{}),t5t={signal:"warning","feature-environment-enabled":"success","feature-environment-disabled":"neutral","feature-archived":"neutral"},n5t=e=>e!==void 0&&["secondary","success","neutral","warning","error"].includes(e),ere=({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 s.jsx(HB,{variant:n5t(n.variant)?n.variant:t5t[n.type],...t,children:e5t(n)})}return s.jsx(HB,{...t,children:s.jsx(Zne,{})})},WB=x("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(1),gap:e.spacing(2),flexWrap:"wrap"})),VB=x("div")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.smallBody,wordBreak:"break-word",flex:1})),r5t=x("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),UB=x("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),o5t=x("div")(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column",gap:e.spacing(2)})),i5t=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),s5t=x(ere)(({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"}})),GB=({children:e})=>e,a5t=({group:e})=>{const{locationSettings:t}=wo();if(e.length===1){const o=e[0],i=Ja(o.timestamp,t==null?void 0:t.locale);return s.jsxs(s.Fragment,{children:[s.jsxs(WB,{children:[s.jsx(VB,{children:o.label}),s.jsx(r5t,{children:i})]}),s.jsx(ep,{components:{strong:GB},children:o.summary})]})}const n=e[0],r=Kd(n.timestamp,t==null?void 0:t.locale);return s.jsxs(s.Fragment,{children:[s.jsxs(WB,{children:[s.jsxs(VB,{children:[e.length," events occurred"]}),s.jsx(UB,{children:r})]}),s.jsx(o5t,{children:e.map(o=>s.jsxs(i5t,{children:[s.jsx(s5t,{group:[o]}),s.jsxs("div",{children:[s.jsx(UB,{children:C_e(o.timestamp,t==null?void 0:t.locale)}),s.jsx(ep,{components:{strong:GB},children:o.summary})]})]},o.id))})]})},l5t=x("div",{shouldForwardProp:e=>e!=="position"})(({position:e})=>({position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",left:e,transform:"translateX(-50%)",zIndex:1})),c5t=x(pR)(({theme:e})=>({".MuiBadge-badge":{backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText}})),u5t=({group:e,startTime:t,endTime:n})=>{const{trackEvent:r}=Kt(),o=n-t,a=`${(e[0].timestamp-t)/o*100}%`,l=()=>{r("event-timeline",{props:{eventType:"event hover"}})};return s.jsx(l5t,{position:a,onMouseEnter:l,children:s.jsx(hr,{title:s.jsx(a5t,{group:e}),maxWidth:350,arrow:!0,children:s.jsx(c5t,{badgeContent:e.length,invisible:e.length<2,children:s.jsx(ere,{group:e})})})})},tre=m.createContext(void 0),nre=()=>{const e=m.useContext(tre);if(!e)throw new Error("useEventTimelineContext must be used within a EventTimelineProvider");return e},Ob=[{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"]}],d5t={open:!1,timeSpan:Ob[0]},p5t=({children:e})=>{const[t,n]=ol("event-timeline:v1",d5t),r=(i,a)=>{n(l=>({...l,[i]:a}))},o={...t,setOpen:i=>r("open",i),setTimeSpan:i=>r("timeSpan",i),setEnvironment:i=>r("environment",i),setSignalsSuggestionSeen:i=>r("signalsSuggestionSeen",i)};return s.jsx(tre.Provider,{value:o,children:e})},qB=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),YB=x(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"}}})),f5t=x("span")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(.25)})),h5t=({totalEvents:e})=>{const{timeSpan:t,environment:n,setOpen:r,setTimeSpan:o,setEnvironment:i}=nre(),{environments:a}=$u(),l=m.useMemo(()=>a.filter(({enabled:d})=>d),[a]);Kt(),m.useEffect(()=>{if(l.length>0&&!n){const d=l.find(({type:p})=>p==="production")||l[0];i(d)}},[l]);const c=()=>s.jsx(X,{condition:!!n&&a.length>0,show:()=>s.jsx(YB,{select:!0,size:"small",variant:"outlined",value:n.name,onChange:d=>i(a.find(({name:p})=>p===d.target.value)||a[0]),children:a.map(({name:d})=>s.jsx(Cr,{value:d,children:d},d))})}),u=()=>s.jsx(YB,{select:!0,size:"small",variant:"outlined",value:t.key,onChange:d=>o(Ob.find(({key:p})=>p===d.target.value)||Ob[0]),children:Ob.map(({key:d,label:p})=>s.jsx(Cr,{value:d,children:p},d))});return s.jsxs(s.Fragment,{children:[s.jsx(qB,{children:s.jsxs(f5t,{children:[e," event",e===1?"":"s",s.jsx(bo,{tooltip:"These are key events per environment across all your projects. For more details, visit the event log."})]})}),s.jsxs(qB,{children:[s.jsx(u,{}),s.jsx(c,{})]})]})},KB={signals:[],total:0},g5t=10,rre="api/admin/signals?",m5t=()=>{const e={total:0,initialLoad:!0},t=(n,r)=>{e[n]=r};return(n,r={},o="")=>{const{isEnterprise:i}=rt(),a=ci("signals"),{KEY:l,fetcher:c}=v5t(n),u=`${o}${l}`;yC(u,rre,g5t);const{data:d,error:p,mutate:f,isLoading:h}=Bi(i()&&a,KB,u,c,r),g=m.useCallback(()=>{f()},[f]);return(d==null?void 0:d.total)!==void 0&&t("total",d.total),!h&&e.initialLoad&&t("initialLoad",!1),{...d||KB,loading:h,error:p,refetch:g,total:e.total,initialLoad:h&&e.initialLoad}}},v5t=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,i])=>!!i).map(([o,i])=>[o,i.toString()]))).toString(),n=`${rre}${t}`;return{fetcher:()=>{const o=bt(n);return fetch(o,{method:"GET"}).then(Jt("Signal query")).then(i=>i.json())},KEY:n}},y5t=m5t(),XB=x("div")({display:"flex",flexDirection:"row",justifyContent:"space-between"}),x5t=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(1.5,0)})),b5t=x("div")(({theme:e})=>({position:"relative",height:e.spacing(1),width:"100%",display:"flex",alignItems:"center",padding:e.spacing(1.5,0)})),w5t=x("div")(({theme:e})=>({backgroundColor:e.palette.divider,height:e.spacing(.5),width:"100%"})),S5t=x("div")({display:"flex",alignItems:"center",justifyContent:"center",position:"relative"}),J$=x("div")(({theme:e})=>({position:"absolute",height:e.spacing(1),width:e.spacing(.25),backgroundColor:e.palette.text.secondary})),C5t=x(J$)(({theme:e})=>({top:e.spacing(-2)})),pE=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),j5t=x(J$)({left:0}),E5t=x(J$)({right:0}),T5t=["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"],rb=e=>e.toISOString().split("T")[0],k5t=e=>"sourceId"in e,_5t=e=>new Date(e.createdAt).getTime(),R5t=(e,t,n)=>e>=t&&e<=n,JB=e=>typeof e=="string"&&e.trim().length>0,P5t=(e,t,n)=>{if(k5t(e)){const{id:r,sourceName:o="unknown source",sourceDescription:i,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${i?`: ${i}`:""}`;return{id:r,timestamp:t,type:"signal",label:f,summary:h,...JB(u)?{icon:u}:{},...JB(d)?{variant:d}:{}}}if(!e.environment||!n||e.environment===n.name){const{id:r,type:o,label:i,summary:a,createdBy:l}=e,c=i||o,u=a||`**${l}** triggered **${o}**`;return{id:r,timestamp:t,type:o,label:c,summary:u}}},A5t=()=>{const{timeSpan:e,environment:t}=nre(),n=new Date,r=b_e(n,e.value),o=n.getTime(),i=r.getTime(),{events:a}=_ee({from:`IS:${rb(Yd(r))}`,to:`IS:${rb(n)}`,type:`IS_ANY_OF:${T5t.join(",")}`},{refreshInterval:10*1e3}),{signals:l}=y5t({from:`IS:${rb(Yd(r))}`,to:`IS:${rb(n)}`},{refreshInterval:10*1e3}),c=m.useMemo(()=>[...a,...l].reduce((f,h)=>{const g=_5t(h);if(R5t(g,i,o)){const v=P5t(h,g,t);v&&f.push(v)}return f},[]).sort((f,h)=>f.timestamp-h.timestamp),[a,l,i,o,t]),u=o-i,d=m.useMemo(()=>u*.02,[u]),p=m.useMemo(()=>c.reduce((f,h)=>{if(f.length===0)f.push([h]);else{const g=f[f.length-1],v=g[g.length-1];h.timestamp-v.timestamp<=d?g.push(h):f.push([h])}return f},[]),[c,d]);return s.jsxs(s.Fragment,{children:[s.jsx(XB,{children:s.jsx(h5t,{totalEvents:c.length})}),s.jsxs(x5t,{children:[s.jsxs(b5t,{children:[s.jsx(w5t,{}),s.jsx(j5t,{}),p.map(f=>s.jsx(u5t,{group:f,startTime:i,endTime:o},f[0].id)),s.jsx(E5t,{})]}),s.jsxs(XB,{children:[s.jsx(pE,{children:e.markers[0]}),e.markers.slice(1).map(f=>s.jsxs(S5t,{children:[s.jsx(C5t,{}),s.jsx(pE,{children:f})]},f)),s.jsx(pE,{children:"now"})]})]})]})},I5t=x("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(1),flexFlow:"row wrap",alignItems:"baseline"})),$5t=x(Ue)({fontWeight:"normal",padding:0,margin:0}),Q$=x(Dc,{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"}}),Z$=x(Fc)(({theme:e})=>({border:"none",padding:e.spacing(2,4),margin:0,"&>.MuiAccordionSummary-content.MuiAccordionSummary-content":{margin:"0"}})),e6=x(Lc)({padding:0}),O5t=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),t6=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),n6=x("h3")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body1.fontSize,fontWeight:e.typography.body2.fontWeight,margin:0})),r6=x(Z)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.body2.fontWeight})),M5t=()=>{const{toggleSectionState:e,expandTimeline:t}=V$(),{trackEvent:n}=Kt();return s.jsxs(Q$,{disableGutters:!0,expanded:t??!1,onChange:()=>e("timeline"),withSummaryContentBorder:!1,children:[s.jsx(Z$,{expandIcon:s.jsx(ha,{titleAccess:"Toggle timeline section"}),id:"timeline-panel-header","aria-controls":"timeline-panel-content",children:s.jsxs(t6,{children:[s.jsx(n6,{children:"Event timeline"}),s.jsxs(r6,{children:["Overview of recent activities across all projects in Unleash. Make debugging easier and"," ",s.jsx(xt,{to:"/integrations/signals",onClick:()=>{n("event-timeline",{props:{eventType:"signals clicked"}})},children:"include external signals"})," ","to get a fuller overview."]})]})}),s.jsx(e6,{children:s.jsx(Wne,{children:s.jsx(A5t,{})})})]})},D5t=()=>{const{personalDashboard:e,refetch:t}=Bne(),n=(e==null?void 0:e.projects)||[],{activeFlag:r,setActiveFlag:o,toggleSectionState:i,expandFlags:a}=V$({flags:(e==null?void 0:e.flags)??[]});return s.jsxs(Q$,{expanded:a??!0,onChange:()=>i("flags"),children:[s.jsx(Z$,{expandIcon:s.jsx(ha,{titleAccess:"Toggle flags section"}),id:"flags-panel-header","aria-controls":"flags-panel-content",children:s.jsxs(t6,{children:[s.jsx(n6,{children:"My feature flags"}),s.jsx(r6,{children:"Feature flags you have created or favorited"})]})}),s.jsx(e6,{children:s.jsx(w3t,{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})})]})},L5t=()=>{const{personalDashboard:e}=Bne(),t=(e==null?void 0:e.projects)||[],{activeProject:n,setActiveProject:r,toggleSectionState:o,expandProjects:i}=V$({projects:t}),a=j3t(Mjt(n));return s.jsxs(Q$,{disableGutters:!0,expanded:i??!0,onChange:()=>o("projects"),children:[s.jsx(Z$,{expandIcon:s.jsx(ha,{titleAccess:"Toggle projects section"}),id:"projects-panel-header","aria-controls":"projects-panel-content",children:s.jsxs(t6,{children:[s.jsx(n6,{children:"My projects"}),s.jsx(r6,{children:"Favorite projects, projects you own, and projects you are a member of"})]})}),s.jsx(e6,{children:s.jsx(y3t,{owners:(e==null?void 0:e.projectOwners)??[],admins:(e==null?void 0:e.admins)??[],projects:t,activeProject:n||"",setActiveProject:r,personalDashboardProjectDetails:a})})]})},F5t=()=>{const{user:e}=Si(),{trackEvent:t}=Kt(),{setSplashSeen:n}=kA(),{splash:r}=fC(),{isOss:o}=rt(),i=(e==null?void 0:e.name)||"";Iu(i?`Dashboard: ${i}`:"Dashboard");const[a,l]=ol("welcome-dialog:v1",r!=null&&r.personalDashboardKeyConcepts?"closed":"open");return m.useEffect(()=>{t("personal-dashboard",{props:{eventType:"seen"}})},[]),s.jsxs(O5t,{children:[o()?s.jsx($3t,{}):null,s.jsxs(I5t,{children:[s.jsxs(Z,{component:"h2",variant:"h2",children:["Welcome ",i]}),s.jsx($5t,{sx:{fontWeight:"normal"},size:"small",variant:"text",onClick:()=>{t("personal-dashboard",{props:{eventType:"open key concepts"}}),l("open")},children:"View key concepts"})]}),s.jsx(M5t,{}),s.jsx(L5t,{}),s.jsx(D5t,{}),s.jsx($jt,{open:a==="open",onClose:()=>{n("personalDashboardKeyConcepts"),l("closed")}})]})},N5t="api/admin/release-plan-templates",B5t=[],hj=()=>{const{isEnterprise:e}=rt(),{data:t,error:n,mutate:r}=Bi(e(),B5t,bt(N5t),z5t);return m.useMemo(()=>({templates:t??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},z5t=e=>fetch(e).then(Jt("Release templates")).then(t=>t.json()),ore=e=>m.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},m.createElement("g",{clipPath:"url(#clip0_28054_15343)"},m.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"}),m.createElement("path",{d:"M16.834 71.409V67.2181H12.6431V71.409H16.834Z",fill:"#F5A69A"}),m.createElement("path",{d:"M37.8536 15.4618H12.6445V67.2163H37.8536V15.4618Z",fill:"#1A4049"}),m.createElement("path",{d:"M37.8554 67.2181H63.0645L63.0645 15.4636H37.8554L37.8554 67.2181Z",fill:"#31545C"}),m.createElement("path",{d:"M55.4316 46.9564H21.668V55.1928H55.4316V46.9564Z",fill:"#B3DAED"}),m.createElement("g",{opacity:.8},m.createElement("mask",{id:"mask0_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:46,width:17,height:10},m.createElement("path",{d:"M37.8389 46.9564V55.2346L21.668 55.1491V46.9564H37.8389Z",fill:"white"})),m.createElement("g",{mask:"url(#mask0_28054_15343)"},m.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)"}))),m.createElement("path",{d:"M55.4316 27.4454H21.668V35.6818H55.4316V27.4454Z",fill:"#B3DAED"}),m.createElement("g",{opacity:.8},m.createElement("mask",{id:"mask1_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:27,width:17,height:9},m.createElement("path",{d:"M37.8389 27.4454V35.7236L21.668 35.6382V27.4454H37.8389Z",fill:"white"})),m.createElement("g",{mask:"url(#mask1_28054_15343)"},m.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)"}))),m.createElement("path",{d:"M56.5577 15.4636H63.0723V8.94908H56.5577V15.4636Z",fill:"#F5A69A"}),m.createElement("path",{d:"M63.0728 19.6545H67.2637V15.4636H63.0728V19.6545Z",fill:"#F5A69A"})),m.createElement("defs",null,m.createElement("pattern",{id:"pattern0_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},m.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),m.createElement("pattern",{id:"pattern1_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},m.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),m.createElement("clipPath",{id:"clip0_28054_15343"},m.createElement("rect",{width:80,height:80,fill:"white"})))),H5t=x("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(1,0,0,0)})),W5t=x("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(1,0,9,0),color:e.palette.text.secondary})),V5t=x("div")(({theme:e})=>({textAlign:"center"})),U5t=x("div")(({theme:e})=>({paddingTop:e.spacing(5)})),G5t=()=>s.jsxs(U5t,{children:[s.jsx(V5t,{children:s.jsx(ore,{})}),s.jsx(H5t,{children:"You have no release templates set up"}),s.jsxs(W5t,{children:["Make the set up of strategies easier for your",s.jsx("br",{}),"teams by creating templates"]})]}),gj={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})}},q5t=x(H0,{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,...gj[t].card(e)})),Y5t=x(J,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({padding:e.spacing(2),display:"flex",flexFlow:"column",height:"100%",position:"relative",...gj[t].body(e)})),K5t=x(J,{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",...gj[t].header(e)})),X5t=x(J)(({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)}})),J5t=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginLeft:"auto"})),Q5t=x(J)(({theme:e})=>({marginTop:e.spacing(2)})),Z5t=x(J,{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",...gj[t].footer(e)})),ire=({icon:e,title:t,headerActions:n,footer:r,cardVariant:o="primary",children:i,...a})=>s.jsxs(q5t,{cardVariant:o,...a,children:[s.jsxs(Y5t,{cardVariant:o,children:[s.jsxs(K5t,{cardVariant:o,children:[e&&s.jsx(X5t,{children:e}),t,n&&s.jsx(J5t,{children:n})]}),i&&s.jsx(Q5t,{children:i})]}),r&&s.jsx(Z5t,{cardVariant:o,children:r})]}),o6=()=>{const{makeRequest:e,makeLightRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0});return{deleteReleasePlanTemplate:async u=>{const d="deleteReleasePlanTemplate",p=`api/admin/release-plan-templates/${u}`,f=n(p,{method:"DELETE"},d);return e(f.caller,f.id)},updateReleasePlanTemplate:async(u,d)=>{const p="updateReleasePlanTemplate",f=`api/admin/release-plan-templates/${u}`,h=n(f,{method:"PUT",body:JSON.stringify(d)},p);return e(h.caller,h.id)},createReleasePlanTemplate:async u=>{const f=n("api/admin/release-plan-templates",{method:"POST",body:JSON.stringify(u)},"createReleasePlanTemplate");return(await e(f.caller,f.id)).json()},archiveReleasePlanTemplate:async u=>{const d="updateReleasePlanTemplate",p=`api/admin/release-plan-templates/archive/${u}`,f=n(p,{method:"POST"},d);return e(f.caller,f.id)}}},eEt=({template:e,open:t,setOpen:n,onConfirm:r})=>s.jsx(Gn,{title:"Archive release template?",open:t,secondaryButtonText:"Cancel",onClose:()=>{n(!1)},permissionButton:s.jsx(Ro,{variant:"contained",onClick:()=>r(e),permission:EA,children:"Archive template"}),children:s.jsxs("p",{children:["You are about to archive release template:"," ",s.jsx("strong",{children:e==null?void 0:e.name})]})}),tEt=x("div")(({theme:e})=>({margin:e.spacing(-1),marginLeft:e.spacing(-.5),display:"flex",justifyContent:"center",alignItems:"center"})),nEt=x(_l)(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(1,1.5)})),rEt=({template:e})=>{const[t,n]=m.useState(null),{archiveReleasePlanTemplate:r}=o6(),{refetch:o}=hj(),{setToastData:i,setToastApiError:a}=Nt(),{trackEvent:l}=Kt(),[c,u]=m.useState(!1),d=Nf(EA),p=m.useCallback(async()=>{try{await r(e.id),o(),i({type:"success",text:"Release template archived"}),l("release-management",{props:{eventType:"archive-template",template:e.name}})}catch(y){a(Tt(y))}},[a,o,i,r]),f=!!t,h=y=>{n(y.currentTarget)},g=()=>{n(null)},v=`release-plan-template-${e.id}-actions`,b=`${v}-menu`;return s.jsxs(tEt,{onClick:y=>{y.preventDefault(),y.stopPropagation()},children:[s.jsx(kt,{title:"Release template actions",arrow:!0,describeChild:!0,children:s.jsx($t,{id:v,"aria-controls":f?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":f?"true":void 0,onClick:h,type:"button",size:"small",children:s.jsx(pm,{})})}),s.jsx(nEt,{id:b,anchorEl:t,open:f,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:s.jsxs(om,{"aria-labelledby":v,children:[s.jsxs(Cr,{onClick:g,component:xt,to:`/release-templates/edit/${e.id}`,children:[s.jsx(Zo,{children:s.jsx(ns,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Edit template"})})]}),s.jsxs(Cr,{onClick:()=>{u(!0),g()},disabled:!d,children:[s.jsx(Zo,{children:s.jsx(Po,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Archive template"})})]})]})}),s.jsx(eEt,{template:e,open:c,setOpen:u,onConfirm:p})]})},oEt=(e,t={})=>{const n=()=>{const c=bt(`api/admin/user-admin/${e}`);return fetch(c,{method:"GET"}).then(Jt("Users")).then(u=>u.json())},{data:r,error:o}=_n(`api/admin/user-admin/${e}`,n,t),[i,a]=m.useState(!o&&!r),l=()=>{Io(`api/admin/user-admin/${e}`)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{user:r||{},error:o,loading:i,refetch:l}},iEt=x(J)({display:"flex",alignItems:"center",gap:pr.spacing(1)}),sEt=x($9)(({theme:e})=>({height:e.spacing(3.5),width:e.spacing(3.5),marginLeft:0})),aEt=x(J)({display:"flex",flexDirection:"column"}),lEt=x("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})),cEt=({template:e})=>{const{user:t}=oEt(`${e.createdByUserId}`);return s.jsxs(iEt,{children:[s.jsx(sEt,{user:t}),s.jsxs(aEt,{children:[s.jsx("span",{children:"Created by"}),s.jsx(lEt,{children:t.name||t.username||t.email})]})]})},uEt=x(xt)(({theme:e})=>({color:"inherit",textDecoration:"none",border:"none",padding:"0",background:"transparent",fontFamily:e.typography.fontFamily,pointer:"cursor"})),dEt=x("h3")(({theme:e})=>({margin:0,marginRight:"auto",fontWeight:e.typography.fontWeightRegular,fontSize:e.typography.body1.fontSize,lineHeight:"1.2"})),pEt=({template:e})=>s.jsx(uEt,{to:`/release-templates/edit/${e.id}`,children:s.jsx(ire,{icon:s.jsx(ore,{}),title:s.jsx(yo,{title:e.name,arrow:!0,component:dEt,children:e.name}),headerActions:s.jsx(rEt,{template:e}),footer:s.jsx(cEt,{template:e}),children:e.description&&s.jsx(yo,{lines:2,title:e.description,arrow:!0,children:e.description})})}),fEt="https://docs.google.com/forms/d/e/1FAIpQLSfbbqsz6wQSgTuJ0NO6ooykTGC_osrzB5-qMrQkbda9SRwnxg/viewform?usp=preview",hEt=x(xt)(({theme:e})=>({textDecoration:"none",fontWeight:e.typography.fontWeightBold,color:e.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),gEt=({title:e,children:t})=>s.jsx(ire,{cardVariant:"secondary",title:e,footer:s.jsx(hEt,{to:fEt,target:"_blank",rel:"noreferrer",children:"Give feedback"}),children:t}),QB=x(jo)({minHeight:"180px"}),mEt=({templates:e})=>s.jsxs(s.Fragment,{children:[e.map(t=>s.jsx(QB,{item:!0,xs:6,md:4,children:s.jsx(pEt,{template:t})},t.id)),e.length>0&&s.jsx(QB,{item:!0,xs:6,md:4,children:s.jsx(gEt,{title:"Release Templates",children:"We would love to get your feedback on the concept around release templates so we can bring it into our work going forward"})},"feedback")]}),vEt="/static/howToApplyReleaseTemplates-CkjJPTRh.png",yEt="/static/howToApplyReleaseTemplatesDark-CfwfIMua.png",xEt=x(kn)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:0,color:e.palette.links,fontWeight:e.fontWeight.medium,"&:hover, &:focus":{textDecoration:"underline"}})),bEt=x(VS)(({theme:e})=>({fontSize:e.spacing(2.25)})),ZB=x("img")(()=>({maxWidth:"100%"})),wEt=x(J)(({theme:e})=>({margin:e.spacing(3,0),display:"flex",borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.elevation1,boxShadow:"none",justifyContent:"center",alignItems:"center","> svg":{display:"block",width:"100%",height:"auto"}})),SEt=()=>{Iu("Release templates");const e=Ot(),t=hj(),{isEnterprise:n}=rt();return n()?s.jsxs(s.Fragment,{children:[s.jsxs(cr,{header:s.jsx(Pn,{title:"Release templates",actions:s.jsx(z9,{Icon:Oo,onClick:()=>{e("/release-templates/create-template")},maxWidth:"700px",permission:jA,disabled:!n(),children:"New template"})}),children:[t.templates.length>0&&s.jsx(jo,{container:!0,spacing:2,children:s.jsx(mEt,{templates:t.templates})}),t.templates.length===0&&s.jsx("div",{className:s1.fullwidth,children:s.jsx(G5t,{})})]}),s.jsx(wEt,{children:s.jsx(Xa,{darkmode:s.jsx(ZB,{src:ti(yEt),alt:"How to setup release templates"}),lightmode:s.jsx(ZB,{src:ti(vEt),alt:"How to setup release templates"})})}),s.jsxs(xEt,{component:"a",href:"https://docs.getunleash.io/reference/release-templates",underline:"hover",rel:"noopener noreferrer",target:"_blank",children:[s.jsx(bEt,{})," Read more in our documentation"]})]}):s.jsx(ym,{feature:"releaseManagement",page:!0})},fE=e=>m.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),CEt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),fontSize:e.fontSizes.smallBody})),jEt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),EEt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),TEt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),kEt=x("p")(({theme:e})=>({fontWeight:e.fontWeight.bold})),hE=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),_Et=()=>s.jsxs(CEt,{children:[s.jsxs(jEt,{children:[s.jsx(Y0,{}),"Release templates"]}),s.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."}),s.jsx("p",{children:"Customize templates to suit your needs by adding strategies to specific milestones. Each milestone will execute sequentially, streamlining your release process."}),s.jsxs(EEt,{children:[s.jsx(kEt,{children:"Example usage"}),s.jsxs(TEt,{children:[s.jsxs("div",{children:[s.jsxs(hE,{children:[s.jsx(fE,{}),"Milestone 1"]}),s.jsx("p",{children:"Enable the feature for internal teams to test functionality and resolve initial issues."})]}),s.jsxs("div",{children:[s.jsxs(hE,{children:[s.jsx(fE,{}),"Milestone 2"]}),s.jsx("p",{children:"Expand the rollout to 20% of beta users to gather feedback and monitor performance."})]}),s.jsxs("div",{children:[s.jsxs(hE,{children:[s.jsx(fE,{}),"Milestone 3"]}),s.jsx("p",{children:"Release the feature to all users after confirming stability and addressing earlier feedback."})]})]})]})]}),REt=x(vr)(({theme:e})=>({width:"100%"})),PEt=x("span")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.bodySize})),AEt=x(ns,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t=!1})=>({cursor:"pointer",marginTop:e.spacing(-.25),marginLeft:e.spacing(.5),height:e.spacing(2.5),width:e.spacing(2.5),color:t?e.palette.error.main:e.palette.text.secondary})),ez=({milestone:e,errors:t,clearErrors:n,milestoneNameChanged:r})=>{const[o,i]=m.useState(!1);return s.jsxs(s.Fragment,{children:[o&&s.jsx(REt,{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:()=>i(!1),autoFocus:!0,onKeyDownCapture:a=>{a.code==="Enter"&&(a.preventDefault(),a.stopPropagation(),i(!1))},onClick:a=>{a.preventDefault(),a.stopPropagation()}}),!o&&s.jsxs(s.Fragment,{children:[s.jsx(PEt,{onClick:a=>{i(!0),a.preventDefault(),a.stopPropagation()},children:e.name}),s.jsx(AEt,{hasError:!!(t!=null&&t[`${e.id}_name`]),onClick:a=>{i(!0),a.preventDefault(),a.stopPropagation()}})]})]})},IEt=(e,t)=>{const n={};return t.parameters.forEach(r=>{n[r.name]=$Et(e,r)}),{name:t.name,constraints:[],parameters:n}},$Et=(e,t)=>t.name==="rollout"||t.name==="percentage"||t.type==="percentage"?"50":t.name==="stickiness"?"":t.name==="groupId"?e:t.type==="boolean"?"false":"",OEt=x("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}})),MEt=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),DEt=x(FC)(({theme:e})=>({fontWeight:e.fontWeight.bold})),LEt=x("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}})),FEt=({strategy:e,onClick:t})=>{const n=NDe(e.name),r=Il(e.name);return s.jsxs(LEt,{onClick:()=>{const o=IEt("",e);o.name==="flexibleRollout"&&(o.parameters={...o.parameters,groupId:"{{featureName}}"}),t({id:wi(),name:o.name,strategyName:o.name,title:"",constraints:o.constraints,parameters:o.parameters})},children:[s.jsx(OEt,{children:s.jsx(n,{})}),s.jsxs("div",{children:[s.jsx(DEt,{text:e.displayName||r,maxWidth:"200",maxLength:25}),s.jsx(MEt,{children:e.description})]})]})},NEt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody,padding:e.spacing(1,2)})),tz=({openEditAddStrategy:e})=>{const{strategies:t}=rh(),n=t.filter(o=>!o.deprecated&&!o.editable),r=o=>{e(o)};return s.jsx(Ni,{dense:!0,children:s.jsxs(s.Fragment,{children:[s.jsx(NEt,{color:"textSecondary",children:"Predefined strategy types"}),n.map(o=>s.jsx(Gr,{children:s.jsx(FEt,{strategy:o,onClick:r})},o.name))]})})},BEt=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),zEt=x("p")(({theme:e})=>({color:e.palette.text.secondary})),HEt=x("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})),WEt=({segments:e,setSegments:t})=>{const[n,r]=m.useState(),o=e.length-1;return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e&&e.length>0,show:s.jsx(zEt,{children:"Selected Segments"})}),s.jsx(BEt,{children:e.map((i,a)=>s.jsxs(m.Fragment,{children:[s.jsx(ree,{segment:i,setSegments:t,preview:n,setPreview:r}),s.jsx(X,{condition:a<o,show:s.jsx(HEt,{children:"AND"})})]},i.id))}),s.jsx(X,{condition:!!n,show:()=>s.jsx(AI,{segment:n,isExpanded:!0})})]})},VEt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),UEt=({segments:e,setSegments:t})=>{const{segments:n}=ma(),{strategySegmentsLimit:r}=bp(),o=!!(r&&e.length>=r);if(!n||n.length===0)return null;const a=n.filter(c=>!e.find(u=>u.id===c.id)).map(c=>({value:String(c.id),label:c.name})),l=([c])=>{const u=n.find(d=>String(d.id)===c.value);u&&t(d=>[...d,u])};return s.jsxs(s.Fragment,{children:[s.jsxs(VEt,{children:[s.jsx(Z,{children:"Segments"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),o&&s.jsx(oee,{}),s.jsx(PI,{label:"Select segments",options:a,onChange:l,disabled:o,icon:null,width:"175px"}),s.jsx(WEt,{segments:e,setSegments:t})]})},GEt=x(J)(({theme:e})=>({paddingBottom:e.spacing(2)})),qEt=x(Z)(({theme:e})=>({paddingBottom:e.spacing(2)})),YEt=({title:e,setTitle:t})=>s.jsxs(GEt,{children:[s.jsx(qEt,{children:"What would you like to call this strategy? (optional)"}),s.jsx(vr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),KEt=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},XEt=({strategy:e,setStrategy:t})=>{m.useEffect(()=>()=>{e.constraints&&t(o=>{var i;return{...o,constraints:(i=o.constraints)==null?void 0:i.filter(KEt)}})},[]);const n=e.constraints||[],r=o=>{t(i=>({...i,constraints:o instanceof Function?o(i.constraints||[]):o}))};return s.jsx(nee,{constraints:n,setConstraints:r,showCreateButton:!0})},JEt=x("div")({display:"flex",flexDirection:"column"}),QEt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),ZEt=({strategy:e,setStrategy:t})=>{const n=(e.variants||[]).map(d=>({...d,new:!0,isValid:!0,id:wi(),overrides:[]})),[r,o]=m.useState(n),i=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default",a=qt();m.useEffect(()=>()=>{t(d=>({...d,variants:r.filter(p=>!!p.name)}))},[JSON.stringify(r)]),m.useEffect(()=>{t(d=>({...d,variants:r.map(p=>({stickiness:i,name:p.name,weight:p.weight,payload:p.payload,weightType:p.weightType}))}))},[i,JSON.stringify(r)]);const l=(d,p)=>{o(f=>I2(f.map(h=>h.id===p?d:h),1e3))},c=()=>{const d=wi();o(p=>[...p,{name:"",weightType:oc.VARIABLE,weight:0,stickiness:i,new:!0,isValid:!1,id:d}])},u=r.reduce((d,p)=>d+(p.weight||0),0)!==1e3;return s.jsxs(s.Fragment,{children:[s.jsx(Lt,{severity:"info",icon:!1,children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),s.jsxs(QEt,{children:[s.jsx(Z,{children:"Variants"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{variant:"body2",children:["Variants in feature toggling 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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),s.jsxs(JEt,{children:[r.length>0&&s.jsx(dee,{}),r.map((d,p)=>s.jsx(uee,{disableOverrides:!0,variant:d,variants:r,updateVariant:f=>l(f,d.id),removeVariant:()=>o(f=>I2(f.filter(h=>h.id!==d.id),1e3)),decorationColor:a.palette.variants[p%a.palette.variants.length],weightsError:u},d.id))]}),s.jsx(Ue,{onClick:c,variant:"outlined",startIcon:s.jsx(Oo,{}),children:"Add variant"}),s.jsx(OI,{variants:r,weightsError:u})]})},e4t=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),t4t=x(J)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",width:"100%",justifyContent:"space-between"})),n4t=x(J)(({theme:e})=>({width:"50%",marginRight:e.spacing(.5)})),r4t=x(J)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"50%",marginLeft:e.spacing(.5),marginBottom:e.spacing(2),"& > div":{flex:1}})),o4t="default",i4t=({parameters:e,updateParameter:t,editable:n,errors:r})=>{const o=(c,u)=>{t("rollout",u.toString())},i=e.rollout!==void 0?Og(e.rollout):100,a=m.useMemo(()=>(e.stickiness||t("stickiness",o4t),Wa(e.stickiness)),[e.stickiness]),l=Wa(e.groupId);return s.jsxs(e4t,{children:[s.jsx(dI,{name:"Rollout",value:i,disabled:!n,onChange:o}),s.jsxs(t4t,{children:[s.jsx(n4t,{children:s.jsx(hZ,{label:"Stickiness",value:a,editable:n,onChange:c=>t("stickiness",c.target.value)})}),s.jsxs(r4t,{children:[s.jsx(vr,{label:"groupId",sx:{width:"100%"},id:"groupId-input",value:l,disabled:!n,onChange:c=>t("groupId",Wa(c.target.value)),error:!!(r!=null&&r.getFormError("groupId")),helperText:r==null?void 0:r.getFormError("groupId")}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(s.Fragment,{children:["Supports ",s.jsx("strong",{children:"{{featureName}}"})," as a template variable. If not set, defaults to the feature flag name."]})})]})]})]})},s4t=({strategy:e,strategyDefinition:t,parameters:n,updateParameter:r,errors:o})=>{if(!t)return null;switch(e.strategyName){case"default":return s.jsx(fZ,{strategyDefinition:t});case"flexibleRollout":return s.jsx(i4t,{parameters:n,updateParameter:r,errors:o,editable:!0});default:return s.jsx(gZ,{strategyDefinition:t,parameters:e.parameters??{},updateParameter:r,editable:!0,errors:o})}},a4t=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),l4t=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",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,borderTop:`1px solid ${e.palette.divider}`})),c4t=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),u4t=x("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),d4t=x(J)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),p4t=x(bR)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),f4t=x(If)(({theme:e})=>({width:"100px"})),nz=x(sn)(({theme:e})=>({marginLeft:e.spacing(1)})),h4t=x("div")(({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%"})),g4t=x(J)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),m4t=x(jr)(({theme:e})=>({width:"100%"})),v4t=x(pI)(({theme:e})=>({top:"-10px",left:"0",transform:"translateY(0)"})),rz=({onCancel:e,strategy:t,onAddUpdateStrategy:n,editMode:r})=>{var C,T;const[o,i]=m.useState(t),[a,l]=m.useState(0),{segments:c,refetchSegments:u}=ma(),[d,p]=m.useState([]),{strategyDefinition:f}=LC(t==null?void 0:t.strategyName),h=KC(t==null?void 0:t.constraints),g=cI(),v=!!(o!=null&&o.parameters&&"stickiness"in(o==null?void 0:o.parameters)),b=o!=null&&o.parameters&&"stickiness"in(o==null?void 0:o.parameters)?String(o.parameters.stickiness):"default",y=c==null?void 0:c.reduce((k,_)=>(k[_.id]=_,k),{});if(m.useEffect(()=>{y&&p(((o==null?void 0:o.segments)||[]).map(k=>y[k]))},[]),m.useEffect(()=>{i(k=>({...k,segments:d.map(_=>_.id)}))},[d]),m.useEffect(()=>{i(k=>({...k,variants:(o.variants||[]).map(_=>({stickiness:b,name:_.name,weight:_.weight,payload:_.payload,weightType:_.weightType}))}))},[b,JSON.stringify(o.variants)]),!t||!o||!f)return null;const w=(k,_)=>{l(_)},S=()=>{var A;const k=((A=o==null?void 0:o.constraints)==null?void 0:A.length)||0,_=(d==null?void 0:d.length)||0;return k+_},j=(k,_)=>{i(Ma(A=>{if(A){if(k==="title"){A.title=_;return}A.parameters=A.parameters??{},A.parameters[k]=_}}))},E=()=>{n(o)};return s.jsxs(Fr,{modal:!0,disablePadding:!0,description:fee,documentationLink:hee,documentationLinkLabel:gee,children:[s.jsx(c4t,{children:s.jsxs(u4t,{children:[Il(o.strategyName||""),o.strategyName==="flexibleRollout"&&s.jsxs(sn,{color:"success",sx:{marginLeft:"1rem"},children:[(C=o.parameters)==null?void 0:C.rollout,"%"]})]})}),!uJ.includes(t.strategyName||"default")&&s.jsx(d4t,{children:s.jsxs(Lt,{severity:"warning",children:["Custom strategies are deprecated. We recommend not adding them to any templates going forward and using the predefined strategies like Gradual rollout with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",variant:"body2",children:"constraints"})," ","instead."]})}),s.jsxs(p4t,{value:a,onChange:w,children:[s.jsx(f4t,{label:"General"}),s.jsx(If,{label:s.jsxs(Z,{children:["Targeting",s.jsx(nz,{children:S()})]})}),v&&s.jsx(If,{label:s.jsxs(Z,{children:["Variants",s.jsx(nz,{children:((T=o==null?void 0:o.variants)==null?void 0:T.length)||0})]})})]}),s.jsxs(h4t,{children:[a===0&&s.jsxs(s.Fragment,{children:[s.jsx(YEt,{title:o.title||"",setTitle:k=>j("title",k)}),s.jsx(s4t,{strategy:o,strategyDefinition:f,parameters:o.parameters,updateParameter:j,errors:g})]}),a===1&&s.jsxs(s.Fragment,{children:[s.jsx(Lt,{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."}),s.jsx(UEt,{segments:d,setSegments:p}),s.jsxs(g4t,{children:[s.jsx(m4t,{}),s.jsx(v4t,{})]}),s.jsx(XEt,{strategy:o,setStrategy:i})]}),a===2&&v&&s.jsx(ZEt,{strategy:o,setStrategy:i})]}),s.jsxs(l4t,{children:[s.jsx(Ue,{variant:"contained",color:"primary",type:"submit",disabled:!h||g.hasFormErrors(),onClick:E,children:r?"Add changes":"Add strategy"}),s.jsx(a4t,{onClick:e,children:"Cancel"})]})]})},y4t=x("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(+ * .${X2}, + .${X2})`]:{filter:"grayscale(.8)"}})),sre=()=>s.jsx(y4t,{role:"separator",children:"OR"});var i6={},x4t=Te;Object.defineProperty(i6,"__esModule",{value:!0});var Mb=i6.default=void 0,b4t=x4t(ke()),w4t=s,S4t=(0,b4t.default)((0,w4t.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");Mb=i6.default=S4t;const C4t=(e,t)=>{const{parameters:n}=e,r=m.useMemo(()=>t.find(a=>a.name===e.name),[t,e.name]),o=r==null?void 0:r.editable,i=(a,l)=>{if(!n||!a.name)return null;const{type:c,name:u}=a,d=s.jsx(yo,{title:u,children:u}),p=`${c}${l}`;switch(c){case"list":{const f=l0(n[u]);return!f||f.length===0?null:s.jsxs(gc,{type:d,children:[f.length===1?"has 1 item:":`has ${f.length} items:`,s.jsx(d1,{values:f})]},p)}case"percentage":{const f=Og(n[u]);return s.jsxs(gc,{type:d,children:["is set to ",s.jsx(Mg,{label:`${f}%`})]},p)}case"boolean":{const f=n[u];return s.jsxs(gc,{type:d,children:["is set to ",s.jsx(Mg,{label:f})]},p)}case"string":{const f=Wa(n[u]);return s.jsxs(gc,{type:d,children:[f===""?"is an empty string":"is set to",s.jsx(d1,{values:f===""?void 0:[f]})]},p)}case"number":{const f=Og(n[u]);return s.jsxs(gc,{type:d,children:["is a number set to",s.jsx(d1,{values:[`${f}`]})]},p)}case"default":return null}return null};return m.useMemo(()=>{var a;return{isCustomStrategy:o,customStrategyParameters:o?(a=r==null?void 0:r.parameters)==null?void 0:a.map(i).filter(Boolean):[]}},[r,o,n])},oz=({value:e,parameters:t,hasConstraints:n,displayGroupId:r})=>{const o=Og(e),a=typeof(t==null?void 0:t.stickiness)=="string"&&(t==null?void 0:t.stickiness)!=="default"?s.jsxs(s.Fragment,{children:["with ",s.jsx("strong",{children:t.stickiness})]}):"";return s.jsx(s.Fragment,{children:s.jsxs(gc,{type:"Rollout %",children:[s.jsx(Mg,{label:`${o}%`}),s.jsxs("p",{children:["of your base ",a," ",s.jsxs("span",{children:[n?"who match constraints ":" ","is included."]}),r&&(t!=null&&t.groupId)?s.jsx(Mg,{label:`groupId: ${t==null?void 0:t.groupId}`,component:"span"}):null]})]})})},j4t=(e,t)=>{const{constraints:n,variants:r}=e,{parameters:o}=e,i=!!(n!=null&&n.length),a=o?Object.keys(o):[],l=c=>{const u=c.toLocaleLowerCase(),d=(o==null?void 0:o[c])||"";return u==="rollout"?s.jsx(oz,{value:d,parameters:o,hasConstraints:i,displayGroupId:t},c):["userids","hostnames","ips"].includes(u)?s.jsx(gc,{type:c,children:s.jsx(d1,{values:l0(d)})},c):null};return m.useMemo(()=>[...a.map(l),e.name==="default"?s.jsx(oz,{value:"100"}):null].filter(Boolean),[o,i,t])},E4t=x("div")(({theme:e})=>({padding:e.spacing(3.5,2,.5)})),T4t=x("div")(()=>({width:"100%",position:"relative"})),k4t=({variants:e,selected:t})=>e!=null&&e.length?s.jsx(E4t,{children:s.jsx(gc,{type:`Variants (${e.length})`,alignType:"top",children:s.jsx(T4t,{children:s.jsx(OI,{variants:e,header:!1,selected:t})})})}):null,Sy=({strategy:e,displayGroupId:t=!1})=>{const{strategies:n}=rh(),{segments:r}=ma(),{isCustomStrategy:o,customStrategyParameters:i}=C4t(e,n),a=j4t(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 s.jsxs(s.Fragment,{children:[s.jsxs(NC,{children:[c==null?void 0:c.map(u=>s.jsx(AI,{segment:u},u.id)),l==null?void 0:l.map((u,d)=>s.jsx(qC,{constraint:u},`${vm(u)}-${d}`)),(o?i:a).map((u,d)=>s.jsx(mZ,{children:u},d))]}),s.jsx(k4t,{variants:e.variants})]})},are=3,_4t=x($t)(({theme:e})=>({marginLeft:e.spacing(-are),padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"})),R4t=x("hgroup")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",columnGap:"1ch",fontSize:e.typography.body1.fontSize,".strategy-name":{fontWeight:"bold",whiteSpace:"nowrap"}})),P4t=x("article")(({theme:e})=>({background:"inherit",padding:e.spacing(are),paddingTop:e.spacing(.5),display:"flex",flexDirection:"column",rowGap:e.spacing(.5)})),A4t=x(yo)(({theme:e})=>({fontSize:e.typography.body1.fontSize,fontWeight:"normal",margin:0})),I4t=x("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"center",color:t?e.palette.text.secondary:e.palette.text.primary})),$4t=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),O4t=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,headerItemsLeft:o,strategyHeaderLevel:i=3,children:a,style:l={},className:c})=>{const u="links"in e?({children:d})=>s.jsx(xt,{to:e.links.edit,children:d}):({children:d})=>s.jsxs(s.Fragment,{children:[" ",d," "]});return s.jsx(J,{className:e.disabled?X2:"",sx:{position:"relative"},children:s.jsxs(P4t,{style:l,className:c,children:[s.jsxs(I4t,{disabled:!!(e!=null&&e.disabled),children:[t?s.jsx(_4t,{tabIndex:-1,className:"strategy-drag-handle",draggable:!0,disableRipple:!0,size:"small",onDragStart:t,onDragEnd:n,sx:{cursor:"move"},children:s.jsx(ej,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})}):null,s.jsxs($4t,{children:[s.jsx(u,{children:s.jsx(R4t,{children:e.title?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"strategy-name",children:[Il(String(e.name)),":"]}),s.jsx(A4t,{component:`h${i}`,children:e.title})]}):s.jsx(Z,{className:"strategy-name",component:`h${i}`,children:Il(String(e.name))})})}),o]}),s.jsxs(J,{sx:{marginLeft:"auto",display:"flex",alignItems:"center"},children:[e.disabled?s.jsx(sn,{color:"warning",children:"Strategy disabled"}):null,r]})]}),s.jsx(J,{children:a})]})})},lre=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,strategyHeaderLevel:o})=>s.jsx(O4t,{strategyHeaderLevel:o,strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,children:s.jsx(Sy,{strategy:e})}),M4t=({strategy:e,index:t,isDragging:n,onDragStartRef:r,onDragOver:o,onDragEnd:i,headerItemsRight:a})=>{const l=m.useRef(null);return s.jsx(J,{ref:l,onDragOver:o==null?void 0:o(l,t),sx:{opacity:n?"0.5":"1"},children:s.jsx(lre,{headerItemsRight:a,strategy:e,onDragStart:r==null?void 0:r(l,t),onDragEnd:i})},e.id)},cre=x("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)}})),D4t=e=>e.palette.background.elevation2,L4t=e=>e.palette.background.elevation1,ure=x("li")(({theme:e,...t})=>({background:t["data-type"]==="release-plan"?D4t(e):L4t(e)})),F4t=x("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}}})),N4t=x("span")(({theme:e})=>({paddingTop:e.spacing(2),paddingInline:e.spacing(.5),display:"block",height:"100%",width:"100%"})),B4t=x("span")(({theme:e})=>({display:"block",paddingBlock:e.spacing(.75),borderRadius:e.shape.borderRadiusMedium,"> svg":{verticalAlign:"bottom"}})),iz=({dragItemRef:e})=>s.jsx(F4t,{tabIndex:-1,type:"button",children:s.jsxs(N4t,{ref:e,children:[s.jsx(B4t,{className:"draggable-hover-indicator",children:s.jsx(ej,{"aria-hidden":!0})}),s.jsx(Bc,{children:"Drag to reorder"})]})}),dre=3,sz=x("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"})),z4t=x(H0,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t})=>({position:"relative",overflow:"initial",display:"flex",alignItems:"center",padding:e.spacing(2,2),paddingLeft:e.spacing(dre),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})),az=x("div")(({theme:e})=>({display:"flex",flexFlow:"row",alignItems:"center"})),H4t=x(Ue)(({theme:e})=>({})),W4t=x(Dc)(({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"})),V4t=x(Fc)(({theme:e})=>({boxShadow:"none",padding:e.spacing(1.5,2),paddingLeft:e.spacing(dre),borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down(400)]:{padding:e.spacing(1,2)},"&:focus-visible":{background:e.palette.table.headerHover}})),U4t=x(Lc)(({theme:e})=>({borderBottomLeftRadius:e.shape.borderRadiusMedium,borderBottomRightRadius:e.shape.borderRadiusMedium,padding:e.spacing(0),backgroundColor:e.palette.background.elevation1})),G4t=x("div")(({theme:e})=>({padding:e.spacing(2),display:"flex",justifyContent:"flex-end",gap:e.spacing(3),backgroundColor:"inherit",borderTop:`1px solid ${e.palette.divider}`})),q4t=x($t)(({theme:e})=>({marginLeft:e.spacing(1),color:e.palette.primary.main})),Y4t=({milestone:e,milestoneChanged:t,errors:n,clearErrors:r,removable:o,onDeleteMilestone:i,index:a,onMoveItem:l})=>{const[c,u]=m.useState(),[d,p]=m.useState(null),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[b,y]=m.useState(!!e.startExpanded),w=!!c,S=w?"MilestoneStrategyMenuPopover":void 0,j=qee(a,l),E=()=>{u(void 0)},[C,T]=m.useState({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),k=B=>{const L=e.strategies||[];t({...e,strategies:[...L.map(I=>I.id===B.id?B:I)]})},_=B=>{var L;t({...e,strategies:[...e.strategies||[],{...B,strategyName:B.strategyName,sortOrder:((L=e.strategies)==null?void 0:L.length)||0}]})},A=B=>{var I;((I=e.strategies)==null?void 0:I.find(q=>q.id===B.id))?k(B):(_(B),y(!0)),h(!1),v(!1),T({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),r()},O=(B,L)=>{v(L),T(B),h(!0)},M=B=>(L,I)=>q=>{if(d===null||L.current===null||d.index===I||B===d.id)return;const{top:ee,bottom:W}=L.current.getBoundingClientRect(),oe=q.clientY-ee<d.height,ne=W-q.clientY<d.height,ce=d.index>I;if(oe&&ce||ne&&!ce){const re=[...e.strategies||[]],ve=re.splice(d.index,1)[0];re.splice(I,0,ve),t({...e,strategies:re}),p({...d,index:I})}},H=(B,L)=>I=>{var q,ee;!B.current||!e.strategies||(p({id:(q=e.strategies[L])==null?void 0:q.id,index:L,height:((ee=B.current)==null?void 0:ee.offsetHeight)||0}),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/html",B.current.outerHTML),I.dataTransfer.setDragImage(B.current,20,20))},P=()=>{p(null),$()},$=()=>{if(!e.strategies)return;const B=[...e.strategies];B.forEach((L,I)=>{L.sortOrder=I}),t({...e,strategies:B})},D=B=>{const L=e.strategies||[];t({...e,strategies:[...L.filter(I=>I.id!==B)]})},z=B=>{t({...e,name:B})};return!e.strategies||e.strategies.length===0?s.jsxs(s.Fragment,{children:[s.jsxs(sz,{children:[s.jsx(iz,{dragItemRef:j}),s.jsxs(z4t,{hasError:!!(n!=null&&n[e.id])||!!(n!=null&&n[`${e.id}_name`]),children:[s.jsx(az,{children:s.jsx(ez,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:z})}),s.jsxs(az,{children:[s.jsx(Ue,{variant:"outlined",color:"primary",onClick:B=>u(B.currentTarget),children:"Add strategy"}),s.jsx(q4t,{title:"Remove milestone",onClick:i,disabled:!o,children:s.jsx(Mb,{})}),s.jsx(_l,{id:S,open:w,anchorEl:c,onClose:E,onClick:E,PaperProps:{sx:B=>({paddingBottom:B.spacing(1)})},children:s.jsx(tz,{openEditAddStrategy:B=>{O(B,!1)}})})]})]})]}),s.jsx(L4,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),s.jsx(Za,{label:"Add strategy to template milestone",onClose:()=>{h(!1),v(!1)},open:f,children:s.jsx(rz,{strategy:C,onAddUpdateStrategy:A,onCancel:()=>{h(!1),v(!1)},editMode:g})})]}):s.jsxs(s.Fragment,{children:[s.jsxs(sz,{children:[s.jsx(iz,{dragItemRef:j}),s.jsxs(W4t,{expanded:b,onChange:(B,L)=>y(L),children:[s.jsx(V4t,{expandIcon:s.jsx(ha,{titleAccess:`${b?"Hide":"Show"} milestone strategies`}),id:`milestone-accordion-summary-${e.id}`,"aria-controls":`milestone-accordion-details-${e.id}`,children:s.jsx(ez,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:z})}),s.jsxs(U4t,{children:[s.jsx(cre,{children:e.strategies.map((B,L)=>s.jsxs(ure,{children:[L>0?s.jsx(sre,{}):null,s.jsx(M4t,{index:L,onDragEnd:P,onDragStartRef:H,onDragOver:M(B.id),isDragging:(d==null?void 0:d.id)===B.id,strategy:{...B,name:B.name||B.strategyName||""},headerItemsRight:s.jsxs(s.Fragment,{children:[s.jsx($t,{title:"Edit strategy",onClick:()=>{O(B,!0)},children:s.jsx(ns,{})}),s.jsx($t,{title:"Remove strategy",onClick:()=>D(B.id),children:s.jsx(Mb,{})})]})})]},B.id))}),s.jsxs(G4t,{children:[s.jsxs(Ue,{variant:"text",color:"primary",onClick:i,disabled:!o,children:[s.jsx(Mb,{})," Remove milestone"]}),s.jsx(H4t,{variant:"outlined",color:"primary",onClick:B=>u(B.currentTarget),children:"Add strategy"}),s.jsx(_l,{id:S,open:w,anchorEl:c,onClose:E,onClick:E,PaperProps:{sx:B=>({paddingBottom:B.spacing(1)})},children:s.jsx(tz,{openEditAddStrategy:B=>{O(B,!1)}})})]})]})]})]}),s.jsx(L4,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),s.jsx(Za,{label:"Add strategy to template milestone",onClose:()=>{h(!1),v(!1)},open:f,children:s.jsx(rz,{strategy:C,onAddUpdateStrategy:A,onCancel:()=>{h(!1),v(!1)},editMode:g})})]})},K4t=x(Ue)(({theme:e})=>({marginTop:e.spacing(1),maxWidth:e.spacing(20)})),X4t=({milestones:e,setMilestones:t,errors:n,clearErrors:r,milestoneChanged:o})=>{const i=m.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:g}=p.getBoundingClientRect(),v=u.clientY-h<f,b=g-u.clientY<f;if(l>c?v:b){const j=[...e||[]],E=j.splice(l,1)[0];j.splice(c,0,E),j.forEach((C,T)=>{C.sortOrder=T}),t(j)}}},[e]),a=l=>()=>{t(c=>c.filter(u=>u.id!==l).map((u,d)=>({...u,sortOrder:d})))};return s.jsxs(s.Fragment,{children:[e.map((l,c)=>s.jsx(Y4t,{index:c,onMoveItem:i,milestone:l,milestoneChanged:o,errors:n,clearErrors:r,removable:e.length>1,onDeleteMilestone:a(l.id)},l.id)),s.jsx(K4t,{variant:"text",color:"primary",startIcon:s.jsx(Oo,{}),onClick:()=>t(l=>{var c;return[...l,{id:wi(),name:`Milestone ${l.length+1}`,sortOrder:l.length,strategies:(c=l[l.length-1].strategies)==null?void 0:c.map(u=>({...u,id:wi()})),startExpanded:!0}]}),children:"Add milestone"})]})},J4t=x(vr)(({theme:e})=>({maxWidth:e.spacing(50),fieldset:{border:"none"},"label::first-letter":{textTransform:"uppercase"},marginBottom:e.spacing(2),padding:e.spacing(0)})),Q4t=x(vr)(({theme:e})=>({width:"100%",fieldset:{border:"none"},"label::first-letter":{textTransform:"uppercase"},marginBottom:e.spacing(2),padding:e.spacing(2,5,1,1.75)})),Z4t=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",paddingTop:e.spacing(5)})),eTt=x(J)(({theme:e})=>({flex:1,display:"flex",alignItems:"flex-end",marginTop:e.spacing(3),marginBottom:e.spacing(3)})),pre=({name:e,setName:t,description:n,setDescription:r,milestones:o,setMilestones:i,errors:a,clearErrors:l,formTitle:c,archived:u,formatApiCode:d,handleSubmit:p,Limit:f,children:h})=>{const g=qt(),v=b=>{i(y=>y.map(w=>w.id===b.id?{...b}:w))};return s.jsxs(Fr,{title:c,description:s.jsx(_Et,{}),formatApiCode:d,children:[u&&s.jsx(Lt,{severity:"warning",children:"This template has been archived and can no longer be edited."}),s.jsxs(Z4t,{onSubmit:p,children:[s.jsx(J4t,{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:g.typography.h1.fontSize}},InputLabelProps:{style:{fontSize:g.typography.h1.fontSize}},size:"medium"}),s.jsx(Q4t,{label:"Template description (optional)",multiline:!0,value:n,onChange:b=>r(b.target.value),InputProps:{style:{fontSize:g.typography.h2.fontSize,padding:0}},InputLabelProps:{style:{fontSize:g.typography.h2.fontSize,padding:0}},size:"small"}),s.jsx(X4t,{milestones:o,setMilestones:i,errors:a,clearErrors:l,milestoneChanged:v}),s.jsx(eTt,{children:f}),h]})]})},fre=(e="",t="",n=[{id:wi(),name:"Milestone 1",sortOrder:0}])=>{const r=$s("templateId"),{templates:o}=hj(),[i,a]=m.useState(e),[l,c]=m.useState(t),[u,d]=m.useState(n),[p,f]=m.useState({});return m.useEffect(()=>{a(e)},[e]),m.useEffect(()=>{c(t)},[t]),m.useEffect(()=>{d(n)},[n.length]),{name:i,setName:a,description:l,setDescription:c,milestones:u,setMilestones:d,errors:p,clearErrors:()=>{f({})},validate:()=>{let b=!0;i.length===0&&(f(S=>({...S,name:"Name can not be empty."})),b=!1),o.some(S=>S.name===i&&S.id!==r)&&(f(S=>({...S,name:"A template with this name already exists."})),b=!1),u.length===0&&(f(S=>({...S,milestones:"At least one milestone is required."})),b=!1);const y={},w=new Set;return u.forEach(S=>{(!S.name||S.name.length===0)&&(y[S.id]="Milestone must have a valid name.",y[`${S.id}_name`]="Milestone must have a valid name."),(!S.strategies||S.strategies.length===0)&&(y[S.id]="Milestone must have at least one strategy."),w.has(S.name)?y[S.id]="Milestone names must be unique.":S.name&&w.add(S.name)}),Object.keys(y).length>0&&(f(S=>({...S,...y,milestones:"All milestones must have unique names and at least one strategy each."})),b=!1),b},getTemplatePayload:()=>({name:i,description:l,milestones:u.map(({startExpanded:b,...y})=>y)})}},tTt=x("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),nTt=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),rTt=()=>{const{uiConfig:e,isEnterprise:t}=rt(),{setToastApiError:n,setToastData:r}=Nt(),o=Ot(),{createReleasePlanTemplate:i}=o6(),{trackEvent:a}=Kt(),{templates:l}=hj(),c=e.resourceLimits.releaseTemplates,u=l.length<c;Iu("Create release template");const{name:d,setName:p,description:f,setDescription:h,milestones:g,setMilestones:v,errors:b,clearErrors:y,validate:w,getTemplatePayload:S}=fre(),j=()=>{o(as)},E=async T=>{if(T.preventDefault(),y(),w())try{const _=await i(S());hK(),r({type:"success",text:"Release template created"}),a("release-management",{props:{eventType:"create-template",template:_.name}}),o("/release-templates")}catch(_){n(Tt(_))}},C=()=>`curl --location --request POST '${e.unleashUrl}/api/admin/release-plan-templates' \\
465
+ `})),Wne=x("div")(({theme:e})=>({padding:e.spacing(2,4)})),Ujt=x(Wne,{shouldForwardProp:e=>!["gridArea"].includes(e.toString())})(({theme:e,gridArea:t})=>({maxHeight:"100%",overflowY:"auto",gridArea:t})),x1=x("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({padding:e.spacing(3,4),maxHeight:"100%",overflowY:"auto",gridArea:t})),Gjt=x("div",{shouldForwardProp:e=>e!=="gridArea"})(({theme:e,gridArea:t})=>({display:"none",gridArea:t,...fj({display:"block"})({theme:e})})),Vne=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",width:"100%"})),Une=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)}),Gne=x(Ni)(({theme:e})=>({maxHeight:"400px",...fj({maxHeight:"100%"})({theme:e})})),qne=x("div")(({theme:e,lines:t=2})=>({fontWeight:e.typography.fontWeightRegular,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"})),wy=x("span")(({theme:e})=>({width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.neutral.border,borderRadius:"50%"})),qjt=x(wy)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper})),Yjt=x("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)})),Kjt=({project:e})=>{const{trackEvent:t}=Kt();return s.jsxs(zc,{"data-loading":!0,title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"1"}),"Create a feature flag"]}),children:[s.jsxs("div",{children:[s.jsx("p",{children:"The project currently holds no feature flags."}),s.jsx("p",{children:"Create one to get started."})]}),s.jsx("div",{children:s.jsx(Ue,{href:`projects/${e}`,onClick:()=>{t("personal-dashboard",{props:{eventType:"Go to project from onboarding"}})},variant:"contained",children:"Go to project"})})]})},Xjt=({project:e})=>s.jsxs(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(qjt,{children:"1"}),"Create a feature flag"]}),children:[s.jsxs(Yjt,{children:[s.jsx(Z,{fontWeight:"bold",variant:"body2",children:"You have created your first flag"}),s.jsx(Z,{variant:"body2",children:"Go to the project to customize the flag further."})]}),s.jsx("div",{children:s.jsx(Ue,{component:xt,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),NB=({project:e})=>s.jsxs(zc,{"data-loading":!0,title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"2"}),"Connect an SDK"]}),children:[s.jsxs("div",{children:[s.jsx("p",{children:"Your project is not yet connected to any SDK."}),s.jsx("p",{children:"To start using your feature flag, connect an SDK to the project."})]}),s.jsx("div",{children:s.jsx(Ue,{component:xt,to:`/projects/${e}`,variant:"contained",children:"Go to project"})})]}),Jjt=x("ul")(({theme:e})=>({padding:0,alignItems:"flex-start",display:"flex",flexFlow:"column nowrap",gap:e.spacing(2)})),Qjt=x("li")(({theme:e})=>({listStyleType:"none",padding:e.spacing(0),display:"inline-flex",gap:e.spacing(2),fontSize:e.typography.body2.fontSize,"*":{fontWeight:"normal"}}));x("div")(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(2),alignItems:"center"}));const Zjt=x("time")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.fontSize,marginBottom:e.spacing(1)})),e3t=x(hp)(({theme:e})=>({marginTop:e.spacing(.5)})),t3t=x(ep)({overflowWrap:"anywhere"}),n3t=({children:e})=>e,r3t=({latestEvents:e})=>{const{locationSettings:t}=wo();return s.jsx(zc,{title:s.jsx(Z,{sx:{fontWeight:"bold"},component:"h4",children:"Latest events"}),children:s.jsx(Jjt,{children:e.map(n=>s.jsxs(Qjt,{children:[s.jsx(e3t,{src:n.createdByImageUrl}),s.jsxs("div",{children:[s.jsx(Zjt,{dateTime:n.createdAt,children:QP(n.createdAt,t.locale)}),s.jsx(t3t,{components:{strong:n3t},children:n.summary||"No preview available for this event"})]})]},n.id))})})},Yne=3.5,o3t=x("div")(({theme:e})=>({width:"100%",display:"flex",flexFlow:"row wrap",gap:e.spacing(1),justifyContent:"space-between"})),BB=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",minHeight:e.spacing(Yne)})),i3t=x("ul")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexFlow:"row wrap",listStyle:"none",padding:0})),s3t=x("ul")(({theme:e})=>({gap:e.spacing(1),flexFlow:"column",display:"flex",listStyle:"none",padding:0})),dE=x(sn)({whitespace:"nowrap"}),a3t=x(O9)(({theme:e})=>({width:"max-content",height:e.spacing(Yne)})),l3t=({roles:e,owners:t})=>{const n=e.slice(0,3),r=e.slice(3),o=t.filter(i=>i.ownerType!=="system");return s.jsxs(o3t,{"data-loading":!0,children:[s.jsx(BB,{children:e.length>0?s.jsxs(s.Fragment,{children:[s.jsx(Z,{sx:{whiteSpace:"nowrap"},variant:"body1",component:"h4",children:"Your roles in this project:"}),s.jsxs(i3t,{children:[n.map(i=>s.jsx("li",{children:s.jsx(dE,{color:"secondary",children:i})},i)),r.length?s.jsx("li",{children:s.jsx(hr,{arrow:!0,title:s.jsx(s3t,{children:r.map(i=>s.jsx("li",{children:s.jsx(dE,{children:i})},i))}),children:s.jsx(dE,{color:"secondary",children:`+ ${r.length} more`},"extra-roles")})}):null]})]}):s.jsx("span",{children:"You have no project roles in this project."})}),s.jsx(BB,{children:o.length>0?s.jsxs(s.Fragment,{children:[s.jsxs(Z,{variant:"body1",component:"h4",sx:{whiteSpace:"nowrap"},children:["Project owner",o.length>1?"s":""]}),s.jsx(a3t,{users:o,avatarLimit:3})]}):null})]})},c3t=x("ul")(({theme:e})=>({padding:0,"li + li":{marginTop:e.spacing(2)}})),u3t=x("li")(({theme:e})=>({display:"flex",flexFlow:"row",gap:e.spacing(2)})),d3t=x("article")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),Kne=({admins:e})=>s.jsx(d3t,{children:e.length?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Your Unleash administrator",e.length>1?"s are":" is",":"]}),s.jsx(c3t,{children:e.map(t=>s.jsxs(u3t,{children:[s.jsx(hp,{sx:{margin:0},user:t}),s.jsx(Z,{children:t.name||t.username||t.email})]},t.id))})]}):s.jsx("p",{children:"You have no Unleash administrators to contact."})}),p3t=({project:e})=>s.jsxs(zc,{title:`Couldn't fetch data for project "${e}".`,children:[s.jsx("p",{children:"The API request to get data for this project returned with an error."}),s.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.']})]}),f3t=({admins:e})=>s.jsx(zc,{title:"Consider contacting one of your Unleash admins for help.",children:s.jsx(Kne,{admins:e})}),h3t=({admins:e})=>s.jsx(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"1"}),"Contact Unleash admin"]}),children:s.jsx(Kne,{admins:e})}),g3t=({owners:e})=>s.jsx(zc,{title:s.jsxs(s.Fragment,{children:[s.jsx(wy,{children:"2"}),"Ask a project owner to add you to their project"]}),children:e.length?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Project owners in Unleash:"}),s.jsx(O9,{users:e,avatarLimit:9})]}):s.jsx("p",{children:"There are no project owners in Unleash to ask for access."})}),m3t=({project:e})=>{const t=e.technicalDebt;return s.jsxs(J,{sx:{display:"flex",gap:2},children:[s.jsxs(J,{sx:{display:"flex",flexDirection:"column"},children:[s.jsx(Z,{variant:"subtitle2",color:"primary",children:e.featureCount}),s.jsx(Z,{variant:"caption",color:"text.secondary",children:"flags"})]}),s.jsxs(J,{sx:{display:"flex",flexDirection:"column"},children:[s.jsx(Z,{variant:"subtitle2",color:"primary",children:e.memberCount}),s.jsx(Z,{variant:"caption",color:"text.secondary",children:"members"})]}),s.jsxs(J,{sx:{display:"flex",flexDirection:"column"},children:[s.jsxs(Z,{variant:"subtitle2",color:"primary",children:[t,"%"]}),s.jsx(Z,{variant:"caption",color:"text.secondary",children:"technical debt"})]})]})},zB=x("div")({height:"80%"}),v3t=({project:e,selected:t,onClick:n})=>{const r=m.useRef(null),{trackEvent:o}=Kt();return m.useEffect(()=>{r.current&&(r.current.scrollIntoView({block:"start",inline:"start"}),window.scrollTo({top:0}))},[]),s.jsx(Gr,{disablePadding:!0,sx:{mb:1},ref:t?r:null,children:s.jsxs(no,{sx:Une,selected:t,onClick:n,children:[s.jsxs(Vne,{children:[s.jsx(Mf,{color:"primary"}),s.jsx(qne,{children:e.name}),s.jsx($t,{component:xt,to:`/projects/${e.id}`,size:"small",sx:{ml:"auto"},onClick:()=>{o("personal-dashboard",{props:{eventType:"Go to project from list"}})},children:s.jsx(OC,{titleAccess:`projects/${e.id}`})})]}),t?s.jsx(m3t,{project:e}):null]})})},y3t=({projects:e,personalDashboardProjectDetails:t,setActiveProject:n,activeProject:r,admins:o,owners:i})=>{const a=$l(t.state==="loading"),l=()=>{if(e.length===0)return{list:s.jsxs(zc,{children:[s.jsx(Z,{children:"You don't currently have access to any projects in the system."}),s.jsxs(Z,{children:["To get started, you can"," ",s.jsx(xt,{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:s.jsx(h3t,{admins:o}),box2:s.jsx(g3t,{owners:i})};const p=s.jsx(Gne,{children:e.map(g=>s.jsx(v3t,{project:g,selected:g.id===r,onClick:()=>n(g.id)},g.id))}),[f,h]=(()=>{switch(t.state){case"success":{const g=t.data.onboardingStatus.status??"loading",v=g==="onboarding-started";return g==="onboarded"?[s.jsx(Hjt,{project:r,insights:t.data.insights}),s.jsx(r3t,{latestEvents:t.data.latestEvents})]:v?[s.jsx(Kjt,{project:r}),s.jsx(NB,{project:r})]:[s.jsx(Xjt,{project:r}),s.jsx(NB,{project:r})]}case"error":return[s.jsx(p3t,{project:r}),s.jsx(f3t,{admins:o})];default:return[s.jsx(zB,{"data-loading":!0}),s.jsx(zB,{"data-loading":!0})]}})();return{list:p,box1:f,box2:h}},{list:c,box1:u,box2:d}=l();return s.jsx(zne,{ref:a,children:s.jsxs(Wjt,{children:[s.jsx(x1,{gridArea:"projects",children:c}),s.jsx(x1,{gridArea:"box1",children:u}),s.jsx(x1,{gridArea:"box2",children:d}),s.jsx(Gjt,{}),s.jsx(Ujt,{gridArea:"owners",children:s.jsx(l3t,{roles:t.state==="success"?t.data.roles.map(p=>p.name):[],owners:t.state==="success"?t.data.owners:[{ownerType:"user",name:"?"}]})})]})})},V$=e=>{const t={activeProject:void 0,activeFlag:void 0,expandProjects:!0,expandFlags:!0,expandTimeline:!1},[n,r]=ol("personal-dashboard:v1",t),o=d=>r({...t,...n,...d});m.useEffect(()=>{var p,f;const d={};(p=e==null?void 0:e.flags)!=null&&p.length&&(!n.activeFlag||!e.flags.some(h=>{var g;return h.name===((g=n.activeFlag)==null?void 0:g.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:i,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:i,setActiveFlag:l,activeProject:a,setActiveProject:c,expandFlags:n.expandFlags??!0,expandProjects:n.expandProjects??!0,expandTimeline:n.expandTimeline??!1,toggleSectionState:u}},x3t=x("div")(({theme:e})=>({display:"flex",flexFlow:"column",gap:e.spacing(2)})),b3t=({flag:e,selected:t,onClick:n})=>{const r=m.useRef(null),{trackEvent:o}=Kt();m.useEffect(()=>{r.current&&(r.current.scrollIntoView({block:"start",inline:"start"}),window.scrollTo({top:0}))},[]);const i=wC(e.type),a=`projects/${e.project}/features/${e.name}`;return s.jsx(Gr,{disablePadding:!0,sx:{mb:1},ref:t?r:null,children:s.jsx(no,{sx:Une,selected:t,onClick:n,children:s.jsxs(Vne,{children:[s.jsx(i,{color:"primary"}),s.jsx(qne,{children:e.name}),s.jsx($t,{component:kn,href:a,onClick:()=>{o("personal-dashboard",{props:{eventType:"Go to flag from list"}})},size:"small",sx:{ml:"auto"},children:s.jsx(OC,{titleAccess:a})})]})})},e.name)},w3t=({hasProjects:e,flagData:t,setActiveFlag:n,refetchDashboard:r})=>s.jsx(zne,{children:s.jsxs(Vjt,{children:[s.jsx(x1,{gridArea:"flags",children:t.state==="flags"?s.jsx(Gne,{disablePadding:!0,sx:{height:"100%"},children:t.flags.map(o=>{var i;return s.jsx(b3t,{flag:o,selected:o.name===((i=t.activeFlag)==null?void 0:i.name),onClick:()=>n(o)},o.name)})}):e?s.jsxs(x3t,{children:[s.jsx(Z,{children:"You have not created or favorited any feature flags. Once you do, they will show up here."}),s.jsx(Z,{children:"To create a new flag, go to one of your projects."})]}):s.jsx(Lt,{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."})}),s.jsx(x1,{gridArea:"chart",children:t.state==="flags"&&t.activeFlag?s.jsx(S3t,{flag:t.activeFlag,onArchive:r}):s.jsx(C3t,{label:"Metrics for your feature flags will be shown here"})})]})}),S3t=Je.lazy(()=>va(()=>import("./FlagMetricsChart-oDTQTkxU.js"),[]).then(e=>({default:e.FlagMetricsChart}))),C3t=Je.lazy(()=>va(()=>import("./FlagMetricsChart-oDTQTkxU.js"),[]).then(e=>({default:e.PlaceholderFlagMetricsChartWithWrapper}))),j3t=({personalDashboardProjectDetails:e,error:t})=>t?{state:"error",error:t}:e?{state:"success",data:e}:{state:"loading"},E3t="/static/upgradeHosted-D8epFMuP.png",T3t=x("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"})),k3t=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center"})),_3t=x("div")(({theme:e})=>({display:"flex",flexFlow:"column nowrap",gap:e.spacing(1)})),R3t=x("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)})),P3t=x("ul")(({theme:e})=>({listStyle:"none",padding:0,margin:0,fontSize:e.typography.body2.fontSize,"& li":{}})),mv=x("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}})),A3t=x($t)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1)})),I3t=x("img")(({theme:e})=>({width:235,margin:e.spacing(1),[e.breakpoints.down("md")]:{display:"none"}})),$3t=()=>{const[e,t]=ol("upgrade-dashboard:v1","open");if(e==="closed")return null;const n=()=>{t("closed")};return s.jsxs(T3t,{children:[s.jsx(kt,{title:"Dismiss",arrow:!0,children:s.jsx(A3t,{"aria-label":"dismiss",onClick:n,size:"small",children:s.jsx(Ho,{fontSize:"inherit"})})}),s.jsxs(k3t,{children:[s.jsxs(_3t,{children:[s.jsxs(R3t,{children:[s.jsx(Xa,{darkmode:s.jsx(ny,{}),lightmode:s.jsx(ty,{})}),"Explore our Enterprise solution"]}),s.jsx(Z,{children:"Increase efficiency and improve the development process in your company with the full experience of Unleash with some key advantages like:"}),s.jsxs(P3t,{children:[s.jsx(mv,{children:"Unlimited projects and environments"}),s.jsx(mv,{children:"Priority support for managed and self-hosted options"}),s.jsx(mv,{children:"SSO/SCIM - streamlined access and account management"}),s.jsx(mv,{children:"RBAC - precise access control"}),s.jsx(mv,{children:"Change requests - reduce error risk with pull-request like experience"})]}),s.jsx("div",{children:s.jsx(Ue,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=dashboard",children:"View full Enterprise offering"})})]}),s.jsx(I3t,{src:ti(E3t),alt:"Upgrade Unleash"})]})]})};var U$={},O3t=Te;Object.defineProperty(U$,"__esModule",{value:!0});var Xne=U$.default=void 0,M3t=O3t(ke()),D3t=s,L3t=(0,M3t.default)((0,D3t.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");Xne=U$.default=L3t;var G$={},F3t=Te;Object.defineProperty(G$,"__esModule",{value:!0});var Jne=G$.default=void 0,N3t=F3t(ke()),B3t=s,z3t=(0,N3t.default)((0,B3t.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");Jne=G$.default=z3t;var q$={},H3t=Te;Object.defineProperty(q$,"__esModule",{value:!0});var Qne=q$.default=void 0,W3t=H3t(ke()),V3t=s,U3t=(0,W3t.default)((0,V3t.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");Qne=q$.default=U3t;var Y$={},G3t=Te;Object.defineProperty(Y$,"__esModule",{value:!0});var Zne=Y$.default=void 0,q3t=G3t(ke()),Y3t=s,K3t=(0,q3t.default)((0,Y3t.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");Zne=Y$.default=K3t;var K$={},X3t=Te;Object.defineProperty(K$,"__esModule",{value:!0});var X$=K$.default=void 0,J3t=X3t(ke()),Q3t=s,Z3t=(0,J3t.default)((0,Q3t.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");X$=K$.default=Z3t;const HB=x("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)"}})),e5t=({icon:e,type:t})=>e?s.jsx(Ka,{children:e}):t==="signal"?s.jsx(X$,{}):t==="feature-environment-enabled"?s.jsx(Xne,{}):t==="feature-environment-disabled"?s.jsx(Jne,{}):t.startsWith("strategy-")||t.startsWith("feature-strategy-")||t.startsWith("release-plan-")?s.jsx(YR,{sx:{marginTop:"-2px",marginRight:"-2px"}}):t.startsWith("feature-")?s.jsx(TP,{}):t.startsWith("segment-")?s.jsx(GR,{}):s.jsx(Qne,{}),t5t={signal:"warning","feature-environment-enabled":"success","feature-environment-disabled":"neutral","feature-archived":"neutral"},n5t=e=>e!==void 0&&["secondary","success","neutral","warning","error"].includes(e),ere=({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 s.jsx(HB,{variant:n5t(n.variant)?n.variant:t5t[n.type],...t,children:e5t(n)})}return s.jsx(HB,{...t,children:s.jsx(Zne,{})})},WB=x("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing(1),gap:e.spacing(2),flexWrap:"wrap"})),VB=x("div")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.smallBody,wordBreak:"break-word",flex:1})),r5t=x("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),UB=x("div")(({theme:e})=>({color:e.palette.text.secondary,whiteSpace:"nowrap"})),o5t=x("div")(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column",gap:e.spacing(2)})),i5t=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),s5t=x(ere)(({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"}})),GB=({children:e})=>e,a5t=({group:e})=>{const{locationSettings:t}=wo();if(e.length===1){const o=e[0],i=Ja(o.timestamp,t==null?void 0:t.locale);return s.jsxs(s.Fragment,{children:[s.jsxs(WB,{children:[s.jsx(VB,{children:o.label}),s.jsx(r5t,{children:i})]}),s.jsx(ep,{components:{strong:GB},children:o.summary})]})}const n=e[0],r=Kd(n.timestamp,t==null?void 0:t.locale);return s.jsxs(s.Fragment,{children:[s.jsxs(WB,{children:[s.jsxs(VB,{children:[e.length," events occurred"]}),s.jsx(UB,{children:r})]}),s.jsx(o5t,{children:e.map(o=>s.jsxs(i5t,{children:[s.jsx(s5t,{group:[o]}),s.jsxs("div",{children:[s.jsx(UB,{children:C_e(o.timestamp,t==null?void 0:t.locale)}),s.jsx(ep,{components:{strong:GB},children:o.summary})]})]},o.id))})]})},l5t=x("div",{shouldForwardProp:e=>e!=="position"})(({position:e})=>({position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",left:e,transform:"translateX(-50%)",zIndex:1})),c5t=x(pR)(({theme:e})=>({".MuiBadge-badge":{backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText}})),u5t=({group:e,startTime:t,endTime:n})=>{const{trackEvent:r}=Kt(),o=n-t,a=`${(e[0].timestamp-t)/o*100}%`,l=()=>{r("event-timeline",{props:{eventType:"event hover"}})};return s.jsx(l5t,{position:a,onMouseEnter:l,children:s.jsx(hr,{title:s.jsx(a5t,{group:e}),maxWidth:350,arrow:!0,children:s.jsx(c5t,{badgeContent:e.length,invisible:e.length<2,children:s.jsx(ere,{group:e})})})})},tre=m.createContext(void 0),nre=()=>{const e=m.useContext(tre);if(!e)throw new Error("useEventTimelineContext must be used within a EventTimelineProvider");return e},Ob=[{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"]}],d5t={open:!1,timeSpan:Ob[0]},p5t=({children:e})=>{const[t,n]=ol("event-timeline:v1",d5t),r=(i,a)=>{n(l=>({...l,[i]:a}))},o={...t,setOpen:i=>r("open",i),setTimeSpan:i=>r("timeSpan",i),setEnvironment:i=>r("environment",i),setSignalsSuggestionSeen:i=>r("signalsSuggestionSeen",i)};return s.jsx(tre.Provider,{value:o,children:e})},qB=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),YB=x(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"}}})),f5t=x("span")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(.25)})),h5t=({totalEvents:e})=>{const{timeSpan:t,environment:n,setOpen:r,setTimeSpan:o,setEnvironment:i}=nre(),{environments:a}=$u(),l=m.useMemo(()=>a.filter(({enabled:d})=>d),[a]);Kt(),m.useEffect(()=>{if(l.length>0&&!n){const d=l.find(({type:p})=>p==="production")||l[0];i(d)}},[l]);const c=()=>s.jsx(X,{condition:!!n&&a.length>0,show:()=>s.jsx(YB,{select:!0,size:"small",variant:"outlined",value:n.name,onChange:d=>i(a.find(({name:p})=>p===d.target.value)||a[0]),children:a.map(({name:d})=>s.jsx(Cr,{value:d,children:d},d))})}),u=()=>s.jsx(YB,{select:!0,size:"small",variant:"outlined",value:t.key,onChange:d=>o(Ob.find(({key:p})=>p===d.target.value)||Ob[0]),children:Ob.map(({key:d,label:p})=>s.jsx(Cr,{value:d,children:p},d))});return s.jsxs(s.Fragment,{children:[s.jsx(qB,{children:s.jsxs(f5t,{children:[e," event",e===1?"":"s",s.jsx(bo,{tooltip:"These are key events per environment across all your projects. For more details, visit the event log."})]})}),s.jsxs(qB,{children:[s.jsx(u,{}),s.jsx(c,{})]})]})},KB={signals:[],total:0},g5t=10,rre="api/admin/signals?",m5t=()=>{const e={total:0,initialLoad:!0},t=(n,r)=>{e[n]=r};return(n,r={},o="")=>{const{isEnterprise:i}=rt(),a=ci("signals"),{KEY:l,fetcher:c}=v5t(n),u=`${o}${l}`;yC(u,rre,g5t);const{data:d,error:p,mutate:f,isLoading:h}=Bi(i()&&a,KB,u,c,r),g=m.useCallback(()=>{f()},[f]);return(d==null?void 0:d.total)!==void 0&&t("total",d.total),!h&&e.initialLoad&&t("initialLoad",!1),{...d||KB,loading:h,error:p,refetch:g,total:e.total,initialLoad:h&&e.initialLoad}}},v5t=e=>{const t=new URLSearchParams(Array.from(Object.entries(e).filter(([o,i])=>!!i).map(([o,i])=>[o,i.toString()]))).toString(),n=`${rre}${t}`;return{fetcher:()=>{const o=bt(n);return fetch(o,{method:"GET"}).then(Jt("Signal query")).then(i=>i.json())},KEY:n}},y5t=m5t(),XB=x("div")({display:"flex",flexDirection:"row",justifyContent:"space-between"}),x5t=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(1.5,0)})),b5t=x("div")(({theme:e})=>({position:"relative",height:e.spacing(1),width:"100%",display:"flex",alignItems:"center",padding:e.spacing(1.5,0)})),w5t=x("div")(({theme:e})=>({backgroundColor:e.palette.divider,height:e.spacing(.5),width:"100%"})),S5t=x("div")({display:"flex",alignItems:"center",justifyContent:"center",position:"relative"}),J$=x("div")(({theme:e})=>({position:"absolute",height:e.spacing(1),width:e.spacing(.25),backgroundColor:e.palette.text.secondary})),C5t=x(J$)(({theme:e})=>({top:e.spacing(-2)})),pE=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),j5t=x(J$)({left:0}),E5t=x(J$)({right:0}),T5t=["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"],rb=e=>e.toISOString().split("T")[0],k5t=e=>"sourceId"in e,_5t=e=>new Date(e.createdAt).getTime(),R5t=(e,t,n)=>e>=t&&e<=n,JB=e=>typeof e=="string"&&e.trim().length>0,P5t=(e,t,n)=>{if(k5t(e)){const{id:r,sourceName:o="unknown source",sourceDescription:i,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${i?`: ${i}`:""}`;return{id:r,timestamp:t,type:"signal",label:f,summary:h,...JB(u)?{icon:u}:{},...JB(d)?{variant:d}:{}}}if(!e.environment||!n||e.environment===n.name){const{id:r,type:o,label:i,summary:a,createdBy:l}=e,c=i||o,u=a||`**${l}** triggered **${o}**`;return{id:r,timestamp:t,type:o,label:c,summary:u}}},A5t=()=>{const{timeSpan:e,environment:t}=nre(),n=new Date,r=b_e(n,e.value),o=n.getTime(),i=r.getTime(),{events:a}=_ee({from:`IS:${rb(Yd(r))}`,to:`IS:${rb(n)}`,type:`IS_ANY_OF:${T5t.join(",")}`},{refreshInterval:10*1e3}),{signals:l}=y5t({from:`IS:${rb(Yd(r))}`,to:`IS:${rb(n)}`},{refreshInterval:10*1e3}),c=m.useMemo(()=>[...a,...l].reduce((f,h)=>{const g=_5t(h);if(R5t(g,i,o)){const v=P5t(h,g,t);v&&f.push(v)}return f},[]).sort((f,h)=>f.timestamp-h.timestamp),[a,l,i,o,t]),u=o-i,d=m.useMemo(()=>u*.02,[u]),p=m.useMemo(()=>c.reduce((f,h)=>{if(f.length===0)f.push([h]);else{const g=f[f.length-1],v=g[g.length-1];h.timestamp-v.timestamp<=d?g.push(h):f.push([h])}return f},[]),[c,d]);return s.jsxs(s.Fragment,{children:[s.jsx(XB,{children:s.jsx(h5t,{totalEvents:c.length})}),s.jsxs(x5t,{children:[s.jsxs(b5t,{children:[s.jsx(w5t,{}),s.jsx(j5t,{}),p.map(f=>s.jsx(u5t,{group:f,startTime:i,endTime:o},f[0].id)),s.jsx(E5t,{})]}),s.jsxs(XB,{children:[s.jsx(pE,{children:e.markers[0]}),e.markers.slice(1).map(f=>s.jsxs(S5t,{children:[s.jsx(C5t,{}),s.jsx(pE,{children:f})]},f)),s.jsx(pE,{children:"now"})]})]})]})},I5t=x("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(1),flexFlow:"row wrap",alignItems:"baseline"})),$5t=x(Ue)({fontWeight:"normal",padding:0,margin:0}),Q$=x(Dc,{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"}}),Z$=x(Fc)(({theme:e})=>({border:"none",padding:e.spacing(2,4),margin:0,"&>.MuiAccordionSummary-content.MuiAccordionSummary-content":{margin:"0"}})),e6=x(Lc)({padding:0}),O5t=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),t6=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5)})),n6=x("h3")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.typography.body1.fontSize,fontWeight:e.typography.body2.fontWeight,margin:0})),r6=x(Z)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.body2.fontWeight})),M5t=()=>{const{toggleSectionState:e,expandTimeline:t}=V$(),{trackEvent:n}=Kt();return s.jsxs(Q$,{disableGutters:!0,expanded:t??!1,onChange:()=>e("timeline"),withSummaryContentBorder:!1,children:[s.jsx(Z$,{expandIcon:s.jsx(ha,{titleAccess:"Toggle timeline section"}),id:"timeline-panel-header","aria-controls":"timeline-panel-content",children:s.jsxs(t6,{children:[s.jsx(n6,{children:"Event timeline"}),s.jsxs(r6,{children:["Overview of recent activities across all projects in Unleash. Make debugging easier and"," ",s.jsx(xt,{to:"/integrations/signals",onClick:()=>{n("event-timeline",{props:{eventType:"signals clicked"}})},children:"include external signals"})," ","to get a fuller overview."]})]})}),s.jsx(e6,{children:s.jsx(Wne,{children:s.jsx(A5t,{})})})]})},D5t=()=>{const{personalDashboard:e,refetch:t}=Bne(),n=(e==null?void 0:e.projects)||[],{activeFlag:r,setActiveFlag:o,toggleSectionState:i,expandFlags:a}=V$({flags:(e==null?void 0:e.flags)??[]});return s.jsxs(Q$,{expanded:a??!0,onChange:()=>i("flags"),children:[s.jsx(Z$,{expandIcon:s.jsx(ha,{titleAccess:"Toggle flags section"}),id:"flags-panel-header","aria-controls":"flags-panel-content",children:s.jsxs(t6,{children:[s.jsx(n6,{children:"My feature flags"}),s.jsx(r6,{children:"Feature flags you have created or favorited"})]})}),s.jsx(e6,{children:s.jsx(w3t,{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})})]})},L5t=()=>{const{personalDashboard:e}=Bne(),t=(e==null?void 0:e.projects)||[],{activeProject:n,setActiveProject:r,toggleSectionState:o,expandProjects:i}=V$({projects:t}),a=j3t(Mjt(n));return s.jsxs(Q$,{disableGutters:!0,expanded:i??!0,onChange:()=>o("projects"),children:[s.jsx(Z$,{expandIcon:s.jsx(ha,{titleAccess:"Toggle projects section"}),id:"projects-panel-header","aria-controls":"projects-panel-content",children:s.jsxs(t6,{children:[s.jsx(n6,{children:"My projects"}),s.jsx(r6,{children:"Favorite projects, projects you own, and projects you are a member of"})]})}),s.jsx(e6,{children:s.jsx(y3t,{owners:(e==null?void 0:e.projectOwners)??[],admins:(e==null?void 0:e.admins)??[],projects:t,activeProject:n||"",setActiveProject:r,personalDashboardProjectDetails:a})})]})},F5t=()=>{const{user:e}=Si(),{trackEvent:t}=Kt(),{setSplashSeen:n}=kA(),{splash:r}=fC(),{isOss:o}=rt(),i=(e==null?void 0:e.name)||"";Iu(i?`Dashboard: ${i}`:"Dashboard");const[a,l]=ol("welcome-dialog:v1",r!=null&&r.personalDashboardKeyConcepts?"closed":"open");return m.useEffect(()=>{t("personal-dashboard",{props:{eventType:"seen"}})},[]),s.jsxs(O5t,{children:[o()?s.jsx($3t,{}):null,s.jsxs(I5t,{children:[s.jsxs(Z,{component:"h2",variant:"h2",children:["Welcome ",i]}),s.jsx($5t,{sx:{fontWeight:"normal"},size:"small",variant:"text",onClick:()=>{t("personal-dashboard",{props:{eventType:"open key concepts"}}),l("open")},children:"View key concepts"})]}),s.jsx(M5t,{}),s.jsx(L5t,{}),s.jsx(D5t,{}),s.jsx($jt,{open:a==="open",onClose:()=>{n("personalDashboardKeyConcepts"),l("closed")}})]})},N5t="api/admin/release-plan-templates",B5t=[],hj=()=>{const{isEnterprise:e}=rt(),{data:t,error:n,mutate:r}=Bi(e(),B5t,bt(N5t),z5t);return m.useMemo(()=>({templates:t??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},z5t=e=>fetch(e).then(Jt("Release templates")).then(t=>t.json()),ore=e=>m.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},m.createElement("g",{clipPath:"url(#clip0_28054_15343)"},m.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"}),m.createElement("path",{d:"M16.834 71.409V67.2181H12.6431V71.409H16.834Z",fill:"#F5A69A"}),m.createElement("path",{d:"M37.8536 15.4618H12.6445V67.2163H37.8536V15.4618Z",fill:"#1A4049"}),m.createElement("path",{d:"M37.8554 67.2181H63.0645L63.0645 15.4636H37.8554L37.8554 67.2181Z",fill:"#31545C"}),m.createElement("path",{d:"M55.4316 46.9564H21.668V55.1928H55.4316V46.9564Z",fill:"#B3DAED"}),m.createElement("g",{opacity:.8},m.createElement("mask",{id:"mask0_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:46,width:17,height:10},m.createElement("path",{d:"M37.8389 46.9564V55.2346L21.668 55.1491V46.9564H37.8389Z",fill:"white"})),m.createElement("g",{mask:"url(#mask0_28054_15343)"},m.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)"}))),m.createElement("path",{d:"M55.4316 27.4454H21.668V35.6818H55.4316V27.4454Z",fill:"#B3DAED"}),m.createElement("g",{opacity:.8},m.createElement("mask",{id:"mask1_28054_15343",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:21,y:27,width:17,height:9},m.createElement("path",{d:"M37.8389 27.4454V35.7236L21.668 35.6382V27.4454H37.8389Z",fill:"white"})),m.createElement("g",{mask:"url(#mask1_28054_15343)"},m.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)"}))),m.createElement("path",{d:"M56.5577 15.4636H63.0723V8.94908H56.5577V15.4636Z",fill:"#F5A69A"}),m.createElement("path",{d:"M63.0728 19.6545H67.2637V15.4636H63.0728V19.6545Z",fill:"#F5A69A"})),m.createElement("defs",null,m.createElement("pattern",{id:"pattern0_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},m.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),m.createElement("pattern",{id:"pattern1_28054_15343",patternContentUnits:"objectBoundingBox",width:1,height:1},m.createElement("use",{xlinkHref:"#image0_28054_15343",transform:"scale(0.00145773 0.00105374)"})),m.createElement("clipPath",{id:"clip0_28054_15343"},m.createElement("rect",{width:80,height:80,fill:"white"})))),H5t=x("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(1,0,0,0)})),W5t=x("div")(({theme:e})=>({textAlign:"center",padding:e.spacing(1,0,9,0),color:e.palette.text.secondary})),V5t=x("div")(({theme:e})=>({textAlign:"center"})),U5t=x("div")(({theme:e})=>({paddingTop:e.spacing(5)})),G5t=()=>s.jsxs(U5t,{children:[s.jsx(V5t,{children:s.jsx(ore,{})}),s.jsx(H5t,{children:"You have no release templates set up"}),s.jsxs(W5t,{children:["Make the set up of strategies easier for your",s.jsx("br",{}),"teams by creating templates"]})]}),gj={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})}},q5t=x(H0,{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,...gj[t].card(e)})),Y5t=x(J,{shouldForwardProp:e=>e!=="cardVariant"})(({theme:e,cardVariant:t})=>({padding:e.spacing(2),display:"flex",flexFlow:"column",height:"100%",position:"relative",...gj[t].body(e)})),K5t=x(J,{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",...gj[t].header(e)})),X5t=x(J)(({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)}})),J5t=x(J)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginLeft:"auto"})),Q5t=x(J)(({theme:e})=>({marginTop:e.spacing(2)})),Z5t=x(J,{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",...gj[t].footer(e)})),ire=({icon:e,title:t,headerActions:n,footer:r,cardVariant:o="primary",children:i,...a})=>s.jsxs(q5t,{cardVariant:o,...a,children:[s.jsxs(Y5t,{cardVariant:o,children:[s.jsxs(K5t,{cardVariant:o,children:[e&&s.jsx(X5t,{children:e}),t,n&&s.jsx(J5t,{children:n})]}),i&&s.jsx(Q5t,{children:i})]}),r&&s.jsx(Z5t,{cardVariant:o,children:r})]}),o6=()=>{const{makeRequest:e,makeLightRequest:t,createRequest:n,errors:r,loading:o}=ar({propagateErrors:!0});return{deleteReleasePlanTemplate:async u=>{const d="deleteReleasePlanTemplate",p=`api/admin/release-plan-templates/${u}`,f=n(p,{method:"DELETE"},d);return e(f.caller,f.id)},updateReleasePlanTemplate:async(u,d)=>{const p="updateReleasePlanTemplate",f=`api/admin/release-plan-templates/${u}`,h=n(f,{method:"PUT",body:JSON.stringify(d)},p);return e(h.caller,h.id)},createReleasePlanTemplate:async u=>{const f=n("api/admin/release-plan-templates",{method:"POST",body:JSON.stringify(u)},"createReleasePlanTemplate");return(await e(f.caller,f.id)).json()},archiveReleasePlanTemplate:async u=>{const d="updateReleasePlanTemplate",p=`api/admin/release-plan-templates/archive/${u}`,f=n(p,{method:"POST"},d);return e(f.caller,f.id)}}},eEt=({template:e,open:t,setOpen:n,onConfirm:r})=>s.jsx(Gn,{title:"Archive release template?",open:t,secondaryButtonText:"Cancel",onClose:()=>{n(!1)},permissionButton:s.jsx(Ro,{variant:"contained",onClick:()=>r(e),permission:EA,children:"Archive template"}),children:s.jsxs("p",{children:["You are about to archive release template:"," ",s.jsx("strong",{children:e==null?void 0:e.name})]})}),tEt=x("div")(({theme:e})=>({margin:e.spacing(-1),marginLeft:e.spacing(-.5),display:"flex",justifyContent:"center",alignItems:"center"})),nEt=x(_l)(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(1,1.5)})),rEt=({template:e})=>{const[t,n]=m.useState(null),{archiveReleasePlanTemplate:r}=o6(),{refetch:o}=hj(),{setToastData:i,setToastApiError:a}=Nt(),{trackEvent:l}=Kt(),[c,u]=m.useState(!1),d=Nf(EA),p=m.useCallback(async()=>{try{await r(e.id),o(),i({type:"success",text:"Release template archived"}),l("release-management",{props:{eventType:"archive-template",template:e.name}})}catch(y){a(Tt(y))}},[a,o,i,r]),f=!!t,h=y=>{n(y.currentTarget)},g=()=>{n(null)},v=`release-plan-template-${e.id}-actions`,b=`${v}-menu`;return s.jsxs(tEt,{onClick:y=>{y.preventDefault(),y.stopPropagation()},children:[s.jsx(kt,{title:"Release template actions",arrow:!0,describeChild:!0,children:s.jsx($t,{id:v,"aria-controls":f?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":f?"true":void 0,onClick:h,type:"button",size:"small",children:s.jsx(pm,{})})}),s.jsx(nEt,{id:b,anchorEl:t,open:f,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:s.jsxs(om,{"aria-labelledby":v,children:[s.jsxs(Cr,{onClick:g,component:xt,to:`/release-templates/edit/${e.id}`,children:[s.jsx(Zo,{children:s.jsx(ns,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Edit template"})})]}),s.jsxs(Cr,{onClick:()=>{u(!0),g()},disabled:!d,children:[s.jsx(Zo,{children:s.jsx(Po,{})}),s.jsx(dn,{children:s.jsx(Z,{variant:"body2",children:"Archive template"})})]})]})}),s.jsx(eEt,{template:e,open:c,setOpen:u,onConfirm:p})]})},oEt=(e,t={})=>{const n=()=>{const c=bt(`api/admin/user-admin/${e}`);return fetch(c,{method:"GET"}).then(Jt("Users")).then(u=>u.json())},{data:r,error:o}=_n(`api/admin/user-admin/${e}`,n,t),[i,a]=m.useState(!o&&!r),l=()=>{Io(`api/admin/user-admin/${e}`)};return m.useEffect(()=>{a(!o&&!r)},[r,o]),{user:r||{},error:o,loading:i,refetch:l}},iEt=x(J)({display:"flex",alignItems:"center",gap:pr.spacing(1)}),sEt=x($9)(({theme:e})=>({height:e.spacing(3.5),width:e.spacing(3.5),marginLeft:0})),aEt=x(J)({display:"flex",flexDirection:"column"}),lEt=x("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})),cEt=({template:e})=>{const{user:t}=oEt(`${e.createdByUserId}`);return s.jsxs(iEt,{children:[s.jsx(sEt,{user:t}),s.jsxs(aEt,{children:[s.jsx("span",{children:"Created by"}),s.jsx(lEt,{children:t.name||t.username||t.email})]})]})},uEt=x(xt)(({theme:e})=>({color:"inherit",textDecoration:"none",border:"none",padding:"0",background:"transparent",fontFamily:e.typography.fontFamily,pointer:"cursor"})),dEt=x("h3")(({theme:e})=>({margin:0,marginRight:"auto",fontWeight:e.typography.fontWeightRegular,fontSize:e.typography.body1.fontSize,lineHeight:"1.2"})),pEt=({template:e})=>s.jsx(uEt,{to:`/release-templates/edit/${e.id}`,children:s.jsx(ire,{icon:s.jsx(ore,{}),title:s.jsx(yo,{title:e.name,arrow:!0,component:dEt,children:e.name}),headerActions:s.jsx(rEt,{template:e}),footer:s.jsx(cEt,{template:e}),children:e.description&&s.jsx(yo,{lines:2,title:e.description,arrow:!0,children:e.description})})}),fEt="https://docs.google.com/forms/d/e/1FAIpQLSfbbqsz6wQSgTuJ0NO6ooykTGC_osrzB5-qMrQkbda9SRwnxg/viewform?usp=preview",hEt=x(xt)(({theme:e})=>({textDecoration:"none",fontWeight:e.typography.fontWeightBold,color:e.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),gEt=({title:e,children:t})=>s.jsx(ire,{cardVariant:"secondary",title:e,footer:s.jsx(hEt,{to:fEt,target:"_blank",rel:"noreferrer",children:"Give feedback"}),children:t}),QB=x(jo)({minHeight:"180px"}),mEt=({templates:e})=>s.jsxs(s.Fragment,{children:[e.map(t=>s.jsx(QB,{item:!0,xs:6,md:4,children:s.jsx(pEt,{template:t})},t.id)),e.length>0&&s.jsx(QB,{item:!0,xs:6,md:4,children:s.jsx(gEt,{title:"Release Templates",children:"We would love to get your feedback on the concept around release templates so we can bring it into our work going forward"})},"feedback")]}),vEt="/static/howToApplyReleaseTemplates-CkjJPTRh.png",yEt="/static/howToApplyReleaseTemplatesDark-CfwfIMua.png",xEt=x(kn)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:0,color:e.palette.links,fontWeight:e.fontWeight.medium,"&:hover, &:focus":{textDecoration:"underline"}})),bEt=x(VS)(({theme:e})=>({fontSize:e.spacing(2.25)})),ZB=x("img")(()=>({maxWidth:"100%"})),wEt=x(J)(({theme:e})=>({margin:e.spacing(3,0),display:"flex",borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.elevation1,boxShadow:"none",justifyContent:"center",alignItems:"center","> svg":{display:"block",width:"100%",height:"auto"}})),SEt=()=>{Iu("Release templates");const e=Ot(),t=hj(),{isEnterprise:n}=rt();return n()?s.jsxs(s.Fragment,{children:[s.jsxs(cr,{header:s.jsx(Pn,{title:"Release templates",actions:s.jsx(z9,{Icon:Oo,onClick:()=>{e("/release-templates/create-template")},maxWidth:"700px",permission:jA,disabled:!n(),children:"New template"})}),children:[t.templates.length>0&&s.jsx(jo,{container:!0,spacing:2,children:s.jsx(mEt,{templates:t.templates})}),t.templates.length===0&&s.jsx("div",{className:s1.fullwidth,children:s.jsx(G5t,{})})]}),s.jsx(wEt,{children:s.jsx(Xa,{darkmode:s.jsx(ZB,{src:ti(yEt),alt:"How to setup release templates"}),lightmode:s.jsx(ZB,{src:ti(vEt),alt:"How to setup release templates"})})}),s.jsxs(xEt,{component:"a",href:"https://docs.getunleash.io/reference/release-templates",underline:"hover",rel:"noopener noreferrer",target:"_blank",children:[s.jsx(bEt,{})," Read more in our documentation"]})]}):s.jsx(ym,{feature:"releaseManagement",page:!0})},fE=e=>m.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),CEt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),fontSize:e.fontSizes.smallBody})),jEt=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),EEt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),TEt=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),kEt=x("p")(({theme:e})=>({fontWeight:e.fontWeight.bold})),hE=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),_Et=()=>s.jsxs(CEt,{children:[s.jsxs(jEt,{children:[s.jsx(Y0,{}),"Release templates"]}),s.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."}),s.jsx("p",{children:"Customize templates to suit your needs by adding strategies to specific milestones. Each milestone will execute sequentially, streamlining your release process."}),s.jsxs(EEt,{children:[s.jsx(kEt,{children:"Example usage"}),s.jsxs(TEt,{children:[s.jsxs("div",{children:[s.jsxs(hE,{children:[s.jsx(fE,{}),"Milestone 1"]}),s.jsx("p",{children:"Enable the feature for internal teams to test functionality and resolve initial issues."})]}),s.jsxs("div",{children:[s.jsxs(hE,{children:[s.jsx(fE,{}),"Milestone 2"]}),s.jsx("p",{children:"Expand the rollout to 20% of beta users to gather feedback and monitor performance."})]}),s.jsxs("div",{children:[s.jsxs(hE,{children:[s.jsx(fE,{}),"Milestone 3"]}),s.jsx("p",{children:"Release the feature to all users after confirming stability and addressing earlier feedback."})]})]})]})]}),REt=x(vr)(({theme:e})=>({width:"100%"})),PEt=x("span")(({theme:e})=>({fontWeight:e.fontWeight.bold,fontSize:e.fontSizes.bodySize})),AEt=x(ns,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t=!1})=>({cursor:"pointer",marginTop:e.spacing(-.25),marginLeft:e.spacing(.5),height:e.spacing(2.5),width:e.spacing(2.5),color:t?e.palette.error.main:e.palette.text.secondary})),ez=({milestone:e,errors:t,clearErrors:n,milestoneNameChanged:r})=>{const[o,i]=m.useState(!1);return s.jsxs(s.Fragment,{children:[o&&s.jsx(REt,{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:()=>i(!1),autoFocus:!0,onKeyDownCapture:a=>{a.code==="Enter"&&(a.preventDefault(),a.stopPropagation(),i(!1))},onClick:a=>{a.preventDefault(),a.stopPropagation()}}),!o&&s.jsxs(s.Fragment,{children:[s.jsx(PEt,{onClick:a=>{i(!0),a.preventDefault(),a.stopPropagation()},children:e.name}),s.jsx(AEt,{hasError:!!(t!=null&&t[`${e.id}_name`]),onClick:a=>{i(!0),a.preventDefault(),a.stopPropagation()}})]})]})},IEt=(e,t)=>{const n={};return t.parameters.forEach(r=>{n[r.name]=$Et(e,r)}),{name:t.name,constraints:[],parameters:n}},$Et=(e,t)=>t.name==="rollout"||t.name==="percentage"||t.type==="percentage"?"50":t.name==="stickiness"?"":t.name==="groupId"?e:t.type==="boolean"?"false":"",OEt=x("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}})),MEt=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),DEt=x(FC)(({theme:e})=>({fontWeight:e.fontWeight.bold})),LEt=x("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}})),FEt=({strategy:e,onClick:t})=>{const n=NDe(e.name),r=Il(e.name);return s.jsxs(LEt,{onClick:()=>{const o=IEt("",e);o.name==="flexibleRollout"&&(o.parameters={...o.parameters,groupId:"{{featureName}}"}),t({id:wi(),name:o.name,strategyName:o.name,title:"",constraints:o.constraints,parameters:o.parameters})},children:[s.jsx(OEt,{children:s.jsx(n,{})}),s.jsxs("div",{children:[s.jsx(DEt,{text:e.displayName||r,maxWidth:"200",maxLength:25}),s.jsx(MEt,{children:e.description})]})]})},NEt=x(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody,padding:e.spacing(1,2)})),tz=({openEditAddStrategy:e})=>{const{strategies:t}=rh(),n=t.filter(o=>!o.deprecated&&!o.editable),r=o=>{e(o)};return s.jsx(Ni,{dense:!0,children:s.jsxs(s.Fragment,{children:[s.jsx(NEt,{color:"textSecondary",children:"Predefined strategy types"}),n.map(o=>s.jsx(Gr,{children:s.jsx(FEt,{strategy:o,onClick:r})},o.name))]})})},BEt=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),zEt=x("p")(({theme:e})=>({color:e.palette.text.secondary})),HEt=x("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})),WEt=({segments:e,setSegments:t})=>{const[n,r]=m.useState(),o=e.length-1;return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx(X,{condition:e&&e.length>0,show:s.jsx(zEt,{children:"Selected Segments"})}),s.jsx(BEt,{children:e.map((i,a)=>s.jsxs(m.Fragment,{children:[s.jsx(ree,{segment:i,setSegments:t,preview:n,setPreview:r}),s.jsx(X,{condition:a<o,show:s.jsx(HEt,{children:"AND"})})]},i.id))}),s.jsx(X,{condition:!!n,show:()=>s.jsx(AI,{segment:n,isExpanded:!0})})]})},VEt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),UEt=({segments:e,setSegments:t})=>{const{segments:n}=ma(),{strategySegmentsLimit:r}=bp(),o=!!(r&&e.length>=r);if(!n||n.length===0)return null;const a=n.filter(c=>!e.find(u=>u.id===c.id)).map(c=>({value:String(c.id),label:c.name})),l=([c])=>{const u=n.find(d=>String(d.id)===c.value);u&&t(d=>[...d,u])};return s.jsxs(s.Fragment,{children:[s.jsxs(VEt,{children:[s.jsx(Z,{children:"Segments"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),o&&s.jsx(oee,{}),s.jsx(PI,{label:"Select segments",options:a,onChange:l,disabled:o,icon:null,width:"175px"}),s.jsx(WEt,{segments:e,setSegments:t})]})},GEt=x(J)(({theme:e})=>({paddingBottom:e.spacing(2)})),qEt=x(Z)(({theme:e})=>({paddingBottom:e.spacing(2)})),YEt=({title:e,setTitle:t})=>s.jsxs(GEt,{children:[s.jsx(qEt,{children:"What would you like to call this strategy? (optional)"}),s.jsx(vr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),KEt=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},XEt=({strategy:e,setStrategy:t})=>{m.useEffect(()=>()=>{e.constraints&&t(o=>{var i;return{...o,constraints:(i=o.constraints)==null?void 0:i.filter(KEt)}})},[]);const n=e.constraints||[],r=o=>{t(i=>({...i,constraints:o instanceof Function?o(i.constraints||[]):o}))};return s.jsx(nee,{constraints:n,setConstraints:r,showCreateButton:!0})},JEt=x("div")({display:"flex",flexDirection:"column"}),QEt=x(J)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),ZEt=({strategy:e,setStrategy:t})=>{const n=(e.variants||[]).map(d=>({...d,new:!0,isValid:!0,id:wi(),overrides:[]})),[r,o]=m.useState(n),i=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default",a=qt();m.useEffect(()=>()=>{t(d=>({...d,variants:r.filter(p=>!!p.name)}))},[JSON.stringify(r)]),m.useEffect(()=>{t(d=>({...d,variants:r.map(p=>({stickiness:i,name:p.name,weight:p.weight,payload:p.payload,weightType:p.weightType}))}))},[i,JSON.stringify(r)]);const l=(d,p)=>{o(f=>I2(f.map(h=>h.id===p?d:h),1e3))},c=()=>{const d=wi();o(p=>[...p,{name:"",weightType:oc.VARIABLE,weight:0,stickiness:i,new:!0,isValid:!1,id:d}])},u=r.reduce((d,p)=>d+(p.weight||0),0)!==1e3;return s.jsxs(s.Fragment,{children:[s.jsx(Lt,{severity:"info",icon:!1,children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),s.jsxs(QEt,{children:[s.jsx(Z,{children:"Variants"}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsx(J,{children:s.jsxs(Z,{variant:"body2",children:["Variants in feature toggling 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"," ",s.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),s.jsxs(JEt,{children:[r.length>0&&s.jsx(dee,{}),r.map((d,p)=>s.jsx(uee,{disableOverrides:!0,variant:d,variants:r,updateVariant:f=>l(f,d.id),removeVariant:()=>o(f=>I2(f.filter(h=>h.id!==d.id),1e3)),decorationColor:a.palette.variants[p%a.palette.variants.length],weightsError:u},d.id))]}),s.jsx(Ue,{onClick:c,variant:"outlined",startIcon:s.jsx(Oo,{}),children:"Add variant"}),s.jsx(OI,{variants:r,weightsError:u})]})},e4t=x(J)(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),t4t=x(J)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",width:"100%",justifyContent:"space-between"})),n4t=x(J)(({theme:e})=>({width:"50%",marginRight:e.spacing(.5)})),r4t=x(J)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"50%",marginLeft:e.spacing(.5),marginBottom:e.spacing(2),"& > div":{flex:1}})),o4t="default",i4t=({parameters:e,updateParameter:t,editable:n,errors:r})=>{const o=(c,u)=>{t("rollout",u.toString())},i=e.rollout!==void 0?Og(e.rollout):100,a=m.useMemo(()=>(e.stickiness||t("stickiness",o4t),Wa(e.stickiness)),[e.stickiness]),l=Wa(e.groupId);return s.jsxs(e4t,{children:[s.jsx(dI,{name:"Rollout",value:i,disabled:!n,onChange:o}),s.jsxs(t4t,{children:[s.jsx(n4t,{children:s.jsx(hZ,{label:"Stickiness",value:a,editable:n,onChange:c=>t("stickiness",c.target.value)})}),s.jsxs(r4t,{children:[s.jsx(vr,{label:"groupId",sx:{width:"100%"},id:"groupId-input",value:l,disabled:!n,onChange:c=>t("groupId",Wa(c.target.value)),error:!!(r!=null&&r.getFormError("groupId")),helperText:r==null?void 0:r.getFormError("groupId")}),s.jsx(bo,{htmlTooltip:!0,tooltip:s.jsxs(s.Fragment,{children:["Supports ",s.jsx("strong",{children:"{{featureName}}"})," as a template variable. If not set, defaults to the feature flag name."]})})]})]})]})},s4t=({strategy:e,strategyDefinition:t,parameters:n,updateParameter:r,errors:o})=>{if(!t)return null;switch(e.strategyName){case"default":return s.jsx(fZ,{strategyDefinition:t});case"flexibleRollout":return s.jsx(i4t,{parameters:n,updateParameter:r,errors:o,editable:!0});default:return s.jsx(gZ,{strategyDefinition:t,parameters:e.parameters??{},updateParameter:r,editable:!0,errors:o})}},a4t=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),l4t=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",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,borderTop:`1px solid ${e.palette.divider}`})),c4t=x(J)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),u4t=x("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),d4t=x(J)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),p4t=x(bR)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),f4t=x(If)(({theme:e})=>({width:"100px"})),nz=x(sn)(({theme:e})=>({marginLeft:e.spacing(1)})),h4t=x("div")(({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%"})),g4t=x(J)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),m4t=x(jr)(({theme:e})=>({width:"100%"})),v4t=x(pI)(({theme:e})=>({top:"-10px",left:"0",transform:"translateY(0)"})),rz=({onCancel:e,strategy:t,onAddUpdateStrategy:n,editMode:r})=>{var C,T;const[o,i]=m.useState(t),[a,l]=m.useState(0),{segments:c,refetchSegments:u}=ma(),[d,p]=m.useState([]),{strategyDefinition:f}=LC(t==null?void 0:t.strategyName),h=KC(t==null?void 0:t.constraints),g=cI(),v=!!(o!=null&&o.parameters&&"stickiness"in(o==null?void 0:o.parameters)),b=o!=null&&o.parameters&&"stickiness"in(o==null?void 0:o.parameters)?String(o.parameters.stickiness):"default",y=c==null?void 0:c.reduce((k,_)=>(k[_.id]=_,k),{});if(m.useEffect(()=>{y&&p(((o==null?void 0:o.segments)||[]).map(k=>y[k]))},[]),m.useEffect(()=>{i(k=>({...k,segments:d.map(_=>_.id)}))},[d]),m.useEffect(()=>{i(k=>({...k,variants:(o.variants||[]).map(_=>({stickiness:b,name:_.name,weight:_.weight,payload:_.payload,weightType:_.weightType}))}))},[b,JSON.stringify(o.variants)]),!t||!o||!f)return null;const w=(k,_)=>{l(_)},S=()=>{var A;const k=((A=o==null?void 0:o.constraints)==null?void 0:A.length)||0,_=(d==null?void 0:d.length)||0;return k+_},j=(k,_)=>{i(Ma(A=>{if(A){if(k==="title"){A.title=_;return}A.parameters=A.parameters??{},A.parameters[k]=_}}))},E=()=>{n(o)};return s.jsxs(Fr,{modal:!0,disablePadding:!0,description:fee,documentationLink:hee,documentationLinkLabel:gee,children:[s.jsx(c4t,{children:s.jsxs(u4t,{children:[Il(o.strategyName||""),o.strategyName==="flexibleRollout"&&s.jsxs(sn,{color:"success",sx:{marginLeft:"1rem"},children:[(C=o.parameters)==null?void 0:C.rollout,"%"]})]})}),!uJ.includes(t.strategyName||"default")&&s.jsx(d4t,{children:s.jsxs(Lt,{severity:"warning",children:["Custom strategies are deprecated. We recommend not adding them to any templates going forward and using the predefined strategies like Gradual rollout with"," ",s.jsx(kn,{href:"https://docs.getunleash.io/reference/activation-strategies#constraints",target:"_blank",variant:"body2",children:"constraints"})," ","instead."]})}),s.jsxs(p4t,{value:a,onChange:w,children:[s.jsx(f4t,{label:"General"}),s.jsx(If,{label:s.jsxs(Z,{children:["Targeting",s.jsx(nz,{children:S()})]})}),v&&s.jsx(If,{label:s.jsxs(Z,{children:["Variants",s.jsx(nz,{children:((T=o==null?void 0:o.variants)==null?void 0:T.length)||0})]})})]}),s.jsxs(h4t,{children:[a===0&&s.jsxs(s.Fragment,{children:[s.jsx(YEt,{title:o.title||"",setTitle:k=>j("title",k)}),s.jsx(s4t,{strategy:o,strategyDefinition:f,parameters:o.parameters,updateParameter:j,errors:g})]}),a===1&&s.jsxs(s.Fragment,{children:[s.jsx(Lt,{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."}),s.jsx(UEt,{segments:d,setSegments:p}),s.jsxs(g4t,{children:[s.jsx(m4t,{}),s.jsx(v4t,{})]}),s.jsx(XEt,{strategy:o,setStrategy:i})]}),a===2&&v&&s.jsx(ZEt,{strategy:o,setStrategy:i})]}),s.jsxs(l4t,{children:[s.jsx(Ue,{variant:"contained",color:"primary",type:"submit",disabled:!h||g.hasFormErrors(),onClick:E,children:r?"Add changes":"Add strategy"}),s.jsx(a4t,{onClick:e,children:"Cancel"})]})]})},y4t=x("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(+ * .${X2}, + .${X2})`]:{filter:"grayscale(.8)"}})),sre=()=>s.jsx(y4t,{role:"separator",children:"OR"});var i6={},x4t=Te;Object.defineProperty(i6,"__esModule",{value:!0});var Mb=i6.default=void 0,b4t=x4t(ke()),w4t=s,S4t=(0,b4t.default)((0,w4t.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");Mb=i6.default=S4t;const C4t=(e,t)=>{const{parameters:n}=e,r=m.useMemo(()=>t.find(a=>a.name===e.name),[t,e.name]),o=r==null?void 0:r.editable,i=(a,l)=>{if(!n||!a.name)return null;const{type:c,name:u}=a,d=s.jsx(yo,{title:u,children:u}),p=`${c}${l}`;switch(c){case"list":{const f=l0(n[u]);return!f||f.length===0?null:s.jsxs(gc,{type:d,children:[f.length===1?"has 1 item:":`has ${f.length} items:`,s.jsx(d1,{values:f})]},p)}case"percentage":{const f=Og(n[u]);return s.jsxs(gc,{type:d,children:["is set to ",s.jsx(Mg,{label:`${f}%`})]},p)}case"boolean":{const f=n[u];return s.jsxs(gc,{type:d,children:["is set to ",s.jsx(Mg,{label:f})]},p)}case"string":{const f=Wa(n[u]);return s.jsxs(gc,{type:d,children:[f===""?"is an empty string":"is set to",s.jsx(d1,{values:f===""?void 0:[f]})]},p)}case"number":{const f=Og(n[u]);return s.jsxs(gc,{type:d,children:["is a number set to",s.jsx(d1,{values:[`${f}`]})]},p)}case"default":return null}return null};return m.useMemo(()=>{var a;return{isCustomStrategy:o,customStrategyParameters:o?(a=r==null?void 0:r.parameters)==null?void 0:a.map(i).filter(Boolean):[]}},[r,o,n])},oz=({value:e,parameters:t,hasConstraints:n,displayGroupId:r})=>{const o=Og(e),a=typeof(t==null?void 0:t.stickiness)=="string"&&(t==null?void 0:t.stickiness)!=="default"?s.jsxs(s.Fragment,{children:["with ",s.jsx("strong",{children:t.stickiness})]}):"";return s.jsx(s.Fragment,{children:s.jsxs(gc,{type:"Rollout %",children:[s.jsx(Mg,{label:`${o}%`}),s.jsxs("p",{children:["of your base ",a," ",s.jsxs("span",{children:[n?"who match constraints ":" ","is included."]}),r&&(t!=null&&t.groupId)?s.jsx(Mg,{label:`groupId: ${t==null?void 0:t.groupId}`,component:"span"}):null]})]})})},j4t=(e,t)=>{const{constraints:n,variants:r}=e,{parameters:o}=e,i=!!(n!=null&&n.length),a=o?Object.keys(o):[],l=c=>{const u=c.toLocaleLowerCase(),d=(o==null?void 0:o[c])||"";return u==="rollout"?s.jsx(oz,{value:d,parameters:o,hasConstraints:i,displayGroupId:t},c):["userids","hostnames","ips"].includes(u)?s.jsx(gc,{type:c,children:s.jsx(d1,{values:l0(d)})},c):null};return m.useMemo(()=>[...a.map(l),e.name==="default"?s.jsx(oz,{value:"100"}):null].filter(Boolean),[o,i,t])},E4t=x("div")(({theme:e})=>({padding:e.spacing(3.5,2,.5)})),T4t=x("div")(()=>({width:"100%",position:"relative"})),k4t=({variants:e,selected:t})=>e!=null&&e.length?s.jsx(E4t,{children:s.jsx(gc,{type:`Variants (${e.length})`,alignType:"top",children:s.jsx(T4t,{children:s.jsx(OI,{variants:e,header:!1,selected:t})})})}):null,Sy=({strategy:e,displayGroupId:t=!1})=>{const{strategies:n}=rh(),{segments:r}=ma(),{isCustomStrategy:o,customStrategyParameters:i}=C4t(e,n),a=j4t(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 s.jsxs(s.Fragment,{children:[s.jsxs(NC,{children:[c==null?void 0:c.map(u=>s.jsx(AI,{segment:u},u.id)),l==null?void 0:l.map((u,d)=>s.jsx(qC,{constraint:u},`${vm(u)}-${d}`)),(o?i:a).map((u,d)=>s.jsx(mZ,{children:u},d))]}),s.jsx(k4t,{variants:e.variants})]})},are=3,_4t=x($t)(({theme:e})=>({marginLeft:e.spacing(-are),padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"})),R4t=x("hgroup")(({theme:e})=>({display:"flex",flexFlow:"row nowrap",columnGap:"1ch",fontSize:e.typography.body1.fontSize,".strategy-name":{fontWeight:"bold",whiteSpace:"nowrap"}})),P4t=x("article")(({theme:e})=>({background:"inherit",padding:e.spacing(are),paddingTop:e.spacing(.5),display:"flex",flexDirection:"column",rowGap:e.spacing(.5)})),A4t=x(yo)(({theme:e})=>({fontSize:e.typography.body1.fontSize,fontWeight:"normal",margin:0})),I4t=x("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"center",color:t?e.palette.text.secondary:e.palette.text.primary})),$4t=x("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),O4t=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,headerItemsLeft:o,strategyHeaderLevel:i=3,children:a,style:l={},className:c})=>{const u="links"in e?({children:d})=>s.jsx(xt,{to:e.links.edit,children:d}):({children:d})=>s.jsxs(s.Fragment,{children:[" ",d," "]});return s.jsx(J,{className:e.disabled?X2:"",sx:{position:"relative"},children:s.jsxs(P4t,{style:l,className:c,children:[s.jsxs(I4t,{disabled:!!(e!=null&&e.disabled),children:[t?s.jsx(_4t,{tabIndex:-1,className:"strategy-drag-handle",draggable:!0,disableRipple:!0,size:"small",onDragStart:t,onDragEnd:n,sx:{cursor:"move"},children:s.jsx(ej,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})}):null,s.jsxs($4t,{children:[s.jsx(u,{children:s.jsx(R4t,{children:e.title?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"strategy-name",children:[Il(String(e.name)),":"]}),s.jsx(A4t,{component:`h${i}`,children:e.title})]}):s.jsx(Z,{className:"strategy-name",component:`h${i}`,children:Il(String(e.name))})})}),o]}),s.jsxs(J,{sx:{marginLeft:"auto",display:"flex",alignItems:"center"},children:[e.disabled?s.jsx(sn,{color:"warning",children:"Strategy disabled"}):null,r]})]}),s.jsx(J,{children:a})]})})},lre=({strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,strategyHeaderLevel:o})=>s.jsx(O4t,{strategyHeaderLevel:o,strategy:e,onDragStart:t,onDragEnd:n,headerItemsRight:r,children:s.jsx(Sy,{strategy:e})}),M4t=({strategy:e,index:t,isDragging:n,onDragStartRef:r,onDragOver:o,onDragEnd:i,headerItemsRight:a})=>{const l=m.useRef(null);return s.jsx(J,{ref:l,onDragOver:o==null?void 0:o(l,t),sx:{opacity:n?"0.5":"1"},children:s.jsx(lre,{headerItemsRight:a,strategy:e,onDragStart:r==null?void 0:r(l,t),onDragEnd:i})},e.id)},cre=x("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)}})),D4t=e=>e.palette.background.elevation2,L4t=e=>e.palette.background.elevation1,ure=x("li")(({theme:e,...t})=>({background:t["data-type"]==="release-plan"?D4t(e):L4t(e)})),F4t=x("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}}})),N4t=x("span")(({theme:e})=>({paddingTop:e.spacing(2),paddingInline:e.spacing(.5),display:"block",height:"100%",width:"100%"})),B4t=x("span")(({theme:e})=>({display:"block",paddingBlock:e.spacing(.75),borderRadius:e.shape.borderRadiusMedium,"> svg":{verticalAlign:"bottom"}})),iz=({dragItemRef:e})=>s.jsx(F4t,{tabIndex:-1,type:"button",children:s.jsxs(N4t,{ref:e,children:[s.jsx(B4t,{className:"draggable-hover-indicator",children:s.jsx(ej,{"aria-hidden":!0})}),s.jsx(Bc,{children:"Drag to reorder"})]})}),dre=3,sz=x("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"})),z4t=x(H0,{shouldForwardProp:e=>e!=="hasError"})(({theme:e,hasError:t})=>({position:"relative",overflow:"initial",display:"flex",alignItems:"center",padding:e.spacing(2,2),paddingLeft:e.spacing(dre),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})),az=x("div")(({theme:e})=>({display:"flex",flexFlow:"row",alignItems:"center"})),H4t=x(Ue)(({theme:e})=>({})),W4t=x(Dc)(({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"})),V4t=x(Fc)(({theme:e})=>({boxShadow:"none",padding:e.spacing(1.5,2),paddingLeft:e.spacing(dre),borderRadius:e.shape.borderRadiusMedium,[e.breakpoints.down(400)]:{padding:e.spacing(1,2)},"&:focus-visible":{background:e.palette.table.headerHover}})),U4t=x(Lc)(({theme:e})=>({borderBottomLeftRadius:e.shape.borderRadiusMedium,borderBottomRightRadius:e.shape.borderRadiusMedium,padding:e.spacing(0),backgroundColor:e.palette.background.elevation1})),G4t=x("div")(({theme:e})=>({padding:e.spacing(2),display:"flex",justifyContent:"flex-end",gap:e.spacing(3),backgroundColor:"inherit",borderTop:`1px solid ${e.palette.divider}`})),q4t=x($t)(({theme:e})=>({marginLeft:e.spacing(1),color:e.palette.primary.main})),Y4t=({milestone:e,milestoneChanged:t,errors:n,clearErrors:r,removable:o,onDeleteMilestone:i,index:a,onMoveItem:l})=>{const[c,u]=m.useState(),[d,p]=m.useState(null),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[b,y]=m.useState(!!e.startExpanded),w=!!c,S=w?"MilestoneStrategyMenuPopover":void 0,j=qee(a,l),E=()=>{u(void 0)},[C,T]=m.useState({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),k=B=>{const L=e.strategies||[];t({...e,strategies:[...L.map(I=>I.id===B.id?B:I)]})},_=B=>{var L;t({...e,strategies:[...e.strategies||[],{...B,strategyName:B.strategyName,sortOrder:((L=e.strategies)==null?void 0:L.length)||0}]})},A=B=>{var I;((I=e.strategies)==null?void 0:I.find(q=>q.id===B.id))?k(B):(_(B),y(!0)),h(!1),v(!1),T({name:"flexibleRollout",parameters:{rollout:"50"},constraints:[],title:"",id:"temp"}),r()},O=(B,L)=>{v(L),T(B),h(!0)},M=B=>(L,I)=>q=>{if(d===null||L.current===null||d.index===I||B===d.id)return;const{top:ee,bottom:W}=L.current.getBoundingClientRect(),oe=q.clientY-ee<d.height,ne=W-q.clientY<d.height,ce=d.index>I;if(oe&&ce||ne&&!ce){const re=[...e.strategies||[]],ve=re.splice(d.index,1)[0];re.splice(I,0,ve),t({...e,strategies:re}),p({...d,index:I})}},H=(B,L)=>I=>{var q,ee;!B.current||!e.strategies||(p({id:(q=e.strategies[L])==null?void 0:q.id,index:L,height:((ee=B.current)==null?void 0:ee.offsetHeight)||0}),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/html",B.current.outerHTML),I.dataTransfer.setDragImage(B.current,20,20))},P=()=>{p(null),$()},$=()=>{if(!e.strategies)return;const B=[...e.strategies];B.forEach((L,I)=>{L.sortOrder=I}),t({...e,strategies:B})},D=B=>{const L=e.strategies||[];t({...e,strategies:[...L.filter(I=>I.id!==B)]})},z=B=>{t({...e,name:B})};return!e.strategies||e.strategies.length===0?s.jsxs(s.Fragment,{children:[s.jsxs(sz,{children:[s.jsx(iz,{dragItemRef:j}),s.jsxs(z4t,{hasError:!!(n!=null&&n[e.id])||!!(n!=null&&n[`${e.id}_name`]),children:[s.jsx(az,{children:s.jsx(ez,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:z})}),s.jsxs(az,{children:[s.jsx(Ue,{variant:"outlined",color:"primary",onClick:B=>u(B.currentTarget),children:"Add strategy"}),s.jsx(q4t,{title:"Remove milestone",onClick:i,disabled:!o,children:s.jsx(Mb,{})}),s.jsx(_l,{id:S,open:w,anchorEl:c,onClose:E,onClick:E,PaperProps:{sx:B=>({paddingBottom:B.spacing(1)})},children:s.jsx(tz,{openEditAddStrategy:B=>{O(B,!1)}})})]})]})]}),s.jsx(L4,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),s.jsx(Za,{label:"Add strategy to template milestone",onClose:()=>{h(!1),v(!1)},open:f,children:s.jsx(rz,{strategy:C,onAddUpdateStrategy:A,onCancel:()=>{h(!1),v(!1)},editMode:g})})]}):s.jsxs(s.Fragment,{children:[s.jsxs(sz,{children:[s.jsx(iz,{dragItemRef:j}),s.jsxs(W4t,{expanded:b,onChange:(B,L)=>y(L),children:[s.jsx(V4t,{expandIcon:s.jsx(ha,{titleAccess:`${b?"Hide":"Show"} milestone strategies`}),id:`milestone-accordion-summary-${e.id}`,"aria-controls":`milestone-accordion-details-${e.id}`,children:s.jsx(ez,{milestone:e,errors:n,clearErrors:r,milestoneNameChanged:z})}),s.jsxs(U4t,{children:[s.jsx(cre,{children:e.strategies.map((B,L)=>s.jsxs(ure,{children:[L>0?s.jsx(sre,{}):null,s.jsx(M4t,{index:L,onDragEnd:P,onDragStartRef:H,onDragOver:M(B.id),isDragging:(d==null?void 0:d.id)===B.id,strategy:{...B,name:B.name||B.strategyName||""},headerItemsRight:s.jsxs(s.Fragment,{children:[s.jsx($t,{title:"Edit strategy",onClick:()=>{O(B,!0)},children:s.jsx(ns,{})}),s.jsx($t,{title:"Remove strategy",onClick:()=>D(B.id),children:s.jsx(Mb,{})})]})})]},B.id))}),s.jsxs(G4t,{children:[s.jsxs(Ue,{variant:"text",color:"primary",onClick:i,disabled:!o,children:[s.jsx(Mb,{})," Remove milestone"]}),s.jsx(H4t,{variant:"outlined",color:"primary",onClick:B=>u(B.currentTarget),children:"Add strategy"}),s.jsx(_l,{id:S,open:w,anchorEl:c,onClose:E,onClick:E,PaperProps:{sx:B=>({paddingBottom:B.spacing(1)})},children:s.jsx(tz,{openEditAddStrategy:B=>{O(B,!1)}})})]})]})]})]}),s.jsx(L4,{error:!!(n!=null&&n[e.id]),children:n==null?void 0:n[e.id]}),s.jsx(Za,{label:"Add strategy to template milestone",onClose:()=>{h(!1),v(!1)},open:f,children:s.jsx(rz,{strategy:C,onAddUpdateStrategy:A,onCancel:()=>{h(!1),v(!1)},editMode:g})})]})},K4t=x(Ue)(({theme:e})=>({marginTop:e.spacing(1),maxWidth:e.spacing(20)})),X4t=({milestones:e,setMilestones:t,errors:n,clearErrors:r,milestoneChanged:o})=>{const i=m.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:g}=p.getBoundingClientRect(),v=u.clientY-h<f,b=g-u.clientY<f;if(l>c?v:b){const j=[...e||[]],E=j.splice(l,1)[0];j.splice(c,0,E),j.forEach((C,T)=>{C.sortOrder=T}),t(j)}}},[e]),a=l=>()=>{t(c=>c.filter(u=>u.id!==l).map((u,d)=>({...u,sortOrder:d})))};return s.jsxs(s.Fragment,{children:[e.map((l,c)=>s.jsx(Y4t,{index:c,onMoveItem:i,milestone:l,milestoneChanged:o,errors:n,clearErrors:r,removable:e.length>1,onDeleteMilestone:a(l.id)},l.id)),s.jsx(K4t,{variant:"text",color:"primary",startIcon:s.jsx(Oo,{}),onClick:()=>t(l=>{var c;return[...l,{id:wi(),name:`Milestone ${l.length+1}`,sortOrder:l.length,strategies:(c=l[l.length-1].strategies)==null?void 0:c.map(u=>({...u,id:wi()})),startExpanded:!0}]}),children:"Add milestone"})]})},J4t=x(vr)(({theme:e})=>({maxWidth:e.spacing(50),fieldset:{border:"none"},"label::first-letter":{textTransform:"uppercase"},marginBottom:e.spacing(2),padding:e.spacing(0)})),Q4t=x(vr)(({theme:e})=>({width:"100%",fieldset:{border:"none"},"label::first-letter":{textTransform:"uppercase"},marginBottom:e.spacing(2),padding:e.spacing(2,5,1,1.75)})),Z4t=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",height:"100%",paddingTop:e.spacing(5)})),eTt=x(J)(({theme:e})=>({flex:1,display:"flex",alignItems:"flex-end",marginTop:e.spacing(3),marginBottom:e.spacing(3)})),pre=({name:e,setName:t,description:n,setDescription:r,milestones:o,setMilestones:i,errors:a,clearErrors:l,formTitle:c,archived:u,formatApiCode:d,handleSubmit:p,Limit:f,children:h})=>{const g=qt(),v=b=>{i(y=>y.map(w=>w.id===b.id?{...b}:w))};return s.jsxs(Fr,{title:c,description:s.jsx(_Et,{}),formatApiCode:d,children:[u&&s.jsx(Lt,{severity:"warning",children:"This template has been archived and can no longer be edited."}),s.jsxs(Z4t,{onSubmit:p,children:[s.jsx(J4t,{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:g.typography.h1.fontSize}},InputLabelProps:{style:{fontSize:g.typography.h1.fontSize}},size:"medium"}),s.jsx(Q4t,{label:"Template description (optional)",multiline:!0,value:n,onChange:b=>r(b.target.value),InputProps:{style:{fontSize:g.typography.h2.fontSize,padding:0}},InputLabelProps:{style:{fontSize:g.typography.h2.fontSize,padding:0}},size:"small"}),s.jsx(X4t,{milestones:o,setMilestones:i,errors:a,clearErrors:l,milestoneChanged:v}),s.jsx(eTt,{children:f}),h]})]})},fre=(e="",t="",n=[{id:wi(),name:"Milestone 1",sortOrder:0}])=>{const r=$s("templateId"),{templates:o}=hj(),[i,a]=m.useState(e),[l,c]=m.useState(t),[u,d]=m.useState(n),[p,f]=m.useState({});return m.useEffect(()=>{a(e)},[e]),m.useEffect(()=>{c(t)},[t]),m.useEffect(()=>{d(n)},[n.length]),{name:i,setName:a,description:l,setDescription:c,milestones:u,setMilestones:d,errors:p,clearErrors:()=>{f({})},validate:()=>{let b=!0;i.length===0&&(f(S=>({...S,name:"Name can not be empty."})),b=!1),o.some(S=>S.name===i&&S.id!==r)&&(f(S=>({...S,name:"A template with this name already exists."})),b=!1),u.length===0&&(f(S=>({...S,milestones:"At least one milestone is required."})),b=!1);const y={},w=new Set;return u.forEach(S=>{(!S.name||S.name.length===0)&&(y[S.id]="Milestone must have a valid name.",y[`${S.id}_name`]="Milestone must have a valid name."),(!S.strategies||S.strategies.length===0)&&(y[S.id]="Milestone must have at least one strategy."),w.has(S.name)?y[S.id]="Milestone names must be unique.":S.name&&w.add(S.name)}),Object.keys(y).length>0&&(f(S=>({...S,...y,milestones:"All milestones must have unique names and at least one strategy each."})),b=!1),b},getTemplatePayload:()=>({name:i,description:l,milestones:u.map(({startExpanded:b,...y})=>y)})}},tTt=x("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),nTt=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),rTt=()=>{const{uiConfig:e,isEnterprise:t}=rt(),{setToastApiError:n,setToastData:r}=Nt(),o=Ot(),{createReleasePlanTemplate:i}=o6(),{trackEvent:a}=Kt(),{templates:l}=hj(),c=e.resourceLimits.releaseTemplates,u=l.length<c;Iu("Create release template");const{name:d,setName:p,description:f,setDescription:h,milestones:g,setMilestones:v,errors:b,clearErrors:y,validate:w,getTemplatePayload:S}=fre(),j=()=>{o(as)},E=async T=>{if(T.preventDefault(),y(),w())try{const _=await i(S());hK(),r({type:"success",text:"Release template created"}),a("release-management",{props:{eventType:"create-template",template:_.name}}),o("/release-templates")}catch(_){n(Tt(_))}},C=()=>`curl --location --request POST '${e.unleashUrl}/api/admin/release-plan-templates' \\
466
466
  --header 'Authorization: INSERT_API_KEY' \\
467
467
  --header 'Content-Type: application/json' \\
468
468
  --data-raw '${JSON.stringify(S(),void 0,2)}'`;return t()?s.jsx(pre,{name:d,setName:p,description:f,setDescription:h,milestones:g,setMilestones:v,errors:b,clearErrors:y,formTitle:"Create release template",formatApiCode:C,handleSubmit:E,Limit:s.jsx(ly,{name:"release templates",limit:c,currentValue:l.length}),children:s.jsxs(tTt,{children:[s.jsx(ah,{name:"template",permission:jA,disabled:!u,children:"Save template"}),s.jsx(nTt,{onClick:j,children:"Cancel"})]})}):null},oTt=e=>`api/admin/release-plan-templates/${e}`,lz={id:"",name:"",description:"",milestones:[],createdAt:"",createdByUserId:0},hre=e=>{const{isEnterprise:t}=rt(),{data:n,error:r,mutate:o}=Bi(t(),lz,bt(oTt(e)),iTt);return m.useMemo(()=>({template:n??lz,loading:!r&&!n,refetch:()=>o(),error:r}),[n,r,o])},iTt=e=>fetch(e).then(Jt("Release template")).then(t=>t.json()),sTt=x("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),aTt=x(Ue)(({theme:e})=>({marginLeft:e.spacing(3)})),lTt=()=>{const{uiConfig:e,isEnterprise:t}=rt(),n=Or("templateId"),{template:r,loading:o,error:i,refetch:a}=hre(n),{trackEvent:l}=Kt();Iu("Edit release template");const c=Ot(),{setToastApiError:u,setToastData:d}=Nt(),{updateReleasePlanTemplate:p}=o6(),{name:f,setName:h,description:g,setDescription:v,errors:b,clearErrors:y,milestones:w,setMilestones:S,validate:j,getTemplatePayload:E}=fre(r.name,r.description,r.milestones),C=()=>{c("/release-templates")},T=async _=>{if(_.preventDefault(),y(),j())try{await p(n,E()),await a(),d({type:"success",text:"Release template updated"}),l("release-management",{props:{eventType:"edit-template",template:r.name}}),c("/release-templates")}catch(O){u(Tt(O))}},k=()=>`curl --location --request PUT '${e.unleashUrl}/api/admin/release-plan-templates/${n}' \\