(function () { 'use strict'; window.industryRenderers ??= {}; function scene(svg, config, kit, title, subtitle, phases, note) { const {anime,el}=kit; const C={bg:'#0b1424',panel:'#15243a',line:'#68809d',ink:'#edf4ff',muted:'#b2c4da',cyan:'#57d9ed',green:'#82e0b0',amber:'#ffd078',red:'#ff8a94'}; const D=Number.isFinite(+config.duration)&&+config.duration>0?+config.duration:6000; const tl=anime.createTimeline({autoplay:false,defaults:{ease:'linear'}}); function e(t,a={},text='',p=svg){return el(t,a,text,p);} function g(){return e('g');} function rect(x,y,w,h,fill=C.panel,stroke=C.line,p=svg,r=8){return e('rect',{x,y,width:w,height:h,rx:r,fill,stroke,'stroke-width':2},'',p);} function text(x,y,s,fill=C.ink,size=18,p=svg){return e('text',{x,y,fill,'font-size':size,'font-family':'system-ui, sans-serif'},s,p);} function path(d,color=C.line,width=3,p=svg){return e('path',{d,fill:'none',stroke:color,'stroke-width':width,'stroke-linecap':'round','stroke-linejoin':'round'},'',p);} function circle(x,y,r,fill=C.cyan,p=svg){return e('circle',{cx:x,cy:y,r,fill},'',p);} const tracks=new WeakMap(); function tween(o,attrs,start,end){ let previous=tracks.get(o);if(!previous){previous={};tracks.set(o,previous);} for(const [key,values] of Object.entries(attrs)){ const old=previous[key]; // Anime v4 needs explicit holds across gaps for reverse seeking. if(old && start>old.end)tl.add(o,{[key]:[old.value,old.value],duration:(start-old.end)*D/6000},old.end*D/6000); previous[key]={end,value:values[values.length-1]}; } tl.add(o,{...attrs,duration:(end-start)*D/6000},start*D/6000); } function reveal(o,start,end= start+650){o.setAttribute('opacity','0');tween(o,{opacity:[0,1]},start,end);} function flow(d,start,end,color=C.cyan,width=5){const p=path(d,color,width);const len=p.getTotalLength();p.setAttribute('stroke-dasharray',len);p.setAttribute('stroke-dashoffset',len);tween(p,{strokeDashoffset:[len,0]},start,end);return p;} function parcel(x,y,color=C.amber){const p=g();rect(x,y,36,28,color,'#0b1424',p,3);path(`M${x+18} ${y} V${y+28}`,'#736146',2,p);return p;} function person(x,y,color=C.cyan){const p=g();circle(x,y,10,color,p);path(`M${x} ${y+15} V${y+43} M${x-15} ${y+25} H${x+15} M${x} ${y+43} L${x-12} ${y+60} M${x} ${y+43} L${x+12} ${y+60}`,color,6,p);return p;} function gear(x,y,r,color=C.line){const p=g();for(let i=0;i<12;i++){const a=i*Math.PI/6;path(`M${x+Math.cos(a)*(r-5)} ${y+Math.sin(a)*(r-5)} L${x+Math.cos(a)*(r+7)} ${y+Math.sin(a)*(r+7)}`,color,8,p);}circle(x,y,r,color,p);circle(x,y,r*.45,C.bg,p);return p;} rect(10,10,940,520,C.bg,C.panel,svg,16); const heading=text(32,43,title,C.ink,25); const words=subtitle.split(' ');let line='',row=0;for(const w of words){if((line+' '+w).length>104){text(32,70+row*19,line,C.muted,16);line=w;row++;}else line+=(line?' ':'')+w;}if(line)text(32,70+row*19,line,C.muted,16); path('M32 426 H928',C.line,1); phases.forEach((s,i)=>{const x=47+i*183;circle(x,455,13,C.panel);const dot=circle(x,455,11,C.cyan);dot.setAttribute('opacity','.18');tween(dot,{opacity:[.18,1]},i*1200,i*1200+700);text(x+21,461,s,C.ink,16);}); text(32,510,note,C.muted,16); tween(heading,{opacity:[1,1]},0,6000); return {C,D,tl,e,g,rect,text,path,circle,tween,reveal,flow,parcel,person,gear}; } window.industryRenderers["energy-microgrid-storage"] = function(svg, config, kit) { const s=scene(svg,config,kit,"Microgrid: balance generation with storage","Solar and wind feed a common bus; a renewable dip triggers storage dispatch before a flexible load rejoins.",["Renewables", "Serve load", "Output dips", "Discharge", "Load rejoins"],"Cyan = renewable supply \u00b7 Amber = storage dispatch \u00b7 Green = restored flexible load"); const {C,tl,g,rect,text,path,circle,tween,reveal,flow}=s; // Tilted solar array, turbine, bus, battery cabinet, and real building loads. path('M50 188 L82 132 H223 L193 188 Z',C.cyan,3);for(let i=0;i<4;i++)path(`M${82+i*35} 132 L${50+i*35} 188`,C.line,2);path('M66 160 H208 M90 189 V215 M174 189 V215',C.line,3);circle(51,116,15,C.amber); text(40,244,'Solar array',C.cyan,17); path('M313 210 V143 M313 143 L290 110 M313 143 L350 133 M313 143 L296 177',C.cyan,5);circle(313,143,7,C.ink);text(269,244,'Wind',C.cyan,17); path('M65 283 H881',C.line,7);text(373,310,'LOCAL ENERGY BUS',C.muted,16); path('M141 217 V283 M313 212 V283',C.line,3); rect(417,120,107,109,C.panel,C.amber);rect(450,109,42,11,C.amber,C.amber);const bars=Math.max(1,Math.min(3,Math.round(+config.storageBars||3)));for(let i=0;i<3;i++){const bar=rect(433,139+i*24,75,15,i>=3-bars?C.amber:C.bg,C.amber,undefined,2);if(i===3-bars)tween(bar,{fill:[C.amber,C.bg]},3600,4900);}text(530,205,'Storage',C.amber,17);path('M470 229 V283',C.line,3); function building(x,y,w,h,label,color){rect(x,y,w,h,C.panel,color);for(let xx=x+12;xx