@opencodex/cli 1.0.39 → 1.0.40
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/LICENSE.md +12 -0
- package/README.md +427 -31
- package/bin/stt/requirements.txt +32 -0
- package/bin/stt/stt_server.py +619 -0
- package/bin/tts/requirements.txt +21 -0
- package/bin/tts/tts_server.py +404 -0
- package/cli-wrapper.cjs +4 -0
- package/llms.txt +88 -0
- package/package.json +30 -11
- package/web/dist/assets/AssistantsView-BiUiWjhF.js +1 -0
- package/web/dist/assets/AutomationView-Dcf_yNaI.js +1 -0
- package/web/dist/assets/ChannelConfigView-BLnxsMGm.js +8 -0
- package/web/dist/assets/ConnectorsView-CX3E6X6c.js +1 -0
- package/web/dist/assets/DesignSystemView--x-P-lpD.js +1 -0
- package/web/dist/assets/Drawer-CjAgqH3B.js +1 -0
- package/web/dist/assets/{FileTreeView-hBtHBbAV.js → FileTreeView-Chb_fzTK.js} +3 -3
- package/web/dist/assets/HookConfigView-EafYlWdN.js +1 -0
- package/web/dist/assets/InputArea-BbHslX7b.js +50 -0
- package/web/dist/assets/ModelsView-CGN5Nljr.js +1 -0
- package/web/dist/assets/PluginsView-CDiJgvI8.js +2 -0
- package/web/dist/assets/ProjectsView-C5Usmwqy.js +1 -0
- package/web/dist/assets/SessionGrid-Drxg0r_u.js +4 -0
- package/web/dist/assets/SettingsModal-Cmts6aBG.js +10 -0
- package/web/dist/assets/Skeleton-Dsk6B0U3.js +1 -0
- package/web/dist/assets/SkillsView-TEDR_3XX.js +1 -0
- package/web/dist/assets/TemplatesTab-DtN5Kdgh.js +1 -0
- package/web/dist/assets/ToolsView-VukZnIt1.js +1 -0
- package/web/dist/assets/VizCardsSkeleton-C_GaEfXd.js +1 -0
- package/web/dist/assets/abnfDiagram-YUKMZFIV-BIFw6B_N.js +1 -0
- package/web/dist/assets/arc-BZQ951h9.js +1 -0
- package/web/dist/assets/architectureDiagram-47P4ROYG-BP5qiXzf.js +36 -0
- package/web/dist/assets/blockDiagram-E7TT5TSB-DtRpcE7F.js +140 -0
- package/web/dist/assets/c4Diagram-CRA5TL53-Gdzn8UBh.js +38 -0
- package/web/dist/assets/channel-BND6_KSH.js +1 -0
- package/web/dist/assets/chunk-2Q5K7J3B-3U6HMlsm.js +1 -0
- package/web/dist/assets/chunk-5VM5RSS4-CYl9mwa-.js +15 -0
- package/web/dist/assets/chunk-7TKQ45FW-Dn6ktcY5.js +1 -0
- package/web/dist/assets/chunk-AW2ZBBNX-De0QX6p1.js +88 -0
- package/web/dist/assets/chunk-FVRAUYC3-CpXDfvz4.js +2 -0
- package/web/dist/assets/chunk-HTAEGDNF-D1KDvcDd.js +1 -0
- package/web/dist/assets/chunk-JWPE2WC7-umm4A-fq.js +1 -0
- package/web/dist/assets/chunk-KQW6MTUR-JYH94hpE.js +1 -0
- package/web/dist/assets/chunk-XXDRQBXY-CSlCFByc.js +1 -0
- package/web/dist/assets/classDiagram-v2-K4WV4PDN-DnFwS0qN.js +217 -0
- package/web/dist/assets/cose-bilkent-JH36ORCC-BxUTUyep.js +1 -0
- package/web/dist/assets/cynefin-EF2NZ3EQ-CiMvulJr.js +141 -0
- package/web/dist/assets/cynefinDiagram-3GCD6N5R-DuXFORdW.js +62 -0
- package/web/dist/assets/cytoscape.esm-Ix0LnXOy.js +331 -0
- package/web/dist/assets/dagre-W4DXFKR2-DzMZHXci.js +4 -0
- package/web/dist/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/web/dist/assets/diagram-2UJZ2QOL-B6tO5G1v.js +200 -0
- package/web/dist/assets/diagram-OVF4WLC6-DRZt8tGc.js +24 -0
- package/web/dist/assets/diagram-PFPMY2P6-DGh6IecR.js +30 -0
- package/web/dist/assets/diagram-UMYRVEAY-BLbnt0yT.js +24 -0
- package/web/dist/assets/diagram-YEKJPTXX-C-S5DVhj.js +41 -0
- package/web/dist/assets/diagram-ZIFT7M5P-JrGHTWbo.js +3 -0
- package/web/dist/assets/ebnfDiagram-VR2GEFS7-DPXA-YOi.js +1 -0
- package/web/dist/assets/elk-IJKZMXRS-CINeWt2W.js +27 -0
- package/web/dist/assets/erDiagram-O2IAPWRE-PPaHmqA1.js +99 -0
- package/web/dist/assets/flowDiagram-OXPTDLAJ-t-u0QXEA.js +213 -0
- package/web/dist/assets/ganttDiagram-R7TSEDQI-Bw49ZD_b.js +292 -0
- package/web/dist/assets/gitGraphDiagram-XJZIOB7I-BAfOqeeg.js +106 -0
- package/web/dist/assets/graph-Bn3Yngep.js +1 -0
- package/web/dist/assets/{icons-BxNxyk-c.js → icons-Bm_ZzSAy.js} +320 -160
- package/web/dist/assets/index-CeeLdENM.js +677 -0
- package/web/dist/assets/index-Ceez9lYk.css +1 -0
- package/web/dist/assets/infoDiagram-5W2HQ5XZ-Bv4RBxYW.js +2 -0
- package/web/dist/assets/init-Gi6I4Gst.js +1 -0
- package/web/dist/assets/ishikawaDiagram-K3B6WC7H-DEpj0bRp.js +70 -0
- package/web/dist/assets/journeyDiagram-COXZFDF6-MJu84Iiz.js +139 -0
- package/web/dist/assets/kanban-definition-P3RFRI5V-mlYSRALK.js +89 -0
- package/web/dist/assets/linear-5j9gt8MV.js +1 -0
- package/web/dist/assets/{markdown-B2L4Mq-x.js → markdown-BWXjRrSw.js} +8 -8
- package/web/dist/assets/mermaid.core-DLb6eAON.js +314 -0
- package/web/dist/assets/mindmap-definition-LZFPQGKD-C9v_57Ex.js +96 -0
- package/web/dist/assets/ordinal-Cboi1Yqb.js +1 -0
- package/web/dist/assets/{panels-P_I7Q72_.js → panels-BQOvnbWH.js} +1 -1
- package/web/dist/assets/pegDiagram-BGZESJAR-KQP26s3-.js +1 -0
- package/web/dist/assets/pieDiagram-CAPJLFHJ-DN3RQ_ih.js +39 -0
- package/web/dist/assets/profileChange-B7TaQ18u.js +1 -0
- package/web/dist/assets/quadrantDiagram-GDMTTRAM-BpL_ZL76.js +7 -0
- package/web/dist/assets/railroadDiagram-SM67HX2B-DZ-fPU85.js +1 -0
- package/web/dist/assets/{react-vendor-B2V_5iSS.js → react-vendor-C0HIWSpf.js} +1 -1
- package/web/dist/assets/requirementDiagram-X7JNWC4A-mKPGj64L.js +84 -0
- package/web/dist/assets/sankeyDiagram-UM26HJRW-Bs4xfjQP.js +40 -0
- package/web/dist/assets/sequenceDiagram-ZO4K6R2Y-BjUmzZaO.js +169 -0
- package/web/dist/assets/sizeCapture-INFHLROL-BXBM3j_Q.js +1 -0
- package/web/dist/assets/{state-0T92JV0u.js → state-Kfon1nTr.js} +1 -1
- package/web/dist/assets/stateDiagram-v2-TBUQTH76-FGgFDGUU.js +291 -0
- package/web/dist/assets/sttLanguages-C7kVulzY.js +1 -0
- package/web/dist/assets/swimlanes-N4OXWK64-wkd_n4HU.js +1 -0
- package/web/dist/assets/swimlanesDiagram-K3J5GTZL-CKnwEuq_.js +8 -0
- package/web/dist/assets/timeline-definition-YOQAKGHF-DyBln1jw.js +120 -0
- package/web/dist/assets/usecaseDiagram-VIAY4XPW-Cqis3XHX.js +370 -0
- package/web/dist/assets/vennDiagram-BLWOH2XV-BaiFLOVS.js +34 -0
- package/web/dist/assets/wardleyDiagram-YMQ3BMBF-C4CzpJto.js +78 -0
- package/web/dist/assets/xychartDiagram-TAQBALBS-Dp1hfe3-.js +7 -0
- package/web/dist/figma-demo/product-1.jpg +0 -0
- package/web/dist/figma-demo/product-2.jpg +0 -0
- package/web/dist/figma-demo/trail-1.jpg +0 -0
- package/web/dist/figma-demo/trail-2.jpg +0 -0
- package/web/dist/figma-demo/trail-3.jpg +0 -0
- package/web/dist/index.html +8 -8
- package/web/dist/assets/AssistantsView-0aLB_cG6.js +0 -1
- package/web/dist/assets/AutomationView-CAMjPhJ2.js +0 -1
- package/web/dist/assets/ChannelConfigView-FcioeeYb.js +0 -8
- package/web/dist/assets/ConnectorsView-DERP7zAW.js +0 -1
- package/web/dist/assets/HookConfigView-NModtSB8.js +0 -1
- package/web/dist/assets/ModelsView-BPpO50C_.js +0 -1
- package/web/dist/assets/PluginsView-D0NE7zrt.js +0 -1
- package/web/dist/assets/ProjectsView-PIv7Gx4q.js +0 -1
- package/web/dist/assets/SessionGrid-BsDL3lov.js +0 -47
- package/web/dist/assets/SettingsModal-DdebvEmv.js +0 -10
- package/web/dist/assets/SkillsView-BNoigImJ.js +0 -1
- package/web/dist/assets/TemplatesTab-D8Pa68fj.js +0 -1
- package/web/dist/assets/ToolsView-NY-yk5YX.js +0 -1
- package/web/dist/assets/WorkspaceDirPicker-C5knnArH.js +0 -6
- package/web/dist/assets/index-DaiVo1RY.css +0 -1
- package/web/dist/assets/index-RB5ffy32.js +0 -620
- package/web/dist/assets/profileChange-C7Jg9C61.js +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{ba as Wt,s as Kt,g as Ht,x as Yt,v as Xt,a as Zt,b as Qt,_ as S,O as St,T as Jt,k as rt,at as $t,ai as te,aj as ee,ak as ne,d as se,D as ie,Q as re,R as oe}from"./mermaid.core-DLb6eAON.js";import"./index-CeeLdENM.js";import"./markdown-BWXjRrSw.js";import"./icons-Bm_ZzSAy.js";import"./react-vendor-C0HIWSpf.js";import"./state-Kfon1nTr.js";import"./panels-BQOvnbWH.js";const It=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(Q(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)Q(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Q(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)Q(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);Q(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Nt(e)}function Ot(t,n,s,e,i){const r=jt(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Nt(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Nt(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(k=>{k.size==0&&k.sets.length==1&&O.add(k.sets[0])}),f=f.filter(k=>!k.sets.some(C=>O.has(C)));let I={},D={};if(f.length>0){let k=b(f,{lossFunction:v,distinct:m});l&&(k=Dt(k,o,d)),I=Ot(k,s,e,i,h),D=Lt(I,f,M)}const X={};f.forEach(k=>{k.label&&(X[k.sets]=k.label)});function G(k){if(k.sets in X)return X[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(k){const C=this.getAttribute("d");k.sets.length==1&&C&&!m&&(z=!0,V[k.sets[0]]=Me(C))});function q(k){return C=>{const H=k.sets.map(J=>{let W=V[J],Y=I[J];return W||(W={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:W.x*(1-C)+Y.x*C,y:W.y*(1-C)+Y.y*C,radius:W.radius*(1-C)+Y.radius*C}});return wt(H,y)}}const R=B.selectAll(".venn-area").data(f,k=>k.sets),N=R.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),F=N.append("path"),L=N.append("text").attr("class","label").text(k=>G(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function P(k){return typeof k.transition=="function"?k.transition("venn").duration(r):k}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",k=>wt(k.sets.map(C=>I[C])),y);const j=_.selectAll("text").filter(k=>k.sets in D).text(k=>G(k)).attr("x",k=>Math.floor(D[k.sets].x)).attr("y",k=>Math.floor(D[k.sets].y));u&&(z?"on"in j?j.on("end",ot(I,G)):j.each("end",ot(I,G)):j.each(ot(I,G)));const A=P(R.exit()).remove();typeof R.transition=="function"&&A.selectAll("path").attrTween("d",q);const Z=A.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),j.style("font-size",p),Z.style("font-size","0px")),{circles:I,textCentres:D,nodes:R,enter:N,update:_,exit:A}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Ft(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Ft(t,[]):Et(u.arcs.map(a=>a.p1))}function ke(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=ke(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=Ft(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
|
|
2
|
+
M`,t,n),e.push(`
|
|
3
|
+
m`,-s,0),e.push(`
|
|
4
|
+
a`,s,s,0,1,0,s*2,0),e.push(`
|
|
5
|
+
a`,s,s,0,1,0,-s*2,0),e.join(" ")}function Me(t){const n=t.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}function Pt(t){if(t.length===0)return[];const n={};return st(t,n),n.arcs}function Bt(t,n){if(t.length===0)return"M 0 0";const s=Math.pow(10,n||0),e=n!=null?r=>Math.round(r*s)/s:r=>r;if(t.length==1){const r=t[0].circle;return Ie(e(r.x),e(r.y),e(r.radius))}const i=[`
|
|
6
|
+
M`,e(t[0].p2.x),e(t[0].p2.y)];for(const r of t){const o=e(r.circle.radius);i.push(`
|
|
7
|
+
A`,o,o,0,r.large?1:0,r.sweep?1:0,e(r.p1.x),e(r.p1.y))}return i.join(" ")}function wt(t,n){return Bt(Pt(t),n)}function we(t,n={}){const{lossFunction:s,layoutFunction:e=At,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:l=600,height:h=350,padding:u=15,scaleToFit:a=!1,symmetricalTextCentre:p=!1,distinct:d,round:m=2}=n;let y=e(t,{lossFunction:s==="default"||!s?et:s==="logRatio"?Ct:s,distinct:d});i&&(y=Dt(y,r,o));const M=Ot(y,l,h,u,a),E=Lt(M,t,p),T=new Map(Object.keys(M).map(b=>[b,{set:b,x:M[b].x,y:M[b].y,radius:M[b].radius}])),w=t.map(b=>{const v=b.sets.map(f=>T.get(f)),c=Pt(v),x=Bt(c,m);return{circles:v,arcs:c,path:x,area:b,has:new Set(b.sets)}});function g(b){let v="";for(const c of w)c.has.size>b.length&&b.every(x=>c.has.has(x))&&(v+=" "+c.path);return v}return w.map(({circles:b,arcs:v,path:c,area:x})=>({data:x,text:E[x.sets],circles:b,arcs:v,path:c,distinctPath:c+g(x.sets)}))}var gt=(function(){var t=S(function(w,g,b,v){for(b=b||{},v=w.length;v--;b[w[v]]=g);return b},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],e=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],o=[1,31],l=[1,39],h=[7,8,11,12,17,19,22,24,27],u=[1,57],a=[1,56],p=[1,58],d=[1,59],m=[1,60],y=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],M={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:S(function(g,b,v,c,x,f,O){var I=f.length-1;switch(x){case 1:return f[I-1];case 2:case 3:case 4:this.$=[];break;case 5:f[I-1].push(f[I]),this.$=f[I-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=f[I];break;case 8:c.setDiagramTitle(f[I].substr(6)),this.$=f[I].substr(6);break;case 9:c.addSubsetData([f[I]],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 10:c.addSubsetData([f[I-1]],f[I],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 11:c.addSubsetData([f[I-2]],void 0,parseFloat(f[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 12:c.addSubsetData([f[I-3]],f[I-2],parseFloat(f[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 13:if(f[I].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[I]),c.addSubsetData(f[I],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 14:if(f[I-1].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[I-1]),c.addSubsetData(f[I-1],f[I],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 15:if(f[I-2].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[I-2]),c.addSubsetData(f[I-2],void 0,parseFloat(f[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 16:if(f[I-3].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[I-3]),c.addSubsetData(f[I-3],f[I-2],parseFloat(f[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 17:case 18:case 19:c.addTextData(f[I-1],f[I],void 0);break;case 20:case 21:c.addTextData(f[I-2],f[I-1],f[I]);break;case 23:c.addStyleData(f[I-1],f[I]);break;case 24:case 25:case 26:var D=c.getCurrentSets();if(!D)throw new Error("text requires set");c.addTextData(D,f[I],void 0);break;case 27:case 28:var D=c.getCurrentSets();if(!D)throw new Error("text requires set");c.addTextData(D,f[I-1],f[I]);break;case 29:case 41:this.$=[f[I]];break;case 30:case 42:this.$=[...f[I-2],f[I]];break;case 31:this.$=[f[I-2],f[I]];break;case 33:this.$=f[I].join(" ");break;case 34:this.$=[f[I]];break;case 35:f[I-1].push(f[I]),this.$=f[I-1];break;case 43:case 44:this.$=f[I];break}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:e,21:i},{13:20,18:19,20:e,21:i},{13:20,18:21,20:e,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:e,21:i},t(s,[2,9],{14:[1,27],15:[1,28]}),t(r,[2,43]),t(r,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:o}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:o},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:e,21:i},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(h,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(r,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:u,20:a,21:[1,53],28:52,29:54,30:55,31:p,32:d,33:m},t(s,[2,12]),t(s,[2,16]),t(h,[2,30]),t(h,[2,31]),t(h,[2,32]),t(h,[2,33],{30:61,16:u,20:a,31:p,32:d,33:m}),t(y,[2,34]),t(y,[2,36]),t(y,[2,37]),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,35])],defaultActions:{6:[2,1]},parseError:S(function(g,b){if(b.recoverable)this.trace(g);else{var v=new Error(g);throw v.hash=b,v}},"parseError"),parse:S(function(g){var b=this,v=[0],c=[],x=[null],f=[],O=this.table,I="",D=0,X=0,G=2,B=1,V=f.slice.call(arguments,1),z=Object.create(this.lexer),q={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(q.yy[R]=this.yy[R]);z.setInput(g,q.yy),q.yy.lexer=z,q.yy.parser=this,typeof z.yylloc>"u"&&(z.yylloc={});var N=z.yylloc;f.push(N);var F=z.options&&z.options.ranges;typeof q.yy.parseError=="function"?this.parseError=q.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function L(U){v.length=v.length-2*U,x.length=x.length-U,f.length=f.length-U}S(L,"popStack");function P(){var U;return U=c.pop()||z.lex()||B,typeof U!="number"&&(U instanceof Array&&(c=U,U=c.pop()),U=b.symbols_[U]||U),U}S(P,"lex");for(var _,j,A,Z,k={},C,H,J,W;;){if(j=v[v.length-1],this.defaultActions[j]?A=this.defaultActions[j]:((_===null||typeof _>"u")&&(_=P()),A=O[j]&&O[j][_]),typeof A>"u"||!A.length||!A[0]){var Y="";W=[];for(C in O[j])this.terminals_[C]&&C>G&&W.push("'"+this.terminals_[C]+"'");z.showPosition?Y="Parse error on line "+(D+1)+`:
|
|
8
|
+
`+z.showPosition()+`
|
|
9
|
+
Expecting `+W.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on line "+(D+1)+": Unexpected "+(_==B?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Y,{text:z.match,token:this.terminals_[_]||_,line:z.yylineno,loc:N,expected:W})}if(A[0]instanceof Array&&A.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+_);switch(A[0]){case 1:v.push(_),x.push(z.yytext),f.push(z.yylloc),v.push(A[1]),_=null,X=z.yyleng,I=z.yytext,D=z.yylineno,N=z.yylloc;break;case 2:if(H=this.productions_[A[1]][1],k.$=x[x.length-H],k._$={first_line:f[f.length-(H||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(H||1)].first_column,last_column:f[f.length-1].last_column},F&&(k._$.range=[f[f.length-(H||1)].range[0],f[f.length-1].range[1]]),Z=this.performAction.apply(k,[I,X,D,q.yy,A[1],x,f].concat(V)),typeof Z<"u")return Z;H&&(v=v.slice(0,-1*H*2),x=x.slice(0,-1*H),f=f.slice(0,-1*H)),v.push(this.productions_[A[1]][0]),x.push(k.$),f.push(k._$),J=O[v[v.length-2]][v[v.length-1]],v.push(J);break;case 3:return!0}}return!0},"parse")},E=(function(){var w={EOF:1,parseError:S(function(b,v){if(this.yy.parser)this.yy.parser.parseError(b,v);else throw new Error(b)},"parseError"),setInput:S(function(g,b){return this.yy=b||this.yy||{},this._input=g,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]),this.offset=0,this},"setInput"),input:S(function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.offset++,this.match+=g,this.matched+=g;var b=g.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),g},"input"),unput:S(function(g){var b=g.length,v=g.split(/(?:\r\n?|\n)/g);this._input=g+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),v.length-1&&(this.yylineno-=v.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:v?(v.length===c.length?this.yylloc.first_column:0)+c[c.length-v.length].length-v[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(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).
|
|
10
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(g){this.unput(this.match.slice(g))},"less"),pastInput:S(function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var g=this.pastInput(),b=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
|
|
11
|
+
`+b+"^"},"showPosition"),test_match:S(function(g,b){var v,c,x;if(this.options.backtrack_lexer&&(x={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&&(x.yylloc.range=this.yylloc.range.slice(0))),c=g[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+g[0].length},this.yytext+=g[0],this.match+=g[0],this.matches=g,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(g[0].length),this.matched+=g[0],v=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var f in x)this[f]=x[f];return!1}return!1},"test_match"),next:S(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,b,v,c;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),f=0;f<x.length;f++)if(v=this._input.match(this.rules[x[f]]),v&&(!b||v[0].length>b[0].length)){if(b=v,c=f,this.options.backtrack_lexer){if(g=this.test_match(v,x[f]),g!==!1)return g;if(this._backtrack){b=!1;continue}else return!1}else if(!this.options.flex)break}return b?(g=this.test_match(b,x[c]),g!==!1?g:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
12
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:S(function(){var b=this.next();return b||this.lex()},"lex"),begin:S(function(b){this.conditionStack.push(b)},"begin"),popState:S(function(){var b=this.conditionStack.length-1;return b>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:S(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:S(function(b){return b=this.conditionStack.length-1-Math.abs(b||0),b>=0?this.conditionStack[b]:"INITIAL"},"topState"),pushState:S(function(b){this.begin(b)},"pushState"),stateStackSize:S(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:S(function(b,v,c,x){switch(c){case 0:break;case 1:break;case 2:break;case 3:if(b.getIndentMode&&b.getIndentMode())return b.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:b.setIndentMode&&b.setIndentMode(!1),this.begin("INITIAL"),this.unput(v.yytext);break;case 6:return this.begin("bol"),8;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(b.consumeIndentText)b.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return v.yytext=v.yytext.slice(2,-2),14;case 17:return v.yytext=v.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return w})();M.lexer=E;function T(){this.yy={}}return S(T,"Parser"),T.prototype=M,M.Parser=T,new T})();gt.parser=gt;var Se=gt,yt=[],pt=[],mt=[],bt=new Set,vt,kt=!1,_e=S((t,n,s)=>{const e=it(t).sort(),i=s??10/Math.pow(t.length,2);vt=e,e.length===1&&bt.add(e[0]),yt.push({sets:e,size:i,label:n?nt(n):void 0})},"addSubsetData"),Te=S(()=>yt,"getSubsetData"),nt=S(t=>{const n=t.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),Ee=S(t=>t&&nt(t),"normalizeStyleValue"),ze=S((t,n,s)=>{const e=nt(n);pt.push({sets:it(t).sort(),id:e,label:s?nt(s):void 0})},"addTextData"),Ae=S((t,n)=>{const s=it(t).sort(),e={};for(const[i,r]of n)e[i]=Ee(r)??r;mt.push({targets:s,styles:e})},"addStyleData"),Re=S(()=>mt,"getStyleData"),it=S(t=>t.map(n=>nt(n)),"normalizeIdentifierList"),Ce=S(t=>{const s=it(t).filter(e=>!bt.has(e));if(s.length>0)throw new Error(`unknown set identifier: ${s.join(", ")}`)},"validateUnionIdentifiers"),De=S(()=>pt,"getTextData"),Oe=S(()=>vt,"getCurrentSets"),Ne=S(()=>kt,"getIndentMode"),je=S(t=>{kt=t},"setIndentMode"),Fe=oe.venn;function Vt(){return re(Fe,St().venn)}S(Vt,"getConfig");var Le=S(()=>{ie(),yt.length=0,pt.length=0,mt.length=0,bt.clear(),vt=void 0,kt=!1},"customClear"),Pe={getConfig:Vt,clear:Le,setAccTitle:Qt,getAccTitle:Zt,setDiagramTitle:Xt,getDiagramTitle:Yt,getAccDescription:Ht,setAccDescription:Kt,addSubsetData:_e,getSubsetData:Te,addTextData:ze,addStyleData:Ae,validateUnionIdentifiers:Ce,getTextData:De,getStyleData:Re,getCurrentSets:Oe,getIndentMode:Ne,setIndentMode:je},Be=S(t=>`
|
|
13
|
+
.venn-title {
|
|
14
|
+
font-size: 32px;
|
|
15
|
+
fill: ${t.vennTitleTextColor};
|
|
16
|
+
font-family: ${t.fontFamily};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.venn-circle text {
|
|
20
|
+
font-size: 48px;
|
|
21
|
+
font-family: ${t.fontFamily};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.venn-intersection text {
|
|
25
|
+
font-size: 48px;
|
|
26
|
+
fill: ${t.vennSetTextColor};
|
|
27
|
+
font-family: ${t.fontFamily};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.venn-text-node {
|
|
31
|
+
font-family: ${t.fontFamily};
|
|
32
|
+
color: ${t.vennSetTextColor};
|
|
33
|
+
}
|
|
34
|
+
`,"getStyles"),Ve=Be;function qt(t){const n=new Map;for(const s of t){const e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}S(qt,"buildStyleByKey");var qe=S((t,n,s,e)=>{var V,z,q;const i=e.db,r=(V=i.getConfig)==null?void 0:V.call(i),{themeVariables:o,look:l,handDrawnSeed:h}=St(),u=l==="handDrawn",a=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),p=(z=i.getDiagramTitle)==null?void 0:z.call(i),d=i.getSubsetData(),m=i.getTextData(),y=qt(i.getStyleData()),M=Gt(d),E=(r==null?void 0:r.width)??800,T=(r==null?void 0:r.height)??450,g=E/1600,b=p?48*g:0,v=o.primaryTextColor??o.textColor,c=Jt(n);c.attr("viewBox",`0 0 ${E} ${T}`),p&&c.append("text").text(p).attr("class","venn-title").attr("font-size",`${32*g}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*g).style("fill",o.vennTitleTextColor||o.titleColor);const x=rt(document.createElement("div")),f=ve().width(E).height(T-b);x.datum(M).call(f);const O=u?$t.svg(x.select("svg").node()):void 0,I=we(M,{width:E,height:T-b,padding:(r==null?void 0:r.padding)??15}),D=new Map;for(const R of I){const N=$([...R.data.sets].sort());D.set(N,R)}m.length>0&&Ut(r,D,x,m,g,y);const X=te(o.background||"#f4f4f4");x.selectAll(".venn-circle").each(function(R,N){var J;const F=rt(this),P=$([...R.sets].sort()),_=y.get(P),j=a.length>0?a[N%a.length]:void 0,A=(_==null?void 0:_.fill)||j||o.primaryColor;F.classed(`venn-set-${N%8}`,!0);const Z=(_==null?void 0:_["fill-opacity"])??.1,k=(_==null?void 0:_.stroke)||A,C=(_==null?void 0:_["stroke-width"])||`${5*g}`;if(u&&O){const W=D.get(P);if(W&&W.circles.length>0){const Y=W.circles[0],U=O.circle(Y.x,Y.y,Y.radius*2,{roughness:.7,seed:h,fill:It(A,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+N*60,stroke:k,strokeWidth:parseFloat(String(C))});F.select("path").remove(),(J=F.node())==null||J.insertBefore(U,F.select("text").node())}}else F.select("path").style("fill",A).style("fill-opacity",Z).style("stroke",k).style("stroke-width",C).style("stroke-opacity",.95);const H=(_==null?void 0:_.color)||(X?ee(A,30):ne(A,30));F.select("text").style("font-size",`${48*g}px`).style("fill",H)}),u&&O?x.selectAll(".venn-intersection").each(function(R){var j;const N=rt(this),L=$([...R.sets].sort()),P=y.get(L),_=P==null?void 0:P.fill;if(_){const A=N.select("path"),Z=A.attr("d");if(Z){const k=O.path(Z,{roughness:.7,seed:h,fill:It(_,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),C=A.node();(j=C==null?void 0:C.parentNode)==null||j.insertBefore(k,C),A.remove()}}else N.select("path").style("fill-opacity",0);N.select("text").style("font-size",`${48*g}px`).style("fill",(P==null?void 0:P.color)??o.vennSetTextColor??v)}):(x.selectAll(".venn-intersection text").style("font-size",`${48*g}px`).style("fill",R=>{var L;const F=$([...R.sets].sort());return((L=y.get(F))==null?void 0:L.color)??o.vennSetTextColor??v}),x.selectAll(".venn-intersection path").style("fill-opacity",R=>{var L;const F=$([...R.sets].sort());return(L=y.get(F))!=null&&L.fill?1:0}).style("fill",R=>{var L;const F=$([...R.sets].sort());return((L=y.get(F))==null?void 0:L.fill)??"transparent"}));const G=c.append("g").attr("transform",`translate(0, ${b})`),B=x.select("svg").node();if(B&&"childNodes"in B)for(const R of[...B.childNodes])(q=G.node())==null||q.appendChild(R);se(c,T,E,(r==null?void 0:r.useMaxWidth)??!0)},"draw");function $(t){return t.join("|")}S($,"stableSetsKey");function Ut(t,n,s,e,i,r){var a;const o=(t==null?void 0:t.useDebugLayout)??!1,h=s.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(const p of e){const d=$(p.sets),m=u.get(d);m?m.push(p):u.set(d,[p])}for(const[p,d]of u.entries()){const m=n.get(p);if(!(m!=null&&m.text))continue;const y=m.text.x,M=m.text.y,E=Math.min(...m.circles.map(V=>V.radius)),T=Math.min(...m.circles.map(V=>V.radius-Math.hypot(y-V.x,M-V.y)));let w=Number.isFinite(T)?Math.max(0,T):0;w===0&&Number.isFinite(E)&&(w=E*.6);const g=h.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);o&&g.append("circle").attr("class","venn-text-debug-circle").attr("cx",y).attr("cy",M).attr("r",w).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const b=Math.max(80*i,w*2*.95),v=Math.max(60*i,w*2*.95),f=(m.data.label&&m.data.label.length>0?Math.min(32*i,w*.25):0)+(d.length<=2?30*i:0),O=y-b/2,I=M-v/2+f,D=Math.max(1,Math.ceil(Math.sqrt(d.length))),X=Math.max(1,Math.ceil(d.length/D)),G=b/D,B=v/X;for(const[V,z]of d.entries()){const q=V%D,R=Math.floor(V/D),N=O+G*(q+.5),F=I+B*(R+.5);o&&g.append("rect").attr("class","venn-text-debug-cell").attr("x",O+G*q).attr("y",I+B*R).attr("width",G).attr("height",B).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const L=G*.9,P=B*.9,_=g.append("foreignObject").attr("class","venn-text-node-fo").attr("width",L).attr("height",P).attr("x",N-L/2).attr("y",F-P/2).attr("overflow","visible"),j=(a=r.get(z.id))==null?void 0:a.color,A=_.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(z.label??z.id);j&&A.style("color",j)}}}S(Ut,"renderTextNodes");function Gt(t){const n=new Set(t.map(i=>[...i.sets].sort().join("|"))),s=new Map(t.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),e=[];for(const i of t){if(i.sets.length<3)continue;const r=[...i.sets].sort();for(let o=0;o<r.length-1;o++)for(let l=o+1;l<r.length;l++){const h=[r[o],r[l]],u=h.join("|");if(!n.has(u)){n.add(u);const a=s.get(h[0]),p=s.get(h[1]),d=a!==void 0&&p!==void 0?Math.min(a,p)/4:2.5;e.push({sets:h,size:d,label:""})}}}return e.length>0?[...t,...e]:t}S(Gt,"ensurePairwiseSubsets");var Ue={draw:qe},Qe={parser:Se,db:Pe,renderer:Ue,styles:Ve};export{Qe as diagram};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{p as Tt}from"./chunk-JWPE2WC7-umm4A-fq.js";import{s as zt,g as Lt,x as At,v as Xt,a as Et,b as Yt,_ as y,a9 as It,O as Bt,Q as K,l as et,T as Ft,d as Ot,D as Rt,c as V}from"./mermaid.core-DLb6eAON.js";import{p as Wt}from"./cynefin-EF2NZ3EQ-CiMvulJr.js";import"./index-CeeLdENM.js";import"./markdown-BWXjRrSw.js";import"./icons-Bm_ZzSAy.js";import"./react-vendor-C0HIWSpf.js";import"./state-Kfon1nTr.js";import"./panels-BQOvnbWH.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(Tt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,z=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,z,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function xt(a,o){b.setSize(a,o)}y(xt,"setSize");function ht(a){b.startPipeline(a)}y(ht,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Rt()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:xt,startPipeline:ht,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Lt,setAccDescription:zt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,z,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((z=a.wardley)==null?void 0:z.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var U,J;et.debug(`Rendering Wardley map
|
|
2
|
+
`+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),z=v.getDiagramTitle(),M=((U=g.size)==null?void 0:U.width)??r.width,k=((J=g.size)==null?void 0:J.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Ot(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;z&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(z);const L=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),R=P.append("g").attr("class","wardley-axes");R.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),R.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";R.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),R.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const O=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(O.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===O.length){let i=0;n.forEach(x=>{s.push({start:i,end:x}),i=x})}else{const i=1/O.length;O.forEach((x,l)=>{s.push({start:l*i,end:(l+1)*i})})}O.forEach((i,x)=>{const l=s[x],h=r.padding+l.start*B,f=r.padding+l.end*B,u=(h+f)/2;x>0&&t.append("line").attr("x1",h).attr("x2",h).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:L(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f<i.length-1;f++){const u=i[f],w=i[f+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let x=1/0,l=-1/0,h=0;if(s.componentIds.forEach(f=>{const u=c.get(f);u&&(x=Math.min(x,u.x),l=Math.max(l,u.x),h=u.y)}),x!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=h-u/2,S=c.get(s.nodeId);if(S){const T=(x+l)/2;S.x=T,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",x-15).attr("y",w).attr("width",l-x+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const Q=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(Q).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,h=s.y-n.y,f=Math.sqrt(l*l+h*h);return n.x+l/f*x}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,h=s.y-n.y,f=Math.sqrt(l*l+h*h);return n.y+h/f*x}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,h=n.y-s.y,f=Math.sqrt(l*l+h*h);return s.x+l/f*x}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,h=n.y-s.y,f=Math.sqrt(l*l+h*h);return s.y+h/f*x}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(Q.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,x=s.y-n.y,l=s.x-n.x,h=Math.sqrt(l*l+x*x),f=8,u=x/h;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,x=s.x-n.x,l=s.y-n.y,h=Math.sqrt(x*x+l*l),f=8,u=-x/h;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,x=(n.y+s.y)/2,l=s.x-n.x,h=s.y-n.y,f=Math.sqrt(l*l+h*h),u=8,w=h/f,S=-l/f,T=i+w*u,W=x+S*u;let Y=Math.atan2(h,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${T} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=L(t.targetX),i=A(t.targetY),x=s-n.x,l=i-n.y,h=Math.sqrt(x*x+l*l),f=r.nodeRadius+2,u=h>f?s-x/h*f:s,w=h>f?i-l/h*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:L(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i<s.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[i].x).attr("y1",s[i].y).attr("x2",s[i+1].x).attr("y2",s[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach(i=>{const x=t.append("g").attr("class","wardley-annotation");x.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),x.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=L(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,x=16,l=11,h=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const T=h.append("text").attr("x",n+i).attr("y",s+i+(S+1)*x).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(T)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const T=w+i*2+105,W=f.length*x+i*2+S/2,Y=r.padding,Pt=M-r.padding-T,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*x)}),h.insert("rect","text").attr("x",n).attr("y",s).attr("width",T).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=L(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=L(n.x),i=A(n.y),x=60,l=30,h=20,f=`
|
|
3
|
+
M ${s} ${i-l/2}
|
|
4
|
+
L ${s+x-h} ${i-l/2}
|
|
5
|
+
L ${s+x-h} ${i-l/2-8}
|
|
6
|
+
L ${s+x} ${i}
|
|
7
|
+
L ${s+x-h} ${i+l/2+8}
|
|
8
|
+
L ${s+x-h} ${i+l/2}
|
|
9
|
+
L ${s} ${i+l/2}
|
|
10
|
+
Z
|
|
11
|
+
`;t.append("path").attr("d",f).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),t.append("text").attr("x",s+x/2).attr("y",i+l/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.name)})}if(g.deaccelerators.length>0){const t=P.append("g").attr("class","wardley-deaccelerators");g.deaccelerators.forEach(n=>{const s=L(n.x),i=A(n.y),x=60,l=30,h=20,f=`
|
|
12
|
+
M ${s+x} ${i-l/2}
|
|
13
|
+
L ${s+h} ${i-l/2}
|
|
14
|
+
L ${s+h} ${i-l/2-8}
|
|
15
|
+
L ${s} ${i}
|
|
16
|
+
L ${s+h} ${i+l/2+8}
|
|
17
|
+
L ${s+h} ${i+l/2}
|
|
18
|
+
L ${s+x} ${i+l/2}
|
|
19
|
+
Z
|
|
20
|
+
`;t.append("path").attr("d",f).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),t.append("text").attr("x",s+x/2).attr("y",i+l/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.name)})}},"draw"),Qt={draw:Zt},Ut=y(({wardley:a}={})=>{const o=It(),e=Bt(),p=K(o,e.themeVariables),r=K(p.wardley,a);return`
|
|
21
|
+
.wardley-background {
|
|
22
|
+
fill: ${r.backgroundColor};
|
|
23
|
+
}
|
|
24
|
+
.wardley-axes line, .wardley-axes path {
|
|
25
|
+
stroke: ${r.axisColor};
|
|
26
|
+
}
|
|
27
|
+
.wardley-axis-label {
|
|
28
|
+
fill: ${r.axisTextColor};
|
|
29
|
+
}
|
|
30
|
+
.wardley-stage-label {
|
|
31
|
+
fill: ${r.axisTextColor};
|
|
32
|
+
}
|
|
33
|
+
.wardley-grid line {
|
|
34
|
+
stroke: ${r.gridColor};
|
|
35
|
+
}
|
|
36
|
+
.wardley-node circle {
|
|
37
|
+
fill: ${r.componentFill};
|
|
38
|
+
stroke: ${r.componentStroke};
|
|
39
|
+
}
|
|
40
|
+
.wardley-node-label {
|
|
41
|
+
fill: ${r.componentLabelColor};
|
|
42
|
+
}
|
|
43
|
+
.wardley-link {
|
|
44
|
+
stroke: ${r.linkStroke};
|
|
45
|
+
}
|
|
46
|
+
.wardley-link--dashed {
|
|
47
|
+
stroke-dasharray: 4 4;
|
|
48
|
+
}
|
|
49
|
+
.wardley-link-label {
|
|
50
|
+
fill: ${r.axisTextColor};
|
|
51
|
+
}
|
|
52
|
+
.wardley-trend line {
|
|
53
|
+
stroke: ${r.evolutionStroke};
|
|
54
|
+
}
|
|
55
|
+
.wardley-annotation-line {
|
|
56
|
+
stroke: ${r.annotationStroke};
|
|
57
|
+
}
|
|
58
|
+
.wardley-annotation circle {
|
|
59
|
+
fill: ${r.annotationFill};
|
|
60
|
+
stroke: ${r.annotationStroke};
|
|
61
|
+
}
|
|
62
|
+
.wardley-annotation text {
|
|
63
|
+
fill: ${r.annotationTextColor};
|
|
64
|
+
}
|
|
65
|
+
.wardley-annotations-box rect {
|
|
66
|
+
fill: ${r.annotationFill};
|
|
67
|
+
stroke: ${r.annotationStroke};
|
|
68
|
+
}
|
|
69
|
+
.wardley-annotations-box text {
|
|
70
|
+
fill: ${r.annotationTextColor};
|
|
71
|
+
}
|
|
72
|
+
.wardley-pipeline-box {
|
|
73
|
+
stroke: ${r.componentStroke};
|
|
74
|
+
}
|
|
75
|
+
.wardley-notes text {
|
|
76
|
+
fill: ${r.axisTextColor};
|
|
77
|
+
}
|
|
78
|
+
`},"styles"),de={parser:at,db:Ht,renderer:Qt,styles:Ut};export{de as diagram};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{s as pi,g as mi,x as $t,v as yi,a as bi,b as wi,_ as a,l as Ut,T as Ai,d as Ci,D as Si,O as Dt,j as Ri,Q as Gt,R as _i,a9 as ki,aH as Ti,aI as Xt}from"./mermaid.core-DLb6eAON.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Yt}from"./linear-5j9gt8MV.js";import"./index-CeeLdENM.js";import"./markdown-BWXjRrSw.js";import"./icons-Bm_ZzSAy.js";import"./react-vendor-C0HIWSpf.js";import"./state-Kfon1nTr.js";import"./panels-BQOvnbWH.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function St(){var e=Pi().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,l,m=!1,u=0,d=0,S=.5;delete e.unknown;function y(){var f=t().length,L=n<s,D=L?n:s,E=L?s:n;o=(E-D)/Math.max(1,f-u+d*2),m&&(o=Math.floor(o)),D+=(E-D-o*(f-u))*S,l=o*(1-u),m&&(D=Math.round(D),l=Math.round(l));var M=vi(f).map(function(w){return D+o*w});return i(L?M.reverse():M)}return e.domain=function(f){return arguments.length?(t(f),y()):t()},e.range=function(f){return arguments.length?([s,n]=f,s=+s,n=+n,y()):[s,n]},e.rangeRound=function(f){return[s,n]=f,s=+s,n=+n,m=!0,y()},e.bandwidth=function(){return l},e.step=function(){return o},e.round=function(f){return arguments.length?(m=!!f,y()):m},e.padding=function(f){return arguments.length?(u=Math.min(1,d=+f),y()):u},e.paddingInner=function(f){return arguments.length?(u=Math.min(1,f),y()):u},e.paddingOuter=function(f){return arguments.length?(d=+f,y()):d},e.align=function(f){return arguments.length?(S=Math.max(0,Math.min(1,f)),y()):S},e.copy=function(){return St(t(),[s,n]).round(m).paddingInner(u).paddingOuter(d).align(S)},Di.apply(y(),arguments)}var Rt=(function(){var e=a(function(F,r,g,x){for(g=g||{},x=F.length;x--;g[F[x]]=r);return g},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],l=[1,7],m=[1,5,10,12,14,16,18,19,21,23,36,37,38],u=[1,25],d=[1,26],S=[1,28],y=[1,29],f=[1,30],L=[1,31],D=[1,32],E=[1,33],M=[1,34],w=[1,35],P=[1,36],c=[1,37],B=[1,43],W=[1,42],X=[1,47],Y=[1,50],k=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],C=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],R=[1,65],O=[26,28],T={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:a(function(r,g,x,p,_,h,lt){var b=h.length-1;switch(_){case 5:p.setOrientation(h[b]);break;case 9:p.setDiagramTitle(h[b].text.trim());break;case 12:p.setLineData({text:"",type:"text"},h[b]);break;case 13:p.setLineData(h[b-1],h[b]);break;case 14:p.setBarData({text:"",type:"text"},h[b]);break;case 15:p.setBarData(h[b-1],h[b]);break;case 16:this.$=h[b].trim(),p.setAccTitle(this.$);break;case 17:case 18:this.$=h[b].trim(),p.setAccDescription(this.$);break;case 19:this.$=h[b-1];break;case 20:case 30:this.$=[h[b-2],...h[b]];break;case 21:case 31:this.$=[h[b]];break;case 22:this.$={value:Number(h[b-1]),label:h[b]};break;case 23:this.$={value:Number(h[b]),label:""};break;case 24:p.setXAxisTitle(h[b]);break;case 25:p.setXAxisTitle(h[b-1]);break;case 26:p.setXAxisTitle({type:"text",text:""});break;case 27:p.setXAxisBand(h[b]);break;case 28:p.setXAxisRangeData(Number(h[b-2]),Number(h[b]));break;case 29:this.$=h[b-1];break;case 32:p.setYAxisTitle(h[b]);break;case 33:p.setYAxisTitle(h[b-1]);break;case 34:p.setYAxisTitle({type:"text",text:""});break;case 35:p.setYAxisRangeData(Number(h[b-2]),Number(h[b]));break;case 39:this.$={text:h[b],type:"text"};break;case 40:this.$={text:h[b],type:"text"};break;case 41:this.$={text:h[b],type:"markdown"};break;case 42:this.$=h[b];break;case 43:this.$=h[b-1]+""+h[b];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:n,37:o,38:l}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:n,37:o,38:l}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:n,37:o,38:l}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(m,[2,36]),e(m,[2,37]),e(m,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:n,37:o,38:l}),{1:[2,3]},e(m,[2,5]),e(t,[2,7],{4:22,36:n,37:o,38:l}),{11:23,30:u,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},{11:39,13:38,24:B,29:W,30:u,31:40,32:41,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},{11:45,15:44,29:X,30:u,35:46,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},{11:49,17:48,24:Y,30:u,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},{11:52,17:51,24:Y,30:u,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},{20:[1,53]},{22:[1,54]},e(k,[2,18]),{1:[2,2]},e(k,[2,8]),e(k,[2,9]),e(H,[2,39],{41:55,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c}),e(H,[2,40]),e(H,[2,41]),e(C,[2,42]),e(C,[2,44]),e(C,[2,45]),e(C,[2,46]),e(C,[2,47]),e(C,[2,48]),e(C,[2,49]),e(C,[2,50]),e(C,[2,51]),e(C,[2,52]),e(C,[2,53]),e(k,[2,10]),e(k,[2,24],{32:41,31:56,24:B,29:W}),e(k,[2,26]),e(k,[2,27]),{33:[1,57]},{11:59,30:u,34:58,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},e(k,[2,11]),e(k,[2,32],{35:60,29:X}),e(k,[2,34]),{33:[1,61]},e(k,[2,12]),{17:62,24:Y},{25:63,27:64,29:R},e(k,[2,14]),{17:66,24:Y},e(k,[2,16]),e(k,[2,17]),e(C,[2,43]),e(k,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(k,[2,33]),{29:[1,70]},e(k,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(O,[2,23],{30:[1,73]}),e(k,[2,15]),e(k,[2,28]),e(k,[2,29]),{11:59,30:u,34:74,39:24,40:d,41:27,42:S,43:y,44:f,45:L,46:D,47:E,48:M,49:w,50:P,51:c},e(k,[2,35]),e(k,[2,19]),{25:75,27:64,29:R},e(O,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:a(function(r,g){if(g.recoverable)this.trace(r);else{var x=new Error(r);throw x.hash=g,x}},"parseError"),parse:a(function(r){var g=this,x=[0],p=[],_=[null],h=[],lt=this.table,b="",dt=0,Ot=0,ui=2,Vt=1,di=h.slice.call(arguments,1),v=Object.create(this.lexer),$={yy:{}};for(var bt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,bt)&&($.yy[bt]=this.yy[bt]);v.setInput(r,$.yy),$.yy.lexer=v,$.yy.parser=this,typeof v.yylloc>"u"&&(v.yylloc={});var wt=v.yylloc;h.push(wt);var xi=v.options&&v.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(z){x.length=x.length-2*z,_.length=_.length-z,h.length=h.length-z}a(fi,"popStack");function Wt(){var z;return z=p.pop()||v.lex()||Vt,typeof z!="number"&&(z instanceof Array&&(p=z,z=p.pop()),z=g.symbols_[z]||z),z}a(Wt,"lex");for(var I,U,V,At,j={},xt,N,Ft,ft;;){if(U=x[x.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Wt()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");v.showPosition?Ct="Parse error on line "+(dt+1)+`:
|
|
2
|
+
`+v.showPosition()+`
|
|
3
|
+
Expecting `+ft.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Ct="Parse error on line "+(dt+1)+": Unexpected "+(I==Vt?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Ct,{text:v.match,token:this.terminals_[I]||I,line:v.yylineno,loc:wt,expected:ft})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+I);switch(V[0]){case 1:x.push(I),_.push(v.yytext),h.push(v.yylloc),x.push(V[1]),I=null,Ot=v.yyleng,b=v.yytext,dt=v.yylineno,wt=v.yylloc;break;case 2:if(N=this.productions_[V[1]][1],j.$=_[_.length-N],j._$={first_line:h[h.length-(N||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(N||1)].first_column,last_column:h[h.length-1].last_column},xi&&(j._$.range=[h[h.length-(N||1)].range[0],h[h.length-1].range[1]]),At=this.performAction.apply(j,[b,Ot,dt,$.yy,V[1],_,h].concat(di)),typeof At<"u")return At;N&&(x=x.slice(0,-1*N*2),_=_.slice(0,-1*N),h=h.slice(0,-1*N)),x.push(this.productions_[V[1]][0]),_.push(j.$),h.push(j._$),Ft=lt[x[x.length-2]][x[x.length-1]],x.push(Ft);break;case 3:return!0}}return!0},"parse")},rt=(function(){var F={EOF:1,parseError:a(function(g,x){if(this.yy.parser)this.yy.parser.parseError(g,x);else throw new Error(g)},"parseError"),setInput:a(function(r,g){return this.yy=g||this.yy||{},this._input=r,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]),this.offset=0,this},"setInput"),input:a(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var g=r.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:a(function(r){var g=r.length,x=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===p.length?this.yylloc.first_column:0)+p[p.length-x.length].length-x[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(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
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(r){this.unput(this.match.slice(r))},"less"),pastInput:a(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var r=this.pastInput(),g=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
5
|
+
`+g+"^"},"showPosition"),test_match:a(function(r,g){var x,p,_;if(this.options.backtrack_lexer&&(_={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&&(_.yylloc.range=this.yylloc.range.slice(0))),p=r[0].match(/(?:\r\n?|\n).*/g),p&&(this.yylineno+=p.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:p?p[p.length-1].length-p[p.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],x=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),x)return x;if(this._backtrack){for(var h in _)this[h]=_[h];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,g,x,p;this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),h=0;h<_.length;h++)if(x=this._input.match(this.rules[_[h]]),x&&(!g||x[0].length>g[0].length)){if(g=x,p=h,this.options.backtrack_lexer){if(r=this.test_match(x,_[h]),r!==!1)return r;if(this._backtrack){g=!1;continue}else return!1}else if(!this.options.flex)break}return g?(r=this.test_match(g,_[p]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var g=this.next();return g||this.lex()},"lex"),begin:a(function(g){this.conditionStack.push(g)},"begin"),popState:a(function(){var g=this.conditionStack.length-1;return g>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(g){return g=this.conditionStack.length-1-Math.abs(g||0),g>=0?this.conditionStack[g]:"INITIAL"},"topState"),pushState:a(function(g){this.begin(g)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(function(g,x,p,_){switch(p){case 0:break;case 1:break;case 2:return this.popState(),36;case 3:return this.popState(),36;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 33;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 29;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return F})();T.lexer=rt;function q(){this.yy={}}return a(q,"Parser"),q.prototype=T,T.Parser=q,new q})();Rt.parser=Rt;var Li=Rt;function pt(e){return e.type==="bar"}a(pt,"isBarPlot");function mt(e){return e.type==="band"}a(mt,"isBandAxisData");function Q(e){return e.type==="linear"}a(Q,"isLinearAxisData");var K,Pt=(K=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){var d,S;if(!this.parentGroup)return{width:t.reduce((y,f)=>Math.max(f.length,y),0)*i,height:i};const s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i),o=(S=(d=n.node())==null?void 0:d.getScreenCTM)==null?void 0:S.call(d),l=a(y=>y&&y>0?y:1,"toScale"),m=l(o==null?void 0:o.a),u=l(o==null?void 0:o.d);for(const y of t){const f=Ti(n,1,y),L=f?f.width/m:y.length*i,D=f?f.height/u:i;s.width=Math.max(s.width,L),s.height=Math.max(s.height,D)}return n.remove(),s}},a(K,"TextDimensionCalculatorWithFont"),K),Nt=.7,Ht=.2,Z,qt=(Z=class{constructor(t,i,s,n){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){Nt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(Nt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=Ht*t.width;this.outerPadding=Math.min(s.width/2,n);let o=s.height;this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0&&(o=Math.max(o,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height))),o+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,o<=i&&(i-=o,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=Ht*t.height;this.outerPadding=Math.min(s.height/2,n);const o=s.width+this.axisConfig.labelPadding*2;o<=i&&(i-=o,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateOffsetByRotation(t){const i=this.normalizedLabelRotationInRad;return i===0?0:Math.sin(i)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},a(Z,"BaseAxis"),Z),J,Ei=(J=class extends qt{constructor(t,i,s,n,o){super(t,n,o,i),this.categories=s,this.scale=St().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=St().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Ut.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},a(J,"BandAxis"),J),tt,Mi=(tt=class extends qt{constructor(t,i,s,n,o){super(t,n,o,i),this.domain=s,this.scale=Yt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=Yt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},a(tt,"LinearAxis"),tt);function _t(e,t,i,s){const n=new Pt(s);return mt(e)?new Ei(t,i,e.categories,e.title,n):new Mi(t,i,[e.min,e.max],e.title,n)}a(_t,"getAxis");var it,Ii=(it=class{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.titleWidth=0,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),n=i.height+2*this.chartConfig.titlePadding;return n<=t.height&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=s,this.boundingRect.height=n,this.titleWidth=i.width,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}alignTo(t,i){const s=Math.min(this.titleWidth,this.chartConfig.width)/2,n=Math.min(Math.max((t+i)/2,s),this.chartConfig.width-s);this.boundingRect.x=n-s,this.boundingRect.width=s*2}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}},a(it,"ChartTitle"),it);function jt(e,t,i,s){const n=new Pt(s);return new Ii(n,e,t,i)}a(jt,"getChartTitleComponent");var zi=.75,Bi=.5,Oi=.35;function kt(e){return{fontSize:e,markerSize:e*zi,markerSpacing:e*Oi,itemSpacing:e*Bi}}a(kt,"getLegendLayout");var et,Vi=(et=class{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter(d=>d.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};const{fontSize:i,markerSize:s,markerSpacing:n,itemSpacing:o}=kt(this.chartConfig.legendFontSize),l=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map(d=>d.title),i),m=this.chartConfig.legendPadding*2+s+n+l.width,u=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*o;return m<=t.width&&u<=t.height?(this.boundingRect.width=m,this.boundingRect.height=u):(this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];const{fontSize:t,markerSize:i,markerSpacing:s,itemSpacing:n}=kt(this.chartConfig.legendFontSize),o=t+n,l=this.boundingRect.x+this.chartConfig.legendPadding,m=this.boundingRect.y+this.chartConfig.legendPadding,u=[],d=[];for(const[S,y]of this.visiblePlots.entries())if(pt(y))u.push({x:l,y:m+S*o,width:i,height:i,fill:y.fill,strokeFill:y.fill,strokeWidth:0});else{const f=m+S*o+i/2;d.push({path:`M ${l},${f} L ${l+i},${f}`,strokeFill:y.strokeFill,strokeWidth:y.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:u},{groupTexts:["legend","markers"],type:"path",data:d},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((S,y)=>({text:S.title,x:l+i+s,y:m+y*o+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}},a(et,"ChartLegend"),et);function Qt(e,t,i,s){const n=new Pt(s);return new Vi(n,e,t,i)}a(Qt,"getChartLegendComponent");var st,Wi=(st=class{constructor(t,i,s,n,o){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=o}getDrawableElement(){const t=this.plotData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]);let i;if(this.orientation==="horizontal"?i=Xt().y(n=>n[0]).x(n=>n[1])(t):i=Xt().x(n=>n[0]).y(n=>n[1])(t),!i)return[];const s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){const l=[];for(const[m,[u,d]]of t.entries()){const S=this.plotData.pointLabels[m];S&&(this.orientation==="horizontal"?l.push({x:d+10,y:u,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0}):l.push({x:u,y:d-10,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0}))}l.length>0&&s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:l})}return s}},a(st,"LinePlot"),st),nt,Fi=(nt=class{constructor(t,i,s,n,o,l){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=o,this.plotIndex=l}getDrawableElement(){const t=this.barData.data.map(o=>[this.xAxis.getScaleValue(o[0]),this.yAxis.getScaleValue(o[1])]),s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),n=s/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(o=>({x:this.boundingRect.x,y:o[0]-n,height:s,width:o[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(o=>({x:o[0]-n,y:o[1],width:s,height:this.boundingRect.y+this.boundingRect.height-o[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},a(nt,"BarPlot"),nt),at,Xi=(at=class{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");const t=[];for(const[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{const n=new Wi(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break;case"bar":{const n=new Fi(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break}return t}},a(at,"BasePlot"),at);function Kt(e,t,i){return new Xi(e,t,i)}a(Kt,"getPlotComponent");var ot,Yi=(ot=class{constructor(t,i,s,n){this.chartConfig=t,this.chartData=i,this.componentStore={title:jt(t,i,s,n),plot:Kt(t,i,s),legend:Qt(t,i,s,n),xAxis:_t(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:_t(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,o={width:0,height:0},l=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),m=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),u=this.componentStore.plot.calculateSpace({width:l,height:m});t-=u.width,i-=u.height,u=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=u.height,i-=u.height,this.componentStore.xAxis.setAxisPosition("bottom"),u=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=u.height,this.componentStore.yAxis.setAxisPosition("left"),u=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=u.width,t-=u.width,o=this.componentStore.legend.calculateSpace({width:t,height:m}),t-=o.width,t>0&&(l+=t,t=0),i>0&&(m+=i,i=0),this.componentStore.plot.calculateSpace({width:l,height:m}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.title.alignTo(s,s+l),this.componentStore.legend.setBoundingBoxXY({x:s+l,y:n+Math.max((m-o.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+l]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+m}),this.componentStore.yAxis.setRange([n,n+m]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(d=>pt(d))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,o=0,l={width:0,height:0},m=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),u=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),d=this.componentStore.plot.calculateSpace({width:m,height:u});t-=d.width,i-=d.height,d=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=d.height,i-=d.height,this.componentStore.xAxis.setAxisPosition("left"),d=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=d.width,n=d.width,this.componentStore.yAxis.setAxisPosition("top"),d=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=d.height,o=s+d.height,l=this.componentStore.legend.calculateSpace({width:t,height:u}),t-=l.width,t>0&&(m+=t,t=0),i>0&&(u+=i,i=0),this.componentStore.plot.calculateSpace({width:m,height:u}),this.componentStore.plot.setBoundingBoxXY({x:n,y:o}),this.componentStore.title.alignTo(n,n+m),this.componentStore.legend.setBoundingBoxXY({x:n+m,y:o+Math.max((u-l.height)/2,0)}),this.componentStore.yAxis.setRange([n,n+m]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([o,o+u]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:o}),this.chartData.plots.some(S=>pt(S))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},a(ot,"Orchestrator"),ot),ht,Ni=(ht=class{static build(t,i,s,n){return new Yi(t,i,s,n).getDrawableElement()}},a(ht,"XYChartBuilder"),ht),ct=0,Zt,gt=Et(),ut=Lt(),A=Mt(),Tt=ut.plotColorPalette.split(",").map(e=>e.trim()),yt=!1,vt=!1;function Lt(){const e=ki(),t=Dt();return Gt(e.xyChart,t.themeVariables.xyChart)}a(Lt,"getChartDefaultThemeConfig");function Et(){const e=Dt();return Gt(_i.xyChart,e.xyChart)}a(Et,"getChartDefaultConfig");function Mt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}a(Mt,"getChartDefaultData");function G(e){const t=Dt();return Ri(e.trim(),t)}a(G,"textSanitizer");function Jt(e){Zt=e}a(Jt,"setTmpSVGG");function ti(e){e==="horizontal"?gt.chartOrientation="horizontal":gt.chartOrientation="vertical"}a(ti,"setOrientation");function ii(e){A.xAxis.title=G(e.text)}a(ii,"setXAxisTitle");function It(e,t){A.xAxis={type:"linear",title:A.xAxis.title,min:e,max:t},yt=!0}a(It,"setXAxisRangeData");function ei(e){A.xAxis={type:"band",title:A.xAxis.title,categories:e.map(t=>G(t.text))},yt=!0}a(ei,"setXAxisBand");function si(e){A.yAxis.title=G(e.text)}a(si,"setYAxisTitle");function ni(e,t){A.yAxis={type:"linear",title:A.yAxis.title,min:e,max:t},vt=!0}a(ni,"setYAxisRangeData");function ai(e){const t=Math.min(...e),i=Math.max(...e),s=Q(A.yAxis)?A.yAxis.min:1/0,n=Q(A.yAxis)?A.yAxis.max:-1/0;A.yAxis={type:"linear",title:A.yAxis.title,min:Math.min(s,t),max:Math.max(n,i)}}a(ai,"setYAxisRangeFromPlotData");function zt(e){let t=[];if(e.length===0)return t;if(!yt){const i=Q(A.xAxis)?A.xAxis.min:1/0,s=Q(A.xAxis)?A.xAxis.max:-1/0;It(Math.min(i,1),Math.max(s,e.length))}if(mt(A.xAxis)&&e.length>A.xAxis.categories.length&&(e=e.slice(0,A.xAxis.categories.length)),vt||ai(e),mt(A.xAxis)&&(t=A.xAxis.categories.map((i,s)=>[i,e[s]])),Q(A.xAxis)){const i=A.xAxis.min,s=A.xAxis.max;if(e.length===1)t=[[`${i}`,e[0]]];else{const n=(s-i)/(e.length-1);t=e.map((o,l)=>[`${i+l*n}`,o])}}return t}a(zt,"transformDataWithoutCategory");function Bt(e){return Tt[e===0?0:e%Tt.length]}a(Bt,"getPlotColorFromPalette");function oi(e,t){const i=t.map(l=>l.value),s=t.map(l=>l.label?G(l.label):""),n=zt(i),o=s.some(l=>l!=="");A.plots.push({type:"line",title:G(e.text),strokeFill:Bt(ct),strokeWidth:2,data:n,...o?{pointLabels:s}:{}}),ct++}a(oi,"setLineData");function hi(e,t){const i=t.map(n=>n.value),s=zt(i);A.plots.push({type:"bar",title:G(e.text),fill:Bt(ct),data:s}),ct++}a(hi,"setBarData");function ri(){if(A.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return A.title=$t(),Ni.build(gt,A,ut,Zt)}a(ri,"getDrawableElem");function li(){return ut}a(li,"getChartThemeConfig");function ci(){return gt}a(ci,"getChartConfig");function gi(){return A}a(gi,"getXYChartData");var Hi=a(function(){Si(),ct=0,gt=Et(),A=Mt(),ut=Lt(),Tt=ut.plotColorPalette.split(",").map(e=>e.trim()),yt=!1,vt=!1},"clear"),$i={getDrawableElem:ri,clear:Hi,setAccTitle:wi,getAccTitle:bi,setDiagramTitle:yi,getDiagramTitle:$t,getAccDescription:mi,setAccDescription:pi,setOrientation:ti,setXAxisTitle:ii,setXAxisRangeData:It,setXAxisBand:ei,setYAxisTitle:si,setYAxisRangeData:ni,setLineData:oi,setBarData:hi,setTmpSVGG:Jt,getChartThemeConfig:li,getChartConfig:ci,getXYChartData:gi},Ui=a((e,t,i,s)=>{const n=s.db,o=n.getChartThemeConfig(),l=n.getChartConfig(),m=n.getXYChartData().plots[0].data.map(w=>w[1]);function u(w){return w==="top"?"text-before-edge":"middle"}a(u,"getDominantBaseLine");function d(w){return w==="left"?"start":w==="right"?"end":"middle"}a(d,"getTextAnchor");function S(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}a(S,"getTextTransformation"),Ut.debug(`Rendering xychart chart
|
|
7
|
+
`+e);const y=Ai(t),f=y.append("g").attr("class","main"),L=f.append("rect").attr("width",l.width).attr("height",l.height).attr("class","background");Ci(y,l.height,l.width,!0),y.attr("viewBox",`0 0 ${l.width} ${l.height}`),L.attr("fill",o.backgroundColor),n.setTmpSVGG(y.append("g").attr("class","mermaid-tmp-group"));const D=n.getDrawableElem(),E={};function M(w){let P=f,c="";for(const[B]of w.entries()){let W=f;B>0&&E[c]&&(W=E[c]),c+=w[B],P=E[c],P||(P=E[c]=W.append("g").attr("class",w[B]))}return P}a(M,"getGroup");for(const w of D){if(w.data.length===0)continue;const P=M(w.groupTexts);switch(w.type){case"rect":if(P.selectAll("rect").data(w.data).enter().append("rect").attr("x",c=>c.x).attr("y",c=>c.y).attr("width",c=>c.width).attr("height",c=>c.height).attr("fill",c=>c.fill).attr("stroke",c=>c.strokeFill).attr("stroke-width",c=>c.strokeWidth),l.showDataLabel){const c=l.showDataLabelOutsideBar;if(l.chartOrientation==="horizontal"){let B=function(R,O){const{data:T,label:rt}=R;return O*rt.length*W<=T.width-X};a(B,"fitsHorizontally");const W=.7,X=10,Y=w.data.map((R,O)=>({data:R,label:m[O].toString()})).filter(R=>R.data.width>0&&R.data.height>0),k=Y.map(R=>{const{data:O}=R;let T=O.height*.7;for(;!B(R,T)&&T>0;)T-=1;return T}),H=Math.floor(Math.min(...k)),C=a(R=>c?R.data.x+R.data.width+X:R.data.x+R.data.width-X,"determineLabelXPosition");P.selectAll("text").data(Y).enter().append("text").attr("x",C).attr("y",R=>R.data.y+R.data.height/2).attr("text-anchor",c?"start":"end").attr("dominant-baseline","middle").attr("fill",o.dataLabelColor).attr("font-size",`${H}px`).text(R=>R.label)}else{let B=function(C,R,O){const{data:T,label:rt}=C,F=R*rt.length*.7,r=T.x+T.width/2,g=r-F/2,x=r+F/2,p=g>=T.x&&x<=T.x+T.width,_=T.y+O+R<=T.y+T.height;return p&&_};a(B,"fitsInBar");const W=10,X=w.data.map((C,R)=>({data:C,label:m[R].toString()})).filter(C=>C.data.width>0&&C.data.height>0),Y=X.map(C=>{const{data:R,label:O}=C;let T=R.width/(O.length*.7);for(;!B(C,T,W)&&T>0;)T-=1;return T}),k=Math.floor(Math.min(...Y)),H=a(C=>c?C.data.y-W:C.data.y+W,"determineLabelYPosition");P.selectAll("text").data(X).enter().append("text").attr("x",C=>C.data.x+C.data.width/2).attr("y",H).attr("text-anchor","middle").attr("dominant-baseline",c?"auto":"hanging").attr("fill",o.dataLabelColor).attr("font-size",`${k}px`).text(C=>C.label)}}break;case"text":P.selectAll("text").data(w.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",c=>c.fill).attr("font-size",c=>c.fontSize).attr("dominant-baseline",c=>u(c.verticalPos)).attr("text-anchor",c=>d(c.horizontalPos)).attr("transform",c=>S(c)).text(c=>c.text);break;case"path":P.selectAll("path").data(w.data).enter().append("path").attr("d",c=>c.path).attr("fill",c=>c.fill?c.fill:"none").attr("stroke",c=>c.strokeFill).attr("stroke-width",c=>c.strokeWidth);break}}},"draw"),Gi={draw:Ui},ae={parser:Li,db:$i,renderer:Gi};export{ae as diagram};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/web/dist/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<meta property="og:title" content="DeepSeekCode Web" />
|
|
19
19
|
<meta property="og:description" content="AI coding workspace for local agent workflows" />
|
|
20
20
|
<meta property="og:type" content="website" />
|
|
21
|
-
<meta name="theme-color" content="#
|
|
21
|
+
<meta name="theme-color" content="#1a1917" />
|
|
22
22
|
<meta name="color-scheme" content="dark light" />
|
|
23
23
|
<title>DeepSeekCode Web</title>
|
|
24
24
|
<!-- 首屏主题引导:在 JS bundle 执行前,按已持久化的偏好设置 html.dark/.light,消除暗/亮首帧闪烁(FOUC)。
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
} catch (e) {}
|
|
43
43
|
})();
|
|
44
44
|
</script>
|
|
45
|
-
<script type="module" crossorigin src="/assets/index-
|
|
46
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-
|
|
48
|
-
<link rel="modulepreload" crossorigin href="/assets/react-vendor-
|
|
49
|
-
<link rel="modulepreload" crossorigin href="/assets/state-
|
|
50
|
-
<link rel="modulepreload" crossorigin href="/assets/panels-
|
|
51
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
45
|
+
<script type="module" crossorigin src="/assets/index-CeeLdENM.js"></script>
|
|
46
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-Bm_ZzSAy.js">
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-BWXjRrSw.js">
|
|
48
|
+
<link rel="modulepreload" crossorigin href="/assets/react-vendor-C0HIWSpf.js">
|
|
49
|
+
<link rel="modulepreload" crossorigin href="/assets/state-Kfon1nTr.js">
|
|
50
|
+
<link rel="modulepreload" crossorigin href="/assets/panels-BQOvnbWH.js">
|
|
51
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Ceez9lYk.css">
|
|
52
52
|
</head>
|
|
53
53
|
<body>
|
|
54
54
|
<div id="root"></div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./markdown-B2L4Mq-x.js";import{a as r,aF as v,k as C,i as w,ax as S,ay as z,ba as y,aV as I,al as E,o as q}from"./icons-BxNxyk-c.js";import{u as j,a as N,ap as A,ar as R,aq as $}from"./index-RB5ffy32.js";import"./react-vendor-B2V_5iSS.js";import"./state-0T92JV0u.js";import"./panels-P_I7Q72_.js";const H=r.memo(function({selectedSessionId:s,onSelectionChange:c,onOpenSession:i,onNavigate:m}){const{t:n}=j(),[d,h]=r.useState([]),[a,u]=r.useState(!0),[p,b]=r.useState(null),[f,k]=r.useState(null),x=r.useCallback(async()=>{try{const t=await N.assistants.list();t.success&&Array.isArray(t.data)?(h(t.data),b(null)):b(t.error||n("assistants.loadFailed"))}catch(t){b(t instanceof Error?t.message:String(t))}finally{u(!1)}},[n]);r.useEffect(()=>{x();const t=window.setInterval(()=>{x()},8e3);return()=>window.clearInterval(t)},[x]);const l=r.useCallback(async(t,g)=>{(await N.assistants.update(t,g)).success&&x()},[x]);return r.useEffect(()=>{if(!s)return;const t=d.find(g=>g.sessionId===s);t&&c(t)},[d,s,c]),e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-dark-border px-4 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{size:16,className:"text-accent-blue","aria-hidden":"true"}),e.jsx("h2",{className:"text-sm font-semibold text-dark-text",children:n("assistants.title")}),!a&&e.jsx("span",{className:"rounded-full bg-dark-hover px-1.5 py-0.5 text-[10px] text-dark-muted",children:d.length})]}),e.jsxs("button",{type:"button",onClick:()=>void x(),className:"flex items-center gap-1 rounded px-2 py-1 text-xs text-dark-muted hover:bg-dark-hover hover:text-dark-text",title:n("common.refresh"),children:[e.jsx(C,{size:12,className:a?"animate-spin":"","aria-hidden":"true"}),n("common.refresh")]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:a&&d.length===0?e.jsxs("div",{className:"flex items-center justify-center py-12 text-xs text-dark-muted",children:[e.jsx(w,{size:14,className:"mr-1.5 animate-spin","aria-hidden":"true"}),n("assistants.loading")]}):p&&d.length===0?e.jsx("div",{className:"py-8 text-center text-xs text-red-400",children:p}):d.length===0?e.jsxs("div",{className:"py-10 text-center text-xs text-dark-muted",children:[e.jsx(v,{size:24,className:"mx-auto mb-2 text-dark-muted","aria-hidden":"true"}),e.jsx("p",{children:n("assistants.empty")}),e.jsx("p",{className:"mt-1 text-[11px]",children:n("assistants.emptyHint")}),e.jsx("button",{type:"button",onClick:()=>m("channels"),className:"mt-3 rounded border border-dark-border px-2.5 py-1 text-[11px] text-dark-text hover:bg-dark-hover",children:n("assistants.goChannels")})]}):e.jsx("div",{className:"flex flex-col gap-2",children:d.map(t=>e.jsx(M,{assistant:t,selected:s===t.sessionId,onSelect:()=>c(t),expanded:f===t.sessionId,onToggleExpand:()=>k(f===t.sessionId?null:t.sessionId),onOpen:()=>i(t.sessionId,t.title),onUpdate:g=>void l(t.sessionId,g)},t.sessionId))})})]})}),M=r.memo(function({assistant:s,selected:c,onSelect:i,expanded:m,onToggleExpand:n,onOpen:d,onUpdate:h}){const{t:a}=j(),u=s.channel.peerKind==="group";return e.jsxs("div",{className:`rounded-lg border bg-dark-surface transition-colors ${c?"border-accent-blue/60 ring-1 ring-accent-blue/30":"border-dark-border"}`,children:[e.jsxs("button",{type:"button",onClick:i,"aria-current":c?"true":void 0,className:`flex w-full items-center gap-2 rounded-t-lg px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-blue/60 ${c?"bg-accent-blue/5":"hover:bg-dark-hover/40"}`,children:[e.jsx("span",{className:"text-base leading-none","aria-hidden":"true",children:A(s.channel.type)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-dark-text",title:s.title,children:s.title}),e.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${R(s.status)}`,title:a(`assistants.status.${s.status}`,{defaultValue:s.status})}),u?e.jsx(S,{size:11,className:"shrink-0 text-dark-muted","aria-label":a("assistants.group")}):e.jsx(z,{size:11,className:"shrink-0 text-dark-muted","aria-label":a("assistants.dm")})]}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px] text-dark-muted",children:[e.jsx("span",{className:"shrink-0",children:$(s.channel.type)}),e.jsx("span",{className:"min-w-0 flex-1 truncate",title:s.channel.peerId,children:s.channel.peerId}),s.stats.unread>0&&e.jsx("span",{className:"shrink-0 rounded-full bg-red-500/80 px-1.5 text-[9px] font-medium text-white",children:s.stats.unread})]}),s.preview&&e.jsx("p",{className:"mt-1 line-clamp-2 text-[11px] leading-snug text-dark-muted",title:s.preview,children:s.preview})]}),e.jsx(U,{mode:s.mode}),s.trust.level==="owner"?e.jsx(y,{size:12,className:"shrink-0 text-green-500","aria-label":a("assistants.trust.owner")}):s.trust.level==="public"?e.jsx(I,{size:12,className:"shrink-0 text-yellow-600","aria-label":a("assistants.trust.public")}):e.jsx(y,{size:12,className:"shrink-0 text-accent-blue","aria-label":a("assistants.trust.team")})]}),e.jsxs("div",{className:"flex items-center gap-1.5 border-t border-dark-border px-3 py-1.5",children:[e.jsxs("button",{type:"button",onClick:d,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-accent-blue hover:bg-dark-hover",children:[e.jsx(E,{size:11,"aria-hidden":"true"}),a("assistants.openSession")]}),e.jsx("button",{type:"button",onClick:n,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-dark-muted hover:bg-dark-hover hover:text-dark-text",children:a("assistants.policy")}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[10px] text-dark-muted",children:a("assistants.groupPolicy",{mention:String(u?s.policy.mentionRequired:!1)})})]}),m&&e.jsx(V,{assistant:s,isGroup:u,onUpdate:h})]})});function U({mode:o}){const{t:s}=j();return e.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-[9px] font-medium ${o==="delegate"?"bg-accent-blue/15 text-accent-blue":"bg-dark-hover text-dark-muted"}`,children:s(`assistants.mode.${o}`)})}function V({assistant:o,isGroup:s,onUpdate:c}){const{t:i}=j(),[m,n]=r.useState(o.mode),[d,h]=r.useState(o.policy.mentionRequired),[a,u]=r.useState(String(o.policy.cooldownSeconds)),[p,b]=r.useState((o.policy.keywords??[]).join(", ")),[f,k]=r.useState(!1),x=()=>{k(!0),c({mode:m,policy:{mentionRequired:s?d:!1,cooldownSeconds:Math.max(0,Number(a)||0),...p.trim()?{keywords:p.split(/[,,]/).map(l=>l.trim()).filter(Boolean)}:{}}}),window.setTimeout(()=>k(!1),600)};return e.jsxs("div",{className:"border-t border-dark-border px-3 py-2.5 text-[11px]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-dark-muted",children:[i("assistants.mode.label"),e.jsxs("select",{value:m,onChange:l=>n(l.target.value),className:"rounded border border-dark-border bg-dark-surface px-1.5 py-0.5 text-dark-text",children:[e.jsx("option",{value:"delegate",children:i("assistants.mode.delegate")}),e.jsx("option",{value:"direct",children:i("assistants.mode.direct")})]})]}),s&&e.jsxs("label",{className:"flex items-center gap-1.5 text-dark-muted",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:l=>h(l.target.checked)}),i("assistants.mentionRequired")]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-dark-muted",children:[i("assistants.cooldown"),e.jsx("input",{type:"number",min:0,value:a,onChange:l=>u(l.target.value),className:"w-14 rounded border border-dark-border bg-dark-surface px-1.5 py-0.5 text-dark-text"}),"s"]})]}),e.jsxs("label",{className:"mt-2 flex items-center gap-1.5 text-dark-muted",children:[i("assistants.keywords"),e.jsx("input",{type:"text",value:p,placeholder:i("assistants.keywordsPlaceholder")??"",onChange:l=>b(l.target.value),className:"min-w-0 flex-1 rounded border border-dark-border bg-dark-surface px-1.5 py-0.5 text-dark-text"})]}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsxs("button",{type:"button",onClick:x,disabled:f,className:"flex items-center gap-1 rounded bg-accent-blue px-2.5 py-1 text-[11px] font-medium text-white disabled:opacity-60",children:[f?e.jsx(w,{size:11,className:"animate-spin","aria-hidden":"true"}):e.jsx(q,{size:11,"aria-hidden":"true"}),i("common.save")]})})]})}export{H as AssistantsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./markdown-B2L4Mq-x.js";import{a as l,aJ as H,k as ve,A as te,m as ye,bE as Ne,am as ae,ao as we,bB as Ae,j as Ce,aP as Ie,aC as $e,w as ze,X as q,bd as se,i as le,bi as Se,aI as re,bF as ne,F,ba as De,bG as Pe,bm as Ee,U as qe}from"./icons-BxNxyk-c.js";import{u as ce,as as Re,N as Te,a as R,t as oe}from"./index-RB5ffy32.js";import"./react-vendor-B2V_5iSS.js";import"./state-0T92JV0u.js";import"./panels-P_I7Q72_.js";const v={name:"",instructions:"",freq:"daily",time:"09:00",dow:"1",onceAt:"",cron:"0 9 * * *",modelRef:"",connectorIds:[],channelIds:[],workspaceDir:"",readAutoAllow:!0},Le=".deepseekcode/automation-attachments",j=a=>String(a).padStart(2,"0");function Oe(a){const n=a.schedule,h={modelRef:a.modelRef??"",connectorIds:Array.isArray(a.connectorIds)?[...a.connectorIds]:[],channelIds:Array.isArray(a.notificationChannelIds)?[...a.notificationChannelIds]:[],workspaceDir:a.workspaceDir??"",readAutoAllow:a.readAutoAllow};if(n.kind==="once"&&n.fireAt){const x=new Date(n.fireAt);return{...v,name:a.name,instructions:a.instructions,freq:"once",time:`${j(x.getHours())}:${j(x.getMinutes())}`,onceAt:`${x.getFullYear()}-${j(x.getMonth()+1)}-${j(x.getDate())}T${j(x.getHours())}:${j(x.getMinutes())}`,...h}}const o=(n.cron||"").trim().split(/\s+/),i={...v,name:a.name,instructions:a.instructions,...h};if(o.length===5){const x=o[0]??"",g=o[1]??"",k=o[4]??"",y=`${j(parseInt(g,10)||0)}:${j(parseInt(x,10)||0)}`;if(k==="*")return{...i,freq:"daily",time:y};if(k==="1-5")return{...i,freq:"weekdays",time:y};if(/^\d+$/.test(k))return{...i,freq:"weekly",time:y,dow:k}}return{...i,freq:"custom",cron:n.cron||""}}function de(a){const[n,h]=a.time.split(":"),o=parseInt(n??"",10),i=parseInt(h??"",10);switch(a.freq){case"daily":return Number.isInteger(o)&&Number.isInteger(i)?{kind:"cron",cron:`${i} ${o} * * *`}:null;case"weekdays":return Number.isInteger(o)&&Number.isInteger(i)?{kind:"cron",cron:`${i} ${o} * * 1-5`}:null;case"weekly":return Number.isInteger(o)&&Number.isInteger(i)?{kind:"cron",cron:`${i} ${o} * * ${a.dow}`}:null;case"once":return a.onceAt?{kind:"once",fireAt:new Date(a.onceAt).toISOString()}:null;case"custom":return a.cron.trim()?{kind:"cron",cron:a.cron.trim()}:null}}function ie(a,n){if(a.kind==="once"&&a.fireAt){const k=new Date(a.fireAt);return`${n("automation.badgeOnce")} ${k.toLocaleString()}`}const h=(a.cron||"").trim().split(/\s+/);if(h.length!==5)return a.cron||"";const o=h[0]??"",i=h[1]??"",x=h[4]??"",g=`${j(parseInt(i,10)||0)}:${j(parseInt(o,10)||0)}`;return x==="*"?n("automation.badgeDaily",{time:g}):x==="1-5"?n("automation.badgeWeekdays",{time:g}):/^\d+$/.test(x)?n("automation.badgeWeekly",{day:n(`automation.dow.${["sunday","monday","tuesday","wednesday","thursday","friday","saturday"][parseInt(x,10)%7]}`),time:g}):a.cron||""}const Me=[{value:"1",key:"automation.dow.monday"},{value:"2",key:"automation.dow.tuesday"},{value:"3",key:"automation.dow.wednesday"},{value:"4",key:"automation.dow.thursday"},{value:"5",key:"automation.dow.friday"},{value:"6",key:"automation.dow.saturday"},{value:"0",key:"automation.dow.sunday"}];function He(a){const n=a.replace(/[\\/]+$/,""),h=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return h===-1?n:n.slice(h+1)}function Fe({initial:a,onClose:n,onConfirm:h}){const{t:o}=ce(),[i,x]=l.useState(a),[g,k]=l.useState(null),[y,M]=l.useState([]),[C,D]=l.useState(!1),[S,I]=l.useState(""),[N,r]=l.useState(a),m=l.useRef(null),w=async b=>{D(!0),I("");try{const u=await R.dirs.list(b);if(!u.success||!u.data){I(u.error||"加载目录失败");return}x(u.data.path),k(u.data.parent),M(u.data.dirs||[]),r(u.data.path)}catch(u){I(u instanceof Error?u.message:"加载目录失败")}finally{D(!1)}};return l.useEffect(()=>{w(a)},[a]),l.useEffect(()=>{var b;(b=m.current)==null||b.focus()},[]),l.useEffect(()=>{const b=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),n())};return document.addEventListener("keydown",b),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",b),document.body.style.overflow=""}},[n]),e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center overflow-hidden p-4",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:n}),e.jsxs("div",{className:"relative w-full max-w-lg mx-4 bg-dark-surface border border-dark-border rounded-xl shadow-2xl flex flex-col max-h-[70vh]",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-dark-border shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-2 text-[13px] font-semibold text-dark-text",children:[e.jsx(F,{size:15,className:"text-accent-blue"}),o("automation.workspacePick")]}),e.jsx("button",{type:"button",onClick:n,className:"rounded p-1 text-dark-muted hover:bg-dark-hover",children:e.jsx(q,{size:15})})]}),e.jsxs("div",{className:"p-4 flex flex-col gap-3 min-h-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Pe,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-dark-muted/60"}),e.jsx("input",{ref:m,value:N,onChange:b=>r(b.target.value),onKeyDown:b=>{b.key==="Enter"&&w(N.trim())},spellCheck:!1,className:"w-full rounded-lg border border-dark-border bg-dark-bg pl-8 pr-2.5 py-1.5 text-xs font-mono focus:outline-none focus:border-accent-blue/50"})]}),e.jsx("button",{type:"button",onClick:()=>void w(N.trim()),disabled:C||!N.trim(),className:"shrink-0 rounded-lg border border-dark-border px-2.5 py-1.5 text-xs text-dark-muted hover:bg-dark-hover disabled:opacity-40",children:o("chat.dirPickerGo")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 truncate font-mono text-[11px] text-dark-muted bg-dark-bg rounded-md px-2 py-1 border border-dark-border",title:i,children:i||"—"}),e.jsxs("button",{type:"button",onClick:()=>g&&void w(g),disabled:C||!g,className:"shrink-0 flex items-center gap-1 rounded-md border border-dark-border px-2 py-1 text-[11px] text-dark-muted hover:bg-dark-hover disabled:opacity-40",children:[e.jsx(Ee,{size:12}),o("chat.dirPickerUp")]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto rounded-lg border border-dark-border bg-dark-bg divide-y divide-dark-border/60",children:C?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-xs text-dark-muted",children:[e.jsx(le,{size:14,className:"animate-spin"}),o("chat.loading")]}):S?e.jsx("div",{className:"px-3 py-4 text-xs text-accent-red",children:S}):y.length===0?e.jsx("div",{className:"px-3 py-4 text-xs text-dark-muted/60 text-center",children:"—"}):y.map(b=>{const u=i.includes("\\")?"\\":"/",T=i.endsWith(u)?i+b:i+u+b;return e.jsxs("button",{type:"button",onClick:()=>void w(T),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs text-dark-text hover:bg-dark-hover",children:[e.jsx(qe,{size:13,className:"shrink-0 text-accent-yellow/80"}),e.jsx("span",{className:"truncate",children:b})]},b)})}),e.jsx("button",{type:"button",onClick:()=>h(i),disabled:!i||C,className:"w-full rounded-lg bg-accent-blue/90 text-white text-xs font-medium py-2 hover:bg-accent-blue disabled:opacity-40",children:o("chat.dirPickerConfirm")})]})]})]})}function _e(){const{t:a}=ce(),{automations:n,runsByAutomation:h,fetchAutomations:o,createAutomation:i,updateAutomation:x,deleteAutomation:g,toggleAutomation:k,runAutomation:y,fetchRuns:M,error:C}=Re(),[D,S]=l.useState(!1),[I,N]=l.useState(null),[r,m]=l.useState(v),[w,b]=l.useState(null),[u,T]=l.useState(""),[K,W]=l.useState(!1),[me,L]=l.useState(!1),[B,G]=l.useState([]),[U,J]=l.useState([]),[_,V]=l.useState([]),[X,Y]=l.useState(!1),[P,A]=l.useState([]),Q=l.useRef(null);l.useEffect(()=>{o()},[o]);const Z=async t=>{N(null),m(t?{...t.form}:{...v}),A([]),S(!0),await ee()},ue=async t=>{N(t.id),m(Oe(t)),A((t.attachments??[]).map((s,d)=>({id:`existing-${d}-${s}`,name:He(s),file:null,uploading:!1,path:s}))),S(!0),await ee()},O=()=>{S(!1),N(null),m(v),A([]),L(!1)},ee=async()=>{var t,s;Y(!0);try{const[d,c,p]=await Promise.all([R.models.list().catch(()=>({success:!1,data:void 0})),R.connectors.list().catch(()=>({success:!1,data:void 0})),R.channels.list().catch(()=>({success:!1,data:void 0}))]);d.success&&((t=d.data)!=null&&t.models)?G(d.data.models.filter(f=>f.enabled!==!1)):G([]),c.success&&((s=c.data)!=null&&s.connectors)?J(c.data.connectors.filter(f=>f.installed)):J([]),p.success&&Array.isArray(p.data)?V(p.data):V([])}finally{Y(!1)}},xe=async()=>{const t=de(r);if(!r.name.trim()||!r.instructions.trim()||!t)return;if(P.some(p=>p.uploading)){oe.warning("附件上传中,请稍候…");return}const s=P.filter(p=>p.error).map(p=>p.name);if(s.length>0){oe.warning(`附件上传失败:${s.join(", ")}`);return}W(!0);const d={name:r.name.trim(),instructions:r.instructions.trim(),schedule:t,workspaceDir:r.workspaceDir.trim(),readAutoAllow:r.readAutoAllow,modelRef:r.modelRef.trim()||null,attachments:P.map(p=>p.path).filter(p=>!!p),connectorIds:[...r.connectorIds],notificationChannelIds:[...r.channelIds]},c=I?await x(I,d):await i(d)!==null;W(!1),c&&O()},be=async t=>{const s=u.trim();if(!s)return;const[d,...c]=s.split(/\s+/),p=c.join(" ");d&&p&&(await fetch(`/api/automations/${encodeURIComponent(t)}/permissions`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tool:d,target:p})})).ok&&(T(""),await o())},pe=async(t,s)=>{(await fetch(`/api/automations/${encodeURIComponent(t)}/permissions`,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({entry:s})})).ok&&await o()},he=async t=>{const s=w===t?null:t;b(s),s&&await M(t)},fe=async t=>{var d;if(!t||t.length===0)return;const s=Array.from(t).map(c=>({id:`f-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:c.name,file:c,uploading:!0}));A(c=>[...c,...s]);for(const c of s){const p=`${Le}/${c.name}`;try{const f=await R.files.upload(c.file,p);if(f.success&&((d=f.data)!=null&&d.path)){const E=f.data.path.replace(/\\/g,"/");A($=>$.map(z=>z.id===c.id?{...z,uploading:!1,path:E}:z))}else A(E=>E.map($=>$.id===c.id?{...$,uploading:!1,error:f.error||"upload failed"}:$))}catch(f){const E=f instanceof Error?f.message:"upload failed";A($=>$.map(z=>z.id===c.id?{...z,uploading:!1,error:E}:z))}}},ge=t=>{A(s=>s.filter(d=>d.id!==t))},ke=[{id:"movie",nameKey:"automation.tplMovieName",descKey:"automation.tplMovieDesc",form:{...v,name:a("automation.tplMovieName"),instructions:a("automation.tplMovieInstr"),freq:"daily",time:"20:00"}},{id:"health",nameKey:"automation.tplHealthName",descKey:"automation.tplHealthDesc",form:{...v,name:a("automation.tplHealthName"),instructions:a("automation.tplHealthInstr"),freq:"daily",time:"14:00"}},{id:"why",nameKey:"automation.tplWhyName",descKey:"automation.tplWhyDesc",form:{...v,name:a("automation.tplWhyName"),instructions:a("automation.tplWhyInstr"),freq:"daily",time:"16:00"}},{id:"git",nameKey:"automation.tplGitName",descKey:"automation.tplGitDesc",form:{...v,name:a("automation.tplGitName"),instructions:a("automation.tplGitInstr"),freq:"weekdays",time:"09:00"}}],je=r.name.trim()&&r.instructions.trim()&&(r.freq==="custom"?!!r.cron.trim():r.freq==="once"?!!r.onceAt:!0);return e.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto p-6",children:[e.jsxs("div",{className:"max-w-4xl w-full mx-auto",children:[e.jsxs("div",{className:"flex items-start justify-between mb-1",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(H,{size:20,className:"text-accent-blue"}),a("automation.title")]}),e.jsx("button",{onClick:()=>void o(),className:"p-2 rounded-lg hover:bg-dark-hover text-dark-muted",title:a("automation.refresh"),children:e.jsx(ve,{size:16})})]}),e.jsx("p",{className:"text-sm text-dark-muted mb-5",children:a("automation.subtitle")}),C&&e.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-accent-red/10 text-accent-red text-sm flex items-center gap-2",children:[e.jsx(te,{size:16})," ",C]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{size:16,className:"text-accent-yellow"}),e.jsx("h3",{className:"text-sm font-semibold",children:a("automation.recommendedTitle")})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 mb-8",children:ke.map(t=>e.jsxs("button",{onClick:()=>void Z(t),className:"text-left rounded-xl border border-dark-border bg-dark-surface p-4 hover:border-accent-blue/60 hover:bg-dark-hover/50 transition-colors flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm font-semibold",children:a(t.nameKey)}),e.jsx("span",{className:"text-xs text-dark-muted leading-relaxed line-clamp-3 flex-1",children:a(t.descKey)}),e.jsxs("span",{className:"inline-flex items-center gap-1 self-start px-2 py-0.5 rounded-md bg-dark-hover text-xs text-dark-muted",children:[e.jsx(H,{size:12})," ",ie(de(t.form),a)]})]},t.id))}),e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold",children:a("automation.mineTitle")}),e.jsx("span",{className:"text-xs text-dark-muted",children:n.length})]}),n.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-dark-border py-12 flex flex-col items-center gap-2 text-center",children:[e.jsx(Ne,{size:32,className:"text-dark-muted"}),e.jsx("p",{className:"text-sm font-medium",children:a("automation.emptyTitle")}),e.jsx("p",{className:"text-xs text-dark-muted",children:a("automation.emptyDesc")}),e.jsxs("button",{onClick:()=>void Z(),className:"mt-2 flex items-center gap-1 px-4 py-1.5 rounded-lg border border-dark-border bg-dark-surface hover:bg-dark-hover text-sm font-medium",children:[e.jsx(ae,{size:15})," ",a("automation.new")]})]}):e.jsx("div",{className:"space-y-2",children:n.map(t=>e.jsxs("div",{className:"rounded-xl border border-dark-border bg-dark-surface",children:[e.jsxs("div",{className:"flex items-center justify-between p-3",children:[e.jsxs("button",{onClick:()=>void he(t.id),className:"flex items-center gap-2 min-w-0 text-left",children:[e.jsx(H,{size:16,className:"text-accent-blue shrink-0"}),e.jsx("span",{className:"font-medium text-sm truncate",children:t.name}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded shrink-0 ${t.status==="enabled"?"bg-accent-green/20 text-accent-green":"bg-dark-hover text-dark-muted"}`,children:t.status==="enabled"?a("automation.enabled"):a("automation.disabled")}),e.jsx("span",{className:"text-xs text-dark-muted shrink-0 hidden md:inline",children:ie(t.schedule,a)})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.nextRunAt&&e.jsxs("span",{className:"text-xs text-dark-muted hidden lg:inline mr-1",children:[a("automation.nextRun"),": ",new Date(t.nextRunAt).toLocaleString()]}),e.jsx("button",{onClick:()=>void ue(t),className:"p-1.5 rounded-lg hover:bg-dark-hover text-dark-muted",title:a("automation.edit"),children:e.jsx(we,{size:15})}),e.jsx("button",{onClick:()=>void k(t.id,t.status!=="enabled"),className:"p-1.5 rounded-lg hover:bg-dark-hover text-dark-muted",title:t.status==="enabled"?a("automation.disable"):a("automation.enable"),children:e.jsx(Ae,{size:15})}),e.jsx("button",{onClick:()=>void y(t.id),className:"p-1.5 rounded-lg hover:bg-dark-hover text-accent-green",title:a("automation.runNow"),children:e.jsx(Ce,{size:15})}),e.jsx("button",{onClick:()=>void g(t.id),className:"p-1.5 rounded-lg hover:bg-dark-hover text-accent-red",title:a("automation.delete"),children:e.jsx(Ie,{size:15})})]})]}),w===t.id&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-dark-border pt-3",children:[e.jsx("p",{className:"text-xs text-dark-muted whitespace-pre-wrap",children:t.instructions}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-semibold text-dark-muted mb-1 flex items-center gap-1",children:[e.jsx($e,{size:12})," ",a("automation.historyTitle")]}),(h[t.id]||[]).length===0&&e.jsx("p",{className:"text-xs text-dark-muted",children:a("automation.noRuns")}),(h[t.id]||[]).slice(0,10).map(s=>e.jsxs("div",{className:"flex items-center gap-2 text-xs py-1",children:[e.jsxs("span",{className:`px-1.5 py-0.5 rounded flex items-center gap-1 ${s.status==="ok"?"bg-accent-green/20 text-accent-green":s.status==="error"?"bg-accent-red/20 text-accent-red":"bg-accent-yellow/20 text-accent-yellow"}`,children:[s.status==="ok"&&e.jsx(ze,{size:11}),s.status]}),e.jsx("span",{className:"text-dark-muted",children:new Date(s.startedAt).toLocaleString()}),e.jsxs("span",{className:"text-dark-muted truncate flex-1",children:["#",s.id.slice(0,8)," · ",s.trigger]})]},s.id))]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-dark-muted mb-1",children:a("automation.permissionsTitle")}),t.permissions.length===0&&e.jsx("p",{className:"text-xs text-dark-muted",children:a("automation.permissionsEmpty")}),e.jsx("div",{className:"flex flex-wrap gap-1 mb-1",children:t.permissions.map(s=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-accent-blue/10 text-accent-blue text-xs",children:[s,e.jsx("button",{onClick:()=>void pe(t.id,s),className:"hover:text-accent-red",children:e.jsx(q,{size:12})})]},s))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:u,onChange:s=>T(s.target.value),placeholder:a("automation.permissionPlaceholder"),className:"flex-1 px-2 py-1.5 rounded-lg bg-dark-bg border border-dark-border text-xs focus:outline-none focus:border-accent-blue"}),e.jsx("button",{onClick:()=>void be(t.id),className:"px-3 py-1.5 rounded-lg bg-dark-hover text-dark-muted hover:text-dark-text text-xs",children:a("automation.add")})]})]})]})]},t.id))})]}),D&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:O,children:e.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-dark-border bg-dark-surface p-5 space-y-4 shadow-xl max-h-[90vh] overflow-y-auto custom-scrollbar",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold",children:a(I?"automation.editTitle":"automation.createTitle")}),e.jsx("p",{className:"text-xs text-dark-muted mt-0.5",children:a("automation.subtitle")})]}),e.jsx("button",{onClick:O,className:"p-1.5 rounded-lg hover:bg-dark-hover text-dark-muted",children:e.jsx(q,{size:16})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-dark-muted mb-1.5",children:a("automation.nameLabel")}),e.jsx("input",{autoFocus:!0,value:r.name,onChange:t=>m(s=>({...s,name:t.target.value})),placeholder:a("automation.namePlaceholder"),className:"w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-dark-muted mb-1.5",children:a("automation.scheduleLabel")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:r.freq,onChange:t=>m(s=>({...s,freq:t.target.value})),className:"px-2.5 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue",children:[e.jsx("option",{value:"daily",children:a("automation.freqDaily")}),e.jsx("option",{value:"weekly",children:a("automation.freqWeekly")}),e.jsx("option",{value:"weekdays",children:a("automation.freqWeekdays")}),e.jsx("option",{value:"once",children:a("automation.freqOnce")}),e.jsx("option",{value:"custom",children:a("automation.freqCustom")})]}),r.freq==="weekly"&&e.jsx("select",{value:r.dow,onChange:t=>m(s=>({...s,dow:t.target.value})),className:"px-2.5 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue",children:Me.map(t=>e.jsx("option",{value:t.value,children:a(t.key)},t.value))}),(r.freq==="daily"||r.freq==="weekly"||r.freq==="weekdays")&&e.jsx("input",{type:"time",value:r.time,onChange:t=>m(s=>({...s,time:t.target.value})),className:"flex-1 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue"}),r.freq==="once"&&e.jsx("input",{type:"datetime-local",value:r.onceAt,onChange:t=>m(s=>({...s,onceAt:t.target.value})),className:"flex-1 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue"}),r.freq==="custom"&&e.jsx("input",{value:r.cron,onChange:t=>m(s=>({...s,cron:t.target.value})),placeholder:"*/30 * * * *",className:"flex-1 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm font-mono focus:outline-none focus:border-accent-blue"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-dark-muted mb-1.5",children:a("automation.instructionLabel")}),e.jsx("textarea",{value:r.instructions,onChange:t=>m(s=>({...s,instructions:t.target.value})),placeholder:a("automation.instructionsPlaceholder"),rows:4,className:"w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue resize-none"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-dark-muted mb-1.5",children:[e.jsx(se,{size:12})," ",a("automation.attachmentsLabel")]}),e.jsx("p",{className:"text-[10px] text-dark-muted/70 mb-1.5",children:a("automation.attachmentsHint")}),P.length===0?e.jsx("div",{className:"text-xs text-dark-muted/60 italic",children:a("automation.attachmentsEmpty")}):e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:P.map(t=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded-md text-xs ${t.error?"bg-accent-red/10 text-accent-red":t.uploading?"bg-dark-hover text-dark-muted":"bg-accent-blue/10 text-accent-blue"}`,title:t.path??t.error,children:[e.jsx(se,{size:11}),e.jsx("span",{className:"truncate max-w-[180px]",children:t.name}),t.uploading&&e.jsx(le,{size:11,className:"animate-spin"}),t.error&&e.jsx(te,{size:11}),e.jsx("button",{onClick:()=>ge(t.id),className:"hover:text-accent-red ml-0.5",children:e.jsx(q,{size:11})})]},t.id))}),e.jsx("input",{ref:Q,type:"file",multiple:!0,className:"hidden",onChange:t=>{fe(t.target.files),t.target.value=""}}),e.jsxs("button",{type:"button",onClick:()=>{var t;return(t=Q.current)==null?void 0:t.click()},className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg border border-dashed border-dark-border text-xs text-dark-muted hover:border-accent-blue/60 hover:text-accent-blue",children:[e.jsx(ae,{size:12})," ",a("automation.attachmentsAdd")]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-dark-muted mb-1.5",children:[e.jsx(Se,{size:12})," ",a("automation.modelLabel")]}),e.jsxs("select",{value:r.modelRef,onChange:t=>m(s=>({...s,modelRef:t.target.value})),className:"w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm focus:outline-none focus:border-accent-blue",disabled:X,children:[e.jsx("option",{value:"",children:a("automation.modelAuto")}),B.map(t=>e.jsxs("option",{value:`${t.provider}:${t.id}`,children:[t.name," · ",t.provider]},`${t.provider}:${t.id}`))]}),!X&&B.length===0&&e.jsx("p",{className:"text-[10px] text-dark-muted/70 mt-1",children:a("automation.modelNoModels")})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-dark-muted mb-1.5",children:[e.jsx(re,{size:12})," ",a("automation.connectorsLabel")]}),e.jsx("p",{className:"text-[10px] text-dark-muted/70 mb-1.5",children:a("automation.connectorsHint")}),U.length===0?e.jsx("div",{className:"text-xs text-dark-muted/60 italic",children:a("automation.connectorsEmpty")}):e.jsx("div",{className:"flex flex-wrap gap-1.5",children:U.map(t=>{const s=r.connectorIds.includes(t.id);return e.jsxs("button",{type:"button",onClick:()=>m(d=>({...d,connectorIds:s?d.connectorIds.filter(c=>c!==t.id):[...d.connectorIds,t.id]})),className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors ${s?"bg-accent-blue/15 text-accent-blue border border-accent-blue/40":"bg-dark-bg text-dark-muted border border-dark-border hover:border-accent-blue/40 hover:text-accent-blue"}`,children:[e.jsx(re,{size:11}),t.name]},t.id)})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-dark-muted mb-1.5",children:[e.jsx(ne,{size:12})," ",a("automation.channelsLabel")]}),e.jsx("p",{className:"text-[10px] text-dark-muted/70 mb-1.5",children:a("automation.channelsHint")}),_.length===0?e.jsx("div",{className:"text-xs text-dark-muted/60 italic",children:a("automation.channelsEmpty")}):e.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map(t=>{const s=r.channelIds.includes(t.id);return e.jsxs("button",{type:"button",disabled:!t.enabled,onClick:()=>m(d=>({...d,channelIds:s?d.channelIds.filter(c=>c!==t.id):[...d.channelIds,t.id]})),className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors ${s?"bg-accent-blue/15 text-accent-blue border border-accent-blue/40":t.enabled?"bg-dark-bg text-dark-muted border border-dark-border hover:border-accent-blue/40 hover:text-accent-blue":"bg-dark-bg text-dark-muted/50 border border-dark-border opacity-60 cursor-not-allowed"}`,children:[e.jsx(ne,{size:11}),t.name,!t.enabled&&e.jsx("span",{className:"text-[9px]",children:"·off"})]},t.id)})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-dark-muted mb-1.5",children:[e.jsx(F,{size:12})," ",a("automation.workspaceLabel")]}),e.jsx("p",{className:"text-[10px] text-dark-muted/70 mb-1.5",children:a("automation.workspaceHint")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:r.workspaceDir,onChange:t=>m(s=>({...s,workspaceDir:t.target.value})),placeholder:"留空使用当前工作目录",className:"flex-1 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm font-mono focus:outline-none focus:border-accent-blue"}),e.jsxs("button",{type:"button",onClick:()=>L(!0),className:"shrink-0 inline-flex items-center gap-1 px-3 py-2 rounded-lg border border-dark-border text-xs text-dark-muted hover:bg-dark-hover hover:text-dark-text",children:[e.jsx(F,{size:12})," ",a("automation.workspacePick")]}),r.workspaceDir&&e.jsx("button",{type:"button",onClick:()=>m(t=>({...t,workspaceDir:""})),className:"shrink-0 inline-flex items-center gap-1 px-2 py-2 rounded-lg border border-dark-border text-xs text-dark-muted hover:bg-dark-hover hover:text-accent-red",title:a("automation.workspaceClear"),children:e.jsx(q,{size:12})})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-dark-muted mb-1.5",children:[e.jsx(De,{size:12})," ",a("automation.permissionAccess")]}),e.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg border border-dark-border bg-dark-bg",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":r.readAutoAllow,onClick:()=>m(t=>({...t,readAutoAllow:!t.readAutoAllow})),className:`relative shrink-0 mt-0.5 inline-flex h-5 w-9 items-center rounded-full transition-colors ${r.readAutoAllow?"bg-accent-blue":"bg-dark-hover"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${r.readAutoAllow?"translate-x-4":"translate-x-0.5"}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-medium text-dark-text",children:a("automation.fullAccessLabel")}),e.jsx("p",{className:"text-[10px] text-dark-muted/80 mt-0.5",children:a("automation.fullAccessHint")})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:O,className:"px-4 py-2 rounded-lg bg-dark-hover text-dark-muted hover:text-dark-text text-sm",children:a("automation.cancel")}),e.jsx("button",{onClick:()=>void xe(),disabled:!je||K,className:"px-5 py-2 rounded-lg bg-accent-blue text-white text-sm font-medium hover:bg-accent-blue/80 disabled:opacity-40 disabled:cursor-not-allowed",children:a(K?"automation.saving":"automation.save")})]})]})}),me&&D&&Te.createPortal(e.jsx(Fe,{initial:r.workspaceDir||"",onClose:()=>L(!1),onConfirm:t=>{m(s=>({...s,workspaceDir:t})),L(!1)}}),document.body)]})}export{_e as AutomationView};
|