@graphysdk/theme-chalkboard 0.1.1-beta.1793272487821 → 0.1.1-beta.1793288163741

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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let M=require("react"),o=require("@graphysdk/react"),d=require("react/jsx-runtime");var Pe=/[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu,Ce=/^[a-zA-Z]$/u,Me=(e,r)=>e==="H"?"x":e==="V"?"y":r%2===0?"x":"y",X=(e,r)=>{let t="",a=0;return(e.match(Pe)??[]).map(n=>{if(Ce.test(n))return t=n.toUpperCase(),a=0,n;const i=Me(t,a);return a+=1,String(Number(n)*(i==="x"?r.width:r.height))}).join(" ")},q=(e,r)=>{const t=(0,o.getX)(e),a=(0,o.getY)(e)??(0,o.getYMax)(e);return t===null||a===null?null:{x:(0,o.toViewBoxX)(t)*r.width,y:(0,o.toViewBoxY)(a)*r.height}},K=(e,r)=>{const t=(0,o.getX)(e),a=(0,o.getY)(e)??(0,o.getRadiusExtent)(e).outerRadius;if(t===null||a===null)return null;const n=(0,o.polarToUnit)(t,a),i=Math.min(r.width,r.height)/2;return{x:r.width/2+n.x*i,y:r.height/2-n.y*i}},He=e=>({x:0,y:0,width:e.width,height:e.height}),Ie=e=>`${e.map((r,t)=>`${t===0?"M":"L"}${r.x},${r.y}`).join(" ")} Z`;var $e=34,z=8,L=72,ee=11,b=6,Oe=(e,r,t)=>`<svg x="${e}" y="${r}" width="1" height="1" overflow="visible">${t}</svg>`,Te=({wood:e,woodLight:r,woodDark:t})=>{const a=(n,i,s,h=1)=>`<rect x="${n}" y="${n}" rx="3" style="width:calc(100% - ${n*2}px);height:calc(100% - ${n*2}px)" fill="none" stroke="${s}" stroke-width="${i}" stroke-opacity="${h}"/>`;return a(8/2,8,e)+a(.5,1,t)+a(8-.5,1,r,.7)+a(9,2,"#000000",.18)},je=({wood:e,woodLight:r,woodDark:t,dust:a})=>`<svg x="0" y="100%" width="100%" height="1" overflow="visible"><rect x="0" y="-13" width="100%" height="13" fill="${e}"/><rect x="0" y="-13" width="100%" height="1.5" fill="${r}"/><rect x="0" y="-1" width="100%" height="1" fill="${t}"/><rect x="12" y="-13" style="width:calc(100% - 24px)" height="1.5" fill="${a}" fill-opacity="0.45"/></svg>`,Le=({wood:e,woodDark:r,felt:t,dust:a,chalks:n})=>{let s=-34-L;return`<rect x="${s}" y="${-13-b}" width="${L}" height="${b}" rx="1" fill="${t}"/><rect x="${s+1}" y="${-13-b}" width="${L-2}" height="1.5" fill="${a}" fill-opacity="0.35"/><rect x="${s}" y="${-13-b-ee}" width="${L}" height="${ee}" rx="2.5" fill="${e}" stroke="${r}" stroke-width="0.75"/>`+n.map((h,l)=>{const u=$e-l*6;return s-=u+14,`<rect x="${s}" y="${-13-z}" width="${u}" height="${z}" rx="${z/2}" fill="${h}"/><rect x="${s+2}" y="-20" width="${u-4}" height="1.2" fill="#FFFFFF" fill-opacity="0.35"/>`}).join("")},be=e=>`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">'+Te(e)+je(e)+Oe("100%","100%",Le(e))+"</svg>")}`,y={board:"#27362F",wiped:"#1F2C26",chalk:"#F4F1E8",dusty:"#C9D1C8",grid:"rgba(244, 241, 232, 0.24)",edge:"rgba(244, 241, 232, 0.45)",axis:"rgba(244, 241, 232, 0.85)",wood:"#86643F",woodLight:"#A88456",woodDark:"#4F3923",felt:"#5E5A55"},De="'Gochi Hand', 'Comic Sans MS', cursive",S={white:"#F4F1E8",yellow:"#F7DC6F",pink:"#F49AC2",blue:"#8FD3F4",green:"#A8E6A1",orange:"#F9A65A",red:"#F07A6A"},pe=[S.white,S.yellow,S.pink,S.blue,S.green,S.orange],We=["#668F99",S.blue,S.white],Ne=[S.blue,"#323F39",S.orange],Ge=(e,r)=>`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 ${e} ${e}">${r}</svg>`)}`,D=480,Be={image:Ge(D,`<filter id="smear" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency="0.004 0.021" numOctaves="4" seed="11" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 0.96 0 0 0 0 0.95 0 0 0 0 0.91 0.3 0 0 0 -0.1"/></filter><rect width="${D}" height="${D}" filter="url(#smear)"/>`),size:D,aspectRatio:1,fallback:y.board},Fe={image:be({wood:y.wood,woodLight:y.woodLight,woodDark:y.woodDark,felt:y.felt,dust:y.chalk,chalks:[S.white,S.yellow,S.pink]}),fit:"stretch",fallback:"transparent"},W=22,Ke=6,Ue=.82,te=2.4,H={fontWeight:400,textColor:y.chalk},$={fontWeight:400,textColor:y.dusty},re={dashArray:[],lineCap:"round",lineJoin:"round"},N={...H,fontSize:16,textOutlineColor:y.board,textOutlineWidth:4,fill:"transparent",stroke:"transparent",strokeWidth:0,cornerRadius:0,paddingInline:3,paddingBlock:0,shadow:"none"},ze={tokens:{graphBackground:y.board,graphBorder:y.edge,geomBorder:y.axis,textPrimary:y.chalk,textSecondary:y.dusty,ruleLine:y.chalk,gridLine:y.grid,hoverStroke:y.board,hoverGuideFill:"rgba(244, 241, 232, 0.07)",hoverGuideLine:y.edge,tooltipBackground:y.wiped,tooltipBorder:y.edge,tooltipPrimaryRow:"rgba(244, 241, 232, 0.1)",annotationShape:S.yellow,annotationArrow:y.chalk,differenceLabelBackground:y.wiped,trendPositive:S.green,trendNegative:S.red,trendNeutral:y.dusty},defaults:[o.style.graph({fill:Be,overpaint:Fe,strokeWidth:0,cornerRadius:4,fontFamily:De,padding:{top:W,right:W,bottom:W+13+Ke,left:W}}),o.style.geom({shadow:"none",fillAlpha:Ue}),o.style.geom({shadow:"none"},{state:"hovered"}),o.style.geom.bar({stroke:y.chalk,strokeWidth:te,cornerRadius:2}),o.style.geom.bar({fillAlpha:1,stroke:y.chalk,strokeWidth:3,shadow:"none"},{state:"hovered"}),o.style.geom.line({strokeWidth:4,...re}),o.style.geom.area({fillAlpha:.72,strokeWidth:3,...re}),o.style.geom.point({fillAlpha:1,size:14,stroke:y.board,strokeWidth:1.5}),o.style.geom.tile({fillAlpha:.9,cornerRadius:2,stroke:y.board,strokeWidth:3}),o.style.geom.tile({fillAlpha:1,stroke:y.chalk,strokeWidth:te},{state:"hovered"}),o.style.geom.rule({strokeWidth:2.5,dashArray:[2,7],lineCap:"round"}),o.style.geom.rule.label({...H,fontSize:15}),o.style.gridLine({dashArray:[7,7]}),o.style.gridLine.y({strokeWidth:1.5}),o.style.panelBorder({strokeWidth:0}),o.style.axisLine({stroke:y.axis,strokeWidth:2.5,dashArray:[],lineCap:"round",cornerRadius:6}),o.style.tickLine({strokeWidth:0}),o.style.tickLabel({...$,fontSize:15,lineHeight:1}),o.style.axisLabel({...$,fontSize:16,lineHeight:1}),o.style.heading({...H}),o.style.heading.h1({fontSize:27,lineHeight:1}),o.style.heading.h2({...$,fontSize:18,lineHeight:1.1}),o.style.header({margin:{bottom:16}}),o.style.caption({...$,fontSize:14}),o.style.source({...$,fontSize:14}),o.style.dataLabel({...H,fontSize:15,lineHeight:1,fill:"transparent",paddingBlock:1,paddingInline:3}),o.style.dataLabel.observation.inside({textOutlineColor:y.board,textOutlineWidth:3.5}),o.style.dataLabel.category.inside({textOutlineColor:y.board,textOutlineWidth:3.5}),o.style.legendItem({...H,fontSize:16,fill:"transparent",stroke:"transparent"}),o.style.directLabel({fontWeight:400,fontSize:16}),o.style.tooltip({strokeWidth:2,cornerRadius:3,paddingInline:12,paddingBlock:9,shadow:"none"}),o.style.tooltip.heading({...H,fontSize:17,lineHeight:1.15}),o.style.tooltip.label({...$,fontSize:15,lineHeight:1.25}),o.style.tooltip.value({...H,fontSize:15,lineHeight:1.25}),o.style.annotation.text({...N,paddingInline:6,paddingBlock:2,fontSize:17,lineHeight:1.15}),o.style.annotation.pinnedNumber({fill:y.chalk,stroke:y.board}),o.style.annotation.pinnedNumber.label({...N}),o.style.annotation.comment({fill:y.chalk,stroke:y.board}),o.style.annotation.comment.label({...N}),o.style.annotation.differenceArrow({stroke:y.chalk,strokeWidth:2.5}),o.style.annotation.differenceArrow.label({...N}),o.style.annotation.arrow({stroke:y.chalk,strokeWidth:3,dashArray:[]}),o.style.annotation.shape({fill:y.chalk,fillAlpha:.1,strokeWidth:0}),o.style.tickLabel({textOutlineColor:y.board,textOutlineWidth:3},{coord:"polar"})]},k=e=>{let r=2166136261;for(let t=0;t<e.length;t+=1)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0},O=e=>{let r=e||1;return()=>{r=r+1831565813|0;let t=Math.imul(r^r>>>15,1|r);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}},Xe=e=>{const r=[.035,.07,.13].map((a,n)=>({frequency:a*(.7+e()*.6),phase:e()*Math.PI*2,weight:1/(n+1)})),t=r.reduce((a,n)=>a+n.weight,0);return a=>r.reduce((n,i)=>n+i.weight*Math.sin(a*i.frequency+i.phase),0)/t},_=(e,{wander:r,seed:t,closed:a=!1,step:n=9,cornered:i=!1})=>{if(e.length<2)return"";const s=Xe(O(t)),h=a?[...e,e[0]]:[...e],l=[],u=[];let g=0;for(let x=0;x<h.length-1;x+=1){const c=h[x],v=h[x+1],p=Math.hypot(v.x-c.x,v.y-c.y);if(p===0)continue;const f={x:-(v.y-c.y)/p,y:(v.x-c.x)/p},P=Math.max(1,Math.ceil(p/n)),R=[];for(let m=0;m<=P;m+=1){const E=m/P,C=r*Math.sin(Math.PI*E)*s(g+E*p);R.push({x:c.x+(v.x-c.x)*E+f.x*C,y:c.y+(v.y-c.y)*E+f.y*C})}u.push(R),l.push(...R.slice(0,-1)),g+=p}return i?`${u.map(x=>ae(x,!1)).map((x,c)=>c===0?x:x.replace(/^M/u,"L")).join(" ")}${a?" Z":""}`:(a||l.push(h[h.length-1]),ae(l,a))},Ye=/M[^M]*/gu,Ve=/^[ML\d\s.,eE+-]+$/u,qe=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu,Ze=e=>{if(!Ve.test(e))return null;const r=(e.match(qe)??[]).map(Number),t=[];for(let a=0;a+1<r.length;a+=2)t.push({x:r[a],y:r[a+1]});return t},Y=(e,r)=>(e.match(Ye)??[]).map(t=>{const a=Ze(t.replace(/\s*Z\s*$/u,""));return a===null||a.length<2?t:_(a,r)}).join(" "),A=e=>(Math.round(e*100)/100).toString(),ae=(e,r)=>{const t=e.length,a=h=>r?e[(h+t)%t]:e[Math.max(0,Math.min(t-1,h))],n=a(0),i=[`M${A(n.x)},${A(n.y)}`],s=r?t:t-1;for(let h=0;h<s;h+=1){const[l,u,g,x]=[a(h-1),a(h),a(h+1),a(h+2)],c={x:u.x+(g.x-l.x)/6,y:u.y+(g.y-l.y)/6},v={x:g.x-(x.x-u.x)/6,y:g.y-(x.y-u.y)/6};i.push(`C${A(c.x)},${A(c.y)} ${A(v.x)},${A(v.y)} ${A(g.x)},${A(g.y)}`)}return`${i.join(" ")}${r?" Z":""}`},Je=9,T=({run:e,skip:r},t)=>{const a=O(t),n=([i,s])=>A(i+a()*(s-i));return Array.from({length:Je},()=>`${n(e)} ${n(r)}`).join(" ")},Qe=.07,et=40,tt=(e,{angle:r,spacing:t,seed:a})=>{const n=O(a),i={x:e.x+e.width/2,y:e.y+e.height/2},s=Math.hypot(e.width,e.height)/2+t,h=[];for(let l=-s;l<=s;l+=t*(.75+n()*.5)){const u=r+(n()-.5)*Math.min(Qe,t/s),g={x:Math.cos(u),y:Math.sin(u)},x={x:-Math.sin(r),y:Math.cos(r)},c={x:i.x+x.x*l,y:i.y+x.y*l},v=s+n()*et;h.push(_([{x:c.x-g.x*v,y:c.y-g.y*v},{x:c.x+g.x*s,y:c.y+g.y*s}],{wander:1.1,seed:a+h.length+1,step:14}))}return h.join(" ")},rt=(e,r,t)=>{const a=(O(t)()-.5)*.25,n=i=>{const s={x:Math.cos(i)*r,y:Math.sin(i)*r};return`M${A(e.x-s.x)},${A(e.y-s.y)} L${A(e.x+s.x)},${A(e.y+s.y)}`};return`${n(Math.PI/4+a)} ${n(-Math.PI/4-a)}`},Z=(e,r,{seed:t,overshoot:a,wander:n,drift:i=0})=>{const s=O(t)()*Math.PI*2,h=Math.PI*2+a,l=Math.max(8,Math.ceil(h*r/10)),u=Array.from({length:l+1},(g,x)=>{const c=h*x/l,v=Math.max(0,c-Math.PI*2)/Math.max(a,1e-6),p=r+i*v*v,f=s+c;return{x:e.x+Math.cos(f)*p,y:e.y+Math.sin(f)*p}});return _(u,{wander:n,seed:t+1,step:6})},at=.4,nt=.85,ot={run:[14,46],skip:[1.5,4]},it=.35,st={run:[1.5,6],skip:[2,7]},ne={x:.45,y:-.35},B={x:-.6,y:.55},lt={run:[18,70],skip:[1.5,5]},dt={run:[1,4],skip:[3,9]},ht=.55,ct=.16,oe=[-Math.PI/4,Math.PI/4,-Math.PI/2.6,Math.PI/2.6,-Math.PI/8,Math.PI/8],j=(e,r=0)=>{const t=pe.indexOf(e);return oe[(t<0?r:t)%oe.length]},fe=e=>`${e}-${(0,M.useId)().replace(/[^a-zA-Z0-9]/gu,"")}`,w=({path:e,color:r,width:t,seed:a,opacity:n=1})=>(0,d.jsxs)("g",{opacity:n,fill:"none",stroke:r,strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:e,strokeWidth:t,strokeOpacity:at,strokeLinecap:"round"}),(0,d.jsx)("path",{d:e,strokeWidth:t*nt,strokeDasharray:T(ot,a),transform:`translate(${ne.x} ${ne.y})`}),(0,d.jsx)("path",{d:e,strokeWidth:Math.max(.8,t*it),strokeDasharray:T(st,a+1),transform:`translate(${B.x} ${B.y})`})]}),U=({region:e,bounds:r,color:t,angle:a,spacing:n,width:i,seed:s,pressure:h})=>{const l=fe("shade"),u=tt(r,{angle:a,spacing:n,seed:s});return(0,d.jsxs)("g",{children:[(0,d.jsx)("clipPath",{id:l,children:(0,d.jsx)("path",{d:e})}),(0,d.jsx)("path",{d:e,fill:y.board,fillOpacity:ht}),(0,d.jsx)("path",{d:e,fill:t,fillOpacity:h*ct}),(0,d.jsxs)("g",{clipPath:`url(#${l})`,fill:"none",stroke:t,children:[(0,d.jsx)("path",{d:u,strokeWidth:i,strokeOpacity:h*.72,strokeDasharray:T(lt,s+2)}),(0,d.jsx)("path",{d:u,strokeWidth:i*.4,strokeOpacity:h,strokeDasharray:T(dt,s+3),transform:`translate(${B.x} ${B.y})`})]})]})},I=e=>{const r=(0,o.useGeomStyleReader)(e);return(t,a)=>({color:(0,o.toPaintColor)(r.get("fill",t,a)),opacity:r.get("alpha",t,a),fillOpacity:r.get("fillAlpha",t,a),edge:r.get("stroke",t,a),edgeWidth:r.get("strokeWidth",t,a)})},me=e=>{const r=(0,o.useGeomStyleReader)(e);return(t,a)=>{const n=r.get("strokeWidth",t,a);return{color:r.get("stroke",t,a),opacity:r.get("alpha",t,a)*r.get("strokeAlpha",t,a),width:n,dashArray:(0,o.toStrokeDasharray)(r.get("dashArray",t,a),n)}}},ut=10,gt=2.2,xt=.5,ie=(e,r)=>{const t=(0,o.createStableKeyGenerator)(e.data,e.mapping,e.id),a=[];return e.data.groupBy(o.GROUP_VARIABLES.group).forEach(n=>{const i=[...n],[s]=i,h=r(i);s===void 0||h===null||a.push({key:t(s),observation:s,path:h})}),a},vt=(e,r)=>{const t=e.flatMap(a=>{const n=(0,o.getX)(a),i=K(a,r);return n===null||i===null?[]:[{angle:n,point:i}]}).sort((a,n)=>a.angle-n.angle).map(({point:a})=>a);return t.length===0?null:Ie(t)},J=({geom:e,observation:r,panel:t,project:a,color:n,opacity:i,radius:s=ut})=>{const h=a(r,t);return h===null?null:(0,d.jsx)("g",{"data-geom":e,children:(0,d.jsx)(w,{path:Z(h,s,{seed:19,overshoot:xt,wander:.5}),color:n,width:gt,seed:23,opacity:i})})},se=1.3,yt=3.2,pt=8,Se=({layer:e,coordSystem:r,panel:t})=>{const a=I(e),n=(0,M.useMemo)(()=>{if(r===void 0)return ie(e,l=>vt(l,t)).map(l=>({...l,fill:l.path,edge:Y(l.path,{wander:se,seed:k(l.key),closed:!0})}));const{areaGenerator:i,lineGenerator:s}=(0,o.createAreaPathGenerators)(r,e.params),h=new Map;return ie(e,l=>{const u=(0,o.prepareAreaObservations)(l,e.params.missingValues),g=i(u),x=s(u);if(!g)return null;const c=X(g,t);return x&&h.set(c,X(x,t)),c}).map(l=>({...l,fill:l.path,edge:Y(h.get(l.path)??"",{wander:se,seed:k(l.key)})}))},[e,r,t]);return t.width<=0||t.height<=0?null:(0,d.jsx)("g",{"data-geom":"area",children:n.map(({key:i,observation:s,fill:h,edge:l},u)=>{const g=a(s),x=k(i);return(0,d.jsxs)("g",{opacity:g.opacity,children:[(0,d.jsx)(U,{region:h,bounds:He(t),color:g.color,angle:j(g.color,u),spacing:pt,width:yt,seed:x,pressure:g.fillOpacity}),l!==""&&(0,d.jsx)(w,{path:l,color:g.color,width:g.edgeWidth,seed:x})]},i)})})},Ae=({layer:e,observation:r,panel:t,project:a})=>{const n=I(e)(r,"hovered");return(0,d.jsx)(J,{geom:"area",observation:r,panel:t,project:a,color:n.color,opacity:n.opacity})},ft=(0,o.defineGeomRenderer)("area",{coord:"cartesian",guideMode:"crosshair",swatchShape:"area",render:({layer:e,coordSystem:r,panelRect:t})=>r.type!=="cartesian"?null:(0,d.jsx)(Se,{layer:e,coordSystem:r,panel:t}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,d.jsx)(Ae,{layer:e,observation:r.observation,panel:t,project:q}),renderHoverCompanions:()=>null}),mt=(0,o.defineGeomRenderer)("area",{coord:"polar",guideMode:"crosshair",swatchShape:"area",render:({layer:e,panelRect:r})=>(0,d.jsx)(Se,{layer:e,panel:r}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,d.jsx)(Ae,{layer:e,observation:r.observation,panel:t,project:K}),renderHoverCompanions:()=>null}),St=1.6,At=.55,kt=.6,wt=3.8,V=7.5,Et=.55,Rt=3,_t={solo:{base:!0,value:!0},floor:{base:!0,value:!1},ceiling:{base:!1,value:!0},middle:{base:!1,value:!1}},Pt={top:"bottom",bottom:"top",left:"right",right:"left"},Ct=(e,r)=>r==="x"?((0,o.getYMax)(e)??(0,o.getY)(e)??0)>=((0,o.getYMin)(e)??0)?"top":"bottom":((0,o.getXMax)(e)??0)>=((0,o.getXMin)(e)??0)?"right":"left",Mt=(e,r,t)=>{const a=Math.max(0,e.width-t),n=Math.max(0,e.height-t);return r==="top"?{...e,y:e.y+e.height-n,height:n}:r==="bottom"?{...e,height:n}:r==="left"?{...e,x:e.x+e.width-a,width:a}:{...e,width:a}},Ht=e=>[{x:e.x,y:e.y+e.height},{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height}],It=({layer:e,observation:r,bounds:t,seedKey:a,mainAxis:n,panel:i,state:s})=>{const h=I(e);if(!t||t.width<=0||t.height<=0)return null;const l=h(r,s),u=_t[(0,o.getStackRole)(r)],g=Ct(r,n),x={x:t.x*i.width,y:t.y*i.height,width:t.width*i.width,height:t.height*i.height},c=[u.value?[]:[g],u.base?[]:[Pt[g]]].flat().reduce((p,f)=>Mt(p,f,Rt/2),x);if(c.width<=0||c.height<=0)return null;const v=s==="hovered";return(0,d.jsx)(ke,{rect:c,color:l.color,opacity:l.opacity,pressure:l.fillOpacity,edge:v?l.edge:l.color,edgeWidth:l.edgeWidth,angle:j(l.color)+(n==="x"?0:Math.PI/2),spacing:v?V*Et:V,seed:k(a)})},ke=({rect:e,color:r,opacity:t,pressure:a,edge:n,edgeWidth:i,angle:s,spacing:h=V,seed:l})=>{const u=Ht(e),g=Math.min(St,e.width/10,e.height/10),x=_(u,{wander:g,seed:l,closed:!0,cornered:!0}),c=_(u,{wander:g,seed:l+7,closed:!0,cornered:!0});return(0,d.jsxs)("g",{opacity:t,children:[(0,d.jsx)(U,{region:x,bounds:e,color:r,angle:s,spacing:h,width:wt,seed:l,pressure:a}),(0,d.jsx)(w,{path:x,color:n,width:i,seed:l}),(0,d.jsx)(w,{path:c,color:r,width:i*kt,seed:l+3,opacity:At})]})},le=({layer:e,observations:r,mainAxis:t,panel:a,state:n})=>{const i=(0,M.useMemo)(()=>(0,o.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]),s=(0,o.useGeomStyleReader)(e),h=(0,M.useMemo)(()=>(0,o.createBarBoundsReader)(e,t,s,a),[e,t,s,a]);return a.width<=0||a.height<=0?null:(0,d.jsx)("g",{"data-geom":"bar",children:Array.from(r,l=>{const u=i(l);return(0,d.jsx)(It,{layer:e,observation:l,bounds:h(l),seedKey:u,mainAxis:t,panel:a,state:n},u)})})},$t=(0,o.defineGeomRenderer)("bar",{coord:"cartesian",guideMode:"band",swatchShape:"square",render:({layer:e,coordSystem:r,panelRect:t})=>(0,d.jsx)(le,{layer:e,observations:e.data,mainAxis:(0,o.readMainAxis)(r),panel:t}),renderHover:({layer:e,coordSystem:r,primary:t,panelRect:a})=>(0,d.jsx)(le,{layer:e,observations:[t.observation],mainAxis:(0,o.readMainAxis)(r),panel:a,state:"hovered"}),renderHoverCompanions:()=>null}),de=1.3,Ot=5,Tt=2.2,jt=16,Lt=(e,r,t,a)=>{const n=(0,o.createStableKeyGenerator)(e.data,e.mapping,e.id),i=(0,o.createLinePathGenerator)(e.params),s=(l,u,g)=>{if(t==="polar")return _(u,{wander:de,seed:g,closed:!0});const x=i((0,o.prepareLineObservations)(l,e.params.missingValues));return x?Y(X(x,r),{wander:de,seed:g}):""},h=[];return e.data.groupBy(o.GROUP_VARIABLES.group).forEach(l=>{const u=[...l],[g]=u;if(g===void 0)return;const x=t==="polar"?u.sort((p,f)=>((0,o.getX)(p)??0)-((0,o.getX)(f)??0)):u,c=x.flatMap(p=>{const f=a(p,r);return f===null?[]:[f]});if(c.length<2)return;const v=n(g);h.push({key:v,observation:g,points:c,stroke:s(x,c,k(v))})}),h},bt=e=>e.every((r,t)=>t===0||Math.hypot(r.x-e[t-1].x,r.y-e[t-1].y)>=jt),Dt=({layer:e,panel:r,coord:t,project:a})=>{const n=me(e),i=(0,M.useMemo)(()=>Lt(e,r,t,a),[e,r,t,a]);return r.width<=0||r.height<=0?null:(0,d.jsx)("g",{"data-geom":"line",children:i.map(({key:s,observation:h,stroke:l,points:u})=>{const g=n(h),x=k(s),c=bt(u)?u.map((v,p)=>rt(v,Ot,x+p)).join(" "):"";return(0,d.jsxs)("g",{opacity:g.opacity,children:[(0,d.jsx)(w,{path:l,color:g.color,width:g.width,seed:x}),c!==""&&(0,d.jsx)(w,{path:c,color:g.color,width:Tt,seed:x+1})]},s)})})},Wt=({layer:e,observation:r,panel:t,project:a})=>{const n=me(e)(r,"hovered");return(0,d.jsx)(J,{geom:"line",observation:r,panel:t,project:a,color:n.color,opacity:n.opacity})},we=(e,r)=>(0,o.defineGeomRenderer)("line",{coord:e,guideMode:"crosshair",swatchShape:"line",render:({layer:t,panelRect:a})=>(0,d.jsx)(Dt,{layer:t,panel:a,coord:e,project:r}),renderHover:({layer:t,primary:a,panelRect:n})=>(0,d.jsx)(Wt,{layer:t,observation:a.observation,panel:n,project:r}),renderHoverCompanions:()=>null,getOverlayAnchor:({observation:t})=>{const a=(0,o.getX)(t),n=(0,o.getY)(t);return a===null||n===null?null:{x:a,y:n}}}),Nt=we("cartesian",q),Gt=we("polar",K),Bt=.35,Ft=.35,Kt=2,Ut=.3,zt=5,Xt=({layer:e,observations:r,panel:t,project:a,state:n})=>{const i=(0,o.useGeomStyleReader)(e),s=I(e),h=(0,M.useMemo)(()=>(0,o.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return(0,d.jsx)("g",{"data-geom":"point",children:Array.from(r,l=>{const u=a(l,t);if(u===null)return null;const g=h(l),x=k(g),c=s(l,n),v=i.get("size",l,n)/2;return(0,d.jsxs)("g",{opacity:c.opacity,children:[(0,d.jsx)("circle",{cx:u.x,cy:u.y,r:v,fill:c.color,fillOpacity:c.fillOpacity*Ut}),(0,d.jsx)(w,{path:Z(u,v,{seed:x,overshoot:Ft,wander:Bt}),color:c.color,width:Kt,seed:x+1})]},g)})})},Yt=({layer:e,observation:r,panel:t,project:a})=>{const n=I(e)(r,"hovered"),i=(0,o.useGeomStyleReader)(e).get("size",r,"hovered");return(0,d.jsx)(J,{geom:"point",observation:r,panel:t,project:a,color:n.color,opacity:n.opacity,radius:i/2+zt})},Ee=(e,r)=>(0,o.defineGeomRenderer)("point",{coord:e,swatchShape:"circle",render:({layer:t,panelRect:a})=>(0,d.jsx)(Xt,{layer:t,observations:t.data,panel:a,project:r}),renderHover:({layer:t,primary:a,panelRect:n})=>(0,d.jsx)(Yt,{layer:t,observation:a.observation,panel:n,project:r}),renderHoverCompanions:()=>null}),Vt=Ee("cartesian",q),qt=Ee("polar",K),Zt=Math.PI/40,Jt=1.2,Qt=3.4,he=8,er=.55,tr=3,rr=.42,ar=5,nr=1.1,or=3,ir=2.2,ce=y.chalk,F=(e,r,t)=>{const a=(0,o.polarToUnit)(r,1);return{x:e.width/2+a.x*t,y:e.height/2-a.y*t}},ue=(e,r,t,a)=>{const n=Math.max(1,Math.ceil(Math.abs(t-r)/Zt));return Array.from({length:n+1},(i,s)=>F(e,r+(t-r)*s/n,a))},ge=(e,r,t,a)=>{const{startAngle:n,endAngle:i}=(0,o.getAngleExtent)(e),{innerRadius:s,outerRadius:h}=(0,o.getRadiusExtent)(e);if(n===null||i===null||s===null||h===null)return null;const l=Math.min(t.width,t.height)/2,u=h*l,g=s*l;if(u<=0)return null;const x=Math.max(0,i-n),c=x>=2*Math.PI-1e-6?0:Math.min(a/2/u,x/4),v=n+c,p=i-c,f=ue(t,v,p,u),P=g>0?ue(t,p,v,g):[F(t,0,0)],R=[...f,...P];return{key:r,observation:e,region:`${R.map((m,E)=>`${E===0?"M":"L"}${m.x},${m.y}`).join(" ")} Z`,outline:_(R,{wander:Jt,seed:k(r),closed:!0,step:12}),bounds:{x:t.width/2-u,y:t.height/2-u,width:u*2,height:u*2},startAngle:n,inner:g,outer:u}},sr=e=>e.length>1&&e.every(({inner:r,outer:t})=>Math.abs(t-(e[0]?.outer??0))<.5&&Math.abs(r-(e[0]?.inner??0))<.5),xe=({layer:e,observations:r,panel:t,state:a})=>{const n=I(e),i=(0,M.useMemo)(()=>(0,o.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);if(t.width<=0||t.height<=0)return null;const s=a==="hovered",h=Array.from(r,c=>({key:i(c),observation:c})),l=h.flatMap(({key:c,observation:v})=>ge(v,c,t,0)??[]),u=!s&&sr(l),g=u?l:h.flatMap(({key:c,observation:v})=>ge(v,c,t,tr)??[]),x={x:t.width/2,y:t.height/2};return(0,d.jsxs)("g",{"data-geom":"bar",children:[g.map(({key:c,observation:v,region:p,outline:f,bounds:P},R)=>{const m=n(v,a),E=k(c);return(0,d.jsxs)("g",{opacity:m.opacity,children:[(0,d.jsx)(U,{region:p,bounds:P,color:m.color,angle:j(m.color,R)+(R%2===0?0:Math.PI/2),spacing:s?he*er:he,width:Qt,seed:E,pressure:m.fillOpacity}),!u&&(0,d.jsx)(w,{path:f,color:s?m.edge:m.color,width:m.edgeWidth,seed:E})]},c)}),u&&(0,d.jsxs)("g",{children:[g.map(({key:c,startAngle:v,inner:p,outer:f})=>(0,d.jsx)(w,{path:_([F(t,v,p),F(t,v,f)],{wander:.8,seed:k(c)+5,step:14}),color:ce,width:ir,seed:k(c)+6},c)),[g[0]?.outer??0,g[0]?.inner??0].filter(c=>c>0).map((c,v)=>(0,d.jsx)(w,{path:Z(x,c,{seed:31+v*17,overshoot:rr,wander:nr,drift:v===0?ar:-5}),color:ce,width:or,seed:41+v},c))]})]})},lr=(0,o.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:e,panelRect:r})=>(0,d.jsx)(xe,{layer:e,observations:e.data,panel:r}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,d.jsx)(xe,{layer:e,observations:[r.observation],panel:t,state:"hovered"}),renderHoverCompanions:()=>null}),G=4,dr=1,hr=.82,ve=3,cr=.28,ur={run:[16,60],skip:[2,7]},gr=50,xr=({layer:e,observation:r,seedKey:t,panel:a,state:n})=>{const i=I(e),s=fe("cell"),h=(0,o.getPaintedTileRect)(r);if(h===null)return null;const l=i(r,n),u=h.x*a.width+G/2,g=h.y*a.height+G/2,x=h.width*a.width-G,c=h.height*a.height-G;if(x<=0||c<=0)return null;const v=k(t),p=O(v),f=_([{x:u,y:g},{x:u+x,y:g},{x:u+x,y:g+c},{x:u,y:g+c}],{wander:Math.min(dr,x/10,c/10),seed:v,closed:!0,cornered:!0}),P=c/ve,R=Array.from({length:ve},(E,C)=>{const Q=g+P*(C+.5),_e=p()*gr;return _([{x:u-2-_e,y:Q+(p()-.5)*2},{x:u+x+2,y:Q+(p()-.5)*2}],{wander:1.2,seed:v+C+1,step:16})}),m=n==="hovered";return(0,d.jsxs)("g",{opacity:l.opacity,children:[(0,d.jsx)("clipPath",{id:s,children:(0,d.jsx)("path",{d:f})}),(0,d.jsx)("path",{d:f,fill:l.color,fillOpacity:l.fillOpacity*hr}),(0,d.jsx)("g",{clipPath:`url(#${s})`,fill:"none",stroke:l.color,strokeOpacity:cr,children:R.map((E,C)=>(0,d.jsx)("path",{d:E,strokeWidth:P*.8,strokeDasharray:T(ur,v+C)},C))}),m&&(0,d.jsx)(w,{path:f,color:l.edge,width:l.edgeWidth,seed:v})]})},ye=({layer:e,observations:r,panel:t,state:a})=>{const n=(0,M.useMemo)(()=>(0,o.createStableCellKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return t.width<=0||t.height<=0?null:(0,d.jsx)("g",{"data-geom":"tile",children:Array.from(r,i=>{const s=n(i);return(0,d.jsx)(xr,{layer:e,observation:i,seedKey:s,panel:t,state:a},s)})})},vr=(0,o.defineGeomRenderer)("tile",{coord:"cartesian",guideMode:null,swatchShape:"square",render:({layer:e,panelRect:r})=>(0,d.jsx)(ye,{layer:e,observations:e.data,panel:r}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,d.jsx)(ye,{layer:e,observations:[r.observation],panel:t,state:"hovered"}),renderHoverCompanions:()=>null}),yr=[$t,lr,vr,Nt,Gt,ft,mt,Vt,qt],pr=.3,fr=2,Re=1.5,mr=.8,Sr=7.5,Ar=3.8,kr=.55,wr=e=>{const r=(0,o.useGeomPanelSize)();if(r===null)return null;const t=e.map(([a,n])=>(0,o.readPositionPixels)(a,n==="x"?r.width:r.height));return t.every(a=>a!==null)?t:null},Er=({fill:e,fillOpacity:r,...t})=>(0,d.jsx)(o.DefaultGeomCircle,{...t,fill:e,fillOpacity:pr,stroke:e,strokeWidth:fr}),Rr=e=>{const r=(0,o.useGeomPanelSize)(),t=r===null?null:(0,o.readRectPixels)(e,r);if(t===null||e.fill===void 0)return(0,d.jsx)(o.DefaultGeomRect,{...e});const{x:a,y:n,width:i,height:s}=t;if(i<=0||s<=0)return null;const h=i>s;return(0,d.jsx)("g",{"data-testid":e["data-testid"],children:(0,d.jsx)(ke,{rect:t,color:e.fill,opacity:e.opacity??1,pressure:e.fillOpacity??1,edge:e.fill,edgeWidth:e.strokeWidth||Re,angle:j(e.fill)+(h?Math.PI/2:0),seed:k([a,n].map(A).join(","))})})},_r=e=>{const r=wr([[e.x1,"x"],[e.y1,"y"],[e.x2,"x"],[e.y2,"y"]]);if(r===null||e.stroke===void 0||e.strokeDasharray!==void 0)return(0,d.jsx)(o.DefaultGeomLine,{...e});if(!e.strokeWidth)return null;const[t=0,a=0,n=0,i=0]=r,s=k(r.map(A).join(",")),h=_([{x:t,y:a},{x:n,y:i}],{wander:mr,seed:s});return(0,d.jsx)("g",{"data-testid":e["data-testid"],children:(0,d.jsx)(w,{path:h,color:e.stroke,width:e.strokeWidth,seed:s,opacity:e.strokeOpacity})})},Pr=e=>{const r=(e.match(/-?\d*\.?\d+(?:e-?\d+)?/giu)??[]).map(Number),t=r.filter((s,h)=>h%2===0),a=r.filter((s,h)=>h%2===1);if(t.length===0||a.length===0)return null;const n=Math.min(...t),i=Math.min(...a);return{x:n,y:i,width:Math.max(...t)-n,height:Math.max(...a)-i}},Cr=e=>{const r=Pr(e.d);if(r===null||e.fill===void 0||e.fill.startsWith("url("))return(0,d.jsx)(o.DefaultGeomPath,{...e});const t=k(e.d);return(0,d.jsxs)("g",{"data-testid":e["data-testid"],opacity:e.opacity??1,children:[(0,d.jsx)(U,{region:e.d,bounds:r,color:e.fill,angle:j(e.fill),spacing:Sr,width:Ar,seed:t,pressure:e.fillOpacity??1}),(0,d.jsx)(w,{path:e.d,color:e.fill,width:e.strokeWidth||Re,seed:t,opacity:kr})]})},Mr={Circle:Er,Line:_r,Rect:Rr,Path:Cr},Hr={name:"chalkboard",styles:ze,palettes:{categorical:pe,sequential:We,diverging:Ne},config:{axes:{y:{position:"left"}},legend:{position:"top",align:"start"}},colorScheme:"dark",plugins:yr,shapes:Mr};exports.chalkboard=Hr;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let I=require("react"),i=require("@graphysdk/react"),s=require("react/jsx-runtime");var be=/[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu,Ge=/^[a-zA-Z]$/u,We=(e,r)=>e==="H"?"x":e==="V"?"y":r%2===0?"x":"y",V=(e,r)=>{let t="",a=0;return(e.match(be)??[]).map(n=>{if(Ge.test(n))return t=n.toUpperCase(),a=0,n;const o=We(t,a);return a+=1,String(Number(n)*(o==="x"?r.width:r.height))}).join(" ")},se=(e,r)=>{const t=(0,i.getX)(e),a=(0,i.getY)(e)??(0,i.getYMax)(e);return t===null||a===null?null:{x:(0,i.toViewBoxX)(t)*r.width,y:(0,i.toViewBoxY)(a)*r.height}},J=(e,r)=>{const t=(0,i.getX)(e),a=(0,i.getY)(e)??(0,i.getRadiusExtent)(e).outerRadius;if(t===null||a===null)return null;const n=(0,i.polarToUnit)(t,a),o=Math.min(r.width,r.height)/2;return{x:r.width/2+n.x*o,y:r.height/2-n.y*o}},_e=e=>({x:0,y:0,width:e.width,height:e.height}),Ne=e=>`${e.map((r,t)=>`${t===0?"M":"L"}${r.x},${r.y}`).join(" ")} Z`;var Be=34,te=8,B=72,ge=11,F=6,Fe=(e,r,t)=>`<svg x="${e}" y="${r}" width="1" height="1" overflow="visible">${t}</svg>`,Ke=({wood:e,woodLight:r,woodDark:t})=>{const a=(n,o,l,h=1)=>`<rect x="${n}" y="${n}" rx="3" style="width:calc(100% - ${n*2}px);height:calc(100% - ${n*2}px)" fill="none" stroke="${l}" stroke-width="${o}" stroke-opacity="${h}"/>`;return a(8/2,8,e)+a(.5,1,t)+a(8-.5,1,r,.7)+a(9,2,"#000000",.18)},Ue=({wood:e,woodLight:r,woodDark:t,dust:a})=>`<svg x="0" y="100%" width="100%" height="1" overflow="visible"><rect x="0" y="-13" width="100%" height="13" fill="${e}"/><rect x="0" y="-13" width="100%" height="1.5" fill="${r}"/><rect x="0" y="-1" width="100%" height="1" fill="${t}"/><rect x="12" y="-13" style="width:calc(100% - 24px)" height="1.5" fill="${a}" fill-opacity="0.45"/></svg>`,ze=({wood:e,woodDark:r,felt:t,dust:a,chalks:n})=>{let l=-34-B;return`<rect x="${l}" y="${-13-F}" width="${B}" height="${F}" rx="1" fill="${t}"/><rect x="${l+1}" y="${-13-F}" width="${B-2}" height="1.5" fill="${a}" fill-opacity="0.35"/><rect x="${l}" y="${-13-F-ge}" width="${B}" height="${ge}" rx="2.5" fill="${e}" stroke="${r}" stroke-width="0.75"/>`+n.map((h,u)=>{const c=Be-u*6;return l-=c+14,`<rect x="${l}" y="${-13-te}" width="${c}" height="${te}" rx="${te/2}" fill="${h}"/><rect x="${l+2}" y="-20" width="${c-4}" height="1.2" fill="#FFFFFF" fill-opacity="0.35"/>`}).join("")},Xe=e=>`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">'+Ke(e)+Ue(e)+Fe("100%","100%",ze(e))+"</svg>")}`,y={board:"#27362F",wiped:"#1F2C26",chalk:"#F4F1E8",dusty:"#C9D1C8",grid:"rgba(244, 241, 232, 0.24)",edge:"rgba(244, 241, 232, 0.45)",axis:"rgba(244, 241, 232, 0.85)",wood:"#86643F",woodLight:"#A88456",woodDark:"#4F3923",felt:"#5E5A55"},Ve="'Gochi Hand', 'Comic Sans MS', cursive",E={white:"#F4F1E8",yellow:"#F7DC6F",pink:"#F49AC2",blue:"#8FD3F4",green:"#A8E6A1",orange:"#F9A65A",red:"#F07A6A"},Oe=[E.white,E.yellow,E.pink,E.blue,E.green,E.orange],Ye=["#668F99",E.blue,E.white],qe=[E.blue,"#323F39",E.orange],Ze=(e,r)=>`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 ${e} ${e}">${r}</svg>`)}`,K=480,Je={image:Ze(K,`<filter id="smear" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency="0.004 0.021" numOctaves="4" seed="11" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 0.96 0 0 0 0 0.95 0 0 0 0 0.91 0.3 0 0 0 -0.1"/></filter><rect width="${K}" height="${K}" filter="url(#smear)"/>`),size:K,aspectRatio:1,fallback:y.board},Qe={image:Xe({wood:y.wood,woodLight:y.woodLight,woodDark:y.woodDark,felt:y.felt,dust:y.chalk,chalks:[E.white,E.yellow,E.pink]}),fit:"stretch",fallback:"transparent"},U=22,et=6,tt=.82,pe=2.4,$={fontWeight:400,textColor:y.chalk},L={fontWeight:400,textColor:y.dusty},xe={dashArray:[],lineCap:"round",lineJoin:"round"},z={...$,fontSize:16,textOutlineColor:y.board,textOutlineWidth:4,fill:"transparent",stroke:"transparent",strokeWidth:0,cornerRadius:0,paddingInline:3,paddingBlock:0,shadow:"none"},rt={tokens:{graphBackground:y.board,graphBorder:y.edge,geomBorder:y.axis,textPrimary:y.chalk,textSecondary:y.dusty,ruleLine:y.chalk,gridLine:y.grid,hoverStroke:y.board,hoverGuideFill:"rgba(244, 241, 232, 0.07)",hoverGuideLine:y.edge,tooltipBackground:y.wiped,tooltipBorder:y.edge,tooltipPrimaryRow:"rgba(244, 241, 232, 0.1)",annotationShape:E.yellow,annotationArrow:y.chalk,differenceLabelBackground:y.wiped,trendPositive:E.green,trendNegative:E.red,trendNeutral:y.dusty},defaults:[i.style.graph({fill:Je,overpaint:Qe,strokeWidth:0,cornerRadius:4,fontFamily:Ve,padding:{top:U,right:U,bottom:U+13+et,left:U}}),i.style.geom({shadow:"none",fillAlpha:tt}),i.style.geom({shadow:"none"},{state:"hovered"}),i.style.geom.bar({stroke:y.chalk,strokeWidth:pe,cornerRadius:2}),i.style.geom.bar({fillAlpha:1,stroke:y.chalk,strokeWidth:3,shadow:"none"},{state:"hovered"}),i.style.geom.line({strokeWidth:4,fillAlpha:0,...xe}),i.style.geom.area({fillAlpha:.72,strokeWidth:3,...xe}),i.style.geom.point({fillAlpha:1,size:14,stroke:y.board,strokeWidth:2}),i.style.geom.tile({fillAlpha:.9,cornerRadius:2,stroke:y.board,strokeWidth:3}),i.style.geom.tile({fillAlpha:1,stroke:y.chalk,strokeWidth:pe},{state:"hovered"}),i.style.geom.rule({strokeWidth:2.5,dashArray:[2,7],lineCap:"round"}),i.style.geom.rule.label({...$,fontSize:15}),i.style.gridLine({dashArray:[7,7]}),i.style.gridLine.y({strokeWidth:1.5}),i.style.panelBorder({strokeWidth:0}),i.style.axisLine({stroke:y.axis,strokeWidth:2.5,dashArray:[],lineCap:"round",cornerRadius:6}),i.style.tickLine({strokeWidth:0}),i.style.tickLabel({...L,fontSize:15,lineHeight:1}),i.style.axisLabel({...L,fontSize:16,lineHeight:1}),i.style.heading({...$}),i.style.heading.h1({fontSize:27,lineHeight:1}),i.style.heading.h2({...L,fontSize:18,lineHeight:1.1}),i.style.header({margin:{bottom:16}}),i.style.caption({...L,fontSize:14}),i.style.source({...L,fontSize:14}),i.style.dataLabel({...$,fontSize:15,lineHeight:1,fill:"transparent",paddingBlock:1,paddingInline:3}),i.style.dataLabel.observation.inside({textOutlineColor:y.board,textOutlineWidth:3.5}),i.style.dataLabel.category.inside({textOutlineColor:y.board,textOutlineWidth:3.5}),i.style.legendItem({...$,fontSize:16,fill:"transparent",stroke:"transparent"}),i.style.directLabel({fontWeight:400,fontSize:16}),i.style.tooltip({strokeWidth:2,cornerRadius:3,paddingInline:12,paddingBlock:9,shadow:"none"}),i.style.tooltip.heading({...$,fontSize:17,lineHeight:1.15}),i.style.tooltip.label({...L,fontSize:15,lineHeight:1.25}),i.style.tooltip.value({...$,fontSize:15,lineHeight:1.25}),i.style.annotation.text({...z,paddingInline:6,paddingBlock:2,fontSize:17,lineHeight:1.15}),i.style.annotation.pinnedNumber({fill:y.chalk,stroke:y.board}),i.style.annotation.pinnedNumber.label({...z}),i.style.annotation.comment({fill:y.chalk,stroke:y.board}),i.style.annotation.comment.label({...z}),i.style.annotation.differenceArrow({stroke:y.chalk,strokeWidth:2.5}),i.style.annotation.differenceArrow.label({...z}),i.style.annotation.arrow({stroke:y.chalk,strokeWidth:3,dashArray:[]}),i.style.annotation.shape({fill:y.chalk,fillAlpha:.1,strokeWidth:0}),i.style.tickLabel({textOutlineColor:y.board,textOutlineWidth:3},{coord:"polar"})]},R=e=>{let r=2166136261;for(let t=0;t<e.length;t+=1)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0},W=e=>{let r=e||1;return()=>{r=r+1831565813|0;let t=Math.imul(r^r>>>15,1|r);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}},at=e=>{const r=[.035,.07,.13].map((a,n)=>({frequency:a*(.7+e()*.6),phase:e()*Math.PI*2,weight:1/(n+1)})),t=r.reduce((a,n)=>a+n.weight,0);return a=>r.reduce((n,o)=>n+o.weight*Math.sin(a*o.frequency+o.phase),0)/t},C=(e,{wander:r,seed:t,closed:a=!1,step:n=9,cornered:o=!1})=>{if(e.length<2)return"";const l=at(W(t)),h=a?[...e,e[0]]:[...e],u=[],c=[];let p=0;for(let g=0;g<h.length-1;g+=1){const d=h[g],x=h[g+1],v=Math.hypot(x.x-d.x,x.y-d.y);if(v===0)continue;const m={x:-(x.y-d.y)/v,y:(x.x-d.x)/v},S=Math.max(1,Math.ceil(v/n)),A=[];for(let H=0;H<=S;H+=1){const k=H/S,f=r*Math.sin(Math.PI*k)*l(p+k*v);A.push({x:d.x+(x.x-d.x)*k+m.x*f,y:d.y+(x.y-d.y)*k+m.y*f})}c.push(A),u.push(...A.slice(0,-1)),p+=v}return c.length===0?"":o?`${c.map(g=>ve(g,!1)).map((g,d)=>d===0?g:g.replace(/^M/u,"L")).join(" ")}${a?" Z":""}`:(a||u.push(h[h.length-1]),ve(u,a))},nt=/M[^M]*/gu,it=/^[ML\d\s.,eE+-]+$/u,ot=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu,st=e=>{if(!it.test(e))return null;const r=(e.match(ot)??[]).map(Number),t=[];for(let a=0;a+1<r.length;a+=2)t.push({x:r[a],y:r[a+1]});return t},ne=(e,r)=>(e.match(nt)??[]).map(t=>{const a=st(t.replace(/\s*Z\s*$/u,""));return a===null||a.length<2?t:C(a,r)}).join(" "),O=e=>(Math.round(e*100)/100).toString(),ve=(e,r)=>{const t=e.length,a=h=>r?e[(h+t)%t]:e[Math.max(0,Math.min(t-1,h))],n=a(0),o=[`M${O(n.x)},${O(n.y)}`],l=r?t:t-1;for(let h=0;h<l;h+=1){const[u,c,p,g]=[a(h-1),a(h),a(h+1),a(h+2)],d={x:c.x+(p.x-u.x)/6,y:c.y+(p.y-u.y)/6},x={x:p.x-(g.x-c.x)/6,y:p.y-(g.y-c.y)/6};o.push(`C${O(d.x)},${O(d.y)} ${O(x.x)},${O(x.y)} ${O(p.x)},${O(p.y)}`)}return`${o.join(" ")}${r?" Z":""}`},lt=9,b=({run:e,skip:r},t)=>{const a=W(t),n=([o,l])=>O(o+a()*(l-o));return Array.from({length:lt},()=>`${n(e)} ${n(r)}`).join(" ")},dt=.07,ht=40,ct=(e,{angle:r,spacing:t,seed:a})=>{const n=W(a),o={x:e.x+e.width/2,y:e.y+e.height/2},l=Math.hypot(e.width,e.height)/2+t,h=[];for(let u=-l;u<=l;u+=t*(.75+n()*.5)){const c=r+(n()-.5)*Math.min(dt,t/l),p={x:Math.cos(c),y:Math.sin(c)},g={x:-Math.sin(r),y:Math.cos(r)},d={x:o.x+g.x*u,y:o.y+g.y*u},x=l+n()*ht;h.push(C([{x:d.x-p.x*x,y:d.y-p.y*x},{x:d.x+p.x*l,y:d.y+p.y*l}],{wander:1.1,seed:a+h.length+1,step:14}))}return h.join(" ")},le=(e,r,{seed:t,overshoot:a,wander:n,drift:o=0})=>{const l=W(t)()*Math.PI*2,h=Math.PI*2+a,u=Math.max(8,Math.ceil(h*r/10)),c=Array.from({length:u+1},(p,g)=>{const d=h*g/u,x=Math.max(0,d-Math.PI*2)/Math.max(a,1e-6),v=r+o*x*x,m=l+d;return{x:e.x+Math.cos(m)*v,y:e.y+Math.sin(m)*v}});return C(c,{wander:n,seed:t+1,step:6})},ut=.4,gt=.85,pt={run:[14,46],skip:[1.5,4]},xt=.35,vt={run:[1.5,6],skip:[2,7]},ye={x:.45,y:-.35},Y={x:-.6,y:.55},ie="butt",yt={run:[18,70],skip:[1.5,5]},ft={run:[1.5,4],skip:[3,9]},mt=.55,St=.16,fe=[-Math.PI/4,Math.PI/4,-Math.PI/2.6,Math.PI/2.6,-Math.PI/8,Math.PI/8],D=(e,r=0)=>{const t=Oe.indexOf(e);return fe[(t<0?r:t)%fe.length]},Ie=e=>`${e}-${(0,I.useId)().replace(/[^a-zA-Z0-9]/gu,"")}`,_=({path:e,color:r,width:t,seed:a,opacity:n=1,dash:o,cap:l="round"})=>(0,s.jsxs)("g",{opacity:n,fill:"none",stroke:r,strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:e,strokeWidth:t,strokeOpacity:ut,strokeLinecap:l,strokeDasharray:o}),(0,s.jsx)("path",{d:e,strokeWidth:o===void 0?t*gt:t,strokeDasharray:o??b(pt,a),strokeLinecap:o===void 0?ie:l,transform:`translate(${ye.x} ${ye.y})`}),o===void 0&&(0,s.jsx)("path",{d:e,strokeWidth:Math.max(.8,t*xt),strokeDasharray:b(vt,a+1),strokeLinecap:ie,transform:`translate(${Y.x} ${Y.y})`})]}),N=({region:e,bounds:r,color:t,angle:a,spacing:n,width:o,seed:l,pressure:h})=>{const u=Ie("shade"),c=ct(r,{angle:a,spacing:n,seed:l});return(0,s.jsxs)("g",{children:[(0,s.jsx)("clipPath",{id:u,children:(0,s.jsx)("path",{d:e})}),(0,s.jsx)("path",{d:e,fill:y.board,fillOpacity:mt}),(0,s.jsx)("path",{d:e,fill:t,fillOpacity:h*St}),(0,s.jsxs)("g",{clipPath:`url(#${u})`,fill:"none",stroke:t,strokeLinecap:ie,children:[(0,s.jsx)("path",{d:c,strokeWidth:o,strokeOpacity:h*.72,strokeDasharray:b(yt,l+2)}),(0,s.jsx)("path",{d:c,strokeWidth:o*.4,strokeOpacity:h,strokeDasharray:b(ft,l+3),transform:`translate(${Y.x} ${Y.y})`})]})]})},At=1.70158,wt=e=>1+2.70158*(e-1)**3+At*(e-1)**2,kt=e=>Math.sqrt(1-(e-1)**2),Et=e=>e.type==="grow"?Math.max(0,...Object.values(e.delayByKey)):0,Rt=e=>{const[r,t]=(0,I.useState)({intro:e,seconds:0});return(0,I.useEffect)(()=>{if(!e)return;const a=Et(e)+e.durationSeconds;let n=null,o=0;const l=h=>{n??=h;const u=Math.max(0,(h-n)/1e3),c=u>=a;t({intro:e,seconds:c?1/0:u}),c||(o=requestAnimationFrame(l))};return o=requestAnimationFrame(l),()=>cancelAnimationFrame(o)},[e]),e?r.intro===e?r.seconds:0:1/0},de=e=>{const r=e?.type==="grow"?e:null,t=Rt(r),a=(0,I.useCallback)(n=>{if(r===null||t===1/0)return 1;const o=r.delayByKey[n]??0,l=Math.min(1,Math.max(0,(t-o)/r.durationSeconds));return r.growAxis==="angle"?kt(l):wt(l)},[r,t]);return{plan:t===1/0?null:r,readGrowth:a}},q=(e,r,t)=>e+(r-e)*t,Q=({intro:e,children:r})=>e?.type==="wipe"?(0,s.jsx)(i.IntroWipeClip,{intro:e,children:r}):e?.type==="fade"?(0,s.jsx)(i.IntroFade,{intro:e,children:r}):r,T=e=>{const r=(0,i.useGeomStyleReader)(e);return(t,a)=>({color:(0,i.toPaintColor)(r.get("fill",t,a)),opacity:r.get("alpha",t,a),fillOpacity:r.get("fillAlpha",t,a),edge:r.get("stroke",t,a),edgeWidth:r.get("strokeWidth",t,a)})},Ce=e=>{const r=(0,i.useGeomStyleReader)(e);return(t,a)=>{const{strokeWidth:n,strokeDasharray:o,strokeLinecap:l}=(0,i.resolvePathStroke)(r.get("dashArray",t,a),r.get("strokeWidth",t,a),r.get("lineCap",t,a));return{color:r.get("stroke",t,a),opacity:r.get("alpha",t,a)*r.get("strokeAlpha",t,a),width:n,dashArray:o,lineCap:l,fillOpacity:r.get("fillAlpha",t,a)??0}}},Pt=10,_t=2.2,Ot=.5,me=(e,r)=>{const t=(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),a=[];return e.data.groupBy(i.GROUP_VARIABLES.group).forEach(n=>{const o=[...n],[l]=o,h=r(o);l===void 0||h===null||a.push({key:t(l),observation:l,path:h})}),a},It=(e,r)=>{const t=e.flatMap(a=>{const n=(0,i.getX)(a),o=J(a,r);return n===null||o===null?[]:[{angle:n,point:o}]}).sort((a,n)=>a.angle-n.angle).map(({point:a})=>a);return t.length===0?null:Ne(t)},he=({geom:e,observation:r,panel:t,project:a,color:n,opacity:o,radius:l=Pt})=>{const h=a(r,t);return h===null?null:(0,s.jsx)("g",{"data-geom":e,children:(0,s.jsx)(_,{path:le(h,l,{seed:19,overshoot:Ot,wander:.5}),color:n,width:_t,seed:23,opacity:o})})},Se=1.3,Ct=3.2,Ht=8,G=({layer:e,coordSystem:r,panel:t,only:a,state:n})=>{const o=T(e),l=(0,i.useGeomStyleReader)(e),h=(0,I.useMemo)(()=>{if(r===void 0)return me(e,d=>It(d,t)).map(d=>({...d,fill:d.path,edge:ne(d.path,{wander:Se,seed:R(d.key),closed:!0})}));const{areaGenerator:c,lineGenerator:p}=(0,i.createAreaPathGenerators)(r,e.params),g=new Map;return me(e,d=>{const x=(0,i.prepareAreaObservations)(d,e.params.missingValues),v=c(x),m=p(x);if(!v)return null;const S=V(v,t);return m&&g.set(S,V(m,t)),S}).map(d=>({...d,fill:d.path,edge:ne(g.get(d.path)??"",{wander:Se,seed:R(d.key)})}))},[e,r,t]);if(t.width<=0||t.height<=0)return null;const u=a===void 0?null:new Set(Array.from(a,i.getGroup));return(0,s.jsx)("g",{"data-geom":"area",children:h.map(({key:c,observation:p,fill:g,edge:d},x)=>{if(u!==null&&!u.has((0,i.getGroup)(p)))return null;const v=o(p,n),m=R(c),S=(0,i.resolvePathStroke)(l.get("dashArray",p,n),v.edgeWidth,l.get("lineCap",p,n));return(0,s.jsxs)("g",{opacity:v.opacity,children:[(0,s.jsx)(N,{region:g,bounds:_e(t),color:v.color,angle:D(v.color,x),spacing:Ht,width:Ct,seed:m,pressure:v.fillOpacity}),d!==""&&(0,s.jsx)(_,{path:d,color:v.color,width:S.strokeWidth,seed:m,dash:S.strokeDasharray,cap:S.strokeLinecap})]},c)})})},He=({layer:e,coordSystem:r,observation:t,panel:a,project:n})=>{const o=T(e)(t,"hovered");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(G,{layer:e,coordSystem:r,panel:a,only:[t],state:"hovered"}),(0,s.jsx)(he,{geom:"area",observation:t,panel:a,project:n,color:o.color,opacity:o.opacity})]})},Mt=(0,i.defineGeomRenderer)("area",{coord:"cartesian",guideMode:"crosshair",swatchShape:"area",render:({layer:e,coordSystem:r,panelRect:t,intro:a})=>r.type!=="cartesian"?null:(0,s.jsx)(Q,{intro:a,children:(0,s.jsx)(G,{layer:e,coordSystem:r,panel:t})}),renderHover:({layer:e,coordSystem:r,primary:t,panelRect:a})=>{if(r.type!=="cartesian")return null;const n=t.anchored?(o,l)=>({x:(0,i.toViewBoxX)(t.x)*l.width,y:(0,i.toViewBoxY)(t.y)*l.height}):se;return(0,s.jsx)(He,{layer:e,coordSystem:r,observation:t.observation,panel:a,project:n})},renderHighlight:({layer:e,sourceLayer:r,coordSystem:t,panelRect:a})=>t.type!=="cartesian"?null:(0,s.jsx)(G,{layer:r,coordSystem:t,panel:a,only:e.data}),renderHoverCompanions:()=>null,getEditOutlineShapes:e=>(0,i.getBuiltInEditOutlineShapes)("area","cartesian",e)}),jt=(0,i.defineGeomRenderer)("area",{coord:"polar",guideMode:"crosshair",swatchShape:"area",render:({layer:e,panelRect:r,intro:t})=>(0,s.jsx)(Q,{intro:t,children:(0,s.jsx)(G,{layer:e,panel:r})}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,s.jsx)(He,{layer:e,observation:r.observation,panel:t,project:J}),renderHighlight:({layer:e,sourceLayer:r,panelRect:t})=>(0,s.jsx)(G,{layer:r,panel:t,only:e.data}),renderHoverCompanions:()=>null,getEditOutlineShapes:e=>(0,i.getBuiltInEditOutlineShapes)("area","polar",e)}),$t=1.6,Tt=.55,Lt=.6,Dt=3.8,oe=7.5,bt=.55,Gt=3,Wt={solo:{base:!0,value:!0},floor:{base:!0,value:!1},ceiling:{base:!1,value:!0},middle:{base:!1,value:!1}},Nt={top:"bottom",bottom:"top",left:"right",right:"left"},Bt=(e,r)=>r==="x"?((0,i.getYMax)(e)??(0,i.getY)(e)??0)>=((0,i.getYMin)(e)??0)?"top":"bottom":((0,i.getXMax)(e)??0)>=((0,i.getXMin)(e)??0)?"right":"left",Ft=(e,r,t)=>{const a=Math.max(0,e.width-t),n=Math.max(0,e.height-t);return r==="top"?{...e,y:e.y+e.height-n,height:n}:r==="bottom"?{...e,height:n}:r==="left"?{...e,x:e.x+e.width-a,width:a}:{...e,width:a}},Kt=e=>[{x:e.x,y:e.y+e.height},{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height}],Ut=({layer:e,observation:r,bounds:t,seedKey:a,mainAxis:n,panel:o,state:l})=>{const h=T(e);if(!t||t.width<=0||t.height<=0)return null;const u=h(r,l),c=Wt[(0,i.getStackRole)(r)],p=Bt(r,n),g={x:t.x*o.width,y:t.y*o.height,width:t.width*o.width,height:t.height*o.height},d=[c.value?[]:[p],c.base?[]:[Nt[p]]].flat().reduce((v,m)=>Ft(v,m,Gt/2),g);if(d.width<=0||d.height<=0)return null;const x=l==="hovered";return(0,s.jsx)(Me,{rect:d,color:u.color,opacity:u.opacity,pressure:u.fillOpacity,edge:x?u.edge:u.color,edgeWidth:u.edgeWidth,angle:D(u.color)+(n==="x"?0:Math.PI/2),spacing:x?oe*bt:oe,seed:R(a)})},Me=({rect:e,color:r,opacity:t,pressure:a,edge:n,edgeWidth:o,angle:l,spacing:h=oe,seed:u})=>{const c=Kt(e),p=Math.min($t,e.width/10,e.height/10),g=C(c,{wander:p,seed:u,closed:!0,cornered:!0}),d=C(c,{wander:p,seed:u+7,closed:!0,cornered:!0});return(0,s.jsxs)("g",{opacity:t,children:[(0,s.jsx)(N,{region:g,bounds:e,color:r,angle:l,spacing:h,width:Dt,seed:u,pressure:a}),(0,s.jsx)(_,{path:g,color:n,width:o,seed:u}),(0,s.jsx)(_,{path:d,color:r,width:o*Lt,seed:u+3,opacity:Tt})]})},zt=(e,r,t,a)=>{const n=r==="x",o=n?e.y:e.x,l=n?e.height:e.width,h=q(t,o,a),u=q(t,o+l,a),c={start:Math.min(h,u),span:Math.abs(u-h)};return n?{...e,y:c.start,height:c.span}:{...e,x:c.start,width:c.span}},Ae=({layer:e,observations:r,mainAxis:t,panel:a,state:n,intro:o})=>{const{plan:l,readGrowth:h}=de(o),u=(0,I.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]),c=(0,i.useGeomStyleReader)(e),p=(0,I.useMemo)(()=>(0,i.createBarBoundsReader)(e,t,c,a),[e,t,c,a]);return a.width<=0||a.height<=0?null:(0,s.jsx)("g",{"data-geom":"bar",children:Array.from(r,g=>{const d=u(g),x=p(g),v=x!==null&&l!==null?zt(x,t,l.baseline,h(d)):x;return(0,s.jsx)(Ut,{layer:e,observation:g,bounds:v,seedKey:d,mainAxis:t,panel:a,state:n},d)})})},Xt=(0,i.defineGeomRenderer)("bar",{coord:"cartesian",guideMode:"band",swatchShape:"square",render:({layer:e,coordSystem:r,panelRect:t,intro:a})=>(0,s.jsx)(Ae,{layer:e,observations:e.data,mainAxis:(0,i.readMainAxis)(r),panel:t,intro:a}),renderHover:({layer:e,coordSystem:r,primary:t,panelRect:a})=>(0,s.jsx)(Ae,{layer:e,observations:[t.observation],mainAxis:(0,i.readMainAxis)(r),panel:a,state:"hovered"}),renderHoverCompanions:()=>null,getEditOutlineShapes:e=>(0,i.getBuiltInEditOutlineShapes)("bar","cartesian",e)}),we=1.3,Vt=3.2,Yt=8,qt=(e,r,t,a)=>{const n=(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),o=(0,i.createLinePathGenerator)(e.params),l=(p,g,d)=>{if(t==="polar")return C(g,{wander:we,seed:d,closed:!0});const x=o((0,i.prepareLineObservations)(p,e.params.missingValues));return x?ne(V(x,r),{wander:we,seed:d}):""},h=(0,i.createLineFillAreaGenerator)(e.params),u=p=>{if(t==="polar")return null;const g=h((0,i.prepareLineObservations)(p,e.params.missingValues));return g?V(g,r):null},c=[];return e.data.groupBy(i.GROUP_VARIABLES.group).forEach(p=>{const g=[...p],[d]=g;if(d===void 0)return;const x=t==="polar"?g.sort((S,A)=>((0,i.getX)(S)??0)-((0,i.getX)(A)??0)):g,v=x.flatMap(S=>{const A=a(S,r);return A===null?[]:[A]});if(v.length<2)return;const m=n(d);c.push({key:m,observation:d,stroke:l(x,v,R(m)),fill:u(x)})}),c},je=({layer:e,panel:r,coord:t,project:a,hovered:n})=>{const o=Ce(e),l=(0,I.useMemo)(()=>qt(e,r,t,a),[e,r,t,a]);if(r.width<=0||r.height<=0)return null;const h=n===void 0?void 0:"hovered",u=n===void 0?l:l.filter(({observation:c})=>(0,i.getGroup)(c)===(0,i.getGroup)(n));return(0,s.jsxs)("g",{"data-geom":"line",children:[u.map(({key:c,observation:p,fill:g},d)=>{const x=o(p);return g===null||x.fillOpacity<=0||n!==void 0?null:(0,s.jsx)("g",{opacity:x.opacity,"data-fill":!0,children:(0,s.jsx)(N,{region:g,bounds:_e(r),color:x.color,angle:D(x.color,d),spacing:Yt,width:Vt,seed:R(c),pressure:x.fillOpacity})},`${c}-fill`)}),u.map(({key:c,observation:p,stroke:g})=>{const d=o(p,h);return(0,s.jsx)("g",{opacity:d.opacity,children:(0,s.jsx)(_,{path:g,color:d.color,width:d.width,seed:R(c),dash:d.dashArray,cap:d.lineCap})},c)})]})},Zt=({layer:e,observation:r,panel:t,coord:a,project:n})=>{const o=Ce(e)(r,"hovered");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(je,{layer:e,panel:t,coord:a,project:n,hovered:r}),(0,s.jsx)(he,{geom:"line",observation:r,panel:t,project:n,color:o.color,opacity:o.opacity})]})},$e=(e,r)=>(0,i.defineGeomRenderer)("line",{coord:e,guideMode:"crosshair",swatchShape:"line",render:({layer:t,panelRect:a,intro:n})=>(0,s.jsx)(Q,{intro:n,children:(0,s.jsx)(je,{layer:t,panel:a,coord:e,project:r})}),renderHover:({layer:t,primary:a,panelRect:n})=>(0,s.jsx)(Zt,{layer:t,observation:a.observation,panel:n,coord:e,project:r}),renderHoverCompanions:()=>null,getEditOutlineShapes:t=>(0,i.getBuiltInEditOutlineShapes)("line",e,t),getOverlayAnchor:({observation:t})=>{const a=(0,i.getX)(t),n=(0,i.getY)(t);return a===null||n===null?null:{x:a,y:n}}}),Jt=$e("cartesian",se),Qt=$e("polar",J),er=.35,tr=.35,rr=.3,ar=5,Te=({layer:e,observations:r,panel:t,project:a,state:n,intro:o})=>{const l=(0,i.useGeomStyleReader)(e),{readGrowth:h}=de(o),u=T(e),c=(0,I.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return(0,s.jsx)("g",{"data-geom":"point",children:Array.from(r,p=>{const g=a(p,t);if(g===null)return null;const d=c(p),x=R(d),v=u(p,n),m=l.get("size",p,n)/2*h(d);return m<=0?null:(0,s.jsxs)("g",{opacity:v.opacity,children:[(0,s.jsx)("circle",{cx:g.x,cy:g.y,r:m,fill:v.color,fillOpacity:v.fillOpacity*rr}),(0,s.jsx)(_,{path:le(g,m,{seed:x,overshoot:tr,wander:er}),color:v.color,width:v.edgeWidth,seed:x+1})]},d)})})},nr=({layer:e,observation:r,panel:t,project:a})=>{const n=T(e)(r,"hovered"),o=(0,i.useGeomStyleReader)(e).get("size",r,"hovered");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Te,{layer:e,observations:[r],panel:t,project:a,state:"hovered"}),(0,s.jsx)(he,{geom:"point",observation:r,panel:t,project:a,color:n.color,opacity:n.opacity,radius:o/2+ar})]})},Le=(e,r)=>(0,i.defineGeomRenderer)("point",{coord:e,swatchShape:"circle",render:({layer:t,panelRect:a,intro:n})=>(0,s.jsx)(Te,{layer:t,observations:t.data,panel:a,project:r,intro:n}),renderHover:({layer:t,primary:a,panelRect:n})=>(0,s.jsx)(nr,{layer:t,observation:a.observation,panel:n,project:r}),renderHoverCompanions:()=>null,getEditOutlineShapes:t=>(0,i.getBuiltInEditOutlineShapes)("point",e,t)}),ir=Le("cartesian",se),or=Le("polar",J),sr=Math.PI/40,lr=1.2,dr=3.4,ke=8,hr=.55,cr=3,ur=.42,gr=5,pr=1.1,xr=1.25,vr=.92,Z=(e,r,t)=>{const a=(0,i.polarToUnit)(r,1);return{x:e.width/2+a.x*t,y:e.height/2-a.y*t}},Ee=(e,r,t,a)=>{const n=Math.max(1,Math.ceil(Math.abs(t-r)/sr));return Array.from({length:n+1},(o,l)=>Z(e,r+(t-r)*l/n,a))},re=(e,r,t,a,n)=>{const o=(0,i.getAngleExtent)(e),l=(0,i.getRadiusExtent)(e),h=P=>n?.plan.growAxis==="angle"?q(n.plan.baseline,P,n.growth):P,u=P=>n?.plan.growAxis==="radius"?q(n.plan.baseline,P,n.growth):P;if(o.startAngle===null||o.endAngle===null||l.innerRadius===null||l.outerRadius===null)return null;const c=h(o.startAngle),p=h(o.endAngle),g=u(l.innerRadius),d=u(l.outerRadius),x=Math.min(t.width,t.height)/2,v=d*x,m=g*x;if(v<=0)return null;const S=Math.max(0,p-c),A=S>=2*Math.PI-1e-6?0:Math.min(a/2/v,S/4),H=c+A,k=p-A,f=Ee(t,H,k,v),w=m>0?Ee(t,k,H,m):[Z(t,0,0)],M=[...f,...w];return{key:r,observation:e,region:`${M.map((P,ee)=>`${ee===0?"M":"L"}${P.x},${P.y}`).join(" ")} Z`,outline:C(M,{wander:lr,seed:R(r),closed:!0,step:12}),bounds:{x:t.width/2-v,y:t.height/2-v,width:v*2,height:v*2},startAngle:c,inner:m,outer:v}},yr=e=>e.length>1&&e.every(({inner:r,outer:t})=>Math.abs(t-(e[0]?.outer??0))<.5&&Math.abs(r-(e[0]?.inner??0))<.5),ae=({layer:e,observations:r,panel:t,state:a,sourceObservations:n,intro:o})=>{const l=T(e),{plan:h,readGrowth:u}=de(o),c=(0,I.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);if(t.width<=0||t.height<=0)return null;const p=a==="hovered",g=Array.from(r,f=>({key:c(f),observation:f})),d=f=>h===null?void 0:{plan:h,growth:u(f)},x=g.flatMap(({key:f,observation:w})=>re(w,f,t,0,d(f))??[]),v=n===void 0?x:[...n].flatMap(f=>re(f,c(f),t,0)??[]),m=!p&&yr(v),S=m&&n===void 0,A=m?x:g.flatMap(({key:f,observation:w})=>re(w,f,t,cr,d(f))??[]),H={x:t.width/2,y:t.height/2},k=A[0]===void 0?null:l(A[0].observation,a);return(0,s.jsxs)("g",{"data-geom":"bar",children:[A.map(({key:f,observation:w,region:M,outline:P,bounds:ee},ce)=>{const j=l(w,a),ue=R(f);return(0,s.jsxs)("g",{opacity:j.opacity,children:[(0,s.jsx)(N,{region:M,bounds:ee,color:j.color,angle:D(j.color,ce)+(ce%2===0?0:Math.PI/2),spacing:p?ke*hr:ke,width:dr,seed:ue,pressure:j.fillOpacity}),!m&&(0,s.jsx)(_,{path:P,color:p?j.edge:j.color,width:j.edgeWidth,seed:ue})]},f)}),S&&k!==null&&(0,s.jsxs)("g",{children:[A.map(({key:f,startAngle:w,inner:M,outer:P})=>(0,s.jsx)(_,{path:C([Z(t,w,M),Z(t,w,P)],{wander:.8,seed:R(f)+5,step:14}),color:k.edge,width:k.edgeWidth*vr,seed:R(f)+6},f)),[A[0]?.outer??0,A[0]?.inner??0].filter(f=>f>0).map((f,w)=>(0,s.jsx)(_,{path:le(H,f,{seed:31+w*17,overshoot:ur,wander:pr,drift:w===0?gr:-5}),color:k.edge,width:k.edgeWidth*xr,seed:41+w},f))]})]})},fr=(0,i.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:e,panelRect:r,intro:t})=>(0,s.jsx)(ae,{layer:e,observations:e.data,panel:r,intro:t}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,s.jsx)(ae,{layer:e,observations:[r.observation],panel:t,state:"hovered"}),renderHighlight:({layer:e,sourceLayer:r,panelRect:t})=>(0,s.jsx)(ae,{layer:e,observations:e.data,panel:t,sourceObservations:r.data}),renderHoverCompanions:()=>null,getEditOutlineShapes:e=>(0,i.getBuiltInEditOutlineShapes)("bar","polar",e)}),X=4,mr=1,Sr=.82,Re=3,Ar=.28,wr={run:[16,60],skip:[2,7]},kr=50,Er=({layer:e,observation:r,seedKey:t,panel:a,state:n})=>{const o=T(e),l=Ie("cell"),h=(0,i.getPaintedTileRect)(r);if(h===null)return null;const u=o(r,n),c=h.x*a.width+X/2,p=h.y*a.height+X/2,g=h.width*a.width-X,d=h.height*a.height-X;if(g<=0||d<=0)return null;const x=R(t),v=W(x),m=C([{x:c,y:p},{x:c+g,y:p},{x:c+g,y:p+d},{x:c,y:p+d}],{wander:Math.min(mr,g/10,d/10),seed:x,closed:!0,cornered:!0}),S=d/Re,A=Array.from({length:Re},(k,f)=>{const w=p+S*(f+.5),M=v()*kr;return C([{x:c-2-M,y:w+(v()-.5)*2},{x:c+g+2,y:w+(v()-.5)*2}],{wander:1.2,seed:x+f+1,step:16})}),H=n==="hovered";return(0,s.jsxs)("g",{opacity:u.opacity,children:[(0,s.jsx)("clipPath",{id:l,children:(0,s.jsx)("path",{d:m})}),(0,s.jsx)("path",{d:m,fill:u.color,fillOpacity:u.fillOpacity*Sr}),(0,s.jsx)("g",{clipPath:`url(#${l})`,fill:"none",stroke:u.color,strokeOpacity:Ar,children:A.map((k,f)=>(0,s.jsx)("path",{d:k,strokeWidth:S*.8,strokeDasharray:b(wr,x+f)},f))}),H&&(0,s.jsx)(_,{path:m,color:u.edge,width:u.edgeWidth,seed:x})]})},Pe=({layer:e,observations:r,panel:t,state:a})=>{const n=(0,I.useMemo)(()=>(0,i.createStableCellKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return t.width<=0||t.height<=0?null:(0,s.jsx)("g",{"data-geom":"tile",children:Array.from(r,o=>{const l=n(o);return(0,s.jsx)(Er,{layer:e,observation:o,seedKey:l,panel:t,state:a},l)})})},Rr=(0,i.defineGeomRenderer)("tile",{coord:"cartesian",guideMode:null,swatchShape:"square",render:({layer:e,panelRect:r,intro:t})=>(0,s.jsx)(Q,{intro:t,children:(0,s.jsx)(Pe,{layer:e,observations:e.data,panel:r})}),renderHover:({layer:e,primary:r,panelRect:t})=>(0,s.jsx)(Pe,{layer:e,observations:[r.observation],panel:t,state:"hovered"}),renderHoverCompanions:()=>null,getEditOutlineShapes:e=>(0,i.getBuiltInEditOutlineShapes)("tile","cartesian",e)}),Pr=[Xt,fr,Rr,Jt,Qt,Mt,jt,ir,or],_r=.3,Or=2,De=1.5,Ir=.8,Cr=7.5,Hr=3.8,Mr=.55,jr=e=>{const r=(0,i.useGeomPanelSize)();if(r===null)return null;const t=e.map(([a,n])=>(0,i.readPositionPixels)(a,n==="x"?r.width:r.height));return t.every(a=>a!==null)?t:null},$r=({fill:e,fillOpacity:r,...t})=>(0,s.jsx)(i.DefaultGeomCircle,{...t,fill:e,fillOpacity:_r,stroke:e,strokeWidth:Or}),Tr=e=>{const r=(0,i.useGeomPanelSize)(),t=r===null?null:(0,i.readRectPixels)(e,r);if(t===null||e.fill===void 0)return(0,s.jsx)(i.DefaultGeomRect,{...e});const{x:a,y:n,width:o,height:l}=t;if(o<=0||l<=0)return null;const h=o>l;return(0,s.jsx)("g",{"data-testid":e["data-testid"],children:(0,s.jsx)(Me,{rect:t,color:e.fill,opacity:e.opacity??1,pressure:e.fillOpacity??1,edge:e.fill,edgeWidth:e.strokeWidth||De,angle:D(e.fill)+(h?Math.PI/2:0),seed:R([a,n].map(O).join(","))})})},Lr=e=>{const r=jr([[e.x1,"x"],[e.y1,"y"],[e.x2,"x"],[e.y2,"y"]]);if(r===null||e.stroke===void 0||e.strokeDasharray!==void 0)return(0,s.jsx)(i.DefaultGeomLine,{...e});if(!e.strokeWidth)return null;const[t=0,a=0,n=0,o=0]=r,l=R(r.map(O).join(",")),h=C([{x:t,y:a},{x:n,y:o}],{wander:Ir,seed:l});return(0,s.jsx)("g",{"data-testid":e["data-testid"],children:(0,s.jsx)(_,{path:h,color:e.stroke,width:e.strokeWidth,seed:l,opacity:e.strokeOpacity})})},Dr=e=>{const r=(e.match(/-?\d*\.?\d+(?:e-?\d+)?/giu)??[]).map(Number),t=r.filter((l,h)=>h%2===0),a=r.filter((l,h)=>h%2===1);if(t.length===0||a.length===0)return null;const n=Math.min(...t),o=Math.min(...a);return{x:n,y:o,width:Math.max(...t)-n,height:Math.max(...a)-o}},br=e=>{const r=Dr(e.d);if(r===null||e.fill===void 0||e.fill.startsWith("url("))return(0,s.jsx)(i.DefaultGeomPath,{...e});const t=R(e.d);return(0,s.jsxs)("g",{"data-testid":e["data-testid"],opacity:e.opacity??1,children:[(0,s.jsx)(N,{region:e.d,bounds:r,color:e.fill,angle:D(e.fill),spacing:Cr,width:Hr,seed:t,pressure:e.fillOpacity??1}),(0,s.jsx)(_,{path:e.d,color:e.fill,width:e.strokeWidth||De,seed:t,opacity:Mr})]})},Gr={Circle:$r,Line:Lr,Rect:Tr,Path:br},Wr={name:"chalkboard",styles:rt,palettes:{categorical:Oe,sequential:Ye,diverging:qe},config:{axes:{y:{position:"left"}},legend:{position:"top",align:"start"}},colorScheme:"dark",plugins:Pr,shapes:Gr};exports.chalkboard=Wr;