// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later // @source: https://gitlab.com/soapbox-pub/ditto/-/tree/f0a3877c var e=/^(\d+)px-(.+)$/,t=[20,40,60,120,250,330,500,960,1280,1920,3840];function n(e,n){let r=n?t.filter(e=>e<=n):t;if(r.length)return r.find(t=>t>=e)??r[r.length-1]}function r(t,r,i){if(!t)return;let a;try{a=new URL(t)}catch{return t}if(a.hostname!==`upload.wikimedia.org`)return t;let o=a.pathname.split(`/`),s=o[o.length-1],c=e.exec(s);if(!c)return t;let l=n(r,i);return l===void 0?t:(o[o.length-1]=`${l}px-${c[2]}`,a.pathname=o.join(`/`),a.toString())}export{r as t}; // @license-end