zudoku 0.16.2 → 0.17.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 (174) hide show
  1. package/dist/app/entry.server.js +4 -5
  2. package/dist/app/entry.server.js.map +1 -1
  3. package/dist/app/main.d.ts +1 -1
  4. package/dist/app/main.js +2 -2
  5. package/dist/app/main.js.map +1 -1
  6. package/dist/config/validators/validate.d.ts +44 -44
  7. package/dist/config/validators/validate.js.map +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/lib/authentication/authentication.d.ts +2 -2
  12. package/dist/lib/authentication/state.d.ts +1 -1
  13. package/dist/lib/authentication/state.js +5 -3
  14. package/dist/lib/authentication/state.js.map +1 -1
  15. package/dist/lib/authentication/use-broadcast/shared.d.ts +48 -0
  16. package/dist/lib/authentication/use-broadcast/shared.js +243 -0
  17. package/dist/lib/authentication/use-broadcast/shared.js.map +1 -0
  18. package/dist/lib/authentication/use-broadcast/useBroadcast.d.ts +24 -0
  19. package/dist/lib/authentication/use-broadcast/useBroadcast.js +106 -0
  20. package/dist/lib/authentication/use-broadcast/useBroadcast.js.map +1 -0
  21. package/dist/lib/components/ClientOnly.d.ts +4 -2
  22. package/dist/lib/components/ClientOnly.js +1 -1
  23. package/dist/lib/components/ClientOnly.js.map +1 -1
  24. package/dist/lib/components/Header.js +4 -2
  25. package/dist/lib/components/Header.js.map +1 -1
  26. package/dist/lib/components/{DevPortal.d.ts → Zudoku.d.ts} +3 -3
  27. package/dist/lib/components/{DevPortal.js → Zudoku.js} +11 -11
  28. package/dist/lib/components/Zudoku.js.map +1 -0
  29. package/dist/lib/components/context/ZudokuContext.d.ts +4 -4
  30. package/dist/lib/components/context/ZudokuContext.js +1 -1
  31. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  32. package/dist/lib/components/context/ZudokuProvider.d.ts +2 -2
  33. package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
  34. package/dist/lib/components/index.d.ts +4 -7
  35. package/dist/lib/components/index.js +2 -3
  36. package/dist/lib/components/index.js.map +1 -1
  37. package/dist/lib/core/{DevPortalContext.d.ts → ZudokuContext.d.ts} +5 -5
  38. package/dist/lib/core/{DevPortalContext.js → ZudokuContext.js} +2 -2
  39. package/dist/lib/core/ZudokuContext.js.map +1 -0
  40. package/dist/lib/core/plugins.d.ts +12 -12
  41. package/dist/lib/core/plugins.js.map +1 -1
  42. package/dist/lib/plugins/api-keys/index.d.ts +9 -9
  43. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  44. package/dist/lib/plugins/custom-pages/index.d.ts +2 -2
  45. package/dist/lib/plugins/custom-pages/index.js.map +1 -1
  46. package/dist/lib/plugins/markdown/index.d.ts +2 -2
  47. package/dist/lib/plugins/markdown/index.js.map +1 -1
  48. package/dist/lib/plugins/openapi/CollapsibleCode.js +4 -2
  49. package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -1
  50. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  51. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  52. package/dist/lib/plugins/openapi/ParameterListItem.js +6 -1
  53. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  54. package/dist/lib/plugins/openapi/Sidecar.js +28 -24
  55. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  56. package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +1 -4
  57. package/dist/lib/plugins/openapi/client/createMemoryClient.js +9 -1
  58. package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -1
  59. package/dist/lib/plugins/openapi/client/createWorkerClient.js +2 -1
  60. package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -1
  61. package/dist/lib/plugins/openapi/index.d.ts +2 -2
  62. package/dist/lib/plugins/openapi/index.js.map +1 -1
  63. package/dist/lib/plugins/redirect/index.d.ts +2 -2
  64. package/dist/lib/plugins/redirect/index.js.map +1 -1
  65. package/dist/lib/plugins/search-inkeep/index.d.ts +2 -2
  66. package/dist/lib/plugins/search-inkeep/index.js.map +1 -1
  67. package/dist/lib/ui/ActionButton.d.ts +4 -0
  68. package/dist/lib/ui/ActionButton.js +10 -0
  69. package/dist/lib/ui/ActionButton.js.map +1 -0
  70. package/dist/lib/util/useIsomorphicLayoutEffect.d.ts +3 -0
  71. package/dist/lib/util/useIsomorphicLayoutEffect.js +4 -0
  72. package/dist/lib/util/useIsomorphicLayoutEffect.js.map +1 -0
  73. package/dist/lib/util/useOnScreen.d.ts +4 -0
  74. package/dist/lib/util/useOnScreen.js +19 -0
  75. package/dist/lib/util/useOnScreen.js.map +1 -0
  76. package/dist/vite/plugin-mdx.d.ts +0 -6
  77. package/dist/vite/plugin-mdx.js.map +1 -1
  78. package/lib/{AnchorLink-BbB2q-jx.js → AnchorLink-DYbUOP9U.js} +2 -2
  79. package/lib/{AnchorLink-BbB2q-jx.js.map → AnchorLink-DYbUOP9U.js.map} +1 -1
  80. package/lib/{AuthenticationPlugin-C9BHGXlE.js → AuthenticationPlugin-bqGAKfot.js} +3 -3
  81. package/lib/{AuthenticationPlugin-C9BHGXlE.js.map → AuthenticationPlugin-bqGAKfot.js.map} +1 -1
  82. package/lib/{ClientOnly-CVN6leDu.js → ClientOnly-E7hGysn1.js} +4 -4
  83. package/lib/ClientOnly-E7hGysn1.js.map +1 -0
  84. package/lib/{Markdown-BDcCAWwm.js → Markdown-D6UxMbZm.js} +2 -2
  85. package/lib/{Markdown-BDcCAWwm.js.map → Markdown-D6UxMbZm.js.map} +1 -1
  86. package/lib/{MdxPage-DKMH_t0f.js → MdxPage-DRKqyn2b.js} +5 -5
  87. package/lib/{MdxPage-DKMH_t0f.js.map → MdxPage-DRKqyn2b.js.map} +1 -1
  88. package/lib/{OperationList-35iw_Gil.js → OperationList-BHUBGM0c.js} +116 -113
  89. package/lib/OperationList-BHUBGM0c.js.map +1 -0
  90. package/lib/{Route-BsEZmkNl.js → Route-B0XuN1oC.js} +3 -3
  91. package/lib/{Route-BsEZmkNl.js.map → Route-B0XuN1oC.js.map} +1 -1
  92. package/lib/{Select-Bagt3Bme.js → Select-DYKDahHt.js} +3 -3
  93. package/lib/{Select-Bagt3Bme.js.map → Select-DYKDahHt.js.map} +1 -1
  94. package/lib/{Spinner-C6zroowC.js → SidebarBadge-Bbt92M5K.js} +16 -18
  95. package/lib/SidebarBadge-Bbt92M5K.js.map +1 -0
  96. package/lib/{SlotletProvider-Da7eFgd2.js → SlotletProvider-mhjLPG44.js} +4 -4
  97. package/lib/{SlotletProvider-Da7eFgd2.js.map → SlotletProvider-mhjLPG44.js.map} +1 -1
  98. package/lib/Spinner-ChOGyPls.js +51 -0
  99. package/lib/Spinner-ChOGyPls.js.map +1 -0
  100. package/lib/{hook-sn0zMTkE.js → hook-CjQERPa7.js} +3 -3
  101. package/lib/{hook-sn0zMTkE.js.map → hook-CjQERPa7.js.map} +1 -1
  102. package/lib/{index-BdD8UbS-.js → index-BRg5pi5D.js} +1351 -1364
  103. package/lib/index-BRg5pi5D.js.map +1 -0
  104. package/lib/{index-CRo94sKK.js → index-DM9hrcCG.js} +4 -4
  105. package/lib/{index-CRo94sKK.js.map → index-DM9hrcCG.js.map} +1 -1
  106. package/lib/state-BsPrOUAh.js +252 -0
  107. package/lib/state-BsPrOUAh.js.map +1 -0
  108. package/lib/ui/ActionButton.js +24 -0
  109. package/lib/ui/ActionButton.js.map +1 -0
  110. package/lib/urql-core-35Qt_U4i.js +1511 -0
  111. package/lib/{urql-core-KJnLL26g.js.map → urql-core-35Qt_U4i.js.map} +1 -1
  112. package/lib/{useExposedProps-ChOIUaS4.js → useExposedProps-BxyHjPNN.js} +2 -2
  113. package/lib/{useExposedProps-ChOIUaS4.js.map → useExposedProps-BxyHjPNN.js.map} +1 -1
  114. package/lib/{ZudokuContext-BKXGJTmu.js → utils-DNAltzXc.js} +153 -152
  115. package/lib/utils-DNAltzXc.js.map +1 -0
  116. package/lib/zudoku.auth-auth0.js +1 -1
  117. package/lib/zudoku.auth-clerk.js +2 -2
  118. package/lib/zudoku.auth-openid.js +4 -4
  119. package/lib/zudoku.components.js +690 -667
  120. package/lib/zudoku.components.js.map +1 -1
  121. package/lib/zudoku.openapi-worker.js +737 -729
  122. package/lib/zudoku.openapi-worker.js.map +1 -1
  123. package/lib/zudoku.plugin-api-keys.js +5 -5
  124. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  125. package/lib/zudoku.plugin-custom-pages.js +2 -2
  126. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  127. package/lib/zudoku.plugin-markdown.js +1 -1
  128. package/lib/zudoku.plugin-markdown.js.map +1 -1
  129. package/lib/zudoku.plugin-openapi.js +6 -6
  130. package/lib/zudoku.plugin-redirect.js.map +1 -1
  131. package/lib/zudoku.plugin-search-inkeep.js +1 -1
  132. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  133. package/package.json +2 -2
  134. package/src/app/entry.server.tsx +9 -5
  135. package/src/app/main.tsx +4 -4
  136. package/src/lib/authentication/authentication.ts +2 -2
  137. package/src/lib/authentication/state.ts +12 -5
  138. package/{LICENSE.md → src/lib/authentication/use-broadcast/LICENSE.md} +2 -2
  139. package/src/lib/authentication/use-broadcast/shared.ts +372 -0
  140. package/src/lib/authentication/use-broadcast/useBroadcast.ts +146 -0
  141. package/src/lib/components/ClientOnly.tsx +6 -3
  142. package/src/lib/components/Header.tsx +31 -25
  143. package/src/lib/components/Zudoku.tsx +113 -0
  144. package/src/lib/components/context/ZudokuContext.ts +3 -3
  145. package/src/lib/components/context/ZudokuProvider.tsx +2 -2
  146. package/src/lib/components/index.ts +2 -3
  147. package/src/lib/core/{DevPortalContext.ts → ZudokuContext.ts} +5 -5
  148. package/src/lib/core/plugins.ts +12 -16
  149. package/src/lib/plugins/api-keys/index.tsx +9 -9
  150. package/src/lib/plugins/custom-pages/index.tsx +2 -2
  151. package/src/lib/plugins/markdown/index.tsx +2 -2
  152. package/src/lib/plugins/openapi/CollapsibleCode.tsx +5 -8
  153. package/src/lib/plugins/openapi/OperationList.tsx +2 -1
  154. package/src/lib/plugins/openapi/ParameterListItem.tsx +37 -31
  155. package/src/lib/plugins/openapi/Sidecar.tsx +65 -51
  156. package/src/lib/plugins/openapi/client/createMemoryClient.ts +17 -3
  157. package/src/lib/plugins/openapi/client/createWorkerClient.ts +5 -1
  158. package/src/lib/plugins/openapi/index.tsx +2 -4
  159. package/src/lib/plugins/redirect/index.tsx +2 -2
  160. package/src/lib/plugins/search-inkeep/index.tsx +2 -2
  161. package/src/lib/ui/ActionButton.tsx +28 -0
  162. package/src/lib/util/useIsomorphicLayoutEffect.ts +5 -0
  163. package/src/lib/util/useOnScreen.ts +32 -0
  164. package/dist/lib/components/DevPortal.js.map +0 -1
  165. package/dist/lib/core/DevPortalContext.js.map +0 -1
  166. package/lib/ClientOnly-CVN6leDu.js.map +0 -1
  167. package/lib/OperationList-35iw_Gil.js.map +0 -1
  168. package/lib/Spinner-C6zroowC.js.map +0 -1
  169. package/lib/ZudokuContext-BKXGJTmu.js.map +0 -1
  170. package/lib/index-BdD8UbS-.js.map +0 -1
  171. package/lib/state-CsuHT8ZO.js +0 -183
  172. package/lib/state-CsuHT8ZO.js.map +0 -1
  173. package/lib/urql-core-KJnLL26g.js +0 -1455
  174. package/src/lib/components/DevPortal.tsx +0 -111
