acsi-core 1.2.17 → 1.2.19

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.
@@ -15,6 +15,7 @@ import rehypeKatex from 'rehype-katex';
15
15
  import remarkRehype from 'remark-rehype';
16
16
  import rehypeRaw from 'rehype-raw';
17
17
  import 'katex/dist/katex.min.css';
18
+ import renderMathInElement from 'katex/contrib/auto-render';
18
19
  import Cookies from 'js-cookie';
19
20
  export { default as Cookies } from 'js-cookie';
20
21
  import moment from 'moment';
@@ -1596,6 +1597,39 @@ function formatContent(content) {
1596
1597
  return result.join("\n");
1597
1598
  }
1598
1599
 
1600
+ var RichContentRenderer = function RichContentRenderer(_ref) {
1601
+ var content = _ref.content;
1602
+ var ref = useRef(null);
1603
+ var isHtml = /<\/?[a-z][\s\S]*>/i.test(content);
1604
+ useEffect(function () {
1605
+ if (isHtml && ref.current) {
1606
+ renderMathInElement(ref.current, {
1607
+ delimiters: [{
1608
+ left: "$$",
1609
+ right: "$$",
1610
+ display: false
1611
+ }, {
1612
+ left: "$",
1613
+ right: "$",
1614
+ display: false
1615
+ }]
1616
+ });
1617
+ }
1618
+ }, [content, isHtml]);
1619
+ if (isHtml) {
1620
+ return React.createElement("div", {
1621
+ ref: ref,
1622
+ dangerouslySetInnerHTML: {
1623
+ __html: content
1624
+ }
1625
+ });
1626
+ }
1627
+ return React.createElement(ReactMarkdown, {
1628
+ remarkPlugins: [remarkMath, remarkGfm],
1629
+ rehypePlugins: [rehypeKatex, rehypeRaw]
1630
+ }, content);
1631
+ };
1632
+
1599
1633
  var CookieService = /*#__PURE__*/function () {
1600
1634
  function CookieService() {}
1601
1635
  CookieService.setAuthCookie = function setAuthCookie(data) {
@@ -3466,43 +3500,25 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
3466
3500
  }, rest));
3467
3501
  };
3468
3502
 
3469
- var isDateOnlyFormat = function isDateOnlyFormat(fmt) {
3470
- return !/[Hhms]/.test(fmt);
3471
- };
3472
- var parseOffsetToMinutes = function parseOffsetToMinutes(cleanOffset) {
3473
- if (/^[+-]?\d+$/.test(cleanOffset)) {
3474
- return parseInt(cleanOffset, 10) * 60;
3475
- }
3476
- return moment().utcOffset(cleanOffset).utcOffset();
3477
- };
3478
3503
  var utcToLocalTime = (function (time, FORMAT) {
3479
3504
  if (time === DATE_MIN_VALUE || time == null) return "";
3480
3505
  var timezone = localStorage.getItem(TIMEZONE_ID) || "";
3481
- var fmt = FORMAT || "yyyy-MM-DD";
3482
3506
  try {
3483
3507
  if (!timezone) {
3484
- if (isDateOnlyFormat(fmt)) {
3485
- var localOffset = moment().utcOffset();
3486
- if (localOffset <= 0) return moment.utc(time).format(fmt);
3487
- }
3488
- return moment.utc(time).local().format(fmt);
3508
+ return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3489
3509
  }
3490
3510
  var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3491
3511
  if (isOffset) {
3492
3512
  var cleanOffset = timezone.replace(/UTC|GMT/gi, "").trim();
3493
- var offsetMinutes = parseOffsetToMinutes(cleanOffset);
3494
- if (isDateOnlyFormat(fmt) && offsetMinutes <= 0) {
3495
- return moment.utc(time).format(fmt);
3496
- }
3497
- return moment.utc(time).utcOffset(offsetMinutes).format(fmt);
3498
- }
3499
- if (isDateOnlyFormat(fmt)) {
3500
- var tzOffset = moment.utc(time).tz(timezone).utcOffset();
3501
- if (tzOffset <= 0) {
3502
- return moment.utc(time).format(fmt);
3513
+ var offsetMinutes;
3514
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3515
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3516
+ } else {
3517
+ offsetMinutes = cleanOffset;
3503
3518
  }
3519
+ return moment.utc(time).utcOffset(offsetMinutes).format(FORMAT || "yyyy-MM-DD");
3504
3520
  }
3505
- return moment.utc(time).tz(timezone).format(fmt);
3521
+ return moment.utc(time).tz(timezone).format(FORMAT || "yyyy-MM-DD");
3506
3522
  } catch (_unused) {
3507
3523
  return "";
3508
3524
  }
@@ -3575,5 +3591,5 @@ var timeSpanToUtc = (function (time, timezone, format) {
3575
3591
 
3576
3592
  var historyCore = createBrowserHistory();
3577
3593
 
3578
- export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, Role, TIMEZONE_ID, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, getTimeZoneId, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsFirstCalendar, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, timeSpanToUtc, useAmplitude, useGoogleSignOut, utcToLocalTime };
3594
+ export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, RichContentRenderer, Role, TIMEZONE_ID, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, getTimeZoneId, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsFirstCalendar, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, timeSpanToUtc, useAmplitude, useGoogleSignOut, utcToLocalTime };
3579
3595
  //# sourceMappingURL=index.modern.js.map