@alwith/module-chat 0.5.9 → 0.5.11

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.
Files changed (33) hide show
  1. package/dist/{chunk-35jevrn7.js → chunk-133f0wed.js} +1 -1
  2. package/dist/{chunk-zh3qwgea.js → chunk-4nh3xzrm.js} +1 -1
  3. package/dist/chunk-5ev4qvsp.js +2 -0
  4. package/dist/{chunk-jydpra8w.js → chunk-5hsmhj1g.js} +1 -1
  5. package/dist/{chunk-0rp1nnaa.js → chunk-5w92bzgs.js} +1 -1
  6. package/dist/{chunk-f7z3a48k.js → chunk-6pmc9283.js} +1 -1
  7. package/dist/{chunk-hkcsnwc0.js → chunk-9tdzg6e6.js} +1 -1
  8. package/dist/{chunk-g5tsnsqt.js → chunk-bhze2sjv.js} +2 -2
  9. package/dist/{chunk-k6pjjtdb.js → chunk-cpk3y6ad.js} +2 -2
  10. package/dist/{chunk-0k36bfyd.js → chunk-fe3c678p.js} +1 -1
  11. package/dist/{chunk-7d41r9qk.js → chunk-mt965yn0.js} +1 -1
  12. package/dist/{chunk-syn2y1k9.js → chunk-rszktjdw.js} +2 -2
  13. package/dist/{chunk-qrvy629d.js → chunk-w6hhyjcn.js} +1 -1
  14. package/dist/{chunk-p660tatw.js → chunk-zbtas7pt.js} +1 -1
  15. package/dist/composer/completion-menu.js +1 -1
  16. package/dist/composer/prompt-input-attachments.js +1 -1
  17. package/dist/composer/prompt-input-context.js +1 -1
  18. package/dist/composer/prompt-input-textarea.js +1 -1
  19. package/dist/composer/prompt-input.js +1 -1
  20. package/dist/conversation/composer/composer.js +1 -1
  21. package/dist/conversation/composer/config-options.js +1 -1
  22. package/dist/conversation/composer/model-menu.js +1 -1
  23. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  24. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  25. package/dist/conversation/composer/slash-command-button.js +1 -1
  26. package/dist/conversation/composer/submit-button.js +1 -1
  27. package/dist/conversation/composer/usage-meter.d.ts +1 -2
  28. package/dist/conversation/composer/usage-meter.js +1 -1
  29. package/dist/conversation/conversation-view.js +1 -1
  30. package/dist/conversation/conversation.js +1 -1
  31. package/dist/lib/markdown-parser.worker.js +43 -39
  32. package/package.json +5 -5
  33. package/dist/chunk-0j0xezr5.js +0 -2
@@ -1,2 +1,2 @@
1
- import{ze}from"./chunk-k6pjjtdb.js";import{K,Zo}from"./chunk-p660tatw.js";import{t}from"./chunk-dp8pjv6r.js";import{Go}from"./chunk-7a6t282a.js";import{ye,be,we}from"./chunk-wb3zpzk3.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Vo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=ze(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(K,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ye,{children:[o(be,{render:o(Zo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(we,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Go,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
1
+ import{ze}from"./chunk-cpk3y6ad.js";import{K,Zo}from"./chunk-zbtas7pt.js";import{t}from"./chunk-dp8pjv6r.js";import{Go}from"./chunk-7a6t282a.js";import{ye,be,we}from"./chunk-wb3zpzk3.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Vo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=ze(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(K,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ye,{children:[o(be,{render:o(Zo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(we,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Go,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
2
2
  export{Vo};
@@ -1,2 +1,2 @@
1
- import{K}from"./chunk-p660tatw.js";import{t}from"./chunk-dp8pjv6r.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function Wo({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(K,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
1
+ import{K}from"./chunk-zbtas7pt.js";import{t}from"./chunk-dp8pjv6r.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function Wo({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(K,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
2
2
  export{Wo};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-dp8pjv6r.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{n}from"./chunk-ysc51tpb.js";import{x,ne}from"./chunk-bhze2sjv.js";import{hasAccount as M,isGroupedSelect as L}from"@nyssance/codex-acp-v2/client";import{cn as H}from"cn";import{useEffect as W,useState as T}from"react";import{jsx as r,jsxs as u}from"react/jsx-runtime";var m=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),F=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),z=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function f(a){return typeof a==="number"&&!Number.isNaN(a)?Math.max(0,a):0}function O(a,t){let e=Math.min(100,a/t*100),p=e>=90?"text-destructive":e>=70?"text-foreground":"text-muted-foreground";return{pct:e,className:p}}function A(a){let t=x(a.configOptions,"model");return t===void 0?void 0:ne(t)}function Oo(a,t){let e=a.windowDurationMins;if(e===null)return t("usage.usage");if(e%1440===0)return t("usage.windowDays",{count:e/1440});return t("usage.windowHours",{count:Math.round(e/60)})}function I(a){let{client:t}=n(),e=o((s)=>a&&s.connection==="ready"&&M(s.agent)),[p,l]=T(null);return W(()=>{if(!e){l(null);return}let s=!0;t.readRateLimits().then((d)=>{if(s)l(d)},()=>{return});let c=t.onRateLimits((d)=>{if(s)l(d)});return()=>{s=!1,c()}},[e,t]),e?p:null}function dt({session:a}){let{t}=n().host,e=x(a.configOptions,"model"),p=e!==void 0&&(L(e.options)?e.options.some((i)=>i.groupId==="chatgpt"&&i.options.some((y)=>y.value===e.currentValue)):!e.currentValue.startsWith("gateway:")&&e.options.some((i)=>i.value===e.currentValue)),l=I(p),{usage:s,lastTurnUsage:c}=a;if(s===null&&c===null)return null;let d=s&&s.size>0?O(s.used,s.size):null,h=7,b=2*Math.PI*h,N=f(c?.inputTokens),k=f(c?.outputTokens),g=f(c?.cachedReadTokens),w=f(c?.cachedWriteTokens),S=f(c?.totalTokens)||N+k+g+w,R=N+g,C=R>0?F.format(g/R):t("tokens.notAvailable"),D=[[t("tokens.input"),m.format(N)],[t("tokens.output"),m.format(k)],[t("tokens.cachedRead"),m.format(g)],[t("tokens.cachedWrite"),m.format(w)],[t("tokens.cacheHitRate"),C],[t("tokens.total"),m.format(S)]],v=A(a);return u(Ae,{children:[r(Le,{delay:100,closeDelay:100,render:u("button",{type:"button",className:H("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",d?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),d!==null&&r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b*(1-d.pct/100),transform:"rotate(-90 9 9)"})]}),d!==null&&u("span",{children:[Math.round(d.pct),"%"]})]})}),u(De,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[v!==void 0&&r("div",{className:"border-b px-3 py-2",children:r("p",{className:"text-foreground truncate text-xs font-semibold",title:v,children:v})}),u("div",{className:"flex flex-col gap-3 p-3",children:[c!==null&&u("div",{className:"flex flex-col gap-1.5",children:[r("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:D.map(([i,y])=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:i}),r("dd",{className:"text-end tabular-nums",children:y})]},i))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("tokens.context")}),r("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:m.format(s.used),limit:m.format(s.size),percent:z.format(s.used/s.size*100)})})]}),l!==null&&(l.primary!==null||l.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("usage.limits")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[l.primary,l.secondary].filter((i)=>i!==null).map((i)=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:Oo(i,t)}),r("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,i.usedPercent)))})})]},`${i.windowDurationMins??"window"}`))})]})]})]})]})}
2
+ export{Oo,dt};
@@ -1,4 +1,4 @@
1
- import{e}from"./chunk-6kn920c5.js";import{Q}from"./chunk-ksv9pjc2.js";import{Zt}from"./chunk-knsf6jm1.js";import{Eo}from"./chunk-294gms5s.js";import{ze}from"./chunk-k6pjjtdb.js";import{autoUpdate as rt}from"@floating-ui/dom";import{cn as X}from"cn";import{BookOpenTextIcon as st,FileIcon as it,StoreIcon as lt}from"lucide-react";import{useCallback as ut,useEffect as v,useLayoutEffect as Y,useMemo as Z,useRef as _,useState as g}from"react";import{createPortal as at}from"react-dom";import{jsx as p,jsxs as E,Fragment as ct}from"react/jsx-runtime";function Ro({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:R,onSearchError:H,fileSearchDebounceMs:M=0,bashMode:A=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:F,fileStatusLabels:h,morePlugins:D}){let j=ze(),l=j.textInput.value,[z,K]=g(0),[y,P]=g(null),[b,L]=g(0),U=_(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>K(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let V=Z(()=>A&&l.startsWith("!")?null:Eo(l,z),[l,z,A]),r=V?.kind==="at"&&!u?null:V,q=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[O,tt]=g(q);if(O!==q)tt(q),L(0);let I=_(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){P(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)P({query:x,search:u,items:s})},(s)=>{if(t)P({query:x,search:u,items:[]}),H(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,H]);let d=Z(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return Zt(C,r.query);if(i)return Zt(C,"");return[]},[r,i,C,y,u]),[et,N]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>N(!0),o=()=>{if(N(!1),i)f?.(!1)};return N(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=et&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;U.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function W(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let B=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+B+l.slice(r.end),r.kind==="at")R?.(t.payload);s=r.start+B.length}else if(i)o=`${l.length===0||l.endsWith(`
1
+ import{e}from"./chunk-6kn920c5.js";import{Q}from"./chunk-ksv9pjc2.js";import{Zt}from"./chunk-knsf6jm1.js";import{Eo}from"./chunk-294gms5s.js";import{ze}from"./chunk-cpk3y6ad.js";import{autoUpdate as rt}from"@floating-ui/dom";import{cn as X}from"cn";import{BookOpenTextIcon as st,FileIcon as it,StoreIcon as lt}from"lucide-react";import{useCallback as ut,useEffect as v,useLayoutEffect as Y,useMemo as Z,useRef as _,useState as g}from"react";import{createPortal as at}from"react-dom";import{jsx as p,jsxs as E,Fragment as ct}from"react/jsx-runtime";function Ro({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:R,onSearchError:H,fileSearchDebounceMs:M=0,bashMode:A=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:F,fileStatusLabels:h,morePlugins:D}){let j=ze(),l=j.textInput.value,[z,K]=g(0),[y,P]=g(null),[b,L]=g(0),U=_(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>K(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let V=Z(()=>A&&l.startsWith("!")?null:Eo(l,z),[l,z,A]),r=V?.kind==="at"&&!u?null:V,q=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[O,tt]=g(q);if(O!==q)tt(q),L(0);let I=_(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){P(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)P({query:x,search:u,items:s})},(s)=>{if(t)P({query:x,search:u,items:[]}),H(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,H]);let d=Z(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return Zt(C,r.query);if(i)return Zt(C,"");return[]},[r,i,C,y,u]),[et,N]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>N(!0),o=()=>{if(N(!1),i)f?.(!1)};return N(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=et&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;U.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function W(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let B=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+B+l.slice(r.end),r.kind==="at")R?.(t.payload);s=r.start+B.length}else if(i)o=`${l.length===0||l.endsWith(`
2
2
  `)?l:`${l}
3
3
  `}/${t.payload} `,s=o.length,f?.(!1);else return;j.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=(o)=>{if(!m)return;if(a.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),L((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),L((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)W(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)K(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,G]=g(null),[S,nt]=g(null),T=ut(()=>{let t=c?.current;if(!t)return;let n=t.getBoundingClientRect();G({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[c]);if(Y(()=>{if(!m){G(null);return}T()},[m,T]),Y(()=>{let t=c?.current;if(!m||!t||!S)return;return rt(t,S,T,{animationFrame:!0})},[m,S,c,T]),!m||c&&!k)return null;let w=r?r.kind==="slash":i,ot=w?st:it,J=p("div",{ref:nt,className:c?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:c&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:E("div",{ref:U,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[E("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&p("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:F}),d.length===0&&!w&&h&&p("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===u?h.empty:h.loading}),d.map((t,n)=>E(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),W(t)},onMouseEnter:()=>L(n),className:X("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[p(ot,{className:X("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")}),p("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label}),t.description&&p("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description})]},t.key))]}),w&&D&&E(ct,{children:[p(Q,{}),E(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),D.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[p(lt,{"data-icon":"inline-start"}),D.label]})]})]})});return c?at(J,document.body):J}
4
4
  export{Ro};
@@ -1,2 +1,2 @@
1
- import{x}from"./chunk-k6pjjtdb.js";import{e}from"./chunk-6kn920c5.js";import{n}from"./chunk-ysc51tpb.js";import{Fe}from"./chunk-m28hdj8j.js";import{FileText as l,RotateCcw as d,X as u}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";function Fo({data:s,sessionId:m}){let{host:a}=n(),{t:o}=a,p=x(),{text:c,status:r}=s.pastedText;return i("div",{className:"bg-muted flex max-w-64 min-w-0 items-center gap-1 rounded-lg px-2 py-1",children:[i(e,{type:"button",variant:"ghost",disabled:r!=="ready",onClick:()=>a.openLink(s.url),className:"h-auto min-w-0 flex-1 shrink gap-2 overflow-hidden px-0 py-1",children:[t(l,{className:"size-4 shrink-0"}),i("span",{className:"min-w-0 flex-1 text-start",children:[t("span",{className:"block truncate text-xs",children:s.filename}),t("span",{className:"text-muted-foreground block text-xs",children:r==="ready"?o("composer.pastedTextCharacters",{count:c.length}):o(r==="pending"?"composer.pastedTextPending":"composer.pastedTextError")})]})]}),r==="error"&&a.writeTextAttachment&&t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRetry"),onClick:()=>Fe(m,s,a.writeTextAttachment),children:t(d,{className:"size-3"})}),t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRemove"),onClick:()=>p.remove(s.id),children:t(u,{className:"size-3"})})]})}
1
+ import{y}from"./chunk-cpk3y6ad.js";import{e}from"./chunk-6kn920c5.js";import{n}from"./chunk-ysc51tpb.js";import{Fe}from"./chunk-m28hdj8j.js";import{FileText as l,RotateCcw as x,X as d}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";function Fo({data:s,sessionId:m}){let{host:a}=n(),{t:o}=a,p=y(),{text:c,status:r}=s.pastedText;return i("div",{className:"bg-muted flex max-w-64 min-w-0 items-center gap-1 rounded-lg px-2 py-1",children:[i(e,{type:"button",variant:"ghost",disabled:r!=="ready",onClick:()=>a.openLink(s.url),className:"h-auto min-w-0 flex-1 shrink gap-2 overflow-hidden px-0 py-1",children:[t(l,{className:"size-4 shrink-0"}),i("span",{className:"min-w-0 flex-1 text-start",children:[t("span",{className:"block truncate text-xs",children:s.filename}),t("span",{className:"text-muted-foreground block text-xs",children:r==="ready"?o("composer.pastedTextCharacters",{count:c.length}):o(r==="pending"?"composer.pastedTextPending":"composer.pastedTextError")})]})]}),r==="error"&&a.writeTextAttachment&&t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRetry"),onClick:()=>Fe(m,s,a.writeTextAttachment),children:t(x,{className:"size-3"})}),t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRemove"),onClick:()=>p.remove(s.id),children:t(d,{className:"size-3"})})]})}
2
2
  export{Fo};
