1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0cd05-6f26-7592-80da-85df758daee6")}catch(e){}}();const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-FAjCZuP0.js","assets/jsx-runtime-Cmd40i93.js"])))=>i.map(i=>d[i]); 2import{$ as e,nt as s,o as t,t as n}from"./jsx-runtime-Cmd40i93.js";import{a,n as o,o as i}from"./lib-DQU0LZkq.js";import{m as r}from"./errorBoundaries-ChBCqxq9.js";import{t as l}from"./compiler-runtime-CIelH7Jt.js";import{o as c,t as d}from"./PackageManagerCode-pMRdaxti.js";import{i as m}from"./CollectionManager-BmTDIUab.js";import{t as f}from"./SegmentedControl-CaObXP1M.js";import{t as h}from"./Modal-Dx5D6uDV.js";import{n as p}from"./Stack-CY8s-X00.js";import{t as u}from"./Text-BsPlXVRb.js";import{t as j}from"./Button-DD02CSeZ.js";import{n as y,t as x}from"./download-CHe_g3ey.js";import{t as v}from"./IconExternalLink-Dhn-rDFX.js";import{a as g,n as b}from"./font-labels-FGupAmqX.js";import{f as w,s as k}from"./CollectionsProvider-DHTekDdv.js";import{r as I}from"./meta-Cj2BVrCf.js";import{n as T,t as _}from"./CopyCodeBlock-C1y5_RWK.js";var C=s(e(),1),N=l(),$="n3TnvG_codeStack",S="n3TnvG_deliveryHeading",F="n3TnvG_download",z="n3TnvG_downloadButton",G="n3TnvG_empty",R="n3TnvG_feedback",D="n3TnvG_fontDetails",L="n3TnvG_fontRow",P="n3TnvG_fonts",A="n3TnvG_intro",B="n3TnvG_notice",E="n3TnvG_page",M="n3TnvG_rowActions",O="n3TnvG_specimen",U="n3TnvG_unavailableFontRow",H="n3TnvG_utilities",q="n3TnvG_website",V=262144e3,Z=class extends Error{code;constructor(e,s){super(e),this.code=s,this.name="FontSetArchiveError"}},J=()=>new DOMException("Archive creation aborted","AbortError"),K=(e,s)=>new Promise((t,n)=>{if(s?.aborted)return void n(J());const a=()=>{clearTimeout(o),n(J())},o=setTimeout(()=>{s?.removeEventListener("abort",a),t()},e);s?.addEventListener("abort",a,{once:!0})}),Y=async(e,s)=>{const t=`https://api.fontsource.org/v1/download/${encodeURIComponent(e)}`;for(let n=0;n<20;n+=1){const n=await fetch(t,{signal:s});if(202===n.status){await(n.body?.cancel());const e=Number(n.headers.get("Retry-After"))||3;await K(1e3*Math.min(Math.max(e,1),5),s);continue}if(!n.ok)throw new Error(`Unable to download ${e}`);if(Number(n.headers.get("Content-Length"))>V)throw new Z("Font set is too large","too-large");return new Uint8Array(await n.arrayBuffer())}throw new Error(`Timed out preparing ${e}`)},Q=e=>e.replaceAll("\\","/").split("/").filter(e=>e&&"."!==e&&".."!==e).join("/"),W=e=>{const s=e.replace(/[^a-z0-9_-]+/gi,"-").replace(/^-+|-+$/g,"");if(!s)throw new Z("Invalid font family ID","invalid-family");return s},X=e=>T(e.packageName,e.packageVersion,"index.css"),ee=e=>e.map(e=>`.font-${e.familyId} {\n font-family: ${JSON.stringify(e.fontFamily)};\n}`).join("\n\n"),se=n(),te=e=>{const s=(0,N.c)(41),{busy:t,item:n,onRemove:a}=e,i="symbols"!==n.classification||Boolean(n.previewText);let r,l;s[0]!==n||s[1]!==i?(r=i&&(0,se.jsx)("link",{rel:"stylesheet",href:X(n)}),s[0]=n,s[1]=i,s[2]=r):r=s[2],s[3]!==n.fontFamily||s[4]!==i?(l=i?{fontFamily:`${JSON.stringify(n.fontFamily)}, var(--mantine-font-family)`}:void 0,s[3]=n.fontFamily,s[4]=i,s[5]=l):l=s[5];const c=n.previewText??n.family;let d;s[6]!==l||s[7]!==c?(d=(0,se.jsx)("div",{className:O,style:l,children:c}),s[6]=l,s[7]=c,s[8]=d):d=s[8];const f=`/fonts/${n.familyId}`;let h;s[9]!==n.family||s[10]!==f?(h=(0,se.jsx)("h2",{children:(0,se.jsx)(o,{to:f,children:n.family})}),s[9]=n.family,s[10]=f,s[11]=h):h=s[11];const p=n.designer?`By ${n.designer} · `:"";let u,y,x;s[12]!==n.classification?(u=b(n.classification),s[12]=n.classification,s[13]=u):u=s[13],s[14]!==p||s[15]!==u?(y=(0,se.jsxs)("p",{children:[p,u]}),s[14]=p,s[15]=u,s[16]=y):y=s[16],s[17]!==n.familyId||s[18]!==n.license.id||s[19]!==n.license.url?(x=n.license.url?(0,se.jsxs)("a",{href:n.license.url,target:"_blank",rel:"noreferrer",children:[n.license.id,(0,se.jsx)(v,{"aria-hidden":!0,size:14})]}):(0,se.jsx)(o,{to:`/fonts/${n.familyId}/about#license`,children:"View license"}),s[17]=n.familyId,s[18]=n.license.id,s[19]=n.license.url,s[20]=x):x=s[20];const g=`/fonts/${n.familyId}/use?tab=web`,w=`Developer setup for ${n.family}`;let k,I;s[21]!==g||s[22]!==w?(k=(0,se.jsx)(o,{to:g,"aria-label":w,children:"Developer setup"}),s[21]=g,s[22]=w,s[23]=k):k=s[23],s[24]===Symbol.for("react.memo_cache_sentinel")?(I=(0,se.jsx)(m,{"aria-hidden":!0,size:16}),s[24]=I):I=s[24];const T=`Remove ${n.family} from font set`;let _,C,$,S;return s[25]!==t||s[26]!==a||s[27]!==T?(_=(0,se.jsx)(j,{variant:"subtle",color:"gray",disabled:t,leftSection:I,"aria-label":T,onClick:a,children:"Remove"}),s[25]=t,s[26]=a,s[27]=T,s[28]=_):_=s[28],s[29]!==x||s[30]!==k||s[31]!==_?(C=(0,se.jsxs)("div",{className:M,children:[x,k,_]}),s[29]=x,s[30]=k,s[31]=_,s[32]=C):C=s[32],s[33]!==C||s[34]!==h||s[35]!==y?($=(0,se.jsxs)("div",{className:D,children:[h,y,C]}),s[33]=C,s[34]=h,s[35]=y,s[36]=$):$=s[36],s[37]!==r||s[38]!==$||s[39]!==d?(S=(0,se.jsxs)("article",{className:L,children:[r,d,$]}),s[37]=r,s[38]=$,s[39]=d,s[40]=S):S=s[40],S},ne=()=>{const e=k(),s=a(),[t,n]=i(),l=w(e.ready$),m=w(e.getItems),v=m.map(e=>
2e.familyId),I=v.join(","),[T,N]=(0,C.useState)(0),D=`${I}:${T}`,L=s.data?.requestId===D?s.data:void 0,M=new Map((s.data?.items??[]).map(e=>[e.familyId,e])),O=v.flatMap(e=>{const s=M.get(e);return s?[s]:[]}),V=l&&m.length>0&&(!L||"idle"!==s.state),K=!V&&Boolean(L)&&!L?.error&&0===L?.failedIds.length&&O.length>0&&O.length===m.length,ne="cdn"===t.get("method")?"cdn":"package",ae="website"===t.get("view")?"website":"files",[oe,ie]=(0,C.useState)(),[re,le]=(0,C.useState)(!1),[ce,de]=(0,C.useState)("idle"),[me,fe]=(0,C.useState)(0),[he,pe]=(0,C.useState)(),ue=(0,C.useRef)(void 0),je="preparing"===ce,ye=O.map(e=>e.packageName).join(" "),xe=O.map(e=>({id:e.familyId,family:e.family})),ve=O.map(e=>`import "${e.packageName}";`).join("\n"),ge=O.map(e=>`<link rel="stylesheet" href="${X(e)}" />`).join("\n"),be=(e,s,a)=>{const o=new URLSearchParams(t);s===a?o.delete(e):o.set(e,s),n(o,{preventScrollReset:!0})};(0,C.useEffect)(()=>()=>ue.current?.abort(),[]),(0,C.useEffect)(()=>{if(!l||!I)return;const e=new FormData;e.set("requestId",D);for(const s of I.split(","))e.append("fontId",s);s.submit(e,{action:"/resources/font-set-items",method:"post"})},[s.submit,l,D,I]);const we=s=>{je||(e.removeItem(s.familyId),ie(s))};return(0,se.jsxs)("div",{className:E,children:[(0,se.jsxs)("header",{className:A,children:[(0,se.jsxs)("div",{children:[(0,se.jsxs)("h1",{children:["Font set",l&&m.length>0&&(0,se.jsx)("span",{children:m.length})]}),(0,se.jsx)("p",{children:"Download your fonts together, or use them on a website."})]}),m.length>0&&(0,se.jsxs)(p,{gap:"xs",className:H,children:[(0,se.jsx)(j,{component:o,to:"/",variant:"subtle",children:"Browse fonts"}),(0,se.jsx)(g,{fonts:K?xe:[]}),(0,se.jsx)(j,{variant:"subtle",color:"gray",disabled:je,onClick:()=>le(!0),children:"Remove all"})]})]}),oe&&(0,se.jsxs)("div",{className:B,role:"status",children:[(0,se.jsxs)("span",{children:[oe.family," removed."]}),(0,se.jsx)(j,{variant:"subtle",disabled:je,onClick:()=>{oe&&(N(e=>e+1),e.addItem({familyId:oe.familyId}),ie(void 0))},children:"Undo"}),(0,se.jsx)(j,{variant:"subtle",color:"gray",onClick:()=>ie(void 0),children:"Dismiss"})]}),l?0===m.length?(0,se.jsxs)("section",{className:G,children:[(0,se.jsx)("h2",{children:"Your font set is empty."}),(0,se.jsx)("p",{children:"Add fonts while you browse. Your selection stays in this browser."}),(0,se.jsx)(j,{component:o,to:"/",children:"Browse fonts"})]}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(c,{value:ae,onChange:e=>e&&be("view",e,"files"),children:[(0,se.jsxs)(c.List,{"aria-label":"Font set output",children:[(0,se.jsx)(c.Tab,{value:"files",children:"Download files"}),(0,se.jsx)(c.Tab,{value:"website",children:"Developer setup"})]}),(0,se.jsxs)(c.Panel,{value:"files",className:F,children:[(0,se.jsxs)("div",{children:[(0,se.jsx)("h2",{children:"All your fonts, one ZIP"}),(0,se.jsx)("p",{children:"Complete desktop and web files, stylesheets, and licenses. Organized by family."})]}),(0,se.jsx)(j,{className:z,leftSection:(0,se.jsx)(y,{"aria-hidden":!0,size:18}),disabled:!K||je,onClick:async()=>{if(!K||je)return;const e=new AbortController;ue.current=e,de("preparing"),fe(0),pe(void 0);try{const s=await(async(e,s,{getFamilyArchive:t=Y,maxExpandedBytes:n=262144e3,signal:a}={})=>{const{unzip:o,zip:i}=await r(async()=>{const{unzip:e,zip:s}=await import("./browser-FAjCZuP0.js").then(e=>e.r);return{unzip:e,zip:s}},__vite__mapDeps([0,1])),l={};let c=0;for(const[r,m]of e.entries()){if(a?.aborted)throw J();const e=await t(m.familyId,a),i=await new Promise((s,t)=>{o(e,(e,n)=>{e?t(e):s(n)})}),d=W(m.familyId);for(const[s,t]of Object.entries(i)){const e=Q(s);if(e){if(c+=t.byteLength,c>n)throw new Z("Font set is too large","too-large");l[`${d}/${e}`]=t}}s(r+1)}if(a?.aborted)throw J();const d=await new Promise((e,s)=>{i(l,{consume:!0,level:6},(t,n)=>{t?s(t):e(n)})});return new Blob([d],{type:"application/zip"})})(O,fe,{signal:e.signal});x("fontsource-font-set.zip",s),de("success")}catch(s){if(e.signal.aborted)return void de("idle");pe(s instanceof Z&&"too-large"===s.code?"This font set is too large to prepare safely in your browser. Download the families separately.":"The font set could not be downloaded. Check your connection and try again."),de("error")}finally{ue.current===e&&(ue.current=void 0)}},children:je?"Preparing ZIPâ¦":"Download all (.zip)"})]}),(0,se.jsxs)(c.Panel,{value:"website",className:q,children:[(0,se.jsxs)("div",{className:S,children:[(0,se.jsxs)("div",{children:[(0,se.jsx)("h2",{children:"Use your fonts"}),(0,se.jsx)("p",{children:"package"===ne?"Install the packages to serve the fonts with your app.":"Load the stylesheets from jsDelivr in your HTML."})]}),(0,se.jsx)(f,{"aria-label":"Font delivery",value:ne,onChange:e=>be("method",e,"package"),data:[{label:"Packages",value:"package"},{label:"CDN",value:"cdn"}]})]}),K&&(0,se.jsxs)("div",{className:$,children:["package"===ne?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(d,{cmd:ye}),(0,se.jsx)(_,{label:"Import fonts",description:"Import these stylesheets once in your appâs entry file.",code:ve,language:"js",scrollable:!0}),(0,se.jsx)(o,{to:"/docs/getting-started/install",children:"Installation guide"})]}):(0,se.jsx)(_,{label:"Link stylesheets",description:(0,se.jsxs)(se.Fragment,{children:["Add these links inside your HTML"," ",(0,se.jsx)("code",{children:"<head>"}),"."]}),code:ge,language:"html",scrollable:!0}),(0,se.jsx)(_,{label:"Apply the fonts",description:"Use these classes on your elements, or copy a font-family declaration into your existing CSS.",code:ee(O),language:"css",scrollable:!0})]})]})]}),"idle"!==ce&&(0,se.jsx)("p",{role:"status",className:R,children:je?`Preparing ${me} of ${O.length} fontsâ¦`:"success"===ce?"Font set download started.":he}),V?(0,se.jsx)("p",{role:"status",children:"Loading font detailsâ¦"}):!K&&(0,se.jsxs)("div",{className:B,role:"alert",children:[(0,se.jsx)("span",{children:L?.error??"Some fonts could not be loaded. Retry or remove them to use the complete set."}),(0,se.jsx)(j,{variant:"subtle",onClick:()=>N(e=>e+1),children:"Try again"})]}),(0,se.jsx)("section",{className:P,"aria-label":"Selected fonts",children:v.map(e=>{const s=M.get(e);if(s)return(0,se.jsx)(te,{busy:je,item:s,onRemove:()=>we(s)},e);const t=b(e);return(0,se.jsxs)("article",{className:U,children:[(0,se.jsxs)("div",{children:[(0,se.jsx)("h2",{children:(0,se.jsx)(o,{to:`/fonts/${e}`,children:t})}),(0,se.jsx)("p",{children:V?"Loading font detailsâ¦":"Font details unavailable."})]}),(0,se.jsx)(j,{variant:"subtle",color:"gray",disabled:je,"aria-label":`Remove ${t} from font set`,onClick:()=>we({familyId:e,family:t}),children:"Remove"})]},e)})})]}):(0,se.jsx)("p",{role:"status",children:"Loading your font setâ¦"}),(0,se.jsxs)(h,{centered:!0,onClose:()=>le(!1),opened:re,size:"sm",title:"Clear this font set?",children:[(0,se.jsxs)(u,{c:"dimmed",fz:"sm",children:["This removes ",m.length," ",1===m.length?"font":"fonts"," from this browser."]}
2),(0,se.jsxs)(p,{justify:"flex-end",mt:"xl",children:[(0,se.jsx)(j,{variant:"subtle",onClick:()=>le(!1),children:"Keep fonts"}),(0,se.jsx)(j,{color:"red",disabled:je,onClick:()=>{je||(e.clear(),ie(void 0),le(!1))},children:"Remove all"})]})]})]})},ae=()=>I({title:"Font Set | Fontsource",description:"Keep font families together, download them in one bundle, or generate a combined website starting point."}),oe=t(function(){const e=(0,N.c)(1);let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,se.jsx)(ne,{}),e[0]=s):s=e[0],s});export{oe as default,ae as meta}; 3//# chunkId=01a0cd05-6f26-7592-80da-85df758daee6
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.