totalum-api-sdk 2.0.25 → 2.0.27
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/README.MD +203 -14
- package/dist/common/endpoints.d.ts +1 -0
- package/dist/common/endpoints.js +1 -0
- package/dist/common/interfaces.d.ts +10 -1
- package/dist/services/CrudService.d.ts +2 -1
- package/dist/services/CrudService.js +6 -0
- package/dist/totalum-sdk.min.js +1 -1
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -92,7 +92,7 @@ const result = await totalumClient.crud.getItems('your_element_table_name', {});
|
|
|
92
92
|
|
|
93
93
|
```html
|
|
94
94
|
<head>
|
|
95
|
-
<script src="https://cdn.jsdelivr.net/npm/totalum-api-sdk@2.0.
|
|
95
|
+
<script src="https://cdn.jsdelivr.net/npm/totalum-api-sdk@2.0.26/dist/totalum-sdk.min.js"></script>
|
|
96
96
|
</head>
|
|
97
97
|
<script>
|
|
98
98
|
//Example of use TotalumSdk in your custom html page
|
|
@@ -142,6 +142,56 @@ const items = result.data.data;
|
|
|
142
142
|
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
### Get nested items
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
|
|
149
|
+
// imagine that you have 3 tables, client, order and product, and you want to get some clients with all orders and the products of the orders
|
|
150
|
+
|
|
151
|
+
const nestedQuery: NestedQuery = {
|
|
152
|
+
client: {
|
|
153
|
+
order: {
|
|
154
|
+
product: {}
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const result = await totalumClient.crud.getNestedData(nestedQuery);
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Get nested items and filter
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
|
|
167
|
+
// As before you have client, order, and product tables, but you now want to only get the client with name 'Jhon' and limit to 10 results
|
|
168
|
+
|
|
169
|
+
const nestedQuery: NestedQuery = {
|
|
170
|
+
client: {
|
|
171
|
+
tableFilter: {
|
|
172
|
+
filter: [{
|
|
173
|
+
name: 'Jhon'
|
|
174
|
+
}],
|
|
175
|
+
sort: {
|
|
176
|
+
name: 1
|
|
177
|
+
},
|
|
178
|
+
pagination: {
|
|
179
|
+
limit: 10,
|
|
180
|
+
page: 0,
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
order: {
|
|
184
|
+
product: {}
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// if you want you can filter to all other nested tables in the same way (adding tableFilter property to the nested table)
|
|
190
|
+
|
|
191
|
+
const result = await totalumClient.crud.getNestedData(nestedQuery);
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
|
|
145
195
|
### delete item by id
|
|
146
196
|
|
|
147
197
|
```javascript
|
|
@@ -362,27 +412,112 @@ const result = await totalumClient.filter.runCustomMongoAggregationQuery(tableEl
|
|
|
362
412
|
|
|
363
413
|
### Upload a file to Totalum (you can upload any file type)
|
|
364
414
|
|
|
415
|
+
### 1. Upload the file to Totalum
|
|
416
|
+
|
|
417
|
+
To scan a document, first you need to upload the file to Totalum. You can do this using the Totalum API directly or using the Totalum SDK.
|
|
418
|
+
|
|
419
|
+
#### 1.1 Transform the file to a blob
|
|
420
|
+
|
|
421
|
+
If you are not using javascript, you will need to do this step using the language you are using. Search
|
|
422
|
+
on internet how to transform a file to a blob in your language. Or also you can ask chatgpt to transform the following examples to your language.
|
|
423
|
+
|
|
424
|
+
Depending on the platform you are using, you will need to transform the file to a blob. Here are some examples:
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
#### From a file input (Frontend)
|
|
428
|
+
|
|
365
429
|
```javascript
|
|
430
|
+
const fileInput = document.getElementById('fileInput');
|
|
431
|
+
const fileBlob = fileInput.files[0];
|
|
432
|
+
```
|
|
433
|
+
#### From a file in storage (Backend)
|
|
366
434
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
const yourFileBlob = new Blob([response.data], { type: response.headers['content-type'] });
|
|
435
|
+
```javascript
|
|
436
|
+
const fs = require('fs');
|
|
437
|
+
const yourFilePath = 'your_file_path'; // example: /user/your_file.pdf
|
|
438
|
+
const fileBlob = fs.readFileSync(yourFilePath);
|
|
439
|
+
```
|
|
373
440
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
|
|
441
|
+
#### From a remote file (Backend)
|
|
442
|
+
|
|
443
|
+
```javascript
|
|
444
|
+
const response = await axios.get('your_file_url', { responseType: 'stream' });
|
|
445
|
+
const fileBlob = response.data;
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
#### From a base64 string (Frontend/Backend)
|
|
449
|
+
|
|
450
|
+
```javascript
|
|
451
|
+
// Convert base64 to binary
|
|
452
|
+
const binaryStr = atob(base64String);
|
|
453
|
+
const len = binaryStr.length;
|
|
454
|
+
const bytes = new Uint8Array(len);
|
|
455
|
+
for (let i = 0; i < len; i++) {
|
|
456
|
+
bytes[i] = binaryStr.charCodeAt(i);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
let fileBlob;
|
|
460
|
+
|
|
461
|
+
// Environment check: Node.js or Browser
|
|
462
|
+
if (typeof process === 'object' && process.version) {
|
|
463
|
+
// Node.js environment
|
|
464
|
+
// Convert Uint8Array to Buffer for Node.js usage
|
|
465
|
+
const buffer = Buffer.from(bytes.buffer);
|
|
466
|
+
// Here, 'buffer' can be used similarly to how you'd use a Blob in the browser
|
|
467
|
+
// Note: Direct Blob emulation isn't possible in Node.js, but Buffer is a close alternative for file handling
|
|
468
|
+
fileBlob = buffer;
|
|
469
|
+
} else {
|
|
470
|
+
// Browser environment
|
|
471
|
+
// Create a Blob from the Uint8Array
|
|
472
|
+
const blob = new Blob([bytes], { type: fileType });
|
|
473
|
+
fileBlob = blob;
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
#### 1.2 Upload the file to Totalum
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
**Using Totalum SDK**
|
|
482
|
+
|
|
483
|
+
```javascript
|
|
484
|
+
|
|
485
|
+
const FormData = require('form-data'); // if you are using node.js
|
|
486
|
+
|
|
487
|
+
const fileName = 'your_file_name.png'; // replace 'your_file_name' with the name of your file, replace .png with the extension of your file
|
|
488
|
+
const file = yourFileBlob // your blob file created in the previous step
|
|
489
|
+
const formData = new FormData();
|
|
490
|
+
formData.append('file', file, fileName);
|
|
491
|
+
const result = await totalumClient.files.uploadFile(formData);
|
|
492
|
+
const fileNameId = result.data.data;
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Using Totalum API**
|
|
496
|
+
|
|
497
|
+
```javascript
|
|
498
|
+
|
|
499
|
+
const FormData = require('form-data'); // if you are using node.js
|
|
500
|
+
|
|
501
|
+
const fileName = 'your_file_name.png'; // replace 'your_file_name' with the name of your file, replace .png with the extension of your file
|
|
502
|
+
const file = yourFileBlob // your blob file created in the previous step
|
|
503
|
+
const formData = new FormData();
|
|
504
|
+
formData.append('file', file, fileName);
|
|
505
|
+
const result = await axios.post('https://api.totalum.app/files/upload', formData, {
|
|
506
|
+
headers: {
|
|
507
|
+
'Content-Type': 'multipart/form-data',
|
|
508
|
+
'api-key': 'your api key here', // replace 'your api key here' with your api key
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
const fileNameId = result.data.data;
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
``` javascript
|
|
380
516
|
|
|
381
517
|
//if you want to link this file to an item, you need to add the fileNameId to the item property of type file
|
|
382
518
|
const result2 = await totalumClient.crud.editItemById('your_element_table_name', 'your_item_id', {'your_file_property_name': {name: fileNameId}});
|
|
383
519
|
// now the file is linked to the item property, and you can see it in the totalum panel.
|
|
384
520
|
|
|
385
|
-
|
|
386
521
|
```
|
|
387
522
|
|
|
388
523
|
### Get the download url of a file
|
|
@@ -459,6 +594,60 @@ const ocrResult = result.data.data;
|
|
|
459
594
|
|
|
460
595
|
```
|
|
461
596
|
|
|
597
|
+
### scan an invoice (get the details of an invoice)
|
|
598
|
+
|
|
599
|
+
```javascript
|
|
600
|
+
|
|
601
|
+
// you can only do scan of a file that is previously uploaded to totalum (see the upload file function)
|
|
602
|
+
// then you can do scan of the file using the file name of the file uploaded
|
|
603
|
+
const fileName = 'your_file_name.png'; // replace 'your_file_name' with the name of your file, replace .png with the extension of your file
|
|
604
|
+
const file = yourFileBlob // replace yourFile with your file object binary blob (in blob format)
|
|
605
|
+
const formData = new FormData();
|
|
606
|
+
formData.append('file', file, fileName);
|
|
607
|
+
const result = await totalumClient.files.uploadFile(formData);
|
|
608
|
+
const fileNameId = result.data.data;
|
|
609
|
+
|
|
610
|
+
const result = await totalumClient.files.scanInvoice(fileNameId);
|
|
611
|
+
const invoiceResult = result.data.data;
|
|
612
|
+
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### scan a document (get the details of a document)
|
|
616
|
+
|
|
617
|
+
```javascript
|
|
618
|
+
|
|
619
|
+
// first upload the file to totalum
|
|
620
|
+
const fileName = 'your_file_name.png'; // replace 'your_file_name' with the name of your file, replace .png with the extension of your file
|
|
621
|
+
const file = yourFileBlob // replace yourFile with your file object binary blob (in blob format)
|
|
622
|
+
const formData = new FormData();
|
|
623
|
+
formData.append('file', file, fileName);
|
|
624
|
+
const result = await totalumClient.files.uploadFile(formData);
|
|
625
|
+
const fileNameId = result.data.data;
|
|
626
|
+
|
|
627
|
+
// define the json properties that you want to extract from the document
|
|
628
|
+
// this is just an example, you can define your own properties following the JSON schema format, the api will return a json with the properties that you define here
|
|
629
|
+
const properties = {
|
|
630
|
+
"fecha": {
|
|
631
|
+
"type": "string",
|
|
632
|
+
"format": "date",
|
|
633
|
+
"description": "introduce here your description for help api to extract this value"
|
|
634
|
+
},
|
|
635
|
+
"import": {
|
|
636
|
+
"type": "number",
|
|
637
|
+
"description": "the import"
|
|
638
|
+
},
|
|
639
|
+
"currency": {
|
|
640
|
+
"type": "string",
|
|
641
|
+
"enum": ["EUR", "USD", "GBP", "OTHER"],
|
|
642
|
+
"description": "if currency is not EUR, USD or GBP set OTHER"
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const result = await totalumClient.files.scanDocument(fileNameId, properties);
|
|
647
|
+
const documentResult = result.data.data;
|
|
648
|
+
|
|
649
|
+
```
|
|
650
|
+
|
|
462
651
|
|
|
463
652
|
## Functions for call OpenAI API without need to have an OpenAI account
|
|
464
653
|
|
package/dist/common/endpoints.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.endpoints = {
|
|
|
6
6
|
crud: {
|
|
7
7
|
getObjectById: 'api/v1/crud/:typeId/:id',
|
|
8
8
|
getObjects: 'api/v1/crud/:typeId',
|
|
9
|
+
getNestedData: 'api/v1/crud/nested',
|
|
9
10
|
createObject: 'api/v1/crud/:typeId',
|
|
10
11
|
editObjectProperties: 'api/v1/crud/:typeId/:id',
|
|
11
12
|
deleteObject: 'api/v1/crud/:typeId/:id',
|
|
@@ -12,6 +12,7 @@ export interface FilterSearchQueryI {
|
|
|
12
12
|
page?: number;
|
|
13
13
|
skip?: number;
|
|
14
14
|
};
|
|
15
|
+
returnCount?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export type FilterLookupSearchQueryI = {
|
|
17
18
|
pagination: {
|
|
@@ -59,9 +60,16 @@ export interface DataValues {
|
|
|
59
60
|
export interface DataProperties {
|
|
60
61
|
[key: string]: fieldValuesEnabled | {
|
|
61
62
|
name: string;
|
|
62
|
-
previousFilename: string;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
+
export interface NestedQuery {
|
|
66
|
+
[tableName: string]: NestedQueryItem;
|
|
67
|
+
}
|
|
68
|
+
interface NestedQueryItem {
|
|
69
|
+
tableFilter?: FilterSearchQueryI;
|
|
70
|
+
propertyName?: string;
|
|
71
|
+
[tableName: string]: NestedQueryItem | FilterSearchQueryI | string;
|
|
72
|
+
}
|
|
65
73
|
export interface AuthOptions {
|
|
66
74
|
token?: {
|
|
67
75
|
accessToken: string;
|
|
@@ -71,3 +79,4 @@ export interface AuthOptions {
|
|
|
71
79
|
};
|
|
72
80
|
baseUrl?: string;
|
|
73
81
|
}
|
|
82
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { FilterSearchQueryI, DataProperties } from "../common/interfaces";
|
|
1
|
+
import { FilterSearchQueryI, DataProperties, NestedQuery } from "../common/interfaces";
|
|
2
2
|
export declare class CrudService {
|
|
3
3
|
private headers;
|
|
4
4
|
private baseUrl;
|
|
5
5
|
constructor(baseUrl: string, headers: any);
|
|
6
6
|
getItemById(itemType: string, id: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
7
|
getItems(itemType: string, query?: FilterSearchQueryI): Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
|
+
getNestedData(nestedQuery: NestedQuery, options?: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
9
|
deleteItemById(itemType: string, id: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
9
10
|
editItemById(itemType: string, id: string, properties: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
10
11
|
createItem(itemType: string, item: DataProperties): Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -31,6 +31,12 @@ class CrudService {
|
|
|
31
31
|
const url = utils_1.UtilsService.getUrl(this.baseUrl, endpoints_1.endpoints.crud.getObjects, { typeId: itemType });
|
|
32
32
|
return axios_1.default.get(url, { params: query, headers: this.headers });
|
|
33
33
|
}
|
|
34
|
+
getNestedData(nestedQuery, options) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const url = utils_1.UtilsService.getUrl(this.baseUrl, endpoints_1.endpoints.crud.getNestedData);
|
|
37
|
+
return axios_1.default.post(url, { nestedQuery: nestedQuery, options: options }, { headers: this.headers });
|
|
38
|
+
});
|
|
39
|
+
}
|
|
34
40
|
deleteItemById(itemType, id) {
|
|
35
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
42
|
const url = utils_1.UtilsService.getUrl(this.baseUrl, endpoints_1.endpoints.crud.deleteObject, { typeId: itemType, id });
|
package/dist/totalum-sdk.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.totalumSdk=t():e.totalumSdk=t()}(this,(()=>(()=>{"use strict";var e={429:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.endpoints=void 0,t.endpoints={crud:{getObjectById:"api/v1/crud/:typeId/:id",getObjects:"api/v1/crud/:typeId",createObject:"api/v1/crud/:typeId",editObjectProperties:"api/v1/crud/:typeId/:id",deleteObject:"api/v1/crud/:typeId/:id",deleteObjectAndSubElements:"api/v1/crud/:typeId/:id/:pageId/subelements",updateLastUsersActions:"api/v1/crud/:typeId/:id/lastUsersActions",addManyToManyReference:"api/v1/crud/:typeId/:id/add-many-to-many-reference",dropManyToManyReference:"api/v1/crud/:typeId/:id/drop-many-to-many-reference",getManyToManyReferencesItems:"api/v1/crud/:typeId/:id/:propertyName"},files:{uploadFile:"api/v1/files/upload",getDownloadUrl:"api/v1/files/download/:fileName",deleteFile:"api/v1/files/:fileName",ocrOfImage:"api/v1/files/ocr/image",ocrOfPdf:"api/v1/files/ocr/pdf",scanInvoice:"api/v1/files/scan-invoice",scanDocument:"api/v1/files/scan-document"},filter:{lookUpFilter:"api/v1/filter/:idPage",customMongoFilter:"api/v1/filter/custom-mongo-filter",runCustomAggregationQuery:"api/v1/filter/custom-mongo-aggregation-query"},pdfTemplate:{generatePdfByTemplate:"api/v1/pdf-template/generatePdfByTemplate/:id"},googleIntegration:{getEmails:"api/v1/google-integration/get-emails",sendEmail:"api/v1/google-integration/send-email",getCalendarEvents:"api/v1/google-integration/get-calendar-events",createCalendarEvent:"api/v1/google-integration/create-calendar-event"},openai:{createCompletion:"api/v1/openai/completion",createChatCompletion:"api/v1/openai/chat-completion",generateImage:"api/v1/openai/image"}}},999:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},492:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.TotalumApiSdk=void 0;const i=n(730),s=n(675),a=n(589),c=n(882);o(n(999),t),t.TotalumApiSdk=class{constructor(e){var t,n;if(this._baseUrl="https://api.totalum.app/",this.authOptions=e,null===(t=this.authOptions.token)||void 0===t?void 0:t.accessToken)this._headers={authorization:this.authOptions.token.accessToken};else{if(!(null===(n=this.authOptions.apiKey)||void 0===n?void 0:n["api-key"]))throw new Error("Error: invalid auth options");this._headers={"api-key":this.authOptions.apiKey["api-key"]}}this.authOptions.baseUrl&&(this._baseUrl=this.authOptions.baseUrl),this.authOptions.fromEvent&&(this._headers.fromEvent="true"),this.setRequestData()}changeBaseUrl(e){this._baseUrl=e,this.setRequestData()}setRequestData(){this.crud=new c.CrudService(this._baseUrl,this._headers),this.openai=new i.OpenaiService(this._baseUrl,this._headers),this.files=new a.FilesService(this._baseUrl,this._headers),this.filter=new s.FilterService(this._baseUrl,this._headers)}}},882:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CrudService=void 0;const i=o(n(218)),s=n(591),a=n(429);t.CrudService=class{constructor(e,t){this.headers=t,this.baseUrl=e}getItemById(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getObjectById,{typeId:e,id:t});return i.default.get(n,{headers:this.headers})}))}getItems(e,t){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getObjects,{typeId:e});return i.default.get(n,{params:t,headers:this.headers})}deleteItemById(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.deleteObject,{typeId:e,id:t});return i.default.delete(n,{headers:this.headers})}))}editItemById(e,t,n){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.editObjectProperties,{typeId:e,id:t});return i.default.patch(r,n,{headers:this.headers})}))}createItem(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.createObject,{typeId:e});return i.default.post(n,t,{headers:this.headers})}))}addManyToManyReferenceItem(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.addManyToManyReference,{typeId:e,id:t});return i.default.patch(r,{propertyId:n,referenceId:o},{headers:this.headers})}))}dropManyToManyReferenceItem(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.dropManyToManyReference,{typeId:e,id:t});return i.default.patch(r,{propertyId:n,referenceId:o},{headers:this.headers})}))}getManyToManyReferencesItems(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getManyToManyReferencesItems,{typeId:e,id:t,propertyName:n});return i.default.get(r,{params:o,headers:this.headers})}))}}},589:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FilesService=void 0;const i=o(n(218)),s=n(591),a=n(429);t.FilesService=class{constructor(e,t){this.headers=t,this.baseUrl=e}uploadFile(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.uploadFile);return i.default.post(t,e,{headers:this.headers})}))}getDownloadUrl(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.getDownloadUrl,{fileName:e});return i.default.get(n,{headers:this.headers,params:t})}))}generatePdfByTemplate(e,t,n){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.pdfTemplate.generatePdfByTemplate,{id:e});return i.default.post(r,{templateId:e,variables:t,name:n},{headers:this.headers})}))}ocrOfImage(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.ocrOfImage);return i.default.post(t,{fileName:e},{headers:this.headers})}))}ocrOfPdf(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.ocrOfPdf);return i.default.post(t,{fileName:e},{headers:this.headers})}))}scanInvoice(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.scanInvoice);return i.default.post(n,{fileName:e,options:t},{headers:this.headers})}))}scanDocument(e,t,n){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.scanDocument);return i.default.post(r,{fileName:e,properties:t,options:n},{headers:this.headers})}))}}},675:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FilterService=void 0;const i=o(n(218)),s=n(429),a=n(591);t.FilterService=class{constructor(e,t){this.headers=t,this.baseUrl=e}lookUpFilter(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=a.UtilsService.getUrl(this.baseUrl,s.endpoints.filter.lookUpFilter,{idPage:e}),c={query:encodeURIComponent(JSON.stringify(t)),idsOfMultipleNodesToSearch:encodeURIComponent(JSON.stringify(n)),returnCount:o};return i.default.get(r,{params:c,headers:this.headers})}))}runCustomMongoAggregationQuery(e,t){return r(this,void 0,void 0,(function*(){const n=a.UtilsService.getUrl(this.baseUrl,s.endpoints.filter.runCustomAggregationQuery),r={customMongoQuery:t,type:e};return i.default.post(n,r,{headers:this.headers})}))}}},730:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OpenaiService=void 0;const i=o(n(218)),s=n(591),a=n(429);t.OpenaiService=class{constructor(e,t){this.headers=t,this.baseUrl=e}createCompletion(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.openai.createCompletion),n=e;return i.default.post(t,n,{headers:this.headers})}))}createChatCompletion(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.openai.createChatCompletion),n=e;return i.default.post(t,n,{headers:this.headers})}))}generateImage(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.openai.generateImage),n=e;return i.default.post(t,n,{headers:this.headers})}))}}},591:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UtilsService=void 0,t.UtilsService=class{static getUrl(e,t,n){let r=e+t;for(const e in n)r=r.replace(`:${e}`,n[e]);return r}}},218:(e,t,n)=>{function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,s=(a=Object.create(null),e=>{const t=o.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,d=u("undefined"),f=c("ArrayBuffer"),p=u("string"),h=u("function"),m=u("number"),y=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=c("Date"),v=c("File"),w=c("Blob"),O=c("FileList"),S=c("URLSearchParams");function E(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function U(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,_=e=>!d(e)&&e!==R,T=(A="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>A&&e instanceof A);var A;const j=c("HTMLFormElement"),P=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),C=c("RegExp"),x=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};E(n,((n,o)=>{!1!==t(n,o,e)&&(r[o]=n)})),Object.defineProperties(e,r)},N="abcdefghijklmnopqrstuvwxyz",I="0123456789",F={DIGIT:I,ALPHA:N,ALPHA_DIGIT:N+N.toUpperCase()+I},D=c("AsyncFunction");var B={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=s(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:g,isUndefined:d,isDate:b,isFile:v,isBlob:w,isRegExp:C,isFunction:h,isStream:e=>y(e)&&h(e.pipe),isURLSearchParams:S,isTypedArray:T,isFileList:O,forEach:E,merge:function e(){const{caseless:t}=_(this)&&this||{},n={},r=(r,o)=>{const i=t&&U(n,o)||o;g(n[i])&&g(r)?n[i]=e(n[i],r):g(r)?n[i]=e({},r):l(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&E(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:o}={})=>(E(t,((t,o)=>{n&&h(t)?e[o]=r(t,n):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:P,hasOwnProp:P,reduceDescriptors:x,freezeMethods:e=>{x(e,((t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:U,global:R,isContextDefined:_,ALPHABET:F,generateString:(e=16,t=F.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return E(e,((e,t)=>{const i=n(e,r+1);!d(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:D,isThenable:e=>e&&(y(e)||h(e))&&h(e.then)&&h(e.catch)};function L(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}B.inherits(L,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const M=L.prototype,k={};function q(e){return B.isPlainObject(e)||B.isArray(e)}function z(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function H(e,t,n){return e?e.concat(t).map((function(e,t){return e=z(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{k[e]={value:e}})),Object.defineProperties(L,k),Object.defineProperty(M,"isAxiosError",{value:!0}),L.from=(e,t,n,r,o,i)=>{const s=Object.create(M);return B.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),L.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const J=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)}));function K(e,t,n){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=B.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!a&&B.isBlob(e))throw new L("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(B.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(q)}(e)||(B.isFileList(e)||B.endsWith(n,"[]"))&&(a=B.toArray(e)))return n=z(n),a.forEach((function(e,r){!B.isUndefined(e)&&null!==e&&t.append(!0===s?H([n],r,i):null===s?n:n+"[]",c(e))})),!1;return!!q(e)||(t.append(H(o,n,i),c(e)),!1)}const l=[],d=Object.assign(J,{defaultVisitor:u,convertValue:c,isVisitable:q});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!B.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),B.forEach(n,(function(n,i){!0===(!(B.isUndefined(n)||null===n)&&o.call(t,n,B.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])})),l.pop()}}(e),t}function W(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function V(e,t){this._pairs=[],e&&K(e,this,t)}const $=V.prototype;function G(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Q(e,t,n){if(!t)return e;const r=n&&n.encode||G,o=n&&n.serialize;let i;if(i=o?o(t,n):B.isURLSearchParams(t)?t.toString():new V(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,W)}:W;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var X=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,n,r,o){let i=e[o++];const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&B.isArray(r)?r.length:i,a?(B.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&B.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&B.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(B.isFormData(e)&&B.isFunction(e.entries)){const n={};return B.forEachEntry(e,((e,r)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const te={"Content-Type":void 0},ne={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=B.isObject(e);if(o&&B.isHTMLForm(e)&&(e=new FormData(e)),B.isFormData(e))return r&&r?JSON.stringify(ee(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return K(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Y.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=B.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return K(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(B.isString(e))try{return(0,JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ne.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&B.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw L.from(e,L.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};B.forEach(["delete","get","head"],(function(e){ne.headers[e]={}})),B.forEach(["post","put","patch"],(function(e){ne.headers[e]=B.merge(te)}));var re=ne;const oe=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ie=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:B.isArray(e)?e.map(ae):String(e)}function ce(e,t,n,r,o){return B.isFunction(r)?r.call(this,t,n):(o&&(t=n),B.isString(t)?B.isString(r)?-1!==t.indexOf(r):B.isRegExp(r)?r.test(t):void 0:void 0)}class ue{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=se(t);if(!o)throw new Error("header name must be a non-empty string");const i=B.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ae(e))}const i=(e,t)=>B.forEach(e,((e,n)=>o(e,n,t)));return B.isPlainObject(e)||e instanceof this.constructor?i(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&oe[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=se(e)){const n=B.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(B.isFunction(t))return t.call(this,e,n);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const n=B.findKey(this,e);return!(!n||void 0===this[n]||t&&!ce(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=se(e)){const o=B.findKey(n,e);!o||t&&!ce(0,n[o],o,t)||(delete n[o],r=!0)}}return B.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ce(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return B.forEach(this,((r,o)=>{const i=B.findKey(n,o);if(i)return t[i]=ae(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=ae(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&B.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[ie]=this[ie]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=se(e);t[r]||(function(e,t){const n=B.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return B.isArray(e)?e.forEach(r):r(e),this}}ue.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.freezeMethods(ue.prototype),B.freezeMethods(ue);var le=ue;function de(e,t){const n=this||re,r=t||n,o=le.from(r.headers);let i=r.data;return B.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function fe(e){return!(!e||!e.__CANCEL__)}function pe(e,t,n){L.call(this,null==e?"canceled":e,L.ERR_CANCELED,t,n),this.name="CanceledError"}B.inherits(pe,L,{__CANCEL__:!0});var he=Y.isStandardBrowserEnv?{write:function(e,t,n,r,o,i){const s=[];s.push(e+"="+encodeURIComponent(t)),B.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),B.isString(r)&&s.push("path="+r),B.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function me(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var ye=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=B.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function ge(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const u={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}const be={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=le.from(e.headers).normalize(),i=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}B.isFormData(r)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const u=me(e.baseURL,e.url);function l(){if(!c)return;const r=le.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new L("Request failed with status code "+n.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),a()}),(function(e){n(e),a()}),{data:i&&"text"!==i&&"json"!==i?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:r,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Q(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=l:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(l)},c.onabort=function(){c&&(n(new L("Request aborted",L.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new L("Network Error",L.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new L(t,r.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,e,c)),c=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||ye(u))&&e.xsrfCookieName&&he.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in c&&B.forEach(o.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),i&&"json"!==i&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",ge(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",ge(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{c&&(n(!t||t.type?new pe(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Y.protocols.indexOf(d)?n(new L("Unsupported protocol "+d+":",L.ERR_BAD_REQUEST,e)):c.send(r||null)}))}};B.forEach(be,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));function ve(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function we(e){return ve(e),e.headers=le.from(e.headers),e.data=de.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),(e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;o<t&&(n=e[o],!(r=B.isString(n)?be[n.toLowerCase()]:n));o++);if(!r){if(!1===r)throw new L(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(B.hasOwnProp(be,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!B.isFunction(r))throw new TypeError("adapter is not a function");return r})(e.adapter||re.adapter)(e).then((function(t){return ve(e),t.data=de.call(e,e.transformResponse,t),t.headers=le.from(t.headers),t}),(function(t){return fe(t)||(ve(e),t&&t.response&&(t.response.data=de.call(e,e.transformResponse,t.response),t.response.headers=le.from(t.response.headers))),Promise.reject(t)}))}const Oe=e=>e instanceof le?e.toJSON():e;function Se(e,t){t=t||{};const n={};function r(e,t,n){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:n},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function o(e,t,n){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!B.isUndefined(t))return r(void 0,t)}function s(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(Oe(e),Oe(t),!0)};return B.forEach(Object.keys(Object.assign({},e,t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);B.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Ee={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ee[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const Ue={};Ee.transitional=function(e,t,n){function r(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new L(r(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!Ue[o]&&(Ue[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Re={assertOptions:function(e,t,n){if("object"!=typeof e)throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new L("option "+i+" must be "+n,L.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}},validators:Ee};const _e=Re.validators;class Te{constructor(e){this.defaults=e,this.interceptors={request:new X,response:new X}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Se(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;let i;void 0!==n&&Re.assertOptions(n,{silentJSONParsing:_e.transitional(_e.boolean),forcedJSONParsing:_e.transitional(_e.boolean),clarifyTimeoutError:_e.transitional(_e.boolean)},!1),null!=r&&(B.isFunction(r)?t.paramsSerializer={serialize:r}:Re.assertOptions(r,{encode:_e.function,serialize:_e.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=o&&B.merge(o.common,o[t.method]),i&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=le.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,d=0;if(!a){const e=[we.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=s.length;let f=t;for(d=0;d<l;){const e=s[d++],t=s[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=we.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return Q(me((e=Se(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}B.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,n){return this.request(Se(n||{},{method:e,url:t,data:(n||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(Se(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Te.prototype[e]=t(),Te.prototype[e+"Form"]=t(!0)}));var Ae=Te;class je{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new pe(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new je((function(t){e=t})),cancel:e}}}var Pe=je;const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ce).forEach((([e,t])=>{Ce[t]=e}));var xe=Ce;const Ne=function e(t){const n=new Ae(t),o=r(Ae.prototype.request,n);return B.extend(o,Ae.prototype,n,{allOwnKeys:!0}),B.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(Se(t,n))},o}(re);Ne.Axios=Ae,Ne.CanceledError=pe,Ne.CancelToken=Pe,Ne.isCancel=fe,Ne.VERSION="1.4.0",Ne.toFormData=K,Ne.AxiosError=L,Ne.Cancel=Ne.CanceledError,Ne.all=function(e){return Promise.all(e)},Ne.spread=function(e){return function(t){return e.apply(null,t)}},Ne.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},Ne.mergeConfig=Se,Ne.AxiosHeaders=le,Ne.formToJSON=e=>ee(B.isHTMLForm(e)?new FormData(e):e),Ne.HttpStatusCode=xe,Ne.default=Ne,e.exports=Ne}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}return n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(492)})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.totalumSdk=t():e.totalumSdk=t()}(this,(()=>(()=>{"use strict";var e={429:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.endpoints=void 0,t.endpoints={crud:{getObjectById:"api/v1/crud/:typeId/:id",getObjects:"api/v1/crud/:typeId",getNestedData:"api/v1/crud/nested",createObject:"api/v1/crud/:typeId",editObjectProperties:"api/v1/crud/:typeId/:id",deleteObject:"api/v1/crud/:typeId/:id",deleteObjectAndSubElements:"api/v1/crud/:typeId/:id/:pageId/subelements",updateLastUsersActions:"api/v1/crud/:typeId/:id/lastUsersActions",addManyToManyReference:"api/v1/crud/:typeId/:id/add-many-to-many-reference",dropManyToManyReference:"api/v1/crud/:typeId/:id/drop-many-to-many-reference",getManyToManyReferencesItems:"api/v1/crud/:typeId/:id/:propertyName"},files:{uploadFile:"api/v1/files/upload",getDownloadUrl:"api/v1/files/download/:fileName",deleteFile:"api/v1/files/:fileName",ocrOfImage:"api/v1/files/ocr/image",ocrOfPdf:"api/v1/files/ocr/pdf",scanInvoice:"api/v1/files/scan-invoice",scanDocument:"api/v1/files/scan-document"},filter:{lookUpFilter:"api/v1/filter/:idPage",customMongoFilter:"api/v1/filter/custom-mongo-filter",runCustomAggregationQuery:"api/v1/filter/custom-mongo-aggregation-query"},pdfTemplate:{generatePdfByTemplate:"api/v1/pdf-template/generatePdfByTemplate/:id"},googleIntegration:{getEmails:"api/v1/google-integration/get-emails",sendEmail:"api/v1/google-integration/send-email",getCalendarEvents:"api/v1/google-integration/get-calendar-events",createCalendarEvent:"api/v1/google-integration/create-calendar-event"},openai:{createCompletion:"api/v1/openai/completion",createChatCompletion:"api/v1/openai/chat-completion",generateImage:"api/v1/openai/image"}}},999:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},492:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.TotalumApiSdk=void 0;const i=n(730),s=n(675),a=n(589),c=n(882);o(n(999),t),t.TotalumApiSdk=class{constructor(e){var t,n;if(this._baseUrl="https://api.totalum.app/",this.authOptions=e,null===(t=this.authOptions.token)||void 0===t?void 0:t.accessToken)this._headers={authorization:this.authOptions.token.accessToken};else{if(!(null===(n=this.authOptions.apiKey)||void 0===n?void 0:n["api-key"]))throw new Error("Error: invalid auth options");this._headers={"api-key":this.authOptions.apiKey["api-key"]}}this.authOptions.baseUrl&&(this._baseUrl=this.authOptions.baseUrl),this.authOptions.fromEvent&&(this._headers.fromEvent="true"),this.setRequestData()}changeBaseUrl(e){this._baseUrl=e,this.setRequestData()}setRequestData(){this.crud=new c.CrudService(this._baseUrl,this._headers),this.openai=new i.OpenaiService(this._baseUrl,this._headers),this.files=new a.FilesService(this._baseUrl,this._headers),this.filter=new s.FilterService(this._baseUrl,this._headers)}}},882:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CrudService=void 0;const i=o(n(218)),s=n(591),a=n(429);t.CrudService=class{constructor(e,t){this.headers=t,this.baseUrl=e}getItemById(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getObjectById,{typeId:e,id:t});return i.default.get(n,{headers:this.headers})}))}getItems(e,t){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getObjects,{typeId:e});return i.default.get(n,{params:t,headers:this.headers})}getNestedData(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getNestedData);return i.default.post(n,{nestedQuery:e,options:t},{headers:this.headers})}))}deleteItemById(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.deleteObject,{typeId:e,id:t});return i.default.delete(n,{headers:this.headers})}))}editItemById(e,t,n){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.editObjectProperties,{typeId:e,id:t});return i.default.patch(r,n,{headers:this.headers})}))}createItem(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.createObject,{typeId:e});return i.default.post(n,t,{headers:this.headers})}))}addManyToManyReferenceItem(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.addManyToManyReference,{typeId:e,id:t});return i.default.patch(r,{propertyId:n,referenceId:o},{headers:this.headers})}))}dropManyToManyReferenceItem(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.dropManyToManyReference,{typeId:e,id:t});return i.default.patch(r,{propertyId:n,referenceId:o},{headers:this.headers})}))}getManyToManyReferencesItems(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.crud.getManyToManyReferencesItems,{typeId:e,id:t,propertyName:n});return i.default.get(r,{params:o,headers:this.headers})}))}}},589:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FilesService=void 0;const i=o(n(218)),s=n(591),a=n(429);t.FilesService=class{constructor(e,t){this.headers=t,this.baseUrl=e}uploadFile(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.uploadFile);return i.default.post(t,e,{headers:this.headers})}))}getDownloadUrl(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.getDownloadUrl,{fileName:e});return i.default.get(n,{headers:this.headers,params:t})}))}generatePdfByTemplate(e,t,n){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.pdfTemplate.generatePdfByTemplate,{id:e});return i.default.post(r,{templateId:e,variables:t,name:n},{headers:this.headers})}))}ocrOfImage(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.ocrOfImage);return i.default.post(t,{fileName:e},{headers:this.headers})}))}ocrOfPdf(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.ocrOfPdf);return i.default.post(t,{fileName:e},{headers:this.headers})}))}scanInvoice(e,t){return r(this,void 0,void 0,(function*(){const n=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.scanInvoice);return i.default.post(n,{fileName:e,options:t},{headers:this.headers})}))}scanDocument(e,t,n){return r(this,void 0,void 0,(function*(){const r=s.UtilsService.getUrl(this.baseUrl,a.endpoints.files.scanDocument);return i.default.post(r,{fileName:e,properties:t,options:n},{headers:this.headers})}))}}},675:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FilterService=void 0;const i=o(n(218)),s=n(429),a=n(591);t.FilterService=class{constructor(e,t){this.headers=t,this.baseUrl=e}lookUpFilter(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=a.UtilsService.getUrl(this.baseUrl,s.endpoints.filter.lookUpFilter,{idPage:e}),c={query:encodeURIComponent(JSON.stringify(t)),idsOfMultipleNodesToSearch:encodeURIComponent(JSON.stringify(n)),returnCount:o};return i.default.get(r,{params:c,headers:this.headers})}))}runCustomMongoAggregationQuery(e,t){return r(this,void 0,void 0,(function*(){const n=a.UtilsService.getUrl(this.baseUrl,s.endpoints.filter.runCustomAggregationQuery),r={customMongoQuery:t,type:e};return i.default.post(n,r,{headers:this.headers})}))}}},730:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OpenaiService=void 0;const i=o(n(218)),s=n(591),a=n(429);t.OpenaiService=class{constructor(e,t){this.headers=t,this.baseUrl=e}createCompletion(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.openai.createCompletion),n=e;return i.default.post(t,n,{headers:this.headers})}))}createChatCompletion(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.openai.createChatCompletion),n=e;return i.default.post(t,n,{headers:this.headers})}))}generateImage(e){return r(this,void 0,void 0,(function*(){const t=s.UtilsService.getUrl(this.baseUrl,a.endpoints.openai.generateImage),n=e;return i.default.post(t,n,{headers:this.headers})}))}}},591:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UtilsService=void 0,t.UtilsService=class{static getUrl(e,t,n){let r=e+t;for(const e in n)r=r.replace(`:${e}`,n[e]);return r}}},218:(e,t,n)=>{function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,s=(a=Object.create(null),e=>{const t=o.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,d=u("undefined"),f=c("ArrayBuffer"),p=u("string"),h=u("function"),m=u("number"),y=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},v=c("Date"),b=c("File"),w=c("Blob"),O=c("FileList"),S=c("URLSearchParams");function E(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function U(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,_=e=>!d(e)&&e!==R,T=(A="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>A&&e instanceof A);var A;const j=c("HTMLFormElement"),P=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),C=c("RegExp"),N=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};E(n,((n,o)=>{!1!==t(n,o,e)&&(r[o]=n)})),Object.defineProperties(e,r)},x="abcdefghijklmnopqrstuvwxyz",I="0123456789",F={DIGIT:I,ALPHA:x,ALPHA_DIGIT:x+x.toUpperCase()+I},D=c("AsyncFunction");var B={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=s(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:g,isUndefined:d,isDate:v,isFile:b,isBlob:w,isRegExp:C,isFunction:h,isStream:e=>y(e)&&h(e.pipe),isURLSearchParams:S,isTypedArray:T,isFileList:O,forEach:E,merge:function e(){const{caseless:t}=_(this)&&this||{},n={},r=(r,o)=>{const i=t&&U(n,o)||o;g(n[i])&&g(r)?n[i]=e(n[i],r):g(r)?n[i]=e({},r):l(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&E(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:o}={})=>(E(t,((t,o)=>{n&&h(t)?e[o]=r(t,n):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:P,hasOwnProp:P,reduceDescriptors:N,freezeMethods:e=>{N(e,((t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:U,global:R,isContextDefined:_,ALPHABET:F,generateString:(e=16,t=F.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return E(e,((e,t)=>{const i=n(e,r+1);!d(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:D,isThenable:e=>e&&(y(e)||h(e))&&h(e.then)&&h(e.catch)};function L(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}B.inherits(L,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const M=L.prototype,k={};function q(e){return B.isPlainObject(e)||B.isArray(e)}function z(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function H(e,t,n){return e?e.concat(t).map((function(e,t){return e=z(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{k[e]={value:e}})),Object.defineProperties(L,k),Object.defineProperty(M,"isAxiosError",{value:!0}),L.from=(e,t,n,r,o,i)=>{const s=Object.create(M);return B.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),L.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const J=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)}));function K(e,t,n){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=B.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!a&&B.isBlob(e))throw new L("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(B.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(q)}(e)||(B.isFileList(e)||B.endsWith(n,"[]"))&&(a=B.toArray(e)))return n=z(n),a.forEach((function(e,r){!B.isUndefined(e)&&null!==e&&t.append(!0===s?H([n],r,i):null===s?n:n+"[]",c(e))})),!1;return!!q(e)||(t.append(H(o,n,i),c(e)),!1)}const l=[],d=Object.assign(J,{defaultVisitor:u,convertValue:c,isVisitable:q});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!B.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),B.forEach(n,(function(n,i){!0===(!(B.isUndefined(n)||null===n)&&o.call(t,n,B.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])})),l.pop()}}(e),t}function W(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function V(e,t){this._pairs=[],e&&K(e,this,t)}const $=V.prototype;function G(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Q(e,t,n){if(!t)return e;const r=n&&n.encode||G,o=n&&n.serialize;let i;if(i=o?o(t,n):B.isURLSearchParams(t)?t.toString():new V(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,W)}:W;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var X=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,n,r,o){let i=e[o++];const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&B.isArray(r)?r.length:i,a?(B.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&B.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&B.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(B.isFormData(e)&&B.isFunction(e.entries)){const n={};return B.forEachEntry(e,((e,r)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const te={"Content-Type":void 0},ne={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=B.isObject(e);if(o&&B.isHTMLForm(e)&&(e=new FormData(e)),B.isFormData(e))return r&&r?JSON.stringify(ee(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return K(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Y.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=B.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return K(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(B.isString(e))try{return(0,JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ne.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&B.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw L.from(e,L.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};B.forEach(["delete","get","head"],(function(e){ne.headers[e]={}})),B.forEach(["post","put","patch"],(function(e){ne.headers[e]=B.merge(te)}));var re=ne;const oe=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ie=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:B.isArray(e)?e.map(ae):String(e)}function ce(e,t,n,r,o){return B.isFunction(r)?r.call(this,t,n):(o&&(t=n),B.isString(t)?B.isString(r)?-1!==t.indexOf(r):B.isRegExp(r)?r.test(t):void 0:void 0)}class ue{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=se(t);if(!o)throw new Error("header name must be a non-empty string");const i=B.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ae(e))}const i=(e,t)=>B.forEach(e,((e,n)=>o(e,n,t)));return B.isPlainObject(e)||e instanceof this.constructor?i(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&oe[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=se(e)){const n=B.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(B.isFunction(t))return t.call(this,e,n);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const n=B.findKey(this,e);return!(!n||void 0===this[n]||t&&!ce(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=se(e)){const o=B.findKey(n,e);!o||t&&!ce(0,n[o],o,t)||(delete n[o],r=!0)}}return B.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ce(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return B.forEach(this,((r,o)=>{const i=B.findKey(n,o);if(i)return t[i]=ae(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=ae(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&B.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[ie]=this[ie]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=se(e);t[r]||(function(e,t){const n=B.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return B.isArray(e)?e.forEach(r):r(e),this}}ue.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.freezeMethods(ue.prototype),B.freezeMethods(ue);var le=ue;function de(e,t){const n=this||re,r=t||n,o=le.from(r.headers);let i=r.data;return B.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function fe(e){return!(!e||!e.__CANCEL__)}function pe(e,t,n){L.call(this,null==e?"canceled":e,L.ERR_CANCELED,t,n),this.name="CanceledError"}B.inherits(pe,L,{__CANCEL__:!0});var he=Y.isStandardBrowserEnv?{write:function(e,t,n,r,o,i){const s=[];s.push(e+"="+encodeURIComponent(t)),B.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),B.isString(r)&&s.push("path="+r),B.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function me(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var ye=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=B.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function ge(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const u={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}const ve={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=le.from(e.headers).normalize(),i=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}B.isFormData(r)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const u=me(e.baseURL,e.url);function l(){if(!c)return;const r=le.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new L("Request failed with status code "+n.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),a()}),(function(e){n(e),a()}),{data:i&&"text"!==i&&"json"!==i?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:r,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Q(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=l:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(l)},c.onabort=function(){c&&(n(new L("Request aborted",L.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new L("Network Error",L.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new L(t,r.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,e,c)),c=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||ye(u))&&e.xsrfCookieName&&he.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in c&&B.forEach(o.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),i&&"json"!==i&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",ge(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",ge(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{c&&(n(!t||t.type?new pe(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Y.protocols.indexOf(d)?n(new L("Unsupported protocol "+d+":",L.ERR_BAD_REQUEST,e)):c.send(r||null)}))}};B.forEach(ve,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function we(e){return be(e),e.headers=le.from(e.headers),e.data=de.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),(e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;o<t&&(n=e[o],!(r=B.isString(n)?ve[n.toLowerCase()]:n));o++);if(!r){if(!1===r)throw new L(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(B.hasOwnProp(ve,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!B.isFunction(r))throw new TypeError("adapter is not a function");return r})(e.adapter||re.adapter)(e).then((function(t){return be(e),t.data=de.call(e,e.transformResponse,t),t.headers=le.from(t.headers),t}),(function(t){return fe(t)||(be(e),t&&t.response&&(t.response.data=de.call(e,e.transformResponse,t.response),t.response.headers=le.from(t.response.headers))),Promise.reject(t)}))}const Oe=e=>e instanceof le?e.toJSON():e;function Se(e,t){t=t||{};const n={};function r(e,t,n){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:n},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function o(e,t,n){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!B.isUndefined(t))return r(void 0,t)}function s(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(Oe(e),Oe(t),!0)};return B.forEach(Object.keys(Object.assign({},e,t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);B.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Ee={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ee[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const Ue={};Ee.transitional=function(e,t,n){function r(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new L(r(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!Ue[o]&&(Ue[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Re={assertOptions:function(e,t,n){if("object"!=typeof e)throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new L("option "+i+" must be "+n,L.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}},validators:Ee};const _e=Re.validators;class Te{constructor(e){this.defaults=e,this.interceptors={request:new X,response:new X}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Se(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;let i;void 0!==n&&Re.assertOptions(n,{silentJSONParsing:_e.transitional(_e.boolean),forcedJSONParsing:_e.transitional(_e.boolean),clarifyTimeoutError:_e.transitional(_e.boolean)},!1),null!=r&&(B.isFunction(r)?t.paramsSerializer={serialize:r}:Re.assertOptions(r,{encode:_e.function,serialize:_e.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=o&&B.merge(o.common,o[t.method]),i&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=le.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,d=0;if(!a){const e=[we.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=s.length;let f=t;for(d=0;d<l;){const e=s[d++],t=s[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=we.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return Q(me((e=Se(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}B.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,n){return this.request(Se(n||{},{method:e,url:t,data:(n||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(Se(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Te.prototype[e]=t(),Te.prototype[e+"Form"]=t(!0)}));var Ae=Te;class je{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new pe(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new je((function(t){e=t})),cancel:e}}}var Pe=je;const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ce).forEach((([e,t])=>{Ce[t]=e}));var Ne=Ce;const xe=function e(t){const n=new Ae(t),o=r(Ae.prototype.request,n);return B.extend(o,Ae.prototype,n,{allOwnKeys:!0}),B.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(Se(t,n))},o}(re);xe.Axios=Ae,xe.CanceledError=pe,xe.CancelToken=Pe,xe.isCancel=fe,xe.VERSION="1.4.0",xe.toFormData=K,xe.AxiosError=L,xe.Cancel=xe.CanceledError,xe.all=function(e){return Promise.all(e)},xe.spread=function(e){return function(t){return e.apply(null,t)}},xe.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},xe.mergeConfig=Se,xe.AxiosHeaders=le,xe.formToJSON=e=>ee(B.isHTMLForm(e)?new FormData(e):e),xe.HttpStatusCode=Ne,xe.default=xe,e.exports=xe}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}return n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(492)})()));
|