@plasmicpkgs/plasmic-giphy 0.0.2 → 0.0.3
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/dist/plasmic-giphy.cjs.development.js +344 -705
- package/dist/plasmic-giphy.cjs.development.js.map +1 -1
- package/dist/plasmic-giphy.cjs.production.min.js +1 -1
- package/dist/plasmic-giphy.cjs.production.min.js.map +1 -1
- package/dist/plasmic-giphy.esm.js +344 -705
- package/dist/plasmic-giphy.esm.js.map +1 -1
- package/package.json +11 -14
|
@@ -9,694 +9,337 @@ var React = require('react');
|
|
|
9
9
|
var React__default = _interopDefault(React);
|
|
10
10
|
var jsFetchApi = require('@giphy/js-fetch-api');
|
|
11
11
|
|
|
12
|
-
function
|
|
12
|
+
function _regeneratorRuntime() {
|
|
13
|
+
_regeneratorRuntime = function () {
|
|
14
|
+
return e;
|
|
15
|
+
};
|
|
16
|
+
var t,
|
|
17
|
+
e = {},
|
|
18
|
+
r = Object.prototype,
|
|
19
|
+
n = r.hasOwnProperty,
|
|
20
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
21
|
+
t[e] = r.value;
|
|
22
|
+
},
|
|
23
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
24
|
+
a = i.iterator || "@@iterator",
|
|
25
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
26
|
+
u = i.toStringTag || "@@toStringTag";
|
|
27
|
+
function define(t, e, r) {
|
|
28
|
+
return Object.defineProperty(t, e, {
|
|
29
|
+
value: r,
|
|
30
|
+
enumerable: !0,
|
|
31
|
+
configurable: !0,
|
|
32
|
+
writable: !0
|
|
33
|
+
}), t[e];
|
|
34
|
+
}
|
|
13
35
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
define({}, "");
|
|
37
|
+
} catch (t) {
|
|
38
|
+
define = function (t, e, r) {
|
|
39
|
+
return t[e] = r;
|
|
40
|
+
};
|
|
19
41
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
function wrap(t, e, r, n) {
|
|
43
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
44
|
+
a = Object.create(i.prototype),
|
|
45
|
+
c = new Context(n || []);
|
|
46
|
+
return o(a, "_invoke", {
|
|
47
|
+
value: makeInvokeMethod(t, r, c)
|
|
48
|
+
}), a;
|
|
24
49
|
}
|
|
25
|
-
|
|
26
|
-
function _asyncToGenerator(fn) {
|
|
27
|
-
return function () {
|
|
28
|
-
var self = this,
|
|
29
|
-
args = arguments;
|
|
30
|
-
return new Promise(function (resolve, reject) {
|
|
31
|
-
var gen = fn.apply(self, args);
|
|
32
|
-
function _next(value) {
|
|
33
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
34
|
-
}
|
|
35
|
-
function _throw(err) {
|
|
36
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
|
-
}
|
|
38
|
-
_next(undefined);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function createCommonjsModule(fn, module) {
|
|
44
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
48
|
-
/**
|
|
49
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
50
|
-
*
|
|
51
|
-
* This source code is licensed under the MIT license found in the
|
|
52
|
-
* LICENSE file in the root directory of this source tree.
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
var runtime = function (exports) {
|
|
56
|
-
|
|
57
|
-
var Op = Object.prototype;
|
|
58
|
-
var hasOwn = Op.hasOwnProperty;
|
|
59
|
-
var undefined$1; // More compressible than void 0.
|
|
60
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
61
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
62
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
63
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
64
|
-
function define(obj, key, value) {
|
|
65
|
-
Object.defineProperty(obj, key, {
|
|
66
|
-
value: value,
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
writable: true
|
|
70
|
-
});
|
|
71
|
-
return obj[key];
|
|
72
|
-
}
|
|
50
|
+
function tryCatch(t, e, r) {
|
|
73
51
|
try {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
return {
|
|
53
|
+
type: "normal",
|
|
54
|
+
arg: t.call(e, r)
|
|
55
|
+
};
|
|
56
|
+
} catch (t) {
|
|
57
|
+
return {
|
|
58
|
+
type: "throw",
|
|
59
|
+
arg: t
|
|
79
60
|
};
|
|
80
61
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
function tryCatch(fn, obj, arg) {
|
|
105
|
-
try {
|
|
106
|
-
return {
|
|
107
|
-
type: "normal",
|
|
108
|
-
arg: fn.call(obj, arg)
|
|
109
|
-
};
|
|
110
|
-
} catch (err) {
|
|
111
|
-
return {
|
|
112
|
-
type: "throw",
|
|
113
|
-
arg: err
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
118
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
119
|
-
var GenStateExecuting = "executing";
|
|
120
|
-
var GenStateCompleted = "completed";
|
|
121
|
-
|
|
122
|
-
// Returning this object from the innerFn has the same effect as
|
|
123
|
-
// breaking out of the dispatch switch statement.
|
|
124
|
-
var ContinueSentinel = {};
|
|
125
|
-
|
|
126
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
127
|
-
// .constructor.prototype properties for functions that return Generator
|
|
128
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
129
|
-
// minifier not to mangle the names of these two functions.
|
|
130
|
-
function Generator() {}
|
|
131
|
-
function GeneratorFunction() {}
|
|
132
|
-
function GeneratorFunctionPrototype() {}
|
|
133
|
-
|
|
134
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
135
|
-
// don't natively support it.
|
|
136
|
-
var IteratorPrototype = {};
|
|
137
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
138
|
-
return this;
|
|
62
|
+
}
|
|
63
|
+
e.wrap = wrap;
|
|
64
|
+
var h = "suspendedStart",
|
|
65
|
+
l = "suspendedYield",
|
|
66
|
+
f = "executing",
|
|
67
|
+
s = "completed",
|
|
68
|
+
y = {};
|
|
69
|
+
function Generator() {}
|
|
70
|
+
function GeneratorFunction() {}
|
|
71
|
+
function GeneratorFunctionPrototype() {}
|
|
72
|
+
var p = {};
|
|
73
|
+
define(p, a, function () {
|
|
74
|
+
return this;
|
|
75
|
+
});
|
|
76
|
+
var d = Object.getPrototypeOf,
|
|
77
|
+
v = d && d(d(values([])));
|
|
78
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
79
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
80
|
+
function defineIteratorMethods(t) {
|
|
81
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
82
|
+
define(t, e, function (t) {
|
|
83
|
+
return this._invoke(e, t);
|
|
84
|
+
});
|
|
139
85
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
function defineIteratorMethods(prototype) {
|
|
156
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
157
|
-
define(prototype, method, function (arg) {
|
|
158
|
-
return this._invoke(method, arg);
|
|
86
|
+
}
|
|
87
|
+
function AsyncIterator(t, e) {
|
|
88
|
+
function invoke(r, o, i, a) {
|
|
89
|
+
var c = tryCatch(t[r], t, o);
|
|
90
|
+
if ("throw" !== c.type) {
|
|
91
|
+
var u = c.arg,
|
|
92
|
+
h = u.value;
|
|
93
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
94
|
+
invoke("next", t, i, a);
|
|
95
|
+
}, function (t) {
|
|
96
|
+
invoke("throw", t, i, a);
|
|
97
|
+
}) : e.resolve(h).then(function (t) {
|
|
98
|
+
u.value = t, i(u);
|
|
99
|
+
}, function (t) {
|
|
100
|
+
return invoke("throw", t, i, a);
|
|
159
101
|
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
exports.isGeneratorFunction = function (genFun) {
|
|
163
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
164
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
165
|
-
// For the native GeneratorFunction constructor, the best we can
|
|
166
|
-
// do is to check its .name property.
|
|
167
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
168
|
-
};
|
|
169
|
-
exports.mark = function (genFun) {
|
|
170
|
-
if (Object.setPrototypeOf) {
|
|
171
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
172
|
-
} else {
|
|
173
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
174
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
175
102
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
182
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
183
|
-
// meant to be awaited.
|
|
184
|
-
exports.awrap = function (arg) {
|
|
185
|
-
return {
|
|
186
|
-
__await: arg
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
190
|
-
function invoke(method, arg, resolve, reject) {
|
|
191
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
192
|
-
if (record.type === "throw") {
|
|
193
|
-
reject(record.arg);
|
|
194
|
-
} else {
|
|
195
|
-
var result = record.arg;
|
|
196
|
-
var value = result.value;
|
|
197
|
-
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
198
|
-
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
199
|
-
invoke("next", value, resolve, reject);
|
|
200
|
-
}, function (err) {
|
|
201
|
-
invoke("throw", err, resolve, reject);
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
205
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
206
|
-
// the .value of the Promise<{value,done}> result for the
|
|
207
|
-
// current iteration.
|
|
208
|
-
result.value = unwrapped;
|
|
209
|
-
resolve(result);
|
|
210
|
-
}, function (error) {
|
|
211
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
212
|
-
// into the async generator function so it can be handled there.
|
|
213
|
-
return invoke("throw", error, resolve, reject);
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
var previousPromise;
|
|
218
|
-
function enqueue(method, arg) {
|
|
103
|
+
a(c.arg);
|
|
104
|
+
}
|
|
105
|
+
var r;
|
|
106
|
+
o(this, "_invoke", {
|
|
107
|
+
value: function (t, n) {
|
|
219
108
|
function callInvokeWithMethodAndArg() {
|
|
220
|
-
return new
|
|
221
|
-
invoke(
|
|
109
|
+
return new e(function (e, r) {
|
|
110
|
+
invoke(t, n, e, r);
|
|
222
111
|
});
|
|
223
112
|
}
|
|
224
|
-
return
|
|
225
|
-
// If enqueue has been called before, then we want to wait until
|
|
226
|
-
// all previous Promises have been resolved before calling invoke,
|
|
227
|
-
// so that results are always delivered in the correct order. If
|
|
228
|
-
// enqueue has not been called before, then it is important to
|
|
229
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
230
|
-
// so that the async generator function has the opportunity to do
|
|
231
|
-
// any necessary setup in a predictable way. This predictability
|
|
232
|
-
// is why the Promise constructor synchronously invokes its
|
|
233
|
-
// executor callback, and why async functions synchronously
|
|
234
|
-
// execute code before the first await. Since we implement simple
|
|
235
|
-
// async functions in terms of async generators, it is especially
|
|
236
|
-
// important to get this right, even though it requires care.
|
|
237
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
238
|
-
// Avoid propagating failures to Promises returned by later
|
|
239
|
-
// invocations of the iterator.
|
|
240
|
-
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
113
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
241
114
|
}
|
|
242
|
-
|
|
243
|
-
// Define the unified helper method that is used to implement .next,
|
|
244
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
245
|
-
this._invoke = enqueue;
|
|
246
|
-
}
|
|
247
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
248
|
-
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
249
|
-
return this;
|
|
250
115
|
});
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (state === GenStateCompleted) {
|
|
271
|
-
if (method === "throw") {
|
|
272
|
-
throw arg;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
276
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
277
|
-
return doneResult();
|
|
278
|
-
}
|
|
279
|
-
context.method = method;
|
|
280
|
-
context.arg = arg;
|
|
281
|
-
while (true) {
|
|
282
|
-
var delegate = context.delegate;
|
|
283
|
-
if (delegate) {
|
|
284
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
285
|
-
if (delegateResult) {
|
|
286
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
287
|
-
return delegateResult;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (context.method === "next") {
|
|
291
|
-
// Setting context._sent for legacy support of Babel's
|
|
292
|
-
// function.sent implementation.
|
|
293
|
-
context.sent = context._sent = context.arg;
|
|
294
|
-
} else if (context.method === "throw") {
|
|
295
|
-
if (state === GenStateSuspendedStart) {
|
|
296
|
-
state = GenStateCompleted;
|
|
297
|
-
throw context.arg;
|
|
298
|
-
}
|
|
299
|
-
context.dispatchException(context.arg);
|
|
300
|
-
} else if (context.method === "return") {
|
|
301
|
-
context.abrupt("return", context.arg);
|
|
302
|
-
}
|
|
303
|
-
state = GenStateExecuting;
|
|
304
|
-
var record = tryCatch(innerFn, self, context);
|
|
305
|
-
if (record.type === "normal") {
|
|
306
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
307
|
-
// GenStateExecuting and loop back for another invocation.
|
|
308
|
-
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
309
|
-
if (record.arg === ContinueSentinel) {
|
|
310
|
-
continue;
|
|
311
|
-
}
|
|
312
|
-
return {
|
|
313
|
-
value: record.arg,
|
|
314
|
-
done: context.done
|
|
315
|
-
};
|
|
316
|
-
} else if (record.type === "throw") {
|
|
317
|
-
state = GenStateCompleted;
|
|
318
|
-
// Dispatch the exception by looping back around to the
|
|
319
|
-
// context.dispatchException(context.arg) call above.
|
|
320
|
-
context.method = "throw";
|
|
321
|
-
context.arg = record.arg;
|
|
116
|
+
}
|
|
117
|
+
function makeInvokeMethod(e, r, n) {
|
|
118
|
+
var o = h;
|
|
119
|
+
return function (i, a) {
|
|
120
|
+
if (o === f) throw new Error("Generator is already running");
|
|
121
|
+
if (o === s) {
|
|
122
|
+
if ("throw" === i) throw a;
|
|
123
|
+
return {
|
|
124
|
+
value: t,
|
|
125
|
+
done: !0
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
for (n.method = i, n.arg = a;;) {
|
|
129
|
+
var c = n.delegate;
|
|
130
|
+
if (c) {
|
|
131
|
+
var u = maybeInvokeDelegate(c, n);
|
|
132
|
+
if (u) {
|
|
133
|
+
if (u === y) continue;
|
|
134
|
+
return u;
|
|
322
135
|
}
|
|
323
136
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
context.delegate = null;
|
|
337
|
-
if (context.method === "throw") {
|
|
338
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
339
|
-
if (delegate.iterator["return"]) {
|
|
340
|
-
// If the delegate iterator has a return method, give it a
|
|
341
|
-
// chance to clean up.
|
|
342
|
-
context.method = "return";
|
|
343
|
-
context.arg = undefined$1;
|
|
344
|
-
maybeInvokeDelegate(delegate, context);
|
|
345
|
-
if (context.method === "throw") {
|
|
346
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
347
|
-
// "return" to "throw", let that override the TypeError below.
|
|
348
|
-
return ContinueSentinel;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
context.method = "throw";
|
|
352
|
-
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
137
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
138
|
+
if (o === h) throw o = s, n.arg;
|
|
139
|
+
n.dispatchException(n.arg);
|
|
140
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
141
|
+
o = f;
|
|
142
|
+
var p = tryCatch(e, r, n);
|
|
143
|
+
if ("normal" === p.type) {
|
|
144
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
145
|
+
return {
|
|
146
|
+
value: p.arg,
|
|
147
|
+
done: n.done
|
|
148
|
+
};
|
|
353
149
|
}
|
|
354
|
-
|
|
150
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
355
151
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function maybeInvokeDelegate(e, r) {
|
|
155
|
+
var n = r.method,
|
|
156
|
+
o = e.iterator[n];
|
|
157
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
158
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
159
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
160
|
+
var a = i.arg;
|
|
161
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
162
|
+
}
|
|
163
|
+
function pushTryEntry(t) {
|
|
164
|
+
var e = {
|
|
165
|
+
tryLoc: t[0]
|
|
166
|
+
};
|
|
167
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
168
|
+
}
|
|
169
|
+
function resetTryEntry(t) {
|
|
170
|
+
var e = t.completion || {};
|
|
171
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
172
|
+
}
|
|
173
|
+
function Context(t) {
|
|
174
|
+
this.tryEntries = [{
|
|
175
|
+
tryLoc: "root"
|
|
176
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
177
|
+
}
|
|
178
|
+
function values(e) {
|
|
179
|
+
if (e || "" === e) {
|
|
180
|
+
var r = e[a];
|
|
181
|
+
if (r) return r.call(e);
|
|
182
|
+
if ("function" == typeof e.next) return e;
|
|
183
|
+
if (!isNaN(e.length)) {
|
|
184
|
+
var o = -1,
|
|
185
|
+
i = function next() {
|
|
186
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
187
|
+
return next.value = t, next.done = !0, next;
|
|
188
|
+
};
|
|
189
|
+
return i.next = i;
|
|
391
190
|
}
|
|
392
|
-
|
|
393
|
-
// The delegate iterator is finished, so forget it and continue with
|
|
394
|
-
// the outer generator.
|
|
395
|
-
context.delegate = null;
|
|
396
|
-
return ContinueSentinel;
|
|
397
191
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
192
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
193
|
+
}
|
|
194
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
195
|
+
value: GeneratorFunctionPrototype,
|
|
196
|
+
configurable: !0
|
|
197
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
198
|
+
value: GeneratorFunction,
|
|
199
|
+
configurable: !0
|
|
200
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
201
|
+
var e = "function" == typeof t && t.constructor;
|
|
202
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
203
|
+
}, e.mark = function (t) {
|
|
204
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
205
|
+
}, e.awrap = function (t) {
|
|
206
|
+
return {
|
|
207
|
+
__await: t
|
|
208
|
+
};
|
|
209
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
210
|
+
return this;
|
|
211
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
212
|
+
void 0 === i && (i = Promise);
|
|
213
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
214
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
215
|
+
return t.done ? t.value : a.next();
|
|
414
216
|
});
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
217
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
218
|
+
return this;
|
|
219
|
+
}), define(g, "toString", function () {
|
|
220
|
+
return "[object Generator]";
|
|
221
|
+
}), e.keys = function (t) {
|
|
222
|
+
var e = Object(t),
|
|
223
|
+
r = [];
|
|
224
|
+
for (var n in e) r.push(n);
|
|
225
|
+
return r.reverse(), function next() {
|
|
226
|
+
for (; r.length;) {
|
|
227
|
+
var t = r.pop();
|
|
228
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
421
229
|
}
|
|
422
|
-
|
|
423
|
-
entry.finallyLoc = locs[2];
|
|
424
|
-
entry.afterLoc = locs[3];
|
|
425
|
-
}
|
|
426
|
-
this.tryEntries.push(entry);
|
|
427
|
-
}
|
|
428
|
-
function resetTryEntry(entry) {
|
|
429
|
-
var record = entry.completion || {};
|
|
430
|
-
record.type = "normal";
|
|
431
|
-
delete record.arg;
|
|
432
|
-
entry.completion = record;
|
|
433
|
-
}
|
|
434
|
-
function Context(tryLocsList) {
|
|
435
|
-
// The root entry object (effectively a try statement without a catch
|
|
436
|
-
// or a finally block) gives us a place to store values thrown from
|
|
437
|
-
// locations where there is no enclosing try statement.
|
|
438
|
-
this.tryEntries = [{
|
|
439
|
-
tryLoc: "root"
|
|
440
|
-
}];
|
|
441
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
442
|
-
this.reset(true);
|
|
443
|
-
}
|
|
444
|
-
exports.keys = function (object) {
|
|
445
|
-
var keys = [];
|
|
446
|
-
for (var key in object) {
|
|
447
|
-
keys.push(key);
|
|
448
|
-
}
|
|
449
|
-
keys.reverse();
|
|
450
|
-
|
|
451
|
-
// Rather than returning an object with a next method, we keep
|
|
452
|
-
// things simple and return the next function itself.
|
|
453
|
-
return function next() {
|
|
454
|
-
while (keys.length) {
|
|
455
|
-
var key = keys.pop();
|
|
456
|
-
if (key in object) {
|
|
457
|
-
next.value = key;
|
|
458
|
-
next.done = false;
|
|
459
|
-
return next;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// To avoid creating an additional object, we just hang the .value
|
|
464
|
-
// and .done properties off the next function object itself. This
|
|
465
|
-
// also ensures that the minifier will not anonymize the function.
|
|
466
|
-
next.done = true;
|
|
467
|
-
return next;
|
|
468
|
-
};
|
|
230
|
+
return next.done = !0, next;
|
|
469
231
|
};
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return next;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
next.value = undefined$1;
|
|
490
|
-
next.done = true;
|
|
491
|
-
return next;
|
|
492
|
-
};
|
|
493
|
-
return next.next = next;
|
|
494
|
-
}
|
|
232
|
+
}, e.values = values, Context.prototype = {
|
|
233
|
+
constructor: Context,
|
|
234
|
+
reset: function (e) {
|
|
235
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
236
|
+
},
|
|
237
|
+
stop: function () {
|
|
238
|
+
this.done = !0;
|
|
239
|
+
var t = this.tryEntries[0].completion;
|
|
240
|
+
if ("throw" === t.type) throw t.arg;
|
|
241
|
+
return this.rval;
|
|
242
|
+
},
|
|
243
|
+
dispatchException: function (e) {
|
|
244
|
+
if (this.done) throw e;
|
|
245
|
+
var r = this;
|
|
246
|
+
function handle(n, o) {
|
|
247
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
495
248
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
reset: function reset(skipTempReset) {
|
|
512
|
-
this.prev = 0;
|
|
513
|
-
this.next = 0;
|
|
514
|
-
// Resetting context._sent for legacy support of Babel's
|
|
515
|
-
// function.sent implementation.
|
|
516
|
-
this.sent = this._sent = undefined$1;
|
|
517
|
-
this.done = false;
|
|
518
|
-
this.delegate = null;
|
|
519
|
-
this.method = "next";
|
|
520
|
-
this.arg = undefined$1;
|
|
521
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
522
|
-
if (!skipTempReset) {
|
|
523
|
-
for (var name in this) {
|
|
524
|
-
// Not sure about the optimal order of these conditions:
|
|
525
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
526
|
-
this[name] = undefined$1;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
stop: function stop() {
|
|
532
|
-
this.done = true;
|
|
533
|
-
var rootEntry = this.tryEntries[0];
|
|
534
|
-
var rootRecord = rootEntry.completion;
|
|
535
|
-
if (rootRecord.type === "throw") {
|
|
536
|
-
throw rootRecord.arg;
|
|
537
|
-
}
|
|
538
|
-
return this.rval;
|
|
539
|
-
},
|
|
540
|
-
dispatchException: function dispatchException(exception) {
|
|
541
|
-
if (this.done) {
|
|
542
|
-
throw exception;
|
|
543
|
-
}
|
|
544
|
-
var context = this;
|
|
545
|
-
function handle(loc, caught) {
|
|
546
|
-
record.type = "throw";
|
|
547
|
-
record.arg = exception;
|
|
548
|
-
context.next = loc;
|
|
549
|
-
if (caught) {
|
|
550
|
-
// If the dispatched exception was caught by a catch block,
|
|
551
|
-
// then let that catch block handle the exception normally.
|
|
552
|
-
context.method = "next";
|
|
553
|
-
context.arg = undefined$1;
|
|
554
|
-
}
|
|
555
|
-
return !!caught;
|
|
556
|
-
}
|
|
557
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
558
|
-
var entry = this.tryEntries[i];
|
|
559
|
-
var record = entry.completion;
|
|
560
|
-
if (entry.tryLoc === "root") {
|
|
561
|
-
// Exception thrown outside of any try block that could handle
|
|
562
|
-
// it, so set the completion value of the entire function to
|
|
563
|
-
// throw the exception.
|
|
564
|
-
return handle("end");
|
|
249
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
250
|
+
var i = this.tryEntries[o],
|
|
251
|
+
a = i.completion;
|
|
252
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
253
|
+
if (i.tryLoc <= this.prev) {
|
|
254
|
+
var c = n.call(i, "catchLoc"),
|
|
255
|
+
u = n.call(i, "finallyLoc");
|
|
256
|
+
if (c && u) {
|
|
257
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
258
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
259
|
+
} else if (c) {
|
|
260
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
261
|
+
} else {
|
|
262
|
+
if (!u) throw new Error("try statement without catch or finally");
|
|
263
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
565
264
|
}
|
|
566
|
-
if (entry.tryLoc <= this.prev) {
|
|
567
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
568
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
569
|
-
if (hasCatch && hasFinally) {
|
|
570
|
-
if (this.prev < entry.catchLoc) {
|
|
571
|
-
return handle(entry.catchLoc, true);
|
|
572
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
573
|
-
return handle(entry.finallyLoc);
|
|
574
|
-
}
|
|
575
|
-
} else if (hasCatch) {
|
|
576
|
-
if (this.prev < entry.catchLoc) {
|
|
577
|
-
return handle(entry.catchLoc, true);
|
|
578
|
-
}
|
|
579
|
-
} else if (hasFinally) {
|
|
580
|
-
if (this.prev < entry.finallyLoc) {
|
|
581
|
-
return handle(entry.finallyLoc);
|
|
582
|
-
}
|
|
583
|
-
} else {
|
|
584
|
-
throw new Error("try statement without catch or finally");
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
},
|
|
589
|
-
abrupt: function abrupt(type, arg) {
|
|
590
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
591
|
-
var entry = this.tryEntries[i];
|
|
592
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
593
|
-
var finallyEntry = entry;
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
598
|
-
// Ignore the finally entry if control is not jumping to a
|
|
599
|
-
// location outside the try/catch block.
|
|
600
|
-
finallyEntry = null;
|
|
601
|
-
}
|
|
602
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
603
|
-
record.type = type;
|
|
604
|
-
record.arg = arg;
|
|
605
|
-
if (finallyEntry) {
|
|
606
|
-
this.method = "next";
|
|
607
|
-
this.next = finallyEntry.finallyLoc;
|
|
608
|
-
return ContinueSentinel;
|
|
609
265
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
} else if (record.type === "return") {
|
|
619
|
-
this.rval = this.arg = record.arg;
|
|
620
|
-
this.method = "return";
|
|
621
|
-
this.next = "end";
|
|
622
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
623
|
-
this.next = afterLoc;
|
|
624
|
-
}
|
|
625
|
-
return ContinueSentinel;
|
|
626
|
-
},
|
|
627
|
-
finish: function finish(finallyLoc) {
|
|
628
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
629
|
-
var entry = this.tryEntries[i];
|
|
630
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
631
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
632
|
-
resetTryEntry(entry);
|
|
633
|
-
return ContinueSentinel;
|
|
634
|
-
}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
abrupt: function (t, e) {
|
|
269
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
270
|
+
var o = this.tryEntries[r];
|
|
271
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
272
|
+
var i = o;
|
|
273
|
+
break;
|
|
635
274
|
}
|
|
636
|
-
}
|
|
637
|
-
"
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
275
|
+
}
|
|
276
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
277
|
+
var a = i ? i.completion : {};
|
|
278
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
279
|
+
},
|
|
280
|
+
complete: function (t, e) {
|
|
281
|
+
if ("throw" === t.type) throw t.arg;
|
|
282
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
283
|
+
},
|
|
284
|
+
finish: function (t) {
|
|
285
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
286
|
+
var r = this.tryEntries[e];
|
|
287
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
catch: function (t) {
|
|
291
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
292
|
+
var r = this.tryEntries[e];
|
|
293
|
+
if (r.tryLoc === t) {
|
|
294
|
+
var n = r.completion;
|
|
295
|
+
if ("throw" === n.type) {
|
|
296
|
+
var o = n.arg;
|
|
297
|
+
resetTryEntry(r);
|
|
647
298
|
}
|
|
299
|
+
return o;
|
|
648
300
|
}
|
|
649
|
-
|
|
650
|
-
// The context.catch method must only be called with a location
|
|
651
|
-
// argument that corresponds to a known catch block.
|
|
652
|
-
throw new Error("illegal catch attempt");
|
|
653
|
-
},
|
|
654
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
655
|
-
this.delegate = {
|
|
656
|
-
iterator: values(iterable),
|
|
657
|
-
resultName: resultName,
|
|
658
|
-
nextLoc: nextLoc
|
|
659
|
-
};
|
|
660
|
-
if (this.method === "next") {
|
|
661
|
-
// Deliberately forget the last sent value so that we don't
|
|
662
|
-
// accidentally pass it on to the delegate.
|
|
663
|
-
this.arg = undefined$1;
|
|
664
|
-
}
|
|
665
|
-
return ContinueSentinel;
|
|
666
301
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
// If this script is executing as a CommonJS module, use module.exports
|
|
676
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
677
|
-
// object. Either way, the resulting object will be used to initialize
|
|
678
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
679
|
-
module.exports );
|
|
680
|
-
try {
|
|
681
|
-
regeneratorRuntime = runtime;
|
|
682
|
-
} catch (accidentalStrictMode) {
|
|
683
|
-
// This module should not be running in strict mode, so the above
|
|
684
|
-
// assignment should always work unless something is misconfigured. Just
|
|
685
|
-
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
686
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
687
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
688
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
689
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
690
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
691
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
692
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
693
|
-
if (typeof globalThis === "object") {
|
|
694
|
-
globalThis.regeneratorRuntime = runtime;
|
|
695
|
-
} else {
|
|
696
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
302
|
+
throw new Error("illegal catch attempt");
|
|
303
|
+
},
|
|
304
|
+
delegateYield: function (e, r, n) {
|
|
305
|
+
return this.delegate = {
|
|
306
|
+
iterator: values(e),
|
|
307
|
+
resultName: r,
|
|
308
|
+
nextLoc: n
|
|
309
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
697
310
|
}
|
|
311
|
+
}, e;
|
|
312
|
+
}
|
|
313
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
314
|
+
try {
|
|
315
|
+
var info = gen[key](arg);
|
|
316
|
+
var value = info.value;
|
|
317
|
+
} catch (error) {
|
|
318
|
+
reject(error);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (info.done) {
|
|
322
|
+
resolve(value);
|
|
323
|
+
} else {
|
|
324
|
+
Promise.resolve(value).then(_next, _throw);
|
|
698
325
|
}
|
|
699
|
-
}
|
|
326
|
+
}
|
|
327
|
+
function _asyncToGenerator(fn) {
|
|
328
|
+
return function () {
|
|
329
|
+
var self = this,
|
|
330
|
+
args = arguments;
|
|
331
|
+
return new Promise(function (resolve, reject) {
|
|
332
|
+
var gen = fn.apply(self, args);
|
|
333
|
+
function _next(value) {
|
|
334
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
335
|
+
}
|
|
336
|
+
function _throw(err) {
|
|
337
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
338
|
+
}
|
|
339
|
+
_next(undefined);
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
}
|
|
700
343
|
|
|
701
344
|
var useFetch = function useFetch(_ref) {
|
|
702
345
|
var keyword = _ref.keyword;
|
|
@@ -707,34 +350,32 @@ var useFetch = function useFetch(_ref) {
|
|
|
707
350
|
if (keyword) fetchGiphy();
|
|
708
351
|
}, [keyword]);
|
|
709
352
|
var fetchGiphy = /*#__PURE__*/function () {
|
|
710
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
353
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
711
354
|
var _data$, response, _yield$response$json, data;
|
|
712
|
-
return
|
|
713
|
-
while (1) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
return _context.stop();
|
|
737
|
-
}
|
|
355
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
356
|
+
while (1) switch (_context.prev = _context.next) {
|
|
357
|
+
case 0:
|
|
358
|
+
_context.prev = 0;
|
|
359
|
+
_context.next = 3;
|
|
360
|
+
return fetch("https://api.giphy.com/v1/gifs/search?api_key=X1q3afkDR9WHSZJhLS6H9yYTQMPIWOTK&q=" + keyword.split(" ").join("") + "&limit=1");
|
|
361
|
+
case 3:
|
|
362
|
+
response = _context.sent;
|
|
363
|
+
_context.next = 6;
|
|
364
|
+
return response.json();
|
|
365
|
+
case 6:
|
|
366
|
+
_yield$response$json = _context.sent;
|
|
367
|
+
data = _yield$response$json.data;
|
|
368
|
+
setGiphyId((_data$ = data[0]) == null ? void 0 : _data$.id);
|
|
369
|
+
_context.next = 15;
|
|
370
|
+
break;
|
|
371
|
+
case 11:
|
|
372
|
+
_context.prev = 11;
|
|
373
|
+
_context.t0 = _context["catch"](0);
|
|
374
|
+
console.log("Error in gif api retrieval: ", _context.t0);
|
|
375
|
+
setGiphyId("");
|
|
376
|
+
case 15:
|
|
377
|
+
case "end":
|
|
378
|
+
return _context.stop();
|
|
738
379
|
}
|
|
739
380
|
}, _callee, null, [[0, 11]]);
|
|
740
381
|
}));
|
|
@@ -782,29 +423,27 @@ function Giphy(_ref) {
|
|
|
782
423
|
var gf = new jsFetchApi.GiphyFetch("X1q3afkDR9WHSZJhLS6H9yYTQMPIWOTK");
|
|
783
424
|
React.useEffect(function () {
|
|
784
425
|
var fetchGif = /*#__PURE__*/function () {
|
|
785
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
426
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
786
427
|
var _yield$gf$gif, data;
|
|
787
|
-
return
|
|
788
|
-
while (1) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
return _context.stop();
|
|
807
|
-
}
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
429
|
+
while (1) switch (_context.prev = _context.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
if (id) {
|
|
432
|
+
_context.next = 2;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
return _context.abrupt("return", null);
|
|
436
|
+
case 2:
|
|
437
|
+
_context.next = 4;
|
|
438
|
+
return gf.gif(id);
|
|
439
|
+
case 4:
|
|
440
|
+
_yield$gf$gif = _context.sent;
|
|
441
|
+
data = _yield$gf$gif.data;
|
|
442
|
+
setGif(data);
|
|
443
|
+
return _context.abrupt("return", data);
|
|
444
|
+
case 8:
|
|
445
|
+
case "end":
|
|
446
|
+
return _context.stop();
|
|
808
447
|
}
|
|
809
448
|
}, _callee);
|
|
810
449
|
}));
|