@bkm016/basalt 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/{chunk-shhrr741.js → chunk-bxn5kmpz.js} +1 -1
  2. package/compiled.js +1 -1
  3. package/package.json +1 -1
  4. package/web/{chunk-agmkx996.js → chunk-0xc2c540.js} +1 -1
  5. package/web/{chunk-kgerjbn4.js → chunk-0z0jycs8.js} +1 -1
  6. package/web/chunk-166qe5j6.js +2 -0
  7. package/web/chunk-1c95wfvq.js +1 -0
  8. package/web/{chunk-8wye0wbb.js → chunk-23c1df7e.js} +1 -1
  9. package/web/{chunk-mjpjkyd1.js → chunk-24h1rfje.js} +1 -1
  10. package/web/{chunk-dt8ss97f.js → chunk-2hd1pe9w.js} +1 -1
  11. package/web/chunk-329rtxa9.js +1 -0
  12. package/web/{chunk-9re6yttj.js → chunk-33qwz9bc.js} +1 -1
  13. package/web/{chunk-vkc149rb.js → chunk-3qjnwsph.js} +1 -1
  14. package/web/{chunk-jvj66qhs.js → chunk-47q4hmfp.js} +1 -1
  15. package/web/{chunk-xa88zgkr.js → chunk-4fzj0azw.js} +1 -1
  16. package/web/{chunk-zrzq29e6.js → chunk-5b2nw6j1.js} +1 -1
  17. package/web/{chunk-q1pkntc6.js → chunk-5hmfk69r.js} +1 -1
  18. package/web/{chunk-znvnb9dh.js → chunk-5qqw2e0t.js} +1 -1
  19. package/web/{chunk-rc2vq9wz.js → chunk-61jahh35.js} +1 -1
  20. package/web/chunk-6gxf3vsg.js +1 -0
  21. package/web/{chunk-5jbf7n5q.js → chunk-6parf7sy.js} +1 -1
  22. package/web/{chunk-shbw6wg8.js → chunk-7520nrbb.js} +1 -1
  23. package/web/{chunk-ezkqa7we.js → chunk-7ba8vrfc.js} +1 -1
  24. package/web/{chunk-pk3ap3wh.js → chunk-7qxhk1kz.js} +1 -1
  25. package/web/{chunk-h31p43qa.js → chunk-7v5rxabp.js} +1 -1
  26. package/web/{chunk-8ah6ce1b.js → chunk-7xk0ntav.js} +1 -1
  27. package/web/{chunk-xdcs8qz3.js → chunk-7yc083xj.js} +1 -1
  28. package/web/{chunk-vjqmnkh2.js → chunk-89fkdgbp.js} +1 -1
  29. package/web/{chunk-vny496ba.js → chunk-8qgpfxkz.js} +1 -1
  30. package/web/{chunk-rkj743fg.js → chunk-90xqeczk.js} +1 -1
  31. package/web/{chunk-jmnaq7c1.js → chunk-97b62pvb.js} +1 -1
  32. package/web/{chunk-693m9kt7.js → chunk-9a3q0jsh.js} +1 -1
  33. package/web/{chunk-jzmzhj8z.js → chunk-9bgey148.js} +1 -1
  34. package/web/{chunk-6qejm5s2.js → chunk-9xh96b33.js} +1 -1
  35. package/web/{chunk-3z93efr4.js → chunk-a5sg33w2.js} +1 -1
  36. package/web/chunk-a91vxtx4.js +1 -0
  37. package/web/{chunk-ctd8bfg2.js → chunk-acybsx44.js} +1 -1
  38. package/web/chunk-agec7jj4.js +1 -0
  39. package/web/{chunk-rrws61wf.js → chunk-axkyft9f.js} +1 -1
  40. package/web/{chunk-kww4azv5.js → chunk-b0a8nbj0.js} +1 -1
  41. package/web/chunk-c516cghj.js +1 -0
  42. package/web/{chunk-43jqvsrg.js → chunk-cwtdnacf.js} +1 -1
  43. package/web/chunk-dg1vas6z.js +8 -0
  44. package/web/{chunk-tn1xzmgx.js → chunk-ep37qp12.js} +1 -1
  45. package/web/{chunk-z760wagr.js → chunk-eqsd8zta.js} +1 -1
  46. package/web/{chunk-ctcrk3qn.js → chunk-es28k2t7.js} +1 -1
  47. package/web/chunk-fc0nx23g.js +1 -0
  48. package/web/{chunk-aqm3spxt.js → chunk-fhnypcrm.js} +84 -84
  49. package/web/{chunk-abbvjt4e.js → chunk-fv60p68p.js} +1 -1
  50. package/web/{chunk-vz5ck6x9.js → chunk-g46f421r.js} +1 -1
  51. package/web/{chunk-24k0r5aq.js → chunk-h18tnrf2.js} +1 -1
  52. package/web/{chunk-284a17k8.js → chunk-h288yd5w.js} +1 -1
  53. package/web/{chunk-z24vs8q9.js → chunk-hszjc2ny.js} +1 -1
  54. package/web/{chunk-5e7ygjdn.js → chunk-j0bwwc1g.js} +1 -1
  55. package/web/{chunk-bt1m87ck.js → chunk-jqa39f8t.js} +1 -1
  56. package/web/chunk-jvbbrnpa.js +1 -0
  57. package/web/{chunk-g8ee1csm.js → chunk-jzfd7cyh.js} +1 -1
  58. package/web/chunk-ka9ak8wr.js +1 -0
  59. package/web/{chunk-s3hwejnr.js → chunk-mb4qx9hy.js} +1 -1
  60. package/web/chunk-mnjd59jk.js +1 -0
  61. package/web/{chunk-1z5p7a1h.js → chunk-mwj9tpkz.js} +1 -1
  62. package/web/{chunk-qryrg2pq.js → chunk-n8gfjj9a.js} +2 -2
  63. package/web/chunk-ng0nbfhh.js +1 -0
  64. package/web/chunk-nz9nxk48.js +1 -0
  65. package/web/{chunk-raqqscwa.js → chunk-p9hsd3rn.js} +1 -1
  66. package/web/chunk-phw908hn.js +1 -0
  67. package/web/chunk-pjmmma1k.js +1 -0
  68. package/web/chunk-q7yn4m3t.js +1 -0
  69. package/web/chunk-qh15dxav.css +1 -0
  70. package/web/chunk-qnhqexe0.js +1 -0
  71. package/web/{chunk-yjv2c45j.js → chunk-rcx1aee5.js} +1 -1
  72. package/web/chunk-rjqj6ffe.js +1 -0
  73. package/web/{chunk-fy8ey195.js → chunk-rks7ksv3.js} +1 -1
  74. package/web/{chunk-cwvtraca.js → chunk-sb1cjpq8.js} +1 -1
  75. package/web/{chunk-5rx8rtsa.js → chunk-sgvp8vge.js} +1 -1
  76. package/web/chunk-sjjwte12.js +1 -0
  77. package/web/{chunk-yen2kkn2.js → chunk-sn9ecfvy.js} +1 -1
  78. package/web/{chunk-3mvr2gwh.js → chunk-t7bwsdbr.js} +1 -1
  79. package/web/{chunk-avwpjsxw.js → chunk-tse9gvyq.js} +1 -1
  80. package/web/{chunk-fqj9kry9.js → chunk-tx8240k4.js} +1 -1
  81. package/web/{chunk-s3rdx28k.js → chunk-vd6y2pcm.js} +1 -1
  82. package/web/{chunk-8e43yaq3.js → chunk-vpa55vje.js} +1 -1
  83. package/web/{chunk-9dd1c37b.js → chunk-vymqrpm3.js} +2 -2
  84. package/web/{chunk-t1xk6hca.js → chunk-w7snhcyg.js} +2 -2
  85. package/web/{chunk-jf2ehmvp.js → chunk-wdtnhpd6.js} +1 -1
  86. package/web/{chunk-vj6kstpp.js → chunk-wmvd6j0b.js} +1 -1
  87. package/web/{chunk-dk90px7g.js → chunk-xnq41dgs.js} +1 -1
  88. package/web/{chunk-986z0p48.js → chunk-xvsmtetz.js} +1 -1
  89. package/web/{chunk-2pjdtesn.js → chunk-y3ajqthy.js} +1 -1
  90. package/web/{chunk-f078k1ej.js → chunk-yd1ez3wd.js} +1 -1
  91. package/web/chunk-yfbxtg5p.js +1 -0
  92. package/web/{chunk-tnv7z83q.js → chunk-ywp4s71k.js} +1 -1
  93. package/web/{chunk-r92sbgwv.js → chunk-z4x331rx.js} +1 -1
  94. package/web/{chunk-4bry4xds.js → chunk-z6bpamwq.js} +1 -1
  95. package/web/{chunk-anbn2ttv.js → chunk-zmdnxn6m.js} +1 -1
  96. package/web/index.html +1 -1
  97. package/web/chunk-0sewdyz1.js +0 -1
  98. package/web/chunk-21ke27j6.js +0 -1
  99. package/web/chunk-3t3zwx9j.js +0 -1
  100. package/web/chunk-5xc9d5ft.js +0 -1
  101. package/web/chunk-b470hvpk.js +0 -1
  102. package/web/chunk-fekjj24p.css +0 -1
  103. package/web/chunk-frjfamx7.js +0 -8
  104. package/web/chunk-h5p5jsrw.js +0 -1
  105. package/web/chunk-h9fmr6ch.js +0 -1
  106. package/web/chunk-jq0pw0k2.js +0 -1
  107. package/web/chunk-k4cfnvyq.js +0 -1
  108. package/web/chunk-m29dhjkh.js +0 -1
  109. package/web/chunk-mj6tee5h.js +0 -1
  110. package/web/chunk-szcy5z56.js +0 -1
  111. package/web/chunk-t2hhdg9r.js +0 -1
  112. package/web/chunk-tj4cmkwe.js +0 -1
  113. package/web/chunk-v2b5q0n5.js +0 -1
  114. package/web/chunk-y5x74t89.js +0 -1
  115. package/web/chunk-yx3dh5hg.js +0 -1
  116. package/web/chunk-yz4fmtk2.js +0 -1
  117. package/web/chunk-z5j6x6j8.js +0 -2
  118. package/web/chunk-z5stjrhc.js +0 -1
@@ -62,7 +62,7 @@ name: ${e.name}
62
62
  description: ${e.description??""}
63
63
  ---
64
64
 
