@loopback/testlab 4.0.0-alpha.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +411 -20
  3. package/dist/client.d.ts +25 -0
  4. package/dist/client.js +40 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/expect.d.ts +2 -0
  7. package/{lib/testlab.js → dist/expect.js} +4 -11
  8. package/dist/expect.js.map +1 -0
  9. package/dist/http-error-logger.d.ts +9 -0
  10. package/dist/http-error-logger.js +23 -0
  11. package/dist/http-error-logger.js.map +1 -0
  12. package/dist/http-server-config.d.ts +26 -0
  13. package/dist/http-server-config.js +76 -0
  14. package/dist/http-server-config.js.map +1 -0
  15. package/dist/index.d.ts +31 -0
  16. package/dist/index.js +39 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/request.d.ts +13 -0
  19. package/dist/request.js +40 -0
  20. package/dist/request.js.map +1 -0
  21. package/dist/shot.d.ts +24 -0
  22. package/dist/shot.js +108 -0
  23. package/dist/shot.js.map +1 -0
  24. package/dist/sinon.d.ts +25 -0
  25. package/dist/sinon.js +35 -0
  26. package/dist/sinon.js.map +1 -0
  27. package/dist/skip.d.ts +49 -0
  28. package/dist/skip.js +65 -0
  29. package/dist/skip.js.map +1 -0
  30. package/dist/test-sandbox.d.ts +89 -0
  31. package/dist/test-sandbox.js +139 -0
  32. package/dist/test-sandbox.js.map +1 -0
  33. package/dist/to-json.d.ts +23 -0
  34. package/dist/to-json.js +12 -0
  35. package/dist/to-json.js.map +1 -0
  36. package/dist/validate-api-spec.d.ts +1 -0
  37. package/dist/validate-api-spec.js +16 -0
  38. package/dist/validate-api-spec.js.map +1 -0
  39. package/fixtures/README.md +9 -0
  40. package/fixtures/cert.pem +21 -0
  41. package/fixtures/copy-me.txt +1 -0
  42. package/fixtures/key.pem +28 -0
  43. package/fixtures/pfx.pfx +0 -0
  44. package/package.json +46 -32
  45. package/should-as-function.d.ts +12 -3
  46. package/src/client.ts +57 -0
  47. package/src/expect.ts +15 -0
  48. package/src/http-error-logger.ts +35 -0
  49. package/src/http-server-config.ts +97 -0
  50. package/src/index.ts +37 -0
  51. package/src/request.ts +45 -0
  52. package/src/shot.ts +191 -0
  53. package/src/sinon.ts +38 -0
  54. package/src/skip.ts +76 -0
  55. package/src/test-sandbox.ts +181 -0
  56. package/src/to-json.ts +54 -0
  57. package/src/validate-api-spec.ts +14 -0
  58. package/index.d.ts +0 -6
  59. package/index.js +0 -9
  60. package/lib/client.d.ts +0 -19
  61. package/lib/client.js +0 -31
  62. package/lib/client.js.map +0 -1
  63. package/lib/shot.d.ts +0 -17
  64. package/lib/shot.js +0 -36
  65. package/lib/shot.js.map +0 -1
  66. package/lib/testlab.d.ts +0 -9
  67. package/lib/testlab.js.map +0 -1
  68. package/lib/validate-api-spec.d.ts +0 -2
  69. package/lib/validate-api-spec.js +0 -29
  70. package/lib/validate-api-spec.js.map +0 -1
  71. package/lib6/client.d.ts +0 -19
  72. package/lib6/client.js +0 -41
  73. package/lib6/client.js.map +0 -1
  74. package/lib6/shot.d.ts +0 -17
  75. package/lib6/shot.js +0 -36
  76. package/lib6/shot.js.map +0 -1
  77. package/lib6/testlab.d.ts +0 -9
  78. package/lib6/testlab.js +0 -22
  79. package/lib6/testlab.js.map +0 -1
  80. package/lib6/validate-api-spec.d.ts +0 -2
  81. package/lib6/validate-api-spec.js +0 -39
  82. package/lib6/validate-api-spec.js.map +0 -1
