@xwiki/cristal-navigation-tree-filesystem 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @xwiki/cristal-navigation-tree-filesystem
2
2
 
3
+ ## 0.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Cristal 0.21.1 Release
8
+ - Updated dependencies
9
+ - @xwiki/cristal-api@0.21.1
10
+ - @xwiki/cristal-model-api@0.21.1
11
+ - @xwiki/cristal-navigation-tree-api@0.21.1
12
+ - @xwiki/cristal-navigation-tree-default@0.21.1
13
+ - @xwiki/cristal-electron-storage@0.21.1
14
+
3
15
  ## 0.21.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.es.js CHANGED
@@ -1,234 +1,56 @@
1
- import { SpaceReference as T } from "@xwiki/cristal-model-api";
2
- import { name as _ } from "@xwiki/cristal-navigation-tree-api";
3
- import { getParentNodesIdFromPath as O } from "@xwiki/cristal-navigation-tree-default";
4
- function S(n, t, e) {
5
- return Reflect.getOwnMetadata(t, n, e);
6
- }
7
- function E(n, t, e, o) {
8
- Reflect.defineMetadata(t, e, n, o);
9
- }
10
- function g(n, t, e, o, i) {
11
- const r = o(S(n, t, i) ?? e());
12
- Reflect.defineMetadata(t, r, n, i);
13
- }
14
- var D, M, F;
15
- (function(n) {
16
- n.moduleId = "moduleId", n.serviceId = "serviceId";
17
- })(D || (D = {}));
18
- (function(n) {
19
- n.id = "id", n.moduleId = "moduleId", n.serviceId = "serviceId";
20
- })(M || (M = {}));
21
- (function(n) {
22
- n.moduleId = "moduleId", n.serviceId = "serviceId";
23
- })(F || (F = {}));
24
- const h = "@inversifyjs/core/classMetadataReflectKey";
25
- function j() {
26
- return { constructorArguments: [], lifecycle: { postConstructMethodName: void 0, preDestroyMethodName: void 0 }, properties: /* @__PURE__ */ new Map(), scope: void 0 };
27
- }
28
- const K = "@inversifyjs/core/pendingClassMetadataCountReflectKey", C = Symbol.for("@inversifyjs/core/InversifyCoreError");
29
- class u extends Error {
30
- [C];
31
- kind;
32
- constructor(t, e, o) {
33
- super(e, o), this[C] = !0, this.kind = t;
34
- }
35
- static is(t) {
36
- return typeof t == "object" && t !== null && t[C] === !0;
37
- }
38
- static isErrorOfKind(t, e) {
39
- return u.is(t) && t.kind === e;
40
- }
41
- }
42
- var l, y, p;
43
- function U() {
44
- return 0;
45
- }
46
- function B(n) {
47
- return (t) => {
48
- t !== void 0 && t.kind === y.unknown && g(n, K, U, (e) => e - 1);
49
- };
50
- }
51
- function L(n, t) {
52
- return (...e) => (o) => {
53
- if (o === void 0) return n(...e);
54
- if (o.kind === p.unmanaged) throw new u(l.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
55
- return t(o, ...e);
56
- };
57
- }
58
- function q(n) {
59
- if (n.kind !== y.unknown && n.isFromTypescriptParamType !== !0) throw new u(l.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
60
- }
61
- (function(n) {
62
- n[n.injectionDecoratorConflict = 0] = "injectionDecoratorConflict", n[n.missingInjectionDecorator = 1] = "missingInjectionDecorator", n[n.planning = 2] = "planning", n[n.resolution = 3] = "resolution", n[n.unknown = 4] = "unknown";
63
- })(l || (l = {})), function(n) {
64
- n[n.unknown = 32] = "unknown";
65
- }(y || (y = {})), function(n) {
66
- n[n.multipleInjection = 0] = "multipleInjection", n[n.singleInjection = 1] = "singleInjection", n[n.unmanaged = 2] = "unmanaged";
67
- }(p || (p = {}));
68
- const z = L(function(n, t, e) {
69
- return n === p.multipleInjection ? { chained: e?.chained ?? !1, kind: n, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: t } : { kind: n, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: t };
70
- }, function(n, t, e, o) {
71
- return q(n), t === p.multipleInjection ? { ...n, chained: o?.chained ?? !1, kind: t, value: e } : { ...n, kind: t, value: e };
72
- });
73
- function b(n, t) {
74
- return (e) => {
75
- const o = e.properties.get(t);
76
- return e.properties.set(t, n(o)), e;
77
- };
78
- }
79
- var d;
80
- function G(n, t, e, o) {
81
- if (u.isErrorOfKind(o, l.injectionDecoratorConflict)) {
82
- const i = function(r, c, a) {
83
- if (a === void 0) {
84
- if (c === void 0) throw new u(l.unknown, "Unexpected undefined property and index values");
85
- return { kind: d.property, property: c, targetClass: r.constructor };
86
- }
87
- return typeof a == "number" ? { index: a, kind: d.parameter, targetClass: r } : { kind: d.method, method: c, targetClass: r };
88
- }(n, t, e);
89
- throw new u(l.injectionDecoratorConflict, `Unexpected injection error.
90
-
91
- Cause:
92
-
93
- ${o.message}
94
-
95
- Details
96
-
97
- ${function(r) {
98
- switch (r.kind) {
99
- case d.method:
100
- return `[class: "${r.targetClass.name}", method: "${r.method.toString()}"]`;
101
- case d.parameter:
102
- return `[class: "${r.targetClass.name}", index: "${r.index.toString()}"]`;
103
- case d.property:
104
- return `[class: "${r.targetClass.name}", property: "${r.property.toString()}"]`;
105
- }
106
- }(i)}`, { cause: o });
107
- }
108
- throw o;
109
- }
110
- function V(n, t) {
111
- return (e, o, i) => {
112
- try {
113
- i === void 0 ? function(r, c) {
114
- const a = k(r, c);
115
- return (s, f) => {
116
- g(s.constructor, h, j, b(a(s), f));
117
- };
118
- }(n, t)(e, o) : typeof i == "number" ? function(r, c) {
119
- const a = k(r, c);
120
- return (s, f, w) => {
121
- if (!/* @__PURE__ */ function(m, v) {
122
- return typeof m == "function" && v === void 0;
123
- }(s, f)) throw new u(l.injectionDecoratorConflict, `Found an @inject decorator in a non constructor parameter.
124
- Found @inject decorator at method "${f?.toString() ?? ""}" at class "${s.constructor.name}"`);
125
- g(s, h, j, /* @__PURE__ */ function(m, v) {
126
- return (I) => {
127
- const R = I.constructorArguments[v];
128
- return I.constructorArguments[v] = m(R), I;
129
- };
130
- }(a(s), w));
131
- };
132
- }(n, t)(e, o, i) : function(r, c) {
133
- const a = k(r, c);
134
- return (s, f, w) => {
135
- if (!function(m) {
136
- return m.set !== void 0;
137
- }(w)) throw new u(l.injectionDecoratorConflict, `Found an @inject decorator in a non setter property method.
138
- Found @inject decorator at method "${f.toString()}" at class "${s.constructor.name}"`);
139
- g(s.constructor, h, j, b(a(s), f));
140
- };
141
- }(n, t)(e, o, i);
142
- } catch (r) {
143
- G(e, o, i, r);
144
- }
145
- };
146
- }
147
- function k(n, t) {
148
- return (e) => {
149
- const o = t(e);
150
- return (i) => (o(i), n(i));
151
- };
152
- }
153
- function A(n) {
154
- return V(z(p.singleInjection, n), B);
155
- }
156
- (function(n) {
157
- n[n.method = 0] = "method", n[n.parameter = 1] = "parameter", n[n.property = 2] = "property";
158
- })(d || (d = {}));
159
- const P = "@inversifyjs/core/classIsInjectableFlagReflectKey", H = [Array, BigInt, Boolean, Function, Number, Object, String];
160
- function J(n) {
161
- const t = S(n, "design:paramtypes");
162
- t !== void 0 && g(n, h, j, /* @__PURE__ */ function(e) {
163
- return (o) => (e.forEach((i, r) => {
164
- var c;
165
- o.constructorArguments[r] !== void 0 || (c = i, H.includes(c)) || (o.constructorArguments[r] = function(a) {
166
- return { isFromTypescriptParamType: !0, kind: p.singleInjection, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: a };
167
- }(i));
168
- }), o);
169
- }(t));
170
- }
171
- function Q(n) {
172
- return (t) => {
173
- (function(e) {
174
- if (S(e, P) !== void 0) throw new u(l.injectionDecoratorConflict, `Cannot apply @injectable decorator multiple times at class "${e.name}"`);
175
- E(e, P, !0);
176
- })(t), J(t);
177
- };
178
- }
179
- var x;
180
- (function(n) {
181
- n[n.multipleInjection = 0] = "multipleInjection", n[n.singleInjection = 1] = "singleInjection";
182
- })(x || (x = {}));
183
- var W = Object.getOwnPropertyDescriptor, X = (n, t, e, o) => {
184
- for (var i = o > 1 ? void 0 : o ? W(t, e) : t, r = n.length - 1, c; r >= 0; r--)
185
- (c = n[r]) && (i = c(i) || i);
186
- return i;
187
- }, N = (n, t) => (e, o) => t(e, o, n);
188
- let $ = class {
189
- constructor(n, t) {
190
- this.logger = n, this.logger.setModule(
1
+ import { SpaceReference as g } from "@xwiki/cristal-model-api";
2
+ import { name as h } from "@xwiki/cristal-navigation-tree-api";
3
+ import { getParentNodesIdFromPath as d } from "@xwiki/cristal-navigation-tree-default";
4
+ import { injectable as f, inject as c } from "inversify";
5
+ var u = Object.getOwnPropertyDescriptor, v = (t, e, r, i) => {
6
+ for (var o = i > 1 ? void 0 : i ? u(e, r) : e, n = t.length - 1, a; n >= 0; n--)
7
+ (a = t[n]) && (o = a(o) || o);
8
+ return o;
9
+ }, m = (t, e) => (r, i) => e(r, i, t);
10
+ let l = class {
11
+ constructor(t, e) {
12
+ this.logger = t, this.logger.setModule(
191
13
  "navigation-tree-filesystem.components.FileSystemNavigationTreeSource"
192
- ), this.cristalApp = t;
193
- }
194
- async getChildNodes(n) {
195
- const t = n || "", e = [], { fileSystemStorage: o } = window, i = await o.listChildren(t);
196
- for (const r of i)
197
- if (r !== "attachments") {
198
- const c = `${t}${t ? "/" : ""}${r}`, a = await this.cristalApp.getPage(c);
199
- e.push({
200
- id: c,
201
- label: a && a.name ? a.name : r,
202
- location: new T(void 0, ...c.split("/")),
14
+ ), this.cristalApp = e;
15
+ }
16
+ async getChildNodes(t) {
17
+ const e = t || "", r = [], { fileSystemStorage: i } = window, o = await i.listChildren(e);
18
+ for (const n of o)
19
+ if (n !== "attachments") {
20
+ const a = `${e}${e ? "/" : ""}${n}`, s = await this.cristalApp.getPage(a);
21
+ r.push({
22
+ id: a,
23
+ label: s && s.name ? s.name : n,
24
+ location: new g(void 0, ...a.split("/")),
203
25
  url: this.cristalApp.getRouter().resolve({
204
26
  name: "view",
205
27
  params: {
206
- page: c
28
+ page: a
207
29
  }
208
30
  }).href,
209
- has_children: (await o.listChildren(c)).filter(
210
- (s) => s != "attachments"
31
+ has_children: (await i.listChildren(a)).filter(
32
+ (p) => p != "attachments"
211
33
  ).length > 0,
212
34
  is_terminal: !1
213
35
  });
214
36
  }
215
- return e;
37
+ return r;
216
38
  }
217
- getParentNodesId(n, t, e) {
218
- return O(n, e);
39
+ getParentNodesId(t, e, r) {
40
+ return d(t, r);
219
41
  }
220
42
  };
221
- $ = X([
222
- Q(),
223
- N(0, A("Logger")),
224
- N(1, A("CristalApp"))
225
- ], $);
226
- class tn {
227
- constructor(t) {
228
- t.bind(_).to($).inSingletonScope().whenNamed("FileSystem");
43
+ l = v([
44
+ f(),
45
+ m(0, c("Logger")),
46
+ m(1, c("CristalApp"))
47
+ ], l);
48
+ class y {
49
+ constructor(e) {
50
+ e.bind(h).to(l).inSingletonScope().whenNamed("FileSystem");
229
51
  }
230
52
  }
231
53
  export {
232
- tn as ComponentInit
54
+ y as ComponentInit
233
55
  };
234
56
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.3.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/esm/index.js","../../../../node_modules/.pnpm/@inversifyjs+core@6.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/esm/index.js","../src/components/componentsInit.ts"],"sourcesContent":["function t(t){return n=>(n.push(...t),n)}function n(t){return n=>(n.push(t),n)}function e(t,n){return e=>(e[n]=t,e)}function u(){return[]}function f(){return new Map}function c(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function a(t,n,e){return Reflect.getMetadata(n,t,e)}function r(t,n,e,u){Reflect.defineMetadata(n,e,t,u)}function i(t,n,e,u,f){const a=u(c(t,n,f)??e());Reflect.defineMetadata(n,a,t,f)}function o(t,n,e,u,f){const c=u(a(t,n,f)??e());Reflect.defineMetadata(n,c,t,f)}export{t as buildArrayMetadataWithArray,n as buildArrayMetadataWithElement,e as buildArrayMetadataWithIndex,u as buildEmptyArrayMetadata,f as buildEmptyMapMetadata,c as getOwnReflectMetadata,a as getReflectMetadata,r as setReflectMetadata,i as updateOwnReflectMetadata,o as updateReflectMetadata};\n//# sourceMappingURL=index.js.map\n","import{getOwnReflectMetadata as e,setReflectMetadata as t,updateOwnReflectMetadata as n}from\"@inversifyjs/reflect-metadata-utils\";import{getBaseType as i}from\"@inversifyjs/prototype-utils\";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as s}from\"@inversifyjs/common\";const a=\"@inversifyjs/container/bindingId\";function c(){const i=e(Object,a)??0;return i===Number.MAX_SAFE_INTEGER?t(Object,a,Number.MIN_SAFE_INTEGER):n(Object,a,()=>i,e=>e+1),i}const d={Request:\"Request\",Singleton:\"Singleton\",Transient:\"Transient\"},u={ConstantValue:\"ConstantValue\",DynamicValue:\"DynamicValue\",Factory:\"Factory\",Instance:\"Instance\",Provider:\"Provider\",ResolvedValue:\"ResolvedValue\",ServiceRedirection:\"ServiceRedirection\"};function*l(...e){for(const t of e)yield*t}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=this.#r(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error(\"Expecting model relation, none found\");for(const o of i)o[e]===t&&this.#d(n,o);this.#e.delete(n)}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#u(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting model to be cloned, none found\");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting relation to be cloned, none found\");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#u(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#u(o,n),e)}}#d(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n])}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var f,v,h;!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(f||(f={}));class g{#f;#v;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new g(e)}add(e,t){this.#f.add(e,t)}clone(){return new g(this.#v,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e)}}function m(e){return e.isRight?{isRight:!0,value:e.value}:e}function y(e){switch(e.type){case u.ConstantValue:case u.DynamicValue:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case u.Factory:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Instance:return function(e){return{cache:m(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Provider:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ResolvedValue:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id=\"id\",e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(v||(v={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}class I{#h;#v;constructor(e,t){this.#h=t??new M({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new I(e)}clone(){return new I(this.#v,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#v()?.get(e)}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#v();void 0!==n&&(yield*n.getChained(e))}getBoundServices(){const e=new Set(this.#h.getAllKeys(v.serviceId)),t=this.#v();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#h.get(v.id,e)??this.#v()?.getById(e)}getByModuleId(e){return this.#h.get(v.moduleId,e)??this.#v()?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(v.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(v.serviceId)}removeById(e){this.#h.removeByRelation(v.id,e)}removeAllByModuleId(e){this.#h.removeByRelation(v.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(v.serviceId,e)}set(e){const t={[v.id]:e.id,[v.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[v.moduleId]=e.moduleId),this.#h.add(e,t)}}!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(h||(h={}));class w{#g;#v;constructor(e,t){this.#g=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new w(e)}add(e,t){this.#g.add(e,t)}clone(){return new w(this.#v,this.#g.clone())}get(e){const t=[],n=this.#g.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#g.removeByRelation(h.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(h.serviceId,e)}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if(\"number\"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const S=\"@inversifyjs/core/classMetadataReflectKey\";function C(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N=\"@inversifyjs/core/pendingClassMetadataCountReflectKey\";const T=Symbol.for(\"@inversifyjs/core/InversifyCoreError\");class j extends Error{[T];kind;constructor(e,t,n){super(t,n),this[T]=!0,this.kind=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[T]}static isErrorOfKind(e,t){return j.is(e)&&e.kind===t}}var P,A,R;function x(t){const n=e(t,S)??C();if(!function(t){const n=e(t,N);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\". \"${e.name}\" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\" at constructor indexes \"${n.join('\", \"')}\".\\n\\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==A.unknown||n.push(` - Missing or incomplete metadata for type \"${e.name}\" at constructor argument with index ${i.toString()}.\\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===A.unknown&&n.push(` - Missing or incomplete metadata for type \"${e.name}\" at property \"${i.toString()}\".\\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new j(P.unknown,`Unexpected class metadata for type \"${e.name}\" with uncompletion traces.\\nThis might be caused by one of the following reasons:\\n\\n1. A third party library is targeting inversify reflection metadata.\\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new j(P.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\\n\\n${n.join(\"\\n\\n\")}`)}(t,n)}function B(){return 0}function $(e){return t=>{void 0!==t&&t.kind===A.unknown&&n(e,N,B,e=>e-1)}}function D(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\");return t(i,...n)}}function k(e){if(e.kind!==A.unknown&&!0!==e.isFromTypescriptParamType)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\")}!function(e){e[e.injectionDecoratorConflict=0]=\"injectionDecoratorConflict\",e[e.missingInjectionDecorator=1]=\"missingInjectionDecorator\",e[e.planning=2]=\"planning\",e[e.resolution=3]=\"resolution\",e[e.unknown=4]=\"unknown\"}(P||(P={})),function(e){e[e.unknown=32]=\"unknown\"}(A||(A={})),function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\",e[e.unmanaged=2]=\"unmanaged\"}(R||(R={}));const F=D(function(e,t,n){return e===R.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return k(e),t===R.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function V(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var O;function E(e,t,n,i){if(j.isErrorOfKind(i,P.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new j(P.unknown,\"Unexpected undefined property and index values\");return{kind:O.property,property:t,targetClass:e.constructor}}return\"number\"==typeof n?{index:n,kind:O.parameter,targetClass:e}:{kind:O.method,method:t,targetClass:e}}(e,t,n);throw new j(P.injectionDecoratorConflict,`Unexpected injection error.\\n\\nCause:\\n\\n${i.message}\\n\\nDetails\\n\\n${function(e){switch(e.kind){case O.method:return`[class: \"${e.targetClass.name}\", method: \"${e.method.toString()}\"]`;case O.parameter:return`[class: \"${e.targetClass.name}\", index: \"${e.index.toString()}\"]`;case O.property:return`[class: \"${e.targetClass.name}\", property: \"${e.property.toString()}\"]`}}(o)}`,{cause:i})}throw i}function _(e,t){return(i,o,r)=>{try{void 0===r?function(e,t){const i=U(e,t);return(e,t)=>{n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o):\"number\"==typeof r?function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e,t){return\"function\"==typeof e&&void 0===t}(e,t))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\\nFound @inject decorator at method \"${t?.toString()??\"\"}\" at class \"${e.constructor.name}\"`);n(e,S,C,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,t)(i,o,r):function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\\nFound @inject decorator at method \"${t.toString()}\" at class \"${e.constructor.name}\"`);n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o,r)}catch(e){E(i,o,r,e)}}}function U(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function z(e){return _(F(R.singleInjection,e),$)}!function(e){e[e.method=0]=\"method\",e[e.parameter=1]=\"parameter\",e[e.property=2]=\"property\"}(O||(O={}));const K=\"@inversifyjs/core/classIsInjectableFlagReflectKey\";const L=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const i=e(t,\"design:paramtypes\");void 0!==i&&n(t,S,C,function(e){return t=>(e.forEach((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,L.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:R.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(i))}function G(i){return o=>{!function(n){if(void 0!==e(n,K))throw new j(P.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class \"${n.name}\"`);t(n,K,!0)}(o),q(o),void 0!==i&&n(o,S,C,e=>({...e,scope:i}))}}function W(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{i[t]=e})):i=n.constructorArguments,i}function X(e,t,n){let i;return i=e.extendProperties??!0?new Map(l(t.properties,n.properties)):n.properties,i}function H(e){return t=>{const i=x(e.type);n(t,S,C,function(e,t){const n=n=>({constructorArguments:W(e,t,n),lifecycle:n.lifecycle,properties:X(e,t,n),scope:n.scope});return n}(e,i))}}function J(e){return t=>{const n=i(t);if(void 0===n)throw new j(P.injectionDecoratorConflict,`Expected base type for type \"${t.name}\", none found.`);H({...e,type:n})(t)}}function Q(e,t){return _(F(R.multipleInjection,e,t),$)}function Y(e){return t=>{void 0===t&&n(e,N,B,e=>e+1)}}function Z(e){return t=>{const n=t??{kind:A.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return e(n)}}function ee(e){const t=Z(function(e){return t=>{if(void 0!==t.name)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated named decorator\");return t.name=e,t}}(e));return _(t,Y)}function te(e){if(e.optional)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated optional decorator\");return e.optional=!0,e}function ne(){return _(Z(te),Y)}function ie(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated postConstruct decorator\");return e.lifecycle.postConstructMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function oe(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated preDestroy decorator\");return e.lifecycle.preDestroyMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function re(e,t){const n=Z(function(e,t){return n=>{if(n.tags.has(e))throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated tag decorator with existing tag\");return n.tags.set(e,t),n}}(e,t));return _(n,Y)}function se(){return{kind:R.unmanaged}}const ae=D(se,function(e){if(k(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return se()});function ce(){return _(ae(),$)}var de;!function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\"}(de||(de={}));class ue{#m;constructor(e){this.#m=e}get name(){return this.#m.elem.name}get serviceIdentifier(){return this.#m.elem.serviceIdentifier}get tags(){return this.#m.elem.tags}getAncestor(){if(this.#m.elem.getAncestorsCalled=!0,void 0!==this.#m.previous)return new ue(this.#m.previous)}}function le(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===o.length&&void 0!==e.autobindOptions&&\"function\"==typeof i){const t=function(e,t){const n=x(t),i=n.scope??e.scope;return{cache:{isRight:!1,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:u.Instance}}(e.autobindOptions,i);e.operations.setBinding(t),o.push(t)}return o}class pe{last;constructor(e){this.last=e}concat(e){return new pe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function fe(e){return void 0!==e.redirections}function ve(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=s[s.length-1]??n,a=`Ambiguous bindings found for service: \"${o(t)}\".${ye(s)}\\n\\nRegistered bindings:\\n\\n${e.map(e=>function(e){switch(e.type){case u.Instance:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\", implementationType: \"${e.implementationType.name}\" ]`;case u.ServiceRedirection:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", redirection: \"${o(e.targetServiceIdentifier)}\" ]`;default:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\" ]`}}(e.binding)).join(\"\\n\")}\\n\\nTrying to resolve bindings for \"${ge(n,i)}\".${me(r)}`;throw new j(P.planning,a)}t||he(n,i,r,s)}(e,t,r,s,n.elem,i):function(e,t,n,i,o,r){void 0!==e||t||he(n,i,o,r)}(e,t,r,s,n.elem,i)}function he(e,t,n,i){const r=i[i.length-1]??e,s=`No bindings found for service: \"${o(r)}\".\\n\\nTrying to resolve bindings for \"${ge(e,t)}\".${ye(i)}${me(n)}`;throw new j(P.planning,s)}function ge(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function me(e){const t=0===e.tags.size?\"\":`\\n- tags:\\n - ${[...e.tags.keys()].map(e=>e.toString()).join(\"\\n - \")}`;return`\\n\\nBinding constraints:\\n- service identifier: ${o(e.serviceIdentifier)}\\n- name: ${e.name?.toString()??\"-\"}${t}`}function ye(e){return 0===e.length?\"\":`\\n\\n- service redirections:\\n - ${e.map(e=>o(e)).join(\"\\n - \")}`}function Me(e,t,n,i){if(1===e.redirections.length){const[o]=e.redirections;return void(fe(o)&&Me(o,t,n,[...i,o.binding.targetServiceIdentifier]))}ve(e.redirections,t,n,i)}function Ie(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(fe(i)&&Me(i,t,n,[i.binding.targetServiceIdentifier]))}ve(e.bindings,t,n,[])}function we(e){return r.is(e)?e.unwrap():e}function be(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||\"InternalError\"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return\"(No dependency trace)\";return t.map(o).join(\" -> \")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new j(P.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}const Se=Symbol.for(\"@inversifyjs/core/LazyPlanServiceNode\");class Ce{[Se];_serviceIdentifier;_serviceNode;constructor(e){this[Se]=!0,this._serviceIdentifier=e.serviceIdentifier,this._serviceNode=e}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[Se]}invalidate(){this._serviceNode=void 0}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}function Ne(e,t,n){if(void 0!==e&&n.isContextFree){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n)}class Te extends Ce{#y;constructor(e,t){super(t),this.#y=e}_buildPlanServiceNode(){return Ae(this.#y)}}class je extends Ce{#y;#M;#I;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#I=n}_buildPlanServiceNode(){return Be(this.#y,this.#M,this.#I)}}class Pe extends Ce{#y;#M;#w;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#w=n}_buildPlanServiceNode(){return $e(this.#y,this.#M,this.#w)}}function Ae(e){const t=function(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new pe({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}(e),n=new ue(t.last),i=!!e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=le(e,n,{chained:i}),r=[],s={bindings:r,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ke(e,t,o,s,i)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){Ie(s,e.rootConstraints.isOptional??!1,t.last);const[n]=r;s.bindings=n}return s}function Re(e){try{const t=function(e){return e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}}(e),n=e.operations.getPlan(t);if(void 0!==n)return n;const i=Ae(e),o={tree:{root:new Te(e,i)}};return e.operations.setPlan(t,o),o}catch(t){be(e,t)}}function xe(e,t,n){const i={binding:t,classMetadata:e.operations.getClassMetadata(t.implementationType),constructorParams:[],propertyParams:new Map};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function Be(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===R.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===R.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function $e(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===de.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===de.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function De(e,t,n){const i={binding:t,params:[]};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function ke(e,t,n,i,o){const r=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(r);const s=[];for(const i of n)switch(i.type){case u.Instance:s.push(xe(e,i,t));break;case u.ResolvedValue:s.push(De(e,i,t));break;case u.ServiceRedirection:{const n=Fe(e,t,i,o);s.push(n);break}default:s.push({binding:i})}return e.servicesBranch.pop(),s}function Fe(e,t,n,i){const o={binding:n,redirections:[]},r=le(e,new ue(t.last),{chained:i,customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...ke(e,t,r,o,i)),o}function Ve(e,t,n){if(n.kind===R.unmanaged)return;const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===R.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=Be(e,t,n),s=new je(e,t,n,o);return Ne(i,e.operations,s),s}function Oe(e,t,n){const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===de.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=$e(e,t,n),s=new Pe(e,t,n,o);return Ne(i,e.operations,s),s}function Ee(e,t){return e.node.binding.type===u.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Ve(e,n,r);for(const[o,r]of i.properties){const i=Ve(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Oe(e,n,r);return e.node}(e,e.node,t)}class _e{#b;#S;#C;constructor(){this.#b=[],this.#S=8,this.#C=1024}*[Symbol.iterator](){let e=0;for(const t of this.#b){const n=t.deref();void 0===n?++e:yield n}this.#b.length>=this.#S&&this.#N(e)&&this.#T(e)}push(e){const t=new WeakRef(e);if(this.#b.push(t),this.#b.length>=this.#S&&this.#b.length%this.#C===0){let e=0;for(const t of this.#b)void 0===t.deref()&&++e;this.#N(e)&&this.#T(e)}}#T(e){const t=new Array(this.#b.length-e);let n=0;for(const e of this.#b)e.deref()&&(t[n++]=e);this.#b=t}#N(e){return e>=.5*this.#b.length}}class Ue{#j;#P;#A;#R;#x;#B;constructor(){this.#j=new Map,this.#P=this.#$(),this.#A=this.#$(),this.#R=this.#$(),this.#x=this.#$(),this.#B=new _e}clearCache(){for(const e of this.#D())e.clear();for(const e of this.#B)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#k(this.#P,e).get(e.serviceIdentifier):this.#k(this.#x,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#k(this.#A,e).get(e.serviceIdentifier)?.get(e.name):this.#k(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateService(e){this.#F(e),this.#V(e),this.#O(e),this.#E(e),this.#_(e);for(const t of this.#B)t.invalidateService(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#k(this.#P,e).set(e.serviceIdentifier,t):this.#U(this.#U(this.#k(this.#x,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#U(this.#k(this.#A,e),e.serviceIdentifier).set(e.name,t):this.#U(this.#U(this.#U(this.#k(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e){let t=this.#j.get(e.serviceIdentifier);void 0===t&&(t=new Set,this.#j.set(e.serviceIdentifier,t)),t.add(e)}subscribe(e){this.#B.push(e)}#$(){const e=new Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#U(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#k(e,t){return e[this.#z(t)]}#D(){return[this.#j,...this.#P,...this.#A,...this.#R,...this.#x]}#z(e){return e.isMultiple?(e.chained?4:0)|(e.optional?1:0)|2:e.optional?1:0}#V(e){for(const t of this.#A){const n=t.get(e);if(void 0!==n)for(const e of n.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#O(e){for(const t of this.#R){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())for(const e of t.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#L(e){switch(e.binding.type){case u.ServiceRedirection:for(const t of e.redirections)this.#L(t);break;case u.Instance:for(const t of e.constructorParams)void 0!==t&&this.#q(t);for(const t of e.propertyParams.values())this.#q(t);break;case u.ResolvedValue:for(const t of e.params)this.#q(t)}}#q(e){const t=this.#j.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#K(e))}#K(e){if(void 0!==e.bindings)if(Array.isArray(e.bindings))for(const t of e.bindings)this.#L(t);else this.#L(e.bindings)}#_(e){const t=this.#j.get(e);if(void 0!==t)for(const e of t)Ce.is(e)&&(this.#K(e),e.invalidate())}#F(e){for(const t of this.#P){const n=t.get(e);void 0!==n&&Ce.is(n.tree.root)&&(this.#K(n.tree.root),n.tree.root.invalidate())}}#E(e){for(const t of this.#x){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())Ce.is(t.tree.root)&&(this.#K(t.tree.root),t.tree.root.invalidate())}}}function ze(e,t){return s(t)?(e.cache={isRight:!0,value:t},t.then(t=>Ke(e,t))):Ke(e,t)}function Ke(e,t){return e.cache={isRight:!0,value:t},t}function Le(e,t,n){const i=e.getActivations(t);return void 0===i?n:s(n)?qe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(s(t))return qe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function qe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ge(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=s(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return Le(e,t.serviceIdentifier,i)}function We(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return ze(n,Ge(t,n,e(t,n)))}}const Xe=We(function(e,t){return t.value});function He(e){return e}function Je(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case d.Singleton:if(o.cache.isRight)return o.cache.value;return ze(o,Ge(n,o,t(n,i)));case d.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ge(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case d.Transient:return Ge(n,o,t(n,i))}}}const Qe=(e=>Je(He,e))(function(e,t){return t.value(e.context)});const Ye=We(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new j(P.resolution,`Expecting a \"${n.toString()}\" property when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, none found.`);if(\"function\"!=typeof e[n])throw new j(P.resolution,`Expecting a \"${n.toString()}\" method when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new j(P.resolution,`Unexpected error found when calling \"${n.toString()}\" @postConstruct decorated method on class \"${t.implementationType.name}\"`,{cause:e})}if(s(i))return async function(e,t,n){try{await n}catch(n){throw new j(P.resolution,`Unexpected error found when calling \"${t.toString()}\" @postConstruct decorated method on class \"${e.implementationType.name}\"`,{cause:n})}}(t,n,i)}}(e,t,n);return s(i)?i.then(()=>e):e}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return s(r)?r.then(()=>Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const tt=We(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const ot=function(e){return(t,n,i)=>{const o=[];for(const[r,a]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new j(P.resolution,`Expecting metadata at property \"${r.toString()}\", none found`);c.kind!==R.unmanaged&&void 0!==a.bindings&&(n[r]=e(t,a),s(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(pt),rt=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(lt),st=function(e,t,n){return(i,o)=>{const r=e(i,o);return s(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(et(ot)),et(ot)),at=function(e){return(t,n)=>{const i=e(t,n);return s(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt)),ct=(e=>Je(nt,e))(st),dt=(e=>Je(it,e))(at);function ut(e){return pt(e,e.planResult.tree.root)}function lt(e,t){switch(t.binding.type){case u.ConstantValue:return Xe(e,t.binding);case u.DynamicValue:return Qe(e,t.binding);case u.Factory:return Ye(e,t.binding);case u.Instance:return ct(e,t);case u.Provider:return tt(e,t.binding);case u.ResolvedValue:return dt(e,t)}}function pt(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)fe(i)?n.push(...rt(e,i)):n.push(lt(e,i));if(n.some(s))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(fe(t)){const n=rt(e,t);if(1===n.length)return n[0];throw new j(P.resolution,\"Unexpected multiple resolved values on single injection\")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function vt(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&\"function\"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function ht(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return s(n)?gt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(s(i))return gt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function gt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===u.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return s(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?yt(e,t):n.then(()=>yt(e,t))}function yt(e,t){const n=t.cache;return s(n.value)?n.value.then(n=>Mt(e,t,n)):Mt(e,t,n.value)}function Mt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?ht(e,t.serviceIdentifier,n):i.then(()=>ht(e,t.serviceIdentifier,n))}function It(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===d.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=mt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function wt(e,t){const n=e.getBindingsFromModule(t);return It(e,n)}function bt(e,t){const n=e.getBindings(t);return It(e,n)}export{g as ActivationsService,I as BindingService,R as ClassElementMetadataKind,w as DeactivationsService,Ue as PlanResultCacheService,de as ResolvedValueElementMetadataKind,d as bindingScopeValues,u as bindingTypeValues,b as decorate,c as getBindingId,x as getClassMetadata,z as inject,J as injectFromBase,G as injectable,Q as multiInject,ee as named,ne as optional,Re as plan,ie as postConstruct,oe as preDestroy,ut as resolve,It as resolveBindingsDeactivations,wt as resolveModuleDeactivations,bt as resolveServiceDeactivations,re as tagged,ce as unmanaged};\n//# sourceMappingURL=index.js.map\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { SpaceReference } from \"@xwiki/cristal-model-api\";\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { getParentNodesIdFromPath } from \"@xwiki/cristal-navigation-tree-default\";\nimport { Container, inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the FileSystem backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass FileSystemNavigationTreeSource implements NavigationTreeSource {\n private cristalApp: CristalApp;\n public logger: Logger;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.logger = logger;\n this.logger.setModule(\n \"navigation-tree-filesystem.components.FileSystemNavigationTreeSource\",\n );\n this.cristalApp = cristalApp;\n }\n\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n // eslint-disable-next-line\n const { fileSystemStorage } = window as any;\n const children = await fileSystemStorage.listChildren(currentId);\n\n for (const child of children) {\n // Remove attachments folders\n if (child !== \"attachments\") {\n const id = `${currentId}${currentId ? \"/\" : \"\"}${child}`;\n const currentPageData = await this.cristalApp.getPage(id);\n navigationTree.push({\n id: id,\n label:\n currentPageData && currentPageData.name\n ? currentPageData.name\n : child,\n location: new SpaceReference(undefined, ...id.split(\"/\")),\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: id,\n },\n }).href,\n has_children:\n (await fileSystemStorage.listChildren(id)).filter(\n (c: string) => c != \"attachments\",\n ).length > 0,\n is_terminal: false,\n });\n }\n }\n\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n _includeTerminal?: boolean,\n includeRootNode?: boolean,\n ): Array<string> {\n // FileSystem implementation does not handle terminal pages.\n return getParentNodesIdFromPath(page, includeRootNode);\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(FileSystemNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"FileSystem\");\n }\n}\n"],"names":["c","t","n","r","u","i","f","a","v","h","e","S","C","N","T","j","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","q","G","de","FileSystemNavigationTreeSource","logger","cristalApp","id","currentId","navigationTree","fileSystemStorage","children","child","currentPageData","SpaceReference","page","_includeTerminal","includeRootNode","getParentNodesIdFromPath","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":";;;AAAsK,SAASA,EAAEC,GAAEC,GAAE,GAAE;AAAC,SAAO,QAAQ,eAAeA,GAAED,GAAE,CAAC;AAAC;AAAqD,SAASE,EAAEF,GAAEC,GAAE,GAAEE,GAAE;AAAC,UAAQ,eAAeF,GAAE,GAAED,GAAEG,CAAC;AAAC;AAAC,SAASC,EAAEJ,GAAEC,GAAE,GAAEE,GAAEE,GAAE;AAAC,QAAMC,IAAEH,EAAEJ,EAAEC,GAAEC,GAAEI,CAAC,KAAG,EAAC,CAAE;AAAE,UAAQ,eAAeJ,GAAEK,GAAEN,GAAEK,CAAC;AA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U,eAAe;AAC3B,cAAML,IAAK,GAAGC,CAAS,GAAGA,IAAY,MAAM,EAAE,GAAGI,CAAK,IAChDC,IAAkB,MAAM,KAAK,WAAW,QAAQN,CAAE;AACxD,QAAAE,EAAe,KAAK;AAAA,UAClB,IAAIF;AAAAA,UACJ,OACEM,KAAmBA,EAAgB,OAC/BA,EAAgB,OAChBD;AAAA,UACN,UAAU,IAAIE,EAAe,QAAW,GAAGP,EAAG,MAAM,GAAG,CAAC;AAAA,UACxD,KAAK,KAAK,WAAW,UAAA,EAAY,QAAQ;AAAA,YACvC,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,MAAMA;AAAAA,YAAA;AAAA,UACR,CACD,EAAE;AAAA,UACH,eACG,MAAMG,EAAkB,aAAaH,CAAE,GAAG;AAAA,YACzC,CAACvC,MAAcA,KAAK;AAAA,UAAA,EACpB,SAAS;AAAA,UACb,aAAa;AAAA,QAAA,CACd;AAAA,MACH;AAGF,WAAOyC;AAAA,EACT;AAAA,EAEA,iBACEM,GACAC,GACAC,GACe;AAEf,WAAOC,EAAyBH,GAAME,CAAe;AAAA,EACvD;AACF;AA7DMb,IAANe,EAAA;AAAA,EADCC,EAAA;AAAA,EAMIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,YAAY,CAAA;AAAA,GANlBjB,CAAA;AA+DC,MAAMkB,GAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA2BC,CAAwB,EACnD,GAAGpB,CAA8B,EACjC,iBAAA,EACA,UAAU,YAAY;AAAA,EAC3B;AACF;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.es.js","sources":["../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { SpaceReference } from \"@xwiki/cristal-model-api\";\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { getParentNodesIdFromPath } from \"@xwiki/cristal-navigation-tree-default\";\nimport { Container, inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the FileSystem backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass FileSystemNavigationTreeSource implements NavigationTreeSource {\n private cristalApp: CristalApp;\n public logger: Logger;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.logger = logger;\n this.logger.setModule(\n \"navigation-tree-filesystem.components.FileSystemNavigationTreeSource\",\n );\n this.cristalApp = cristalApp;\n }\n\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n // eslint-disable-next-line\n const { fileSystemStorage } = window as any;\n const children = await fileSystemStorage.listChildren(currentId);\n\n for (const child of children) {\n // Remove attachments folders\n if (child !== \"attachments\") {\n const id = `${currentId}${currentId ? \"/\" : \"\"}${child}`;\n const currentPageData = await this.cristalApp.getPage(id);\n navigationTree.push({\n id: id,\n label:\n currentPageData && currentPageData.name\n ? currentPageData.name\n : child,\n location: new SpaceReference(undefined, ...id.split(\"/\")),\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: id,\n },\n }).href,\n has_children:\n (await fileSystemStorage.listChildren(id)).filter(\n (c: string) => c != \"attachments\",\n ).length > 0,\n is_terminal: false,\n });\n }\n }\n\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n _includeTerminal?: boolean,\n includeRootNode?: boolean,\n ): Array<string> {\n // FileSystem implementation does not handle terminal pages.\n return getParentNodesIdFromPath(page, includeRootNode);\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(FileSystemNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"FileSystem\");\n }\n}\n"],"names":["FileSystemNavigationTreeSource","logger","cristalApp","id","currentId","navigationTree","fileSystemStorage","children","child","currentPageData","SpaceReference","c","page","_includeTerminal","includeRootNode","getParentNodesIdFromPath","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":";;;;;;;;;AAqCA,IAAMA,IAAN,MAAqE;AAAA,EAInE,YACoBC,GACIC,GACtB;AACA,SAAK,SAASD,GACd,KAAK,OAAO;AAAA,MACV;AAAA,IAAA,GAEF,KAAK,aAAaC;AAAA,EACpB;AAAA,EAEA,MAAM,cAAcC,GAAiD;AACnE,UAAMC,IAAYD,KAAU,IACtBE,IAA4C,CAAA,GAG5C,EAAE,mBAAAC,MAAsB,QACxBC,IAAW,MAAMD,EAAkB,aAAaF,CAAS;AAE/D,eAAWI,KAASD;AAElB,UAAIC,MAAU,eAAe;AAC3B,cAAML,IAAK,GAAGC,CAAS,GAAGA,IAAY,MAAM,EAAE,GAAGI,CAAK,IAChDC,IAAkB,MAAM,KAAK,WAAW,QAAQN,CAAE;AACxD,QAAAE,EAAe,KAAK;AAAA,UAClB,IAAIF;AAAAA,UACJ,OACEM,KAAmBA,EAAgB,OAC/BA,EAAgB,OAChBD;AAAA,UACN,UAAU,IAAIE,EAAe,QAAW,GAAGP,EAAG,MAAM,GAAG,CAAC;AAAA,UACxD,KAAK,KAAK,WAAW,UAAA,EAAY,QAAQ;AAAA,YACvC,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,MAAMA;AAAAA,YAAA;AAAA,UACR,CACD,EAAE;AAAA,UACH,eACG,MAAMG,EAAkB,aAAaH,CAAE,GAAG;AAAA,YACzC,CAACQ,MAAcA,KAAK;AAAA,UAAA,EACpB,SAAS;AAAA,UACb,aAAa;AAAA,QAAA,CACd;AAAA,MACH;AAGF,WAAON;AAAA,EACT;AAAA,EAEA,iBACEO,GACAC,GACAC,GACe;AAEf,WAAOC,EAAyBH,GAAME,CAAe;AAAA,EACvD;AACF;AA7DMd,IAANgB,EAAA;AAAA,EADCC,EAAA;AAAA,EAMIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,YAAY,CAAA;AAAA,GANlBlB,CAAA;AA+DC,MAAMmB,EAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA2BC,CAAwB,EACnD,GAAGrB,CAA8B,EACjC,iBAAA,EACA,UAAU,YAAY;AAAA,EAC3B;AACF;"}
package/dist/index.umd.js CHANGED
@@ -1,12 +1,2 @@
1
- (function(d,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("@xwiki/cristal-model-api"),require("@xwiki/cristal-navigation-tree-api"),require("@xwiki/cristal-navigation-tree-default")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-model-api","@xwiki/cristal-navigation-tree-api","@xwiki/cristal-navigation-tree-default"],g):(d=typeof globalThis<"u"?globalThis:d||self,g(d["cristal_navigation-tree-filesystem"]={},d.cristalModelApi,d.cristalNavigationTreeApi,d.cristalNavigationTreeDefault))})(this,function(d,g,O,R){"use strict";function C(n,t,e){return Reflect.getOwnMetadata(t,n,e)}function E(n,t,e,i){Reflect.defineMetadata(t,e,n,i)}function v(n,t,e,i,r){const o=i(C(n,t,r)??e());Reflect.defineMetadata(t,o,n,r)}var M,T,A;(function(n){n.moduleId="moduleId",n.serviceId="serviceId"})(M||(M={})),function(n){n.id="id",n.moduleId="moduleId",n.serviceId="serviceId"}(T||(T={})),function(n){n.moduleId="moduleId",n.serviceId="serviceId"}(A||(A={}));const j="@inversifyjs/core/classMetadataReflectKey";function w(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const K="@inversifyjs/core/pendingClassMetadataCountReflectKey",k=Symbol.for("@inversifyjs/core/InversifyCoreError");class u extends Error{[k];kind;constructor(t,e,i){super(e,i),this[k]=!0,this.kind=t}static is(t){return typeof t=="object"&&t!==null&&t[k]===!0}static isErrorOfKind(t,e){return u.is(t)&&t.kind===e}}var l,y,p;function U(){return 0}function q(n){return t=>{t!==void 0&&t.kind===y.unknown&&v(n,K,U,e=>e-1)}}function B(n,t){return(...e)=>i=>{if(i===void 0)return n(...e);if(i.kind===p.unmanaged)throw new u(l.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(i,...e)}}function L(n){if(n.kind!==y.unknown&&n.isFromTypescriptParamType!==!0)throw new u(l.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(function(n){n[n.injectionDecoratorConflict=0]="injectionDecoratorConflict",n[n.missingInjectionDecorator=1]="missingInjectionDecorator",n[n.planning=2]="planning",n[n.resolution=3]="resolution",n[n.unknown=4]="unknown"})(l||(l={})),function(n){n[n.unknown=32]="unknown"}(y||(y={})),function(n){n[n.multipleInjection=0]="multipleInjection",n[n.singleInjection=1]="singleInjection",n[n.unmanaged=2]="unmanaged"}(p||(p={}));const z=B(function(n,t,e){return n===p.multipleInjection?{chained:e?.chained??!1,kind:n,name:void 0,optional:!1,tags:new Map,value:t}:{kind:n,name:void 0,optional:!1,tags:new Map,value:t}},function(n,t,e,i){return L(n),t===p.multipleInjection?{...n,chained:i?.chained??!1,kind:t,value:e}:{...n,kind:t,value:e}});function F(n,t){return e=>{const i=e.properties.get(t);return e.properties.set(t,n(i)),e}}var f;function G(n,t,e,i){if(u.isErrorOfKind(i,l.injectionDecoratorConflict)){const r=function(o,c,a){if(a===void 0){if(c===void 0)throw new u(l.unknown,"Unexpected undefined property and index values");return{kind:f.property,property:c,targetClass:o.constructor}}return typeof a=="number"?{index:a,kind:f.parameter,targetClass:o}:{kind:f.method,method:c,targetClass:o}}(n,t,e);throw new u(l.injectionDecoratorConflict,`Unexpected injection error.
2
-
3
- Cause:
4
-
5
- ${i.message}
6
-
7
- Details
8
-
9
- ${function(o){switch(o.kind){case f.method:return`[class: "${o.targetClass.name}", method: "${o.method.toString()}"]`;case f.parameter:return`[class: "${o.targetClass.name}", index: "${o.index.toString()}"]`;case f.property:return`[class: "${o.targetClass.name}", property: "${o.property.toString()}"]`}}(r)}`,{cause:i})}throw i}function V(n,t){return(e,i,r)=>{try{r===void 0?function(o,c){const a=S(o,c);return(s,m)=>{v(s.constructor,j,w,F(a(s),m))}}(n,t)(e,i):typeof r=="number"?function(o,c){const a=S(o,c);return(s,m,D)=>{if(!function(h,I){return typeof h=="function"&&I===void 0}(s,m))throw new u(l.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
10
- Found @inject decorator at method "${m?.toString()??""}" at class "${s.constructor.name}"`);v(s,j,w,function(h,I){return x=>{const Z=x.constructorArguments[I];return x.constructorArguments[I]=h(Z),x}}(a(s),D))}}(n,t)(e,i,r):function(o,c){const a=S(o,c);return(s,m,D)=>{if(!function(h){return h.set!==void 0}(D))throw new u(l.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
11
- Found @inject decorator at method "${m.toString()}" at class "${s.constructor.name}"`);v(s.constructor,j,w,F(a(s),m))}}(n,t)(e,i,r)}catch(o){G(e,i,r,o)}}}function S(n,t){return e=>{const i=t(e);return r=>(i(r),n(r))}}function N(n){return V(z(p.singleInjection,n),q)}(function(n){n[n.method=0]="method",n[n.parameter=1]="parameter",n[n.property=2]="property"})(f||(f={}));const P="@inversifyjs/core/classIsInjectableFlagReflectKey",H=[Array,BigInt,Boolean,Function,Number,Object,String];function J(n){const t=C(n,"design:paramtypes");t!==void 0&&v(n,j,w,function(e){return i=>(e.forEach((r,o)=>{var c;i.constructorArguments[o]!==void 0||(c=r,H.includes(c))||(i.constructorArguments[o]=function(a){return{isFromTypescriptParamType:!0,kind:p.singleInjection,name:void 0,optional:!1,tags:new Map,value:a}}(r))}),i)}(t))}function Q(n){return t=>{(function(e){if(C(e,P)!==void 0)throw new u(l.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);E(e,P,!0)})(t),J(t)}}var b;(function(n){n[n.multipleInjection=0]="multipleInjection",n[n.singleInjection=1]="singleInjection"})(b||(b={}));var W=Object.getOwnPropertyDescriptor,X=(n,t,e,i)=>{for(var r=i>1?void 0:i?W(t,e):t,o=n.length-1,c;o>=0;o--)(c=n[o])&&(r=c(r)||r);return r},_=(n,t)=>(e,i)=>t(e,i,n);let $=class{constructor(n,t){this.logger=n,this.logger.setModule("navigation-tree-filesystem.components.FileSystemNavigationTreeSource"),this.cristalApp=t}async getChildNodes(n){const t=n||"",e=[],{fileSystemStorage:i}=window,r=await i.listChildren(t);for(const o of r)if(o!=="attachments"){const c=`${t}${t?"/":""}${o}`,a=await this.cristalApp.getPage(c);e.push({id:c,label:a&&a.name?a.name:o,location:new g.SpaceReference(void 0,...c.split("/")),url:this.cristalApp.getRouter().resolve({name:"view",params:{page:c}}).href,has_children:(await i.listChildren(c)).filter(s=>s!="attachments").length>0,is_terminal:!1})}return e}getParentNodesId(n,t,e){return R.getParentNodesIdFromPath(n,e)}};$=X([Q(),_(0,N("Logger")),_(1,N("CristalApp"))],$);class Y{constructor(t){t.bind(O.name).to($).inSingletonScope().whenNamed("FileSystem")}}d.ComponentInit=Y,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@xwiki/cristal-model-api"),require("@xwiki/cristal-navigation-tree-api"),require("@xwiki/cristal-navigation-tree-default"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-model-api","@xwiki/cristal-navigation-tree-api","@xwiki/cristal-navigation-tree-default","inversify"],l):(i=typeof globalThis<"u"?globalThis:i||self,l(i["cristal_navigation-tree-filesystem"]={},i.cristalModelApi,i.cristalNavigationTreeApi,i.cristalNavigationTreeDefault,i.inversify))})(this,function(i,l,f,g,c){"use strict";var m=Object.getOwnPropertyDescriptor,h=(t,e,n,a)=>{for(var o=a>1?void 0:a?m(e,n):e,s=t.length-1,r;s>=0;s--)(r=t[s])&&(o=r(o)||o);return o},u=(t,e)=>(n,a)=>e(n,a,t);let d=class{constructor(t,e){this.logger=t,this.logger.setModule("navigation-tree-filesystem.components.FileSystemNavigationTreeSource"),this.cristalApp=e}async getChildNodes(t){const e=t||"",n=[],{fileSystemStorage:a}=window,o=await a.listChildren(e);for(const s of o)if(s!=="attachments"){const r=`${e}${e?"/":""}${s}`,p=await this.cristalApp.getPage(r);n.push({id:r,label:p&&p.name?p.name:s,location:new l.SpaceReference(void 0,...r.split("/")),url:this.cristalApp.getRouter().resolve({name:"view",params:{page:r}}).href,has_children:(await a.listChildren(r)).filter(w=>w!="attachments").length>0,is_terminal:!1})}return n}getParentNodesId(t,e,n){return g.getParentNodesIdFromPath(t,n)}};d=h([c.injectable(),u(0,c.inject("Logger")),u(1,c.inject("CristalApp"))],d);class v{constructor(e){e.bind(f.name).to(d).inSingletonScope().whenNamed("FileSystem")}}i.ComponentInit=v,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
12
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.3.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/esm/index.js","../../../../node_modules/.pnpm/@inversifyjs+core@6.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/esm/index.js","../src/components/componentsInit.ts"],"sourcesContent":["function t(t){return n=>(n.push(...t),n)}function n(t){return n=>(n.push(t),n)}function e(t,n){return e=>(e[n]=t,e)}function u(){return[]}function f(){return new Map}function c(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function a(t,n,e){return Reflect.getMetadata(n,t,e)}function r(t,n,e,u){Reflect.defineMetadata(n,e,t,u)}function i(t,n,e,u,f){const a=u(c(t,n,f)??e());Reflect.defineMetadata(n,a,t,f)}function o(t,n,e,u,f){const c=u(a(t,n,f)??e());Reflect.defineMetadata(n,c,t,f)}export{t as buildArrayMetadataWithArray,n as buildArrayMetadataWithElement,e as buildArrayMetadataWithIndex,u as buildEmptyArrayMetadata,f as buildEmptyMapMetadata,c as getOwnReflectMetadata,a as getReflectMetadata,r as setReflectMetadata,i as updateOwnReflectMetadata,o as updateReflectMetadata};\n//# sourceMappingURL=index.js.map\n","import{getOwnReflectMetadata as e,setReflectMetadata as t,updateOwnReflectMetadata as n}from\"@inversifyjs/reflect-metadata-utils\";import{getBaseType as i}from\"@inversifyjs/prototype-utils\";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as s}from\"@inversifyjs/common\";const a=\"@inversifyjs/container/bindingId\";function c(){const i=e(Object,a)??0;return i===Number.MAX_SAFE_INTEGER?t(Object,a,Number.MIN_SAFE_INTEGER):n(Object,a,()=>i,e=>e+1),i}const d={Request:\"Request\",Singleton:\"Singleton\",Transient:\"Transient\"},u={ConstantValue:\"ConstantValue\",DynamicValue:\"DynamicValue\",Factory:\"Factory\",Instance:\"Instance\",Provider:\"Provider\",ResolvedValue:\"ResolvedValue\",ServiceRedirection:\"ServiceRedirection\"};function*l(...e){for(const t of e)yield*t}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=this.#r(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error(\"Expecting model relation, none found\");for(const o of i)o[e]===t&&this.#d(n,o);this.#e.delete(n)}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#u(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting model to be cloned, none found\");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting relation to be cloned, none found\");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#u(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#u(o,n),e)}}#d(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n])}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var f,v,h;!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(f||(f={}));class g{#f;#v;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new g(e)}add(e,t){this.#f.add(e,t)}clone(){return new g(this.#v,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e)}}function m(e){return e.isRight?{isRight:!0,value:e.value}:e}function y(e){switch(e.type){case u.ConstantValue:case u.DynamicValue:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case u.Factory:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Instance:return function(e){return{cache:m(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Provider:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ResolvedValue:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id=\"id\",e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(v||(v={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}class I{#h;#v;constructor(e,t){this.#h=t??new M({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new I(e)}clone(){return new I(this.#v,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#v()?.get(e)}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#v();void 0!==n&&(yield*n.getChained(e))}getBoundServices(){const e=new Set(this.#h.getAllKeys(v.serviceId)),t=this.#v();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#h.get(v.id,e)??this.#v()?.getById(e)}getByModuleId(e){return this.#h.get(v.moduleId,e)??this.#v()?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(v.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(v.serviceId)}removeById(e){this.#h.removeByRelation(v.id,e)}removeAllByModuleId(e){this.#h.removeByRelation(v.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(v.serviceId,e)}set(e){const t={[v.id]:e.id,[v.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[v.moduleId]=e.moduleId),this.#h.add(e,t)}}!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(h||(h={}));class w{#g;#v;constructor(e,t){this.#g=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new w(e)}add(e,t){this.#g.add(e,t)}clone(){return new w(this.#v,this.#g.clone())}get(e){const t=[],n=this.#g.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#g.removeByRelation(h.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(h.serviceId,e)}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if(\"number\"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const S=\"@inversifyjs/core/classMetadataReflectKey\";function C(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N=\"@inversifyjs/core/pendingClassMetadataCountReflectKey\";const T=Symbol.for(\"@inversifyjs/core/InversifyCoreError\");class j extends Error{[T];kind;constructor(e,t,n){super(t,n),this[T]=!0,this.kind=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[T]}static isErrorOfKind(e,t){return j.is(e)&&e.kind===t}}var P,A,R;function x(t){const n=e(t,S)??C();if(!function(t){const n=e(t,N);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\". \"${e.name}\" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\" at constructor indexes \"${n.join('\", \"')}\".\\n\\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==A.unknown||n.push(` - Missing or incomplete metadata for type \"${e.name}\" at constructor argument with index ${i.toString()}.\\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===A.unknown&&n.push(` - Missing or incomplete metadata for type \"${e.name}\" at property \"${i.toString()}\".\\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new j(P.unknown,`Unexpected class metadata for type \"${e.name}\" with uncompletion traces.\\nThis might be caused by one of the following reasons:\\n\\n1. A third party library is targeting inversify reflection metadata.\\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new j(P.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\\n\\n${n.join(\"\\n\\n\")}`)}(t,n)}function B(){return 0}function $(e){return t=>{void 0!==t&&t.kind===A.unknown&&n(e,N,B,e=>e-1)}}function D(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\");return t(i,...n)}}function k(e){if(e.kind!==A.unknown&&!0!==e.isFromTypescriptParamType)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\")}!function(e){e[e.injectionDecoratorConflict=0]=\"injectionDecoratorConflict\",e[e.missingInjectionDecorator=1]=\"missingInjectionDecorator\",e[e.planning=2]=\"planning\",e[e.resolution=3]=\"resolution\",e[e.unknown=4]=\"unknown\"}(P||(P={})),function(e){e[e.unknown=32]=\"unknown\"}(A||(A={})),function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\",e[e.unmanaged=2]=\"unmanaged\"}(R||(R={}));const F=D(function(e,t,n){return e===R.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return k(e),t===R.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function V(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var O;function E(e,t,n,i){if(j.isErrorOfKind(i,P.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new j(P.unknown,\"Unexpected undefined property and index values\");return{kind:O.property,property:t,targetClass:e.constructor}}return\"number\"==typeof n?{index:n,kind:O.parameter,targetClass:e}:{kind:O.method,method:t,targetClass:e}}(e,t,n);throw new j(P.injectionDecoratorConflict,`Unexpected injection error.\\n\\nCause:\\n\\n${i.message}\\n\\nDetails\\n\\n${function(e){switch(e.kind){case O.method:return`[class: \"${e.targetClass.name}\", method: \"${e.method.toString()}\"]`;case O.parameter:return`[class: \"${e.targetClass.name}\", index: \"${e.index.toString()}\"]`;case O.property:return`[class: \"${e.targetClass.name}\", property: \"${e.property.toString()}\"]`}}(o)}`,{cause:i})}throw i}function _(e,t){return(i,o,r)=>{try{void 0===r?function(e,t){const i=U(e,t);return(e,t)=>{n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o):\"number\"==typeof r?function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e,t){return\"function\"==typeof e&&void 0===t}(e,t))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\\nFound @inject decorator at method \"${t?.toString()??\"\"}\" at class \"${e.constructor.name}\"`);n(e,S,C,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,t)(i,o,r):function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\\nFound @inject decorator at method \"${t.toString()}\" at class \"${e.constructor.name}\"`);n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o,r)}catch(e){E(i,o,r,e)}}}function U(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function z(e){return _(F(R.singleInjection,e),$)}!function(e){e[e.method=0]=\"method\",e[e.parameter=1]=\"parameter\",e[e.property=2]=\"property\"}(O||(O={}));const K=\"@inversifyjs/core/classIsInjectableFlagReflectKey\";const L=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const i=e(t,\"design:paramtypes\");void 0!==i&&n(t,S,C,function(e){return t=>(e.forEach((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,L.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:R.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(i))}function G(i){return o=>{!function(n){if(void 0!==e(n,K))throw new j(P.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class \"${n.name}\"`);t(n,K,!0)}(o),q(o),void 0!==i&&n(o,S,C,e=>({...e,scope:i}))}}function W(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{i[t]=e})):i=n.constructorArguments,i}function X(e,t,n){let i;return i=e.extendProperties??!0?new Map(l(t.properties,n.properties)):n.properties,i}function H(e){return t=>{const i=x(e.type);n(t,S,C,function(e,t){const n=n=>({constructorArguments:W(e,t,n),lifecycle:n.lifecycle,properties:X(e,t,n),scope:n.scope});return n}(e,i))}}function J(e){return t=>{const n=i(t);if(void 0===n)throw new j(P.injectionDecoratorConflict,`Expected base type for type \"${t.name}\", none found.`);H({...e,type:n})(t)}}function Q(e,t){return _(F(R.multipleInjection,e,t),$)}function Y(e){return t=>{void 0===t&&n(e,N,B,e=>e+1)}}function Z(e){return t=>{const n=t??{kind:A.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return e(n)}}function ee(e){const t=Z(function(e){return t=>{if(void 0!==t.name)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated named decorator\");return t.name=e,t}}(e));return _(t,Y)}function te(e){if(e.optional)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated optional decorator\");return e.optional=!0,e}function ne(){return _(Z(te),Y)}function ie(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated postConstruct decorator\");return e.lifecycle.postConstructMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function oe(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated preDestroy decorator\");return e.lifecycle.preDestroyMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function re(e,t){const n=Z(function(e,t){return n=>{if(n.tags.has(e))throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated tag decorator with existing tag\");return n.tags.set(e,t),n}}(e,t));return _(n,Y)}function se(){return{kind:R.unmanaged}}const ae=D(se,function(e){if(k(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return se()});function ce(){return _(ae(),$)}var de;!function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\"}(de||(de={}));class ue{#m;constructor(e){this.#m=e}get name(){return this.#m.elem.name}get serviceIdentifier(){return this.#m.elem.serviceIdentifier}get tags(){return this.#m.elem.tags}getAncestor(){if(this.#m.elem.getAncestorsCalled=!0,void 0!==this.#m.previous)return new ue(this.#m.previous)}}function le(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===o.length&&void 0!==e.autobindOptions&&\"function\"==typeof i){const t=function(e,t){const n=x(t),i=n.scope??e.scope;return{cache:{isRight:!1,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:u.Instance}}(e.autobindOptions,i);e.operations.setBinding(t),o.push(t)}return o}class pe{last;constructor(e){this.last=e}concat(e){return new pe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function fe(e){return void 0!==e.redirections}function ve(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=s[s.length-1]??n,a=`Ambiguous bindings found for service: \"${o(t)}\".${ye(s)}\\n\\nRegistered bindings:\\n\\n${e.map(e=>function(e){switch(e.type){case u.Instance:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\", implementationType: \"${e.implementationType.name}\" ]`;case u.ServiceRedirection:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", redirection: \"${o(e.targetServiceIdentifier)}\" ]`;default:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\" ]`}}(e.binding)).join(\"\\n\")}\\n\\nTrying to resolve bindings for \"${ge(n,i)}\".${me(r)}`;throw new j(P.planning,a)}t||he(n,i,r,s)}(e,t,r,s,n.elem,i):function(e,t,n,i,o,r){void 0!==e||t||he(n,i,o,r)}(e,t,r,s,n.elem,i)}function he(e,t,n,i){const r=i[i.length-1]??e,s=`No bindings found for service: \"${o(r)}\".\\n\\nTrying to resolve bindings for \"${ge(e,t)}\".${ye(i)}${me(n)}`;throw new j(P.planning,s)}function ge(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function me(e){const t=0===e.tags.size?\"\":`\\n- tags:\\n - ${[...e.tags.keys()].map(e=>e.toString()).join(\"\\n - \")}`;return`\\n\\nBinding constraints:\\n- service identifier: ${o(e.serviceIdentifier)}\\n- name: ${e.name?.toString()??\"-\"}${t}`}function ye(e){return 0===e.length?\"\":`\\n\\n- service redirections:\\n - ${e.map(e=>o(e)).join(\"\\n - \")}`}function Me(e,t,n,i){if(1===e.redirections.length){const[o]=e.redirections;return void(fe(o)&&Me(o,t,n,[...i,o.binding.targetServiceIdentifier]))}ve(e.redirections,t,n,i)}function Ie(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(fe(i)&&Me(i,t,n,[i.binding.targetServiceIdentifier]))}ve(e.bindings,t,n,[])}function we(e){return r.is(e)?e.unwrap():e}function be(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||\"InternalError\"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return\"(No dependency trace)\";return t.map(o).join(\" -> \")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new j(P.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}const Se=Symbol.for(\"@inversifyjs/core/LazyPlanServiceNode\");class Ce{[Se];_serviceIdentifier;_serviceNode;constructor(e){this[Se]=!0,this._serviceIdentifier=e.serviceIdentifier,this._serviceNode=e}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[Se]}invalidate(){this._serviceNode=void 0}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}function Ne(e,t,n){if(void 0!==e&&n.isContextFree){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n)}class Te extends Ce{#y;constructor(e,t){super(t),this.#y=e}_buildPlanServiceNode(){return Ae(this.#y)}}class je extends Ce{#y;#M;#I;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#I=n}_buildPlanServiceNode(){return Be(this.#y,this.#M,this.#I)}}class Pe extends Ce{#y;#M;#w;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#w=n}_buildPlanServiceNode(){return $e(this.#y,this.#M,this.#w)}}function Ae(e){const t=function(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new pe({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}(e),n=new ue(t.last),i=!!e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=le(e,n,{chained:i}),r=[],s={bindings:r,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ke(e,t,o,s,i)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){Ie(s,e.rootConstraints.isOptional??!1,t.last);const[n]=r;s.bindings=n}return s}function Re(e){try{const t=function(e){return e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}}(e),n=e.operations.getPlan(t);if(void 0!==n)return n;const i=Ae(e),o={tree:{root:new Te(e,i)}};return e.operations.setPlan(t,o),o}catch(t){be(e,t)}}function xe(e,t,n){const i={binding:t,classMetadata:e.operations.getClassMetadata(t.implementationType),constructorParams:[],propertyParams:new Map};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function Be(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===R.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===R.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function $e(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===de.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===de.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function De(e,t,n){const i={binding:t,params:[]};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function ke(e,t,n,i,o){const r=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(r);const s=[];for(const i of n)switch(i.type){case u.Instance:s.push(xe(e,i,t));break;case u.ResolvedValue:s.push(De(e,i,t));break;case u.ServiceRedirection:{const n=Fe(e,t,i,o);s.push(n);break}default:s.push({binding:i})}return e.servicesBranch.pop(),s}function Fe(e,t,n,i){const o={binding:n,redirections:[]},r=le(e,new ue(t.last),{chained:i,customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...ke(e,t,r,o,i)),o}function Ve(e,t,n){if(n.kind===R.unmanaged)return;const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===R.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=Be(e,t,n),s=new je(e,t,n,o);return Ne(i,e.operations,s),s}function Oe(e,t,n){const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===de.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=$e(e,t,n),s=new Pe(e,t,n,o);return Ne(i,e.operations,s),s}function Ee(e,t){return e.node.binding.type===u.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Ve(e,n,r);for(const[o,r]of i.properties){const i=Ve(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Oe(e,n,r);return e.node}(e,e.node,t)}class _e{#b;#S;#C;constructor(){this.#b=[],this.#S=8,this.#C=1024}*[Symbol.iterator](){let e=0;for(const t of this.#b){const n=t.deref();void 0===n?++e:yield n}this.#b.length>=this.#S&&this.#N(e)&&this.#T(e)}push(e){const t=new WeakRef(e);if(this.#b.push(t),this.#b.length>=this.#S&&this.#b.length%this.#C===0){let e=0;for(const t of this.#b)void 0===t.deref()&&++e;this.#N(e)&&this.#T(e)}}#T(e){const t=new Array(this.#b.length-e);let n=0;for(const e of this.#b)e.deref()&&(t[n++]=e);this.#b=t}#N(e){return e>=.5*this.#b.length}}class Ue{#j;#P;#A;#R;#x;#B;constructor(){this.#j=new Map,this.#P=this.#$(),this.#A=this.#$(),this.#R=this.#$(),this.#x=this.#$(),this.#B=new _e}clearCache(){for(const e of this.#D())e.clear();for(const e of this.#B)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#k(this.#P,e).get(e.serviceIdentifier):this.#k(this.#x,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#k(this.#A,e).get(e.serviceIdentifier)?.get(e.name):this.#k(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateService(e){this.#F(e),this.#V(e),this.#O(e),this.#E(e),this.#_(e);for(const t of this.#B)t.invalidateService(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#k(this.#P,e).set(e.serviceIdentifier,t):this.#U(this.#U(this.#k(this.#x,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#U(this.#k(this.#A,e),e.serviceIdentifier).set(e.name,t):this.#U(this.#U(this.#U(this.#k(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e){let t=this.#j.get(e.serviceIdentifier);void 0===t&&(t=new Set,this.#j.set(e.serviceIdentifier,t)),t.add(e)}subscribe(e){this.#B.push(e)}#$(){const e=new Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#U(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#k(e,t){return e[this.#z(t)]}#D(){return[this.#j,...this.#P,...this.#A,...this.#R,...this.#x]}#z(e){return e.isMultiple?(e.chained?4:0)|(e.optional?1:0)|2:e.optional?1:0}#V(e){for(const t of this.#A){const n=t.get(e);if(void 0!==n)for(const e of n.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#O(e){for(const t of this.#R){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())for(const e of t.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#L(e){switch(e.binding.type){case u.ServiceRedirection:for(const t of e.redirections)this.#L(t);break;case u.Instance:for(const t of e.constructorParams)void 0!==t&&this.#q(t);for(const t of e.propertyParams.values())this.#q(t);break;case u.ResolvedValue:for(const t of e.params)this.#q(t)}}#q(e){const t=this.#j.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#K(e))}#K(e){if(void 0!==e.bindings)if(Array.isArray(e.bindings))for(const t of e.bindings)this.#L(t);else this.#L(e.bindings)}#_(e){const t=this.#j.get(e);if(void 0!==t)for(const e of t)Ce.is(e)&&(this.#K(e),e.invalidate())}#F(e){for(const t of this.#P){const n=t.get(e);void 0!==n&&Ce.is(n.tree.root)&&(this.#K(n.tree.root),n.tree.root.invalidate())}}#E(e){for(const t of this.#x){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())Ce.is(t.tree.root)&&(this.#K(t.tree.root),t.tree.root.invalidate())}}}function ze(e,t){return s(t)?(e.cache={isRight:!0,value:t},t.then(t=>Ke(e,t))):Ke(e,t)}function Ke(e,t){return e.cache={isRight:!0,value:t},t}function Le(e,t,n){const i=e.getActivations(t);return void 0===i?n:s(n)?qe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(s(t))return qe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function qe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ge(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=s(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return Le(e,t.serviceIdentifier,i)}function We(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return ze(n,Ge(t,n,e(t,n)))}}const Xe=We(function(e,t){return t.value});function He(e){return e}function Je(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case d.Singleton:if(o.cache.isRight)return o.cache.value;return ze(o,Ge(n,o,t(n,i)));case d.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ge(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case d.Transient:return Ge(n,o,t(n,i))}}}const Qe=(e=>Je(He,e))(function(e,t){return t.value(e.context)});const Ye=We(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new j(P.resolution,`Expecting a \"${n.toString()}\" property when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, none found.`);if(\"function\"!=typeof e[n])throw new j(P.resolution,`Expecting a \"${n.toString()}\" method when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new j(P.resolution,`Unexpected error found when calling \"${n.toString()}\" @postConstruct decorated method on class \"${t.implementationType.name}\"`,{cause:e})}if(s(i))return async function(e,t,n){try{await n}catch(n){throw new j(P.resolution,`Unexpected error found when calling \"${t.toString()}\" @postConstruct decorated method on class \"${e.implementationType.name}\"`,{cause:n})}}(t,n,i)}}(e,t,n);return s(i)?i.then(()=>e):e}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return s(r)?r.then(()=>Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const tt=We(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const ot=function(e){return(t,n,i)=>{const o=[];for(const[r,a]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new j(P.resolution,`Expecting metadata at property \"${r.toString()}\", none found`);c.kind!==R.unmanaged&&void 0!==a.bindings&&(n[r]=e(t,a),s(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(pt),rt=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(lt),st=function(e,t,n){return(i,o)=>{const r=e(i,o);return s(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(et(ot)),et(ot)),at=function(e){return(t,n)=>{const i=e(t,n);return s(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt)),ct=(e=>Je(nt,e))(st),dt=(e=>Je(it,e))(at);function ut(e){return pt(e,e.planResult.tree.root)}function lt(e,t){switch(t.binding.type){case u.ConstantValue:return Xe(e,t.binding);case u.DynamicValue:return Qe(e,t.binding);case u.Factory:return Ye(e,t.binding);case u.Instance:return ct(e,t);case u.Provider:return tt(e,t.binding);case u.ResolvedValue:return dt(e,t)}}function pt(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)fe(i)?n.push(...rt(e,i)):n.push(lt(e,i));if(n.some(s))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(fe(t)){const n=rt(e,t);if(1===n.length)return n[0];throw new j(P.resolution,\"Unexpected multiple resolved values on single injection\")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function vt(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&\"function\"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function ht(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return s(n)?gt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(s(i))return gt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function gt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===u.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return s(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?yt(e,t):n.then(()=>yt(e,t))}function yt(e,t){const n=t.cache;return s(n.value)?n.value.then(n=>Mt(e,t,n)):Mt(e,t,n.value)}function Mt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?ht(e,t.serviceIdentifier,n):i.then(()=>ht(e,t.serviceIdentifier,n))}function It(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===d.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=mt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function wt(e,t){const n=e.getBindingsFromModule(t);return It(e,n)}function bt(e,t){const n=e.getBindings(t);return It(e,n)}export{g as ActivationsService,I as BindingService,R as ClassElementMetadataKind,w as DeactivationsService,Ue as PlanResultCacheService,de as ResolvedValueElementMetadataKind,d as bindingScopeValues,u as bindingTypeValues,b as decorate,c as getBindingId,x as getClassMetadata,z as inject,J as injectFromBase,G as injectable,Q as multiInject,ee as named,ne as optional,Re as plan,ie as postConstruct,oe as preDestroy,ut as resolve,It as resolveBindingsDeactivations,wt as resolveModuleDeactivations,bt as resolveServiceDeactivations,re as tagged,ce as unmanaged};\n//# sourceMappingURL=index.js.map\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { SpaceReference } from \"@xwiki/cristal-model-api\";\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { getParentNodesIdFromPath } from \"@xwiki/cristal-navigation-tree-default\";\nimport { Container, inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the FileSystem backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass FileSystemNavigationTreeSource implements NavigationTreeSource {\n private cristalApp: CristalApp;\n public logger: Logger;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.logger = logger;\n this.logger.setModule(\n \"navigation-tree-filesystem.components.FileSystemNavigationTreeSource\",\n );\n this.cristalApp = cristalApp;\n }\n\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n // eslint-disable-next-line\n const { fileSystemStorage } = window as any;\n const children = await fileSystemStorage.listChildren(currentId);\n\n for (const child of children) {\n // Remove attachments folders\n if (child !== \"attachments\") {\n const id = `${currentId}${currentId ? \"/\" : \"\"}${child}`;\n const currentPageData = await this.cristalApp.getPage(id);\n navigationTree.push({\n id: id,\n label:\n currentPageData && currentPageData.name\n ? currentPageData.name\n : child,\n location: new SpaceReference(undefined, ...id.split(\"/\")),\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: id,\n },\n }).href,\n has_children:\n (await fileSystemStorage.listChildren(id)).filter(\n (c: string) => c != \"attachments\",\n ).length > 0,\n is_terminal: false,\n });\n }\n }\n\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n _includeTerminal?: boolean,\n includeRootNode?: boolean,\n ): Array<string> {\n // FileSystem implementation does not handle terminal pages.\n return getParentNodesIdFromPath(page, includeRootNode);\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(FileSystemNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"FileSystem\");\n }\n}\n"],"names":["c","t","n","r","u","i","f","a","v","h","e","S","C","N","T","j","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","q","G","de","FileSystemNavigationTreeSource","logger","cristalApp","id","currentId","navigationTree","fileSystemStorage","children","child","currentPageData","SpaceReference","page","_includeTerminal","includeRootNode","getParentNodesIdFromPath","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":"4jBAAsK,SAASA,EAAEC,EAAEC,EAAE,EAAE,CAAC,OAAO,QAAQ,eAAeA,EAAED,EAAE,CAAC,CAAC,CAAqD,SAASE,EAAEF,EAAEC,EAAE,EAAEE,EAAE,CAAC,QAAQ,eAAeF,EAAE,EAAED,EAAEG,CAAC,CAAC,CAAC,SAASC,EAAEJ,EAAEC,EAAE,EAAEE,EAAEE,EAAE,CAAC,MAAMC,EAAEH,EAAEJ,EAAEC,EAAEC,EAAEI,CAAC,GAAG,EAAC,CAAE,EAAE,QAAQ,eAAeJ,EAAEK,EAAEN,EAAEK,CAAC,CAAC,CCA2nE,IAAIA,EAAEE,EAAEC,GAAG,SAASC,EAAE,CAACA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,GAAEJ,IAAIA,EAAE,CAAA,EAAG,EAA4oE,SAASI,EAAE,CAACA,EAAE,GAAG,KAAKA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,EAAEF,IAAIA,EAAE,CAAA,EAAG,EAAgrC,SAASE,EAAE,CAACA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,EAAED,IAAIA,EAAE,CAAA,EAAG,EAAmqB,MAAME,EAAE,4CAA4C,SAASC,GAAG,CAAC,MAAM,CAAC,qBAAqB,GAAG,UAAU,CAAC,wBAAwB,OAAO,qBAAqB,MAAM,EAAE,WAAW,IAAI,IAAI,MAAM,MAAM,CAAC,CAAC,MAAMC,EAAE,wDAA8DC,EAAE,OAAO,IAAI,sCAAsC,EAAE,MAAMC,UAAU,KAAK,CAAC,CAACD,CAAC,EAAE,KAAK,YAAYJ,EAAET,EAAEC,EAAE,CAAC,MAAMD,EAAEC,CAAC,EAAE,KAAKY,CAAC,EAAE,GAAG,KAAK,KAAKJ,CAAC,CAAC,OAAO,GAAGA,EAAE,CAAC,OAAgB,OAAOA,GAAjB,UAA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,EAAK,GAAGC,CAAS,GAAGA,EAAY,IAAM,EAAE,GAAGI,CAAK,GAChDC,EAAkB,MAAM,KAAK,WAAW,QAAQN,CAAE,EACxDE,EAAe,KAAK,CAClB,GAAIF,EACJ,MACEM,GAAmBA,EAAgB,KAC/BA,EAAgB,KAChBD,EACN,SAAU,IAAIE,EAAAA,eAAe,OAAW,GAAGP,EAAG,MAAM,GAAG,CAAC,EACxD,IAAK,KAAK,WAAW,UAAA,EAAY,QAAQ,CACvC,KAAM,OACN,OAAQ,CACN,KAAMA,CAAA,CACR,CACD,EAAE,KACH,cACG,MAAMG,EAAkB,aAAaH,CAAE,GAAG,OACxCvC,GAAcA,GAAK,aAAA,EACpB,OAAS,EACb,YAAa,EAAA,CACd,CACH,CAGF,OAAOyC,CACT,CAEA,iBACEM,EACAC,EACAC,EACe,CAEf,OAAOC,EAAAA,yBAAyBH,EAAME,CAAe,CACvD,CACF,EA7DMb,EAANe,EAAA,CADCC,EAAA,EAMIC,MAAO,QAAQ,CAAA,EACfA,MAAO,YAAY,CAAA,CAAA,EANlBjB,CAAA,EA+DC,MAAMkB,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAA2BC,EAAAA,IAAwB,EACnD,GAAGpB,CAA8B,EACjC,iBAAA,EACA,UAAU,YAAY,CAC3B,CACF","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { SpaceReference } from \"@xwiki/cristal-model-api\";\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { getParentNodesIdFromPath } from \"@xwiki/cristal-navigation-tree-default\";\nimport { Container, inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the FileSystem backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass FileSystemNavigationTreeSource implements NavigationTreeSource {\n private cristalApp: CristalApp;\n public logger: Logger;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.logger = logger;\n this.logger.setModule(\n \"navigation-tree-filesystem.components.FileSystemNavigationTreeSource\",\n );\n this.cristalApp = cristalApp;\n }\n\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n // eslint-disable-next-line\n const { fileSystemStorage } = window as any;\n const children = await fileSystemStorage.listChildren(currentId);\n\n for (const child of children) {\n // Remove attachments folders\n if (child !== \"attachments\") {\n const id = `${currentId}${currentId ? \"/\" : \"\"}${child}`;\n const currentPageData = await this.cristalApp.getPage(id);\n navigationTree.push({\n id: id,\n label:\n currentPageData && currentPageData.name\n ? currentPageData.name\n : child,\n location: new SpaceReference(undefined, ...id.split(\"/\")),\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: id,\n },\n }).href,\n has_children:\n (await fileSystemStorage.listChildren(id)).filter(\n (c: string) => c != \"attachments\",\n ).length > 0,\n is_terminal: false,\n });\n }\n }\n\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n _includeTerminal?: boolean,\n includeRootNode?: boolean,\n ): Array<string> {\n // FileSystem implementation does not handle terminal pages.\n return getParentNodesIdFromPath(page, includeRootNode);\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(FileSystemNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"FileSystem\");\n }\n}\n"],"names":["FileSystemNavigationTreeSource","logger","cristalApp","id","currentId","navigationTree","fileSystemStorage","children","child","currentPageData","SpaceReference","c","page","_includeTerminal","includeRootNode","getParentNodesIdFromPath","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":"gxBAqCA,IAAMA,EAAN,KAAqE,CAInE,YACoBC,EACIC,EACtB,CACA,KAAK,OAASD,EACd,KAAK,OAAO,UACV,sEAAA,EAEF,KAAK,WAAaC,CACpB,CAEA,MAAM,cAAcC,EAAiD,CACnE,MAAMC,EAAYD,GAAU,GACtBE,EAA4C,CAAA,EAG5C,CAAE,kBAAAC,GAAsB,OACxBC,EAAW,MAAMD,EAAkB,aAAaF,CAAS,EAE/D,UAAWI,KAASD,EAElB,GAAIC,IAAU,cAAe,CAC3B,MAAML,EAAK,GAAGC,CAAS,GAAGA,EAAY,IAAM,EAAE,GAAGI,CAAK,GAChDC,EAAkB,MAAM,KAAK,WAAW,QAAQN,CAAE,EACxDE,EAAe,KAAK,CAClB,GAAIF,EACJ,MACEM,GAAmBA,EAAgB,KAC/BA,EAAgB,KAChBD,EACN,SAAU,IAAIE,EAAAA,eAAe,OAAW,GAAGP,EAAG,MAAM,GAAG,CAAC,EACxD,IAAK,KAAK,WAAW,UAAA,EAAY,QAAQ,CACvC,KAAM,OACN,OAAQ,CACN,KAAMA,CAAA,CACR,CACD,EAAE,KACH,cACG,MAAMG,EAAkB,aAAaH,CAAE,GAAG,OACxCQ,GAAcA,GAAK,aAAA,EACpB,OAAS,EACb,YAAa,EAAA,CACd,CACH,CAGF,OAAON,CACT,CAEA,iBACEO,EACAC,EACAC,EACe,CAEf,OAAOC,EAAAA,yBAAyBH,EAAME,CAAe,CACvD,CACF,EA7DMd,EAANgB,EAAA,CADCC,aAAA,EAMIC,aAAO,QAAQ,CAAA,EACfA,aAAO,YAAY,CAAA,CAAA,EANlBlB,CAAA,EA+DC,MAAMmB,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAA2BC,EAAAA,IAAwB,EACnD,GAAGrB,CAA8B,EACjC,iBAAA,EACA,UAAU,YAAY,CAC3B,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-navigation-tree-filesystem",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "main": "./dist/index.es.js",
29
29
  "dependencies": {
30
- "@xwiki/cristal-electron-storage": "0.21.0",
31
- "@xwiki/cristal-api": "0.21.0",
32
- "@xwiki/cristal-navigation-tree-default": "0.21.0",
33
- "@xwiki/cristal-navigation-tree-api": "0.21.0",
34
- "@xwiki/cristal-model-api": "0.21.0"
30
+ "@xwiki/cristal-api": "0.21.1",
31
+ "@xwiki/cristal-model-api": "0.21.1",
32
+ "@xwiki/cristal-electron-storage": "0.21.1",
33
+ "@xwiki/cristal-navigation-tree-api": "0.21.1",
34
+ "@xwiki/cristal-navigation-tree-default": "0.21.1"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "inversify": "7.x",
@@ -42,7 +42,7 @@
42
42
  "reflect-metadata": "0.2.2",
43
43
  "typescript": "5.9.2",
44
44
  "vite": "7.0.6",
45
- "@xwiki/cristal-dev-config": "0.21.0"
45
+ "@xwiki/cristal-dev-config": "0.21.1"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsc --project tsconfig.json && vite build",