hanbiro-react16-sdk 1.0.22 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/components/ChatAIDraft/EmptyState.d.ts +6 -0
  2. package/dist/components/ChatAIDraft/EmptyState.js +222 -0
  3. package/dist/components/ChatAIDraft/List.js +55 -18
  4. package/dist/components/ChatAIDraft/SettingPopper/ChipGroup.d.ts +11 -0
  5. package/dist/components/ChatAIDraft/SettingPopper/ChipGroup.js +62 -0
  6. package/dist/components/ChatAIDraft/SettingPopper/LanguageSelect.d.ts +21 -0
  7. package/dist/components/ChatAIDraft/SettingPopper/LanguageSelect.js +137 -0
  8. package/dist/components/ChatAIDraft/SettingPopper/icons.d.ts +3 -0
  9. package/dist/components/ChatAIDraft/SettingPopper/icons.js +30 -0
  10. package/dist/components/ChatAIDraft/{SettingPopper.d.ts → SettingPopper/index.d.ts} +5 -5
  11. package/dist/components/ChatAIDraft/{SettingPopper.js → SettingPopper/index.js} +37 -77
  12. package/dist/components/ChatAIDraft/constants.d.ts +4 -0
  13. package/dist/components/ChatAIDraft/constants.js +18 -0
  14. package/dist/components/ChatAIDraft/index.d.ts +8 -8
  15. package/dist/components/ChatAIDraft/index.js +100 -52
  16. package/dist/components/index.d.ts +1 -1
  17. package/dist/hanbiro-react16-sdk.style.css +39 -2
  18. package/dist/hanbiro-react16-sdk.umd.js +2244 -1646
  19. package/dist/index.js +2 -2
  20. package/dist/node_modules/prop-types/index.js +1 -2
  21. package/dist/node_modules/react-feather/dist/icons/align-justify.js +86 -0
  22. package/dist/node_modules/react-feather/dist/icons/{send.js → arrow-up.js} +10 -10
  23. package/dist/node_modules/react-feather/dist/icons/award.js +72 -0
  24. package/dist/node_modules/react-feather/dist/icons/check.js +68 -0
  25. package/dist/node_modules/react-feather/dist/icons/chevron-down.js +68 -0
  26. package/dist/node_modules/react-feather/dist/icons/compass.js +72 -0
  27. package/dist/node_modules/react-feather/dist/icons/file-text.js +82 -0
  28. package/dist/node_modules/react-feather/dist/icons/frown.js +82 -0
  29. package/dist/node_modules/react-feather/dist/icons/heart.js +68 -0
  30. package/dist/node_modules/react-feather/dist/icons/message-circle.js +68 -0
  31. package/dist/node_modules/react-feather/dist/icons/message-square.js +68 -0
  32. package/dist/node_modules/react-feather/dist/icons/scissors.js +89 -0
  33. package/dist/node_modules/react-feather/dist/icons/smile.js +82 -0
  34. package/dist/node_modules/react-feather/dist/icons/thumbs-up.js +68 -0
  35. package/dist/node_modules/react-feather/dist/icons/zap.js +68 -0
  36. package/package.json +1 -1
  37. package/dist/components/TinyMceEditor/index.js +0 -181
  38. package/dist/components/TinyMceEditor/scrollStyle.js +0 -40
  39. package/dist/components/TinyMceEditor/useEditor.js +0 -120
  40. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/ScriptLoader2.js +0 -148
  41. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/TinyMCE.js +0 -7
  42. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/Utils.js +0 -103
  43. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/Editor.js +0 -353
  44. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/EditorPropTypes.js +0 -102
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * hanbiro-react16-sdk v1.0.22
3
- * Build Date: 2026-04-03
2
+ * hanbiro-react16-sdk v1.0.24
3
+ * Build Date: 2026-05-21
4
4
  */
5
5
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
6
  function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
