unleash-server 5.5.3 → 5.5.5

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 (27) hide show
  1. package/dist/lib/services/project-health-service.d.ts +0 -1
  2. package/dist/lib/services/project-health-service.js +4 -9
  3. package/dist/lib/services/project-health-service.js.map +1 -1
  4. package/frontend/build/index.html +1 -1
  5. package/frontend/build/static/{AdvancedPlayground-abef6155.js → AdvancedPlayground-1d40ca66.js} +1 -1
  6. package/frontend/build/static/{CreateProject-6ee5e39c.js → CreateProject-7137c153.js} +1 -1
  7. package/frontend/build/static/{Error-96134128.js → Error-8db81fe3.js} +1 -1
  8. package/frontend/build/static/{FeatureArchiveDialog-c613a9be.js → FeatureArchiveDialog-bfc17ec3.js} +3 -3
  9. package/frontend/build/static/{FeatureMetricsChart-a32146f8.js → FeatureMetricsChart-74b86882.js} +2 -2
  10. package/frontend/build/static/{FeatureViewLazyExport-d7e816f2.js → FeatureViewLazyExport-764b84de.js} +2 -2
  11. package/frontend/build/static/{LazyAdminExport-7486d382.js → LazyAdminExport-27b6004e.js} +2 -2
  12. package/frontend/build/static/{LazyProjectExport-19d9c4f0.js → LazyProjectExport-8d1a4482.js} +11 -11
  13. package/frontend/build/static/{NetworkOverview-7cdc3de8.js → NetworkOverview-14424a3b.js} +2 -2
  14. package/frontend/build/static/{NetworkTraffic-0e3adee3.js → NetworkTraffic-2141c36a.js} +1 -1
  15. package/frontend/build/static/{ReactJSONEditor-900afb5d.js → ReactJSONEditor-1196ab92.js} +1 -1
  16. package/frontend/build/static/{RoleCell-aa0d7a05.js → RoleCell-3781fc9d.js} +1 -1
  17. package/frontend/build/static/{StrategyItemContainer-4f546cf4.js → StrategyItemContainer-89d55669.js} +1 -1
  18. package/frontend/build/static/{chartjs-adapter-date-fns.esm-bb13a147.js → chartjs-adapter-date-fns.esm-b9693ae4.js} +1 -1
  19. package/frontend/build/static/{flowchart-elk-definition-170a3958-5593653b.js → flowchart-elk-definition-170a3958-dc742c7d.js} +1 -1
  20. package/frontend/build/static/{index-0165843e.js → index-31edcb6f.js} +1 -1
  21. package/frontend/build/static/{index-b6e8c0c5.js → index-58ca4e41.js} +1 -1
  22. package/frontend/build/static/{index-83ae2eb3.js → index-9add17b9.js} +4 -4
  23. package/frontend/build/static/{is_dark-e2b6fb2d.js → is_dark-0f348beb.js} +1 -1
  24. package/frontend/build/static/{mindmap-definition-44684416-32899bfd.js → mindmap-definition-44684416-ad6e7a3e.js} +1 -1
  25. package/frontend/build/static/{timeline-definition-8e5a9bc6-717d2a5f.js → timeline-definition-8e5a9bc6-bf7dc1c7.js} +1 -1
  26. package/frontend/build/static/{unknownify-b7f23ad5.js → unknownify-9625098a.js} +1 -1
  27. package/package.json +1 -1
