@three-blocks/devtools 5.0.0 → 6.0.0-alpha.329.g5455df6647e5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/browser/shader-capture.js +1 -1
- package/dist/{browser-smoke-WWMWRM6S.js → browser-smoke-NTM7XYO6.js} +1 -1
- package/dist/{chunk-6RGA2IVT.js → chunk-IM4TPX74.js} +1 -1
- package/dist/chunk-X5OFYHIY.js +3 -0
- package/dist/cli.js +6 -6
- package/dist/index.d.ts +11 -0
- package/dist/index.js +27 -27
- package/dist/{status-EK3BIJ2K.js → status-6GFLRFEZ.js} +1 -1
- package/dist/{text-atlas-WRYJT3E7.js → text-atlas-UORTLOQJ.js} +1 -1
- package/package.json +9 -4
- package/dist/chunk-JHBQB7WC.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{b as RUNTIME_STATUS_RECEIPT_MAX_BYTES,a as RUNTIME_STATUS_RECEIPT_PATH,c as RUNTIME_STATUS_RECOVERY,e as findProjectRoot,i as formatShaderMatrixStatus,j as formatStatus,k as formatThreeBlocksStatus,f as inspectProject,g as inspectThreeBlocksStatus,d as parseRuntimeStatusReceipt,h as threeBlocksStatusIsFresh}from'./chunk-
|
|
2
|
+
export{b as RUNTIME_STATUS_RECEIPT_MAX_BYTES,a as RUNTIME_STATUS_RECEIPT_PATH,c as RUNTIME_STATUS_RECOVERY,e as findProjectRoot,i as formatShaderMatrixStatus,j as formatStatus,k as formatThreeBlocksStatus,f as inspectProject,g as inspectThreeBlocksStatus,d as parseRuntimeStatusReceipt,h as threeBlocksStatusIsFresh}from'./chunk-IM4TPX74.js';import'./chunk-IILE5RBI.js';import'./chunk-X5OFYHIY.js';export{c as readInstalledShaderRuntime,b as snapshotShaderInputs}from'./chunk-2TSMAC6E.js';import'./chunk-S22OSG76.js';import'./chunk-EE64MV27.js';import'./chunk-QJFPNM6W.js';import'./chunk-ZT6T2W4B.js';import'./chunk-NPLE7PPF.js';import'./chunk-65VEJRRT.js';import'./chunk-5L2VS3BN.js';import'./chunk-HOZDD6PW.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{b as TEXT_ATLAS_GENERATOR_VERSION,a as TEXT_ATLAS_SCHEMA_VERSION,c as builtinFontMetadata,e as generateTextAtlases,g as inspectTextAtlases,f as parseTextAtlasReceipt,d as prewarmBuiltinFont}from'./chunk-
|
|
2
|
+
export{b as TEXT_ATLAS_GENERATOR_VERSION,a as TEXT_ATLAS_SCHEMA_VERSION,c as builtinFontMetadata,e as generateTextAtlases,g as inspectTextAtlases,f as parseTextAtlasReceipt,d as prewarmBuiltinFont}from'./chunk-X5OFYHIY.js';import'./chunk-65VEJRRT.js';import'./chunk-5L2VS3BN.js';import'./chunk-HOZDD6PW.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@three-blocks/devtools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.329.g5455df6647e5",
|
|
4
4
|
"description": "Three Blocks devtools command engine for npx three-blocks; the runtime lives in three-blocks/devtools and the Vite plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"three",
|
|
@@ -78,14 +78,15 @@
|
|
|
78
78
|
"msdf-bmfont-xml": "npm:@pixi/msdf-bmfont-xml@3.0.0",
|
|
79
79
|
"opentype.js": "1.3.4",
|
|
80
80
|
"pngjs": "7.0.0",
|
|
81
|
-
"sharp": "0.35.3"
|
|
81
|
+
"sharp": "0.35.3",
|
|
82
|
+
"subset-font": "2.5.0"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
85
|
"@types/node": "^22.10.0",
|
|
85
86
|
"@types/three": "0.185.0",
|
|
86
87
|
"create-vite": "9.1.1",
|
|
87
88
|
"playwright": "^1.61.1",
|
|
88
|
-
"three-blocks": "0.
|
|
89
|
+
"three-blocks": "0.7.0-alpha.329.g5455df6647e5",
|
|
89
90
|
"tsup": "^8.0.0",
|
|
90
91
|
"typescript": "^5.9.3",
|
|
91
92
|
"vite": "^7.2.2",
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
"peerDependencies": {
|
|
98
99
|
"playwright": "^1.61.1",
|
|
99
100
|
"three": ">=0.185.0",
|
|
100
|
-
"three-blocks": "
|
|
101
|
+
"three-blocks": "0.7.0-alpha.329.g5455df6647e5",
|
|
101
102
|
"typescript": ">=5.9.3 <7.0.0",
|
|
102
103
|
"vite": ">=7.2.2 <9.0.0"
|
|
103
104
|
},
|
|
@@ -111,5 +112,9 @@
|
|
|
111
112
|
"vite": {
|
|
112
113
|
"optional": true
|
|
113
114
|
}
|
|
115
|
+
},
|
|
116
|
+
"threeBlocks": {
|
|
117
|
+
"channel": "alpha",
|
|
118
|
+
"site": "https://preprod.threejs-blocks.com"
|
|
114
119
|
}
|
|
115
120
|
}
|
package/dist/chunk-JHBQB7WC.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {a as a$1}from'./chunk-65VEJRRT.js';import {j,a as a$2,c,h as h$1,b,f}from'./chunk-5L2VS3BN.js';import {a}from'./chunk-HOZDD6PW.js';import {createHash,randomUUID}from'crypto';import {rm,mkdir,writeFile,rename}from'fs/promises';import {platform,homedir}from'os';import h from'path';import {fileURLToPath}from'url';import*as I from'zlib';import {createDefaultContainer,VK_FORMAT_R8G8B8A8_UNORM,KHR_SUPERCOMPRESSION_ZSTD,KHR_SUPERCOMPRESSION_NONE,KHR_DF_FLAG_ALPHA_STRAIGHT,KHR_DF_TRANSFER_LINEAR,KHR_DF_PRIMARIES_BT709,KHR_DF_MODEL_RGBSDA,KHR_DF_VERSION,KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,KHR_DF_VENDORID_KHRONOS,KHR_DF_CHANNEL_RGBSDA_RED,KHR_DF_CHANNEL_RGBSDA_GREEN,KHR_DF_CHANNEL_RGBSDA_BLUE,KHR_DF_CHANNEL_RGBSDA_ALPHA,KHR_DF_SAMPLE_DATATYPE_LINEAR,write,read}from'ktx-parse';import Tt from'msdf-bmfont-xml';import we from'opentype.js';import {PNG}from'pngjs';import {createRequire}from'module';var Ie=createRequire(import.meta.url),ne,y=new Proxy({},{get(e,t){return ne??=Ie("typescript"),Reflect.get(ne,t)}}),Ne=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),He=new Set(["script","style","template"]),re=2e5,Me={amp:"&",apos:"'",copy:"\xA9",deg:"\xB0",gt:">",hellip:"\u2026",ldquo:"\u201C",lsquo:"\u2018",lt:"<",mdash:"\u2014",nbsp:"\xA0",ndash:"\u2013",quot:'"',rdquo:"\u201D",rsquo:"\u2019"};function De(e){return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]+);/giu,(t,n)=>{if(n.startsWith("#x")||n.startsWith("#X")){let r=Number.parseInt(n.slice(2),16);return O(r)?String.fromCodePoint(r):t}if(n.startsWith("#")){let r=Number.parseInt(n.slice(1),10);return O(r)?String.fromCodePoint(r):t}return Me[n.toLowerCase()]??t})}a(De,"decodeHtmlEntities");function O(e){return Number.isSafeInteger(e)&&e>=0&&e<=1114111&&!(e>=55296&&e<=57343)}a(O,"validCodePoint");function se(e){return O(e)&&e>=32&&!(e>=127&&e<=159)}a(se,"renderableCodePoint");function ze(e){return /(?:^|\s)data-canvas-text(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?(?=\s|\/?>)/iu.test(e)}a(ze,"hasCanvasTextAttribute");function ie(e){let t=[],n=[],r=e.match(/<!--[\s\S]*?-->|<![^>]*>|<[^>]*>|[^<]+/gu)??[];for(let o of r){if(!o.startsWith("<")){if(n.some(a=>a.synchronized)&&!n.some(a=>a.skipped)){let a=De(o);a.trim().length>0&&t.push(a);}continue}if(o.startsWith("<!--")||o.startsWith("<!")||o.startsWith("<?"))continue;let s=/^<\s*\//u.test(o),c=/^<\s*\/?\s*([a-z][a-z0-9:-]*)/iu.exec(o)?.[1]?.toLowerCase();if(!c)continue;if(s){let a=n.map(u=>u.tag).lastIndexOf(c);a>=0&&n.splice(a);continue}/\/\s*>$/u.test(o)||Ne.has(c)||n.push({tag:c,synchronized:ze(o),skipped:He.has(c)});}return t}a(ie,"extractCanvasTextFromHtml");function Ue(e){let t=new Set,n=new Set;for(let r of e.statements){if(!y.isImportDeclaration(r)||!y.isStringLiteral(r.moduleSpecifier)||r.moduleSpecifier.text!=="three-blocks/text")continue;let o=r.importClause?.namedBindings;if(o&&y.isNamespaceImport(o)&&n.add(o.name.text),o&&y.isNamedImports(o))for(let s of o.elements)(s.propertyName?.text??s.name.text)==="defineTextContent"&&t.add(s.name.text);}return {named:t,namespaces:n}}a(Ue,"importedTextHelpers");function je(e,t){return y.isIdentifier(e)?t.named.has(e.text):y.isPropertyAccessExpression(e)&&y.isIdentifier(e.expression)&&t.namespaces.has(e.expression.text)&&e.name.text==="defineTextContent"}a(je,"isDefineTextContentCall");function Ge(e){let t=e;for(;y.isParenthesizedExpression(t)||y.isAsExpression(t)||y.isSatisfiesExpression(t)||y.isTypeAssertionExpression(t);)t=t.expression;return t}a(Ge,"unwrapExpression");function K(e,t,n){let r=Ge(e);if(y.isStringLiteral(r)||y.isNoSubstitutionTemplateLiteral(r)){t.push(r.text);return}if(y.isArrayLiteralExpression(r)){for(let c of r.elements){if(y.isSpreadElement(c))throw new Error(`${n}: defineTextContent() cannot use spread elements.`);K(c,t,n);}return}if(y.isObjectLiteralExpression(r)){for(let c of r.properties){if(!y.isPropertyAssignment(c))throw new Error(`${n}: defineTextContent() accepts only static property assignments.`);K(c.initializer,t,n);}return}let o=r.getStart(),s=r.getSourceFile().getLineAndCharacterOfPosition(o).line+1;throw new Error(`${n}:${s}: defineTextContent() contains dynamic text; declare a Unicode range or an explicit static string.`)}a(K,"collectStaticStrings");function ae(e,t="content.ts"){let n=y.createSourceFile(t,e,y.ScriptTarget.Latest,true,t.endsWith(".tsx")?y.ScriptKind.TSX:y.ScriptKind.TS),r=Ue(n),o=[];function s(c){if(y.isCallExpression(c)&&je(c.expression,r)){if(c.arguments.length!==1||!c.arguments[0])throw new Error(`${t}: defineTextContent() requires exactly one static argument.`);K(c.arguments[0],o,t);return}y.forEachChild(c,s);}return a(s,"visit"),s(n),o}a(ae,"extractDefinedTextContent");function Ke(e){let t=[];if(e==="latin"){for(let n=32;n<=126;n++)t.push(n);for(let n of "\u2018\u2019\u201C\u201D\u2013\u2014\u2026\u2022\xB7\xAB\xBB\u2039\u203A\u20AC\xA3\xA5\xB0\xB1\xD7\xF7\xA9\xAE\u2122\xA0"){let r=n.codePointAt(0);r!==void 0&&t.push(r);}}else {for(let n=12353;n<=12438;n++)t.push(n);for(let n=12443;n<=12447;n++)t.push(n);for(let n=12448;n<=12543;n++)t.push(n);for(let n of "\u3000\u3001\u3002\u300C\u300D\u300E\u300F\uFF08\uFF09\u30FB\u30FC\u301C\u3008\u3009\u300A\u300B\u3010\u3011\uFF01\uFF1F\uFF1A\uFF1B\uFF10\uFF11\uFF12\uFF13\uFF14\uFF15\uFF16\uFF17\uFF18\uFF19\uFF05\uFF06"){let r=n.codePointAt(0);r!==void 0&&t.push(r);}}return t}a(Ke,"presetCodePoints");function oe(e,t){for(let n of t.normalize("NFC")){let r=n.codePointAt(0);r!==void 0&&se(r)&&e.add(r);}}a(oe,"addCharacters");function ce(e,t={}){let n=new Set;for(let i of e)oe(n,i);t.additionalCharacters&&oe(n,t.additionalCharacters);for(let i of t.presets??[])for(let a of Ke(i))n.add(a);let r=0;for(let i of t.ranges??[]){if(!O(i.start)||!O(i.end)||i.end<i.start)throw new RangeError("Text Unicode ranges must contain ordered Unicode scalar values.");if(r+=i.end-i.start+1,r>re)throw new RangeError(`Configured Unicode ranges exceed the ${re}-code-point safety limit.`);for(let a=i.start;a<=i.end;a++)se(a)&&n.add(a);}n.add(32),n.add(63),n.add(65533);let o=[...n].sort((i,a)=>i-a),s=o.map(i=>String.fromCodePoint(i)).join(""),c=createHash("sha256").update(s.normalize("NFC")).digest("hex");return {codePoints:o,characters:s,hash:c}}a(ce,"buildGlyphSet");var We=createRequire(import.meta.url),de,p=new Proxy({},{get(e,t){return de??=We("typescript"),Reflect.get(de,t)}});function qe(e){let t=e;for(;p.isParenthesizedExpression(t)||p.isAsExpression(t)||p.isSatisfiesExpression(t)||p.isTypeAssertionExpression(t);)t=t.expression;return t}a(qe,"unwrap");function Je(e,t){if(p.isIdentifier(e)||p.isStringLiteral(e)||p.isNumericLiteral(e))return e.text;throw new Error(`${t}: text configuration property names must be static.`)}a(Je,"propertyName");function H(e,t){let n=qe(e);if(p.isStringLiteral(n)||p.isNoSubstitutionTemplateLiteral(n))return n.text;if(p.isNumericLiteral(n))return Number(n.text);if(n.kind===p.SyntaxKind.TrueKeyword)return true;if(n.kind===p.SyntaxKind.FalseKeyword)return false;if(n.kind===p.SyntaxKind.NullKeyword)return null;if(p.isPrefixUnaryExpression(n)&&(n.operator===p.SyntaxKind.MinusToken||n.operator===p.SyntaxKind.PlusToken)){let o=H(n.operand,t);if(typeof o=="number")return n.operator===p.SyntaxKind.MinusToken?-o:o}if(p.isArrayLiteralExpression(n))return n.elements.map(o=>{if(p.isSpreadElement(o))throw new Error(`${t}: text configuration cannot use spread elements.`);return H(o,t)});if(p.isObjectLiteralExpression(n)){let o=Object.create(null);for(let s of n.properties){if(!p.isPropertyAssignment(s))throw new Error(`${t}: text configuration accepts only static property assignments.`);let c=Je(s.name,t);if(Object.hasOwn(o,c))throw new Error(`${t}: duplicate text configuration property "${c}".`);o[c]=H(s.initializer,t);}return o}let r=n.getSourceFile().getLineAndCharacterOfPosition(n.getStart()).line+1;throw new Error(`${t}:${r}: text configuration must be statically inspectable.`)}a(H,"evaluateStatic");function ve(e){let t=new Set,n=new Set;for(let r of e.statements){if(!p.isImportDeclaration(r)||!p.isStringLiteral(r.moduleSpecifier)||r.moduleSpecifier.text!=="three-blocks/text")continue;let o=r.importClause?.namedBindings;if(o&&p.isNamespaceImport(o)&&n.add(o.name.text),o&&p.isNamedImports(o))for(let s of o.elements)(s.propertyName?.text??s.name.text)==="defineText"&&t.add(s.name.text);}return {named:t,namespaces:n}}a(ve,"helperNames");function Xe(e,t){return p.isIdentifier(e)?t.named.has(e.text):p.isPropertyAccessExpression(e)&&p.isIdentifier(e.expression)&&t.namespaces.has(e.expression.text)&&e.name.text==="defineText"}a(Xe,"isDefineTextCall");function R(e,t){if(typeof e!="string"||e.trim().length===0)throw new Error(`${t} must be a non-empty string.`);return e}a(R,"requiredString");function M(e,t,n=false){if(!Array.isArray(e)||!n&&e.length===0)throw new Error(`${t} must be ${n?"an":"a non-empty"} array of strings.`);return e.map((r,o)=>R(r,`${t}[${o}]`))}a(M,"stringArray");function D(e,t){if(e.includes("\\")||h.posix.isAbsolute(e)||h.posix.normalize(e)!==e||e===".."||e.startsWith("../")||/[\u0000-\u001f\u007f]/u.test(e))throw new Error(`${t} must be a safe project-relative path.`);return e}a(D,"safeProjectPath");function Ze(e,t){if(!a$1(e))throw new Error(`${t} must be an object.`);let n=Object.keys(e).sort();if(n.length===1&&n[0]==="builtin")return {builtin:R(e.builtin,`${t}.builtin`)};if(n.length===1&&n[0]==="path")return {path:D(R(e.path,`${t}.path`),`${t}.path`)};if(n.join(",")==="checksum,file,package")return {package:R(e.package,`${t}.package`),file:D(R(e.file,`${t}.file`),`${t}.file`),checksum:R(e.checksum,`${t}.checksum`)};throw new Error(`${t} must select exactly one supported source.`)}a(Ze,"parseFontSource");function V(e,t){let n=R(e,t);if(n.includes("\\")||/[\u0000-\u001f\u007f]/u.test(n)||n.split("/").includes(".."))throw new Error(`${t} is unsafe.`);return n}a(V,"deployedPath");function Ye(e){if(e===void 0)return {};if(!a$1(e))throw new Error("Text generation options must be an object.");let t=e.presets===void 0?void 0:M(e.presets,"Text generation presets",true).map(a=>{if(a!=="latin"&&a!=="japanese-kana")throw new Error(`Unsupported text preset "${a}".`);return a}),n;if(e.ranges!==void 0){if(!Array.isArray(e.ranges))throw new Error("Text generation ranges must be an array.");n=e.ranges.map((a,u)=>{if(!a$1(a)||typeof a.start!="number"||typeof a.end!="number")throw new Error(`Text generation range ${u} is invalid.`);return {start:a.start,end:a.end}});}let r=a(a=>{let u=e[a];if(u!==void 0){if(typeof u!="number"||!Number.isFinite(u))throw new Error(`Text generation ${a} must be finite.`);return u}},"numeric"),o=r("size"),s=r("distanceRange"),c=r("padding"),i=r("maxTextureSize");return {...t===void 0?{}:{presets:t},...n===void 0?{}:{ranges:n},...e.additionalCharacters===void 0?{}:{additionalCharacters:R(e.additionalCharacters,"Text generation additionalCharacters")},...o===void 0?{}:{size:o},...s===void 0?{}:{distanceRange:s},...c===void 0?{}:{padding:c},...i===void 0?{}:{maxTextureSize:i}}}a(Ye,"parseGeneration");function Qe(e){if(!a$1(e)||e.schemaVersion!==void 0&&e.schemaVersion!==1)throw new Error("Text configuration must use schemaVersion 1.");let t=M(e.content,"Text content inputs").map(o=>D(o,"Text content input"));if(!a$1(e.fonts)||Object.keys(e.fonts).length===0)throw new Error("Text fonts must be a non-empty object.");let n={},r=0;for(let[o,s]of Object.entries(e.fonts)){if(R(o,"Text font key"),!a$1(s))throw new Error(`Text font "${o}" must be an object.`);let c=s.default===true;c&&r++,n[o]={source:Ze(s.source,`Text font "${o}" source`),browser:V(s.browser,`Text font "${o}" browser path`),atlas:V(s.atlas,`Text font "${o}" atlas path`),metrics:V(s.metrics,`Text font "${o}" metrics path`),families:M(s.families,`Text font "${o}" families`),languages:s.languages===void 0?[]:M(s.languages,`Text font "${o}" languages`,true),default:c};}if(Object.keys(n).length>1&&r!==1)throw new Error("Multiple text fonts require exactly one default route.");if(r>1)throw new Error("Text fonts can select only one default route.");return {schemaVersion:1,content:t,fonts:n,generation:Ye(e.generation)}}a(Qe,"validateConfiguration");function et(e,t="three-blocks.text.ts"){let n=p.createSourceFile(t,e,p.ScriptTarget.Latest,true,p.ScriptKind.TS),r=ve(n),o=[];function s(c){if(p.isCallExpression(c)&&Xe(c.expression,r)){if(c.arguments.length!==1||!c.arguments[0])throw new Error(`${t}: defineText() requires one static argument.`);o.push(H(c.arguments[0],t));return}p.forEachChild(c,s);}if(a(s,"visit"),s(n),o.length!==1)throw new Error(`${t} must contain exactly one imported defineText() call.`);return Qe(o[0])}a(et,"parseTextConfiguration");function W(e,t){if(typeof e=="string")t.push(e);else if(Array.isArray(e))for(let n of e)W(n,t);else if(a$1(e))for(let n of Object.values(e))W(n,t);}a(W,"jsonStrings");async function q(e,t="three-blocks.text.ts"){let n=D(t,"Text configuration path"),r=await j(e,h.join(e,n),a$2.semanticInput,"Text configuration");return et(r.data.toString("utf8"),n)}a(q,"readTextConfiguration");async function J(e,t){let n=[],r={},o=0;for(let s of t.content){let c$1=await j(e,h.join(e,s),a$2.semanticInput,"Text content input");if(o+=c$1.data.byteLength,o>a$2.semanticTotal)throw new Error("Text content inputs exceed the total inspection size limit.");r[s]=c(c$1.data);let i=c$1.data.toString("utf8"),a=h.extname(s).toLowerCase();if(a===".html"||a===".htm")n.push(...ie(i));else if([".ts",".tsx",".js",".jsx",".mts",".cts",".mjs",".cjs"].includes(a))n.push(...ae(i,s));else if(a===".json")W(JSON.parse(i),n);else if(a===".txt"||a===".md")n.push(i);else throw new Error(`Unsupported configured text content type: ${s}.`)}return {values:n,glyphs:ce(n,t.generation),inputs:r}}a(J,"discoverTextContent");var xe=1,U="1.0.0",St=Object.freeze({"geist-sans":{id:"geist-sans",family:"Geist Sans",version:"1.600",license:"OFL-1.1",licenseFile:"OFL-1.1.txt",sourceFile:"geist-sans/Geist-Variable.ttf",sourceUrl:"https://raw.githubusercontent.com/vercel/geist-font/1.6.0/fonts/Geist/variable/Geist%5Bwght%5D.ttf",sourceBytes:168472,sourceChecksum:"995c579489b33cd28a6732d7aa7ca1b46c2faa832c18b4063933d7652c39932b",browserFile:"geist-sans/Geist-Variable.woff2",browserUrl:"https://raw.githubusercontent.com/vercel/geist-font/449415077ee4ffc191b4e7e557cd35e88b1b98fd/packages/next/dist/fonts/geist-sans/Geist-Variable.woff2",browserBytes:58512,browserChecksum:"46525b05bbf4527d263f8624ca7024c7d0dce3c64430267d30c31c6dd3821e4d"},"noto-sans-jp":{id:"noto-sans-jp",family:"Noto Sans JP",version:"2.004-H2",license:"OFL-1.1",licenseFile:"OFL-1.1.txt",sourceFile:"noto-sans-jp/NotoSansJP[wght].ttf",sourceUrl:"https://raw.githubusercontent.com/google/fonts/295d98a7a0c17c68f1341eaeea354e7960ea70d3/ofl/notosansjp/NotoSansJP%5Bwght%5D.ttf",sourceBytes:9589900,sourceChecksum:"c2f3b4d463500a2ddcd3849cded1fceeb9fd6d1c32e6cbecd568453ba50fc68f",browserFile:"noto-sans-jp/NotoSansJP[wght].woff2",browserUrl:"https://raw.githubusercontent.com/RenaudRohlinger/three-blocks-monorepo/364a50cc5f6f92735a110b50144e8d62404c9d87/packages/three-blocks-devtools/fonts/noto-sans-jp/NotoSansJP%5Bwght%5D.woff2",browserBytes:4350080,browserChecksum:"6fd94964d1990baa2a392cea7a036683d2b80b9dfd590cb3918e8dab98d8e188"}}),Ft="THREE_BLOCKS_FONT_CACHE_DIR",Rt=6e4,z=new Map,At=fileURLToPath(new URL("../fonts/",import.meta.url));function E(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Error(`${t} must be finite.`);return e}a(E,"finiteNumber");function k(e,t){let n=E(e,t);if(!Number.isSafeInteger(n))throw new Error(`${t} must be an integer.`);return n}a(k,"integer");function kt(e){if(!a$1(e)||!a$1(e.info)||!a$1(e.common)||!Array.isArray(e.chars))throw new Error("MSDF generator returned invalid BMFont metadata.");let t=e.chars.map((o,s)=>{if(!a$1(o))throw new Error(`BMFont character ${s} is invalid.`);return {id:k(o.id,`BMFont character ${s}.id`),x:E(o.x,`BMFont character ${s}.x`),y:E(o.y,`BMFont character ${s}.y`),width:E(o.width,`BMFont character ${s}.width`),height:E(o.height,`BMFont character ${s}.height`),xoffset:E(o.xoffset,`BMFont character ${s}.xoffset`),yoffset:E(o.yoffset,`BMFont character ${s}.yoffset`),xadvance:E(o.xadvance,`BMFont character ${s}.xadvance`)}}),n=e.kernings===void 0?[]:e.kernings;if(!Array.isArray(n))throw new Error("BMFont kernings are invalid.");let r=n.map((o,s)=>{if(!a$1(o))throw new Error(`BMFont kerning ${s} is invalid.`);return {first:k(o.first,`BMFont kerning ${s}.first`),second:k(o.second,`BMFont kerning ${s}.second`),amount:E(o.amount,`BMFont kerning ${s}.amount`)}});return {info:{size:E(e.info.size,"BMFont info.size"),face:typeof e.info.face=="string"?e.info.face:"Font"},common:{base:E(e.common.base,"BMFont common.base"),scaleW:k(e.common.scaleW,"BMFont common.scaleW"),scaleH:k(e.common.scaleH,"BMFont common.scaleH")},chars:t,kernings:r}}a(kt,"parseBMFont");function be(e){let t=e.generation.size??48,n=e.generation.distanceRange??8,r=e.generation.padding??2,o=e.generation.maxTextureSize??4096;if(!Number.isInteger(t)||t<8||t>256)throw new Error("Text generation size must be an integer from 8 to 256.");if(!Number.isInteger(n)||n<1||n>64)throw new Error("Text generation distanceRange must be an integer from 1 to 64.");if(!Number.isInteger(r)||r<0||r>32)throw new Error("Text generation padding must be an integer from 0 to 32.");if(!Number.isInteger(o)||o<64||o>8192||(o&o-1)!==0)throw new Error("Text generation maxTextureSize must be a power of two from 64 to 8192.");return {size:t,distanceRange:n,padding:r,maxTextureSize:o}}a(be,"atlasOptions");function Te(e){let t=St[e];if(t===void 0)throw new Error(`Unknown built-in font ${JSON.stringify(e)}.`);return t}a(Te,"builtinFontMetadata");function Ee(e){let t=e.cacheDirectory??process.env[Ft];return t?h.resolve(t):platform()==="darwin"?h.join(homedir(),"Library","Caches","three-blocks","fonts"):platform()==="win32"?h.join(process.env.LOCALAPPDATA?.trim()||h.join(homedir(),"AppData","Local"),"Three Blocks","Cache","fonts"):h.join(process.env.XDG_CACHE_HOME?.trim()||h.join(homedir(),".cache"),"three-blocks","fonts")}a(Ee,"fontCacheRoot");function le(e,t){return t==="source"?{font:e,kind:t,file:e.sourceFile,url:e.sourceUrl,bytes:e.sourceBytes,checksum:e.sourceChecksum,...e.sourceArchive===void 0?{}:{archive:e.sourceArchive}}:{font:e,kind:t,file:e.browserFile,url:e.browserUrl,bytes:e.browserBytes,checksum:e.browserChecksum}}a(le,"builtinAsset");function Se(e,t){let n=Te(e),r=t.mapBuiltinFont?.(n)??n;if(r.id!==n.id||r.version!==n.version||r.sourceBytes!==n.sourceBytes||r.sourceChecksum!==n.sourceChecksum||r.browserBytes!==n.browserBytes||r.browserChecksum!==n.browserChecksum)throw new Error(`Runtime metadata for built-in font ${JSON.stringify(e)} changed its pinned identity.`);return r}a(Se,"runtimeBuiltinFontMetadata");function Bt(e,t){return h.join(Ee(t),e.font.id,e.font.version,e.checksum,h.basename(e.file))}a(Bt,"builtinCachePath");async function Pt(e,t){try{let n=await h$1(e,a$2.texture,`${t.font.id} cached ${t.kind} font`);if(n.data.byteLength===t.bytes&&c(n.data)===t.checksum)return n.data;await rm(e,{force:!0});return}catch(n){if(b(n)==="ENOENT")return;throw n}}a(Pt,"readCachedFont");async function $t(e){try{let t=await h$1(h.join(At,e.file),e.bytes,`${e.font.id} packaged ${e.kind} font`);return t.data.byteLength===e.bytes&&c(t.data)===e.checksum?t.data:void 0}catch(t){if(b(t)==="ENOENT")return;throw t}}a($t,"readPackagedFont");async function Ct(e,t){try{let n=await j(e.root,e.filePath,t.bytes,`${t.font.id} existing browser font output`);return n.data.byteLength!==t.bytes||c(n.data)!==t.checksum?void 0:n.data}catch{return}}a(Ct,"readBuiltinBrowserSeed");function Ot(e,t,n){let r=Math.max(0,e.byteLength-65557),o=-1;for(let u=e.byteLength-22;u>=r;u--)if(e.readUInt32LE(u)===101010256){o=u;break}if(o<0)throw new Error("downloaded ZIP has no end-of-central-directory record");let s=e.readUInt16LE(o+10),c=e.readUInt32LE(o+12),i=e.readUInt32LE(o+16);if(i+c>o)throw new Error("downloaded ZIP central directory is out of bounds");let a=i;for(let u=0;u<s;u++){if(a+46>e.byteLength||e.readUInt32LE(a)!==33639248)throw new Error("downloaded ZIP central directory is invalid");let f=e.readUInt16LE(a+10),l=e.readUInt32LE(a+20),w=e.readUInt32LE(a+24),b=e.readUInt16LE(a+28),g=e.readUInt16LE(a+30),B=e.readUInt16LE(a+32),S=e.readUInt32LE(a+42),A=a+46+b+g+B;if(A>e.byteLength)throw new Error("downloaded ZIP entry metadata is out of bounds");let P=e.subarray(a+46,a+46+b).toString("utf8");if(a=A,P!==t)continue;if(w!==n)throw new Error(`ZIP entry has ${w} bytes; expected ${n}`);if(S+30>e.byteLength||e.readUInt32LE(S)!==67324752)throw new Error("downloaded ZIP local entry is invalid");let $=e.readUInt16LE(S+26),Oe=e.readUInt16LE(S+28),j=S+30+$+Oe;if(j+l>e.byteLength)throw new Error("downloaded ZIP entry data is out of bounds");let te=e.subarray(j,j+l);if(f===0)return Buffer.from(te);if(f===8)return I.inflateRawSync(te,{maxOutputLength:n});throw new Error(`ZIP entry uses unsupported compression method ${f}`)}throw new Error(`downloaded ZIP does not contain ${JSON.stringify(t)}`)}a(Ot,"zipEntry");async function Lt(e,t){let n=new URL(e.url);if(n.protocol!=="https:")throw new Error(`Built-in font source must use HTTPS: ${e.url}.`);let r;try{r=await t(n,{signal:AbortSignal.timeout(Rt)});}catch(g){throw new Error(`request failed: ${g instanceof Error?g.message:String(g)}`,{cause:g})}if(!r.ok)throw new Error(`server returned HTTP ${r.status} ${r.statusText}`.trim());let o=e.archive?.bytes??e.bytes,s=e.archive?.checksum??e.checksum,c$1=r.headers.get("content-length");if(c$1!==null){let g=Number(c$1);if(!Number.isSafeInteger(g)||g!==o)throw new Error(`server declared ${c$1} bytes; expected ${o}`)}if(r.body===null)throw new Error("server returned an empty response body");let i=r.body.getReader(),a=[],u=0;for(;;){let g=await i.read();if(g.done)break;if(u+=g.value.byteLength,u>o||u>a$2.texture)throw await i.cancel(),new Error(`download exceeded the expected ${o}-byte size`);a.push(Buffer.from(g.value.buffer,g.value.byteOffset,g.value.byteLength));}let f=Buffer.concat(a,u);if(f.byteLength!==o)throw new Error(`downloaded ${f.byteLength} bytes; expected ${o}`);let l=c(f);if(l!==s)throw new Error(`checksum mismatch: expected ${s}, received ${l}`);let w=e.archive===void 0?f:Ot(f,e.archive.entry,e.bytes);if(w.byteLength!==e.bytes)throw new Error(`resolved ${w.byteLength} bytes; expected ${e.bytes}`);let b=c(w);if(b!==e.checksum)throw new Error(`resolved checksum mismatch: expected ${e.checksum}, received ${b}`);return w}a(Lt,"downloadFont");async function X(e,t){await mkdir(h.dirname(e),{recursive:true});let n=`${e}.${process.pid}.${randomUUID()}.tmp`;try{await writeFile(n,t,{flag:"wx"}),await rename(n,e);}finally{await rm(n,{force:true});}}a(X,"writeCachedFont");async function fe(e,t,n){let r=Bt(e,t),o=z.get(r);if(o)return o;let s=(async()=>{let c=await Pt(r,e);if(c)return c;if(t.fetch===void 0&&t.mapBuiltinFont===void 0){let i=await $t(e);if(i!==void 0)return await X(r,i),i}if(n!==void 0){let i=await Ct(n,e);if(i!==void 0)return await X(r,i),i}try{let i=await Lt(e,t.fetch??globalThis.fetch);return await X(r,i),i}catch(i){throw new Error(`Could not download the built-in ${e.font.id} ${e.kind} font from ${e.url}: ${i instanceof Error?i.message:String(i)}. Connect once to prewarm the checksum-keyed cache at ${JSON.stringify(Ee(t))}, or configure source.path/source.package for fully offline text generation.`,{cause:i})}})();z.set(r,s);try{return await s}finally{z.get(r)===s&&z.delete(r);}}a(fe,"cachedBuiltinAsset");async function Fe(e,t,n){let[r,o]=await Promise.allSettled([fe(le(e,"source"),t),fe(le(e,"browser"),t,n)]);if(r.status==="rejected")throw r.reason;if(o.status==="rejected")throw o.reason;return [r.value,o.value]}a(Fe,"cachedBuiltinPair");async function mn(e,t={}){let n=Se(e,t);await Fe(n,t);}a(mn,"prewarmBuiltinFont");async function Re(e,t,n){let r=await h$1(e,a$2.texture,n),o=c(r.data);if(t!=="pending"&&o!==t)throw new Error(`${n} checksum mismatch: expected ${t}, received ${o}.`);return r.data}a(Re,"checkedExternalFile");function Ae(e,t){if(!/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/iu.test(t))throw new Error("Text font package name is unsafe.");return h.join(e,"node_modules",...t.split("/"))}a(Ae,"packageRoot");async function _t(e,t){if("builtin"in t){let o=Te(t.builtin);return {sourceHash:o.sourceChecksum,browserHash:o.browserChecksum,description:`builtin:${o.id}@${o.version}`,license:o.license}}if("path"in t){let o=await j(e,h.join(e,t.path),a$2.texture,"Text source font");return {sourceHash:c(o.data),browserHash:c(o.data),description:t.path}}let n=h.join(Ae(e,t.package),t.file),r=await Re(n,t.checksum,"Package text source font");return {sourceHash:c(r),browserHash:c(r),description:`${t.package}/${t.file}`}}a(_t,"resolveFontIdentity");async function It(e,t,n,r){if("builtin"in t){let i=Se(t.builtin,n),[a,u]=await Fe(i,n,r===void 0?void 0:{root:e,filePath:r});return {source:a,sourceHash:i.sourceChecksum,browser:u,browserHash:i.browserChecksum,description:`builtin:${i.id}@${i.version}`,license:i.license}}if("path"in t){let i=await j(e,h.join(e,t.path),a$2.texture,"Text source font"),a=c(i.data);return {source:i.data,sourceHash:a,browser:i.data,browserHash:a,description:t.path}}let o=h.join(Ae(e,t.package),t.file),s=await Re(o,t.checksum,"Package text source font"),c$1=c(s);return {source:s,sourceHash:c$1,browser:s,browserHash:c$1,description:`${t.package}/${t.file}`}}a(It,"resolveFont");function _(e,t){let n=t.replace(/^\/+/,""),r=h.resolve(e,"public",n),o=h.resolve(e,"public"),s=h.relative(o,r);if(s===""||s===".."||s.startsWith(`..${h.sep}`)||h.isAbsolute(s))throw new Error(`Deployed text path ${JSON.stringify(t)} escapes public/.`);return r}a(_,"deployedFile");function ee(e,t){return h.relative(e,t).split(h.sep).join("/")}a(ee,"portablePath");function ke(e){return e.endsWith(".json")?`${e.slice(0,-5)}.meta.json`:`${e}.meta.json`}a(ke,"metadataPath");function Be(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}a(Be,"bufferArray");function Nt(e,t){return t.filter(n=>n===65533||e.charToGlyphIndex(String.fromCodePoint(n))!==0)}a(Nt,"supportedCodePoints");function Ht(e,t,n,r){return new Promise((o,s)=>{Tt(e,{filename:n,charset:t.map(c=>String.fromCodePoint(c)),outputType:"json",fieldType:"msdf",fontSize:r.size,distanceRange:r.distanceRange,texturePadding:r.padding,textureSize:[r.maxTextureSize,r.maxTextureSize],smartSize:true,pot:true},(c,i,a)=>{if(c)return s(c);if(i.length!==1||i[0]===void 0)return s(new Error(`Text glyphs require ${i.length} atlas pages; raise maxTextureSize or lower size.`));try{o({png:i[0].texture,data:kt(JSON.parse(a.data))});}catch(u){s(u);}});})}a(Ht,"generateBMFontData");function Mt(e,t,n){let r=1/e.info.size,o=e.common.base,s=t.unitsPerEm,c=t.tables.hhea;return {name:t.names?.fontFamily?.en??e.info.face,atlas:{type:"msdf",distanceRange:n.distanceRange,size:e.info.size,width:e.common.scaleW,height:e.common.scaleH,yOrigin:"top"},metrics:{emSize:1,lineHeight:(c.ascender-c.descender+c.lineGap)/s,ascender:c.ascender/s,descender:c.descender/s,underlineY:(t.tables.post?.underlinePosition??-s*.1)/s,underlineThickness:(t.tables.post?.underlineThickness??s*.05)/s},glyphs:e.chars.slice().sort((i,a)=>i.id-a.id).map(i=>({unicode:i.id,advance:i.xadvance*r,...i.width>0&&i.height>0?{planeBounds:{left:i.xoffset*r,bottom:(o-i.yoffset-i.height)*r,right:(i.xoffset+i.width)*r,top:(o-i.yoffset)*r},atlasBounds:{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height}}:{}})),kerning:e.kernings.filter(i=>i.amount!==0).sort((i,a)=>i.first-a.first||i.second-a.second).map(i=>({unicode1:i.first,unicode2:i.second,advance:i.amount*r}))}}a(Mt,"convertMetrics");function Pe(){return I}a(Pe,"zstdFunctions");function Dt(e){let t=PNG.sync.read(e),n=new Uint8Array(t.data.buffer,t.data.byteOffset,t.data.byteLength),o=Pe().zstdCompressSync,s=o===void 0?"none":"zstd",c=I.constants.ZSTD_c_compressionLevel,i=o?.(n,c===void 0?{}:{params:{[c]:19}}),a$1=createDefaultContainer();a$1.vkFormat=VK_FORMAT_R8G8B8A8_UNORM,a$1.typeSize=1,a$1.pixelWidth=t.width,a$1.pixelHeight=t.height,a$1.supercompressionScheme=s==="zstd"?KHR_SUPERCOMPRESSION_ZSTD:KHR_SUPERCOMPRESSION_NONE,a$1.levels=[{levelData:i===void 0?n:new Uint8Array(i.buffer,i.byteOffset,i.byteLength),uncompressedByteLength:n.byteLength}];let u=a((l,w)=>({bitOffset:l*8,bitLength:7,channelType:w,samplePosition:[0,0,0,0],sampleLower:0,sampleUpper:255}),"sample");a$1.dataFormatDescriptor=[{vendorId:KHR_DF_VENDORID_KHRONOS,descriptorType:KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,versionNumber:KHR_DF_VERSION,colorModel:KHR_DF_MODEL_RGBSDA,colorPrimaries:KHR_DF_PRIMARIES_BT709,transferFunction:KHR_DF_TRANSFER_LINEAR,flags:KHR_DF_FLAG_ALPHA_STRAIGHT,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[u(0,KHR_DF_CHANNEL_RGBSDA_RED),u(1,KHR_DF_CHANNEL_RGBSDA_GREEN),u(2,KHR_DF_CHANNEL_RGBSDA_BLUE),u(3,KHR_DF_CHANNEL_RGBSDA_ALPHA|KHR_DF_SAMPLE_DATATYPE_LINEAR)]}],a$1.keyValue.KTXwriter=`three-blocks text ${U}`,a$1.keyValue.KTXorientation="rd";let f=write(a$1,{keepWriter:true});return $e(f,t.width,t.height),{bytes:f,width:t.width,height:t.height,compression:s}}a(Dt,"createKtx2");function $e(e,t,n){let r=read(e);if(r.vkFormat!==VK_FORMAT_R8G8B8A8_UNORM)throw new Error("Text atlas must use RGBA8 KTX2.");if(r.pixelWidth<=0||r.pixelHeight<=0||r.levels.length!==1||r.levels[0]===void 0)throw new Error("Text atlas KTX2 dimensions or levels are invalid.");if(t!==void 0&&r.pixelWidth!==t)throw new Error("Text atlas KTX2 width does not match metrics.");if(n!==void 0&&r.pixelHeight!==n)throw new Error("Text atlas KTX2 height does not match metrics.");if(r.keyValue.KTXorientation!=="rd")throw new Error("Text atlas KTX2 orientation must be rd.");let o=r.levels[0],s,c;if(r.supercompressionScheme===KHR_SUPERCOMPRESSION_ZSTD){let a=Pe().zstdDecompressSync;if(a===void 0)throw new Error("This Node.js runtime cannot validate Zstandard KTX2 text atlases.");s=a(o.levelData),c="zstd";}else if(r.supercompressionScheme===KHR_SUPERCOMPRESSION_NONE)s=o.levelData,c="none";else throw new Error("Text atlas uses an unsupported KTX2 supercompression scheme.");let i=r.pixelWidth*r.pixelHeight*4;if(s.byteLength!==i||o.uncompressedByteLength!==i)throw new Error("Text atlas KTX2 decoded byte length is invalid.");return {width:r.pixelWidth,height:r.pixelHeight,compression:c}}a($e,"validateKtx2Bytes");function pe(e){return `${JSON.stringify(e)}
|
|
3
|
-
`}a(pe,"stableJson");function Z(e,t,n){return {path:ee(e,t),sha256:c(n),bytes:n.byteLength}}a(Z,"fileReceipt");function Ce(e,t,n,r){return c(JSON.stringify({generator:U,fontKey:r,fontHash:e.sourceHash,glyphSetHash:t,options:n}))}a(Ce,"createInputHash");async function zt(e,t,n,r,o,s,c){if(o.length===0)throw new Error(`Text font ${JSON.stringify(t)} covers no required glyphs.`);let i=we.parse(Be(r.source)),a=await Ht(r.source,o,t,c),u=Mt(a.data,i,c),f$1=Buffer.from(pe(u)),l=Dt(a.png);if(a.data.common.scaleW!==l.width||a.data.common.scaleH!==l.height)throw new Error(`Text font ${JSON.stringify(t)} metrics and texture dimensions differ.`);let w=_(e,n.browser),b=_(e,n.atlas),g=_(e,n.metrics),B=ke(g),S={schemaVersion:xe,generatorVersion:U,font:{key:t,source:r.description,sourceHash:r.sourceHash,...r.license===void 0?{}:{license:r.license}},inputHash:Ce(r,s,c,t),glyphSetHash:s,codePoints:o,options:c,texture:{format:"RGBA8",orientation:"rd",compression:l.compression,width:l.width,height:l.height},files:{browser:Z(e,w,r.browser),atlas:Z(e,b,l.bytes),metrics:Z(e,g,f$1)}},A=Buffer.from(pe(S));await f(w,r.browser),await f(b,l.bytes),await f(g,f$1),await f(B,A);let P=[w,b,g,B].map($=>ee(e,$));return {font:t,receipt:S,metadataPath:ee(e,B),updatedFiles:P}}a(zt,"generateRoute");async function yn(e,t="three-blocks.text.ts",n={}){let r=await q(e,t),o=await J(e,r),s=be(r),c=[];for(let[f,l]of Object.entries(r.fonts).sort((w,b)=>w[0].localeCompare(b[0]))){let w=await It(e,l.source,n,"builtin"in l.source?_(e,l.browser):void 0),b=we.parse(Be(w.source));c.push({key:f,route:l,resolved:w,font:b,codePoints:Nt(b,o.glyphs.codePoints)});}let i=new Set(c.flatMap(f=>f.codePoints)),a=o.glyphs.codePoints.filter(f=>!i.has(f));if(a.length>0)throw new Error(`Configured fonts do not cover ${a.length} required glyph(s): ${a.map(f=>String.fromCodePoint(f)).join(" ")}`);let u=[];for(let f of c)u.push(await zt(e,f.key,f.route,f.resolved,f.codePoints,o.glyphs.hash,s));return {glyphs:o.glyphs.codePoints.length,glyphSetHash:o.glyphs.hash,atlases:u,updatedFiles:u.flatMap(f=>f.updatedFiles)}}a(yn,"generateTextAtlases");function Y(e,t){if(!a$1(e)||typeof e.path!="string"||typeof e.sha256!="string"||!/^[a-f0-9]{64}$/u.test(e.sha256)||!Number.isSafeInteger(e.bytes)||e.bytes<0)throw new Error(`${t} receipt is invalid.`);return e}a(Y,"parseFileReceipt");function Ut(e){if(!a$1(e)||e.schemaVersion!==xe||e.generatorVersion!==U||!a$1(e.font)||typeof e.font.key!="string"||typeof e.font.source!="string"||typeof e.font.sourceHash!="string"||!/^[a-f0-9]{64}$/u.test(e.font.sourceHash)||typeof e.inputHash!="string"||!/^[a-f0-9]{64}$/u.test(e.inputHash)||typeof e.glyphSetHash!="string"||!/^[a-f0-9]{64}$/u.test(e.glyphSetHash)||!Array.isArray(e.codePoints)||!e.codePoints.every(t=>Number.isSafeInteger(t))||!a$1(e.options)||!a$1(e.texture)||!a$1(e.files))throw new Error("Text atlas generation metadata is invalid.");if(e.texture.format!=="RGBA8"||e.texture.orientation!=="rd"||!["zstd","none"].includes(e.texture.compression))throw new Error("Text atlas texture metadata is invalid.");return Y(e.files.browser,"Browser font"),Y(e.files.atlas,"Text atlas"),Y(e.files.metrics,"Text metrics"),e}a(Ut,"parseTextAtlasReceipt");function jt(e){if(!a$1(e)||!a$1(e.atlas)||!Array.isArray(e.glyphs))throw new Error("Text metrics are invalid.");let t=k(e.atlas.width,"Text metrics atlas.width"),n=k(e.atlas.height,"Text metrics atlas.height"),r=e.glyphs.map((o,s)=>{if(!a$1(o))throw new Error(`Text metrics glyph ${s} is invalid.`);return k(o.unicode,`Text metrics glyph ${s}.unicode`)});return {width:t,height:n,codePoints:r}}a(jt,"metricsCoverage");async function Q(e,t,n,r){let o=await j(e,h.join(e,t.path),n,r);if(o.data.byteLength!==t.bytes||c(o.data)!==t.sha256)throw new Error(`${r} checksum or byte length differs from generation metadata.`);return o.data}a(Q,"verifyReceiptFile");async function hn(e,t="three-blocks.text.ts"){let n;try{n=await q(e,t);}catch(r){return {state:"invalid",reason:`Text configuration is invalid: ${r instanceof Error?r.message:String(r)}`,missing:[],atlases:[]}}try{let r=await J(e,n),o=be(n),s=[],c$1=new Set;for(let[a,u]of Object.entries(n.fonts).sort((f,l)=>f[0].localeCompare(l[0]))){let f=await j(e,ke(_(e,u.metrics)),a$2.metadata,"Text atlas generation metadata"),l=Ut(JSON.parse(f.data.toString("utf8")));if(l.font.key!==a)throw new Error(`Text atlas metadata belongs to ${JSON.stringify(l.font.key)}, not ${JSON.stringify(a)}.`);let w=await _t(e,u.source),b=Ce(w,l.glyphSetHash,o,a);if(l.inputHash!==b)return {state:"invalid",reason:`Text atlas ${a} font source or generation options changed.`,missing:[],atlases:[...s,l]};let[g,B,S]=await Promise.all([Q(e,l.files.browser,a$2.texture,"Browser font"),Q(e,l.files.atlas,a$2.texture,"Text atlas"),Q(e,l.files.metrics,a$2.metrics,"Text metrics")]);if(c(g)!==w.browserHash)throw new Error(`Browser font ${a} differs from its resolved source.`);let A=jt(JSON.parse(S.toString("utf8"))),P=$e(B,A.width,A.height);if(P.width!==l.texture.width||P.height!==l.texture.height||P.compression!==l.texture.compression)throw new Error(`Text atlas ${a} texture metadata does not match KTX2.`);for(let $ of A.codePoints)c$1.add($);s.push(l);}let i=r.glyphs.codePoints.filter(a=>!c$1.has(a));return i.length>0?{state:"missing",reason:`${i.length} required glyph(s) are missing.`,missing:i,atlases:s}:{state:"ready",reason:`${r.glyphs.codePoints.length} required glyphs are covered by ${s.length} atlas(es).`,missing:[],atlases:s}}catch(r){return (typeof r=="object"&&r!==null&&"code"in r?r.code:void 0)==="ENOENT"?{state:"missing",reason:"Text atlas files or generation metadata are absent.",missing:[],atlases:[]}:{state:"invalid",reason:r instanceof Error?r.message:String(r),missing:[],atlases:[]}}}a(hn,"inspectTextAtlases");export{xe as a,U as b,Te as c,mn as d,yn as e,Ut as f,hn as g};
|