@kelet-ai/feedback-ui 1.1.3 → 1.2.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 +140 -70
- package/dist/components/vote-feedback.d.ts +1 -1
- package/dist/contexts/kelet.d.ts +20 -0
- package/dist/feedback-ui.es.js +270 -263
- package/dist/feedback-ui.es.js.map +1 -1
- package/dist/feedback-ui.es.min.js +850 -838
- package/dist/feedback-ui.es.min.js.map +1 -1
- package/dist/feedback-ui.umd.js +269 -262
- package/dist/feedback-ui.umd.js.map +1 -1
- package/dist/feedback-ui.umd.min.js +11 -11
- package/dist/feedback-ui.umd.min.js.map +1 -1
- package/dist/hooks/feedback-state/diff-utils.d.ts +1 -1
- package/dist/hooks/feedback-state/types.d.ts +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +16 -9
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Ne, { createContext as
|
|
1
|
+
import Ne, { createContext as Pe, useEffect as ce, useContext as le, useCallback as q, isValidElement as Q, cloneElement as ee, useState as X, useRef as Y, useId as de } from "react";
|
|
2
2
|
function je(t) {
|
|
3
3
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4
4
|
}
|
|
@@ -41,24 +41,24 @@ function Ie() {
|
|
|
41
41
|
if (pe) return V;
|
|
42
42
|
pe = 1;
|
|
43
43
|
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
44
|
-
function n(r, o,
|
|
45
|
-
var
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
for (var
|
|
49
|
-
|
|
50
|
-
} else
|
|
51
|
-
return o =
|
|
44
|
+
function n(r, o, d) {
|
|
45
|
+
var f = null;
|
|
46
|
+
if (d !== void 0 && (f = "" + d), o.key !== void 0 && (f = "" + o.key), "key" in o) {
|
|
47
|
+
d = {};
|
|
48
|
+
for (var l in o)
|
|
49
|
+
l !== "key" && (d[l] = o[l]);
|
|
50
|
+
} else d = o;
|
|
51
|
+
return o = d.ref, {
|
|
52
52
|
$$typeof: t,
|
|
53
53
|
type: r,
|
|
54
|
-
key:
|
|
54
|
+
key: f,
|
|
55
55
|
ref: o !== void 0 ? o : null,
|
|
56
|
-
props:
|
|
56
|
+
props: d
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
return V.Fragment = e, V.jsx = n, V.jsxs = n, V;
|
|
60
60
|
}
|
|
61
|
-
var
|
|
61
|
+
var G = {};
|
|
62
62
|
/**
|
|
63
63
|
* @license React
|
|
64
64
|
* react-jsx-runtime.development.js
|
|
@@ -71,235 +71,235 @@ var X = {};
|
|
|
71
71
|
var he;
|
|
72
72
|
function Le() {
|
|
73
73
|
return he || (he = 1, process.env.NODE_ENV !== "production" && function() {
|
|
74
|
-
function t(
|
|
75
|
-
if (
|
|
76
|
-
if (typeof
|
|
77
|
-
return
|
|
78
|
-
if (typeof
|
|
79
|
-
switch (
|
|
80
|
-
case
|
|
74
|
+
function t(a) {
|
|
75
|
+
if (a == null) return null;
|
|
76
|
+
if (typeof a == "function")
|
|
77
|
+
return a.$$typeof === s ? null : a.displayName || a.name || null;
|
|
78
|
+
if (typeof a == "string") return a;
|
|
79
|
+
switch (a) {
|
|
80
|
+
case k:
|
|
81
81
|
return "Fragment";
|
|
82
82
|
case A:
|
|
83
83
|
return "Profiler";
|
|
84
|
-
case
|
|
84
|
+
case O:
|
|
85
85
|
return "StrictMode";
|
|
86
|
-
case
|
|
86
|
+
case _:
|
|
87
87
|
return "Suspense";
|
|
88
|
-
case
|
|
88
|
+
case N:
|
|
89
89
|
return "SuspenseList";
|
|
90
|
-
case
|
|
90
|
+
case u:
|
|
91
91
|
return "Activity";
|
|
92
92
|
}
|
|
93
|
-
if (typeof
|
|
94
|
-
switch (typeof
|
|
93
|
+
if (typeof a == "object")
|
|
94
|
+
switch (typeof a.tag == "number" && console.error(
|
|
95
95
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
96
|
-
),
|
|
97
|
-
case
|
|
96
|
+
), a.$$typeof) {
|
|
97
|
+
case p:
|
|
98
98
|
return "Portal";
|
|
99
|
+
case T:
|
|
100
|
+
return (a.displayName || "Context") + ".Provider";
|
|
101
|
+
case m:
|
|
102
|
+
return (a._context.displayName || "Context") + ".Consumer";
|
|
99
103
|
case R:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var T = l.render;
|
|
105
|
-
return l = l.displayName, l || (l = T.displayName || T.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l;
|
|
106
|
-
case S:
|
|
107
|
-
return T = l.displayName || null, T !== null ? T : t(l.type) || "Memo";
|
|
104
|
+
var C = a.render;
|
|
105
|
+
return a = a.displayName, a || (a = C.displayName || C.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
106
|
+
case I:
|
|
107
|
+
return C = a.displayName || null, C !== null ? C : t(a.type) || "Memo";
|
|
108
108
|
case i:
|
|
109
|
-
|
|
109
|
+
C = a._payload, a = a._init;
|
|
110
110
|
try {
|
|
111
|
-
return t(
|
|
111
|
+
return t(a(C));
|
|
112
112
|
} catch {
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
function e(
|
|
118
|
-
return "" +
|
|
117
|
+
function e(a) {
|
|
118
|
+
return "" + a;
|
|
119
119
|
}
|
|
120
|
-
function n(
|
|
120
|
+
function n(a) {
|
|
121
121
|
try {
|
|
122
|
-
e(
|
|
123
|
-
var
|
|
122
|
+
e(a);
|
|
123
|
+
var C = !1;
|
|
124
124
|
} catch {
|
|
125
|
-
|
|
125
|
+
C = !0;
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
var
|
|
130
|
-
return
|
|
131
|
-
|
|
127
|
+
if (C) {
|
|
128
|
+
C = console;
|
|
129
|
+
var D = C.error, S = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
130
|
+
return D.call(
|
|
131
|
+
C,
|
|
132
132
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
133
|
-
|
|
134
|
-
), e(
|
|
133
|
+
S
|
|
134
|
+
), e(a);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
function r(
|
|
138
|
-
if (
|
|
139
|
-
if (typeof
|
|
137
|
+
function r(a) {
|
|
138
|
+
if (a === k) return "<>";
|
|
139
|
+
if (typeof a == "object" && a !== null && a.$$typeof === i)
|
|
140
140
|
return "<...>";
|
|
141
141
|
try {
|
|
142
|
-
var
|
|
143
|
-
return
|
|
142
|
+
var C = t(a);
|
|
143
|
+
return C ? "<" + C + ">" : "<...>";
|
|
144
144
|
} catch {
|
|
145
145
|
return "<...>";
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
function o() {
|
|
149
|
-
var
|
|
150
|
-
return
|
|
149
|
+
var a = v.A;
|
|
150
|
+
return a === null ? null : a.getOwner();
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function d() {
|
|
153
153
|
return Error("react-stack-top-frame");
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
if (y.call(
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
155
|
+
function f(a) {
|
|
156
|
+
if (y.call(a, "key")) {
|
|
157
|
+
var C = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
158
|
+
if (C && C.isReactWarning) return !1;
|
|
159
159
|
}
|
|
160
|
-
return
|
|
160
|
+
return a.key !== void 0;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
function
|
|
162
|
+
function l(a, C) {
|
|
163
|
+
function D() {
|
|
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
|
+
C
|
|
167
167
|
));
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
get:
|
|
169
|
+
D.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
170
|
+
get: D,
|
|
171
171
|
configurable: !0
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
var
|
|
176
|
-
return
|
|
174
|
+
function c() {
|
|
175
|
+
var a = t(this.type);
|
|
176
|
+
return j[a] || (j[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
|
|
181
|
-
return
|
|
182
|
-
$$typeof:
|
|
183
|
-
type:
|
|
184
|
-
key:
|
|
180
|
+
function h(a, C, D, S, W, $, B, U) {
|
|
181
|
+
return D = $.ref, a = {
|
|
182
|
+
$$typeof: x,
|
|
183
|
+
type: a,
|
|
184
|
+
key: C,
|
|
185
185
|
props: $,
|
|
186
186
|
_owner: W
|
|
187
|
-
}, (
|
|
187
|
+
}, (D !== void 0 ? D : null) !== null ? Object.defineProperty(a, "ref", {
|
|
188
188
|
enumerable: !1,
|
|
189
|
-
get:
|
|
190
|
-
}) : Object.defineProperty(
|
|
189
|
+
get: c
|
|
190
|
+
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
191
191
|
configurable: !1,
|
|
192
192
|
enumerable: !1,
|
|
193
193
|
writable: !0,
|
|
194
194
|
value: 0
|
|
195
|
-
}), Object.defineProperty(
|
|
195
|
+
}), Object.defineProperty(a, "_debugInfo", {
|
|
196
196
|
configurable: !1,
|
|
197
197
|
enumerable: !1,
|
|
198
198
|
writable: !0,
|
|
199
199
|
value: null
|
|
200
|
-
}), Object.defineProperty(
|
|
200
|
+
}), Object.defineProperty(a, "_debugStack", {
|
|
201
201
|
configurable: !1,
|
|
202
202
|
enumerable: !1,
|
|
203
203
|
writable: !0,
|
|
204
204
|
value: B
|
|
205
|
-
}), Object.defineProperty(
|
|
205
|
+
}), Object.defineProperty(a, "_debugTask", {
|
|
206
206
|
configurable: !1,
|
|
207
207
|
enumerable: !1,
|
|
208
208
|
writable: !0,
|
|
209
|
-
value:
|
|
210
|
-
}), Object.freeze && (Object.freeze(
|
|
209
|
+
value: U
|
|
210
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
211
211
|
}
|
|
212
|
-
function b(
|
|
213
|
-
var
|
|
214
|
-
if (
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
217
|
-
for (
|
|
218
|
-
|
|
219
|
-
Object.freeze && Object.freeze(
|
|
212
|
+
function b(a, C, D, S, W, $, B, U) {
|
|
213
|
+
var L = C.children;
|
|
214
|
+
if (L !== void 0)
|
|
215
|
+
if (S)
|
|
216
|
+
if (g(L)) {
|
|
217
|
+
for (S = 0; S < L.length; S++)
|
|
218
|
+
P(L[S]);
|
|
219
|
+
Object.freeze && Object.freeze(L);
|
|
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 (y.call(
|
|
226
|
-
|
|
227
|
-
var z = Object.keys(
|
|
228
|
-
return
|
|
224
|
+
else P(L);
|
|
225
|
+
if (y.call(C, "key")) {
|
|
226
|
+
L = t(a);
|
|
227
|
+
var z = Object.keys(C).filter(function(De) {
|
|
228
|
+
return De !== "key";
|
|
229
229
|
});
|
|
230
|
-
|
|
230
|
+
S = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", re[L + S] || (z = 0 < z.length ? "{" + z.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
|
+
S,
|
|
238
|
+
L,
|
|
239
239
|
z,
|
|
240
|
-
|
|
241
|
-
), re[
|
|
240
|
+
L
|
|
241
|
+
), re[L + S] = !0);
|
|
242
242
|
}
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
for (var ue in
|
|
246
|
-
ue !== "key" && (
|
|
247
|
-
} else
|
|
248
|
-
return
|
|
249
|
-
|
|
250
|
-
typeof
|
|
251
|
-
),
|
|
252
|
-
|
|
253
|
-
|
|
243
|
+
if (L = null, D !== void 0 && (n(D), L = "" + D), f(C) && (n(C.key), L = "" + C.key), "key" in C) {
|
|
244
|
+
D = {};
|
|
245
|
+
for (var ue in C)
|
|
246
|
+
ue !== "key" && (D[ue] = C[ue]);
|
|
247
|
+
} else D = C;
|
|
248
|
+
return L && l(
|
|
249
|
+
D,
|
|
250
|
+
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
251
|
+
), h(
|
|
252
|
+
a,
|
|
253
|
+
L,
|
|
254
254
|
$,
|
|
255
255
|
W,
|
|
256
256
|
o(),
|
|
257
|
-
|
|
257
|
+
D,
|
|
258
258
|
B,
|
|
259
|
-
|
|
259
|
+
U
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
typeof
|
|
262
|
+
function P(a) {
|
|
263
|
+
typeof a == "object" && a !== null && a.$$typeof === x && a._store && (a._store.validated = 1);
|
|
264
264
|
}
|
|
265
|
-
var
|
|
265
|
+
var E = Ne, x = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), T = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), N = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), u = Symbol.for("react.activity"), s = Symbol.for("react.client.reference"), v = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, g = Array.isArray, w = console.createTask ? console.createTask : function() {
|
|
266
266
|
return null;
|
|
267
267
|
};
|
|
268
|
-
|
|
269
|
-
react_stack_bottom_frame: function(
|
|
270
|
-
return
|
|
268
|
+
E = {
|
|
269
|
+
react_stack_bottom_frame: function(a) {
|
|
270
|
+
return a();
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
-
var M,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
)(), J =
|
|
277
|
-
|
|
278
|
-
var $ = 1e4 >
|
|
273
|
+
var M, j = {}, K = E.react_stack_bottom_frame.bind(
|
|
274
|
+
E,
|
|
275
|
+
d
|
|
276
|
+
)(), J = w(r(d)), re = {};
|
|
277
|
+
G.Fragment = k, G.jsx = function(a, C, D, S, W) {
|
|
278
|
+
var $ = 1e4 > v.recentlyCreatedOwnerStacks++;
|
|
279
279
|
return b(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
a,
|
|
281
|
+
C,
|
|
282
|
+
D,
|
|
283
283
|
!1,
|
|
284
|
-
|
|
284
|
+
S,
|
|
285
285
|
W,
|
|
286
|
-
$ ? Error("react-stack-top-frame") :
|
|
287
|
-
$ ?
|
|
286
|
+
$ ? Error("react-stack-top-frame") : K,
|
|
287
|
+
$ ? w(r(a)) : J
|
|
288
288
|
);
|
|
289
|
-
},
|
|
290
|
-
var $ = 1e4 >
|
|
289
|
+
}, G.jsxs = function(a, C, D, S, W) {
|
|
290
|
+
var $ = 1e4 > v.recentlyCreatedOwnerStacks++;
|
|
291
291
|
return b(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
a,
|
|
293
|
+
C,
|
|
294
|
+
D,
|
|
295
295
|
!0,
|
|
296
|
-
|
|
296
|
+
S,
|
|
297
297
|
W,
|
|
298
|
-
$ ? Error("react-stack-top-frame") :
|
|
299
|
-
$ ?
|
|
298
|
+
$ ? Error("react-stack-top-frame") : K,
|
|
299
|
+
$ ? w(r(a)) : J
|
|
300
300
|
);
|
|
301
301
|
};
|
|
302
|
-
}()),
|
|
302
|
+
}()), G;
|
|
303
303
|
}
|
|
304
304
|
var me;
|
|
305
305
|
function Fe() {
|
|
@@ -314,20 +314,20 @@ function Me(t) {
|
|
|
314
314
|
const n = e.getAttribute("data-feedback-id");
|
|
315
315
|
if (n) return `[data-feedback-id="${n}"]`;
|
|
316
316
|
const r = [];
|
|
317
|
-
let o = e,
|
|
318
|
-
const
|
|
319
|
-
for (; o && o !== document.body &&
|
|
320
|
-
let
|
|
317
|
+
let o = e, d = 0;
|
|
318
|
+
const f = 5;
|
|
319
|
+
for (; o && o !== document.body && d < f; ) {
|
|
320
|
+
let l = o.tagName.toLowerCase();
|
|
321
321
|
if (o.classList.length > 0) {
|
|
322
|
-
const
|
|
323
|
-
|
|
322
|
+
const h = Array.from(o.classList)[0];
|
|
323
|
+
l += `.${h}`;
|
|
324
324
|
}
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
328
|
-
|
|
325
|
+
const c = o.parentElement;
|
|
326
|
+
if (c) {
|
|
327
|
+
const h = Array.from(c.children), b = h.indexOf(o) + 1;
|
|
328
|
+
h.length > 1 && (l += `:nth-child(${b})`);
|
|
329
329
|
}
|
|
330
|
-
r.unshift(
|
|
330
|
+
r.unshift(l), o = c, d++;
|
|
331
331
|
}
|
|
332
332
|
return r.join(" > ");
|
|
333
333
|
}
|
|
@@ -365,70 +365,70 @@ function qe() {
|
|
|
365
365
|
function ze() {
|
|
366
366
|
return Z ? Date.now() - Z.timestamp > 1e4 ? (Z = null, null) : { ...Z } : null;
|
|
367
367
|
}
|
|
368
|
-
const
|
|
369
|
-
const t = ae
|
|
368
|
+
const ae = Pe(null), Ye = "https://api.kelet.ai", wt = () => {
|
|
369
|
+
const t = le(ae);
|
|
370
370
|
if (!t)
|
|
371
371
|
throw new Error("useKelet must be used within a KeletProvider");
|
|
372
372
|
return t;
|
|
373
|
-
},
|
|
374
|
-
const t = ae
|
|
373
|
+
}, Ke = () => {
|
|
374
|
+
const t = le(ae);
|
|
375
375
|
return t ? t.feedback : (console.warn(
|
|
376
376
|
"No FeedbackHandler found: defaultFeedbackHandler is not possible since there's no KeletProvider wrapping this call, and handler not provided"
|
|
377
377
|
), async () => {
|
|
378
378
|
});
|
|
379
|
-
},
|
|
379
|
+
}, Te = Ke, kt = ({ apiKey: t, project: e, baseUrl: n, children: r }) => {
|
|
380
380
|
ce(() => {
|
|
381
381
|
qe();
|
|
382
382
|
}, []);
|
|
383
|
-
const o = ae
|
|
384
|
-
if (!
|
|
383
|
+
const o = le(ae), d = t || o?.api_key;
|
|
384
|
+
if (!d)
|
|
385
385
|
throw new Error(
|
|
386
386
|
"apiKey is required either directly or from a parent KeletProvider"
|
|
387
387
|
);
|
|
388
|
-
let
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
api_key:
|
|
388
|
+
let f = n || Ye;
|
|
389
|
+
f.endsWith("/api") && (f = f.slice(0, -4)), f.endsWith("/") && (f = f.slice(0, -1));
|
|
390
|
+
const c = {
|
|
391
|
+
api_key: d,
|
|
392
392
|
project: e,
|
|
393
|
-
feedback: async (
|
|
394
|
-
const b = `${
|
|
395
|
-
...
|
|
396
|
-
...
|
|
397
|
-
},
|
|
398
|
-
session_id:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
metadata: Object.keys(
|
|
406
|
-
|
|
393
|
+
feedback: async (h) => {
|
|
394
|
+
const b = `${f}/api/projects/${e}/signal`, P = ze(), E = {
|
|
395
|
+
...h.metadata ?? {},
|
|
396
|
+
...P && { $dom_event: P }
|
|
397
|
+
}, x = {
|
|
398
|
+
session_id: h.session_id,
|
|
399
|
+
kind: h.kind,
|
|
400
|
+
source: h.source,
|
|
401
|
+
trigger_name: h.trigger_name,
|
|
402
|
+
score: h.score,
|
|
403
|
+
value: h.value,
|
|
404
|
+
confidence: h.confidence,
|
|
405
|
+
metadata: Object.keys(E).length > 0 ? E : void 0,
|
|
406
|
+
timestamp: h.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
|
|
407
|
+
trace_id: h.trace_id
|
|
408
|
+
}, p = await fetch(b, {
|
|
407
409
|
method: "POST",
|
|
408
410
|
headers: {
|
|
409
411
|
"Content-Type": "application/json",
|
|
410
|
-
Authorization: `Bearer ${
|
|
412
|
+
Authorization: `Bearer ${d}`
|
|
411
413
|
},
|
|
412
|
-
body: JSON.stringify(
|
|
414
|
+
body: JSON.stringify(x)
|
|
413
415
|
});
|
|
414
|
-
if (!
|
|
415
|
-
throw new Error(`Failed to submit feedback: ${
|
|
416
|
+
if (!p.ok)
|
|
417
|
+
throw new Error(`Failed to submit feedback: ${p.statusText}`);
|
|
416
418
|
}
|
|
417
419
|
};
|
|
418
|
-
return /* @__PURE__ */ F.jsx(
|
|
420
|
+
return /* @__PURE__ */ F.jsx(ae.Provider, { value: c, children: r });
|
|
419
421
|
}, te = (t, e) => {
|
|
420
422
|
const n = { ...e };
|
|
421
423
|
for (const r in e) {
|
|
422
|
-
const o = t[r],
|
|
423
|
-
/^on[A-Z]/.test(r) ? o &&
|
|
424
|
-
|
|
425
|
-
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...
|
|
424
|
+
const o = t[r], d = e[r];
|
|
425
|
+
/^on[A-Z]/.test(r) ? o && d ? n[r] = (...l) => {
|
|
426
|
+
d(...l), o(...l);
|
|
427
|
+
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...d } : r === "className" ? n[r] = [o, d].filter(Boolean).join(" ") : n[r] = d !== void 0 ? d : o;
|
|
426
428
|
}
|
|
427
429
|
return { ...t, ...n };
|
|
428
|
-
},
|
|
429
|
-
|
|
430
|
-
), ne = () => {
|
|
431
|
-
const t = ae(Ce);
|
|
430
|
+
}, _e = Pe(null), ne = () => {
|
|
431
|
+
const t = le(_e);
|
|
432
432
|
if (!t)
|
|
433
433
|
throw new Error(
|
|
434
434
|
"VoteFeedback components must be used within VoteFeedback.Root"
|
|
@@ -439,146 +439,158 @@ const le = xe(null), Ye = "https://api.kelet.ai", gt = () => {
|
|
|
439
439
|
onFeedback: e,
|
|
440
440
|
defaultText: n = "",
|
|
441
441
|
session_id: r,
|
|
442
|
-
|
|
443
|
-
trigger_name:
|
|
442
|
+
metadata: o,
|
|
443
|
+
trigger_name: d,
|
|
444
|
+
trace_id: f
|
|
444
445
|
}) => {
|
|
445
|
-
const
|
|
446
|
+
const l = typeof r == "function" ? r() : r, c = d || void 0, [h, b] = X(!1), [P, E] = X(n), [x, p] = X(!1), [k, O] = X(null), A = Y(null), m = Y(null), T = de(), R = de(), _ = Te(), N = e || _;
|
|
446
447
|
ce(() => {
|
|
447
|
-
|
|
448
|
-
}, [
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
const
|
|
452
|
-
session_id:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
448
|
+
b(!1), E(n), p(!1), O(null), setTimeout(() => m.current?.focus(), 0);
|
|
449
|
+
}, [l, n]);
|
|
450
|
+
const I = q(async () => {
|
|
451
|
+
O("upvote");
|
|
452
|
+
const g = {
|
|
453
|
+
session_id: l,
|
|
454
|
+
kind: "feedback",
|
|
455
|
+
source: "human",
|
|
456
|
+
trigger_name: c,
|
|
457
|
+
score: 1,
|
|
458
|
+
...o && { metadata: o },
|
|
459
|
+
...f && { trace_id: f }
|
|
456
460
|
};
|
|
457
461
|
try {
|
|
458
|
-
|
|
462
|
+
p(!0), await N(g);
|
|
459
463
|
} finally {
|
|
460
|
-
|
|
464
|
+
p(!1);
|
|
461
465
|
}
|
|
462
|
-
}, [
|
|
463
|
-
if (
|
|
464
|
-
const
|
|
465
|
-
session_id:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
}, [N, l, o, c, f]), i = q(async () => {
|
|
467
|
+
if (O("downvote"), N) {
|
|
468
|
+
const g = {
|
|
469
|
+
session_id: l,
|
|
470
|
+
kind: "feedback",
|
|
471
|
+
source: "human",
|
|
472
|
+
trigger_name: c,
|
|
473
|
+
score: 0,
|
|
474
|
+
...o && { metadata: o },
|
|
475
|
+
...f && { trace_id: f }
|
|
469
476
|
};
|
|
470
477
|
try {
|
|
471
|
-
|
|
478
|
+
p(!0), await N(g);
|
|
472
479
|
} finally {
|
|
473
|
-
|
|
480
|
+
p(!1);
|
|
474
481
|
}
|
|
475
482
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
|
|
483
|
+
b(!0), setTimeout(() => {
|
|
484
|
+
A.current?.focus();
|
|
485
|
+
const g = document.createElement("div");
|
|
486
|
+
g.setAttribute("aria-live", "polite"), g.setAttribute("aria-atomic", "true"), g.className = "sr-only", g.textContent = "Feedback dialog opened. You can provide additional details about your downvote.", document.body.appendChild(g), setTimeout(() => document.body.removeChild(g), 1e3);
|
|
480
487
|
}, 0);
|
|
481
|
-
}, [
|
|
482
|
-
(
|
|
483
|
-
|
|
488
|
+
}, [N, l, o, c, f]), u = q(
|
|
489
|
+
(g) => {
|
|
490
|
+
E(g.target.value);
|
|
484
491
|
},
|
|
485
492
|
[]
|
|
486
|
-
),
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
const
|
|
490
|
-
session_id:
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
), s = q(async () => {
|
|
494
|
+
const g = P.trim().length > 0;
|
|
495
|
+
if (g) {
|
|
496
|
+
const w = {
|
|
497
|
+
session_id: l,
|
|
498
|
+
kind: "feedback",
|
|
499
|
+
source: "human",
|
|
500
|
+
trigger_name: c,
|
|
501
|
+
score: 0,
|
|
502
|
+
value: P,
|
|
503
|
+
...o && { metadata: o },
|
|
504
|
+
...f && { trace_id: f }
|
|
495
505
|
};
|
|
496
506
|
try {
|
|
497
|
-
|
|
507
|
+
p(!0), await N(w);
|
|
498
508
|
} finally {
|
|
499
|
-
|
|
509
|
+
p(!1);
|
|
500
510
|
}
|
|
501
511
|
}
|
|
502
|
-
if (
|
|
503
|
-
const
|
|
504
|
-
|
|
512
|
+
if (b(!1), E(n), m.current?.focus(), g) {
|
|
513
|
+
const w = document.createElement("div");
|
|
514
|
+
w.setAttribute("aria-live", "polite"), w.className = "sr-only", w.textContent = "Feedback submitted successfully.", document.body.appendChild(w), setTimeout(() => document.body.removeChild(w), 1e3);
|
|
505
515
|
}
|
|
506
516
|
}, [
|
|
507
|
-
|
|
508
|
-
|
|
517
|
+
N,
|
|
518
|
+
P,
|
|
509
519
|
n,
|
|
510
|
-
|
|
520
|
+
l,
|
|
511
521
|
o,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
522
|
+
c,
|
|
523
|
+
f
|
|
524
|
+
]), v = q(
|
|
525
|
+
(g) => {
|
|
526
|
+
if (g.key === "Escape")
|
|
527
|
+
b(!1), E(n), m.current?.focus();
|
|
528
|
+
else if ((g.metaKey || g.ctrlKey) && g.key === "Enter")
|
|
529
|
+
g.preventDefault(), s().then((w) => {
|
|
519
530
|
});
|
|
520
|
-
else if (
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
const
|
|
531
|
+
else if (g.key === "Tab" && h) {
|
|
532
|
+
const w = document.getElementById(T);
|
|
533
|
+
if (w) {
|
|
534
|
+
const M = w.querySelectorAll(
|
|
524
535
|
'button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'
|
|
525
|
-
),
|
|
526
|
-
|
|
536
|
+
), j = M[0], K = M[M.length - 1];
|
|
537
|
+
g.shiftKey && document.activeElement === j ? (g.preventDefault(), K?.focus()) : !g.shiftKey && document.activeElement === K && (g.preventDefault(), j?.focus());
|
|
527
538
|
}
|
|
528
539
|
}
|
|
529
540
|
},
|
|
530
|
-
[
|
|
531
|
-
),
|
|
532
|
-
onFeedback:
|
|
533
|
-
showPopover:
|
|
534
|
-
setShowPopover:
|
|
535
|
-
feedbackText:
|
|
536
|
-
setFeedbackText:
|
|
537
|
-
isSubmitting:
|
|
538
|
-
setIsSubmitting:
|
|
541
|
+
[s, h, T, n]
|
|
542
|
+
), y = {
|
|
543
|
+
onFeedback: N,
|
|
544
|
+
showPopover: h,
|
|
545
|
+
setShowPopover: b,
|
|
546
|
+
feedbackText: P,
|
|
547
|
+
setFeedbackText: E,
|
|
548
|
+
isSubmitting: x,
|
|
549
|
+
setIsSubmitting: p,
|
|
539
550
|
vote: k,
|
|
540
|
-
handleUpvote:
|
|
541
|
-
handleDownvote:
|
|
542
|
-
handleTextareaChange:
|
|
543
|
-
handleSubmit:
|
|
544
|
-
handleKeyDown:
|
|
545
|
-
textareaRef:
|
|
546
|
-
triggerRef:
|
|
547
|
-
popoverId:
|
|
548
|
-
triggerId:
|
|
549
|
-
session_id:
|
|
550
|
-
|
|
551
|
-
trigger_name:
|
|
551
|
+
handleUpvote: I,
|
|
552
|
+
handleDownvote: i,
|
|
553
|
+
handleTextareaChange: u,
|
|
554
|
+
handleSubmit: s,
|
|
555
|
+
handleKeyDown: v,
|
|
556
|
+
textareaRef: A,
|
|
557
|
+
triggerRef: m,
|
|
558
|
+
popoverId: T,
|
|
559
|
+
triggerId: R,
|
|
560
|
+
session_id: l,
|
|
561
|
+
metadata: o,
|
|
562
|
+
trigger_name: c,
|
|
563
|
+
trace_id: f
|
|
552
564
|
};
|
|
553
|
-
return /* @__PURE__ */ F.jsx(
|
|
554
|
-
},
|
|
565
|
+
return /* @__PURE__ */ F.jsx(_e.Provider, { value: y, children: t });
|
|
566
|
+
}, Ue = ({
|
|
555
567
|
asChild: t,
|
|
556
568
|
children: e,
|
|
557
569
|
onClick: n,
|
|
558
570
|
...r
|
|
559
571
|
}) => {
|
|
560
|
-
const { handleUpvote: o, isSubmitting:
|
|
572
|
+
const { handleUpvote: o, isSubmitting: d, vote: f } = ne(), l = q(
|
|
561
573
|
(b) => {
|
|
562
574
|
o(), n?.(b);
|
|
563
575
|
},
|
|
564
576
|
[o, n]
|
|
565
|
-
),
|
|
577
|
+
), c = {
|
|
566
578
|
...r,
|
|
567
|
-
onClick:
|
|
568
|
-
disabled:
|
|
579
|
+
onClick: l,
|
|
580
|
+
disabled: d || r.disabled,
|
|
569
581
|
"aria-label": r["aria-label"] || "Upvote feedback",
|
|
570
582
|
type: "button"
|
|
571
|
-
},
|
|
583
|
+
}, h = f === "upvote";
|
|
572
584
|
if (t) {
|
|
573
|
-
const b = typeof e == "function" ? e({ isSelected:
|
|
585
|
+
const b = typeof e == "function" ? e({ isSelected: h }) : e;
|
|
574
586
|
if (Q(b))
|
|
575
587
|
return ee(
|
|
576
588
|
b,
|
|
577
|
-
te(
|
|
589
|
+
te(c, b.props)
|
|
578
590
|
);
|
|
579
591
|
}
|
|
580
|
-
return /* @__PURE__ */ F.jsx("button", { ...
|
|
581
|
-
},
|
|
592
|
+
return /* @__PURE__ */ F.jsx("button", { ...c, children: typeof e == "function" ? e({ isSelected: h }) : e });
|
|
593
|
+
}, Je = ({
|
|
582
594
|
asChild: t,
|
|
583
595
|
children: e,
|
|
584
596
|
onClick: n,
|
|
@@ -586,129 +598,129 @@ const le = xe(null), Ye = "https://api.kelet.ai", gt = () => {
|
|
|
586
598
|
}) => {
|
|
587
599
|
const {
|
|
588
600
|
handleDownvote: o,
|
|
589
|
-
showPopover:
|
|
590
|
-
isSubmitting:
|
|
591
|
-
popoverId:
|
|
592
|
-
triggerId:
|
|
593
|
-
triggerRef:
|
|
601
|
+
showPopover: d,
|
|
602
|
+
isSubmitting: f,
|
|
603
|
+
popoverId: l,
|
|
604
|
+
triggerId: c,
|
|
605
|
+
triggerRef: h,
|
|
594
606
|
vote: b
|
|
595
|
-
} = ne(),
|
|
596
|
-
(
|
|
597
|
-
o(), n?.(
|
|
607
|
+
} = ne(), P = q(
|
|
608
|
+
(p) => {
|
|
609
|
+
o(), n?.(p);
|
|
598
610
|
},
|
|
599
611
|
[o, n]
|
|
600
|
-
),
|
|
612
|
+
), E = {
|
|
601
613
|
...r,
|
|
602
|
-
ref:
|
|
603
|
-
onClick:
|
|
604
|
-
disabled:
|
|
614
|
+
ref: h,
|
|
615
|
+
onClick: P,
|
|
616
|
+
disabled: f || r.disabled,
|
|
605
617
|
"aria-label": r["aria-label"] || "Downvote feedback",
|
|
606
|
-
"aria-expanded":
|
|
607
|
-
"aria-controls":
|
|
608
|
-
id:
|
|
618
|
+
"aria-expanded": d,
|
|
619
|
+
"aria-controls": l,
|
|
620
|
+
id: c,
|
|
609
621
|
type: "button"
|
|
610
|
-
},
|
|
622
|
+
}, x = b === "downvote";
|
|
611
623
|
if (t) {
|
|
612
|
-
const
|
|
613
|
-
if (Q(
|
|
614
|
-
return ee(
|
|
615
|
-
if (
|
|
616
|
-
return
|
|
624
|
+
const p = typeof e == "function" ? e({ isSelected: x }) : e;
|
|
625
|
+
if (Q(p))
|
|
626
|
+
return ee(p, te(E, p.props));
|
|
627
|
+
if (p)
|
|
628
|
+
return p;
|
|
617
629
|
}
|
|
618
|
-
return /* @__PURE__ */ F.jsx("button", { ...
|
|
619
|
-
},
|
|
620
|
-
const { showPopover: r, handleKeyDown: o, popoverId:
|
|
630
|
+
return /* @__PURE__ */ F.jsx("button", { ...E, children: typeof e == "function" ? e({ isSelected: x }) : e });
|
|
631
|
+
}, Be = ({ asChild: t, children: e, ...n }) => {
|
|
632
|
+
const { showPopover: r, handleKeyDown: o, popoverId: d, triggerId: f } = ne();
|
|
621
633
|
if (!r)
|
|
622
634
|
return null;
|
|
623
|
-
const
|
|
635
|
+
const l = {
|
|
624
636
|
...n,
|
|
625
637
|
role: "dialog",
|
|
626
|
-
"aria-labelledby":
|
|
638
|
+
"aria-labelledby": f,
|
|
627
639
|
"aria-modal": !0,
|
|
628
|
-
"aria-describedby": `${
|
|
629
|
-
id:
|
|
640
|
+
"aria-describedby": `${d}-description`,
|
|
641
|
+
id: d,
|
|
630
642
|
onKeyDown: o,
|
|
631
643
|
tabIndex: -1
|
|
632
644
|
};
|
|
633
645
|
return t && Q(e) ? /* @__PURE__ */ F.jsxs(F.Fragment, { children: [
|
|
634
646
|
ee(
|
|
635
647
|
e,
|
|
636
|
-
te(
|
|
648
|
+
te(l, e.props)
|
|
637
649
|
),
|
|
638
|
-
/* @__PURE__ */ F.jsx("div", { id: `${
|
|
639
|
-
] }) : /* @__PURE__ */ F.jsxs("div", { ...
|
|
640
|
-
/* @__PURE__ */ F.jsx("div", { id: `${
|
|
650
|
+
/* @__PURE__ */ F.jsx("div", { id: `${d}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" })
|
|
651
|
+
] }) : /* @__PURE__ */ F.jsxs("div", { ...l, children: [
|
|
652
|
+
/* @__PURE__ */ F.jsx("div", { id: `${d}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" }),
|
|
641
653
|
e
|
|
642
654
|
] });
|
|
643
|
-
},
|
|
655
|
+
}, Ve = ({ asChild: t, value: e, onChange: n, ...r }) => {
|
|
644
656
|
const {
|
|
645
657
|
feedbackText: o,
|
|
646
|
-
handleTextareaChange:
|
|
647
|
-
textareaRef:
|
|
648
|
-
handleKeyDown:
|
|
649
|
-
popoverId:
|
|
650
|
-
} = ne(),
|
|
658
|
+
handleTextareaChange: d,
|
|
659
|
+
textareaRef: f,
|
|
660
|
+
handleKeyDown: l,
|
|
661
|
+
popoverId: c
|
|
662
|
+
} = ne(), h = {
|
|
651
663
|
...r,
|
|
652
|
-
ref:
|
|
664
|
+
ref: f,
|
|
653
665
|
value: e !== void 0 ? e : o,
|
|
654
|
-
onChange: n ||
|
|
655
|
-
onKeyDown:
|
|
666
|
+
onChange: n || d,
|
|
667
|
+
onKeyDown: l,
|
|
656
668
|
placeholder: r.placeholder || "What did we miss?",
|
|
657
669
|
"aria-label": r["aria-label"] || "Additional feedback",
|
|
658
|
-
"aria-describedby": `${
|
|
670
|
+
"aria-describedby": `${c}-help`,
|
|
659
671
|
rows: r.rows || 3
|
|
660
672
|
};
|
|
661
673
|
return t && Q(r.children) ? ee(
|
|
662
674
|
r.children,
|
|
663
|
-
te(
|
|
664
|
-
) : /* @__PURE__ */ F.jsx("textarea", { ...
|
|
665
|
-
},
|
|
675
|
+
te(h, r.children.props)
|
|
676
|
+
) : /* @__PURE__ */ F.jsx("textarea", { ...h });
|
|
677
|
+
}, Ge = ({
|
|
666
678
|
asChild: t,
|
|
667
679
|
children: e,
|
|
668
680
|
onClick: n,
|
|
669
681
|
...r
|
|
670
682
|
}) => {
|
|
671
|
-
const { handleSubmit: o, isSubmitting:
|
|
672
|
-
(
|
|
673
|
-
o(), n?.(
|
|
683
|
+
const { handleSubmit: o, isSubmitting: d, feedbackText: f } = ne(), l = q(
|
|
684
|
+
(P) => {
|
|
685
|
+
o(), n?.(P);
|
|
674
686
|
},
|
|
675
687
|
[o, n]
|
|
676
|
-
),
|
|
688
|
+
), c = f.trim().length > 0, h = c ? "Submit feedback" : "Close without feedback", b = {
|
|
677
689
|
...r,
|
|
678
|
-
onClick:
|
|
679
|
-
disabled:
|
|
690
|
+
onClick: l,
|
|
691
|
+
disabled: d || r.disabled,
|
|
680
692
|
type: "button",
|
|
681
|
-
"aria-label": r["aria-label"] ||
|
|
682
|
-
"aria-describedby":
|
|
693
|
+
"aria-label": r["aria-label"] || h,
|
|
694
|
+
"aria-describedby": c ? void 0 : "submit-help"
|
|
683
695
|
};
|
|
684
696
|
return t && Q(e) ? /* @__PURE__ */ F.jsxs(F.Fragment, { children: [
|
|
685
697
|
ee(
|
|
686
698
|
e,
|
|
687
699
|
te(b, e.props)
|
|
688
700
|
),
|
|
689
|
-
!
|
|
701
|
+
!c && /* @__PURE__ */ F.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
690
702
|
] }) : /* @__PURE__ */ F.jsxs("button", { ...b, children: [
|
|
691
703
|
e,
|
|
692
|
-
!
|
|
704
|
+
!c && /* @__PURE__ */ F.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
693
705
|
] });
|
|
694
706
|
}, Et = {
|
|
695
707
|
Root: He,
|
|
696
|
-
UpvoteButton:
|
|
697
|
-
DownvoteButton:
|
|
698
|
-
Popover:
|
|
699
|
-
Textarea:
|
|
700
|
-
SubmitButton:
|
|
708
|
+
UpvoteButton: Ue,
|
|
709
|
+
DownvoteButton: Je,
|
|
710
|
+
Popover: Be,
|
|
711
|
+
Textarea: Ve,
|
|
712
|
+
SubmitButton: Ge
|
|
701
713
|
};
|
|
702
714
|
var se = { exports: {} }, Xe = se.exports, ve;
|
|
703
|
-
function
|
|
715
|
+
function Ze() {
|
|
704
716
|
return ve || (ve = 1, function(t, e) {
|
|
705
717
|
(function(n, r) {
|
|
706
718
|
var o = r(n);
|
|
707
719
|
t.exports = o;
|
|
708
720
|
})(Xe, function(n) {
|
|
709
721
|
var r = ["N", "E", "A", "D"];
|
|
710
|
-
function o(i,
|
|
711
|
-
i.super_ =
|
|
722
|
+
function o(i, u) {
|
|
723
|
+
i.super_ = u, i.prototype = Object.create(u.prototype, {
|
|
712
724
|
constructor: {
|
|
713
725
|
value: i,
|
|
714
726
|
enumerable: !1,
|
|
@@ -717,281 +729,281 @@ function Ge() {
|
|
|
717
729
|
}
|
|
718
730
|
});
|
|
719
731
|
}
|
|
720
|
-
function
|
|
732
|
+
function d(i, u) {
|
|
721
733
|
Object.defineProperty(this, "kind", {
|
|
722
734
|
value: i,
|
|
723
735
|
enumerable: !0
|
|
724
|
-
}),
|
|
725
|
-
value:
|
|
736
|
+
}), u && u.length && Object.defineProperty(this, "path", {
|
|
737
|
+
value: u,
|
|
726
738
|
enumerable: !0
|
|
727
739
|
});
|
|
728
740
|
}
|
|
729
|
-
function
|
|
730
|
-
|
|
731
|
-
value:
|
|
741
|
+
function f(i, u, s) {
|
|
742
|
+
f.super_.call(this, "E", i), Object.defineProperty(this, "lhs", {
|
|
743
|
+
value: u,
|
|
732
744
|
enumerable: !0
|
|
733
745
|
}), Object.defineProperty(this, "rhs", {
|
|
734
746
|
value: s,
|
|
735
747
|
enumerable: !0
|
|
736
748
|
});
|
|
737
749
|
}
|
|
738
|
-
o(
|
|
739
|
-
function
|
|
740
|
-
|
|
741
|
-
value:
|
|
750
|
+
o(f, d);
|
|
751
|
+
function l(i, u) {
|
|
752
|
+
l.super_.call(this, "N", i), Object.defineProperty(this, "rhs", {
|
|
753
|
+
value: u,
|
|
742
754
|
enumerable: !0
|
|
743
755
|
});
|
|
744
756
|
}
|
|
745
|
-
o(
|
|
746
|
-
function
|
|
747
|
-
|
|
748
|
-
value:
|
|
757
|
+
o(l, d);
|
|
758
|
+
function c(i, u) {
|
|
759
|
+
c.super_.call(this, "D", i), Object.defineProperty(this, "lhs", {
|
|
760
|
+
value: u,
|
|
749
761
|
enumerable: !0
|
|
750
762
|
});
|
|
751
763
|
}
|
|
752
|
-
o(
|
|
753
|
-
function
|
|
754
|
-
|
|
755
|
-
value:
|
|
764
|
+
o(c, d);
|
|
765
|
+
function h(i, u, s) {
|
|
766
|
+
h.super_.call(this, "A", i), Object.defineProperty(this, "index", {
|
|
767
|
+
value: u,
|
|
756
768
|
enumerable: !0
|
|
757
769
|
}), Object.defineProperty(this, "item", {
|
|
758
770
|
value: s,
|
|
759
771
|
enumerable: !0
|
|
760
772
|
});
|
|
761
773
|
}
|
|
762
|
-
o(
|
|
763
|
-
function b(i,
|
|
764
|
-
var
|
|
765
|
-
return i.length =
|
|
774
|
+
o(h, d);
|
|
775
|
+
function b(i, u, s) {
|
|
776
|
+
var v = i.slice(u + 1 || i.length);
|
|
777
|
+
return i.length = u < 0 ? i.length + u : u, i.push.apply(i, v), i;
|
|
766
778
|
}
|
|
767
|
-
function
|
|
768
|
-
var
|
|
769
|
-
return
|
|
779
|
+
function P(i) {
|
|
780
|
+
var u = typeof i;
|
|
781
|
+
return u !== "object" ? u : 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";
|
|
770
782
|
}
|
|
771
|
-
function
|
|
772
|
-
var
|
|
783
|
+
function E(i) {
|
|
784
|
+
var u = 0;
|
|
773
785
|
if (i.length === 0)
|
|
774
|
-
return
|
|
786
|
+
return u;
|
|
775
787
|
for (var s = 0; s < i.length; s++) {
|
|
776
|
-
var
|
|
777
|
-
|
|
788
|
+
var v = i.charCodeAt(s);
|
|
789
|
+
u = (u << 5) - u + v, u = u & u;
|
|
778
790
|
}
|
|
779
|
-
return
|
|
791
|
+
return u;
|
|
780
792
|
}
|
|
781
|
-
function
|
|
782
|
-
var
|
|
793
|
+
function x(i) {
|
|
794
|
+
var u = 0, s = P(i);
|
|
783
795
|
if (s === "array") {
|
|
784
796
|
i.forEach(function(M) {
|
|
785
|
-
|
|
797
|
+
u += x(M);
|
|
786
798
|
});
|
|
787
|
-
var
|
|
788
|
-
return
|
|
799
|
+
var v = "[type: array, hash: " + u + "]";
|
|
800
|
+
return u + E(v);
|
|
789
801
|
}
|
|
790
802
|
if (s === "object") {
|
|
791
803
|
for (var y in i)
|
|
792
804
|
if (i.hasOwnProperty(y)) {
|
|
793
|
-
var
|
|
794
|
-
|
|
805
|
+
var g = "[ type: object, key: " + y + ", value hash: " + x(i[y]) + "]";
|
|
806
|
+
u += E(g);
|
|
795
807
|
}
|
|
796
|
-
return
|
|
808
|
+
return u;
|
|
797
809
|
}
|
|
798
|
-
var
|
|
799
|
-
return
|
|
810
|
+
var w = "[ type: " + s + " ; value: " + i + "]";
|
|
811
|
+
return u + E(w);
|
|
800
812
|
}
|
|
801
|
-
function
|
|
802
|
-
s = s || [], y = y || [],
|
|
803
|
-
var
|
|
804
|
-
if (typeof
|
|
805
|
-
if (
|
|
806
|
-
if (typeof
|
|
813
|
+
function p(i, u, s, v, y, g, w, M) {
|
|
814
|
+
s = s || [], y = y || [], w = w || [];
|
|
815
|
+
var j = y.slice(0);
|
|
816
|
+
if (typeof g < "u" && g !== null) {
|
|
817
|
+
if (v) {
|
|
818
|
+
if (typeof v == "function" && v(j, g))
|
|
807
819
|
return;
|
|
808
|
-
if (typeof
|
|
809
|
-
if (
|
|
820
|
+
if (typeof v == "object") {
|
|
821
|
+
if (v.prefilter && v.prefilter(j, g))
|
|
810
822
|
return;
|
|
811
|
-
if (
|
|
812
|
-
var
|
|
813
|
-
|
|
823
|
+
if (v.normalize) {
|
|
824
|
+
var K = v.normalize(j, g, i, u);
|
|
825
|
+
K && (i = K[0], u = K[1]);
|
|
814
826
|
}
|
|
815
827
|
}
|
|
816
828
|
}
|
|
817
|
-
|
|
829
|
+
j.push(g);
|
|
818
830
|
}
|
|
819
|
-
|
|
820
|
-
var J = typeof i, re = typeof
|
|
831
|
+
P(i) === "regexp" && P(u) === "regexp" && (i = i.toString(), u = u.toString());
|
|
832
|
+
var J = typeof i, re = typeof u, a, C, D, S, W = J !== "undefined" || w && w.length > 0 && w[w.length - 1].lhs && Object.getOwnPropertyDescriptor(w[w.length - 1].lhs, g), $ = re !== "undefined" || w && w.length > 0 && w[w.length - 1].rhs && Object.getOwnPropertyDescriptor(w[w.length - 1].rhs, g);
|
|
821
833
|
if (!W && $)
|
|
822
|
-
s.push(new
|
|
834
|
+
s.push(new l(j, u));
|
|
823
835
|
else if (!$ && W)
|
|
824
|
-
s.push(new
|
|
825
|
-
else if (
|
|
826
|
-
s.push(new
|
|
827
|
-
else if (
|
|
828
|
-
s.push(new
|
|
829
|
-
else if (J === "object" && i !== null &&
|
|
830
|
-
for (
|
|
831
|
-
if (
|
|
832
|
-
|
|
836
|
+
s.push(new c(j, i));
|
|
837
|
+
else if (P(i) !== P(u))
|
|
838
|
+
s.push(new f(j, i, u));
|
|
839
|
+
else if (P(i) === "date" && i - u !== 0)
|
|
840
|
+
s.push(new f(j, i, u));
|
|
841
|
+
else if (J === "object" && i !== null && u !== null) {
|
|
842
|
+
for (a = w.length - 1; a > -1; --a)
|
|
843
|
+
if (w[a].lhs === i) {
|
|
844
|
+
S = !0;
|
|
833
845
|
break;
|
|
834
846
|
}
|
|
835
|
-
if (
|
|
836
|
-
i !==
|
|
847
|
+
if (S)
|
|
848
|
+
i !== u && s.push(new f(j, i, u));
|
|
837
849
|
else {
|
|
838
|
-
if (
|
|
839
|
-
for (M && (i.sort(function(
|
|
840
|
-
return
|
|
841
|
-
}),
|
|
842
|
-
return
|
|
843
|
-
})),
|
|
844
|
-
s.push(new
|
|
845
|
-
for (;
|
|
846
|
-
s.push(new
|
|
847
|
-
for (;
|
|
848
|
-
|
|
850
|
+
if (w.push({ lhs: i, rhs: u }), Array.isArray(i)) {
|
|
851
|
+
for (M && (i.sort(function(L, z) {
|
|
852
|
+
return x(L) - x(z);
|
|
853
|
+
}), u.sort(function(L, z) {
|
|
854
|
+
return x(L) - x(z);
|
|
855
|
+
})), a = u.length - 1, C = i.length - 1; a > C; )
|
|
856
|
+
s.push(new h(j, a, new l(void 0, u[a--])));
|
|
857
|
+
for (; C > a; )
|
|
858
|
+
s.push(new h(j, C, new c(void 0, i[C--])));
|
|
859
|
+
for (; a >= 0; --a)
|
|
860
|
+
p(i[a], u[a], s, v, j, a, w, M);
|
|
849
861
|
} else {
|
|
850
|
-
var B = Object.keys(i),
|
|
851
|
-
for (
|
|
852
|
-
|
|
853
|
-
for (
|
|
854
|
-
|
|
862
|
+
var B = Object.keys(i), U = Object.keys(u);
|
|
863
|
+
for (a = 0; a < B.length; ++a)
|
|
864
|
+
D = B[a], S = U.indexOf(D), S >= 0 ? (p(i[D], u[D], s, v, j, D, w, M), U[S] = null) : p(i[D], void 0, s, v, j, D, w, M);
|
|
865
|
+
for (a = 0; a < U.length; ++a)
|
|
866
|
+
D = U[a], D && p(void 0, u[D], s, v, j, D, w, M);
|
|
855
867
|
}
|
|
856
|
-
|
|
868
|
+
w.length = w.length - 1;
|
|
857
869
|
}
|
|
858
|
-
} else i !==
|
|
870
|
+
} else i !== u && (J === "number" && isNaN(i) && isNaN(u) || s.push(new f(j, i, u)));
|
|
859
871
|
}
|
|
860
|
-
function
|
|
861
|
-
var
|
|
862
|
-
if (
|
|
863
|
-
for (var
|
|
864
|
-
s(
|
|
865
|
-
return
|
|
872
|
+
function k(i, u, s, v, y) {
|
|
873
|
+
var g = [];
|
|
874
|
+
if (p(i, u, g, v, null, null, null, y), s)
|
|
875
|
+
for (var w = 0; w < g.length; ++w)
|
|
876
|
+
s(g[w]);
|
|
877
|
+
return g;
|
|
866
878
|
}
|
|
867
|
-
function
|
|
868
|
-
return
|
|
879
|
+
function O(i, u, s, v, y, g, w) {
|
|
880
|
+
return p(i, u, s, v, y, g, w, !0);
|
|
869
881
|
}
|
|
870
|
-
function A(i,
|
|
871
|
-
var y =
|
|
872
|
-
|
|
873
|
-
} : void 0,
|
|
874
|
-
return
|
|
882
|
+
function A(i, u, s, v) {
|
|
883
|
+
var y = v ? function(w) {
|
|
884
|
+
w && v.push(w);
|
|
885
|
+
} : void 0, g = k(i, u, y, s);
|
|
886
|
+
return v || (g.length ? g : void 0);
|
|
875
887
|
}
|
|
876
|
-
function
|
|
877
|
-
var y =
|
|
878
|
-
|
|
879
|
-
} : void 0,
|
|
880
|
-
return
|
|
888
|
+
function m(i, u, s, v) {
|
|
889
|
+
var y = v ? function(w) {
|
|
890
|
+
w && v.push(w);
|
|
891
|
+
} : void 0, g = k(i, u, y, s, !0);
|
|
892
|
+
return v || (g.length ? g : void 0);
|
|
881
893
|
}
|
|
882
|
-
function
|
|
894
|
+
function T(i, u, s) {
|
|
883
895
|
if (s.path && s.path.length) {
|
|
884
|
-
var
|
|
885
|
-
for (y = 0; y <
|
|
886
|
-
|
|
896
|
+
var v = i[u], y, g = s.path.length - 1;
|
|
897
|
+
for (y = 0; y < g; y++)
|
|
898
|
+
v = v[s.path[y]];
|
|
887
899
|
switch (s.kind) {
|
|
888
900
|
case "A":
|
|
889
|
-
|
|
901
|
+
T(v[s.path[y]], s.index, s.item);
|
|
890
902
|
break;
|
|
891
903
|
case "D":
|
|
892
|
-
delete
|
|
904
|
+
delete v[s.path[y]];
|
|
893
905
|
break;
|
|
894
906
|
case "E":
|
|
895
907
|
case "N":
|
|
896
|
-
|
|
908
|
+
v[s.path[y]] = s.rhs;
|
|
897
909
|
break;
|
|
898
910
|
}
|
|
899
911
|
} else
|
|
900
912
|
switch (s.kind) {
|
|
901
913
|
case "A":
|
|
902
|
-
|
|
914
|
+
T(i[u], s.index, s.item);
|
|
903
915
|
break;
|
|
904
916
|
case "D":
|
|
905
|
-
i = b(i,
|
|
917
|
+
i = b(i, u);
|
|
906
918
|
break;
|
|
907
919
|
case "E":
|
|
908
920
|
case "N":
|
|
909
|
-
i[
|
|
921
|
+
i[u] = s.rhs;
|
|
910
922
|
break;
|
|
911
923
|
}
|
|
912
924
|
return i;
|
|
913
925
|
}
|
|
914
|
-
function
|
|
915
|
-
if (typeof s > "u" &&
|
|
916
|
-
for (var
|
|
917
|
-
typeof
|
|
926
|
+
function R(i, u, s) {
|
|
927
|
+
if (typeof s > "u" && u && ~r.indexOf(u.kind) && (s = u), i && s && s.kind) {
|
|
928
|
+
for (var v = i, y = -1, g = s.path ? s.path.length - 1 : 0; ++y < g; )
|
|
929
|
+
typeof v[s.path[y]] > "u" && (v[s.path[y]] = typeof s.path[y + 1] < "u" && typeof s.path[y + 1] == "number" ? [] : {}), v = v[s.path[y]];
|
|
918
930
|
switch (s.kind) {
|
|
919
931
|
case "A":
|
|
920
|
-
s.path && typeof
|
|
932
|
+
s.path && typeof v[s.path[y]] > "u" && (v[s.path[y]] = []), T(s.path ? v[s.path[y]] : v, s.index, s.item);
|
|
921
933
|
break;
|
|
922
934
|
case "D":
|
|
923
|
-
delete
|
|
935
|
+
delete v[s.path[y]];
|
|
924
936
|
break;
|
|
925
937
|
case "E":
|
|
926
938
|
case "N":
|
|
927
|
-
|
|
939
|
+
v[s.path[y]] = s.rhs;
|
|
928
940
|
break;
|
|
929
941
|
}
|
|
930
942
|
}
|
|
931
943
|
}
|
|
932
|
-
function
|
|
944
|
+
function _(i, u, s) {
|
|
933
945
|
if (s.path && s.path.length) {
|
|
934
|
-
var
|
|
935
|
-
for (y = 0; y <
|
|
936
|
-
|
|
946
|
+
var v = i[u], y, g = s.path.length - 1;
|
|
947
|
+
for (y = 0; y < g; y++)
|
|
948
|
+
v = v[s.path[y]];
|
|
937
949
|
switch (s.kind) {
|
|
938
950
|
case "A":
|
|
939
|
-
|
|
951
|
+
_(v[s.path[y]], s.index, s.item);
|
|
940
952
|
break;
|
|
941
953
|
case "D":
|
|
942
|
-
|
|
954
|
+
v[s.path[y]] = s.lhs;
|
|
943
955
|
break;
|
|
944
956
|
case "E":
|
|
945
|
-
|
|
957
|
+
v[s.path[y]] = s.lhs;
|
|
946
958
|
break;
|
|
947
959
|
case "N":
|
|
948
|
-
delete
|
|
960
|
+
delete v[s.path[y]];
|
|
949
961
|
break;
|
|
950
962
|
}
|
|
951
963
|
} else
|
|
952
964
|
switch (s.kind) {
|
|
953
965
|
case "A":
|
|
954
|
-
|
|
966
|
+
_(i[u], s.index, s.item);
|
|
955
967
|
break;
|
|
956
968
|
case "D":
|
|
957
|
-
i[
|
|
969
|
+
i[u] = s.lhs;
|
|
958
970
|
break;
|
|
959
971
|
case "E":
|
|
960
|
-
i[
|
|
972
|
+
i[u] = s.lhs;
|
|
961
973
|
break;
|
|
962
974
|
case "N":
|
|
963
|
-
i = b(i,
|
|
975
|
+
i = b(i, u);
|
|
964
976
|
break;
|
|
965
977
|
}
|
|
966
978
|
return i;
|
|
967
979
|
}
|
|
968
|
-
function
|
|
969
|
-
if (i &&
|
|
970
|
-
var
|
|
971
|
-
for (
|
|
972
|
-
typeof
|
|
980
|
+
function N(i, u, s) {
|
|
981
|
+
if (i && u && s && s.kind) {
|
|
982
|
+
var v = i, y, g;
|
|
983
|
+
for (g = s.path.length - 1, y = 0; y < g; y++)
|
|
984
|
+
typeof v[s.path[y]] > "u" && (v[s.path[y]] = {}), v = v[s.path[y]];
|
|
973
985
|
switch (s.kind) {
|
|
974
986
|
case "A":
|
|
975
|
-
|
|
987
|
+
_(v[s.path[y]], s.index, s.item);
|
|
976
988
|
break;
|
|
977
989
|
case "D":
|
|
978
|
-
|
|
990
|
+
v[s.path[y]] = s.lhs;
|
|
979
991
|
break;
|
|
980
992
|
case "E":
|
|
981
|
-
|
|
993
|
+
v[s.path[y]] = s.lhs;
|
|
982
994
|
break;
|
|
983
995
|
case "N":
|
|
984
|
-
delete
|
|
996
|
+
delete v[s.path[y]];
|
|
985
997
|
break;
|
|
986
998
|
}
|
|
987
999
|
}
|
|
988
1000
|
}
|
|
989
|
-
function
|
|
990
|
-
if (i &&
|
|
991
|
-
var
|
|
992
|
-
(!s || s(i,
|
|
1001
|
+
function I(i, u, s) {
|
|
1002
|
+
if (i && u) {
|
|
1003
|
+
var v = function(y) {
|
|
1004
|
+
(!s || s(i, u, y)) && R(i, u, y);
|
|
993
1005
|
};
|
|
994
|
-
|
|
1006
|
+
k(i, u, v);
|
|
995
1007
|
}
|
|
996
1008
|
}
|
|
997
1009
|
return Object.defineProperties(A, {
|
|
@@ -1000,31 +1012,31 @@ function Ge() {
|
|
|
1000
1012
|
enumerable: !0
|
|
1001
1013
|
},
|
|
1002
1014
|
orderIndependentDiff: {
|
|
1003
|
-
value:
|
|
1015
|
+
value: m,
|
|
1004
1016
|
enumerable: !0
|
|
1005
1017
|
},
|
|
1006
1018
|
observableDiff: {
|
|
1007
|
-
value:
|
|
1019
|
+
value: k,
|
|
1008
1020
|
enumerable: !0
|
|
1009
1021
|
},
|
|
1010
1022
|
orderIndependentObservableDiff: {
|
|
1011
|
-
value:
|
|
1023
|
+
value: O,
|
|
1012
1024
|
enumerable: !0
|
|
1013
1025
|
},
|
|
1014
1026
|
orderIndepHash: {
|
|
1015
|
-
value:
|
|
1027
|
+
value: x,
|
|
1016
1028
|
enumerable: !0
|
|
1017
1029
|
},
|
|
1018
1030
|
applyDiff: {
|
|
1019
|
-
value:
|
|
1031
|
+
value: I,
|
|
1020
1032
|
enumerable: !0
|
|
1021
1033
|
},
|
|
1022
1034
|
applyChange: {
|
|
1023
|
-
value:
|
|
1035
|
+
value: R,
|
|
1024
1036
|
enumerable: !0
|
|
1025
1037
|
},
|
|
1026
1038
|
revertChange: {
|
|
1027
|
-
value:
|
|
1039
|
+
value: N,
|
|
1028
1040
|
enumerable: !0
|
|
1029
1041
|
},
|
|
1030
1042
|
isConflict: {
|
|
@@ -1037,193 +1049,84 @@ function Ge() {
|
|
|
1037
1049
|
});
|
|
1038
1050
|
}(se)), se.exports;
|
|
1039
1051
|
}
|
|
1040
|
-
var
|
|
1041
|
-
|
|
1042
|
-
const n = t.length, r = e.length, o = 1 << n - 1;
|
|
1043
|
-
let u = -1, c = 0, f = n, d = n;
|
|
1044
|
-
for (; d--; )
|
|
1045
|
-
H[t.charCodeAt(d)] |= 1 << d;
|
|
1046
|
-
for (d = 0; d < r; d++) {
|
|
1047
|
-
let m = H[e.charCodeAt(d)];
|
|
1048
|
-
const b = m | c;
|
|
1049
|
-
m |= (m & u) + u ^ u, c |= ~(m | u), u &= m, c & o && f++, u & o && f--, c = c << 1 | 1, u = u << 1 | ~(b | c), c &= b;
|
|
1050
|
-
}
|
|
1051
|
-
for (d = n; d--; )
|
|
1052
|
-
H[t.charCodeAt(d)] = 0;
|
|
1053
|
-
return f;
|
|
1054
|
-
}, Qe = (t, e) => {
|
|
1055
|
-
const n = e.length, r = t.length, o = [], u = [], c = Math.ceil(n / 32), f = Math.ceil(r / 32);
|
|
1056
|
-
for (let h = 0; h < c; h++)
|
|
1057
|
-
u[h] = -1, o[h] = 0;
|
|
1058
|
-
let d = 0;
|
|
1059
|
-
for (; d < f - 1; d++) {
|
|
1060
|
-
let h = 0, g = -1;
|
|
1061
|
-
const C = d * 32, A = Math.min(32, r) + C;
|
|
1062
|
-
for (let v = C; v < A; v++)
|
|
1063
|
-
H[t.charCodeAt(v)] |= 1 << v;
|
|
1064
|
-
for (let v = 0; v < n; v++) {
|
|
1065
|
-
const R = H[e.charCodeAt(v)], E = u[v / 32 | 0] >>> v & 1, P = o[v / 32 | 0] >>> v & 1, j = R | h, S = ((R | P) & g) + g ^ g | R | P;
|
|
1066
|
-
let i = h | ~(S | g), a = g & S;
|
|
1067
|
-
i >>> 31 ^ E && (u[v / 32 | 0] ^= 1 << v), a >>> 31 ^ P && (o[v / 32 | 0] ^= 1 << v), i = i << 1 | E, a = a << 1 | P, g = a | ~(j | i), h = i & j;
|
|
1068
|
-
}
|
|
1069
|
-
for (let v = C; v < A; v++)
|
|
1070
|
-
H[t.charCodeAt(v)] = 0;
|
|
1071
|
-
}
|
|
1072
|
-
let m = 0, b = -1;
|
|
1073
|
-
const O = d * 32, w = Math.min(32, r - O) + O;
|
|
1074
|
-
for (let h = O; h < w; h++)
|
|
1075
|
-
H[t.charCodeAt(h)] |= 1 << h;
|
|
1076
|
-
let k = r;
|
|
1077
|
-
for (let h = 0; h < n; h++) {
|
|
1078
|
-
const g = H[e.charCodeAt(h)], C = u[h / 32 | 0] >>> h & 1, A = o[h / 32 | 0] >>> h & 1, v = g | m, R = ((g | A) & b) + b ^ b | g | A;
|
|
1079
|
-
let E = m | ~(R | b), P = b & R;
|
|
1080
|
-
k += E >>> r - 1 & 1, k -= P >>> r - 1 & 1, E >>> 31 ^ C && (u[h / 32 | 0] ^= 1 << h), P >>> 31 ^ A && (o[h / 32 | 0] ^= 1 << h), E = E << 1 | C, P = P << 1 | A, b = P | ~(v | E), m = E & v;
|
|
1081
|
-
}
|
|
1082
|
-
for (let h = O; h < w; h++)
|
|
1083
|
-
H[t.charCodeAt(h)] = 0;
|
|
1084
|
-
return k;
|
|
1085
|
-
}, Re = (t, e) => {
|
|
1086
|
-
if (t.length < e.length) {
|
|
1087
|
-
const n = e;
|
|
1088
|
-
e = t, t = n;
|
|
1089
|
-
}
|
|
1090
|
-
return e.length === 0 ? t.length : t.length <= 32 ? Ze(t, e) : Qe(t, e);
|
|
1091
|
-
}, et = (t, e) => {
|
|
1092
|
-
let n = 1 / 0, r = 0;
|
|
1093
|
-
for (let o = 0; o < e.length; o++) {
|
|
1094
|
-
const u = Re(t, e[o]);
|
|
1095
|
-
u < n && (n = u, r = o);
|
|
1096
|
-
}
|
|
1097
|
-
return e[r];
|
|
1098
|
-
}, tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1099
|
-
__proto__: null,
|
|
1100
|
-
closest: et,
|
|
1101
|
-
distance: Re
|
|
1102
|
-
}, Symbol.toStringTag, { value: "Module" })), nt = /* @__PURE__ */ Se(tt);
|
|
1103
|
-
var ye;
|
|
1104
|
-
function rt() {
|
|
1105
|
-
return ye || (ye = 1, function(t, e) {
|
|
1106
|
-
(function() {
|
|
1107
|
-
var n;
|
|
1108
|
-
try {
|
|
1109
|
-
n = typeof Intl < "u" && typeof Intl.Collator < "u" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
1110
|
-
} catch {
|
|
1111
|
-
console.log("Collator could not be initialized and wouldn't be used");
|
|
1112
|
-
}
|
|
1113
|
-
var r = nt, o = [], u = [], c = {
|
|
1114
|
-
/**
|
|
1115
|
-
* Calculate levenshtein distance of the two strings.
|
|
1116
|
-
*
|
|
1117
|
-
* @param str1 String the first string.
|
|
1118
|
-
* @param str2 String the second string.
|
|
1119
|
-
* @param [options] Additional options.
|
|
1120
|
-
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
1121
|
-
* @return Integer the levenshtein distance (0 and above).
|
|
1122
|
-
*/
|
|
1123
|
-
get: function(f, d, m) {
|
|
1124
|
-
var b = m && n && m.useCollator;
|
|
1125
|
-
if (b) {
|
|
1126
|
-
var O = f.length, w = d.length;
|
|
1127
|
-
if (O === 0) return w;
|
|
1128
|
-
if (w === 0) return O;
|
|
1129
|
-
var k, h, g, C, A;
|
|
1130
|
-
for (g = 0; g < w; ++g)
|
|
1131
|
-
o[g] = g, u[g] = d.charCodeAt(g);
|
|
1132
|
-
o[w] = w;
|
|
1133
|
-
var v;
|
|
1134
|
-
for (g = 0; g < O; ++g) {
|
|
1135
|
-
for (h = g + 1, C = 0; C < w; ++C)
|
|
1136
|
-
k = h, v = n.compare(f.charAt(g), String.fromCharCode(u[C])) === 0, h = o[C] + (v ? 0 : 1), A = k + 1, h > A && (h = A), A = o[C + 1] + 1, h > A && (h = A), o[C] = k;
|
|
1137
|
-
o[C] = h;
|
|
1138
|
-
}
|
|
1139
|
-
return h;
|
|
1140
|
-
}
|
|
1141
|
-
return r.distance(f, d);
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1144
|
-
t !== null && t.exports === e ? t.exports = c : typeof self < "u" && typeof self.postMessage == "function" && typeof self.importScripts == "function" ? self.Levenshtein = c : typeof window < "u" && window !== null && (window.Levenshtein = c);
|
|
1145
|
-
})();
|
|
1146
|
-
}(ie, ie.exports)), ie.exports;
|
|
1147
|
-
}
|
|
1148
|
-
var ot = rt();
|
|
1149
|
-
const it = /* @__PURE__ */ je(ot);
|
|
1150
|
-
class st {
|
|
1052
|
+
var Ce = Ze();
|
|
1053
|
+
class Qe {
|
|
1151
1054
|
diff(e, n, r = {}) {
|
|
1152
1055
|
let o;
|
|
1153
1056
|
typeof r == "function" ? (o = r, r = {}) : "callback" in r && (o = r.callback);
|
|
1154
|
-
const
|
|
1155
|
-
return this.diffWithOptionsObj(
|
|
1057
|
+
const d = this.castInput(e, r), f = this.castInput(n, r), l = this.removeEmpty(this.tokenize(d, r)), c = this.removeEmpty(this.tokenize(f, r));
|
|
1058
|
+
return this.diffWithOptionsObj(l, c, r, o);
|
|
1156
1059
|
}
|
|
1157
1060
|
diffWithOptionsObj(e, n, r, o) {
|
|
1158
|
-
var
|
|
1159
|
-
const
|
|
1160
|
-
if (
|
|
1061
|
+
var d;
|
|
1062
|
+
const f = (m) => {
|
|
1063
|
+
if (m = this.postProcess(m, r), o) {
|
|
1161
1064
|
setTimeout(function() {
|
|
1162
|
-
o(
|
|
1065
|
+
o(m);
|
|
1163
1066
|
}, 0);
|
|
1164
1067
|
return;
|
|
1165
1068
|
} else
|
|
1166
|
-
return
|
|
1167
|
-
},
|
|
1168
|
-
let
|
|
1069
|
+
return m;
|
|
1070
|
+
}, l = n.length, c = e.length;
|
|
1071
|
+
let h = 1, b = l + c;
|
|
1169
1072
|
r.maxEditLength != null && (b = Math.min(b, r.maxEditLength));
|
|
1170
|
-
const
|
|
1171
|
-
let
|
|
1172
|
-
if (
|
|
1173
|
-
return
|
|
1174
|
-
let
|
|
1073
|
+
const P = (d = r.timeout) !== null && d !== void 0 ? d : 1 / 0, E = Date.now() + P, x = [{ oldPos: -1, lastComponent: void 0 }];
|
|
1074
|
+
let p = this.extractCommon(x[0], n, e, 0, r);
|
|
1075
|
+
if (x[0].oldPos + 1 >= c && p + 1 >= l)
|
|
1076
|
+
return f(this.buildValues(x[0].lastComponent, n, e));
|
|
1077
|
+
let k = -1 / 0, O = 1 / 0;
|
|
1175
1078
|
const A = () => {
|
|
1176
|
-
for (let
|
|
1177
|
-
let
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
let
|
|
1181
|
-
if (
|
|
1182
|
-
const i =
|
|
1183
|
-
|
|
1079
|
+
for (let m = Math.max(k, -h); m <= Math.min(O, h); m += 2) {
|
|
1080
|
+
let T;
|
|
1081
|
+
const R = x[m - 1], _ = x[m + 1];
|
|
1082
|
+
R && (x[m - 1] = void 0);
|
|
1083
|
+
let N = !1;
|
|
1084
|
+
if (_) {
|
|
1085
|
+
const i = _.oldPos - m;
|
|
1086
|
+
N = _ && 0 <= i && i < l;
|
|
1184
1087
|
}
|
|
1185
|
-
const
|
|
1186
|
-
if (!
|
|
1187
|
-
|
|
1088
|
+
const I = R && R.oldPos + 1 < c;
|
|
1089
|
+
if (!N && !I) {
|
|
1090
|
+
x[m] = void 0;
|
|
1188
1091
|
continue;
|
|
1189
1092
|
}
|
|
1190
|
-
if (!
|
|
1191
|
-
return
|
|
1192
|
-
|
|
1093
|
+
if (!I || N && R.oldPos < _.oldPos ? T = this.addToPath(_, !0, !1, 0, r) : T = this.addToPath(R, !1, !0, 1, r), p = this.extractCommon(T, n, e, m, r), T.oldPos + 1 >= c && p + 1 >= l)
|
|
1094
|
+
return f(this.buildValues(T.lastComponent, n, e)) || !0;
|
|
1095
|
+
x[m] = T, T.oldPos + 1 >= c && (O = Math.min(O, m - 1)), p + 1 >= l && (k = Math.max(k, m + 1));
|
|
1193
1096
|
}
|
|
1194
|
-
|
|
1097
|
+
h++;
|
|
1195
1098
|
};
|
|
1196
1099
|
if (o)
|
|
1197
|
-
(function
|
|
1100
|
+
(function m() {
|
|
1198
1101
|
setTimeout(function() {
|
|
1199
|
-
if (
|
|
1102
|
+
if (h > b || Date.now() > E)
|
|
1200
1103
|
return o(void 0);
|
|
1201
|
-
A() ||
|
|
1104
|
+
A() || m();
|
|
1202
1105
|
}, 0);
|
|
1203
1106
|
})();
|
|
1204
1107
|
else
|
|
1205
|
-
for (;
|
|
1206
|
-
const
|
|
1207
|
-
if (
|
|
1208
|
-
return
|
|
1108
|
+
for (; h <= b && Date.now() <= E; ) {
|
|
1109
|
+
const m = A();
|
|
1110
|
+
if (m)
|
|
1111
|
+
return m;
|
|
1209
1112
|
}
|
|
1210
1113
|
}
|
|
1211
|
-
addToPath(e, n, r, o,
|
|
1212
|
-
const
|
|
1213
|
-
return
|
|
1114
|
+
addToPath(e, n, r, o, d) {
|
|
1115
|
+
const f = e.lastComponent;
|
|
1116
|
+
return f && !d.oneChangePerToken && f.added === n && f.removed === r ? {
|
|
1214
1117
|
oldPos: e.oldPos + o,
|
|
1215
|
-
lastComponent: { count:
|
|
1118
|
+
lastComponent: { count: f.count + 1, added: n, removed: r, previousComponent: f.previousComponent }
|
|
1216
1119
|
} : {
|
|
1217
1120
|
oldPos: e.oldPos + o,
|
|
1218
|
-
lastComponent: { count: 1, added: n, removed: r, previousComponent:
|
|
1121
|
+
lastComponent: { count: 1, added: n, removed: r, previousComponent: f }
|
|
1219
1122
|
};
|
|
1220
1123
|
}
|
|
1221
|
-
extractCommon(e, n, r, o,
|
|
1222
|
-
const
|
|
1223
|
-
let
|
|
1224
|
-
for (;
|
|
1225
|
-
|
|
1226
|
-
return b && !
|
|
1124
|
+
extractCommon(e, n, r, o, d) {
|
|
1125
|
+
const f = n.length, l = r.length;
|
|
1126
|
+
let c = e.oldPos, h = c - o, b = 0;
|
|
1127
|
+
for (; h + 1 < f && c + 1 < l && this.equals(r[c + 1], n[h + 1], d); )
|
|
1128
|
+
h++, c++, b++, d.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
|
|
1129
|
+
return b && !d.oneChangePerToken && (e.lastComponent = { count: b, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = c, h;
|
|
1227
1130
|
}
|
|
1228
1131
|
equals(e, n, r) {
|
|
1229
1132
|
return r.comparator ? r.comparator(e, n) : e === n || !!r.ignoreCase && e.toLowerCase() === n.toLowerCase();
|
|
@@ -1253,34 +1156,34 @@ class st {
|
|
|
1253
1156
|
}
|
|
1254
1157
|
buildValues(e, n, r) {
|
|
1255
1158
|
const o = [];
|
|
1256
|
-
let
|
|
1159
|
+
let d;
|
|
1257
1160
|
for (; e; )
|
|
1258
|
-
o.push(e),
|
|
1161
|
+
o.push(e), d = e.previousComponent, delete e.previousComponent, e = d;
|
|
1259
1162
|
o.reverse();
|
|
1260
|
-
const
|
|
1261
|
-
let
|
|
1262
|
-
for (;
|
|
1263
|
-
const b = o[
|
|
1163
|
+
const f = o.length;
|
|
1164
|
+
let l = 0, c = 0, h = 0;
|
|
1165
|
+
for (; l < f; l++) {
|
|
1166
|
+
const b = o[l];
|
|
1264
1167
|
if (b.removed)
|
|
1265
|
-
b.value = this.join(r.slice(
|
|
1168
|
+
b.value = this.join(r.slice(h, h + b.count)), h += b.count;
|
|
1266
1169
|
else {
|
|
1267
1170
|
if (!b.added && this.useLongestToken) {
|
|
1268
|
-
let
|
|
1269
|
-
|
|
1270
|
-
const
|
|
1271
|
-
return
|
|
1272
|
-
}), b.value = this.join(
|
|
1171
|
+
let P = n.slice(c, c + b.count);
|
|
1172
|
+
P = P.map(function(E, x) {
|
|
1173
|
+
const p = r[h + x];
|
|
1174
|
+
return p.length > E.length ? p : E;
|
|
1175
|
+
}), b.value = this.join(P);
|
|
1273
1176
|
} else
|
|
1274
|
-
b.value = this.join(n.slice(
|
|
1275
|
-
|
|
1177
|
+
b.value = this.join(n.slice(c, c + b.count));
|
|
1178
|
+
c += b.count, b.added || (h += b.count);
|
|
1276
1179
|
}
|
|
1277
1180
|
}
|
|
1278
1181
|
return o;
|
|
1279
1182
|
}
|
|
1280
1183
|
}
|
|
1281
|
-
class
|
|
1184
|
+
class et extends Qe {
|
|
1282
1185
|
constructor() {
|
|
1283
|
-
super(...arguments), this.tokenize =
|
|
1186
|
+
super(...arguments), this.tokenize = nt;
|
|
1284
1187
|
}
|
|
1285
1188
|
equals(e, n, r) {
|
|
1286
1189
|
return r.ignoreWhitespace ? ((!r.newlineIsToken || !e.includes(`
|
|
@@ -1290,87 +1193,87 @@ class lt extends st {
|
|
|
1290
1193
|
`) && (n = n.slice(0, -1))), super.equals(e, n, r);
|
|
1291
1194
|
}
|
|
1292
1195
|
}
|
|
1293
|
-
const
|
|
1294
|
-
function
|
|
1295
|
-
return
|
|
1196
|
+
const tt = new et();
|
|
1197
|
+
function ye(t, e, n) {
|
|
1198
|
+
return tt.diff(t, e, n);
|
|
1296
1199
|
}
|
|
1297
|
-
function
|
|
1200
|
+
function nt(t, e) {
|
|
1298
1201
|
e.stripTrailingCr && (t = t.replace(/\r\n/g, `
|
|
1299
1202
|
`));
|
|
1300
1203
|
const n = [], r = t.split(/(\n|\r\n)/);
|
|
1301
1204
|
r[r.length - 1] || r.pop();
|
|
1302
1205
|
for (let o = 0; o < r.length; o++) {
|
|
1303
|
-
const
|
|
1304
|
-
o % 2 && !e.newlineIsToken ? n[n.length - 1] +=
|
|
1206
|
+
const d = r[o];
|
|
1207
|
+
o % 2 && !e.newlineIsToken ? n[n.length - 1] += d : n.push(d);
|
|
1305
1208
|
}
|
|
1306
1209
|
return n;
|
|
1307
1210
|
}
|
|
1308
|
-
function
|
|
1309
|
-
let
|
|
1310
|
-
|
|
1311
|
-
const
|
|
1312
|
-
if (
|
|
1211
|
+
function ge(t, e, n, r, o, d, f) {
|
|
1212
|
+
let l;
|
|
1213
|
+
f ? typeof f == "function" ? l = { callback: f } : l = f : l = {}, typeof l.context > "u" && (l.context = 4);
|
|
1214
|
+
const c = l.context;
|
|
1215
|
+
if (l.newlineIsToken)
|
|
1313
1216
|
throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
|
|
1314
|
-
if (
|
|
1315
|
-
const { callback: b } =
|
|
1316
|
-
|
|
1317
|
-
const
|
|
1318
|
-
b(
|
|
1217
|
+
if (l.callback) {
|
|
1218
|
+
const { callback: b } = l;
|
|
1219
|
+
ye(n, r, Object.assign(Object.assign({}, l), { callback: (P) => {
|
|
1220
|
+
const E = h(P);
|
|
1221
|
+
b(E);
|
|
1319
1222
|
} }));
|
|
1320
1223
|
} else
|
|
1321
|
-
return
|
|
1322
|
-
function
|
|
1224
|
+
return h(ye(n, r, l));
|
|
1225
|
+
function h(b) {
|
|
1323
1226
|
if (!b)
|
|
1324
1227
|
return;
|
|
1325
1228
|
b.push({ value: "", lines: [] });
|
|
1326
|
-
function
|
|
1327
|
-
return
|
|
1328
|
-
return " " +
|
|
1229
|
+
function P(m) {
|
|
1230
|
+
return m.map(function(T) {
|
|
1231
|
+
return " " + T;
|
|
1329
1232
|
});
|
|
1330
1233
|
}
|
|
1331
|
-
const
|
|
1332
|
-
let
|
|
1333
|
-
for (let
|
|
1334
|
-
const
|
|
1335
|
-
if (
|
|
1336
|
-
if (!
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1234
|
+
const E = [];
|
|
1235
|
+
let x = 0, p = 0, k = [], O = 1, A = 1;
|
|
1236
|
+
for (let m = 0; m < b.length; m++) {
|
|
1237
|
+
const T = b[m], R = T.lines || ot(T.value);
|
|
1238
|
+
if (T.lines = R, T.added || T.removed) {
|
|
1239
|
+
if (!x) {
|
|
1240
|
+
const _ = b[m - 1];
|
|
1241
|
+
x = O, p = A, _ && (k = c > 0 ? P(_.lines.slice(-c)) : [], x -= k.length, p -= k.length);
|
|
1339
1242
|
}
|
|
1340
|
-
for (const
|
|
1341
|
-
|
|
1342
|
-
|
|
1243
|
+
for (const _ of R)
|
|
1244
|
+
k.push((T.added ? "+" : "-") + _);
|
|
1245
|
+
T.added ? A += R.length : O += R.length;
|
|
1343
1246
|
} else {
|
|
1344
|
-
if (
|
|
1345
|
-
if (
|
|
1346
|
-
for (const
|
|
1347
|
-
|
|
1247
|
+
if (x)
|
|
1248
|
+
if (R.length <= c * 2 && m < b.length - 2)
|
|
1249
|
+
for (const _ of P(R))
|
|
1250
|
+
k.push(_);
|
|
1348
1251
|
else {
|
|
1349
|
-
const
|
|
1350
|
-
for (const
|
|
1351
|
-
|
|
1352
|
-
const
|
|
1353
|
-
oldStart:
|
|
1354
|
-
oldLines:
|
|
1355
|
-
newStart:
|
|
1356
|
-
newLines: A -
|
|
1357
|
-
lines:
|
|
1252
|
+
const _ = Math.min(R.length, c);
|
|
1253
|
+
for (const I of P(R.slice(0, _)))
|
|
1254
|
+
k.push(I);
|
|
1255
|
+
const N = {
|
|
1256
|
+
oldStart: x,
|
|
1257
|
+
oldLines: O - x + _,
|
|
1258
|
+
newStart: p,
|
|
1259
|
+
newLines: A - p + _,
|
|
1260
|
+
lines: k
|
|
1358
1261
|
};
|
|
1359
|
-
|
|
1262
|
+
E.push(N), x = 0, p = 0, k = [];
|
|
1360
1263
|
}
|
|
1361
|
-
|
|
1264
|
+
O += R.length, A += R.length;
|
|
1362
1265
|
}
|
|
1363
1266
|
}
|
|
1364
|
-
for (const
|
|
1365
|
-
for (let
|
|
1366
|
-
|
|
1367
|
-
`) ?
|
|
1267
|
+
for (const m of E)
|
|
1268
|
+
for (let T = 0; T < m.lines.length; T++)
|
|
1269
|
+
m.lines[T].endsWith(`
|
|
1270
|
+
`) ? m.lines[T] = m.lines[T].slice(0, -1) : (m.lines.splice(T + 1, 0, "\"), T++);
|
|
1368
1271
|
return {
|
|
1369
1272
|
oldFileName: t,
|
|
1370
1273
|
newFileName: e,
|
|
1371
1274
|
oldHeader: o,
|
|
1372
|
-
newHeader:
|
|
1373
|
-
hunks:
|
|
1275
|
+
newHeader: d,
|
|
1276
|
+
hunks: E
|
|
1374
1277
|
};
|
|
1375
1278
|
}
|
|
1376
1279
|
}
|
|
@@ -1390,38 +1293,148 @@ function fe(t) {
|
|
|
1390
1293
|
`) + `
|
|
1391
1294
|
`;
|
|
1392
1295
|
}
|
|
1393
|
-
function
|
|
1394
|
-
if (typeof
|
|
1395
|
-
const { callback:
|
|
1396
|
-
|
|
1397
|
-
|
|
1296
|
+
function rt(t, e, n, r, o, d, f) {
|
|
1297
|
+
if (typeof f == "function" && (f = { callback: f }), f?.callback) {
|
|
1298
|
+
const { callback: l } = f;
|
|
1299
|
+
ge(t, e, n, r, o, d, Object.assign(Object.assign({}, f), { callback: (c) => {
|
|
1300
|
+
l(c ? fe(c) : void 0);
|
|
1398
1301
|
} }));
|
|
1399
1302
|
} else {
|
|
1400
|
-
const
|
|
1401
|
-
return
|
|
1303
|
+
const l = ge(t, e, n, r, o, d, f);
|
|
1304
|
+
return l ? fe(l) : void 0;
|
|
1402
1305
|
}
|
|
1403
1306
|
}
|
|
1404
|
-
function
|
|
1307
|
+
function ot(t) {
|
|
1405
1308
|
const e = t.endsWith(`
|
|
1406
1309
|
`), n = t.split(`
|
|
1407
1310
|
`).map((r) => r + `
|
|
1408
1311
|
`);
|
|
1409
1312
|
return e ? n.pop() : n.push(n.pop().slice(0, -1)), n;
|
|
1410
1313
|
}
|
|
1411
|
-
|
|
1314
|
+
var ie = { exports: {} };
|
|
1315
|
+
const H = new Uint32Array(65536), it = (t, e) => {
|
|
1316
|
+
const n = t.length, r = e.length, o = 1 << n - 1;
|
|
1317
|
+
let d = -1, f = 0, l = n, c = n;
|
|
1318
|
+
for (; c--; )
|
|
1319
|
+
H[t.charCodeAt(c)] |= 1 << c;
|
|
1320
|
+
for (c = 0; c < r; c++) {
|
|
1321
|
+
let h = H[e.charCodeAt(c)];
|
|
1322
|
+
const b = h | f;
|
|
1323
|
+
h |= (h & d) + d ^ d, f |= ~(h | d), d &= h, f & o && l++, d & o && l--, f = f << 1 | 1, d = d << 1 | ~(b | f), f &= b;
|
|
1324
|
+
}
|
|
1325
|
+
for (c = n; c--; )
|
|
1326
|
+
H[t.charCodeAt(c)] = 0;
|
|
1327
|
+
return l;
|
|
1328
|
+
}, st = (t, e) => {
|
|
1329
|
+
const n = e.length, r = t.length, o = [], d = [], f = Math.ceil(n / 32), l = Math.ceil(r / 32);
|
|
1330
|
+
for (let p = 0; p < f; p++)
|
|
1331
|
+
d[p] = -1, o[p] = 0;
|
|
1332
|
+
let c = 0;
|
|
1333
|
+
for (; c < l - 1; c++) {
|
|
1334
|
+
let p = 0, k = -1;
|
|
1335
|
+
const O = c * 32, A = Math.min(32, r) + O;
|
|
1336
|
+
for (let m = O; m < A; m++)
|
|
1337
|
+
H[t.charCodeAt(m)] |= 1 << m;
|
|
1338
|
+
for (let m = 0; m < n; m++) {
|
|
1339
|
+
const T = H[e.charCodeAt(m)], R = d[m / 32 | 0] >>> m & 1, _ = o[m / 32 | 0] >>> m & 1, N = T | p, I = ((T | _) & k) + k ^ k | T | _;
|
|
1340
|
+
let i = p | ~(I | k), u = k & I;
|
|
1341
|
+
i >>> 31 ^ R && (d[m / 32 | 0] ^= 1 << m), u >>> 31 ^ _ && (o[m / 32 | 0] ^= 1 << m), i = i << 1 | R, u = u << 1 | _, k = u | ~(N | i), p = i & N;
|
|
1342
|
+
}
|
|
1343
|
+
for (let m = O; m < A; m++)
|
|
1344
|
+
H[t.charCodeAt(m)] = 0;
|
|
1345
|
+
}
|
|
1346
|
+
let h = 0, b = -1;
|
|
1347
|
+
const P = c * 32, E = Math.min(32, r - P) + P;
|
|
1348
|
+
for (let p = P; p < E; p++)
|
|
1349
|
+
H[t.charCodeAt(p)] |= 1 << p;
|
|
1350
|
+
let x = r;
|
|
1351
|
+
for (let p = 0; p < n; p++) {
|
|
1352
|
+
const k = H[e.charCodeAt(p)], O = d[p / 32 | 0] >>> p & 1, A = o[p / 32 | 0] >>> p & 1, m = k | h, T = ((k | A) & b) + b ^ b | k | A;
|
|
1353
|
+
let R = h | ~(T | b), _ = b & T;
|
|
1354
|
+
x += R >>> r - 1 & 1, x -= _ >>> r - 1 & 1, R >>> 31 ^ O && (d[p / 32 | 0] ^= 1 << p), _ >>> 31 ^ A && (o[p / 32 | 0] ^= 1 << p), R = R << 1 | O, _ = _ << 1 | A, b = _ | ~(m | R), h = R & m;
|
|
1355
|
+
}
|
|
1356
|
+
for (let p = P; p < E; p++)
|
|
1357
|
+
H[t.charCodeAt(p)] = 0;
|
|
1358
|
+
return x;
|
|
1359
|
+
}, Oe = (t, e) => {
|
|
1360
|
+
if (t.length < e.length) {
|
|
1361
|
+
const n = e;
|
|
1362
|
+
e = t, t = n;
|
|
1363
|
+
}
|
|
1364
|
+
return e.length === 0 ? t.length : t.length <= 32 ? it(t, e) : st(t, e);
|
|
1365
|
+
}, at = (t, e) => {
|
|
1366
|
+
let n = 1 / 0, r = 0;
|
|
1367
|
+
for (let o = 0; o < e.length; o++) {
|
|
1368
|
+
const d = Oe(t, e[o]);
|
|
1369
|
+
d < n && (n = d, r = o);
|
|
1370
|
+
}
|
|
1371
|
+
return e[r];
|
|
1372
|
+
}, lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1373
|
+
__proto__: null,
|
|
1374
|
+
closest: at,
|
|
1375
|
+
distance: Oe
|
|
1376
|
+
}, Symbol.toStringTag, { value: "Module" })), ut = /* @__PURE__ */ Se(lt);
|
|
1377
|
+
var we;
|
|
1378
|
+
function ft() {
|
|
1379
|
+
return we || (we = 1, function(t, e) {
|
|
1380
|
+
(function() {
|
|
1381
|
+
var n;
|
|
1382
|
+
try {
|
|
1383
|
+
n = typeof Intl < "u" && typeof Intl.Collator < "u" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
1384
|
+
} catch {
|
|
1385
|
+
console.log("Collator could not be initialized and wouldn't be used");
|
|
1386
|
+
}
|
|
1387
|
+
var r = ut, o = [], d = [], f = {
|
|
1388
|
+
/**
|
|
1389
|
+
* Calculate levenshtein distance of the two strings.
|
|
1390
|
+
*
|
|
1391
|
+
* @param str1 String the first string.
|
|
1392
|
+
* @param str2 String the second string.
|
|
1393
|
+
* @param [options] Additional options.
|
|
1394
|
+
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
1395
|
+
* @return Integer the levenshtein distance (0 and above).
|
|
1396
|
+
*/
|
|
1397
|
+
get: function(l, c, h) {
|
|
1398
|
+
var b = h && n && h.useCollator;
|
|
1399
|
+
if (b) {
|
|
1400
|
+
var P = l.length, E = c.length;
|
|
1401
|
+
if (P === 0) return E;
|
|
1402
|
+
if (E === 0) return P;
|
|
1403
|
+
var x, p, k, O, A;
|
|
1404
|
+
for (k = 0; k < E; ++k)
|
|
1405
|
+
o[k] = k, d[k] = c.charCodeAt(k);
|
|
1406
|
+
o[E] = E;
|
|
1407
|
+
var m;
|
|
1408
|
+
for (k = 0; k < P; ++k) {
|
|
1409
|
+
for (p = k + 1, O = 0; O < E; ++O)
|
|
1410
|
+
x = p, m = n.compare(l.charAt(k), String.fromCharCode(d[O])) === 0, p = o[O] + (m ? 0 : 1), A = x + 1, p > A && (p = A), A = o[O + 1] + 1, p > A && (p = A), o[O] = x;
|
|
1411
|
+
o[O] = p;
|
|
1412
|
+
}
|
|
1413
|
+
return p;
|
|
1414
|
+
}
|
|
1415
|
+
return r.distance(l, c);
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
t !== null && t.exports === e ? t.exports = f : typeof self < "u" && typeof self.postMessage == "function" && typeof self.importScripts == "function" ? self.Levenshtein = f : typeof window < "u" && window !== null && (window.Levenshtein = f);
|
|
1419
|
+
})();
|
|
1420
|
+
}(ie, ie.exports)), ie.exports;
|
|
1421
|
+
}
|
|
1422
|
+
var ct = ft();
|
|
1423
|
+
const dt = /* @__PURE__ */ je(ct);
|
|
1424
|
+
function pt(t, e, n = "git", r = 1) {
|
|
1412
1425
|
switch (n) {
|
|
1413
1426
|
case "git":
|
|
1414
|
-
return
|
|
1427
|
+
return ke(t, e, r);
|
|
1415
1428
|
case "object":
|
|
1416
|
-
return pt(t, e);
|
|
1417
|
-
case "json":
|
|
1418
1429
|
return ht(t, e);
|
|
1430
|
+
case "json":
|
|
1431
|
+
return mt(t, e);
|
|
1419
1432
|
default:
|
|
1420
|
-
return
|
|
1433
|
+
return ke(t, e, r);
|
|
1421
1434
|
}
|
|
1422
1435
|
}
|
|
1423
|
-
function
|
|
1424
|
-
const r =
|
|
1436
|
+
function ke(t, e, n = 1) {
|
|
1437
|
+
const r = xe(t), o = xe(e), l = rt(
|
|
1425
1438
|
/* oldFilename */
|
|
1426
1439
|
"",
|
|
1427
1440
|
/* newFilename */
|
|
@@ -1434,18 +1447,18 @@ function Ee(t, e, n = 1) {
|
|
|
1434
1447
|
"",
|
|
1435
1448
|
{ context: n }
|
|
1436
1449
|
).split(`
|
|
1437
|
-
`).filter((
|
|
1438
|
-
for (;
|
|
1439
|
-
for (;
|
|
1440
|
-
|
|
1441
|
-
return
|
|
1450
|
+
`).filter((c) => !c || c === "\" || c.startsWith("@@") || c.startsWith("---") || c.startsWith("+++") || c.startsWith(" ") ? !1 : !!(c.startsWith("+") || c.startsWith("-")));
|
|
1451
|
+
for (; l.length && l[0].trim() === ""; ) l.shift();
|
|
1452
|
+
for (; l.length && l[l.length - 1].trim() === ""; )
|
|
1453
|
+
l.pop();
|
|
1454
|
+
return l.join(`
|
|
1442
1455
|
`);
|
|
1443
1456
|
}
|
|
1444
|
-
function
|
|
1445
|
-
const n =
|
|
1457
|
+
function ht(t, e) {
|
|
1458
|
+
const n = Ce.diff(t, e) || [];
|
|
1446
1459
|
return JSON.stringify(n, null, 2);
|
|
1447
1460
|
}
|
|
1448
|
-
function
|
|
1461
|
+
function mt(t, e) {
|
|
1449
1462
|
return JSON.stringify(
|
|
1450
1463
|
{
|
|
1451
1464
|
before: t,
|
|
@@ -1455,59 +1468,59 @@ function ht(t, e) {
|
|
|
1455
1468
|
2
|
|
1456
1469
|
);
|
|
1457
1470
|
}
|
|
1458
|
-
function
|
|
1459
|
-
return typeof t == "string" && typeof e == "string" ?
|
|
1471
|
+
function bt(t, e) {
|
|
1472
|
+
return typeof t == "string" && typeof e == "string" ? Re(t, e) : typeof t == "number" && typeof e == "number" ? Ae(t, e) : vt(t, e);
|
|
1460
1473
|
}
|
|
1461
|
-
function
|
|
1474
|
+
function Re(t, e) {
|
|
1462
1475
|
if (t === e) return 0;
|
|
1463
1476
|
if (t.length === 0 || e.length === 0) return 1;
|
|
1464
|
-
const n =
|
|
1477
|
+
const n = dt.get(t, e), r = Math.max(t.length, e.length);
|
|
1465
1478
|
return n / r;
|
|
1466
1479
|
}
|
|
1467
|
-
function
|
|
1480
|
+
function Ae(t, e) {
|
|
1468
1481
|
if (t === e) return 0;
|
|
1469
1482
|
if (t === 0) return 1;
|
|
1470
1483
|
const n = Math.abs(e - t), r = Math.max(Math.abs(t), Math.abs(e));
|
|
1471
1484
|
return Math.min(n / r, 1);
|
|
1472
1485
|
}
|
|
1473
|
-
function
|
|
1486
|
+
function vt(t, e) {
|
|
1474
1487
|
if (t === e) return 0;
|
|
1475
|
-
const n =
|
|
1488
|
+
const n = Ce.diff(t, e) || [];
|
|
1476
1489
|
if (n.length === 0) return 0;
|
|
1477
|
-
const r =
|
|
1478
|
-
if (
|
|
1479
|
-
let
|
|
1480
|
-
for (const
|
|
1481
|
-
switch (
|
|
1490
|
+
const r = Ee(t), o = Ee(e), d = Math.max(r, o);
|
|
1491
|
+
if (d === 0) return 0;
|
|
1492
|
+
let f = 0;
|
|
1493
|
+
for (const l of n)
|
|
1494
|
+
switch (l.kind) {
|
|
1482
1495
|
case "N":
|
|
1483
|
-
|
|
1496
|
+
f += 1;
|
|
1484
1497
|
break;
|
|
1485
1498
|
case "D":
|
|
1486
|
-
|
|
1499
|
+
f += 1;
|
|
1487
1500
|
break;
|
|
1488
1501
|
case "E":
|
|
1489
|
-
if (typeof
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
|
|
1502
|
+
if (typeof l.lhs == "string" && typeof l.rhs == "string") {
|
|
1503
|
+
const c = Re(
|
|
1504
|
+
l.lhs,
|
|
1505
|
+
l.rhs
|
|
1493
1506
|
);
|
|
1494
|
-
|
|
1495
|
-
} else if (typeof
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1507
|
+
f += c;
|
|
1508
|
+
} else if (typeof l.lhs == "number" && typeof l.rhs == "number") {
|
|
1509
|
+
const c = Ae(
|
|
1510
|
+
l.lhs,
|
|
1511
|
+
l.rhs
|
|
1499
1512
|
);
|
|
1500
|
-
|
|
1513
|
+
f += c;
|
|
1501
1514
|
} else
|
|
1502
|
-
|
|
1515
|
+
f += 1;
|
|
1503
1516
|
break;
|
|
1504
1517
|
case "A":
|
|
1505
|
-
|
|
1518
|
+
f += 0.5;
|
|
1506
1519
|
break;
|
|
1507
1520
|
}
|
|
1508
|
-
return Math.min(
|
|
1521
|
+
return Math.min(f / d, 1);
|
|
1509
1522
|
}
|
|
1510
|
-
function
|
|
1523
|
+
function Ee(t) {
|
|
1511
1524
|
if (t == null) return 0;
|
|
1512
1525
|
if (typeof t != "object") return 1;
|
|
1513
1526
|
if (Array.isArray(t)) return t.length;
|
|
@@ -1516,7 +1529,7 @@ function ke(t) {
|
|
|
1516
1529
|
Object.prototype.hasOwnProperty.call(t, n) && (e += 1);
|
|
1517
1530
|
return e;
|
|
1518
1531
|
}
|
|
1519
|
-
function
|
|
1532
|
+
function xe(t) {
|
|
1520
1533
|
try {
|
|
1521
1534
|
return JSON.stringify(
|
|
1522
1535
|
t,
|
|
@@ -1527,101 +1540,100 @@ function Pe(t) {
|
|
|
1527
1540
|
return String(t);
|
|
1528
1541
|
}
|
|
1529
1542
|
}
|
|
1530
|
-
function
|
|
1531
|
-
const r = Te(), o = n?.onFeedback || r,
|
|
1543
|
+
function yt(t, e, n) {
|
|
1544
|
+
const r = Te(), o = n?.onFeedback || r, d = n?.debounceMs ?? 3e3, f = n?.diffType ?? "git", l = n?.compareWith, c = n?.default_trigger_name ?? "auto_state_change", h = n?.ignoreInitialNullish ?? !0, b = Y(t), P = Y(!0), E = Y(t), x = Y(t == null), p = Y(
|
|
1532
1545
|
t != null
|
|
1533
1546
|
// != null catches both null and undefined
|
|
1534
|
-
),
|
|
1535
|
-
!(
|
|
1536
|
-
),
|
|
1537
|
-
(
|
|
1538
|
-
const
|
|
1539
|
-
let a;
|
|
1540
|
-
n?.vote ? typeof n.vote == "function" ? a = n.vote(E, P, S) : a = n.vote : a = S > 0.5 ? "downvote" : "upvote";
|
|
1541
|
-
const s = typeof e == "function" ? e(P) : e;
|
|
1547
|
+
), k = Y(
|
|
1548
|
+
!(h && t == null)
|
|
1549
|
+
), O = Y(null), A = Y(void 0), m = q(
|
|
1550
|
+
(R, _, N) => {
|
|
1551
|
+
const I = bt(R, _), i = pt(R, _, f), u = typeof n?.score == "function" ? n.score(R, _, I) : n?.score ?? (I > 0.5 ? 0 : 1), s = typeof e == "function" ? e(_) : e;
|
|
1542
1552
|
o({
|
|
1543
1553
|
session_id: s,
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1554
|
+
kind: "edit",
|
|
1555
|
+
source: "human",
|
|
1556
|
+
trigger_name: N,
|
|
1557
|
+
score: u,
|
|
1558
|
+
value: i,
|
|
1559
|
+
confidence: I,
|
|
1560
|
+
metadata: n?.metadata
|
|
1550
1561
|
});
|
|
1551
1562
|
},
|
|
1552
|
-
[n, e,
|
|
1553
|
-
),
|
|
1554
|
-
(
|
|
1555
|
-
const
|
|
1556
|
-
if (
|
|
1557
|
-
clearTimeout(
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
|
|
1563
|
+
[n, e, f, o]
|
|
1564
|
+
), T = q(
|
|
1565
|
+
(R) => {
|
|
1566
|
+
const _ = R || c;
|
|
1567
|
+
if (O.current && A.current && A.current !== _) {
|
|
1568
|
+
clearTimeout(O.current);
|
|
1569
|
+
const N = E.current;
|
|
1570
|
+
m(
|
|
1571
|
+
N,
|
|
1561
1572
|
t,
|
|
1562
1573
|
A.current
|
|
1563
|
-
),
|
|
1574
|
+
), O.current = null;
|
|
1564
1575
|
}
|
|
1565
|
-
A.current =
|
|
1576
|
+
A.current = _;
|
|
1566
1577
|
},
|
|
1567
|
-
[t,
|
|
1578
|
+
[t, c, m]
|
|
1568
1579
|
);
|
|
1569
1580
|
return ce(() => {
|
|
1570
|
-
if (
|
|
1571
|
-
|
|
1581
|
+
if (P.current) {
|
|
1582
|
+
P.current = !1, b.current = t, (!h || t != null) && (E.current = t, k.current = !0);
|
|
1572
1583
|
return;
|
|
1573
1584
|
}
|
|
1574
|
-
const
|
|
1575
|
-
if (!(
|
|
1576
|
-
const
|
|
1577
|
-
!
|
|
1585
|
+
const R = b.current;
|
|
1586
|
+
if (!(l ? l(R, t) : JSON.stringify(R) === JSON.stringify(t))) {
|
|
1587
|
+
const N = h && x.current && // True initial state was nullish
|
|
1588
|
+
!p.current && // We haven't had non-nullish state before
|
|
1578
1589
|
t != null;
|
|
1579
|
-
if (t != null && (
|
|
1580
|
-
|
|
1590
|
+
if (t != null && (p.current = !0), N) {
|
|
1591
|
+
E.current = t, k.current = !0, b.current = t;
|
|
1581
1592
|
return;
|
|
1582
1593
|
}
|
|
1583
|
-
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
|
|
1594
|
+
O.current && clearTimeout(O.current), b.current = t, O.current = setTimeout(() => {
|
|
1595
|
+
const I = E.current, i = t;
|
|
1596
|
+
k.current && m(
|
|
1597
|
+
I,
|
|
1587
1598
|
i,
|
|
1588
|
-
A.current ||
|
|
1589
|
-
),
|
|
1590
|
-
},
|
|
1599
|
+
A.current || c
|
|
1600
|
+
), O.current = null;
|
|
1601
|
+
}, d);
|
|
1591
1602
|
}
|
|
1592
1603
|
return () => {
|
|
1593
|
-
|
|
1604
|
+
O.current && clearTimeout(O.current);
|
|
1594
1605
|
};
|
|
1595
1606
|
}, [
|
|
1596
1607
|
t,
|
|
1597
1608
|
e,
|
|
1598
1609
|
n,
|
|
1599
1610
|
o,
|
|
1600
|
-
c,
|
|
1601
|
-
u,
|
|
1602
1611
|
f,
|
|
1603
1612
|
d,
|
|
1604
|
-
|
|
1605
|
-
|
|
1613
|
+
l,
|
|
1614
|
+
c,
|
|
1615
|
+
h,
|
|
1616
|
+
m
|
|
1606
1617
|
]), {
|
|
1607
|
-
notifyChange:
|
|
1618
|
+
notifyChange: T
|
|
1608
1619
|
};
|
|
1609
1620
|
}
|
|
1610
|
-
function
|
|
1611
|
-
const [r, o] =
|
|
1612
|
-
(
|
|
1613
|
-
|
|
1621
|
+
function xt(t, e, n) {
|
|
1622
|
+
const [r, o] = X(t), { notifyChange: d } = yt(r, e, n), f = q(
|
|
1623
|
+
(l, c) => {
|
|
1624
|
+
d(c), o((h) => typeof l == "function" ? l(h) : l);
|
|
1614
1625
|
},
|
|
1615
|
-
[
|
|
1626
|
+
[d]
|
|
1616
1627
|
);
|
|
1617
|
-
return [r,
|
|
1628
|
+
return [r, f];
|
|
1618
1629
|
}
|
|
1619
1630
|
export {
|
|
1620
|
-
|
|
1621
|
-
|
|
1631
|
+
ae as KeletContext,
|
|
1632
|
+
kt as KeletProvider,
|
|
1622
1633
|
Et as VoteFeedback,
|
|
1623
1634
|
Te as useDefaultFeedbackHandler,
|
|
1624
|
-
|
|
1625
|
-
|
|
1635
|
+
xt as useFeedbackState,
|
|
1636
|
+
wt as useKelet,
|
|
1637
|
+
Ke as useKeletSignal
|
|
1626
1638
|
};
|
|
1627
1639
|
//# sourceMappingURL=feedback-ui.es.min.js.map
|