@@ -7,7 +7,6 @@ export default class ProjectHealthService {
7
7
  private projectStore;
8
8
  private featureTypeStore;
9
9
  private featureToggleStore;
10
- private featureTypes;
11
10
  private projectService;
12
11
  constructor({ projectStore, featureTypeStore, featureToggleStore, }: Pick<IUnleashStores, 'projectStore' | 'featureTypeStore' | 'featureToggleStore'>, { getLogger }: Pick<IUnleashConfig, 'getLogger'>, projectService: ProjectService);
13
12
  getProjectHealthReport(projectId: string): Promise<IProjectHealthReport>;
@@ -7,29 +7,24 @@ class ProjectHealthService {
7
7
  this.projectStore = projectStore;
8
8
  this.featureTypeStore = featureTypeStore;
9
9
  this.featureToggleStore = featureToggleStore;
10
- this.featureTypes = [];
11
10
  this.projectService = projectService;
12
11
  }
13
12
  async getProjectHealthReport(projectId) {
14
- if (this.featureTypes.length === 0) {
15
- this.featureTypes = await this.featureTypeStore.getAll();
16
- }
13
+ const featureTypes = await this.featureTypeStore.getAll();
17
14
  const overview = await this.projectService.getProjectOverview(projectId, false, undefined);
18
- const healthRating = (0, project_health_1.calculateProjectHealth)(overview.features, this.featureTypes);
15
+ const healthRating = (0, project_health_1.calculateProjectHealth)(overview.features, featureTypes);
19
16
  return {
20
17
  ...overview,
21
18
  ...healthRating,
22
19
  };
23
20
  }
24
21
  async calculateHealthRating(project) {
25
- if (this.featureTypes.length === 0) {
26
- this.featureTypes = await this.featureTypeStore.getAll();
27
- }
22
+ const featureTypes = await this.featureTypeStore.getAll();
28
23
  const toggles = await this.featureToggleStore.getAll({
29
24
  project: project.id,
30
25
  archived: false,
31
26
  });
32
- return (0, project_health_1.calculateHealthRating)(toggles, this.featureTypes);
27
+ return (0, project_health_1.calculateHealthRating)(toggles, featureTypes);
33
28
  }
34
29
  async setHealthRating() {
35
30
  const projects = await this.projectStore.getAll();
@@ -1 +1 @@
1
- {"version":3,"file":"project-health-service.js","sourceRoot":"","sources":["../../../src/lib/services/project-health-service.ts"],"names":[],"mappings":";;AAWA,4EAGiD;AAEjD,MAAqB,oBAAoB;IAarC,YACI,EACI,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GAIrB,EACD,EAAE,SAAS,EAAqC,EAChD,cAA8B;QAE9B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,oCAAoC,CAAC,CAAC;QAC9D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,sBAAsB,CACxB,SAAiB;QAEjB,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,IAAI,CAAC,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;SAC5D;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CACzD,SAAS,EACT,KAAK,EACL,SAAS,CACZ,CAAC;QAEF,MAAM,YAAY,GAAG,IAAA,uCAAsB,EACvC,QAAQ,CAAC,QAAQ,EACjB,IAAI,CAAC,YAAY,CACpB,CAAC;QAEF,OAAO;YACH,GAAG,QAAQ;YACX,GAAG,YAAY;SAClB,CAAC;IACN,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,OAAiB;QACzC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,IAAI,CAAC,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;SAC5D;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC;YACjD,OAAO,EAAE,OAAO,CAAC,EAAE;YACnB,QAAQ,EAAE,KAAK;SAClB,CAAC,CAAC;QAEH,OAAO,IAAA,sCAAqB,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,eAAe;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAElD,MAAM,OAAO,CAAC,GAAG,CACb,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAC5D,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;gBACjC,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,MAAM,EAAE,SAAS;aACpB,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;IACN,CAAC;CACJ;AApFD,uCAoFC"}
1
+ {"version":3,"file":"project-health-service.js","sourceRoot":"","sources":["../../../src/lib/services/project-health-service.ts"],"names":[],"mappings":";;AAQA,4EAGiD;AAEjD,MAAqB,oBAAoB;IAWrC,YACI,EACI,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GAIrB,EACD,EAAE,SAAS,EAAqC,EAChD,cAA8B;QAE9B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,oCAAoC,CAAC,CAAC;QAC9D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAE7C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,sBAAsB,CACxB,SAAiB;QAEjB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAE1D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CACzD,SAAS,EACT,KAAK,EACL,SAAS,CACZ,CAAC;QAEF,MAAM,YAAY,GAAG,IAAA,uCAAsB,EACvC,QAAQ,CAAC,QAAQ,EACjB,YAAY,CACf,CAAC;QAEF,OAAO;YACH,GAAG,QAAQ;YACX,GAAG,YAAY;SAClB,CAAC;IACN,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,OAAiB;QACzC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAE1D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC;YACjD,OAAO,EAAE,OAAO,CAAC,EAAE;YACnB,QAAQ,EAAE,KAAK;SAClB,CAAC,CAAC;QAEH,OAAO,IAAA,sCAAqB,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,eAAe;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAElD,MAAM,OAAO,CAAC,GAAG,CACb,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAC5D,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;gBACjC,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,MAAM,EAAE,SAAS;aACpB,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;IACN,CAAC;CACJ;AA7ED,uCA6EC"}
@@ -16,7 +16,7 @@
16
16
  href="https://fonts.googleapis.com/css2?family=Sen:wght@400;700;800&display=swap"
17
17
  rel="stylesheet"
18
18
  />
19
- <script type="module" crossorigin src="/static/index-83ae2eb3.js"></script>
19
+ <script type="module" crossorigin src="/static/index-9add17b9.js"></script>
20
20
  <link rel="stylesheet" href="/static/style-97d3ef98.css">
21
21
  </head>
22
22
  <body>
@@ -1,4 +1,4 @@
1
- import{c as qi,j as m,u as Xu,r as E,_ as Zu,a as Yr,s as V,U as ef,b as me,d as D,B as q,C as j,e as tf,f as za,g as nf,h as Si,T as te,F as sf,I as rf,S as of,M as lf,i as Xr,p as No,k as Fo,l as Ci,A as ir,m as af,n as hf,o as cf,q as uf,D as ff,t as ti,P as df,v as $a,w as pf,x as Ai,y as Be,z as mf,E as Pi,G as Ui,H as gf,J as ja,K as yf,L as bf,N as nr,O as wn,Q as sr,R as xf,V as wf,W as vf,X as kf,Y as Zr,Z as as,$ as Sf,a0 as Me,a1 as hs,a2 as Cf,a3 as Af,a4 as Mf,a5 as Of,a6 as Tf,a7 as Df,a8 as Wo,a9 as qa,aa as eo,ab as to,ac as Ua,ad as io,ae as Ga,af as Ka,ag as Pf,ah as Qa,ai as Rf,aj as Vo,ak as Bf,al as Ef,am as Ms,an as Lf,ao as If,ap as Nf,aq as Ff,ar as Wf,as as Vf}from"./index-83ae2eb3.js";import{E as Hf}from"./Error-96134128.js";import{S as zf}from"./StrategyItemContainer-4f546cf4.js";const cs=qi(m("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 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 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined"),$f=qi(m("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"),jf=qi(m("path",{d:"M12 2C6.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 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),qf=qi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help"),Uf=qi(m("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined"),Gf=()=>{const{makeRequest:n,createRequest:e,errors:t,loading:i}=Xu({propagateErrors:!0}),s="api/admin/playground";return{evaluateAdvancedPlayground:async o=>{const l=`${s}/advanced`,a=e(l,{method:"POST",body:JSON.stringify(o)});try{return(await n(a.caller,a.id)).json()}catch(h){throw h}},errors:t,loading:i}};function rr(n,e,t){var i,s,r,o,l;e==null&&(e=100);function a(){var c=Date.now()-o;c<e&&c>=0?i=setTimeout(a,e-c):(i=null,t||(l=n.apply(r,s),r=s=null))}var h=function(){r=this,s=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(a,e)),c&&(l=n.apply(r,s),r=s=null),l};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(l=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},h}rr.debounce=rr;var Kf=rr;class U{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),tt.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),tt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Mi(this),r=new Mi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Mi(this,e)}iterRange(e,t=this.length){return new Ja(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new _a(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?U.empty:e.length<=32?new ae(e):tt.from(ae.split(e,[]))}}class ae extends U{constructor(e,t=Qf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Jf(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new ae(Ho(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=vn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new ae(l,o.length+r.length));else{let a=l.length>>1;i.push(new ae(l.slice(0,a)),new ae(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof ae))return super.replace(e,t,i);let s=vn(this.text,vn(i.text,Ho(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new ae(s,r):tt.from(ae.split(s,[]),r)}sliceString(e,t=this.length,i=`
1
+ import{c as qi,j as m,u as Xu,r as E,_ as Zu,a as Yr,s as V,U as ef,b as me,d as D,B as q,C as j,e as tf,f as za,g as nf,h as Si,T as te,F as sf,I as rf,S as of,M as lf,i as Xr,p as No,k as Fo,l as Ci,A as ir,m as af,n as hf,o as cf,q as uf,D as ff,t as ti,P as df,v as $a,w as pf,x as Ai,y as Be,z as mf,E as Pi,G as Ui,H as gf,J as ja,K as yf,L as bf,N as nr,O as wn,Q as sr,R as xf,V as wf,W as vf,X as kf,Y as Zr,Z as as,$ as Sf,a0 as Me,a1 as hs,a2 as Cf,a3 as Af,a4 as Mf,a5 as Of,a6 as Tf,a7 as Df,a8 as Wo,a9 as qa,aa as eo,ab as to,ac as Ua,ad as io,ae as Ga,af as Ka,ag as Pf,ah as Qa,ai as Rf,aj as Vo,ak as Bf,al as Ef,am as Ms,an as Lf,ao as If,ap as Nf,aq as Ff,ar as Wf,as as Vf}from"./index-9add17b9.js";import{E as Hf}from"./Error-8db81fe3.js";import{S as zf}from"./StrategyItemContainer-89d55669.js";const cs=qi(m("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 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 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined"),$f=qi(m("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"),jf=qi(m("path",{d:"M12 2C6.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 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),qf=qi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help"),Uf=qi(m("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined"),Gf=()=>{const{makeRequest:n,createRequest:e,errors:t,loading:i}=Xu({propagateErrors:!0}),s="api/admin/playground";return{evaluateAdvancedPlayground:async o=>{const l=`${s}/advanced`,a=e(l,{method:"POST",body:JSON.stringify(o)});try{return(await n(a.caller,a.id)).json()}catch(h){throw h}},errors:t,loading:i}};function rr(n,e,t){var i,s,r,o,l;e==null&&(e=100);function a(){var c=Date.now()-o;c<e&&c>=0?i=setTimeout(a,e-c):(i=null,t||(l=n.apply(r,s),r=s=null))}var h=function(){r=this,s=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(a,e)),c&&(l=n.apply(r,s),r=s=null),l};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(l=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},h}rr.debounce=rr;var Kf=rr;class U{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),tt.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),tt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Mi(this),r=new Mi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Mi(this,e)}iterRange(e,t=this.length){return new Ja(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new _a(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?U.empty:e.length<=32?new ae(e):tt.from(ae.split(e,[]))}}class ae extends U{constructor(e,t=Qf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Jf(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new ae(Ho(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=vn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new ae(l,o.length+r.length));else{let a=l.length>>1;i.push(new ae(l.slice(0,a)),new ae(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof ae))return super.replace(e,t,i);let s=vn(this.text,vn(i.text,Ho(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new ae(s,r):tt.from(ae.split(s,[]),r)}sliceString(e,t=this.length,i=`
2
2
  `){let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(s+=i),e<a&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new ae(i,s)),i=[],s=-1);return s>-1&&t.push(new ae(i,s)),t}}class tt extends U{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if(i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>5-1&&a.lines>h>>5+1){let c=this.children.slice();return c[s]=a,new tt(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
3
  `){let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(s+=i),e<a&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof tt))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new ae(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function u(d){let p;if(d.lines>r&&d instanceof tt)for(let b of d.children)u(b);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof ae&&a&&(p=c[c.length-1])instanceof ae&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new ae(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&f(),a+=d.lines,h+=d.length+1,c.push(d))}function f(){a!=0&&(l.push(c.length==1?c[0]:tt.from(c,h)),h=-1,a=c.length=0)}for(let d of e)u(d);return f(),l.length==1?l[0]:new tt(l,t)}}U.empty=new ae([""],0);function Qf(n){let e=-1;for(let t of n)e+=t.length+1;return e}function vn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=t&&(a>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function Ho(n,e,t){return vn(n,[""],e,t)}class Mi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ae?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof ae?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(s instanceof ae){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ae?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Ja{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Mi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _a{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(U.prototype[Symbol.iterator]=function(){return this.iter()},Mi.prototype[Symbol.iterator]=Ja.prototype[Symbol.iterator]=_a.prototype[Symbol.iterator]=function(){return this});class Jf{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Jt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<Jt.length;n++)Jt[n]+=Jt[n-1];function _f(n){for(let e=1;e<Jt.length;e+=2)if(Jt[e]>n)return Jt[e-1]<=n;return!1}function zo(n){return n>=127462&&n<=127487}const $o=8205;function Oe(n,e,t=!0,i=!0){return(t?Ya:Yf)(n,e,i)}function Ya(n,e,t){if(e==n.length)return e;e&&Xa(n.charCodeAt(e))&&Za(n.charCodeAt(e-1))&&e--;let i=ye(n,e);for(e+=Ne(i);e<n.length;){let s=ye(n,e);if(i==$o||s==$o||t&&_f(s))e+=Ne(s),i=s;else if(zo(s)){let r=0,o=e-2;for(;o>=0&&zo(ye(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Yf(n,e,t){for(;e>0;){let i=Ya(n,e-2,t);if(i<e)return i;e--}return 0}function Xa(n){return n>=56320&&n<57344}function Za(n){return n>=55296&&n<56320}function ye(n,e){let t=n.charCodeAt(e);if(!Za(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Xa(i)?(t-55296<<10)+(i-56320)+65536:t}function no(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ne(n){return n<65536?1:2}const or=/\r\n?|\n/;var Ae=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Ae||(Ae={}));class st{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){lr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new st(e)}composeDesc(e){return this.empty?e:e.empty?this:eh(this,e)}mapDesc(e,t=!1){return e.empty?this:ar(this,e,t)}mapPos(e,t=-1,i=Ae.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>e)return r+(e-s);r+=l}else{if(i!=Ae.Simple&&h>=e&&(i==Ae.TrackDel&&s<e&&h>e||i==Ae.TrackBefore&&s<e||i==Ae.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=t&&l>=e)return s<e&&l>t?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new st(e)}static create(e){return new st(e)}}class fe extends st{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return lr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return ar(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],l=t[s+1];if(l>=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(U.empty);i.push(o?e.slice(r,r+o):U.empty)}r+=o}return new fe(t,i)}compose(e){return this.empty?e:e.empty?this:eh(this,e,!0)}map(e,t=!1){return e.empty?this:ar(this,e,t,!0)}iterChanges(e,t=!1){lr(this,e,t)}get desc(){return st.create(this.sections)}filter(e){let t=[],i=[],s=[],r=new Ri(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,a-l);ve(s,c,-1);let u=r.ins==-1?-1:r.off==0?r.ins:0;ve(t,c,u),u>0&&xt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l<h;){if(r.done)break e;let c=Math.min(r.len,h-l);ve(t,c,-1),ve(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new fe(t,i),filtered:st.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<t&&ve(s,t-o,-1);let u=new fe(s,r);l=l?l.compose(u.map(l)):u,s=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let u of c)h(u);else if(c instanceof fe){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:u,to:f=u,insert:d}=c;if(u>f||u<0||f>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let p=d?typeof d=="string"?U.of(d.split(i||or)):d:U.empty,b=p.length;if(u==f&&b==0)return;u<o&&a(),u>o&&ve(s,u-o,-1),ve(s,f-u,b),xt(r,s,p),o=f}}return h(e),a(!l),l}static empty(e){return new fe(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length<s;)i.push(U.empty);i[s]=U.of(r.slice(1)),t.push(r[0],i[s].length)}}}return new fe(t,i)}static createSet(e,t){return new fe(e,t)}}function ve(n,e,t,i=!1){if(e==0&&t<=0)return;let s=n.length-2;s>=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function xt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(U.empty);n.push(t)}}function lr(n,e,t){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,c=r,u=U.empty;for(;h+=l,c+=a,a&&i&&(u=u.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,u),s=h,r=c}}}function ar(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Ri(n),l=new Ri(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ve(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(ve(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ve(s,0,o.ins),r&&xt(r,s,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let u=Math.min(c,l.len);h+=u,c-=u,l.forward(u)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;ve(s,h,a<o.i?o.ins:0),r&&a<o.i&&xt(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?fe.createSet(s,r):st.create(s);throw new Error("Mismatched change set lengths")}}function eh(n,e,t=!1){let i=[],s=t?[]:null,r=new Ri(n),o=new Ri(e);for(let l=!1;;){if(r.done&&o.done)return s?fe.createSet(i,s):st.create(i);if(r.ins==0)ve(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)ve(i,0,o.ins,l),s&&xt(s,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ve(i,a,c,l),s&&c&&xt(s,i,o.text)}else o.ins==-1?(ve(i,r.off?0:r.len,a,l),s&&xt(s,i,r.textBit(a))):(ve(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&xt(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Ri{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?U.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?U.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class It{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new It(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return w.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return w.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return w.range(e.anchor,e.head)}static create(e,t,i){return new It(e,t,i)}}class w{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:w.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new w([this.main],0)}addRange(e,t=!0){return w.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,w.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new w(e.ranges.map(t=>It.fromJSON(t)),e.main)}static single(e,t=e){return new w([w.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=i:r.from<i)return w.normalized(e.slice(),t);i=r.to}return new w(e,t)}static cursor(e,t=0,i,s){return It.create(e,e,(t==0?0:t<0?4:8)|(i==null?3:Math.min(2,i))|(s??33554431)<<5)}static range(e,t,i,s){let r=(i??33554431)<<5|(s==null?3:Math.min(2,s));return t<e?It.create(t,e,24|r):It.create(e,t,(t>e?4:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?w.range(a,l):w.range(l,a))}}return new w(e,t)}}function th(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let so=0;class B{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=so++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new B(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:ro),!!e.static,e.enables)}of(e){return new kn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new kn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new kn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function ro(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class kn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=so++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let u of this.dependencies)u=="doc"?a=!0:u=="selection"?h=!0:((t=e[u.id])!==null&&t!==void 0?t:1)&1||c.push(e[u.id]);return{create(u){return u.values[o]=i(u),1},update(u,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||hr(u,c)){let d=i(u);if(l?!jo(d,u.values[o],s):!s(d,u.values[o]))return u.values[o]=d,1}return 0},reconfigure:(u,f)=>{let d,p=f.config.address[r];if(p!=null){let b=Bn(f,p);if(this.dependencies.every(g=>g instanceof B?f.facet(g)===u.facet(g):g instanceof we?f.field(g,!1)==u.field(g,!1):!0)||(l?jo(d=i(u),b,s):s(d=i(u),b)))return u.values[o]=b,0}else d=i(u);return u.values[o]=d,1}}}}function jo(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function hr(n,e){let t=!1;for(let i of e)Oi(n,i)&1&&(t=!0);return t}function Xf(n,e,t){let i=t.map(a=>n[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let u=Bn(a,i[c]);if(s[c]==2)for(let f of u)h.push(f);else h.push(u)}return e.combine(h)}return{create(a){for(let h of i)Oi(a,h);return a.values[o]=l(a),1},update(a,h){if(!hr(a,r))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=hr(a,i),u=h.config.facets[e.id],f=h.facet(e);if(u&&!c&&ro(t,u))return a.values[o]=f,0;let d=l(a);return e.compare(d,f)?(a.values[o]=f,0):(a.values[o]=d,1)}}}const qo=B.define({static:!0});class we{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new we(so++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(qo).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,qo.of({field:this,create:e})]}get extension(){return this}}const Et={lowest:4,low:3,default:2,high:1,highest:0};function di(n){return e=>new ih(e,n)}const ci={highest:di(Et.highest),high:di(Et.high),default:di(Et.default),low:di(Et.low),lowest:di(Et.lowest)};class ih{constructor(e,t){this.inner=e,this.prec=t}}class us{of(e){return new cr(this,e)}reconfigure(e){return us.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class cr{constructor(e,t){this.compartment=e,this.inner=t}}class Rn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let f of Zf(e,t,o))f instanceof we?s.push(f):(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of s)l[f.id]=h.length<<1,h.push(d=>f.slot(d));let c=i==null?void 0:i.config.facets;for(let f in r){let d=r[f],p=d[0].facet,b=c&&c[f]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,ro(b,d))a.push(i.facet(p));else{let g=p.combine(d.map(x=>x.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(x=>g.dynamicSlot(x)));l[p.id]=h.length<<1,h.push(g=>Xf(g,p,d))}}let u=h.map(f=>f(l));return new Rn(e,o,u,l,a,r)}}function Zf(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof cr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof cr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof ih)r(o.inner,o.prec);else if(o instanceof we)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof kn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Et.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,Et.default),i.reduce((o,l)=>o.concat(l))}function Oi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Bn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const nh=B.define(),sh=B.define({combine:n=>n.some(e=>e),static:!0}),rh=B.define({combine:n=>n.length?n[0]:void 0,static:!0}),oh=B.define(),lh=B.define(),ah=B.define(),hh=B.define({combine:n=>n.length?n[0]:!1});class ft{constructor(e,t){this.type=e,this.value=t}static define(){return new ed}}class ed{of(e){return new ft(this,e)}}class td{constructor(e){this.map=e}of(e){return new W(this,e)}}class W{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new W(this.type,t)}is(e){return this.type==e}static define(e={}){return new td(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}W.reconfigure=W.define();W.appendConfig=W.define();class de{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&th(i,t.newLength),r.some(l=>l.type==de.time)||(this.annotations=r.concat(de.time.of(Date.now())))}static create(e,t,i,s,r,o){return new de(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(de.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}de.time=ft.define();de.userEvent=ft.define();de.addToHistory=ft.define();de.remote=ft.define();function id(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==e.length||e[s]>=n[i]))r=n[i++],o=n[i++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function ch(n,e,t){var i;let s,r,o;return t?(s=e.changes,r=fe.empty(e.changes.length),o=n.changes.compose(e.changes)):(s=e.changes.map(n.changes),r=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:W.mapEffects(n.effects,s).concat(W.mapEffects(e.effects,r)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function ur(n,e,t){let i=e.selection,s=_t(e.annotations);return e.userEvent&&(s=s.concat(de.userEvent.of(e.userEvent))),{changes:e.changes instanceof fe?e.changes:fe.of(e.changes||[],t,n.facet(rh)),selection:i&&(i instanceof w?i:w.single(i.anchor,i.head)),effects:_t(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function uh(n,e,t){let i=ur(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=ch(i,ur(n,e[r],o?i.changes.newLength:n.doc.length),o)}let s=de.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return sd(t?nd(s):s)}function nd(n){let e=n.startState,t=!0;for(let s of e.facet(oh)){let r=s(n);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:id(t,r))}if(t!==!0){let s,r;if(t===!1)r=n.changes.invertedDesc,s=fe.empty(e.doc.length);else{let o=n.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=de.create(e,s,n.selection&&n.selection.map(r),W.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=e.facet(lh);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof de?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof de?n=r[0]:n=uh(e,_t(r),!1)}return n}function sd(n){let e=n.startState,t=e.facet(ah),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=ch(i,ur(e,r,n.changes.newLength),!0))}return i==n?n:de.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const rd=[];function _t(n){return n==null?rd:Array.isArray(n)?n:[n]}var ie=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(ie||(ie={}));const od=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let fr;try{fr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ld(n){if(fr)return fr.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||od.test(t)))return!0}return!1}function ad(n){return e=>{if(!/\S/.test(e))return ie.Space;if(ld(e))return ie.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return ie.Word;return ie.Other}}class ${constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Oi(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Oi(this,i),Bn(this,i)}update(...e){return uh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let o of e.effects)o.is(us.reconfigure)?(t&&(s=new Map,t.compartments.forEach((l,a)=>s.set(a,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(W.reconfigure)?(t=null,i=o.value):o.is(W.appendConfig)&&(t=null,i=_t(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Rn.resolve(i,s,this),r=new $(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new $(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:w.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=_t(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(s);for(let f=0;f<l;f++)r[f]=r[f].map(c);let u=s.mapDesc(h,!0);r.push(a.range.map(u)),s=s.compose(c),o=W.mapEffects(o,c).concat(W.mapEffects(_t(a.effects),u))}return{changes:s,selection:w.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof fe?e:fe.of(e,this.doc.length,this.facet($.lineSeparator))}toText(e){return U.of(e.split(this.facet($.lineSeparator)||or))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Oi(this,t),Bn(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof we&&this.config.address[s.id]!=null&&(t[i]=s.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return $.create({doc:e.doc,selection:w.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Rn.resolve(e.extensions||[],new Map),i=e.doc instanceof U?e.doc:U.of((e.doc||"").split(t.staticFacet($.lineSeparator)||or)),s=e.selection?e.selection instanceof w?e.selection:w.single(e.selection.anchor,e.selection.head):w.single(0);return th(s,i.length),t.staticFacet(sh)||(s=s.asSingle()),new $(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet($.tabSize)}get lineBreak(){return this.facet($.lineSeparator)||`
@@ -1,4 +1,4 @@
1
- import{s as O,i as U,f as J,at as b,au as K,av as $,ag as z,aw as M,ax as q,j as t,ay as G,d as Y,az as H,aA as Q,aB as V,aC as W,h as X,aD as Z}from"./index-83ae2eb3.js";const ee="CREATE_PROJECT_BTN",te=O(U)(({theme:e})=>({marginLeft:e.spacing(3)})),ne=()=>{const{setToastData:e,setToastApiError:i}=J(),{refetchUser:d}=b(),{uiConfig:u}=K(),a=$(),{trackEvent:l}=z(),{projectId:o,projectName:m,projectMode:p,projectDesc:j,featureLimit:P,featureNamingPattern:g,featureNamingExample:C,featureNamingDescription:f,setFeatureNamingExample:h,setFeatureNamingPattern:E,setFeatureNamingDescription:T,setProjectId:N,setProjectName:A,setProjectDesc:y,getProjectPayload:s,clearErrors:r,validateProjectId:n,validateName:_,setProjectStickiness:S,setFeatureLimit:v,setProjectMode:k,projectStickiness:c,errors:I}=M(),{createProject:D,loading:F}=q();return t(G,{loading:F,title:"Create project",description:"Projects allows you to group feature toggles together in the management UI.",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:()=>`curl --location --request POST '${u.unleashUrl}/api/admin/projects' \\
1
+ import{s as O,i as U,f as J,at as b,au as K,av as $,ag as z,aw as M,ax as q,j as t,ay as G,d as Y,az as H,aA as Q,aB as V,aC as W,h as X,aD as Z}from"./index-9add17b9.js";const ee="CREATE_PROJECT_BTN",te=O(U)(({theme:e})=>({marginLeft:e.spacing(3)})),ne=()=>{const{setToastData:e,setToastApiError:i}=J(),{refetchUser:d}=b(),{uiConfig:u}=K(),a=$(),{trackEvent:l}=z(),{projectId:o,projectName:m,projectMode:p,projectDesc:j,featureLimit:P,featureNamingPattern:g,featureNamingExample:C,featureNamingDescription:f,setFeatureNamingExample:h,setFeatureNamingPattern:E,setFeatureNamingDescription:T,setProjectId:N,setProjectName:A,setProjectDesc:y,getProjectPayload:s,clearErrors:r,validateProjectId:n,validateName:_,setProjectStickiness:S,setFeatureLimit:v,setProjectMode:k,projectStickiness:c,errors:I}=M(),{createProject:D,loading:F}=q();return t(G,{loading:F,title:"Create project",description:"Projects allows you to group feature toggles together in the management UI.",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:()=>`curl --location --request POST '${u.unleashUrl}/api/admin/projects' \\
2
2
  --header 'Authorization: INSERT_API_KEY' \\
3
3
  --header 'Content-Type: application/json' \\
4
4
  --data-raw '${JSON.stringify(s(),void 0,2)}'`,children:Y(H,{errors:I,handleSubmit:async R=>{R.preventDefault(),r();const w=_(),x=await n();if(w&&x){const B=s();try{await D(B),d(),a(`/projects/${o}`),e({title:"Project created",text:"Now you can add toggles to this project",confetti:!0,type:"success"}),c!==W&&l("project_stickiness_set")}catch(L){i(X(L))}}},projectId:o,setProjectId:N,projectName:m,projectMode:p,projectStickiness:c,featureLimit:P,featureNamingExample:C,featureNamingPattern:g,setFeatureNamingPattern:E,featureNamingDescription:f,setFeatureNamingDescription:T,setFeatureNamingExample:h,setProjectStickiness:S,setFeatureLimit:v,setProjectMode:k,setProjectName:A,projectDesc:j,setProjectDesc:y,mode:"Create",clearErrors:r,validateProjectId:n,children:[t(Q,{name:"project",permission:V,"data-testid":ee}),t(te,{onClick:()=>{a(Z)},children:"Cancel"})]})})};export{ne as default};
@@ -1 +1 @@
1
- import{c as r,j as o}from"./index-83ae2eb3.js";const a=r(o("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-2h2v2zm0-4h-2V7h2v6z"}),"Error");export{a as E};
1
+ import{c as r,j as o}from"./index-9add17b9.js";const a=r(o("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-2h2v2zm0-4h-2V7h2v6z"}),"Error");export{a as E};
@@ -1,10 +1,10 @@
1
- import{c as de,j as o,b as ge,aE as j,aW as J,d as T,b7 as z,C as q,E as he,T as $,c8 as xe,s as L,fO as ke,bd as Re,fP as se,av as K,au as I,fQ as Fe,fR as Pe,fS as De,fT as $e,fU as qe,bu as M,fV as Oe,i as Be,fW as _e,cj as Le,fX as ae,r as C,ax as fe,f as Y,fY as pe,ag as ye,fZ as me,ay as be,aX as Se,bn as Ve,f_ as Ye,h as _,dn as Ue,aY as je,aV as re,aF as ne,a_ as Q,f$ as ze,g0 as He,g1 as Ge,g2 as We,g3 as Me,g4 as Je,a$ as ve,b8 as Ke,g5 as Ie,y as X,aJ as ce,B as Qe,ae as Xe,bT as oe,g6 as Ne,es as Ze,g7 as et,g8 as tt,g9 as at,ga as nt,ba as st,bb as rt,bc as ot,A as Ce,l as Te,bN as it,m as ct,o as lt,L as ut,gb as dt,n as gt,u as ht,bR as ft,aQ as pt,aO as yt,aP as mt,aK as bt,gc as we}from"./index-83ae2eb3.js";const St=de(o("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"}),"Cloud"),Qt=de(o("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater"),Xt=({enabled:e,className:a})=>{const t=ge(),s=e?"Environment enabled":"Environment disabled",n={backgroundColor:e?t.palette.primary.light:t.palette.neutral.border,borderRadius:"50%",width:"28px",height:"28px",minWidth:"28px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:t.spacing(1)},r={fill:t.palette.common.white,width:"16px",height:"16px"};return o("div",{style:n,className:a,children:o(St,{style:r,titleAccess:s})})},vt=({isOpen:e,onConfirm:a,onClose:t,showBanner:s,environment:n,messageComponent:r})=>{const i=j("projectId"),{data:c}=J(i),{changeRequestInReviewOrApproved:p,alert:h}=xe(c),l=p(n||"");return T(z,{open:e,primaryButtonText:l?"Add to existing change request":"Add suggestion to draft",secondaryButtonText:"Cancel",onClick:a,onClose:t,title:"Request changes",fullWidth:!0,children:[o(q,{condition:l,show:h}),o(q,{condition:!!s,show:T(he,{severity:"info",sx:{mb:2},children:["Change requests feature is enabled for ",n,". Your changes need 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."]})}),o($,{variant:"body2",color:"text.secondary",children:"Your suggestion:"}),r]})},Ct=(e,a)=>{const t={};return a.parameters.forEach(s=>{t[s.name]=Tt(e,s)}),{name:a.name,constraints:[],parameters:t}},Tt=(e,a)=>a.name==="rollout"||a.name==="percentage"||a.type==="percentage"?"50":a.name==="stickiness"?"":a.name==="groupId"?e:a.type==="boolean"?"false":"",wt=L("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),le=L("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),Et=L("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),At=({projectId:e,environmentId:a,permission:t,onSubmit:s,onCancel:n,loading:r,strategy:i,setStrategy:c,segments:p,setSegments:h,errors:l})=>{const y=ke(i.constraints),d=Re(t,e,a),{strategyDefinition:u}=se(i==null?void 0:i.name),w=K(),{uiConfig:f,error:g,loading:E}=I();if(g)throw g;if(E||!u)return null;const D=m=>u.parameters.find(S=>S.name===m),R=(m,S)=>{const F=D(m);if(m!=="groupId"){const k=_e(F,S);return k?(l.setFormError(m,k),!1):(l.removeFormError(m),!0)}return!0},x=()=>u.parameters.map(m=>m.name).map(m=>{var S;return R(m,(S=i.parameters)==null?void 0:S[m])}).every(Boolean),b=()=>{w(`/projects/${e}/settings/default-strategy`)};return T(wt,{onSubmit:async m=>{if(m.preventDefault(),x())s();else return},children:[o(Fe,{title:i.title||"",setTitle:m=>{c(S=>({...S,title:m}))}}),o(Pe,{segments:p,setSegments:h,projectId:e}),o(De,{projectId:e,environmentId:a,strategy:i,setStrategy:c}),o(le,{}),o($e,{strategy:i,strategyDefinition:u,setStrategy:c,validateParameter:R,errors:l,hasAccess:d}),o(q,{condition:i.parameters!=null&&"stickiness"in i.parameters,show:o(qe,{strategy:i,setStrategy:c,environment:a,projectId:e})}),o(le,{}),T(Et,{children:[o(M,{permission:t,projectId:e,environmentId:a,variant:"contained",color:"primary",type:"submit",disabled:r||!y||l.hasFormErrors(),"data-testid":Oe,children:"Save strategy"}),o(Be,{type:"button",color:"primary",onClick:n||b,disabled:r,children:"Cancel"})]})]})},Ee=(e,a)=>{var i;const{project:t,refetch:s}=Le(e),n={name:"flexibleRollout",constraints:[],parameters:{rollout:"100",stickiness:t.defaultStickiness||"default",groupId:""}},r=(i=t.environments.find(c=>c.environment===a))==null?void 0:i.defaultStrategy;return{defaultStrategyFallback:n,strategy:r,refetch:s}},Nt=()=>{const e=j("projectId"),a=ae("environmentId"),{defaultStrategyFallback:t,strategy:s,refetch:n}=Ee(e,a),[r,i]=C.useState(s||t),[c,p]=C.useState([]),{updateDefaultStrategy:h,loading:l}=fe(),{strategyDefinition:y}=se(r==null?void 0:r.name),{setToastData:d,setToastApiError:u}=Y(),w=pe(),{uiConfig:f}=I(),{unleashUrl:g}=f,E=K(),{trackEvent:D}=ye(),{segments:R,refetchSegments:x}=me();C.useEffect(()=>{if(R&&(s!=null&&s.segments)){const S=[];for(const F of s==null?void 0:s.segments)S.push(...R.filter(k=>k.id===F));p(S)}},[JSON.stringify(R),JSON.stringify(s==null?void 0:s.segments)]);const b=xt(r,c),O=async S=>{await h(e,a,S),D("default_strategy",{props:{action:"edit",hasTitle:!!S.title}}),await x(),d({title:"Default Strategy updated",type:"success",confetti:!0})},m=async()=>{const S=`/projects/${e}/settings/default-strategy`;try{await O(b),await n(),E(S)}catch(F){u(_(F))}};return!y||!r?null:o(be,{modal:!0,title:Se((r==null?void 0:r.name)??""),description:Rt,documentationLink:Ft,documentationLinkLabel:Pt,formatApiCode:()=>kt(e,a,b,y,g),children:o(At,{projectId:e,strategy:r,setStrategy:i,segments:c,setSegments:p,environmentId:a,onSubmit:m,loading:l,permission:Ve,errors:w,isChangeRequest:!1})})},xt=(e,a)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:a.map(t=>t.id),disabled:e.disabled??!1}),kt=(e,a,t,s,n)=>{if(!n)return"";const r={...t,parameters:Ye(t.parameters??{},s)},i=`${n}/api/admin/projects/${e}/environments/${a}/default-strategy}`,c=JSON.stringify(r,void 0,2);return`curl --location --request PUT '${i}' \\
1
+ import{c as de,j as o,b as ge,aE as j,aW as J,d as T,b7 as z,C as q,E as he,T as $,c8 as xe,s as L,fM as ke,bd as Re,fN as se,av as K,au as I,fO as Fe,fP as Pe,fQ as De,fR as $e,fS as qe,bu as M,fT as Oe,i as Be,fU as _e,cj as Le,fV as ae,r as C,ax as fe,f as Y,fW as pe,ag as ye,fX as me,ay as be,aX as Se,bn as Ve,fY as Ye,h as _,dn as Ue,aY as je,aV as re,aF as ne,a_ as Q,fZ as ze,f_ as He,f$ as Ge,g0 as We,g1 as Me,g2 as Je,a$ as ve,b8 as Ke,g3 as Ie,y as N,aJ as ce,B as Qe,ae as Ne,bT as oe,g4 as Xe,es as Ze,g5 as et,g6 as tt,g7 as at,g8 as nt,ba as st,bb as rt,bc as ot,A as Ce,l as Te,bN as it,m as ct,o as lt,L as ut,g9 as dt,n as gt,u as ht,bR as ft,aQ as pt,aO as yt,aP as mt,aK as bt,ga as we}from"./index-9add17b9.js";const St=de(o("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"}),"Cloud"),Qt=de(o("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater"),Nt=({enabled:e,className:a})=>{const t=ge(),s=e?"Environment enabled":"Environment disabled",n={backgroundColor:e?t.palette.primary.light:t.palette.neutral.border,borderRadius:"50%",width:"28px",height:"28px",minWidth:"28px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:t.spacing(1)},r={fill:t.palette.common.white,width:"16px",height:"16px"};return o("div",{style:n,className:a,children:o(St,{style:r,titleAccess:s})})},vt=({isOpen:e,onConfirm:a,onClose:t,showBanner:s,environment:n,messageComponent:r})=>{const i=j("projectId"),{data:c}=J(i),{changeRequestInReviewOrApproved:p,alert:h}=xe(c),l=p(n||"");return T(z,{open:e,primaryButtonText:l?"Add to existing change request":"Add suggestion to draft",secondaryButtonText:"Cancel",onClick:a,onClose:t,title:"Request changes",fullWidth:!0,children:[o(q,{condition:l,show:h}),o(q,{condition:!!s,show:T(he,{severity:"info",sx:{mb:2},children:["Change requests feature is enabled for ",n,". Your changes need 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."]})}),o($,{variant:"body2",color:"text.secondary",children:"Your suggestion:"}),r]})},Ct=(e,a)=>{const t={};return a.parameters.forEach(s=>{t[s.name]=Tt(e,s)}),{name:a.name,constraints:[],parameters:t}},Tt=(e,a)=>a.name==="rollout"||a.name==="percentage"||a.type==="percentage"?"50":a.name==="stickiness"?"":a.name==="groupId"?e:a.type==="boolean"?"false":"",wt=L("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),le=L("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),Et=L("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),At=({projectId:e,environmentId:a,permission:t,onSubmit:s,onCancel:n,loading:r,strategy:i,setStrategy:c,segments:p,setSegments:h,errors:l})=>{const y=ke(i.constraints),d=Re(t,e,a),{strategyDefinition:u}=se(i==null?void 0:i.name),w=K(),{uiConfig:f,error:g,loading:E}=I();if(g)throw g;if(E||!u)return null;const D=m=>u.parameters.find(S=>S.name===m),R=(m,S)=>{const F=D(m);if(m!=="groupId"){const k=_e(F,S);return k?(l.setFormError(m,k),!1):(l.removeFormError(m),!0)}return!0},x=()=>u.parameters.map(m=>m.name).map(m=>{var S;return R(m,(S=i.parameters)==null?void 0:S[m])}).every(Boolean),b=()=>{w(`/projects/${e}/settings/default-strategy`)};return T(wt,{onSubmit:async m=>{if(m.preventDefault(),x())s();else return},children:[o(Fe,{title:i.title||"",setTitle:m=>{c(S=>({...S,title:m}))}}),o(Pe,{segments:p,setSegments:h,projectId:e}),o(De,{projectId:e,environmentId:a,strategy:i,setStrategy:c}),o(le,{}),o($e,{strategy:i,strategyDefinition:u,setStrategy:c,validateParameter:R,errors:l,hasAccess:d}),o(q,{condition:i.parameters!=null&&"stickiness"in i.parameters,show:o(qe,{strategy:i,setStrategy:c,environment:a,projectId:e})}),o(le,{}),T(Et,{children:[o(M,{permission:t,projectId:e,environmentId:a,variant:"contained",color:"primary",type:"submit",disabled:r||!y||l.hasFormErrors(),"data-testid":Oe,children:"Save strategy"}),o(Be,{type:"button",color:"primary",onClick:n||b,disabled:r,children:"Cancel"})]})]})},Ee=(e,a)=>{var i;const{project:t,refetch:s}=Le(e),n={name:"flexibleRollout",constraints:[],parameters:{rollout:"100",stickiness:t.defaultStickiness||"default",groupId:""}},r=(i=t.environments.find(c=>c.environment===a))==null?void 0:i.defaultStrategy;return{defaultStrategyFallback:n,strategy:r,refetch:s}},Xt=()=>{const e=j("projectId"),a=ae("environmentId"),{defaultStrategyFallback:t,strategy:s,refetch:n}=Ee(e,a),[r,i]=C.useState(s||t),[c,p]=C.useState([]),{updateDefaultStrategy:h,loading:l}=fe(),{strategyDefinition:y}=se(r==null?void 0:r.name),{setToastData:d,setToastApiError:u}=Y(),w=pe(),{uiConfig:f}=I(),{unleashUrl:g}=f,E=K(),{trackEvent:D}=ye(),{segments:R,refetchSegments:x}=me();C.useEffect(()=>{if(R&&(s!=null&&s.segments)){const S=[];for(const F of s==null?void 0:s.segments)S.push(...R.filter(k=>k.id===F));p(S)}},[JSON.stringify(R),JSON.stringify(s==null?void 0:s.segments)]);const b=xt(r,c),O=async S=>{await h(e,a,S),D("default_strategy",{props:{action:"edit",hasTitle:!!S.title}}),await x(),d({title:"Default Strategy updated",type:"success",confetti:!0})},m=async()=>{const S=`/projects/${e}/settings/default-strategy`;try{await O(b),await n(),E(S)}catch(F){u(_(F))}};return!y||!r?null:o(be,{modal:!0,title:Se((r==null?void 0:r.name)??""),description:Rt,documentationLink:Ft,documentationLinkLabel:Pt,formatApiCode:()=>kt(e,a,b,y,g),children:o(At,{projectId:e,strategy:r,setStrategy:i,segments:c,setSegments:p,environmentId:a,onSubmit:m,loading:l,permission:Ve,errors:w,isChangeRequest:!1})})},xt=(e,a)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:a.map(t=>t.id),disabled:e.disabled??!1}),kt=(e,a,t,s,n)=>{if(!n)return"";const r={...t,parameters:Ye(t.parameters??{},s)},i=`${n}/api/admin/projects/${e}/environments/${a}/default-strategy}`,c=JSON.stringify(r,void 0,2);return`curl --location --request PUT '${i}' \\
2
2
  --header 'Authorization: INSERT_API_KEY' \\
3
3
  --header 'Content-Type: application/json' \\
4
4
  --data-raw '${c}'`},Rt=`
5
5
  An activation strategy will only run when a feature toggle is enabled and provides a way to control who will get access to the feature.
6
6
  If any of a feature toggle's activation strategies returns true, the user will get access.
7
- `,Ft="https://docs.getunleash.io/reference/activation-strategies",Pt="Default strategy documentation",Zt=()=>{const e=j("projectId"),a=j("featureId"),t=ae("environmentId"),s=ae("strategyName"),{strategy:n,defaultStrategyFallback:r}=Ee(e,t),i=JSON.parse(Ue().get("defaultStrategy")||"false"),{segments:c}=me(),p=(c||[]).filter(A=>{var P;return(P=n==null?void 0:n.segments)==null?void 0:P.includes(A.id)}),[h,l]=C.useState({}),[y,d]=C.useState(i?p:[]),{strategyDefinition:u}=se(s),w=pe(),{addStrategyToFeature:f,loading:g}=je(),{addChange:E}=re(),{setToastData:D,setToastApiError:R}=Y(),{uiConfig:x}=I(),{unleashUrl:b}=x,O=K(),{feature:m,refetchFeature:S}=ne(e,a),F=C.useRef(m),{isChangeRequestConfigured:k}=Q(e),{refetch:N}=J(e),{trackEvent:H}=ye(),{data:U,staleDataNotification:Z,forceRefreshCache:ee}=ze({unleashGetter:ne,params:[e,a],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},m,{afterSubmitAction:S},Ie);C.useEffect(()=>{F.current.name===""&&m.name&&(ee(m),F.current=m)},[m.name]),C.useEffect(()=>{var A;if(i){const P=n||r;((A=P.parameters)==null?void 0:A.groupId)===""&&a?l({...P,parameters:{...P.parameters,groupId:a}}):l(P)}else u&&l(Ct(a,u))},[a,JSON.stringify(u),i]);const G=async A=>{await f(e,a,t,A),D({title:"Strategy created",type:"success",confetti:!0})},W=async A=>{await E(e,t,{action:"addStrategy",feature:a,payload:A}),D({title:"Strategy added to draft",type:"success",confetti:!0}),N()},V=He(h,y),v=async()=>{H("strategyTitle",{props:{hasTitle:!!h.title,on:"create"}});try{k(t)?await W(V):await G(V),S(),O(Ke(e,a))}catch(A){R(_(A))}};return!U||!U.project?null:T(be,{modal:!0,title:Se(s),description:Ge,documentationLink:We,documentationLinkLabel:Me,formatApiCode:()=>$t(e,a,t,V,b),children:[o(Je,{projectId:e,feature:U,strategy:h,setStrategy:l,segments:y,setSegments:d,environmentId:t,onSubmit:v,loading:g,permission:ve,errors:w,isChangeRequest:k(t)}),Z]})},Dt=(e,a,t,s,n=!1)=>{const r=new URLSearchParams({environmentId:t,strategyName:s,defaultStrategy:String(n)});return`/projects/${e}/features/${a}/strategies/create?${r}`},$t=(e,a,t,s,n)=>{if(!n)return"";const r=`${n}/api/admin/projects/${e}/features/${a}/environments/${t}/strategies`,i=JSON.stringify(s,void 0,2);return`curl --location --request POST '${r}' \\
7
+ `,Ft="https://docs.getunleash.io/reference/activation-strategies",Pt="Default strategy documentation",Zt=()=>{const e=j("projectId"),a=j("featureId"),t=ae("environmentId"),s=ae("strategyName"),{strategy:n,defaultStrategyFallback:r}=Ee(e,t),i=JSON.parse(Ue().get("defaultStrategy")||"false"),{segments:c}=me(),p=(c||[]).filter(A=>{var P;return(P=n==null?void 0:n.segments)==null?void 0:P.includes(A.id)}),[h,l]=C.useState({}),[y,d]=C.useState(i?p:[]),{strategyDefinition:u}=se(s),w=pe(),{addStrategyToFeature:f,loading:g}=je(),{addChange:E}=re(),{setToastData:D,setToastApiError:R}=Y(),{uiConfig:x}=I(),{unleashUrl:b}=x,O=K(),{feature:m,refetchFeature:S}=ne(e,a),F=C.useRef(m),{isChangeRequestConfigured:k}=Q(e),{refetch:X}=J(e),{trackEvent:H}=ye(),{data:U,staleDataNotification:Z,forceRefreshCache:ee}=ze({unleashGetter:ne,params:[e,a],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},m,{afterSubmitAction:S},Ie);C.useEffect(()=>{F.current.name===""&&m.name&&(ee(m),F.current=m)},[m.name]),C.useEffect(()=>{var A;if(i){const P=n||r;((A=P.parameters)==null?void 0:A.groupId)===""&&a?l({...P,parameters:{...P.parameters,groupId:a}}):l(P)}else u&&l(Ct(a,u))},[a,JSON.stringify(u),i]);const G=async A=>{await f(e,a,t,A),D({title:"Strategy created",type:"success",confetti:!0})},W=async A=>{await E(e,t,{action:"addStrategy",feature:a,payload:A}),D({title:"Strategy added to draft",type:"success",confetti:!0}),X()},V=He(h,y),v=async()=>{H("strategyTitle",{props:{hasTitle:!!h.title,on:"create"}});try{k(t)?await W(V):await G(V),S(),O(Ke(e,a))}catch(A){R(_(A))}};return!U||!U.project?null:T(be,{modal:!0,title:Se(s),description:Ge,documentationLink:We,documentationLinkLabel:Me,formatApiCode:()=>$t(e,a,t,V,b),children:[o(Je,{projectId:e,feature:U,strategy:h,setStrategy:l,segments:y,setSegments:d,environmentId:t,onSubmit:v,loading:g,permission:ve,errors:w,isChangeRequest:k(t)}),Z]})},Dt=(e,a,t,s,n=!1)=>{const r=new URLSearchParams({environmentId:t,strategyName:s,defaultStrategy:String(n)});return`/projects/${e}/features/${a}/strategies/create?${r}`},$t=(e,a,t,s,n)=>{if(!n)return"";const r=`${n}/api/admin/projects/${e}/features/${a}/environments/${t}/strategies`,i=JSON.stringify(s,void 0,2);return`curl --location --request POST '${r}' \\
8
8
  --header 'Authorization: INSERT_API_KEY' \\
9
9
  --header 'Content-Type: application/json' \\
10
- --data-raw '${i}'`},ue=L("p")(({theme:e})=>({marginBottom:e.spacing(.5),fontSize:e.fontSizes.bodySize})),ea=({open:e,environmentName:a,featureId:t,projectId:s,onClose:n})=>{const r=K(),i=Dt(s,t,a,"default");return T(z,{open:e,maxWidth:"sm",onClose:()=>n(),title:"You need to add a strategy to your toggle",primaryButtonText:"Take me directly to add strategy",permissionButton:o(M,{type:"button",permission:ve,projectId:s,environmentId:a,onClick:()=>{n(),r(i)},children:"Take me directly to add strategy"}),secondaryButtonText:"Cancel",children:[o(ue,{children:"Before you can enable the toggle in the environment, you need to add an activation strategy."}),o(ue,{children:"You can add the activation strategy by selecting the toggle, open the environment accordion and add the activation strategy."})]})},qt=e=>{const[a,t]=C.useState(e),s=C.useCallback(()=>t(e),[e]);return C.useEffect(()=>{t(e)},[e]),[a,t,s]},Ot="You can not enable the environment before it has strategies",Bt=e=>{const{setToastData:a,setToastApiError:t}=Y(),{addChange:s}=re(),{refetch:n}=J(e),[r,i]=C.useState({isOpen:!1}),c=C.useCallback((l,y,d,u)=>{i({featureName:l,environment:y,enabled:d,shouldActivateDisabledStrategies:u,isOpen:!0})},[]),p=C.useCallback(()=>{i(l=>({...l,isOpen:!1}))},[]),h=C.useCallback(async()=>{try{await s(e,r.environment,{feature:r.featureName,action:"updateEnabled",payload:{enabled:!!r.enabled,shouldActivateDisabledStrategies:!!r.shouldActivateDisabledStrategies}}),n(),i(l=>({...l,isOpen:!1})),a({type:"success",title:"Changes added to the draft!"})}catch(l){t(_(l)),i(y=>({...y,isOpen:!1}))}},[s]);return{onChangeRequestToggle:c,onChangeRequestToggleClose:p,onChangeRequestToggleConfirm:h,changeRequestDialogDetails:r}},_t=({isOpen:e,onAddDefaultStrategy:a,onActivateDisabledStrategies:t,onClose:s,environment:n,disabledStrategiesCount:r=0})=>{const i=j("projectId");return T(z,{open:e,secondaryButtonText:"Cancel",permissionButton:T(X,{children:[o(M,{type:"button",permission:ce,projectId:i,environmentId:n,onClick:a,children:"Add default strategy"}),o(M,{type:"button",variant:"text",permission:ce,projectId:i,environmentId:n,onClick:t,children:"Enable all strategies"})]}),onClose:s,title:"Enable feature toggle",fullWidth:!0,children:[T($,{variant:"body1",color:"text.primary",sx:{mb:c=>c.spacing(2)},children:["The feature toggle has ",r," disabled",r===1?" strategy":" strategies","."]}),o($,{variant:"body1",color:"text.primary",children:"You can choose to enable all the disabled strategies or you can add the default strategy to enable this feature toggle."})]})},Lt=({enabled:e,featureName:a,environment:t})=>T($,{"data-testid":"update-enabled-message",children:[o("strong",{children:e?"Enable":"Disable"})," feature toggle"," ",o("strong",{children:a})," in ",o("strong",{children:t})]}),Vt=L(Qe)(()=>({mx:"auto",...Xe})),ta=({projectId:e,featureId:a,environmentName:t,value:s,onToggle:n,onError:r})=>{var V;const{loading:i,toggleFeatureEnvironmentOn:c,toggleFeatureEnvironmentOff:p}=oe(),{setToastData:h,setToastApiError:l}=Y(),{isChangeRequestConfigured:y}=Q(e),{onChangeRequestToggle:d,onChangeRequestToggleClose:u,onChangeRequestToggleConfirm:w,changeRequestDialogDetails:f}=Bt(e),[g,E,D]=qt(s),[R,x]=C.useState(!1),{feature:b}=ne(e,a),O=Ne(b,t),[m,S]=C.useState(!1),F=((V=b==null?void 0:b.environments.find(v=>v.name===t))==null?void 0:V.strategies.filter(v=>v.disabled).length)??0,k=async(v=!1)=>{try{E(!g),await c(e,b.name,t,v),h({type:"success",title:`Available in ${t}`,text:`${b.name} is now available in ${t} based on its defined strategies.`}),n==null||n(e,b.name,t,!g)}catch(B){B instanceof Error&&B.message===Ot?r==null||r():l(_(B)),D()}},N=async()=>{try{E(!g),await p(e,b.name,t),h({type:"success",title:`Unavailable in ${t}`,text:`${b.name} is unavailable in ${t} and its strategies will no longer have any effect.`}),n==null||n(e,b.name,t,!g)}catch(v){l(_(v)),D()}},H=async()=>{if(S(!1),y(t)){G()?x(!0):d(b.name,t,!g,!1);return}if(g){await N();return}G()?x(!0):await k()},U=async()=>{console.log("*********"),console.log(O),console.log(y(t)),console.log("*********"),O&&!y(t)?S(!0):await H()},Z=async()=>{y(t)?d(b.name,t,!g,!0):await k(!0),x(!1)},ee=async()=>{y(t)?d(b.name,t,!g,!1):await k(),x(!1)},G=()=>{var B,A,P;const v=(B=b==null?void 0:b.environments)==null?void 0:B.find(te=>te.name===t);return(v==null?void 0:v.strategies)&&((A=v==null?void 0:v.strategies)==null?void 0:A.length)>0&&((P=v==null?void 0:v.strategies)==null?void 0:P.every(te=>te.disabled))},W=`${b.name}-${t}`;return T(X,{children:[o(Vt,{"data-testid":`TOGGLE-${W}`,children:o(Ze,{tooltip:g?`Disable feature in ${t}`:`Enable feature in ${t}`,checked:g,environmentId:t,projectId:e,permission:et,inputProps:{"aria-label":t},onClick:U,"data-testid":"permission-switch"})},W),o(_t,{isOpen:R,onClose:()=>x(!1),environment:t,disabledStrategiesCount:F,onActivateDisabledStrategies:Z,onAddDefaultStrategy:ee}),o(vt,{isOpen:f.isOpen,onClose:u,environment:f==null?void 0:f.environment,onConfirm:w,messageComponent:o(Lt,{enabled:f==null?void 0:f.enabled,featureName:f==null?void 0:f.featureName,environment:f.environment})}),o(tt,{open:m,onClose:()=>S(!1),onClick:H,loading:i,label:`${g?"Disable":"Enable"} Environment`})]})},Yt=L(at)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.bodySize})),aa=()=>o(nt,{arrow:!0,title:T(X,{children:["This environment has no variants enabled. If you check this feature's variants in this environment, you will get the"," ",o("a",{href:"https://docs.getunleash.io/reference/feature-toggle-variants#the-disabled-variant",target:"_blank",rel:"noreferrer",children:"disabled variant"}),"."]}),children:o(Yt,{})});var ie={},Ut=rt;Object.defineProperty(ie,"__esModule",{value:!0});var Ae=ie.default=void 0,jt=Ut(st()),zt=ot,Ht=(0,jt.default)((0,zt.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");Ae=ie.default=Ht;const Gt=dt(),na=({options:e,selectedOptions:a,indeterminateOptions:t,tagType:s,existingTags:n,disabled:r=!1,onChange:i})=>{const c=o(gt,{fontSize:"small"});return o(Ce,{multiple:!0,id:"checkboxes-tag",sx:{marginTop:d=>d.spacing(2),width:500},disableCloseOnSelect:!0,placeholder:"Select Values",options:e,value:a,renderTags:(d,u)=>d.map((w,f)=>n.some(E=>E.value===w.title&&E.type===s.name)&&t===void 0?null:o(ut,{...u({index:f}),label:w.title})),isOptionEqualToValue:(d,u)=>u.inputValue&&u.inputValue!==""?d.title===u.inputValue:d.title===u.title,getOptionLabel:d=>d.inputValue?d.inputValue:d.title,renderOption:(d,u,{selected:w})=>{const f=(t==null?void 0:t.some(g=>g.title===u.title))??!1;return T("li",{...d,children:[o(q,{condition:!!u.inputValue,show:o(it,{sx:{mr:g=>g.spacing(.5)}}),elseShow:o(ct,{icon:c,checkedIcon:o(lt,{fontSize:"small"}),indeterminateIcon:o(Ae,{fontSize:"small"}),sx:{mr:g=>g.spacing(.5)},checked:w&&!f,indeterminate:f})}),u.title]})},filterOptions:(d,u)=>{const w=Gt(d,u),{inputValue:f}=u,g=d.some(E=>f===E.title);return f!==""&&!g&&w.push({inputValue:f,title:`Create new value "${f}"`}),w},ListboxProps:{style:{maxHeight:200,overflow:"auto"}},onChange:i,renderInput:d=>o(Te,{...d,label:"Select values",placeholder:"Select values"}),disabled:r})},Wt=L("li")({flexDirection:"column"}),sa=({options:e,value:a,disabled:t=!1,onChange:s})=>{const n=ge();return o(Ce,{disablePortal:!0,disabled:t,id:"tag-type-select",sx:{marginTop:r=>r.spacing(2),width:500},options:e,disableClearable:!0,value:a,getOptionLabel:r=>r.name,renderOption:(r,i)=>T(Wt,{...r,style:{alignItems:"flex-start",gap:n.spacing(.5)},children:[o($,{variant:"body1",children:i.name}),o($,{variant:"caption",children:i.description})]}),renderInput:r=>o(Te,{...r,label:"Tag type",value:a}),onChange:s,ListboxProps:{style:{maxHeight:200,overflow:"auto"}}})},ra=()=>{const{makeRequest:e,createRequest:a,errors:t,loading:s}=ht({propagateErrors:!0});return{createTag:async i=>{const p=a("api/admin/tags",{method:"POST",body:JSON.stringify(i)});try{return await e(p.caller,p.id)}catch(h){throw h}},bulkUpdateTags:async(i,c)=>{const p=`api/admin/projects/${c}/tags`,h=a(p,{method:"PUT",body:JSON.stringify(i)});try{return await e(h.caller,h.id)}catch(l){throw l}},errors:t,loading:s}},oa=(e,a={})=>{const t=async()=>{const h=yt(`api/admin/tags/${e}`);return(await fetch(h,{method:"GET"}).then(mt("Tags"))).json()},s=`api/admin/tags/${e}`,{data:n,error:r}=ft(!!e,{tags:[]},s,t,a),[i,c]=C.useState(!r&&!n),p=()=>{pt(s)};return C.useEffect(()=>{c(!r&&!n)},[n,r]),{tags:(n==null?void 0:n.tags)||[],error:r,loading:i,refetch:p}},ia=({isStale:e,isOpen:a,projectId:t,featureId:s,onClose:n})=>{const{setToastData:r,setToastApiError:i}=Y(),{patchFeatureToggle:c}=oe(),p=o($,{children:"Setting a toggle to stale marks it for cleanup"}),h=o($,{children:"Setting a toggle to active marks it as in active use"}),l=e?"active":"stale",y=async d=>{d.stopPropagation();try{await c(t,s,[{op:"replace",path:"/stale",value:!e}]),n()}catch(u){i(_(u))}r(e?{type:"success",title:"And we're back!",text:"The toggle is no longer marked as stale."}:{type:"success",title:"A job well done.",text:"The toggle has been marked as stale."})};return o(z,{open:a,secondaryButtonText:"Cancel",primaryButtonText:`Flip to ${l}`,title:`Set feature state to ${l}`,onClick:y,onClose:n,children:o(q,{condition:e,show:h,elseShow:p})})},Mt=({ids:e,projectId:a})=>{const t=s=>`/projects/${a}/features/${s}`;return e?T(he,{severity:"warning",sx:{m:s=>s.spacing(2,0)},children:[o($,{fontWeight:"bold",variant:"body2",display:"inline",children:`${e.length} feature toggles `}),o("span",{children:"have usage from applications. If you archive these feature toggles they will not be available to Client SDKs:"}),o("ul",{children:e==null?void 0:e.map(s=>o("li",{children:o(bt,{to:t(s),children:s})},s))})]}):null},Jt=(e,a)=>{const s=we(e)(),{isChangeRequestConfigured:n}=Q(e);return s&&n(s)&&a?"Add to change request":s&&n(s)?"Add change to draft":a?"Archive toggles":"Archive toggle"},Kt=({projectId:e,featureIds:a,onSuccess:t,onError:s})=>{const{setToastData:n,setToastApiError:r}=Y(),{archiveFeatureToggle:i}=oe(),{archiveFeatures:c}=fe(),{isChangeRequestConfigured:p}=Q(e),{addChange:h}=re(),{refetch:l}=J(e),y=we(e),d=(a==null?void 0:a.length)>1,u=y(),w=async()=>{if(!u){console.error("No change request environment");return}await h(e,u,a.map(E=>({action:"archiveFeature",feature:E,payload:void 0}))),l(),n({text:d?"Your archive feature toggles changes have been added to change request":"Your archive feature toggle change has been added to change request",type:"success",title:d?"Changes added to a draft":"Change added to a draft"})},f=async()=>{await i(e,a[0]),n({text:"Your feature toggle has been archived",type:"success",title:"Feature archived"})},g=async()=>{await c(e,a),n({text:"Selected feature toggles have been archived",type:"success",title:"Features archived"})};return async()=>{try{u&&p(u)?await w():d?await g():await f(),t()}catch(E){r(_(E)),s()}}},ca=({isOpen:e,onClose:a,onConfirm:t,projectId:s,featureIds:n,featuresWithUsage:r})=>{const{uiConfig:i}=I(),c=(n==null?void 0:n.length)>1,p=Jt(s,c),h=c?"Archive feature toggles":"Archive feature toggle",l=Kt({projectId:s,featureIds:n,onSuccess(){t(),a()},onError(){a()}});return o(z,{onClick:l,open:e,onClose:a,primaryButtonText:p,secondaryButtonText:"Cancel",title:h,children:o(q,{condition:c,show:T(X,{children:[T("p",{children:["Are you sure you want to archive"," ",o("strong",{children:n==null?void 0:n.length})," feature toggles?"]}),o(q,{condition:!!(i.flags.lastSeenByEnvironment&&r&&(r==null?void 0:r.length)>0),show:o(Mt,{ids:r,projectId:s})}),o(q,{condition:(n==null?void 0:n.length)<=5,show:o("ul",{children:n==null?void 0:n.map(y=>o("li",{children:y},y))})})]}),elseShow:T("p",{children:["Are you sure you want to archive"," ",c?"these feature toggles":"this feature toggle","?"]})})})};export{vt as C,Xt as E,ta as F,sa as T,Lt as U,aa as V,Qt as W,ea as a,oa as b,na as c,Zt as d,ca as e,Dt as f,ia as g,Bt as h,Nt as i,ra as u};
10
+ --data-raw '${i}'`},ue=L("p")(({theme:e})=>({marginBottom:e.spacing(.5),fontSize:e.fontSizes.bodySize})),ea=({open:e,environmentName:a,featureId:t,projectId:s,onClose:n})=>{const r=K(),i=Dt(s,t,a,"default");return T(z,{open:e,maxWidth:"sm",onClose:()=>n(),title:"You need to add a strategy to your toggle",primaryButtonText:"Take me directly to add strategy",permissionButton:o(M,{type:"button",permission:ve,projectId:s,environmentId:a,onClick:()=>{n(),r(i)},children:"Take me directly to add strategy"}),secondaryButtonText:"Cancel",children:[o(ue,{children:"Before you can enable the toggle in the environment, you need to add an activation strategy."}),o(ue,{children:"You can add the activation strategy by selecting the toggle, open the environment accordion and add the activation strategy."})]})},qt=e=>{const[a,t]=C.useState(e),s=C.useCallback(()=>t(e),[e]);return C.useEffect(()=>{t(e)},[e]),[a,t,s]},Ot="You can not enable the environment before it has strategies",Bt=e=>{const{setToastData:a,setToastApiError:t}=Y(),{addChange:s}=re(),{refetch:n}=J(e),[r,i]=C.useState({isOpen:!1}),c=C.useCallback((l,y,d,u)=>{i({featureName:l,environment:y,enabled:d,shouldActivateDisabledStrategies:u,isOpen:!0})},[]),p=C.useCallback(()=>{i(l=>({...l,isOpen:!1}))},[]),h=C.useCallback(async()=>{try{await s(e,r.environment,{feature:r.featureName,action:"updateEnabled",payload:{enabled:!!r.enabled,shouldActivateDisabledStrategies:!!r.shouldActivateDisabledStrategies}}),n(),i(l=>({...l,isOpen:!1})),a({type:"success",title:"Changes added to the draft!"})}catch(l){t(_(l)),i(y=>({...y,isOpen:!1}))}},[s]);return{onChangeRequestToggle:c,onChangeRequestToggleClose:p,onChangeRequestToggleConfirm:h,changeRequestDialogDetails:r}},_t=({isOpen:e,onAddDefaultStrategy:a,onActivateDisabledStrategies:t,onClose:s,environment:n,disabledStrategiesCount:r=0})=>{const i=j("projectId");return T(z,{open:e,secondaryButtonText:"Cancel",permissionButton:T(N,{children:[o(M,{type:"button",permission:ce,projectId:i,environmentId:n,onClick:a,children:"Add default strategy"}),o(M,{type:"button",variant:"text",permission:ce,projectId:i,environmentId:n,onClick:t,children:"Enable all strategies"})]}),onClose:s,title:"Enable feature toggle",fullWidth:!0,children:[T($,{variant:"body1",color:"text.primary",sx:{mb:c=>c.spacing(2)},children:["The feature toggle has ",r," disabled",r===1?" strategy":" strategies","."]}),o($,{variant:"body1",color:"text.primary",children:"You can choose to enable all the disabled strategies or you can add the default strategy to enable this feature toggle."})]})},Lt=({enabled:e,featureName:a,environment:t})=>T($,{"data-testid":"update-enabled-message",children:[o("strong",{children:e?"Enable":"Disable"})," feature toggle"," ",o("strong",{children:a})," in ",o("strong",{children:t})]}),Vt=L(Qe)(()=>({mx:"auto",...Ne})),ta=({projectId:e,featureId:a,environmentName:t,value:s,onToggle:n,onError:r})=>{var V;const{loading:i,toggleFeatureEnvironmentOn:c,toggleFeatureEnvironmentOff:p}=oe(),{setToastData:h,setToastApiError:l}=Y(),{isChangeRequestConfigured:y}=Q(e),{onChangeRequestToggle:d,onChangeRequestToggleClose:u,onChangeRequestToggleConfirm:w,changeRequestDialogDetails:f}=Bt(e),[g,E,D]=qt(s),[R,x]=C.useState(!1),{feature:b}=ne(e,a),O=Xe(b,t),[m,S]=C.useState(!1),F=((V=b==null?void 0:b.environments.find(v=>v.name===t))==null?void 0:V.strategies.filter(v=>v.disabled).length)??0,k=async(v=!1)=>{try{E(!g),await c(e,b.name,t,v),h({type:"success",title:`Available in ${t}`,text:`${b.name} is now available in ${t} based on its defined strategies.`}),n==null||n(e,b.name,t,!g)}catch(B){B instanceof Error&&B.message===Ot?r==null||r():l(_(B)),D()}},X=async()=>{try{E(!g),await p(e,b.name,t),h({type:"success",title:`Unavailable in ${t}`,text:`${b.name} is unavailable in ${t} and its strategies will no longer have any effect.`}),n==null||n(e,b.name,t,!g)}catch(v){l(_(v)),D()}},H=async()=>{if(S(!1),y(t)){G()?x(!0):d(b.name,t,!g,!1);return}if(g){await X();return}G()?x(!0):await k()},U=async()=>{console.log("*********"),console.log(O),console.log(y(t)),console.log("*********"),O&&!y(t)?S(!0):await H()},Z=async()=>{y(t)?d(b.name,t,!g,!0):await k(!0),x(!1)},ee=async()=>{y(t)?d(b.name,t,!g,!1):await k(),x(!1)},G=()=>{var B,A,P;const v=(B=b==null?void 0:b.environments)==null?void 0:B.find(te=>te.name===t);return(v==null?void 0:v.strategies)&&((A=v==null?void 0:v.strategies)==null?void 0:A.length)>0&&((P=v==null?void 0:v.strategies)==null?void 0:P.every(te=>te.disabled))},W=`${b.name}-${t}`;return T(N,{children:[o(Vt,{"data-testid":`TOGGLE-${W}`,children:o(Ze,{tooltip:g?`Disable feature in ${t}`:`Enable feature in ${t}`,checked:g,environmentId:t,projectId:e,permission:et,inputProps:{"aria-label":t},onClick:U,"data-testid":"permission-switch"})},W),o(_t,{isOpen:R,onClose:()=>x(!1),environment:t,disabledStrategiesCount:F,onActivateDisabledStrategies:Z,onAddDefaultStrategy:ee}),o(vt,{isOpen:f.isOpen,onClose:u,environment:f==null?void 0:f.environment,onConfirm:w,messageComponent:o(Lt,{enabled:f==null?void 0:f.enabled,featureName:f==null?void 0:f.featureName,environment:f.environment})}),o(tt,{open:m,onClose:()=>S(!1),onClick:H,loading:i,label:`${g?"Disable":"Enable"} Environment`})]})},Yt=L(at)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.bodySize})),aa=()=>o(nt,{arrow:!0,title:T(N,{children:["This environment has no variants enabled. If you check this feature's variants in this environment, you will get the"," ",o("a",{href:"https://docs.getunleash.io/reference/feature-toggle-variants#the-disabled-variant",target:"_blank",rel:"noreferrer",children:"disabled variant"}),"."]}),children:o(Yt,{})});var ie={},Ut=rt;Object.defineProperty(ie,"__esModule",{value:!0});var Ae=ie.default=void 0,jt=Ut(st()),zt=ot,Ht=(0,jt.default)((0,zt.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");Ae=ie.default=Ht;const Gt=dt(),na=({options:e,selectedOptions:a,indeterminateOptions:t,tagType:s,existingTags:n,disabled:r=!1,onChange:i})=>{const c=o(gt,{fontSize:"small"});return o(Ce,{multiple:!0,id:"checkboxes-tag",sx:{marginTop:d=>d.spacing(2),width:500},disableCloseOnSelect:!0,placeholder:"Select Values",options:e,value:a,renderTags:(d,u)=>d.map((w,f)=>n.some(E=>E.value===w.title&&E.type===s.name)&&t===void 0?null:o(ut,{...u({index:f}),label:w.title})),isOptionEqualToValue:(d,u)=>u.inputValue&&u.inputValue!==""?d.title===u.inputValue:d.title===u.title,getOptionLabel:d=>d.inputValue?d.inputValue:d.title,renderOption:(d,u,{selected:w})=>{const f=(t==null?void 0:t.some(g=>g.title===u.title))??!1;return T("li",{...d,children:[o(q,{condition:!!u.inputValue,show:o(it,{sx:{mr:g=>g.spacing(.5)}}),elseShow:o(ct,{icon:c,checkedIcon:o(lt,{fontSize:"small"}),indeterminateIcon:o(Ae,{fontSize:"small"}),sx:{mr:g=>g.spacing(.5)},checked:w&&!f,indeterminate:f})}),u.title]})},filterOptions:(d,u)=>{const w=Gt(d,u),{inputValue:f}=u,g=d.some(E=>f===E.title);return f!==""&&!g&&w.push({inputValue:f,title:`Create new value "${f}"`}),w},ListboxProps:{style:{maxHeight:200,overflow:"auto"}},onChange:i,renderInput:d=>o(Te,{...d,label:"Select values",placeholder:"Select values"}),disabled:r})},Wt=L("li")({flexDirection:"column"}),sa=({options:e,value:a,disabled:t=!1,onChange:s})=>{const n=ge();return o(Ce,{disablePortal:!0,disabled:t,id:"tag-type-select",sx:{marginTop:r=>r.spacing(2),width:500},options:e,disableClearable:!0,value:a,getOptionLabel:r=>r.name,renderOption:(r,i)=>T(Wt,{...r,style:{alignItems:"flex-start",gap:n.spacing(.5)},children:[o($,{variant:"body1",children:i.name}),o($,{variant:"caption",children:i.description})]}),renderInput:r=>o(Te,{...r,label:"Tag type",value:a}),onChange:s,ListboxProps:{style:{maxHeight:200,overflow:"auto"}}})},ra=()=>{const{makeRequest:e,createRequest:a,errors:t,loading:s}=ht({propagateErrors:!0});return{createTag:async i=>{const p=a("api/admin/tags",{method:"POST",body:JSON.stringify(i)});try{return await e(p.caller,p.id)}catch(h){throw h}},bulkUpdateTags:async(i,c)=>{const p=`api/admin/projects/${c}/tags`,h=a(p,{method:"PUT",body:JSON.stringify(i)});try{return await e(h.caller,h.id)}catch(l){throw l}},errors:t,loading:s}},oa=(e,a={})=>{const t=async()=>{const h=yt(`api/admin/tags/${e}`);return(await fetch(h,{method:"GET"}).then(mt("Tags"))).json()},s=`api/admin/tags/${e}`,{data:n,error:r}=ft(!!e,{tags:[]},s,t,a),[i,c]=C.useState(!r&&!n),p=()=>{pt(s)};return C.useEffect(()=>{c(!r&&!n)},[n,r]),{tags:(n==null?void 0:n.tags)||[],error:r,loading:i,refetch:p}},ia=({isStale:e,isOpen:a,projectId:t,featureId:s,onClose:n})=>{const{setToastData:r,setToastApiError:i}=Y(),{patchFeatureToggle:c}=oe(),p=o($,{children:"Setting a toggle to stale marks it for cleanup"}),h=o($,{children:"Setting a toggle to active marks it as in active use"}),l=e?"active":"stale",y=async d=>{d.stopPropagation();try{await c(t,s,[{op:"replace",path:"/stale",value:!e}]),n()}catch(u){i(_(u))}r(e?{type:"success",title:"And we're back!",text:"The toggle is no longer marked as stale."}:{type:"success",title:"A job well done.",text:"The toggle has been marked as stale."})};return o(z,{open:a,secondaryButtonText:"Cancel",primaryButtonText:`Flip to ${l}`,title:`Set feature state to ${l}`,onClick:y,onClose:n,children:o(q,{condition:e,show:h,elseShow:p})})},Mt=({ids:e,projectId:a})=>{const t=s=>`/projects/${a}/features/${s}`;return e?T(he,{severity:"warning",sx:{m:s=>s.spacing(2,0)},children:[o($,{fontWeight:"bold",variant:"body2",display:"inline",children:`${e.length} feature toggles `}),o("span",{children:"have usage from applications. If you archive these feature toggles they will not be available to Client SDKs:"}),o("ul",{children:e==null?void 0:e.map(s=>o("li",{children:o(bt,{to:t(s),children:s})},s))})]}):null},Jt=(e,a)=>{const s=we(e)(),{isChangeRequestConfigured:n}=Q(e);return s&&n(s)&&a?"Add to change request":s&&n(s)?"Add change to draft":a?"Archive toggles":"Archive toggle"},Kt=({projectId:e,featureIds:a,onSuccess:t,onError:s})=>{const{setToastData:n,setToastApiError:r}=Y(),{archiveFeatureToggle:i}=oe(),{archiveFeatures:c}=fe(),{isChangeRequestConfigured:p}=Q(e),{addChange:h}=re(),{refetch:l}=J(e),y=we(e),d=(a==null?void 0:a.length)>1,u=y(),w=async()=>{if(!u){console.error("No change request environment");return}await h(e,u,a.map(E=>({action:"archiveFeature",feature:E,payload:void 0}))),l(),n({text:d?"Your archive feature toggles changes have been added to change request":"Your archive feature toggle change has been added to change request",type:"success",title:d?"Changes added to a draft":"Change added to a draft"})},f=async()=>{await i(e,a[0]),n({text:"Your feature toggle has been archived",type:"success",title:"Feature archived"})},g=async()=>{await c(e,a),n({text:"Selected feature toggles have been archived",type:"success",title:"Features archived"})};return async()=>{try{u&&p(u)?await w():d?await g():await f(),t()}catch(E){r(_(E)),s()}}},ca=({isOpen:e,onClose:a,onConfirm:t,projectId:s,featureIds:n,featuresWithUsage:r})=>{const{uiConfig:i}=I(),c=(n==null?void 0:n.length)>1,p=Jt(s,c),h=c?"Archive feature toggles":"Archive feature toggle",l=Kt({projectId:s,featureIds:n,onSuccess(){t(),a()},onError(){a()}});return o(z,{onClick:l,open:e,onClose:a,primaryButtonText:p,secondaryButtonText:"Cancel",title:h,children:o(q,{condition:c,show:T(N,{children:[T("p",{children:["Are you sure you want to archive"," ",o("strong",{children:n==null?void 0:n.length})," feature toggles?"]}),o(q,{condition:!!(i.flags.lastSeenByEnvironment&&r&&(r==null?void 0:r.length)>0),show:o(Mt,{ids:r,projectId:s})}),o(q,{condition:(n==null?void 0:n.length)<=5,show:o("ul",{children:n==null?void 0:n.map(y=>o("li",{children:y},y))})})]}),elseShow:T("p",{children:["Are you sure you want to archive"," ",c?"these feature toggles":"this feature toggle","?"]})})})};export{vt as C,Nt as E,ta as F,sa as T,Lt as U,aa as V,Qt as W,ea as a,oa as b,na as c,Zt as d,ca as e,Dt as f,ia as g,Bt as h,Xt as i,ra as u};
@@ -1,2 +1,2 @@
1
- import{gi as c,b as g,bI as m,r as d,j as u}from"./index-83ae2eb3.js";import{d as b,L as x,C as f,a as C,b as v,P as S,c as h,T as q,p as k,e as M,f as L}from"./chartjs-adapter-date-fns.esm-bb13a147.js";import"./index-b6e8c0c5.js";import"./index-0165843e.js";const $=(e,s,n)=>{const a={label:"Total requests",borderColor:e.palette.primary.main,backgroundColor:e.palette.primary.main,data:p(s,n,o=>o.yes+o.no),elements:{point:{radius:6,pointStyle:"circle"},line:{borderDash:[8,4]}}},t={label:"Exposed",borderColor:e.palette.success.main,backgroundColor:e.palette.success.main,data:p(s,n,o=>o.yes),elements:{point:{radius:6,pointStyle:"triangle"}}},r={label:"Not exposed",borderColor:e.palette.error.main,backgroundColor:e.palette.error.main,data:p(s,n,o=>o.no),elements:{point:{radius:6,pointStyle:"triangle",pointRotation:180}}};return{datasets:[t,r,a]}},p=(e,s,n)=>e.map(a=>({x:a.timestamp,y:n(a),variants:a.variants})),E=(e,s)=>{if(s===0)return"";const[n,a]=e,t=Math.floor(Number(a)/s*100);return`${a} (${t}%) - ${n}`},P=(e,s,n,a)=>({locale:a.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:e.palette.text.secondary,plugins:{tooltip:{backgroundColor:e.palette.background.paper,bodyColor:e.palette.text.primary,titleColor:e.palette.text.secondary,borderColor:e.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,itemSort:(t,r)=>{const o=["Total requests","Exposed","Not exposed"],i=o.indexOf(t.dataset.label),l=o.indexOf(r.dataset.label);return i-l},callbacks:{label:t=>`${t.formattedValue} - ${t.dataset.label}`,afterLabel:t=>{const r=t.dataset.data[t.dataIndex];if(t.dataset.label!=="Exposed"||r.variants===void 0)return"";const{disabled:o,...i}=r.variants;return Object.entries(i).map(l=>E(l,r.y)).join(`
2
- `)},title:t=>`Time: ${c(t[0].parsed.x,a.locale)}`}},legend:{position:"top",align:"end",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0}},title:{text:T(n),position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:e.palette.text.primary}},scales:{y:{type:"linear",title:{display:!0,text:"Number of requests",color:e.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:e.palette.text.secondary},grid:{color:e.palette.divider,borderColor:e.palette.divider}},x:{type:"time",time:{unit:"hour"},grid:{display:!1},ticks:{callback:(t,r,o)=>c(o[r].value,a.locale),color:e.palette.text.secondary}}}}),T=e=>e===1?"Requests in the last hour":`Requests in the last ${e} hours`;b.font={...b.font,family:"Sen",size:13,weight:"400"};const R=({metrics:e,hoursBack:s,statsSectionId:n})=>{const a=g(),{locationSettings:t}=m(),r=d.useMemo(()=>[...e].sort((l,y)=>l.timestamp.localeCompare(y.timestamp)),[e]),o=d.useMemo(()=>P(a,r,s,t),[a,r,s,t]),i=d.useMemo(()=>$(a,r,t),[a,r,t]);return u("div",{style:{height:400},children:u(x,{options:o,data:i,"aria-label":"A feature metrics line chart, with three lines: all requests, positive requests, and negative requests.","aria-describedby":n})})};f.register(C,v,S,h,q,k,M,L);export{R as FeatureMetricsChart,R as default};
1
+ import{gg as c,b as g,bI as m,r as d,j as u}from"./index-9add17b9.js";import{d as b,L as x,C as f,a as C,b as v,P as S,c as h,T as q,p as k,e as M,f as L}from"./chartjs-adapter-date-fns.esm-b9693ae4.js";import"./index-58ca4e41.js";import"./index-31edcb6f.js";const $=(e,s,n)=>{const a={label:"Total requests",borderColor:e.palette.primary.main,backgroundColor:e.palette.primary.main,data:p(s,n,o=>o.yes+o.no),elements:{point:{radius:6,pointStyle:"circle"},line:{borderDash:[8,4]}}},t={label:"Exposed",borderColor:e.palette.success.main,backgroundColor:e.palette.success.main,data:p(s,n,o=>o.yes),elements:{point:{radius:6,pointStyle:"triangle"}}},r={label:"Not exposed",borderColor:e.palette.error.main,backgroundColor:e.palette.error.main,data:p(s,n,o=>o.no),elements:{point:{radius:6,pointStyle:"triangle",pointRotation:180}}};return{datasets:[t,r,a]}},p=(e,s,n)=>e.map(a=>({x:a.timestamp,y:n(a),variants:a.variants})),E=(e,s)=>{if(s===0)return"";const[n,a]=e,t=Math.floor(Number(a)/s*100);return`${a} (${t}%) - ${n}`},P=(e,s,n,a)=>({locale:a.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:e.palette.text.secondary,plugins:{tooltip:{backgroundColor:e.palette.background.paper,bodyColor:e.palette.text.primary,titleColor:e.palette.text.secondary,borderColor:e.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,itemSort:(t,r)=>{const o=["Total requests","Exposed","Not exposed"],l=o.indexOf(t.dataset.label),i=o.indexOf(r.dataset.label);return l-i},callbacks:{label:t=>`${t.formattedValue} - ${t.dataset.label}`,afterLabel:t=>{const r=t.dataset.data[t.dataIndex];if(t.dataset.label!=="Exposed"||r.variants===void 0)return"";const{disabled:o,...l}=r.variants;return Object.entries(l).map(i=>E(i,r.y)).join(`
2
+ `)},title:t=>`Time: ${c(t[0].parsed.x,a.locale)}`}},legend:{position:"top",align:"end",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0}},title:{text:T(n),position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:e.palette.text.primary}},scales:{y:{type:"linear",title:{display:!0,text:"Number of requests",color:e.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:e.palette.text.secondary},grid:{color:e.palette.divider,borderColor:e.palette.divider}},x:{type:"time",time:{unit:"hour"},grid:{display:!1},ticks:{callback:(t,r,o)=>c(o[r].value,a.locale),color:e.palette.text.secondary}}}}),T=e=>e===1?"Requests in the last hour":`Requests in the last ${e} hours`;b.font={...b.font,family:"Sen",size:13,weight:"400"};const R=({metrics:e,hoursBack:s,statsSectionId:n})=>{const a=g(),{locationSettings:t}=m(),r=d.useMemo(()=>[...e].sort((i,y)=>i.timestamp.localeCompare(y.timestamp)),[e]),o=d.useMemo(()=>P(a,r,s,t),[a,r,s,t]),l=d.useMemo(()=>$(a,r,t),[a,r,t]);return u("div",{style:{height:400},children:u(x,{options:o,data:l,"aria-label":"A feature metrics line chart, with three lines: all requests, positive requests, and negative requests.","aria-describedby":n})})};f.register(C,v,S,h,q,k,M,L);export{R as FeatureMetricsChart,R as default};