package/lib/shot.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /// <reference types="shot" />
2
- /// <reference types="node" />
3
- import { ServerRequest, ServerResponse } from 'http';
4
- import { RequestOptions as ShotRequestOptions, ResponseObject, inject } from 'shot';
5
- export { inject, ShotRequestOptions };
6
- export declare const ShotRequest: ShotRequestCtor;
7
- export declare const ShotResponse: ShotResponseCtor;
8
- export declare type ShotRequestCtor = new (options: ShotRequestOptions) => ServerRequest;
9
- export declare type ShotCallback = (response: ResponseObject) => void;
10
- export declare type ShotResponseCtor = new (request: ServerRequest, onEnd: ShotCallback) => ServerResponse;
11
- export declare type ShotObservedResponse = ResponseObject;
12
- export interface ShotResponseMock {
13
- request: ServerRequest;
14
- response: ServerResponse;
15
- result: Promise<ShotObservedResponse>;
16
- }
17
- export declare function mockResponse(requestOptions?: ShotRequestOptions): ShotResponseMock;
package/lib/shot.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/testlab
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const util = require("util");
8
- const shot_1 = require("shot");
9
- exports.inject = shot_1.inject;
10
- // tslint:disable-next-line:variable-name
11
- exports.ShotRequest = require('shot/lib/request');
12
- // tslint:disable-next-line:variable-name
13
- exports.ShotResponse = require('shot/lib/response');
14
- function mockResponse(requestOptions = { url: '/' }) {
15
- const request = new exports.ShotRequest(requestOptions);
16
- let response;
17
- let result = new Promise(resolve => {
18
- response = new exports.ShotResponse(request, resolve);
19
- });
20
- // Setup custom inspect functions to make test error messages easier to read
21
- const inspectOpts = (depth) => util.inspect(requestOptions, { depth });
22
- defineCustomInspect(request, depth => `[ShotRequest with options ${inspectOpts(depth)}]`);
23
- defineCustomInspect(response, depth => `[ShotResponse for request with options ${inspectOpts(depth)}]`);
24
- result = result.then(r => {
25
- defineCustomInspect(r, depth => `[ShotObservedResponse for request with options ${inspectOpts(depth)}]`);
26
- return r;
27
- });
28
- return { request, response: response, result };
29
- }
30
- exports.mockResponse = mockResponse;
31
- // tslint:disable:no-any
32
- function defineCustomInspect(obj, inspectFn) {
33
- obj.inspect = obj.toString = inspectFn;
34
- }
35
- // tslint:enable:no-any
36
- //# sourceMappingURL=shot.js.map
package/lib/shot.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"shot.js","sourceRoot":"","sources":["../src/shot.ts"],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A/BD,oCA+BC;AAED,wBAAwB;AACxB,6BAA6B,GAAQ,EAAE,SAAgC;IACrE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC;AACzC,CAAC;AACD,uBAAuB"}
package/lib/testlab.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /// <reference path="../should-as-function.d.ts" />
2
- import 'should-sinon';
3
- import sinon = require('sinon');
4
- import { SinonSpy } from 'sinon';
5
- export declare const expect: Internal;
6
- export { sinon, SinonSpy };
7
- export * from './client';
8
- export * from './shot';
9
- export * from './validate-api-spec';
@@ -1 +0,0 @@
1
- {"version":3,"file":"testlab.js","sourceRoot":"","sources":["../src/testlab.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,mDAAmD;AAEnD,MAAM,gBAAgB,GAAa,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACjE,wBAAsB;AAEtB,+BAAgC;AAQxB,sBAAK;AALb,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;IACzC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,gBAAgB,CAAC;AAGvC,8BAAyB;AACzB,4BAAuB;AACvB,yCAAoC"}
@@ -1,2 +0,0 @@
1
- import { OpenApiSpec } from '@loopback/openapi-spec';
2
- export declare function validateApiSpec(spec: OpenApiSpec): Promise<void>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/testlab
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const SwaggerParser = require("swagger-parser");
8
- async function validateApiSpec(spec) {
9
- const opts = {
10
- $refs: {
11
- internal: false,
12
- external: false,
13
- },
14
- };
15
- // workaround for unhelpful message returned by SwaggerParser
16
- // TODO(bajtos) contribute these improvements to swagger-parser
17
- if (!spec.swagger) {
18
- throw new Error('Missing required property: swagger at #/');
19
- }
20
- if (!spec.info) {
21
- throw new Error('Missing required property: info at #/');
22
- }
23
- if (!spec.paths) {
24
- throw new Error('Missing required property: paths at #/');
25
- }
26
- await SwaggerParser.validate(spec, opts);
27
- }
28
- exports.validateApiSpec = validateApiSpec;
29
- //# sourceMappingURL=validate-api-spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-api-spec.js","sourceRoot":"","sources":["../src/validate-api-spec.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAEhE,gDAAgD;AAGzC,KAAK,0BAA0B,IAAiB;IACrD,MAAM,IAAI,GAA0B;QAClC,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,KAAK;SAChB;KACuB,CAAC;IAE3B,6DAA6D;IAC7D,+DAA+D;IAC/D,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAvBD,0CAuBC"}
package/lib6/client.d.ts DELETED
@@ -1,19 +0,0 @@
1
- /// <reference types="supertest" />
2
- /// <reference types="node" />
3
- import * as http from 'http';
4
- import supertest = require('supertest');
5
- export { supertest };
6
- export declare type Client = supertest.SuperTest<supertest.Test>;
7
- /**
8
- * Create a SuperTest client connected to an HTTP server listening
9
- * on an ephemeral port and calling `handler` to handle incoming requests.
10
- * @param handler
11
- */
12
- export declare function createClientForHandler(handler: (req: http.ServerRequest, res: http.ServerResponse) => void): Client;
13
- export declare function createClientForRestServer(server: RestServer): Promise<Client>;
14
- export interface RestServer {
15
- start(): Promise<void>;
16
- options?: {
17
- [prop: string]: any;
18
- };
19
- }
package/lib6/client.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/testlab
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- /*
16
- * HTTP client utilities
17
- */
18
- const http = require("http");
19
- const supertest = require("supertest");
20
- exports.supertest = supertest;
21
- /**
22
- * Create a SuperTest client connected to an HTTP server listening
23
- * on an ephemeral port and calling `handler` to handle incoming requests.
24
- * @param handler
25
- */
26
- function createClientForHandler(handler) {
27
- const server = http.createServer(handler);
28
- return supertest(server);
29
- }
30
- exports.createClientForHandler = createClientForHandler;
31
- function createClientForRestServer(server) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- yield server.start();
34
- const port = server.options && server.options.http ? server.options.http.port : 3000;
35
- const url = `http://127.0.0.1:${port}`;
36
- // TODO(bajtos) Find a way how to stop the server after all tests are done
37
- return supertest(url);
38
- });
39
- }
40
- exports.createClientForRestServer = createClientForRestServer;
41
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;;;;;;AAEhE;;GAEG;AAEH,6BAA6B;AAC7B,uCAAwC;AAEhC,8BAAS;AAIjB;;;;GAIG;AACH,gCACE,OAAoE;IAEpE,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AALD,wDAKC;AAED,mCACE,MAAkB;;QAElB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,GACR,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,MAAM,GAAG,GAAG,oBAAoB,IAAI,EAAE,CAAC;QACvC,0EAA0E;QAC1E,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CAAA;AATD,8DASC"}
package/lib6/shot.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /// <reference types="shot" />
2
- /// <reference types="node" />
3
- import { ServerRequest, ServerResponse } from 'http';
4
- import { RequestOptions as ShotRequestOptions, ResponseObject, inject } from 'shot';
5
- export { inject, ShotRequestOptions };
6
- export declare const ShotRequest: ShotRequestCtor;
7
- export declare const ShotResponse: ShotResponseCtor;
8
- export declare type ShotRequestCtor = new (options: ShotRequestOptions) => ServerRequest;
9
- export declare type ShotCallback = (response: ResponseObject) => void;
10
- export declare type ShotResponseCtor = new (request: ServerRequest, onEnd: ShotCallback) => ServerResponse;
11
- export declare type ShotObservedResponse = ResponseObject;
12
- export interface ShotResponseMock {
13
- request: ServerRequest;
14
- response: ServerResponse;
15
- result: Promise<ShotObservedResponse>;
16
- }
17
- export declare function mockResponse(requestOptions?: ShotRequestOptions): ShotResponseMock;
package/lib6/shot.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/testlab
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const util = require("util");
8
- const shot_1 = require("shot");
9
- exports.inject = shot_1.inject;
10
- // tslint:disable-next-line:variable-name
11
- exports.ShotRequest = require('shot/lib/request');
12
- // tslint:disable-next-line:variable-name
13
- exports.ShotResponse = require('shot/lib/response');
14
- function mockResponse(requestOptions = { url: '/' }) {
15
- const request = new exports.ShotRequest(requestOptions);
16
- let response;
17
- let result = new Promise(resolve => {
18
- response = new exports.ShotResponse(request, resolve);
19
- });
20
- // Setup custom inspect functions to make test error messages easier to read
21
- const inspectOpts = (depth) => util.inspect(requestOptions, { depth });
22
- defineCustomInspect(request, depth => `[ShotRequest with options ${inspectOpts(depth)}]`);
23
- defineCustomInspect(response, depth => `[ShotResponse for request with options ${inspectOpts(depth)}]`);
24
- result = result.then(r => {
25
- defineCustomInspect(r, depth => `[ShotObservedResponse for request with options ${inspectOpts(depth)}]`);
26
- return r;
27
- });
28
- return { request, response: response, result };
29
- }
30
- exports.mockResponse = mockResponse;
31
- // tslint:disable:no-any
32
- function defineCustomInspect(obj, inspectFn) {
33
- obj.inspect = obj.toString = inspectFn;
34
- }
35
- // tslint:enable:no-any
36
- //# sourceMappingURL=shot.js.map
package/lib6/shot.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"shot.js","sourceRoot":"","sources":["../src/shot.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAQhE,6BAA6B;AAE7B,+BAIc;AAEN,iBAHN,aAAM,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,CAAC;AACzC,CAAC;AACD,uBAAuB"}
package/lib6/testlab.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /// <reference path="../should-as-function.d.ts" />
2
- import 'should-sinon';
3
- import sinon = require('sinon');
4
- import { SinonSpy } from 'sinon';
5
- export declare const expect: Internal;
6
- export { sinon, SinonSpy };
7
- export * from './client';
8
- export * from './shot';
9
- export * from './validate-api-spec';
package/lib6/testlab.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/testlab
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- function __export(m) {
7
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
8
- }
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- /// <reference path="../should-as-function.d.ts" />
11
- const shouldAsFunction = require('should/as-function');
12
- require("should-sinon");
13
- const sinon = require("sinon");
14
- exports.sinon = sinon;
15
- shouldAsFunction.use((should, assertion) => {
16
- assertion.addChain('to');
17
- });
18
- exports.expect = shouldAsFunction;
19
- __export(require("./client"));
20
- __export(require("./shot"));
21
- __export(require("./validate-api-spec"));
22
- //# sourceMappingURL=testlab.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testlab.js","sourceRoot":"","sources":["../src/testlab.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,mDAAmD;AAEnD,MAAM,gBAAgB,GAAa,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACjE,wBAAsB;AAEtB,+BAAgC;AAQxB,sBAAK;AALb,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;IACzC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,gBAAgB,CAAC;AAGvC,8BAAyB;AACzB,4BAAuB;AACvB,yCAAoC"}
@@ -1,2 +0,0 @@
1
- import { OpenApiSpec } from '@loopback/openapi-spec';
2
- export declare function validateApiSpec(spec: OpenApiSpec): Promise<void>;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/testlab
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const SwaggerParser = require("swagger-parser");
16
- function validateApiSpec(spec) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const opts = {
19
- $refs: {
20
- internal: false,
21
- external: false,
22
- },
23
- };
24
- // workaround for unhelpful message returned by SwaggerParser
25
- // TODO(bajtos) contribute these improvements to swagger-parser
26
- if (!spec.swagger) {
27
- throw new Error('Missing required property: swagger at #/');
28
- }
29
- if (!spec.info) {
30
- throw new Error('Missing required property: info at #/');
31
- }
32
- if (!spec.paths) {
33
- throw new Error('Missing required property: paths at #/');
34
- }
35
- yield SwaggerParser.validate(spec, opts);
36
- });
37
- }
38
- exports.validateApiSpec = validateApiSpec;
39
- //# sourceMappingURL=validate-api-spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-api-spec.js","sourceRoot":"","sources":["../src/validate-api-spec.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;;;;;;AAEhE,gDAAgD;AAGhD,yBAAsC,IAAiB;;QACrD,MAAM,IAAI,GAA0B;YAClC,KAAK,EAAE;gBACL,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,KAAK;aAChB;SACuB,CAAC;QAE3B,6DAA6D;QAC7D,+DAA+D;QAC/D,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;CAAA;AAvBD,0CAuBC"}