1const _="http://www.w3.org/2000/svg",V={parchment:{player:"#3f5a78",town:"#3f5a78",hub:"#3f5a78",low:"#9c7a2a",medium:"#6e430a",high:"#3a2004"},stone:{player:"#a9b7cc",town:"#a9b7cc",hub:"#a9b7cc",low:"#efe0a8",medium:"#d9a53a",high:"#a8620f"}},B={parchment:"#f2e6c6",stone:"#23262c"},O={flag:"M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12 12 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A20 20 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a20 20 0 0 0 1.349-.476l.019-.007.004-.002h.001",house:"M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L8 2.207l6.646 6.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zm-.707 1.793 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293z",star:"M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"};function F(i,e){return i==="player"?null:i==="hub"?O.star:e||i==="town"?O.house:null}const D=20;function h(i,e){const n=document.createElementNS(_,i);for(const[r,s]of Object.entries(e))n.setAttribute(r,String(s));return n}function Y(i){switch(i){case"Portal":return{stroke:"#7a3aa8",width:2.5,dash:"6 4"};case"Proximity":return{stroke:"#9a8b6a",width:1,dash:"2 4"};default:return{stroke:"#7a4b2a",width:3,dash:""}}}
1const W={parchment:{base:"#968262",clouds:"#4d3824",edges:"#463422",corners:"#3c2c1c",flakes:"#a3916e",grain:"#402e1a",flakeAlpha:210/255},stone:{base:"",clouds:"#0a0c10",edges:"#08090c",corners:"#040508",flakes:"#78808c",grain:"#000000",flakeAlpha:90/255}};function U(i,e,n){const r=parseInt(i.slice(1),16),[s,o,a]=[r>>16&255,r>>8&255,r&255].map(f=>(f/255).toFixed(4));return`0 0 0 0 ${s} 0 0 0 0 ${o} 0 0 0 0 ${a} ${e} 0 0 0 ${n}`}function Z(i,e,n){const r=W[i],s=600/Math.max(e,n),o=(f,g,x,d,z,S)=>`<filter id="${f}" x="0" y="0" width="${e}" height="${n}" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feTurbulence type="${g}" baseFrequency="${(x*s).toFixed(4)}" numOctaves="${d}" seed="${z}"/><feColorMatrix type="matrix" values="${S}"/></filter>`,a=(f,g)=>`<radialGradient id="${f}" gradientUnits="userSpaceOnUse" cx="${e/2}" cy="${n/2}" r="${Math.max(e,n)*.72}">${g}</radialGradient>`;return o("rmg-tx-clouds","fractalNoise",.009,4,11,U(r.clouds,.9,-.26))+o("rmg-tx-flakes","fractalNoise",.028,3,5,U(r.flakes,9,-4.9))+o("rmg-tx-grain","turbulence",.8,2,3,U(r.grain,.12,0))+a("rmg-tx-calm-g",'<stop offset="0.25" stop-color="#fff" stop-opacity="0.2745"/><stop offset="0.9" stop-color="#fff"/>')+a("rmg-tx-ring-g",`<stop offset="0.55" stop-color="#fff" stop-opacity="0"/><stop offset="0.85" stop-color="#fff" stop-opacity="${r.flakeAlpha.toFixed(3)}"/>`)+a("rmg-tx-edges",`<stop offset="0.42" stop-color="${r.edges}" stop-opacity="0"/><stop offset="0.78" stop-color="${r.edges}" stop-opacity="0.2745"/><stop offset="1" stop-color="${r.corners}" stop-opacity="0.588"/>`)+`<mask id="rmg-tx-calm" maskUnits="userSpaceOnUse" x="0" y="0" width="${e}" height="${n}"><rect width="${e}" height="${n}" fill="url(#rmg-tx-calm-g)"/></mask><mask id="rmg-tx-ring" maskUnits="userSpaceOnUse" x="0" y="0" width="${e}" height="${n}"><rect width="${e}" height="${n}" fill="url(#rmg-tx-ring-g)"/></mask>`}function q(i,e,n,r){const s=o=>i.appendChild(h("rect",{width:n,height:r,rx:8,...o}));if(s({filter:"url(#rmg-tx-clouds)",mask:"url(#rmg-tx-calm)"}),s({fill:"url(#rmg-tx-edges)"}),s({filter:"url(#rmg-tx-flakes)",mask:"url(#rmg-tx-ring)"}),s({filter:"url(#rmg-tx-grain)"}),e==="parchment"){const o=600/Math.max(n,r),a=14/o;i.appendChild(h("rect",{x:a,y:a,width:n-2*a,height:r-2*a,rx:22/o,fill:"none",stroke:"rgba(75,56,35,0.75)","stroke-width":2/o}))}}function H(i,e,n,r,s){const o=r/16;return h("path",{d:i,fill:s,"pointer-events":"none",transform:`translate(${e-r/2} ${n-r/2}) scale(${o})`})}function I(i,e,n){const r=n*.46,s=i+n*.74,o=e-n*.74,a=h("g",{class:"rmg-zone-badge","pointer-events":"none"});return a.appendChild(h("circle",{cx:s,cy:o,r,fill:"#caa14a",stroke:"#3a1c0c","stroke-width":1})),a.appendChild(H(O.flag,s,o,r*1.2,"#3a1c0c")),a}function tt(i,e,n={}){if(!i)return;const{legend:r,valueCaption:s,tt:o,selectedZone:a,onZoneClick:f,selectedConn:g,onConnClick:x}=n,d=n.theme==="stone",z=V[d?"stone":"parchment"],S=B[d?"stone":"parchment"],y=e.width,b=e.height,p=h("svg",{viewBox:`0 0 ${y} ${b}`,class:"rmg-map",role:"img","aria-label":`Map layout: ${e.zoneCount} zones, ${e.connectionCount} connections`}),G=[...new Set(e.zones.map(t=>t.category))].map(t=>{const u=z[t]??"#888888";return`<radialGradient id="rmg-grad-${t}" cx="35%" cy="35%" r="75%"><stop offset="0%" stop-color="${Q(u,.3)}"/><stop offset="100%" stop-color="${u}"/></radialGradient>`}).join(""),v=h("defs",{});v.innerHTML='<filter id="rmg-shadow" x="-30%" y="-30%" width="160%" height="160%"><feDropShadow dx="0" dy="1.5" stdDeviation="1.5" flood-color="#2c1608" flood-opacity="0.45"/></filter><linearGradient id="rmg-stone" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#3b4048"/><stop offset="100%" stop-color="#1c1f24"/></linearGradient><radialGradient id="rmg-stone-glow" cx="50%" cy="38%" r="55%"><stop offset="0%" stop-color="rgb(255,236,196)" stop-opacity="0.149"/><stop offset="100%" stop-color="rgb(255,236,196)" stop-opacity="0"/></radialGradient>'+Z(d?"stone":"parchment",y,b)+G,p.appendChild(v);const C=h("rect",{width:y,height:b,fill:d?"url(#rmg-stone)":W.parchment.base,rx:8});p.appendChild(C),d&&p.appendChild(h("rect",{width:y,height:b,fill:"url(#rmg-stone-glow)",rx:8})),q(p,d?"stone":"parchment",y,b);for(const t of e.connections){const u=d&&t.kind!=="Portal"&&t.kind!=="Proximity"?{...Y(t.kind),stroke:"#d9c79c"}:Y(t.kind),c=g!=null&&t.index===g,m=h("g",{class:c?"rmg-conn rmg-conn--selected":"rmg-conn"});m.setAttribute("data-conn",t.kind),m.setAttribute("data-conn-index",String(t.index)),m.setAttribute("data-guard",String(t.borderGuard)),m.setAttribute("data-road",t.road?"1":"0");const k=h("line",{x1:t.fromX,y1:t.fromY,x2:t.toX,y2:t.toY,stroke:"#fff","stroke-opacity":0,"stroke-width":14,"pointer-events":"stroke"}),N=h("line",{class:"rmg-conn-line",x1:t.fromX,y1:t.fromY,x2:t.toX,y2:t.toY,stroke:u.stroke,"stroke-width":u.width,"stroke-linecap":"round","pointer-events":"none"});u.dash&&N.setAttribute("stroke-dasharray",u.dash),m.appendChild(k),m.appendChild(N),x&&(m.classList.add("rmg-conn--clickable"),m.addEventListener("click",()=>{p.querySelectorAll(".rmg-conn--selected").forEach(M=>M.classList.remove("rmg-conn--selected")),p.querySelectorAll(".rmg-zone--selected").forEach(M=>M.classList.remove("rmg-zone--selected")),m.classList.add("rmg-conn--selected"),x(t.index,t.kind)})),p.appendChild(m)}
1for(const t of e.zones){const u=!!a&&t.name===a,c=h("g",{class:u?"rmg-zone rmg-zone--selected":"rmg-zone"});c.setAttribute("data-role",t.category),c.setAttribute("data-num",t.label),c.setAttribute("data-zone-name",t.name),c.setAttribute("data-size",String(t.size)),c.setAttribute("data-castle",t.hasCastle?"1":"0"),c.setAttribute("data-guard",String(t.guardMultiplier)),c.setAttribute("data-treasure",String(t.treasure)),c.setAttribute("data-res",String(t.resources)),f&&(c.classList.add("rmg-zone--clickable"),c.addEventListener("click",()=>{p.querySelectorAll(".rmg-zone--selected, .rmg-conn--selected").forEach(k=>k.classList.remove("rmg-zone--selected","rmg-conn--selected")),c.classList.add("rmg-zone--selected"),f(t.name,t.category)})),c.appendChild(h("circle",{class:"rmg-zone-disc",cx:t.x,cy:t.y,r:D,fill:`url(#rmg-grad-${t.category})`,stroke:"#caa14a","stroke-width":3.5,filter:"url(#rmg-shadow)"}));const m=F(t.category,t.hasCastle);if(m){const k=H(m,t.x,t.y,D*1.05,S);k.setAttribute("class","rmg-zone-icon"),c.appendChild(k)}if(t.category==="player"&&c.appendChild(I(t.x,t.y,D)),!m&&t.label){const k=h("text",{x:t.x,y:t.y+6,"text-anchor":"middle","pointer-events":"none","font-family":'Georgia, "Times New Roman", serif',"font-size":18,"font-weight":"bold",fill:"#f4e7c8",stroke:"#3a1c0c","stroke-width":.7,"paint-order":"stroke"});k.textContent=t.label,c.appendChild(k)}p.appendChild(c)}if(r){const t=i.clientWidth||Math.min(y,document.documentElement.clientWidth-32)||y,u=Math.max(1,y/t*.8),c=J(p,e,r,s,d?"stone":"parchment",u,u>1.2);c>0&&(p.setAttribute("viewBox",`0 0 ${y} ${b+c}`),C.setAttribute("height",String(b+c)))}if(o){const t=document.createElement("div");t.className="rmg-map-tooltip",t.hidden=!0,i.replaceChildren(p,t),K(i,p,t,o)}else i.replaceChildren(p)}function A(i,e){return i.replace(/\{(\w+)\}/g,(n,r)=>String(e[r]??""))}function j(i,e){const n=o=>o.replace(/[&<>]/g,a=>a==="&"?"&":a==="<"?"<":">"),r=i.dataset,s=[];if(i.classList.contains("rmg-zone")){const o=r.role??"";let a;if(o==="player")a=A(e.player??"Player {n}",{n:r.num??""});else if(o==="town")a=e.town??"Neutral town";else if(o==="hub")a=e.hub??"Central hub";else{const x=o==="low"?e.low:o==="medium"?e.medium:o==="high"?e.high:"";a=(e.neutral??"Neutral zone")+(x?` â ${x}`:"")}s.push(`<strong>${n(a)}</strong>`);const f=Number(r.size);f>0&&s.push(n(A(e.size??"Size {n}Ã",{n:f.toFixed(1).replace(/\.0$/,"")}))),r.castle==="1"&&s.push(n(e.castle??"Has a castle"));const g=Number(r.guard);g>0&&Math.abs(g-1)>.01&&s.push(n(A(e.guards??"Guards: {s}",{s:`${g.toFixed(1).replace(/\.0$/,"")}Ã`}))),Number(r.treasure)>0&&s.push(n(A(e.treasure??"Treasure â {n}",{n:r.treasure??""}))),Number(r.res)>0&&s.push(n(A(e.resources??"Resources â {n}",{n:r.res??""})))}else{const o=r.conn??"Direct",a=o==="Portal"?e.connPortal??"Portal":o==="Proximity"?e.connProximity??"Proximity link":o==="Direct"?e.connDirect??"Direct route":e.connDefault??"Route";s.push(`<strong>${n(a)}</strong>`),Number(r.guard)>0?s.push(n(A(e.borderGuard??"Border guard â {n}",{n:r.guard??""}))):o==="Direct"&&s.push(n(e.open??"Open â no border guard")),r.road==="1"&&s.push(n(e.road??"Has a road"))}return s.join("<br>")}function K(i,e,n,r){e.addEventListener("mousemove",s=>{const o=s.target.closest(".rmg-zone, .rmg-conn");if(!o){n.hidden=!0;return}n.innerHTML=j(o,r),n.hidden=!1;const a=i.getBoundingClientRect(),f=n.offsetWidth,g=n.offsetHeight;let x=s.clientX-a.left+14,d=s.clientY-a.top+14;x+f>a.width&&(x=s.clientX-a.left-f-14),d+g>a.height&&(d=s.clientY-a.top-g-14),n.style.left=`${Math.max(2,x)}px`,n.style.top=`${Math.max(2,d)}px`}),e.addEventListener("mouseleave",()=>{n.hidden=!0})}function J(i,e,n,r,s,o=1,a=!1){const f=new Set(e.zones.map(l=>l.category));e.zones.some(l=>l.hasCastle&&l.category!=="player"&&l.category!=="hub")&&f.add("town");const g=["player","town","hub"].filter(l=>f.has(l)),x=["low","medium","high"].filter(l=>f.has(l));if(g.length===0&&x.length===0)return 0;const d=16*o,z=7*o,S=18*o,y=24*o,b=12*o,p=14*o,L=12,G=l=>l.length*p*.58,v=Math.max(120,e.width-L*2-b*2),C=[];let t=0,u=0,c=0;const m=l=>{u>0&&u+l>v&&(t++,u=0);const w=u;return u+=l,c=Math.max(c,u),w},k=(l,w)=>{if(l.length!==0){if(C.length>0&&(t++,u=0),w){const $=m(G(w)+8);C.push({kind:"caption",label:w,x:$,row:t})}for(const $ of l){const E=n[$]??$,P=m(d+z+G(E));C.push({kind:"swatch",cat:$,label:E,x:P,row:t}),u+=S}}};k(g),k(x,r);
1const N=t+1,M=Math.min(c,v)+b*2,T=N*y+b*2-(y-d),R=L,X=a?e.height:e.height-T-L;i.appendChild(h("rect",{x:R,y:X,width:M,height:T,rx:8,fill:"rgba(28,18,8,0.65)"}));for(const l of C){const w=R+b+l.x,$=X+b+d/2+l.row*y;if(l.kind==="swatch"){i.appendChild(h("rect",{x:w,y:$-d/2,width:d,height:d,rx:3,fill:V[s][l.cat??""]??"#888888",stroke:"rgba(0,0,0,0.3)","stroke-width":1}));const P=l.cat==="player"?O.flag:F(l.cat??"",!1);P&&i.appendChild(H(P,w+d/2,$,d*.72,B[s]))}const E=h("text",{x:l.kind==="swatch"?w+d+z:w,y:$+5*o,"font-family":"sans-serif","font-size":p,fill:"#f4e7c8"});E.textContent=l.label,i.appendChild(E)}return a?T+L:0}function Q(i,e){const n=/^#?([0-9a-f]{6})$/i.exec(i);if(!n)return i;const r=parseInt(n[1],16),s=g=>Math.round(g+(255-g)*e),o=s(r>>16&255),a=s(r>>8&255),f=s(r&255);return`#${(1<<24|o<<16|a<<8|f).toString(16).slice(1)}`}export{tt as p};
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.