@asgardeo/browser 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1940,6 +1940,7 @@ __export(index_exports, {
1940
1940
  hasCalledForThisInstanceInUrl: () => hasCalledForThisInstanceInUrl_default,
1941
1941
  http: () => http_default,
1942
1942
  navigate: () => navigate_default,
1943
+ resolveEmojiUrisInHtml: () => resolveEmojiUrisInHtml_default,
1943
1944
  workerReceiver: () => workerReceiver
1944
1945
  });
1945
1946
  module.exports = __toCommonJS(index_exports);
@@ -5867,6 +5868,28 @@ var http = (instanceId = 0) => {
5867
5868
  };
5868
5869
  };
5869
5870
  var http_default = http();
5871
+
5872
+ // src/utils/v2/resolveEmojiUrisInHtml.ts
5873
+ var import_javascript15 = require("@asgardeo/javascript");
5874
+ var resolveEmojiUrisInHtml = (html) => {
5875
+ const withEmojiImages = html.replace(
5876
+ /<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi,
5877
+ (_match, pre, src, post) => {
5878
+ const emoji = (0, import_javascript15.extractEmojiFromUri)(src);
5879
+ if (!emoji) {
5880
+ return _match;
5881
+ }
5882
+ const altMatch = (pre + post).match(/alt="([^"]*)"/i);
5883
+ const label = altMatch ? altMatch[1] : emoji;
5884
+ return `<span role="img" aria-label="${label}">${emoji}</span>`;
5885
+ }
5886
+ );
5887
+ return withEmojiImages.replace(
5888
+ /emoji:([^\s"<>&]+)/g,
5889
+ (_, rest) => (0, import_javascript15.isEmojiUri)(`emoji:${rest}`) ? rest : `emoji:${rest}`
5890
+ );
5891
+ };
5892
+ var resolveEmojiUrisInHtml_default = resolveEmojiUrisInHtml;
5870
5893
  /*! Bundled license information:
5871
5894
 
5872
5895
  ieee754/index.js: