flintmaker 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -6
- package/dist/chunks/chunk-2DDAUP6P.js +23 -0
- package/dist/chunks/chunk-2XK6FXMP.js +72 -0
- package/dist/chunks/chunk-5PRYZOW7.js +1 -0
- package/dist/chunks/chunk-EUPBID7K.js +1 -0
- package/dist/chunks/chunk-HEEZNIZR.js +9 -0
- package/dist/chunks/chunk-K3ZZ2VJH.js +6 -0
- package/dist/chunks/highlight-QJIBHZTN.js +7 -0
- package/dist/chunks/plain-EQXWFHTX.js +5 -0
- package/dist/chunks/render-Q3KDKHPR.js +1 -0
- package/dist/chunks/repl-LUJ6BCT7.js +27 -0
- package/dist/chunks/update-TVZWTPD2.js +17 -0
- package/dist/flint.js +53 -997
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -4,14 +4,62 @@
|
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install -g flintmaker
|
|
7
|
-
flint login
|
|
7
|
+
flint login # connect your FlintMaker account (opens the browser)
|
|
8
8
|
cd my-project
|
|
9
|
-
flint
|
|
10
|
-
flint "add a dark mode toggle"
|
|
9
|
+
flint # interactive session
|
|
10
|
+
flint "add a dark mode toggle" # one task, then exit (plain output, fine for scripts)
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
```text
|
|
14
|
+
╭────────────────────────────────────────────────────────────╮
|
|
15
|
+
│ ✦ FlintMaker flint v0.2.0 │
|
|
16
|
+
│ ▟█▙ you@example.com · Blaze · 1,200 credits left │
|
|
17
|
+
│ ▟███▙ model Standard · ~/code/my-app │
|
|
18
|
+
╰────────────────────────────────────────────────────────────╯
|
|
19
|
+
|
|
20
|
+
❯ fix the failing date test in @src/date.ts
|
|
21
|
+
|
|
22
|
+
● Read src/date.ts (84 lines)
|
|
23
|
+
● Edit src/date.ts
|
|
24
|
+
┌ src/date.ts +2 -1
|
|
25
|
+
│ 41 - return d.getDay()
|
|
26
|
+
│ 41 + return d.getUTCDay()
|
|
27
|
+
└
|
|
28
|
+
⎿ Updated · +2 -1
|
|
29
|
+
● Run npm test
|
|
30
|
+
⎿ ✓ 42 tests passed
|
|
31
|
+
|
|
32
|
+
✳ Forging… (6s · 4 credits · esc to interrupt)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**In a session**
|
|
36
|
+
|
|
37
|
+
- `enter` sends · `shift+enter`, `ctrl+j` or a trailing `\` adds a line · paste keeps blocks intact
|
|
38
|
+
- `@path` attaches a file (tab completes paths) · `↑/↓` history (kept in `~/.flintmaker/history`)
|
|
39
|
+
- `esc` interrupts the current step · `ctrl+c` twice exits
|
|
40
|
+
- `shift+tab` switches mode: **ask before edits** → **auto-accept edits** → **plan only (no changes)**
|
|
41
|
+
- `/help` `/model` `/mode` `/clear` `/compact` `/credits` `/init` `/login` `/logout` `/exit`
|
|
42
|
+
- `/init` writes `FLINT.md`, a short project memory flint reads at the start of every conversation
|
|
43
|
+
- flint can search the web and read docs pages (current versions, error messages) and cites the URLs. These run on FlintMaker's servers, never touch your machine, and cost 2 credits per search and 1 per page (at most 5 searches and 8 pages per message). Page text is treated as information, never as instructions.
|
|
44
|
+
|
|
45
|
+
**Safety**
|
|
46
|
+
|
|
47
|
+
- Every file change is shown as a full diff and needs your approval (1 = yes, 2 = yes for the rest of the session, 3 = no and say what to do instead).
|
|
48
|
+
- Commands run only after you approve them; chained or risky commands are always asked about.
|
|
49
|
+
- Secret files such as `.env` and private keys are never read, and nothing outside the project folder is touched.
|
|
50
|
+
|
|
51
|
+
**Windows**
|
|
52
|
+
|
|
53
|
+
- Works in PowerShell, Command Prompt (cmd) and Windows Terminal. `flintmaker` is an alias for `flint`.
|
|
54
|
+
- Commands run in `cmd.exe` by default; set `FLINT_SHELL=powershell` (or `pwsh`) to use PowerShell. flint tells the model which OS and shell you use, so it suggests commands that work there.
|
|
55
|
+
- `flint` is not recognized? Add `%APPDATA%\npm` to your PATH (Settings → Environment variables), then open a new terminal.
|
|
56
|
+
- PowerShell says running scripts is disabled? Run `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned` once.
|
|
57
|
+
- Files keep their line endings (CRLF stays CRLF). In the old console window, symbols fall back to plain ASCII (`FLINT_ASCII=1` / `FLINT_UNICODE=1` to force).
|
|
58
|
+
|
|
59
|
+
**Updates**
|
|
60
|
+
|
|
61
|
+
flint checks for a new version once a day in the background and installs it when it was installed with `npm i -g` or the FlintMaker installer (never with sudo); restart to use it. `flint update` updates right away. Turn it off with `FLINT_NO_UPDATE=1` (it is also off when `CI` is set).
|
|
62
|
+
|
|
63
|
+
Uses credits from your FlintMaker plan — see [pricing](https://flintmaker.com/pricing). Respects `NO_COLOR`.
|
|
16
64
|
|
|
17
65
|
Made by PT Jiji Labs Digital · hello@jijilabsdigital.com
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{c as b,n as _}from"./chunk-K3ZZ2VJH.js";var S="Interrupted by the user before this finished.",h=class extends Error{},D={list_files:e=>String(e.path??"."),read_file:e=>`${e.path}${e.start_line?`:${e.start_line}-${e.end_line??""}`:""}`,search:e=>`/${e.pattern}/ ${e.path??""}`.trim(),write_file:e=>String(e.path),edit_file:e=>String(e.path),run_command:e=>String(e.command),web_search:e=>`"${e.query??""}"`,web_fetch:e=>String(e.url??"").replace(/^https?:\/\//,"").replace(/\/$/,"")},T=(e,n)=>typeof e=="object"?e.declined:n;async function L(e,n,t,r,i){switch(n){case"list_files":return e.listFiles(typeof t.path=="string"?t.path:".");case"read_file":return e.readFile(String(t.path),R(t.start_line),R(t.end_line));case"search":return e.search(String(t.pattern??""),typeof t.path=="string"?t.path:".");case"write_file":case"edit_file":{let s=await e.plan(n,t),o=await r.approveChange(s);return o!==!0?T(o,"The user declined this change. Ask what they want instead, or try a different approach."):i?.aborted?S:(await s.apply(),`${s.created?"Created":"Updated"} ${s.path}.`)}case"run_command":{let s=String(t.command??"").trim();if(!s)throw new Error("command is required");let o=await r.approveCommand(s);return o!==!0?T(o,"The user declined to run this command."):i?.aborted?S:e.runCommand(s,void 0,i)}default:throw new Error(`unknown tool ${n}`)}}var R=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0;function F(e){let n=structuredClone(e),t=n.map((r,i)=>({m:r,i})).filter(r=>r.m.role==="tool"&&(r.m.content?.length??0)>400);for(let{m:r}of t.slice(0,Math.max(1,Math.ceil(t.length/2))))r.role==="tool"&&(r.content=`${r.content.slice(0,300)}
|
|
2
|
+
[output trimmed to save context; read again if needed]`);return t.length===0&&n.length>4&&n.splice(1,2),n}async function X(e,n,t,r,i={}){let s=[...n],o=i.signal;try{for(let l=0;l<(i.maxSteps??25);l++){if(o?.aborted)return s;let c=null,m="",w=a=>{m+=a,r.onDelta(a)};for(let a=0;a<4&&!c;a++)try{m="",c=await t(s,w)}catch(g){if(o?.aborted)return m&&s.push({role:"assistant",content:m}),s;if(!(g instanceof h))throw g;s=F(s)}if(!c)throw new Error("This conversation is too long. Start a new one with /clear.");if(c.toolCalls.length===0)return s.push({role:"assistant",content:c.text}),s;s.push({role:"assistant",content:c.text||null,tool_calls:c.toolCalls.map(a=>({id:a.id,type:"function",function:{name:a.name,arguments:a.arguments}}))});for(let a of c.toolCalls){if(o?.aborted){s.push({role:"tool",tool_call_id:a.id,content:S});continue}let g={};try{g=JSON.parse(a.arguments||"{}")}catch{}r.onToolStart(a.name,(D[a.name]??(()=>""))(g),g);let d,u=c.serverResults?.[a.id];if(u){d=u.content,r.onToolResult(a.name,u.ok,u.ok?d:d.replace(/^Error: /,"")),s.push({role:"tool",tool_call_id:a.id,content:d});continue}try{d=await L(e,a.name,g,r,o),r.onToolResult(a.name,!0,d)}catch(E){d=`Error: ${E.message}`,r.onToolResult(a.name,!1,E.message)}s.push({role:"tool",tool_call_id:a.id,content:d})}}}catch(l){throw l&&typeof l=="object"&&Object.assign(l,{partial:s}),l}return s.push({role:"assistant",content:"I stopped after many steps. Tell me how to continue."}),s}function $(){let e="";return n=>{e+=n;let t=e.split(`
|
|
3
|
+
|
|
4
|
+
`);return e=t.pop()??"",t.filter(Boolean).map(r=>{let i="message",s=[];for(let o of r.split(`
|
|
5
|
+
`))o.startsWith("event:")?i=o.slice(6).trim():o.startsWith("data:")&&s.push(o.slice(5).replace(/^ /,""));return{event:i,data:s.join(`
|
|
6
|
+
`)}})}}var p=class extends Error{constructor(t,r="error",i=0){super(t);this.reason=r;this.status=i}reason;status},U=e=>e?new Date(e).toLocaleString(void 0,{weekday:"short",hour:"2-digit",minute:"2-digit"}):"soon";async function C(e,n){let t=await e.json().catch(()=>({})),r=t.requestId?` (ref ${t.requestId})`:"";switch(t.reason){case"signed_out":return new p("You are signed out. Run: flint login","signed_out",e.status);case"limit":return new p(`Out of credits until ${U(t.resetAt)}. Get more at ${n}/pricing`,"limit",e.status);case"busy":return new p("FlintMaker is very busy right now. Please try again later.","busy",e.status);case"upgrade_required":return new p(`The smart model needs a paid plan: ${n}/pricing`,"upgrade_required",e.status);case"in_progress":return new p("Another flint session is still working. Wait for it to finish.","in_progress",e.status);default:return new p(`Request failed (${e.status} ${t.reason??""})${r}`,t.reason??"error",e.status)}}var M=class{constructor(n,t){this.base=n;this.token=t}base;token;headers(){return{"content-type":"application/json","user-agent":"flint-cli",...this.token?{authorization:`Bearer ${this.token}`}:{}}}async json(n,t={}){let r=await fetch(`${this.base}/api${n}`,{...t,headers:{...this.headers(),...t.headers}});if(!r.ok)throw await C(r,this.base);return await r.json()}me(){return this.json("/me")}async deviceLogin(n,t){let r=await this.json("/auth/device",{method:"POST",body:"{}"});n(r.userCode,r.verifyUrl);let i=Date.now()+r.expiresIn*1e3;for(;Date.now()<i;){if(await new Promise(o=>setTimeout(o,r.interval*1e3)),t?.aborted)throw new p("Login cancelled.","cancelled");let s=await fetch(`${this.base}/api/auth/device/token`,{method:"POST",headers:this.headers(),body:JSON.stringify({deviceCode:r.deviceCode})});if(s.status!==428){if(s.ok)return await s.json();throw new p("The login code expired. Run flint login again.","expired",s.status)}}throw new p("The login code expired. Run flint login again.","expired")}stepper(n,t,r){return async(i,s)=>{let o=await fetch(`${this.base}/api/agent`,{method:"POST",headers:{...this.headers(),"x-flint-features":"web"},body:JSON.stringify({messages:i,model:n()}),signal:t()});if(o.status===413)throw new h;if(!o.ok||!o.body)throw await C(o,this.base);let l=$(),c=new TextDecoder,m="",w=[],a={};for await(let g of o.body)for(let d of l(c.decode(g,{stream:!0}))){let u=d.data?JSON.parse(d.data):{};if(d.event==="delta")m+=u.text,s(u.text);else if(d.event==="tool_call")w.push(u);else if(d.event==="tool_result")a[u.id]={ok:u.ok!==!1,content:String(u.content??"")};else if(d.event==="done")r(u.credits,u.usage);else if(d.event==="error")throw new p(`The model hit a problem; no credits were used.${u.requestId?` (ref ${u.requestId})`:""}`,"model")}return{text:m,toolCalls:w,serverResults:a}}}};var A="https://flintmaker.com/pricing";function W(e){let n=e;return n?.name==="TypeError"&&/fetch failed|network/i.test(n.message??"")||["ECONNREFUSED","ENOTFOUND","ECONNRESET","ETIMEDOUT","EAI_AGAIN","UND_ERR_SOCKET","UND_ERR_CONNECT_TIMEOUT"].includes(n?.cause?.code??"")}function oe(e,n={}){let t=n.interactive?"Run /login to connect your FlintMaker account.":"Run: flint login",r=n.retry?[n.retry]:[];if(W(e))return{title:"Can't reach FlintMaker",lines:["Check your internet connection, then try again.",...r],tone:"warn"};if(e instanceof p)switch(e.reason){case"signed_out":return{title:"You are signed out",lines:[t],tone:"warn"};case"limit":return{title:"Out of credits",lines:[e.message.replace(/\. Get more at .*$/,"."),`Upgrade or top up: ${A}`],tone:"warn"};case"upgrade_required":return{title:"Smart needs a paid plan",lines:["Switch back with /model standard, or upgrade:",A],tone:"warn"};case"busy":return{title:"FlintMaker is very busy",lines:["Please try again in a minute.",...r],tone:"warn"};case"in_progress":return{title:"Another flint session is working",lines:["Wait for it to finish, then try again."],tone:"warn"};case"model":return{title:"The model hit a problem",lines:[e.message,...r],tone:"error"};default:return{title:"Something went wrong",lines:[e.message,...r],tone:"error"}}return{title:"Something went wrong",lines:[e?.message??String(e)],tone:"error"}}var k=null,N=[];function ae(e){k?k(e):N.push(e)}function le(e){if(k=e,e)for(let n of N.splice(0))e(n)}import{readdirSync as q}from"node:fs";import{join as B,sep as z}from"node:path";var y=[{name:"help",description:"Show commands and keyboard shortcuts"},{name:"model",args:"[standard|smart]",description:"Switch model and see credit costs"},{name:"mode",args:"[ask|auto|plan]",description:"Change when flint asks before acting (or Shift+Tab)"},{name:"clear",description:"Start a new conversation",aliases:["new","reset"]},{name:"compact",description:"Summarise the conversation to free up context"},{name:"credits",description:"Show credit usage and plans",aliases:["usage"]},{name:"init",description:"Create FLINT.md, the project memory flint reads first"},{name:"login",description:"Connect another FlintMaker account"},{name:"logout",description:"Disconnect this computer"},{name:"exit",description:"Quit flint",aliases:["quit","q"]}];function pe(e){let n=/^\/([a-zA-Z][\w-]*)(?:\s+([\s\S]*))?$/.exec(e.trim());if(!n)return null;let t=n[1].toLowerCase(),r=y.find(i=>i.name===t||i.aliases?.includes(t));return!r&&(t==="smart"||t==="standard")?{name:"model",args:t,command:y.find(i=>i.name==="model")}:{name:r?.name??t,args:(n[2]??"").trim(),command:r}}function G(e,n){let t=Array.from({length:n.length+1},(r,i)=>i);for(let r=1;r<=e.length;r++){let i=t[0];t[0]=r;for(let s=1;s<=n.length;s++){let o=t[s];t[s]=Math.min(t[s]+1,t[s-1]+1,i+(e[r-1]===n[s-1]?0:1)),i=o}}return t[n.length]}function me(e){let n=null,t=1/0;for(let r of y)for(let i of[r.name,...r.aliases??[]]){let s=i.startsWith(e)?0:G(e,i);s<t&&(t=s,n=r.name)}return t<=Math.max(2,Math.floor(e.length/3))?n:null}function ge(e){let n=e.replace(/^\//,"").toLowerCase();return y.filter(t=>t.name.startsWith(n)||t.aliases?.some(r=>r.startsWith(n)))}function he(e){if(e.length===0)return"";let n=e[0];for(let t of e.slice(1))for(;!t.startsWith(n);)n=n.slice(0,-1);return n}var J=new Set(["node_modules",".git","dist","build",".next","coverage",".venv","__pycache__","DerivedData","Pods"]);function fe(e,n){let t=n.lastIndexOf("/"),r=t>=0?n.slice(0,t+1):"",i=t>=0?n.slice(t+1):n;if(r.split("/").includes("..")||r.startsWith("/"))return[];let s;try{s=q(B(e,r.split("/").join(z)),{withFileTypes:!0})}catch{return[]}return s.filter(o=>o.name.startsWith(i)&&!J.has(o.name)&&(i.startsWith(".")||!o.name.startsWith(".")||o.name===".github")).map(o=>r+o.name+(o.isDirectory()?"/":"")).sort((o,l)=>Number(l.endsWith("/"))-Number(o.endsWith("/"))||o.localeCompare(l)).slice(0,50)}function P(e){let n=new Set;for(let t of e.matchAll(/(?:^|\s)@((?:[\w.-]+\/)*[\w.-]+)/g))n.add(t[1]);return[...n]}import{readFileSync as I,statSync as Y}from"node:fs";import{join as K}from"node:path";var x="FLINT.md",j=2e4,f=e=>e.toLocaleString("en-US");function ke(e){return e.creditsLeftToday!==null?`${f(e.creditsLeftToday)} credits left today`:`${f(e.creditsLeftMonth)} credits left`}function ve(e){let n=r=>new Date(r).toLocaleString(void 0,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),t=[`Plan: ${e.plan.charAt(0).toUpperCase()+e.plan.slice(1)}`];return e.creditsLeftToday!==null&&t.push(`Today: ${f(e.creditsLeftToday)} credits left (resets ${n(e.resetAt)})`),t.push(`This period: ${f(e.creditsLeftMonth)} of ${f(e.monthlyCredits)} credits left (resets ${n(e.monthResetAt)})`),t}var Ee={standard:{label:"Standard",cost:"\u22482\u20133 credits per step",note:"fast, great for most tasks \xB7 all plans"},smart:{label:"Smart",cost:"\u22482\u20138 credits per step",note:"stronger reasoning, longer answers \xB7 paid plans"}},_e=`Create ${x} in the project root: a concise project memory that you will read at the start of every future conversation.
|
|
7
|
+
First explore the project (list files, read the README, package/config files and a few key sources). Then write ${x} (max ~60 lines) with:
|
|
8
|
+
- What the project is, in 1\u20132 sentences
|
|
9
|
+
- Tech stack and layout (key directories and entry points)
|
|
10
|
+
- How to install, build, run, test and lint (exact commands)
|
|
11
|
+
- Code style and conventions worth following
|
|
12
|
+
- Anything surprising (gotchas, generated files, things not to touch)
|
|
13
|
+
Do not include secrets. Keep it factual and short.`,Te=`Summarise our conversation so far so we can continue in a fresh context. Do not call any tools.
|
|
14
|
+
Include: the goal, decisions made, files changed (with what changed), commands run and their outcomes, open problems and next steps.
|
|
15
|
+
Be concise but keep exact file paths, names and error messages.`,H="[Plan mode is on: do not change files or run commands. Explore with read-only tools (list_files, read_file, search) and reply with a clear, numbered plan. The user will switch modes to let you carry it out.]";function V(e){let n=K(e,x);try{return Y(n).size>j?I(n,"utf8").slice(0,j)+`
|
|
16
|
+
[truncated]`:I(n,"utf8")}catch{return null}}async function Re(e,n,t){let r=[],i=[],s=!1;if(t.first){i.push(_());let o=V(e.root);o&&(s=!0,i.push(`<project-memory file="${x}">
|
|
17
|
+
${o.trim()}
|
|
18
|
+
</project-memory>`))}t.mode==="plan"&&i.push(H),i.push(n);for(let o of P(n))try{let l=await e.readFile(o),c=l.split(`
|
|
19
|
+
`).filter(m=>/^\d+\t/.test(m)).length;r.push({path:o,lines:c}),i.push(`<file path="${o}">
|
|
20
|
+
${l}
|
|
21
|
+
</file>`)}catch(l){let c=l.message;r.push({path:o,error:/ENOENT|no such file/.test(c)?"not found":c.replace(`${o} `,"")})}return{content:i.join(`
|
|
22
|
+
|
|
23
|
+
`),attachments:r,memory:s}}var v=new Set(["rm","rmdir","sudo","su","doas","dd","mkfs","shred","curl","wget","ssh","scp","sh","bash","zsh","fish","eval","exec","xargs","env","chmod","chown","kill","killall","git push"]),Q=new Set(["del","erase","rd","rmdir","format","cmd","powershell","pwsh","start","reg","regedit","taskkill","runas","icacls","takeown","attrib","cipher","diskpart","bcdedit","schtasks","sc","net","netsh","wsl","certutil","bitsadmin","mshta","rundll32","wscript","cscript","remove-item","invoke-expression","iex","invoke-webrequest","iwr","curl.exe","move","ren","rename","copy","xcopy","robocopy","mklink","setx","stop-process"]),O=new Set(["node","py","python","python3","ruby","perl","php","deno","bun","npx","pnpx","bunx"]);function $e(e,n=process.platform){let t=e.trim();if(!t||/[;&|<>`$(){}\n\r\\*?!~#'"]/.test(t)||b(n)&&/[%^]/.test(t))return null;let[r,i]=t.split(/\s+/),s=b(n),o=s?r.split("/").pop().toLowerCase().replace(/\.(exe|cmd|bat|com|ps1)$/,""):r.split("/").pop();if(v.has(o)||s&&Q.has(o))return null;let l=i&&/^[a-z][\w:-]*$/i.test(i)?`${r} ${i}`:r;return v.has(l)||s&&v.has(`${o} ${i?.toLowerCase()}`)||O.has(o)&&l===r||O.has(o)&&["npx","pnpx","bunx"].includes(o)?null:l}export{S as a,h as b,F as c,X as d,p as e,M as f,A as g,oe as h,ae as i,le as j,y as k,pe as l,me as m,ge as n,he as o,fe as p,x as q,f as r,ke as s,ve as t,Ee as u,_e as v,Te as w,Re as x,$e as y};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import{a as H,c as P,d as fe,e as de,g as xe}from"./chunk-HEEZNIZR.js";import{b as f}from"./chunk-5PRYZOW7.js";function ee(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var v=ee();function _e(r){v=r}var E={exec:()=>null};function I(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),n=e[s];return n||(n=r(s),e[s]=n),n}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(y.caret,"$1"),t=t.replace(n,l),s},getRegex:()=>new RegExp(t,e)};return s}var je=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),y={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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:I(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:I(r=>new RegExp(`^ {0,${r}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:I(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:I(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:I(r=>new RegExp(`^ {0,${r}}(?:</?(?:${Q})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:I(r=>new RegExp(`^ {0,${r}}>`))},He=/^(?:[ \t]*(?:\n|$))+/,Ne=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fe=/^ {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+|$)/,te=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Pe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Le=g(Pe).replace(/bull/g,te).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(Pe).replace(/bull/g,te).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(),re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ue=/^[^\n]+/,ne=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,We=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ne).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Je=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,te).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",se=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ke=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[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",se).replace("tag",Q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ee=r=>g(re).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",r).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",Q).getRegex(),Ve=Ee(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ye=Ee(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),et=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ye).getRegex(),ie={blockquote:et,code:Ne,def:We,fences:Fe,heading:Ge,hr:M,html:Ke,lheading:Le,list:Je,newline:He,paragraph:Ve,table:E,text:Ue},be=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} )[^\\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(),tt={...ie,lheading:Xe,table:be,paragraph:g(re).replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",be).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()},rt={...ie,html:g(`^ *(?: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:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(re).replace("hr",M).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",Le).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,st=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ce=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,it=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,j=/[^\s\p{P}\p{S}]/u,lt=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,B).getRegex(),at=/[\p{Pi}\p{Ps}"']/u,ve=/(?!~)[\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-",je?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ie=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pt=g(Ie,"u").replace(/punct/g,T).getRegex(),ut=g(Ie,"u").replace(/punct/g,ve).getRegex(),gt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,kt=g(gt,"u").replace(/openQuote/g,at).replace(/punct/g,T).getRegex(),Be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ft=g(Be,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,T).getRegex(),dt=g(Be,"gu").replace(/notPunctSpace/g,ct).replace(/punctSpace/g,ot).replace(/punct/g,ve).getRegex(),xt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",bt=g(xt,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,T).getRegex(),mt=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,T).getRegex(),wt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",yt=g(wt,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,T).getRegex(),$t=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),St="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Rt=g(St,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,T).getRegex(),Tt=g(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),At=g(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,T).getRegex(),zt=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(),_t=g(se).replace("(?:-->|$)","-->").getRegex(),Pt=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",_t).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,F=g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",qe).getRegex(),Lt=g(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",F).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Et=g(/^!?\[(label)\]\[(ref)\]/).replace("label",F).replace("ref",ne).getRegex(),Ct=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",ne).getRegex(),me=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,vt=g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",qe).getRegex(),It=g("reflink|nolink(?!\\()","g").replace("reflink",g(/^!?\[(label)\]\[(ref)\]/).replace("label",vt).replace("ref",me).getRegex()).replace("nolink",g(/^!?\[(ref)\](?:\[\])?/).replace("ref",me).getRegex()).getRegex(),we=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bt=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,qt=g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Bt).getRegex(),le={_backpedal:E,anyPunctuation:Tt,anyPunctuationOutsideCode:At,autolink:zt,blockSkip:ht,br:Ce,code:st,del:E,delLDelim:E,delRDelim:E,emStrongLDelim:pt,emStrongRDelimAst:ft,emStrongRDelimUnd:mt,escape:nt,link:Lt,nolink:Ct,punctuation:lt,reflink:Et,reflinkSearch:It,tag:Pt,text:it,url:E},Zt={...le,emStrongLDelim:kt,emStrongRDelimAst:bt,emStrongRDelimUnd:yt,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",F).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",F).getRegex()},K={...le,emStrongRDelimAst:dt,emStrongLDelim:ut,delLDelim:$t,delRDelim:Rt,url:g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",qt).replace("protocol",we).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",we).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Dt={...K,br:g(Ce).replace("{2,}","*").getRegex(),text:g(K.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},N={normal:ie,gfm:tt,pedantic:rt},D={normal:le,gfm:K,breaks:Dt,pedantic:Zt},Ot={"&":"&","<":"<",">":">",'"':""","'":"'"},ye=r=>Ot[r];function $(r,e){if(e){if(y.escapeTest.test(r))return r.replace(y.escapeReplace,ye)}else if(y.escapeTestNoEncode.test(r))return r.replace(y.escapeReplaceNoEncode,ye);return r}function Mt(r){return y.numericCharacterReference.test(r)?r.replace(y.numericCharacterReferenceOrAmpersand,(e,t,s)=>{if(t===void 0&&s===void 0)return"&";let n=t===void 0?Number.parseInt(s,16):Number.parseInt(t,10);return n===0||n>1114111||n>=55296&&n<=57343?"\uFFFD":n===38?"&":String.fromCodePoint(n)}):r}function $e(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function Se(r,e){let t=r.replace(y.findPipe,(i,l,a)=>{let h=!1,o=l;for(;--o>=0&&a[o]==="\\";)h=!h;return h?"|":" |"}),s=t.split(y.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(y.slashPipe,"|");return s}function z(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let i=r.charAt(s-n-1);if(i===e&&!t)n++;else if(i!==e&&t)n++;else break}return r.slice(0,s-n)}function Re(r){let e=r.split(`
|
|
3
|
+
`),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
|
|
4
|
+
`)}function G(r){return r.trim().toLowerCase().toUpperCase().toLowerCase()}function Te(r,e){if(r.indexOf(e[0])===-1&&r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function J(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=n,t++;return s}function Ae(r,e,t,s,n){let i=e.href,l=e.title||null,a=r[1].replace(n.other.outputLinkReplace,"$1"),h=r[0].charAt(0)==="!",o=s.state.inLink,c=s.state.linkEmitted,p=s.state.inRawBlock;s.state.inLink=!0,s.state.linkEmitted=!1;let k=s.inlineTokens(a),u=s.state.linkEmitted;if(s.state.linkEmitted=c,s.state.inLink=o,!h){if(u){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:h?"image":"link",raw:t,href:i,title:l,text:a,tokens:k}}function Qt(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
|
|
5
|
+
`).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[a]=l;return i.slice(Math.min(a.length,n.length))}).join(`
|
|
6
|
+
`)}function ze(r,e,t,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=r.slice(t+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 X=class{options;rules;lexer;constructor(r){this.options=r||v}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:Re(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=Qt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=z(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceTabChar.test(s))&&(t=s.trim())}return{type:"heading",raw:z(e[0],`
|
|
7
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:z(e[0],`
|
|
8
|
+
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=z(e[0],`
|
|
9
|
+
`).split(`
|
|
10
|
+
`),s="",n="",i=[];for(;t.length>0;){let l=!1,a=[],h;for(h=0;h<t.length;h++)if(this.rules.other.blockquoteStart.test(t[h]))a.push(t[h]),l=!0;else if(!l)a.push(t[h]);else break;t=t.slice(h);let o=a.join(`
|
|
11
|
+
`),c=o.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
13
|
+
${o}`:o,n=n?`${n}
|
|
14
|
+
${c}`:c;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=p,t.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 u=k,m=t.join(`
|
|
15
|
+
`),w=u.raw+`
|
|
16
|
+
`+m.replace(this.rules.other.blockquoteSetextReplace2,""),x=this.blockquote(w);i[i.length-1]=x;let _=w.substring(x.raw.length).replace(/^\n/,""),b=_?_.split(`
|
|
17
|
+
`).length:0,q=b?t.slice(0,-b):t;q.length>0&&(s=`${s}
|
|
18
|
+
${q.join(`
|
|
19
|
+
`)}`),n=n.substring(0,n.length-u.text.length)+x.text;break}else if(k?.type==="list"){let u=k,m=u.raw+`
|
|
20
|
+
`+t.join(`
|
|
21
|
+
`),w=this.list(m);i[i.length-1]=w,s=s.substring(0,s.length-k.raw.length)+w.raw,n=n.substring(0,n.length-u.raw.length)+w.raw,t=m.substring(i.at(-1).raw.length).split(`
|
|
22
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=r,s=()=>t.length-r.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),h=!1;for(;r;){let c=!1,p="";if(!(e=a.exec(r))||this.rules.block.hr.test(r))break;let k=s();r=r.substring(e[0].length);let u=e[2].split(`
|
|
23
|
+
`,1)[0],m=e[1].length,w=this.options.pedantic?J(u,m):u.replace(this.rules.other.leadingSpaceTab,W=>J(W,m)),x=r.split(`
|
|
24
|
+
`,1)[0],_=!w.trim(),b=0;if(this.options.pedantic?(b=2,p=w.trimStart()):_?b=m+1:(b=w.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=w.slice(b),b+=m),_&&this.rules.other.blankLine.test(x)&&(r=r.substring(x.length+1),c=!0),!c){let W=this.rules.other.nextBulletRegex(b),pe=this.rules.other.hrRegex(b),ue=this.rules.other.fencesBeginRegex(b),ge=this.rules.other.headingBeginRegex(b),Oe=this.rules.other.htmlBeginRegex(b),Me=this.rules.other.blockquoteBeginRegex(b);for(;r;){let ke=r.split(`
|
|
25
|
+
`,1)[0],Z;if(x=ke,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),Z=x):Z=x.replace(this.rules.other.leadingSpaceTab,Qe=>J(Qe)),ue.test(x)||ge.test(x)||Oe.test(x)||Me.test(x)||W.test(x)||pe.test(x))break;if(Z.search(this.rules.other.nonSpaceChar)>=b||!x.trim())p+=`
|
|
26
|
+
`+Z.slice(b);else{if(_||w.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ue.test(w)||ge.test(w)||pe.test(w))break;p+=`
|
|
27
|
+
`+x}_=!x.trim(),r=r.substring(ke.length+1),w=Z.slice(b)}}let q=t.slice(k,s());l.loose||(h?l.loose=!0:this.rules.other.doubleBlankLine.test(q)&&(h=!0)),l.items.push({type:"list_item",raw:q,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]})}let o=l.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;l.raw=t.slice(0,s()).trimEnd();for(let c of l.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!l.loose){let p=c.tokens.filter(u=>u.type==="space"),k=p.length>0&&p.some(u=>this.rules.other.anyLine.test(u.raw));l.loose=k}for(let c of l.items){let p=c.tokens[0];if(c.task&&(p?.type==="text"||p?.type==="paragraph")){c.text=c.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 u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let k=this.rules.other.listTaskCheckbox.exec(c.raw);if(k){let u={type:"checkbox",raw:k[0]+" ",checked:k[0]!=="[ ]"};c.checked=u.checked,l.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(l.loose)for(let c of l.items){c.loose=!0;for(let p of c.tokens)p.type==="text"&&(p.type="paragraph")}return l}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=Re(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&Te(e[2],"()")!==-1)return;let t=G(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:t,raw:z(e[0],`
|
|
28
|
+
`),href:s,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Se(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
29
|
+
`):[],i={type:"table",raw:z(e[0],`
|
|
30
|
+
`),header:[],align:[],rows:[]};if(t.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<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of n)i.rows.push(Se(l,i.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[h]})));return i}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:z(e[0],`
|
|
31
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
32
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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(r){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(r);if(e){let t=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ze(r,e[1],t,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=Te(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)),Ae(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(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ze(r,t[1],s,this.rules))return;let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[G(n)];if(!i){let l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return Ae(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,l,a=n,h=0,o=s[0][0],c=t===o,p=o==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*r.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)){h+=l;continue}if(c)break}if(a-=l,a>0)continue;l=Math.min(l,l+a+h);let k=[...s[0]][0].length,u=r.slice(0,n+s.index+k+l);if(Math.min(n,l)%2){let w=u.slice(1,-1);return{type:"em",raw:u,text:w,tokens:this.lexer.inlineTokens(w)}}let m=u.slice(2,-2);return{type:"strong",raw:u,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,l,a=n,h=this.rules.inline.delRDelim;for(h.lastIndex=0,e=e.slice(-1*r.length+n);(s=h.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 o=[...s[0]][0].length,c=r.slice(0,n+s.index+o+l),p=c.slice(n,-n);return{type:"del",raw:c,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:t?e[0]:Mt(e[0]),escaped:t}}}},S=class V{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||v,this.options.tokenizer=this.options.tokenizer||new X,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 t={other:y,block:N.normal,inline:D.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=D.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=D.breaks:t.inline=D.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:D}}static lex(e,t){return new V(t).lex(e)}static lexInline(e,t){return new V(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
|
|
33
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.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,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=t.at(-1);i.raw.length===1&&a!==void 0?a.raw+=`
|
|
34
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
35
|
+
`)?"":`
|
|
36
|
+
`)+i.raw,a.text+=`
|
|
37
|
+
`+i.text,this.inlineQueue.at(-1).src=a.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
38
|
+
`)?"":`
|
|
39
|
+
`)+i.raw,a.text+=`
|
|
40
|
+
`+i.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let l=e;if(this.options.extensions?.startBlock){let a=1/0,h=e.slice(1),o;this.options.extensions.startBlock.forEach(c=>{o=c.call({lexer:this},h),typeof o=="number"&&o>=0&&(a=Math.min(a,o))}),a<1/0&&a>=0&&(l=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
41
|
+
`)?"":`
|
|
42
|
+
`)+i.raw,a.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.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=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
44
|
+
`)?"":`
|
|
45
|
+
`)+i.raw,a.text+=`
|
|
46
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.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,G(n.slice(i+1,-1))))&&!(i>1&&this.linkInText(n.slice(1,i-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=this.state.linkParenPossible;this.state.linkParenPossible=s&&e.includes(")");try{return this.#e(e,t)}finally{this.state.linkParenPossible=s}}#e(e,t){let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,h=o=>{let c=o.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,G(o.slice(c+1,-1))))return o;if(c>1&&o.charAt(0)!=="!"){let p=o.slice(1,c-1);if(this.linkInText(p))return"["+p.replace(a,h)+"]["+"a".repeat(o.length-c-2)+"]"}return"["+"a".repeat(o.length-2)+"]"};s=s.replace(a,h)}s=s.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(a,h,o)=>o?"+".repeat(a.length):h?h+a.slice(h.length,-h.length).replace(/`/g,"+")+h:a),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,h,o)=>{let c=o?o.length:0;return a.slice(0,c)+"["+"a".repeat(a.length-c-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(o=>(a=o.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let o=t.at(-1);a.type==="text"&&o?.type==="text"?(o.raw+=a.raw,o.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,i)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,i)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let h=e;if(this.options.extensions?.startInline){let o=1/0,c=e.slice(1),p;this.options.extensions.startInline.forEach(k=>{p=k.call({lexer:this},c),typeof p=="number"&&p>=0&&(o=Math.min(o,p))}),o<1/0&&o>=0&&(h=e.substring(0,o+1))}if(a=this.tokenizer.inlineText(h)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),n=!0;let o=t.at(-1);o?.type==="text"?(o.raw+=a.raw,o.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},U=class{options;parser;constructor(r){this.options=r||v}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],n=r?r.replace(y.endingNewline,"")+`
|
|
47
|
+
`:"";return s?'<pre><code class="language-'+$(s)+'">'+(t?n:$(n,!0))+`</code></pre>
|
|
48
|
+
`:"<pre><code>"+(t?n:$(n,!0))+`</code></pre>
|
|
49
|
+
`}blockquote({tokens:r}){return`<blockquote>
|
|
50
|
+
${this.parser.parse(r)}</blockquote>
|
|
51
|
+
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
52
|
+
`}hr(r){return`<hr>
|
|
53
|
+
`}list(r){let e=r.ordered,t=r.start,s="";for(let l=0;l<r.items.length;l++){let a=r.items[l];s+=this.listitem(a)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
|
|
54
|
+
`+s+"</"+n+`>
|
|
55
|
+
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
|
|
56
|
+
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
|
57
|
+
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let l=0;l<i.length;l++)t+=this.tablecell(i[l]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
58
|
+
<thead>
|
|
59
|
+
`+e+`</thead>
|
|
60
|
+
`+s+`</table>
|
|
61
|
+
`}tablerow({text:r}){return`<tr>
|
|
62
|
+
${r}</tr>
|
|
63
|
+
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
64
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${$(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,text:t,tokens:s,autolink:n}){let i=n?$(t,!0):this.parser.parseInline(s),l=$e(r);if(l===null)return i;r=$(l,n);let a='<a href="'+r+'"';return e&&(a+=' title="'+$(e)+'"'),a+=">"+i+"</a>",a}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=$e(r);if(n===null)return $(t);r=n;let i=`<img src="${$(r)}" alt="${$(t)}"`;return e&&(i+=` title="${$(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:$(r.text)}},ae=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},R=class Y{options;renderer;textRenderer;constructor(e){this.options=e||v,this.options.renderer=this.options.renderer||new U,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ae}static parse(e,t){return new Y(t).parse(e)}static parseInline(e,t){return new Y(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";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)){t+=a||"";continue}}let i=n;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=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 new Error(l)}}}return t}parseInline(e,t=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+=t.text(l);break}case"html":{s+=t.html(l);break}case"link":{s+=t.link(l);break}case"image":{s+=t.image(l);break}case"checkbox":{s+=t.checkbox(l);break}case"strong":{s+=t.strong(l);break}case"em":{s+=t.em(l);break}case"codespan":{s+=t.codespan(l);break}case"br":{s+=t.br(l);break}case"del":{s+=t.del(l);break}case"text":{s+=t.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},O=class{options;block;constructor(r){this.options=r||v}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?S.lex:S.lexInline}provideParser(r=this.block){return r?R.parse:R.parseInline}};function L(r,e){if(Array.isArray(e))for(let t=0;t<e.length;t++)r.push(e[t]);else r.push(e)}var jt=class{defaults=ee();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=R;Renderer=U;TextRenderer=ae;Lexer=S;Tokenizer=X;Hooks=O;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(L(t,e.call(this,s)),s.type){case"table":{let n=s;for(let i of n.header)L(t,this.walkTokens(i.tokens,e));for(let i of n.rows)for(let l of i)L(t,this.walkTokens(l.tokens,e));break}case"list":{let n=s;L(t,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);L(t,this.walkTokens(l,e))}):n.tokens&&L(t,this.walkTokens(n.tokens,e))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new 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 new 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),t.renderer){let n=this.defaults.renderer||new U(this.defaults);for(let i in t.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,a=t.renderer[l],h=n[l];n[l]=(...o)=>{let c=a.apply(n,o);return c===!1&&(c=h.apply(n,o)),c||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new X(this.defaults);for(let i in t.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,a=t.tokenizer[l],h=n[l];n[l]=(...o)=>{let c=a.apply(n,o);return c===!1&&(c=h.apply(n,o)),c}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new O;for(let i in t.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,a=t.hooks[l],h=n[l];O.passThroughHooks.has(i)?n[l]=o=>{if(this.defaults.async&&O.passThroughHooksRespectAsync.has(i))return(async()=>{let p=await a.call(n,o);return h.call(n,p)})();let c=a.call(n,o);return h.call(n,c)}:n[l]=(...o)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(n,o);return p===!1&&(p=await h.apply(n,o)),p})();let c=a.apply(n,o);return c===!1&&(c=h.apply(n,o)),c}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(l){let a=[];return a.push(i.call(this,l)),n&&L(a,n.call(this,l)),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return S.lex(r,e??this.defaults)}parser(r,e){return R.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(new 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(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let l=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer(r):r?S.lex:S.lexInline)(l,n),h=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(h,n.walkTokens));let o=await(n.hooks?await n.hooks.provideParser(r):r?R.parse:R.parseInline)(h,n);return n.hooks?await n.hooks.postprocess(o):o})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let l=(n.hooks?n.hooks.provideLexer(r):r?S.lex:S.lexInline)(e,n);n.hooks&&(l=n.hooks.processAllTokens(l)),n.walkTokens&&this.walkTokens(l,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(r):r?R.parse:R.parseInline)(l,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(l){return i(l)}}}onError(r,e){return t=>{if(t.message+=`
|
|
65
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+$(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},C=new jt;function d(r,e){return C.parse(r,e)}d.options=d.setOptions=function(r){return C.setOptions(r),d.defaults=C.defaults,_e(d.defaults),d};d.getDefaults=ee;d.defaults=v;function Ht(...r){return C.use(...r),d.defaults=C.defaults,_e(d.defaults),d}d.use=Ht;d.walkTokens=function(r,e){return C.walkTokens(r,e)};d.parseInline=C.parseInline;d.Parser=R;d.parser=R.parse;d.Renderer=U;d.TextRenderer=ae;d.Lexer=S;d.lexer=S.lex;d.Tokenizer=X;d.Hooks=O;d.parse=d;var Ut=d.options,Wt=d.setOptions,Jt=d.walkTokens,Kt=d.parseInline;var Vt=R.parse,Yt=S.lex;var ce=null;function cr(r){ce=r}function A(r){return r?r.map(e=>{switch(e.type){case"strong":return f.bold(A(e.tokens));case"em":return f.italic(A(e.tokens));case"del":return f.strike(A(e.tokens));case"codespan":return f.ember(e.text);case"br":return`
|
|
66
|
+
`;case"link":{let t=A(e.tokens),s=H(t);return s===e.href||`mailto:${s}`===e.href?f.underline(f.blue(t)):`${f.underline(f.blue(t))} ${f.grey(`(${e.href})`)}`}case"image":return f.grey(`[image: ${e.text||e.href}]`);case"html":return f.grey(e.text);case"escape":return e.text;case"text":return"tokens"in e&&e.tokens?A(e.tokens):e.text;default:return"text"in e?String(e.text):e.raw}}).join(""):""}function Nt(r,e,t,s){let n=ce?ce(r,e):r,i=f.grey("\u2502"),l=[s+f.grey(`\u256D\u2500 ${e||"code"}`)];for(let a of n.split(`
|
|
67
|
+
`))l.push(`${s}${i} ${a}`);return l.push(s+f.grey("\u2570\u2500")),l}function Ft(r,e,t){let s=r.header.map(p=>f.bold(A(p.tokens))),n=r.rows.map(p=>p.map(k=>A(k.tokens))),i=s.length,l=s.map((p,k)=>Math.max(P(p),...n.map(u=>P(u[k]??"")))),a=e-P(t)-(3*i+1);for(;l.reduce((p,k)=>p+k,0)>a&&Math.max(...l)>4;){let p=l.indexOf(Math.max(...l));l[p]--}let h=(p,k)=>{let u=fe(p,l[k]),m=l[k]-P(u);return r.align[k]==="right"?" ".repeat(m)+u:r.align[k]==="center"?" ".repeat(m>>1)+u+" ".repeat(m-(m>>1)):de(u,l[k])},o=(p,k,u)=>t+f.grey(p+l.map(m=>"\u2500".repeat(m+2)).join(k)+u),c=p=>t+f.grey("\u2502")+p.map((k,u)=>` ${h(k,u)} `).join(f.grey("\u2502"))+f.grey("\u2502");return[o("\u250C","\u252C","\u2510"),c(s),o("\u251C","\u253C","\u2524"),...n.map(c),o("\u2514","\u2534","\u2518")]}function Gt(r,e,t){let s=[],n=typeof r.start=="number"?r.start:1;return r.items.forEach((i,l)=>{let a=r.ordered?f.ember(`${n+l}.`):f.ember("\u2022");i.task&&(a=i.checked?f.green("\u2714"):f.grey("\u2610"));let h=" ".repeat(P(H(a))+1),o=he(i.tokens.filter(p=>p.type!=="checkbox"),e,t+h,!0);o.length===0&&o.push(t+h);let c=o[0].slice(t.length+h.length);i.task&&i.checked&&(c=f.grey(f.strike(H(c)))),s.push(t+a+" "+c,...o.slice(1))}),s}var oe=(r,e,t)=>xe(t+r.replace(/\n/g,`
|
|
68
|
+
${t}`),e,t);function he(r,e,t,s=!1){let n=[],i=()=>{!s&&n.length&&n.at(-1)!==""&&n.push("")};for(let l of r)switch(l.type){case"space":break;case"heading":{i();let a=A(l.tokens),h=l.depth===1?f.bold(f.gold(a)):l.depth===2?f.bold(f.ember(a)):f.bold(a);n.push(...oe(h,e,t));break}case"paragraph":i(),n.push(...oe(A(l.tokens),e,t));break;case"text":n.push(...oe(A(l.tokens??[l]),e,t));break;case"list":i(),n.push(...Gt(l,e,t));break;case"code":i(),n.push(...Nt(l.text,(l.lang??"").split(/\s/)[0],e,t));break;case"blockquote":{i();let a=he(l.tokens??[],e-2,"",!0);n.push(...a.map(h=>`${t}${f.grey("\u258E")} ${f.italic(h)}`));break}case"hr":i(),n.push(t+f.grey("\u2500".repeat(Math.max(3,Math.min(e-P(t),60)))));break;case"table":i(),n.push(...Ft(l,e,t));break;case"html":i(),n.push(...l.text.replace(/\n$/,"").split(`
|
|
69
|
+
`).map(a=>t+f.grey(a)));break;case"def":break;default:"text"in l&&n.push(t+String(l.text))}return n}function Ze(r,e,t=" "){let s=new S({gfm:!0}).lex(r);return he(s,Math.max(20,e),t)}var Xt=/^ {0,3}(`{3,}|~{3,})/,De=class{constructor(e){this.width=e}width;buf="";block=[];fence=null;emitted=0;push(e){this.buf+=e;let t=[],s;for(;(s=this.buf.indexOf(`
|
|
70
|
+
`))>=0;){let n=this.buf.slice(0,s);this.buf=this.buf.slice(s+1),t.push(...this.line(n))}return t}line(e){let t=Xt.exec(e);if(this.fence)return this.block.push(e),t&&t[1][0]===this.fence[0]&&t[1].length>=this.fence.length&&e.trim()===t[1]?(this.fence=null,this.emit()):[];if(t){let s=this.emit();return this.fence=t[1],this.block.push(e),s}return e.trim()===""?this.emit():(this.block.push(e),[])}emit(){if(this.block.length===0)return[];let e=this.block.join(`
|
|
71
|
+
`);this.block=[];let t=Ze(e,this.width());return t.length===0?[]:this.emitted++>0?["",...t]:t}preview(){let e=[...this.block,this.buf].join(`
|
|
72
|
+
`).trimEnd();return e?Ze(e,this.width()):[]}end(){this.buf&&this.block.push(this.buf),this.buf="",this.fence=null;let e=this.emit();return this.emitted=0,e}get started(){return this.emitted>0||this.block.length>0||this.buf!==""}};export{cr as a,De as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as b}from"./chunk-K3ZZ2VJH.js";function T(r=process.env,e=!!process.stdout.isTTY,t=process.platform,i=b(t)){if(r.NO_COLOR!==void 0&&r.NO_COLOR!=="")return 0;let n=r.FORCE_COLOR;if(n!==void 0){if(n==="0"||n==="false")return 0;if(n==="2")return 2;if(n==="3")return 3;if(!e)return 1}return!e||r.TERM==="dumb"?n!==void 0?1:0:/truecolor|24bit/i.test(r.COLORTERM??"")||["iTerm.app","vscode","WezTerm","ghostty","Hyper"].includes(r.TERM_PROGRAM??"")||r.WT_SESSION?3:t==="win32"&&!r.TERM?i>=14931?3:i>=10586?2:1:/kitty|alacritty|foot/.test(r.TERM??"")?3:/256/.test(r.TERM??"")||r.TERM_PROGRAM==="Apple_Terminal"?2:1}var s=T(),E=()=>s;function O([r,e,t]){if(r===e&&e===t)return r<8?16:r>248?231:Math.round((r-8)/247*24)+232;let i=n=>n<48?0:n<115?1:Math.floor((n-35)/40);return 16+36*i(r)+6*i(e)+i(t)}function c(r,e,t){return s===3?`\x1B[${t?48:38};2;${r[0]};${r[1]};${r[2]}m`:s===2?`\x1B[${t?48:38};5;${O(r)}m`:`\x1B[${t?e+10:e}m`}var u=(r,e)=>t=>s===0||t===""?t:`${r()}${t}${e}`,o=(r,e)=>u(()=>c(r,e,!1),"\x1B[39m"),f=(r,e)=>u(()=>c(r,e,!0),"\x1B[49m"),m={ember:[255,122,61],gold:[255,194,74],crimson:[232,51,107],violet:[123,47,247]},d={bold:u(()=>"\x1B[1m","\x1B[22m"),dim:u(()=>"\x1B[2m","\x1B[22m"),italic:u(()=>"\x1B[3m","\x1B[23m"),underline:u(()=>"\x1B[4m","\x1B[24m"),strike:u(()=>"\x1B[9m","\x1B[29m"),inverse:u(()=>"\x1B[7m","\x1B[27m"),ember:o(m.ember,33),gold:o(m.gold,93),crimson:o(m.crimson,35),green:o([120,210,120],32),red:o([255,95,95],31),cyan:o([110,200,220],36),blue:o([120,160,255],34),pink:o([255,122,154],95),grey:o([140,140,150],90),sand:o([230,200,160],33),addBg:f([22,64,34],42),delBg:f([78,24,30],41),addBgStrong:f([36,110,52],42),delBgStrong:f([140,36,46],41)};function L(r,e=[m.crimson,m.ember,m.gold]){if(s<2)return s===0?r:d.bold(d.ember(r));let t=[...r],i=Math.max(1,t.length-1);return t.map((n,R)=>{let l=R/i*(e.length-1),x=e[Math.floor(l)],g=e[Math.min(e.length-1,Math.floor(l)+1)],p=l-Math.floor(l),M=x.map((a,B)=>Math.round(a+(g[B]-a)*p));return n===" "?n:`${c(M,33,!1)}${n}`}).join("")+"\x1B[39m"}export{E as a,d as b,L as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as p}from"./chunk-K3ZZ2VJH.js";import{spawn as h}from"node:child_process";var d=t=>/^https:\/\/[\w.-]+\/device(\?[\w=&-]*)?$/.test(t);function I(t){if(!d(t))return;let n=(f,m,l,c)=>{try{let s=h(f,m,{stdio:"ignore",detached:!0,...l});s.on("error",()=>c?.()),s.unref()}catch{c?.()}},{file:i,args:u,options:a}=p(t);n(i,u,a,process.platform==="linux"&&i==="cmd.exe"?()=>n("xdg-open",[t],{}):void 0)}import{chmodSync as g,existsSync as x,mkdirSync as y,readFileSync as A,rmSync as S,writeFileSync as v}from"node:fs";import{homedir as k}from"node:os";import{join as e}from"node:path";var w="https://flintmaker.com",r=()=>e(process.env.XDG_CONFIG_HOME||e(k(),".config"),"flintmaker"),o=(t=r())=>e(t,"auth.json");function P(t=r()){try{let n=JSON.parse(A(o(t),"utf8"));return typeof n?.token=="string"?n:null}catch{return null}}function B(t,n=r()){y(n,{recursive:!0,mode:448}),v(o(n),JSON.stringify(t,null,2),{mode:384});try{g(o(n),384)}catch{}}function C(t=r()){x(o(t))&&S(o(t))}function E(t){return(process.env.FLINT_API||t?.api||w).replace(/\/$/,"")}export{I as a,P as b,B as c,C as d,E as e};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a as M,b as s,c as S}from"./chunk-5PRYZOW7.js";var I=/\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,L=t=>t.replace(I,"");function N(t){return t===0||t<32||t>=127&&t<160||t>=768&&t<=879||t>=8203&&t<=8207||t>=65024&&t<=65039||t>=6832&&t<=6911||t>=8400&&t<=8447||t>=917760&&t<=917999?0:t>=4352&&t<=4447||t>=11904&&t<=12350||t>=12353&&t<=13311||t>=13312&&t<=19903||t>=19968&&t<=40959||t>=40960&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65103||t>=65280&&t<=65376||t>=65504&&t<=65510||t>=127744&&t<=128591||t>=129280&&t<=129535||t>=128640&&t<=128767||t>=129648&&t<=129791||t>=131072&&t<=262141?2:1}function x(t){let r=0;for(let e of L(t))r+=N(e.codePointAt(0));return r}function*O(t){let r=0;for(let e of t.matchAll(I)){for(let n of t.slice(r,e.index))yield{ansi:!1,text:n};yield{ansi:!0,text:e[0]},r=e.index+e[0].length}for(let e of t.slice(r))yield{ansi:!1,text:e}}function m(t,r,e="\u2026"){if(r<=0)return"";if(x(t)<=r)return t;let n=r-x(e),i=0,o="",l=!1;for(let a of O(t)){if(a.ansi){o+=a.text;continue}if(l)continue;let c=N(a.text.codePointAt(0));if(i+c>n){o+=e,l=!0;continue}o+=a.text,i+=c}return o+(/\x1b\[/.test(o)?"\x1B[0m":"")}var R=(t,r)=>t+" ".repeat(Math.max(0,r-x(t)));function X(t,r){let e=[],n="",i=0;for(let o of t){let l=N(o.codePointAt(0));i+l>r&&n!==""&&(e.push(n),n="",i=0),n+=o,i+=l}return e.push(n),e}function et(t,r,e=""){let n=[];for(let i of t.split(`
|
|
2
|
+
`)){let o=[],l="",a=0,c=[],f="",h=0,d="",b=()=>c.join(""),$=()=>{o.push(l+(c.length?"\x1B[0m":"")),l=e+b(),a=x(e)},p=()=>{if(f){a+x(d)+h>r&&a>x(e)&&($(),d=""),l+=d+f,a+=x(d)+h,d="";for(let u of f.matchAll(/\x1b\[[0-9;]*m/g))/^\x1b\[0?m$/.test(u[0])?c=[]:c.push(u[0]);for(;a>r;){let u=L(l),g=X(u,r)[0];o.push(g),l=e+u.slice(g.length),a=x(l)}f="",h=0}};for(let u of O(i)){if(u.ansi){f+=u.text;continue}if(u.text===" "){p(),d+=" ";continue}f+=u.text,h+=N(u.text.codePointAt(0))}p(),o.push(l),n.push(...o)}return n}function E(t){return t.replace(/\x1b\][^\x07\x1b]*(\x07|\x1b\\)?/g,"").replace(/\x1b\[[0-?]*[ -/]*[@-~]/g,"").replace(/\x1b[@-Z\\-_]/g,"").replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g,"").replace(/[--]/g,r=>`<U+${r.charCodeAt(0).toString(16).toUpperCase()}>`)}var B={ask:"ask before edits",auto:"auto-accept edits",plan:"plan only (no changes)"},F={standard:"Standard",smart:"Smart"};function T(t,r,e={}){let n=e.border??s.grey,i=e.padX??1,o=Math.max(4,r-2-i*2),l=e.title?n("\u256D\u2500 ")+e.title+" "+n("\u2500".repeat(Math.max(0,r-5-x(e.title)))+"\u256E"):n("\u256D"+"\u2500".repeat(r-2)+"\u256E"),a=" ".repeat(i);return[l,...t.map(c=>n("\u2502")+a+R(m(c,o),o)+a+n("\u2502")),n("\u2570"+"\u2500".repeat(r-2)+"\u256F")]}var W=[" \u2726 "," \u259F\u2588\u2599 ","\u259F\u2588\u2588\u2588\u2599"];function lt(t,r){let e=Math.min(r-1,76),n=M()===0?W:[s.gold(W[0]),S(W[1],[[255,194,74],[255,122,61]]),S(W[2],[[255,122,61],[232,51,107]])],i=`${s.bold(S("FlintMaker"))} ${s.bold("flint")} ${s.grey(`v${t.version}`)}`,o=t.email?`${t.email}${t.plan?s.grey(" \xB7 ")+H(t.plan):""}${t.credits?s.grey(" \xB7 ")+t.credits:""}`:s.grey(t.status??"connecting\u2026"),l=[i,o,`${s.grey("model")} ${F[t.model]}${s.grey(" \xB7 ")}${s.grey(t.cwd)}`],a=W.map((c,f)=>`${n[f]} ${l[f]}`);return a.push("",s.grey("/help commands \xB7 @ attach files \xB7 esc interrupt \xB7 shift+tab mode")),T(a,e,{border:c=>s.ember(c)})}var H=t=>t.charAt(0).toUpperCase()+t.slice(1),P=["Forging","Sparking","Kindling","Stoking","Smelting","Hammering","Tempering","Igniting","Annealing","Striking","Blazing","Quenching"],j=["\xB7","\u2722","\u2733","\u2736","\u273B","\u273D","\u273B","\u2736","\u2733","\u2722"];function at(t,r,e,n,i){let o=i??P[Math.floor(r/3e3)%P.length],l=j[t%j.length],c=[`${Math.floor(r/1e3)}s`,e?`${e} credit${e===1?"":"s"}`:null,"esc to interrupt"].filter(Boolean).join(" \xB7 ");return m(`${s.ember(l)} ${S(`${o}\u2026`,[[255,122,61],[255,194,74]])} ${s.grey(`(${c})`)}`,n-1)}function ct(t,r){let e=t.mode==="ask"?s.grey(B.ask):t.mode==="auto"?s.gold(`\u23F5\u23F5 ${B.auto}`):s.pink(`\u23F8 ${B.plan}`),n=[s.ember(F[t.model]),e+s.grey(" (shift+tab)")];t.credits&&n.push(s.grey(t.credits)),n.push(s.grey(t.cwd)+(t.branch?s.grey(` \u2387 ${t.branch}`):""));let i=" "+(t.hint?s.gold(t.hint):n.join(s.grey(" \xB7 ")));return m(i,r-1)}var Z={list_files:"List",read_file:"Read",search:"Search",write_file:"Write",edit_file:"Edit",run_command:"Run",web_search:"Web search",web_fetch:"Fetch"};function q(t){return Z[t]??t.replace(/_/g," ")}function gt(t,r,e,n,i=""){let o=e==="running"?s.gold("\u25CF"):e==="ok"?s.ember("\u25CF"):e==="error"?s.red("\u25CF"):s.grey("\u25CF"),l=E(r).replace(/\s*\n\s*/g," \u23CE ");return m(`${o} ${s.bold(q(t))} ${l}${i?s.grey(` ${i}`):""}`,n-1)}function ft(t,r,e=4,n=s.grey){let i=E(t).replace(/\s+$/,"").split(`
|
|
3
|
+
`),l=i.slice(0,e).map((a,c)=>m(` ${c===0?s.grey("\u23BF"):" "} ${n(a.replace(/\t/g," "))}`,r-1));return i.length>e&&l.push(s.grey(` \u2026 +${i.length-e} lines`)),l}function ut(t,r){switch(t){case"read_file":{if(r.startsWith("[binary file"))return{suffix:"(binary)"};let e=r.split(`
|
|
4
|
+
`).filter(n=>/^\d+\t/.test(n)).length;return{suffix:`(${e} line${e===1?"":"s"})`}}case"list_files":{let e=/… (\d+) more files/.exec(r),n=r==="(empty)"?0:r.split(`
|
|
5
|
+
`).filter(i=>i&&!i.startsWith("\u2026 ")).length+(e?Number(e[1]):0);return{detail:`${n} file${n===1?"":"s"}`}}case"search":{if(r==="No matches.")return{detail:"No matches"};let e=r.split(`
|
|
6
|
+
`).filter(Boolean),n=new Set(e.map(i=>i.split(":")[0]));return{detail:`${e.length} match${e.length===1?"":"es"} in ${n.size} file${n.size===1?"":"s"}`}}case"run_command":{let e=/\[exit code (\d+|null)\]$|\[timed out after \d+s\]$|^\[could not run command/.exec(r.trim());return{failed:!e||(e[1]!==void 0?e[1]!=="0":!0)}}case"web_search":{let e=r.split(`
|
|
7
|
+
`),n=e.flatMap((o,l)=>/^\[\d+\] /.test(o)?[G(e[l+1]??"")]:[]).filter(Boolean);if(n.length===0)return{detail:"No results"};let i=[...new Set(n)];return{detail:`${n.length} result${n.length===1?"":"s"}: ${i.slice(0,3).join(", ")}${i.length>3?"\u2026":""}`}}case"web_fetch":{let e=/^Words: (\d+)( \(truncated\))?/m.exec(r);return e?{detail:`${Number(e[1]).toLocaleString("en-US")} words${e[2]?" (truncated)":""}`}:{}}default:return{}}}function G(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return""}}function Q(t){let r=0,e=0;for(let n of t.split(`
|
|
8
|
+
`))n.startsWith("+++")||n.startsWith("---")||(n.startsWith("+")?r++:n.startsWith("-")&&e++);return{added:r,removed:e}}function dt(t,r,e,n=!1){let i=E(t),{added:o,removed:l}=Q(i),a=e-1,c=`${s.bold(r)} ${s.green(`+${o}`)} ${s.red(`-${l}`)}${n?s.grey(" (new file)"):""}`,f=[` ${s.grey("\u250C")} ${c}`],h=0,d=0,b=1;for(let g of i.matchAll(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/gm))b=Math.max(b,Number(g[1])+Number(g[2]??1),Number(g[3])+Number(g[4]??1));let $=String(b).length,p=[],u=!0;for(let g of i.split(`
|
|
9
|
+
`)){if(g.startsWith("===")||g.startsWith("Index:")||g.startsWith("---")||g.startsWith("+++"))continue;let v=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(g);if(v){h=Number(v[1]),d=Number(v[2]),u||p.push(` ${s.grey("\u2506")} ${s.grey(" ".repeat($)+" \u22EE")}`),u=!1;continue}if(g==="\")continue;let y=g[0],D=g.slice(1).replace(/\t/g," "),k,A,w;if(y==="+")k=String(d++),A="+",w=M()>=2?s.addBg:s.green;else if(y==="-")k=String(h++),A="-",w=M()>=2?s.delBg:s.red;else if(y===" ")k=String(d),h++,d++,A=" ",w=_=>_;else continue;let U=` ${s.grey("\u2502")} ${s.grey(k.padStart($))} `,C=Math.max(10,a-($+5)-2);J(`${A} ${D}`,C).forEach((_,K)=>{let z=y===" "?s.grey(_):_,V=y===" "||M()<2?w(z):w(R(z,C));p.push((K===0?U:` ${s.grey("\u2502")} ${" ".repeat($)} `)+V)})}return f.push(...p,` ${s.grey("\u2514")}`),f}function J(t,r){let e=[],n=t;for(;x(n)>r;){let i=0,o=0;for(let l of n){let a=x(l);if(o+a>r)break;o+=a,i+=l.length}e.push(n.slice(0,i)),n=" "+n.slice(i)}return e.push(n),e}function xt(t,r,e,n="error"){let i=n==="error"?s.red:n==="warn"?s.gold:s.ember,o=n==="error"?"\u2717":n==="warn"?"!":"\u2726",l=Math.min(e-1,76);return T([`${i(o)} ${s.bold(t)}`,...r.map(a=>` ${a}`)],l,{border:i})}function ht(t,r,e,n,i="cancel"){let o=[m(s.bold(t),n-1)];return r.forEach((l,a)=>{let c=a===e,f=c?s.ember("\u276F"):" ",h=`${a+1}. ${l.label}`;o.push(m(`${f} ${c?s.ember(h):h}${l.hint?s.grey(` ${l.hint}`):""}`,n-1))}),o.push(s.grey(`\u2191/\u2193 or 1-${r.length} to choose \xB7 enter to confirm \xB7 esc to ${i}`)),o}function mt(t,r,e,n={}){let i=e-1,o=n.prefix??"\u276F ",l=Y(e,o),a=n.maxRows??8,c=0;t.length>a&&(c=Math.min(Math.max(0,r.row-a+1),t.length-a));let f=t.slice(c,c+a),h=t.length===1&&t[0]==="",d=[s.grey("\u256D"+"\u2500".repeat(i-2)+"\u256E")];f.forEach(($,p)=>{let u=p===0&&c===0?s.ember(o):" ".repeat(x(o)),g=h&&n.placeholder?s.grey(m(n.placeholder,l)):$;d.push(s.grey("\u2502")+" "+u+R(g,l)+" "+s.grey("\u2502"))});let b=t.length>a?`\u2500 ${c+f.length}/${t.length} lines `:"";return d.push(s.grey("\u2570"+b+"\u2500".repeat(Math.max(0,i-2-b.length))+"\u256F")),{lines:d,cursorRow:1+(r.row-c),cursorCol:2+x(o)+(h?0:r.col)}}var Y=(t,r="\u276F ")=>Math.max(8,t-1-4-x(r));function bt(t,r,e=32){/^[a-zA-Z]:[\\/]|^\\\\/.test(t)&&(t=t.replace(/\\/g,"/"),r=r.replace(/\\/g,"/"),r&&(t.toLowerCase()===r.toLowerCase()||t.toLowerCase().startsWith(r.toLowerCase()+"/"))&&(t=r+t.slice(r.length)));let n=r&&(t===r||t.startsWith(r+"/"))?`~${t.slice(r.length)}`:t;if(n.length<=e)return n;let i=n.split("/");for(;i.length>2&&i.join("/").length>e-2;)i.splice(1,1);return n=i.length>1?`${i[0]}/\u2026/${i.slice(1).join("/")}`:n,n.length>e?"\u2026"+n.slice(-(e-1)):n}var $t=t=>t.map(L);export{L as a,N as b,x as c,m as d,R as e,X as f,et as g,E as h,B as i,F as j,T as k,lt as l,P as m,j as n,at as o,ct as p,q,gt as r,ft as s,ut as t,Q as u,dt as v,xt as w,ht as x,mt as y,Y as z,bt as A,$t as B};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var u=Object.create;var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var R=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(t){throw r=0,t}};var g=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of m(r))!h.call(e,n)&&n!==t&&l(e,n,{get:()=>r[n],enumerable:!(o=d(r,n))||o.enumerable});return e};var T=(e,r,t)=>(t=e!=null?u(w(e)):{},g(r||!e||!e.__esModule?l(t,"default",{value:e,enumerable:!0}):t,e));import{spawn as S}from"node:child_process";import{release as x}from"node:os";import p from"node:path";var s=(e=process.platform)=>e==="win32",c=(e=process.platform)=>s(e)?p.win32:p.posix;function M(e,r=process.platform){if(c(r).isAbsolute(e))return`${e} is outside the project`;if(s(r)){if(/^[a-zA-Z]:/.test(e)||/^[\\/]/.test(e))return`${e} is outside the project`;if(e.includes(":"))return`${e} is not a valid path on Windows`}return null}function b(e,r,t=process.platform){let o=c(t),n=o.normalize(e),i=o.normalize(r);return s(t)&&(n=n.toLowerCase(),i=i.toLowerCase()),n.endsWith(o.sep)&&(n=n.slice(0,-1)),i===n||i.startsWith(n+o.sep)}function O(e,r=process.platform){return s(r)?e.replace(/[. ]+$/,""):e}function W(e,r=process.platform){return s(r)?e.replace(/\\/g,"/"):e}function $(e){let r=(e.match(/\n/g)??[]).length;return r===0?"lf":(e.match(/\r\n/g)??[]).length===r?"crlf":"lf"}var P=e=>e.replace(/\r\n/g,`
|
|
2
|
+
`),k=e=>P(e).replace(/\n/g,`\r
|
|
3
|
+
`);function a(e=process.platform,r=process.env){if(!s(e))return"sh";let t=(r.FLINT_SHELL??"").trim().toLowerCase();return t==="powershell"||t==="powershell.exe"?"powershell":t==="pwsh"||t==="pwsh.exe"?"pwsh":"cmd"}function v(e,r=process.platform,t=process.env){let o=a(r,t);if(o==="sh")return{file:"/bin/sh",args:["-c",e],options:{detached:!0}};if(o==="cmd")return{file:t.ComSpec||t.COMSPEC||"cmd.exe",args:["/d","/s","/c",`"${e}"`],options:{windowsVerbatimArguments:!0,windowsHide:!0}};let n=Buffer.from(e,"utf16le").toString("base64");return{file:o==="pwsh"?"pwsh.exe":"powershell.exe",args:["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",n],options:{windowsHide:!0}}}function J(e,r=process.platform,t){if(!e)return t?.();if(s(r)){try{S("taskkill",["/pid",String(e),"/T","/F"],{stdio:"ignore",windowsHide:!0}).on("error",()=>t?.())}catch{t?.()}return}try{process.kill(-e,"SIGKILL")}catch{t?.()}}var E={sh:"/bin/sh",cmd:"cmd.exe (Windows Command Prompt)",powershell:"Windows PowerShell (powershell.exe)",pwsh:"PowerShell 7 (pwsh.exe)"};function N(e=process.platform,r=process.env){return e==="win32"?"Windows":e==="darwin"?"macOS":e==="linux"?r.WSL_DISTRO_NAME?`Linux (WSL, ${r.WSL_DISTRO_NAME})`:"Linux":e}function F(e=process.platform,r=process.env){let t=a(e,r),o=[`OS: ${N(e,r)}`,`run_command shell: ${E[t]}`];return t==="cmd"?o.push("Use Windows cmd syntax: dir, type, copy, move, del, mkdir, findstr, set VAR=x, && to chain. No ls/cat/grep/rm/export, no single-quote quoting."):t!=="sh"&&o.push("Use PowerShell syntax (Get-ChildItem, Get-Content, $env:VAR, ; to chain)."),s(e)&&o.push("File tool paths are project-relative; forward slashes are fine."),`<environment>
|
|
4
|
+
${o.join(`
|
|
5
|
+
`)}
|
|
6
|
+
</environment>`}function U(e=process.platform,r=process.env){return r.FLINT_ASCII&&r.FLINT_ASCII!=="0"?!1:r.FLINT_UNICODE&&r.FLINT_UNICODE!=="0"?!0:s(e)?!!r.WT_SESSION||!!r.TERMINUS_SUBLIME||r.ConEmuTask==="{cmd::Cmder}"||r.TERM_PROGRAM==="vscode"||r.TERM_PROGRAM==="Terminus-Sublime"||r.TERMINAL_EMULATOR==="JetBrains-JediTerm"||r.TERM==="xterm-256color"||r.TERM==="alacritty"||r.TERM==="rxvt-unicode"||r.TERM==="rxvt-unicode-256color":r.TERM!=="linux"}var f={"\u2726":"*","\u25CF":"*","\u23BF":"`","\u276F":">","\u270E":">","\u23F5":">","\u23F8":"|","\u2387":"@","\u23CE":"/","\u2713":"v","\u2717":"x","\u2722":"*","\u2733":"*","\u2736":"*","\u273B":"*","\u273D":"*","\u259F":"/","\u2599":"\\","\u2588":"#","\u256D":"+","\u256E":"+","\u2570":"+","\u256F":"+","\u250C":"+","\u2510":"+","\u2514":"+","\u2518":"+","\u251C":"+","\u2524":"+","\u252C":"+","\u2534":"+","\u253C":"+","\u2500":"-","\u2502":"|","\u2191":"^","\u2193":"v","\u2192":">","\u2190":"<","\u2026":".","\u2248":"~","\u2013":"-","\u2014":"-","\u25B8":">","\u258C":"|","\u258E":"|","\u2022":"*","\u23F9":"#","\u2714":"v","\u2610":"o","\u2506":":","\u22EE":":","\xD7":"x"},I=new RegExp(`[${Object.keys(f).join("").replace(/[\\\]^-]/g,"\\$&")}]`,"g"),L=e=>e.replace(I,r=>f[r]??r);function j(e){let r=e.write.bind(e);e.write=((t,...o)=>r(typeof t=="string"?L(t):t,...o))}function B(e=process.platform,r=x()){if(!s(e))return 0;let t=r.split(".");return Number(t[0])>=10&&Number(t[2])||0}function G(e,r=process.platform,t=process.env){return r==="darwin"?{file:"open",args:[e],options:{}}:s(r)?{file:t.ComSpec||"cmd.exe",args:["/d","/s","/c",`start "" "${e}"`],options:{windowsVerbatimArguments:!0,windowsHide:!0}}:t.WSL_DISTRO_NAME?{file:"cmd.exe",args:["/d","/c","start",'""',e.replace(/&/g,"^&")],options:{}}:{file:"xdg-open",args:[e],options:{}}}export{R as a,T as b,s as c,c as d,M as e,b as f,O as g,W as h,$ as i,P as j,k,v as l,J as m,F as n,U as o,j as p,B as q,G as r};
|