@bkm016/basalt 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-0xd9mnc2.js → chunk-jymx3a77.js} +165 -152
- package/{chunk-66h5qpc6.js → chunk-zq32mwxj.js} +134 -134
- package/compiled.js +1 -1
- package/package.json +1 -1
- package/ui-test-worker.js +1 -1
- package/web/{chunk-9yfftz38.js → chunk-05mvzx00.js} +1 -1
- package/web/chunk-086dshck.js +1 -0
- package/web/chunk-0fy590s0.js +1 -0
- package/web/{chunk-4a6gdrbs.js → chunk-0hvxb5d5.js} +1 -1
- package/web/chunk-0mdf1qja.js +1 -0
- package/web/{chunk-dz7g1gnv.js → chunk-0y971zgq.js} +2 -2
- package/web/{chunk-fjb3ksfd.js → chunk-1t38sgrk.js} +2 -2
- package/web/{chunk-66wb0p6e.js → chunk-1zfxaafq.js} +1 -1
- package/web/{chunk-p9hfcamx.js → chunk-27812gqr.js} +5 -5
- package/web/{chunk-sk1wkgjw.js → chunk-2ds0a2z1.js} +3 -3
- package/web/{chunk-ddyyc20r.js → chunk-2f2agfpj.js} +11 -11
- package/web/{chunk-3ecrkvr3.js → chunk-2tsxj613.js} +3 -3
- package/web/{chunk-y2rzeb4v.js → chunk-2weaa3gn.js} +2 -2
- package/web/{chunk-0pghpg4y.js → chunk-3020mmp1.js} +1 -1
- package/web/{chunk-mykrm8ba.js → chunk-30aeb767.js} +2 -2
- package/web/chunk-32zmk3f5.js +1 -0
- package/web/{chunk-zb2bkr7f.js → chunk-36dc7tcg.js} +2 -2
- package/web/{chunk-nnyc889n.js → chunk-3a57m7xm.js} +3 -3
- package/web/{chunk-8w7fyb3v.js → chunk-3b4wqmnh.js} +7 -7
- package/web/chunk-3d3wnh8a.js +2 -0
- package/web/{chunk-601k823s.js → chunk-3ftb27f3.js} +8 -8
- package/web/{chunk-c6yacwbc.js → chunk-47mbbmst.js} +3 -3
- package/web/chunk-48479gnx.js +1 -0
- package/web/{chunk-qsqtwf34.js → chunk-4gc663j0.js} +2 -2
- package/web/{chunk-kcjz03h5.js → chunk-4rwwtfnd.js} +2 -2
- package/web/{chunk-eqndhs21.js → chunk-4wwd3pfz.js} +2 -2
- package/web/{chunk-myd6sc76.js → chunk-57pyz29y.js} +2 -2
- package/web/{chunk-mdfksj61.js → chunk-59nk506k.js} +1 -1
- package/web/{chunk-db3twjvk.js → chunk-5ahx98zj.js} +9 -9
- package/web/chunk-6cjm2yr7.js +1 -0
- package/web/{chunk-frnh4zqf.js → chunk-6jb2zyp6.js} +2 -2
- package/web/{chunk-ts6jsfdk.js → chunk-793m5jjh.js} +1 -1
- package/web/{chunk-3ak5dg10.js → chunk-7dycbjxn.js} +4 -4
- package/web/chunk-7ycxz39p.js +1 -0
- package/web/{chunk-tftc5v89.js → chunk-8151c970.js} +1 -1
- package/web/{chunk-jccz14ye.js → chunk-885kpj14.js} +2 -2
- package/web/{chunk-79e08rk1.js → chunk-8csw0mvf.js} +2 -2
- package/web/{chunk-m9q5nr8f.js → chunk-8z7texmv.js} +1 -1
- package/web/{chunk-v1exk5wd.js → chunk-90fkdzx3.js} +8 -8
- package/web/chunk-94denx9h.js +39 -0
- package/web/{chunk-5baeh8q7.js → chunk-96xhmmqz.js} +6 -6
- package/web/chunk-9jy8nc4r.js +1 -0
- package/web/{chunk-5dr4tkem.js → chunk-9kkzmss7.js} +3 -3
- package/web/chunk-9wr33d0t.js +1 -0
- package/web/{chunk-3pd0qt83.js → chunk-a3pye9ag.js} +3 -3
- package/web/chunk-a4tdrxdh.js +1 -0
- package/web/chunk-a9fvsyc1.js +1 -0
- package/web/chunk-apvbvg4d.js +1 -0
- package/web/{chunk-gn8kyz76.js → chunk-b3j07x0n.js} +6 -6
- package/web/{chunk-ff1pmd3g.js → chunk-b6sqwmq7.js} +1 -1
- package/web/chunk-bkxcc7v5.js +1 -0
- package/web/chunk-bve354k7.js +1 -0
- package/web/{chunk-zdyys4ar.js → chunk-cbwvfedy.js} +8 -8
- package/web/{chunk-eadfxfkw.js → chunk-cpshsp24.js} +1 -1
- package/web/chunk-cwpxakby.js +1 -0
- package/web/chunk-d3f763n7.js +2 -0
- package/web/{chunk-8z0r0wtk.js → chunk-d4519smc.js} +14 -14
- package/web/chunk-de29pe57.js +1 -0
- package/web/chunk-dk0fnj87.js +1 -0
- package/web/{chunk-c57f714b.js → chunk-drchr3yn.js} +2 -2
- package/web/chunk-dsbyfvwz.js +1 -0
- package/web/{chunk-3hr3ew9w.js → chunk-dtrh40vr.js} +1 -1
- package/web/chunk-e68jw0bg.js +1 -0
- package/web/{chunk-veam6vk4.js → chunk-e763h2px.js} +67 -67
- package/web/{chunk-nvpp0ghj.js → chunk-enryqmj7.js} +5 -5
- package/web/{chunk-fpb2dd2d.js → chunk-f79ajymt.js} +2 -2
- package/web/{chunk-qq6m2my8.js → chunk-fj753yzt.js} +2 -2
- package/web/{chunk-9ctg0f30.js → chunk-g0rtcedn.js} +3 -3
- package/web/{chunk-2x4g9t37.js → chunk-g31dbnzm.js} +4 -4
- package/web/{chunk-w3w18stt.js → chunk-g4as4zzd.js} +4 -4
- package/web/{chunk-6e87m0nm.js → chunk-gten0rpx.js} +2 -2
- package/web/{chunk-a0ryzdnp.js → chunk-gyhr27dm.js} +1 -1
- package/web/{chunk-98y92vmh.js → chunk-hjyev38w.js} +6 -6
- package/web/{chunk-wzd2a4k5.js → chunk-hm8thq7c.js} +4 -4
- package/web/{chunk-07agqp8h.js → chunk-j4gvtszc.js} +2 -2
- package/web/chunk-jd7npyv9.js +8 -0
- package/web/chunk-jhpg2kcf.js +1 -0
- package/web/{chunk-9fnr00kv.js → chunk-jqqbkdtw.js} +2 -2
- package/web/chunk-jzz5htxp.js +1 -0
- package/web/chunk-ka3q31t1.js +1 -0
- package/web/chunk-kahab58k.js +1139 -0
- package/web/{chunk-af9evdza.js → chunk-kfbgvh0c.js} +1 -1
- package/web/chunk-krgvx75q.js +1 -0
- package/web/chunk-kxeaj44h.js +1 -0
- package/web/chunk-m1rdyvb5.js +1 -0
- package/web/{chunk-5v2c0aqk.js → chunk-m24yb8md.js} +2 -2
- package/web/chunk-m7k4wr3k.js +1 -0
- package/web/chunk-mdj3r75b.js +1 -0
- package/web/{chunk-ewx42c11.js → chunk-mpdeqzc9.js} +10 -10
- package/web/{chunk-b5h52neg.js → chunk-mykbcvqz.js} +1 -1
- package/web/{chunk-7qkav30b.js → chunk-n33753da.js} +1 -1
- package/web/{chunk-rasjtvsb.js → chunk-nafe18y9.js} +10 -10
- package/web/chunk-nbcpbqq4.js +1 -0
- package/web/{chunk-24jhbz82.js → chunk-nhx8pw7p.js} +1 -1
- package/web/chunk-nkpdd9hw.js +1 -0
- package/web/{chunk-dwjmr0zj.js → chunk-p1yc8hwn.js} +1 -1
- package/web/chunk-p29brxyt.js +1 -0
- package/web/chunk-p8fbes0t.js +1 -0
- package/web/chunk-pbp1p5ex.js +1 -0
- package/web/{chunk-xx11yv61.js → chunk-ppjw1mps.js} +4 -4
- package/web/{chunk-7tkgbbf9.js → chunk-pq56b3mq.js} +2 -2
- package/web/{chunk-vvvd3grf.js → chunk-pzg25qqe.js} +2 -2
- package/web/{chunk-spbs56wz.js → chunk-q65zxczs.js} +7 -7
- package/web/{chunk-t893141g.js → chunk-q8v5j963.js} +2 -2
- package/web/{chunk-vsjpnwsr.js → chunk-qykt7avq.js} +2 -2
- package/web/chunk-r6q1301x.js +1 -0
- package/web/chunk-r8kghrkb.js +1 -0
- package/web/chunk-rhxn7mxg.js +1 -0
- package/web/{chunk-2dvbeqt0.js → chunk-rqympya7.js} +2 -2
- package/web/{chunk-30b33r2w.js → chunk-s0xy00v5.js} +2 -2
- package/web/chunk-svqshmpg.js +1 -0
- package/web/chunk-swzxq7r3.css +1 -0
- package/web/{chunk-8jcvdd5d.js → chunk-t18tn37m.js} +2 -2
- package/web/chunk-tbsaseer.js +1 -0
- package/web/{chunk-5jdrev9p.js → chunk-tggja45g.js} +3 -3
- package/web/chunk-tgkdyxbn.js +1 -0
- package/web/{chunk-rrpn5r5w.js → chunk-tpdcrrf1.js} +1 -1
- package/web/chunk-v0zfnvc1.js +1 -0
- package/web/{chunk-5a4mj3qz.js → chunk-v3dn9bfw.js} +1 -1
- package/web/chunk-vj31fs16.js +1 -0
- package/web/chunk-vr79r8vh.js +1 -0
- package/web/chunk-wb9tax0m.js +1 -0
- package/web/{chunk-rayf24gy.js → chunk-wbwets5x.js} +23 -23
- package/web/chunk-x9eghjjd.js +1 -0
- package/web/{chunk-awkdw9rw.js → chunk-xbyrgyy0.js} +2 -2
- package/web/{chunk-60axh4sa.js → chunk-xjc5fmcr.js} +24 -24
- package/web/{chunk-qh62nkem.js → chunk-ydtrc1ay.js} +2 -2
- package/web/chunk-yrh86m0n.js +1 -0
- package/web/chunk-z3ky5ews.js +2 -0
- package/web/{chunk-ctzkqx2g.js → chunk-zdhyq3ch.js} +13 -13
- package/web/{chunk-0zwc2rvh.js → chunk-zv73g4qq.js} +2 -2
- package/web/index.html +1 -1
- package/web/chunk-08sq3cwm.js +0 -1
- package/web/chunk-12qf1r6m.js +0 -1
- package/web/chunk-24fjnnee.js +0 -1
- package/web/chunk-2hrswh3d.js +0 -2
- package/web/chunk-2j2atyjw.js +0 -1
- package/web/chunk-3h3g3ca3.js +0 -1
- package/web/chunk-3pcrxg6m.js +0 -1
- package/web/chunk-3txxt0a7.js +0 -1
- package/web/chunk-43g4wd7a.js +0 -1
- package/web/chunk-5z2n4z9x.css +0 -1
- package/web/chunk-6y55gk1n.js +0 -1
- package/web/chunk-7qq1ypvj.js +0 -1
- package/web/chunk-814kkkmq.js +0 -8
- package/web/chunk-8w8atrdh.js +0 -1
- package/web/chunk-935mjq1c.js +0 -39
- package/web/chunk-942g3eqn.js +0 -1
- package/web/chunk-a61zrp66.js +0 -1
- package/web/chunk-arnzrqnm.js +0 -1
- package/web/chunk-avxk6jpc.js +0 -2
- package/web/chunk-bwy3e58v.js +0 -1
- package/web/chunk-dnv8dx72.js +0 -1
- package/web/chunk-f7jpakwh.js +0 -1
- package/web/chunk-fmthkpff.js +0 -1
- package/web/chunk-gv99c8zv.js +0 -1
- package/web/chunk-h0767tjv.js +0 -1
- package/web/chunk-h0c42zy3.js +0 -1
- package/web/chunk-hqynf99g.js +0 -1
- package/web/chunk-ket6g0yd.js +0 -1
- package/web/chunk-mbwwj216.js +0 -1
- package/web/chunk-me7dza1c.js +0 -1
- package/web/chunk-mzzaet63.js +0 -1
- package/web/chunk-n0wazxgz.js +0 -1
- package/web/chunk-nvt9tkt4.js +0 -1139
- package/web/chunk-ph1dgffm.js +0 -1
- package/web/chunk-q34as3v6.js +0 -1
- package/web/chunk-qz6r9v1z.js +0 -1
- package/web/chunk-rad2s9ha.js +0 -1
- package/web/chunk-s37beysw.js +0 -1
- package/web/chunk-s60s09mb.js +0 -1
- package/web/chunk-tfvcs2xx.js +0 -1
- package/web/chunk-tj1fn8v2.js +0 -1
- package/web/chunk-vqmj6peg.js +0 -1
- package/web/chunk-wdq2tp9e.js +0 -1
- package/web/chunk-wkf5xfyr.js +0 -1
- package/web/chunk-xa43ndfj.js +0 -2
- package/web/chunk-xh4xn1az.js +0 -1
- package/web/chunk-xzwxcxb4.js +0 -1
- package/web/chunk-y1qty77a.js +0 -1
- package/web/chunk-ys2tns0p.js +0 -1
- package/web/chunk-z05x9cbm.js +0 -1
- package/web/chunk-zgavhnt8.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{t,F,C,S,E,T,A,L,R,l,p}from"./chunk-
|
|
1
|
+
import{t,F,C,S,E,T,A,L,R,l,p}from"./chunk-e763h2px.js";import{nn,Ur,oo,et}from"./chunk-8csw0mvf.js";import{xt}from"./chunk-rqympya7.js";import{qe}from"./chunk-m24yb8md.js";var st=function(){var e=t(function(u,n,s,o){for(s=s||{},o=u.length;o--;s[u[o]]=n);return s},"o"),r=[6,8,10,11,12,14,16,17,18],a=[1,9],g=[1,10],i=[1,11],y=[1,12],m=[1,13],c=[1,14],x={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:t(function(n,s,o,d,f,h,w){var _=h.length-1;switch(f){case 1:return h[_-1];case 2:this.$=[];break;case 3:h[_-1].push(h[_]),this.$=h[_-1];break;case 4:case 5:this.$=h[_];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(h[_].substr(6)),this.$=h[_].substr(6);break;case 9:this.$=h[_].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=h[_].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(h[_].substr(8)),this.$=h[_].substr(8);break;case 13:d.addTask(h[_-1],h[_]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(r,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:g,14:i,16:y,17:m,18:c},e(r,[2,7],{1:[2,1]}),e(r,[2,3]),{9:15,11:a,12:g,14:i,16:y,17:m,18:c},e(r,[2,5]),e(r,[2,6]),e(r,[2,8]),{13:[1,16]},{15:[1,17]},e(r,[2,11]),e(r,[2,12]),{19:[1,18]},e(r,[2,4]),e(r,[2,9]),e(r,[2,10]),e(r,[2,13])],defaultActions:{},parseError:t(function(n,s){if(s.recoverable)this.trace(n);else{var o=Error(n);throw o.hash=s,o}},"parseError"),parse:t(function(n){var s=this,o=[0],d=[],f=[null],h=[],w=this.table,_="",z=0,ct=0,ht=0,wt=2,ut=1,Tt=h.slice.call(arguments,1),v=Object.create(this.lexer),O={yy:{}};for(var Q in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,Q))O.yy[Q]=this.yy[Q];if(v.setInput(n,O.yy),O.yy.lexer=v,O.yy.parser=this,typeof v.yylloc>"u")v.yylloc={};var D=v.yylloc;h.push(D);var St=v.options&&v.options.ranges;if(typeof O.yy.parseError==="function")this.parseError=O.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function $t(I){o.length=o.length-2*I,f.length=f.length-I,h.length=h.length-I}t($t,"popStack");function yt(){var I=d.pop()||v.lex()||ut;if(typeof I!=="number"){if(I instanceof Array)d=I,I=d.pop();I=s.symbols_[I]||I}return I}t(yt,"lex");var M,tt,Y,P,Ht,rt,q={},Z,j,dt,J;while(!0){if(Y=o[o.length-1],this.defaultActions[Y])P=this.defaultActions[Y];else{if(M===null||typeof M>"u")M=yt();P=w[Y]&&w[Y][M]}if(typeof P>"u"||!P.length||!P[0]){var it="";J=[];for(Z in w[Y])if(this.terminals_[Z]&&Z>wt)J.push("'"+this.terminals_[Z]+"'");if(v.showPosition)it="Parse error on line "+(z+1)+`:
|
|
2
2
|
`+v.showPosition()+`
|
|
3
|
-
Expecting `+J.join(", ")+", got '"+(this.terminals_[M]||M)+"'";else
|
|
3
|
+
Expecting `+J.join(", ")+", got '"+(this.terminals_[M]||M)+"'";else it="Parse error on line "+(z+1)+": Unexpected "+(M==ut?"end of input":"'"+(this.terminals_[M]||M)+"'");this.parseError(it,{text:v.match,token:this.terminals_[M]||M,line:v.yylineno,loc:D,expected:J})}if(P[0]instanceof Array&&P.length>1)throw Error("Parse Error: multiple actions possible at state: "+Y+", token: "+M);switch(P[0]){case 1:if(o.push(M),f.push(v.yytext),h.push(v.yylloc),o.push(P[1]),M=null,!tt){if(ct=v.yyleng,_=v.yytext,z=v.yylineno,D=v.yylloc,ht>0)ht--}else M=tt,tt=null;break;case 2:if(j=this.productions_[P[1]][1],q.$=f[f.length-j],q._$={first_line:h[h.length-(j||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(j||1)].first_column,last_column:h[h.length-1].last_column},St)q._$.range=[h[h.length-(j||1)].range[0],h[h.length-1].range[1]];if(rt=this.performAction.apply(q,[_,ct,z,O.yy,P[1],f,h].concat(Tt)),typeof rt<"u")return rt;if(j)o=o.slice(0,-1*j*2),f=f.slice(0,-1*j),h=h.slice(0,-1*j);o.push(this.productions_[P[1]][0]),f.push(q.$),h.push(q._$),dt=w[o[o.length-2]][o[o.length-1]],o.push(dt);break;case 3:return!0}}return!0},"parse")},k=function(){var u={EOF:1,parseError:t(function(s,o){if(this.yy.parser)this.yy.parser.parseError(s,o);else throw Error(s)},"parseError"),setInput:t(function(n,s){if(this.yy=s||this.yy||{},this._input=n,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:t(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var s=n.match(/(?:\r\n?|\n).*/g);if(s)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),n},"input"),unput:t(function(n){var s=n.length,o=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var d=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),o.length-1)this.yylineno-=o.length-1;var f=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:o?(o.length===d.length?this.yylloc.first_column:0)+d[d.length-o.length].length-o[0].length:this.yylloc.first_column-s},this.options.ranges)this.yylloc.range=[f[0],f[0]+this.yyleng-s];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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:t(function(n){this.unput(this.match.slice(n))},"less"),pastInput:t(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var n=this.match;if(n.length<20)n+=this._input.substr(0,20-n.length);return(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var n=this.pastInput(),s=Array(n.length+1).join("-");return n+this.upcomingInput()+`
|
|
5
5
|
`+s+"^"},"showPosition"),test_match:t(function(n,s){var o,d,f;if(this.options.backtrack_lexer){if(f={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)f.yylloc.range=this.yylloc.range.slice(0)}if(d=n[0].match(/(?:\r\n?|\n).*/g),d)this.yylineno+=d.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+n[0].length},this.yytext+=n[0],this.match+=n[0],this.matches=n,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(n[0].length),this.matched+=n[0],o=this.performAction.call(this,this.yy,this,s,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(o)return o;else if(this._backtrack){for(var h in f)this[h]=f[h];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var n,s,o,d;if(!this._more)this.yytext="",this.match="";var f=this._currentRules();for(var h=0;h<f.length;h++)if(o=this._input.match(this.rules[f[h]]),o&&(!s||o[0].length>s[0].length)){if(s=o,d=h,this.options.backtrack_lexer)if(n=this.test_match(o,f[h]),n!==!1)return n;else if(this._backtrack){s=!1;continue}else return!1;else if(!this.options.flex)break}if(s){if(n=this.test_match(s,f[d]),n!==!1)return n;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var s=this.next();if(s)return s;else return this.lex()},"lex"),begin:t(function(s){this.conditionStack.push(s)},"begin"),popState:t(function(){var s=this.conditionStack.length-1;if(s>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(s){if(s=this.conditionStack.length-1-Math.abs(s||0),s>=0)return this.conditionStack[s];else return"INITIAL"},"topState"),pushState:t(function(s){this.begin(s)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(s,o,d,f){var h=f;switch(d){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return u}();x.lexer=k;function b(){this.yy={}}return t(b,"Parser"),b.prototype=x,x.Parser=b,new b}();
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var s=this.next();if(s)return s;else return this.lex()},"lex"),begin:t(function(s){this.conditionStack.push(s)},"begin"),popState:t(function(){var s=this.conditionStack.length-1;if(s>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(s){if(s=this.conditionStack.length-1-Math.abs(s||0),s>=0)return this.conditionStack[s];else return"INITIAL"},"topState"),pushState:t(function(s){this.begin(s)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(s,o,d,f){var h=f;switch(d){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return u}();x.lexer=k;function b(){this.yy={}}return t(b,"Parser"),b.prototype=x,x.Parser=b,new b}();st.parser=st;var Mt=st,X="",lt=[],G=[],H=[],Et=t(function(){lt.length=0,G.length=0,X="",H.length=0,C()},"clear"),Ct=t(function(e){X=e,lt.push(e)},"addSection"),Pt=t(function(){return lt},"getSections"),It=t(function(){let e=ft(),r=100,a=0;while(!e&&a<r)e=ft(),a++;return G.push(...H),G},"getTasks"),At=t(function(){let e=[];return G.forEach((a)=>{if(a.people)e.push(...a.people)}),[...new Set(e)].sort()},"updateActors"),Ft=t(function(e,r){let a=r.substr(1).split(":"),g=0,i=[];if(a.length===1)g=Number(a[0]),i=[];else g=Number(a[0]),i=a[1].split(",");let y=i.map((c)=>c.trim()),m={section:X,type:X,people:y,task:e,score:g};H.push(m)},"addTask"),Vt=t(function(e){let r={section:X,type:X,description:e,task:e,classes:[]};G.push(r)},"addTaskOrg"),ft=t(function(){let e=t(function(a){return H[a].processed},"compileTask"),r=!0;for(let[a,g]of H.entries())e(a),r=r&&g.processed;return r},"compileTasks"),Rt=t(function(){return At()},"getActors"),pt={getConfig:t(()=>l().journey,"getConfig"),clear:Et,setDiagramTitle:L,getDiagramTitle:R,setAccTitle:S,getAccTitle:E,setAccDescription:T,getAccDescription:A,addSection:Ct,getSections:Pt,getTasks:It,addTask:Ft,addTaskOrg:Vt,getActors:Rt},Lt=t((e)=>`.label {
|
|
7
7
|
font-family: ${e.fontFamily};
|
|
8
8
|
color: ${e.textColor};
|
|
9
9
|
}
|
|
@@ -135,5 +135,5 @@ Expecting `+J.join(", ")+", got '"+(this.terminals_[M]||M)+"'";else rt="Parse er
|
|
|
135
135
|
.actor-5 {
|
|
136
136
|
${e.actor5?`fill: ${e.actor5}`:""};
|
|
137
137
|
}
|
|
138
|
-
${
|
|
139
|
-
`,"getStyles"),Lt
|
|
138
|
+
${qe()}
|
|
139
|
+
`,"getStyles"),Bt=Lt,ot=t(function(e,r){return nn(e,r)},"drawRect"),jt=t(function(e,r){let g=e.append("circle").attr("cx",r.cx).attr("cy",r.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=e.append("g");i.append("circle").attr("cx",r.cx-5).attr("cy",r.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",r.cx+5).attr("cy",r.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function y(x){let k=xt().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);x.append("path").attr("class","mouth").attr("d",k).attr("transform","translate("+r.cx+","+(r.cy+2)+")")}t(y,"smile");function m(x){let k=xt().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);x.append("path").attr("class","mouth").attr("d",k).attr("transform","translate("+r.cx+","+(r.cy+7)+")")}t(m,"sad");function c(x){x.append("line").attr("class","mouth").attr("stroke",2).attr("x1",r.cx-5).attr("y1",r.cy+7).attr("x2",r.cx+5).attr("y2",r.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}if(t(c,"ambivalent"),r.score>3)y(i);else if(r.score<3)m(i);else c(i);return g},"drawFace"),kt=t(function(e,r){let a=e.append("circle");if(a.attr("cx",r.cx),a.attr("cy",r.cy),a.attr("class","actor-"+r.pos),a.attr("fill",r.fill),a.attr("stroke",r.stroke),a.attr("r",r.r),a.class!==void 0)a.attr("class",a.class);if(r.title!==void 0)a.append("title").text(r.title);return a},"drawCircle"),bt=t(function(e,r){return oo(e,r)},"drawText"),Nt=t(function(e,r){function a(i,y,m,c,x){return i+","+y+" "+(i+m)+","+y+" "+(i+m)+","+(y+c-x)+" "+(i+m-x*1.2)+","+(y+c)+" "+i+","+(y+c)}t(a,"genPoints");let g=e.append("polygon");g.attr("points",a(r.x,r.y,50,20,7)),g.attr("class","labelBox"),r.y=r.y+r.labelMargin,r.x=r.x+0.5*r.labelMargin,bt(e,r)},"drawLabel"),zt=t(function(e,r,a){let g=e.append("g"),i=et();i.x=r.x,i.y=r.y,i.fill=r.fill,i.width=a.width*r.taskCount+a.diagramMarginX*(r.taskCount-1),i.height=a.height,i.class="journey-section section-type-"+r.num,i.rx=3,i.ry=3,ot(g,i),_t(a)(r.text,g,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+r.num},a,r.colour)},"drawSection"),at=-1,Wt=t(function(e,r,a,g){let i=r.x+a.width/2,y=e.append("g");at++;let m=450;y.append("line").attr("id",g+"-task"+at).attr("x1",i).attr("y1",r.y).attr("x2",i).attr("y2",m).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),jt(y,{cx:i,cy:300+(5-r.score)*30,score:r.score});let c=et();c.x=r.x,c.y=r.y,c.fill=r.fill,c.width=a.width,c.height=a.height,c.class="task task-type-"+r.num,c.rx=3,c.ry=3,ot(y,c);let x=r.x+14;r.people.forEach((k)=>{let b=r.actors[k].color,u={cx:x,cy:r.y,r:7,fill:b,stroke:"#000",title:k,pos:r.actors[k].position};kt(y,u),x+=10}),_t(a)(r.task,y,c.x,c.y,c.width,c.height,{class:"task"},a,r.colour)},"drawTask"),Ot=t(function(e,r){Ur(e,r)},"drawBackgroundRect"),_t=function(){function e(i,y,m,c,x,k,b,u){let n=y.append("text").attr("x",m+x/2).attr("y",c+k/2+5).style("font-color",u).style("text-anchor","middle").text(i);g(n,b)}t(e,"byText");function r(i,y,m,c,x,k,b,u,n){let{taskFontSize:s,taskFontFamily:o}=u,d=i.split(/<br\s*\/?>/gi);for(let f=0;f<d.length;f++){let h=f*s-s*(d.length-1)/2,w=y.append("text").attr("x",m+x/2).attr("y",c).attr("fill",n).style("text-anchor","middle").style("font-size",s).style("font-family",o);w.append("tspan").attr("x",m+x/2).attr("dy",h).text(d[f]),w.attr("y",c+k/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),g(w,b)}}t(r,"byTspan");function a(i,y,m,c,x,k,b,u){let n=y.append("switch"),o=n.append("foreignObject").attr("x",m).attr("y",c).attr("width",x).attr("height",k).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");o.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),r(i,n,m,c,x,k,b,u),g(o,b)}t(a,"byFo");function g(i,y){for(let m in y)if(m in y)i.attr(m,y[m])}return t(g,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?a:i.textPlacement==="old"?e:r}}(),Yt=t(function(e,r){at=-1,e.append("defs").append("marker").attr("id",r+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics"),U={drawRect:ot,drawCircle:kt,drawSection:zt,drawText:bt,drawLabel:Nt,drawTask:Wt,drawBackgroundRect:Ot,initGraphics:Yt},qt=t(function(e){Object.keys(e).forEach(function(a){B[a]=e[a]})},"setConf"),N={},K=0;function vt(e){let r=l().journey,a=r.maxLabelWidth;K=0;let g=60;Object.keys(N).forEach((i)=>{let y=N[i].color,m={cx:20,cy:g,r:7,fill:y,stroke:"#000",pos:N[i].position};U.drawCircle(e,m);let c=e.append("text").attr("visibility","hidden").text(i),x=c.node().getBoundingClientRect().width;c.remove();let k=[];if(x<=a)k=[i];else{let b=i.split(" "),u="";if(c=e.append("text").attr("visibility","hidden"),b.forEach((n)=>{let s=u?`${u} ${n}`:n;if(c.text(s),c.node().getBoundingClientRect().width>a){if(u)k.push(u);if(u=n,c.text(n),c.node().getBoundingClientRect().width>a){let d="";for(let f of n)if(d+=f,c.text(d+"-"),c.node().getBoundingClientRect().width>a)k.push(d.slice(0,-1)+"-"),d=f;u=d}}else u=s}),u)k.push(u);c.remove()}k.forEach((b,u)=>{let n={x:40,y:g+7+u*20,fill:"#666",text:b,textMargin:r.boxTextMargin??5},o=U.drawText(e,n).node().getBoundingClientRect().width;if(o>K&&o>r.leftMargin-o)K=o}),g+=Math.max(20,k.length*20)})}t(vt,"drawActorLegend");var B=l().journey,W=0,Xt=t(function(e,r,a,g){let i=l(),y=i.journey.titleColor,m=i.journey.titleFontSize,c=i.journey.titleFontFamily,x=i.securityLevel,k;if(x==="sandbox")k=p("#i"+r);let b=x==="sandbox"?p(k.nodes()[0].contentDocument.body):p("body");V.init();let u=b.select("#"+r);U.initGraphics(u,r);let n=g.db.getTasks(),s=g.db.getDiagramTitle(),o=g.db.getActors();for(let z in N)delete N[z];let d=0;o.forEach((z)=>{N[z]={color:B.actorColours[d%B.actorColours.length],position:d},d++}),vt(u),W=B.leftMargin+K,V.insert(0,0,W,Object.keys(N).length*50),Gt(u,n,0,r);let f=V.getBounds();if(s)u.append("text").text(s).attr("x",W).attr("font-size",m).attr("font-weight","bold").attr("y",25).attr("fill",y).attr("font-family",c);let h=f.stopy-f.starty+2*B.diagramMarginY,w=W+f.stopx+2*B.diagramMarginX;F(u,h,w,B.useMaxWidth),u.append("line").attr("x1",W).attr("y1",B.height*4).attr("x2",w-W-4).attr("y2",B.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#"+r+"-arrowhead)");let _=s?70:0;u.attr("viewBox",`${f.startx} -25 ${w} ${h+_}`),u.attr("preserveAspectRatio","xMinYMin meet"),u.attr("height",h+_+25)},"draw"),V={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:t(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:t(function(e,r,a,g){if(e[r]===void 0)e[r]=a;else e[r]=g(a,e[r])},"updateVal"),updateBounds:t(function(e,r,a,g){let i=l().journey,y=this,m=0;function c(x){return t(function(b){m++;let u=y.sequenceItems.length-m+1;if(y.updateVal(b,"starty",r-u*i.boxMargin,Math.min),y.updateVal(b,"stopy",g+u*i.boxMargin,Math.max),y.updateVal(V.data,"startx",e-u*i.boxMargin,Math.min),y.updateVal(V.data,"stopx",a+u*i.boxMargin,Math.max),x!=="activation")y.updateVal(b,"startx",e-u*i.boxMargin,Math.min),y.updateVal(b,"stopx",a+u*i.boxMargin,Math.max),y.updateVal(V.data,"starty",r-u*i.boxMargin,Math.min),y.updateVal(V.data,"stopy",g+u*i.boxMargin,Math.max)},"updateItemBounds")}t(c,"updateFn"),this.sequenceItems.forEach(c())},"updateBounds"),insert:t(function(e,r,a,g){let i=Math.min(e,a),y=Math.max(e,a),m=Math.min(r,g),c=Math.max(r,g);this.updateVal(V.data,"startx",i,Math.min),this.updateVal(V.data,"starty",m,Math.min),this.updateVal(V.data,"stopx",y,Math.max),this.updateVal(V.data,"stopy",c,Math.max),this.updateBounds(i,m,y,c)},"insert"),bumpVerticalPos:t(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:t(function(){return this.verticalPos},"getVerticalPos"),getBounds:t(function(){return this.data},"getBounds")},{sectionFills:nt,sectionColours:gt}=B,Gt=t(function(e,r,a,g){let i=l().journey,y="",m=i.height*2+i.diagramMarginY,c=a+m,x=0,k="#CCC",b="black",u=0;for(let[n,s]of r.entries()){if(y!==s.section){k=nt[x%nt.length],u=x%nt.length,b=gt[x%gt.length];let d=0,f=s.section;for(let w=n;w<r.length;w++)if(r[w].section==f)d=d+1;else break;let h={x:n*i.taskMargin+n*i.width+W,y:50,text:s.section,fill:k,num:u,colour:b,taskCount:d};U.drawSection(e,h,i),y=s.section,x++}let o=s.people.reduce((d,f)=>{if(N[f])d[f]=N[f];return d},{});s.x=n*i.taskMargin+n*i.width+W,s.y=c,s.width=i.diagramMarginX,s.height=i.diagramMarginY,s.colour=b,s.fill=k,s.num=u,s.actors=o,U.drawTask(e,s,i,g),V.insert(s.x,s.y,s.x+s.width+i.taskMargin,450)}},"drawTasks"),mt={setConf:qt,draw:Xt},ee={parser:Mt,db:pt,renderer:mt,styles:Bt,init:t((e)=>{mt.setConf(e.journey),pt.clear()},"init")};export{ee as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B,o,v,i,r,f,e,n,y,q,
|
|
2
|
-
`):t}function z(){return n("div",{role:"status","aria-busy":"true","aria-label":"正在加载上下文",className:"space-y-2 animate-pulse",children:[e("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),e("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),e("div",{className:"h-10 rounded-xl border border-line bg-panel/40"})]})}function k(t){let{style:c}=y();return e("p",{className:c("surface.empty"),children:t.children})}function E(t){let{Code:c}=y();return e(c,{code:t.code,lang:t.lang,className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})}function O(t){let{cn:c}=y();if(!t.items.length)return e(k,{children:"新会话还没有上下文。发送第一条消息后,这里会显示构成。"});let d=t.items.reduce((s,a)=>s+a.tokens,0)||1;return n("div",{className:"space-y-2.5",children:[e("div",{className:"flex h-2 overflow-hidden rounded-full bg-raised",children:t.items.map((s,a)=>e("span",{className:c(R[a%R.length],"transition-[width] duration-300 ease-out-quint"),title:`${s.label}:${s.tokens.toLocaleString()} token`,style:{width:`${s.tokens/d*100}%`}},s.id))}),e("div",{className:"space-y-1.5",children:t.items.map((s,a)=>e(Q,{item:s,total:d,index:a,color:R[a%R.length]??"bg-accent"},s.id))})]})}function Q(t){let{cn:c,Chevron:d,CopyButton:s,style:a,useTheme:m}=y();m();let[u,x]=r(!1),g=(t.item.tokens/t.total*100).toFixed(1),l=v(()=>u&&t.item.detail?
|
|
1
|
+
import{B,o,v,i,r,f,e,n,y,q,fi,To,Ji,Mr,er,Eo,eo,Ao,ia,oa,Nn,hi,gi}from"./chunk-kahab58k.js";var D={sealed:"已封存",folded:"已折叠",archived:"已移出"},R=["bg-accent","bg-accent-strong","bg-warning","bg-success"];function W(t,c){if(t.startsWith("recent-"))return"json";let d=c.trimStart();if(!d)return"markdown";if(d.startsWith("{")||d.startsWith("["))return"json";if(/^<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>/.test(d))return"xml";return"markdown"}function A(t){if(!t||t.length>32000)return t;if(!t.trimStart().startsWith("<"))return t;let d=[],s=0,a=(u)=>" ".repeat(u),m=/(<([a-zA-Z_][\w.-]*)(?:\s+[^>]*)?>([^\r\n<]*)<\/\2>)|(<\/[a-zA-Z_][\w.-]*>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?\/>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>)|([^<]+)/g;for(let u of t.matchAll(m)){let[,x,,,g,l,p,h]=u;if(x)d.push(`${a(s)}${x.trim()}`);else if(g)s=Math.max(0,s-1),d.push(`${a(s)}${g.trim()}`);else if(p)d.push(`${a(s)}${p.trim()}`),s++;else if(l)d.push(`${a(s)}${l.trim()}`);else if(h){let N=h.trim();if(N)for(let S of N.split(/\r?\n/)){let I=S.trim();if(I)d.push(`${a(s)}${I}`)}}}return d.length>0?d.join(`
|
|
2
|
+
`):t}function z(){return n("div",{role:"status","aria-busy":"true","aria-label":"正在加载上下文",className:"space-y-2 animate-pulse",children:[e("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),e("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),e("div",{className:"h-10 rounded-xl border border-line bg-panel/40"})]})}function k(t){let{style:c}=y();return e("p",{className:c("surface.empty"),children:t.children})}function E(t){let{Code:c}=y();return e(c,{code:t.code,lang:t.lang,className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})}function O(t){let{cn:c}=y();if(!t.items.length)return e(k,{children:"新会话还没有上下文。发送第一条消息后,这里会显示构成。"});let d=t.items.reduce((s,a)=>s+a.tokens,0)||1;return n("div",{className:"space-y-2.5",children:[e("div",{className:"flex h-2 overflow-hidden rounded-full bg-raised",children:t.items.map((s,a)=>e("span",{className:c(R[a%R.length],"transition-[width] duration-300 ease-out-quint"),title:`${s.label}:${s.tokens.toLocaleString()} token`,style:{width:`${s.tokens/d*100}%`}},s.id))}),e("div",{className:"space-y-1.5",children:t.items.map((s,a)=>e(Q,{item:s,total:d,index:a,color:R[a%R.length]??"bg-accent"},s.id))})]})}function Q(t){let{cn:c,Chevron:d,CopyButton:s,style:a,useTheme:m}=y();m();let[u,x]=r(!1),g=(t.item.tokens/t.total*100).toFixed(1),l=v(()=>u&&t.item.detail?er(t.item.detail):"",[u,t.item.detail]),p=v(()=>l?W(t.item.id,l):"markdown",[l,t.item.id]),h=v(()=>{if(!l)return"";return p==="xml"?A(l):l},[l,p]);return n("div",{"data-state":u?"open":"closed",className:a("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>x((N)=>!N),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[e("span",{className:c("size-2 shrink-0 rounded-full",t.color),"aria-hidden":!0}),e("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:t.item.label}),t.item.state&&e("span",{className:a("control.badge","text-[10px]"),children:D[t.item.state]}),e("span",{className:"font-mono tabular-nums text-dim",children:t.item.tokens.toLocaleString()}),n("span",{className:"w-10 text-right font-mono text-[11px] tabular-nums text-faint",children:[g,"%"]}),e(d,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[e("div",{className:"mb-2 h-1 overflow-hidden rounded-full bg-raised",children:e("div",{className:c("h-full",t.color),style:{width:`${g}%`}})}),h?n("div",{className:a("surface.subtle","group/detail relative overflow-hidden rounded-lg bg-panel/70 p-2.5"),children:[e("div",{className:"absolute right-1.5 top-1.5 z-10",children:e(s,{text:t.item.detail,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),e("div",{className:"max-h-80 overflow-y-auto pr-6 text-dim",children:e(E,{code:h,lang:p})})]}):e("p",{className:"py-2 text-center text-xs text-faint",children:"(空)"})]})]})}var M=40,Y={accent:"bg-accent/15 text-accent",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",neutral:"bg-raised text-dim"};function L(t){let{Button:c,CopyButton:d,style:s,useTheme:a}=y();a();let[m,u]=r(M),x=i(null),g=m<t.entries.length;o(()=>{let p=x.current;if(!p||!g||typeof IntersectionObserver>"u")return;let h=new IntersectionObserver((N)=>{if(N.some((S)=>S.isIntersecting))u((S)=>Math.min(t.entries.length,S+M))},{rootMargin:"480px"});return h.observe(p),()=>h.disconnect()},[g,t.entries.length]);let l=v(()=>t.entries.slice(-m).reverse(),[t.entries,m]);if(!t.entries.length)return e(k,{children:"还没有消息。"});return n("div",{className:"space-y-1.5",children:[n("div",{className:s("surface.subtle","flex items-center justify-between px-3 py-1.5 text-xs text-faint"),children:[n("span",{children:["共 ",t.entries.length," 条记录"]}),e(d,{text:()=>t.entries.map((p)=>JSON.stringify(p,null,2)).join(`
|
|
3
3
|
|
|
4
|
-
`),size:"icon-xs",label:"复制全部原始 JSON",className:"hover:bg-raised text-faint hover:text-ink"})]}),l.map((p)=>e(ee,{entry:p},p.seq)),g&&n("div",{ref:x,className:s("surface.subtle","flex items-center justify-between bg-panel/40 px-3 py-2 text-xs text-faint"),children:[n("span",{children:["已显示 ",l.length," / ",t.entries.length," 条"]}),n("div",{className:"flex items-center gap-1.5",children:[e(c,{size:"sm",variant:"ghost",onClick:()=>u((p)=>Math.min(t.entries.length,p+M)),children:"加载更多"}),e(c,{size:"sm",variant:"ghost",onClick:()=>u(t.entries.length),children:"显示全部"})]})]})]})}var ee=B(function(c){let{Chevron:d,CopyButton:s,style:a,useTheme:m}=y();m();let[u,x]=r(!1),g=Ro(c.entry),l=v(()=>Ao(c.entry.time),[c.entry.time]);return n("div",{"data-state":u?"open":"closed",className:a("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>x((p)=>!p),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[n("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:["#",c.entry.seq]}),e("span",{className:a("control.badge","shrink-0 font-medium text-[10px]",Y[g.tone]),children:g.badge}),e("span",{className:"min-w-0 flex-1 truncate text-ink",children:g.title}),g.meta&&e("span",{className:a("control.badge","shrink-0 font-mono text-[10px] text-faint"),children:g.meta}),e("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:l}),e(d,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&e("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2.5 text-xs text-dim",children:n("div",{className:"space-y-2",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[n("span",{className:"font-mono",children:[c.entry.type," · #",c.entry.seq]}),e(s,{text:()=>JSON.stringify(c.entry,null,2),size:"icon-xs",label:"复制此条 JSON",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink"})]}),e(te,{entry:c.entry})]})})]})});function te(t){let{style:c,useTheme:d}=y();d();let s=t.entry;if(s.type==="user")return n("div",{className:"space-y-2",children:[s.text&&e("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Pr(s.text)}),s.attachments&&s.attachments.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["附件(",s.attachments.length,")"]}),e("div",{className:"flex flex-wrap gap-1.5",children:s.attachments.map((a,m)=>{let u=a.kind==="image"?Math.floor(a.data.length*0.75):a.data.length;return n("div",{className:c("surface.subtle","inline-flex items-center gap-1.5 px-2 py-1 text-[11px]"),children:[e("span",{className:c("control.badge","text-[10px] text-faint"),children:a.kind==="image"?"图片":a.kind==="path"?"路径":"文本"}),e("span",{className:"max-w-40 truncate font-medium text-ink",children:a.name}),n("span",{className:"font-mono text-[10px] text-faint",children:[a.mimeType," · ",to(u)]})]},`${a.name}-${m}`)})})]}),s.notices&&s.notices.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["通知来源(",s.notices.length,")"]}),s.notices.map((a)=>n("div",{className:c("surface.subtle","flex items-center justify-between px-2.5 py-1.5 font-mono text-[11px]"),children:[n("span",{className:"truncate text-ink",children:[a.sourceKind,"/",a.sourceID]}),e("span",{className:"text-faint",children:a.state})]},a.dedupeKey))]})]});if(s.type==="assistant")return n("div",{className:"space-y-2",children:[n("div",{className:"font-mono text-[11px] text-faint",children:["模型:",s.model]}),s.error&&e("div",{className:"rounded-lg border border-danger/30 bg-danger/8 px-2.5 py-2 text-xs text-danger",children:s.error}),s.parts.map((a,m)=>{if(a.type==="thinking")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[e("div",{className:"text-[10.5px] font-medium text-faint",children:"思考"}),e("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs italic leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Pr(a.text)})]},`thinking-${m}`);if(a.type==="text")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[e("div",{className:"text-[10.5px] font-medium text-faint",children:"回复"}),e("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Pr(a.text)})]},`text-${m}`);return n("div",{className:c("surface.subtle","p-2.5 space-y-1.5"),children:[n("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[n("span",{className:"font-mono font-medium text-ink",children:["工具调用 · ",a.name]}),e("span",{className:"truncate font-mono text-[10px] text-faint",children:a.id})]}),e("div",{className:"max-h-60 overflow-y-auto text-dim",children:e(E,{code:nr(JSON.stringify(a.input,no,2)),lang:"json"})})]},a.id||`tool-${m}`)})]});if(s.type==="tool_result")return n("div",{className:"space-y-2",children:[n("div",{className:"flex flex-wrap items-center gap-2 font-mono text-[11px] text-faint",children:[e("span",{className:"text-ink",children:s.name}),e("span",{children:"·"}),e("span",{className:"truncate",children:s.callID}),e("span",{className:c("control.badge","ml-auto font-sans text-[10px]",s.isError?"bg-danger/15 text-danger":"text-dim"),children:s.isError?"执行失败":"执行完成"})]}),s.images&&s.images.length>0&&e("div",{className:"flex flex-wrap gap-1.5",children:s.images.map((a,m)=>n("span",{className:c("surface.subtle","px-2 py-1 font-mono text-[10.5px] text-faint"),children:["图片 #",m+1," · ",a.mimeType," · ",to(Math.floor(a.data.length*0.75))]},`${a.mimeType}-${m}`))}),gi(s.output)?e("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere]",s.isError?"text-danger":"text-dim"),children:Pr(s.output)}):e("p",{className:"py-1 text-faint",children:"(无文本输出)"})]});return e("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Lo(s)})}function j(t){let{cn:c,style:d,useTheme:s}=y();if(s(),!t.todos.length)return e(k,{children:"暂无待办。"});return e("ul",{className:"space-y-1.5",children:t.todos.map((a)=>n("li",{className:d("surface.interactive","flex items-start gap-2.5 px-3 py-2 text-xs"),children:[n("span",{className:c("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors duration-300",a.status==="completed"&&"border-success bg-success text-panel",a.status==="in_progress"&&"border-accent",a.status==="pending"&&"border-line-strong"),children:[a.status==="completed"&&e(q,{className:"size-2.5 animate-pop",strokeWidth:3.5}),a.status==="in_progress"&&e("span",{className:"size-1.5 animate-pulse rounded-full bg-accent"})]}),e("span",{className:c("min-w-0 flex-1 break-words leading-relaxed [overflow-wrap:anywhere]",a.status==="completed"&&"text-faint line-through decoration-faint/60",a.status==="in_progress"&&"font-medium text-ink",a.status==="pending"&&"text-dim"),children:a.content})]},`${a.status}-${a.content}`))})}function F(t){let{cn:c,style:d,useTheme:s}=y();s();let[a,m]=r("all"),u=v(()=>t.tools.filter((l)=>l.deferred).length,[t.tools]),x=t.tools.length-u,g=v(()=>{if(a==="deferred")return t.tools.filter((l)=>l.deferred);if(a==="active")return t.tools.filter((l)=>!l.deferred);return t.tools},[t.tools,a]);if(!t.tools.length)return e(k,{children:"当前会话没有可用工具。"});return n("div",{className:"space-y-2",children:[u>0&&n("div",{className:"flex items-center gap-1 text-[11px]",children:[n("button",{type:"button",onClick:()=>m("all"),className:c("rounded-lg px-2 py-1 transition-colors",a==="all"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["全部 (",t.tools.length,")"]}),n("button",{type:"button",onClick:()=>m("active"),className:c("rounded-lg px-2 py-1 transition-colors",a==="active"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["常驻 (",x,")"]}),n("button",{type:"button",onClick:()=>m("deferred"),className:c("rounded-lg px-2 py-1 transition-colors",a==="deferred"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["延迟加载 (",u,")"]})]}),e("div",{className:"space-y-1.5",children:g.map((l)=>e(ae,{tool:l},`${l.group}-${l.name}`))})]})}function ae(t){let{Chevron:c,CopyButton:d,style:s,useTheme:a}=y();a();let[m,u]=r(!1),x=v(()=>m?JSON.stringify(t.tool.schema,null,2):"",[m,t.tool.schema]);return n("div",{"data-state":m?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":m,onClick:()=>u((g)=>!g),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate font-mono text-ink",children:[e("span",{className:"truncate",children:t.tool.name}),t.tool.group&&e("span",{className:s("control.badge","font-sans text-[10px]"),children:t.tool.group}),t.tool.deferred&&e("span",{className:s("control.badge","font-sans text-[10px]"),children:"延迟加载"})]}),e(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),m&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[t.tool.deferred&&e("div",{className:s("surface.subtle","mb-2 px-2.5 py-1.5 text-[11px] text-faint"),children:"延迟加载:此工具默认以精简描述挂载,模型通过 toolsearch 取回定义后才向上下文注入完整参数 Schema。"}),t.tool.description&&e("pre",{className:"mb-2 max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:nr(t.tool.description)}),n("div",{className:s("surface.subtle","group/schema relative overflow-hidden rounded-lg p-2.5"),children:[e("div",{className:"absolute right-1.5 top-1.5 z-10",children:e(d,{text:x,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),e("div",{className:"max-h-72 overflow-y-auto pr-6 text-dim",children:e(E,{code:nr(x),lang:"json"})})]})]})]})}function se(){try{let t=localStorage.getItem("basalt.contextSidebar.tab");if(t==="tools"||t==="todos"||t==="raw")return t}catch{}return"breakdown"}function ne(t){let{style:c,useTheme:d}=y();return d(),n("div",{className:c("surface.panel","bg-panel/70 px-3 py-2"),children:[e("div",{className:"text-[10px] font-medium uppercase tracking-wider text-faint",children:t.label}),e("div",{className:"mt-0.5 truncate font-mono text-xs font-semibold tabular-nums text-ink",children:t.value})]})}function Oe(t){let{Button:c,StatusChip:d,Segmented:s,cn:a,style:m,useTheme:u}=y();u();let[x,g]=r(se),[l,p]=r(()=>On.get(t.session.id)),[h,N]=r(!1),[S,I]=r(0),[H,U]=r(!1);o(()=>{let b=setTimeout(()=>U(!0),140);return()=>clearTimeout(b)},[]),o(()=>{let b=On.get(t.session.id);if(b)p(b);return yi((T,G)=>{if(T===t.session.id)p(G)})},[t.session.id]),o(()=>{let b=new AbortController;return N(!1),t.connection.request(`/api/sessions/${encodeURIComponent(t.session.id)}/context`,{signal:AbortSignal.any([b.signal,AbortSignal.timeout(15000)])}).then((T)=>{if(!b.signal.aborted)bi(t.session.id,T),p(T)},()=>{if(!b.signal.aborted)N(!0)}),()=>b.abort()},[t.connection,t.session.id,t.session.updated,t.entries.length,S]);let w=sa(l?.items??[],l?.usableWindow,l?.calibratedTokens,l?.lastInputTokens,l?.hasPendingOutput),C=la(w.percent),_=l?.lastCacheHitRate,P=l?.usage?.cacheHitRate,J=_===void 0?"—":`${(_*100).toFixed(1)}%`,Z=P===void 0?"—":`${(P*100).toFixed(1)}%`,K=(b)=>{g(b);try{localStorage.setItem("basalt.contextSidebar.tab",b)}catch{}},V=[{value:"breakdown",label:"构成"},{value:"tools",label:n("span",{className:"inline-flex items-center gap-1",children:["工具",l&&e("span",{className:"text-[10px] text-faint tabular-nums",children:l.tools.length})]})},{value:"todos",label:n("span",{className:"inline-flex items-center gap-1",children:["待办",t.session.todos.length>0&&e("span",{className:"text-[10px] text-faint tabular-nums",children:t.session.todos.length})]})},{value:"raw",label:"原始消息"}],X=n("div",{className:"px-3.5 pt-1 pb-3",children:[n("div",{className:"flex items-start justify-between gap-3",children:[n("div",{children:[e("div",{className:"text-[10.5px] font-medium uppercase tracking-wider text-faint",children:"上下文用量"}),n("div",{className:"mt-0.5 flex items-baseline gap-1.5",children:[e("span",{className:"font-mono text-xl font-semibold tabular-nums text-ink",children:l?w.totalTokens.toLocaleString():"—"}),n("span",{className:"font-mono text-xs text-dim",children:["/ ",l?.usableWindow.toLocaleString()??"—"]})]})]}),e(d,{tone:C==="overflow"||C==="near_limit"?"danger":C==="sealing"?"warning":"success",children:C==="overflow"?"预计超限":C==="near_limit"?"接近上限":C==="sealing"?"接近封存":"正常"})]}),w.percent!==null&&e("meter",{className:"sr-only","aria-label":"可用上下文窗口占比",min:0,max:100,value:Math.min(100,w.percent)}),e("div",{"aria-hidden":!0,className:a("relative mt-2.5 h-2 w-full overflow-hidden rounded-full bg-raised",!l&&"animate-pulse"),children:e("div",{className:"h-full rounded-full bg-accent transition-[width] duration-500 ease-out-quint",style:{width:`${Math.min(100,w.percent??0)}%`}})}),n("div",{className:"mt-2 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-dim",children:w.percent===null?"暂无窗口数据":`${w.percent.toFixed(1)}% 可用窗口`}),n("span",{className:"text-faint",children:["总窗口 ",l?.contextWindow.toLocaleString()??"—"," · 80% 封存 · 97% 折叠"]})]}),l?.usage&&(l.usage.input>0||l.usage.output>0||l.usage.cacheRead>0||l.usage.cacheWrite>0||l.usage.cost>0)&&e("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[["Input",l.usage.input.toLocaleString()],["Output",l.usage.output.toLocaleString()],["缓存命中 当前 / 平均",`${J} / ${Z}`],["平均 TPS",l.usage.tps!==void 0?`${l.usage.tps.toFixed(1)} tok/s`:"—"]].map(([b,T])=>e(ne,{label:b,value:T},b))})]});return n(f,{children:[X,e("div",{className:"px-3 py-2",children:e(s,{value:x,onChange:K,options:V,className:"w-full grid grid-cols-4"})}),n("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:[h&&!l&&n("div",{role:"alert",className:"flex items-center justify-between rounded-xl border border-danger/30 bg-danger/8 px-3 py-2 text-xs text-danger",children:[e("span",{children:"上下文加载失败。"}),e(c,{size:"sm",variant:"ghost",onClick:()=>I((b)=>b+1),children:"重试"})]}),e("div",{children:!H?e(z,{}):n(f,{children:[x==="raw"&&e(L,{entries:t.entries}),x==="todos"&&e(j,{todos:t.session.todos}),x==="breakdown"&&(l?e(O,{items:w.items}):!h?e(z,{}):null),x==="tools"&&(l?e(F,{tools:l.tools??[]}):!h?e(z,{}):null)]})},x)]})]})}export{Oe as ContextSidebar};
|
|
4
|
+
`),size:"icon-xs",label:"复制全部原始 JSON",className:"hover:bg-raised text-faint hover:text-ink"})]}),l.map((p)=>e(ee,{entry:p},p.seq)),g&&n("div",{ref:x,className:s("surface.subtle","flex items-center justify-between bg-panel/40 px-3 py-2 text-xs text-faint"),children:[n("span",{children:["已显示 ",l.length," / ",t.entries.length," 条"]}),n("div",{className:"flex items-center gap-1.5",children:[e(c,{size:"sm",variant:"ghost",onClick:()=>u((p)=>Math.min(t.entries.length,p+M)),children:"加载更多"}),e(c,{size:"sm",variant:"ghost",onClick:()=>u(t.entries.length),children:"显示全部"})]})]})]})}var ee=B(function(c){let{Chevron:d,CopyButton:s,style:a,useTheme:m}=y();m();let[u,x]=r(!1),g=Eo(c.entry),l=v(()=>To(c.entry.time),[c.entry.time]);return n("div",{"data-state":u?"open":"closed",className:a("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>x((p)=>!p),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[n("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:["#",c.entry.seq]}),e("span",{className:a("control.badge","shrink-0 font-medium text-[10px]",Y[g.tone]),children:g.badge}),e("span",{className:"min-w-0 flex-1 truncate text-ink",children:g.title}),g.meta&&e("span",{className:a("control.badge","shrink-0 font-mono text-[10px] text-faint"),children:g.meta}),e("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:l}),e(d,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&e("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2.5 text-xs text-dim",children:n("div",{className:"space-y-2",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[n("span",{className:"font-mono",children:[c.entry.type," · #",c.entry.seq]}),e(s,{text:()=>JSON.stringify(c.entry,null,2),size:"icon-xs",label:"复制此条 JSON",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink"})]}),e(te,{entry:c.entry})]})})]})});function te(t){let{style:c,useTheme:d}=y();d();let s=t.entry;if(s.type==="user")return n("div",{className:"space-y-2",children:[s.text&&e("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Mr(s.text)}),s.attachments&&s.attachments.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["附件(",s.attachments.length,")"]}),e("div",{className:"flex flex-wrap gap-1.5",children:s.attachments.map((a,m)=>{let u=a.kind==="image"?Math.floor(a.data.length*0.75):a.data.length;return n("div",{className:c("surface.subtle","inline-flex items-center gap-1.5 px-2 py-1 text-[11px]"),children:[e("span",{className:c("control.badge","text-[10px] text-faint"),children:a.kind==="image"?"图片":a.kind==="path"?"路径":"文本"}),e("span",{className:"max-w-40 truncate font-medium text-ink",children:a.name}),n("span",{className:"font-mono text-[10px] text-faint",children:[a.mimeType," · ",Ji(u)]})]},`${a.name}-${m}`)})})]}),s.notices&&s.notices.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["通知来源(",s.notices.length,")"]}),s.notices.map((a)=>n("div",{className:c("surface.subtle","flex items-center justify-between px-2.5 py-1.5 font-mono text-[11px]"),children:[n("span",{className:"truncate text-ink",children:[a.sourceKind,"/",a.sourceID]}),e("span",{className:"text-faint",children:a.state})]},a.dedupeKey))]})]});if(s.type==="assistant")return n("div",{className:"space-y-2",children:[n("div",{className:"font-mono text-[11px] text-faint",children:["模型:",s.model]}),s.error&&e("div",{className:"rounded-lg border border-danger/30 bg-danger/8 px-2.5 py-2 text-xs text-danger",children:s.error}),s.parts.map((a,m)=>{if(a.type==="thinking")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[e("div",{className:"text-[10.5px] font-medium text-faint",children:"思考"}),e("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs italic leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(a.text)})]},`thinking-${m}`);if(a.type==="text")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[e("div",{className:"text-[10.5px] font-medium text-faint",children:"回复"}),e("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(a.text)})]},`text-${m}`);return n("div",{className:c("surface.subtle","p-2.5 space-y-1.5"),children:[n("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[n("span",{className:"font-mono font-medium text-ink",children:["工具调用 · ",a.name]}),e("span",{className:"truncate font-mono text-[10px] text-faint",children:a.id})]}),e("div",{className:"max-h-60 overflow-y-auto text-dim",children:e(E,{code:er(JSON.stringify(a.input,eo,2)),lang:"json"})})]},a.id||`tool-${m}`)})]});if(s.type==="tool_result")return n("div",{className:"space-y-2",children:[n("div",{className:"flex flex-wrap items-center gap-2 font-mono text-[11px] text-faint",children:[e("span",{className:"text-ink",children:s.name}),e("span",{children:"·"}),e("span",{className:"truncate",children:s.callID}),e("span",{className:c("control.badge","ml-auto font-sans text-[10px]",s.isError?"bg-danger/15 text-danger":"text-dim"),children:s.isError?"执行失败":"执行完成"})]}),s.images&&s.images.length>0&&e("div",{className:"flex flex-wrap gap-1.5",children:s.images.map((a,m)=>n("span",{className:c("surface.subtle","px-2 py-1 font-mono text-[10.5px] text-faint"),children:["图片 #",m+1," · ",a.mimeType," · ",Ji(Math.floor(a.data.length*0.75))]},`${a.mimeType}-${m}`))}),fi(s.output)?e("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere]",s.isError?"text-danger":"text-dim"),children:Mr(s.output)}):e("p",{className:"py-1 text-faint",children:"(无文本输出)"})]});return e("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Ao(s)})}function j(t){let{cn:c,style:d,useTheme:s}=y();if(s(),!t.todos.length)return e(k,{children:"暂无待办。"});return e("ul",{className:"space-y-1.5",children:t.todos.map((a)=>n("li",{className:d("surface.interactive","flex items-start gap-2.5 px-3 py-2 text-xs"),children:[n("span",{className:c("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors duration-300",a.status==="completed"&&"border-success bg-success text-panel",a.status==="in_progress"&&"border-accent",a.status==="pending"&&"border-line-strong"),children:[a.status==="completed"&&e(q,{className:"size-2.5 animate-pop",strokeWidth:3.5}),a.status==="in_progress"&&e("span",{className:"size-1.5 animate-pulse rounded-full bg-accent"})]}),e("span",{className:c("min-w-0 flex-1 break-words leading-relaxed [overflow-wrap:anywhere]",a.status==="completed"&&"text-faint line-through decoration-faint/60",a.status==="in_progress"&&"font-medium text-ink",a.status==="pending"&&"text-dim"),children:a.content})]},`${a.status}-${a.content}`))})}function F(t){let{cn:c,style:d,useTheme:s}=y();s();let[a,m]=r("all"),u=v(()=>t.tools.filter((l)=>l.deferred).length,[t.tools]),x=t.tools.length-u,g=v(()=>{if(a==="deferred")return t.tools.filter((l)=>l.deferred);if(a==="active")return t.tools.filter((l)=>!l.deferred);return t.tools},[t.tools,a]);if(!t.tools.length)return e(k,{children:"当前会话没有可用工具。"});return n("div",{className:"space-y-2",children:[u>0&&n("div",{className:"flex items-center gap-1 text-[11px]",children:[n("button",{type:"button",onClick:()=>m("all"),className:c("rounded-lg px-2 py-1 transition-colors",a==="all"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["全部 (",t.tools.length,")"]}),n("button",{type:"button",onClick:()=>m("active"),className:c("rounded-lg px-2 py-1 transition-colors",a==="active"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["常驻 (",x,")"]}),n("button",{type:"button",onClick:()=>m("deferred"),className:c("rounded-lg px-2 py-1 transition-colors",a==="deferred"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["延迟加载 (",u,")"]})]}),e("div",{className:"space-y-1.5",children:g.map((l)=>e(ae,{tool:l},`${l.group}-${l.name}`))})]})}function ae(t){let{Chevron:c,CopyButton:d,style:s,useTheme:a}=y();a();let[m,u]=r(!1),x=v(()=>m?JSON.stringify(t.tool.schema,null,2):"",[m,t.tool.schema]);return n("div",{"data-state":m?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":m,onClick:()=>u((g)=>!g),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate font-mono text-ink",children:[e("span",{className:"truncate",children:t.tool.name}),t.tool.group&&e("span",{className:s("control.badge","font-sans text-[10px]"),children:t.tool.group}),t.tool.deferred&&e("span",{className:s("control.badge","font-sans text-[10px]"),children:"延迟加载"})]}),e(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),m&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[t.tool.deferred&&e("div",{className:s("surface.subtle","mb-2 px-2.5 py-1.5 text-[11px] text-faint"),children:"延迟加载:此工具默认以精简描述挂载,模型通过 toolsearch 取回定义后才向上下文注入完整参数 Schema。"}),t.tool.description&&e("pre",{className:"mb-2 max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:er(t.tool.description)}),n("div",{className:s("surface.subtle","group/schema relative overflow-hidden rounded-lg p-2.5"),children:[e("div",{className:"absolute right-1.5 top-1.5 z-10",children:e(d,{text:x,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),e("div",{className:"max-h-72 overflow-y-auto pr-6 text-dim",children:e(E,{code:er(x),lang:"json"})})]})]})]})}function se(){try{let t=localStorage.getItem("basalt.contextSidebar.tab");if(t==="tools"||t==="todos"||t==="raw")return t}catch{}return"breakdown"}function ne(t){let{style:c,useTheme:d}=y();return d(),n("div",{className:c("surface.panel","bg-panel/70 px-3 py-2"),children:[e("div",{className:"text-[10px] font-medium uppercase tracking-wider text-faint",children:t.label}),e("div",{className:"mt-0.5 truncate font-mono text-xs font-semibold tabular-nums text-ink",children:t.value})]})}function Oe(t){let{Button:c,StatusChip:d,Segmented:s,cn:a,style:m,useTheme:u}=y();u();let[x,g]=r(se),[l,p]=r(()=>Nn.get(t.session.id)),[h,N]=r(!1),[S,I]=r(0),[H,U]=r(!1);o(()=>{let b=setTimeout(()=>U(!0),140);return()=>clearTimeout(b)},[]),o(()=>{let b=Nn.get(t.session.id);if(b)p(b);return hi((T,G)=>{if(T===t.session.id)p(G)})},[t.session.id]),o(()=>{let b=new AbortController;return N(!1),t.connection.request(`/api/sessions/${encodeURIComponent(t.session.id)}/context`,{signal:AbortSignal.any([b.signal,AbortSignal.timeout(15000)])}).then((T)=>{if(!b.signal.aborted)gi(t.session.id,T),p(T)},()=>{if(!b.signal.aborted)N(!0)}),()=>b.abort()},[t.connection,t.session.id,t.session.updated,t.entries.length,S]);let w=ia(l?.items??[],l?.usableWindow,l?.calibratedTokens,l?.lastInputTokens,l?.hasPendingOutput),C=oa(w.percent),_=l?.lastCacheHitRate,P=l?.usage?.cacheHitRate,J=_===void 0?"—":`${(_*100).toFixed(1)}%`,Z=P===void 0?"—":`${(P*100).toFixed(1)}%`,K=(b)=>{g(b);try{localStorage.setItem("basalt.contextSidebar.tab",b)}catch{}},V=[{value:"breakdown",label:"构成"},{value:"tools",label:n("span",{className:"inline-flex items-center gap-1",children:["工具",l&&e("span",{className:"text-[10px] text-faint tabular-nums",children:l.tools.length})]})},{value:"todos",label:n("span",{className:"inline-flex items-center gap-1",children:["待办",t.session.todos.length>0&&e("span",{className:"text-[10px] text-faint tabular-nums",children:t.session.todos.length})]})},{value:"raw",label:"原始消息"}],X=n("div",{className:"px-3.5 pt-1 pb-3",children:[n("div",{className:"flex items-start justify-between gap-3",children:[n("div",{children:[e("div",{className:"text-[10.5px] font-medium uppercase tracking-wider text-faint",children:"上下文用量"}),n("div",{className:"mt-0.5 flex items-baseline gap-1.5",children:[e("span",{className:"font-mono text-xl font-semibold tabular-nums text-ink",children:l?w.totalTokens.toLocaleString():"—"}),n("span",{className:"font-mono text-xs text-dim",children:["/ ",l?.usableWindow.toLocaleString()??"—"]})]})]}),e(d,{tone:C==="overflow"||C==="near_limit"?"danger":C==="sealing"?"warning":"success",children:C==="overflow"?"预计超限":C==="near_limit"?"接近上限":C==="sealing"?"接近封存":"正常"})]}),w.percent!==null&&e("meter",{className:"sr-only","aria-label":"可用上下文窗口占比",min:0,max:100,value:Math.min(100,w.percent)}),e("div",{"aria-hidden":!0,className:a("relative mt-2.5 h-2 w-full overflow-hidden rounded-full bg-raised",!l&&"animate-pulse"),children:e("div",{className:"h-full rounded-full bg-accent transition-[width] duration-500 ease-out-quint",style:{width:`${Math.min(100,w.percent??0)}%`}})}),n("div",{className:"mt-2 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-dim",children:w.percent===null?"暂无窗口数据":`${w.percent.toFixed(1)}% 可用窗口`}),n("span",{className:"text-faint",children:["总窗口 ",l?.contextWindow.toLocaleString()??"—"," · 80% 封存 · 97% 折叠"]})]}),l?.usage&&(l.usage.input>0||l.usage.output>0||l.usage.cacheRead>0||l.usage.cacheWrite>0||l.usage.cost>0)&&e("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[["Input",l.usage.input.toLocaleString()],["Output",l.usage.output.toLocaleString()],["缓存命中 当前 / 平均",`${J} / ${Z}`],["平均 TPS",l.usage.tps!==void 0?`${l.usage.tps.toFixed(1)} tok/s`:"—"]].map(([b,T])=>e(ne,{label:b,value:T},b))})]});return n(f,{children:[X,e("div",{className:"px-3 py-2",children:e(s,{value:x,onChange:K,options:V,className:"w-full grid grid-cols-4"})}),n("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:[h&&!l&&n("div",{role:"alert",className:"flex items-center justify-between rounded-xl border border-danger/30 bg-danger/8 px-3 py-2 text-xs text-danger",children:[e("span",{children:"上下文加载失败。"}),e(c,{size:"sm",variant:"ghost",onClick:()=>I((b)=>b+1),children:"重试"})]}),e("div",{children:!H?e(z,{}):n(f,{children:[x==="raw"&&e(L,{entries:t.entries}),x==="todos"&&e(j,{todos:t.session.todos}),x==="breakdown"&&(l?e(O,{items:w.items}):!h?e(z,{}):null),x==="tools"&&(l?e(F,{tools:l.tools??[]}):!h?e(z,{}):null)]})},x)]})]})}export{Oe as ContextSidebar};
|