PageSourceSearch

https://cdn.oreateai.com/static/oreatesea/assets/stateDiagram-v2-1992cada.RrZbRBV2-DwKKf036-xl63jZFy.js

js oreateai.com collected 2026-10-02 04:30:35 UTC 5,317 bytes, 1 lines download raw bytes

1import{x as Z,C as I,v as _,T as z,Q as F,D as H,g as J,$ as K}from"./styles-0784dbeb.B4Xib_qh-CyUvHYPM-CxQaYiK8.js";import{R as tt}from"./graph.Doj0trym-SuC8wTcv-CQlFUdjs.js";import{fU as b,fP as v,fT as S,g8 as et,fV as st,fX as B}from"./errorMonitor-Cf5wXY6C.js";import{x as ot}from"./index-01f381cb.BJqK_LXQ-lyhf6H1N-BkQ5VB8v.js";import"./html-r4eYa5OA.js";import"./layout.oaZJmusP-Dl_umbZp-DBrHefVn.js";import"./clone.Djf8k5jk-tcd5583d-CWlr3nqr.js";import"./edges-066a5561.DGXaydv9-CCuBZQ_D-DBIK1Box.js";import"./createText-ca0c5216.CuEfW_ss-Ccr39xhx-BbB41oO4.js";import"./line.D8WlrxM0-C-sCIaQ9-CLJVhqW9.js";import"./array.CqVTtuYm-fKLgkG2b-BzrFf4n-.js";import"./path.C0NDTjT5-CTuRNnpz-BGLZK2l_.js";var it=(e,i,t)=>new Promise((r,a)=>{var n=d=>{try{l(t.next(d))}catch(o){a(o)}},s=d=>{try{l(t.throw(d))}catch(o){a(o)}},l=d=>d.done?r(d.value):Promise.resolve(d.value).then(n,s);l((t=t.apply(e,i)).next())});const w="rect",A="rectWithTitle",rt="start",at="end",nt="divider",dt="roundedWithTitle",lt="note",ct="noteGroup",y="statediagram",pt="state",gt=`${y}-${pt}`,L="transition",bt="note",ht="note-edge",ut=`${L} ${ht}`,yt=`${y}-${bt}`,ft="cluster",mt=`${y}-${ft}`,$t="cluster-alt",xt=`${y}-${$t}`,O="parent",j="note",wt="state",R="----",Tt=`${R}${j}`,W=`${R}${O}`,G="fill:none",q="fill: #333",Q="c",U="text",X="normal";let T={},g=0;const vt=function(e){const i=Object.keys(e);for(const t of i)e[t]},Dt=function(e,i){return i.db.extract(i.db.getRootDocV2()),i.db.getClasses()};function St(e){return e==null?"":e.classes?e.classes.join(" "):""}function k(e="",i=0,t="",r=R){const a=t!==null&&t.length>0?`${r}${t}`:"";return`${wt}-${e}${a}-${i}`}const x=(e,i,t,r,a,n)=>{const s=t.id,l=St(r[s]);if(s!=="root"){let d=w;t.start===!0&&(d=rt),t.start===!1&&(d=at),t.type!==z&&(d=t.type),T[s]||(T[s]={id:s,shape:d,description:B.sanitizeText(s,v()),classes:`${l} ${gt}`});const o=T[s];t.description&&(Array.isArray(o.description)?(o.shape=A,o.description.push(t.description)):o.description.length>0?(o.shape=A,o.description===s?o.description=[t.description]:o.description=[o.description,t.description]):(o.shape=w,o.description=t.description),o.description=B.sanitizeTextOrArray(o.description,v())),o.description.length===1&&o.shape===A&&(o.shape=w),!o.type&&t.doc&&(b.info("Setting cluster for ",s,E(t)),o.type="group",o.dir=E(t),o.shape=t.type===F?nt:dt,o.classes=o.classes+" "+mt+" "+(n?xt:""));const u={labelStyle:"",shape:o.shape,labelText:o.description,classes:o.classes,style:"",id:s,dir:o.dir,domId:k(s,g),type:o.type,padding:15};if(u.centerLabel=!0,t.note){const c={labelStyle:"",shape:lt,labelText:t.note.text,classes:yt,style:"",id:s+Tt+"-"+g,domId:k(s,g,j),type:o.type,padding:15},p={labelStyle:"",shape:ct,labelText:t.note.text,classes:o.classes,style:"",id:s+W,domId:k(s,g,O),type:"group",padding:0};g++;const f=s+W;e.setNode(f,p),e.setNode(c.id,c),e.setNode(s,u),e.setParent(s,f),e.setParent(c.id,f);let h=s,m=c.id;t.note.position==="left of"&&(h=c.id,m=s),e.setEdge(h,m,{arrowhead:"none",arrowType:"",style:G,labelStyle:"",classes:ut,arrowheadStyle:q,labelpos:Q,labelType:U,thickness:X})}else e.setNode(s,u)}i&&i.id!=="root"&&(b.trace("Setting node ",s," to be child of its parent ",i.id),e.setParent(s,i.id)),t.doc&&(b.trace("Adding nodes children "),At(e,t,t.doc,r,a,!n))},At=(e,i,t,r,a,n)=>{b.trace("items",t),t.forEach(s=>{switch(s.stmt){case J:x(e,i,s,r,a,n);break;case z:x(e,i,s,r,a,n);break;case H:{x(e,i,s.state1,r,a,n),x(e,i,s.state2,r,a,n);const l={id:"edge"+g,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:G,labelStyle:"",label:B.sanitizeText(s.description,v()),arrowheadStyle:q,labelpos:Q,labelType:U,thickness:X,classes:L};e.setEdge(s.state1.id,s.state2.id,l,g),g++}break}})},E=(e,i=K)=>{let t=i;if(e.doc)for(let r=0;r<e.doc.length;r++){const a=e.doc[r];a.stmt==="dir"&&(t=a.value)}return t},kt=function(e,i,t,r){return it(this,null,function*(){b.info("Drawing state diagram (v2)",i),T={},r.db.getDirection();const{securityLevel:a,state:n}=v(),s=n.nodeSpacing||50,l=n.rankSpacing||50;b.info(r.db.getRootDocV2()),r.db.extract(r.db.getRootDocV2()),b.info(r.db.getRootDocV2());const d=r.db.getStates(),o=new tt({multigraph:!0,compound:!0}).setGraph({rankdir:E(r.db.getRootDocV2()),nodesep:s,ranksep:l,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});x(o,void 0,r.db.getRootDocV2(),d,r.db,!0);let u;a==="sandbox"&&(u=S("#i"+i));const c=a==="sandbox"?S(u.nodes()[0].contentDocument.body):S("body"),p=c.select(`[id="${i}"]`),f=c.select("#"+i+" g");yield ot(f,o,["barb"],y,i);const h=8;et.insertTitle(p,"statediagramTitleText",n.titleTopMargin,r.db.getDiagramTitle());const m=p.node().getBBox(),V=m.width+h*2,C=m.height+h*2;p.attr("class",y);const P=p.node().getBBox();st(p,C,V,n.useMaxWidth);const M=`${P.x-h} ${P.y-h} ${V} ${C}`;b.debug(`viewBox ${M}`),p.attr("viewBox",M);const Y=document.querySelectorAll('[id="'+i+'"] .edgeLabel .label');for(const D of Y){const N=D.getBBox(),$=document.createElementNS("http://www.w3.org/2000/svg",w);$.setAttribute("rx",0),$.setAttribute("ry",0),$.setAttribute("width",N.width),$.setAttribute("height",N.height),D.insertBefore($,D.firstChild)}})},Bt={setConf:vt,getClasses:Dt,draw:kt},jt={parser:Z,db:I,renderer:Bt,styles:_,init:e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute,I.clear()}};export{jt as diagram};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.