1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[42667],{42667:(e,t,n)=>{n.r(t),n.d(t,{default:()=>H});var s=n(95155),r=n(12115),a=n(97003),l=n(33789),i=n(90235),o=n(67001),c=n(33534),h=n(69635),d=n(52863),u=n(10926),m=n(84296),f=n(49480),g=n(95302);let p=["A","AB","B"],x=["A","B","C","AB","AC","BC","ABC"],y=["A","B","C"],b=new Intl.NumberFormat("en-US"),v=(e,t,n)=>e<t?t:e>n?n:e,j=e=>(e%(2*Math.PI)+2*Math.PI)%(2*Math.PI),w=e=>Math.round(100*e)/100,k=e=>Math.round(1e3*e)/1e3;function N(e){let t=e.replace("#",""),n=parseInt((3===t.length?t.split("").map(e=>e+e).join(""):t).slice(0,6)||"000000",16);return[n>>16&255,n>>8&255,255&n]}function C(e,t,n){let s=e=>v(Math.round(e),0,255).toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(n)}`}function $(e,t){let[n,s,r]=N(e);return C(n*(1-t),s*(1-t),r*(1-t))}let A=[{id:"okabe",name:"Okabe-Ito, colorblind safe",sets:["#0072B2","#E69F00","#009E73"]},{id:"classic",name:"Classic",sets:["#2563eb","#dc2626","#16a34a"]},{id:"cool",name:"Cool",sets:["#0e7490","#4338ca","#0f766e"]},{id:"warm",name:"Warm",sets:["#b45309","#b91c1c","#a21caf"]},{id:"print",name:"Black and white for print",sets:["#1f2937","#6b7280","#4b5563"]}];function B(e){return e.replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").slice(0,40).toLowerCase()||"venn-diagram"}function M(e,t,n){if(e<=0||t<=0||n>=e+t)return 0;if(n<=Math.abs(e-t))return Math.PI*Math.min(e,t)**2;let s=e*e*Math.acos(v((n*n+e*e-t*t)/(2*n*e),-1,1));return s+t*t*Math.acos(v((n*n+t*t-e*e)/(2*n*t),-1,1))-.5*Math.sqrt(Math.max(0,(-n+e+t)*(n+e-t)*(n-e+t)*(n+e+t)))}function S(e){return 2===e?[{key:"A",sig:[!0,!1]},{key:"B",sig:[!1,!0]},{key:"AB",sig:[!0,!0]}]:[{key:"A",sig:[!0,!1,!1]},{key:"B",sig:[!1,!0,!1]},{key:"C",sig:[!1,!1,!0]},{key:"AB",sig:[!0,!0,!1]},{key:"AC",sig:[!0,!1,!0]},{key:"BC",sig:[!1,!0,!0]},{key:"ABC",sig:[!0,!0,!0]}]}function F(e,t){if(!e.length)return[];let n=1/0,s=1/0,r=-1/0,a=-1/0;for(let t of e)n=Math.min(n,t.x-t.r),s=Math.min(s,t.y-t.r),r=Math.max(r,t.x+t.r),a=Math.max(a,t.y+t.r);let l=Math.max(1e-9,r-n),i=Math.max(1e-9,a-s),o=Math.min(t.w/l,t.h/i),c=t.x+(t.w-l*o)/2-n*o,h=t.y+(t.h-i*o)/2-s*o;return e.map(e=>({x:e.x*o+c,y:e.y*o+h,r:e.r*o}))}let T=[{x:-.55,y:0,r:1},{x:.55,y:0,r:1}],D=[{x:-.5*Math.sqrt(3)*.55,y:-.275,r:1},{x:.5*Math.sqrt(3)*.55,y:-.275,r:1},{x:0,y:.55,r:1}];function E(e,t){let n=t.trim?e.trim().replace(/\s+/g," "):e;return n=n.normalize("NFC"),t.caseFold&&(n=(0,g.u7)(n)),t.accentFold&&(n=n.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC")),n}function O(e,t){let n=new Set;for(let s of e)n.add(E(s,t));return n.size}let z=/^[+-]?\d{1,3}(?:[ \u00a0\u202f]\d{3})+(?:\.\d+)?$/,I=/[ \u00a0\u202f]/g;function P(e,t){let n=e=>t[e]?.trim()||`Set ${y[e]??""}`;return 1===e.length?`${n(y.indexOf(e))} total`:3===e.length?"In all three":`Shared by ${e.split("").map(e=>n(y.indexOf(e))).join(" and ")}`}function q(e,t,n){let s=e.split("").map(e=>y.indexOf(e)).map(e=>t[e]?.trim()||`Set ${y[e]??""}`);return 1===s.length?`${s[0]} only`:s.length===n?2===n?`In both ${s.join(" and ")}`:`In all three, ${s.join(", ")}`:`${s.join(" and ")} only`}function L(e){return encodeURIComponent(JSON.stringify(e))}function R(e){try{let t=JSON.parse(decodeURIComponent(e));if(!t||"object"!=typeof t||1!==t.v)return null;return t}catch{return null}}var W=n(27784),G=n(14827);let J="toolbreezy.venn-diagram-maker",V="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",U={names:["Frogs","Toads",""],labels:{A:"Smooth wet skin\nLays eggs in clusters\nLong jumping legs",B:"Dry bumpy skin\nLays eggs in strings\nShort walking legs",AB:"Amphibians\nStart life as tadpoles\nEat insects"}},_=["running shoes\nTrail Runners\nhiking boots\nwool socks\nheadlamp\nwater filter\ntrekking poles\nrain jacket\nrunning shoes","hiking boots\nwool socks\nHEADLAMP\ntent\nsleeping bag\ncamp stove\nrain jacket\ntrekking poles",""],Y="h-9 w-full rounded-md border border-input bg-background px-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";function H(){let[e,t]=(0,r.useState)("labels"),[n,g]=(0,r.useState)(2),[H,X]=(0,r.useState)("fit"),[Z,K]=(0,r.useState)([...U.names]),[Q,ee]=(0,r.useState)({...
1U.labels}),[et,en]=(0,r.useState)([..._]),[es,er]=(0,r.useState)({A:"120",B:"90",C:"70",AB:"35",AC:"20",BC:"18",ABC:"9"}),[ea,el]=(0,r.useState)({trim:!0,caseFold:!0,accentFold:!1}),[ei,eo]=(0,r.useState)({}),[ec,eh]=(0,r.useState)("Frogs and toads"),[ed,eu]=(0,r.useState)(""),[em,ef]=(0,r.useState)("okabe"),[eg,ep]=(0,r.useState)(!1),[ex,ey]=(0,r.useState)(1),[eb,ev]=(0,r.useState)(2),[ej,ew]=(0,r.useState)(null),[ek,eN]=(0,r.useState)(!1),[eC,e$]=(0,r.useState)(""),[eA,eB]=(0,r.useState)(""),[eM,eS]=(0,r.useState)(!1),[eF,eT]=(0,r.useState)(-1),eD=(0,r.useRef)(null),eE=[(0,r.useRef)(null),(0,r.useRef)(null),(0,r.useRef)(null)],eO=(0,r.useRef)(null),ez=(A.find(e=>e.id===em)??A[0]).sets,eI=2===n?p:x;function eP(e){t("lists"===e.mode||"counts"===e.mode?e.mode:"labels"),g(3===e.n?3:2),X("equal"===e.layout?"equal":"fit"),K([e.names[0]??"",e.names[1]??"",e.names[2]??""]),ee({...e.labels}),er(t=>({...t,...e.counts})),e.lists&&en([e.lists[0]??"",e.lists[1]??"",e.lists[2]??""]),e.fold&&el({trim:!!e.fold.trim,caseFold:!!e.fold.caseFold,accentFold:!!e.fold.accentFold}),eo({...e.merges??{}}),eh(e.title??""),eu(e.caption??""),e.palette&&ef(e.palette),ep(!!e.hatch),ey(v(e.fs??1,.7,1.5)),ew(null)}(0,r.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("s");if(e){let t=R(e);if(t)return void eP(t)}try{let e=localStorage.getItem(J);if(e){let t=JSON.parse(e);t.palette&&ef(t.palette),"boolean"==typeof t.hatch&&ep(t.hatch),"number"==typeof t.fs&&ey(v(t.fs,.7,1.5)),(2===t.n||3===t.n)&&g(t.n),("fit"===t.layout||"equal"===t.layout)&&X(t.layout)}}catch{}},[]),(0,W.Vd)(J,()=>JSON.stringify({palette:em,hatch:eg,fs:ex,n:n,layout:H}),[em,eg,ex,n,H]);let eq=(0,r.useMemo)(()=>"lists"===e?function(e,t,n,s){let r=[],a=new Map,l=[];for(let i=0;i<t;i++){let{lines:t,recon:o}=function(e,t){let n=e.split(/\r?\n/),s=n.filter(e=>""!==e.trim()),r=Math.max(0,s.length-5e3),a=s.slice(0,5e3),l={trim:!1,caseFold:!1,accentFold:!1},i=O(a,l),o=O(a,{...l,trim:t.trim}),c=O(a,{...l,trim:t.trim,caseFold:t.caseFold}),h=O(a,t);return{lines:a,recon:{raw:n.length,blank:n.length-s.length,exactDupes:a.length-i,byTrim:i-o,byCase:o-c,byAccent:c-h,unique:h,overCap:r}}}(e[i]??"",n);l.push(o);let c=new Set;for(let e of t){let t=E(e,n),r=s[t];r&&(t=r),a.has(t)||a.set(t,n.trim?e.trim().replace(/\s+/g," "):e),c.add(t)}r.push(c)}let i=new Set;for(let e of r)for(let t of e)i.add(t);let o={};for(let e of 2===t?p:x)o[e]=[];for(let e of i){let n=r[0]?.has(e)===!0,s=r[1]?.has(e)===!0,l=3===t&&r[2]?.has(e)===!0,i="";i=2===t?n&&s?"AB":n?"A":"B":n&&s&&l?"ABC":n&&s?"AB":n&&l?"AC":s&&l?"BC":n?"A":s?"B":"C",o[i]?.push(a.get(e)??e)}for(let e of Object.keys(o))o[e]?.sort((e,t)=>e.localeCompare(t));let c=[];for(let e=0;e<t;e++)c.push(r[e]?.size??0);let h=(e,t)=>{let n=r[e],s=r[t];if(!n||!s)return 0;let a=0;for(let e of n)s.has(e)&&a++;return a},d=h(0,1),u=3===t?h(0,2):0,m=3===t?h(1,2):0,f=0;if(3===t){let e=r[0],t=r[1],n=r[2];if(e&&t&&n)for(let s of e)t.has(s)&&n.has(s)&&f++}let g=[],y=[...i].slice(0,600),b=e=>(a.get(e)??e).toLowerCase().replace(/[^a-z0-9]/g,""),v=new Map;for(let e of y){let t=b(e);if(!t)continue;let n=v.get(t);n?n.push(e):v.set(t,[e])}for(let e of v.values())for(let t=1;t<e.length&&g.length<25;t++)g.push({a:e[0],b:e[t]});for(let e=0;e<y.length&&g.length<25;e++)for(let t=e+1;t<y.length&&g.length<25;t++){let n=b(y[e]),s=b(y[t]);if(!n||!s||n===s)continue;let r=n.length>=s.length?n:s,a=n.length>=s.length?s:n;a.length>=4&&r.startsWith(a)&&r.length-a.length<=5&&g.push({a:y[e],b:y[t]})}return{data:{totals:c,nAB:d,nAC:u,nBC:m,nABC:f},regionItems:o,recons:l,nearMisses:g,nearMissPartial:i.size>600}}(et,n,ea,ei):null,[e,et,n,ea,ei]),eL=(0,r.useMemo)(()=>{if("counts"!==e)return null;let t=[],s=e=>{let n=es[e]??"";if(""===n.trim())return 0;let s=function(e){let t=e.trim();return""===t?null:(0,f.qF)(z.test(t)?t.replace(I,""):t)}(n);return null===s?(t.push({key:e,text:n.trim()}),0):Math.round(s)},r=[s("A"),s("B")];return 3===n&&r.push(s("C")),{data:{totals:r,nAB:s("AB"),nAC:3===n?s("AC"):0,nBC:3===n?s("BC"):0,nABC:3===n?s("ABC"):0},unreadable:t}},[e,es,n]),eR=eL?.data??null,eW="lists"===e?eq?.data??null:eR,eG=(0,r.useMemo)(()=>eW&&"counts"===e?[...(eL?.unreadable??[]).map(({key:e,text:t})=>`${P(e,Z)} holds "${t}", which is not a count. Type digits, grouped in threes if you like: 1234, 1,234 and 1 234 all read as one thousand two hundred and thirty four.`),...function(e,t,n){let s=[],r=e=>n[e]?.trim()||`Set ${y[e]??""}`,a=e.totals,l=a[0]??0,i=a[1]??0,o=a[2]??0;for(let e=0;e<t;e++){let t=a[e]??0;(!Number.isFinite(t)||t<0)&&s.push(`${r(e)} has a total of ${t}, which cannot be below zero.`)}let c=[[0,1,e.nAB,"nAB"]];for(let[n,l,i]of(3===t&&(c.push([0,2,e.nAC,"nAC"]),c.push([1,2,e.nBC,"nBC"])),c)){i<0&&s.push(`${r(n)} and ${r(l)} share ${i}, which cannot be below zero.`);let e=Math.min(a[n]??0,a[l]??0);if(i>e){let t=r((a[n]??0)<=(a[l]??0)?n:l);s.push(`${r(n)} and ${r(l)} share ${b.format(i)}, but ${t} only holds ${b.format(e)}. Lower the shared number to ${b.format(e)} or raise ${t}.`)}}if(3===t){let t=Math.min(e.nAB,e.nAC,e.nBC);for(let[n,c]of(e.nABC<0?s.push(`The all-three number is ${e.nABC}, which cannot be below zero.`):e.nABC>t&&s.push(`All three share ${b.format(e.nABC)}, but the smallest pair only shares ${b.format(t)}. An item in all three is in every pair too, so lower the all-three number to ${b.format(t)}.`),[[0,l-e.nAB-e.nAC+e.nABC],[1,i-e.nAB-e.nBC+e.nABC],[2,o-e.nAC-e.nBC+e.nABC]]))if(c<0){let e=(a[n]??0)-c;s.push(`These numbers leave ${r(n)} with ${b.format(c)} items of its own. Its overlaps already account for more than its total, so ${r(n)} needs at least ${b.format(e)}.`)}}return s}(eW,n,Z)]:[],[eW,e,n,Z,eL]),eJ=eW&&0===eG.length?eW:null,eV=eJ?function(e,t){let n=e.totals,s=n[0]??0,r=n[1]??0,a=n[2]??0;return 2===t?{A:s-e.nAB,AB:e.nAB,B:r-e.nAB}:{A:s-e.nAB-e.nAC+e.nABC,B:r-e.nAB-e.nBC+e.nABC,C:a-e.nAC-e.nBC+e.nABC,AB:e.nAB-e.nABC,AC:e.nAC-e.nABC,BC:e.nBC-e.nABC,ABC:e.nABC}}(eJ,n):null,eU=(0,r.useMemo)(()=>(function(e,t,n){let s={x:90,y:134,w:820,h:520},r=e=>`{${e}}`;if(3===e)return{circles:F(D,s),setOf:[0,1,2],regions:S(3),kind:"normal",areaError:null,note:n?"Not drawn to scale. Three circles cannot carry seven true areas, so the sizes are fixed and the numbers in each region are the real counts.":"Three set
1s, equal circles. No counts were entered, so no numbers are shown."};if(!n)return{circles:F(T,s),setOf:[0,1],regions:S(2),kind:"normal",areaError:null,note:"Two sets, equal circles. No counts were entered, so no numbers are shown."};let a=n.totals[0]??0,l=n.totals[1]??0,i=n.nAB;if(a<=0&&l<=0)return{circles:[],setOf:[],regions:[],kind:"empty",areaError:null,note:"Both sets are empty, so there is nothing to draw yet."};if(a<=0||l<=0){let e=a>0?0:1;return{circles:F([{x:0,y:0,r:1}],s),setOf:[e],regions:[{key:0===e?"A":"B",sig:[!0]}],kind:"solo",areaError:null,note:`${r(+(0===e))} is empty, so only ${r(e)} is drawn.`}}if(i>=a&&i>=l)return{circles:F([{x:0,y:0,r:1}],s),setOf:[0],regions:[{key:"AB",sig:[!0]}],kind:"solo",areaError:0,note:`${r(0)} and ${r(1)} hold exactly the same items, so they are one circle.`};let o="fit"===t,c=o?Math.sqrt(a/Math.PI):1,h=o?Math.sqrt(l/Math.PI):1;if(i<=0){let e=.2*Math.max(c,h);return{circles:F([{x:0,y:0,r:c},{x:c+h+e,y:0,r:h}],s),setOf:[0,1],regions:S(2),kind:"disjoint",areaError:o?0:null,note:`${r(0)} and ${r(1)} share nothing, so the circles are drawn apart. That is an Euler diagram, and it is the correct picture for this data.`}}if(i>=Math.min(a,l)){let e=a<l,t=o?e?h:c:1,n=o?e?c:h:.55,i=Math.max(0,(t-n)*.42),d={x:0,y:0,r:t},u={x:i,y:0,r:n};return{circles:F(e?[u,d]:[d,u],s),setOf:[0,1],regions:S(2),kind:"nested",areaError:o?0:null,note:`Every item in ${r(+!e)} is also in ${r(+!!e)}, so the smaller circle is drawn inside the larger one.`}}if(!o)return{circles:F(T,s),setOf:[0,1],regions:S(2),kind:"normal",areaError:null,note:"Not drawn to scale. The circles are a fixed size and the numbers in each region are the real counts."};let d=function(e,t,n){let s=Math.abs(e-t),r=e+t;for(let a=0;a<80;a++){let a=(s+r)/2,l=M(e,t,a);if(Math.abs(l-n)<=1e-9*Math.max(1,n))return{d:a,achieved:l};l>n?s=a:r=a}let a=(s+r)/2;return{d:a,achieved:M(e,t,a)}}(c,h,i),u=i>0?Math.abs(d.achieved-i)/i*100:0;return{circles:F([{x:0,y:0,r:c},{x:d.d,y:0,r:h}],s),setOf:[0,1],regions:S(2),kind:"normal",areaError:u,note:`Areas match the counts. The overlap is drawn ${u<5e-5?"0.0000":u.toFixed(4)}% away from the area the numbers asked for.`}})(n,H,eJ),[n,H,eJ]),e_=(0,r.useMemo)(()=>{if(!eU.circles.length)return{paths:{},anchors:{}};let e=function(e){let t=[],n=e.map(()=>[]);for(let s=0;s<e.length;s++)for(let r=s+1;r<e.length;r++)for(let a of function(e,t){let n=t.x-e.x,s=t.y-e.y,r=Math.hypot(n,s),a=1e-7*Math.max(e.r,t.r,1);if(r<a||r>e.r+t.r-a||r<Math.abs(e.r-t.r)+a)return[];let l=(e.r*e.r-t.r*t.r+r*r)/(2*r),i=Math.sqrt(Math.max(0,e.r*e.r-l*l)),o=e.x+l*n/r,c=e.y+l*s/r,h=-s*i/r,d=n*i/r;return[{x:o+h,y:c+d},{x:o-h,y:c-d}]}(e[s],e[r])){let e=t.length;t.push(a),n[s].push(e),n[r].push(e)}let s=[];for(let r=0;r<e.length;r++){let a=e[r],l=n[r];if(!l.length){s.push({ci:r,from:-1,to:-1,a0:0,a1:2*Math.PI,full:!0});continue}let i=l.map(e=>({idx:e,ang:j(Math.atan2(t[e].y-a.y,t[e].x-a.x))})).sort((e,t)=>e.ang-t.ang);for(let e=0;e<i.length;e++){let t=i[e],n=i[(e+1)%i.length],a=e+1===i.length?n.ang+2*Math.PI:n.ang;s.push({ci:r,from:t.idx,to:n.idx,a0:t.ang,a1:a,full:!1})}}return{pts:t,arcs:s}}(eU.circles),t={},n={};for(let s of eU.regions)t[s.key]=function(e,t,n){let s=[];for(let r of t.arcs){let t=e[r.ci],a=(r.a0+r.a1)/2,l=t.x+t.r*Math.cos(a),i=t.y+t.r*Math.sin(a),o=!0;for(let t=0;t<e.length;t++){if(t===r.ci)continue;let s=e[t];if(Math.hypot(l-s.x,i-s.y)<s.r!=(!0===n[t])){o=!1;break}}o&&s.push(r)}if(!s.length)return"";let r=(n,s)=>{let r=e[n.ci],a=+(n.a1-n.a0>Math.PI),l=t.pts[s?n.to:n.from];return`A ${k(r.r)} ${k(r.r)} 0 ${a} ${+!!s} ${k(l.x)} ${k(l.y)}`},a=Array(s.length).fill(!1),l=[];for(let n=0;n<s.length;n++){if(a[n])continue;let i=s[n];if(a[n]=!0,i.full){l.push(function(e){let t=k(e.r),n=k(e.x),s=k(e.y);return`M ${k(n+t)} ${s} A ${t} ${t} 0 1 1 ${k(n-t)} ${s} A ${t} ${t} 0 1 1 ${k(n+t)} ${s} Z`}(e[i.ci]));continue}let o=t.pts[i.from],c=`M ${k(o.x)} ${k(o.y)} ${r(i,!0)}`,h=i.to,d=0;for(;h!==i.from&&d++<=s.length;){let e=-1,t=!0;for(let n=0;n<s.length;n++){let r=s[n];if(!a[n]&&!r.full){if(r.from===h){e=n,t=!0;break}if(r.to===h){e=n,t=!1;break}}}if(e<0)break;a[e]=!0;let n=s[e];c+=` ${r(n,t)}`,h=t?n.to:n.from}l.push(`${c} Z`)}return l.join(" ")}(eU.circles,e,s.sig),n[s.key]=function(e,t){if(!e.length)return null;let n=1/0,s=1/0,r=-1/0,a=-1/0;for(let t of e)n=Math.min(n,t.x-t.r),s=Math.min(s,t.y-t.r),r=Math.max(r,t.x+t.r),a=Math.max(a,t.y+t.r);let l=null;for(let i=0;i<=108;i++){let o=n+(r-n)*i/108;for(let n=0;n<=108;n++){let r=s+(a-s)*n/108,i=!0,c=1/0;for(let n=0;n<e.length;n++){let s=e[n],a=Math.hypot(o-s.x,r-s.y);if(a<s.r!=(!0===t[n])){i=!1;break}c=Math.min(c,Math.abs(a-s.r))}i&&Number.isFinite(c)&&(!l||c>l.room)&&(l={x:o,y:r,room:c})}}return l}(eU.circles,s.sig);return{paths:t,anchors:n}},[eU]),eY=(0,r.useCallback)(e=>eV&&(eV[e]??0)===0?"#f1f5f9":function(e,t){let n=t.split("").map(e=>y.indexOf(e)).filter(e=>e>=0),s=n.map(t=>e[t]??e[0]??"#0072B2"),r=n.length>=3?.2:2===n.length?.42:.64;if(!s.length)return"#e5e7eb";let a=0,l=0,i=0;for(let e of s){let[t,n,s]=N(e);a+=t,l+=n,i+=s}return a/=s.length,C(a+(255-a)*r,(l/=s.length)+(255-l)*r,(i/=s.length)+(255-i)*r)}(ez,e),[eV,ez]),eH=(0,r.useMemo)(()=>{let e=[];eU.note&&e.push(eU.note.replace(/\{(\d)\}/g,(e,t)=>Z[Number(t)]?.trim()||`Set ${y[Number(t)]??""}`));let t=ed.trim();return t&&e.push(t),e.slice(0,2)}
1,[eU.note,ed,Z]),eX=(0,r.useCallback)(t=>{let s=et.reduce((e,t)=>e+t.length,0);return{v:1,mode:e,n:n,layout:H,names:Z,labels:Q,counts:es,lists:t&&s<=8e4?et:void 0,fold:ea,merges:ei,title:ec,caption:ed,palette:em,hatch:eg,fs:ex}},[e,n,H,Z,Q,es,et,ea,ei,ec,ed,em,eg,ex]),eZ=(0,r.useCallback)(e=>{let t=eD.current;if(!t)return"";let n=t.cloneNode(!0);return n.querySelectorAll("[data-ui]").forEach(e=>e.remove()),n.removeAttribute("class"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("width",String(1e3)),n.setAttribute("height",String(780)),e&&(n.setAttribute("data-toolbreezy","venn-diagram-maker"),n.setAttribute("data-venn",L(eX(!0)))),`<?xml version="1.0" encoding="UTF-8"?> 2${new XMLSerializer().serializeToString(n)}`},[eX]);async function eK(){if(!eM){eS(!0);try{let e=await (0,h.s)(eZ(!1),{width:1e3,height:780,scale:eb,subject:"diagram"});if(!e.ok)return void e$(`${e.message} The SVG download does not go through a picture and works either way.`);(0,G.WN)(e.blob,`${B(ec||"venn-diagram")}.png`)}finally{eS(!1)}}}async function eQ(){eS(!0);try{let e=await (0,h.s)(eZ(!1),{width:1e3,height:780,scale:eb,subject:"diagram"});if(!e.ok)return void e$(e.message);let{ok:t}=await (0,d.L1)(e.blob);if(!t)return void e$("This browser would not put the diagram on the clipboard. Use Download PNG instead.");e0("image")}catch{e$("The clipboard was blocked. Use Download PNG instead.")}finally{eS(!1)}}function e0(e){eB(e),setTimeout(()=>eB(t=>t===e?"":t),1600)}function e1(e){let t=e.match(/data-venn="([^"]*)"/);if(!t||!t[1])return void e$("That SVG has no diagram data in it, so there is nothing to reopen. Only files this tool exported carry it.");let n=R(t[1]);if(!n)return void e$("That file carries diagram data this version cannot read.");eP(n),e$("Diagram reopened with its mode, layout and matching rules restored.")}function e2(e,n){let s=e.name.toLowerCase(),r=new FileReader;r.onload=()=>{let a=String(r.result??"");if(s.endsWith(".svg")||a.includes("data-venn="))return void e1(a);if(n<0)return void e$(`${e.name} is not a diagram this tool saved. Drop a list file on one of the list boxes instead.`);let l=s.endsWith(".csv")||s.endsWith(".tsv"),i=l?function(e){let t=e.split(/\r?\n/);return t.slice(0,5).some(e=>e.includes(",")||e.includes(" "))?t.map(e=>{if(!e)return"";let t="",n=!1;for(let s=0;s<e.length;s++){let r=e[s];if('"'===r){n&&'"'===e[s+1]?(t+='"',s++):n=!n;continue}if(!n&&(","===r||" "===r))break;t+=r}return t}).join("\n"):e}(a):a;en(e=>{let t=[...e];return t[n]=i,t}
2),t("lists"),e$(l?`Loaded the first column of ${e.name}. If you needed a different column, paste that one instead.`:`Loaded ${e.name}, one item per line exactly as written.`)},r.readAsText(e)}(0,r.useEffect)(()=>{function e(e){let t=e.target;if(t&&"function"==typeof t.closest&&t.closest('input, textarea, [contenteditable="true"]'))return;let n=e.clipboardData?.files?.[0];if(n){e.preventDefault(),e2(n,-1);return}let s=e.clipboardData?.getData("text/plain")??"";if(s.includes("data-venn=")){e.preventDefault(),e1(s);return}s.includes("<svg")&&(e.preventDefault(),e$("That paste has no diagram data in it. Paste the contents of an SVG this tool exported."))}return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[e2,e1]);let e3=eq?.regionItems??null,e5=ej&&e3?e3[ej]??[]:[];async function e4(e){let t=e3?.[e]??[];if(!t.length)return;let{ok:n,note:s}=await (0,d.copyText)(t.join("\n"));n&&e0(`items-${e}`),s&&e$(s)}let e6=(0,r.useMemo)(()=>L(eX(!0)).length,[eX]),e7=(0,r.useCallback)(()=>{let e=new URLSearchParams,t=L(eX(!0));return e.set("s",t.length<=1400?t:L(eX(!1))),e},[eX]),e9=e=>Z[e]?.trim()||`Set ${y[e]??""}`,e8=eU.circles.length?{x:eU.circles.reduce((e,t)=>e+t.x,0)/eU.circles.length,y:eU.circles.reduce((e,t)=>e+t.y,0)/eU.circles.length}:{x:500,y:390},te=17*ex,tt=22*ex;return(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",children:"What do you have"}),(0,s.jsxs)("select",{className:Y,value:e,onChange:e=>{t(e.target.value),ew(null)},children:[(0,s.jsx)("option",{value:"labels",children:"Words for each region"}),(0,s.jsx)("option",{value:"lists",children:"Two or three lists to compare"}),(0,s.jsx)("option",{value:"counts",children:"Numbers I already have"})]})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",children:"Circles"}),(0,s.jsxs)("select",{className:Y,value:n,onChange:e=>{g(Number(e.target.value)),ew(null)},children:[(0,s.jsx)("option",{value:2,children:"2 circles, 3 regions"}),(0,s.jsx)("option",{value:3,children:"3 circles, 7 regions"})]})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",children:"Layout"}),(0,s.jsxs)("select",{className:Y,value:3===n?"equal":H,disabled:3===n,onChange:e=>X(e.target.value),children:[(0,s.jsx)("option",{value:"fit",children:"Fit to data, areas true"}),(0,s.jsx)("option",{value:"equal",children:"Equal circles, counts printed"})]})]})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Two or three circles only. Four circles cut a page into at most 14 pieces and a four-set Venn needs 16, so every four-circle version you have seen is quietly missing two of them. Four-set data belongs in a table.",3===n?" With three circles the sizes are fixed, because three circles cannot carry seven true areas.":""]}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-3",children:Array.from({length:n}).map((e,t)=>(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)(i.J,{className:"text-xs",htmlFor:`venn-name-${t}`,children:["Circle ",y[t]," name"]}),(0,s.jsx)(l.p,{id:`venn-name-${t}`,value:Z[t]??"",onChange:e=>K(n=>{let s=[...n];return s[t]=e.target.value,s}),placeholder:`Set ${y[t]}`})]},t))}),"labels"===e&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Each box is one region and every one of them means ",(0,s.jsx)("strong",{children:"only"}),". Something both circles share goes in the shared box, not in either single box, and that is the one mistake almost everybody makes on the first go."]}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:eI.map(e=>(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",htmlFor:`venn-lab-${e}`,children:q(e,Z,n)}),(0,s.jsx)(o.T,{id:`venn-lab-${e}`,rows:4,value:Q[e]??"",onChange:t=>ee(n=>({...n,[e]:t.target.value})),placeholder:"One item per line"})]},e))})]}),"lists"===e&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:n}).map((e,t)=>(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)(i.J,{className:"text-xs",htmlFor:`venn-list-${t}`,children:[e9(t),", one item per line"]}),(0,s.jsx)(o.T,{id:`venn-list-${t}`,rows:8,className:eF===t?"border-primary ring-2 ring-primary/40":"",value:et[t]??"",onChange:e=>en(n=>{let s=[...n];return s[t]=e.target.value,s}),onDragOver:e=>{e.preventDefault(),eT(t)},onDragLeave:()=>eT(-1),onDrop:e=>{e.preventDefault(),eT(-1);let n=e.dataTransfer.files[0];n&&e2(n,t)},placeholder:"Paste your list here, drag a .txt or .csv onto this box, or click Choose a file"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{ref:eE[t],type:"file",accept:".txt,.csv,.tsv,.svg,text/plain,text/csv,image/svg+xml",className:"hidden",onChange:e=>{let n=e.target.files?.[0];n&&e2(n,t),e.target.value=""}}),(0,s.jsx)(a.$,{variant:"ghost",size:"sm",onClick:()=>eE[t]?.current?.click(),children:"Choose a file"}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[b.format(eq?.recons[t]?.unique??0)," unique"]})]})]},t))}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-4 roun
2ded-md border p-3 text-sm",children:[[["trim","Ignore extra spaces"],["caseFold","Ignore capitals"],["accentFold","Ignore accents"]].map(([e,t])=>(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,s.jsx)("input",{type:"checkbox",checked:ea[e],onChange:t=>el(n=>({...n,[e]:t.target.checked})),className:"h-4 w-4"}),t]},e)),Object.keys(ei).length>0&&(0,s.jsxs)(a.$,{variant:"ghost",size:"sm",onClick:()=>eo({}),children:["Undo ",Object.keys(ei).length," manual merge",1===Object.keys(ei).length?"":"s"]})]}),eq&&(0,s.jsx)("div",{className:"overflow-x-auto rounded-lg border",children:(0,s.jsxs)("table",{className:"w-full min-w-[520px] text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b bg-muted/40 text-left",children:[(0,s.jsx)("th",{className:"px-2 py-2 font-medium",children:"Where the numbers came from"}),Array.from({length:n}).map((e,t)=>(0,s.jsx)("th",{className:"px-2 py-2 text-right font-medium",children:e9(t)},t))]})}),(0,s.jsx)("tbody",{className:"tabular-nums",children:[["Lines pasted",e=>e.raw],["Blank lines dropped",e=>e.blank],["Exact duplicates removed",e=>e.exactDupes],["Merged by ignoring spaces",e=>e.byTrim],["Merged by ignoring capitals",e=>e.byCase],["Merged by ignoring accents",e=>e.byAccent],["Unique items counted",e=>e.unique]].map(([e,t],r)=>(0,s.jsxs)("tr",{className:`border-b last:border-0 ${6===r?"font-medium":""}`,children:[(0,s.jsx)("td",{className:"px-2 py-1.5",children:e}),Array.from({length:n}).map((e,n)=>{let r=eq.recons[n];return(0,s.jsx)("td",{className:"px-2 py-1.5 text-right",children:r?b.format(t(r)):"0"},n)})]},e))})]})}),eq?.recons.some(e=>e.overCap>0)&&(0,s.jsx)("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-sm",children:eq.recons.map((e,t)=>e.overCap>0?`${e9(t)} hit the ${b.format(5e3)} line limit, so ${b.format(e.overCap)}
2 lines were not included.`:"").filter(Boolean).join(" ")}),eq&&eq.nearMisses.length>0&&(0,s.jsxs)("div",{className:"rounded-md border p-3 text-sm",children:[(0,s.jsxs)("p",{className:"mb-2 font-medium",children:[eq.nearMisses.length," pair",1===eq.nearMisses.length?"":"s"," look like the same thing typed two ways"]}),(0,s.jsxs)("p",{className:"mb-2 text-muted-foreground",children:["Nothing is merged for you here. A quiet guess would change every count on the picture, so each one is your call.",eq.nearMissPartial?` This check compares the first ${b.format(600)} unique items, so there may be more it did not reach.`:"",eq.nearMisses.length>12?" The first 12 are offered below.":""]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:eq.nearMisses.slice(0,12).map((e,t)=>(0,s.jsxs)("button",{type:"button",onClick:()=>eo(t=>({...t,[e.b]:e.a})),className:"rounded-full border px-3 py-1 text-xs hover:bg-accent",children:['Merge "',e.b,'" into "',e.a,'"']},`${e.a}|${e.b}|${t}`))})]})]}),"counts"===e&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Totals first, then the overlaps. A total means everything in that circle, including the parts it shares."}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-3 lg:grid-cols-4",children:(2===n?["A","B","AB"]:["A","B","C","AB","AC","BC","ABC"]).map(e=>(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",htmlFor:`venn-cnt-${e}`,children:P(e,Z)}),(0,s.jsx)(l.p,{id:`venn-cnt-${e}`,inputMode:"numeric",value:es[e]??"",onChange:t=>er(n=>({...n,[e]:t.target.value}))})]},e))}),eG.length>0&&(0,s.jsxs)("div",{className:"rounded-md border border-red-500/50 bg-red-500/10 p-3 text-sm",children:[(0,s.jsx)("p",{className:"mb-1 font-medium",children:"These numbers cannot be drawn, so nothing is drawn."}),(0,s.jsx)("ul",{className:"list-disc space-y-1 pl-5",children:eG.map(e=>(0,s.jsx)("li",{children:e},e))})]})]}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",htmlFor:"venn-title",children:"Title on the picture"}),(0,s.jsx)(l.p,{id:"venn-title",value:ec,onChange:e=>eh(e.target.value),placeholder:"Optional"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",htmlFor:"venn-caption",children:"Your own caption"}),(0,s.jsx)(l.p,{id:"venn-caption",value:ed,onChange:e=>eu(e.target.value),placeholder:"Optional, sits under the diagram"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",htmlFor:"venn-palette",children:"Colors"}),(0,s.jsx)("select",{id:"venn-palette",className:Y,value:em,onChange:e=>{ef(e.target.value),"print"===e.target.value&&ep(!0)},children:A.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(i.J,{className:"text-xs",htmlFor:"venn-fs",children:"Text size"}),(0,s.jsx)("input",{id:"venn-fs",type:"range",min:.7,max:1.5,step:.05,value:ex,onChange:e=>ey(Number(e.target.value)),className:"w-full accent-primary"})]})]}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[(0,s.jsx)("input",{type:"checkbox",checked:eg,onChange:e=>ep(e.target.checked),className:"h-4 w-4"}
2),"Add a pattern to the shared regions, so they still read apart in black and white"]}),(0,s.jsx)("div",{className:"rounded-lg border bg-white p-3",children:0===eU.circles.length?(0,s.jsx)("p",{className:"px-4 py-16 text-center text-sm text-slate-500",children:eH[0]||"Enter something above and the diagram draws itself."}):(0,s.jsxs)("svg",{ref:eD,viewBox:"0 0 1000 780",className:"h-auto w-full",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":ec||"Venn diagram",children:[(0,s.jsx)("defs",{children:eU.regions.map((e,t)=>eg&&e.key.length>1?(0,s.jsxs)("pattern",{id:`venn-hatch-${e.key}`,width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:`rotate(${30+25*t})`,children:[(0,s.jsx)("rect",{width:"10",height:"10",fill:eY(e.key)}),(0,s.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"10",stroke:$(eY(e.key),.42),strokeWidth:"3"})]},e.key):null)}),(0,s.jsx)("rect",{x:"0",y:"0",width:1e3,height:780,fill:"#ffffff"}),ec.trim()&&(0,s.jsx)("text",{x:500,y:50,fill:"#0f172a",fontFamily:V,fontSize:32*ex,fontWeight:700,textAnchor:"middle",children:ec.trim()}),eU.regions.map(e=>{let t=e_.paths[e.key];if(!t)return null;let n=eY(e.key),r=eg&&e.key.length>1&&(!eV||(eV[e.key]??1)!==0);return(0,s.jsx)("path",{d:t,fill:r?`url(#venn-hatch-${e.key})`:n,fillRule:"evenodd",stroke:"none",onClick:()=>{ew(t=>t===e.key?null:e.key),eN(!1)},style:{cursor:"pointer"}},e.key)}),ej&&e_.paths[ej]&&(0,s.jsx)("path",{"data-ui":"1",d:e_.paths[ej],fill:"none",stroke:"#111827",strokeWidth:4,strokeDasharray:"9 6",fillRule:"evenodd"}),eU.circles.map((e,t)=>(0,s.jsx)("circle",{cx:w(e.x),cy:w(e.y),r:w(e.r),fill:"none",stroke:$(ez[eU.setOf[t]??0]??"#0072B2",.15),strokeWidth:3},t)),eU.circles.map((e,t)=>{let n=eU.setOf[t]??0,r=e.x-e8.x,a=e.y-e8.y,l=Math.hypot(r,a);l<1?(r=0,a=-1):(r/=l,a/=l);let i=v(e.x+r*(e.r+26),60,940),o=v(e.y+a*(e.r+26)+(a<0?-6:20),96,700),c=eJ?eJ.totals[n]:null;return(0,s.jsxs)("text",{x:w(i),y:w(o),fill:$(ez[n]??"#0072B2",.25),fontFamily:V,fontSize:20*ex,fontWeight:700,textAnchor:.35>Math.abs(r)?"middle":r>0?"end":"start",children:[e9(n),"number"==typeof c?` (${b.format(c)})`:""]},`n${t}`)}),eU.regions.map(t=>{let n=e_.anchors[t.key];if(!n||!e_.paths[t.key])return null;let r=eY(t.key),a=(0,u.X8)(r),l=eV?eV[t.key]:void 0,i="labels"===e?(Q[t.key]??"").trim():"",o=n.room<22,c=o?te:v(te*Math.min(1,n.room/34),11,te),h=Math.max(6,Math.floor(1.85*n.room/(.52*c))),d=i?function(e,t){let n=[];for(let s of e.split("\n")){let e=s.split(/\s+/).filter(Boolean);if(!e.length)continue;let r="";for(let s of e){let e=r?`${r} ${s}`:s;e.length<=t||!r?r=e:(n.push(r),r=s)}r&&n.push(r)}return n}(i,o?26:h):[],m=d.length>6?[...d.slice(0,5),`+${d.length-5} more`]:d,f="number"==typeof l;if(!m.length&&!f)return null;let g=n.x,p=n.y,x="middle",y=null;if(o){let e=n.x-e8.x,t=n.y-e8.y,s=Math.hypot(e,t)||1;e/=s,t/=s,g=v(n.x+92*e,70,930),p=v(n.y+92*t,102,686),x=e>=0?"start":"end",y=`M ${w(n.x)} ${w(n.y)} L ${w(g-(e>=0?8:-8))} ${w(p)}`}let j=m.length+ +!!f,k=1.22*c,N=p-(j-1)*k/2-(f?(tt-c)/4:0),C=o?"#334155":a;return(0,s.jsxs)("g",{children:[y&&(0,s.jsx)("path",{d:y,stroke:"#94a3b8",strokeWidth:1.6,fill:"none"}),m.map((e,t)=>(0,s.jsx)("text",{x:w(g),y:w(N+t*k),fill:C,fontFamily:V,fontSize:c,textAnchor:x,dominantBaseline:"middle",children:e},t)),f&&(0,s.jsx)("text",{x:w(g),y:w(N+m.length*k),fill:C,fontFamily:V,fontSize:m.length?c:tt,fontWeight:700,textAnchor:x,dominantBaseline:"middle",children:b.format(l??0)})]},`t${t.key}`)}),eH.map((e,t)=>(0,s.jsx)("text",{x:500,y:732+22*t,fill:"#475569",fontFamily:V,fontSize:15,textAnchor:"middle",children:e},`c${t}`))]})}),eJ&&2===n&&"fit"===H&&null!==eU.areaError&&(0,s.jsxs)("p",{className:"rounded-md border border-emerald-600/40 bg-emerald-600/10 p-2 text-sm",children:["Overlap area drawn: ",eU.areaError<5e-5?"0.0000":eU.areaError.toFixed(4),"% away from what the counts asked for. That is the error the solver actually reached, not an assumption."]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(a.$,{onClick:eK,disabled:eM||!eU.circles.length,children:eM?"Working...":"Download PNG"}),(0,s.jsx)(a.$,{variant:"outline",onClick:function(){(0,G.mR)(eZ(!0),`${B(ec||"venn-diagram")}.svg`,"image/svg+xml")},disabled:!eU.circles.length,children:"Download SVG"}),(0,s.jsx)(a.$,{variant:"outline",onClick:eQ,disabled:eM||!eU.circles.length,children:"image"===eA?"Copied â":"Copy image"}),(0,s.jsxs)("select",{className:"h-9 rounded-md border border-input bg-background px-2 text-sm",value:eb,onChange:e=>ev(Number(e.target.value)),"aria-label":"PNG size",children:[(0,s.jsx)("option",{value:1,children:"1x"}),(0,s.jsx)("option",{value:2,children:"2x"}),(0,s.jsx)("option",{value:3,children:"3x"})]}),(0,s.jsx)(a.$,{variant:"ghost",onClick:function(){let e=eZ(!1);if(!e)return;let t=window.open("","_blank","width=900,height=760");if(!t)return void e$("Your browser blocked the print window. Allow pop-ups for this page, or download the PNG and print that.");t.document.write(`<!doctype html><html><head><title>${(ec||"Venn diagram").replace(/[<>&]/g,"")}</title><style>html,body{margin:0;padding:0}svg{width:100%;height:auto}@page{margin:12mm}</style></head><body>${e.replace(/^<\?xml[^>]*\?>\s*/,"")}</body></html>`),t.document.close(),t.focus(),setTimeout(()=>t.print(),250)},disabled:!eU.circles.length,children:"Print the diagram"})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["PNG at ",eb,"x is ",1e3*eb," by ",780*eb," pixels, which every browser can handle at this frame size. The SVG stays sharp at any size and keeps its text live, but it names its fonts rather than carrying them, so a machine without that font substitutes one. PNG is the format that always looks like the preview."]}),(0,s.jsxs)("div",{className:"rounded-lg border border-dashed p-3 text-sm",onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files[0];t&&e2(t,-1)}
2,children:[(0,s.jsx)("p",{className:"font-medium",children:"Reopen a diagram you saved"}),(0,s.jsx)("p",{className:"mt-1 text-muted-foreground",children:"Every SVG this tool writes carries the whole diagram inside it. Drop that file here, click to choose it, or paste the file contents, and it comes back with its mode, its layout and its matching rules set the way you left them."}),(0,s.jsx)("input",{ref:eO,type:"file",accept:".svg,image/svg+xml",className:"hidden",onChange:e=>{let t=e.target.files?.[0];t&&e2(t,-1),e.target.value=""}}),(0,s.jsx)(a.$,{variant:"ghost",size:"sm",className:"mt-1",onClick:()=>eO.current?.click(),children:"Choose a saved SVG"})]}),eC&&(0,s.jsxs)("p",{className:"rounded-md border bg-muted/40 p-2 text-sm",children:[eC," ",(0,s.jsx)("button",{type:"button",className:"underline",onClick:()=>e$(""),children:"Dismiss"})]}),"lists"===e&&e3&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"overflow-x-auto rounded-lg border",children:(0,s.jsxs)("table",{className:"w-full min-w-[420px] text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b bg-muted/40 text-left",children:[(0,s.jsx)("th",{className:"px-2 py-2 font-medium",children:"Region"}),(0,s.jsx)("th",{className:"w-24 px-2 py-2 text-right font-medium",children:"Items"}),(0,s.jsx)("th",{className:"w-40 px-2 py-2"})]})}),(0,s.jsx)("tbody",{children:eI.map(e=>(0,s.jsxs)("tr",{className:`cursor-pointer border-b last:border-0 hover:bg-accent/40 ${ej===e?"bg-accent/60":""}`,onClick:()=>{ew(t=>t===e?null:e),eN(!1)},children:[(0,s.jsxs)("td",{className:"px-2 py-1.5",children:[(0,s.jsx)("span",{className:"mr-2 inline-block h-3 w-3 rounded-sm align-middle",style:{background:eY(e),border:"1px solid rgba(0,0,0,.2)"}}),q(e,Z,n)]}),(0,s.jsx)("td",{className:"px-2 py-1.5 text-right tabular-nums",children:b.format(e3[e]?.length??0)}),(0,s.jsxs)("td",{className:"px-2 py-1.5 text-right",children:[(0,s.jsx)("button",{type:"button",className:"rounded px-2 py-1 text-xs underline",onClick:t=>{t.stopPropagation(),e4(e)},children:eA===`items-${e}`?"Copied â":"Copy"}),(0,s.jsx)("button",{type:"button",className:"rounded px-2 py-1 text-xs underline",onClick:t=>{t.stopPropagation();let s=e3?.[e]??[],r=`region,item 3`,a=s.map(t=>`${(0,m.r)(q(e,Z,n))},${(0,m.r)(t)}`).join("\n");(0,G.mR)(r+a,`${B(q(e,Z,n))}.csv`,"text/csv;charset=utf-8")},children:"CSV"})]})]},e))})]})}),ej&&(0,s.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,s.jsx)("p",{className:"mb-2 text-sm font-medium",children:q(ej,Z,n)}),(0,s.jsxs)("p",{className:"mb-2 text-xs text-muted-foreground",children:["Showing ",b.format(Math.min(e5.length,ek?e5.length:200))," of"," ",b.format(e5.length)," items. Everything here is in this region and nowhere else on the diagram."]}),(0,s.jsx)("ul",{className:"max-h-64 space-y-0.5 overflow-y-auto text-sm",children:(ek?e5:e5.slice(0,200)).map((e,t)=>(0,s.jsx)("li",{className:"truncate",children:e},`${e}-${t}`))}),!ek&&e5.length>200&&(0,s.jsxs)(a.$,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>eN(!0),children:["Show all ",b.format(e5.length)]})]})]}),(0,s.jsx)(c.ToolActions,{getParams:e7,title:"Venn Diagram Maker"}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Every list, count and label stays on your own machine. Customer IDs, keyword sets and student names are never uploaded, there is no account, no export cap, and no watermark.",e6>1400?" Your lists are too long to ride along in a share link, so the link carries the settings and the counts. Download the SVG to keep the items.":""]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.