@@ -1,2 +1,2 @@
1
- import{Bo}from"./chunk-kahn24np.js";import{n,C}from"./chunk-ysc51tpb.js";import{R,y}from"./chunk-g5tsnsqt.js";import{createLucideIcon as k,HandIcon as w,ShieldAlertIcon as S,ShieldCheckIcon as c}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var O=k("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),d={"read-only":w,"workspace-write":c,agent:O,"agent-full-access":S},b={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function mt({sessionId:u,options:g,disabled:m,onConfigChange:r}){let{host:l,client:f}=n(),{t:a}=l,o=y(g,"mode");if(!o)return null;let s=o.currentValue,p=R(o).map((e)=>{let i=b[e.value];return i?{...e,name:a(`permissionModes.${i}.name`),description:a(`permissionModes.${i}.description`)}:e}),h=p.find((e)=>e.value===s),I=d[s]??c,M=(e)=>{if(e===s)return;C(l,r?r(o.configId,e):f.setConfig(u,o.configId,e))};return t(Bo,{value:s,warning:s==="agent-full-access",currentName:h?.name??s,icon:t(I,{className:"size-3.5 shrink-0"}),header:a("permissionModes.heading"),disabled:m,label:a("composer.switchPermissionMode"),onValueChange:M,options:p.map((e)=>{let i=d[e.value]??c,v=e.value==="agent-full-access";return{value:e.value,label:t("span",{"data-permission-warning":v?"":void 0,children:e.name}),description:e.description?t("span",{className:"whitespace-normal",children:e.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}
1
+ import{Bo}from"./chunk-kahn24np.js";import{n,C}from"./chunk-ysc51tpb.js";import{R,x}from"./chunk-bhze2sjv.js";import{createLucideIcon as k,HandIcon as w,ShieldAlertIcon as y,ShieldCheckIcon as c}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var S=k("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),d={"read-only":w,"workspace-write":c,agent:S,"agent-full-access":y},O={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function mt({sessionId:u,options:g,disabled:m,onConfigChange:r}){let{host:l,client:f}=n(),{t:a}=l,o=x(g,"mode");if(!o)return null;let s=o.currentValue,p=R(o).map((e)=>{let i=O[e.value];return i?{...e,name:a(`permissionModes.${i}.name`),description:a(`permissionModes.${i}.description`)}:e}),h=p.find((e)=>e.value===s),I=d[s]??c,M=(e)=>{if(e===s)return;C(l,r?r(o.configId,e):f.setConfig(u,o.configId,e))};return t(Bo,{value:s,warning:s==="agent-full-access",currentName:h?.name??s,icon:t(I,{className:"size-3.5 shrink-0"}),header:a("permissionModes.heading"),disabled:m,label:a("composer.switchPermissionMode"),onValueChange:M,options:p.map((e)=>{let i=d[e.value]??c,v=e.value==="agent-full-access";return{value:e.value,label:t("span",{"data-permission-warning":v?"":void 0,children:e.name}),description:e.description?t("span",{className:"whitespace-normal",children:e.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}
2
2
  export{mt};
@@ -1,2 +1,2 @@
1
- import{or,x}from"./chunk-k6pjjtdb.js";import{Ro}from"./chunk-jydpra8w.js";import{oe}from"./chunk-0kwfy29d.js";import{jo,Ko,Qo,Xo,Yo,K}from"./chunk-p660tatw.js";import{No,Mo}from"./chunk-7d41r9qk.js";import{Yt}from"./chunk-syn2y1k9.js";import{t,o}from"./chunk-dp8pjv6r.js";import{n}from"./chunk-ysc51tpb.js";import{en}from"./chunk-3e0mfcj6.js";import{i,ir,E,xt}from"./chunk-20svvgj3.js";import{ut}from"./chunk-svt0t387.js";import{xe,ft}from"./chunk-m28hdj8j.js";import{yt,wt}from"./chunk-31x6chk8.js";import{ar}from"./chunk-e55zxnda.js";import{gt}from"./chunk-qrvy629d.js";import{Fo}from"./chunk-0rp1nnaa.js";import{mt}from"./chunk-f7z3a48k.js";import{pt}from"./chunk-abwjd5yv.js";import{Wo}from"./chunk-zh3qwgea.js";import{Vo}from"./chunk-35jevrn7.js";import{dt}from"./chunk-0j0xezr5.js";import{hasFuzzyFileSearch as Ft}from"@nyssance/codex-acp-v2/client";import{PlusIcon as kt}from"lucide-react";import{useCallback as S,useEffect as Dt,useLayoutEffect as X,useMemo as q,useRef as H,useState as N}from"react";import{jsx as c,jsxs as v}from"react/jsx-runtime";var Bt=["image/png","image/jpeg","image/webp","image/gif"],J=[];async function _t(e){let d=await(await fetch(e.url)).blob();return new Promise((b,G)=>{let I=new FileReader;I.onerror=()=>G(I.error),I.onload=()=>{let O=I.result;b(O.slice(O.indexOf(",")+1))},I.readAsDataURL(d)})}function Lt(e){let{t:d}=t(),b=x();return c(K,{"aria-label":d("composer.attachImage"),title:d("composer.attachImage"),onClick:()=>b.openFileDialog(),...e,children:c(kt,{className:"size-4"})})}function lt({session:e,onSubmit:d,onHandOff:b,modelSelector:G,modelMenu:I,inputHeader:O,actions:Pt,children:bt,attachmentPolicy:vt,predictions:It=!0,disabled:Ct=!1,preparing:Q=!1,allowPendingInput:Tt=!1}){let{host:F,client:T}=n(),{t:s}=F,k=S((r)=>{if(F.reportError)F.reportError(r);else console.error(r)},[F]),[Z,D]=N(()=>({text:i.get(e.id)?.text??"",revision:0})),{text:A}=Z,[w,At]=N(()=>i.get(e.id)?.attachments??J),[g,_]=N(()=>i.get(e.id)?.mentions??[]),W=w.some((r)=>xe(r)&&r.pastedText.status!=="ready"),[C,tt]=N(!1),[L,Mt]=N(!1),[Y,et]=N(!1),u=H(null),rt=H(null),a=H(Z),z=S((r)=>{rt.current?.(),a.current={text:r,revision:a.current.revision+1},D(a.current)},[]),ot=q(()=>({read:()=>{let p=u.current?.getTextarea(),h=p===null||p===void 0?[a.current.text.length,a.current.text.length]:[p.selectionStart,p.selectionEnd];return{target:e.id,...a.current,selection:h}},compareAndSet(p,h,y){if(p.target!==e.id||p.revision!==a.current.revision)return null;a.current={text:h,revision:a.current.revision+1},D(a.current);let l=u.current?.getTextarea();if(l!==null&&l!==void 0)l.value=h,l.setSelectionRange(y[0],y[1]);return{target:e.id,...a.current,selection:y}}}),[e.id]),B=H(null),nt=S((r)=>(B.current=r,()=>{if(B.current===r)B.current=null}),[]),at=e.state!=="idle",f=!Ct&&!Q&&e.attached&&!e.restoring&&!e.readOnly,M=!e.readOnly&&(Tt||f),R=pt(e,f&&!C&&!L&&!W&&!Y,A.length>0||w.length>0||g.length>0,It),it=R.invalidate;X(()=>{i.set(e.id,{text:A,attachments:w,mentions:g,modelId:i.get(e.id)?.modelId??null})},[e.id,A,w,g]),X(()=>ir(e.id,At),[e.id]),X(()=>xt(e.id,(r)=>{if(!M||C)throw Error("The composer cannot take text now; try again later");if(A.length||w.length||g.length)throw Error("The composer already has a draft; send or clear it first");z(r)}),[e.id,M,C,A,w,g,z]);let ct=o((r)=>Ft(r.agent)),Rt=q(()=>ct&&f?async(r)=>ut((await T.fuzzyFileSearch({query:r,roots:[e.cwd]})).files):void 0,[T,ct,f,e.cwd]),V=S((r)=>{_((p)=>p.includes(r)?p:[...p,r])},[]);Dt(()=>{u.current?.focus()},[]);let st=S(async({text:r,files:p})=>{let h=r.trim();if(h.length===0&&p.length===0&&g.length===0)return;let y=B.current;tt(!0);let l=i.get(e.id),Ot=a.current.revision,U=null;try{let P=[];for(let m of g){let j={kind:"file",absPath:m};P.push({type:"resource_link",uri:yt(j),name:wt(j)})}if(h.length>0)P.push({type:"text",text:h});for(let m of p)if(xe(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");P.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else P.push({type:"image",data:await _t(m),mimeType:m.mediaType});if(a.current.revision===Ot&&i.get(e.id)===l)a.current={text:"",revision:a.current.revision+1},U=a.current.revision,D(a.current),_([]),E(e.id,()=>J),i.set(e.id,{text:"",attachments:J,mentions:[],modelId:l?.modelId??null}),u.current?.resetHeight();if(d)if(y===null)await d(P);else await d(P,(m)=>{if(y.signal.aborted||B.current!==y)return;y.accept(m),b?.(e.id,m)});else if(y===null)await T.prompt(e.id,P);else{let m=await T.prompt(e.id,P);y.accept(m)}it();for(let m of l?.attachments??[])if(m.url.startsWith("blob:")&&!i.get(e.id)?.attachments.some((j)=>j.id===m.id))URL.revokeObjectURL(m.url)}catch(P){if(l&&U!==null&&a.current.revision===U&&i.get(e.id)?.attachments.length===0&&i.get(e.id)?.mentions.length===0)a.current={text:l.text,revision:U+1},D(a.current),_(l.mentions),i.set(e.id,l),E(e.id,()=>l.attachments);throw P}finally{tt(!1),u.current?.focus()}},[T,e.id,g,d,b,it]),Et=()=>{T.cancel(e.id).catch(k)},St=S((r)=>{let p=r.code==="max_total_size"?Object.assign(Error(s("composer.imageTooLargeTitle")),{description:s("composer.imageTooLargeDescription",{mb:oe})}):Object.assign(Error(s("composer.unsupportedAttachmentTitle")),{description:s("composer.unsupportedAttachmentDescription")});k(p)},[k,s]),Nt=q(()=>({session:e,ready:f,inputReady:M,sending:C,textareaRef:u,draft:ot,interruptRef:rt,observeReceipts:nt,addMention:V,setAdding:Mt,handsFree:d===void 0||b!==void 0}),[e,f,M,C,ot,nt,V,d,b]),ht=F.writeTextAttachment;return c(en,{value:Nt,children:c("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:v("div",{className:"relative",children:[O&&c("div",{"data-chat-input-header":!0,className:"bg-sidebar dark:bg-foreground/3 relative top-1 z-0 mx-[13px] -mb-[18px] flex min-w-0 items-center gap-2 overflow-hidden rounded-t-2xl px-1.5 pt-1.5 pb-[27px]",children:O}),v(or,{attachmentPolicy:vt,value:A,revision:a.current.revision,onValueChange:z,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},D(a.current)},attachments:w,onAttachmentsChange:(r)=>E(e.id,()=>r),children:[c(Ro,{handleRef:u,commands:e.commands,searchFiles:Rt,onMention:V,onSearchError:k,forcedOpen:Y,onForcedOpenChange:et,emptyLabel:s("composer.noCommands"),fileStatusLabels:{loading:s("composer.searchingFiles"),empty:s("composer.noMatchingFiles")}}),v(jo,{globalDrop:!0,multiple:!0,accept:Bt.join(","),onError:St,onSubmit:st,onSubmitAsync:st,onSubmitError:k,canSubmit:()=>f&&!C&&!L&&!W?!0:"chat_not_ready",className:"relative z-10",children:[bt,v(Qo,{className:"px-3 pt-3 pb-0 empty:hidden",children:[L&&c("span",{role:"status",className:"text-muted-foreground text-xs",children:s("composer.addingFiles")}),c(ar,{mentions:g,onRemove:(r)=>_((p)=>p.filter((h)=>h!==r))}),c(Mo,{children:(r)=>xe(r)?c(Fo,{data:r,sessionId:e.id}):c(No,{data:r,t:s})})]}),v(Ko,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(r)=>{if(!R.text||u.current?.isComposing()||r.nativeEvent.isComposing||r.nativeEvent.keyCode===229||r.shiftKey||r.ctrlKey||r.altKey||r.metaKey||r.target!==u.current?.getTextarea())return;if(r.key==="Tab")r.preventDefault(),r.stopPropagation(),z(R.text)},children:[c(Yt,{className:"min-h-10 bg-transparent text-sm font-normal",ref:u,rows:2,bashMode:!1,disabled:!M,onPasteCapture:ht?(r)=>ft(r,e.id,s("composer.pastedTextFilename"),ht):void 0,placeholder:R.text||(at?s("composer.steerPlaceholder"):s("composer.placeholder")),"aria-label":s("composer.placeholder")}),R.error&&c("span",{className:"text-muted-foreground text-xs",role:"status",title:R.error,children:s("composer.predictionUnavailable")})]}),c(Xo,{className:"chat-composer-toolbar @container/input-footer mt-0 mb-2 w-full min-w-0 p-0",children:v("div",{className:"grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-[5px] px-2",children:[v("div",{className:"flex min-w-0 items-center gap-[5px]",children:[c(Lt,{className:"text-foreground",disabled:!M}),c(Wo,{textareaRef:u,menuOpen:Y,onOpenChange:et,disabled:!f||e.commands.length===0}),c(mt,{sessionId:e.id,options:e.configOptions,disabled:!f})]}),v(Yo,{className:"w-full min-w-0 items-center justify-end gap-1",children:[c(dt,{session:e}),G??c(gt,{...I,sessionId:e.id,options:e.configOptions,disabled:!f}),Pt,c(Vo,{active:at,sending:C||Q||L,ready:f&&!W,hasMentions:g.length>0,onStop:Et})]})]})})]})]})]})})})}
1
+ import{or,y}from"./chunk-cpk3y6ad.js";import{Ro}from"./chunk-5hsmhj1g.js";import{oe}from"./chunk-0kwfy29d.js";import{jo,Ko,Qo,Xo,Yo,K}from"./chunk-zbtas7pt.js";import{No,Mo}from"./chunk-mt965yn0.js";import{Yt}from"./chunk-rszktjdw.js";import{t,o}from"./chunk-dp8pjv6r.js";import{n}from"./chunk-ysc51tpb.js";import{en}from"./chunk-3e0mfcj6.js";import{i,ir,E,xt}from"./chunk-20svvgj3.js";import{ut}from"./chunk-svt0t387.js";import{xe,ft}from"./chunk-m28hdj8j.js";import{yt,wt}from"./chunk-31x6chk8.js";import{ar}from"./chunk-e55zxnda.js";import{gt}from"./chunk-w6hhyjcn.js";import{Fo}from"./chunk-5w92bzgs.js";import{mt}from"./chunk-6pmc9283.js";import{pt}from"./chunk-abwjd5yv.js";import{Wo}from"./chunk-4nh3xzrm.js";import{Vo}from"./chunk-133f0wed.js";import{dt}from"./chunk-5ev4qvsp.js";import{hasFuzzyFileSearch as Ft}from"@nyssance/codex-acp-v2/client";import{PlusIcon as kt}from"lucide-react";import{useCallback as S,useEffect as Dt,useLayoutEffect as X,useMemo as q,useRef as H,useState as N}from"react";import{jsx as c,jsxs as v}from"react/jsx-runtime";var Bt=["image/png","image/jpeg","image/webp","image/gif"],J=[];async function _t(e){let d=await(await fetch(e.url)).blob();return new Promise((b,G)=>{let I=new FileReader;I.onerror=()=>G(I.error),I.onload=()=>{let O=I.result;b(O.slice(O.indexOf(",")+1))},I.readAsDataURL(d)})}function Lt(e){let{t:d}=t(),b=y();return c(K,{"aria-label":d("composer.attachImage"),title:d("composer.attachImage"),onClick:()=>b.openFileDialog(),...e,children:c(kt,{className:"size-4"})})}function lt({session:e,onSubmit:d,onHandOff:b,modelSelector:G,modelMenu:I,inputHeader:O,actions:Pt,children:bt,attachmentPolicy:vt,predictions:It=!0,disabled:Ct=!1,preparing:Q=!1,allowPendingInput:Tt=!1}){let{host:F,client:T}=n(),{t:s}=F,k=S((r)=>{if(F.reportError)F.reportError(r);else console.error(r)},[F]),[Z,D]=N(()=>({text:i.get(e.id)?.text??"",revision:0})),{text:A}=Z,[w,At]=N(()=>i.get(e.id)?.attachments??J),[g,_]=N(()=>i.get(e.id)?.mentions??[]),W=w.some((r)=>xe(r)&&r.pastedText.status!=="ready"),[C,tt]=N(!1),[L,Mt]=N(!1),[Y,et]=N(!1),u=H(null),rt=H(null),a=H(Z),z=S((r)=>{rt.current?.(),a.current={text:r,revision:a.current.revision+1},D(a.current)},[]),ot=q(()=>({read:()=>{let p=u.current?.getTextarea(),h=p===null||p===void 0?[a.current.text.length,a.current.text.length]:[p.selectionStart,p.selectionEnd];return{target:e.id,...a.current,selection:h}},compareAndSet(p,h,x){if(p.target!==e.id||p.revision!==a.current.revision)return null;a.current={text:h,revision:a.current.revision+1},D(a.current);let l=u.current?.getTextarea();if(l!==null&&l!==void 0)l.value=h,l.setSelectionRange(x[0],x[1]);return{target:e.id,...a.current,selection:x}}}),[e.id]),B=H(null),nt=S((r)=>(B.current=r,()=>{if(B.current===r)B.current=null}),[]),at=e.state!=="idle",f=!Ct&&!Q&&e.attached&&!e.restoring&&!e.readOnly,M=!e.readOnly&&(Tt||f),R=pt(e,f&&!C&&!L&&!W&&!Y,A.length>0||w.length>0||g.length>0,It),it=R.invalidate;X(()=>{i.set(e.id,{text:A,attachments:w,mentions:g,modelId:i.get(e.id)?.modelId??null})},[e.id,A,w,g]),X(()=>ir(e.id,At),[e.id]),X(()=>xt(e.id,(r)=>{if(!M||C)throw Error("The composer cannot take text now; try again later");if(A.length||w.length||g.length)throw Error("The composer already has a draft; send or clear it first");z(r)}),[e.id,M,C,A,w,g,z]);let ct=o((r)=>Ft(r.agent)),Rt=q(()=>ct&&f?async(r)=>ut((await T.fuzzyFileSearch({query:r,roots:[e.cwd]})).files):void 0,[T,ct,f,e.cwd]),V=S((r)=>{_((p)=>p.includes(r)?p:[...p,r])},[]);Dt(()=>{u.current?.focus()},[]);let st=S(async({text:r,files:p})=>{let h=r.trim();if(h.length===0&&p.length===0&&g.length===0)return;let x=B.current;tt(!0);let l=i.get(e.id),Ot=a.current.revision,U=null;try{let P=[];for(let m of g){let j={kind:"file",absPath:m};P.push({type:"resource_link",uri:yt(j),name:wt(j)})}if(h.length>0)P.push({type:"text",text:h});for(let m of p)if(xe(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");P.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else P.push({type:"image",data:await _t(m),mimeType:m.mediaType});if(a.current.revision===Ot&&i.get(e.id)===l)a.current={text:"",revision:a.current.revision+1},U=a.current.revision,D(a.current),_([]),E(e.id,()=>J),i.set(e.id,{text:"",attachments:J,mentions:[],modelId:l?.modelId??null}),u.current?.resetHeight();if(d)if(x===null)await d(P);else await d(P,(m)=>{if(x.signal.aborted||B.current!==x)return;x.accept(m),b?.(e.id,m)});else if(x===null)await T.prompt(e.id,P);else{let m=await T.prompt(e.id,P);x.accept(m)}it();for(let m of l?.attachments??[])if(m.url.startsWith("blob:")&&!i.get(e.id)?.attachments.some((j)=>j.id===m.id))URL.revokeObjectURL(m.url)}catch(P){if(l&&U!==null&&a.current.revision===U&&i.get(e.id)?.attachments.length===0&&i.get(e.id)?.mentions.length===0)a.current={text:l.text,revision:U+1},D(a.current),_(l.mentions),i.set(e.id,l),E(e.id,()=>l.attachments);throw P}finally{tt(!1),u.current?.focus()}},[T,e.id,g,d,b,it]),Et=()=>{T.cancel(e.id).catch(k)},St=S((r)=>{let p=r.code==="max_total_size"?Object.assign(Error(s("composer.imageTooLargeTitle")),{description:s("composer.imageTooLargeDescription",{mb:oe})}):Object.assign(Error(s("composer.unsupportedAttachmentTitle")),{description:s("composer.unsupportedAttachmentDescription")});k(p)},[k,s]),Nt=q(()=>({session:e,ready:f,inputReady:M,sending:C,textareaRef:u,draft:ot,interruptRef:rt,observeReceipts:nt,addMention:V,setAdding:Mt,handsFree:d===void 0||b!==void 0}),[e,f,M,C,ot,nt,V,d,b]),ht=F.writeTextAttachment;return c(en,{value:Nt,children:c("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:v("div",{className:"relative",children:[O&&c("div",{"data-chat-input-header":!0,className:"bg-sidebar dark:bg-foreground/3 relative top-1 z-0 mx-[13px] -mb-[18px] flex min-w-0 items-center gap-2 overflow-hidden rounded-t-2xl px-1.5 pt-1.5 pb-[27px]",children:O}),v(or,{attachmentPolicy:vt,value:A,revision:a.current.revision,onValueChange:z,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},D(a.current)},attachments:w,onAttachmentsChange:(r)=>E(e.id,()=>r),children:[c(Ro,{handleRef:u,commands:e.commands,searchFiles:Rt,onMention:V,onSearchError:k,forcedOpen:Y,onForcedOpenChange:et,emptyLabel:s("composer.noCommands"),fileStatusLabels:{loading:s("composer.searchingFiles"),empty:s("composer.noMatchingFiles")}}),v(jo,{globalDrop:!0,multiple:!0,accept:Bt.join(","),onError:St,onSubmit:st,onSubmitAsync:st,onSubmitError:k,canSubmit:()=>f&&!C&&!L&&!W?!0:"chat_not_ready",className:"relative z-10",children:[bt,v(Qo,{className:"px-3 pt-3 pb-0 empty:hidden",children:[L&&c("span",{role:"status",className:"text-muted-foreground text-xs",children:s("composer.addingFiles")}),c(ar,{mentions:g,onRemove:(r)=>_((p)=>p.filter((h)=>h!==r))}),c(Mo,{children:(r)=>xe(r)?c(Fo,{data:r,sessionId:e.id}):c(No,{data:r,t:s})})]}),v(Ko,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(r)=>{if(!R.text||u.current?.isComposing()||r.nativeEvent.isComposing||r.nativeEvent.keyCode===229||r.shiftKey||r.ctrlKey||r.altKey||r.metaKey||r.target!==u.current?.getTextarea())return;if(r.key==="Tab")r.preventDefault(),r.stopPropagation(),z(R.text)},children:[c(Yt,{className:"min-h-10 bg-transparent text-sm font-normal",ref:u,rows:2,bashMode:!1,disabled:!M,onPasteCapture:ht?(r)=>ft(r,e.id,s("composer.pastedTextFilename"),ht):void 0,placeholder:R.text||(at?s("composer.steerPlaceholder"):s("composer.placeholder")),"aria-label":s("composer.placeholder")}),R.error&&c("span",{className:"text-muted-foreground text-xs",role:"status",title:R.error,children:s("composer.predictionUnavailable")})]}),c(Xo,{className:"chat-composer-toolbar @container/input-footer mt-0 mb-2 w-full min-w-0 p-0",children:v("div",{className:"grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-[5px] px-2",children:[v("div",{className:"flex min-w-0 items-center gap-[5px]",children:[c(Lt,{className:"text-foreground",disabled:!M}),c(Wo,{textareaRef:u,menuOpen:Y,onOpenChange:et,disabled:!f||e.commands.length===0}),c(mt,{sessionId:e.id,options:e.configOptions,disabled:!f})]}),v(Yo,{className:"w-full min-w-0 items-center justify-end gap-1",children:[c(dt,{session:e}),G??c(gt,{...I,sessionId:e.id,options:e.configOptions,disabled:!f}),Pt,c(Vo,{active:at,sending:C||Q||L,ready:f&&!W,hasMentions:g.length>0,onStop:Et})]})]})})]})]})]})})})}
2
2
  export{lt};