65
- ${n}`,body:n,name:e.name,description:e.description,directory:"<built-in>",bin:"",commands:[],scope:"builtin",platforms:e.platforms,disableModelInvocation:e.disableModelInvocation}}function qS(e,n="custom",c=[]){let g="parse";try{let f=zS(e,"utf8"),x=f.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);if(!x)throw Error("missing YAML frontmatter");let b=Bun.YAML.parse(x[1]??"");if(!b||typeof b!=="object"||Array.isArray(b))throw Error("invalid frontmatter");let k=b,T=zs(e),M=k.name;if(typeof M!=="string"||!M.trim()){c.push({path:e,reason:"\u7F3A\u5C11 name",kind:"missing-field"});return}let L=typeof k.description!=="string"||!k.description.trim();if(M!==BS(T))throw Error("name must match directory");if(g="bin",k.bin!==void 0&&(typeof k.bin!=="string"||!k.bin.trim()))throw Error("bin must be a non-empty directory path");let _=typeof k.bin==="string"?k.bin:"bin",E=Fs(T,_),I=E;while(!Bs(I)&&zs(I)!==I)I=zs(I);if(!Tn(Fs(T),E)||!Tn(Hs(T),Hs(I)))throw Error("bin must stay inside the skill directory");let C=[];if(Bs(E)&&qs(E).isDirectory()){for(let z of Hc(E,{withFileTypes:!0})){if(z.name.startsWith(".")||!z.isFile())continue;if(process.platform==="win32"||(qs(da(E,z.name)).mode&73)!==0)C.push(z.name)}C.sort()}if(g="parse",k["disable-model-invocation"]!==void 0&&typeof k["disable-model-invocation"]!=="boolean")throw Error("disable-model-invocation must be a boolean");if(k.platforms!==void 0&&(!Array.isArray(k.platforms)||!k.platforms.every((z)=>typeof z==="string")))throw Error("platforms must be a list of platform names");let j=Array.isArray(k.platforms)&&k.platforms.every((z)=>typeof z==="string")?k.platforms:void 0;if(j&&!j.includes(process.platform))return;if(L)c.push({path:e,reason:"\u7F3A\u5C11 description",kind:"missing-field"});return{raw:f,body:(x[2]??"").trim(),name:M,description:typeof k.description==="string"?k.description:void 0,directory:T,bin:E,commands:C,platforms:j,scope:n,disableModelInvocation:k["disable-model-invocation"]===!0}}catch(f){let x=f instanceof Error?f.message:String(f),k={"name must match directory":"name \u4E0E\u76EE\u5F55\u540D\u4E0D\u4E00\u81F4","bin must stay inside the skill directory":"bin \u8D8A\u51FA\u6280\u80FD\u76EE\u5F55","bin must be a non-empty directory path":"bin \u5FC5\u987B\u662F\u975E\u7A7A\u76EE\u5F55\u8DEF\u5F84","disable-model-invocation must be a boolean":"disable-model-invocation \u5FC5\u987B\u662F\u5E03\u5C14\u503C","platforms must be a list of platform names":"platforms \u5FC5\u987B\u662F\u5E73\u53F0\u540D\u79F0\u5217\u8868"}[x]??"frontmatter \u89E3\u6790\u5931\u8D25";c.push({path:e,reason:k,detail:x,kind:g});return}}function Ah(e,n=[],c=Pt(),g=[],f=[]){let x=Fc(e,n,c),b=new Map,k=new Set;for(let T of x){if(!Bs(T.path)){if(T.scope==="custom")g.push({path:T.path,reason:"\u81EA\u5B9A\u4E49\u8DEF\u5F84\u4E0D\u5B58\u5728",kind:"path"});continue}let M;try{M=Hc(T.path).sort()}catch(_){g.push({path:T.path,reason:"\u65E0\u6CD5\u626B\u63CF\u76EE\u5F55",detail:_ instanceof Error?_.message:String(_),kind:"path"});continue}let L=0;for(let _ of M){let E=da(T.path,_,"SKILL.md");if(!FS(E))continue;if(L++,k.has(E))continue;k.add(E);let I=qS(E,T.scope,g);if(I){f.push(I);let C=b.get(I.name);if(C&&!g.some((j)=>j.path===da(C.directory,"SKILL.md")))g.push({path:da(C.directory,"SKILL.md"),reason:"\u540C\u540D\u88AB\u8986\u76D6",kind:"overridden",overriddenBy:E});b.delete(I.name),b.set(I.name,I)}}if(T.scope==="custom"&&L===0)g.push({path:T.path,reason:"\u81EA\u5B9A\u4E49\u8DEF\u5F84\u6CA1\u6709\u6280\u80FD",kind:"path"})}return[...b.values()].filter((T)=>T.platforms===void 0||T.platforms.includes(process.platform))}function FS(e){try{return qs(e).isFile()}catch{return!1}}function Lh(e,n=process.env){let c=Object.keys(n).find((b)=>b.toLowerCase()==="path"),g=(c?n[c]:void 0)??process.env.PATH??"",f=new Set(g.split(process.platform==="win32"?";":":").map((b)=>process.platform==="win32"?b.toLowerCase():b)),x=e.map((b)=>b.bin).filter((b)=>{let k=process.platform==="win32"?b.toLowerCase():b;if(f.has(k))return!1;return f.add(k),!0});return[...g?[g]:[],...x].join(process.platform==="win32"?";":":")}function qc(e){return e.body}function Tn(e,n){let c=Wh(e,n);return c===""||c!==".."&&!c.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!HS(c)}function Fc(e,n=[],c=Pt()){let g=[];if(g.push({path:da(Rh(),".claude/skills"),scope:"global"}),g.push({path:da(Rh(),".agents/skills"),scope:"global"}),g.push({path:da(c,"skills"),scope:"global"}),e){let f=Fs(e);for(;;){for(let b of[".claude/skills",".agents/skills",".basalt/skills"])g.push({path:da(f,b),scope:"project"});let x=zs(f);if(x===f)break;f=x}}for(let f of n)g.push({path:Fs(f),scope:"custom"});return g}function Rn(e){return e.map((n)=>({name:n.name,...n.description?{description:n.description}:{},location:n.scope==="builtin"?"<built-in>":n.directory,scope:n.scope,bin:n.bin,...n.commands?.length?{commands:n.commands}:{},disableModelInvocation:n.disableModelInvocation,...n.platforms?{platforms:n.platforms}:{}}))}function _h(e){if(e.scope==="builtin"||!Bs(e.directory))return[];let n=Hs(e.directory),c=[];function g(f){for(let x of Hc(f,{withFileTypes:!0}).sort((b,k)=>{if(b.name<k.name)return-1;if(b.name>k.name)return 1;return 0})){if(c.length>=200)return;if(x.name.startsWith(".")||x.name==="node_modules")continue;let b=da(f,x.name),k;try{k=Hs(b)}catch(T){if(T instanceof Error&&"code"in T&&T.code==="ENOENT")continue;throw T}if(!Tn(n,k))continue;if(x.isDirectory())g(b);else if(x.isFile()||x.isSymbolicLink()&&qs(b).isFile())c.push(Wh(e.directory,b).split("\\").join("/"))}}return g(e.directory),c}import{existsSync as NS,watch as $S}from"fs";import{dirname as Eh,resolve as QS}from"path";class Nc{storageDirectory;settings;builtinSkills;candidates=new Map;snapshots=new Map;issues=new Map;watchers=[];timer;closed=!1;constructor(e,n,c=()=>[]){this.storageDirectory=e;this.settings=n;this.builtinSkills=c}open(){this.closed=!1}get(e){if(this.closed)return[];let n=e??"",c=this.snapshots.get(n);if(c)return c;let g=this.scan(e);return this.snapshots.set(n,g),this.listen(),g}all(e){if(this.closed)return[];return this.get(e),this.candidates.get(e??"")??[]}getIssues(e){if(this.closed)return[];return this.get(e),this.issues.get(e??"")??[]}rescan(){if(this.closed)return;for(let e of this.snapshots.keys()){if(this.closed)return;this.snapshots.set(e,this.scan(e||void 0))}if(this.closed)return;this.listen()}closeWatchers(){if(this.timer)clearTimeout(this.timer),this.timer=void 0;for(let e of this.watchers)e.close();this.watchers=[]}close(){this.closed=!0,this.closeWatchers()}scan(e){if(this.closed)return[];let n;try{n=this.settings()}catch{return[]}let c=[],g=[],f=this.builtinSkills().filter((T)=>T.platforms===void 0||T.platforms.includes(process.platform));for(let T of f)g.push(T);let x=Ah(e,n.customPaths,this.storageDirectory,c,g),b=new Set(x.map((T)=>T.name)),k=[];for(let T of f)if(b.has(T.name)){let M=x.find((L)=>L.name===T.name);if(M)c.push({path:"<built-in>",reason:"\u540C\u540D\u88AB\u8986\u76D6",kind:"overridden",overriddenBy:M.directory})}else k.push(T);return k.push(...x),this.candidates.set(e??"",g),this.issues.set(e??"",c),k}listen(){if(this.closeWatchers(),this.closed)return;let e;try{e=this.settings()}catch{return}let n=new Set([...this.snapshots.keys()].flatMap((g)=>Fc(g||void 0,e.customPaths,this.storageDirectory).map((f)=>f.path))),c=new Set;for(let g of n){let f=g;while(!NS(f)&&Eh(f)!==f)f=Eh(f);if(c.has(f))continue;c.add(f);try{let x=$S(f,{recursive:f===g},(b,k)=>{if(this.closed||!k)return;let T=QS(f,k);if(![...n].some((L)=>Tn(L,T)&&/\.md$/i.test(T)||Tn(T,L)))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(()=>{if(this.closed)return;try{this.rescan()}catch(L){console.warn("Skill rescan failed:",L)}},1000),this.timer.unref?.()});x.on("error",(b)=>console.warn(`Skill watcher failed for ${g}:`,b)),x.unref(),this.watchers.push(x)}catch(x){console.warn(`Cannot watch skills directory ${g}:`,x)}}}}class $c{database;constructor(e){this.database=e}skillSettings(){let e=this.database.query("SELECT custom_paths, disabled FROM skill_settings WHERE id = 1").get();if(!e)throw Error("Missing skill settings; database migration is incomplete");return{customPaths:JSON.parse(e.custom_paths),disabled:JSON.parse(e.disabled??"[]")}}saveSkillSettings(e){this.database.query("UPDATE skill_settings SET custom_paths = ?, disabled = ? WHERE id = 1").run(JSON.stringify(e.customPaths),JSON.stringify(e.disabled??[]))}}class Qc{runtime;store;owners=0;enabled;sessionSkills=new Map;skillCatalog;builtins=new Map;constructor(e,n,c){this.runtime=e;this.store=new $c(c),this.skillCatalog=new Nc(n,()=>this.store.skillSettings(),()=>[...this.builtins.values()]),this.enabled=!0}registerBuiltinSkill(e){let n=Mh(e);return this.builtins.set(n.name,n),this.skillCatalog.rescan(),()=>{if(this.builtins.get(n.name)===n)this.builtins.delete(n.name),this.skillCatalog.rescan()}}capture(e,n){if(!this.enabled)return;let c=this.runtime.plugins.list().find((f)=>f.id==="skills");if(c&&(!c.builtin||c.status!=="enabled"))return;let g=this.store.skillSettings().disabled??[];this.sessionSkills.set(e,this.skillCatalog.get(n).filter((f)=>!g.includes(f.name)))}inherit(e,n){if(!this.enabled)return;let c=this.sessionSkills.get(n)??this.availableSkills(void 0,n);this.sessionSkills.set(e,[...c])}retain(){if(this.enabled=!0,this.skillCatalog.open(),this.owners++===0)this.skillCatalog.rescan();let e=!1;return()=>{if(e)return;if(e=!0,--this.owners<=0)this.owners=0,this.enabled=!1,this.skillCatalog.close()}}close(){this.enabled=!1,this.owners=0,this.skillCatalog.close()}requireProject(e){let n=this.runtime.project(e);if(!n)throw new y("no such project");return n}skills(e,n){let c=this.store.skillSettings();return Rn(this.availableSkills(e,n).filter((g)=>!(c.disabled??[]).includes(g.name))).map((g)=>({...g,disabled:!1}))}skillList(e,n){let c=e?this.requireProject(e):void 0;return{skills:this.skills(e,n),issues:this.skillCatalog.getIssues(c?.directory)}}allSkills(){let e=this.store.skillSettings(),n=[void 0,...this.runtime.store.projects()],c=n.flatMap((f)=>Rn(this.skillCatalog.all(f?.directory)).map((x)=>({...x,disabled:(e.disabled??[]).includes(x.name),...f?{projectID:f.id,projectName:f.name}:{}}))),g=n.flatMap((f)=>this.skillCatalog.getIssues(f?.directory));return{skills:[...new Map(c.map((f)=>[`${f.location}\x00${f.name}`,f])).values()],issues:[...new Map(g.map((f)=>[f.path,f])).values()]}}skillFiles(e,n,c,g){let f=this.previewSkill(e,n,c,g);return{files:_h(f)}}previewSkill(e,n,c,g){let f=n?this.requireProject(n):void 0,b=(g&&!c?this.skillCatalog.all(f?.directory):this.availableSkills(n,c)).find((k)=>k.name===e&&(!g||k.directory===g||k.scope==="builtin"&&g==="<built-in>"));if(!b)throw new y("Skill not found; rescan skills and try again");return b}availableSkills(e,n){if(n){let g=this.sessionSkills.get(n);if(g)return g;let f=this.runtime.get(n);if(!f)throw new y("Session not found");let x=f.projectID?this.runtime.project(f.projectID):void 0;return this.capture(n,x?.directory),this.sessionSkills.get(n)??[]}let c=e?this.requireProject(e):void 0;return this.skillCatalog.get(c?.directory)}skillContent(e,n,c,g){return{text:this.previewSkill(e,n,c,g).raw}}skillSettings(){return this.store.skillSettings()}saveSkillSettings(e){if(!e||!Array.isArray(e.customPaths)||e.customPaths.length>100||e.disabled!==void 0&&(!Array.isArray(e.disabled)||e.disabled.length>1e4||e.disabled.some((c)=>typeof c!=="string"||!c.trim()||c.length>256))||e.customPaths.some((c)=>typeof c!=="string"||!c.trim()||c.length>4096||c.includes("\x00")||!GS(c)))throw new t("Skills accept up to 100 absolute local paths");let n={customPaths:[...new Set(e.customPaths.map((c)=>VS(c)))],disabled:[...new Set(e.disabled??[])]};return this.store.saveSkillSettings(n),this.skillCatalog.rescan(),n}rescanSkills(){return this.skillCatalog.rescan(),this.skills()}}var Wn={pluginID:"skills",name:"service",validate(e){return e instanceof Qc}},Ih=new WeakMap;function Ph(e,n){let c=Ih.get(e);if(!c)c=new Qc(e,e.options.dataDir,n),Ih.set(e,c);return c}import{join as Yh}from"path";var Aa={name:"@basalt/cli",version:"0.1.2",private:!0,type:"module",bin:{basalt:"./src/main.ts"},scripts:{typecheck:"tsgo --noEmit -p ."},dependencies:{"@basalt/core":"workspace:*","@basalt/server":"workspace:*",uqr:"0.1.3","@basalt/web":"workspace:*","@earendil-works/pi-ai":"1.2.0","@basalt/protocol":"workspace:*","@basalt/builtins":"workspace:*"},imports:{"#*":"./src/*"}};var Ao=`# Basalt plugins
65
+ ${n}`,body:n,name:e.name,description:e.description,directory:"<built-in>",bin:"",commands:[],scope:"builtin",platforms:e.platforms,disableModelInvocation:e.disableModelInvocation}}function qS(e,n="custom",c=[]){let g="parse";try{let f=zS(e,"utf8"),x=f.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);if(!x)throw Error("missing YAML frontmatter");let b=Bun.YAML.parse(x[1]??"");if(!b||typeof b!=="object"||Array.isArray(b))throw Error("invalid frontmatter");let k=b,T=zs(e),M=k.name;if(typeof M!=="string"||!M.trim()){c.push({path:e,reason:"\u7F3A\u5C11 name",kind:"missing-field"});return}let L=typeof k.description!=="string"||!k.description.trim();if(M!==BS(T))throw Error("name must match directory");if(g="bin",k.bin!==void 0&&(typeof k.bin!=="string"||!k.bin.trim()))throw Error("bin must be a non-empty directory path");let _=typeof k.bin==="string"?k.bin:"bin",E=Fs(T,_),I=E;while(!Bs(I)&&zs(I)!==I)I=zs(I);if(!Tn(Fs(T),E)||!Tn(Hs(T),Hs(I)))throw Error("bin must stay inside the skill directory");let C=[];if(Bs(E)&&qs(E).isDirectory()){for(let z of Hc(E,{withFileTypes:!0})){if(z.name.startsWith(".")||!z.isFile())continue;if(process.platform==="win32"||(qs(da(E,z.name)).mode&73)!==0)C.push(z.name)}C.sort()}if(g="parse",k["disable-model-invocation"]!==void 0&&typeof k["disable-model-invocation"]!=="boolean")throw Error("disable-model-invocation must be a boolean");if(k.platforms!==void 0&&(!Array.isArray(k.platforms)||!k.platforms.every((z)=>typeof z==="string")))throw Error("platforms must be a list of platform names");let j=Array.isArray(k.platforms)&&k.platforms.every((z)=>typeof z==="string")?k.platforms:void 0;if(j&&!j.includes(process.platform))return;if(L)c.push({path:e,reason:"\u7F3A\u5C11 description",kind:"missing-field"});return{raw:f,body:(x[2]??"").trim(),name:M,description:typeof k.description==="string"?k.description:void 0,directory:T,bin:E,commands:C,platforms:j,scope:n,disableModelInvocation:k["disable-model-invocation"]===!0}}catch(f){let x=f instanceof Error?f.message:String(f),k={"name must match directory":"name \u4E0E\u76EE\u5F55\u540D\u4E0D\u4E00\u81F4","bin must stay inside the skill directory":"bin \u8D8A\u51FA\u6280\u80FD\u76EE\u5F55","bin must be a non-empty directory path":"bin \u5FC5\u987B\u662F\u975E\u7A7A\u76EE\u5F55\u8DEF\u5F84","disable-model-invocation must be a boolean":"disable-model-invocation \u5FC5\u987B\u662F\u5E03\u5C14\u503C","platforms must be a list of platform names":"platforms \u5FC5\u987B\u662F\u5E73\u53F0\u540D\u79F0\u5217\u8868"}[x]??"frontmatter \u89E3\u6790\u5931\u8D25";c.push({path:e,reason:k,detail:x,kind:g});return}}function Ah(e,n=[],c=Pt(),g=[],f=[]){let x=Fc(e,n,c),b=new Map,k=new Set;for(let T of x){if(!Bs(T.path)){if(T.scope==="custom")g.push({path:T.path,reason:"\u81EA\u5B9A\u4E49\u8DEF\u5F84\u4E0D\u5B58\u5728",kind:"path"});continue}let M;try{M=Hc(T.path).sort()}catch(_){g.push({path:T.path,reason:"\u65E0\u6CD5\u626B\u63CF\u76EE\u5F55",detail:_ instanceof Error?_.message:String(_),kind:"path"});continue}let L=0;for(let _ of M){let E=da(T.path,_,"SKILL.md");if(!FS(E))continue;if(L++,k.has(E))continue;k.add(E);let I=qS(E,T.scope,g);if(I){f.push(I);let C=b.get(I.name);if(C&&!g.some((j)=>j.path===da(C.directory,"SKILL.md")))g.push({path:da(C.directory,"SKILL.md"),reason:"\u540C\u540D\u88AB\u8986\u76D6",kind:"overridden",overriddenBy:E});b.delete(I.name),b.set(I.name,I)}}if(T.scope==="custom"&&L===0)g.push({path:T.path,reason:"\u81EA\u5B9A\u4E49\u8DEF\u5F84\u6CA1\u6709\u6280\u80FD",kind:"path"})}return[...b.values()].filter((T)=>T.platforms===void 0||T.platforms.includes(process.platform))}function FS(e){try{return qs(e).isFile()}catch{return!1}}function Lh(e,n=process.env){let c=Object.keys(n).find((b)=>b.toLowerCase()==="path"),g=(c?n[c]:void 0)??process.env.PATH??"",f=new Set(g.split(process.platform==="win32"?";":":").map((b)=>process.platform==="win32"?b.toLowerCase():b)),x=e.map((b)=>b.bin).filter((b)=>{let k=process.platform==="win32"?b.toLowerCase():b;if(f.has(k))return!1;return f.add(k),!0});return[...g?[g]:[],...x].join(process.platform==="win32"?";":":")}function qc(e){return e.body}function Tn(e,n){let c=Wh(e,n);return c===""||c!==".."&&!c.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!HS(c)}function Fc(e,n=[],c=Pt()){let g=[];if(g.push({path:da(Rh(),".claude/skills"),scope:"global"}),g.push({path:da(Rh(),".agents/skills"),scope:"global"}),g.push({path:da(c,"skills"),scope:"global"}),e){let f=Fs(e);for(;;){for(let b of[".claude/skills",".agents/skills",".basalt/skills"])g.push({path:da(f,b),scope:"project"});let x=zs(f);if(x===f)break;f=x}}for(let f of n)g.push({path:Fs(f),scope:"custom"});return g}function Rn(e){return e.map((n)=>({name:n.name,...n.description?{description:n.description}:{},location:n.scope==="builtin"?"<built-in>":n.directory,scope:n.scope,bin:n.bin,...n.commands?.length?{commands:n.commands}:{},disableModelInvocation:n.disableModelInvocation,...n.platforms?{platforms:n.platforms}:{}}))}function _h(e){if(e.scope==="builtin"||!Bs(e.directory))return[];let n=Hs(e.directory),c=[];function g(f){for(let x of Hc(f,{withFileTypes:!0}).sort((b,k)=>{if(b.name<k.name)return-1;if(b.name>k.name)return 1;return 0})){if(c.length>=200)return;if(x.name.startsWith(".")||x.name==="node_modules")continue;let b=da(f,x.name),k;try{k=Hs(b)}catch(T){if(T instanceof Error&&"code"in T&&T.code==="ENOENT")continue;throw T}if(!Tn(n,k))continue;if(x.isDirectory())g(b);else if(x.isFile()||x.isSymbolicLink()&&qs(b).isFile())c.push(Wh(e.directory,b).split("\\").join("/"))}}return g(e.directory),c}import{existsSync as NS,watch as $S}from"fs";import{dirname as Eh,resolve as QS}from"path";class Nc{storageDirectory;settings;builtinSkills;candidates=new Map;snapshots=new Map;issues=new Map;watchers=[];timer;closed=!1;constructor(e,n,c=()=>[]){this.storageDirectory=e;this.settings=n;this.builtinSkills=c}open(){this.closed=!1}get(e){if(this.closed)return[];let n=e??"",c=this.snapshots.get(n);if(c)return c;let g=this.scan(e);return this.snapshots.set(n,g),this.listen(),g}all(e){if(this.closed)return[];return this.get(e),this.candidates.get(e??"")??[]}getIssues(e){if(this.closed)return[];return this.get(e),this.issues.get(e??"")??[]}rescan(){if(this.closed)return;for(let e of this.snapshots.keys()){if(this.closed)return;this.snapshots.set(e,this.scan(e||void 0))}if(this.closed)return;this.listen()}closeWatchers(){if(this.timer)clearTimeout(this.timer),this.timer=void 0;for(let e of this.watchers)e.close();this.watchers=[]}close(){this.closed=!0,this.closeWatchers()}scan(e){if(this.closed)return[];let n;try{n=this.settings()}catch{return[]}let c=[],g=[],f=this.builtinSkills().filter((T)=>T.platforms===void 0||T.platforms.includes(process.platform));for(let T of f)g.push(T);let x=Ah(e,n.customPaths,this.storageDirectory,c,g),b=new Set(x.map((T)=>T.name)),k=[];for(let T of f)if(b.has(T.name)){let M=x.find((L)=>L.name===T.name);if(M)c.push({path:"<built-in>",reason:"\u540C\u540D\u88AB\u8986\u76D6",kind:"overridden",overriddenBy:M.directory})}else k.push(T);return k.push(...x),this.candidates.set(e??"",g),this.issues.set(e??"",c),k}listen(){if(this.closeWatchers(),this.closed)return;let e;try{e=this.settings()}catch{return}let n=new Set([...this.snapshots.keys()].flatMap((g)=>Fc(g||void 0,e.customPaths,this.storageDirectory).map((f)=>f.path))),c=new Set;for(let g of n){let f=g;while(!NS(f)&&Eh(f)!==f)f=Eh(f);if(c.has(f))continue;c.add(f);try{let x=$S(f,{recursive:f===g},(b,k)=>{if(this.closed||!k)return;let T=QS(f,k);if(![...n].some((L)=>Tn(L,T)&&/\.md$/i.test(T)||Tn(T,L)))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(()=>{if(this.closed)return;try{this.rescan()}catch(L){console.warn("Skill rescan failed:",L)}},1000),this.timer.unref?.()});x.on("error",(b)=>console.warn(`Skill watcher failed for ${g}:`,b)),x.unref(),this.watchers.push(x)}catch(x){console.warn(`Cannot watch skills directory ${g}:`,x)}}}}class $c{database;constructor(e){this.database=e}skillSettings(){let e=this.database.query("SELECT custom_paths, disabled FROM skill_settings WHERE id = 1").get();if(!e)throw Error("Missing skill settings; database migration is incomplete");return{customPaths:JSON.parse(e.custom_paths),disabled:JSON.parse(e.disabled??"[]")}}saveSkillSettings(e){this.database.query("UPDATE skill_settings SET custom_paths = ?, disabled = ? WHERE id = 1").run(JSON.stringify(e.customPaths),JSON.stringify(e.disabled??[]))}}class Qc{runtime;store;owners=0;enabled;sessionSkills=new Map;skillCatalog;builtins=new Map;constructor(e,n,c){this.runtime=e;this.store=new $c(c),this.skillCatalog=new Nc(n,()=>this.store.skillSettings(),()=>[...this.builtins.values()]),this.enabled=!0}registerBuiltinSkill(e){let n=Mh(e);return this.builtins.set(n.name,n),this.skillCatalog.rescan(),()=>{if(this.builtins.get(n.name)===n)this.builtins.delete(n.name),this.skillCatalog.rescan()}}capture(e,n){if(!this.enabled)return;let c=this.runtime.plugins.list().find((f)=>f.id==="skills");if(c&&(!c.builtin||c.status!=="enabled"))return;let g=this.store.skillSettings().disabled??[];this.sessionSkills.set(e,this.skillCatalog.get(n).filter((f)=>!g.includes(f.name)))}inherit(e,n){if(!this.enabled)return;let c=this.sessionSkills.get(n)??this.availableSkills(void 0,n);this.sessionSkills.set(e,[...c])}retain(){if(this.enabled=!0,this.skillCatalog.open(),this.owners++===0)this.skillCatalog.rescan();let e=!1;return()=>{if(e)return;if(e=!0,--this.owners<=0)this.owners=0,this.enabled=!1,this.skillCatalog.close()}}close(){this.enabled=!1,this.owners=0,this.skillCatalog.close()}requireProject(e){let n=this.runtime.project(e);if(!n)throw new y("no such project");return n}skills(e,n){let c=this.store.skillSettings();return Rn(this.availableSkills(e,n).filter((g)=>!(c.disabled??[]).includes(g.name))).map((g)=>({...g,disabled:!1}))}skillList(e,n){let c=e?this.requireProject(e):void 0;return{skills:this.skills(e,n),issues:this.skillCatalog.getIssues(c?.directory)}}allSkills(){let e=this.store.skillSettings(),n=[void 0,...this.runtime.store.projects()],c=n.flatMap((f)=>Rn(this.skillCatalog.all(f?.directory)).map((x)=>({...x,disabled:(e.disabled??[]).includes(x.name),...f?{projectID:f.id,projectName:f.name}:{}}))),g=n.flatMap((f)=>this.skillCatalog.getIssues(f?.directory));return{skills:[...new Map(c.map((f)=>[`${f.location}\x00${f.name}`,f])).values()],issues:[...new Map(g.map((f)=>[f.path,f])).values()]}}skillFiles(e,n,c,g){let f=this.previewSkill(e,n,c,g);return{files:_h(f)}}previewSkill(e,n,c,g){let f=n?this.requireProject(n):void 0,b=(g&&!c?this.skillCatalog.all(f?.directory):this.availableSkills(n,c)).find((k)=>k.name===e&&(!g||k.directory===g||k.scope==="builtin"&&g==="<built-in>"));if(!b)throw new y("Skill not found; rescan skills and try again");return b}availableSkills(e,n){if(n){let g=this.sessionSkills.get(n);if(g)return g;let f=this.runtime.get(n);if(!f)throw new y("Session not found");let x=f.projectID?this.runtime.project(f.projectID):void 0;return this.capture(n,x?.directory),this.sessionSkills.get(n)??[]}let c=e?this.requireProject(e):void 0;return this.skillCatalog.get(c?.directory)}skillContent(e,n,c,g){return{text:this.previewSkill(e,n,c,g).raw}}skillSettings(){return this.store.skillSettings()}saveSkillSettings(e){if(!e||!Array.isArray(e.customPaths)||e.customPaths.length>100||e.disabled!==void 0&&(!Array.isArray(e.disabled)||e.disabled.length>1e4||e.disabled.some((c)=>typeof c!=="string"||!c.trim()||c.length>256))||e.customPaths.some((c)=>typeof c!=="string"||!c.trim()||c.length>4096||c.includes("\x00")||!GS(c)))throw new t("Skills accept up to 100 absolute local paths");let n={customPaths:[...new Set(e.customPaths.map((c)=>VS(c)))],disabled:[...new Set(e.disabled??[])]};return this.store.saveSkillSettings(n),this.skillCatalog.rescan(),n}rescanSkills(){return this.skillCatalog.rescan(),this.skills()}}var Wn={pluginID:"skills",name:"service",validate(e){return e instanceof Qc}},Ih=new WeakMap;function Ph(e,n){let c=Ih.get(e);if(!c)c=new Qc(e,e.options.dataDir,n),Ih.set(e,c);return c}import{join as Yh}from"path";var Aa={name:"@basalt/cli",version:"0.1.3",private:!0,type:"module",bin:{basalt:"./src/main.ts"},scripts:{typecheck:"tsgo --noEmit -p ."},dependencies:{"@basalt/core":"workspace:*","@basalt/server":"workspace:*",uqr:"0.1.3","@basalt/web":"workspace:*","@earendil-works/pi-ai":"1.2.0","@basalt/protocol":"workspace:*","@basalt/builtins":"workspace:*"},imports:{"#*":"./src/*"}};var Ao=`# Basalt plugins
66
66
 
