@next-bricks/visual-builder 1.33.8 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/bricks.json +12 -10
  2. package/dist/chunks/{5814.8ed8f39d.js → 5814.71a79ad9.js} +3 -3
  3. package/dist/chunks/{5814.8ed8f39d.js.map → 5814.71a79ad9.js.map} +1 -1
  4. package/dist/chunks/8144.79397337.js +3 -0
  5. package/dist/chunks/{7150.0e64cf9e.js.LICENSE.txt → 8144.79397337.js.LICENSE.txt} +2 -0
  6. package/dist/chunks/8144.79397337.js.map +1 -0
  7. package/dist/chunks/8989.74e3337d.js +2 -0
  8. package/dist/chunks/{8989.0d8b22ea.js.map → 8989.74e3337d.js.map} +1 -1
  9. package/dist/chunks/{9080.b97eaf67.js → 9080.fe043f12.js} +2 -2
  10. package/dist/chunks/{9080.b97eaf67.js.map → 9080.fe043f12.js.map} +1 -1
  11. package/dist/chunks/batch-update-raw-data-generated-view.d729bc1b.js +3 -0
  12. package/dist/chunks/batch-update-raw-data-generated-view.d729bc1b.js.LICENSE.txt +1 -0
  13. package/dist/chunks/batch-update-raw-data-generated-view.d729bc1b.js.map +1 -0
  14. package/dist/chunks/main.85c6714e.js +2 -0
  15. package/dist/chunks/main.85c6714e.js.map +1 -0
  16. package/dist/chunks/pre-generated-preview.450a7748.js +3 -0
  17. package/dist/chunks/pre-generated-preview.450a7748.js.map +1 -0
  18. package/dist/chunks/raw-data-preview.90cc3e5a.js +3 -0
  19. package/dist/chunks/raw-data-preview.90cc3e5a.js.LICENSE.txt +5 -0
  20. package/dist/chunks/raw-data-preview.90cc3e5a.js.map +1 -0
  21. package/dist/index.5683a6e8.js +2 -0
  22. package/dist/index.5683a6e8.js.map +1 -0
  23. package/dist/manifest.json +110 -59
  24. package/dist/types.json +418 -0
  25. package/dist-types/bootstrap.d.ts +2 -0
  26. package/dist-types/data-providers/batch-update-raw-data-generated-view.d.ts +9 -0
  27. package/dist-types/data-providers/batch-update-raw-data-generated-view.spec.d.ts +1 -0
  28. package/dist-types/raw-data-preview/convert.d.ts +3 -0
  29. package/dist-types/raw-data-preview/index.d.ts +53 -0
  30. package/dist-types/raw-data-preview/index.spec.d.ts +1 -0
  31. package/dist-types/raw-data-preview/raw-data-interfaces.d.ts +74 -0
  32. package/package.json +2 -2
  33. package/dist/chunks/1370.f1c0b4dc.js +0 -2
  34. package/dist/chunks/1370.f1c0b4dc.js.map +0 -1
  35. package/dist/chunks/7150.0e64cf9e.js +0 -3
  36. package/dist/chunks/7150.0e64cf9e.js.map +0 -1
  37. package/dist/chunks/8989.0d8b22ea.js +0 -2
  38. package/dist/chunks/main.07bd0560.js +0 -2
  39. package/dist/chunks/main.07bd0560.js.map +0 -1
  40. package/dist/chunks/pre-generated-preview.9fe5a3d8.js +0 -3
  41. package/dist/chunks/pre-generated-preview.9fe5a3d8.js.map +0 -1
  42. package/dist/index.b98e786d.js +0 -2
  43. package/dist/index.b98e786d.js.map +0 -1
  44. /package/dist/chunks/{5814.8ed8f39d.js.LICENSE.txt → 5814.71a79ad9.js.LICENSE.txt} +0 -0
  45. /package/dist/chunks/{pre-generated-preview.9fe5a3d8.js.LICENSE.txt → pre-generated-preview.450a7748.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -102,6 +102,127 @@
102
102
  "events": [],
103
103
  "methods": []
104
104
  },