@@ -35,7 +35,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
35
35
  })(this, function (exports2, React, ReactDOM) {
36
36
  "use strict";
37
37
 
38
- var _this0 = this;
38
+ var _this9 = this;
39
39
  var __defProp = Object.defineProperty;
40
40
  var __defProps = Object.defineProperties;
41
41
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -230,8 +230,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
230
230
  }
231
231
  var propTypesExports = propTypes.exports;
232
232
  var PropTypes = /* @__PURE__ */getDefaultExportFromCjs(propTypesExports);
233
- function _extends$2() {
234
- _extends$2 = Object.assign || function (target) {
233
+ function _extends$g() {
234
+ _extends$g = Object.assign || function (target) {
235
235
  for (var i = 1; i < arguments.length; i++) {
236
236
  var source = arguments[i];
237
237
  for (var key in source) {
@@ -242,11 +242,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
242
242
  }
243
243
  return target;
244
244
  };
245
- return _extends$2.apply(this, arguments);
245
+ return _extends$g.apply(this, arguments);
246
246
  }
247
- function _objectWithoutProperties$2(source, excluded) {
247
+ function _objectWithoutProperties$g(source, excluded) {
248
248
  if (source == null) return {};
249
- var target = _objectWithoutPropertiesLoose$2(source, excluded);
249
+ var target = _objectWithoutPropertiesLoose$g(source, excluded);
250
250
  var key, i;
251
251
  if (Object.getOwnPropertySymbols) {
252
252
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -259,7 +259,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
259
259
  }
260
260
  return target;
261
261
  }
262
- function _objectWithoutPropertiesLoose$2(source, excluded) {
262
+ function _objectWithoutPropertiesLoose$g(source, excluded) {
263
263
  if (source == null) return {};
264
264
  var target = {};
265
265
  var sourceKeys = Object.keys(source);
@@ -271,13 +271,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
271
271
  }
272
272
  return target;
273
273
  }
274
- var Copy = React.forwardRef(function (_ref, ref) {
274
+ var AlignJustify = React.forwardRef(function (_ref, ref) {
275
275
  var _ref$color = _ref.color,
276
276
  color = _ref$color === void 0 ? "currentColor" : _ref$color,
277
277
  _ref$size = _ref.size,
278
278
  size = _ref$size === void 0 ? 24 : _ref$size,
279
- rest = _objectWithoutProperties$2(_ref, ["color", "size"]);
280
- return /* @__PURE__ */React.createElement("svg", _extends$2({
279
+ rest = _objectWithoutProperties$g(_ref, ["color", "size"]);
280
+ return /* @__PURE__ */React.createElement("svg", _extends$g({
281
281
  ref: ref,
282
282
  xmlns: "http://www.w3.org/2000/svg",
283
283
  width: size,
@@ -288,24 +288,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
288
288
  strokeWidth: "2",
289
289
  strokeLinecap: "round",
290
290
  strokeLinejoin: "round"
291
- }, rest), /* @__PURE__ */React.createElement("rect", {
292
- x: "9",
293
- y: "9",
294
- width: "13",
295
- height: "13",
296
- rx: "2",
297
- ry: "2"
298
- }), /* @__PURE__ */React.createElement("path", {
299
- d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
291
+ }, rest), /* @__PURE__ */React.createElement("line", {
292
+ x1: "21",
293
+ y1: "10",
294
+ x2: "3",
295
+ y2: "10"
296
+ }), /* @__PURE__ */React.createElement("line", {
297
+ x1: "21",
298
+ y1: "6",
299
+ x2: "3",
300
+ y2: "6"
301
+ }), /* @__PURE__ */React.createElement("line", {
302
+ x1: "21",
303
+ y1: "14",
304
+ x2: "3",
305
+ y2: "14"
306
+ }), /* @__PURE__ */React.createElement("line", {
307
+ x1: "21",
308
+ y1: "18",
309
+ x2: "3",
310
+ y2: "18"
300
311
  }));
301
312
  });
302
- Copy.propTypes = {
313
+ AlignJustify.propTypes = {
303
314
  color: PropTypes.string,
304
315
  size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
305
316
  };
306
- Copy.displayName = "Copy";
307
- function _extends$1() {
308
- _extends$1 = Object.assign || function (target) {
317
+ AlignJustify.displayName = "AlignJustify";
318
+ function _extends$f() {
319
+ _extends$f = Object.assign || function (target) {
309
320
  for (var i = 1; i < arguments.length; i++) {
310
321
  var source = arguments[i];
311
322
  for (var key in source) {
@@ -316,11 +327,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
316
327
  }
317
328
  return target;
318
329
  };
319
- return _extends$1.apply(this, arguments);
330
+ return _extends$f.apply(this, arguments);
320
331
  }
321
- function _objectWithoutProperties$1(source, excluded) {
332
+ function _objectWithoutProperties$f(source, excluded) {
322
333
  if (source == null) return {};
323
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
334
+ var target = _objectWithoutPropertiesLoose$f(source, excluded);
324
335
  var key, i;
325
336
  if (Object.getOwnPropertySymbols) {
326
337
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -333,7 +344,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
333
344
  }
334
345
  return target;
335
346
  }
336
- function _objectWithoutPropertiesLoose$1(source, excluded) {
347
+ function _objectWithoutPropertiesLoose$f(source, excluded) {
337
348
  if (source == null) return {};
338
349
  var target = {};
339
350
  var sourceKeys = Object.keys(source);
@@ -345,13 +356,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
345
356
  }
346
357
  return target;
347
358
  }
348
- var Send = React.forwardRef(function (_ref, ref) {
359
+ var ArrowUp = React.forwardRef(function (_ref, ref) {
349
360
  var _ref$color = _ref.color,
350
361
  color = _ref$color === void 0 ? "currentColor" : _ref$color,
351
362
  _ref$size = _ref.size,
352
363
  size = _ref$size === void 0 ? 24 : _ref$size,
353
- rest = _objectWithoutProperties$1(_ref, ["color", "size"]);
354
- return /* @__PURE__ */React.createElement("svg", _extends$1({
364
+ rest = _objectWithoutProperties$f(_ref, ["color", "size"]);
365
+ return /* @__PURE__ */React.createElement("svg", _extends$f({
355
366
  ref: ref,
356
367
  xmlns: "http://www.w3.org/2000/svg",
357
368
  width: size,
@@ -363,21 +374,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
363
374
  strokeLinecap: "round",
364
375
  strokeLinejoin: "round"
365
376
  }, rest), /* @__PURE__ */React.createElement("line", {
366
- x1: "22",
367
- y1: "2",
368
- x2: "11",
369
- y2: "13"
370
- }), /* @__PURE__ */React.createElement("polygon", {
371
- points: "22 2 15 22 11 13 2 9 22 2"
377
+ x1: "12",
378
+ y1: "19",
379
+ x2: "12",
380
+ y2: "5"
381
+ }), /* @__PURE__ */React.createElement("polyline", {
382
+ points: "5 12 12 5 19 12"
372
383
  }));
373
384
  });
374
- Send.propTypes = {
385
+ ArrowUp.propTypes = {
375
386
  color: PropTypes.string,
376
387
  size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
377
388
  };
378
- Send.displayName = "Send";
379
- function _extends() {
380
- _extends = Object.assign || function (target) {
389
+ ArrowUp.displayName = "ArrowUp";
390
+ function _extends$e() {
391
+ _extends$e = Object.assign || function (target) {
381
392
  for (var i = 1; i < arguments.length; i++) {
382
393
  var source = arguments[i];
383
394
  for (var key in source) {
@@ -388,11 +399,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
388
399
  }
389
400
  return target;
390
401
  };
391
- return _extends.apply(this, arguments);
402
+ return _extends$e.apply(this, arguments);
392
403
  }
393
- function _objectWithoutProperties(source, excluded) {
404
+ function _objectWithoutProperties$e(source, excluded) {
394
405
  if (source == null) return {};
395
- var target = _objectWithoutPropertiesLoose(source, excluded);
406
+ var target = _objectWithoutPropertiesLoose$e(source, excluded);
396
407
  var key, i;
397
408
  if (Object.getOwnPropertySymbols) {
398
409
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -405,7 +416,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
405
416
  }
406
417
  return target;
407
418
  }
408
- function _objectWithoutPropertiesLoose(source, excluded) {
419
+ function _objectWithoutPropertiesLoose$e(source, excluded) {
409
420
  if (source == null) return {};
410
421
  var target = {};
411
422
  var sourceKeys = Object.keys(source);
@@ -417,13 +428,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
417
428
  }
418
429
  return target;
419
430
  }
420
- var Settings = React.forwardRef(function (_ref, ref) {
431
+ var Award = React.forwardRef(function (_ref, ref) {
421
432
  var _ref$color = _ref.color,
422
433
  color = _ref$color === void 0 ? "currentColor" : _ref$color,
423
434
  _ref$size = _ref.size,
424
435
  size = _ref$size === void 0 ? 24 : _ref$size,
425
- rest = _objectWithoutProperties(_ref, ["color", "size"]);
426
- return /* @__PURE__ */React.createElement("svg", _extends({
436
+ rest = _objectWithoutProperties$e(_ref, ["color", "size"]);
437
+ return /* @__PURE__ */React.createElement("svg", _extends$e({
427
438
  ref: ref,
428
439
  xmlns: "http://www.w3.org/2000/svg",
429
440
  width: size,
@@ -436,137 +447,1091 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
436
447
  strokeLinejoin: "round"
437
448
  }, rest), /* @__PURE__ */React.createElement("circle", {
438
449
  cx: "12",
439
- cy: "12",
440
- r: "3"
441
- }), /* @__PURE__ */React.createElement("path", {
442
- d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
450
+ cy: "8",
451
+ r: "7"
452
+ }), /* @__PURE__ */React.createElement("polyline", {
453
+ points: "8.21 13.89 7 23 12 20 17 23 15.79 13.88"
443
454
  }));
444
455
  });
445
- Settings.propTypes = {
456
+ Award.propTypes = {
446
457
  color: PropTypes.string,
447
458
  size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
448
459
  };
449
- Settings.displayName = "Settings";
450
- var CustomAiIcon = function CustomAiIcon(_ref2) {
451
- var _ref2$isGradient = _ref2.isGradient,
452
- isGradient = _ref2$isGradient === void 0 ? false : _ref2$isGradient,
453
- _ref2$stroke = _ref2.stroke,
454
- stroke = _ref2$stroke === void 0 ? 1.5 : _ref2$stroke,
455
- _ref2$size = _ref2.size,
456
- size = _ref2$size === void 0 ? 40 : _ref2$size;
457
- var gradientId = "ai-gradient-" + Math.random().toString(36).substr(2, 9);
458
- return /* @__PURE__ */React__namespace.createElement("svg", {
460
+ Award.displayName = "Award";
461
+ function _extends$d() {
462
+ _extends$d = Object.assign || function (target) {
463
+ for (var i = 1; i < arguments.length; i++) {
464
+ var source = arguments[i];
465
+ for (var key in source) {
466
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
467
+ target[key] = source[key];
468
+ }
469
+ }
470
+ }
471
+ return target;
472
+ };
473
+ return _extends$d.apply(this, arguments);
474
+ }
475
+ function _objectWithoutProperties$d(source, excluded) {
476
+ if (source == null) return {};
477
+ var target = _objectWithoutPropertiesLoose$d(source, excluded);
478
+ var key, i;
479
+ if (Object.getOwnPropertySymbols) {
480
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
481
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
482
+ key = sourceSymbolKeys[i];
483
+ if (excluded.indexOf(key) >= 0) continue;
484
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
485
+ target[key] = source[key];
486
+ }
487
+ }
488
+ return target;
489
+ }
490
+ function _objectWithoutPropertiesLoose$d(source, excluded) {
491
+ if (source == null) return {};
492
+ var target = {};
493
+ var sourceKeys = Object.keys(source);
494
+ var key, i;
495
+ for (i = 0; i < sourceKeys.length; i++) {
496
+ key = sourceKeys[i];
497
+ if (excluded.indexOf(key) >= 0) continue;
498
+ target[key] = source[key];
499
+ }
500
+ return target;
501
+ }
502
+ var Check = React.forwardRef(function (_ref, ref) {
503
+ var _ref$color = _ref.color,
504
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
505
+ _ref$size = _ref.size,
506
+ size = _ref$size === void 0 ? 24 : _ref$size,
507
+ rest = _objectWithoutProperties$d(_ref, ["color", "size"]);
508
+ return /* @__PURE__ */React.createElement("svg", _extends$d({
509
+ ref: ref,
459
510
  xmlns: "http://www.w3.org/2000/svg",
460
511
  width: size,
461
512
  height: size,
462
513
  viewBox: "0 0 24 24",
463
- style: {
464
- flexShrink: 0
465
- }
466
- }, isGradient && /* @__PURE__ */React__namespace.createElement("defs", null, /* @__PURE__ */React__namespace.createElement("linearGradient", {
467
- id: gradientId,
468
- x1: "0%",
469
- y1: "0%",
470
- x2: "0%",
471
- y2: "100%"
472
- }, /* @__PURE__ */React__namespace.createElement("stop", {
473
- offset: "0%",
474
- stopColor: "#9D50BB"
475
- }, /* @__PURE__ */React__namespace.createElement("animate", {
476
- attributeName: "offset",
477
- values: "0%;0.4;0%",
478
- dur: "1s",
479
- repeatCount: "indefinite"
480
- })), /* @__PURE__ */React__namespace.createElement("stop", {
481
- offset: "30%",
482
- stopColor: "#6E48AA"
483
- }, /* @__PURE__ */React__namespace.createElement("animate", {
484
- attributeName: "offset",
485
- values: "0.4;0.7;0.4",
486
- dur: "1s",
487
- repeatCount: "indefinite"
488
- })), /* @__PURE__ */React__namespace.createElement("stop", {
489
- offset: "50%",
490
- stopColor: "#4776E6"
491
- }, /* @__PURE__ */React__namespace.createElement("animate", {
492
- attributeName: "offset",
493
- values: "0.5;0.7;0.5",
494
- dur: "1s",
495
- repeatCount: "indefinite"
496
- })), /* @__PURE__ */React__namespace.createElement("animateTransform", {
497
- attributeName: "gradientTransform",
498
- type: "translate",
499
- from: "0,0",
500
- to: "100,0",
501
- dur: "1s",
502
- repeatCount: "indefinite"
503
- }))), /* @__PURE__ */React__namespace.createElement("path", {
504
514
  fill: "none",
505
- stroke: isGradient ? "url(#".concat(gradientId, ")") : "currentColor",
515
+ stroke: color,
516
+ strokeWidth: "2",
506
517
  strokeLinecap: "round",
507
- strokeLinejoin: "round",
508
- strokeWidth: stroke,
509
- d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"
518
+ strokeLinejoin: "round"
519
+ }, rest), /* @__PURE__ */React.createElement("polyline", {
520
+ points: "20 6 9 17 4 12"
510
521
  }));
522
+ });
523
+ Check.propTypes = {
524
+ color: PropTypes.string,
525
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
511
526
  };
512
- var SDKConfig = {
513
- baseUrl: "V3",
514
- signer: null
515
- };
516
- var initHanbiroReactSDK = function initHanbiroReactSDK(_ref3) {
517
- var baseUrl = _ref3.baseUrl,
518
- signer = _ref3.signer;
519
- SDKConfig.baseUrl = baseUrl;
520
- SDKConfig.signer = signer;
521
- };
522
- var checkDevelopment = function checkDevelopment() {
523
- var locationInfo = window.location;
524
- var hostname = locationInfo.hostname;
525
- if (hostname === "localhost" || hostname === "127.0.0.1") {
526
- return true;
527
- } else {
528
- return false;
529
- }
530
- };
531
- var isDevelopment = checkDevelopment();
532
- var getBaseUrl = function getBaseUrl() {
533
- var _a2;
534
- var locationInfo = window.location;
535
- var host = locationInfo.host;
536
- if (isDevelopment) {
537
- var baseUrlArr = (_a2 = SDKConfig.baseUrl) == null ? void 0 : _a2.split("/");
538
- if (baseUrlArr) {
539
- return "https://" + (baseUrlArr == null ? void 0 : baseUrlArr[2]);
540
- } else {
541
- return "https://vndev.hanbiro.com";
527
+ Check.displayName = "Check";
528
+ function _extends$c() {
529
+ _extends$c = Object.assign || function (target) {
530
+ for (var i = 1; i < arguments.length; i++) {
531
+ var source = arguments[i];
532
+ for (var key in source) {
533
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
534
+ target[key] = source[key];
535
+ }
536
+ }
542
537
  }
543
- } else {
544
- var data = localStorage.getItem("host") || host;
545
- var dataArr = data == null ? void 0 : data.split("/");
546
- return "https://" + (dataArr == null ? void 0 : dataArr[0]);
538
+ return target;
539
+ };
540
+ return _extends$c.apply(this, arguments);
541
+ }
542
+ function _objectWithoutProperties$c(source, excluded) {
543
+ if (source == null) return {};
544
+ var target = _objectWithoutPropertiesLoose$c(source, excluded);
545
+ var key, i;
546
+ if (Object.getOwnPropertySymbols) {
547
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
548
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
549
+ key = sourceSymbolKeys[i];
550
+ if (excluded.indexOf(key) >= 0) continue;
551
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
552
+ target[key] = source[key];
553
+ }
554
+ }
555
+ return target;
556
+ }
557
+ function _objectWithoutPropertiesLoose$c(source, excluded) {
558
+ if (source == null) return {};
559
+ var target = {};
560
+ var sourceKeys = Object.keys(source);
561
+ var key, i;
562
+ for (i = 0; i < sourceKeys.length; i++) {
563
+ key = sourceKeys[i];
564
+ if (excluded.indexOf(key) >= 0) continue;
565
+ target[key] = source[key];
547
566
  }
567
+ return target;
568
+ }
569
+ var ChevronDown = React.forwardRef(function (_ref, ref) {
570
+ var _ref$color = _ref.color,
571
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
572
+ _ref$size = _ref.size,
573
+ size = _ref$size === void 0 ? 24 : _ref$size,
574
+ rest = _objectWithoutProperties$c(_ref, ["color", "size"]);
575
+ return /* @__PURE__ */React.createElement("svg", _extends$c({
576
+ ref: ref,
577
+ xmlns: "http://www.w3.org/2000/svg",
578
+ width: size,
579
+ height: size,
580
+ viewBox: "0 0 24 24",
581
+ fill: "none",
582
+ stroke: color,
583
+ strokeWidth: "2",
584
+ strokeLinecap: "round",
585
+ strokeLinejoin: "round"
586
+ }, rest), /* @__PURE__ */React.createElement("polyline", {
587
+ points: "6 9 12 15 18 9"
588
+ }));
589
+ });
590
+ ChevronDown.propTypes = {
591
+ color: PropTypes.string,
592
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
548
593
  };
549
- var getGroupwareUrl = function getGroupwareUrl() {
550
- var locationInfo = window.location;
551
- if (isDevelopment) {
552
- return getBaseUrl() || "https://vndev.hanbiro.com/ngw";
553
- } else {
554
- if (window.location !== window.parent.location) {
555
- locationInfo = window.parent.location;
594
+ ChevronDown.displayName = "ChevronDown";
595
+ function _extends$b() {
596
+ _extends$b = Object.assign || function (target) {
597
+ for (var i = 1; i < arguments.length; i++) {
598
+ var source = arguments[i];
599
+ for (var key in source) {
600
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
601
+ target[key] = source[key];
602
+ }
603
+ }
604
+ }
605
+ return target;
606
+ };
607
+ return _extends$b.apply(this, arguments);
608
+ }
609
+ function _objectWithoutProperties$b(source, excluded) {
610
+ if (source == null) return {};
611
+ var target = _objectWithoutPropertiesLoose$b(source, excluded);
612
+ var key, i;
613
+ if (Object.getOwnPropertySymbols) {
614
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
615
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
616
+ key = sourceSymbolKeys[i];
617
+ if (excluded.indexOf(key) >= 0) continue;
618
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
619
+ target[key] = source[key];
556
620
  }
557
- var _locationInfo = locationInfo,
558
- hostname = _locationInfo.hostname,
559
- protocol = _locationInfo.protocol;
560
- return [protocol, "//", hostname, "/ngw"].join("");
561
621
  }
562
- };
563
- function callAI(_0, _1) {
564
- return __async(this, arguments, function (params, _ref4) {
565
- var setContent = _ref4.setContent,
566
- setIsLoading = _ref4.setIsLoading,
567
- setConversationId = _ref4.setConversationId;
568
- return /*#__PURE__*/_regenerator().m(function _callee() {
569
- var currentContent, baseUrl, config, sigHeaders, signer, response, reader, fullContentDecode, readIndex, _yield$reader$read, done, value, originStr, jsonFormat, contentDecode, contentRegex, conversationIdRegex, matchArray, conversationIdmatch, _regMatchItem, nVal, decoded, _t;
622
+ return target;
623
+ }
624
+ function _objectWithoutPropertiesLoose$b(source, excluded) {
625
+ if (source == null) return {};
626
+ var target = {};
627
+ var sourceKeys = Object.keys(source);
628
+ var key, i;
629
+ for (i = 0; i < sourceKeys.length; i++) {
630
+ key = sourceKeys[i];
631
+ if (excluded.indexOf(key) >= 0) continue;
632
+ target[key] = source[key];
633
+ }
634
+ return target;
635
+ }
636
+ var Compass = React.forwardRef(function (_ref, ref) {
637
+ var _ref$color = _ref.color,
638
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
639
+ _ref$size = _ref.size,
640
+ size = _ref$size === void 0 ? 24 : _ref$size,
641
+ rest = _objectWithoutProperties$b(_ref, ["color", "size"]);
642
+ return /* @__PURE__ */React.createElement("svg", _extends$b({
643
+ ref: ref,
644
+ xmlns: "http://www.w3.org/2000/svg",
645
+ width: size,
646
+ height: size,
647
+ viewBox: "0 0 24 24",
648
+ fill: "none",
649
+ stroke: color,
650
+ strokeWidth: "2",
651
+ strokeLinecap: "round",
652
+ strokeLinejoin: "round"
653
+ }, rest), /* @__PURE__ */React.createElement("circle", {
654
+ cx: "12",
655
+ cy: "12",
656
+ r: "10"
657
+ }), /* @__PURE__ */React.createElement("polygon", {
658
+ points: "16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"
659
+ }));
660
+ });
661
+ Compass.propTypes = {
662
+ color: PropTypes.string,
663
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
664
+ };
665
+ Compass.displayName = "Compass";
666
+ function _extends$a() {
667
+ _extends$a = Object.assign || function (target) {
668
+ for (var i = 1; i < arguments.length; i++) {
669
+ var source = arguments[i];
670
+ for (var key in source) {
671
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
672
+ target[key] = source[key];
673
+ }
674
+ }
675
+ }
676
+ return target;
677
+ };
678
+ return _extends$a.apply(this, arguments);
679
+ }
680
+ function _objectWithoutProperties$a(source, excluded) {
681
+ if (source == null) return {};
682
+ var target = _objectWithoutPropertiesLoose$a(source, excluded);
683
+ var key, i;
684
+ if (Object.getOwnPropertySymbols) {
685
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
686
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
687
+ key = sourceSymbolKeys[i];
688
+ if (excluded.indexOf(key) >= 0) continue;
689
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
690
+ target[key] = source[key];
691
+ }
692
+ }
693
+ return target;
694
+ }
695
+ function _objectWithoutPropertiesLoose$a(source, excluded) {
696
+ if (source == null) return {};
697
+ var target = {};
698
+ var sourceKeys = Object.keys(source);
699
+ var key, i;
700
+ for (i = 0; i < sourceKeys.length; i++) {
701
+ key = sourceKeys[i];
702
+ if (excluded.indexOf(key) >= 0) continue;
703
+ target[key] = source[key];
704
+ }
705
+ return target;
706
+ }
707
+ var Copy = React.forwardRef(function (_ref, ref) {
708
+ var _ref$color = _ref.color,
709
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
710
+ _ref$size = _ref.size,
711
+ size = _ref$size === void 0 ? 24 : _ref$size,
712
+ rest = _objectWithoutProperties$a(_ref, ["color", "size"]);
713
+ return /* @__PURE__ */React.createElement("svg", _extends$a({
714
+ ref: ref,
715
+ xmlns: "http://www.w3.org/2000/svg",
716
+ width: size,
717
+ height: size,
718
+ viewBox: "0 0 24 24",
719
+ fill: "none",
720
+ stroke: color,
721
+ strokeWidth: "2",
722
+ strokeLinecap: "round",
723
+ strokeLinejoin: "round"
724
+ }, rest), /* @__PURE__ */React.createElement("rect", {
725
+ x: "9",
726
+ y: "9",
727
+ width: "13",
728
+ height: "13",
729
+ rx: "2",
730
+ ry: "2"
731
+ }), /* @__PURE__ */React.createElement("path", {
732
+ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
733
+ }));
734
+ });
735
+ Copy.propTypes = {
736
+ color: PropTypes.string,
737
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
738
+ };
739
+ Copy.displayName = "Copy";
740
+ function _extends$9() {
741
+ _extends$9 = Object.assign || function (target) {
742
+ for (var i = 1; i < arguments.length; i++) {
743
+ var source = arguments[i];
744
+ for (var key in source) {
745
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
746
+ target[key] = source[key];
747
+ }
748
+ }
749
+ }
750
+ return target;
751
+ };
752
+ return _extends$9.apply(this, arguments);
753
+ }
754
+ function _objectWithoutProperties$9(source, excluded) {
755
+ if (source == null) return {};
756
+ var target = _objectWithoutPropertiesLoose$9(source, excluded);
757
+ var key, i;
758
+ if (Object.getOwnPropertySymbols) {
759
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
760
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
761
+ key = sourceSymbolKeys[i];
762
+ if (excluded.indexOf(key) >= 0) continue;
763
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
764
+ target[key] = source[key];
765
+ }
766
+ }
767
+ return target;
768
+ }
769
+ function _objectWithoutPropertiesLoose$9(source, excluded) {
770
+ if (source == null) return {};
771
+ var target = {};
772
+ var sourceKeys = Object.keys(source);
773
+ var key, i;
774
+ for (i = 0; i < sourceKeys.length; i++) {
775
+ key = sourceKeys[i];
776
+ if (excluded.indexOf(key) >= 0) continue;
777
+ target[key] = source[key];
778
+ }
779
+ return target;
780
+ }
781
+ var FileText = React.forwardRef(function (_ref, ref) {
782
+ var _ref$color = _ref.color,
783
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
784
+ _ref$size = _ref.size,
785
+ size = _ref$size === void 0 ? 24 : _ref$size,
786
+ rest = _objectWithoutProperties$9(_ref, ["color", "size"]);
787
+ return /* @__PURE__ */React.createElement("svg", _extends$9({
788
+ ref: ref,
789
+ xmlns: "http://www.w3.org/2000/svg",
790
+ width: size,
791
+ height: size,
792
+ viewBox: "0 0 24 24",
793
+ fill: "none",
794
+ stroke: color,
795
+ strokeWidth: "2",
796
+ strokeLinecap: "round",
797
+ strokeLinejoin: "round"
798
+ }, rest), /* @__PURE__ */React.createElement("path", {
799
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"
800
+ }), /* @__PURE__ */React.createElement("polyline", {
801
+ points: "14 2 14 8 20 8"
802
+ }), /* @__PURE__ */React.createElement("line", {
803
+ x1: "16",
804
+ y1: "13",
805
+ x2: "8",
806
+ y2: "13"
807
+ }), /* @__PURE__ */React.createElement("line", {
808
+ x1: "16",
809
+ y1: "17",
810
+ x2: "8",
811
+ y2: "17"
812
+ }), /* @__PURE__ */React.createElement("polyline", {
813
+ points: "10 9 9 9 8 9"
814
+ }));
815
+ });
816
+ FileText.propTypes = {
817
+ color: PropTypes.string,
818
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
819
+ };
820
+ FileText.displayName = "FileText";
821
+ function _extends$8() {
822
+ _extends$8 = Object.assign || function (target) {
823
+ for (var i = 1; i < arguments.length; i++) {
824
+ var source = arguments[i];
825
+ for (var key in source) {
826
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
827
+ target[key] = source[key];
828
+ }
829
+ }
830
+ }
831
+ return target;
832
+ };
833
+ return _extends$8.apply(this, arguments);
834
+ }
835
+ function _objectWithoutProperties$8(source, excluded) {
836
+ if (source == null) return {};
837
+ var target = _objectWithoutPropertiesLoose$8(source, excluded);
838
+ var key, i;
839
+ if (Object.getOwnPropertySymbols) {
840
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
841
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
842
+ key = sourceSymbolKeys[i];
843
+ if (excluded.indexOf(key) >= 0) continue;
844
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
845
+ target[key] = source[key];
846
+ }
847
+ }
848
+ return target;
849
+ }
850
+ function _objectWithoutPropertiesLoose$8(source, excluded) {
851
+ if (source == null) return {};
852
+ var target = {};
853
+ var sourceKeys = Object.keys(source);
854
+ var key, i;
855
+ for (i = 0; i < sourceKeys.length; i++) {
856
+ key = sourceKeys[i];
857
+ if (excluded.indexOf(key) >= 0) continue;
858
+ target[key] = source[key];
859
+ }
860
+ return target;
861
+ }
862
+ var Frown = React.forwardRef(function (_ref, ref) {
863
+ var _ref$color = _ref.color,
864
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
865
+ _ref$size = _ref.size,
866
+ size = _ref$size === void 0 ? 24 : _ref$size,
867
+ rest = _objectWithoutProperties$8(_ref, ["color", "size"]);
868
+ return /* @__PURE__ */React.createElement("svg", _extends$8({
869
+ ref: ref,
870
+ xmlns: "http://www.w3.org/2000/svg",
871
+ width: size,
872
+ height: size,
873
+ viewBox: "0 0 24 24",
874
+ fill: "none",
875
+ stroke: color,
876
+ strokeWidth: "2",
877
+ strokeLinecap: "round",
878
+ strokeLinejoin: "round"
879
+ }, rest), /* @__PURE__ */React.createElement("circle", {
880
+ cx: "12",
881
+ cy: "12",
882
+ r: "10"
883
+ }), /* @__PURE__ */React.createElement("path", {
884
+ d: "M16 16s-1.5-2-4-2-4 2-4 2"
885
+ }), /* @__PURE__ */React.createElement("line", {
886
+ x1: "9",
887
+ y1: "9",
888
+ x2: "9.01",
889
+ y2: "9"
890
+ }), /* @__PURE__ */React.createElement("line", {
891
+ x1: "15",
892
+ y1: "9",
893
+ x2: "15.01",
894
+ y2: "9"
895
+ }));
896
+ });
897
+ Frown.propTypes = {
898
+ color: PropTypes.string,
899
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
900
+ };
901
+ Frown.displayName = "Frown";
902
+ function _extends$7() {
903
+ _extends$7 = Object.assign || function (target) {
904
+ for (var i = 1; i < arguments.length; i++) {
905
+ var source = arguments[i];
906
+ for (var key in source) {
907
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
908
+ target[key] = source[key];
909
+ }
910
+ }
911
+ }
912
+ return target;
913
+ };
914
+ return _extends$7.apply(this, arguments);
915
+ }
916
+ function _objectWithoutProperties$7(source, excluded) {
917
+ if (source == null) return {};
918
+ var target = _objectWithoutPropertiesLoose$7(source, excluded);
919
+ var key, i;
920
+ if (Object.getOwnPropertySymbols) {
921
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
922
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
923
+ key = sourceSymbolKeys[i];
924
+ if (excluded.indexOf(key) >= 0) continue;
925
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
926
+ target[key] = source[key];
927
+ }
928
+ }
929
+ return target;
930
+ }
931
+ function _objectWithoutPropertiesLoose$7(source, excluded) {
932
+ if (source == null) return {};
933
+ var target = {};
934
+ var sourceKeys = Object.keys(source);
935
+ var key, i;
936
+ for (i = 0; i < sourceKeys.length; i++) {
937
+ key = sourceKeys[i];
938
+ if (excluded.indexOf(key) >= 0) continue;
939
+ target[key] = source[key];
940
+ }
941
+ return target;
942
+ }
943
+ var Heart = React.forwardRef(function (_ref, ref) {
944
+ var _ref$color = _ref.color,
945
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
946
+ _ref$size = _ref.size,
947
+ size = _ref$size === void 0 ? 24 : _ref$size,
948
+ rest = _objectWithoutProperties$7(_ref, ["color", "size"]);
949
+ return /* @__PURE__ */React.createElement("svg", _extends$7({
950
+ ref: ref,
951
+ xmlns: "http://www.w3.org/2000/svg",
952
+ width: size,
953
+ height: size,
954
+ viewBox: "0 0 24 24",
955
+ fill: "none",
956
+ stroke: color,
957
+ strokeWidth: "2",
958
+ strokeLinecap: "round",
959
+ strokeLinejoin: "round"
960
+ }, rest), /* @__PURE__ */React.createElement("path", {
961
+ d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"
962
+ }));
963
+ });
964
+ Heart.propTypes = {
965
+ color: PropTypes.string,
966
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
967
+ };
968
+ Heart.displayName = "Heart";
969
+ function _extends$6() {
970
+ _extends$6 = Object.assign || function (target) {
971
+ for (var i = 1; i < arguments.length; i++) {
972
+ var source = arguments[i];
973
+ for (var key in source) {
974
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
975
+ target[key] = source[key];
976
+ }
977
+ }
978
+ }
979
+ return target;
980
+ };
981
+ return _extends$6.apply(this, arguments);
982
+ }
983
+ function _objectWithoutProperties$6(source, excluded) {
984
+ if (source == null) return {};
985
+ var target = _objectWithoutPropertiesLoose$6(source, excluded);
986
+ var key, i;
987
+ if (Object.getOwnPropertySymbols) {
988
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
989
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
990
+ key = sourceSymbolKeys[i];
991
+ if (excluded.indexOf(key) >= 0) continue;
992
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
993
+ target[key] = source[key];
994
+ }
995
+ }
996
+ return target;
997
+ }
998
+ function _objectWithoutPropertiesLoose$6(source, excluded) {
999
+ if (source == null) return {};
1000
+ var target = {};
1001
+ var sourceKeys = Object.keys(source);
1002
+ var key, i;
1003
+ for (i = 0; i < sourceKeys.length; i++) {
1004
+ key = sourceKeys[i];
1005
+ if (excluded.indexOf(key) >= 0) continue;
1006
+ target[key] = source[key];
1007
+ }
1008
+ return target;
1009
+ }
1010
+ var MessageCircle = React.forwardRef(function (_ref, ref) {
1011
+ var _ref$color = _ref.color,
1012
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1013
+ _ref$size = _ref.size,
1014
+ size = _ref$size === void 0 ? 24 : _ref$size,
1015
+ rest = _objectWithoutProperties$6(_ref, ["color", "size"]);
1016
+ return /* @__PURE__ */React.createElement("svg", _extends$6({
1017
+ ref: ref,
1018
+ xmlns: "http://www.w3.org/2000/svg",
1019
+ width: size,
1020
+ height: size,
1021
+ viewBox: "0 0 24 24",
1022
+ fill: "none",
1023
+ stroke: color,
1024
+ strokeWidth: "2",
1025
+ strokeLinecap: "round",
1026
+ strokeLinejoin: "round"
1027
+ }, rest), /* @__PURE__ */React.createElement("path", {
1028
+ d: "M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"
1029
+ }));
1030
+ });
1031
+ MessageCircle.propTypes = {
1032
+ color: PropTypes.string,
1033
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1034
+ };
1035
+ MessageCircle.displayName = "MessageCircle";
1036
+ function _extends$5() {
1037
+ _extends$5 = Object.assign || function (target) {
1038
+ for (var i = 1; i < arguments.length; i++) {
1039
+ var source = arguments[i];
1040
+ for (var key in source) {
1041
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1042
+ target[key] = source[key];
1043
+ }
1044
+ }
1045
+ }
1046
+ return target;
1047
+ };
1048
+ return _extends$5.apply(this, arguments);
1049
+ }
1050
+ function _objectWithoutProperties$5(source, excluded) {
1051
+ if (source == null) return {};
1052
+ var target = _objectWithoutPropertiesLoose$5(source, excluded);
1053
+ var key, i;
1054
+ if (Object.getOwnPropertySymbols) {
1055
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1056
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1057
+ key = sourceSymbolKeys[i];
1058
+ if (excluded.indexOf(key) >= 0) continue;
1059
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1060
+ target[key] = source[key];
1061
+ }
1062
+ }
1063
+ return target;
1064
+ }
1065
+ function _objectWithoutPropertiesLoose$5(source, excluded) {
1066
+ if (source == null) return {};
1067
+ var target = {};
1068
+ var sourceKeys = Object.keys(source);
1069
+ var key, i;
1070
+ for (i = 0; i < sourceKeys.length; i++) {
1071
+ key = sourceKeys[i];
1072
+ if (excluded.indexOf(key) >= 0) continue;
1073
+ target[key] = source[key];
1074
+ }
1075
+ return target;
1076
+ }
1077
+ var MessageSquare = React.forwardRef(function (_ref, ref) {
1078
+ var _ref$color = _ref.color,
1079
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1080
+ _ref$size = _ref.size,
1081
+ size = _ref$size === void 0 ? 24 : _ref$size,
1082
+ rest = _objectWithoutProperties$5(_ref, ["color", "size"]);
1083
+ return /* @__PURE__ */React.createElement("svg", _extends$5({
1084
+ ref: ref,
1085
+ xmlns: "http://www.w3.org/2000/svg",
1086
+ width: size,
1087
+ height: size,
1088
+ viewBox: "0 0 24 24",
1089
+ fill: "none",
1090
+ stroke: color,
1091
+ strokeWidth: "2",
1092
+ strokeLinecap: "round",
1093
+ strokeLinejoin: "round"
1094
+ }, rest), /* @__PURE__ */React.createElement("path", {
1095
+ d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
1096
+ }));
1097
+ });
1098
+ MessageSquare.propTypes = {
1099
+ color: PropTypes.string,
1100
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1101
+ };
1102
+ MessageSquare.displayName = "MessageSquare";
1103
+ function _extends$4() {
1104
+ _extends$4 = Object.assign || function (target) {
1105
+ for (var i = 1; i < arguments.length; i++) {
1106
+ var source = arguments[i];
1107
+ for (var key in source) {
1108
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1109
+ target[key] = source[key];
1110
+ }
1111
+ }
1112
+ }
1113
+ return target;
1114
+ };
1115
+ return _extends$4.apply(this, arguments);
1116
+ }
1117
+ function _objectWithoutProperties$4(source, excluded) {
1118
+ if (source == null) return {};
1119
+ var target = _objectWithoutPropertiesLoose$4(source, excluded);
1120
+ var key, i;
1121
+ if (Object.getOwnPropertySymbols) {
1122
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1123
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1124
+ key = sourceSymbolKeys[i];
1125
+ if (excluded.indexOf(key) >= 0) continue;
1126
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1127
+ target[key] = source[key];
1128
+ }
1129
+ }
1130
+ return target;
1131
+ }
1132
+ function _objectWithoutPropertiesLoose$4(source, excluded) {
1133
+ if (source == null) return {};
1134
+ var target = {};
1135
+ var sourceKeys = Object.keys(source);
1136
+ var key, i;
1137
+ for (i = 0; i < sourceKeys.length; i++) {
1138
+ key = sourceKeys[i];
1139
+ if (excluded.indexOf(key) >= 0) continue;
1140
+ target[key] = source[key];
1141
+ }
1142
+ return target;
1143
+ }
1144
+ var Scissors = React.forwardRef(function (_ref, ref) {
1145
+ var _ref$color = _ref.color,
1146
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1147
+ _ref$size = _ref.size,
1148
+ size = _ref$size === void 0 ? 24 : _ref$size,
1149
+ rest = _objectWithoutProperties$4(_ref, ["color", "size"]);
1150
+ return /* @__PURE__ */React.createElement("svg", _extends$4({
1151
+ ref: ref,
1152
+ xmlns: "http://www.w3.org/2000/svg",
1153
+ width: size,
1154
+ height: size,
1155
+ viewBox: "0 0 24 24",
1156
+ fill: "none",
1157
+ stroke: color,
1158
+ strokeWidth: "2",
1159
+ strokeLinecap: "round",
1160
+ strokeLinejoin: "round"
1161
+ }, rest), /* @__PURE__ */React.createElement("circle", {
1162
+ cx: "6",
1163
+ cy: "6",
1164
+ r: "3"
1165
+ }), /* @__PURE__ */React.createElement("circle", {
1166
+ cx: "6",
1167
+ cy: "18",
1168
+ r: "3"
1169
+ }), /* @__PURE__ */React.createElement("line", {
1170
+ x1: "20",
1171
+ y1: "4",
1172
+ x2: "8.12",
1173
+ y2: "15.88"
1174
+ }), /* @__PURE__ */React.createElement("line", {
1175
+ x1: "14.47",
1176
+ y1: "14.48",
1177
+ x2: "20",
1178
+ y2: "20"
1179
+ }), /* @__PURE__ */React.createElement("line", {
1180
+ x1: "8.12",
1181
+ y1: "8.12",
1182
+ x2: "12",
1183
+ y2: "12"
1184
+ }));
1185
+ });
1186
+ Scissors.propTypes = {
1187
+ color: PropTypes.string,
1188
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1189
+ };
1190
+ Scissors.displayName = "Scissors";
1191
+ function _extends$3() {
1192
+ _extends$3 = Object.assign || function (target) {
1193
+ for (var i = 1; i < arguments.length; i++) {
1194
+ var source = arguments[i];
1195
+ for (var key in source) {
1196
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1197
+ target[key] = source[key];
1198
+ }
1199
+ }
1200
+ }
1201
+ return target;
1202
+ };
1203
+ return _extends$3.apply(this, arguments);
1204
+ }
1205
+ function _objectWithoutProperties$3(source, excluded) {
1206
+ if (source == null) return {};
1207
+ var target = _objectWithoutPropertiesLoose$3(source, excluded);
1208
+ var key, i;
1209
+ if (Object.getOwnPropertySymbols) {
1210
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1211
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1212
+ key = sourceSymbolKeys[i];
1213
+ if (excluded.indexOf(key) >= 0) continue;
1214
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1215
+ target[key] = source[key];
1216
+ }
1217
+ }
1218
+ return target;
1219
+ }
1220
+ function _objectWithoutPropertiesLoose$3(source, excluded) {
1221
+ if (source == null) return {};
1222
+ var target = {};
1223
+ var sourceKeys = Object.keys(source);
1224
+ var key, i;
1225
+ for (i = 0; i < sourceKeys.length; i++) {
1226
+ key = sourceKeys[i];
1227
+ if (excluded.indexOf(key) >= 0) continue;
1228
+ target[key] = source[key];
1229
+ }
1230
+ return target;
1231
+ }
1232
+ var Settings = React.forwardRef(function (_ref, ref) {
1233
+ var _ref$color = _ref.color,
1234
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1235
+ _ref$size = _ref.size,
1236
+ size = _ref$size === void 0 ? 24 : _ref$size,
1237
+ rest = _objectWithoutProperties$3(_ref, ["color", "size"]);
1238
+ return /* @__PURE__ */React.createElement("svg", _extends$3({
1239
+ ref: ref,
1240
+ xmlns: "http://www.w3.org/2000/svg",
1241
+ width: size,
1242
+ height: size,
1243
+ viewBox: "0 0 24 24",
1244
+ fill: "none",
1245
+ stroke: color,
1246
+ strokeWidth: "2",
1247
+ strokeLinecap: "round",
1248
+ strokeLinejoin: "round"
1249
+ }, rest), /* @__PURE__ */React.createElement("circle", {
1250
+ cx: "12",
1251
+ cy: "12",
1252
+ r: "3"
1253
+ }), /* @__PURE__ */React.createElement("path", {
1254
+ d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
1255
+ }));
1256
+ });
1257
+ Settings.propTypes = {
1258
+ color: PropTypes.string,
1259
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1260
+ };
1261
+ Settings.displayName = "Settings";
1262
+ function _extends$2() {
1263
+ _extends$2 = Object.assign || function (target) {
1264
+ for (var i = 1; i < arguments.length; i++) {
1265
+ var source = arguments[i];
1266
+ for (var key in source) {
1267
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1268
+ target[key] = source[key];
1269
+ }
1270
+ }
1271
+ }
1272
+ return target;
1273
+ };
1274
+ return _extends$2.apply(this, arguments);
1275
+ }
1276
+ function _objectWithoutProperties$2(source, excluded) {
1277
+ if (source == null) return {};
1278
+ var target = _objectWithoutPropertiesLoose$2(source, excluded);
1279
+ var key, i;
1280
+ if (Object.getOwnPropertySymbols) {
1281
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1282
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1283
+ key = sourceSymbolKeys[i];
1284
+ if (excluded.indexOf(key) >= 0) continue;
1285
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1286
+ target[key] = source[key];
1287
+ }
1288
+ }
1289
+ return target;
1290
+ }
1291
+ function _objectWithoutPropertiesLoose$2(source, excluded) {
1292
+ if (source == null) return {};
1293
+ var target = {};
1294
+ var sourceKeys = Object.keys(source);
1295
+ var key, i;
1296
+ for (i = 0; i < sourceKeys.length; i++) {
1297
+ key = sourceKeys[i];
1298
+ if (excluded.indexOf(key) >= 0) continue;
1299
+ target[key] = source[key];
1300
+ }
1301
+ return target;
1302
+ }
1303
+ var Smile = React.forwardRef(function (_ref, ref) {
1304
+ var _ref$color = _ref.color,
1305
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1306
+ _ref$size = _ref.size,
1307
+ size = _ref$size === void 0 ? 24 : _ref$size,
1308
+ rest = _objectWithoutProperties$2(_ref, ["color", "size"]);
1309
+ return /* @__PURE__ */React.createElement("svg", _extends$2({
1310
+ ref: ref,
1311
+ xmlns: "http://www.w3.org/2000/svg",
1312
+ width: size,
1313
+ height: size,
1314
+ viewBox: "0 0 24 24",
1315
+ fill: "none",
1316
+ stroke: color,
1317
+ strokeWidth: "2",
1318
+ strokeLinecap: "round",
1319
+ strokeLinejoin: "round"
1320
+ }, rest), /* @__PURE__ */React.createElement("circle", {
1321
+ cx: "12",
1322
+ cy: "12",
1323
+ r: "10"
1324
+ }), /* @__PURE__ */React.createElement("path", {
1325
+ d: "M8 14s1.5 2 4 2 4-2 4-2"
1326
+ }), /* @__PURE__ */React.createElement("line", {
1327
+ x1: "9",
1328
+ y1: "9",
1329
+ x2: "9.01",
1330
+ y2: "9"
1331
+ }), /* @__PURE__ */React.createElement("line", {
1332
+ x1: "15",
1333
+ y1: "9",
1334
+ x2: "15.01",
1335
+ y2: "9"
1336
+ }));
1337
+ });
1338
+ Smile.propTypes = {
1339
+ color: PropTypes.string,
1340
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1341
+ };
1342
+ Smile.displayName = "Smile";
1343
+ function _extends$1() {
1344
+ _extends$1 = Object.assign || function (target) {
1345
+ for (var i = 1; i < arguments.length; i++) {
1346
+ var source = arguments[i];
1347
+ for (var key in source) {
1348
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1349
+ target[key] = source[key];
1350
+ }
1351
+ }
1352
+ }
1353
+ return target;
1354
+ };
1355
+ return _extends$1.apply(this, arguments);
1356
+ }
1357
+ function _objectWithoutProperties$1(source, excluded) {
1358
+ if (source == null) return {};
1359
+ var target = _objectWithoutPropertiesLoose$1(source, excluded);
1360
+ var key, i;
1361
+ if (Object.getOwnPropertySymbols) {
1362
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1363
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1364
+ key = sourceSymbolKeys[i];
1365
+ if (excluded.indexOf(key) >= 0) continue;
1366
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1367
+ target[key] = source[key];
1368
+ }
1369
+ }
1370
+ return target;
1371
+ }
1372
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
1373
+ if (source == null) return {};
1374
+ var target = {};
1375
+ var sourceKeys = Object.keys(source);
1376
+ var key, i;
1377
+ for (i = 0; i < sourceKeys.length; i++) {
1378
+ key = sourceKeys[i];
1379
+ if (excluded.indexOf(key) >= 0) continue;
1380
+ target[key] = source[key];
1381
+ }
1382
+ return target;
1383
+ }
1384
+ var ThumbsUp = React.forwardRef(function (_ref, ref) {
1385
+ var _ref$color = _ref.color,
1386
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1387
+ _ref$size = _ref.size,
1388
+ size = _ref$size === void 0 ? 24 : _ref$size,
1389
+ rest = _objectWithoutProperties$1(_ref, ["color", "size"]);
1390
+ return /* @__PURE__ */React.createElement("svg", _extends$1({
1391
+ ref: ref,
1392
+ xmlns: "http://www.w3.org/2000/svg",
1393
+ width: size,
1394
+ height: size,
1395
+ viewBox: "0 0 24 24",
1396
+ fill: "none",
1397
+ stroke: color,
1398
+ strokeWidth: "2",
1399
+ strokeLinecap: "round",
1400
+ strokeLinejoin: "round"
1401
+ }, rest), /* @__PURE__ */React.createElement("path", {
1402
+ d: "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"
1403
+ }));
1404
+ });
1405
+ ThumbsUp.propTypes = {
1406
+ color: PropTypes.string,
1407
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1408
+ };
1409
+ ThumbsUp.displayName = "ThumbsUp";
1410
+ function _extends() {
1411
+ _extends = Object.assign || function (target) {
1412
+ for (var i = 1; i < arguments.length; i++) {
1413
+ var source = arguments[i];
1414
+ for (var key in source) {
1415
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1416
+ target[key] = source[key];
1417
+ }
1418
+ }
1419
+ }
1420
+ return target;
1421
+ };
1422
+ return _extends.apply(this, arguments);
1423
+ }
1424
+ function _objectWithoutProperties(source, excluded) {
1425
+ if (source == null) return {};
1426
+ var target = _objectWithoutPropertiesLoose(source, excluded);
1427
+ var key, i;
1428
+ if (Object.getOwnPropertySymbols) {
1429
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1430
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1431
+ key = sourceSymbolKeys[i];
1432
+ if (excluded.indexOf(key) >= 0) continue;
1433
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1434
+ target[key] = source[key];
1435
+ }
1436
+ }
1437
+ return target;
1438
+ }
1439
+ function _objectWithoutPropertiesLoose(source, excluded) {
1440
+ if (source == null) return {};
1441
+ var target = {};
1442
+ var sourceKeys = Object.keys(source);
1443
+ var key, i;
1444
+ for (i = 0; i < sourceKeys.length; i++) {
1445
+ key = sourceKeys[i];
1446
+ if (excluded.indexOf(key) >= 0) continue;
1447
+ target[key] = source[key];
1448
+ }
1449
+ return target;
1450
+ }
1451
+ var Zap = React.forwardRef(function (_ref, ref) {
1452
+ var _ref$color = _ref.color,
1453
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
1454
+ _ref$size = _ref.size,
1455
+ size = _ref$size === void 0 ? 24 : _ref$size,
1456
+ rest = _objectWithoutProperties(_ref, ["color", "size"]);
1457
+ return /* @__PURE__ */React.createElement("svg", _extends({
1458
+ ref: ref,
1459
+ xmlns: "http://www.w3.org/2000/svg",
1460
+ width: size,
1461
+ height: size,
1462
+ viewBox: "0 0 24 24",
1463
+ fill: "none",
1464
+ stroke: color,
1465
+ strokeWidth: "2",
1466
+ strokeLinecap: "round",
1467
+ strokeLinejoin: "round"
1468
+ }, rest), /* @__PURE__ */React.createElement("polygon", {
1469
+ points: "13 2 3 14 12 14 11 22 21 10 12 10 13 2"
1470
+ }));
1471
+ });
1472
+ Zap.propTypes = {
1473
+ color: PropTypes.string,
1474
+ size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
1475
+ };
1476
+ Zap.displayName = "Zap";
1477
+ var SDKConfig = {
1478
+ baseUrl: "V3",
1479
+ signer: null
1480
+ };
1481
+ var initHanbiroReactSDK = function initHanbiroReactSDK(_ref2) {
1482
+ var baseUrl = _ref2.baseUrl,
1483
+ signer = _ref2.signer;
1484
+ SDKConfig.baseUrl = baseUrl;
1485
+ SDKConfig.signer = signer;
1486
+ };
1487
+ var checkDevelopment = function checkDevelopment() {
1488
+ var locationInfo = window.location;
1489
+ var hostname = locationInfo.hostname;
1490
+ if (hostname === "localhost" || hostname === "127.0.0.1") {
1491
+ return true;
1492
+ } else {
1493
+ return false;
1494
+ }
1495
+ };
1496
+ var isDevelopment = checkDevelopment();
1497
+ var getBaseUrl = function getBaseUrl() {
1498
+ var _a2;
1499
+ var locationInfo = window.location;
1500
+ var host = locationInfo.host;
1501
+ if (isDevelopment) {
1502
+ var baseUrlArr = (_a2 = SDKConfig.baseUrl) == null ? void 0 : _a2.split("/");
1503
+ if (baseUrlArr) {
1504
+ return "https://" + (baseUrlArr == null ? void 0 : baseUrlArr[2]);
1505
+ } else {
1506
+ return "https://vndev.hanbiro.com";
1507
+ }
1508
+ } else {
1509
+ var data = localStorage.getItem("host") || host;
1510
+ var dataArr = data == null ? void 0 : data.split("/");
1511
+ return "https://" + (dataArr == null ? void 0 : dataArr[0]);
1512
+ }
1513
+ };
1514
+ var getGroupwareUrl = function getGroupwareUrl() {
1515
+ var locationInfo = window.location;
1516
+ if (isDevelopment) {
1517
+ return getBaseUrl() || "https://vndev.hanbiro.com/ngw";
1518
+ } else {
1519
+ if (window.location !== window.parent.location) {
1520
+ locationInfo = window.parent.location;
1521
+ }
1522
+ var _locationInfo = locationInfo,
1523
+ hostname = _locationInfo.hostname,
1524
+ protocol = _locationInfo.protocol;
1525
+ return [protocol, "//", hostname, "/ngw"].join("");
1526
+ }
1527
+ };
1528
+ function callAI(_0, _1) {
1529
+ return __async(this, arguments, function (params, _ref3) {
1530
+ var setContent = _ref3.setContent,
1531
+ setIsLoading = _ref3.setIsLoading,
1532
+ setConversationId = _ref3.setConversationId;
1533
+ return /*#__PURE__*/_regenerator().m(function _callee() {
1534
+ var currentContent, baseUrl, config, sigHeaders, signer, response, reader, fullContentDecode, readIndex, _yield$reader$read, done, value, originStr, jsonFormat, contentDecode, contentRegex, conversationIdRegex, matchArray, conversationIdmatch, _regMatchItem, nVal, decoded, _t;
570
1535
  return _regenerator().w(function (_context) {
571
1536
  while (1) switch (_context.p = _context.n) {
572
1537
  case 0:
@@ -999,15 +1964,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
999
1964
  return -1;
1000
1965
  }
1001
1966
  var level = 0;
1002
- for (var _i2 = 0; _i2 < str.length; _i2++) {
1003
- if (str[_i2] === "\\") {
1004
- _i2++;
1005
- } else if (str[_i2] === b[0]) {
1967
+ for (var _i = 0; _i < str.length; _i++) {
1968
+ if (str[_i] === "\\") {
1969
+ _i++;
1970
+ } else if (str[_i] === b[0]) {
1006
1971
  level++;
1007
- } else if (str[_i2] === b[1]) {
1972
+ } else if (str[_i] === b[1]) {
1008
1973
  level--;
1009
1974
  if (level < 0) {
1010
- return _i2;
1975
+ return _i;
1011
1976
  }
1012
1977
  }
1013
1978
  }
@@ -1147,18 +2112,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1147
2112
  while (lines.length > 0) {
1148
2113
  var inBlockquote = false;
1149
2114
  var currentLines = [];
1150
- var _i3 = void 0;
1151
- for (_i3 = 0; _i3 < lines.length; _i3++) {
1152
- if (this.rules.other.blockquoteStart.test(lines[_i3])) {
1153
- currentLines.push(lines[_i3]);
2115
+ var _i2 = void 0;
2116
+ for (_i2 = 0; _i2 < lines.length; _i2++) {
2117
+ if (this.rules.other.blockquoteStart.test(lines[_i2])) {
2118
+ currentLines.push(lines[_i2]);
1154
2119
  inBlockquote = true;
1155
2120
  } else if (!inBlockquote) {
1156
- currentLines.push(lines[_i3]);
2121
+ currentLines.push(lines[_i2]);
1157
2122
  } else {
1158
2123
  break;
1159
2124
  }
1160
2125
  }
1161
- lines = lines.slice(_i3);
2126
+ lines = lines.slice(_i2);
1162
2127
  var currentRaw = currentLines.join("\n");
1163
2128
  var currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
1164
2129
  raw = raw ? "".concat(raw, "\n").concat(currentRaw) : currentRaw;
@@ -1203,7 +2168,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1203
2168
  }, {
1204
2169
  key: "list",
1205
2170
  value: function list(src) {
1206
- var _this2 = this;
2171
+ var _this = this;
1207
2172
  var cap = this.rules.block.list.exec(src);
1208
2173
  if (cap) {
1209
2174
  var bull = cap[1].trim();
@@ -1350,22 +2315,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1350
2315
  return;
1351
2316
  }
1352
2317
  list2.raw = list2.raw.trimEnd();
1353
- for (var _i4 = 0; _i4 < list2.items.length; _i4++) {
2318
+ for (var _i3 = 0; _i3 < list2.items.length; _i3++) {
1354
2319
  this.lexer.state.top = false;
1355
- list2.items[_i4].tokens = this.lexer.blockTokens(list2.items[_i4].text, []);
2320
+ list2.items[_i3].tokens = this.lexer.blockTokens(list2.items[_i3].text, []);
1356
2321
  if (!list2.loose) {
1357
- var spacers = list2.items[_i4].tokens.filter(function (t) {
2322
+ var spacers = list2.items[_i3].tokens.filter(function (t) {
1358
2323
  return t.type === "space";
1359
2324
  });
1360
2325
  var hasMultipleLineBreaks = spacers.length > 0 && spacers.some(function (t) {
1361
- return _this2.rules.other.anyLine.test(t.raw);
2326
+ return _this.rules.other.anyLine.test(t.raw);
1362
2327
  });
1363
2328
  list2.loose = hasMultipleLineBreaks;
1364
2329
  }
1365
2330
  }
1366
2331
  if (list2.loose) {
1367
- for (var _i5 = 0; _i5 < list2.items.length; _i5++) {
1368
- list2.items[_i5].loose = true;
2332
+ for (var _i4 = 0; _i4 < list2.items.length; _i4++) {
2333
+ list2.items[_i4].loose = true;
1369
2334
  }
1370
2335
  }
1371
2336
  return list2;
@@ -1406,7 +2371,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1406
2371
  }, {
1407
2372
  key: "table",
1408
2373
  value: function table(src) {
1409
- var _this3 = this;
2374
+ var _this2 = this;
1410
2375
  var _a2;
1411
2376
  var cap = this.rules.block.table.exec(src);
1412
2377
  if (!cap) {
@@ -1448,12 +2413,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1448
2413
  } finally {
1449
2414
  _iterator3.f();
1450
2415
  }
1451
- for (var _i6 = 0; _i6 < headers.length; _i6++) {
2416
+ for (var _i5 = 0; _i5 < headers.length; _i5++) {
1452
2417
  item.header.push({
1453
- text: headers[_i6],
1454
- tokens: this.lexer.inline(headers[_i6]),
2418
+ text: headers[_i5],
2419
+ tokens: this.lexer.inline(headers[_i5]),
1455
2420
  header: true,
1456
- align: item.align[_i6]
2421
+ align: item.align[_i5]
1457
2422
  });
1458
2423
  }
1459
2424
  var _iterator4 = _createForOfIteratorHelper(rows),
@@ -1464,7 +2429,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1464
2429
  item.rows.push(splitCells(row, item.header.length).map(function (cell, i) {
1465
2430
  return {
1466
2431
  text: cell,
1467
- tokens: _this3.lexer.inline(cell),
2432
+ tokens: _this2.lexer.inline(cell),
1468
2433
  header: false,
1469
2434
  align: item.align[i]
1470
2435
  };
@@ -1850,8 +2815,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1850
2815
  function lex(src) {
1851
2816
  src = src.replace(other.carriageReturn, "\n");
1852
2817
  this.blockTokens(src, this.tokens);
1853
- for (var _i7 = 0; _i7 < this.inlineQueue.length; _i7++) {
1854
- var next = this.inlineQueue[_i7];
2818
+ for (var _i6 = 0; _i6 < this.inlineQueue.length; _i6++) {
2819
+ var next = this.inlineQueue[_i6];
1855
2820
  this.inlineTokens(next.src, next.tokens);
1856
2821
  }
1857
2822
  this.inlineQueue = [];
@@ -1860,7 +2825,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1860
2825
  }, {
1861
2826
  key: "blockTokens",
1862
2827
  value: function blockTokens(src) {
1863
- var _this4 = this;
2828
+ var _this3 = this;
1864
2829
  var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1865
2830
  var lastParagraphClipped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1866
2831
  var _a2, _b, _c;
@@ -1869,9 +2834,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1869
2834
  }
1870
2835
  var _loop2 = function _loop2() {
1871
2836
  var token;
1872
- if ((_b = (_a2 = _this4.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some(function (extTokenizer) {
2837
+ if ((_b = (_a2 = _this3.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some(function (extTokenizer) {
1873
2838
  if (token = extTokenizer.call({
1874
- lexer: _this4
2839
+ lexer: _this3
1875
2840
  }, src, tokens)) {
1876
2841
  src = src.substring(token.raw.length);
1877
2842
  tokens.push(token);
@@ -1881,7 +2846,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1881
2846
  })) {
1882
2847
  return 0; // continue
1883
2848
  }
1884
- if (token = _this4.tokenizer.space(src)) {
2849
+ if (token = _this3.tokenizer.space(src)) {
1885
2850
  src = src.substring(token.raw.length);
1886
2851
  var lastToken = tokens.at(-1);
1887
2852
  if (token.raw.length === 1 && lastToken !== void 0) {
@@ -1891,81 +2856,81 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1891
2856
  }
1892
2857
  return 0; // continue
1893
2858
  }
1894
- if (token = _this4.tokenizer.code(src)) {
2859
+ if (token = _this3.tokenizer.code(src)) {
1895
2860
  src = src.substring(token.raw.length);
1896
2861
  var _lastToken = tokens.at(-1);
1897
2862
  if ((_lastToken == null ? void 0 : _lastToken.type) === "paragraph" || (_lastToken == null ? void 0 : _lastToken.type) === "text") {
1898
2863
  _lastToken.raw += "\n" + token.raw;
1899
2864
  _lastToken.text += "\n" + token.text;
1900
- _this4.inlineQueue.at(-1).src = _lastToken.text;
2865
+ _this3.inlineQueue.at(-1).src = _lastToken.text;
1901
2866
  } else {
1902
2867
  tokens.push(token);
1903
2868
  }
1904
2869
  return 0; // continue
1905
2870
  }
1906
- if (token = _this4.tokenizer.fences(src)) {
2871
+ if (token = _this3.tokenizer.fences(src)) {
1907
2872
  src = src.substring(token.raw.length);
1908
2873
  tokens.push(token);
1909
2874
  return 0; // continue
1910
2875
  }
1911
- if (token = _this4.tokenizer.heading(src)) {
2876
+ if (token = _this3.tokenizer.heading(src)) {
1912
2877
  src = src.substring(token.raw.length);
1913
2878
  tokens.push(token);
1914
2879
  return 0; // continue
1915
2880
  }
1916
- if (token = _this4.tokenizer.hr(src)) {
2881
+ if (token = _this3.tokenizer.hr(src)) {
1917
2882
  src = src.substring(token.raw.length);
1918
2883
  tokens.push(token);
1919
2884
  return 0; // continue
1920
2885
  }
1921
- if (token = _this4.tokenizer.blockquote(src)) {
2886
+ if (token = _this3.tokenizer.blockquote(src)) {
1922
2887
  src = src.substring(token.raw.length);
1923
2888
  tokens.push(token);
1924
2889
  return 0; // continue
1925
2890
  }
1926
- if (token = _this4.tokenizer.list(src)) {
2891
+ if (token = _this3.tokenizer.list(src)) {
1927
2892
  src = src.substring(token.raw.length);
1928
2893
  tokens.push(token);
1929
2894
  return 0; // continue
1930
2895
  }
1931
- if (token = _this4.tokenizer.html(src)) {
2896
+ if (token = _this3.tokenizer.html(src)) {
1932
2897
  src = src.substring(token.raw.length);
1933
2898
  tokens.push(token);
1934
2899
  return 0; // continue
1935
2900
  }
1936
- if (token = _this4.tokenizer.def(src)) {
2901
+ if (token = _this3.tokenizer.def(src)) {
1937
2902
  src = src.substring(token.raw.length);
1938
2903
  var _lastToken2 = tokens.at(-1);
1939
2904
  if ((_lastToken2 == null ? void 0 : _lastToken2.type) === "paragraph" || (_lastToken2 == null ? void 0 : _lastToken2.type) === "text") {
1940
2905
  _lastToken2.raw += "\n" + token.raw;
1941
2906
  _lastToken2.text += "\n" + token.raw;
1942
- _this4.inlineQueue.at(-1).src = _lastToken2.text;
1943
- } else if (!_this4.tokens.links[token.tag]) {
1944
- _this4.tokens.links[token.tag] = {
2907
+ _this3.inlineQueue.at(-1).src = _lastToken2.text;
2908
+ } else if (!_this3.tokens.links[token.tag]) {
2909
+ _this3.tokens.links[token.tag] = {
1945
2910
  href: token.href,
1946
2911
  title: token.title
1947
2912
  };
1948
2913
  }
1949
2914
  return 0; // continue
1950
2915
  }
1951
- if (token = _this4.tokenizer.table(src)) {
2916
+ if (token = _this3.tokenizer.table(src)) {
1952
2917
  src = src.substring(token.raw.length);
1953
2918
  tokens.push(token);
1954
2919
  return 0; // continue
1955
2920
  }
1956
- if (token = _this4.tokenizer.lheading(src)) {
2921
+ if (token = _this3.tokenizer.lheading(src)) {
1957
2922
  src = src.substring(token.raw.length);
1958
2923
  tokens.push(token);
1959
2924
  return 0; // continue
1960
2925
  }
1961
2926
  var cutSrc = src;
1962
- if ((_c = _this4.options.extensions) == null ? void 0 : _c.startBlock) {
2927
+ if ((_c = _this3.options.extensions) == null ? void 0 : _c.startBlock) {
1963
2928
  var startIndex = Infinity;
1964
2929
  var tempSrc = src.slice(1);
1965
2930
  var tempStart;
1966
- _this4.options.extensions.startBlock.forEach(function (getStartIndex) {
2931
+ _this3.options.extensions.startBlock.forEach(function (getStartIndex) {
1967
2932
  tempStart = getStartIndex.call({
1968
- lexer: _this4
2933
+ lexer: _this3
1969
2934
  }, tempSrc);
1970
2935
  if (typeof tempStart === "number" && tempStart >= 0) {
1971
2936
  startIndex = Math.min(startIndex, tempStart);
@@ -1975,13 +2940,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1975
2940
  cutSrc = src.substring(0, startIndex + 1);
1976
2941
  }
1977
2942
  }
1978
- if (_this4.state.top && (token = _this4.tokenizer.paragraph(cutSrc))) {
2943
+ if (_this3.state.top && (token = _this3.tokenizer.paragraph(cutSrc))) {
1979
2944
  var _lastToken3 = tokens.at(-1);
1980
2945
  if (lastParagraphClipped && (_lastToken3 == null ? void 0 : _lastToken3.type) === "paragraph") {
1981
2946
  _lastToken3.raw += "\n" + token.raw;
1982
2947
  _lastToken3.text += "\n" + token.text;
1983
- _this4.inlineQueue.pop();
1984
- _this4.inlineQueue.at(-1).src = _lastToken3.text;
2948
+ _this3.inlineQueue.pop();
2949
+ _this3.inlineQueue.at(-1).src = _lastToken3.text;
1985
2950
  } else {
1986
2951
  tokens.push(token);
1987
2952
  }
@@ -1989,14 +2954,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1989
2954
  src = src.substring(token.raw.length);
1990
2955
  return 0; // continue
1991
2956
  }
1992
- if (token = _this4.tokenizer.text(src)) {
2957
+ if (token = _this3.tokenizer.text(src)) {
1993
2958
  src = src.substring(token.raw.length);
1994
2959
  var _lastToken4 = tokens.at(-1);
1995
2960
  if ((_lastToken4 == null ? void 0 : _lastToken4.type) === "text") {
1996
2961
  _lastToken4.raw += "\n" + token.raw;
1997
2962
  _lastToken4.text += "\n" + token.text;
1998
- _this4.inlineQueue.pop();
1999
- _this4.inlineQueue.at(-1).src = _lastToken4.text;
2963
+ _this3.inlineQueue.pop();
2964
+ _this3.inlineQueue.at(-1).src = _lastToken4.text;
2000
2965
  } else {
2001
2966
  tokens.push(token);
2002
2967
  }
@@ -2004,7 +2969,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2004
2969
  }
2005
2970
  if (src) {
2006
2971
  var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
2007
- if (_this4.options.silent) {
2972
+ if (_this3.options.silent) {
2008
2973
  console.error(errMsg);
2009
2974
  return 1; // break
2010
2975
  } else {
@@ -2037,7 +3002,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2037
3002
  }, {
2038
3003
  key: "inlineTokens",
2039
3004
  value: function inlineTokens(src) {
2040
- var _this5 = this;
3005
+ var _this4 = this;
2041
3006
  var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
2042
3007
  var _a2, _b, _c;
2043
3008
  var maskedSrc = src;
@@ -2066,9 +3031,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2066
3031
  }
2067
3032
  keepPrevChar = false;
2068
3033
  var token;
2069
- if ((_b = (_a2 = _this5.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some(function (extTokenizer) {
3034
+ if ((_b = (_a2 = _this4.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some(function (extTokenizer) {
2070
3035
  if (token = extTokenizer.call({
2071
- lexer: _this5
3036
+ lexer: _this4
2072
3037
  }, src, tokens)) {
2073
3038
  src = src.substring(token.raw.length);
2074
3039
  tokens.push(token);
@@ -2078,22 +3043,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2078
3043
  })) {
2079
3044
  return 0; // continue
2080
3045
  }
2081
- if (token = _this5.tokenizer.escape(src)) {
3046
+ if (token = _this4.tokenizer.escape(src)) {
2082
3047
  src = src.substring(token.raw.length);
2083
3048
  tokens.push(token);
2084
3049
  return 0; // continue
2085
3050
  }
2086
- if (token = _this5.tokenizer.tag(src)) {
3051
+ if (token = _this4.tokenizer.tag(src)) {
2087
3052
  src = src.substring(token.raw.length);
2088
3053
  tokens.push(token);
2089
3054
  return 0; // continue
2090
3055
  }
2091
- if (token = _this5.tokenizer.link(src)) {
3056
+ if (token = _this4.tokenizer.link(src)) {
2092
3057
  src = src.substring(token.raw.length);
2093
3058
  tokens.push(token);
2094
3059
  return 0; // continue
2095
3060
  }
2096
- if (token = _this5.tokenizer.reflink(src, _this5.tokens.links)) {
3061
+ if (token = _this4.tokenizer.reflink(src, _this4.tokens.links)) {
2097
3062
  src = src.substring(token.raw.length);
2098
3063
  var lastToken = tokens.at(-1);
2099
3064
  if (token.type === "text" && (lastToken == null ? void 0 : lastToken.type) === "text") {
@@ -2104,44 +3069,44 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2104
3069
  }
2105
3070
  return 0; // continue
2106
3071
  }
2107
- if (token = _this5.tokenizer.emStrong(src, maskedSrc, prevChar)) {
3072
+ if (token = _this4.tokenizer.emStrong(src, maskedSrc, prevChar)) {
2108
3073
  src = src.substring(token.raw.length);
2109
3074
  tokens.push(token);
2110
3075
  return 0; // continue
2111
3076
  }
2112
- if (token = _this5.tokenizer.codespan(src)) {
3077
+ if (token = _this4.tokenizer.codespan(src)) {
2113
3078
  src = src.substring(token.raw.length);
2114
3079
  tokens.push(token);
2115
3080
  return 0; // continue
2116
3081
  }
2117
- if (token = _this5.tokenizer.br(src)) {
3082
+ if (token = _this4.tokenizer.br(src)) {
2118
3083
  src = src.substring(token.raw.length);
2119
3084
  tokens.push(token);
2120
3085
  return 0; // continue
2121
3086
  }
2122
- if (token = _this5.tokenizer.del(src)) {
3087
+ if (token = _this4.tokenizer.del(src)) {
2123
3088
  src = src.substring(token.raw.length);
2124
3089
  tokens.push(token);
2125
3090
  return 0; // continue
2126
3091
  }
2127
- if (token = _this5.tokenizer.autolink(src)) {
3092
+ if (token = _this4.tokenizer.autolink(src)) {
2128
3093
  src = src.substring(token.raw.length);
2129
3094
  tokens.push(token);
2130
3095
  return 0; // continue
2131
3096
  }
2132
- if (!_this5.state.inLink && (token = _this5.tokenizer.url(src))) {
3097
+ if (!_this4.state.inLink && (token = _this4.tokenizer.url(src))) {
2133
3098
  src = src.substring(token.raw.length);
2134
3099
  tokens.push(token);
2135
3100
  return 0; // continue
2136
3101
  }
2137
3102
  var cutSrc = src;
2138
- if ((_c = _this5.options.extensions) == null ? void 0 : _c.startInline) {
3103
+ if ((_c = _this4.options.extensions) == null ? void 0 : _c.startInline) {
2139
3104
  var startIndex = Infinity;
2140
3105
  var tempSrc = src.slice(1);
2141
3106
  var tempStart;
2142
- _this5.options.extensions.startInline.forEach(function (getStartIndex) {
3107
+ _this4.options.extensions.startInline.forEach(function (getStartIndex) {
2143
3108
  tempStart = getStartIndex.call({
2144
- lexer: _this5
3109
+ lexer: _this4
2145
3110
  }, tempSrc);
2146
3111
  if (typeof tempStart === "number" && tempStart >= 0) {
2147
3112
  startIndex = Math.min(startIndex, tempStart);
@@ -2151,7 +3116,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2151
3116
  cutSrc = src.substring(0, startIndex + 1);
2152
3117
  }
2153
3118
  }
2154
- if (token = _this5.tokenizer.inlineText(cutSrc)) {
3119
+ if (token = _this4.tokenizer.inlineText(cutSrc)) {
2155
3120
  src = src.substring(token.raw.length);
2156
3121
  if (token.raw.slice(-1) !== "_") {
2157
3122
  prevChar = token.raw.slice(-1);
@@ -2168,7 +3133,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2168
3133
  }
2169
3134
  if (src) {
2170
3135
  var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
2171
- if (_this5.options.silent) {
3136
+ if (_this4.options.silent) {
2172
3137
  console.error(errMsg);
2173
3138
  return 1; // break
2174
3139
  } else {
@@ -2227,10 +3192,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2227
3192
  }
2228
3193
  }, {
2229
3194
  key: "code",
2230
- value: function code(_ref5) {
2231
- var text = _ref5.text,
2232
- lang = _ref5.lang,
2233
- escaped = _ref5.escaped;
3195
+ value: function code(_ref4) {
3196
+ var text = _ref4.text,
3197
+ lang = _ref4.lang,
3198
+ escaped = _ref4.escaped;
2234
3199
  var _a2;
2235
3200
  var langString = (_a2 = (lang || "").match(other.notSpaceStart)) == null ? void 0 : _a2[0];
2236
3201
  var code = text.replace(other.endingNewline, "") + "\n";
@@ -2241,22 +3206,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2241
3206
  }
2242
3207
  }, {
2243
3208
  key: "blockquote",
2244
- value: function blockquote(_ref6) {
2245
- var tokens = _ref6.tokens;
3209
+ value: function blockquote(_ref5) {
3210
+ var tokens = _ref5.tokens;
2246
3211
  var body = this.parser.parse(tokens);
2247
3212
  return "<blockquote>\n".concat(body, "</blockquote>\n");
2248
3213
  }
2249
3214
  }, {
2250
3215
  key: "html",
2251
- value: function html(_ref7) {
2252
- var text = _ref7.text;
3216
+ value: function html(_ref6) {
3217
+ var text = _ref6.text;
2253
3218
  return text;
2254
3219
  }
2255
3220
  }, {
2256
3221
  key: "heading",
2257
- value: function heading(_ref8) {
2258
- var tokens = _ref8.tokens,
2259
- depth = _ref8.depth;
3222
+ value: function heading(_ref7) {
3223
+ var tokens = _ref7.tokens,
3224
+ depth = _ref7.depth;
2260
3225
  return "<h".concat(depth, ">").concat(this.parser.parseInline(tokens), "</h").concat(depth, ">\n");
2261
3226
  }
2262
3227
  }, {
@@ -2311,14 +3276,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2311
3276
  }
2312
3277
  }, {
2313
3278
  key: "checkbox",
2314
- value: function checkbox(_ref9) {
2315
- var checked = _ref9.checked;
3279
+ value: function checkbox(_ref8) {
3280
+ var checked = _ref8.checked;
2316
3281
  return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
2317
3282
  }
2318
3283
  }, {
2319
3284
  key: "paragraph",
2320
- value: function paragraph(_ref0) {
2321
- var tokens = _ref0.tokens;
3285
+ value: function paragraph(_ref9) {
3286
+ var tokens = _ref9.tokens;
2322
3287
  return "<p>".concat(this.parser.parseInline(tokens), "</p>\n");
2323
3288
  }
2324
3289
  }, {
@@ -2348,8 +3313,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2348
3313
  }
2349
3314
  }, {
2350
3315
  key: "tablerow",
2351
- value: function tablerow(_ref1) {
2352
- var text = _ref1.text;
3316
+ value: function tablerow(_ref0) {
3317
+ var text = _ref0.text;
2353
3318
  return "<tr>\n".concat(text, "</tr>\n");
2354
3319
  }
2355
3320
  }, {
@@ -2365,20 +3330,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2365
3330
  */
2366
3331
  }, {
2367
3332
  key: "strong",
2368
- value: function strong(_ref10) {
2369
- var tokens = _ref10.tokens;
3333
+ value: function strong(_ref1) {
3334
+ var tokens = _ref1.tokens;
2370
3335
  return "<strong>".concat(this.parser.parseInline(tokens), "</strong>");
2371
3336
  }
2372
3337
  }, {
2373
3338
  key: "em",
2374
- value: function em(_ref11) {
2375
- var tokens = _ref11.tokens;
3339
+ value: function em(_ref10) {
3340
+ var tokens = _ref10.tokens;
2376
3341
  return "<em>".concat(this.parser.parseInline(tokens), "</em>");
2377
3342
  }
2378
3343
  }, {
2379
3344
  key: "codespan",
2380
- value: function codespan(_ref12) {
2381
- var text = _ref12.text;
3345
+ value: function codespan(_ref11) {
3346
+ var text = _ref11.text;
2382
3347
  return "<code>".concat(escape2(text, true), "</code>");
2383
3348
  }
2384
3349
  }, {
@@ -2388,16 +3353,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2388
3353
  }
2389
3354
  }, {
2390
3355
  key: "del",
2391
- value: function del(_ref13) {
2392
- var tokens = _ref13.tokens;
3356
+ value: function del(_ref12) {
3357
+ var tokens = _ref12.tokens;
2393
3358
  return "<del>".concat(this.parser.parseInline(tokens), "</del>");
2394
3359
  }
2395
3360
  }, {
2396
3361
  key: "link",
2397
- value: function link(_ref14) {
2398
- var href = _ref14.href,
2399
- title = _ref14.title,
2400
- tokens = _ref14.tokens;
3362
+ value: function link(_ref13) {
3363
+ var href = _ref13.href,
3364
+ title = _ref13.title,
3365
+ tokens = _ref13.tokens;
2401
3366
  var text = this.parser.parseInline(tokens);
2402
3367
  var cleanHref = cleanUrl(href);
2403
3368
  if (cleanHref === null) {
@@ -2413,11 +3378,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2413
3378
  }
2414
3379
  }, {
2415
3380
  key: "image",
2416
- value: function image(_ref15) {
2417
- var href = _ref15.href,
2418
- title = _ref15.title,
2419
- text = _ref15.text,
2420
- tokens = _ref15.tokens;
3381
+ value: function image(_ref14) {
3382
+ var href = _ref14.href,
3383
+ title = _ref14.title,
3384
+ text = _ref14.text,
3385
+ tokens = _ref14.tokens;
2421
3386
  if (tokens) {
2422
3387
  text = this.parser.parseInline(tokens, this.parser.textRenderer);
2423
3388
  }
@@ -2448,50 +3413,50 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2448
3413
  key: "strong",
2449
3414
  value:
2450
3415
  // no need for block level renderers
2451
- function strong(_ref16) {
2452
- var text = _ref16.text;
3416
+ function strong(_ref15) {
3417
+ var text = _ref15.text;
2453
3418
  return text;
2454
3419
  }
2455
3420
  }, {
2456
3421
  key: "em",
2457
- value: function em(_ref17) {
2458
- var text = _ref17.text;
3422
+ value: function em(_ref16) {
3423
+ var text = _ref16.text;
2459
3424
  return text;
2460
3425
  }
2461
3426
  }, {
2462
3427
  key: "codespan",
2463
- value: function codespan(_ref18) {
2464
- var text = _ref18.text;
3428
+ value: function codespan(_ref17) {
3429
+ var text = _ref17.text;
2465
3430
  return text;
2466
3431
  }
2467
3432
  }, {
2468
3433
  key: "del",
2469
- value: function del(_ref19) {
2470
- var text = _ref19.text;
3434
+ value: function del(_ref18) {
3435
+ var text = _ref18.text;
2471
3436
  return text;
2472
3437
  }
2473
3438
  }, {
2474
3439
  key: "html",
2475
- value: function html(_ref20) {
2476
- var text = _ref20.text;
3440
+ value: function html(_ref19) {
3441
+ var text = _ref19.text;
2477
3442
  return text;
2478
3443
  }
2479
3444
  }, {
2480
3445
  key: "text",
2481
- value: function text(_ref21) {
2482
- var _text = _ref21.text;
3446
+ value: function text(_ref20) {
3447
+ var _text = _ref20.text;
2483
3448
  return _text;
2484
3449
  }
2485
3450
  }, {
2486
3451
  key: "link",
2487
- value: function link(_ref22) {
2488
- var text = _ref22.text;
3452
+ value: function link(_ref21) {
3453
+ var text = _ref21.text;
2489
3454
  return "" + text;
2490
3455
  }
2491
3456
  }, {
2492
3457
  key: "image",
2493
- value: function image(_ref23) {
2494
- var text = _ref23.text;
3458
+ value: function image(_ref22) {
3459
+ var text = _ref22.text;
2495
3460
  return "" + text;
2496
3461
  }
2497
3462
  }, {
@@ -2527,8 +3492,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2527
3492
  var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2528
3493
  var _a2, _b;
2529
3494
  var out = "";
2530
- for (var _i8 = 0; _i8 < tokens.length; _i8++) {
2531
- var anyToken = tokens[_i8];
3495
+ for (var _i7 = 0; _i7 < tokens.length; _i7++) {
3496
+ var anyToken = tokens[_i7];
2532
3497
  if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[anyToken.type]) {
2533
3498
  var genericToken = anyToken;
2534
3499
  var ret = this.options.extensions.renderers[genericToken.type].call({
@@ -2590,8 +3555,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2590
3555
  {
2591
3556
  var textToken = token;
2592
3557
  var body = this.renderer.text(textToken);
2593
- while (_i8 + 1 < tokens.length && tokens[_i8 + 1].type === "text") {
2594
- textToken = tokens[++_i8];
3558
+ while (_i7 + 1 < tokens.length && tokens[_i7 + 1].type === "text") {
3559
+ textToken = tokens[++_i7];
2595
3560
  body += "\n" + this.renderer.text(textToken);
2596
3561
  }
2597
3562
  if (top) {
@@ -2634,8 +3599,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2634
3599
  var renderer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.renderer;
2635
3600
  var _a2, _b;
2636
3601
  var out = "";
2637
- for (var _i9 = 0; _i9 < tokens.length; _i9++) {
2638
- var anyToken = tokens[_i9];
3602
+ for (var _i8 = 0; _i8 < tokens.length; _i8++) {
3603
+ var anyToken = tokens[_i8];
2639
3604
  if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[anyToken.type]) {
2640
3605
  var ret = this.options.extensions.renderers[anyToken.type].call({
2641
3606
  parser: this
@@ -2798,7 +3763,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2798
3763
  return _createClass(Marked, [{
2799
3764
  key: "walkTokens",
2800
3765
  value: function walkTokens(tokens, callback) {
2801
- var _this6 = this;
3766
+ var _this5 = this;
2802
3767
  var _a2, _b;
2803
3768
  var values = [];
2804
3769
  var _iterator5 = _createForOfIteratorHelper(tokens),
@@ -2806,7 +3771,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2806
3771
  try {
2807
3772
  var _loop4 = function _loop4() {
2808
3773
  var token = _step5.value;
2809
- values = values.concat(callback.call(_this6, token));
3774
+ values = values.concat(callback.call(_this5, token));
2810
3775
  switch (token.type) {
2811
3776
  case "table":
2812
3777
  {
@@ -2816,7 +3781,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2816
3781
  try {
2817
3782
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
2818
3783
  var cell = _step6.value;
2819
- values = values.concat(_this6.walkTokens(cell.tokens, callback));
3784
+ values = values.concat(_this5.walkTokens(cell.tokens, callback));
2820
3785
  }
2821
3786
  } catch (err) {
2822
3787
  _iterator6.e(err);
@@ -2833,7 +3798,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2833
3798
  try {
2834
3799
  for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2835
3800
  var _cell = _step8.value;
2836
- values = values.concat(_this6.walkTokens(_cell.tokens, callback));
3801
+ values = values.concat(_this5.walkTokens(_cell.tokens, callback));
2837
3802
  }
2838
3803
  } catch (err) {
2839
3804
  _iterator8.e(err);
@@ -2851,19 +3816,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2851
3816
  case "list":
2852
3817
  {
2853
3818
  var listToken = token;
2854
- values = values.concat(_this6.walkTokens(listToken.items, callback));
3819
+ values = values.concat(_this5.walkTokens(listToken.items, callback));
2855
3820
  break;
2856
3821
  }
2857
3822
  default:
2858
3823
  {
2859
3824
  var genericToken = token;
2860
- if ((_b = (_a2 = _this6.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[genericToken.type]) {
2861
- _this6.defaults.extensions.childTokens[genericToken.type].forEach(function (childTokens) {
3825
+ if ((_b = (_a2 = _this5.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[genericToken.type]) {
3826
+ _this5.defaults.extensions.childTokens[genericToken.type].forEach(function (childTokens) {
2862
3827
  var tokens2 = genericToken[childTokens].flat(Infinity);
2863
- values = values.concat(_this6.walkTokens(tokens2, callback));
3828
+ values = values.concat(_this5.walkTokens(tokens2, callback));
2864
3829
  });
2865
3830
  } else if (genericToken.tokens) {
2866
- values = values.concat(_this6.walkTokens(genericToken.tokens, callback));
3831
+ values = values.concat(_this5.walkTokens(genericToken.tokens, callback));
2867
3832
  }
2868
3833
  }
2869
3834
  }
@@ -2881,7 +3846,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2881
3846
  }, {
2882
3847
  key: "use",
2883
3848
  value: function use() {
2884
- var _this7 = this;
3849
+ var _this6 = this;
2885
3850
  var extensions = this.defaults.extensions || {
2886
3851
  renderers: {},
2887
3852
  childTokens: {}
@@ -2891,7 +3856,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2891
3856
  }
2892
3857
  args.forEach(function (pack) {
2893
3858
  var opts = __spreadValues({}, pack);
2894
- opts.async = _this7.defaults.async || opts.async || false;
3859
+ opts.async = _this6.defaults.async || opts.async || false;
2895
3860
  if (pack.extensions) {
2896
3861
  pack.extensions.forEach(function (ext) {
2897
3862
  if (!ext.name) {
@@ -2947,7 +3912,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2947
3912
  opts.extensions = extensions;
2948
3913
  }
2949
3914
  if (pack.renderer) {
2950
- var renderer = _this7.defaults.renderer || new _Renderer(_this7.defaults);
3915
+ var renderer = _this6.defaults.renderer || new _Renderer(_this6.defaults);
2951
3916
  var _loop5 = function _loop5() {
2952
3917
  if (!(prop in renderer)) {
2953
3918
  throw new Error("renderer '".concat(prop, "' does not exist"));
@@ -2975,7 +3940,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2975
3940
  opts.renderer = renderer;
2976
3941
  }
2977
3942
  if (pack.tokenizer) {
2978
- var tokenizer = _this7.defaults.tokenizer || new _Tokenizer(_this7.defaults);
3943
+ var tokenizer = _this6.defaults.tokenizer || new _Tokenizer(_this6.defaults);
2979
3944
  var _loop6 = function _loop6() {
2980
3945
  if (!(_prop in tokenizer)) {
2981
3946
  throw new Error("tokenizer '".concat(_prop, "' does not exist"));
@@ -3003,7 +3968,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3003
3968
  opts.tokenizer = tokenizer;
3004
3969
  }
3005
3970
  if (pack.hooks) {
3006
- var hooks = _this7.defaults.hooks || new _Hooks();
3971
+ var hooks = _this6.defaults.hooks || new _Hooks();
3007
3972
  var _loop7 = function _loop7() {
3008
3973
  if (!(_prop2 in hooks)) {
3009
3974
  throw new Error("hook '".concat(_prop2, "' does not exist"));
@@ -3016,7 +3981,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3016
3981
  var prevHook = hooks[hooksProp];
3017
3982
  if (_Hooks.passThroughHooks.has(_prop2)) {
3018
3983
  hooks[hooksProp] = function (arg) {
3019
- if (_this7.defaults.async) {
3984
+ if (_this6.defaults.async) {
3020
3985
  return Promise.resolve(hooksFunc.call(hooks, arg)).then(function (ret2) {
3021
3986
  return prevHook.call(hooks, ret2);
3022
3987
  });
@@ -3043,7 +4008,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3043
4008
  opts.hooks = hooks;
3044
4009
  }
3045
4010
  if (pack.walkTokens) {
3046
- var walkTokens2 = _this7.defaults.walkTokens;
4011
+ var walkTokens2 = _this6.defaults.walkTokens;
3047
4012
  var packWalktokens = pack.walkTokens;
3048
4013
  opts.walkTokens = function (token) {
3049
4014
  var values = [];
@@ -3054,7 +4019,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3054
4019
  return values;
3055
4020
  };
3056
4021
  }
3057
- _this7.defaults = __spreadValues(__spreadValues({}, _this7.defaults), opts);
4022
+ _this6.defaults = __spreadValues(__spreadValues({}, _this6.defaults), opts);
3058
4023
  });
3059
4024
  return this;
3060
4025
  }
@@ -3077,12 +4042,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3077
4042
  }, {
3078
4043
  key: "parseMarkdown",
3079
4044
  value: function parseMarkdown(blockType) {
3080
- var _this8 = this;
4045
+ var _this7 = this;
3081
4046
  var parse2 = function parse2(src, options2) {
3082
4047
  var origOpt = __spreadValues({}, options2);
3083
- var opt = __spreadValues(__spreadValues({}, _this8.defaults), origOpt);
3084
- var throwError = _this8.onError(!!opt.silent, !!opt.async);
3085
- if (_this8.defaults.async === true && origOpt.async === false) {
4048
+ var opt = __spreadValues(__spreadValues({}, _this7.defaults), origOpt);
4049
+ var throwError = _this7.onError(!!opt.silent, !!opt.async);
4050
+ if (_this7.defaults.async === true && origOpt.async === false) {
3086
4051
  return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
3087
4052
  }
3088
4053
  if (typeof src === "undefined" || src === null) {
@@ -3103,7 +4068,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3103
4068
  }).then(function (tokens) {
3104
4069
  return opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens;
3105
4070
  }).then(function (tokens) {
3106
- return opt.walkTokens ? Promise.all(_this8.walkTokens(tokens, opt.walkTokens)).then(function () {
4071
+ return opt.walkTokens ? Promise.all(_this7.walkTokens(tokens, opt.walkTokens)).then(function () {
3107
4072
  return tokens;
3108
4073
  }) : tokens;
3109
4074
  }).then(function (tokens) {
@@ -3121,7 +4086,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3121
4086
  tokens = opt.hooks.processAllTokens(tokens);
3122
4087
  }
3123
4088
  if (opt.walkTokens) {
3124
- _this8.walkTokens(tokens, opt.walkTokens);
4089
+ _this7.walkTokens(tokens, opt.walkTokens);
3125
4090
  }
3126
4091
  var html2 = parser2(tokens, opt);
3127
4092
  if (opt.hooks) {
@@ -3192,9 +4157,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3192
4157
  marked.parseInline;
3193
4158
  _Parser.parse;
3194
4159
  _Lexer.lex;
3195
- var TypingText = function TypingText(_ref24) {
3196
- var data = _ref24.data,
3197
- style = _ref24.style;
4160
+ var TypingText = function TypingText(_ref23) {
4161
+ var data = _ref23.data,
4162
+ style = _ref23.style;
3198
4163
  return /* @__PURE__ */React__namespace.createElement("div", {
3199
4164
  style: __spreadValues({
3200
4165
  maxWidth: "80%"
@@ -3212,90 +4177,56 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3212
4177
  }
3213
4178
  }, data ? data.question : ""));
3214
4179
  };
3215
- var LoadingCircular = function LoadingCircular(_ref25) {
3216
- var _ref25$size = _ref25.size,
3217
- size = _ref25$size === void 0 ? 40 : _ref25$size,
3218
- _ref25$color = _ref25.color,
3219
- color = _ref25$color === void 0 ? "var(--primary-main)" : _ref25$color,
3220
- _ref25$thickness = _ref25.thickness,
3221
- thickness = _ref25$thickness === void 0 ? 3.6 : _ref25$thickness;
3222
- var radius = 20;
3223
- var circumference = 2 * Math.PI * radius;
3224
- return /* @__PURE__ */React.createElement("div", {
3225
- className: "circular-container",
3226
- style: {
3227
- width: size,
3228
- height: size
3229
- },
3230
- role: "progressbar"
3231
- }, /* @__PURE__ */React.createElement("svg", {
3232
- className: "circular-svg",
3233
- viewBox: "22 22 44 44"
3234
- }, /* @__PURE__ */React.createElement("circle", {
3235
- className: "circular-circle",
3236
- cx: "44",
3237
- cy: "44",
3238
- r: radius,
3239
- fill: "none",
3240
- stroke: color,
3241
- strokeWidth: thickness,
3242
- strokeDasharray: circumference,
3243
- style: {
3244
- strokeDashoffset: circumference * 0.7
3245
- // Độ dài của thanh loading
3246
- }
3247
- })));
3248
- };
3249
4180
  var ARROW_SIZE = 6;
3250
4181
  var GAP = 4;
3251
4182
  var Tooltip = /*#__PURE__*/function (_React__namespace$Com) {
3252
4183
  function Tooltip(props) {
3253
- var _this9;
4184
+ var _this8;
3254
4185
  _classCallCheck(this, Tooltip);
3255
- _this9 = _callSuper(this, Tooltip, [props]);
3256
- __publicField(_this9, "triggerRef");
3257
- __publicField(_this9, "tooltipRef");
3258
- __publicField(_this9, "enterTimer", null);
3259
- __publicField(_this9, "leaveTimer", null);
3260
- __publicField(_this9, "handleMouseEnter", function () {
3261
- if (_this9.leaveTimer) {
3262
- clearTimeout(_this9.leaveTimer);
3263
- _this9.leaveTimer = null;
4186
+ _this8 = _callSuper(this, Tooltip, [props]);
4187
+ __publicField(_this8, "triggerRef");
4188
+ __publicField(_this8, "tooltipRef");
4189
+ __publicField(_this8, "enterTimer", null);
4190
+ __publicField(_this8, "leaveTimer", null);
4191
+ __publicField(_this8, "handleMouseEnter", function () {
4192
+ if (_this8.leaveTimer) {
4193
+ clearTimeout(_this8.leaveTimer);
4194
+ _this8.leaveTimer = null;
3264
4195
  }
3265
- var enterDelay = _this9.props.enterDelay;
3266
- _this9.enterTimer = setTimeout(function () {
3267
- _this9.setState({
4196
+ var enterDelay = _this8.props.enterDelay;
4197
+ _this8.enterTimer = setTimeout(function () {
4198
+ _this8.setState({
3268
4199
  visible: true
3269
4200
  }, function () {
3270
- var coords = _this9.computeCoords();
3271
- _this9.setState({
4201
+ var coords = _this8.computeCoords();
4202
+ _this8.setState({
3272
4203
  coords: coords
3273
4204
  });
3274
4205
  });
3275
4206
  }, enterDelay);
3276
4207
  });
3277
- __publicField(_this9, "handleMouseLeave", function () {
3278
- if (_this9.enterTimer) {
3279
- clearTimeout(_this9.enterTimer);
3280
- _this9.enterTimer = null;
4208
+ __publicField(_this8, "handleMouseLeave", function () {
4209
+ if (_this8.enterTimer) {
4210
+ clearTimeout(_this8.enterTimer);
4211
+ _this8.enterTimer = null;
3281
4212
  }
3282
- var leaveDelay = _this9.props.leaveDelay;
3283
- _this9.leaveTimer = setTimeout(function () {
3284
- _this9.setState({
4213
+ var leaveDelay = _this8.props.leaveDelay;
4214
+ _this8.leaveTimer = setTimeout(function () {
4215
+ _this8.setState({
3285
4216
  visible: false
3286
4217
  });
3287
4218
  }, leaveDelay);
3288
4219
  });
3289
- _this9.state = {
4220
+ _this8.state = {
3290
4221
  visible: false,
3291
4222
  coords: {
3292
4223
  top: 0,
3293
4224
  left: 0
3294
4225
  }
3295
4226
  };
3296
- _this9.triggerRef = React__namespace.createRef();
3297
- _this9.tooltipRef = React__namespace.createRef();
3298
- return _this9;
4227
+ _this8.triggerRef = React__namespace.createRef();
4228
+ _this8.tooltipRef = React__namespace.createRef();
4229
+ return _this8;
3299
4230
  }
3300
4231
  _inherits(Tooltip, _React__namespace$Com);
3301
4232
  return _createClass(Tooltip, [{
@@ -3426,12 +4357,50 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3426
4357
  leaveDelay: 0,
3427
4358
  zIndex: 1500
3428
4359
  });
3429
- var List = function List(_ref26) {
3430
- var items = _ref26.items,
3431
- onApply = _ref26.onApply,
3432
- getEditorContent = _ref26.getEditorContent;
4360
+ var AIAvatar = function AIAvatar() {
4361
+ return /* @__PURE__ */React__namespace.createElement("div", {
4362
+ style: {
4363
+ width: 28,
4364
+ height: 28,
4365
+ borderRadius: "50%",
4366
+ background: "var(--primary-main)",
4367
+ color: "var(--primary-contrasttext)",
4368
+ display: "flex",
4369
+ alignItems: "center",
4370
+ justifyContent: "center",
4371
+ fontSize: 11,
4372
+ fontWeight: 700,
4373
+ letterSpacing: 0.5,
4374
+ flexShrink: 0
4375
+ }
4376
+ }, "AI");
4377
+ };
4378
+ var LoadingDots = function LoadingDots(_ref24) {
4379
+ var _ref24$label = _ref24.label,
4380
+ label = _ref24$label === void 0 ? "Thinking" : _ref24$label;
4381
+ return /* @__PURE__ */React__namespace.createElement("div", {
4382
+ style: {
4383
+ display: "inline-flex",
4384
+ alignItems: "center",
4385
+ gap: 6,
4386
+ background: "var(--background-softGrey)",
4387
+ borderRadius: 8,
4388
+ borderTopLeftRadius: 0,
4389
+ padding: "8px 12px",
4390
+ fontSize: 13,
4391
+ color: "var(--text-secondary)"
4392
+ }
4393
+ }, /* @__PURE__ */React__namespace.createElement("span", null, label), /* @__PURE__ */React__namespace.createElement("span", {
4394
+ className: "chat-ai-dots",
4395
+ "aria-hidden": "true"
4396
+ }, /* @__PURE__ */React__namespace.createElement("span", null), /* @__PURE__ */React__namespace.createElement("span", null), /* @__PURE__ */React__namespace.createElement("span", null)));
4397
+ };
4398
+ var List = function List(_ref25) {
4399
+ var items = _ref25.items,
4400
+ onApply = _ref25.onApply,
4401
+ getEditorContent = _ref25.getEditorContent;
3433
4402
  var handleApply = function handleApply(body) {
3434
- return __async(_this0, null, /*#__PURE__*/_regenerator().m(function _callee2() {
4403
+ return __async(_this9, null, /*#__PURE__*/_regenerator().m(function _callee2() {
3435
4404
  var titleRegex, matches, content, html2, signatureRegex, editorValue, signatureMatch;
3436
4405
  return _regenerator().w(function (_context2) {
3437
4406
  while (1) switch (_context2.n) {
@@ -3496,27 +4465,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3496
4465
  borderRadius: 8,
3497
4466
  borderTopRightRadius: 0,
3498
4467
  padding: "8px 12px",
3499
- background: "var(--background-softGrey)"
4468
+ background: "var(--primary-main)",
4469
+ color: "var(--primary-contrasttext)"
3500
4470
  }
3501
4471
  })), /* @__PURE__ */React__namespace.createElement("div", {
3502
4472
  style: {
3503
4473
  width: "100%",
3504
4474
  display: "flex",
3505
4475
  alignItems: "flex-start",
3506
- flexDirection: "column",
4476
+ flexDirection: "row",
3507
4477
  position: "relative",
3508
- marginTop: 8
4478
+ marginTop: 8,
4479
+ gap: 8
3509
4480
  }
3510
- }, (_item == null ? void 0 : _item.isLoading) ? /* @__PURE__ */React__namespace.createElement(LoadingCircular, {
3511
- size: 32
3512
- }) : /* @__PURE__ */React__namespace.createElement("div", {
4481
+ }, /* @__PURE__ */React__namespace.createElement(AIAvatar, null), /* @__PURE__ */React__namespace.createElement("div", {
3513
4482
  style: {
4483
+ flex: 1,
4484
+ minWidth: 0,
3514
4485
  display: "flex",
3515
- flexDirection: "row",
3516
- alignItems: "flex-end",
3517
- width: "100%"
4486
+ flexDirection: "column"
3518
4487
  }
3519
- }, /* @__PURE__ */React__namespace.createElement(TypingText, {
4488
+ }, (_item == null ? void 0 : _item.isLoading) ? /* @__PURE__ */React__namespace.createElement(LoadingDots, null) : /* @__PURE__ */React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */React__namespace.createElement(TypingText, {
3520
4489
  data: {
3521
4490
  subject: _item.subject,
3522
4491
  body: _item.body
@@ -3525,10 +4494,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3525
4494
  background: "var(--background-softGrey)",
3526
4495
  borderRadius: 8,
3527
4496
  borderTopLeftRadius: 0,
3528
- padding: "8px 12px",
3529
- flexShrink: 0
4497
+ padding: "8px 12px"
3530
4498
  }
3531
- }), /* @__PURE__ */React__namespace.createElement(Tooltip, {
4499
+ }), /* @__PURE__ */React__namespace.createElement("div", {
4500
+ style: {
4501
+ marginTop: 4
4502
+ }
4503
+ }, /* @__PURE__ */React__namespace.createElement(Tooltip, {
3532
4504
  title: "Apply content"
3533
4505
  }, /* @__PURE__ */React__namespace.createElement("button", {
3534
4506
  type: "button",
@@ -3536,999 +4508,253 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3536
4508
  return handleApply(_item.body);
3537
4509
  },
3538
4510
  color: "primary",
3539
- className: "icon-button small",
3540
- style: {
3541
- marginLeft: 4
3542
- }
4511
+ className: "icon-button small"
3543
4512
  }, /* @__PURE__ */React__namespace.createElement(Copy, {
3544
4513
  size: 16
3545
- }))))));
4514
+ }))))))));
4515
+ }));
4516
+ };
4517
+ var CustomAiIcon = function CustomAiIcon(_ref26) {
4518
+ var _ref26$isGradient = _ref26.isGradient,
4519
+ isGradient = _ref26$isGradient === void 0 ? false : _ref26$isGradient,
4520
+ _ref26$stroke = _ref26.stroke,
4521
+ stroke = _ref26$stroke === void 0 ? 1.5 : _ref26$stroke,
4522
+ _ref26$size = _ref26.size,
4523
+ size = _ref26$size === void 0 ? 40 : _ref26$size;
4524
+ var gradientId = "ai-gradient-" + Math.random().toString(36).substr(2, 9);
4525
+ return /* @__PURE__ */React__namespace.createElement("svg", {
4526
+ xmlns: "http://www.w3.org/2000/svg",
4527
+ width: size,
4528
+ height: size,
4529
+ viewBox: "0 0 24 24",
4530
+ style: {
4531
+ flexShrink: 0
4532
+ }
4533
+ }, isGradient && /* @__PURE__ */React__namespace.createElement("defs", null, /* @__PURE__ */React__namespace.createElement("linearGradient", {
4534
+ id: gradientId,
4535
+ x1: "0%",
4536
+ y1: "0%",
4537
+ x2: "0%",
4538
+ y2: "100%"
4539
+ }, /* @__PURE__ */React__namespace.createElement("stop", {
4540
+ offset: "0%",
4541
+ stopColor: "#9D50BB"
4542
+ }, /* @__PURE__ */React__namespace.createElement("animate", {
4543
+ attributeName: "offset",
4544
+ values: "0%;0.4;0%",
4545
+ dur: "1s",
4546
+ repeatCount: "indefinite"
4547
+ })), /* @__PURE__ */React__namespace.createElement("stop", {
4548
+ offset: "30%",
4549
+ stopColor: "#6E48AA"
4550
+ }, /* @__PURE__ */React__namespace.createElement("animate", {
4551
+ attributeName: "offset",
4552
+ values: "0.4;0.7;0.4",
4553
+ dur: "1s",
4554
+ repeatCount: "indefinite"
4555
+ })), /* @__PURE__ */React__namespace.createElement("stop", {
4556
+ offset: "50%",
4557
+ stopColor: "#4776E6"
4558
+ }, /* @__PURE__ */React__namespace.createElement("animate", {
4559
+ attributeName: "offset",
4560
+ values: "0.5;0.7;0.5",
4561
+ dur: "1s",
4562
+ repeatCount: "indefinite"
4563
+ })), /* @__PURE__ */React__namespace.createElement("animateTransform", {
4564
+ attributeName: "gradientTransform",
4565
+ type: "translate",
4566
+ from: "0,0",
4567
+ to: "100,0",
4568
+ dur: "1s",
4569
+ repeatCount: "indefinite"
4570
+ }))), /* @__PURE__ */React__namespace.createElement("path", {
4571
+ fill: "none",
4572
+ stroke: isGradient ? "url(#".concat(gradientId, ")") : "currentColor",
4573
+ strokeLinecap: "round",
4574
+ strokeLinejoin: "round",
4575
+ strokeWidth: stroke,
4576
+ d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"
3546
4577
  }));
3547
4578
  };
3548
- var circularSize = {
3549
- small: 28,
3550
- medium: 40
3551
- };
3552
- var LoadingContainer = function LoadingContainer(_ref27) {
3553
- var style = _ref27.style,
3554
- _ref27$fullHeight = _ref27.fullHeight,
3555
- fullHeight = _ref27$fullHeight === void 0 ? false : _ref27$fullHeight,
3556
- _ref27$size = _ref27.size,
3557
- size = _ref27$size === void 0 ? "medium" : _ref27$size,
3558
- label = _ref27.label;
3559
- return /* @__PURE__ */React.createElement("div", {
3560
- style: __spreadValues({
3561
- display: "flex",
3562
- alignItems: "center",
3563
- justifyContent: "center",
3564
- width: "100%",
3565
- height: fullHeight ? "100%" : 350
3566
- }, style)
3567
- }, /* @__PURE__ */React.createElement(LoadingCircular, {
3568
- size: circularSize[size]
3569
- }), label && /* @__PURE__ */React.createElement("p", {
3570
- color: "text.secondary",
4579
+ var FEATURES = [{
4580
+ icon: /* @__PURE__ */React__namespace.createElement(MessageCircle, {
4581
+ size: 16
4582
+ }),
4583
+ title: "Request via message",
4584
+ desc: 'e.g., "Draft an email to Director Hong proposing a Q3 collaboration meeting (May 20, 3 PM)"'
4585
+ }, {
4586
+ icon: /* @__PURE__ */React__namespace.createElement(CustomAiIcon, {
4587
+ size: 16,
4588
+ stroke: 2
4589
+ }),
4590
+ title: "AI generates a draft",
4591
+ desc: "Refine the draft freely with follow-ups like 'more polite' or 'add a deadline'."
4592
+ }, {
4593
+ icon: /* @__PURE__ */React__namespace.createElement(Check, {
4594
+ size: 16
4595
+ }),
4596
+ title: "Apply to body",
4597
+ desc: "Insert the response you like into the email body and send."
4598
+ }];
4599
+ var SUGGESTIONS = ["Propose a Q3 meeting to Director Hong (May 20, 3 PM)", "Notify client of payment schedule (Due May 30)", "Welcome message to new employee (Joining May 22)"];
4600
+ var EmptyState = function EmptyState(_ref27) {
4601
+ var onSelectPrompt = _ref27.onSelectPrompt;
4602
+ return /* @__PURE__ */React__namespace.createElement("div", {
3571
4603
  style: {
3572
- marginTop: 16,
3573
- fontSize: size === "small" ? 12 : 13
3574
- }
3575
- }, label));
3576
- };
3577
- var scrollStyle = "\n::-webkit-scrollbar,\n*::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n*::-webkit-scrollbar-track {\n background: transparent;\n backdrop-filter: blur(6px);\n}\n\n::-webkit-scrollbar-thumb,\n*::-webkit-scrollbar-thumb {\n background: #e0e0e0;\n}\n\n::-webkit-scrollbar-thumb:focus,\n*::-webkit-scrollbar-thumb:focus {\n background: #bdbdbd;\n}\n\n::-webkit-scrollbar-thumb:active,\n*::-webkit-scrollbar-thumb:active {\n background: #bdbdbd;\n}\n\n::-webkit-scrollbar-thumb:hover,\n*::-webkit-scrollbar-thumb:hover {\n background: #bdbdbd;\n}\n\n::-webkit-scrollbar-corner,\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}\n";
3578
- var _assign$ = function __assign$2() {
3579
- _assign$ = Object.assign || function (t) {
3580
- for (var s, i = 1, n = arguments.length; i < n; i++) {
3581
- s = arguments[i];
3582
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3583
- }
3584
- return t;
3585
- };
3586
- return _assign$.apply(this, arguments);
3587
- };
3588
- var eventPropTypes = {
3589
- onActivate: propTypesExports.func,
3590
- onAddUndo: propTypesExports.func,
3591
- onBeforeAddUndo: propTypesExports.func,
3592
- onBeforeExecCommand: propTypesExports.func,
3593
- onBeforeGetContent: propTypesExports.func,
3594
- onBeforeRenderUI: propTypesExports.func,
3595
- onBeforeSetContent: propTypesExports.func,
3596
- onBeforePaste: propTypesExports.func,
3597
- onBlur: propTypesExports.func,
3598
- onChange: propTypesExports.func,
3599
- onClearUndos: propTypesExports.func,
3600
- onClick: propTypesExports.func,
3601
- onContextMenu: propTypesExports.func,
3602
- onCommentChange: propTypesExports.func,
3603
- onCopy: propTypesExports.func,
3604
- onCut: propTypesExports.func,
3605
- onDblclick: propTypesExports.func,
3606
- onDeactivate: propTypesExports.func,
3607
- onDirty: propTypesExports.func,
3608
- onDrag: propTypesExports.func,
3609
- onDragDrop: propTypesExports.func,
3610
- onDragEnd: propTypesExports.func,
3611
- onDragGesture: propTypesExports.func,
3612
- onDragOver: propTypesExports.func,
3613
- onDrop: propTypesExports.func,
3614
- onExecCommand: propTypesExports.func,
3615
- onFocus: propTypesExports.func,
3616
- onFocusIn: propTypesExports.func,
3617
- onFocusOut: propTypesExports.func,
3618
- onGetContent: propTypesExports.func,
3619
- onHide: propTypesExports.func,
3620
- onInit: propTypesExports.func,
3621
- onKeyDown: propTypesExports.func,
3622
- onKeyPress: propTypesExports.func,
3623
- onKeyUp: propTypesExports.func,
3624
- onLoadContent: propTypesExports.func,
3625
- onMouseDown: propTypesExports.func,
3626
- onMouseEnter: propTypesExports.func,
3627
- onMouseLeave: propTypesExports.func,
3628
- onMouseMove: propTypesExports.func,
3629
- onMouseOut: propTypesExports.func,
3630
- onMouseOver: propTypesExports.func,
3631
- onMouseUp: propTypesExports.func,
3632
- onNodeChange: propTypesExports.func,
3633
- onObjectResizeStart: propTypesExports.func,
3634
- onObjectResized: propTypesExports.func,
3635
- onObjectSelected: propTypesExports.func,
3636
- onPaste: propTypesExports.func,
3637
- onPostProcess: propTypesExports.func,
3638
- onPostRender: propTypesExports.func,
3639
- onPreProcess: propTypesExports.func,
3640
- onProgressState: propTypesExports.func,
3641
- onRedo: propTypesExports.func,
3642
- onRemove: propTypesExports.func,
3643
- onReset: propTypesExports.func,
3644
- onSaveContent: propTypesExports.func,
3645
- onSelectionChange: propTypesExports.func,
3646
- onSetAttrib: propTypesExports.func,
3647
- onSetContent: propTypesExports.func,
3648
- onShow: propTypesExports.func,
3649
- onSubmit: propTypesExports.func,
3650
- onUndo: propTypesExports.func,
3651
- onVisualAid: propTypesExports.func,
3652
- onSkinLoadError: propTypesExports.func,
3653
- onThemeLoadError: propTypesExports.func,
3654
- onModelLoadError: propTypesExports.func,
3655
- onPluginLoadError: propTypesExports.func,
3656
- onIconsLoadError: propTypesExports.func,
3657
- onLanguageLoadError: propTypesExports.func,
3658
- onScriptsLoad: propTypesExports.func,
3659
- onScriptsLoadError: propTypesExports.func
3660
- };
3661
- var EditorPropTypes = _assign$({
3662
- apiKey: propTypesExports.string,
3663
- id: propTypesExports.string,
3664
- inline: propTypesExports.bool,
3665
- init: propTypesExports.object,
3666
- initialValue: propTypesExports.string,
3667
- onEditorChange: propTypesExports.func,
3668
- value: propTypesExports.string,
3669
- tagName: propTypesExports.string,
3670
- cloudChannel: propTypesExports.string,
3671
- plugins: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.array]),
3672
- toolbar: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.array]),
3673
- disabled: propTypesExports.bool,
3674
- textareaName: propTypesExports.string,
3675
- tinymceScriptSrc: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.arrayOf(propTypesExports.string), propTypesExports.arrayOf(propTypesExports.shape({
3676
- src: propTypesExports.string,
3677
- async: propTypesExports.bool,
3678
- defer: propTypesExports.bool
3679
- }))]),
3680
- rollback: propTypesExports.oneOfType([propTypesExports.number, propTypesExports.oneOf([false])]),
3681
- scriptLoading: propTypesExports.shape({
3682
- async: propTypesExports.bool,
3683
- defer: propTypesExports.bool,
3684
- delay: propTypesExports.number
3685
- })
3686
- }, eventPropTypes);
3687
- var isFunction = function isFunction(x) {
3688
- return typeof x === "function";
3689
- };
3690
- var isEventProp = function isEventProp(name) {
3691
- return name in eventPropTypes;
3692
- };
3693
- var eventAttrToEventName = function eventAttrToEventName(attrName) {
3694
- return attrName.substr(2);
3695
- };
3696
- var configHandlers2 = function configHandlers2(handlerLookup, on, off, adapter, prevProps, props, boundHandlers) {
3697
- var prevEventKeys = Object.keys(prevProps).filter(isEventProp);
3698
- var currEventKeys = Object.keys(props).filter(isEventProp);
3699
- var removedKeys = prevEventKeys.filter(function (key) {
3700
- return props[key] === void 0;
3701
- });
3702
- var addedKeys = currEventKeys.filter(function (key) {
3703
- return prevProps[key] === void 0;
3704
- });
3705
- removedKeys.forEach(function (key) {
3706
- var eventName = eventAttrToEventName(key);
3707
- var wrappedHandler = boundHandlers[eventName];
3708
- off(eventName, wrappedHandler);
3709
- delete boundHandlers[eventName];
3710
- });
3711
- addedKeys.forEach(function (key) {
3712
- var wrappedHandler = adapter(handlerLookup, key);
3713
- var eventName = eventAttrToEventName(key);
3714
- boundHandlers[eventName] = wrappedHandler;
3715
- on(eventName, wrappedHandler);
3716
- });
3717
- };
3718
- var configHandlers = function configHandlers(editor, prevProps, props, boundHandlers, lookup) {
3719
- return configHandlers2(lookup, editor.on.bind(editor), editor.off.bind(editor),
3720
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
3721
- function (handlerLookup, key) {
3722
- return function (e) {
3723
- var _a2;
3724
- return (_a2 = handlerLookup(key)) === null || _a2 === void 0 ? void 0 : _a2(e, editor);
3725
- };
3726
- }, prevProps, props, boundHandlers);
3727
- };
3728
- var unique = 0;
3729
- var uuid = function uuid(prefix) {
3730
- var time = Date.now();
3731
- var random = Math.floor(Math.random() * 1e9);
3732
- unique++;
3733
- return prefix + "_" + random + unique + String(time);
3734
- };
3735
- var isTextareaOrInput = function isTextareaOrInput(element) {
3736
- return element !== null && (element.tagName.toLowerCase() === "textarea" || element.tagName.toLowerCase() === "input");
3737
- };
3738
- var normalizePluginArray = function normalizePluginArray(plugins) {
3739
- if (typeof plugins === "undefined" || plugins === "") {
3740
- return [];
3741
- }
3742
- return Array.isArray(plugins) ? plugins : plugins.split(" ");
3743
- };
3744
- var mergePlugins = function mergePlugins(initPlugins, inputPlugins) {
3745
- return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
3746
- };
3747
- var isBeforeInputEventAvailable = function isBeforeInputEventAvailable() {
3748
- return window.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
3749
- };
3750
- var isInDoc = function isInDoc(elem) {
3751
- if (!("isConnected" in Node.prototype)) {
3752
- var current = elem;
3753
- var parent_1 = elem.parentNode;
3754
- while (parent_1 != null) {
3755
- current = parent_1;
3756
- parent_1 = current.parentNode;
3757
- }
3758
- return current === elem.ownerDocument;
3759
- }
3760
- return elem.isConnected;
3761
- };
3762
- var setMode = function setMode(editor, mode) {
3763
- if (editor !== void 0) {
3764
- if (editor.mode != null && _typeof(editor.mode) === "object" && typeof editor.mode.set === "function") {
3765
- editor.mode.set(mode);
3766
- } else {
3767
- editor.setMode(mode);
3768
- }
3769
- }
3770
- };
3771
- var _assign$2 = function __assign$1() {
3772
- _assign$2 = Object.assign || function (t) {
3773
- for (var s, i = 1, n = arguments.length; i < n; i++) {
3774
- s = arguments[i];
3775
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3776
- }
3777
- return t;
3778
- };
3779
- return _assign$2.apply(this, arguments);
3780
- };
3781
- var injectScriptTag = function injectScriptTag(doc, item, handler) {
3782
- var _a2, _b;
3783
- var scriptTag = doc.createElement("script");
3784
- scriptTag.referrerPolicy = "origin";
3785
- scriptTag.type = "application/javascript";
3786
- scriptTag.id = item.id;
3787
- scriptTag.src = item.src;
3788
- scriptTag.async = (_a2 = item.async) !== null && _a2 !== void 0 ? _a2 : false;
3789
- scriptTag.defer = (_b = item.defer) !== null && _b !== void 0 ? _b : false;
3790
- var _loadHandler = function loadHandler() {
3791
- scriptTag.removeEventListener("load", _loadHandler);
3792
- scriptTag.removeEventListener("error", _errorHandler);
3793
- handler(item.src);
3794
- };
3795
- var _errorHandler = function errorHandler(err) {
3796
- scriptTag.removeEventListener("load", _loadHandler);
3797
- scriptTag.removeEventListener("error", _errorHandler);
3798
- handler(item.src, err);
3799
- };
3800
- scriptTag.addEventListener("load", _loadHandler);
3801
- scriptTag.addEventListener("error", _errorHandler);
3802
- if (doc.head) {
3803
- doc.head.appendChild(scriptTag);
3804
- }
3805
- };
3806
- var createDocumentScriptLoader = function createDocumentScriptLoader(doc) {
3807
- var lookup = {};
3808
- var scriptLoadOrErrorHandler = function scriptLoadOrErrorHandler(src, err) {
3809
- var item = lookup[src];
3810
- item.done = true;
3811
- item.error = err;
3812
- for (var _i = 0, _a2 = item.handlers; _i < _a2.length; _i++) {
3813
- var h = _a2[_i];
3814
- h(src, err);
3815
- }
3816
- item.handlers = [];
3817
- };
3818
- var loadScripts = function loadScripts(items, success, failure) {
3819
- var failureOrLog = function failureOrLog(err) {
3820
- return failure !== void 0 ? failure(err) : console.error(err);
3821
- };
3822
- if (items.length === 0) {
3823
- failureOrLog(new Error("At least one script must be provided"));
3824
- return;
4604
+ flex: 1,
4605
+ minHeight: 0,
4606
+ overflowY: "auto",
4607
+ display: "flex",
4608
+ flexDirection: "column",
4609
+ paddingRight: 8,
4610
+ marginRight: -8,
4611
+ paddingBottom: 16
3825
4612
  }
3826
- var successCount = 0;
3827
- var failed = false;
3828
- var loaded = function loaded(_src, err) {
3829
- if (failed) {
3830
- return;
3831
- }
3832
- if (err) {
3833
- failed = true;
3834
- failureOrLog(err);
3835
- } else if (++successCount === items.length) {
3836
- success();
3837
- }
3838
- };
3839
- for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
3840
- var item = items_1[_i];
3841
- var existing = lookup[item.src];
3842
- if (existing) {
3843
- if (existing.done) {
3844
- loaded(item.src, existing.error);
3845
- } else {
3846
- existing.handlers.push(loaded);
3847
- }
3848
- } else {
3849
- var id = uuid("tiny-");
3850
- lookup[item.src] = {
3851
- id: id,
3852
- src: item.src,
3853
- done: false,
3854
- error: null,
3855
- handlers: [loaded]
3856
- };
3857
- injectScriptTag(doc, _assign$2({
3858
- id: id
3859
- }, item), scriptLoadOrErrorHandler);
3860
- }
4613
+ }, /* @__PURE__ */React__namespace.createElement("div", {
4614
+ style: {
4615
+ textAlign: "center",
4616
+ marginTop: 8
3861
4617
  }
3862
- };
3863
- var deleteScripts = function deleteScripts() {
3864
- var _a2;
3865
- for (var _i = 0, _b = Object.values(lookup); _i < _b.length; _i++) {
3866
- var item = _b[_i];
3867
- var scriptTag = doc.getElementById(item.id);
3868
- if (scriptTag != null && scriptTag.tagName === "SCRIPT") {
3869
- (_a2 = scriptTag.parentNode) === null || _a2 === void 0 ? void 0 : _a2.removeChild(scriptTag);
3870
- }
4618
+ }, /* @__PURE__ */React__namespace.createElement("div", {
4619
+ style: {
4620
+ fontSize: 14,
4621
+ fontWeight: 600,
4622
+ color: "var(--text-primary)",
4623
+ lineHeight: 1.5
3871
4624
  }
3872
- lookup = {};
3873
- };
3874
- var getDocument = function getDocument() {
3875
- return doc;
3876
- };
3877
- return {
3878
- loadScripts: loadScripts,
3879
- deleteScripts: deleteScripts,
3880
- getDocument: getDocument
3881
- };
3882
- };
3883
- var createScriptLoader = function createScriptLoader() {
3884
- var cache = [];
3885
- var getDocumentScriptLoader = function getDocumentScriptLoader(doc) {
3886
- var loader = cache.find(function (l) {
3887
- return l.getDocument() === doc;
3888
- });
3889
- if (loader === void 0) {
3890
- loader = createDocumentScriptLoader(doc);
3891
- cache.push(loader);
4625
+ }, "Let's draft a new email together from scratch."), /* @__PURE__ */React__namespace.createElement("div", {
4626
+ style: {
4627
+ fontSize: 13,
4628
+ color: "var(--text-secondary)",
4629
+ marginTop: 4
3892
4630
  }
3893
- return loader;
3894
- };
3895
- var loadList = function loadList(doc, items, delay, success, failure) {
3896
- var doLoad = function doLoad() {
3897
- return getDocumentScriptLoader(doc).loadScripts(items, success, failure);
3898
- };
3899
- if (delay > 0) {
3900
- setTimeout(doLoad, delay);
3901
- } else {
3902
- doLoad();
4631
+ }, "Tell me what kind of email you'd like to write.")), /* @__PURE__ */React__namespace.createElement("div", {
4632
+ style: {
4633
+ alignSelf: "center",
4634
+ width: 100,
4635
+ height: 100,
4636
+ borderRadius: "50%",
4637
+ background: "var(--primary-lighter)",
4638
+ display: "flex",
4639
+ alignItems: "center",
4640
+ justifyContent: "center",
4641
+ margin: "20px 0",
4642
+ color: "var(--primary-main)",
4643
+ flexShrink: 0
3903
4644
  }
3904
- };
3905
- var reinitialize = function reinitialize() {
3906
- for (var loader = cache.pop(); loader != null; loader = cache.pop()) {
3907
- loader.deleteScripts();
4645
+ }, /* @__PURE__ */React__namespace.createElement(CustomAiIcon, {
4646
+ size: 52,
4647
+ stroke: 1.5
4648
+ })), /* @__PURE__ */React__namespace.createElement("div", {
4649
+ style: {
4650
+ textAlign: "center"
3908
4651
  }
3909
- };
3910
- return {
3911
- loadList: loadList,
3912
- reinitialize: reinitialize
3913
- };
3914
- };
3915
- var ScriptLoader = createScriptLoader();
3916
- var getTinymce = function getTinymce(view) {
3917
- var global = view;
3918
- return global && global.tinymce ? global.tinymce : null;
3919
- };
3920
- var __extends = /* @__PURE__ */function () {
3921
- var _extendStatics = function extendStatics(d, b) {
3922
- _extendStatics = Object.setPrototypeOf || {
3923
- __proto__: []
3924
- } instanceof Array && function (d2, b2) {
3925
- d2.__proto__ = b2;
3926
- } || function (d2, b2) {
3927
- for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
3928
- };
3929
- return _extendStatics(d, b);
3930
- };
3931
- return function (d, b) {
3932
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
3933
- _extendStatics(d, b);
3934
- function __() {
3935
- this.constructor = d;
4652
+ }, /* @__PURE__ */React__namespace.createElement("div", {
4653
+ style: {
4654
+ fontSize: 13,
4655
+ color: "var(--text-secondary)",
4656
+ lineHeight: 1.6
3936
4657
  }
3937
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3938
- };
3939
- }();
3940
- var _assign = function __assign() {
3941
- _assign = Object.assign || function (t) {
3942
- for (var s, i = 1, n = arguments.length; i < n; i++) {
3943
- s = arguments[i];
3944
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4658
+ }, "Give me the recipient, purpose, and key points", /* @__PURE__ */React__namespace.createElement("br", null), "and AI will generate a polished draft.")), /* @__PURE__ */React__namespace.createElement("div", {
4659
+ style: {
4660
+ borderTop: "1px solid var(--border-light)",
4661
+ marginTop: 20,
4662
+ paddingTop: 16,
4663
+ display: "flex",
4664
+ flexDirection: "column",
4665
+ gap: 14
3945
4666
  }
3946
- return t;
3947
- };
3948
- return _assign.apply(this, arguments);
3949
- };
3950
- var Editor = /** @class */
3951
- function (_super) {
3952
- __extends(Editor2, _super);
3953
- function Editor2(props) {
3954
- var _a2, _b, _c;
3955
- var _this = _super.call(this, props) || this;
3956
- _this.rollbackTimer = void 0;
3957
- _this.valueCursor = void 0;
3958
- _this.rollbackChange = function () {
3959
- var editor = _this.editor;
3960
- var value = _this.props.value;
3961
- if (editor && value && value !== _this.currentContent) {
3962
- editor.undoManager.ignore(function () {
3963
- editor.setContent(value);
3964
- if (_this.valueCursor && (!_this.inline || editor.hasFocus())) {
3965
- try {
3966
- editor.selection.moveToBookmark(_this.valueCursor);
3967
- } catch (e) {}
3968
- }
3969
- });
3970
- }
3971
- _this.rollbackTimer = void 0;
3972
- };
3973
- _this.handleBeforeInput = function (_evt) {
3974
- if (_this.props.value !== void 0 && _this.props.value === _this.currentContent && _this.editor) {
3975
- if (!_this.inline || _this.editor.hasFocus()) {
3976
- try {
3977
- _this.valueCursor = _this.editor.selection.getBookmark(3);
3978
- } catch (e) {}
3979
- }
3980
- }
3981
- };
3982
- _this.handleBeforeInputSpecial = function (evt) {
3983
- if (evt.key === "Enter" || evt.key === "Backspace" || evt.key === "Delete") {
3984
- _this.handleBeforeInput(evt);
3985
- }
3986
- };
3987
- _this.handleEditorChange = function (_evt) {
3988
- var editor = _this.editor;
3989
- if (editor && editor.initialized) {
3990
- var newContent = editor.getContent();
3991
- if (_this.props.value !== void 0 && _this.props.value !== newContent && _this.props.rollback !== false) {
3992
- if (!_this.rollbackTimer) {
3993
- _this.rollbackTimer = window.setTimeout(_this.rollbackChange, typeof _this.props.rollback === "number" ? _this.props.rollback : 200);
3994
- }
3995
- }
3996
- if (newContent !== _this.currentContent) {
3997
- _this.currentContent = newContent;
3998
- if (isFunction(_this.props.onEditorChange)) {
3999
- _this.props.onEditorChange(newContent, editor);
4000
- }
4001
- }
4002
- }
4003
- };
4004
- _this.handleEditorChangeSpecial = function (evt) {
4005
- if (evt.key === "Backspace" || evt.key === "Delete") {
4006
- _this.handleEditorChange(evt);
4007
- }
4008
- };
4009
- _this.initialise = function (attempts) {
4010
- var _a3, _b2, _c2;
4011
- if (attempts === void 0) {
4012
- attempts = 0;
4013
- }
4014
- var target = _this.elementRef.current;
4015
- if (!target) {
4016
- return;
4017
- }
4018
- if (!isInDoc(target)) {
4019
- if (attempts === 0) {
4020
- setTimeout(function () {
4021
- return _this.initialise(1);
4022
- }, 1);
4023
- } else if (attempts < 100) {
4024
- setTimeout(function () {
4025
- return _this.initialise(attempts + 1);
4026
- }, 100);
4027
- } else {
4028
- throw new Error("tinymce can only be initialised when in a document");
4029
- }
4030
- return;
4031
- }
4032
- var tinymce = getTinymce(_this.view);
4033
- if (!tinymce) {
4034
- throw new Error("tinymce should have been loaded into global scope");
4035
- }
4036
- var finalInit = _assign(_assign({}, _this.props.init), {
4037
- selector: void 0,
4038
- target: target,
4039
- readonly: _this.props.disabled,
4040
- inline: _this.inline,
4041
- plugins: mergePlugins((_a3 = _this.props.init) === null || _a3 === void 0 ? void 0 : _a3.plugins, _this.props.plugins),
4042
- toolbar: (_b2 = _this.props.toolbar) !== null && _b2 !== void 0 ? _b2 : (_c2 = _this.props.init) === null || _c2 === void 0 ? void 0 : _c2.toolbar,
4043
- setup: function setup(editor) {
4044
- _this.editor = editor;
4045
- _this.bindHandlers({});
4046
- if (_this.inline && !isTextareaOrInput(target)) {
4047
- editor.once("PostRender", function (_evt) {
4048
- editor.setContent(_this.getInitialValue(), {
4049
- no_events: true
4050
- });
4051
- });
4052
- }
4053
- if (_this.props.init && isFunction(_this.props.init.setup)) {
4054
- _this.props.init.setup(editor);
4055
- }
4056
- },
4057
- init_instance_callback: function init_instance_callback(editor) {
4058
- var _a4, _b3;
4059
- var initialValue = _this.getInitialValue();
4060
- _this.currentContent = (_a4 = _this.currentContent) !== null && _a4 !== void 0 ? _a4 : editor.getContent();
4061
- if (_this.currentContent !== initialValue) {
4062
- _this.currentContent = initialValue;
4063
- editor.setContent(initialValue);
4064
- editor.undoManager.clear();
4065
- editor.undoManager.add();
4066
- editor.setDirty(false);
4067
- }
4068
- var disabled = (_b3 = _this.props.disabled) !== null && _b3 !== void 0 ? _b3 : false;
4069
- setMode(_this.editor, disabled ? "readonly" : "design");
4070
- if (_this.props.init && isFunction(_this.props.init.init_instance_callback)) {
4071
- _this.props.init.init_instance_callback(editor);
4072
- }
4073
- }
4074
- });
4075
- if (!_this.inline) {
4076
- target.style.visibility = "";
4667
+ }, FEATURES.map(function (f, i) {
4668
+ return /* @__PURE__ */React__namespace.createElement("div", {
4669
+ key: i,
4670
+ style: {
4671
+ display: "flex",
4672
+ flexDirection: "row",
4673
+ alignItems: "flex-start",
4674
+ gap: 10
4077
4675
  }
4078
- if (isTextareaOrInput(target)) {
4079
- target.value = _this.getInitialValue();
4676
+ }, /* @__PURE__ */React__namespace.createElement("div", {
4677
+ style: {
4678
+ width: 28,
4679
+ height: 28,
4680
+ borderRadius: "50%",
4681
+ background: "var(--background-softGrey)",
4682
+ color: "var(--primary-main)",
4683
+ display: "flex",
4684
+ alignItems: "center",
4685
+ justifyContent: "center",
4686
+ flexShrink: 0
4080
4687
  }
4081
- tinymce.init(finalInit);
4082
- };
4083
- _this.id = _this.props.id || uuid("tiny-react");
4084
- _this.elementRef = React__namespace.createRef();
4085
- _this.inline = (_c = (_a2 = _this.props.inline) !== null && _a2 !== void 0 ? _a2 : (_b = _this.props.init) === null || _b === void 0 ? void 0 : _b.inline) !== null && _c !== void 0 ? _c : false;
4086
- _this.boundHandlers = {};
4087
- return _this;
4088
- }
4089
- Object.defineProperty(Editor2.prototype, "view", {
4090
- get: function get() {
4091
- var _a2, _b;
4092
- return (_b = (_a2 = this.elementRef.current) === null || _a2 === void 0 ? void 0 : _a2.ownerDocument.defaultView) !== null && _b !== void 0 ? _b : window;
4093
- },
4094
- enumerable: false,
4095
- configurable: true
4096
- });
4097
- Editor2.prototype.componentDidUpdate = function (prevProps) {
4098
- var _this = this;
4099
- var _a2, _b;
4100
- if (this.rollbackTimer) {
4101
- clearTimeout(this.rollbackTimer);
4102
- this.rollbackTimer = void 0;
4103
- }
4104
- if (this.editor) {
4105
- this.bindHandlers(prevProps);
4106
- if (this.editor.initialized) {
4107
- this.currentContent = (_a2 = this.currentContent) !== null && _a2 !== void 0 ? _a2 : this.editor.getContent();
4108
- if (typeof this.props.initialValue === "string" && this.props.initialValue !== prevProps.initialValue) {
4109
- this.editor.setContent(this.props.initialValue);
4110
- this.editor.undoManager.clear();
4111
- this.editor.undoManager.add();
4112
- this.editor.setDirty(false);
4113
- } else if (typeof this.props.value === "string" && this.props.value !== this.currentContent) {
4114
- var localEditor_1 = this.editor;
4115
- localEditor_1.undoManager.transact(function () {
4116
- var cursor;
4117
- if (!_this.inline || localEditor_1.hasFocus()) {
4118
- try {
4119
- cursor = localEditor_1.selection.getBookmark(3);
4120
- } catch (e) {}
4121
- }
4122
- var valueCursor = _this.valueCursor;
4123
- localEditor_1.setContent(_this.props.value);
4124
- if (!_this.inline || localEditor_1.hasFocus()) {
4125
- for (var _i = 0, _a3 = [cursor, valueCursor]; _i < _a3.length; _i++) {
4126
- var bookmark = _a3[_i];
4127
- if (bookmark) {
4128
- try {
4129
- localEditor_1.selection.moveToBookmark(bookmark);
4130
- _this.valueCursor = bookmark;
4131
- break;
4132
- } catch (e) {}
4133
- }
4134
- }
4135
- }
4136
- });
4137
- }
4138
- if (this.props.disabled !== prevProps.disabled) {
4139
- var disabled = (_b = this.props.disabled) !== null && _b !== void 0 ? _b : false;
4140
- setMode(this.editor, disabled ? "readonly" : "design");
4141
- }
4688
+ }, f.icon), /* @__PURE__ */React__namespace.createElement("div", {
4689
+ style: {
4690
+ flex: 1,
4691
+ minWidth: 0
4142
4692
  }
4143
- }
4144
- };
4145
- Editor2.prototype.componentDidMount = function () {
4146
- var _this = this;
4147
- var _a2, _b, _c, _d, _e;
4148
- if (getTinymce(this.view) !== null) {
4149
- this.initialise();
4150
- } else if (Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0) {
4151
- (_b = (_a2 = this.props).onScriptsLoadError) === null || _b === void 0 ? void 0 : _b.call(_a2, new Error("No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array."));
4152
- } else if ((_c = this.elementRef.current) === null || _c === void 0 ? void 0 : _c.ownerDocument) {
4153
- var successHandler = function successHandler() {
4154
- var _a3, _b2;
4155
- (_b2 = (_a3 = _this.props).onScriptsLoad) === null || _b2 === void 0 ? void 0 : _b2.call(_a3);
4156
- _this.initialise();
4157
- };
4158
- var errorHandler = function errorHandler(err) {
4159
- var _a3, _b2;
4160
- (_b2 = (_a3 = _this.props).onScriptsLoadError) === null || _b2 === void 0 ? void 0 : _b2.call(_a3, err);
4161
- };
4162
- ScriptLoader.loadList(this.elementRef.current.ownerDocument, this.getScriptSources(), (_e = (_d = this.props.scriptLoading) === null || _d === void 0 ? void 0 : _d.delay) !== null && _e !== void 0 ? _e : 0, successHandler, errorHandler);
4163
- }
4164
- };
4165
- Editor2.prototype.componentWillUnmount = function () {
4166
- var _this = this;
4167
- var editor = this.editor;
4168
- if (editor) {
4169
- editor.off(this.changeEvents(), this.handleEditorChange);
4170
- editor.off(this.beforeInputEvent(), this.handleBeforeInput);
4171
- editor.off("keypress", this.handleEditorChangeSpecial);
4172
- editor.off("keydown", this.handleBeforeInputSpecial);
4173
- editor.off("NewBlock", this.handleEditorChange);
4174
- Object.keys(this.boundHandlers).forEach(function (eventName) {
4175
- editor.off(eventName, _this.boundHandlers[eventName]);
4176
- });
4177
- this.boundHandlers = {};
4178
- editor.remove();
4179
- this.editor = void 0;
4180
- }
4181
- };
4182
- Editor2.prototype.render = function () {
4183
- return this.inline ? this.renderInline() : this.renderIframe();
4184
- };
4185
- Editor2.prototype.changeEvents = function () {
4186
- var _a2, _b, _c;
4187
- var isIE = (_c = (_b = (_a2 = getTinymce(this.view)) === null || _a2 === void 0 ? void 0 : _a2.Env) === null || _b === void 0 ? void 0 : _b.browser) === null || _c === void 0 ? void 0 : _c.isIE();
4188
- return isIE ? "change keyup compositionend setcontent CommentChange" : "change input compositionend setcontent CommentChange";
4189
- };
4190
- Editor2.prototype.beforeInputEvent = function () {
4191
- return isBeforeInputEventAvailable() ? "beforeinput SelectionChange" : "SelectionChange";
4192
- };
4193
- Editor2.prototype.renderInline = function () {
4194
- var _a2 = this.props.tagName,
4195
- tagName = _a2 === void 0 ? "div" : _a2;
4196
- return React__namespace.createElement(tagName, {
4197
- ref: this.elementRef,
4198
- id: this.id
4199
- });
4200
- };
4201
- Editor2.prototype.renderIframe = function () {
4202
- return React__namespace.createElement("textarea", {
4203
- ref: this.elementRef,
4693
+ }, /* @__PURE__ */React__namespace.createElement("div", {
4204
4694
  style: {
4205
- visibility: "hidden"
4206
- },
4207
- name: this.props.textareaName,
4208
- id: this.id
4209
- });
4210
- };
4211
- Editor2.prototype.getScriptSources = function () {
4212
- var _a2, _b;
4213
- var async = (_a2 = this.props.scriptLoading) === null || _a2 === void 0 ? void 0 : _a2.async;
4214
- var defer = (_b = this.props.scriptLoading) === null || _b === void 0 ? void 0 : _b.defer;
4215
- if (this.props.tinymceScriptSrc !== void 0) {
4216
- if (typeof this.props.tinymceScriptSrc === "string") {
4217
- return [{
4218
- src: this.props.tinymceScriptSrc,
4219
- async: async,
4220
- defer: defer
4221
- }];
4695
+ fontSize: 13,
4696
+ fontWeight: 600,
4697
+ color: "var(--text-primary)"
4222
4698
  }
4223
- return this.props.tinymceScriptSrc.map(function (item) {
4224
- if (typeof item === "string") {
4225
- return {
4226
- src: item,
4227
- async: async,
4228
- defer: defer
4229
- };
4230
- } else {
4231
- return item;
4232
- }
4233
- });
4234
- }
4235
- var channel = this.props.cloudChannel;
4236
- var apiKey = this.props.apiKey ? this.props.apiKey : "no-api-key";
4237
- var cloudTinyJs = "https://cdn.tiny.cloud/1/".concat(apiKey, "/tinymce/").concat(channel, "/tinymce.min.js");
4238
- return [{
4239
- src: cloudTinyJs,
4240
- async: async,
4241
- defer: defer
4242
- }];
4243
- };
4244
- Editor2.prototype.getInitialValue = function () {
4245
- if (typeof this.props.initialValue === "string") {
4246
- return this.props.initialValue;
4247
- } else if (typeof this.props.value === "string") {
4248
- return this.props.value;
4249
- } else {
4250
- return "";
4251
- }
4252
- };
4253
- Editor2.prototype.bindHandlers = function (prevProps) {
4254
- var _this = this;
4255
- if (this.editor !== void 0) {
4256
- configHandlers(this.editor, prevProps, this.props, this.boundHandlers, function (key) {
4257
- return _this.props[key];
4258
- });
4259
- var isValueControlled = function isValueControlled(p) {
4260
- return p.onEditorChange !== void 0 || p.value !== void 0;
4261
- };
4262
- var wasControlled = isValueControlled(prevProps);
4263
- var nowControlled = isValueControlled(this.props);
4264
- if (!wasControlled && nowControlled) {
4265
- this.editor.on(this.changeEvents(), this.handleEditorChange);
4266
- this.editor.on(this.beforeInputEvent(), this.handleBeforeInput);
4267
- this.editor.on("keydown", this.handleBeforeInputSpecial);
4268
- this.editor.on("keyup", this.handleEditorChangeSpecial);
4269
- this.editor.on("NewBlock", this.handleEditorChange);
4270
- } else if (wasControlled && !nowControlled) {
4271
- this.editor.off(this.changeEvents(), this.handleEditorChange);
4272
- this.editor.off(this.beforeInputEvent(), this.handleBeforeInput);
4273
- this.editor.off("keydown", this.handleBeforeInputSpecial);
4274
- this.editor.off("keyup", this.handleEditorChangeSpecial);
4275
- this.editor.off("NewBlock", this.handleEditorChange);
4699
+ }, f.title), /* @__PURE__ */React__namespace.createElement("div", {
4700
+ style: {
4701
+ fontSize: 12,
4702
+ color: "var(--text-secondary)",
4703
+ marginTop: 2,
4704
+ lineHeight: 1.5
4276
4705
  }
4706
+ }, f.desc)));
4707
+ })), /* @__PURE__ */React__namespace.createElement("div", {
4708
+ style: {
4709
+ borderTop: "1px solid var(--border-light)",
4710
+ marginTop: 20,
4711
+ paddingTop: 16
4277
4712
  }
4278
- };
4279
- Editor2.propTypes = EditorPropTypes;
4280
- Editor2.defaultProps = {
4281
- cloudChannel: "6"
4282
- };
4283
- return Editor2;
4284
- }(React__namespace.Component);
4285
- var useEditor = function useEditor(options) {
4286
- var isSimple = options.isSimple,
4287
- noImage = options.noImage;
4288
- var fontSize = 13;
4289
- var fontType = void 0;
4290
- var fontWeight = 0;
4291
- var lang = "en";
4292
- var imageUploadBasePath = getBaseUrl();
4293
- var supportImageTypes = "jpeg,JPEG,jpg,JPG,jpe,JPE,jfi,jif,jfif,png,PNG,gif,GIF,bmp,BMP,webp,WEBP";
4294
- var fontfamily = function () {
4295
- var baseFonts = "Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats;";
4296
- var localeFonts = {
4297
- ko: '맑은고딕=Malgun Gothic;돋움="돋움",Dotum;돋움체="돋움체",DotumChe;굴림="굴림",Gulim;굴림체="굴림체",GulimChe;바탕="바탕",Batang;바탕체="바탕체",BatangChe;궁서="궁서",Gungseo;',
4298
- en: "MS PGothic=MS PGothic,Sans-serif;Meiryo UI=Meiryo UI,Sans-serif;HiraKakuProN-W3=HiraKakuProN-W3;MS PMincho=MS PMincho,Sans-serif;MS Gothic=MS Gothic,Sans-serif;MS Mincho=MS Mincho,Sans-serif;",
4299
- ch: "Microsoft YaHei=Microsoft YaHei,Sans-serif;"
4300
- };
4301
- return localeFonts[lang] + baseFonts;
4302
- }();
4303
- var imageUploadUrl = function () {
4304
- var locationInfo = window.location;
4305
- var hostname = locationInfo.hostname;
4306
- if (hostname === "localhost" || hostname === "127.0.0.1") {
4307
- return "".concat(imageUploadBasePath, "/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload");
4308
- } else {
4309
- return "".concat(imageUploadBasePath, "/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload");
4310
- }
4311
- }();
4312
- var defaultPlugins;
4313
- var defaultToolbar = [];
4314
- if (isSimple) {
4315
- defaultPlugins = "hanbiroclip";
4316
- defaultToolbar = ["fontfamily fontsize", "bold italic underline", "forecolor backcolor", "bullist numlist", "emoticons"];
4317
- } else {
4318
- defaultPlugins = "checklist lists link image table code codesample insertdatetime emoticons fullscreen wordcount hanbiroclip";
4319
- defaultToolbar = ["fontfamily fontsize styles", "align lineheight checklist", "bold italic underline", "forecolor backcolor", "bullist numlist", "link image table", "code codesample", "insertdatetime emoticons", "fullscreen", "removeformat"];
4320
- }
4321
- var setupFunction = function setupFunction(ed) {
4322
- ed.on("init", function () {
4323
- setTimeout(function () {
4324
- var editorBody = ed == null ? void 0 : ed.getBody();
4325
- var style = [];
4326
- {
4327
- ed.execCommand("FontSize", false, fontSize);
4328
- style.push("font-size: ".concat(fontSize, "pt;"));
4329
- }
4330
- if ((style == null ? void 0 : style.length) > 0) {
4331
- editorBody == null ? void 0 : editorBody.setAttribute("style", style.join(" "));
4332
- }
4333
- if (Number(fontWeight)) {
4334
- ed.execCommand("Bold");
4335
- }
4336
- }, 0);
4337
- });
4338
- if (noImage) {
4339
- ed.on("BeforeSetContent", function (e) {
4340
- if (/<img[\s\S]*?>/i.test(e == null ? void 0 : e.content)) {
4341
- ed.windowManager.alert("Image is not allowed!");
4342
- }
4343
- });
4344
- }
4345
- };
4346
- var filePickerHandle = function filePickerHandle(cb) {
4347
- var input = document.createElement("input");
4348
- input.setAttribute("type", "file");
4349
- input.setAttribute("accept", "image/*");
4350
- input.onchange = function (event) {
4351
- var fileInput = event.target;
4352
- var file = fileInput.files && fileInput.files[0];
4353
- if (file) {
4354
- var reader = new FileReader();
4355
- reader.onload = function () {
4356
- var id = "blobid" + (/* @__PURE__ */new Date()).getTime();
4357
- var blobCache = window.tinymce.activeEditor.editorUpload.blobCache;
4358
- var result = reader.result;
4359
- if (result && typeof result === "string") {
4360
- var base64 = result.split(",")[1];
4361
- var blobInfo = blobCache.create(id, file, base64);
4362
- blobCache.add(blobInfo);
4363
- cb(blobInfo.blobUri(), {
4364
- title: file.name
4365
- });
4366
- }
4367
- };
4368
- reader.readAsDataURL(file);
4369
- }
4370
- };
4371
- input.click();
4372
- };
4373
- return {
4374
- defaultPlugins: defaultPlugins,
4375
- defaultToolbar: defaultToolbar == null ? void 0 : defaultToolbar.join(" | "),
4376
- imageUploadBasePath: imageUploadBasePath,
4377
- imageUploadUrl: imageUploadUrl,
4378
- supportImageTypes: supportImageTypes,
4379
- fontfamily: fontfamily,
4380
- setupFunction: setupFunction,
4381
- filePickerHandle: filePickerHandle,
4382
- defaultFontType: fontType,
4383
- defaultFontSize: fontSize,
4384
- isFontWeightBold: Number(fontWeight) === 1
4385
- };
4386
- };
4387
- var TinyMceEditor = /*#__PURE__*/function (_React$Component) {
4388
- function TinyMceEditor(props) {
4389
- var _this1;
4390
- _classCallCheck(this, TinyMceEditor);
4391
- _this1 = _callSuper(this, TinyMceEditor, [props]);
4392
- __publicField(_this1, "editorRef", null);
4393
- // Các hàm public được expose ra (tương tự như useImperativeHandle trước đó)
4394
- __publicField(_this1, "getContent", function () {
4395
- var _a2;
4396
- var editorContent = ((_a2 = _this1.editorRef) == null ? void 0 : _a2.getContent()) || "";
4397
- return {
4398
- content: editorContent
4399
- };
4400
- });
4401
- __publicField(_this1, "getRawContent", function () {
4402
- var _a2;
4403
- var editorContent = ((_a2 = _this1.editorRef) == null ? void 0 : _a2.getContent()) || "";
4404
- return editorContent;
4405
- });
4406
- __publicField(_this1, "handleEditorChange", function (content) {
4407
- if (_this1.props.onChange) {
4408
- _this1.props.onChange(content);
4409
- }
4410
- });
4411
- _this1.state = {
4412
- showEditor: false
4413
- };
4414
- return _this1;
4415
- }
4416
- _inherits(TinyMceEditor, _React$Component);
4417
- return _createClass(TinyMceEditor, [{
4418
- key: "render",
4419
- value: function render() {
4420
- var _this10 = this;
4421
- var _this$props3 = this.props,
4422
- value = _this$props3.value,
4423
- _this$props3$isSimple = _this$props3.isSimple,
4424
- isSimple = _this$props3$isSimple === void 0 ? false : _this$props3$isSimple,
4425
- _this$props3$disabled = _this$props3.disabled,
4426
- disabled = _this$props3$disabled === void 0 ? false : _this$props3$disabled,
4427
- _this$props3$height = _this$props3.height,
4428
- height = _this$props3$height === void 0 ? 550 : _this$props3$height,
4429
- _this$props3$skin = _this$props3.skin,
4430
- skin = _this$props3$skin === void 0 ? "tinymce-5" : _this$props3$skin,
4431
- onClick = _this$props3.onClick,
4432
- style = _this$props3.style,
4433
- _this$props3$lang = _this$props3.lang,
4434
- lang = _this$props3$lang === void 0 ? "en" : _this$props3$lang,
4435
- _this$props3$placehol = _this$props3.placeholder,
4436
- placeholder = _this$props3$placehol === void 0 ? "" : _this$props3$placehol,
4437
- options = _this$props3.options,
4438
- _this$props3$noImage = _this$props3.noImage,
4439
- noImage = _this$props3$noImage === void 0 ? false : _this$props3$noImage;
4440
- var showEditor = this.state.showEditor;
4441
- var _useEditor = useEditor({
4442
- isSimple: isSimple,
4443
- noImage: noImage
4444
- }),
4445
- defaultPlugins = _useEditor.defaultPlugins,
4446
- defaultToolbar = _useEditor.defaultToolbar,
4447
- imageUploadBasePath = _useEditor.imageUploadBasePath,
4448
- imageUploadUrl = _useEditor.imageUploadUrl,
4449
- supportImageTypes = _useEditor.supportImageTypes,
4450
- fontfamily = _useEditor.fontfamily,
4451
- setupFunction = _useEditor.setupFunction,
4452
- filePickerHandle = _useEditor.filePickerHandle,
4453
- defaultFontSize = _useEditor.defaultFontSize;
4454
- return /* @__PURE__ */React.createElement("div", {
4455
- style: __spreadValues({
4456
- position: "relative",
4457
- borderRadius: 1,
4458
- height: height
4459
- }, style)
4460
- }, /* @__PURE__ */React.createElement("style", null, "\n .tox.tox-tinymce {\n border-radius: 4px;\n }\n "), !showEditor && /* @__PURE__ */React.createElement(LoadingContainer, {
4461
- style: {
4462
- position: "absolute",
4463
- top: 0,
4464
- left: 0,
4465
- right: 0,
4466
- zIndex: 12,
4467
- background: "#ffffff",
4468
- border: "1px solid var(--border-main)",
4469
- borderRadius: 4,
4470
- height: (options == null ? void 0 : options.height) || height
4471
- }
4472
- }), /* @__PURE__ */React.createElement(Editor, {
4473
- disabled: disabled,
4474
- onEditorChange: this.handleEditorChange,
4475
- value: value,
4476
- onInit: function onInit(evt, editor) {
4477
- _this10.setState({
4478
- showEditor: true
4479
- });
4480
- _this10.editorRef = editor;
4481
- },
4482
- onClick: onClick,
4483
- plugins: defaultPlugins,
4484
- init: __spreadProps(__spreadValues({
4485
- text_patterns: false,
4486
- placeholder: placeholder,
4487
- indent: false,
4488
- skin: skin,
4489
- visual: false,
4490
- promotion: false,
4491
- language: lang || "en",
4492
- // language_url: language
4493
- // ? `${process.env.PUBLIC_URL || ""}/js/tinymce/langs/${language}.js`
4494
- // : undefined,
4495
- branding: false,
4496
- elementpath: false,
4497
- height: height,
4498
- menubar: !isSimple,
4499
- verify_html: true,
4500
- toolbar: defaultToolbar,
4501
- toolbar_mode: "sliding",
4502
- images_upload_base_path: imageUploadBasePath,
4503
- images_upload_url: imageUploadUrl,
4504
- images_upload_credentials: true,
4505
- automatic_uploads: true,
4506
- images_file_types: supportImageTypes,
4507
- font_family_formats: fontfamily,
4508
- paste_data_images: true,
4509
- a11y_advanced_options: true,
4510
- image_advtab: true,
4511
- file_picker_types: "file image media",
4512
- file_picker_callback: filePickerHandle,
4513
- forced_root_block_attrs: {
4514
- style: "margin: 0;"
4515
- },
4516
- font_size_formats: "6pt 8pt 9pt 10pt 11pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 36pt 48pt 72pt"
4517
- }, noImage && {
4518
- invalid_elements: "img"
4519
- }), {
4520
- content_style: "\n ".concat(scrollStyle, "\n [data-mce-placeholder]::before {\n color: rgba(0, 23, 55, 0.42) !important;\n }\n body { \n font-family: ", "Helvetica,Arial,sans-serif", "; \n font-size: ").concat(defaultFontSize, "pt;\n line-height: unset;\n background: var(--background-softGrey);\n color: var(--text-primary);\n }"),
4521
- setup: setupFunction,
4522
- relative_urls: false,
4523
- remove_script_host: false,
4524
- document_base_url: "/"
4525
- })
4526
- }));
4713
+ }, /* @__PURE__ */React__namespace.createElement("div", {
4714
+ style: {
4715
+ fontSize: 12,
4716
+ color: "var(--text-secondary)",
4717
+ marginBottom: 8
4527
4718
  }
4528
- }]);
4529
- }(React.Component);
4719
+ }, "💡 Try these prompts to get a draft right away"), /* @__PURE__ */React__namespace.createElement("div", {
4720
+ style: {
4721
+ display: "flex",
4722
+ flexDirection: "column",
4723
+ gap: 8
4724
+ }
4725
+ }, SUGGESTIONS.map(function (s, i) {
4726
+ return /* @__PURE__ */React__namespace.createElement("button", {
4727
+ key: i,
4728
+ type: "button",
4729
+ onClick: function onClick() {
4730
+ return onSelectPrompt(s);
4731
+ },
4732
+ style: {
4733
+ display: "flex",
4734
+ alignItems: "center",
4735
+ gap: 8,
4736
+ width: "100%",
4737
+ padding: "10px 12px",
4738
+ borderRadius: 8,
4739
+ border: "none",
4740
+ background: "var(--primary-lighter)",
4741
+ color: "var(--text-primary)",
4742
+ fontSize: 13,
4743
+ textAlign: "left",
4744
+ cursor: "pointer",
4745
+ fontFamily: "inherit"
4746
+ }
4747
+ }, /* @__PURE__ */React__namespace.createElement(MessageSquare, {
4748
+ size: 14,
4749
+ style: {
4750
+ color: "var(--primary-main)",
4751
+ flexShrink: 0
4752
+ }
4753
+ }), /* @__PURE__ */React__namespace.createElement("span", null, s));
4754
+ }))));
4755
+ };
4530
4756
  var apiGet = function apiGet(url, opts) {
4531
- return __async(_this0, null, /*#__PURE__*/_regenerator().m(function _callee3() {
4757
+ return __async(_this9, null, /*#__PURE__*/_regenerator().m(function _callee3() {
4532
4758
  var response, data;
4533
4759
  return _regenerator().w(function (_context3) {
4534
4760
  while (1) switch (_context3.n) {
@@ -4565,205 +4791,38 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4565
4791
  }, _callee3);
4566
4792
  }));
4567
4793
  };
4568
- var SettingPopper = /*#__PURE__*/function (_React__namespace$Com2) {
4569
- function SettingPopper(props) {
4570
- var _this11;
4571
- _classCallCheck(this, SettingPopper);
4572
- _this11 = _callSuper(this, SettingPopper, [props]);
4573
- __publicField(_this11, "containerRef");
4574
- __publicField(_this11, "popperRef");
4575
- __publicField(_this11, "getLanguageOptions", function () {
4576
- return __async(_this11, null, /*#__PURE__*/_regenerator().m(function _callee4() {
4577
- var _a2, _yield$apiGet, data, langs;
4578
- return _regenerator().w(function (_context4) {
4579
- while (1) switch (_context4.n) {
4580
- case 0:
4581
- _context4.n = 1;
4582
- return apiGet("/email/ai/langlist");
4583
- case 1:
4584
- _yield$apiGet = _context4.v;
4585
- data = _yield$apiGet.data;
4586
- if (data == null ? void 0 : data.list) {
4587
- langs = (_a2 = Object.keys(data == null ? void 0 : data.list)) == null ? void 0 : _a2.map(function (_key, i) {
4588
- var _a3;
4589
- var _item = (_a3 = data == null ? void 0 : data.list) == null ? void 0 : _a3[_key];
4590
- return {
4591
- value: _key,
4592
- label: _item == null ? void 0 : _item.name
4593
- };
4594
- });
4595
- this.setState({
4596
- languageOptions: langs
4597
- });
4598
- }
4599
- case 2:
4600
- return _context4.a(2);
4601
- }
4602
- }, _callee4, this);
4603
- }));
4604
- });
4605
- __publicField(_this11, "handleClickOutside", function (event) {
4606
- var target = event.target;
4607
- if (_this11.containerRef.current && !_this11.containerRef.current.contains(target) && (!_this11.popperRef.current || !_this11.popperRef.current.contains(target))) {
4608
- _this11.setState({
4609
- open: false
4610
- });
4611
- }
4612
- });
4613
- __publicField(_this11, "togglePopper", function () {
4614
- _this11.setState(function (prevState) {
4615
- return {
4616
- open: !prevState.open
4617
- };
4618
- });
4619
- });
4620
- __publicField(_this11, "handleLangChange", function (e) {
4621
- var selected = _this11.state.languageOptions.find(function (opt) {
4622
- return opt.value === e.target.value;
4623
- });
4624
- _this11.props.setLang(selected || null);
4625
- });
4626
- _this11.state = {
4627
- open: false,
4628
- languageOptions: []
4629
- };
4630
- _this11.containerRef = React__namespace.createRef();
4631
- _this11.popperRef = React__namespace.createRef();
4632
- return _this11;
4633
- }
4634
- _inherits(SettingPopper, _React__namespace$Com2);
4635
- return _createClass(SettingPopper, [{
4636
- key: "componentDidMount",
4637
- value: function componentDidMount() {
4638
- document.addEventListener("mousedown", this.handleClickOutside);
4639
- this.getLanguageOptions();
4640
- }
4641
- }, {
4642
- key: "componentWillUnmount",
4643
- value: function componentWillUnmount() {
4644
- document.removeEventListener("mousedown", this.handleClickOutside);
4645
- }
4646
- }, {
4647
- key: "render",
4648
- value: function render() {
4649
- var _this$props4 = this.props,
4650
- lang = _this$props4.lang,
4651
- originalEmail = _this$props4.originalEmail,
4652
- setOriginalEmail = _this$props4.setOriginalEmail,
4653
- getEditorContent = _this$props4.getEditorContent,
4654
- parentRef = _this$props4.parentRef;
4655
- var _this$state2 = this.state,
4656
- open = _this$state2.open,
4657
- languageOptions = _this$state2.languageOptions;
4658
- var popperTop = 0;
4659
- var popperLeft = 0;
4660
- var popperWidth = 320;
4661
- if (open && this.containerRef.current) {
4662
- var rect = this.containerRef.current.getBoundingClientRect();
4663
- popperTop = rect.top + (window.scrollY || document.documentElement.scrollTop) - 8;
4664
- popperLeft = rect.left + (window.scrollX || document.documentElement.scrollLeft);
4665
- if (parentRef && parentRef.current) {
4666
- var parentRect = parentRef.current.getBoundingClientRect();
4667
- popperWidth = parentRect.width - 16;
4668
- popperLeft = parentRect.left + 8;
4669
- }
4670
- }
4671
- return /* @__PURE__ */React__namespace.createElement("div", {
4672
- ref: this.containerRef,
4673
- style: {
4674
- position: "relative",
4675
- display: "inline-block"
4676
- }
4677
- }, /* @__PURE__ */React__namespace.createElement("button", {
4678
- type: "button",
4679
- onClick: this.togglePopper,
4680
- className: "icon-button small"
4681
- }, /* @__PURE__ */React__namespace.createElement(Settings, {
4682
- size: 16
4683
- })), open && this.containerRef.current && ReactDOM__namespace.createPortal(/* @__PURE__ */React__namespace.createElement("div", {
4684
- ref: this.popperRef,
4685
- style: {
4686
- position: "absolute",
4687
- top: popperTop,
4688
- left: popperLeft,
4689
- transform: "translateY(-100%)",
4690
- zIndex: 1051,
4691
- background: "#fff",
4692
- border: "1px solid #ddd",
4693
- boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
4694
- borderRadius: 8,
4695
- padding: 16,
4696
- width: popperWidth,
4697
- boxSizing: "border-box"
4698
- }
4699
- }, /* @__PURE__ */React__namespace.createElement("div", {
4700
- style: {
4701
- display: "flex",
4702
- flexDirection: "column",
4703
- gap: 12
4704
- }
4705
- }, /* @__PURE__ */React__namespace.createElement("div", {
4706
- style: {
4707
- display: "flex",
4708
- flexDirection: "column",
4709
- gap: 4
4710
- }
4711
- }, /* @__PURE__ */React__namespace.createElement("span", {
4712
- style: {
4713
- fontSize: 12,
4714
- fontWeight: 500
4715
- // color: "var(--text-secondary)",
4716
- }
4717
- }, "Language"), /* @__PURE__ */React__namespace.createElement("select", {
4718
- name: "language",
4719
- value: lang ? lang.value : "",
4720
- onChange: this.handleLangChange
4721
- }, /* @__PURE__ */React__namespace.createElement("option", {
4722
- value: "",
4723
- disabled: true
4724
- }, "Select Language"), languageOptions.map(function (opt) {
4725
- return /* @__PURE__ */React__namespace.createElement("option", {
4726
- key: opt.value,
4727
- value: opt.value
4728
- }, opt.label);
4729
- }))), /* @__PURE__ */React__namespace.createElement("div", {
4730
- style: {
4731
- display: "flex",
4732
- flexDirection: "column",
4733
- gap: 4
4734
- }
4735
- }, /* @__PURE__ */React__namespace.createElement("div", {
4736
- style: {
4737
- display: "flex",
4738
- alignItems: "center",
4739
- justifyContent: "space-between"
4740
- }
4741
- }, /* @__PURE__ */React__namespace.createElement("span", {
4742
- style: {
4743
- fontSize: 12,
4744
- fontWeight: 500
4745
- // color: "var(--text-secondary)",
4746
- }
4747
- }, "AI Context"), getEditorContent && /* @__PURE__ */React__namespace.createElement(Tooltip, {
4748
- title: "Copy from origin email"
4749
- }, /* @__PURE__ */React__namespace.createElement("button", {
4750
- type: "button",
4751
- onClick: function onClick() {
4752
- var currentContent = getEditorContent();
4753
- setOriginalEmail(currentContent);
4754
- },
4755
- className: "icon-button small"
4756
- }, /* @__PURE__ */React__namespace.createElement(Copy, null)))), /* @__PURE__ */React__namespace.createElement(TinyMceEditor, {
4757
- value: originalEmail,
4758
- onChange: function onChange(val) {
4759
- return setOriginalEmail(val);
4760
- },
4761
- height: 350,
4762
- isSimple: true
4763
- })))), document.body));
4764
- }
4765
- }]);
4766
- }(React__namespace.Component);
4794
+ var TONE_OPTIONS = [{
4795
+ label: "Formal",
4796
+ value: "formal"
4797
+ }, {
4798
+ label: "Polite",
4799
+ value: "polite"
4800
+ }, {
4801
+ label: "Neutral",
4802
+ value: "neutral"
4803
+ }, {
4804
+ label: "Friendly",
4805
+ value: "friendly"
4806
+ }, {
4807
+ label: "Firm",
4808
+ value: "firm"
4809
+ }, {
4810
+ label: "Apology",
4811
+ value: "apologetic"
4812
+ }];
4813
+ var LENGTH_OPTIONS = [{
4814
+ label: "Short",
4815
+ value: "short"
4816
+ }, {
4817
+ label: "Medium",
4818
+ value: "medium"
4819
+ }, {
4820
+ label: "Long",
4821
+ value: "long"
4822
+ }, {
4823
+ label: "1-liner",
4824
+ value: "one_liner"
4825
+ }];
4767
4826
  var AI_LANG_FLAGS = [{
4768
4827
  label: "English",
4769
4828
  value: "en",
@@ -6382,42 +6441,471 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6382
6441
  us: USFlag,
6383
6442
  vn: VNFlag
6384
6443
  };
6385
- var CountryFlag = function CountryFlag(props) {
6386
- var _a2 = props,
6387
- flagCode = _a2.flagCode,
6388
- style = _a2.style,
6389
- rest = __objRest(_a2, ["flagCode", "style"]);
6390
- if (!flagCode) return null;
6391
- var FlagComponent = FlagMap[flagCode];
6392
- if (!FlagComponent) return null;
6393
- return /* @__PURE__ */React__namespace.createElement(FlagComponent, __spreadValues({
6394
- style: style
6395
- }, rest));
6444
+ var CountryFlag = function CountryFlag(props) {
6445
+ var _a2 = props,
6446
+ flagCode = _a2.flagCode,
6447
+ style = _a2.style,
6448
+ rest = __objRest(_a2, ["flagCode", "style"]);
6449
+ if (!flagCode) return null;
6450
+ var FlagComponent = FlagMap[flagCode];
6451
+ if (!FlagComponent) return null;
6452
+ return /* @__PURE__ */React__namespace.createElement(FlagComponent, __spreadValues({
6453
+ style: style
6454
+ }, rest));
6455
+ };
6456
+ var getFlagCode = function getFlagCode(value) {
6457
+ var _a2;
6458
+ return (_a2 = AI_LANG_FLAGS.find(function (l) {
6459
+ return l.value === value;
6460
+ })) == null ? void 0 : _a2.flagCode;
6461
+ };
6462
+ var LanguageSelect = /*#__PURE__*/function (_React__namespace$Com2) {
6463
+ function LanguageSelect(props) {
6464
+ var _this0;
6465
+ _classCallCheck(this, LanguageSelect);
6466
+ _this0 = _callSuper(this, LanguageSelect, [props]);
6467
+ __publicField(_this0, "ref");
6468
+ __publicField(_this0, "handleClickOutside", function (e) {
6469
+ if (_this0.ref.current && !_this0.ref.current.contains(e.target)) {
6470
+ _this0.setState({
6471
+ open: false
6472
+ });
6473
+ }
6474
+ });
6475
+ __publicField(_this0, "toggle", function () {
6476
+ _this0.setState(function (s) {
6477
+ return {
6478
+ open: !s.open
6479
+ };
6480
+ });
6481
+ });
6482
+ __publicField(_this0, "pick", function (opt) {
6483
+ _this0.props.onChange(opt);
6484
+ _this0.setState({
6485
+ open: false
6486
+ });
6487
+ });
6488
+ _this0.state = {
6489
+ open: false
6490
+ };
6491
+ _this0.ref = React__namespace.createRef();
6492
+ return _this0;
6493
+ }
6494
+ _inherits(LanguageSelect, _React__namespace$Com2);
6495
+ return _createClass(LanguageSelect, [{
6496
+ key: "componentDidMount",
6497
+ value: function componentDidMount() {
6498
+ document.addEventListener("mousedown", this.handleClickOutside);
6499
+ }
6500
+ }, {
6501
+ key: "componentWillUnmount",
6502
+ value: function componentWillUnmount() {
6503
+ document.removeEventListener("mousedown", this.handleClickOutside);
6504
+ }
6505
+ }, {
6506
+ key: "render",
6507
+ value: function render() {
6508
+ var _this1 = this;
6509
+ var _this$props3 = this.props,
6510
+ value = _this$props3.value,
6511
+ options = _this$props3.options;
6512
+ var open = this.state.open;
6513
+ var selectedFlag = getFlagCode(value == null ? void 0 : value.value);
6514
+ return /* @__PURE__ */React__namespace.createElement("div", {
6515
+ ref: this.ref,
6516
+ style: {
6517
+ position: "relative",
6518
+ width: "100%"
6519
+ }
6520
+ }, /* @__PURE__ */React__namespace.createElement("button", {
6521
+ type: "button",
6522
+ onClick: this.toggle,
6523
+ style: {
6524
+ width: "100%",
6525
+ display: "flex",
6526
+ alignItems: "center",
6527
+ gap: 8,
6528
+ padding: "8px 10px",
6529
+ border: "1px solid var(--border-main)",
6530
+ borderRadius: 4,
6531
+ background: "#fff",
6532
+ cursor: "pointer",
6533
+ fontFamily: "inherit",
6534
+ fontSize: 13,
6535
+ color: "var(--text-primary)"
6536
+ }
6537
+ }, selectedFlag && /* @__PURE__ */React__namespace.createElement(CountryFlag, {
6538
+ flagCode: selectedFlag,
6539
+ style: {
6540
+ width: 18,
6541
+ height: 14,
6542
+ flexShrink: 0
6543
+ }
6544
+ }), /* @__PURE__ */React__namespace.createElement("span", {
6545
+ style: {
6546
+ flex: 1,
6547
+ textAlign: "left"
6548
+ }
6549
+ }, (value == null ? void 0 : value.label) || "Select Language"), /* @__PURE__ */React__namespace.createElement(ChevronDown, {
6550
+ size: 14,
6551
+ style: {
6552
+ transform: open ? "rotate(180deg)" : "none",
6553
+ transition: "transform 0.15s"
6554
+ }
6555
+ })), open && /* @__PURE__ */React__namespace.createElement("div", {
6556
+ style: {
6557
+ position: "absolute",
6558
+ top: "calc(100% + 4px)",
6559
+ left: 0,
6560
+ right: 0,
6561
+ maxHeight: 220,
6562
+ overflowY: "auto",
6563
+ border: "1px solid var(--border-main)",
6564
+ borderRadius: 4,
6565
+ background: "#fff",
6566
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.08)",
6567
+ zIndex: 2
6568
+ }
6569
+ }, options.map(function (opt) {
6570
+ var fc = getFlagCode(opt.value);
6571
+ var isActive = (value == null ? void 0 : value.value) === opt.value;
6572
+ return /* @__PURE__ */React__namespace.createElement("button", {
6573
+ key: opt.value,
6574
+ type: "button",
6575
+ onClick: function onClick() {
6576
+ return _this1.pick(opt);
6577
+ },
6578
+ className: "chat-ai-lang-option" + (isActive ? " is-active" : ""),
6579
+ style: {
6580
+ width: "100%",
6581
+ display: "flex",
6582
+ alignItems: "center",
6583
+ gap: 8,
6584
+ padding: "8px 10px",
6585
+ border: "none",
6586
+ background: isActive ? "var(--primary-lighter)" : void 0,
6587
+ cursor: "pointer",
6588
+ fontFamily: "inherit",
6589
+ fontSize: 13,
6590
+ textAlign: "left",
6591
+ color: "var(--text-primary)",
6592
+ fontWeight: 400
6593
+ }
6594
+ }, fc && /* @__PURE__ */React__namespace.createElement(CountryFlag, {
6595
+ flagCode: fc,
6596
+ style: {
6597
+ width: 18,
6598
+ height: 14,
6599
+ flexShrink: 0
6600
+ }
6601
+ }), /* @__PURE__ */React__namespace.createElement("span", null, opt.label));
6602
+ })));
6603
+ }
6604
+ }]);
6605
+ }(React__namespace.Component);
6606
+ var ChipGroup = function ChipGroup(_ref28) {
6607
+ var options = _ref28.options,
6608
+ selected = _ref28.selected,
6609
+ onSelect = _ref28.onSelect,
6610
+ iconMap = _ref28.iconMap,
6611
+ _ref28$columns = _ref28.columns,
6612
+ columns = _ref28$columns === void 0 ? 3 : _ref28$columns;
6613
+ return /* @__PURE__ */React__namespace.createElement("div", {
6614
+ style: {
6615
+ display: "grid",
6616
+ gridTemplateColumns: "repeat(".concat(columns, ", minmax(0, 1fr))"),
6617
+ gap: 6
6618
+ }
6619
+ }, options.map(function (opt) {
6620
+ var isActive = (selected == null ? void 0 : selected.value) === opt.value;
6621
+ return /* @__PURE__ */React__namespace.createElement("button", {
6622
+ key: opt.value,
6623
+ type: "button",
6624
+ onClick: function onClick() {
6625
+ return onSelect(opt);
6626
+ },
6627
+ style: {
6628
+ display: "flex",
6629
+ alignItems: "center",
6630
+ justifyContent: "center",
6631
+ gap: 6,
6632
+ padding: "8px 10px",
6633
+ borderRadius: 4,
6634
+ border: isActive ? "1px solid var(--primary-main)" : "1px solid var(--border-main)",
6635
+ background: isActive ? "var(--primary-lighter)" : "#fff",
6636
+ color: isActive ? "var(--primary-main)" : "var(--text-primary)",
6637
+ fontWeight: isActive ? 600 : 400,
6638
+ fontSize: 13,
6639
+ cursor: "pointer",
6640
+ fontFamily: "inherit",
6641
+ transition: "background 0.15s, border-color 0.15s",
6642
+ minWidth: 0
6643
+ }
6644
+ }, /* @__PURE__ */React__namespace.createElement("span", {
6645
+ style: {
6646
+ display: "inline-flex",
6647
+ alignItems: "center",
6648
+ flexShrink: 0
6649
+ }
6650
+ }, iconMap[opt.value]), /* @__PURE__ */React__namespace.createElement("span", {
6651
+ style: {
6652
+ whiteSpace: "nowrap"
6653
+ }
6654
+ }, opt.label));
6655
+ }));
6656
+ };
6657
+ var ICON_SIZE = 14;
6658
+ var TONE_ICONS = {
6659
+ formal: /* @__PURE__ */React__namespace.createElement(Award, {
6660
+ size: ICON_SIZE
6661
+ }),
6662
+ polite: /* @__PURE__ */React__namespace.createElement(Heart, {
6663
+ size: ICON_SIZE
6664
+ }),
6665
+ neutral: /* @__PURE__ */React__namespace.createElement(Compass, {
6666
+ size: ICON_SIZE
6667
+ }),
6668
+ friendly: /* @__PURE__ */React__namespace.createElement(Smile, {
6669
+ size: ICON_SIZE
6670
+ }),
6671
+ firm: /* @__PURE__ */React__namespace.createElement(ThumbsUp, {
6672
+ size: ICON_SIZE
6673
+ }),
6674
+ apologetic: /* @__PURE__ */React__namespace.createElement(Frown, {
6675
+ size: ICON_SIZE
6676
+ })
6396
6677
  };
6397
- var ChatAIDraft = /*#__PURE__*/function (_React__namespace$Com3) {
6678
+ var LENGTH_ICONS = {
6679
+ short: /* @__PURE__ */React__namespace.createElement(Scissors, {
6680
+ size: ICON_SIZE
6681
+ }),
6682
+ medium: /* @__PURE__ */React__namespace.createElement(AlignJustify, {
6683
+ size: ICON_SIZE
6684
+ }),
6685
+ long: /* @__PURE__ */React__namespace.createElement(FileText, {
6686
+ size: ICON_SIZE
6687
+ }),
6688
+ one_liner: /* @__PURE__ */React__namespace.createElement(Zap, {
6689
+ size: ICON_SIZE
6690
+ })
6691
+ };
6692
+ var SettingPopper = /*#__PURE__*/function (_React__namespace$Com3) {
6693
+ function SettingPopper(props) {
6694
+ var _this10;
6695
+ _classCallCheck(this, SettingPopper);
6696
+ _this10 = _callSuper(this, SettingPopper, [props]);
6697
+ __publicField(_this10, "containerRef");
6698
+ __publicField(_this10, "popperRef");
6699
+ __publicField(_this10, "getLanguageOptions", function () {
6700
+ return __async(_this10, null, /*#__PURE__*/_regenerator().m(function _callee4() {
6701
+ var _a2, _yield$apiGet, data, langs;
6702
+ return _regenerator().w(function (_context4) {
6703
+ while (1) switch (_context4.n) {
6704
+ case 0:
6705
+ _context4.n = 1;
6706
+ return apiGet("/email/ai/langlist");
6707
+ case 1:
6708
+ _yield$apiGet = _context4.v;
6709
+ data = _yield$apiGet.data;
6710
+ if (data == null ? void 0 : data.list) {
6711
+ langs = (_a2 = Object.keys(data == null ? void 0 : data.list)) == null ? void 0 : _a2.map(function (_key) {
6712
+ var _a3;
6713
+ var _item = (_a3 = data == null ? void 0 : data.list) == null ? void 0 : _a3[_key];
6714
+ return {
6715
+ value: _key,
6716
+ label: _item == null ? void 0 : _item.name
6717
+ };
6718
+ });
6719
+ this.setState({
6720
+ languageOptions: langs
6721
+ });
6722
+ }
6723
+ case 2:
6724
+ return _context4.a(2);
6725
+ }
6726
+ }, _callee4, this);
6727
+ }));
6728
+ });
6729
+ __publicField(_this10, "handleClickOutside", function (event) {
6730
+ var target = event.target;
6731
+ if (_this10.containerRef.current && !_this10.containerRef.current.contains(target) && (!_this10.popperRef.current || !_this10.popperRef.current.contains(target))) {
6732
+ _this10.setState({
6733
+ open: false
6734
+ });
6735
+ }
6736
+ });
6737
+ __publicField(_this10, "togglePopper", function () {
6738
+ _this10.setState(function (prevState) {
6739
+ return {
6740
+ open: !prevState.open
6741
+ };
6742
+ });
6743
+ });
6744
+ _this10.state = {
6745
+ open: false,
6746
+ languageOptions: []
6747
+ };
6748
+ _this10.containerRef = React__namespace.createRef();
6749
+ _this10.popperRef = React__namespace.createRef();
6750
+ return _this10;
6751
+ }
6752
+ _inherits(SettingPopper, _React__namespace$Com3);
6753
+ return _createClass(SettingPopper, [{
6754
+ key: "componentDidMount",
6755
+ value: function componentDidMount() {
6756
+ document.addEventListener("mousedown", this.handleClickOutside);
6757
+ this.getLanguageOptions();
6758
+ }
6759
+ }, {
6760
+ key: "componentWillUnmount",
6761
+ value: function componentWillUnmount() {
6762
+ document.removeEventListener("mousedown", this.handleClickOutside);
6763
+ }
6764
+ }, {
6765
+ key: "render",
6766
+ value: function render() {
6767
+ var _this$props4 = this.props,
6768
+ lang = _this$props4.lang,
6769
+ tone = _this$props4.tone,
6770
+ length = _this$props4.length,
6771
+ parentRef = _this$props4.parentRef,
6772
+ setLang = _this$props4.setLang,
6773
+ setTone = _this$props4.setTone,
6774
+ setLength = _this$props4.setLength;
6775
+ var _this$state2 = this.state,
6776
+ open = _this$state2.open,
6777
+ languageOptions = _this$state2.languageOptions;
6778
+ var popperTop = 0;
6779
+ var popperLeft = 0;
6780
+ var popperWidth = 320;
6781
+ if (open && this.containerRef.current) {
6782
+ var rect = this.containerRef.current.getBoundingClientRect();
6783
+ popperTop = rect.top + (window.scrollY || document.documentElement.scrollTop) - 8;
6784
+ popperLeft = rect.left + (window.scrollX || document.documentElement.scrollLeft);
6785
+ if (parentRef && parentRef.current) {
6786
+ var parentRect = parentRef.current.getBoundingClientRect();
6787
+ popperWidth = parentRect.width - 16;
6788
+ popperLeft = parentRect.left + 8;
6789
+ }
6790
+ }
6791
+ return /* @__PURE__ */React__namespace.createElement("div", {
6792
+ ref: this.containerRef,
6793
+ style: {
6794
+ position: "relative",
6795
+ display: "inline-block"
6796
+ }
6797
+ }, /* @__PURE__ */React__namespace.createElement("button", {
6798
+ type: "button",
6799
+ onClick: this.togglePopper,
6800
+ className: "icon-button small"
6801
+ }, /* @__PURE__ */React__namespace.createElement(Settings, {
6802
+ size: 16
6803
+ })), open && this.containerRef.current && ReactDOM__namespace.createPortal(/* @__PURE__ */React__namespace.createElement("div", {
6804
+ ref: this.popperRef,
6805
+ style: {
6806
+ position: "absolute",
6807
+ top: popperTop,
6808
+ left: popperLeft,
6809
+ transform: "translateY(-100%)",
6810
+ zIndex: 1051,
6811
+ background: "#fff",
6812
+ border: "1px solid #ddd",
6813
+ boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
6814
+ borderRadius: 8,
6815
+ padding: 16,
6816
+ width: popperWidth,
6817
+ boxSizing: "border-box"
6818
+ }
6819
+ }, /* @__PURE__ */React__namespace.createElement("div", {
6820
+ style: {
6821
+ display: "flex",
6822
+ flexDirection: "column",
6823
+ gap: 12
6824
+ }
6825
+ }, /* @__PURE__ */React__namespace.createElement("div", {
6826
+ style: {
6827
+ display: "flex",
6828
+ flexDirection: "column",
6829
+ gap: 6
6830
+ }
6831
+ }, /* @__PURE__ */React__namespace.createElement("span", {
6832
+ style: {
6833
+ fontSize: 12,
6834
+ fontWeight: 600
6835
+ }
6836
+ }, "Language"), /* @__PURE__ */React__namespace.createElement(LanguageSelect, {
6837
+ value: lang,
6838
+ options: languageOptions,
6839
+ onChange: function onChange(opt) {
6840
+ return setLang(opt);
6841
+ }
6842
+ })), /* @__PURE__ */React__namespace.createElement("div", {
6843
+ style: {
6844
+ display: "flex",
6845
+ flexDirection: "column",
6846
+ gap: 6
6847
+ }
6848
+ }, /* @__PURE__ */React__namespace.createElement("span", {
6849
+ style: {
6850
+ fontSize: 12,
6851
+ fontWeight: 600
6852
+ }
6853
+ }, "Tone"), /* @__PURE__ */React__namespace.createElement(ChipGroup, {
6854
+ options: TONE_OPTIONS,
6855
+ selected: tone,
6856
+ onSelect: function onSelect(opt) {
6857
+ return setTone(opt);
6858
+ },
6859
+ iconMap: TONE_ICONS
6860
+ })), /* @__PURE__ */React__namespace.createElement("div", {
6861
+ style: {
6862
+ display: "flex",
6863
+ flexDirection: "column",
6864
+ gap: 6
6865
+ }
6866
+ }, /* @__PURE__ */React__namespace.createElement("span", {
6867
+ style: {
6868
+ fontSize: 12,
6869
+ fontWeight: 600
6870
+ }
6871
+ }, "Length"), /* @__PURE__ */React__namespace.createElement(ChipGroup, {
6872
+ options: LENGTH_OPTIONS,
6873
+ selected: length,
6874
+ onSelect: function onSelect(opt) {
6875
+ return setLength(opt);
6876
+ },
6877
+ iconMap: LENGTH_ICONS,
6878
+ columns: 4
6879
+ })))), document.body));
6880
+ }
6881
+ }]);
6882
+ }(React__namespace.Component);
6883
+ var ChatAIDraft = /*#__PURE__*/function (_React__namespace$Com4) {
6398
6884
  function ChatAIDraft(props) {
6399
- var _this12;
6885
+ var _this11;
6400
6886
  _classCallCheck(this, ChatAIDraft);
6401
- _this12 = _callSuper(this, ChatAIDraft, [props]);
6402
- __publicField(_this12, "rootRef");
6403
- __publicField(_this12, "setAIContext", function (html2) {
6404
- _this12.setState({
6405
- originalEmail: html2
6406
- });
6887
+ _this11 = _callSuper(this, ChatAIDraft, [props]);
6888
+ __publicField(_this11, "rootRef");
6889
+ __publicField(_this11, "textareaRef");
6890
+ __publicField(_this11, "adjustTextareaHeight", function () {
6891
+ var el = _this11.textareaRef.current;
6892
+ if (!el) return;
6893
+ el.style.height = "auto";
6894
+ el.style.height = "".concat(Math.min(el.scrollHeight, 160), "px");
6407
6895
  });
6408
- __publicField(_this12, "handleMessageChange", function (e) {
6409
- _this12.setState({
6896
+ __publicField(_this11, "handleMessageChange", function (e) {
6897
+ _this11.setState({
6410
6898
  message: e.target.value
6411
- });
6899
+ }, _this11.adjustTextareaHeight);
6412
6900
  });
6413
- __publicField(_this12, "handleSubmit", function () {
6414
- return __async(_this12, null, /*#__PURE__*/_regenerator().m(function _callee5() {
6415
- var _this13 = this;
6416
- var _this$state3, message, messages, lang, originalEmail, conversationId, newId, newMessage, currentItems, params, setContent, setIsLoading, setConversationId;
6901
+ __publicField(_this11, "handleSubmit", function () {
6902
+ return __async(_this11, null, /*#__PURE__*/_regenerator().m(function _callee5() {
6903
+ var _this12 = this;
6904
+ var _this$state3, message, messages, lang, tone, length, conversationId, newId, newMessage, currentItems, params, setContent, setIsLoading, setConversationId;
6417
6905
  return _regenerator().w(function (_context5) {
6418
6906
  while (1) switch (_context5.n) {
6419
6907
  case 0:
6420
- _this$state3 = this.state, message = _this$state3.message, messages = _this$state3.messages, lang = _this$state3.lang, originalEmail = _this$state3.originalEmail, conversationId = _this$state3.conversationId;
6908
+ _this$state3 = this.state, message = _this$state3.message, messages = _this$state3.messages, lang = _this$state3.lang, tone = _this$state3.tone, length = _this$state3.length, conversationId = _this$state3.conversationId;
6421
6909
  if (message.trim()) {
6422
6910
  _context5.n = 1;
6423
6911
  break;
@@ -6442,14 +6930,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6442
6930
  params = {
6443
6931
  query: message,
6444
6932
  default_language: lang ? lang.value : "KR",
6445
- original_email: originalEmail,
6446
6933
  debug_grpc: true
6447
6934
  };
6935
+ if (tone) {
6936
+ params.tone = tone.value;
6937
+ }
6938
+ if (length) {
6939
+ params.length = length.value;
6940
+ }
6448
6941
  if (conversationId) {
6449
6942
  params.conversation_id = conversationId;
6450
6943
  }
6451
6944
  setContent = function setContent(nContent) {
6452
- _this13.setState(function (prevState) {
6945
+ _this12.setState(function (prevState) {
6453
6946
  var updatedMessages = prevState.messages.map(function (m) {
6454
6947
  return m.id === newId ? __spreadProps(__spreadValues({}, m), {
6455
6948
  subject: "Some thing not used",
@@ -6464,7 +6957,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6464
6957
  });
6465
6958
  };
6466
6959
  setIsLoading = function setIsLoading(loading) {
6467
- _this13.setState(function (prevState) {
6960
+ _this12.setState(function (prevState) {
6468
6961
  var updatedMessages = prevState.messages.map(function (m) {
6469
6962
  return m.id === newId ? __spreadProps(__spreadValues({}, m), {
6470
6963
  isLoading: loading
@@ -6476,7 +6969,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6476
6969
  });
6477
6970
  };
6478
6971
  setConversationId = function setConversationId(id) {
6479
- _this13.setState({
6972
+ _this12.setState({
6480
6973
  conversationId: id
6481
6974
  });
6482
6975
  };
@@ -6496,40 +6989,57 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6496
6989
  }, _callee5, this);
6497
6990
  }));
6498
6991
  });
6499
- __publicField(_this12, "handleKeyDown", function (event) {
6500
- if (!event.shiftKey && event.key === "Enter" && !_this12.state.isSending) {
6992
+ __publicField(_this11, "handleKeyDown", function (event) {
6993
+ if (!event.shiftKey && event.key === "Enter" && !_this11.state.isSending) {
6501
6994
  event.preventDefault();
6502
- _this12.handleSubmit();
6995
+ _this11.handleSubmit();
6503
6996
  }
6504
6997
  });
6505
- __publicField(_this12, "setLang", function (lang) {
6506
- _this12.setState({
6998
+ __publicField(_this11, "setLang", function (lang) {
6999
+ _this11.setState({
6507
7000
  lang: lang
6508
7001
  });
6509
7002
  });
6510
- __publicField(_this12, "setOriginalEmail", function (email) {
6511
- _this12.setState({
6512
- originalEmail: email
7003
+ __publicField(_this11, "setTone", function (tone) {
7004
+ _this11.setState({
7005
+ tone: tone
6513
7006
  });
6514
7007
  });
6515
- _this12.rootRef = React__namespace.createRef();
7008
+ __publicField(_this11, "setLength", function (length) {
7009
+ _this11.setState({
7010
+ length: length
7011
+ });
7012
+ });
7013
+ _this11.rootRef = React__namespace.createRef();
7014
+ _this11.textareaRef = React__namespace.createRef();
6516
7015
  var lang = (AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(function (_item) {
6517
7016
  return (_item == null ? void 0 : _item.value) === (props == null ? void 0 : props.defaultLang);
6518
7017
  })) || AI_LANG_FLAGS[0];
6519
- _this12.state = {
7018
+ _this11.state = {
6520
7019
  message: "",
6521
7020
  messages: [],
6522
7021
  isSending: false,
6523
7022
  lang: lang,
6524
- conversationId: "",
6525
- originalEmail: ""
7023
+ tone: TONE_OPTIONS[2],
7024
+ // Neutral
7025
+ length: LENGTH_OPTIONS[1],
7026
+ // Medium
7027
+ conversationId: ""
6526
7028
  };
6527
- return _this12;
7029
+ return _this11;
6528
7030
  }
6529
- _inherits(ChatAIDraft, _React__namespace$Com3);
7031
+ _inherits(ChatAIDraft, _React__namespace$Com4);
6530
7032
  return _createClass(ChatAIDraft, [{
7033
+ key: "componentDidUpdate",
7034
+ value: function componentDidUpdate(_, prevState) {
7035
+ if (prevState.message !== this.state.message) {
7036
+ this.adjustTextareaHeight();
7037
+ }
7038
+ }
7039
+ }, {
6531
7040
  key: "render",
6532
7041
  value: function render() {
7042
+ var _this13 = this;
6533
7043
  var _a2;
6534
7044
  var _this$props5 = this.props,
6535
7045
  onApply = _this$props5.onApply,
@@ -6539,7 +7049,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6539
7049
  messages = _this$state4.messages,
6540
7050
  isSending = _this$state4.isSending,
6541
7051
  lang = _this$state4.lang,
6542
- originalEmail = _this$state4.originalEmail;
7052
+ tone = _this$state4.tone,
7053
+ length = _this$state4.length;
6543
7054
  var flagCode = (_a2 = AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(function (_item) {
6544
7055
  return (_item == null ? void 0 : _item.value) === (lang == null ? void 0 : lang.value);
6545
7056
  })) == null ? void 0 : _a2.flagCode;
@@ -6558,53 +7069,42 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6558
7069
  items: messages,
6559
7070
  onApply: onApply,
6560
7071
  getEditorContent: getEditorContent
6561
- }) : /* @__PURE__ */React__namespace.createElement("div", {
6562
- style: {
6563
- flex: 1,
6564
- minHeight: 0,
6565
- display: "flex",
6566
- flexDirection: "column",
6567
- alignItems: "center",
6568
- justifyContent: "center",
6569
- color: "var(--grey-light)"
6570
- }
6571
- }, /* @__PURE__ */React__namespace.createElement(CustomAiIcon, {
6572
- size: 46
6573
- }), /* @__PURE__ */React__namespace.createElement("h2", {
6574
- style: {
6575
- marginTop: 16,
6576
- fontWeight: 600,
6577
- color: "inherit",
6578
- fontSize: 18
7072
+ }) : /* @__PURE__ */React__namespace.createElement(EmptyState, {
7073
+ onSelectPrompt: function onSelectPrompt(text) {
7074
+ return _this13.setState({
7075
+ message: text
7076
+ });
6579
7077
  }
6580
- }, "Build with Agent")), /* @__PURE__ */React__namespace.createElement("div", {
7078
+ }), /* @__PURE__ */React__namespace.createElement("div", {
6581
7079
  style: {
6582
7080
  width: "100%",
6583
- border: "1px solid var(--border-main)",
6584
- borderRadius: 4,
7081
+ borderRadius: 12,
6585
7082
  overflow: "hidden",
6586
- background: "#fff",
7083
+ background: "var(--background-softGrey)",
6587
7084
  display: "flex",
6588
- flexDirection: "column"
7085
+ flexDirection: "column",
7086
+ border: "1px solid var(--border-light)"
6589
7087
  }
6590
7088
  }, /* @__PURE__ */React__namespace.createElement("textarea", {
7089
+ ref: this.textareaRef,
6591
7090
  value: message,
6592
7091
  onChange: this.handleMessageChange,
6593
- placeholder: "Describe your email",
7092
+ placeholder: "Describe your email...",
6594
7093
  name: "ai-content",
6595
7094
  onKeyDown: this.handleKeyDown,
6596
7095
  disabled: isSending,
7096
+ rows: 1,
6597
7097
  style: {
6598
7098
  flex: 1,
6599
7099
  minWidth: 0,
6600
- borderRadius: 4,
6601
7100
  padding: 12,
6602
7101
  fontSize: 13,
6603
7102
  border: "none",
6604
7103
  resize: "none",
6605
7104
  outline: "none",
6606
- minHeight: 60,
6607
- fontFamily: "inherit"
7105
+ fontFamily: "inherit",
7106
+ background: "transparent",
7107
+ overflowY: "auto"
6608
7108
  }
6609
7109
  }), /* @__PURE__ */React__namespace.createElement("div", {
6610
7110
  style: {
@@ -6618,9 +7118,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6618
7118
  }, /* @__PURE__ */React__namespace.createElement(SettingPopper, {
6619
7119
  lang: lang,
6620
7120
  setLang: this.setLang,
6621
- originalEmail: originalEmail,
6622
- setOriginalEmail: this.setOriginalEmail,
6623
- getEditorContent: getEditorContent,
7121
+ tone: tone,
7122
+ setTone: this.setTone,
7123
+ length: length,
7124
+ setLength: this.setLength,
6624
7125
  parentRef: this.rootRef
6625
7126
  }), /* @__PURE__ */React__namespace.createElement(CountryFlag, {
6626
7127
  flagCode: flagCode,
@@ -6628,18 +7129,115 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6628
7129
  marginLeft: 4,
6629
7130
  height: 14
6630
7131
  }
6631
- }), /* @__PURE__ */React__namespace.createElement("button", {
7132
+ }), (tone || length) && /* @__PURE__ */React__namespace.createElement("span", {
7133
+ style: {
7134
+ marginLeft: 8,
7135
+ padding: "2px 8px",
7136
+ borderRadius: 999,
7137
+ background: "var(--primary-lighter)",
7138
+ color: "var(--primary-main)",
7139
+ fontSize: 11,
7140
+ fontWeight: 500,
7141
+ whiteSpace: "nowrap",
7142
+ display: "inline-flex",
7143
+ alignItems: "center",
7144
+ gap: 4
7145
+ }
7146
+ }, (tone == null ? void 0 : tone.label) && /* @__PURE__ */React__namespace.createElement("span", null, tone.label), (tone == null ? void 0 : tone.label) && (length == null ? void 0 : length.label) && /* @__PURE__ */React__namespace.createElement("span", {
7147
+ style: {
7148
+ width: 3,
7149
+ height: 3,
7150
+ borderRadius: "50%",
7151
+ background: "currentColor",
7152
+ display: "inline-block"
7153
+ }
7154
+ }), (length == null ? void 0 : length.label) && /* @__PURE__ */React__namespace.createElement("span", null, length.label)), /* @__PURE__ */React__namespace.createElement("button", {
7155
+ type: "button",
6632
7156
  disabled: !message.trim() || isSending,
6633
7157
  onClick: this.handleSubmit,
6634
- className: "icon-button",
6635
- color: "primary",
6636
7158
  style: {
6637
- marginLeft: "auto"
7159
+ marginLeft: "auto",
7160
+ width: 28,
7161
+ height: 28,
7162
+ borderRadius: "50%",
7163
+ border: "none",
7164
+ display: "flex",
7165
+ alignItems: "center",
7166
+ justifyContent: "center",
7167
+ background: !message.trim() || isSending ? "var(--primary-lighter)" : "var(--primary-main)",
7168
+ color: "var(--primary-contrasttext)",
7169
+ cursor: !message.trim() || isSending ? "not-allowed" : "pointer",
7170
+ transition: "background 0.15s ease-in-out"
6638
7171
  }
6639
- }, /* @__PURE__ */React__namespace.createElement(Send, null)))));
7172
+ }, /* @__PURE__ */React__namespace.createElement(ArrowUp, {
7173
+ size: 18
7174
+ })))));
6640
7175
  }
6641
7176
  }]);
6642
7177
  }(React__namespace.Component);
7178
+ var LoadingCircular = function LoadingCircular(_ref29) {
7179
+ var _ref29$size = _ref29.size,
7180
+ size = _ref29$size === void 0 ? 40 : _ref29$size,
7181
+ _ref29$color = _ref29.color,
7182
+ color = _ref29$color === void 0 ? "var(--primary-main)" : _ref29$color,
7183
+ _ref29$thickness = _ref29.thickness,
7184
+ thickness = _ref29$thickness === void 0 ? 3.6 : _ref29$thickness;
7185
+ var radius = 20;
7186
+ var circumference = 2 * Math.PI * radius;
7187
+ return /* @__PURE__ */React.createElement("div", {
7188
+ className: "circular-container",
7189
+ style: {
7190
+ width: size,
7191
+ height: size
7192
+ },
7193
+ role: "progressbar"
7194
+ }, /* @__PURE__ */React.createElement("svg", {
7195
+ className: "circular-svg",
7196
+ viewBox: "22 22 44 44"
7197
+ }, /* @__PURE__ */React.createElement("circle", {
7198
+ className: "circular-circle",
7199
+ cx: "44",
7200
+ cy: "44",
7201
+ r: radius,
7202
+ fill: "none",
7203
+ stroke: color,
7204
+ strokeWidth: thickness,
7205
+ strokeDasharray: circumference,
7206
+ style: {
7207
+ strokeDashoffset: circumference * 0.7
7208
+ // Độ dài của thanh loading
7209
+ }
7210
+ })));
7211
+ };
7212
+ var circularSize = {
7213
+ small: 28,
7214
+ medium: 40
7215
+ };
7216
+ var LoadingContainer = function LoadingContainer(_ref30) {
7217
+ var style = _ref30.style,
7218
+ _ref30$fullHeight = _ref30.fullHeight,
7219
+ fullHeight = _ref30$fullHeight === void 0 ? false : _ref30$fullHeight,
7220
+ _ref30$size = _ref30.size,
7221
+ size = _ref30$size === void 0 ? "medium" : _ref30$size,
7222
+ label = _ref30.label;
7223
+ return /* @__PURE__ */React.createElement("div", {
7224
+ style: __spreadValues({
7225
+ display: "flex",
7226
+ alignItems: "center",
7227
+ justifyContent: "center",
7228
+ width: "100%",
7229
+ height: fullHeight ? "100%" : 350
7230
+ }, style)
7231
+ }, /* @__PURE__ */React.createElement(LoadingCircular, {
7232
+ size: circularSize[size]
7233
+ }), label && /* @__PURE__ */React.createElement("p", {
7234
+ color: "text.secondary",
7235
+ style: {
7236
+ marginTop: 16,
7237
+ fontSize: size === "small" ? 12 : 13
7238
+ }
7239
+ }, label));
7240
+ };
6643
7241
  exports2.AI_LANG_FLAGS = AI_LANG_FLAGS;
6644
7242
  exports2.ChatAIDraft = ChatAIDraft;
6645
7243
  exports2.CountryFlag = CountryFlag;