67
67
  \u8FDB\u7A0B\u5185\u3001\u5B8C\u5168\u4FE1\u4EFB\u7684 Bun TypeScript \u63D2\u4EF6\u3002\u63D2\u4EF6\u6301\u6709\u771F\u5B9E Runtime\uFF0C\u6CA1\u6709\u6C99\u7BB1\uFF1B\u53EA\u5B89\u88C5\u4F60\u613F\u610F\u6388\u4E88\u670D\u52A1\u8FDB\u7A0B\u5168\u90E8\u6743\u9650\u7684\u4EE3\u7801\u3002\u5185\u7F6E\u529F\u80FD\u4E5F\u4F7F\u7528\u4E0B\u9762\u7684 definePlugin \u548C PluginHost \u5165\u53E3\u3002
68
68
 
package/compiled.js CHANGED
@@ -20,4 +20,4 @@ import{Nr,Dr,Rn}from"./chunk-v258nxcz.js";import{F}from"./chunk-m8vkwdgr.js";imp
20
20
  `);let{connect:a,buffered:u}=await d;if(e.emit("proxyConnect",a),this.emit("proxyConnect",a,e),e.emit("proxy",{proxy:this.proxy.href,socket:n}),a.statusCode===200){if(e.once("socket",Dn),t.secureEndpoint)return W("Upgrading socket connection to TLS"),ye.connect({...Lt(lt(t),"host","path","port"),socket:n});return n}if(a.statusCode===407&&this.onProxyAuth){W("Got 407 response, invoking onProxyAuth callback"),n.destroy();let p=a.headers["proxy-authenticate"]||"",S=Array.isArray(p)?p[0].split(/\s/)[0]:p.split(/\s/)[0],C=await this.onProxyAuth({response:a,scheme:S});return this._connectWithAuth(e,t,C.headers)}n.destroy();let l=new P.Socket({writable:!1});return l.readable=!0,e.once("socket",(p)=>{W("Replaying proxy buffer for failed request"),Ja(p.listenerCount("data")>0),p.push(u),p.push(null)}),l}async _connectWithAuth(e,t,o){let{proxy:n}=this,s;if(n.protocol==="https:")s=ye.connect(lt(this.connectOpts));else s=P.connect(this.connectOpts);let r=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},c=P.isIPv6(t.host)?`[${t.host}]`:t.host,d=`CONNECT ${c}:${t.port} HTTP/1.1\r
21
21
  `;if(n.username||n.password){let l=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;r["Proxy-Authorization"]=`Basic ${Buffer.from(l).toString("base64")}`}if(Object.assign(r,o),r.Host=`${c}:${t.port}`,!r["Proxy-Connection"])r["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let l of Object.keys(r))d+=`${l}: ${r[l]}\r
