UNPKG

@capitol.ai/ui-components

Version:

Library of React components from Capitol AI

1,232 lines (1,227 loc) 317 kB
import * as hr from "react"; import lr, { useState as ki, useRef as Ur, useEffect as Yr } from "react"; function Xr(P) { return P && P.__esModule && Object.prototype.hasOwnProperty.call(P, "default") ? P.default : P; } var ii = { exports: {} }, Os = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Gi; function Gr() { if (Gi) return Os; Gi = 1; var P = lr, E = Symbol.for("react.element"), S = Symbol.for("react.fragment"), H = Object.prototype.hasOwnProperty, X = P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, G = { key: !0, ref: !0, __self: !0, __source: !0 }; function $(z, K, mt) { var Q, pt = {}, _ = null, N = null; mt !== void 0 && (_ = "" + mt), K.key !== void 0 && (_ = "" + K.key), K.ref !== void 0 && (N = K.ref); for (Q in K) H.call(K, Q) && !G.hasOwnProperty(Q) && (pt[Q] = K[Q]); if (z && z.defaultProps) for (Q in K = z.defaultProps, K) pt[Q] === void 0 && (pt[Q] = K[Q]); return { $$typeof: E, type: z, key: _, ref: N, props: pt, _owner: X.current }; } return Os.Fragment = S, Os.jsx = $, Os.jsxs = $, Os; } var zs = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Ji; function Jr() { return Ji || (Ji = 1, process.env.NODE_ENV !== "production" && function() { var P = lr, E = Symbol.for("react.element"), S = Symbol.for("react.portal"), H = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), G = Symbol.for("react.profiler"), $ = Symbol.for("react.provider"), z = Symbol.for("react.context"), K = Symbol.for("react.forward_ref"), mt = Symbol.for("react.suspense"), Q = Symbol.for("react.suspense_list"), pt = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), N = Symbol.for("react.offscreen"), I = Symbol.iterator, lt = "@@iterator"; function J(v) { if (v === null || typeof v != "object") return null; var V = I && v[I] || v[lt]; return typeof V == "function" ? V : null; } var ft = P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function et(v) { { for (var V = arguments.length, W = new Array(V > 1 ? V - 1 : 0), st = 1; st < V; st++) W[st - 1] = arguments[st]; Tt("error", v, W); } } function Tt(v, V, W) { { var st = ft.ReactDebugCurrentFrame, vt = st.getStackAddendum(); vt !== "" && (V += "%s", W = W.concat([vt])); var Ct = W.map(function(gt) { return String(gt); }); Ct.unshift("Warning: " + V), Function.prototype.apply.call(console[v], console, Ct); } } var Ft = !1, dt = !1, yt = !1, St = !1, Ht = !1, Le; Le = Symbol.for("react.module.reference"); function ce(v) { return !!(typeof v == "string" || typeof v == "function" || v === H || v === G || Ht || v === X || v === mt || v === Q || St || v === N || Ft || dt || yt || typeof v == "object" && v !== null && (v.$$typeof === _ || v.$$typeof === pt || v.$$typeof === $ || v.$$typeof === z || v.$$typeof === K || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. v.$$typeof === Le || v.getModuleId !== void 0)); } function oe(v, V, W) { var st = v.displayName; if (st) return st; var vt = V.displayName || V.name || ""; return vt !== "" ? W + "(" + vt + ")" : W; } function he(v) { return v.displayName || "Context"; } function qt(v) { if (v == null) return null; if (typeof v.tag == "number" && et("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof v == "function") return v.displayName || v.name || null; if (typeof v == "string") return v; switch (v) { case H: return "Fragment"; case S: return "Portal"; case G: return "Profiler"; case X: return "StrictMode"; case mt: return "Suspense"; case Q: return "SuspenseList"; } if (typeof v == "object") switch (v.$$typeof) { case z: var V = v; return he(V) + ".Consumer"; case $: var W = v; return he(W._context) + ".Provider"; case K: return oe(v, v.render, "ForwardRef"); case pt: var st = v.displayName || null; return st !== null ? st : qt(v.type) || "Memo"; case _: { var vt = v, Ct = vt._payload, gt = vt._init; try { return qt(gt(Ct)); } catch { return null; } } } return null; } var Gt = Object.assign, wt = 0, ue, ee, Yt, le, Ce, we, Pe; function Ye() { } Ye.__reactDisabledLog = !0; function it() { { if (wt === 0) { ue = console.log, ee = console.info, Yt = console.warn, le = console.error, Ce = console.group, we = console.groupCollapsed, Pe = console.groupEnd; var v = { configurable: !0, enumerable: !0, value: Ye, writable: !0 }; Object.defineProperties(console, { info: v, log: v, warn: v, error: v, group: v, groupCollapsed: v, groupEnd: v }); } wt++; } } function _s() { { if (wt--, wt === 0) { var v = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: Gt({}, v, { value: ue }), info: Gt({}, v, { value: ee }), warn: Gt({}, v, { value: Yt }), error: Gt({}, v, { value: le }), group: Gt({}, v, { value: Ce }), groupCollapsed: Gt({}, v, { value: we }), groupEnd: Gt({}, v, { value: Pe }) }); } wt < 0 && et("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var Ae = ft.ReactCurrentDispatcher, Cs; function Xe(v, V, W) { { if (Cs === void 0) try { throw Error(); } catch (vt) { var st = vt.stack.trim().match(/\n( *(at )?)/); Cs = st && st[1] || ""; } return ` ` + Cs + v; } } var ws = !1, ps; { var Ge = typeof WeakMap == "function" ? WeakMap : Map; ps = new Ge(); } function Je(v, V) { if (!v || ws) return ""; { var W = ps.get(v); if (W !== void 0) return W; } var st; ws = !0; var vt = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var Ct; Ct = Ae.current, Ae.current = null, it(); try { if (V) { var gt = function() { throw Error(); }; if (Object.defineProperty(gt.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(gt, []); } catch (Lt) { st = Lt; } Reflect.construct(v, [], gt); } else { try { gt.call(); } catch (Lt) { st = Lt; } v.call(gt.prototype); } } else { try { throw Error(); } catch (Lt) { st = Lt; } v(); } } catch (Lt) { if (Lt && st && typeof Lt.stack == "string") { for (var ht = Lt.stack.split(` `), Wt = st.stack.split(` `), Pt = ht.length - 1, ct = Wt.length - 1; Pt >= 1 && ct >= 0 && ht[Pt] !== Wt[ct]; ) ct--; for (; Pt >= 1 && ct >= 0; Pt--, ct--) if (ht[Pt] !== Wt[ct]) { if (Pt !== 1 || ct !== 1) do if (Pt--, ct--, ct < 0 || ht[Pt] !== Wt[ct]) { var Jt = ` ` + ht[Pt].replace(" at new ", " at "); return v.displayName && Jt.includes("<anonymous>") && (Jt = Jt.replace("<anonymous>", v.displayName)), typeof v == "function" && ps.set(v, Jt), Jt; } while (Pt >= 1 && ct >= 0); break; } } } finally { ws = !1, Ae.current = Ct, _s(), Error.prepareStackTrace = vt; } var me = v ? v.displayName || v.name : "", ke = me ? Xe(me) : ""; return typeof v == "function" && ps.set(v, ke), ke; } function tt(v, V, W) { return Je(v, !1); } function It(v) { var V = v.prototype; return !!(V && V.isReactComponent); } function ve(v, V, W) { if (v == null) return ""; if (typeof v == "function") return Je(v, It(v)); if (typeof v == "string") return Xe(v); switch (v) { case mt: return Xe("Suspense"); case Q: return Xe("SuspenseList"); } if (typeof v == "object") switch (v.$$typeof) { case K: return tt(v.render); case pt: return ve(v.type, V, W); case _: { var st = v, vt = st._payload, Ct = st._init; try { return ve(Ct(vt), V, W); } catch { } } } return ""; } var Re = Object.prototype.hasOwnProperty, Ke = {}, Ps = ft.ReactDebugCurrentFrame; function Qe(v) { if (v) { var V = v._owner, W = ve(v.type, v._source, V ? V.type : null); Ps.setExtraStackFrame(W); } else Ps.setExtraStackFrame(null); } function pe(v, V, W, st, vt) { { var Ct = Function.call.bind(Re); for (var gt in v) if (Ct(v, gt)) { var ht = void 0; try { if (typeof v[gt] != "function") { var Wt = Error((st || "React class") + ": " + W + " type `" + gt + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof v[gt] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw Wt.name = "Invariant Violation", Wt; } ht = v[gt](V, gt, st, W, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (Pt) { ht = Pt; } ht && !(ht instanceof Error) && (Qe(vt), et("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", st || "React class", W, gt, typeof ht), Qe(null)), ht instanceof Error && !(ht.message in Ke) && (Ke[ht.message] = !0, Qe(vt), et("Failed %s type: %s", W, ht.message), Qe(null)); } } } var Se = Array.isArray; function fs(v) { return Se(v); } function Ws(v) { { var V = typeof Symbol == "function" && Symbol.toStringTag, W = V && v[Symbol.toStringTag] || v.constructor.name || "Object"; return W; } } function Zs(v) { try { return As(v), !1; } catch { return !0; } } function As(v) { return "" + v; } function ts(v) { if (Zs(v)) return et("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ws(v)), As(v); } var es = ft.ReactCurrentOwner, cs = { key: !0, ref: !0, __self: !0, __source: !0 }, Us, Ys; function ni(v) { if (Re.call(v, "ref")) { var V = Object.getOwnPropertyDescriptor(v, "ref").get; if (V && V.isReactWarning) return !1; } return v.ref !== void 0; } function oi(v) { if (Re.call(v, "key")) { var V = Object.getOwnPropertyDescriptor(v, "key").get; if (V && V.isReactWarning) return !1; } return v.key !== void 0; } function Z(v, V) { typeof v.ref == "string" && es.current; } function Nt(v, V) { { var W = function() { Us || (Us = !0, et("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V)); }; W.isReactWarning = !0, Object.defineProperty(v, "key", { get: W, configurable: !0 }); } } function Ee(v, V) { { var W = function() { Ys || (Ys = !0, et("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V)); }; W.isReactWarning = !0, Object.defineProperty(v, "ref", { get: W, configurable: !0 }); } } var de = function(v, V, W, st, vt, Ct, gt) { var ht = { // This tag allows us to uniquely identify this as a React Element $$typeof: E, // Built-in properties that belong on the element type: v, key: V, ref: W, props: gt, // Record the component responsible for creating this element. _owner: Ct }; return ht._store = {}, Object.defineProperty(ht._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(ht, "_self", { configurable: !1, enumerable: !1, writable: !1, value: st }), Object.defineProperty(ht, "_source", { configurable: !1, enumerable: !1, writable: !1, value: vt }), Object.freeze && (Object.freeze(ht.props), Object.freeze(ht)), ht; }; function Ss(v, V, W, st, vt) { { var Ct, gt = {}, ht = null, Wt = null; W !== void 0 && (ts(W), ht = "" + W), oi(V) && (ts(V.key), ht = "" + V.key), ni(V) && (Wt = V.ref, Z(V, vt)); for (Ct in V) Re.call(V, Ct) && !cs.hasOwnProperty(Ct) && (gt[Ct] = V[Ct]); if (v && v.defaultProps) { var Pt = v.defaultProps; for (Ct in Pt) gt[Ct] === void 0 && (gt[Ct] = Pt[Ct]); } if (ht || Wt) { var ct = typeof v == "function" ? v.displayName || v.name || "Unknown" : v; ht && Nt(gt, ct), Wt && Ee(gt, ct); } return de(v, ht, Wt, vt, st, es.current, gt); } } var jt = ft.ReactCurrentOwner, us = ft.ReactDebugCurrentFrame; function De(v) { if (v) { var V = v._owner, W = ve(v.type, v._source, V ? V.type : null); us.setExtraStackFrame(W); } else us.setExtraStackFrame(null); } var be; be = !1; function ss(v) { return typeof v == "object" && v !== null && v.$$typeof === E; } function Ve() { { if (jt.current) { var v = qt(jt.current.type); if (v) return ` Check the render method of \`` + v + "`."; } return ""; } } function Ne(v) { return ""; } var is = {}; function $t(v) { { var V = Ve(); if (!V) { var W = typeof v == "string" ? v : v.displayName || v.name; W && (V = ` Check the top-level render call using <` + W + ">."); } return V; } } function ds(v, V) { { if (!v._store || v._store.validated || v.key != null) return; v._store.validated = !0; var W = $t(V); if (is[W]) return; is[W] = !0; var st = ""; v && v._owner && v._owner !== jt.current && (st = " It was passed a child from " + qt(v._owner.type) + "."), De(v), et('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', W, st), De(null); } } function kt(v, V) { { if (typeof v != "object") return; if (fs(v)) for (var W = 0; W < v.length; W++) { var st = v[W]; ss(st) && ds(st, V); } else if (ss(v)) v._store && (v._store.validated = !0); else if (v) { var vt = J(v); if (typeof vt == "function" && vt !== v.entries) for (var Ct = vt.call(v), gt; !(gt = Ct.next()).done; ) ss(gt.value) && ds(gt.value, V); } } } function Xs(v) { { var V = v.type; if (V == null || typeof V == "string") return; var W; if (typeof V == "function") W = V.propTypes; else if (typeof V == "object" && (V.$$typeof === K || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. V.$$typeof === pt)) W = V.propTypes; else return; if (W) { var st = qt(V); pe(W, v.props, "prop", st, v); } else if (V.PropTypes !== void 0 && !be) { be = !0; var vt = qt(V); et("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", vt || "Unknown"); } typeof V.getDefaultProps == "function" && !V.getDefaultProps.isReactClassApproved && et("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function Gs(v) { { for (var V = Object.keys(v.props), W = 0; W < V.length; W++) { var st = V[W]; if (st !== "children" && st !== "key") { De(v), et("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", st), De(null); break; } } v.ref !== null && (De(v), et("Invalid attribute `ref` supplied to `React.Fragment`."), De(null)); } } var Es = {}; function Ds(v, V, W, st, vt, Ct) { { var gt = ce(v); if (!gt) { var ht = ""; (v === void 0 || typeof v == "object" && v !== null && Object.keys(v).length === 0) && (ht += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var Wt = Ne(); Wt ? ht += Wt : ht += Ve(); var Pt; v === null ? Pt = "null" : fs(v) ? Pt = "array" : v !== void 0 && v.$$typeof === E ? (Pt = "<" + (qt(v.type) || "Unknown") + " />", ht = " Did you accidentally export a JSX literal instead of a component?") : Pt = typeof v, et("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Pt, ht); } var ct = Ss(v, V, W, vt, Ct); if (ct == null) return ct; if (gt) { var Jt = V.children; if (Jt !== void 0) if (st) if (fs(Jt)) { for (var me = 0; me < Jt.length; me++) kt(Jt[me], v); Object.freeze && Object.freeze(Jt); } else et("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else kt(Jt, v); } if (Re.call(V, "key")) { var ke = qt(v), Lt = Object.keys(V).filter(function(Oe) { return Oe !== "key"; }), rs = Lt.length > 0 ? "{key: someKey, " + Lt.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Es[ke + rs]) { var ms = Lt.length > 0 ? "{" + Lt.join(": ..., ") + ": ...}" : "{}"; et(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, rs, ke, ms, ke), Es[ke + rs] = !0; } } return v === H ? Gs(ct) : Xs(ct), ct; } } function hi(v, V, W) { return Ds(v, V, W, !0); } function xe(v, V, W) { return Ds(v, V, W, !1); } var se = xe, ae = hi; zs.Fragment = H, zs.jsx = se, zs.jsxs = ae; }()), zs; } var Ki; function Kr() { return Ki || (Ki = 1, process.env.NODE_ENV === "production" ? ii.exports = Gr() : ii.exports = Jr()), ii.exports; } var T = Kr(); const pr = () => /* @__PURE__ */ T.jsx( "svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ T.jsx( "path", { d: "M8.75036 10.0001H4.16702M4.09648 10.243L2.15071 16.0552C1.99785 16.5119 1.92142 16.7402 1.97627 16.8808C2.0239 17.0029 2.1262 17.0954 2.25244 17.1307C2.3978 17.1712 2.61736 17.0724 3.05647 16.8748L16.9827 10.608C17.4113 10.4151 17.6256 10.3187 17.6918 10.1847C17.7494 10.0684 17.7494 9.93179 17.6918 9.8154C17.6256 9.68143 17.4113 9.585 16.9827 9.39212L3.05161 3.12317C2.61383 2.92617 2.39493 2.82767 2.24971 2.86807C2.1236 2.90317 2.0213 2.99549 1.97351 3.11736C1.91847 3.25769 1.99408 3.4855 2.14531 3.94113L4.09702 9.82134C4.12299 9.8996 4.13598 9.93873 4.14111 9.97874C4.14565 10.0143 4.14561 10.0502 4.14097 10.0857C4.13574 10.1257 4.12265 10.1648 4.09648 10.243Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" } ) } ), Qr = ({ accentColor: P = "#1C76F3", onSubmitPrompt: E, disabled: S = !1 }) => /* @__PURE__ */ T.jsx( "button", { className: "submitButton", style: P ? { background: P } : {}, onClick: E, disabled: S, "aria-label": "Submit prompt", children: /* @__PURE__ */ T.jsx(pr, {}) } ), ta = ({ setPrompt: P, prompt: E }) => /* @__PURE__ */ T.jsx( "textarea", { suppressContentEditableWarning: !0, role: "textbox", id: "capitolai_summary-prompt", className: "border-2 rounded-lg p-4 mt-4 whitespace-pre-wrap", style: { minHeight: "200px" }, contentEditable: !0, onKeyUp: (S) => { let H = S.currentTarget.lastElementChild; H && H.tagName === "BR" && H.remove(); }, onInput: (S) => { const H = S.target.value; P(H); }, value: E } ), ea = ({ placeholderText: P, minHeight: E, setPrompt: S, onSubmitPrompt: H, isEditable: X = !0, onChange: G }) => /* @__PURE__ */ T.jsx( "div", { suppressContentEditableWarning: !0, role: "textbox", id: "capitolai_summary-prompt", placeholder: P, className: "contentEditable", style: E ? { minHeight: `${E}px` } : {}, contentEditable: X, onKeyUp: ($) => { let z = $.currentTarget.lastElementChild; z && z.tagName === "BR" && z.remove(); }, onKeyDown: ($) => { $.key === "Enter" && ($.preventDefault(), H()); }, onInput: ($) => { const z = $.currentTarget.textContent || ""; S(z), G && G(z); }, "aria-placeholder": P } ), fr = ({ placeholderText: P = "Enter prompt", minHeight: E, accentColor: S, onSubmit: H = () => { }, onChange: X = () => { }, disabled: G = !1, enableFormatPrompt: $ = !1, defaultFormatPrompt: z = "" }) => { const [K, mt] = ki(""), [Q, pt] = ki(z), _ = () => { if ($ && Q && Q.length > 0 ? H(K, Q) : H(K), mt(""), typeof document < "u") { const N = document.getElementById("capitolai_summary-prompt"); N && (N.textContent = ""); } }; return /* @__PURE__ */ T.jsxs(T.Fragment, { children: [ /* @__PURE__ */ T.jsxs("div", { className: "promptContainer", children: [ /* @__PURE__ */ T.jsx("div", { className: "promptWrapper", children: /* @__PURE__ */ T.jsx( ea, { placeholderText: P, minHeight: E, setPrompt: mt, onSubmitPrompt: _, isEditable: !G, onChange: X } ) }), /* @__PURE__ */ T.jsx("div", { className: "buttonWrapper", children: /* @__PURE__ */ T.jsx( Qr, { onSubmitPrompt: _, accentColor: S, disabled: G } ) }) ] }), $ && /* @__PURE__ */ T.jsx(ta, { setPrompt: pt, prompt: Q }) ] }); }, Vn = ({ onSubmit: P }) => /* @__PURE__ */ T.jsxs("div", { className: "fancyPromptContainer", "data-testid": "fancy-prompt-container", children: [ /* @__PURE__ */ T.jsx( fr, { placeholderText: "Ask a question", minHeight: 100, accentColor: "#d02523", onSubmit: P } ), /* @__PURE__ */ T.jsx("div", { className: "fancyPromptFooter", "data-testid": "fancy-prompt-footer", children: "TODO" }) ] }), sa = ({ prompt: P, onClickHandler: E }) => /* @__PURE__ */ T.jsxs( "div", { className: "rounded-lg border-2 border-gray-200 py-2 px-4 flex items-center hover:bg-stone-100 cursor-pointer capitolai-summary__prompt-suggestion", onClick: () => { E(P); }, children: [ /* @__PURE__ */ T.jsx("div", { className: "flex-1 text-[13px] ", children: P }), /* @__PURE__ */ T.jsx("div", { className: "stroke-gray-500 pl-2", children: /* @__PURE__ */ T.jsx(pr, {}) }) ] } ), ia = ({ prompts: P = [], onClickHandler: E = () => { }, title: S = "Suggestions" }) => P.length === 0 ? null : /* @__PURE__ */ T.jsxs("div", { className: "capitolai-summary__prompt-suggestions-container", children: [ /* @__PURE__ */ T.jsx("div", { className: "font-bold text-xl pb-4", children: S }), /* @__PURE__ */ T.jsx("div", { className: "grid grid-cols-1 justify-between gap-2 sm:grid-cols-2", children: P.map((H, X) => /* @__PURE__ */ T.jsx( sa, { prompt: H, onClickHandler: E }, X )) }) ] }), ra = ({ currentPage: P, totalPages: E, onPageChange: S, maxVisiblePages: H = 5 }) => { if (E <= 1) return null; const X = () => { const G = Math.floor(H / 2); let $ = Math.max(1, P - G), z = Math.min(E, $ + H - 1); return z - $ + 1 < H && ($ = Math.max(1, z - H + 1)), Array.from( { length: z - $ + 1 }, (K, mt) => $ + mt ); }; return /* @__PURE__ */ T.jsxs("div", { className: "flex justify-center items-center space-x-2 mt-6", children: [ /* @__PURE__ */ T.jsx( "button", { onClick: () => S(P - 1), disabled: P === 1, className: `px-3 py-1 rounded ${P === 1 ? "bg-gray-200 text-gray-500 cursor-not-allowed" : "bg-white text-gray-700 hover:bg-gray-100"}`, children: "Previous" } ), X().map((G) => /* @__PURE__ */ T.jsx( "button", { onClick: () => S(G), className: `px-3 py-1 rounded ${P === G ? "bg-blue-500 text-white" : "bg-white text-gray-700 hover:bg-gray-100"}`, children: G }, G )), /* @__PURE__ */ T.jsx( "button", { onClick: () => S(P + 1), disabled: P === E, className: `px-3 py-1 rounded ${P === E ? "bg-gray-200 text-gray-500 cursor-not-allowed" : "bg-white text-gray-700 hover:bg-gray-100"}`, children: "Next" } ) ] }); }, aa = ({ source: P, index: E, isMasonryLayout: S = !1 }) => { function H(mt) { return new URL(mt).hostname; } const X = H(P.url), G = X, $ = X, z = P == null ? void 0 : P.title, K = P == null ? void 0 : P.image; return /* @__PURE__ */ T.jsxs( "div", { className: `group p-4 rounded-lg flex cursor-pointer ${S ? "bg-stone-100 hover:bg-stone-200" : "hover:bg-neutral-100"}`, children: [ /* @__PURE__ */ T.jsxs( "div", { onClick: () => { typeof window < "u" && window.open(P.url, "_blank"); }, className: "flex-1", children: [ /* @__PURE__ */ T.jsxs("div", { className: "flex items-center", children: [ /* @__PURE__ */ T.jsx("div", { className: "w-5 h-5 min-w-5 bg-gray-300 rounded-full flex items-center justify-center text-xs", children: E + 1 }), /* @__PURE__ */ T.jsx( "img", { style: { marginLeft: "-4px" }, className: "w-5 h-5 bg-gray-400 rounded-full flex items-center justify-center", src: `https://www.google.com/s2/favicons?sz=18&domain=${X}` } ), /* @__PURE__ */ T.jsx("div", { className: "pl-2 uppercase text-gray-500 font-medium text-[11px] line-clamp-1 break-all", children: G }) ] }), !S && /* @__PURE__ */ T.jsx("div", { className: "font-bold text-[19px] mt-2 line-clamp-1 break-all group-hover:underline py-1", children: $ }), /* @__PURE__ */ T.jsx( "div", { className: S ? "text-[13px] pt-2 font-bold group-hover:underline line-clamp-3" : "text-[15px] text-gray-500 line-clamp-3", children: z } ) ] }, `source-${E}` ), S ? null : K ? /* @__PURE__ */ T.jsx("img", { className: "w-[174px] h-[116px] ml-12 object-cover", src: K }) : /* @__PURE__ */ T.jsx("div", { className: "w-[174px] h-[116px] ml-12" }) ] } ); }, na = ({ sources: P = [], itemsPerPage: E = 4, layout: S = "default" }) => { const [H, X] = ki(1), G = Math.ceil(P.length / E), $ = (H - 1) * E, z = $ + E, K = P.slice($, z), mt = S === "masonry"; switch (S) { case "compact": return /* @__PURE__ */ T.jsxs("div", { className: "inline-flex items-center gap-2 px-3 py-2 bg-[rgba(36,35,41,0.06)] rounded-full", children: [ /* @__PURE__ */ T.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ T.jsxs("span", { className: "text-[13px] font-normal text-[rgba(36,35,41,0.8)]", children: [ P.length, " Source", P.length !== 1 ? "s" : "" ] }) }), /* @__PURE__ */ T.jsx("div", { className: "flex -space-x-1.5", children: P.map((Q, pt) => { const _ = new URL(Q.url).hostname; return /* @__PURE__ */ T.jsxs( "div", { onClick: () => window.open(Q.url, "_blank"), className: "group relative w-5 h-5 rounded-full bg-[#E7E7E7] border border-white shadow-[0px_1px_5px_-1px_rgba(0,0,0,0.12),0px_2px_2px_-2px_rgba(0,0,0,0.14),0px_3px_1px_-3px_rgba(0,0,0,0.2)] overflow-visible cursor-pointer hover:scale-110 hover:z-20 transition-transform duration-200", children: [ /* @__PURE__ */ T.jsx( "img", { src: `https://www.google.com/s2/favicons?sz=32&domain=${_}`, alt: `${_} favicon`, className: "w-full h-full object-cover" } ), /* @__PURE__ */ T.jsxs("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-gray-700 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap pointer-events-none z-30", children: [ Q.url, /* @__PURE__ */ T.jsx("div", { className: "absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 rotate-45 w-2 h-2 bg-gray-700" }) ] }) ] }, Q.url ); }) }) ] }); case "masonry": case "default": default: return /* @__PURE__ */ T.jsxs("div", { children: [ /* @__PURE__ */ T.jsx( "div", { className: `font-bold text-xl ${mt ? "pb-6" : "pb-12"} `, children: `${P.length} source${P.length > 0 ? "s" : ""}` } ), /* @__PURE__ */ T.jsx( "div", { className: `grid grid-cols-1 justify-between ${mt ? "gap-2 sm:grid-cols-2" : "gap-6"}`, children: K.map((Q, pt) => /* @__PURE__ */ T.jsx( aa, { source: Q, index: pt, isMasonryLayout: mt }, pt )) } ), /* @__PURE__ */ T.jsx( ra, { currentPage: H, totalPages: G, onPageChange: X } ) ] }); } }; function ls() { return ls = Object.assign ? Object.assign.bind() : function(P) { for (var E = 1; E < arguments.length; E++) { var S = arguments[E]; for (var H in S) Object.prototype.hasOwnProperty.call(S, H) && (P[H] = S[H]); } return P; }, ls.apply(this, arguments); } const oa = ["children", "options"], rt = { blockQuote: "0", breakLine: "1", breakThematic: "2", codeBlock: "3", codeFenced: "4", codeInline: "5", footnote: "6", footnoteReference: "7", gfmTask: "8", heading: "9", headingSetext: "10", htmlBlock: "11", htmlComment: "12", htmlSelfClosing: "13", image: "14", link: "15", linkAngleBraceStyleDetector: "16", linkBareUrlDetector: "17", linkMailtoDetector: "18", newlineCoalescer: "19", orderedList: "20", paragraph: "21", ref: "22", refImage: "23", refLink: "24", table: "25", text: "27", textBolded: "28", textEmphasized: "29", textEscaped: "30", textMarked: "31", textStrikethroughed: "32", unorderedList: "33" }; var Qi; (function(P) { P[P.MAX = 0] = "MAX", P[P.HIGH = 1] = "HIGH", P[P.MED = 2] = "MED", P[P.LOW = 3] = "LOW", P[P.MIN = 4] = "MIN"; })(Qi || (Qi = {})); const tr = ["allowFullScreen", "allowTransparency", "autoComplete", "autoFocus", "autoPlay", "cellPadding", "cellSpacing", "charSet", "classId", "colSpan", "contentEditable", "contextMenu", "crossOrigin", "encType", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "frameBorder", "hrefLang", "inputMode", "keyParams", "keyType", "marginHeight", "marginWidth", "maxLength", "mediaGroup", "minLength", "noValidate", "radioGroup", "readOnly", "rowSpan", "spellCheck", "srcDoc", "srcLang", "srcSet", "tabIndex", "useMap"].reduce((P, E) => (P[E.toLowerCase()] = E, P), { class: "className", for: "htmlFor" }), er = { amp: "&", apos: "'", gt: ">", lt: "<", nbsp: " ", quot: "“" }, ha = ["style", "script"], la = ["src", "href", "data", "formAction", "srcDoc", "action"], pa = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi, fa = /mailto:/i, ca = /\n{2,}$/, cr = /^(\s*>[\s\S]*?)(?=\n\n|$)/, ua = /^ *> ?/gm, da = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/, ma = /^ {2,}\n/, ga = /^(?:( *[-*_])){3,} *(?:\n *)+\n/, ur = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/, dr = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/, ya = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/, va = /^(?:\n *)*\n/, ba = /\r\n?/g, xa = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/, ka = /^\[\^([^\]]+)]/, _a = /\f/g, Ca = /^---[ \t]*\n(.|\n)*\n---[ \t]*\n/, wa = /^\s*?\[(x|\s)\]/, mr = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/, gr = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/, yr = /^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/, _i = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i, Pa = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi, vr = /^<!--[\s\S]*?(?:-->)/, Aa = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/, Ci = /^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i, Sa = /^\{.*\}$/, Ea = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, Da = /^<([^ >]+@[^ >]+)>/, Ma = /^<([^ >]+:\/[^ >]+)>/, Ta = /-([a-z])?/gi, br = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/, Fa = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/, Ia = /^!\[([^\]]*)\] ?\[([^\]]*)\]/, ja = /^\[([^\]]*)\] ?\[([^\]]*)\]/, La = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/, Ra = /\t/g, Va = /(^ *\||\| *$)/g, Na = /^ *:-+: *$/, Oa = /^ *:-+ *$/, za = /^ *-+: *$/, ai = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)", Ba = new RegExp(`^([*_])\\1${ai}\\1\\1(?!\\1)`), Ha = new RegExp(`^([*_])${ai}\\1(?!\\1)`), qa = new RegExp(`^(==)${ai}\\1`), $a = new RegExp(`^(~~)${ai}\\1`), Wa = /^\\([^0-9A-Za-z\s])/, sr = /\\([^0-9A-Za-z\s])/g, Za = /^([\s\S](?:(?! |[0-9]\.)[^=*_~\-\n<`\\\[!])*)/, Ua = /^\n+/, Ya = /^([ \t]*)/, Xa = /\\([^\\])/g, Ga = /(?:^|\n)( *)$/, Pi = "(?:\\d+\\.)", Ai = "(?:[*+-])"; function xr(P) { return "( *)(" + (P === 1 ? Pi : Ai) + ") +"; } const kr = xr(1), _r = xr(2); function Cr(P) { return new RegExp("^" + (P === 1 ? kr : _r)); } const Ja = Cr(1), Ka = Cr(2); function wr(P) { return new RegExp("^" + (P === 1 ? kr : _r) + "[^\\n]*(?:\\n(?!\\1" + (P === 1 ? Pi : Ai) + " )[^\\n]*)*(\\n|$)", "gm"); } const Qa = wr(1), tn = wr(2); function Pr(P) { const E = P === 1 ? Pi : Ai; return new RegExp("^( *)(" + E + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + E + " (?!" + E + " ))\\n*|\\s*\\n*$)"); } const Ar = Pr(1), Sr = Pr(2); function ir(P, E) { const S = E === 1, H = S ? Ar : Sr, X = S ? Qa : tn, G = S ? Ja : Ka; return { match: ks(function($, z) { const K = Ga.exec(z.prevCapture); return K && (z.list || !z.inline && !z.simple) ? H.exec($ = K[1] + $) : null; }), order: 1, parse($, z, K) { const mt = S ? +$[2] : void 0, Q = $[0].replace(ca, ` `).match(X); let pt = !1; return { items: Q.map(function(_, N) { const I = G.exec(_)[0].length, lt = new RegExp("^ {1," + I + "}", "gm"), J = _.replace(lt, "").replace(G, ""), ft = N === Q.length - 1, et = J.indexOf(` `) !== -1 || ft && pt; pt = et; const Tt = K.inline, Ft = K.list; let dt; K.list = !0, et ? (K.inline = !1, dt = $s(J) + ` `) : (K.inline = !0, dt = $s(J)); const yt = z(dt, K); return K.inline = Tt, K.list = Ft, yt; }), ordered: S, start: mt }; }, render: ($, z, K) => P($.ordered ? "ol" : "ul", { key: K.key, start: $.type === rt.orderedList ? $.start : void 0 }, $.items.map(function(mt, Q) { return P("li", { key: Q }, z(mt, K)); })) }; } const en = new RegExp(`^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`), sn = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/, Er = [cr, ur, dr, mr, yr, gr, br, Ar, Sr], rn = [...Er, /^[^\n]+(?: \n|\n{2,})/, _i, vr, Ci]; function $s(P) { let E = P.length; for (; E > 0 && P[E - 1] <= " "; ) E--; return P.slice(0, E); } function Bs(P) { return P.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase(); } function an(P) { return za.test(P) ? "right" : Na.test(P) ? "center" : Oa.test(P) ? "left" : null; } function rr(P, E, S, H) { const X = S.inTable; S.inTable = !0; let G = [[]], $ = ""; function z() { if (!$) return; const K = G[G.length - 1]; K.push.apply(K, E($, S)), $ = ""; } return P.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((K, mt, Q) => { K.trim() === "|" && (z(), H) ? mt !== 0 && mt !== Q.length - 1 && G.push([]) : $ += K; }), z(), S.inTable = X, G; } function nn(P, E, S) { S.inline = !0; const H = P[2] ? P[2].replace(Va, "").split("|").map(an) : [], X = P[3] ? function($, z, K) { return $.trim().split(` `).map(function(mt) { return rr(mt, z, K, !0); }); }(P[3], E, S) : [], G = rr(P[1], E, S, !!X.length); return S.inline = !1, X.length ? { align: H, cells: X, header: G, type: rt.table } : { children: G, type: rt.paragraph }; } function ar(P, E) { return P.align[E] == null ? {} : { textAlign: P.align[E] }; } function ks(P) { return P.inline = 1, P; } function Ze(P) { return ks(function(E, S) { return S.inline ? P.exec(E) : null; }); } function Ue(P) { return ks(function(E, S) { return S.inline || S.simple ? P.exec(E) : null; }); } function je(P) { return function(E, S) { return S.inline || S.simple ? null : P.exec(E); }; } function Hs(P) { return ks(function(E) { return P.exec(E); }); } function on(P, E) { if (E.inline || E.simple) return null; let S = ""; P.split(` `).every((X) => (X += ` `, !Er.some((G) => G.test(X)) && (S += X, !!X.trim()))); const H = $s(S); return H == "" ? null : [S, , H]; } const hn = /(javascript|vbscript|data(?!:image)):/i; function ln(P) { try { const E = decodeURIComponent(P).replace(/[^A-Za-z0-9/:]/g, ""); if (hn.test(E)) return null; } catch { return null; } return P; } function nr(P) { return P.replace(Xa, "$1"); } function ri(P, E, S) { const H = S.inline || !1, X = S.simple || !1; S.inline = !0, S.simple = !0; const G = P(E, S); return S.inline = H, S.simple = X, G; } function pn(P, E, S) { const H = S.inline || !1, X = S.simple || !1; S.inline = !1, S.simple = !0; const G = P(E, S); return S.inline = H, S.simple = X, G; } function fn(P, E, S) { const H = S.inline || !1; S.inline = !1; const X = P(E, S); return S.inline = H, X; } const yi = (P, E, S) => ({ children: ri(E, P[2], S) }); function vi() { return {}; } function bi() { return null; } function cn(...P) { return P.filter(Boolean).join(" "); } function xi(P, E, S) { let H = P; const X = E.split("."); for (; X.length && (H = H[X[0]], H !== void 0); ) X.shift(); return H || S; } function un(P = "", E = {}) { function S(_, N, ...I) { const lt = xi(E.overrides, `${_}.props`, {}); return E.createElement(function(J, ft) { const et = xi(ft, J); return et ? typeof et == "function" || typeof et == "object" && "render" in et ? et : xi(ft, `${J}.component`, J) : J; }(_, E.overrides), ls({}, N, lt, { className: cn(N == null ? void 0 : N.className, lt.className) || void 0 }), ...I); } function H(_) { _ = _.replace(Ca, ""); let N = !1; E.forceInline ? N = !0 : E.forceBlock || (N = La.test(_) === !1); const I = mt(K(N ? _ : `${$s(_).replace(Ua, "")} `, { inline: N })); for (; typeof I[I.length - 1] == "string" && !I[I.length - 1].trim(); ) I.pop(); if (E.wrapper === null) return I; const lt = E.wrapper || (N ? "span" : "div"); let J; if (I.length > 1 || E.forceWrapper) J = I; else { if (I.length === 1) return J = I[0], typeof J == "string" ? S("span", { key: "outer" }, J) : J; J = null; } return E.createElement(lt, { key: "outer" }, J); } function X(_, N) { const I = N.match(pa); return I ? I.reduce(function(lt, J) { const ft = J.indexOf("="); if (ft !== -1) { const et = function(yt) { return yt.indexOf("-") !== -1 && yt.match(Aa) === null && (yt = yt.replace(Ta, function(St, Ht) { return Ht.toUpperCase(); })), yt; }(J.slice(0, ft)).trim(), Tt = function(yt) { const St = yt[0]; return (St === '"' || St === "'") && yt.length >= 2 && yt[yt.length - 1] === St ? yt.slice(1, -1) : yt; }(J.slice(ft + 1).trim()), Ft = tr[et] || et; if (Ft === "ref") return lt; const dt = lt[Ft] = function(yt, St, Ht, Le) { return St === "style" ? function(ce) { const oe = []; let he = "", qt = !1, Gt = !1, wt = ""; if (!ce) return oe; for (let ee = 0; ee < ce.length; ee++) { const Yt = ce[ee]; if (Yt !== '"' && Yt !== "'" || qt || (Gt ? Yt === wt && (Gt = !1, wt = "") : (Gt = !0, wt = Yt)), Yt === "(" && he.endsWith("url") ? qt = !0 : Yt === ")" && qt && (qt = !1), Yt !== ";" || Gt || qt) he += Yt; else { const le = he.trim(); if (le) { const Ce = le.indexOf(":"); if (Ce > 0) { const we = le.slice(0, Ce).trim(), Pe = le.slice(Ce + 1).trim(); oe.push([we, Pe]); } } he = ""; } } const ue = he.trim(); if (ue) { const ee = ue.indexOf(":"); if (ee > 0) { const Yt = ue.slice(0, ee).trim(), le = ue.slice(ee + 1).trim(); oe.push([Yt, le]); } } return oe; }(Ht).reduce(function(ce, [oe, he]) { return ce[oe.replace(/(-[a-z])/g, (qt) => qt[1].toUpperCase())] = Le(he, yt, oe), ce; }, {}) : la.indexOf(St) !== -1 ? Le(Ht, yt, St) : (Ht.match(Sa) && (Ht = Ht.slice(1, Ht.length - 1)), Ht === "true" || Ht !== "false" && Ht); }(_, et, Tt, E.sanitizer); typeof dt == "string" && (_i.test(dt) || Ci.test(dt)) && (lt[Ft] = H(dt.trim())); } else J !== "style" && (lt[tr[J] || J] = !0); return lt; }, {}) : null; } E.overrides = E.overrides || {}, E.sanitizer = E.sanitizer || ln, E.slugify = E.slugify || Bs, E.namedCodesToUnicode = E.namedCodesToUnicode ? ls({}, er, E.namedCodesToUnicode) : er, E.createElement = E.createElement || hr.createElement; const G = [], $ = {}, z = { [rt.blockQuote]: { match: je(cr), order: 1, parse(_, N, I) { const [, lt, J] = _[0].replace(ua, "").match(da); return { alert: lt, children: N(J, I) }; }, render(_, N, I) { const lt = { key: I.key }; return _.alert && (lt.className = "markdown-alert-" + E.slugify(_.alert.toLowerCase(), Bs), _.children.unshift({ attrs: {}, children: [{ type: rt.text, text: _.alert }], noInnerParse: !0, type: rt.htmlBlock, tag: "header" })), S("blockquote", lt, N(_.children, I)); } }, [rt.breakLine]: { match: Hs(ma), order: 1, parse: vi, render: (_, N, I) => S("br", { key: I.key }) }, [rt.breakThematic]: { match: je(ga), order: 1, parse: vi, render: (_, N, I) => S("hr", { key: I.key }) }, [rt.codeBlock]: { match: je(dr), order: 0, parse: (_) => ({ lang: void 0, text: $s(_[0].replace(/^ {4}/gm, "")).replace(sr, "$1") }), render: (_, N, I) => S("pre", { key: I.key }, S("code", ls({}, _.attrs, { className: _.lang ? `lang-${_.lang}` : "" }), _.text)) }, [rt.codeFenced]: { match: je(ur), order: 0, parse: (_) => ({ attrs: X("code", _[3] || ""), lang: _[2] || void 0, text: _[4], type: rt.codeBlock }) }, [rt.codeInline]: { match: Ue(ya), order: 3, parse: (_) => ({ text: _[2].replace(sr, "$1") }), render: (_, N, I) => S("code", { key: I.key }, _.text) }, [rt.footnote]: { match: je(xa), order: 0, parse: (_) => (G.push({ footnote: _[2], identifier: _[1] }), {}), render: bi }, [rt.footnoteReference]: { match: Ze(ka), order: 1, parse: (_) => ({ target: `#${E.slugify(_[1], Bs)}`, text: _[1] }), render: (_, N, I) => S("a", { key: I.key, href: E.sanitizer(_.target, "a", "href") }, S("sup", { key: I.key }, _.text)) }, [rt.gfmTask]: { match: Ze(wa), order: 1, parse: (_) => ({ completed: _[1].toLowerCase() === "x" }), render: (_, N, I) => S("input", { checked: _.completed, key: I.key, readOnly: !0, type: "checkbox" }) }, [rt.heading]: { match: je(E.enforceAtxHeadings ? gr : mr), order: 1, parse: (_, N, I) => ({ children: ri(N, _[2], I), id: E.slugify(_[2], Bs), level: _[1].length }), render: (_, N, I) => S(`h${_.level}`, { id: _.id, key: I.key }, N(_.children, I)) }, [rt.headingSetext]: { match: je(yr), order: 0, parse: (_, N, I) => ({ children: ri(N, _[1], I), level: _[2] === "=" ? 1 : 2, type: rt.heading }) }, [rt.htmlBlock]: { match: Hs(_i), order: 1, parse(_, N, I) { const [, lt] = _[3].match(Ya), J = new RegExp(`^${lt}`, "gm"), ft = _[3].replace(J, ""), et = (Tt = ft, rn.some((Ht) => Ht.test(Tt)) ? fn : ri); var Tt; const Ft = _[1].toLowerCase(), dt = ha.indexOf(Ft) !== -1, yt = (dt ? Ft : _[1]).trim(), St = { attrs: X(yt, _[2]), noInnerParse: dt, tag: yt }; return I.inAnchor = I.inAnchor || Ft === "a", dt ? St.text = _[3] : St.children = et(N, ft, I), I.inAnchor = !1, St; }, render: (_, N, I) => S(_.tag, ls({ key: I.key }, _.attrs), _.text || (_.children ? N(_.children, I) : "")) }, [rt.htmlSelfClosing]: { match: Hs(Ci), order: 1, parse(_) { const N = _[1].trim(); return { attrs: X(N, _[2] || ""), tag: N }; }, render: (_, N, I) => S(_.tag, ls({}, _.attrs, { key: I.key })) }, [rt.htmlComment]: { match: Hs(vr), order: 1, parse: () => ({}), render: bi }, [rt.image]: { match: Ue(sn), order: 1, parse: (_) => ({ alt: _[1], target: nr(_[2]), title: _[3] }), render: (_, N, I) => S("img", { key: I.key, alt: _.alt || void 0, title: _.title || void 0, src: E.sanitizer(_.target, "img", "src") }) }, [rt.link]: { match: Ze(en), order: 3, parse: (_, N, I) => ({ children: pn(N, _[1], I), target: nr(_[2]), title: _[3] }), render: (_, N, I) => S("a", { key: I.key, href: E.sanitizer(_.target, "a", "href"), title: _.title }, N(_.children, I)) }, [rt.linkAngleBraceStyleDetector]: { match: Ze(Ma), order: 0, parse: (_) => ({ children: [{ text: _[1], type: rt.text }