Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@americana/maplibre-shield-generator

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@americana/maplibre-shield-generator - npm Package Compare versions

Comparing version 0.0.3-test-1 to 0.0.4-dev0

docs/.nojekyll

4

dist/index.js

@@ -1,3 +0,3 @@

var Ze=Object.create;var ge=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var nt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ot=(t,e,i,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!lt.call(t,n)&&n!==i&&ge(t,n,{get:()=>e[n],enumerable:!(l=et(e,n))||l.enumerable});return t};var rt=(t,e,i)=>(i=t!=null?Ze(it(t)):{},ot(e||!t||!t.__esModule?ge(i,"default",{value:t,enumerable:!0}):i,t));var Se=nt((Ot,ye)=>{"use strict";ye.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var te=rt(Se(),1),we=at,ce={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function at(t){var e,i=[],l=1,n;if(typeof t=="string")if(te.default[t])i=te.default[t].slice(),n="rgb";else if(t==="transparent")l=0,n="rgb",i=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var o=t.slice(1),r=o.length,s=r<=4;l=1,s?(i=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],r===4&&(l=parseInt(o[3]+o[3],16)/255)):(i=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],r===8&&(l=parseInt(o[6]+o[7],16)/255)),i[0]||(i[0]=0),i[1]||(i[1]=0),i[2]||(i[2]=0),n="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],g=h==="rgb",o=h.replace(/a$/,"");n=o;var r=o==="cmyk"?4:o==="gray"?1:3;i=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(a,f){if(/%$/.test(a))return f===r?parseFloat(a)/100:o==="rgb"?parseFloat(a)*255/100:parseFloat(a);if(o[f]==="h"){if(/deg$/.test(a))return parseFloat(a);if(ce[a]!==void 0)return ce[a]}return parseFloat(a)}),h===o&&i.push(1),l=g||i[r]===void 0?1:i[r],i=i.slice(0,r)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(i=t.match(/([0-9]+)/g).map(function(y){return parseFloat(y)}),n=t.match(/([a-z])/ig).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(i=[t[0],t[1],t[2]],n="rgb",l=t.length===4?t[3]:1):t instanceof Object&&(t.r!=null||t.red!=null||t.R!=null?(n="rgb",i=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(n="hsl",i=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),l=t.a||t.alpha||t.opacity||1,t.opacity!=null&&(l/=100)):(n="rgb",i=[t>>>16,(t&65280)>>>8,t&255]);return{space:n,values:i,alpha:l}}var U={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var j={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e=t[0]/360,i=t[1]/100,l=t[2]/100,n,o,r,s,h;if(i===0)return h=l*255,[h,h,h];l<.5?o=l*(1+i):o=l+i-l*i,n=2*l-o,s=[0,0,0];for(var g=0;g<3;g++)r=e+1/3*-(g-1),r<0?r++:r>1&&r--,6*r<1?h=n+(o-n)*6*r:2*r<1?h=o:3*r<2?h=n+(o-n)*(2/3-r)*6:h=n,s[g]=h*255;return s}};U.hsl=function(t){var e=t[0]/255,i=t[1]/255,l=t[2]/255,n=Math.min(e,i,l),o=Math.max(e,i,l),r=o-n,s,h,g;return o===n?s=0:e===o?s=(i-l)/r:i===o?s=2+(l-e)/r:l===o&&(s=4+(e-i)/r),s=Math.min(s*60,360),s<0&&(s+=360),g=(n+o)/2,o===n?h=0:g<=.5?h=r/(o+n):h=r/(2-o-n),[s,h*100,g*100]};function E(t){Array.isArray(t)&&t.raw&&(t=String.raw(...arguments));var e,i,l,n=we(t);if(!n.space)return[];let o=n.space[0]==="h"?j.min:U.min,r=n.space[0]==="h"?j.max:U.max;return e=Array(3),e[0]=Math.min(Math.max(n.values[0],o[0]),r[0]),e[1]=Math.min(Math.max(n.values[1],o[1]),r[1]),e[2]=Math.min(Math.max(n.values[2],o[2]),r[2]),n.space[0]==="h"&&(e=j.rgb(e)),e.push(Math.min(Math.max(n.alpha,0),1)),e}var dt='"sans-serif-condensed", "Arial Narrow", sans-serif',X=(t,e)=>`bold ${t}px ${e||dt}`,q=12;function ie(t,e,i){return 255-t/255*(255-i)-(1-t/255)*(255-e)}function ht(t,e,i,l){e[l]=t[i],e[l+1]=t[i+1],e[l+2]=t[i+2],e[l+3]=t[i+3]}function st(t,e,i,l,n,o){e[l]=ie(t[i],n[0],o[0]),e[l+1]=ie(t[i+1],n[1],o[1]),e[l+2]=ie(t[i+2],n[2],o[2]),e[l+3]=t[i+3]}function le(t,e,i,l,n,o){let r=t.createImageData(e.data.width,e.data.height),s=n||o?st:ht,h=n?E(n):E("#000"),g=o?E(o):E("#fff");if(l)for(let y=0;y<e.data.height;y++)for(let u=0;u<e.data.width;u++){let f=((e.data.height-y-1)*e.data.width+u)*4,p=(y*e.data.width+u)*4;s(e.data.data,r.data,p,f,h,g)}else for(let y=0;y<e.data.data.length;y+=4)s(e.data.data,r.data,y,y,h,g);t.putImageData(r,0,i)}var A={Middle:"middle",Top:"top",Bottom:"bottom"};function be(t,e){var i=t.width,l=t.height,n=e.width,o=e.height;return i*l/Math.sqrt(i*i*o*o+l*l*n*n)}function ut(t,e){return{scale:be(t,e),valign:A.Middle}}function ft(t,e){return{scale:be(t,{height:e.width/2,width:e.height}),valign:A.Top}}function Ce(t,e){var i=t.height/e.height,l=t.width/e.width;return{scale:Math.min(l,i),valign:A.Middle}}function pt(t,e,i){let l=2;return i!==void 0&&i.radius!==void 0&&(l=i.radius),Ce({width:t.width-l*(2-Math.sqrt(2)),height:t.height-l*(2-Math.sqrt(2))},e)}function ke(t,e){let i=t.width,l=t.height,n=e.width,o=e.height;return{scale:i*l/(l*n+i*o),valign:A.Middle}}function gt(t,e){return{scale:ke(t,e).scale,valign:A.Top}}function yt(t,e,i,l,n,o){var r=t.px(i.top)||0,s=t.px(i.bottom)||0,h=t.px(i.left)||0,g=t.px(i.right)||0,y=t.px(o),u=t.gfxFactory.createGraphics(l);u.font=X(q,t.options.shieldFont),u.textAlign="center",u.textBaseline="top";var a=u.measureText(e),f=a.width,p=a.actualBoundingBoxDescent,S=l.height-r-s,d=l.width-h-g,c=h+d/2;let w=We[n.constraintFunc],x=w({height:S,width:d},{height:p,width:f},n.options);var C=Math.min(y,q*x.scale);u.font=X(C,t.options.shieldFont),u.textAlign="center",u.textBaseline="top",a=u.measureText(e),p=a.actualBoundingBoxDescent;var b;switch(x.valign){case A.Top:b=r;break;case A.Bottom:b=r+S-p;break;case A.Middle:default:b=r+(S-p)/2;break}return{xBaseline:c,yBaseline:b,fontPx:C}}var St={padding:{top:0,bottom:0,left:0,right:0}};function J(t,e,i,l){i==null&&(i=St);var n=i.padding||{},o={constraintFunc:"rect"},r=14;return typeof i.textLayout!="undefined"&&(o=i.textLayout),typeof i.maxFontSize!="undefined"&&(r=Math.min(r,i.maxFontSize)),yt(t,e,n,l,o,r)}function me(t,e,i,l){Te(t,e,l),e.fillText(i,l.xBaseline,l.yBaseline)}function ne(t,e,i,l){Te(t,e,l),e.shadowColor=e.strokeStyle,e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(i,l.xBaseline,l.yBaseline),e.shadowColor=null,e.shadowBlur=null}function Te(t,e,i){e.textAlign="center",e.textBaseline="top",e.font=X(i.fontPx,t.options.shieldFont)}function ve(t,e,i,l){Re(t,e,i,l,!0)}function Me(t,e,i,l){Re(t,e,i,l,!1)}function Re(t,e,i,l,n){let o={padding:{top:t.options.bannerPadding,bottom:0,left:0,right:0}};var r=J(t,i,o,{width:e.canvas.width,height:t.px(t.options.bannerHeight-t.options.bannerPadding)});e.font=X(r.fontPx,t.options.shieldFont),e.textBaseline="top",e.textAlign="center",n?(e.fillStyle=t.options.bannerTextColor,e.fillText(i,r.xBaseline,r.yBaseline+l*t.px(t.options.bannerHeight-t.options.bannerPadding))):(e.strokeStyle=e.shadowColor=t.options.bannerTextHaloColor,e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(i,r.xBaseline,r.yBaseline+l*t.px(t.options.bannerHeight-t.options.bannerPadding)),e.shadowColor=null,e.shadowBlur=null)}function oe(t,e,i){var l=t.emptySprite();return l.font=X(i,t.options.shieldFont),Math.ceil(l.measureText(e).width)}var We={};function N(t,e){We[t]=e}N("diamond",ke);N("ellipse",ut);N("rect",Ce);N("roundedRect",pt);N("southHalfEllipse",ft);N("triangleDown",gt);function ct(t,e,i){Q(t,e,{fillColor:"white",strokeColor:"black",outlineWidth:1,radius:2,rectWidth:20});let l=i.fillColor,n=t.px(.5),o=t.shieldSize()/3-n;return e.beginPath(),e.arc(t.shieldSize()/2,t.shieldSize()/2,o,0,2*Math.PI,!1),e.fillStyle=l,e.strokeStyle=i.strokeColor,e.fill(),e.lineWidth=n,e.stroke(),e}function wt(t,e,i){Q(t,e,{fillColor:"#006747",strokeColor:"white",outlineWidth:1,radius:2,rectWidth:20});let l=i.fillColor,n=t.px(.5),o=.15*t.shieldSize()+n,r=.7*t.shieldSize()-2*n,s=.4*t.shieldSize()+n,h=.45*t.shieldSize()-2*n;return e.beginPath(),e.rect(o,s,r,h),e.fillStyle=l,e.strokeStyle=i.strokeColor,e.fill(),e.lineWidth=n,e.stroke(),e}function Pe(){I("branson",wt,20),I("paBelt",ct,20)}var Ie=20,ze=34,_e=18;function z(t,e,i,l){if(re[l]!==void 0)return t.px(re[l]);let n=e.rectWidth==null?null:e.rectWidth,o=e.angle==null?0:e.angle,r=Math.tan(o);if(n==null){let s=oe(t,i,t.px(_e))+t.px(2),h=t.px(Ie);switch(l){case"pentagon":let g=e.offset==null?0:e.offset;s+=(t.shieldSize()-t.px(g))*r/2;break;case"trapezoid":s+=t.shieldSize()*r/2;break;case"triangle":h+=t.px(2);break;case"diamond":case"hexagonHorizontal":h+=t.px(4);break}return Math.max(h,Math.min(t.px(ze),s))}else return t.px(n)}function xt(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=z(t,i,l),s=t.px(1),h=r/2-s,g=t.shieldSize()/2-s;return e.beginPath(),e.ellipse(e.canvas.width/2,t.shieldSize()/2,h,g,0,2*Math.PI,!1),e.fillStyle=n,e.fill(),e.lineWidth=s,e.strokeStyle=o,e.stroke(),r}function He(t,e){var i=oe(t,e,t.px(_e))+t.px(2),l=Math.max(t.px(Ie),Math.min(t.px(ze),i));return t.gfxFactory.createGraphics({width:l,height:t.shieldSize()})}function Q(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=i.radius==null?0:i.radius,s=i.outlineWidth==null?1:i.outlineWidth,h=z(t,i,l),g=t.px(s),y=g/2,u=t.px(r),a=y,f=y+u,p=h-y-u,S=h-y,d=y,c=y+u,w=t.shieldSize()-y-u,x=t.shieldSize()-y;return e.beginPath(),e.moveTo(p,d),e.arcTo(S,d,S,c,u),e.arcTo(S,x,p,x,u),e.arcTo(a,x,a,w,u),e.arcTo(a,d,f,d,u),e.closePath(),e.lineWidth=g,e.fillStyle=n,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),h}function bt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=z(t,i,l),y=t.px(h),u=y/2,a=t.px(s),f=t.px(n),p=u,S=g-u,d=u,c=t.shieldSize()-u,w=p+a,x=(p+S)/2,C=d+a,b=c-f,m=(2*p+x)/3,k=(x+2*S)/3,T=(b+c)/2,M=(T+2*c)/3;return e.beginPath(),e.moveTo(x,c),e.bezierCurveTo(m,M,p,T,p,b),e.arcTo(p,d,w,d,a),e.arcTo(S,d,S,C,a),e.lineTo(S,b),e.bezierCurveTo(S,T,k,M,x,c),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),g}function Ct(t,e,i,l){let n=i.pointUp==null?!1:i.pointUp,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.outlineWidth==null?1:i.outlineWidth,h=n?-1:1,g=z(t,i,l),y=t.px(s),u=y/2,a=u,f=g-u,p=n?t.shieldSize()-u:u,S=n?u:t.shieldSize()-u,d=a+t.px(1),c=a+t.px(2.5),w=(a+f)/2,x=f-t.px(2.5),C=f-t.px(1),b=p+h*t.px(2),m=p+h*t.px(4.5),k=p+h*t.px(7),T=S-h*t.px(6),M=S-h*t.px(1),v=(a+w)/2,R=(w+f)/2;e.beginPath(),e.moveTo(w,S),e.bezierCurveTo(v,M,a,T,a,k),e.bezierCurveTo(a,m,d,b,c,p),e.lineTo(x,p),e.bezierCurveTo(C,b,f,m,f,k),e.bezierCurveTo(f,T,R,M,w,S),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke())}function kt(t,e,i,l){let n=i.pointUp==null?!1:i.pointUp,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=n?-1:1,y=z(t,i,l,"triangle"),u=t.px(h),a=u/2,f=t.px(s),p=a,S=y-a,d=n?t.shieldSize()-a:a,c=n?a:t.shieldSize()-a,w=p+f,x=(p+S)/2,C=S-f,b=d+g*f,m=Math.atan((x-w)/Math.abs(c-f-b)),k=Math.sin(m),T=Math.cos(m),M=Math.tan(m/2),v=Math.tan(Math.PI/4-m/2),R=w-f*T,W=x-f*v,F=x+f*v,_=C+f*T,B=b+g*f*M,P=b+g*f*k,H=c-g*f*(1-k);return e.beginPath(),e.moveTo(x,c),e.arcTo(W,c,R,P,f),e.arcTo(p,B,p,b,f),e.arcTo(p,d,w,d,f),e.arcTo(S,d,S,b,f),e.arcTo(S,B,_,P,f),e.arcTo(F,c,x,c,f),e.closePath(),e.lineWidth=u,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),y}function mt(t,e,i,l){let n=i.shortSideUp==null?!1:i.shortSideUp,o=i.angle==null?0:i.angle,r=i.fillColor==null?"white":i.fillColor,s=i.strokeColor==null?"black":i.strokeColor,h=i.radius==null?0:i.radius,g=i.outlineWidth==null?1:i.outlineWidth,y=n?-1:1,u=Math.sin(o),a=Math.cos(o),f=Math.tan(o),p=z(t,i,l,"trapezoid"),S=t.px(g),d=S/2,c=t.px(h),w=d,x=p-d,C=n?t.shieldSize()-d:d,b=n?d:t.shieldSize()-d,m=C+y*c*(1+u),k=b-y*c*(1-u),T=w+(m-C)*f,M=T+c*a,v=w+y*(k-C)*f,R=w+y*(b-C)*f,W=v+y*c*a,F=p-R,_=p-v,B=p-M;return e.beginPath(),e.moveTo(B,C),e.arcTo(x,C,_,k,c),e.arcTo(F,b,W,b,c),e.arcTo(R,b,T,m,c),e.arcTo(w,C,B,C,c),e.closePath(),e.lineWidth=S,e.fillStyle=r,e.fill(),s!=null&&(e.strokeStyle=s,e.stroke()),p}function Tt(t,e,i,l){let n=i.fillColor==null?"white":i.fillColor,o=i.strokeColor==null?"black":i.strokeColor,r=i.radius==null?0:i.radius,s=i.outlineWidth==null?1:i.outlineWidth,h=Y(t,"diamond"),g=z(t,i,l,"diamond"),y=t.px(s),u=y/2,a=t.px(r),f=u,p=g-u,S=u,d=h-u,c=(f+p)/2,w=(S+d)/2,x=Math.atan((c-a-f)/(d-a-w)),C=Math.sin(x),b=Math.cos(x),m=Math.tan(x/2),k=Math.tan(Math.PI/4-x/2),T=f+a*(1-b),M=c-a*b,v=c-a*k,R=c+a*k,W=c+a*b,F=p-a*(1-b),_=S+a*(1-C),B=w-a*C,P=w-a*m,H=w+a*m,G=w+a*C,O=d-a*(1-C);return e.beginPath(),e.moveTo(c,d),e.arcTo(v,d,T,G,a),e.arcTo(f,H,f,w,a),e.arcTo(f,P,M,_,a),e.arcTo(v,S,c,S,a),e.arcTo(R,S,F,B,a),e.arcTo(p,P,p,w,a),e.arcTo(p,H,W,O,a),e.arcTo(R,d,c,d,a),e.closePath(),e.lineWidth=y,e.fillStyle=n,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),g}function vt(t,e,i,l){let n=i.pointUp==null?!0:i.pointUp,o=i.offset==null?0:i.offset,r=i.angle==null?0:i.angle,s=i.fillColor==null?"white":i.fillColor,h=i.strokeColor==null?"black":i.strokeColor,g=i.radius1==null?0:i.radius1,y=i.radius2==null?0:i.radius2,u=i.outlineWidth==null?1:i.outlineWidth,a=n?-1:1,f=Math.sin(r),p=Math.cos(r),S=Math.tan(r),d=z(t,i,l,"pentagon"),c=t.px(u),w=c/2,x=t.px(g),C=t.px(y),b=t.px(o),m=w,k=d-w,T=n?t.shieldSize()-w:w,M=n?w:t.shieldSize()-w,v=M-a*b,R=m+a*(v-T)*S,W=(m+k)/2,F=k-a*(v-T)*S,_=Math.atan(b/(W-m)),B=(Math.PI/2-_+r)/2,P=Math.tan(B),H=(Math.PI/2-r)/2,G=Math.tan(H),O=m+x*P*f,V=R+C*G,D=F-C*G,L=k-x*P*f,$=v-a*x*P*p;return e.beginPath(),e.moveTo(W,M),e.arcTo(m,v,O,$,x),e.arcTo(R,T,V,T,C),e.lineTo(D,T),e.arcTo(F,T,L,$,C),e.arcTo(k,v,W,M,x),e.closePath(),e.lineWidth=c,e.fillStyle=s,e.fill(),h!=null&&(e.strokeStyle=h,e.stroke()),d}function Mt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=z(t,i,l),y=t.px(h),u=y/2,a=t.px(s),f=t.px(n),p=u,S=g-u,d=u,c=t.shieldSize()-u,w=(p+S)/2,x=d+f,C=c-f,b=a*Math.tan(Math.PI/4-Math.asin(f/(w-p))/2),m=x+b,k=C-b;return e.beginPath(),e.moveTo(w,c),e.arcTo(p,C,p,k,a),e.arcTo(p,x,w,d,a),e.lineTo(w,d),e.arcTo(S,x,S,m,a),e.arcTo(S,C,w,c,a),e.lineTo(w,c),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),g}function Rt(t,e,i,l){let n=i.angle==null?0:i.angle,o=i.fillColor==null?"white":i.fillColor,r=i.strokeColor==null?"black":i.strokeColor,s=i.radius==null?0:i.radius,h=i.outlineWidth==null?1:i.outlineWidth,g=Math.sin(n),y=Math.cos(n),u=Math.tan(n),a=Math.tan(Math.PI/4-n/2),f=z(t,i,l,"hexagonHorizontal"),p=t.px(h),S=p/2,d=t.px(s),c=S,w=f-S,x=S,C=t.shieldSize()-S,b=(x+C)/2,m=x+d*a*y,k=b-d*g,T=b+d*g,M=C-d*a*y,v=c+(b-k)*u,R=c+(b-x)*u,W=w-(b-x)*u,F=w-(b-k)*u,_=R-d*a*g,B=R+d*a,P=W-d*a,H=W+d*a*g;return e.beginPath(),e.moveTo(B,x),e.arcTo(W,x,H,m,d),e.arcTo(w,b,F,T,d),e.arcTo(W,C,P,C,d),e.arcTo(R,C,_,M,d),e.arcTo(c,b,v,k,d),e.arcTo(R,x,B,x,d),e.closePath(),e.lineWidth=p,e.fillStyle=o,e.fill(),r!=null&&(e.strokeStyle=r,e.stroke()),f}function Wt(t,e,i,l){let n=i.offset==null?0:i.offset,o=i.angle==null?0:i.angle,r=i.fillColor==null?"white":i.fillColor,s=i.strokeColor==null?"black":i.strokeColor,h=i.radius==null?0:i.radius,g=i.outlineWidth==null?1:i.outlineWidth,y=Math.sin(o),u=Math.cos(o),a=Math.tan(o),f=z(t,i,l),p=t.px(g),S=p/2,d=t.px(h),c=t.px(n),w=S,x=f-S,C=S,b=t.shieldSize()-S,m=w+d*a*y,k=(w+x)/2,T=x-d*a*y,M=C+c,v=(C+b)/2,R=b-c,W=w+(v-M)*a,F=x-(v-M)*a,_=v-d*a*u,B=v+d*a*u,P=Math.atan(c/(k-W)),H=Math.sin(P),G=Math.cos(P),O=(Math.PI/2-o-P)/2,V=Math.cos(O),D=d*Math.cos(o+O)/V,L=d*Math.sin(o+O)/V,$=W+D-d*u,Ve=W+D-d*H,$e=F-D+d*H,je=F-D+d*u,Je=M+L-d*G,Qe=M+L-d*y,Ye=R-L+d*y,Ke=R-L+d*G;return e.beginPath(),e.moveTo(k,b),e.arcTo(W,R,$,Ye,d),e.arcTo(w,v,m,_,d),e.arcTo(W,M,Ve,Je,d),e.lineTo(k,C),e.arcTo(F,M,je,Qe,d),e.arcTo(x,v,T,B,d),e.arcTo(F,R,$e,Ke,d),e.lineTo(k,b),e.closePath(),e.lineWidth=p,e.fillStyle=r,e.fill(),s!=null&&(e.strokeStyle=s,e.stroke()),f}function Y(t,e){switch(e){case"diamond":return t.shieldSize()+t.px(4);default:return t.shieldSize()}}function Ae(t,e,i,l,n){return Ge[e](t,i,l,n)}var Ge={},re={};function I(t,e,i){Ge[t]=e,i!==void 0&&(re[t]=i)}I("diamond",Tt);I("ellipse",xt);I("escutcheon",bt);I("fishhead",Ct);I("hexagonVertical",Mt);I("hexagonHorizontal",Rt);I("octagonVertical",Wt);I("pentagon",vt);I("roundedRectangle",Q);I("trapezoid",mt);I("triangle",kt);Pe();function Oe(t,e,i,l){if(i==null||typeof i.banners=="undefined")return e;for(var n=0;n<i.banners.length;n++)l(t,e,i.banners[n],n);return e}function Ft(t,e,i){return{width:e.width,height:e.height+i*t.px(t.options.bannerHeight+t.options.bannerPadding)}}function ae(t){return t!==null&&t.length!==0&&t.length<=6}function de(t){return t==null||typeof t.banners=="undefined"?0:t.banners.length}function De(t,e,i){var l=null,n,o=0,r;if(Array.isArray(e.spriteBlank))for(var s=0;s<e.spriteBlank.length&&(l=t.spriteRepo.getSprite(e.spriteBlank[s]),r=Ft(t,l.data,o),n=J(t,i.ref,e,r),!(n.fontPx>t.px(q)));s++);else l=t.spriteRepo.getSprite(e.spriteBlank);return l}function Pt(t){return t!=null&&typeof t.textColor!="undefined"?t.textColor:"black"}function Le(t){return typeof t.shapeBlank!="undefined"?(e,i,l)=>Ae(e,t.shapeBlank.drawFunc,i,t.shapeBlank.params,l):He}function Bt(t,e,i,l){let o=de(i)*t.px(t.options.bannerHeight);e.save(),e.translate(0,o),Le(i)(t,e,l.ref),e.restore()}function It(t,e){return typeof e.shapeBlank!="undefined"?Y(t,e.shapeBlank.drawFunc):t.shieldSize()}function zt(t,e,i,l){var n=de(i),o=null,r=De(t,i,l);let s=n*t.px(t.options.bannerHeight);if(r==null?(e.translate(0,s),Le(i)(t,e,l.ref),e.translate(0,-s),o={width:e.canvas.width,height:It(t,i)}):o={width:r.data.width,height:r.data.height},i.notext)return e;var h=J(t,l.ref,i,o);return h.yBaseline+=n*t.px(t.options.bannerHeight),typeof t.options.SHIELD_TEXT_HALO_COLOR_OVERRIDE!="undefined"?(e.strokeStyle=options.SHIELD_TEXT_HALO_COLOR_OVERRIDE,ne(t,e,l.ref,h)):i.textHaloColor&&(e.strokeStyle=i.textHaloColor,ne(t,e,l.ref,h)),e.fillStyle=Pt(i),me(t,e,l.ref,h),t.options.SHIELD_TEXT_BBOX_COLOR&&(e.strokeStyle=t.options.SHIELD_TEXT_BBOX_COLOR,e.lineWidth=t.px(1),e.strokeRect(t.px(i.padding.left-.5),n*t.px(t.options.bannerHeight)+t.px(i.padding.top-.5),o.width-t.px(i.padding.left+i.padding.right-1),o.height-t.px(i.padding.top+i.padding.bottom-1))),e}function Ee(t,e){let i=he(t,e);i==null&&(console.warn("Didn't produce a shield for",JSON.stringify(e)),i=t.gfxFactory.createGraphics({width:1,height:1})),Xe(t,e.spriteID,i)}function Xe(t,e,i){let l=i.getImageData(0,0,i.canvas.width,i.canvas.height);t.spriteRepo.putSprite(e,{width:i.canvas.width,height:i.canvas.height,data:l.data},t.px(1))}function Ne(t,e){Xe(t,e,t.emptySprite())}function Ue(t,e){return e.refsByName&&t.name&&e.refsByName[t.name]?e.refsByName[t.name]:t.ref}function _t(t,e){var i=t[e.network];if(e==null)return null;if(i==null)return console.debug("Generic shield for",JSON.stringify(e)),ae(e.ref)?t.default:null;var l=Ue(e,i);return i.overrideByRef&&(i={...i,...i.overrideByRef[l]}),i.overrideByName&&(i={...i,...i.overrideByName[e.name||""]}),!ae(l)&&"noref"in i&&(i=i.noref,i.notext=!0),!ae(l)&&!i.notext&&!(i.refsByName&&e.name)?null:i}function Ht(t){let e=parseInt(t,10);if(isNaN(e))return t;let i="M".repeat(e/1e3)+"D".repeat(e%1e3/500)+"C".repeat(e%500/100)+"L".repeat(e%100/50)+"X".repeat(e%50/10)+"V".repeat(e%10/5)+"I".repeat(e%5);return i=i.replace("DCCCC","CM").replace("CCCC","CD").replace("LXXXX","XC").replace("XXXX","XL").replace("VIIII","IX").replace("IIII","IV"),i+t.slice(e.toString().length)}function At(t,e,i){let l=Math.max(t.shieldSize(),z(t,e.shapeBlank.params,i,e.shapeBlank.drawFunc)),n=Y(t,e.shapeBlank.drawFunc);return{width:l,height:n}}function he(t,e){let i=_t(t.shieldDef,e);if(i==null)return null;e.ref=Ue(e,i);let l=de(i),n=De(t,i,e),o=t.shieldSize(),r=t.shieldSize();if(n==null){if(typeof i.shapeBlank!="undefined"){let g=At(t,i,e.ref);o=g.width,r=g.height}}else o=n.data.width,r=n.data.height;let s=l*t.px(t.options.bannerHeight);r+=s;let h=t.gfxFactory.createGraphics({width:o,height:r});return e.ref&&i.numberingSystem==="roman"&&(e.ref=Ht(e.ref)),Oe(t,h,i,Me),n==null?Bt(t,h,i,e):le(h,n,s,i.verticalReflect,i.colorLighten,i.colorDarken),zt(t,h,i,e),Oe(t,h,i,ve),h}function qe(){return(typeof window!="undefined"&&window.devicePixelRatio)>1?2:1}var K=class{createGraphics(e){var i=document.createElement("canvas").getContext("2d"),i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});return i.imageSmoothingQuality="high",i.textAlign="center",i.textBaseline="top",i.canvas.width=e.width,i.canvas.height=e.height,i}pixelRatio(){return qe()}};var se=class{emptySprite(){return this._emptySpriteCache||(this._emptySpriteCache=this.gfxFactory.createGraphics({width:1,height:1})),this._emptySpriteCache}px(e){return e*this.gfxFactory.pixelRatio()}shieldSize(){return this.px(this.options.shieldSize)}},ue=class{constructor(e){this.map=e}getSprite(e){return this.map.style.getImage(e)}putSprite(e,i,l){this.map.addImage(e,i,{pixelRatio:l})}},Z=class{constructor(e){this._shieldPredicate=()=>!0;this._networkPredicate=()=>!0;this._shieldDefCallbacks=[];this._routeParser=e,this._renderContext=new se,this._renderContext.gfxFactory=new K}setShields(e){this._renderContext.options=e.options,this._renderContext.shieldDef=e.networks,this._shieldDefCallbacks.forEach(i=>i(e.networks))}getShieldDefinitions(){return this._renderContext.shieldDef}debugOptions(e){return this._renderContext.debugOptions=e,this}filterImageID(e){return this._shieldPredicate=e,this}filterNetwork(e){return this._networkPredicate=e,this}graphicsFactory(e){return this._renderContext.gfxFactory=e,this}renderOnMaplibreGL(e){return this.renderOnRepository(new ue(e)),e.on("styleimagemissing",this.getStyleImageMissingHandler()),this}onShieldDefLoad(e){return this._renderContext.shieldDef?e(this._renderContext.shieldDef):this._shieldDefCallbacks.push(e),this}renderOnRepository(e){return this._renderContext.spriteRepo||(this._renderContext.spriteRepo=e),this}getStyleImageMissingHandler(){return e=>{try{if(!this._shieldPredicate(e.id))return;let i=this._routeParser.parse(e.id);if(!this._networkPredicate(i.network)){Ne(this._renderContext,e.id);return}i.spriteID=e.id,this._renderContext.debugOptions=this.debugOptions,i&&Ee(this._renderContext,i)}catch(i){console.error(`Exception while loading image \u2018${e==null?void 0:e.id}\u2019:
`,i)}}}getGraphicForRoute(e,i,l){return he(this._renderContext,{network:e,ref:i,name:l,spriteID:this._routeParser.format(e,i,l)})}emptySprite(){return this._renderContext.emptySprite()}createGraphics(e){return this._renderContext.gfxFactory.createGraphics(e)}pixelRatio(){return this._renderContext.px(1)}},fe=class extends Z{constructor(e,i){super(i),this.setShields(e)}},pe=class extends Z{constructor(e,i){super(i),this.setShieldURL(e)}async setShieldURL(e){await fetch(e).then(i=>i.json()).then(i=>super.setShields(i)).catch(i=>console.error(i))}},ee=class{constructor(){this.sprites={}}getSprite(e){return this.sprites[e]}hasSprite(e){return e in this.sprites}putSprite(e,i){this.sprites[e]=i}},ei=new ee;export{ee as InMemorySpriteRepository,fe as ShieldRenderer,pe as URLShieldRenderer,qe as getDOMPixelRatio,le as transposeImageData};
var tt=Object.create;var ye=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var rt=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of it(e))!at.call(t,l)&&l!==n&&ye(t,l,{get:()=>e[l],enumerable:!(i=nt(e,l))||i.enumerable});return t};var dt=(t,e,n)=>(n=t!=null?tt(lt(t)):{},rt(e||!t||!t.__esModule?ye(n,"default",{value:t,enumerable:!0}):n,t));var me=ot((Ut,Se)=>{"use strict";Se.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var ie=dt(me(),1),we=ht,be={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function ht(t){var e,n=[],i=1,l;if(typeof t=="string")if(ie.default[t])n=ie.default[t].slice(),l="rgb";else if(t==="transparent")i=0,l="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var a=t.slice(1),o=a.length,u=o<=4;i=1,u?(n=[parseInt(a[0]+a[0],16),parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16)],o===4&&(i=parseInt(a[3]+a[3],16)/255)):(n=[parseInt(a[0]+a[1],16),parseInt(a[2]+a[3],16),parseInt(a[4]+a[5],16)],o===8&&(i=parseInt(a[6]+a[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),l="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],c=h==="rgb",a=h.replace(/a$/,"");l=a;var o=a==="cmyk"?4:a==="gray"?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(r,f){if(/%$/.test(r))return f===o?parseFloat(r)/100:a==="rgb"?parseFloat(r)*255/100:parseFloat(r);if(a[f]==="h"){if(/deg$/.test(r))return parseFloat(r);if(be[r]!==void 0)return be[r]}return parseFloat(r)}),h===a&&n.push(1),i=c||n[o]===void 0?1:n[o],n=n.slice(0,o)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(g){return parseFloat(g)}),l=t.match(/([a-z])/ig).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(n=[t[0],t[1],t[2]],l="rgb",i=t.length===4?t[3]:1):t instanceof Object&&(t.r!=null||t.red!=null||t.R!=null?(l="rgb",n=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(l="hsl",n=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),i=t.a||t.alpha||t.opacity||1,t.opacity!=null&&(i/=100)):(l="rgb",n=[t>>>16,(t&65280)>>>8,t&255]);return{space:l,values:n,alpha:i}}var q={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Q={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e=t[0]/360,n=t[1]/100,i=t[2]/100,l,a,o,u,h,c=0;if(n===0)return h=i*255,[h,h,h];for(a=i<.5?i*(1+n):i+n-i*n,l=2*i-a,u=[0,0,0];c<3;)o=e+1/3*-(c-1),o<0?o++:o>1&&o--,h=6*o<1?l+(a-l)*6*o:2*o<1?a:3*o<2?l+(a-l)*(2/3-o)*6:l,u[c++]=h*255;return u}};q.hsl=function(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255,l=Math.min(e,n,i),a=Math.max(e,n,i),o=a-l,u,h,c;return a===l?u=0:e===a?u=(n-i)/o:n===a?u=2+(i-e)/o:i===a&&(u=4+(e-n)/o),u=Math.min(u*60,360),u<0&&(u+=360),c=(l+a)/2,a===l?h=0:c<=.5?h=o/(a+l):h=o/(2-a-l),[u,h*100,c*100]};function X(t){Array.isArray(t)&&t.raw&&(t=String.raw(...arguments));var e,n,i,l=we(t);if(!l.space)return[];let a=l.space[0]==="h"?Q.min:q.min,o=l.space[0]==="h"?Q.max:q.max;return e=Array(3),e[0]=Math.min(Math.max(l.values[0],a[0]),o[0]),e[1]=Math.min(Math.max(l.values[1],a[1]),o[1]),e[2]=Math.min(Math.max(l.values[2],a[2]),o[2]),l.space[0]==="h"&&(e=Q.rgb(e)),e.push(Math.min(Math.max(l.alpha,0),1)),e}var ut='"sans-serif-condensed", "Arial Narrow", sans-serif',N=(t,e)=>`bold ${t}px ${e||ut}`,$=12;function le(t,e,n){return 255-t/255*(255-n)-(1-t/255)*(255-e)}function st(t,e,n,i){e[i]=t[n],e[i+1]=t[n+1],e[i+2]=t[n+2],e[i+3]=t[n+3]}function ft(t,e,n,i,l,a){e[i]=le(t[n],l[0],a[0]),e[i+1]=le(t[n+1],l[1],a[1]),e[i+2]=le(t[n+2],l[2],a[2]),e[i+3]=t[n+3]}function ae(t,e,n,i,l,a){let o=t.createImageData(e.data.width,e.data.height),u=l||a?ft:st,h=l?X(l):X("#000"),c=a?X(a):X("#fff");if(i)for(let g=0;g<e.data.height;g++)for(let s=0;s<e.data.width;s++){let f=((e.data.height-g-1)*e.data.width+s)*4,p=(g*e.data.width+s)*4;u(e.data.data,o.data,p,f,h,c)}else for(let g=0;g<e.data.data.length;g+=4)u(e.data.data,o.data,g,g,h,c);t.putImageData(o,0,n)}var H={Middle:"middle",Top:"top",Bottom:"bottom"};function Te(t,e){var n=t.width,i=t.height,l=e.width,a=e.height;return n*i/Math.sqrt(n*n*a*a+i*i*l*l)}function pt(t,e){return{scale:Te(t,e),valign:H.Middle}}function gt(t,e){return{scale:Te(t,{height:e.width/2,width:e.height}),valign:H.Top}}function ve(t,e){var n=t.height/e.height,i=t.width/e.width;return{scale:Math.min(i,n),valign:H.Middle}}function ct(t,e,n){let i=2;return n!==void 0&&n.radius!==void 0&&(i=n.radius),ve({width:t.width-i*(2-Math.sqrt(2)),height:t.height-i*(2-Math.sqrt(2))},e)}function xe(t,e){let n=t.width,i=t.height,l=e.width,a=e.height;return{scale:n*i/(i*l+n*a),valign:H.Middle}}function yt(t,e){return{scale:xe(t,e).scale,valign:H.Top}}function St(t,e,n,i,l,a){var o=t.px(n.top)||0,u=t.px(n.bottom)||0,h=t.px(n.left)||0,c=t.px(n.right)||0,g=t.px(a),s=t.gfxFactory.createGraphics(i);s.font=N($,t.options.shieldFont),s.textAlign="center",s.textBaseline="top";var r=s.measureText(e),f=r.width,p=r.actualBoundingBoxDescent,y=i.height-o-u,d=i.width-h-c,S=h+d/2;let m=Pe[l.constraintFunc],b=m({height:y,width:d},{height:p,width:f},l.options);var k=Math.min(g,$*b.scale);s.font=N(k,t.options.shieldFont),s.textAlign="center",s.textBaseline="top",r=s.measureText(e),p=r.actualBoundingBoxDescent;var w;switch(b.valign){case H.Top:w=o;break;case H.Bottom:w=o+y-p;break;case H.Middle:default:w=o+(y-p)/2;break}return{xBaseline:S,yBaseline:w,fontPx:k}}var mt={padding:{top:0,bottom:0,left:0,right:0}};function Y(t,e,n,i){n==null&&(n=mt);var l=n.padding||{},a={constraintFunc:"rect"},o=14;return typeof n.textLayout!="undefined"&&(a=n.textLayout),typeof n.maxFontSize!="undefined"&&(o=Math.min(o,n.maxFontSize)),St(t,e,l,i,a,o)}function Me(t,e,n,i){Re(t,e,i),e.fillText(n,i.xBaseline,i.yBaseline)}function oe(t,e,n,i){Re(t,e,i),e.shadowColor=e.strokeStyle,e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(n,i.xBaseline,i.yBaseline),e.shadowColor=null,e.shadowBlur=null}function Re(t,e,n){e.textAlign="center",e.textBaseline="top",e.font=N(n.fontPx,t.options.shieldFont)}function Fe(t,e,n,i){We(t,e,n,i,!0)}function Be(t,e,n,i){We(t,e,n,i,!1)}function We(t,e,n,i,l){let a={padding:{top:t.options.bannerPadding,bottom:0,left:0,right:0}};var o=Y(t,n,a,{width:e.canvas.width,height:t.px(t.options.bannerHeight-t.options.bannerPadding)});e.font=N(o.fontPx,t.options.shieldFont),e.textBaseline="top",e.textAlign="center",l?(e.fillStyle=t.options.bannerTextColor,e.fillText(n,o.xBaseline,o.yBaseline+i*t.px(t.options.bannerHeight-t.options.bannerPadding))):(e.strokeStyle=e.shadowColor=t.options.bannerTextHaloColor,e.shadowBlur=0,e.lineWidth=t.px(2),e.strokeText(n,o.xBaseline,o.yBaseline+i*t.px(t.options.bannerHeight-t.options.bannerPadding)),e.shadowColor=null,e.shadowBlur=null)}function re(t,e,n){var i=t.emptySprite();return i.font=N(n,t.options.shieldFont),Math.ceil(i.measureText(e).width)}var Pe={};function V(t,e){Pe[t]=e}V("diamond",xe);V("ellipse",pt);V("rect",ve);V("roundedRect",ct);V("southHalfEllipse",gt);V("triangleDown",yt);function bt(t,e,n){K(t,e,{fillColor:"white",strokeColor:"black",outlineWidth:1,radius:2,rectWidth:20});let i=n.fillColor,l=t.px(.5),a=t.shieldSize()/3-l;return e.beginPath(),e.arc(t.shieldSize()/2,t.shieldSize()/2,a,0,2*Math.PI,!1),e.fillStyle=i,e.strokeStyle=n.strokeColor,e.fill(),e.lineWidth=l,e.stroke(),e}function wt(t,e,n){K(t,e,{fillColor:"#006747",strokeColor:"white",outlineWidth:1,radius:2,rectWidth:20});let i=n.fillColor,l=t.px(.5),a=.15*t.shieldSize()+l,o=.7*t.shieldSize()-2*l,u=.4*t.shieldSize()+l,h=.45*t.shieldSize()-2*l;return e.beginPath(),e.rect(a,u,o,h),e.fillStyle=i,e.strokeStyle=n.strokeColor,e.fill(),e.lineWidth=l,e.stroke(),e}function ze(){z("branson",wt,20),z("paBelt",bt,20)}var De=20,_e=34,He=18;function C(t,e,n,i){if(de[i]!==void 0)return t.px(de[i]);let l=e.rectWidth==null?null:e.rectWidth,a=e.angle==null?0:e.angle,o=Math.tan(a);if(l==null){let u=re(t,n,t.px(He))+t.px(2),h=t.px(De);switch(i){case"pentagon":let c=e.offset==null?0:e.offset;u+=(t.shieldSize()-t.px(c))*o/2;break;case"trapezoid":u+=t.shieldSize()*o/2;break;case"triangle":h+=t.px(2);break;case"diamond":case"hexagonHorizontal":h+=t.px(4);break}return Math.max(h,Math.min(t.px(_e),u))}else return t.px(l)}function kt(t,e,n,i){let l=n.fillColor==null?"white":n.fillColor,a=n.strokeColor==null?"black":n.strokeColor,o=C(t,n,i),u=t.px(1),h=o/2-u,c=t.shieldSize()/2-u;return e.beginPath(),e.ellipse(e.canvas.width/2,t.shieldSize()/2,h,c,0,2*Math.PI,!1),e.fillStyle=l,e.fill(),e.lineWidth=u,e.strokeStyle=a,e.stroke(),o}function Le(t,e){var n=re(t,e,t.px(He))+t.px(2),i=Math.max(t.px(De),Math.min(t.px(_e),n));return t.gfxFactory.createGraphics({width:i,height:t.shieldSize()})}function K(t,e,n,i){let l=n.fillColor==null?"white":n.fillColor,a=n.strokeColor==null?"black":n.strokeColor,o=n.radius==null?0:n.radius,u=n.outlineWidth==null?1:n.outlineWidth,h=C(t,n,i),c=t.px(u),g=c/2,s=t.px(o),r=g,f=g+s,p=h-g-s,y=h-g,d=g,S=g+s,m=t.shieldSize()-g-s,b=t.shieldSize()-g;return e.beginPath(),e.moveTo(p,d),e.arcTo(y,d,y,S,s),e.arcTo(y,b,p,b,s),e.arcTo(r,b,r,m,s),e.arcTo(r,d,f,d,s),e.closePath(),e.lineWidth=c,e.fillStyle=l,e.fill(),a!=null&&(e.strokeStyle=a,e.stroke()),h}function Tt(t,e,n,i){let l=n.offset==null?0:n.offset,a=n.fillColor==null?"white":n.fillColor,o=n.strokeColor==null?"black":n.strokeColor,u=n.radius==null?0:n.radius,h=n.outlineWidth==null?1:n.outlineWidth,c=C(t,n,i),g=t.px(h),s=g/2,r=t.px(u),f=t.px(l),p=s,y=c-s,d=s,S=t.shieldSize()-s,m=p+r,b=(p+y)/2,k=d+r,w=S-f,v=(2*p+b)/3,T=(b+2*y)/3,x=(w+S)/2,R=(x+2*S)/3;return e.beginPath(),e.moveTo(b,S),e.bezierCurveTo(v,R,p,x,p,w),e.arcTo(p,d,m,d,r),e.arcTo(y,d,y,k,r),e.lineTo(y,w),e.bezierCurveTo(y,x,T,R,b,S),e.closePath(),e.lineWidth=g,e.fillStyle=a,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),c}function vt(t,e,n,i){let l=n.pointUp==null?!1:n.pointUp,a=n.fillColor==null?"white":n.fillColor,o=n.strokeColor==null?"black":n.strokeColor,u=n.outlineWidth==null?1:n.outlineWidth,h=l?-1:1,c=C(t,n,i),g=t.px(u),s=g/2,r=s,f=c-s,p=l?t.shieldSize()-s:s,y=l?s:t.shieldSize()-s,d=r+t.px(1),S=r+t.px(2.5),m=(r+f)/2,b=f-t.px(2.5),k=f-t.px(1),w=p+h*t.px(2),v=p+h*t.px(4.5),T=p+h*t.px(7),x=y-h*t.px(6),R=y-h*t.px(1),M=(r+m)/2,F=(m+f)/2;e.beginPath(),e.moveTo(m,y),e.bezierCurveTo(M,R,r,x,r,T),e.bezierCurveTo(r,v,d,w,S,p),e.lineTo(b,p),e.bezierCurveTo(k,w,f,v,f,T),e.bezierCurveTo(f,x,F,R,m,y),e.closePath(),e.lineWidth=g,e.fillStyle=a,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke())}function xt(t,e,n,i){let l=n.pointUp==null?!1:n.pointUp,a=n.fillColor==null?"white":n.fillColor,o=n.strokeColor==null?"black":n.strokeColor,u=n.radius==null?0:n.radius,h=n.outlineWidth==null?1:n.outlineWidth,c=l?-1:1,g=C(t,n,i,"triangle"),s=t.px(h),r=s/2,f=t.px(u),p=r,y=g-r,d=l?t.shieldSize()-r:r,S=l?r:t.shieldSize()-r,m=p+f,b=(p+y)/2,k=y-f,w=d+c*f,v=Math.atan((b-m)/Math.abs(S-f-w)),T=Math.sin(v),x=Math.cos(v),R=Math.tan(v/2),M=Math.tan(Math.PI/4-v/2),F=m-f*x,B=b-f*M,W=b+f*M,D=k+f*x,I=w+c*f*R,P=w+c*f*T,_=S-c*f*(1-T);return e.beginPath(),e.moveTo(b,S),e.arcTo(B,S,F,P,f),e.arcTo(p,I,p,w,f),e.arcTo(p,d,m,d,f),e.arcTo(y,d,y,w,f),e.arcTo(y,I,D,P,f),e.arcTo(W,S,b,S,f),e.closePath(),e.lineWidth=s,e.fillStyle=a,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),g}function Mt(t,e,n,i){let l=n.shortSideUp==null?!1:n.shortSideUp,a=n.angle==null?0:n.angle,o=n.fillColor==null?"white":n.fillColor,u=n.strokeColor==null?"black":n.strokeColor,h=n.radius==null?0:n.radius,c=n.outlineWidth==null?1:n.outlineWidth,g=l?-1:1,s=Math.sin(a),r=Math.cos(a),f=Math.tan(a),p=C(t,n,i,"trapezoid"),y=t.px(c),d=y/2,S=t.px(h),m=d,b=p-d,k=l?t.shieldSize()-d:d,w=l?d:t.shieldSize()-d,v=k+g*S*(1+s),T=w-g*S*(1-s),x=m+(v-k)*f,R=x+S*r,M=m+g*(T-k)*f,F=m+g*(w-k)*f,B=M+g*S*r,W=p-F,D=p-M,I=p-R;return e.beginPath(),e.moveTo(I,k),e.arcTo(b,k,D,T,S),e.arcTo(W,w,B,w,S),e.arcTo(F,w,x,v,S),e.arcTo(m,k,I,k,S),e.closePath(),e.lineWidth=y,e.fillStyle=o,e.fill(),u!=null&&(e.strokeStyle=u,e.stroke()),p}function Rt(t,e,n,i){let l=n.fillColor==null?"white":n.fillColor,a=n.strokeColor==null?"black":n.strokeColor,o=n.radius==null?0:n.radius,u=n.outlineWidth==null?1:n.outlineWidth,h=Z(t,"diamond"),c=C(t,n,i,"diamond"),g=t.px(u),s=g/2,r=t.px(o),f=s,p=c-s,y=s,d=h-s,S=(f+p)/2,m=(y+d)/2,b=Math.atan((S-r-f)/(d-r-m)),k=Math.sin(b),w=Math.cos(b),v=Math.tan(b/2),T=Math.tan(Math.PI/4-b/2),x=f+r*(1-w),R=S-r*w,M=S-r*T,F=S+r*T,B=S+r*w,W=p-r*(1-w),D=y+r*(1-k),I=m-r*k,P=m-r*v,_=m+r*v,L=m+r*k,A=d-r*(1-k);return e.beginPath(),e.moveTo(S,d),e.arcTo(M,d,x,L,r),e.arcTo(f,_,f,m,r),e.arcTo(f,P,R,D,r),e.arcTo(M,y,S,y,r),e.arcTo(F,y,W,I,r),e.arcTo(p,P,p,m,r),e.arcTo(p,_,B,A,r),e.arcTo(F,d,S,d,r),e.closePath(),e.lineWidth=g,e.fillStyle=l,e.fill(),a!=null&&(e.strokeStyle=a,e.stroke()),c}function Ft(t,e,n,i){let l=n.pointUp==null?!0:n.pointUp,a=n.offset==null?0:n.offset,o=n.angle==null?0:n.angle,u=n.fillColor==null?"white":n.fillColor,h=n.strokeColor==null?"black":n.strokeColor,c=n.radius1==null?0:n.radius1,g=n.radius2==null?0:n.radius2,s=n.outlineWidth==null?1:n.outlineWidth,r=l?-1:1,f=Math.sin(o),p=Math.cos(o),y=Math.tan(o),d=C(t,n,i,"pentagon"),S=t.px(s),m=S/2,b=t.px(c),k=t.px(g),w=t.px(a),v=m,T=d-m,x=l?t.shieldSize()-m:m,R=l?m:t.shieldSize()-m,M=R-r*w,F=v+r*(M-x)*y,B=(v+T)/2,W=T-r*(M-x)*y,D=Math.atan(w/(B-v)),I=(Math.PI/2-D+o)/2,P=Math.tan(I),_=(Math.PI/2-o)/2,L=Math.tan(_),A=v+b*P*f,j=F+k*L,U=W-k*L,E=T-b*P*f,J=M-r*b*P*p;return e.beginPath(),e.moveTo(B,R),e.arcTo(v,M,A,J,b),e.arcTo(F,x,j,x,k),e.lineTo(U,x),e.arcTo(W,x,E,J,k),e.arcTo(T,M,B,R,b),e.closePath(),e.lineWidth=S,e.fillStyle=u,e.fill(),h!=null&&(e.strokeStyle=h,e.stroke()),d}function Bt(t,e,n,i){let l=n.offset==null?0:n.offset,a=n.fillColor==null?"white":n.fillColor,o=n.strokeColor==null?"black":n.strokeColor,u=n.radius==null?0:n.radius,h=n.outlineWidth==null?1:n.outlineWidth,c=C(t,n,i),g=t.px(h),s=g/2,r=t.px(u),f=t.px(l),p=s,y=c-s,d=s,S=t.shieldSize()-s,m=(p+y)/2,b=d+f,k=S-f,w=r*Math.tan(Math.PI/4-Math.asin(f/(m-p))/2),v=b+w,T=k-w;return e.beginPath(),e.moveTo(m,S),e.arcTo(p,k,p,T,r),e.arcTo(p,b,m,d,r),e.lineTo(m,d),e.arcTo(y,b,y,v,r),e.arcTo(y,k,m,S,r),e.lineTo(m,S),e.closePath(),e.lineWidth=g,e.fillStyle=a,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),c}function Wt(t,e,n,i){let l=n.angle==null?0:n.angle,a=n.fillColor==null?"white":n.fillColor,o=n.strokeColor==null?"black":n.strokeColor,u=n.radius==null?0:n.radius,h=n.outlineWidth==null?1:n.outlineWidth,c=Math.sin(l),g=Math.cos(l),s=Math.tan(l),r=Math.tan(Math.PI/4-l/2),f=C(t,n,i,"hexagonHorizontal"),p=t.px(h),y=p/2,d=t.px(u),S=y,m=f-y,b=y,k=t.shieldSize()-y,w=(b+k)/2,v=b+d*r*g,T=w-d*c,x=w+d*c,R=k-d*r*g,M=S+(w-T)*s,F=S+(w-b)*s,B=m-(w-b)*s,W=m-(w-T)*s,D=F-d*r*c,I=F+d*r,P=B-d*r,_=B+d*r*c;return e.beginPath(),e.moveTo(I,b),e.arcTo(B,b,_,v,d),e.arcTo(m,w,W,x,d),e.arcTo(B,k,P,k,d),e.arcTo(F,k,D,R,d),e.arcTo(S,w,M,T,d),e.arcTo(F,b,I,b,d),e.closePath(),e.lineWidth=p,e.fillStyle=a,e.fill(),o!=null&&(e.strokeStyle=o,e.stroke()),f}function Pt(t,e,n,i){let l=n.offset==null?0:n.offset,a=n.angle==null?0:n.angle,o=n.fillColor==null?"white":n.fillColor,u=n.strokeColor==null?"black":n.strokeColor,h=n.radius==null?0:n.radius,c=n.outlineWidth==null?1:n.outlineWidth,g=Math.sin(a),s=Math.cos(a),r=Math.tan(a),f=C(t,n,i),p=t.px(c),y=p/2,d=t.px(h),S=t.px(l),m=y,b=f-y,k=y,w=t.shieldSize()-y,v=m+d*r*g,T=(m+b)/2,x=b-d*r*g,R=k+S,M=(k+w)/2,F=w-S,B=m+(M-R)*r,W=b-(M-R)*r,D=M-d*r*s,I=M+d*r*s,P=Math.atan(S/(T-B)),_=Math.sin(P),L=Math.cos(P),A=(Math.PI/2-a-P)/2,j=Math.cos(A),U=d*Math.cos(a+A)/j,E=d*Math.sin(a+A)/j,J=B+U-d*s,je=B+U-d*_,Je=W-U+d*_,Qe=W-U+d*s,Ye=R+E-d*L,Ke=R+E-d*g,Ze=F-E+d*g,et=F-E+d*L;return e.beginPath(),e.moveTo(T,w),e.arcTo(B,F,J,Ze,d),e.arcTo(m,M,v,D,d),e.arcTo(B,R,je,Ye,d),e.lineTo(T,k),e.arcTo(W,R,Qe,Ke,d),e.arcTo(b,M,x,I,d),e.arcTo(W,F,Je,et,d),e.lineTo(T,w),e.closePath(),e.lineWidth=p,e.fillStyle=o,e.fill(),u!=null&&(e.strokeStyle=u,e.stroke()),f}function Z(t,e){switch(e){case"diamond":return t.shieldSize()+t.px(4);default:return t.shieldSize()}}function Ae(t,e,n,i,l){return Ge[e](t,n,i,l)}var Ge={},de={};function z(t,e,n){Ge[t]=e,n!==void 0&&(de[t]=n)}z("diamond",Rt);z("ellipse",kt);z("escutcheon",Tt);z("fishhead",vt);z("hexagonVertical",Bt);z("hexagonHorizontal",Wt);z("octagonVertical",Pt);z("pentagon",Ft);z("roundedRectangle",K);z("trapezoid",Mt);z("triangle",xt);ze();function Oe(t,e,n,i){if(n==null||typeof n.banners=="undefined")return e;for(var l=0;l<n.banners.length;l++)i(t,e,n.banners[l],l);return e}function It(t,e,n){return{width:e.width,height:e.height+n*t.px(t.options.bannerHeight+t.options.bannerPadding)}}function he(t){return t!==null&&t.length!==0&&t.length<=6}function ue(t){return t==null||typeof t.banners=="undefined"?0:t.banners.length}function Ue(t,e,n){var i=null,l,a=0,o;if(Array.isArray(e.spriteBlank))for(var u=0;u<e.spriteBlank.length&&(i=t.spriteRepo.getSprite(e.spriteBlank[u]),o=It(t,i.data,a),l=Y(t,n.ref,e,o),!(l.fontPx>t.px($)));u++);else i=t.spriteRepo.getSprite(e.spriteBlank);return i}function zt(t){return t!=null&&typeof t.textColor!="undefined"?t.textColor:"black"}function Ee(t){return typeof t.shapeBlank!="undefined"?(e,n,i)=>Ae(e,t.shapeBlank.drawFunc,n,t.shapeBlank.params,i):Le}function Ct(t,e,n,i){let a=ue(n)*t.px(t.options.bannerHeight);e.save(),e.translate(0,a),Ee(n)(t,e,i.ref),e.restore()}function Dt(t,e){return typeof e.shapeBlank!="undefined"?Z(t,e.shapeBlank.drawFunc):t.shieldSize()}function _t(t,e,n,i){var l=ue(n),a=null,o=Ue(t,n,i);let u=l*t.px(t.options.bannerHeight);if(o==null?(e.translate(0,u),Ee(n)(t,e,i.ref),e.translate(0,-u),a={width:e.canvas.width,height:Dt(t,n)}):a={width:o.data.width,height:o.data.height},n.notext)return e;var h=Y(t,i.ref,n,a);return h.yBaseline+=l*t.px(t.options.bannerHeight),typeof t.options.SHIELD_TEXT_HALO_COLOR_OVERRIDE!="undefined"?(e.strokeStyle=options.SHIELD_TEXT_HALO_COLOR_OVERRIDE,oe(t,e,i.ref,h)):n.textHaloColor&&(e.strokeStyle=n.textHaloColor,oe(t,e,i.ref,h)),e.fillStyle=zt(n),Me(t,e,i.ref,h),t.options.SHIELD_TEXT_BBOX_COLOR&&(e.strokeStyle=t.options.SHIELD_TEXT_BBOX_COLOR,e.lineWidth=t.px(1),e.strokeRect(t.px(n.padding.left-.5),l*t.px(t.options.bannerHeight)+t.px(n.padding.top-.5),a.width-t.px(n.padding.left+n.padding.right-1),a.height-t.px(n.padding.top+n.padding.bottom-1))),e}function Xe(t,e){let n=se(t,e);n==null&&(console.warn("Didn't produce a shield for",JSON.stringify(e)),n=t.gfxFactory.createGraphics({width:1,height:1})),Ne(t,e.spriteID,n)}function Ne(t,e,n){let i=n.getImageData(0,0,n.canvas.width,n.canvas.height);t.spriteRepo.putSprite(e,{width:n.canvas.width,height:n.canvas.height,data:i.data},t.px(1))}function Ve(t,e){Ne(t,e,t.emptySprite())}function qe(t,e){return e.refsByName&&t.name&&e.refsByName[t.name]?e.refsByName[t.name]:t.ref}function Ht(t,e){var n=t[e.network];if(e==null)return null;if(n==null)return console.debug("Generic shield for",JSON.stringify(e)),he(e.ref)?t.default:null;var i=qe(e,n);return n.overrideByRef&&(n={...n,...n.overrideByRef[i]}),n.overrideByName&&(n={...n,...n.overrideByName[e.name||""]}),!he(i)&&"noref"in n&&(n=n.noref,n.notext=!0),!he(i)&&!n.notext&&!(n.refsByName&&e.name)?null:n}function Lt(t){let e=parseInt(t,10);if(isNaN(e))return t;let n="M".repeat(e/1e3)+"D".repeat(e%1e3/500)+"C".repeat(e%500/100)+"L".repeat(e%100/50)+"X".repeat(e%50/10)+"V".repeat(e%10/5)+"I".repeat(e%5);return n=n.replace("DCCCC","CM").replace("CCCC","CD").replace("LXXXX","XC").replace("XXXX","XL").replace("VIIII","IX").replace("IIII","IV"),n+t.slice(e.toString().length)}function At(t,e,n){let i=Math.max(t.shieldSize(),C(t,e.shapeBlank.params,n,e.shapeBlank.drawFunc)),l=Z(t,e.shapeBlank.drawFunc);return{width:i,height:l}}function se(t,e){let n=Ht(t.shieldDef,e);if(n==null)return null;e.ref=qe(e,n);let i=ue(n),l=Ue(t,n,e),a=t.shieldSize(),o=t.shieldSize();if(l==null){if(typeof n.shapeBlank!="undefined"){let c=At(t,n,e.ref);a=c.width,o=c.height}}else a=l.data.width,o=l.data.height;let u=i*t.px(t.options.bannerHeight);o+=u;let h=t.gfxFactory.createGraphics({width:a,height:o});return e.ref&&n.numberingSystem==="roman"&&(e.ref=Lt(e.ref)),Oe(t,h,n,Be),l==null?Ct(t,h,n,e):ae(h,l,u,n.verticalReflect,n.colorLighten,n.colorDarken),_t(t,h,n,e),Oe(t,h,n,Fe),h}function $e(){return(typeof window!="undefined"&&window.devicePixelRatio)>1?2:1}var ee=class{createGraphics(e){var n=document.createElement("canvas").getContext("2d"),n=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});return n.imageSmoothingQuality="high",n.textAlign="center",n.textBaseline="top",n.canvas.width=e.width,n.canvas.height=e.height,n}pixelRatio(){return $e()}};var fe=class{emptySprite(){return this._emptySpriteCache||(this._emptySpriteCache=this.gfxFactory.createGraphics({width:1,height:1})),this._emptySpriteCache}px(e){return e*this.gfxFactory.pixelRatio()}shieldSize(){return this.px(this.options.shieldSize)}},pe=class{constructor(e){this.map=e}getSprite(e){return this.map.style.getImage(e)}putSprite(e,n,i){this.map.addImage(e,n,{pixelRatio:i})}},te=class{constructor(e){this._shieldPredicate=()=>!0;this._networkPredicate=()=>!0;this._shieldDefCallbacks=[];this._routeParser=e,this._renderContext=new fe,this._renderContext.gfxFactory=new ee}setShields(e){this._renderContext.options=e.options,this._renderContext.shieldDef=e.networks,this._shieldDefCallbacks.forEach(n=>n(e.networks))}getShieldDefinitions(){return this._renderContext.shieldDef}debugOptions(e){return this._renderContext.debugOptions=e,this}filterImageID(e){return this._shieldPredicate=e,this}filterNetwork(e){return this._networkPredicate=e,this}graphicsFactory(e){return this._renderContext.gfxFactory=e,this}renderOnMaplibreGL(e){return this.renderOnRepository(new pe(e)),e.on("styleimagemissing",this.getStyleImageMissingHandler()),this}onShieldDefLoad(e){return this._renderContext.shieldDef?e(this._renderContext.shieldDef):this._shieldDefCallbacks.push(e),this}renderOnRepository(e){return this._renderContext.spriteRepo||(this._renderContext.spriteRepo=e),this}getStyleImageMissingHandler(){return e=>{try{if(!this._shieldPredicate(e.id))return;let n=this._routeParser.parse(e.id);if(!this._networkPredicate(n.network)){Ve(this._renderContext,e.id);return}n.spriteID=e.id,this._renderContext.debugOptions=this.debugOptions,n&&Xe(this._renderContext,n)}catch(n){console.error(`Exception while loading image \u2018${e==null?void 0:e.id}\u2019:
`,n)}}}getGraphicForRoute(e,n,i){return se(this._renderContext,{network:e,ref:n,name:i,spriteID:this._routeParser.format(e,n,i)})}emptySprite(){return this._renderContext.emptySprite()}createGraphics(e){return this._renderContext.gfxFactory.createGraphics(e)}pixelRatio(){return this._renderContext.px(1)}},ge=class extends te{constructor(e,n){super(n),this.setShields(e)}},ce=class extends te{constructor(e,n){super(n),this.setShieldURL(e)}async setShieldURL(e){await fetch(e).then(n=>n.json()).then(n=>super.setShields(n)).catch(n=>console.error(n))}},ne=class{constructor(){this.sprites={}}getSprite(e){return this.sprites[e]}hasSprite(e){return e in this.sprites}putSprite(e,n){this.sprites[e]=n}},ln=new ne;function G(t){return{constraintFunc:"roundedRect",options:{radius:t}}}function O(t){return{constraintFunc:t}}function Gt(t,e,n,i){return n=n!=null?n:e,{shapeBlank:{drawFunc:"ellipse",params:{fillColor:t,strokeColor:e,rectWidth:i}},textLayout:O("ellipse"),padding:{left:2,right:2,top:2,bottom:2},textColor:n}}function on(t,e,n){return Gt(t,e,n,20)}function rn(t,e,n,i,l){return n=n!=null?n:e,l=l!=null?l:2,{shapeBlank:{drawFunc:"roundedRectangle",params:{fillColor:t,strokeColor:e,rectWidth:i,radius:l}},textLayout:G(l),padding:{left:3,right:3,top:3,bottom:3},textColor:n}}function dn(t,e,n,i,l,a){return i=i!=null?i:n,l=l!=null?l:0,{shapeBlank:{drawFunc:"escutcheon",params:{offset:t,fillColor:e,strokeColor:n,rectWidth:a,radius:l,outlineWidth:1}},textLayout:G(l),padding:{left:2,right:2,top:2,bottom:0+t/2},textColor:i}}function hn(t,e,n,i){return n=n!=null?n:e,{shapeBlank:{drawFunc:"fishhead",params:{fillColor:t,strokeColor:e,rectWidth:i,outlineWidth:1}},textLayout:O("roundedRect"),padding:{left:3,right:3,top:2,bottom:6},textColor:n}}function un(t,e,n,i,l){return n=n!=null?n:e,i=i!=null?i:2,{shapeBlank:{drawFunc:"triangle",params:{pointUp:!1,fillColor:t,strokeColor:e,rectWidth:l,radius:i}},textLayout:O("triangleDown"),padding:{left:1,right:1,top:2,bottom:1},textColor:n}}function sn(t,e,n,i,l,a){let o=t*Math.PI/180;return i=i!=null?i:n,l=l!=null?l:0,{shapeBlank:{drawFunc:"trapezoid",params:{angle:o,fillColor:e,strokeColor:n,rectWidth:a,radius:l}},textLayout:G(l),padding:{left:2+10*Math.tan(o),right:2+10*Math.tan(o),top:2,bottom:4},textColor:i}}function fn(t,e,n,i,l,a){let o=t*Math.PI/180;return i=i!=null?i:n,l=l!=null?l:0,{shapeBlank:{drawFunc:"trapezoid",params:{shortSideUp:!0,angle:o,fillColor:e,strokeColor:n,rectWidth:a,radius:l}},textLayout:G(l),padding:{left:2+10*Math.tan(o),right:2+10*Math.tan(o),top:4,bottom:2},textColor:i}}function pn(t,e,n,i,l){return n=n!=null?n:e,i=i!=null?i:2,{shapeBlank:{drawFunc:"diamond",params:{fillColor:t,strokeColor:e,radius:i,rectWidth:l}},textLayout:O("diamond"),padding:{left:1,right:1,top:1,bottom:1},textColor:n}}function gn(t,e,n,i,l,a,o,u){let h=e*Math.PI/180;return l=l!=null?l:i,a=a!=null?a:2,o=o!=null?o:0,{shapeBlank:{drawFunc:"pentagon",params:{offset:t,angle:h,fillColor:n,strokeColor:i,radius1:a,radius2:o,rectWidth:u}},textLayout:{constraintFunc:"rect"},padding:{left:2+(20-t)*Math.tan(h)/2,right:2+(20-t)*Math.tan(h)/2,top:1+t/2,bottom:3},textColor:l}}function cn(t,e,n,i,l,a,o){return i=i!=null?i:n,l=l!=null?l:2,a=a!=null?a:2,{shapeBlank:{drawFunc:"pentagon",params:{pointUp:!1,offset:t,angle:0,fillColor:e,strokeColor:n,radius1:l,radius2:a,rectWidth:o}},textLayout:G(a),padding:{left:2,right:2,top:2,bottom:1+t},textColor:i}}function yn(t,e,n,i,l,a,o){return i=i!=null?i:n,l=l!=null?l:2,a=a!=null?a:2,{shapeBlank:{drawFunc:"pentagon",params:{pointUp:!0,offset:t,angle:0,fillColor:e,strokeColor:n,radius1:l,radius2:a,rectWidth:o}},textLayout:G(a),padding:{left:2,right:2,top:1+t,bottom:2},textColor:i}}function Sn(t,e,n,i,l,a){return i=i!=null?i:n,l=l!=null?l:2,{shapeBlank:{drawFunc:"hexagonVertical",params:{offset:t,fillColor:e,strokeColor:n,radius:l,rectWidth:a}},textLayout:G(l),padding:{left:2,right:2,top:1+t,bottom:1+t},textColor:i}}function mn(t,e,n,i,l,a){let o=t*Math.PI/180;return i=i!=null?i:n,l=l!=null?l:2,{shapeBlank:{drawFunc:"hexagonHorizontal",params:{angle:o,fillColor:e,strokeColor:n,radius:l,rectWidth:a}},textLayout:O("ellipse"),padding:{left:3,right:3,top:2,bottom:2},textColor:i}}function bn(t,e,n,i,l,a,o){let u=e*Math.PI/180;return l=l!=null?l:i,a=a!=null?a:2,{shapeBlank:{drawFunc:"octagonVertical",params:{offset:t,angle:u,fillColor:n,strokeColor:i,radius:a,rectWidth:o}},textLayout:O("ellipse"),padding:{left:2,right:2,top:2,bottom:2},textColor:l}}function wn(t,e,n,i){return n=n!=null?n:e,{shapeBlank:{drawFunc:"roundedRectangle",params:{fillColor:t,strokeColor:e,rectWidth:i,radius:10}},textLayout:O("ellipse"),padding:{left:2,right:2,top:2,bottom:2},textColor:n}}function kn(t,e){return{banners:e,...t}}function Tn(t,e){return{notext:!0,shapeBlank:{drawFunc:"paBelt",params:{fillColor:t,strokeColor:e}}}}function vn(t,e){return{notext:!0,shapeBlank:{drawFunc:"branson",params:{fillColor:t,strokeColor:e}}}}export{ne as InMemorySpriteRepository,ge as ShieldRenderer,ce as URLShieldRenderer,kn as banneredShield,vn as bransonRouteShield,on as circleShield,pn as diamondShield,dn as escutcheonDownShield,hn as fishheadDownShield,$e as getDOMPixelRatio,mn as hexagonHorizontalShield,Sn as hexagonVerticalShield,cn as homePlateDownShield,yn as homePlateUpShield,bn as octagonVerticalShield,Gt as ovalShield,Tn as paBeltShield,gn as pentagonUpShield,wn as pillShield,rn as roundedRectShield,G as roundedRectTextConstraint,O as textConstraint,ae as transposeImageData,sn as trapezoidDownShield,fn as trapezoidUpShield,un as triangleDownShield};
//# sourceMappingURL=index.js.map
{
"name": "@americana/maplibre-shield-generator",
"description": "Generate highway shields for maplibre-gl-js maps",
"version": "0.0.3-test-1",
"version": "0.0.4-dev0",
"author": "OpenStreetMap Americana Contributors",

@@ -18,8 +18,3 @@ "type": "module",

"license": "CC0-1.0",
"main": "dist/maplibre-shield-generator-cjs.js",
"module": "dist/maplibre-shield-generator-esm.js",
"browser": {
"dist/maplibre-shield-generator-cjs.js": "dist/maplibre-shield-generator.js",
"dist/maplibre-shield-generator-esm.js": "dist/maplibre-shield-generator-esm.js"
},
"main": "dist/index.js",
"source": "src/index.ts",

@@ -34,2 +29,3 @@ "devDependencies": {

"ts-node": "^10.9.1",
"typedoc": "^0.24.8",
"typescript": "^4.9.5"

@@ -40,6 +36,7 @@ },

"code_format:prettier": "prettier --write --list-different .",
"clean": "shx rm -rf dist",
"clean": "shx rm -rf dist docs",
"docs": "npx typedoc src/index.ts",
"test": "npm exec -- ts-mocha",
"build:code": "node scripts/build.js",
"build": "run-s clean build:code",
"build": "run-s clean build:code docs",
"preversion": "npm version --no-git-tag-version --preid alpha",

@@ -60,8 +57,10 @@ "publish-alpha": "npm publish --access=public --tag alpha"

},
"files": [
"dist/*"
],
"directories": {
"test": "test"
}
},
"files": [
"dist/",
"docs/",
"README.md"
]
}

@@ -7,5 +7,5 @@ # Americana Shield Renderer

## Usage
## Shield rendering workflow
Rendering shields requires the following components:
Rendering shields requires the following compoments:

@@ -16,10 +16,4 @@ 1. **Encode shield information in vector tiles**. First, your tiles must contain the information which tells the shield renderer what shields to draw. In OpenMapTiles, shield information is encoded in the [`transportation_name`](https://openmaptiles.org/schema/#transportation_name) vector tile layer with a series of attributes named `route_1`, `route_2`, etc. Each attribute contains a text string which contains all of the information needed to determine which graphic to display, including numeric route number if the shield is numbered. However, this library allows you to specify how the shield information has been encoded, and it's possible to stitch together data from multiple fields when encoding shield data.

3. Import the library:
```html
<script type="text/javascript" src="maplibre-shield-generator.js"></script>
```
3. **Define a parser that describes how route information is encoded**. There are three parts to a route definition:
4. **Define a parser that describes how route information is encoded**. There are three parts to a route definition:
1. The `network` string, which defines a network with a common shield shape, graphic, and color

@@ -47,3 +41,3 @@ 1. The `ref` string, which defines a text sequence that should be drawn on top of the shield graphic

5. **(Optional) Create predicates that define which shields will be handled**. For example, if all sprite IDs in your style that need a shield begin with the string `shield|`, this would look like:
4. **(Optional) Create predicates that define which shields will be handled**. For example, if all sprite IDs in your style that need a shield begin with the string `shield|`, this would look like:

@@ -63,8 +57,8 @@ ```typescript

6. **Create shield definitions and artwork**. The shield definition is expressed as a JSON file along with a set of sprites containing any raster artwork used for the shields. It can be generated as an object or hosted as a JSON file accessible by URL. See the next section for how to create this definition.
5. **Create shield definitions and artwork**. The shield definition is expressed as a JSON file along with a set of sprites containing any raster artwork used for the shields. It can be generated as an object or hosted as a JSON file accessible by URL. See the next section for how to create this definition.
7. **Hook up the shield generator to a maplibre-gl-js map**. Pass either the URL of the JSON shield definition or create an object in javascript code. There are two separate classes for each approach.
6. **Hook up the shield generator to a maplibre-gl-js map**. Pass either the URL of the JSON shield definition or create an object in javascript code. There are two separate classes for each approach.
```typescript
new mapLibreShieldGenerator.URLShieldRenderer("shields.json", routeParser)
new URLShieldRenderer("shields.json", routeParser)
.filterImageID(shieldPredicate)

@@ -76,3 +70,3 @@ .filterNetwork(networkPredicate)

```typescript
new mapLibreShieldGenerator.ShieldRenderer(shields, routeParser)
new ShieldRenderer(shields, routeParser)
.filterImageID(shieldPredicate)

@@ -83,3 +77,3 @@ .filterNetwork(networkPredicate)

## Shield definition
## Shield Definition

@@ -328,1 +322,5 @@ The purpose of the shield definition is to define which graphics and text to draw for each network/ref/name combination that you wish to display. This can be created in javascript as an object, or as an HTTP-accessible JSON file.

In addition to the stock drawing functions, a custom draw function can be specified. `paDot` and `branson` are included as examples of this, for rendering the [Allegheny County belt system](https://en.wikipedia.org/wiki/Allegheny_County_belt_system) and the Branson, Missouri colored route system. See the file `src/custom_shields.mjs` for an example of how this is done.
## Documentation
See [TypeDoc generated documentation](./docs/index.html) for detailed API information.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc