MCPcopy Index your code
hub / github.com/google/adk-python / c

Function c

src/google/adk/cli/browser/chunk-QMDHABEH.js:139–139  ·  view source on GitHub ↗
(i,f)

Source from the content-addressed store, hash-verified

137 }
138 ${gt()}
139`,"getStyles"),zt=Nt,D=n(function(t,e){return dt(t,e)},"drawRect"),Wt=n(function(t,e){let c=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=t.append("g");i.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function f(g){let m=U().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}n(f,"smile");function u(g){let m=U().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}n(u,"sad");function d(g){g.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return n(d,"ambivalent"),e.score>3?f(i):e.score<3?u(i):d(i),c},"drawFace"),vt=n(function(t,e){let s=t.append("circle");return s.attr("cx",e.cx),s.attr("cy",e.cy),s.attr("class","actor-"+e.pos),s.attr("fill",e.fill),s.attr("stroke",e.stroke),s.attr("r",e.r),s.class!==void 0&&s.attr("class",s.class),e.title!==void 0&&s.append("title").text(e.title),s},"drawCircle"),wt=n(function(t,e){return pt(t,e)},"drawText"),Ot=n(function(t,e){function s(i,f,u,d,g){return i+","+f+" "+(i+u)+","+f+" "+(i+u)+","+(f+d-g)+" "+(i+u-g*1.2)+","+(f+d)+" "+i+","+(f+d)}n(s,"genPoints");let c=t.append("polygon");c.attr("points",s(e.x,e.y,50,20,7)),c.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,wt(t,e)},"drawLabel"),Yt=n(function(t,e,s){let c=t.append("g"),i=Z();i.x=e.x,i.y=e.y,i.fill=e.fill,i.width=s.width*e.taskCount+s.diagramMarginX*(e.taskCount-1),i.height=s.height,i.class="journey-section section-type-"+e.num,i.rx=3,i.ry=3,D(c,i),Tt(s)(e.text,c,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+e.num},s,e.colour)},"drawSection"),kt=-1,qt=n(function(t,e,s){let c=e.x+s.width/2,i=t.append("g");kt++,i.append("line").attr("id","task"+kt).attr("x1",c).attr("y1",e.y).attr("x2",c).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Wt(i,{cx:c,cy:300+(5-e.score)*30,score:e.score});let u=Z();u.x=e.x,u.y=e.y,u.fill=e.fill,u.width=s.width,u.height=s.height,u.class="task task-type-"+e.num,u.rx=3,u.ry=3,D(i,u);let d=e.x+14;e.people.forEach(g=>{let m=e.actors[g].color,x={cx:d,cy:e.y,r:7,fill:m,stroke:"#000",title:g,pos:e.actors[g].position};vt(i,x),d+=10}),Tt(s)(e.task,i,u.x,u.y,u.width,u.height,{class:"task"},s,e.colour)},"drawTask"),Ht=n(function(t,e){ft(t,e)},"drawBackgroundRect"),Tt=(function(){function t(i,f,u,d,g,m,x,h){let r=f.append("text").attr("x",u+g/2).attr("y",d+m/2+5).style("font-color",h).style("text-anchor","middle").text(i);c(r,x)}n(t,"byText");function e(i,f,u,d,g,m,x,h,r){let{taskFontSize:a,taskFontFamily:l}=h,y=i.split(/<br\s*\/?>/gi);for(let p=0;p<y.length;p++){let o=p*a-a*(y.length-1)/2,v=f.append("text").attr("x",u+g/2).attr("y",d).attr("fill",r).style("text-anchor","middle").style("font-size",a).style("font-family",l);v.append("tspan").attr("x",u+g/2).attr("dy",o).text(y[p]),v.attr("y",d+m/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),c(v,x)}}n(e,"byTspan");function s(i,f,u,d,g,m,x,h){let r=f.append("switch"),l=r.append("foreignObject").attr("x",u).attr("y",d).attr("width",g).attr("height",m).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");l.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),e(i,r,u,d,g,m,x,h),c(l,x)}n(s,"byFo");function c(i,f){for(let u in f)u in f&&i.attr(u,f[u])}return n(c,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?s:i.textPlacement==="old"?t:e}})(),Xt=n(function(t){t.append("defs").append("marker").attr("id","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"),j={drawRect:D,drawCircle:vt,drawSection:Yt,drawText:wt,drawLabel:Ot,drawTask:qt,drawBackgroundRect:Ht,initGraphics:Xt},Gt=n(function(t){Object.keys(t).forEach(function(s){$[s]=t[s]})},"setConf"),E={},O=0;function St(t){let e=F().journey,s=e.maxLabelWidth;O=0;let c=60;Object.keys(E).forEach(i=>{let f=E[i].color,u={cx:20,cy:c,r:7,fill:f,stroke:"#000",pos:E[i].position};j.drawCircle(t,u);let d=t.append("text").attr("visibility","hidden").text(i),g=d.node().getBoundingClientRect().width;d.remove();let m=[];if(g<=s)m=[i];else{let x=i.split(" "),h="";d=t.append("text").attr("visibility","hidden"),x.forEach(r=>{let a=h?`${h} ${r}`:r;if(d.text(a),d.node().getBoundingClientRect().width>s){if(h&&m.push(h),h=r,d.text(r),d.node().getBoundingClientRect().width>s){let y="";for(let p of r)y+=p,d.text(y+"-"),d.node().getBoundingClientRect().width>s&&(m.push(y.slice(0,-1)+"-"),y=p);h=y}}else h=a}),h&&m.push(h),d.remove()}m.forEach((x,h)=>{let r={x:40,y:c+7+h*20,fill:"#666",text:x,textMargin:e.boxTextMargin??5},l=j.drawText(t,r).node().getBoundingClientRect().width;l>O&&l>e.leftMargin-l&&(O=l)}),c+=Math.max(20,m.length*20)})}n(St,"drawActorLegend");var $=F().journey,P=0,Ut=n(function(t,e,s,c){let i=F(),f=i.journey.titleColor,u=i.journey.titleFontSize,d=i.journey.titleFontFamily,g=i.securityLevel,m;g==="sandbox"&&(m=W("#i"+e));let x=g==="sandbox"?W(m.nodes()[0].contentDocument.body):W("body");S.init();let h=x.select("#"+e);j.initGraphics(h);let r=c.db.getTasks(),a=c.db.getDiagramTitle(),l=c.db.getActors();for(let C in E)delete E[C];let y=0;l.forEach(C=>{E[C]={color:$.actorColours[y%$.actorColours.length],position:y},y++}),St(h),P=$.leftMargin+O,S.insert(0,0,P,Object.keys(E).length*50),Zt(h,r,0);let p=S.getBounds();a&&h.append("text").text(a).attr("x",P).attr("font-size",u).attr("font-weight","bold").attr("y",25).attr("fill",f).attr("font-family",d);let o=p.stopy-p.starty+2*$.diagramMarginY,v=P+p.stopx+2*$.diagramMarginX;st(h,o,v,$.useMaxWidth),h.append("line").attr("x1",P).attr("y1",$.height*4).attr("x2",v-P-4).attr("y2",$.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");let k=a?70:0;h.attr("viewBox",`${p.startx} -25 ${v} ${o+k}`),h.attr("preserveAspectRatio","xMinYMin meet"),h.attr("height",o+k+25)},"draw"),S={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:n(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:n(function(t,e,s,c){t[e]===void 0?t[e]=s:t[e]=c(s,t[e])},"updateVal"),updateBounds:n(function(t,e,s,c){let i=F().journey,f=this,u=0;function d(g){return n(function(x){u++;let h=f.sequenceItems.length-u+1;f.updateVal(x,"starty",e-h*i.boxMargin,Math.min),f.updateVal(x,"stopy",c+h*i.boxMargin,Math.max),f.updateVal(S.data,"startx",t-h*i.boxMargin,Math.min),f.updateVal(S.data,"stopx",s+h*i.boxMargin,Math.max),g!=="activation"&&(f.updateVal(x,"startx",t-h*i.boxMargin,Math.min),f.updateVal(x,"stopx",s+h*i.boxMargin,Math.max),f.updateVal(S.data,"starty",e-h*i.boxMargin,Math.min),f.updateVal(S.data,"stopy",c+h*i.boxMargin,Math.max))},"updateItemBounds")}n(d,"updateFn"),this.sequenceItems.forEach(d())},"updateBounds"),insert:n(function(t,e,s,c){let i=Math.min(t,s),f=Math.max(t,s),u=Math.min(e,c),d=Math.max(e,c);this.updateVal(S.data,"startx",i,Math.min),this.updateVal(S.data,"starty",u,Math.min),this.updateVal(S.data,"stopx",f,Math.max),this.updateVal(S.data,"stopy",d,Math.max),this.updateBounds(i,u,f,d)},"insert"),bumpVerticalPos:n(function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:n(function(){return this.verticalPos},"getVerticalPos"),getBounds:n(function(){return this.data},"getBounds")},J=$.sectionFills,bt=$.sectionColours,Zt=n(function(t,e,s){let c=F().journey,i="",f=c.height*2+c.diagramMarginY,u=s+f,d=0,g="#CCC",m="black",x=0;for(let[h,r]of e.entries()){if(i!==r.section){g=J[d%J.length],x=d%J.length,m=bt[d%bt.length];let l=0,y=r.section;for(let o=h;o<e.length&&e[o].section==y;o++)l=l+1;let p={x:h*c.taskMargin+h*c.width+P,y:50,text:r.section,fill:g,num:x,colour:m,taskCount:l};j.drawSection(t,p,c),i=r.section,d++}let a=r.people.reduce((l,y)=>(E[y]&&(l[y]=E[y]),l),{});r.x=h*c.taskMargin+h*c.width+P,r.y=u,r.width=c.diagramMarginX,r.height=c.diagramMarginY,r.colour=m,r.fill=g,r.num=x,r.actors=a,j.drawTask(t,r,c),S.insert(r.x,r.y,r.x+r.width+c.taskMargin,450)}},"drawTasks"),_t={setConf:Gt,draw:Ut},ie={parser:Pt,db:xt,renderer:_t,styles:zt,init:n(t=>{_t.setConf(t.journey),xt.clear()},"init")};export{ie as diagram};

Callers 4

tFunction · 0.90
eFunction · 0.90
sFunction · 0.90
chunk-QMDHABEH.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected