{"version":3,"file":"index.umd.production.min.cjs","sources":["../src/utils.ts","../src/split.ts","../src/parser.ts","../src/png.ts","../src/handler.ts","../src/types.ts","../src/index.ts"],"sourcesContent":["import { crlf } from 'crlf-normalize';\n\nexport function inputToBytes(png: Uint8Array | string)\n{\n\t/**\n\t * if (typeof Buffer !== 'undefined' && Buffer.isBuffer(png))\n\t *   {\n\t *     bytes = Uint8Array.from(png)\n\t *     bin_str = png.toString()\n\t *   }\n\t *   else if (png instanceof Uint8Array)\n\t *   {\n\t *     bytes = png\n\t *     bin_str = png.toString()\n\t *   }\n\t */\n\tif (typeof Buffer !== 'undefined' && Buffer.isBuffer(png) || png instanceof Uint8Array)\n\t{\n\t\treturn png\n\t}\n\n\t/**\n\t * bin_str = atob(png.slice(0, 8192))\n\t * bytes = Uint8Array.from(bin_str, c => c.charCodeAt(0))\n\t */\n\treturn Uint8Array.from(atob(png.slice(0, 8192)), c => c.charCodeAt(0))\n}\n\n/**\n * get int32 from png compensating for endianness\n */\nexport function i32(a: Uint8Array, i: number)\n{\n\treturn new Uint32Array(new Uint8Array([...a.slice(i, i + 4)].reverse()).buffer)[0];\n}\n\nexport function _normalizeInputRaw(raw_info: string)\n{\n\traw_info = crlf(raw_info)\n\t\t.replace(/[ \\t\\xa0]+(?=\\n)/g, '')\n\t\t.replace(/\\n{3,}/g, '\\n\\n')\n\t\t.replace(/^[\\r\\n]+|[\\s\\r\\n]+$/g, '')\n\t;\n\n\treturn raw_info\n}\n","/**\n * \\n\n */\nexport const RE_LINE_SPLIT_BASE = /\\r?\\n/;\n/**\n * ```\n * \\x00\\x00\\x00\\n\n * \\u200b\\u200b\\u200b\\n zero-width space\n * ```\n */\nexport const RE_LINE_SPLIT_PLUS = /(?:\\x00\\x00\\x00|\\u200b\\u200b\\u200b)\\r?\\n/;\n\n/**\n * Splits a raw string into an array of lines.\n *\n * @param raw_info - The raw string to split into lines.\n * @returns An array of lines extracted from the raw string.\n *\n * @example\n * ```typescript\n * const rawInfo = \"line1\\nline2\\r\\nline3\";\n * const lines = _splitRawToLines(rawInfo);\n * console.log(lines); // Output: [\"line1\", \"line2\", \"line3\"]\n * ```\n */\nexport function _splitRawToLines(raw_info: string)\n{\n\treturn raw_info.split(_isRawVersionPlus(raw_info) ? RE_LINE_SPLIT_PLUS : RE_LINE_SPLIT_BASE)\n}\n\n/**\n * Checks if the given raw string is in \"\\x00\\x00\\x00\\n\" format.\n *\n * @see https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15713\n *\n * @param raw_info - The raw string to check.\n * @returns A boolean indicating whether the raw string is in \"\\x00\\x00\\x00\\n\" format.\n *\n * @example\n * ```typescript\n * const rawInfo = \"line1\\nline2\\x00\\x00\\x00\\r\\nline3\";\n * const isPlusFormat = _isRawVersionPlus(rawInfo);\n * console.log(isPlusFormat); // Output: true\n * ```\n */\nexport function _isRawVersionPlus(raw_info: string)\n{\n\treturn RE_LINE_SPLIT_PLUS.test(raw_info)\n}\n","import { splitSmartly } from 'split-smartly2';\nimport { _isRawVersionPlus, _splitRawToLines } from './split';\nimport { _normalizeInputRaw } from './utils';\n\n/**\n * `${key}: ${value}`\n */\nexport function _parseLine(line: string)\n{\n\tconst [, key, value] = line.match(/^([^:]+)\\s*:\\s*(.*)$/);\n\treturn [key, value] as const\n}\n\n/**\n * Parses an info line into key-value pairs.\n *\n * @param infoline - The info line to parse.\n * @returns An array of tuples, where each tuple contains a key-value pair.\n *\n * @remarks\n * This function uses the `splitSmartly` function from the 'split-smartly2' package to split the info line into key-value pairs.\n * The info line is expected to be in the format `${key}: ${value}`, separated by commas.\n * The `splitSmartly` function is configured to handle nested brackets and trim separators.\n *\n * @example\n * ```typescript\n * const infoLine = 'key1: value1, key2: value2, key3: value3';\n * const result = _parseInfoLine(infoLine);\n * // result: [['key1', 'value1'], ['key2', 'value2'], ['key3', 'value3']]\n * ```\n */\nexport function _parseInfoLine(infoline: string)\n{\n\treturn [..._parseInfoLineGenerator(infoline)]\n}\n\nexport function* _parseInfoLineGenerator(infoline: string)\n{\n\tinfoline = _normalizeInputRaw(infoline);\n\n\tconst entries = splitSmartly(infoline, [','], {\n\t\tbrackets: true,\n\t\ttrimSeparators: true,\n\t}) as string[];\n\n\t//let list: (readonly [string, string])[] = [];\n\n\tfor (let line of entries)\n\t{\n\t\t/**\n\t\t * avoid empty line\n\t\t */\n\t\tif (line?.length)\n\t\t{\n\t\t\tconst entry = _parseLine(line);\n\t\t\tyield entry\n\t\t}\n\t}\n\n\treturn void 0 as void\n}\n\n/**\n * Extracts prompt, negative prompt, info line, and extra info from a raw info string.\n *\n * @param raw_info - The raw info string to extract data from.\n * @returns An object containing the extracted prompt, negative prompt, info line, extra info, and the original lines.\n *\n * @throws Will throw a TypeError if the raw info string is in Plus version and contains more than 3 lines.\n *\n * @remarks\n * This function first checks if the raw info string is in Plus version using the `_isRawVersionPlus` function.\n * It then splits the raw info string into lines using the `_splitRawToLines` function.\n * Depending on the version, it extracts the prompt, negative prompt, info line, and extra info.\n * If the raw info string is in Plus version, it follows a specific order to extract the data.\n * If the raw info string is not in Plus version, it uses the `findIndex` method to find the indices of the negative prompt and steps,\n * and then extracts the data accordingly.\n * Finally, it returns an object containing the extracted data and the original lines.\n *\n * @example\n * ```typescript\n * const rawInfo = 'Prompt:...\\nNegative prompt:...\\nSteps:...';\n * const result = extractPromptAndInfoFromRaw(rawInfo);\n * // result: {\n * //   prompt: '...',\n * //   negative_prompt: '...',\n * //   infoline: 'Steps:...',\n * //   infoline_extra: [],\n * //   lines_raw: ['Prompt:...', 'Negative prompt:...', 'Steps:...'],\n * // }\n * ```\n */\nexport function extractPromptAndInfoFromRaw(raw_info: string)\n{\n\traw_info = _normalizeInputRaw(raw_info);\n\n\tconst isPlus = _isRawVersionPlus(raw_info);\n\tlet lines = _splitRawToLines(raw_info);\n\n\tlet prompt: string = '';\n\tlet negative_prompt: string = '';\n\tlet infoline: string = '';\n\tlet infoline_extra: string[] = [];\n\n\tconst lines_raw = lines.slice();\n\n\tif (lines.length)\n\t{\n\t\tif (isPlus)\n\t\t{\n\t\t\tif (lines.length > 3)\n\t\t\t{\n\t\t\t\tthrow new TypeError()\n\t\t\t}\n\n\t\t\tlet line = lines.pop();\n\n\t\t\tif (line.startsWith('Steps: '))\n\t\t\t{\n\t\t\t\tinfoline = line;\n\t\t\t\tline = void 0\n\t\t\t}\n\n\t\t\tline ??= lines.pop();\n\n\t\t\tif (line.startsWith('Negative prompt: '))\n\t\t\t{\n\t\t\t\tnegative_prompt = line.slice('Negative prompt: '.length);\n\t\t\t\tline = void 0\n\t\t\t}\n\n\t\t\tline ??= lines.pop();\n\n\t\t\tprompt = line;\n\n\t\t\tif (lines.length)\n\t\t\t{\n\t\t\t\tthrow new TypeError()\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlet line = lines[lines.length - 1];\n\t\t\tif (line.startsWith('Steps: '))\n\t\t\t{\n\t\t\t\tinfoline = lines.pop();\n\t\t\t\tline = void 0\n\t\t\t}\n\n\t\t\tif (lines.length)\n\t\t\t{\n\t\t\t\tlet idx = -1;\n\t\t\t\tfor (let i = lines.length - 1; i >= 0; i--)\n\t\t\t\t{\n\t\t\t\t\tline = lines[i];\n\t\t\t\t\tif (line.startsWith('Negative prompt: '))\n\t\t\t\t\t{\n\t\t\t\t\t\tidx = i;\n\t\t\t\t\t\tlines[i] = line.slice('Negative prompt: '.length);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (idx !== -1)\n\t\t\t\t{\n\t\t\t\t\tnegative_prompt = lines.splice(idx).join('\\n');\n\t\t\t\t}\n\n\t\t\t\tprompt = lines.join('\\n');\n\t\t\t}\n\t\t}\n\n\t\tprompt = prompt.replace(/\\x00\\x00\\x00/g, '');\n\t\tnegative_prompt = negative_prompt.replace(/\\x00\\x00\\x00/g, '');\n\t}\n\n\treturn {\n\t\tprompt,\n\t\tnegative_prompt,\n\t\tinfoline,\n\t\tinfoline_extra,\n\t\tlines_raw,\n\t}\n}\n","import { i32 } from './utils';\n\nconst BYTES_pngmagic = '137,80,78,71,13,10,26,10';\nconst BYTES_tEXt = Uint8Array.from('tEXt', c => c.charCodeAt(0)).join(',');\n\nconst OFFSET_parameters = \"parameters\\u0000\".length\n\nexport function uint8arrayToString(uint8array: Uint8Array)\n{\n\treturn new TextDecoder().decode(uint8array)\n}\n\n/**\n * ```\n * new TextEncoder().encode(inputString)\n * String.fromCharCode(...raw_info)\n * ```\n */\nexport function stringToUint8Array(inputString: string)\n{\n\treturn new TextEncoder().encode(inputString);\n}\n\n/**\n * Extracts raw data from a PNG byte array.\n *\n * @param bytes - The Uint8Array containing the PNG data.\n * @returns An object containing the width, height, and raw_info extracted from the PNG data,\n *          or `undefined` if the PNG data does not contain a valid tEXt chunk.\n */\nexport function extractRawFromBytes(bytes: Uint8Array)\n{\n\t// Check if the bytes represent a valid PNG file by comparing the magic number\n\tconst pngmagic = bytes.slice(0, 8).join(',') === BYTES_pngmagic\n\tif (!pngmagic) return undefined\n\n\t// Extract the width, height, and IHDR size from the PNG data\n\tconst [ihdrSize, width, height] = [i32(bytes, 8), i32(bytes, 16), i32(bytes, 20)];\n\n\t// Calculate the offset of the tEXt chunk in the PNG data\n\tconst txtOffset = 8 + ihdrSize + 12;\n\n\t// Check if the tEXt chunk is present by comparing the chunk type\n\tif (bytes.slice(txtOffset + 4, txtOffset + 8).join(',') !== BYTES_tEXt) return undefined\n\n\t// Extract the size of the tEXt chunk data\n\tconst txtSize = i32(bytes, txtOffset);\n\n\t// Extract the raw_info data from the tEXt chunk\n\tconst raw_info = bytes.slice(txtOffset + 8 + OFFSET_parameters, txtOffset + 8 + txtSize);\n\n\t// Convert the raw_info data to a string\n\tconst raw_info_str = uint8arrayToString(raw_info);\n\n\t// Return the extracted data\n\treturn {\n\t\twidth,\n\t\theight,\n\t\traw_info: raw_info_str,\n\t}\n}\n","import { IOptionsInfoparser } from './index';\n\nexport function keyToSnakeStyle1(key: string)\n{\n\treturn key.toLowerCase().replace(/ /g, '_')\n}\n\nexport function handleInfoEntries(entries: Iterable<readonly [string, string]>, opts?: IOptionsInfoparser)\n{\n\treturn [...handleInfoEntriesGenerator(entries, opts)]\n}\n\nexport function* handleInfoEntriesGenerator(entries: Iterable<readonly [string, string]>, opts?: IOptionsInfoparser)\n{\n\tfor (const entry of entries)\n\t{\n\t\tyield handleInfoEntry(entry, opts)\n\t}\n}\n\nexport function handleInfoEntry(entry: readonly [string, string], opts?: IOptionsInfoparser)\n{\n\tconst cast_to_snake = opts?.cast_to_snake;\n\tconst re = /^0\\d/;\n\n\tlet [key, value] = entry;\n\n\tconst asNum = parseFloat(value);\n\tconst isNotNum = (re.test(value)) || isNaN(asNum) || ((value as any as number) - asNum) !== 0;\n\n\tif (cast_to_snake) key = keyToSnakeStyle1(key)\n\n\tconst out = [key, isNotNum ? value : asNum] as const;\n\treturn out\n}\n","\nexport const enum EnumInfoKey\n{\n\tprompt = 'prompt',\n\tnegative_prompt = 'negative_prompt',\n}\n","import { inputToBytes } from './utils';\nimport { _parseInfoLineGenerator, extractPromptAndInfoFromRaw } from './parser';\nimport { extractRawFromBytes } from './png';\nimport { handleInfoEntriesGenerator } from './handler';\nimport { EnumInfoKey } from './types';\n\nexport * from './handler';\nexport * from './parser';\nexport * from './png';\nexport * from './split';\nexport * from './types';\nexport * from './utils';\n\nexport interface IOptionsInfoparser\n{\n\tcast_to_snake?: boolean;\n\t/**\n\t * If true, prompt and negative_prompt are included in the input\n\t */\n\tisIncludePrompts?: boolean;\n}\n\nexport interface IRecordInfo\n{\n\t[EnumInfoKey.prompt]: string;\n\t[EnumInfoKey.negative_prompt]: string;\n\n\t[k: string]: string | number;\n}\n\n/**\n * Parses raw info line and returns an object with the extracted data.\n *\n * @param line - The raw info line to parse.\n * @param opts - Optional parameters.\n * @param opts.cast_to_snake - If true, keys will be converted to snake_case. Default is false.\n * @param opts.isIncludePrompts - If true, prompt and negative_prompt will be included in the result. Default is false.\n *\n * @returns An object containing the extracted data.\n *\n * @example\n * ```typescript\n * const rawInfo = \"my prompt, Negative prompt: my negative prompt, width: 512, height: 512\";\n * const parsedData = parseFromRawInfo(rawInfo, { isIncludePrompts: true });\n * console.log(parsedData);\n * // Output: { prompt: 'my prompt', Negative prompt: 'my negative prompt', width: 512, height: 512 }\n * ```\n */\nexport function parseFromRawInfo(line: string, opts?: IOptionsInfoparser)\n{\n\treturn Object.fromEntries([...parseFromRawInfoGenerator(line, opts)]) as IRecordInfo\n}\n\nexport function* parseFromRawInfoGenerator(line: string, opts?: IOptionsInfoparser): Generator<readonly [string, string | number] | readonly [EnumInfoKey, string], void, void>\n{\n\tif (opts?.isIncludePrompts)\n\t{\n\t\tconst {\n\t\t\tprompt,\n\t\t\tnegative_prompt,\n\t\t\tinfoline,\n\t\t} = extractPromptAndInfoFromRaw(line);\n\n\t\tyield [EnumInfoKey.prompt as const, prompt] as const\n\t\tyield [EnumInfoKey.negative_prompt as const, negative_prompt] as const;\n\t\tline = infoline;\n\t}\n\n\tyield* handleInfoEntriesGenerator(_parseInfoLineGenerator(line), opts)\n}\n\n/**\n * @example\n * import fs from 'fs/promises'\n * import parseFromImageBuffer from '@bluelovers/auto1111-pnginfo'\n *\n * const file = await fs.readFile('generate_waifu.png')\n * const info = parseFromImageBuffer(file)\n *\n * console.log(info)\n */\nexport function parseFromImageBuffer(png: Uint8Array | string, cast_to_snake = false)\n{\n\tlet bytes = inputToBytes(png) as Uint8Array;\n\n\tconst raw = extractRawFromBytes(bytes);\n\tif (!raw) return;\n\n\tconst {\n\t\traw_info,\n\t\twidth,\n\t\theight,\n\t} = raw;\n\n\tconst {\n\t\tprompt,\n\t\tnegative_prompt,\n\t\tinfoline,\n\t\tinfoline_extra,\n\t\t//lines_raw,\n\t} = extractPromptAndInfoFromRaw(raw_info as any)\n\n\tlet data = parseFromRawInfo(infoline, {\n\t\tcast_to_snake,\n\t});\n\n\tlet output = {\n\t\tmetadata: {\n\t\t\twidth,\n\t\t\theight,\n\t\t\textra: infoline_extra,\n\t\t\traw_info,\n\t\t},\n\t\tpnginfo: {\n\t\t\tprompt,\n\t\t\tnegative_prompt,\n\t\t\t...data,\n\t\t},\n\t}\n\n\treturn output\n}\n\nexport default parseFromImageBuffer\n"],"names":["inputToBytes","png","Buffer","isBuffer","Uint8Array","from","atob","slice","c","charCodeAt","i32","a","i","Uint32Array","reverse","buffer","_normalizeInputRaw","raw_info","crlf","replace","RE_LINE_SPLIT_BASE","RE_LINE_SPLIT_PLUS","_splitRawToLines","split","_isRawVersionPlus","test","_parseLine","line","key","value","match","_parseInfoLineGenerator","infoline","entries","splitSmartly","brackets","trimSeparators","length","entry","extractPromptAndInfoFromRaw","isPlus","lines","prompt","negative_prompt","lines_raw","_line","_line2","TypeError","pop","startsWith","idx","splice","join","infoline_extra","BYTES_pngmagic","BYTES_tEXt","OFFSET_parameters","uint8arrayToString","uint8array","TextDecoder","decode","extractRawFromBytes","bytes","ihdrSize","width","height","txtOffset","txtSize","keyToSnakeStyle1","toLowerCase","handleInfoEntriesGenerator","opts","handleInfoEntry","cast_to_snake","asNum","parseFloat","isNotNum","isNaN","EnumInfoKey","parseFromRawInfo","Object","fromEntries","parseFromRawInfoGenerator","isIncludePrompts","parseFromImageBuffer","raw","metadata","extra","pnginfo","exports","_parseInfoLine","handleInfoEntries","stringToUint8Array","inputString","TextEncoder","encode"],"mappings":";;;;EAEM,SAAUA,aAAaC;IAc5B,OAAsB,sBAAXC,UAA0BA,OAAOC,SAASF,MAAQA,aAAeG,aAEpEH,IAODG,WAAWC,KAAKC,KAAKL,EAAIM,MAAM,GAAG,SAAQC,KAAKA,EAAEC,WAAW;AACpE;EAKgB,SAAAC,IAAIC,GAAeC;IAElC,OAAO,IAAIC,YAAY,IAAIT,WAAW,KAAIO,EAAEJ,MAAMK,GAAGA,IAAI,KAAIE,WAAWC,QAAQ;AACjF;EAEM,SAAUC,mBAAmBC;IAQlC,OANWC,EAAAA,KAAKD,GACdE,QAAQ,qBAAqB,IAC7BA,QAAQ,WAAW,QACnBA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