@visulima/ono 1.0.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.
@@ -0,0 +1,163 @@
1
+ var ie=Object.defineProperty;var T=(e,o)=>ie(e,"name",{value:o,configurable:!0});import{a as P,s as G,n as X,e as Z,c as de,g as le,d as ce}from"../../packem_shared/clipboard-XQlKTYnW.js";const q="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-braces%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203H7a2%202%200%200%200-2%202v5a2%202%200%200%201-2%202%202%202%200%200%201%202%202v5c0%201.1.9%202%202%202h1%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021h1a2%202%200%200%200%202-2v-5c0-1.1.9-2%202-2a2%202%200%200%201-2-2V5a2%202%200%200%200-2-2h-1%22%20%2F%3E%20%3C%2Fsvg%3E",J="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-cookie%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%202a10%2010%200%201%200%2010%2010%204%204%200%200%201-5-5%204%204%200%200%201-5-5%22%20%2F%3E%20%3Cpath%20d%3D%22M8.5%208.5v.01%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2015.5v.01%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2012v.01%22%20%2F%3E%20%3Cpath%20d%3D%22M11%2017v.01%22%20%2F%3E%20%3Cpath%20d%3D%22M7%2014v.01%22%20%2F%3E%20%3C%2Fsvg%3E",S="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-file-text%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M15%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V7Z%22%20%2F%3E%20%3Cpath%20d%3D%22M14%202v4a2%202%200%200%200%202%202h4%22%20%2F%3E%20%3Cpath%20d%3D%22M10%209H8%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2013H8%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2017H8%22%20%2F%3E%20%3C%2Fsvg%3E",I="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-globe%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%20%2F%3E%20%3Cpath%20d%3D%22M12%202a14.5%2014.5%200%200%200%200%2020%2014.5%2014.5%200%200%200%200-20%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2012h20%22%20%2F%3E%20%3C%2Fsvg%3E",R="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-user%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M19%2021v-2a4%204%200%200%200-4-4H9a4%204%200%200%200-4%204v2%22%20%2F%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%227%22%20r%3D%224%22%20%2F%3E%20%3C%2Fsvg%3E";var ue=Object.defineProperty,ve=T((e,o)=>ue(e,"name",{value:o,configurable:!0}),"s$2");const O=ve(({label:e="Copy",successText:o="Copied!",targetId:r})=>{const c=P(r),h=P(e),x=G(e),l=G(o);return{html:`
2
+ <button
3
+ type="button"
4
+ aria-label="${h}"
5
+ title="${x}"
6
+ class="ono-copy-btn relative inline-flex justify-center items-center size-8 rounded-[var(--ono-radius-md)] shadow-[var(--ono-elevation-1)] bg-[var(--ono-surface)] text-[var(--ono-text)] hover:bg-[var(--ono-hover-overlay)] focus:outline-hidden focus:bg-[var(--ono-hover-overlay)] disabled:opacity-50 disabled:pointer-events-none cursor-pointer"
7
+ data-target="#${c}"
8
+ data-success-text="${l}"
9
+ >
10
+ <span class="ono-copy-default dui size-4 transition" style="-webkit-mask-image: url('${X}'); mask-image: url('${X}')"></span>
11
+ <span class="ono-copy-success dui hidden size-4 text-[var(--ono-red-orange)]" style="-webkit-mask-image: url('${Z}'); mask-image: url('${Z}')"></span>
12
+ <span class="sr-only">${x}</span>
13
+ </button>
14
+ `}},"copyButton");var pe=Object.defineProperty,j=T((e,o)=>pe(e,"name",{value:o,configurable:!0}),"s$1");const xe=typeof globalThis<"u"&&"Request"in globalThis,Y=j((e,o)=>o in e,"hasProperty"),V=j((e,o)=>Y(e,o)&&typeof e[o]=="function","hasMethod"),ee=j((e,o)=>Y(e,o)&&typeof e[o]=="string","hasStringProperty"),me=j(e=>xe&&V(e,"clone"),"isNativeRequest"),be=j(e=>V(e,"on")&&ee(e,"method"),"isIncomingMessage");j(e=>!me(e)&&!be(e)&&ee(e,"method"),"isExpressRequest");const L=j(e=>typeof e=="object"&&e!==null&&V(e,"forEach")&&V(e,"get"),"isHeadersObject");var ge=Object.defineProperty,s=T((e,o)=>ge(e,"name",{value:o,configurable:!0}),"s");const he=[/authorization/i,/cookie/i,/set-cookie/i,/x-api-key/i,/api-key/i,/x-auth/i,/token/i,/secret/i],z=s((e,o)=>{if(typeof e=="object"&&e!==null&&o in e)return e[o]},"safeGetProperty"),p=s((e,o)=>{const r=z(e,o);return typeof r=="function"?r:void 0},"safeGetMethod"),A=s((e,o)=>{const r=z(e,o);return typeof r=="string"?r:void 0},"safeGetString"),fe=s((e,o)=>o&&o.some(r=>r.toLowerCase()===e.toLowerCase())?!0:he.some(r=>r.test(e)),"isSensitiveHeader"),ye=s(e=>{if(!e)return[];if(L(e)){const o=p(e,"entries");if(o)return[...o()].map(([r,c])=>[r,c])}return Object.entries(e)},"normalizeHeadersToEntries"),we=s((e,o)=>!o||o.length===0?!0:o.some(r=>r.toLowerCase()===e.toLowerCase()),"shouldIncludeHeader"),$e=s((e,o)=>!e||!o?e:Array.isArray(e)?e.map(()=>o):o,"maskHeaderValue"),ke=s((e,o,r,c="[masked]")=>{const h=ye(e);if(h.length===0)return;const x={};for(const[l,a]of h){if(!we(l,o)||a===void 0)continue;const m=fe(l.toLowerCase(),r)?c:void 0;x[l]=$e(a,m)}return x},"filterHeaders"),W=s(e=>{try{return JSON.stringify(e,null,2)}catch{return String(e)}},"safeJsonStringify"),De=s(e=>{if(!e)return{};const o={};return e.split(";").map(r=>r.trim()).filter(Boolean).forEach(r=>{const c=r.indexOf("=");if(c===-1)return;const h=r.slice(0,c).trim(),x=r.slice(c+1).trim();o[h]=x}),o},"parseCookieString"),Ce=s(async(e,o)=>{try{const r=String(A(e,"method")||"GET").toUpperCase();if(r==="GET"||r==="HEAD")return;const c=z(e,"headers"),h=L(c)?p(c,"get")?.("content-type")||"":String(c?.["content-type"]||""),x=p(e,"clone"),l=x?x():e;if(p(l,"json")&&String(h).includes("application/json"))try{const a=p(l,"json");return a?await a():void 0}catch{try{const a=p(l,"text");return a?await a()||"":void 0}catch{return}}if(p(l,"text"))try{const a=p(l,"text");return a?await a():void 0}catch{return}return p(e,"on")?await new Promise(a=>{try{let m="",N=!1;const C=p(e,"setEncoding");C&&C("utf8");const k=s(y=>{if(N)return;const M=typeof y=="string"?y:String(y);if(m.length+M.length>o){const D=Math.max(0,o-m.length);m+=M.slice(0,D),N=!0,b(),a(`${m}
15
+ … [truncated]`);return}m+=M},"onData"),E=s(()=>{b(),a(m||void 0)},"onEnd"),B=s(()=>{b(),a(void 0)},"onError"),b=s(()=>{const y=p(e,"off");y?.("data",k),y?.("end",E),y?.("error",B)},"cleanup"),F=p(e,"on");F?.("data",k),F?.("end",E),F?.("error",B)}catch{a(void 0)}}):void 0}catch{return}},"readRequestBody"),Fe=s(async(e,o)=>{const r=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`,{headerAllowlist:c,headerDenylist:h,maskValue:x="[masked]"}=o||{},l=ke(z(e,"headers"),c,h,x),a=s(t=>{if(t!==void 0)return Array.isArray(t)?t.join(", "):t},"toSingle"),m=s(t=>`'${String(t).replaceAll("'",String.raw`'\''`)}'`,"shellQuote"),N=s(t=>{if(!t)return;const n=[];for(const[i,d]of Object.entries(t)){const g=a(d)??"";n.push(`${i}=${g}`)}return n.length>0?n.join("; "):void 0},"buildCookieHeader");let C;const k=z(e,"headers");if(L(k)){const t=p(k,"get")?.("cookie");C=typeof t=="string"?t:void 0}else if(Array.isArray(k?.cookie))C=k?.cookie?.[0];else{const t=k?.cookie;C=typeof t=="string"?t:void 0}const E=De(C),B=Math.max(0,Number(o?.previewBytes??64e3)),b=await Ce(e,B),F=s(()=>{const t=String(A(e,"method")||"GET").toUpperCase(),n=String(A(e,"url")||""),i=[],d={};if(l)for(const[w,$]of Object.entries(l)){const Q=a($);Q!==void 0&&(d[w]=Q)}const g=N(E);g&&!d.cookie&&(d.Cookie=g);for(const[w,$]of Object.entries(d))i.push(`-H ${m(`${w}: ${$}`)}`);let v="";if(e&&b!==void 0&&b!==null&&t!=="GET"){const w=typeof b=="string"?b:W(b);v=`--data ${m(w)}`}const u=["curl","-X",t];return i.length>0&&u.push("\\",` ${i.join(` \\
16
+ `)}`),v&&u.push("\\",` ${v}`),u.push("\\",` ${m(n)}`),u.join(" ")},"buildCurl")(),y=await(await de()).codeToHtml(F,{lang:"bash",themes:{dark:"github-dark-default",light:"github-light"}}),M=le(y),D=s(t=>P(t),"attributeEscape"),f=s(t=>G(t),"escapeHtml"),U=s(t=>!t||Object.keys(t).length===0?'<div class="px-4 pb-4 pt-2 text-xs text-[var(--ono-text-muted)]">(empty)</div>':`<div class="px-4 pb-4">${Object.entries(t).map(([n,i])=>{const d=Array.isArray(i)?i.join(", "):i;return`<div class="grid grid-cols-[200px_1fr] gap-3 items-start py-2 border-b border-[var(--ono-border)]">
17
+ <div class="text-[11px] uppercase tracking-wide text-[var(--ono-text-muted)]">${f(n)}</div>
18
+ <div class="text-sm break-words whitespace-pre-wrap text-[var(--ono-text)]">${f(String(d))}</div>
19
+ </div>`}).join("")}</div>`,"renderKeyValueTable"),te=s(t=>`<span class="text-[var(--ono-red-orange)]">${typeof t=="string"?`"${f(t)}"`:String(t)}</span>`,"renderPrimitiveValue"),oe=s(t=>`<span class="italic text-[var(--ono-text-muted)]">${t===null?"null":"undefined"}</span>`,"renderNullishValue"),re=s((t,n)=>{if(Object.keys(t).length===0)return'<span class="italic text-[var(--ono-text-muted)]">(empty object)</span>';if(n>=3)return`<span class="italic text-[var(--ono-text-muted)]">{Object with ${Object.keys(t).length} keys}</span>`;const i=Object.entries(t).slice(0,10).map(([g,v])=>{const u=H(v,n+1);return`
20
+ <div class="ml-4 pl-3 py-1 border-l-2 border-[var(--ono-border)]">
21
+ <span class="font-medium text-[var(--ono-text)]">${f(g)}:</span> ${u}
22
+ </div>`}).join(""),d=Object.keys(t).length>10?`<div class="ml-4 italic text-[var(--ono-text-muted)]">... and ${Object.keys(t).length-10} more keys</div>`:"";return`<div class="space-y-1">${i}${d}</div>`},"renderObjectValue"),H=s((t,n=0)=>{if(t==null)return oe(t);if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return te(t);if(Array.isArray(t)){if(t.length===0)return'<span class="italic text-[var(--ono-text-muted)]">(empty array)</span>';if(n>=3)return`<span class="italic text-[var(--ono-text-muted)]">[Array with ${t.length} items]</span>`;const i=t.slice(0,10).map((g,v)=>{const u=H(g,n+1);return`
23
+ <div class="ml-4 pl-3 py-1 border-l-2 border-[var(--ono-border)]">
24
+ <span class="text-xs text-[var(--ono-text-muted)]">[${v}]:</span> ${u}
25
+ </div>`}).join(""),d=t.length>10?`<div class="ml-4 text-sm italic text-[var(--ono-text-muted)]">... and ${t.length-10} more items</div>`:"";return`<div class="space-y-1">${i}${d}</div>`}return typeof t=="object"?re(t,n):`<span class="text-[var(--ono-text)]">${f(String(t))}</span>`},"renderValue"),_=s(t=>!t||Object.keys(t).length===0?'<div class="px-4 pb-4 pt-2 text-xs text-[var(--ono-text-muted)]">(empty)</div>':`<div class="px-4 pb-4">${Object.entries(t).map(([n,i])=>{const d=H(i);return`<div class="grid grid-cols-[200px_1fr] gap-3 items-start py-2 border-b border-[var(--ono-border)]">
26
+ <div class="text-[11px] uppercase tracking-wide text-[var(--ono-text-muted)]">${f(n)}</div>
27
+ <div class="text-sm break-words text-[var(--ono-text)]">${d}</div>
28
+ </div>`}).join("")}</div>`,"renderObjectTable"),se=s(t=>t==null?'<div class="px-4 pb-4 pt-2 text-xs text-[var(--ono-text-muted)]">(no body)</div>':typeof t=="string"?t.trim()===""?'<div class="px-4 pb-4 pt-2 text-xs text-[var(--ono-text-muted)]">(empty string)</div>':`<div class="px-4 pb-4">
29
+ <div class="text-sm break-words whitespace-pre-wrap font-mono p-3 rounded border border-[var(--ono-border)] bg-[var(--ono-surface-muted)] text-[var(--ono-text)]">${f(t)}</div>
30
+ </div>`:typeof t=="object"?Array.isArray(t)?t.length===0?'<div class="px-4 pb-4 pt-2 text-xs text-[var(--ono-text-muted)]">(empty array)</div>':`<div class="px-4 pb-4">
31
+ <div class="text-sm break-words p-3 rounded border border-[var(--ono-border)] bg-[var(--ono-surface-muted)] text-[var(--ono-text)]">${H(t)}</div>
32
+ </div>`:Object.keys(t).length===0?'<div class="px-4 pb-4 pt-2 text-xs text-[var(--ono-text-muted)]">(empty object)</div>':`<div class="px-4 pb-4">
33
+ <div class="text-sm break-words p-3 rounded border border-[var(--ono-border)] bg-[var(--ono-surface-muted)] text-[var(--ono-text)]">${H(t)}</div>
34
+ </div>`:`<div class="px-4 pb-4">
35
+ <div class="text-sm break-words whitespace-pre-wrap font-mono p-3 rounded border border-[var(--ono-border)] bg-[var(--ono-surface-muted)] text-[var(--ono-text)]">${f(String(t))}</div>
36
+ </div>`,"renderBodyContent"),K=s(t=>{if(!t)return{content:"",sidebar:""};const n=new Set(["request"]),i=Object.keys(t).filter(v=>!n.has(v));if(i.length===0)return{content:"",sidebar:""};let d="",g="";return i.forEach(v=>{const u=t[v];if(u&&typeof u=="object"&&(Array.isArray(u)||Object.keys(u).length>0)){const w=v.charAt(0).toUpperCase()+v.slice(1),$=`context-${v}`;d+=`
37
+ <div>
38
+ <div class="text-[11px] uppercase tracking-wide mb-2 text-[var(--ono-text-muted)]">${w}</div>
39
+ <ul class="space-y-1 text-sm">
40
+ <li>
41
+ <a href="#${$}" class="flex items-center gap-2 px-2 py-1 rounded text-[var(--ono-text)] hover:bg-[var(--ono-surface-muted)] ono-scrollspy-active:bg-[var(--ono-surface-muted)] ono-scrollspy-active:font-semibold">
42
+ <span class="dui size-3" style="-webkit-mask-image:url('${S}'); mask-image:url('${S}')"></span>
43
+ <span>${w}</span>
44
+ </a>
45
+ </li>
46
+ </ul>
47
+ </div>`,g+=`
48
+ <input type="hidden" id="clipboard-${$}-${r}" value="${D(JSON.stringify(u))}">
49
+ <section id="${$}" class="mb-4 rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] overflow-hidden bg-[var(--ono-surface)] border border-[var(--ono-border)]">
50
+ <div class="px-4 py-2 flex items-center gap-2 bg-[var(--ono-surface-muted)] border-b border-[var(--ono-border)]">
51
+ <h3 class="text-sm font-semibold text-[var(--ono-text)]">${w}</h3>
52
+ <div class="grow"></div>
53
+ <a href="#${$}" class="text-xs text-[var(--ono-text-muted)]" aria-label="Anchor">#</a>
54
+ ${O({label:"Copy JSON",targetId:`clipboard-${$}-${r}`}).html}
55
+ </div>
56
+ <div class="max-w-full overflow-auto mt-2">${_(u)}</div>
57
+ </section>`}}),{content:g,sidebar:d}},"generateContextSections")(o.context),ae=`
58
+ <aside class="shrink-0 w-64 sticky top-4 self-start">
59
+ <nav aria-label="Context sections" class="p-3 rounded-[var(--ono-radius-md)] shadow-[var(--ono-elevation-1)] space-y-4 overflow-auto bg-[var(--ono-surface)] border border-[var(--ono-border)] max-h-[calc(100dvh-2rem)]">
60
+ <div>
61
+ <div class="text-[11px] uppercase tracking-wide mb-2 text-[var(--ono-text-muted)]">Request</div>
62
+ <ul class="space-y-1 text-sm">
63
+ <li>
64
+ <a href="#context-request" class="flex items-center gap-2 px-2 py-1 rounded text-[var(--ono-text)] hover:bg-[var(--ono-surface-muted)]">
65
+ <span class="dui size-3" style="-webkit-mask-image:url('${I}'); mask-image:url('${I}')"></span>
66
+ <span>Overview</span>
67
+ </a>
68
+ </li>
69
+ <li>
70
+ <a href="#context-headers" class="flex items-center gap-2 px-2 py-1 rounded text-[var(--ono-text)] hover:bg-[var(--ono-surface-muted)]">
71
+ <span class="dui size-3" style="-webkit-mask-image:url('${S}'); mask-image:url('${S}')"></span>
72
+ <span>Headers</span>
73
+ </a>
74
+ </li>
75
+ <li>
76
+ <a href="#context-body" class="flex items-center gap-2 px-2 py-1 rounded text-[var(--ono-text)] hover:bg-[var(--ono-surface-muted)]">
77
+ <span class="dui size-3" style="-webkit-mask-image:url('${q}'); mask-image:url('${q}')"></span>
78
+ <span>Body</span>
79
+ </a>
80
+ </li>
81
+ <li>
82
+ <a href="#context-session" class="flex items-center gap-2 px-2 py-1 rounded text-[var(--ono-text)] hover:bg-[var(--ono-surface-muted)]">
83
+ <span class="dui size-3" style="-webkit-mask-image:url('${R}'); mask-image:url('${R}')"></span>
84
+ <span>Session</span>
85
+ </a>
86
+ </li>
87
+ <li>
88
+ <a href="#context-cookies" class="flex items-center gap-2 px-2 py-1 rounded text-[var(--ono-text)] hover:bg-[var(--ono-surface-muted)]">
89
+ <span class="dui size-3" style="-webkit-mask-image:url('${J}'); mask-image:url('${J}')"></span>
90
+ <span>Cookies</span>
91
+ </a>
92
+ </li>
93
+ </ul>
94
+ </div>${K.sidebar}
95
+ </nav>
96
+ </aside>`,ne=`
97
+ <div class="grow min-w-0">
98
+ <input type="hidden" id="clipboard-curl-${r}" value="${D(F)}">
99
+ <section id="context-request" class="mb-4 rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] overflow-hidden bg-[var(--ono-surface)] border border-[var(--ono-border)]">
100
+ <div class="px-4 py-2 flex items-center gap-3 min-w-0 bg-[var(--ono-surface-muted)] border-b border-[var(--ono-border)]">
101
+ <span class="dui size-4" style="-webkit-mask-image:url('${I}'); mask-image:url('${I}')"></span>
102
+ <h2 class="text-sm font-semibold text-[var(--ono-text)]">Request</h2>
103
+ <a class="text-sm truncate text-[var(--ono-red-orange)]" href="${ce(A(e,"url")||"#")}">${f(A(e,"url")||"")}</a>
104
+ <span class="inline-block text-[10px] px-2 py-0.5 rounded-full bg-[var(--ono-chip-bg)] text-[var(--ono-chip-text)]">${f(String(A(e,"method")||"GET"))}</span>
105
+ <div class="grow"></div>
106
+ ${O({label:"Copy cURL",targetId:`clipboard-curl-${r}`}).html}
107
+ </div>
108
+ <div class="px-4 pb-4 overflow-auto mt-2">${M}</div>
109
+ </section>
110
+
111
+ <input type="hidden" id="clipboard-headers-${r}" value="${D(JSON.stringify(l||{}))}">
112
+ <section id="context-headers" class="mb-4 rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] overflow-hidden bg-[var(--ono-surface)] border border-[var(--ono-border)]">
113
+ <div class="px-4 py-2 flex items-center gap-2 bg-[var(--ono-surface-muted)] border-b border-[var(--ono-border)]">
114
+ <span class="dui size-4" style="-webkit-mask-image:url('${S}'); mask-image:url('${S}')"></span>
115
+ <h3 class="text-sm font-semibold text-[var(--ono-text)]">Headers</h3>
116
+ <div class="grow"></div>
117
+ <a href="#context-headers" class="text-xs text-[var(--ono-text-muted)]" aria-label="Anchor">#</a>
118
+ ${O({label:"Copy JSON",targetId:`clipboard-headers-${r}`}).html}
119
+ </div>
120
+ <div class="max-w-full overflow-auto mt-2">${U(l)}</div>
121
+ </section>
122
+
123
+ <input type="hidden" id="clipboard-body-${r}" value="${D(W(b??{}))}">
124
+ <section id="context-body" class="mb-4 rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] overflow-hidden bg-[var(--ono-surface)] border border-[var(--ono-border)]">
125
+ <div class="px-4 py-2 flex items-center gap-2 bg-[var(--ono-surface-muted)] border-b border-[var(--ono-border)]">
126
+ <span class="dui size-4" style="-webkit-mask-image:url('${q}'); mask-image:url('${q}')"></span>
127
+ <h3 class="text-sm font-semibold text-[var(--ono-text)]">Body</h3>
128
+ <div class="grow"></div>
129
+ <a href="#context-body" class="text-xs text-[var(--ono-text-muted)]" aria-label="Anchor">#</a>
130
+ ${O({label:"Copy JSON",targetId:`clipboard-body-${r}`}).html}
131
+ </div>
132
+ <div class="max-w-full overflow-auto mt-2">${se(b)}</div>
133
+ </section>
134
+
135
+ <input type="hidden" id="clipboard-session-${r}" value="${D(JSON.stringify(e?.session??{}))}">
136
+ <section id="context-session" class="mb-4 rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] overflow-hidden bg-[var(--ono-surface)] border border-[var(--ono-border)]">
137
+ <div class="px-4 py-2 flex items-center gap-2 bg-[var(--ono-surface-muted)] border-b border-[var(--ono-border)]">
138
+ <span class="dui size-4" style="-webkit-mask-image:url('${R}'); mask-image:url('${R}')"></span>
139
+ <h3 class="text-sm font-semibold text-[var(--ono-text)]">Session</h3>
140
+ <div class="grow"></div>
141
+ <a href="#context-session" class="text-xs text-[var(--ono-text-muted)]" aria-label="Anchor">#</a>
142
+ ${O({label:"Copy JSON",targetId:`clipboard-session-${r}`}).html}
143
+ </div>
144
+ <div class="max-w-full overflow-auto mt-2">${_(e?.session)}</div>
145
+ </section>
146
+
147
+ <input type="hidden" id="clipboard-cookies-${r}" value="${D(JSON.stringify(E||{}))}">
148
+ <section id="context-cookies" class="mb-4 rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] overflow-hidden bg-[var(--ono-surface)] border border-[var(--ono-border)]">
149
+ <div class="px-4 py-2 flex items-center gap-2 bg-[var(--ono-surface-muted)] border-b border-[var(--ono-border)]">
150
+ <span class="dui size-4" style="-webkit-mask-image:url('${J}'); mask-image:url('${J}')"></span>
151
+ <h3 class="text-sm font-semibold text-[var(--ono-text)]">Cookies</h3>
152
+ <div class="grow"></div>
153
+ <a href="#context-cookies" class="text-xs text-[var(--ono-text-muted)]" aria-label="Anchor">#</a>
154
+ ${O({label:"Copy JSON",targetId:`clipboard-cookies-${r}`}).html}
155
+ </div>
156
+ <div class="max-w-full overflow-auto mt-2">${U(E)}
157
+ </div>
158
+ </section>${K.content}
159
+ </div>`;return{code:{html:`
160
+ <div class="w-full flex gap-4 relative">
161
+ ${ae}
162
+ ${ne}
163
+ </div>`,script:""},id:"context",name:"Context"}},"createRequestContext");export{Fe as default};
@@ -0,0 +1,33 @@
1
+ import { SolutionFinder } from '@visulima/error/solution';
2
+ import { RenderErrorOptions } from '@visulima/error/error';
3
+ import { T as TemplateOptions$1 } from './packem_shared/types-B8vYgwmD.js';
4
+
5
+ type ColorizeMethod = (value: string) => string;
6
+ type BaseCliOptions = {
7
+ solutionTitle?: string;
8
+ solutionFinders?: SolutionFinder[];
9
+ debug?: boolean;
10
+ } & Partial<Omit<RenderErrorOptions, "color">> & {
11
+ color?: {
12
+ codeFrame?: RenderErrorOptions["color"];
13
+ boxen?: {
14
+ headerTextColor?: ColorizeMethod;
15
+ textColor?: ColorizeMethod;
16
+ borderColor?: ColorizeMethod;
17
+ };
18
+ };
19
+ };
20
+
21
+ type TemplateOptions = TemplateOptions$1 & {
22
+ solutionFinders?: SolutionFinder[];
23
+ };
24
+ type CliOptions = BaseCliOptions;
25
+ declare class Ono {
26
+ toHTML(error: unknown, options?: TemplateOptions): Promise<string>;
27
+ toANSI(error: unknown, options?: CliOptions): Promise<{
28
+ errorAnsi: string;
29
+ solutionBox: undefined | string;
30
+ }>;
31
+ }
32
+
33
+ export { type CliOptions, Ono, type TemplateOptions };