Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
91 lines
4.3 KiB
TypeScript
91 lines
4.3 KiB
TypeScript
// Module ID: 10205
|
|
// Function ID: 10206
|
|
// Name: MessagePreviewMarkup
|
|
// Dependencies: [5048, 5049, 10206, 4303, 4596, 7953, 1437, 2]
|
|
// Exports: getMessagePreviewASTParser, renderASTToReact, renderMessagePreviewMarkup
|
|
|
|
// Module 10205 (MessagePreviewMarkup)
|
|
import privDefault from "priv" /* 1437 */;
|
|
import _modDef4303 from "module_4303" /* 4303 */;
|
|
import MarkupUtilsDefault from "MarkupUtils" /* 4596 */;
|
|
import combineMarkupRulesDefault from "combineMarkupRules" /* 5048 */;
|
|
import MarkupRulesDefault from "MarkupRules" /* 5049 */;
|
|
import ChannelListLayoutTypes from "ChannelListLayoutTypes" /* 7953 */;
|
|
import MarkupMessagePreviewReactRulesDefault from "MarkupMessagePreviewReactRules" /* 10206 */;
|
|
|
|
require = fn;
|
|
function getOrParseMessagePreviewMarkupAST(arg0) {
|
|
({ content, layout, color, initialParserState, postProcessor, fontScale, maxFontSizeMultiplier } = arg0);
|
|
value = closure_3.get(content);
|
|
if (null != value) {
|
|
return value;
|
|
} else {
|
|
const items = [MarkupRulesDefault.RULES, MarkupMessagePreviewReactRulesDefault(layout, color, fontScale, maxFontSizeMultiplier)];
|
|
const tmp11Result = combineMarkupRulesDefault(items);
|
|
let startsWithResult = content.startsWith("```");
|
|
let tmp3;
|
|
if (!startsWithResult) {
|
|
const first = content.split("\n")[0];
|
|
startsWithResult = first.includes("||");
|
|
tmp3 = first;
|
|
}
|
|
if (startsWithResult) {
|
|
tmp3 = content;
|
|
}
|
|
const astParserForResultResult = MarkupUtilsDefault.astParserFor(tmp11Result)(tmp3, true, initialParserState, postProcessor);
|
|
const result = obj.set(content, astParserForResultResult);
|
|
return astParserForResultResult;
|
|
}
|
|
obj = closure_3;
|
|
}
|
|
const tmp2 = new privDefault({ max: 2000 });
|
|
let closure_3 = tmp2;
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/message_previews/native/MessagePreviewMarkup.tsx");
|
|
|
|
export const renderASTToReact = function renderASTToReact(layout) {
|
|
({ tree, initialParserState, color, fontScale, maxFontSizeMultiplier } = layout);
|
|
const items = [MarkupRulesDefault.RULES, MarkupMessagePreviewReactRulesDefault(layout.layout, color, fontScale, maxFontSizeMultiplier)];
|
|
const tmpResult = combineMarkupRulesDefault(items);
|
|
const obj = _modDef4303;
|
|
return obj.reactFor(_modDef4303.ruleOutput(tmpResult, "react"))(tree, initialParserState);
|
|
};
|
|
export const getMessagePreviewASTParser = function getMessagePreviewASTParser(layout) {
|
|
({ color, fontScale, maxFontSizeMultiplier } = layout);
|
|
const items = [MarkupRulesDefault.RULES, MarkupMessagePreviewReactRulesDefault(layout.layout, color, fontScale, maxFontSizeMultiplier)];
|
|
const tmpResult = combineMarkupRulesDefault(items);
|
|
return MarkupUtilsDefault.astParserFor(tmpResult);
|
|
};
|
|
export const renderMessagePreviewMarkup = function renderMessagePreviewMarkup(fontScale) {
|
|
({ content, muted, layout } = fontScale);
|
|
({ guildId, channelId } = fontScale);
|
|
if (layout === undefined) {
|
|
layout = ChannelListLayoutTypes.ChannelListLayoutTypes.COMPACT;
|
|
}
|
|
({ color, disableAnimatedEmoji, postProcessor } = fontScale);
|
|
if (disableAnimatedEmoji === undefined) {
|
|
disableAnimatedEmoji = true;
|
|
}
|
|
let num = fontScale.fontScale;
|
|
if (num === undefined) {
|
|
num = 1;
|
|
}
|
|
const maxFontSizeMultiplier = fontScale.maxFontSizeMultiplier;
|
|
if ("" === content) {
|
|
return null;
|
|
} else {
|
|
const obj4 = { allowLinks: true, allowDevLinks: false, allowEmojiLinks: false, allowGameMentions: false, mentionChannels: [], soundboardSounds: [], formatInline: true, noStyleAndInteraction: true, allowHeading: true, allowList: true, disableAutoBlockNewlines: true, previewLinkTarget: false, disableAnimatedEmoji, unknownUserMentionPlaceholder: true, guildId, channelId, muted: null };
|
|
if (muted == null) {
|
|
muted = false;
|
|
}
|
|
obj4.muted = muted;
|
|
const obj = { content, layout, color, initialParserState: obj4, fontScale: num, maxFontSizeMultiplier, postProcessor };
|
|
const tmp4 = getOrParseMessagePreviewMarkupAST(obj);
|
|
const items = [MarkupRulesDefault.RULES, MarkupMessagePreviewReactRulesDefault(layout, color, num, maxFontSizeMultiplier)];
|
|
const tmp7Result = combineMarkupRulesDefault(items);
|
|
const obj2 = _modDef4303;
|
|
return obj2.reactFor(_modDef4303.ruleOutput(tmp7Result, "react"))(tmp4, obj4);
|
|
}
|
|
};
|
|
export const messagePreviewASTCache = tmp2;
|
|
export { getOrParseMessagePreviewMarkupAST };
|