webforai
Version:
A library that provides a web interface for AI
46 lines (45 loc) • 1.66 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var custom_a_handler_exports = {};
__export(custom_a_handler_exports, {
customAHandler: () => customAHandler
});
module.exports = __toCommonJS(custom_a_handler_exports);
var import_hast_util_to_mdast = require("hast-util-to-mdast");
var import_hast_util_to_string = require("hast-util-to-string");
const customAHandler = (options) => (state, node) => {
if (options?.asText) {
const text = (0, import_hast_util_to_string.toString)(node);
if (3 >= text.length) {
return void 0;
}
const link2 = { type: "text", value: text };
state.patch(node, link2);
return link2;
}
const link = import_hast_util_to_mdast.defaultHandlers.a(state, node);
if (link.children.length > 0) {
return link;
}
return void 0;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
customAHandler
});