@@ -1,2 +1,2 @@
1
- import{isGroupedSelect as i,isSelectOption as o}from"@nyssance/codex-acp-v2/client";function R(e){return i(e.options)?e.options.flatMap((t)=>t.options):e.options}function y(e,t){return e.find((n)=>n.category===t&&o(n))}function ne(e){return R(e).find((t)=>t.value===e.currentValue)?.name??e.currentValue}
2
- export{R,y,ne};
1
+ import{isGroupedSelect as i,isSelectOption as o}from"@nyssance/codex-acp-v2/client";function R(e){return i(e.options)?e.options.flatMap((t)=>t.options):e.options}function x(e,t){return e.find((n)=>n.category===t&&o(n))}function ne(e){return R(e).find((t)=>t.value===e.currentValue)?.name??e.currentValue}
2
+ export{R,x,ne};
@@ -1,2 +1,2 @@
1
- import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as g,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var F=d(null),sn=d(null);function Si(){return i(sn)}var ln=d(null);function Ii(){return i(ln)}var Be=d(null);function ze(){let r=i(F);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var Ue=()=>i(F);function Pi(){let r=i(Be);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(Be);function or({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:A,attachmentPolicy:f,value:R,onValueChange:y,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=R!==void 0,[G,J]=z(r),p=R??G,o=g({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)y?.(t);else J(t)},[T,y]),h=n(()=>P(""),[P]),v=U!==void 0,[K,N]=z([]),I=U??K,b=g(I);b.current=I;let s=n((t)=>{let e=typeof t==="function"?t(b.current):t;if(v)L?.(e);else N(e)},[v,L]),j=g(null),w=g(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),A?.()},[A,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(v)return;return()=>{for(let t of b.current)if(t.url)URL.revokeObjectURL(t.url)}},[v]);let k=n(()=>{w.current?.()},[]),C=q(()=>({files:I,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[I,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:h,getRevision:W,clearSubmitted:c??h},attachments:C,__registerFileInput:H}),[p,P,h,W,c,C,H]);return D(F.Provider,{value:Q,children:D(Be.Provider,{value:C,children:B})})}var cn=d(null);function x(){let r=X(),l=i(cn),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
- export{sn,Si,ln,Ii,Be,ze,Ue,Pi,or,cn,x};
1
+ import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as I,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var C=d(null),sn=d(null);function Si(){return i(sn)}var ln=d(null);function Ii(){return i(ln)}var Be=d(null);function ze(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var Ue=()=>i(C);function Pi(){let r=i(Be);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(Be);function or({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:F,attachmentPolicy:f,value:A,onValueChange:R,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=A!==void 0,[G,J]=z(r),p=A??G,o=I({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)R?.(t);else J(t)},[T,R]),g=n(()=>P(""),[P]),x=U!==void 0,[K,N]=z([]),v=U??K,h=I(v);h.current=v;let s=n((t)=>{let e=typeof t==="function"?t(h.current):t;if(x)L?.(e);else N(e)},[x,L]),j=I(null),w=I(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),F?.()},[F,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(x)return;return()=>{for(let t of h.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let k=n(()=>{w.current?.()},[]),b=q(()=>({files:v,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[v,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:g,getRevision:W,clearSubmitted:c??g},attachments:b,__registerFileInput:H}),[p,P,g,W,c,b,H]);return D(C.Provider,{value:Q,children:D(Be.Provider,{value:b,children:B})})}var cn=d(null);function y(){let r=X(),l=i(cn),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
+ export{sn,Si,ln,Ii,Be,ze,Ue,Pi,or,cn,y};
@@ -1,2 +1,2 @@
1
- import{o}from"./chunk-dp8pjv6r.js";import{q,Et,V}from"./chunk-cke0v0a7.js";import{e}from"./chunk-6kn920c5.js";import{ge,fe,he,ve}from"./chunk-magaaqab.js";import{ht,n,C}from"./chunk-ysc51tpb.js";import{lt}from"./chunk-hkcsnwc0.js";import{st}from"./chunk-64whvkk0.js";import{nt,ot}from"./chunk-gj3j9zh5.js";import{rt}from"./chunk-y3qgsj79.js";import{LockIcon as g,UnplugIcon as A}from"lucide-react";import{useMemo as R}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function gr({host:t,client:l,...c}){let s=R(()=>t.openDiff?t:{...t,openDiff:nt},[t]);return i(ht,{host:s,client:l,children:[r(E,{...c}),!t.openDiff&&r(ot,{})]})}function E({session:t,header:l,overlay:c,timeline:s,composer:y,readOnlyActions:x,welcome:u,children:N,rootRef:w}){let{host:d,client:h}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>C(d,h.open(t.id,t.cwd)),D=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:w,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[c,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(q,{children:[r(A,{}),r(Et,{children:a("conversation.stopped")}),r(V,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),D?u??r(ge,{className:"flex-1",children:i(fe,{children:[r(he,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ve,{children:a("conversation.welcomeDescription")})]})}):r(st,{session:t,timeline:s}),r(rt,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(q,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(g,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r(Et,{children:a("conversation.readOnlyTitle")}),r(V,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(lt,{session:t})]}),N]})}
1
+ import{o}from"./chunk-dp8pjv6r.js";import{q,Et,V}from"./chunk-cke0v0a7.js";import{e}from"./chunk-6kn920c5.js";import{ge,fe,he,ve}from"./chunk-magaaqab.js";import{ht,n,C}from"./chunk-ysc51tpb.js";import{lt}from"./chunk-9tdzg6e6.js";import{st}from"./chunk-64whvkk0.js";import{nt,ot}from"./chunk-gj3j9zh5.js";import{rt}from"./chunk-y3qgsj79.js";import{LockIcon as g,UnplugIcon as A}from"lucide-react";import{useMemo as R}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function gr({host:t,client:l,...c}){let s=R(()=>t.openDiff?t:{...t,openDiff:nt},[t]);return i(ht,{host:s,client:l,children:[r(E,{...c}),!t.openDiff&&r(ot,{})]})}function E({session:t,header:l,overlay:c,timeline:s,composer:y,readOnlyActions:x,welcome:u,children:N,rootRef:w}){let{host:d,client:h}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>C(d,h.open(t.id,t.cwd)),D=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:w,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[c,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(q,{children:[r(A,{}),r(Et,{children:a("conversation.stopped")}),r(V,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),D?u??r(ge,{className:"flex-1",children:i(fe,{children:[r(he,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ve,{children:a("conversation.welcomeDescription")})]})}):r(st,{session:t,timeline:s}),r(rt,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(q,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(g,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r(Et,{children:a("conversation.readOnlyTitle")}),r(V,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(lt,{session:t})]}),N]})}
2
2
  export{gr};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-6kn920c5.js";import{Do}from"./chunk-sex6d2c2.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{x}from"./chunk-k6pjjtdb.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(De,{align:"start",...n})}function No({data:n,t:r,className:u,...c}){let p=x(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),y=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),o(R,{children:[o(Ae,{children:[t(Le,{render:o("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),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?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:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):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(k,{className:"size-3"})}),o(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(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("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:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(Do,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function Mo({children:n,className:r,...u}){let c=x();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
1
+ import{e}from"./chunk-6kn920c5.js";import{Do}from"./chunk-sex6d2c2.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{y}from"./chunk-cpk3y6ad.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(De,{align:"start",...n})}function No({data:n,t:r,className:u,...c}){let p=y(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),x=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",x,{passive:!1}),()=>window.removeEventListener("keydown",x)},[d]),o(R,{children:[o(Ae,{children:[t(Le,{render:o("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),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?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:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):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(k,{className:"size-3"})}),o(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(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("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:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(Do,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function Mo({children:n,className:r,...u}){let c=y();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
2
2
  export{No,Mo};
@@ -1,4 +1,4 @@
1
- import{an}from"./chunk-qpc4ca5y.js";import{Ao,Lo,ct}from"./chunk-96xwaa2t.js";import{Ue,x}from"./chunk-k6pjjtdb.js";import{cn as w}from"cn";import{forwardRef as A,useCallback as D,useEffect as M,useImperativeHandle as K,useRef as f}from"react";import{jsx as F}from"react/jsx-runtime";var L=(i)=>!i.shiftKey,R=()=>!1,Yt=A(({onChange:i,onCompositionStart:g,onCompositionEnd:v,className:T,placeholder:y,bashMode:b=!1,isSendShortcut:E=L,isNewlineShortcut:I=R,...C},H)=>{let n=Ue(),l=x(),o=f(!1),u=f(!1),r=f(null),s=D(()=>{let e=r.current;if(!e||o.current)return;e.style.height="auto",e.style.height=`${e.scrollHeight}px`},[]);M(()=>{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("!"),P=(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!==`
1
+ import{an}from"./chunk-qpc4ca5y.js";import{Ao,Lo,ct}from"./chunk-96xwaa2t.js";import{Ue,y}from"./chunk-cpk3y6ad.js";import{cn as w}from"cn";import{forwardRef as A,useCallback as D,useEffect as M,useImperativeHandle as K,useRef as f}from"react";import{jsx as F}from"react/jsx-runtime";var L=(i)=>!i.shiftKey,R=()=>!1,Yt=A(({onChange:i,onCompositionStart:g,onCompositionEnd:v,className:x,placeholder:T,bashMode:b=!1,isSendShortcut:E=L,isNewlineShortcut:I=R,...C},H)=>{let n=Ue(),l=y(),o=f(!1),u=f(!1),r=f(null),s=D(()=>{let e=r.current;if(!e||o.current)return;e.style.height="auto",e.style.height=`${e.scrollHeight}px`},[]);M(()=>{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("!"),P=(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
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:m,value:p}=t,d=`${p.slice(0,a)}
3
- ${p.slice(m)}`;if(n)n.textInput.setInput(d);else t.value=d;let h=a+1;t.setSelectionRange(h,h),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)}},S=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:a,sawNonImageFile:m}=Ao(t),p=Lo(t);if(a.length>0)e.preventDefault(),l.add(a);else if(m&&!p)e.preventDefault()},k=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:ct(e.currentTarget);n.textInput.setInput(c?`!${t}`:t),s(),i?.(e)}}:{onChange:(e)=>{if(!o.current)ct(e.currentTarget);s(),i?.(e)}};return K(H,()=>({resetHeight:()=>{if(r.current)r.current.style.height="auto"},focus:()=>{r.current?.focus()},isComposing:()=>o.current||u.current,getTextarea:()=>r.current}),[]),F(an,{"data-chat-input":!0,ref:r,rows:3,className:w("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=ct(e.currentTarget);n?.textInput.setInput(c?`!${t}`:t),s(),v?.(e),u.current=!0,requestAnimationFrame(()=>{u.current=!1})},onCompositionStart:(e)=>{u.current=!1,o.current=!0,g?.(e)},onKeyDown:P,onPaste:S,placeholder:y,...C,...k})});Yt.displayName="PromptInputTextarea";
3
+ ${p.slice(m)}`;if(n)n.textInput.setInput(d);else t.value=d;let h=a+1;t.setSelectionRange(h,h),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)}},S=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:a,sawNonImageFile:m}=Ao(t),p=Lo(t);if(a.length>0)e.preventDefault(),l.add(a);else if(m&&!p)e.preventDefault()},k=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:ct(e.currentTarget);n.textInput.setInput(c?`!${t}`:t),s(),i?.(e)}}:{onChange:(e)=>{if(!o.current)ct(e.currentTarget);s(),i?.(e)}};return K(H,()=>({resetHeight:()=>{if(r.current)r.current.style.height="auto"},focus:()=>{r.current?.focus()},isComposing:()=>o.current||u.current,getTextarea:()=>r.current}),[]),F(an,{"data-chat-input":!0,ref:r,rows:3,className:w("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",x),name:"message",onCompositionEnd:(e)=>{o.current=!1;let t=ct(e.currentTarget);n?.textInput.setInput(c?`!${t}`:t),s(),v?.(e),u.current=!0,requestAnimationFrame(()=>{u.current=!1})},onCompositionStart:(e)=>{u.current=!1,o.current=!0,g?.(e)},onKeyDown:P,onPaste:S,placeholder:T,...C,...k})});Yt.displayName="PromptInputTextarea";
4
4
  export{Yt};
@@ -1,2 +1,2 @@
1
- import{zo}from"./chunk-zt8qaqbz.js";import{o}from"./chunk-dp8pjv6r.js";import{n,C}from"./chunk-ysc51tpb.js";import{R,y,ne}from"./chunk-g5tsnsqt.js";import{isBooleanOption as E,isGroupedSelect as U,isSelectOption as q}from"@nyssance/codex-acp-v2/client";import{Zap as A}from"lucide-react";import{jsx as w}from"react/jsx-runtime";function gt({sessionId:p,options:f,disabled:I,onModelChange:g,onConfigChange:M,defaultGroup:B={id:"models",name:"Models"},catalog:G=(s)=>s,headerAction:x}){let{host:s,client:L}=n(),{t:r}=s,h=o((e)=>Boolean(e.configPending[p])),N=o((e)=>{let a=e.sessions[p];return a?.state==="running"||a?.state==="requires_action"}),t=y(f,"model"),l=y(f,"thought_level"),b=f.filter((e)=>e.configId!=="collaboration_mode"&&(e.category==="model_config"||e.category!=="mode"&&e!==t&&e!==l)),O=b.filter(q),d=b.filter(E);if(!t&&!l&&O.length===0&&d.length===0)return null;let c=(e,a)=>{if(a===e.currentValue)return;C(s,M?M(e.configId,a):L.setConfig(p,e.configId,a))},m=l?R(l):[],k=m.reduce((e,a)=>a.name.length>=e.length?a.name:e,""),z=t?ne(t):r("composer.model"),_=(e)=>({api_id:e.value,label:e.name}),v=G(t&&U(t.options)?t.options.map((e)=>({id:e.groupId,name:e.name,models:e.options.map(_)})):[{...B,models:t?R(t).map(_):[]}]),S=v.flatMap((e)=>e.models),u=S.find((e)=>e.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:z},i=d.find((e)=>e.configId==="fast-mode");return w(zo,{disabled:I||h||N,switching:h,value:{...u,label:u.shortLabel??u.label},compactCatalog:!0,models:S,showModelList:Boolean(t),onChange:(e)=>{if(e.api_id===t?.currentValue)return;if(g)g(e.api_id);else if(t)c(t,e.api_id)},header:{name:t?.name??r("composer.model"),action:x},modelGroups:v,t:r,effortConfig:l&&m.length>0?{name:"Effort",value:l.currentValue,levels:m,sizer:k,onChange:(e)=>c(l,e)}:void 0,selectOptions:O.map((e)=>({id:e.configId,name:e.name,value:e.currentValue,options:R(e).map((a)=>({value:a.value,label:a.name})),onChange:(a)=>c(e,a)})),booleanOptions:[{id:"fast_mode",name:r("composer.fastMode"),currentValue:i?.currentValue??!1,disabled:!i,title:!i?r("composer.fastModeUnsupported"):void 0,icon:w(A,{className:"size-4","aria-hidden":"true"})},...d.filter((e)=>e!==i).map((e)=>({id:e.configId,name:e.name,currentValue:e.currentValue}))],onBooleanChange:(e,a)=>{let V=e==="fast_mode"?i:d.find((P)=>P.configId===e);if(!V)throw Error(`Unknown boolean config: ${e}`);c(V,a)}})}
1
+ import{zo}from"./chunk-zt8qaqbz.js";import{o}from"./chunk-dp8pjv6r.js";import{n,C}from"./chunk-ysc51tpb.js";import{R,x,ne}from"./chunk-bhze2sjv.js";import{isBooleanOption as E,isGroupedSelect as U,isSelectOption as q}from"@nyssance/codex-acp-v2/client";import{Zap as A}from"lucide-react";import{jsx as y}from"react/jsx-runtime";function gt({sessionId:p,options:f,disabled:w,onModelChange:g,onConfigChange:M,defaultGroup:I={id:"models",name:"Models"},catalog:B=(s)=>s,headerAction:G}){let{host:s,client:L}=n(),{t:r}=s,h=o((e)=>Boolean(e.configPending[p])),N=o((e)=>{let a=e.sessions[p];return a?.state==="running"||a?.state==="requires_action"}),t=x(f,"model"),l=x(f,"thought_level"),b=f.filter((e)=>e.configId!=="collaboration_mode"&&(e.category==="model_config"||e.category!=="mode"&&e!==t&&e!==l)),O=b.filter(q),d=b.filter(E);if(!t&&!l&&O.length===0&&d.length===0)return null;let c=(e,a)=>{if(a===e.currentValue)return;C(s,M?M(e.configId,a):L.setConfig(p,e.configId,a))},m=l?R(l):[],k=m.reduce((e,a)=>a.name.length>=e.length?a.name:e,""),z=t?ne(t):r("composer.model"),_=(e)=>({api_id:e.value,label:e.name}),v=B(t&&U(t.options)?t.options.map((e)=>({id:e.groupId,name:e.name,models:e.options.map(_)})):[{...I,models:t?R(t).map(_):[]}]),S=v.flatMap((e)=>e.models),u=S.find((e)=>e.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:z},i=d.find((e)=>e.configId==="fast-mode");return y(zo,{disabled:w||h||N,switching:h,value:{...u,label:u.shortLabel??u.label},compactCatalog:!0,models:S,showModelList:Boolean(t),onChange:(e)=>{if(e.api_id===t?.currentValue)return;if(g)g(e.api_id);else if(t)c(t,e.api_id)},header:{name:t?.name??r("composer.model"),action:G},modelGroups:v,t:r,effortConfig:l&&m.length>0?{name:"Effort",value:l.currentValue,levels:m,sizer:k,onChange:(e)=>c(l,e)}:void 0,selectOptions:O.map((e)=>({id:e.configId,name:e.name,value:e.currentValue,options:R(e).map((a)=>({value:a.value,label:a.name})),onChange:(a)=>c(e,a)})),booleanOptions:[{id:"fast_mode",name:r("composer.fastMode"),currentValue:i?.currentValue??!1,disabled:!i,title:!i?r("composer.fastModeUnsupported"):void 0,icon:y(A,{className:"size-4","aria-hidden":"true"})},...d.filter((e)=>e!==i).map((e)=>({id:e.configId,name:e.name,currentValue:e.currentValue}))],onBooleanChange:(e,a)=>{let V=e==="fast_mode"?i:d.find((P)=>P.configId===e);if(!V)throw Error(`Unknown boolean config: ${e}`);c(V,a)}})}
2
2
  export{gt};
@@ -1,2 +1,2 @@
1
- import{Jo,oe}from"./chunk-0kwfy29d.js";import{er}from"./chunk-6amcjhqh.js";import{nr,on,rn}from"./chunk-7h8pv9eg.js";import{sn,ln,Be,Ue,cn}from"./chunk-k6pjjtdb.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Y,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function Z(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var jo=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:ee,globalDrop:C,syncHiddenInput:R,maxFiles:z,maxFileSize:H,onError:b,onSubmit:te,children:re,...ne})=>{let s=Ue(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),k=M(!1),[ie,D]=Pe([]),c=l?s.attachments.files:ie,U=M(c);U.current=c;let ae=h(()=>{x.current?.click()},[]),B=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]),O=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""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>B(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>H?i.size<=H:!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}D((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=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 Q=[];for(let T of _){let V=I?.sourcePath(T);Q.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:O(T),filename:T.name,size:T.size,lastModified:T.lastModified,...V===void 0?{}:{sourcePath:V}})}return[...i,...Q]})},[I,O,B,z,H,b]),le=h((e)=>D((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>D((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),W=l?s.attachments.add:ue,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,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(Jo(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${oe}MB.`});return}}W(r)},[c,W,b]),G=l?s.attachments.remove:le,N=l?s.attachments.clear:pe,j=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(R&&x.current&&c.length===0)x.current.value=""},[c,R]),F(()=>{let e=A.current;if(!e)return;if(C)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,C]),F(()=>{if(!C)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,C]),F(()=>()=>{if(!l){for(let e of U.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},q=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:G,clear:N,openFileDialog:j,fileInputRef:x}),[c,L,G,N,j]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let X=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(k.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:Z(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)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(Z(t)===n)t.reset();N()};k.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await er(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.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 te({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{k.current=!1}},ce=(e)=>{e.preventDefault(),X(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),J=a(ln.Provider,{value:()=>X(null),children:ye(sn.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:ee,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...ne,children:a(nr,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"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:re})})]})});return l?a(Be.Provider,{value:q,children:J}):a(cn.Provider,{value:q,children:J})};function Ko({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Qo({className:u,...o}){return a(on,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function Xo({className:u,...o}){return a(on,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Yo({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var K=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Y.count(y.children)<=1?"icon-xs":"xs";return a(rn,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Y.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Zo=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(rn,{"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:o,...f,children:y??g})};
1
+ import{Jo,oe}from"./chunk-0kwfy29d.js";import{er}from"./chunk-6amcjhqh.js";import{nr,on,rn}from"./chunk-7h8pv9eg.js";import{sn,ln,Be,Ue,cn}from"./chunk-cpk3y6ad.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Y,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function Z(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var jo=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:ee,globalDrop:C,syncHiddenInput:R,maxFiles:z,maxFileSize:H,onError:b,onSubmit:te,children:re,...ne})=>{let s=Ue(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),k=M(!1),[ie,D]=Pe([]),c=l?s.attachments.files:ie,U=M(c);U.current=c;let ae=h(()=>{x.current?.click()},[]),B=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]),O=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""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>B(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>H?i.size<=H:!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}D((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=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 Q=[];for(let T of _){let V=I?.sourcePath(T);Q.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:O(T),filename:T.name,size:T.size,lastModified:T.lastModified,...V===void 0?{}:{sourcePath:V}})}return[...i,...Q]})},[I,O,B,z,H,b]),le=h((e)=>D((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>D((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),W=l?s.attachments.add:ue,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,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(Jo(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${oe}MB.`});return}}W(r)},[c,W,b]),G=l?s.attachments.remove:le,N=l?s.attachments.clear:pe,j=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(R&&x.current&&c.length===0)x.current.value=""},[c,R]),F(()=>{let e=A.current;if(!e)return;if(C)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,C]),F(()=>{if(!C)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,C]),F(()=>()=>{if(!l){for(let e of U.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},q=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:G,clear:N,openFileDialog:j,fileInputRef:x}),[c,L,G,N,j]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let X=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(k.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:Z(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)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(Z(t)===n)t.reset();N()};k.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await er(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.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 te({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{k.current=!1}},ce=(e)=>{e.preventDefault(),X(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),J=a(ln.Provider,{value:()=>X(null),children:ye(sn.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:ee,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...ne,children:a(nr,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"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:re})})]})});return l?a(Be.Provider,{value:q,children:J}):a(cn.Provider,{value:q,children:J})};function Ko({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Qo({className:u,...o}){return a(on,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function Xo({className:u,...o}){return a(on,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Yo({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var K=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Y.count(y.children)<=1?"icon-xs":"xs";return a(rn,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Y.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Zo=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(rn,{"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:o,...f,children:y??g})};
2
2
  export{jo,Ko,Qo,Xo,Yo,K,Zo};
@@ -1 +1 @@
1
- import{Ro}from"../chunk-jydpra8w.js";import"../chunk-knsf6jm1.js";import"../chunk-294gms5s.js";import"../chunk-gzff19t3.js";import"../chunk-k6pjjtdb.js";import"../chunk-ksv9pjc2.js";import"../chunk-6kn920c5.js";export{Ro as CompletionMenu};
1
+ import{Ro}from"../chunk-5hsmhj1g.js";import"../chunk-knsf6jm1.js";import"../chunk-294gms5s.js";import"../chunk-gzff19t3.js";import"../chunk-cpk3y6ad.js";import"../chunk-ksv9pjc2.js";import"../chunk-6kn920c5.js";export{Ro as CompletionMenu};
@@ -1 +1 @@
1
- import{No,Mo}from"../chunk-7d41r9qk.js";import"../chunk-sex6d2c2.js";import"../chunk-t3ew92b3.js";import"../chunk-b65vdzz3.js";import"../chunk-k6pjjtdb.js";import"../chunk-17zegmxa.js";import"../chunk-6kn920c5.js";export{No as PromptInputAttachment,Mo as PromptInputAttachments};
1
+ import{No,Mo}from"../chunk-mt965yn0.js";import"../chunk-sex6d2c2.js";import"../chunk-t3ew92b3.js";import"../chunk-b65vdzz3.js";import"../chunk-cpk3y6ad.js";import"../chunk-17zegmxa.js";import"../chunk-6kn920c5.js";export{No as PromptInputAttachment,Mo as PromptInputAttachments};
@@ -1 +1 @@
1
- import{sn,Si,ln,Ii,Be,ze,Ue,Pi,or,cn,x}from"../chunk-k6pjjtdb.js";export{cn as LocalAttachmentsContext,or as PromptInputProvider,ln as PromptInputSubmissionContext,sn as PromptInputSubmitContext,Be as ProviderAttachmentsContext,Ue as useOptionalPromptInputController,x as usePromptInputAttachments,ze as usePromptInputController,Ii as usePromptInputSubmission,Si as usePromptInputSubmit,Pi as useProviderAttachments};
1
+ import{sn,Si,ln,Ii,Be,ze,Ue,Pi,or,cn,y}from"../chunk-cpk3y6ad.js";export{cn as LocalAttachmentsContext,or as PromptInputProvider,ln as PromptInputSubmissionContext,sn as PromptInputSubmitContext,Be as ProviderAttachmentsContext,Ue as useOptionalPromptInputController,y as usePromptInputAttachments,ze as usePromptInputController,Ii as usePromptInputSubmission,Si as usePromptInputSubmit,Pi as useProviderAttachments};
@@ -1 +1 @@
1
- import{Yt}from"../chunk-syn2y1k9.js";import"../chunk-96xwaa2t.js";import"../chunk-qpc4ca5y.js";import"../chunk-k6pjjtdb.js";import"../chunk-ncekagm6.js";export{Yt as PromptInputTextarea};
1
+ import{Yt}from"../chunk-rszktjdw.js";import"../chunk-96xwaa2t.js";import"../chunk-qpc4ca5y.js";import"../chunk-cpk3y6ad.js";import"../chunk-ncekagm6.js";export{Yt as PromptInputTextarea};
@@ -1 +1 @@
1
- import{jo,Ko,Qo,Xo,Yo,K,Zo}from"../chunk-p660tatw.js";import{oe}from"../chunk-0kwfy29d.js";import"../chunk-6amcjhqh.js";import"../chunk-tv89wh8b.js";import"../chunk-7h8pv9eg.js";import"../chunk-qpc4ca5y.js";import"../chunk-k6pjjtdb.js";import"../chunk-ncekagm6.js";import"../chunk-6kn920c5.js";export{oe as MAX_TOTAL_IMAGE_MB,jo as PromptInput,Ko as PromptInputBody,K as PromptInputButton,Xo as PromptInputFooter,Qo as PromptInputHeader,Zo as PromptInputSubmit,Yo as PromptInputTools};
1
+ import{jo,Ko,Qo,Xo,Yo,K,Zo}from"../chunk-zbtas7pt.js";import{oe}from"../chunk-0kwfy29d.js";import"../chunk-6amcjhqh.js";import"../chunk-tv89wh8b.js";import"../chunk-7h8pv9eg.js";import"../chunk-qpc4ca5y.js";import"../chunk-cpk3y6ad.js";import"../chunk-ncekagm6.js";import"../chunk-6kn920c5.js";export{oe as MAX_TOTAL_IMAGE_MB,jo as PromptInput,Ko as PromptInputBody,K as PromptInputButton,Xo as PromptInputFooter,Qo as PromptInputHeader,Zo as PromptInputSubmit,Yo as PromptInputTools};
@@ -1 +1 @@
1
- import{lt}from"../../chunk-hkcsnwc0.js";import"../../chunk-syn2y1k9.js";import"../../chunk-7d41r9qk.js";import"../../chunk-jydpra8w.js";import"../../chunk-knsf6jm1.js";import"../../chunk-294gms5s.js";import"../../chunk-96xwaa2t.js";import"../../chunk-sex6d2c2.js";import"../../chunk-gzff19t3.js";import"../../chunk-t3ew92b3.js";import"../../chunk-0j0xezr5.js";import"../../chunk-b65vdzz3.js";import"../../chunk-0rp1nnaa.js";import"../../chunk-svt0t387.js";import"../../chunk-3e0mfcj6.js";import"../../chunk-f7z3a48k.js";import"../../chunk-kahn24np.js";import"../../chunk-abwjd5yv.js";import"../../chunk-qrvy629d.js";import"../../chunk-zt8qaqbz.js";import"../../chunk-e11qjnb4.js";import"../../chunk-rnykpmn2.js";import"../../chunk-qah4fs3d.js";import"../../chunk-m28hdj8j.js";import"../../chunk-g5tsnsqt.js";import"../../chunk-35jevrn7.js";import"../../chunk-7a6t282a.js";import"../../chunk-wb3zpzk3.js";import"../../chunk-zh3qwgea.js";import"../../chunk-p660tatw.js";import"../../chunk-0kwfy29d.js";import"../../chunk-6amcjhqh.js";import"../../chunk-tv89wh8b.js";import"../../chunk-7h8pv9eg.js";import"../../chunk-qpc4ca5y.js";import"../../chunk-k6pjjtdb.js";import"../../chunk-ksv9pjc2.js";import"../../chunk-17zegmxa.js";import"../../chunk-ak0k5vg6.js";import"../../chunk-ncekagm6.js";import"../../chunk-ysc51tpb.js";import"../../chunk-20svvgj3.js";import"../../chunk-e55zxnda.js";import"../../chunk-nkypxxjk.js";import"../../chunk-31x6chk8.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{lt as Composer};
1
+ import{lt}from"../../chunk-9tdzg6e6.js";import"../../chunk-rszktjdw.js";import"../../chunk-mt965yn0.js";import"../../chunk-5hsmhj1g.js";import"../../chunk-knsf6jm1.js";import"../../chunk-294gms5s.js";import"../../chunk-96xwaa2t.js";import"../../chunk-sex6d2c2.js";import"../../chunk-gzff19t3.js";import"../../chunk-t3ew92b3.js";import"../../chunk-5ev4qvsp.js";import"../../chunk-b65vdzz3.js";import"../../chunk-5w92bzgs.js";import"../../chunk-svt0t387.js";import"../../chunk-3e0mfcj6.js";import"../../chunk-6pmc9283.js";import"../../chunk-kahn24np.js";import"../../chunk-abwjd5yv.js";import"../../chunk-w6hhyjcn.js";import"../../chunk-zt8qaqbz.js";import"../../chunk-e11qjnb4.js";import"../../chunk-rnykpmn2.js";import"../../chunk-qah4fs3d.js";import"../../chunk-m28hdj8j.js";import"../../chunk-bhze2sjv.js";import"../../chunk-133f0wed.js";import"../../chunk-7a6t282a.js";import"../../chunk-wb3zpzk3.js";import"../../chunk-4nh3xzrm.js";import"../../chunk-zbtas7pt.js";import"../../chunk-0kwfy29d.js";import"../../chunk-6amcjhqh.js";import"../../chunk-tv89wh8b.js";import"../../chunk-7h8pv9eg.js";import"../../chunk-qpc4ca5y.js";import"../../chunk-cpk3y6ad.js";import"../../chunk-ksv9pjc2.js";import"../../chunk-17zegmxa.js";import"../../chunk-ak0k5vg6.js";import"../../chunk-ncekagm6.js";import"../../chunk-ysc51tpb.js";import"../../chunk-20svvgj3.js";import"../../chunk-e55zxnda.js";import"../../chunk-nkypxxjk.js";import"../../chunk-31x6chk8.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{lt as Composer};
@@ -1 +1 @@
1
- import{R,y,ne}from"../../chunk-g5tsnsqt.js";export{ne as currentName,R as flattenSelectOptions,y as selectOption};
1
+ import{R,x,ne}from"../../chunk-bhze2sjv.js";export{ne as currentName,R as flattenSelectOptions,x as selectOption};
@@ -1 +1 @@
1
- import{gt}from"../../chunk-qrvy629d.js";import"../../chunk-zt8qaqbz.js";import"../../chunk-e11qjnb4.js";import"../../chunk-rnykpmn2.js";import"../../chunk-qah4fs3d.js";import"../../chunk-g5tsnsqt.js";import"../../chunk-wb3zpzk3.js";import"../../chunk-ak0k5vg6.js";import"../../chunk-ysc51tpb.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{gt as ModelMenu};
1
+ import{gt}from"../../chunk-w6hhyjcn.js";import"../../chunk-zt8qaqbz.js";import"../../chunk-e11qjnb4.js";import"../../chunk-rnykpmn2.js";import"../../chunk-qah4fs3d.js";import"../../chunk-bhze2sjv.js";import"../../chunk-wb3zpzk3.js";import"../../chunk-ak0k5vg6.js";import"../../chunk-ysc51tpb.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{gt as ModelMenu};
@@ -1 +1 @@
1
- import{Fo}from"../../chunk-0rp1nnaa.js";import"../../chunk-m28hdj8j.js";import"../../chunk-k6pjjtdb.js";import"../../chunk-ysc51tpb.js";import"../../chunk-20svvgj3.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{Fo as PastedTextAttachment};
1
+ import{Fo}from"../../chunk-5w92bzgs.js";import"../../chunk-m28hdj8j.js";import"../../chunk-cpk3y6ad.js";import"../../chunk-ysc51tpb.js";import"../../chunk-20svvgj3.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{Fo as PastedTextAttachment};
@@ -1 +1 @@
1
- import{mt}from"../../chunk-f7z3a48k.js";import"../../chunk-kahn24np.js";import"../../chunk-rnykpmn2.js";import"../../chunk-qah4fs3d.js";import"../../chunk-g5tsnsqt.js";import"../../chunk-ysc51tpb.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{mt as PermissionModeMenu};
1
+ import{mt}from"../../chunk-6pmc9283.js";import"../../chunk-kahn24np.js";import"../../chunk-rnykpmn2.js";import"../../chunk-qah4fs3d.js";import"../../chunk-bhze2sjv.js";import"../../chunk-ysc51tpb.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{mt as PermissionModeMenu};
@@ -1 +1 @@
1
- import{Wo}from"../../chunk-zh3qwgea.js";import"../../chunk-p660tatw.js";import"../../chunk-0kwfy29d.js";import"../../chunk-6amcjhqh.js";import"../../chunk-tv89wh8b.js";import"../../chunk-7h8pv9eg.js";import"../../chunk-qpc4ca5y.js";import"../../chunk-k6pjjtdb.js";import"../../chunk-ncekagm6.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{Wo as SlashCommandButton};
1
+ import{Wo}from"../../chunk-4nh3xzrm.js";import"../../chunk-zbtas7pt.js";import"../../chunk-0kwfy29d.js";import"../../chunk-6amcjhqh.js";import"../../chunk-tv89wh8b.js";import"../../chunk-7h8pv9eg.js";import"../../chunk-qpc4ca5y.js";import"../../chunk-cpk3y6ad.js";import"../../chunk-ncekagm6.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{Wo as SlashCommandButton};
@@ -1 +1 @@
1
- import{Vo}from"../../chunk-35jevrn7.js";import"../../chunk-7a6t282a.js";import"../../chunk-wb3zpzk3.js";import"../../chunk-p660tatw.js";import"../../chunk-0kwfy29d.js";import"../../chunk-6amcjhqh.js";import"../../chunk-tv89wh8b.js";import"../../chunk-7h8pv9eg.js";import"../../chunk-qpc4ca5y.js";import"../../chunk-k6pjjtdb.js";import"../../chunk-ncekagm6.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{Vo as SubmitButton};
1
+ import{Vo}from"../../chunk-133f0wed.js";import"../../chunk-7a6t282a.js";import"../../chunk-wb3zpzk3.js";import"../../chunk-zbtas7pt.js";import"../../chunk-0kwfy29d.js";import"../../chunk-6amcjhqh.js";import"../../chunk-tv89wh8b.js";import"../../chunk-7h8pv9eg.js";import"../../chunk-qpc4ca5y.js";import"../../chunk-cpk3y6ad.js";import"../../chunk-ncekagm6.js";import"../../chunk-6kn920c5.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{Vo as SubmitButton};
@@ -1,5 +1,4 @@
1
- import type { Session } from "@nyssance/codex-acp-v2/client";
2
- import { type RateLimitWindow } from "@nyssance/codex-acp-v2/client";
1
+ import { type RateLimitWindow, type Session } from "@nyssance/codex-acp-v2/client";
3
2
  import type { ActivityHost } from "../../activity-host";
4
3
  export declare function limitWindowLabel(window: RateLimitWindow, t: ActivityHost["t"]): string;
5
4
  export declare function UsageMeter({ session }: {
@@ -1 +1 @@
1
- import{Oo,dt}from"../../chunk-0j0xezr5.js";import"../../chunk-b65vdzz3.js";import"../../chunk-g5tsnsqt.js";import"../../chunk-ysc51tpb.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{dt as UsageMeter,Oo as limitWindowLabel};
1
+ import{Oo,dt}from"../../chunk-5ev4qvsp.js";import"../../chunk-b65vdzz3.js";import"../../chunk-bhze2sjv.js";import"../../chunk-ysc51tpb.js";import"../../chunk-dp8pjv6r.js";import"../../chunk-ryz4c13z.js";export{dt as UsageMeter,Oo as limitWindowLabel};
@@ -1 +1 @@
1
- import{gr}from"../chunk-0k36bfyd.js";import"../chunk-cke0v0a7.js";import"../chunk-gj3j9zh5.js";import"../chunk-y3qgsj79.js";import"../chunk-j2wtwb37.js";import"../chunk-cgqhz23q.js";import"../chunk-443z7mve.js";import"../chunk-krmz8t4p.js";import"../chunk-p8qgqtkc.js";import"../chunk-vv1ghqq3.js";import"../chunk-1drkvxzk.js";import"../chunk-7k0wvvy0.js";import"../chunk-1hy64ewz.js";import"../chunk-377s443r.js";import"../chunk-64whvkk0.js";import"../chunk-p1ydsj54.js";import"../chunk-7dzq2t68.js";import"../chunk-0gwe31zs.js";import"../chunk-hxhptw6e.js";import"../chunk-6d7ppje3.js";import"../chunk-ha5jfz6r.js";import"../chunk-460phps1.js";import"../chunk-a3krtv66.js";import"../chunk-syffw61b.js";import"../chunk-4svcj9c6.js";import"../chunk-znx2e9e7.js";import"../chunk-k5c82xk9.js";import"../chunk-jn0q0b7k.js";import"../chunk-30wqrz8v.js";import"../chunk-88xay4pa.js";import"../chunk-rnzphmk6.js";import"../chunk-0yvbqccv.js";import"../chunk-4b3s7gyc.js";import"../chunk-93x6b2qa.js";import"../chunk-0d4xsx23.js";import"../chunk-9a4kjze3.js";import"../chunk-p8nx34zm.js";import"../chunk-51sbmqdk.js";import"../chunk-ynw0f8h2.js";import"../chunk-w43dvzqk.js";import"../chunk-6edz9f7j.js";import"../chunk-r79zqx0t.js";import"../chunk-50qyant6.js";import"../chunk-sr5rcdza.js";import"../chunk-0n240acr.js";import"../chunk-c0ac9k7h.js";import"../chunk-m6rrt94g.js";import"../chunk-91x8etvh.js";import"../chunk-q905xt4v.js";import"../chunk-jhk2chpp.js";import"../chunk-g7p46jq1.js";import"../chunk-5kpcpjrb.js";import"../chunk-k3375qqd.js";import"../chunk-b4dsjhkq.js";import"../chunk-w8qmh6he.js";import"../chunk-m99k3e5h.js";import"../chunk-tjgq4882.js";import"../chunk-magaaqab.js";import"../chunk-5m4605a3.js";import"../chunk-ek06eyp4.js";import"../chunk-hkcsnwc0.js";import"../chunk-syn2y1k9.js";import"../chunk-7d41r9qk.js";import"../chunk-jydpra8w.js";import"../chunk-knsf6jm1.js";import"../chunk-294gms5s.js";import"../chunk-96xwaa2t.js";import"../chunk-sex6d2c2.js";import"../chunk-gzff19t3.js";import"../chunk-t3ew92b3.js";import"../chunk-0j0xezr5.js";import"../chunk-b65vdzz3.js";import"../chunk-0rp1nnaa.js";import"../chunk-svt0t387.js";import"../chunk-3e0mfcj6.js";import"../chunk-f7z3a48k.js";import"../chunk-kahn24np.js";import"../chunk-abwjd5yv.js";import"../chunk-qrvy629d.js";import"../chunk-zt8qaqbz.js";import"../chunk-e11qjnb4.js";import"../chunk-rnykpmn2.js";import"../chunk-qah4fs3d.js";import"../chunk-m28hdj8j.js";import"../chunk-g5tsnsqt.js";import"../chunk-35jevrn7.js";import"../chunk-7a6t282a.js";import"../chunk-wb3zpzk3.js";import"../chunk-zh3qwgea.js";import"../chunk-p660tatw.js";import"../chunk-0kwfy29d.js";import"../chunk-6amcjhqh.js";import"../chunk-tv89wh8b.js";import"../chunk-7h8pv9eg.js";import"../chunk-qpc4ca5y.js";import"../chunk-k6pjjtdb.js";import"../chunk-ksv9pjc2.js";import"../chunk-17zegmxa.js";import"../chunk-ak0k5vg6.js";import"../chunk-ncekagm6.js";import"../chunk-ysc51tpb.js";import"../chunk-20svvgj3.js";import"../chunk-e55zxnda.js";import"../chunk-nkypxxjk.js";import"../chunk-31x6chk8.js";import"../chunk-6kn920c5.js";import"../chunk-dp8pjv6r.js";import"../chunk-ryz4c13z.js";export{gr as ConversationView};
1
+ import{gr}from"../chunk-fe3c678p.js";import"../chunk-cke0v0a7.js";import"../chunk-gj3j9zh5.js";import"../chunk-y3qgsj79.js";import"../chunk-j2wtwb37.js";import"../chunk-cgqhz23q.js";import"../chunk-443z7mve.js";import"../chunk-krmz8t4p.js";import"../chunk-p8qgqtkc.js";import"../chunk-vv1ghqq3.js";import"../chunk-1drkvxzk.js";import"../chunk-7k0wvvy0.js";import"../chunk-1hy64ewz.js";import"../chunk-377s443r.js";import"../chunk-64whvkk0.js";import"../chunk-p1ydsj54.js";import"../chunk-7dzq2t68.js";import"../chunk-0gwe31zs.js";import"../chunk-hxhptw6e.js";import"../chunk-6d7ppje3.js";import"../chunk-ha5jfz6r.js";import"../chunk-460phps1.js";import"../chunk-a3krtv66.js";import"../chunk-syffw61b.js";import"../chunk-4svcj9c6.js";import"../chunk-znx2e9e7.js";import"../chunk-k5c82xk9.js";import"../chunk-jn0q0b7k.js";import"../chunk-30wqrz8v.js";import"../chunk-88xay4pa.js";import"../chunk-rnzphmk6.js";import"../chunk-0yvbqccv.js";import"../chunk-4b3s7gyc.js";import"../chunk-93x6b2qa.js";import"../chunk-0d4xsx23.js";import"../chunk-9a4kjze3.js";import"../chunk-p8nx34zm.js";import"../chunk-51sbmqdk.js";import"../chunk-ynw0f8h2.js";import"../chunk-w43dvzqk.js";import"../chunk-6edz9f7j.js";import"../chunk-r79zqx0t.js";import"../chunk-50qyant6.js";import"../chunk-sr5rcdza.js";import"../chunk-0n240acr.js";import"../chunk-c0ac9k7h.js";import"../chunk-m6rrt94g.js";import"../chunk-91x8etvh.js";import"../chunk-q905xt4v.js";import"../chunk-jhk2chpp.js";import"../chunk-g7p46jq1.js";import"../chunk-5kpcpjrb.js";import"../chunk-k3375qqd.js";import"../chunk-b4dsjhkq.js";import"../chunk-w8qmh6he.js";import"../chunk-m99k3e5h.js";import"../chunk-tjgq4882.js";import"../chunk-magaaqab.js";import"../chunk-5m4605a3.js";import"../chunk-ek06eyp4.js";import"../chunk-9tdzg6e6.js";import"../chunk-rszktjdw.js";import"../chunk-mt965yn0.js";import"../chunk-5hsmhj1g.js";import"../chunk-knsf6jm1.js";import"../chunk-294gms5s.js";import"../chunk-96xwaa2t.js";import"../chunk-sex6d2c2.js";import"../chunk-gzff19t3.js";import"../chunk-t3ew92b3.js";import"../chunk-5ev4qvsp.js";import"../chunk-b65vdzz3.js";import"../chunk-5w92bzgs.js";import"../chunk-svt0t387.js";import"../chunk-3e0mfcj6.js";import"../chunk-6pmc9283.js";import"../chunk-kahn24np.js";import"../chunk-abwjd5yv.js";import"../chunk-w6hhyjcn.js";import"../chunk-zt8qaqbz.js";import"../chunk-e11qjnb4.js";import"../chunk-rnykpmn2.js";import"../chunk-qah4fs3d.js";import"../chunk-m28hdj8j.js";import"../chunk-bhze2sjv.js";import"../chunk-133f0wed.js";import"../chunk-7a6t282a.js";import"../chunk-wb3zpzk3.js";import"../chunk-4nh3xzrm.js";import"../chunk-zbtas7pt.js";import"../chunk-0kwfy29d.js";import"../chunk-6amcjhqh.js";import"../chunk-tv89wh8b.js";import"../chunk-7h8pv9eg.js";import"../chunk-qpc4ca5y.js";import"../chunk-cpk3y6ad.js";import"../chunk-ksv9pjc2.js";import"../chunk-17zegmxa.js";import"../chunk-ak0k5vg6.js";import"../chunk-ncekagm6.js";import"../chunk-ysc51tpb.js";import"../chunk-20svvgj3.js";import"../chunk-e55zxnda.js";import"../chunk-nkypxxjk.js";import"../chunk-31x6chk8.js";import"../chunk-6kn920c5.js";import"../chunk-dp8pjv6r.js";import"../chunk-ryz4c13z.js";export{gr as ConversationView};
@@ -1 +1 @@
1
- import"../chunk-ryz4c13z.js";import"../chunk-dp8pjv6r.js";import"../chunk-cke0v0a7.js";import"../chunk-6kn920c5.js";import"../chunk-magaaqab.js";import"../chunk-ksv9pjc2.js";import"../chunk-gzff19t3.js";import"../chunk-knsf6jm1.js";import"../chunk-294gms5s.js";import"../chunk-k6pjjtdb.js";import"../chunk-jydpra8w.js";import"../chunk-0kwfy29d.js";import"../chunk-tv89wh8b.js";import"../chunk-6amcjhqh.js";import"../chunk-ncekagm6.js";import"../chunk-qpc4ca5y.js";import"../chunk-7h8pv9eg.js";import"../chunk-p660tatw.js";import"../chunk-t3ew92b3.js";import"../chunk-17zegmxa.js";import"../chunk-sex6d2c2.js";import"../chunk-b65vdzz3.js";import"../chunk-7d41r9qk.js";import"../chunk-96xwaa2t.js";import"../chunk-syn2y1k9.js";import{ht,n}from"../chunk-ysc51tpb.js";import{wr}from"../chunk-3e0mfcj6.js";import{i,E,vt,kr,Cr,xt,Tr}from"../chunk-20svvgj3.js";import{ut}from"../chunk-svt0t387.js";import{qo,xe,Fe,ft}from"../chunk-m28hdj8j.js";import"../chunk-nkypxxjk.js";import{yt,wt}from"../chunk-31x6chk8.js";import"../chunk-e55zxnda.js";import"../chunk-qah4fs3d.js";import"../chunk-ak0k5vg6.js";import"../chunk-wb3zpzk3.js";import"../chunk-e11qjnb4.js";import"../chunk-rnykpmn2.js";import"../chunk-zt8qaqbz.js";import{R,y,ne}from"../chunk-g5tsnsqt.js";import{gt}from"../chunk-qrvy629d.js";import"../chunk-0rp1nnaa.js";import"../chunk-kahn24np.js";import{mt}from"../chunk-f7z3a48k.js";import{pt}from"../chunk-abwjd5yv.js";import"../chunk-zh3qwgea.js";import"../chunk-7a6t282a.js";import"../chunk-35jevrn7.js";import{Oo,dt}from"../chunk-0j0xezr5.js";import{lt}from"../chunk-hkcsnwc0.js";import"../chunk-0gwe31zs.js";import"../chunk-7dzq2t68.js";import"../chunk-w43dvzqk.js";import"../chunk-ynw0f8h2.js";import"../chunk-6edz9f7j.js";import"../chunk-51sbmqdk.js";import"../chunk-p8nx34zm.js";import"../chunk-w8qmh6he.js";import"../chunk-9a4kjze3.js";import"../chunk-50qyant6.js";import"../chunk-0n240acr.js";import"../chunk-sr5rcdza.js";import"../chunk-93x6b2qa.js";import"../chunk-ek06eyp4.js";import"../chunk-5m4605a3.js";import"../chunk-5kpcpjrb.js";import"../chunk-k3375qqd.js";import"../chunk-g7p46jq1.js";import"../chunk-m6rrt94g.js";import"../chunk-0d4xsx23.js";import"../chunk-jhk2chpp.js";import"../chunk-q905xt4v.js";import"../chunk-r79zqx0t.js";import"../chunk-b4dsjhkq.js";import"../chunk-tjgq4882.js";import"../chunk-m99k3e5h.js";import"../chunk-91x8etvh.js";import"../chunk-c0ac9k7h.js";import"../chunk-4b3s7gyc.js";import"../chunk-rnzphmk6.js";import"../chunk-jn0q0b7k.js";import"../chunk-88xay4pa.js";import"../chunk-30wqrz8v.js";import"../chunk-syffw61b.js";import"../chunk-k5c82xk9.js";import"../chunk-znx2e9e7.js";import"../chunk-4svcj9c6.js";import"../chunk-a3krtv66.js";import"../chunk-6d7ppje3.js";import"../chunk-hxhptw6e.js";import"../chunk-0yvbqccv.js";import"../chunk-460phps1.js";import"../chunk-ha5jfz6r.js";import"../chunk-p1ydsj54.js";import{st}from"../chunk-64whvkk0.js";import"../chunk-377s443r.js";import{nt,xn,ot}from"../chunk-gj3j9zh5.js";import"../chunk-p8qgqtkc.js";import"../chunk-cgqhz23q.js";import"../chunk-1drkvxzk.js";import"../chunk-7k0wvvy0.js";import"../chunk-1hy64ewz.js";import"../chunk-443z7mve.js";import"../chunk-vv1ghqq3.js";import"../chunk-krmz8t4p.js";import{de,Pe,it}from"../chunk-j2wtwb37.js";import{rt}from"../chunk-y3qgsj79.js";import{gr}from"../chunk-0k36bfyd.js";export{it as ActionCard,lt as Composer,st as ConversationBody,ht as ConversationProvider,gr as ConversationView,ot as DiffModal,Pe as ElicitationForm,qo as LONG_TEXT_LENGTH,gt as ModelMenu,mt as PermissionModeMenu,rt as SessionActions,dt as UsageMeter,ne as currentName,i as drafts,kr as exportDraft,ut as fileItems,xn as filePatch,R as flattenSelectOptions,yt as formatMentionUri,Cr as importDraft,de as isFormAction,xe as isPastedTextAttachment,Oo as limitWindowLabel,wt as mentionDisplayName,nt as openDiffModal,ft as pasteLongText,xt as registerComposerWriter,y as selectOption,Tr as setComposerDraft,vt as trackDraftAttachmentWrite,E as updateDraftAttachments,wr as useComposer,pt as useComposerPrediction,n as useConversation,Fe as writePastedTextAttachment};
1
+ import"../chunk-ryz4c13z.js";import"../chunk-dp8pjv6r.js";import"../chunk-cke0v0a7.js";import"../chunk-6kn920c5.js";import"../chunk-magaaqab.js";import"../chunk-ksv9pjc2.js";import"../chunk-gzff19t3.js";import"../chunk-knsf6jm1.js";import"../chunk-294gms5s.js";import"../chunk-cpk3y6ad.js";import"../chunk-5hsmhj1g.js";import"../chunk-0kwfy29d.js";import"../chunk-tv89wh8b.js";import"../chunk-6amcjhqh.js";import"../chunk-ncekagm6.js";import"../chunk-qpc4ca5y.js";import"../chunk-7h8pv9eg.js";import"../chunk-zbtas7pt.js";import"../chunk-t3ew92b3.js";import"../chunk-17zegmxa.js";import"../chunk-sex6d2c2.js";import"../chunk-b65vdzz3.js";import"../chunk-mt965yn0.js";import"../chunk-96xwaa2t.js";import"../chunk-rszktjdw.js";import{ht,n}from"../chunk-ysc51tpb.js";import{wr}from"../chunk-3e0mfcj6.js";import{i,E,vt,kr,Cr,xt,Tr}from"../chunk-20svvgj3.js";import{ut}from"../chunk-svt0t387.js";import{qo,xe,Fe,ft}from"../chunk-m28hdj8j.js";import"../chunk-nkypxxjk.js";import{yt,wt}from"../chunk-31x6chk8.js";import"../chunk-e55zxnda.js";import"../chunk-qah4fs3d.js";import"../chunk-ak0k5vg6.js";import"../chunk-wb3zpzk3.js";import"../chunk-e11qjnb4.js";import"../chunk-rnykpmn2.js";import"../chunk-zt8qaqbz.js";import{R,x,ne}from"../chunk-bhze2sjv.js";import{gt}from"../chunk-w6hhyjcn.js";import"../chunk-5w92bzgs.js";import"../chunk-kahn24np.js";import{mt}from"../chunk-6pmc9283.js";import{pt}from"../chunk-abwjd5yv.js";import"../chunk-4nh3xzrm.js";import"../chunk-7a6t282a.js";import"../chunk-133f0wed.js";import{Oo,dt}from"../chunk-5ev4qvsp.js";import{lt}from"../chunk-9tdzg6e6.js";import"../chunk-0gwe31zs.js";import"../chunk-7dzq2t68.js";import"../chunk-w43dvzqk.js";import"../chunk-ynw0f8h2.js";import"../chunk-6edz9f7j.js";import"../chunk-51sbmqdk.js";import"../chunk-p8nx34zm.js";import"../chunk-w8qmh6he.js";import"../chunk-9a4kjze3.js";import"../chunk-50qyant6.js";import"../chunk-0n240acr.js";import"../chunk-sr5rcdza.js";import"../chunk-93x6b2qa.js";import"../chunk-ek06eyp4.js";import"../chunk-5m4605a3.js";import"../chunk-5kpcpjrb.js";import"../chunk-k3375qqd.js";import"../chunk-g7p46jq1.js";import"../chunk-m6rrt94g.js";import"../chunk-0d4xsx23.js";import"../chunk-jhk2chpp.js";import"../chunk-q905xt4v.js";import"../chunk-r79zqx0t.js";import"../chunk-b4dsjhkq.js";import"../chunk-tjgq4882.js";import"../chunk-m99k3e5h.js";import"../chunk-91x8etvh.js";import"../chunk-c0ac9k7h.js";import"../chunk-4b3s7gyc.js";import"../chunk-rnzphmk6.js";import"../chunk-jn0q0b7k.js";import"../chunk-88xay4pa.js";import"../chunk-30wqrz8v.js";import"../chunk-syffw61b.js";import"../chunk-k5c82xk9.js";import"../chunk-znx2e9e7.js";import"../chunk-4svcj9c6.js";import"../chunk-a3krtv66.js";import"../chunk-6d7ppje3.js";import"../chunk-hxhptw6e.js";import"../chunk-0yvbqccv.js";import"../chunk-460phps1.js";import"../chunk-ha5jfz6r.js";import"../chunk-p1ydsj54.js";import{st}from"../chunk-64whvkk0.js";import"../chunk-377s443r.js";import{nt,xn,ot}from"../chunk-gj3j9zh5.js";import"../chunk-p8qgqtkc.js";import"../chunk-cgqhz23q.js";import"../chunk-1drkvxzk.js";import"../chunk-7k0wvvy0.js";import"../chunk-1hy64ewz.js";import"../chunk-443z7mve.js";import"../chunk-vv1ghqq3.js";import"../chunk-krmz8t4p.js";import{de,Pe,it}from"../chunk-j2wtwb37.js";import{rt}from"../chunk-y3qgsj79.js";import{gr}from"../chunk-fe3c678p.js";export{it as ActionCard,lt as Composer,st as ConversationBody,ht as ConversationProvider,gr as ConversationView,ot as DiffModal,Pe as ElicitationForm,qo as LONG_TEXT_LENGTH,gt as ModelMenu,mt as PermissionModeMenu,rt as SessionActions,dt as UsageMeter,ne as currentName,i as drafts,kr as exportDraft,ut as fileItems,xn as filePatch,R as flattenSelectOptions,yt as formatMentionUri,Cr as importDraft,de as isFormAction,xe as isPastedTextAttachment,Oo as limitWindowLabel,wt as mentionDisplayName,nt as openDiffModal,ft as pasteLongText,xt as registerComposerWriter,x as selectOption,Tr as setComposerDraft,vt as trackDraftAttachmentWrite,E as updateDraftAttachments,wr as useComposer,pt as useComposerPrediction,n as useConversation,Fe as writePastedTextAttachment};
@@ -1,66 +1,70 @@
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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},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"&amp;";let n=r===void 0?Number.parseInt(s,16):Number.parseInt(r,10);return n===0||n>1114111||n>=55296&&n<=57343?"�":n===38?"&amp;":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],`
1
+ function Y(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var P=Y();function be(t){P=t}var T={exec:()=>null};function S(t){let e=[];return(r)=>{let n=Math.max(0,Math.min(3,r-1)),s=e[n];return s||(s=t(n),e[n]=s),s}}function d(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(s,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(F.caret,"$1"),r=r.replace(s,l),n},getRegex:()=>new RegExp(r,e)};return n}var Qe=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),F={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,blockquoteMarkerWhitespace:/^( {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:S((t)=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:S((t)=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:S((t)=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:S((t)=>new RegExp(`^ {0,${t}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:S((t)=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:S((t)=>new RegExp(`^ {0,${t}}(?:</?(?:${H})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:S((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|$)|$)/,Q=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ge=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,we=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ee=d(we).replace(/bull/g,ee).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=d(we).replace(/bull/g,ee).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(),te=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ue=/^[^\n]+/,re=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ke=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",re).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Je=d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ee).getRegex(),H="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",se=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ve=d("^ {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)(?:[ \\t]+|\\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",se).replace("tag",H).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$e=(t)=>d(te).replace("hr",Q).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",H).getRegex(),Ye=$e(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),et=$e(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),tt=d(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",et).getRegex(),ne={blockquote:tt,code:Ne,def:Ke,fences:We,heading:Ge,hr:Q,html:Ve,lheading:Ee,list:Je,newline:He,paragraph:Ye,table:T,text:Ue},pe=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Q).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",H).getRegex(),rt={...ne,lheading:Xe,table:pe,paragraph:d(te).replace("hr",Q).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pe).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",H).getRegex()},st={...ne,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",se).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:T,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(te).replace("hr",Q).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",Ee).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,it=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ae=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,lt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,y=/[\p{P}\p{S}]/u,Z=/[\s\p{P}\p{S}]/u,N=/[^\s\p{P}\p{S}]/u,at=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Z).getRegex(),ut=/[\p{Pi}\p{Ps}"']/u,Ce=/(?!~)[\p{P}\p{S}]/u,ot=/(?!~)[\s\p{P}\p{S}]/u,ct=/(?:[^\s\p{P}\p{S}]|~)/u,ht=d(/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(),ye=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pt=d(ye,"u").replace(/punct/g,y).getRegex(),gt=d(ye,"u").replace(/punct/g,Ce).getRegex(),dt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,kt=d(dt,"u").replace(/openQuote/g,ut).replace(/punct/g,y).getRegex(),ze="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ft=d(ze,"gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,Z).replace(/punct/g,y).getRegex(),xt=d(ze,"gu").replace(/notPunctSpace/g,ct).replace(/punctSpace/g,ot).replace(/punct/g,Ce).getRegex(),Dt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",_t=d(Dt,"gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,Z).replace(/punct/g,y).getRegex(),mt=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,Z).replace(/punct/g,y).getRegex(),Ft="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",bt=d(Ft,"gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,Z).replace(/punct/g,y).getRegex(),wt=d(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,y).getRegex(),Et="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",$t=d(Et,"gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,Z).replace(/punct/g,y).getRegex(),At=d(/\\(punct)/,"gu").replace(/punct/g,y).getRegex(),Ct=d(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,y).getRegex(),yt=d(/^<(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=d(se).replace("(?:-->|$)","-->").getRegex(),Rt=d("^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(),Re=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,X=d(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Re).getRegex(),St=d(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",X).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Bt=d(/^!?\[(label)\]\[(ref)\]/).replace("label",X).replace("ref",re).getRegex(),Tt=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",re).getRegex(),ge=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,vt=d(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Re).getRegex(),Pt=d("reflink|nolink(?!\\()","g").replace("reflink",d(/^!?\[(label)\]\[(ref)\]/).replace("label",vt).replace("ref",ge).getRegex()).replace("nolink",d(/^!?\[(ref)\](?:\[\])?/).replace("ref",ge).getRegex()).getRegex(),de=/[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=d(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,It).getRegex(),ie={_backpedal:T,anyPunctuation:At,anyPunctuationOutsideCode:Ct,autolink:yt,blockSkip:ht,br:Ae,code:it,del:T,delLDelim:T,delRDelim:T,emStrongLDelim:pt,emStrongRDelimAst:ft,emStrongRDelimUnd:mt,escape:nt,link:St,nolink:Tt,punctuation:at,reflink:Bt,reflinkSearch:Pt,tag:Rt,text:lt,url:T},Zt={...ie,emStrongLDelim:kt,emStrongRDelimAst:_t,emStrongRDelimUnd:bt,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",X).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X).getRegex()},V={...ie,emStrongRDelimAst:xt,emStrongLDelim:gt,delLDelim:wt,delRDelim:$t,url:d(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Lt).replace("protocol",de).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:d(/^(?:[^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",de).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Mt={...V,br:d(Ae).replace("{2,}","*").getRegex(),text:d(V.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},W={normal:ne,gfm:rt,pedantic:st},O={normal:ie,gfm:V,breaks:Mt,pedantic:Zt},qt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ke=(t)=>qt[t];function w(t,e){if(e){if(F.escapeTest.test(t))return t.replace(F.escapeReplace,ke)}else if(F.escapeTestNoEncode.test(t))return t.replace(F.escapeReplaceNoEncode,ke);return t}function Ot(t){return F.numericCharacterReference.test(t)?t.replace(F.numericCharacterReferenceOrAmpersand,(e,r,n)=>{if(r===void 0&&n===void 0)return"&amp;";let s=r===void 0?Number.parseInt(n,16):Number.parseInt(r,10);return s===0||s>1114111||s>=55296&&s<=57343?"�":s===38?"&amp;":String.fromCodePoint(s)}):t}function fe(t){try{t=encodeURI(t).replace(F.percentDecode,"%")}catch{return null}return t}function xe(t,e){let r=t.replace(F.findPipe,(i,l,a)=>{let o=!1,c=l;for(;--c>=0&&a[c]==="\\";)o=!o;return o?"|":" |"}),n=r.split(F.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(F.slashPipe,"|");return n}function z(t,e,r){let n=t.length;if(n===0)return"";let s=0;for(;s<n;){let i=t.charAt(n-s-1);if(i===e&&!r)s++;else if(i!==e&&r)s++;else break}return t.slice(0,n-s)}function De(t){let e=t.split(`
3
+ `),r=e.length-1;for(;r>=0&&F.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(`
4
+ `)}function U(t){return t.trim().toLowerCase().toUpperCase().toLowerCase()}function _e(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function G(t,e=0){let r=e,n="";for(let s of t)if(s==="\t"){let i=4-r%4;n+=" ".repeat(i),r+=i}else n+=s,r++;return n}function me(t,e,r,n,s){let i=e.href,l=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1"),o=t[0].charAt(0)==="!",c=n.state.inLink,u=n.state.linkEmitted,p=n.state.inRawBlock;n.state.inLink=!0,n.state.linkEmitted=!1;let f=n.inlineTokens(a),h=n.state.linkEmitted;if(n.state.linkEmitted=u,n.state.inLink=c,!o){if(h){n.state.inRawBlock=p;return}n.state.linkEmitted=!0}return{type:o?"image":"link",raw:r,href:i,title:l,text:a,tokens:f}}function jt(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let s=n[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,s.length))}).join(`
6
+ `)}function Fe(t,e,r,n){if(!e.includes("<"))return!1;for(let s=0;s<e.length;s++){if(e[s]==="\\"){s++;continue}if(e[s]==="`"){let a=n.inline.code.exec(e.slice(s));if(a){s+=a[0].length-1;continue}}if(e[s]!=="<")continue;let i=t.slice(r+s),l=n.inline.tag.exec(i)||n.inline.autolink.exec(i);if(l){if(l[0].length>e.length-s)return!0;s+=l[0].length-1}}return!1}var L=class{options;rules;lexer;constructor(t){this.options=t||P}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]:De(e[0]),n=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=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:n}}}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 n=z(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(r=n.trim())}return{type:"heading",raw:z(e[0],`
7
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
8
  `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=z(e[0],`
9
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+`
10
+ `),n="",s="",i=[];for(;r.length>0;){let l=!1,a=[],o;for(o=0;o<r.length;o++)if(this.rules.other.blockquoteStart.test(r[o]))a.push(r[o]),l=!0;else if(!l)a.push(r[o]);else break;r=r.slice(o);let c=a.join(`
11
+ `),u=c.replace(this.rules.other.blockquoteMarkerWhitespace,(h,x,D)=>x+G(D,x.length)).replace(this.rules.other.blockquoteSetextReplace,`
12
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
13
+ ${c}`:c,s=s?`${s}
14
+ ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=p,r.length===0)break;let f=i.at(-1);if(f?.type==="code"||f?.type==="heading"||f?.type==="hr"||f?.type==="html")break;if(f?.type==="blockquote"){let h=f,x=r.join(`
15
+ `),D=h.raw+`
16
+ `+x.replace(this.rules.other.blockquoteSetextReplace2,""),g=this.blockquote(D);i[i.length-1]=g;let m=D.substring(g.raw.length).replace(/^\n/,""),k=m?m.split(`
17
+ `).length:0,b=k?r.slice(0,-k):r;b.length>0&&(n=`${n}
18
+ ${b.join(`
19
+ `)}`),s=s.substring(0,s.length-h.text.length)+g.text;break}else if(f?.type==="list"){let h=f,x=h.raw+`
20
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(`
21
+ `),D=this.list(x);i[i.length-1]=D;let g=D.raw.length>h.raw.length?x.slice(h.raw.length+1,D.raw.length).split(`
22
+ `).length:0;if(g>0){let m=r.slice(0,g).join(`
23
+ `);n=`${n}
24
+ ${m}`,s=`${s}
25
+ ${m}`}r=r.slice(g);continue}}return{type:"blockquote",raw:n,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,n=()=>r.length-t.length,s=e[1].trim(),i=s.length>1,l={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),o=!1;for(;t;){let u=!1,p="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;let f=n();t=t.substring(e[0].length);let h=e[2].split(`
26
+ `,1)[0],x=e[1].length,D=this.options.pedantic?G(h,x):h.replace(this.rules.other.leadingSpaceTab,(E)=>G(E,x)),g=t.split(`
27
+ `,1)[0],m=!D.trim(),k=0;if(this.options.pedantic?(k=2,p=D.trimStart()):m?k=x+1:(k=D.search(this.rules.other.nonSpaceChar),k=k>4?1:k,p=D.slice(k),k+=x),m&&this.rules.other.blankLine.test(g)&&(t=t.substring(g.length+1),u=!0),!u){let E=this.rules.other.nextBulletRegex(k),R=this.rules.other.hrRegex(k),M=this.rules.other.fencesBeginRegex(k),q=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(k):this.rules.other.headingBeginRegex(k),Oe=this.rules.other.htmlBeginRegex(k),je=this.rules.other.blockquoteBeginRegex(k);for(;t;){let he=t.split(`
28
+ `,1)[0],I;if(g=he,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),I=g):I=g.replace(this.rules.other.leadingSpaceTab,(J)=>G(J)),M.test(g)||q.test(g)||Oe.test(g)||je.test(g)||E.test(g)||R.test(g))break;if(I.search(this.rules.other.nonSpaceChar)>=k||!g.trim())p+=`
29
+ `+I.slice(k);else{if(m||D.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(D)||q.test(D)||R.test(D))break;let J=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(g)&&this.rules.block.lheading.test(`${D}
30
+ ${g}`)?` ${I.replace(/^ {0,3}/,"")}`:g;p+=`
31
+ `+J}m=!g.trim(),t=t.substring(he.length+1),D=I.slice(k)}}let b=r.slice(f,n());l.loose||(o?l.loose=!0:this.rules.other.doubleBlankLine.test(b)&&(o=!0)),l.items.push({type:"list_item",raw:b,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]})}let c=l.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;l.raw=r.slice(0,n()).trimEnd();for(let u of l.items)if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),!l.loose){let p=u.tokens.filter((h)=>h.type==="space"),f=p.length>0&&p.some((h)=>this.rules.other.anyLine.test(h.raw));l.loose=f}for(let u of l.items){let p=u.tokens[0];if(u.task&&(p?.type==="text"||p?.type==="paragraph")){u.text=u.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 f=this.rules.other.listTaskCheckbox.exec(u.raw);if(f){let h={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};u.checked=h.checked,l.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}else u.task&&(u.task=!1)}if(l.loose)for(let u of l.items){u.loose=!0;for(let p of u.tokens)p.type==="text"&&(p.type="paragraph")}return l}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=De(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])&&_e(e[2],"()")!==-1)return;let r=U(e[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=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],`
32
+ `),href:n,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=xe(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
29
33
  `):[],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],`
34
+ `),header:[],align:[],rows:[]};if(r.length===n.length){for(let l of n)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 s)i.rows.push(xe(l,i.header.length).map((a,o)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[o]})));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
35
  `),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+=`
36
+ `?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&&Fe(t,e[1],r,this.rules))return;let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let l=z(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{let l=_e(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 s=e[2],i="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(s);l&&(s=l[1],i=l[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),me(e,{href:s&&s.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 n=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Fe(t,r[1],n,this.rules))return;let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[U(s)];if(!i){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return me(r,i,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let s=n[0][0],i=r===s,l=e.length-t.length,a=l;for(;!this.options.pedantic&&a>0&&e[a-1]===s;)a--;let o=[...e.slice(Math.max(0,a-2),a)].at(-1)??"",c=o==="*"||o==="_"||!!this.rules.inline.punctuation.exec(o);a<l&&(r=o);let u=a<l?c:!!this.rules.inline.punctuation.exec(r);if(n[4]&&r.match(this.rules.other.unicodeAlphaNumeric))return;let p=n[1]||n[3]||"";if(!p||!r||u){let f=[...n[0]].length-1,h,x,D=f,g=0,m=l-a+f,k=!this.options.pedantic&&!!o.trim()&&(!!p||s==="*"&&!c),b=s==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,e=e.slice(-1*t.length+f);(n=b.exec(e))!==null;){if(h=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!h)continue;if(x=[...h].length,n[3]||n[4]){D+=x;continue}else if(n[5]||n[6]||k){if(i&&(n[5]||n[6]))break;if(m%3&&!((m+x)%3)){g+=x;continue}}if(D-=x,D>0)continue;x=Math.min(x,x+D+g);let E=[...n[0]][0].length,R=t.slice(0,f+n.index+E+x);if(Math.min(f,x)%2){let q=R.slice(1,-1);return{type:"em",raw:R,text:q,tokens:this.lexer.inlineTokens(q)}}let M=R.slice(2,-2);return{type:"strong",raw:R,text:M,tokens:this.lexer.inlineTokens(M)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(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 n=this.rules.inline.delLDelim.exec(t);if(!n)return;if(!n[1]||!r||this.rules.inline.punctuation.exec(r)){let s=[...n[0]].length-1,i,l,a=s,o=this.rules.inline.delRDelim;for(o.lastIndex=0,e=e.slice(-1*t.length+s);(n=o.exec(e))!==null;){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i||(l=[...i].length,l!==s))continue;if(n[3]||n[4]){a+=l;continue}if(a-=l,a>0)continue;l=Math.min(l,l+a);let c=[...n[0]][0].length,u=t.slice(0,s+n.index+c+l),p=u.slice(s,-s);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,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}}}},A=class t{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||P,this.options.tokenizer=this.options.tokenizer||new L,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:F,block:W.normal,inline:O.normal};this.options.pedantic?(r.block=W.pedantic,r.inline=O.pedantic):this.options.gfm&&(r.block=W.gfm,this.options.breaks?r.inline=O.breaks:r.inline=O.gfm),this.tokenizer.rules=r}static get rules(){return{block:W,inline:O}}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(F.carriageReturn,`
37
+ `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.state.inRawBlock=!1,this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(F.tabCharGlobal," ").replace(F.spaceLine,""));let s=1/0;for(;e;){if(e.length<s)s=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
38
  `: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
39
  `)?"":`
36
40
  `)+i.raw,a.text+=`
37
41
  `+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
42
  `)?"":`
39
43
  `)+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(`
44
+ `+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,o=e.slice(1),c;this.options.extensions.startBlock.forEach((u)=>{c=u.call({lexer:this},o),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),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);n&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
41
45
  `)?"":`
42
46
  `)+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(`
47
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(i),n=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
48
  `)?"":`
45
49
  `)+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>
50
+ `+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 n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let s=n[0],i=s.lastIndexOf("[");if(!(s.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,U(s.slice(i+1,-1))))&&!(i>1&&this.linkInText(s.slice(1,i-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,r)}finally{this.state.linkParenPossible=n}}#e(e,r){let n=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==L.prototype.emStrong||this.tokenizer.del!==L.prototype.del?this.#t(e):e,s=!1,i="",l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}s||(i=""),s=!1;let a;if(this.options.extensions?.inline?.some((c)=>(a=c.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 c=r.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,n,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,n,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 o=e;if(this.options.extensions?.startInline){let c=1/0,u=e.slice(1),p;this.options.extensions.startInline.forEach((f)=>{p=f.call({lexer:this},u),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(o=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(o)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),s=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return r}#t(e){let r=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,s=(i)=>{let l=i.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,U(i.slice(l+1,-1))))return i;if(l>1&&i.charAt(0)!=="!"){let a=i.slice(1,l-1);if(this.linkInText(a))return"["+a.replace(n,s)+"]["+"a".repeat(i.length-l-2)+"]"}return"["+"a".repeat(i.length-2)+"]"};r=r.replace(n,s)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,s,i)=>i?"+".repeat(n.length):s?s+n.slice(s.length,-s.length).replace(/`/g,"+")+s:n),r=r.replace(this.tokenizer.rules.inline.blockSkip,(n,s,i)=>{let l=i?i.length:0;return n.slice(0,l)+"["+"a".repeat(n.length-l-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw Error(r)}},K=class{options;parser;constructor(t){this.options=t||P}space(t){return""}code({text:t,lang:e,escaped:r}){let n=(e||"").match(F.notSpaceStart)?.[0],s=t?t.replace(F.endingNewline,"")+`
51
+ `:"";return n?'<pre><code class="language-'+w(n)+'">'+(r?s:w(s,!0))+`</code></pre>
52
+ `:"<pre><code>"+(r?s:w(s,!0))+`</code></pre>
49
53
  `}blockquote({tokens:t}){return`<blockquote>
50
54
  ${this.parser.parse(t)}</blockquote>
51
55
  `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
52
56
  `}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+`>
57
+ `}list(t){let{ordered:e,start:r}=t,n="";for(let l=0;l<t.items.length;l++){let a=t.items[l];n+=this.listitem(a)}let s=e?"ol":"ul",i=e&&r!==1?' start="'+r+'"':"";return"<"+s+i+`>
58
+ `+n+"</"+s+`>
55
59
  `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
56
60
  `}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>
61
+ `}table(t){let e="",r="";for(let s=0;s<t.header.length;s++)r+=this.tablecell(t.header[s]);e+=this.tablerow({text:r});let n="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];r="";for(let l=0;l<i.length;l++)r+=this.tablecell(i[l]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
58
62
  <thead>
59
63
  `+e+`</thead>
60
- `+s+`</table>
64
+ `+n+`</table>
61
65
  `}tablerow({text:t}){return`<tr>
62
66
  ${t}</tr>
63
67
  `}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)};
68
+ `}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>${w(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:n,autolink:s}){let i=s?w(r,!0):this.parser.parseInline(n),l=fe(t);if(l===null)return i;t=w(l,s);let a='<a href="'+t+'"';return e&&(a+=' title="'+w(e)+'"'),a+=">"+i+"</a>",a}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let s=fe(t);if(s===null)return w(r);t=s;let i=`<img src="${w(t)}" alt="${w(r)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):("escaped"in t)&&t.escaped?t.text:w(t.text)}},le=class{parser;strong({text:t,tokens:e}){return e?this.parser.parseInline(e,this):t}em({text:t,tokens:e}){return e?this.parser.parseInline(e,this):t}codespan({text:t}){return t}del({text:t,tokens:e}){return e?this.parser.parseInline(e,this):t}html({text:t}){return t}text({text:t}){return t}link({text:t,tokens:e}){return e?this.parser.parseInline(e,this):t}image({text:t,tokens:e}){return e?this.parser.parseInline(e,this):t}br(){return""}checkbox({raw:t}){return t}},C=class t{options;renderer;textRenderer;constructor(e){this.options=e||P,this.options.renderer=this.options.renderer||new K,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new le,this.textRenderer.parser=this}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 n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let l=s,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=s;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 n="";for(let s=0;s<e.length;s++){let i=e[s];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)){n+=a||"";continue}}let l=i;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"checkbox":{n+=r.checkbox(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=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 n}},j=class{options;block;constructor(t){this.options=t||P}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?A.lex:A.lexInline}provideParser(t=this.block){return t?C.parse:C.parseInline}};function B(t,e){if(Array.isArray(e))for(let r=0;r<e.length;r++)t.push(e[r]);else t.push(e)}var ae=class{defaults=Y();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=C;Renderer=K;TextRenderer=le;Lexer=A;Tokenizer=L;Hooks=j;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(let n of t)switch(B(r,e.call(this,n)),n.type){case"table":{let s=n;for(let i of s.header)B(r,this.walkTokens(i.tokens,e));for(let i of s.rows)for(let l of i)B(r,this.walkTokens(l.tokens,e));break}case"list":{let s=n;B(r,this.walkTokens(s.items,e));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach((i)=>{let l=s[i].flat(1/0);B(r,this.walkTokens(l,e))}):s.tokens&&B(r,this.walkTokens(s.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach((r)=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach((s)=>{if(!s.name)throw Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...l){let a=s.renderer.apply(this,l);return a===!1&&(a=i.apply(this,l)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){let s=this.defaults.renderer||new K(this.defaults);for(let i in r.renderer){if(!(i in s))throw Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,a=r.renderer[l],o=s[l];s[l]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=o.apply(s,c)),u||""}}n.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new L(this.defaults);for(let i in r.tokenizer){if(!(i in s))throw Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,a=r.tokenizer[l],o=s[l];s[l]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=o.apply(s,c)),u}}n.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new j;for(let i in r.hooks){if(!(i in s))throw Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,a=r.hooks[l],o=s[l];j.passThroughHooks.has(i)?s[l]=(c)=>{if(s.options.async&&j.passThroughHooksRespectAsync.has(i))return(async()=>{let p=await a.call(s,c);return o.call(s,p)})();let u=a.call(s,c);return o.call(s,u)}:s[l]=(...c)=>{if(s.options.async)return(async()=>{let p=await a.apply(s,c);return p===!1&&(p=await o.apply(s,c)),p})();let u=a.apply(s,c);return u===!1&&(u=o.apply(s,c)),u}}n.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(l){let a=[];return a.push(i.call(this,l)),s&&B(a,s.call(this,l)),a}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return A.lex(t,e??this.defaults)}parser(t,e){return C.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},s={...this.defaults,...n},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.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(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let l=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(t):t?A.lex:A.lexInline)(l,s),o=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(o,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?C.parse:C.parseInline)(o,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let l=(s.hooks?s.hooks.provideLexer(t):t?A.lex:A.lexInline)(e,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(t):t?C.parse:C.parseInline)(l,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(l){return i(l)}}}onError(t,e){return(r)=>{if(r.message+=`
69
+ Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+w(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},v=new ae;function _(t,e){return v.parse(t,e)}_.options=_.setOptions=function(t){return v.setOptions(t),_.defaults=v.defaults,be(_.defaults),_};_.getDefaults=Y;_.defaults=P;function Qt(...t){return v.use(...t),_.defaults=v.defaults,be(_.defaults),_}_.use=Qt;_.walkTokens=function(t,e){return v.walkTokens(t,e)};_.parseInline=v.parseInline;_.Parser=C;_.parser=C.parse;_.Renderer=K;_.TextRenderer=le;_.Lexer=A;_.lexer=A.lex;_.Tokenizer=L;_.Hooks=j;_.parse=_;var{options:nr,setOptions:ir,walkTokens:lr,parseInline:ar}=_;var ur=C.parse,or=A.lex;var Se=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Be=/[\0-\x1F\x7F-\x9F]/;var Te=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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 ve=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var Ht=class{src_Any=Se.source;src_Cc=Be.source;src_Z=ve.source;src_P=Te.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 n=this.escapeRE(t),s=this.escapeRE(e),i=`(?:(?!${this.src_ZCc}|${n}|${s}).)`,l=`${n}${i}{0,1000}${s}`;for(let a=2;a<=r;a++)l=`${n}(?:${i}|${l}){0,1000}${s}`;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")}},ue={validate:(t,e,r)=>{let n=r.re.get_http_validator();n.lastIndex=e;let s=n.exec(t);return s?s[0].length:0},normalize:(t,e)=>e.normalize(t)},Nt={"http:":ue,"https:":ue,"ftp:":ue,"//":{validate:function(t,e,r){let n=r.re.get_relative_proto_validator();n.lastIndex=e;let s=n.exec(t);if(s){if(e>=3&&t[e-3]===":")return 0;if(e>=3&&t[e-3]==="/")return 0;return s[0].length}return 0},normalize:(t,e)=>e.normalize(t)},"mailto:":{validate:function(t,e,r){let n=r.re.get_mailto_validator();n.lastIndex=e;let s=n.exec(t);return s?s[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(":"),n=e.slice(0,r);for(let s of e.slice(r+1))t.push(n+s)}),t}var Ut={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Xt(),urlAuth:!1,maxLength:1e4},Pe=class{schema;index;lastIndex;raw;text;url;constructor(t,e,r,n){let s=t.slice(r,n);this.schema=e.toLowerCase(),this.index=r,this.lastIndex=n,this.raw=s,this.text=s,this.url=s}},Ie=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:(n,s)=>s.normalize(n),...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 n=this.re.get_fuzzy_mail_host_search(),s=this.re.get_mail_name_validator();n.lastIndex=0;while((e=n.exec(t))!==null){let i=t.slice(Math.max(0,e.index-65),e.index);if(s.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(),n,s,i,l,a,o,c=!1,u=!1,p=!1,f=0;if(!t.length)return null;if(r.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"])n=this.re.get_fuzzy_link_search(),n.lastIndex=0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"])s=this.re.get_fuzzy_mail_host_search(),s.lastIndex=0,i=this.re.get_mail_name_validator();for(;;){let h=Math.max(f-1,0);if(s&&i&&!p&&(!a||a.index<f)){if(s.lastIndex<h)s.lastIndex=h;for(;;){let k=s.exec(t);if(!k){p=!0,a=void 0;break}let b=i.exec(t.slice(Math.max(0,k.index-65),k.index));if(!b)continue;if(a={schema:"mailto:",index:k.index-b[1].length,lastIndex:k.index+k[0].length},a.index>=f)break;if(s.lastIndex<h)s.lastIndex=h}}if(n&&!u&&(!l||l.index<f)){if(n.lastIndex<h)n.lastIndex=h;for(;;){let k=n.exec(t);if(!k){u=!0,l=void 0;break}if(l={schema:"",index:k.index+k[1].length,lastIndex:k.index+k[0].length},l.index>=f)break;if(n.lastIndex<h)n.lastIndex=h}}let x=a;if(!x||l&&(l.index<x.index||l.index===x.index&&l.lastIndex>x.lastIndex))x=l;let D;if(!c)for(;;){if(!o){if(r.lastIndex<h)r.lastIndex=h;let E=r.exec(t);if(!E){c=!0;break}o={schema:E[2],index:E.index+E[1].length,lastIndex:E.index+E[0].length}}if(o.index<f){o=void 0;continue}if(x&&o.index>x.index)break;let k=o;o=void 0;let b=this.testSchemaAt(t,k.schema,k.lastIndex);if(b){D={schema:k.schema,index:k.index,lastIndex:k.lastIndex+b};break}}let g=D;if(!g||a&&(a.index<g.index||a.index===g.index&&a.lastIndex>g.lastIndex))g=a;if(!g||l&&(l.index<g.index||l.index===g.index&&l.lastIndex>g.lastIndex))g=l;if(!g)break;if(g===a)a=void 0;else if(g===l)l=void 0;let m=new Pe(t,g.schema,g.index,g.lastIndex);if(m.schema)this.__schemas__[m.schema].normalize(m,this);else this.normalize(m);e.push(m),f=g.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 n=new Pe(t,e[2],e.index+e[1].length,e.index+e[0].length+r);return this.__schemas__[n.schema].normalize(n,this),n}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 oe(t={}){let{tlds:e,tldsKeepOld:r,schemas:n,...s}=t,i=new Ie({...Kt,...s});return Jt(i,e,r),Vt(i,n),{extensions:[{name:"autolink",level:"inline",start:(l)=>{let a=Le(i,l);if(!a)return;return a.index},tokenizer(l){if(this.lexer.state.inLink)return;let a=Le(i,l);if(!a)return;let o;if(a.index===0)o=a.raw;else if(a.index===1&&l.charAt(0)==="<"&&l.charAt(a.lastIndex)===">")o=`<${a.raw}>`;if(!o)return;return{type:"link",raw:o,text:a.text,href:a.url,tokens:[{type:"text",raw:a.text,text:a.text}]}}}]}}function Le(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,n]of Object.entries(e))t.add(r,n)}var Yt=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,er=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,Ze=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,tr={extensions:[{name:"math",level:"block",tokenizer(t){let e=Ze.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=Ze.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 n=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(t);if(n===null||/^\s|\s$/.test(n[1]))return;return{type:"math",raw:n[0],text:n[1],display:!1}}}]};function Me(){let t=new ae({gfm:!0}),e=oe(),r=e.extensions[0],n=r.tokenizer;r.tokenizer=function(s,i){let l=n.call(this,s,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 o=a[0].length-1,c=l.raw.slice(o).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(c===-1)return l;let u=l.raw.slice(0,o+c),p=l.href.slice(0,l.href.length-(l.raw.length-u.length));return{...l,raw:u,href:p,text:u,tokens:[{type:"text",raw:u,text:u}]}},t.use(tr,e);for(let s of["block","inline"])t.use({extensions:[{name:"internalMessage",level:s,...s==="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((n)=>{let s=e[n];return t[n].href===s?.href&&t[n].title===s.title})}function sr(t,e){let r=2,n=0;for(let i=t.length-1;i>=0;i-=1){if(t[i].type==="space")continue;if(r-=1,r===0){n=i;break}}let s=0;for(let i=0;i<n;i+=1){let l=t[i];if(l.type==="def"||/^ {0,3}(?:\[|<|\$\$|\\\[)/.test(l.raw))return s;let a=!1;if(e.walkTokens([t[i]],(o)=>{if(o.type==="html"&&(("inLink"in o)&&o.inLink||("inRawBlock"in o)&&o.inRawBlock))a=!0}),a)return s;if(/\n[\t ]*\n$/.test(t[i].raw))s=i+1}return s}function qe(t=Me()){let e="",r=[],n={},s={};return{parse(i){let l=i.replaceAll(/\r\n|\r/g,`
70
+ `);if(!l.startsWith(e))e="",r=[],n={},s={};let a=new t.Lexer(t.defaults);a.tokens.links={...n};let o=a.lex(l.slice(e.length)),c=[...r,...o],u=o.links;if(r.length>0&&!rr(s,u)){let h=t.lexer(l);c=[...h],u=h.links}s=u;let p=0,f=[];for(let h of c){if(!l.startsWith(h.raw,p))break;f.push(h),p+=h.raw.length}return r=f.slice(0,sr(f,t)),e=l.slice(0,r.reduce((h,x)=>h+x.raw.length,0)),n=Object.create(null),t.walkTokens(r,(h)=>{if(h.type!=="def")return;let x=h;if(!Object.hasOwn(n,x.tag))n[x.tag]={href:x.href,title:x.title}}),structuredClone(c)}}}var ce=new Map;self.onmessage=(t)=>{let e=t.data;if(e.type==="dispose"){ce.delete(e.clientId);return}let{clientId:r,revision:n,source:s}=e,i;try{let l=ce.get(r);if(l===void 0)l=qe(),ce.set(r,l);i={clientId:r,revision:n,ok:!0,tokens:l.parse(s)}}catch(l){i={clientId:r,revision:n,ok:!1,error:l instanceof Error?l.message:String(l)}}self.postMessage(i)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwith/module-chat",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -335,12 +335,12 @@
335
335
  "prepack": "bun run build && bun test ../../scripts/__tests__/chat-worker-distribution.test.ts"
336
336
  },
337
337
  "devDependencies": {
338
- "@agentclientprotocol/sdk": "^2.0.2",
338
+ "@agentclientprotocol/sdk": "^2.1.0",
339
339
  "@alwith/api": "^0.5.4",
340
340
  "@happy-dom/global-registrator": "^21.0.4",
341
341
  "@nyssance/codex-acp-v2": "^0.7.43",
342
342
  "@testing-library/dom": "^10.4.2",
343
- "@testing-library/jest-dom": "^6.6.3",
343
+ "@testing-library/jest-dom": "^6.9.1",
344
344
  "@testing-library/react": "^16.3.3",
345
345
  "@types/react": "^19.3.0",
346
346
  "@types/react-dom": "^19.3.0",
@@ -352,8 +352,8 @@
352
352
  "entities": "^8.1.0",
353
353
  "highlight.js": "^11.12.0",
354
354
  "katex": "^0.19.1",
355
- "lucide-react": "^1.61.0",
356
- "marked": "^18.1.1",
355
+ "lucide-react": "^1.64.0",
356
+ "marked": "^18.1.2",
357
357
  "marked-linkify-it": "^4.0.2",
358
358
  "cn": "^0.5.0",
359
359
  "ansi_up": "^6.0.6",
@@ -1,2 +0,0 @@
1
- import{o}from"./chunk-dp8pjv6r.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{n}from"./chunk-ysc51tpb.js";import{y,ne}from"./chunk-g5tsnsqt.js";import{hasAccount as D}from"@nyssance/codex-acp-v2/client";import{cn as M}from"cn";import{useEffect as C,useState as L}from"react";import{jsx as a,jsxs as c}from"react/jsx-runtime";var d=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),H=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),T=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function p(e){return typeof e==="number"&&!Number.isNaN(e)?Math.max(0,e):0}function W(e,t){let r=Math.min(100,e/t*100),s=r>=90?"text-destructive":r>=70?"text-foreground":"text-muted-foreground";return{pct:r,className:s}}function F(e){let t=y(e.configOptions,"model");return t===void 0?void 0:ne(t)}function Oo(e,t){let r=e.windowDurationMins;if(r===null)return t("usage.usage");if(r%1440===0)return t("usage.windowDays",{count:r/1440});return t("usage.windowHours",{count:Math.round(r/60)})}function z(){let{client:e}=n(),t=o((i)=>i.connection==="ready"&&D(i.agent)),[r,s]=L(null);return C(()=>{if(!t){s(null);return}let i=!0;e.readRateLimits().then((m)=>{if(i)s(m)},()=>{return});let l=e.onRateLimits((m)=>{if(i)s(m)});return()=>{i=!1,l()}},[t,e]),r}function dt({session:e}){let{t}=n().host,r=z(),{usage:s,lastTurnUsage:i}=e;if(s===null&&i===null)return null;let l=s&&s.size>0?W(s.used,s.size):null,m=7,N=2*Math.PI*m,x=p(i?.inputTokens),h=p(i?.outputTokens),f=p(i?.cachedReadTokens),v=p(i?.cachedWriteTokens),b=p(i?.totalTokens)||x+h+f+v,k=x+f,w=k>0?H.format(f/k):t("tokens.notAvailable"),R=[[t("tokens.input"),d.format(x)],[t("tokens.output"),d.format(h)],[t("tokens.cachedRead"),d.format(f)],[t("tokens.cachedWrite"),d.format(v)],[t("tokens.cacheHitRate"),w],[t("tokens.total"),d.format(b)]],g=F(e);return c(Ae,{children:[a(Le,{delay:100,closeDelay:100,render:c("button",{type:"button",className:M("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",l?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[c("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[a("circle",{cx:"9",cy:"9",r:m,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),l!==null&&a("circle",{cx:"9",cy:"9",r:m,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:N,strokeDashoffset:N*(1-l.pct/100),transform:"rotate(-90 9 9)"})]}),l!==null&&c("span",{children:[Math.round(l.pct),"%"]})]})}),c(De,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[g!==void 0&&a("div",{className:"border-b px-3 py-2",children:a("p",{className:"text-foreground truncate text-xs font-semibold",title:g,children:g})}),c("div",{className:"flex flex-col gap-3 p-3",children:[i!==null&&c("div",{className:"flex flex-col gap-1.5",children:[a("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),a("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:R.map(([u,S])=>c("div",{className:"contents",children:[a("dt",{className:"text-muted-foreground",children:u}),a("dd",{className:"text-end tabular-nums",children:S})]},u))})]}),s!==null&&s.size>0&&c("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[a("p",{className:"text-xs font-medium",children:t("tokens.context")}),a("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:d.format(s.used),limit:d.format(s.size),percent:T.format(s.used/s.size*100)})})]}),r!==null&&(r.primary!==null||r.secondary!==null)&&c("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[a("p",{className:"text-xs font-medium",children:t("usage.limits")}),a("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[r.primary,r.secondary].filter((u)=>u!==null).map((u)=>c("div",{className:"contents",children:[a("dt",{className:"text-muted-foreground",children:Oo(u,t)}),a("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,u.usedPercent)))})})]},`${u.windowDurationMins??"window"}`))})]})]})]})]})}
2
- export{Oo,dt};