@@ -1,1455 +0,0 @@
1
- var M = {
2
- NAME: "Name",
3
- DOCUMENT: "Document",
4
- OPERATION_DEFINITION: "OperationDefinition",
5
- VARIABLE_DEFINITION: "VariableDefinition",
6
- SELECTION_SET: "SelectionSet",
7
- FIELD: "Field",
8
- ARGUMENT: "Argument",
9
- FRAGMENT_SPREAD: "FragmentSpread",
10
- INLINE_FRAGMENT: "InlineFragment",
11
- FRAGMENT_DEFINITION: "FragmentDefinition",
12
- VARIABLE: "Variable",
13
- INT: "IntValue",
14
- FLOAT: "FloatValue",
15
- STRING: "StringValue",
16
- BOOLEAN: "BooleanValue",
17
- NULL: "NullValue",
18
- ENUM: "EnumValue",
19
- LIST: "ListValue",
20
- OBJECT: "ObjectValue",
21
- OBJECT_FIELD: "ObjectField",
22
- DIRECTIVE: "Directive",
23
- NAMED_TYPE: "NamedType",
24
- LIST_TYPE: "ListType",
25
- NON_NULL_TYPE: "NonNullType"
26
- };
27
- class fe extends Error {
28
- constructor(r, t, n, i, a, o, l) {
29
- super(r), this.name = "GraphQLError", this.message = r, a && (this.path = a), t && (this.nodes = Array.isArray(t) ? t : [t]), n && (this.source = n), i && (this.positions = i), o && (this.originalError = o);
30
- var f = l;
31
- if (!f && o) {
32
- var u = o.extensions;
33
- u && typeof u == "object" && (f = u);
34
- }
35
- this.extensions = f || {};
36
- }
37
- toJSON() {
38
- return {
39
- ...this,
40
- message: this.message
41
- };
42
- }
43
- toString() {
44
- return this.message;
45
- }
46
- get [Symbol.toStringTag]() {
47
- return "GraphQLError";
48
- }
49
- }
50
- var g, d;
51
- function N(e) {
52
- return new fe(`Syntax Error: Unexpected token at ${d} in ${e}`);
53
- }
54
- function _(e) {
55
- if (e.lastIndex = d, e.test(g))
56
- return g.slice(d, d = e.lastIndex);
57
- }
58
- var Y = / +(?=[^\s])/y;
59
- function Qe(e) {
60
- for (var r = e.split(`
61
- `), t = "", n = 0, i = 0, a = r.length - 1, o = 0; o < r.length; o++)
62
- Y.lastIndex = 0, Y.test(r[o]) && (o && (!n || Y.lastIndex < n) && (n = Y.lastIndex), i = i || o, a = o);
63
- for (var l = i; l <= a; l++)
64
- l !== i && (t += `
65
- `), t += r[l].slice(n).replace(/\\"""/g, '"""');
66
- return t;
67
- }
68
- function h() {
69
- for (var e = 0 | g.charCodeAt(d++); e === 9 || e === 10 || e === 13 || e === 32 || e === 35 || e === 44 || e === 65279; e = 0 | g.charCodeAt(d++))
70
- if (e === 35)
71
- for (; (e = g.charCodeAt(d++)) !== 10 && e !== 13; )
72
- ;
73
- d--;
74
- }
75
- var O = /[_A-Za-z]\w*/y, se = new RegExp("(?:(null|true|false)|\\$(" + O.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + O.source + "))", "y"), L = function(e) {
76
- return e[e.Const = 1] = "Const", e[e.Var = 2] = "Var", e[e.Int = 3] = "Int", e[e.Float = 4] = "Float", e[e.BlockString = 5] = "BlockString", e[e.String = 6] = "String", e[e.Enum = 7] = "Enum", e;
77
- }(L || {}), Ue = /\\/;
78
- function K(e) {
79
- var r, t;
80
- if (se.lastIndex = d, g.charCodeAt(d) === 91) {
81
- d++, h();
82
- for (var n = []; g.charCodeAt(d) !== 93; )
83
- n.push(K(e));
84
- return d++, h(), {
85
- kind: "ListValue",
86
- values: n
87
- };
88
- } else if (g.charCodeAt(d) === 123) {
89
- d++, h();
90
- for (var i = []; g.charCodeAt(d) !== 125; ) {
91
- if ((r = _(O)) == null || (h(), g.charCodeAt(d++) !== 58))
92
- throw N("ObjectField");
93
- h(), i.push({
94
- kind: "ObjectField",
95
- name: {
96
- kind: "Name",
97
- value: r
98
- },
99
- value: K(e)
100
- });
101
- }
102
- return d++, h(), {
103
- kind: "ObjectValue",
104
- fields: i
105
- };
106
- } else if ((t = se.exec(g)) != null) {
107
- if (d = se.lastIndex, h(), (r = t[L.Const]) != null)
108
- return r === "null" ? {
109
- kind: "NullValue"
110
- } : {
111
- kind: "BooleanValue",
112
- value: r === "true"
113
- };
114
- if ((r = t[L.Var]) != null) {
115
- if (e)
116
- throw N("Variable");
117
- return {
118
- kind: "Variable",
119
- name: {
120
- kind: "Name",
121
- value: r
122
- }
123
- };
124
- } else if ((r = t[L.Int]) != null) {
125
- var a;
126
- return (a = t[L.Float]) != null ? {
127
- kind: "FloatValue",
128
- value: r + a
129
- } : {
130
- kind: "IntValue",
131
- value: r
132
- };
133
- } else {
134
- if ((r = t[L.BlockString]) != null)
135
- return {
136
- kind: "StringValue",
137
- value: Qe(r.slice(3, -3)),
138
- block: !0
139
- };
140
- if ((r = t[L.String]) != null)
141
- return {
142
- kind: "StringValue",
143
- value: Ue.test(r) ? JSON.parse(r) : r.slice(1, -1),
144
- block: !1
145
- };
146
- if ((r = t[L.Enum]) != null)
147
- return {
148
- kind: "EnumValue",
149
- value: r
150
- };
151
- }
152
- }
153
- throw N("Value");
154
- }
155
- function Le(e) {
156
- if (g.charCodeAt(d) === 40) {
157
- var r = [];
158
- d++, h();
159
- var t;
160
- do {
161
- if ((t = _(O)) == null || (h(), g.charCodeAt(d++) !== 58))
162
- throw N("Argument");
163
- h(), r.push({
164
- kind: "Argument",
165
- name: {
166
- kind: "Name",
167
- value: t
168
- },
169
- value: K(e)
170
- });
171
- } while (g.charCodeAt(d) !== 41);
172
- return d++, h(), r;
173
- }
174
- }
175
- function $(e) {
176
- if (g.charCodeAt(d) === 64) {
177
- var r = [], t;
178
- do {
179
- if (d++, (t = _(O)) == null)
180
- throw N("Directive");
181
- h(), r.push({
182
- kind: "Directive",
183
- name: {
184
- kind: "Name",
185
- value: t
186
- },
187
- arguments: Le(e)
188
- });
189
- } while (g.charCodeAt(d) === 64);
190
- return r;
191
- }
192
- }
193
- function ze() {
194
- for (var e, r = 0; g.charCodeAt(d) === 91; )
195
- r++, d++, h();
196
- if ((e = _(O)) == null)
197
- throw N("NamedType");
198
- h();
199
- var t = {
200
- kind: "NamedType",
201
- name: {
202
- kind: "Name",
203
- value: e
204
- }
205
- };
206
- do
207
- if (g.charCodeAt(d) === 33 && (d++, h(), t = {
208
- kind: "NonNullType",
209
- type: t
210
- }), r) {
211
- if (g.charCodeAt(d++) !== 93)
212
- throw N("NamedType");
213
- h(), t = {
214
- kind: "ListType",
215
- type: t
216
- };
217
- }
218
- while (r--);
219
- return t;
220
- }
221
- var le = new RegExp("(?:(\\.{3})|(" + O.source + "))", "y"), ve = function(e) {
222
- return e[e.Spread = 1] = "Spread", e[e.Name = 2] = "Name", e;
223
- }(ve || {});
224
- function X() {
225
- var e = [], r, t;
226
- do
227
- if (le.lastIndex = d, (t = le.exec(g)) != null) {
228
- if (d = le.lastIndex, t[ve.Spread] != null) {
229
- h();
230
- var n = _(O);
231
- if (n != null && n !== "on")
232
- h(), e.push({
233
- kind: "FragmentSpread",
234
- name: {
235
- kind: "Name",
236
- value: n
237
- },
238
- directives: $(!1)
239
- });
240
- else {
241
- if (h(), n === "on") {
242
- if ((n = _(O)) == null)
243
- throw N("NamedType");
244
- h();
245
- }
246
- var i = $(!1);
247
- if (g.charCodeAt(d++) !== 123)
248
- throw N("InlineFragment");
249
- h(), e.push({
250
- kind: "InlineFragment",
251
- typeCondition: n ? {
252
- kind: "NamedType",
253
- name: {
254
- kind: "Name",
255
- value: n
256
- }
257
- } : void 0,
258
- directives: i,
259
- selectionSet: X()
260
- });
261
- }
262
- } else if ((r = t[ve.Name]) != null) {
263
- var a = void 0;
264
- if (h(), g.charCodeAt(d) === 58) {
265
- if (d++, h(), a = r, (r = _(O)) == null)
266
- throw N("Field");
267
- h();
268
- }
269
- var o = Le(!1);
270
- h();
271
- var l = $(!1), f = void 0;
272
- g.charCodeAt(d) === 123 && (d++, h(), f = X()), e.push({
273
- kind: "Field",
274
- alias: a ? {
275
- kind: "Name",
276
- value: a
277
- } : void 0,
278
- name: {
279
- kind: "Name",
280
- value: r
281
- },
282
- arguments: o,
283
- directives: l,
284
- selectionSet: f
285
- });
286
- }
287
- } else
288
- throw N("SelectionSet");
289
- while (g.charCodeAt(d) !== 125);
290
- return d++, h(), {
291
- kind: "SelectionSet",
292
- selections: e
293
- };
294
- }
295
- function Ye() {
296
- var e, r;
297
- if ((e = _(O)) == null || (h(), _(O) !== "on") || (h(), (r = _(O)) == null))
298
- throw N("FragmentDefinition");
299
- h();
300
- var t = $(!1);
301
- if (g.charCodeAt(d++) !== 123)
302
- throw N("FragmentDefinition");
303
- return h(), {
304
- kind: "FragmentDefinition",
305
- name: {
306
- kind: "Name",
307
- value: e
308
- },
309
- typeCondition: {
310
- kind: "NamedType",
311
- name: {
312
- kind: "Name",
313
- value: r
314
- }
315
- },
316
- directives: t,
317
- selectionSet: X()
318
- };
319
- }
320
- var We = /(?:query|mutation|subscription|fragment)/y;
321
- function He(e) {
322
- var r, t, n;
323
- if (e && (h(), r = _(O), t = function() {
324
- if (h(), g.charCodeAt(d) === 40) {
325
- var a = [];
326
- d++, h();
327
- var o;
328
- do {
329
- if (g.charCodeAt(d++) !== 36 || (o = _(O)) == null)
330
- throw N("Variable");
331
- if (h(), g.charCodeAt(d++) !== 58)
332
- throw N("VariableDefinition");
333
- h();
334
- var l = ze(), f = void 0;
335
- g.charCodeAt(d) === 61 && (d++, h(), f = K(!0)), h(), a.push({
336
- kind: "VariableDefinition",
337
- variable: {
338
- kind: "Variable",
339
- name: {
340
- kind: "Name",
341
- value: o
342
- }
343
- },
344
- type: l,
345
- defaultValue: f,
346
- directives: $(!0)
347
- });
348
- } while (g.charCodeAt(d) !== 41);
349
- return d++, h(), a;
350
- }
351
- }(), n = $(!1)), g.charCodeAt(d) === 123)
352
- return d++, h(), {
353
- kind: "OperationDefinition",
354
- operation: e || "query",
355
- name: r ? {
356
- kind: "Name",
357
- value: r
358
- } : void 0,
359
- variableDefinitions: t,
360
- directives: n,
361
- selectionSet: X()
362
- };
363
- }
364
- function Ze(e, r) {
365
- return g = typeof e.body == "string" ? e.body : e, d = 0, function() {
366
- var n, i;
367
- h();
368
- var a = [];
369
- do
370
- if ((n = _(We)) === "fragment")
371
- h(), a.push(Ye());
372
- else if ((i = He(n)) != null)
373
- a.push(i);
374
- else
375
- throw N("Document");
376
- while (d < g.length);
377
- return {
378
- kind: "Document",
379
- definitions: a
380
- };
381
- }();
382
- }
383
- function S(e, r, t) {
384
- for (var n = "", i = 0; i < e.length; i++)
385
- i && (n += r), n += t(e[i]);
386
- return n;
387
- }
388
- function Ke(e) {
389
- return JSON.stringify(e);
390
- }
391
- function Xe(e) {
392
- return `"""
393
- ` + e.replace(/"""/g, '\\"""') + `
394
- """`;
395
- }
396
- var F = `
397
- `, b = {
398
- OperationDefinition(e) {
399
- var r = e.operation;
400
- return e.name && (r += " " + e.name.value), e.variableDefinitions && e.variableDefinitions.length && (e.name || (r += " "), r += "(" + S(e.variableDefinitions, ", ", b.VariableDefinition) + ")"), e.directives && e.directives.length && (r += " " + S(e.directives, " ", b.Directive)), r !== "query" ? r + " " + b.SelectionSet(e.selectionSet) : b.SelectionSet(e.selectionSet);
401
- },
402
- VariableDefinition(e) {
403
- var r = b.Variable(e.variable) + ": " + P(e.type);
404
- return e.defaultValue && (r += " = " + P(e.defaultValue)), e.directives && e.directives.length && (r += " " + S(e.directives, " ", b.Directive)), r;
405
- },
406
- Field(e) {
407
- var r = e.alias ? e.alias.value + ": " + e.name.value : e.name.value;
408
- if (e.arguments && e.arguments.length) {
409
- var t = S(e.arguments, ", ", b.Argument);
410
- r.length + t.length + 2 > 80 ? r += "(" + (F += " ") + S(e.arguments, F, b.Argument) + (F = F.slice(0, -2)) + ")" : r += "(" + t + ")";
411
- }
412
- return e.directives && e.directives.length && (r += " " + S(e.directives, " ", b.Directive)), e.selectionSet && (r += " " + b.SelectionSet(e.selectionSet)), r;
413
- },
414
- StringValue(e) {
415
- return e.block ? Xe(e.value).replace(/\n/g, F) : Ke(e.value);
416
- },
417
- BooleanValue: (e) => "" + e.value,
418
- NullValue: (e) => "null",
419
- IntValue: (e) => e.value,
420
- FloatValue: (e) => e.value,
421
- EnumValue: (e) => e.value,
422
- Name: (e) => e.value,
423
- Variable: (e) => "$" + e.name.value,
424
- ListValue: (e) => "[" + S(e.values, ", ", P) + "]",
425
- ObjectValue: (e) => "{" + S(e.fields, ", ", b.ObjectField) + "}",
426
- ObjectField: (e) => e.name.value + ": " + P(e.value),
427
- Document(e) {
428
- return !e.definitions || !e.definitions.length ? "" : S(e.definitions, `
429
-
430
- `, P);
431
- },
432
- SelectionSet: (e) => "{" + (F += " ") + S(e.selections, F, P) + (F = F.slice(0, -2)) + "}",
433
- Argument: (e) => e.name.value + ": " + P(e.value),
434
- FragmentSpread(e) {
435
- var r = "..." + e.name.value;
436
- return e.directives && e.directives.length && (r += " " + S(e.directives, " ", b.Directive)), r;
437
- },
438
- InlineFragment(e) {
439
- var r = "...";
440
- return e.typeCondition && (r += " on " + e.typeCondition.name.value), e.directives && e.directives.length && (r += " " + S(e.directives, " ", b.Directive)), r += " " + b.SelectionSet(e.selectionSet);
441
- },
442
- FragmentDefinition(e) {
443
- var r = "fragment " + e.name.value;
444
- return r += " on " + e.typeCondition.name.value, e.directives && e.directives.length && (r += " " + S(e.directives, " ", b.Directive)), r + " " + b.SelectionSet(e.selectionSet);
445
- },
446
- Directive(e) {
447
- var r = "@" + e.name.value;
448
- return e.arguments && e.arguments.length && (r += "(" + S(e.arguments, ", ", b.Argument) + ")"), r;
449
- },
450
- NamedType: (e) => e.name.value,
451
- ListType: (e) => "[" + P(e.type) + "]",
452
- NonNullType: (e) => P(e.type) + "!"
453
- }, P = (e) => b[e.kind](e);
454
- function er(e) {
455
- return F = `
456
- `, b[e.kind] ? b[e.kind](e) : "";
457
- }
458
- var ge = () => {
459
- }, T = ge;
460
- function C(e) {
461
- return {
462
- tag: 0,
463
- 0: e
464
- };
465
- }
466
- function z(e) {
467
- return {
468
- tag: 1,
469
- 0: e
470
- };
471
- }
472
- var Ne = () => typeof Symbol == "function" && Symbol.asyncIterator || "@@asyncIterator", rr = (e) => e;
473
- function A(e) {
474
- return (r) => (t) => {
475
- var n = T;
476
- r((i) => {
477
- i === 0 ? t(0) : i.tag === 0 ? (n = i[0], t(i)) : e(i[0]) ? t(i) : n(0);
478
- });
479
- };
480
- }
481
- function W(e) {
482
- return (r) => (t) => r((n) => {
483
- n === 0 || n.tag === 0 ? t(n) : t(z(e(n[0])));
484
- });
485
- }
486
- function ee(e) {
487
- return (r) => (t) => {
488
- var n = [], i = T, a = !1, o = !1;
489
- r((l) => {
490
- o || (l === 0 ? (o = !0, n.length || t(0)) : l.tag === 0 ? i = l[0] : (a = !1, function(u) {
491
- var p = T;
492
- u((c) => {
493
- if (c === 0) {
494
- if (n.length) {
495
- var m = n.indexOf(p);
496
- m > -1 && (n = n.slice()).splice(m, 1), n.length || (o ? t(0) : a || (a = !0, i(0)));
497
- }
498
- } else c.tag === 0 ? (n.push(p = c[0]), p(0)) : n.length && (t(c), p(0));
499
- });
500
- }(e(l[0])), a || (a = !0, i(0))));
501
- }), t(C((l) => {
502
- if (l === 1) {
503
- o || (o = !0, i(1));
504
- for (var f = 0, u = n, p = n.length; f < p; f++)
505
- u[f](1);
506
- n.length = 0;
507
- } else {
508
- !o && !a ? (a = !0, i(0)) : a = !1;
509
- for (var c = 0, m = n, x = n.length; c < x; c++)
510
- m[c](0);
511
- }
512
- }));
513
- };
514
- }
515
- function tr(e) {
516
- return ee(rr)(e);
517
- }
518
- function J(e) {
519
- return tr(or(e));
520
- }
521
- function je(e) {
522
- return (r) => (t) => {
523
- var n = !1;
524
- r((i) => {
525
- if (!n) if (i === 0)
526
- n = !0, t(0), e();
527
- else if (i.tag === 0) {
528
- var a = i[0];
529
- t(C((o) => {
530
- o === 1 ? (n = !0, a(1), e()) : a(o);
531
- }));
532
- } else
533
- t(i);
534
- });
535
- };
536
- }
537
- function ie(e) {
538
- return (r) => (t) => {
539
- var n = !1;
540
- r((i) => {
541
- if (!n) if (i === 0)
542
- n = !0, t(0);
543
- else if (i.tag === 0) {
544
- var a = i[0];
545
- t(C((o) => {
546
- o === 1 && (n = !0), a(o);
547
- }));
548
- } else
549
- e(i[0]), t(i);
550
- });
551
- };
552
- }
553
- function be(e) {
554
- return (r) => (t) => r((n) => {
555
- n === 0 ? t(0) : n.tag === 0 ? (t(n), e()) : t(n);
556
- });
557
- }
558
- function Q(e) {
559
- var r = [], t = T, n = !1;
560
- return (i) => {
561
- r.push(i), r.length === 1 && e((a) => {
562
- if (a === 0) {
563
- for (var o = 0, l = r, f = r.length; o < f; o++)
564
- l[o](0);
565
- r.length = 0;
566
- } else if (a.tag === 0)
567
- t = a[0];
568
- else {
569
- n = !1;
570
- for (var u = 0, p = r, c = r.length; u < c; u++)
571
- p[u](a);
572
- }
573
- }), i(C((a) => {
574
- if (a === 1) {
575
- var o = r.indexOf(i);
576
- o > -1 && (r = r.slice()).splice(o, 1), r.length || t(1);
577
- } else n || (n = !0, t(0));
578
- }));
579
- };
580
- }
581
- function we(e) {
582
- return (r) => (t) => {
583
- var n = T, i = T, a = !1, o = !1, l = !1, f = !1;
584
- r((u) => {
585
- f || (u === 0 ? (f = !0, l || t(0)) : u.tag === 0 ? n = u[0] : (l && (i(1), i = T), a ? a = !1 : (a = !0, n(0)), function(c) {
586
- l = !0, c((m) => {
587
- l && (m === 0 ? (l = !1, f ? t(0) : a || (a = !0, n(0))) : m.tag === 0 ? (o = !1, (i = m[0])(0)) : (t(m), o ? o = !1 : i(0)));
588
- });
589
- }(e(u[0]))));
590
- }), t(C((u) => {
591
- u === 1 ? (f || (f = !0, n(1)), l && (l = !1, i(1))) : (!f && !a && (a = !0, n(0)), l && !o && (o = !0, i(0)));
592
- }));
593
- };
594
- }
595
- function Re(e) {
596
- return (r) => (t) => {
597
- var n = T, i = !1, a = 0;
598
- r((o) => {
599
- i || (o === 0 ? (i = !0, t(0)) : o.tag === 0 ? n = o[0] : a++ < e ? (t(o), !i && a >= e && (i = !0, t(0), n(1))) : t(o));
600
- }), t(C((o) => {
601
- o === 1 && !i ? (i = !0, n(1)) : o === 0 && !i && a < e && n(0);
602
- }));
603
- };
604
- }
605
- function Me(e) {
606
- return (r) => (t) => {
607
- var n = T, i = T, a = !1;
608
- r((o) => {
609
- a || (o === 0 ? (a = !0, i(1), t(0)) : o.tag === 0 ? (n = o[0], e((l) => {
610
- l === 0 || (l.tag === 0 ? (i = l[0])(0) : (a = !0, i(1), n(1), t(0)));
611
- })) : t(o));
612
- }), t(C((o) => {
613
- o === 1 && !a ? (a = !0, n(1), i(1)) : a || n(0);
614
- }));
615
- };
616
- }
617
- function nr(e, r) {
618
- return (t) => (n) => {
619
- var i = T, a = !1;
620
- t((o) => {
621
- a || (o === 0 ? (a = !0, n(0)) : o.tag === 0 ? (i = o[0], n(o)) : e(o[0]) ? n(o) : (a = !0, r && n(o), n(0), i(1)));
622
- });
623
- };
624
- }
625
- function ar(e) {
626
- return (r) => e()(r);
627
- }
628
- function $e(e) {
629
- return (r) => {
630
- var t = e[Ne()] && e[Ne()]() || e, n = !1, i = !1, a = !1, o;
631
- r(C(async (l) => {
632
- if (l === 1)
633
- n = !0, t.return && t.return();
634
- else if (i)
635
- a = !0;
636
- else {
637
- for (a = i = !0; a && !n; )
638
- if ((o = await t.next()).done)
639
- n = !0, t.return && await t.return(), r(0);
640
- else
641
- try {
642
- a = !1, r(z(o.value));
643
- } catch (f) {
644
- if (t.throw)
645
- (n = !!(await t.throw(f)).done) && r(0);
646
- else
647
- throw f;
648
- }
649
- i = !1;
650
- }
651
- }));
652
- };
653
- }
654
- function ir(e) {
655
- return e[Symbol.asyncIterator] ? $e(e) : (r) => {
656
- var t = e[Symbol.iterator](), n = !1, i = !1, a = !1, o;
657
- r(C((l) => {
658
- if (l === 1)
659
- n = !0, t.return && t.return();
660
- else if (i)
661
- a = !0;
662
- else {
663
- for (a = i = !0; a && !n; )
664
- if ((o = t.next()).done)
665
- n = !0, t.return && t.return(), r(0);
666
- else
667
- try {
668
- a = !1, r(z(o.value));
669
- } catch (f) {
670
- if (t.throw)
671
- (n = !!t.throw(f).done) && r(0);
672
- else
673
- throw f;
674
- }
675
- i = !1;
676
- }
677
- }));
678
- };
679
- }
680
- var or = ir;
681
- function G(e) {
682
- return (r) => {
683
- var t = !1;
684
- r(C((n) => {
685
- n === 1 ? t = !0 : t || (t = !0, r(z(e)), r(0));
686
- }));
687
- };
688
- }
689
- function Be(e) {
690
- return (r) => {
691
- var t = !1, n = e({
692
- next(i) {
693
- t || r(z(i));
694
- },
695
- complete() {
696
- t || (t = !0, r(0));
697
- }
698
- });
699
- r(C((i) => {
700
- i === 1 && !t && (t = !0, n());
701
- }));
702
- };
703
- }
704
- function Ee() {
705
- var e, r;
706
- return {
707
- source: Q(Be((t) => (e = t.next, r = t.complete, ge))),
708
- next(t) {
709
- e && e(t);
710
- },
711
- complete() {
712
- r && r();
713
- }
714
- };
715
- }
716
- function Oe(e) {
717
- return Be((r) => (e.then((t) => {
718
- Promise.resolve(t).then(() => {
719
- r.next(t), r.complete();
720
- });
721
- }), ge));
722
- }
723
- function re(e) {
724
- return (r) => {
725
- var t = T, n = !1;
726
- return r((i) => {
727
- i === 0 ? n = !0 : i.tag === 0 ? (t = i[0])(0) : n || (e(i[0]), t(0));
728
- }), {
729
- unsubscribe() {
730
- n || (n = !0, t(1));
731
- }
732
- };
733
- };
734
- }
735
- function sr(e) {
736
- re((r) => {
737
- })(e);
738
- }
739
- function lr(e) {
740
- return new Promise((r) => {
741
- var t = T, n;
742
- e((i) => {
743
- i === 0 ? Promise.resolve(n).then(r) : i.tag === 0 ? (t = i[0])(0) : (n = i[0], t(0));
744
- });
745
- });
746
- }
747
- var ur = (e) => e && e.message && (e.extensions || e.name === "GraphQLError") ? e : typeof e == "object" && e.message ? new fe(e.message, e.nodes, e.source, e.positions, e.path, e, e.extensions || {}) : new fe(e);
748
- class ke extends Error {
749
- constructor(r) {
750
- var t = (r.graphQLErrors || []).map(ur), n = ((i, a) => {
751
- var o = "";
752
- if (i)
753
- return `[Network] ${i.message}`;
754
- if (a)
755
- for (var l of a)
756
- o && (o += `
757
- `), o += `[GraphQL] ${l.message}`;
758
- return o;
759
- })(r.networkError, t);
760
- super(n), this.name = "CombinedError", this.message = n, this.graphQLErrors = t, this.networkError = r.networkError, this.response = r.response;
761
- }
762
- toString() {
763
- return this.message;
764
- }
765
- }
766
- var H = (e, r) => {
767
- for (var t = 0 | (r || 5381), n = 0, i = 0 | e.length; n < i; n++)
768
- t = (t << 5) + t + e.charCodeAt(n);
769
- return t;
770
- }, j = /* @__PURE__ */ new Set(), Se = /* @__PURE__ */ new WeakMap(), R = (e, r) => {
771
- if (e === null || j.has(e))
772
- return "null";
773
- if (typeof e != "object")
774
- return JSON.stringify(e) || "";
775
- if (e.toJSON)
776
- return R(e.toJSON(), r);
777
- if (Array.isArray(e)) {
778
- var t = "[";
779
- for (var n of e)
780
- t.length > 1 && (t += ","), t += R(n, r) || "null";
781
- return t += "]";
782
- } else if (!r && (ne !== B && e instanceof ne || ae !== B && e instanceof ae))
783
- return "null";
784
- var i = Object.keys(e).sort();
785
- if (!i.length && e.constructor && Object.getPrototypeOf(e).constructor !== Object.prototype.constructor) {
786
- var a = Se.get(e) || Math.random().toString(36).slice(2);
787
- return Se.set(e, a), R({
788
- __key: a
789
- }, r);
790
- }
791
- j.add(e);
792
- var o = "{";
793
- for (var l of i) {
794
- var f = R(e[l], r);
795
- f && (o.length > 1 && (o += ","), o += R(l, r) + ":" + f);
796
- }
797
- return j.delete(e), o += "}";
798
- }, de = (e, r, t) => {
799
- if (!(t == null || typeof t != "object" || t.toJSON || j.has(t))) if (Array.isArray(t))
800
- for (var n = 0, i = t.length; n < i; n++)
801
- de(e, `${r}.${n}`, t[n]);
802
- else if (t instanceof ne || t instanceof ae)
803
- e.set(r, t);
804
- else {
805
- j.add(t);
806
- for (var a of Object.keys(t))
807
- de(e, `${r}.${a}`, t[a]);
808
- }
809
- }, te = (e, r) => (j.clear(), R(e, r || !1));
810
- class B {
811
- }
812
- var ne = typeof File < "u" ? File : B, ae = typeof Blob < "u" ? Blob : B, cr = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g, fr = /(?:#[^\n\r]+)?(?:[\r\n]+|$)/g, vr = (e, r) => r % 2 == 0 ? e.replace(fr, `
813
- `) : e, Ae = (e) => e.split(cr).map(vr).join("").trim(), De = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), xe = (e) => {
814
- var r;
815
- return typeof e == "string" ? r = Ae(e) : e.loc && Z.get(e.__key) === e ? r = e.loc.source.body : (r = De.get(e) || Ae(er(e)), De.set(e, r)), typeof e != "string" && !e.loc && (e.loc = {
816
- start: 0,
817
- end: r.length,
818
- source: {
819
- body: r,
820
- name: "gql",
821
- locationOffset: {
822
- line: 1,
823
- column: 1
824
- }
825
- }
826
- }), r;
827
- }, Ie = (e) => {
828
- var r;
829
- if (e.documentId)
830
- r = H(e.documentId);
831
- else if (r = H(xe(e)), e.definitions) {
832
- var t = Je(e);
833
- t && (r = H(`
834
- # ${t}`, r));
835
- }
836
- return r;
837
- }, Ge = (e) => {
838
- var r, t;
839
- return typeof e == "string" ? (r = Ie(e), t = Z.get(r) || Ze(e)) : (r = e.__key || Ie(e), t = Z.get(r) || e), t.loc || xe(t), t.__key = r, Z.set(r, t), t;
840
- }, ue = (e, r, t) => {
841
- var n = r || {}, i = Ge(e), a = te(n, !0), o = i.__key;
842
- return a !== "{}" && (o = H(a, o)), {
843
- key: o,
844
- query: i,
845
- variables: n,
846
- extensions: t
847
- };
848
- }, Je = (e) => {
849
- for (var r of e.definitions)
850
- if (r.kind === M.OPERATION_DEFINITION)
851
- return r.name ? r.name.value : void 0;
852
- }, dr = (e) => {
853
- for (var r of e.definitions)
854
- if (r.kind === M.OPERATION_DEFINITION)
855
- return r.operation;
856
- }, pe = (e, r, t) => {
857
- if (!("data" in r || "errors" in r && Array.isArray(r.errors)))
858
- throw new Error("No Content");
859
- var n = e.kind === "subscription";
860
- return {
861
- operation: e,
862
- data: r.data,
863
- error: Array.isArray(r.errors) ? new ke({
864
- graphQLErrors: r.errors,
865
- response: t
866
- }) : void 0,
867
- extensions: r.extensions ? {
868
- ...r.extensions
869
- } : void 0,
870
- hasNext: r.hasNext == null ? n : r.hasNext,
871
- stale: !1
872
- };
873
- }, he = (e, r) => {
874
- if (typeof e == "object" && e != null && (!e.constructor || e.constructor === Object || Array.isArray(e))) {
875
- e = Array.isArray(e) ? [...e] : {
876
- ...e
877
- };
878
- for (var t of Object.keys(r))
879
- e[t] = he(e[t], r[t]);
880
- return e;
881
- }
882
- return r;
883
- }, pr = (e, r, t, n) => {
884
- var i = e.error ? e.error.graphQLErrors : [], a = !!e.extensions || !!(r.payload || r).extensions, o = {
885
- ...e.extensions,
886
- ...(r.payload || r).extensions
887
- }, l = r.incremental;
888
- "path" in r && (l = [r]);
889
- var f = {
890
- data: e.data
891
- };
892
- if (l) {
893
- var u = function(c) {
894
- Array.isArray(c.errors) && i.push(...c.errors), c.extensions && (Object.assign(o, c.extensions), a = !0);
895
- var m = "data", x = f, k = [];
896
- if (c.path)
897
- k = c.path;
898
- else if (n) {
899
- var w = n.find((y) => y.id === c.id);
900
- c.subPath ? k = [...w.path, ...c.subPath] : k = w.path;
901
- }
902
- for (var E = 0, D = k.length; E < D; m = k[E++])
903
- x = x[m] = Array.isArray(x[m]) ? [...x[m]] : {
904
- ...x[m]
905
- };
906
- if (c.items)
907
- for (var q = +m >= 0 ? m : 0, I = 0, s = c.items.length; I < s; I++)
908
- x[q + I] = he(x[q + I], c.items[I]);
909
- else c.data !== void 0 && (x[m] = he(x[m], c.data));
910
- };
911
- for (var p of l)
912
- u(p);
913
- } else
914
- f.data = (r.payload || r).data || e.data, i = r.errors || r.payload && r.payload.errors || i;
915
- return {
916
- operation: e.operation,
917
- data: f.data,
918
- error: i.length ? new ke({
919
- graphQLErrors: i,
920
- response: t
921
- }) : void 0,
922
- extensions: a ? o : void 0,
923
- hasNext: r.hasNext != null ? r.hasNext : e.hasNext,
924
- stale: !1
925
- };
926
- }, hr = (e, r, t) => ({
927
- operation: e,
928
- data: void 0,
929
- error: new ke({
930
- networkError: r,
931
- response: t
932
- }),
933
- extensions: void 0,
934
- hasNext: !1,
935
- stale: !1
936
- });
937
- function yr(e) {
938
- var r = {
939
- query: void 0,
940
- documentId: void 0,
941
- operationName: Je(e.query),
942
- variables: e.variables || void 0,
943
- extensions: e.extensions
944
- };
945
- return "documentId" in e.query && e.query.documentId && (!e.query.definitions || !e.query.definitions.length) ? r.documentId = e.query.documentId : (!e.extensions || !e.extensions.persistedQuery || e.extensions.persistedQuery.miss) && (r.query = xe(e.query)), r;
946
- }
947
- var mr = (e, r) => {
948
- var t = e.kind === "query" && e.context.preferGetMethod;
949
- if (!t || !r)
950
- return e.context.url;
951
- var n = gr(e.context.url);
952
- for (var i in r) {
953
- var a = r[i];
954
- a && n[1].set(i, typeof a == "object" ? te(a) : a);
955
- }
956
- var o = n.join("?");
957
- return o.length > 2047 && t !== "force" ? (e.context.preferGetMethod = !1, e.context.url) : o;
958
- }, gr = (e) => {
959
- var r = e.indexOf("?");
960
- return r > -1 ? [e.slice(0, r), new URLSearchParams(e.slice(r + 1))] : [e, new URLSearchParams()];
961
- }, kr = (e, r) => {
962
- if (r && !(e.kind === "query" && e.context.preferGetMethod)) {
963
- var t = te(r), n = ((l) => {
964
- var f = /* @__PURE__ */ new Map();
965
- return (ne !== B || ae !== B) && (j.clear(), de(f, "variables", l)), f;
966
- })(r.variables);
967
- if (n.size) {
968
- var i = new FormData();
969
- i.append("operations", t), i.append("map", te({
970
- ...[...n.keys()].map((l) => [l])
971
- }));
972
- var a = 0;
973
- for (var o of n.values())
974
- i.append("" + a++, o);
975
- return i;
976
- }
977
- return t;
978
- }
979
- }, xr = (e, r) => {
980
- var t = {
981
- accept: e.kind === "subscription" ? "text/event-stream, multipart/mixed" : "application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed"
982
- }, n = (typeof e.context.fetchOptions == "function" ? e.context.fetchOptions() : e.context.fetchOptions) || {};
983
- if (n.headers)
984
- if (((o) => "has" in o && !Object.keys(o).length)(n.headers))
985
- n.headers.forEach((o, l) => {
986
- t[l] = o;
987
- });
988
- else if (Array.isArray(n.headers))
989
- n.headers.forEach((o, l) => {
990
- Array.isArray(o) ? t[o[0]] ? t[o[0]] = `${t[o[0]]},${o[1]}` : t[o[0]] = o[1] : t[l] = o;
991
- });
992
- else
993
- for (var i in n.headers)
994
- t[i.toLowerCase()] = n.headers[i];
995
- var a = kr(e, r);
996
- return typeof a == "string" && !t["content-type"] && (t["content-type"] = "application/json"), {
997
- ...n,
998
- method: a ? "POST" : "GET",
999
- body: a,
1000
- headers: t
1001
- };
1002
- }, Nr = typeof TextDecoder < "u" ? new TextDecoder() : null, br = /boundary="?([^=";]+)"?/i, wr = /data: ?([^\n]+)/, Ve = (e) => e.constructor.name === "Buffer" ? e.toString() : Nr.decode(e);
1003
- async function* _e(e) {
1004
- if (e.body[Symbol.asyncIterator])
1005
- for await (var r of e.body)
1006
- yield Ve(r);
1007
- else {
1008
- var t = e.body.getReader(), n;
1009
- try {
1010
- for (; !(n = await t.read()).done; )
1011
- yield Ve(n.value);
1012
- } finally {
1013
- t.cancel();
1014
- }
1015
- }
1016
- }
1017
- async function* Te(e, r) {
1018
- var t = "", n;
1019
- for await (var i of e)
1020
- for (t += i; (n = t.indexOf(r)) > -1; )
1021
- yield t.slice(0, n), t = t.slice(n + r.length);
1022
- }
1023
- async function* Er(e, r, t) {
1024
- var n = !0, i = null, a;
1025
- try {
1026
- yield await Promise.resolve();
1027
- var o = (a = await (e.context.fetch || fetch)(r, t)).headers.get("Content-Type") || "", l;
1028
- /multipart\/mixed/i.test(o) ? l = async function* (c, m) {
1029
- var x = c.match(br), k = "--" + (x ? x[1] : "-"), w = !0, E;
1030
- for await (var D of Te(_e(m), `\r
1031
- ` + k)) {
1032
- if (w) {
1033
- w = !1;
1034
- var q = D.indexOf(k);
1035
- if (q > -1)
1036
- D = D.slice(q + k.length);
1037
- else
1038
- continue;
1039
- }
1040
- try {
1041
- yield E = JSON.parse(D.slice(D.indexOf(`\r
1042
- \r
1043
- `) + 4));
1044
- } catch (I) {
1045
- if (!E)
1046
- throw I;
1047
- }
1048
- if (E && E.hasNext === !1)
1049
- break;
1050
- }
1051
- E && E.hasNext !== !1 && (yield {
1052
- hasNext: !1
1053
- });
1054
- }(o, a) : /text\/event-stream/i.test(o) ? l = async function* (c) {
1055
- var m;
1056
- for await (var x of Te(_e(c), `
1057
-
1058
- `)) {
1059
- var k = x.match(wr);
1060
- if (k) {
1061
- var w = k[1];
1062
- try {
1063
- yield m = JSON.parse(w);
1064
- } catch (E) {
1065
- if (!m)
1066
- throw E;
1067
- }
1068
- if (m && m.hasNext === !1)
1069
- break;
1070
- }
1071
- }
1072
- m && m.hasNext !== !1 && (yield {
1073
- hasNext: !1
1074
- });
1075
- }(a) : /text\//i.test(o) ? l = async function* (c) {
1076
- var m = await c.text();
1077
- try {
1078
- var x = JSON.parse(m);
1079
- process.env.NODE_ENV !== "production" && console.warn('Found response with content-type "text/plain" but it had a valid "application/json" response.'), yield x;
1080
- } catch {
1081
- throw new Error(m);
1082
- }
1083
- }(a) : l = async function* (c) {
1084
- yield JSON.parse(await c.text());
1085
- }(a);
1086
- var f;
1087
- for await (var u of l)
1088
- u.pending && !i ? f = u.pending : u.pending && (f = [...f, ...u.pending]), i = i ? pr(i, u, a, f) : pe(e, u, a), n = !1, yield i, n = !0;
1089
- i || (yield i = pe(e, {}, a));
1090
- } catch (p) {
1091
- if (!n)
1092
- throw p;
1093
- yield hr(e, a && (a.status < 200 || a.status >= 300) && a.statusText ? new Error(a.statusText) : p, a);
1094
- }
1095
- }
1096
- function Or(e, r, t) {
1097
- var n;
1098
- return typeof AbortController < "u" && (t.signal = (n = new AbortController()).signal), je(() => {
1099
- n && n.abort();
1100
- })(A((i) => !!i)($e(Er(e, r, t))));
1101
- }
1102
- var ye = (e, r) => {
1103
- if (Array.isArray(e))
1104
- for (var t of e)
1105
- ye(t, r);
1106
- else if (typeof e == "object" && e !== null)
1107
- for (var n in e)
1108
- n === "__typename" && typeof e[n] == "string" ? r.add(e[n]) : ye(e[n], r);
1109
- return r;
1110
- }, me = (e) => {
1111
- if ("definitions" in e) {
1112
- var r = [];
1113
- for (var t of e.definitions) {
1114
- var n = me(t);
1115
- r.push(n);
1116
- }
1117
- return {
1118
- ...e,
1119
- definitions: r
1120
- };
1121
- }
1122
- if ("directives" in e && e.directives && e.directives.length) {
1123
- var i = [], a = {};
1124
- for (var o of e.directives) {
1125
- var l = o.name.value;
1126
- l[0] !== "_" ? i.push(o) : l = l.slice(1), a[l] = o;
1127
- }
1128
- e = {
1129
- ...e,
1130
- directives: i,
1131
- _directives: a
1132
- };
1133
- }
1134
- if ("selectionSet" in e) {
1135
- var f = [], u = e.kind === M.OPERATION_DEFINITION;
1136
- if (e.selectionSet) {
1137
- for (var p of e.selectionSet.selections || []) {
1138
- u = u || p.kind === M.FIELD && p.name.value === "__typename" && !p.alias;
1139
- var c = me(p);
1140
- f.push(c);
1141
- }
1142
- return u || f.push({
1143
- kind: M.FIELD,
1144
- name: {
1145
- kind: M.NAME,
1146
- value: "__typename"
1147
- },
1148
- _generated: !0
1149
- }), {
1150
- ...e,
1151
- selectionSet: {
1152
- ...e.selectionSet,
1153
- selections: f
1154
- }
1155
- };
1156
- }
1157
- }
1158
- return e;
1159
- }, qe = /* @__PURE__ */ new Map(), Sr = (e) => {
1160
- var r = Ge(e), t = qe.get(r.__key);
1161
- return t || (qe.set(r.__key, t = me(r)), Object.defineProperty(t, "__key", {
1162
- value: r.__key,
1163
- enumerable: !1
1164
- })), t;
1165
- };
1166
- function Ce(e) {
1167
- var r = (t) => e(t);
1168
- return r.toPromise = () => lr(Re(1)(A((t) => !t.stale && !t.hasNext)(r))), r.then = (t, n) => r.toPromise().then(t, n), r.subscribe = (t) => re(t)(r), r;
1169
- }
1170
- function U(e, r, t) {
1171
- return {
1172
- ...r,
1173
- kind: e,
1174
- context: r.context ? {
1175
- ...r.context,
1176
- ...t
1177
- } : t || r.context
1178
- };
1179
- }
1180
- var Fe = (e, r) => U(e.kind, e, {
1181
- meta: {
1182
- ...e.context.meta,
1183
- ...r
1184
- }
1185
- }), Ar = () => {
1186
- }, ce = ({ kind: e }) => e !== "mutation" && e !== "query", Dr = (e) => {
1187
- var r = Sr(e.query);
1188
- if (r !== e.query) {
1189
- var t = U(e.kind, e);
1190
- return t.query = r, t;
1191
- } else
1192
- return e;
1193
- }, _r = ({ forward: e, client: r, dispatchDebug: t }) => {
1194
- var n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = (o) => o.kind === "query" && o.context.requestPolicy !== "network-only" && (o.context.requestPolicy === "cache-only" || n.has(o.key));
1195
- return (o) => {
1196
- var l = W((u) => {
1197
- var p = n.get(u.key);
1198
- process.env.NODE_ENV !== "production" && t({
1199
- operation: u,
1200
- ...p ? {
1201
- type: "cacheHit",
1202
- message: "The result was successfully retried from the cache"
1203
- } : {
1204
- type: "cacheMiss",
1205
- message: "The result could not be retrieved from the cache"
1206
- },
1207
- source: "cacheExchange"
1208
- });
1209
- var c = p || pe(u, {
1210
- data: null
1211
- });
1212
- return c = {
1213
- ...c,
1214
- operation: process.env.NODE_ENV !== "production" ? Fe(u, {
1215
- cacheOutcome: p ? "hit" : "miss"
1216
- }) : u
1217
- }, u.context.requestPolicy === "cache-and-network" && (c.stale = !0, Pe(r, u)), c;
1218
- })(A((u) => !ce(u) && a(u))(o)), f = ie((u) => {
1219
- var { operation: p } = u;
1220
- if (p) {
1221
- var c = p.context.additionalTypenames || [];
1222
- if (u.operation.kind !== "subscription" && (c = ((y) => [...ye(y, /* @__PURE__ */ new Set())])(u.data).concat(c)), u.operation.kind === "mutation" || u.operation.kind === "subscription") {
1223
- var m = /* @__PURE__ */ new Set();
1224
- process.env.NODE_ENV !== "production" && t({
1225
- type: "cacheInvalidation",
1226
- message: `The following typenames have been invalidated: ${c}`,
1227
- operation: p,
1228
- data: {
1229
- typenames: c,
1230
- response: u
1231
- },
1232
- source: "cacheExchange"
1233
- });
1234
- for (var x = 0; x < c.length; x++) {
1235
- var k = c[x], w = i.get(k);
1236
- w || i.set(k, w = /* @__PURE__ */ new Set());
1237
- for (var E of w.values())
1238
- m.add(E);
1239
- w.clear();
1240
- }
1241
- for (var D of m.values())
1242
- n.has(D) && (p = n.get(D).operation, n.delete(D), Pe(r, p));
1243
- } else if (p.kind === "query" && u.data) {
1244
- n.set(p.key, u);
1245
- for (var q = 0; q < c.length; q++) {
1246
- var I = c[q], s = i.get(I);
1247
- s || i.set(I, s = /* @__PURE__ */ new Set()), s.add(p.key);
1248
- }
1249
- }
1250
- }
1251
- })(e(A((u) => u.kind !== "query" || u.context.requestPolicy !== "cache-only")(W((u) => process.env.NODE_ENV !== "production" ? Fe(u, {
1252
- cacheOutcome: "miss"
1253
- }) : u)(J([W(Dr)(A((u) => !ce(u) && !a(u))(o)), A((u) => ce(u))(o)])))));
1254
- return J([l, f]);
1255
- };
1256
- }, Pe = (e, r) => e.reexecuteOperation(U(r.kind, r, {
1257
- requestPolicy: "network-only"
1258
- })), Tr = ({ forward: e, dispatchDebug: r }) => (t) => {
1259
- var n = ee((a) => {
1260
- var o = yr(a), l = mr(a, o), f = xr(a, o);
1261
- process.env.NODE_ENV !== "production" && r({
1262
- type: "fetchRequest",
1263
- message: "A fetch request is being executed.",
1264
- operation: a,
1265
- data: {
1266
- url: l,
1267
- fetchOptions: f
1268
- },
1269
- source: "fetchExchange"
1270
- });
1271
- var u = Me(A((p) => p.kind === "teardown" && p.key === a.key)(t))(Or(a, l, f));
1272
- return process.env.NODE_ENV !== "production" ? ie((p) => {
1273
- var c = p.data ? void 0 : p.error;
1274
- process.env.NODE_ENV !== "production" && r({
1275
- type: c ? "fetchError" : "fetchSuccess",
1276
- message: `A ${c ? "failed" : "successful"} fetch response has been returned.`,
1277
- operation: a,
1278
- data: {
1279
- url: l,
1280
- fetchOptions: f,
1281
- value: c || p
1282
- },
1283
- source: "fetchExchange"
1284
- });
1285
- })(u) : u;
1286
- })(A((a) => a.kind !== "teardown" && (a.kind !== "subscription" || !!a.context.fetchSubscriptions))(t)), i = e(A((a) => a.kind === "teardown" || a.kind === "subscription" && !a.context.fetchSubscriptions)(t));
1287
- return J([n, i]);
1288
- }, Ir = (e) => ({ client: r, forward: t, dispatchDebug: n }) => e.reduceRight((i, a) => {
1289
- var o = !1;
1290
- return a({
1291
- client: r,
1292
- forward(l) {
1293
- if (process.env.NODE_ENV !== "production") {
1294
- if (o)
1295
- throw new Error("forward() must only be called once in each Exchange.");
1296
- o = !0;
1297
- }
1298
- return Q(i(Q(l)));
1299
- },
1300
- dispatchDebug(l) {
1301
- process.env.NODE_ENV !== "production" && n({
1302
- timestamp: Date.now(),
1303
- source: a.name,
1304
- ...l
1305
- });
1306
- }
1307
- });
1308
- }, t), qr = ({ onOperation: e, onResult: r, onError: t }) => ({ forward: n }) => (i) => ee((a) => {
1309
- t && a.error && t(a.error, a.operation);
1310
- var o = r && r(a) || a;
1311
- return "then" in o ? Oe(o) : G(o);
1312
- })(n(ee((a) => {
1313
- var o = e && e(a) || a;
1314
- return "then" in o ? Oe(o) : G(o);
1315
- })(i))), Vr = ({ dispatchDebug: e }) => (r) => (process.env.NODE_ENV !== "production" && (r = ie((t) => {
1316
- if (t.kind !== "teardown" && process.env.NODE_ENV !== "production") {
1317
- var n = `No exchange has handled operations of kind "${t.kind}". Check whether you've added an exchange responsible for these operations.`;
1318
- process.env.NODE_ENV !== "production" && e({
1319
- type: "fallbackCatch",
1320
- message: n,
1321
- operation: t,
1322
- source: "fallbackExchange"
1323
- }), console.warn(n);
1324
- }
1325
- })(r)), A((t) => !1)(r)), Cr = function e(r) {
1326
- if (process.env.NODE_ENV !== "production" && !r.url)
1327
- throw new Error("You are creating an urql-client without a url.");
1328
- var t = 0, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = [], l = {
1329
- url: r.url,
1330
- fetchSubscriptions: r.fetchSubscriptions,
1331
- fetchOptions: r.fetchOptions,
1332
- fetch: r.fetch,
1333
- preferGetMethod: r.preferGetMethod,
1334
- requestPolicy: r.requestPolicy || "cache-first"
1335
- }, f = Ee();
1336
- function u(s) {
1337
- (s.kind === "mutation" || s.kind === "teardown" || !a.has(s.key)) && (s.kind === "teardown" ? a.delete(s.key) : s.kind !== "mutation" && a.add(s.key), f.next(s));
1338
- }
1339
- var p = !1;
1340
- function c(s) {
1341
- if (s && u(s), !p) {
1342
- for (p = !0; p && (s = o.shift()); )
1343
- u(s);
1344
- p = !1;
1345
- }
1346
- }
1347
- var m = (s) => {
1348
- var y = Me(A((v) => v.kind === "teardown" && v.key === s.key)(f.source))(A((v) => v.operation.kind === s.kind && v.operation.key === s.key && (!v.operation.context._instance || v.operation.context._instance === s.context._instance))(I));
1349
- return s.kind !== "query" ? y = nr((v) => !!v.hasNext, !0)(y) : y = we((v) => {
1350
- var V = G(v);
1351
- return v.stale || v.hasNext ? V : J([V, W(() => (v.stale = !0, v))(Re(1)(A((oe) => oe.key === s.key)(f.source)))]);
1352
- })(y), s.kind !== "mutation" ? y = je(() => {
1353
- a.delete(s.key), n.delete(s.key), i.delete(s.key), p = !1;
1354
- for (var v = o.length - 1; v >= 0; v--)
1355
- o[v].key === s.key && o.splice(v, 1);
1356
- u(U("teardown", s, s.context));
1357
- })(ie((v) => {
1358
- if (v.stale) {
1359
- if (!v.hasNext)
1360
- a.delete(s.key);
1361
- else
1362
- for (var V of o)
1363
- if (V.key === v.operation.key) {
1364
- a.delete(V.key);
1365
- break;
1366
- }
1367
- } else v.hasNext || a.delete(s.key);
1368
- n.set(s.key, v);
1369
- })(y)) : y = be(() => {
1370
- u(s);
1371
- })(y), Q(y);
1372
- }, x = this instanceof e ? this : Object.create(e.prototype), k = Object.assign(x, {
1373
- suspense: !!r.suspense,
1374
- operations$: f.source,
1375
- reexecuteOperation(s) {
1376
- if (s.kind === "teardown")
1377
- c(s);
1378
- else if (s.kind === "mutation")
1379
- o.push(s), Promise.resolve().then(c);
1380
- else if (i.has(s.key)) {
1381
- for (var y = !1, v = 0; v < o.length; v++)
1382
- o[v].key === s.key && (o[v] = s, y = !0);
1383
- y || a.has(s.key) && s.context.requestPolicy !== "network-only" ? (a.delete(s.key), Promise.resolve().then(c)) : (o.push(s), Promise.resolve().then(c));
1384
- }
1385
- },
1386
- createRequestOperation(s, y, v) {
1387
- v || (v = {});
1388
- var V;
1389
- if (process.env.NODE_ENV !== "production" && s !== "teardown" && (V = dr(y.query)) !== s)
1390
- throw new Error(`Expected operation of type "${s}" but found "${V}"`);
1391
- return U(s, y, {
1392
- _instance: s === "mutation" ? t = t + 1 | 0 : void 0,
1393
- ...l,
1394
- ...v,
1395
- requestPolicy: v.requestPolicy || l.requestPolicy,
1396
- suspense: v.suspense || v.suspense !== !1 && k.suspense
1397
- });
1398
- },
1399
- executeRequestOperation(s) {
1400
- return s.kind === "mutation" ? Ce(m(s)) : Ce(ar(() => {
1401
- var y = i.get(s.key);
1402
- y || i.set(s.key, y = m(s)), y = be(() => {
1403
- c(s);
1404
- })(y);
1405
- var v = n.get(s.key);
1406
- return s.kind === "query" && v && (v.stale || v.hasNext) ? we(G)(J([y, A((V) => V === n.get(s.key))(G(v))])) : y;
1407
- }));
1408
- },
1409
- executeQuery(s, y) {
1410
- var v = k.createRequestOperation("query", s, y);
1411
- return k.executeRequestOperation(v);
1412
- },
1413
- executeSubscription(s, y) {
1414
- var v = k.createRequestOperation("subscription", s, y);
1415
- return k.executeRequestOperation(v);
1416
- },
1417
- executeMutation(s, y) {
1418
- var v = k.createRequestOperation("mutation", s, y);
1419
- return k.executeRequestOperation(v);
1420
- },
1421
- readQuery(s, y, v) {
1422
- var V = null;
1423
- return re((oe) => {
1424
- V = oe;
1425
- })(k.query(s, y, v)).unsubscribe(), V;
1426
- },
1427
- query: (s, y, v) => k.executeQuery(ue(s, y), v),
1428
- subscription: (s, y, v) => k.executeSubscription(ue(s, y), v),
1429
- mutation: (s, y, v) => k.executeMutation(ue(s, y), v)
1430
- }), w = Ar;
1431
- if (process.env.NODE_ENV !== "production") {
1432
- var { next: E, source: D } = Ee();
1433
- k.subscribeToDebugTarget = (s) => re(s)(D), w = E;
1434
- }
1435
- var q = Ir(r.exchanges), I = Q(q({
1436
- client: k,
1437
- dispatchDebug: w,
1438
- forward: Vr({
1439
- dispatchDebug: w
1440
- })
1441
- })(f.source));
1442
- return sr(I), k;
1443
- };
1444
- export {
1445
- Cr as C,
1446
- je as a,
1447
- _r as b,
1448
- ue as c,
1449
- Tr as f,
1450
- qr as m,
1451
- ie as o,
1452
- re as s,
1453
- nr as t
1454
- };
1455
- //# sourceMappingURL=urql-core-KJnLL26g.js.map