You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
1.2 KiB

const t=new Map,n="#05c9ac";function e(e){const r=function(t){if(!t||"string"!=typeof t)return n;let e=t.trim();if(e.startsWith("#")||(e=`#${e}`),/^#[0-9A-Fa-f]{6}$/.test(e))return e;if(/^#[0-9A-Fa-f]{3}$/.test(e)){const t=e[1],n=e[2],r=e[3];return`#${t}${t}${n}${n}${r}${r}`}return n}(e||"");if(t.has(r))return t.get(r);if("undefined"==typeof document)return t.set(r,""),"";const f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 56" width="48" height="56">\n<path fill="${r}" stroke="#ffffff" stroke-width="2" stroke-linejoin="round" d="M24 4C14.6 4 7 11.4 7 20.5C7 32 24 50 24 50S41 32 41 20.5C41 11.4 33.4 4 24 4Z"/>\n<circle cx="24" cy="21" r="7" fill="#ffffff"/>\n<circle cx="24" cy="21" r="3.5" fill="${r}"/>\n</svg>`)}`;return t.set(r,f),f}const r=120;function f(t,n){const e=t.venue_type_color;return e&&"string"==typeof e&&function(t){if(!t||"string"!=typeof t)return null;let n=t.trim();n.startsWith("#")||(n=`#${n}`);const e=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!e)return null;let r=e[1];return 3===r.length&&(r=`${r[0]}${r[0]}${r[1]}${r[1]}${r[2]}${r[2]}`),r.toLowerCase()}(e.trim())?e.trim():n()}export{r as S,e as g,f as t};