@kelet-ai/feedback-ui 0.7.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/feedback-ui.es.js +37 -19
- package/dist/feedback-ui.es.js.map +1 -1
- package/dist/feedback-ui.es.min.js +557 -552
- package/dist/feedback-ui.es.min.js.map +1 -1
- package/dist/feedback-ui.umd.js +37 -19
- package/dist/feedback-ui.umd.js.map +1 -1
- package/dist/feedback-ui.umd.min.js +9 -9
- package/dist/feedback-ui.umd.min.js.map +1 -1
- package/dist/hooks/feedback-state/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Ae, { createContext as ke, useContext as ae, useCallback as
|
|
1
|
+
import Ae, { createContext as ke, useContext as ae, useCallback as q, isValidElement as Z, cloneElement as Q, useState as X, useRef as z, useId as fe, useEffect as Ee } from "react";
|
|
2
2
|
function _e(t) {
|
|
3
3
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function Ne(t) {
|
|
6
6
|
if (Object.prototype.hasOwnProperty.call(t, "__esModule")) return t;
|
|
7
7
|
var e = t.default;
|
|
8
8
|
if (typeof e == "function") {
|
|
@@ -36,22 +36,22 @@ var re = { exports: {} }, V = {};
|
|
|
36
36
|
* This source code is licensed under the MIT license found in the
|
|
37
37
|
* LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/
|
|
39
|
-
var
|
|
40
|
-
function
|
|
41
|
-
if (
|
|
42
|
-
|
|
39
|
+
var ce;
|
|
40
|
+
function je() {
|
|
41
|
+
if (ce) return V;
|
|
42
|
+
ce = 1;
|
|
43
43
|
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
44
44
|
function n(r, o, u) {
|
|
45
|
-
var
|
|
46
|
-
if (u !== void 0 && (
|
|
45
|
+
var p = null;
|
|
46
|
+
if (u !== void 0 && (p = "" + u), o.key !== void 0 && (p = "" + o.key), "key" in o) {
|
|
47
47
|
u = {};
|
|
48
|
-
for (var
|
|
49
|
-
|
|
48
|
+
for (var f in o)
|
|
49
|
+
f !== "key" && (u[f] = o[f]);
|
|
50
50
|
} else u = o;
|
|
51
51
|
return o = u.ref, {
|
|
52
52
|
$$typeof: t,
|
|
53
53
|
type: r,
|
|
54
|
-
key:
|
|
54
|
+
key: p,
|
|
55
55
|
ref: o !== void 0 ? o : null,
|
|
56
56
|
props: u
|
|
57
57
|
};
|
|
@@ -79,13 +79,13 @@ function Se() {
|
|
|
79
79
|
switch (a) {
|
|
80
80
|
case w:
|
|
81
81
|
return "Fragment";
|
|
82
|
-
case R:
|
|
83
|
-
return "Profiler";
|
|
84
82
|
case D:
|
|
83
|
+
return "Profiler";
|
|
84
|
+
case C:
|
|
85
85
|
return "StrictMode";
|
|
86
|
-
case
|
|
86
|
+
case P:
|
|
87
87
|
return "Suspense";
|
|
88
|
-
case
|
|
88
|
+
case j:
|
|
89
89
|
return "SuspenseList";
|
|
90
90
|
case l:
|
|
91
91
|
return "Activity";
|
|
@@ -96,19 +96,19 @@ function Se() {
|
|
|
96
96
|
), a.$$typeof) {
|
|
97
97
|
case h:
|
|
98
98
|
return "Portal";
|
|
99
|
-
case
|
|
99
|
+
case O:
|
|
100
100
|
return (a.displayName || "Context") + ".Provider";
|
|
101
|
-
case
|
|
101
|
+
case v:
|
|
102
102
|
return (a._context.displayName || "Context") + ".Consumer";
|
|
103
103
|
case k:
|
|
104
|
-
var
|
|
105
|
-
return a = a.displayName, a || (a =
|
|
106
|
-
case
|
|
107
|
-
return
|
|
104
|
+
var T = a.render;
|
|
105
|
+
return a = a.displayName, a || (a = T.displayName || T.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
106
|
+
case S:
|
|
107
|
+
return T = a.displayName || null, T !== null ? T : t(a.type) || "Memo";
|
|
108
108
|
case i:
|
|
109
|
-
|
|
109
|
+
T = a._payload, a = a._init;
|
|
110
110
|
try {
|
|
111
|
-
return t(a(
|
|
111
|
+
return t(a(T));
|
|
112
112
|
} catch {
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -120,17 +120,17 @@ function Se() {
|
|
|
120
120
|
function n(a) {
|
|
121
121
|
try {
|
|
122
122
|
e(a);
|
|
123
|
-
var
|
|
123
|
+
var T = !1;
|
|
124
124
|
} catch {
|
|
125
|
-
|
|
125
|
+
T = !0;
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
var _ =
|
|
127
|
+
if (T) {
|
|
128
|
+
T = console;
|
|
129
|
+
var _ = T.error, N = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
130
130
|
return _.call(
|
|
131
|
-
|
|
131
|
+
T,
|
|
132
132
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
133
|
-
|
|
133
|
+
N
|
|
134
134
|
), e(a);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -139,31 +139,31 @@ function Se() {
|
|
|
139
139
|
if (typeof a == "object" && a !== null && a.$$typeof === i)
|
|
140
140
|
return "<...>";
|
|
141
141
|
try {
|
|
142
|
-
var
|
|
143
|
-
return
|
|
142
|
+
var T = t(a);
|
|
143
|
+
return T ? "<" + T + ">" : "<...>";
|
|
144
144
|
} catch {
|
|
145
145
|
return "<...>";
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
function o() {
|
|
149
|
-
var a =
|
|
149
|
+
var a = d.A;
|
|
150
150
|
return a === null ? null : a.getOwner();
|
|
151
151
|
}
|
|
152
152
|
function u() {
|
|
153
153
|
return Error("react-stack-top-frame");
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
155
|
+
function p(a) {
|
|
156
|
+
if (b.call(a, "key")) {
|
|
157
|
+
var T = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
158
|
+
if (T && T.isReactWarning) return !1;
|
|
159
159
|
}
|
|
160
160
|
return a.key !== void 0;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function f(a, T) {
|
|
163
163
|
function _() {
|
|
164
164
|
M || (M = !0, console.error(
|
|
165
165
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
166
|
-
|
|
166
|
+
T
|
|
167
167
|
));
|
|
168
168
|
}
|
|
169
169
|
_.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
@@ -171,22 +171,22 @@ function Se() {
|
|
|
171
171
|
configurable: !0
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function c() {
|
|
175
175
|
var a = t(this.type);
|
|
176
|
-
return
|
|
176
|
+
return F[a] || (F[a] = !0, console.error(
|
|
177
177
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
178
178
|
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
179
179
|
}
|
|
180
|
-
function y(a,
|
|
180
|
+
function y(a, T, _, N, W, $, B, U) {
|
|
181
181
|
return _ = $.ref, a = {
|
|
182
|
-
$$typeof:
|
|
182
|
+
$$typeof: E,
|
|
183
183
|
type: a,
|
|
184
|
-
key:
|
|
184
|
+
key: T,
|
|
185
185
|
props: $,
|
|
186
|
-
_owner:
|
|
186
|
+
_owner: W
|
|
187
187
|
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(a, "ref", {
|
|
188
188
|
enumerable: !1,
|
|
189
|
-
get:
|
|
189
|
+
get: c
|
|
190
190
|
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
191
191
|
configurable: !1,
|
|
192
192
|
enumerable: !1,
|
|
@@ -209,101 +209,101 @@ function Se() {
|
|
|
209
209
|
value: U
|
|
210
210
|
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
211
211
|
}
|
|
212
|
-
function m(a,
|
|
213
|
-
var
|
|
214
|
-
if (
|
|
215
|
-
if (
|
|
216
|
-
if (A(
|
|
217
|
-
for (
|
|
218
|
-
|
|
219
|
-
Object.freeze && Object.freeze(
|
|
212
|
+
function m(a, T, _, N, W, $, B, U) {
|
|
213
|
+
var I = T.children;
|
|
214
|
+
if (I !== void 0)
|
|
215
|
+
if (N)
|
|
216
|
+
if (A(I)) {
|
|
217
|
+
for (N = 0; N < I.length; N++)
|
|
218
|
+
R(I[N]);
|
|
219
|
+
Object.freeze && Object.freeze(I);
|
|
220
220
|
} else
|
|
221
221
|
console.error(
|
|
222
222
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
223
223
|
);
|
|
224
|
-
else
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
var Y = Object.keys(
|
|
224
|
+
else R(I);
|
|
225
|
+
if (b.call(T, "key")) {
|
|
226
|
+
I = t(a);
|
|
227
|
+
var Y = Object.keys(T).filter(function(De) {
|
|
228
228
|
return De !== "key";
|
|
229
229
|
});
|
|
230
|
-
|
|
230
|
+
N = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", ne[I + N] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
231
231
|
`A props object containing a "key" prop is being spread into JSX:
|
|
232
232
|
let props = %s;
|
|
233
233
|
<%s {...props} />
|
|
234
234
|
React keys must be passed directly to JSX without using spread:
|
|
235
235
|
let props = %s;
|
|
236
236
|
<%s key={someKey} {...props} />`,
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
N,
|
|
238
|
+
I,
|
|
239
239
|
Y,
|
|
240
|
-
|
|
241
|
-
), ne[
|
|
240
|
+
I
|
|
241
|
+
), ne[I + N] = !0);
|
|
242
242
|
}
|
|
243
|
-
if (
|
|
243
|
+
if (I = null, _ !== void 0 && (n(_), I = "" + _), p(T) && (n(T.key), I = "" + T.key), "key" in T) {
|
|
244
244
|
_ = {};
|
|
245
|
-
for (var le in
|
|
246
|
-
le !== "key" && (_[le] =
|
|
247
|
-
} else _ =
|
|
248
|
-
return
|
|
245
|
+
for (var le in T)
|
|
246
|
+
le !== "key" && (_[le] = T[le]);
|
|
247
|
+
} else _ = T;
|
|
248
|
+
return I && f(
|
|
249
249
|
_,
|
|
250
250
|
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
251
251
|
), y(
|
|
252
252
|
a,
|
|
253
|
-
|
|
253
|
+
I,
|
|
254
254
|
$,
|
|
255
|
-
|
|
255
|
+
W,
|
|
256
256
|
o(),
|
|
257
257
|
_,
|
|
258
258
|
B,
|
|
259
259
|
U
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
typeof a == "object" && a !== null && a.$$typeof ===
|
|
262
|
+
function R(a) {
|
|
263
|
+
typeof a == "object" && a !== null && a.$$typeof === E && a._store && (a._store.validated = 1);
|
|
264
264
|
}
|
|
265
|
-
var
|
|
265
|
+
var g = Ae, E = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), O = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), l = Symbol.for("react.activity"), s = Symbol.for("react.client.reference"), d = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, b = Object.prototype.hasOwnProperty, A = Array.isArray, x = console.createTask ? console.createTask : function() {
|
|
266
266
|
return null;
|
|
267
267
|
};
|
|
268
|
-
|
|
268
|
+
g = {
|
|
269
269
|
react_stack_bottom_frame: function(a) {
|
|
270
270
|
return a();
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
-
var M,
|
|
274
|
-
|
|
273
|
+
var M, F = {}, K = g.react_stack_bottom_frame.bind(
|
|
274
|
+
g,
|
|
275
275
|
u
|
|
276
|
-
)(), J =
|
|
277
|
-
G.Fragment = w, G.jsx = function(a,
|
|
278
|
-
var $ = 1e4 >
|
|
276
|
+
)(), J = x(r(u)), ne = {};
|
|
277
|
+
G.Fragment = w, G.jsx = function(a, T, _, N, W) {
|
|
278
|
+
var $ = 1e4 > d.recentlyCreatedOwnerStacks++;
|
|
279
279
|
return m(
|
|
280
280
|
a,
|
|
281
|
-
|
|
281
|
+
T,
|
|
282
282
|
_,
|
|
283
283
|
!1,
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
N,
|
|
285
|
+
W,
|
|
286
286
|
$ ? Error("react-stack-top-frame") : K,
|
|
287
|
-
$ ?
|
|
287
|
+
$ ? x(r(a)) : J
|
|
288
288
|
);
|
|
289
|
-
}, G.jsxs = function(a,
|
|
290
|
-
var $ = 1e4 >
|
|
289
|
+
}, G.jsxs = function(a, T, _, N, W) {
|
|
290
|
+
var $ = 1e4 > d.recentlyCreatedOwnerStacks++;
|
|
291
291
|
return m(
|
|
292
292
|
a,
|
|
293
|
-
|
|
293
|
+
T,
|
|
294
294
|
_,
|
|
295
295
|
!0,
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
N,
|
|
297
|
+
W,
|
|
298
298
|
$ ? Error("react-stack-top-frame") : K,
|
|
299
|
-
$ ?
|
|
299
|
+
$ ? x(r(a)) : J
|
|
300
300
|
);
|
|
301
301
|
};
|
|
302
302
|
}()), G;
|
|
303
303
|
}
|
|
304
304
|
var pe;
|
|
305
305
|
function Ie() {
|
|
306
|
-
return pe || (pe = 1, process.env.NODE_ENV === "production" ? re.exports =
|
|
306
|
+
return pe || (pe = 1, process.env.NODE_ENV === "production" ? re.exports = je() : re.exports = Se()), re.exports;
|
|
307
307
|
}
|
|
308
308
|
var L = Ie();
|
|
309
309
|
const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
@@ -323,37 +323,37 @@ const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
|
323
323
|
throw new Error(
|
|
324
324
|
"apiKey is required either directly or from a parent KeletProvider"
|
|
325
325
|
);
|
|
326
|
-
const
|
|
326
|
+
const f = {
|
|
327
327
|
api_key: u,
|
|
328
328
|
project: e,
|
|
329
|
-
feedback: async (
|
|
330
|
-
const m = `${n || Fe}/projects/${e}/feedback`,
|
|
331
|
-
tx_id:
|
|
332
|
-
source:
|
|
333
|
-
vote:
|
|
334
|
-
explanation:
|
|
335
|
-
correction:
|
|
336
|
-
selection:
|
|
329
|
+
feedback: async (c) => {
|
|
330
|
+
const m = `${n || Fe}/projects/${e}/feedback`, R = {
|
|
331
|
+
tx_id: c.tx_id,
|
|
332
|
+
source: c.source || "EXPLICIT",
|
|
333
|
+
vote: c.vote,
|
|
334
|
+
explanation: c.explanation,
|
|
335
|
+
correction: c.correction,
|
|
336
|
+
selection: c.selection
|
|
337
337
|
// Include trigger_name if needed in the future
|
|
338
|
-
},
|
|
338
|
+
}, g = await fetch(m, {
|
|
339
339
|
method: "POST",
|
|
340
340
|
headers: {
|
|
341
341
|
"Content-Type": "application/json",
|
|
342
342
|
Authorization: `Bearer ${u}`
|
|
343
343
|
},
|
|
344
|
-
body: JSON.stringify(
|
|
344
|
+
body: JSON.stringify(R)
|
|
345
345
|
});
|
|
346
|
-
if (!
|
|
347
|
-
throw new Error(`Failed to submit feedback: ${
|
|
346
|
+
if (!g.ok)
|
|
347
|
+
throw new Error(`Failed to submit feedback: ${g.statusText}`);
|
|
348
348
|
}
|
|
349
349
|
};
|
|
350
|
-
return /* @__PURE__ */ L.jsx(se.Provider, { value:
|
|
350
|
+
return /* @__PURE__ */ L.jsx(se.Provider, { value: f, children: r });
|
|
351
351
|
}, ee = (t, e) => {
|
|
352
352
|
const n = { ...e };
|
|
353
353
|
for (const r in e) {
|
|
354
354
|
const o = t[r], u = e[r];
|
|
355
|
-
/^on[A-Z]/.test(r) ? o && u ? n[r] = (...
|
|
356
|
-
u(...
|
|
355
|
+
/^on[A-Z]/.test(r) ? o && u ? n[r] = (...f) => {
|
|
356
|
+
u(...f), o(...f);
|
|
357
357
|
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...u } : r === "className" ? n[r] = [o, u].filter(Boolean).join(" ") : n[r] = u !== void 0 ? u : o;
|
|
358
358
|
}
|
|
359
359
|
return { ...t, ...n };
|
|
@@ -374,104 +374,104 @@ const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
|
374
374
|
extra_metadata: o,
|
|
375
375
|
trigger_name: u
|
|
376
376
|
}) => {
|
|
377
|
-
const
|
|
377
|
+
const p = typeof r == "function" ? r() : r, [f, c] = X(!1), [y, m] = X(n), [R, g] = X(!1), [E, h] = X(null), w = z(null), C = z(null), D = fe(), v = fe(), O = Pe(), k = e || O;
|
|
378
378
|
Ee(() => {
|
|
379
|
-
|
|
380
|
-
}, [
|
|
381
|
-
const
|
|
379
|
+
c(!1), m(n), g(!1), h(null), setTimeout(() => C.current?.focus(), 0);
|
|
380
|
+
}, [p, n]);
|
|
381
|
+
const P = q(async () => {
|
|
382
382
|
h("upvote");
|
|
383
|
-
const
|
|
384
|
-
tx_id:
|
|
383
|
+
const d = {
|
|
384
|
+
tx_id: p,
|
|
385
385
|
vote: "upvote",
|
|
386
386
|
...o && { extra_metadata: o },
|
|
387
387
|
...u && { trigger_name: u }
|
|
388
388
|
};
|
|
389
389
|
try {
|
|
390
|
-
|
|
390
|
+
g(!0), await k(d);
|
|
391
391
|
} finally {
|
|
392
|
-
|
|
392
|
+
g(!1);
|
|
393
393
|
}
|
|
394
|
-
}, [k,
|
|
394
|
+
}, [k, p, o, u]), j = q(async () => {
|
|
395
395
|
if (h("downvote"), k) {
|
|
396
|
-
const
|
|
397
|
-
tx_id:
|
|
396
|
+
const d = {
|
|
397
|
+
tx_id: p,
|
|
398
398
|
vote: "downvote",
|
|
399
399
|
...o && { extra_metadata: o },
|
|
400
400
|
...u && { trigger_name: u }
|
|
401
401
|
};
|
|
402
402
|
try {
|
|
403
|
-
|
|
403
|
+
g(!0), await k(d);
|
|
404
404
|
} finally {
|
|
405
|
-
|
|
405
|
+
g(!1);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
|
|
408
|
+
c(!0), setTimeout(() => {
|
|
409
409
|
w.current?.focus();
|
|
410
|
-
const
|
|
411
|
-
|
|
410
|
+
const d = document.createElement("div");
|
|
411
|
+
d.setAttribute("aria-live", "polite"), d.setAttribute("aria-atomic", "true"), d.className = "sr-only", d.textContent = "Feedback dialog opened. You can provide additional details about your downvote.", document.body.appendChild(d), setTimeout(() => document.body.removeChild(d), 1e3);
|
|
412
412
|
}, 0);
|
|
413
|
-
}, [k,
|
|
414
|
-
(
|
|
415
|
-
m(
|
|
413
|
+
}, [k, p, o, u]), S = q(
|
|
414
|
+
(d) => {
|
|
415
|
+
m(d.target.value);
|
|
416
416
|
},
|
|
417
417
|
[]
|
|
418
|
-
), i =
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
const
|
|
422
|
-
tx_id:
|
|
418
|
+
), i = q(async () => {
|
|
419
|
+
const d = y.trim().length > 0;
|
|
420
|
+
if (d) {
|
|
421
|
+
const b = {
|
|
422
|
+
tx_id: p,
|
|
423
423
|
vote: "downvote",
|
|
424
424
|
explanation: y,
|
|
425
425
|
...o && { extra_metadata: o },
|
|
426
426
|
...u && { trigger_name: u }
|
|
427
427
|
};
|
|
428
428
|
try {
|
|
429
|
-
|
|
429
|
+
g(!0), await k(b);
|
|
430
430
|
} finally {
|
|
431
|
-
|
|
431
|
+
g(!1);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
if (
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
if (c(!1), m(n), C.current?.focus(), d) {
|
|
435
|
+
const b = document.createElement("div");
|
|
436
|
+
b.setAttribute("aria-live", "polite"), b.className = "sr-only", b.textContent = "Feedback submitted successfully.", document.body.appendChild(b), setTimeout(() => document.body.removeChild(b), 1e3);
|
|
437
437
|
}
|
|
438
|
-
}, [k, y, n,
|
|
439
|
-
(
|
|
440
|
-
if (
|
|
441
|
-
|
|
442
|
-
else if ((
|
|
443
|
-
|
|
438
|
+
}, [k, y, n, p, o, u]), l = q(
|
|
439
|
+
(d) => {
|
|
440
|
+
if (d.key === "Escape")
|
|
441
|
+
c(!1), m(n), C.current?.focus();
|
|
442
|
+
else if ((d.metaKey || d.ctrlKey) && d.key === "Enter")
|
|
443
|
+
d.preventDefault(), i().then((b) => {
|
|
444
444
|
});
|
|
445
|
-
else if (
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
const A =
|
|
445
|
+
else if (d.key === "Tab" && f) {
|
|
446
|
+
const b = document.getElementById(D);
|
|
447
|
+
if (b) {
|
|
448
|
+
const A = b.querySelectorAll(
|
|
449
449
|
'button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'
|
|
450
|
-
),
|
|
451
|
-
|
|
450
|
+
), x = A[0], M = A[A.length - 1];
|
|
451
|
+
d.shiftKey && document.activeElement === x ? (d.preventDefault(), M?.focus()) : !d.shiftKey && document.activeElement === M && (d.preventDefault(), x?.focus());
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
},
|
|
455
|
-
[i,
|
|
455
|
+
[i, f, D, n]
|
|
456
456
|
), s = {
|
|
457
457
|
onFeedback: k,
|
|
458
|
-
showPopover:
|
|
459
|
-
setShowPopover:
|
|
458
|
+
showPopover: f,
|
|
459
|
+
setShowPopover: c,
|
|
460
460
|
feedbackText: y,
|
|
461
461
|
setFeedbackText: m,
|
|
462
|
-
isSubmitting:
|
|
463
|
-
setIsSubmitting:
|
|
464
|
-
vote:
|
|
465
|
-
handleUpvote:
|
|
466
|
-
handleDownvote:
|
|
467
|
-
handleTextareaChange:
|
|
462
|
+
isSubmitting: R,
|
|
463
|
+
setIsSubmitting: g,
|
|
464
|
+
vote: E,
|
|
465
|
+
handleUpvote: P,
|
|
466
|
+
handleDownvote: j,
|
|
467
|
+
handleTextareaChange: S,
|
|
468
468
|
handleSubmit: i,
|
|
469
469
|
handleKeyDown: l,
|
|
470
470
|
textareaRef: w,
|
|
471
|
-
triggerRef:
|
|
472
|
-
popoverId:
|
|
473
|
-
triggerId:
|
|
474
|
-
tx_id:
|
|
471
|
+
triggerRef: C,
|
|
472
|
+
popoverId: D,
|
|
473
|
+
triggerId: v,
|
|
474
|
+
tx_id: p,
|
|
475
475
|
extra_metadata: o,
|
|
476
476
|
trigger_name: u
|
|
477
477
|
};
|
|
@@ -482,27 +482,27 @@ const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
|
482
482
|
onClick: n,
|
|
483
483
|
...r
|
|
484
484
|
}) => {
|
|
485
|
-
const { handleUpvote: o, isSubmitting: u, vote:
|
|
485
|
+
const { handleUpvote: o, isSubmitting: u, vote: p } = te(), f = q(
|
|
486
486
|
(m) => {
|
|
487
487
|
o(), n?.(m);
|
|
488
488
|
},
|
|
489
489
|
[o, n]
|
|
490
|
-
),
|
|
490
|
+
), c = {
|
|
491
491
|
...r,
|
|
492
|
-
onClick:
|
|
492
|
+
onClick: f,
|
|
493
493
|
disabled: u || r.disabled,
|
|
494
494
|
"aria-label": r["aria-label"] || "Upvote feedback",
|
|
495
495
|
type: "button"
|
|
496
|
-
}, y =
|
|
496
|
+
}, y = p === "upvote";
|
|
497
497
|
if (t) {
|
|
498
498
|
const m = typeof e == "function" ? e({ isSelected: y }) : e;
|
|
499
499
|
if (Z(m))
|
|
500
500
|
return Q(
|
|
501
501
|
m,
|
|
502
|
-
ee(
|
|
502
|
+
ee(c, m.props)
|
|
503
503
|
);
|
|
504
504
|
}
|
|
505
|
-
return /* @__PURE__ */ L.jsx("button", { ...
|
|
505
|
+
return /* @__PURE__ */ L.jsx("button", { ...c, children: typeof e == "function" ? e({ isSelected: y }) : e });
|
|
506
506
|
}, $e = ({
|
|
507
507
|
asChild: t,
|
|
508
508
|
children: e,
|
|
@@ -512,43 +512,43 @@ const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
|
512
512
|
const {
|
|
513
513
|
handleDownvote: o,
|
|
514
514
|
showPopover: u,
|
|
515
|
-
isSubmitting:
|
|
516
|
-
popoverId:
|
|
517
|
-
triggerId:
|
|
515
|
+
isSubmitting: p,
|
|
516
|
+
popoverId: f,
|
|
517
|
+
triggerId: c,
|
|
518
518
|
triggerRef: y,
|
|
519
519
|
vote: m
|
|
520
|
-
} = te(),
|
|
520
|
+
} = te(), R = q(
|
|
521
521
|
(h) => {
|
|
522
522
|
o(), n?.(h);
|
|
523
523
|
},
|
|
524
524
|
[o, n]
|
|
525
|
-
),
|
|
525
|
+
), g = {
|
|
526
526
|
...r,
|
|
527
527
|
ref: y,
|
|
528
|
-
onClick:
|
|
529
|
-
disabled:
|
|
528
|
+
onClick: R,
|
|
529
|
+
disabled: p || r.disabled,
|
|
530
530
|
"aria-label": r["aria-label"] || "Downvote feedback",
|
|
531
531
|
"aria-expanded": u,
|
|
532
|
-
"aria-controls":
|
|
533
|
-
id:
|
|
532
|
+
"aria-controls": f,
|
|
533
|
+
id: c,
|
|
534
534
|
type: "button"
|
|
535
|
-
},
|
|
535
|
+
}, E = m === "downvote";
|
|
536
536
|
if (t) {
|
|
537
|
-
const h = typeof e == "function" ? e({ isSelected:
|
|
537
|
+
const h = typeof e == "function" ? e({ isSelected: E }) : e;
|
|
538
538
|
if (Z(h))
|
|
539
|
-
return Q(h, ee(
|
|
539
|
+
return Q(h, ee(g, h.props));
|
|
540
540
|
if (h)
|
|
541
541
|
return h;
|
|
542
542
|
}
|
|
543
|
-
return /* @__PURE__ */ L.jsx("button", { ...
|
|
544
|
-
},
|
|
545
|
-
const { showPopover: r, handleKeyDown: o, popoverId: u, triggerId:
|
|
543
|
+
return /* @__PURE__ */ L.jsx("button", { ...g, children: typeof e == "function" ? e({ isSelected: E }) : e });
|
|
544
|
+
}, We = ({ asChild: t, children: e, ...n }) => {
|
|
545
|
+
const { showPopover: r, handleKeyDown: o, popoverId: u, triggerId: p } = te();
|
|
546
546
|
if (!r)
|
|
547
547
|
return null;
|
|
548
|
-
const
|
|
548
|
+
const f = {
|
|
549
549
|
...n,
|
|
550
550
|
role: "dialog",
|
|
551
|
-
"aria-labelledby":
|
|
551
|
+
"aria-labelledby": p,
|
|
552
552
|
"aria-modal": !0,
|
|
553
553
|
"aria-describedby": `${u}-description`,
|
|
554
554
|
id: u,
|
|
@@ -558,29 +558,29 @@ const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
|
558
558
|
return t && Z(e) ? /* @__PURE__ */ L.jsxs(L.Fragment, { children: [
|
|
559
559
|
Q(
|
|
560
560
|
e,
|
|
561
|
-
ee(
|
|
561
|
+
ee(f, e.props)
|
|
562
562
|
),
|
|
563
563
|
/* @__PURE__ */ L.jsx("div", { id: `${u}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" })
|
|
564
|
-
] }) : /* @__PURE__ */ L.jsxs("div", { ...
|
|
564
|
+
] }) : /* @__PURE__ */ L.jsxs("div", { ...f, children: [
|
|
565
565
|
/* @__PURE__ */ L.jsx("div", { id: `${u}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" }),
|
|
566
566
|
e
|
|
567
567
|
] });
|
|
568
|
-
},
|
|
568
|
+
}, qe = ({ asChild: t, value: e, onChange: n, ...r }) => {
|
|
569
569
|
const {
|
|
570
570
|
feedbackText: o,
|
|
571
571
|
handleTextareaChange: u,
|
|
572
|
-
textareaRef:
|
|
573
|
-
handleKeyDown:
|
|
574
|
-
popoverId:
|
|
572
|
+
textareaRef: p,
|
|
573
|
+
handleKeyDown: f,
|
|
574
|
+
popoverId: c
|
|
575
575
|
} = te(), y = {
|
|
576
576
|
...r,
|
|
577
|
-
ref:
|
|
577
|
+
ref: p,
|
|
578
578
|
value: e !== void 0 ? e : o,
|
|
579
579
|
onChange: n || u,
|
|
580
|
-
onKeyDown:
|
|
580
|
+
onKeyDown: f,
|
|
581
581
|
placeholder: r.placeholder || "What did we miss?",
|
|
582
582
|
"aria-label": r["aria-label"] || "Additional feedback",
|
|
583
|
-
"aria-describedby": `${
|
|
583
|
+
"aria-describedby": `${c}-help`,
|
|
584
584
|
rows: r.rows || 3
|
|
585
585
|
};
|
|
586
586
|
return t && Z(r.children) ? Q(
|
|
@@ -593,35 +593,35 @@ const se = ke(null), Fe = "https://api.kelet.ai/api", pt = () => {
|
|
|
593
593
|
onClick: n,
|
|
594
594
|
...r
|
|
595
595
|
}) => {
|
|
596
|
-
const { handleSubmit: o, isSubmitting: u, feedbackText:
|
|
597
|
-
(
|
|
598
|
-
o(), n?.(
|
|
596
|
+
const { handleSubmit: o, isSubmitting: u, feedbackText: p } = te(), f = q(
|
|
597
|
+
(R) => {
|
|
598
|
+
o(), n?.(R);
|
|
599
599
|
},
|
|
600
600
|
[o, n]
|
|
601
|
-
),
|
|
601
|
+
), c = p.trim().length > 0, y = c ? "Submit feedback" : "Close without feedback", m = {
|
|
602
602
|
...r,
|
|
603
|
-
onClick:
|
|
603
|
+
onClick: f,
|
|
604
604
|
disabled: u || r.disabled,
|
|
605
605
|
type: "button",
|
|
606
606
|
"aria-label": r["aria-label"] || y,
|
|
607
|
-
"aria-describedby":
|
|
607
|
+
"aria-describedby": c ? void 0 : "submit-help"
|
|
608
608
|
};
|
|
609
609
|
return t && Z(e) ? /* @__PURE__ */ L.jsxs(L.Fragment, { children: [
|
|
610
610
|
Q(
|
|
611
611
|
e,
|
|
612
612
|
ee(m, e.props)
|
|
613
613
|
),
|
|
614
|
-
!
|
|
614
|
+
!c && /* @__PURE__ */ L.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
615
615
|
] }) : /* @__PURE__ */ L.jsxs("button", { ...m, children: [
|
|
616
616
|
e,
|
|
617
|
-
!
|
|
617
|
+
!c && /* @__PURE__ */ L.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
618
618
|
] });
|
|
619
619
|
}, mt = {
|
|
620
620
|
Root: Le,
|
|
621
621
|
UpvoteButton: Me,
|
|
622
622
|
DownvoteButton: $e,
|
|
623
|
-
Popover:
|
|
624
|
-
Textarea:
|
|
623
|
+
Popover: We,
|
|
624
|
+
Textarea: qe,
|
|
625
625
|
SubmitButton: Ye
|
|
626
626
|
};
|
|
627
627
|
var ie = { exports: {} }, ze = ie.exports, he;
|
|
@@ -651,8 +651,8 @@ function He() {
|
|
|
651
651
|
enumerable: !0
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
|
|
654
|
+
function p(i, l, s) {
|
|
655
|
+
p.super_.call(this, "E", i), Object.defineProperty(this, "lhs", {
|
|
656
656
|
value: l,
|
|
657
657
|
enumerable: !0
|
|
658
658
|
}), Object.defineProperty(this, "rhs", {
|
|
@@ -660,21 +660,21 @@ function He() {
|
|
|
660
660
|
enumerable: !0
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
|
-
o(
|
|
664
|
-
function
|
|
665
|
-
|
|
663
|
+
o(p, u);
|
|
664
|
+
function f(i, l) {
|
|
665
|
+
f.super_.call(this, "N", i), Object.defineProperty(this, "rhs", {
|
|
666
666
|
value: l,
|
|
667
667
|
enumerable: !0
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
|
-
o(
|
|
671
|
-
function
|
|
672
|
-
|
|
670
|
+
o(f, u);
|
|
671
|
+
function c(i, l) {
|
|
672
|
+
c.super_.call(this, "D", i), Object.defineProperty(this, "lhs", {
|
|
673
673
|
value: l,
|
|
674
674
|
enumerable: !0
|
|
675
675
|
});
|
|
676
676
|
}
|
|
677
|
-
o(
|
|
677
|
+
o(c, u);
|
|
678
678
|
function y(i, l, s) {
|
|
679
679
|
y.super_.call(this, "A", i), Object.defineProperty(this, "index", {
|
|
680
680
|
value: l,
|
|
@@ -686,145 +686,145 @@ function He() {
|
|
|
686
686
|
}
|
|
687
687
|
o(y, u);
|
|
688
688
|
function m(i, l, s) {
|
|
689
|
-
var
|
|
690
|
-
return i.length = l < 0 ? i.length + l : l, i.push.apply(i,
|
|
689
|
+
var d = i.slice(l + 1 || i.length);
|
|
690
|
+
return i.length = l < 0 ? i.length + l : l, i.push.apply(i, d), i;
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function R(i) {
|
|
693
693
|
var l = typeof i;
|
|
694
694
|
return l !== "object" ? l : i === Math ? "math" : i === null ? "null" : Array.isArray(i) ? "array" : Object.prototype.toString.call(i) === "[object Date]" ? "date" : typeof i.toString == "function" && /^\/.*\//.test(i.toString()) ? "regexp" : "object";
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function g(i) {
|
|
697
697
|
var l = 0;
|
|
698
698
|
if (i.length === 0)
|
|
699
699
|
return l;
|
|
700
700
|
for (var s = 0; s < i.length; s++) {
|
|
701
|
-
var
|
|
702
|
-
l = (l << 5) - l +
|
|
701
|
+
var d = i.charCodeAt(s);
|
|
702
|
+
l = (l << 5) - l + d, l = l & l;
|
|
703
703
|
}
|
|
704
704
|
return l;
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
var l = 0, s =
|
|
706
|
+
function E(i) {
|
|
707
|
+
var l = 0, s = R(i);
|
|
708
708
|
if (s === "array") {
|
|
709
709
|
i.forEach(function(M) {
|
|
710
|
-
l +=
|
|
710
|
+
l += E(M);
|
|
711
711
|
});
|
|
712
|
-
var
|
|
713
|
-
return l +
|
|
712
|
+
var d = "[type: array, hash: " + l + "]";
|
|
713
|
+
return l + g(d);
|
|
714
714
|
}
|
|
715
715
|
if (s === "object") {
|
|
716
|
-
for (var
|
|
717
|
-
if (i.hasOwnProperty(
|
|
718
|
-
var A = "[ type: object, key: " +
|
|
719
|
-
l +=
|
|
716
|
+
for (var b in i)
|
|
717
|
+
if (i.hasOwnProperty(b)) {
|
|
718
|
+
var A = "[ type: object, key: " + b + ", value hash: " + E(i[b]) + "]";
|
|
719
|
+
l += g(A);
|
|
720
720
|
}
|
|
721
721
|
return l;
|
|
722
722
|
}
|
|
723
|
-
var
|
|
724
|
-
return l +
|
|
723
|
+
var x = "[ type: " + s + " ; value: " + i + "]";
|
|
724
|
+
return l + g(x);
|
|
725
725
|
}
|
|
726
|
-
function h(i, l, s,
|
|
727
|
-
s = s || [],
|
|
728
|
-
var
|
|
726
|
+
function h(i, l, s, d, b, A, x, M) {
|
|
727
|
+
s = s || [], b = b || [], x = x || [];
|
|
728
|
+
var F = b.slice(0);
|
|
729
729
|
if (typeof A < "u" && A !== null) {
|
|
730
|
-
if (
|
|
731
|
-
if (typeof
|
|
730
|
+
if (d) {
|
|
731
|
+
if (typeof d == "function" && d(F, A))
|
|
732
732
|
return;
|
|
733
|
-
if (typeof
|
|
734
|
-
if (
|
|
733
|
+
if (typeof d == "object") {
|
|
734
|
+
if (d.prefilter && d.prefilter(F, A))
|
|
735
735
|
return;
|
|
736
|
-
if (
|
|
737
|
-
var K =
|
|
736
|
+
if (d.normalize) {
|
|
737
|
+
var K = d.normalize(F, A, i, l);
|
|
738
738
|
K && (i = K[0], l = K[1]);
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
|
-
|
|
742
|
+
F.push(A);
|
|
743
743
|
}
|
|
744
|
-
|
|
745
|
-
var J = typeof i, ne = typeof l, a,
|
|
746
|
-
if (!
|
|
747
|
-
s.push(new
|
|
748
|
-
else if (!$ &&
|
|
749
|
-
s.push(new
|
|
750
|
-
else if (
|
|
751
|
-
s.push(new
|
|
752
|
-
else if (
|
|
753
|
-
s.push(new
|
|
744
|
+
R(i) === "regexp" && R(l) === "regexp" && (i = i.toString(), l = l.toString());
|
|
745
|
+
var J = typeof i, ne = typeof l, a, T, _, N, W = J !== "undefined" || x && x.length > 0 && x[x.length - 1].lhs && Object.getOwnPropertyDescriptor(x[x.length - 1].lhs, A), $ = ne !== "undefined" || x && x.length > 0 && x[x.length - 1].rhs && Object.getOwnPropertyDescriptor(x[x.length - 1].rhs, A);
|
|
746
|
+
if (!W && $)
|
|
747
|
+
s.push(new f(F, l));
|
|
748
|
+
else if (!$ && W)
|
|
749
|
+
s.push(new c(F, i));
|
|
750
|
+
else if (R(i) !== R(l))
|
|
751
|
+
s.push(new p(F, i, l));
|
|
752
|
+
else if (R(i) === "date" && i - l !== 0)
|
|
753
|
+
s.push(new p(F, i, l));
|
|
754
754
|
else if (J === "object" && i !== null && l !== null) {
|
|
755
|
-
for (a =
|
|
756
|
-
if (
|
|
757
|
-
|
|
755
|
+
for (a = x.length - 1; a > -1; --a)
|
|
756
|
+
if (x[a].lhs === i) {
|
|
757
|
+
N = !0;
|
|
758
758
|
break;
|
|
759
759
|
}
|
|
760
|
-
if (
|
|
761
|
-
i !== l && s.push(new
|
|
760
|
+
if (N)
|
|
761
|
+
i !== l && s.push(new p(F, i, l));
|
|
762
762
|
else {
|
|
763
|
-
if (
|
|
764
|
-
for (M && (i.sort(function(
|
|
765
|
-
return
|
|
766
|
-
}), l.sort(function(
|
|
767
|
-
return
|
|
768
|
-
})), a = l.length - 1,
|
|
769
|
-
s.push(new y(
|
|
770
|
-
for (;
|
|
771
|
-
s.push(new y(
|
|
763
|
+
if (x.push({ lhs: i, rhs: l }), Array.isArray(i)) {
|
|
764
|
+
for (M && (i.sort(function(I, Y) {
|
|
765
|
+
return E(I) - E(Y);
|
|
766
|
+
}), l.sort(function(I, Y) {
|
|
767
|
+
return E(I) - E(Y);
|
|
768
|
+
})), a = l.length - 1, T = i.length - 1; a > T; )
|
|
769
|
+
s.push(new y(F, a, new f(void 0, l[a--])));
|
|
770
|
+
for (; T > a; )
|
|
771
|
+
s.push(new y(F, T, new c(void 0, i[T--])));
|
|
772
772
|
for (; a >= 0; --a)
|
|
773
|
-
h(i[a], l[a], s,
|
|
773
|
+
h(i[a], l[a], s, d, F, a, x, M);
|
|
774
774
|
} else {
|
|
775
775
|
var B = Object.keys(i), U = Object.keys(l);
|
|
776
776
|
for (a = 0; a < B.length; ++a)
|
|
777
|
-
_ = B[a],
|
|
777
|
+
_ = B[a], N = U.indexOf(_), N >= 0 ? (h(i[_], l[_], s, d, F, _, x, M), U[N] = null) : h(i[_], void 0, s, d, F, _, x, M);
|
|
778
778
|
for (a = 0; a < U.length; ++a)
|
|
779
|
-
_ = U[a], _ && h(void 0, l[_], s,
|
|
779
|
+
_ = U[a], _ && h(void 0, l[_], s, d, F, _, x, M);
|
|
780
780
|
}
|
|
781
|
-
|
|
781
|
+
x.length = x.length - 1;
|
|
782
782
|
}
|
|
783
|
-
} else i !== l && (J === "number" && isNaN(i) && isNaN(l) || s.push(new
|
|
783
|
+
} else i !== l && (J === "number" && isNaN(i) && isNaN(l) || s.push(new p(F, i, l)));
|
|
784
784
|
}
|
|
785
|
-
function w(i, l, s,
|
|
785
|
+
function w(i, l, s, d, b) {
|
|
786
786
|
var A = [];
|
|
787
|
-
if (h(i, l, A,
|
|
788
|
-
for (var
|
|
789
|
-
s(A[
|
|
787
|
+
if (h(i, l, A, d, null, null, null, b), s)
|
|
788
|
+
for (var x = 0; x < A.length; ++x)
|
|
789
|
+
s(A[x]);
|
|
790
790
|
return A;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
return h(i, l, s,
|
|
792
|
+
function C(i, l, s, d, b, A, x) {
|
|
793
|
+
return h(i, l, s, d, b, A, x, !0);
|
|
794
794
|
}
|
|
795
|
-
function
|
|
796
|
-
var
|
|
797
|
-
|
|
798
|
-
} : void 0, A = w(i, l,
|
|
799
|
-
return
|
|
795
|
+
function D(i, l, s, d) {
|
|
796
|
+
var b = d ? function(x) {
|
|
797
|
+
x && d.push(x);
|
|
798
|
+
} : void 0, A = w(i, l, b, s);
|
|
799
|
+
return d || (A.length ? A : void 0);
|
|
800
800
|
}
|
|
801
|
-
function
|
|
802
|
-
var
|
|
803
|
-
|
|
804
|
-
} : void 0, A = w(i, l,
|
|
805
|
-
return
|
|
801
|
+
function v(i, l, s, d) {
|
|
802
|
+
var b = d ? function(x) {
|
|
803
|
+
x && d.push(x);
|
|
804
|
+
} : void 0, A = w(i, l, b, s, !0);
|
|
805
|
+
return d || (A.length ? A : void 0);
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function O(i, l, s) {
|
|
808
808
|
if (s.path && s.path.length) {
|
|
809
|
-
var
|
|
810
|
-
for (
|
|
811
|
-
|
|
809
|
+
var d = i[l], b, A = s.path.length - 1;
|
|
810
|
+
for (b = 0; b < A; b++)
|
|
811
|
+
d = d[s.path[b]];
|
|
812
812
|
switch (s.kind) {
|
|
813
813
|
case "A":
|
|
814
|
-
|
|
814
|
+
O(d[s.path[b]], s.index, s.item);
|
|
815
815
|
break;
|
|
816
816
|
case "D":
|
|
817
|
-
delete
|
|
817
|
+
delete d[s.path[b]];
|
|
818
818
|
break;
|
|
819
819
|
case "E":
|
|
820
820
|
case "N":
|
|
821
|
-
|
|
821
|
+
d[s.path[b]] = s.rhs;
|
|
822
822
|
break;
|
|
823
823
|
}
|
|
824
824
|
} else
|
|
825
825
|
switch (s.kind) {
|
|
826
826
|
case "A":
|
|
827
|
-
|
|
827
|
+
O(i[l], s.index, s.item);
|
|
828
828
|
break;
|
|
829
829
|
case "D":
|
|
830
830
|
i = m(i, l);
|
|
@@ -838,45 +838,45 @@ function He() {
|
|
|
838
838
|
}
|
|
839
839
|
function k(i, l, s) {
|
|
840
840
|
if (typeof s > "u" && l && ~r.indexOf(l.kind) && (s = l), i && s && s.kind) {
|
|
841
|
-
for (var
|
|
842
|
-
typeof
|
|
841
|
+
for (var d = i, b = -1, A = s.path ? s.path.length - 1 : 0; ++b < A; )
|
|
842
|
+
typeof d[s.path[b]] > "u" && (d[s.path[b]] = typeof s.path[b + 1] < "u" && typeof s.path[b + 1] == "number" ? [] : {}), d = d[s.path[b]];
|
|
843
843
|
switch (s.kind) {
|
|
844
844
|
case "A":
|
|
845
|
-
s.path && typeof
|
|
845
|
+
s.path && typeof d[s.path[b]] > "u" && (d[s.path[b]] = []), O(s.path ? d[s.path[b]] : d, s.index, s.item);
|
|
846
846
|
break;
|
|
847
847
|
case "D":
|
|
848
|
-
delete
|
|
848
|
+
delete d[s.path[b]];
|
|
849
849
|
break;
|
|
850
850
|
case "E":
|
|
851
851
|
case "N":
|
|
852
|
-
|
|
852
|
+
d[s.path[b]] = s.rhs;
|
|
853
853
|
break;
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function P(i, l, s) {
|
|
858
858
|
if (s.path && s.path.length) {
|
|
859
|
-
var
|
|
860
|
-
for (
|
|
861
|
-
|
|
859
|
+
var d = i[l], b, A = s.path.length - 1;
|
|
860
|
+
for (b = 0; b < A; b++)
|
|
861
|
+
d = d[s.path[b]];
|
|
862
862
|
switch (s.kind) {
|
|
863
863
|
case "A":
|
|
864
|
-
|
|
864
|
+
P(d[s.path[b]], s.index, s.item);
|
|
865
865
|
break;
|
|
866
866
|
case "D":
|
|
867
|
-
|
|
867
|
+
d[s.path[b]] = s.lhs;
|
|
868
868
|
break;
|
|
869
869
|
case "E":
|
|
870
|
-
|
|
870
|
+
d[s.path[b]] = s.lhs;
|
|
871
871
|
break;
|
|
872
872
|
case "N":
|
|
873
|
-
delete
|
|
873
|
+
delete d[s.path[b]];
|
|
874
874
|
break;
|
|
875
875
|
}
|
|
876
876
|
} else
|
|
877
877
|
switch (s.kind) {
|
|
878
878
|
case "A":
|
|
879
|
-
|
|
879
|
+
P(i[l], s.index, s.item);
|
|
880
880
|
break;
|
|
881
881
|
case "D":
|
|
882
882
|
i[l] = s.lhs;
|
|
@@ -890,42 +890,42 @@ function He() {
|
|
|
890
890
|
}
|
|
891
891
|
return i;
|
|
892
892
|
}
|
|
893
|
-
function
|
|
893
|
+
function j(i, l, s) {
|
|
894
894
|
if (i && l && s && s.kind) {
|
|
895
|
-
var
|
|
896
|
-
for (A = s.path.length - 1,
|
|
897
|
-
typeof
|
|
895
|
+
var d = i, b, A;
|
|
896
|
+
for (A = s.path.length - 1, b = 0; b < A; b++)
|
|
897
|
+
typeof d[s.path[b]] > "u" && (d[s.path[b]] = {}), d = d[s.path[b]];
|
|
898
898
|
switch (s.kind) {
|
|
899
899
|
case "A":
|
|
900
|
-
|
|
900
|
+
P(d[s.path[b]], s.index, s.item);
|
|
901
901
|
break;
|
|
902
902
|
case "D":
|
|
903
|
-
|
|
903
|
+
d[s.path[b]] = s.lhs;
|
|
904
904
|
break;
|
|
905
905
|
case "E":
|
|
906
|
-
|
|
906
|
+
d[s.path[b]] = s.lhs;
|
|
907
907
|
break;
|
|
908
908
|
case "N":
|
|
909
|
-
delete
|
|
909
|
+
delete d[s.path[b]];
|
|
910
910
|
break;
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function S(i, l, s) {
|
|
915
915
|
if (i && l) {
|
|
916
|
-
var
|
|
917
|
-
(!s || s(i, l,
|
|
916
|
+
var d = function(b) {
|
|
917
|
+
(!s || s(i, l, b)) && k(i, l, b);
|
|
918
918
|
};
|
|
919
|
-
w(i, l,
|
|
919
|
+
w(i, l, d);
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
|
-
return Object.defineProperties(
|
|
922
|
+
return Object.defineProperties(D, {
|
|
923
923
|
diff: {
|
|
924
|
-
value:
|
|
924
|
+
value: D,
|
|
925
925
|
enumerable: !0
|
|
926
926
|
},
|
|
927
927
|
orderIndependentDiff: {
|
|
928
|
-
value:
|
|
928
|
+
value: v,
|
|
929
929
|
enumerable: !0
|
|
930
930
|
},
|
|
931
931
|
observableDiff: {
|
|
@@ -933,15 +933,15 @@ function He() {
|
|
|
933
933
|
enumerable: !0
|
|
934
934
|
},
|
|
935
935
|
orderIndependentObservableDiff: {
|
|
936
|
-
value:
|
|
936
|
+
value: C,
|
|
937
937
|
enumerable: !0
|
|
938
938
|
},
|
|
939
939
|
orderIndepHash: {
|
|
940
|
-
value:
|
|
940
|
+
value: E,
|
|
941
941
|
enumerable: !0
|
|
942
942
|
},
|
|
943
943
|
applyDiff: {
|
|
944
|
-
value:
|
|
944
|
+
value: S,
|
|
945
945
|
enumerable: !0
|
|
946
946
|
},
|
|
947
947
|
applyChange: {
|
|
@@ -949,7 +949,7 @@ function He() {
|
|
|
949
949
|
enumerable: !0
|
|
950
950
|
},
|
|
951
951
|
revertChange: {
|
|
952
|
-
value:
|
|
952
|
+
value: j,
|
|
953
953
|
enumerable: !0
|
|
954
954
|
},
|
|
955
955
|
isConflict: {
|
|
@@ -958,55 +958,55 @@ function He() {
|
|
|
958
958
|
},
|
|
959
959
|
enumerable: !0
|
|
960
960
|
}
|
|
961
|
-
}),
|
|
961
|
+
}), D.DeepDiff = D, n && (n.DeepDiff = D), D;
|
|
962
962
|
});
|
|
963
963
|
}(ie)), ie.exports;
|
|
964
964
|
}
|
|
965
965
|
var Te = He(), oe = { exports: {} };
|
|
966
966
|
const H = new Uint32Array(65536), Ue = (t, e) => {
|
|
967
967
|
const n = t.length, r = e.length, o = 1 << n - 1;
|
|
968
|
-
let u = -1,
|
|
969
|
-
for (;
|
|
970
|
-
H[t.charCodeAt(
|
|
971
|
-
for (
|
|
972
|
-
let y = H[e.charCodeAt(
|
|
973
|
-
const m = y |
|
|
974
|
-
y |= (y & u) + u ^ u,
|
|
968
|
+
let u = -1, p = 0, f = n, c = n;
|
|
969
|
+
for (; c--; )
|
|
970
|
+
H[t.charCodeAt(c)] |= 1 << c;
|
|
971
|
+
for (c = 0; c < r; c++) {
|
|
972
|
+
let y = H[e.charCodeAt(c)];
|
|
973
|
+
const m = y | p;
|
|
974
|
+
y |= (y & u) + u ^ u, p |= ~(y | u), u &= y, p & o && f++, u & o && f--, p = p << 1 | 1, u = u << 1 | ~(m | p), p &= m;
|
|
975
975
|
}
|
|
976
|
-
for (
|
|
977
|
-
H[t.charCodeAt(
|
|
978
|
-
return
|
|
976
|
+
for (c = n; c--; )
|
|
977
|
+
H[t.charCodeAt(c)] = 0;
|
|
978
|
+
return f;
|
|
979
979
|
}, Ke = (t, e) => {
|
|
980
|
-
const n = e.length, r = t.length, o = [], u = [],
|
|
981
|
-
for (let h = 0; h <
|
|
980
|
+
const n = e.length, r = t.length, o = [], u = [], p = Math.ceil(n / 32), f = Math.ceil(r / 32);
|
|
981
|
+
for (let h = 0; h < p; h++)
|
|
982
982
|
u[h] = -1, o[h] = 0;
|
|
983
|
-
let
|
|
984
|
-
for (;
|
|
983
|
+
let c = 0;
|
|
984
|
+
for (; c < f - 1; c++) {
|
|
985
985
|
let h = 0, w = -1;
|
|
986
|
-
const
|
|
987
|
-
for (let
|
|
988
|
-
H[t.charCodeAt(
|
|
989
|
-
for (let
|
|
990
|
-
const
|
|
991
|
-
let i = h | ~(
|
|
992
|
-
i >>> 31 ^ k && (u[
|
|
986
|
+
const C = c * 32, D = Math.min(32, r) + C;
|
|
987
|
+
for (let v = C; v < D; v++)
|
|
988
|
+
H[t.charCodeAt(v)] |= 1 << v;
|
|
989
|
+
for (let v = 0; v < n; v++) {
|
|
990
|
+
const O = H[e.charCodeAt(v)], k = u[v / 32 | 0] >>> v & 1, P = o[v / 32 | 0] >>> v & 1, j = O | h, S = ((O | P) & w) + w ^ w | O | P;
|
|
991
|
+
let i = h | ~(S | w), l = w & S;
|
|
992
|
+
i >>> 31 ^ k && (u[v / 32 | 0] ^= 1 << v), l >>> 31 ^ P && (o[v / 32 | 0] ^= 1 << v), i = i << 1 | k, l = l << 1 | P, w = l | ~(j | i), h = i & j;
|
|
993
993
|
}
|
|
994
|
-
for (let
|
|
995
|
-
H[t.charCodeAt(
|
|
994
|
+
for (let v = C; v < D; v++)
|
|
995
|
+
H[t.charCodeAt(v)] = 0;
|
|
996
996
|
}
|
|
997
997
|
let y = 0, m = -1;
|
|
998
|
-
const
|
|
999
|
-
for (let h =
|
|
998
|
+
const R = c * 32, g = Math.min(32, r - R) + R;
|
|
999
|
+
for (let h = R; h < g; h++)
|
|
1000
1000
|
H[t.charCodeAt(h)] |= 1 << h;
|
|
1001
|
-
let
|
|
1001
|
+
let E = r;
|
|
1002
1002
|
for (let h = 0; h < n; h++) {
|
|
1003
|
-
const w = H[e.charCodeAt(h)],
|
|
1004
|
-
let k = y | ~(
|
|
1005
|
-
|
|
1003
|
+
const w = H[e.charCodeAt(h)], C = u[h / 32 | 0] >>> h & 1, D = o[h / 32 | 0] >>> h & 1, v = w | y, O = ((w | D) & m) + m ^ m | w | D;
|
|
1004
|
+
let k = y | ~(O | m), P = m & O;
|
|
1005
|
+
E += k >>> r - 1 & 1, E -= P >>> r - 1 & 1, k >>> 31 ^ C && (u[h / 32 | 0] ^= 1 << h), P >>> 31 ^ D && (o[h / 32 | 0] ^= 1 << h), k = k << 1 | C, P = P << 1 | D, m = P | ~(v | k), y = k & v;
|
|
1006
1006
|
}
|
|
1007
|
-
for (let h =
|
|
1007
|
+
for (let h = R; h < g; h++)
|
|
1008
1008
|
H[t.charCodeAt(h)] = 0;
|
|
1009
|
-
return
|
|
1009
|
+
return E;
|
|
1010
1010
|
}, Ce = (t, e) => {
|
|
1011
1011
|
if (t.length < e.length) {
|
|
1012
1012
|
const n = e;
|
|
@@ -1024,7 +1024,7 @@ const H = new Uint32Array(65536), Ue = (t, e) => {
|
|
|
1024
1024
|
__proto__: null,
|
|
1025
1025
|
closest: Je,
|
|
1026
1026
|
distance: Ce
|
|
1027
|
-
}, Symbol.toStringTag, { value: "Module" })), Ve = /* @__PURE__ */
|
|
1027
|
+
}, Symbol.toStringTag, { value: "Module" })), Ve = /* @__PURE__ */ Ne(Be);
|
|
1028
1028
|
var me;
|
|
1029
1029
|
function Ge() {
|
|
1030
1030
|
return me || (me = 1, function(t, e) {
|
|
@@ -1035,7 +1035,7 @@ function Ge() {
|
|
|
1035
1035
|
} catch {
|
|
1036
1036
|
console.log("Collator could not be initialized and wouldn't be used");
|
|
1037
1037
|
}
|
|
1038
|
-
var r = Ve, o = [], u = [],
|
|
1038
|
+
var r = Ve, o = [], u = [], p = {
|
|
1039
1039
|
/**
|
|
1040
1040
|
* Calculate levenshtein distance of the two strings.
|
|
1041
1041
|
*
|
|
@@ -1045,28 +1045,28 @@ function Ge() {
|
|
|
1045
1045
|
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
1046
1046
|
* @return Integer the levenshtein distance (0 and above).
|
|
1047
1047
|
*/
|
|
1048
|
-
get: function(
|
|
1048
|
+
get: function(f, c, y) {
|
|
1049
1049
|
var m = y && n && y.useCollator;
|
|
1050
1050
|
if (m) {
|
|
1051
|
-
var
|
|
1052
|
-
if (
|
|
1053
|
-
if (
|
|
1054
|
-
var
|
|
1055
|
-
for (w = 0; w <
|
|
1056
|
-
o[w] = w, u[w] =
|
|
1057
|
-
o[
|
|
1058
|
-
var
|
|
1059
|
-
for (w = 0; w <
|
|
1060
|
-
for (h = w + 1,
|
|
1061
|
-
|
|
1062
|
-
o[
|
|
1051
|
+
var R = f.length, g = c.length;
|
|
1052
|
+
if (R === 0) return g;
|
|
1053
|
+
if (g === 0) return R;
|
|
1054
|
+
var E, h, w, C, D;
|
|
1055
|
+
for (w = 0; w < g; ++w)
|
|
1056
|
+
o[w] = w, u[w] = c.charCodeAt(w);
|
|
1057
|
+
o[g] = g;
|
|
1058
|
+
var v;
|
|
1059
|
+
for (w = 0; w < R; ++w) {
|
|
1060
|
+
for (h = w + 1, C = 0; C < g; ++C)
|
|
1061
|
+
E = h, v = n.compare(f.charAt(w), String.fromCharCode(u[C])) === 0, h = o[C] + (v ? 0 : 1), D = E + 1, h > D && (h = D), D = o[C + 1] + 1, h > D && (h = D), o[C] = E;
|
|
1062
|
+
o[C] = h;
|
|
1063
1063
|
}
|
|
1064
1064
|
return h;
|
|
1065
1065
|
}
|
|
1066
|
-
return r.distance(
|
|
1066
|
+
return r.distance(f, c);
|
|
1067
1067
|
}
|
|
1068
1068
|
};
|
|
1069
|
-
t !== null && t.exports === e ? t.exports =
|
|
1069
|
+
t !== null && t.exports === e ? t.exports = p : typeof self < "u" && typeof self.postMessage == "function" && typeof self.importScripts == "function" ? self.Levenshtein = p : typeof window < "u" && window !== null && (window.Levenshtein = p);
|
|
1070
1070
|
})();
|
|
1071
1071
|
}(oe, oe.exports)), oe.exports;
|
|
1072
1072
|
}
|
|
@@ -1076,79 +1076,79 @@ class Qe {
|
|
|
1076
1076
|
diff(e, n, r = {}) {
|
|
1077
1077
|
let o;
|
|
1078
1078
|
typeof r == "function" ? (o = r, r = {}) : "callback" in r && (o = r.callback);
|
|
1079
|
-
const u = this.castInput(e, r),
|
|
1080
|
-
return this.diffWithOptionsObj(
|
|
1079
|
+
const u = this.castInput(e, r), p = this.castInput(n, r), f = this.removeEmpty(this.tokenize(u, r)), c = this.removeEmpty(this.tokenize(p, r));
|
|
1080
|
+
return this.diffWithOptionsObj(f, c, r, o);
|
|
1081
1081
|
}
|
|
1082
1082
|
diffWithOptionsObj(e, n, r, o) {
|
|
1083
1083
|
var u;
|
|
1084
|
-
const
|
|
1085
|
-
if (
|
|
1084
|
+
const p = (v) => {
|
|
1085
|
+
if (v = this.postProcess(v, r), o) {
|
|
1086
1086
|
setTimeout(function() {
|
|
1087
|
-
o(
|
|
1087
|
+
o(v);
|
|
1088
1088
|
}, 0);
|
|
1089
1089
|
return;
|
|
1090
1090
|
} else
|
|
1091
|
-
return
|
|
1092
|
-
},
|
|
1093
|
-
let y = 1, m =
|
|
1091
|
+
return v;
|
|
1092
|
+
}, f = n.length, c = e.length;
|
|
1093
|
+
let y = 1, m = f + c;
|
|
1094
1094
|
r.maxEditLength != null && (m = Math.min(m, r.maxEditLength));
|
|
1095
|
-
const
|
|
1096
|
-
let h = this.extractCommon(
|
|
1097
|
-
if (
|
|
1098
|
-
return
|
|
1099
|
-
let w = -1 / 0,
|
|
1100
|
-
const
|
|
1101
|
-
for (let
|
|
1102
|
-
let
|
|
1103
|
-
const k =
|
|
1104
|
-
k && (
|
|
1105
|
-
let
|
|
1106
|
-
if (
|
|
1107
|
-
const i =
|
|
1108
|
-
|
|
1095
|
+
const R = (u = r.timeout) !== null && u !== void 0 ? u : 1 / 0, g = Date.now() + R, E = [{ oldPos: -1, lastComponent: void 0 }];
|
|
1096
|
+
let h = this.extractCommon(E[0], n, e, 0, r);
|
|
1097
|
+
if (E[0].oldPos + 1 >= c && h + 1 >= f)
|
|
1098
|
+
return p(this.buildValues(E[0].lastComponent, n, e));
|
|
1099
|
+
let w = -1 / 0, C = 1 / 0;
|
|
1100
|
+
const D = () => {
|
|
1101
|
+
for (let v = Math.max(w, -y); v <= Math.min(C, y); v += 2) {
|
|
1102
|
+
let O;
|
|
1103
|
+
const k = E[v - 1], P = E[v + 1];
|
|
1104
|
+
k && (E[v - 1] = void 0);
|
|
1105
|
+
let j = !1;
|
|
1106
|
+
if (P) {
|
|
1107
|
+
const i = P.oldPos - v;
|
|
1108
|
+
j = P && 0 <= i && i < f;
|
|
1109
1109
|
}
|
|
1110
|
-
const
|
|
1111
|
-
if (!
|
|
1112
|
-
|
|
1110
|
+
const S = k && k.oldPos + 1 < c;
|
|
1111
|
+
if (!j && !S) {
|
|
1112
|
+
E[v] = void 0;
|
|
1113
1113
|
continue;
|
|
1114
1114
|
}
|
|
1115
|
-
if (!
|
|
1116
|
-
return
|
|
1117
|
-
|
|
1115
|
+
if (!S || j && k.oldPos < P.oldPos ? O = this.addToPath(P, !0, !1, 0, r) : O = this.addToPath(k, !1, !0, 1, r), h = this.extractCommon(O, n, e, v, r), O.oldPos + 1 >= c && h + 1 >= f)
|
|
1116
|
+
return p(this.buildValues(O.lastComponent, n, e)) || !0;
|
|
1117
|
+
E[v] = O, O.oldPos + 1 >= c && (C = Math.min(C, v - 1)), h + 1 >= f && (w = Math.max(w, v + 1));
|
|
1118
1118
|
}
|
|
1119
1119
|
y++;
|
|
1120
1120
|
};
|
|
1121
1121
|
if (o)
|
|
1122
|
-
(function
|
|
1122
|
+
(function v() {
|
|
1123
1123
|
setTimeout(function() {
|
|
1124
|
-
if (y > m || Date.now() >
|
|
1124
|
+
if (y > m || Date.now() > g)
|
|
1125
1125
|
return o(void 0);
|
|
1126
|
-
|
|
1126
|
+
D() || v();
|
|
1127
1127
|
}, 0);
|
|
1128
1128
|
})();
|
|
1129
1129
|
else
|
|
1130
|
-
for (; y <= m && Date.now() <=
|
|
1131
|
-
const
|
|
1132
|
-
if (
|
|
1133
|
-
return
|
|
1130
|
+
for (; y <= m && Date.now() <= g; ) {
|
|
1131
|
+
const v = D();
|
|
1132
|
+
if (v)
|
|
1133
|
+
return v;
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
1136
|
addToPath(e, n, r, o, u) {
|
|
1137
|
-
const
|
|
1138
|
-
return
|
|
1137
|
+
const p = e.lastComponent;
|
|
1138
|
+
return p && !u.oneChangePerToken && p.added === n && p.removed === r ? {
|
|
1139
1139
|
oldPos: e.oldPos + o,
|
|
1140
|
-
lastComponent: { count:
|
|
1140
|
+
lastComponent: { count: p.count + 1, added: n, removed: r, previousComponent: p.previousComponent }
|
|
1141
1141
|
} : {
|
|
1142
1142
|
oldPos: e.oldPos + o,
|
|
1143
|
-
lastComponent: { count: 1, added: n, removed: r, previousComponent:
|
|
1143
|
+
lastComponent: { count: 1, added: n, removed: r, previousComponent: p }
|
|
1144
1144
|
};
|
|
1145
1145
|
}
|
|
1146
1146
|
extractCommon(e, n, r, o, u) {
|
|
1147
|
-
const
|
|
1148
|
-
let
|
|
1149
|
-
for (; y + 1 <
|
|
1150
|
-
y++,
|
|
1151
|
-
return m && !u.oneChangePerToken && (e.lastComponent = { count: m, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos =
|
|
1147
|
+
const p = n.length, f = r.length;
|
|
1148
|
+
let c = e.oldPos, y = c - o, m = 0;
|
|
1149
|
+
for (; y + 1 < p && c + 1 < f && this.equals(r[c + 1], n[y + 1], u); )
|
|
1150
|
+
y++, c++, m++, u.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
|
|
1151
|
+
return m && !u.oneChangePerToken && (e.lastComponent = { count: m, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = c, y;
|
|
1152
1152
|
}
|
|
1153
1153
|
equals(e, n, r) {
|
|
1154
1154
|
return r.comparator ? r.comparator(e, n) : e === n || !!r.ignoreCase && e.toLowerCase() === n.toLowerCase();
|
|
@@ -1182,22 +1182,22 @@ class Qe {
|
|
|
1182
1182
|
for (; e; )
|
|
1183
1183
|
o.push(e), u = e.previousComponent, delete e.previousComponent, e = u;
|
|
1184
1184
|
o.reverse();
|
|
1185
|
-
const
|
|
1186
|
-
let
|
|
1187
|
-
for (;
|
|
1188
|
-
const m = o[
|
|
1185
|
+
const p = o.length;
|
|
1186
|
+
let f = 0, c = 0, y = 0;
|
|
1187
|
+
for (; f < p; f++) {
|
|
1188
|
+
const m = o[f];
|
|
1189
1189
|
if (m.removed)
|
|
1190
1190
|
m.value = this.join(r.slice(y, y + m.count)), y += m.count;
|
|
1191
1191
|
else {
|
|
1192
1192
|
if (!m.added && this.useLongestToken) {
|
|
1193
|
-
let
|
|
1194
|
-
|
|
1195
|
-
const h = r[y +
|
|
1196
|
-
return h.length >
|
|
1197
|
-
}), m.value = this.join(
|
|
1193
|
+
let R = n.slice(c, c + m.count);
|
|
1194
|
+
R = R.map(function(g, E) {
|
|
1195
|
+
const h = r[y + E];
|
|
1196
|
+
return h.length > g.length ? h : g;
|
|
1197
|
+
}), m.value = this.join(R);
|
|
1198
1198
|
} else
|
|
1199
|
-
m.value = this.join(n.slice(
|
|
1200
|
-
|
|
1199
|
+
m.value = this.join(n.slice(c, c + m.count));
|
|
1200
|
+
c += m.count, m.added || (y += m.count);
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
1203
|
return o;
|
|
@@ -1230,72 +1230,72 @@ function nt(t, e) {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
return n;
|
|
1232
1232
|
}
|
|
1233
|
-
function be(t, e, n, r, o, u,
|
|
1234
|
-
let
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1233
|
+
function be(t, e, n, r, o, u, p) {
|
|
1234
|
+
let f;
|
|
1235
|
+
p ? typeof p == "function" ? f = { callback: p } : f = p : f = {}, typeof f.context > "u" && (f.context = 4);
|
|
1236
|
+
const c = f.context;
|
|
1237
|
+
if (f.newlineIsToken)
|
|
1238
1238
|
throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
|
|
1239
|
-
if (
|
|
1240
|
-
const { callback: m } =
|
|
1241
|
-
ve(n, r, Object.assign(Object.assign({},
|
|
1242
|
-
const
|
|
1243
|
-
m(
|
|
1239
|
+
if (f.callback) {
|
|
1240
|
+
const { callback: m } = f;
|
|
1241
|
+
ve(n, r, Object.assign(Object.assign({}, f), { callback: (R) => {
|
|
1242
|
+
const g = y(R);
|
|
1243
|
+
m(g);
|
|
1244
1244
|
} }));
|
|
1245
1245
|
} else
|
|
1246
|
-
return y(ve(n, r,
|
|
1246
|
+
return y(ve(n, r, f));
|
|
1247
1247
|
function y(m) {
|
|
1248
1248
|
if (!m)
|
|
1249
1249
|
return;
|
|
1250
1250
|
m.push({ value: "", lines: [] });
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1253
|
-
return " " +
|
|
1251
|
+
function R(v) {
|
|
1252
|
+
return v.map(function(O) {
|
|
1253
|
+
return " " + O;
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
|
-
const
|
|
1257
|
-
let
|
|
1258
|
-
for (let
|
|
1259
|
-
const
|
|
1260
|
-
if (
|
|
1261
|
-
if (!
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1256
|
+
const g = [];
|
|
1257
|
+
let E = 0, h = 0, w = [], C = 1, D = 1;
|
|
1258
|
+
for (let v = 0; v < m.length; v++) {
|
|
1259
|
+
const O = m[v], k = O.lines || ot(O.value);
|
|
1260
|
+
if (O.lines = k, O.added || O.removed) {
|
|
1261
|
+
if (!E) {
|
|
1262
|
+
const P = m[v - 1];
|
|
1263
|
+
E = C, h = D, P && (w = c > 0 ? R(P.lines.slice(-c)) : [], E -= w.length, h -= w.length);
|
|
1264
1264
|
}
|
|
1265
|
-
for (const
|
|
1266
|
-
w.push((
|
|
1267
|
-
|
|
1265
|
+
for (const P of k)
|
|
1266
|
+
w.push((O.added ? "+" : "-") + P);
|
|
1267
|
+
O.added ? D += k.length : C += k.length;
|
|
1268
1268
|
} else {
|
|
1269
|
-
if (
|
|
1270
|
-
if (k.length <=
|
|
1271
|
-
for (const
|
|
1272
|
-
w.push(
|
|
1269
|
+
if (E)
|
|
1270
|
+
if (k.length <= c * 2 && v < m.length - 2)
|
|
1271
|
+
for (const P of R(k))
|
|
1272
|
+
w.push(P);
|
|
1273
1273
|
else {
|
|
1274
|
-
const
|
|
1275
|
-
for (const
|
|
1276
|
-
w.push(
|
|
1277
|
-
const
|
|
1278
|
-
oldStart:
|
|
1279
|
-
oldLines:
|
|
1274
|
+
const P = Math.min(k.length, c);
|
|
1275
|
+
for (const S of R(k.slice(0, P)))
|
|
1276
|
+
w.push(S);
|
|
1277
|
+
const j = {
|
|
1278
|
+
oldStart: E,
|
|
1279
|
+
oldLines: C - E + P,
|
|
1280
1280
|
newStart: h,
|
|
1281
|
-
newLines:
|
|
1281
|
+
newLines: D - h + P,
|
|
1282
1282
|
lines: w
|
|
1283
1283
|
};
|
|
1284
|
-
|
|
1284
|
+
g.push(j), E = 0, h = 0, w = [];
|
|
1285
1285
|
}
|
|
1286
|
-
|
|
1286
|
+
C += k.length, D += k.length;
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
|
-
for (const
|
|
1290
|
-
for (let
|
|
1291
|
-
|
|
1292
|
-
`) ?
|
|
1289
|
+
for (const v of g)
|
|
1290
|
+
for (let O = 0; O < v.lines.length; O++)
|
|
1291
|
+
v.lines[O].endsWith(`
|
|
1292
|
+
`) ? v.lines[O] = v.lines[O].slice(0, -1) : (v.lines.splice(O + 1, 0, "\"), O++);
|
|
1293
1293
|
return {
|
|
1294
1294
|
oldFileName: t,
|
|
1295
1295
|
newFileName: e,
|
|
1296
1296
|
oldHeader: o,
|
|
1297
1297
|
newHeader: u,
|
|
1298
|
-
hunks:
|
|
1298
|
+
hunks: g
|
|
1299
1299
|
};
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
@@ -1315,15 +1315,15 @@ function ue(t) {
|
|
|
1315
1315
|
`) + `
|
|
1316
1316
|
`;
|
|
1317
1317
|
}
|
|
1318
|
-
function rt(t, e, n, r, o, u,
|
|
1319
|
-
if (typeof
|
|
1320
|
-
const { callback:
|
|
1321
|
-
be(t, e, n, r, o, u, Object.assign(Object.assign({},
|
|
1322
|
-
|
|
1318
|
+
function rt(t, e, n, r, o, u, p) {
|
|
1319
|
+
if (typeof p == "function" && (p = { callback: p }), p?.callback) {
|
|
1320
|
+
const { callback: f } = p;
|
|
1321
|
+
be(t, e, n, r, o, u, Object.assign(Object.assign({}, p), { callback: (c) => {
|
|
1322
|
+
f(c ? ue(c) : void 0);
|
|
1323
1323
|
} }));
|
|
1324
1324
|
} else {
|
|
1325
|
-
const
|
|
1326
|
-
return
|
|
1325
|
+
const f = be(t, e, n, r, o, u, p);
|
|
1326
|
+
return f ? ue(f) : void 0;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
1329
|
function ot(t) {
|
|
@@ -1333,7 +1333,7 @@ function ot(t) {
|
|
|
1333
1333
|
`);
|
|
1334
1334
|
return e ? n.pop() : n.push(n.pop().slice(0, -1)), n;
|
|
1335
1335
|
}
|
|
1336
|
-
function it(t, e, n = "git", r =
|
|
1336
|
+
function it(t, e, n = "git", r = 1) {
|
|
1337
1337
|
switch (n) {
|
|
1338
1338
|
case "git":
|
|
1339
1339
|
return ye(t, e, r);
|
|
@@ -1345,9 +1345,8 @@ function it(t, e, n = "git", r = 3) {
|
|
|
1345
1345
|
return ye(t, e, r);
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
function ye(t, e, n =
|
|
1349
|
-
const r = ge(t), o = ge(e)
|
|
1350
|
-
return rt(
|
|
1348
|
+
function ye(t, e, n = 1) {
|
|
1349
|
+
const r = ge(t), o = ge(e), f = rt(
|
|
1351
1350
|
/* oldFilename */
|
|
1352
1351
|
"",
|
|
1353
1352
|
/* newFilename */
|
|
@@ -1360,7 +1359,11 @@ function ye(t, e, n = 3) {
|
|
|
1360
1359
|
"",
|
|
1361
1360
|
{ context: n }
|
|
1362
1361
|
).split(`
|
|
1363
|
-
`).
|
|
1362
|
+
`).filter((c) => !c || c === "\" || c.startsWith("@@") || c.startsWith("---") || c.startsWith("+++") || c.startsWith(" ") ? !1 : !!(c.startsWith("+") || c.startsWith("-")));
|
|
1363
|
+
for (; f.length && f[0].trim() === ""; ) f.shift();
|
|
1364
|
+
for (; f.length && f[f.length - 1].trim() === ""; )
|
|
1365
|
+
f.pop();
|
|
1366
|
+
return f.join(`
|
|
1364
1367
|
`);
|
|
1365
1368
|
}
|
|
1366
1369
|
function st(t, e) {
|
|
@@ -1398,36 +1401,36 @@ function ut(t, e) {
|
|
|
1398
1401
|
if (n.length === 0) return 0;
|
|
1399
1402
|
const r = we(t), o = we(e), u = Math.max(r, o);
|
|
1400
1403
|
if (u === 0) return 0;
|
|
1401
|
-
let
|
|
1402
|
-
for (const
|
|
1403
|
-
switch (
|
|
1404
|
+
let p = 0;
|
|
1405
|
+
for (const f of n)
|
|
1406
|
+
switch (f.kind) {
|
|
1404
1407
|
case "N":
|
|
1405
|
-
|
|
1408
|
+
p += 1;
|
|
1406
1409
|
break;
|
|
1407
1410
|
case "D":
|
|
1408
|
-
|
|
1411
|
+
p += 1;
|
|
1409
1412
|
break;
|
|
1410
1413
|
case "E":
|
|
1411
|
-
if (typeof
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
|
|
1414
|
+
if (typeof f.lhs == "string" && typeof f.rhs == "string") {
|
|
1415
|
+
const c = Oe(
|
|
1416
|
+
f.lhs,
|
|
1417
|
+
f.rhs
|
|
1415
1418
|
);
|
|
1416
|
-
|
|
1417
|
-
} else if (typeof
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
|
|
1419
|
+
p += c;
|
|
1420
|
+
} else if (typeof f.lhs == "number" && typeof f.rhs == "number") {
|
|
1421
|
+
const c = Re(
|
|
1422
|
+
f.lhs,
|
|
1423
|
+
f.rhs
|
|
1421
1424
|
);
|
|
1422
|
-
|
|
1425
|
+
p += c;
|
|
1423
1426
|
} else
|
|
1424
|
-
|
|
1427
|
+
p += 1;
|
|
1425
1428
|
break;
|
|
1426
1429
|
case "A":
|
|
1427
|
-
|
|
1430
|
+
p += 0.5;
|
|
1428
1431
|
break;
|
|
1429
1432
|
}
|
|
1430
|
-
return Math.min(
|
|
1433
|
+
return Math.min(p / u, 1);
|
|
1431
1434
|
}
|
|
1432
1435
|
function we(t) {
|
|
1433
1436
|
if (t == null) return 0;
|
|
@@ -1449,94 +1452,96 @@ function ge(t) {
|
|
|
1449
1452
|
return String(t);
|
|
1450
1453
|
}
|
|
1451
1454
|
}
|
|
1452
|
-
function
|
|
1453
|
-
const r = Pe(), o = n?.onFeedback || r, u = n?.debounceMs ??
|
|
1455
|
+
function ft(t, e, n) {
|
|
1456
|
+
const r = Pe(), o = n?.onFeedback || r, u = n?.debounceMs ?? 3e3, p = n?.diffType ?? "git", f = n?.compareWith, c = n?.default_trigger_name ?? "auto_state_change", y = n?.ignoreInitialNullish ?? !0, m = z(t), R = z(!0), g = z(t), E = z(t == null), h = z(
|
|
1454
1457
|
t != null
|
|
1455
1458
|
// != null catches both null and undefined
|
|
1456
|
-
), w = z(
|
|
1457
|
-
(
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1459
|
+
), w = z(
|
|
1460
|
+
!(y && t == null)
|
|
1461
|
+
), C = z(null), D = z(void 0), v = q(
|
|
1462
|
+
(k, P, j) => {
|
|
1463
|
+
const S = lt(k, P), i = it(k, P, p);
|
|
1464
|
+
let l;
|
|
1465
|
+
n?.vote ? typeof n.vote == "function" ? l = n.vote(k, P, S) : l = n.vote : l = S > 0.5 ? "downvote" : "upvote";
|
|
1466
|
+
const s = typeof e == "function" ? e(P) : e;
|
|
1462
1467
|
o({
|
|
1463
|
-
tx_id:
|
|
1464
|
-
vote:
|
|
1465
|
-
explanation: `State change with diff percentage: ${(
|
|
1466
|
-
correction:
|
|
1468
|
+
tx_id: s,
|
|
1469
|
+
vote: l,
|
|
1470
|
+
explanation: `State change with diff percentage: ${(S * 100).toFixed(1)}%`,
|
|
1471
|
+
correction: i,
|
|
1467
1472
|
source: "IMPLICIT",
|
|
1468
1473
|
extra_metadata: n?.metadata,
|
|
1469
|
-
trigger_name:
|
|
1474
|
+
trigger_name: j
|
|
1470
1475
|
});
|
|
1471
1476
|
},
|
|
1472
|
-
[n, e,
|
|
1473
|
-
),
|
|
1474
|
-
(
|
|
1475
|
-
const
|
|
1476
|
-
if (
|
|
1477
|
-
clearTimeout(
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1480
|
-
|
|
1477
|
+
[n, e, p, o]
|
|
1478
|
+
), O = q(
|
|
1479
|
+
(k) => {
|
|
1480
|
+
const P = k || c;
|
|
1481
|
+
if (C.current && D.current && D.current !== P) {
|
|
1482
|
+
clearTimeout(C.current);
|
|
1483
|
+
const j = g.current;
|
|
1484
|
+
v(
|
|
1485
|
+
j,
|
|
1481
1486
|
t,
|
|
1482
1487
|
D.current
|
|
1483
|
-
),
|
|
1488
|
+
), C.current = null;
|
|
1484
1489
|
}
|
|
1485
|
-
D.current =
|
|
1490
|
+
D.current = P;
|
|
1486
1491
|
},
|
|
1487
|
-
[t,
|
|
1492
|
+
[t, c, v]
|
|
1488
1493
|
);
|
|
1489
1494
|
return Ee(() => {
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1495
|
+
if (R.current) {
|
|
1496
|
+
R.current = !1, m.current = t, (!y || t != null) && (g.current = t, w.current = !0);
|
|
1492
1497
|
return;
|
|
1493
1498
|
}
|
|
1494
|
-
const
|
|
1495
|
-
if (!(
|
|
1496
|
-
const
|
|
1499
|
+
const k = m.current;
|
|
1500
|
+
if (!(f ? f(k, t) : JSON.stringify(k) === JSON.stringify(t))) {
|
|
1501
|
+
const j = y && E.current && // True initial state was nullish
|
|
1497
1502
|
!h.current && // We haven't had non-nullish state before
|
|
1498
1503
|
t != null;
|
|
1499
|
-
if (t != null && (h.current = !0),
|
|
1500
|
-
|
|
1504
|
+
if (t != null && (h.current = !0), j) {
|
|
1505
|
+
g.current = t, w.current = !0, m.current = t;
|
|
1501
1506
|
return;
|
|
1502
1507
|
}
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
D.current ||
|
|
1509
|
-
),
|
|
1508
|
+
C.current && clearTimeout(C.current), m.current = t, C.current = setTimeout(() => {
|
|
1509
|
+
const S = g.current, i = t;
|
|
1510
|
+
w.current && v(
|
|
1511
|
+
S,
|
|
1512
|
+
i,
|
|
1513
|
+
D.current || c
|
|
1514
|
+
), C.current = null;
|
|
1510
1515
|
}, u);
|
|
1511
1516
|
}
|
|
1512
1517
|
return () => {
|
|
1513
|
-
|
|
1518
|
+
C.current && clearTimeout(C.current);
|
|
1514
1519
|
};
|
|
1515
1520
|
}, [
|
|
1516
1521
|
t,
|
|
1517
1522
|
e,
|
|
1518
1523
|
n,
|
|
1519
1524
|
o,
|
|
1520
|
-
f,
|
|
1521
|
-
u,
|
|
1522
|
-
d,
|
|
1523
1525
|
p,
|
|
1526
|
+
u,
|
|
1527
|
+
f,
|
|
1528
|
+
c,
|
|
1524
1529
|
y,
|
|
1525
|
-
|
|
1530
|
+
v
|
|
1526
1531
|
]), {
|
|
1527
|
-
notifyChange:
|
|
1532
|
+
notifyChange: O
|
|
1528
1533
|
};
|
|
1529
1534
|
}
|
|
1530
1535
|
function vt(t, e, n) {
|
|
1531
|
-
const [r, o] = X(t), { notifyChange: u } =
|
|
1532
|
-
(
|
|
1533
|
-
u(
|
|
1536
|
+
const [r, o] = X(t), { notifyChange: u } = ft(r, e, n), p = q(
|
|
1537
|
+
(f, c) => {
|
|
1538
|
+
u(c), o((y) => typeof f == "function" ? f(y) : f);
|
|
1534
1539
|
},
|
|
1535
1540
|
[u]
|
|
1536
1541
|
);
|
|
1537
|
-
return [r,
|
|
1542
|
+
return [r, p];
|
|
1538
1543
|
}
|
|
1539
|
-
let
|
|
1544
|
+
let ct = () => {
|
|
1540
1545
|
try {
|
|
1541
1546
|
return require("@opentelemetry/api");
|
|
1542
1547
|
} catch {
|
|
@@ -1546,7 +1551,7 @@ let ft = () => {
|
|
|
1546
1551
|
}
|
|
1547
1552
|
};
|
|
1548
1553
|
function bt() {
|
|
1549
|
-
const { trace: t, context: e } =
|
|
1554
|
+
const { trace: t, context: e } = ct();
|
|
1550
1555
|
try {
|
|
1551
1556
|
const n = t.getSpanContext(e.active());
|
|
1552
1557
|
if (n?.traceId)
|