vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Draw avatars with DiceBear instead of by hand
97f77001eed76cc287aeba532c4d670488121a18 · Keenan Nemetz · 8d ago · parent ca098f62
Draw avatars with DiceBear instead of by hand The marks this package drew itself were a design I kept losing arguments with. Avatars are now DiceBear's Shapes style, which is what the request asked for. DiceBear is JavaScript and Vole is a Go binary, so the split is: the server renders the account's initial on its Everforest ground, and an embedded bundle replaces it with the mark when the page runs. The initial is what a browser without scripts keeps, so nothing depends on the bundle arriving; the seed is the account name, so the same person draws the same mark everywhere; and the ground is read from the element, so vole.css remains the only palette. The bundle is core 9.3.1 plus Shapes 9.4.2 (MIT code, CC0 design), built with esbuild and committed like the other vendored scripts: 18KB, 5.5KB gzipped. Its source is scripts/avatars-entry.js, and the licence files beside it are inventoried in NOTICE, so the verify workflow's licence check keeps passing. No request leaves the instance and no avatar is stored. Two details worth naming. Each mark gets a unique clip-mask id, because SVG ids are document-wide and a directory page holds fifty of them. And the RDF metadata block DiceBear embeds is stripped: it is identical for every avatar and its licence is in NOTICE, so repeating it in the DOM would be weight without information.
server/web/static/dicebear-avatars.min.js +38
| @@ -0,0 +1,38 @@ | |||
| 1 | /*! Vole avatars: DiceBear core 9.3.1 + Shapes 9.4.2, bundled into one script. | ||
| 2 | * MIT (code) and CC0 1.0 (Shapes design). See server/web/static/dicebear.LICENSE | ||
| 3 | * and server/web/static/dicebear-shapes.LICENSE. | ||
| 4 | * | ||
| 5 | * Built with esbuild. To rebuild after changing the palette or the versions: | ||
| 6 | * | ||
| 7 | * mkdir -p /tmp/dicebear && cd /tmp/dicebear && npm init -y | ||
| 8 | * npm i @dicebear/core@9.3.1 @dicebear/shapes@9.4.2 esbuild@0.25.9 | ||
| 9 | * npx esbuild /path/to/scripts/avatars-entry.js \ | ||
| 10 | * --bundle --minify --format=iife \ | ||
| 11 | * --outfile=/path/to/server/web/static/dicebear-avatars.min.js | ||
| 12 | * | ||
| 13 | * Then run `vole workflow run verify` so the licence inventory is checked. */ | ||
| 14 | |||
| 15 | "use strict";(()=>{var _e=Object.defineProperty;var u=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var we=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},O=(t,e)=>{for(var r in e)_e(t,r,{get:e[r],enumerable:!0})};var m={};O(m,{xml:()=>v});function v(t){return t.replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var k=u(()=>{});function Y(t){var e,r,n,a,l,i,s;let o=(e=t.meta)===null||e===void 0?void 0:e.title,d=(r=t.meta)===null||r===void 0?void 0:r.creator,p=(n=t.meta)===null||n===void 0?void 0:n.source,c=(l=(a=t.meta)===null||a===void 0?void 0:a.license)===null||l===void 0?void 0:l.url,f=Ce(t);return!o&&!d&&!p&&!c&&!f?"":'<metadata xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"><rdf:RDF><rdf:Description>'+(o?`<dc:title>${v(o)}</dc:title>`:"")+(d?`<dc:creator>${v(d)}</dc:creator>`:"")+(p?`<dc:source xsi:type="dcterms:URI">${v((s=(i=t.meta)===null||i===void 0?void 0:i.source)!==null&&s!==void 0?s:"")}</dc:source>`:"")+(c?`<dcterms:license xsi:type="dcterms:URI">${v(c)}</dcterms:license>`:"")+(f?`<dc:rights>${v(f)}</dc:rights>`:"")+"</rdf:Description></rdf:RDF></metadata>"}function Ce(t){var e,r,n,a,l,i,s,o,d,p,c,f,x,$,h;let g=!((e=t.meta)===null||e===void 0)&&e.title?`\u201E${(r=t.meta)===null||r===void 0?void 0:r.title}\u201D`:"Design",w=`\u201E${(a=(n=t.meta)===null||n===void 0?void 0:n.creator)!==null&&a!==void 0?a:"Unknown"}\u201D`;!((l=t.meta)===null||l===void 0)&&l.source&&(g+=` (${t.meta.source})`);let y="";return((s=(i=t.meta)===null||i===void 0?void 0:i.license)===null||s===void 0?void 0:s.name)!=="MIT"&&((o=t.meta)===null||o===void 0?void 0:o.creator)!=="DiceBear"&&(!((d=t.meta)===null||d===void 0)&&d.title)&&(y+="Remix of "),y+=`${g} by ${w}`,!((c=(p=t.meta)===null||p===void 0?void 0:p.license)===null||c===void 0)&&c.name&&(y+=`, licensed under \u201E${(x=(f=t.meta)===null||f===void 0?void 0:f.license)===null||x===void 0?void 0:x.name}\u201D`,!((h=($=t.meta)===null||$===void 0?void 0:$.license)===null||h===void 0)&&h.url&&(y+=` (${t.meta.license.url})`)),y}var Z=u(()=>{k()});function H(t){return t^=t<<13,t^=t>>17,t^=t<<5,t}function ke(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0,e=H(e);return e}function b(t=""){t=t.toString();let e=ke(t)||1,r=()=>e=H(e),n=(a,l)=>Math.floor((r()- -2147483648)/4294967295*(l+1-a)+a);return{seed:t,next:r,bool(a=50){return n(1,100)<=a},integer(a,l){return n(a,l)},pick(a,l){var i;return a.length===0?(r(),l):(i=a[n(0,a.length-1)])!==null&&i!==void 0?i:l},shuffle(a){let l=b(r().toString()),i=[...a];for(let s=i.length-1;s>0;s--){let o=l.integer(0,s);[i[s],i[o]]=[i[o],i[s]]}return i},string(a,l="abcdefghijklmnopqrstuvwxyz1234567890"){let i=b(r().toString()),s="";for(let o=0;o<a;o++)s+=l[i.integer(0,l.length-1)];return s}}}var A=u(()=>{});function _(t){let e=t.attributes.viewBox.split(" "),r=parseInt(e[0]),n=parseInt(e[1]),a=parseInt(e[2]),l=parseInt(e[3]);return{x:r,y:n,width:a,height:l}}function j(t,e,r,n,a){let{width:l,height:i,x:s,y:o}=_(t),d=`<rect fill="${e}" width="${l}" height="${i}" x="${s}" y="${o}" />`;switch(n){case"solid":return d+t.body;case"gradientLinear":return`<rect fill="url(#backgroundLinear)" width="${l}" height="${i}" x="${s}" y="${o}" /><defs><linearGradient id="backgroundLinear" gradientTransform="rotate(${a} 0.5 0.5)"><stop stop-color="${e}"/><stop offset="1" stop-color="${r}"/></linearGradient></defs>`+t.body}}function z(t,e){let{width:r,height:n,x:a,y:l}=_(t),i=e?(e-100)/100:0,s=(r/2+a)*i*-1,o=(n/2+l)*i*-1;return`<g transform="translate(${s} ${o}) scale(${e/100})">${t.body}</g>`}function B(t,e,r){let n=_(t),a=(n.width+n.x*2)*((e??0)/100),l=(n.height+n.y*2)*((r??0)/100);return`<g transform="translate(${a} ${l})">${t.body}</g>`}function U(t,e){let{width:r,height:n,x:a,y:l}=_(t);return`<g transform="rotate(${e}, ${r/2+a}, ${n/2+l})">${t.body}</g>`}function V(t){let{width:e,x:r}=_(t);return`<g transform="scale(-1 1) translate(${e*-1-r*2} 0)">${t.body}</g>`}function D(t,e){let{width:r,height:n,x:a,y:l}=_(t),i=e?r*e/100:0,s=e?n*e/100:0;return`<mask id="viewboxMask"><rect width="${r}" height="${n}" rx="${i}" ry="${s}" x="${a}" y="${l}" fill="#fff" /></mask><g mask="url(#viewboxMask)">${t.body}</g>`}function T(t){let e={xmlns:"http://www.w3.org/2000/svg",...t.attributes};return Object.keys(e).map(r=>`${v(r)}="${v(e[r])}"`).join(" ")}function N(t){let e=b(Math.random().toString()),r={};return t.body.replace(/(id="|url\(#)([a-z0-9-_]+)([")])/gi,(n,a,l,i)=>(r[l]=r[l]||e.string(8),`${a}${r[l]}${i}`))}var P=u(()=>{k();A()});var q,I=u(()=>{q={type:"object",$schema:"http://json-schema.org/draft-07/schema#",properties:{seed:{type:"string"},flip:{type:"boolean",default:!1},rotate:{type:"integer",minimum:0,maximum:360,default:0},scale:{type:"integer",minimum:0,maximum:200,default:100},radius:{type:"integer",minimum:0,maximum:50,default:0},size:{type:"integer",minimum:1},backgroundColor:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"}},backgroundType:{type:"array",items:{type:"string",enum:["solid","gradientLinear"]},default:["solid"]},backgroundRotation:{type:"array",items:{type:"integer",minimum:-360,maximum:360},default:[0,360]},translateX:{type:"integer",minimum:-100,maximum:100,default:0},translateY:{type:"integer",minimum:-100,maximum:100,default:0},clip:{type:"boolean",default:!0},randomizeIds:{type:"boolean",default:!1}}}});function J(t){var e;let r={},n=(e=t.properties)!==null&&e!==void 0?e:{};return Object.keys(n).forEach(a=>{let l=n[a];typeof l=="object"&&l.default!==void 0&&(Array.isArray(l.default)?r[a]=[...l.default]:typeof l.default=="object"?r[a]={...l.default}:r[a]=l.default)}),r}function E(t,e){var r;let n={...J(q),...J((r=t.schema)!==null&&r!==void 0?r:{}),...e};return JSON.parse(JSON.stringify(n))}var G=u(()=>{I()});function K(t){return t==="transparent"?t:`#${t}`}function Q(t,e,r){var n;let a=t.shuffle(e);a.length<=1||e.length==2&&r=="gradientLinear"?(a=e,t.next()):a=t.shuffle(e),a.length===0&&(a=["transparent"]);let l=a[0],i=(n=a[1])!==null&&n!==void 0?n:a[0];return{primary:K(l),secondary:K(i)}}var W=u(()=>{});function ee(t,e={}){var r,n,a,l,i;e=E(t,e);let s=b(e.seed),o=t.create({prng:s,options:e}),d=s.pick((r=e.backgroundType)!==null&&r!==void 0?r:[],"solid"),{primary:p,secondary:c}=Q(s,(n=e.backgroundColor)!==null&&n!==void 0?n:[],d),f=s.integer(!((a=e.backgroundRotation)===null||a===void 0)&&a.length?Math.min(...e.backgroundRotation):0,!((l=e.backgroundRotation)===null||l===void 0)&&l.length?Math.max(...e.backgroundRotation):0);e.size&&(o.attributes.width=e.size.toString(),o.attributes.height=e.size.toString()),e.scale!==void 0&&e.scale!==100&&(o.body=z(o,e.scale)),e.flip&&(o.body=V(o)),e.rotate&&(o.body=U(o,e.rotate)),(e.translateX||e.translateY)&&(o.body=B(o,e.translateX,e.translateY)),p!=="transparent"&&c!=="transparent"&&(o.body=j(o,p,c,d,f)),(e.radius||e.clip)&&(o.body=D(o,(i=e.radius)!==null&&i!==void 0?i:0)),e.randomizeIds&&(o.body=N(o));let x=T(o),$=Y(t),h=`<svg ${x}>${$}${o.body}</svg>`;return{toString:()=>h,toJson:()=>{var g;return{svg:h,extra:{primaryBackgroundColor:p,secondaryBackgroundColor:c,backgroundType:d,backgroundRotation:f,...(g=o.extra)===null||g===void 0?void 0:g.call(o)}}},toDataUri:()=>`data:image/svg+xml;utf8,${encodeURIComponent(h)}`}}var te=u(()=>{P();G();A();Z();W()});var re=u(()=>{});var C=u(()=>{Z();k();te();I();re();});var ae,le=u(()=>{C();ae={rectangle:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M90 10H10v80h80V10ZM0 0v100h100V0H0Z" fill="${m.xml(`${e.shape1}`)}"/>`,rectangleFilled:(t,e)=>`<path d="M0 0h100v100H0V0Z" fill="${m.xml(`${e.shape1}`)}"/>`,ellipseFilled:(t,e)=>`<path d="M100 50A50 50 0 1 1 0 50a50 50 0 0 1 100 0Z" fill="${m.xml(`${e.shape1}`)}"/>`,ellipse:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 90a40 40 0 1 0 0-80 40 40 0 0 0 0 80Zm0 10A50 50 0 1 0 50 0a50 50 0 0 0 0 100Z" fill="${m.xml(`${e.shape1}`)}"/>`,polygonFilled:(t,e)=>`<path d="m50 7 50 86.6H0L50 7Z" fill="${m.xml(`${e.shape1}`)}"/>`,polygon:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 7 0 93.6h100L50 7Zm0 20L17.3 83.6h65.4L50 27Z" fill="${m.xml(`${e.shape1}`)}"/>`,line:(t,e)=>`<path fill="${m.xml(`${e.shape1}`)}" d="M45-150h10v400H45z"/>`}});var ne,oe=u(()=>{C();ne={rectangle:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M90 10H10v80h80V10ZM0 0v100h100V0H0Z" fill="${m.xml(`${e.shape2}`)}"/>`,rectangleFilled:(t,e)=>`<path d="M0 0h100v100H0V0Z" fill="${m.xml(`${e.shape2}`)}"/>`,ellipseFilled:(t,e)=>`<path d="M100 50A50 50 0 1 1 0 50a50 50 0 0 1 100 0Z" fill="${m.xml(`${e.shape2}`)}"/>`,ellipse:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 90a40 40 0 1 0 0-80 40 40 0 0 0 0 80Zm0 10A50 50 0 1 0 50 0a50 50 0 0 0 0 100Z" fill="${m.xml(`${e.shape2}`)}"/>`,polygonFilled:(t,e)=>`<path d="m50 7 50 86.6H0L50 7Z" fill="${m.xml(`${e.shape2}`)}"/>`,polygon:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 7 0 93.6h100L50 7Zm0 20L17.3 83.6h65.4L50 27Z" fill="${m.xml(`${e.shape2}`)}"/>`,line:(t,e)=>`<path fill="${m.xml(`${e.shape2}`)}" d="M45-150h10v400H45z"/>`}});var ie,se=u(()=>{C();ie={rectangle:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M90 10H10v80h80V10ZM0 0v100h100V0H0Z" fill="${m.xml(`${e.shape3}`)}"/>`,rectangleFilled:(t,e)=>`<path d="M0 0h100v100H0V0Z" fill="${m.xml(`${e.shape3}`)}"/>`,ellipseFilled:(t,e)=>`<path d="M100 50A50 50 0 1 1 0 50a50 50 0 0 1 100 0Z" fill="${m.xml(`${e.shape3}`)}"/>`,ellipse:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 90a40 40 0 1 0 0-80 40 40 0 0 0 0 80Zm0 10A50 50 0 1 0 50 0a50 50 0 0 0 0 100Z" fill="${m.xml(`${e.shape3}`)}"/>`,polygonFilled:(t,e)=>`<path d="m50 7 50 86.6H0L50 7Z" fill="${m.xml(`${e.shape3}`)}"/>`,polygon:(t,e)=>`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 7 0 93.6h100L50 7Zm0 20L17.3 83.6h65.4L50 27Z" fill="${m.xml(`${e.shape3}`)}"/>`,line:(t,e)=>`<path fill="${m.xml(`${e.shape3}`)}" d="M45-150h10v400H45z"/>`}});var R={};O(R,{shape1:()=>ae,shape2:()=>ne,shape3:()=>ie});var de=u(()=>{le();oe();se()});function M({prng:t,group:e,width:r,height:n,values:a=[],rotation:l,offsetX:i,offsetY:s}){let o=R,d=t.pick(a),p=t.integer(Math.min(...l),Math.max(...l)),c=t.integer(Math.min(...i),Math.max(...i)),f=t.integer(Math.min(...s),Math.max(...s));if(d&&o[e][d])return{name:d,value(x,$){var h,g,w;let y=o[e][d](x,$);return(this.rotation||this.offsetX||this.offsetY)&&(y=`<g transform="translate(${(h=this.offsetX)!==null&&h!==void 0?h:0}, ${(g=this.offsetY)!==null&&g!==void 0?g:0}) rotate(${(w=this.rotation)!==null&&w!==void 0?w:0} ${r/2} ${n/2})">${y}</g>`),y},rotation:p,offsetX:c,offsetY:f}}var me=u(()=>{de()});function pe({prng:t,options:e}){var r,n,a,l,i,s,o,d,p;let c=M({prng:t,group:"shape1",values:e.shape1,width:100,height:100,rotation:!((r=e.shape1Rotation)===null||r===void 0)&&r.length?e.shape1Rotation:[0],offsetX:!((n=e.shape1OffsetX)===null||n===void 0)&&n.length?e.shape1OffsetX:[0],offsetY:!((a=e.shape1OffsetY)===null||a===void 0)&&a.length?e.shape1OffsetY:[0]}),f=M({prng:t,group:"shape2",values:e.shape2,width:100,height:100,rotation:!((l=e.shape2Rotation)===null||l===void 0)&&l.length?e.shape2Rotation:[0],offsetX:!((i=e.shape2OffsetX)===null||i===void 0)&&i.length?e.shape2OffsetX:[0],offsetY:!((s=e.shape2OffsetY)===null||s===void 0)&&s.length?e.shape2OffsetY:[0]}),x=M({prng:t,group:"shape3",values:e.shape3,width:100,height:100,rotation:!((o=e.shape3Rotation)===null||o===void 0)&&o.length?e.shape3Rotation:[0],offsetX:!((d=e.shape3OffsetX)===null||d===void 0)&&d.length?e.shape3OffsetX:[0],offsetY:!((p=e.shape3OffsetY)===null||p===void 0)&&p.length?e.shape3OffsetY:[0]});return{shape1:c,shape2:f,shape3:x}}var ce=u(()=>{me()});function F(t){return t==="transparent"?t:`#${t}`}var ue=u(()=>{});function fe({prng:t,options:e}){var r,n,a;return{shape1:F(t.pick((r=e.shape1Color)!==null&&r!==void 0?r:[],"transparent")),shape2:F(t.pick((n=e.shape2Color)!==null&&n!==void 0?n:[],"transparent")),shape3:F(t.pick((a=e.shape3Color)!==null&&a!==void 0?a:[],"transparent"))}}var he=u(()=>{ue()});function ge({prng:t,options:e}){var r,n,a,l;let i=new Set;function s(d){let p=d.filter(c=>!i.has(c));return p.length>0?p:d}function o(d){let p=s(d),c=t.pick(p,"transparent");return i.add(c),c}e.shape1Color=[o((r=e.shape1Color)!==null&&r!==void 0?r:[])],e.shape2Color=[o((n=e.shape2Color)!==null&&n!==void 0?n:[])],e.shape3Color=[o((a=e.shape3Color)!==null&&a!==void 0?a:[])],e.backgroundColor=s((l=e.backgroundColor)!==null&&l!==void 0?l:[])}var ve=u(()=>{});var xe,ye=u(()=>{xe={$schema:"http://json-schema.org/draft-07/schema#",properties:{backgroundColor:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"},default:["0a5b83","1c799f","69d2e7","f1f4dc","f88c49"]},shape1:{type:"array",items:{type:"string",enum:["rectangle","rectangleFilled","ellipseFilled","ellipse","polygonFilled","polygon","line"]},default:["rectangleFilled","ellipseFilled","polygonFilled"]},shape1Color:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"},default:["0a5b83","1c799f","69d2e7","f1f4dc","f88c49"]},shape1OffsetX:{type:"array",items:{type:"integer",minimum:-65,maximum:65},maxItems:2,default:[-65,65]},shape1OffsetY:{type:"array",items:{type:"integer",minimum:-45,maximum:45},maxItems:2,default:[-45,45]},shape1Rotation:{type:"array",items:{type:"integer",minimum:-160,maximum:160},maxItems:2,default:[-160,160]},shape2:{type:"array",items:{type:"string",enum:["rectangle","rectangleFilled","ellipseFilled","ellipse","polygonFilled","polygon","line"]},default:["rectangleFilled","ellipseFilled","polygonFilled","line"]},shape2Color:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"},default:["0a5b83","1c799f","69d2e7","f1f4dc","f88c49"]},shape2OffsetX:{type:"array",items:{type:"integer",minimum:-40,maximum:40},maxItems:2,default:[-40,40]},shape2OffsetY:{type:"array",items:{type:"integer",minimum:-40,maximum:40},maxItems:2,default:[-40,40]},shape2Rotation:{type:"array",items:{type:"integer",minimum:-180,maximum:180},maxItems:2,default:[-180,180]},shape3:{type:"array",items:{type:"string",enum:["rectangle","rectangleFilled","ellipseFilled","ellipse","polygonFilled","polygon","line"]},default:["rectangle","rectangleFilled","ellipseFilled","ellipse","polygonFilled","polygon","line"]},shape3Color:{type:"array",items:{type:"string",pattern:"^(transparent|[a-fA-F0-9]{6})$"},default:["0a5b83","1c799f","69d2e7","f1f4dc","f88c49"]},shape3OffsetX:{type:"array",items:{type:"integer",minimum:-25,maximum:25},maxItems:2,default:[-25,25]},shape3OffsetY:{type:"array",items:{type:"integer",minimum:-25,maximum:25},maxItems:2,default:[-25,25]},shape3Rotation:{type:"array",items:{type:"integer",minimum:-180,maximum:180},maxItems:2,default:[-180,180]}}}});var S={};O(S,{create:()=>Oe,meta:()=>Fe,schema:()=>xe});var Fe,Oe,$e=u(()=>{ce();he();ve();ye();Fe={title:"Shapes",creator:"DiceBear",source:"https://www.dicebear.com",homepage:"https://www.dicebear.com",license:{name:"CC0 1.0",url:"https://creativecommons.org/publicdomain/zero/1.0/"}},Oe=({prng:t,options:e})=>{var r,n,a,l,i,s;ge({prng:t,options:e});let o=pe({prng:t,options:e}),d=fe({prng:t,options:e});return{attributes:{viewBox:"0 0 100 100",fill:"none","shape-rendering":"auto"},body:`<g transform="matrix(1.2 0 0 1.2 -10 -10)">${(n=(r=o.shape1)===null||r===void 0?void 0:r.value(o,d))!==null&&n!==void 0?n:""}</g><g transform="matrix(.8 0 0 .8 10 10)">${(l=(a=o.shape2)===null||a===void 0?void 0:a.value(o,d))!==null&&l!==void 0?l:""}</g><g transform="matrix(.4 0 0 .4 30 30)">${(s=(i=o.shape3)===null||i===void 0?void 0:i.value(o,d))!==null&&s!==void 0?s:""}</g>`,extra:()=>({...Object.entries(o).reduce((p,[c,f])=>(p[c]=f?.name,p),{}),...Object.entries(d).reduce((p,[c,f])=>(p[`${c}Color`]=f,p),{})})}}});var Ie=we(()=>{C();$e();var Ze=t=>(getComputedStyle(t).backgroundColor.match(/\d+/g)||[]).map(Number).slice(0,3).map(r=>r.toString(16).padStart(2,"0")).join(""),X=["f0e6d2","2d353b","a7c080","7fbbb3","dbbc7f"],Ae=0,be=t=>{if(t.querySelector("svg"))return;let e=t.getAttribute("data-avatar");if(!e)return;let r=ee(S,{seed:e,size:40,radius:50,backgroundColor:[Ze(t)],shape1Color:X,shape2Color:X,shape3Color:X}).toString();t.innerHTML=r.replace(/<metadata[\s\S]*?<\/metadata>/g,"").replace(/viewboxMask/g,`viewboxMask-${++Ae}`)};window.VoleAvatars={render:be,renderAll(t){t.querySelectorAll("[data-avatar]").forEach(be)}}});Ie();})(); | ||
| 16 | /*! Vole avatars: DiceBear core 9.3.1 + Shapes 9.4.2, bundled into one script. | ||
| 17 | * MIT (code) and CC0 1.0 (Shapes design). See server/web/static/dicebear.LICENSE | ||
| 18 | * and server/web/static/dicebear-shapes.LICENSE. | ||
| 19 | * | ||
| 20 | * Built with esbuild. To rebuild after changing the palette or the versions: | ||
| 21 | * | ||
| 22 | * mkdir -p /tmp/dicebear && cd /tmp/dicebear && npm init -y | ||
| 23 | * npm i @dicebear/core@9.3.1 @dicebear/shapes@9.4.2 esbuild@0.25.9 | ||
| 24 | * npx esbuild /path/to/scripts/avatars-entry.js \ | ||
| 25 | * --bundle --minify --format=iife \ | ||
| 26 | * --outfile=/path/to/server/web/static/dicebear-avatars.min.js | ||
| 27 | * | ||
| 28 | * Then run `vole workflow run verify` so the licence inventory is checked. */ | ||
| 29 | /*! Bundled license information: | ||
| 30 | |||
| 31 | @dicebear/core/lib/index.js: | ||
| 32 | (*! | ||
| 33 | * DiceBear (@dicebear/core) | ||
| 34 | * | ||
| 35 | * Code licensed under MIT (https://github.com/dicebear/dicebear/blob/main/LICENSE) | ||
| 36 | * Copyright (c) 2024 Florian Körner | ||
| 37 | *) | ||
| 38 | */ | ||