22
22
  `;let a=Dt(s);s.write(`${d}\r
23
- `);let{connect:u}=await a;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200){if(e.once("socket",Dn),t.secureEndpoint)return W("Upgrading socket connection to TLS"),ye.connect({...Lt(lt(t),"host","path","port"),socket:s});return s}throw s.destroy(),Error(`Proxy authentication failed with status ${u.statusCode} after retry`)}}pt.protocols=["http","https"];function Dn(e){setImmediate(()=>{e.resume()})}function Lt(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var Ht="<empty>",Za="thinking-binding-controls-2026-08-01",wn="[Reasoning redacted]",le=(e,t,o={})=>{let n=new M,s=Le(t);return(async()=>{let r={role:"assistant",content:[],api:"bedrock-converse-stream",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()},c=r.content,d=o.profile||o.env?.AWS_PROFILE,a={profile:d||_("AWS_PROFILE",o.env)},u=Wn(o),l=Boolean(_("AWS_PROFILE")),p=Vn(e.baseUrl),S=Gi(e.baseUrl,u,l);if(S)a.endpoint=e.baseUrl;let C=_("AWS_BEDROCK_SKIP_AUTH",o.env)==="1",T=o.bearerToken||o.apiKey||_("AWS_BEARER_TOKEN_BEDROCK",o.env)||void 0,E=T!==void 0&&!C;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){let y=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);if(y)a.region=y[1];else if(u)a.region=u;else if(p&&S)a.region=p;else if(!l)a.region="us-east-1";if(C)a.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"};let R=yi(o.env);if(!C&&R&&!d)a.credentials=R;let I=Cr(e.baseUrl,o.env);if(I)a.requestHandler=new wt.NodeHttpHandler({httpAgent:new _t(I),httpsAgent:new pt(I)});else if(_("AWS_BEDROCK_FORCE_HTTP1",o.env)==="1")a.requestHandler=new wt.NodeHttpHandler}else a.region=u||(p&&S?p:void 0)||"us-east-1";if(E)a.token={token:T},a.authSchemePreference=["httpBearerAuth"];let w;try{let y=e.compat?.supportsStrictMode??!1,R=new Ot(a),I=!1;if(o.onResponse)li(R,o.onResponse,e,()=>{I=!0});let K=fe(o.headers);if(K)di(R,K);let j=Ei(o.cacheRetention,o.env),z=o.maxTokens??(Ct(e)?e.maxTokens:void 0),U=pe(s.messages),qn=U?N(U):void 0,gt={modelId:e.id,messages:Ti(s,e,j,o.env),system:vi(qn,e,j,o.env),inferenceConfig:{...z!==void 0&&{maxTokens:z},...o.temperature!==void 0&&{temperature:o.temperature}},toolConfig:Ii(ne(s.messages),o.toolChoice,y),additionalModelRequestFields:Bi(e,o),...o.requestMetadata!==void 0&&{requestMetadata:o.requestMetadata}},Vt=await o?.onPayload?.(gt,e);if(Vt!==void 0)gt=Vt;let zn=new Nt(gt),J=await R.send(zn,{abortSignal:o.signal});if(w=Wt(J.$metadata.requestId),!I&&J.$metadata.httpStatusCode!==void 0){let m={};if(J.$metadata.requestId)m["x-amzn-requestid"]=J.$metadata.requestId;await o?.onResponse?.({status:J.$metadata.httpStatusCode,headers:m},e)}for await(let m of J.stream)if(await o.onProviderStreamEvent?.(m,e),m.messageStart){if(m.messageStart.role!==de.ASSISTANT)throw Error("Unexpected assistant message start but got user message start instead");n.push({type:"start",partial:r})}else if(m.contentBlockStart)pi(m.contentBlockStart,c,r,n);else if(m.contentBlockDelta)mi(m.contentBlockDelta,c,r,n);else if(m.contentBlockStop)gi(m.contentBlockStop,c,r,n);else if(m.messageStop){r.rawStopReason=m.messageStop.stopReason;let{stopReason:Yn,errorMessage:Kt}=ki(m.messageStop.stopReason);if(r.stopReason=Yn,Kt)r.errorMessage=Kt}else if(m.metadata)Ci(m.metadata,e,r);else if(m.internalServerException)throw m.internalServerException;else if(m.modelStreamErrorException)throw m.modelStreamErrorException;else if(m.validationException)throw m.validationException;else if(m.throttlingException)throw m.throttlingException;else if(m.serviceUnavailableException)throw m.serviceUnavailableException;if(o.signal?.aborted)throw Error("Request was aborted");if(r.stopReason==="pending")throw Error("Bedrock stream ended without a stop reason");if(r.stopReason==="error"||r.stopReason==="aborted")throw Error(r.errorMessage||"An unknown error occurred");for(let m of r.content)Un(m);n.push({type:"done",reason:r.stopReason,message:r}),n.end()}catch(y){for(let R of r.content)Un(R);if(r.stopReason=o.signal?.aborted?"aborted":"error",r.errorMessage=oi(y),r.stopReason==="error")si(r,y,w);n.push({type:"error",reason:r.stopReason,error:r}),n.end()}})(),n},ei={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},ti="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function oi(e){let t=q(e),o=!t.messageCarriesBody&&t.status!==void 0&&t.body!==void 0?`${t.status}: ${t.body}`:t.message,n=/data retention mode/i.test(o)?` See ${ti} for supported data retention modes.`:"";if(e instanceof f)return`${ei[e.name]??e.name}: ${o}${n}`;return`${o}${n}`}var ni=200;function Wt(e){if(typeof e!=="string")return;let t=e.trim();if(t.length===0||t.length>ni)return;return t}function ri(e){if(!(e instanceof Error)||!e.name.endsWith("Exception"))return;return Wt(e.name)}function si(e,t,o){let n=t?.$metadata,s={};if(typeof n?.httpStatusCode==="number")s.status=n.httpStatusCode;let r=ri(t);if(r!==void 0)s.errorCode=r;let c=Wt(n?.requestId)??o;if(c!==void 0)s.requestId=c;if(Object.keys(s).length===0)return;Te(e,{type:"bedrock_response_failure",timestamp:Date.now(),details:s})}var ii=new Set(["authorization","host"]);function ci(e){let t=e.toLowerCase();return t.startsWith("x-amz-")||ii.has(t)}function di(e,t){let o=(n)=>async(s)=>{let r=s.request;if(r&&typeof r==="object"&&"headers"in r){let c=r.headers;for(let[d,a]of Object.entries(t))if(!ci(d))c[d]=a}return n(s)};e.middlewareStack.add(o,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}function _i(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.statusCode==="number"&&!!t.headers&&typeof t.headers==="object"}function ui(e){if(!_i(e))return;return{status:e.statusCode,headers:{...e.headers}}}function li(e,t,o,n){let s=(r)=>async(c)=>{let d=await r(c),a=ui(d.response);if(a)n(),await t(a,o);return d};e.middlewareStack.add(s,{step:"deserialize",name:"pi-ai-response-headers"})}var $n=(e,t,o)=>{let n={...V(e,t,o,void 0),toolChoice:o?.toolChoice};if(!o?.reasoning)return le(e,t,{...n,reasoning:void 0});if(Ct(e)){if(Ut(e.id,e.name))return le(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets});let s=Or(n.maxTokens,e.maxTokens,o.reasoning,o.thinkingBudgets),r=Zt(e,t,s.maxTokens);return le(e,t,{...n,maxTokens:r,reasoning:o.reasoning,thinkingBudgets:{...o.thinkingBudgets||{},[Ao(o.reasoning)]:Math.min(s.thinkingBudget,Math.max(0,r-1024))}})}return le(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets})};function pi(e,t,o,n){let{contentBlockIndex:s,start:r}=e;if(r?.toolUse){let c={type:"toolCall",id:r.toolUse.toolUseId||"",name:r.toolUse.name||"",arguments:{},partialJson:"",index:s};o.content.push(c),n.push({type:"toolcall_start",contentIndex:t.length-1,partial:o})}}function mi(e,t,o,n){let{contentBlockIndex:s,delta:r}=e,c=t.findIndex((a)=>a.index===s),d=t[c];if(r?.text!==void 0){if(!d){let a={type:"text",text:"",index:s};o.content.push(a),c=t.length-1,d=t[c],n.push({type:"text_start",contentIndex:c,partial:o})}if(d.type==="text")d.text+=r.text,n.push({type:"text_delta",contentIndex:c,delta:r.text,partial:o})}else if(r?.toolUse&&d?.type==="toolCall")d.partialJson=(d.partialJson||"")+(r.toolUse.input||""),d.arguments=F(d.partialJson),n.push({type:"toolcall_delta",contentIndex:c,delta:r.toolUse.input||"",partial:o});else if(r?.reasoningContent){let a=d,u=c;if(!a){let l={type:"thinking",thinking:"",thinkingSignature:"",index:s};o.content.push(l),u=t.length-1,a=t[u],n.push({type:"thinking_start",contentIndex:u,partial:o})}if(a?.type==="thinking"){if(r.reasoningContent.text)a.thinking+=r.reasoningContent.text,n.push({type:"thinking_delta",contentIndex:u,delta:r.reasoningContent.text,partial:o});if(r.reasoningContent.signature&&!a.redacted)a.thinkingSignature=(a.thinkingSignature||"")+r.reasoningContent.signature;if(r.reasoningContent.redactedContent?.length){if(!a.redacted)a.redacted=!0,a.thinkingSignature="",a.thinking+=wn,n.push({type:"thinking_delta",contentIndex:u,delta:wn,partial:o});a.redactedChunks??=[],a.redactedChunks.push(r.reasoningContent.redactedContent)}}}}function Fn(e){if(e.type!=="thinking"||!e.redactedChunks)return;e.thinkingSignature=Di(e.redactedChunks),delete e.redactedChunks}function Un(e){delete e.index,delete e.partialJson,Fn(e)}function Ci(e,t,o){if(e.usage)o.usage.input=e.usage.inputTokens||0,o.usage.output=e.usage.outputTokens||0,o.usage.cacheRead=e.usage.cacheReadInputTokens||0,o.usage.cacheWrite=e.usage.cacheWriteInputTokens||0,o.usage.cacheWrite1h=e.usage.cacheDetails?.reduce((n,s)=>n+(s.ttl===ct.ONE_HOUR?s.inputTokens??0:0),0),o.usage.totalTokens=e.usage.totalTokens||o.usage.input+o.usage.output,Q(t,o.usage)}function gi(e,t,o,n){let s=t.findIndex((c)=>c.index===e.contentBlockIndex),r=t[s];if(!r)return;switch(delete r.index,r.type){case"text":n.push({type:"text_end",contentIndex:s,content:r.text,partial:o});break;case"thinking":Fn(r),n.push({type:"thinking_end",contentIndex:s,content:r.thinking,partial:o});break;case"toolCall":r.arguments=F(r.partialJson),delete r.partialJson,n.push({type:"toolcall_end",contentIndex:s,toolCall:r,partial:o});break}}function Ge(e,t){return(t?[e,t]:[e]).flatMap((n)=>{let s=n.toLowerCase();return[s,s.replace(/[\s_.:]+/g,"-")]})}function Ut(e,t){return Ge(e,t).some((n)=>n.includes("opus-4-6")||n.includes("opus-4-7")||n.includes("opus-4-8")||n.includes("opus-5")||n.includes("sonnet-4-6")||n.includes("sonnet-5")||n.includes("haiku-5")||n.includes("fable-5"))}function fi(e){return Ge(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function hi(e){return Ge(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function Si(e,t){if(t==="xhigh"&&fi(e))return"xhigh";let o=t?e.thinkingLevelMap?.[t]:void 0;if(typeof o==="string")return o;switch(t){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}function Ei(e,t){if(e)return e;if(_("PI_CACHE_RETENTION",t)==="long")return"long";return"short"}function Ct(e){let t=e.id.toLowerCase(),o=e.name?.toLowerCase()??"";return t.includes("anthropic.claude")||t.includes("anthropic/claude")||o.includes("anthropic.claude")||o.includes("anthropic/claude")||o.includes("claude")}function Hn(e,t){let o=Ge(e.id,e.name);if(!o.some((s)=>s.includes("claude"))){if(_("AWS_BEDROCK_FORCE_CACHE",t)==="1")return!0;return!1}if(o.some((s)=>s.includes("fable-5")||s.includes("opus-5")||s.includes("sonnet-5")||s.includes("haiku-5")))return!0;if(o.some((s)=>s.includes("-4-")))return!0;if(o.some((s)=>s.includes("claude-3-7-sonnet")))return!0;if(o.some((s)=>s.includes("claude-3-5-haiku")))return!0;return!1}function Ri(e){return Ct(e)}function vi(e,t,o,n){if(!e)return;let s=[{text:g(e)}];if(o!=="none"&&Hn(t,n))s.push({cachePoint:{type:Mt.DEFAULT,...o==="long"?{ttl:ct.ONE_HOUR}:{}}});return s}function Ai(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,"_");return t.length>64?t.slice(0,64):t}function mt(e){let t=g(e);return t.trim().length===0?void 0:{text:t}}function xi(e){return mt(e)??{text:Ht}}function bt(e){if(Array.isArray(e))return e.map(bt);if(e!==null&&typeof e==="object")return Object.fromEntries(Object.entries(e).filter(([t])=>t.length>0).map(([t,o])=>[t,bt(o)]));return e}function bn(e){let t=[];for(let o of e)if(o.type==="image")t.push({image:Kn(o.mimeType,o.data)});else{let n=mt(o.text);if(n)t.push(n)}if(t.length===0)t.push({text:Ht});return t}function Ti(e,t,o,n){let s=[],r=he($t(e.messages),t,Ai);for(let c=0;c<r.length;c++){let d=r[c];switch(d.role){case"user":{let a=[];if(typeof d.content==="string")a.push(xi(d.content));else{for(let u of d.content)switch(u.type){case"text":{let l=mt(u.text);if(l)a.push(l);break}case"image":a.push({image:Kn(u.mimeType,u.data)});break;default:continue}if(a.length===0)a.push({text:Ht})}s.push({role:de.USER,content:a});break}case"assistant":{if(d.content.length===0)continue;let a=[];for(let u of d.content)switch(u.type){case"text":{let l=mt(u.text);if(!l)continue;a.push(l);break}case"toolCall":a.push({toolUse:{toolUseId:u.id,name:u.name,input:bt(u.arguments)}});break;case"thinking":{if(u.redacted){let p=Mi(u.thinkingSignature);if(p?.length)a.push({reasoningContent:{redactedContent:p}});continue}let l=g(u.thinking);if(l.trim().length===0)continue;if(Ri(t))if(!u.thinkingSignature||u.thinkingSignature.trim().length===0)a.push({text:l});else a.push({reasoningContent:{reasoningText:{text:l,signature:u.thinkingSignature}}});else a.push({reasoningContent:{reasoningText:{text:l}}});break}default:continue}if(a.length===0)continue;s.push({role:de.ASSISTANT,content:a});break}case"toolResult":{let a=[];a.push({toolResult:{toolUseId:d.toolCallId,content:bn(d.content),status:d.isError?Ie.ERROR:Ie.SUCCESS}});let u=c+1;while(u<r.length&&r[u].role==="toolResult"){let l=r[u];a.push({toolResult:{toolUseId:l.toolCallId,content:bn(l.content),status:l.isError?Ie.ERROR:Ie.SUCCESS}}),u++}c=u-1,s.push({role:de.USER,content:a});break}default:continue}}if(o!=="none"&&Hn(t,n)&&s.length>0){let c=s[s.length-1];if(c.role===de.USER&&c.content)c.content.push({cachePoint:{type:Mt.DEFAULT,...o==="long"?{ttl:ct.ONE_HOUR}:{}}})}return s}function Ii(e,t,o){if(!e?.length)return;if(t==="none")return;let n=e.map((r)=>{let c=ce(r,o);return{toolSpec:{name:r.name,description:r.description,inputSchema:{json:me(r,c)},...c===!0?{strict:!0}:{}}}}),s;switch(t){case"auto":s={auto:{}};break;case"any":s={any:{}};break;default:if(t?.type==="tool")s={tool:{name:t.name}}}return{tools:n,toolChoice:s}}function ki(e){switch(e){case _e.END_TURN:case _e.STOP_SEQUENCE:return{stopReason:"stop"};case _e.MAX_TOKENS:case _e.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case _e.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:`Provider stopped with: ${e}`}:{stopReason:"error"}}}function Wn(e){return e.region||_("AWS_REGION",e.env)||_("AWS_DEFAULT_REGION",e.env)||void 0}function yi(e){let t=_("AWS_ACCESS_KEY_ID",e),o=_("AWS_SECRET_ACCESS_KEY",e);if(!t||!o)return;let n=_("AWS_SESSION_TOKEN",e);return{accessKeyId:t,secretAccessKey:o,...n?{sessionToken:n}:{}}}function Vn(e){if(!e)return;try{let{hostname:t}=new URL(e);return t.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}function Gi(e,t,o){if(!Vn(e))return!0;return!t&&!o}function Pi(e,t){if(Wn(t)?.toLowerCase().startsWith("us-gov-"))return!0;let n=e.id.toLowerCase();return n.startsWith("us-gov.")||n.startsWith("arn:aws-us-gov:")}function Bi(e,t){if(!t.reasoning||!e.reasoning)return;if(Ct(e)){let n=Pi(e,t),s=n?void 0:t.thinkingDisplay??"summarized",r=!n&&hi(e),c=Ut(e.id,e.name)?{thinking:{type:"adaptive",...s!==void 0?{display:s}:{},...r?{block_binding:{prefix_mismatch_behavior:"drop_block"}}:{}},output_config:{effort:Si(e,t.reasoning)},...r?{anthropic_beta:[Za]}:{}}:(()=>{let d={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},a=t.reasoning==="xhigh"||t.reasoning==="max"?"high":t.reasoning;return{thinking:{type:"enabled",budget_tokens:t.thinkingBudgets?.[a]??d[t.reasoning],...s!==void 0?{display:s}:{}}}})();if(!Ut(e.id,e.name)&&(t.interleavedThinking??!0))c.anthropic_beta=["interleaved-thinking-2025-05-14"];return c}let o=Ge(e.id,e.name);if(o.some((n)=>n.includes("gpt-oss")))return{reasoning_effort:Ni[t.reasoning]};if(o.some((n)=>n.includes("gpt-"))){let n=e.thinkingLevelMap?.[t.reasoning];return{reasoning:{effort:typeof n==="string"?n:Oi[t.reasoning]}}}return}var Oi={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},Ni={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"high",max:"high"};function Kn(e,t){let o;switch(e){case"image/jpeg":case"image/jpg":o=xe.JPEG;break;case"image/png":o=xe.PNG;break;case"image/gif":o=xe.GIF;break;case"image/webp":o=xe.WEBP;break;default:throw Error(`Unknown image type: ${e}`)}return{source:{bytes:Xn(t)},format:o}}function Xn(e){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return o}function Mi(e){if(!e)return;try{return Xn(e)}catch{return}}function Di(e){let o="";for(let n of e)for(let s=0;s<n.length;s+=32768)o+=String.fromCharCode(...n.subarray(s,s+32768));return btoa(o)}var jn={stream:le,streamSimple:$n};ai(jn);await import("./chunk-shhrr741.js");
23
+ `);let{connect:u}=await a;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200){if(e.once("socket",Dn),t.secureEndpoint)return W("Upgrading socket connection to TLS"),ye.connect({...Lt(lt(t),"host","path","port"),socket:s});return s}throw s.destroy(),Error(`Proxy authentication failed with status ${u.statusCode} after retry`)}}pt.protocols=["http","https"];function Dn(e){setImmediate(()=>{e.resume()})}function Lt(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var Ht="<empty>",Za="thinking-binding-controls-2026-08-01",wn="[Reasoning redacted]",le=(e,t,o={})=>{let n=new M,s=Le(t);return(async()=>{let r={role:"assistant",content:[],api:"bedrock-converse-stream",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()},c=r.content,d=o.profile||o.env?.AWS_PROFILE,a={profile:d||_("AWS_PROFILE",o.env)},u=Wn(o),l=Boolean(_("AWS_PROFILE")),p=Vn(e.baseUrl),S=Gi(e.baseUrl,u,l);if(S)a.endpoint=e.baseUrl;let C=_("AWS_BEDROCK_SKIP_AUTH",o.env)==="1",T=o.bearerToken||o.apiKey||_("AWS_BEARER_TOKEN_BEDROCK",o.env)||void 0,E=T!==void 0&&!C;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){let y=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);if(y)a.region=y[1];else if(u)a.region=u;else if(p&&S)a.region=p;else if(!l)a.region="us-east-1";if(C)a.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"};let R=yi(o.env);if(!C&&R&&!d)a.credentials=R;let I=Cr(e.baseUrl,o.env);if(I)a.requestHandler=new wt.NodeHttpHandler({httpAgent:new _t(I),httpsAgent:new pt(I)});else if(_("AWS_BEDROCK_FORCE_HTTP1",o.env)==="1")a.requestHandler=new wt.NodeHttpHandler}else a.region=u||(p&&S?p:void 0)||"us-east-1";if(E)a.token={token:T},a.authSchemePreference=["httpBearerAuth"];let w;try{let y=e.compat?.supportsStrictMode??!1,R=new Ot(a),I=!1;if(o.onResponse)li(R,o.onResponse,e,()=>{I=!0});let K=fe(o.headers);if(K)di(R,K);let j=Ei(o.cacheRetention,o.env),z=o.maxTokens??(Ct(e)?e.maxTokens:void 0),U=pe(s.messages),qn=U?N(U):void 0,gt={modelId:e.id,messages:Ti(s,e,j,o.env),system:vi(qn,e,j,o.env),inferenceConfig:{...z!==void 0&&{maxTokens:z},...o.temperature!==void 0&&{temperature:o.temperature}},toolConfig:Ii(ne(s.messages),o.toolChoice,y),additionalModelRequestFields:Bi(e,o),...o.requestMetadata!==void 0&&{requestMetadata:o.requestMetadata}},Vt=await o?.onPayload?.(gt,e);if(Vt!==void 0)gt=Vt;let zn=new Nt(gt),J=await R.send(zn,{abortSignal:o.signal});if(w=Wt(J.$metadata.requestId),!I&&J.$metadata.httpStatusCode!==void 0){let m={};if(J.$metadata.requestId)m["x-amzn-requestid"]=J.$metadata.requestId;await o?.onResponse?.({status:J.$metadata.httpStatusCode,headers:m},e)}for await(let m of J.stream)if(await o.onProviderStreamEvent?.(m,e),m.messageStart){if(m.messageStart.role!==de.ASSISTANT)throw Error("Unexpected assistant message start but got user message start instead");n.push({type:"start",partial:r})}else if(m.contentBlockStart)pi(m.contentBlockStart,c,r,n);else if(m.contentBlockDelta)mi(m.contentBlockDelta,c,r,n);else if(m.contentBlockStop)gi(m.contentBlockStop,c,r,n);else if(m.messageStop){r.rawStopReason=m.messageStop.stopReason;let{stopReason:Yn,errorMessage:Kt}=ki(m.messageStop.stopReason);if(r.stopReason=Yn,Kt)r.errorMessage=Kt}else if(m.metadata)Ci(m.metadata,e,r);else if(m.internalServerException)throw m.internalServerException;else if(m.modelStreamErrorException)throw m.modelStreamErrorException;else if(m.validationException)throw m.validationException;else if(m.throttlingException)throw m.throttlingException;else if(m.serviceUnavailableException)throw m.serviceUnavailableException;if(o.signal?.aborted)throw Error("Request was aborted");if(r.stopReason==="pending")throw Error("Bedrock stream ended without a stop reason");if(r.stopReason==="error"||r.stopReason==="aborted")throw Error(r.errorMessage||"An unknown error occurred");for(let m of r.content)Un(m);n.push({type:"done",reason:r.stopReason,message:r}),n.end()}catch(y){for(let R of r.content)Un(R);if(r.stopReason=o.signal?.aborted?"aborted":"error",r.errorMessage=oi(y),r.stopReason==="error")si(r,y,w);n.push({type:"error",reason:r.stopReason,error:r}),n.end()}})(),n},ei={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},ti="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function oi(e){let t=q(e),o=!t.messageCarriesBody&&t.status!==void 0&&t.body!==void 0?`${t.status}: ${t.body}`:t.message,n=/data retention mode/i.test(o)?` See ${ti} for supported data retention modes.`:"";if(e instanceof f)return`${ei[e.name]??e.name}: ${o}${n}`;return`${o}${n}`}var ni=200;function Wt(e){if(typeof e!=="string")return;let t=e.trim();if(t.length===0||t.length>ni)return;return t}function ri(e){if(!(e instanceof Error)||!e.name.endsWith("Exception"))return;return Wt(e.name)}function si(e,t,o){let n=t?.$metadata,s={};if(typeof n?.httpStatusCode==="number")s.status=n.httpStatusCode;let r=ri(t);if(r!==void 0)s.errorCode=r;let c=Wt(n?.requestId)??o;if(c!==void 0)s.requestId=c;if(Object.keys(s).length===0)return;Te(e,{type:"bedrock_response_failure",timestamp:Date.now(),details:s})}var ii=new Set(["authorization","host"]);function ci(e){let t=e.toLowerCase();return t.startsWith("x-amz-")||ii.has(t)}function di(e,t){let o=(n)=>async(s)=>{let r=s.request;if(r&&typeof r==="object"&&"headers"in r){let c=r.headers;for(let[d,a]of Object.entries(t))if(!ci(d))c[d]=a}return n(s)};e.middlewareStack.add(o,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}function _i(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.statusCode==="number"&&!!t.headers&&typeof t.headers==="object"}function ui(e){if(!_i(e))return;return{status:e.statusCode,headers:{...e.headers}}}function li(e,t,o,n){let s=(r)=>async(c)=>{let d=await r(c),a=ui(d.response);if(a)n(),await t(a,o);return d};e.middlewareStack.add(s,{step:"deserialize",name:"pi-ai-response-headers"})}var $n=(e,t,o)=>{let n={...V(e,t,o,void 0),toolChoice:o?.toolChoice};if(!o?.reasoning)return le(e,t,{...n,reasoning:void 0});if(Ct(e)){if(Ut(e.id,e.name))return le(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets});let s=Or(n.maxTokens,e.maxTokens,o.reasoning,o.thinkingBudgets),r=Zt(e,t,s.maxTokens);return le(e,t,{...n,maxTokens:r,reasoning:o.reasoning,thinkingBudgets:{...o.thinkingBudgets||{},[Ao(o.reasoning)]:Math.min(s.thinkingBudget,Math.max(0,r-1024))}})}return le(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets})};function pi(e,t,o,n){let{contentBlockIndex:s,start:r}=e;if(r?.toolUse){let c={type:"toolCall",id:r.toolUse.toolUseId||"",name:r.toolUse.name||"",arguments:{},partialJson:"",index:s};o.content.push(c),n.push({type:"toolcall_start",contentIndex:t.length-1,partial:o})}}function mi(e,t,o,n){let{contentBlockIndex:s,delta:r}=e,c=t.findIndex((a)=>a.index===s),d=t[c];if(r?.text!==void 0){if(!d){let a={type:"text",text:"",index:s};o.content.push(a),c=t.length-1,d=t[c],n.push({type:"text_start",contentIndex:c,partial:o})}if(d.type==="text")d.text+=r.text,n.push({type:"text_delta",contentIndex:c,delta:r.text,partial:o})}else if(r?.toolUse&&d?.type==="toolCall")d.partialJson=(d.partialJson||"")+(r.toolUse.input||""),d.arguments=F(d.partialJson),n.push({type:"toolcall_delta",contentIndex:c,delta:r.toolUse.input||"",partial:o});else if(r?.reasoningContent){let a=d,u=c;if(!a){let l={type:"thinking",thinking:"",thinkingSignature:"",index:s};o.content.push(l),u=t.length-1,a=t[u],n.push({type:"thinking_start",contentIndex:u,partial:o})}if(a?.type==="thinking"){if(r.reasoningContent.text)a.thinking+=r.reasoningContent.text,n.push({type:"thinking_delta",contentIndex:u,delta:r.reasoningContent.text,partial:o});if(r.reasoningContent.signature&&!a.redacted)a.thinkingSignature=(a.thinkingSignature||"")+r.reasoningContent.signature;if(r.reasoningContent.redactedContent?.length){if(!a.redacted)a.redacted=!0,a.thinkingSignature="",a.thinking+=wn,n.push({type:"thinking_delta",contentIndex:u,delta:wn,partial:o});a.redactedChunks??=[],a.redactedChunks.push(r.reasoningContent.redactedContent)}}}}function Fn(e){if(e.type!=="thinking"||!e.redactedChunks)return;e.thinkingSignature=Di(e.redactedChunks),delete e.redactedChunks}function Un(e){delete e.index,delete e.partialJson,Fn(e)}function Ci(e,t,o){if(e.usage)o.usage.input=e.usage.inputTokens||0,o.usage.output=e.usage.outputTokens||0,o.usage.cacheRead=e.usage.cacheReadInputTokens||0,o.usage.cacheWrite=e.usage.cacheWriteInputTokens||0,o.usage.cacheWrite1h=e.usage.cacheDetails?.reduce((n,s)=>n+(s.ttl===ct.ONE_HOUR?s.inputTokens??0:0),0),o.usage.totalTokens=e.usage.totalTokens||o.usage.input+o.usage.output,Q(t,o.usage)}function gi(e,t,o,n){let s=t.findIndex((c)=>c.index===e.contentBlockIndex),r=t[s];if(!r)return;switch(delete r.index,r.type){case"text":n.push({type:"text_end",contentIndex:s,content:r.text,partial:o});break;case"thinking":Fn(r),n.push({type:"thinking_end",contentIndex:s,content:r.thinking,partial:o});break;case"toolCall":r.arguments=F(r.partialJson),delete r.partialJson,n.push({type:"toolcall_end",contentIndex:s,toolCall:r,partial:o});break}}function Ge(e,t){return(t?[e,t]:[e]).flatMap((n)=>{let s=n.toLowerCase();return[s,s.replace(/[\s_.:]+/g,"-")]})}function Ut(e,t){return Ge(e,t).some((n)=>n.includes("opus-4-6")||n.includes("opus-4-7")||n.includes("opus-4-8")||n.includes("opus-5")||n.includes("sonnet-4-6")||n.includes("sonnet-5")||n.includes("haiku-5")||n.includes("fable-5"))}function fi(e){return Ge(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function hi(e){return Ge(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function Si(e,t){if(t==="xhigh"&&fi(e))return"xhigh";let o=t?e.thinkingLevelMap?.[t]:void 0;if(typeof o==="string")return o;switch(t){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}function Ei(e,t){if(e)return e;if(_("PI_CACHE_RETENTION",t)==="long")return"long";return"short"}function Ct(e){let t=e.id.toLowerCase(),o=e.name?.toLowerCase()??"";return t.includes("anthropic.claude")||t.includes("anthropic/claude")||o.includes("anthropic.claude")||o.includes("anthropic/claude")||o.includes("claude")}function Hn(e,t){let o=Ge(e.id,e.name);if(!o.some((s)=>s.includes("claude"))){if(_("AWS_BEDROCK_FORCE_CACHE",t)==="1")return!0;return!1}if(o.some((s)=>s.includes("fable-5")||s.includes("opus-5")||s.includes("sonnet-5")||s.includes("haiku-5")))return!0;if(o.some((s)=>s.includes("-4-")))return!0;if(o.some((s)=>s.includes("claude-3-7-sonnet")))return!0;if(o.some((s)=>s.includes("claude-3-5-haiku")))return!0;return!1}function Ri(e){return Ct(e)}function vi(e,t,o,n){if(!e)return;let s=[{text:g(e)}];if(o!=="none"&&Hn(t,n))s.push({cachePoint:{type:Mt.DEFAULT,...o==="long"?{ttl:ct.ONE_HOUR}:{}}});return s}function Ai(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,"_");return t.length>64?t.slice(0,64):t}function mt(e){let t=g(e);return t.trim().length===0?void 0:{text:t}}function xi(e){return mt(e)??{text:Ht}}function bt(e){if(Array.isArray(e))return e.map(bt);if(e!==null&&typeof e==="object")return Object.fromEntries(Object.entries(e).filter(([t])=>t.length>0).map(([t,o])=>[t,bt(o)]));return e}function bn(e){let t=[];for(let o of e)if(o.type==="image")t.push({image:Kn(o.mimeType,o.data)});else{let n=mt(o.text);if(n)t.push(n)}if(t.length===0)t.push({text:Ht});return t}function Ti(e,t,o,n){let s=[],r=he($t(e.messages),t,Ai);for(let c=0;c<r.length;c++){let d=r[c];switch(d.role){case"user":{let a=[];if(typeof d.content==="string")a.push(xi(d.content));else{for(let u of d.content)switch(u.type){case"text":{let l=mt(u.text);if(l)a.push(l);break}case"image":a.push({image:Kn(u.mimeType,u.data)});break;default:continue}if(a.length===0)a.push({text:Ht})}s.push({role:de.USER,content:a});break}case"assistant":{if(d.content.length===0)continue;let a=[];for(let u of d.content)switch(u.type){case"text":{let l=mt(u.text);if(!l)continue;a.push(l);break}case"toolCall":a.push({toolUse:{toolUseId:u.id,name:u.name,input:bt(u.arguments)}});break;case"thinking":{if(u.redacted){let p=Mi(u.thinkingSignature);if(p?.length)a.push({reasoningContent:{redactedContent:p}});continue}let l=g(u.thinking);if(l.trim().length===0)continue;if(Ri(t))if(!u.thinkingSignature||u.thinkingSignature.trim().length===0)a.push({text:l});else a.push({reasoningContent:{reasoningText:{text:l,signature:u.thinkingSignature}}});else a.push({reasoningContent:{reasoningText:{text:l}}});break}default:continue}if(a.length===0)continue;s.push({role:de.ASSISTANT,content:a});break}case"toolResult":{let a=[];a.push({toolResult:{toolUseId:d.toolCallId,content:bn(d.content),status:d.isError?Ie.ERROR:Ie.SUCCESS}});let u=c+1;while(u<r.length&&r[u].role==="toolResult"){let l=r[u];a.push({toolResult:{toolUseId:l.toolCallId,content:bn(l.content),status:l.isError?Ie.ERROR:Ie.SUCCESS}}),u++}c=u-1,s.push({role:de.USER,content:a});break}default:continue}}if(o!=="none"&&Hn(t,n)&&s.length>0){let c=s[s.length-1];if(c.role===de.USER&&c.content)c.content.push({cachePoint:{type:Mt.DEFAULT,...o==="long"?{ttl:ct.ONE_HOUR}:{}}})}return s}function Ii(e,t,o){if(!e?.length)return;if(t==="none")return;let n=e.map((r)=>{let c=ce(r,o);return{toolSpec:{name:r.name,description:r.description,inputSchema:{json:me(r,c)},...c===!0?{strict:!0}:{}}}}),s;switch(t){case"auto":s={auto:{}};break;case"any":s={any:{}};break;default:if(t?.type==="tool")s={tool:{name:t.name}}}return{tools:n,toolChoice:s}}function ki(e){switch(e){case _e.END_TURN:case _e.STOP_SEQUENCE:return{stopReason:"stop"};case _e.MAX_TOKENS:case _e.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case _e.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:`Provider stopped with: ${e}`}:{stopReason:"error"}}}function Wn(e){return e.region||_("AWS_REGION",e.env)||_("AWS_DEFAULT_REGION",e.env)||void 0}function yi(e){let t=_("AWS_ACCESS_KEY_ID",e),o=_("AWS_SECRET_ACCESS_KEY",e);if(!t||!o)return;let n=_("AWS_SESSION_TOKEN",e);return{accessKeyId:t,secretAccessKey:o,...n?{sessionToken:n}:{}}}function Vn(e){if(!e)return;try{let{hostname:t}=new URL(e);return t.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}function Gi(e,t,o){if(!Vn(e))return!0;return!t&&!o}function Pi(e,t){if(Wn(t)?.toLowerCase().startsWith("us-gov-"))return!0;let n=e.id.toLowerCase();return n.startsWith("us-gov.")||n.startsWith("arn:aws-us-gov:")}function Bi(e,t){if(!t.reasoning||!e.reasoning)return;if(Ct(e)){let n=Pi(e,t),s=n?void 0:t.thinkingDisplay??"summarized",r=!n&&hi(e),c=Ut(e.id,e.name)?{thinking:{type:"adaptive",...s!==void 0?{display:s}:{},...r?{block_binding:{prefix_mismatch_behavior:"drop_block"}}:{}},output_config:{effort:Si(e,t.reasoning)},...r?{anthropic_beta:[Za]}:{}}:(()=>{let d={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},a=t.reasoning==="xhigh"||t.reasoning==="max"?"high":t.reasoning;return{thinking:{type:"enabled",budget_tokens:t.thinkingBudgets?.[a]??d[t.reasoning],...s!==void 0?{display:s}:{}}}})();if(!Ut(e.id,e.name)&&(t.interleavedThinking??!0))c.anthropic_beta=["interleaved-thinking-2025-05-14"];return c}let o=Ge(e.id,e.name);if(o.some((n)=>n.includes("gpt-oss")))return{reasoning_effort:Ni[t.reasoning]};if(o.some((n)=>n.includes("gpt-"))){let n=e.thinkingLevelMap?.[t.reasoning];return{reasoning:{effort:typeof n==="string"?n:Oi[t.reasoning]}}}return}var Oi={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},Ni={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"high",max:"high"};function Kn(e,t){let o;switch(e){case"image/jpeg":case"image/jpg":o=xe.JPEG;break;case"image/png":o=xe.PNG;break;case"image/gif":o=xe.GIF;break;case"image/webp":o=xe.WEBP;break;default:throw Error(`Unknown image type: ${e}`)}return{source:{bytes:Xn(t)},format:o}}function Xn(e){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return o}function Mi(e){if(!e)return;try{return Xn(e)}catch{return}}function Di(e){let o="";for(let n of e)for(let s=0;s<n.length;s+=32768)o+=String.fromCharCode(...n.subarray(s,s+32768));return btoa(o)}var jn={stream:le,streamSimple:$n};ai(jn);await import("./chunk-bxn5kmpz.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bkm016/basalt",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first AI software engineering agent runtime and web workbench",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- import{e,r,Le,O,Kt,y,C,S,E,T,A,I,L,s,p,N,Fe,ce,ae,ie,Ye,ge,ye}from"./chunk-9dd1c37b.js";import{Pt}from"./chunk-jvj66qhs.js";import{je}from"./chunk-shbw6wg8.js";import{he}from"./chunk-ctcrk3qn.js";import{se}from"./chunk-anbn2ttv.js";var tt=function(){var i=e(function(W,b,k,m){for(k=k||{},m=W.length;m--;k[W[m]]=b);return k},"o"),n=[1,18],l=[1,19],u=[1,20],o=[1,41],d=[1,26],f=[1,42],h=[1,24],D=[1,25],F=[1,32],R=[1,33],J=[1,34],_=[1,45],Oe=[1,35],we=[1,36],Me=[1,37],Pe=[1,38],Ve=[1,27],Re=[1,28],Ge=[1,29],Ue=[1,30],ze=[1,31],x=[1,44],v=[1,46],w=[1,43],M=[1,47],Ke=[1,9],g=[1,8,9],be=[1,58],fe=[1,59],ke=[1,60],me=[1,61],Ce=[1,62],We=[1,63],Qe=[1,64],G=[1,8,9,41],st=[1,77],H=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],Ee=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],Te=[13,60,86,100,102,103],Z=[13,60,73,74,86,100,102,103],it=[13,60,68,69,70,71,72,86,100,102,103],De=[1,103],ee=[1,121],te=[1,117],re=[1,113],ne=[1,119],le=[1,114],ue=[1,115],oe=[1,116],de=[1,118],pe=[1,120],at=[22,50,60,61,82,86,87,88,89,90],rt=[1,128],Be=[12,39],Xe=[1,8,9,39,41,44,46],_e=[1,8,9,22],nt=[1,153],lt=[1,8,9,61],Y=[1,8,9,22,50,60,61,82,86,87,88,89,90],He={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:e(function(b,k,m,c,B,t,Ae){var a=t.length-1;switch(B){case 8:this.$=t[a-1];break;case 9:case 10:case 13:case 15:this.$=t[a];break;case 11:case 14:this.$=t[a-2]+"."+t[a];break;case 12:case 16:this.$=t[a-1]+t[a];break;case 17:case 18:this.$=t[a-1]+"~"+t[a]+"~";break;case 19:c.addRelation(t[a]);break;case 20:t[a-1].title=c.cleanupLabel(t[a]),c.addRelation(t[a-1]);break;case 31:this.$=t[a].trim(),c.setAccTitle(this.$);break;case 32:case 33:this.$=t[a].trim(),c.setAccDescription(this.$);break;case 34:c.addClassesToNamespace(t[a-3],t[a-1][0],t[a-1][1]),c.popNamespace();break;case 35:c.addClassesToNamespace(t[a-4],t[a-1][0],t[a-1][1]),c.popNamespace();break;case 36:this.$=c.addNamespace(t[a]);break;case 37:this.$=c.addNamespace(t[a-1],t[a]);break;case 38:this.$=[[t[a]],[]];break;case 39:this.$=[[t[a-1]],[]];break;case 40:t[a][0].unshift(t[a-2]),this.$=t[a];break;case 41:this.$=[[],[t[a]]];break;case 42:this.$=[[],[t[a-1]]];break;case 43:t[a][1].unshift(t[a-2]),this.$=t[a];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=t[a];break;case 48:c.setCssClass(t[a-2],t[a]);break;case 49:c.addMembers(t[a-3],t[a-1]);break;case 51:c.setCssClass(t[a-5],t[a-3]),c.addMembers(t[a-5],t[a-1]);break;case 52:c.addAnnotation(t[a-3],t[a-1]);break;case 53:c.addAnnotation(t[a-6],t[a-4]),c.addMembers(t[a-6],t[a-1]);break;case 54:c.addAnnotation(t[a-5],t[a-3]);break;case 55:this.$=t[a],c.addClass(t[a]);break;case 56:this.$=t[a-1],c.addClass(t[a-1]),c.setClassLabel(t[a-1],t[a]);break;case 60:c.addAnnotation(t[a],t[a-2]);break;case 61:case 74:this.$=[t[a]];break;case 62:t[a].push(t[a-1]),this.$=t[a];break;case 63:break;case 64:c.addMember(t[a-1],c.cleanupLabel(t[a]));break;case 65:break;case 66:break;case 67:this.$={id1:t[a-2],id2:t[a],relation:t[a-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:t[a-3],id2:t[a],relation:t[a-1],relationTitle1:t[a-2],relationTitle2:"none"};break;case 69:this.$={id1:t[a-3],id2:t[a],relation:t[a-2],relationTitle1:"none",relationTitle2:t[a-1]};break;case 70:this.$={id1:t[a-4],id2:t[a],relation:t[a-2],relationTitle1:t[a-3],relationTitle2:t[a-1]};break;case 71:this.$=c.addNote(t[a],t[a-1]);break;case 72:this.$=c.addNote(t[a]);break;case 73:this.$=t[a-2],c.defineClass(t[a-1],t[a]);break;case 75:this.$=t[a-2].concat([t[a]]);break;case 76:c.setDirection("TB");break;case 77:c.setDirection("BT");break;case 78:c.setDirection("RL");break;case 79:c.setDirection("LR");break;case 80:this.$={type1:t[a-2],type2:t[a],lineType:t[a-1]};break;case 81:this.$={type1:"none",type2:t[a],lineType:t[a-1]};break;case 82:this.$={type1:t[a-1],type2:"none",lineType:t[a]};break;case 83:this.$={type1:"none",type2:"none",lineType:t[a]};break;case 84:this.$=c.relationType.AGGREGATION;break;case 85:this.$=c.relationType.EXTENSION;break;case 86:this.$=c.relationType.COMPOSITION;break;case 87:this.$=c.relationType.DEPENDENCY;break;case 88:this.$=c.relationType.LOLLIPOP;break;case 89:this.$=c.lineType.LINE;break;case 90:this.$=c.lineType.DOTTED_LINE;break;case 91:case 97:this.$=t[a-2],c.setClickEvent(t[a-1],t[a]);break;case 92:case 98:this.$=t[a-3],c.setClickEvent(t[a-2],t[a-1]),c.setTooltip(t[a-2],t[a]);break;case 93:this.$=t[a-2],c.setLink(t[a-1],t[a]);break;case 94:this.$=t[a-3],c.setLink(t[a-2],t[a-1],t[a]);break;case 95:this.$=t[a-3],c.setLink(t[a-2],t[a-1]),c.setTooltip(t[a-2],t[a]);break;case 96:this.$=t[a-4],c.setLink(t[a-3],t[a-2],t[a]),c.setTooltip(t[a-3],t[a-1]);break;case 99:this.$=t[a-3],c.setClickEvent(t[a-2],t[a-1],t[a]);break;case 100:this.$=t[a-4],c.setClickEvent(t[a-3],t[a-2],t[a-1]),c.setTooltip(t[a-3],t[a]);break;case 101:this.$=t[a-3],c.setLink(t[a-2],t[a]);break;case 102:this.$=t[a-4],c.setLink(t[a-3],t[a-1],t[a]);break;case 103:this.$=t[a-4],c.setLink(t[a-3],t[a-1]),c.setTooltip(t[a-3],t[a]);break;case 104:this.$=t[a-5],c.setLink(t[a-4],t[a-2],t[a]),c.setTooltip(t[a-4],t[a-1]);break;case 105:this.$=t[a-2],c.setCssStyle(t[a-1],t[a]);break;case 106:c.setCssClass(t[a-1],t[a]);break;case 107:this.$=[t[a]];break;case 108:t[a-2].push(t[a]),this.$=t[a-2];break;case 110:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:n,35:l,37:u,38:22,42:o,43:23,46:d,48:f,51:h,52:D,54:F,56:R,57:J,60:_,62:Oe,63:we,64:Me,65:Pe,75:Ve,76:Re,78:Ge,82:Ue,83:ze,86:x,100:v,102:w,103:M},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},i(Ke,[2,5],{8:[1,48]}),{8:[1,49]},i(g,[2,19],{22:[1,50]}),i(g,[2,21]),i(g,[2,22]),i(g,[2,23]),i(g,[2,24]),i(g,[2,25]),i(g,[2,26]),i(g,[2,27]),i(g,[2,28]),i(g,[2,29]),i(g,[2,30]),{34:[1,51]},{36:[1,52]},i(g,[2,33]),i(g,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:be,69:fe,70:ke,71:me,72:Ce,73:We,74:Qe}),{39:[1,65]},i(G,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),i(g,[2,65]),i(g,[2,66]),{16:69,60:_,86:x,100:v,102:w},{16:39,17:40,19:70,60:_,86:x,100:v,102:w,103:M},{16:39,17:40,19:71,60:_,86:x,100:v,102:w,103:M},{16:39,17:40,19:72,60:_,86:x,100:v,102:w,103:M},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:_,86:x,100:v,102:w,103:M},{13:st,55:76},{58:78,60:[1,79]},i(g,[2,76]),i(g,[2,77]),i(g,[2,78]),i(g,[2,79]),i(H,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:_,86:x,100:v,102:w,103:M}),i(H,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:_,86:x,100:v,102:w,103:M},{16:39,17:40,19:87,60:_,86:x,100:v,102:w,103:M},i(Ee,[2,133]),i(Ee,[2,134]),i(Ee,[2,135]),i(Ee,[2,136]),i([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),i(Ke,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:n,35:l,37:u,42:o,46:d,48:f,51:h,52:D,54:F,56:R,57:J,60:_,62:Oe,63:we,64:Me,65:Pe,75:Ve,76:Re,78:Ge,82:Ue,83:ze,86:x,100:v,102:w,103:M}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:n,35:l,37:u,38:22,42:o,43:23,46:d,48:f,51:h,52:D,54:F,56:R,57:J,60:_,62:Oe,63:we,64:Me,65:Pe,75:Ve,76:Re,78:Ge,82:Ue,83:ze,86:x,100:v,102:w,103:M},i(g,[2,20]),i(g,[2,31]),i(g,[2,32]),{13:[1,91],16:39,17:40,19:90,60:_,86:x,100:v,102:w,103:M},{53:92,66:56,67:57,68:be,69:fe,70:ke,71:me,72:Ce,73:We,74:Qe},i(g,[2,64]),{67:93,73:We,74:Qe},i(Te,[2,83],{66:94,68:be,69:fe,70:ke,71:me,72:Ce}),i(Z,[2,84]),i(Z,[2,85]),i(Z,[2,86]),i(Z,[2,87]),i(Z,[2,88]),i(it,[2,89]),i(it,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:o,43:23,48:f,54:F,56:R},{16:100,60:_,86:x,100:v,102:w},{41:[1,102],45:101,51:De},{16:104,60:_,86:x,100:v,102:w},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:ee,50:te,59:110,60:re,82:ne,84:111,85:112,86:le,87:ue,88:oe,89:de,90:pe},{60:[1,122]},{13:st,55:123},i(G,[2,72]),i(G,[2,138]),{22:ee,50:te,59:124,60:re,61:[1,125],82:ne,84:111,85:112,86:le,87:ue,88:oe,89:de,90:pe},i(at,[2,74]),{16:39,17:40,19:126,60:_,86:x,100:v,102:w,103:M},i(H,[2,16]),i(H,[2,17]),i(H,[2,18]),{11:127,12:rt,39:[2,36]},i(Be,[2,9],{16:85,17:86,15:130,18:[1,129],60:_,86:x,100:v,102:w,103:M}),i(Be,[2,10]),i(Xe,[2,55],{11:131,12:rt}),i(Ke,[2,7]),{9:[1,132]},i(_e,[2,67]),{16:39,17:40,19:133,60:_,86:x,100:v,102:w,103:M},{13:[1,135],16:39,17:40,19:134,60:_,86:x,100:v,102:w,103:M},i(Te,[2,82],{66:136,68:be,69:fe,70:ke,71:me,72:Ce}),i(Te,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:o,43:23,48:f,54:F,56:R},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},i(G,[2,48],{39:[1,142]}),{41:[1,143]},i(G,[2,50]),{41:[2,61],45:144,51:De},{47:[1,145]},{16:39,17:40,19:146,60:_,86:x,100:v,102:w,103:M},i(g,[2,91],{13:[1,147]}),i(g,[2,93],{13:[1,149],77:[1,148]}),i(g,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},i(g,[2,105],{61:nt}),i(lt,[2,107],{85:154,22:ee,50:te,60:re,82:ne,86:le,87:ue,88:oe,89:de,90:pe}),i(Y,[2,109]),i(Y,[2,111]),i(Y,[2,112]),i(Y,[2,113]),i(Y,[2,114]),i(Y,[2,115]),i(Y,[2,116]),i(Y,[2,117]),i(Y,[2,118]),i(Y,[2,119]),i(g,[2,106]),i(G,[2,71]),i(g,[2,73],{61:nt}),{60:[1,155]},i(H,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:_,86:x,100:v,102:w,103:M},i(Be,[2,12]),i(Xe,[2,56]),{1:[2,4]},i(_e,[2,69]),i(_e,[2,68]),{16:39,17:40,19:158,60:_,86:x,100:v,102:w,103:M},i(Te,[2,80]),i(G,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:o,43:23,48:f,54:F,56:R},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:o,43:23,48:f,54:F,56:R},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:o,43:23,48:f,54:F,56:R},{45:163,51:De},i(G,[2,49]),{41:[2,62]},i(G,[2,52],{39:[1,164]}),i(g,[2,60]),i(g,[2,92]),i(g,[2,94]),i(g,[2,95],{77:[1,165]}),i(g,[2,98]),i(g,[2,99],{13:[1,166]}),i(g,[2,101],{13:[1,168],77:[1,167]}),{22:ee,50:te,60:re,82:ne,84:169,85:112,86:le,87:ue,88:oe,89:de,90:pe},i(Y,[2,110]),i(at,[2,75]),{14:[1,170]},i(Be,[2,11]),i(_e,[2,70]),i(G,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:De},i(g,[2,96]),i(g,[2,100]),i(g,[2,102]),i(g,[2,103],{77:[1,174]}),i(lt,[2,108],{85:154,22:ee,50:te,60:re,82:ne,86:le,87:ue,88:oe,89:de,90:pe}),i(Xe,[2,8]),i(G,[2,51]),{41:[1,175]},i(G,[2,54]),i(g,[2,104]),i(G,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:e(function(b,k){if(k.recoverable)this.trace(b);else{var m=Error(b);throw m.hash=k,m}},"parseError"),parse:e(function(b){var k=this,m=[0],c=[],B=[null],t=[],Ae=this.table,a="",Ne=0,ut=0,ot=0,kt=2,ct=1,mt=t.slice.call(arguments,1),P=Object.create(this.lexer),Q={yy:{}};for(var qe in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,qe))Q.yy[qe]=this.yy[qe];if(P.setInput(b,Q.yy),Q.yy.lexer=P,Q.yy.parser=this,typeof P.yylloc>"u")P.yylloc={};var Je=P.yylloc;t.push(Je);var gt=P.options&&P.options.ranges;if(typeof Q.yy.parseError==="function")this.parseError=Q.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Ct(z){m.length=m.length-2*z,B.length=B.length-z,t.length=t.length-z}e(Ct,"popStack");function ht(){var z=c.pop()||P.lex()||ct;if(typeof z!=="number"){if(z instanceof Array)c=z,z=c.pop();z=k.symbols_[z]||z}return z}e(ht,"lex");var V,Ze,j,U,Lt,$e,q={},xe,K,dt,ve;while(!0){if(j=m[m.length-1],this.defaultActions[j])U=this.defaultActions[j];else{if(V===null||typeof V>"u")V=ht();U=Ae[j]&&Ae[j][V]}if(typeof U>"u"||!U.length||!U[0]){var et="";ve=[];for(xe in Ae[j])if(this.terminals_[xe]&&xe>kt)ve.push("'"+this.terminals_[xe]+"'");if(P.showPosition)et="Parse error on line "+(Ne+1)+`:
1
+ import{e,r,Le,O,Kt,y,C,S,E,T,A,I,L,s,p,N,Fe,ce,ae,ie,Ye,ge,ye}from"./chunk-vymqrpm3.js";import{Pt}from"./chunk-47q4hmfp.js";import{je}from"./chunk-7520nrbb.js";import{he}from"./chunk-es28k2t7.js";import{se}from"./chunk-zmdnxn6m.js";var tt=function(){var i=e(function(W,b,k,m){for(k=k||{},m=W.length;m--;k[W[m]]=b);return k},"o"),n=[1,18],l=[1,19],u=[1,20],o=[1,41],d=[1,26],f=[1,42],h=[1,24],D=[1,25],F=[1,32],R=[1,33],J=[1,34],_=[1,45],Oe=[1,35],we=[1,36],Me=[1,37],Pe=[1,38],Ve=[1,27],Re=[1,28],Ge=[1,29],Ue=[1,30],ze=[1,31],x=[1,44],v=[1,46],w=[1,43],M=[1,47],Ke=[1,9],g=[1,8,9],be=[1,58],fe=[1,59],ke=[1,60],me=[1,61],Ce=[1,62],We=[1,63],Qe=[1,64],G=[1,8,9,41],st=[1,77],H=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],Ee=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],Te=[13,60,86,100,102,103],Z=[13,60,73,74,86,100,102,103],it=[13,60,68,69,70,71,72,86,100,102,103],De=[1,103],ee=[1,121],te=[1,117],re=[1,113],ne=[1,119],le=[1,114],ue=[1,115],oe=[1,116],de=[1,118],pe=[1,120],at=[22,50,60,61,82,86,87,88,89,90],rt=[1,128],Be=[12,39],Xe=[1,8,9,39,41,44,46],_e=[1,8,9,22],nt=[1,153],lt=[1,8,9,61],Y=[1,8,9,22,50,60,61,82,86,87,88,89,90],He={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:e(function(b,k,m,c,B,t,Ae){var a=t.length-1;switch(B){case 8:this.$=t[a-1];break;case 9:case 10:case 13:case 15:this.$=t[a];break;case 11:case 14:this.$=t[a-2]+"."+t[a];break;case 12:case 16:this.$=t[a-1]+t[a];break;case 17:case 18:this.$=t[a-1]+"~"+t[a]+"~";break;case 19:c.addRelation(t[a]);break;case 20:t[a-1].title=c.cleanupLabel(t[a]),c.addRelation(t[a-1]);break;case 31:this.$=t[a].trim(),c.setAccTitle(this.$);break;case 32:case 33:this.$=t[a].trim(),c.setAccDescription(this.$);break;case 34:c.addClassesToNamespace(t[a-3],t[a-1][0],t[a-1][1]),c.popNamespace();break;case 35:c.addClassesToNamespace(t[a-4],t[a-1][0],t[a-1][1]),c.popNamespace();break;case 36:this.$=c.addNamespace(t[a]);break;case 37:this.$=c.addNamespace(t[a-1],t[a]);break;case 38:this.$=[[t[a]],[]];break;case 39:this.$=[[t[a-1]],[]];break;case 40:t[a][0].unshift(t[a-2]),this.$=t[a];break;case 41:this.$=[[],[t[a]]];break;case 42:this.$=[[],[t[a-1]]];break;case 43:t[a][1].unshift(t[a-2]),this.$=t[a];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=t[a];break;case 48:c.setCssClass(t[a-2],t[a]);break;case 49:c.addMembers(t[a-3],t[a-1]);break;case 51:c.setCssClass(t[a-5],t[a-3]),c.addMembers(t[a-5],t[a-1]);break;case 52:c.addAnnotation(t[a-3],t[a-1]);break;case 53:c.addAnnotation(t[a-6],t[a-4]),c.addMembers(t[a-6],t[a-1]);break;case 54:c.addAnnotation(t[a-5],t[a-3]);break;case 55:this.$=t[a],c.addClass(t[a]);break;case 56:this.$=t[a-1],c.addClass(t[a-1]),c.setClassLabel(t[a-1],t[a]);break;case 60:c.addAnnotation(t[a],t[a-2]);break;case 61:case 74:this.$=[t[a]];break;case 62:t[a].push(t[a-1]),this.$=t[a];break;case 63:break;case 64:c.addMember(t[a-1],c.cleanupLabel(t[a]));break;case 65:break;case 66:break;case 67:this.$={id1:t[a-2],id2:t[a],relation:t[a-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:t[a-3],id2:t[a],relation:t[a-1],relationTitle1:t[a-2],relationTitle2:"none"};break;case 69:this.$={id1:t[a-3],id2:t[a],relation:t[a-2],relationTitle1:"none",relationTitle2:t[a-1]};break;case 70:this.$={id1:t[a-4],id2:t[a],relation:t[a-2],relationTitle1:t[a-3],relationTitle2:t[a-1]};break;case 71:this.$=c.addNote(t[a],t[a-1]);break;case 72:this.$=c.addNote(t[a]);break;case 73:this.$=t[a-2],c.defineClass(t[a-1],t[a]);break;case 75:this.$=t[a-2].concat([t[a]]);break;case 76:c.setDirection("TB");break;case 77:c.setDirection("BT");break;case 78:c.setDirection("RL");break;case 79:c.setDirection("LR");break;case 80:this.$={type1:t[a-2],type2:t[a],lineType:t[a-1]};break;case 81:this.$={type1:"none",type2:t[a],lineType:t[a-1]};break;case 82:this.$={type1:t[a-1],type2:"none",lineType:t[a]};break;case 83:this.$={type1:"none",type2:"none",lineType:t[a]};break;case 84:this.$=c.relationType.AGGREGATION;break;case 85:this.$=c.relationType.EXTENSION;break;case 86:this.$=c.relationType.COMPOSITION;break;case 87:this.$=c.relationType.DEPENDENCY;break;case 88:this.$=c.relationType.LOLLIPOP;break;case 89:this.$=c.lineType.LINE;break;case 90:this.$=c.lineType.DOTTED_LINE;break;case 91:case 97:this.$=t[a-2],c.setClickEvent(t[a-1],t[a]);break;case 92:case 98:this.$=t[a-3],c.setClickEvent(t[a-2],t[a-1]),c.setTooltip(t[a-2],t[a]);break;case 93:this.$=t[a-2],c.setLink(t[a-1],t[a]);break;case 94:this.$=t[a-3],c.setLink(t[a-2],t[a-1],t[a]);break;case 95:this.$=t[a-3],c.setLink(t[a-2],t[a-1]),c.setTooltip(t[a-2],t[a]);break;case 96:this.$=t[a-4],c.setLink(t[a-3],t[a-2],t[a]),c.setTooltip(t[a-3],t[a-1]);break;case 99:this.$=t[a-3],c.setClickEvent(t[a-2],t[a-1],t[a]);break;case 100:this.$=t[a-4],c.setClickEvent(t[a-3],t[a-2],t[a-1]),c.setTooltip(t[a-3],t[a]);break;case 101:this.$=t[a-3],c.setLink(t[a-2],t[a]);break;case 102:this.$=t[a-4],c.setLink(t[a-3],t[a-1],t[a]);break;case 103:this.$=t[a-4],c.setLink(t[a-3],t[a-1]),c.setTooltip(t[a-3],t[a]);break;case 104:this.$=t[a-5],c.setLink(t[a-4],t[a-2],t[a]),c.setTooltip(t[a-4],t[a-1]);break;case 105:this.$=t[a-2],c.setCssStyle(t[a-1],t[a]);break;case 106:c.setCssClass(t[a-1],t[a]);break;case 107:this.$=[t[a]];break;case 108:t[a-2].push(t[a]),this.$=t[a-2];break;case 110:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:n,35:l,37:u,38:22,42:o,43:23,46:d,48:f,51:h,52:D,54:F,56:R,57:J,60:_,62:Oe,63:we,64:Me,65:Pe,75:Ve,76:Re,78:Ge,82:Ue,83:ze,86:x,100:v,102:w,103:M},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},i(Ke,[2,5],{8:[1,48]}),{8:[1,49]},i(g,[2,19],{22:[1,50]}),i(g,[2,21]),i(g,[2,22]),i(g,[2,23]),i(g,[2,24]),i(g,[2,25]),i(g,[2,26]),i(g,[2,27]),i(g,[2,28]),i(g,[2,29]),i(g,[2,30]),{34:[1,51]},{36:[1,52]},i(g,[2,33]),i(g,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:be,69:fe,70:ke,71:me,72:Ce,73:We,74:Qe}),{39:[1,65]},i(G,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),i(g,[2,65]),i(g,[2,66]),{16:69,60:_,86:x,100:v,102:w},{16:39,17:40,19:70,60:_,86:x,100:v,102:w,103:M},{16:39,17:40,19:71,60:_,86:x,100:v,102:w,103:M},{16:39,17:40,19:72,60:_,86:x,100:v,102:w,103:M},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:_,86:x,100:v,102:w,103:M},{13:st,55:76},{58:78,60:[1,79]},i(g,[2,76]),i(g,[2,77]),i(g,[2,78]),i(g,[2,79]),i(H,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:_,86:x,100:v,102:w,103:M}),i(H,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:_,86:x,100:v,102:w,103:M},{16:39,17:40,19:87,60:_,86:x,100:v,102:w,103:M},i(Ee,[2,133]),i(Ee,[2,134]),i(Ee,[2,135]),i(Ee,[2,136]),i([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),i(Ke,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:n,35:l,37:u,42:o,46:d,48:f,51:h,52:D,54:F,56:R,57:J,60:_,62:Oe,63:we,64:Me,65:Pe,75:Ve,76:Re,78:Ge,82:Ue,83:ze,86:x,100:v,102:w,103:M}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:n,35:l,37:u,38:22,42:o,43:23,46:d,48:f,51:h,52:D,54:F,56:R,57:J,60:_,62:Oe,63:we,64:Me,65:Pe,75:Ve,76:Re,78:Ge,82:Ue,83:ze,86:x,100:v,102:w,103:M},i(g,[2,20]),i(g,[2,31]),i(g,[2,32]),{13:[1,91],16:39,17:40,19:90,60:_,86:x,100:v,102:w,103:M},{53:92,66:56,67:57,68:be,69:fe,70:ke,71:me,72:Ce,73:We,74:Qe},i(g,[2,64]),{67:93,73:We,74:Qe},i(Te,[2,83],{66:94,68:be,69:fe,70:ke,71:me,72:Ce}),i(Z,[2,84]),i(Z,[2,85]),i(Z,[2,86]),i(Z,[2,87]),i(Z,[2,88]),i(it,[2,89]),i(it,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:o,43:23,48:f,54:F,56:R},{16:100,60:_,86:x,100:v,102:w},{41:[1,102],45:101,51:De},{16:104,60:_,86:x,100:v,102:w},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:ee,50:te,59:110,60:re,82:ne,84:111,85:112,86:le,87:ue,88:oe,89:de,90:pe},{60:[1,122]},{13:st,55:123},i(G,[2,72]),i(G,[2,138]),{22:ee,50:te,59:124,60:re,61:[1,125],82:ne,84:111,85:112,86:le,87:ue,88:oe,89:de,90:pe},i(at,[2,74]),{16:39,17:40,19:126,60:_,86:x,100:v,102:w,103:M},i(H,[2,16]),i(H,[2,17]),i(H,[2,18]),{11:127,12:rt,39:[2,36]},i(Be,[2,9],{16:85,17:86,15:130,18:[1,129],60:_,86:x,100:v,102:w,103:M}),i(Be,[2,10]),i(Xe,[2,55],{11:131,12:rt}),i(Ke,[2,7]),{9:[1,132]},i(_e,[2,67]),{16:39,17:40,19:133,60:_,86:x,100:v,102:w,103:M},{13:[1,135],16:39,17:40,19:134,60:_,86:x,100:v,102:w,103:M},i(Te,[2,82],{66:136,68:be,69:fe,70:ke,71:me,72:Ce}),i(Te,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:o,43:23,48:f,54:F,56:R},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},i(G,[2,48],{39:[1,142]}),{41:[1,143]},i(G,[2,50]),{41:[2,61],45:144,51:De},{47:[1,145]},{16:39,17:40,19:146,60:_,86:x,100:v,102:w,103:M},i(g,[2,91],{13:[1,147]}),i(g,[2,93],{13:[1,149],77:[1,148]}),i(g,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},i(g,[2,105],{61:nt}),i(lt,[2,107],{85:154,22:ee,50:te,60:re,82:ne,86:le,87:ue,88:oe,89:de,90:pe}),i(Y,[2,109]),i(Y,[2,111]),i(Y,[2,112]),i(Y,[2,113]),i(Y,[2,114]),i(Y,[2,115]),i(Y,[2,116]),i(Y,[2,117]),i(Y,[2,118]),i(Y,[2,119]),i(g,[2,106]),i(G,[2,71]),i(g,[2,73],{61:nt}),{60:[1,155]},i(H,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:_,86:x,100:v,102:w,103:M},i(Be,[2,12]),i(Xe,[2,56]),{1:[2,4]},i(_e,[2,69]),i(_e,[2,68]),{16:39,17:40,19:158,60:_,86:x,100:v,102:w,103:M},i(Te,[2,80]),i(G,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:o,43:23,48:f,54:F,56:R},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:o,43:23,48:f,54:F,56:R},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:o,43:23,48:f,54:F,56:R},{45:163,51:De},i(G,[2,49]),{41:[2,62]},i(G,[2,52],{39:[1,164]}),i(g,[2,60]),i(g,[2,92]),i(g,[2,94]),i(g,[2,95],{77:[1,165]}),i(g,[2,98]),i(g,[2,99],{13:[1,166]}),i(g,[2,101],{13:[1,168],77:[1,167]}),{22:ee,50:te,60:re,82:ne,84:169,85:112,86:le,87:ue,88:oe,89:de,90:pe},i(Y,[2,110]),i(at,[2,75]),{14:[1,170]},i(Be,[2,11]),i(_e,[2,70]),i(G,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:De},i(g,[2,96]),i(g,[2,100]),i(g,[2,102]),i(g,[2,103],{77:[1,174]}),i(lt,[2,108],{85:154,22:ee,50:te,60:re,82:ne,86:le,87:ue,88:oe,89:de,90:pe}),i(Xe,[2,8]),i(G,[2,51]),{41:[1,175]},i(G,[2,54]),i(g,[2,104]),i(G,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:e(function(b,k){if(k.recoverable)this.trace(b);else{var m=Error(b);throw m.hash=k,m}},"parseError"),parse:e(function(b){var k=this,m=[0],c=[],B=[null],t=[],Ae=this.table,a="",Ne=0,ut=0,ot=0,kt=2,ct=1,mt=t.slice.call(arguments,1),P=Object.create(this.lexer),Q={yy:{}};for(var qe in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,qe))Q.yy[qe]=this.yy[qe];if(P.setInput(b,Q.yy),Q.yy.lexer=P,Q.yy.parser=this,typeof P.yylloc>"u")P.yylloc={};var Je=P.yylloc;t.push(Je);var gt=P.options&&P.options.ranges;if(typeof Q.yy.parseError==="function")this.parseError=Q.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Ct(z){m.length=m.length-2*z,B.length=B.length-z,t.length=t.length-z}e(Ct,"popStack");function ht(){var z=c.pop()||P.lex()||ct;if(typeof z!=="number"){if(z instanceof Array)c=z,z=c.pop();z=k.symbols_[z]||z}return z}e(ht,"lex");var V,Ze,j,U,Lt,$e,q={},xe,K,dt,ve;while(!0){if(j=m[m.length-1],this.defaultActions[j])U=this.defaultActions[j];else{if(V===null||typeof V>"u")V=ht();U=Ae[j]&&Ae[j][V]}if(typeof U>"u"||!U.length||!U[0]){var et="";ve=[];for(xe in Ae[j])if(this.terminals_[xe]&&xe>kt)ve.push("'"+this.terminals_[xe]+"'");if(P.showPosition)et="Parse error on line "+(Ne+1)+`:
2
2
  `+P.showPosition()+`
3
3
  Expecting `+ve.join(", ")+", got '"+(this.terminals_[V]||V)+"'";else et="Parse error on line "+(Ne+1)+": Unexpected "+(V==ct?"end of input":"'"+(this.terminals_[V]||V)+"'");this.parseError(et,{text:P.match,token:this.terminals_[V]||V,line:P.yylineno,loc:Je,expected:ve})}if(U[0]instanceof Array&&U.length>1)throw Error("Parse Error: multiple actions possible at state: "+j+", token: "+V);switch(U[0]){case 1:if(m.push(V),B.push(P.yytext),t.push(P.yylloc),m.push(U[1]),V=null,!Ze){if(ut=P.yyleng,a=P.yytext,Ne=P.yylineno,Je=P.yylloc,ot>0)ot--}else V=Ze,Ze=null;break;case 2:if(K=this.productions_[U[1]][1],q.$=B[B.length-K],q._$={first_line:t[t.length-(K||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(K||1)].first_column,last_column:t[t.length-1].last_column},gt)q._$.range=[t[t.length-(K||1)].range[0],t[t.length-1].range[1]];if($e=this.performAction.apply(q,[a,ut,Ne,Q.yy,U[1],B,t].concat(mt)),typeof $e<"u")return $e;if(K)m=m.slice(0,-1*K*2),B=B.slice(0,-1*K),t=t.slice(0,-1*K);m.push(this.productions_[U[1]][0]),B.push(q.$),t.push(q._$),dt=Ae[m[m.length-2]][m[m.length-1]],m.push(dt);break;case 3:return!0}}return!0},"parse")},ft=function(){var W={EOF:1,parseError:e(function(k,m){if(this.yy.parser)this.yy.parser.parseError(k,m);else throw Error(k)},"parseError"),setInput:e(function(b,k){if(this.yy=k||this.yy||{},this._input=b,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:e(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var k=b.match(/(?:\r\n?|\n).*/g);if(k)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),b},"input"),unput:e(function(b){var k=b.length,m=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-k),this.offset-=k;var c=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1)this.yylineno-=m.length-1;var B=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===c.length?this.yylloc.first_column:0)+c[c.length-m.length].length-m[0].length:this.yylloc.first_column-k},this.options.ranges)this.yylloc.range=[B[0],B[0]+this.yyleng-k];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(b){this.unput(this.match.slice(b))},"less"),pastInput:e(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var b=this.match;if(b.length<20)b+=this._input.substr(0,20-b.length);return(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var b=this.pastInput(),k=Array(b.length+1).join("-");return b+this.upcomingInput()+`