105
+ "visual-builder.batch-update-raw-data-generated-view": {
106
+ "type": "provider",
107
+ "params": [
108
+ {
109
+ "name": "generations",
110
+ "annotation": {
111
+ "type": "array",
112
+ "elementType": {
113
+ "type": "reference",
114
+ "typeName": {
115
+ "type": "identifier",
116
+ "name": "GeneratedView"
117
+ }
118
+ }
119
+ }
120
+ }
121
+ ],
122
+ "returns": {
123
+ "annotation": {
124
+ "type": "reference",
125
+ "typeName": {
126
+ "type": "identifier",
127
+ "name": "Promise"
128
+ },
129
+ "typeParameters": {
130
+ "type": "typeParameterInstantiation",
131
+ "params": [
132
+ {
133
+ "type": "keyword",
134
+ "value": "unknown"
135
+ }
136
+ ]
137
+ }
138
+ }
139
+ },
140
+ "types": [
141
+ {
142
+ "type": "interface",
143
+ "name": "GeneratedView",
144
+ "body": [
145
+ {
146
+ "type": "propertySignature",
147
+ "key": {
148
+ "type": "identifier",
149
+ "name": "attrInstanceId"
150
+ },
151
+ "annotation": {
152
+ "type": "keyword",
153
+ "value": "string"
154
+ },
155
+ "computed": false
156
+ },
157
+ {
158
+ "type": "propertySignature",
159
+ "key": {
160
+ "type": "identifier",
161
+ "name": "input"
162
+ },
163
+ "annotation": {
164
+ "type": "keyword",
165
+ "value": "string"
166
+ },
167
+ "computed": false
168
+ },
169
+ {
170
+ "type": "propertySignature",
171
+ "key": {
172
+ "type": "identifier",
173
+ "name": "output"
174
+ },
175
+ "annotation": {
176
+ "type": "keyword",
177
+ "value": "string"
178
+ },
179
+ "computed": false
180
+ },
181
+ {
182
+ "type": "propertySignature",
183
+ "key": {
184
+ "type": "identifier",
185
+ "name": "list"
186
+ },
187
+ "annotation": {
188
+ "type": "array",
189
+ "elementType": {
190
+ "type": "keyword",
191
+ "value": "unknown"
192
+ }
193
+ },
194
+ "computed": false
195
+ },
196
+ {
197
+ "type": "propertySignature",
198
+ "key": {
199
+ "type": "identifier",
200
+ "name": "defaultVisualWeight"
201
+ },
202
+ "annotation": {
203
+ "type": "keyword",
204
+ "value": "number"
205
+ },
206
+ "optional": true,
207
+ "computed": false
208
+ },
209
+ {
210
+ "type": "propertySignature",
211
+ "key": {
212
+ "type": "identifier",
213
+ "name": "systemPromptVersion"
214
+ },
215
+ "annotation": {
216
+ "type": "keyword",
217
+ "value": "string"
218
+ },
219
+ "optional": true,
220
+ "computed": false
221
+ }
222
+ ]
223
+ }
224
+ ]
225
+ },
105
226
  "visual-builder.check-editor-by-name": {
106
227
  "type": "provider",
107
228
  "params": [
@@ -1493,6 +1614,303 @@
1493
1614
  }
1494
1615
  ]
1495
1616
  },
