typebulb 0.45.2 → 0.47.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 +21 -4
- package/SKILL.md +23 -6
- package/dist/agents/claude/client.js +138 -70
- package/dist/agents/pi/client.js +138 -70
- package/dist/agents/pi/matchu-patchu.ts +1 -1
- package/dist/ai/protocol.d.ts +4 -0
- package/dist/ai/protocol.d.ts.map +1 -1
- package/dist/dts/tbTypings.d.ts +2 -2
- package/dist/dts/tbTypings.d.ts.map +1 -1
- package/dist/dts/tbTypings.js +18 -7
- package/dist/dts/tbTypings.js.map +1 -1
- package/dist/index.js +314 -237
- package/dist/render.js +125 -57
- package/dist/servers.js +137 -70
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`),t=0;if(e[t]?.trim()!=="---")return null;t++;let n=[];for(;t<e.length&&e[t]?.trim()!=="---";)n.push(e[t]),t++;if(e[t]?.trim()!=="---")return null;t++;let s=
|
|
5
|
-
`)),o.set(u,h),c=t}else t++}return{frontmatter:s,files:i,warnings:a,bodyEndLine:c,starts:o}}catch{return null}}function
|
|
3
|
+
var Ew=Object.create;var ya=Object.defineProperty;var Aw=Object.getOwnPropertyDescriptor;var Tw=Object.getOwnPropertyNames;var Pw=Object.getPrototypeOf,Ow=Object.prototype.hasOwnProperty;var ks=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var v=(r,e)=>()=>(r&&(e=r(r=0)),e);var T=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),hd=(r,e)=>{for(var t in e)ya(r,t,{get:e[t],enumerable:!0})},Cw=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Tw(e))!Ow.call(r,s)&&s!==t&&ya(r,s,{get:()=>e[s],enumerable:!(n=Aw(e,s))||n.enumerable});return r};var Rw=(r,e,t)=>(t=r!=null?Ew(Pw(r)):{},Cw(e||!r||!r.__esModule?ya(t,"default",{value:r,enumerable:!0}):t,r));import*as yd from"fs/promises";import{existsSync as cr,readFileSync as _w}from"fs";import*as re from"path";import{pathToFileURL as Nw}from"url";import{resolve as wa}from"resolve.exports";import{init as bd,parse as wd}from"es-module-lexer";function vd(r,e){let t=re.join(r,"package.json");try{return JSON.parse(_w(t,"utf8"))}catch{throw new Error(`--replace package '${e}' has no readable package.json at ${t}`)}}function Sd(r){let e=r.indexOf("=");if(e===-1)throw new Error(`--replace must be <name>=<path> (got '${r}')`);let t=r.slice(0,e).trim(),n=r.slice(e+1).trim();if(!t)throw new Error(`--replace missing package name (got '${r}')`);if(!n)throw new Error(`--replace missing path for '${t}'`);if(t.startsWith("@"))throw new Error(`--replace does not support scoped names yet; '${t}' is scoped`);return{name:t,dir:re.resolve(n)}}async function kd(r){let{name:e,dir:t}=r;if(!cr(t))throw new Error(`--replace path for '${e}' does not exist: ${t}`);let n=vd(t,e),s=Iw(n,e),i=re.resolve(t,s);if(!cr(i))throw new Error(`--replace package '${e}' entry not found on disk: ${i} \u2014 did you build it (e.g. \`pnpm run build\`)?`);let o=re.dirname(i),a=`/local/${e}/${re.basename(i)}`,c=$w(n,t);return await Lw(e,i,o),{name:e,dir:t,entryAbs:i,serveDir:o,entryUrl:a,typesAbs:c}}function Iw(r,e){if(r.exports!==void 0){let n;try{n=wa(r,".",{browser:!0,conditions:ba})}catch(i){throw new Error(`--replace package '${e}' "exports" does not resolve a browser entry (conditions: ${ba.join(", ")}): ${i instanceof Error?i.message:i}`)}let s=va(n);if(!s)throw new Error(`--replace package '${e}' "exports" did not resolve "." to a single file (conditions: ${ba.join(", ")}); too complex to override.`);return s}let t=r.module??r.main;if(!t)throw new Error(`--replace package '${e}' has no "exports", "module", or "main" entry to resolve.`);return t}function $w(r,e){if(r.exports!==void 0)try{let n=wa(r,".",{conditions:["types"]}),s=va(n);if(s){let i=re.resolve(e,s);if(cr(i))return i}}catch{}let t=r.types??r.typings;if(t){let n=re.resolve(e,t);if(cr(n))return n}}function va(r){if(typeof r=="string")return r;if(Array.isArray(r))return r.find(e=>typeof e=="string")}async function Lw(r,e,t){await bd;let n=re.normalize(t),s=new Set,i=[e];for(;i.length;){let o=i.shift();if(s.has(o))continue;s.add(o);let a;try{a=await yd.readFile(o,"utf8")}catch{continue}let c,l;try{[c,,,l]=wd(a,o)}catch{continue}if(o===e&&!l)throw new Error(`override package '${r}' entry is not an ES module (no import/export syntax); CommonJS or non-module entries aren't supported (esm.sh would have to transform it).`);for(let d of c){if(d.d===-2)continue;let u=d.n;if(u&&!u.startsWith("node:")){if(u.startsWith("./")||u.startsWith("../")||u.startsWith("/")){let f=Mw(o,u,n);f&&!s.has(f)&&i.push(f);continue}throw new Error(`override package must ship self-contained (bundle its dependencies); ${r} externalizes '${u}'`)}}}}function Mw(r,e,t){let n=e.replace(/[?#].*$/,""),s=re.resolve(re.dirname(r),n),i=[s,s+".js",s+".mjs",re.join(s,"index.js"),re.join(s,"index.mjs")];for(let o of i)if(re.normalize(o).startsWith(t)&&cr(o))return o}function Bw(r,e,t){let n=vd(r,e),s;if(n.exports!==void 0)try{s=va(wa(n,t,{conditions:gd}))}catch(o){throw new Error(`--replace package '${e}' "exports" does not resolve a node entry for '${t}' (conditions: ${gd.join(", ")}): ${o instanceof Error?o.message:o}`)}else t==="."&&(s=n.main??n.module);if(!s)throw new Error(`--replace package '${e}' has no node export for '${t}'.`);let i=re.resolve(r,s);if(!cr(i))throw new Error(`--replace package '${e}' built file not found: ${i} \u2014 did you build it (e.g. \`pnpm run build\`)?`);return Nw(i).href}async function xd(r,e){await bd;let t;try{[t]=wd(r)}catch{return r}let n="",s=0;for(let i of t){if(i.d!==-1)continue;let o=i.n;if(!o||o!==e.name&&!o.startsWith(e.name+"/"))continue;let a=o===e.name?".":"."+o.slice(e.name.length),c=Bw(e.dir,e.name,a);n+=r.slice(s,i.s)+c,s=i.e}return n+r.slice(s)}var ba,gd,xs=v(()=>{ba=["browser","import","default"],gd=["node","import","default"]});function Ed(r){return Ce.find(e=>ae[e].path===r)}function Td(r){return!!r?.startsWith("typebulb")}var ae,Ce,Ad,Es=v(()=>{ae={code:{path:"code.tsx",language:"typescript"},css:{path:"styles.css",language:"css"},html:{path:"index.html",language:"html"},config:{path:"config.json",language:"json"},notes:{path:"notes.md",language:"markdown"},data:{path:"data.txt",language:"text"},infer:{path:"infer.md",language:"markdown"},insight:{path:"insight.json",language:"json"}},Ce=["code","css","html","data","infer","insight","config","notes"];Ad="typebulb/v1"});function Sa(r){return/[:\n"']/.test(r)||r.startsWith(" ")||r.endsWith(" ")?`"${r.replace(/"/g,'\\"')}"`:r}function ka(r){return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1).replace(/\\"/g,'"'):r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r}var As=v(()=>{});function ue(r){try{let e=r.split(`
|
|
4
|
+
`),t=0;if(e[t]?.trim()!=="---")return null;t++;let n=[];for(;t<e.length&&e[t]?.trim()!=="---";)n.push(e[t]),t++;if(e[t]?.trim()!=="---")return null;t++;let s=qw(n);if(!s)return null;let i=new Map,o=new Map,a=[],c=t;for(;t<e.length;){let d=e[t]?.trim()?.match(Pd);if(d){let u=d[1].trim();for(t++;t<e.length&&e[t]?.trim()==="";)t++;let f=e[t]?.match(Ts);if(!f){a.push(`**${u}** has no code fence \u2014 block skipped`);continue}let p=f[1];t++;let h=t+1,m=[],b=xa(p);for(;t<e.length&&!e[t]?.match(b);)m.push(e[t]),t++;let A=t<e.length;t++,a.push(...jw(u,m,A)),i.set(u,m.join(`
|
|
5
|
+
`)),o.set(u,h),c=t}else t++}return{frontmatter:s,files:i,warnings:a,bodyEndLine:c,starts:o}}catch{return null}}function jw(r,e,t){let n=[];for(let s=0;s<e.length;s++){let i=e[s]?.trim().match(Pd);i&&Dw.has(i[1].trim())&&Fw(e,s)&&n.push(i[1].trim())}return n.length?n.map(s=>`**${r}** block has an unterminated code fence \u2014 it swallowed the **${s}** block.`):t?[]:[`**${r}** block has an unterminated code fence (it runs to the end of the file).`]}function Fw(r,e){let t=e+1;for(;t<r.length&&r[t]?.trim()==="";)t++;return!!r[t]?.match(Ts)}function qw(r){let e={};for(let t of r){let n=t.indexOf(":");if(n===-1)continue;let s=t.slice(0,n).trim(),i=t.slice(n+1).trim();switch(s){case"format":e.format=i;break;case"name":e.name=ka(i);break}}return!Td(e.format)||!e.name?null:e}function Od(r){return ue(r)?.warnings??[]}function Cd(r){let e=Object.fromEntries(Ce.map(t=>[t,r.files.get(ae[t].path)||""]));return{name:r.frontmatter.name,...e}}var Pd,Ts,Dw,xa,Ea=v(()=>{Es();As();Pd=/^\*\*(.+)\*\*$/,Ts=/^(`{3,})(\w*)\s*$/,Dw=new Set(Ce.map(r=>ae[r].path)),xa=r=>new RegExp(`^${r}\\s*$`)});function Rd(r){let e=r.match(/^`{3,}/gm),t=e?Math.max(...e.map(n=>n.length)):0;return"`".repeat(Math.max(3,t+1))}function _d(r,e){let{path:t}=ae[r],n=t.split(".").pop(),s=Rd(e);return`**${t}**
|
|
6
6
|
|
|
7
7
|
${s}${n}
|
|
8
8
|
${e}
|
|
9
|
-
${s}`}function
|
|
10
|
-
`)}function
|
|
11
|
-
`),s=
|
|
9
|
+
${s}`}function Nd(r){let e=Ce.filter(t=>r[t]).map(t=>_d(t,r[t]));return["---",`format: ${Ad}`,`name: ${Sa(r.name)}`,"---","",...e].join(`
|
|
10
|
+
`)}function Id(r,e){for(let t=0;t<r.length;t++){if(r[t]?.trim()!==`**${e}**`)continue;let n=t+1;for(;n<r.length&&r[n]?.trim()==="";)n++;let s=r[n]?.match(Ts);if(!s)continue;let i=xa(s[1]),o=n+1;for(;o<r.length&&!r[o]?.match(i);)o++;return o>=r.length?"unterminated":{header:t,open:n,close:o,fence:s[1],lang:s[2]}}return null}function Zr(r,e,t){let n=r.split(`
|
|
11
|
+
`),s=Id(n,ae[e].path);if(s==="unterminated")return r;if(!s)return`${r.replace(/\s*$/,"")}
|
|
12
12
|
|
|
13
|
-
${
|
|
14
|
-
`;let i=
|
|
13
|
+
${_d(e,t)}
|
|
14
|
+
`;let i=Rd(t),o=i.length>s.fence.length?i:s.fence;return[...n.slice(0,s.open),o+s.lang,...t.split(`
|
|
15
15
|
`),o,...n.slice(s.close+1)].join(`
|
|
16
|
-
`)}function
|
|
17
|
-
`),n=
|
|
16
|
+
`)}function $d(r,e){let t=r.split(`
|
|
17
|
+
`),n=Id(t,ae[e].path);if(!n||n==="unterminated")return r;let s=n.close+1;for(;s<t.length&&t[s]?.trim()==="";)s++;return[...t.slice(0,n.header),...t.slice(s)].join(`
|
|
18
18
|
`).replace(/\s*$/,"")+`
|
|
19
|
-
`}var
|
|
20
|
-
>/]`,i);if(n&&console.log("[xml-utils] start:",o),o===-1)return;let a=r.slice(o+e.length),c=
|
|
21
|
-
>]`),m+=Os(b,"</"+e+">"),m>=h)break;p=c}}else c=
|
|
22
|
-
`)}};
|
|
23
|
-
`)?
|
|
19
|
+
`}var Ld=v(()=>{Es();Ea();As()});function en(r){if(!r.trim())return{};try{return JSON.parse(r)}catch{return{}}}function Bd(r){switch(Md(r)){case".js":case".mjs":return"text/javascript";case".wasm":return"application/wasm";case".json":case".map":return"application/json";case".svg":return"image/svg+xml";case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".avif":return"image/avif";case".ico":return"image/x-icon";case".mp3":return"audio/mpeg";case".wav":return"audio/wav";case".ogg":return"audio/ogg";case".m4a":return"audio/mp4";case".mp4":return"video/mp4";case".webm":return"video/webm";case".woff2":return"font/woff2";case".ttf":return"font/ttf";case".css":return"text/css";case".txt":return"text/plain; charset=utf-8";default:return"application/octet-stream"}}function Dd(r){let e=Md(r);return e!==void 0&&Jw.has(e)?e:void 0}function Hw(r){return r.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"")}function Aa(r){let e=en(r??"").description?.trim();if(!e)return Kw;let t=Hw(e);return(t.length>200?t.slice(0,197)+"...":t).replace(/\n/g," ")}var Uw,Ps,Md,Jw,Kw,jd=v(()=>{Uw="https://assets.typebulb.com",Ps=(r,e)=>`${Uw}/u/${encodeURIComponent(r)}/${encodeURIComponent(e)}/`,Md=r=>/\.[^./\\]+$/.exec(r)?.[0]?.toLowerCase();Jw=new Set([".html",".htm",".xhtml",".js",".mjs",".cjs",".ts",".tsx",".css"]);Kw="A Typebulb bulb."});var Fd=v(()=>{});function Ta(r,e,t){let s=new RegExp(e).exec(r.slice(t));return s?t+s.index:-1}var qd=v(()=>{});function tn(r,e,t){let s=new RegExp(e).exec(r.slice(t));return s?t+s.index+s[0].length-1:-1}var Ud=v(()=>{});function Os(r,e){let t=new RegExp(e,"g"),n=r.match(t);return n?n.length:0}var Jd=v(()=>{});function rn(r,e,t){let n=t&&t.debug||!1,s=!(t&&typeof t.nested===!1),i=t&&t.startIndex||0;n&&console.log("[xml-utils] starting findTagByName with",e," and ",t);let o=Ta(r,`<${e}[
|
|
20
|
+
>/]`,i);if(n&&console.log("[xml-utils] start:",o),o===-1)return;let a=r.slice(o+e.length),c=tn(a,"^[^<]*[ /]>",0),l=c!==-1&&a[c-1]==="/";if(n&&console.log("[xml-utils] selfClosing:",l),l===!1)if(s){let p=0,h=1,m=0;for(;(c=tn(a,"[ /]"+e+">",p))!==-1;){let b=a.substring(p,c+1);if(h+=Os(b,"<"+e+`[
|
|
21
|
+
>]`),m+=Os(b,"</"+e+">"),m>=h)break;p=c}}else c=tn(a,"[ /]"+e+">",0);let d=o+e.length+c+1;if(n&&console.log("[xml-utils] end:",d),d===-1)return;let u=r.slice(o,d),f;return l?f=null:f=u.slice(u.indexOf(">")+1,u.lastIndexOf("<")),{inner:f,outer:u,start:o,end:d}}var Pa=v(()=>{qd();Ud();Jd()});var Oa=v(()=>{Pa()});var Ca=v(()=>{Oa()});var Kd=v(()=>{Ca()});var Hd=v(()=>{});var Wd=v(()=>{Fd();Pa();Oa();Kd();Ca();Hd()});var q=T(ce=>{"use strict";var Ra=Symbol.for("yaml.alias"),Yd=Symbol.for("yaml.document"),Cs=Symbol.for("yaml.map"),Vd=Symbol.for("yaml.pair"),_a=Symbol.for("yaml.scalar"),Rs=Symbol.for("yaml.seq"),Xe=Symbol.for("yaml.node.type"),Vw=r=>!!r&&typeof r=="object"&&r[Xe]===Ra,zw=r=>!!r&&typeof r=="object"&&r[Xe]===Yd,Gw=r=>!!r&&typeof r=="object"&&r[Xe]===Cs,Xw=r=>!!r&&typeof r=="object"&&r[Xe]===Vd,zd=r=>!!r&&typeof r=="object"&&r[Xe]===_a,Qw=r=>!!r&&typeof r=="object"&&r[Xe]===Rs;function Gd(r){if(r&&typeof r=="object")switch(r[Xe]){case Cs:case Rs:return!0}return!1}function Zw(r){if(r&&typeof r=="object")switch(r[Xe]){case Ra:case Cs:case _a:case Rs:return!0}return!1}var ev=r=>(zd(r)||Gd(r))&&!!r.anchor;ce.ALIAS=Ra;ce.DOC=Yd;ce.MAP=Cs;ce.NODE_TYPE=Xe;ce.PAIR=Vd;ce.SCALAR=_a;ce.SEQ=Rs;ce.hasAnchor=ev;ce.isAlias=Vw;ce.isCollection=Gd;ce.isDocument=zw;ce.isMap=Gw;ce.isNode=Zw;ce.isPair=Xw;ce.isScalar=zd;ce.isSeq=Qw});var nn=T(Na=>{"use strict";var ne=q(),he=Symbol("break visit"),Xd=Symbol("skip children"),qe=Symbol("remove node");function _s(r,e){let t=Qd(e);ne.isDocument(r)?lr(null,r.contents,t,Object.freeze([r]))===qe&&(r.contents=null):lr(null,r,t,Object.freeze([]))}_s.BREAK=he;_s.SKIP=Xd;_s.REMOVE=qe;function lr(r,e,t,n){let s=Zd(r,e,t,n);if(ne.isNode(s)||ne.isPair(s))return ef(r,n,s),lr(r,s,t,n);if(typeof s!="symbol"){if(ne.isCollection(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let o=lr(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===he)return he;o===qe&&(e.items.splice(i,1),i-=1)}}}else if(ne.isPair(e)){n=Object.freeze(n.concat(e));let i=lr("key",e.key,t,n);if(i===he)return he;i===qe&&(e.key=null);let o=lr("value",e.value,t,n);if(o===he)return he;o===qe&&(e.value=null)}}return s}async function Ns(r,e){let t=Qd(e);ne.isDocument(r)?await ur(null,r.contents,t,Object.freeze([r]))===qe&&(r.contents=null):await ur(null,r,t,Object.freeze([]))}Ns.BREAK=he;Ns.SKIP=Xd;Ns.REMOVE=qe;async function ur(r,e,t,n){let s=await Zd(r,e,t,n);if(ne.isNode(s)||ne.isPair(s))return ef(r,n,s),ur(r,s,t,n);if(typeof s!="symbol"){if(ne.isCollection(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let o=await ur(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===he)return he;o===qe&&(e.items.splice(i,1),i-=1)}}}else if(ne.isPair(e)){n=Object.freeze(n.concat(e));let i=await ur("key",e.key,t,n);if(i===he)return he;i===qe&&(e.key=null);let o=await ur("value",e.value,t,n);if(o===he)return he;o===qe&&(e.value=null)}}return s}function Qd(r){return typeof r=="object"&&(r.Collection||r.Node||r.Value)?Object.assign({Alias:r.Node,Map:r.Node,Scalar:r.Node,Seq:r.Node},r.Value&&{Map:r.Value,Scalar:r.Value,Seq:r.Value},r.Collection&&{Map:r.Collection,Seq:r.Collection},r):r}function Zd(r,e,t,n){if(typeof t=="function")return t(r,e,n);if(ne.isMap(e))return t.Map?.(r,e,n);if(ne.isSeq(e))return t.Seq?.(r,e,n);if(ne.isPair(e))return t.Pair?.(r,e,n);if(ne.isScalar(e))return t.Scalar?.(r,e,n);if(ne.isAlias(e))return t.Alias?.(r,e,n)}function ef(r,e,t){let n=e[e.length-1];if(ne.isCollection(n))n.items[r]=t;else if(ne.isPair(n))r==="key"?n.key=t:n.value=t;else if(ne.isDocument(n))n.contents=t;else{let s=ne.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}Na.visit=_s;Na.visitAsync=Ns});var Ia=T(rf=>{"use strict";var tf=q(),tv=nn(),rv={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},nv=r=>r.replace(/[!,[\]{}]/g,e=>rv[e]),sn=class r{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},r.defaultYaml,e),this.tags=Object.assign({},r.defaultTags,t)}clone(){let e=new r(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new r(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:r.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},r.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:r.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},r.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),s=n.shift();switch(s){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[i,o]=n;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${s}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,s]=e.match(/^(.*!)([^!]*)$/s);s||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(s)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+nv(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),s;if(e&&n.length>0&&tf.isNode(e.contents)){let i={};tv.visit(e.contents,(o,a)=>{tf.isNode(a)&&a.tag&&(i[a.tag]=!0)}),s=Object.keys(i)}else s=[];for(let[i,o]of n)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(o)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
|
|
22
|
+
`)}};sn.defaultYaml={explicit:!1,version:"1.2"};sn.defaultTags={"!!":"tag:yaml.org,2002:"};rf.Directives=sn});var Is=T(on=>{"use strict";var nf=q(),sv=nn();function iv(r){if(/[\x00-\x19\s,[\]{}]/.test(r)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(r)}`;throw new Error(t)}return!0}function sf(r){let e=new Set;return sv.visit(r,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function of(r,e){for(let t=1;;++t){let n=`${r}${t}`;if(!e.has(n))return n}}function ov(r,e){let t=[],n=new Map,s=null;return{onAnchor:i=>{t.push(i),s??(s=sf(r));let o=of(e,s);return s.add(o),o},setAnchors:()=>{for(let i of t){let o=n.get(i);if(typeof o=="object"&&o.anchor&&(nf.isScalar(o.node)||nf.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:n}}on.anchorIsValid=iv;on.anchorNames=sf;on.createNodeAnchors=ov;on.findNewAnchor=of});var $a=T(af=>{"use strict";function an(r,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let s=0,i=n.length;s<i;++s){let o=n[s],a=an(r,n,String(s),o);a===void 0?delete n[s]:a!==o&&(n[s]=a)}else if(n instanceof Map)for(let s of Array.from(n.keys())){let i=n.get(s),o=an(r,n,s,i);o===void 0?n.delete(s):o!==i&&n.set(s,o)}else if(n instanceof Set)for(let s of Array.from(n)){let i=an(r,n,s,s);i===void 0?n.delete(s):i!==s&&(n.delete(s),n.add(i))}else for(let[s,i]of Object.entries(n)){let o=an(r,n,s,i);o===void 0?delete n[s]:o!==i&&(n[s]=o)}return r.call(e,t,n)}af.applyReviver=an});var lt=T(lf=>{"use strict";var av=q();function cf(r,e,t){if(Array.isArray(r))return r.map((n,s)=>cf(n,String(s),t));if(r&&typeof r.toJSON=="function"){if(!t||!av.hasAnchor(r))return r.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(r,n),t.onCreate=i=>{n.res=i,delete t.onCreate};let s=r.toJSON(e,t);return t.onCreate&&t.onCreate(s),s}return typeof r=="bigint"&&!t?.keep?Number(r):r}lf.toJS=cf});var $s=T(df=>{"use strict";var cv=$a(),uf=q(),lv=lt(),La=class{constructor(e){Object.defineProperty(this,uf.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:s,reviver:i}={}){if(!uf.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=lv.toJS(this,"",o);if(typeof s=="function")for(let{count:c,res:l}of o.anchors.values())s(l,c);return typeof i=="function"?cv.applyReviver(i,{"":a},"",a):a}};df.NodeBase=La});var cn=T(ff=>{"use strict";var uv=Is(),dv=nn(),dr=q(),fv=$s(),pv=lt(),Ma=class extends fv.NodeBase{constructor(e){super(dr.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],dv.visit(e,{Node:(i,o)=>{(dr.isAlias(o)||dr.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let s;for(let i of n){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:s,maxAliasCount:i}=t,o=this.resolve(s,t);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(o);if(a||(pv.toJS(o,null,t),a=n.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ls(s,o,n)),a.count*a.aliasCount>i)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,t,n){let s=`*${this.source}`;if(e){if(uv.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${s} `}return s}};function Ls(r,e,t){if(dr.isAlias(e)){let n=e.resolve(r),s=t&&n&&t.get(n);return s?s.count*s.aliasCount:0}else if(dr.isCollection(e)){let n=0;for(let s of e.items){let i=Ls(r,s,t);i>n&&(n=i)}return n}else if(dr.isPair(e)){let n=Ls(r,e.key,t),s=Ls(r,e.value,t);return Math.max(n,s)}return 1}ff.Alias=Ma});var ee=T(Ba=>{"use strict";var mv=q(),hv=$s(),gv=lt(),yv=r=>!r||typeof r!="function"&&typeof r!="object",ut=class extends hv.NodeBase{constructor(e){super(mv.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:gv.toJS(this.value,e,t)}toString(){return String(this.value)}};ut.BLOCK_FOLDED="BLOCK_FOLDED";ut.BLOCK_LITERAL="BLOCK_LITERAL";ut.PLAIN="PLAIN";ut.QUOTE_DOUBLE="QUOTE_DOUBLE";ut.QUOTE_SINGLE="QUOTE_SINGLE";Ba.Scalar=ut;Ba.isScalarValue=yv});var ln=T(mf=>{"use strict";var bv=cn(),Mt=q(),pf=ee(),wv="tag:yaml.org,2002:";function vv(r,e,t){if(e){let n=t.filter(i=>i.tag===e),s=n.find(i=>!i.format)??n[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return t.find(n=>n.identify?.(r)&&!n.format)}function Sv(r,e,t){if(Mt.isDocument(r)&&(r=r.contents),Mt.isNode(r))return r;if(Mt.isPair(r)){let u=t.schema[Mt.MAP].createNode?.(t.schema,null,t);return u.items.push(r),u}(r instanceof String||r instanceof Number||r instanceof Boolean||typeof BigInt<"u"&&r instanceof BigInt)&&(r=r.valueOf());let{aliasDuplicateObjects:n,onAnchor:s,onTagObj:i,schema:o,sourceObjects:a}=t,c;if(n&&r&&typeof r=="object"){if(c=a.get(r),c)return c.anchor??(c.anchor=s(r)),new bv.Alias(c.anchor);c={anchor:null,node:null},a.set(r,c)}e?.startsWith("!!")&&(e=wv+e.slice(2));let l=vv(r,e,o.tags);if(!l){if(r&&typeof r.toJSON=="function"&&(r=r.toJSON()),!r||typeof r!="object"){let u=new pf.Scalar(r);return c&&(c.node=u),u}l=r instanceof Map?o[Mt.MAP]:Symbol.iterator in Object(r)?o[Mt.SEQ]:o[Mt.MAP]}i&&(i(l),delete t.onTagObj);let d=l?.createNode?l.createNode(t.schema,r,t):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(t.schema,r,t):new pf.Scalar(r);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}mf.createNode=Sv});var Bs=T(Ms=>{"use strict";var kv=ln(),Ue=q(),xv=$s();function Da(r,e,t){let n=t;for(let s=e.length-1;s>=0;--s){let i=e[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=n,n=o}else n=new Map([[i,n]])}return kv.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:r,sourceObjects:new Map})}var hf=r=>r==null||typeof r=="object"&&!!r[Symbol.iterator]().next().done,ja=class extends xv.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>Ue.isNode(n)||Ue.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(hf(e))this.add(t);else{let[n,...s]=e,i=this.get(n,!0);if(Ue.isCollection(i))i.addIn(s,t);else if(i===void 0&&this.schema)this.set(n,Da(this.schema,s,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let s=this.get(t,!0);if(Ue.isCollection(s))return s.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...s]=e,i=this.get(n,!0);return s.length===0?!t&&Ue.isScalar(i)?i.value:i:Ue.isCollection(i)?i.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Ue.isPair(t))return!1;let n=t.value;return n==null||e&&Ue.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let s=this.get(t,!0);return Ue.isCollection(s)?s.hasIn(n):!1}setIn(e,t){let[n,...s]=e;if(s.length===0)this.set(n,t);else{let i=this.get(n,!0);if(Ue.isCollection(i))i.setIn(s,t);else if(i===void 0&&this.schema)this.set(n,Da(this.schema,s,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}};Ms.Collection=ja;Ms.collectionFromPath=Da;Ms.isEmptyPath=hf});var un=T(Ds=>{"use strict";var Ev=r=>r.replace(/^(?!$)(?: $)?/gm,"#");function Fa(r,e){return/^\n+$/.test(r)?r.substring(1):e?r.replace(/^(?! *$)/gm,e):r}var Av=(r,e,t)=>r.endsWith(`
|
|
23
|
+
`)?Fa(t,e):t.includes(`
|
|
24
24
|
`)?`
|
|
25
|
-
`+
|
|
26
|
-
`)t===
|
|
25
|
+
`+Fa(t,e):(r.endsWith(" ")?"":" ")+t;Ds.indentComment=Fa;Ds.lineComment=Av;Ds.stringifyComment=Ev});var yf=T(dn=>{"use strict";var Tv="flow",qa="block",js="quoted";function Pv(r,e,t="flow",{indentAtStart:n,lineWidth:s=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return r;s<i&&(i=0);let c=Math.max(1+i,1+s-e.length);if(r.length<=c)return r;let l=[],d={},u=s-e.length;typeof n=="number"&&(n>s-Math.max(2,i)?l.push(0):u=s-n);let f,p,h=!1,m=-1,b=-1,A=-1;t===qa&&(m=gf(r,m,e.length),m!==-1&&(u=m+c));for(let P;P=r[m+=1];){if(t===js&&P==="\\"){switch(b=m,r[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}A=m}if(P===`
|
|
26
|
+
`)t===qa&&(m=gf(r,m,e.length)),u=m+e.length+c,f=void 0;else{if(P===" "&&p&&p!==" "&&p!==`
|
|
27
27
|
`&&p!==" "){let R=r[m+1];R&&R!==" "&&R!==`
|
|
28
|
-
`&&R!==" "&&(f=m)}if(m>=u)if(f)l.push(f),u=f+c,f=void 0;else if(t===
|
|
29
|
-
${e}${r.slice(0,C)}`:(t===
|
|
30
|
-
${e}${r.slice(R+1,C)}`)}return w}function
|
|
31
|
-
`);n=e,s=e+1,i=r[s]}return n}
|
|
32
|
-
`){if(i-o>n)return!0;if(o=i+1,s-o<=n)return!1}return!0}function
|
|
28
|
+
`&&R!==" "&&(f=m)}if(m>=u)if(f)l.push(f),u=f+c,f=void 0;else if(t===js){for(;p===" "||p===" ";)p=P,P=r[m+=1],h=!0;let R=m>A+1?m-2:b-1;if(d[R])return r;l.push(R),d[R]=!0,u=R+c,f=void 0}else h=!0}p=P}if(h&&a&&a(),l.length===0)return r;o&&o();let w=r.slice(0,l[0]);for(let P=0;P<l.length;++P){let R=l[P],C=l[P+1]||r.length;R===0?w=`
|
|
29
|
+
${e}${r.slice(0,C)}`:(t===js&&d[R]&&(w+=`${r[R]}\\`),w+=`
|
|
30
|
+
${e}${r.slice(R+1,C)}`)}return w}function gf(r,e,t){let n=e,s=e+1,i=r[s];for(;i===" "||i===" ";)if(e<s+t)i=r[++e];else{do i=r[++e];while(i&&i!==`
|
|
31
|
+
`);n=e,s=e+1,i=r[s]}return n}dn.FOLD_BLOCK=qa;dn.FOLD_FLOW=Tv;dn.FOLD_QUOTED=js;dn.foldFlowLines=Pv});var pn=T(bf=>{"use strict";var Re=ee(),dt=yf(),qs=(r,e)=>({indentAtStart:e?r.indent.length:r.indentAtStart,lineWidth:r.options.lineWidth,minContentWidth:r.options.minContentWidth}),Us=r=>/^(%|---|\.\.\.)/m.test(r);function Ov(r,e,t){if(!e||e<0)return!1;let n=e-t,s=r.length;if(s<=n)return!1;for(let i=0,o=0;i<s;++i)if(r[i]===`
|
|
32
|
+
`){if(i-o>n)return!0;if(o=i+1,s-o<=n)return!1}return!0}function fn(r,e){let t=JSON.stringify(r);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,s=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Us(r)?" ":""),o="",a=0;for(let c=0,l=t[c];l;l=t[++c])if(l===" "&&t[c+1]==="\\"&&t[c+2]==="n"&&(o+=t.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(t[c+1]){case"u":{o+=t.slice(a,c);let d=t.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=t.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||t[c+2]==='"'||t.length<s)c+=1;else{for(o+=t.slice(a,c)+`
|
|
33
33
|
|
|
34
34
|
`;t[c+2]==="\\"&&t[c+3]==="n"&&t[c+4]!=='"';)o+=`
|
|
35
|
-
`,c+=2;o+=i,t[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+t.slice(a):t,n?o:
|
|
36
|
-
`)||/[ \t]\n|\n[ \t]/.test(r))return
|
|
37
|
-
${t}`)+"'";return e.implicitKey?n:
|
|
35
|
+
`,c+=2;o+=i,t[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+t.slice(a):t,n?o:dt.foldFlowLines(o,i,dt.FOLD_QUOTED,qs(e,!1))}function Ua(r,e){if(e.options.singleQuote===!1||e.implicitKey&&r.includes(`
|
|
36
|
+
`)||/[ \t]\n|\n[ \t]/.test(r))return fn(r,e);let t=e.indent||(Us(r)?" ":""),n="'"+r.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
37
|
+
${t}`)+"'";return e.implicitKey?n:dt.foldFlowLines(n,t,dt.FOLD_FLOW,qs(e,!1))}function fr(r,e){let{singleQuote:t}=e.options,n;if(t===!1)n=fn;else{let s=r.includes('"'),i=r.includes("'");s&&!i?n=Ua:i&&!s?n=fn:n=t?Ua:fn}return n(r,e)}var Ja;try{Ja=new RegExp(`(^|(?<!
|
|
38
38
|
))
|
|
39
39
|
+(?!
|
|
40
|
-
|$)`,"g")}catch{
|
|
40
|
+
|$)`,"g")}catch{Ja=/\n+(?!\n|$)/g}function Fs({comment:r,type:e,value:t},n,s,i){let{blockQuote:o,commentString:a,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(t))return fr(t,n);let l=n.indent||(n.forceBlockIndent||Us(t)?" ":""),d=o==="literal"?!0:o==="folded"||e===Re.Scalar.BLOCK_FOLDED?!1:e===Re.Scalar.BLOCK_LITERAL?!0:!Ov(t,c,l.length);if(!t)return d?`|
|
|
41
41
|
`:`>
|
|
42
42
|
`;let u,f;for(f=t.length;f>0;--f){let C=t[f-1];if(C!==`
|
|
43
43
|
`&&C!==" "&&C!==" ")break}let p=t.substring(f),h=p.indexOf(`
|
|
44
44
|
`);h===-1?u="-":t===p||h!==p.length-1?(u="+",i&&i()):u="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
45
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
45
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Ja,`$&${l}`));let m=!1,b,A=-1;for(b=0;b<t.length;++b){let C=t[b];if(C===" ")m=!0;else if(C===`
|
|
46
46
|
`)A=b;else break}let w=t.substring(0,A<b?A+1:b);w&&(t=t.substring(w.length),w=w.replace(/\n+/g,`$&${l}`));let R=(m?l?"2":"1":"")+u;if(r&&(R+=" "+a(r.replace(/ ?[\r\n]+/g," ")),s&&s()),!d){let C=t.replace(/\n+/g,`
|
|
47
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),_=!1,$=
|
|
47
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),_=!1,$=qs(n,!0);o!=="folded"&&e!==Re.Scalar.BLOCK_FOLDED&&($.onOverflow=()=>{_=!0});let E=dt.foldFlowLines(`${w}${C}${p}`,l,dt.FOLD_BLOCK,$);if(!_)return`>${R}
|
|
48
48
|
${l}${E}`}return t=t.replace(/\n+/g,`$&${l}`),`|${R}
|
|
49
|
-
${l}${w}${t}${p}`}function
|
|
50
|
-
`)||d&&/[[\]{},]/.test(i))return
|
|
51
|
-
`)?
|
|
52
|
-
`))return
|
|
53
|
-
${c}`);if(o){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:p,tags:h}=e.doc.schema;if(h.some(f)||p?.some(f))return
|
|
54
|
-
${e.indent}${a}`:a}
|
|
55
|
-
${a}:`):(b=`${b}:`,f&&(b+=
|
|
49
|
+
${l}${w}${t}${p}`}function Cv(r,e,t,n){let{type:s,value:i}=r,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:d}=e;if(a&&i.includes(`
|
|
50
|
+
`)||d&&/[[\]{},]/.test(i))return fr(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||d||!i.includes(`
|
|
51
|
+
`)?fr(i,e):Fs(r,e,t,n);if(!a&&!d&&s!==Re.Scalar.PLAIN&&i.includes(`
|
|
52
|
+
`))return Fs(r,e,t,n);if(Us(i)){if(c==="")return e.forceBlockIndent=!0,Fs(r,e,t,n);if(a&&c===l)return fr(i,e)}let u=i.replace(/\n+/g,`$&
|
|
53
|
+
${c}`);if(o){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:p,tags:h}=e.doc.schema;if(h.some(f)||p?.some(f))return fr(i,e)}return a?u:dt.foldFlowLines(u,c,dt.FOLD_FLOW,qs(e,!1))}function Rv(r,e,t,n){let{implicitKey:s,inFlow:i}=e,o=typeof r.value=="string"?r:Object.assign({},r,{value:String(r.value)}),{type:a}=r;a!==Re.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Re.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case Re.Scalar.BLOCK_FOLDED:case Re.Scalar.BLOCK_LITERAL:return s||i?fr(o.value,e):Fs(o,e,t,n);case Re.Scalar.QUOTE_DOUBLE:return fn(o.value,e);case Re.Scalar.QUOTE_SINGLE:return Ua(o.value,e);case Re.Scalar.PLAIN:return Cv(o,e,t,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=s&&d||u;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}bf.stringifyString=Rv});var mn=T(Ka=>{"use strict";var _v=Is(),ft=q(),Nv=un(),Iv=pn();function $v(r,e){let t=Object.assign({blockQuote:!0,commentString:Nv.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},r.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:r,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Lv(r,e){if(e.tag){let s=r.filter(i=>i.tag===e.tag);if(s.length>0)return s.find(i=>i.format===e.format)??s[0]}let t,n;if(ft.isScalar(e)){n=e.value;let s=r.filter(i=>i.identify?.(n));if(s.length>1){let i=s.filter(o=>o.test);i.length>0&&(s=i)}t=s.find(i=>i.format===e.format)??s.find(i=>!i.format)}else n=e,t=r.find(s=>s.nodeClass&&n instanceof s.nodeClass);if(!t){let s=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${s} value`)}return t}function Mv(r,e,{anchors:t,doc:n}){if(!n.directives)return"";let s=[],i=(ft.isScalar(r)||ft.isCollection(r))&&r.anchor;i&&_v.anchorIsValid(i)&&(t.add(i),s.push(`&${i}`));let o=r.tag??(e.default?null:e.tag);return o&&s.push(n.directives.tagString(o)),s.join(" ")}function Bv(r,e,t,n){if(ft.isPair(r))return r.toString(e,t,n);if(ft.isAlias(r)){if(e.doc.directives)return r.toString(e);if(e.resolvedAliases?.has(r))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(r):e.resolvedAliases=new Set([r]),r=r.resolve(e.doc)}let s,i=ft.isNode(r)?r:e.doc.createNode(r,{onTagObj:c=>s=c});s??(s=Lv(e.doc.schema.tags,i));let o=Mv(i,s,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof s.stringify=="function"?s.stringify(i,e,t,n):ft.isScalar(i)?Iv.stringifyString(i,e,t,n):i.toString(e,t,n);return o?ft.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
54
|
+
${e.indent}${a}`:a}Ka.createStringifyContext=$v;Ka.stringify=Bv});var kf=T(Sf=>{"use strict";var Qe=q(),wf=ee(),vf=mn(),hn=un();function Dv({key:r,value:e},t,n,s){let{allNullValues:i,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:d,simpleKeys:u}}=t,f=Qe.isNode(r)&&r.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Qe.isCollection(r)||!Qe.isNode(r)&&typeof r=="object"){let $="With simple keys, collection cannot be used as a key value";throw new Error($)}}let p=!u&&(!r||f&&e==null&&!t.inFlow||Qe.isCollection(r)||(Qe.isScalar(r)?r.type===wf.Scalar.BLOCK_FOLDED||r.type===wf.Scalar.BLOCK_LITERAL:typeof r=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(u||!i),indent:a+c});let h=!1,m=!1,b=vf.stringify(r,t,()=>h=!0,()=>m=!0);if(!p&&!t.inFlow&&b.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(i||e==null)return h&&n&&n(),b===""?"?":p?`? ${b}`:b}else if(i&&!u||e==null&&p)return b=`? ${b}`,f&&!h?b+=hn.lineComment(b,t.indent,l(f)):m&&s&&s(),b;h&&(f=null),p?(f&&(b+=hn.lineComment(b,t.indent,l(f))),b=`? ${b}
|
|
55
|
+
${a}:`):(b=`${b}:`,f&&(b+=hn.lineComment(b,t.indent,l(f))));let A,w,P;Qe.isNode(e)?(A=!!e.spaceBefore,w=e.commentBefore,P=e.comment):(A=!1,w=null,P=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!f&&Qe.isScalar(e)&&(t.indentAtStart=b.length+1),m=!1,!d&&c.length>=2&&!t.inFlow&&!p&&Qe.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let R=!1,C=vf.stringify(e,t,()=>R=!0,()=>m=!0),_=" ";if(f||A||w){if(_=A?`
|
|
56
56
|
`:"",w){let $=l(w);_+=`
|
|
57
|
-
${
|
|
58
|
-
`&&
|
|
57
|
+
${hn.indentComment($,t.indent)}`}C===""&&!t.inFlow?_===`
|
|
58
|
+
`&&P&&(_=`
|
|
59
59
|
|
|
60
60
|
`):_+=`
|
|
61
|
-
${t.indent}`}else if(!p&&
|
|
61
|
+
${t.indent}`}else if(!p&&Qe.isCollection(e)){let $=C[0],E=C.indexOf(`
|
|
62
62
|
`),M=E!==-1,W=t.inFlow??e.flow??e.items.length===0;if(M||!W){let U=!1;if(M&&($==="&"||$==="!")){let y=C.indexOf(" ");$==="&"&&y!==-1&&y<E&&C[y+1]==="!"&&(y=C.indexOf(" ",y+1)),(y===-1||E<y)&&(U=!0)}U||(_=`
|
|
63
63
|
${t.indent}`)}}else(C===""||C[0]===`
|
|
64
|
-
`)&&(_="");return b+=_+C,t.inFlow?R&&n&&n():
|
|
64
|
+
`)&&(_="");return b+=_+C,t.inFlow?R&&n&&n():P&&!R?b+=hn.lineComment(b,t.indent,l(P)):m&&s&&s(),b}Sf.stringifyPair=Dv});var Wa=T(Ha=>{"use strict";var xf=ks("process");function jv(r,...e){r==="debug"&&console.log(...e)}function Fv(r,e){(r==="debug"||r==="warn")&&(typeof xf.emitWarning=="function"?xf.emitWarning(e):console.warn(e))}Ha.debug=jv;Ha.warn=Fv});var Ws=T(Hs=>{"use strict";var gn=q(),Ef=ee(),Js="<<",Ks={identify:r=>r===Js||typeof r=="symbol"&&r.description===Js,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ef.Scalar(Symbol(Js)),{addToJSMap:Af}),stringify:()=>Js},qv=(r,e)=>(Ks.identify(e)||gn.isScalar(e)&&(!e.type||e.type===Ef.Scalar.PLAIN)&&Ks.identify(e.value))&&r?.doc.schema.tags.some(t=>t.tag===Ks.tag&&t.default);function Af(r,e,t){if(t=r&&gn.isAlias(t)?t.resolve(r.doc):t,gn.isSeq(t))for(let n of t.items)Ya(r,e,n);else if(Array.isArray(t))for(let n of t)Ya(r,e,n);else Ya(r,e,t)}function Ya(r,e,t){let n=r&&gn.isAlias(t)?t.resolve(r.doc):t;if(!gn.isMap(n))throw new Error("Merge sources must be maps or map aliases");let s=n.toJSON(null,r,Map);for(let[i,o]of s)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}Hs.addMergeToJSMap=Af;Hs.isMergeKey=qv;Hs.merge=Ks});var za=T(Of=>{"use strict";var Uv=Wa(),Tf=Ws(),Jv=mn(),Pf=q(),Va=lt();function Kv(r,e,{key:t,value:n}){if(Pf.isNode(t)&&t.addToJSMap)t.addToJSMap(r,e,n);else if(Tf.isMergeKey(r,t))Tf.addMergeToJSMap(r,e,n);else{let s=Va.toJS(t,"",r);if(e instanceof Map)e.set(s,Va.toJS(n,s,r));else if(e instanceof Set)e.add(s);else{let i=Hv(t,s,r),o=Va.toJS(n,i,r);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function Hv(r,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Pf.isNode(r)&&t?.doc){let n=Jv.createStringifyContext(t.doc,{});n.anchors=new Set;for(let i of t.anchors.keys())n.anchors.add(i.anchor);n.inFlow=!0,n.inStringifyKey=!0;let s=r.toString(n);if(!t.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),Uv.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return s}return JSON.stringify(e)}Of.addPairToJSMap=Kv});var pt=T(Ga=>{"use strict";var Cf=ln(),Wv=kf(),Yv=za(),Ys=q();function Vv(r,e,t){let n=Cf.createNode(r,void 0,t),s=Cf.createNode(e,void 0,t);return new Vs(n,s)}var Vs=class r{constructor(e,t=null){Object.defineProperty(this,Ys.NODE_TYPE,{value:Ys.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return Ys.isNode(t)&&(t=t.clone(e)),Ys.isNode(n)&&(n=n.clone(e)),new r(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return Yv.addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?Wv.stringifyPair(this,e,t,n):JSON.stringify(this)}};Ga.Pair=Vs;Ga.createPair=Vv});var Xa=T(_f=>{"use strict";var Bt=q(),Rf=mn(),zs=un();function zv(r,e,t){return(e.inFlow??r.flow?Xv:Gv)(r,e,t)}function Gv({comment:r,items:e},t,{blockItemPrefix:n,flowChars:s,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=t,d=Object.assign({},t,{indent:i,type:null}),u=!1,f=[];for(let h=0;h<e.length;++h){let m=e[h],b=null;if(Bt.isNode(m))!u&&m.spaceBefore&&f.push(""),Gs(t,f,m.commentBefore,u),m.comment&&(b=m.comment);else if(Bt.isPair(m)){let w=Bt.isNode(m.key)?m.key:null;w&&(!u&&w.spaceBefore&&f.push(""),Gs(t,f,w.commentBefore,u))}u=!1;let A=Rf.stringify(m,d,()=>b=null,()=>u=!0);b&&(A+=zs.lineComment(A,i,l(b))),u&&b&&(u=!1),f.push(n+A)}let p;if(f.length===0)p=s.start+s.end;else{p=f[0];for(let h=1;h<f.length;++h){let m=f[h];p+=m?`
|
|
65
65
|
${c}${m}`:`
|
|
66
66
|
`}}return r?(p+=`
|
|
67
|
-
`+
|
|
67
|
+
`+zs.indentComment(l(r),c),a&&a()):u&&o&&o(),p}function Xv({items:r},e,{flowChars:t,itemIndent:n}){let{indent:s,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;n+=i;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,d=0,u=[];for(let h=0;h<r.length;++h){let m=r[h],b=null;if(Bt.isNode(m))m.spaceBefore&&u.push(""),Gs(e,u,m.commentBefore,!1),m.comment&&(b=m.comment);else if(Bt.isPair(m)){let w=Bt.isNode(m.key)?m.key:null;w&&(w.spaceBefore&&u.push(""),Gs(e,u,w.commentBefore,!1),w.comment&&(l=!0));let P=Bt.isNode(m.value)?m.value:null;P?(P.comment&&(b=P.comment),P.commentBefore&&(l=!0)):m.value==null&&w?.comment&&(b=w.comment)}b&&(l=!0);let A=Rf.stringify(m,c,()=>b=null);h<r.length-1&&(A+=","),b&&(A+=zs.lineComment(A,n,a(b))),!l&&(u.length>d||A.includes(`
|
|
68
68
|
`))&&(l=!0),u.push(A),d=u.length}let{start:f,end:p}=t;if(u.length===0)return f+p;if(!l){let h=u.reduce((m,b)=>m+b.length+2,2);l=e.options.lineWidth>0&&h>e.options.lineWidth}if(l){let h=f;for(let m of u)h+=m?`
|
|
69
69
|
${i}${s}${m}`:`
|
|
70
70
|
`;return`${h}
|
|
71
|
-
${s}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function
|
|
72
|
-
`:" ")}return
|
|
71
|
+
${s}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Gs({indent:r,options:{commentString:e}},t,n,s){if(n&&s&&(n=n.replace(/^\n+/,"")),n){let i=zs.indentComment(e(n),r);t.push(i.trimStart())}}_f.stringifyCollection=zv});var ht=T(Za=>{"use strict";var Qv=Xa(),Zv=za(),eS=Bs(),mt=q(),Xs=pt(),tS=ee();function yn(r,e){let t=mt.isScalar(e)?e.value:e;for(let n of r)if(mt.isPair(n)&&(n.key===e||n.key===t||mt.isScalar(n.key)&&n.key.value===t))return n}var Qa=class extends eS.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(mt.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:s,replacer:i}=n,o=new this(e),a=(c,l)=>{if(typeof i=="function")l=i.call(t,c,l);else if(Array.isArray(i)&&!i.includes(c))return;(l!==void 0||s)&&o.items.push(Xs.createPair(c,l,n))};if(t instanceof Map)for(let[c,l]of t)a(c,l);else if(t&&typeof t=="object")for(let c of Object.keys(t))a(c,t[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;mt.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Xs.Pair(e,e?.value):n=new Xs.Pair(e.key,e.value);let s=yn(this.items,n.key),i=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${n.key} already set`);mt.isScalar(s.value)&&tS.isScalarValue(n.value)?s.value.value=n.value:s.value=n.value}else if(i){let o=this.items.findIndex(a=>i(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=yn(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let s=yn(this.items,e)?.value;return(!t&&mt.isScalar(s)?s.value:s)??void 0}has(e){return!!yn(this.items,e)}set(e,t){this.add(new Xs.Pair(e,t),!0)}toJSON(e,t,n){let s=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(let i of this.items)Zv.addPairToJSMap(t,s,i);return s}toString(e,t,n){if(!e)return JSON.stringify(this);for(let s of this.items)if(!mt.isPair(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Qv.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};Za.YAMLMap=Qa;Za.findPair=yn});var pr=T(If=>{"use strict";var rS=q(),Nf=ht(),nS={collection:"map",default:!0,nodeClass:Nf.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(r,e){return rS.isMap(r)||e("Expected a mapping for this tag"),r},createNode:(r,e,t)=>Nf.YAMLMap.from(r,e,t)};If.map=nS});var gt=T($f=>{"use strict";var sS=ln(),iS=Xa(),oS=Bs(),Zs=q(),aS=ee(),cS=lt(),ec=class extends oS.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Zs.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Qs(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=Qs(e);if(typeof n!="number")return;let s=this.items[n];return!t&&Zs.isScalar(s)?s.value:s}has(e){let t=Qs(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=Qs(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[n];Zs.isScalar(s)&&aS.isScalarValue(t)?s.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let s=0;for(let i of this.items)n.push(cS.toJS(i,String(s++),t));return n}toString(e,t,n){return e?iS.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:s}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof s=="function"){let c=t instanceof Set?a:String(o++);a=s.call(t,c,a)}i.items.push(sS.createNode(a,void 0,n))}}return i}};function Qs(r){let e=Zs.isScalar(r)?r.value:r;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}$f.YAMLSeq=ec});var mr=T(Mf=>{"use strict";var lS=q(),Lf=gt(),uS={collection:"seq",default:!0,nodeClass:Lf.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(r,e){return lS.isSeq(r)||e("Expected a sequence for this tag"),r},createNode:(r,e,t)=>Lf.YAMLSeq.from(r,e,t)};Mf.seq=uS});var bn=T(Bf=>{"use strict";var dS=pn(),fS={identify:r=>typeof r=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:r=>r,stringify(r,e,t,n){return e=Object.assign({actualString:!0},e),dS.stringifyString(r,e,t,n)}};Bf.string=fS});var ei=T(Ff=>{"use strict";var Df=ee(),jf={identify:r=>r==null,createNode:()=>new Df.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Df.Scalar(null),stringify:({source:r},e)=>typeof r=="string"&&jf.test.test(r)?r:e.options.nullStr};Ff.nullTag=jf});var tc=T(Uf=>{"use strict";var pS=ee(),qf={identify:r=>typeof r=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:r=>new pS.Scalar(r[0]==="t"||r[0]==="T"),stringify({source:r,value:e},t){if(r&&qf.test.test(r)){let n=r[0]==="t"||r[0]==="T";if(e===n)return r}return e?t.options.trueStr:t.options.falseStr}};Uf.boolTag=qf});var hr=T(Jf=>{"use strict";function mS({format:r,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let s=typeof n=="number"?n:Number(n);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(n,-0)?"-0":JSON.stringify(n);if(!r&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}Jf.stringifyNumber=mS});var nc=T(ti=>{"use strict";var hS=ee(),rc=hr(),gS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:rc.stringifyNumber},yS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():rc.stringifyNumber(r)}},bS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(r){let e=new hS.Scalar(parseFloat(r)),t=r.indexOf(".");return t!==-1&&r[r.length-1]==="0"&&(e.minFractionDigits=r.length-t-1),e},stringify:rc.stringifyNumber};ti.float=bS;ti.floatExp=yS;ti.floatNaN=gS});var ic=T(ni=>{"use strict";var Kf=hr(),ri=r=>typeof r=="bigint"||Number.isInteger(r),sc=(r,e,t,{intAsBigInt:n})=>n?BigInt(r):parseInt(r.substring(e),t);function Hf(r,e,t){let{value:n}=r;return ri(n)&&n>=0?t+n.toString(e):Kf.stringifyNumber(r)}var wS={identify:r=>ri(r)&&r>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(r,e,t)=>sc(r,2,8,t),stringify:r=>Hf(r,8,"0o")},vS={identify:ri,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(r,e,t)=>sc(r,0,10,t),stringify:Kf.stringifyNumber},SS={identify:r=>ri(r)&&r>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(r,e,t)=>sc(r,2,16,t),stringify:r=>Hf(r,16,"0x")};ni.int=vS;ni.intHex=SS;ni.intOct=wS});var Yf=T(Wf=>{"use strict";var kS=pr(),xS=ei(),ES=mr(),AS=bn(),TS=tc(),oc=nc(),ac=ic(),PS=[kS.map,ES.seq,AS.string,xS.nullTag,TS.boolTag,ac.intOct,ac.int,ac.intHex,oc.floatNaN,oc.floatExp,oc.float];Wf.schema=PS});var Gf=T(zf=>{"use strict";var OS=ee(),CS=pr(),RS=mr();function Vf(r){return typeof r=="bigint"||Number.isInteger(r)}var si=({value:r})=>JSON.stringify(r),_S=[{identify:r=>typeof r=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:r=>r,stringify:si},{identify:r=>r==null,createNode:()=>new OS.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:si},{identify:r=>typeof r=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:r=>r==="true",stringify:si},{identify:Vf,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(r,e,{intAsBigInt:t})=>t?BigInt(r):parseInt(r,10),stringify:({value:r})=>Vf(r)?r.toString():JSON.stringify(r)},{identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:r=>parseFloat(r),stringify:si}],NS={default:!0,tag:"",test:/^/,resolve(r,e){return e(`Unresolved plain scalar ${JSON.stringify(r)}`),r}},IS=[CS.map,RS.seq].concat(_S,NS);zf.schema=IS});var lc=T(Xf=>{"use strict";var wn=ks("buffer"),cc=ee(),$S=pn(),LS={identify:r=>r instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(r,e){if(typeof wn.Buffer=="function")return wn.Buffer.from(r,"base64");if(typeof atob=="function"){let t=atob(r.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let s=0;s<t.length;++s)n[s]=t.charCodeAt(s);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),r},stringify({comment:r,type:e,value:t},n,s,i){if(!t)return"";let o=t,a;if(typeof wn.Buffer=="function")a=o instanceof wn.Buffer?o.toString("base64"):wn.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=cc.Scalar.BLOCK_LITERAL),e!==cc.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),d=new Array(l);for(let u=0,f=0;u<l;++u,f+=c)d[u]=a.substr(f,c);a=d.join(e===cc.Scalar.BLOCK_LITERAL?`
|
|
72
|
+
`:" ")}return $S.stringifyString({comment:r,type:e,value:a},n,s,i)}};Xf.binary=LS});var ai=T(oi=>{"use strict";var ii=q(),uc=pt(),MS=ee(),BS=gt();function Qf(r,e){if(ii.isSeq(r))for(let t=0;t<r.items.length;++t){let n=r.items[t];if(!ii.isPair(n)){if(ii.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let s=n.items[0]||new uc.Pair(new MS.Scalar(null));if(n.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${n.commentBefore}
|
|
73
73
|
${s.key.commentBefore}`:n.commentBefore),n.comment){let i=s.value??s.key;i.comment=i.comment?`${n.comment}
|
|
74
|
-
${i.comment}`:n.comment}n=s}r.items[t]=si.isPair(n)?n:new oc.Pair(n)}}else e("Expected a sequence for this tag");return r}function Gf(r,e,t){let{replacer:n}=t,s=new IS.YAMLSeq(r);s.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;s.items.push(oc.createPair(a,c,t))}return s}var $S={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:zf,createNode:Gf};ii.createPairs=Gf;ii.pairs=$S;ii.resolvePairs=zf});var lc=T(cc=>{"use strict";var Xf=q(),ac=ct(),bn=mt(),LS=ht(),Qf=oi(),Mt=class r extends LS.YAMLSeq{constructor(){super(),this.add=bn.YAMLMap.prototype.add.bind(this),this.delete=bn.YAMLMap.prototype.delete.bind(this),this.get=bn.YAMLMap.prototype.get.bind(this),this.has=bn.YAMLMap.prototype.has.bind(this),this.set=bn.YAMLMap.prototype.set.bind(this),this.tag=r.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let s of this.items){let i,o;if(Xf.isPair(s)?(i=ac.toJS(s.key,"",t),o=ac.toJS(s.value,i,t)):i=ac.toJS(s,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){let s=Qf.createPairs(e,t,n),i=new this;return i.items=s.items,i}};Mt.tag="tag:yaml.org,2002:omap";var MS={collection:"seq",identify:r=>r instanceof Map,nodeClass:Mt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(r,e){let t=Qf.resolvePairs(r,e),n=[];for(let{key:s}of t.items)Xf.isScalar(s)&&(n.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new Mt,t)},createNode:(r,e,t)=>Mt.from(r,e,t)};cc.YAMLOMap=Mt;cc.omap=MS});var np=T(uc=>{"use strict";var Zf=ee();function ep({value:r,source:e},t){return e&&(r?tp:rp).test.test(e)?e:r?t.options.trueStr:t.options.falseStr}var tp={identify:r=>r===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Zf.Scalar(!0),stringify:ep},rp={identify:r=>r===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Zf.Scalar(!1),stringify:ep};uc.falseTag=rp;uc.trueTag=tp});var sp=T(ai=>{"use strict";var BS=ee(),dc=pr(),DS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:dc.stringifyNumber},jS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r.replace(/_/g,"")),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():dc.stringifyNumber(r)}},FS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(r){let e=new BS.Scalar(parseFloat(r.replace(/_/g,""))),t=r.indexOf(".");if(t!==-1){let n=r.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:dc.stringifyNumber};ai.float=FS;ai.floatExp=jS;ai.floatNaN=DS});var op=T(vn=>{"use strict";var ip=pr(),wn=r=>typeof r=="bigint"||Number.isInteger(r);function ci(r,e,t,{intAsBigInt:n}){let s=r[0];if((s==="-"||s==="+")&&(e+=1),r=r.substring(e).replace(/_/g,""),n){switch(t){case 2:r=`0b${r}`;break;case 8:r=`0o${r}`;break;case 16:r=`0x${r}`;break}let o=BigInt(r);return s==="-"?BigInt(-1)*o:o}let i=parseInt(r,t);return s==="-"?-1*i:i}function fc(r,e,t){let{value:n}=r;if(wn(n)){let s=n.toString(e);return n<0?"-"+t+s.substr(1):t+s}return ip.stringifyNumber(r)}var qS={identify:wn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(r,e,t)=>ci(r,2,2,t),stringify:r=>fc(r,2,"0b")},US={identify:wn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(r,e,t)=>ci(r,1,8,t),stringify:r=>fc(r,8,"0")},JS={identify:wn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(r,e,t)=>ci(r,0,10,t),stringify:ip.stringifyNumber},KS={identify:wn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(r,e,t)=>ci(r,2,16,t),stringify:r=>fc(r,16,"0x")};vn.int=JS;vn.intBin=qS;vn.intHex=KS;vn.intOct=US});var mc=T(pc=>{"use strict";var di=q(),li=ft(),ui=mt(),Bt=class r extends ui.YAMLMap{constructor(e){super(e),this.tag=r.tag}add(e){let t;di.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new li.Pair(e.key,null):t=new li.Pair(e,null),ui.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=ui.findPair(this.items,e);return!t&&di.isPair(n)?di.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ui.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new li.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:s}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof s=="function"&&(o=s.call(t,o,o)),i.items.push(li.createPair(o,null,n));return i}};Bt.tag="tag:yaml.org,2002:set";var HS={collection:"map",identify:r=>r instanceof Set,nodeClass:Bt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(r,e,t)=>Bt.from(r,e,t),resolve(r,e){if(di.isMap(r)){if(r.hasAllNullValues(!0))return Object.assign(new Bt,r);e("Set items must all have null values")}else e("Expected a mapping for this tag");return r}};pc.YAMLSet=Bt;pc.set=HS});var gc=T(fi=>{"use strict";var WS=pr();function hc(r,e){let t=r[0],n=t==="-"||t==="+"?r.substring(1):r,s=o=>e?BigInt(o):Number(o),i=n.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*i:i}function ap(r){let{value:e}=r,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return WS.stringifyNumber(r);let n="";e<0&&(n="-",e*=t(-1));let s=t(60),i=[e%s];return e<60?i.unshift(0):(e=(e-i[0])/s,i.unshift(e%s),e>=60&&(e=(e-i[0])/s,i.unshift(e))),n+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var YS={identify:r=>typeof r=="bigint"||Number.isInteger(r),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(r,e,{intAsBigInt:t})=>hc(r,t),stringify:ap},VS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:r=>hc(r,!1),stringify:ap},cp={identify:r=>r instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(r){let e=r.match(cp.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,s,i,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,n-1,s,i||0,o||0,a||0,c),d=e[8];if(d&&d!=="Z"){let u=hc(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:r})=>r?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};fi.floatTime=VS;fi.intTime=YS;fi.timestamp=cp});var dp=T(up=>{"use strict";var zS=dr(),GS=Zs(),XS=fr(),QS=gn(),ZS=ic(),lp=np(),yc=sp(),pi=op(),ek=Hs(),tk=lc(),rk=oi(),nk=mc(),bc=gc(),sk=[zS.map,XS.seq,QS.string,GS.nullTag,lp.trueTag,lp.falseTag,pi.intBin,pi.intOct,pi.int,pi.intHex,yc.floatNaN,yc.floatExp,yc.float,ZS.binary,ek.merge,tk.omap,rk.pairs,nk.set,bc.intTime,bc.floatTime,bc.timestamp];up.schema=sk});var Sp=T(Sc=>{"use strict";var hp=dr(),ik=Zs(),gp=fr(),ok=gn(),ak=Xa(),wc=Za(),vc=tc(),ck=Kf(),lk=Yf(),yp=ic(),Sn=Hs(),bp=lc(),wp=oi(),fp=dp(),vp=mc(),mi=gc(),pp=new Map([["core",ck.schema],["failsafe",[hp.map,gp.seq,ok.string]],["json",lk.schema],["yaml11",fp.schema],["yaml-1.1",fp.schema]]),mp={binary:yp.binary,bool:ak.boolTag,float:wc.float,floatExp:wc.floatExp,floatNaN:wc.floatNaN,floatTime:mi.floatTime,int:vc.int,intHex:vc.intHex,intOct:vc.intOct,intTime:mi.intTime,map:hp.map,merge:Sn.merge,null:ik.nullTag,omap:bp.omap,pairs:wp.pairs,seq:gp.seq,set:vp.set,timestamp:mi.timestamp},uk={"tag:yaml.org,2002:binary":yp.binary,"tag:yaml.org,2002:merge":Sn.merge,"tag:yaml.org,2002:omap":bp.omap,"tag:yaml.org,2002:pairs":wp.pairs,"tag:yaml.org,2002:set":vp.set,"tag:yaml.org,2002:timestamp":mi.timestamp};function dk(r,e,t){let n=pp.get(e);if(n&&!r)return t&&!n.includes(Sn.merge)?n.concat(Sn.merge):n.slice();let s=n;if(!s)if(Array.isArray(r))s=[];else{let i=Array.from(pp.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(r))for(let i of r)s=s.concat(i);else typeof r=="function"&&(s=r(s.slice()));return t&&(s=s.concat(Sn.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?mp[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(mp).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(a)||i.push(a),i},[])}Sc.coreKnownTags=uk;Sc.getTags=dk});var Ec=T(kp=>{"use strict";var kc=q(),fk=dr(),pk=fr(),mk=gn(),hi=Sp(),hk=(r,e)=>r.key<e.key?-1:r.key>e.key?1:0,xc=class r{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?hi.getTags(e,"compat"):e?hi.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?hi.coreKnownTags:{},this.tags=hi.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,kc.MAP,{value:fk.map}),Object.defineProperty(this,kc.SCALAR,{value:mk.string}),Object.defineProperty(this,kc.SEQ,{value:pk.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?hk:null}clone(){let e=Object.create(r.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};kp.Schema=xc});var Ep=T(xp=>{"use strict";var gk=q(),Ac=fn(),kn=cn();function yk(r,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&r.directives){let c=r.directives.toString(r);c?(t.push(c),n=!0):r.directives.docStart&&(n=!0)}n&&t.push("---");let s=Ac.createStringifyContext(r,e),{commentString:i}=s.options;if(r.commentBefore){t.length!==1&&t.unshift("");let c=i(r.commentBefore);t.unshift(kn.indentComment(c,""))}let o=!1,a=null;if(r.contents){if(gk.isNode(r.contents)){if(r.contents.spaceBefore&&n&&t.push(""),r.contents.commentBefore){let d=i(r.contents.commentBefore);t.push(kn.indentComment(d,""))}s.forceBlockIndent=!!r.comment,a=r.contents.comment}let c=a?void 0:()=>o=!0,l=Ac.stringify(r.contents,s,()=>a=null,c);a&&(l+=kn.lineComment(l,"",i(a))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(Ac.stringify(r.contents,s));if(r.directives?.docEnd)if(r.comment){let c=i(r.comment);c.includes(`
|
|
75
|
-
`)?(t.push("..."),t.push(
|
|
74
|
+
${i.comment}`:n.comment}n=s}r.items[t]=ii.isPair(n)?n:new uc.Pair(n)}}else e("Expected a sequence for this tag");return r}function Zf(r,e,t){let{replacer:n}=t,s=new BS.YAMLSeq(r);s.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;s.items.push(uc.createPair(a,c,t))}return s}var DS={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Qf,createNode:Zf};oi.createPairs=Zf;oi.pairs=DS;oi.resolvePairs=Qf});var pc=T(fc=>{"use strict";var ep=q(),dc=lt(),vn=ht(),jS=gt(),tp=ai(),Dt=class r extends jS.YAMLSeq{constructor(){super(),this.add=vn.YAMLMap.prototype.add.bind(this),this.delete=vn.YAMLMap.prototype.delete.bind(this),this.get=vn.YAMLMap.prototype.get.bind(this),this.has=vn.YAMLMap.prototype.has.bind(this),this.set=vn.YAMLMap.prototype.set.bind(this),this.tag=r.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let s of this.items){let i,o;if(ep.isPair(s)?(i=dc.toJS(s.key,"",t),o=dc.toJS(s.value,i,t)):i=dc.toJS(s,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){let s=tp.createPairs(e,t,n),i=new this;return i.items=s.items,i}};Dt.tag="tag:yaml.org,2002:omap";var FS={collection:"seq",identify:r=>r instanceof Map,nodeClass:Dt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(r,e){let t=tp.resolvePairs(r,e),n=[];for(let{key:s}of t.items)ep.isScalar(s)&&(n.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new Dt,t)},createNode:(r,e,t)=>Dt.from(r,e,t)};fc.YAMLOMap=Dt;fc.omap=FS});var op=T(mc=>{"use strict";var rp=ee();function np({value:r,source:e},t){return e&&(r?sp:ip).test.test(e)?e:r?t.options.trueStr:t.options.falseStr}var sp={identify:r=>r===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new rp.Scalar(!0),stringify:np},ip={identify:r=>r===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new rp.Scalar(!1),stringify:np};mc.falseTag=ip;mc.trueTag=sp});var ap=T(ci=>{"use strict";var qS=ee(),hc=hr(),US={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hc.stringifyNumber},JS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r.replace(/_/g,"")),stringify(r){let e=Number(r.value);return isFinite(e)?e.toExponential():hc.stringifyNumber(r)}},KS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(r){let e=new qS.Scalar(parseFloat(r.replace(/_/g,""))),t=r.indexOf(".");if(t!==-1){let n=r.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:hc.stringifyNumber};ci.float=KS;ci.floatExp=JS;ci.floatNaN=US});var lp=T(kn=>{"use strict";var cp=hr(),Sn=r=>typeof r=="bigint"||Number.isInteger(r);function li(r,e,t,{intAsBigInt:n}){let s=r[0];if((s==="-"||s==="+")&&(e+=1),r=r.substring(e).replace(/_/g,""),n){switch(t){case 2:r=`0b${r}`;break;case 8:r=`0o${r}`;break;case 16:r=`0x${r}`;break}let o=BigInt(r);return s==="-"?BigInt(-1)*o:o}let i=parseInt(r,t);return s==="-"?-1*i:i}function gc(r,e,t){let{value:n}=r;if(Sn(n)){let s=n.toString(e);return n<0?"-"+t+s.substr(1):t+s}return cp.stringifyNumber(r)}var HS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(r,e,t)=>li(r,2,2,t),stringify:r=>gc(r,2,"0b")},WS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(r,e,t)=>li(r,1,8,t),stringify:r=>gc(r,8,"0")},YS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(r,e,t)=>li(r,0,10,t),stringify:cp.stringifyNumber},VS={identify:Sn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(r,e,t)=>li(r,2,16,t),stringify:r=>gc(r,16,"0x")};kn.int=YS;kn.intBin=HS;kn.intHex=VS;kn.intOct=WS});var bc=T(yc=>{"use strict";var fi=q(),ui=pt(),di=ht(),jt=class r extends di.YAMLMap{constructor(e){super(e),this.tag=r.tag}add(e){let t;fi.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new ui.Pair(e.key,null):t=new ui.Pair(e,null),di.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=di.findPair(this.items,e);return!t&&fi.isPair(n)?fi.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=di.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ui.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:s}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof s=="function"&&(o=s.call(t,o,o)),i.items.push(ui.createPair(o,null,n));return i}};jt.tag="tag:yaml.org,2002:set";var zS={collection:"map",identify:r=>r instanceof Set,nodeClass:jt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(r,e,t)=>jt.from(r,e,t),resolve(r,e){if(fi.isMap(r)){if(r.hasAllNullValues(!0))return Object.assign(new jt,r);e("Set items must all have null values")}else e("Expected a mapping for this tag");return r}};yc.YAMLSet=jt;yc.set=zS});var vc=T(pi=>{"use strict";var GS=hr();function wc(r,e){let t=r[0],n=t==="-"||t==="+"?r.substring(1):r,s=o=>e?BigInt(o):Number(o),i=n.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*i:i}function up(r){let{value:e}=r,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return GS.stringifyNumber(r);let n="";e<0&&(n="-",e*=t(-1));let s=t(60),i=[e%s];return e<60?i.unshift(0):(e=(e-i[0])/s,i.unshift(e%s),e>=60&&(e=(e-i[0])/s,i.unshift(e))),n+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var XS={identify:r=>typeof r=="bigint"||Number.isInteger(r),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(r,e,{intAsBigInt:t})=>wc(r,t),stringify:up},QS={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:r=>wc(r,!1),stringify:up},dp={identify:r=>r instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(r){let e=r.match(dp.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,s,i,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,n-1,s,i||0,o||0,a||0,c),d=e[8];if(d&&d!=="Z"){let u=wc(d,!1);Math.abs(u)<30&&(u*=60),l-=6e4*u}return new Date(l)},stringify:({value:r})=>r?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};pi.floatTime=QS;pi.intTime=XS;pi.timestamp=dp});var mp=T(pp=>{"use strict";var ZS=pr(),ek=ei(),tk=mr(),rk=bn(),nk=lc(),fp=op(),Sc=ap(),mi=lp(),sk=Ws(),ik=pc(),ok=ai(),ak=bc(),kc=vc(),ck=[ZS.map,tk.seq,rk.string,ek.nullTag,fp.trueTag,fp.falseTag,mi.intBin,mi.intOct,mi.int,mi.intHex,Sc.floatNaN,Sc.floatExp,Sc.float,nk.binary,sk.merge,ik.omap,ok.pairs,ak.set,kc.intTime,kc.floatTime,kc.timestamp];pp.schema=ck});var Ep=T(Ac=>{"use strict";var bp=pr(),lk=ei(),wp=mr(),uk=bn(),dk=tc(),xc=nc(),Ec=ic(),fk=Yf(),pk=Gf(),vp=lc(),xn=Ws(),Sp=pc(),kp=ai(),hp=mp(),xp=bc(),hi=vc(),gp=new Map([["core",fk.schema],["failsafe",[bp.map,wp.seq,uk.string]],["json",pk.schema],["yaml11",hp.schema],["yaml-1.1",hp.schema]]),yp={binary:vp.binary,bool:dk.boolTag,float:xc.float,floatExp:xc.floatExp,floatNaN:xc.floatNaN,floatTime:hi.floatTime,int:Ec.int,intHex:Ec.intHex,intOct:Ec.intOct,intTime:hi.intTime,map:bp.map,merge:xn.merge,null:lk.nullTag,omap:Sp.omap,pairs:kp.pairs,seq:wp.seq,set:xp.set,timestamp:hi.timestamp},mk={"tag:yaml.org,2002:binary":vp.binary,"tag:yaml.org,2002:merge":xn.merge,"tag:yaml.org,2002:omap":Sp.omap,"tag:yaml.org,2002:pairs":kp.pairs,"tag:yaml.org,2002:set":xp.set,"tag:yaml.org,2002:timestamp":hi.timestamp};function hk(r,e,t){let n=gp.get(e);if(n&&!r)return t&&!n.includes(xn.merge)?n.concat(xn.merge):n.slice();let s=n;if(!s)if(Array.isArray(r))s=[];else{let i=Array.from(gp.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(r))for(let i of r)s=s.concat(i);else typeof r=="function"&&(s=r(s.slice()));return t&&(s=s.concat(xn.merge)),s.reduce((i,o)=>{let a=typeof o=="string"?yp[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(yp).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(a)||i.push(a),i},[])}Ac.coreKnownTags=mk;Ac.getTags=hk});var Oc=T(Ap=>{"use strict";var Tc=q(),gk=pr(),yk=mr(),bk=bn(),gi=Ep(),wk=(r,e)=>r.key<e.key?-1:r.key>e.key?1:0,Pc=class r{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:s,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?gi.getTags(e,"compat"):e?gi.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?gi.coreKnownTags:{},this.tags=gi.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Tc.MAP,{value:gk.map}),Object.defineProperty(this,Tc.SCALAR,{value:bk.string}),Object.defineProperty(this,Tc.SEQ,{value:yk.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?wk:null}clone(){let e=Object.create(r.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Ap.Schema=Pc});var Pp=T(Tp=>{"use strict";var vk=q(),Cc=mn(),En=un();function Sk(r,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&r.directives){let c=r.directives.toString(r);c?(t.push(c),n=!0):r.directives.docStart&&(n=!0)}n&&t.push("---");let s=Cc.createStringifyContext(r,e),{commentString:i}=s.options;if(r.commentBefore){t.length!==1&&t.unshift("");let c=i(r.commentBefore);t.unshift(En.indentComment(c,""))}let o=!1,a=null;if(r.contents){if(vk.isNode(r.contents)){if(r.contents.spaceBefore&&n&&t.push(""),r.contents.commentBefore){let d=i(r.contents.commentBefore);t.push(En.indentComment(d,""))}s.forceBlockIndent=!!r.comment,a=r.contents.comment}let c=a?void 0:()=>o=!0,l=Cc.stringify(r.contents,s,()=>a=null,c);a&&(l+=En.lineComment(l,"",i(a))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(Cc.stringify(r.contents,s));if(r.directives?.docEnd)if(r.comment){let c=i(r.comment);c.includes(`
|
|
75
|
+
`)?(t.push("..."),t.push(En.indentComment(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=r.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(En.indentComment(i(c),"")))}return t.join(`
|
|
76
76
|
`)+`
|
|
77
|
-
`}
|
|
77
|
+
`}Tp.stringifyDocument=Sk});var An=T(Op=>{"use strict";var kk=cn(),gr=Bs(),ke=q(),xk=pt(),Ek=lt(),Ak=Oc(),Tk=Pp(),Rc=Is(),Pk=$a(),Ok=ln(),_c=Ia(),Nc=class r{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ke.NODE_TYPE,{value:ke.DOC});let s=null;typeof t=="function"||Array.isArray(t)?s=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:o}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new _c.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,s,n)}clone(){let e=Object.create(r.prototype,{[ke.NODE_TYPE]:{value:ke.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ke.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){yr(this.contents)&&this.contents.add(e)}addIn(e,t){yr(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Rc.anchorNames(this);e.anchor=!t||n.has(t)?Rc.findNewAnchor(t||"a",n):t}return new kk.Alias(e.anchor)}createNode(e,t,n){let s;if(typeof t=="function")e=t.call({"":e},"",e),s=t;else if(Array.isArray(t)){let b=w=>typeof w=="number"||w instanceof String||w instanceof Number,A=t.filter(b).map(String);A.length>0&&(t=t.concat(A)),s=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:d}=n??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=Rc.createNodeAnchors(this,o||"a"),h={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:l,replacer:s,schema:this.schema,sourceObjects:p},m=Ok.createNode(e,d,h);return a&&ke.isCollection(m)&&(m.flow=!0),f(),m}createPair(e,t,n={}){let s=this.createNode(e,null,n),i=this.createNode(t,null,n);return new xk.Pair(s,i)}delete(e){return yr(this.contents)?this.contents.delete(e):!1}deleteIn(e){return gr.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):yr(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ke.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return gr.isEmptyPath(e)?!t&&ke.isScalar(this.contents)?this.contents.value:this.contents:ke.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ke.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return gr.isEmptyPath(e)?this.contents!==void 0:ke.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=gr.collectionFromPath(this.schema,[e],t):yr(this.contents)&&this.contents.set(e,t)}setIn(e,t){gr.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=gr.collectionFromPath(this.schema,Array.from(e),t):yr(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _c.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new _c.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Ak.Schema(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:s,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=Ek.toJS(this.contents,t??"",a);if(typeof i=="function")for(let{count:l,res:d}of a.anchors.values())i(d,l);return typeof o=="function"?Pk.applyReviver(o,{"":c},"",c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Tk.stringifyDocument(this,e)}};function yr(r){if(ke.isCollection(r))return!0;throw new Error("Expected a YAML collection as document contents")}Op.Document=Nc});var On=T(Pn=>{"use strict";var Tn=class extends Error{constructor(e,t,n,s){super(),this.name=e,this.code=n,this.message=s,this.pos=t}},Ic=class extends Tn{constructor(e,t,n){super("YAMLParseError",e,t,n)}},$c=class extends Tn{constructor(e,t,n){super("YAMLWarning",e,t,n)}},Ck=(r,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:s}=t.linePos[0];t.message+=` at line ${n}, column ${s}`;let i=s-1,o=r.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,i))){let a=r.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
78
78
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=t.linePos[1];c?.line===n&&c.col>s&&(a=Math.max(1,Math.min(c.col-s,80-i)));let l=" ".repeat(i)+"^".repeat(a);t.message+=`:
|
|
79
79
|
|
|
80
80
|
${o}
|
|
81
81
|
${l}
|
|
82
|
-
`}};
|
|
83
|
-
`))return!0;if(r.end){for(let e of r.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of r.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(
|
|
84
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
85
|
-
`+
|
|
86
|
-
`+_.comment:l.comment=_.comment),u=_.end;continue}!o&&t.options.strict&&
|
|
87
|
-
`+$:E.comment=$,_.comment=_.comment.substring($.length+1)}}if(!o&&!R&&!_.found){let $=C?r(t,C,_,s):e(t,_.end,R,null,_,s);l.items.push($),u=$.range[2],
|
|
88
|
-
`+M.comment:E.comment=M.comment);let U=new
|
|
89
|
-
`+b.comment:l.comment=b.comment),l.range=[n.offset,m,b.offset]}else l.range=[n.offset,m,m];return l}
|
|
82
|
+
`}};Pn.YAMLError=Tn;Pn.YAMLParseError=Ic;Pn.YAMLWarning=$c;Pn.prettifyError=Ck});var Cn=T(Cp=>{"use strict";function Rk(r,{flow:e,indicator:t,next:n,offset:s,onError:i,parentIndent:o,startOnNewline:a}){let c=!1,l=a,d=a,u="",f="",p=!1,h=!1,m=null,b=null,A=null,w=null,P=null,R=null,C=null;for(let E of r)switch(h&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&i(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(l&&E.type!=="comment"&&E.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),E.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(m=E),d=!0;break;case"comment":{d||i(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=E.source.substring(1)||" ";u?u+=f+M:u=M,f="",l=!1;break}case"newline":l?u?u+=E.source:(!R||t!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(b||A)&&(w=E),d=!0;break;case"anchor":b&&i(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&i(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),b=E,C??(C=E.offset),l=!1,d=!1,h=!0;break;case"tag":{A&&i(E,"MULTIPLE_TAGS","A node can have at most one tag"),A=E,C??(C=E.offset),l=!1,d=!1,h=!0;break}case t:(b||A)&&i(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),R&&i(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),R=E,l=t==="seq-item-ind"||t==="explicit-key-ind",d=!1;break;case"comma":if(e){P&&i(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),P=E,l=!1,d=!1;break}default:i(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,d=!1}let _=r[r.length-1],$=_?_.offset+_.source.length:s;return h&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&i(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:P,found:R,spaceBefore:c,comment:u,hasNewline:p,anchor:b,tag:A,newlineAfterProp:w,end:$,start:C??$}}Cp.resolveProps=Rk});var yi=T(Rp=>{"use strict";function Lc(r){if(!r)return null;switch(r.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(r.source.includes(`
|
|
83
|
+
`))return!0;if(r.end){for(let e of r.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of r.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Lc(e.key)||Lc(e.value))return!0}return!1;default:return!0}}Rp.containsNewline=Lc});var Mc=T(_p=>{"use strict";var _k=yi();function Nk(r,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===r&&(n.source==="]"||n.source==="}")&&_k.containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}_p.flowIndentCheck=Nk});var Bc=T(Ip=>{"use strict";var Np=q();function Ik(r,e,t){let{uniqueKeys:n}=r.options;if(n===!1)return!1;let s=typeof n=="function"?n:(i,o)=>i===o||Np.isScalar(i)&&Np.isScalar(o)&&i.value===o.value;return e.some(i=>s(i.key,t))}Ip.mapIncludes=Ik});var jp=T(Dp=>{"use strict";var $p=pt(),$k=ht(),Lp=Cn(),Lk=yi(),Mp=Mc(),Mk=Bc(),Bp="All mapping items must start at the same column";function Bk({composeNode:r,composeEmptyNode:e},t,n,s,i){let o=i?.nodeClass??$k.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let c=n.offset,l=null;for(let d of n.items){let{start:u,key:f,sep:p,value:h}=d,m=Lp.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0}),b=!m.found;if(b){if(f&&(f.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&s(c,"BAD_INDENT",Bp)),!m.anchor&&!m.tag&&!p){l=m.end,m.comment&&(a.comment?a.comment+=`
|
|
84
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Lk.containsNewline(f))&&s(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&s(c,"BAD_INDENT",Bp);t.atKey=!0;let A=m.end,w=f?r(t,f,m,s):e(t,A,u,null,m,s);t.schema.compat&&Mp.flowIndentCheck(n.indent,f,s),t.atKey=!1,Mk.mapIncludes(t,a.items,w)&&s(A,"DUPLICATE_KEY","Map keys must be unique");let P=Lp.resolveProps(p??[],{indicator:"map-value-ind",next:h,offset:w.range[2],onError:s,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=P.end,P.found){b&&(h?.type==="block-map"&&!P.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&m.start<P.found.offset-1024&&s(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let R=h?r(t,h,P,s):e(t,c,p,null,P,s);t.schema.compat&&Mp.flowIndentCheck(n.indent,h,s),c=R.range[2];let C=new $p.Pair(w,R);t.options.keepSourceTokens&&(C.srcToken=d),a.items.push(C)}else{b&&s(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),P.comment&&(w.comment?w.comment+=`
|
|
85
|
+
`+P.comment:w.comment=P.comment);let R=new $p.Pair(w);t.options.keepSourceTokens&&(R.srcToken=d),a.items.push(R)}}return l&&l<c&&s(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,l??c],a}Dp.resolveBlockMap=Bk});var qp=T(Fp=>{"use strict";var Dk=gt(),jk=Cn(),Fk=Mc();function qk({composeNode:r,composeEmptyNode:e},t,n,s,i){let o=i?.nodeClass??Dk.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let c=n.offset,l=null;for(let{start:d,value:u}of n.items){let f=jk.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?s(f.end,"BAD_INDENT","All sequence items must start at the same column"):s(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=u?r(t,u,f,s):e(t,f.end,d,null,f,s);t.schema.compat&&Fk.flowIndentCheck(n.indent,u,s),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Fp.resolveBlockSeq=qk});var br=T(Up=>{"use strict";function Uk(r,e,t,n){let s="";if(r){let i=!1,o="";for(let a of r){let{source:c,type:l}=a;switch(l){case"space":i=!0;break;case"comment":{t&&!i&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";s?s+=o+d:s=d,o="";break}case"newline":s&&(o+=c),i=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:s,offset:e}}Up.resolveEnd=Uk});var Wp=T(Hp=>{"use strict";var Jk=q(),Kk=pt(),Jp=ht(),Hk=gt(),Wk=br(),Kp=Cn(),Yk=yi(),Vk=Bc(),Dc="Block collections are not allowed within flow collections",jc=r=>r&&(r.type==="block-map"||r.type==="block-seq");function zk({composeNode:r,composeEmptyNode:e},t,n,s,i){let o=n.start.source==="{",a=o?"flow map":"flow sequence",c=i?.nodeClass??(o?Jp.YAMLMap:Hk.YAMLSeq),l=new c(t.schema);l.flow=!0;let d=t.atRoot;d&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=n.offset+n.start.source.length;for(let b=0;b<n.items.length;++b){let A=n.items[b],{start:w,key:P,sep:R,value:C}=A,_=Kp.resolveProps(w,{flow:a,indicator:"explicit-key-ind",next:P??R?.[0],offset:u,onError:s,parentIndent:n.indent,startOnNewline:!1});if(!_.found){if(!_.anchor&&!_.tag&&!R&&!C){b===0&&_.comma?s(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):b<n.items.length-1&&s(_.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),_.comment&&(l.comment?l.comment+=`
|
|
86
|
+
`+_.comment:l.comment=_.comment),u=_.end;continue}!o&&t.options.strict&&Yk.containsNewline(P)&&s(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(b===0)_.comma&&s(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(_.comma||s(_.start,"MISSING_CHAR",`Missing , between ${a} items`),_.comment){let $="";e:for(let E of w)switch(E.type){case"comma":case"space":break;case"comment":$=E.source.substring(1);break e;default:break e}if($){let E=l.items[l.items.length-1];Jk.isPair(E)&&(E=E.value??E.key),E.comment?E.comment+=`
|
|
87
|
+
`+$:E.comment=$,_.comment=_.comment.substring($.length+1)}}if(!o&&!R&&!_.found){let $=C?r(t,C,_,s):e(t,_.end,R,null,_,s);l.items.push($),u=$.range[2],jc(C)&&s($.range,"BLOCK_IN_FLOW",Dc)}else{t.atKey=!0;let $=_.end,E=P?r(t,P,_,s):e(t,$,w,null,_,s);jc(P)&&s(E.range,"BLOCK_IN_FLOW",Dc),t.atKey=!1;let M=Kp.resolveProps(R??[],{flow:a,indicator:"map-value-ind",next:C,offset:E.range[2],onError:s,parentIndent:n.indent,startOnNewline:!1});if(M.found){if(!o&&!_.found&&t.options.strict){if(R)for(let y of R){if(y===M.found)break;if(y.type==="newline"){s(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}_.start<M.found.offset-1024&&s(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?s(C,"MISSING_CHAR",`Missing space after : in ${a}`):s(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let W=C?r(t,C,M,s):M.found?e(t,M.end,R,null,M,s):null;W?jc(C)&&s(W.range,"BLOCK_IN_FLOW",Dc):M.comment&&(E.comment?E.comment+=`
|
|
88
|
+
`+M.comment:E.comment=M.comment);let U=new Kk.Pair(E,W);if(t.options.keepSourceTokens&&(U.srcToken=A),o){let y=l;Vk.mapIncludes(t,y.items,E)&&s($,"DUPLICATE_KEY","Map keys must be unique"),y.items.push(U)}else{let y=new Jp.YAMLMap(t.schema);y.flow=!0,y.items.push(U);let x=(W??E).range;y.range=[E.range[0],x[1],x[2]],l.items.push(y)}u=W?W.range[2]:M.end}}let f=o?"}":"]",[p,...h]=n.end,m=u;if(p?.source===f)m=p.offset+p.source.length;else{let b=a[0].toUpperCase()+a.substring(1),A=d?`${b} must end with a ${f}`:`${b} in block collection must be sufficiently indented and end with a ${f}`;s(u,d?"MISSING_CHAR":"BAD_INDENT",A),p&&p.source.length!==1&&h.unshift(p)}if(h.length>0){let b=Wk.resolveEnd(h,m,t.options.strict,s);b.comment&&(l.comment?l.comment+=`
|
|
89
|
+
`+b.comment:l.comment=b.comment),l.range=[n.offset,m,b.offset]}else l.range=[n.offset,m,m];return l}Hp.resolveFlowCollection=zk});var Vp=T(Yp=>{"use strict";var Gk=q(),Xk=ee(),Qk=ht(),Zk=gt(),ex=jp(),tx=qp(),rx=Wp();function Fc(r,e,t,n,s,i){let o=t.type==="block-map"?ex.resolveBlockMap(r,e,t,n,i):t.type==="block-seq"?tx.resolveBlockSeq(r,e,t,n,i):rx.resolveFlowCollection(r,e,t,n,i),a=o.constructor;return s==="!"||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function nx(r,e,t,n,s){let i=n.tag,o=i?e.directives.tagName(i.source,f=>s(i,"TAG_RESOLVE_FAILED",f)):null;if(t.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,h=f&&i?f.offset>i.offset?f:i:f??i;h&&(!p||p.offset<h.offset)&&s(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===Qk.YAMLMap.tagName&&a==="map"||o===Zk.YAMLSeq.tagName&&a==="seq")return Fc(r,e,t,s,o);let c=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!c){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?s(i,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Fc(r,e,t,s,o)}let l=Fc(r,e,t,s,o,c),d=c.resolve?.(l,f=>s(i,"TAG_RESOLVE_FAILED",f),e.options)??l,u=Gk.isNode(d)?d:new Xk.Scalar(d);return u.range=l.range,u.tag=o,c?.format&&(u.format=c.format),u}Yp.composeCollection=nx});var Uc=T(zp=>{"use strict";var qc=ee();function sx(r,e,t){let n=e.offset,s=ix(e,r.options.strict,t);if(!s)return{value:"",type:null,comment:"",range:[n,n,n]};let i=s.mode===">"?qc.Scalar.BLOCK_FOLDED:qc.Scalar.BLOCK_LITERAL,o=e.source?ox(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let b=o[m][1];if(b===""||b==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&o.length>0?`
|
|
90
90
|
`.repeat(Math.max(1,o.length-1)):"",b=n+s.length;return e.source&&(b+=e.source.length),{value:m,type:i,comment:s.comment,range:[n,b,b]}}let c=e.indent+s.indent,l=e.offset+s.length,d=0;for(let m=0;m<a;++m){let[b,A]=o[m];if(A===""||A==="\r")s.indent===0&&b.length>c&&(c=b.length);else{b.length<c&&t(l+b.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=b.length),d=m,c===0&&!r.atRoot&&t(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=b.length+A.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>c&&(a=m+1);let u="",f="",p=!1;for(let m=0;m<d;++m)u+=o[m][0].slice(c)+`
|
|
91
|
-
`;for(let m=d;m<a;++m){let[b,A]=o[m];l+=b.length+A.length+1;let w=A[A.length-1]==="\r";if(w&&(A=A.slice(0,-1)),A&&b.length<c){let R=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;t(l-A.length-(w?2:1),"BAD_INDENT",R),b=""}i===
|
|
91
|
+
`;for(let m=d;m<a;++m){let[b,A]=o[m];l+=b.length+A.length+1;let w=A[A.length-1]==="\r";if(w&&(A=A.slice(0,-1)),A&&b.length<c){let R=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;t(l-A.length-(w?2:1),"BAD_INDENT",R),b=""}i===qc.Scalar.BLOCK_LITERAL?(u+=f+b.slice(c)+A,f=`
|
|
92
92
|
`):b.length>c||A[0]===" "?(f===" "?f=`
|
|
93
93
|
`:!p&&f===`
|
|
94
94
|
`&&(f=`
|
|
@@ -101,90 +101,90 @@ ${l}
|
|
|
101
101
|
`+o[m][0].slice(c);u[u.length-1]!==`
|
|
102
102
|
`&&(u+=`
|
|
103
103
|
`);break;default:u+=`
|
|
104
|
-
`}let h=n+s.length+e.source.length;return{value:u,type:i,comment:s.comment,range:[n,h,h]}}function
|
|
104
|
+
`}let h=n+s.length+e.source.length;return{value:u,type:i,comment:s.comment,range:[n,h,h]}}function ix({offset:r,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=e[0],i=s[0],o=0,a="",c=-1;for(let f=1;f<s.length;++f){let p=s[f];if(!a&&(p==="-"||p==="+"))a=p;else{let h=Number(p);!o&&h?o=h:c===-1&&(c=r+f)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let l=!1,d="",u=s.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":u+=p.source.length;break;case"comment":t&&!l&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let h=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",h);let m=p.source;m&&typeof m=="string"&&(u+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:d,length:u}}function ox(r){let e=r.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),i=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}zp.resolveBlockScalar=sx});var Kc=T(Xp=>{"use strict";var Jc=ee(),ax=br();function cx(r,e,t){let{offset:n,type:s,source:i,end:o}=r,a,c,l=(f,p,h)=>t(n+f,p,h);switch(s){case"scalar":a=Jc.Scalar.PLAIN,c=lx(i,l);break;case"single-quoted-scalar":a=Jc.Scalar.QUOTE_SINGLE,c=ux(i,l);break;case"double-quoted-scalar":a=Jc.Scalar.QUOTE_DOUBLE,c=dx(i,l);break;default:return t(r,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[n,n+i.length,n+i.length]}}let d=n+i.length,u=ax.resolveEnd(o,d,e,t);return{value:c,type:a,comment:u.comment,range:[n,d,u.offset]}}function lx(r,e){let t="";switch(r[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${r[0]}`;break}case"@":case"`":{t=`reserved character ${r[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Gp(r)}function ux(r,e){return(r[r.length-1]!=="'"||r.length===1)&&e(r.length,"MISSING_CHAR","Missing closing 'quote"),Gp(r.slice(1,-1)).replace(/''/g,"'")}function Gp(r){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
105
105
|
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
106
106
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(r);if(!n)return r;let s=n[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(r);)n[1]===""?i===`
|
|
107
107
|
`?s+=i:i=`
|
|
108
|
-
`:(s+=i+n[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(r),s+i+(n?.[1]??"")}function
|
|
108
|
+
`:(s+=i+n[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(r),s+i+(n?.[1]??"")}function dx(r,e){let t="";for(let n=1;n<r.length-1;++n){let s=r[n];if(!(s==="\r"&&r[n+1]===`
|
|
109
109
|
`))if(s===`
|
|
110
|
-
`){let{fold:i,offset:o}=
|
|
110
|
+
`){let{fold:i,offset:o}=fx(r,n);t+=i,n=o}else if(s==="\\"){let i=r[++n],o=px[i];if(o)t+=o;else if(i===`
|
|
111
111
|
`)for(i=r[n+1];i===" "||i===" ";)i=r[++n+1];else if(i==="\r"&&r[n+1]===`
|
|
112
|
-
`)for(i=r[++n+1];i===" "||i===" ";)i=r[++n+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=
|
|
112
|
+
`)for(i=r[++n+1];i===" "||i===" ";)i=r[++n+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=mx(r,n+1,a,e),n+=a}else{let a=r.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(s===" "||s===" "){let i=n,o=r[n+1];for(;o===" "||o===" ";)o=r[++n+1];o!==`
|
|
113
113
|
`&&!(o==="\r"&&r[n+2]===`
|
|
114
|
-
`)&&(t+=n>i?r.slice(i,n+1):s)}else t+=s}return(r[r.length-1]!=='"'||r.length===1)&&e(r.length,"MISSING_CHAR",'Missing closing "quote'),t}function
|
|
114
|
+
`)&&(t+=n>i?r.slice(i,n+1):s)}else t+=s}return(r[r.length-1]!=='"'||r.length===1)&&e(r.length,"MISSING_CHAR",'Missing closing "quote'),t}function fx(r,e){let t="",n=r[e+1];for(;(n===" "||n===" "||n===`
|
|
115
115
|
`||n==="\r")&&!(n==="\r"&&r[e+2]!==`
|
|
116
116
|
`);)n===`
|
|
117
117
|
`&&(t+=`
|
|
118
|
-
`),e+=1,n=r[e+1];return t||(t=" "),{fold:t,offset:e}}var
|
|
119
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
118
|
+
`),e+=1,n=r[e+1];return t||(t=" "),{fold:t,offset:e}}var px={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
119
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function mx(r,e,t,n){let s=r.substr(e,t),o=s.length===t&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(o)){let a=r.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}Xp.resolveFlowScalar=cx});var em=T(Zp=>{"use strict";var Ft=q(),Qp=ee(),hx=Uc(),gx=Kc();function yx(r,e,t,n){let{value:s,type:i,comment:o,range:a}=e.type==="block-scalar"?hx.resolveBlockScalar(r,e,n):gx.resolveFlowScalar(e,r.options.strict,n),c=t?r.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null,l;r.options.stringKeys&&r.atKey?l=r.schema[Ft.SCALAR]:c?l=bx(r.schema,s,c,t,n):e.type==="scalar"?l=wx(r,s,e,n):l=r.schema[Ft.SCALAR];let d;try{let u=l.resolve(s,f=>n(t??e,"TAG_RESOLVE_FAILED",f),r.options);d=Ft.isScalar(u)?u:new Qp.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);n(t??e,"TAG_RESOLVE_FAILED",f),d=new Qp.Scalar(s)}return d.range=a,d.source=s,i&&(d.type=i),c&&(d.tag=c),l.format&&(d.format=l.format),o&&(d.comment=o),d}function bx(r,e,t,n,s){if(t==="!")return r[Ft.SCALAR];let i=[];for(let a of r.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=r.knownTags[t];return o&&!o.collection?(r.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),r[Ft.SCALAR])}function wx({atKey:r,directives:e,schema:t},n,s,i){let o=t.tags.find(a=>(a.default===!0||r&&a.default==="key")&&a.test?.test(n))||t[Ft.SCALAR];if(t.compat){let a=t.compat.find(c=>c.default&&c.test?.test(n))??t[Ft.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),d=`Value may be parsed as either ${c} or ${l}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return o}Zp.composeScalar=yx});var rm=T(tm=>{"use strict";function vx(r,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let s=e[n];switch(s.type){case"space":case"comment":case"newline":r-=s.source.length;continue}for(s=e[++n];s?.type==="space";)r+=s.source.length,s=e[++n];break}}return r}tm.emptyScalarPosition=vx});var im=T(Wc=>{"use strict";var Sx=cn(),kx=q(),xx=Vp(),nm=em(),Ex=br(),Ax=rm(),Tx={composeNode:sm,composeEmptyNode:Hc};function sm(r,e,t,n){let s=r.atKey,{spaceBefore:i,comment:o,anchor:a,tag:c}=t,l,d=!0;switch(e.type){case"alias":l=Px(r,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=nm.composeScalar(r,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=xx.composeCollection(Tx,r,e,t,n),a&&(l.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),l=Hc(r,e.offset,void 0,null,t,n),d=!1}}return a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&r.options.stringKeys&&(!kx.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),r.options.keepSourceTokens&&d&&(l.srcToken=e),l}function Hc(r,e,t,n,{spaceBefore:s,comment:i,anchor:o,tag:a,end:c},l){let d={type:"scalar",offset:Ax.emptyScalarPosition(e,t,n),indent:-1,source:""},u=nm.composeScalar(r,d,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=c),u}function Px({options:r},{offset:e,source:t,end:n},s){let i=new Sx.Alias(t.substring(1));i.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=Ex.resolveEnd(n,o,r.strict,s);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}Wc.composeEmptyNode=Hc;Wc.composeNode=sm});var cm=T(am=>{"use strict";var Ox=An(),om=im(),Cx=br(),Rx=Cn();function _x(r,e,{offset:t,start:n,value:s,end:i},o){let a=Object.assign({_directives:e},r),c=new Ox.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Rx.resolveProps(n,{indicator:"doc-start",next:s??i?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?om.composeNode(l,s,d,o):om.composeEmptyNode(l,d.end,n,null,d,o);let u=c.contents.range[2],f=Cx.resolveEnd(i,u,!1,o);return f.comment&&(c.comment=f.comment),c.range=[t,u,f.offset],c}am.composeDoc=_x});var Vc=T(dm=>{"use strict";var Nx=ks("process"),Ix=Ia(),$x=An(),Rn=On(),lm=q(),Lx=cm(),Mx=br();function _n(r){if(typeof r=="number")return[r,r+1];if(Array.isArray(r))return r.length===2?r:[r[0],r[1]];let{offset:e,source:t}=r;return[e,e+(typeof t=="string"?t.length:1)]}function um(r){let e="",t=!1,n=!1;for(let s=0;s<r.length;++s){let i=r[s];switch(i[0]){case"#":e+=(e===""?"":n?`
|
|
120
120
|
|
|
121
121
|
`:`
|
|
122
|
-
`)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":r[s+1]?.[0]!=="#"&&(s+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var
|
|
123
|
-
${n}`:n;else if(s||e.directives.docStart||!i)e.commentBefore=n;else if(
|
|
122
|
+
`)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":r[s+1]?.[0]!=="#"&&(s+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var Yc=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,s,i)=>{let o=_n(t);i?this.warnings.push(new Rn.YAMLWarning(o,n,s)):this.errors.push(new Rn.YAMLParseError(o,n,s))},this.directives=new Ix.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:s}=um(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
123
|
+
${n}`:n;else if(s||e.directives.docStart||!i)e.commentBefore=n;else if(lm.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];lm.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}
|
|
124
124
|
${a}`:n}else{let o=i.commentBefore;i.commentBefore=o?`${n}
|
|
125
|
-
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
126
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new
|
|
125
|
+
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:um(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let s of e)yield*this.next(s);yield*this.end(t,n)}*next(e){switch(Nx.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,n,s)=>{let i=_n(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Lx.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Rn.YAMLParseError(_n(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Rn.YAMLParseError(_n(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=Mx.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
126
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Rn.YAMLParseError(_n(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),s=new $x.Document(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}};dm.Composer=Yc});var mm=T(bi=>{"use strict";var Bx=Uc(),Dx=Kc(),jx=On(),fm=pn();function Fx(r,e=!0,t){if(r){let n=(s,i,o)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(t)t(a,i,o);else throw new jx.YAMLParseError([a,a+1],i,o)};switch(r.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Dx.resolveFlowScalar(r,e,n);case"block-scalar":return Bx.resolveBlockScalar({options:{strict:e}},r,n)}}return null}function qx(r,e){let{implicitKey:t=!1,indent:n,inFlow:s=!1,offset:i=-1,type:o="PLAIN"}=e,a=fm.stringifyString({type:o,value:r},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
127
127
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
128
128
|
`),d=a.substring(0,l),u=a.substring(l+1)+`
|
|
129
|
-
`,f=[{type:"block-scalar-header",offset:i,indent:n,source:d}];return
|
|
130
|
-
`}),{type:"block-scalar",offset:i,indent:n,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:n,source:a,end:c};default:return{type:"scalar",offset:i,indent:n,source:a,end:c}}}function
|
|
129
|
+
`,f=[{type:"block-scalar-header",offset:i,indent:n,source:d}];return pm(f,c)||f.push({type:"newline",offset:-1,indent:n,source:`
|
|
130
|
+
`}),{type:"block-scalar",offset:i,indent:n,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:n,source:a,end:c};default:return{type:"scalar",offset:i,indent:n,source:a,end:c}}}function Ux(r,e,t={}){let{afterKey:n=!1,implicitKey:s=!1,inFlow:i=!1,type:o}=t,a="indent"in r?r.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(r.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=r.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=fm.stringifyString({type:o,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Jx(r,c);break;case'"':zc(r,c,"double-quoted-scalar");break;case"'":zc(r,c,"single-quoted-scalar");break;default:zc(r,c,"scalar")}}function Jx(r,e){let t=e.indexOf(`
|
|
131
131
|
`),n=e.substring(0,t),s=e.substring(t+1)+`
|
|
132
|
-
`;if(r.type==="block-scalar"){let i=r.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=n,r.source=s}else{let{offset:i}=r,o="indent"in r?r.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:n}];
|
|
133
|
-
`});for(let c of Object.keys(r))c!=="type"&&c!=="offset"&&delete r[c];Object.assign(r,{type:"block-scalar",indent:o,props:a,source:s})}}function
|
|
134
|
-
`};delete r.items,Object.assign(r,{type:t,source:e,end:[s]});break}default:{let n="indent"in r?r.indent:-1,s="end"in r&&Array.isArray(r.end)?r.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(r))i!=="type"&&i!=="offset"&&delete r[i];Object.assign(r,{type:t,indent:n,source:e,end:s})}}}
|
|
132
|
+
`;if(r.type==="block-scalar"){let i=r.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=n,r.source=s}else{let{offset:i}=r,o="indent"in r?r.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:n}];pm(a,"end"in r?r.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
133
|
+
`});for(let c of Object.keys(r))c!=="type"&&c!=="offset"&&delete r[c];Object.assign(r,{type:"block-scalar",indent:o,props:a,source:s})}}function pm(r,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":r.push(t);break;case"newline":return r.push(t),!0}return!1}function zc(r,e,t){switch(r.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":r.type=t,r.source=e;break;case"block-scalar":{let n=r.props.slice(1),s=e.length;r.props[0].type==="block-scalar-header"&&(s-=r.props[0].source.length);for(let i of n)i.offset+=s;delete r.props,Object.assign(r,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let s={type:"newline",offset:r.offset+e.length,indent:r.indent,source:`
|
|
134
|
+
`};delete r.items,Object.assign(r,{type:t,source:e,end:[s]});break}default:{let n="indent"in r?r.indent:-1,s="end"in r&&Array.isArray(r.end)?r.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(r))i!=="type"&&i!=="offset"&&delete r[i];Object.assign(r,{type:t,indent:n,source:e,end:s})}}}bi.createScalarToken=qx;bi.resolveAsScalar=Fx;bi.setScalarValue=Ux});var gm=T(hm=>{"use strict";var Kx=r=>"type"in r?vi(r):wi(r);function vi(r){switch(r.type){case"block-scalar":{let e="";for(let t of r.props)e+=vi(t);return e+r.source}case"block-map":case"block-seq":{let e="";for(let t of r.items)e+=wi(t);return e}case"flow-collection":{let e=r.start.source;for(let t of r.items)e+=wi(t);for(let t of r.end)e+=t.source;return e}case"document":{let e=wi(r);if(r.end)for(let t of r.end)e+=t.source;return e}default:{let e=r.source;if("end"in r&&r.end)for(let t of r.end)e+=t.source;return e}}}function wi({start:r,key:e,sep:t,value:n}){let s="";for(let i of r)s+=i.source;if(e&&(s+=vi(e)),t)for(let i of t)s+=i.source;return n&&(s+=vi(n)),s}hm.stringify=Kx});var vm=T(wm=>{"use strict";var Gc=Symbol("break visit"),Hx=Symbol("skip children"),ym=Symbol("remove item");function qt(r,e){"type"in r&&r.type==="document"&&(r={start:r.start,value:r.value}),bm(Object.freeze([]),r,e)}qt.BREAK=Gc;qt.SKIP=Hx;qt.REMOVE=ym;qt.itemAtPath=(r,e)=>{let t=r;for(let[n,s]of e){let i=t?.[n];if(i&&"items"in i)t=i.items[s];else return}return t};qt.parentCollection=(r,e)=>{let t=qt.itemAtPath(r,e.slice(0,-1)),n=e[e.length-1][0],s=t?.[n];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function bm(r,e,t){let n=t(e,r);if(typeof n=="symbol")return n;for(let s of["key","value"]){let i=e[s];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=bm(Object.freeze(r.concat([[s,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Gc)return Gc;a===ym&&(i.items.splice(o,1),o-=1)}}typeof n=="function"&&s==="key"&&(n=n(e,r))}}return typeof n=="function"?n(e,r):n}wm.visit=qt});var Si=T(ge=>{"use strict";var Xc=mm(),Wx=gm(),Yx=vm(),Qc="\uFEFF",Zc="",el="",tl="",Vx=r=>!!r&&"items"in r,zx=r=>!!r&&(r.type==="scalar"||r.type==="single-quoted-scalar"||r.type==="double-quoted-scalar"||r.type==="block-scalar");function Gx(r){switch(r){case Qc:return"<BOM>";case Zc:return"<DOC>";case el:return"<FLOW_END>";case tl:return"<SCALAR>";default:return JSON.stringify(r)}}function Xx(r){switch(r){case Qc:return"byte-order-mark";case Zc:return"doc-mode";case el:return"flow-error-end";case tl:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
135
135
|
`:case`\r
|
|
136
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(r[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ge.createScalarToken=
|
|
137
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
138
|
-
\r `),
|
|
136
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(r[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}ge.createScalarToken=Xc.createScalarToken;ge.resolveAsScalar=Xc.resolveAsScalar;ge.setScalarValue=Xc.setScalarValue;ge.stringify=Wx.stringify;ge.visit=Yx.visit;ge.BOM=Qc;ge.DOCUMENT=Zc;ge.FLOW_END=el;ge.SCALAR=tl;ge.isCollection=Vx;ge.isScalar=zx;ge.prettyToken=Gx;ge.tokenType=Xx});var sl=T(km=>{"use strict";var Nn=Si();function _e(r){switch(r){case void 0:case" ":case`
|
|
137
|
+
`:case"\r":case" ":return!0;default:return!1}}var Sm=new Set("0123456789ABCDEFabcdef"),Qx=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ki=new Set(",[]{}"),Zx=new Set(` ,[]{}
|
|
138
|
+
\r `),rl=r=>!r||Zx.has(r),nl=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
139
139
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
140
140
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let s=this.buffer[n+e+1];if(s===`
|
|
141
141
|
`||!s&&!this.atEnd)return e+n+1}return t===`
|
|
142
142
|
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&_e(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
143
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
143
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Nn.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let i=e[n-1];if(i===" "||i===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Nn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&_e(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!_e(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&_e(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(rl),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&s[0]!=="#"||n===0&&(s.startsWith("---")||s.startsWith("..."))&&_e(s[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield Nn.FLOW_END,yield*this.parseLineStart();let i=0;for(;s[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),s[i]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(rl),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||_e(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),s=n.indexOf(`
|
|
144
144
|
`,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=n.indexOf(`
|
|
145
145
|
`,i)}s!==-1&&(t=s-(n[s-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>_e(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
|
|
146
146
|
`:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
147
147
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
|
148
148
|
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(n=this.buffer[s];n===" ";)n=this.buffer[++s];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
149
149
|
`;)n=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
|
150
|
-
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield
|
|
150
|
+
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield Nn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let i=this.buffer[n+1];if(_e(i)||e&&ki.has(i))break;t=n}else if(_e(s)){let i=this.buffer[n+1];if(s==="\r"&&(i===`
|
|
151
151
|
`?(n+=1,s=`
|
|
152
|
-
`,i=this.buffer[n+1]):t=n),i==="#"||e&&
|
|
153
|
-
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&
|
|
152
|
+
`,i=this.buffer[n+1]):t=n),i==="#"||e&&ki.has(i))break;if(s===`
|
|
153
|
+
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&ki.has(s))break;t=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield Nn.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(rl))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(_e(t)||e&&ki.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!_e(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Qx.has(t))t=this.buffer[++e];else if(t==="%"&&Sm.has(this.buffer[e+1])&&Sm.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
154
154
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
155
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};
|
|
155
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};km.Lexer=nl});var ol=T(xm=>{"use strict";var il=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};xm.LineCounter=il});var cl=T(Om=>{"use strict";var e0=ks("process"),Em=Si(),t0=sl();function yt(r,e){for(let t=0;t<r.length;++t)if(r[t].type===e)return!0;return!1}function Am(r){for(let e=0;e<r.length;++e)switch(r[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Pm(r){switch(r?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function xi(r){switch(r.type){case"document":return r.start;case"block-map":{let e=r.items[r.items.length-1];return e.sep??e.start}case"block-seq":return r.items[r.items.length-1].start;default:return[]}}function wr(r){if(r.length===0)return[];let e=r.length;e:for(;--e>=0;)switch(r[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;r[++e]?.type==="space";);return r.splice(e,r.length)}function Tm(r){if(r.start.type==="flow-seq-start")for(let e of r.items)e.sep&&!e.value&&!yt(e.start,"explicit-key-ind")&&!yt(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Pm(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var al=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new t0.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,e0.env.LOG_TOKENS&&console.log("|",Em.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Em.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Tm(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let s=n.items[n.items.length-1];if(s.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=n.items[n.items.length-1];s.value?n.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{let s=n.items[n.items.length-1];!s||s.value?n.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&Am(s.start)===-1&&(t.indent===0||s.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=s.start:n.items.push({start:s.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Am(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=xi(this.peek(2)),n=wr(t),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
156
156
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
157
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let c=t.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(
|
|
157
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let c=t.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(yt(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Pm(t.key)&&!yt(t.sep,"newline")){let o=wr(t.start),a=t.key,c=t.sep;c.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(yt(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=wr(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):yt(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);s||t.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!yt(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||yt(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=xi(n),i=wr(s);Tm(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
158
158
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
159
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=
|
|
160
|
-
`),t=e.trim();if(
|
|
159
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=xi(e),n=wr(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=xi(e),n=wr(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Om.Parser=al});var Im=T($n=>{"use strict";var Cm=Vc(),r0=An(),In=On(),n0=Wa(),s0=q(),i0=ol(),Rm=cl();function _m(r){let e=r.prettyErrors!==!1;return{lineCounter:r.lineCounter||e&&new i0.LineCounter||null,prettyErrors:e}}function o0(r,e={}){let{lineCounter:t,prettyErrors:n}=_m(e),s=new Rm.Parser(t?.addNewLine),i=new Cm.Composer(e),o=Array.from(i.compose(s.parse(r)));if(n&&t)for(let a of o)a.errors.forEach(In.prettifyError(r,t)),a.warnings.forEach(In.prettifyError(r,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function Nm(r,e={}){let{lineCounter:t,prettyErrors:n}=_m(e),s=new Rm.Parser(t?.addNewLine),i=new Cm.Composer(e),o=null;for(let a of i.compose(s.parse(r),!0,r.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new In.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(In.prettifyError(r,t)),o.warnings.forEach(In.prettifyError(r,t))),o}function a0(r,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let s=Nm(r,t);if(!s)return null;if(s.warnings.forEach(i=>n0.warn(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},t))}function c0(r,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let s=Math.round(t);t=s<1?void 0:s>8?{indent:8}:{indent:s}}if(r===void 0){let{keepUndefined:s}=t??e??{};if(!s)return}return s0.isDocument(r)&&!n?r.toString(t):new r0.Document(r,n,t).toString(t)}$n.parse=a0;$n.parseAllDocuments=o0;$n.parseDocument=Nm;$n.stringify=c0});var Lm=T(J=>{"use strict";var l0=Vc(),u0=An(),d0=Oc(),ll=On(),f0=cn(),bt=q(),p0=pt(),m0=ee(),h0=ht(),g0=gt(),y0=Si(),b0=sl(),w0=ol(),v0=cl(),Ei=Im(),$m=nn();J.Composer=l0.Composer;J.Document=u0.Document;J.Schema=d0.Schema;J.YAMLError=ll.YAMLError;J.YAMLParseError=ll.YAMLParseError;J.YAMLWarning=ll.YAMLWarning;J.Alias=f0.Alias;J.isAlias=bt.isAlias;J.isCollection=bt.isCollection;J.isDocument=bt.isDocument;J.isMap=bt.isMap;J.isNode=bt.isNode;J.isPair=bt.isPair;J.isScalar=bt.isScalar;J.isSeq=bt.isSeq;J.Pair=p0.Pair;J.Scalar=m0.Scalar;J.YAMLMap=h0.YAMLMap;J.YAMLSeq=g0.YAMLSeq;J.CST=y0;J.Lexer=b0.Lexer;J.LineCounter=w0.LineCounter;J.Parser=v0.Parser;J.parse=Ei.parse;J.parseAllDocuments=Ei.parseAllDocuments;J.parseDocument=Ei.parseDocument;J.stringify=Ei.stringify;J.visit=$m.visit;J.visitAsync=$m.visitAsync});function k0(r){try{return JSON.parse(r.trim()),!0}catch{return!1}}function x0(r){let e=r.trim();if(!e.startsWith("<"))return!1;let t=e.match(S0);return t?rn(e,t[1])!==null:!1}function E0(r){let e=r.trim();if(!e.match(/^(---|#|\w+:|-)/)||"[{<".includes(e[0]))return!1;try{let t=Mm.parse(e);return t!==null&&typeof t=="object"}catch{return!1}}function Bm(r){return k0(r)||x0(r)||E0(r)}var Mm,S0,ul=v(()=>{Wd();Mm=Rw(Lm(),1),S0=/<([a-zA-Z_][\w.-]*)/});function A0(r){if(!r?.trim())return[];let e=r.replace(/\r\n/g,`
|
|
160
|
+
`),t=e.trim();if(Bm(t))return[{text:t,startLine:1,endLine:e.split(`
|
|
161
161
|
`).length}];let n=e.split(`
|
|
162
162
|
`),s=[],i=0,o=-1,a=0,c=()=>{if(o>=i){let l=n.slice(i,o+1).join(`
|
|
163
|
-
`).trim();l&&s.push({text:l,startLine:i+1,endLine:o+1})}};for(let l=0;l<n.length;l++)n[l].trim()?(a>=2&&o>=i&&(c(),i=l),a=0,o=l):a++;return c(),s}function
|
|
163
|
+
`).trim();l&&s.push({text:l,startLine:i+1,endLine:o+1})}};for(let l=0;l<n.length;l++)n[l].trim()?(a>=2&&o>=i&&(c(),i=l),a=0,o=l):a++;return c(),s}function Ai(r){return A0(r).map(e=>e.text)}var Dm,jm=v(()=>{ul();Dm=`
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
`});function Ai(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Bm=v(()=>{});var k0,x0,al,Dm=v(()=>{k0=[["\xDF","ss"],["\u1E9E","Ss"],["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xC0","A"],["\xC1","A"],["\xC2","A"],["\xC3","A"],["\xC4","Ae"],["\xC5","A"],["\xC6","AE"],["\xC7","C"],["\xC8","E"],["\xC9","E"],["\xCA","E"],["\xCB","E"],["\u018F","A"],["\xCC","I"],["\xCD","I"],["\xCE","I"],["\xCF","I"],["\xD0","D"],["\xD1","N"],["\xD2","O"],["\xD3","O"],["\xD4","O"],["\xD5","O"],["\xD6","Oe"],["\u014C","O"],["\u0150","O"],["\xD8","O"],["\u0152","OE"],["\xD9","U"],["\xDA","U"],["\xDB","U"],["\xDC","Ue"],["\u0170","U"],["\xDD","Y"],["\xDE","TH"],["\xDF","ss"],["\xE0","a"],["\xE1","a"],["\xE2","a"],["\xE3","a"],["\xE4","ae"],["\xE5","a"],["\xE6","ae"],["\xE7","c"],["\xE8","e"],["\xE9","e"],["\xEA","e"],["\xEB","e"],["\u0259","a"],["\xEC","i"],["\xED","i"],["\xEE","i"],["\xEF","i"],["\xF0","d"],["\xF1","n"],["\xF2","o"],["\xF3","o"],["\xF4","o"],["\xF5","o"],["\xF6","oe"],["\u014D","o"],["\u0151","o"],["\xF8","o"],["\u0153","oe"],["\xF9","u"],["\xFA","u"],["\xFB","u"],["\xFC","ue"],["\u0171","u"],["\xFD","y"],["\xFE","th"],["\xFF","y"],["\xE0","a"],["\xC0","A"],["\xE1","a"],["\xC1","A"],["\xE2","a"],["\xC2","A"],["\xE3","a"],["\xC3","A"],["\xE8","e"],["\xC8","E"],["\xE9","e"],["\xC9","E"],["\xEA","e"],["\xCA","E"],["\xEC","i"],["\xCC","I"],["\xED","i"],["\xCD","I"],["\xF2","o"],["\xD2","O"],["\xF3","o"],["\xD3","O"],["\xF4","o"],["\xD4","O"],["\xF5","o"],["\xD5","O"],["\xF9","u"],["\xD9","U"],["\xFA","u"],["\xDA","U"],["\xFD","y"],["\xDD","Y"],["\u0103","a"],["\u0102","A"],["\u0110","D"],["\u0111","d"],["\u0129","i"],["\u0128","I"],["\u0169","u"],["\u0168","U"],["\u01A1","o"],["\u01A0","O"],["\u01B0","u"],["\u01AF","U"],["\u1EA1","a"],["\u1EA0","A"],["\u1EA3","a"],["\u1EA2","A"],["\u1EA5","a"],["\u1EA4","A"],["\u1EA7","a"],["\u1EA6","A"],["\u1EA9","a"],["\u1EA8","A"],["\u1EAB","a"],["\u1EAA","A"],["\u1EAD","a"],["\u1EAC","A"],["\u1EAF","a"],["\u1EAE","A"],["\u1EB1","a"],["\u1EB0","A"],["\u1EB3","a"],["\u1EB2","A"],["\u1EB5","a"],["\u1EB4","A"],["\u1EB7","a"],["\u1EB6","A"],["\u1EB9","e"],["\u1EB8","E"],["\u1EBB","e"],["\u1EBA","E"],["\u1EBD","e"],["\u1EBC","E"],["\u1EBF","e"],["\u1EBE","E"],["\u1EC1","e"],["\u1EC0","E"],["\u1EC3","e"],["\u1EC2","E"],["\u1EC5","e"],["\u1EC4","E"],["\u1EC7","e"],["\u1EC6","E"],["\u1EC9","i"],["\u1EC8","I"],["\u1ECB","i"],["\u1ECA","I"],["\u1ECD","o"],["\u1ECC","O"],["\u1ECF","o"],["\u1ECE","O"],["\u1ED1","o"],["\u1ED0","O"],["\u1ED3","o"],["\u1ED2","O"],["\u1ED5","o"],["\u1ED4","O"],["\u1ED7","o"],["\u1ED6","O"],["\u1ED9","o"],["\u1ED8","O"],["\u1EDB","o"],["\u1EDA","O"],["\u1EDD","o"],["\u1EDC","O"],["\u1EDF","o"],["\u1EDE","O"],["\u1EE1","o"],["\u1EE0","O"],["\u1EE3","o"],["\u1EE2","O"],["\u1EE5","u"],["\u1EE4","U"],["\u1EE7","u"],["\u1EE6","U"],["\u1EE9","u"],["\u1EE8","U"],["\u1EEB","u"],["\u1EEA","U"],["\u1EED","u"],["\u1EEC","U"],["\u1EEF","u"],["\u1EEE","U"],["\u1EF1","u"],["\u1EF0","U"],["\u1EF3","y"],["\u1EF2","Y"],["\u1EF5","y"],["\u1EF4","Y"],["\u1EF7","y"],["\u1EF6","Y"],["\u1EF9","y"],["\u1EF8","Y"],["\u0621","e"],["\u0622","a"],["\u0623","a"],["\u0624","w"],["\u0625","a"],["\u0626","y"],["\u0627","a"],["\u0628","b"],["\u0629","t"],["\u062A","t"],["\u062B","th"],["\u062C","j"],["\u062D","h"],["\u062E","kh"],["\u062F","d"],["\u0630","dh"],["\u0631","r"],["\u0632","z"],["\u0633","s"],["\u0634","sh"],["\u0635","s"],["\u0636","d"],["\u0637","t"],["\u0638","z"],["\u0639","e"],["\u063A","gh"],["\u0640","_"],["\u0641","f"],["\u0642","q"],["\u0643","k"],["\u0644","l"],["\u0645","m"],["\u0646","n"],["\u0647","h"],["\u0648","w"],["\u0649","a"],["\u064A","y"],["\u064E\u200E","a"],["\u064F","u"],["\u0650\u200E","i"],["\u0660","0"],["\u0661","1"],["\u0662","2"],["\u0663","3"],["\u0664","4"],["\u0665","5"],["\u0666","6"],["\u0667","7"],["\u0668","8"],["\u0669","9"],["\u0686","ch"],["\u06A9","k"],["\u06AF","g"],["\u067E","p"],["\u0698","zh"],["\u06CC","y"],["\u06F0","0"],["\u06F1","1"],["\u06F2","2"],["\u06F3","3"],["\u06F4","4"],["\u06F5","5"],["\u06F6","6"],["\u06F7","7"],["\u06F8","8"],["\u06F9","9"],["\u067C","p"],["\u0681","z"],["\u0685","c"],["\u0689","d"],["\uFEAB","d"],["\uFEAD","r"],["\u0693","r"],["\uFEAF","z"],["\u0696","g"],["\u069A","x"],["\u06AB","g"],["\u06BC","n"],["\u06C0","e"],["\u06D0","e"],["\u06CD","ai"],["\u0679","t"],["\u0688","d"],["\u0691","r"],["\u06BA","n"],["\u06C1","h"],["\u06BE","h"],["\u06D2","e"],["\u0410","A"],["\u0430","a"],["\u0411","B"],["\u0431","b"],["\u0412","V"],["\u0432","v"],["\u0413","G"],["\u0433","g"],["\u0414","D"],["\u0434","d"],["\u044A\u0435","ye"],["\u042A\u0435","Ye"],["\u044A\u0415","yE"],["\u042A\u0415","YE"],["\u0415","E"],["\u0435","e"],["\u0401","Yo"],["\u0451","yo"],["\u0416","Zh"],["\u0436","zh"],["\u0417","Z"],["\u0437","z"],["\u0418","I"],["\u0438","i"],["\u044B\u0439","iy"],["\u042B\u0439","Iy"],["\u042B\u0419","IY"],["\u044B\u0419","iY"],["\u0419","Y"],["\u0439","y"],["\u041A","K"],["\u043A","k"],["\u041B","L"],["\u043B","l"],["\u041C","M"],["\u043C","m"],["\u041D","N"],["\u043D","n"],["\u041E","O"],["\u043E","o"],["\u041F","P"],["\u043F","p"],["\u0420","R"],["\u0440","r"],["\u0421","S"],["\u0441","s"],["\u0422","T"],["\u0442","t"],["\u0423","U"],["\u0443","u"],["\u0424","F"],["\u0444","f"],["\u0425","Kh"],["\u0445","kh"],["\u0426","Ts"],["\u0446","ts"],["\u0427","Ch"],["\u0447","ch"],["\u0428","Sh"],["\u0448","sh"],["\u0429","Sch"],["\u0449","sch"],["\u042A",""],["\u044A",""],["\u042B","Y"],["\u044B","y"],["\u042C",""],["\u044C",""],["\u042D","E"],["\u044D","e"],["\u042E","Yu"],["\u044E","yu"],["\u042F","Ya"],["\u044F","ya"],["\u0103","a"],["\u0102","A"],["\u0219","s"],["\u0218","S"],["\u021B","t"],["\u021A","T"],["\u0163","t"],["\u0162","T"],["\u015F","s"],["\u015E","S"],["\xE7","c"],["\xC7","C"],["\u011F","g"],["\u011E","G"],["\u0131","i"],["\u0130","I"],["\u0561","a"],["\u0531","A"],["\u0562","b"],["\u0532","B"],["\u0563","g"],["\u0533","G"],["\u0564","d"],["\u0534","D"],["\u0565","ye"],["\u0535","Ye"],["\u0566","z"],["\u0536","Z"],["\u0567","e"],["\u0537","E"],["\u0568","y"],["\u0538","Y"],["\u0569","t"],["\u0539","T"],["\u056A","zh"],["\u053A","Zh"],["\u056B","i"],["\u053B","I"],["\u056C","l"],["\u053C","L"],["\u056D","kh"],["\u053D","Kh"],["\u056E","ts"],["\u053E","Ts"],["\u056F","k"],["\u053F","K"],["\u0570","h"],["\u0540","H"],["\u0571","dz"],["\u0541","Dz"],["\u0572","gh"],["\u0542","Gh"],["\u0573","tch"],["\u0543","Tch"],["\u0574","m"],["\u0544","M"],["\u0575","y"],["\u0545","Y"],["\u0576","n"],["\u0546","N"],["\u0577","sh"],["\u0547","Sh"],["\u0578\u0582","u"],["\u0548\u0552","U"],["\u0548\u0582","U"],["\u0578","vo"],["\u0548","Vo"],["\u0579","ch"],["\u0549","Ch"],["\u057A","p"],["\u054A","P"],["\u057B","j"],["\u054B","J"],["\u057C","r"],["\u054C","R"],["\u057D","s"],["\u054D","S"],["\u057E","v"],["\u054E","V"],["\u057F","t"],["\u054F","T"],["\u0580","r"],["\u0550","R"],["\u0581","c"],["\u0551","C"],["\u0583","p"],["\u0553","P"],["\u0584","q"],["\u0554","Q"],["\u0585","o"],["\u0555","O"],["\u0586","f"],["\u0556","F"],["\u0587","yev"],["\u10D0","a"],["\u10D1","b"],["\u10D2","g"],["\u10D3","d"],["\u10D4","e"],["\u10D5","v"],["\u10D6","z"],["\u10D7","t"],["\u10D8","i"],["\u10D9","k"],["\u10DA","l"],["\u10DB","m"],["\u10DC","n"],["\u10DD","o"],["\u10DE","p"],["\u10DF","zh"],["\u10E0","r"],["\u10E1","s"],["\u10E2","t"],["\u10E3","u"],["\u10E4","ph"],["\u10E5","q"],["\u10E6","gh"],["\u10E7","k"],["\u10E8","sh"],["\u10E9","ch"],["\u10EA","ts"],["\u10EB","dz"],["\u10EC","ts"],["\u10ED","tch"],["\u10EE","kh"],["\u10EF","j"],["\u10F0","h"],["\u010D","c"],["\u010F","d"],["\u011B","e"],["\u0148","n"],["\u0159","r"],["\u0161","s"],["\u0165","t"],["\u016F","u"],["\u017E","z"],["\u010C","C"],["\u010E","D"],["\u011A","E"],["\u0147","N"],["\u0158","R"],["\u0160","S"],["\u0164","T"],["\u016E","U"],["\u017D","Z"],["\u0780","h"],["\u0781","sh"],["\u0782","n"],["\u0783","r"],["\u0784","b"],["\u0785","lh"],["\u0786","k"],["\u0787","a"],["\u0788","v"],["\u0789","m"],["\u078A","f"],["\u078B","dh"],["\u078C","th"],["\u078D","l"],["\u078E","g"],["\u078F","gn"],["\u0790","s"],["\u0791","d"],["\u0792","z"],["\u0793","t"],["\u0794","y"],["\u0795","p"],["\u0796","j"],["\u0797","ch"],["\u0798","tt"],["\u0799","hh"],["\u079A","kh"],["\u079B","th"],["\u079C","z"],["\u079D","sh"],["\u079E","s"],["\u079F","d"],["\u07A0","t"],["\u07A1","z"],["\u07A2","a"],["\u07A3","gh"],["\u07A4","q"],["\u07A5","w"],["\u07A6","a"],["\u07A7","aa"],["\u07A8","i"],["\u07A9","ee"],["\u07AA","u"],["\u07AB","oo"],["\u07AC","e"],["\u07AD","ey"],["\u07AE","o"],["\u07AF","oa"],["\u07B0",""],["\u03B1","a"],["\u03B2","v"],["\u03B3","g"],["\u03B4","d"],["\u03B5","e"],["\u03B6","z"],["\u03B7","i"],["\u03B8","th"],["\u03B9","i"],["\u03BA","k"],["\u03BB","l"],["\u03BC","m"],["\u03BD","n"],["\u03BE","ks"],["\u03BF","o"],["\u03C0","p"],["\u03C1","r"],["\u03C3","s"],["\u03C4","t"],["\u03C5","y"],["\u03C6","f"],["\u03C7","x"],["\u03C8","ps"],["\u03C9","o"],["\u03AC","a"],["\u03AD","e"],["\u03AF","i"],["\u03CC","o"],["\u03CD","y"],["\u03AE","i"],["\u03CE","o"],["\u03C2","s"],["\u03CA","i"],["\u03B0","y"],["\u03CB","y"],["\u0390","i"],["\u0391","A"],["\u0392","B"],["\u0393","G"],["\u0394","D"],["\u0395","E"],["\u0396","Z"],["\u0397","I"],["\u0398","TH"],["\u0399","I"],["\u039A","K"],["\u039B","L"],["\u039C","M"],["\u039D","N"],["\u039E","KS"],["\u039F","O"],["\u03A0","P"],["\u03A1","R"],["\u03A3","S"],["\u03A4","T"],["\u03A5","Y"],["\u03A6","F"],["\u03A7","X"],["\u03A8","PS"],["\u03A9","O"],["\u0386","A"],["\u0388","E"],["\u038A","I"],["\u038C","O"],["\u038E","Y"],["\u0389","I"],["\u038F","O"],["\u03AA","I"],["\u03AB","Y"],["\u0101","a"],["\u0113","e"],["\u0123","g"],["\u012B","i"],["\u0137","k"],["\u013C","l"],["\u0146","n"],["\u016B","u"],["\u0100","A"],["\u0112","E"],["\u0122","G"],["\u012A","I"],["\u0136","K"],["\u013B","L"],["\u0145","N"],["\u016A","U"],["\u010D","c"],["\u0161","s"],["\u017E","z"],["\u010C","C"],["\u0160","S"],["\u017D","Z"],["\u0105","a"],["\u010D","c"],["\u0119","e"],["\u0117","e"],["\u012F","i"],["\u0161","s"],["\u0173","u"],["\u016B","u"],["\u017E","z"],["\u0104","A"],["\u010C","C"],["\u0118","E"],["\u0116","E"],["\u012E","I"],["\u0160","S"],["\u0172","U"],["\u016A","U"],["\u040C","Kj"],["\u045C","kj"],["\u0409","Lj"],["\u0459","lj"],["\u040A","Nj"],["\u045A","nj"],["\u0422\u0441","Ts"],["\u0442\u0441","ts"],["\u0105","a"],["\u0107","c"],["\u0119","e"],["\u0142","l"],["\u0144","n"],["\u015B","s"],["\u017A","z"],["\u017C","z"],["\u0104","A"],["\u0106","C"],["\u0118","E"],["\u0141","L"],["\u0143","N"],["\u015A","S"],["\u0179","Z"],["\u017B","Z"],["\u0404","Ye"],["\u0406","I"],["\u0407","Yi"],["\u0490","G"],["\u0454","ye"],["\u0456","i"],["\u0457","yi"],["\u0491","g"],["\u0132","IJ"],["\u0133","ij"],["\xA2","c"],["\xA5","Y"],["\u07FF","b"],["\u09F3","t"],["\u0AF1","Bo"],["\u0E3F","B"],["\u20A0","CE"],["\u20A1","C"],["\u20A2","Cr"],["\u20A3","F"],["\u20A5","m"],["\u20A6","N"],["\u20A7","Pt"],["\u20A8","Rs"],["\u20A9","W"],["\u20AB","s"],["\u20AC","E"],["\u20AD","K"],["\u20AE","T"],["\u20AF","Dp"],["\u20B0","S"],["\u20B1","P"],["\u20B2","G"],["\u20B3","A"],["\u20B4","S"],["\u20B5","C"],["\u20B6","tt"],["\u20B7","S"],["\u20B8","T"],["\u20B9","R"],["\u20BA","L"],["\u20BD","P"],["\u20BF","B"],["\uFE69","$"],["\uFFE0","c"],["\uFFE5","Y"],["\uFFE6","W"],["\u{1D400}","A"],["\u{1D401}","B"],["\u{1D402}","C"],["\u{1D403}","D"],["\u{1D404}","E"],["\u{1D405}","F"],["\u{1D406}","G"],["\u{1D407}","H"],["\u{1D408}","I"],["\u{1D409}","J"],["\u{1D40A}","K"],["\u{1D40B}","L"],["\u{1D40C}","M"],["\u{1D40D}","N"],["\u{1D40E}","O"],["\u{1D40F}","P"],["\u{1D410}","Q"],["\u{1D411}","R"],["\u{1D412}","S"],["\u{1D413}","T"],["\u{1D414}","U"],["\u{1D415}","V"],["\u{1D416}","W"],["\u{1D417}","X"],["\u{1D418}","Y"],["\u{1D419}","Z"],["\u{1D41A}","a"],["\u{1D41B}","b"],["\u{1D41C}","c"],["\u{1D41D}","d"],["\u{1D41E}","e"],["\u{1D41F}","f"],["\u{1D420}","g"],["\u{1D421}","h"],["\u{1D422}","i"],["\u{1D423}","j"],["\u{1D424}","k"],["\u{1D425}","l"],["\u{1D426}","m"],["\u{1D427}","n"],["\u{1D428}","o"],["\u{1D429}","p"],["\u{1D42A}","q"],["\u{1D42B}","r"],["\u{1D42C}","s"],["\u{1D42D}","t"],["\u{1D42E}","u"],["\u{1D42F}","v"],["\u{1D430}","w"],["\u{1D431}","x"],["\u{1D432}","y"],["\u{1D433}","z"],["\u{1D434}","A"],["\u{1D435}","B"],["\u{1D436}","C"],["\u{1D437}","D"],["\u{1D438}","E"],["\u{1D439}","F"],["\u{1D43A}","G"],["\u{1D43B}","H"],["\u{1D43C}","I"],["\u{1D43D}","J"],["\u{1D43E}","K"],["\u{1D43F}","L"],["\u{1D440}","M"],["\u{1D441}","N"],["\u{1D442}","O"],["\u{1D443}","P"],["\u{1D444}","Q"],["\u{1D445}","R"],["\u{1D446}","S"],["\u{1D447}","T"],["\u{1D448}","U"],["\u{1D449}","V"],["\u{1D44A}","W"],["\u{1D44B}","X"],["\u{1D44C}","Y"],["\u{1D44D}","Z"],["\u{1D44E}","a"],["\u{1D44F}","b"],["\u{1D450}","c"],["\u{1D451}","d"],["\u{1D452}","e"],["\u{1D453}","f"],["\u{1D454}","g"],["\u{1D456}","i"],["\u{1D457}","j"],["\u{1D458}","k"],["\u{1D459}","l"],["\u{1D45A}","m"],["\u{1D45B}","n"],["\u{1D45C}","o"],["\u{1D45D}","p"],["\u{1D45E}","q"],["\u{1D45F}","r"],["\u{1D460}","s"],["\u{1D461}","t"],["\u{1D462}","u"],["\u{1D463}","v"],["\u{1D464}","w"],["\u{1D465}","x"],["\u{1D466}","y"],["\u{1D467}","z"],["\u{1D468}","A"],["\u{1D469}","B"],["\u{1D46A}","C"],["\u{1D46B}","D"],["\u{1D46C}","E"],["\u{1D46D}","F"],["\u{1D46E}","G"],["\u{1D46F}","H"],["\u{1D470}","I"],["\u{1D471}","J"],["\u{1D472}","K"],["\u{1D473}","L"],["\u{1D474}","M"],["\u{1D475}","N"],["\u{1D476}","O"],["\u{1D477}","P"],["\u{1D478}","Q"],["\u{1D479}","R"],["\u{1D47A}","S"],["\u{1D47B}","T"],["\u{1D47C}","U"],["\u{1D47D}","V"],["\u{1D47E}","W"],["\u{1D47F}","X"],["\u{1D480}","Y"],["\u{1D481}","Z"],["\u{1D482}","a"],["\u{1D483}","b"],["\u{1D484}","c"],["\u{1D485}","d"],["\u{1D486}","e"],["\u{1D487}","f"],["\u{1D488}","g"],["\u{1D489}","h"],["\u{1D48A}","i"],["\u{1D48B}","j"],["\u{1D48C}","k"],["\u{1D48D}","l"],["\u{1D48E}","m"],["\u{1D48F}","n"],["\u{1D490}","o"],["\u{1D491}","p"],["\u{1D492}","q"],["\u{1D493}","r"],["\u{1D494}","s"],["\u{1D495}","t"],["\u{1D496}","u"],["\u{1D497}","v"],["\u{1D498}","w"],["\u{1D499}","x"],["\u{1D49A}","y"],["\u{1D49B}","z"],["\u{1D49C}","A"],["\u{1D49E}","C"],["\u{1D49F}","D"],["\u{1D4A2}","g"],["\u{1D4A5}","J"],["\u{1D4A6}","K"],["\u{1D4A9}","N"],["\u{1D4AA}","O"],["\u{1D4AB}","P"],["\u{1D4AC}","Q"],["\u{1D4AE}","S"],["\u{1D4AF}","T"],["\u{1D4B0}","U"],["\u{1D4B1}","V"],["\u{1D4B2}","W"],["\u{1D4B3}","X"],["\u{1D4B4}","Y"],["\u{1D4B5}","Z"],["\u{1D4B6}","a"],["\u{1D4B7}","b"],["\u{1D4B8}","c"],["\u{1D4B9}","d"],["\u{1D4BB}","f"],["\u{1D4BD}","h"],["\u{1D4BE}","i"],["\u{1D4BF}","j"],["\u{1D4C0}","k"],["\u{1D4C1}","l"],["\u{1D4C2}","m"],["\u{1D4C3}","n"],["\u{1D4C5}","p"],["\u{1D4C6}","q"],["\u{1D4C7}","r"],["\u{1D4C8}","s"],["\u{1D4C9}","t"],["\u{1D4CA}","u"],["\u{1D4CB}","v"],["\u{1D4CC}","w"],["\u{1D4CD}","x"],["\u{1D4CE}","y"],["\u{1D4CF}","z"],["\u{1D4D0}","A"],["\u{1D4D1}","B"],["\u{1D4D2}","C"],["\u{1D4D3}","D"],["\u{1D4D4}","E"],["\u{1D4D5}","F"],["\u{1D4D6}","G"],["\u{1D4D7}","H"],["\u{1D4D8}","I"],["\u{1D4D9}","J"],["\u{1D4DA}","K"],["\u{1D4DB}","L"],["\u{1D4DC}","M"],["\u{1D4DD}","N"],["\u{1D4DE}","O"],["\u{1D4DF}","P"],["\u{1D4E0}","Q"],["\u{1D4E1}","R"],["\u{1D4E2}","S"],["\u{1D4E3}","T"],["\u{1D4E4}","U"],["\u{1D4E5}","V"],["\u{1D4E6}","W"],["\u{1D4E7}","X"],["\u{1D4E8}","Y"],["\u{1D4E9}","Z"],["\u{1D4EA}","a"],["\u{1D4EB}","b"],["\u{1D4EC}","c"],["\u{1D4ED}","d"],["\u{1D4EE}","e"],["\u{1D4EF}","f"],["\u{1D4F0}","g"],["\u{1D4F1}","h"],["\u{1D4F2}","i"],["\u{1D4F3}","j"],["\u{1D4F4}","k"],["\u{1D4F5}","l"],["\u{1D4F6}","m"],["\u{1D4F7}","n"],["\u{1D4F8}","o"],["\u{1D4F9}","p"],["\u{1D4FA}","q"],["\u{1D4FB}","r"],["\u{1D4FC}","s"],["\u{1D4FD}","t"],["\u{1D4FE}","u"],["\u{1D4FF}","v"],["\u{1D500}","w"],["\u{1D501}","x"],["\u{1D502}","y"],["\u{1D503}","z"],["\u{1D504}","A"],["\u{1D505}","B"],["\u{1D507}","D"],["\u{1D508}","E"],["\u{1D509}","F"],["\u{1D50A}","G"],["\u{1D50D}","J"],["\u{1D50E}","K"],["\u{1D50F}","L"],["\u{1D510}","M"],["\u{1D511}","N"],["\u{1D512}","O"],["\u{1D513}","P"],["\u{1D514}","Q"],["\u{1D516}","S"],["\u{1D517}","T"],["\u{1D518}","U"],["\u{1D519}","V"],["\u{1D51A}","W"],["\u{1D51B}","X"],["\u{1D51C}","Y"],["\u{1D51E}","a"],["\u{1D51F}","b"],["\u{1D520}","c"],["\u{1D521}","d"],["\u{1D522}","e"],["\u{1D523}","f"],["\u{1D524}","g"],["\u{1D525}","h"],["\u{1D526}","i"],["\u{1D527}","j"],["\u{1D528}","k"],["\u{1D529}","l"],["\u{1D52A}","m"],["\u{1D52B}","n"],["\u{1D52C}","o"],["\u{1D52D}","p"],["\u{1D52E}","q"],["\u{1D52F}","r"],["\u{1D530}","s"],["\u{1D531}","t"],["\u{1D532}","u"],["\u{1D533}","v"],["\u{1D534}","w"],["\u{1D535}","x"],["\u{1D536}","y"],["\u{1D537}","z"],["\u{1D538}","A"],["\u{1D539}","B"],["\u{1D53B}","D"],["\u{1D53C}","E"],["\u{1D53D}","F"],["\u{1D53E}","G"],["\u{1D540}","I"],["\u{1D541}","J"],["\u{1D542}","K"],["\u{1D543}","L"],["\u{1D544}","M"],["\u{1D546}","O"],["\u{1D54A}","S"],["\u{1D54B}","T"],["\u{1D54C}","U"],["\u{1D54D}","V"],["\u{1D54E}","W"],["\u{1D54F}","X"],["\u{1D550}","Y"],["\u{1D552}","a"],["\u{1D553}","b"],["\u{1D554}","c"],["\u{1D555}","d"],["\u{1D556}","e"],["\u{1D557}","f"],["\u{1D558}","g"],["\u{1D559}","h"],["\u{1D55A}","i"],["\u{1D55B}","j"],["\u{1D55C}","k"],["\u{1D55D}","l"],["\u{1D55E}","m"],["\u{1D55F}","n"],["\u{1D560}","o"],["\u{1D561}","p"],["\u{1D562}","q"],["\u{1D563}","r"],["\u{1D564}","s"],["\u{1D565}","t"],["\u{1D566}","u"],["\u{1D567}","v"],["\u{1D568}","w"],["\u{1D569}","x"],["\u{1D56A}","y"],["\u{1D56B}","z"],["\u{1D56C}","A"],["\u{1D56D}","B"],["\u{1D56E}","C"],["\u{1D56F}","D"],["\u{1D570}","E"],["\u{1D571}","F"],["\u{1D572}","G"],["\u{1D573}","H"],["\u{1D574}","I"],["\u{1D575}","J"],["\u{1D576}","K"],["\u{1D577}","L"],["\u{1D578}","M"],["\u{1D579}","N"],["\u{1D57A}","O"],["\u{1D57B}","P"],["\u{1D57C}","Q"],["\u{1D57D}","R"],["\u{1D57E}","S"],["\u{1D57F}","T"],["\u{1D580}","U"],["\u{1D581}","V"],["\u{1D582}","W"],["\u{1D583}","X"],["\u{1D584}","Y"],["\u{1D585}","Z"],["\u{1D586}","a"],["\u{1D587}","b"],["\u{1D588}","c"],["\u{1D589}","d"],["\u{1D58A}","e"],["\u{1D58B}","f"],["\u{1D58C}","g"],["\u{1D58D}","h"],["\u{1D58E}","i"],["\u{1D58F}","j"],["\u{1D590}","k"],["\u{1D591}","l"],["\u{1D592}","m"],["\u{1D593}","n"],["\u{1D594}","o"],["\u{1D595}","p"],["\u{1D596}","q"],["\u{1D597}","r"],["\u{1D598}","s"],["\u{1D599}","t"],["\u{1D59A}","u"],["\u{1D59B}","v"],["\u{1D59C}","w"],["\u{1D59D}","x"],["\u{1D59E}","y"],["\u{1D59F}","z"],["\u{1D5A0}","A"],["\u{1D5A1}","B"],["\u{1D5A2}","C"],["\u{1D5A3}","D"],["\u{1D5A4}","E"],["\u{1D5A5}","F"],["\u{1D5A6}","G"],["\u{1D5A7}","H"],["\u{1D5A8}","I"],["\u{1D5A9}","J"],["\u{1D5AA}","K"],["\u{1D5AB}","L"],["\u{1D5AC}","M"],["\u{1D5AD}","N"],["\u{1D5AE}","O"],["\u{1D5AF}","P"],["\u{1D5B0}","Q"],["\u{1D5B1}","R"],["\u{1D5B2}","S"],["\u{1D5B3}","T"],["\u{1D5B4}","U"],["\u{1D5B5}","V"],["\u{1D5B6}","W"],["\u{1D5B7}","X"],["\u{1D5B8}","Y"],["\u{1D5B9}","Z"],["\u{1D5BA}","a"],["\u{1D5BB}","b"],["\u{1D5BC}","c"],["\u{1D5BD}","d"],["\u{1D5BE}","e"],["\u{1D5BF}","f"],["\u{1D5C0}","g"],["\u{1D5C1}","h"],["\u{1D5C2}","i"],["\u{1D5C3}","j"],["\u{1D5C4}","k"],["\u{1D5C5}","l"],["\u{1D5C6}","m"],["\u{1D5C7}","n"],["\u{1D5C8}","o"],["\u{1D5C9}","p"],["\u{1D5CA}","q"],["\u{1D5CB}","r"],["\u{1D5CC}","s"],["\u{1D5CD}","t"],["\u{1D5CE}","u"],["\u{1D5CF}","v"],["\u{1D5D0}","w"],["\u{1D5D1}","x"],["\u{1D5D2}","y"],["\u{1D5D3}","z"],["\u{1D5D4}","A"],["\u{1D5D5}","B"],["\u{1D5D6}","C"],["\u{1D5D7}","D"],["\u{1D5D8}","E"],["\u{1D5D9}","F"],["\u{1D5DA}","G"],["\u{1D5DB}","H"],["\u{1D5DC}","I"],["\u{1D5DD}","J"],["\u{1D5DE}","K"],["\u{1D5DF}","L"],["\u{1D5E0}","M"],["\u{1D5E1}","N"],["\u{1D5E2}","O"],["\u{1D5E3}","P"],["\u{1D5E4}","Q"],["\u{1D5E5}","R"],["\u{1D5E6}","S"],["\u{1D5E7}","T"],["\u{1D5E8}","U"],["\u{1D5E9}","V"],["\u{1D5EA}","W"],["\u{1D5EB}","X"],["\u{1D5EC}","Y"],["\u{1D5ED}","Z"],["\u{1D5EE}","a"],["\u{1D5EF}","b"],["\u{1D5F0}","c"],["\u{1D5F1}","d"],["\u{1D5F2}","e"],["\u{1D5F3}","f"],["\u{1D5F4}","g"],["\u{1D5F5}","h"],["\u{1D5F6}","i"],["\u{1D5F7}","j"],["\u{1D5F8}","k"],["\u{1D5F9}","l"],["\u{1D5FA}","m"],["\u{1D5FB}","n"],["\u{1D5FC}","o"],["\u{1D5FD}","p"],["\u{1D5FE}","q"],["\u{1D5FF}","r"],["\u{1D600}","s"],["\u{1D601}","t"],["\u{1D602}","u"],["\u{1D603}","v"],["\u{1D604}","w"],["\u{1D605}","x"],["\u{1D606}","y"],["\u{1D607}","z"],["\u{1D608}","A"],["\u{1D609}","B"],["\u{1D60A}","C"],["\u{1D60B}","D"],["\u{1D60C}","E"],["\u{1D60D}","F"],["\u{1D60E}","G"],["\u{1D60F}","H"],["\u{1D610}","I"],["\u{1D611}","J"],["\u{1D612}","K"],["\u{1D613}","L"],["\u{1D614}","M"],["\u{1D615}","N"],["\u{1D616}","O"],["\u{1D617}","P"],["\u{1D618}","Q"],["\u{1D619}","R"],["\u{1D61A}","S"],["\u{1D61B}","T"],["\u{1D61C}","U"],["\u{1D61D}","V"],["\u{1D61E}","W"],["\u{1D61F}","X"],["\u{1D620}","Y"],["\u{1D621}","Z"],["\u{1D622}","a"],["\u{1D623}","b"],["\u{1D624}","c"],["\u{1D625}","d"],["\u{1D626}","e"],["\u{1D627}","f"],["\u{1D628}","g"],["\u{1D629}","h"],["\u{1D62A}","i"],["\u{1D62B}","j"],["\u{1D62C}","k"],["\u{1D62D}","l"],["\u{1D62E}","m"],["\u{1D62F}","n"],["\u{1D630}","o"],["\u{1D631}","p"],["\u{1D632}","q"],["\u{1D633}","r"],["\u{1D634}","s"],["\u{1D635}","t"],["\u{1D636}","u"],["\u{1D637}","v"],["\u{1D638}","w"],["\u{1D639}","x"],["\u{1D63A}","y"],["\u{1D63B}","z"],["\u{1D63C}","A"],["\u{1D63D}","B"],["\u{1D63E}","C"],["\u{1D63F}","D"],["\u{1D640}","E"],["\u{1D641}","F"],["\u{1D642}","G"],["\u{1D643}","H"],["\u{1D644}","I"],["\u{1D645}","J"],["\u{1D646}","K"],["\u{1D647}","L"],["\u{1D648}","M"],["\u{1D649}","N"],["\u{1D64A}","O"],["\u{1D64B}","P"],["\u{1D64C}","Q"],["\u{1D64D}","R"],["\u{1D64E}","S"],["\u{1D64F}","T"],["\u{1D650}","U"],["\u{1D651}","V"],["\u{1D652}","W"],["\u{1D653}","X"],["\u{1D654}","Y"],["\u{1D655}","Z"],["\u{1D656}","a"],["\u{1D657}","b"],["\u{1D658}","c"],["\u{1D659}","d"],["\u{1D65A}","e"],["\u{1D65B}","f"],["\u{1D65C}","g"],["\u{1D65D}","h"],["\u{1D65E}","i"],["\u{1D65F}","j"],["\u{1D660}","k"],["\u{1D661}","l"],["\u{1D662}","m"],["\u{1D663}","n"],["\u{1D664}","o"],["\u{1D665}","p"],["\u{1D666}","q"],["\u{1D667}","r"],["\u{1D668}","s"],["\u{1D669}","t"],["\u{1D66A}","u"],["\u{1D66B}","v"],["\u{1D66C}","w"],["\u{1D66D}","x"],["\u{1D66E}","y"],["\u{1D66F}","z"],["\u{1D670}","A"],["\u{1D671}","B"],["\u{1D672}","C"],["\u{1D673}","D"],["\u{1D674}","E"],["\u{1D675}","F"],["\u{1D676}","G"],["\u{1D677}","H"],["\u{1D678}","I"],["\u{1D679}","J"],["\u{1D67A}","K"],["\u{1D67B}","L"],["\u{1D67C}","M"],["\u{1D67D}","N"],["\u{1D67E}","O"],["\u{1D67F}","P"],["\u{1D680}","Q"],["\u{1D681}","R"],["\u{1D682}","S"],["\u{1D683}","T"],["\u{1D684}","U"],["\u{1D685}","V"],["\u{1D686}","W"],["\u{1D687}","X"],["\u{1D688}","Y"],["\u{1D689}","Z"],["\u{1D68A}","a"],["\u{1D68B}","b"],["\u{1D68C}","c"],["\u{1D68D}","d"],["\u{1D68E}","e"],["\u{1D68F}","f"],["\u{1D690}","g"],["\u{1D691}","h"],["\u{1D692}","i"],["\u{1D693}","j"],["\u{1D694}","k"],["\u{1D695}","l"],["\u{1D696}","m"],["\u{1D697}","n"],["\u{1D698}","o"],["\u{1D699}","p"],["\u{1D69A}","q"],["\u{1D69B}","r"],["\u{1D69C}","s"],["\u{1D69D}","t"],["\u{1D69E}","u"],["\u{1D69F}","v"],["\u{1D6A0}","w"],["\u{1D6A1}","x"],["\u{1D6A2}","y"],["\u{1D6A3}","z"],["\u{1D6A4}","l"],["\u{1D6A5}","j"],["\u{1D6E2}","A"],["\u{1D6E3}","B"],["\u{1D6E4}","G"],["\u{1D6E5}","D"],["\u{1D6E6}","E"],["\u{1D6E7}","Z"],["\u{1D6E8}","I"],["\u{1D6E9}","TH"],["\u{1D6EA}","I"],["\u{1D6EB}","K"],["\u{1D6EC}","L"],["\u{1D6ED}","M"],["\u{1D6EE}","N"],["\u{1D6EF}","KS"],["\u{1D6F0}","O"],["\u{1D6F1}","P"],["\u{1D6F2}","R"],["\u{1D6F3}","TH"],["\u{1D6F4}","S"],["\u{1D6F5}","T"],["\u{1D6F6}","Y"],["\u{1D6F7}","F"],["\u{1D6F8}","x"],["\u{1D6F9}","PS"],["\u{1D6FA}","O"],["\u{1D6FB}","D"],["\u{1D6FC}","a"],["\u{1D6FD}","b"],["\u{1D6FE}","g"],["\u{1D6FF}","d"],["\u{1D700}","e"],["\u{1D701}","z"],["\u{1D702}","i"],["\u{1D703}","th"],["\u{1D704}","i"],["\u{1D705}","k"],["\u{1D706}","l"],["\u{1D707}","m"],["\u{1D708}","n"],["\u{1D709}","ks"],["\u{1D70A}","o"],["\u{1D70B}","p"],["\u{1D70C}","r"],["\u{1D70D}","s"],["\u{1D70E}","s"],["\u{1D70F}","t"],["\u{1D710}","y"],["\u{1D711}","f"],["\u{1D712}","x"],["\u{1D713}","ps"],["\u{1D714}","o"],["\u{1D715}","d"],["\u{1D716}","E"],["\u{1D717}","TH"],["\u{1D718}","K"],["\u{1D719}","f"],["\u{1D71A}","r"],["\u{1D71B}","p"],["\u{1D71C}","A"],["\u{1D71D}","V"],["\u{1D71E}","G"],["\u{1D71F}","D"],["\u{1D720}","E"],["\u{1D721}","Z"],["\u{1D722}","I"],["\u{1D723}","TH"],["\u{1D724}","I"],["\u{1D725}","K"],["\u{1D726}","L"],["\u{1D727}","M"],["\u{1D728}","N"],["\u{1D729}","KS"],["\u{1D72A}","O"],["\u{1D72B}","P"],["\u{1D72C}","S"],["\u{1D72D}","TH"],["\u{1D72E}","S"],["\u{1D72F}","T"],["\u{1D730}","Y"],["\u{1D731}","F"],["\u{1D732}","X"],["\u{1D733}","PS"],["\u{1D734}","O"],["\u{1D735}","D"],["\u{1D736}","a"],["\u{1D737}","v"],["\u{1D738}","g"],["\u{1D739}","d"],["\u{1D73A}","e"],["\u{1D73B}","z"],["\u{1D73C}","i"],["\u{1D73D}","th"],["\u{1D73E}","i"],["\u{1D73F}","k"],["\u{1D740}","l"],["\u{1D741}","m"],["\u{1D742}","n"],["\u{1D743}","ks"],["\u{1D744}","o"],["\u{1D745}","p"],["\u{1D746}","r"],["\u{1D747}","s"],["\u{1D748}","s"],["\u{1D749}","t"],["\u{1D74A}","y"],["\u{1D74B}","f"],["\u{1D74C}","x"],["\u{1D74D}","ps"],["\u{1D74E}","o"],["\u{1D74F}","a"],["\u{1D750}","e"],["\u{1D751}","i"],["\u{1D752}","k"],["\u{1D753}","f"],["\u{1D754}","r"],["\u{1D755}","p"],["\u{1D756}","A"],["\u{1D757}","B"],["\u{1D758}","G"],["\u{1D759}","D"],["\u{1D75A}","E"],["\u{1D75B}","Z"],["\u{1D75C}","I"],["\u{1D75D}","TH"],["\u{1D75E}","I"],["\u{1D75F}","K"],["\u{1D760}","L"],["\u{1D761}","M"],["\u{1D762}","N"],["\u{1D763}","KS"],["\u{1D764}","O"],["\u{1D765}","P"],["\u{1D766}","R"],["\u{1D767}","TH"],["\u{1D768}","S"],["\u{1D769}","T"],["\u{1D76A}","Y"],["\u{1D76B}","F"],["\u{1D76C}","X"],["\u{1D76D}","PS"],["\u{1D76E}","O"],["\u{1D76F}","D"],["\u{1D770}","a"],["\u{1D771}","v"],["\u{1D772}","g"],["\u{1D773}","d"],["\u{1D774}","e"],["\u{1D775}","z"],["\u{1D776}","i"],["\u{1D777}","th"],["\u{1D778}","i"],["\u{1D779}","k"],["\u{1D77A}","l"],["\u{1D77B}","m"],["\u{1D77C}","n"],["\u{1D77D}","ks"],["\u{1D77E}","o"],["\u{1D77F}","p"],["\u{1D780}","r"],["\u{1D781}","s"],["\u{1D782}","s"],["\u{1D783}","t"],["\u{1D784}","y"],["\u{1D785}","f"],["\u{1D786}","x"],["\u{1D787}","ps"],["\u{1D788}","o"],["\u{1D789}","a"],["\u{1D78A}","e"],["\u{1D78B}","i"],["\u{1D78C}","k"],["\u{1D78D}","f"],["\u{1D78E}","r"],["\u{1D78F}","p"],["\u{1D790}","A"],["\u{1D791}","V"],["\u{1D792}","G"],["\u{1D793}","D"],["\u{1D794}","E"],["\u{1D795}","Z"],["\u{1D796}","I"],["\u{1D797}","TH"],["\u{1D798}","I"],["\u{1D799}","K"],["\u{1D79A}","L"],["\u{1D79B}","M"],["\u{1D79C}","N"],["\u{1D79D}","KS"],["\u{1D79E}","O"],["\u{1D79F}","P"],["\u{1D7A0}","S"],["\u{1D7A1}","TH"],["\u{1D7A2}","S"],["\u{1D7A3}","T"],["\u{1D7A4}","Y"],["\u{1D7A5}","F"],["\u{1D7A6}","X"],["\u{1D7A7}","PS"],["\u{1D7A8}","O"],["\u{1D7A9}","D"],["\u{1D7AA}","av"],["\u{1D7AB}","g"],["\u{1D7AC}","d"],["\u{1D7AD}","e"],["\u{1D7AE}","z"],["\u{1D7AF}","i"],["\u{1D7B0}","i"],["\u{1D7B1}","th"],["\u{1D7B2}","i"],["\u{1D7B3}","k"],["\u{1D7B4}","l"],["\u{1D7B5}","m"],["\u{1D7B6}","n"],["\u{1D7B7}","ks"],["\u{1D7B8}","o"],["\u{1D7B9}","p"],["\u{1D7BA}","r"],["\u{1D7BB}","s"],["\u{1D7BC}","s"],["\u{1D7BD}","t"],["\u{1D7BE}","y"],["\u{1D7BF}","f"],["\u{1D7C0}","x"],["\u{1D7C1}","ps"],["\u{1D7C2}","o"],["\u{1D7C3}","a"],["\u{1D7C4}","e"],["\u{1D7C5}","i"],["\u{1D7C6}","k"],["\u{1D7C7}","f"],["\u{1D7C8}","r"],["\u{1D7C9}","p"],["\u{1D7CA}","F"],["\u{1D7CB}","f"],["\u249C","(a)"],["\u249D","(b)"],["\u249E","(c)"],["\u249F","(d)"],["\u24A0","(e)"],["\u24A1","(f)"],["\u24A2","(g)"],["\u24A3","(h)"],["\u24A4","(i)"],["\u24A5","(j)"],["\u24A6","(k)"],["\u24A7","(l)"],["\u24A8","(m)"],["\u24A9","(n)"],["\u24AA","(o)"],["\u24AB","(p)"],["\u24AC","(q)"],["\u24AD","(r)"],["\u24AE","(s)"],["\u24AF","(t)"],["\u24B0","(u)"],["\u24B1","(v)"],["\u24B2","(w)"],["\u24B3","(x)"],["\u24B4","(y)"],["\u24B5","(z)"],["\u24B6","(A)"],["\u24B7","(B)"],["\u24B8","(C)"],["\u24B9","(D)"],["\u24BA","(E)"],["\u24BB","(F)"],["\u24BC","(G)"],["\u24BD","(H)"],["\u24BE","(I)"],["\u24BF","(J)"],["\u24C0","(K)"],["\u24C1","(L)"],["\u24C3","(N)"],["\u24C4","(O)"],["\u24C5","(P)"],["\u24C6","(Q)"],["\u24C7","(R)"],["\u24C8","(S)"],["\u24C9","(T)"],["\u24CA","(U)"],["\u24CB","(V)"],["\u24CC","(W)"],["\u24CD","(X)"],["\u24CE","(Y)"],["\u24CF","(Z)"],["\u24D0","(a)"],["\u24D1","(b)"],["\u24D2","(c)"],["\u24D3","(d)"],["\u24D4","(e)"],["\u24D5","(f)"],["\u24D6","(g)"],["\u24D7","(h)"],["\u24D8","(i)"],["\u24D9","(j)"],["\u24DA","(k)"],["\u24DB","(l)"],["\u24DC","(m)"],["\u24DD","(n)"],["\u24DE","(o)"],["\u24DF","(p)"],["\u24E0","(q)"],["\u24E1","(r)"],["\u24E2","(s)"],["\u24E3","(t)"],["\u24E4","(u)"],["\u24E5","(v)"],["\u24E6","(w)"],["\u24E7","(x)"],["\u24E8","(y)"],["\u24E9","(z)"],["\u010A","C"],["\u010B","c"],["\u0120","G"],["\u0121","g"],["\u0126","H"],["\u0127","h"],["\u017B","Z"],["\u017C","z"],["\u{1D7CE}","0"],["\u{1D7CF}","1"],["\u{1D7D0}","2"],["\u{1D7D1}","3"],["\u{1D7D2}","4"],["\u{1D7D3}","5"],["\u{1D7D4}","6"],["\u{1D7D5}","7"],["\u{1D7D6}","8"],["\u{1D7D7}","9"],["\u{1D7D8}","0"],["\u{1D7D9}","1"],["\u{1D7DA}","2"],["\u{1D7DB}","3"],["\u{1D7DC}","4"],["\u{1D7DD}","5"],["\u{1D7DE}","6"],["\u{1D7DF}","7"],["\u{1D7E0}","8"],["\u{1D7E1}","9"],["\u{1D7E2}","0"],["\u{1D7E3}","1"],["\u{1D7E4}","2"],["\u{1D7E5}","3"],["\u{1D7E6}","4"],["\u{1D7E7}","5"],["\u{1D7E8}","6"],["\u{1D7E9}","7"],["\u{1D7EA}","8"],["\u{1D7EB}","9"],["\u{1D7EC}","0"],["\u{1D7ED}","1"],["\u{1D7EE}","2"],["\u{1D7EF}","3"],["\u{1D7F0}","4"],["\u{1D7F1}","5"],["\u{1D7F2}","6"],["\u{1D7F3}","7"],["\u{1D7F4}","8"],["\u{1D7F5}","9"],["\u{1D7F6}","0"],["\u{1D7F7}","1"],["\u{1D7F8}","2"],["\u{1D7F9}","3"],["\u{1D7FA}","4"],["\u{1D7FB}","5"],["\u{1D7FC}","6"],["\u{1D7FD}","7"],["\u{1D7FE}","8"],["\u{1D7FF}","9"],["\u2460","1"],["\u2461","2"],["\u2462","3"],["\u2463","4"],["\u2464","5"],["\u2465","6"],["\u2466","7"],["\u2467","8"],["\u2468","9"],["\u2469","10"],["\u246A","11"],["\u246B","12"],["\u246C","13"],["\u246D","14"],["\u246E","15"],["\u246F","16"],["\u2470","17"],["\u2471","18"],["\u2472","19"],["\u2473","20"],["\u2474","1"],["\u2475","2"],["\u2476","3"],["\u2477","4"],["\u2478","5"],["\u2479","6"],["\u247A","7"],["\u247B","8"],["\u247C","9"],["\u247D","10"],["\u247E","11"],["\u247F","12"],["\u2480","13"],["\u2481","14"],["\u2482","15"],["\u2483","16"],["\u2484","17"],["\u2485","18"],["\u2486","19"],["\u2487","20"],["\u2488","1."],["\u2489","2."],["\u248A","3."],["\u248B","4."],["\u248C","5."],["\u248D","6."],["\u248E","7."],["\u248F","8."],["\u2490","9."],["\u2491","10."],["\u2492","11."],["\u2493","12."],["\u2494","13."],["\u2495","14."],["\u2496","15."],["\u2497","16."],["\u2498","17."],["\u2499","18."],["\u249A","19."],["\u249B","20."],["\u24EA","0"],["\u24EB","11"],["\u24EC","12"],["\u24ED","13"],["\u24EE","14"],["\u24EF","15"],["\u24F0","16"],["\u24F1","17"],["\u24F2","18"],["\u24F3","19"],["\u24F4","20"],["\u24F5","1"],["\u24F6","2"],["\u24F7","3"],["\u24F8","4"],["\u24F9","5"],["\u24FA","6"],["\u24FB","7"],["\u24FC","8"],["\u24FD","9"],["\u24FE","10"],["\u24FF","0"],["\u{1F670}","&"],["\u{1F671}","&"],["\u{1F672}","&"],["\u{1F673}","&"],["\u{1F674}","&"],["\u{1F675}","&"],["\u{1F676}",'"'],["\u{1F677}",'"'],["\u{1F678}",'"'],["\u203D","?!"],["\u{1F679}","?!"],["\u{1F67A}","?!"],["\u{1F67B}","?!"],["\u{1F67C}","/"],["\u{1F67D}","\\"],["\u{1F707}","AR"],["\u{1F708}","V"],["\u{1F709}","V"],["\u{1F706}","VR"],["\u{1F705}","VF"],["\u{1F729}","2"],["\u{1F72A}","5"],["\u{1F761}","f"],["\u{1F762}","W"],["\u{1F763}","U"],["\u{1F767}","V"],["\u{1F768}","T"],["\u{1F76A}","V"],["\u{1F76B}","MB"],["\u{1F76C}","VB"],["\u{1F772}","3B"],["\u{1F773}","3B"],["\u{1F4AF}","100"],["\u{1F519}","BACK"],["\u{1F51A}","END"],["\u{1F51B}","ON!"],["\u{1F51C}","SOON"],["\u{1F51D}","TOP"],["\u{1F51E}","18"],["\u{1F524}","abc"],["\u{1F520}","ABCD"],["\u{1F521}","abcd"],["\u{1F522}","1234"],["\u{1F523}","T&@%"],["#\uFE0F\u20E3","#"],["*\uFE0F\u20E3","*"],["0\uFE0F\u20E3","0"],["1\uFE0F\u20E3","1"],["2\uFE0F\u20E3","2"],["3\uFE0F\u20E3","3"],["4\uFE0F\u20E3","4"],["5\uFE0F\u20E3","5"],["6\uFE0F\u20E3","6"],["7\uFE0F\u20E3","7"],["8\uFE0F\u20E3","8"],["9\uFE0F\u20E3","9"],["\u{1F51F}","10"],["\u{1F170}\uFE0F","A"],["\u{1F171}\uFE0F","B"],["\u{1F18E}","AB"],["\u{1F191}","CL"],["\u{1F17E}\uFE0F","O"],["\u{1F17F}","P"],["\u{1F198}","SOS"],["\u{1F172}","C"],["\u{1F173}","D"],["\u{1F174}","E"],["\u{1F175}","F"],["\u{1F176}","G"],["\u{1F177}","H"],["\u{1F178}","I"],["\u{1F179}","J"],["\u{1F17A}","K"],["\u{1F17B}","L"],["\u{1F17C}","M"],["\u{1F17D}","N"],["\u{1F180}","Q"],["\u{1F181}","R"],["\u{1F182}","S"],["\u{1F183}","T"],["\u{1F184}","U"],["\u{1F185}","V"],["\u{1F186}","W"],["\u{1F187}","X"],["\u{1F188}","Y"],["\u{1F189}","Z"],["\u2212","-"],["\u2053","-"]],x0=new Map(k0),al=x0});var jm,Ti,cl,Fm=v(()=>{jm=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],Ti={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:jm,nb:jm,de:[["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xDF","ss"],["\u1E9E","Ss"]],tr:[["\xE2","a"],["\xC2","A"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"]],hu:[["\u0171","u"],["\u0170","U"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"],["\xE1","a"],["\xC1","A"],["\xE9","e"],["\xC9","E"],["\xED","i"],["\xCD","I"],["\xF3","o"],["\xD3","O"],["\xFA","u"],["\xDA","U"]],sr:[["\u0452","dj"],["\u0402","Dj"],["\u045F","dz"],["\u040F","Dz"],["\u0459","lj"],["\u0409","Lj"],["\u045A","nj"],["\u040A","Nj"],["\u045B","c"],["\u040B","C"],["\u0447","ch"],["\u0427","Ch"],["\u0448","sh"],["\u0428","Sh"],["\u0436","zh"],["\u0416","Zh"]]};for(let r of Object.keys(Ti))Ti[r]=new Map(Ti[r]);cl=Ti});function ll(r,e){if(typeof r!="string")throw new TypeError(`Expected a string, got \`${typeof r}\``);e={customReplacements:[],...e};let t=A0(e.locale),n=al,s=e.customReplacements.length>0||e.customReplacements.size>0;if(t||s){if(n=new Map(al),t)for(let[i,o]of t)n.set(i,o);for(let[i,o]of e.customReplacements)n.set(i,o)}return r=r.normalize(),r=E0(r,n),r=r.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),r=r.replaceAll(/\p{Dash_Punctuation}/gu,"-"),r}var E0,A0,qm=v(()=>{Dm();Fm();E0=(r,e)=>{for(let[t,n]of e)r=r.replaceAll(t,n);return r},A0=r=>{if(!r)return;let e=r.toLowerCase().replace(/^no(-|$)/,"nb$1");return cl[e]||cl[e.split("-")[0]]||void 0}});var T0,Um,Jm=v(()=>{T0=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],Um=T0});function ul(r,e){if(typeof r!="string")throw new TypeError(`Expected a string, got \`${typeof r}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let t=e.preserveLeadingUnderscore&&r.startsWith("_"),n=e.preserveTrailingDash&&r.endsWith("-");if(e.transliterate){let i=new Map([...Um,...e.customReplacements]);r=ll(r,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)r=r.replaceAll(i,o);e.decamelize&&(r=O0(r));let s=C0(e);return e.lowercase&&(r=e.locale?r.toLocaleLowerCase(e.locale):r.toLowerCase()),r=r.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),r=r.replace(s,e.separator),r=r.replaceAll("\\",""),e.separator&&(r=P0(r,e.separator)),t&&(r=`_${r}`),n&&(r=`${r}-`),r}var O0,P0,C0,Km=v(()=>{Bm();qm();Jm();O0=r=>r.replaceAll(/([A-Z]{2,})(\d+)/g,"$1 $2").replaceAll(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").replaceAll(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"),P0=(r,e)=>{let t=Ai(e);return r.replaceAll(new RegExp(`(?:${t}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${t})|(?:${t})$`,"g"),"")},C0=r=>{let e=String.raw`a-z\d`;if(e+=r.lowercase?"":"A-Z",r.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),r.preserveCharacters.length>0)for(let n of r.preserveCharacters){if(n===r.separator)throw new Error(`The separator character \`${r.separator}\` cannot be included in preserved characters: ${r.preserveCharacters}`);e+=Ai(n)}let t=r.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,t)}});function br(r){return ul(r)}var Hm=v(()=>{Km()});var In,dl,Wm=v(()=>{In=` *, *::before, *::after { box-sizing: border-box; }
|
|
166
|
+
`});function Ti(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Fm=v(()=>{});var T0,P0,dl,qm=v(()=>{T0=[["\xDF","ss"],["\u1E9E","Ss"],["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xC0","A"],["\xC1","A"],["\xC2","A"],["\xC3","A"],["\xC4","Ae"],["\xC5","A"],["\xC6","AE"],["\xC7","C"],["\xC8","E"],["\xC9","E"],["\xCA","E"],["\xCB","E"],["\u018F","A"],["\xCC","I"],["\xCD","I"],["\xCE","I"],["\xCF","I"],["\xD0","D"],["\xD1","N"],["\xD2","O"],["\xD3","O"],["\xD4","O"],["\xD5","O"],["\xD6","Oe"],["\u014C","O"],["\u0150","O"],["\xD8","O"],["\u0152","OE"],["\xD9","U"],["\xDA","U"],["\xDB","U"],["\xDC","Ue"],["\u0170","U"],["\xDD","Y"],["\xDE","TH"],["\xDF","ss"],["\xE0","a"],["\xE1","a"],["\xE2","a"],["\xE3","a"],["\xE4","ae"],["\xE5","a"],["\xE6","ae"],["\xE7","c"],["\xE8","e"],["\xE9","e"],["\xEA","e"],["\xEB","e"],["\u0259","a"],["\xEC","i"],["\xED","i"],["\xEE","i"],["\xEF","i"],["\xF0","d"],["\xF1","n"],["\xF2","o"],["\xF3","o"],["\xF4","o"],["\xF5","o"],["\xF6","oe"],["\u014D","o"],["\u0151","o"],["\xF8","o"],["\u0153","oe"],["\xF9","u"],["\xFA","u"],["\xFB","u"],["\xFC","ue"],["\u0171","u"],["\xFD","y"],["\xFE","th"],["\xFF","y"],["\xE0","a"],["\xC0","A"],["\xE1","a"],["\xC1","A"],["\xE2","a"],["\xC2","A"],["\xE3","a"],["\xC3","A"],["\xE8","e"],["\xC8","E"],["\xE9","e"],["\xC9","E"],["\xEA","e"],["\xCA","E"],["\xEC","i"],["\xCC","I"],["\xED","i"],["\xCD","I"],["\xF2","o"],["\xD2","O"],["\xF3","o"],["\xD3","O"],["\xF4","o"],["\xD4","O"],["\xF5","o"],["\xD5","O"],["\xF9","u"],["\xD9","U"],["\xFA","u"],["\xDA","U"],["\xFD","y"],["\xDD","Y"],["\u0103","a"],["\u0102","A"],["\u0110","D"],["\u0111","d"],["\u0129","i"],["\u0128","I"],["\u0169","u"],["\u0168","U"],["\u01A1","o"],["\u01A0","O"],["\u01B0","u"],["\u01AF","U"],["\u1EA1","a"],["\u1EA0","A"],["\u1EA3","a"],["\u1EA2","A"],["\u1EA5","a"],["\u1EA4","A"],["\u1EA7","a"],["\u1EA6","A"],["\u1EA9","a"],["\u1EA8","A"],["\u1EAB","a"],["\u1EAA","A"],["\u1EAD","a"],["\u1EAC","A"],["\u1EAF","a"],["\u1EAE","A"],["\u1EB1","a"],["\u1EB0","A"],["\u1EB3","a"],["\u1EB2","A"],["\u1EB5","a"],["\u1EB4","A"],["\u1EB7","a"],["\u1EB6","A"],["\u1EB9","e"],["\u1EB8","E"],["\u1EBB","e"],["\u1EBA","E"],["\u1EBD","e"],["\u1EBC","E"],["\u1EBF","e"],["\u1EBE","E"],["\u1EC1","e"],["\u1EC0","E"],["\u1EC3","e"],["\u1EC2","E"],["\u1EC5","e"],["\u1EC4","E"],["\u1EC7","e"],["\u1EC6","E"],["\u1EC9","i"],["\u1EC8","I"],["\u1ECB","i"],["\u1ECA","I"],["\u1ECD","o"],["\u1ECC","O"],["\u1ECF","o"],["\u1ECE","O"],["\u1ED1","o"],["\u1ED0","O"],["\u1ED3","o"],["\u1ED2","O"],["\u1ED5","o"],["\u1ED4","O"],["\u1ED7","o"],["\u1ED6","O"],["\u1ED9","o"],["\u1ED8","O"],["\u1EDB","o"],["\u1EDA","O"],["\u1EDD","o"],["\u1EDC","O"],["\u1EDF","o"],["\u1EDE","O"],["\u1EE1","o"],["\u1EE0","O"],["\u1EE3","o"],["\u1EE2","O"],["\u1EE5","u"],["\u1EE4","U"],["\u1EE7","u"],["\u1EE6","U"],["\u1EE9","u"],["\u1EE8","U"],["\u1EEB","u"],["\u1EEA","U"],["\u1EED","u"],["\u1EEC","U"],["\u1EEF","u"],["\u1EEE","U"],["\u1EF1","u"],["\u1EF0","U"],["\u1EF3","y"],["\u1EF2","Y"],["\u1EF5","y"],["\u1EF4","Y"],["\u1EF7","y"],["\u1EF6","Y"],["\u1EF9","y"],["\u1EF8","Y"],["\u0621","e"],["\u0622","a"],["\u0623","a"],["\u0624","w"],["\u0625","a"],["\u0626","y"],["\u0627","a"],["\u0628","b"],["\u0629","t"],["\u062A","t"],["\u062B","th"],["\u062C","j"],["\u062D","h"],["\u062E","kh"],["\u062F","d"],["\u0630","dh"],["\u0631","r"],["\u0632","z"],["\u0633","s"],["\u0634","sh"],["\u0635","s"],["\u0636","d"],["\u0637","t"],["\u0638","z"],["\u0639","e"],["\u063A","gh"],["\u0640","_"],["\u0641","f"],["\u0642","q"],["\u0643","k"],["\u0644","l"],["\u0645","m"],["\u0646","n"],["\u0647","h"],["\u0648","w"],["\u0649","a"],["\u064A","y"],["\u064E\u200E","a"],["\u064F","u"],["\u0650\u200E","i"],["\u0660","0"],["\u0661","1"],["\u0662","2"],["\u0663","3"],["\u0664","4"],["\u0665","5"],["\u0666","6"],["\u0667","7"],["\u0668","8"],["\u0669","9"],["\u0686","ch"],["\u06A9","k"],["\u06AF","g"],["\u067E","p"],["\u0698","zh"],["\u06CC","y"],["\u06F0","0"],["\u06F1","1"],["\u06F2","2"],["\u06F3","3"],["\u06F4","4"],["\u06F5","5"],["\u06F6","6"],["\u06F7","7"],["\u06F8","8"],["\u06F9","9"],["\u067C","p"],["\u0681","z"],["\u0685","c"],["\u0689","d"],["\uFEAB","d"],["\uFEAD","r"],["\u0693","r"],["\uFEAF","z"],["\u0696","g"],["\u069A","x"],["\u06AB","g"],["\u06BC","n"],["\u06C0","e"],["\u06D0","e"],["\u06CD","ai"],["\u0679","t"],["\u0688","d"],["\u0691","r"],["\u06BA","n"],["\u06C1","h"],["\u06BE","h"],["\u06D2","e"],["\u0410","A"],["\u0430","a"],["\u0411","B"],["\u0431","b"],["\u0412","V"],["\u0432","v"],["\u0413","G"],["\u0433","g"],["\u0414","D"],["\u0434","d"],["\u044A\u0435","ye"],["\u042A\u0435","Ye"],["\u044A\u0415","yE"],["\u042A\u0415","YE"],["\u0415","E"],["\u0435","e"],["\u0401","Yo"],["\u0451","yo"],["\u0416","Zh"],["\u0436","zh"],["\u0417","Z"],["\u0437","z"],["\u0418","I"],["\u0438","i"],["\u044B\u0439","iy"],["\u042B\u0439","Iy"],["\u042B\u0419","IY"],["\u044B\u0419","iY"],["\u0419","Y"],["\u0439","y"],["\u041A","K"],["\u043A","k"],["\u041B","L"],["\u043B","l"],["\u041C","M"],["\u043C","m"],["\u041D","N"],["\u043D","n"],["\u041E","O"],["\u043E","o"],["\u041F","P"],["\u043F","p"],["\u0420","R"],["\u0440","r"],["\u0421","S"],["\u0441","s"],["\u0422","T"],["\u0442","t"],["\u0423","U"],["\u0443","u"],["\u0424","F"],["\u0444","f"],["\u0425","Kh"],["\u0445","kh"],["\u0426","Ts"],["\u0446","ts"],["\u0427","Ch"],["\u0447","ch"],["\u0428","Sh"],["\u0448","sh"],["\u0429","Sch"],["\u0449","sch"],["\u042A",""],["\u044A",""],["\u042B","Y"],["\u044B","y"],["\u042C",""],["\u044C",""],["\u042D","E"],["\u044D","e"],["\u042E","Yu"],["\u044E","yu"],["\u042F","Ya"],["\u044F","ya"],["\u0103","a"],["\u0102","A"],["\u0219","s"],["\u0218","S"],["\u021B","t"],["\u021A","T"],["\u0163","t"],["\u0162","T"],["\u015F","s"],["\u015E","S"],["\xE7","c"],["\xC7","C"],["\u011F","g"],["\u011E","G"],["\u0131","i"],["\u0130","I"],["\u0561","a"],["\u0531","A"],["\u0562","b"],["\u0532","B"],["\u0563","g"],["\u0533","G"],["\u0564","d"],["\u0534","D"],["\u0565","ye"],["\u0535","Ye"],["\u0566","z"],["\u0536","Z"],["\u0567","e"],["\u0537","E"],["\u0568","y"],["\u0538","Y"],["\u0569","t"],["\u0539","T"],["\u056A","zh"],["\u053A","Zh"],["\u056B","i"],["\u053B","I"],["\u056C","l"],["\u053C","L"],["\u056D","kh"],["\u053D","Kh"],["\u056E","ts"],["\u053E","Ts"],["\u056F","k"],["\u053F","K"],["\u0570","h"],["\u0540","H"],["\u0571","dz"],["\u0541","Dz"],["\u0572","gh"],["\u0542","Gh"],["\u0573","tch"],["\u0543","Tch"],["\u0574","m"],["\u0544","M"],["\u0575","y"],["\u0545","Y"],["\u0576","n"],["\u0546","N"],["\u0577","sh"],["\u0547","Sh"],["\u0578\u0582","u"],["\u0548\u0552","U"],["\u0548\u0582","U"],["\u0578","vo"],["\u0548","Vo"],["\u0579","ch"],["\u0549","Ch"],["\u057A","p"],["\u054A","P"],["\u057B","j"],["\u054B","J"],["\u057C","r"],["\u054C","R"],["\u057D","s"],["\u054D","S"],["\u057E","v"],["\u054E","V"],["\u057F","t"],["\u054F","T"],["\u0580","r"],["\u0550","R"],["\u0581","c"],["\u0551","C"],["\u0583","p"],["\u0553","P"],["\u0584","q"],["\u0554","Q"],["\u0585","o"],["\u0555","O"],["\u0586","f"],["\u0556","F"],["\u0587","yev"],["\u10D0","a"],["\u10D1","b"],["\u10D2","g"],["\u10D3","d"],["\u10D4","e"],["\u10D5","v"],["\u10D6","z"],["\u10D7","t"],["\u10D8","i"],["\u10D9","k"],["\u10DA","l"],["\u10DB","m"],["\u10DC","n"],["\u10DD","o"],["\u10DE","p"],["\u10DF","zh"],["\u10E0","r"],["\u10E1","s"],["\u10E2","t"],["\u10E3","u"],["\u10E4","ph"],["\u10E5","q"],["\u10E6","gh"],["\u10E7","k"],["\u10E8","sh"],["\u10E9","ch"],["\u10EA","ts"],["\u10EB","dz"],["\u10EC","ts"],["\u10ED","tch"],["\u10EE","kh"],["\u10EF","j"],["\u10F0","h"],["\u010D","c"],["\u010F","d"],["\u011B","e"],["\u0148","n"],["\u0159","r"],["\u0161","s"],["\u0165","t"],["\u016F","u"],["\u017E","z"],["\u010C","C"],["\u010E","D"],["\u011A","E"],["\u0147","N"],["\u0158","R"],["\u0160","S"],["\u0164","T"],["\u016E","U"],["\u017D","Z"],["\u0780","h"],["\u0781","sh"],["\u0782","n"],["\u0783","r"],["\u0784","b"],["\u0785","lh"],["\u0786","k"],["\u0787","a"],["\u0788","v"],["\u0789","m"],["\u078A","f"],["\u078B","dh"],["\u078C","th"],["\u078D","l"],["\u078E","g"],["\u078F","gn"],["\u0790","s"],["\u0791","d"],["\u0792","z"],["\u0793","t"],["\u0794","y"],["\u0795","p"],["\u0796","j"],["\u0797","ch"],["\u0798","tt"],["\u0799","hh"],["\u079A","kh"],["\u079B","th"],["\u079C","z"],["\u079D","sh"],["\u079E","s"],["\u079F","d"],["\u07A0","t"],["\u07A1","z"],["\u07A2","a"],["\u07A3","gh"],["\u07A4","q"],["\u07A5","w"],["\u07A6","a"],["\u07A7","aa"],["\u07A8","i"],["\u07A9","ee"],["\u07AA","u"],["\u07AB","oo"],["\u07AC","e"],["\u07AD","ey"],["\u07AE","o"],["\u07AF","oa"],["\u07B0",""],["\u03B1","a"],["\u03B2","v"],["\u03B3","g"],["\u03B4","d"],["\u03B5","e"],["\u03B6","z"],["\u03B7","i"],["\u03B8","th"],["\u03B9","i"],["\u03BA","k"],["\u03BB","l"],["\u03BC","m"],["\u03BD","n"],["\u03BE","ks"],["\u03BF","o"],["\u03C0","p"],["\u03C1","r"],["\u03C3","s"],["\u03C4","t"],["\u03C5","y"],["\u03C6","f"],["\u03C7","x"],["\u03C8","ps"],["\u03C9","o"],["\u03AC","a"],["\u03AD","e"],["\u03AF","i"],["\u03CC","o"],["\u03CD","y"],["\u03AE","i"],["\u03CE","o"],["\u03C2","s"],["\u03CA","i"],["\u03B0","y"],["\u03CB","y"],["\u0390","i"],["\u0391","A"],["\u0392","B"],["\u0393","G"],["\u0394","D"],["\u0395","E"],["\u0396","Z"],["\u0397","I"],["\u0398","TH"],["\u0399","I"],["\u039A","K"],["\u039B","L"],["\u039C","M"],["\u039D","N"],["\u039E","KS"],["\u039F","O"],["\u03A0","P"],["\u03A1","R"],["\u03A3","S"],["\u03A4","T"],["\u03A5","Y"],["\u03A6","F"],["\u03A7","X"],["\u03A8","PS"],["\u03A9","O"],["\u0386","A"],["\u0388","E"],["\u038A","I"],["\u038C","O"],["\u038E","Y"],["\u0389","I"],["\u038F","O"],["\u03AA","I"],["\u03AB","Y"],["\u0101","a"],["\u0113","e"],["\u0123","g"],["\u012B","i"],["\u0137","k"],["\u013C","l"],["\u0146","n"],["\u016B","u"],["\u0100","A"],["\u0112","E"],["\u0122","G"],["\u012A","I"],["\u0136","K"],["\u013B","L"],["\u0145","N"],["\u016A","U"],["\u010D","c"],["\u0161","s"],["\u017E","z"],["\u010C","C"],["\u0160","S"],["\u017D","Z"],["\u0105","a"],["\u010D","c"],["\u0119","e"],["\u0117","e"],["\u012F","i"],["\u0161","s"],["\u0173","u"],["\u016B","u"],["\u017E","z"],["\u0104","A"],["\u010C","C"],["\u0118","E"],["\u0116","E"],["\u012E","I"],["\u0160","S"],["\u0172","U"],["\u016A","U"],["\u040C","Kj"],["\u045C","kj"],["\u0409","Lj"],["\u0459","lj"],["\u040A","Nj"],["\u045A","nj"],["\u0422\u0441","Ts"],["\u0442\u0441","ts"],["\u0105","a"],["\u0107","c"],["\u0119","e"],["\u0142","l"],["\u0144","n"],["\u015B","s"],["\u017A","z"],["\u017C","z"],["\u0104","A"],["\u0106","C"],["\u0118","E"],["\u0141","L"],["\u0143","N"],["\u015A","S"],["\u0179","Z"],["\u017B","Z"],["\u0404","Ye"],["\u0406","I"],["\u0407","Yi"],["\u0490","G"],["\u0454","ye"],["\u0456","i"],["\u0457","yi"],["\u0491","g"],["\u0132","IJ"],["\u0133","ij"],["\xA2","c"],["\xA5","Y"],["\u07FF","b"],["\u09F3","t"],["\u0AF1","Bo"],["\u0E3F","B"],["\u20A0","CE"],["\u20A1","C"],["\u20A2","Cr"],["\u20A3","F"],["\u20A5","m"],["\u20A6","N"],["\u20A7","Pt"],["\u20A8","Rs"],["\u20A9","W"],["\u20AB","s"],["\u20AC","E"],["\u20AD","K"],["\u20AE","T"],["\u20AF","Dp"],["\u20B0","S"],["\u20B1","P"],["\u20B2","G"],["\u20B3","A"],["\u20B4","S"],["\u20B5","C"],["\u20B6","tt"],["\u20B7","S"],["\u20B8","T"],["\u20B9","R"],["\u20BA","L"],["\u20BD","P"],["\u20BF","B"],["\uFE69","$"],["\uFFE0","c"],["\uFFE5","Y"],["\uFFE6","W"],["\u{1D400}","A"],["\u{1D401}","B"],["\u{1D402}","C"],["\u{1D403}","D"],["\u{1D404}","E"],["\u{1D405}","F"],["\u{1D406}","G"],["\u{1D407}","H"],["\u{1D408}","I"],["\u{1D409}","J"],["\u{1D40A}","K"],["\u{1D40B}","L"],["\u{1D40C}","M"],["\u{1D40D}","N"],["\u{1D40E}","O"],["\u{1D40F}","P"],["\u{1D410}","Q"],["\u{1D411}","R"],["\u{1D412}","S"],["\u{1D413}","T"],["\u{1D414}","U"],["\u{1D415}","V"],["\u{1D416}","W"],["\u{1D417}","X"],["\u{1D418}","Y"],["\u{1D419}","Z"],["\u{1D41A}","a"],["\u{1D41B}","b"],["\u{1D41C}","c"],["\u{1D41D}","d"],["\u{1D41E}","e"],["\u{1D41F}","f"],["\u{1D420}","g"],["\u{1D421}","h"],["\u{1D422}","i"],["\u{1D423}","j"],["\u{1D424}","k"],["\u{1D425}","l"],["\u{1D426}","m"],["\u{1D427}","n"],["\u{1D428}","o"],["\u{1D429}","p"],["\u{1D42A}","q"],["\u{1D42B}","r"],["\u{1D42C}","s"],["\u{1D42D}","t"],["\u{1D42E}","u"],["\u{1D42F}","v"],["\u{1D430}","w"],["\u{1D431}","x"],["\u{1D432}","y"],["\u{1D433}","z"],["\u{1D434}","A"],["\u{1D435}","B"],["\u{1D436}","C"],["\u{1D437}","D"],["\u{1D438}","E"],["\u{1D439}","F"],["\u{1D43A}","G"],["\u{1D43B}","H"],["\u{1D43C}","I"],["\u{1D43D}","J"],["\u{1D43E}","K"],["\u{1D43F}","L"],["\u{1D440}","M"],["\u{1D441}","N"],["\u{1D442}","O"],["\u{1D443}","P"],["\u{1D444}","Q"],["\u{1D445}","R"],["\u{1D446}","S"],["\u{1D447}","T"],["\u{1D448}","U"],["\u{1D449}","V"],["\u{1D44A}","W"],["\u{1D44B}","X"],["\u{1D44C}","Y"],["\u{1D44D}","Z"],["\u{1D44E}","a"],["\u{1D44F}","b"],["\u{1D450}","c"],["\u{1D451}","d"],["\u{1D452}","e"],["\u{1D453}","f"],["\u{1D454}","g"],["\u{1D456}","i"],["\u{1D457}","j"],["\u{1D458}","k"],["\u{1D459}","l"],["\u{1D45A}","m"],["\u{1D45B}","n"],["\u{1D45C}","o"],["\u{1D45D}","p"],["\u{1D45E}","q"],["\u{1D45F}","r"],["\u{1D460}","s"],["\u{1D461}","t"],["\u{1D462}","u"],["\u{1D463}","v"],["\u{1D464}","w"],["\u{1D465}","x"],["\u{1D466}","y"],["\u{1D467}","z"],["\u{1D468}","A"],["\u{1D469}","B"],["\u{1D46A}","C"],["\u{1D46B}","D"],["\u{1D46C}","E"],["\u{1D46D}","F"],["\u{1D46E}","G"],["\u{1D46F}","H"],["\u{1D470}","I"],["\u{1D471}","J"],["\u{1D472}","K"],["\u{1D473}","L"],["\u{1D474}","M"],["\u{1D475}","N"],["\u{1D476}","O"],["\u{1D477}","P"],["\u{1D478}","Q"],["\u{1D479}","R"],["\u{1D47A}","S"],["\u{1D47B}","T"],["\u{1D47C}","U"],["\u{1D47D}","V"],["\u{1D47E}","W"],["\u{1D47F}","X"],["\u{1D480}","Y"],["\u{1D481}","Z"],["\u{1D482}","a"],["\u{1D483}","b"],["\u{1D484}","c"],["\u{1D485}","d"],["\u{1D486}","e"],["\u{1D487}","f"],["\u{1D488}","g"],["\u{1D489}","h"],["\u{1D48A}","i"],["\u{1D48B}","j"],["\u{1D48C}","k"],["\u{1D48D}","l"],["\u{1D48E}","m"],["\u{1D48F}","n"],["\u{1D490}","o"],["\u{1D491}","p"],["\u{1D492}","q"],["\u{1D493}","r"],["\u{1D494}","s"],["\u{1D495}","t"],["\u{1D496}","u"],["\u{1D497}","v"],["\u{1D498}","w"],["\u{1D499}","x"],["\u{1D49A}","y"],["\u{1D49B}","z"],["\u{1D49C}","A"],["\u{1D49E}","C"],["\u{1D49F}","D"],["\u{1D4A2}","g"],["\u{1D4A5}","J"],["\u{1D4A6}","K"],["\u{1D4A9}","N"],["\u{1D4AA}","O"],["\u{1D4AB}","P"],["\u{1D4AC}","Q"],["\u{1D4AE}","S"],["\u{1D4AF}","T"],["\u{1D4B0}","U"],["\u{1D4B1}","V"],["\u{1D4B2}","W"],["\u{1D4B3}","X"],["\u{1D4B4}","Y"],["\u{1D4B5}","Z"],["\u{1D4B6}","a"],["\u{1D4B7}","b"],["\u{1D4B8}","c"],["\u{1D4B9}","d"],["\u{1D4BB}","f"],["\u{1D4BD}","h"],["\u{1D4BE}","i"],["\u{1D4BF}","j"],["\u{1D4C0}","k"],["\u{1D4C1}","l"],["\u{1D4C2}","m"],["\u{1D4C3}","n"],["\u{1D4C5}","p"],["\u{1D4C6}","q"],["\u{1D4C7}","r"],["\u{1D4C8}","s"],["\u{1D4C9}","t"],["\u{1D4CA}","u"],["\u{1D4CB}","v"],["\u{1D4CC}","w"],["\u{1D4CD}","x"],["\u{1D4CE}","y"],["\u{1D4CF}","z"],["\u{1D4D0}","A"],["\u{1D4D1}","B"],["\u{1D4D2}","C"],["\u{1D4D3}","D"],["\u{1D4D4}","E"],["\u{1D4D5}","F"],["\u{1D4D6}","G"],["\u{1D4D7}","H"],["\u{1D4D8}","I"],["\u{1D4D9}","J"],["\u{1D4DA}","K"],["\u{1D4DB}","L"],["\u{1D4DC}","M"],["\u{1D4DD}","N"],["\u{1D4DE}","O"],["\u{1D4DF}","P"],["\u{1D4E0}","Q"],["\u{1D4E1}","R"],["\u{1D4E2}","S"],["\u{1D4E3}","T"],["\u{1D4E4}","U"],["\u{1D4E5}","V"],["\u{1D4E6}","W"],["\u{1D4E7}","X"],["\u{1D4E8}","Y"],["\u{1D4E9}","Z"],["\u{1D4EA}","a"],["\u{1D4EB}","b"],["\u{1D4EC}","c"],["\u{1D4ED}","d"],["\u{1D4EE}","e"],["\u{1D4EF}","f"],["\u{1D4F0}","g"],["\u{1D4F1}","h"],["\u{1D4F2}","i"],["\u{1D4F3}","j"],["\u{1D4F4}","k"],["\u{1D4F5}","l"],["\u{1D4F6}","m"],["\u{1D4F7}","n"],["\u{1D4F8}","o"],["\u{1D4F9}","p"],["\u{1D4FA}","q"],["\u{1D4FB}","r"],["\u{1D4FC}","s"],["\u{1D4FD}","t"],["\u{1D4FE}","u"],["\u{1D4FF}","v"],["\u{1D500}","w"],["\u{1D501}","x"],["\u{1D502}","y"],["\u{1D503}","z"],["\u{1D504}","A"],["\u{1D505}","B"],["\u{1D507}","D"],["\u{1D508}","E"],["\u{1D509}","F"],["\u{1D50A}","G"],["\u{1D50D}","J"],["\u{1D50E}","K"],["\u{1D50F}","L"],["\u{1D510}","M"],["\u{1D511}","N"],["\u{1D512}","O"],["\u{1D513}","P"],["\u{1D514}","Q"],["\u{1D516}","S"],["\u{1D517}","T"],["\u{1D518}","U"],["\u{1D519}","V"],["\u{1D51A}","W"],["\u{1D51B}","X"],["\u{1D51C}","Y"],["\u{1D51E}","a"],["\u{1D51F}","b"],["\u{1D520}","c"],["\u{1D521}","d"],["\u{1D522}","e"],["\u{1D523}","f"],["\u{1D524}","g"],["\u{1D525}","h"],["\u{1D526}","i"],["\u{1D527}","j"],["\u{1D528}","k"],["\u{1D529}","l"],["\u{1D52A}","m"],["\u{1D52B}","n"],["\u{1D52C}","o"],["\u{1D52D}","p"],["\u{1D52E}","q"],["\u{1D52F}","r"],["\u{1D530}","s"],["\u{1D531}","t"],["\u{1D532}","u"],["\u{1D533}","v"],["\u{1D534}","w"],["\u{1D535}","x"],["\u{1D536}","y"],["\u{1D537}","z"],["\u{1D538}","A"],["\u{1D539}","B"],["\u{1D53B}","D"],["\u{1D53C}","E"],["\u{1D53D}","F"],["\u{1D53E}","G"],["\u{1D540}","I"],["\u{1D541}","J"],["\u{1D542}","K"],["\u{1D543}","L"],["\u{1D544}","M"],["\u{1D546}","O"],["\u{1D54A}","S"],["\u{1D54B}","T"],["\u{1D54C}","U"],["\u{1D54D}","V"],["\u{1D54E}","W"],["\u{1D54F}","X"],["\u{1D550}","Y"],["\u{1D552}","a"],["\u{1D553}","b"],["\u{1D554}","c"],["\u{1D555}","d"],["\u{1D556}","e"],["\u{1D557}","f"],["\u{1D558}","g"],["\u{1D559}","h"],["\u{1D55A}","i"],["\u{1D55B}","j"],["\u{1D55C}","k"],["\u{1D55D}","l"],["\u{1D55E}","m"],["\u{1D55F}","n"],["\u{1D560}","o"],["\u{1D561}","p"],["\u{1D562}","q"],["\u{1D563}","r"],["\u{1D564}","s"],["\u{1D565}","t"],["\u{1D566}","u"],["\u{1D567}","v"],["\u{1D568}","w"],["\u{1D569}","x"],["\u{1D56A}","y"],["\u{1D56B}","z"],["\u{1D56C}","A"],["\u{1D56D}","B"],["\u{1D56E}","C"],["\u{1D56F}","D"],["\u{1D570}","E"],["\u{1D571}","F"],["\u{1D572}","G"],["\u{1D573}","H"],["\u{1D574}","I"],["\u{1D575}","J"],["\u{1D576}","K"],["\u{1D577}","L"],["\u{1D578}","M"],["\u{1D579}","N"],["\u{1D57A}","O"],["\u{1D57B}","P"],["\u{1D57C}","Q"],["\u{1D57D}","R"],["\u{1D57E}","S"],["\u{1D57F}","T"],["\u{1D580}","U"],["\u{1D581}","V"],["\u{1D582}","W"],["\u{1D583}","X"],["\u{1D584}","Y"],["\u{1D585}","Z"],["\u{1D586}","a"],["\u{1D587}","b"],["\u{1D588}","c"],["\u{1D589}","d"],["\u{1D58A}","e"],["\u{1D58B}","f"],["\u{1D58C}","g"],["\u{1D58D}","h"],["\u{1D58E}","i"],["\u{1D58F}","j"],["\u{1D590}","k"],["\u{1D591}","l"],["\u{1D592}","m"],["\u{1D593}","n"],["\u{1D594}","o"],["\u{1D595}","p"],["\u{1D596}","q"],["\u{1D597}","r"],["\u{1D598}","s"],["\u{1D599}","t"],["\u{1D59A}","u"],["\u{1D59B}","v"],["\u{1D59C}","w"],["\u{1D59D}","x"],["\u{1D59E}","y"],["\u{1D59F}","z"],["\u{1D5A0}","A"],["\u{1D5A1}","B"],["\u{1D5A2}","C"],["\u{1D5A3}","D"],["\u{1D5A4}","E"],["\u{1D5A5}","F"],["\u{1D5A6}","G"],["\u{1D5A7}","H"],["\u{1D5A8}","I"],["\u{1D5A9}","J"],["\u{1D5AA}","K"],["\u{1D5AB}","L"],["\u{1D5AC}","M"],["\u{1D5AD}","N"],["\u{1D5AE}","O"],["\u{1D5AF}","P"],["\u{1D5B0}","Q"],["\u{1D5B1}","R"],["\u{1D5B2}","S"],["\u{1D5B3}","T"],["\u{1D5B4}","U"],["\u{1D5B5}","V"],["\u{1D5B6}","W"],["\u{1D5B7}","X"],["\u{1D5B8}","Y"],["\u{1D5B9}","Z"],["\u{1D5BA}","a"],["\u{1D5BB}","b"],["\u{1D5BC}","c"],["\u{1D5BD}","d"],["\u{1D5BE}","e"],["\u{1D5BF}","f"],["\u{1D5C0}","g"],["\u{1D5C1}","h"],["\u{1D5C2}","i"],["\u{1D5C3}","j"],["\u{1D5C4}","k"],["\u{1D5C5}","l"],["\u{1D5C6}","m"],["\u{1D5C7}","n"],["\u{1D5C8}","o"],["\u{1D5C9}","p"],["\u{1D5CA}","q"],["\u{1D5CB}","r"],["\u{1D5CC}","s"],["\u{1D5CD}","t"],["\u{1D5CE}","u"],["\u{1D5CF}","v"],["\u{1D5D0}","w"],["\u{1D5D1}","x"],["\u{1D5D2}","y"],["\u{1D5D3}","z"],["\u{1D5D4}","A"],["\u{1D5D5}","B"],["\u{1D5D6}","C"],["\u{1D5D7}","D"],["\u{1D5D8}","E"],["\u{1D5D9}","F"],["\u{1D5DA}","G"],["\u{1D5DB}","H"],["\u{1D5DC}","I"],["\u{1D5DD}","J"],["\u{1D5DE}","K"],["\u{1D5DF}","L"],["\u{1D5E0}","M"],["\u{1D5E1}","N"],["\u{1D5E2}","O"],["\u{1D5E3}","P"],["\u{1D5E4}","Q"],["\u{1D5E5}","R"],["\u{1D5E6}","S"],["\u{1D5E7}","T"],["\u{1D5E8}","U"],["\u{1D5E9}","V"],["\u{1D5EA}","W"],["\u{1D5EB}","X"],["\u{1D5EC}","Y"],["\u{1D5ED}","Z"],["\u{1D5EE}","a"],["\u{1D5EF}","b"],["\u{1D5F0}","c"],["\u{1D5F1}","d"],["\u{1D5F2}","e"],["\u{1D5F3}","f"],["\u{1D5F4}","g"],["\u{1D5F5}","h"],["\u{1D5F6}","i"],["\u{1D5F7}","j"],["\u{1D5F8}","k"],["\u{1D5F9}","l"],["\u{1D5FA}","m"],["\u{1D5FB}","n"],["\u{1D5FC}","o"],["\u{1D5FD}","p"],["\u{1D5FE}","q"],["\u{1D5FF}","r"],["\u{1D600}","s"],["\u{1D601}","t"],["\u{1D602}","u"],["\u{1D603}","v"],["\u{1D604}","w"],["\u{1D605}","x"],["\u{1D606}","y"],["\u{1D607}","z"],["\u{1D608}","A"],["\u{1D609}","B"],["\u{1D60A}","C"],["\u{1D60B}","D"],["\u{1D60C}","E"],["\u{1D60D}","F"],["\u{1D60E}","G"],["\u{1D60F}","H"],["\u{1D610}","I"],["\u{1D611}","J"],["\u{1D612}","K"],["\u{1D613}","L"],["\u{1D614}","M"],["\u{1D615}","N"],["\u{1D616}","O"],["\u{1D617}","P"],["\u{1D618}","Q"],["\u{1D619}","R"],["\u{1D61A}","S"],["\u{1D61B}","T"],["\u{1D61C}","U"],["\u{1D61D}","V"],["\u{1D61E}","W"],["\u{1D61F}","X"],["\u{1D620}","Y"],["\u{1D621}","Z"],["\u{1D622}","a"],["\u{1D623}","b"],["\u{1D624}","c"],["\u{1D625}","d"],["\u{1D626}","e"],["\u{1D627}","f"],["\u{1D628}","g"],["\u{1D629}","h"],["\u{1D62A}","i"],["\u{1D62B}","j"],["\u{1D62C}","k"],["\u{1D62D}","l"],["\u{1D62E}","m"],["\u{1D62F}","n"],["\u{1D630}","o"],["\u{1D631}","p"],["\u{1D632}","q"],["\u{1D633}","r"],["\u{1D634}","s"],["\u{1D635}","t"],["\u{1D636}","u"],["\u{1D637}","v"],["\u{1D638}","w"],["\u{1D639}","x"],["\u{1D63A}","y"],["\u{1D63B}","z"],["\u{1D63C}","A"],["\u{1D63D}","B"],["\u{1D63E}","C"],["\u{1D63F}","D"],["\u{1D640}","E"],["\u{1D641}","F"],["\u{1D642}","G"],["\u{1D643}","H"],["\u{1D644}","I"],["\u{1D645}","J"],["\u{1D646}","K"],["\u{1D647}","L"],["\u{1D648}","M"],["\u{1D649}","N"],["\u{1D64A}","O"],["\u{1D64B}","P"],["\u{1D64C}","Q"],["\u{1D64D}","R"],["\u{1D64E}","S"],["\u{1D64F}","T"],["\u{1D650}","U"],["\u{1D651}","V"],["\u{1D652}","W"],["\u{1D653}","X"],["\u{1D654}","Y"],["\u{1D655}","Z"],["\u{1D656}","a"],["\u{1D657}","b"],["\u{1D658}","c"],["\u{1D659}","d"],["\u{1D65A}","e"],["\u{1D65B}","f"],["\u{1D65C}","g"],["\u{1D65D}","h"],["\u{1D65E}","i"],["\u{1D65F}","j"],["\u{1D660}","k"],["\u{1D661}","l"],["\u{1D662}","m"],["\u{1D663}","n"],["\u{1D664}","o"],["\u{1D665}","p"],["\u{1D666}","q"],["\u{1D667}","r"],["\u{1D668}","s"],["\u{1D669}","t"],["\u{1D66A}","u"],["\u{1D66B}","v"],["\u{1D66C}","w"],["\u{1D66D}","x"],["\u{1D66E}","y"],["\u{1D66F}","z"],["\u{1D670}","A"],["\u{1D671}","B"],["\u{1D672}","C"],["\u{1D673}","D"],["\u{1D674}","E"],["\u{1D675}","F"],["\u{1D676}","G"],["\u{1D677}","H"],["\u{1D678}","I"],["\u{1D679}","J"],["\u{1D67A}","K"],["\u{1D67B}","L"],["\u{1D67C}","M"],["\u{1D67D}","N"],["\u{1D67E}","O"],["\u{1D67F}","P"],["\u{1D680}","Q"],["\u{1D681}","R"],["\u{1D682}","S"],["\u{1D683}","T"],["\u{1D684}","U"],["\u{1D685}","V"],["\u{1D686}","W"],["\u{1D687}","X"],["\u{1D688}","Y"],["\u{1D689}","Z"],["\u{1D68A}","a"],["\u{1D68B}","b"],["\u{1D68C}","c"],["\u{1D68D}","d"],["\u{1D68E}","e"],["\u{1D68F}","f"],["\u{1D690}","g"],["\u{1D691}","h"],["\u{1D692}","i"],["\u{1D693}","j"],["\u{1D694}","k"],["\u{1D695}","l"],["\u{1D696}","m"],["\u{1D697}","n"],["\u{1D698}","o"],["\u{1D699}","p"],["\u{1D69A}","q"],["\u{1D69B}","r"],["\u{1D69C}","s"],["\u{1D69D}","t"],["\u{1D69E}","u"],["\u{1D69F}","v"],["\u{1D6A0}","w"],["\u{1D6A1}","x"],["\u{1D6A2}","y"],["\u{1D6A3}","z"],["\u{1D6A4}","l"],["\u{1D6A5}","j"],["\u{1D6E2}","A"],["\u{1D6E3}","B"],["\u{1D6E4}","G"],["\u{1D6E5}","D"],["\u{1D6E6}","E"],["\u{1D6E7}","Z"],["\u{1D6E8}","I"],["\u{1D6E9}","TH"],["\u{1D6EA}","I"],["\u{1D6EB}","K"],["\u{1D6EC}","L"],["\u{1D6ED}","M"],["\u{1D6EE}","N"],["\u{1D6EF}","KS"],["\u{1D6F0}","O"],["\u{1D6F1}","P"],["\u{1D6F2}","R"],["\u{1D6F3}","TH"],["\u{1D6F4}","S"],["\u{1D6F5}","T"],["\u{1D6F6}","Y"],["\u{1D6F7}","F"],["\u{1D6F8}","x"],["\u{1D6F9}","PS"],["\u{1D6FA}","O"],["\u{1D6FB}","D"],["\u{1D6FC}","a"],["\u{1D6FD}","b"],["\u{1D6FE}","g"],["\u{1D6FF}","d"],["\u{1D700}","e"],["\u{1D701}","z"],["\u{1D702}","i"],["\u{1D703}","th"],["\u{1D704}","i"],["\u{1D705}","k"],["\u{1D706}","l"],["\u{1D707}","m"],["\u{1D708}","n"],["\u{1D709}","ks"],["\u{1D70A}","o"],["\u{1D70B}","p"],["\u{1D70C}","r"],["\u{1D70D}","s"],["\u{1D70E}","s"],["\u{1D70F}","t"],["\u{1D710}","y"],["\u{1D711}","f"],["\u{1D712}","x"],["\u{1D713}","ps"],["\u{1D714}","o"],["\u{1D715}","d"],["\u{1D716}","E"],["\u{1D717}","TH"],["\u{1D718}","K"],["\u{1D719}","f"],["\u{1D71A}","r"],["\u{1D71B}","p"],["\u{1D71C}","A"],["\u{1D71D}","V"],["\u{1D71E}","G"],["\u{1D71F}","D"],["\u{1D720}","E"],["\u{1D721}","Z"],["\u{1D722}","I"],["\u{1D723}","TH"],["\u{1D724}","I"],["\u{1D725}","K"],["\u{1D726}","L"],["\u{1D727}","M"],["\u{1D728}","N"],["\u{1D729}","KS"],["\u{1D72A}","O"],["\u{1D72B}","P"],["\u{1D72C}","S"],["\u{1D72D}","TH"],["\u{1D72E}","S"],["\u{1D72F}","T"],["\u{1D730}","Y"],["\u{1D731}","F"],["\u{1D732}","X"],["\u{1D733}","PS"],["\u{1D734}","O"],["\u{1D735}","D"],["\u{1D736}","a"],["\u{1D737}","v"],["\u{1D738}","g"],["\u{1D739}","d"],["\u{1D73A}","e"],["\u{1D73B}","z"],["\u{1D73C}","i"],["\u{1D73D}","th"],["\u{1D73E}","i"],["\u{1D73F}","k"],["\u{1D740}","l"],["\u{1D741}","m"],["\u{1D742}","n"],["\u{1D743}","ks"],["\u{1D744}","o"],["\u{1D745}","p"],["\u{1D746}","r"],["\u{1D747}","s"],["\u{1D748}","s"],["\u{1D749}","t"],["\u{1D74A}","y"],["\u{1D74B}","f"],["\u{1D74C}","x"],["\u{1D74D}","ps"],["\u{1D74E}","o"],["\u{1D74F}","a"],["\u{1D750}","e"],["\u{1D751}","i"],["\u{1D752}","k"],["\u{1D753}","f"],["\u{1D754}","r"],["\u{1D755}","p"],["\u{1D756}","A"],["\u{1D757}","B"],["\u{1D758}","G"],["\u{1D759}","D"],["\u{1D75A}","E"],["\u{1D75B}","Z"],["\u{1D75C}","I"],["\u{1D75D}","TH"],["\u{1D75E}","I"],["\u{1D75F}","K"],["\u{1D760}","L"],["\u{1D761}","M"],["\u{1D762}","N"],["\u{1D763}","KS"],["\u{1D764}","O"],["\u{1D765}","P"],["\u{1D766}","R"],["\u{1D767}","TH"],["\u{1D768}","S"],["\u{1D769}","T"],["\u{1D76A}","Y"],["\u{1D76B}","F"],["\u{1D76C}","X"],["\u{1D76D}","PS"],["\u{1D76E}","O"],["\u{1D76F}","D"],["\u{1D770}","a"],["\u{1D771}","v"],["\u{1D772}","g"],["\u{1D773}","d"],["\u{1D774}","e"],["\u{1D775}","z"],["\u{1D776}","i"],["\u{1D777}","th"],["\u{1D778}","i"],["\u{1D779}","k"],["\u{1D77A}","l"],["\u{1D77B}","m"],["\u{1D77C}","n"],["\u{1D77D}","ks"],["\u{1D77E}","o"],["\u{1D77F}","p"],["\u{1D780}","r"],["\u{1D781}","s"],["\u{1D782}","s"],["\u{1D783}","t"],["\u{1D784}","y"],["\u{1D785}","f"],["\u{1D786}","x"],["\u{1D787}","ps"],["\u{1D788}","o"],["\u{1D789}","a"],["\u{1D78A}","e"],["\u{1D78B}","i"],["\u{1D78C}","k"],["\u{1D78D}","f"],["\u{1D78E}","r"],["\u{1D78F}","p"],["\u{1D790}","A"],["\u{1D791}","V"],["\u{1D792}","G"],["\u{1D793}","D"],["\u{1D794}","E"],["\u{1D795}","Z"],["\u{1D796}","I"],["\u{1D797}","TH"],["\u{1D798}","I"],["\u{1D799}","K"],["\u{1D79A}","L"],["\u{1D79B}","M"],["\u{1D79C}","N"],["\u{1D79D}","KS"],["\u{1D79E}","O"],["\u{1D79F}","P"],["\u{1D7A0}","S"],["\u{1D7A1}","TH"],["\u{1D7A2}","S"],["\u{1D7A3}","T"],["\u{1D7A4}","Y"],["\u{1D7A5}","F"],["\u{1D7A6}","X"],["\u{1D7A7}","PS"],["\u{1D7A8}","O"],["\u{1D7A9}","D"],["\u{1D7AA}","av"],["\u{1D7AB}","g"],["\u{1D7AC}","d"],["\u{1D7AD}","e"],["\u{1D7AE}","z"],["\u{1D7AF}","i"],["\u{1D7B0}","i"],["\u{1D7B1}","th"],["\u{1D7B2}","i"],["\u{1D7B3}","k"],["\u{1D7B4}","l"],["\u{1D7B5}","m"],["\u{1D7B6}","n"],["\u{1D7B7}","ks"],["\u{1D7B8}","o"],["\u{1D7B9}","p"],["\u{1D7BA}","r"],["\u{1D7BB}","s"],["\u{1D7BC}","s"],["\u{1D7BD}","t"],["\u{1D7BE}","y"],["\u{1D7BF}","f"],["\u{1D7C0}","x"],["\u{1D7C1}","ps"],["\u{1D7C2}","o"],["\u{1D7C3}","a"],["\u{1D7C4}","e"],["\u{1D7C5}","i"],["\u{1D7C6}","k"],["\u{1D7C7}","f"],["\u{1D7C8}","r"],["\u{1D7C9}","p"],["\u{1D7CA}","F"],["\u{1D7CB}","f"],["\u249C","(a)"],["\u249D","(b)"],["\u249E","(c)"],["\u249F","(d)"],["\u24A0","(e)"],["\u24A1","(f)"],["\u24A2","(g)"],["\u24A3","(h)"],["\u24A4","(i)"],["\u24A5","(j)"],["\u24A6","(k)"],["\u24A7","(l)"],["\u24A8","(m)"],["\u24A9","(n)"],["\u24AA","(o)"],["\u24AB","(p)"],["\u24AC","(q)"],["\u24AD","(r)"],["\u24AE","(s)"],["\u24AF","(t)"],["\u24B0","(u)"],["\u24B1","(v)"],["\u24B2","(w)"],["\u24B3","(x)"],["\u24B4","(y)"],["\u24B5","(z)"],["\u24B6","(A)"],["\u24B7","(B)"],["\u24B8","(C)"],["\u24B9","(D)"],["\u24BA","(E)"],["\u24BB","(F)"],["\u24BC","(G)"],["\u24BD","(H)"],["\u24BE","(I)"],["\u24BF","(J)"],["\u24C0","(K)"],["\u24C1","(L)"],["\u24C3","(N)"],["\u24C4","(O)"],["\u24C5","(P)"],["\u24C6","(Q)"],["\u24C7","(R)"],["\u24C8","(S)"],["\u24C9","(T)"],["\u24CA","(U)"],["\u24CB","(V)"],["\u24CC","(W)"],["\u24CD","(X)"],["\u24CE","(Y)"],["\u24CF","(Z)"],["\u24D0","(a)"],["\u24D1","(b)"],["\u24D2","(c)"],["\u24D3","(d)"],["\u24D4","(e)"],["\u24D5","(f)"],["\u24D6","(g)"],["\u24D7","(h)"],["\u24D8","(i)"],["\u24D9","(j)"],["\u24DA","(k)"],["\u24DB","(l)"],["\u24DC","(m)"],["\u24DD","(n)"],["\u24DE","(o)"],["\u24DF","(p)"],["\u24E0","(q)"],["\u24E1","(r)"],["\u24E2","(s)"],["\u24E3","(t)"],["\u24E4","(u)"],["\u24E5","(v)"],["\u24E6","(w)"],["\u24E7","(x)"],["\u24E8","(y)"],["\u24E9","(z)"],["\u010A","C"],["\u010B","c"],["\u0120","G"],["\u0121","g"],["\u0126","H"],["\u0127","h"],["\u017B","Z"],["\u017C","z"],["\u{1D7CE}","0"],["\u{1D7CF}","1"],["\u{1D7D0}","2"],["\u{1D7D1}","3"],["\u{1D7D2}","4"],["\u{1D7D3}","5"],["\u{1D7D4}","6"],["\u{1D7D5}","7"],["\u{1D7D6}","8"],["\u{1D7D7}","9"],["\u{1D7D8}","0"],["\u{1D7D9}","1"],["\u{1D7DA}","2"],["\u{1D7DB}","3"],["\u{1D7DC}","4"],["\u{1D7DD}","5"],["\u{1D7DE}","6"],["\u{1D7DF}","7"],["\u{1D7E0}","8"],["\u{1D7E1}","9"],["\u{1D7E2}","0"],["\u{1D7E3}","1"],["\u{1D7E4}","2"],["\u{1D7E5}","3"],["\u{1D7E6}","4"],["\u{1D7E7}","5"],["\u{1D7E8}","6"],["\u{1D7E9}","7"],["\u{1D7EA}","8"],["\u{1D7EB}","9"],["\u{1D7EC}","0"],["\u{1D7ED}","1"],["\u{1D7EE}","2"],["\u{1D7EF}","3"],["\u{1D7F0}","4"],["\u{1D7F1}","5"],["\u{1D7F2}","6"],["\u{1D7F3}","7"],["\u{1D7F4}","8"],["\u{1D7F5}","9"],["\u{1D7F6}","0"],["\u{1D7F7}","1"],["\u{1D7F8}","2"],["\u{1D7F9}","3"],["\u{1D7FA}","4"],["\u{1D7FB}","5"],["\u{1D7FC}","6"],["\u{1D7FD}","7"],["\u{1D7FE}","8"],["\u{1D7FF}","9"],["\u2460","1"],["\u2461","2"],["\u2462","3"],["\u2463","4"],["\u2464","5"],["\u2465","6"],["\u2466","7"],["\u2467","8"],["\u2468","9"],["\u2469","10"],["\u246A","11"],["\u246B","12"],["\u246C","13"],["\u246D","14"],["\u246E","15"],["\u246F","16"],["\u2470","17"],["\u2471","18"],["\u2472","19"],["\u2473","20"],["\u2474","1"],["\u2475","2"],["\u2476","3"],["\u2477","4"],["\u2478","5"],["\u2479","6"],["\u247A","7"],["\u247B","8"],["\u247C","9"],["\u247D","10"],["\u247E","11"],["\u247F","12"],["\u2480","13"],["\u2481","14"],["\u2482","15"],["\u2483","16"],["\u2484","17"],["\u2485","18"],["\u2486","19"],["\u2487","20"],["\u2488","1."],["\u2489","2."],["\u248A","3."],["\u248B","4."],["\u248C","5."],["\u248D","6."],["\u248E","7."],["\u248F","8."],["\u2490","9."],["\u2491","10."],["\u2492","11."],["\u2493","12."],["\u2494","13."],["\u2495","14."],["\u2496","15."],["\u2497","16."],["\u2498","17."],["\u2499","18."],["\u249A","19."],["\u249B","20."],["\u24EA","0"],["\u24EB","11"],["\u24EC","12"],["\u24ED","13"],["\u24EE","14"],["\u24EF","15"],["\u24F0","16"],["\u24F1","17"],["\u24F2","18"],["\u24F3","19"],["\u24F4","20"],["\u24F5","1"],["\u24F6","2"],["\u24F7","3"],["\u24F8","4"],["\u24F9","5"],["\u24FA","6"],["\u24FB","7"],["\u24FC","8"],["\u24FD","9"],["\u24FE","10"],["\u24FF","0"],["\u{1F670}","&"],["\u{1F671}","&"],["\u{1F672}","&"],["\u{1F673}","&"],["\u{1F674}","&"],["\u{1F675}","&"],["\u{1F676}",'"'],["\u{1F677}",'"'],["\u{1F678}",'"'],["\u203D","?!"],["\u{1F679}","?!"],["\u{1F67A}","?!"],["\u{1F67B}","?!"],["\u{1F67C}","/"],["\u{1F67D}","\\"],["\u{1F707}","AR"],["\u{1F708}","V"],["\u{1F709}","V"],["\u{1F706}","VR"],["\u{1F705}","VF"],["\u{1F729}","2"],["\u{1F72A}","5"],["\u{1F761}","f"],["\u{1F762}","W"],["\u{1F763}","U"],["\u{1F767}","V"],["\u{1F768}","T"],["\u{1F76A}","V"],["\u{1F76B}","MB"],["\u{1F76C}","VB"],["\u{1F772}","3B"],["\u{1F773}","3B"],["\u{1F4AF}","100"],["\u{1F519}","BACK"],["\u{1F51A}","END"],["\u{1F51B}","ON!"],["\u{1F51C}","SOON"],["\u{1F51D}","TOP"],["\u{1F51E}","18"],["\u{1F524}","abc"],["\u{1F520}","ABCD"],["\u{1F521}","abcd"],["\u{1F522}","1234"],["\u{1F523}","T&@%"],["#\uFE0F\u20E3","#"],["*\uFE0F\u20E3","*"],["0\uFE0F\u20E3","0"],["1\uFE0F\u20E3","1"],["2\uFE0F\u20E3","2"],["3\uFE0F\u20E3","3"],["4\uFE0F\u20E3","4"],["5\uFE0F\u20E3","5"],["6\uFE0F\u20E3","6"],["7\uFE0F\u20E3","7"],["8\uFE0F\u20E3","8"],["9\uFE0F\u20E3","9"],["\u{1F51F}","10"],["\u{1F170}\uFE0F","A"],["\u{1F171}\uFE0F","B"],["\u{1F18E}","AB"],["\u{1F191}","CL"],["\u{1F17E}\uFE0F","O"],["\u{1F17F}","P"],["\u{1F198}","SOS"],["\u{1F172}","C"],["\u{1F173}","D"],["\u{1F174}","E"],["\u{1F175}","F"],["\u{1F176}","G"],["\u{1F177}","H"],["\u{1F178}","I"],["\u{1F179}","J"],["\u{1F17A}","K"],["\u{1F17B}","L"],["\u{1F17C}","M"],["\u{1F17D}","N"],["\u{1F180}","Q"],["\u{1F181}","R"],["\u{1F182}","S"],["\u{1F183}","T"],["\u{1F184}","U"],["\u{1F185}","V"],["\u{1F186}","W"],["\u{1F187}","X"],["\u{1F188}","Y"],["\u{1F189}","Z"],["\u2212","-"],["\u2053","-"]],P0=new Map(T0),dl=P0});var Um,Pi,fl,Jm=v(()=>{Um=[["\xE6","ae"],["\xC6","Ae"],["\xF8","oe"],["\xD8","Oe"],["\xE5","aa"],["\xC5","Aa"]],Pi={sv:[["\xE4","a"],["\xC4","A"],["\xF6","o"],["\xD6","O"],["\xE5","a"],["\xC5","A"]],da:Um,nb:Um,de:[["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xDF","ss"],["\u1E9E","Ss"]],tr:[["\xE2","a"],["\xC2","A"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"]],hu:[["\u0171","u"],["\u0170","U"],["\xF6","o"],["\xD6","O"],["\xFC","u"],["\xDC","U"],["\xE1","a"],["\xC1","A"],["\xE9","e"],["\xC9","E"],["\xED","i"],["\xCD","I"],["\xF3","o"],["\xD3","O"],["\xFA","u"],["\xDA","U"]],sr:[["\u0452","dj"],["\u0402","Dj"],["\u045F","dz"],["\u040F","Dz"],["\u0459","lj"],["\u0409","Lj"],["\u045A","nj"],["\u040A","Nj"],["\u045B","c"],["\u040B","C"],["\u0447","ch"],["\u0427","Ch"],["\u0448","sh"],["\u0428","Sh"],["\u0436","zh"],["\u0416","Zh"]]};for(let r of Object.keys(Pi))Pi[r]=new Map(Pi[r]);fl=Pi});function pl(r,e){if(typeof r!="string")throw new TypeError(`Expected a string, got \`${typeof r}\``);e={customReplacements:[],...e};let t=C0(e.locale),n=dl,s=e.customReplacements.length>0||e.customReplacements.size>0;if(t||s){if(n=new Map(dl),t)for(let[i,o]of t)n.set(i,o);for(let[i,o]of e.customReplacements)n.set(i,o)}return r=r.normalize(),r=O0(r,n),r=r.normalize("NFD").replaceAll(/\p{Diacritic}/gu,"").normalize(),r=r.replaceAll(/\p{Dash_Punctuation}/gu,"-"),r}var O0,C0,Km=v(()=>{qm();Jm();O0=(r,e)=>{for(let[t,n]of e)r=r.replaceAll(t,n);return r},C0=r=>{if(!r)return;let e=r.toLowerCase().replace(/^no(-|$)/,"nb$1");return fl[e]||fl[e.split("-")[0]]||void 0}});var R0,Hm,Wm=v(()=>{R0=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]],Hm=R0});function ml(r,e){if(typeof r!="string")throw new TypeError(`Expected a string, got \`${typeof r}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,preserveTrailingDash:!1,preserveCharacters:[],transliterate:!0,...e};let t=e.preserveLeadingUnderscore&&r.startsWith("_"),n=e.preserveTrailingDash&&r.endsWith("-");if(e.transliterate){let i=new Map([...Hm,...e.customReplacements]);r=pl(r,{customReplacements:i,locale:e.locale})}else if(e.customReplacements.length>0)for(let[i,o]of e.customReplacements)r=r.replaceAll(i,o);e.decamelize&&(r=_0(r));let s=I0(e);return e.lowercase&&(r=e.locale?r.toLocaleLowerCase(e.locale):r.toLowerCase()),r=r.replaceAll(/([a-zA-Z\d]+)['\u2019]([ts])(\s|$)/g,"$1$2$3"),r=r.replace(s,e.separator),r=r.replaceAll("\\",""),e.separator&&(r=N0(r,e.separator)),t&&(r=`_${r}`),n&&(r=`${r}-`),r}var _0,N0,I0,Ym=v(()=>{Fm();Km();Wm();_0=r=>r.replaceAll(/([A-Z]{2,})(\d+)/g,"$1 $2").replaceAll(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").replaceAll(/([A-Z]+)([A-Z][a-rt-z\d]+)/g,"$1 $2"),N0=(r,e)=>{let t=Ti(e);return r.replaceAll(new RegExp(`(?:${t}){2,}`,"g"),e).replaceAll(new RegExp(`^(?:${t})|(?:${t})$`,"g"),"")},I0=r=>{let e=String.raw`a-z\d`;if(e+=r.lowercase?"":"A-Z",r.transliterate===!1&&(e+=String.raw`\p{L}\p{N}`),r.preserveCharacters.length>0)for(let n of r.preserveCharacters){if(n===r.separator)throw new Error(`The separator character \`${r.separator}\` cannot be included in preserved characters: ${r.preserveCharacters}`);e+=Ti(n)}let t=r.transliterate?"g":"gu";return new RegExp(`[^${e}]+`,t)}});function vr(r){return ml(r)}var Vm=v(()=>{Ym()});var Ln,hl,zm=v(()=>{Ln=` *, *::before, *::after { box-sizing: border-box; }
|
|
167
167
|
canvas { max-width: 100%; }
|
|
168
168
|
body { margin: 0; display: flow-root; font-family: system-ui, -apple-system, sans-serif; }
|
|
169
169
|
html[data-theme="dark"] { color-scheme: dark; }
|
|
170
|
-
html[data-theme="light"] { color-scheme: light; }`,
|
|
171
|
-
\u2026[${r.length-5e4} more characters truncated]`:r}function
|
|
172
|
-
`).map(i=>i.trim()).filter(Boolean),t=e[0];if(!t)return"";let n=t.length>300?t.slice(0,300).trimEnd()+"\u2026":t,s=e.length-1;return s>0?`${n} (+${s} line${s===1?"":"s"})`:n}var
|
|
173
|
-
`):r==null?"":
|
|
174
|
-
`).length,"line")}`;if(t.mode==="content")return Ne(t.numLines??0,"line");if(t.mode==="count")return`${Ne(t.numMatches??0,"match","matches")} (${Ne(t.numFiles??0,"file")})`;if(t.mode==="files_with_matches")return Ne(t.numFiles??0,"file");if(Array.isArray(t.structuredPatch)){let n=0,s=0;for(let i of t.structuredPatch)for(let o of i?.lines??[])typeof o=="string"&&(o.startsWith("+")?n++:o.startsWith("-")&&s++);return`+${n} \u2212${s}`}return typeof t.stdout=="string"||typeof t.stderr=="string"?t.backgroundTaskId?"running in background":t.interrupted?"interrupted":
|
|
170
|
+
html[data-theme="light"] { color-scheme: light; }`,hl=" html, body { height: 100%; }"});var le=v(()=>{Es();Ea();Ld();jd();ul();jm();Vm();zm();As()});function Je(r){return r.length>5e4?r.slice(0,5e4)+`
|
|
171
|
+
\u2026[${r.length-5e4} more characters truncated]`:r}function Ze(r){let e=r.replace($0,"").split(`
|
|
172
|
+
`).map(i=>i.trim()).filter(Boolean),t=e[0];if(!t)return"";let n=t.length>300?t.slice(0,300).trimEnd()+"\u2026":t,s=e.length-1;return s>0?`${n} (+${s} line${s===1?"":"s"})`:n}var $0,Oi,Ci=v(()=>{$0=/\u001b\[[0-9;]*m/g;Oi=(r,e)=>``});import{existsSync as L0,readdirSync as M0,statSync as B0}from"fs";import{join as D0}from"path";function Ri(r){if(!L0(r))return[];let e;try{e=M0(r)}catch{return[]}let t=[];for(let n of e){if(!n.endsWith(".jsonl"))continue;let s=D0(r,n);try{let i=B0(s);i.isFile()&&t.push({sessionId:n.slice(0,-6),file:s,mtime:i.mtimeMs})}catch{}}return t}var yl=v(()=>{});var Sr,bl=v(()=>{Sr=class{ensureHarnessSupport(){}}});import{openSync as j0,readSync as F0,closeSync as q0,statSync as U0,readdirSync as J0,readFileSync as K0,existsSync as H0}from"fs";import{join as Bn}from"path";import{homedir as Sl}from"os";function W0(r){return r.replace(/[^a-zA-Z0-9]/g,"-")}function _i(r){let e=r?.type==="image"?r.source:void 0;return e?.type==="base64"&&e.data?Oi(e.data,e.media_type):""}function wl(r){return typeof r=="string"?Je(r):Array.isArray(r)?r.map(e=>{if(typeof e=="string")return Je(e);let t=e;return typeof t?.text=="string"?Je(t.text):t?.content!=null?wl(t.content):_i(t)}).join(`
|
|
173
|
+
`):r==null?"":Je(JSON.stringify(r))}function V0(r){let e=r.trim();return!!e&&eh.some(t=>t.test(e))}function z0(r){let e=r.trim();return e?eh.some(t=>{let n=t.exec(e);return!!n&&n.index===0}):!0}function X0(r){return r.replace(G0,"")}function Q0(r){let e=/^<command-name>([\s\S]*?)<\/command-name>/.exec(r)?.[1]?.trim();if(!e)return;let t=/<command-args>([\s\S]*?)<\/command-args>/.exec(r)?.[1]?.trim();return t?`${e} ${t}`:e}function wt(r){let e=X0(r).trim();return e?Q0(e)??(V0(e)?"":e):""}function vl(r){return r?.type==="text"&&typeof r.text=="string"?wt(r.text):""}function kl(r,e){if(typeof r=="string")return Ze(r);if(!r||typeof r!="object")return Ze(e);let t=r;if(t.type==="text"&&typeof t.file?.numLines=="number")return Ne(t.file.numLines,"line");if(t.type==="image"){let n=Qm(t.file?.originalSize);return n?`image (${n})`:"image"}if(t.type==="pdf"){let n=Qm(t.file?.originalSize);return n?`PDF (${n})`:"PDF"}if(t.type==="parts"&&typeof t.file?.count=="number")return Ne(t.file.count,"page");if(t.type==="file_unchanged")return"unchanged since last read";if(t.type==="create"&&typeof t.content=="string")return`created, ${Ne(t.content.split(`
|
|
174
|
+
`).length,"line")}`;if(t.mode==="content")return Ne(t.numLines??0,"line");if(t.mode==="count")return`${Ne(t.numMatches??0,"match","matches")} (${Ne(t.numFiles??0,"file")})`;if(t.mode==="files_with_matches")return Ne(t.numFiles??0,"file");if(Array.isArray(t.structuredPatch)){let n=0,s=0;for(let i of t.structuredPatch)for(let o of i?.lines??[])typeof o=="string"&&(o.startsWith("+")?n++:o.startsWith("-")&&s++);return`+${n} \u2212${s}`}return typeof t.stdout=="string"||typeof t.stderr=="string"?t.backgroundTaskId?"running in background":t.interrupted?"interrupted":Ze(t.stdout||t.stderr||"")||"no output":typeof t.code=="number"&&typeof t.codeText=="string"?`${t.code} ${t.codeText}`:typeof t.searchCount=="number"?Ne(t.searchCount,"search","searches"):Array.isArray(t.matches)&&typeof t.total_deferred_tools=="number"?Ne(t.matches.length,"tool"):Array.isArray(t.newTodos)?Ne(t.newTodos.length,"todo"):typeof t.numFiles=="number"?Ne(t.numFiles,"file"):Ze(e)}function Mn(r){return!!r.isSidechain||!!r.isMeta}function Z0(r){let e;try{e=j0(r,"r")}catch{return""}try{let n=65536;try{n=U0(r).size}catch{}let s=(l,d)=>{if(d<=0)return"";let u=Buffer.alloc(d),f=F0(e,u,0,d,l);return u.subarray(0,f).toString("utf8")},i=(l,d,u)=>{let f="";for(let p of l.split(`
|
|
175
175
|
`)){if(!p.includes(`"${d}"`))continue;let h;try{h=JSON.parse(p)}catch{continue}let m=h?.[u];h?.type===d&&typeof m=="string"&&m&&(f=m)}return f},o=s(0,Math.min(65536,n)),a=n>65536?s(n-65536,65536):"",c=i(a,"custom-title","customTitle")||i(o,"custom-title","customTitle")||i(a,"ai-title","aiTitle")||i(o,"ai-title","aiTitle");if(c)return c.replace(/\s+/g," ").trim().slice(0,200);for(let l of o.split(`
|
|
176
|
-
`)){if(!l.trim())continue;let d;try{d=JSON.parse(l)}catch{continue}if(!d
|
|
177
|
-
`),c=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||c.length){let u=Date.parse(e.timestamp??""),f=!isNaN(u)&&u>=t;n.push({type:"assistant",text:o,thinking:a,tools:c,live:f})}let l=e.message?.usage??e.usage,d=l&&{in:l.input_tokens??0,out:l.output_tokens??0,cached:l.cache_read_input_tokens??0,cacheCreate:l.cache_creation_input_tokens??0};return{events:n,usage:d,model:e.message?.model}}return{events:n}}chainWorking(e){let t;for(let o of e)(o.type==="user"||o.type==="assistant")&&(t=o);if(!t)return!1;if(t.type==="user"){try{let o=t.message?.content,a=typeof o=="string"?o:Array.isArray(o)?o.filter(l=>l&&l.type==="text").map(l=>l.text??"").join(""):"";if(!(Array.isArray(o)&&o.some(l=>l&&l.type==="tool_result"))&&a.trim()&&
|
|
178
|
-
`),n=[];if(t.forEach((o,a)=>{let c=
|
|
179
|
-
`)}function
|
|
176
|
+
`)){if(!l.trim())continue;let d;try{d=JSON.parse(l)}catch{continue}if(!d||Mn(d)||d.type!=="user")continue;let u=d.message?.content,f="";typeof u=="string"?f=wt(u):Array.isArray(u)&&(f=u.map(vl).filter(Boolean).join(" "));let p=f.replace(/\s+/g," ").trim();if(p)return(p.replace(/^Continuing from a prior session\. Here is the summary of our work so far:\s*/i,"").trim()||p).slice(0,200)}return""}finally{q0(e)}}function eE(r){let e;try{e=J0(Zm)}catch{return!1}for(let t of e)if(t.endsWith(".json"))try{let n=JSON.parse(K0(Bn(Zm,t),"utf8"));if(n?.sessionId!==r)continue;return process.kill(n.pid,0),!0}catch{}return!1}var Y0,Xm,eh,G0,Ne,Qm,Zm,kr,Ni=v(()=>{Ci();yl();bl();Y0=Bn(Sl(),".claude","projects"),Xm=r=>Bn(Y0,W0(r));eh=[/\[Request interrupted by user\b/i,/\[Tool use was interrupted\]/i,/Claude Code returned an error/i,/\[ede_diagnostic\]/i,/^No response requested\.?$/i,/^<task-notification\b/i,/^<system-reminder\b/i,/^<local-command-stdout\b/i,/^<local-command-stderr\b/i];G0=/<ide_[a-z_]+>[\s\S]*?<\/ide_[a-z_]+>/gi;Ne=(r,e,t=e+"s")=>`${r} ${r===1?e:t}`,Qm=r=>typeof r!="number"?"":r<1024?`${r}B`:r<1048576?`${Math.round(r/1024)}KB`:`${(r/1048576).toFixed(1)}MB`;Zm=Bn(Sl(),".claude","sessions");kr=class extends Sr{displayName="Claude Mirror";detectsSelf(){return process.env.CLAUDECODE==="1"}detectsInstalled(){return H0(Bn(Sl(),".claude"))}sessionsDir(e){return Xm(e)}listSessionFiles(e){return Ri(Xm(e))}parseEntry(e){try{return JSON.parse(e)}catch{return null}}idOf(e){return e.uuid}parentOf(e){return e.parentUuid}timestampOf(e){return e.timestamp}isSidechain(e){return!!e.isSidechain}isLeafType(e){return e.type==="user"||e.type==="assistant"}isRecoveryNoise(e){return!!e.isApiErrorMessage}apply(e,t){if(Mn(e))return{events:[]};let n=[];if(e.type==="user"){let s=e.message?.content;if(typeof s=="string"){let i=wt(s);i&&n.push({type:"user",text:i})}else if(Array.isArray(s))for(let i of s)if(i?.type==="tool_result"){let o=wl(i.content);n.push({type:"tool_result",id:i.tool_use_id??"",content:o,isError:!!i.is_error,digest:kl(e.toolUseResult,o)})}else{let o=vl(i)||_i(i);o&&n.push({type:"user",text:o})}return{events:n}}if(e.type==="attachment"&&e.attachment?.type==="queued_command"){let s=wt(wl(e.attachment.prompt));return s&&n.push({type:"user",text:s}),{events:n}}if(e.type==="assistant"){let s=e.message?.content,i=Array.isArray(s)?s:[],o=i.filter(u=>u.type==="text").map(u=>u.text??"").filter(u=>!z0(u)).join(""),a=i.filter(u=>u.type==="thinking").map(u=>u.thinking??"").join(`
|
|
177
|
+
`),c=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||c.length){let u=Date.parse(e.timestamp??""),f=!isNaN(u)&&u>=t;n.push({type:"assistant",text:o,thinking:a,tools:c,live:f})}let l=e.message?.usage??e.usage,d=l&&{in:l.input_tokens??0,out:l.output_tokens??0,cached:l.cache_read_input_tokens??0,cacheCreate:l.cache_creation_input_tokens??0};return{events:n,usage:d,model:e.message?.model}}return{events:n}}chainWorking(e){let t;for(let o of e)(o.type==="user"||o.type==="assistant")&&(t=o);if(!t)return!1;if(t.type==="user"){try{let o=t.message?.content,a=typeof o=="string"?o:Array.isArray(o)?o.filter(l=>l&&l.type==="text").map(l=>l.text??"").join(""):"";if(!(Array.isArray(o)&&o.some(l=>l&&l.type==="tool_result"))&&a.trim()&&wt(a)==="")return!1}catch{}return!0}let s=(Array.isArray(t.message?.content)?t.message.content:[]).filter(o=>o.type==="tool_use").map(o=>o.id);if(s.length===0)return!1;let i=new Set;for(let o of e){let a=o.message?.content;if(Array.isArray(a))for(let c of a)c.type==="tool_result"&&c.tool_use_id&&i.add(c.tool_use_id)}return s.some(o=>o&&!i.has(o))}sessionAlive(e){return eE(e)}readPreview(e){return Z0(e)}searchText(e){if(!e||Mn(e)||e.type!=="user"&&e.type!=="assistant")return"";let t=e.message?.content,n="";if(typeof t=="string")n=wt(t);else if(Array.isArray(t)){let s=t;n=e.type==="user"?s.map(vl).filter(Boolean).join(" "):s.filter(i=>i.type==="text"&&typeof i.text=="string").map(i=>i.text).join(" ")}return n.replace(/\s+/g," ").trim()}}});import{realpathSync as tE}from"fs";import{createHash as rE}from"crypto";import{join as Ii,resolve as nE}from"path";import{homedir as sE}from"os";function Ut(){let r=process.env.TYPEBULB_SERVERS_DIR;return r?Ii(r,".."):Ii(sE(),".typebulb")}function et(){return process.env.TYPEBULB_SERVERS_DIR||Ii(Ut(),"servers")}function th(r){let e=X(r),t=rE("sha1").update(e).digest("hex").slice(0,8),n=e.slice(e.lastIndexOf("/")+1).replace(/\.bulb\.md$/,"");return Ii(Ut(),"canvas",`${n}-${t}.png`)}function X(r){let e=nE(r),t=e;try{t=tE.native(e)}catch{}return(process.platform==="win32"?t.toLowerCase():t).replace(/\\/g,"/")}function rh(r,e){let t=X(r),n=X(e);return t.startsWith(n.endsWith("/")?n:n+"/")?!t.includes("/node_modules/"):!1}var xr=v(()=>{});var Ie,$i=v(()=>{Ie="0.47.0"});import{spawn as nh}from"child_process";import{readdir as iE,readFile as ih,writeFile as oh,unlink as xl,mkdir as oE}from"fs/promises";import{mkdirSync as ah,writeFileSync as Li,appendFileSync as aE,readFileSync as El}from"fs";import*as xe from"path";import{fileURLToPath as cE}from"url";function Al(r){return xe.join(et(),`${r}.json`)}function jn(r){return xe.join(et(),`${r}.log`)}function Tl(r){return xe.join(et(),`${r}.wait.json`)}function ch(r){try{let e=JSON.parse(El(Tl(r),"utf8"));return e.cursors&&typeof e.cursors=="object"?e.cursors:{}}catch{return{}}}function Pl(r,e=""){let t=ch(r)[e];return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0}function Mi(r,e,t=""){try{ah(et(),{recursive:!0});let n=ch(r);n[t]=e,Li(Tl(r),JSON.stringify({cursors:n}))}catch{}}function Bi(r){let e=jn(r);try{ah(et(),{recursive:!0}),Li(e,"")}catch{return()=>{}}let t=process.stdout.write.bind(process.stdout),n=process.stderr.write.bind(process.stderr),s=0,i=!1,o=a=>{if(!i)try{let c=typeof a=="string"?Buffer.from(a,"utf8"):Buffer.from(a);if(aE(e,c),s+=c.length,s>2*sh){let l=El(e),d=l.subarray(Math.max(0,l.length-sh));Li(e,d),s=d.length}}catch{i=!0}};return process.stdout.write=((a,...c)=>(o(a),t(a,...c))),process.stderr.write=((a,...c)=>(o(a),n(a,...c))),()=>{process.stdout.write=t,process.stderr.write=n}}function lh(r){try{Li(jn(r),"")}catch{}}function Ke(r,e=0){try{let t=El(jn(r)),n=e>=0&&e<=t.length?e:0;return{text:t.subarray(n).toString("utf8"),offset:t.length}}catch{return{text:"",offset:0}}}function Ol(r){return`\u2500\u2500 run ${r} \u2500\u2500 ${new Date().toTimeString().slice(0,8)}`}function uE(r){let e=lE.exec(r);return e?Number(e[1]):void 0}function uh(r,e){let t=r.split(`
|
|
178
|
+
`),n=[];if(t.forEach((o,a)=>{let c=uE(o);c!==void 0&&n.push({id:c,idx:a})}),!n.length)return e==="latest"?r:"";let s=e==="latest"?n[n.length-1]:n.find(o=>o.id===e);if(!s)return"";let i=n.find(o=>o.idx>s.idx);return t.slice(s.idx,i?i.idx:t.length).join(`
|
|
179
|
+
`)}function Cl(r){try{return process.kill(r,0),!0}catch(e){return e.code==="EPERM"}}async function dh(r){await oE(et(),{recursive:!0}),await oh(Al(r.pid),JSON.stringify({version:Ie,...r}))}async function fh(r,e){let t=Al(r);try{let n=JSON.parse(await ih(t,"utf8"));if(n.denied===e)return;n.denied=e,await oh(t,JSON.stringify(n))}catch{}}async function Dn(r){await xl(Al(r)).catch(()=>{}),await xl(jn(r)).catch(()=>{}),await xl(Tl(r)).catch(()=>{})}async function Q(r){let e;try{e=await iE(et())}catch{return[]}let t=[];return await Promise.all(e.map(async s=>{if(!/^\d+\.json$/.test(s))return;let i=parseInt(s,10),o;try{o=JSON.parse(await ih(xe.join(et(),s),"utf8"))}catch{await Dn(i);return}o&&typeof o.pid=="number"&&Cl(o.pid)?t.push(o):await Dn(i)})),(r?t.filter(s=>s.agent==null&&rh(s.file,r)):t).sort((s,i)=>s.startedAt-i.startedAt)}async function Rl(r,e){let t=X(r);return(await Q()).find(n=>n.cwd!=null&&X(n.cwd)===t&&(e?n.agent===e:n.agent!=null))}async function Jt(r){try{process.kill(r,"SIGTERM")}catch{}await Dn(r)}function Er(r,e){let t=X(e);return r.filter(n=>n.agent==null&&n.pid!==process.pid&&X(n.file)===t)}async function _l(r){let e=Er(await Q(),r);for(let t of e)await Jt(t.pid);return e}function fE(r,e,t){(process.platform==="win32"?nh("cmd",["/c","start","","/b",r,...e],{cwd:t,stdio:"ignore",windowsHide:!0}):nh(r,e,{cwd:t,detached:!0,stdio:"ignore"})).unref()}function ph(){return xe.join(xe.dirname(cE(import.meta.url)),"index.js")}function pE(r,e={}){return{command:process.execPath,args:[ph(),...e.trust?["--trust"]:[],...e.batch?["--batch",e.batch]:[],...e.mode?["--mode",e.mode]:[],r,...e.open===!1?["--no-open"]:[]]}}function mE(r){return{command:process.execPath,args:[ph(),`agent:${r}`,"--no-open"]}}async function mh(r,e,t,n){let s=await r();if(s)return s;fE(e.command,e.args,t);let i=Date.now()+2e4;for(;Date.now()<i;){await dE(150);let o=await r();if(o)return o}throw new Error(`Launched ${n} but it did not register within 20s.`)}async function Di(r,e={}){let t=e.cwd??process.cwd(),n=xe.resolve(t,r),[s]=await _l(n),i={...e,batch:e.batch??s?.batch,mode:e.mode??s?.mode};return mh(async()=>Er(await Q(),n)[0],pE(r,i),t,xe.basename(r))}async function hh(r,e=process.cwd()){return mh(()=>Rl(e,r),mE(r),e,`the ${r} mirror`)}var sh,lE,dE,$e=v(()=>{xr();$i();sh=1e6;lE=/^── run (\d+) ── /;dE=r=>new Promise(e=>setTimeout(e,r))});function Ar(r){return{...Cd(r),server:r.files.get("server.ts")??""}}function ji(r){return!!r.server&&!r.code}var Fn=v(()=>{le();le()});function Fi(r){let e=/^---[^\n]*\n([\s\S]*?)\n---/.exec(r),t=e?/^\s*name:\s*(.+?)\s*$/m.exec(e[1]):null;return t?t[1].replace(/^["']|["']$/g,""):void 0}function Nl(r){return vr(Fi(r)??"bulb")||"bulb"}var Il=v(()=>{le()});import{transform as hE}from"sucrase";function $l(r,e={}){let t=e.serverOnly?["typescript"]:["typescript","jsx"];try{let{code:n}=hE(r,{transforms:t,jsxRuntime:"automatic",jsxImportSource:e.jsxImportSource||"react",production:!0});return{code:n}}catch(n){return{code:"",error:String(n)}}}var gh=v(()=>{});function Ll(r){let e=r.split(""),t=(i,o)=>{for(let a=i;a<o&&a<e.length;a++)e[a]!==`
|
|
180
180
|
`&&(e[a]=" ")},n=0,s="";for(;n<r.length;){let i=r[n],o=r[n+1];if(i==="/"&&o==="/"){let a=n;for(;a<r.length&&r[a]!==`
|
|
181
|
-
`;)a++;t(n,a),n=a}else if(i==="/"&&o==="*"){let a=n+2;for(;a<r.length&&!(r[a]==="*"&&r[a+1]==="/");)a++;t(n,Math.min(a+2,r.length)),n=a+2}else if(i==="/"&&
|
|
181
|
+
`;)a++;t(n,a),n=a}else if(i==="/"&&o==="*"){let a=n+2;for(;a<r.length&&!(r[a]==="*"&&r[a+1]==="/");)a++;t(n,Math.min(a+2,r.length)),n=a+2}else if(i==="/"&&gE.has(s)){let a=n+1,c=!1;for(;a<r.length&&r[a]!==`
|
|
182
182
|
`;){let l=r[a];if(l==="\\")a++;else if(l==="[")c=!0;else if(l==="]")c=!1;else if(l==="/"&&!c)break;a++}n=a+1,s="/"}else if(i==='"'||i==="'"){let a=n+1;for(;a<r.length&&r[a]!==i&&r[a]!==`
|
|
183
|
-
`;)r[a]==="\\"&&a++,a++;n=a+1,s=i}else if(i==="`"){let a=
|
|
184
|
-
`).length-1}));return n}function
|
|
185
|
-
`),a=
|
|
186
|
-
`);for(let c=0;c<o.length;c++){let l=a[c],d=c+1+s;for(let u of
|
|
187
|
-
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+n;return{type:"UNDECLARED_IMPORT",severity:"error",message:
|
|
183
|
+
`;)r[a]==="\\"&&a++,a++;n=a+1,s=i}else if(i==="`"){let a=yh(r,n);t(n,a),n=a,s="`"}else/\s/.test(i)||(s=i),n++}return e.join("")}function yh(r,e){let t=e+1,n=0;for(;t<r.length;){let s=r[t];if(s==="\\"){t+=2;continue}if(s==="`"){if(n===0)return t+1;t=yh(r,t);continue}if(s==="$"&&r[t+1]==="{"){n++,t+=2;continue}if(s==="}"&&n>0){n--,t++;continue}t++}return r.length}var gE,bh=v(()=>{gE=new Set(["","(",",","=",":","[","!","&","|","?",";","{"])});function wE(r){if(/^[./]/.test(r)||/^[a-z][a-z0-9+.-]*:/i.test(r))return null;let e=r.split("/");return r.startsWith("@")?e.slice(0,2).join("/"):e[0]}function wh(r){let e=[];for(let s of bE)for(let i of r.matchAll(s)){let o=wE(i[1]);o&&e.push({root:o,index:i.index??0})}e.sort((s,i)=>s.index-i.index);let t=new Set,n=[];for(let{root:s,index:i}of e)t.has(s)||(t.add(s),n.push({root:s,lineIndex:r.slice(0,i).split(`
|
|
184
|
+
`).length-1}));return n}function vh(r){return wh(Ll(r)).map(e=>e.root)}function qn(r,e){if(!r)return[];let{target:t,dependencies:n}=e,s=(e.lineOffset??1)-1,i=[],o=r.split(`
|
|
185
|
+
`),a=Ll(r).split(`
|
|
186
|
+
`);for(let c=0;c<o.length;c++){let l=a[c],d=c+1+s;for(let u of yE)u.targets.includes(t)&&u.pattern.test(l)&&i.push({type:u.type,severity:"error",message:kE(u.type,d),lineNumber:d,lineContent:o[c]})}return t==="client"&&n&&i.push(...vE(a,o,n,s)),i}function vE(r,e,t,n){let s=new Set(Object.keys(t));return wh(r.join(`
|
|
187
|
+
`)).filter(({root:i})=>!s.has(i)).map(({root:i,lineIndex:o})=>{let a=o+1+n;return{type:"UNDECLARED_IMPORT",severity:"error",message:SE(i,a),lineNumber:a,lineContent:e[o]}})}function SE(r,e){return`Import "${r}" is not declared in config.json dependencies! Found on line ${e}.
|
|
188
188
|
|
|
189
189
|
**CRITICAL**: Every bare import in code.tsx must be declared in the **config.json** "dependencies" block. A bulb that imports a package it doesn't declare is incomplete \u2014 it won't type-check, its versions aren't pinned, and it can't be reliably re-run or ported to typebulb.com.
|
|
190
190
|
|
|
@@ -198,7 +198,7 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
198
198
|
}
|
|
199
199
|
\`\`\`
|
|
200
200
|
|
|
201
|
-
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${r}" \u2014 and for every other bare import in code.tsx. Pin a real version where you can (e.g. "react": "^19.2.7").`}function
|
|
201
|
+
**Fix:** Add a **config.json** block (or extend the existing one) with a "dependencies" entry for "${r}" \u2014 and for every other bare import in code.tsx. Pin a real version where you can (e.g. "react": "^19.2.7").`}function kE(r,e){return r==="URL_IMPORT"?`Direct URL imports are not supported! Found on line ${e}.
|
|
202
202
|
|
|
203
203
|
**CRITICAL**: Import packages by name only. Do NOT use CDN URLs:
|
|
204
204
|
|
|
@@ -352,18 +352,18 @@ import { something } from 'module-name'
|
|
|
352
352
|
const something = require('module-name') // NOT SUPPORTED!
|
|
353
353
|
\`\`\`
|
|
354
354
|
|
|
355
|
-
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var
|
|
355
|
+
**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var Kt,Ht,yE,bE,qi=v(()=>{bh();Kt=["client"],Ht=["client","server"],yE=[{type:"DYNAMIC_IMPORT",pattern:/\bimport\s*\(\s*['"`]/,targets:Kt},{type:"COMMONJS_REQUIRE",pattern:/\brequire\s*\(\s*['"`]/,targets:Ht},{type:"JS_EXTENSION_IMPORT",pattern:/from\s+['"][^'"]*\/[^'"]*\.js['"]/,targets:Kt},{type:"URL_IMPORT",pattern:/from\s+['"]https?:\/\//,targets:Kt},{type:"VERSION_SPECIFIER_IMPORT",pattern:/from\s+['"][^'"]*@[\d^~]/,targets:Kt},{type:"REDUNDANT_TB_DECLARATION",pattern:/declare\s+(const|var|let)\s+tb\b/,targets:Ht},{type:"CONST_ENUM",pattern:/\bconst\s+enum\b/,targets:Ht},{type:"NAMESPACE_DECLARATION",pattern:/\bnamespace\s+\w+/,targets:Ht},{type:"COMMONJS_EXPORT_EQUALS",pattern:/\bexport\s*=/,targets:Ht},{type:"COMMONJS_IMPORT_EQUALS",pattern:/\bimport\s+\w+\s*=/,targets:Ht},{type:"MODULE_DECLARATION",pattern:/\bmodule\s+\w+\s*\{/,targets:Ht},{type:"CSS_FILE_IMPORT",pattern:/(?:from|import)\s+['"][^'"]*\.css['"]/,targets:Kt},{type:"NAVIGATION",pattern:/window\.(location\.(reload|assign|replace)\s*\(|open\s*\()/,targets:Kt},{type:"NAVIGATION",pattern:/window\.location(\.href)?\s*=[^=]/,targets:Kt}],bE=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});function xE(r){return r.map(e=>`${e.type} (line ${e.lineNumber}): ${e.message.split(`
|
|
356
356
|
`)[0]}`).join(`
|
|
357
|
-
`)}function
|
|
358
|
-
${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="https://cdn.jsdelivr.net/npm/",Il="https://data.jsdelivr.com/v1/package/npm/"});function wh(r){let e=(r||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var j,Er,vh,Jn=v(()=>{Un();j=class r{constructor(e,t,n){let s=typeof e=="string"?r.parse(e):e;this.name=s.name,this.version=Er(t??s.version),this.subpath=Er(n??s.subpath)}static parse(e){let t=wh(e||"");if(!t.length)return new r({name:""});if(t[0].startsWith("@")){let s=t[0],[i,o]=vh(t[1]??""),a=Er(t.slice(2).join("/"));return new r({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=vh(t[0]),o=Er(t.slice(1).join("/"));return new r({name:s,version:i,subpath:o})}}static fromUrl(e){try{let t=new URL(e),n=new URL(wt).host,s=new URL(qn).host;if(t.host===n){let i=wh(t.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return r.parse(o)}if(t.host===s){let i=t.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return r.parse(o)}return}catch{return}}format(){let e=this.version?`${this.name}@${this.version}`:this.name;return this.subpath?`${e}/${this.subpath}`:e}root(){return this.name}static rootOf(e){return r.parse(e).name}withVersion(e){return new r({name:this.name,version:Er(e),subpath:this.subpath})}static isBare(e){if(!e||e.startsWith(".")||e.startsWith("/"))return!1;let t=e.toLowerCase();return!t.startsWith("http://")&&!t.startsWith("https://")}},Er=r=>r&&r.length?r:void 0,vh=r=>{let e=r.indexOf("@");return e<0?[r,void 0]:[r.slice(0,e),Er(r.slice(e+1))]}});async function ye(r){try{return await r()}catch{return}}var ji=v(()=>{});function Jt(r){let e=r||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function $l(r){return r.startsWith("./")?r:`./${r}`}var Kn,Ll=v(()=>{Jn();ji();Un();Kn=class{constructor(e,t){this.cache=e,this.http=t,this.pinMs=1e4,this.versionsIndexMs=1440*60*1e3,this.metaTtlMs=10080*60*1e3,this.pinCache=new Map}baseDir(e){let t=typeof e=="string"?new j(e):e;return`${qn}${t.name}${t.version?`@${t.version}`:""}/`}file(e,t){return new URL(Jt(t),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,t={}){let{target:n="es2022",bundle:s=!1,external:i}=t,o=new URLSearchParams({target:n});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${wt}/${e}?${o.toString()}`}async resolveExactVersion(e){let t=Date.now(),n=this.pinCache.get(e);if(n&&t-n.ts<this.pinMs)return n.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${wt}/${e}`]);return this.pinCache.set(e,{value:s,ts:t}),s}async tryResolveFromUrls(e){for(let t of e){let n=await ye(()=>this.http.head(t)),s=this.parseVersionFromUrl(n?.url||t);if(s)return s}}async fetchVersionsIndex(e){if(await this.cache.isNegative(e))return;let t=await this.cache.getIndex(e);if(t&&Date.now()-t.updatedAt<this.versionsIndexMs)return{versions:t.versions,distTags:t.distTags};let n=await ye(()=>this.http.getJson(`${Il}${encodeURIComponent(e)}`));if(!n?.versions?.length){await this.cache.recordNegative(e);return}await this.cache.clearNegative(e);let s=n.tags&&Object.keys(n.tags).length?n.tags:void 0;return await this.cache.setIndex(e,n.versions,s),{versions:n.versions,distTags:s}}parseVersionFromUrl(e){let t=j.fromUrl(e)?.version;return t&&/\d+\.\d+\.\d+/.test(t)?t:void 0}async fetchPackageMeta(e,t){let n=await this.cache.getMeta(e,t);if(n&&Date.now()-n.updatedAt<this.metaTtlMs){let{dependencies:d,peerDependencies:u,peerDependenciesMeta:f}=n;return{name:e,version:t,dependencies:d,peerDependencies:u,peerDependenciesMeta:f}}let s=this.packageJson(new j(`${e}@${t}`)),i=await ye(()=>this.http.getJson(s));if(!i)return;let o=d=>d&&Object.keys(d).length?d:void 0,a=o(i.dependencies),c=o(i.peerDependencies),l=o(i.peerDependenciesMeta);return await this.cache.setMeta(e,t,a,c,l),{name:e,version:t,dependencies:a,peerDependencies:c,peerDependenciesMeta:l}}}});var Sh,Hn,Ml,wE,Wn,Fi=v(()=>{Sh=r=>r.startsWith("@types/"),Hn=r=>Object.keys(r?.peerDependencies||{}).filter(e=>!Sh(e)),Ml=r=>Object.keys(r?.dependencies||{}).filter(e=>!Sh(e)),wE=r=>Hn(r).filter(e=>!r?.peerDependenciesMeta?.[e]?.optional),Wn=class{constructor(e){this.cdn=e}async resolve(e,t){let n=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(n,t),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:t,version:n})=>({name:t,version:n,meta:await this.cdn.fetchPackageMeta(t,n)})))}async expandWithPeers(e,t){let n=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of wE(i.meta))!n.has(o)&&!s.some(a=>a.name===o)&&s.push({name:o,requiredBy:i.name});for(let{name:i,requiredBy:o}of s)try{let a=await t(i),c=await this.cdn.fetchPackageMeta(i,a);n.set(i,{name:i,version:a,meta:c})}catch(a){console.warn(`[typebulb] Failed to resolve peer "${i}" for "${o}":`,a)}return{allRoots:[...n.values()],autoAddedPeers:s.filter(i=>n.has(i.name))}}computeFlags(e){let t=new Set(e.flatMap(i=>Hn(i.meta))),n=new Map;for(let i of e)for(let o of Ml(i.meta))n.set(o,(n.get(o)||0)+1);let s=new Set([...n.entries()].filter(([,i])=>i>=2).map(([i])=>i));return new Map(e.map(i=>[i.name,{isPeerRoot:t.has(i.name),hasPeers:Hn(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var Yn,Bl=v(()=>{Jn();ji();Yn=class{constructor(e,t,n){this.cache=e,this.cdn=t,this.semver=n}async learnExactVersion(e){let t=await ye(()=>this.cdn.fetchVersionsIndex(e));if(t?.versions?.length){let n=this.semver.selectBestVersion(t.versions,{distTags:t.distTags});if(n)return n}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,t){if(!t)return this.learnExactVersion(e);let n=await this.cache.getPinnedExact(e,t);if(n){if(this.semver.isExactVersion(n))return n;console.debug("[typebulb] cached version for",e,"is not exact (",n,"); re-resolving from registry")}let s=async o=>{if(o&&this.semver.isExactVersion(o))return await this.cache.setPinnedExact(e,t,o),o},i=await ye(()=>this.cdn.fetchVersionsIndex(e));if(i?.versions?.length){let o=this.semver.selectBestVersion(i.versions,{range:t,distTags:i.distTags});if(o){let a=await s(o);if(a)return a}else{console.debug("[typebulb] refreshing version cache for",e,"(",t,"not in cached set \u2014 likely a new release)"),await this.cache.invalidateVersionsCache(e);let a=await ye(()=>this.cdn.fetchVersionsIndex(e));if(a?.versions?.length){let c=await s(this.semver.selectBestVersion(a.versions,{range:t,distTags:a.distTags}));if(c)return c}}}return s(await this.cdn.resolveExactVersion(`${e}@${t}`))}async effectivePackage(e,t){let n=new j(e),s=n.root(),i=t[s],o=i?await ye(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?n.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as vE,parse as SE}from"es-module-lexer";var Ar,Dl=v(()=>{Jn();Un();Fi();Ar=class r{constructor(e,t,n){this.version=e,this.cdn=t,this.peer=n}extractImportsSync(e){let t=new Set;for(let n of r.importPatterns){n.lastIndex=0;for(let s of e.matchAll(n))j.isBare(s[1])&&t.add(s[1])}return Array.from(t)}async extractImports(e){let t=new Set,n=s=>{j.isBare(s)&&t.add(s)};try{await vE;let[s]=SE(e);s.forEach(i=>n(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(t)}async buildImportMap(e,t,n){let s=(await this.extractImports(e)).filter(u=>!n?.has(j.rootOf(u))),i=[...new Set(s.map(j.rootOf))],o=await Promise.all(i.map(async u=>({name:u,version:await this.resolveVersion(u,t)}))),{allRoots:a,flags:c,autoAddedPeers:l}=await this.peer.resolve(o,u=>this.resolveVersion(u,t)),d=this.buildEntries([...s,...l.map(u=>u.name)],a,c);return{importMap:{imports:Object.fromEntries(d)},prefetchUrls:d.map(([,u])=>u)}}async resolveVersion(e,t){let n=t[e],s=await this.version.resolveExactForRoot(e,n);if(!s)throw new Error(`Cannot resolve ${n?`${e}@${n}`:e}: no matching version is published (the package or version may not exist, or the registry was unreachable).`);return s}buildEntries(e,t,n){let s=new Map(t.map(p=>[p.name,p])),i=p=>{let h=s.get(j.rootOf(p));return new j(p).withVersion(h.version).format()},o=new Set([...n.entries()].filter(([,p])=>p.isPeerRoot||p.isSharedDep).map(([p])=>p)),a=new Set(e.filter(p=>p!==j.rootOf(p)).map(j.rootOf)),c=[],l=new Set,d=new Set(e.filter(p=>p===j.rootOf(p))),u=new Set;for(let p of e){let h=j.rootOf(p),m=s.get(h),{isPeerRoot:b,hasPeers:A,isSharedDep:w}=n.get(h),O=a.has(h),R=p!==h,_=!(b||w)&&(O||!A),$=this.singletonDepsOf(m,o),E=R&&d.has(h);E&&u.add(h);let M=E?[...$,h]:$.length?$:void 0;c.push([p,this.cdn.buildEsmUrl(i(p),{bundle:_,external:M})]),l.add(p)}let f=new Set([...o,...u]);for(let p of f)s.has(p)&&(l.has(p)||c.push([p,this.cdn.buildEsmUrl(i(p),{})]),c.push([`${p}/`,`${wt}/${i(p)}/`]));return c}singletonDepsOf(e,t){return[...new Set([...Hn(e.meta),...Ml(e.meta)])].filter(n=>t.has(n))}};Ar.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as kh,satisfies as kE,maxSatisfying as xh,major as xE,valid as EE}from"semver";var qi,Kt,jl=v(()=>{qi=class{cmp(e,t){return e===t?0:kh(e,t)?1:kh(t,e)?-1:0}satisfies(e,t){return!e||!e.trim()?!0:!!kE(t,e,{includePrerelease:!0})}selectBestVersion(e,t){if(!e?.length)return;let n=t?.range?.trim()||"*",s=t?.preferStable??!0,i=t?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(n,i))return i;if(s){let a=xh(e,n,{includePrerelease:!1});if(a)return a}return xh(e,n,{includePrerelease:!0})??void 0}majorOf(e){return xE(e)}isExactVersion(e){return EE(e)!==null}},Kt=new qi});function AE(r){return Math.min(9e5*Math.pow(2,Math.max(0,r-1)),864e5)}var Ht,Eh=v(()=>{ji();Ht=class{constructor(e){this.store=e}async isNegative(e){let t=await ye(()=>this.store.get(e));return!!t&&t.until>Date.now()}async recordNegative(e){let n=((await ye(()=>this.store.get(e)))?.attempts||0)+1;await ye(()=>this.store.set(e,{until:Date.now()+AE(n),attempts:n}))}async clearNegative(e){await ye(()=>this.store.delete(e))}}});function Ah(r,e){let t=new Kn(r,e),n=new Wn(t),s=new Yn(r,t,Kt);return{packageService:new Ar(s,t,n),versionResolver:s,cdnClient:t,peerResolver:n}}var et=v(()=>{Ll();Fi();Bl();Dl();jl();Jn();jl();Un();Ll();Fi();Bl();Dl();Eh()});import*as Fl from"fs/promises";import*as Th from"crypto";function $e(r){return Th.createHash("sha1").update(r).digest("hex")}async function tt(r){try{return JSON.parse(await Fl.readFile(r,"utf8"))}catch{return}}async function Ui(r){try{return await Fl.readFile(r,"utf8")}catch{return}}var Tr=v(()=>{});import*as St from"fs/promises";import*as rt from"path";import*as Ph from"os";function Z(){return ql||(ql=OE()),ql}function Ki(r,e){return rt.join(TE,$e(r),e)}async function OE(){await St.mkdir(vt,{recursive:!0});let r=rt.join(vt,"version.json");if((await tt(r))?.version===Oh)return;let t=await St.readdir(vt).catch(()=>[]);await Promise.all(t.map(n=>St.rm(rt.join(vt,n),{recursive:!0,force:!0}))),await St.writeFile(r,JSON.stringify({version:Oh})+`
|
|
359
|
-
`,"utf8")}var
|
|
357
|
+
`)}function Sh(r,e){let t=qn(r,{target:"client",dependencies:e}).filter(n=>n.type==="UNDECLARED_IMPORT");if(t.length)throw new Error(`Lint failed:
|
|
358
|
+
${xE(t)}`)}var kh=v(()=>{qi()});var vt,Un,Ml,Jn=v(()=>{vt="https://esm.sh",Un="https://cdn.jsdelivr.net/npm/",Ml="https://data.jsdelivr.com/v1/package/npm/"});function xh(r){let e=(r||"").replace(/^\/+/,"").replace(/\/+$/,"");return e?e.split("/"):[]}var j,Tr,Eh,Kn=v(()=>{Jn();j=class r{constructor(e,t,n){let s=typeof e=="string"?r.parse(e):e;this.name=s.name,this.version=Tr(t??s.version),this.subpath=Tr(n??s.subpath)}static parse(e){let t=xh(e||"");if(!t.length)return new r({name:""});if(t[0].startsWith("@")){let s=t[0],[i,o]=Eh(t[1]??""),a=Tr(t.slice(2).join("/"));return new r({name:`${s}/${i}`,version:o,subpath:a})}else{let[s,i]=Eh(t[0]),o=Tr(t.slice(1).join("/"));return new r({name:s,version:i,subpath:o})}}static fromUrl(e){try{let t=new URL(e),n=new URL(vt).host,s=new URL(Un).host;if(t.host===n){let i=xh(t.pathname.replace(/^\/v\d+\//,"/"));if(!i.length)return;let o=i[0].startsWith("@")?`${i[0]}/${i[1]??""}`:i[0];return r.parse(o)}if(t.host===s){let i=t.pathname.split("/npm/")[1];if(!i)return;let o=i.split("/")[0]||"";return r.parse(o)}return}catch{return}}format(){let e=this.version?`${this.name}@${this.version}`:this.name;return this.subpath?`${e}/${this.subpath}`:e}root(){return this.name}static rootOf(e){return r.parse(e).name}withVersion(e){return new r({name:this.name,version:Tr(e),subpath:this.subpath})}static isBare(e){if(!e||e.startsWith(".")||e.startsWith("/"))return!1;let t=e.toLowerCase();return!t.startsWith("http://")&&!t.startsWith("https://")}},Tr=r=>r&&r.length?r:void 0,Eh=r=>{let e=r.indexOf("@");return e<0?[r,void 0]:[r.slice(0,e),Tr(r.slice(e+1))]}});async function ye(r){try{return await r()}catch{return}}var Ui=v(()=>{});function Wt(r){let e=r||"";return e.startsWith("./")?e.slice(2):e.replace(/^\/+/,"")}function Bl(r){return r.startsWith("./")?r:`./${r}`}var Hn,Dl=v(()=>{Kn();Ui();Jn();Hn=class{constructor(e,t){this.cache=e,this.http=t,this.pinMs=1e4,this.versionsIndexMs=1440*60*1e3,this.metaTtlMs=10080*60*1e3,this.pinCache=new Map}baseDir(e){let t=typeof e=="string"?new j(e):e;return`${Un}${t.name}${t.version?`@${t.version}`:""}/`}file(e,t){return new URL(Wt(t),this.baseDir(e)).toString()}packageJson(e){return this.file(e,"package.json")}buildEsmUrl(e,t={}){let{target:n="es2022",bundle:s=!1,external:i}=t,o=new URLSearchParams({target:n});return s&&o.append("bundle",""),i?.length&&o.append("external",i.join(",")),`${vt}/${e}?${o.toString()}`}async resolveExactVersion(e){let t=Date.now(),n=this.pinCache.get(e);if(n&&t-n.ts<this.pinMs)return n.value;let s=await this.tryResolveFromUrls([this.buildEsmUrl(e),`${vt}/${e}`]);return this.pinCache.set(e,{value:s,ts:t}),s}async tryResolveFromUrls(e){for(let t of e){let n=await ye(()=>this.http.head(t)),s=this.parseVersionFromUrl(n?.url||t);if(s)return s}}async fetchVersionsIndex(e){if(await this.cache.isNegative(e))return;let t=await this.cache.getIndex(e);if(t&&Date.now()-t.updatedAt<this.versionsIndexMs)return{versions:t.versions,distTags:t.distTags};let n=await ye(()=>this.http.getJson(`${Ml}${encodeURIComponent(e)}`));if(!n?.versions?.length){await this.cache.recordNegative(e);return}await this.cache.clearNegative(e);let s=n.tags&&Object.keys(n.tags).length?n.tags:void 0;return await this.cache.setIndex(e,n.versions,s),{versions:n.versions,distTags:s}}parseVersionFromUrl(e){let t=j.fromUrl(e)?.version;return t&&/\d+\.\d+\.\d+/.test(t)?t:void 0}async fetchPackageMeta(e,t){let n=await this.cache.getMeta(e,t);if(n&&Date.now()-n.updatedAt<this.metaTtlMs){let{dependencies:d,peerDependencies:u,peerDependenciesMeta:f}=n;return{name:e,version:t,dependencies:d,peerDependencies:u,peerDependenciesMeta:f}}let s=this.packageJson(new j(`${e}@${t}`)),i=await ye(()=>this.http.getJson(s));if(!i)return;let o=d=>d&&Object.keys(d).length?d:void 0,a=o(i.dependencies),c=o(i.peerDependencies),l=o(i.peerDependenciesMeta);return await this.cache.setMeta(e,t,a,c,l),{name:e,version:t,dependencies:a,peerDependencies:c,peerDependenciesMeta:l}}}});var Ah,Wn,jl,EE,Yn,Ji=v(()=>{Ah=r=>r.startsWith("@types/"),Wn=r=>Object.keys(r?.peerDependencies||{}).filter(e=>!Ah(e)),jl=r=>Object.keys(r?.dependencies||{}).filter(e=>!Ah(e)),EE=r=>Wn(r).filter(e=>!r?.peerDependenciesMeta?.[e]?.optional),Yn=class{constructor(e){this.cdn=e}async resolve(e,t){let n=await this.fetchMeta(e),{allRoots:s,autoAddedPeers:i}=await this.expandWithPeers(n,t),o=this.computeFlags(s);return{allRoots:s,flags:o,autoAddedPeers:i}}async fetchMeta(e){return Promise.all(e.map(async({name:t,version:n})=>({name:t,version:n,meta:await this.cdn.fetchPackageMeta(t,n)})))}async expandWithPeers(e,t){let n=new Map(e.map(i=>[i.name,i])),s=[];for(let i of e)for(let o of EE(i.meta))!n.has(o)&&!s.some(a=>a.name===o)&&s.push({name:o,requiredBy:i.name});for(let{name:i,requiredBy:o}of s)try{let a=await t(i),c=await this.cdn.fetchPackageMeta(i,a);n.set(i,{name:i,version:a,meta:c})}catch(a){console.warn(`[typebulb] Failed to resolve peer "${i}" for "${o}":`,a)}return{allRoots:[...n.values()],autoAddedPeers:s.filter(i=>n.has(i.name))}}computeFlags(e){let t=new Set(e.flatMap(i=>Wn(i.meta))),n=new Map;for(let i of e)for(let o of jl(i.meta))n.set(o,(n.get(o)||0)+1);let s=new Set([...n.entries()].filter(([,i])=>i>=2).map(([i])=>i));return new Map(e.map(i=>[i.name,{isPeerRoot:t.has(i.name),hasPeers:Wn(i.meta).length>0,isSharedDep:s.has(i.name)}]))}}});var Vn,Fl=v(()=>{Kn();Ui();Vn=class{constructor(e,t,n){this.cache=e,this.cdn=t,this.semver=n}async learnExactVersion(e){let t=await ye(()=>this.cdn.fetchVersionsIndex(e));if(t?.versions?.length){let n=this.semver.selectBestVersion(t.versions,{distTags:t.distTags});if(n)return n}return this.cdn.resolveExactVersion(e)}async resolveExactForRoot(e,t){if(!t)return this.learnExactVersion(e);let n=await this.cache.getPinnedExact(e,t);if(n){if(this.semver.isExactVersion(n))return n;console.debug("[typebulb] cached version for",e,"is not exact (",n,"); re-resolving from registry")}let s=async o=>{if(o&&this.semver.isExactVersion(o))return await this.cache.setPinnedExact(e,t,o),o},i=await ye(()=>this.cdn.fetchVersionsIndex(e));if(i?.versions?.length){let o=this.semver.selectBestVersion(i.versions,{range:t,distTags:i.distTags});if(o){let a=await s(o);if(a)return a}else{console.debug("[typebulb] refreshing version cache for",e,"(",t,"not in cached set \u2014 likely a new release)"),await this.cache.invalidateVersionsCache(e);let a=await ye(()=>this.cdn.fetchVersionsIndex(e));if(a?.versions?.length){let c=await s(this.semver.selectBestVersion(a.versions,{range:t,distTags:a.distTags}));if(c)return c}}}return s(await this.cdn.resolveExactVersion(`${e}@${t}`))}async effectivePackage(e,t){let n=new j(e),s=n.root(),i=t[s],o=i?await ye(()=>this.resolveExactForRoot(s,i)):void 0;return{effectivePackage:o?n.withVersion(o).format():e,root:s,range:i,pinned:o}}}});import{init as AE,parse as TE}from"es-module-lexer";var Pr,ql=v(()=>{Kn();Jn();Ji();Pr=class r{constructor(e,t,n){this.version=e,this.cdn=t,this.peer=n}extractImportsSync(e){let t=new Set;for(let n of r.importPatterns){n.lastIndex=0;for(let s of e.matchAll(n))j.isBare(s[1])&&t.add(s[1])}return Array.from(t)}async extractImports(e){let t=new Set,n=s=>{j.isBare(s)&&t.add(s)};try{await AE;let[s]=TE(e);s.forEach(i=>n(e.slice(i.s,i.e).trim()))}catch{return this.extractImportsSync(e)}return Array.from(t)}async buildImportMap(e,t,n){let s=(await this.extractImports(e)).filter(u=>!n?.has(j.rootOf(u))),i=[...new Set(s.map(j.rootOf))],o=await Promise.all(i.map(async u=>({name:u,version:await this.resolveVersion(u,t)}))),{allRoots:a,flags:c,autoAddedPeers:l}=await this.peer.resolve(o,u=>this.resolveVersion(u,t)),d=this.buildEntries([...s,...l.map(u=>u.name)],a,c);return{importMap:{imports:Object.fromEntries(d)},prefetchUrls:d.map(([,u])=>u)}}async resolveVersion(e,t){let n=t[e],s=await this.version.resolveExactForRoot(e,n);if(!s)throw new Error(`Cannot resolve ${n?`${e}@${n}`:e}: no matching version is published (the package or version may not exist, or the registry was unreachable).`);return s}buildEntries(e,t,n){let s=new Map(t.map(p=>[p.name,p])),i=p=>{let h=s.get(j.rootOf(p));return new j(p).withVersion(h.version).format()},o=new Set([...n.entries()].filter(([,p])=>p.isPeerRoot||p.isSharedDep).map(([p])=>p)),a=new Set(e.filter(p=>p!==j.rootOf(p)).map(j.rootOf)),c=[],l=new Set,d=new Set(e.filter(p=>p===j.rootOf(p))),u=new Set;for(let p of e){let h=j.rootOf(p),m=s.get(h),{isPeerRoot:b,hasPeers:A,isSharedDep:w}=n.get(h),P=a.has(h),R=p!==h,_=!(b||w)&&(P||!A),$=this.singletonDepsOf(m,o),E=R&&d.has(h);E&&u.add(h);let M=E?[...$,h]:$.length?$:void 0;c.push([p,this.cdn.buildEsmUrl(i(p),{bundle:_,external:M})]),l.add(p)}let f=new Set([...o,...u]);for(let p of f)s.has(p)&&(l.has(p)||c.push([p,this.cdn.buildEsmUrl(i(p),{})]),c.push([`${p}/`,`${vt}/${i(p)}/`]));return c}singletonDepsOf(e,t){return[...new Set([...Wn(e.meta),...jl(e.meta)])].filter(n=>t.has(n))}};Pr.importPatterns=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g]});import{gt as Th,satisfies as PE,maxSatisfying as Ph,major as OE,valid as CE}from"semver";var Ki,Yt,Ul=v(()=>{Ki=class{cmp(e,t){return e===t?0:Th(e,t)?1:Th(t,e)?-1:0}satisfies(e,t){return!e||!e.trim()?!0:!!PE(t,e,{includePrerelease:!0})}selectBestVersion(e,t){if(!e?.length)return;let n=t?.range?.trim()||"*",s=t?.preferStable??!0,i=t?.distTags?.latest;if(i&&e.includes(i)&&this.satisfies(n,i))return i;if(s){let a=Ph(e,n,{includePrerelease:!1});if(a)return a}return Ph(e,n,{includePrerelease:!0})??void 0}majorOf(e){return OE(e)}isExactVersion(e){return CE(e)!==null}},Yt=new Ki});function RE(r){return Math.min(9e5*Math.pow(2,Math.max(0,r-1)),864e5)}var Vt,Oh=v(()=>{Ui();Vt=class{constructor(e){this.store=e}async isNegative(e){let t=await ye(()=>this.store.get(e));return!!t&&t.until>Date.now()}async recordNegative(e){let n=((await ye(()=>this.store.get(e)))?.attempts||0)+1;await ye(()=>this.store.set(e,{until:Date.now()+RE(n),attempts:n}))}async clearNegative(e){await ye(()=>this.store.delete(e))}}});function Ch(r,e){let t=new Hn(r,e),n=new Yn(t),s=new Vn(r,t,Yt);return{packageService:new Pr(s,t,n),versionResolver:s,cdnClient:t,peerResolver:n}}var tt=v(()=>{Dl();Ji();Fl();ql();Ul();Kn();Ul();Jn();Dl();Ji();Fl();ql();Oh()});import*as Jl from"fs/promises";import*as Rh from"crypto";function Le(r){return Rh.createHash("sha1").update(r).digest("hex")}async function rt(r){try{return JSON.parse(await Jl.readFile(r,"utf8"))}catch{return}}async function Hi(r){try{return await Jl.readFile(r,"utf8")}catch{return}}var Or=v(()=>{});import*as kt from"fs/promises";import*as nt from"path";import*as Nh from"os";function Z(){return Kl||(Kl=NE()),Kl}function Yi(r,e){return nt.join(_E,Le(r),e)}async function NE(){await kt.mkdir(St,{recursive:!0});let r=nt.join(St,"version.json");if((await rt(r))?.version===_h)return;let t=await kt.readdir(St).catch(()=>[]);await Promise.all(t.map(n=>kt.rm(nt.join(St,n),{recursive:!0,force:!0}))),await kt.writeFile(r,JSON.stringify({version:_h})+`
|
|
359
|
+
`,"utf8")}var _h,St,zn,Gn,Wi,_E,Kl,Cr=v(()=>{Or();_h=1,St=nt.join(Nh.homedir(),".typebulb","cache"),zn=nt.join(St,"packages"),Gn=nt.join(St,"proxy"),Wi=nt.join(St,"dts"),_E=nt.join(St,"emit")});import*as xt from"fs/promises";import*as Ih from"path";async function Ee(r,e){await xt.mkdir(Ih.dirname(r),{recursive:!0});let t=`${r}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await xt.writeFile(t,e,"utf8"),await xt.rename(t,r).catch(async n=>{throw await xt.rm(t,{force:!0}).catch(()=>{}),n})}var Xn=v(()=>{});var Rr,Hl=v(()=>{Xn();Or();Rr=class{constructor(e){this.filePath=e}mem;loadPromise;load(){return this.mem?Promise.resolve(this.mem):(this.loadPromise||(this.loadPromise=rt(this.filePath).then(e=>(this.mem=new Map(Object.entries(e??{})),this.mem))),this.loadPromise)}async get(e){return(await this.load()).get(e)}async set(e,t){let n=await this.load();n.set(e,t),await this.persist(n)}async delete(e){let t=await this.load();t.delete(e)&&await this.persist(t)}async persist(e){await Ee(this.filePath,JSON.stringify(Object.fromEntries(e)))}}});import*as Mh from"fs/promises";import*as Me from"path";function Lh(r,e){return Me.join(IE,Vi(r),encodeURIComponent(e)+".json")}function Vi(r){return r.replace(/\//g,"__")}var Wl,$h,IE,$E,zi,Bh=v(()=>{tt();Cr();Xn();Hl();Or();Wl=Me.join(zn,"indexes"),$h=Me.join(zn,"pinned"),IE=Me.join(zn,"meta"),$E=Me.join(zn,"negative.json"),zi=class{pinnedMem=new Map;indexMem=new Map;metaMem=new Map;negativeCache=new Vt(new Rr($E));async getPinnedExact(e,t){let n=`${e}@${t}`;if(this.pinnedMem.has(n))return this.pinnedMem.get(n);await Z();let s=await Hi(Me.join($h,Le(n)+".txt"));return this.pinnedMem.set(n,s),s}async setPinnedExact(e,t,n){let s=`${e}@${t}`;this.pinnedMem.set(s,n),await Z(),await Ee(Me.join($h,Le(s)+".txt"),n)}async getIndex(e){if(this.indexMem.has(e))return this.indexMem.get(e);await Z();let t=await rt(Me.join(Wl,Vi(e)+".json"));return this.indexMem.set(e,t),t}async setIndex(e,t,n){let s={versions:t,distTags:n,updatedAt:Date.now()};this.indexMem.set(e,s),await Z(),await Ee(Me.join(Wl,Vi(e)+".json"),JSON.stringify(s))}async invalidateVersionsCache(e){this.indexMem.delete(e),await Mh.rm(Me.join(Wl,Vi(e)+".json"),{force:!0})}async isNegative(e){return await Z(),this.negativeCache.isNegative(e)}async recordNegative(e){await Z(),await this.negativeCache.recordNegative(e)}async clearNegative(e){await this.negativeCache.clearNegative(e)}async getMeta(e,t){let n=`${e}@${t}`;if(this.metaMem.has(n))return this.metaMem.get(n);await Z();let s=await rt(Lh(e,t));return this.metaMem.set(n,s),s}async setMeta(e,t,n,s,i){let o={dependencies:n,peerDependencies:s,peerDependenciesMeta:i,updatedAt:Date.now()};this.metaMem.set(`${e}@${t}`,o),await Z(),await Ee(Lh(e,t),JSON.stringify(o))}}});var Dh,jh=v(()=>{Dh={async getJson(r){try{let e=await fetch(r,{redirect:"follow"});return e.ok?await e.json():void 0}catch{return}},async head(r){try{let e=await fetch(r,{method:"HEAD",redirect:"follow"});return{ok:e.ok,url:e.url}}catch{return}}}});var LE,Gi,Fh,qh,d1,Yl=v(()=>{tt();Bh();jh();LE=new zi,{packageService:Gi,versionResolver:Fh,cdnClient:qh,peerResolver:d1}=Ch(LE,Dh)});function Xi(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Qi(r,e){return` <script>
|
|
360
360
|
(function() {
|
|
361
361
|
try {
|
|
362
|
-
var KEY = ${
|
|
362
|
+
var KEY = ${Et(JSON.stringify("tb-theme:"+r))};
|
|
363
363
|
var doc = document.documentElement;
|
|
364
364
|
var mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
365
365
|
var os = function() { return mq.matches ? 'dark' : 'light'; };
|
|
366
|
-
var FORCED = ${
|
|
366
|
+
var FORCED = ${Et(JSON.stringify(e??null))};
|
|
367
367
|
var stored = function() {
|
|
368
368
|
try { var v = localStorage.getItem(KEY); return (v === 'dark' || v === 'light') ? v : undefined; }
|
|
369
369
|
catch (e) { return undefined; }
|
|
@@ -391,7 +391,7 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
391
391
|
});
|
|
392
392
|
} catch (e) {}
|
|
393
393
|
})();
|
|
394
|
-
</script>`}var
|
|
394
|
+
</script>`}var Et,Zi,eo=v(()=>{le();Et=r=>r.replace(/<\/script/gi,"<\\/script");Zi=`
|
|
395
395
|
const es = new EventSource('/__reload');
|
|
396
396
|
let bootId = null;
|
|
397
397
|
let firstErrorAt = 0;
|
|
@@ -408,7 +408,7 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
408
408
|
es.onerror = () => {
|
|
409
409
|
if (!firstErrorAt) firstErrorAt = Date.now();
|
|
410
410
|
if (Date.now() - firstErrorAt > RETRY_WINDOW_MS) es.close();
|
|
411
|
-
};`});var
|
|
411
|
+
};`});var Uh,Jh=v(()=>{eo();Uh=`
|
|
412
412
|
(() => {
|
|
413
413
|
// Embedded (bulb-in-a-bulb): runs inside a sandboxed iframe with no parent
|
|
414
414
|
// bridge, so privileged tb.* (AI, fs, server RPC) can't reach a host and would
|
|
@@ -718,12 +718,13 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
718
718
|
return resp.json();
|
|
719
719
|
},
|
|
720
720
|
|
|
721
|
-
//
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
721
|
+
// AI-access check - 'own' when the user's own AI backs tb.ai (env keys, compat endpoint, or
|
|
722
|
+
// Ollama), else 'none': an embed has no host AI, and the CLI has no courtesy model
|
|
723
|
+
aiAccess: async () => {
|
|
724
|
+
if (isEmbedded) return 'none';
|
|
725
|
+
const resp = await fetch('/__ai-access');
|
|
726
|
+
if (!resp.ok) return 'none';
|
|
727
|
+
return await resp.json();
|
|
727
728
|
},
|
|
728
729
|
|
|
729
730
|
// Dump just logs to console in local mode
|
|
@@ -804,7 +805,10 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
804
805
|
// small implicit-role map; names come from aria-label, label association, placeholder, then
|
|
805
806
|
// visible text \u2014 a form control's value is a stated facet ([value=\u2026]), never its name, because a
|
|
806
807
|
// value-derived name is a self-invalidating selector.
|
|
807
|
-
|
|
808
|
+
// CANVAS's 'img' is an invention, not an ARIA reading (canvas has no implicit role): it puts a
|
|
809
|
+
// canvas in the outline so tb:png's multi-canvas form resolves by the ordinary vocabulary
|
|
810
|
+
// (TB-Interrogation-Pixels.md). It collides with real <img> by design \u2014 ambiguity is reported.
|
|
811
|
+
const IMPLICIT_ROLES = { BUTTON: 'button', SELECT: 'combobox', TEXTAREA: 'textbox', OPTION: 'option', IMG: 'img', CANVAS: 'img', NAV: 'navigation', MAIN: 'main', HEADER: 'banner', FOOTER: 'contentinfo', ASIDE: 'complementary', FORM: 'form', DIALOG: 'dialog', TABLE: 'table', TR: 'row', TH: 'columnheader', TD: 'cell', UL: 'list', OL: 'list', LI: 'listitem', LABEL: 'label', P: 'paragraph', PROGRESS: 'progressbar', SUMMARY: 'button', FIGURE: 'figure', BLOCKQUOTE: 'blockquote', HR: 'separator' };
|
|
808
812
|
const INPUT_ROLES = { checkbox: 'checkbox', radio: 'radio', range: 'slider', number: 'spinbutton', search: 'searchbox', button: 'button', submit: 'button', reset: 'button', hidden: '' };
|
|
809
813
|
const FORM_TAGS = { INPUT: 1, TEXTAREA: 1, SELECT: 1 };
|
|
810
814
|
const squash = (s) => (s || '').replace(/\\s+/g, ' ').trim();
|
|
@@ -863,13 +867,13 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
863
867
|
const attr = (n) => squash(ch.getAttribute(n) || '');
|
|
864
868
|
const text = squash(ch.textContent);
|
|
865
869
|
const formControl = FORM_TAGS[tag] && role !== 'button';
|
|
866
|
-
let name;
|
|
870
|
+
let name, fromContent = false;
|
|
867
871
|
const aria = attr('aria-label');
|
|
868
872
|
if (aria) name = aria;
|
|
869
873
|
else if (tag === 'IMG') name = attr('alt') || text;
|
|
870
874
|
else if (formControl) name = labelName(ch) || attr('placeholder') || attr('title');
|
|
871
875
|
else if (tag === 'INPUT') name = squash(ch.value) || text; // a button-role input: value is its caption
|
|
872
|
-
else name = text;
|
|
876
|
+
else { name = text; fromContent = true; }
|
|
873
877
|
const facets = [];
|
|
874
878
|
if (role === 'heading') {
|
|
875
879
|
const lv = attr('aria-level') || (/^H[1-6]$/.test(tag) ? tag.charAt(1) : '');
|
|
@@ -883,11 +887,22 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
883
887
|
}
|
|
884
888
|
if ((role === 'checkbox' || role === 'radio') && ch.checked) facets.push('checked');
|
|
885
889
|
if (ch.disabled === true || attr('aria-disabled') === 'true') facets.push('disabled');
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
lines.push(' '.repeat(depth) + '- ' + line);
|
|
890
|
+
const facetStr = facets.map((f) => ' [' + f + ']').join('');
|
|
891
|
+
lines.push(' '.repeat(depth) + '- ' + role + (name ? ' "' + clip(name) + '"' : '') + facetStr);
|
|
889
892
|
targets.push({ el: ch, role, name: name || '' });
|
|
890
|
-
if (
|
|
893
|
+
if (fromContent && name) {
|
|
894
|
+
// A content-derived name IS the subtree's text, so the form is decided AFTER descending
|
|
895
|
+
// (TB-Interrogation-Actuation.md, container fix): a subtree with no lines of its own
|
|
896
|
+
// collapses into the named line ('listitem "Apple"'); one with lines keeps them all, and
|
|
897
|
+
// the name \u2014 their duplicate \u2014 goes bare. An aria-label is never content-derived.
|
|
898
|
+
const lineMark = lines.length, targetMark = targets.length;
|
|
899
|
+
walk(ch, depth + 1, false);
|
|
900
|
+
if (targets.length === targetMark) lines.length = lineMark;
|
|
901
|
+
else {
|
|
902
|
+
lines[lineMark - 1] = ' '.repeat(depth) + '- ' + role + facetStr;
|
|
903
|
+
targets[targetMark - 1].name = '';
|
|
904
|
+
}
|
|
905
|
+
} else walk(ch, depth + 1, false);
|
|
891
906
|
}
|
|
892
907
|
};
|
|
893
908
|
walk(document.body, 0, false);
|
|
@@ -1024,13 +1039,59 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
|
|
|
1024
1039
|
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1025
1040
|
return postFrameSnapshot();
|
|
1026
1041
|
};
|
|
1042
|
+
// tb:png (TB-Interrogation-Pixels.md): the page's canvas as PNG \u2014 bytes base64 in the reply
|
|
1043
|
+
// envelope. The shim knows nothing about files; the CLI decodes, writes one under its own home,
|
|
1044
|
+
// and prints the path. Resolution is a SUBSET of the outline's vocabulary: the sole visible
|
|
1045
|
+
// canvas needs no name (an edit is the state loss the verb avoids); several resolve as the
|
|
1046
|
+
// ordinary img role by name, rejecting a match that isn't a canvas.
|
|
1047
|
+
const readPng = (rest) => {
|
|
1048
|
+
const m = /^\\s*(?:"([^"]*)"|(\\S+))?\\s*$/.exec(rest);
|
|
1049
|
+
if (!m) throw new Error('usage: tb:png ["<name>"]');
|
|
1050
|
+
const name = m[1] !== undefined ? m[1] : m[2];
|
|
1051
|
+
let el;
|
|
1052
|
+
if (name === undefined) {
|
|
1053
|
+
const canvases = collectOutline().targets.filter((t) => t.el.tagName === 'CANVAS');
|
|
1054
|
+
if (!canvases.length) throw new Error('no canvas in the page (tb:png reads a canvas element back as PNG)');
|
|
1055
|
+
if (canvases.length > 1) {
|
|
1056
|
+
const named = canvases.filter((t) => t.name);
|
|
1057
|
+
throw new Error(canvases.length + ' canvases here \u2014 name one: tb:png "<name>"'
|
|
1058
|
+
+ (named.length ? '; canvas names: ' + named.map((t) => '"' + t.name + '"').join(', ') : '')
|
|
1059
|
+
+ (named.length < canvases.length ? ' (' + (canvases.length - named.length) + ' unnamed \u2014 an aria-label would make them targetable)' : ''));
|
|
1060
|
+
}
|
|
1061
|
+
el = canvases[0].el;
|
|
1062
|
+
} else {
|
|
1063
|
+
el = resolveTarget('img', name);
|
|
1064
|
+
if (el.tagName !== 'CANVAS') throw new Error('img "' + name + '" is <' + el.tagName.toLowerCase() + '>, not a canvas');
|
|
1065
|
+
}
|
|
1066
|
+
// toBlob throws from outside for a canvas that can't be read; name the cause \u2014 a tainted or
|
|
1067
|
+
// transferred canvas must exit non-zero, never read as an empty success.
|
|
1068
|
+
return new Promise((resolve, reject) => {
|
|
1069
|
+
try {
|
|
1070
|
+
el.toBlob((blob) => {
|
|
1071
|
+
if (!blob) return reject(new Error('the canvas produced no pixels \u2014 is it 0\xD70?'));
|
|
1072
|
+
const fr = new FileReader();
|
|
1073
|
+
fr.onerror = () => reject(new Error('failed to read the encoded PNG'));
|
|
1074
|
+
fr.onload = () => {
|
|
1075
|
+
const s = String(fr.result);
|
|
1076
|
+
resolve({ png: s.slice(s.indexOf(',') + 1), width: el.width, height: el.height });
|
|
1077
|
+
};
|
|
1078
|
+
fr.readAsDataURL(blob);
|
|
1079
|
+
}, 'image/png');
|
|
1080
|
+
} catch (err) {
|
|
1081
|
+
const why = err && err.name === 'SecurityError' ? 'it is tainted by a cross-origin draw'
|
|
1082
|
+
: err && err.name === 'InvalidStateError' ? 'its control was transferred to an OffscreenCanvas'
|
|
1083
|
+
: String((err && err.message) || err);
|
|
1084
|
+
reject(new Error('the canvas cannot be read: ' + why));
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
};
|
|
1027
1088
|
|
|
1028
1089
|
// Events channel (dev server only): 'reload' drives hot reload (only emitted when watching),
|
|
1029
1090
|
// 'message' delivers \`typebulb send\` pushes to tb.onMessage. Connect for a CLI-served page (http
|
|
1030
1091
|
// origin, not an embed); a srcdoc embed or a file:// static export has no server, so onMessage just
|
|
1031
1092
|
// stays inert there. Opening it independent of watch is what lets send reach a --no-watch page.
|
|
1032
1093
|
if (!isEmbedded && location.protocol.indexOf('http') === 0) {
|
|
1033
|
-
${
|
|
1094
|
+
${Zi}
|
|
1034
1095
|
es.addEventListener('message', async (e) => {
|
|
1035
1096
|
// Wire envelope { id?, payload } (JSON \u2014 SSE-line-safe). tb:* payloads are the shim's reserved
|
|
1036
1097
|
// namespace (TB-Interrogation.md): answered by a built-in handler, never delivered to
|
|
@@ -1049,11 +1110,17 @@ ${Gi}
|
|
|
1049
1110
|
};
|
|
1050
1111
|
const reservedCall = async () => {
|
|
1051
1112
|
const p = env.payload;
|
|
1113
|
+
// A failed compile still serves a page \u2014 with broken code, so it renders nothing. Every
|
|
1114
|
+
// read below would then describe an empty room ('(empty page)', 'no canvas in the page'):
|
|
1115
|
+
// true, useless, and indistinguishable from a bulb that simply draws nothing. The server
|
|
1116
|
+
// knew the cause at compile time, so the page carries it and every reserved read states it.
|
|
1117
|
+
if (window.__TB_COMPILE_ERROR__) throw new Error('the bulb did not compile, so the page is empty: ' + window.__TB_COMPILE_ERROR__);
|
|
1052
1118
|
if (p === 'tb:snapshot') return snapshot();
|
|
1053
1119
|
if (p === 'tb:click' || p.indexOf('tb:click ') === 0) return actClick(p.slice(9));
|
|
1054
1120
|
if (p === 'tb:set' || p.indexOf('tb:set ') === 0) return actSet(p.slice(7));
|
|
1055
1121
|
if (p === 'tb:rect' || p.indexOf('tb:rect ') === 0) return readRect(p.slice(8));
|
|
1056
|
-
|
|
1122
|
+
if (p === 'tb:png' || p.indexOf('tb:png ') === 0) return readPng(p.slice(7));
|
|
1123
|
+
throw new Error('unknown reserved message: ' + p + ' (known: tb:snapshot, tb:rect, tb:png, tb:click, tb:set)');
|
|
1057
1124
|
};
|
|
1058
1125
|
const value = parseMsg(env.payload);
|
|
1059
1126
|
const calls = typeof env.payload === 'string' && env.payload.indexOf('tb:') === 0
|
|
@@ -1069,45 +1136,46 @@ ${Gi}
|
|
|
1069
1136
|
});
|
|
1070
1137
|
}
|
|
1071
1138
|
})();
|
|
1072
|
-
`});function
|
|
1073
|
-
`+
|
|
1139
|
+
`});function Kh(r){let{name:e,code:t,css:n,html:s,data:i,insight:o,importMap:a,theme:c,embedded:l,dir:d,source:u,compileError:f}=r,p=s.trim()||'<div id="app"></div>',h=l?"":`
|
|
1140
|
+
`+hl,m={imports:FE(a.imports)};return`<!DOCTYPE html>
|
|
1074
1141
|
<html>
|
|
1075
1142
|
<head>
|
|
1076
1143
|
<meta charset="utf-8">
|
|
1077
1144
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1078
|
-
<title>${
|
|
1079
|
-
${
|
|
1145
|
+
<title>${Xi(e)} - typebulb</title>
|
|
1146
|
+
${Qi(e,c)}
|
|
1080
1147
|
<script type="importmap">
|
|
1081
|
-
${JSON.stringify(
|
|
1148
|
+
${JSON.stringify(m,null,2)}
|
|
1082
1149
|
</script>
|
|
1083
1150
|
<style>
|
|
1084
|
-
${
|
|
1151
|
+
${Ln}${h}
|
|
1085
1152
|
</style>
|
|
1086
1153
|
<style>
|
|
1087
1154
|
${n}
|
|
1088
1155
|
</style>
|
|
1089
1156
|
</head>
|
|
1090
1157
|
<body>
|
|
1091
|
-
${
|
|
1158
|
+
${p}
|
|
1092
1159
|
|
|
1093
|
-
${i.length>0?`<script>window.__TB_DATA__ = ${
|
|
1094
|
-
${o?`<script>window.__TB_INSIGHT__ = ${
|
|
1095
|
-
${d?`<script>window.__TB_DIR__ = ${
|
|
1160
|
+
${i.length>0?`<script>window.__TB_DATA__ = ${Et(JSON.stringify(i))};</script>`:""}
|
|
1161
|
+
${o?`<script>window.__TB_INSIGHT__ = ${Et(JSON.stringify(o))};</script>`:""}
|
|
1162
|
+
${d?`<script>window.__TB_DIR__ = ${Et(JSON.stringify(d))};</script>`:""}
|
|
1163
|
+
${f?`<script>window.__TB_COMPILE_ERROR__ = ${Et(JSON.stringify(f))};</script>`:""}
|
|
1096
1164
|
|
|
1097
1165
|
<script>
|
|
1098
|
-
${
|
|
1166
|
+
${Uh}
|
|
1099
1167
|
</script>
|
|
1100
1168
|
|
|
1101
|
-
${
|
|
1169
|
+
${jE}
|
|
1102
1170
|
|
|
1103
|
-
${
|
|
1171
|
+
${BE(t,u)}
|
|
1104
1172
|
</body>
|
|
1105
|
-
</html>`}function
|
|
1106
|
-
`);return`<script type="module">${s}${
|
|
1107
|
-
</script>`}function
|
|
1173
|
+
</html>`}function BE(r,e){let t=["",...ME],n=e?Array(Math.max(0,e.codeLine-t.length-1)).fill(""):[],s=[...t,...n,Et(r)].join(`
|
|
1174
|
+
`);return`<script type="module">${s}${DE(e,s)}
|
|
1175
|
+
</script>`}function DE(r,e){if(!r)return"";let t=e.split(`
|
|
1108
1176
|
`).length,n={version:3,file:r.file,sources:[`/__source/${r.file}`],names:[],mappings:["AAAA",...Array(Math.max(0,t-1)).fill("AACA")].join(";")};return`
|
|
1109
1177
|
//# sourceURL=${r.file.replace(/\s/g,"%20")}
|
|
1110
|
-
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(n))}`}function
|
|
1178
|
+
//# sourceMappingURL=data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(n))}`}function FE(r){let e={};for(let[t,n]of Object.entries(r))e[t]=n.startsWith("https://")?"/proxy/"+n:n;return e}var ME,jE,Hh=v(()=>{Jh();eo();ME=["globalThis.__tbEntryRan = true; /* import graph resolved \u2014 the load-failure backstop's signal (imports hoist above this line) */","await globalThis.__tbBoot; /* #tb= fragment restore, set by the shim when present (TB-Inference.md) */"];jE=`<script>
|
|
1111
1179
|
(function () {
|
|
1112
1180
|
var framed = window.parent !== window;
|
|
1113
1181
|
var post = function (m) { try { parent.postMessage(m, '*'); } catch (e) {} }; /* framed only */
|
|
@@ -1206,22 +1274,22 @@ ${NE(t,u)}
|
|
|
1206
1274
|
}
|
|
1207
1275
|
});
|
|
1208
1276
|
})();
|
|
1209
|
-
</script>`});import*as
|
|
1210
|
-
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await
|
|
1277
|
+
</script>`});import*as ro from"fs/promises";import*as to from"path";import{existsSync as Wh,readFileSync as qE}from"fs";import{execFile as UE}from"child_process";import{promisify as JE}from"util";import{satisfies as KE}from"semver";async function no(r,e,t,n){let i=r.map(l=>YE(l,t)).filter(l=>!VE(l,e));if(i.length===0)return;let o=i.filter(l=>!WE.test(l));if(o.length)throw new Error(`Refusing to install npm spec(s) with unsupported characters: ${o.join(", ")}
|
|
1278
|
+
Use a plain name with an exact / caret / tilde range (e.g. three@^0.160.0).`);await ro.mkdir(e,{recursive:!0});let a=to.join(e,"package.json");Wh(a)||await ro.writeFile(a,JSON.stringify({name:"typebulb-server",private:!0})),console.log(` Installing: ${i.join(", ")}`);let c=["--no-audit","--no-fund",...n?.ignoreScripts?["--ignore-scripts"]:[]];await HE("npm",["install",...c,...i],{cwd:e,shell:!0})}function YE(r,e){if(!e||j.parse(r).version)return r;let t=e[r];return t?`${r}@${t}`:r}function VE(r,e){let{name:t,version:n}=j.parse(r),s=to.join(e,"node_modules",t);if(!Wh(s))return!1;if(!n)return!0;try{let i=JSON.parse(qE(to.join(s,"package.json"),"utf-8")).version;return KE(i,n)}catch{return!1}}function so(r){let e=new Set,t=/\bimport\s+(?:[\s\S]*?\s+from\s+)?['"]([^./][^'"]*)['"]/g,n;for(;n=t.exec(r);){let s=n[1];s.includes(":")||e.add(j.rootOf(s))}return[...e]}var HE,WE,Vl=v(()=>{tt();HE=JE(UE),WE=/^(@[a-z0-9._-]+\/)?[a-z0-9._-]+(@[a-zA-Z0-9.^~*x-]+)?$/i});var Yh=v(()=>{});var we,Be,_r=v(()=>{we=class extends Error{constructor(e,t="unknown",n=!1){super(e),this.code=t,this.retryable=n}},Be=class{getPath(e,t){return this.path}parseError(e,t){return this.parseJsonError(e,t)}parseStreamChunk(e){return this.checkAndThrowError(e),this.parseProviderStreamChunk(e)}extractSystemMessages(e,t=`
|
|
1211
1279
|
|
|
1212
|
-
`){let n=e.filter(s=>s.role==="system").map(s=>s.content);return{system:n.length?n.join(t):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let n=JSON.parse(e);return n.error&&typeof n.error=="object"?{message:n.error.message||`HTTP ${t}`,type:n.error.type}:n.message?{message:n.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let t=e;if(t.type==="error"&&"message"in t){let n=t.code||"unknown";throw new we(t.message,n,!!t.retryable)}if(t.error){let n=t.error,s=typeof n=="object"&&n!==null?String(n.type??n.code??""):"",i=/rate_limit|too_many_requests/i.test(s),o=/overloaded|server_error|unavailable/i.test(s),a=/context_length/i.test(s);throw new we(this.extractErrorMessage(t.error),i?"rate_limit":a?"context_exceeded":"unknown",i||o)}}extractErrorMessage(e){if(typeof e=="string")try{let t=JSON.parse(e);return t.error?.message||t.message||e}catch{return e}return typeof e=="object"&&e!==null?e.message||JSON.stringify(e):`${this.providerName} returned an error`}}});var
|
|
1280
|
+
`){let n=e.filter(s=>s.role==="system").map(s=>s.content);return{system:n.length?n.join(t):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let n=JSON.parse(e);return n.error&&typeof n.error=="object"?{message:n.error.message||`HTTP ${t}`,type:n.error.type}:n.message?{message:n.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let t=e;if(t.type==="error"&&"message"in t){let n=t.code||"unknown";throw new we(t.message,n,!!t.retryable)}if(t.error){let n=t.error,s=typeof n=="object"&&n!==null?String(n.type??n.code??""):"",i=/rate_limit|too_many_requests/i.test(s),o=/overloaded|server_error|unavailable/i.test(s),a=/context_length/i.test(s);throw new we(this.extractErrorMessage(t.error),i?"rate_limit":a?"context_exceeded":"unknown",i||o)}}extractErrorMessage(e){if(typeof e=="string")try{let t=JSON.parse(e);return t.error?.message||t.message||e}catch{return e}return typeof e=="object"&&e!==null?e.message||JSON.stringify(e):`${this.providerName} returned an error`}}});var io,zl=v(()=>{_r();io=class extends Be{constructor(){super(...arguments),this.providerName="OpenAI",this.defaultBaseUrl="https://api.openai.com",this.path="/v1/responses",this.effortMap={0:"none",1:"low",2:"medium",3:"high"}}buildHeaders(e){return{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"}}buildPayload(e,t,n,s){let i=this.convertMessagesToInput(e),o={model:t,input:i,stream:s};if(n?.webSearch!==!1&&(o.tools=[{type:"web_search"}]),n?.effort!==void 0){let a=this.effortMap[n.effort];o.reasoning=a==="none"?{effort:a}:{effort:a,summary:"auto"}}return o}parseNonStreamingResponse(e){if(!this.isResponsesApiResponse(e))return{text:""};let t=e.output_text||"",n;if(e.output&&Array.isArray(e.output))for(let s of e.output)s.type==="reasoning"&&s.summary&&(n=s.summary.map(i=>i.text).join(`
|
|
1213
1281
|
`)),!t&&s.type==="message"&&s.content&&(t=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,reasoning:n}}parseProviderStreamChunk(e){if(!this.isResponsesApiEvent(e))return null;switch(e.type){case"response.failed":{let n=e.response?.error,s=n?.message||"Response failed",i=n?.code==="insufficient_quota"||n?.code==="rate_limit_exceeded";throw new we(s,i?"rate_limit":"unknown",i)}case"response.output_text.delta":return{text:e.delta};case"response.reasoning_summary_text.delta":return{reasoning:e.delta};default:return null}}convertMessagesToInput(e){return e.map(t=>t.role==="system"?`System: ${t.content}`:t.role==="user"?`User: ${t.content}`:t.role==="assistant"?`Assistant: ${t.content}`:t.content).join(`
|
|
1214
1282
|
|
|
1215
|
-
`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}}});var
|
|
1283
|
+
`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}}});var Nr,oo=v(()=>{_r();Nr=class extends Be{parseNonStreamingResponse(e){if(!this.hasChoices(e))return{text:""};let t=e,n=t.choices[0],s=n?.message,i=s?.content??n?.text??"",o=s?.reasoning??s?.reasoning_content??t.reasoning;return{text:i,reasoning:o}}parseProviderStreamChunk(e){if(!this.hasChoices(e))return null;let t=e.choices[0];if(!t)return null;let n=t.delta||t.message;if(!n)return null;let s=n.content||void 0,i=n.reasoning||n.reasoning_content||void 0;return!s&&!i?null:{text:s,reasoning:i}}hasChoices(e){return typeof e=="object"&&e!==null&&"choices"in e&&Array.isArray(e.choices)}}});var ao,Gl=v(()=>{oo();ao=class extends Nr{constructor(){super(...arguments),this.providerName="OpenRouter",this.defaultBaseUrl="https://openrouter.ai",this.path="/api/v1/chat/completions",this.effortMap={0:"none",1:"low",2:"medium",3:"high"}}buildHeaders(e,t){let n={Authorization:`Bearer ${e}`,"x-api-key":e,"Content-Type":"application/json",Accept:"application/json","X-Title":"Typebulb"};return t&&(n["HTTP-Referer"]=t,n.Referer=t,n.Origin=t),n}buildPayload(e,t,n,s){let i={model:t,messages:e,stream:s};n?.webSearch===!0&&(i.plugins=[{id:"web"}]);let o=n?.effort;return o!==void 0&&(i.reasoning={effort:this.effortMap[o]}),i}}});var co,Xl=v(()=>{_r();co=class extends Be{constructor(){super(...arguments),this.providerName="Anthropic",this.defaultBaseUrl="https://api.anthropic.com",this.path="/v1/messages"}buildHeaders(e){return{"x-api-key":e,"anthropic-version":"2023-06-01","Content-Type":"application/json",Accept:"application/json"}}buildPayload(e,t,n,s){let{system:i,conversationMessages:o}=this.extractSystemMessages(e),a={model:t,max_tokens:this.getMaxTokens(t),messages:this.withTailMessagesCached(o),stream:s};n?.webSearch!==!1&&(a.tools=[{type:"web_search_20250305",name:"web_search"}]),i&&(a.system=[{type:"text",text:i,cache_control:{type:"ephemeral"}}]);let c=n?.effort;if(c!==void 0){if(this.isModernModel(t))if(c===0)this.alwaysThinks(t)||(a.thinking={type:"disabled"}),a.output_config={effort:"low"};else{let l={1:"low",2:"medium",3:"high"};a.thinking={type:"adaptive",display:"summarized"},a.output_config={effort:l[c]}}else if(c!==0){let l={1:2048,2:4096,3:8192};a.thinking={type:"enabled",budget_tokens:l[c]}}}return a}parseNonStreamingResponse(e){if(!this.isAnthropicResponse(e))return{text:""};let t=e.content.filter(s=>s.type==="text").map(s=>s.text).join(""),n=e.content.filter(s=>s.type==="thinking").map(s=>s.thinking).join(`
|
|
1216
1284
|
|
|
1217
|
-
`);return{text:t,reasoning:n||void 0}}parseProviderStreamChunk(e){return this.isAnthropicEvent(e)&&e.type==="content_block_delta"?e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:null:null}withTailMessagesCached(e){let t=Math.max(0,e.length-2);return e.map((n,s)=>s>=t?{role:n.role,content:[{type:"text",text:n.content,cache_control:{type:"ephemeral"}}]}:n)}isAnthropicResponse(e){return typeof e=="object"&&e!==null&&e.type==="message"&&Array.isArray(e.content)}isAnthropicEvent(e){return typeof e=="object"&&e!==null&&"type"in e}isModernModel(e){let t=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!t)return!1;let n=+t[1],s=t[2]?+t[2]:0;return n>4||n===4&&s>=6}alwaysThinks(e){return/^claude-(fable|mythos)\b/i.test(e)}getMaxTokens(e){return this.isModernModel(e)?64e3:32e3}}});var
|
|
1285
|
+
`);return{text:t,reasoning:n||void 0}}parseProviderStreamChunk(e){return this.isAnthropicEvent(e)&&e.type==="content_block_delta"?e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:null:null}withTailMessagesCached(e){let t=Math.max(0,e.length-2);return e.map((n,s)=>s>=t?{role:n.role,content:[{type:"text",text:n.content,cache_control:{type:"ephemeral"}}]}:n)}isAnthropicResponse(e){return typeof e=="object"&&e!==null&&e.type==="message"&&Array.isArray(e.content)}isAnthropicEvent(e){return typeof e=="object"&&e!==null&&"type"in e}isModernModel(e){let t=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!t)return!1;let n=+t[1],s=t[2]?+t[2]:0;return n>4||n===4&&s>=6}alwaysThinks(e){return/^claude-(fable|mythos)\b/i.test(e)}getMaxTokens(e){return this.isModernModel(e)?64e3:32e3}}});var lo,Ql=v(()=>{_r();lo=class extends Be{constructor(){super(...arguments),this.providerName="Gemini",this.defaultBaseUrl="https://generativelanguage.googleapis.com",this.path="/v1beta/models",this.budgetMap={0:0,1:1024,2:8192,3:-1}}getPath(e,t){return`/v1beta/models/${e}:${t?"streamGenerateContent":"generateContent"}${t?"?alt=sse":""}`}buildHeaders(e){return{"Content-Type":"application/json","x-goog-api-key":e}}buildPayload(e,t,n,s){let{system:i,conversationMessages:o}=this.extractSystemMessages(e,`
|
|
1218
1286
|
`),c={contents:o.map(d=>({role:d.role==="assistant"?"model":"user",parts:[{text:d.content}]}))};n?.webSearch!==!1&&(c.tools=[{google_search:{}}]),i&&(c.systemInstruction={role:"system",parts:[{text:i}]});let l=n?.effort;if(l!==void 0){let d=this.geminiVersion(t),u=d!==null&&d>=3?{thinkingLevel:this.thinkingLevelFor(d,l)}:{thinkingBudget:this.budgetMap[l]};c.generationConfig={thinkingConfig:l===0?u:{includeThoughts:!0,...u}}}return c}parseError(e,t){if(!e)return{message:`HTTP ${t}`};try{let n=JSON.parse(e),s=Array.isArray(n)?n[0]?.error:n?.error;return s&&typeof s=="object"?{message:(s.message||`HTTP ${t}`).split(`
|
|
1219
|
-
`)[0],type:s.status,code:s.code?.toString()}:n.message?{message:n.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let t=this.extractParts(e).text||"",n=e.candidates?.[0]?.finishReason,s="complete";return n==="MAX_TOKENS"?s="interrupted":(n==="SAFETY"||n==="RECITATION")&&(s="failed"),{text:t,status:s}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return null;let t=this.extractParts(e);return t.text||t.reasoning?t:null}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):null}thinkingLevelFor(e,t){let n=["minimal","low","medium","high"][t];return n==="minimal"&&e<3.5?"low":n}isGeminiResponse(e){return typeof e=="object"&&e!==null&&"candidates"in e&&Array.isArray(e.candidates)}extractParts(e){let t=e.candidates?.[0]?.content?.parts;if(!t)return{};let n="",s="";for(let i of t)i.text&&(i.thought?s+=i.text:n+=i.text);return{text:n||void 0,reasoning:s||void 0}}checkGeminiError(e){if(this.isGeminiResponse(e)&&e.promptFeedback?.blockReason){let t=e.promptFeedback.blockReason;throw new we(`Prompt blocked: ${t}`)}}}});var
|
|
1287
|
+
`)[0],type:s.status,code:s.code?.toString()}:n.message?{message:n.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let t=this.extractParts(e).text||"",n=e.candidates?.[0]?.finishReason,s="complete";return n==="MAX_TOKENS"?s="interrupted":(n==="SAFETY"||n==="RECITATION")&&(s="failed"),{text:t,status:s}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return null;let t=this.extractParts(e);return t.text||t.reasoning?t:null}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):null}thinkingLevelFor(e,t){let n=["minimal","low","medium","high"][t];return n==="minimal"&&e<3.5?"low":n}isGeminiResponse(e){return typeof e=="object"&&e!==null&&"candidates"in e&&Array.isArray(e.candidates)}extractParts(e){let t=e.candidates?.[0]?.content?.parts;if(!t)return{};let n="",s="";for(let i of t)i.text&&(i.thought?s+=i.text:n+=i.text);return{text:n||void 0,reasoning:s||void 0}}checkGeminiError(e){if(this.isGeminiResponse(e)&&e.promptFeedback?.blockReason){let t=e.promptFeedback.blockReason;throw new we(`Prompt blocked: ${t}`)}}}});var uo,Zl=v(()=>{oo();uo=class extends Nr{constructor(){super(...arguments),this.providerName="Ollama",this.defaultBaseUrl="http://localhost:11434",this.path="/chat/completions"}buildHeaders(e){let t={"Content-Type":"application/json",Accept:"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}buildPayload(e,t,n,s){return{model:t,messages:e,stream:s}}}});function zt(r){let e=zE.get(r);if(!e)throw new Error(`Unsupported protocol: ${r}`);return e}function GE(r,e){return r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)}async function eu(r,e){let t=zt(r.protocol),n=t.getPath(r.model,e.stream),s=GE(r.baseUrl,n),i=t.buildHeaders(r.apiKey,e.origin),o=t.buildPayload(e.messages,r.model,{effort:e.effort,webSearch:e.webSearch},e.stream);return e.modifyPayload?.(o),fetch(s,{method:"POST",headers:i,body:JSON.stringify(o),signal:e.signal})}function XE(r){return/prompt is too long|context[_ ](length|window)|maximum context|token count exceeds|too many tokens/i.test(r)}async function Ir(r,e){let t=zt(e),n=await r.text().catch(()=>""),{message:s}=t.parseError(n,r.status),i=r.status,o="unknown";return i===429?o="rate_limit":(i===413||XE(s))&&(o="context_exceeded"),{code:o,message:s,retryable:i===429||i>=500}}var Vh,zE,tu=v(()=>{zl();Gl();Xl();Ql();Zl();Vh=new uo,zE=new Map([["openai",new io],["openrouter",new ao],["anthropic",new co],["gemini",new lo],["ollama",Vh],["openai-compat",Vh]])});function zh(r){let e=r.indexOf(`\r
|
|
1220
1288
|
\r
|
|
1221
1289
|
`),t=r.indexOf(`
|
|
1222
1290
|
|
|
1223
|
-
`);return e!==-1&&(t===-1||e<t)?{pos:e,len:4}:t!==-1?{pos:t,len:2}:{pos:-1,len:0}}function
|
|
1224
|
-
`).trim();if(!n)return null;if(n==="[DONE]")return"done";try{return JSON.parse(n)}catch{return null}}async function*
|
|
1291
|
+
`);return e!==-1&&(t===-1||e<t)?{pos:e,len:4}:t!==-1?{pos:t,len:2}:{pos:-1,len:0}}function ru(r){let t=r.split(/\r?\n/).filter(s=>s.startsWith("data:"));if(!t.length)return null;let n=t.map(s=>s.replace(/^data:\s?/,"")).join(`
|
|
1292
|
+
`).trim();if(!n)return null;if(n==="[DONE]")return"done";try{return JSON.parse(n)}catch{return null}}async function*Gh(r,e,t){let n=new TextDecoder,s="",i,o=e?new Promise((a,c)=>{e.aborted&&c(new Error("Aborted")),i=()=>c(new Error("Aborted")),e.addEventListener("abort",i,{once:!0})}):null;o?.catch(()=>{});try{for(;;){let{done:a,value:c}=o?await Promise.race([r.read(),o]):await r.read();if(a){if(s.trim()){let u=ru(s);u!==null&&u!=="done"&&(yield u)}return}t?.(),s+=n.decode(c,{stream:!0});let{pos:l,len:d}=zh(s);for(;l!==-1;){let u=s.slice(0,l);s=s.slice(l+d);let f=ru(u);if(f==="done")return;f!==null&&(yield f),{pos:l,len:d}=zh(s)}}}finally{i&&e?.removeEventListener("abort",i);try{await r.cancel()}catch{}}}async function Gt(r,e){if(!r.body)throw new Error("Response body is missing");let t="";for await(let n of Xt(r,e))n.kind==="text"&&(t+=n.text);return t}async function*Xt(r,e){let t=e??(r.headers.get("X-Provider-Protocol")||"openai"),n=zt(t);if(!r.body)return;let s=r.body.getReader();for await(let i of Gh(s)){let o=n.parseStreamChunk(i);o?.reasoning&&(yield{kind:"reasoning",text:o.reasoning}),o?.text&&(yield{kind:"text",text:o.text})}}var Xh=v(()=>{tu()});import{strToU8 as QE,strFromU8 as ZE,deflateSync as eA,inflateSync as tA}from"fflate";function su(r,e){let t=[];if(t.push(`You are a data processor. Follow the instructions to analyze the provided data. Output valid JSON that the code can consume.
|
|
1225
1293
|
|
|
1226
1294
|
---
|
|
1227
1295
|
Instructions:
|
|
@@ -1239,21 +1307,21 @@ ${n}
|
|
|
1239
1307
|
</data>`)}return t.push(`
|
|
1240
1308
|
Output only valid JSON. No explanation, no markdown fences, just the JSON object. Every number must be a JSON literal \u2014 never an expression like 2 * pi; write the computed decimal instead.`),t.join(`
|
|
1241
1309
|
|
|
1242
|
-
`)}function
|
|
1243
|
-
`)}var Ir,iA,oA,aA,cA,Qn,co,Zn,Gt=v(()=>{Ir={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};iA="https://api.typebulb.com/api/models",oA=1440*60*1e3,aA=5e3,cA=60*1e3,Qn=null,co=null,Zn=null});function st(r,e){let t=r??process.env.TB_AI_PROVIDER,n=e??process.env.TB_AI_MODEL;if(!t)return"No provider specified. Set TB_AI_PROVIDER in your .env file or pass provider in the tb.ai() call.";if(!n)return"No model specified. Set TB_AI_MODEL in your .env file or pass model in the tb.ai() call.";let s;try{s=Yt(t)}catch{return`Unknown provider '${t}'.`}if(t==="ollama")return{apiKey:"",baseUrl:`${$r(process.env.OLLAMA_HOST??s.defaultBaseUrl)}/v1`,protocol:t,model:n,isFreeModel:!1};if(t==="openai-compat"){let a=process.env.TB_AI_BASE_URL;return a?{apiKey:process.env.TB_AI_API_KEY??"",baseUrl:a,protocol:t,model:n,isFreeModel:!1}:"No base URL for openai-compat. Set TB_AI_BASE_URL (the OpenAI-style base ending in /v1, e.g. http://localhost:1234/v1) in your .env file."}let i=Ir[t];if(!i)return`Unknown provider '${t}'.`;let o=process.env[i];return o?{apiKey:o,baseUrl:s.defaultBaseUrl,protocol:t,model:n,isFreeModel:!1}:`No API key for '${t}'. Set ${i} in your .env file.`}function xt(r,e){let t=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(s=>({role:s.role,content:s.content}))],n=e.effort;return Xl(r,{messages:t,stream:!0,effort:n!=null&&n>=0&&n<=3?n:void 0,webSearch:e.webSearch??!0,signal:e.signal})}var uo=v(()=>{Nr();Gt()});import*as Lr from"fs/promises";import*as it from"path";function fo(r,e,t=e){let n=it.resolve(e,r),s=it.normalize(t),i=it.normalize(n);if(i!==s&&!i.startsWith(s+it.sep))throw new Error("Path traversal detected - access denied");return n}async function es(r,e,t){return Lr.readFile(fo(r,e,t))}async function po(r,e,t,n){let s=fo(r,t,n);await Lr.mkdir(it.dirname(s),{recursive:!0}),await Lr.writeFile(s,typeof e=="string"?e:Buffer.from(e))}var au=v(()=>{});async function Zh(r){let e=st(r.provider,r.model);if(typeof e=="string")throw new Error(e);let t=await xt(e,r);if(!t.ok){let n=await _r(t,e.protocol);throw new Error(n.message)}return{response:t,protocol:e.protocol}}async function fA(r){let{response:e,protocol:t}=await Zh(r);return{text:await Vt(e,t)}}async function*pA(r){let{response:e,protocol:t}=await Zh(r);yield*zt(e,t)}function eg(r,e=process.cwd()){let t=Object.assign(fA,{stream:pA}),n={read:async s=>{let i=await es(s,r,e);try{return new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{throw new Error(`File is not valid UTF-8 text: ${s} \u2014 use tb.fs.readBytes() for binary files.`)}},readBytes:async s=>new Uint8Array(await es(s,r,e)),write:async(s,i)=>(await po(s,i,r,e),!0)};globalThis.tb=Object.freeze({log:(...s)=>{console.log(...s)},ai:t,fs:n,dir:r,models:()=>nt(),hasOwnKeys:lo,mode:"local"})}var tg=v(()=>{Nr();uo();Gt();au()});import*as Be from"fs/promises";import*as se from"path";import{pathToFileURL as mA}from"url";async function rg(r){let t=(await Be.readdir(r)).find(n=>n.endsWith(".bulb.md"));return t?se.join(r,t):null}function Et(r,e){let t=se.resolve(r),n=se.join(se.dirname(t),se.basename(t).replace(/\.bulb\.md$/,""));return e?se.join(n,"batches",e):n}async function Mr(r,e){let t=Et(r,e);await Be.mkdir(t,{recursive:!0});let n=new Date;await Be.utimes(t,n,n).catch(()=>{})}function Br(r){let[e,t,n,s]=r.split(se.sep).slice(-4);if(!(e!=="typebulbs"||t!=="u"||!n||!s?.endsWith(".bulb.md")))return{userSlug:n,slug:s.slice(0,-8)}}async function De(r){let e=await Be.readFile(r,"utf-8"),t=ue(e);if(!t)throw new Error("Invalid .bulb.md file format");let n=xr(t);return{bulb:n,config:Qr(n.config),warnings:Ad(e),starts:t.starts}}function cu(r){let e=se.basename(r).replace(/\.bulb\.md$/i,"");return se.join(se.dirname(r),".typebulb",`${e}.server.mjs`)}async function ts(r,e,t,n,s){let i=_l(r,{serverOnly:!0});if(i.error)throw new Error(`Server compilation error: ${i.error}`);let o=i.code;t&&(o=await vd(o,t));let a=se.join(se.dirname(e),".typebulb");await Be.mkdir(a,{recursive:!0});let c=to(o);c.length>0&&await eo(c,a,n);let l=cu(e);return await Be.writeFile(l,o,"utf-8"),eg(Et(e,s)),await import(`${mA(l).href}?t=${Date.now()}`)}async function lu(r,e,t,n,s){let{bulb:i,config:o,starts:a}=await De(r),c=Ei(i.data);yh(i.code,o.dependencies??{});let l=_l(i.code,{jsxImportSource:o.ts?.jsxImportSource});l.error&&console.error("Compilation error:",l.error);let{importMap:d}=await Yi.buildImportMap(l.code,o.dependencies??{},n?new Set([n.name]):void 0);n&&(d.imports[n.name]=n.entryUrl);let u=Fh({name:i.name,code:l.code,css:i.css,html:i.html,data:c,insight:i.insight,importMap:d,dir:Et(r,s),watch:e,source:{file:se.basename(r),codeLine:a.get("code.tsx")??1}}),f=null;return i.server&&t&&(f=await ts(i.server,r,n,o.dependencies,s)),{html:u,bulb:i,serverExports:f}}var At,Ke=v(()=>{jn();fh();bh();Kl();qh();Hl();ks();tg();At=(r,e)=>se.join(Et(r,e),"assets")});import{readdirSync as ng,readFileSync as hA,statSync as sg}from"fs";import{join as mo,basename as gA}from"path";function ig(r,e,t){if(e>8)return t;let n;try{n=ng(r,{withFileTypes:!0})}catch{return t}for(let s of n)if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;ig(mo(r,s.name),e+1,t)}else s.isFile()&&s.name.endsWith(".bulb.md")&&t.push(mo(r,s.name));return t}function uu(r){let e=mo(Et(r),"batches"),t;try{t=ng(e,{withFileTypes:!0})}catch{return[]}return t.filter(n=>n.isDirectory()).map(n=>{let s=0;try{s=sg(mo(e,n.name)).mtimeMs}catch{}return{name:n.name,mtime:s}}).sort((n,s)=>s.mtime-n.mtime).map(n=>n.name)}function ho(r){return ig(r,0,[]).map(e=>{let t=0;try{t=sg(e).mtimeMs}catch{}let n,s=!1;try{let i=hA(e,"utf8");n=Bi(i.slice(0,1024));let o=ue(i);s=!!o&&Mi(xr(o))}catch{}return{path:e,name:n??gA(e).replace(/\.bulb\.md$/,""),mtime:t,serverOnly:s}})}var og=v(()=>{le();jn();Rl();Ke()});import*as lg from"net";import{mkdir as yA,readFile as bA,writeFile as ug}from"fs/promises";import{existsSync as wA}from"fs";import{join as dg}from"path";function mg(){return dg(Sr(),"blocks")}function du(r){return dg(mg(),`${r}.json`)}function yo(r){return new Promise(e=>{let t=lg.createServer();t.once("error",()=>e(!1)),t.listen(r,"127.0.0.1",()=>t.close(()=>e(!0)))})}async function kA(r){for(let e=r;e<65535;e++)if(await yo(e))return e;throw new Error(`No free port found above ${r}`)}async function fu(r){let e=(await Q()).find(n=>n.port===r),t=e?` (pid ${e.pid}, ${e.agent?`agent:${e.agent}`:e.file})`:"";console.error(`port ${r} in use${t}`),process.exit(1)}async function bo(r){try{let e=JSON.parse(await bA(du(r),"utf8"));return e&&typeof e.cwd=="string"?{cwd:e.cwd,slots:e.slots??{},mirrors:e.mirrors??{}}:void 0}catch{return}}async function wo(r,e){await ug(du(r),JSON.stringify(e,null,2))}async function xA(r){let e=X(r);try{await yA(mg(),{recursive:!0})}catch{return}let t=[];for(let o=0;o<pg;o++)t.push(fg+o*Xt);let n=await Promise.all(t.map(async o=>({base:o,block:await bo(o)})));for(let{base:o,block:a}of n)if(a?.cwd===e)return o;let s={cwd:e,slots:{},mirrors:{}};for(let{base:o,block:a}of n){if(!a)try{return await ug(du(o),JSON.stringify(s,null,2),{flag:"wx"}),o}catch{if((await bo(o))?.cwd===e)return o;continue}if(!wA(a.cwd))return await wo(o,s),o}let i=n.filter(o=>!!o.block).sort((o,a)=>ag(o.block)-ag(a.block))[0];if(i)return await wo(i.base,s),i.base}function ag(r){return Object.values(r.slots).reduce((e,t)=>Math.max(e,t.usedAt??0),0)}async function EA(r,e){let t=await bo(r)??{cwd:"",slots:{},mirrors:{}};if(e.kind==="mirror"){let i=t.mirrors[e.agent];if(i!==void 0)return i;let o=cg(t),a=o.has(0)?SA:0;for(;a>go&&o.has(a);)a--;return t.mirrors[e.agent]=a,await wo(r,t),a}let n=X(e.file),s=t.slots[n]?.offset;if(s===void 0){let i=cg(t);for(s=go;s<Xt&&i.has(s);)s++;if(s>=Xt){let o=Object.entries(t.slots).sort((a,c)=>(a[1].usedAt??0)-(c[1].usedAt??0))[0];s=o?o[1].offset:go,o&&delete t.slots[o[0]]}}return t.slots[n]={offset:s,usedAt:Date.now()},await wo(r,t),s}function cg(r){return new Set([...Object.values(r.mirrors),...Object.values(r.slots).map(e=>e.offset)])}async function AA(r,e){let t=await xA(e);return t===void 0?void 0:t+await EA(t,r)}async function rs(r){let e=X(r);for(let t=0;t<pg;t++){let n=await bo(fg+t*Xt);if(n?.cwd===e)return s=>n.slots[X(s)]?.usedAt??0}return()=>0}async function vo(r){if(r.explicit!==void 0)return await yo(r.explicit)||await fu(r.explicit),{port:r.explicit};let e=await AA(r.target,r.cwd);if(e!==void 0){let n=e-e%Xt;for(let s=0;s<4;s++){if(await yo(e))return{port:e};await new Promise(i=>setTimeout(i,150))}for(let s=go;s<Xt;s++){let i=n+s;if(i!==e&&await yo(i))return{port:i,note:`(slot ${e} was busy)`}}}return{port:await kA(vA),note:e===void 0?"(no port block available)":"(this project's block was full)"}}var fg,Xt,pg,vA,go,SA,Dr=v(()=>{Mn();Ie();fg=20100,Xt=100,pg=19,vA=23e3,go=1,SA=Xt-1});function jr(r){if(r.server.trim())return"server-side code (server.ts)";let e=r.code;if(/\btb\s*\.\s*fs\b/.test(e)||e.includes("/__fs"))return"the filesystem";if(/\btb\s*\.\s*ai\b/.test(e)||e.includes("/__ai")||r.infer.trim()||/\btb\s*\.\s*infer\b/.test(e))return"AI (your API keys)";if(/\btb\s*\.\s*server\s*\.\s*\w/.test(e)||e.includes("/__api"))return"server-side code (server.ts)"}var So=v(()=>{});import{readFile as TA}from"fs/promises";async function pu(r){try{let e=ue(await TA(r,"utf-8"));return e?jr(xr(e)):void 0}catch{return}}var hg=v(()=>{jn();So()});function mu(r){let e=ue(r);if(!e)return r;let t=e.files.get("code.tsx");if(!t)return r;let n=gh(t);if(!n.length)return r;let s=e.files.get("config.json"),i={};if(s)try{let l=JSON.parse(s);l&&typeof l=="object"&&(i=l)}catch{}let o=i.dependencies&&typeof i.dependencies=="object"?{...i.dependencies}:{},a=n.filter(l=>!(l in o));if(!a.length)return r;for(let l of a)o[l]="latest";i.dependencies=o;let c={name:e.frontmatter.name};for(let[l,d]of e.files){let u=Sd(l);u&&(c[u]=d)}return c.config=JSON.stringify(i,null,2),Cd(c)}var gg=v(()=>{le();Di()});import{spawn as yg}from"child_process";import{basename as OA}from"path";function PA(){return process.env.TYPEBULB_EDITOR||"code"}function RA(r,e,t){return t==null?[e]:CA.test(OA(r))?["-g",`${e}:${t}`]:[`+${t}`,e]}function _A(r,e){let t=PA();return{command:t,args:RA(t,r,e)}}function hu(r,e){let{command:t,args:n}=_A(r,e),s=process.platform==="win32"?yg("cmd.exe",["/d","/s","/c",t,...n],{detached:!0,stdio:"ignore",windowsHide:!0}):yg(t,n,{detached:!0,stdio:"ignore"});s.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),s.unref()}var CA,bg=v(()=>{CA=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i});import{readFileSync as NA,writeFileSync as IA,mkdirSync as $A}from"fs";import{join as LA}from"path";function wg(){return LA(Sr(),"trust.json")}function gu(){try{let r=JSON.parse(NA(wg(),"utf8"));return new Set(Array.isArray(r)?r:[])}catch{return new Set}}function MA(r){$A(Sr(),{recursive:!0}),IA(wg(),JSON.stringify([...r]))}function Qt(r){return gu().has(X(r))}function Fr(r,e){let t=gu(),n=X(r);(e?t.has(n):!t.has(n))||(e?t.add(n):t.delete(n),MA(t))}function yu(){return[...gu()]}var ns=v(()=>{Mn()});import{readFileSync as W$,existsSync as BA}from"fs";import*as qr from"path";import{fileURLToPath as DA}from"url";function jA(){let r=qr.dirname(DA(import.meta.url));for(;!BA(qr.join(r,"package.json"));){let e=qr.dirname(r);if(e===r)break;r=e}return r}function ss(){return qr.join(jA(),"SKILL.md")}var bu=v(()=>{});import{readFileSync as vg,existsSync as FA}from"fs";import*as He from"path";function Sg(r){return[...r?[`.env.${r}.local`,`.env.${r}`]:[],".env.local",".env"]}function Ae(r,e=process.cwd()){let t={},n=[];for(let s of Sg(r)){let i;try{i=vg(He.resolve(e,s),"utf-8")}catch{continue}n.push(s);for(let[o,a]of kg(i))process.env[o]===void 0&&(process.env[o]=a,t[o]=s)}return{mode:r,sources:t,loaded:n}}function*kg(r){for(let e of r.split(`
|
|
1244
|
-
`)){let t=e.trim();if(!t||t.startsWith("#"))continue;let n=t.indexOf("=");if(n===-1)continue;let s=t.slice(0,n).trim(),i=t.slice(n+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function
|
|
1245
|
-
Expected <origin>/u/<user>/<slug>`);let c=a[1],l=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:c,slug:l,dest:Te.join(e,
|
|
1246
|
-
A pull target must be a bulb URL, or a local file at typebulbs/u/<user>/<slug>.bulb.md \u2014 the path is its remote identity.`);return{origin:t,...s,dest:n}}async function
|
|
1247
|
-
`),n=ue(t(r)),s=ue(t(e));return!n||!s?t(r)===t(e):n.frontmatter.name===s.frontmatter.name&&Ce.every(i=>(n.files.get(ae[i].path)||"")===(s.files.get(ae[i].path)||""))}async function
|
|
1310
|
+
`)}function Qn(r){try{return JSON.parse(r)}catch{return null}}function nA(r,e){let t="",n=0,s=!1,i=!1;for(let o=0;o<r.length;o++){let a=r[o];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}a==='"'&&(s?(t+=r.slice(n,o+1),n=o+1):(t+=e(r.slice(n,o))+'"',n=o+1),s=!s)}return t+=s?r.slice(n):e(r.slice(n)),t}function sA(r){let e=nA(r,t=>t.replace(/\bpi\b/g,"3.141592653589793").replace(/\be\b/g,"2.718281828459045").replace(/-?\d[\d.\s+\-*/()]*\d|\(-?\d[\d.\s+\-*/()]*\d\)/g,n=>{if(!/[+\-*/]/.test(n.replace(/^-/,""))||n.length>64||!/^[\d\s.+\-*/()]+$/.test(n))return n;try{let s=Function(`"use strict"; return (${n})`)();return typeof s=="number"&&Number.isFinite(s)?String(s):n}catch{return n}}));return e!==r?e:null}function iA(r,e){let t=0,n=!1,s=!1;for(let i=e;i<r.length;i++){let o=r[i];if(s){s=!1;continue}if(o==="\\"){s=!0;continue}if(o==='"'){n=!n;continue}if(!n){if(o==="{"||o==="[")t++;else if((o==="}"||o==="]")&&(t--,t===0))return i}}return-1}function oA(r){let e=null,t=0;for(;t<r.length;){let n=r[t];if(n==="{"||n==="["){let s=iA(r,t);if(s!==-1){let i=r.slice(t,s+1),o=Qn(i);o!==null&&(e={parsed:o,json:i}),t=s+1;continue}}t++}return e}function iu(r){let e=[],t=r.trim();t.startsWith("```")&&(t=t.replace(/^```(?:json)?\s*\n?/,"").replace(/\n?```\s*$/,""),e.push("markdown fences"));let n=Qn(t);if(n!==null)return{parsed:n,json:t,fixesApplied:e};let s=t.match(/```(?:json)?\s*\n([\s\S]*?)\n?```\s*$/);if(s&&(t=s[1].trim(),e.push("preamble before fenced JSON"),n=Qn(t),n!==null))return{parsed:n,json:t,fixesApplied:e};if(!t.startsWith("{")&&!t.startsWith("[")){let o=t.indexOf("{"),a=t.indexOf("["),c=o>=0&&a>=0?Math.min(o,a):o>=0?o:a;if(c>0&&(t=t.slice(c),e.push("preamble text"),n=Qn(t),n!==null))return{parsed:n,json:t,fixesApplied:e}}for(let[o,a]of rA){let c=a(t);if(c!==null){let l=Qn(c);if(l!==null)return{parsed:l,json:c,fixesApplied:[...e,o]}}}let i=oA(r);return i!==null?{...i,fixesApplied:[...e,"extracted last JSON value"]}:{parsed:null,json:t,fixesApplied:e}}function ou(r){try{let e={i:r.insight,d:r.data},t=JSON.stringify(e),n=eA(QE(t),{level:9}),s=cA(n),i=`${Qh}:${s}`;return i.length>aA?"":"#"+nu+i}catch{return""}}function au(r){try{let e=r.startsWith("#")?r.slice(1):r;if(!e.startsWith(nu))return null;let t=e.slice(nu.length),n=t.indexOf(":");if(n===-1||t.slice(0,n)!==Qh)return null;let s=lA(t.slice(n+1)),i=JSON.parse(ZE(tA(s)));return!i||typeof i.i>"u"||!Array.isArray(i.d)?null:{insight:i.i,insightJson:JSON.stringify(i.i,null,2),data:i.d}}catch{return null}}function cA(r){let e="";for(let t=0;t<r.length;t+=32768)e+=String.fromCharCode(...r.subarray(t,t+32768));return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function lA(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";let t=atob(e),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n}var rA,nu,Qh,aA,Zh=v(()=>{rA=[["orphan quote",r=>{let e=r.replace(/^[ \t]*"[ \t]*\r?\n/gm,"");return e!==r?e:null}],["trailing }",r=>r.endsWith("}}")?r.slice(0,-1):null],["trailing ]",r=>r.endsWith("]]")?r.slice(0,-1):null],["trailing },",r=>r.endsWith("},")?r.slice(0,-1):null],["trailing ],",r=>r.endsWith("],")?r.slice(0,-1):null],["trailing comma in object",r=>r.match(/,\s*\}$/)?r.replace(/,\s*\}$/,"}"):null],["trailing comma in array",r=>r.match(/,\s*\]$/)?r.replace(/,\s*\]$/,"]"):null],["arithmetic constants",sA]];nu="tb=",Qh="1",aA=6e4});var $r=v(()=>{Yh();_r();tu();Xh();Zh();oo();Xl();Ql();zl();Gl();Zl()});function Mr(r){return(r.includes("://")?r:`http://${r}`).replace(/\/+$/,"")}function cu(){return es}async function st(){let[r,e]=await Promise.all([tg(),hA()]);return mA([...gA(e),...r],process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL)}function mA(r,e,t){return!e||!t?r:r.map(n=>n.provider===e&&n.name===t?{...n,default:!0}:n)}async function eg(){let r;try{r=await fetch(uA,{signal:AbortSignal.timeout(fA)})}catch(e){return es=`catalog fetch failed: ${e?.message??e}`,null}if(!r.ok)return es=`catalog fetch failed: HTTP ${r.status}`,null;try{return await r.json()}catch(e){return es=`catalog returned an unreadable body: ${e?.message??e}`,null}}async function hA(){if(Zn&&Date.now()-Zn.fetchedAt<=dA)return Zn.models;let r=await eg()??await eg();return r?(Zn={models:r,fetchedAt:Date.now()},es=null,r):Zn?.models??[]}async function tg(){if(fo&&Date.now()-fo.fetchedAt<=pA)return fo.models;let r=Mr(process.env.OLLAMA_HOST??"http://localhost:11434"),e=[];try{let t=await fetch(new URL("/api/tags",r).toString());t.ok&&(e=((await t.json()).models??[]).map(s=>s.name).filter(s=>!!s).map(s=>({provider:"ollama",name:s,friendlyName:s,providerName:"Ollama"})))}catch{}return fo={models:e,fetchedAt:Date.now()},e}function gA(r){let e=new Set(Object.entries(Lr).filter(([,t])=>!!process.env[t]).map(([t])=>t));return r.filter(t=>e.has(t.provider))}function lu(){return Object.values(Lr).some(r=>!!process.env[r])}async function po(){return lu()||process.env.TB_AI_BASE_URL||(await tg()).length>0?"own":"none"}function rg(r,e,t){let n=Math.max(...r.map(o=>o.name.length)),s=Math.max(...r.map(o=>o.friendlyName.length)),i=["Models available to tb.ai (filtered by your .env keys):",""];for(let o of r)i.push(` ${o.name.padEnd(n)} ${o.friendlyName.padEnd(s)} (${o.provider})`);return i.push("","Pass an id as the `model` in tb.ai({ provider, model })."),e&&t&&i.push(`Default (from .env): ${e} / ${t}`),i.join(`
|
|
1311
|
+
`)}var Lr,uA,dA,fA,pA,Zn,fo,es,Qt=v(()=>{Lr={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};uA="https://api.typebulb.com/api/models",dA=1440*60*1e3,fA=5e3,pA=60*1e3,Zn=null,fo=null,es=null});function it(r,e){let t=r??process.env.TB_AI_PROVIDER,n=e??process.env.TB_AI_MODEL;if(!t)return"No provider specified. Set TB_AI_PROVIDER in your .env file or pass provider in the tb.ai() call.";if(!n)return"No model specified. Set TB_AI_MODEL in your .env file or pass model in the tb.ai() call.";let s;try{s=zt(t)}catch{return`Unknown provider '${t}'.`}if(t==="ollama")return{apiKey:"",baseUrl:`${Mr(process.env.OLLAMA_HOST??s.defaultBaseUrl)}/v1`,protocol:t,model:n,isFreeModel:!1};if(t==="openai-compat"){let a=process.env.TB_AI_BASE_URL;return a?{apiKey:process.env.TB_AI_API_KEY??"",baseUrl:a,protocol:t,model:n,isFreeModel:!1}:"No base URL for openai-compat. Set TB_AI_BASE_URL (the OpenAI-style base ending in /v1, e.g. http://localhost:1234/v1) in your .env file."}let i=Lr[t];if(!i)return`Unknown provider '${t}'.`;let o=process.env[i];return o?{apiKey:o,baseUrl:s.defaultBaseUrl,protocol:t,model:n,isFreeModel:!1}:`No API key for '${t}'. Set ${i} in your .env file.`}function At(r,e){let t=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(s=>({role:s.role,content:s.content}))],n=e.effort;return eu(r,{messages:t,stream:!0,effort:n!=null&&n>=0&&n<=3?n:void 0,webSearch:e.webSearch??!0,signal:e.signal})}var mo=v(()=>{$r();Qt()});import*as Br from"fs/promises";import*as ot from"path";function ho(r,e,t=e){let n=ot.resolve(e,r),s=ot.normalize(t),i=ot.normalize(n);if(i!==s&&!i.startsWith(s+ot.sep))throw new Error("Path traversal detected - access denied");return n}async function ts(r,e,t){return Br.readFile(ho(r,e,t))}async function go(r,e,t,n){let s=ho(r,t,n);await Br.mkdir(ot.dirname(s),{recursive:!0}),await Br.writeFile(s,typeof e=="string"?e:Buffer.from(e))}var uu=v(()=>{});async function ng(r){let e=it(r.provider,r.model);if(typeof e=="string")throw new Error(e);let t=await At(e,r);if(!t.ok){let n=await Ir(t,e.protocol);throw new Error(n.message)}return{response:t,protocol:e.protocol}}async function yA(r){let{response:e,protocol:t}=await ng(r);return{text:await Gt(e,t)}}async function*bA(r){let{response:e,protocol:t}=await ng(r);yield*Xt(e,t)}function sg(r,e=process.cwd()){let t=Object.assign(yA,{stream:bA}),n={read:async s=>{let i=await ts(s,r,e);try{return new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{throw new Error(`File is not valid UTF-8 text: ${s} \u2014 use tb.fs.readBytes() for binary files.`)}},readBytes:async s=>new Uint8Array(await ts(s,r,e)),write:async(s,i)=>(await go(s,i,r,e),!0)};globalThis.tb=Object.freeze({log:(...s)=>{console.log(...s)},ai:t,fs:n,dir:r,models:()=>st(),aiAccess:po,mode:"local"})}var ig=v(()=>{$r();mo();Qt();uu()});import*as De from"fs/promises";import*as se from"path";import{pathToFileURL as wA}from"url";async function og(r){let t=(await De.readdir(r)).find(n=>n.endsWith(".bulb.md"));return t?se.join(r,t):null}function Tt(r,e){let t=se.resolve(r),n=se.join(se.dirname(t),se.basename(t).replace(/\.bulb\.md$/,""));return e?se.join(n,"batches",e):n}async function Dr(r,e){let t=Tt(r,e);await De.mkdir(t,{recursive:!0});let n=new Date;await De.utimes(t,n,n).catch(()=>{})}function jr(r){let[e,t,n,s]=r.split(se.sep).slice(-4);if(!(e!=="typebulbs"||t!=="u"||!n||!s?.endsWith(".bulb.md")))return{userSlug:n,slug:s.slice(0,-8)}}async function je(r){let e=await De.readFile(r,"utf-8"),t=ue(e);if(!t)throw new Error("Invalid .bulb.md file format");let n=Ar(t);return{bulb:n,config:en(n.config),warnings:Od(e),starts:t.starts}}function du(r){let e=se.basename(r).replace(/\.bulb\.md$/i,"");return se.join(se.dirname(r),".typebulb",`${e}.server.mjs`)}async function rs(r,e,t,n,s){let i=$l(r,{serverOnly:!0});if(i.error)throw new Error(`Server compilation error: ${i.error}`);let o=i.code;t&&(o=await xd(o,t));let a=se.join(se.dirname(e),".typebulb");await De.mkdir(a,{recursive:!0});let c=so(o);c.length>0&&await no(c,a,n);let l=du(e);return await De.writeFile(l,o,"utf-8"),sg(Tt(e,s)),await import(`${wA(l).href}?t=${Date.now()}`)}async function fu(r,e,t,n,s){let{bulb:i,config:o,starts:a}=await je(r),c=Ai(i.data);Sh(i.code,o.dependencies??{});let l=$l(i.code,{jsxImportSource:o.ts?.jsxImportSource});l.error&&console.error("Compilation error:",l.error);let{importMap:d}=await Gi.buildImportMap(l.code,o.dependencies??{},n?new Set([n.name]):void 0);n&&(d.imports[n.name]=n.entryUrl);let u=Kh({name:i.name,code:l.code,css:i.css,html:i.html,data:c,insight:i.insight,importMap:d,dir:Tt(r,s),watch:e,source:{file:se.basename(r),codeLine:a.get("code.tsx")??1},compileError:l.error?String(l.error):void 0}),f=null;return i.server&&t&&(f=await rs(i.server,r,n,o.dependencies,s)),{html:u,bulb:i,serverExports:f}}var Pt,He=v(()=>{Fn();gh();kh();Yl();Hh();Vl();xs();ig();Pt=(r,e)=>se.join(Tt(r,e),"assets")});import{readdirSync as ag,readFileSync as vA,statSync as cg}from"fs";import{join as yo,basename as SA}from"path";function lg(r,e,t){if(e>8)return t;let n;try{n=ag(r,{withFileTypes:!0})}catch{return t}for(let s of n)if(s.isDirectory()){if(s.name.startsWith(".")||s.name==="node_modules")continue;lg(yo(r,s.name),e+1,t)}else s.isFile()&&s.name.endsWith(".bulb.md")&&t.push(yo(r,s.name));return t}function pu(r){let e=yo(Tt(r),"batches"),t;try{t=ag(e,{withFileTypes:!0})}catch{return[]}return t.filter(n=>n.isDirectory()).map(n=>{let s=0;try{s=cg(yo(e,n.name)).mtimeMs}catch{}return{name:n.name,mtime:s}}).sort((n,s)=>s.mtime-n.mtime).map(n=>n.name)}function bo(r){return lg(r,0,[]).map(e=>{let t=0;try{t=cg(e).mtimeMs}catch{}let n,s=!1;try{let i=vA(e,"utf8");n=Fi(i.slice(0,1024));let o=ue(i);s=!!o&&ji(Ar(o))}catch{}return{path:e,name:n??SA(e).replace(/\.bulb\.md$/,""),mtime:t,serverOnly:s}})}var ug=v(()=>{le();Fn();Il();He()});import*as pg from"net";import{mkdir as kA,readFile as xA,writeFile as mg}from"fs/promises";import{existsSync as EA}from"fs";import{join as hg}from"path";function bg(){return hg(Ut(),"blocks")}function mu(r){return hg(bg(),`${r}.json`)}function vo(r){return new Promise(e=>{let t=pg.createServer();t.once("error",()=>e(!1)),t.listen(r,"127.0.0.1",()=>t.close(()=>e(!0)))})}async function PA(r){for(let e=r;e<65535;e++)if(await vo(e))return e;throw new Error(`No free port found above ${r}`)}async function hu(r){let e=(await Q()).find(n=>n.port===r),t=e?` (pid ${e.pid}, ${e.agent?`agent:${e.agent}`:e.file})`:"";console.error(`port ${r} in use${t}`),process.exit(1)}async function So(r){try{let e=JSON.parse(await xA(mu(r),"utf8"));return e&&typeof e.cwd=="string"?{cwd:e.cwd,slots:e.slots??{},mirrors:e.mirrors??{}}:void 0}catch{return}}async function ko(r,e){await mg(mu(r),JSON.stringify(e,null,2))}async function OA(r){let e=X(r);try{await kA(bg(),{recursive:!0})}catch{return}let t=[];for(let o=0;o<yg;o++)t.push(gg+o*Zt);let n=await Promise.all(t.map(async o=>({base:o,block:await So(o)})));for(let{base:o,block:a}of n)if(a?.cwd===e)return o;let s={cwd:e,slots:{},mirrors:{}};for(let{base:o,block:a}of n){if(!a)try{return await mg(mu(o),JSON.stringify(s,null,2),{flag:"wx"}),o}catch{if((await So(o))?.cwd===e)return o;continue}if(!EA(a.cwd))return await ko(o,s),o}let i=n.filter(o=>!!o.block).sort((o,a)=>dg(o.block)-dg(a.block))[0];if(i)return await ko(i.base,s),i.base}function dg(r){return Object.values(r.slots).reduce((e,t)=>Math.max(e,t.usedAt??0),0)}async function CA(r,e){let t=await So(r)??{cwd:"",slots:{},mirrors:{}};if(e.kind==="mirror"){let i=t.mirrors[e.agent];if(i!==void 0)return i;let o=fg(t),a=o.has(0)?TA:0;for(;a>wo&&o.has(a);)a--;return t.mirrors[e.agent]=a,await ko(r,t),a}let n=X(e.file),s=t.slots[n]?.offset;if(s===void 0){let i=fg(t);for(s=wo;s<Zt&&i.has(s);)s++;if(s>=Zt){let o=Object.entries(t.slots).sort((a,c)=>(a[1].usedAt??0)-(c[1].usedAt??0))[0];s=o?o[1].offset:wo,o&&delete t.slots[o[0]]}}return t.slots[n]={offset:s,usedAt:Date.now()},await ko(r,t),s}function fg(r){return new Set([...Object.values(r.mirrors),...Object.values(r.slots).map(e=>e.offset)])}async function RA(r,e){let t=await OA(e);return t===void 0?void 0:t+await CA(t,r)}async function ns(r){let e=X(r);for(let t=0;t<yg;t++){let n=await So(gg+t*Zt);if(n?.cwd===e)return s=>n.slots[X(s)]?.usedAt??0}return()=>0}async function xo(r){if(r.explicit!==void 0)return await vo(r.explicit)||await hu(r.explicit),{port:r.explicit};let e=await RA(r.target,r.cwd);if(e!==void 0){let n=e-e%Zt;for(let s=0;s<4;s++){if(await vo(e))return{port:e};await new Promise(i=>setTimeout(i,150))}for(let s=wo;s<Zt;s++){let i=n+s;if(i!==e&&await vo(i))return{port:i,note:`(slot ${e} was busy)`}}}return{port:await PA(AA),note:e===void 0?"(no port block available)":"(this project's block was full)"}}var gg,Zt,yg,AA,wo,TA,Fr=v(()=>{xr();$e();gg=20100,Zt=100,yg=19,AA=23e3,wo=1,TA=Zt-1});function qr(r){if(r.server.trim())return"server-side code (server.ts)";let e=r.code;if(/\btb\s*\.\s*fs\b/.test(e)||e.includes("/__fs"))return"the filesystem";if(/\btb\s*\.\s*ai\b/.test(e)||e.includes("/__ai")||r.infer.trim()||/\btb\s*\.\s*infer\b/.test(e))return"AI (your API keys)";if(/\btb\s*\.\s*server\s*\.\s*\w/.test(e)||e.includes("/__api"))return"server-side code (server.ts)"}var Eo=v(()=>{});import{readFile as _A}from"fs/promises";async function gu(r){try{let e=ue(await _A(r,"utf-8"));return e?qr(Ar(e)):void 0}catch{return}}var wg=v(()=>{Fn();Eo()});function yu(r){let e=ue(r);if(!e)return r;let t=e.files.get("code.tsx");if(!t)return r;let n=vh(t);if(!n.length)return r;let s=e.files.get("config.json"),i={};if(s)try{let l=JSON.parse(s);l&&typeof l=="object"&&(i=l)}catch{}let o=i.dependencies&&typeof i.dependencies=="object"?{...i.dependencies}:{},a=n.filter(l=>!(l in o));if(!a.length)return r;for(let l of a)o[l]="latest";i.dependencies=o;let c={name:e.frontmatter.name};for(let[l,d]of e.files){let u=Ed(l);u&&(c[u]=d)}return c.config=JSON.stringify(i,null,2),Nd(c)}var vg=v(()=>{le();qi()});import{spawn as Sg}from"child_process";import{basename as NA}from"path";function IA(){return process.env.TYPEBULB_EDITOR||"code"}function LA(r,e,t){return t==null?[e]:$A.test(NA(r))?["-g",`${e}:${t}`]:[`+${t}`,e]}function MA(r,e){let t=IA();return{command:t,args:LA(t,r,e)}}function bu(r,e){let{command:t,args:n}=MA(r,e),s=process.platform==="win32"?Sg("cmd.exe",["/d","/s","/c",t,...n],{detached:!0,stdio:"ignore",windowsHide:!0}):Sg(t,n,{detached:!0,stdio:"ignore"});s.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),s.unref()}var $A,kg=v(()=>{$A=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i});import{readFileSync as BA,writeFileSync as DA,mkdirSync as jA}from"fs";import{join as FA}from"path";function xg(){return FA(Ut(),"trust.json")}function wu(){try{let r=JSON.parse(BA(xg(),"utf8"));return new Set(Array.isArray(r)?r:[])}catch{return new Set}}function qA(r){jA(Ut(),{recursive:!0}),DA(xg(),JSON.stringify([...r]))}function er(r){return wu().has(X(r))}function Ur(r,e){let t=wu(),n=X(r);(e?t.has(n):!t.has(n))||(e?t.add(n):t.delete(n),qA(t))}function vu(){return[...wu()]}var ss=v(()=>{xr()});import{readFileSync as sL,existsSync as UA}from"fs";import*as Jr from"path";import{fileURLToPath as JA}from"url";function KA(){let r=Jr.dirname(JA(import.meta.url));for(;!UA(Jr.join(r,"package.json"));){let e=Jr.dirname(r);if(e===r)break;r=e}return r}function is(){return Jr.join(KA(),"SKILL.md")}var Su=v(()=>{});import{readFileSync as Eg,existsSync as HA}from"fs";import*as We from"path";function Ag(r){return[...r?[`.env.${r}.local`,`.env.${r}`]:[],".env.local",".env"]}function Ae(r,e=process.cwd()){let t={},n=[];for(let s of Ag(r)){let i;try{i=Eg(We.resolve(e,s),"utf-8")}catch{continue}n.push(s);for(let[o,a]of Tg(i))process.env[o]===void 0&&(process.env[o]=a,t[o]=s)}return{mode:r,sources:t,loaded:n}}function*Tg(r){for(let e of r.split(`
|
|
1312
|
+
`)){let t=e.trim();if(!t||t.startsWith("#"))continue;let n=t.indexOf("=");if(n===-1)continue;let s=t.slice(0,n).trim(),i=t.slice(n+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[s,i]}}function Ao(r,e=process.cwd()){for(let t of Ag()){let n;try{n=Eg(We.resolve(e,t),"utf-8")}catch{continue}for(let[s,i]of Tg(n))if(s===r)return i}return process.env[r]}function WA(r){let e=new Set,t=/process\.env\.([A-Za-z_$][\w$]*)|process\.env\[\s*['"]([^'"]+)['"]\s*\]/g;for(let n;n=t.exec(r);)e.add(n[1]??n[2]);return[...e]}function Ot(r,e,t){let{sources:n,mode:s,loaded:i}=r,o=process.cwd(),a=We.dirname(e),c=`(mode: ${s??"none"})`,l=t?WA(t):[],d=l.filter(p=>n[p]).map(p=>`${p} \u2190 ${n[p]}`);d.length?console.log(`env: ${d.join(", ")} ${c}`):i.length&&console.log(`env: loaded ${i.join(", ")} ${c}`),s&&!i.some(p=>p===`.env.${s}`||p===`.env.${s}.local`)&&console.log(`env: mode=${s} \u2014 no .env.${s} found; using .env`);let u=We.resolve(a)!==We.resolve(o);if(u)for(let p of[".env.local",".env"])HA(We.join(a,p))&&console.log(`env: ${We.join(a,p)} present but not loaded (cwd is ${o})`);let f=l.filter(p=>process.env[p]===void 0);if(f.length){let p=u?` \u2014 try running from ${a}`:"";console.log(`env: server.ts reads ${f.join(", ")} but ${f.length>1?"they are":"it's"} unset${p}`)}}var Ct=v(()=>{});import*as ve from"fs/promises";import*as Te from"path";import{createHash as YA}from"crypto";async function xu(r,e,t){let n=[...r],s=async()=>{for(let i=n.shift();i!==void 0;i=n.shift())await t(i)};await Promise.all(Array.from({length:Math.min(e,r.length)},s))}function Kr(r){try{return JSON.parse(r).error||r}catch{return r}}async function Au(r,e){try{let t=await fetch(os(r),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});return t.ok?t.headers.get("content-type")?.includes("json")?{entries:await t.json()}:{error:"manifest response is not JSON \u2014 wrong origin?"}:{error:`manifest request failed (${t.status}): ${Kr(await t.text())}`}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function Tu(r,e){Ae(e);let t=process.env.TYPEBULB_ORIGIN||VA;try{return Oo(r,process.cwd(),t)}catch(n){console.error(n instanceof Error?n.message:String(n)),process.exit(1)}}function Oo(r,e,t){if(/^https?:\/\//i.test(r)){let i=new URL(r),o=i.pathname.split("/").filter(Boolean).map(decodeURIComponent),a=o[0]==="api"&&o[1]==="scripts"?o.slice(2):o;if(a[0]!=="u"||!a[1]||!a[2])throw new Error(`Not a bulb URL: ${r}
|
|
1313
|
+
Expected <origin>/u/<user>/<slug>`);let c=a[1],l=a[2].replace(/(\.bulb)?\.md$/,"");return{origin:i.origin,userSlug:c,slug:l,dest:Te.join(e,To(c,l))}}let n=Te.resolve(e,r),s=jr(n);if(!s)throw new Error(`Not a conventional bulb path: ${r}
|
|
1314
|
+
A pull target must be a bulb URL, or a local file at typebulbs/u/<user>/<slug>.bulb.md \u2014 the path is its remote identity.`);return{origin:t,...s,dest:n}}async function zA(r,e){let t=await Au(r,e);if("error"in t||!t.entries.length)return{kind:"none"};let n=t.entries,s=Pt(r.dest),i=[],o=[],a=0;for(let c of n){let l=await ve.readFile(Te.join(s,...c.path.split("/"))).catch(()=>{});l===void 0?i.push(c.path):Eu(l)===c.md5?a++:e.force?i.push(c.path):o.push(c.path)}return o.length?{kind:"conflict",paths:o}:{kind:"plan",toGet:i,unchanged:a}}async function GA(r,e,t){let n=Pt(r.dest),s=[],i=0;return await xu(e.toGet,4,async o=>{try{let a=await fetch(`${os(r)}/${Po(o)}`,{headers:t.token?{Authorization:`Bearer ${t.token}`}:{},signal:AbortSignal.timeout(t.timeoutMs??3e4)});if(!a.ok){s.push(`${o}: HTTP ${a.status}`);return}let c=Te.join(n,...o.split("/"));await ve.mkdir(Te.dirname(c),{recursive:!0}),await ve.writeFile(c,new Uint8Array(await a.arrayBuffer())),i++}catch(a){s.push(`${o}: ${a instanceof Error?a.message:String(a)}`)}}),{downloaded:i,unchanged:e.unchanged,errors:s}}async function Co(r,e={}){let t=await fetch(ku(r),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});if(!t.ok)return{kind:"http-error",status:t.status};let n=t.headers.get("content-type");if(!n?.includes("text/markdown"))return{kind:"not-markdown",contentType:n};let s=await t.text(),i;try{i=await ve.readFile(r.dest,"utf-8")}catch{}let o=i!==void 0&&XA(i,s);if(i!==void 0&&!o&&!e.force){let{mtime:l}=await ve.stat(r.dest);return{kind:"conflict",dest:r.dest,localMtime:l,remoteLastModified:t.headers.get("last-modified")}}let a=await zA(r,e);if(a.kind==="conflict")return{kind:"asset-conflict",dest:r.dest,paths:a.paths};if(!o){await ve.mkdir(Te.dirname(r.dest),{recursive:!0}),await ve.writeFile(r.dest,s);let l=new Date(t.headers.get("last-modified")??"");isNaN(l.getTime())||await ve.utimes(r.dest,new Date,l)}let c=a.kind==="plan"?await GA(r,a,e):void 0;return o?{kind:"up-to-date",dest:r.dest,assets:c}:{kind:"written",dest:r.dest,created:i===void 0,assets:c}}function XA(r,e){let t=i=>i.replace(/\r\n/g,`
|
|
1315
|
+
`),n=ue(t(r)),s=ue(t(e));return!n||!s?t(r)===t(e):n.frontmatter.name===s.frontmatter.name&&Ce.every(i=>(n.files.get(ae[i].path)||"")===(s.files.get(ae[i].path)||""))}async function Og(r,e){r||(console.error("Usage: typebulb pull <bulb url | typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1));let t=Tu(r,e.mode),n=`${t.origin}/u/${t.userSlug}/${t.slug}`,s;try{s=await Co(t,{force:e.force,token:process.env.TYPEBULB_TOKEN})}catch(o){console.error(`Could not reach ${t.origin}: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1;return}let i=Te.relative(process.cwd(),t.dest)||t.dest;switch(s.kind){case"written":console.log(`pulled ${n} \u2192 ${i}${s.created?"":" (overwritten)"}`),Pg(s.assets);return;case"up-to-date":console.log(`up to date: ${i}`),Pg(s.assets);return;case"conflict":console.error(`Refusing to overwrite ${i} \u2014 it differs from ${n}
|
|
1248
1316
|
local file modified ${s.localMtime.toISOString()}
|
|
1249
1317
|
remote last saved ${s.remoteLastModified??"unknown"}
|
|
1250
1318
|
Re-run with --force to overwrite the local file.`),process.exitCode=1;return;case"asset-conflict":console.error(`Refusing to overwrite local assets that differ from the hosted copies:
|
|
1251
1319
|
`+s.paths.map(o=>` assets/${o}`).join(`
|
|
1252
1320
|
`)+`
|
|
1253
|
-
Re-run with --force to overwrite them.`),process.exitCode=1;return;case"http-error":s.status===404?console.error(`Bulb not found: ${n}`):s.status===401||s.status===403?console.error(`This bulb is private (${s.status}) \u2014 pulling it needs a TYPEBULB_TOKEN for its owner.`):console.error(`Pull failed: ${t.origin} responded ${s.status}`),process.exitCode=1;return;case"not-markdown":console.error(`${n}.md did not return bulb markdown (got ${s.contentType??"no content-type"}) \u2014 is ${t.origin} a typebulb host?`),process.exitCode=1}}function
|
|
1321
|
+
Re-run with --force to overwrite them.`),process.exitCode=1;return;case"http-error":s.status===404?console.error(`Bulb not found: ${n}`):s.status===401||s.status===403?console.error(`This bulb is private (${s.status}) \u2014 pulling it needs a TYPEBULB_TOKEN for its owner.`):console.error(`Pull failed: ${t.origin} responded ${s.status}`),process.exitCode=1;return;case"not-markdown":console.error(`${n}.md did not return bulb markdown (got ${s.contentType??"no content-type"}) \u2014 is ${t.origin} a typebulb host?`),process.exitCode=1}}function Pg(r){if(!(!r||!r.downloaded&&!r.errors.length)){console.log(`assets: ${r.downloaded} downloaded${r.unchanged?`, ${r.unchanged} unchanged`:""}`);for(let e of r.errors)console.error(` asset failed \u2014 ${e} (a re-pull retries just the missing ones)`);r.errors.length&&(process.exitCode=1)}}var VA,To,ku,Po,os,Eu,Ro=v(()=>{Ct();le();He();VA="https://typebulb.com",To=(r,e)=>Te.join("typebulbs","u",r,`${e}.bulb.md`),ku=r=>`${r.origin}/u/${encodeURIComponent(r.userSlug)}/${encodeURIComponent(r.slug)}.md`,Po=r=>r.split("/").map(encodeURIComponent).join("/"),os=r=>`${r.origin}/u/${encodeURIComponent(r.userSlug)}/${encodeURIComponent(r.slug)}/assets`;Eu=r=>YA("md5").update(r).digest("hex")});import*as Ye from"fs/promises";import*as as from"path";async function Cg(r,e=""){let t=await Ye.readdir(r,{withFileTypes:!0}).catch(()=>[]),n=[];for(let s of t)s.isDirectory()?n.push(...await Cg(as.join(r,s.name),`${e}${s.name}/`)):s.isFile()&&n.push(e+s.name);return n}async function QA(r,e){let t=e.timeoutMs??3e4,n=os(r),s={Authorization:`Bearer ${e.token}`},i=Pt(r.dest);if(!await Ye.stat(i).then(h=>h.isDirectory()).catch(()=>!1))return{kind:"skipped"};let o=await Cg(i),a=await Au(r,{token:e.token,timeoutMs:t});if("error"in a)return{kind:"sync-error",message:a.error};let c=a.entries;if(!o.length&&!c.length)return{kind:"skipped"};let l=new Map(c.map(h=>[h.path,h.md5])),d=new Set(o),u=c.map(h=>h.path).filter(h=>!d.has(h)),f=0,p=0;try{await xu(o,4,async h=>{let m=await Ye.readFile(as.join(i,...h.split("/")));if(l.get(h)===Eu(m)){p++;return}let b=await fetch(`${n}/${Po(h)}`,{method:"PUT",body:new Uint8Array(m),headers:s,signal:AbortSignal.timeout(t)});if(!b.ok)throw new Error(`upload of '${h}' refused (${b.status}): ${Kr(await b.text())}`);f++})}catch(h){return{kind:"sync-error",message:h instanceof Error?h.message:String(h)}}return{kind:"synced",uploaded:f,unchanged:p,toDelete:u,base:Ps(r.userSlug,r.slug)}}async function ZA(r,e,t){let n=t.timeoutMs??3e4,s=os(r),i=[];for(let o of e)try{let a=await fetch(`${s}/${Po(o)}`,{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`},signal:AbortSignal.timeout(n)});if(!a.ok)return{deleted:i,error:`delete of '${o}' refused (${a.status}): ${Kr(await a.text())}`};i.push(o)}catch(a){return{deleted:i,error:a instanceof Error?a.message:String(a)}}return{deleted:i}}async function _o(r,e){let t=await Ye.readFile(r.dest,"utf-8"),{mtime:n}=await Ye.stat(r.dest),s=await QA(r,{token:e.token,timeoutMs:e.timeoutMs});if(s.kind==="sync-error")return{kind:"asset-error",message:s.message};let i=s.kind==="synced"?{uploaded:s.uploaded,unchanged:s.unchanged,deleted:[],base:s.base}:void 0,o={Authorization:`Bearer ${e.token}`,"Content-Type":"text/markdown; charset=utf-8"};e.force||(o["If-Unmodified-Since"]=n.toUTCString());let a=await fetch(ku(r),{method:"PUT",body:t,headers:o,signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0}),c=await a.text();if(a.status===409)return{kind:"conflict",message:Kr(c),assets:i};if(!a.ok)return{kind:"http-error",status:a.status,message:Kr(c),assets:i};let l=JSON.parse(c);if(await Ye.utimes(r.dest,new Date,new Date(l.updatedAt)),i&&s.kind==="synced"&&s.toDelete.length){let d=await ZA(r,s.toDelete,{token:e.token,timeoutMs:e.timeoutMs});i.deleted=d.deleted,d.error&&(i.pruneError=d.error)}return{kind:"pushed",created:l.created,serverStripped:l.serverStripped,updatedAt:l.updatedAt,assets:i}}async function Rg(r,e){r||(console.error("Usage: typebulb push <typebulbs/u/<user>/<slug>.bulb.md>"),process.exit(1)),/^https?:\/\//i.test(r)&&(console.error("push takes a local .bulb.md file, not a URL (the path is its remote identity)"),process.exit(1));let t=Tu(r,e.mode),n=process.env.TYPEBULB_TOKEN;n||(console.error("push needs TYPEBULB_TOKEN in your .env \u2014 create one on your typebulb.com settings page."),process.exit(1));let s=`${t.origin}/u/${t.userSlug}/${t.slug}`,i=as.relative(process.cwd(),t.dest)||t.dest,o;try{o=await _o(t,{token:n,force:e.force})}catch(a){let c=a instanceof Error?a.message:String(a);console.error(a?.code==="ENOENT"?`File not found: ${i}`:`Could not push to ${t.origin}: ${c}`),process.exitCode=1;return}switch(o.kind!=="asset-error"&&o.assets&&console.log(`assets: ${o.assets.uploaded} uploaded, ${o.assets.unchanged} unchanged \u2192 ${o.assets.base}`),o.kind){case"asset-error":console.error(`assets sync failed: ${o.message}
|
|
1254
1322
|
push refused: the bulb text was not pushed.`),process.exitCode=1;return;case"pushed":{console.log(`pushed ${i} \u2192 ${s}`),o.created&&(console.log(" created a new bulb, unlisted \u2014 nothing existed at this URL before"),console.log(" if you renamed this file, its previous bulb is still live at the old URL")),o.serverStripped&&console.log("note: the server.ts block was stripped on the server copy (CLI-only); your local file is untouched.");for(let a of o.assets?.deleted??[])console.log(` deleted ${a} (no longer in assets/)`);o.assets?.pruneError&&console.log(`note: asset cleanup incomplete \u2014 ${o.assets.pruneError}; the next push will retry.`);return}case"conflict":console.error(`${o.message}
|
|
1255
1323
|
pull to see the remote: typebulb pull ${i}
|
|
1256
|
-
or overwrite it: typebulb push ${i} --force`),process.exitCode=1;return;case"http-error":o.status===401?console.error("The server rejected TYPEBULB_TOKEN (401) \u2014 it may be revoked; mint a new one on the settings page."):console.error(`Push failed: ${t.origin} responded ${o.status}${o.message?` \u2014 ${o.message}`:""}`),process.exitCode=1}}var
|
|
1324
|
+
or overwrite it: typebulb push ${i} --force`),process.exitCode=1;return;case"http-error":o.status===401?console.error("The server rejected TYPEBULB_TOKEN (401) \u2014 it may be revoked; mint a new one on the settings page."):console.error(`Push failed: ${t.origin} responded ${o.status}${o.message?` \u2014 ${o.message}`:""}`),process.exitCode=1}}var Pu=v(()=>{le();Ro();He()});var Hr=v(()=>{$e();ug();Fr();wg();Il();vg();kg();ss();Qt();Qt();mo();Su();Ro();Pu();Ct()});import{copyFileSync as eT,existsSync as _g,mkdirSync as Ng,rmSync as tT,writeFileSync as rT}from"fs";import{homedir as nT}from"os";import*as Ve from"path";import{fileURLToPath as sT}from"url";function uT(){return lT.replace('"__TB_SKILL_PATH__"',JSON.stringify(is()))}function Ig(){try{if(!_g(No()))return}catch{return}try{let r=iT();Ng(Ve.dirname(r),{recursive:!0}),rT(r,uT()),tT(oT(),{force:!0})}catch{}try{let r=aT();if(!_g(r))return;let e=cT();Ng(Ve.dirname(e),{recursive:!0}),eT(r,e)}catch{}}var No,iT,oT,aT,cT,lT,$g=v(()=>{Hr();No=()=>Ve.join(nT(),".pi","agent"),iT=()=>Ve.join(No(),"extensions","typebulb.ts"),oT=()=>Ve.join(No(),"extensions","typebulb-wait.ts"),aT=()=>Ve.join(Ve.dirname(sT(import.meta.url)),"agents","pi","matchu-patchu.ts"),cT=()=>Ve.join(No(),"extensions","matchu-patchu.ts"),lT=String.raw`// Generated by typebulb — do not edit; overwritten on each run.
|
|
1257
1325
|
import { spawn } from "node:child_process";
|
|
1258
1326
|
import { existsSync } from "node:fs";
|
|
1259
1327
|
|
|
@@ -1398,32 +1466,32 @@ export default function (pi) {
|
|
|
1398
1466
|
try { pi.on("session_shutdown", () => { for (const c of pending) { try { c.kill(); } catch (e) {} } pending.clear(); }); } catch (e) {}
|
|
1399
1467
|
} catch (e) { logErr("load", e && e.message); }
|
|
1400
1468
|
}
|
|
1401
|
-
`});function Y(r){return r?.message??String(r)}var z,
|
|
1402
|
-
`))>=0;){let o=n.slice(0,i);n=n.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var
|
|
1403
|
-
`)}catch{}await Promise.race([this.#v,
|
|
1404
|
-
`)}catch{}}#p(e,t){let n=e.length>200?e.slice(0,200)+"\u2026":e;n&&(this.#n={text:n,kind:t,until:Date.now()+(t==="info"?
|
|
1469
|
+
`});function Y(r){return r?.message??String(r)}var z,Rt=v(()=>{z=process.cwd()});import{spawn as Lg}from"child_process";import{StringDecoder as dT}from"string_decoder";function wT(r,e){let t=new dT("utf8"),n="";r.on("data",s=>{n+=typeof s=="string"?s:t.write(s);let i;for(;(i=n.indexOf(`
|
|
1470
|
+
`))>=0;){let o=n.slice(0,i);n=n.slice(i+1),o.endsWith("\r")&&(o=o.slice(0,-1)),o&&e(o)}})}var fT,pT,Mg,mT,hT,gT,yT,bT,Io,$o,Bg,Dg=v(()=>{Rt();fT=3e4,pT=5e3,Mg=2e3,mT=2e3,hT=12e4,gT=8e3,yT=15e3,bT=new Set(["get_state","get_commands","get_available_models","set_model","set_thinking_level","cycle_thinking_level","get_session_stats","compact","set_auto_compaction","get_fork_messages","fork","clone","set_session_name","export_html","bash","abort_bash"]),Io=new Set;process.on("exit",()=>{for(let r of Io)try{r.kill()}catch{}});$o=class{#e;#a=!1;#c=0;#i=!1;#l=null;#m=null;#t=null;#n=null;#u=new Map;#r=[];#h=null;#w=null;#g=null;#d;#f;#y="";#A=1;#s=new Map;#v;#b;constructor(e,t,n=(s,i)=>Lg(s,{cwd:i,shell:!0,stdio:["pipe","pipe","pipe"],env:{...process.env,TYPEBULB_MIRROR:"1"}})){if(this.#v=new Promise(o=>{this.#b=o}),t?.includes('"')){this.#f="session path contains a quote \u2014 cannot drive it",this.#b();return}let s=t?`pi --mode rpc --session "${t}"`:"pi --mode rpc",i;try{i=n(s,e)}catch(o){this.#f=`could not start pi: ${Y(o)}`,this.#b();return}this.#e=i,this.#d=t,Io.add(i),i.stdout&&wT(i.stdout,o=>this.#T(o)),i.stderr&&i.stderr.on("data",o=>{this.#y=(this.#y+o.toString()).slice(-mT)}),i.on("error",o=>this.#x(`could not start pi: ${o.message}`)),i.on("exit",o=>{this.#e===i&&this.#x(o?`pi exited (code ${o})${this.#y.trim()?`: ${this.#y.trim()}`:""}`:"pi exited"),Io.delete(i),this.#b()}),this.#o({type:"get_state"}).then(o=>{let a=o.data?.sessionFile;typeof a=="string"&&a&&(this.#d=a);let c=o.data?.model;c&&typeof c.id=="string"&&c.id&&(this.#g=c.id)}).catch(()=>{}),this.#S()}get streaming(){return this.#a||Date.now()<this.#c}get draft(){return this.#l}get echo(){return this.#m}get queue(){return this.#h}get stats(){return this.#w}get model(){return this.#g}get sessionFile(){return this.#d}get error(){return this.#f}get status(){if(this.#t)return this.#t;if(this.#n){if(Date.now()<this.#n.until)return{text:this.#n.text,kind:this.#n.kind};this.#n=null}return this.#u.size?{text:[...this.#u.values()].join(" \xB7 "),kind:"info"}:null}get dialog(){let e=Date.now();for(;this.#r.length;){let t=this.#r[0];if(e<t.until)return t.req;this.#r.shift(),t.ownTimeout||this.#k({type:"extension_ui_response",id:t.req.id,cancelled:!0})}return null}notice(e,t){this.#p(e,t)}respondUi(e,t){let n=this.#r.findIndex(o=>o.req.id===e);if(n<0)return{ok:!1,error:"dialog expired or already answered"};let[s]=this.#r.splice(n,1),i={type:"extension_ui_response",id:e};return t.cancelled?i.cancelled=!0:s.req.method==="confirm"?i.confirmed=!!t.confirmed:i.value=t.value??"",this.#k(i),{ok:!0}}async rpc(e){if(!bT.has(e.type))return{ok:!1,error:`command not allowed: ${e.type}`};try{let t=await this.#o(e);if(t.success&&e.type==="set_model"){let n=t.data?.id;typeof n=="string"&&n&&(this.#g=n)}if(t.success&&(e.type==="fork"||e.type==="clone")){try{let s=(await this.#o({type:"get_state"})).data?.sessionFile;typeof s=="string"&&s&&(this.#d=s)}catch{}return{ok:!0,data:{...t.data??{},sessionFile:this.#d}}}return t.success?{ok:!0,data:t.data}:{ok:!1,error:t.error??`pi rejected ${e.type}`}}catch(t){return{ok:!1,error:Y(t)}}}async send(e,t){let n=this.streaming,s=n?e.trimStart().startsWith("/")?{type:"prompt",message:e,streamingBehavior:t?.followUp?"followUp":"steer"}:{type:t?.followUp?"follow_up":"steer",message:e}:{type:"prompt",message:e},i;try{i=await this.#o(s)}catch(o){return{ok:!1,error:Y(o)}}return i.success&&!n&&(this.#c=Date.now()+pT),i.success&&!n&&!e.trimStart().startsWith("/")&&(this.#m=e),i.success?{ok:!0}:{ok:!1,error:i.error??"pi rejected the message"}}async stop(){if(this.#e)try{await this.#o({type:"abort"})}catch{}}clearCompletedDraft(){this.#i||(this.#l=null)}clearEcho(){this.#m=null}async dispose(){let e=this.#e;if(e){if(this.#e=void 0,this.#a){try{e.stdin?.write(JSON.stringify({type:"abort"})+`
|
|
1471
|
+
`)}catch{}await Promise.race([this.#v,Bg(Mg)])}try{e.stdin?.end()}catch{}if(await Promise.race([this.#v,Bg(Mg)]),e.exitCode===null&&!e.killed)if(process.platform==="win32"&&e.pid)try{Lg("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"})}catch{}else try{e.kill("SIGKILL")}catch{}Io.delete(e),this.#r=[],this.#E("pi was shut down")}}#k(e){try{this.#e?.stdin?.write(JSON.stringify(e)+`
|
|
1472
|
+
`)}catch{}}#p(e,t){let n=e.length>200?e.slice(0,200)+"\u2026":e;n&&(this.#n={text:n,kind:t,until:Date.now()+(t==="info"?gT:yT)})}#S(){this.#o({type:"get_session_stats"}).then(e=>{if(!e.success||!e.data)return;let t=e.data;this.#w={cost:typeof t.cost=="number"?t.cost:0,contextTokens:typeof t.contextUsage?.tokens=="number"?t.contextUsage.tokens:null,contextPercent:typeof t.contextUsage?.percent=="number"?t.contextUsage.percent:null}}).catch(()=>{})}#o(e){let t=this.#e;if(!t?.stdin?.writable)return Promise.reject(new Error(this.#f??"pi is not running"));let n=`tb-${this.#A++}`;return new Promise((s,i)=>{let o=setTimeout(()=>{this.#s.delete(n),i(new Error("pi did not respond (30s)"))},fT);o.unref?.(),this.#s.set(n,{resolve:s,timer:o});try{t.stdin.write(JSON.stringify({id:n,...e})+`
|
|
1405
1473
|
`)}catch(a){clearTimeout(o),this.#s.delete(n),i(new Error(Y(a)))}})}#T(e){let t;try{t=JSON.parse(e)}catch{return}switch(t.type){case"response":{let n=t,s=n.id?this.#s.get(n.id):void 0;s&&(this.#s.delete(n.id),clearTimeout(s.timer),s.resolve(n));return}case"agent_start":this.#a=!0,this.#c=0;return;case"agent_end":this.#a=!1,this.#c=0,this.#i=!1,this.#t=null,this.#h=null,this.#S();return;case"message_start":{t.message?.role==="assistant"&&(this.#i=!0,this.#l={text:"",thinking:""});return}case"message_update":{if(!this.#i)return;let n=t.message,s=Array.isArray(n?.content)?n.content:[],i=s[s.length-1];this.#l={text:s.filter(o=>o?.type==="text").map(o=>o.text??"").join(""),thinking:s.filter(o=>o?.type==="thinking").map(o=>o.thinking??"").join(`
|
|
1406
|
-
`),tool:i?.type==="toolCall"?i.name:void 0};return}case"message_end":this.#i=!1;return;case"auto_retry_start":this.#t={text:`retrying after a transient error (attempt ${Number(t.attempt)||1}/${Number(t.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#t=null,t.success===!1&&this.#p(`retries exhausted: ${String(t.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#t={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#t=null;let n=t.result;typeof t.errorMessage=="string"&&t.errorMessage?this.#p(`compaction failed: ${t.errorMessage}`,"error"):n?.tokensBefore&&this.#p(`compacted: ~${Math.round(n.tokensBefore/1e3)}k \u2192 ~${Math.round((n.estimatedTokensAfter??0)/1e3)}k tokens`,"info"),this.#S();return}case"queue_update":{let n=Array.isArray(t.steering)?t.steering.map(String):[],s=Array.isArray(t.followUp)?t.followUp.map(String):[];this.#h=n.length||s.length?{steering:n,followUp:s}:null;return}case"extension_ui_request":{let n=String(t.method??"");if(n==="select"||n==="confirm"||n==="input"||n==="editor"){let s=typeof t.timeout=="number"&&t.timeout>0?t.timeout:void 0;this.#r.push({req:{id:String(t.id??""),method:n,title:typeof t.title=="string"?t.title:void 0,message:typeof t.message=="string"?t.message:void 0,options:Array.isArray(t.options)?t.options.map(String):void 0,placeholder:typeof t.placeholder=="string"?t.placeholder:void 0,prefill:typeof t.prefill=="string"?t.prefill:void 0},until:Date.now()+(s??
|
|
1407
|
-
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function
|
|
1408
|
-
`),c=i.filter(f=>f.type==="toolCall").map(f=>({id:f.id??"",name:f.name??"",input:f.arguments??{}}));if(o||a||c.length){let f=Date.parse(e.timestamp??""),p=!isNaN(f)&&f>=t;n.push({type:"assistant",text:o,thinking:a,tools:c,live:p})}let l=s.usage,d=l?(l.input??0)+(l.output??0)+(l.cacheRead??0)+(l.cacheWrite??0):0,u=l&&d>0&&s.stopReason!=="aborted"&&s.stopReason!=="error"?{in:l.input??0,out:l.output??0,cached:l.cacheRead??0,cacheCreate:l.cacheWrite??0}:void 0;return{events:n,usage:u,model:s.model,cost:l?.cost?.total}}return{events:n}}chainWorking(e){let t;for(let a of e)
|
|
1474
|
+
`),tool:i?.type==="toolCall"?i.name:void 0};return}case"message_end":this.#i=!1;return;case"auto_retry_start":this.#t={text:`retrying after a transient error (attempt ${Number(t.attempt)||1}/${Number(t.maxAttempts)||"?"})\u2026`,kind:"warning"};return;case"auto_retry_end":this.#t=null,t.success===!1&&this.#p(`retries exhausted: ${String(t.finalError??"unknown error")}`,"error");return;case"compaction_start":this.#t={text:"compacting context\u2026",kind:"info"};return;case"compaction_end":{this.#t=null;let n=t.result;typeof t.errorMessage=="string"&&t.errorMessage?this.#p(`compaction failed: ${t.errorMessage}`,"error"):n?.tokensBefore&&this.#p(`compacted: ~${Math.round(n.tokensBefore/1e3)}k \u2192 ~${Math.round((n.estimatedTokensAfter??0)/1e3)}k tokens`,"info"),this.#S();return}case"queue_update":{let n=Array.isArray(t.steering)?t.steering.map(String):[],s=Array.isArray(t.followUp)?t.followUp.map(String):[];this.#h=n.length||s.length?{steering:n,followUp:s}:null;return}case"extension_ui_request":{let n=String(t.method??"");if(n==="select"||n==="confirm"||n==="input"||n==="editor"){let s=typeof t.timeout=="number"&&t.timeout>0?t.timeout:void 0;this.#r.push({req:{id:String(t.id??""),method:n,title:typeof t.title=="string"?t.title:void 0,message:typeof t.message=="string"?t.message:void 0,options:Array.isArray(t.options)?t.options.map(String):void 0,placeholder:typeof t.placeholder=="string"?t.placeholder:void 0,prefill:typeof t.prefill=="string"?t.prefill:void 0},until:Date.now()+(s??hT),ownTimeout:s!==void 0})}else if(n==="notify"){let s=t.notifyType==="warning"?"warning":t.notifyType==="error"?"error":"info";this.#p(String(t.message??""),s),console.log(`[composer] pi extension: ${String(t.message??"")}`)}else if(n==="setStatus"){let s=String(t.statusKey??"");typeof t.statusText=="string"&&t.statusText?this.#u.set(s,t.statusText):this.#u.delete(s)}return}default:return}}#x(e){this.#f=e,this.#a=!1,this.#c=0,this.#i=!1,this.#l=null,this.#m=null,this.#t=null,this.#n=null,this.#u.clear(),this.#r=[],this.#h=null,this.#w=null,this.#g=null,this.#e=void 0,this.#E(e)}#E(e){for(let[,t]of this.#s)clearTimeout(t.timer),t.resolve({type:"response",success:!1,error:e});this.#s.clear()}},Bg=r=>new Promise(e=>{setTimeout(e,r).unref?.()})});import{existsSync as jg,readFileSync as vT,realpathSync as ST}from"fs";import{join as tr,dirname as Jg,resolve as kT}from"path";import{homedir as Fg}from"os";function ET(r,e){let t=tr(r,".pi");if(xT.some(s=>jg(tr(t,s))))return!0;let n=tr(e,".agents","skills");for(let s=r;;){let i=tr(s,".agents","skills");if(i!==n&&jg(i))return!0;let o=Jg(s);if(o===s)return!1;s=o}}function AT(r,e){for(let t=e;;){if(r[t]===!0||r[t]===!1)return!0;let n=Jg(t);if(n===t)return!1;t=n}}function Kg(r,e){try{let t=e?.agentDir??tr(Fg(),".pi","agent"),n=qg(e?.home??process.env.HOME??Fg()),s=qg(kT(r));if(!ET(s,n))return null;let i=Ug(tr(t,"settings.json")).defaultProjectTrust;return i==="always"||i==="never"||AT(Ug(tr(t,"trust.json")),s)?null:"pi has no trust decision for this project \u2014 running untrusted; run `pi` once in a terminal to grant it"}catch{return null}}var xT,qg,Ug,Hg=v(()=>{xT=["settings.json","extensions","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"],qg=r=>{try{return ST(r)}catch{return r}},Ug=r=>{try{return JSON.parse(vT(r,"utf8"))}catch{return{}}}});import{statSync as TT,openSync as PT,readSync as OT,closeSync as CT,existsSync as Yg}from"fs";import{join as Lo}from"path";import{homedir as Ou}from"os";import{execFile as RT}from"child_process";async function NT(r){let e=Lo(Ou(),".pi","agent","bin",process.platform==="win32"?"fd.exe":"fd");for(let t of["fd","fdfind",...Yg(e)?[e]:[]]){let n=await new Promise(s=>{RT(t,["--base-directory",r,"--type","f","--follow","--hidden","--exclude",".git"],{maxBuffer:67108864},(i,o)=>s(i?null:o))});if(n!==null)return n.split(`
|
|
1475
|
+
`).filter(Boolean).map(s=>s.replace(/\\/g,"/"))}return null}function IT(r){return`--${r.replace(/^[/\\]/,"").replace(/[/\\:]/g,"-")}--`}function Wg(r){return r.type==="message"?$T(r.message?.role):r.type==="custom_message"?r.display!==!1:!1}var _T,$T,Wr,Cu=v(()=>{Ci();yl();bl();$g();Dg();Hg();_T=Lo(Ou(),".pi","agent","sessions");$T=r=>r==="user"||r==="assistant"||r==="toolResult"||r==="bashExecution";Wr=class extends Sr{displayName="Pi Mirror";detectsSelf(){return process.env.PI_CODING_AGENT==="true"}detectsInstalled(){return Yg(Lo(Ou(),".pi","agent"))}ensureHarnessSupport(){Ig()}createDriver(e,t){let n=new $o(e,t),s=Kg(e);return s&&n.notice(s,"warning"),n}walkFiles(e){return NT(e)}sessionsDir(e){return Lo(_T,IT(e))}listSessionFiles(e){return Ri(this.sessionsDir(e))}parseEntry(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||t.type==="session"||!t.id?null:t}idOf(e){return e.id}parentOf(e){return e.parentId??void 0}timestampOf(e){return e.timestamp}isSidechain(e){return!1}isLeafType(e){return Wg(e)}isRecoveryNoise(e){return!1}apply(e,t){let n=[];if(e.type==="custom_message"){if(e.display===!1)return{events:n};let i=this.contentText(e.content).trim();return i&&n.push({type:"user",text:i}),{events:n}}if(e.type!=="message"||!e.message)return{events:n};let s=e.message;if(s.role==="user"){let i=this.contentText(s.content).trim();return i&&n.push({type:"user",text:i}),{events:n}}if(s.role==="toolResult"){let i=this.contentText(s.content);return n.push({type:"tool_result",id:s.toolCallId??"",content:i,isError:!!s.isError,digest:Ze(i)}),{events:n}}if(s.role==="bashExecution")return s.command&&!s.excludeFromContext&&n.push({type:"user",text:`$ ${s.command}`}),{events:n};if(s.role==="assistant"){let i=Array.isArray(s.content)?s.content:[],o=i.filter(f=>f.type==="text").map(f=>f.text??"").join(""),a=i.filter(f=>f.type==="thinking").map(f=>f.thinking??"").join(`
|
|
1476
|
+
`),c=i.filter(f=>f.type==="toolCall").map(f=>({id:f.id??"",name:f.name??"",input:f.arguments??{}}));if(o||a||c.length){let f=Date.parse(e.timestamp??""),p=!isNaN(f)&&f>=t;n.push({type:"assistant",text:o,thinking:a,tools:c,live:p})}let l=s.usage,d=l?(l.input??0)+(l.output??0)+(l.cacheRead??0)+(l.cacheWrite??0):0,u=l&&d>0&&s.stopReason!=="aborted"&&s.stopReason!=="error"?{in:l.input??0,out:l.output??0,cached:l.cacheRead??0,cacheCreate:l.cacheWrite??0}:void 0;return{events:n,usage:u,model:s.model,cost:l?.cost?.total}}return{events:n}}chainWorking(e){let t;for(let a of e)Wg(a)&&(t=a);if(!t||t.type==="custom_message")return!1;let n=t.message.role;if(n==="user"||n==="toolResult"||n==="bashExecution")return!0;if(n!=="assistant")return!1;let i=(Array.isArray(t.message.content)?t.message.content:[]).filter(a=>a.type==="toolCall").map(a=>a.id);if(!i.length)return!1;let o=new Set;for(let a of e)a.type==="message"&&a.message?.role==="toolResult"&&a.message.toolCallId&&o.add(a.message.toolCallId);return i.some(a=>a&&!o.has(a))}sessionAlive(){}readPreview(e){let t;try{t=PT(e,"r")}catch{return""}try{let s=65536;try{s=TT(e).size}catch{}let i=(u,f)=>{let p=Buffer.alloc(f),h=OT(t,p,0,f,u);return p.subarray(0,h).toString("utf8")},o=i(0,Math.min(65536,s)),a=s>65536?i(s-65536,65536):"",c=u=>{let f="";for(let p of u.split(`
|
|
1409
1477
|
`))if(p.includes('"session_info"'))try{let h=JSON.parse(p);h?.type==="session_info"&&typeof h.name=="string"&&h.name&&(f=h.name)}catch{}return f},l="";for(let u of o.split(`
|
|
1410
|
-
`))if(!(l||!u.includes('"type"')))try{let f=JSON.parse(u);f?.type==="message"&&f.message?.role==="user"&&(l=this.contentText(f.message.content).replace(/\s+/g," ").trim())}catch{}let d=c(a)||c(o)||l;return d?d.slice(0,200):""}finally{
|
|
1411
|
-
`):""}}});var
|
|
1412
|
-
`)){let a=/^(\d+)\t(\d+)\t(.+)$/.exec(o);a&&i.set(a[3],{add:+a[1],del:+a[2]})}for(let o of t){let a=i.get(o.path);a&&(o.add=a.add,o.del=a.del)}}catch{}return t.sort((s,i)=>s.path.localeCompare(i.path)),{repo:!0,root:r,files:t}}catch(e){return{repo:!1,root:"",files:[],error:Y(e)}}}async function
|
|
1413
|
-
|
|
1414
|
-
${r.slice(0,
|
|
1415
|
-
`))>=0;){let H=g.partial.slice(0,D);if(g.partial=g.partial.slice(D+1),!H.trim())continue;let be=r.parseEntry(H);if(!be)continue;let oe=r.idOf(be);oe&&(g.entries.set(oe,be),!r.isSidechain(be)&&r.isLeafType(be)&&(
|
|
1416
|
-
`).filter(Boolean):await r.walkFiles?.(e.cwd)??[];return(await Promise.all(S.map(async
|
|
1417
|
-
`)){if(!F.trim())continue;let I=r.parseEntry(F);if(!I)continue;let V=r.searchText(I);V&&
|
|
1418
|
-
`)){if(!I.trim())continue;let V=r.parseEntry(I);if(V)for(let H of r.apply(V,e.sessionStartMs).events)H.type==="assistant"&&H.text.trim()&&(D=H.text.trim())}let F=D.length>
|
|
1419
|
-
`)){let l=c.replace(/\s+/g," ").trim();l&&i.push({text:l,lower:l.toLowerCase()})}let{hitCount:o,snippet:a}=
|
|
1420
|
-
${r}`;return
|
|
1421
|
-
`)}function
|
|
1478
|
+
`))if(!(l||!u.includes('"type"')))try{let f=JSON.parse(u);f?.type==="message"&&f.message?.role==="user"&&(l=this.contentText(f.message.content).replace(/\s+/g," ").trim())}catch{}let d=c(a)||c(o)||l;return d?d.slice(0,200):""}finally{CT(t)}}searchText(e){if(e?.type!=="message")return"";let t=e.message?.role;if(t!=="user"&&t!=="assistant")return"";let n=e.message?.content,s="";return typeof n=="string"?s=n:Array.isArray(n)&&(s=n.filter(i=>i.type==="text"&&typeof i.text=="string").map(i=>i.text).join(" ")),s.replace(/\s+/g," ").trim()}contentText(e){return typeof e=="string"?Je(e):Array.isArray(e)?e.map(t=>typeof t?.text=="string"?Je(t.text):t?.type==="image"&&t.data?Oi(t.data,t.mimeType):"").filter(Boolean).join(`
|
|
1479
|
+
`):""}}});var Mo,Vg=v(()=>{Mo=class{#e=new Map;accept(e,t){return this.#e.get(e)===t?!1:(this.#e.set(e,t),!0)}}});import{execFile as LT}from"child_process";import{promisify as MT}from"util";import{readFile as BT}from"fs/promises";import{resolve as zg,sep as DT}from"path";async function ze(r,e){let{stdout:t}=await jT("git",r,{cwd:e,maxBuffer:67108864});return t}async function Yr(){if(Bo)return Bo;try{Bo=(await ze(["rev-parse","--show-toplevel"],z)).trim()}catch{}return Bo}function FT(r,e){let t=e===" "?r:e;return t==="?"?"U":t}async function Xg(){let r=await Yr();if(!r)return{repo:!1,root:"",files:[]};try{let e=await ze(["status","--porcelain","-z"],r),t=[],n=e.split("\0");for(let s=0;s<n.length;s++){let i=n[s];i.length<4||((i[0]==="R"||i[0]==="C")&&s++,t.push({path:i.slice(3),status:FT(i[0],i[1])}))}try{let s=await ze(["diff","--numstat","HEAD"],r),i=new Map;for(let o of s.split(`
|
|
1480
|
+
`)){let a=/^(\d+)\t(\d+)\t(.+)$/.exec(o);a&&i.set(a[3],{add:+a[1],del:+a[2]})}for(let o of t){let a=i.get(o.path);a&&(o.add=a.add,o.del=a.del)}}catch{}return t.sort((s,i)=>s.path.localeCompare(i.path)),{repo:!0,root:r,files:t}}catch(e){return{repo:!1,root:"",files:[],error:Y(e)}}}async function Qg(r){let e=await Yr();if(!e)return{ok:!1,error:"not a git repository"};try{if((await ze(["status","--porcelain","-z","--",r],e)).startsWith("??")){let s=zg(e,r);if(!s.startsWith(zg(e)+DT))return{ok:!1,error:"outside repository"};let i=await BT(s);return i.includes(0)?Ru("Binary file (not shown)",!1):Ru(i.toString("utf8"),!0)}let n;try{n=await ze(["diff","--no-color","--unified=999999","HEAD","--",r],e)}catch{n=await ze(["diff","--no-color","--unified=999999","--",r],e)}return Ru(n,!1)}catch(t){return{ok:!1,error:Y(t)}}}var jT,Gg,Bo,Ru,Do=v(()=>{Rt();jT=MT(LT),Gg=2e6;Ru=(r,e)=>({ok:!0,text:r.slice(0,Gg),untracked:e,truncated:r.length>Gg})});function jo(r,e){let t=0,n="";for(let s of r){let i=s.lower.indexOf(e);if(!(i<0)&&(t++,!n)){let o=Math.max(0,i-110),a=Math.min(s.text.length,i+e.length+110);n=(o>0?"\u2026":"")+s.text.slice(o,a)+(a<s.text.length?"\u2026":"")}}return{hitCount:t,snippet:n}}var _u=v(()=>{});var Fo,qo,Zg=v(()=>{Fo=".typebulb/paste",qo={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp"}});import{existsSync as qT,mkdirSync as UT,writeFileSync as JT,readFileSync as KT}from"fs";import{join as Uo}from"path";function ey(){let r=new Date,e=t=>String(t).padStart(2,"0");return`${r.getFullYear()}${e(r.getMonth()+1)}${e(r.getDate())}-${e(r.getHours())}${e(r.getMinutes())}${e(r.getSeconds())}`}function VT(r){return r.trim().toLowerCase().replace(/\.[a-z0-9]{1,4}$/,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}async function zT(r){let e=AbortSignal.timeout(HT);for(let[t,n]of YT){let s=it(t,n);if(typeof s!="string"){try{let i=await At(s,{messages:[{role:"user",content:`Reply with ONLY a short kebab-case filename (2-5 words, lowercase, no extension) describing this text:
|
|
1481
|
+
|
|
1482
|
+
${r.slice(0,WT)}`}],effort:0,webSearch:!1,signal:e});if(!i.ok)continue;let o=VT(await Gt(i,s.protocol));if(o)return o}catch{}if(e.aborted)return}}}async function ty(r,e){if(!e||e.kind!=="image"&&e.kind!=="text")return{ok:!1,error:"bad paste kind"};if(typeof e.data!="string"||!e.data)return{ok:!1,error:"empty paste"};let t=Uo(r,Fo);try{UT(t,{recursive:!0})}catch(a){return{ok:!1,error:Y(a)}}let n,s,i;if(e.kind==="image"){if(n=`img-${ey()}`,s=Object.keys(qo).find(a=>qo[a]===e.mime)??"png",i=Buffer.from(e.data,"base64"),!i.length)return{ok:!1,error:"empty image data"}}else n=await zT(e.data)??`paste-${ey()}`,s="md",i=e.data;let o=`${n}.${s}`;for(let a=2;qT(Uo(t,o));a++)o=`${n}-${a}.${s}`;try{JT(Uo(t,o),i)}catch(a){return{ok:!1,error:Y(a)}}return{ok:!0,path:`${Fo}/${o}`}}function ry(r,e){if(!/^[\w-]+(\.[\w-]+)*$/.test(e))return{ok:!1,error:"bad name"};let t=e.slice(e.lastIndexOf(".")+1).toLowerCase(),n=qo[t];if(!n)return{ok:!1,error:"not an image"};try{return{ok:!0,mime:n,base64:KT(Uo(r,Fo,e)).toString("base64")}}catch{return{ok:!1,error:"not found"}}}var HT,WT,YT,ny=v(()=>{$r();Hr();Rt();Zg();HT=4e3,WT=4e3,YT=[["openrouter","google/gemini-3.1-flash-lite-preview"],["gemini","gemini-3.1-flash-lite"]]});import{existsSync as sy,openSync as GT,readSync as XT,closeSync as QT,statSync as Vr,readdirSync as iy,watchFile as ZT,unwatchFile as oy,mkdirSync as eP,writeFileSync as tP,readFileSync as Jo,unlinkSync as rP,rmSync as nP}from"fs";import{stat as sP}from"fs/promises";import{dirname as iP,join as rr,resolve as ay}from"path";function lP(r){if(!Number.isInteger(r))return!0;try{return process.kill(r,0),!0}catch(e){return e.code==="EPERM"}}function Ko(r){let e={cwd:z,sessionId:"",sessionStartMs:Date.now(),buffer:[],partial:"",offset:0,latest:{in:0,out:0,cached:0,cacheCreate:0},latestModel:null,everAttached:!1,entries:new Map},t=new Set,n;function s(){if(e.file){for(let g of t)if(g.file===e.file)return g;return}return n}function i(g){let S={d:r.createDriver(e.cwd,g),file:g};return t.add(S),e.file||(n=S),S}async function o(g){t.delete(g),n===g&&(n=void 0);try{await g.d.dispose()}catch(S){console.error("[composer] dispose:",Y(S))}}function a(){let g=s();for(let S of[...t])S!==g&&(S.d.streaming||S.d.queue||S.d.error||o(S))}function c(){for(let g of t)g.d.sessionFile&&g.file!==g.d.sessionFile&&(g.file=g.d.sessionFile);if(n&&!e.file&&n.file){let g=r.listSessionFiles(e.cwd).find(S=>S.file===n.file);g&&C(g)}}let l=g=>rr(g,aP),d=(g,S)=>rr(l(g),`${S}.lock`);function u(g,S){try{let k=d(g,S);if(Date.now()-Vr(k).mtimeMs>=cy)return!1;try{let O=parseInt(Jo(k,"utf8").trim(),10);if(O===process.pid||!lP(O))return!1}catch{}return!0}catch{return!1}}function f(g,S){if(S)try{eP(l(g),{recursive:!0}),tP(d(g,S),String(process.pid))}catch(k){console.error("[lock] claim failed:",Y(k))}}function p(g){try{nP(rr(g,".claude-bulb"),{recursive:!0,force:!0})}catch{}}function h(g){let S=l(g);if(!sy(S))return;let k;try{k=iy(S)}catch{return}let O=Date.now();for(let D of k){if(!D.endsWith(".lock"))continue;let F=rr(S,D);try{let I=Vr(F);O-I.mtimeMs>cP&&rP(F)}catch{}}}function m(g){try{return Vr(g),!1}catch(S){return S.code==="ENOENT"}}function b(){let g=e;if(g.file&&!m(g.file)){f(g.cwd,g.sessionId);return}let S=A(g);S&&C(S)}function A(g){if(!g.everAttached)return w(g.cwd)??P(g.cwd,()=>!0)}function w(g){let S=l(g);if(!sy(S))return;let k;try{k=iy(S)}catch{return}let O;for(let F of k)if(F.endsWith(".lock"))try{let I=Vr(rr(S,F));if(Date.now()-I.mtimeMs>=cy||parseInt(Jo(rr(S,F),"utf8").trim(),10)!==process.pid)continue;(!O||I.mtimeMs>O.mtime)&&(O={sessionId:F.slice(0,-5),mtime:I.mtimeMs})}catch{}if(!O)return;let D=r.listSessionFiles(g).find(F=>F.sessionId===O.sessionId);if(!(!D||m(D.file)))return D}function P(g,S){return r.listSessionFiles(g).sort((k,O)=>O.mtime-k.mtime).find(k=>!u(g,k.sessionId)&&S(k))}function R(g,S){let k=e;if(k.file)try{oy(k.file)}catch{}k.file=g,k.sessionId=S,k.partial="",k.offset=0,k.latest={in:0,out:0,cached:0,cacheCreate:0},k.latestModel=null,k.entries=new Map,k.chainLastId=void 0,k.buffer.push({type:"cleared"}),k.buffer.push({type:"session",sessionId:S})}function C(g){let S=e;n=void 0,R(g.file,g.sessionId),S.everAttached=!0,f(S.cwd,g.sessionId),$();try{oy(g.file)}catch{}ZT(g.file,{interval:200},()=>$())}function _(){R(void 0,"")}function $(){let g=e;if(!g.file)return;let S;try{S=Vr(g.file).size}catch{return}if(S<=g.offset)return;let k;try{k=GT(g.file,"r")}catch{return}try{let H=S-g.offset,be=Buffer.alloc(H),oe=0;for(;oe<H;){let md=XT(k,be,oe,H-oe,g.offset+oe);if(!md)break;oe+=md}g.offset+=oe,g.partial+=be.subarray(0,oe).toString("utf8")}finally{QT(k)}let O,D;for(;(D=g.partial.indexOf(`
|
|
1483
|
+
`))>=0;){let H=g.partial.slice(0,D);if(g.partial=g.partial.slice(D+1),!H.trim())continue;let be=r.parseEntry(H);if(!be)continue;let oe=r.idOf(be);oe&&(g.entries.set(oe,be),!r.isSidechain(be)&&r.isLeafType(be)&&(O=oe))}if(!O)return;let F=[],I=g.entries.get(O),V=!1;for(;I;){if(F.push(I),r.idOf(I)===g.chainLastId){V=!0;break}let H=r.parentOf(I);I=H?g.entries.get(H):void 0}if(V)for(let H=F.length-2;H>=0;H--)U(F[H]);else{g.chainLastId!==void 0&&(g.buffer.push({type:"cleared"}),g.buffer.push({type:"session",sessionId:g.sessionId}),g.latest={in:0,out:0,cached:0,cacheCreate:0});let H=new Set(F.map(oe=>r.idOf(oe))),be=E(g.entries);for(let oe=F.length-1;oe>=0;oe--)U(F[oe]),M(r.idOf(F[oe]),be,H)}g.chainLastId=O}function E(g){let S=new Map;for(let k of g.values()){let O=r.parentOf(k);if(!O)continue;let D=S.get(O);D?D.push(k):S.set(O,[k])}return S}function M(g,S,k){if(!g)return;let O=S.get(g);if(!O)return;let D=O.filter(H=>!r.isSidechain(H));if(D.length<2)return;let F=D.filter(H=>!k.has(r.idOf(H)));if(!F.length)return;let I=[],V=0;for(let H of F){let be=W(H,S);I.push(...be.events),V+=be.count}V>0&&e.buffer.push({type:"fork",atId:g,count:V,events:I})}function W(g,S){let k=[],O=[g];for(;O.length;){let I=O.pop();if(r.isSidechain(I))continue;k.push(I);let V=S.get(r.idOf(I)??"");if(V)for(let H of V)O.push(H)}k.sort((I,V)=>(Date.parse(r.timestampOf(I)??"")||0)-(Date.parse(r.timestampOf(V)??"")||0));let D=[];for(let I of k)r.isRecoveryNoise(I)||D.push(...r.apply(I,e.sessionStartMs).events);return{count:D.reduce((I,V)=>I+(V.type==="user"||V.type==="assistant"?1:0),0),events:D}}function U(g){try{let{events:S,usage:k,model:O,cost:D}=r.apply(g,e.sessionStartMs);for(let F of S)e.buffer.push(F);S.some(F=>F.type==="assistant")&&s()?.d.clearCompletedDraft(),S.some(F=>F.type==="user")&&s()?.d.clearEcho(),O&&(e.latestModel=O),k&&(e.latest=k),(k||D)&&e.buffer.push({type:"usage",...e.latest,cost:D})}catch(S){console.error("[mirror] skipped malformed entry:",Y(S))}}async function y(){return{cwd:e.cwd,pid:process.pid,composer:!!r.createDriver,elsewhere:await x()}}async function x(){if(r.listSessionFiles(e.cwd).length)return;let g=await Yr();if(!g)return;let S=ay(g).toLowerCase();for(let k=ay(e.cwd);k.toLowerCase()!==S;){let O=iP(k);if(O===k)return;k=O;let D=r.listSessionFiles(k).length;if(D)return{dir:k,count:D}}}x().then(g=>{g&&console.log(`No sessions for ${e.cwd} \u2014 ${g.count} exist for ${g.dir}. Launched from a subfolder? Relaunch from the project root.`)}).catch(()=>{});let N=new Mo;async function L(g,S){N.accept(g,S)&&console.log(S)}function B(){let g=r.sessionAlive(e.sessionId,e.cwd);if(g!==void 0)return g;if(!e.file)return!1;try{return Date.now()-Vr(e.file).mtimeMs<1e4}catch{return!1}}function K(){return r.chainWorking([...e.entries.values()])&&B()}function G(){!r.createDriver||s()||e.latestModel||K()||i(e.file)}async function me(g){let S=e;b(),c(),G(),a();let k=s();for(let I of t)I!==k&&I.d.dialog;let O=new Set([...t].filter(I=>I.d.streaming&&I.file).map(I=>I.file)),D=O.size?r.listSessionFiles(S.cwd).filter(I=>O.has(I.file)).map(I=>I.sessionId):[],F=r.createDriver?{streaming:!!k?.d.streaming,draft:k?.d.draft??null,echo:k?.d.echo??null,status:k?.d.status??null,dialog:k?.d.dialog??null,queue:k?.d.queue??null,stats:k?.d.stats??null,model:k?.d.model??null,error:k?.d.error}:void 0;return{events:S.buffer.slice(g),cursor:S.buffer.length,working:!!k?.d.streaming||K(),latestModel:S.latestModel,composer:F,busy:D}}async function te(){b(),c();let g=s();if(g?.d.error&&!g.d.streaming&&(await o(g),g=void 0),!g){if(K())return{ok:!1,error:"the agent is mid-turn in a terminal \u2014 watch only"};g=i(e.file)}return{ok:!0,d:g.d}}async function ie(g,S){if(!r.createDriver)return{ok:!1,error:"not supported"};let k=String(g??"").trim();if(!k)return{ok:!1,error:"empty message"};let O=await te();return O.ok?O.d.send(k,S):O}async function Se(g,S){let k=s();return k?k.d.respondUi(String(g??""),S??{}):{ok:!1,error:"no dialog pending"}}async function Fe(g,S){if(!r.createDriver)return{ok:!1,error:"not supported"};if(!g||typeof g.type!="string")return{ok:!1,error:"bad command"};if(S?.spawn){let O=await te();return O.ok?O.d.rpc(g):O}let k=s();return!k||k.d.error?{ok:!1,error:"not running"}:k.d.rpc(g)}async function ga(){let g=s();if(g)try{await g.d.stop()}catch(S){console.error("[composer] stop:",Y(S))}return{ok:!0}}async function pw(){return r.createDriver?(c(),!e.file&&n&&!n.d.streaming&&!n.d.error?{ok:!0}:(n?.d.error&&await o(n),n=void 0,e.file&&_(),i(void 0),a(),{ok:!0})):{ok:!1,error:"not supported"}}async function mw(){if(!r.createDriver)return[];let g=await ze(["ls-files","--cached","--others","--exclude-standard"],e.cwd).catch(()=>null),S=g!==null?g.split(`
|
|
1484
|
+
`).filter(Boolean):await r.walkFiles?.(e.cwd)??[];return(await Promise.all(S.map(async O=>{try{return{f:O,m:(await sP(rr(e.cwd,O))).mtimeMs}}catch{return{f:O,m:0}}}))).sort((O,D)=>D.m-O.m).map(O=>O.f)}function hw(){for(let g of[...t])o(g)}async function gw(g){return r.createDriver?ty(e.cwd,g):{ok:!1,error:"not supported"}}async function yw(g){return ry(e.cwd,String(g??""))}async function bw(){return r.listSessionFiles(e.cwd).sort((g,S)=>S.mtime-g.mtime).map(({sessionId:g,file:S,mtime:k})=>({sessionId:g,mtime:k,preview:r.readPreview(S)}))}let dd=new Map;function ww(g,S){let k=dd.get(g);if(k&&k.mtime===S)return k.turns;let O=[],D="";try{D=Jo(g,"utf8")}catch{return[]}for(let F of D.split(`
|
|
1485
|
+
`)){if(!F.trim())continue;let I=r.parseEntry(F);if(!I)continue;let V=r.searchText(I);V&&O.push({text:V,lower:V.toLowerCase()})}return dd.set(g,{mtime:S,turns:O}),O}async function vw(g){let S=g.toLowerCase(),k=[];for(let{sessionId:O,file:D,mtime:F}of r.listSessionFiles(e.cwd).sort((I,V)=>V.mtime-I.mtime)){let{hitCount:I,snippet:V}=jo(ww(D,F),S);if(I&&(k.push({sessionId:O,mtime:F,preview:r.readPreview(D),hitCount:I,snippet:V}),k.length>=uP))break}return k}let fd=800,pd=new Map;function Sw(g,S){let k=pd.get(g);if(k&&k.mtime===S)return k.text;let O="";try{O=Jo(g,"utf8")}catch{return""}let D="";for(let I of O.split(`
|
|
1486
|
+
`)){if(!I.trim())continue;let V=r.parseEntry(I);if(V)for(let H of r.apply(V,e.sessionStartMs).events)H.type==="assistant"&&H.text.trim()&&(D=H.text.trim())}let F=D.length>fd?D.slice(0,fd).trimEnd()+"\u2026":D;return pd.set(g,{mtime:S,text:F}),F}async function kw(g){let S=r.listSessionFiles(e.cwd).find(k=>k.sessionId===g);return{text:S?Sw(S.file,S.mtime):""}}async function xw(g){let S=e,k=r.listSessionFiles(S.cwd).find(O=>O.sessionId===g);return k?k.file===S.file?{ok:!0}:(C(k),c(),a(),{ok:!0}):{ok:!1,error:"session not found"}}return p(e.cwd),h(e.cwd),b(),{info:y,poll:me,logEmbedStatus:L,listSessions:bw,searchSessions:vw,sessionPeek:kw,attach:xw,composerSend:ie,composerStop:ga,composerNew:pw,composerFiles:mw,composerUiRespond:Se,composerRpc:Fe,composerPaste:gw,composerPasteRead:yw,shutdownComposer:hw}}var oP,aP,cy,cP,uP,Nu=v(()=>{Rt();Vg();Do();_u();ny();oP=".typebulb",aP=`${oP}/locks`,cy=5e3,cP=6e4;uP=50});import{existsSync as Mu,mkdirSync as dP,readFileSync as ly,writeFileSync as fP}from"fs";import{join as nr,isAbsolute as pP}from"path";async function uy(r,e){let t=pP(r)?r:nr(z,r);return Mu(t)?(bu(t,e),{ok:!0}):{ok:!1,error:"file not found"}}async function dy(r){let e=z,t=yu(r),n=nr(e,"typebulbs");dP(n,{recursive:!0});let s=Nl(t),i=`${s}.bulb.md`;for(let l=2;Mu(nr(n,i))&&ly(nr(n,i),"utf8")!==t;l++)i=`${s}-${l}.bulb.md`;let o=nr(n,i);Mu(o)||fP(o,t);let a=nr("typebulbs",i),c=await Di(a,{cwd:e,open:!1});return{ok:!0,file:a,pid:c.pid,url:c.url}}async function fy(){return Q(z)}async function py(r){return await Jt(r),{ok:!0}}async function my(){let r=await ns(z);return bo(z).filter(e=>!e.serverOnly).map(e=>({...e,trusted:er(e.path),batches:pu(e.path),lastRunAt:r(e.path)}))}async function hy(r){let e=r.toLowerCase(),t=[];for(let n of bo(z).filter(s=>!s.serverOnly).sort((s,i)=>i.mtime-s.mtime)){let s="";try{s=ly(n.path,"utf8")}catch{continue}let i=[];for(let c of s.split(`
|
|
1487
|
+
`)){let l=c.replace(/\s+/g," ").trim();l&&i.push({text:l,lower:l.toLowerCase()})}let{hitCount:o,snippet:a}=jo(i,e);o&&t.push({path:n.path,hitCount:o,snippet:a})}return t}async function gy(r,e,t){let n=z;e!=null&&Ur(r,e);let s=await Di(r,{cwd:n,open:!1,trust:e,batch:t??void 0});return{ok:!0,file:s.file,pid:s.pid,url:s.url,trust:!!s.trust}}async function yy(r){return{cap:await gu(r)}}async function by(r,e){return Ur(r,e),{ok:!0}}async function wy(r,e){return Ke(r,e)}async function xy(){return cs&&Date.now()-cs.fetchedAt<=hP?cs.samples:(Iu??=gP().finally(()=>{Iu=null}),Iu)}async function gP(){try{let r=await fetch(`${mP}/api/scripts/u/samples?stubs`,{signal:AbortSignal.timeout(Sy)});if(!r.ok)throw new Error(`HTTP ${r.status}`);let e=await r.json(),t=i=>i.order??Number.MAX_SAFE_INTEGER,n=i=>Date.parse(i.createdAt??"")||0,s=e.filter(i=>i.slug!=="welcome").sort((i,o)=>t(i)-t(o)||n(o)-n(i)).map(i=>({slug:i.slug,name:i.name,description:Aa(i.config)}));return cs={samples:s,fetchedAt:Date.now()},s}catch{return cs?.samples??[]}}async function Ey(r){return Bu.test(r)?Py(vy,"samples",r,!0):{ok:!1,error:"bad slug"}}async function Ay(){let r=Du();if(!r)return{bulbs:[]};let e=`${Ho()}
|
|
1488
|
+
${r}`;return _t?.key===e&&Date.now()-_t.fetchedAt<=yP?{user:_t.user,bulbs:_t.bulbs}:($u??=bP(e,r).finally(()=>{$u=null}),$u)}async function Lu(r,e,t){let n=await fetch(`${r}${e}`,{headers:t,signal:AbortSignal.timeout(Sy)});if(!n.ok)throw new Error(`HTTP ${n.status}`);if(!n.headers.get("content-type")?.includes("json"))throw new Error("not json");return n.json()}async function bP(r,e){let t={Authorization:`Bearer ${e}`};try{let n=Ho(),s;try{s=await Lu(n,"/api/me",t)}catch{let a=new URL(n);n=`${a.protocol}//api.${a.host}`,s=await Lu(n,"/api/me",t)}let o=(await Lu(n,"/api/scripts/list",t)).filter(a=>a.userSlug===s.slug&&!a.isTemplate).map(a=>({slug:a.slug,name:a.name,description:Aa(a.config)}));return _t={key:r,user:s.slug,bulbs:o,fetchedAt:Date.now()},{user:s.slug,bulbs:o}}catch{return _t?.key===r?{user:_t.user,bulbs:_t.bulbs}:{bulbs:[]}}}async function Ty(r,e,t=!1){return!Bu.test(e)||!Bu.test(r)?{ok:!1,error:"bad slug"}:Py(Ho(),r,e,t)}async function Py(r,e,t,n){let s=To(e,t);try{let i=await Co({origin:r,userSlug:e,slug:t,dest:nr(z,s)},{force:n,token:Du(),timeoutMs:ky});return i.kind==="conflict"?{ok:!1,conflict:!0,error:"local file differs from the site copy"}:i.kind==="asset-conflict"?{ok:!1,conflict:!0,error:`local assets differ from the site copies (${i.paths.join(", ")})`}:i.kind==="http-error"?{ok:!1,error:`HTTP ${i.status}`}:i.kind==="not-markdown"?{ok:!1,error:`not a bulb (${i.contentType??"no content-type"})`}:{ok:!0,file:s,upToDate:i.kind==="up-to-date"}}catch(i){return{ok:!1,error:i?.message??String(i)}}}async function Oy(r,e=!1){let t=Du();if(!t)return{ok:!1,error:"no TYPEBULB_TOKEN in .env"};try{let n=Oo(r,z,Ho()),s=await _o(n,{token:t,force:e,timeoutMs:ky});return s.kind==="conflict"?{ok:!1,conflict:!0,error:s.message}:s.kind==="asset-error"?{ok:!1,error:`assets sync failed: ${s.message}`}:s.kind==="http-error"?{ok:!1,error:`HTTP ${s.status}: ${s.message}`}:{ok:!0,created:s.created,serverStripped:s.serverStripped}}catch(n){return{ok:!1,error:n?.message??String(n)}}}var mP,vy,hP,Sy,ky,cs,Iu,Bu,yP,_t,$u,Ho,Du,ju=v(()=>{Hr();Rt();_u();le();mP="https://api.typebulb.com",vy="https://typebulb.com",hP=3600*1e3,Sy=5e3,ky=15e3,cs=null,Iu=null;Bu=/^[a-z0-9][a-z0-9-]*$/,yP=300*1e3,_t=null,$u=null,Ho=()=>Ao("TYPEBULB_ORIGIN",z)||vy,Du=()=>Ao("TYPEBULB_TOKEN",z)});import{readFileSync as Uu,writeFileSync as Ry,mkdirSync as wP,appendFileSync as _y,rmSync as Cy}from"fs";import{join as Vo,dirname as vP}from"path";import{createServer as SP}from"http";function Nt(r){try{return JSON.parse(Uu(r,"utf8"))}catch{return null}}function Yo(r,e){wP(vP(r),{recursive:!0}),Ry(r,JSON.stringify(e,null,2)+`
|
|
1489
|
+
`)}function Iy(r,e,t){let n=Vo(r,".gitignore"),s="";try{s=Uu(n,"utf8")}catch{}let i=new Set(s.split(/\r?\n/).map(c=>c.trim())),o=e.filter(c=>!i.has(c));if(!o.length)return;let a=s&&!s.endsWith(`
|
|
1422
1490
|
`)?`
|
|
1423
|
-
`:"";try{
|
|
1491
|
+
`:"";try{_y(n,a+t+`
|
|
1424
1492
|
`+o.join(`
|
|
1425
1493
|
`)+`
|
|
1426
|
-
`)}catch(c){console.error("[switcher] .gitignore update failed",Y(c))}}function
|
|
1494
|
+
`)}catch(c){console.error("[switcher] .gitignore update failed",Y(c))}}function TP(r){let e=i=>{let o=i.exec(r);return o?Number(o[1]):0},t=e(/"cache_read_input_tokens":\s*(\d+)/),n=e(/"cache_creation_input_tokens":\s*(\d+)/),s=e(/"input_tokens":\s*(\d+)/);t>0||n>0?ds="live":s>AP&&(ds="uncached")}function Ly(r,e){let t={"content-type":"application/json",authorization:`Bearer ${e}`,"anthropic-version":r.headers["anthropic-version"]||"2023-06-01"},n=r.headers["anthropic-beta"];return typeof n=="string"&&(t["anthropic-beta"]=n),t}function PP(r){if(Array.isArray(r?.messages))for(let e of r.messages){if(!Array.isArray(e?.content))continue;let t=e.content.filter(n=>n?.type!=="thinking"&&n?.type!=="redacted_thinking");t.length&&t.length!==e.content.length&&(e.content=t)}}function My(r){let e;try{e=JSON.parse(r)}catch{return r}us=typeof e?.model=="string"?e.model:null,Ge&&(e.model=Ge),ir&&(e.provider=$y(ir));let t=/haiku/i.test(us||"");return fs!=null&&!t&&(e.reasoning={effort:Fu[fs]}),delete e.thinking,e.output_config&&delete e.output_config.effort,PP(e),JSON.stringify(e)}function OP(){let r="",e=0,t=new Map,n=new Set(["thinking","redacted_thinking"]),s=i=>{let o=/^data: (.*)$/m.exec(i);if(!o)return i;let a;try{a=JSON.parse(o[1])}catch{return i}switch(a.type){case"message_start":return t.clear(),e=0,i;case"content_block_start":{if(n.has(a.content_block?.type))return t.set(a.index,null),null;let c=e++;return t.set(a.index,c),a.index=c,`event: ${a.type}
|
|
1427
1495
|
data: ${JSON.stringify(a)}
|
|
1428
1496
|
|
|
1429
1497
|
`}case"content_block_delta":case"content_block_stop":{let c=t.get(a.index);return c==null?null:(a.index=c,`event: ${a.type}
|
|
@@ -1431,11 +1499,11 @@ data: ${JSON.stringify(a)}
|
|
|
1431
1499
|
|
|
1432
1500
|
`)}default:return i}};return i=>{r+=i;let o="",a;for(;(a=r.indexOf(`
|
|
1433
1501
|
|
|
1434
|
-
`))!==-1;){let c=r.slice(0,a);if(r=r.slice(a+2),!c.trim())continue;let l=s(c);l!==null&&(o+=l)}return o}}function
|
|
1502
|
+
`))!==-1;){let c=r.slice(0,a);if(r=r.slice(a+2),!c.trim())continue;let l=s(c);l!==null&&(o+=l)}return o}}function CP(r){return new Promise(e=>{let t=[];r.on("data",n=>t.push(n)),r.on("end",()=>e(Buffer.concat(t).toString("utf8"))),r.on("error",()=>e(Buffer.concat(t).toString("utf8")))})}function ls(r,e,t,n){r.writableEnded||(r.writeHead(e,{"content-type":"application/json"}),r.end(JSON.stringify({type:"error",error:{type:t,message:n}})))}async function RP(r,e,t){if(!Ge){ls(e,400,"invalid_request_error",EP);return}let n=process.env.OPENROUTER_API_KEY;if(!n){ls(e,401,"authentication_error","OPENROUTER_API_KEY not set in the typebulb proxy");return}let s=new AbortController;e.on("close",()=>{e.writableEnded||s.abort()});let i;try{i=await fetch(Ju,{method:"POST",headers:Ly(r,n),body:My(t),signal:s.signal})}catch(u){ls(e,502,"api_error",`proxy upstream failed: ${Y(u)}`);return}let o=i.headers.get("content-type")||"application/json";if(e.writeHead(i.status,{"content-type":o}),!i.body){e.end();return}let a=o.includes("event-stream"),c=i.body.getReader(),l=new TextDecoder,d=a?OP():null;try{for(;;){let{done:u,value:f}=await c.read();if(u)break;if(f)if(d){let p=l.decode(f,{stream:!0});TP(p);let h=d(p);h&&e.write(h)}else e.write(Buffer.from(f))}}catch{}finally{e.writableEnded||e.end()}}async function _P(r,e,t){let n=process.env.OPENROUTER_API_KEY,s=()=>{e.writeHead(200,{"content-type":"application/json"}),e.end(JSON.stringify({input_tokens:Math.max(1,Math.ceil(t.length/4))}))};if(!Ge||!n)return s();try{let i=await fetch(`${Ju}/count_tokens`,{method:"POST",headers:Ly(r,n),body:My(t)});if(!i.ok)return s();let o=await i.text();e.writeHead(200,{"content-type":"application/json"}),e.end(o)}catch{s()}}function NP(r,e){let t=r.url||"/";if(r.method==="HEAD"){e.writeHead(200),e.end();return}if(r.method!=="POST"){ls(e,404,"not_found_error",t);return}CP(r).then(n=>{if(t.includes("count_tokens"))return _P(r,e,n);if(t.includes("/v1/messages"))return RP(r,e,n);ls(e,404,"not_found_error",t)})}function IP(){return zr&&sr?Promise.resolve(sr):new Promise((r,e)=>{let t=SP(NP);t.on("error",e),t.listen(0,"127.0.0.1",()=>{zr=t,sr=t.address().port,console.log(`[switcher] wire proxy listening on ${Wo(sr)}`),r(sr)})})}function $P(){try{zr?.close()}catch{}zr=null,sr=null}function LP(r,e){let t=zo(r),n=Nt(t),s=n||{};if((!s.env||typeof s.env!="object")&&(s.env={}),s.env.ANTHROPIC_BASE_URL===Wo(e)&&s.env.ANTHROPIC_AUTH_TOKEN)return;let i=Go(r);if(!Nt(i)){let a={};for(let c of Ny)a[c]=c in s.env?s.env[c]:null;Yo(i,{managedBy:"agent-switcher",fileExisted:n!==null,snapshot:a,active:null})}s.env.ANTHROPIC_BASE_URL=Wo(e),s.env.ANTHROPIC_AUTH_TOKEN=xP,Yo(t,s),Iy(r,[".claude/settings.local.json",".claude/.cc-switcher.json"],"# agent switcher (local Claude Code model override)")}function MP(r,e,t){let n=Go(r),s=Nt(n)||{managedBy:"agent-switcher",fileExisted:!1,snapshot:{}};s.active={model:e,provider:t},Yo(n,s)}function By(r){let e=zo(r),t=Go(r),n=Nt(t),s=Nt(e);if(s?.env){let i=n?.snapshot||{};for(let o of Ny){let a=i[o];a==null?delete s.env[o]:s.env[o]=a}if(Object.keys(s.env).length===0&&delete s.env,n?.fileExisted===!1&&Object.keys(s).length===0)try{Cy(e,{force:!0})}catch{}else Yo(e,s)}try{Cy(t,{force:!0})}catch{}}async function BP(){let r=!!process.env.OPENROUTER_API_KEY,e=[];try{e=(await st()).filter(n=>n.provider==="openrouter"&&!Ku(n.name)).map(n=>({id:n.name,label:n.friendlyName||n.name}))}catch(n){console.error("[switcher] model list failed",Y(n))}let t=e.length?void 0:cu()??void 0;return{hasKey:r,models:e,error:t}}async function DP(){if(zr&&Ge)return{active:!0,managed:!0,model:Ge,port:sr,provider:ir,routedModel:us,caching:ds,reasoning:fs,externalBaseUrl:null};let r=Nt(zo(z))?.env||{};return{active:!1,managed:!1,model:null,port:null,provider:null,routedModel:null,caching:"unknown",reasoning:fs,externalBaseUrl:r.ANTHROPIC_BASE_URL||null}}async function Dy(r,e){let t=await IP();return Ge=r,ir=e,LP(z,t),t}async function jP({model:r}){if(!process.env.OPENROUTER_API_KEY)return{ok:!1,error:"OPENROUTER_API_KEY not set \u2014 add a key first"};if(!r)return{ok:!1,error:"no model given"};if(Ku(r))return{ok:!1,error:"Refusing to route an Anthropic model through OpenRouter \u2014 that bills full API rate with no caching. Use it on your Anthropic subscription instead."};try{await Dy(r,Hu[r]??null),us=null,ds="unknown",MP(z,r,ir)}catch(e){return{ok:!1,error:`failed to start the wire proxy: ${Y(e)}`}}return{ok:!0}}async function FP({level:r}){return r!=null&&(!Number.isInteger(r)||r<0||r>=Fu.length)?{ok:!1,error:`reasoning level must be 0\u2013${Fu.length-1} or null`}:(fs=r,{ok:!0,level:r})}async function qP(){return By(z),Ge=null,ir=null,us=null,ds="unknown",{ok:!0}}async function UP({key:r}){let e=(r||"").trim();if(!e)return{ok:!1,error:"empty key"};let t=z,n=Vo(t,".env"),s="";try{s=Uu(n,"utf8")}catch{}try{if(/^\s*OPENROUTER_API_KEY\s*=/m.test(s))Ry(n,s.replace(/^\s*OPENROUTER_API_KEY\s*=.*$/m,`OPENROUTER_API_KEY=${e}`));else{let i=s&&!s.endsWith(`
|
|
1435
1503
|
`)?`
|
|
1436
|
-
`:"";
|
|
1437
|
-
`)}}catch(i){return{ok:!1,error:Y(i)}}return process.env.OPENROUTER_API_KEY=e,
|
|
1438
|
-
`)}catch(o){return{ok:!1,error:`could not write ${r}: ${Y(o)}`}}return{ok:!0,count:e.length}}var
|
|
1504
|
+
`:"";_y(n,i+`OPENROUTER_API_KEY=${e}
|
|
1505
|
+
`)}}catch(i){return{ok:!1,error:Y(i)}}return process.env.OPENROUTER_API_KEY=e,Iy(t,[".env"],"# secrets"),{ok:!0}}function JP(){if(!(!zr&&!Ge)){try{By(z)}catch{}$P()}}function KP(r,e){return jy.test(e)?"blocked by your OpenRouter data policy":r===401||r===403||/unauthor|invalid api key|no auth|forbidden/i.test(e)?"auth rejected \u2014 check your OpenRouter key":r===404||/not a valid model|no such model|unknown model|model not found/i.test(e)?"model not found on this route":r===429||/rate limit/i.test(e)?"rate limited":r===402||/insufficient|credit|quota|balance/i.test(e)?"out of credits / quota":e.slice(0,160)}function HP(r){if(jy.test(r))return"This model's only provider(s) require prompt logging/training, which your OpenRouter account disallows by default. Allow it (or that provider) at openrouter.ai/settings/privacy, then probe again."}function WP(r,e,t){if(!r)return{works:null,read:0,note:t?`couldn't re-test on ${t} \u2014 caching unconfirmed`:"caching unconfirmed"};let n=qu(e?.cache_read_input_tokens)||qu(e?.prompt_tokens_details?.cached_tokens),s=e?.cache_read_input_tokens!==void 0||e?.cache_creation_input_tokens!==void 0||e?.prompt_tokens_details!==void 0;return n>0?{works:!0,read:n,note:`${n} tokens read from cache on the 2nd call`}:s?{works:!1,read:n,note:"no cache reads after a warm call \u2014 every turn re-bills the full context"}:{works:null,read:n,note:"route doesn't report cache usage \u2014 caching almost certainly not honored"}}async function YP({model:r}){let e=process.env.OPENROUTER_API_KEY;if(!e)return{ok:!1,error:"OPENROUTER_API_KEY not set \u2014 add a key first"};if(!r)return{ok:!1,error:"no model given"};if(Ku(r))return{ok:!1,error:"Anthropic model \u2014 not offered or probed via OpenRouter"};let t=Date.now(),n=Array(350).fill("Caching probe filler sentence; its only purpose is to exceed the prompt-cache minimum token threshold.").join(" "),s={"content-type":"application/json",authorization:`Bearer ${e}`,"anthropic-version":"2023-06-01"},i={model:r,max_tokens:64,system:[{type:"text",text:n,cache_control:{type:"ephemeral"}}],messages:[{role:"user",content:"Reply with exactly: ok"}]},o=async a=>{let c=new AbortController,l=setTimeout(()=>c.abort(),2e4);try{let d=JSON.stringify(a?{...i,provider:$y(a)}:i),u=await fetch(Ju,{method:"POST",signal:c.signal,headers:s,body:d}),f=await u.json().catch(()=>({}));return{r:u,j:f}}finally{clearTimeout(l)}};try{let{r:a,j:c}=await o();if(!a.ok){let A=c?.error?.message||c?.message||JSON.stringify(c).slice(0,300);return{ok:!0,callable:!1,status:a.status,ms:Date.now()-t,error:KP(a.status,A),restriction:HP(A)}}let l=typeof c?.provider=="string"?c.provider:void 0,d=c?.content?.find?.(A=>A.type==="text")?.text??c?.content?.[0]?.text??"ok",u=qu(c?.usage?.cache_creation_input_tokens),{r:f,j:p}=await o(l),{works:h,read:m,note:b}=WP(f.ok,p?.usage,l);return h===!0&&l&&(Hu[r]=l,Ge===r&&(ir=l)),{ok:!0,callable:!0,status:a.status,ms:Date.now()-t,provider:l,sample:String(d).trim().slice(0,60),cache:{works:h,created:u,read:m,note:b}}}catch(a){let c=Y(a);return{ok:!0,callable:!1,ms:Date.now()-t,error:/abort/i.test(c)?"timed out (20s)":c}}}var kP,Ju,xP,EP,Ny,AP,Fu,zo,Go,Wo,Ku,zr,sr,Ge,ir,us,ds,fs,Hu,qu,$y,jy,Fy=v(()=>{Hr();Rt();kP="https://openrouter.ai/api",Ju=`${kP}/v1/messages`,xP="typebulb-proxy-managed",EP="The typebulb model override was reverted to Anthropic, but this Claude Code session still points at the now-idle proxy. Reload the window (VS Code/Cursor: \u201CDeveloper: Reload Window\u201D) or relaunch `claude` in a terminal to return to your Anthropic subscription.",Ny=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],AP=5e3,Fu=["low","medium","high"],zo=r=>Vo(r,".claude","settings.local.json"),Go=r=>Vo(r,".claude",".cc-switcher.json"),Wo=r=>`http://127.0.0.1:${r}`;Ku=r=>/^anthropic\//i.test(r)||/claude/i.test(r),zr=null,sr=null,Ge=null,ir=null,us=null,ds="unknown",fs=1,Hu={},qu=r=>typeof r=="number"?r:0,$y=r=>({order:[r],allow_fallbacks:!1});jy=/data policy|no endpoints|no allowed providers|privacy|requires.*(training|logging|data)/i;(async function(){try{let e=Nt(Go(z)),t=e?.active?.model;if(!t)return;let s=(Nt(zo(z))?.env||{}).ANTHROPIC_BASE_URL||"";if(!/127\.0\.0\.1|localhost/.test(s))return;let i=await Dy(t,e.active.provider??Hu[t]??null);console.log(`[switcher] re-adopted override after restart: ${t} via ${Wo(i)}`)}catch(e){console.error("[switcher] boot reconcile failed",Y(e))}})()});var Uy={};hd(Uy,{attach:()=>tO,blockToMarkdown:()=>_i,breakout:()=>dy,capText:()=>Je,cleanUserText:()=>wt,clearSwitchModel:()=>qP,composerPasteRead:()=>rO,displayName:()=>VP,downloadSample:()=>Ey,firstLineDigest:()=>Ze,git:()=>ze,gitChangedFiles:()=>Xg,gitDiff:()=>Qg,info:()=>zP,isHiddenTurn:()=>Mn,launchBulb:()=>gy,listBreakouts:()=>fy,listBulbFiles:()=>my,listMyBulbs:()=>Ay,listSamples:()=>xy,listSessions:()=>QP,listSwitchModels:()=>BP,logEmbedStatus:()=>XP,openFile:()=>uy,poll:()=>GP,predictTrustOf:()=>yy,probeModel:()=>YP,pullRemoteBulb:()=>Ty,pushLocalBulb:()=>Oy,readBulbLog:()=>wy,repoRoot:()=>Yr,saveOpenRouterKey:()=>UP,searchBulbs:()=>hy,searchSessions:()=>ZP,sessionPeek:()=>eO,setBulbTrust:()=>by,setReasoning:()=>FP,setSwitchModel:()=>jP,shutdownSwitcher:()=>JP,stopBreakout:()=>py,switchState:()=>DP,toolResultDigest:()=>kl});var qy,VP,zP,GP,XP,QP,ZP,eO,tO,rO,Jy=v(()=>{Nu();Ni();ju();Do();Fy();Ni();Ci();qy=new kr,VP=qy.displayName,{info:zP,poll:GP,logEmbedStatus:XP,listSessions:QP,searchSessions:ZP,sessionPeek:eO,attach:tO,composerPasteRead:rO}=Ko(qy)});import{readFileSync as nO,writeFileSync as sO,mkdirSync as iO}from"fs";import{homedir as oO}from"os";import*as Xo from"path";async function Wy(){try{let r=await fetch(new URL("/api/tags",Hy()).toString(),{signal:AbortSignal.timeout(aO)});return r.ok?((await r.json()).models??[]).map(t=>t.name).filter(t=>!!t):[]}catch{return[]}}function Yy(r){let e;try{e=nO(r,"utf-8")}catch{return{json:void 0,unreadable:!1}}try{let t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t)){let n=t;return{json:n,unreadable:"providers"in n&&!Wu(n)}}}catch{}return{json:void 0,unreadable:!0}}function Wu(r){let e=r?.providers;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function cO(r){let e=Wu(r);if(!e||!("ollama"in e))return null;let t=e.ollama?.models;return Array.isArray(t)?t.map(n=>n?.id).filter(n=>typeof n=="string"):[]}async function Vy(){let{json:r,unreadable:e}=Yy(Ky());return e?{installed:[],configured:null}:{installed:await Wy(),configured:cO(r)}}async function zy(){let r=await Wy();return r.length?lO(Ky(),r,Hy()):{ok:!1,error:"Ollama is not running (or has no models installed)"}}function lO(r,e,t){let{json:n,unreadable:s}=Yy(r);if(s)return{ok:!1,error:`could not parse ${r} \u2014 edit the ollama provider there yourself`};let i={...n??{},providers:{...Wu(n)??{},ollama:{baseUrl:`${t}/v1`,api:"openai-completions",apiKey:"ollama",models:e.map(o=>({id:o}))}}};try{iO(Xo.dirname(r),{recursive:!0}),sO(r,JSON.stringify(i,null,2)+`
|
|
1506
|
+
`)}catch(o){return{ok:!1,error:`could not write ${r}: ${Y(o)}`}}return{ok:!0,count:e.length}}var aO,Ky,Hy,Gy=v(()=>{Rt();Hr();aO=1500,Ky=()=>Xo.join(oO(),".pi","agent","models.json"),Hy=()=>Mr(process.env.OLLAMA_HOST??"http://localhost:11434")});var Qy={};hd(Qy,{attach:()=>yO,breakout:()=>dy,composerFiles:()=>SO,composerNew:()=>vO,composerPaste:()=>EO,composerPasteRead:()=>AO,composerRpc:()=>xO,composerSend:()=>bO,composerStop:()=>wO,composerUiRespond:()=>kO,displayName:()=>uO,downloadSample:()=>Ey,git:()=>ze,gitChangedFiles:()=>Xg,gitDiff:()=>Qg,info:()=>dO,launchBulb:()=>gy,listBreakouts:()=>fy,listBulbFiles:()=>my,listMyBulbs:()=>Ay,listSamples:()=>xy,listSessions:()=>mO,logEmbedStatus:()=>pO,ollamaOffer:()=>Vy,ollamaSync:()=>zy,openFile:()=>uy,poll:()=>fO,predictTrustOf:()=>yy,pullRemoteBulb:()=>Ty,pushLocalBulb:()=>Oy,readBulbLog:()=>wy,repoRoot:()=>Yr,searchBulbs:()=>hy,searchSessions:()=>hO,sessionPeek:()=>gO,setBulbTrust:()=>by,shutdownComposer:()=>TO,stopBreakout:()=>py});var Xy,uO,dO,fO,pO,mO,hO,gO,yO,bO,wO,vO,SO,kO,xO,EO,AO,TO,Zy=v(()=>{Nu();Cu();ju();Do();Gy();Xy=new Wr,uO=Xy.displayName,{info:dO,poll:fO,logEmbedStatus:pO,listSessions:mO,searchSessions:hO,sessionPeek:gO,attach:yO,composerSend:bO,composerStop:wO,composerNew:vO,composerFiles:SO,composerUiRespond:kO,composerRpc:xO,composerPaste:EO,composerPasteRead:AO,shutdownComposer:TO}=Ko(Xy)});import*as fw from"fs/promises";import*as ar from"path";xs();le();function gl(r){if(!Ce.includes(r))throw new Error(`Unknown block kind '${r}' (one of: ${Ce.join(", ")})`);return r}function Gm(r){let e=[];for(let t of r){let n=t.indexOf("=");if(n<=0||n===t.length-1)throw new Error(`Expected <kind>=<source>, got '${t}' (e.g. data=results.json, or data=- for stdin)`);let s=gl(t.slice(0,n));if(e.some(i=>i.kind===s))throw new Error(`Duplicate block kind '${s}' \u2014 each block can be written once per invocation`);e.push({kind:s,source:t.slice(n+1)})}if(e.filter(t=>t.source==="-").length>1)throw new Error("Only one <kind>=- can read stdin");return e}Ni();Cu();var Qo={claude:{adapter:()=>new kr,server:()=>Promise.resolve().then(()=>(Jy(),Uy))},pi:{adapter:()=>new Wr,server:()=>Promise.resolve().then(()=>(Zy(),Qy))}};function eb(r){return r in Qo}function Gr(){return Object.keys(Qo)}function tb(){return Object.fromEntries(Object.entries(Qo).map(([r,e])=>[r,e.adapter]))}function rb(r){return Qo[r].server()}var ps=tb();function nb(){for(let r of Object.values(ps))try{r().ensureHarnessSupport()}catch{}}function or(){for(let r of Object.keys(ps))try{if(ps[r]().detectsSelf())return r}catch{}}function sb(r){let e=Gr(),t=new Map(e.filter(i=>ps[i]).map(i=>[i,ps[i]()]));for(let[i,o]of t)if(o.detectsSelf())return{name:i};let n=[...t].filter(([,i])=>i.detectsInstalled()).map(([i])=>i);if(n.length===0)return{name:e[0]};if(n.length===1)return{name:n[0]};let s=i=>t.get(i).listSessionFiles(r).length>0;return{ambiguous:[...n].sort((i,o)=>Number(s(o))-Number(s(i)))}}var Vu=5e3;function Yu(r){try{return r()}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}}function ib(r){let t={subcommand:"run",file:"",watch:!0,open:!(process.env.TERM_PROGRAM==="vscode"||or()!==void 0),server:!1,trust:!1,noTrust:!1,force:!1,follow:!1,clear:!1,help:!1,version:!1,callArgs:[],hasArgsFlag:!1},n=["call","check","predict","logs","wait","stop","trust","untrust","models","slug","send","pull","push","get","put"],s=r[0];if(s==="agent"||s?.startsWith("agent:")){t.subcommand="agent";let o=s.indexOf(":");if(o!==-1){let a=s.slice(o+1);a&&(t.agentTarget=a)}r=r.slice(1)}else s&&n.includes(s)&&(t.subcommand=s,r=r.slice(1));let i=[];for(let o=0;o<r.length;o++){let a=r[o];if(a==="--help"||a==="-h")t.help=!0;else if(a==="--version"||a==="-V")t.version=!0;else if(a==="--no-watch")t.watch=!1;else if(a==="--open")t.open=!0;else if(a==="--no-open")t.open=!1;else if(a==="--server")t.server=!0;else if(a==="--trust")t.trust=!0;else if(a==="--no-trust")t.noTrust=!0;else if(a==="--force")t.force=!0;else if(a==="--mode"){let c=r[++o];(!c||c.startsWith("-"))&&(console.error("Missing value for --mode (e.g. --mode staging)"),process.exit(1)),t.mode=c}else if(a==="--batch"){let c=r[++o];(!c||c.startsWith("-"))&&(console.error("Missing value for --batch (a batch name, e.g. --batch pilot)"),process.exit(1));let l=c.replace(/[\\/]+$/,"");(!l||/[\\/]/.test(l)||l==="."||l==="..")&&(console.error(`Invalid --batch value: ${c} (a single folder name \u2014 no path separators or dot segments)`),process.exit(1)),t.batch=l}else if(a==="--follow"||a==="-f")t.follow=!0;else if(a==="--clear")t.clear=!0;else if(a==="--run"){let c=r[++o];if(c==="latest")t.run="latest";else{let l=parseInt(c,10);(isNaN(l)||l<1)&&(console.error(`Invalid --run value: ${c} (a run number, or 'latest')`),process.exit(1)),t.run=l}}else if(a==="--bulbs")t.stopScope="bulbs";else if(a==="--agent")t.stopScope="agent";else if(a==="--global")t.stopScope="global";else if(a==="--match"){let c=r[++o];c===void 0&&(console.error("Missing value for --match (a literal substring new log lines must contain)"),process.exit(1)),t.match=c}else if(a==="--timeout"){let c=parseInt(r[++o],10);(isNaN(c)||c<=0)&&(console.error(`Invalid --timeout value: ${r[o]} (seconds)`),process.exit(1)),t.timeoutSec=c}else if(a==="--wait"||a.startsWith("--wait="))if(a.startsWith("--wait=")){let c=parseInt(a.slice(7),10);(isNaN(c)||c<=0)&&(console.error(`Invalid --wait value: ${a.slice(7)} (milliseconds)`),process.exit(1)),t.sendWaitMs=c}else t.sendWaitMs=Vu;else if(a==="--lines"||a==="-n"){let c=parseInt(r[++o],10);(isNaN(c)||c<0)&&(console.error(`Invalid --lines value: ${r[o]}`),process.exit(1)),t.lines=c}else if(a==="--port"||a==="-p"){let c=r[++o],l=parseInt(c,10);isNaN(l)&&(console.error(`Invalid port: ${c}`),process.exit(1)),t.port=l}else if(a==="--replace"||a.startsWith("--replace=")){let c=a.startsWith("--replace=")?a.slice(10):r[++o]??"",l=Yu(()=>Sd(c));t.local&&(console.error(`--replace can only be used once (got '${t.local.name}' and '${l.name}')`),process.exit(1)),t.local=l}else if(a==="--args"||a.startsWith("--args=")){t.hasArgsFlag=!0;let c=a.startsWith("--args=")?a.slice(7):r[++o];c===void 0&&(console.error("Missing value for --args (a JSON array, or - to read it from stdin)"),process.exit(1)),t.argsJson=c}else if(!a.startsWith("-"))["call","send","get","put","slug"].includes(t.subcommand)?i.push(a):t.file=a;else{let c=t.subcommand==="call"?" (for a negative or dash-leading argument, use --args '<json-array>')":"";console.error(`Unknown option: ${a}${c}`),process.exit(1)}}return t.subcommand==="call"&&(i.length<2&&(console.error("Usage: typebulb call <file> <fn> [arg\u2026]"),process.exit(1)),t.file=i[0],t.fn=i[1],t.callArgs=i.slice(2)),t.subcommand==="send"&&(i.length<1&&(console.error("Usage: typebulb send <file> [message]"),process.exit(1)),t.file=i[0],t.sendMessage=i[1]),t.subcommand==="slug"&&(i.length||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1)),t.slugName=i.join(" ")),t.subcommand==="get"&&(i.length!==2&&(console.error("Usage: typebulb get <file> <kind>"),process.exit(1)),t.file=i[0],t.blockKind=Yu(()=>gl(i[1]))),t.subcommand==="put"&&(i.length<2&&(console.error("Usage: typebulb put <file> <kind>=<source> [<kind>=<source> \u2026]"),process.exit(1)),t.file=i[0],t.blockPairs=Yu(()=>Gm(i.slice(1)))),t}function ob(){console.log(`
|
|
1439
1507
|
typebulb - Local bulb runner for Typebulb
|
|
1440
1508
|
|
|
1441
1509
|
Usage:
|
|
@@ -1606,7 +1674,7 @@ Examples:
|
|
|
1606
1674
|
typebulb my-editor.bulb.md
|
|
1607
1675
|
typebulb --no-watch --port 8080 my-editor.bulb.md
|
|
1608
1676
|
typebulb .
|
|
1609
|
-
`)}
|
|
1677
|
+
`)}He();Fn();xs();ss();He();import*as Oe from"path";import{spawn as ZO,execSync as eC}from"child_process";import{createRequire as tC}from"module";import{existsSync as rC}from"fs";import*as pe from"fs/promises";import*as de from"path";var zu=[{name:"es5"},{name:"es2015.core"},{name:"es2015.collection"},{name:"es2015.promise"},{name:"es2015.iterable"},{name:"es2015.symbol"},{name:"es2015.symbol.wellknown"},{name:"es2015.generator"},{name:"es2015.proxy"},{name:"es2015.reflect"},{name:"es2016.array.include"},{name:"es2016.intl"},{name:"es2017.object"},{name:"es2017.string"},{name:"es2017.sharedmemory"},{name:"es2017.typedarrays"},{name:"es2017.date"},{name:"es2017.intl"},{name:"es2018.asynciterable"},{name:"es2018.asyncgenerator"},{name:"es2018.promise"},{name:"es2018.regexp"},{name:"es2018.intl"},{name:"es2019.array"},{name:"es2019.object"},{name:"es2019.string"},{name:"es2019.symbol"},{name:"es2019.intl"},{name:"es2020.bigint"},{name:"es2020.promise"},{name:"es2020.string"},{name:"es2020.sharedmemory"},{name:"es2020.date"},{name:"es2020.number"},{name:"es2020.symbol.wellknown"},{name:"es2020.intl"},{name:"es2021.promise"},{name:"es2021.string"},{name:"es2021.weakref"},{name:"es2021.intl"},{name:"es2022.array"},{name:"es2022.object"},{name:"es2022.error"},{name:"es2022.string"},{name:"es2022.regexp"},{name:"es2022.intl"},{name:"es2023.array"},{name:"es2023.collection"},{name:"es2023.intl",since:"5.5"},{name:"es2024.arraybuffer",since:"5.5"},{name:"es2024.collection",since:"5.5"},{name:"es2024.object",since:"5.5"},{name:"es2024.promise",since:"5.5"},{name:"es2024.regexp",since:"5.5"},{name:"es2024.sharedmemory",since:"5.5"},{name:"es2024.string",since:"5.5"},{name:"esnext.array",since:"5.5"},{name:"esnext.collection"},{name:"esnext.decorators"},{name:"esnext.disposable"},{name:"esnext.error",since:"5.5"},{name:"esnext.float16",since:"5.5"},{name:"esnext.iterator",since:"5.5"},{name:"esnext.object"},{name:"esnext.promise"},{name:"esnext.sharedmemory",since:"5.5"},{name:"esnext.intl"}],Gu=[{name:"dom"},{name:"dom.iterable"},{name:"dom.asynciterable"}];function Xu(r,e){if(!e)return r.filter(s=>!s.since);let t={"5.0":0,"5.5":1},n=t[e];return r.filter(s=>!s.since||t[s.since]<=n)}var PO=`
|
|
1610
1678
|
/**
|
|
1611
1679
|
* Get raw data chunk from the Data tab.
|
|
1612
1680
|
* @param index - Chunk index (0-based). Separate chunks with 2 blank lines.
|
|
@@ -1617,7 +1685,7 @@ Examples:
|
|
|
1617
1685
|
* @param index - Chunk index (0-based)
|
|
1618
1686
|
* @throws If chunk is not valid JSON/JSON-ish
|
|
1619
1687
|
*/
|
|
1620
|
-
json<T = unknown>(index: number): T;`,
|
|
1688
|
+
json<T = unknown>(index: number): T;`,OO=`
|
|
1621
1689
|
/**
|
|
1622
1690
|
* Get the insight data produced by the inference layer.
|
|
1623
1691
|
*
|
|
@@ -1626,7 +1694,7 @@ Examples:
|
|
|
1626
1694
|
*
|
|
1627
1695
|
* @returns The parsed insight JSON, or undefined if no insight is available
|
|
1628
1696
|
*/
|
|
1629
|
-
insight<T = unknown>(): T | undefined;`,
|
|
1697
|
+
insight<T = unknown>(): T | undefined;`,ab=`options: {
|
|
1630
1698
|
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
1631
1699
|
system?: string;
|
|
1632
1700
|
/** Reasoning effort hint: 0=minimal, 1=low, 2=med, 3=high. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking budget, Anthropic adaptive thinking). 0 minimizes reasoning \u2014 a floor, not a guaranteed "off": some models still think a little at 0, and adaptive models already self-skip at 1 (low). Level 1 (low) is the sensible default for most work; reach for 0 only when you truly want minimal deliberation. Omit for the model's own default. */
|
|
@@ -1637,12 +1705,15 @@ Examples:
|
|
|
1637
1705
|
webSearch?: boolean;
|
|
1638
1706
|
/** Abort the request. On abort the promise rejects / the stream ends. */
|
|
1639
1707
|
signal?: AbortSignal;
|
|
1640
|
-
}`,
|
|
1708
|
+
}`,cb=`
|
|
1641
1709
|
/** A single streamed delta from \`tb.ai.stream()\`. Discriminated by \`kind\`. */
|
|
1642
1710
|
type AiChunk =
|
|
1643
1711
|
| { kind: "text"; text: string }
|
|
1644
1712
|
| { kind: "reasoning"; text: string };
|
|
1645
|
-
`,
|
|
1713
|
+
`,lb=`
|
|
1714
|
+
/** What backs \`tb.ai\`: the user's own keys, the quota-limited courtesy model, or nothing. */
|
|
1715
|
+
type AiAccess = "own" | "courtesy" | "none";
|
|
1716
|
+
`,ub=`
|
|
1646
1717
|
/**
|
|
1647
1718
|
* General-purpose AI call. \`tb.ai(opts)\` resolves with the full text; \`tb.ai.stream(opts)\`
|
|
1648
1719
|
* returns an async iterable of {@link AiChunk} deltas you consume with \`for await\`.
|
|
@@ -1651,7 +1722,7 @@ type AiChunk =
|
|
|
1651
1722
|
* @throws On rate limit, network error, or provider error
|
|
1652
1723
|
*/
|
|
1653
1724
|
ai: {
|
|
1654
|
-
(${
|
|
1725
|
+
(${ab}): Promise<{ text: string }>;
|
|
1655
1726
|
/**
|
|
1656
1727
|
* Streaming counterpart of \`tb.ai()\`. Yields \`{ kind: "text" | "reasoning", text }\` deltas
|
|
1657
1728
|
* as they arrive; break the loop (or abort \`signal\`) to cancel and stop the upstream.
|
|
@@ -1665,8 +1736,8 @@ type AiChunk =
|
|
|
1665
1736
|
* if (c.kind === "text") answer += c.text;
|
|
1666
1737
|
* }
|
|
1667
1738
|
*/
|
|
1668
|
-
stream(${
|
|
1669
|
-
};`,
|
|
1739
|
+
stream(${ab}): AsyncIterable<AiChunk>;
|
|
1740
|
+
};`,db=`
|
|
1670
1741
|
/**
|
|
1671
1742
|
* Returns AI models available to the current user.
|
|
1672
1743
|
* Models are filtered by the user's configured API keys.
|
|
@@ -1685,12 +1756,18 @@ type AiChunk =
|
|
|
1685
1756
|
default?: boolean;
|
|
1686
1757
|
}>>;
|
|
1687
1758
|
/**
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
1759
|
+
* What backs \`tb.ai\` right now:
|
|
1760
|
+
*
|
|
1761
|
+
* - \`'own'\` \u2014 the user's own API keys (or their own local model server)
|
|
1762
|
+
* - \`'courtesy'\` \u2014 the quota-limited courtesy model, fine for a call or two
|
|
1763
|
+
* - \`'none'\` \u2014 no AI at all (the CLI with no keys, an embedded bulb)
|
|
1764
|
+
*
|
|
1765
|
+
* A bulb making many AI calls should show a "use your own keys" notice
|
|
1766
|
+
* instead of running unless this is \`'own'\`. Never derive it from
|
|
1767
|
+
* \`tb.mode\` or the length of \`tb.models()\` \u2014 which hosts offer a courtesy
|
|
1768
|
+
* model is the host's business and changes without your bulb changing.
|
|
1692
1769
|
*/
|
|
1693
|
-
|
|
1770
|
+
aiAccess(): Promise<AiAccess>;`,CO="\n /**\n * The bulb's theme override (`<html data-theme>`).\n *\n * - Get: the current override \u2014 `'dark'` | `'light'`, or `undefined` when\n * following the OS preference.\n * - Set `'dark'`/`'light'` to force and persist it (per-bulb); set\n * `undefined` to clear the override and follow the OS again.\n *\n * Drives `<html data-theme>`, so render off `html[data-theme=\"\u2026\"]` selectors\n * (or observe the attribute) rather than reading `tb.theme`.\n */\n theme: 'light' | 'dark' | undefined;",fb=`
|
|
1694
1771
|
/**
|
|
1695
1772
|
* The mode this bulb is running in.
|
|
1696
1773
|
*
|
|
@@ -1700,7 +1777,7 @@ type AiChunk =
|
|
|
1700
1777
|
* - \`'embedded'\` \u2014 Running as a bulb embedded inside another bulb (sandboxed,
|
|
1701
1778
|
* client-only: AI, filesystem, and server RPC are unavailable)
|
|
1702
1779
|
*/
|
|
1703
|
-
mode: 'local' | 'editor' | 'published' | 'embedded';`,
|
|
1780
|
+
mode: 'local' | 'editor' | 'published' | 'embedded';`,pb=`
|
|
1704
1781
|
/**
|
|
1705
1782
|
* Local filesystem access (CLI only).
|
|
1706
1783
|
*
|
|
@@ -1717,7 +1794,7 @@ type AiChunk =
|
|
|
1717
1794
|
readBytes(path: string): Promise<Uint8Array>;
|
|
1718
1795
|
/** Write text or raw bytes to a file. Creates parent directories if needed. */
|
|
1719
1796
|
write(path: string, content: string | Uint8Array): Promise<boolean>;
|
|
1720
|
-
};`,
|
|
1797
|
+
};`,mb="\n /**\n * The bulb's folder \u2014 absolute path to `<bulb-dir>/<filename-stem>/`\n * (or its `batches/<name>/` folder when the run is scoped with `--batch`).\n *\n * For interop only (handing a path to `server.ts` or a spawned tool):\n * `tb.fs` already resolves relative paths against it, so bulb code writing\n * its own files never needs it. CLI only \u2014 throws in editor/published/embedded mode.\n */\n readonly dir: string;",RO=`
|
|
1721
1798
|
/**
|
|
1722
1799
|
* Async value inspector for tensor-like objects.
|
|
1723
1800
|
*
|
|
@@ -1784,47 +1861,47 @@ type AiChunk =
|
|
|
1784
1861
|
*
|
|
1785
1862
|
* @returns The full canonical URL
|
|
1786
1863
|
*/
|
|
1787
|
-
url(): Promise<string>;`,
|
|
1864
|
+
url(): Promise<string>;`,_O="\n /**\n * Subscribe to a value pushed from the terminal via `typebulb send <file> [message]`.\n *\n * The dual of `tb.log` (data out): a value sent *in* from the CLI, no `--trust` required.\n * Use it to start expensive work on demand instead of on load \u2014 e.g. `tb.onMessage(() => start())`\n * \u2014 so hot reloads don't re-trigger it while you edit, and an agent kicks off one run when ready.\n *\n * The message is the JSON-parsed value of what `send` was given (or the raw string if it isn't\n * JSON; `undefined` for a bare `typebulb send <file>`). A non-`undefined` return value (awaited)\n * becomes the reply `send --wait` prints on stdout \u2014 JSON-serializable, at most one handler\n * replying \u2014 the structured read-back for self-tests. Returns an unsubscribe function. Inert in\n * an embedded bulb (no sender) \u2014 the handler is registered but never fires.\n *\n * @param handler - Called with each pushed message; may return a JSON-serializable reply.\n * @returns An unsubscribe function.\n */\n onMessage(handler: (message: any) => unknown): () => void;",NO="\n /**\n * Print to the CLI's stdout \u2014 the bulb's log channel, read back with `typebulb logs <file>`.\n *\n * Ungated: needs no `server.ts` block and no `--trust`, so a Restricted client-only bulb can\n * instrument itself. Args cross to the CLI as JSON; where no CLI serves the page (web, embedded,\n * or a transport failure) it falls back to the browser console. Works in `server.ts` too (same\n * as `console.log` there).\n */\n log(...args: any[]): void;",IO="\n /**\n * Server-side function proxy.\n *\n * In the CLI, calls exported functions from the `**server.ts**` section.\n *\n * A normal export is awaited for its result (`await tb.server.fn()`). An `async function*`\n * export streams: `for await (const chunk of tb.server.gen())`. The call object supports both;\n * break the `for await` to cancel and tear down the server generator.\n */\n server: Record<string, (...args: any[]) => Promise<any> & AsyncIterable<any>>;",Qu=`${cb}${lb}
|
|
1788
1865
|
/**
|
|
1789
1866
|
* Typebulb utilities namespace.
|
|
1790
1867
|
* Type \`tb.\` to discover available helpers.
|
|
1791
1868
|
*/
|
|
1792
|
-
declare const tb: {${
|
|
1869
|
+
declare const tb: {${PO}${RO}${OO}${NO}${IO}${_O}${ub}${pb}${mb}${db}${CO}${fb}
|
|
1793
1870
|
};
|
|
1794
|
-
|
|
1871
|
+
`,$O=`
|
|
1795
1872
|
/**
|
|
1796
1873
|
* Print to the CLI's stdout \u2014 the same channel as \`console.log\` here (the server's console IS
|
|
1797
1874
|
* the bulb's log). One log verb across blocks: page-side \`tb.log\` reaches this same stdout.
|
|
1798
1875
|
*/
|
|
1799
|
-
log(...args: any[]): void;`,
|
|
1876
|
+
log(...args: any[]): void;`,Zu=`${cb}${lb}
|
|
1800
1877
|
/**
|
|
1801
1878
|
* Typebulb utilities namespace (server-side).
|
|
1802
1879
|
* Type \`tb.\` to discover available helpers.
|
|
1803
1880
|
*/
|
|
1804
|
-
declare const tb: {${
|
|
1881
|
+
declare const tb: {${$O}${ub}${pb}${mb}${db}${fb}
|
|
1805
1882
|
};
|
|
1806
|
-
`;
|
|
1883
|
+
`;tt();import DO from"p-limit";tt();import{resolve as gb}from"resolve.exports";var at={maxRelativeTypeRefs:500,maxBareDeps:8,maxBareDepth:3,prefetchConcurrency:4,negativeTtlMs:1e4},ms=["index.d.ts","index.d.mts"],ed=/\.d\.(ts|mts|cts)$/i;function Zo(r){return/\.d\.(ts|mts|cts)(?:[?#].*)?$/i.test(r)||/[?&]dts(?:[&#]|$)/i.test(r)}function hb(r){return[`${r}.d.ts`,`${r}.d.mts`]}function It(r){if(!r||r==="./"||r==="/")return[...ms];let e=r.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),t=hb(e),n=e.endsWith("/")?e:`${e}/`;return t.push(...hb(`${n}index`)),t}async function Xr(r,{retries:e=2,timeoutMs:t=15e3,init:n}={}){for(let s=0;s<=e;s++){let i=new AbortController,o=setTimeout(()=>i.abort(),t);try{let a=await fetch(r,{...n,signal:i.signal});if(LO(a.status)&&s<e)continue;return a}catch{if(s<e)continue;return}finally{clearTimeout(o)}}}function LO(r){return r===408||r===429||r>=500&&r<600}var ea=class{constructor(e,t){this.fetchDts=e,this.cdnClient=t}async tryUrls(e){for(let t of e){let n=await this.fetchDts(t);if(n&&(this.looksLikeDts(n.dts)||Zo(n.url)))return n}}looksLikeDts(e){return/^\s*export\s*\{\s*\}\s*;?\s*$/m.test(e)?!0:/declare\s+(module|namespace|class|interface|function|const|var|let)/.test(e)||/interface\s+\w+/.test(e)||/type\s+\w+\s*=/.test(e)}async loadPackageAtVersionedRoot(e,t){let n=this.cdnClient.packageJson(new j({name:e,version:t})),s=await Xr(n);if(!s?.ok)return;let i;try{i=await s.json()}catch{return}if(i)return{pkg:i,baseDir:this.cdnClient.baseDir(new j({name:e,version:t??i.version})),version:t}}extractPathFromResult(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.find(t=>typeof t=="string")}async tryUntilSuccess(e,t){for(let n of e){let s=await t(n);if(s)return s}}async resolveFromSelected(e,t,n){if(e.kind==="types"){let o=Wt(e.path);if(!o||o==="/"||o===".")return this.tryUntilSuccess([...ms],t);if(!ed.test(o)){let a=await this.tryUntilSuccess(It(o),t);if(a)return a}return t(o)}let s=It(e.path),i=n?.subpath?[...s,...ms]:[...ms,...s];return this.tryUntilSuccess(i,t)}toResolutionResult(e){return{kind:ed.test(e)?"types":"probe",path:e}}resolveExportsPath(e,t){let n=t||".",s=e;try{let i=this.extractPathFromResult(gb(s,n,{conditions:["types"]}));if(i)return i}catch{}try{return this.extractPathFromResult(gb(s,n,{browser:!0,conditions:["import","default","module","browser","node"]}))}catch{return}}async resolve(e){try{let t=j.parse(e),{pkg:n,baseDir:s}=await this.loadPackageAtVersionedRoot(t.name,t.version)||{};if(!n||!s)return;let i={name:t.name,version:t.version},o=new j(i).format(),a=new j({...i,subpath:t.subpath}).format(),c=u=>this.fetchCandidateFrom(s,t.name,u);if(t.subpath){let u=Bl(t.subpath),f=this.resolveExportsPath(n,u);if(f){let h=await this.resolveFromSelected(this.toResolutionResult(f),c,{subpath:!0});if(h)return{...h,resolvedPkg:a}}let p=await this.tryUntilSuccess(It(u),c);if(p)return{...p,resolvedPkg:a}}let l=n.types??n.typings;if(l){let u=await this.resolveFromSelected({kind:"types",path:l},c);if(u)return{...u,resolvedPkg:o}}let d=this.resolveExportsPath(n,".");if(d){let u=await this.resolveFromSelected(this.toResolutionResult(d),c);if(u)return{...u,resolvedPkg:o}}return}catch{return}}async fetchCandidateFrom(e,t,n){let s=Wt(n),i=new URL(s,e).toString(),o=await this.tryUrls([i]);return o?{dts:o.dts,url:o.url,resolvedPkg:t}:void 0}};tt();import{gunzipSync as MO}from"fflate";var ta=class{async fetchAndExtract(e,t){let n=this.getTarballUrl(e,t),s=await Xr(n,{timeoutMs:3e4});if(!s?.ok)return new Map;let i=new Uint8Array(await s.arrayBuffer());return this.extractDtsFiles(i)}getTarballUrl(e,t){return`https://registry.npmjs.org/${e.replace("/","%2F")}/-/${e.split("/").pop()}-${t}.tgz`}normalizeTarPath(e){let t=e.replace(/^package\//,""),n=t.indexOf("/");return n>0?t.substring(n+1):t}extractDtsFiles(e){let t=new Map;try{let n=MO(e),s=new TextDecoder("utf-8"),i=0;for(;i<n.length-512;){let o=n.slice(i,i+512);if(o[0]===0)break;let a=o.slice(0,100),c=a.indexOf(0),l=s.decode(a.slice(0,c>0?c:100)).trim(),d=o.slice(124,136),u=s.decode(d).trim().replace(/\0/g,""),f=parseInt(u,8)||0,p=String.fromCharCode(o[156]);if(i+=512,(p==="0"||p==="\0")&&(l.endsWith(".d.ts")||l.endsWith(".d.mts"))){let h=n.slice(i,i+f);t.set(this.normalizeTarPath(l),s.decode(h))}i+=Math.ceil(f/512)*512}}catch{}return t}};var ra=class{constructor(e,t,n=new ta){this.cdnClient=e,this.cache=t,this.tarballFetcher=n}typesNameCandidates(e){let t=e.startsWith("@")?e.slice(1).replace("/","__"):e;return t.includes(".")?[t,t.split(".").join("-"),t.split(".").join("")]:[t]}selectTypesVersion(e,t,n){try{if(n){let i=Yt.majorOf(n),o=e.filter(a=>Yt.majorOf(a)===i);if(o.length)return o.sort((a,c)=>Yt.cmp(c,a))[0]}let s=t?.latest;return s&&e.includes(s)?s:e[0]}catch{return e[0]}}subpathCandidates(e){let t=e.replace(/\.(mjs|cjs|js|mts|cts|ts)$/i,""),n=It(e);return t!==e&&n.push(`${e}.d.ts`,`${e}/index.d.ts`),n}async fetchFromVersionedRoot(e,t){let n=new j(e),s=n.version;if(!s)return;let i;try{i=await this.tarballFetcher.fetchAndExtract(n.name,s)}catch{return}if(!i||i.size===0)return;for(let[a,c]of i.entries()){let l=this.cdnClient.file(e,a);try{await this.cache.setCachedFile(l,c)}catch{}}let o=t.subpath?this.subpathCandidates(t.subpath):["index.d.ts"];for(let a of o){let c=i.get(a);if(c)return{dts:c,url:this.cdnClient.file(e,a),resolvedPkg:t.subpath?new j(t).format():t.name}}}async resolve(e){let t=j.parse(e);if(t.name)for(let n of this.typesNameCandidates(t.name)){let s=`@types/${n}`,i;try{i=await this.cdnClient.fetchVersionsIndex(s)}catch{continue}if(!i?.versions?.length)continue;let o=this.selectTypesVersion(i.versions,i.distTags,t.version),a=await this.fetchFromVersionedRoot(`${s}@${o}`,t);if(a)return a}}};var na=class{collectRelativeTypeRefs(e){return this.collectRefs(e).filter(t=>t.startsWith("./")||t.startsWith("../"))}collectBareModuleRefs(e){return this.collectRefs(e).filter(t=>this.isBare(t))}collectRefs(e){let t=e.split(`
|
|
1807
1884
|
`).filter(s=>{let i=s.trimStart();return!(i.startsWith("*")||i.startsWith("//")||i.startsWith("/*"))}).join(`
|
|
1808
|
-
`),n=new Set;for(let s of t.matchAll(/(import|export)\s+[^'"\n]*from\s*['"]([^'"\n]+)['"]/g))n.add(s[2]);for(let s of t.matchAll(/export\s*\*\s*from\s*['"]([^'"\n]+)['"]/g))n.add(s[1]);return Array.from(n)}isBare(e){return!(e.startsWith("./")||e.startsWith("../")||e.startsWith("file:")||e.startsWith("http://")||e.startsWith("https://"))}};
|
|
1809
|
-
`);await this.prefetchBareDeps(h,l,f,p,s);let m=c.format(),b=e===m?[e]:[e,m],A=b.some(w=>this.ambientlyDeclares(i,w));return A?this.markFileAmbient(f,d):p.push(...b.map(w=>({module:w,path:d}))),{pkg:e,mainPath:d,files:f,shims:p,ambient:A}}};
|
|
1810
|
-
`,"utf8"),await pe.writeFile(de.join(e,"code.tsx"),r.code,"utf8"),await pe.writeFile(de.join(e,"tb.d.ts"),
|
|
1811
|
-
`,"utf8"),{dir:e}}function
|
|
1812
|
-
`))console.log(`${e} ${n}`);return r.length>0}function
|
|
1885
|
+
`),n=new Set;for(let s of t.matchAll(/(import|export)\s+[^'"\n]*from\s*['"]([^'"\n]+)['"]/g))n.add(s[2]);for(let s of t.matchAll(/export\s*\*\s*from\s*['"]([^'"\n]+)['"]/g))n.add(s[1]);return Array.from(n)}isBare(e){return!(e.startsWith("./")||e.startsWith("../")||e.startsWith("file:")||e.startsWith("http://")||e.startsWith("https://"))}};tt();var yb="file:///node_modules",sa=class{constructor(){this.epoch=0}bumpEpoch(){this.epoch+=1}epochDir(){return`__tsepoch_${this.epoch}`}pathForMain(e){return`${yb}/${this.epochDir()}/${e}/index.d.ts`}pathFor(e,t){let n=Wt(t);return`${yb}/${this.epochDir()}/${e}/${n}`}};import{LRUCache as BO}from"lru-cache";function bb(r){let e=new BO({ttl:at.negativeTtlMs,max:500}),t=new Map;return async function(s){try{if(await r.isNegative(s)||e.has(s))return;let i=await r.getCachedFile(s);if(i)return{dts:i,url:s};let o=t.get(s);if(o)return o;let a=(async()=>{let c=await Xr(s,{init:{cache:"no-store"}});if(!c?.ok){c?.status===404&&(e.set(s,!0),await r.recordNegative(s));return}let l=await c.text(),d=c.url||s;return await r.clearNegative(s),await r.setCachedFile(d,l),{dts:l,url:d}})();return t.set(s,a),await a.finally(()=>t.delete(s))}catch{return}}}var hs=class{constructor(e){this.inFlight=new Map,this.scanner=new na,this.cache=e.cache,this.cdnClient=e.cdnClient,this.versionResolver=e.versionResolver,this.packageService=e.packageService,this.fetchDts=bb(e.cache),this.typescriptProvider=new ea(this.fetchDts,e.cdnClient),this.definitelyTypedProvider=new ra(e.cdnClient,e.cache),this.virtualFs=new sa}withInFlight(e,t){let n=this.inFlight.get(e);if(n)return n;let s=t().finally(()=>this.inFlight.delete(e));return this.inFlight.set(e,s),s}invalidate(){this.virtualFs.bumpEpoch(),this.inFlight.clear()}pushFileIfNew(e,t,n){e.some(s=>s.path===t)||e.push({path:t,content:n})}createStubDef(e){let t=this.virtualFs.pathForMain(e);return{pkg:e,mainPath:t,files:[{path:t,content:"export const _shim: any; export default _shim;"}],shims:[{module:e,path:t}]}}async fetchViaProviders(e){for(let t of[this.typescriptProvider,this.definitelyTypedProvider])try{let n=await t.resolve(e);if(n?.dts)return n}catch{}}async fetchRootDts(e,t){let{effectivePackage:n,root:s,pinned:i}=await this.versionResolver.effectivePackage(e,t),o=await this.cache.getCachedDts(n);if(o?.content){let c=o.url??this.cdnClient.file(i?`${s}@${i}`:s,"index.d.ts");return{dts:o.content,url:c,resolvedPkg:n}}let a;try{a=await this.fetchViaProviders(n)}catch{return}if(!(!a?.dts||!a.url)&&new j(n).subpath===new j(a.resolvedPkg||n).subpath){try{await this.cache.setCachedDts(n,a.dts,a.url)}catch{}return a}}extractPackageRootUrl(e){let t=e.pathname.match(/^(.+@[^/]+\/)/);return t?new URL(t[1],e.origin):new URL("./",e)}toVirtualPath(e,t,n){let s=t.pathname.startsWith(e.pathname)?t.pathname.slice(e.pathname.length):`__deps__/${encodeURIComponent(t.toString()).replace(/%/g,"_")}.d.ts`;return this.virtualFs.pathFor(n,s)}computeEntryPath(e,t){if(!e)return{mainPath:this.virtualFs.pathForMain(t),packageRootUrl:void 0};let n=new URL(e),s=this.extractPackageRootUrl(n);return{mainPath:this.toVirtualPath(s,n,t),packageRootUrl:s}}async expandRelativeRefs(e,t,n,s,i=new Set,o){if(!i.has(t)&&(i.add(t),!(i.size>at.maxRelativeTypeRefs)))try{let a=new URL(t),c=new URL("./",a);o??(o=this.extractPackageRootUrl(a));let l=this.scanner.collectRelativeTypeRefs(e).slice(0,at.maxRelativeTypeRefs);for(let d of l)await this.tryRelativeRef(d,c,o,n,s,i)}catch{}}async tryRelativeRef(e,t,n,s,i,o){try{let a=new URL(e,t),c=a.pathname+a.search,l=Zo(c)?[c]:It(c);for(let d of l){let f=new URL(d,a).toString();if(o.has(f))return;let p=await this.fetchDts(f);if(p?.dts){let h=this.toVirtualPath(n,new URL(p.url),s);this.pushFileIfNew(i,h,p.dts),await this.expandRelativeRefs(p.dts,p.url,s,i,o,n);return}}}catch{}}isDifferentPackage(e,t){return e===t?!1:new j(e).name!==new j(t).name}ambientlyDeclares(e,t){if(/^(?:import|export)\b/m.test(e))return!1;for(let n of e.matchAll(/declare\s+module\s+['"]([^'"]+)['"]/g)){let s=n[1];if(s===t||s.endsWith("/*")&&t.startsWith(s.slice(0,-1)))return!0}return!1}markFileAmbient(e,t){let n=e.find(s=>s.path===t);n&&(n.ambient=!0)}async prefetchBareDeps(e,t,n,s,i){try{let o=this.scanner.collectBareModuleRefs(e).slice(0,at.maxBareDeps).filter(l=>this.isDifferentPackage(l,t));if(!o.length)return;let a=new Set([t]),c=DO(at.prefetchConcurrency);await Promise.all(o.map(l=>c(()=>this.prefetchBareDepsRecursive(l,n,s,at.maxBareDepth,a,i).catch(()=>{}))))}catch{}}async prefetchBareDepsRecursive(e,t,n,s,i,o){if(s<=0||i.has(e))return;i.add(e);let a=await this.fetchRootDts(e,o);if(!a?.dts)return;let c=a.resolvedPkg||e,l=this.virtualFs.pathForMain(c);this.pushFileIfNew(t,l,a.dts),this.ambientlyDeclares(a.dts,e)?this.markFileAmbient(t,l):n.push({module:e,path:l}),a.url&&await this.expandRelativeRefs(a.dts,a.url,c,t);let d=this.scanner.collectBareModuleRefs(a.dts).slice(0,at.maxBareDeps).filter(u=>!i.has(u));for(let u of d)await this.prefetchBareDepsRecursive(u,t,n,s-1,i,o)}async resolve(e,t,n){let s=await this.packageService.extractImports(e),i=n?[...s,...n]:s;return(await Promise.all(i.map(a=>this.resolveOne(a,t)))).filter(a=>!!a)}async resolveOne(e,t){let{effectivePackage:n}=await this.versionResolver.effectivePackage(e,t);return this.withInFlight(n,async()=>{let s=new j(e),i=await this.fetchRootDts(e,t)??(s.subpath?await this.fetchRootDts(s.name,t):void 0);return i?this.buildDefFromContent(e,i,i.resolvedPkg||e,t):this.createStubDef(e)})}async buildDefFromContent(e,t,n,s){let{dts:i,url:o,resolvedPkg:a}=t,c=new j(a||n),l=c.version?`${c.name}@${c.version}`:c.name,{mainPath:d,packageRootUrl:u}=this.computeEntryPath(o,l),f=[{path:d,content:i}],p=[];o&&await this.expandRelativeRefs(i,o,l,f,void 0,u);let h=f.map(w=>w.content).join(`
|
|
1886
|
+
`);await this.prefetchBareDeps(h,l,f,p,s);let m=c.format(),b=e===m?[e]:[e,m],A=b.some(w=>this.ambientlyDeclares(i,w));return A?this.markFileAmbient(f,d):p.push(...b.map(w=>({module:w,path:d}))),{pkg:e,mainPath:d,files:f,shims:p,ambient:A}}};Yl();tt();Cr();Xn();Hl();Or();import*as Qr from"path";var jO=Qr.join(Wi,"pkg"),FO=Qr.join(Wi,"files"),qO=Qr.join(Wi,"negative.json"),oa=class{pkgMem=new Map;fileMem=new Map;negativeCache=new Vt(new Rr(qO));async getCachedDts(e){if(this.pkgMem.has(e))return this.pkgMem.get(e);await Z();let t=await rt(wb(e));return this.pkgMem.set(e,t),t}async setCachedDts(e,t,n){let s={content:t,url:n};this.pkgMem.set(e,s),await ia(async()=>{await Z(),await Ee(wb(e),JSON.stringify(s))})}async getCachedFile(e){if(this.fileMem.has(e))return this.fileMem.get(e);await Z();let t=await Hi(vb(e));return this.fileMem.set(e,t),t}async setCachedFile(e,t){this.fileMem.set(e,t),await ia(async()=>{await Z(),await Ee(vb(e),t)})}isNegative(e){return this.negativeCache.isNegative(e)}async recordNegative(e){await ia(async()=>{await Z(),await this.negativeCache.recordNegative(e)})}clearNegative(e){return ia(()=>this.negativeCache.clearNegative(e))}};async function ia(r){try{await r()}catch{}}function wb(r){return Qr.join(jO,Le(r)+".json")}function vb(r){return Qr.join(FO,Le(r)+".txt")}Cr();var td;function UO(){return td||(td=new hs({cache:new oa,cdnClient:qh,packageService:Gi,versionResolver:Fh})),td}var Sb="file:///node_modules/";async function kb(r){let e=Yi(r.emitKey,"typecheck");await Z(),await pe.rm(e,{recursive:!0,force:!0}),await pe.mkdir(e,{recursive:!0});let t=WO(r.jsxImportSource,r.dependencies),n=await UO().resolve(r.code,r.dependencies,t),s=r.local?.name,i=s?n.filter(d=>d.pkg!==s):n,o=new Set;for(let d of i)for(let u of d.files){let f=aa(u.path);if(!f||o.has(f))continue;o.add(f);let p=de.join(e,"node_modules",f);await pe.mkdir(de.dirname(p),{recursive:!0}),await pe.writeFile(p,u.content,"utf8")}let a={};for(let d of i)for(let u of d.shims){let f=aa(u.path);f&&(a[u.module]=[`./node_modules/${f}`])}for(let d of i){if(d.ambient)continue;let u=aa(d.mainPath);u&&(a[d.pkg]=[`./node_modules/${u}`])}let c=new Set;for(let d of i)for(let u of d.files){if(!u.ambient)continue;let f=aa(u.path);f&&c.add(`node_modules/${f}`)}if(r.local){delete a[r.local.name];let d=await YO(r.local,e);d?a[r.local.name]=[`./node_modules/${r.local.name}/${d}`]:console.warn(` local: '${r.local.name}' ships no type defs; check cannot type against it.`)}let l=JO(r.jsxImportSource,a,[...c]);return await pe.writeFile(de.join(e,"tsconfig.json"),JSON.stringify(l,null,2)+`
|
|
1887
|
+
`,"utf8"),await pe.writeFile(de.join(e,"code.tsx"),r.code,"utf8"),await pe.writeFile(de.join(e,"tb.d.ts"),Qu,"utf8"),{dir:e}}var rd={target:"es2023",module:"esnext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0};function JO(r,e,t=[]){return{compilerOptions:{...rd,lib:KO([...zu,...Gu]),jsx:"react-jsx",jsxImportSource:r??"react",paths:e},include:["code.tsx","tb.d.ts",...t]}}function KO(r){return Xu(r).map(e=>HO(e.name))}function HO(r){return r.split(".").map(e=>/^es\d+$/i.test(e)?e.toUpperCase():e==="dom"?"DOM":e==="esnext"?"ESNext":e.charAt(0).toUpperCase()+e.slice(1)).join(".")}function WO(r,e){let t=r??("react"in e?"react":void 0);return t?[`${t}/jsx-runtime`,`${t}/jsx-dev-runtime`]:[]}function aa(r){if(!r.startsWith(Sb))return;let e=r.slice(Sb.length),t=e.indexOf("/");if(!(t<0))return e.slice(t+1)}async function YO(r,e){if(!r.typesAbs)return;let t=de.dirname(r.typesAbs),n=de.join(e,"node_modules",r.name);for(let s of await VO(t)){let i=de.join(n,de.relative(t,s));await pe.mkdir(de.dirname(i),{recursive:!0}),await pe.copyFile(s,i)}return de.basename(r.typesAbs)}async function VO(r){let e=[];async function t(n){let s=await pe.readdir(n,{withFileTypes:!0});for(let i of s){let o=de.join(n,i.name);i.isDirectory()?await t(o):/\.d\.ts(\.map)?$/.test(i.name)&&e.push(o)}}return await t(r),e}import*as Pe from"fs/promises";import*as ct from"path";import{existsSync as zO}from"fs";Cr();Vl();var GO="^22";async function xb(r){let e=Yi(r.emitKey,"typecheck-server");await Z(),await Pe.rm(e,{recursive:!0,force:!0}),await Pe.mkdir(e,{recursive:!0});let t=ct.join(r.bulbDir,".typebulb"),n=so(r.server).filter(o=>o!==r.local?.name);await no([`@types/node@${GO}`,...n],t,r.dependencies,{ignoreScripts:!0});let s=ct.join(t,"node_modules"),i=ct.join(e,"node_modules");return await QO(s,i),await Pe.writeFile(ct.join(e,"server.ts"),r.server,"utf8"),await Pe.writeFile(ct.join(e,"tb.d.ts"),Zu,"utf8"),await Pe.writeFile(ct.join(e,"tsconfig.json"),JSON.stringify(XO(r.local),null,2)+`
|
|
1888
|
+
`,"utf8"),{dir:e}}function XO(r){let e={...rd,lib:["ES2023"],types:["node"]};if(r?.typesAbs){let t=i=>i.replace(/\\/g,"/"),n=t(ct.dirname(r.typesAbs)),s=t(r.typesAbs).replace(/\.d\.ts$/,"");e.paths={[r.name]:[s],[`${r.name}/*`]:[`${n}/*`]}}return{compilerOptions:e,include:["server.ts","tb.d.ts"]}}async function QO(r,e){if(!zO(r)){await Pe.mkdir(e,{recursive:!0});return}await Pe.rm(e,{recursive:!0,force:!0});let t=process.platform==="win32"?"junction":"dir";await Pe.symlink(r,e,t)}qi();le();async function Ab(r,e){let{bulb:t,config:n,warnings:s,starts:i}=await je(r),o=Oe.basename(r),a=m=>i.get(m)??1;!t.code&&!t.server&&(console.error("Bulb has neither **code.tsx** nor **server.ts**; nothing to check."),process.exit(1));let c=!1,l=!1;for(let m of s)console.log(`structure ${m}`);s.length&&(c=!0);let d=jr(Oe.resolve(r)),u=d?vr(t.name):"";d&&u&&u!==d.slug&&(console.log(`naming filename '${d.slug}.bulb.md' doesn't match the title '${t.name}' \u2014 its slug derives to '${u}'. Rename the file to '${u}.bulb.md', or change name: to suit the filename.`),l=!0),t.code&&(c=Eb(qn(t.code,{target:"client",dependencies:n.dependencies??{},lineOffset:a("code.tsx")}),"client")||c),t.server&&(c=Eb(qn(t.server,{target:"server",lineOffset:a("server.ts")}),"server")||c);let f=oC([process.cwd(),Oe.dirname(r)]);if(!f){let m=Oe.relative(process.cwd(),r)||r;console.error("check: TypeScript not found \u2014 install it once, then re-run:"),console.error(" npm i -g typescript"),console.error(` typebulb check ${m}`),process.exit(2)}let p=[];if(t.code){let{dir:m}=await kb({code:t.code,dependencies:n.dependencies??{},jsxImportSource:n.ts?.jsxImportSource,emitKey:r,local:e});p.push({role:"client",dir:m})}if(t.server){let{dir:m}=await xb({server:t.server,bulbDir:Oe.dirname(r),emitKey:r,local:e?{name:e.name,typesAbs:e.typesAbs}:void 0,dependencies:n.dependencies});p.push({role:"server",dir:m})}for(let{role:m,dir:b}of p){let{stdout:A,exitCode:w}=await sC(f,b);for(let P of A.split(/\r?\n/))P.trim()&&console.log(`${m} ${nC(P,o,a)}`);w!==0&&(c=!0)}c&&process.exit(1);let h=[t.code&&"code.tsx",t.server&&"server.ts"].filter(Boolean).join(", ");console.error(l?`\u2713 type-checks (${h}) \u2014 see the naming warning above`:`\u2713 no issues (${h})`)}function Eb(r,e){for(let t of r)for(let n of t.message.split(`
|
|
1889
|
+
`))console.log(`${e} ${n}`);return r.length>0}function nC(r,e,t){return r.replace(/\b(code\.tsx|server\.ts)\((\d+),(\d+)\)/g,(n,s,i,o)=>`${e}(${Number(i)+t(s)-1},${o})`)}function sC(r,e){return new Promise(t=>{let n=ZO(process.execPath,[r,"--noEmit"],{cwd:e}),s="";n.stdout?.on("data",i=>{s+=i.toString()}),n.stderr?.on("data",i=>{s+=i.toString()}),n.on("close",i=>t({stdout:s,exitCode:i??1}))})}var iC=tC(import.meta.url);function oC(r){let e=n=>{try{let s=iC.resolve("typescript/package.json",{paths:n}),i=Oe.join(Oe.dirname(s),"lib","tsc.js");return rC(i)?i:void 0}catch{return}},t=e(r);if(t)return t;try{let n=eC("npm root -g",{encoding:"utf8"}).trim();return e([n])}catch{return}}He();Eo();ss();async function Tb(r,e){let{bulb:t}=await je(r),n=qr(t);if(er(r)){console.log("remembered-trusted \u2014 runs with filesystem / AI / server.ts automatically (`typebulb untrust` to revoke)."),n&&console.log(` (it uses ${n})`);return}n?(console.log(`This bulb appears to use ${n}; it runs Restricted unless you grant trust:`),console.log(` ${e}`)):console.log("No privileged capability detected \u2014 runs Restricted by default. (A clean scan is a hint, not a guarantee.)")}ss();import*as gs from"path";async function Pb(r,e){if(!r){e||(console.error("Usage: typebulb untrust <file.bulb.md>"),process.exit(1));let n=vu();if(!n.length){console.log("No bulbs are remembered as trusted.");return}console.log("Trusted bulbs (run with fs/AI/server.ts without --trust):");for(let s of n)console.log(` ${s}`);return}let t=gs.resolve(r);t.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),Ur(t,e),console.log(e?`Trusted ${gs.basename(t)} \u2014 runs with fs / AI / server.ts (no --trust needed).`:`Untrusted ${gs.basename(t)} \u2014 runs Restricted.`),console.log(` ${t}`)}$e();import*as Cb from"readline";Su();function nd(r){let e=t=>n=>r?`\x1B[${t}m${n}\x1B[0m`:n;return{lit:e("38;5;70"),litLink:e("4;38;5;70"),brand:e("38;5;135")}}async function Rb(r){let e=sb(process.cwd());if("ambiguous"in e){let t=await aC(r,e.ambiguous);return t?Ob(r,t):cC(r,e.ambiguous)}return Ob(r,e.name)}async function Ob(r,e){let t,n;try{t=await hh(e)}catch(d){n=d instanceof Error?d.message:String(d)}let{lit:s,litLink:i,brand:o}=nd(process.stdout.isTTY===!0),a=[" Read the authoring skill before writing a bulb:",` \u2022 ${s(is())}`],c=t?[` Agent mirror (${e}) is live\u{1F4A1}`,` ${s("\u25CF")} ${i(t.url)}`," Embedded bulbs render live here."," Agents:",` Reusable app/tool \u2192 write a ${s(".bulb.md")}`," Show something inline \u2192 embed a bulb",e==="pi"?" arm a wait for its render verdict \u2014 run it plainly:":" background a wait for its render verdict:",` \u2022 ${s('typebulb wait agent --match "[embed <name>"')}`,...a," End your reply with the mirror link above"," \u2022 easy to miss the link mid-message"]:[` The mirror did not start (${n})`,` \u25CF Start it manually: ${s(`npx typebulb agent:${e}`)}`," Agents:",...a],l=[` ${o(`typebulb v${r}`)}`,...c,""];process.stdout.write(l.join(`
|
|
1813
1890
|
`)+`
|
|
1814
|
-
`)}async function
|
|
1891
|
+
`)}async function aC(r,e){if(!process.stdin.isTTY||!process.stdout.isTTY)return;let{lit:t,brand:n}=nd(!0),s=[` ${n(`typebulb v${r}`)}`," More than one agent harness is available here.",...e.map((o,a)=>` ${t(String(a+1))}) ${o}`),""];process.stdout.write(s.join(`
|
|
1815
1892
|
`)+`
|
|
1816
|
-
`);let i=
|
|
1893
|
+
`);let i=Cb.createInterface({input:process.stdin,output:process.stdout});try{let o=(await new Promise(c=>i.question(" Open which? [1]: ",c))).trim();if(o==="")return e[0];let a=Number(o);return Number.isInteger(a)&&a>=1&&a<=e.length?e[a-1]:e.find(c=>c===o.toLowerCase())}finally{i.close()}}function cC(r,e){let{lit:t,brand:n}=nd(process.stdout.isTTY===!0),s=[` ${n(`typebulb v${r}`)}`," More than one agent harness is available here."," Open the mirror for the one you want:",...e.map(i=>` \u2022 ${t(`npx typebulb agent:${i}`)}`),""];process.stdout.write(s.join(`
|
|
1817
1894
|
`)+`
|
|
1818
|
-
`)}
|
|
1819
|
-
`+e)}function
|
|
1895
|
+
`)}Ct();Qt();async function _b(r){Ae(r);let e=await st();if(e.length>0){console.log(rg(e,process.env.TB_AI_PROVIDER,process.env.TB_AI_MODEL));return}if(!lu()){console.log("No AI provider keys found in this directory's .env, and no local Ollama server detected."),console.log("Set one of these to use a cloud model with tb.ai:");for(let[t,n]of Object.entries(Lr))console.log(` ${n.padEnd(20)} (${t})`);console.log("\u2026or start Ollama (http://localhost:11434, or set OLLAMA_HOST) for local models. Then re-run `typebulb models`.");return}console.log("Couldn't fetch the model catalog (offline?). tb.ai still works with any valid provider/model id for your keys.")}le();function Nb(r){r?.trim()||(console.error("Usage: typebulb slug <bulb name>"),process.exit(1));let e=vr(r);e||(console.error(`'${r}' has no slug \u2014 a bulb name needs at least one letter or digit.`),process.exit(1)),console.log(e)}xr();import*as $b from"path";import{valid as Ib,lt as lC}from"semver";$e();$i();function uC(r,e,t,n){if(/^\d+$/.test(e))return r.find(i=>i.pid===parseInt(e,10));let s=e==="agent"?r.filter(i=>i.agent!=null):r.filter(i=>i.agent===e);if(s.length){if(!t)return s[0];let i=s.filter(o=>o.cwd&&X(o.cwd)===X(t));return n&&i.find(o=>o.agent===n)||i[0]}return r.find(i=>X(i.file)===X(e))}var ys=r=>r.agent??$b.basename(r.file);function dC(r){return r===Ie?"":r?(Ib(r)&&Ib(Ie)?lC(r,Ie):!0)?` STALE runtime v${r} (this CLI is v${Ie} \u2014 relaunch to update)`:` runtime v${r} (newer than this CLI's v${Ie})`:" STALE runtime (predates the version stamp \u2014 relaunch to update)"}function Lb(r,e){for(let t of r)e(` ${t.url} pid ${t.pid} ${t.trust?"trusted":"restricted"}${t.batch?` --batch ${t.batch}`:""}${dC(t.version)} ${t.file}`)}function sd(r,e){if(!r.length){console.log("No running bulb servers.");return}console.log("Running bulb servers:"),Lb(r,t=>console.log(t)),console.log(`
|
|
1896
|
+
`+e)}function id(r,e,t,n,s){let i=uC(r,e,n,s);if(i)return i;console.error(`No running server for '${e}'.`),r.length?(console.error(`Running servers (try \`typebulb ${t} <file|pid>\`):`),Lb(r,o=>console.error(o))):console.error("No bulb servers are running."),process.exit(1)}async function Mb(r,e){if(!r){e.clear&&(console.error("Specify which server to clear: typebulb logs --clear <file|pid>"),process.exit(1)),sd(await Q(process.cwd()),"Run `typebulb logs <file|pid>` to print one server's console.");return}let t=id(await Q(),r,"logs",process.cwd(),or());if(e.clear){lh(t.pid),console.log(`Cleared log for ${ys(t)} (pid ${t.pid}).`);return}let n=Ke(t.pid),s=n.text;if(e.run!==void 0?(s=uh(s,e.run),s||console.error(e.run==="latest"?"No output in the latest run yet (the server has logged nothing since its last reload).":`No output for run ${e.run} (it hasn't started, or was trimmed from the log).`)):!s&&!e.follow&&console.error("Log is empty \u2014 this server has logged nothing yet."),e.lines&&e.lines>0){let i=s.split(`
|
|
1820
1897
|
`);i.length&&i[i.length-1]===""&&i.pop(),s=i.slice(-e.lines).join(`
|
|
1821
1898
|
`)}if(process.stdout.write(s),s&&!s.endsWith(`
|
|
1822
1899
|
`)&&process.stdout.write(`
|
|
1823
|
-
`),e.follow&&e.run===void 0){let i=n.offset,o=setInterval(()=>{let c=
|
|
1824
|
-
`);m=w.pop()??"";for(let
|
|
1900
|
+
`),e.follow&&e.run===void 0){let i=n.offset,o=setInterval(()=>{let c=Ke(t.pid,i);i=c.offset,c.text&&process.stdout.write(c.text)},500),a=()=>{clearInterval(o),process.exit(0)};process.on("SIGINT",a),process.on("SIGTERM",a),await new Promise(()=>{})}}var fC=r=>new Promise(e=>setTimeout(e,r));async function Bb(r,e){if(!r){sd(await Q(process.cwd()),"Run `typebulb wait <file|pid>` to block until one logs a new line.");return}let t=id(await Q(),r,"wait",process.cwd(),or()),n=t.agent!=null,i=process.env.TYPEBULB_WAIT_SHIM==="1",o=e.timeoutSec??1800,a=e.match??"",c=Ke(t.pid).offset,l=Pl(t.pid,a)??(a?Pl(t.pid):void 0),d=l!==void 0&&l<=c?l:a?0:c,u=Date.now()+o*1e3,f=n?1e4:1e3,p=2e3,h,m="",b=0;for(;;){let A=Ke(t.pid,d);if(d=A.offset,A.text){m+=A.text;let w=m.split(`
|
|
1901
|
+
`);m=w.pop()??"";for(let P of w)P.trim()&&(e.match&&!P.includes(e.match)||(console.log(P),h??=Date.now()+f,n&&(P.includes("] compile error")||P.includes("] runtime error"))&&(h=Math.min(h,Date.now()+p))))}if(h&&Date.now()>=h)break;if(!i&&!h&&Date.now()>=u){console.error(`timeout: no ${e.match?`line matching '${e.match}'`:"new output"} from ${ys(t)} within ${o}s`),b=2;break}if(!Cl(t.pid)){h||(console.error(`server ${ys(t)} (pid ${t.pid}) exited while waiting`),process.exit(3));break}await fC(400)}Mi(t.pid,d,a),process.exit(b)}async function Db(r){if(!r){sd(await Q(process.cwd()),"Run `typebulb stop <file|pid>` to stop one.");return}let e=id(await Q(),r,"stop",process.cwd(),or());await Jt(e.pid),console.log(`Stopped ${ys(e)} (pid ${e.pid}, ${e.url}).`)}async function jb(r){let e=process.cwd(),t=r==="agent"?or():void 0,n=r==="global"?await Q():r==="bulbs"?await Q(e):(await Q()).filter(i=>i.agent!=null&&i.cwd!=null&&X(i.cwd)===X(e)&&(!t||i.agent===t)),s=r==="global"?"server":r==="agent"?"mirror":"bulb";if(!n.length){console.log(r==="global"?"No running bulb servers.":`No running ${s}s for this project.`);return}await Promise.all(n.map(i=>Jt(i.pid))),console.log(`Stopped ${n.length} ${s}${n.length===1?"":"s"}:`);for(let i of n)console.log(` ${i.url} pid ${i.pid} ${ys(i)}`)}$e();xr();Fr();import*as ca from"path";import*as Fb from"http";import{mkdir as pC,writeFile as mC}from"fs/promises";function hC(r,e){return new Promise((t,n)=>{let s=new URL(r),i=Fb.request({hostname:s.hostname,port:s.port,path:s.pathname+s.search,method:"POST",headers:{"Content-Type":"text/plain","Content-Length":Buffer.byteLength(e)}},o=>{let a="";o.setEncoding("utf8"),o.on("data",c=>{a+=c}),o.on("end",()=>t({status:o.statusCode??0,text:a}))});i.setTimeout(0),i.on("error",n),i.end(e)})}var gC=r=>{let e=Math.round((Date.now()-r)/6e4);return e<1?"moments ago":e<60?`${e}m ago`:`${Math.round(e/60)}h ago`};async function qb(r,e,t=0){let n=e!==void 0&&e.startsWith("tb:");n&&t<=0&&(t=Vu);let s=e!==void 0&&/^tb:(click|set)( |$)/.test(e),i=ca.resolve(r),o=Er(await Q(),i)[0];if(!o){let p=(await ns(process.cwd()))(i);console.error(p?`No running server for '${r}' \u2014 it last ran ${gC(p)}. Relaunching reuses the same URL (a stale tab is one reload from live): npx typebulb ${r}`:`No running server for '${r}'. Start it first: npx typebulb ${r}`),process.exit(1)}let a=async p=>{let h=[p>0?`reply=${p}`:"",s?"solo=1":""].filter(Boolean).join("&"),m=await hC(`${o.url}/__send${h?`?${h}`:""}`,e??"");(m.status<200||m.status>=300)&&(console.error(`send failed: HTTP ${m.status} from ${o.url}/__send`),process.exit(1));try{return JSON.parse(m.text)}catch{return{}}},c={};try{let p=Date.now()+t;do{if(c=await a(t>0?Math.max(p-Date.now(),1e3):0),(c.clients??0)>0||Date.now()>=p)break;await new Promise(h=>setTimeout(h,150))}while(!0)}catch(p){console.error(`send failed: ${p instanceof Error?p.message:String(p)}`),process.exit(1)}let l=c.clients??0,d=`${l} page${l===1?"":"s"}`;if(c.refused&&(console.error(`Actuation needs exactly one connected page; ${d} are open on ${o.url} \u2014 close the extras and retry.`),process.exit(1)),l===0){let p=c.droppedMsAgo,h=p!==void 0?` \u2014 a page disconnected ${Math.round(p/1e3)}s ago and hasn't reconnected; reload it, or open ${o.url}`:` \u2014 no page has ever connected; share ${o.url} and arm: typebulb wait ${r} --match "[page] connected"`;t>0?console.error(`No page connected after ${t/1e3}s${h}`):console.error(`Sent, but no page is connected${h}`),n&&process.exit(1);return}console.error(`Sent to ${d}.`);let u=c.results??[],f=c.errors??[];for(let p of f)console.error(`handler error: ${p}`);if(f.length&&process.exit(1),u.length>1&&(console.error(`${u.length} replies from ${d} \u2014 one reply owns stdout: at most one tb.onMessage handler, in one page, may return a value.`),process.exit(1)),u.length===1){if(e!==void 0&&/^tb:png( |$)/.test(e)){let h={};try{h=JSON.parse(u[0])}catch{}typeof h.png!="string"&&(console.error("tb:png replied with an unexpected shape \u2014 an older runtime? (`typebulb logs` lists server versions)"),process.exit(1));let m=th(i);await pC(ca.dirname(m),{recursive:!0}),await mC(m,Buffer.from(h.png,"base64")),console.error(`canvas ${h.width}\xD7${h.height} \u2192 PNG`),console.log(m);return}let p;try{p=JSON.parse(u[0])}catch{p=void 0}console.log(typeof p=="string"?p:u[0])}else c.timedOut&&(n&&(console.error(`No reply to '${e}' within ${t/1e3}s \u2014 reload the page and retry.`),process.exit(1)),console.error(`(no reply within ${t/1e3}s \u2014 slow work needs a larger --wait=ms; a reply that NEVER comes is a done-promise that missed an exit)`))}Ro();Pu();le();import*as Ub from"fs/promises";async function Jb(r,e){let t=await Ub.readFile(r,"utf-8"),n=ue(t);n||(console.error(`Not a valid bulb: ${r}`),process.exit(1));let s=ae[e].path,i=n.files.get(s);i||(console.error(i===void 0?`No **${s}** block in ${r}`:`The **${s}** block in ${r} is empty`),process.exit(2)),process.stdout.write(i.endsWith(`
|
|
1825
1902
|
`)?i:i+`
|
|
1826
|
-
`)}le();import*as
|
|
1827
|
-
`).trimEnd()}function
|
|
1903
|
+
`)}le();import*as bs from"fs/promises";async function Wb(r,e){let t=await bs.readFile(r,"utf-8"),n=[];for(let{kind:i,source:o}of e){let a;try{a=o==="-"?await bC():await bs.readFile(o,"utf-8")}catch(c){Hb(`Cannot read ${i}'s source: ${c instanceof Error?c.message:String(c)}`)}n.push({kind:i,content:Yb(a),label:o==="-"?"stdin":o})}let s;try{s=yC(t,n)}catch(i){Hb(`${r}: ${i instanceof Error?i.message:String(i)}`)}for(let i of s.upToDate)console.log(`${ae[i].path}: already up to date`);if(s.written.length){await bs.writeFile(r,s.text);for(let i of s.written)console.log(i.action==="removed"?`${ae[i.kind].path}: removed (${i.label} is empty)`:`${ae[i.kind].path}: ${i.action} from ${i.label} (${i.chars.toLocaleString()} chars)`)}}function yC(r,e){let t=ue(r);if(!t)throw new Error("not a valid bulb");let n=r,s=[],i=[];for(let{kind:o,content:a,label:c}of e){let l=ae[o].path,d=t.files.get(l);if(!a){if(d===void 0){i.push(o);continue}n=Kb($d(n,o),n,l),s.push({kind:o,action:"removed",chars:0,label:c});continue}if(d!==void 0&&Yb(d)===a){i.push(o);continue}n=Kb(Zr(n,o,a),n,l),s.push({kind:o,action:d===void 0?"created":"replaced",chars:a.length,label:c})}return{text:n,written:s,upToDate:i}}function Yb(r){return(r.charCodeAt(0)===65279?r.slice(1):r).replace(/\r\n/g,`
|
|
1904
|
+
`).trimEnd()}function Kb(r,e,t){if(r===e)throw new Error(`the **${t}** block's fence is unterminated; refusing to rewrite inside it`);return r}function Hb(r){console.error(r),process.exit(1)}async function bC(){let r=[];for await(let e of process.stdin)r.push(e);return Buffer.concat(r).toString("utf-8")}Ct();He();le();Eo();import*as Lt from"fs/promises";import*as ha from"path";import{EventEmitter as Zb}from"events";import LC from"open";$r();le();import{Hono as EC}from"hono";import{serve as AC}from"@hono/node-server";import{streamSSE as TC}from"hono/streaming";import*as ld from"fs/promises";Cr();Xn();Or();import*as od from"fs/promises";import*as ws from"path";var la=class{async get(e){let t=Le(e),n=ws.join(Gn,t+".bin"),s=ws.join(Gn,t+".json");try{let[i,o]=await Promise.all([od.readFile(n),od.readFile(s,"utf8")]),a=JSON.parse(o);return{body:i,contentType:a.contentType,cacheControl:a.cacheControl}}catch{return}}async set(e,t){await Z();let n=Le(e),s=ws.join(Gn,n+".bin"),i=ws.join(Gn,n+".json"),o={url:e,contentType:t.contentType,cacheControl:t.cacheControl};await Promise.all([Ee(s,t.body),Ee(i,JSON.stringify(o))])}};var Vb=`
|
|
1828
1905
|
const CSS = '\\n' +
|
|
1829
1906
|
/* The agent mirror's token set, verbatim (agents/core/client/styles.css) \u2014 one system across CLI
|
|
1830
1907
|
chrome: app chrome sits on --panel, content wells paint --veil, grays ride one neutral tint.
|
|
@@ -2128,18 +2205,18 @@ export function runInference(ctx) {
|
|
|
2128
2205
|
showConfirm();
|
|
2129
2206
|
document.body.appendChild(host);
|
|
2130
2207
|
}
|
|
2131
|
-
|
|
2132
|
-
${f}`:"";return y.text(`Forbidden: this capability requires --trust.${B}`,403)}await x()},C=async(y,x)=>{let N=y.req.header("sec-fetch-site");if(N){if(N!=="same-origin")return y.text(`Forbidden: ${N} request`,403)}else{let L=y.req.header("origin");if(L&&!
|
|
2133
|
-
`+te.slice(-4e3)),new we("LLM output is not valid JSON","parse_error",!0);ie.fixesApplied.length&&console.warn("[tb.infer] sanitized output, fixes applied:",ie.fixesApplied.join(", "));let Se={insight:ie.parsed,insightJson:ie.json,data:B};yield{kind:"complete",...Se,fixesApplied:ie.fixesApplied,hash:
|
|
2208
|
+
`;$e();Qt();mo();$r();import{stream as wC}from"hono/streaming";var vC="X-TB-Stream";function vs(r){return r instanceof we?{message:r.message,code:r.code,retryable:r.retryable}:{message:r instanceof Error?r.message:"Unknown error",code:"unknown",retryable:!1}}function ua(r,e){return r.header("Content-Type","application/x-ndjson; charset=utf-8"),r.header("Cache-Control","no-cache"),r.header(vC,"1"),wC(r,async t=>{let n=e[Symbol.asyncIterator]();t.onAbort(()=>{n.return?.()});try{for(;;){let{done:s,value:i}=await n.next();if(s)break;await t.writeln(JSON.stringify({type:"chunk",value:i}))}}catch(s){await t.writeln(JSON.stringify({type:"error",error:vs(s)}))}finally{try{await n.return?.()}catch{}}})}var da={log:(...r)=>console.log(...r)};function fa(r,e){let t=r?.[e]??(Object.hasOwn(da,e)?da[e]:void 0);return typeof t=="function"?t:void 0}function pa(r){return r.constructor?.name==="AsyncGeneratorFunction"}uu();var SC=/^\/(v\d+\/|stable\/|node\/|gh\/|@[^/]+\/[^@/]+@|[^@/]+@)/,kC=/[?&]target=/,xC=/^\/(?:@[^/]+\/)?[^/@]+\/[^/]+/;function zb(r,e=""){return SC.test(r)?!0:xC.test(r)&&kC.test(e)}var PC="127.0.0.1",OC=new Set(["localhost","127.0.0.1","::1"]),CC=0;function RC(r){if(r)try{return new URL(r.includes("://")?r:`http://${r}`).hostname}catch{return}}function _C(r){let e=RC(r);return!!e&&OC.has(e)}function NC(r,e){if(!e)return!1;try{return new URL(r).host===e}catch{return!1}}function ad(r){return r instanceof Error?r.message:"Unknown error"}async function Xb(r){let{getHtml:e,basePath:t,fsBase:n,port:s,reloadEmitter:i,messageEmitter:o,getServerExports:a,getBulbBlocks:c,saveInferenceResult:l,localOverride:d,trusted:u=!1,trustHint:f,staticAssets:p,bulbAssets:h,sourceFile:m}=r,b=`${process.pid}-${++CC}-${Date.now()}`,A=n??t,w=new EC;w.use("*",async(y,x)=>{if(!_C(y.req.header("host")))return y.text("Forbidden: untrusted Host",403);await x()}),w.use("*",async(y,x)=>{await x(),y.res.headers.set("Cross-Origin-Opener-Policy","same-origin"),y.res.headers.set("Cross-Origin-Embedder-Policy","credentialless")});let P=[["/__fs/*","the filesystem"],["/__api/*","server-side code (server.ts)"],["/__ai","AI (your API keys)"],["/__infer","AI (your API keys)"],["/__infer-save","the filesystem"]],R=async(y,x)=>{if(!u){let N=new URL(y.req.url).pathname,L=P.find(([K])=>K.endsWith("/*")?N.startsWith(K.slice(0,-2)):N===K)?.[1]??"server-side code (server.ts)";fh(process.pid,L);let B=f?`
|
|
2209
|
+
${f}`:"";return y.text(`Forbidden: this capability requires --trust.${B}`,403)}await x()},C=async(y,x)=>{let N=y.req.header("sec-fetch-site");if(N){if(N!=="same-origin")return y.text(`Forbidden: ${N} request`,403)}else{let L=y.req.header("origin");if(L&&!NC(L,y.req.header("host")))return y.text("Forbidden: cross-origin request",403)}await x()};for(let[y]of P)w.use(y,R),w.use(y,C);w.use("/__log",C),w.post("/__log",async y=>{try{let{args:x}=await y.req.json();console.log(...x||[])}catch{}return y.json({ok:!0})});let _=0;if(o){let y=0,x=new Map;w.use("/__send",C),w.post("/__send",async N=>{let L="";try{L=await N.req.text()}catch{}let B=Number(N.req.query("reply"))||0,K=o.listenerCount("message"),G=K===0&&_?Date.now()-_:void 0;if(N.req.query("solo")!==void 0&&K!==1)return N.json({clients:K,droppedMsAgo:G,refused:K>1});if(B<=0||K===0)return o.emit("message",{payload:L}),N.json({clients:K,droppedMsAgo:G});let me=++y,te=await new Promise(ie=>{let Se={expected:K,received:0,results:[],errors:[],finish:ga=>{clearTimeout(Fe),x.delete(me),ie({results:Se.results,errors:Se.errors,timedOut:ga})}},Fe=setTimeout(()=>Se.finish(!0),B);x.set(me,Se),o.emit("message",{id:me,payload:L})});return N.json({clients:K,...te})}),w.use("/__send-reply",C),w.post("/__send-reply",async N=>{try{let{id:L,results:B,errors:K}=await N.req.json(),G=x.get(L);G&&(G.results.push(...B??[]),G.errors.push(...K??[]),++G.received>=G.expected&&G.finish(!1))}catch{}return N.json({ok:!0})})}w.get("/",y=>y.html(e())),w.post("/__fs/read",async y=>{try{let{path:x}=await y.req.json(),N=await ts(x,A,t);return new Response(new Uint8Array(N),{headers:{"Content-Type":"application/octet-stream"}})}catch(x){let N=ad(x);return y.json({error:N},400)}}),w.post("/__fs/write",async y=>{try{let x=y.req.query("path");return x?(await go(x,new Uint8Array(await y.req.arrayBuffer()),A,t),y.json({success:!0})):y.json({error:"Missing path"},400)}catch(x){let N=ad(x);return y.json({error:N},400)}}),w.post("/__api/:name",async y=>{try{let x=y.req.param("name"),N=fa(a?.(),x);if(!N)return y.json({error:`API function '${x}' not found`},404);let{args:L}=await y.req.json();if(pa(N))return ua(y,N(...L||[]));let B=await N(...L||[]);return y.json({result:B})}catch(x){let N=ad(x);return y.json({error:N},500)}}),w.post("/__ai",async y=>{try{let{messages:x,system:N,effort:L,provider:B,model:K,webSearch:G,stream:me}=await y.req.json();if(!x||!Array.isArray(x)||x.length===0)return y.json({message:"messages array is required",code:"unknown",retryable:!1},400);let te=it(B,K);if(typeof te=="string")return y.json({message:te,code:"unknown",retryable:!1},400);let ie=await At(te,{messages:x,system:N,effort:L,webSearch:G,signal:y.req.raw.signal});if(!ie.ok){let Fe=await Ir(ie,te.protocol);return y.json(Fe,ie.status)}if(me)return ua(y,Xt(ie,te.protocol));let Se=await Gt(ie,te.protocol);return Se||console.warn("[tb.ai] Empty response from provider"),y.json({text:Se})}catch(x){return y.json(vs(x),500)}}),w.post("/__infer",async y=>{try{let{data:x}=await y.req.json().catch(()=>({})),N=c?.();if(!N?.infer.trim())return y.json({message:"This bulb has no infer.md block.",code:"unknown",retryable:!1},400);let L=it();if(typeof L=="string")return y.json({message:L,code:"unknown",retryable:!1},400);let B=Array.isArray(x)?x.map(String):[],K=su(N,B),G=await At(L,{messages:[{role:"user",content:K}],signal:y.req.raw.signal});if(!G.ok){let te=await Ir(G,L.protocol);return y.json(te,G.status)}let me=(async function*(){let te="";for await(let Fe of Xt(G,L.protocol))Fe.kind!=="text"||!Fe.text||(te+=Fe.text,yield{kind:"delta",text:Fe.text});let ie=iu(te);if(ie.parsed===null)throw console.warn(`[tb.infer] output not valid JSON after sanitize; raw output (last 4000 chars):
|
|
2210
|
+
`+te.slice(-4e3)),new we("LLM output is not valid JSON","parse_error",!0);ie.fixesApplied.length&&console.warn("[tb.infer] sanitized output, fixes applied:",ie.fixesApplied.join(", "));let Se={insight:ie.parsed,insightJson:ie.json,data:B};yield{kind:"complete",...Se,fixesApplied:ie.fixesApplied,hash:ou(Se)}})();return ua(y,me)}catch(x){return y.json(vs(x),500)}});let $=async y=>{let{hash:x}=await y.req.json().catch(()=>({}));return typeof x=="string"?au(x):null};w.post("/__infer-save",async y=>{try{if(!l)return y.json({message:"Save is not available for this server.",code:"unknown",retryable:!1},400);let x=await $(y);return x?(await l(x.data,x.insightJson),y.json({ok:!0})):y.json({message:"No decodable #tb= fragment to save.",code:"unknown",retryable:!1},400)}catch(x){return y.json(vs(x),500)}}),w.get("/__infer-info",y=>{let x=c?.(),N=en(x?.config??"").inference,L=Ai(x?.data??""),B=it();return typeof B=="string"?y.json({error:B,inference:N,data:L}):y.json({provider:B.protocol,model:B.model,inference:N,data:L})}),w.use("/__infer-decode",C),w.post("/__infer-decode",async y=>y.json(await $(y)??{error:"invalid fragment"})),w.get("/__infer-ui.js",y=>y.body(Vb,200,{"Content-Type":"text/javascript; charset=utf-8"})),w.get("/__models",async y=>{try{let x=await st();return y.json(x)}catch{return y.json([],200)}}),w.get("/__ai-access",async y=>{try{return y.json(await po())}catch{return y.json("none",200)}}),m&&w.get("/__source/*",async y=>{let x=await ld.readFile(m,"utf-8").catch(()=>{});return x===void 0?y.text("Not Found",404):new Response(x,{headers:{"Content-Type":"text/plain; charset=utf-8"}})});let E=["esm.sh","unpkg.com","cdn.jsdelivr.net","cdnjs.cloudflare.com"],M=new la;w.get("/proxy/*",async y=>{let x=new URL(y.req.url),L=(x.pathname+x.search).slice(7),B=L.lastIndexOf("https://");return B===-1?y.text("Invalid proxy URL",400):W(y,L.slice(B))}),d&&Gb(w,`/local/${d.name}/`,d.serveDir),p&&Gb(w,p.mount,p.dir),h&&w.get("/assets/*",async y=>{let{pathname:x}=new URL(y.req.url),N=x.slice(8),L;try{L=decodeURIComponent(N)}catch{return y.text("Not Found",404)}let B=Dd(L);if(B)return y.text(`${B} is not an asset type: a bulb's code and markup live in the bulb; assets are media and data`,403);try{for(let G of h.dirs){let me=await Qb(L,G,{"Cache-Control":"no-cache"});if(me)return me}}catch{return y.text("Not Found",404)}let K=h.remoteBase;return K?y.redirect(K+N,302):y.text("Not Found",404)});async function W(y,x){let N;try{N=new URL(x)}catch{return y.text("Invalid URL",400)}if(N.protocol!=="https:")return y.text("HTTPS only",400);if(!E.includes(N.hostname))return y.text("Host not allowed",403);let L=await M.get(x);if(L)return new Response(L.body,{status:200,headers:cd(L.contentType,L.cacheControl)});try{let B=await fetch(x,{headers:{Accept:y.req.header("Accept")||"*/*"},redirect:"follow"});if(!B.ok)return y.text(`Upstream ${B.status}`,B.status);let K=B.headers.get("Content-Type")||void 0,G=B.headers.get("Cache-Control")||void 0;if(B.body){let[me,te]=B.body.tee();return(async()=>{try{let ie=await new Response(te).arrayBuffer();await M.set(x,{body:Buffer.from(ie),contentType:K,cacheControl:G})}catch{}})(),new Response(me,{status:B.status,headers:cd(K,G)})}return new Response(null,{status:B.status,headers:cd(K,G)})}catch(B){return y.text(`Proxy fetch failed: ${B instanceof Error?B.message:B}`,502)}}(i||o)&&w.get("/__reload",y=>TC(y,async x=>{let N=()=>{x.writeSSE({event:"reload",data:""})},L=B=>{x.writeSSE({event:"message",data:JSON.stringify(B)})};for(i?.on("reload",N),o?.on("message",L),o&&o.listenerCount("message")===1&&console.log("[page] connected"),x.onAbort(()=>{i?.removeListener("reload",N),o?.removeListener("message",L),_=Date.now()}),await x.writeSSE({event:"hello",data:b});!x.aborted;)await x.sleep(3e4)})),w.notFound(async y=>{if(y.req.method!=="GET")return y.text("Not Found",404);let x=new URL(y.req.url);return zb(x.pathname,x.search)?W(y,"https://esm.sh"+x.pathname+x.search):y.text("Not Found",404)});let U=AC({fetch:w.fetch,port:s,hostname:PC});return U.listening||await new Promise((y,x)=>{let N=L=>x(L);U.once("error",N),U.once("listening",()=>{U.removeListener("error",N),y()})}),{port:s,close:()=>U.close()}}function cd(r,e){let t=new Headers;return r&&t.set("Content-Type",r),e&&t.set("Cache-Control",e),t.set("Access-Control-Allow-Origin","*"),t.set("Cross-Origin-Resource-Policy","cross-origin"),t}function Gb(r,e,t){r.get(`${e}*`,async n=>{let{pathname:s}=new URL(n.req.url);if(!s.startsWith(e))return n.text("Not Found",404);try{return await Qb(decodeURIComponent(s.slice(e.length)),t)??n.text("Not Found",404)}catch{return n.text("Not Found",404)}})}async function Qb(r,e,t={}){let n=ho(r,e),s=await ld.readFile(n).catch(()=>{});if(s)return new Response(s,{headers:{"Content-Type":Bd(n),...t}})}$e();Fr();async function ma(r){let{port:e,portNote:t,makeServerOptions:n,makeEntry:s,displayName:i,stopLog:o}=r,a=await Xb(n(e)).catch(async u=>{if(u?.code!=="EADDRINUSE")throw u;return hu(e)}),c=`http://localhost:${e}`;await dh(s(e,c)),console.log(`
|
|
2134
2211
|
${i}`),console.log(` ${c}`),t&&console.log(` ${t}`);let l=[],d=async()=>{console.log(`
|
|
2135
|
-
Shutting down...`),a.close();for(let u of l)try{await u()}catch{}o(),await
|
|
2212
|
+
Shutting down...`),a.close();for(let u of l)try{await u()}catch{}o(),await Dn(process.pid),process.exit(0)};return process.on("SIGINT",d),process.on("SIGTERM",d),{port:e,url:c,onCleanup(u){l.push(u)}}}Fr();import IC from"chokidar";var $C={persistent:!0,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}};function $t(r){let{target:e,onChange:t,events:n="change",debounceMs:s=150}=r,i,o=IC.watch(e,$C);o.on("error",c=>console.warn(`watch: ${c instanceof Error?c.message:c} \u2014 continuing`));let a=()=>{i&&clearTimeout(i),i=setTimeout(t,s)};return n==="all"?o.on("all",a):o.on("change",a),()=>{i&&clearTimeout(i),o.close()}}$e();async function ew(r,e,t,n){let s=process.cwd(),i=Bi(process.pid),o=e.watch?new Zb:void 0,a=new Zb;a.setMaxListeners(0);let c=Ae(e.mode),l=await _l(r);l.length&&console.log(`Replacing the running server for this bulb (pid ${l.map(E=>E.pid).join(", ")})`);let{port:d,note:u}=await xo({explicit:e.port,target:{kind:"bulb",file:r},cwd:process.cwd()}),f=1;console.log(Ol(f)),e.batch&&await Dr(r,e.batch),console.log(`Loading ${ha.basename(r)}...`);let{html:p,bulb:h,serverExports:m}=await fu(r,e.watch,e.trust,n,e.batch);Ot(c,r,h.server);let b=[...e.batch?[Pt(r,e.batch)]:[],Pt(r)],A=jr(ha.resolve(r)),w=e.trust?void 0:qr(h),{port:P,url:R,onCleanup:C}=await ma({port:d,portNote:u,displayName:h.name,stopLog:i,makeServerOptions:E=>({getHtml:()=>p,basePath:s,fsBase:Tt(r,e.batch),port:E,reloadEmitter:o,messageEmitter:a,getServerExports:()=>m,getBulbBlocks:()=>({infer:h.infer,insight:h.insight,code:h.code,config:h.config,data:h.data}),saveInferenceResult:async(M,W)=>{let U=await Lt.readFile(r,"utf-8");U=Zr(U,"data",M.join(Dm)),U=Zr(U,"insight",W),await Lt.writeFile(r,U)},localOverride:n?{name:n.name,serveDir:n.serveDir}:void 0,bulbAssets:{dirs:b,remoteBase:A&&Ps(A.userSlug,A.slug)},sourceFile:r,trusted:e.trust,trustHint:t}),makeEntry:(E,M)=>({pid:process.pid,port:E,url:M,file:r,cwd:process.cwd(),startedAt:Date.now(),trust:e.trust,batch:e.batch,mode:e.mode,predicted:w})});e.trust?console.log(" trust: granted (filesystem, AI, server.ts enabled)"):console.log(w?` trust: restricted \u2014 this bulb appears to use ${w}; re-run with --trust to enable it:
|
|
2136
2213
|
${t}
|
|
2137
2214
|
`:` trust: restricted \u2014 re-run with --trust to enable filesystem / AI / server.ts
|
|
2138
2215
|
`),e.watch&&console.log(` Watching for changes...
|
|
2139
|
-
`);let _,$;if(e.watch&&o){let E=0,M=Promise.resolve();if(_
|
|
2140
|
-
`),o.emit("reload")}})}for(let W of b)await
|
|
2141
|
-
`),o.emit("reload")}}))}_&&C(_),$&&C($),C(()=>
|
|
2142
|
-
`):await
|
|
2216
|
+
`);let _,$;if(e.watch&&o){let E=0,M=Promise.resolve();if(_=$t({target:r,onChange:()=>{let W=++E;M=M.then(async()=>{if(W===E)try{console.log("Recompiling...");let U=await fu(r,!0,e.trust,n,e.batch);p=U.html,m=U.serverExports,h=U.bulb,f++,console.log(Ol(f)),o.emit("reload")}catch(U){console.error("Compile error:",U)}})}}),n){let{name:W,serveDir:U}=n;$=$t({target:U,events:"all",onChange:()=>{console.log(`Local package '${W}' changed. Browser reloading...
|
|
2217
|
+
`),o.emit("reload")}})}for(let W of b)await Lt.stat(W).then(U=>U.isDirectory()).catch(()=>!1)&&C($t({target:W,events:"all",onChange:()=>{console.log(`Assets changed. Browser reloading...
|
|
2218
|
+
`),o.emit("reload")}}))}_&&C(_),$&&C($),C(()=>Lt.rm(du(r),{force:!0})),e.open&&(l.some(E=>E.port===P)?console.log(` Reusing the open browser tab.
|
|
2219
|
+
`):await LC(R))}Ct();import{readFileSync as rw,copyFileSync as BC,existsSync as DC}from"fs";import*as fe from"path";import{fileURLToPath as jC}from"url";import{EventEmitter as FC}from"events";import nw from"open";Fr();$e();eo();var ud=r=>`/agents/${r}/client.js`,MC=`
|
|
2143
2220
|
(() => {
|
|
2144
2221
|
const api = async (name, ...args) => {
|
|
2145
2222
|
const resp = await fetch('/__api/' + name, {
|
|
@@ -2168,18 +2245,18 @@ Shutting down...`),a.close();for(let u of l)try{await u()}catch{}o(),await Bn(pr
|
|
|
2168
2245
|
})
|
|
2169
2246
|
});
|
|
2170
2247
|
if (window.__TYPEBULB_WATCH__) {
|
|
2171
|
-
${
|
|
2248
|
+
${Zi}
|
|
2172
2249
|
}
|
|
2173
2250
|
})();
|
|
2174
|
-
`;function
|
|
2251
|
+
`;function tw(r){let{name:e,agent:t,styles:n,mountHtml:s,watch:i,theme:o}=r,a=ud(t);return`<!DOCTYPE html>
|
|
2175
2252
|
<html>
|
|
2176
2253
|
<head>
|
|
2177
2254
|
<meta charset="utf-8">
|
|
2178
2255
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
2179
|
-
<title>${
|
|
2180
|
-
${
|
|
2256
|
+
<title>${Xi(e)} - typebulb</title>
|
|
2257
|
+
${Qi(e,o)}
|
|
2181
2258
|
<style>
|
|
2182
|
-
${
|
|
2259
|
+
${Ln}
|
|
2183
2260
|
</style>
|
|
2184
2261
|
<style>
|
|
2185
2262
|
${n}
|
|
@@ -2191,17 +2268,17 @@ ${s}
|
|
|
2191
2268
|
${i?"<script>window.__TYPEBULB_WATCH__ = true;</script>":""}
|
|
2192
2269
|
|
|
2193
2270
|
<script>
|
|
2194
|
-
${
|
|
2271
|
+
${MC}
|
|
2195
2272
|
</script>
|
|
2196
2273
|
|
|
2197
2274
|
<script type="module" src="${a}"></script>
|
|
2198
2275
|
</body>
|
|
2199
|
-
</html>`}async function
|
|
2200
|
-
${n.url}`),r.open&&await
|
|
2201
|
-
`);let R=fe.join(u,t,"client"),C=fe.join(u,"core","client");async function _(){await(await import("esbuild")).build({entryPoints:[fe.join(R,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:fe.join(d,"client.js")});for(let M of["styles.css","index.html","typebulb.png","typebulb-inv.png"])
|
|
2202
|
-
`),i.emit("reload")}catch(W){console.error("Mirror rebuild failed:",W instanceof Error?W.message:W)}finally{M=!1}}}})}r.open&&await
|
|
2203
|
-
`);let c=0,l=Promise.resolve()
|
|
2204
|
-
`)}catch(p){
|
|
2205
|
-
`),
|
|
2206
|
-
`),process.exit(1)}function
|
|
2207
|
-
${e}`),process.exit(1))}async function
|
|
2276
|
+
</html>`}async function sw(r){let e=process.cwd(),t=r.agentTarget;eb(t)||(console.error(`Unknown agent '${t}'. Known: ${Gr().join(", ")}.`),process.exit(1));let n=await Rl(e,t);if(n){console.log(`Mirror '${t}' is already running for this project:
|
|
2277
|
+
${n.url}`),r.open&&await nw(n.url);return}let s=Bi(process.pid),i=r.watch?new FC:void 0,o=Ae(r.mode),a=await rb(t),c=a.displayName||`${t} mirror`;Ot(o,fe.join(e,"mirror"));let l=fe.dirname(jC(import.meta.url)),d=fe.join(l,"agents",t),u=fe.join(l,"..","cli","agents"),f=fe.join(d,"styles.css"),p=fe.join(d,"index.html"),h=()=>tw({name:c,agent:t,styles:rw(f,"utf8"),mountHtml:rw(p,"utf8"),watch:r.watch}),{port:m,note:b}=await xo({explicit:r.port,target:{kind:"mirror",agent:t},cwd:e}),{port:A,url:w,onCleanup:P}=await ma({port:m,portNote:b,displayName:c,stopLog:s,makeServerOptions:E=>({getHtml:h,basePath:e,port:E,reloadEmitter:i,getServerExports:()=>a,trusted:!0,staticAssets:{mount:`${fe.posix.dirname(ud(t))}/`,dir:d}}),makeEntry:(E,M)=>({pid:process.pid,port:E,url:M,file:`agent:${t}`,cwd:e,startedAt:Date.now(),trust:!0,agent:t})});r.watch&&console.log(` Watching for changes...
|
|
2278
|
+
`);let R=fe.join(u,t,"client"),C=fe.join(u,"core","client");async function _(){await(await import("esbuild")).build({entryPoints:[fe.join(R,"index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:fe.join(d,"client.js")});for(let M of["styles.css","index.html","typebulb.png","typebulb-inv.png"])BC(fe.join(C,M),fe.join(d,M))}let $;if(r.watch&&i){let E=DC(R),M=!1;$=$t({target:E?u:d,events:"all",onChange:async()=>{if(!M){M=!0;try{E&&await _(),console.log(`Mirror rebuilt. Browser reloading...
|
|
2279
|
+
`),i.emit("reload")}catch(W){console.error("Mirror rebuild failed:",W instanceof Error?W.message:W)}finally{M=!1}}}})}r.open&&await nw(w),P(()=>a.shutdownSwitcher?.()),P(()=>a.shutdownComposer?.()),$&&P($)}Ct();He();import*as iw from"path";async function ow(r,e,t,n,s){let i=Ae(t),o=!1;s&&await Dr(r,s);let a=async()=>{let{bulb:c,config:l}=await je(r);o||(Ot(i,r,c.server),o=!0),await rs(c.server,r,n,l.dependencies,s)};if(console.log(`Running ${iw.basename(r)}...`),await a(),e){console.log(`Watching for changes...
|
|
2280
|
+
`);let c=0,l=Promise.resolve();$t({target:r,onChange:()=>{let d=++c;l=l.then(async()=>{if(d===c)try{console.log("Re-running..."),await a()}catch(u){console.error("Error:",u)}})}})}}Ct();He();import{Console as qC}from"node:console";$e();async function lw(r,e,t,n,s){WC();try{let p=Er(await Q(),r)[0];p&&(Mi(p.pid,Ke(p.pid).offset),console.error(`note: 'call' boots a fresh server.ts instance; the running server (${p.url}) is not contacted \u2014 state shared with it must live on disk.`))}catch{}let i=Ae(t),{bulb:o,config:a}=await je(r);o.server||Ss("This bulb has no **server.ts** block; nothing to call."),Ot(i,r,o.server),s&&await Dr(r,s);let c;try{c=await rs(o.server,r,n,a.dependencies,s)}catch(p){Ss(p instanceof Error?p.message:String(p))}let l=fa(c,e.fn);if(!l){let p=[...Object.keys(c).filter(h=>typeof c[h]=="function"),...Object.keys(da)];Ss(`Function '${e.fn}' not found. Available: ${p.length?p.join(", "):"(none)"}.`)}let d=await UC(e);if(pa(l)){try{for await(let p of l(...d))await cw(JSON.stringify(p,uw)+`
|
|
2281
|
+
`)}catch(p){Ss(p instanceof Error?p.stack??p.message:String(p))}return aw(0)}let u;try{u=await l(...d)}catch(p){Ss(p instanceof Error?p.stack??p.message:String(p))}let f=HC(u);f!==void 0&&await cw(f+`
|
|
2282
|
+
`),aw(0)}function aw(r){process.exitCode=r,setTimeout(()=>process.exit(r),2e3).unref?.()}async function UC(r){if(r.hasArgsFlag){let e=r.argsJson??"";return e==="-"&&(e=await YC()),KC(e)}return JC(r.positional)}function JC(r){return r.map(e=>{try{return JSON.parse(e)}catch{return e}})}function KC(r){let e;try{e=JSON.parse(r)}catch(t){throw new Error(`--args must be a JSON array: ${t instanceof Error?t.message:String(t)}`)}if(!Array.isArray(e))throw new Error(`--args must be a JSON array, got ${e===null?"null":typeof e}`);return e}function HC(r){if(r!==void 0)return JSON.stringify(r,uw,2)}function uw(r,e){return typeof e=="bigint"?e.toString():e}function Ss(r){process.stderr.write(r+`
|
|
2283
|
+
`),process.exit(1)}function WC(){let r=new qC(process.stderr,process.stderr);console.log=r.log.bind(r),console.info=r.info.bind(r),console.debug=r.debug.bind(r),console.dir=r.dir.bind(r)}function cw(r){return new Promise((e,t)=>{process.stdout.write(r,n=>n?t(n):e())})}async function YC(){let r=[];for await(let e of process.stdin)r.push(e);return Buffer.concat(r).toString("utf-8")}$i();for(let r of[process.stdout,process.stderr])r.on("error",e=>{if(e?.code!=="EPIPE")throw e});function dw(r,e){r||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
|
|
2284
|
+
${e}`),process.exit(1))}async function VC(){let r=ib(process.argv.slice(2));if(r.version&&(console.log(`typebulb ${Ie}`),process.exit(0)),r.help&&(ob(),process.exit(0)),nb(),r.subcommand==="logs"){await Mb(r.file||void 0,{follow:r.follow,clear:r.clear,run:r.run,lines:r.lines});return}if(r.subcommand==="wait"){await Bb(r.file||void 0,{match:r.match,timeoutSec:r.timeoutSec});return}if(r.subcommand==="stop"){r.stopScope?await jb(r.stopScope):await Db(r.file||void 0);return}if(r.subcommand==="send"){await qb(r.file,r.sendMessage,r.sendWaitMs??0);return}if(r.subcommand==="models"){await _b(r.mode);return}if(r.subcommand==="slug"){Nb(r.slugName);return}if(r.subcommand==="pull"){await Og(r.file||void 0,{force:r.force,mode:r.mode});return}if(r.subcommand==="push"){await Rg(r.file||void 0,{force:r.force,mode:r.mode});return}if(r.subcommand==="agent"){await(r.agentTarget?sw(r):Rb(Ie));return}if(r.subcommand==="trust"||r.subcommand==="untrust"){await Pb(r.file||void 0,r.subcommand==="trust");return}let e;if(!r.file||r.file==="."){let c=await og(process.cwd());c||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=c}else e=ar.resolve(r.file);if(await fw.access(e).then(()=>!0,()=>!1)||(Gr().includes(r.file)&&(console.error(`To open the ${r.file} agent mirror, run: npx typebulb agent:${r.file}`),process.exit(1)),console.error(`File not found: ${e}`),process.exit(1)),e.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),r.subcommand==="get"){await Jb(e,r.blockKind);return}if(r.subcommand==="put"){await Wb(e,r.blockPairs);return}let n=r.file&&r.file!=="."?r.file:ar.relative(process.cwd(),e)||ar.basename(e),s=`npx typebulb --trust ${n.includes(" ")?`"${n}"`:n}`;if(r.subcommand==="predict"){await Tb(e,s);return}let i=!r.noTrust&&er(e);i&&!r.trust&&console.error("trust: granted from memory (run `typebulb untrust` to revoke)"),r.trust=r.noTrust?!1:r.trust||i;let o;try{o=await je(e)}catch{}let a;if(r.local){o&&!(r.local.name in(o.config.dependencies??{}))&&(console.error(`--replace: '${r.local.name}' is not a dependency in this bulb's config.json; nothing to replace.`),process.exit(1)),o&&r.subcommand!=="call"&&(!o.bulb.code||r.server)&&console.warn("warning: --replace has no effect in server mode (the override is client-only).");try{a=await kd(r.local)}catch(c){console.error(c instanceof Error?c.message:String(c)),process.exit(1)}console.error(`replace: ${a.name} \u2192 ${ar.relative(process.cwd(),a.dir)||"."}`)}if(r.subcommand==="check"){await Ab(e,a);return}if(r.subcommand==="call"){dw(r.trust,s),await lw(e,{fn:r.fn,positional:r.callArgs,argsJson:r.argsJson,hasArgsFlag:r.hasArgsFlag},r.mode,a,r.batch);return}if(o&&o.bulb.server&&(ji(o.bulb)||r.server)){dw(r.trust,s),await ow(e,r.watch,r.mode,a,r.batch);return}await ew(e,r,s,a)}VC().catch(r=>{console.error("Error:",r.message),process.exit(1)});
|