@alwith/module-chat 0.1.25 → 0.1.27
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/README.md +1 -1
- package/dist/activity-host.d.ts +1 -1
- package/dist/activity-host.js +1 -1
- package/dist/approval/choice-elicitation-form.d.ts +1 -1
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/choice-schema.js +1 -1
- package/dist/approval/permission-options.js +1 -1
- package/dist/approval/permission-view.js +1 -1
- package/dist/approval/schema-elicitation-form.js +1 -1
- package/dist/approval/url-elicitation-card.js +1 -1
- package/dist/chunk-0e1pdbec.js +2 -0
- package/dist/chunk-25na55ve.js +2 -0
- package/dist/chunk-2845n9v4.js +1 -0
- package/dist/chunk-341yykkp.js +1 -0
- package/dist/chunk-6x9vcfpg.js +1 -0
- package/dist/chunk-74phx7h8.js +2 -0
- package/dist/chunk-7gh078gc.js +2 -0
- package/dist/chunk-7pr2j1zb.js +1 -0
- package/dist/chunk-7tj0a2na.js +2 -0
- package/dist/chunk-8bdd6q4w.js +2 -0
- package/dist/chunk-8zs8vy0q.js +1 -0
- package/dist/chunk-9me7jmzd.js +2 -0
- package/dist/chunk-arge74eh.js +2 -0
- package/dist/chunk-awbgf3hp.js +2 -0
- package/dist/chunk-ax9ganqr.js +2 -0
- package/dist/chunk-bhvtt6tv.js +4 -0
- package/dist/chunk-darkfx1b.js +2 -0
- package/dist/chunk-dekjd5sf.js +2 -0
- package/dist/chunk-etvhn65g.js +2 -0
- package/dist/chunk-f20xh0z9.js +1 -0
- package/dist/chunk-g20b01rn.js +2 -0
- package/dist/chunk-g3r8m488.js +2 -0
- package/dist/chunk-g77gammg.js +2 -0
- package/dist/chunk-ghfbzhnb.js +1 -0
- package/dist/chunk-gycty1x1.js +2 -0
- package/dist/chunk-hnt4tt1n.js +2 -0
- package/dist/chunk-hy1x2td2.js +2 -0
- package/dist/chunk-jkr153v1.js +2 -0
- package/dist/chunk-jnx3t913.js +2 -0
- package/dist/chunk-k1c0jrk1.js +1 -0
- package/dist/chunk-m8gejgjs.js +1 -0
- package/dist/chunk-p9wpghey.js +2 -0
- package/dist/chunk-pnncsvbz.js +1 -0
- package/dist/chunk-pve9b7z3.js +2 -0
- package/dist/chunk-q17wr01c.js +3 -0
- package/dist/chunk-qj8r5xvx.js +2 -0
- package/dist/chunk-qyhgwc51.js +2 -0
- package/dist/chunk-r9k7kszp.js +1 -0
- package/dist/chunk-rakd7vzb.js +2 -0
- package/dist/chunk-reqrpvyy.js +2 -0
- package/dist/chunk-rka1mc9r.js +1 -0
- package/dist/chunk-s0nhgptn.js +1 -0
- package/dist/chunk-s28x10qd.js +1 -0
- package/dist/chunk-s3z33k7f.js +2 -0
- package/dist/chunk-src2j5cw.js +2 -0
- package/dist/chunk-v4p0qwmj.js +1 -0
- package/dist/chunk-wc3patey.js +7 -0
- package/dist/chunk-wtkv29ba.js +1 -0
- package/dist/chunk-y2xbq7rb.js +3 -0
- package/dist/chunk-yk52gm8x.js +2 -0
- package/dist/codex/activity-group.d.ts +1 -1
- package/dist/codex/activity-group.js +1 -6
- package/dist/codex/assistant-message.d.ts +3 -3
- package/dist/codex/assistant-message.js +2 -2
- package/dist/codex/async-question-card.js +3 -3
- package/dist/codex/disclosure-state.js +1 -1
- package/dist/codex/edited-files-card.d.ts +1 -1
- package/dist/codex/edited-files-card.js +1 -2
- package/dist/codex/image-view-activity.d.ts +1 -1
- package/dist/codex/image-view-activity.js +1 -1
- package/dist/codex/markdown-renderer.js +5 -5
- package/dist/codex/navigation-audio.d.ts +1 -1
- package/dist/codex/navigation-audio.js +1 -1
- package/dist/codex/navigation-instruments.d.ts +1 -1
- package/dist/codex/navigation-instruments.js +1 -1
- package/dist/codex/navigation-preview.js +1 -1
- package/dist/codex/navigation-rail.css +1 -216
- package/dist/codex/navigation-rail.js +1 -1
- package/dist/codex/patch-view.js +2 -2
- package/dist/codex/plan.d.ts +1 -1
- package/dist/codex/plan.js +1 -1
- package/dist/codex/terminal-output.js +1 -1
- package/dist/codex/thread-virtualizer.js +1 -1
- package/dist/codex/user-message.d.ts +1 -1
- package/dist/codex/user-message.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/composer/completion-filter.js +1 -1
- package/dist/composer/completion-menu.d.ts +2 -2
- package/dist/composer/completion-menu.js +3 -3
- package/dist/composer/completion-trigger.js +1 -3
- package/dist/composer/effort-slider.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.d.ts +3 -3
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.d.ts +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/composer/prompt-input-attachments.d.ts +1 -1
- package/dist/composer/prompt-input-attachments.js +1 -1
- package/dist/composer/prompt-input-clipboard.js +1 -1
- package/dist/composer/prompt-input-context.js +1 -1
- package/dist/composer/prompt-input-textarea.d.ts +1 -1
- package/dist/composer/prompt-input-textarea.js +3 -3
- package/dist/composer/prompt-input.d.ts +3 -3
- package/dist/composer/prompt-input.js +1 -1
- package/dist/image-lightbox.js +1 -1
- package/dist/image-preview-dialog.js +1 -1
- package/dist/lib/code-highlighter.js +1 -1
- package/dist/lib/fuzzy.js +1 -1
- package/dist/lib/group-blocks.d.ts +4 -4
- package/dist/lib/group-blocks.js +1 -1
- package/dist/lib/image-encode.js +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/markdown-parser.js +1 -1
- package/dist/lib/markdown-parser.worker.js +66 -1
- package/dist/lib/markdown-rules.js +1 -1
- package/dist/lib/model-name.js +1 -1
- package/dist/lib/pointer-centered-zoom.js +1 -1
- package/dist/lib/prepare-prompt-files.d.ts +1 -1
- package/dist/lib/prepare-prompt-files.js +1 -1
- package/dist/lib/stream-entry.d.ts +1 -1
- package/dist/lib/stream-style.d.ts +1 -1
- package/dist/lib/stream-style.js +1 -2
- package/dist/lib/streaming-markdown.js +2 -2
- package/dist/locales.js +1 -1
- package/dist/search/chat-search.d.ts +3 -3
- package/dist/search/chat-search.js +1 -1
- package/dist/search/dom-matches.js +1 -1
- package/dist/search/find-bar.js +1 -1
- package/dist/search/literal-matches.js +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/button.js +1 -1
- package/dist/ui/card.js +1 -1
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/field.d.ts +2 -2
- package/dist/ui/field.js +1 -1
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/input-group-textarea.js +1 -1
- package/dist/ui/input-group.d.ts +4 -4
- package/dist/ui/input-group.js +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +23 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e}from"../chunk-7pr2j1zb.js";import{v,x,m}from"../chunk-2845n9v4.js";import{n}from"../chunk-g3r8m488.js";import{useState as f}from"react";import{jsxDEV as o}from"react/jsx-dev-runtime";function N({value:p,currentName:t,icon:r,options:s,label:i,header:a,onValueChange:l,showLabel:d=!1,disabled:u=!1}){let[c,g]=f(!1);return o(v,{open:c,onOpenChange:g,children:[o(x,{render:o(e,{disabled:u,variant:"ghost","aria-label":`${i}: ${t}`,title:t,className:"text-muted-foreground data-popup-open:hover:bg-muted h-7 gap-1.5 rounded-full bg-transparent px-2 text-xs font-normal whitespace-nowrap data-popup-open:bg-transparent",children:[r,o("span",{className:d?"max-w-40 truncate":"hidden max-w-40 truncate @[40rem]/input-footer:inline-block",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),o(m,{align:"start",sideOffset:4,className:"permission-mode-menu z-100 w-auto max-w-[calc(100vw-2rem)] min-w-72 rounded-xl p-1.5",children:[a&&o("div",{className:"text-muted-foreground flex items-center px-1.5 pt-0.5 pb-1 text-[11px] leading-4",children:o("span",{children:a},void 0,!1,void 0,this)},void 0,!1,void 0,this),o(n,{value:p,onValueChange:l,itemClassName:"items-center gap-2 py-1 pr-6 pl-2 whitespace-nowrap",options:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{N as PermissionModeSelect};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import { type FileUIPart } from "./prompt-input-context
|
|
2
|
+
import { type FileUIPart } from "./prompt-input-context";
|
|
3
3
|
export type PromptInputAttachmentProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
t: (key: "input.image" | "input.attachment" | "input.removeAttachment") => string;
|
|
5
5
|
data: FileUIPart & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import"../chunk-qj8r5xvx.js";import{e}from"../chunk-7pr2j1zb.js";import"../chunk-s0nhgptn.js";import{Ke}from"../chunk-74phx7h8.js";import{Re,Le,_e}from"../chunk-6x9vcfpg.js";import{p}from"../chunk-awbgf3hp.js";import{cn as f}from"cn";import{PaperclipIcon as H,XIcon as k}from"lucide-react";import{Fragment as T,useEffect as M,useRef as L,useState as P}from"react";import{jsxDEV as t,Fragment as E}from"react/jsx-dev-runtime";function z(n){return t(_e,{align:"start",...n},void 0,!1,void 0,this)}function W({data:n,t:r,className:u,...m}){let c=p(),[d,h]=P(!1),[N,v]=P(1),I=L(null),a=n.filename||"",o=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",C=a||(o?r("input.image"):r("input.attachment"));return M(()=>{if(!d)return;let l=0.1,g=(i)=>Math.min(10,Math.max(0.1,i)),y=(i)=>{if(!(i.ctrlKey||i.metaKey))return;let s=i.key,x=s==="+"||s==="=",A=s==="-"||s==="_",w=s==="0";if(!x&&!A&&!w)return;i.preventDefault(),v((b)=>{if(w)return 1;if(x)return g(b+l);return g(b-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),t(E,{children:[t(Re,{children:[t(Le,{render:t("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...m,children:[t("div",{className:"relative size-5 shrink-0",children:[o?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:a||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20},void 0,!1,void 0,this)},void 0,!1,void 0,this):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(H,{className:"size-3"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),c.remove(n.id)},type:"button",variant:"ghost",children:[t(k,{},void 0,!1,void 0,this),t("span",{className:"sr-only",children:r("input.removeAttachment")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!o&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(z,{className:"w-auto p-2",children:t("div",{className:"w-auto space-y-3",children:[o&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:a||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("div",{className:"flex items-center gap-2.5",children:t("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:a||(o?"Image":"Attachment")},void 0,!1,void 0,this),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o&&n.url&&t(Ke,{containerRef:I,filename:a||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:N,url:n.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X({children:n,className:r,...u}){let m=p();if(!m.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:m.files.map((c)=>t(T,{children:n(c)},c.id,!1,void 0,this))},void 0,!1,void 0,this)}export{W as PromptInputAttachment,X as PromptInputAttachments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ot,le,de,it,nt,_}from"../chunk-7tj0a2na.js";export{de as clipboardHasStringItem,nt as countControlCharsBeforeIndex,ot as normalizePastedImageFile,_ as sanitizeTextareaTargetValue,it as sanitizeTextareaValue,le as scanClipboardForImageFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O,pt,B,gt,k,ce,C,ft,ht,z,p}from"../chunk-awbgf3hp.js";export{z as LocalAttachmentsContext,ht as PromptInputProvider,B as PromptInputSubmissionContext,O as PromptInputSubmitContext,k as ProviderAttachmentsContext,C as useOptionalPromptInputController,p as usePromptInputAttachments,ce as usePromptInputController,gt as usePromptInputSubmission,pt as usePromptInputSubmit,ft as useProviderAttachments};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
-
import { InputGroupTextarea } from "../ui/input-group-textarea
|
|
2
|
+
import { InputGroupTextarea } from "../ui/input-group-textarea";
|
|
3
3
|
export type PromptInputTextareaProps = ComponentProps<typeof InputGroupTextarea> & {
|
|
4
4
|
bashMode?: boolean;
|
|
5
5
|
isSendShortcut?: (event: KeyboardEvent) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`&&
|
|
3
|
-
${
|
|
1
|
+
import"../chunk-r9k7kszp.js";import{ne}from"../chunk-jnx3t913.js";import{le,de,_}from"../chunk-7tj0a2na.js";import{C,p}from"../chunk-awbgf3hp.js";import{cn as A}from"cn";import{forwardRef as D,useCallback as M,useEffect as K,useImperativeHandle as L,useRef as d}from"react";import{jsxDEV as q}from"react/jsx-dev-runtime";var R=(i)=>!i.shiftKey,F=()=>!1,N=D(({onChange:i,onCompositionStart:v,onCompositionEnd:x,className:T,placeholder:y,bashMode:b=!1,isSendShortcut:E=R,isNewlineShortcut:I=F,...H},P)=>{let n=C(),l=p(),o=d(!1),u=d(!1),r=d(null),s=M(()=>{let e=r.current;if(!e||o.current)return;e.style.height="auto",e.style.height=`${e.scrollHeight}px`},[]);K(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(s)});return t.observe(e),()=>t.disconnect()},[s]);let c=b&&(n?.textInput.value??"").startsWith("!"),S=(e)=>{if(o.current||e.nativeEvent.isComposing||e.nativeEvent.keyCode===229||u.current)return;if(e.key.length===1&&e.key.charCodeAt(0)<32&&e.key!==`
|
|
2
|
+
`&&e.key!=="\r"&&e.key!=="\t"){e.preventDefault();return}if(c&&n){let t=e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0;if(e.key==="Escape"||(e.key==="Backspace"||e.key==="Delete")&&t){e.preventDefault(),n.textInput.setInput(n.textInput.value.slice(1));return}}if(e.key==="Enter"){if(I(e.nativeEvent)){e.preventDefault();let t=e.currentTarget,{selectionStart:a,selectionEnd:f,value:m}=t,h=`${m.slice(0,a)}
|
|
3
|
+
${m.slice(f)}`;if(n)n.textInput.setInput(h);else t.value=h;let g=a+1;t.setSelectionRange(g,g),s();return}if(E(e.nativeEvent)){e.preventDefault();let t=e.currentTarget.form;if(!t)return;let a=t.querySelector('button[type="submit"]');if(!a||a.disabled)return;t.requestSubmit(a)}}if(e.key==="Backspace"&&e.currentTarget.value===""&&l.files.length>0){e.preventDefault();let t=l.files.at(-1);if(t)l.remove(t.id)}},k=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:a,sawNonImageFile:f}=le(t),m=de(t);if(a.length>0)e.preventDefault(),l.add(a);else if(f&&!m)e.preventDefault()},w=n?{value:o.current&&r.current?r.current.value:c?n.textInput.value.slice(1):n.textInput.value,onChange:(e)=>{let t=o.current?e.currentTarget.value:_(e.currentTarget);n.textInput.setInput(c?`!${t}`:t),s(),i?.(e)}}:{onChange:(e)=>{if(!o.current)_(e.currentTarget);s(),i?.(e)}};return L(P,()=>({resetHeight:()=>{if(r.current)r.current.style.height="auto"},focus:()=>{r.current?.focus()},isComposing:()=>o.current||u.current,getTextarea:()=>r.current}),[]),q(ne,{"data-chat-input":!0,ref:r,rows:3,className:A("field-sizing-content max-h-(--chat-input-max-height) min-h-[calc(var(--chat-input-line-height)*3)] min-w-0 flex-1 overflow-x-hidden","leading-(--chat-input-line-height)","placeholder:text-chat-input-placeholder p-0 pe-2.5","bg-chat-input-bg",T),name:"message",onCompositionEnd:(e)=>{o.current=!1;let t=_(e.currentTarget);n?.textInput.setInput(c?`!${t}`:t),s(),x?.(e),u.current=!0,requestAnimationFrame(()=>{u.current=!1})},onCompositionStart:(e)=>{u.current=!1,o.current=!0,v?.(e)},onKeyDown:S,onPaste:k,placeholder:y,...H,...w},void 0,!1,void 0,this)});N.displayName="PromptInputTextarea";export{N as PromptInputTextarea};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ComponentProps, type FormEvent, type HTMLAttributes } from "react";
|
|
2
|
-
import { InputGroupAddon, InputGroupButton } from "../ui/input-group
|
|
3
|
-
import { type AttachmentPolicy, type FileUIPart } from "./prompt-input-context
|
|
2
|
+
import { InputGroupAddon, InputGroupButton } from "../ui/input-group";
|
|
3
|
+
import { type AttachmentPolicy, type FileUIPart } from "./prompt-input-context";
|
|
4
4
|
type ChatStatus = "submitted" | "streaming" | "ready" | "error";
|
|
5
5
|
export type PromptInputError = Parameters<NonNullable<PromptInputProps["onError"]>>[0];
|
|
6
|
-
export { MAX_TOTAL_IMAGE_MB } from "../lib/limits
|
|
6
|
+
export { MAX_TOTAL_IMAGE_MB } from "../lib/limits";
|
|
7
7
|
export type PromptInputMessage = {
|
|
8
8
|
text: string;
|
|
9
9
|
files: FileUIPart[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ze,ae}from"../chunk-reqrpvyy.js";import"../chunk-0e1pdbec.js";import{Ve}from"../chunk-src2j5cw.js";import"../chunk-7pr2j1zb.js";import"../chunk-r9k7kszp.js";import"../chunk-jnx3t913.js";import{ze,ee,te}from"../chunk-ghfbzhnb.js";import{O,B,k,C,z}from"../chunk-awbgf3hp.js";import{cn as P}from"cn";import{ArrowUpIcon as Ie,Loader2Icon as ye,SquareIcon as xe,XIcon as Le}from"lucide-react";import{Children as oe,useCallback as h,useEffect as F,useMemo as Te,useRef as M,useState as Fe}from"react";import{flushSync as Me}from"react-dom";import{jsxDEV as o}from"react/jsx-dev-runtime";function se(u){let s=new FormData(u).get("message");return typeof s==="string"?s:""}var De=({className:u,bashMode:s=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:ie,globalDrop:A,syncHiddenInput:G,maxFiles:D,maxFileSize:N,onError:b,onSubmit:ue,children:le,...pe})=>{let i=C(),l=!!i,me=s&&l&&i.textInput.value.startsWith("!"),x=M(null),w=M(null),R=M(!1),[ce,U]=Fe([]),c=l?i.attachments.files:ce,j=M(c);j.current=c;let de=h(()=>{x.current?.click()},[]),q=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),X=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),fe=h((e)=>{let r=[...e],t=r.filter((a)=>q(a));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(a)=>N?a.size<=N:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}U((a)=>{let v=I?I.uniqueFiles(m,a):m,p=typeof D==="number"?Math.max(0,D-a.length):void 0,H=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let re=[];for(let T of H){let ne=I?.sourcePath(T);re.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:X(T),filename:T.name,size:T.size,lastModified:T.lastModified,...ne===void 0?{}:{sourcePath:ne}})}return[...a,...re]})},[I,X,q,D,N,b]),ge=h((e)=>U((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),be=h(()=>U((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),J=l?i.attachments.add:fe,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,a)=>m+a.size,0);if(n>0){let m=c.filter((a)=>(a.mediaType??"").toLowerCase().startsWith("image/")).reduce((a,v)=>a+(v.size??0),0);if(Ze(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${ae}MB.`});return}}J(r)},[c,J,b]),K=l?i.attachments.remove:ge,W=l?i.attachments.clear:be,Q=l?i.attachments.openFileDialog:de;F(()=>{if(!l)return;i.__registerFileInput(x,()=>x.current?.click())},[l,i]),F(()=>{if(G&&x.current&&c.length===0)x.current.value=""},[c,G]),F(()=>{let e=w.current;if(!e)return;if(A)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,A]),F(()=>{if(!A)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,A]),F(()=>()=>{if(!l){for(let e of j.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let ve=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},V=Te(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:K,clear:W,openFileDialog:Q,fileInputRef:x}),[c,L,K,W,Q]),S=M({controller:i,files:c,canSubmit:f});S.current={controller:i,files:c,canSubmit:f};let _=M(!0);F(()=>(_.current=!0,()=>{_.current=!1}),[]);let Y=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(R.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=w.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?i.textInput.value:se(t),m=i?.textInput.getRevision?.(),a=c,v=()=>{if(!_.current)return;let p=S.current;if(p.files!==a)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(se(t)===n)t.reset();W()};R.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await Ve(a),H=S.current.canSubmit===void 0?!0:S.current.canSubmit();if(H!==!0)return{status:"blocked",reason:H};if(!_.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await ue({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{R.current=!1}},he=(e)=>{e.preventDefault(),Y(e).catch(y)},Pe=h((e)=>{if(!e.trim())return;if(l&&i)Me(()=>{i.textInput.setInput(e)});w.current?.requestSubmit()},[i,l]),Z=o(B.Provider,{value:()=>Y(null),children:o(O.Provider,{value:Pe,children:[o("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:ie,onChange:ve,ref:x,title:"Upload files",type:"file"},void 0,!1,void 0,this),o("form",{className:P("w-full",u),onSubmit:he,ref:w,"data-tour":"chat-input",...pe,children:o(ze,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",me&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:le},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return l?o(k.Provider,{value:V,children:Z},void 0,!1,void 0,this):o(z.Provider,{value:V,children:Z},void 0,!1,void 0,this)};function Ne({className:u,...s}){return o("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...s},void 0,!1,void 0,this)}function Re({className:u,...s}){return o(ee,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...s},void 0,!1,void 0,this)}function Ue({className:u,...s}){return o(ee,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...s},void 0,!1,void 0,this)}function Be({className:u,...s}){return o("div",{className:P("flex items-center gap-1",u),...s},void 0,!1,void 0,this)}var Oe=({variant:u="ghost",className:s,size:I,collapsed:d=!1,...y})=>{let f=d||oe.count(y.children)<=1?"icon-xs":"xs";return o(te,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||oe.count(y.children)<=1)&&"size-7",s),size:f,type:"button",variant:u,...y},void 0,!1,void 0,this)},We=({className:u,variant:s="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=o(Ie,{className:"size-4"},void 0,!1,void 0,this);if(d==="submitted")g=o(ye,{className:"size-4 animate-spin"},void 0,!1,void 0,this);else if(d==="streaming")g=o(xe,{className:"size-3 fill-current"},void 0,!1,void 0,this);else if(d==="error")g=o(Le,{className:"size-4"},void 0,!1,void 0,this);return o(te,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:s,...f,children:y??g},void 0,!1,void 0,this)};export{ae as MAX_TOTAL_IMAGE_MB,De as PromptInput,Ne as PromptInputBody,Oe as PromptInputButton,Ue as PromptInputFooter,Re as PromptInputHeader,We as PromptInputSubmit,Be as PromptInputTools};
|
package/dist/image-lightbox.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ke}from"./chunk-8bdd6q4w.js";export{ke as ImageLightbox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ke}from"./chunk-74phx7h8.js";import"./chunk-s0nhgptn.js";import"./chunk-7pr2j1zb.js";import"./chunk-qj8r5xvx.js";export{Ke as ImagePreviewDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{tt}from"../chunk-25na55ve.js";export{tt as createCodeHighlighter};
|
package/dist/lib/fuzzy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{se,Je}from"../chunk-hnt4tt1n.js";export{Je as fuzzyFilter,se as fuzzyMatch};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContentBlock } from "../types
|
|
2
|
-
import type { StreamEntry } from "./stream-entry
|
|
3
|
-
import { type StreamStyle } from "./stream-style
|
|
4
|
-
export type { BlockEntry, CodexActivityBlock, CodexActivityGroupEntry, StreamEntry, ToolGroupEntry, ToolUseBlock } from "./stream-entry
|
|
1
|
+
import type { ContentBlock } from "../types";
|
|
2
|
+
import type { StreamEntry } from "./stream-entry";
|
|
3
|
+
import { type StreamStyle } from "./stream-style";
|
|
4
|
+
export type { BlockEntry, CodexActivityBlock, CodexActivityGroupEntry, StreamEntry, ToolGroupEntry, ToolUseBlock } from "./stream-entry";
|
|
5
5
|
export declare function groupBlocksForStyle(blocks: ContentBlock[], style: StreamStyle): StreamEntry[];
|
package/dist/lib/group-blocks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ue}from"../chunk-s3z33k7f.js";import"../chunk-y2xbq7rb.js";export{Ue as groupBlocksForStyle};
|
package/dist/lib/image-encode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{Qe}from"../chunk-0e1pdbec.js";export{Qe as convertBlobUrlToDataUrl};
|
package/dist/lib/limits.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{At,Ft,Ze,Dt,ae}from"../chunk-reqrpvyy.js";export{At as BYTES_PER_MB,Ft as MAX_TOTAL_IMAGE_BYTES,ae as MAX_TOTAL_IMAGE_MB,Ze as exceedsImageLimit,Dt as formatImageSizeMb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ie,Xe}from"../chunk-g20b01rn.js";export{ie as cachedMarkdown,Xe as createMarkdownParser};
|
|
@@ -1 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
function U(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var T=U();function Fe(t){T=t}var S={exec:()=>null};function v(t){let e=[];return(r)=>{let s=Math.max(0,Math.min(3,r-1)),n=e[s];return n||(n=t(s),e[s]=n),n}}function g(t,e=""){let r=typeof t=="string"?t:t.source,s={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(m.caret,"$1"),r=r.replace(n,l),s},getRegex:()=>new RegExp(r,e)};return s}var Qe=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),m={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(t)=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:v((t)=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:v((t)=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:v((t)=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:v((t)=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:v((t)=>new RegExp(`^ {0,${t}}(?:</?(?:${q})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:v((t)=>new RegExp(`^ {0,${t}}>`))},He=/^(?:[ \t]*(?:\n|$))+/,Ne=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,We=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,M=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ge=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,K=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,be=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,we=g(be).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Xe=g(be).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),J=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ue=/^[^\n]+/,V=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ke=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",V).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Je=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,K).getRegex(),q="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Y=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ve=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Y).replace("tag",q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ee=(t)=>g(J).replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",q).getRegex(),Ye=Ee(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),et=Ee(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),tt=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",et).getRegex(),ee={blockquote:tt,code:Ne,def:Ke,fences:We,heading:Ge,hr:M,html:Ve,lheading:we,list:Je,newline:He,paragraph:Ye,table:S,text:Ue},he=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",q).getRegex(),rt={...ee,lheading:Xe,table:he,paragraph:g(J).replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",q).getRegex()},nt={...ee,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Y).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(J).replace("hr",M).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",we).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},st=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,it=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ae=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,lt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,y=/[\p{P}\p{S}]/u,P=/[\s\p{P}\p{S}]/u,O=/[^\s\p{P}\p{S}]/u,at=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,P).getRegex(),ut=/[\p{Pi}\p{Ps}"']/u,$e=/(?!~)[\p{P}\p{S}]/u,ot=/(?!~)[\s\p{P}\p{S}]/u,ct=/(?:[^\s\p{P}\p{S}]|~)/u,ht=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Qe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ce=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pt=g(Ce,"u").replace(/punct/g,y).getRegex(),gt=g(Ce,"u").replace(/punct/g,$e).getRegex(),dt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ft=g(dt,"u").replace(/openQuote/g,ut).replace(/punct/g,y).getRegex(),ye="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kt=g(ye,"gu").replace(/notPunctSpace/g,O).replace(/punctSpace/g,P).replace(/punct/g,y).getRegex(),xt=g(ye,"gu").replace(/notPunctSpace/g,ct).replace(/punctSpace/g,ot).replace(/punct/g,$e).getRegex(),Dt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",_t=g(Dt,"gu").replace(/notPunctSpace/g,O).replace(/punctSpace/g,P).replace(/punct/g,y).getRegex(),mt=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,O).replace(/punctSpace/g,P).replace(/punct/g,y).getRegex(),Ft="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",bt=g(Ft,"gu").replace(/notPunctSpace/g,O).replace(/punctSpace/g,P).replace(/punct/g,y).getRegex(),wt=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,y).getRegex(),Et="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",At=g(Et,"gu").replace(/notPunctSpace/g,O).replace(/punctSpace/g,P).replace(/punct/g,y).getRegex(),$t=g(/\\(punct)/,"gu").replace(/punct/g,y).getRegex(),Ct=g(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,y).getRegex(),yt=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),zt=g(Y).replace("(?:-->|$)","-->").getRegex(),Rt=g("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",zt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ze=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Q=g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",ze).getRegex(),St=g(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",Q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Bt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",Q).replace("ref",V).getRegex(),Tt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",V).getRegex(),pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,vt=g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",ze).getRegex(),Pt=g("reflink|nolink(?!\\()","g").replace("reflink",g(/^!?\[(label)\]\[(ref)\]/).replace("label",vt).replace("ref",pe).getRegex()).replace("nolink",g(/^!?\[(ref)\](?:\[\])?/).replace("ref",pe).getRegex()).getRegex(),ge=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,It=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Lt=g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,It).getRegex(),te={_backpedal:S,anyPunctuation:$t,anyPunctuationOutsideCode:Ct,autolink:yt,blockSkip:ht,br:Ae,code:it,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:pt,emStrongRDelimAst:kt,emStrongRDelimUnd:mt,escape:st,link:St,nolink:Tt,punctuation:at,reflink:Bt,reflinkSearch:Pt,tag:Rt,text:lt,url:S},Zt={...te,emStrongLDelim:ft,emStrongRDelimAst:_t,emStrongRDelimUnd:bt,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",Q).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Q).getRegex()},X={...te,emStrongRDelimAst:xt,emStrongLDelim:gt,delLDelim:wt,delRDelim:At,url:g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Lt).replace("protocol",ge).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",ge).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Mt={...X,br:g(Ae).replace("{2,}","*").getRegex(),text:g(X.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},j={normal:ee,gfm:rt,pedantic:nt},L={normal:te,gfm:X,breaks:Mt,pedantic:Zt},qt={"&":"&","<":"<",">":">",'"':""","'":"'"},de=(t)=>qt[t];function b(t,e){if(e){if(m.escapeTest.test(t))return t.replace(m.escapeReplace,de)}else if(m.escapeTestNoEncode.test(t))return t.replace(m.escapeReplaceNoEncode,de);return t}function Ot(t){return m.numericCharacterReference.test(t)?t.replace(m.numericCharacterReferenceOrAmpersand,(e,r,s)=>{if(r===void 0&&s===void 0)return"&";let n=r===void 0?Number.parseInt(s,16):Number.parseInt(r,10);return n===0||n>1114111||n>=55296&&n<=57343?"�":n===38?"&":String.fromCodePoint(n)}):t}function fe(t){try{t=encodeURI(t).replace(m.percentDecode,"%")}catch{return null}return t}function ke(t,e){let r=t.replace(m.findPipe,(i,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),s=r.split(m.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(m.slashPipe,"|");return s}function z(t,e,r){let s=t.length;if(s===0)return"";let n=0;for(;n<s;){let i=t.charAt(s-n-1);if(i===e&&!r)n++;else if(i!==e&&r)n++;else break}return t.slice(0,s-n)}function xe(t){let e=t.split(`
|
|
3
|
+
`),r=e.length-1;for(;r>=0&&m.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(`
|
|
4
|
+
`)}function H(t){return t.trim().toLowerCase().toUpperCase().toLowerCase()}function De(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])r++;else if(t[s]===e[1]&&(r--,r<0))return s;return r>0?-2:-1}function G(t,e=0){let r=e,s="";for(let n of t)if(n==="\t"){let i=4-r%4;s+=" ".repeat(i),r+=i}else s+=n,r++;return s}function _e(t,e,r,s,n){let i=e.href,l=e.title||null,a=t[1].replace(n.other.outputLinkReplace,"$1"),c=t[0].charAt(0)==="!",u=s.state.inLink,o=s.state.linkEmitted,p=s.state.inRawBlock;s.state.inLink=!0,s.state.linkEmitted=!1;let k=s.inlineTokens(a),h=s.state.linkEmitted;if(s.state.linkEmitted=o,s.state.inLink=u,!c){if(h){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:r,href:i,title:l,text:a,tokens:k}}function jt(t,e,r){let s=t.match(r.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
|
|
5
|
+
`).map((i)=>{let l=i.match(r.other.beginningSpace);if(l===null)return i;let[a]=l;return i.slice(Math.min(a.length,n.length))}).join(`
|
|
6
|
+
`)}function me(t,e,r,s){if(!e.includes("<"))return!1;for(let n=0;n<e.length;n++){if(e[n]==="\\"){n++;continue}if(e[n]==="`"){let a=s.inline.code.exec(e.slice(n));if(a){n+=a[0].length-1;continue}}if(e[n]!=="<")continue;let i=t.slice(r+n),l=s.inline.tag.exec(i)||s.inline.autolink.exec(i);if(l){if(l[0].length>e.length-n)return!0;n+=l[0].length-1}}return!1}var N=class{options;rules;lexer;constructor(t){this.options=t||T}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:xe(e[0]),s=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:s}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],s=jt(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let s=z(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceTabChar.test(s))&&(r=s.trim())}return{type:"heading",raw:z(e[0],`
|
|
7
|
+
`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:z(e[0],`
|
|
8
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=z(e[0],`
|
|
9
|
+
`).split(`
|
|
10
|
+
`),s="",n="",i=[];for(;r.length>0;){let l=!1,a=[],c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))a.push(r[c]),l=!0;else if(!l)a.push(r[c]);else break;r=r.slice(c);let u=a.join(`
|
|
11
|
+
`),o=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
13
|
+
${u}`:u,n=n?`${n}
|
|
14
|
+
${o}`:o;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,i,!0),this.lexer.state.top=p,r.length===0)break;let k=i.at(-1);if(k?.type==="code"||k?.type==="heading"||k?.type==="hr"||k?.type==="html")break;if(k?.type==="blockquote"){let h=k,x=r.join(`
|
|
15
|
+
`),_=h.raw+`
|
|
16
|
+
`+x.replace(this.rules.other.blockquoteSetextReplace2,""),f=this.blockquote(_);i[i.length-1]=f;let F=_.substring(f.raw.length).replace(/^\n/,""),d=F?F.split(`
|
|
17
|
+
`).length:0,w=d?r.slice(0,-d):r;w.length>0&&(s=`${s}
|
|
18
|
+
${w.join(`
|
|
19
|
+
`)}`),n=n.substring(0,n.length-h.text.length)+f.text;break}else if(k?.type==="list"){let h=k,x=h.raw+`
|
|
20
|
+
`+r.join(`
|
|
21
|
+
`),_=this.list(x);i[i.length-1]=_,s=s.substring(0,s.length-k.raw.length)+_.raw,n=n.substring(0,n.length-h.raw.length)+_.raw,r=x.substring(i.at(-1).raw.length).split(`
|
|
22
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,s=()=>r.length-t.length,n=e[1].trim(),i=n.length>1,l={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let a=this.rules.other.listItemRegex(n),c=!1;for(;t;){let o=!1,p="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;let k=s();t=t.substring(e[0].length);let h=e[2].split(`
|
|
23
|
+
`,1)[0],x=e[1].length,_=this.options.pedantic?G(h,x):h.replace(this.rules.other.leadingSpaceTab,(C)=>G(C,x)),f=t.split(`
|
|
24
|
+
`,1)[0],F=!_.trim(),d=0;if(this.options.pedantic?(d=2,p=_.trimStart()):F?d=x+1:(d=_.search(this.rules.other.nonSpaceChar),d=d>4?1:d,p=_.slice(d),d+=x),F&&this.rules.other.blankLine.test(f)&&(t=t.substring(f.length+1),o=!0),!o){let C=this.rules.other.nextBulletRegex(d),ae=this.rules.other.hrRegex(d),ue=this.rules.other.fencesBeginRegex(d),oe=this.rules.other.headingBeginRegex(d),qe=this.rules.other.htmlBeginRegex(d),Oe=this.rules.other.blockquoteBeginRegex(d);for(;t;){let ce=t.split(`
|
|
25
|
+
`,1)[0],I;if(f=ce,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),I=f):I=f.replace(this.rules.other.leadingSpaceTab,(je)=>G(je)),ue.test(f)||oe.test(f)||qe.test(f)||Oe.test(f)||C.test(f)||ae.test(f))break;if(I.search(this.rules.other.nonSpaceChar)>=d||!f.trim())p+=`
|
|
26
|
+
`+I.slice(d);else{if(F||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ue.test(_)||oe.test(_)||ae.test(_))break;p+=`
|
|
27
|
+
`+f}F=!f.trim(),t=t.substring(ce.length+1),_=I.slice(d)}}let w=r.slice(k,s());l.loose||(c?l.loose=!0:this.rules.other.doubleBlankLine.test(w)&&(c=!0)),l.items.push({type:"list_item",raw:w,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]})}let u=l.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;l.raw=r.slice(0,s()).trimEnd();for(let o of l.items)if(this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]),!l.loose){let p=o.tokens.filter((h)=>h.type==="space"),k=p.length>0&&p.some((h)=>this.rules.other.anyLine.test(h.raw));l.loose=k}for(let o of l.items){let p=o.tokens[0];if(o.task&&(p?.type==="text"||p?.type==="paragraph")){o.text=o.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let k=this.rules.other.listTaskCheckbox.exec(o.raw);if(k){let h={type:"checkbox",raw:k[0]+" ",checked:k[0]!=="[ ]"};o.checked=h.checked,l.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=h.raw+o.tokens[0].raw,o.tokens[0].text=h.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(h)):o.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):o.tokens.unshift(h)}}else o.task&&(o.task=!1)}if(l.loose)for(let o of l.items){o.loose=!0;for(let p of o.tokens)p.type==="text"&&(p.type="paragraph")}return l}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=xe(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&De(e[2],"()")!==-1)return;let r=H(e[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:z(e[0],`
|
|
28
|
+
`),href:s,title:n}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=ke(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
29
|
+
`):[],i={type:"table",raw:z(e[0],`
|
|
30
|
+
`),header:[],align:[],rows:[]};if(r.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<r.length;l++)i.header.push({text:r[l],tokens:this.lexer.inline(r[l]),header:!0,align:i.align[l]});for(let l of n)i.rows.push(ke(l,i.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[c]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:z(e[0],`
|
|
31
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
|
|
32
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let r=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&me(t,e[1],r,this.rules))return;let s=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=z(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=De(e[2],"()");if(l===-2)return;if(l>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],i="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(n);l&&(n=l[1],i=l[3])}else i=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?n=n.slice(1):n=n.slice(1,-1)),_e(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let s=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&me(t,r[1],s,this.rules))return;let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[H(n)];if(!i){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return _e(r,i,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r)){let n=[...s[0]].length-1,i,l,a=n,c=0,u=s[0][0],o=r===u,p=u==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*t.length+n);(s=p.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){a+=l;continue}else if(s[5]||s[6]){if(n%3&&!((n+l)%3)){c+=l;continue}if(o)break}if(a-=l,a>0)continue;l=Math.min(l,l+a+c);let k=[...s[0]][0].length,h=t.slice(0,n+s.index+k+l);if(Math.min(n,l)%2){let _=h.slice(1,-1);return{type:"em",raw:h,text:_,tokens:this.lexer.inlineTokens(_)}}let x=h.slice(2,-2);return{type:"strong",raw:h,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let s=this.rules.inline.delLDelim.exec(t);if(!s)return;if(!s[1]||!r||this.rules.inline.punctuation.exec(r)){let n=[...s[0]].length-1,i,l,a=n,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*t.length+n);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==n))continue;if(s[3]||s[4]){a+=l;continue}if(a-=l,a>0)continue;l=Math.min(l,l+a);let u=[...s[0]][0].length,o=t.slice(0,n+s.index+u+l),p=o.slice(n,-n);return{type:"del",raw:o,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:r?e[0]:Ot(e[0]),escaped:r}}}},E=class t{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||T,this.options.tokenizer=this.options.tokenizer||new N,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:m,block:j.normal,inline:L.normal};this.options.pedantic?(r.block=j.pedantic,r.inline=L.pedantic):this.options.gfm&&(r.block=j.gfm,this.options.breaks?r.inline=L.breaks:r.inline=L.gfm),this.tokenizer.rules=r}static get rules(){return{block:j,inline:L}}static lex(e,r){return new t(r).lex(e)}static lexInline(e,r){return new t(r).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
33
|
+
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let s=this.inlineQueue[r];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some((a)=>(i=a.call({lexer:this},e,r))?(e=e.substring(i.raw.length),r.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=r.at(-1);i.raw.length===1&&a!==void 0?a.raw+=`
|
|
34
|
+
`:r.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
35
|
+
`)?"":`
|
|
36
|
+
`)+i.raw,a.text+=`
|
|
37
|
+
`+i.text,this.inlineQueue.at(-1).src=a.text):r.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
38
|
+
`)?"":`
|
|
39
|
+
`)+i.raw,a.text+=`
|
|
40
|
+
`+i.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},r.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),r.push(i);continue}let l=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),u;this.options.extensions.startBlock.forEach((o)=>{u=o.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(l=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let a=r.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
41
|
+
`)?"":`
|
|
42
|
+
`)+i.raw,a.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(i),s=l.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let a=r.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
44
|
+
`)?"":`
|
|
45
|
+
`)+i.raw,a.text+=`
|
|
46
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let n=s[0],i=n.lastIndexOf("[");if(!(n.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,H(n.slice(i+1,-1))))&&!(i>1&&this.linkInText(n.slice(1,i-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let s=this.state.linkParenPossible;this.state.linkParenPossible=s&&e.includes(")");try{return this.#e(e,r)}finally{this.state.linkParenPossible=s}}#e(e,r){let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=(u)=>{let o=u.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,H(u.slice(o+1,-1))))return u;if(o>1&&u.charAt(0)!=="!"){let p=u.slice(1,o-1);if(this.linkInText(p))return"["+p.replace(a,c)+"]["+"a".repeat(u.length-o-2)+"]"}return"["+"a".repeat(u.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(a,c,u)=>u?"+".repeat(a.length):c?c+a.slice(c.length,-c.length).replace(/`/g,"+")+c:a),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,u)=>{let o=u?u.length:0;return a.slice(0,o)+"["+"a".repeat(a.length-o-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let n=!1,i="",l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}n||(i=""),n=!1;let a;if(this.options.extensions?.inline?.some((u)=>(a=u.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let u=r.at(-1);a.type==="text"&&u?.type==="text"?(u.raw+=a.raw,u.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,s,i)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e,s,i)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,o=e.slice(1),p;this.options.extensions.startInline.forEach((k)=>{p=k.call({lexer:this},o),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),n=!0;let u=r.at(-1);u?.type==="text"?(u.raw+=a.raw,u.text+=a.text):r.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw Error(r)}},W=class{options;parser;constructor(t){this.options=t||T}space(t){return""}code({text:t,lang:e,escaped:r}){let s=(e||"").match(m.notSpaceStart)?.[0],n=t?t.replace(m.endingNewline,"")+`
|
|
47
|
+
`:"";return s?'<pre><code class="language-'+b(s)+'">'+(r?n:b(n,!0))+`</code></pre>
|
|
48
|
+
`:"<pre><code>"+(r?n:b(n,!0))+`</code></pre>
|
|
49
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
50
|
+
${this.parser.parse(t)}</blockquote>
|
|
51
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
52
|
+
`}hr(t){return`<hr>
|
|
53
|
+
`}list(t){let{ordered:e,start:r}=t,s="";for(let l=0;l<t.items.length;l++){let a=t.items[l];s+=this.listitem(a)}let n=e?"ol":"ul",i=e&&r!==1?' start="'+r+'"':"";return"<"+n+i+`>
|
|
54
|
+
`+s+"</"+n+`>
|
|
55
|
+
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
56
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
57
|
+
`}table(t){let e="",r="";for(let n=0;n<t.header.length;n++)r+=this.tablecell(t.header[n]);e+=this.tablerow({text:r});let s="";for(let n=0;n<t.rows.length;n++){let i=t.rows[n];r="";for(let l=0;l<i.length;l++)r+=this.tablecell(i[l]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
58
|
+
<thead>
|
|
59
|
+
`+e+`</thead>
|
|
60
|
+
`+s+`</table>
|
|
61
|
+
`}tablerow({text:t}){return`<tr>
|
|
62
|
+
${t}</tr>
|
|
63
|
+
`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
64
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${b(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,text:r,tokens:s,autolink:n}){let i=n?b(r,!0):this.parser.parseInline(s),l=fe(t);if(l===null)return i;t=b(l,n);let a='<a href="'+t+'"';return e&&(a+=' title="'+b(e)+'"'),a+=">"+i+"</a>",a}image({href:t,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let n=fe(t);if(n===null)return b(r);t=n;let i=`<img src="${b(t)}" alt="${b(r)}"`;return e&&(i+=` title="${b(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):("escaped"in t)&&t.escaped?t.text:b(t.text)}},re=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},A=class t{options;renderer;textRenderer;constructor(e){this.options=e||T,this.options.renderer=this.options.renderer||new W,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new re}static parse(e,r){return new t(r).parse(e)}static parseInline(e,r){return new t(r).parseInline(e)}parse(e){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let l=n,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.type)){r+=a||"";continue}}let i=n;switch(i.type){case"space":{r+=this.renderer.space(i);break}case"hr":{r+=this.renderer.hr(i);break}case"heading":{r+=this.renderer.heading(i);break}case"code":{r+=this.renderer.code(i);break}case"table":{r+=this.renderer.table(i);break}case"blockquote":{r+=this.renderer.blockquote(i);break}case"list":{r+=this.renderer.list(i);break}case"checkbox":{r+=this.renderer.checkbox(i);break}case"html":{r+=this.renderer.html(i);break}case"def":{r+=this.renderer.def(i);break}case"paragraph":{r+=this.renderer.paragraph(i);break}case"text":{r+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw Error(l)}}}return r}parseInline(e,r=this.renderer){this.renderer.parser=this;let s="";for(let n=0;n<e.length;n++){let i=e[n];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(i.type)){s+=a||"";continue}}let l=i;switch(l.type){case"escape":{s+=r.text(l);break}case"html":{s+=r.html(l);break}case"link":{s+=r.link(l);break}case"image":{s+=r.image(l);break}case"checkbox":{s+=r.checkbox(l);break}case"strong":{s+=r.strong(l);break}case"em":{s+=r.em(l);break}case"codespan":{s+=r.codespan(l);break}case"br":{s+=r.br(l);break}case"del":{s+=r.del(l);break}case"text":{s+=r.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return s}},Z=class{options;block;constructor(t){this.options=t||T}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?E.lex:E.lexInline}provideParser(t=this.block){return t?A.parse:A.parseInline}};function R(t,e){if(Array.isArray(e))for(let r=0;r<e.length;r++)t.push(e[r]);else t.push(e)}var ne=class{defaults=U();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=A;Renderer=W;TextRenderer=re;Lexer=E;Tokenizer=N;Hooks=Z;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(let s of t)switch(R(r,e.call(this,s)),s.type){case"table":{let n=s;for(let i of n.header)R(r,this.walkTokens(i.tokens,e));for(let i of n.rows)for(let l of i)R(r,this.walkTokens(l.tokens,e));break}case"list":{let n=s;R(r,this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach((i)=>{let l=n[i].flat(1/0);R(r,this.walkTokens(l,e))}):n.tokens&&R(r,this.walkTokens(n.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach((r)=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach((n)=>{if(!n.name)throw Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...l){let a=n.renderer.apply(this,l);return a===!1&&(a=i.apply(this,l)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let i=e[n.level];i?i.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),r.renderer){let n=this.defaults.renderer||new W(this.defaults);for(let i in r.renderer){if(!(i in n))throw Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,a=r.renderer[l],c=n[l];n[l]=(...u)=>{let o=a.apply(n,u);return o===!1&&(o=c.apply(n,u)),o||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new N(this.defaults);for(let i in r.tokenizer){if(!(i in n))throw Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,a=r.tokenizer[l],c=n[l];n[l]=(...u)=>{let o=a.apply(n,u);return o===!1&&(o=c.apply(n,u)),o}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Z;for(let i in r.hooks){if(!(i in n))throw Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,a=r.hooks[l],c=n[l];Z.passThroughHooks.has(i)?n[l]=(u)=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(i))return(async()=>{let p=await a.call(n,u);return c.call(n,p)})();let o=a.call(n,u);return c.call(n,o)}:n[l]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(n,u);return p===!1&&(p=await c.apply(n,u)),p})();let o=a.apply(n,u);return o===!1&&(o=c.apply(n,u)),o}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(l){let a=[];return a.push(i.call(this,l)),n&&R(a,n.call(this,l)),a}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return E.lex(t,e??this.defaults)}parser(t,e){return A.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let s={...r},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let l=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer(t):t?E.lex:E.lexInline)(l,n),c=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let u=await(n.hooks?await n.hooks.provideParser(t):t?A.parse:A.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(u):u})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let l=(n.hooks?n.hooks.provideLexer(t):t?E.lex:E.lexInline)(e,n);n.hooks&&(l=n.hooks.processAllTokens(l)),n.walkTokens&&this.walkTokens(l,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(t):t?A.parse:A.parseInline)(l,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(l){return i(l)}}}onError(t,e){return(r)=>{if(r.message+=`
|
|
65
|
+
Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+b(r.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(r);throw r}}},B=new ne;function D(t,e){return B.parse(t,e)}D.options=D.setOptions=function(t){return B.setOptions(t),D.defaults=B.defaults,Fe(D.defaults),D};D.getDefaults=U;D.defaults=T;function Qt(...t){return B.use(...t),D.defaults=B.defaults,Fe(D.defaults),D}D.use=Qt;D.walkTokens=function(t,e){return B.walkTokens(t,e)};D.parseInline=B.parseInline;D.Parser=A;D.parser=A.parse;D.Renderer=W;D.TextRenderer=re;D.Lexer=E;D.lexer=E.lex;D.Tokenizer=N;D.Hooks=Z;D.parse=D;var{options:sr,setOptions:ir,walkTokens:lr,parseInline:ar}=D;var ur=A.parse,or=E.lex;var Re=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Se=/[\0-\x1F\x7F-\x9F]/;var Be=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/;var Te=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var Ht=class{src_Any=Re.source;src_Cc=Se.source;src_Z=Te.source;src_P=Be.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(t={}){this.opts={...this.opts,...t}}set(t={}){return this.opts={...this.opts,...t},this.cache={},this}escapeRE(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(t,e,r=4){let s=this.escapeRE(t),n=this.escapeRE(e),i=`(?:(?!${this.src_ZCc}|${s}|${n}).)`,l=`${s}${i}{0,1000}${n}`;for(let a=2;a<=r;a++)l=`${s}(?:${i}|${l}){0,1000}${n}`;return l}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){let e=`(?:(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:[0-9A-Fa-f]{1,4}:){6}${e}|::(?:[0-9A-Fa-f]{1,4}:){5}${e}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}${e}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}${e}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}${e}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:${e}|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::${e}|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;let t=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${t||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${this.src_ZPCc}))(?:(?![$+<=>^\`||])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map((t)=>this.escapeRE(t)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><|]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},se={validate:(t,e,r)=>{let s=r.re.get_http_validator();s.lastIndex=e;let n=s.exec(t);return n?n[0].length:0},normalize:(t,e)=>e.normalize(t)},Nt={"http:":se,"https:":se,"ftp:":se,"//":{validate:function(t,e,r){let s=r.re.get_relative_proto_validator();s.lastIndex=e;let n=s.exec(t);if(n){if(e>=3&&t[e-3]===":")return 0;if(e>=3&&t[e-3]==="/")return 0;return n[0].length}return 0},normalize:(t,e)=>e.normalize(t)},"mailto:":{validate:function(t,e,r){let s=r.re.get_mailto_validator();s.lastIndex=e;let n=s.exec(t);return n?n[0].length:0},normalize:(t,e)=>e.normalize(t)}},Wt="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",Gt="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function Xt(){let t=Gt.split("|");return Wt.split("|").forEach((e)=>{let r=e.indexOf(":"),s=e.slice(0,r);for(let n of e.slice(r+1))t.push(s+n)}),t}var Ut={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Xt(),urlAuth:!1,maxLength:1e4},ve=class{schema;index;lastIndex;raw;text;url;constructor(t,e,r,s){let n=t.slice(r,s);this.schema=e.toLowerCase(),this.index=r,this.lastIndex=s,this.raw=n,this.text=n,this.url=n}},Pe=class{__opts__;__schemas__;re;constructor(t={}){let{rebuilder:e,...r}=t;this.__opts__={...Ut,...r},this.__schemas__={...Nt},this.re=e||new Ht,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(t,e=null){if(!e)delete this.__schemas__[t];else{let r={normalize:(s,n)=>n.normalize(s),...e};this.__schemas__[t]=r}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(t={}){return this.__opts__={...this.__opts__,...t},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(t){if(!t.length)return!1;let e,r;r=this.re.get_schema_search(),r.lastIndex=0;while((e=r.exec(t))!==null)if(this.testSchemaAt(t,e[2],r.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]){if(r=this.re.get_fuzzy_link_search(),r.lastIndex=0,r.exec(t)!==null)return!0}if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]){if(t.indexOf("@")>=0){let s=this.re.get_fuzzy_mail_host_search(),n=this.re.get_mail_name_validator();s.lastIndex=0;while((e=s.exec(t))!==null){let i=t.slice(Math.max(0,e.index-65),e.index);if(n.test(i))return!0}}}return!1}testSchemaAt(t,e,r){if(!this.__schemas__[e.toLowerCase()])return 0;return this.__schemas__[e.toLowerCase()].validate(t.slice(0,r+this.__opts__.maxLength),r,this)}match(t){let e=[],r=this.re.get_schema_search(),s,n,i,l,a,c,u=!1,o=!1,p=!1,k=0;if(!t.length)return null;if(r.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"])s=this.re.get_fuzzy_link_search(),s.lastIndex=0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"])n=this.re.get_fuzzy_mail_host_search(),n.lastIndex=0,i=this.re.get_mail_name_validator();for(;;){let h=Math.max(k-1,0);if(n&&i&&!p&&(!a||a.index<k)){if(n.lastIndex<h)n.lastIndex=h;for(;;){let d=n.exec(t);if(!d){p=!0,a=void 0;break}let w=i.exec(t.slice(Math.max(0,d.index-65),d.index));if(!w)continue;if(a={schema:"mailto:",index:d.index-w[1].length,lastIndex:d.index+d[0].length},a.index>=k)break;if(n.lastIndex<h)n.lastIndex=h}}if(s&&!o&&(!l||l.index<k)){if(s.lastIndex<h)s.lastIndex=h;for(;;){let d=s.exec(t);if(!d){o=!0,l=void 0;break}if(l={schema:"",index:d.index+d[1].length,lastIndex:d.index+d[0].length},l.index>=k)break;if(s.lastIndex<h)s.lastIndex=h}}let x=a;if(!x||l&&(l.index<x.index||l.index===x.index&&l.lastIndex>x.lastIndex))x=l;let _;if(!u)for(;;){if(!c){if(r.lastIndex<h)r.lastIndex=h;let C=r.exec(t);if(!C){u=!0;break}c={schema:C[2],index:C.index+C[1].length,lastIndex:C.index+C[0].length}}if(c.index<k){c=void 0;continue}if(x&&c.index>x.index)break;let d=c;c=void 0;let w=this.testSchemaAt(t,d.schema,d.lastIndex);if(w){_={schema:d.schema,index:d.index,lastIndex:d.lastIndex+w};break}}let f=_;if(!f||a&&(a.index<f.index||a.index===f.index&&a.lastIndex>f.lastIndex))f=a;if(!f||l&&(l.index<f.index||l.index===f.index&&l.lastIndex>f.lastIndex))f=l;if(!f)break;if(f===a)a=void 0;else if(f===l)l=void 0;let F=new ve(t,f.schema,f.index,f.lastIndex);if(F.schema)this.__schemas__[F.schema].normalize(F,this);else this.normalize(F);e.push(F),k=f.lastIndex}if(e.length)return e;return null}matchAtStart(t){if(!t.length)return null;let e=this.re.get_schema_at_start().exec(t);if(!e)return null;let r=this.testSchemaAt(t,e[2],e[0].length);if(!r)return null;let s=new ve(t,e[2],e.index+e[1].length,e.index+e[0].length+r);return this.__schemas__[s.schema].normalize(s,this),s}tlds(t,e=!1){if(t=Array.isArray(t)?t:[t],!e)this.__opts__.tlds=t;else this.__opts__.tlds=this.__opts__.tlds.concat(t);return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(t){if(!t.schema)t.url=`http://${t.url}`;if(t.schema==="mailto:"&&!/^mailto:/i.test(t.url))t.url=`mailto:${t.url}`}};var Kt={fuzzyLink:!0};function ie(t={}){let{tlds:e,tldsKeepOld:r,schemas:s,...n}=t,i=new Pe({...Kt,...n});return Jt(i,e,r),Vt(i,s),{extensions:[{name:"autolink",level:"inline",start:(l)=>{let a=Ie(i,l);if(!a)return;return a.index},tokenizer(l){if(this.lexer.state.inLink)return;let a=Ie(i,l);if(!a)return;let c;if(a.index===0)c=a.raw;else if(a.index===1&&l.charAt(0)==="<"&&l.charAt(a.lastIndex)===">")c=`<${a.raw}>`;if(!c)return;return{type:"link",raw:c,text:a.text,href:a.url,tokens:[{type:"text",raw:a.text,text:a.text}]}}}]}}function Ie(t,e){let r=t.match(e);if(!r||!r.length)return;return r[0]}function Jt(t,e,r){if(e)t.tlds(e,r)}function Vt(t,e){if(e)for(let[r,s]of Object.entries(e))t.add(r,s)}var Yt=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,er=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,Le=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,tr={extensions:[{name:"math",level:"block",tokenizer(t){let e=Le.exec(t);if(e===null)return;return{type:"math",raw:e[0],text:(e[1]??e[2]).trim(),display:!0}}},{name:"math",level:"inline",start(t){return t.search(/\$|\\[([]/)},tokenizer(t){let e=Le.exec(t);if(e!==null)return{type:"math",raw:e[0],text:(e[1]??e[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(t);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let s=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(t);if(s===null||/^\s|\s$/.test(s[1]))return;return{type:"math",raw:s[0],text:s[1],display:!1}}}]};function Ze(){let t=new ne({gfm:!0}),e=ie(),r=e.extensions[0],s=r.tokenizer;r.tokenizer=function(n,i){let l=s.call(this,n,i);if(l===void 0)return;if(l.raw.startsWith("<"))return l;let a=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(l.raw);if(a===null)return l;let c=a[0].length-1,u=l.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return l;let o=l.raw.slice(0,c+u),p=l.href.slice(0,l.href.length-(l.raw.length-o.length));return{...l,raw:o,href:p,text:o,tokens:[{type:"text",raw:o,text:o}]}},t.use(tr,e);for(let n of["block","inline"])t.use({extensions:[{name:"internalMessage",level:n,...n==="inline"?{start(i){return Yt.exec(i)?.index}}:{},tokenizer(i){let l=er.exec(i);if(l===null)return;return{type:"internalMessage",raw:l[0]}},renderer(){return""}}]});return t}function rr(t,e){let r=Object.keys(t);return r.length===Object.keys(e).length&&r.every((s)=>{let n=e[s];return t[s].href===n?.href&&t[s].title===n.title})}function nr(t,e){let r=2,s=0;for(let i=t.length-1;i>=0;i-=1){if(t[i].type==="space")continue;if(r-=1,r===0){s=i;break}}let n=0;for(let i=0;i<s;i+=1){let l=t[i];if(l.type==="def"||/^ {0,3}(?:\[|<|\$\$|\\\[)/.test(l.raw))return n;let a=!1;if(e.walkTokens([t[i]],(c)=>{if(c.type==="html"&&(("inLink"in c)&&c.inLink||("inRawBlock"in c)&&c.inRawBlock))a=!0}),a)return n;if(/\n[\t ]*\n$/.test(t[i].raw))n=i+1}return n}function Me(t=Ze()){let e="",r=[],s={},n={};return{parse(i){let l=i.replaceAll(/\r\n|\r/g,`
|
|
66
|
+
`);if(!l.startsWith(e))e="",r=[],s={},n={};let a=new t.Lexer(t.defaults);a.tokens.links={...s};let c=a.lex(l.slice(e.length)),u=[...r,...c],o=c.links;if(r.length>0&&!rr(n,o)){let h=t.lexer(l);u=[...h],o=h.links}n=o;let p=0,k=[];for(let h of u){if(!l.startsWith(h.raw,p))break;k.push(h),p+=h.raw.length}return r=k.slice(0,nr(k,t)),e=l.slice(0,r.reduce((h,x)=>h+x.raw.length,0)),s=Object.create(null),t.walkTokens(r,(h)=>{if(h.type!=="def")return;let x=h;if(!Object.hasOwn(s,x.tag))s[x.tag]={href:x.href,title:x.title}}),structuredClone(u)}}}var le=new Map;self.onmessage=(t)=>{let e=t.data;if(e.type==="dispose"){le.delete(e.clientId);return}let{clientId:r,revision:s,source:n}=e,i;try{let l=le.get(r);if(l===void 0)l=Me(),le.set(r,l);i={clientId:r,revision:s,ok:!0,tokens:l.parse(n)}}catch(l){i={clientId:r,revision:s,ok:!1,error:l instanceof Error?l.message:String(l)}}self.postMessage(i)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$e,re}from"../chunk-9me7jmzd.js";export{$e as createChatMarkdown,re as isSafeMarkdownUrl};
|
package/dist/lib/model-name.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{oe}from"../chunk-p9wpghey.js";export{oe as formatModelName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{Ye}from"../chunk-qj8r5xvx.js";export{Ye as getPointerCenteredScrollPosition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ve}from"../chunk-src2j5cw.js";import"../chunk-0e1pdbec.js";export{Ve as preparePromptFiles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContentBlock, ToolCallStatus } from "../types
|
|
1
|
+
import type { ContentBlock, ToolCallStatus } from "../types";
|
|
2
2
|
export declare const STREAM_STYLES: readonly ["full", "compact", "codexUI"];
|
|
3
3
|
export type StreamStyle = (typeof STREAM_STYLES)[number];
|
|
4
4
|
export declare function isCodexLook(style: StreamStyle): boolean;
|
package/dist/lib/stream-style.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`)[0]??t("pattern")??t("url")??t("query")??t("description");return{category:n,...c===void 0?{}:{target:c},...o===void 0?{}:{filePath:o}}}function h(e,n){if(n)return"dot-permission";switch(e){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",e),"dot-pending"}}export{p as STREAM_STYLES,d as TOOL_CATEGORIES,f as describeToolUse,l as isCodexLook,h as toolDotClass};
|
|
1
|
+
import{Ht,et,mt,d,Ot}from"../chunk-y2xbq7rb.js";export{Ht as STREAM_STYLES,mt as TOOL_CATEGORIES,d as describeToolUse,et as isCodexLook,Ot as toolDotClass};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`);if(!
|
|
1
|
+
import{$e}from"../chunk-9me7jmzd.js";function T(e,o){let t=Object.keys(e);return t.length===Object.keys(o).length&&t.every((r)=>{let i=o[r];return e[r].href===i?.href&&e[r].title===i.title})}function b(e,o){let t=2,r=0;for(let n=e.length-1;n>=0;n-=1){if(e[n].type==="space")continue;if(t-=1,t===0){r=n;break}}let i=0;for(let n=0;n<r;n+=1){let l=e[n];if(l.type==="def"||/^ {0,3}(?:\[|<|\$\$|\\\[)/.test(l.raw))return i;let k=!1;if(o.walkTokens([e[n]],(a)=>{if(a.type==="html"&&(("inLink"in a)&&a.inLink||("inRawBlock"in a)&&a.inRawBlock))k=!0}),k)return i;if(/\n[\t ]*\n$/.test(e[n].raw))i=n+1}return i}function L(e=$e()){let o="",t=[],r={},i={};return{parse(n){let l=n.replaceAll(/\r\n|\r/g,`
|
|
2
|
+
`);if(!l.startsWith(o))o="",t=[],r={},i={};let k=new e.Lexer(e.defaults);k.tokens.links={...r};let a=k.lex(l.slice(o.length)),f=[...t,...a],u=a.links;if(t.length>0&&!T(i,u)){let s=e.lexer(l);f=[...s],u=s.links}i=u;let h=0,d=[];for(let s of f){if(!l.startsWith(s.raw,h))break;d.push(s),h+=s.raw.length}return t=d.slice(0,b(d,e)),o=l.slice(0,t.reduce((s,c)=>s+c.raw.length,0)),r=Object.create(null),e.walkTokens(t,(s)=>{if(s.type!=="def")return;let c=s;if(!Object.hasOwn(r,c.tag))r[c.tag]={href:c.href,title:c.title}}),structuredClone(f)}}}export{L as createStreamingMarkdownLexer};
|