1617
+ "visual-builder.raw-data-preview": {
1618
+ "properties": [
1619
+ {
1620
+ "name": "previewUrl",
1621
+ "annotation": {
1622
+ "type": "keyword",
1623
+ "value": "string"
1624
+ }
1625
+ },
1626
+ {
1627
+ "name": "generations",
1628
+ "annotation": {
1629
+ "type": "array",
1630
+ "elementType": {
1631
+ "type": "reference",
1632
+ "typeName": {
1633
+ "type": "identifier",
1634
+ "name": "AttributeGeneration"
1635
+ }
1636
+ }
1637
+ }
1638
+ },
1639
+ {
1640
+ "name": "busy",
1641
+ "annotation": {
1642
+ "type": "keyword",
1643
+ "value": "boolean"
1644
+ }
1645
+ },
1646
+ {
1647
+ "name": "category",
1648
+ "annotation": {
1649
+ "type": "reference",
1650
+ "typeName": {
1651
+ "type": "identifier",
1652
+ "name": "PreviewCategory"
1653
+ }
1654
+ }
1655
+ },
1656
+ {
1657
+ "name": "theme",
1658
+ "annotation": {
1659
+ "type": "keyword",
1660
+ "value": "string"
1661
+ }
1662
+ },
1663
+ {
1664
+ "name": "uiVersion",
1665
+ "annotation": {
1666
+ "type": "keyword",
1667
+ "value": "string"
1668
+ }
1669
+ },
1670
+ {
1671
+ "name": "app",
1672
+ "annotation": {
1673
+ "type": "reference",
1674
+ "typeName": {
1675
+ "type": "identifier",
1676
+ "name": "MicroApp"
1677
+ }
1678
+ }
1679
+ }
1680
+ ],
1681
+ "events": [
1682
+ {
1683
+ "name": "comment",
1684
+ "detail": {
1685
+ "annotation": {
1686
+ "type": "reference",
1687
+ "typeName": {
1688
+ "type": "identifier",
1689
+ "name": "CommentDetail"
1690
+ }
1691
+ }
1692
+ }
1693
+ }
1694
+ ],
1695
+ "methods": [],
1696
+ "types": [
1697
+ {
1698
+ "type": "interface",
1699
+ "name": "AttributeGeneration",
1700
+ "body": [
1701
+ {
1702
+ "type": "propertySignature",
1703
+ "key": {
1704
+ "type": "identifier",
1705
+ "name": "generationId"
1706
+ },
1707
+ "annotation": {
1708
+ "type": "keyword",
1709
+ "value": "string"
1710
+ },
1711
+ "optional": true,
1712
+ "computed": false
1713
+ },
1714
+ {
1715
+ "type": "propertySignature",
1716
+ "key": {
1717
+ "type": "identifier",
1718
+ "name": "objectId"
1719
+ },
1720
+ "annotation": {
1721
+ "type": "keyword",
1722
+ "value": "string"
1723
+ },
1724
+ "computed": false
1725
+ },
1726
+ {
1727
+ "type": "propertySignature",
1728
+ "key": {
1729
+ "type": "identifier",
1730
+ "name": "objectName"
1731
+ },
1732
+ "annotation": {
1733
+ "type": "keyword",
1734
+ "value": "string"
1735
+ },
1736
+ "computed": false
1737
+ },
1738
+ {
1739
+ "type": "propertySignature",
1740
+ "key": {
1741
+ "type": "identifier",
1742
+ "name": "propertyId"
1743
+ },
1744
+ "annotation": {
1745
+ "type": "keyword",
1746
+ "value": "string"
1747
+ },
1748
+ "computed": false
1749
+ },
1750
+ {
1751
+ "type": "propertySignature",
1752
+ "key": {
1753
+ "type": "identifier",
1754
+ "name": "propertyName"
1755
+ },
1756
+ "annotation": {
1757
+ "type": "keyword",
1758
+ "value": "string"
1759
+ },
1760
+ "computed": false
1761
+ },
1762
+ {
1763
+ "type": "propertySignature",
1764
+ "key": {
1765
+ "type": "identifier",
1766
+ "name": "propertyInstanceId"
1767
+ },
1768
+ "annotation": {
1769
+ "type": "keyword",
1770
+ "value": "string"
1771
+ },
1772
+ "optional": true,
1773
+ "computed": false
1774
+ },
1775
+ {
1776
+ "type": "propertySignature",
1777
+ "key": {
1778
+ "type": "identifier",
1779
+ "name": "comment"
1780
+ },
1781
+ "annotation": {
1782
+ "type": "keyword",
1783
+ "value": "string"
1784
+ },
1785
+ "optional": true,
1786
+ "computed": false
1787
+ },
1788
+ {
1789
+ "type": "propertySignature",
1790
+ "key": {
1791
+ "type": "identifier",
1792
+ "name": "candidates"
1793
+ },
1794
+ "annotation": {
1795
+ "type": "union",
1796
+ "types": [
1797
+ {
1798
+ "type": "array",
1799
+ "elementType": {
1800
+ "type": "reference",
1801
+ "typeName": {
1802
+ "type": "identifier",
1803
+ "name": "VisualConfig"
1804
+ }
1805
+ }
1806
+ },
1807
+ {
1808
+ "type": "keyword",
1809
+ "value": "null"
1810
+ }
1811
+ ]
1812
+ },
1813
+ "computed": false
1814
+ },
1815
+ {
1816
+ "type": "propertySignature",
1817
+ "key": {
1818
+ "type": "identifier",
1819
+ "name": "mockData"
1820
+ },
1821
+ "annotation": {
1822
+ "type": "array",
1823
+ "elementType": {
1824
+ "type": "reference",
1825
+ "typeName": {
1826
+ "type": "identifier",
1827
+ "name": "Record"
1828
+ },
1829
+ "typeParameters": {
1830
+ "type": "typeParameterInstantiation",
1831
+ "params": [
1832
+ {
1833
+ "type": "keyword",
1834
+ "value": "string"
1835
+ },
1836
+ {
1837
+ "type": "keyword",
1838
+ "value": "unknown"
1839
+ }
1840
+ ]
1841
+ }
1842
+ }
1843
+ },
1844
+ "computed": false
1845
+ }
1846
+ ]
1847
+ },
1848
+ {
1849
+ "type": "typeAlias",
1850
+ "name": "PreviewCategory",
1851
+ "annotation": {
1852
+ "type": "union",
1853
+ "types": [
1854
+ {
1855
+ "type": "jsLiteral",
1856
+ "value": "detail-item"
1857
+ },
1858
+ {
1859
+ "type": "jsLiteral",
1860
+ "value": "form-item"
1861
+ },
1862
+ {
1863
+ "type": "jsLiteral",
1864
+ "value": "table-column"
1865
+ },
1866
+ {
1867
+ "type": "jsLiteral",
1868
+ "value": "card-item"
1869
+ },
1870
+ {
1871
+ "type": "jsLiteral",
1872
+ "value": "metric-item"
1873
+ },
1874
+ {
1875
+ "type": "jsLiteral",
1876
+ "value": "value"
1877
+ }
1878
+ ]
1879
+ }
1880
+ },
1881
+ {
1882
+ "type": "interface",
1883
+ "name": "CommentDetail",
1884
+ "body": [
1885
+ {
1886
+ "type": "propertySignature",
1887
+ "key": {
1888
+ "type": "identifier",
1889
+ "name": "comment"
1890
+ },
1891
+ "annotation": {
1892
+ "type": "keyword",
1893
+ "value": "string"
1894
+ },
1895
+ "computed": false
1896
+ },
1897
+ {
1898
+ "type": "propertySignature",
1899
+ "key": {
1900
+ "type": "identifier",
1901
+ "name": "propertyInstanceId"
1902
+ },
1903
+ "annotation": {
1904
+ "type": "keyword",
1905
+ "value": "string"
1906
+ },
1907
+ "optional": true,
1908
+ "computed": false
1909
+ }
1910
+ ]
1911
+ }
1912
+ ]
1913
+ },
1496
1914
  "visual-builder.inject-chat-preview-agent": {
1497
1915
  "type": "provider",
1498
1916
  "params": [],
@@ -18,4 +18,6 @@ import "./property-editor/index.js";
18
18
  import "./data-providers/check-editor-by-name.js";
19
19
  import "./data-providers/get-data-dependency.js";
20
20
  import "./data-providers/get-dependency-tree.js";
21
+ import "./raw-data-preview/index.js";
21
22
  import "./data-providers/parse-path.js";
23
+ import "./data-providers/batch-update-raw-data-generated-view.js";
@@ -0,0 +1,9 @@
1
+ export interface GeneratedView {
2
+ attrInstanceId: string;
3
+ input: string;
4
+ output: string;
5
+ list: unknown[];
6
+ defaultVisualWeight?: number;
7
+ systemPromptVersion?: string;
8
+ }
9
+ export declare function batchUpdateRawDataGeneratedView(generations: GeneratedView[]): Promise<unknown>;
@@ -0,0 +1,3 @@
1
+ import type { BrickConf } from "@next-core/types";
2
+ import type { VisualConfig } from "./raw-data-interfaces";
3
+ export declare function convertToStoryboard(config: VisualConfig, attr: string): BrickConf | null;
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import "@next-core/theme";
4
+ import type { MicroApp } from "@next-core/types";
5
+ import type { VisualConfig } from "./raw-data-interfaces";
6
+ export interface RawPreviewProps {
7
+ previewUrl?: string;
8
+ generations?: AttributeGeneration[];
9
+ busy?: boolean;
10
+ category?: PreviewCategory;
11
+ theme?: string;
12
+ uiVersion?: string;
13
+ app?: MicroApp;
14
+ }
15
+ export interface AttributeGeneration {
16
+ generationId?: string;
17
+ objectId: string;
18
+ objectName: string;
19
+ propertyId: string;
20
+ propertyName: string;
21
+ propertyInstanceId?: string;
22
+ comment?: string;
23
+ candidates: VisualConfig[] | null;
24
+ mockData: Record<string, unknown>[];
25
+ }
26
+ export interface CommentDetail {
27
+ comment: string;
28
+ propertyInstanceId?: string;
29
+ }
30
+ export type PreviewCategory = "detail-item" | "form-item" | "table-column" | "card-item" | "metric-item" | "value";
31
+ /**
32
+ * 构件 `visual-builder.raw-data-preview`
33
+ *
34
+ * @internal
35
+ */
36
+ export declare class RawDataPreview extends ReactNextElement {
37
+ #private;
38
+ accessor previewUrl: string | undefined;
39
+ accessor generations: AttributeGeneration[] | undefined;
40
+ accessor busy: boolean | undefined;
41
+ /**
42
+ * @default "value"
43
+ */
44
+ accessor category: PreviewCategory | undefined;
45
+ accessor theme: string | undefined;
46
+ accessor uiVersion: string | undefined;
47
+ accessor app: MicroApp | undefined;
48
+ render(): React.JSX.Element;
49
+ }
50
+ export interface RawDataPreviewComponentProps extends RawPreviewProps {
51
+ onComment: (detail: CommentDetail) => void;
52
+ }
53
+ export declare function RawDataPreviewComponent({ previewUrl, generations, busy, category, theme, uiVersion, app, onComment, }: RawDataPreviewComponentProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ import "./";
@@ -0,0 +1,74 @@
1
+ export interface VisualConfig {
2
+ /** 视觉重量,整型,默认为 0,取值范围 [-1, 2] */
3
+ visualWeight: number;
4
+ /** 显示形式,默认为 text */
5
+ display: "text" | "tag" | "link" | "icon" | "file";
6
+ /** 原始数据类型 */
7
+ type: "integer" | "float" | "string" | "boolean" | "enum" | "enum-list" | "struct" | "struct-list" | "date" | "date-time";
8
+ /** 样式设置 */
9
+ style?: VisualStyle;
10
+ /** 根据区间设置不同的样式 */
11
+ ranges?: VisualRange[];
12
+ /** 格式化设置 */
13
+ formatter?: VisualFormatter;
14
+ icon?: string;
15
+ /** 最多显示的列表项数量,当结构体列表数据降级显示时使用 */
16
+ maxItems?: number;
17
+ /** 尽显示列表类数据的数量 */
18
+ countOnly?: number;
19
+ /** 当结构体或结构体列表数据降级显示时,仅显示该字段值 */
20
+ field?: string;
21
+ }
22
+ export interface VisualStyle {
23
+ /**
24
+ * 尺寸
25
+ *
26
+ * @default "medium"
27
+ */
28
+ size?: "small" | "medium" | "large" | "x-large";
29
+ /**
30
+ * 字重
31
+ *
32
+ * @default "normal"
33
+ */
34
+ fontWeight?: "normal" | "bold";
35
+ /** 内容颜色使用预设的 CSS 变量 */
36
+ color?: "var(--text-color-default)" | "var(--text-color-secondary)" | "var(--text-color-disabled)" | "var(--color-brand)";
37
+ /** 标签变种形式:默认、边框、背景色 */
38
+ variant?: "default" | "outline" | "background";
39
+ /** 背景颜色使用预设的 CSS 变量 */
40
+ background?: VisualBackground;
41
+ /** 背景颜色表 */
42
+ palette?: Record<string, VisualBackground>;
43
+ }
44
+ export type VisualBackground = "blue" | "cyan" | "geekblue" | "grayblue" | "gray" | "green" | "orange" | "purple" | "red" | "yellow" | "teal";
45
+ export interface VisualRange {
46
+ start?: number;
47
+ end?: number;
48
+ style?: VisualStyle;
49
+ }
50
+ export type VisualFormatter = DateTimeFormatter | CostTimeFormatter | NumberFormatter | FileFormatter;
51
+ export interface DateTimeFormatter {
52
+ type: "date-time" | "date" | "time";
53
+ format?: "full" | "default" | "accurate" | "relative" | "future" | "auto" | string;
54
+ }
55
+ export interface CostTimeFormatter {
56
+ type: "cost-time";
57
+ }
58
+ export interface NumberFormatter {
59
+ type: "number";
60
+ format: "decimal" | "currency" | "percent" | "unit";
61
+ /**
62
+ * 货币名,例如 CNY / USD 等
63
+ */
64
+ currency?: string;
65
+ unit?: string;
66
+ /** 保留的小数位数 */
67
+ decimals?: number;
68
+ thousandsSeparator?: boolean;
69
+ }
70
+ export interface FileFormatter {
71
+ type: "file";
72
+ /** 文件类型,例如 markdown / js / css / php 等 */
73
+ fileType: string;
74
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/visual-builder",
3
- "version": "1.33.8",
3
+ "version": "1.34.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/visual-builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,5 +44,5 @@
44
44
  "@next-bricks/icons": "*",
45
45
  "@next-bricks/vs": "*"
46
46
  },
47
- "gitHead": "0dc80f976bbe10992b895eae022c6f86fab7507c"
47
+ "gitHead": "3cd2a1a5c23ea4fa3565a2aaf6a3cd62a8fa146c"
48
48
  }
@@ -1,2 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_bricks_visual_builder=globalThis.webpackChunk_next_bricks_visual_builder||[]).push([[1370],{2559:(t,r,e)=>{function s(t,r,e){if("function"==typeof t?t===r:t.has(r))return arguments.length<3?r:e;throw new TypeError("Private element is not present on this object")}e.d(r,{A:()=>s})},2016:(t,r,e)=>{function s(t,r){if(r.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}e.d(r,{A:()=>s})},829:(t,r,e)=>{e.d(r,{A:()=>n});var s=e(2559);function n(t,r){return t.get((0,s.A)(t,r))}},918:(t,r,e)=>{e.d(r,{A:()=>n});var s=e(2016);function n(t,r,e){(0,s.A)(t,r),r.set(t,e)}},6121:(t,r,e)=>{e.d(r,{A:()=>n});var s=e(2559);function n(t,r,e){return t.set((0,s.A)(t,r),e),e}},4635:(t,r,e)=>{e.d(r,{A:()=>n});var s=e(2016);function n(t,r){(0,s.A)(t,r),r.add(t)}},8989:(t,r,e)=>{e.r(r),e.d(r,{HttpAbortError:()=>I,HttpFetchError:()=>q,HttpParseError:()=>F,HttpResponseError:()=>D,createHttpInstance:()=>L,defaultAdapter:()=>B,fetch:()=>W,http:()=>U,isHttpAbortError:()=>J});var s={};e.r(s),e.d(s,{HttpAbortError:()=>E,HttpFetchError:()=>l,HttpParseError:()=>d,HttpResponseError:()=>p,createHttpInstance:()=>R,defaultAdapter:()=>g,fetch:()=>n,getUrlWithParams:()=>H,http:()=>x,isHttpAbortError:()=>w});const n=(t,r)=>{const e=new Request(t,Object.assign({credentials:"same-origin"},r));return self.fetch(e)};var o=e(4635),a=e(918),i=e(4586),c=e(829),h=e(2559),u=e(6121);class l extends Error{constructor(t){super(t),this.name="HttpFetchError",Error.captureStackTrace&&Error.captureStackTrace(this,l)}}class p extends Error{constructor(t,r){super(t.statusText),(0,i.A)(this,"response",void 0),(0,i.A)(this,"responseJson",void 0),this.name="HttpResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,p),this.response=t,this.responseJson=r}}class d extends Error{constructor(t){super(t.statusText),(0,i.A)(this,"response",void 0),this.name="HttpParseError",Error.captureStackTrace&&Error.captureStackTrace(this,d),this.response=t}}class E extends Error{constructor(t){super(t),this.name="HttpAbortError"}}class f{constructor(){(0,i.A)(this,"handlers",[])}use(t,r){return this.handlers.push({fulfilled:t,rejected:r}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}forEach(t){this.handlers.forEach((r=>{null!==r&&t(r)}))}}function A(t){return null==t}const v=document.querySelector("base"),m=v?v.href:location.origin+"/",w=t=>t instanceof DOMException&&20===t.code,b=async(t,r,e)=>new Promise((async(s,o)=>{let a;e.url=t;let i,{responseType:c}=e.options||{};c||(c="json");try{a=await n(t,r)}catch(t){return void o(w(t)?new E(t.toString()):new l(t.toString()))}if(a.ok){try{i=await a[c]()}catch(t){return void o(w(t)?new E(t.toString()):new d(a))}s({status:a.status,statusText:a.statusText,headers:a.headers,data:i})}else{let t;try{t=await a.json()}catch{}o(new p(a,t))}})),H=(t,r)=>{if(r){const e=new URL(t,m);r instanceof URLSearchParams?r.forEach((function(t,r){e.searchParams.append(r,t)})):Object.entries(r).forEach((t=>{let[r,s]=t;Array.isArray(s)?s.forEach((t=>{e.searchParams.append(r,A(t)?"":t)})):e.searchParams.append(r,A(s)?"":s)}));const{href:s}=e;return s.startsWith(m)?s.substr(m.length):s}return t},T=(t,r)=>{if(void 0!==t){const e=new Headers(r||{}),s="Content-Type";let n=t;return e.has(s)||("string"==typeof t?e.set(s,"application/x-www-form-urlencoded"):t instanceof FormData||(e.set(s,"application/json"),n=JSON.stringify(t))),{body:n,headers:e}}return{headers:r}},g=t=>{const{url:r,method:e,data:s}=t;return["DELETE","GET","HEAD"].includes(t.method)?((t,r,e)=>{const{params:s,responseType:n,interceptorParams:o,observe:a,noAbortOnRouteChange:i,useCache:c,...h}=e.options||{};return b(H(r,s),{...h,method:t},e)})(e,r,t):((t,r,e,s)=>{const{params:n,headers:o,responseType:a,interceptorParams:i,observe:c,noAbortOnRouteChange:h,useCache:u,...l}=s.options||{};return b(H(r,n),{...l,method:t,...T(e,o)},s)})(e,r,s,t)};var y=new WeakMap,P=new WeakSet;class k{constructor(t){var r=this;(0,o.A)(this,P),(0,i.A)(this,"interceptors",void 0),(0,a.A)(this,y,g),(0,i.A)(this,"request",(async(t,r,e)=>{const{body:s,method:n,...o}=r||{};return(0,h.A)(P,this,S).call(this,{url:t,data:s,method:n||"GET",options:{...e||{},...o}})})),(0,i.A)(this,"simpleRequest",(function(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,h.A)(P,r,S).call(r,{url:e,method:t,options:s})})),(0,i.A)(this,"requestWithBody",(function(t,e,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,h.A)(P,r,S).call(r,{url:e,method:t,data:s,options:n})})),this.interceptors={request:new f,response:new f},null!=t&&t.adapter&&(0,u.A)(y,this,t.adapter)}getUrlWithParams(t,r){return H(t,r)}getBodyAndHeaders(t,r){return T(t,r)}get(t,r){return(0,h.A)(P,this,S).call(this,{url:t,method:"GET",options:r})}delete(t,r){return(0,h.A)(P,this,S).call(this,{url:t,method:"DELETE",options:r})}head(t,r){return(0,h.A)(P,this,S).call(this,{url:t,method:"HEAD",options:r})}post(t,r,e){return(0,h.A)(P,this,S).call(this,{url:t,method:"POST",data:r,options:e})}put(t,r,e){return(0,h.A)(P,this,S).call(this,{url:t,method:"PUT",data:r,options:e})}patch(t,r,e){return(0,h.A)(P,this,S).call(this,{url:t,method:"PATCH",data:r,options:e})}}function S(t){const r=[];let e=Promise.resolve(t);for(this.interceptors.request.forEach((t=>{r.push(t.fulfilled,t.rejected)})),r.push((t=>(0,c.A)(y,this).call(this,t)),void 0),this.interceptors.response.forEach((e=>{r.push((r=>{var s;return null===(s=e.fulfilled)||void 0===s?void 0:s.call(e,r,t)}),(r=>{var s;return null===(s=e.rejected)||void 0===s?void 0:s.call(e,r,t)}))})),r.push((r=>{var e;return"response"===(null===(e=t.options)||void 0===e?void 0:e.observe)?r:r.data}),void 0);r.length;)e=e.then(r.shift(),r.shift());return e}let x=new k;function R(t){x=new k(t)}var j;let C,_;const{dll:O}=window;C=O&&null!==(j=window.BRICK_NEXT_VERSIONS)&&void 0!==j&&null!==(j=j["brick-container"])&&void 0!==j&&j.startsWith("2.")&&(_=O("JxWY"))?_:s;const{fetch:W,HttpFetchError:q,HttpResponseError:D,HttpParseError:F,HttpAbortError:I,http:U,isHttpAbortError:J,createHttpInstance:L,defaultAdapter:B}=C}}]);
2
- //# sourceMappingURL=1370.f1c0b4dc.js.map