@file-viewer/web-full 2.1.3 → 2.1.4
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/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/flyfish-file-viewer-web-full.iife.js +10 -11643
- package/dist/flyfish-viewer-manifest.json +1 -1
- package/dist/global.d.ts +4 -2
- package/dist/global.js +4 -2
- package/dist/iife.d.ts +40 -0
- package/dist/iife.js +325 -0
- package/dist/renderers/archive.iife.js +358 -0
- package/dist/renderers/cad.iife.js +198 -0
- package/dist/renderers/data.iife.js +154 -0
- package/dist/renderers/drawing.iife.js +3389 -0
- package/dist/renderers/ebook.iife.js +95 -0
- package/dist/renderers/eda.iife.js +146 -0
- package/dist/renderers/email.iife.js +95 -0
- package/dist/renderers/geo.iife.js +30 -0
- package/dist/renderers/image.iife.js +88 -0
- package/dist/renderers/media.iife.js +89 -0
- package/dist/renderers/mindmap.iife.js +57 -0
- package/dist/renderers/model.iife.js +4288 -0
- package/dist/renderers/ofd.iife.js +31 -0
- package/dist/renderers/pdf.iife.js +2097 -0
- package/dist/renderers/presentation.iife.js +108 -0
- package/dist/renderers/spreadsheet.iife.js +121 -0
- package/dist/renderers/text.iife.js +284 -0
- package/dist/renderers/typst.iife.js +109 -0
- package/dist/renderers/word.iife.js +458 -0
- package/package.json +23 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
(function(){var Ts=Object.create,Br=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,Fs=Object.getOwnPropertyNames,Ds=Object.getPrototypeOf,Cs=Object.prototype.hasOwnProperty,Ze=(t,r)=>()=>(t&&(r=t(t=0)),r),je=(t,r)=>()=>(r||(t((r={exports:{}}).exports,r),t=null),r.exports),xr=(t,r)=>{let s={};for(var a in t)Br(s,a,{get:t[a],enumerable:!0});return r||Br(s,Symbol.toStringTag,{value:"Module"}),s},Os=(t,r,s,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(var c=Fs(r),l=0,h=c.length,o;l<h;l++)o=c[l],!Cs.call(t,o)&&o!==s&&Br(t,o,{get:(S=>r[S]).bind(null,o),enumerable:!(a=Ps(r,o))||a.enumerable});return t},vn=(t,r,s)=>(s=t!=null?Ts(Ds(t)):{},Os(r||!t||!t.__esModule?Br(s,"default",{value:t,enumerable:!0}):s,t)),Pi,Fi,Di,Ci,Bs=Ze((()=>{Pi="wasm/data/sql-wasm.wasm",Fi="http://localhost/",Di=(t,r,s={})=>{const a=t?String(t):r,c=s.documentBaseUrl||Fi,l=s.baseUrl?s.baseUrl.endsWith("/")?s.baseUrl:`${s.baseUrl}/`:c,h=s.baseUrl?new URL(l,c).href:l,o=new URL(a,h).href;return s.trimTrailingSlash?o.replace(/\/+$/,""):o},Ci=(t,r=[],s)=>Di(t?.sqlWasmUrl||r.find(Boolean),Pi,{documentBaseUrl:s})})),Oi=Ze((()=>{Bs()})),mn,gn,yn,wn,At,xs,zt=Ze((()=>{mn=["zip","zipx","7z","rar","tar","gz","gzip","tgz","bz2","bzip2","tbz","tbz2","xz","txz","lzma","zst","tzst","cab","ar","cpio","iso","xar","lha","lzh","jar","war","ear","apk","cbz","cbr"],gn=["glb","gltf","obj","stl","ply","fbx","dae","3ds","3mf","amf","usd","usda","usdc","usdz","kmz","step","stp","iges","igs","ifc","3dm","brep","pcd","wrl","vrml","xyz","vtk","vtp"],yn=["txt","json","js","mjs","cjs","css","java","py","html","htm","jsx","ts","tsx","xml","log","vue","yaml","yml","ini","sh","bash","sql","go","rs","php","c","cpp","cc","h","hpp","cs","diff","patch","bundle","bdl","jsonc","json5","ipynb","toml","proto","hcl","tex","gv","http","react","rb","swift","kt"],wn=["gif","jpg","jpeg","bmp","tiff","tif","png","svg","webp","avif","ico","heic","heif","jxl"],At=[{id:"office-word-openxml",label:"Word OpenXML",category:"office",extensions:["docx","docm","dotx","dotm"],async:!0,capabilities:{download:!0,print:"adapter",exportHtml:"adapter",zoom:"provider",search:!0}},{id:"office-word-binary",label:"Word Binary",category:"office",extensions:["doc","dot"],async:!0,capabilities:{download:!0,print:"adapter",exportHtml:"adapter",zoom:"provider",search:!0}},{id:"office-presentation",label:"PowerPoint",category:"office",extensions:["pptx","pptm","potx","potm","ppsx","ppsm"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"open-document",label:"Open Document",category:"office",extensions:["rtf","odt","odp"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"spreadsheet-openxml",label:"Spreadsheet",category:"office",extensions:["xlsx","xltx","xlsm","xlsb","xls","xlt","xltm","csv","ods","fods","numbers"],async:!0,capabilities:{download:!0,print:!1,exportHtml:!1,zoom:"provider",search:!0}},{id:"pdf",label:"PDF",category:"document",extensions:["pdf"],async:!0,capabilities:{download:!0,print:"adapter",exportHtml:"adapter",zoom:"provider",search:"provider"}},{id:"ofd",label:"OFD",category:"document",extensions:["ofd"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"typst",label:"Typst",category:"document",extensions:["typ","typst"],async:!0,capabilities:{download:!0,print:"adapter",exportHtml:"adapter",zoom:"provider",search:!0}},{id:"archive",label:"Archive",category:"archive",extensions:mn,async:!0,capabilities:{download:!0,print:!1,exportHtml:!1,zoom:!1,search:!0}},{id:"email",label:"Email",category:"email",extensions:["eml","msg","mbox"],async:!0,capabilities:{download:!0,print:!1,exportHtml:!0,zoom:!1,search:!0}},{id:"eda",label:"EDA",category:"eda",extensions:["olb","dra","gds","oas","oasis"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:!1,search:!0}},{id:"cad",label:"CAD",category:"cad",extensions:["dxf","dwg","dwf","dwfx","xps"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!1}},{id:"model",label:"3D Model",category:"model",extensions:gn,async:!0,capabilities:{download:!0,print:!1,exportHtml:!1,zoom:"provider",search:!1}},{id:"geo",label:"Geospatial",category:"geo",extensions:["geojson","kml","gpx","shp"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"drawing",label:"Drawing",category:"drawing",extensions:["excalidraw","drawio","dio","mermaid","mmd","plantuml","puml"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"mindmap",label:"Mind Map",category:"mindmap",extensions:["xmind"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"epub",label:"EPUB",category:"ebook",extensions:["epub"],async:!0,capabilities:{download:!0,print:!1,exportHtml:!0,zoom:!1,search:"provider"}},{id:"umd",label:"UMD",category:"ebook",extensions:["umd"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!0}},{id:"image",label:"Image",category:"image",extensions:wn,async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:"provider",search:!1}},{id:"markdown",label:"Markdown",category:"markdown",extensions:["md","markdown"],async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:!1,search:!0}},{id:"code",label:"Code and Text",category:"code",extensions:yn,async:!0,capabilities:{download:!0,print:!0,exportHtml:!0,zoom:!1,search:!0}},{id:"video",label:"Video",category:"media",extensions:["mp4","webm","m3u8"],async:!0,capabilities:{download:!0,print:!1,exportHtml:!1,zoom:!1,search:!1}},{id:"audio",label:"Audio",category:"media",extensions:["mp3","mpeg","wav","ogg","oga","opus","m4a","aac","flac","weba","midi","mid"],async:!0,capabilities:{download:!0,print:!1,exportHtml:!1,zoom:!1,search:!1}},{id:"data-asset",label:"Data Asset",category:"asset",extensions:["ttf","otf","woff","woff2","psd","ai","eps","sqlite","wasm","parquet","avro","webarchive"],async:!0,capabilities:{download:!0,print:!1,exportHtml:!0,zoom:!1,search:!0}}],xs=Object.freeze(Array.from(new Set(At.flatMap(t=>t.extensions))).sort())})),Us,Ls,Ms=Ze((()=>{Us=["[data-viewer-anchor-id]",".pdfViewer .page",".docx-wrapper section",".docx p",".docx li",".docx table",".markdown-body h1",".markdown-body h2",".markdown-body h3",".markdown-body h4",".markdown-body h5",".markdown-body h6",".markdown-body p",".markdown-body li",".markdown-body pre",".markdown-body table","article h1","article h2","article h3","article h4","article h5","article h6","article p","article li","article pre","article table","pre code","p","li","tr","h1","h2","h3","h4","h5","h6","pre","table"].join(","),Ls=[".viewer-actions",".viewer-watermark",".state-panel",".pdf-toolbar",".pdf-nav-pane",".flyfish-search-match"].join(",")})),bn,_n,Sn,Rs=Ze((()=>{bn=new WeakMap,_n=(t,r)=>{bn.set(t,r),t.dataset.viewerZoomProvider=t.dataset.viewerZoomProvider||"custom",t.__flyfishViewerZoomProvider=r},Sn=t=>{t&&(bn.delete(t),delete t.dataset.viewerZoomProvider,delete t.__flyfishViewerZoomProvider)}})),pr=Ze((()=>{Ms(),Rs()})),Ns,Bi=Ze((()=>{pr(),Ns=["script","style","textarea","input","select","button",".viewer-actions",".viewer-watermark",".state-panel",".pdf-toolbar",".pdf-nav-pane",".flyfish-search-match",".textLayer",".annotationLayer",".xfaLayer","svg","canvas","iframe","video","audio"].join(",")})),xi=Ze((()=>{pr(),Bi()})),En,An=Ze((()=>{pr(),En=()=>{const t=new Set;return{emit(){t.forEach(r=>r())},subscribe(r){return t.add(r),()=>{t.delete(r)}}}}})),gt,Ur=Ze((()=>{gt=t=>t.trim().replace(/^\./,"").toLowerCase()})),zs,Ui,Li,In,Mi,Ri,Ni,kn,zi,kt,Tn,Qt=Ze((()=>{zs="zh-CN",Ui={"toolbar.zoomGroup":"缩放控制","toolbar.zoomOut":"缩小预览","toolbar.zoomIn":"放大预览","toolbar.zoomReset":"还原比例","toolbar.download":"下载","toolbar.downloadTitle":"下载原始文件","toolbar.print":"打印","toolbar.printTitle":"打印完整渲染内容","toolbar.exportHtml":"HTML","toolbar.exportHtmlTitle":"导出当前渲染后的 HTML","state.ready.title":"预览完成","state.ready.message":"文件内容已完成渲染。","state.empty.title":"暂无文件","state.empty.message":"请选择文件或提供可访问的文件地址后开始预览。","state.unsupported.install.title":"需要装配预览能力","state.unsupported.install.message":"{extension} 格式已在支持矩阵中,但当前项目尚未装配 {rendererLabel} renderer。","state.unsupported.install.description":"推荐安装 {presetPackage},通过 options.preset / options.renderers 注入对应能力{rendererTip};Vite 项目也可以使用 @file-viewer/vite-plugin 自动发现已安装 preset。","state.unsupported.title":"暂不支持在线预览","state.unsupported.message":"不支持{extension}格式的在线预览,请下载后预览或转换为支持的格式。","state.unsupported.description":"支持 Office、PDF、OFD、Typst、压缩包、邮件、OLB/DRA、CAD、地理数据、3D 模型、Excalidraw、draw.io、EPUB、UMD、Markdown、代码/文本、图片、音视频、字体和数据资产的在线预览","state.error.title":"预览失败","preview.downloading":"正在下载文件资源...","preview.streamingPdf":"正在建立 PDF 流式预览...","preview.reading":"正在解析文件内容...","error.download":"下载失败","error.print":"打印失败","error.exportHtml":"导出 HTML 失败","error.noDownloadSource":"当前没有可下载的源文件","error.noExportContent":"当前没有可导出的预览内容","error.printUnavailable":"当前文件类型不支持完整打印,请下载原文件后在本地应用中打印","error.printWindowBlocked":"浏览器拦截了打印窗口","error.remoteDownload":"文件下载失败","error.localRead":"读取文件异常","error.load":"加载文件异常","error.stream":"加载 PDF 流式预览异常","error.beforeOperation":"操作前置校验失败","operation.download":"下载原始文件","operation.print":"打印完整渲染内容","operation.exportHtml":"导出渲染 HTML","operation.zoomIn":"放大预览","operation.zoomOut":"缩小预览","operation.zoomReset":"还原预览比例","pdf.toolbar.toggleNavigation":"切换导航窗格","pdf.toolbar.previousPage":"上一页","pdf.toolbar.nextPage":"下一页","pdf.toolbar.fitWidth":"适合宽度","pdf.toolbar.zoomOut":"缩小","pdf.toolbar.zoomIn":"放大","pdf.toolbar.rotateLeft":"向左旋转","pdf.toolbar.rotateRight":"向右旋转","pdf.nav.typeLabel":"PDF 导航类型","pdf.nav.pagesTab":"页面","pdf.nav.outlineTab":"目录","pdf.nav.pagesTitle":"页面导航","pdf.nav.outlineTitle":"目录导航","pdf.nav.pageCount":"{count} 页","pdf.nav.itemCount":"{count} 项","pdf.nav.pageLabel":"第 {page} 页","pdf.nav.outlineEmpty":"当前 PDF 没有可用目录","pdf.nav.outlineFallbackTitle":"目录 {index}","pdf.thumbnail.alt":"第 {page} 页缩略图","pdf.state.loading":"正在加载 PDF...","pdf.error.browserWindow":"PDF 预览需要浏览器窗口","pdf.error.missingSource":"PDF 缺少可读取的数据源","pdf.error.loadFailed":"PDF 加载失败","pdf.error.notLoaded":"PDF 尚未加载完成,请稍后再试","pdf.error.unloaded":"PDF 已卸载,无法继续打印","pdf.error.canvasUnavailable":"当前浏览器无法创建 PDF 打印画布","pdf.export.pageTitle":"{title} - 第 {page} 页","spreadsheet.loading.kicker":"Excel 表格","spreadsheet.loading.title":"正在解析 Excel 工作簿","spreadsheet.loading.hint":"正在准备工作表、样式和大数据视口,请稍候。","spreadsheet.loading.streaming":"正在平滑补充可视区数据","spreadsheet.tabs.ariaLabel":"工作表列表","spreadsheet.state.parsingWorkbook":"正在解析 Excel 工作簿,请耐心等待...","spreadsheet.state.preparingSheet":"正在准备工作表内容...","spreadsheet.state.preparingSheetNamed":"正在准备「{name}」...","spreadsheet.state.cachedRows":"已缓存 {cached} / {total} 行","spreadsheet.state.rows":"共 {rows} 行,按视口预取平滑加载","spreadsheet.state.rowsAndColumns":"共 {rows} 行,{cols} 列,按视口预取平滑加载","spreadsheet.error.parseFailed":"Excel 解析失败","spreadsheet.error.workerFailed":"Excel Worker 运行失败","archive.error.nestedUnsupported":"不支持 .{type} 格式的在线预览,请下载后预览或转换为支持的格式","archive.loading.readingDirectory":"正在读取压缩包目录...","archive.loading.readingDirectoryHint":"大文件会在 Worker 中解析,避免阻塞主线程。","archive.search.placeholder":"筛选压缩包内文件","archive.preview.title":"压缩包内预览","archive.preview.chooseFile":"请选择一个文件","archive.preview.downloadFile":"下载文件","archive.error.title":"压缩包预览提示","archive.stats.summary":"{count} 个文件 · {size} · {previewable} 个可直接预览","archive.warning.encrypted":"检测到加密内容,当前在线预览不接收密码,建议下载后本地解压。","archive.empty.title":"选择左侧文件即可预览","archive.empty.message":"压缩包只读取目录;文件内容会在点击后按需解压,并在体积允许时缓存到 IndexedDB。","archive.loading.initializingCandidate":"正在初始化 {label}...","archive.loading.initializingCandidateHint":"如果当前服务器没有正确发布 Worker/WASM,会自动切换兼容模式。","archive.error.candidateInitTimeout":"{label} 初始化超时","archive.error.encryptedCheckTimeout":"{label} 加密检测超时","archive.loading.directoryReadyHint":"目录读取完成后,点击内部文件才会按需解压。","archive.error.candidateReadTimeout":"{label} 读取目录超时","archive.loading.workerFallback":"Worker 不可用,正在切换 ZIP/TAR 兼容模式...","archive.loading.workerFallbackHint":"兼容模式无需额外静态 Worker,适合手机 WebView 或本地临时服务器。","archive.notice.workerFallback":"当前环境的 libarchive Worker 未能启动,已自动切换到 ZIP/TAR/GZIP 兼容模式。RAR、7z 等格式仍建议发布 vendor/libarchive/worker-bundle.js 与 libarchive.wasm。","archive.error.tooLarge":"压缩包体积 {size} 超过安全上限 {limit},请下载后在本地解压。","archive.loading.initializingWorker":"正在初始化压缩包解析 Worker...","archive.loading.initializingWorkerHint":"大文件会在 Worker 中解析,避免阻塞主线程。","archive.error.workerInitFailed":"压缩包 Worker 初始化失败","archive.error.entryTooLarge":"压缩包内文件 {name} 体积 {size} 超过预览上限 {limit}。","archive.loading.extracting":"正在按需解压 {name}...","archive.loading.rendering":"正在渲染 {name}...","archive.loading.exporting":"正在导出 {name}...","media.audio.title":"音频预览","media.audio.description":"使用浏览器原生播放器打开,兼容性取决于当前浏览器支持的音频编码。","media.audio.unsupported":"当前浏览器不支持音频播放。","media.video.title":"视频预览","media.video.unsupported":"当前浏览器不支持该视频格式。","media.video.hlsHint":"HLS 会优先使用原始 URL 加载分片;如果传入的是本地单文件清单,请确保分片地址可被浏览器访问。","media.midi.title":"MIDI 文件","media.midi.loading":"正在解析 MIDI 轨道...","media.midi.trackHeader":"轨道","media.midi.instrumentHeader":"乐器","media.midi.channelHeader":"通道","media.midi.noteCountHeader":"音符数","media.midi.durationHeader":"时长","media.midi.durationStat":"时长","media.midi.trackStat":"轨道","media.midi.noteStat":"音符","media.midi.parseFailed":"MIDI 解析失败","email.mbox.subject":"{filename} · 第 1 封","email.mbox.summary":"MBOX 共识别 {count} 封邮件,当前展示第 1 封。","email.error.title":"邮件预览提示","email.meta.from":"发件人","email.meta.to":"收件人","email.meta.cc":"抄送","email.meta.date":"时间","email.tabs.text":"正文","email.tabs.headers":"头信息","email.attachments.title":"附件","email.attachments.empty":"暂无附件","email.attachments.download":"下载附件","email.attachments.opening":"正在打开附件 {name}...","email.attachments.nestedUnavailable":"当前运行环境未提供附件嵌套预览入口,请下载 {name} 后查看。","email.loading.parsing":"正在解析邮件...","data.font.sample":"Flyfish Viewer 轻量预览 AaBbCc 1234567890","data.error.fontFaceUnsupported":"当前浏览器不支持 FontFace API","data.title.font":"字体文件预览","data.title.sqlite":"SQLite 数据库预览","data.title.parquet":"Parquet 列式数据预览","data.title.avro":"Avro 对象容器预览","data.title.wasm":"WebAssembly 模块预览","data.title.eps":"EPS 矢量文件摘要","data.title.ai":"Illustrator 文件摘要","data.title.webarchive":"WebArchive 摘要预览","data.title.summary":"数据资产摘要","data.label.format":"格式","data.label.size":"大小","data.label.rendering":"渲染方式","data.label.objects":"对象数","data.label.sampleTable":"示例表","data.label.rows":"行数","data.label.columns":"列数","data.label.sampleRows":"示例行","data.label.imports":"导入","data.label.exports":"导出","data.label.magic":"Magic","data.label.note":"说明","data.label.container":"容器","data.value.schemaRead":"已读取","data.value.schemaUnread":"未读取","data.note.aiSummary":"非 PDF-compatible AI 按摘要展示","data.note.postscriptSummary":"PostScript 摘要展示","data.note.webarchive":"安全提取可读片段,不执行网页脚本","data.image.alt":"资产预览","psd.title":"PSD 图层预览","psd.action.fit":"适合","psd.action.showAll":"全显","psd.action.hideAll":"全隐","psd.layers.title":"图层","psd.layers.redrawable":"{count} 可重绘","psd.layers.empty":"未发现可展示图层,使用合成图预览。","psd.layers.hidden":"隐藏","drawing.error.viewerLoadFailed":"diagrams.net viewer 加载失败","drawing.error.excalidrawEmpty":"Excalidraw 文件中没有可预览图元","drawing.error.excalidrawTimeout":"Excalidraw 官方导出超时,自动切换 rough.js 兼容渲染","drawing.error.drawioParseFailed":"Draw.io XML 解析失败:{message}","drawing.error.drawioNoModel":"当前 Draw.io 文件没有可直接渲染的 mxGraphModel。","drawing.error.drawioNoElements":"当前 Draw.io 文件没有可预览图元。","drawing.error.viewerInitFailed":"diagrams.net viewer 未正确初始化","drawing.error.drawioTimeout":"diagrams.net 官方 Viewer 加载超时,自动切换本地 SVG 预览","drawing.error.svgParseFailed":"SVG 解析失败","drawing.error.plantumlRenderFailed":"PlantUML SVG 渲染失败:{status}","drawing.title.excalidraw":"Excalidraw 官方 SVG 预览","drawing.title.mermaid":"Mermaid SVG 预览","drawing.title.plantuml":"PlantUML SVG 预览","drawing.title.drawio":"Draw.io 离线 SVG 预览","drawing.toolbar.zoomOut":"缩小","drawing.toolbar.zoomIn":"放大","drawing.toolbar.fit":"适合","drawing.toolbar.fitWidth":"适合宽度","drawing.state.loading":"正在加载绘图预览...","text.code.loadingHighlight":"正在加载高亮...","ebook.toc":"目录","ebook.reading":"阅读中","ebook.itemCount":"{count} 项","epub.title":"EPUB 电子书","epub.previousPage":"上一页","epub.nextPage":"下一页","epub.loading":"正在解析 EPUB...","epub.chapterFallback":"章节 {index}","epub.renderIncomplete":"EPUB 正文渲染未完成,请刷新后重试","umd.title":"UMD 电子书","umd.previousChapter":"上一章","umd.nextChapter":"下一章","umd.loading":"正在解析 UMD...","umd.emptyContent":"未解析到正文内容","umd.chapterFallback":"章节 {index}","umd.galleryFallback":"图集 {index}","umd.warningBodyTooShort":"UMD 正文长度小于声明长度,文件可能不完整","umd.error.unexpectedEnd":"UMD 文件结构不完整,读取时遇到意外结尾","umd.error.invalidFile":"不是有效的 UMD 电子书文件","typst.summaryRenderer":"Typst WASM 渲染器","typst.pageSummary.empty":"0 页","typst.pageSummary.ready":"{count} 页 / {width} x {height} pt","typst.status.compiling":"正在编译","typst.status.failed":"编译失败","typst.status.rendered":"已渲染","typst.loading.title":"正在解析 Typst","typst.loading.hint":"加载编译器并生成页面预览...","typst.error.title":"Typst 渲染失败","typst.error.timeout":"Typst WASM / 字体加载或编译超过 {seconds} 秒","typst.error.timeoutHint":"请检查 Typst compiler WASM、renderer WASM、字体目录的下载速度和缓存策略;弱网或跨境部署可通过 options.typst.renderTimeoutMs 调大浏览器端加载/编译超时。","typst.error.assetHint":"Typst 需要本地 compiler / renderer WASM 和字体目录。请运行 file-viewer-copy-assets,或配置 options.typst.compilerWasmUrl / options.typst.rendererWasmUrl / options.typst.fontAssetsUrl,并确认服务器以 application/wasm 返回 WASM。","typst.error.svgParseFailed":"Typst SVG 解析失败","typst.error.wasmLoadFailed":"Typst WASM 加载失败","xmind.toolbar.zoomOut":"缩小","xmind.toolbar.zoomIn":"放大","xmind.toolbar.fit":"适合","xmind.toolbar.fitTitle":"适配画布","xmind.state.loading":"正在解析 XMind 脑图...","xmind.stats.nodes":"节点","xmind.stats.depth":"层级","xmind.stats.theme":"主题","xmind.stats.template":"模板","xmind.badge.paused":"暂停","xmind.badge.collapsed":"折叠","xmind.badge.floating":"浮动","xmind.badge.summary":"概要","xmind.badge.callout":"标注","xmind.imageResource":"图片资源: {name}","xmind.error.unrecognized":"无法识别 XMind 文件: ZIP 中未找到 content.json 或 content.xml","xmind.error.noCanvas":"XMind 文件中没有可预览的画布","cad.toolbar.fit":"适配","cad.toolbar.zoomOut":"缩小","cad.toolbar.zoomIn":"放大","cad.layers.title":"图层","cad.layers.count":"{count} 项","cad.inspector.title":"结构","cad.inspector.entities":"实体","cad.inspector.blocks":"块","cad.inspector.pages":"页面","cad.inspector.drawn":"绘制","cad.state.loadingViewer":"正在加载 CAD 预览器...","cad.state.parsing":"正在解析 CAD...","cad.error.parseFailed":"CAD 文件解析失败","image.alt":"图片","image.lightbox.alt":"图片预览","image.lightbox.close":"关闭图片预览","gitBundle.error.invalid":"当前文件不是标准 Git bundle。","gitBundle.error.missingPack":"Git bundle header 后未找到 PACK 数据。","gitBundle.notice.delta":"当前 bundle 包含 delta 压缩对象。预览器已在浏览器端解析常规 OFS_DELTA / REF_DELTA;若仍有缺失文件,通常是包体过大、对象过多或依赖外部 prerequisite。","gitBundle.title.history":"历史记录","gitBundle.title.fileTree":"文件树","gitBundle.file.choose":"选择文件查看内容","gitBundle.file.noTree":"当前 bundle 的 tree/blob 可能被 delta 压缩,暂未解析到可展开文件。","gitBundle.file.none":"未解析到文件","gitBundle.history.empty":"当前 bundle 未解析到 commit 对象,仅展示 refs 和 pack 摘要。","gitBundle.toolbar.summary":"{commits} commits · {files} files","gitBundle.meta.bundle":"Bundle","gitBundle.meta.refs":"Refs","gitBundle.meta.commits":"Commits","gitBundle.meta.objects":"Objects","gitBundle.meta.deltas":"Deltas","gitBundle.meta.objectFormat":"Object format","gitBundle.meta.objectTypes":"Object types","geo.error.unrecognized":"无法识别的 GeoJSON 数据","geo.error.xmlParseFailed":"XML 解析失败","geo.error.unsupported":"不支持 .{type} 地理格式","geo.title":"地理数据预览","geo.featureCount":"要素数","geo.bounds":"范围","geo.geometryTypes":"几何类型","geo.aria":"地理数据 SVG 预览","geo.loading":"正在解析地理数据...","model.toolbar.fit":"适配","model.toolbar.rotate":"旋转","model.toolbar.wireframe":"线框","model.toolbar.grid":"网格","model.toolbar.axes":"坐标","model.state.loadingSummary":"正在加载模型","model.state.loading":"正在解析 3D 模型...","model.state.loaded":"模型已加载","model.state.parseFailed":"模型解析失败","model.summary.meshes":"{count} 个网格","model.summary.points":"{count} 个点云","model.error.daeEmpty":"DAE 模型未解析出有效场景","model.error.unsupported":"暂不支持 .{type} 模型格式","model.error.parseFailed":"{type} 模型解析失败","model.notice.signature":"检测到文件签名: {signature}。","loading.generic.label":"文件内容","loading.generic.hint":"正在整理内容结构并生成预览。","loading.word.label":"Word 文档","loading.word.hint":"正在准备分页、文本样式和文档结构。","loading.wordWorker.hint":"正在通过 Worker 准备文档结构、文本样式和分页结果。","loading.sheet.label":"Excel 表格","loading.sheet.hint":"正在准备工作表、样式和可视区数据。","loading.csv.label":"表格数据","loading.csv.hint":"正在准备行列数据和基础样式。","loading.presentation.label":"PPT 演示文稿","loading.presentation.hint":"正在构建幻灯片布局和媒体内容。","loading.pdf.label":"PDF 文档","loading.pdf.hint":"正在载入页面位图、文本层和缩放视图。","loading.ofd.label":"OFD 版式文件","loading.ofd.hint":"正在解析国产版式文档和页面对象。","loading.archive.label":"压缩包","loading.archive.hint":"正在启动 Worker 并读取压缩包目录。","loading.email.label":"邮件文件","loading.email.hint":"正在解析邮件头、正文和附件。","loading.msg.hint":"正在解析 Outlook 邮件和附件。","loading.eda.label":"EDA 文件","loading.eda.hint":"正在读取 EDA 容器结构和可读属性。","loading.cad.label":"CAD 图纸","loading.cad.hint":"正在准备 CAD 图层、几何对象和画布视图。","loading.dwg.hint":"正在通过 Worker 加载 DWG 几何和 LibreDWG WASM。","loading.dwf.hint":"正在加载 DWF native renderer 与 W2D/W3D 图形。","loading.dwfx.hint":"正在加载 DWFx/XPS native renderer 与页面图形。","loading.xps.hint":"正在加载 XPS native renderer 与嵌入字体。","loading.drawio.label":"draw.io 图纸","loading.drawio.hint":"正在解析图元、连线和 SVG 预览。","loading.excalidraw.label":"Excalidraw 图纸","loading.excalidraw.hint":"正在解析手绘图元并生成安全 SVG。","loading.epub.label":"EPUB 电子书","loading.epub.hint":"正在解析目录、章节资源和阅读分页。","loading.umd.label":"UMD 电子书","loading.umd.hint":"正在解析移动电子书结构、目录和压缩正文。","loading.image.label":"图片文件","loading.image.hint":"正在解码像素数据并生成预览。","loading.video.label":"视频文件","loading.video.hint":"正在准备媒体资源和播放组件。","loading.audio.label":"音频文件","loading.audio.hint":"正在准备音频资源和播放控件。"},Li={"toolbar.zoomGroup":"Zoom controls","toolbar.zoomOut":"Zoom out","toolbar.zoomIn":"Zoom in","toolbar.zoomReset":"Reset zoom","toolbar.download":"Download","toolbar.downloadTitle":"Download the original file","toolbar.print":"Print","toolbar.printTitle":"Print the complete rendered document","toolbar.exportHtml":"HTML","toolbar.exportHtmlTitle":"Export the rendered HTML","state.ready.title":"Preview ready","state.ready.message":"The file has been rendered.","state.empty.title":"No file selected","state.empty.message":"Choose a file or provide an accessible URL to start previewing.","state.unsupported.install.title":"Preview capability required","state.unsupported.install.message":"{extension} is in the supported matrix, but {rendererLabel} renderer is not assembled in this project.","state.unsupported.install.description":"Install {presetPackage} and pass the capability through options.preset / options.renderers{rendererTip}. Vite projects can also use @file-viewer/vite-plugin to auto-discover installed presets.","state.unsupported.title":"Online preview is not supported yet","state.unsupported.message":"{extension} cannot be previewed online. Download it or convert it to a supported format.","state.unsupported.description":"Supports online preview for Office, PDF, OFD, Typst, archives, email, OLB/DRA, CAD, geospatial data, 3D models, Excalidraw, draw.io, EPUB, UMD, Markdown, code/text, images, audio/video, fonts, and structured data assets.","state.error.title":"Preview failed","preview.downloading":"Downloading file resources...","preview.streamingPdf":"Preparing streaming PDF preview...","preview.reading":"Parsing file content...","error.download":"Download failed","error.print":"Print failed","error.exportHtml":"HTML export failed","error.noDownloadSource":"There is no original file source to download.","error.noExportContent":"There is no rendered preview content to export.","error.printUnavailable":"This file type does not support full-document printing. Download the original file and print it locally.","error.printWindowBlocked":"The browser blocked the print window.","error.remoteDownload":"File download failed","error.localRead":"Failed to read local file","error.load":"Failed to load file","error.stream":"Failed to load streaming PDF preview","error.beforeOperation":"Before-operation check failed","operation.download":"Download original file","operation.print":"Print complete rendered content","operation.exportHtml":"Export rendered HTML","operation.zoomIn":"Zoom in","operation.zoomOut":"Zoom out","operation.zoomReset":"Reset preview zoom","pdf.toolbar.toggleNavigation":"Toggle navigation pane","pdf.toolbar.previousPage":"Previous page","pdf.toolbar.nextPage":"Next page","pdf.toolbar.fitWidth":"Fit to width","pdf.toolbar.zoomOut":"Zoom out","pdf.toolbar.zoomIn":"Zoom in","pdf.toolbar.rotateLeft":"Rotate left","pdf.toolbar.rotateRight":"Rotate right","pdf.nav.typeLabel":"PDF navigation type","pdf.nav.pagesTab":"Pages","pdf.nav.outlineTab":"Outline","pdf.nav.pagesTitle":"Page navigation","pdf.nav.outlineTitle":"Outline navigation","pdf.nav.pageCount":"{count} pages","pdf.nav.itemCount":"{count} items","pdf.nav.pageLabel":"Page {page}","pdf.nav.outlineEmpty":"This PDF has no available outline.","pdf.nav.outlineFallbackTitle":"Outline {index}","pdf.thumbnail.alt":"Page {page} thumbnail","pdf.state.loading":"Loading PDF...","pdf.error.browserWindow":"PDF preview requires a browser window","pdf.error.missingSource":"PDF has no readable data source","pdf.error.loadFailed":"Failed to load PDF","pdf.error.notLoaded":"The PDF is not loaded yet. Please try again later.","pdf.error.unloaded":"The PDF has been unloaded and cannot continue printing.","pdf.error.canvasUnavailable":"This browser cannot create a PDF print canvas.","pdf.export.pageTitle":"{title} - Page {page}","spreadsheet.loading.kicker":"Excel workbook","spreadsheet.loading.title":"Parsing Excel workbook","spreadsheet.loading.hint":"Preparing worksheets, styles, and virtualized viewport data.","spreadsheet.loading.streaming":"Loading visible worksheet data","spreadsheet.tabs.ariaLabel":"Worksheet list","spreadsheet.state.parsingWorkbook":"Parsing the Excel workbook. Please wait...","spreadsheet.state.preparingSheet":"Preparing worksheet content...","spreadsheet.state.preparingSheetNamed":"Preparing “{name}”...","spreadsheet.state.cachedRows":"Cached {cached} / {total} rows","spreadsheet.state.rows":"{rows} rows, loading smoothly by viewport","spreadsheet.state.rowsAndColumns":"{rows} rows, {cols} columns, loading smoothly by viewport","spreadsheet.error.parseFailed":"Failed to parse Excel","spreadsheet.error.workerFailed":"Excel Worker failed","archive.error.nestedUnsupported":".{type} cannot be previewed online. Download it or convert it to a supported format.","archive.loading.readingDirectory":"Reading archive directory...","archive.loading.readingDirectoryHint":"Large files are parsed in a Worker to keep the main thread responsive.","archive.search.placeholder":"Filter files inside the archive","archive.preview.title":"Archive entry preview","archive.preview.chooseFile":"Choose a file","archive.preview.downloadFile":"Download file","archive.error.title":"Archive preview notice","archive.stats.summary":"{count} files · {size} · {previewable} directly previewable","archive.warning.encrypted":"Encrypted content was detected. Online preview does not accept passwords; download and extract it locally.","archive.empty.title":"Choose a file from the left to preview","archive.empty.message":"The archive directory is read first. File contents are extracted on demand and cached in IndexedDB when size allows.","archive.loading.initializingCandidate":"Initializing {label}...","archive.loading.initializingCandidateHint":"If the server does not publish Worker/WASM assets correctly, the viewer falls back automatically.","archive.error.candidateInitTimeout":"{label} initialization timed out","archive.error.encryptedCheckTimeout":"{label} encryption check timed out","archive.loading.directoryReadyHint":"After the directory is ready, click an entry to extract it on demand.","archive.error.candidateReadTimeout":"{label} directory read timed out","archive.loading.workerFallback":"Worker unavailable. Switching to ZIP/TAR compatibility mode...","archive.loading.workerFallbackHint":"Compatibility mode needs no static Worker and works well in mobile WebViews or temporary local servers.","archive.notice.workerFallback":"The libarchive Worker could not start in this environment, so ZIP/TAR/GZIP compatibility mode is active. RAR, 7z, and similar formats should still publish vendor/libarchive/worker-bundle.js and libarchive.wasm.","archive.error.tooLarge":"Archive size {size} exceeds the safety limit {limit}. Download and extract it locally.","archive.loading.initializingWorker":"Initializing archive parsing Worker...","archive.loading.initializingWorkerHint":"Large files are parsed in a Worker to keep the main thread responsive.","archive.error.workerInitFailed":"Archive Worker initialization failed","archive.error.entryTooLarge":"Entry {name} is {size}, exceeding the preview limit {limit}.","archive.loading.extracting":"Extracting {name} on demand...","archive.loading.rendering":"Rendering {name}...","archive.loading.exporting":"Exporting {name}...","media.audio.title":"Audio preview","media.audio.description":"Opened with the browser-native audio player. Codec support depends on the current browser.","media.audio.unsupported":"This browser does not support audio playback.","media.video.title":"Video preview","media.video.unsupported":"This browser does not support this video format.","media.video.hlsHint":"HLS prefers the original URL for segment loading. If the input is a local single-file playlist, make sure segment URLs are reachable by the browser.","media.midi.title":"MIDI file","media.midi.loading":"Parsing MIDI tracks...","media.midi.trackHeader":"Track","media.midi.instrumentHeader":"Instrument","media.midi.channelHeader":"Channel","media.midi.noteCountHeader":"Notes","media.midi.durationHeader":"Duration","media.midi.durationStat":"Duration","media.midi.trackStat":"Tracks","media.midi.noteStat":"Notes","media.midi.parseFailed":"Failed to parse MIDI","email.mbox.subject":"{filename} · message 1","email.mbox.summary":"Detected {count} messages in the MBOX archive. Showing message 1.","email.error.title":"Email preview notice","email.meta.from":"From","email.meta.to":"To","email.meta.cc":"Cc","email.meta.date":"Date","email.tabs.text":"Body","email.tabs.headers":"Headers","email.attachments.title":"Attachments","email.attachments.empty":"No attachments","email.attachments.download":"Download attachment","email.attachments.opening":"Opening attachment {name}...","email.attachments.nestedUnavailable":"Nested attachment preview is not available in this environment. Download {name} to inspect it.","email.loading.parsing":"Parsing email...","data.font.sample":"Flyfish Viewer preview AaBbCc 1234567890","data.error.fontFaceUnsupported":"This browser does not support the FontFace API","data.title.font":"Font file preview","data.title.sqlite":"SQLite database preview","data.title.parquet":"Parquet columnar data preview","data.title.avro":"Avro object container preview","data.title.wasm":"WebAssembly module preview","data.title.eps":"EPS vector file summary","data.title.ai":"Illustrator file summary","data.title.webarchive":"WebArchive summary preview","data.title.summary":"Data asset summary","data.label.format":"Format","data.label.size":"Size","data.label.rendering":"Renderer","data.label.objects":"Objects","data.label.sampleTable":"Sample table","data.label.rows":"Rows","data.label.columns":"Columns","data.label.sampleRows":"Sample rows","data.label.imports":"Imports","data.label.exports":"Exports","data.label.magic":"Magic","data.label.note":"Note","data.label.container":"Container","data.value.schemaRead":"Read","data.value.schemaUnread":"Not read","data.note.aiSummary":"Non PDF-compatible AI is shown as a safe summary.","data.note.postscriptSummary":"PostScript summary preview","data.note.webarchive":"Readable fragments are extracted safely. Web scripts are not executed.","data.image.alt":"Asset preview","psd.title":"PSD layer preview","psd.action.fit":"Fit","psd.action.showAll":"Show all","psd.action.hideAll":"Hide all","psd.layers.title":"Layers","psd.layers.redrawable":"{count} redrawable","psd.layers.empty":"No displayable layers were found. Showing the composite image.","psd.layers.hidden":"hidden","drawing.error.viewerLoadFailed":"Failed to load the diagrams.net viewer","drawing.error.excalidrawEmpty":"This Excalidraw file has no previewable elements","drawing.error.excalidrawTimeout":"Official Excalidraw export timed out. Falling back to the rough.js renderer.","drawing.error.drawioParseFailed":"Failed to parse Draw.io XML: {message}","drawing.error.drawioNoModel":"This Draw.io file has no directly renderable mxGraphModel.","drawing.error.drawioNoElements":"This Draw.io file has no previewable elements.","drawing.error.viewerInitFailed":"The diagrams.net viewer was not initialized correctly","drawing.error.drawioTimeout":"Official diagrams.net Viewer timed out. Falling back to the local SVG preview.","drawing.error.svgParseFailed":"Failed to parse SVG","drawing.error.plantumlRenderFailed":"Failed to render PlantUML SVG: {status}","drawing.title.excalidraw":"Official Excalidraw SVG preview","drawing.title.mermaid":"Mermaid SVG preview","drawing.title.plantuml":"PlantUML SVG preview","drawing.title.drawio":"Draw.io offline SVG preview","drawing.toolbar.zoomOut":"Zoom out","drawing.toolbar.zoomIn":"Zoom in","drawing.toolbar.fit":"Fit","drawing.toolbar.fitWidth":"Fit width","drawing.state.loading":"Loading drawing preview...","text.code.loadingHighlight":"Loading syntax highlighting...","ebook.toc":"Table of contents","ebook.reading":"Reading","ebook.itemCount":"{count} items","epub.title":"EPUB ebook","epub.previousPage":"Previous","epub.nextPage":"Next","epub.loading":"Parsing EPUB...","epub.chapterFallback":"Chapter {index}","epub.renderIncomplete":"EPUB content did not finish rendering. Refresh and try again.","umd.title":"UMD ebook","umd.previousChapter":"Previous chapter","umd.nextChapter":"Next chapter","umd.loading":"Parsing UMD...","umd.emptyContent":"No readable body content was parsed.","umd.chapterFallback":"Chapter {index}","umd.galleryFallback":"Gallery {index}","umd.warningBodyTooShort":"The UMD body is shorter than declared and may be incomplete.","umd.error.unexpectedEnd":"The UMD structure is incomplete and ended unexpectedly.","umd.error.invalidFile":"This is not a valid UMD ebook file.","typst.summaryRenderer":"Typst WASM renderer","typst.pageSummary.empty":"0 pages","typst.pageSummary.ready":"{count} pages / {width} x {height} pt","typst.status.compiling":"Compiling","typst.status.failed":"Compilation failed","typst.status.rendered":"Rendered","typst.loading.title":"Parsing Typst","typst.loading.hint":"Loading the compiler and generating page previews...","typst.error.title":"Typst render failed","typst.error.timeout":"Typst WASM / font loading or compilation exceeded {seconds} seconds","typst.error.timeoutHint":"Check the download speed and cache strategy for the Typst compiler WASM, renderer WASM, and font directory. On weak networks or cross-region deployments, increase options.typst.renderTimeoutMs.","typst.error.assetHint":"Typst requires local compiler / renderer WASM files and a font directory. Run file-viewer-copy-assets, or configure options.typst.compilerWasmUrl / options.typst.rendererWasmUrl / options.typst.fontAssetsUrl, and make sure the server returns WASM with application/wasm.","typst.error.svgParseFailed":"Failed to parse Typst SVG","typst.error.wasmLoadFailed":"Failed to load Typst WASM","xmind.toolbar.zoomOut":"Zoom out","xmind.toolbar.zoomIn":"Zoom in","xmind.toolbar.fit":"Fit","xmind.toolbar.fitTitle":"Fit canvas","xmind.state.loading":"Parsing XMind mind map...","xmind.stats.nodes":"Nodes","xmind.stats.depth":"Depth","xmind.stats.theme":"Theme","xmind.stats.template":"Template","xmind.badge.paused":"Paused","xmind.badge.collapsed":"Collapsed","xmind.badge.floating":"Floating","xmind.badge.summary":"Summary","xmind.badge.callout":"Callout","xmind.imageResource":"Image resource: {name}","xmind.error.unrecognized":"Unrecognized XMind file: content.json or content.xml was not found in the ZIP package.","xmind.error.noCanvas":"This XMind file has no previewable canvas.","cad.toolbar.fit":"Fit","cad.toolbar.zoomOut":"Zoom out","cad.toolbar.zoomIn":"Zoom in","cad.layers.title":"Layers","cad.layers.count":"{count} items","cad.inspector.title":"Structure","cad.inspector.entities":"Entities","cad.inspector.blocks":"Blocks","cad.inspector.pages":"Pages","cad.inspector.drawn":"Drawn","cad.state.loadingViewer":"Loading CAD viewer...","cad.state.parsing":"Parsing CAD...","cad.error.parseFailed":"Failed to parse CAD file","image.alt":"Image","image.lightbox.alt":"Image preview","image.lightbox.close":"Close image preview","gitBundle.error.invalid":"This file is not a valid Git bundle.","gitBundle.error.missingPack":"No PACK data was found after the Git bundle header.","gitBundle.notice.delta":"This bundle contains delta-compressed objects. The viewer resolves common OFS_DELTA / REF_DELTA objects in the browser. Missing files usually indicate a very large bundle, too many objects, or an external prerequisite.","gitBundle.title.history":"History","gitBundle.title.fileTree":"File tree","gitBundle.file.choose":"Select a file to inspect","gitBundle.file.noTree":"The tree/blob objects in this bundle may be delta-compressed, and no expandable files were parsed.","gitBundle.file.none":"No files parsed","gitBundle.history.empty":"No commit objects were parsed. Showing refs and pack summary only.","gitBundle.toolbar.summary":"{commits} commits · {files} files","gitBundle.meta.bundle":"Bundle","gitBundle.meta.refs":"Refs","gitBundle.meta.commits":"Commits","gitBundle.meta.objects":"Objects","gitBundle.meta.deltas":"Deltas","gitBundle.meta.objectFormat":"Object format","gitBundle.meta.objectTypes":"Object types","geo.error.unrecognized":"Unrecognized GeoJSON data","geo.error.xmlParseFailed":"Failed to parse XML","geo.error.unsupported":".{type} geospatial format is not supported","geo.title":"Geospatial preview","geo.featureCount":"Features","geo.bounds":"Bounds","geo.geometryTypes":"Geometry types","geo.aria":"Geospatial SVG preview","geo.loading":"Parsing geospatial data...","model.toolbar.fit":"Fit","model.toolbar.rotate":"Rotate","model.toolbar.wireframe":"Wireframe","model.toolbar.grid":"Grid","model.toolbar.axes":"Axes","model.state.loadingSummary":"Loading model","model.state.loading":"Parsing 3D model...","model.state.loaded":"Model loaded","model.state.parseFailed":"Failed to parse model","model.summary.meshes":"{count} meshes","model.summary.points":"{count} point clouds","model.error.daeEmpty":"The DAE model did not contain a valid scene.","model.error.unsupported":".{type} model format is not supported yet","model.error.parseFailed":"Failed to parse {type} model","model.notice.signature":"Detected file signature: {signature}.","loading.generic.label":"File content","loading.generic.hint":"Preparing content structure and preview.","loading.word.label":"Word document","loading.word.hint":"Preparing document structure, text styles, and layout.","loading.wordWorker.hint":"Preparing document structure, text styles, and layout in a Worker.","loading.sheet.label":"Excel workbook","loading.sheet.hint":"Preparing worksheets, styles, and viewport data.","loading.csv.label":"Tabular data","loading.csv.hint":"Preparing rows, columns, and basic styling.","loading.presentation.label":"PowerPoint deck","loading.presentation.hint":"Building slide layout and media content.","loading.pdf.label":"PDF document","loading.pdf.hint":"Loading page bitmaps, text layers, and zoom view.","loading.ofd.label":"OFD layout document","loading.ofd.hint":"Parsing OFD pages and layout objects.","loading.archive.label":"Archive","loading.archive.hint":"Starting Worker and reading archive entries.","loading.email.label":"Email file","loading.email.hint":"Parsing message headers, body, and attachments.","loading.msg.hint":"Parsing Outlook message and attachments.","loading.eda.label":"EDA file","loading.eda.hint":"Reading EDA container structure and properties.","loading.cad.label":"CAD drawing","loading.cad.hint":"Preparing CAD layers, geometry, and canvas view.","loading.dwg.hint":"Loading DWG geometry and LibreDWG WASM in a Worker.","loading.dwf.hint":"Loading native DWF renderer and W2D/W3D graphics.","loading.dwfx.hint":"Loading native DWFx/XPS renderer and page graphics.","loading.xps.hint":"Loading native XPS renderer and embedded fonts.","loading.drawio.label":"draw.io diagram","loading.drawio.hint":"Parsing shapes, connectors, and SVG preview.","loading.excalidraw.label":"Excalidraw scene","loading.excalidraw.hint":"Parsing hand-drawn elements and generating safe SVG.","loading.epub.label":"EPUB ebook","loading.epub.hint":"Parsing table of contents, chapter resources, and reading pages.","loading.umd.label":"UMD ebook","loading.umd.hint":"Parsing mobile ebook metadata, table of contents, and compressed chapters.","loading.image.label":"Image file","loading.image.hint":"Decoding pixels and generating preview.","loading.video.label":"Video file","loading.video.hint":"Preparing media resource and player.","loading.audio.label":"Audio file","loading.audio.hint":"Preparing audio resource and playback controls."},In=Object.freeze({"zh-CN":Ui,"en-US":Li}),Mi=()=>{var t;if(!(typeof navigator>"u"))return((t=navigator.languages)===null||t===void 0?void 0:t[0])||navigator.language},Ri=t=>{const r=!t||t==="auto"?Mi():t;return String(r||"zh-CN").toLowerCase().startsWith("zh")?"zh-CN":"en-US"},Ni=t=>{var r;return((r=t?.i18n)===null||r===void 0?void 0:r.messages)||t?.messages},kn=t=>{var r;return Ri(((r=t?.i18n)===null||r===void 0?void 0:r.locale)||t?.locale)},zi=(t,r={})=>t.replace(/\{([a-zA-Z0-9_.-]+)\}/g,(s,a)=>{const c=r[a];return c==null?"":String(c)}),kt=(t,r,s={})=>{const a=kn(t),c=Ni(t);return zi((typeof c=="function"?c(r,s,a):c?.[r])||In[a][r]||In["zh-CN"][r],s)},Tn=t=>(r,s)=>kt(t,r,s)})),Pn=Ze((()=>{Qt()})),ji,Lr,Mr=Ze((()=>{zt(),Ur(),ji=t=>({...t,extensions:t.extensions.map(gt)}),Lr=(t=At)=>{const r=new Map,s=new Map,a=c=>{const l=ji(c),h=r.get(l.id);h&&h.extensions.forEach(o=>{var S;((S=s.get(o))===null||S===void 0?void 0:S.id)===h.id&&s.delete(o)}),r.set(l.id,l),l.extensions.forEach(o=>{const S=s.get(o);if(S&&S.id!==l.id)throw new Error(`File extension "${o}" is already registered by renderer "${S.id}".`);s.set(o,l)})};return t.forEach(a),{register:a,unregister(c){const l=r.get(c);return l?(l.extensions.forEach(h=>{var o;((o=s.get(h))===null||o===void 0?void 0:o.id)===c&&s.delete(h)}),r.delete(c),!0):!1},getById(c){return r.get(c)},getByExtension(c){return s.get(gt(c))},hasExtension(c){return s.has(gt(c))},list(){return Array.from(r.values())},listExtensions(){return Array.from(s.keys()).sort()}}}})),Fn,Dn=Ze((()=>{zt(),Mr(),Ur(),Fn=({registry:t=Lr(At),handlers:r,fallbackHandler:s,fallbackKey:a="error"})=>{const c=Array.from(r).reduce((S,D)=>(S.set(D.rendererId,D.handler),S),new Map),l=new Map,h=[];t.list().forEach(S=>{const D=c.get(S.id);if(!D){h.push(S.id);return}S.extensions.forEach(U=>{l.set(gt(U),D)})}),s&&a&&l.set(gt(a),s);const o=S=>l.get(gt(S));return{handlersByRendererId:c,handlersByExtension:l,missingRendererIds:h,get:o,resolve(S){return o(S)||(a?o(a):void 0)},has(S){return l.has(gt(S))},listExtensions(){return Array.from(l.keys()).sort()}}}})),js,Vs,Gs,Cn=Ze((()=>{zt(),js=Object.freeze({download:!1,print:!1,exportHtml:!1,zoom:!1,zoomIn:!1,zoomOut:!1,zoomReset:!1}),Vs=["pptx","pptm","potx","potm","ppsx","ppsm","ofd","dxf","dwg","dwf","dwfx","xps","excalidraw","drawio","dio","mermaid","mmd","plantuml","puml","umd","md","markdown","olb","dra",...yn,...wn],Gs=["xlsx","xltx","xlsm","xlsb","xls","xlt","xltm","csv","ods","fods","numbers",...mn,"eml","msg","epub","mp4","mp3","mpeg","wav","ogg","oga","opus","m4a","aac","flac","weba",...gn]})),vr=Ze((()=>{Cn(),Qt(),Pn()})),Hs,On,Vi,Gi,Hi,qi,Wi,$i,Zi,Bn,Yi,Rr=Ze((()=>{Ur(),zt(),Qt(),Hs=Object.freeze({downloading:"正在下载文件资源...",streamingPdf:"正在建立 PDF 流式预览...",reading:"正在解析文件内容..."}),On=Object.freeze({accent:"#5f6f82",soft:"rgba(95, 111, 130, 0.12)",badge:"DOC",label:"文件内容",hint:"正在整理内容结构并生成预览。"}),Vi=t=>{const r=gt(t);return r?`.${r}`:"当前"},Gi={"office-word-openxml":"@file-viewer/renderer-word","office-word-binary":"@file-viewer/renderer-word","office-presentation":"@file-viewer/renderer-presentation","open-document":"@file-viewer/renderer-word","spreadsheet-openxml":"@file-viewer/renderer-spreadsheet",pdf:"@file-viewer/renderer-pdf",ofd:"@file-viewer/renderer-ofd",typst:"@file-viewer/renderer-typst",archive:"@file-viewer/renderer-archive",email:"@file-viewer/renderer-email",eda:"@file-viewer/renderer-eda",cad:"@file-viewer/renderer-cad",model:"@file-viewer/renderer-3d",geo:"@file-viewer/renderer-geo",drawing:"@file-viewer/renderer-drawing",mindmap:"@file-viewer/renderer-mindmap",epub:"@file-viewer/renderer-epub",umd:"@file-viewer/renderer-epub",image:"@file-viewer/renderer-image",markdown:"@file-viewer/renderer-text",code:"@file-viewer/renderer-text",video:"@file-viewer/renderer-media",audio:"@file-viewer/renderer-media","data-asset":"@file-viewer/renderer-data"},Hi=new Set(["office-word-openxml","office-word-binary","office-presentation","open-document","spreadsheet-openxml","pdf","ofd"]),qi=new Set(["image","markdown","code","video","audio"]),Wi=new Set(["typst","archive","eda","cad","model","geo","drawing","mindmap","data-asset"]),$i=t=>Hi.has(t.id)?{packageName:"@file-viewer/preset-office",vitePreset:"office",label:"Office preset"}:Wi.has(t.id)?{packageName:"@file-viewer/preset-engineering",vitePreset:"engineering",label:"Engineering preset"}:qi.has(t.id)?{packageName:"@file-viewer/preset-lite",vitePreset:"lite",label:"Lite preset"}:{packageName:"@file-viewer/preset-all",vitePreset:"all",label:"Full preset"},Zi=(t="")=>{const r=gt(t),s=At.find(c=>c.extensions.map(gt).includes(r));if(!s)return null;const a=$i(s);return{extension:r,rendererId:s.id,rendererLabel:s.label,rendererCategory:s.category,rendererPackage:Gi[s.id],presetPackage:a.packageName,vitePreset:a.vitePreset,presetLabel:a.label}},Bn=({state:t,extension:r="",title:s,message:a,description:c,theme:l=On,recoverable:h})=>({state:t,extension:gt(r),title:s,message:a,description:c,theme:l,recoverable:h}),Yi=(t="",r=On,s)=>{const a=Vi(t),c=Zi(t);if(c){const l=kn(s),h=c.rendererPackage?l==="zh-CN"?`;如果需要极致裁剪,也可以只安装 ${c.rendererPackage}`:`; for a strict custom cut, install only ${c.rendererPackage}`:"";return Bn({state:"unsupported",extension:t,title:kt(s,"state.unsupported.install.title"),message:kt(s,"state.unsupported.install.message",{extension:a,rendererLabel:c.rendererLabel}),description:kt(s,"state.unsupported.install.description",{extension:a,rendererLabel:c.rendererLabel,presetPackage:c.presetPackage,vitePreset:c.vitePreset,rendererTip:h}),theme:r,recoverable:!0})}return Bn({state:"unsupported",extension:t,title:kt(s,"state.unsupported.title"),message:kt(s,"state.unsupported.message",{extension:a}),description:kt(s,"state.unsupported.description"),theme:r,recoverable:!0})}})),Nr=Ze((()=>{vr(),Rr(),Qt()})),Xi,xn,Ji,Ki,Qi,Un=Ze((()=>{zt(),Dn(),Mr(),Nr(),Xi=(t,r)=>({rendered:t,destroy:()=>r?r():xn(t)}),xn=t=>{if(!t||typeof t!="object")return;const r=t;if(typeof r.unmount=="function")return r.unmount();if(typeof r.$destroy=="function")return r.$destroy();if(typeof r.destroy=="function")return r.destroy()},Ji=({source:t,options:r,registerExportAdapter:s,renderContext:a})=>({filename:t.filename,url:t.url,streamUrl:t.url,options:r,registerExportAdapter:s,...a}),Ki=({handler:t,getTarget:r=c=>c.surface.container,createContext:s=Ji,destroy:a})=>async c=>{const{source:l}=c;if(!l.buffer)throw new Error("FileRenderHandler renderer requires an ArrayBuffer source.");const h=r(c),o=await t(l.buffer,h,l.extension,s(c));return Xi(o,()=>a?a(o,c):xn(o))},Qi=({definitions:t=At,handlers:r,getTarget:s,createContext:a,destroy:c})=>{const l=Lr(t),h=Fn({registry:l,handlers:r});return{registry:Lr(l.list().map(o=>{const S=h.handlersByRendererId.get(o.id);return S?{...o,load:Ki({handler:S,getTarget:s,createContext:a,destroy:c})}:o})),dispatcher:h,missingRendererIds:h.missingRendererIds}}})),qs=xr({default:()=>Ws});async function Ws(t,r,s){const a=await aa(t,s);let c=1,l=0;const h=En(),o=document.createElement("div");o.className="image-viewer",o.dataset.viewerZoomProvider="image";const S=document.createElement("div");S.className="image-stage";const D=document.createElement("img");D.alt="图片",D.src=a,S.append(D),o.append(S);const U=sa(a),M=()=>U.open();D.addEventListener("click",M),document.body.append(U.element);const _=()=>{l=o.clientHeight||0,Ln(D,l,c),h.emit()},x=new ResizeObserver(_);x.observe(o);const I=()=>({scale:c,label:`${Math.round(c*100)}%`,canZoomIn:c<5,canZoomOut:c>.1,canReset:c!==1,minScale:.1,maxScale:5}),H=ee=>(c=oa(ee),Ln(D,l,c),h.emit(),I());return _n(o,{zoomIn:()=>H(c+.15),zoomOut:()=>H(c-.15),resetZoom:()=>H(1),setZoom:H,getState:I,subscribe:h.subscribe}),r.replaceChildren(ra(),o),_(),{$el:r,unmount(){Sn(o),x.disconnect(),D.removeEventListener("click",M),U.destroy(),r.replaceChildren()}}}var ea,ta,ra,na,ia,aa,oa,Ln,sa,$s=Ze((()=>{pr(),An(),ea={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",heic:"image/heic",heif:"image/heif",ico:"image/x-icon",jxl:"image/jxl",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp"},ta=`
|
|
2
|
+
.image-viewer{position:relative;width:100%;height:100%;overflow:auto;background:#eef1f4;box-sizing:border-box}
|
|
3
|
+
.image-stage{min-width:100%;min-height:100%;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box}
|
|
4
|
+
.image-stage img{display:block;width:auto;max-width:none;margin:0 auto;border:0;box-shadow:0 18px 48px rgba(15,23,42,.16);background:#fff;cursor:zoom-in}
|
|
5
|
+
.image-lightbox{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:40px;background:rgba(15,23,42,.88);box-sizing:border-box}
|
|
6
|
+
.image-lightbox[hidden]{display:none}
|
|
7
|
+
.image-lightbox img{display:block;max-width:100%;max-height:100%;object-fit:contain;background:#fff;box-shadow:0 30px 80px rgba(0,0,0,.4);cursor:zoom-out}
|
|
8
|
+
.image-lightbox button{position:absolute;top:20px;right:20px;width:40px;height:40px;border:0;border-radius:999px;background:rgba(255,255,255,.92);color:#172033;font-size:24px;line-height:40px;cursor:pointer;box-shadow:0 12px 28px rgba(0,0,0,.18)}
|
|
9
|
+
.file-viewer[data-viewer-theme='dark'] .image-viewer{background:#101820}
|
|
10
|
+
@media (prefers-color-scheme:dark){.file-viewer[data-viewer-theme='system'] .image-viewer{background:#101820}}
|
|
11
|
+
@media (max-width:767px){.image-stage{padding:12px}.image-lightbox{padding:16px}.image-lightbox button{top:12px;right:12px}}
|
|
12
|
+
`,ra=()=>{const t=document.createElement("style");return t.textContent=ta,t},na=t=>ea[(t||"").trim().toLowerCase()]||"image/*",ia=async t=>await new Promise((r,s)=>{const a=new FileReader;a.onload=c=>{var l;const h=(l=c.target)===null||l===void 0?void 0:l.result;if(typeof h=="string"){r(h);return}s(new Error("Unable to read image data URL."))},a.onerror=()=>s(a.error||new Error("Unable to read image data URL.")),a.readAsDataURL(t)}),aa=async(t,r)=>{const s=(r||"").trim().toLowerCase();if(s==="heic"||s==="heif")throw new Error("HEIC/HEIF image conversion has moved out of @file-viewer/core. Install and pass @file-viewer/renderer-image, or use @file-viewer/preset-all.");return ia(new Blob([t],{type:na(s)}))},oa=t=>Math.min(5,Math.max(.1,Number(t.toFixed(2)))),Ln=(t,r,s)=>{if(r>0){t.style.height=`${Math.max(1,Math.round(r*s))}px`;return}t.style.height=`${s*100}%`},sa=t=>{const r=document.createElement("div");r.className="image-lightbox",r.hidden=!0,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true");const s=document.createElement("img");s.alt="Preview image",s.src=t;const a=document.createElement("button");a.type="button",a.setAttribute("aria-label","Close image preview"),a.textContent="x";const c=()=>{r.hidden=!0};return a.addEventListener("click",c),s.addEventListener("click",c),r.addEventListener("click",l=>{l.target===r&&c()}),r.append(s,a),{element:r,open(){r.hidden=!1},destroy(){a.removeEventListener("click",c),s.removeEventListener("click",c),r.remove()}}}})),la,zr,Mn,ua,ca,fa,da,ha,pa,jr,Zs,Ys,Xs,va=Ze((()=>{zt(),Un(),Dn(),Rr(),la=t=>({$el:t,unmount(){}}),zr=[{rendererId:"image",handler:async(t,r,s)=>{const{default:a}=await Promise.resolve().then(()=>($s(),qs));return a(t,r,s)}}],Mn=["image"],ua=zr.filter(t=>Mn.includes(t.rendererId)),ca=At.filter(t=>Mn.includes(t.id)),fa=t=>t==="none"?[]:t==="lite"?ca:At,da=t=>t==="none"?[]:t==="lite"?ua:zr,ha=async(t,r,s)=>{const a=Yi(s),c=document.createElement("div");c.style.textAlign="center",c.style.marginTop="80px";const l=document.createElement("div");if(l.textContent=a.message,c.appendChild(l),a.description){const h=document.createElement("div");h.textContent=a.description,c.appendChild(h)}return r.replaceChildren(c),la(r)},pa=(t={})=>{const r=t.builtinRenderers||"all",s=Qi({definitions:fa(r),handlers:da(r)});return{...s,dispatcher:Fn({registry:s.registry,handlers:zr,fallbackHandler:ha})}},jr=pa(),Zs=jr.registry,Ys=jr.dispatcher,Xs=jr.missingRendererIds})),Js=Ze((()=>{Qt()})),Ks=Ze((()=>{vr(),Nr()})),Qs=Ze((()=>{vr()})),el=Ze((()=>{xi(),An(),Pn(),Cn(),vr(),Mr(),Un(),va(),Nr(),Rr()})),Rn=Ze((()=>{Oi(),zt(),Bi(),xi(),An(),pr(),Pn(),Qt(),Mr(),va(),Cn(),vr(),Js(),Ks(),Qs(),Dn(),Un(),Ur(),Rr(),Nr(),el()}));function mr(t){"@babel/helpers - typeof";return mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mr(t)}var ma=Ze((()=>{}));function tl(t,r){if(mr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,r||"default");if(mr(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var rl=Ze((()=>{ma()}));function nl(t){var r=tl(t,"string");return mr(r)=="symbol"?r:r+""}var il=Ze((()=>{ma(),rl()}));function jt(t,r,s){return(r=nl(r))in t?Object.defineProperty(t,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[r]=s,t}var al=Ze((()=>{il()})),ol=je(((t,r)=>{al();var s=void 0,a=function(c){return s||(s=new Promise(function(l,h){var o=typeof c<"u"?c:{},S=o.onAbort;o.onAbort=function(b){h(new Error(b)),S&&S(b)},o.postRun=o.postRun||[],o.postRun.push(function(){l(o)}),r=void 0;var D;D||(D=typeof o<"u"?o:{});var U=!!globalThis.window,M=!!globalThis.WorkerGlobalScope;D.onRuntimeInitialized=function(){function b(Fe,Ve){switch(typeof Ve){case"boolean":uf(Fe,Ve?1:0);break;case"number":of(Fe,Ve);break;case"string":sf(Fe,Ve,-1,-1);break;case"object":if(Ve===null)Es(Fe);else if(Ve.length!=null){var We=cn(Ve.length);V.set(Ve,We),lf(Fe,We,Ve.length,-1),Or(We)}else pn(Fe,"Wrong API use : tried to return a value of an unknown type ("+Ve+").",-1);break;default:Es(Fe)}}function B(Fe,Ve){for(var We=[],Ye=0;Ye<Fe;Ye+=1){var tt=Ee(Ve+4*Ye,"i32"),nt=ef(tt);if(nt===1||nt===2)tt=af(tt);else if(nt===3)tt=rf(tt);else if(nt===4){nt=tt,tt=tf(nt),nt=nf(nt);for(var bt=new Uint8Array(tt),yt=0;yt<tt;yt+=1)bt[yt]=V[nt+yt];tt=bt}else tt=null;We.push(tt)}return We}function q(Fe,Ve){this.Qa=Fe,this.db=Ve,this.Oa=1,this.yb=[]}function de(Fe,Ve){if(this.db=Ve,this.ob=un(Fe),this.ob===null)throw Error("Unable to allocate memory for the SQL string");this.ub=this.ob,this.gb=this.Fb=null}function Ae(Fe){if(this.filename="dbfile_"+(4294967295*Math.random()>>>0),Fe!=null){var Ve=this.filename,We="/",Ye=Ve;if(We&&(We=typeof We=="string"?We:He(We),Ye=Ve?Ge(We+"/"+Ve):We),Ve=w(!0,!0),Ye=st(Ye,Ve),Fe){if(typeof Fe=="string"){We=Array(Fe.length);for(var tt=0,nt=Fe.length;tt<nt;++tt)We[tt]=Fe.charCodeAt(tt);Fe=We}Lt(Ye,Ve|146),We=wt(Ye,577),cs(We,Fe,0,Fe.length,0),hr(We),Lt(Ye,Ve)}}this.handleError(Je(this.filename,Oe)),this.db=Ee(Oe,"i32"),Is(this.db),this.pb={},this.Sa={}}var Oe=Jt(4),ze=D.cwrap,Je=ze("sqlite3_open","number",["string","number"]),lt=ze("sqlite3_close_v2","number",["number"]),et=ze("sqlite3_exec","number",["number","string","number","number","number"]),ft=ze("sqlite3_changes","number",["number"]),vt=ze("sqlite3_prepare_v2","number",["number","string","number","number","number"]),ys=ze("sqlite3_sql","string",["number"]),Mc=ze("sqlite3_normalized_sql","string",["number"]),ws=ze("sqlite3_prepare_v2","number",["number","number","number","number","number"]),Rc=ze("sqlite3_bind_text","number",["number","number","number","number","number"]),bs=ze("sqlite3_bind_blob","number",["number","number","number","number","number"]),Nc=ze("sqlite3_bind_double","number",["number","number","number"]),zc=ze("sqlite3_bind_int","number",["number","number","number"]),jc=ze("sqlite3_bind_parameter_index","number",["number","string"]),Vc=ze("sqlite3_step","number",["number"]),Gc=ze("sqlite3_errmsg","string",["number"]),Hc=ze("sqlite3_column_count","number",["number"]),qc=ze("sqlite3_data_count","number",["number"]),Wc=ze("sqlite3_column_double","number",["number","number"]),_s=ze("sqlite3_column_text","string",["number","number"]),$c=ze("sqlite3_column_blob","number",["number","number"]),Zc=ze("sqlite3_column_bytes","number",["number","number"]),Yc=ze("sqlite3_column_type","number",["number","number"]),Xc=ze("sqlite3_column_name","string",["number","number"]),Jc=ze("sqlite3_reset","number",["number"]),Kc=ze("sqlite3_clear_bindings","number",["number"]),Qc=ze("sqlite3_finalize","number",["number"]),Ss=ze("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),ef=ze("sqlite3_value_type","number",["number"]),tf=ze("sqlite3_value_bytes","number",["number"]),rf=ze("sqlite3_value_text","string",["number"]),nf=ze("sqlite3_value_blob","number",["number"]),af=ze("sqlite3_value_double","number",["number"]),of=ze("sqlite3_result_double","",["number","number"]),Es=ze("sqlite3_result_null","",["number"]),sf=ze("sqlite3_result_text","",["number","string","number","number"]),lf=ze("sqlite3_result_blob","",["number","number","number","number"]),uf=ze("sqlite3_result_int","",["number","number"]),pn=ze("sqlite3_result_error","",["number","string","number"]),As=ze("sqlite3_aggregate_context","number",["number","number"]),Is=ze("RegisterExtensionFunctions","number",["number"]),ks=ze("sqlite3_update_hook","number",["number","number","number"]);q.prototype.bind=function(Fe){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(Fe)?this.Wb(Fe):Fe!=null&&typeof Fe=="object"?this.Xb(Fe):!0},q.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var Fe=Vc(this.Qa);switch(Fe){case 100:return!0;case 101:return!1;default:throw this.db.handleError(Fe)}},q.prototype.Pb=function(Fe){return Fe??(Fe=this.Oa,this.Oa+=1),Wc(this.Qa,Fe)},q.prototype.hc=function(Fe){if(Fe??(Fe=this.Oa,this.Oa+=1),Fe=_s(this.Qa,Fe),typeof BigInt!="function")throw Error("BigInt is not supported");return BigInt(Fe)},q.prototype.mc=function(Fe){return Fe??(Fe=this.Oa,this.Oa+=1),_s(this.Qa,Fe)},q.prototype.getBlob=function(Fe){Fe??(Fe=this.Oa,this.Oa+=1);var Ve=Zc(this.Qa,Fe);Fe=$c(this.Qa,Fe);for(var We=new Uint8Array(Ve),Ye=0;Ye<Ve;Ye+=1)We[Ye]=V[Fe+Ye];return We},q.prototype.get=function(Fe,Ve){Ve=Ve||{},Fe!=null&&this.bind(Fe)&&this.step(),Fe=[];for(var We=qc(this.Qa),Ye=0;Ye<We;Ye+=1)switch(Yc(this.Qa,Ye)){case 1:var tt=Ve.useBigInt?this.hc(Ye):this.Pb(Ye);Fe.push(tt);break;case 2:Fe.push(this.Pb(Ye));break;case 3:Fe.push(this.mc(Ye));break;case 4:Fe.push(this.getBlob(Ye));break;default:Fe.push(null)}return Fe},q.prototype.Db=function(){for(var Fe=[],Ve=Hc(this.Qa),We=0;We<Ve;We+=1)Fe.push(Xc(this.Qa,We));return Fe},q.prototype.Ob=function(Fe,Ve){Fe=this.get(Fe,Ve),Ve=this.Db();for(var We={},Ye=0;Ye<Ve.length;Ye+=1)We[Ve[Ye]]=Fe[Ye];return We},q.prototype.lc=function(){return ys(this.Qa)},q.prototype.ic=function(){return Mc(this.Qa)},q.prototype.Jb=function(Fe){return Fe!=null&&this.bind(Fe),this.step(),this.reset()},q.prototype.Lb=function(Fe,Ve){Ve??(Ve=this.Oa,this.Oa+=1),Fe=un(Fe),this.yb.push(Fe),this.db.handleError(Rc(this.Qa,Ve,Fe,-1,0))},q.prototype.Vb=function(Fe,Ve){Ve??(Ve=this.Oa,this.Oa+=1);var We=cn(Fe.length);V.set(Fe,We),this.yb.push(We),this.db.handleError(bs(this.Qa,Ve,We,Fe.length,0))},q.prototype.Kb=function(Fe,Ve){Ve??(Ve=this.Oa,this.Oa+=1),this.db.handleError((Fe===(Fe|0)?zc:Nc)(this.Qa,Ve,Fe))},q.prototype.Yb=function(Fe){Fe??(Fe=this.Oa,this.Oa+=1),bs(this.Qa,Fe,0,0,0)},q.prototype.Mb=function(Fe,Ve){switch(Ve??(Ve=this.Oa,this.Oa+=1),typeof Fe){case"string":this.Lb(Fe,Ve);return;case"number":this.Kb(Fe,Ve);return;case"bigint":this.Lb(Fe.toString(),Ve);return;case"boolean":this.Kb(Fe+0,Ve);return;case"object":if(Fe===null){this.Yb(Ve);return}if(Fe.length!=null){this.Vb(Fe,Ve);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+Fe+")."},q.prototype.Xb=function(Fe){var Ve=this;return Object.keys(Fe).forEach(function(We){var Ye=jc(Ve.Qa,We);Ye!==0&&Ve.Mb(Fe[We],Ye)}),!0},q.prototype.Wb=function(Fe){for(var Ve=0;Ve<Fe.length;Ve+=1)this.Mb(Fe[Ve],Ve+1);return!0},q.prototype.reset=function(){return this.Cb(),Kc(this.Qa)===0&&Jc(this.Qa)===0},q.prototype.Cb=function(){for(var Fe;(Fe=this.yb.pop())!==void 0;)Or(Fe)},q.prototype.cb=function(){this.Cb();var Fe=Qc(this.Qa)===0;return delete this.db.pb[this.Qa],this.Qa=0,Fe},de.prototype.next=function(){if(this.ob===null)return{done:!0};if(this.gb!==null&&(this.gb.cb(),this.gb=null),!this.db.db)throw this.Ab(),Error("Database closed");var Fe=dn(),Ve=Jt(4);De(Oe),De(Ve);try{this.db.handleError(ws(this.db.db,this.ub,-1,Oe,Ve)),this.ub=Ee(Ve,"i32");var We=Ee(Oe,"i32");return We===0?(this.Ab(),{done:!0}):(this.gb=new q(We,this.db),this.db.pb[We]=this.gb,{value:this.gb,done:!1})}catch(Ye){throw this.Fb=Me(this.ub),this.Ab(),Ye}finally{fn(Fe)}},de.prototype.Ab=function(){Or(this.ob),this.ob=null},de.prototype.jc=function(){return this.Fb!==null?this.Fb:Me(this.ub)},typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"&&(de.prototype[Symbol.iterator]=function(){return this}),Ae.prototype.Jb=function(Fe,Ve){if(!this.db)throw"Database closed";if(Ve){Fe=this.Gb(Fe,Ve);try{Fe.step()}finally{Fe.cb()}}else this.handleError(et(this.db,Fe,0,0,Oe));return this},Ae.prototype.exec=function(Fe,Ve,We){if(!this.db)throw"Database closed";var Ye=null,tt=null,nt=null;try{nt=tt=un(Fe);var bt=Jt(4);for(Fe=[];Ee(nt,"i8")!==0;){De(Oe),De(bt),this.handleError(ws(this.db,nt,-1,Oe,bt));var yt=Ee(Oe,"i32");if(nt=Ee(bt,"i32"),yt!==0){var mt=null;for(Ye=new q(yt,this),Ve!=null&&Ye.bind(Ve);Ye.step();)mt===null&&(mt={columns:Ye.Db(),values:[]},Fe.push(mt)),mt.values.push(Ye.get(null,We));Ye.cb()}}return Fe}catch(_t){throw Ye&&Ye.cb(),_t}finally{tt&&Or(tt)}},Ae.prototype.ec=function(Fe,Ve,We,Ye,tt){typeof Ve=="function"&&(Ye=We,We=Ve,Ve=void 0),Fe=this.Gb(Fe,Ve);try{for(;Fe.step();)We(Fe.Ob(null,tt))}finally{Fe.cb()}if(typeof Ye=="function")return Ye()},Ae.prototype.Gb=function(Fe,Ve){if(De(Oe),this.handleError(vt(this.db,Fe,-1,Oe,0)),Fe=Ee(Oe,"i32"),Fe===0)throw"Nothing to prepare";var We=new q(Fe,this);return Ve!=null&&We.bind(Ve),this.pb[Fe]=We},Ae.prototype.pc=function(Fe){return new de(Fe,this)},Ae.prototype.fc=function(){Object.values(this.pb).forEach(function(Ve){Ve.cb()}),Object.values(this.Sa).forEach(Rt),this.Sa={},this.handleError(lt(this.db));var Fe=Dc(this.filename);return this.handleError(Je(this.filename,Oe)),this.db=Ee(Oe,"i32"),Is(this.db),Fe},Ae.prototype.close=function(){this.db!==null&&(Object.values(this.pb).forEach(function(Fe){Fe.cb()}),Object.values(this.Sa).forEach(Rt),this.Sa={},this.fb&&(Rt(this.fb),this.fb=void 0),this.handleError(lt(this.db)),Ut("/"+this.filename),this.db=null)},Ae.prototype.handleError=function(Fe){if(Fe===0)return null;throw Fe=Gc(this.db),Error(Fe)},Ae.prototype.kc=function(){return ft(this.db)},Ae.prototype.bc=function(Fe,Ve){Object.prototype.hasOwnProperty.call(this.Sa,Fe)&&(Rt(this.Sa[Fe]),delete this.Sa[Fe]);var We=Cr(function(Ye,tt,nt){tt=B(tt,nt);try{var bt=Ve.apply(null,tt)}catch(yt){pn(Ye,yt,-1);return}b(Ye,bt)},"viii");return this.Sa[Fe]=We,this.handleError(Ss(this.db,Fe,Ve.length,1,0,We,0,0,0)),this},Ae.prototype.ac=function(Fe,Ve){var We=Ve.init||function(){return null},Ye=Ve.finalize||function(mt){return mt},tt=Ve.step;if(!tt)throw"An aggregate function must have a step function in "+Fe;var nt={};Object.hasOwnProperty.call(this.Sa,Fe)&&(Rt(this.Sa[Fe]),delete this.Sa[Fe]),Ve=Fe+"__finalize",Object.hasOwnProperty.call(this.Sa,Ve)&&(Rt(this.Sa[Ve]),delete this.Sa[Ve]);var bt=Cr(function(mt,_t,Ti){var Kt=As(mt,1);Object.hasOwnProperty.call(nt,Kt)||(nt[Kt]=We()),_t=B(_t,Ti),_t=[nt[Kt]].concat(_t);try{nt[Kt]=tt.apply(null,_t)}catch(cf){delete nt[Kt],pn(mt,cf,-1)}},"viii"),yt=Cr(function(mt){var _t=As(mt,1);try{var Ti=Ye(nt[_t])}catch(Kt){delete nt[_t],pn(mt,Kt,-1);return}b(mt,Ti),delete nt[_t]},"vi");return this.Sa[Fe]=bt,this.Sa[Ve]=yt,this.handleError(Ss(this.db,Fe,tt.length-1,1,0,0,bt,yt,0)),this},Ae.prototype.vc=function(Fe){return this.fb&&(ks(this.db,0,0),Rt(this.fb),this.fb=void 0),Fe?(this.fb=Cr(function(Ve,We,Ye,tt,nt){switch(We){case 18:Ve="insert";break;case 23:Ve="update";break;case 9:Ve="delete";break;default:throw"unknown operationCode in updateHook callback: "+We}if(Ye=Me(Ye),tt=Me(tt),nt>Number.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";Fe(Ve,Ye,tt,Number(nt))},"viiiij"),ks(this.db,this.fb,0),this):this},q.prototype.bind=q.prototype.bind,q.prototype.step=q.prototype.step,q.prototype.get=q.prototype.get,q.prototype.getColumnNames=q.prototype.Db,q.prototype.getAsObject=q.prototype.Ob,q.prototype.getSQL=q.prototype.lc,q.prototype.getNormalizedSQL=q.prototype.ic,q.prototype.run=q.prototype.Jb,q.prototype.reset=q.prototype.reset,q.prototype.freemem=q.prototype.Cb,q.prototype.free=q.prototype.cb,de.prototype.next=de.prototype.next,de.prototype.getRemainingSQL=de.prototype.jc,Ae.prototype.run=Ae.prototype.Jb,Ae.prototype.exec=Ae.prototype.exec,Ae.prototype.each=Ae.prototype.ec,Ae.prototype.prepare=Ae.prototype.Gb,Ae.prototype.iterateStatements=Ae.prototype.pc,Ae.prototype.export=Ae.prototype.fc,Ae.prototype.close=Ae.prototype.close,Ae.prototype.handleError=Ae.prototype.handleError,Ae.prototype.getRowsModified=Ae.prototype.kc,Ae.prototype.create_function=Ae.prototype.bc,Ae.prototype.create_aggregate=Ae.prototype.ac,Ae.prototype.updateHook=Ae.prototype.vc,D.Database=Ae};var _="./this.program",x=globalThis.document?.currentScript?.src;M&&(x=self.location.href);var I="",H,ee;if(U||M){try{I=new URL(".",x).href}catch{}M&&(ee=b=>{var B=new XMLHttpRequest;return B.open("GET",b,!1),B.responseType="arraybuffer",B.send(null),new Uint8Array(B.response)}),H=async b=>{if(b=await fetch(b,{credentials:"same-origin"}),b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url)}}var Z=console.log.bind(console),K=console.error.bind(console),W,X=!1,Q,V,te,J,G,$,ce,se,g;function L(){var b=hn.buffer;V=new Int8Array(b),J=new Int16Array(b),te=new Uint8Array(b),new Uint16Array(b),G=new Int32Array(b),$=new Uint32Array(b),ce=new Float32Array(b),se=new Float64Array(b),g=new BigInt64Array(b),new BigUint64Array(b)}function j(b){throw D.onAbort?.(b),b="Aborted("+b+")",K(b),X=!0,new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.")}var ne;async function z(b){if(!W)try{var B=await H(b);return new Uint8Array(B)}catch{}if(b==ne&&W)b=new Uint8Array(W);else if(ee)b=ee(b);else throw"both async and sync fetching of the wasm failed";return b}async function Y(b,B){try{var q=await z(b);return await WebAssembly.instantiate(q,B)}catch(de){K(`failed to asynchronously prepare wasm: ${de}`),j(de)}}async function ve(b){var B=ne;if(!W)try{var q=fetch(B,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(q,b)}catch(de){K(`wasm streaming compile failed: ${de}`),K("falling back to ArrayBuffer instantiation")}return Y(B,b)}class we{constructor(B){jt(this,"name","ExitStatus"),this.message=`Program terminated with exit(${B})`,this.status=B}}var _e=b=>{for(;0<b.length;)b.shift()(D)},ie=[],pe=[],fe=()=>{var b=D.preRun.shift();pe.push(b)},ge=0,ke=null;function Ee(b,B="i8"){switch(B.endsWith("*")&&(B="*"),B){case"i1":return V[b];case"i8":return V[b];case"i16":return J[b>>1];case"i32":return G[b>>2];case"i64":return g[b>>3];case"float":return ce[b>>2];case"double":return se[b>>3];case"*":return $[b>>2];default:j(`invalid type for getValue: ${B}`)}}var Ie=!0;function De(b){var B="i32";switch(B.endsWith("*")&&(B="*"),B){case"i1":V[b]=0;break;case"i8":V[b]=0;break;case"i16":J[b>>1]=0;break;case"i32":G[b>>2]=0;break;case"i64":g[b>>3]=BigInt(0);break;case"float":ce[b>>2]=0;break;case"double":se[b>>3]=0;break;case"*":$[b>>2]=0;break;default:j(`invalid type for setValue: ${B}`)}}var Ue=new TextDecoder,Ne=(b,B,q,de)=>{if(q=B+q,de)return q;for(;b[B]&&!(B>=q);)++B;return B},Me=(b,B,q)=>b?Ue.decode(te.subarray(b,Ne(te,b,B,q))):"",Ce=(b,B)=>{for(var q=0,de=b.length-1;0<=de;de--){var Ae=b[de];Ae==="."?b.splice(de,1):Ae===".."?(b.splice(de,1),q++):q&&(b.splice(de,1),q--)}if(B)for(;q;q--)b.unshift("..");return b},Ge=b=>{var B=b.charAt(0)==="/",q=b.slice(-1)==="/";return(b=Ce(b.split("/").filter(de=>!!de),!B).join("/"))||B||(b="."),b&&q&&(b+="/"),(B?"/":"")+b},qe=b=>{var B=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(b).slice(1);return b=B[0],B=B[1],!b&&!B?".":(B&&(B=B.slice(0,-1)),b+B)},ae=b=>b&&b.match(/([^\/]+|\/)\/*$/)[1],le=()=>b=>crypto.getRandomValues(b),p=b=>{(p=le())(b)},m=(...b)=>{for(var B="",q=!1,de=b.length-1;-1<=de&&!q;de--){if(q=0<=de?b[de]:"/",typeof q!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!q)return"";B=q+"/"+B,q=q.charAt(0)==="/"}return B=Ce(B.split("/").filter(Ae=>!!Ae),!q).join("/"),(q?"/":"")+B||"."},O=b=>{var B=Ne(b,0);return Ue.decode(b.buffer?b.subarray(0,B):new Uint8Array(b.slice(0,B)))},y=[],F=b=>{for(var B=0,q=0;q<b.length;++q){var de=b.charCodeAt(q);127>=de?B++:2047>=de?B+=2:55296<=de&&57343>=de?(B+=4,++q):B+=3}return B},e=(b,B,q,de)=>{if(!(0<de))return 0;var Ae=q;de=q+de-1;for(var Oe=0;Oe<b.length;++Oe){var ze=b.codePointAt(Oe);if(127>=ze){if(q>=de)break;B[q++]=ze}else if(2047>=ze){if(q+1>=de)break;B[q++]=192|ze>>6,B[q++]=128|ze&63}else if(65535>=ze){if(q+2>=de)break;B[q++]=224|ze>>12,B[q++]=128|ze>>6&63,B[q++]=128|ze&63}else{if(q+3>=de)break;B[q++]=240|ze>>18,B[q++]=128|ze>>12&63,B[q++]=128|ze>>6&63,B[q++]=128|ze&63,Oe++}}return B[q]=0,q-Ae},u=[];function f(b,B){u[b]={input:[],output:[],kb:B},ut(b,k)}var k={open(b){var B=u[b.node.nb];if(!B)throw new A(43);b.Va=B,b.seekable=!1},close(b){b.Va.kb.lb(b.Va)},lb(b){b.Va.kb.lb(b.Va)},read(b,B,q,de){if(!b.Va||!b.Va.kb.Qb)throw new A(60);for(var Ae=0,Oe=0;Oe<de;Oe++){try{var ze=b.Va.kb.Qb(b.Va)}catch{throw new A(29)}if(ze===void 0&&Ae===0)throw new A(6);if(ze==null)break;Ae++,B[q+Oe]=ze}return Ae&&(b.node.$a=Date.now()),Ae},write(b,B,q,de){if(!b.Va||!b.Va.kb.Hb)throw new A(60);try{for(var Ae=0;Ae<de;Ae++)b.Va.kb.Hb(b.Va,B[q+Ae])}catch{throw new A(29)}return de&&(b.node.Ua=b.node.Ta=Date.now()),Ae}},v={Qb(){e:{if(!y.length){var b=null;if(globalThis.window?.prompt&&(b=window.prompt("Input: "),b!==null&&(b+=`
|
|
13
|
+
`)),!b){var B=null;break e}B=Array(F(b)+1),b=e(b,B,0,B.length),B.length=b,y=B}B=y.shift()}return B},Hb(b,B){B===null||B===10?(Z(O(b.output)),b.output=[]):B!=0&&b.output.push(B)},lb(b){0<b.output?.length&&(Z(O(b.output)),b.output=[])},Dc(){return{yc:25856,Ac:5,xc:191,zc:35387,wc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Ec(){return 0},Fc(){return[24,80]}},i={Hb(b,B){B===null||B===10?(K(O(b.output)),b.output=[]):B!=0&&b.output.push(B)},lb(b){0<b.output?.length&&(K(O(b.output)),b.output=[])}},n={Za:null,ab(){return n.createNode(null,"/",16895,0)},createNode(b,B,q,de){if((q&61440)===24576||(q&61440)===4096)throw new A(63);return n.Za||(n.Za={dir:{node:{Wa:n.La.Wa,Xa:n.La.Xa,mb:n.La.mb,rb:n.La.rb,Tb:n.La.Tb,xb:n.La.xb,vb:n.La.vb,Ib:n.La.Ib,wb:n.La.wb},stream:{Ya:n.Ma.Ya}},file:{node:{Wa:n.La.Wa,Xa:n.La.Xa},stream:{Ya:n.Ma.Ya,read:n.Ma.read,write:n.Ma.write,sb:n.Ma.sb,tb:n.Ma.tb}},link:{node:{Wa:n.La.Wa,Xa:n.La.Xa,eb:n.La.eb},stream:{}},Nb:{node:{Wa:n.La.Wa,Xa:n.La.Xa},stream:rt}}),q=P(b,B,q,de),me(q.mode)?(q.La=n.Za.dir.node,q.Ma=n.Za.dir.stream,q.Na={}):(q.mode&61440)===32768?(q.La=n.Za.file.node,q.Ma=n.Za.file.stream,q.Ra=0,q.Na=null):(q.mode&61440)===40960?(q.La=n.Za.link.node,q.Ma=n.Za.link.stream):(q.mode&61440)===8192&&(q.La=n.Za.Nb.node,q.Ma=n.Za.Nb.stream),q.$a=q.Ua=q.Ta=Date.now(),b&&(b.Na[B]=q,b.$a=b.Ua=b.Ta=q.$a),q},Cc(b){return b.Na?b.Na.subarray?b.Na.subarray(0,b.Ra):new Uint8Array(b.Na):new Uint8Array(0)},La:{Wa(b){var B={};return B.cc=(b.mode&61440)===8192?b.id:1,B.oc=b.id,B.mode=b.mode,B.rc=1,B.uid=0,B.nc=0,B.nb=b.nb,me(b.mode)?B.size=4096:(b.mode&61440)===32768?B.size=b.Ra:(b.mode&61440)===40960?B.size=b.link.length:B.size=0,B.$a=new Date(b.$a),B.Ua=new Date(b.Ua),B.Ta=new Date(b.Ta),B.Zb=4096,B.$b=Math.ceil(B.size/B.Zb),B},Xa(b,B){for(var q of["mode","atime","mtime","ctime"])B[q]!=null&&(b[q]=B[q]);B.size!==void 0&&(B=B.size,b.Ra!=B&&(B==0?(b.Na=null,b.Ra=0):(q=b.Na,b.Na=new Uint8Array(B),q&&b.Na.set(q.subarray(0,Math.min(B,b.Ra))),b.Ra=B)))},mb(){throw n.zb||(n.zb=new A(44),n.zb.stack="<generic error, no stack>"),n.zb},rb(b,B,q,de){return n.createNode(b,B,q,de)},Tb(b,B,q){try{var de=N(B,q)}catch{}if(de){if(me(b.mode))for(var Ae in de.Na)throw new A(55);d(de)}delete b.parent.Na[b.name],B.Na[q]=b,b.name=q,B.Ta=B.Ua=b.parent.Ta=b.parent.Ua=Date.now()},xb(b,B){delete b.Na[B],b.Ta=b.Ua=Date.now()},vb(b,B){var q=N(b,B),de;for(de in q.Na)throw new A(55);delete b.Na[B],b.Ta=b.Ua=Date.now()},Ib(b){return[".","..",...Object.keys(b.Na)]},wb(b,B,q){return b=n.createNode(b,B,41471,0),b.link=q,b},eb(b){if((b.mode&61440)!==40960)throw new A(28);return b.link}},Ma:{read(b,B,q,de,Ae){var Oe=b.node.Na;if(Ae>=b.node.Ra)return 0;if(b=Math.min(b.node.Ra-Ae,de),8<b&&Oe.subarray)B.set(Oe.subarray(Ae,Ae+b),q);else for(de=0;de<b;de++)B[q+de]=Oe[Ae+de];return b},write(b,B,q,de,Ae,Oe){if(B.buffer===V.buffer&&(Oe=!1),!de)return 0;if(b=b.node,b.Ua=b.Ta=Date.now(),B.subarray&&(!b.Na||b.Na.subarray)){if(Oe)return b.Na=B.subarray(q,q+de),b.Ra=de;if(b.Ra===0&&Ae===0)return b.Na=B.slice(q,q+de),b.Ra=de;if(Ae+de<=b.Ra)return b.Na.set(B.subarray(q,q+de),Ae),de}Oe=Ae+de;var ze=b.Na?b.Na.length:0;if(ze>=Oe||(Oe=Math.max(Oe,ze*(1048576>ze?2:1.125)>>>0),ze!=0&&(Oe=Math.max(Oe,256)),ze=b.Na,b.Na=new Uint8Array(Oe),0<b.Ra&&b.Na.set(ze.subarray(0,b.Ra),0)),b.Na.subarray&&B.subarray)b.Na.set(B.subarray(q,q+de),Ae);else for(Oe=0;Oe<de;Oe++)b.Na[Ae+Oe]=B[q+Oe];return b.Ra=Math.max(b.Ra,Ae+de),de},Ya(b,B,q){if(q===1?B+=b.position:q===2&&(b.node.mode&61440)===32768&&(B+=b.node.Ra),0>B)throw new A(28);return B},sb(b,B,q,de,Ae){if((b.node.mode&61440)!==32768)throw new A(43);if(b=b.node.Na,Ae&2||!b||b.buffer!==V.buffer){Ae=!0,de=65536*Math.ceil(B/65536);var Oe=ms(65536,de);if(Oe&&te.fill(0,Oe,Oe+de),de=Oe,!de)throw new A(48);b&&((0<q||q+B<b.length)&&(b.subarray?b=b.subarray(q,q+B):b=Array.prototype.slice.call(b,q,q+B)),V.set(b,de))}else Ae=!1,de=b.byteOffset;return{tc:de,Ub:Ae}},tb(b,B,q,de){return n.Ma.write(b,B,0,de,q,!1),0}}},w=(b,B)=>{var q=0;return b&&(q|=365),B&&(q|=146),q},E=null,C={},R=[],oe=1,ue=null,re=!1,he=!0,A=class{constructor(b){jt(this,"name","ErrnoError"),this.Pa=b}},Se=class{constructor(){jt(this,"qb",{}),jt(this,"node",null)}get flags(){return this.qb.flags}set flags(b){this.qb.flags=b}get position(){return this.qb.position}set position(b){this.qb.position=b}},Pe=class{constructor(b,B,q,de){jt(this,"La",{}),jt(this,"Ma",{}),jt(this,"ib",null),b||(b=this),this.parent=b,this.ab=b.ab,this.id=oe++,this.name=B,this.mode=q,this.nb=de,this.$a=this.Ua=this.Ta=Date.now()}get read(){return(this.mode&365)===365}set read(b){b?this.mode|=365:this.mode&=-366}get write(){return(this.mode&146)===146}set write(b){b?this.mode|=146:this.mode&=-147}};function Te(b,B={}){if(!b)throw new A(44);B.Bb??(B.Bb=!0),b.charAt(0)==="/"||(b="//"+b);var q=0;e:for(;40>q;q++){b=b.split("/").filter(Je=>!!Je);for(var de=E,Ae="/",Oe=0;Oe<b.length;Oe++){var ze=Oe===b.length-1;if(ze&&B.parent)break;if(b[Oe]!==".")if(b[Oe]==="..")if(Ae=qe(Ae),de===de.parent){b=Ae+"/"+b.slice(Oe+1).join("/"),q--;continue e}else de=de.parent;else{Ae=Ge(Ae+"/"+b[Oe]);try{de=N(de,b[Oe])}catch(Je){if(Je?.Pa===44&&ze&&B.sc)return{path:Ae};throw Je}if(!de.ib||ze&&!B.Bb||(de=de.ib.root),(de.mode&61440)===40960&&(!ze||B.hb)){if(!de.La.eb)throw new A(52);de=de.La.eb(de),de.charAt(0)==="/"||(de=qe(Ae)+"/"+de),b=de+"/"+b.slice(Oe+1).join("/");continue e}}}return{path:Ae,node:de}}throw new A(32)}function He(b){for(var B;;){if(b===b.parent)return b=b.ab.Sb,B?b[b.length-1]!=="/"?`${b}/${B}`:b+B:b;B=B?`${b.name}/${B}`:b.name,b=b.parent}}function T(b,B){for(var q=0,de=0;de<B.length;de++)q=(q<<5)-q+B.charCodeAt(de)|0;return(b+q>>>0)%ue.length}function d(b){var B=T(b.parent.id,b.name);if(ue[B]===b)ue[B]=b.jb;else for(B=ue[B];B;){if(B.jb===b){B.jb=b.jb;break}B=B.jb}}function N(b,B){var q=me(b.mode)?(q=be(b,"x"))?q:b.La.mb?0:2:54;if(q)throw new A(q);for(q=ue[T(b.id,B)];q;q=q.jb){var de=q.name;if(q.parent.id===b.id&&de===B)return q}return b.La.mb(b,B)}function P(b,B,q,de){return b=new Pe(b,B,q,de),B=T(b.parent.id,b.name),b.jb=ue[B],ue[B]=b}function me(b){return(b&61440)===16384}function be(b,B){return he?0:B.includes("r")&&!(b.mode&292)||B.includes("w")&&!(b.mode&146)||B.includes("x")&&!(b.mode&73)?2:0}function ye(b,B){if(!me(b.mode))return 54;try{return N(b,B),20}catch{}return be(b,"wx")}function xe(b,B,q){try{var de=N(b,B)}catch(Ae){return Ae.Pa}if(b=be(b,"wx"))return b;if(q){if(!me(de.mode))return 54;if(de===de.parent||He(de)==="/")return 10}else if(me(de.mode))return 31;return 0}function Re(b){if(!b)throw new A(63);return b}function Be(b){if(b=R[b],!b)throw new A(8);return b}function Le(b,B=-1){if(b=Object.assign(new Se,b),B==-1)e:{for(B=0;4096>=B;B++)if(!R[B])break e;throw new A(33)}return b.bb=B,R[B]=b}function $e(b,B=-1){return b=Le(b,B),b.Ma?.Bc?.(b),b}function Ke(b,B,q){var de=b?.Ma.Xa;b=de?b:B,de??(de=B.La.Xa),Re(de),de(b,q)}var rt={open(b){b.Ma=C[b.node.nb].Ma,b.Ma.open?.(b)},Ya(){throw new A(70)}};function ut(b,B){C[b]={Ma:B}}function at(b,B){var q=B==="/";if(q&&E)throw new A(10);if(!q&&B){var de=Te(B,{Bb:!1});if(B=de.path,de=de.node,de.ib)throw new A(10);if(!me(de.mode))throw new A(54)}B={type:b,Gc:{},Sb:B,qc:[]},b=b.ab(B),b.ab=B,B.root=b,q?E=b:de&&(de.ib=B,de.ab&&de.ab.qc.push(B))}function Qe(b,B,q){var de=Te(b,{parent:!0}).node;if(b=ae(b),!b)throw new A(28);if(b==="."||b==="..")throw new A(20);var Ae=ye(de,b);if(Ae)throw new A(Ae);if(!de.La.rb)throw new A(63);return de.La.rb(de,b,B,q)}function st(b,B=438){return Qe(b,B&4095|32768,0)}function Xe(b,B=511){return Qe(b,B&1023|16384,0)}function ht(b,B,q){typeof q>"u"&&(q=B,B=438),Qe(b,B|8192,q)}function ot(b,B){if(!m(b))throw new A(44);var q=Te(B,{parent:!0}).node;if(!q)throw new A(44);B=ae(B);var de=ye(q,B);if(de)throw new A(de);if(!q.La.wb)throw new A(63);q.La.wb(q,B,b)}function It(b){var B=Te(b,{parent:!0}).node;b=ae(b);var q=N(B,b),de=xe(B,b,!0);if(de)throw new A(de);if(!B.La.vb)throw new A(63);if(q.ib)throw new A(10);B.La.vb(B,b),d(q)}function Ut(b){var B=Te(b,{parent:!0}).node;if(!B)throw new A(44);b=ae(b);var q=N(B,b),de=xe(B,b,!1);if(de)throw new A(de);if(!B.La.xb)throw new A(63);if(q.ib)throw new A(10);B.La.xb(B,b),d(q)}function Et(b,B){return b=Te(b,{hb:!B}).node,Re(b.La.Wa)(b)}function Zt(b,B,q,de){Ke(b,B,{mode:q&4095|B.mode&-4096,Ta:Date.now(),dc:de})}function Lt(b,B){b=typeof b=="string"?Te(b,{hb:!0}).node:b,Zt(null,b,B)}function dr(b,B,q){if(me(B.mode))throw new A(31);if((B.mode&61440)!==32768)throw new A(28);var de=be(B,"w");if(de)throw new A(de);Ke(b,B,{size:q,timestamp:Date.now()})}function wt(b,B,q=438){if(b==="")throw new A(44);if(typeof B=="string"){var de={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[B];if(typeof de>"u")throw Error(`Unknown file open mode: ${B}`);B=de}if(q=B&64?q&4095|32768:0,typeof b=="object")de=b;else{var Ae=b.endsWith("/"),Oe=Te(b,{hb:!(B&131072),sc:!0});de=Oe.node,b=Oe.path}if(Oe=!1,B&64)if(de){if(B&128)throw new A(20)}else{if(Ae)throw new A(31);de=Qe(b,q|511,0),Oe=!0}if(!de)throw new A(44);if((de.mode&61440)===8192&&(B&=-513),B&65536&&!me(de.mode))throw new A(54);if(!Oe&&(de?(de.mode&61440)===40960?Ae=32:(Ae=["r","w","rw"][B&3],B&512&&(Ae+="w"),Ae=me(de.mode)&&(Ae!=="r"||B&576)?31:be(de,Ae)):Ae=44,Ae))throw new A(Ae);return B&512&&!Oe&&(Ae=de,Ae=typeof Ae=="string"?Te(Ae,{hb:!0}).node:Ae,dr(null,Ae,0)),B=Le({node:de,path:He(de),flags:B&-131713,seekable:!0,position:0,Ma:de.Ma,uc:[],error:!1}),B.Ma.open&&B.Ma.open(B),Oe&&Lt(de,q&511),B}function hr(b){if(b.bb===null)throw new A(8);b.Eb&&(b.Eb=null);try{b.Ma.close&&b.Ma.close(b)}catch(B){throw B}finally{R[b.bb]=null}b.bb=null}function ls(b,B,q){if(b.bb===null)throw new A(8);if(!b.seekable||!b.Ma.Ya)throw new A(70);if(q!=0&&q!=1&&q!=2)throw new A(28);b.position=b.Ma.Ya(b,B,q),b.uc=[]}function us(b,B,q,de,Ae){if(0>de||0>Ae)throw new A(28);if(b.bb===null)throw new A(8);if((b.flags&2097155)===1)throw new A(8);if(me(b.node.mode))throw new A(31);if(!b.Ma.read)throw new A(28);var Oe=typeof Ae<"u";if(!Oe)Ae=b.position;else if(!b.seekable)throw new A(70);return B=b.Ma.read(b,B,q,de,Ae),Oe||(b.position+=B),B}function cs(b,B,q,de,Ae){if(0>de||0>Ae)throw new A(28);if(b.bb===null)throw new A(8);if((b.flags&2097155)===0)throw new A(8);if(me(b.node.mode))throw new A(31);if(!b.Ma.write)throw new A(28);b.seekable&&b.flags&1024&&ls(b,0,2);var Oe=typeof Ae<"u";if(!Oe)Ae=b.position;else if(!b.seekable)throw new A(70);return B=b.Ma.write(b,B,q,de,Ae,void 0),Oe||(b.position+=B),B}function Dc(b){var B=B||0,q="binary";q!=="utf8"&&q!=="binary"&&j(`Invalid encoding type "${q}"`),B=wt(b,B),b=Et(b).size;var de=new Uint8Array(b);return us(B,de,0,b,0),q==="utf8"&&(de=O(de)),hr(B),de}function Mt(b,B,q){b=Ge("/dev/"+b);var de=w(!!B,!!q);Mt.Rb??(Mt.Rb=64);var Ae=Mt.Rb++<<8|0;ut(Ae,{open(Oe){Oe.seekable=!1},close(){q?.buffer?.length&&q(10)},read(Oe,ze,Je,lt){for(var et=0,ft=0;ft<lt;ft++){try{var vt=B()}catch{throw new A(29)}if(vt===void 0&&et===0)throw new A(6);if(vt==null)break;et++,ze[Je+ft]=vt}return et&&(Oe.node.$a=Date.now()),et},write(Oe,ze,Je,lt){for(var et=0;et<lt;et++)try{q(ze[Je+et])}catch{throw new A(29)}return lt&&(Oe.node.Ua=Oe.node.Ta=Date.now()),et}}),ht(b,de,Ae)}var ct={};function Yt(b,B,q){if(B.charAt(0)==="/")return B;if(b=b===-100?"/":Be(b).path,B.length==0){if(!q)throw new A(44);return b}return b+"/"+B}function on(b,B){$[b>>2]=B.cc,$[b+4>>2]=B.mode,$[b+8>>2]=B.rc,$[b+12>>2]=B.uid,$[b+16>>2]=B.nc,$[b+20>>2]=B.nb,g[b+24>>3]=BigInt(B.size),G[b+32>>2]=4096,G[b+36>>2]=B.$b;var q=B.$a.getTime(),de=B.Ua.getTime(),Ae=B.Ta.getTime();return g[b+40>>3]=BigInt(Math.floor(q/1e3)),$[b+48>>2]=q%1e3*1e6,g[b+56>>3]=BigInt(Math.floor(de/1e3)),$[b+64>>2]=de%1e3*1e6,g[b+72>>3]=BigInt(Math.floor(Ae/1e3)),$[b+80>>2]=Ae%1e3*1e6,g[b+88>>3]=BigInt(B.oc),0}var sn=void 0,ln=()=>{var b=G[+sn>>2];return sn+=4,b},_i=0,Cc=[0,31,60,91,121,152,182,213,244,274,305,335],Oc=[0,31,59,90,120,151,181,212,243,273,304,334],Dr={},fs=b=>{if(!(b instanceof we||b=="unwind"))throw b},ds=b=>{throw Q=b,Ie||0<_i||(D.onExit?.(b),X=!0),new we(b)},Bc=b=>{if(!X)try{b()}catch(B){fs(B)}finally{if(!(Ie||0<_i))try{Q=b=Q,ds(b)}catch(B){fs(B)}}},Si={},hs=()=>{if(!Ei){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:_||"./this.program"},B;for(B in Si)Si[B]===void 0?delete b[B]:b[B]=Si[B];var q=[];for(B in b)q.push(`${B}=${b[B]}`);Ei=q}return Ei},Ei,xc=(b,B,q,de)=>{var Ae={string:et=>{var ft=0;if(et!=null&&et!==0){ft=F(et)+1;var vt=Jt(ft);e(et,te,vt,ft),ft=vt}return ft},array:et=>{var ft=Jt(et.length);return V.set(et,ft),ft}};b=D["_"+b];var Oe=[],ze=0;if(de)for(var Je=0;Je<de.length;Je++){var lt=Ae[q[Je]];lt?(ze===0&&(ze=dn()),Oe[Je]=lt(de[Je])):Oe[Je]=de[Je]}return q=b(...Oe),q=(function(et){return ze!==0&&fn(ze),B==="string"?Me(et):B==="boolean"?!!et:et})(q)},un=b=>{var B=F(b)+1,q=cn(B);return q&&e(b,te,q,B),q},Xt,Ai=[],Rt=b=>{Xt.delete(Nt.get(b)),Nt.set(b,null),Ai.push(b)},ps=b=>{const B=b.length;return[B%128|128,B>>7,...b]},Uc={i:127,p:127,j:126,f:125,d:124,e:111},vs=b=>ps(Array.from(b,B=>Uc[B])),Cr=(b,B)=>{if(!Xt){Xt=new WeakMap;var q=Nt.length;if(Xt)for(var de=0;de<0+q;de++){var Ae=Nt.get(de);Ae&&Xt.set(Ae,de)}}if(q=Xt.get(b)||0)return q;q=Ai.length?Ai.pop():Nt.grow(1);try{Nt.set(q,b)}catch(Oe){if(!(Oe instanceof TypeError))throw Oe;B=Uint8Array.of(0,97,115,109,1,0,0,0,1,...ps([1,96,...vs(B.slice(1)),...vs(B[0]==="v"?"":B[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),B=new WebAssembly.Module(B),B=new WebAssembly.Instance(B,{e:{f:b}}).exports.f,Nt.set(q,B)}return Xt.set(b,q),q};if(ue=Array(4096),at(n,"/"),Xe("/tmp"),Xe("/home"),Xe("/home/web_user"),(function(){Xe("/dev"),ut(259,{read:()=>0,write:(de,Ae,Oe,ze)=>ze,Ya:()=>0}),ht("/dev/null",259),f(1280,v),f(1536,i),ht("/dev/tty",1280),ht("/dev/tty1",1536);var b=new Uint8Array(1024),B=0,q=()=>(B===0&&(p(b),B=b.byteLength),b[--B]);Mt("random",q),Mt("urandom",q),Xe("/dev/shm"),Xe("/dev/shm/tmp")})(),(function(){Xe("/proc");var b=Xe("/proc/self");Xe("/proc/self/fd"),at({ab(){var B=P(b,"fd",16895,73);return B.Ma={Ya:n.Ma.Ya},B.La={mb(q,de){q=+de;var Ae=Be(q);return q={parent:null,ab:{Sb:"fake"},La:{eb:()=>Ae.path},id:q+1},q.parent=q},Ib(){return Array.from(R.entries()).filter(([,q])=>q).map(([q])=>q.toString())}},B}},"/proc/self/fd")})(),D.noExitRuntime&&(Ie=D.noExitRuntime),D.print&&(Z=D.print),D.printErr&&(K=D.printErr),D.wasmBinary&&(W=D.wasmBinary),D.thisProgram&&(_=D.thisProgram),D.preInit)for(typeof D.preInit=="function"&&(D.preInit=[D.preInit]);0<D.preInit.length;)D.preInit.shift()();D.stackSave=()=>dn(),D.stackRestore=b=>fn(b),D.stackAlloc=b=>Jt(b),D.cwrap=(b,B,q,de)=>{var Ae=!q||q.every(Oe=>Oe==="number"||Oe==="boolean");return B!=="string"&&Ae&&!de?D["_"+b]:(...Oe)=>xc(b,B,q,Oe)},D.addFunction=Cr,D.removeFunction=Rt,D.UTF8ToString=Me,D.stringToNewUTF8=un,D.writeArrayToMemory=(b,B)=>{V.set(b,B)};var cn,Or,ms,gs,fn,Jt,dn,hn,Nt,Lc={a:(b,B,q,de)=>j(`Assertion failed: ${Me(b)}, at: `+[B?Me(B):"unknown filename",q,de?Me(de):"unknown function"]),i:function(b,B){try{return b=Me(b),Lt(b,B),0}catch(q){if(typeof ct>"u"||q.name!=="ErrnoError")throw q;return-q.Pa}},L:function(b,B,q){try{if(B=Me(B),B=Yt(b,B),q&-8)return-28;var de=Te(B,{hb:!0}).node;return de?(b="",q&4&&(b+="r"),q&2&&(b+="w"),q&1&&(b+="x"),b&&be(de,b)?-2:0):-44}catch(Ae){if(typeof ct>"u"||Ae.name!=="ErrnoError")throw Ae;return-Ae.Pa}},j:function(b,B){try{var q=Be(b);return Zt(q,q.node,B,!1),0}catch(de){if(typeof ct>"u"||de.name!=="ErrnoError")throw de;return-de.Pa}},h:function(b){try{var B=Be(b);return Ke(B,B.node,{timestamp:Date.now(),dc:!1}),0}catch(q){if(typeof ct>"u"||q.name!=="ErrnoError")throw q;return-q.Pa}},b:function(b,B,q){sn=q;try{var de=Be(b);switch(B){case 0:var Ae=ln();if(0>Ae)break;for(;R[Ae];)Ae++;return $e(de,Ae).bb;case 1:case 2:return 0;case 3:return de.flags;case 4:return Ae=ln(),de.flags|=Ae,0;case 12:return Ae=ln(),J[Ae+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(Oe){if(typeof ct>"u"||Oe.name!=="ErrnoError")throw Oe;return-Oe.Pa}},g:function(b,B){try{var q=Be(b),de=q.node,Ae=q.Ma.Wa;return b=Ae?q:de,Ae??(Ae=de.La.Wa),Re(Ae),on(B,Ae(b))}catch(Oe){if(typeof ct>"u"||Oe.name!=="ErrnoError")throw Oe;return-Oe.Pa}},H:function(b,B){B=-9007199254740992>B||9007199254740992<B?NaN:Number(B);try{if(isNaN(B))return-61;var q=Be(b);if(0>B||(q.flags&2097155)===0)throw new A(28);return dr(q,q.node,B),0}catch(de){if(typeof ct>"u"||de.name!=="ErrnoError")throw de;return-de.Pa}},G:function(b,B){try{if(B===0)return-28;var q=F("/")+1;return B<q?-68:(e("/",te,b,B),q)}catch(de){if(typeof ct>"u"||de.name!=="ErrnoError")throw de;return-de.Pa}},K:function(b,B){try{return b=Me(b),on(B,Et(b,!0))}catch(q){if(typeof ct>"u"||q.name!=="ErrnoError")throw q;return-q.Pa}},C:function(b,B,q){try{return B=Me(B),B=Yt(b,B),Xe(B,q),0}catch(de){if(typeof ct>"u"||de.name!=="ErrnoError")throw de;return-de.Pa}},J:function(b,B,q,de){try{B=Me(B);var Ae=de&256;return B=Yt(b,B,de&4096),on(q,Ae?Et(B,!0):Et(B))}catch(Oe){if(typeof ct>"u"||Oe.name!=="ErrnoError")throw Oe;return-Oe.Pa}},x:function(b,B,q,de){sn=de;try{B=Me(B),B=Yt(b,B);var Ae=de?ln():0;return wt(B,q,Ae).bb}catch(Oe){if(typeof ct>"u"||Oe.name!=="ErrnoError")throw Oe;return-Oe.Pa}},v:function(b,B,q,de){try{if(B=Me(B),B=Yt(b,B),0>=de)return-28;var Ae=Te(B).node;if(!Ae)throw new A(44);if(!Ae.La.eb)throw new A(28);var Oe=Ae.La.eb(Ae),ze=Math.min(de,F(Oe)),Je=V[q+ze];return e(Oe,te,q,de+1),V[q+ze]=Je,ze}catch(lt){if(typeof ct>"u"||lt.name!=="ErrnoError")throw lt;return-lt.Pa}},u:function(b){try{return b=Me(b),It(b),0}catch(B){if(typeof ct>"u"||B.name!=="ErrnoError")throw B;return-B.Pa}},f:function(b,B){try{return b=Me(b),on(B,Et(b))}catch(q){if(typeof ct>"u"||q.name!=="ErrnoError")throw q;return-q.Pa}},r:function(b,B,q){try{if(B=Me(B),B=Yt(b,B),q)if(q===512)It(B);else return-28;else Ut(B);return 0}catch(de){if(typeof ct>"u"||de.name!=="ErrnoError")throw de;return-de.Pa}},q:function(b,B,q){try{B=Me(B),B=Yt(b,B,!0);var de=Date.now(),Ae,Oe;if(q){var ze=$[q>>2]+4294967296*G[q+4>>2],Je=G[q+8>>2];Je==1073741823?Ae=de:Je==1073741822?Ae=null:Ae=1e3*ze+Je/1e6,q+=16,ze=$[q>>2]+4294967296*G[q+4>>2],Je=G[q+8>>2],Je==1073741823?Oe=de:Je==1073741822?Oe=null:Oe=1e3*ze+Je/1e6}else Oe=Ae=de;if((Oe??Ae)!==null){b=Ae;var lt=Te(B,{hb:!0}).node;Re(lt.La.Xa)(lt,{$a:b,Ua:Oe})}return 0}catch(et){if(typeof ct>"u"||et.name!=="ErrnoError")throw et;return-et.Pa}},m:()=>j(""),l:()=>{Ie=!1,_i=0},A:function(b,B){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b),b=new Date(1e3*b),G[B>>2]=b.getSeconds(),G[B+4>>2]=b.getMinutes(),G[B+8>>2]=b.getHours(),G[B+12>>2]=b.getDate(),G[B+16>>2]=b.getMonth(),G[B+20>>2]=b.getFullYear()-1900,G[B+24>>2]=b.getDay();var q=b.getFullYear();G[B+28>>2]=(q%4!==0||q%100===0&&q%400!==0?Oc:Cc)[b.getMonth()]+b.getDate()-1|0,G[B+36>>2]=-(60*b.getTimezoneOffset()),q=new Date(b.getFullYear(),6,1).getTimezoneOffset();var de=new Date(b.getFullYear(),0,1).getTimezoneOffset();G[B+32>>2]=(q!=de&&b.getTimezoneOffset()==Math.min(de,q))|0},y:function(b,B,q,de,Ae,Oe,ze){Ae=-9007199254740992>Ae||9007199254740992<Ae?NaN:Number(Ae);try{var Je=Be(de);if((B&2)!==0&&(q&2)===0&&(Je.flags&2097155)!==2)throw new A(2);if((Je.flags&2097155)===1)throw new A(2);if(!Je.Ma.sb)throw new A(43);if(!b)throw new A(28);var lt=Je.Ma.sb(Je,b,Ae,B,q),et=lt.tc;return G[Oe>>2]=lt.Ub,$[ze>>2]=et,0}catch(ft){if(typeof ct>"u"||ft.name!=="ErrnoError")throw ft;return-ft.Pa}},z:function(b,B,q,de,Ae,Oe){Oe=-9007199254740992>Oe||9007199254740992<Oe?NaN:Number(Oe);try{var ze=Be(Ae);if(q&2){if((ze.node.mode&61440)!==32768)throw new A(43);de&2||ze.Ma.tb&&ze.Ma.tb(ze,te.slice(b,b+B),Oe,B,de)}}catch(Je){if(typeof ct>"u"||Je.name!=="ErrnoError")throw Je;return-Je.Pa}},n:(b,B)=>(Dr[b]&&(clearTimeout(Dr[b].id),delete Dr[b]),B&&(Dr[b]={id:setTimeout(()=>{delete Dr[b],Bc(()=>gs(b,performance.now()))},B),Hc:B}),0),B:(b,B,q,de)=>{var Ae=new Date().getFullYear(),Oe=new Date(Ae,0,1).getTimezoneOffset();Ae=new Date(Ae,6,1).getTimezoneOffset(),$[b>>2]=60*Math.max(Oe,Ae),G[B>>2]=+(Oe!=Ae),B=ze=>{var Je=Math.abs(ze);return`UTC${0<=ze?"-":"+"}${String(Math.floor(Je/60)).padStart(2,"0")}${String(Je%60).padStart(2,"0")}`},b=B(Oe),B=B(Ae),Ae<Oe?(e(b,te,q,17),e(B,te,de,17)):(e(b,te,de,17),e(B,te,q,17))},d:()=>Date.now(),s:()=>2147483648,c:()=>performance.now(),o:b=>{var B=te.length;if(b>>>=0,2147483648<b)return!1;for(var q=1;4>=q;q*=2){var de=B*(1+.2/q);de=Math.min(de,b+100663296);e:{de=(Math.min(2147483648,65536*Math.ceil(Math.max(b,de)/65536))-hn.buffer.byteLength+65535)/65536|0;try{hn.grow(de),L();var Ae=1;break e}catch{}Ae=void 0}if(Ae)return!0}return!1},E:(b,B)=>{var q=0,de=0,Ae;for(Ae of hs()){var Oe=B+q;$[b+de>>2]=Oe,q+=e(Ae,te,Oe,1/0)+1,de+=4}return 0},F:(b,B)=>{var q=hs();$[b>>2]=q.length,b=0;for(var de of q)b+=F(de)+1;return $[B>>2]=b,0},e:function(b){try{return hr(Be(b)),0}catch(B){if(typeof ct>"u"||B.name!=="ErrnoError")throw B;return B.Pa}},p:function(b,B){try{var q=Be(b);return V[B]=q.Va?2:me(q.mode)?3:(q.mode&61440)===40960?7:4,J[B+2>>1]=0,g[B+8>>3]=BigInt(0),g[B+16>>3]=BigInt(0),0}catch(de){if(typeof ct>"u"||de.name!=="ErrnoError")throw de;return de.Pa}},w:function(b,B,q,de){try{e:{var Ae=Be(b);b=B;for(var Oe,ze=B=0;ze<q;ze++){var Je=$[b>>2],lt=$[b+4>>2];b+=8;var et=us(Ae,V,Je,lt,Oe);if(0>et){var ft=-1;break e}if(B+=et,et<lt)break;typeof Oe<"u"&&(Oe+=et)}ft=B}return $[de>>2]=ft,0}catch(vt){if(typeof ct>"u"||vt.name!=="ErrnoError")throw vt;return vt.Pa}},D:function(b,B,q,de){B=-9007199254740992>B||9007199254740992<B?NaN:Number(B);try{if(isNaN(B))return 61;var Ae=Be(b);return ls(Ae,B,q),g[de>>3]=BigInt(Ae.position),Ae.Eb&&B===0&&q===0&&(Ae.Eb=null),0}catch(Oe){if(typeof ct>"u"||Oe.name!=="ErrnoError")throw Oe;return Oe.Pa}},I:function(b){try{var B=Be(b);return B.Ma?.lb?.(B)}catch(q){if(typeof ct>"u"||q.name!=="ErrnoError")throw q;return q.Pa}},t:function(b,B,q,de){try{e:{var Ae=Be(b);b=B;for(var Oe,ze=B=0;ze<q;ze++){var Je=$[b>>2],lt=$[b+4>>2];b+=8;var et=cs(Ae,V,Je,lt,Oe);if(0>et){var ft=-1;break e}if(B+=et,et<lt)break;typeof Oe<"u"&&(Oe+=et)}ft=B}return $[de>>2]=ft,0}catch(vt){if(typeof ct>"u"||vt.name!=="ErrnoError")throw vt;return vt.Pa}},k:ds};function Ii(){function b(){if(D.calledRun=!0,!X){if(!D.noFSInit&&!re){var B,q;re=!0,B??(B=D.stdin),q??(q=D.stdout),de??(de=D.stderr),B?Mt("stdin",B):ot("/dev/tty","/dev/stdin"),q?Mt("stdout",null,q):ot("/dev/tty","/dev/stdout"),de?Mt("stderr",null,de):ot("/dev/tty1","/dev/stderr"),wt("/dev/stdin",0),wt("/dev/stdout",1),wt("/dev/stderr",1)}if(ki.N(),he=!1,D.onRuntimeInitialized?.(),D.postRun)for(typeof D.postRun=="function"&&(D.postRun=[D.postRun]);D.postRun.length;){var de=D.postRun.shift();ie.push(de)}_e(ie)}}if(0<ge)ke=Ii;else{if(D.preRun)for(typeof D.preRun=="function"&&(D.preRun=[D.preRun]);D.preRun.length;)fe();_e(pe),0<ge?ke=Ii:D.setStatus?(D.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>D.setStatus(""),1),b()},1)):b()}}var ki;return(async function(){function b(q){return q=ki=q.exports,D._sqlite3_free=q.P,D._sqlite3_value_text=q.Q,D._sqlite3_prepare_v2=q.R,D._sqlite3_step=q.S,D._sqlite3_reset=q.T,D._sqlite3_exec=q.U,D._sqlite3_finalize=q.V,D._sqlite3_column_name=q.W,D._sqlite3_column_text=q.X,D._sqlite3_column_type=q.Y,D._sqlite3_errmsg=q.Z,D._sqlite3_clear_bindings=q._,D._sqlite3_value_blob=q.$,D._sqlite3_value_bytes=q.aa,D._sqlite3_value_double=q.ba,D._sqlite3_value_int=q.ca,D._sqlite3_value_type=q.da,D._sqlite3_result_blob=q.ea,D._sqlite3_result_double=q.fa,D._sqlite3_result_error=q.ga,D._sqlite3_result_int=q.ha,D._sqlite3_result_int64=q.ia,D._sqlite3_result_null=q.ja,D._sqlite3_result_text=q.ka,D._sqlite3_aggregate_context=q.la,D._sqlite3_column_count=q.ma,D._sqlite3_data_count=q.na,D._sqlite3_column_blob=q.oa,D._sqlite3_column_bytes=q.pa,D._sqlite3_column_double=q.qa,D._sqlite3_bind_blob=q.ra,D._sqlite3_bind_double=q.sa,D._sqlite3_bind_int=q.ta,D._sqlite3_bind_text=q.ua,D._sqlite3_bind_parameter_index=q.va,D._sqlite3_sql=q.wa,D._sqlite3_normalized_sql=q.xa,D._sqlite3_changes=q.ya,D._sqlite3_close_v2=q.za,D._sqlite3_create_function_v2=q.Aa,D._sqlite3_update_hook=q.Ba,D._sqlite3_open=q.Ca,cn=D._malloc=q.Da,Or=D._free=q.Ea,D._RegisterExtensionFunctions=q.Fa,ms=q.Ga,gs=q.Ha,fn=q.Ia,Jt=q.Ja,dn=q.Ka,hn=q.M,Nt=q.O,L(),ge--,D.monitorRunDependencies?.(ge),ge==0&&ke&&(q=ke,ke=null,q()),ki}ge++,D.monitorRunDependencies?.(ge);var B={a:Lc};return D.instantiateWasm?new Promise(q=>{D.instantiateWasm(B,(de,Ae)=>{q(b(de,Ae))})}):(ne??(ne=D.locateFile?D.locateFile("sql-wasm-browser.wasm",I):I+"sql-wasm-browser.wasm"),b((await ve(B)).instance))})(),Ii(),o}),s)};typeof t=="object"&&typeof r=="object"?(r.exports=a,r.exports.default=a):typeof define=="function"&&define.amd?define([],function(){return a}):typeof t=="object"&&(t.Module=a)})),Nn,Tt,ga,ya,wa,zn,ba,_a,jn=Ze((()=>{Nn=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],Tt=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],ga=["REQUIRED","OPTIONAL","REPEATED"],ya=["UTF8","MAP","MAP_KEY_VALUE","LIST","ENUM","DECIMAL","DATE","TIME_MILLIS","TIME_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UINT_8","UINT_16","UINT_32","UINT_64","INT_8","INT_16","INT_32","INT_64","JSON","BSON","INTERVAL"],wa=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],zn=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],ba=["UNORDERED","ASCENDING","DESCENDING"],_a=["SPHERICAL","VINCENTY","THOMAS","ANDOYER","KARNEY"]}));function Vn(t){const r=Vr(t);if(r.type===1)return{type:"Point",coordinates:Gn(t,r)};if(r.type===2)return{type:"LineString",coordinates:Hn(t,r)};if(r.type===3)return{type:"Polygon",coordinates:Sa(t,r)};if(r.type===4){const s=[];for(let a=0;a<r.count;a++)s.push(Gn(t,Vr(t)));return{type:"MultiPoint",coordinates:s}}else if(r.type===5){const s=[];for(let a=0;a<r.count;a++)s.push(Hn(t,Vr(t)));return{type:"MultiLineString",coordinates:s}}else if(r.type===6){const s=[];for(let a=0;a<r.count;a++)s.push(Sa(t,Vr(t)));return{type:"MultiPolygon",coordinates:s}}else if(r.type===7){const s=[];for(let a=0;a<r.count;a++)s.push(Vn(t));return{type:"GeometryCollection",geometries:s}}else throw new Error(`Unsupported geometry type: ${r.type}`)}function Vr(t){const{view:r}=t,s=r.getUint8(t.offset++)===1,a=r.getUint32(t.offset,s);t.offset+=4;const c=a%1e3,l=Math.floor(a/1e3);let h=0;c>1&&c<=7&&(h=r.getUint32(t.offset,s),t.offset+=4);let o=2;return l&&o++,l===3&&o++,{littleEndian:s,type:c,dim:o,count:h}}function Gn(t,r){const s=[];for(let a=0;a<r.dim;a++){const c=t.view.getFloat64(t.offset,r.littleEndian);t.offset+=8,s.push(c)}return s}function Hn(t,r){const s=[];for(let a=0;a<r.count;a++)s.push(Gn(t,r));return s}function Sa(t,r){const{view:s}=t,a=[];for(let c=0;c<r.count;c++){const l=s.getUint32(t.offset,r.littleEndian);t.offset+=4,a.push(Hn(t,{...r,count:l}))}return a}var sl=Ze((()=>{}));function Ea(t,r,s,a){if(r&&s.endsWith("_DICTIONARY")){let c=t;t instanceof Uint8Array&&!(r instanceof Uint8Array)&&(c=new r.constructor(t.length));for(let l=0;l<t.length;l++)c[l]=r[t[l]];return c}else return Aa(t,a)}function Aa(t,r){const{element:s,parsers:a,utf8:c=!0,schemaPath:l}=r,{type:h,converted_type:o,logical_type:S}=s,D=s.repetition_type!=="REQUIRED";if(l?.some(U=>U.element.logical_type?.type==="VARIANT")&&h==="BYTE_ARRAY"&&o!=="UTF8"&&S?.type!=="STRING")return t;if(o==="DECIMAL"){const U=10**-(s.scale||0),M=new Array(t.length);for(let _=0;_<M.length;_++)t[_]instanceof Uint8Array?M[_]=Ia(t[_])*U:M[_]=Number(t[_])*U;return M}if(!o&&h==="INT96")return Array.from(t).map(U=>a.timestampFromNanoseconds(ll(U)));if(o==="DATE")return Array.from(t).map(U=>a.dateFromDays(U));if(o==="TIMESTAMP_MILLIS")return Array.from(t).map(U=>a.timestampFromMilliseconds(U));if(o==="TIMESTAMP_MICROS")return Array.from(t).map(U=>a.timestampFromMicroseconds(U));if(o==="JSON")return t.map(U=>JSON.parse(qn.decode(U)));if(o==="BSON")throw new Error("parquet bson not supported");if(o==="INTERVAL")throw new Error("parquet interval not supported");if(S?.type==="GEOMETRY")return t.map(U=>a.geometryFromBytes(U));if(S?.type==="GEOGRAPHY")return t.map(U=>a.geographyFromBytes(U));if(S?.type==="UUID")return t.map(U=>a.uuidFromBytes(U));if(o==="UTF8"||S?.type==="STRING"||c&&h==="BYTE_ARRAY")return t.map(U=>a.stringFromBytes(U));if(o==="UINT_64"||S?.type==="INTEGER"&&S.bitWidth===64&&!S.isSigned){if(t instanceof BigInt64Array)return new BigUint64Array(t.buffer,t.byteOffset,t.length);const U=D?new Array(t.length):new BigUint64Array(t.length);for(let M=0;M<U.length;M++)U[M]=t[M];return U}if(o==="UINT_32"||S?.type==="INTEGER"&&S.bitWidth===32&&!S.isSigned){if(t instanceof Int32Array)return new Uint32Array(t.buffer,t.byteOffset,t.length);const U=D?new Array(t.length):new Uint32Array(t.length);for(let M=0;M<U.length;M++)U[M]=t[M]<0?4294967296+t[M]:t[M];return U}if(S?.type==="FLOAT16")return Array.from(t).map(ka);if(S?.type==="TIMESTAMP"){const{unit:U}=S;let M=a.timestampFromMilliseconds;U==="MICROS"&&(M=a.timestampFromMicroseconds),U==="NANOS"&&(M=a.timestampFromNanoseconds);const _=new Array(t.length);for(let x=0;x<_.length;x++)_[x]=M(t[x]);return _}return t}function Ia(t){if(!t.length)return 0;let r=0n;for(const a of t)r=r*256n+BigInt(a);const s=t.length*8;return r>=2n**BigInt(s-1)&&(r-=2n**BigInt(s)),Number(r)}function ll(t){const r=(t>>64n)-2440588n,s=t&18446744073709551615n;return r*86400000000000n+s}function ka(t){if(!t)return;const r=t[1]<<8|t[0],s=r>>15?-1:1,a=r>>10&31,c=r&1023;return a===0?s*2**-14*(c/1024):a===31?c?NaN:s*(1/0):s*2**(a-15)*(1+c/1024)}var qn,er,gr=Ze((()=>{sl(),qn=new TextDecoder,er={timestampFromMilliseconds(t){return new Date(Number(t))},timestampFromMicroseconds(t){return new Date(Number(t/1000n))},timestampFromNanoseconds(t){return new Date(Number(t/1000000n))},dateFromDays(t){return new Date(t*864e5)},stringFromBytes(t){return t&&qn.decode(t)},geometryFromBytes(t){return t&&Vn({view:new DataView(t.buffer,t.byteOffset,t.byteLength),offset:0})},geographyFromBytes(t){return t&&Vn({view:new DataView(t.buffer,t.byteOffset,t.byteLength),offset:0})},uuidFromBytes(t){if(!t)return;const r=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return r.slice(0,8)+"-"+r.slice(8,12)+"-"+r.slice(12,16)+"-"+r.slice(16,20)+"-"+r.slice(20,32)}}}));function Ta(t,r,s){const a=t[r],c=[];let l=1;if(a.num_children)for(;c.length<a.num_children;){const h=t[r+l],o=Ta(t,r+l,[...s,h.name]);l+=o.count,c.push(o)}return{count:l,element:a,children:c,path:s}}function Pa(t,r){let s=Ta(t,0,[]);const a=[s];for(const c of r){const l=s.children.find(h=>h.element.name===c);if(!l)throw new Error(`parquet schema element not found: ${r}`);a.push(l),s=l}return a}function Fa(t){const r=[];function s(a){if(a.children.length)for(const c of a.children)s(c);else r.push(a.path.join("."))}return s(t),r}function Da(t){let r=0;for(const{element:s}of t)s.repetition_type==="REPEATED"&&r++;return r}function Wn(t){let r=0;for(const{element:s}of t.slice(1))s.repetition_type!=="REQUIRED"&&r++;return r}function ul(t){if(!t||t.element.converted_type!=="LIST"||t.children.length>1)return!1;const r=t.children[0];return!(r.children.length>1||r.element.repetition_type!=="REPEATED")}function cl(t){if(!t||t.element.converted_type!=="MAP"||t.children.length>1)return!1;const r=t.children[0];return!(r.children.length!==2||r.element.repetition_type!=="REPEATED"||r.children.find(s=>s.element.name==="key")?.element.repetition_type==="REPEATED"||r.children.find(s=>s.element.name==="value")?.element.repetition_type==="REPEATED")}function Ca(t){if(t.length!==2)return!1;const[,r]=t;return!(r.element.repetition_type==="REPEATED"||r.children.length)}var tr=Ze((()=>{}));function rr(t){const r={};let s=0;for(;t.offset<t.view.byteLength;){const a=t.view.getUint8(t.offset++),c=a&15;if(c===Ba)break;const l=a>>4;s=l?s+l:Oa(t),r[`field_${s}`]=$n(t,c)}return r}function $n(t,r){switch(r){case Yn:return!0;case Xn:return!1;case Jn:return t.view.getInt8(t.offset++);case xa:case Ua:return Oa(t);case La:return Zn(t);case Ma:{const s=t.view.getFloat64(t.offset,!0);return t.offset+=8,s}case Ra:{const s=Vt(t),a=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,s);return t.offset+=s,a}case Na:{const s=t.view.getUint8(t.offset++),a=s&15;let c=s>>4;c===15&&(c=Vt(t));const l=a===Yn||a===Xn,h=new Array(c);for(let o=0;o<c;o++)h[o]=l?$n(t,Jn)===1:$n(t,a);return h}case za:return rr(t);default:throw new Error(`thrift unhandled type: ${r}`)}}function Vt(t){let r=0,s=0;for(;;){const a=t.view.getUint8(t.offset++);if(r|=(a&127)<<s,!(a&128))return r;s+=7}}function fl(t){let r=0n,s=0n;for(;;){const a=t.view.getUint8(t.offset++);if(r|=BigInt(a&127)<<s,!(a&128))return r;s+=7n}}function Oa(t){const r=Vt(t);return r>>>1^-(r&1)}function Zn(t){const r=fl(t);return r>>1n^-(r&1n)}var Ba,Yn,Xn,Jn,xa,Ua,La,Ma,Ra,Na,za,nr=Ze((()=>{Ba=0,Yn=1,Xn=2,Jn=3,xa=4,Ua=5,La=6,Ma=7,Ra=8,Na=9,za=12}));function dl(t,r){const s=new Map,a=r?.find(({key:l})=>l==="geo")?.value,c=(a&&JSON.parse(a)?.columns)??{};for(const[l,h]of Object.entries(c)){if(h.encoding!=="WKB")continue;const o=h.edges==="spherical"?"GEOGRAPHY":"GEOMETRY",S=h.crs?.id??h.crs?.ids?.[0],D=S?`${S.authority}:${S.code.toString()}`:void 0;s.set(l,{type:o,crs:D})}for(let l=1;l<t.length;l++){const{logical_type:h,name:o,num_children:S,type:D}=t[l];if(S){l+=S;continue}D==="BYTE_ARRAY"&&!h&&(t[l].logical_type=s.get(o))}}var hl=Ze((()=>{}));function St(t){return t&&Va.decode(t)}async function yr(t,{parsers:r,initialFetchSize:s=Qn,geoparquet:a=!0}={}){if(!t||!(t.byteLength>=0))throw new Error("parquet expected AsyncBuffer");const c=Math.max(0,t.byteLength-s),l=await t.slice(c,t.byteLength),h=new DataView(l);if(h.getUint32(l.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const o=h.getUint32(l.byteLength-8,!0);if(o>t.byteLength-8)throw new Error(`parquet metadata length ${o} exceeds available buffer ${t.byteLength-8}`);if(o+8>s){const S=t.byteLength-o-8,D=await t.slice(S,c),U=new ArrayBuffer(o+8),M=new Uint8Array(U);return M.set(new Uint8Array(D)),M.set(new Uint8Array(l),c-S),Kn(U,{parsers:r,geoparquet:a})}else return Kn(l,{parsers:r,geoparquet:a})}function Kn(t,{parsers:r,geoparquet:s=!0}={}){if(!(t instanceof ArrayBuffer))throw new Error("parquet expected ArrayBuffer");const a=new DataView(t);if(r={...er,...r},a.byteLength<8)throw new Error("parquet file is too short");if(a.getUint32(a.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const c=a.byteLength-8,l=a.getUint32(c,!0);if(l>a.byteLength-8)throw new Error(`parquet metadata length ${l} exceeds available buffer ${a.byteLength-8}`);const h=rr({view:a,offset:c-l}),o=h.field_1,S=h.field_2.map(I=>({type:Nn[I.field_1],type_length:I.field_2,repetition_type:ga[I.field_3],name:St(I.field_4),num_children:I.field_5,converted_type:ya[I.field_6],scale:I.field_7,precision:I.field_8,field_id:I.field_9,logical_type:pl(I.field_10)})),D=S.filter(I=>I.type),U=h.field_3,M=h.field_4.map(I=>({columns:I.field_1.map((H,ee)=>({file_path:St(H.field_1),file_offset:H.field_2,meta_data:H.field_3&&{type:Nn[H.field_3.field_1],encodings:H.field_3.field_2?.map(Z=>Tt[Z]),path_in_schema:H.field_3.field_3.map(St),codec:wa[H.field_3.field_4],num_values:H.field_3.field_5,total_uncompressed_size:H.field_3.field_6,total_compressed_size:H.field_3.field_7,key_value_metadata:H.field_3.field_8?.map(Z=>({key:St(Z.field_1),value:St(Z.field_2)})),data_page_offset:H.field_3.field_9,index_page_offset:H.field_3.field_10,dictionary_page_offset:H.field_3.field_11,statistics:vl(H.field_3.field_12,D[ee],r),encoding_stats:H.field_3.field_13?.map(Z=>({page_type:zn[Z.field_1],encoding:Tt[Z.field_2],count:Z.field_3})),bloom_filter_offset:H.field_3.field_14,bloom_filter_length:H.field_3.field_15,size_statistics:H.field_3.field_16&&{unencoded_byte_array_data_bytes:H.field_3.field_16.field_1,repetition_level_histogram:H.field_3.field_16.field_2,definition_level_histogram:H.field_3.field_16.field_3},geospatial_statistics:H.field_3.field_17&&{bbox:H.field_3.field_17.field_1&&{xmin:H.field_3.field_17.field_1.field_1,xmax:H.field_3.field_17.field_1.field_2,ymin:H.field_3.field_17.field_1.field_3,ymax:H.field_3.field_17.field_1.field_4,zmin:H.field_3.field_17.field_1.field_5,zmax:H.field_3.field_17.field_1.field_6,mmin:H.field_3.field_17.field_1.field_7,mmax:H.field_3.field_17.field_1.field_8},geospatial_types:H.field_3.field_17.field_2}},offset_index_offset:H.field_4,offset_index_length:H.field_5,column_index_offset:H.field_6,column_index_length:H.field_7,crypto_metadata:H.field_8,encrypted_column_metadata:H.field_9})),total_byte_size:I.field_2,num_rows:I.field_3,sorting_columns:I.field_4?.map(H=>({column_idx:H.field_1,descending:H.field_2,nulls_first:H.field_3})),file_offset:I.field_5,total_compressed_size:I.field_6,ordinal:I.field_7})),_=h.field_5?.map(I=>({key:St(I.field_1),value:St(I.field_2)})),x=St(h.field_6);return s&&dl(S,_),{version:o,schema:S,num_rows:U,row_groups:M,key_value_metadata:_,created_by:x,metadata_length:l}}function Pt({schema:t}){return Pa(t,[])[0]}function pl(t){return t?.field_1?{type:"STRING"}:t?.field_2?{type:"MAP"}:t?.field_3?{type:"LIST"}:t?.field_4?{type:"ENUM"}:t?.field_5?{type:"DECIMAL",scale:t.field_5.field_1,precision:t.field_5.field_2}:t?.field_6?{type:"DATE"}:t?.field_7?{type:"TIME",isAdjustedToUTC:t.field_7.field_1,unit:ja(t.field_7.field_2)}:t?.field_8?{type:"TIMESTAMP",isAdjustedToUTC:t.field_8.field_1,unit:ja(t.field_8.field_2)}:t?.field_10?{type:"INTEGER",bitWidth:t.field_10.field_1,isSigned:t.field_10.field_2}:t?.field_11?{type:"NULL"}:t?.field_12?{type:"JSON"}:t?.field_13?{type:"BSON"}:t?.field_14?{type:"UUID"}:t?.field_15?{type:"FLOAT16"}:t?.field_16?{type:"VARIANT",specification_version:t.field_16.field_1}:t?.field_17?{type:"GEOMETRY",crs:St(t.field_17.field_1)}:t?.field_18?{type:"GEOGRAPHY",crs:St(t.field_18.field_1),algorithm:_a[t.field_18.field_2]}:t}function ja(t){if(t.field_1)return"MILLIS";if(t.field_2)return"MICROS";if(t.field_3)return"NANOS";throw new Error("parquet time unit required")}function vl(t,r,s){return t&&{max:ir(t.field_1,r,s),min:ir(t.field_2,r,s),null_count:t.field_3,distinct_count:t.field_4,max_value:ir(t.field_5,r,s),min_value:ir(t.field_6,r,s),is_max_value_exact:t.field_7,is_min_value_exact:t.field_8}}function ir(t,r,s){const{type:a,converted_type:c,logical_type:l}=r;if(t===void 0)return t;if(a==="BOOLEAN")return t[0]===1;if(a==="BYTE_ARRAY")return s.stringFromBytes(t);const h=new DataView(t.buffer,t.byteOffset,t.byteLength);return a==="FLOAT"&&h.byteLength===4?h.getFloat32(0,!0):a==="DOUBLE"&&h.byteLength===8?h.getFloat64(0,!0):a==="INT32"&&c==="DATE"?s.dateFromDays(h.getInt32(0,!0)):a==="INT64"&&c==="TIMESTAMP_MILLIS"?s.timestampFromMilliseconds(h.getBigInt64(0,!0)):a==="INT64"&&c==="TIMESTAMP_MICROS"?s.timestampFromMicroseconds(h.getBigInt64(0,!0)):a==="INT64"&&l?.type==="TIMESTAMP"&&l?.unit==="NANOS"?s.timestampFromNanoseconds(h.getBigInt64(0,!0)):a==="INT64"&&l?.type==="TIMESTAMP"&&l?.unit==="MICROS"?s.timestampFromMicroseconds(h.getBigInt64(0,!0)):a==="INT64"&&l?.type==="TIMESTAMP"?s.timestampFromMilliseconds(h.getBigInt64(0,!0)):a==="INT32"&&h.byteLength===4?h.getInt32(0,!0):a==="INT64"&&h.byteLength===8?h.getBigInt64(0,!0):c==="DECIMAL"?Ia(t)*10**-(r.scale||0):l?.type==="FLOAT16"?ka(t):t}var Qn,Va,ar=Ze((()=>{jn(),gr(),tr(),nr(),hl(),Qn=1<<19,Va=new TextDecoder}));function ml(t,r,s=void 0){s={...er,...s};const a=rr(t);return{null_pages:a.field_1,min_values:a.field_2.map(c=>ir(c,r,s)),max_values:a.field_3.map(c=>ir(c,r,s)),boundary_order:ba[a.field_4],null_counts:a.field_5,repetition_level_histograms:a.field_6,definition_level_histograms:a.field_7}}function Ga(t){const r=rr(t);return{page_locations:r.field_1.map(s=>({offset:s.field_1,compressed_page_size:s.field_2,first_row_index:s.field_3})),unencoded_byte_array_data_bytes:r.field_2}}var Ha=Ze((()=>{jn(),gr(),ar(),nr()}));function Ft(t,r){return(t<<r|t>>64n-r)&pt}function or(t,r){return t=t+r*sr&pt,t=Ft(t,31n),t*Ct&pt}function Gr(t,r){return t^=or(0n,r),t*Ct+ti&pt}function Dt(t,r=0n){const s=new DataView(t.buffer,t.byteOffset,t.byteLength),a=t.byteLength;let c=0,l;if(a>=32){let h=r+Ct+sr&pt,o=r+sr&pt,S=r,D=r-Ct&pt;for(;c+32<=a;)h=or(h,s.getBigUint64(c,!0)),c+=8,o=or(o,s.getBigUint64(c,!0)),c+=8,S=or(S,s.getBigUint64(c,!0)),c+=8,D=or(D,s.getBigUint64(c,!0)),c+=8;l=Ft(h,1n)+Ft(o,7n)+Ft(S,12n)+Ft(D,18n)&pt,l=Gr(l,h),l=Gr(l,o),l=Gr(l,S),l=Gr(l,D)}else l=r+ri&pt;for(l=l+BigInt(a)&pt;c+8<=a;)l^=or(0n,s.getBigUint64(c,!0)),l=Ft(l,27n)*Ct+ti&pt,c+=8;for(c+4<=a&&(l^=BigInt(s.getUint32(c,!0))*Ct&pt,l=Ft(l,23n)*sr+ei&pt,c+=4);c<a;)l^=BigInt(s.getUint8(c))*ri&pt,l=Ft(l,11n)*Ct&pt,c+=1;return l^=l>>33n,l=l*sr&pt,l^=l>>29n,l=l*ei&pt,l^=l>>32n,l}var pt,Ct,sr,ei,ti,ri,gl=Ze((()=>{pt=18446744073709551615n,Ct=11400714785074694791n,sr=14029467366897019727n,ei=1609587929392839161n,ti=9650029242287828579n,ri=2870177450012600261n}));function yl(t,r){return Number((t>>32n)*BigInt(r)>>32n)}function wl(t){const r=new Uint32Array(8),s=Number(t&4294967295n)|0;for(let a=0;a<8;a++)r[a]=1<<(Math.imul(s,Za[a])>>>27);return r}function qa(t,r){const s=yl(r,t.length>>3)<<3,a=wl(r);for(let c=0;c<8;c++)if((t[s+c]&a[c])===0)return!1;return!0}function bl(t){const r=rr(t),s=r.field_1;if(typeof s!="number"||s<=0||s%32!==0||!r.field_2?.field_1||!r.field_3?.field_1||!r.field_4?.field_1)return;const{view:a,offset:c}=t;if(c+s>a.byteLength)throw new Error(`parquet bloom filter truncated: need ${s} bytes, have ${a.byteLength-c}`);const l=new Uint32Array(s>>2);for(let h=0;h<l.length;h++)l[h]=a.getUint32(c+h*4,!0);return t.offset=c+s,{numBytes:s,blocks:l}}function Wa(t,r){if(t==null)return;const{type:s,converted_type:a,logical_type:c}=r;if(s==="BOOLEAN")return typeof t!="boolean"?void 0:Dt(new Uint8Array([t?1:0]));if(s==="FLOAT"){if(typeof t!="number")return;const l=new ArrayBuffer(4);return new DataView(l).setFloat32(0,t,!0),Dt(new Uint8Array(l))}if(s==="DOUBLE"){if(typeof t!="number")return;const l=new ArrayBuffer(8);return new DataView(l).setFloat64(0,t,!0),Dt(new Uint8Array(l))}if(s==="INT32"){if(a==="DATE"||a==="DECIMAL"||a==="TIME_MILLIS"||c?.type==="DATE"||c?.type==="TIME"||c?.type==="DECIMAL"||typeof t!="number"||!Number.isInteger(t))return;const l=new ArrayBuffer(4);return new DataView(l).setInt32(0,t|0,!0),Dt(new Uint8Array(l))}if(s==="INT64"){if(a==="TIMESTAMP_MILLIS"||a==="TIMESTAMP_MICROS"||a==="TIME_MICROS"||a==="DECIMAL"||c?.type==="TIMESTAMP"||c?.type==="TIME"||c?.type==="DECIMAL")return;let l;if(typeof t=="bigint")l=t;else if(typeof t=="number"&&Number.isSafeInteger(t))l=BigInt(t);else return;const h=new ArrayBuffer(8);return new DataView(h).setBigUint64(0,BigInt.asUintN(64,l),!0),Dt(new Uint8Array(h))}if(s==="BYTE_ARRAY")return a==="JSON"||a==="BSON"||a==="DECIMAL"||c?.type==="JSON"||c?.type==="BSON"||c?.type==="VARIANT"||c?.type==="GEOMETRY"||c?.type==="GEOGRAPHY"?void 0:typeof t=="string"?Dt($a.encode(t)):t instanceof Uint8Array?Dt(t):void 0;if(s==="FIXED_LEN_BYTE_ARRAY")return a==="DECIMAL"||a==="INTERVAL"||c?.type==="DECIMAL"||c?.type==="UUID"||c?.type==="FLOAT16"||c?.type==="GEOMETRY"||c?.type==="GEOGRAPHY"?void 0:t instanceof Uint8Array?Dt(t):void 0}function _l(t){const r=new Set;return ni(t,r),r}function ni(t,r){if(t){if("$and"in t&&Array.isArray(t.$and)){for(const s of t.$and)ni(s,r);return}if("$or"in t&&Array.isArray(t.$or)){for(const s of t.$or)ni(s,r);return}if(!("$nor"in t))for(const[s,a]of Object.entries(t))s.startsWith("$")||(typeof a=="object"&&a!==null&&!Array.isArray(a)?("$eq"in a||"$in"in a)&&r.add(s):r.add(s))}}var $a,Za,Ya=Ze((()=>{nr(),gl(),$a=new TextEncoder,Za=new Uint32Array([1203114875,1150766481,2284105051,2729912477,1884591559,770785867,2667333959,1550580529])}));function ii(t){if(t===void 0)return null;if(typeof t=="bigint")return Number(t);if(Object.is(t,-0))return 0;if(Array.isArray(t))return t.map(ii);if(t instanceof Uint8Array)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof Object){const r={};for(const s of Object.keys(t))t[s]!==void 0&&(r[s]=ii(t[s]));return r}return t}function ai(t,r){for(let a=0;a<r.length;a+=1e4)t.push(...r.slice(a,a+1e4))}function Ot(t,r,s=!0){if(s?t===r:t==r)return!0;if(!t||!r||typeof t!="object"||typeof r!="object")return!1;if(t instanceof Uint8Array&&r instanceof Uint8Array){if(t.length!==r.length)return!1;for(let c=0;c<t.length;c++)if(t[c]!==r[c])return!1;return!0}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return!1;for(let c=0;c<t.length;c++)if(!Ot(t[c],r[c],s))return!1;return!0}const a=Object.keys(t);if(a.length!==Object.keys(r).length)return!1;for(const c of a)if(!Ot(t[c],r[c],s))return!1;return!0}async function Xa(t,r={},s=globalThis.fetch){const a=new AbortController,c=new Headers(r.headers);c.set("Range","bytes=0-0");const l=await s(t,{...r,headers:c,signal:a.signal});if(!l.ok)throw new Error(`fetch with range failed ${l.status}`);if(l.status===206){const h=l.headers.get("Content-Range");if(!h)throw new Error("missing content-range header");const o=h.match(/bytes \d+-\d+\/(\d+)/);if(!o)throw new Error(`invalid content-range header: ${h}`);return parseInt(o[1])}if(l.status===200){const h=l.headers.get("Content-Length");if(a.abort(),h)return parseInt(h)}throw new Error("server does not support range requests and missing content-length")}async function Ja(t,r,s){const a=s??globalThis.fetch,c=await a(t,{...r,method:"HEAD"});if(c.status===403)return Xa(t,r,a);if(!c.ok)throw new Error(`fetch head failed ${c.status}`);const l=c.headers.get("Content-Length");return l?parseInt(l):Xa(t,r,a)}async function Sl({url:t,byteLength:r,requestInit:s,fetch:a}){if(!t)throw new Error("missing url");const c=a??globalThis.fetch;r??(r=await Ja(t,s,c));let l;const h=s||{};return{byteLength:r,async slice(o,S){if(l)return l.then(_=>_.slice(o,S));const D=new Headers(h.headers),U=S===void 0?"":S-1;D.set("Range",`bytes=${o}-${U}`);const M=await c(t,{...h,headers:D});if(!M.ok||!M.body)throw new Error(`fetch failed ${M.status}`);if(M.status===200)return l=M.arrayBuffer(),l.then(_=>_.slice(o,S));if(M.status===206)return M.arrayBuffer();throw new Error(`fetch received unexpected status code ${M.status}`)}}}function El({byteLength:t,slice:r},{minSize:s=Qn}={}){if(t<s){const c=r(0,t);return{byteLength:t,async slice(l,h){return(await c).slice(l,h)}}}const a=new Map;return{byteLength:t,slice(c,l){const h=Al(c,l,t),o=a.get(h);if(o)return o;const S=r(c,l);return a.set(h,S),S}}}function Al(t,r,s){if(t<0){if(r!==void 0)throw new Error(`invalid suffix range [${t}, ${r}]`);return s===void 0?`${t},`:`${s+t},${s}`}else if(r!==void 0){if(t>r)throw new Error(`invalid empty range [${t}, ${r}]`);return`${t},${r}`}else return s===void 0?`${t},`:`${t},${s}`}function oi(t){if(!t)return[];if(t.length===1)return t[0];const r=[];for(const s of t)ai(r,s);return r}var Hr=Ze((()=>{ar()}));function qr(t){if(!t)return[];const r=[];return"$and"in t&&Array.isArray(t.$and)?r.push(...t.$and.flatMap(qr)):"$or"in t&&Array.isArray(t.$or)?r.push(...t.$or.flatMap(qr)):"$nor"in t&&Array.isArray(t.$nor)?r.push(...t.$nor.flatMap(qr)):r.push(...Object.keys(t).map(s=>s.split(".")[0])),[...new Set(r)]}function wr(t,r,s=!0){return"$and"in r&&Array.isArray(r.$and)?r.$and.every(a=>wr(t,a,s)):"$or"in r&&Array.isArray(r.$or)?r.$or.some(a=>wr(t,a,s)):"$nor"in r&&Array.isArray(r.$nor)?!r.$nor.some(a=>wr(t,a,s)):Object.entries(r).every(([a,c])=>{const l=Il(t,a);return typeof c!="object"||c===null||Array.isArray(c)?Ot(l,c,s):Object.entries(c||{}).every(([h,o])=>h==="$gt"?l>o:h==="$gte"?l>=o:h==="$lt"?l<o:h==="$lte"?l<=o:h==="$eq"?Ot(l,o,s):h==="$ne"?!Ot(l,o,s):h==="$in"?Array.isArray(o)&&o.includes(l):h==="$nin"?Array.isArray(o)&&!o.includes(l):h==="$not"?!wr({[a]:l},{[a]:o},s):!0)})}function Wr({rowGroup:t,physicalColumns:r,filter:s,strict:a=!0,bloomFilters:c,schemaElements:l}){if(!s)return!1;if("$and"in s&&Array.isArray(s.$and))return s.$and.some(h=>Wr({rowGroup:t,physicalColumns:r,filter:h,strict:a,bloomFilters:c,schemaElements:l}));if("$or"in s&&Array.isArray(s.$or))return s.$or.every(h=>Wr({rowGroup:t,physicalColumns:r,filter:h,strict:a,bloomFilters:c,schemaElements:l}));if("$nor"in s&&Array.isArray(s.$nor))return!1;for(const[h,o]of Object.entries(s)){const S=r.indexOf(h);if(S===-1)continue;const{min:D,max:U,min_value:M,max_value:_}=t.columns[S].meta_data?.statistics||{},x=M!==void 0?M:D,I=_!==void 0?_:U,H=x!==void 0&&I!==void 0,ee=c?.[h],Z=l?.[h];for(const[K,W]of Object.entries(o||{})){if(H&&(K==="$gt"&&I<=W||K==="$gte"&&I<W||K==="$lt"&&x>=W||K==="$lte"&&x>W||K==="$eq"&&(W<x||W>I)||K==="$ne"&&Ot(x,I,a)&&Ot(x,W,a)||K==="$in"&&Array.isArray(W)&&W.every(X=>X<x||X>I)||K==="$nin"&&Array.isArray(W)&&Ot(x,I,a)&&W.includes(x)))return!0;if(ee&&Z){if(K==="$eq"){const X=Wa(W,Z);if(X!==void 0&&!qa(ee.blocks,X))return!0}if(K==="$in"&&Array.isArray(W)&&W.length>0){let X=!0;for(const Q of W){const V=Wa(Q,Z);if(V===void 0||qa(ee.blocks,V)){X=!1;break}}if(X)return!0}}}}return!1}function Il(t,r){let s=t;for(const a of r.split("."))s=s?.[a];return s}var Ka=Ze((()=>{Ya(),Hr()}));function kl({metadata:t,rowStart:r=0,rowEnd:s=1/0,columns:a,filter:c,filterStrict:l=!0,useOffsetIndex:h=!1,bloomFiltersByGroup:o,schemaElements:S}){if(!t)throw new Error("parquetPlan requires metadata");const D=[],U=[],M=[],_=Fa(Pt(t));let x=0,I=0;for(const H of t.row_groups){const ee=Number(H.num_rows),Z=x+ee,K=o?.[I];if(ee>0&&Z>r&&x<s&&!Wr({rowGroup:H,physicalColumns:_,filter:c,strict:l,bloomFilters:K,schemaElements:S})){const W=[];let X=1/0,Q=-1/0;for(const G of H.columns){const $=G.meta_data;if(G.file_path)throw new Error("parquet file_path not supported");if(!$)throw new Error("parquet column metadata is undefined");if(!a||a.includes($.path_in_schema[0])){const ce=$.dictionary_page_offset||$.data_page_offset,se=Number(ce),g=Number(ce+$.total_compressed_size);if(se<X&&(X=se),g>Q&&(Q=g),h&&G.offset_index_offset&&G.offset_index_length&&(r>x||s<Z)){const L=Number(G.offset_index_offset);W.push({columnMetadata:$,offsetIndex:{startByte:L,endByte:L+G.offset_index_length},range:{startByte:se,endByte:g}})}else W.push({columnMetadata:$,range:{startByte:se,endByte:g}})}}const V=Math.max(r-x,0),te=Math.min(s-x,ee);D.push({chunks:W,rowGroup:H,groupStart:x,groupRows:ee,selectStart:V,selectEnd:te});let J;for(const G of W)if("offsetIndex"in G)M.push(G.offsetIndex);else{const{range:$}=G;a?U.push($):J&&$.endByte-J.startByte<=Qa?J.endByte=$.endByte:(J&&U.push(J),J={...$})}J&&U.push(J)}x=Z,I++}return isFinite(s)||(s=x),U.push(...M),{metadata:t,rowStart:r,rowEnd:s,columns:a,fetches:U,groups:D}}async function Tl({file:t,metadata:r,filter:s,filterStrict:a=!0}){const c=r.row_groups.map(()=>({})),l=_l(s);if(l.size===0)return c;const h=Fa(Pt(r)),o=[];return r.row_groups.forEach((S,D)=>{if(!Wr({rowGroup:S,physicalColumns:h,filter:s,strict:a}))for(const U of l){const M=h.indexOf(U);if(M===-1)continue;const _=S.columns[M]?.meta_data;if(!_?.bloom_filter_offset||!_.bloom_filter_length)continue;const x=Number(_.bloom_filter_offset),I=x+_.bloom_filter_length;o.push((async()=>{const H=await t.slice(x,I),ee=bl({view:new DataView(H),offset:0});ee&&(c[D][U]=ee)})())}}),o.length&&await Promise.all(o),c}function Pl(t,{fetches:r}){const s=r.map(({startByte:a,endByte:c})=>t.slice(a,c));return{byteLength:t.byteLength,slice(a,c=t.byteLength){const l=r.findIndex(({startByte:h,endByte:o})=>h<=a&&c<=o);if(l<0)return t.slice(a,c);if(r[l].startByte!==a||r[l].endByte!==c){const h=a-r[l].startByte,o=c-r[l].startByte;return s[l]instanceof Promise?s[l].then(S=>S.slice(h,o)):s[l].slice(h,o)}else return s[l]}}}var Qa,Fl=Ze((()=>{Ya(),Ka(),ar(),tr(),Qa=1<<21}));function eo(t,r=er){if(Array.isArray(t))return t.map(s=>eo(s,r));if(typeof t!="object")return t;if("metadata"in t){const s=Dl(t.metadata),a=t.typed_value&&$r(t.typed_value,s,r),c=t.value&&br(Zr(t.value),s,r);return a&&c?{...c,...a}:a??c}return t}function $r(t,r,s){if(t instanceof Date)return t;if(t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof Uint8Array)){if("typed_value"in t&&t.typed_value!==null&&t.typed_value!==void 0)return $r(t.typed_value,r,s);if("value"in t&&t.value instanceof Uint8Array)return br(Zr(t.value),r,s);if("typed_value"in t||"value"in t)return null;const a={};for(const[c,l]of Object.entries(t))r.dictionary.includes(c)&&(a[c]=$r(l,r,s));return a}return t instanceof Uint8Array?br(Zr(t),r,s):Array.isArray(t)?t.map(a=>$r(a,r,s)):t}function Zr(t){return{view:new DataView(t.buffer,t.byteOffset,t.byteLength),offset:0}}function Dl(t){let r=li.get(t.buffer);r||(r=new Map,li.set(t.buffer,r));const s=`${t.byteOffset}:${t.byteLength}`,a=r.get(s);if(a)return a;const c=Zr(t),l=c.view.getUint8(c.offset++),h=l&15;if(h!==1)throw new Error(`parquet unsupported variant metadata version: ${h}`);const o=(l>>4&1)===1,S=(l>>6&3)+1,D=Gt(c,S),U=new Array(D+1);for(let I=0;I<U.length;I++)U[I]=Gt(c,S);const M=c.offset,_=new Array(D);for(let I=0;I<D;I++){const H=U[I],ee=U[I+1],Z=new Uint8Array(t.buffer,t.byteOffset+M+H,ee-H);_[I]=Yr.decode(Z)}const x={dictionary:_,sorted:o};return r.set(s,x),x}function Gt(t,r){let s=0;for(let a=0;a<r;a++)s|=t.view.getUint8(t.offset+a)<<a*8;return t.offset+=r,s}function br(t,r,s){const a=t.view.getUint8(t.offset++),c=a&3,l=a>>2;if(c===0)return Cl(t,l,s);if(c===2)return Ol(t,l,r,s);if(c===3)return Bl(t,l,r,s);const h=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,l);return t.offset+=l,Yr.decode(h)}function Cl(t,r,s){switch(r){case 0:return null;case 1:return!0;case 2:return!1;case 3:{const a=t.view.getInt8(t.offset);return t.offset+=1,a}case 4:{const a=t.view.getInt16(t.offset,!0);return t.offset+=2,a}case 5:{const a=t.view.getInt32(t.offset,!0);return t.offset+=4,a}case 6:{const a=t.view.getBigInt64(t.offset,!0);return t.offset+=8,a}case 7:{const a=t.view.getFloat64(t.offset,!0);return t.offset+=8,a}case 8:return si(t,4);case 9:return si(t,8);case 10:return si(t,16);case 11:{const a=t.view.getInt32(t.offset,!0);return t.offset+=4,s.dateFromDays(a)}case 12:case 13:{const a=t.view.getBigInt64(t.offset,!0);return t.offset+=8,s.timestampFromMicroseconds(a)}case 14:{const a=t.view.getFloat32(t.offset,!0);return t.offset+=4,a}case 15:return to(t);case 16:{const a=to(t);return Yr.decode(a)}case 17:{const a=t.view.getBigInt64(t.offset,!0);return t.offset+=8,a}case 18:case 19:{const a=t.view.getBigInt64(t.offset,!0);return t.offset+=8,s.timestampFromNanoseconds(a)}case 20:{const a=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,16);t.offset+=16;const c=Array.from(a,l=>l.toString(16).padStart(2,"0")).join("");return`${c.slice(0,8)}-${c.slice(8,12)}-${c.slice(12,16)}-${c.slice(16,20)}-${c.slice(20)}`}default:throw new Error(`parquet unsupported variant primitive type: ${r}`)}}function Ol(t,r,s,a){const c=(r&3)+1,l=(r>>2&3)+1,h=r>>4&1?Gt(t,4):t.view.getUint8(t.offset++),o=new Array(h);for(let U=0;U<h;U++)o[U]=Gt(t,l);const S=new Array(h+1);for(let U=0;U<S.length;U++)S[U]=Gt(t,c);const D={};for(let U=0;U<h;U++){const M=s.dictionary[o[U]];D[M]=br({view:t.view,offset:t.offset+S[U]},s,a)}return t.offset+=S[S.length-1],D}function Bl(t,r,s,a){const c=r&3,l=r>>2&1,h=c+1,o=Gt(t,l?4:1),S=new Array(o+1);for(let M=0;M<S.length;M++)S[M]=Gt(t,h);const D=t.offset,U=new Array(o);for(let M=0;M<o;M++)U[M]=br({view:t.view,offset:D+S[M]},s,a);return t.offset=D+S[S.length-1],U}function si(t,r){const s=t.view.getUint8(t.offset);t.offset+=1;let a;if(r===4)a=BigInt(t.view.getInt32(t.offset,!0)),t.offset+=4;else if(r===8)a=t.view.getBigInt64(t.offset,!0),t.offset+=8;else{const c=t.view.getBigUint64(t.offset,!0);a=t.view.getBigInt64(t.offset+8,!0)<<64n|c,t.offset+=16}return Number(a)*10**-s}function to(t){const r=t.view.getUint32(t.offset,!0);t.offset+=4;const s=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,r);return t.offset+=r,s}var Yr,li,xl=Ze((()=>{gr(),Yr=new TextDecoder,li=new WeakMap}));function ro(t,r,s,a,c){const l=Wn(c);if(!r?.length&&!s.length){if(!l||!a.length)return a;r=new Array(a.length).fill(l)}const h=r?.length||s.length,o=c.map(({element:I})=>I.repetition_type);let S=0;const D=[t];let U=t,M=0,_=0,x=0;if(s[0])for(;M<o.length-2&&x<s[0];)M++,o[M]!=="REQUIRED"&&(U=U.at(-1),D.push(U),_++),o[M]==="REPEATED"&&x++;for(let I=0;I<h;I++){const H=r?.length?r[I]:l,ee=s[I];for(;M&&(ee<x||o[M]!=="REPEATED");)o[M]!=="REQUIRED"&&(D.pop(),_--),o[M]==="REPEATED"&&x--,M--;for(U=D.at(-1);(M<o.length-2||o[M+1]==="REPEATED")&&(_<H||o[M+1]==="REQUIRED");){if(M++,o[M]!=="REQUIRED"){const Z=[];U.push(Z),U=Z,D.push(Z),_++}o[M]==="REPEATED"&&x++}H===l?U.push(a[S++]):M===o.length-2?U.push(null):U.push([])}if(!t.length)for(let I=0;I<l;I++){const H=[];U.push(H),U=H}return t}function _r(t,r,s,a=0){const c=r.path.join("."),l=r.element.repetition_type==="OPTIONAL",h=l?a+1:a;if(ul(r)){let o=r.children[0],S=h;o.children.length===1&&(o=o.children[0],S++),_r(t,o,s,S);const D=o.path.join("."),U=t.get(D);if(!U)throw new Error("parquet list column missing values");l&&Xr(U,a),t.set(c,U),t.delete(D);return}if(cl(r)){const o=r.children[0].element.name;_r(t,r.children[0].children[0],s,h+1),_r(t,r.children[0].children[1],s,h+1);const S=t.get(`${c}.${o}.key`),D=t.get(`${c}.${o}.value`);if(!S)throw new Error("parquet map column missing keys");if(!D)throw new Error("parquet map column missing values");if(S.length!==D.length)throw new Error("parquet map column key/value length mismatch");const U=no(S,D,h);l&&Xr(U,a),t.delete(`${c}.${o}.key`),t.delete(`${c}.${o}.value`),t.set(c,U);return}if(r.children.length){const o=r.element.repetition_type==="REQUIRED"?a:a+1,S={};for(const U of r.children){_r(t,U,s,o);const M=t.get(U.path.join("."));if(!M)throw new Error("parquet struct missing child data");S[U.element.name]=M}for(const U of r.children)t.delete(U.path.join("."));let D=io(S,o);r.element.logical_type?.type==="VARIANT"&&(D=eo(D,s)),l&&Xr(D,a),t.set(c,D)}}function Xr(t,r){for(let s=0;s<t.length;s++)r?Xr(t[s],r-1):t[s]=t[s][0]}function no(t,r,s){const a=[];for(let c=0;c<t.length;c++)if(s)a.push(no(t[c],r[c],s-1));else if(t[c]){const l={};for(let h=0;h<t[c].length;h++){const o=r[c][h];l[t[c][h]]=o===void 0?null:o}a.push(l)}else a.push(void 0);return a}function io(t,r){const s=Object.keys(t),a=t[s[0]]?.length,c=[];for(let l=0;l<a;l++){const h={};for(const o of s){if(t[o].length!==a)throw new Error("parquet struct parsing error");h[o]=t[o][l]}r?c.push(io(h,r-1)):c.push(h)}return c}var ao=Ze((()=>{tr(),xl()}));function Sr(t,r,s){const a=s instanceof Int32Array,c=Vt(t),l=Vt(t);Vt(t);let h=Zn(t),o=0;s[o++]=a?Number(h):h;const S=c/l;for(;o<r;){const D=Zn(t),U=new Uint8Array(l);for(let M=0;M<l;M++)U[M]=t.view.getUint8(t.offset++);for(let M=0;M<l&&o<r;M++){const _=BigInt(U[M]);if(_){let x=0n,I=S;const H=(1n<<_)-1n;for(;I&&o<r;){let ee=BigInt(t.view.getUint8(t.offset))>>x&H;for(x+=_;x>=8;)x-=8n,t.offset++,x&&(ee|=BigInt(t.view.getUint8(t.offset))<<_-x&H);const Z=D+ee;h+=Z,s[o++]=a?Number(h):h,I--}I&&(t.offset+=Math.ceil((I*Number(_)+Number(x))/8))}else for(let x=0;x<S&&o<r;x++)h+=D,s[o++]=a?Number(h):h}}}function oo(t,r,s){const a=new Int32Array(r);Sr(t,r,a);for(let c=0;c<r;c++)s[c]=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,a[c]),t.offset+=a[c]}function Ul(t,r,s){const a=new Int32Array(r);Sr(t,r,a);const c=new Int32Array(r);Sr(t,r,c);for(let l=0;l<r;l++){const h=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,c[l]);a[l]?(s[l]=new Uint8Array(a[l]+c[l]),s[l].set(s[l-1].subarray(0,a[l])),s[l].set(h,a[l])):s[l]=h,t.offset+=c[l]}}var Ll=Ze((()=>{nr()}));function Bt(t,r,s,a){a===void 0&&(a=t.view.getUint32(t.offset,!0),t.offset+=4);const c=t.offset;let l=0;for(;l<s.length;){const h=Vt(t);if(h&1)l=Rl(t,h,r,s,l);else{const o=h>>>1;Ml(t,o,r,s,l),l+=o}}t.offset=c+a}function Ml(t,r,s,a,c){const l=s+7>>3;let h=0;for(let o=0;o<l;o++)h|=t.view.getUint8(t.offset++)<<(o<<3);for(let o=0;o<r;o++)a[c+o]=h}function Rl(t,r,s,a,c){let l=r>>1<<3;const h=(1<<s)-1;let o=0;if(t.offset<t.view.byteLength)o=t.view.getUint8(t.offset++);else if(h)throw new Error(`parquet bitpack offset ${t.offset} out of range`);let S=8,D=0;for(;l;)D>8?(D-=8,S-=8,o>>>=8):S-D<s?(o|=t.view.getUint8(t.offset)<<S,t.offset++,S+=8):(c<a.length&&(a[c++]=o>>D&h),l--,D+=s);return c}function so(t,r,s,a){const c=Nl(s,a),l=new Uint8Array(r*c);for(let h=0;h<c;h++)for(let o=0;o<r;o++)l[o*c+h]=t.view.getUint8(t.offset++);if(s==="FLOAT")return new Float32Array(l.buffer);if(s==="DOUBLE")return new Float64Array(l.buffer);if(s==="INT32")return new Int32Array(l.buffer);if(s==="INT64")return new BigInt64Array(l.buffer);if(s==="FIXED_LEN_BYTE_ARRAY"){const h=new Array(r);for(let o=0;o<r;o++)h[o]=l.subarray(o*c,(o+1)*c);return h}throw new Error(`parquet byte_stream_split unsupported type: ${s}`)}function Nl(t,r){switch(t){case"INT32":case"FLOAT":return 4;case"INT64":case"DOUBLE":return 8;case"FIXED_LEN_BYTE_ARRAY":if(!r)throw new Error("parquet byteWidth missing type_length");return r;default:throw new Error(`parquet unsupported type: ${t}`)}}var zl=Ze((()=>{nr()}));function ui(t,r,s,a){if(s===0)return[];if(r==="BOOLEAN")return jl(t,s);if(r==="INT32")return Vl(t,s);if(r==="INT64")return Gl(t,s);if(r==="INT96")return Hl(t,s);if(r==="FLOAT")return ql(t,s);if(r==="DOUBLE")return Wl(t,s);if(r==="BYTE_ARRAY")return $l(t,s);if(r==="FIXED_LEN_BYTE_ARRAY"){if(!a)throw new Error("parquet missing fixed length");return Zl(t,s,a)}else throw new Error(`parquet unhandled type: ${r}`)}function jl(t,r){const s=new Array(r);for(let a=0;a<r;a++){const c=t.offset+(a/8|0),l=a%8;s[a]=(t.view.getUint8(c)&1<<l)!==0}return t.offset+=Math.ceil(r/8),s}function Vl(t,r){const s=(t.view.byteOffset+t.offset)%4?new Int32Array(Jr(t.view.buffer,t.view.byteOffset+t.offset,r*4)):new Int32Array(t.view.buffer,t.view.byteOffset+t.offset,r);return t.offset+=r*4,s}function Gl(t,r){const s=(t.view.byteOffset+t.offset)%8?new BigInt64Array(Jr(t.view.buffer,t.view.byteOffset+t.offset,r*8)):new BigInt64Array(t.view.buffer,t.view.byteOffset+t.offset,r);return t.offset+=r*8,s}function Hl(t,r){const s=new Array(r);for(let a=0;a<r;a++){const c=t.view.getBigInt64(t.offset+a*12,!0),l=t.view.getInt32(t.offset+a*12+8,!0);s[a]=BigInt(l)<<64n|c}return t.offset+=r*12,s}function ql(t,r){const s=(t.view.byteOffset+t.offset)%4?new Float32Array(Jr(t.view.buffer,t.view.byteOffset+t.offset,r*4)):new Float32Array(t.view.buffer,t.view.byteOffset+t.offset,r);return t.offset+=r*4,s}function Wl(t,r){const s=(t.view.byteOffset+t.offset)%8?new Float64Array(Jr(t.view.buffer,t.view.byteOffset+t.offset,r*8)):new Float64Array(t.view.buffer,t.view.byteOffset+t.offset,r);return t.offset+=r*8,s}function $l(t,r){const s=new Array(r);for(let a=0;a<r;a++){const c=t.view.getUint32(t.offset,!0);t.offset+=4,s[a]=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,c),t.offset+=c}return s}function Zl(t,r,s){const a=new Array(r);for(let c=0;c<r;c++)a[c]=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,s),t.offset+=s;return a}function Jr(t,r,s){const a=new ArrayBuffer(s);return new Uint8Array(a).set(new Uint8Array(t,r,s)),a}var lo=Ze((()=>{}));function uo(t,r,s,a,c){for(let l=0;l<c;l++)s[a+l]=t[r+l]}function co(t,r){const s=t.byteLength,a=r.byteLength;let c=0,l=0;for(;c<s;){const h=t[c];if(c++,h<128)break}if(a&&c>=s)throw new Error("invalid snappy length header");for(;c<s;){const h=t[c];let o=0;if(c++,c>=s)throw new Error("missing eof marker");if((h&3)===0){let S=(h>>>2)+1;if(S>60){if(c+3>=s)throw new Error("snappy error literal pos + 3 >= inputLength");const D=S-60;S=t[c]+(t[c+1]<<8)+(t[c+2]<<16)+(t[c+3]<<24),S=(S&fo[D])+1,c+=D}if(c+S>s)throw new Error("snappy error literal exceeds input length");uo(t,c,r,l,S),c+=S,l+=S}else{let S=0;switch(h&3){case 1:o=(h>>>2&7)+4,S=t[c]+(h>>>5<<8),c++;break;case 2:if(s<=c+1)throw new Error("snappy error end of input");o=(h>>>2)+1,S=t[c]+(t[c+1]<<8),c+=2;break;case 3:if(s<=c+3)throw new Error("snappy error end of input");o=(h>>>2)+1,S=t[c]+(t[c+1]<<8)+(t[c+2]<<16)+(t[c+3]<<24),c+=4;break;default:break}if(S===0||isNaN(S))throw new Error(`invalid offset ${S} pos ${c} inputLength ${s}`);if(S>l)throw new Error("cannot copy from before start of buffer");uo(r,l-S,r,l,o),l+=o}}if(l!==a)throw new Error("premature end of input")}var fo,ho=Ze((()=>{fo=[0,255,65535,16777215,4294967295]}));function Yl(t,r,{type:s,element:a,schemaPath:c}){const l=new DataView(t.buffer,t.byteOffset,t.byteLength),h={view:l,offset:0};let o;const S=Xl(h,r,c),{definitionLevels:D,numNulls:U}=Jl(h,r,c),M=r.num_values-U;if(r.encoding==="PLAIN")o=ui(h,s,M,a.type_length);else if(r.encoding==="PLAIN_DICTIONARY"||r.encoding==="RLE_DICTIONARY"||r.encoding==="RLE"){const _=s==="BOOLEAN"?1:l.getUint8(h.offset++);_?(o=new Array(M),s==="BOOLEAN"?(Bt(h,_,o),o=o.map(x=>!!x)):Bt(h,_,o,l.byteLength-h.offset)):o=new Uint8Array(M)}else if(r.encoding==="BYTE_STREAM_SPLIT")o=so(h,M,s,a.type_length);else if(r.encoding==="DELTA_BINARY_PACKED")o=s==="INT32"?new Int32Array(M):new BigInt64Array(M),Sr(h,M,o);else if(r.encoding==="DELTA_LENGTH_BYTE_ARRAY")o=new Array(M),oo(h,M,o);else throw new Error(`parquet unsupported encoding: ${r.encoding}`);return{definitionLevels:D,repetitionLevels:S,dataPage:o}}function Xl(t,r,s){if(s.length>1){const a=Da(s);if(a){const c=new Array(r.num_values);return Bt(t,Kr(a),c),c}}return[]}function Jl(t,r,s){const a=Wn(s);if(!a)return{definitionLevels:[],numNulls:0};const c=new Array(r.num_values);Bt(t,Kr(a),c);let l=r.num_values;for(const h of c)h===a&&l--;return l===0&&(c.length=0),{definitionLevels:c,numNulls:l}}function ci(t,r,s,a){let c;const l=a?.[s];if(s==="UNCOMPRESSED")c=t;else if(l)c=l(t,r);else if(s==="SNAPPY")c=new Uint8Array(r),co(t,c);else throw new Error(`parquet unsupported compression codec: ${s}`);if(c?.length!==r)throw new Error(`parquet decompressed page length ${c?.length} does not match header ${r}`);return c}function Kl(t,r,s){const a={view:new DataView(t.buffer,t.byteOffset,t.byteLength),offset:0},{type:c,element:l,schemaPath:h,codec:o,compressors:S}=s,D=r.data_page_header_v2;if(!D)throw new Error("parquet data page header v2 is undefined");const U=Ql(a,D,h);a.offset=D.repetition_levels_byte_length;const M=eu(a,D,h),_=r.uncompressed_page_size-D.definition_levels_byte_length-D.repetition_levels_byte_length;let x=t.subarray(a.offset);D.is_compressed!==!1&&(x=ci(x,_,o,S));const I=new DataView(x.buffer,x.byteOffset,x.byteLength),H={view:I,offset:0};let ee;const Z=D.num_values-D.num_nulls;if(D.encoding==="PLAIN")ee=ui(H,c,Z,l.type_length);else if(D.encoding==="RLE")ee=new Array(Z),Bt(H,1,ee),ee=ee.map(K=>!!K);else if(D.encoding==="PLAIN_DICTIONARY"||D.encoding==="RLE_DICTIONARY"){const K=I.getUint8(H.offset++);ee=new Array(Z),Bt(H,K,ee,_-1)}else if(D.encoding==="DELTA_BINARY_PACKED")ee=c==="INT32"?new Int32Array(Z):new BigInt64Array(Z),Sr(H,Z,ee);else if(D.encoding==="DELTA_LENGTH_BYTE_ARRAY")ee=new Array(Z),oo(H,Z,ee);else if(D.encoding==="DELTA_BYTE_ARRAY")ee=new Array(Z),Ul(H,Z,ee);else if(D.encoding==="BYTE_STREAM_SPLIT")ee=so(H,Z,c,l.type_length);else throw new Error(`parquet unsupported encoding: ${D.encoding}`);return{definitionLevels:M,repetitionLevels:U,dataPage:ee}}function Ql(t,r,s){const a=Da(s);if(!a)return[];const c=new Array(r.num_values);return Bt(t,Kr(a),c,r.repetition_levels_byte_length),c}function eu(t,r,s){const a=Wn(s);if(a){const c=new Array(r.num_values);return Bt(t,Kr(a),c,r.definition_levels_byte_length),c}}function Kr(t){return 32-Math.clz32(t)}var tu=Ze((()=>{Ll(),zl(),lo(),tr(),ho()}));function po(t,{groupStart:r,selectStart:s,selectEnd:a},c,l){const{pathInSchema:h,schemaPath:o}=c,S=Ca(o),D=[];let U,M,_=0,x=0;const I=l&&(()=>{M&&l({pathInSchema:h,columnData:M,rowStart:r+_-M.length,rowEnd:r+_})});for(;(S?_<a:t.offset<t.view.byteLength-1)&&!(t.offset>=t.view.byteLength-1);){const H=ru(t);if(H.type==="DICTIONARY_PAGE"){const{data:ee}=vo(t,H,c,U,void 0,0);ee&&(U=Aa(ee,c))}else{const ee=M?.length||0,Z=vo(t,H,c,U,M,s-_);Z.skipped?(D.length||(x+=Z.skipped),_+=Z.skipped):Z.data&&M===Z.data?_+=Z.data.length-ee:Z.data&&Z.data.length&&(I?.(),D.push(Z.data),_+=Z.data.length,M=Z.data)}}return I?.(),{data:D,skipped:x}}function vo(t,r,s,a,c,l){const{type:h,element:o,schemaPath:S,codec:D,compressors:U}=s,M=new Uint8Array(t.view.buffer,t.view.byteOffset+t.offset,r.compressed_page_size);if(t.offset+=r.compressed_page_size,r.type==="DATA_PAGE"){const _=r.data_page_header;if(!_)throw new Error("parquet data page header is undefined");if(l>_.num_values&&Ca(S))return{skipped:_.num_values};const{definitionLevels:x,repetitionLevels:I,dataPage:H}=Yl(ci(M,Number(r.uncompressed_page_size),D,U),_,s),ee=Ea(H,a,_.encoding,s);return{skipped:0,data:ro(Array.isArray(c)?c:[],x,I,ee,S)}}else if(r.type==="DATA_PAGE_V2"){const _=r.data_page_header_v2;if(!_)throw new Error("parquet data page header v2 is undefined");if(l>_.num_rows)return{skipped:_.num_values};const{definitionLevels:x,repetitionLevels:I,dataPage:H}=Kl(M,r,s),ee=Ea(H,a,_.encoding,s);return{skipped:0,data:ro(Array.isArray(c)?c:[],x,I,ee,S)}}else if(r.type==="DICTIONARY_PAGE"){const _=r.dictionary_page_header;if(!_)throw new Error("parquet dictionary page header is undefined");const x=ci(M,Number(r.uncompressed_page_size),D,U);return{skipped:0,data:ui({view:new DataView(x.buffer,x.byteOffset,x.byteLength),offset:0},h,_.num_values,o.type_length)}}else throw new Error(`parquet unsupported page type: ${r.type}`)}function ru(t){const r=rr(t);return{type:zn[r.field_1],uncompressed_page_size:r.field_2,compressed_page_size:r.field_3,crc:r.field_4,data_page_header:r.field_5&&{num_values:r.field_5.field_1,encoding:Tt[r.field_5.field_2],definition_level_encoding:Tt[r.field_5.field_3],repetition_level_encoding:Tt[r.field_5.field_4],statistics:r.field_5.field_5&&{max:r.field_5.field_5.field_1,min:r.field_5.field_5.field_2,null_count:r.field_5.field_5.field_3,distinct_count:r.field_5.field_5.field_4,max_value:r.field_5.field_5.field_5,min_value:r.field_5.field_5.field_6}},index_page_header:r.field_6,dictionary_page_header:r.field_7&&{num_values:r.field_7.field_1,encoding:Tt[r.field_7.field_2],is_sorted:r.field_7.field_3},data_page_header_v2:r.field_8&&{num_values:r.field_8.field_1,num_nulls:r.field_8.field_2,num_rows:r.field_8.field_3,encoding:Tt[r.field_8.field_4],definition_levels_byte_length:r.field_8.field_5,repetition_levels_byte_length:r.field_8.field_6,is_compressed:r.field_8.field_7===void 0?!0:r.field_8.field_7,statistics:r.field_8.field_8}}}var nu=Ze((()=>{ao(),jn(),gr(),tu(),lo(),tr(),nr()}));function iu(t,{metadata:r},s){const a=[];for(const c of s.chunks){const{data_page_offset:l,dictionary_page_offset:h,path_in_schema:o}=c.columnMetadata,S=Pa(r.schema,o),D={pathInSchema:o,element:S[S.length-1].element,schemaPath:S,parsers:{...er,...t.parsers},...t,...c.columnMetadata};let{startByte:U,endByte:M}=c.range;if(!("offsetIndex"in c)){a.push({pathInSchema:o,data:Promise.resolve(t.file.slice(U,M)).then(_=>po({view:new DataView(_),offset:0},s,D,t.onPage))});continue}a.push({pathInSchema:o,data:Promise.resolve(t.file.slice(c.offsetIndex.startByte,c.offsetIndex.endByte)).then(async _=>{const{selectStart:x,selectEnd:I}=s,H=Ga({view:new DataView(_),offset:0}).page_locations;let ee=-1;const Z=h||l<H[0].offset;for(let Q=0;Q<H.length;Q++){const V=H[Q],te=Number(V.first_row_index),J=Q+1<H.length?Number(H[Q+1].first_row_index):s.groupRows;ee<0&&!Z&&J>x&&(U=Number(V.offset),ee=te),te<I&&(M=Number(V.offset)+V.compressed_page_size)}ee<0&&(ee=0);const K=await t.file.slice(U,M),{data:W,skipped:X}=po({view:new DataView(K),offset:0},ee?{...s,groupStart:s.groupStart+ee,selectStart:s.selectStart-ee,selectEnd:s.selectEnd-ee}:s,D,t.onPage);return{data:W,skipped:ee+X}})})}return{groupStart:s.groupStart,groupRows:s.groupRows,asyncColumns:a}}async function mo({asyncColumns:t},r,s,a,c){const l=await Promise.all(t.map(M=>M.data.then(({skipped:_,data:x})=>({skipped:_,data:oi(x)})))),h=s-r;if(c==="object"){const M=Array(h);for(let _=0;_<h;_++){const x={};for(let I=0;I<t.length;I++){const{data:H,skipped:ee}=l[I];x[t[I].pathInSchema[0]]=H[r+_-ee]}M[_]=x}return M}const o=t.map(M=>M.pathInSchema[0]).filter(M=>!a||a.includes(M)),S=a??o,D=S.map(M=>t.findIndex(_=>_.pathInSchema[0]===M)),U=Array(h);for(let M=0;M<h;M++){const _=Array(t.length);for(let x=0;x<S.length;x++){const I=D[x];if(I<0)throw new Error(`parquet column not found: ${S[x]}`);const{data:H,skipped:ee}=l[I];_[x]=H[r+M-ee]}U[M]=_}return U}function go(t,r,s){const{asyncColumns:a}=t;s={...er,...s};const c=[];for(const l of r.children)if(l.children.length){const h=a.filter(o=>o.pathInSchema[0]===l.element.name);if(!h.length)continue;c.push({pathInSchema:l.path,data:(async()=>{const o=await Promise.all(h.map(M=>M.data)),S=new Map;let D=1/0;for(let M=0;M<h.length;M++){const _=oi(o[M].data);S.set(h[M].pathInSchema.join("."),_),D=Math.min(D,_.length)}for(const[M,_]of S)_.length>D&&S.set(M,_.slice(0,D));_r(S,l,s);const U=S.get(l.element.name);if(!U)throw new Error("parquet column data not assembled");return{data:[U],skipped:0}})()})}else{const h=a.find(o=>o.pathInSchema[0]===l.element.name);h&&c.push(h)}return{...t,asyncColumns:c}}var au=Ze((()=>{ao(),nu(),gr(),Ha(),tr(),Hr()}));async function yo(t){t.metadata??(t.metadata=await yr(t.file,t));const{rowStart:r=0,rowEnd:s,columns:a,onChunk:c,onComplete:l,rowFormat:h,filter:o,filterStrict:S=!0}=t;if(o&&h!=="object")throw new Error('parquet filter requires rowFormat: "object"');const D=qr(o);if(D.length){const ee=Pt(t.metadata).children.map(K=>K.element.name),Z=D.filter(K=>!ee.includes(K));if(Z.length)throw new Error(`parquet filter columns not found: ${Z.join(", ")}`)}let U=a,M=!1;if(a&&o){const ee=D.filter(Z=>!a.includes(Z));ee.length&&(U=[...a,...ee],M=!0)}let _=U!==a?{...t,columns:U}:t;_=await bo(_);const x=wo(_);if(!l&&!c){await Qr(x);return}const I=Pt(t.metadata),H=x.map(ee=>go(ee,I,t.parsers));if(c)for(const ee of H)for(const Z of ee.asyncColumns)Z.data.then(({data:K,skipped:W})=>{let X=ee.groupStart+W;for(const Q of K)c({columnName:Z.pathInSchema[0],columnData:Q,rowStart:X,rowEnd:X+Q.length}),X+=Q.length},()=>{});if(l){await Qr(H);const ee=[];for(const Z of H){const K=Math.max(r-Z.groupStart,0),W=Math.min((s??1/0)-Z.groupStart,Z.groupRows),X=h==="object"?await mo(Z,K,W,U,"object"):await mo(Z,K,W,a,"array");if(o){for(const Q of X)if(wr(Q,o,S)){if(M&&a)for(const V of D)a.includes(V)||delete Q[V];ee.push(Q)}}else ai(ee,X)}l(ee)}else await Qr(H)}async function Qr(t){const r=t.flatMap(a=>a.asyncColumns.map(c=>c.data)),s=(await Promise.allSettled(r)).find(a=>a.status==="rejected");if(s)throw s.reason}function wo(t){if(!t.metadata)throw new Error("parquet requires metadata");const r=kl(t);return t.file=Pl(t.file,r),r.groups.map(s=>iu(t,r,s))}async function ou(t){if(t.columns?.length!==1)throw new Error("parquetReadColumn expected columns: [columnName]");t.metadata??(t.metadata=await yr(t.file,t));const r=wo(await bo(t)),s=Pt(t.metadata),a=r.map(l=>go(l,s,t.parsers));await Qr(a);const c=[];for(const l of a){const{data:h}=await l.asyncColumns[0].data;for(const o of h)ai(c,o)}return c}async function bo(t){if(!t.useBloomFilters||!t.filter||!t.metadata)return t;const r=Pt(t.metadata),s={};for(const c of r.children)s[c.element.name]=c.element;const a=await Tl({file:t.file,metadata:t.metadata,filter:t.filter,filterStrict:t.filterStrict});return{...t,bloomFiltersByGroup:a,schemaElements:s}}function lr(t){return new Promise((r,s)=>{yo({...t,rowFormat:"object",onComplete:r}).catch(s)})}var _o=Ze((()=>{Ka(),ar(),Fl(),au(),Hr()}));async function su(t){if(!t.file||!(t.file.byteLength>=0))throw new Error("parquet expected AsyncBuffer");t.metadata??(t.metadata=await yr(t.file,t));const{metadata:r,rowStart:s=0,columns:a,orderBy:c,filter:l}=t;if(s<0)throw new Error("parquet rowStart must be positive");const h=t.rowEnd??Number(r.num_rows);if(c&&!Pt(t.metadata).children.map(o=>o.element.name).includes(c))throw new Error(`parquet orderBy column not found: ${c}`);if(l&&!c&&h<r.num_rows){const o=[];let S=0;for(const D of r.row_groups){const U=S+Number(D.num_rows),M=await lr({...t,rowStart:S,rowEnd:U});if(o.push(...M),o.length>=h)break;S=U}return o.slice(s,h)}else if(l&&c){const o=a&&!a.includes(c)?[...a,c]:a,S=await lr({...t,rowStart:void 0,rowEnd:void 0,columns:o});if(S.sort((D,U)=>So(D[c],U[c])),o!==a)for(const D of S)delete D[c];return S.slice(s,h)}else{if(l)return(await lr({...t,rowStart:void 0,rowEnd:void 0})).slice(s,h);if(typeof c=="string"){const o=await ou({...t,rowStart:void 0,rowEnd:void 0,columns:[c]}),S=Array.from(o,(U,M)=>M).sort((U,M)=>So(o[U],o[M])).slice(s,h),D=await lu({...t,rows:S});return S.map(U=>D[U])}else return await lr(t)}}async function lu(t){const{file:r,rows:s}=t;t.metadata??(t.metadata=await yr(r,t));const{row_groups:a}=t.metadata,c=Array(a.length).fill(!1);let l=0;const h=a.map(U=>l+=Number(U.num_rows));for(const U of s){const M=h.findIndex(_=>U<_);c[M]=!0}const o=[];let S;l=0;for(let U=0;U<c.length;U++){const M=l+Number(a[U].num_rows);c[U]?S===void 0&&(S=l):S!==void 0&&(o.push([S,M]),S=void 0),l=M}S!==void 0&&o.push([S,l]);const D=Array(Number(t.metadata.num_rows));for(const[U,M]of o){const _=await lr({...t,rowStart:U,rowEnd:M});for(let x=U;x<M;x++)D[x]={__index__:x,..._[x-U]}}return D}function So(t,r){return t<r?-1:t>r?1:0}var uu=Ze((()=>{ar(),_o()})),cu=xr({asyncBufferFromUrl:()=>Sl,byteLengthFromUrl:()=>Ja,cachedAsyncBuffer:()=>El,flatten:()=>oi,parquetMetadata:()=>Kn,parquetMetadataAsync:()=>yr,parquetQuery:()=>su,parquetRead:()=>yo,parquetReadObjects:()=>lr,parquetSchema:()=>Pt,readColumnIndex:()=>ml,readOffsetIndex:()=>Ga,snappyUncompress:()=>co,toJson:()=>ii}),fu=Ze((()=>{Ha(),ar(),_o(),uu(),ho(),Hr()})),en=je((t=>{t.byteLength=S,t.toByteArray=U,t.fromByteArray=x;for(var r=[],s=[],a=typeof Uint8Array<"u"?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,h=c.length;l<h;++l)r[l]=c[l],s[c.charCodeAt(l)]=l;s[45]=62,s[95]=63;function o(I){var H=I.length;if(H%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var ee=I.indexOf("=");ee===-1&&(ee=H);var Z=ee===H?0:4-ee%4;return[ee,Z]}function S(I){var H=o(I),ee=H[0],Z=H[1];return(ee+Z)*3/4-Z}function D(I,H,ee){return(H+ee)*3/4-ee}function U(I){var H,ee=o(I),Z=ee[0],K=ee[1],W=new a(D(I,Z,K)),X=0,Q=K>0?Z-4:Z,V;for(V=0;V<Q;V+=4)H=s[I.charCodeAt(V)]<<18|s[I.charCodeAt(V+1)]<<12|s[I.charCodeAt(V+2)]<<6|s[I.charCodeAt(V+3)],W[X++]=H>>16&255,W[X++]=H>>8&255,W[X++]=H&255;return K===2&&(H=s[I.charCodeAt(V)]<<2|s[I.charCodeAt(V+1)]>>4,W[X++]=H&255),K===1&&(H=s[I.charCodeAt(V)]<<10|s[I.charCodeAt(V+1)]<<4|s[I.charCodeAt(V+2)]>>2,W[X++]=H>>8&255,W[X++]=H&255),W}function M(I){return r[I>>18&63]+r[I>>12&63]+r[I>>6&63]+r[I&63]}function _(I,H,ee){for(var Z,K=[],W=H;W<ee;W+=3)Z=(I[W]<<16&16711680)+(I[W+1]<<8&65280)+(I[W+2]&255),K.push(M(Z));return K.join("")}function x(I){for(var H,ee=I.length,Z=ee%3,K=[],W=16383,X=0,Q=ee-Z;X<Q;X+=W)K.push(_(I,X,X+W>Q?Q:X+W));return Z===1?(H=I[ee-1],K.push(r[H>>2]+r[H<<4&63]+"==")):Z===2&&(H=(I[ee-2]<<8)+I[ee-1],K.push(r[H>>10]+r[H>>4&63]+r[H<<2&63]+"=")),K.join("")}})),du=je((t=>{t.read=function(r,s,a,c,l){var h,o,S=l*8-c-1,D=(1<<S)-1,U=D>>1,M=-7,_=a?l-1:0,x=a?-1:1,I=r[s+_];for(_+=x,h=I&(1<<-M)-1,I>>=-M,M+=S;M>0;h=h*256+r[s+_],_+=x,M-=8);for(o=h&(1<<-M)-1,h>>=-M,M+=c;M>0;o=o*256+r[s+_],_+=x,M-=8);if(h===0)h=1-U;else{if(h===D)return o?NaN:(I?-1:1)*(1/0);o=o+Math.pow(2,c),h=h-U}return(I?-1:1)*o*Math.pow(2,h-c)},t.write=function(r,s,a,c,l,h){var o,S,D,U=h*8-l-1,M=(1<<U)-1,_=M>>1,x=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=c?0:h-1,H=c?1:-1,ee=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(S=isNaN(s)?1:0,o=M):(o=Math.floor(Math.log(s)/Math.LN2),s*(D=Math.pow(2,-o))<1&&(o--,D*=2),o+_>=1?s+=x/D:s+=x*Math.pow(2,1-_),s*D>=2&&(o++,D/=2),o+_>=M?(S=0,o=M):o+_>=1?(S=(s*D-1)*Math.pow(2,l),o=o+_):(S=s*Math.pow(2,_-1)*Math.pow(2,l),o=0));l>=8;r[a+I]=S&255,I+=H,S/=256,l-=8);for(o=o<<l|S,U+=l;U>0;r[a+I]=o&255,I+=H,o/=256,U-=8);r[a+I-H]|=ee*128}})),Er=je((t=>{var r=en(),s=du(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=K,t.INSPECT_MAX_BYTES=50;var c=2147483647;t.kMaxLength=c,o.TYPED_ARRAY_SUPPORT=l(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{const v=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(v,i),v.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function h(v){if(v>c)throw new RangeError('The value "'+v+'" is invalid for option "size"');const i=new Uint8Array(v);return Object.setPrototypeOf(i,o.prototype),i}function o(v,i,n){if(typeof v=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(v)}return S(v,i,n)}o.poolSize=8192;function S(v,i,n){if(typeof v=="string")return _(v,i);if(ArrayBuffer.isView(v))return I(v);if(v==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof v);if(F(v,ArrayBuffer)||v&&F(v.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(v,SharedArrayBuffer)||v&&F(v.buffer,SharedArrayBuffer)))return H(v,i,n);if(typeof v=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const w=v.valueOf&&v.valueOf();if(w!=null&&w!==v)return o.from(w,i,n);const E=ee(v);if(E)return E;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof v[Symbol.toPrimitive]=="function")return o.from(v[Symbol.toPrimitive]("string"),i,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof v)}o.from=function(v,i,n){return S(v,i,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function D(v){if(typeof v!="number")throw new TypeError('"size" argument must be of type number');if(v<0)throw new RangeError('The value "'+v+'" is invalid for option "size"')}function U(v,i,n){return D(v),v<=0?h(v):i!==void 0?typeof n=="string"?h(v).fill(i,n):h(v).fill(i):h(v)}o.alloc=function(v,i,n){return U(v,i,n)};function M(v){return D(v),h(v<0?0:Z(v)|0)}o.allocUnsafe=function(v){return M(v)},o.allocUnsafeSlow=function(v){return M(v)};function _(v,i){if((typeof i!="string"||i==="")&&(i="utf8"),!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);const n=W(v,i)|0;let w=h(n);const E=w.write(v,i);return E!==n&&(w=w.slice(0,E)),w}function x(v){const i=v.length<0?0:Z(v.length)|0,n=h(i);for(let w=0;w<i;w+=1)n[w]=v[w]&255;return n}function I(v){if(F(v,Uint8Array)){const i=new Uint8Array(v);return H(i.buffer,i.byteOffset,i.byteLength)}return x(v)}function H(v,i,n){if(i<0||v.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(v.byteLength<i+(n||0))throw new RangeError('"length" is outside of buffer bounds');let w;return i===void 0&&n===void 0?w=new Uint8Array(v):n===void 0?w=new Uint8Array(v,i):w=new Uint8Array(v,i,n),Object.setPrototypeOf(w,o.prototype),w}function ee(v){if(o.isBuffer(v)){const i=Z(v.length)|0,n=h(i);return n.length===0||v.copy(n,0,0,i),n}if(v.length!==void 0)return typeof v.length!="number"||e(v.length)?h(0):x(v);if(v.type==="Buffer"&&Array.isArray(v.data))return x(v.data)}function Z(v){if(v>=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return v|0}function K(v){return+v!=v&&(v=0),o.alloc(+v)}o.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==o.prototype},o.compare=function(i,n){if(F(i,Uint8Array)&&(i=o.from(i,i.offset,i.byteLength)),F(n,Uint8Array)&&(n=o.from(n,n.offset,n.byteLength)),!o.isBuffer(i)||!o.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===n)return 0;let w=i.length,E=n.length;for(let C=0,R=Math.min(w,E);C<R;++C)if(i[C]!==n[C]){w=i[C],E=n[C];break}return w<E?-1:E<w?1:0},o.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(i,n){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return o.alloc(0);let w;if(n===void 0)for(n=0,w=0;w<i.length;++w)n+=i[w].length;const E=o.allocUnsafe(n);let C=0;for(w=0;w<i.length;++w){let R=i[w];if(F(R,Uint8Array))C+R.length>E.length?(o.isBuffer(R)||(R=o.from(R)),R.copy(E,C)):Uint8Array.prototype.set.call(E,R,C);else if(o.isBuffer(R))R.copy(E,C);else throw new TypeError('"list" argument must be an Array of Buffers');C+=R.length}return E};function W(v,i){if(o.isBuffer(v))return v.length;if(ArrayBuffer.isView(v)||F(v,ArrayBuffer))return v.byteLength;if(typeof v!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof v);const n=v.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&n===0)return 0;let E=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return le(v).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return O(v).length;default:if(E)return w?-1:le(v).length;i=(""+i).toLowerCase(),E=!0}}o.byteLength=W;function X(v,i,n){let w=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,i>>>=0,n<=i))return"";for(v||(v="utf8");;)switch(v){case"hex":return ve(this,i,n);case"utf8":case"utf-8":return L(this,i,n);case"ascii":return z(this,i,n);case"latin1":case"binary":return Y(this,i,n);case"base64":return g(this,i,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return we(this,i,n);default:if(w)throw new TypeError("Unknown encoding: "+v);v=(v+"").toLowerCase(),w=!0}}o.prototype._isBuffer=!0;function Q(v,i,n){const w=v[i];v[i]=v[n],v[n]=w}o.prototype.swap16=function(){const i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<i;n+=2)Q(this,n,n+1);return this},o.prototype.swap32=function(){const i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<i;n+=4)Q(this,n,n+3),Q(this,n+1,n+2);return this},o.prototype.swap64=function(){const i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<i;n+=8)Q(this,n,n+7),Q(this,n+1,n+6),Q(this,n+2,n+5),Q(this,n+3,n+4);return this},o.prototype.toString=function(){const i=this.length;return i===0?"":arguments.length===0?L(this,0,i):X.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(i){if(!o.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:o.compare(this,i)===0},o.prototype.inspect=function(){let i="";const n=t.INSPECT_MAX_BYTES;return i=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(i+=" ... "),"<Buffer "+i+">"},a&&(o.prototype[a]=o.prototype.inspect),o.prototype.compare=function(i,n,w,E,C){if(F(i,Uint8Array)&&(i=o.from(i,i.offset,i.byteLength)),!o.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(n===void 0&&(n=0),w===void 0&&(w=i?i.length:0),E===void 0&&(E=0),C===void 0&&(C=this.length),n<0||w>i.length||E<0||C>this.length)throw new RangeError("out of range index");if(E>=C&&n>=w)return 0;if(E>=C)return-1;if(n>=w)return 1;if(n>>>=0,w>>>=0,E>>>=0,C>>>=0,this===i)return 0;let R=C-E,oe=w-n;const ue=Math.min(R,oe),re=this.slice(E,C),he=i.slice(n,w);for(let A=0;A<ue;++A)if(re[A]!==he[A]){R=re[A],oe=he[A];break}return R<oe?-1:oe<R?1:0};function V(v,i,n,w,E){if(v.length===0)return-1;if(typeof n=="string"?(w=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,e(n)&&(n=E?0:v.length-1),n<0&&(n=v.length+n),n>=v.length){if(E)return-1;n=v.length-1}else if(n<0)if(E)n=0;else return-1;if(typeof i=="string"&&(i=o.from(i,w)),o.isBuffer(i))return i.length===0?-1:te(v,i,n,w,E);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?E?Uint8Array.prototype.indexOf.call(v,i,n):Uint8Array.prototype.lastIndexOf.call(v,i,n):te(v,[i],n,w,E);throw new TypeError("val must be string, number or Buffer")}function te(v,i,n,w,E){let C=1,R=v.length,oe=i.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(v.length<2||i.length<2)return-1;C=2,R/=2,oe/=2,n/=2}function ue(he,A){return C===1?he[A]:he.readUInt16BE(A*C)}let re;if(E){let he=-1;for(re=n;re<R;re++)if(ue(v,re)===ue(i,he===-1?0:re-he)){if(he===-1&&(he=re),re-he+1===oe)return he*C}else he!==-1&&(re-=re-he),he=-1}else for(n+oe>R&&(n=R-oe),re=n;re>=0;re--){let he=!0;for(let A=0;A<oe;A++)if(ue(v,re+A)!==ue(i,A)){he=!1;break}if(he)return re}return-1}o.prototype.includes=function(i,n,w){return this.indexOf(i,n,w)!==-1},o.prototype.indexOf=function(i,n,w){return V(this,i,n,w,!0)},o.prototype.lastIndexOf=function(i,n,w){return V(this,i,n,w,!1)};function J(v,i,n,w){n=Number(n)||0;const E=v.length-n;w?(w=Number(w),w>E&&(w=E)):w=E;const C=i.length;w>C/2&&(w=C/2);let R;for(R=0;R<w;++R){const oe=parseInt(i.substr(R*2,2),16);if(e(oe))return R;v[n+R]=oe}return R}function G(v,i,n,w){return y(le(i,v.length-n),v,n,w)}function $(v,i,n,w){return y(p(i),v,n,w)}function ce(v,i,n,w){return y(O(i),v,n,w)}function se(v,i,n,w){return y(m(i,v.length-n),v,n,w)}o.prototype.write=function(i,n,w,E){if(n===void 0)E="utf8",w=this.length,n=0;else if(w===void 0&&typeof n=="string")E=n,w=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(w)?(w=w>>>0,E===void 0&&(E="utf8")):(E=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const C=this.length-n;if((w===void 0||w>C)&&(w=C),i.length>0&&(w<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");E||(E="utf8");let R=!1;for(;;)switch(E){case"hex":return J(this,i,n,w);case"utf8":case"utf-8":return G(this,i,n,w);case"ascii":case"latin1":case"binary":return $(this,i,n,w);case"base64":return ce(this,i,n,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return se(this,i,n,w);default:if(R)throw new TypeError("Unknown encoding: "+E);E=(""+E).toLowerCase(),R=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function g(v,i,n){return i===0&&n===v.length?r.fromByteArray(v):r.fromByteArray(v.slice(i,n))}function L(v,i,n){n=Math.min(v.length,n);const w=[];let E=i;for(;E<n;){const C=v[E];let R=null,oe=C>239?4:C>223?3:C>191?2:1;if(E+oe<=n){let ue,re,he,A;switch(oe){case 1:C<128&&(R=C);break;case 2:ue=v[E+1],(ue&192)===128&&(A=(C&31)<<6|ue&63,A>127&&(R=A));break;case 3:ue=v[E+1],re=v[E+2],(ue&192)===128&&(re&192)===128&&(A=(C&15)<<12|(ue&63)<<6|re&63,A>2047&&(A<55296||A>57343)&&(R=A));break;case 4:ue=v[E+1],re=v[E+2],he=v[E+3],(ue&192)===128&&(re&192)===128&&(he&192)===128&&(A=(C&15)<<18|(ue&63)<<12|(re&63)<<6|he&63,A>65535&&A<1114112&&(R=A))}}R===null?(R=65533,oe=1):R>65535&&(R-=65536,w.push(R>>>10&1023|55296),R=56320|R&1023),w.push(R),E+=oe}return ne(w)}var j=4096;function ne(v){const i=v.length;if(i<=j)return String.fromCharCode.apply(String,v);let n="",w=0;for(;w<i;)n+=String.fromCharCode.apply(String,v.slice(w,w+=j));return n}function z(v,i,n){let w="";n=Math.min(v.length,n);for(let E=i;E<n;++E)w+=String.fromCharCode(v[E]&127);return w}function Y(v,i,n){let w="";n=Math.min(v.length,n);for(let E=i;E<n;++E)w+=String.fromCharCode(v[E]);return w}function ve(v,i,n){const w=v.length;(!i||i<0)&&(i=0),(!n||n<0||n>w)&&(n=w);let E="";for(let C=i;C<n;++C)E+=u[v[C]];return E}function we(v,i,n){const w=v.slice(i,n);let E="";for(let C=0;C<w.length-1;C+=2)E+=String.fromCharCode(w[C]+w[C+1]*256);return E}o.prototype.slice=function(i,n){const w=this.length;i=~~i,n=n===void 0?w:~~n,i<0?(i+=w,i<0&&(i=0)):i>w&&(i=w),n<0?(n+=w,n<0&&(n=0)):n>w&&(n=w),n<i&&(n=i);const E=this.subarray(i,n);return Object.setPrototypeOf(E,o.prototype),E};function _e(v,i,n){if(v%1!==0||v<0)throw new RangeError("offset is not uint");if(v+i>n)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(i,n,w){i=i>>>0,n=n>>>0,w||_e(i,n,this.length);let E=this[i],C=1,R=0;for(;++R<n&&(C*=256);)E+=this[i+R]*C;return E},o.prototype.readUintBE=o.prototype.readUIntBE=function(i,n,w){i=i>>>0,n=n>>>0,w||_e(i,n,this.length);let E=this[i+--n],C=1;for(;n>0&&(C*=256);)E+=this[i+--n]*C;return E},o.prototype.readUint8=o.prototype.readUInt8=function(i,n){return i=i>>>0,n||_e(i,1,this.length),this[i]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(i,n){return i=i>>>0,n||_e(i,2,this.length),this[i]|this[i+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(i,n){return i=i>>>0,n||_e(i,2,this.length),this[i]<<8|this[i+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(i,n){return i=i>>>0,n||_e(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(i,n){return i=i>>>0,n||_e(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},o.prototype.readBigUInt64LE=f(function(i){i=i>>>0,Ce(i,"offset");const n=this[i],w=this[i+7];(n===void 0||w===void 0)&&Ge(i,this.length-8);const E=n+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,C=this[++i]+this[++i]*2**8+this[++i]*2**16+w*2**24;return BigInt(E)+(BigInt(C)<<BigInt(32))}),o.prototype.readBigUInt64BE=f(function(i){i=i>>>0,Ce(i,"offset");const n=this[i],w=this[i+7];(n===void 0||w===void 0)&&Ge(i,this.length-8);const E=n*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],C=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+w;return(BigInt(E)<<BigInt(32))+BigInt(C)}),o.prototype.readIntLE=function(i,n,w){i=i>>>0,n=n>>>0,w||_e(i,n,this.length);let E=this[i],C=1,R=0;for(;++R<n&&(C*=256);)E+=this[i+R]*C;return C*=128,E>=C&&(E-=Math.pow(2,8*n)),E},o.prototype.readIntBE=function(i,n,w){i=i>>>0,n=n>>>0,w||_e(i,n,this.length);let E=n,C=1,R=this[i+--E];for(;E>0&&(C*=256);)R+=this[i+--E]*C;return C*=128,R>=C&&(R-=Math.pow(2,8*n)),R},o.prototype.readInt8=function(i,n){return i=i>>>0,n||_e(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},o.prototype.readInt16LE=function(i,n){i=i>>>0,n||_e(i,2,this.length);const w=this[i]|this[i+1]<<8;return w&32768?w|4294901760:w},o.prototype.readInt16BE=function(i,n){i=i>>>0,n||_e(i,2,this.length);const w=this[i+1]|this[i]<<8;return w&32768?w|4294901760:w},o.prototype.readInt32LE=function(i,n){return i=i>>>0,n||_e(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},o.prototype.readInt32BE=function(i,n){return i=i>>>0,n||_e(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},o.prototype.readBigInt64LE=f(function(i){i=i>>>0,Ce(i,"offset");const n=this[i],w=this[i+7];(n===void 0||w===void 0)&&Ge(i,this.length-8);const E=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(w<<24);return(BigInt(E)<<BigInt(32))+BigInt(n+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),o.prototype.readBigInt64BE=f(function(i){i=i>>>0,Ce(i,"offset");const n=this[i],w=this[i+7];(n===void 0||w===void 0)&&Ge(i,this.length-8);const E=(n<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(E)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+w)}),o.prototype.readFloatLE=function(i,n){return i=i>>>0,n||_e(i,4,this.length),s.read(this,i,!0,23,4)},o.prototype.readFloatBE=function(i,n){return i=i>>>0,n||_e(i,4,this.length),s.read(this,i,!1,23,4)},o.prototype.readDoubleLE=function(i,n){return i=i>>>0,n||_e(i,8,this.length),s.read(this,i,!0,52,8)},o.prototype.readDoubleBE=function(i,n){return i=i>>>0,n||_e(i,8,this.length),s.read(this,i,!1,52,8)};function ie(v,i,n,w,E,C){if(!o.isBuffer(v))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>E||i<C)throw new RangeError('"value" argument is out of bounds');if(n+w>v.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(i,n,w,E){if(i=+i,n=n>>>0,w=w>>>0,!E){const oe=Math.pow(2,8*w)-1;ie(this,i,n,w,oe,0)}let C=1,R=0;for(this[n]=i&255;++R<w&&(C*=256);)this[n+R]=i/C&255;return n+w},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(i,n,w,E){if(i=+i,n=n>>>0,w=w>>>0,!E){const oe=Math.pow(2,8*w)-1;ie(this,i,n,w,oe,0)}let C=w-1,R=1;for(this[n+C]=i&255;--C>=0&&(R*=256);)this[n+C]=i/R&255;return n+w},o.prototype.writeUint8=o.prototype.writeUInt8=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,1,255,0),this[n]=i&255,n+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,2,65535,0),this[n]=i&255,this[n+1]=i>>>8,n+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,2,65535,0),this[n]=i>>>8,this[n+1]=i&255,n+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,4,4294967295,0),this[n+3]=i>>>24,this[n+2]=i>>>16,this[n+1]=i>>>8,this[n]=i&255,n+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,4,4294967295,0),this[n]=i>>>24,this[n+1]=i>>>16,this[n+2]=i>>>8,this[n+3]=i&255,n+4};function pe(v,i,n,w,E){Me(i,w,E,v,n,7);let C=Number(i&BigInt(4294967295));v[n++]=C,C=C>>8,v[n++]=C,C=C>>8,v[n++]=C,C=C>>8,v[n++]=C;let R=Number(i>>BigInt(32)&BigInt(4294967295));return v[n++]=R,R=R>>8,v[n++]=R,R=R>>8,v[n++]=R,R=R>>8,v[n++]=R,n}function fe(v,i,n,w,E){Me(i,w,E,v,n,7);let C=Number(i&BigInt(4294967295));v[n+7]=C,C=C>>8,v[n+6]=C,C=C>>8,v[n+5]=C,C=C>>8,v[n+4]=C;let R=Number(i>>BigInt(32)&BigInt(4294967295));return v[n+3]=R,R=R>>8,v[n+2]=R,R=R>>8,v[n+1]=R,R=R>>8,v[n]=R,n+8}o.prototype.writeBigUInt64LE=f(function(i,n=0){return pe(this,i,n,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=f(function(i,n=0){return fe(this,i,n,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(i,n,w,E){if(i=+i,n=n>>>0,!E){const ue=Math.pow(2,8*w-1);ie(this,i,n,w,ue-1,-ue)}let C=0,R=1,oe=0;for(this[n]=i&255;++C<w&&(R*=256);)i<0&&oe===0&&this[n+C-1]!==0&&(oe=1),this[n+C]=(i/R>>0)-oe&255;return n+w},o.prototype.writeIntBE=function(i,n,w,E){if(i=+i,n=n>>>0,!E){const ue=Math.pow(2,8*w-1);ie(this,i,n,w,ue-1,-ue)}let C=w-1,R=1,oe=0;for(this[n+C]=i&255;--C>=0&&(R*=256);)i<0&&oe===0&&this[n+C+1]!==0&&(oe=1),this[n+C]=(i/R>>0)-oe&255;return n+w},o.prototype.writeInt8=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,1,127,-128),i<0&&(i=255+i+1),this[n]=i&255,n+1},o.prototype.writeInt16LE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,2,32767,-32768),this[n]=i&255,this[n+1]=i>>>8,n+2},o.prototype.writeInt16BE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,2,32767,-32768),this[n]=i>>>8,this[n+1]=i&255,n+2},o.prototype.writeInt32LE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,4,2147483647,-2147483648),this[n]=i&255,this[n+1]=i>>>8,this[n+2]=i>>>16,this[n+3]=i>>>24,n+4},o.prototype.writeInt32BE=function(i,n,w){return i=+i,n=n>>>0,w||ie(this,i,n,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[n]=i>>>24,this[n+1]=i>>>16,this[n+2]=i>>>8,this[n+3]=i&255,n+4},o.prototype.writeBigInt64LE=f(function(i,n=0){return pe(this,i,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=f(function(i,n=0){return fe(this,i,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ge(v,i,n,w,E,C){if(n+w>v.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ke(v,i,n,w,E){return i=+i,n=n>>>0,E||ge(v,i,n,4,34028234663852886e22,-34028234663852886e22),s.write(v,i,n,w,23,4),n+4}o.prototype.writeFloatLE=function(i,n,w){return ke(this,i,n,!0,w)},o.prototype.writeFloatBE=function(i,n,w){return ke(this,i,n,!1,w)};function Ee(v,i,n,w,E){return i=+i,n=n>>>0,E||ge(v,i,n,8,17976931348623157e292,-17976931348623157e292),s.write(v,i,n,w,52,8),n+8}o.prototype.writeDoubleLE=function(i,n,w){return Ee(this,i,n,!0,w)},o.prototype.writeDoubleBE=function(i,n,w){return Ee(this,i,n,!1,w)},o.prototype.copy=function(i,n,w,E){if(!o.isBuffer(i))throw new TypeError("argument should be a Buffer");if(w||(w=0),!E&&E!==0&&(E=this.length),n>=i.length&&(n=i.length),n||(n=0),E>0&&E<w&&(E=w),E===w||i.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("sourceEnd out of bounds");E>this.length&&(E=this.length),i.length-n<E-w&&(E=i.length-n+w);const C=E-w;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,w,E):Uint8Array.prototype.set.call(i,this.subarray(w,E),n),C},o.prototype.fill=function(i,n,w,E){if(typeof i=="string"){if(typeof n=="string"?(E=n,n=0,w=this.length):typeof w=="string"&&(E=w,w=this.length),E!==void 0&&typeof E!="string")throw new TypeError("encoding must be a string");if(typeof E=="string"&&!o.isEncoding(E))throw new TypeError("Unknown encoding: "+E);if(i.length===1){const R=i.charCodeAt(0);(E==="utf8"&&R<128||E==="latin1")&&(i=R)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(n<0||this.length<n||this.length<w)throw new RangeError("Out of range index");if(w<=n)return this;n=n>>>0,w=w===void 0?this.length:w>>>0,i||(i=0);let C;if(typeof i=="number")for(C=n;C<w;++C)this[C]=i;else{const R=o.isBuffer(i)?i:o.from(i,E),oe=R.length;if(oe===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(C=0;C<w-n;++C)this[C+n]=R[C%oe]}return this};var Ie={};function De(v,i,n){Ie[v]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${v}]`,this.stack,delete this.name}get code(){return v}set code(E){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:E,writable:!0})}toString(){return`${this.name} [${v}]: ${this.message}`}}}De("ERR_BUFFER_OUT_OF_BOUNDS",function(v){return v?`${v} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),De("ERR_INVALID_ARG_TYPE",function(v,i){return`The "${v}" argument must be of type number. Received type ${typeof i}`},TypeError),De("ERR_OUT_OF_RANGE",function(v,i,n){let w=`The value of "${v}" is out of range.`,E=n;return Number.isInteger(n)&&Math.abs(n)>2**32?E=Ue(String(n)):typeof n=="bigint"&&(E=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(E=Ue(E)),E+="n"),w+=` It must be ${i}. Received ${E}`,w},RangeError);function Ue(v){let i="",n=v.length;const w=v[0]==="-"?1:0;for(;n>=w+4;n-=3)i=`_${v.slice(n-3,n)}${i}`;return`${v.slice(0,n)}${i}`}function Ne(v,i,n){Ce(i,"offset"),(v[i]===void 0||v[i+n]===void 0)&&Ge(i,v.length-(n+1))}function Me(v,i,n,w,E,C){if(v>n||v<i){const R=typeof i=="bigint"?"n":"";let oe;throw C>3?i===0||i===BigInt(0)?oe=`>= 0${R} and < 2${R} ** ${(C+1)*8}${R}`:oe=`>= -(2${R} ** ${(C+1)*8-1}${R}) and < 2 ** ${(C+1)*8-1}${R}`:oe=`>= ${i}${R} and <= ${n}${R}`,new Ie.ERR_OUT_OF_RANGE("value",oe,v)}Ne(w,E,C)}function Ce(v,i){if(typeof v!="number")throw new Ie.ERR_INVALID_ARG_TYPE(i,"number",v)}function Ge(v,i,n){throw Math.floor(v)!==v?(Ce(v,n),new Ie.ERR_OUT_OF_RANGE(n||"offset","an integer",v)):i<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${i}`,v)}var qe=/[^+/0-9A-Za-z-_]/g;function ae(v){if(v=v.split("=")[0],v=v.trim().replace(qe,""),v.length<2)return"";for(;v.length%4!==0;)v=v+"=";return v}function le(v,i){i=i||1/0;let n;const w=v.length;let E=null;const C=[];for(let R=0;R<w;++R){if(n=v.charCodeAt(R),n>55295&&n<57344){if(!E){if(n>56319){(i-=3)>-1&&C.push(239,191,189);continue}else if(R+1===w){(i-=3)>-1&&C.push(239,191,189);continue}E=n;continue}if(n<56320){(i-=3)>-1&&C.push(239,191,189),E=n;continue}n=(E-55296<<10|n-56320)+65536}else E&&(i-=3)>-1&&C.push(239,191,189);if(E=null,n<128){if((i-=1)<0)break;C.push(n)}else if(n<2048){if((i-=2)<0)break;C.push(n>>6|192,n&63|128)}else if(n<65536){if((i-=3)<0)break;C.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((i-=4)<0)break;C.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return C}function p(v){const i=[];for(let n=0;n<v.length;++n)i.push(v.charCodeAt(n)&255);return i}function m(v,i){let n,w,E;const C=[];for(let R=0;R<v.length&&!((i-=2)<0);++R)n=v.charCodeAt(R),w=n>>8,E=n%256,C.push(E),C.push(w);return C}function O(v){return r.toByteArray(ae(v))}function y(v,i,n,w){let E;for(E=0;E<w&&!(E+n>=i.length||E>=v.length);++E)i[E+n]=v[E];return E}function F(v,i){return v instanceof i||v!=null&&v.constructor!=null&&v.constructor.name!=null&&v.constructor.name===i.name}function e(v){return v!==v}var u=(function(){const v="0123456789abcdef",i=new Array(256);for(let n=0;n<16;++n){const w=n*16;for(let E=0;E<16;++E)i[w+E]=v[n]+v[E]}return i})();function f(v){return typeof BigInt>"u"?k:v}function k(){throw new Error("BigInt not supported")}})),hu=je(((t,r)=>{var s=Er().Buffer;function a(H){if(H!=="md5")throw new Error("only md5 is supported in the browser");return new c}function c(){this.data=void 0}c.prototype.end=function(H){this.data=H},c.prototype.read=function(){return x(this.data)};function l(H,ee){var Z=H[0],K=H[1],W=H[2],X=H[3];Z=o(Z,K,W,X,ee[0],7,-680876936),X=o(X,Z,K,W,ee[1],12,-389564586),W=o(W,X,Z,K,ee[2],17,606105819),K=o(K,W,X,Z,ee[3],22,-1044525330),Z=o(Z,K,W,X,ee[4],7,-176418897),X=o(X,Z,K,W,ee[5],12,1200080426),W=o(W,X,Z,K,ee[6],17,-1473231341),K=o(K,W,X,Z,ee[7],22,-45705983),Z=o(Z,K,W,X,ee[8],7,1770035416),X=o(X,Z,K,W,ee[9],12,-1958414417),W=o(W,X,Z,K,ee[10],17,-42063),K=o(K,W,X,Z,ee[11],22,-1990404162),Z=o(Z,K,W,X,ee[12],7,1804603682),X=o(X,Z,K,W,ee[13],12,-40341101),W=o(W,X,Z,K,ee[14],17,-1502002290),K=o(K,W,X,Z,ee[15],22,1236535329),Z=S(Z,K,W,X,ee[1],5,-165796510),X=S(X,Z,K,W,ee[6],9,-1069501632),W=S(W,X,Z,K,ee[11],14,643717713),K=S(K,W,X,Z,ee[0],20,-373897302),Z=S(Z,K,W,X,ee[5],5,-701558691),X=S(X,Z,K,W,ee[10],9,38016083),W=S(W,X,Z,K,ee[15],14,-660478335),K=S(K,W,X,Z,ee[4],20,-405537848),Z=S(Z,K,W,X,ee[9],5,568446438),X=S(X,Z,K,W,ee[14],9,-1019803690),W=S(W,X,Z,K,ee[3],14,-187363961),K=S(K,W,X,Z,ee[8],20,1163531501),Z=S(Z,K,W,X,ee[13],5,-1444681467),X=S(X,Z,K,W,ee[2],9,-51403784),W=S(W,X,Z,K,ee[7],14,1735328473),K=S(K,W,X,Z,ee[12],20,-1926607734),Z=D(Z,K,W,X,ee[5],4,-378558),X=D(X,Z,K,W,ee[8],11,-2022574463),W=D(W,X,Z,K,ee[11],16,1839030562),K=D(K,W,X,Z,ee[14],23,-35309556),Z=D(Z,K,W,X,ee[1],4,-1530992060),X=D(X,Z,K,W,ee[4],11,1272893353),W=D(W,X,Z,K,ee[7],16,-155497632),K=D(K,W,X,Z,ee[10],23,-1094730640),Z=D(Z,K,W,X,ee[13],4,681279174),X=D(X,Z,K,W,ee[0],11,-358537222),W=D(W,X,Z,K,ee[3],16,-722521979),K=D(K,W,X,Z,ee[6],23,76029189),Z=D(Z,K,W,X,ee[9],4,-640364487),X=D(X,Z,K,W,ee[12],11,-421815835),W=D(W,X,Z,K,ee[15],16,530742520),K=D(K,W,X,Z,ee[2],23,-995338651),Z=U(Z,K,W,X,ee[0],6,-198630844),X=U(X,Z,K,W,ee[7],10,1126891415),W=U(W,X,Z,K,ee[14],15,-1416354905),K=U(K,W,X,Z,ee[5],21,-57434055),Z=U(Z,K,W,X,ee[12],6,1700485571),X=U(X,Z,K,W,ee[3],10,-1894986606),W=U(W,X,Z,K,ee[10],15,-1051523),K=U(K,W,X,Z,ee[1],21,-2054922799),Z=U(Z,K,W,X,ee[8],6,1873313359),X=U(X,Z,K,W,ee[15],10,-30611744),W=U(W,X,Z,K,ee[6],15,-1560198380),K=U(K,W,X,Z,ee[13],21,1309151649),Z=U(Z,K,W,X,ee[4],6,-145523070),X=U(X,Z,K,W,ee[11],10,-1120210379),W=U(W,X,Z,K,ee[2],15,718787259),K=U(K,W,X,Z,ee[9],21,-343485551),H[0]=I(Z,H[0]),H[1]=I(K,H[1]),H[2]=I(W,H[2]),H[3]=I(X,H[3])}function h(H,ee,Z,K,W,X){return ee=I(I(ee,H),I(K,X)),I(ee<<W|ee>>>32-W,Z)}function o(H,ee,Z,K,W,X,Q){return h(ee&Z|~ee&K,H,ee,W,X,Q)}function S(H,ee,Z,K,W,X,Q){return h(ee&K|Z&~K,H,ee,W,X,Q)}function D(H,ee,Z,K,W,X,Q){return h(ee^Z^K,H,ee,W,X,Q)}function U(H,ee,Z,K,W,X,Q){return h(Z^(ee|~K),H,ee,W,X,Q)}function M(H){var ee=H.length,Z=[1732584193,-271733879,-1732584194,271733878],K;for(K=64;K<=H.length;K+=64)l(Z,_(H.substring(K-64,K)));H=H.substring(K-64);var W=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(K=0;K<H.length;K++)W[K>>2]|=H.charCodeAt(K)<<(K%4<<3);if(W[K>>2]|=128<<(K%4<<3),K>55)for(l(Z,W),K=0;K<16;K++)W[K]=0;return W[14]=ee*8,l(Z,W),Z}function _(H){var ee=[],Z;for(Z=0;Z<64;Z+=4)ee[Z>>2]=H.charCodeAt(Z)+(H.charCodeAt(Z+1)<<8)+(H.charCodeAt(Z+2)<<16)+(H.charCodeAt(Z+3)<<24);return ee}function x(H){var ee=M(H),Z=s.alloc?s.alloc(16):new s(16),K;for(K=0;K<4;K++)Z.writeIntLE(ee[K],K*4,4);return Z}function I(H,ee){return H+ee&4294967295}r.exports={createHash:a}})),Eo=je(((t,r)=>{r.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var a={},c=Symbol("test"),l=Object(c);if(typeof c=="string"||Object.prototype.toString.call(c)!=="[object Symbol]"||Object.prototype.toString.call(l)!=="[object Symbol]")return!1;var h=42;a[c]=h;for(var o in a)return!1;if(typeof Object.keys=="function"&&Object.keys(a).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(a).length!==0)return!1;var S=Object.getOwnPropertySymbols(a);if(S.length!==1||S[0]!==c||!Object.prototype.propertyIsEnumerable.call(a,c))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var D=Object.getOwnPropertyDescriptor(a,c);if(D.value!==h||D.enumerable!==!0)return!1}return!0}})),Ar=je(((t,r)=>{var s=Eo();r.exports=function(){return s()&&!!Symbol.toStringTag}})),pu=je(((t,r)=>{r.exports=Object})),vu=je(((t,r)=>{r.exports=Error})),mu=je(((t,r)=>{r.exports=EvalError})),gu=je(((t,r)=>{r.exports=RangeError})),yu=je(((t,r)=>{r.exports=ReferenceError})),Ao=je(((t,r)=>{r.exports=SyntaxError})),Ir=je(((t,r)=>{r.exports=TypeError})),wu=je(((t,r)=>{r.exports=URIError})),bu=je(((t,r)=>{r.exports=Math.abs})),_u=je(((t,r)=>{r.exports=Math.floor})),Su=je(((t,r)=>{r.exports=Math.max})),Eu=je(((t,r)=>{r.exports=Math.min})),Au=je(((t,r)=>{r.exports=Math.pow})),Iu=je(((t,r)=>{r.exports=Math.round})),ku=je(((t,r)=>{r.exports=Number.isNaN||function(a){return a!==a}})),Tu=je(((t,r)=>{var s=ku();r.exports=function(c){return s(c)||c===0?c:c<0?-1:1}})),Pu=je(((t,r)=>{r.exports=Object.getOwnPropertyDescriptor})),Ht=je(((t,r)=>{var s=Pu();if(s)try{s([],"length")}catch{s=null}r.exports=s})),tn=je(((t,r)=>{var s=Object.defineProperty||!1;if(s)try{s({},"a",{value:1})}catch{s=!1}r.exports=s})),Fu=je(((t,r)=>{var s=typeof Symbol<"u"&&Symbol,a=Eo();r.exports=function(){return typeof s!="function"||typeof Symbol!="function"||typeof s("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:a()}})),Io=je(((t,r)=>{r.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null})),Du=je(((t,r)=>{r.exports=Object})),ko=je(((t,r)=>{var s=Du();r.exports=s.getPrototypeOf||null})),Cu=je(((t,r)=>{var s="Function.prototype.bind called on incompatible ",a=Object.prototype.toString,c=Math.max,l="[object Function]",h=function(U,M){for(var _=[],x=0;x<U.length;x+=1)_[x]=U[x];for(var I=0;I<M.length;I+=1)_[I+U.length]=M[I];return _},o=function(U,M){for(var _=[],x=M||0,I=0;x<U.length;x+=1,I+=1)_[I]=U[x];return _},S=function(D,U){for(var M="",_=0;_<D.length;_+=1)M+=D[_],_+1<D.length&&(M+=U);return M};r.exports=function(U){var M=this;if(typeof M!="function"||a.apply(M)!==l)throw new TypeError(s+M);for(var _=o(arguments,1),x,I=function(){if(this instanceof x){var W=M.apply(this,h(_,arguments));return Object(W)===W?W:this}return M.apply(U,h(_,arguments))},H=c(0,M.length-_.length),ee=[],Z=0;Z<H;Z++)ee[Z]="$"+Z;if(x=Function("binder","return function ("+S(ee,",")+"){ return binder.apply(this,arguments); }")(I),M.prototype){var K=function(){};K.prototype=M.prototype,x.prototype=new K,K.prototype=null}return x}})),kr=je(((t,r)=>{var s=Cu();r.exports=Function.prototype.bind||s})),fi=je(((t,r)=>{r.exports=Function.prototype.call})),di=je(((t,r)=>{r.exports=Function.prototype.apply})),Ou=je(((t,r)=>{r.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply})),To=je(((t,r)=>{var s=kr(),a=di(),c=fi(),l=Ou();r.exports=l||s.call(c,a)})),hi=je(((t,r)=>{var s=kr(),a=Ir(),c=fi(),l=To();r.exports=function(o){if(o.length<1||typeof o[0]!="function")throw new a("a function is required");return l(s,c,o)}})),Bu=je(((t,r)=>{var s=hi(),a=Ht(),c;try{c=[].__proto__===Array.prototype}catch(S){if(!S||typeof S!="object"||!("code"in S)||S.code!=="ERR_PROTO_ACCESS")throw S}var l=!!c&&a&&a(Object.prototype,"__proto__"),h=Object,o=h.getPrototypeOf;r.exports=l&&typeof l.get=="function"?s([l.get]):typeof o=="function"?function(D){return o(D==null?D:h(D))}:!1})),rn=je(((t,r)=>{var s=Io(),a=ko(),c=Bu();r.exports=s?function(h){return s(h)}:a?function(h){if(!h||typeof h!="object"&&typeof h!="function")throw new TypeError("getProto: not an object");return a(h)}:c?function(h){return c(h)}:null})),Po=je(((t,r)=>{var s=Function.prototype.call,a=Object.prototype.hasOwnProperty,c=kr();r.exports=c.call(s,a)})),Fo=je(((t,r)=>{var s,a=pu(),c=vu(),l=mu(),h=gu(),o=yu(),S=Ao(),D=Ir(),U=wu(),M=bu(),_=_u(),x=Su(),I=Eu(),H=Au(),ee=Iu(),Z=Tu(),K=Function,W=function(Ue){try{return K('"use strict"; return ('+Ue+").constructor;")()}catch{}},X=Ht(),Q=tn(),V=function(){throw new D},te=X?(function(){try{return arguments.callee,V}catch{try{return X(arguments,"callee").get}catch{return V}}})():V,J=Fu()(),G=rn(),$=ko(),ce=Io(),se=di(),g=fi(),L={},j=typeof Uint8Array>"u"||!G?s:G(Uint8Array),ne={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?s:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?s:ArrayBuffer,"%ArrayIteratorPrototype%":J&&G?G([][Symbol.iterator]()):s,"%AsyncFromSyncIteratorPrototype%":s,"%AsyncFunction%":L,"%AsyncGenerator%":L,"%AsyncGeneratorFunction%":L,"%AsyncIteratorPrototype%":L,"%Atomics%":typeof Atomics>"u"?s:Atomics,"%BigInt%":typeof BigInt>"u"?s:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?s:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?s:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?s:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":c,"%eval%":eval,"%EvalError%":l,"%Float16Array%":typeof Float16Array>"u"?s:Float16Array,"%Float32Array%":typeof Float32Array>"u"?s:Float32Array,"%Float64Array%":typeof Float64Array>"u"?s:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?s:FinalizationRegistry,"%Function%":K,"%GeneratorFunction%":L,"%Int8Array%":typeof Int8Array>"u"?s:Int8Array,"%Int16Array%":typeof Int16Array>"u"?s:Int16Array,"%Int32Array%":typeof Int32Array>"u"?s:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":J&&G?G(G([][Symbol.iterator]())):s,"%JSON%":typeof JSON=="object"?JSON:s,"%Map%":typeof Map>"u"?s:Map,"%MapIteratorPrototype%":typeof Map>"u"||!J||!G?s:G(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":a,"%Object.getOwnPropertyDescriptor%":X,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?s:Promise,"%Proxy%":typeof Proxy>"u"?s:Proxy,"%RangeError%":h,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?s:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?s:Set,"%SetIteratorPrototype%":typeof Set>"u"||!J||!G?s:G(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?s:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":J&&G?G(""[Symbol.iterator]()):s,"%Symbol%":J?Symbol:s,"%SyntaxError%":S,"%ThrowTypeError%":te,"%TypedArray%":j,"%TypeError%":D,"%Uint8Array%":typeof Uint8Array>"u"?s:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?s:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?s:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?s:Uint32Array,"%URIError%":U,"%WeakMap%":typeof WeakMap>"u"?s:WeakMap,"%WeakRef%":typeof WeakRef>"u"?s:WeakRef,"%WeakSet%":typeof WeakSet>"u"?s:WeakSet,"%Function.prototype.call%":g,"%Function.prototype.apply%":se,"%Object.defineProperty%":Q,"%Object.getPrototypeOf%":$,"%Math.abs%":M,"%Math.floor%":_,"%Math.max%":x,"%Math.min%":I,"%Math.pow%":H,"%Math.round%":ee,"%Math.sign%":Z,"%Reflect.getPrototypeOf%":ce};if(G)try{null.error}catch(Ue){ne["%Error.prototype%"]=G(G(Ue))}var z=function Ue(Ne){var Me;if(Ne==="%AsyncFunction%")Me=W("async function () {}");else if(Ne==="%GeneratorFunction%")Me=W("function* () {}");else if(Ne==="%AsyncGeneratorFunction%")Me=W("async function* () {}");else if(Ne==="%AsyncGenerator%"){var Ce=Ue("%AsyncGeneratorFunction%");Ce&&(Me=Ce.prototype)}else if(Ne==="%AsyncIteratorPrototype%"){var Ge=Ue("%AsyncGenerator%");Ge&&G&&(Me=G(Ge.prototype))}return ne[Ne]=Me,Me},Y={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ve=kr(),we=Po(),_e=ve.call(g,Array.prototype.concat),ie=ve.call(se,Array.prototype.splice),pe=ve.call(g,String.prototype.replace),fe=ve.call(g,String.prototype.slice),ge=ve.call(g,RegExp.prototype.exec),ke=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ee=/\\(\\)?/g,Ie=function(Ne){var Me=fe(Ne,0,1),Ce=fe(Ne,-1);if(Me==="%"&&Ce!=="%")throw new S("invalid intrinsic syntax, expected closing `%`");if(Ce==="%"&&Me!=="%")throw new S("invalid intrinsic syntax, expected opening `%`");var Ge=[];return pe(Ne,ke,function(qe,ae,le,p){Ge[Ge.length]=le?pe(p,Ee,"$1"):ae||qe}),Ge},De=function(Ne,Me){var Ce=Ne,Ge;if(we(Y,Ce)&&(Ge=Y[Ce],Ce="%"+Ge[0]+"%"),we(ne,Ce)){var qe=ne[Ce];if(qe===L&&(qe=z(Ce)),typeof qe>"u"&&!Me)throw new D("intrinsic "+Ne+" exists, but is not available. Please file an issue!");return{alias:Ge,name:Ce,value:qe}}throw new S("intrinsic "+Ne+" does not exist!")};r.exports=function(Ne,Me){if(typeof Ne!="string"||Ne.length===0)throw new D("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Me!="boolean")throw new D('"allowMissing" argument must be a boolean');if(ge(/^%?[^%]*%?$/,Ne)===null)throw new S("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Ce=Ie(Ne),Ge=Ce.length>0?Ce[0]:"",qe=De("%"+Ge+"%",Me),ae=qe.name,le=qe.value,p=!1,m=qe.alias;m&&(Ge=m[0],ie(Ce,_e([0,1],m)));for(var O=1,y=!0;O<Ce.length;O+=1){var F=Ce[O],e=fe(F,0,1),u=fe(F,-1);if((e==='"'||e==="'"||e==="`"||u==='"'||u==="'"||u==="`")&&e!==u)throw new S("property names with quotes must have matching quotes");if((F==="constructor"||!y)&&(p=!0),Ge+="."+F,ae="%"+Ge+"%",we(ne,ae))le=ne[ae];else if(le!=null){if(!(F in le)){if(!Me)throw new D("base intrinsic for "+Ne+" exists, but the property is not available.");return}if(X&&O+1>=Ce.length){var f=X(le,F);y=!!f,y&&"get"in f&&!("originalValue"in f.get)?le=f.get:le=le[F]}else y=we(le,F),le=le[F];y&&!p&&(ne[ae]=le)}}return le}})),ur=je(((t,r)=>{var s=Fo(),a=hi(),c=a([s("%String.prototype.indexOf%")]);r.exports=function(h,o){var S=s(h,!!o);return typeof S=="function"&&c(h,".prototype.")>-1?a([S]):S}})),xu=je(((t,r)=>{var s=Ar()(),a=ur()("Object.prototype.toString"),c=function(S){return s&&S&&typeof S=="object"&&Symbol.toStringTag in S?!1:a(S)==="[object Arguments]"},l=function(S){return c(S)?!0:S!==null&&typeof S=="object"&&"length"in S&&typeof S.length=="number"&&S.length>=0&&a(S)!=="[object Array]"&&"callee"in S&&a(S.callee)==="[object Function]"},h=(function(){return c(arguments)})();c.isLegacyArguments=l,r.exports=h?c:l})),Uu=je(((t,r)=>{var s=ur(),a=Ar()(),c=Po(),l=Ht(),h;if(a){var o=s("RegExp.prototype.exec"),S={},D=function(){throw S},U={toString:D,valueOf:D};typeof Symbol.toPrimitive=="symbol"&&(U[Symbol.toPrimitive]=D),h=function(I){if(!I||typeof I!="object")return!1;var H=l(I,"lastIndex");if(!(H&&c(H,"value")))return!1;try{o(I,U)}catch(ee){return ee===S}}}else{var M=s("Object.prototype.toString"),_="[object RegExp]";h=function(I){return!I||typeof I!="object"&&typeof I!="function"?!1:M(I)===_}}r.exports=h})),Lu=je(((t,r)=>{var s=ur(),a=Uu(),c=s("RegExp.prototype.exec"),l=Ir();r.exports=function(o){if(!a(o))throw new l("`regex` must be a RegExp");return function(D){return c(o,D)!==null}}})),Mu=je(((t,r)=>{var s=function*(){}.constructor;r.exports=()=>s})),Ru=je(((t,r)=>{var s=ur(),a=Lu()(/^\s*(?:function)?\*/),c=Ar()(),l=rn(),h=s("Object.prototype.toString"),o=s("Function.prototype.toString"),S=Mu();r.exports=function(U){if(typeof U!="function")return!1;if(a(o(U)))return!0;if(!c)return h(U)==="[object GeneratorFunction]";if(!l)return!1;var M=S();return M&&l(U)===M.prototype}})),Nu=je(((t,r)=>{var s=Function.prototype.toString,a=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,c,l;if(typeof a=="function"&&typeof Object.defineProperty=="function")try{c=Object.defineProperty({},"length",{get:function(){throw l}}),l={},a(function(){throw 42},null,c)}catch(X){X!==l&&(a=null)}else a=null;var h=/^\s*class\b/,o=function(Q){try{var V=s.call(Q);return h.test(V)}catch{return!1}},S=function(Q){try{return o(Q)?!1:(s.call(Q),!0)}catch{return!1}},D=Object.prototype.toString,U="[object Object]",M="[object Function]",_="[object GeneratorFunction]",x="[object HTMLAllCollection]",I="[object HTML document.all class]",H="[object HTMLCollection]",ee=typeof Symbol=="function"&&!!Symbol.toStringTag,Z=!(0 in[,]),K=function(){return!1};if(typeof document=="object"){var W=document.all;D.call(W)===D.call(document.all)&&(K=function(Q){if((Z||!Q)&&(typeof Q>"u"||typeof Q=="object"))try{var V=D.call(Q);return(V===x||V===I||V===H||V===U)&&Q("")==null}catch{}return!1})}r.exports=a?function(Q){if(K(Q))return!0;if(!Q||typeof Q!="function"&&typeof Q!="object")return!1;try{a(Q,null,c)}catch(V){if(V!==l)return!1}return!o(Q)&&S(Q)}:function(Q){if(K(Q))return!0;if(!Q||typeof Q!="function"&&typeof Q!="object")return!1;if(ee)return S(Q);if(o(Q))return!1;var V=D.call(Q);return V!==M&&V!==_&&!/^\[object HTML/.test(V)?!1:S(Q)}})),Do=je(((t,r)=>{var s=Nu(),a=Object.prototype.toString,c=Object.prototype.hasOwnProperty,l=function(U,M,_){for(var x=0,I=U.length;x<I;x++)c.call(U,x)&&(_==null?M(U[x],x,U):M.call(_,U[x],x,U))},h=function(U,M,_){for(var x=0,I=U.length;x<I;x++)_==null?M(U.charAt(x),x,U):M.call(_,U.charAt(x),x,U)},o=function(U,M,_){for(var x in U)c.call(U,x)&&(_==null?M(U[x],x,U):M.call(_,U[x],x,U))};function S(D){return a.call(D)==="[object Array]"}r.exports=function(U,M,_){if(!s(M))throw new TypeError("iterator must be a function");var x;arguments.length>=3&&(x=_),S(U)?l(U,M,x):typeof U=="string"?h(U,M,x):o(U,M,x)}})),zu=je(((t,r)=>{r.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]})),Co=je(((t,r)=>{var s=zu(),a=typeof globalThis>"u"?global:globalThis;r.exports=function(){for(var l=[],h=0;h<s.length;h++)typeof a[s[h]]=="function"&&(l[l.length]=s[h]);return l}})),ju=je(((t,r)=>{var s=tn(),a=Ao(),c=Ir(),l=Ht();r.exports=function(o,S,D){if(!o||typeof o!="object"&&typeof o!="function")throw new c("`obj` must be an object or a function`");if(typeof S!="string"&&typeof S!="symbol")throw new c("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new c("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new c("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new c("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new c("`loose`, if provided, must be a boolean");var U=arguments.length>3?arguments[3]:null,M=arguments.length>4?arguments[4]:null,_=arguments.length>5?arguments[5]:null,x=arguments.length>6?arguments[6]:!1,I=!!l&&l(o,S);if(s)s(o,S,{configurable:_===null&&I?I.configurable:!_,enumerable:U===null&&I?I.enumerable:!U,value:D,writable:M===null&&I?I.writable:!M});else if(x||!U&&!M&&!_)o[S]=D;else throw new a("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}})),Vu=je(((t,r)=>{var s=tn(),a=function(){return!!s};a.hasArrayLengthDefineBug=function(){if(!s)return null;try{return s([],"length",{value:1}).length!==1}catch{return!0}},r.exports=a})),Gu=je(((t,r)=>{var s=Fo(),a=ju(),c=Vu()(),l=Ht(),h=Ir(),o=s("%Math.floor%");r.exports=function(D,U){if(typeof D!="function")throw new h("`fn` is not a function");if(typeof U!="number"||U<0||U>4294967295||o(U)!==U)throw new h("`length` must be a positive 32-bit integer");var M=arguments.length>2&&!!arguments[2],_=!0,x=!0;if("length"in D&&l){var I=l(D,"length");I&&!I.configurable&&(_=!1),I&&!I.writable&&(x=!1)}return(_||x||!M)&&(c?a(D,"length",U,!0,!0):a(D,"length",U)),D}})),Hu=je(((t,r)=>{var s=kr(),a=di(),c=To();r.exports=function(){return c(s,a,arguments)}})),Oo=je(((t,r)=>{var s=Gu(),a=tn(),c=hi(),l=Hu();r.exports=function(o){var S=c(arguments),D=1+o.length-(arguments.length-1);return s(S,D>0?D:0,!0)},a?a(r.exports,"apply",{value:l}):r.exports.apply=l})),qu=je(((t,r)=>{var s=Do(),a=Co(),c=Oo(),l=ur(),h=Ht(),o=rn(),S=l("Object.prototype.toString"),D=Ar()(),U=typeof globalThis>"u"?global:globalThis,M=a(),_=l("String.prototype.slice"),x=l("Array.prototype.indexOf",!0)||function(W,X){for(var Q=0;Q<W.length;Q+=1)if(W[Q]===X)return Q;return-1},I={__proto__:null};D&&h&&o?s(M,function(K){var W=new U[K];if(Symbol.toStringTag in W&&o){var X=o(W),Q=h(X,Symbol.toStringTag);if(!Q&&X&&(Q=h(o(X),Symbol.toStringTag)),Q&&Q.get){var V=c(Q.get);I["$"+K]=V}}}):s(M,function(K){var W=new U[K],X=W.slice||W.set;if(X){var Q=c(X);I["$"+K]=Q}});function H(K){var W=!1;return s(I,function(X,Q){if(!W)try{"$"+X(K)===Q&&(W=_(Q,1))}catch{}}),W}function ee(K){var W=!1;return s(I,function(X,Q){if(!W)try{X(K),W=_(Q,1)}catch{}}),W}function Z(K){return x(M,K)>-1}r.exports=function(W){if(!W||typeof W!="object")return!1;if(!D){var X=_(S(W),8,-1);return Z(X)?X:X!=="Object"?!1:ee(W)}return h?H(W):null}})),Wu=je(((t,r)=>{var s=Do(),a=Co(),c=Oo(),l=ur(),h=Ht(),o=rn(),S=l("Object.prototype.toString"),D=Ar()(),U=typeof globalThis>"u"?global:globalThis,M=a(),_=l("String.prototype.slice"),x=l("Array.prototype.indexOf",!0)||function(K,W){for(var X=0;X<K.length;X+=1)if(K[X]===W)return X;return-1},I={__proto__:null};D&&h&&o?s(M,function(Z){var K=new U[Z];if(Symbol.toStringTag in K&&o){var W=o(K),X=h(W,Symbol.toStringTag);if(!X&&W&&(X=h(o(W),Symbol.toStringTag)),X&&X.get){var Q=c(X.get);I["$"+Z]=Q}}}):s(M,function(Z){var K=new U[Z],W=K.slice||K.set;if(W){var X=c(W);I["$"+Z]=X}});var H=function(K){var W=!1;return s(I,function(X,Q){if(!W)try{"$"+X(K)===Q&&(W=_(Q,1))}catch{}}),W},ee=function(K){var W=!1;return s(I,function(X,Q){if(!W)try{X(K),W=_(Q,1)}catch{}}),W};r.exports=function(K){if(!K||typeof K!="object")return!1;if(!D){var W=_(S(K),8,-1);return x(M,W)>-1?W:W!=="Object"?!1:ee(K)}return h?H(K):null}})),$u=je(((t,r)=>{var s=Wu();r.exports=function(c){return!!s(c)}})),Zu=je((t=>{var r=xu(),s=Ru(),a=qu(),c=$u();function l(m){return m.call.bind(m)}var h=typeof BigInt<"u",o=typeof Symbol<"u",S=l(Object.prototype.toString),D=l(Number.prototype.valueOf),U=l(String.prototype.valueOf),M=l(Boolean.prototype.valueOf);if(h)var _=l(BigInt.prototype.valueOf);if(o)var x=l(Symbol.prototype.valueOf);function I(m,O){if(typeof m!="object")return!1;try{return O(m),!0}catch{return!1}}t.isArgumentsObject=r,t.isGeneratorFunction=s,t.isTypedArray=c;function H(m){return typeof Promise<"u"&&m instanceof Promise||m!==null&&typeof m=="object"&&typeof m.then=="function"&&typeof m.catch=="function"}t.isPromise=H;function ee(m){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(m):c(m)||pe(m)}t.isArrayBufferView=ee;function Z(m){return a(m)==="Uint8Array"}t.isUint8Array=Z;function K(m){return a(m)==="Uint8ClampedArray"}t.isUint8ClampedArray=K;function W(m){return a(m)==="Uint16Array"}t.isUint16Array=W;function X(m){return a(m)==="Uint32Array"}t.isUint32Array=X;function Q(m){return a(m)==="Int8Array"}t.isInt8Array=Q;function V(m){return a(m)==="Int16Array"}t.isInt16Array=V;function te(m){return a(m)==="Int32Array"}t.isInt32Array=te;function J(m){return a(m)==="Float32Array"}t.isFloat32Array=J;function G(m){return a(m)==="Float64Array"}t.isFloat64Array=G;function $(m){return a(m)==="BigInt64Array"}t.isBigInt64Array=$;function ce(m){return a(m)==="BigUint64Array"}t.isBigUint64Array=ce;function se(m){return S(m)==="[object Map]"}se.working=typeof Map<"u"&&se(new Map);function g(m){return typeof Map>"u"?!1:se.working?se(m):m instanceof Map}t.isMap=g;function L(m){return S(m)==="[object Set]"}L.working=typeof Set<"u"&&L(new Set);function j(m){return typeof Set>"u"?!1:L.working?L(m):m instanceof Set}t.isSet=j;function ne(m){return S(m)==="[object WeakMap]"}ne.working=typeof WeakMap<"u"&&ne(new WeakMap);function z(m){return typeof WeakMap>"u"?!1:ne.working?ne(m):m instanceof WeakMap}t.isWeakMap=z;function Y(m){return S(m)==="[object WeakSet]"}Y.working=typeof WeakSet<"u"&&Y(new WeakSet);function ve(m){return Y(m)}t.isWeakSet=ve;function we(m){return S(m)==="[object ArrayBuffer]"}we.working=typeof ArrayBuffer<"u"&&we(new ArrayBuffer);function _e(m){return typeof ArrayBuffer>"u"?!1:we.working?we(m):m instanceof ArrayBuffer}t.isArrayBuffer=_e;function ie(m){return S(m)==="[object DataView]"}ie.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ie(new DataView(new ArrayBuffer(1),0,1));function pe(m){return typeof DataView>"u"?!1:ie.working?ie(m):m instanceof DataView}t.isDataView=pe;var fe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ge(m){return S(m)==="[object SharedArrayBuffer]"}function ke(m){return typeof fe>"u"?!1:(typeof ge.working>"u"&&(ge.working=ge(new fe)),ge.working?ge(m):m instanceof fe)}t.isSharedArrayBuffer=ke;function Ee(m){return S(m)==="[object AsyncFunction]"}t.isAsyncFunction=Ee;function Ie(m){return S(m)==="[object Map Iterator]"}t.isMapIterator=Ie;function De(m){return S(m)==="[object Set Iterator]"}t.isSetIterator=De;function Ue(m){return S(m)==="[object Generator]"}t.isGeneratorObject=Ue;function Ne(m){return S(m)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=Ne;function Me(m){return I(m,D)}t.isNumberObject=Me;function Ce(m){return I(m,U)}t.isStringObject=Ce;function Ge(m){return I(m,M)}t.isBooleanObject=Ge;function qe(m){return h&&I(m,_)}t.isBigIntObject=qe;function ae(m){return o&&I(m,x)}t.isSymbolObject=ae;function le(m){return Me(m)||Ce(m)||Ge(m)||qe(m)||ae(m)}t.isBoxedPrimitive=le;function p(m){return typeof Uint8Array<"u"&&(_e(m)||ke(m))}t.isAnyArrayBuffer=p,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(m){Object.defineProperty(t,m,{enumerable:!1,value:function(){throw new Error(m+" is not supported in userland")}})})})),Yu=je(((t,r)=>{r.exports=function(a){return a&&typeof a=="object"&&typeof a.copy=="function"&&typeof a.fill=="function"&&typeof a.readUInt8=="function"}})),Xu=je(((t,r)=>{typeof Object.create=="function"?r.exports=function(a,c){c&&(a.super_=c,a.prototype=Object.create(c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(a,c){if(c){a.super_=c;var l=function(){};l.prototype=c.prototype,a.prototype=new l,a.prototype.constructor=a}}})),xt=je((t=>{var r=Object.getOwnPropertyDescriptors||function(pe){for(var fe=Object.keys(pe),ge={},ke=0;ke<fe.length;ke++)ge[fe[ke]]=Object.getOwnPropertyDescriptor(pe,fe[ke]);return ge},s=/%[sdj%]/g;t.format=function(ie){if(!Q(ie)){for(var pe=[],fe=0;fe<arguments.length;fe++)pe.push(h(arguments[fe]));return pe.join(" ")}for(var fe=1,ge=arguments,ke=ge.length,Ee=String(ie).replace(s,function(De){if(De==="%%")return"%";if(fe>=ke)return De;switch(De){case"%s":return String(ge[fe++]);case"%d":return Number(ge[fe++]);case"%j":try{return JSON.stringify(ge[fe++])}catch{return"[Circular]"}default:return De}}),Ie=ge[fe];fe<ke;Ie=ge[++fe])K(Ie)||!G(Ie)?Ee+=" "+Ie:Ee+=" "+h(Ie);return Ee},t.deprecate=function(ie,pe){if(typeof process<"u"&&process.noDeprecation===!0)return ie;if(typeof process>"u")return function(){return t.deprecate(ie,pe).apply(this,arguments)};var fe=!1;function ge(){if(!fe){if(process.throwDeprecation)throw new Error(pe);process.traceDeprecation?console.trace(pe):console.error(pe),fe=!0}return ie.apply(this,arguments)}return ge};var a={},c=/^$/;if({NODE_ENV:"production"}.NODE_DEBUG){var l={NODE_ENV:"production"}.NODE_DEBUG;l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),c=new RegExp("^"+l+"$","i")}t.debuglog=function(ie){if(ie=ie.toUpperCase(),!a[ie])if(c.test(ie)){var pe=process.pid;a[ie]=function(){var fe=t.format.apply(t,arguments);console.error("%s %d: %s",ie,pe,fe)}}else a[ie]=function(){};return a[ie]};function h(ie,pe){var fe={seen:[],stylize:S};return arguments.length>=3&&(fe.depth=arguments[2]),arguments.length>=4&&(fe.colors=arguments[3]),Z(pe)?fe.showHidden=pe:pe&&t._extend(fe,pe),te(fe.showHidden)&&(fe.showHidden=!1),te(fe.depth)&&(fe.depth=2),te(fe.colors)&&(fe.colors=!1),te(fe.customInspect)&&(fe.customInspect=!0),fe.colors&&(fe.stylize=o),U(fe,ie,fe.depth)}t.inspect=h,h.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},h.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function o(ie,pe){var fe=h.styles[pe];return fe?"\x1B["+h.colors[fe][0]+"m"+ie+"\x1B["+h.colors[fe][1]+"m":ie}function S(ie,pe){return ie}function D(ie){var pe={};return ie.forEach(function(fe,ge){pe[fe]=!0}),pe}function U(ie,pe,fe){if(ie.customInspect&&pe&&se(pe.inspect)&&pe.inspect!==t.inspect&&!(pe.constructor&&pe.constructor.prototype===pe)){var ge=pe.inspect(fe,ie);return Q(ge)||(ge=U(ie,ge,fe)),ge}var ke=M(ie,pe);if(ke)return ke;var Ee=Object.keys(pe),Ie=D(Ee);if(ie.showHidden&&(Ee=Object.getOwnPropertyNames(pe)),ce(pe)&&(Ee.indexOf("message")>=0||Ee.indexOf("description")>=0))return _(pe);if(Ee.length===0){if(se(pe)){var De=pe.name?": "+pe.name:"";return ie.stylize("[Function"+De+"]","special")}if(J(pe))return ie.stylize(RegExp.prototype.toString.call(pe),"regexp");if($(pe))return ie.stylize(Date.prototype.toString.call(pe),"date");if(ce(pe))return _(pe)}var Ue="",Ne=!1,Me=["{","}"];if(ee(pe)&&(Ne=!0,Me=["[","]"]),se(pe)&&(Ue=" [Function"+(pe.name?": "+pe.name:"")+"]"),J(pe)&&(Ue=" "+RegExp.prototype.toString.call(pe)),$(pe)&&(Ue=" "+Date.prototype.toUTCString.call(pe)),ce(pe)&&(Ue=" "+_(pe)),Ee.length===0&&(!Ne||pe.length==0))return Me[0]+Ue+Me[1];if(fe<0)return J(pe)?ie.stylize(RegExp.prototype.toString.call(pe),"regexp"):ie.stylize("[Object]","special");ie.seen.push(pe);var Ce;return Ne?Ce=x(ie,pe,fe,Ie,Ee):Ce=Ee.map(function(Ge){return I(ie,pe,fe,Ie,Ge,Ne)}),ie.seen.pop(),H(Ce,Ue,Me)}function M(ie,pe){if(te(pe))return ie.stylize("undefined","undefined");if(Q(pe)){var fe="'"+JSON.stringify(pe).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ie.stylize(fe,"string")}if(X(pe))return ie.stylize(""+pe,"number");if(Z(pe))return ie.stylize(""+pe,"boolean");if(K(pe))return ie.stylize("null","null")}function _(ie){return"["+Error.prototype.toString.call(ie)+"]"}function x(ie,pe,fe,ge,ke){for(var Ee=[],Ie=0,De=pe.length;Ie<De;++Ie)Y(pe,String(Ie))?Ee.push(I(ie,pe,fe,ge,String(Ie),!0)):Ee.push("");return ke.forEach(function(Ue){Ue.match(/^\d+$/)||Ee.push(I(ie,pe,fe,ge,Ue,!0))}),Ee}function I(ie,pe,fe,ge,ke,Ee){var Ie,De,Ue=Object.getOwnPropertyDescriptor(pe,ke)||{value:pe[ke]};if(Ue.get?Ue.set?De=ie.stylize("[Getter/Setter]","special"):De=ie.stylize("[Getter]","special"):Ue.set&&(De=ie.stylize("[Setter]","special")),Y(ge,ke)||(Ie="["+ke+"]"),De||(ie.seen.indexOf(Ue.value)<0?(K(fe)?De=U(ie,Ue.value,null):De=U(ie,Ue.value,fe-1),De.indexOf(`
|
|
14
|
+
`)>-1&&(Ee?De=De.split(`
|
|
15
|
+
`).map(function(Ne){return" "+Ne}).join(`
|
|
16
|
+
`).slice(2):De=`
|
|
17
|
+
`+De.split(`
|
|
18
|
+
`).map(function(Ne){return" "+Ne}).join(`
|
|
19
|
+
`))):De=ie.stylize("[Circular]","special")),te(Ie)){if(Ee&&ke.match(/^\d+$/))return De;Ie=JSON.stringify(""+ke),Ie.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Ie=Ie.slice(1,-1),Ie=ie.stylize(Ie,"name")):(Ie=Ie.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Ie=ie.stylize(Ie,"string"))}return Ie+": "+De}function H(ie,pe,fe){var ge=0;return ie.reduce(function(ke,Ee){return ge++,Ee.indexOf(`
|
|
20
|
+
`)>=0&&ge++,ke+Ee.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?fe[0]+(pe===""?"":pe+`
|
|
21
|
+
`)+" "+ie.join(`,
|
|
22
|
+
`)+" "+fe[1]:fe[0]+pe+" "+ie.join(", ")+" "+fe[1]}t.types=Zu();function ee(ie){return Array.isArray(ie)}t.isArray=ee;function Z(ie){return typeof ie=="boolean"}t.isBoolean=Z;function K(ie){return ie===null}t.isNull=K;function W(ie){return ie==null}t.isNullOrUndefined=W;function X(ie){return typeof ie=="number"}t.isNumber=X;function Q(ie){return typeof ie=="string"}t.isString=Q;function V(ie){return typeof ie=="symbol"}t.isSymbol=V;function te(ie){return ie===void 0}t.isUndefined=te;function J(ie){return G(ie)&&L(ie)==="[object RegExp]"}t.isRegExp=J,t.types.isRegExp=J;function G(ie){return typeof ie=="object"&&ie!==null}t.isObject=G;function $(ie){return G(ie)&&L(ie)==="[object Date]"}t.isDate=$,t.types.isDate=$;function ce(ie){return G(ie)&&(L(ie)==="[object Error]"||ie instanceof Error)}t.isError=ce,t.types.isNativeError=ce;function se(ie){return typeof ie=="function"}t.isFunction=se;function g(ie){return ie===null||typeof ie=="boolean"||typeof ie=="number"||typeof ie=="string"||typeof ie=="symbol"||typeof ie>"u"}t.isPrimitive=g,t.isBuffer=Yu();function L(ie){return Object.prototype.toString.call(ie)}function j(ie){return ie<10?"0"+ie.toString(10):ie.toString(10)}var ne=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function z(){var ie=new Date,pe=[j(ie.getHours()),j(ie.getMinutes()),j(ie.getSeconds())].join(":");return[ie.getDate(),ne[ie.getMonth()],pe].join(" ")}t.log=function(){console.log("%s - %s",z(),t.format.apply(t,arguments))},t.inherits=Xu(),t._extend=function(ie,pe){if(!pe||!G(pe))return ie;for(var fe=Object.keys(pe),ge=fe.length;ge--;)ie[fe[ge]]=pe[fe[ge]];return ie};function Y(ie,pe){return Object.prototype.hasOwnProperty.call(ie,pe)}var ve=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(pe){if(typeof pe!="function")throw new TypeError('The "original" argument must be of type Function');if(ve&&pe[ve]){var fe=pe[ve];if(typeof fe!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(fe,ve,{value:fe,enumerable:!1,writable:!1,configurable:!0}),fe}function fe(){for(var ge,ke,Ee=new Promise(function(Ue,Ne){ge=Ue,ke=Ne}),Ie=[],De=0;De<arguments.length;De++)Ie.push(arguments[De]);Ie.push(function(Ue,Ne){Ue?ke(Ue):ge(Ne)});try{pe.apply(this,Ie)}catch(Ue){ke(Ue)}return Ee}return Object.setPrototypeOf(fe,Object.getPrototypeOf(pe)),ve&&Object.defineProperty(fe,ve,{value:fe,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(fe,r(pe))},t.promisify.custom=ve;function we(ie,pe){if(!ie){var fe=new Error("Promise was rejected with a falsy value");fe.reason=ie,ie=fe}return pe(ie)}function _e(ie){if(typeof ie!="function")throw new TypeError('The "original" argument must be of type Function');function pe(){for(var fe=[],ge=0;ge<arguments.length;ge++)fe.push(arguments[ge]);var ke=fe.pop();if(typeof ke!="function")throw new TypeError("The last argument must be of type Function");var Ee=this,Ie=function(){return ke.apply(Ee,arguments)};ie.apply(this,fe).then(function(De){process.nextTick(Ie.bind(null,null,De))},function(De){process.nextTick(we.bind(null,De,Ie))})}return Object.setPrototypeOf(pe,Object.getPrototypeOf(ie)),Object.defineProperties(pe,r(ie)),pe}t.callbackify=_e})),cr=je(((t,r)=>{var s=Er(),a=hu(),c=xt(),l=s.Buffer,h=new se(4096),o=/^[A-Za-z_][A-Za-z0-9_]*$/,S=c.format;function D(z){return typeof l.alloc=="function"?l.alloc(z):new l(z)}function U(z){return typeof l.allocUnsafeSlow=="function"?l.allocUnsafeSlow(z):new s.SlowBuffer(z)}function M(z,Y){return typeof l.from=="function"?l.from(z,Y):new l(z,Y)}function _(z){return z.charAt(0).toUpperCase()+z.slice(1)}function x(z,Y){return z===Y?0:z<Y?-1:1}function I(z,Y,ve){var we=z[Y];return we===void 0?ve:we}function H(z,Y){Y=Y||"md5";var ve=a.createHash(Y);return ve.end(z),ve.read()}function ee(z,Y){var ve=-1,we,_e;if(!z)return-1;for(we=0,_e=z.length;we<_e;we++)if(z[we]===Y){if(ve>=0)return-2;ve=we}return ve}function Z(z,Y){var ve={},we,_e;for(we=0;we<z.length;we++)_e=z[we],ve[Y(_e)]=_e;return ve}function K(z){return Object.keys(z).map(function(Y){return z[Y]})}function W(z,Y){var ve=Object.create(null),we,_e,ie;for(we=0,_e=z.length;we<_e;we++){if(ie=z[we],Y&&(ie=Y(ie)),ve[ie])return!0;ve[ie]=!0}return!1}function X(z,Y,ve){var we=Object.getOwnPropertyNames(z),_e,ie,pe;for(_e=0,ie=we.length;_e<ie;_e++)pe=we[_e],(!Y.hasOwnProperty(pe)||ve)&&Object.defineProperty(Y,pe,Object.getOwnPropertyDescriptor(z,pe));return Y}function Q(z){return o.test(z)}function V(z,Y){return~z.indexOf(".")?z=z.replace(/^\./,""):Y&&(z=Y+"."+z),z.split(".").forEach(function(ve){if(!Q(ve))throw new Error(S("invalid name: %j",z))}),z}function te(z){var Y=z.split(".");return Y[Y.length-1]}function J(z){var Y=/^(.*)\.[^.]+$/.exec(z);return Y?Y[1]:void 0}function G(z,Y){Y=Y|0;var ve=z.charAt(Y++);if(/[\d-]/.test(ve)){for(;/[eE\d.+-]/.test(z.charAt(Y));)Y++;return Y}else{if(/true|null/.test(z.slice(Y-1,Y+3)))return Y+3;if(/false/.test(z.slice(Y-1,Y+4)))return Y+4}var we=0,_e=!1;do switch(ve){case"{":case"[":_e||we++;break;case"}":case"]":if(!_e&&!--we)return Y;break;case'"':if(_e=!_e,!we&&!_e)return Y;break;case"\\":Y++}while(ve=z.charAt(Y++));return-1}function $(){throw new Error("abstract")}function ce(z,Y){var ve=z.prototype,we,_e,ie,pe;for(we=0,_e=Y.length;we<_e;we++)ie=Y[we],pe="get"+_(ie),ve[pe]=c.deprecate(fe(ie),"use `."+ie+"` instead of `."+pe+"()`");function fe(ge){return function(){var ke=this[ge];return typeof ke=="function"?ke.apply(this,arguments):ke}}}function se(z){this._len=z|0,this._pos=0,this._slab=D(this._len)}se.prototype.alloc=function(z){if(z<0)throw new Error("negative length");var Y=this._len;return z>Y?D(z):(this._pos+z>Y&&(this._slab=D(Y),this._pos=0),this._slab.slice(this._pos,this._pos+=z))};function g(z){var Y=1103515245,ve=12345,we=Math.pow(2,31),_e=Math.floor(z||Math.random()*(we-1));this._max=we,this._nextInt=function(){return _e=(Y*_e+ve)%we}}g.prototype.nextBoolean=function(){return!!(this._nextInt()%2)},g.prototype.nextInt=function(z,Y){return Y===void 0&&(Y=z,z=0),Y=Y===void 0?this._max:Y,z+Math.floor(this.nextFloat()*(Y-z))},g.prototype.nextFloat=function(z,Y){return Y===void 0&&(Y=z,z=0),Y=Y===void 0?1:Y,z+(Y-z)*this._nextInt()/this._max},g.prototype.nextString=function(z,Y){z|=0,Y=Y||"aA";var ve="";Y.indexOf("a")>-1&&(ve+="abcdefghijklmnopqrstuvwxyz"),Y.indexOf("A")>-1&&(ve+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),Y.indexOf("#")>-1&&(ve+="0123456789"),Y.indexOf("!")>-1&&(ve+="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\");for(var we=[],_e=0;_e<z;_e++)we.push(this.choice(ve));return we.join("")},g.prototype.nextBuffer=function(z){var Y=[],ve;for(ve=0;ve<z;ve++)Y.push(this.nextInt(256));return M(Y)},g.prototype.choice=function(z){var Y=z.length;if(!Y)throw new Error("choosing from empty array");return z[this.nextInt(Y)]};function L(){this._index=0,this._items=[]}L.prototype.push=function(z){var Y=this._items,ve=Y.length|0,we;for(Y.push(z);ve>0&&Y[ve].index<Y[we=ve-1>>1].index;)z=Y[ve],Y[ve]=Y[we],Y[we]=z,ve=we},L.prototype.pop=function(){var z=this._items,Y=z.length-1|0,ve=z[0];if(!ve||ve.index>this._index)return null;if(this._index++,!Y)return z.pop(),ve;z[0]=z.pop();for(var we=Y>>1,_e=0,ie,pe,fe,ge,ke,Ee,Ie;_e<we&&(ge=z[_e],ie=(_e<<1)+1,pe=_e+1<<1,Ee=z[ie],Ie=z[pe],!Ie||Ee.index<=Ie.index?(ke=Ee,fe=ie):(ke=Ie,fe=pe),!(ke.index>=ge.index));)z[fe]=ge,z[_e]=ke,_e=fe;return ve};function j(z,Y){if(this.buf=z,this.pos=Y|0,this.pos<0)throw new Error("negative offset")}j.prototype.isValid=function(){return this.pos<=this.buf.length},j.prototype._invalidate=function(){this.pos=this.buf.length+1},j.prototype.readBoolean=function(){return!!this.buf[this.pos++]},j.prototype.skipBoolean=function(){this.pos++},j.prototype.writeBoolean=function(z){this.buf[this.pos++]=!!z},j.prototype.readInt=j.prototype.readLong=function(){var z=0,Y=0,ve=this.buf,we,_e,ie,pe;do we=ve[this.pos++],_e=we&128,z|=(we&127)<<Y,Y+=7;while(_e&&Y<28);if(_e){ie=z,pe=268435456;do we=ve[this.pos++],ie+=(we&127)*pe,pe*=128;while(we&128);return(ie%2?-(ie+1):ie)/2}return z>>1^-(z&1)},j.prototype.skipInt=j.prototype.skipLong=function(){for(var z=this.buf;z[this.pos++]&128;);},j.prototype.writeInt=j.prototype.writeLong=function(z){var Y=this.buf,ve,we;if(z>=-1073741824&&z<1073741824){we=z>=0?z<<1:~z<<1|1;do Y[this.pos]=we&127,we>>=7;while(we&&(Y[this.pos++]|=128))}else{ve=z>=0?z*2:-z*2-1;do Y[this.pos]=ve&127,ve/=128;while(ve>=1&&(Y[this.pos++]|=128))}this.pos++},j.prototype.readFloat=function(){var z=this.buf,Y=this.pos;return this.pos+=4,this.pos>z.length?0:this.buf.readFloatLE(Y)},j.prototype.skipFloat=function(){this.pos+=4},j.prototype.writeFloat=function(z){var Y=this.buf,ve=this.pos;if(this.pos+=4,!(this.pos>Y.length))return this.buf.writeFloatLE(z,ve)},j.prototype.readDouble=function(){var z=this.buf,Y=this.pos;return this.pos+=8,this.pos>z.length?0:this.buf.readDoubleLE(Y)},j.prototype.skipDouble=function(){this.pos+=8},j.prototype.writeDouble=function(z){var Y=this.buf,ve=this.pos;if(this.pos+=8,!(this.pos>Y.length))return this.buf.writeDoubleLE(z,ve)},j.prototype.readFixed=function(z){var Y=this.pos;if(this.pos+=z,!(this.pos>this.buf.length)){var ve=h.alloc(z);return this.buf.copy(ve,0,Y,Y+z),ve}},j.prototype.skipFixed=function(z){this.pos+=z},j.prototype.writeFixed=function(z,Y){Y=Y||z.length;var ve=this.pos;this.pos+=Y,!(this.pos>this.buf.length)&&z.copy(this.buf,ve,0,Y)},j.prototype.readBytes=function(){var z=this.readLong();if(z<0){this._invalidate();return}return this.readFixed(z)},j.prototype.skipBytes=function(){var z=this.readLong();if(z<0){this._invalidate();return}this.pos+=z},j.prototype.writeBytes=function(z){var Y=z.length;this.writeLong(Y),this.writeFixed(z,Y)},typeof l.prototype.utf8Slice=="function"?j.prototype.readString=function(){var z=this.readLong();if(z<0)return this._invalidate(),"";var Y=this.pos,ve=this.buf;if(this.pos+=z,!(this.pos>ve.length))return this.buf.utf8Slice(Y,Y+z)}:j.prototype.readString=function(){var z=this.readLong();if(z<0)return this._invalidate(),"";var Y=this.pos,ve=this.buf;if(this.pos+=z,!(this.pos>ve.length))return this.buf.slice(Y,Y+z).toString()},j.prototype.skipString=function(){var z=this.readLong();if(z<0){this._invalidate();return}this.pos+=z},j.prototype.writeString=function(z){var Y=l.byteLength(z),ve=this.buf;this.writeLong(Y);var we=this.pos;if(this.pos+=Y,!(this.pos>ve.length))if(Y>64&&typeof l.prototype.utf8Write=="function")ve.utf8Write(z,we,Y);else{var _e,ie,pe,fe;for(_e=0,ie=Y;_e<ie;_e++)pe=z.charCodeAt(_e),pe<128?ve[we++]=pe:pe<2048?(ve[we++]=pe>>6|192,ve[we++]=pe&63|128):(pe&64512)===55296&&((fe=z.charCodeAt(_e+1))&64512)===56320?(pe=65536+((pe&1023)<<10)+(fe&1023),_e++,ve[we++]=pe>>18|240,ve[we++]=pe>>12&63|128,ve[we++]=pe>>6&63|128,ve[we++]=pe&63|128):(ve[we++]=pe>>12|224,ve[we++]=pe>>6&63|128,ve[we++]=pe&63|128)}},typeof l.prototype.latin1Write=="function"?j.prototype.writeBinary=function(z,Y){var ve=this.pos;this.pos+=Y,!(this.pos>this.buf.length)&&this.buf.latin1Write(z,ve,Y)}:typeof l.prototype.binaryWrite=="function"?j.prototype.writeBinary=function(z,Y){var ve=this.pos;this.pos+=Y,!(this.pos>this.buf.length)&&this.buf.binaryWrite(z,ve,Y)}:j.prototype.writeBinary=function(z,Y){var ve=this.pos;this.pos+=Y,!(this.pos>this.buf.length)&&this.buf.write(z,ve,Y,"binary")},j.prototype.matchBoolean=function(z){return this.buf[this.pos++]-z.buf[z.pos++]},j.prototype.matchInt=j.prototype.matchLong=function(z){var Y=this.readLong(),ve=z.readLong();return Y===ve?0:Y<ve?-1:1},j.prototype.matchFloat=function(z){var Y=this.readFloat(),ve=z.readFloat();return Y===ve?0:Y<ve?-1:1},j.prototype.matchDouble=function(z){var Y=this.readDouble(),ve=z.readDouble();return Y===ve?0:Y<ve?-1:1},j.prototype.matchFixed=function(z,Y){return this.readFixed(Y).compare(z.readFixed(Y))},j.prototype.matchBytes=j.prototype.matchString=function(z){var Y=this.readLong(),ve=this.pos;this.pos+=Y;var we=z.readLong(),_e=z.pos;z.pos+=we;var ie=this.buf.slice(ve,this.pos),pe=z.buf.slice(_e,z.pos);return ie.compare(pe)},j.prototype.unpackLongBytes=function(){var z=D(8),Y=0,ve=0,we=6,_e=this.buf,ie=_e[this.pos++],pe=ie&1;for(z.fill(0),Y|=(ie&127)>>1;ie&128;)ie=_e[this.pos++],Y|=(ie&127)<<we,we+=7,we>=8&&(we-=8,z[ve++]=Y,Y>>=8);return z[ve]=Y,pe&&ne(z,8),z},j.prototype.packLongBytes=function(z){var Y=(z[7]&128)>>7,ve=this.buf,we=1,_e=0,ie=3,pe;Y?(ne(z,8),pe=1):pe=0;for(var fe=[z.readUIntLE(0,3),z.readUIntLE(3,3),z.readUIntLE(6,2)];ie&&!fe[--ie];);for(;_e<ie;)for(pe|=fe[_e++]<<we,we+=24;we>7;)ve[this.pos++]=pe&127|128,pe>>=7,we-=7;pe|=fe[ie]<<we;do ve[this.pos]=pe&127,pe>>=7;while(pe&&(ve[this.pos++]|=128));this.pos++,Y&&ne(z,8)};function ne(z,Y){for(;Y--;)z[Y]=~z[Y]}r.exports={abstractFunction:$,addDeprecatedGetters:ce,bufferFrom:M,capitalize:_,copyOwnProperties:X,getHash:H,compare:x,getOption:I,impliedNamespace:J,isValidName:Q,jsonEnd:G,newBuffer:D,newSlowBuffer:U,objectValues:K,qualify:V,toMap:Z,singleIndexOf:ee,hasDuplicates:W,unqualify:te,BufferPool:se,Lcg:g,OrderedQueue:L,Tap:j}})),pi=je(((t,r)=>{var s=cr(),a=Er(),c=xt(),l=a.Buffer,h=s.Tap,o=c.debuglog("avsc:types"),S=c.format,D={array:L,boolean:Z,bytes:te,double:Q,enum:ce,error:j,fixed:se,float:X,int:K,long:W,map:g,null:ee,record:j,string:V},U=new s.Lcg,M=new h(s.newSlowBuffer(1024)),_=null,x=[];function I(p,m){var O;if(_?(O=_,x.push([_,this]),_=null):O=this,this._hash=new we,this.name=void 0,this.aliases=void 0,this.doc=p&&p.doc?""+p.doc:void 0,p){var y=p.name,F=p.namespace===void 0?m&&m.namespace:p.namespace;if(y!==void 0){if(y=Ue(y,F),fe(y))throw new Error(S("cannot rename primitive type: %j",y));var e=m&&m.registry;if(e){if(e[y]!==void 0)throw new Error(S("duplicate type name: %s",y));e[y]=O}}else if(m&&m.noAnonymousTypes)throw new Error(S("missing name property in schema: %j",p));this.name=y,this.aliases=p.aliases?p.aliases.map(function(u){return Ue(u,F)}):[]}}I.forSchema=function(p,m){m=m||{},m.registry=m.registry||{};var O=(function(v){switch(v===!0?v="always":v===!1?v="never":v===void 0?v="auto":typeof v=="string"&&(v=v.toLowerCase()),v){case"always":return $;case"never":return G;case"auto":return;default:throw new Error(S("invalid wrap unions option: %j",v))}})(m.wrapUnions);if(p===null)throw new Error('invalid type: null (did you mean "null"?)');if(I.isType(p))return p;var y;if(m.typeHook&&(y=m.typeHook(p,m))){if(!I.isType(y))throw new Error(S("invalid typehook return value: %j",y));return y}if(typeof p=="string"){if(p=Ue(p,m.namespace),y=m.registry[p],y)return y;if(fe(p))return m.registry[p]=I.forSchema({type:p},m);throw new Error(S("undefined type name: %s",p))}if(p.logicalType&&m.logicalTypes&&!_){var F=m.logicalTypes[p.logicalType];if(F){var e=m.namespace,u={};Object.keys(m.registry).forEach(function(v){u[v]=m.registry[v]});try{return o("instantiating logical type for %s",p.logicalType),new F(p,m)}catch(v){if(o("failed to instantiate logical type for %s",p.logicalType),m.assertLogicalTypes)throw v;_=null,m.namespace=e,m.registry=u}}}if(Array.isArray(p)){var f=_;_=null;var k=p.map(function(v){return I.forSchema(v,m)});O||(O=Ce(k)?$:G),_=f,y=new O(k,m)}else y=(function(v){var i=D[v];if(i===void 0)throw new Error(S("unknown type: %j",v));return new i(p,m)})(p.type);return y},I.forValue=function(p,m){if(m=m||{},m.emptyArrayType=m.emptyArrayType||I.forSchema({type:"array",items:"null"}),m.valueHook){var O=m.valueHook(p,m);if(O!==void 0){if(!I.isType(O))throw new Error(S("invalid value hook return value: %j",O));return O}}switch(typeof p){case"string":return I.forSchema("string",m);case"boolean":return I.forSchema("boolean",m);case"number":return(p|0)===p?I.forSchema("int",m):Math.abs(p)<9007199254740991?I.forSchema("float",m):I.forSchema("double",m);case"object":if(p===null)return I.forSchema("null",m);if(Array.isArray(p))return p.length?I.forSchema({type:"array",items:I.forTypes(p.map(function(F){return I.forValue(F,m)}),m)},m):m.emptyArrayType;if(l.isBuffer(p))return I.forSchema("bytes",m);var y=Object.keys(p);return y.some(function(F){return!s.isValidName(F)})?I.forSchema({type:"map",values:I.forTypes(y.map(function(F){return I.forValue(p[F],m)}),m)},m):I.forSchema({type:"record",fields:y.map(function(F){return{name:F,type:I.forValue(p[F],m)}})},m);default:throw new Error(S("cannot infer type from: %j",p))}},I.forTypes=function(p,m){if(!p.length)throw new Error("no types to combine");if(p.length===1)return p[0];m=m||{};var O=[],y=0,F=!0;if(p.forEach(function(i){switch(i.typeName){case"union:unwrapped":F=!1,O=O.concat(i.types);break;case"union:wrapped":y++,O=O.concat(i.types);break;case"null":O.push(i);break;default:F=!1,O.push(i)}}),y){if(!F)throw new Error("cannot combine wrapped union");var e={};O.forEach(function(i){var n=i.branchName,w=e[n];if(!w)e[n]=i;else if(!i.equals(w))throw new Error("inconsistent branch type")});var u=m.wrapUnions,f;m.wrapUnions=!0;try{f=I.forSchema(Object.keys(e).map(function(i){return e[i]}),m)}catch(i){throw m.wrapUnions=u,i}return m.wrapUnions=u,f}var k={};O.forEach(function(i){var n=Ne(i),w=k[n];w||(k[n]=w=[]),w.push(i)});var v=Object.keys(k).map(function(i){var n=k[i];if(n.length===1)return n[0];switch(i){case"null":case"boolean":return n[0];case"number":return Ge(n);case"string":return qe(n,m);case"buffer":return ae(n,m);case"array":return n=n.filter(function(w){return w!==m.emptyArrayType}),n.length?I.forSchema({type:"array",items:I.forTypes(n.map(function(w){return w.itemsType}),m)},m):m.emptyArrayType;default:return le(n,m)}});return v.length===1?v[0]:I.forSchema(v,m)},I.isType=function(){var p=arguments.length;if(!p)return!1;var m=arguments[0];if(!m||typeof m._update!="function"||typeof m.fingerprint!="function")return!1;if(p===1)return!0;var O=m.typeName,y;for(y=1;y<p;y++)if(O.indexOf(arguments[y])===0)return!0;return!1},I.__reset=function(p){o("resetting type buffer to %d",p),M.buf=s.newSlowBuffer(p)},Object.defineProperty(I.prototype,"branchName",{enumerable:!0,get:function(){var p=I.isType(this,"logical")?this.underlyingType:this;return p.name?p.name:I.isType(p,"abstract")?p._concreteTypeName:I.isType(p,"union")?void 0:p.typeName}}),I.prototype.clone=function(p,m){return m?(m={coerce:!!m.coerceBuffers|0,fieldHook:m.fieldHook,qualifyNames:!!m.qualifyNames,skip:!!m.skipMissingFields,wrap:!!m.wrapUnions|0},this._copy(p,m)):this.fromBuffer(this.toBuffer(p))},I.prototype.compare=s.abstractFunction,I.prototype.compareBuffers=function(p,m){return this._match(new h(p),new h(m))},I.prototype.createResolver=function(p,m){if(!I.isType(p))throw new Error(S("not a type: %j",p));if(!I.isType(this,"union","logical")&&I.isType(p,"logical"))return this.createResolver(p.underlyingType,m);m=m||{},m.registry=m.registry||{};var O,y;if(I.isType(this,"record","error")&&I.isType(p,"record","error")&&(y=this.name+":"+p.name,O=m.registry[y],O))return O;if(O=new ve(this),y&&(m.registry[y]=O),I.isType(p,"union")){var F=p.types.map(function(e){return this.createResolver(e,m)},this);O._read=function(e){var u=e.readLong();if(F[u]===void 0)throw new Error(S("invalid union index: %s",u));return F[u]._read(e)}}else this._update(O,p,m);if(!O._read)throw new Error(S("cannot read %s as %s",p,this));return Object.freeze(O)},I.prototype.decode=function(p,m,O){var y=new h(p,m),F=_e(this,y,O);return y.isValid()?{value:F,offset:y.pos}:{value:void 0,offset:-1}},I.prototype.encode=function(p,m,O){var y=new h(m,O);return this._write(y,p),y.isValid()?y.pos:m.length-y.pos},I.prototype.equals=function(p,m){var O=I.isType(p)&&this.fingerprint().equals(p.fingerprint());return!O||!(m&&m.strict)?O:JSON.stringify(this.schema({exportAttrs:!0}))===JSON.stringify(p.schema({exportAttrs:!0}))},I.prototype.fingerprint=function(p){if(p)return s.getHash(JSON.stringify(this.schema()),p);if(!this._hash.str){var m=JSON.stringify(this.schema());this._hash.str=s.getHash(m).toString("binary")}return s.bufferFrom(this._hash.str,"binary")},I.prototype.fromBuffer=function(p,m,O){var y=new h(p),F=_e(this,y,m,O);if(!y.isValid())throw new Error("truncated buffer");if(!O&&y.pos<p.length)throw new Error("trailing data");return F},I.prototype.fromString=function(p){return this._copy(JSON.parse(p),{coerce:2})},I.prototype.inspect=function(){var p=this.typeName,m=ge(p);if(fe(p))return S("<%s>",m);var O=this.schema({exportAttrs:!0,noDeref:!0});return typeof O=="object"&&!I.isType(this,"logical")&&(O.type=void 0),S("<%s %j>",m,O)},I.prototype.isValid=function(p,m){var O=(m&&m.noUndeclaredFields)|0,y=m&&m.errorHook,F,e;return y&&(e=[],F=function(u,f){y.call(this,e.slice(),u,f,p)}),this._check(p,O,F,e)},I.prototype.random=s.abstractFunction,I.prototype.schema=function(p){return this._attrs({exportAttrs:!!(p&&p.exportAttrs),noDeref:!!(p&&p.noDeref)})},I.prototype.toBuffer=function(p){M.pos=0,this._write(M,p);var m=s.newBuffer(M.pos);return M.isValid()?M.buf.copy(m,0,0,M.pos):this._write(new h(m),p),m},I.prototype.toJSON=function(){return this.schema({exportAttrs:!0})},I.prototype.toString=function(p){return JSON.stringify(p===void 0?this.schema({noDeref:!0}):this._copy(p,{coerce:3}))},I.prototype.wrap=function(p){var m=this._branchConstructor;return m===null?null:new m(p)},I.prototype._attrs=function(p){p.derefed=p.derefed||{};var m=this.name;if(m!==void 0){if(p.noDeref||p.derefed[m])return m;p.derefed[m]=!0}var O={};this.name!==void 0&&(O.name=m),O.type=this.typeName;var y=this._deref(O,p);return y!==void 0&&(O=y),p.exportAttrs&&(this.aliases&&this.aliases.length&&(O.aliases=this.aliases),this.doc!==void 0&&(O.doc=this.doc)),O},I.prototype._createBranchConstructor=function(){var p=this.branchName;if(p==="null")return null;var m=~p.indexOf(".")?"this['"+p+"']":"this."+p,O="return function Branch$(val) { "+m+" = val; };",y=new Function(O)();return y.type=this,y.prototype.unwrap=new Function("return "+m+";"),y.prototype.unwrapped=y.prototype.unwrap,y},I.prototype._peek=function(p){var m=p.pos,O=this._read(p);return p.pos=m,O},I.prototype._check=s.abstractFunction,I.prototype._copy=s.abstractFunction,I.prototype._deref=s.abstractFunction,I.prototype._match=s.abstractFunction,I.prototype._read=s.abstractFunction,I.prototype._skip=s.abstractFunction,I.prototype._update=s.abstractFunction,I.prototype._write=s.abstractFunction,I.prototype.getAliases=function(){return this.aliases},I.prototype.getFingerprint=I.prototype.fingerprint,I.prototype.getName=function(p){return this.name||!p?this.name:this.branchName},I.prototype.getSchema=I.prototype.schema,I.prototype.getTypeName=function(){return this.typeName};function H(p){I.call(this),this._branchConstructor=this._createBranchConstructor(),p||Object.freeze(this)}c.inherits(H,I),H.prototype._update=function(p,m){m.typeName===this.typeName&&(p._read=this._read)},H.prototype._copy=function(p){return this._check(p,void 0,De),p},H.prototype._deref=function(){return this.typeName},H.prototype.compare=s.compare;function ee(){H.call(this)}c.inherits(ee,H),ee.prototype._check=function(p,m,O){var y=p===null;return!y&&O&&O(p,this),y},ee.prototype._read=function(){return null},ee.prototype._skip=function(){},ee.prototype._write=function(p,m){m!==null&&De(m,this)},ee.prototype._match=function(){return 0},ee.prototype.compare=ee.prototype._match,ee.prototype.typeName="null",ee.prototype.random=ee.prototype._read;function Z(){H.call(this)}c.inherits(Z,H),Z.prototype._check=function(p,m,O){var y=typeof p=="boolean";return!y&&O&&O(p,this),y},Z.prototype._read=function(p){return p.readBoolean()},Z.prototype._skip=function(p){p.skipBoolean()},Z.prototype._write=function(p,m){typeof m!="boolean"&&De(m,this),p.writeBoolean(m)},Z.prototype._match=function(p,m){return p.matchBoolean(m)},Z.prototype.typeName="boolean",Z.prototype.random=function(){return U.nextBoolean()};function K(){H.call(this)}c.inherits(K,H),K.prototype._check=function(p,m,O){var y=p===(p|0);return!y&&O&&O(p,this),y},K.prototype._read=function(p){return p.readInt()},K.prototype._skip=function(p){p.skipInt()},K.prototype._write=function(p,m){m!==(m|0)&&De(m,this),p.writeInt(m)},K.prototype._match=function(p,m){return p.matchInt(m)},K.prototype.typeName="int",K.prototype.random=function(){return U.nextInt(1e3)|0};function W(){H.call(this)}c.inherits(W,H),W.prototype._check=function(p,m,O){var y=typeof p=="number"&&p%1===0&&Ee(p);return!y&&O&&O(p,this),y},W.prototype._read=function(p){var m=p.readLong();if(!Ee(m))throw new Error("potential precision loss");return m},W.prototype._skip=function(p){p.skipLong()},W.prototype._write=function(p,m){(typeof m!="number"||m%1||!Ee(m))&&De(m,this),p.writeLong(m)},W.prototype._match=function(p,m){return p.matchLong(m)},W.prototype._update=function(p,m){switch(m.typeName){case"int":p._read=m._read;break;case"abstract:long":case"long":p._read=this._read}},W.prototype.typeName="long",W.prototype.random=function(){return U.nextInt()},W.__with=function(p,m){p=p||{};var O={toBuffer:"_toBuffer",fromBuffer:"_fromBuffer",fromJSON:"_fromJSON",toJSON:"_toJSON",isValid:"_isValid",compare:"compare"},y=new z(m);return Object.keys(O).forEach(function(F){if(p[F]===void 0)throw new Error(S("missing method implementation: %s",F));y[O[F]]=p[F]}),Object.freeze(y)};function X(){H.call(this)}c.inherits(X,H),X.prototype._check=function(p,m,O){var y=typeof p=="number";return!y&&O&&O(p,this),y},X.prototype._read=function(p){return p.readFloat()},X.prototype._skip=function(p){p.skipFloat()},X.prototype._write=function(p,m){typeof m!="number"&&De(m,this),p.writeFloat(m)},X.prototype._match=function(p,m){return p.matchFloat(m)},X.prototype._update=function(p,m){switch(m.typeName){case"float":case"int":p._read=m._read;break;case"abstract:long":case"long":p._read=function(O){return O.readLong()}}},X.prototype.typeName="float",X.prototype.random=function(){return U.nextFloat(1e3)};function Q(){H.call(this)}c.inherits(Q,H),Q.prototype._check=function(p,m,O){var y=typeof p=="number";return!y&&O&&O(p,this),y},Q.prototype._read=function(p){return p.readDouble()},Q.prototype._skip=function(p){p.skipDouble()},Q.prototype._write=function(p,m){typeof m!="number"&&De(m,this),p.writeDouble(m)},Q.prototype._match=function(p,m){return p.matchDouble(m)},Q.prototype._update=function(p,m){switch(m.typeName){case"double":case"float":case"int":p._read=m._read;break;case"abstract:long":case"long":p._read=function(O){return O.readLong()}}},Q.prototype.typeName="double",Q.prototype.random=function(){return U.nextFloat()};function V(){H.call(this)}c.inherits(V,H),V.prototype._check=function(p,m,O){var y=typeof p=="string";return!y&&O&&O(p,this),y},V.prototype._read=function(p){return p.readString()},V.prototype._skip=function(p){p.skipString()},V.prototype._write=function(p,m){typeof m!="string"&&De(m,this),p.writeString(m)},V.prototype._match=function(p,m){return p.matchString(m)},V.prototype._update=function(p,m){switch(m.typeName){case"bytes":case"string":p._read=this._read}},V.prototype.typeName="string",V.prototype.random=function(){return U.nextString(U.nextInt(32))};function te(){H.call(this)}c.inherits(te,H),te.prototype._check=function(p,m,O){var y=l.isBuffer(p);return!y&&O&&O(p,this),y},te.prototype._read=function(p){return p.readBytes()},te.prototype._skip=function(p){p.skipBytes()},te.prototype._write=function(p,m){l.isBuffer(m)||De(m,this),p.writeBytes(m)},te.prototype._match=function(p,m){return p.matchBytes(m)},te.prototype._update=V.prototype._update,te.prototype._copy=function(p,m){var O;switch((m&&m.coerce)|0){case 3:return this._check(p,void 0,De),p.toString("binary");case 2:if(typeof p!="string")throw new Error(S("cannot coerce to buffer: %j",p));return O=s.bufferFrom(p,"binary"),this._check(O,void 0,De),O;case 1:if(!Ie(p))throw new Error(S("cannot coerce to buffer: %j",p));return O=s.bufferFrom(p.data),this._check(O,void 0,De),O;default:return this._check(p,void 0,De),s.bufferFrom(p)}},te.prototype.compare=l.compare,te.prototype.typeName="bytes",te.prototype.random=function(){return U.nextBuffer(U.nextInt(32))};function J(p,m){if(I.call(this),!Array.isArray(p))throw new Error(S("non-array union schema: %j",p));if(!p.length)throw new Error("empty union");this.types=Object.freeze(p.map(function(O){return I.forSchema(O,m)})),this._branchIndices={},this.types.forEach(function(O,y){if(I.isType(O,"union"))throw new Error("unions cannot be directly nested");var F=O.branchName;if(this._branchIndices[F]!==void 0)throw new Error(S("duplicate union branch name: %j",F));this._branchIndices[F]=y},this)}c.inherits(J,I),J.prototype._branchConstructor=function(){throw new Error("unions cannot be directly wrapped")},J.prototype._skip=function(p){this.types[p.readLong()]._skip(p)},J.prototype._match=function(p,m){var O=p.readLong(),y=m.readLong();return O===y?this.types[O]._match(p,m):O<y?-1:1},J.prototype._deref=function(p,m){return this.types.map(function(O){return O._attrs(m)})},J.prototype.getTypes=function(){return this.types};function G(p,m){J.call(this,p,m),this._dynamicBranches=null,this._bucketIndices={},this.types.forEach(function(O,y){if(I.isType(O,"abstract","logical"))this._dynamicBranches||(this._dynamicBranches=[]),this._dynamicBranches.push({index:y,type:O});else{var F=Ne(O);if(this._bucketIndices[F]!==void 0)throw new Error(S("ambiguous unwrapped union: %j",this));this._bucketIndices[F]=y}},this),Object.freeze(this)}c.inherits(G,J),G.prototype._getIndex=function(p){var m=this._bucketIndices[Me(p)];return this._dynamicBranches&&(m=this._getBranchIndex(p,m)),m},G.prototype._getBranchIndex=function(p,m){var O=this._dynamicBranches,y,F,e;for(y=0,F=O.length;y<F;y++)if(e=O[y],e.type._check(p))if(m===void 0)m=e.index;else throw new Error("ambiguous conversion");return m},G.prototype._check=function(p,m,O,y){var F=this._getIndex(p),e=F!==void 0;return e?this.types[F]._check(p,m,O,y):(O&&O(p,this),e)},G.prototype._read=function(p){var m=p.readLong(),O=this.types[m];if(O)return O._read(p);throw new Error(S("invalid union index: %s",m))},G.prototype._write=function(p,m){var O=this._getIndex(m);O===void 0&&De(m,this),p.writeLong(O),m!==null&&this.types[O]._write(p,m)},G.prototype._update=function(p,m,O){var y,F,e;for(y=0,F=this.types.length;y<F;y++){try{e=this.types[y].createResolver(m,O)}catch{continue}p._read=function(u){return e._read(u)};return}},G.prototype._copy=function(p,m){var O=m&&m.coerce|0,y=m&&m.wrap|0,F;if(y===2)F=0;else{switch(O){case 1:Ie(p)&&this._bucketIndices.buffer!==void 0?F=this._bucketIndices.buffer:F=this._getIndex(p);break;case 2:if(p===null)F=this._bucketIndices.null;else if(typeof p=="object"){var e=Object.keys(p);e.length===1&&(F=this._branchIndices[e[0]],p=p[e[0]])}break;default:F=this._getIndex(p)}F===void 0&&De(p,this)}var u=this.types[F];if(p===null||y===3)return u._copy(p,m);if(O===3){var f={};return f[u.branchName]=u._copy(p,m),f}else return u._copy(p,m)},G.prototype.compare=function(p,m){var O=this._getIndex(p),y=this._getIndex(m);if(O===void 0)De(p,this);else if(y===void 0)De(m,this);else return O===y?this.types[O].compare(p,m):s.compare(O,y)},G.prototype.typeName="union:unwrapped",G.prototype.random=function(){var p=U.nextInt(this.types.length);return this.types[p].random()};function $(p,m){J.call(this,p,m),Object.freeze(this)}c.inherits($,J),$.prototype._check=function(p,m,O,y){var F=!1;if(p===null)F=this._branchIndices.null!==void 0;else if(typeof p=="object"){var e=Object.keys(p);if(e.length===1){var u=e[0],f=this._branchIndices[u];if(f!==void 0)return O?(y.push(u),F=this.types[f]._check(p[u],m,O,y),y.pop(),F):this.types[f]._check(p[u],m)}}return!F&&O&&O(p,this),F},$.prototype._read=function(p){var m=this.types[p.readLong()];if(!m)throw new Error(S("invalid union index"));var O=m._branchConstructor;return O===null?null:new O(m._read(p))},$.prototype._write=function(p,m){var O,y,F;m===null?(O=this._branchIndices.null,O===void 0&&De(m,this),p.writeLong(O)):(y=Object.keys(m),y.length===1&&(F=y[0],O=this._branchIndices[F]),O===void 0&&De(m,this),p.writeLong(O),this.types[O]._write(p,m[F]))},$.prototype._update=function(p,m,O){var y,F,e,u;for(y=0,F=this.types.length;y<F;y++){try{e=this.types[y].createResolver(m,O)}catch{continue}u=this.types[y]._branchConstructor,u?p._read=function(f){return new u(e._read(f))}:p._read=function(){return null};return}},$.prototype._copy=function(p,m){var O=m&&m.wrap|0;if(O===2){var y=this.types[0];return p===null&&y.typeName==="null"?null:new y._branchConstructor(y._copy(p,m))}if(p===null&&this._branchIndices.null!==void 0)return null;var F,e,u;if(typeof p=="object"){var f=Object.keys(p);if(f.length===1){var k=f[0];if(F=this._branchIndices[k],F===void 0&&m.qualifyNames){var v,i;for(v=0,e=this.types.length;v<e;v++)if(i=this.types[v],i.name&&k===s.unqualify(i.name)){F=v;break}}F!==void 0&&(u=this.types[F]._copy(p[k],m))}}if(O===1&&u===void 0)for(F=0,e=this.types.length;F<e&&u===void 0;)try{u=this.types[F]._copy(p,m)}catch{F++}if(u!==void 0)return O===3?u:new this.types[F]._branchConstructor(u);De(p,this)},$.prototype.compare=function(p,m){var O=p===null?"null":Object.keys(p)[0],y=m===null?"null":Object.keys(m)[0],F=this._branchIndices[O];return O===y?O==="null"?0:this.types[F].compare(p[O],m[O]):s.compare(F,this._branchIndices[y])},$.prototype.typeName="union:wrapped",$.prototype.random=function(){var p=U.nextInt(this.types.length),m=this.types[p],O=m._branchConstructor;return O?new O(m.random()):null};function ce(p,m){if(I.call(this,p,m),!Array.isArray(p.symbols)||!p.symbols.length)throw new Error(S("invalid enum symbols: %j",p.symbols));if(this.symbols=Object.freeze(p.symbols.slice()),this._indices={},this.symbols.forEach(function(O,y){if(!s.isValidName(O))throw new Error(S("invalid %s symbol: %j",this,O));if(this._indices[O]!==void 0)throw new Error(S("duplicate %s symbol: %j",this,O));this._indices[O]=y},this),this.default=p.default,this.default!==void 0&&this._indices[this.default]===void 0)throw new Error(S("invalid %s default: %j",this,this.default));this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}c.inherits(ce,I),ce.prototype._check=function(p,m,O){var y=this._indices[p]!==void 0;return!y&&O&&O(p,this),y},ce.prototype._read=function(p){var m=p.readLong(),O=this.symbols[m];if(O===void 0)throw new Error(S("invalid %s enum index: %s",this.name,m));return O},ce.prototype._skip=function(p){p.skipLong()},ce.prototype._write=function(p,m){var O=this._indices[m];O===void 0&&De(m,this),p.writeLong(O)},ce.prototype._match=function(p,m){return p.matchLong(m)},ce.prototype.compare=function(p,m){return s.compare(this._indices[p],this._indices[m])},ce.prototype._update=function(p,m,O){var y=this.symbols;m.typeName==="enum"&&pe(this,m,!O.ignoreNamespaces)&&(m.symbols.every(function(F){return~y.indexOf(F)})||this.default!==void 0)&&(p.symbols=m.symbols.map(function(F){return this._indices[F]===void 0?this.default:F},this),p._read=m._read)},ce.prototype._copy=function(p){return this._check(p,void 0,De),p},ce.prototype._deref=function(p){p.symbols=this.symbols},ce.prototype.getSymbols=function(){return this.symbols},ce.prototype.typeName="enum",ce.prototype.random=function(){return U.choice(this.symbols)};function se(p,m){if(I.call(this,p,m),p.size!==(p.size|0)||p.size<0)throw new Error(S("invalid %s size",this.branchName));this.size=p.size|0,this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}c.inherits(se,I),se.prototype._check=function(p,m,O){var y=l.isBuffer(p)&&p.length===this.size;return!y&&O&&O(p,this),y},se.prototype._read=function(p){return p.readFixed(this.size)},se.prototype._skip=function(p){p.skipFixed(this.size)},se.prototype._write=function(p,m){(!l.isBuffer(m)||m.length!==this.size)&&De(m,this),p.writeFixed(m,this.size)},se.prototype._match=function(p,m){return p.matchFixed(m,this.size)},se.prototype.compare=l.compare,se.prototype._update=function(p,m,O){m.typeName==="fixed"&&this.size===m.size&&pe(this,m,!O.ignoreNamespaces)&&(p.size=this.size,p._read=this._read)},se.prototype._copy=te.prototype._copy,se.prototype._deref=function(p){p.size=this.size},se.prototype.getSize=function(){return this.size},se.prototype.typeName="fixed",se.prototype.random=function(){return U.nextBuffer(this.size)};function g(p,m){if(I.call(this),!p.values)throw new Error(S("missing map values: %j",p));this.valuesType=I.forSchema(p.values,m),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}c.inherits(g,I),g.prototype._check=function(p,m,O,y){if(!p||typeof p!="object"||Array.isArray(p))return O&&O(p,this),!1;var F=Object.keys(p),e=!0,u,f,k,v;if(O){for(k=y.length,y.push(""),u=0,f=F.length;u<f;u++)v=y[k]=F[u],this.valuesType._check(p[v],m,O,y)||(e=!1);y.pop()}else for(u=0,f=F.length;u<f;u++)if(!this.valuesType._check(p[F[u]],m))return!1;return e},g.prototype._read=function(p){for(var m=this.valuesType,O={},y;y=ke(p);)for(;y--;){var F=p.readString();O[F]=m._read(p)}return O},g.prototype._skip=function(p){for(var m=this.valuesType,O,y;y=p.readLong();)if(y<0)O=p.readLong(),p.pos+=O;else for(;y--;)p.skipString(),m._skip(p)},g.prototype._write=function(p,m){(!m||typeof m!="object"||Array.isArray(m))&&De(m,this);var O=this.valuesType,y=Object.keys(m),F=y.length,e,u;if(F)for(p.writeLong(F),e=0;e<F;e++)u=y[e],p.writeString(u),O._write(p,m[u]);p.writeLong(0)},g.prototype._match=function(){throw new Error("maps cannot be compared")},g.prototype._update=function(p,m,O){m.typeName==="map"&&(p.valuesType=this.valuesType.createResolver(m.valuesType,O),p._read=this._read)},g.prototype._copy=function(p,m){if(p&&typeof p=="object"&&!Array.isArray(p)){var O=this.valuesType,y=Object.keys(p),F,e,u,f={};for(F=0,e=y.length;F<e;F++)u=y[F],f[u]=O._copy(p[u],m);return f}De(p,this)},g.prototype.compare=g.prototype._match,g.prototype.typeName="map",g.prototype.getValuesType=function(){return this.valuesType},g.prototype.random=function(){var p={},m,O;for(m=0,O=U.nextInt(10);m<O;m++)p[U.nextString(U.nextInt(20))]=this.valuesType.random();return p},g.prototype._deref=function(p,m){p.values=this.valuesType._attrs(m)};function L(p,m){if(I.call(this),!p.items)throw new Error(S("missing array items: %j",p));this.itemsType=I.forSchema(p.items,m),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}c.inherits(L,I),L.prototype._check=function(p,m,O,y){if(!Array.isArray(p))return O&&O(p,this),!1;var F=this.itemsType,e=!0,u,f,k;if(O){for(k=y.length,y.push(""),u=0,f=p.length;u<f;u++)y[k]=""+u,F._check(p[u],m,O,y)||(e=!1);y.pop()}else for(u=0,f=p.length;u<f;u++)if(!F._check(p[u],m))return!1;return e},L.prototype._read=function(p){for(var m=this.itemsType,O=0,y,F;F=p.readLong();)for(F<0&&(F=-F,p.skipLong()),y=y||new Array(F);F--;)y[O++]=m._read(p);return y||[]},L.prototype._skip=function(p){for(var m=this.itemsType,O,y;y=p.readLong();)if(y<0)O=p.readLong(),p.pos+=O;else for(;y--;)m._skip(p)},L.prototype._write=function(p,m){Array.isArray(m)||De(m,this);var O=this.itemsType,y=m.length,F;if(y)for(p.writeLong(y),F=0;F<y;F++)O._write(p,m[F]);p.writeLong(0)},L.prototype._match=function(p,m){for(var O=p.readLong(),y=m.readLong(),F;O&&y;){if(F=this.itemsType._match(p,m),F)return F;--O||(O=ke(p)),--y||(y=ke(m))}return s.compare(O,y)},L.prototype._update=function(p,m,O){m.typeName==="array"&&(p.itemsType=this.itemsType.createResolver(m.itemsType,O),p._read=this._read)},L.prototype._copy=function(p,m){Array.isArray(p)||De(p,this);var O=new Array(p.length),y,F;for(y=0,F=p.length;y<F;y++)O[y]=this.itemsType._copy(p[y],m);return O},L.prototype._deref=function(p,m){p.items=this.itemsType._attrs(m)},L.prototype.compare=function(p,m){var O=p.length,y=m.length,F,e,u;for(F=0,e=Math.min(O,y);F<e;F++)if(u=this.itemsType.compare(p[F],m[F]))return u;return s.compare(O,y)},L.prototype.getItemsType=function(){return this.itemsType},L.prototype.typeName="array",L.prototype.random=function(){var p=[],m,O;for(m=0,O=U.nextInt(10);m<O;m++)p.push(this.itemsType.random());return p};function j(p,m){m=m||{};var O=m.namespace;if(p.namespace!==void 0)m.namespace=p.namespace;else if(p.name){var y=s.impliedNamespace(p.name);y!==void 0&&(m.namespace=y)}if(I.call(this,p,m),!Array.isArray(p.fields))throw new Error(S("non-array record fields: %j",p.fields));if(s.hasDuplicates(p.fields,function(F){return F.name}))throw new Error(S("duplicate field name: %j",p.fields));this._fieldsByName={},this.fields=Object.freeze(p.fields.map(function(F){var e=new Y(F,m);return this._fieldsByName[e.name]=e,e},this)),this._branchConstructor=this._createBranchConstructor(),this._isError=p.type==="error",this.recordConstructor=this._createConstructor(m.errorStackTraces,m.omitRecordMethods),this._read=this._createReader(),this._skip=this._createSkipper(),this._write=this._createWriter(),this._check=this._createChecker(),m.namespace=O,Object.freeze(this)}c.inherits(j,I),j.prototype._getConstructorName=function(){return this.name?s.capitalize(s.unqualify(this.name)):this._isError?"Error$":"Record$"},j.prototype._createConstructor=function(p,m){var O=[],y=[],F=[],e="",u,f,k,v,i,n,w;for(u=0,f=this.fields.length;u<f;u++)k=this.fields[u],i=k.defaultValue,n=i()!==void 0,v=k.name,p&&this._isError&&v==="stack"&&I.isType(k.type,"string")&&!n&&(w=k),y.push("v"+u),e+=" ",n?(e+="if (v"+u+" === undefined) { ",e+="this."+v+" = d"+F.length+"(); ",e+="} else { this."+v+" = v"+u+`; }
|
|
23
|
+
`,O.push("d"+F.length),F.push(i)):e+="this."+v+" = v"+u+`;
|
|
24
|
+
`;w&&(e+=" if (this.stack === undefined) { ",typeof Error.captureStackTrace=="function"?e+="Error.captureStackTrace(this, this.constructor);":e+="this.stack = Error().stack;",e+=` }
|
|
25
|
+
`);var E="return function "+this._getConstructorName()+"(";E+=y.join()+`) {
|
|
26
|
+
`+e+"};";var C=new Function(O.join(),E).apply(void 0,F);if(m)return C;var R=this;return C.getType=function(){return R},C.type=R,this._isError&&(c.inherits(C,Error),C.prototype.name=this._getConstructorName()),C.prototype.clone=function(oe){return R.clone(this,oe)},C.prototype.compare=function(oe){return R.compare(this,oe)},C.prototype.isValid=function(oe){return R.isValid(this,oe)},C.prototype.toBuffer=function(){return R.toBuffer(this)},C.prototype.toString=function(){return R.toString(this)},C.prototype.wrap=function(){return R.wrap(this)},C.prototype.wrapped=C.prototype.wrap,C},j.prototype._createChecker=function(){var p=[],m=[],O="return function check"+this._getConstructorName()+`(v, f, h, p) {
|
|
27
|
+
`;if(O+=` if (
|
|
28
|
+
`,O+=` v === null ||
|
|
29
|
+
`,O+=` typeof v != 'object' ||
|
|
30
|
+
`,O+=` (f && !this._checkFields(v))
|
|
31
|
+
`,O+=` ) {
|
|
32
|
+
`,O+=` if (h) { h(v, this); }
|
|
33
|
+
`,O+=` return false;
|
|
34
|
+
`,O+=` }
|
|
35
|
+
`,!this.fields.length)O+=` return true;
|
|
36
|
+
`;else{for(y=0,F=this.fields.length;y<F;y++)e=this.fields[y],p.push("t"+y),m.push(e.type),e.defaultValue()!==void 0&&(O+=" var v"+y+" = v."+e.name+`;
|
|
37
|
+
`);O+=` if (h) {
|
|
38
|
+
`,O+=` var b = 1;
|
|
39
|
+
`,O+=` var j = p.length;
|
|
40
|
+
`,O+=` p.push('');
|
|
41
|
+
`;var y,F,e;for(y=0,F=this.fields.length;y<F;y++)e=this.fields[y],O+=" p[j] = '"+e.name+`';
|
|
42
|
+
`,O+=" b &= ",e.defaultValue()===void 0?O+="t"+y+"._check(v."+e.name+`, f, h, p);
|
|
43
|
+
`:(O+="v"+y+" === undefined || ",O+="t"+y+"._check(v"+y+`, f, h, p);
|
|
44
|
+
`);O+=` p.pop();
|
|
45
|
+
`,O+=` return !!b;
|
|
46
|
+
`,O+=` } else {
|
|
47
|
+
return (
|
|
48
|
+
`,O+=this.fields.map(function(u,f){return u.defaultValue()===void 0?"t"+f+"._check(v."+u.name+", f)":"(v"+f+" === undefined || t"+f+"._check(v"+f+", f))"}).join(` &&
|
|
49
|
+
`),O+=`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
`}return O+="};",new Function(p.join(),O).apply(void 0,m)},j.prototype._createReader=function(){var p=[],m=[this.recordConstructor],O,y;for(O=0,y=this.fields.length;O<y;O++)p.push("t"+O),m.push(this.fields[O].type);var F=this._getConstructorName(),e="return function read"+F+`(t) {
|
|
53
|
+
`;return e+=" return new "+F+`(
|
|
54
|
+
`,e+=p.map(function(u){return u+"._read(t)"}).join(`,
|
|
55
|
+
`),e+=`
|
|
56
|
+
);
|
|
57
|
+
};`,p.unshift(F),new Function(p.join(),e).apply(void 0,m)},j.prototype._createSkipper=function(){var p=[],m="return function skip"+this._getConstructorName()+`(t) {
|
|
58
|
+
`,O=[],y,F;for(y=0,F=this.fields.length;y<F;y++)p.push("t"+y),O.push(this.fields[y].type),m+=" t"+y+`._skip(t);
|
|
59
|
+
`;return m+="}",new Function(p.join(),m).apply(void 0,O)},j.prototype._createWriter=function(){var p=[],m="return function write"+this._getConstructorName()+`(t, v) {
|
|
60
|
+
`,O=[],y,F,e,u;for(y=0,F=this.fields.length;y<F;y++)e=this.fields[y],p.push("t"+y),O.push(e.type),m+=" ",e.defaultValue()===void 0?m+="t"+y+"._write(t, v."+e.name+`);
|
|
61
|
+
`:(u=e.type.toBuffer(e.defaultValue()).toString("binary"),p.push("d"+y),O.push(u),m+="var v"+y+" = v."+e.name+`;
|
|
62
|
+
`,m+="if (v"+y+` === undefined) {
|
|
63
|
+
`,m+=" t.writeBinary(d"+y+", "+u.length+`);
|
|
64
|
+
`,m+=` } else {
|
|
65
|
+
t`+y+"._write(t, v"+y+`);
|
|
66
|
+
}
|
|
67
|
+
`);return m+="}",new Function(p.join(),m).apply(void 0,O)},j.prototype._update=function(p,m,O){if(!pe(this,m,!O.ignoreNamespaces))throw new Error(S("no alias found for %s",m.name));var y=this.fields,F=m.fields,e=s.toMap(F,function(A){return A.name}),u=[],f={},k,v,i,n,w,E,C;for(k=0;k<y.length;k++){for(i=y[k],w=ie(i),E=[],v=0;v<w.length;v++)n=w[v],e[n]&&E.push(n);if(E.length>1)throw new Error(S("ambiguous aliasing for %s.%s (%s)",m.name,i.name,E));if(E.length)n=E[0],C={resolver:i.type.createResolver(e[n].type,O),name:"_"+i.name},f[n]?f[n].push(C):f[n]=[C],u.push(C.name);else{if(i.defaultValue()===void 0)throw new Error(S("no matching field for default-less %s.%s",m.name,i.name));u.push("undefined")}}var R=-1;for(k=F.length;k&&f[F[--k].name]===void 0;)R=k;var oe=this._getConstructorName(),ue=[oe],re=[this.recordConstructor],he=" return function read"+oe+`(t, b) {
|
|
68
|
+
`;for(k=0;k<F.length;k++)if(k===R&&(he+=` if (!b) {
|
|
69
|
+
`),i=m.fields[k],n=i.name,f[n]===void 0)he+=~R&&k>=R?" ":" ",ue.push("r"+k),re.push(i.type),he+="r"+k+`._skip(t);
|
|
70
|
+
`;else for(v=f[n].length;v--;)he+=~R&&k>=R?" ":" ",ue.push("r"+k+"f"+v),C=f[n][v],re.push(C.resolver),he+="var "+C.name+" = ",he+="r"+k+"f"+v+"._"+(v?"peek":"read")+`(t);
|
|
71
|
+
`;~R&&(he+=` }
|
|
72
|
+
`),he+=" return new "+oe+"("+u.join()+`);
|
|
73
|
+
};`,p._read=new Function(ue.join(),he).apply(void 0,re)},j.prototype._match=function(p,m){var O=this.fields,y,F,e,u,f;for(y=0,F=O.length;y<F;y++)if(e=O[y],u=e._order,f=e.type,u){if(u*=f._match(p,m),u)return u}else f._skip(p),f._skip(m);return 0},j.prototype._checkFields=function(p){var m=Object.keys(p),O,y;for(O=0,y=m.length;O<y;O++)if(!this._fieldsByName[m[O]])return!1;return!0},j.prototype._copy=function(p,m){var O=m&&m.fieldHook,y=[void 0],F,e,u,f;for(F=0,e=this.fields.length;F<e;F++)u=this.fields[F],f=p[u.name],f===void 0&&u.hasOwnProperty("defaultValue")&&(f=u.defaultValue()),(m&&!m.skip||f!==void 0)&&(f=u.type._copy(f,m)),O&&(f=O(u,f,this)),y.push(f);var k=this.recordConstructor;return new(k.bind.apply(k,y))},j.prototype._deref=function(p,m){p.fields=this.fields.map(function(O){var y=O.type,F={name:O.name,type:y._attrs(m)};if(m.exportAttrs){var e=O.defaultValue();e!==void 0&&(F.default=y._copy(e,{coerce:3,wrap:3}));var u=O.order;u!=="ascending"&&(F.order=u);var f=O.aliases;f.length&&(F.aliases=f);var k=O.doc;k!==void 0&&(F.doc=k)}return F})},j.prototype.compare=function(p,m){var O=this.fields,y,F,e,u,f,k;for(y=0,F=O.length;y<F;y++)if(e=O[y],u=e.name,f=e._order,k=e.type,f&&(f*=k.compare(p[u],m[u]),f))return f;return 0},j.prototype.random=function(){var p=this.fields.map(function(O){return O.type.random()});p.unshift(void 0);var m=this.recordConstructor;return new(m.bind.apply(m,p))},j.prototype.field=function(p){return this._fieldsByName[p]},j.prototype.getField=j.prototype.field,j.prototype.getFields=function(){return this.fields},j.prototype.getRecordConstructor=function(){return this.recordConstructor},Object.defineProperty(j.prototype,"typeName",{enumerable:!0,get:function(){return this._isError?"error":"record"}});function ne(p,m){this._logicalTypeName=p.logicalType,I.call(this),_=this;try{this._underlyingType=I.forSchema(p,m)}finally{_=null;var O=x.length;O&&x[O-1][0]===this&&x.pop()}I.isType(this.underlyingType,"union")?this._branchConstructor=this.underlyingType._branchConstructor:this._branchConstructor=this.underlyingType._createBranchConstructor()}c.inherits(ne,I),Object.defineProperty(ne.prototype,"typeName",{enumerable:!0,get:function(){return"logical:"+this._logicalTypeName}}),Object.defineProperty(ne.prototype,"underlyingType",{enumerable:!0,get:function(){if(this._underlyingType)return this._underlyingType;var p,m,O;for(p=0,m=x.length;p<m;p++)if(O=x[p],O[0]===this)return O[1]}}),ne.prototype.getUnderlyingType=function(){return this.underlyingType},ne.prototype._read=function(p){return this._fromValue(this.underlyingType._read(p))},ne.prototype._write=function(p,m){this.underlyingType._write(p,this._toValue(m))},ne.prototype._check=function(p,m,O,y){try{var F=this._toValue(p)}catch{}return F===void 0?(O&&O(p,this),!1):this.underlyingType._check(F,m,O,y)},ne.prototype._copy=function(p,m){var O=this.underlyingType;switch(m&&m.coerce){case 3:return O._copy(this._toValue(p),m);case 2:return this._fromValue(O._copy(p,m));default:return this._fromValue(O._copy(this._toValue(p),m))}},ne.prototype._update=function(p,m,O){var y=this._resolve(m,O);y&&(p._read=function(F){return y(m._read(F))})},ne.prototype.compare=function(p,m){var O=this._toValue(p),y=this._toValue(m);return this.underlyingType.compare(O,y)},ne.prototype.random=function(){return this._fromValue(this.underlyingType.random())},ne.prototype._deref=function(p,m){var O=this.underlyingType,y=O.name!==void 0&&m.derefed[O.name];return p=O._attrs(m),!y&&m.exportAttrs&&(typeof p=="string"&&(p={type:p}),p.logicalType=this._logicalTypeName,this._export(p)),p},ne.prototype._skip=function(p){this.underlyingType._skip(p)},ne.prototype._export=function(){},ne.prototype._fromValue=s.abstractFunction,ne.prototype._toValue=s.abstractFunction,ne.prototype._resolve=s.abstractFunction;function z(p){this._concreteTypeName="long",H.call(this,!0),this._noUnpack=!!p}c.inherits(z,W),z.prototype.typeName="abstract:long",z.prototype._check=function(p,m,O){var y=this._isValid(p);return!y&&O&&O(p,this),y},z.prototype._read=function(p){var m,O;if(this._noUnpack?(O=p.pos,p.skipLong(),m=p.buf.slice(O,p.pos)):m=p.unpackLongBytes(p),p.isValid())return this._fromBuffer(m)},z.prototype._write=function(p,m){this._isValid(m)||De(m,this);var O=this._toBuffer(m);this._noUnpack?p.writeFixed(O):p.packLongBytes(O)},z.prototype._copy=function(p,m){switch(m&&m.coerce){case 3:return this._toJSON(p);case 2:return this._fromJSON(p);default:return this._fromJSON(this._toJSON(p))}},z.prototype._deref=function(){return"long"},z.prototype._update=function(p,m){var O=this;switch(m.typeName){case"int":p._read=function(y){return O._fromJSON(m._read(y))};break;case"abstract:long":case"long":p._read=function(y){return O._read(y)}}},z.prototype.random=function(){return this._fromJSON(W.prototype.random())},z.prototype._fromBuffer=s.abstractFunction,z.prototype._toBuffer=s.abstractFunction,z.prototype._fromJSON=s.abstractFunction,z.prototype._toJSON=s.abstractFunction,z.prototype._isValid=s.abstractFunction,z.prototype.compare=s.abstractFunction;function Y(p,m){var O=p.name;if(typeof O!="string"||!s.isValidName(O))throw new Error(S("invalid field name: %s",O));this.name=O,this.type=I.forSchema(p.type,m),this.aliases=p.aliases||[],this.doc=p.doc!==void 0?""+p.doc:void 0,this._order=(function(f){switch(f){case"ascending":return 1;case"descending":return-1;case"ignore":return 0;default:throw new Error(S("invalid order: %j",f))}})(p.order===void 0?"ascending":p.order);var y=p.default;if(y!==void 0){var F=this.type,e;try{e=F._copy(y,{coerce:2,wrap:2})}catch(f){var u=S("incompatible field default %j (%s)",y,f.message);throw I.isType(F,"union")&&(u+=S(", union defaults must match the first branch's type (%j)",F.types[0])),new Error(u)}fe(F.typeName)&&F.typeName!=="bytes"?this.defaultValue=function(){return e}:this.defaultValue=function(){return F._copy(e)}}Object.freeze(this)}Y.prototype.defaultValue=function(){},Object.defineProperty(Y.prototype,"order",{enumerable:!0,get:function(){return["descending","ignore","ascending"][this._order+1]}}),Y.prototype.getAliases=function(){return this.aliases},Y.prototype.getDefault=Y.prototype.defaultValue,Y.prototype.getName=function(){return this.name},Y.prototype.getOrder=function(){return this.order},Y.prototype.getType=function(){return this.type};function ve(p){this._readerType=p,this._read=null,this.itemsType=null,this.size=0,this.symbols=null,this.valuesType=null}ve.prototype._peek=I.prototype._peek,ve.prototype.inspect=function(){return"<Resolver>"};function we(){this.str=void 0}function _e(p,m,O,y){if(O){if(O._readerType!==p)throw new Error("invalid resolver");return O._read(m,y)}else return p._read(m)}function ie(p){var m={};p.name&&(m[p.name]=!0);var O=p.aliases,y,F;for(y=0,F=O.length;y<F;y++)m[O[y]]=!0;return Object.keys(m)}function pe(p,m,O){if(!m.name)return!0;var y=O?m.name:s.unqualify(m.name),F=ie(p),e,u,f;for(e=0,u=F.length;e<u;e++)if(f=F[e],O||(f=s.unqualify(f)),f===y)return!0;return!1}function fe(p){var m=D[p];return m&&m.prototype instanceof H}function ge(p){if(p==="error")p="record";else{var m=/^([^:]+):(.*)$/.exec(p);m&&(m[1]==="union"?p=m[2]+"Union":p=m[1])}return s.capitalize(p)+"Type"}function ke(p){var m=p.readLong();return m<0&&(m=-m,p.skipLong()),m}function Ee(p){return p>=-9007199254740990&&p<=9007199254740990}function Ie(p){return p&&p.type==="Buffer"&&Array.isArray(p.data)}function De(p,m){throw new Error(S("invalid %j: %j",m.schema(),p))}function Ue(p,m){var O=s.unqualify(p);return fe(O)?O:s.qualify(p,m)}function Ne(p){var m=p.typeName;switch(m){case"double":case"float":case"int":case"long":return"number";case"bytes":case"fixed":return"buffer";case"enum":return"string";case"map":case"error":case"record":return"object";default:return m}}function Me(p){if(p===null)return"null";var m=typeof p;if(m==="object"){if(Array.isArray(p))return"array";if(l.isBuffer(p))return"buffer"}return m}function Ce(p){var m={},O,y,F,e;for(O=0,y=p.length;O<y;O++)if(e=p[O],!I.isType(e,"logical")){if(F=Ne(e),m[F])return!0;m[F]=!0}return!1}function Ge(p){var m=["int","long","float","double"],O=-1,y=null,F,e,u,f;for(F=0,e=p.length;F<e;F++)u=p[F],f=m.indexOf(u.typeName),f>O&&(O=f,y=u);return y}function qe(p,m){var O={},y,F,e,u;for(y=0,F=p.length;y<F;y++){if(e=p[y],e.typeName==="string")return e;u=e.symbols;var f,k;for(f=0,k=u.length;f<k;f++)O[u[f]]=!0}return I.forSchema({type:"enum",symbols:Object.keys(O)},m)}function ae(p,m){var O=-1,y,F,e;for(y=0,F=p.length;y<F;y++){if(e=p[y],e.typeName==="bytes")return e;O===-1?O=e.size:e.size!==O&&(O=-2)}return O<0?I.forSchema("bytes",m):p[0]}function le(p,m){var O=[],y={},F={},e=!0,u,f,k,v;for(u=0,f=p.length;u<f;u++)if(k=p[u],k.typeName==="map")e=!1,O.push(k.valuesType);else{v=k.fields;var i,n,w,E,C,R;for(i=0,n=v.length;i<n;i++)w=v[i],C=w.name,R=w.type,O.push(R),e&&(y[C]||(y[C]=[]),y[C].push(R),E=w.defaultValue(),E!==void 0&&(F[C]=E))}if(e){var oe=Object.keys(y);for(u=0,f=oe.length;u<f;u++)C=oe[u],y[C].length<p.length&&F[C]===void 0&&(m&&m.strictDefaults?e=!1:(y[C].unshift(I.forSchema("null",m)),F[C]=null))}var ue;return e?ue={type:"record",fields:oe.map(function(re){var he=I.forTypes(y[re],m),A=F[re];if(A!==void 0&&~he.typeName.indexOf("union")){var Se=he.types.slice(),Pe,Te;for(Pe=0,Te=Se.length;Pe<Te&&!Se[Pe].isValid(A);Pe++);if(Pe>0){var He=Se[0];Se[0]=Se[Pe],Se[Pe]=He,he=I.forSchema(Se,m)}}return{name:re,type:he,default:F[re]}})}:ue={type:"map",values:I.forTypes(O,m)},I.forSchema(ue,m)}r.exports={Type:I,getTypeBucket:Ne,getValueBucket:Me,isPrimitive:fe,builtins:(function(){var p={LogicalType:ne,UnwrappedUnionType:G,WrappedUnionType:$},m=Object.keys(D),O,y,F;for(O=0,y=m.length;O<y;O++)F=m[O],p[ge(F)]=D[F];return p})()}})),Ju=je(((t,r)=>{var s=pi();function a(c,l){var h;if(typeof c=="string")try{h=JSON.parse(c)}catch{h=c}else h=c;return s.Type.forSchema(h,l)}r.exports={Type:s.Type,parse:a,types:s.builtins,combine:s.Type.forTypes,infer:s.Type.forValue}})),Ku=je(((t,r)=>{var s=typeof Reflect=="object"?Reflect:null,a=s&&typeof s.apply=="function"?s.apply:function(te,J,G){return Function.prototype.apply.call(te,J,G)},c;s&&typeof s.ownKeys=="function"?c=s.ownKeys:Object.getOwnPropertySymbols?c=function(te){return Object.getOwnPropertyNames(te).concat(Object.getOwnPropertySymbols(te))}:c=function(te){return Object.getOwnPropertyNames(te)};function l(V){console&&console.warn&&console.warn(V)}var h=Number.isNaN||function(te){return te!==te};function o(){o.init.call(this)}r.exports=o,r.exports.once=W,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var S=10;function D(V){if(typeof V!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof V)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return S},set:function(V){if(typeof V!="number"||V<0||h(V))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+V+".");S=V}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(te){if(typeof te!="number"||te<0||h(te))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+te+".");return this._maxListeners=te,this};function U(V){return V._maxListeners===void 0?o.defaultMaxListeners:V._maxListeners}o.prototype.getMaxListeners=function(){return U(this)},o.prototype.emit=function(te){for(var J=[],G=1;G<arguments.length;G++)J.push(arguments[G]);var $=te==="error",ce=this._events;if(ce!==void 0)$=$&&ce.error===void 0;else if(!$)return!1;if($){var se;if(J.length>0&&(se=J[0]),se instanceof Error)throw se;var g=new Error("Unhandled error."+(se?" ("+se.message+")":""));throw g.context=se,g}var L=ce[te];if(L===void 0)return!1;if(typeof L=="function")a(L,this,J);else for(var j=L.length,ne=ee(L,j),G=0;G<j;++G)a(ne[G],this,J);return!0};function M(V,te,J,G){var $,ce,se;if(D(J),ce=V._events,ce===void 0?(ce=V._events=Object.create(null),V._eventsCount=0):(ce.newListener!==void 0&&(V.emit("newListener",te,J.listener?J.listener:J),ce=V._events),se=ce[te]),se===void 0)se=ce[te]=J,++V._eventsCount;else if(typeof se=="function"?se=ce[te]=G?[J,se]:[se,J]:G?se.unshift(J):se.push(J),$=U(V),$>0&&se.length>$&&!se.warned){se.warned=!0;var g=new Error("Possible EventEmitter memory leak detected. "+se.length+" "+String(te)+" listeners added. Use emitter.setMaxListeners() to increase limit");g.name="MaxListenersExceededWarning",g.emitter=V,g.type=te,g.count=se.length,l(g)}return V}o.prototype.addListener=function(te,J){return M(this,te,J,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(te,J){return M(this,te,J,!0)};function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function x(V,te,J){var G={fired:!1,wrapFn:void 0,target:V,type:te,listener:J},$=_.bind(G);return $.listener=J,G.wrapFn=$,$}o.prototype.once=function(te,J){return D(J),this.on(te,x(this,te,J)),this},o.prototype.prependOnceListener=function(te,J){return D(J),this.prependListener(te,x(this,te,J)),this},o.prototype.removeListener=function(te,J){var G,$,ce,se,g;if(D(J),$=this._events,$===void 0)return this;if(G=$[te],G===void 0)return this;if(G===J||G.listener===J)--this._eventsCount===0?this._events=Object.create(null):(delete $[te],$.removeListener&&this.emit("removeListener",te,G.listener||J));else if(typeof G!="function"){for(ce=-1,se=G.length-1;se>=0;se--)if(G[se]===J||G[se].listener===J){g=G[se].listener,ce=se;break}if(ce<0)return this;ce===0?G.shift():Z(G,ce),G.length===1&&($[te]=G[0]),$.removeListener!==void 0&&this.emit("removeListener",te,g||J)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(te){var J,G=this._events,$;if(G===void 0)return this;if(G.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):G[te]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete G[te]),this;if(arguments.length===0){var ce=Object.keys(G),se;for($=0;$<ce.length;++$)se=ce[$],se!=="removeListener"&&this.removeAllListeners(se);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(J=G[te],typeof J=="function")this.removeListener(te,J);else if(J!==void 0)for($=J.length-1;$>=0;$--)this.removeListener(te,J[$]);return this};function I(V,te,J){var G=V._events;if(G===void 0)return[];var $=G[te];return $===void 0?[]:typeof $=="function"?J?[$.listener||$]:[$]:J?K($):ee($,$.length)}o.prototype.listeners=function(te){return I(this,te,!0)},o.prototype.rawListeners=function(te){return I(this,te,!1)},o.listenerCount=function(V,te){return typeof V.listenerCount=="function"?V.listenerCount(te):H.call(V,te)},o.prototype.listenerCount=H;function H(V){var te=this._events;if(te!==void 0){var J=te[V];if(typeof J=="function")return 1;if(J!==void 0)return J.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?c(this._events):[]};function ee(V,te){for(var J=new Array(te),G=0;G<te;++G)J[G]=V[G];return J}function Z(V,te){for(;te+1<V.length;te++)V[te]=V[te+1];V.pop()}function K(V){for(var te=new Array(V.length),J=0;J<te.length;++J)te[J]=V[J].listener||V[J];return te}function W(V,te){return new Promise(function(J,G){function $(se){V.removeListener(te,ce),G(se)}function ce(){typeof V.removeListener=="function"&&V.removeListener("error",$),J([].slice.call(arguments))}Q(V,te,ce,{once:!0}),te!=="error"&&X(V,$,{once:!0})})}function X(V,te,J){typeof V.on=="function"&&Q(V,"error",te,J)}function Q(V,te,J,G){if(typeof V.on=="function")G.once?V.once(te,J):V.on(te,J);else if(typeof V.addEventListener=="function")V.addEventListener(te,function $(ce){G.once&&V.removeEventListener(te,$),J(ce)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof V)}})),Tr=je(((t,r)=>{r.exports={}})),Qu=je(((t,r)=>{var s=pi(),a=cr(),c=Er(),l=Ku(),h=Tr(),o=xt(),S=c.Buffer,D=a.Tap,U=s.Type,M=o.debuglog("avsc:services"),_=o.format,x={namespace:"org.apache.avro.ipc"},I=U.forSchema("boolean",x),H=U.forSchema({type:"map",values:"bytes"},x),ee=U.forSchema("string",x),Z=U.forSchema({name:"HandshakeRequest",type:"record",fields:[{name:"clientHash",type:{name:"MD5",type:"fixed",size:16}},{name:"clientProtocol",type:["null","string"],default:null},{name:"serverHash",type:"MD5"},{name:"meta",type:["null",H],default:null}]},x),K=U.forSchema({name:"HandshakeResponse",type:"record",fields:[{name:"match",type:{name:"HandshakeMatch",type:"enum",symbols:["BOTH","CLIENT","NONE"]}},{name:"serverProtocol",type:["null","string"],default:null},{name:"serverHash",type:["null","MD5"],default:null},{name:"meta",type:["null",H],default:null}]},x),W=16,X=new Q("",U.forSchema({name:"PingRequest",type:"record",fields:[]},x),U.forSchema(["string"],x),U.forSchema("null",x));function Q(y,F,e,u,f,k){if(this.name=y,!U.isType(F,"record"))throw new Error("invalid request type");if(this.requestType=F,!U.isType(e,"union")||!U.isType(e.getTypes()[0],"string"))throw new Error("invalid error type");if(this.errorType=e,f&&(!U.isType(u,"null")||e.getTypes().length>1))throw new Error("inapplicable one-way parameter");this.responseType=u,this.oneWay=!!f,this.doc=k!==void 0?""+k:void 0,Object.freeze(this)}Q.forSchema=function(y,F,e){if(e=e||{},!a.isValidName(y))throw new Error(_("invalid message name: %s",y));if(!Array.isArray(F.request))throw new Error(_("invalid message request: %s",y));var u=_("%s.%sRequest",x.namespace,a.capitalize(y)),f=U.forSchema({name:u,type:"record",namespace:e.namespace||"",fields:F.request},e);if(delete e.registry[u],!F.response)throw new Error(_("invalid message response: %s",y));var k=U.forSchema(F.response,e);if(F.errors!==void 0&&!Array.isArray(F.errors))throw new Error(_("invalid message errors: %s",y));return new Q(y,f,U.forSchema(["string"].concat(F.errors||[]),e),k,!!F["one-way"],F.doc)},Q.prototype.schema=U.prototype.getSchema,Q.prototype._attrs=function(y){var F={request:this.requestType._attrs(y).fields,response:this.responseType._attrs(y)},e=this.doc;e!==void 0&&(F.doc=e);var u=this.errorType._attrs(y);return u.length>1&&(F.errors=u.slice(1)),this.oneWay&&(F["one-way"]=!0),F},a.addDeprecatedGetters(Q,["name","errorType","requestType","responseType"]),Q.prototype.isOneWay=o.deprecate(function(){return this.oneWay},"use `.oneWay` directly instead of `.isOneWay()`");function V(y,F,e,u,f){if(typeof y!="string")return V.forProtocol(y,F);this.name=y,this._messagesByName=F||{},this.messages=Object.freeze(a.objectValues(this._messagesByName)),this._typesByName=e||{},this.types=Object.freeze(a.objectValues(this._typesByName)),this.protocol=u,this._hashStr=a.getHash(JSON.stringify(u)).toString("binary"),this.doc=u.doc?""+u.doc:void 0,this._server=f||this.createServer({silent:!0}),Object.freeze(this)}V.Client=J,V.Server=G,V.compatible=function(y,F){try{Ie(y,F)}catch{return!1}return!0},V.forProtocol=function(y,F){F=F||{};var e=y.protocol;if(!e)throw new Error("missing protocol name");if(y.namespace!==void 0)F.namespace=y.namespace;else{var u=/^(.*)\.[^.]+$/.exec(e);u&&(F.namespace=u[1])}e=a.qualify(e,F.namespace),y.types&&y.types.forEach(function(k){U.forSchema(k,F)});var f;return y.messages&&(f={},Object.keys(y.messages).forEach(function(k){f[k]=Q.forSchema(k,y.messages[k],F)})),new V(e,f,F.registry,y)},V.isService=function(y){return!!y&&y.hasOwnProperty("_hashStr")},V.prototype.createClient=function(y){var F=new J(this,y);return process.nextTick(function(){if(y&&y.server){var e={objectMode:!0},u=[new h.PassThrough(e),new h.PassThrough(e)];y.server.createChannel({readable:u[0],writable:u[1]},e),F.createChannel({readable:u[1],writable:u[0]},e)}else y&&y.transport&&F.createChannel(y.transport)}),F},V.prototype.createServer=function(y){return new G(this,y)},Object.defineProperty(V.prototype,"hash",{enumerable:!0,get:function(){return a.bufferFrom(this._hashStr,"binary")}}),V.prototype.message=function(y){return this._messagesByName[y]},V.prototype.type=function(y){return this._typesByName[y]},V.prototype.inspect=function(){return _("<Service %j>",this.name)},a.addDeprecatedGetters(V,["message","messages","name","type","types"]),V.prototype.createEmitter=o.deprecate(function(y,F){F=F||{};var e=this.createClient({cache:F.cache,buffering:!1,strictTypes:F.strictErrors,timeout:F.timeout}),u=e.createChannel(y,F);return Me(e,u),u},"use `.createClient()` instead of `.createEmitter()`"),V.prototype.createListener=o.deprecate(function(y,F){if(F&&F.strictErrors)throw new Error("use `.createServer()` to support strict errors");return this._server.createChannel(y,F)},"use `.createServer().createChannel()` instead of `.createListener()`"),V.prototype.emit=o.deprecate(function(y,F,e,u){if(!e||!this.equals(e.client._svc$))throw new Error("invalid emitter");var f=e.client;return J.prototype.emitMessage.call(f,y,F,u&&u.bind(this)),e.getPending()},"create a client via `.createClient()` to emit messages instead of `.emit()`"),V.prototype.equals=o.deprecate(function(y){return V.isService(y)&&this.getFingerprint().equals(y.getFingerprint())},"equality testing is deprecated, compare the `.protocol`s instead"),V.prototype.getFingerprint=o.deprecate(function(y){return a.getHash(JSON.stringify(this.protocol),y)},"use `.hash` instead of `.getFingerprint()`"),V.prototype.getSchema=o.deprecate(U.prototype.getSchema,"use `.protocol` instead of `.getSchema()`"),V.prototype.on=o.deprecate(function(y,F){var e=this;return this._server.onMessage(y,function(u,f){return F.call(e,u,this.channel,f)}),this},"use `.createServer().onMessage()` instead of `.on()`"),V.prototype.subprotocol=o.deprecate(function(){var y=this._server,F={strictTypes:y._strict,cache:y._cache},e=new G(y.service,F);return e._handlers=Object.create(y._handlers),new V(this.name,this._messagesByName,this._typesByName,this.protocol,e)},"`.subprotocol()` will be removed in 5.1"),V.prototype._attrs=function(y){var F={protocol:this.name},e=[];this.types.forEach(function(f){if(f.getName()!==void 0){var k=f._attrs(y);typeof k!="string"&&e.push(k)}}),e.length&&(F.types=e);var u=Object.keys(this._messagesByName);return u.length&&(F.messages={},u.forEach(function(f){F.messages[f]=this._messagesByName[f]._attrs(y)},this)),y&&y.exportAttrs&&this.doc!==void 0&&(F.doc=this.doc),F};function te(y,F,e){e===void 0&&typeof F=="function"&&(e=F,F=void 0);var u=new V({protocol:"Empty"},x),f;u.createClient({timeout:F&&F.timeout}).createChannel(y,{scope:F&&F.scope,endWritable:typeof y=="function"}).once("handshake",function(k,v){f=v.serverProtocol,this.destroy(!0)}).once("eot",function(k,v){v&&!/interrupted/.test(v)?e(v):e(null,JSON.parse(f))})}function J(y,F){F=F||{},l.EventEmitter.call(this),this._svc$=y,this._channels$=[],this._fns$=[],this._buffering$=!!F.buffering,this._cache$=F.cache||{},this._policy$=F.channelPolicy,this._strict$=!!F.strictTypes,this._timeout$=a.getOption(F,"timeout",1e4),F.remoteProtocols&&De(this._cache$,F.remoteProtocols,y,!0),this._svc$.messages.forEach(function(e){this[e.name]=this._createMessageHandler$(e)},this)}o.inherits(J,l.EventEmitter),J.prototype.activeChannels=function(){return this._channels$.slice()},J.prototype.createChannel=function(y,F){var e=F&&F.objectMode,u;if(typeof y=="function"){var f;e?f=y:f=function(E){var C=new ie,R=y(function(oe,ue){if(oe){E(oe);return}var re=new _e().once("error",function(he){u.destroy(he)});E(null,ue.pipe(re))});if(R)return C.pipe(R),C},u=new ce(this,f,F)}else{var k,v;if(p(y)?k=v=y:(k=y.readable,v=y.writable),!e){var i=new pe;k=k.pipe(i);var n=new fe;n.pipe(v),v=n}u=new se(this,k,v,F),e||(u.once("eot",function(){k.unpipe(i),n.unpipe(v)}),i.once("error",function(E){u.destroy(E)}))}var w=this._channels$;return w.push(u),u.once("_drain",function(){w.splice(w.indexOf(this),1)}),this._buffering$=!1,this.emit("channel",u),u},J.prototype.destroyChannels=function(y){this._channels$.forEach(function(F){F.destroy(y&&y.noWait)})},J.prototype.emitMessage=function(y,F,e,u){var f=new ne(m(this._svc$,y),{},F);this._emitMessage$(f,e,u)},J.prototype.remoteProtocols=function(){return Ue(this._cache$,!0)},Object.defineProperty(J.prototype,"service",{enumerable:!0,get:function(){return this._svc$}}),J.prototype.use=function(){var y,F,e;for(y=0,F=arguments.length;y<F;y++)e=arguments[y],this._fns$.push(e.length<3?e(this):e);return this},J.prototype._emitMessage$=function(y,F,e){!e&&typeof F=="function"&&(e=F,F=void 0);var u=this,f=this._channels$,k=f.length;if(!k){if(this._buffering$)M("no active client channels, buffering call"),this.once("channel",function(){this._emitMessage$(y,F,e)});else{var v=new Error("no active channels");process.nextTick(function(){e?e.call(new Y(y._msg),v):u.emit("error",v)})}return}F=F||{},F.timeout===void 0&&(F.timeout=this._timeout$);var i;if(k===1)i=f[0];else if(this._policy$){if(i=this._policy$(this._channels$.slice()),!i){M("policy returned no channel, skipping call");return}}else i=f[Math.floor(Math.random()*k)];i._emit(y,F,function(n,w){var E=this,C=E.message.errorType;if(n){u._strict$&&(n=C.clone(n.message,{wrapUnions:!0})),R(n);return}if(!w){R();return}n=w.error,u._strict$||(n===void 0?n=null:U.isType(C,"union:unwrapped")?typeof n=="string"&&(n=new Error(n)):n&&n.string&&typeof n.string=="string"&&(n=new Error(n.string))),R(n,w.response);function R(oe,ue){e?e.call(E,oe,ue):oe&&u.emit("error",oe)}})},J.prototype._createMessageHandler$=function(y){var F=y.requestType.getFields().map(function(u){return u.getName()}),e="return function "+y.name+"(";return F.length&&(e+=F.join(", ")+", "),e+=`opts, cb) {
|
|
74
|
+
`,e+=" var req = {",e+=F.map(function(u){return u+": "+u}).join(", "),e+=`};
|
|
75
|
+
`,e+=" return this.emitMessage('"+y.name+`', req, opts, cb);
|
|
76
|
+
`,e+="};",new Function(e)()};function G(y,F){F=F||{},l.EventEmitter.call(this),this.service=y,this._handlers={},this._fns=[],this._channels={},this._nextChannelId=1,this._cache=F.cache||{},this._defaultHandler=F.defaultHandler,this._sysErrFormatter=F.systemErrorFormatter,this._silent=!!F.silent,this._strict=!!F.strictTypes,F.remoteProtocols&&De(this._cache,F.remoteProtocols,y,!1),y.messages.forEach(function(e){var u=e.name;F.noCapitalize||(u=a.capitalize(u)),this["on"+u]=this._createMessageHandler(e)},this)}o.inherits(G,l.EventEmitter),G.prototype.activeChannels=function(){return a.objectValues(this._channels)},G.prototype.createChannel=function(y,F){var e=F&&F.objectMode,u;if(typeof y=="function"){var f;e?f=y:f=function(C){var R=new _e().once("error",function(oe){u.destroy(oe)});return y(function(oe,ue){if(oe){C(oe);return}var re=new ie;re.pipe(ue),C(null,re)}).pipe(R)},u=new L(this,f,F)}else{var k,v;if(p(y)?k=v=y:(k=y.readable,v=y.writable),!e){var i=new pe;k=k.pipe(i);var n=new fe;n.pipe(v),v=n}u=new j(this,k,v,F),e||(u.once("eot",function(){k.unpipe(i),n.unpipe(v)}),i.once("error",function(C){u.destroy(C)}))}this.listeners("error").length||this.on("error",this._onError);var w=this._nextChannelId++,E=this._channels;return E[w]=u.once("eot",function(){delete E[w]}),this.emit("channel",u),u},G.prototype.onMessage=function(y,F){return m(this.service,y),this._handlers[y]=F,this},G.prototype.remoteProtocols=function(){return Ue(this._cache,!1)},G.prototype.use=function(){var y,F,e;for(y=0,F=arguments.length;y<F;y++)e=arguments[y],this._fns.push(e.length<3?e(this):e);return this},G.prototype._createMessageHandler=function(y){var F=y.name,e=y.requestType.fields,u=e.length,f=e.length?", "+e.map(function(v){return"req."+v.name}).join(", "):"",k=`return function (handler) {
|
|
77
|
+
`;return k+=" if (handler.length > "+u+`) {
|
|
78
|
+
`,k+=" return this.onMessage('"+F+`', function (req, cb) {
|
|
79
|
+
`,k+=" return handler.call(this"+f+`, cb);
|
|
80
|
+
`,k+=` });
|
|
81
|
+
`,k+=` } else {
|
|
82
|
+
`,k+=" return this.onMessage('"+F+`', function (req) {
|
|
83
|
+
`,k+=" return handler.call(this"+f+`);
|
|
84
|
+
`,k+=` });
|
|
85
|
+
`,k+=` }
|
|
86
|
+
`,k+=`};
|
|
87
|
+
`,new Function(k)()},G.prototype._onError=function(y){!this._silent&&y.rpcCode!=="UNKNOWN_PROTOCOL"&&(console.error(),y.rpcCode?(console.error(y.rpcCode),console.error(y.cause)):(console.error("INTERNAL_SERVER_ERROR"),console.error(y)))};function $(y,F){F=F||{},l.EventEmitter.call(this),this.client=y,this.timeout=a.getOption(F,"timeout",y._timeout$),this._endWritable=!!a.getOption(F,"endWritable",!0),this._prefix=ae(F.scope);var e=y._cache$,u=y._svc$,f=F.serverHash;f||(f=u.hash);var k=e[f];k||(f=u.hash,k=e[f]=new we(u,u,f)),this._adapter=k,this._registry=new ve(this,W),this.pending=0,this.destroyed=!1,this.draining=!1,this.once("_eot",function(v,i){M("client channel EOT"),this.destroyed=!0,this.emit("eot",v,i)})}o.inherits($,l.EventEmitter),$.prototype.destroy=function(y){M("destroying client channel"),this.draining||(this.draining=!0,this.emit("_drain"));var F=this._registry,e=this.pending;y&&F.clear(),y||!e?Ne(y)?(M("fatal client channel error: %s",y),this.emit("_eot",e,y)):this.emit("_eot",e):M("client channel entering drain mode (%s pending)",e)},$.prototype.ping=function(y,F){!F&&typeof y=="function"&&(F=y,y=void 0);var e=this,u=new ne(X);this._emit(u,{timeout:y},function(f){F?F.call(e,f):f&&e.destroy(f)})},$.prototype._createHandshakeRequest=function(y,F){var e=this.client._svc$;return{clientHash:e.hash,clientProtocol:F?null:JSON.stringify(e.protocol),serverHash:y._hash}},$.prototype._emit=function(y,F,e){var u=y._msg,f=u.oneWay?void 0:new z(u,{}),k=new Y(u,this),v=this;this.pending++,process.nextTick(function(){if(!u.name)i(y,f,n);else{v.emit("outgoingCall",k,F);var E=v.client._fns$;M("starting client middleware chain (%s middleware)",E.length),O({fns:E,ctx:k,wreq:y,wres:f,onTransition:i,onCompletion:n,onError:w})}});function i(E,C,R){var oe,ue;if(v.destroyed)oe=new Error("channel destroyed");else try{ue=E.toBuffer()}catch{oe=qe(_("invalid %j request",u.name),E,[{name:"headers",type:H},{name:"request",type:u.requestType}])}if(oe){R(oe);return}var re=F&&F.timeout!==void 0?F.timeout:v.timeout,he=v._registry.add(re,function(A,Se,Pe){if(!A&&!u.oneWay)try{Pe._decodeResponse(Se,C,u)}catch(Te){A=Te}R(A)});he|=v._prefix,M("sending message %s",he),v._send(he,ue,!!u&&u.oneWay)}function n(E){v.pending--,e.call(k,E,f),v.draining&&!v.destroyed&&!v.pending&&v.destroy()}function w(E){v.client.emit("error",E,v)}},$.prototype._getAdapter=function(y){var F=y.serverHash,e=this.client._cache$,u=e[F];if(u)return u;var f=JSON.parse(y.serverProtocol),k=V.forProtocol(f);return u=new we(this.client._svc$,k,F,!0),e[F]=u},$.prototype._matchesPrefix=function(y){return le(y,this._prefix)},$.prototype._send=a.abstractFunction,a.addDeprecatedGetters($,["pending","timeout"]),$.prototype.getCache=o.deprecate(function(){return this.client._cache$},"use `.remoteProtocols()` instead of `.getCache()`"),$.prototype.getProtocol=o.deprecate(function(){return this.client._svc$},"use `.service` instead or `.getProtocol()`"),$.prototype.isDestroyed=o.deprecate(function(){return this.destroyed},"use `.destroyed` instead of `.isDestroyed`");function ce(y,F,e){$.call(this,y,e),this._writableFactory=F,(!e||!e.noPing)&&(M("emitting ping request"),this.ping())}o.inherits(ce,$),ce.prototype._send=function(y,F){var e=this._registry.get(y),u=this._adapter,f=this;return process.nextTick(k),!0;function k(v){if(!f.destroyed){var i=f._createHandshakeRequest(u,!v),n=f._writableFactory.call(f,function(w,E){if(w){e(w);return}E.on("data",function(C){M("received response %s",C.id);var R=S.concat(C.payload);try{var oe=ke(K,R),ue=oe.head;ue.serverHash&&(u=f._getAdapter(ue))}catch(he){e(he);return}var re=ue.match;M("handshake match: %s",re),f.emit("handshake",i,ue),re==="NONE"?process.nextTick(function(){k(!0)}):(f._adapter=u,e(null,oe.tail,u))})});if(!n){e(new Error("invalid writable stream"));return}n.write({id:y,payload:[Z.toBuffer(i),F]}),f._endWritable&&n.end()}}};function se(y,F,e,u){$.call(this,y,u),this._readable=F,this._writable=e,this._connected=!!(u&&u.noPing),this._readable.on("end",E),this._writable.on("finish",C);var f=this,k=null;this.once("eot",function(){k&&(clearTimeout(k),k=null),f._connected||f.emit("_ready"),this._writable.removeListener("finish",C),this._endWritable&&(M("ending transport"),this._writable.end()),this._readable.removeListener("data",n).removeListener("data",w).removeListener("end",E)});var v;this._connected?this._readable.on("data",w):(this._readable.on("data",n),process.nextTick(i),f.timeout&&(k=setTimeout(function(){f.destroy(new Error("timeout"))},f.timeout)));function i(R){if(!f.destroyed){v=f._createHandshakeRequest(f._adapter,!R);var oe=[Z.toBuffer(v),a.bufferFrom([0,0])];f._writable.write({id:f._prefix,payload:oe})}}function n(R){if(!f._matchesPrefix(R.id)){M("discarding unscoped response %s (still connecting)",R.id);return}var oe=S.concat(R.payload);try{var ue=ke(K,oe).head;ue.serverHash&&(f._adapter=f._getAdapter(ue))}catch(he){f.destroy(he);return}var re=ue.match;M("handshake match: %s",re),f.emit("handshake",v,ue),re==="NONE"?process.nextTick(function(){i(!0)}):(M("successfully connected"),k&&(clearTimeout(k),k=null),f._readable.removeListener("data",n).on("data",w),f._connected=!0,f.emit("_ready"),v=null)}function w(R){var oe=R.id;if(!f._matchesPrefix(oe)){M("discarding unscoped message %s",oe);return}var ue=f._registry.get(oe);ue&&process.nextTick(function(){M("received message %s",oe),ue(null,S.concat(R.payload),f._adapter)})}function E(){f.destroy(!0)}function C(){f.destroy()}}o.inherits(se,$),se.prototype._emit=function(){if(this._connected||this.draining)$.prototype._emit.apply(this,arguments);else{M("queuing request");var y=[],F,e;for(F=0,e=arguments.length;F<e;F++)y.push(arguments[F]);this.once("_ready",function(){this._emit.apply(this,y)})}},se.prototype._send=function(y,F,e){if(e){var u=this;process.nextTick(function(){u._registry.get(y)(null,a.bufferFrom([0,0,0]),u._adapter)})}return this._writable.write({id:y,payload:[F]})};function g(y,F){F=F||{},l.EventEmitter.call(this),this.server=y,this._endWritable=!!a.getOption(F,"endWritable",!0),this._prefix=ae(F.scope);var e=y._cache,u=y.service,f=u.hash;e[f]||(e[f]=new we(u,u,f)),this._adapter=null,this.destroyed=!1,this.draining=!1,this.pending=0,this.once("_eot",function(k,v){M("server channel EOT"),this.emit("eot",k,v)})}o.inherits(g,l.EventEmitter),g.prototype.destroy=function(y){this.draining||(this.draining=!0,this.emit("_drain")),(y||!this.pending)&&(this.destroyed=!0,Ne(y)?(M("fatal server channel error: %s",y),this.emit("_eot",this.pending,y)):this.emit("_eot",this.pending))},g.prototype._createHandshakeResponse=function(y,F){var e=this.server.service,u=e.hash,f=F&&F.serverHash.equals(u);return{match:y?"NONE":f?"BOTH":"CLIENT",serverProtocol:f?null:JSON.stringify(e.protocol),serverHash:f?null:u}},g.prototype._getAdapter=function(y){var F=y.clientHash,e=this.server._cache[F];if(e)return e;if(!y.clientProtocol)throw Ge("UNKNOWN_PROTOCOL");var u=JSON.parse(y.clientProtocol);return e=new we(V.forProtocol(u),this.server.service,F,!0),this.server._cache[F]=e},g.prototype._matchesPrefix=function(y){return le(y,this._prefix)},g.prototype._receive=function(y,F,e){var u=this,f;try{f=F._decodeRequest(y)}catch(R){e(u._encodeSystemError(Ge("INVALID_REQUEST",R)));return}var k=f._msg,v=new z(k,{});if(!k.name){v.response=null,e(v.toBuffer(),!1);return}var i=new Y(k,this);u.emit("incomingCall",i);var n=this.server._fns;M("starting server middleware chain (%s middleware)",n.length),u.pending++,O({fns:n,ctx:i,wreq:f,wres:v,onTransition:w,onCompletion:E,onError:C});function w(R,oe,ue){var re=u.server._handlers[k.name];if(re){var A=!k.oneWay;try{A?re.call(i,R.request,function(Se,Pe){A=!1,oe.error=Se,oe.response=Pe,ue()}):(re.call(i,R.request),ue())}catch(Se){A?(A=!1,ue(Se)):C(Se)}}else{var he=u.server._defaultHandler;he?he.call(i,R,oe,ue):ue(Ge("NOT_IMPLEMENTED",new Error(_("no handler for %s",k.name))))}}function E(R){u.pending--;var oe=u.server,ue;if(!R){var re=v.error;oe._strict||(Ne(re)?v.error=k.errorType.clone(re.message,{wrapUnions:!0}):re===null&&(re=v.error=void 0),re===void 0&&v.response===void 0&&k.responseType.isValid(null)&&(v.response=null));try{ue=v.toBuffer()}catch{v.error!==void 0?R=qe(_("invalid %j error",k.name),v,[{name:"headers",type:H},{name:"error",type:k.errorType}]):R=qe(_("invalid %j response",k.name),v,[{name:"headers",type:H},{name:"response",type:k.responseType}])}}ue?re!==void 0&&oe.emit("error",Ge("APPLICATION_ERROR",re)):ue=u._encodeSystemError(R,v.headers),e(ue,k.oneWay),u.draining&&!u.pending&&u.destroy()}function C(R){u.server.emit("error",R,u)}},a.addDeprecatedGetters(g,["pending"]),g.prototype.getCache=o.deprecate(function(){return this.server._cache},"use `.remoteProtocols()` instead of `.getCache()`"),g.prototype.getProtocol=o.deprecate(function(){return this.server.service},"use `.service` instead of `.getProtocol()`"),g.prototype.isDestroyed=o.deprecate(function(){return this.destroyed},"use `.destroyed` instead of `.isDestroyed`"),g.prototype._encodeSystemError=function(y,F){var e=this.server;e.emit("error",y,this);var u;e._sysErrFormatter?u=e._sysErrFormatter.call(this,y):y.rpcCode&&(u=y.message);var f;if(F)try{f=H.toBuffer(F)}catch(k){e.emit("error",k,this)}return S.concat([f||a.bufferFrom([0]),a.bufferFrom([1,0]),ee.toBuffer(u||"internal server error")])};function L(y,F,e){g.call(this,y,e),this._writable=void 0;var u=this,f;process.nextTick(function(){f=F.call(u,function(n,w){process.nextTick(function(){if(n){i(n);return}u._writable=w.on("finish",i),u.emit("_writable")})}).on("data",k).on("end",v)});function k(n){var w=n.id,E=S.concat(n.payload),C;try{var R=ke(Z,E),oe=R.head,ue=u._getAdapter(oe)}catch(A){C=Ge("INVALID_HANDSHAKE_REQUEST",A)}var re=u._createHandshakeResponse(C,oe);u.emit("handshake",oe,re),C?he(u._encodeSystemError(C)):u._receive(R.tail,ue,he);function he(A){if(!u.destroyed){if(!u._writable){u.once("_writable",function(){he(A)});return}u._writable.write({id:w,payload:[K.toBuffer(re),A]})}u._writable&&u._endWritable&&u._writable.end()}}function v(){u.destroy()}function i(n){f.removeListener("data",k).removeListener("end",v),u.destroy(n||!0)}}o.inherits(L,g);function j(y,F,e,u){g.call(this,y,u),this._adapter=void 0,this._writable=e.on("finish",n),this._readable=F.on("data",k).on("end",i),this.once("_drain",function(){this._readable.removeListener("data",k).removeListener("data",v).removeListener("end",i)}).once("eot",function(){this._writable.removeListener("finish",n),this._endWritable&&this._writable.end()});var f=this;function k(w){var E=w.id;if(!f._matchesPrefix(E))return;var C=S.concat(w.payload),R;try{var oe=ke(Z,C),ue=oe.head;f._adapter=f._getAdapter(ue)}catch(A){R=Ge("INVALID_HANDSHAKE_REQUEST",A)}var re=f._createHandshakeResponse(R,ue);f.emit("handshake",ue,re),R?he(f._encodeSystemError(R)):(f._readable.removeListener("data",k).on("data",v),f._receive(oe.tail,f._adapter,he));function he(A){f.destroyed||f._writable.write({id:E,payload:[K.toBuffer(re),A]})}}function v(w){var E=w.id;if(f._matchesPrefix(E)){var C=S.concat(w.payload);f._receive(C,f._adapter,function(R,oe){f.destroyed||oe||f._writable.write({id:E,payload:[R]})})}}function i(){f.destroy()}function n(){f.destroy(!0)}}o.inherits(j,g);function ne(y,F,e){this._msg=y,this.headers=F||{},this.request=e||{}}ne.prototype.toBuffer=function(){var y=this._msg;return S.concat([H.toBuffer(this.headers),ee.toBuffer(y.name),y.requestType.toBuffer(this.request)])};function z(y,F,e,u){this._msg=y,this.headers=F,this.error=e,this.response=u}z.prototype.toBuffer=function(){var y=H.toBuffer(this.headers),F=this.error!==void 0;return S.concat([y,I.toBuffer(F),F?this._msg.errorType.toBuffer(this.error):this._msg.responseType.toBuffer(this.response)])};function Y(y,F){this.channel=F,this.locals={},this.message=y,Object.freeze(this)}function ve(y,F){this._ctx=y,this._mask=-1>>>(F|0),this._id=0,this._n=0,this._cbs={}}ve.prototype.get=function(y){return this._cbs[y&this._mask]},ve.prototype.add=function(y,F){this._id=this._id+1&this._mask;var e=this,u=this._id,f;return y>0&&(f=setTimeout(function(){k(new Error("timeout"))},y)),this._cbs[u]=k,this._n++,u;function k(){e._cbs[u]&&(delete e._cbs[u],e._n--,f&&clearTimeout(f),F.apply(e._ctx,arguments))}},ve.prototype.clear=function(){Object.keys(this._cbs).forEach(function(y){this._cbs[y](new Error("interrupted"))},this)};function we(y,F,e,u){this._clientSvc=y,this._serverSvc=F,this._hash=e,this._isRemote=!!u,this._readers=Ie(y,F)}we.prototype._decodeRequest=function(y){var F=new D(y),e=H._read(F),u=ee._read(F),f,k;if(u?(f=this._serverSvc.message(u),k=this._readers[u+"?"]._read(F)):f=X,!F.isValid())throw new Error(_("truncated %s request",u||"ping$"));return new ne(f,e,k)},we.prototype._decodeResponse=function(y,F,e){var u=new D(y);a.copyOwnProperties(H._read(u),F.headers,!0);var f=I._read(u),k=e.name;if(k){var v=this._readers[k+(f?"*":"!")];if(e=this._clientSvc.message(k),f?F.error=v._read(u):F.response=v._read(u),!u.isValid())throw new Error(_("truncated %s response",k))}else e=X};function _e(){h.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._buf=a.newBuffer(0),this._bufs=[],this.on("finish",function(){this.push(null)})}o.inherits(_e,h.Transform),_e.prototype._transform=function(y,F,e){y=S.concat([this._buf,y]);for(var u;y.length>=4&&y.length>=(u=y.readInt32BE(0))+4;){if(u)this._bufs.push(y.slice(4,u+4));else{var f=this._bufs;this._bufs=[],this.push({id:null,payload:f})}y=y.slice(u+4)}this._buf=y,e()},_e.prototype._flush=function(y){if(this._buf.length||this._bufs.length){var F=this._bufs.slice();F.unshift(this._buf);var e=Ge("TRAILING_DATA");e.trailingData=S.concat(F).toString(),this.emit("error",e)}y()};function ie(){h.Transform.call(this,{writableObjectMode:!0}),this.on("finish",function(){this.push(null)})}o.inherits(ie,h.Transform),ie.prototype._transform=function(y,F,e){var u=y.payload,f,k,v;for(f=0,k=u.length;f<k;f++)v=u[f],this.push(ge(v.length)),this.push(v);this.push(ge(0)),e()};function pe(){h.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._frameCount=0,this._buf=a.newBuffer(0),this._bufs=[],this.on("finish",function(){this.push(null)})}o.inherits(pe,h.Transform),pe.prototype._transform=function(y,F,e){for(y=S.concat([this._buf,y]);;){if(this._id===void 0){if(y.length<8){this._buf=y,e();return}this._id=y.readInt32BE(0),this._frameCount=y.readInt32BE(4),y=y.slice(8)}for(var u;this._frameCount&&y.length>=4&&y.length>=(u=y.readInt32BE(0))+4;)this._frameCount--,this._bufs.push(y.slice(4,u+4)),y=y.slice(u+4);if(this._frameCount){this._buf=y,e();return}else{var f={id:this._id,payload:this._bufs};this._bufs=[],this._id=void 0,this.push(f)}}},pe.prototype._flush=_e.prototype._flush;function fe(){h.Transform.call(this,{writableObjectMode:!0}),this.on("finish",function(){this.push(null)})}o.inherits(fe,h.Transform),fe.prototype._transform=function(y,F,e){var u=y.payload,f=u.length,k=a.newBuffer(8);k.writeInt32BE(y.id,0),k.writeInt32BE(f,4),this.push(k);var v;for(v=0;v<f;v++)k=u[v],this.push(ge(k.length)),this.push(k);e()};function ge(y){var F=a.newBuffer(4);return F.writeInt32BE(y),F}function ke(y,F){var e=new D(F),u=y._read(e);if(!e.isValid())throw new Error(_("truncated %j",y.schema()));return{head:u,tail:e.buf.slice(e.pos)}}function Ee(y,F){return y.equals(F)?y:y.createResolver(F)}function Ie(y,F){var e={};return y.messages.forEach(function(u){var f=u.name,k=F.message(f);try{if(!k)throw new Error(_("missing server message: %s",f));if(k.oneWay!==u.oneWay)throw new Error(_("inconsistent one-way message: %s",f));e[f+"?"]=Ee(k.requestType,u.requestType),e[f+"*"]=Ee(u.errorType,k.errorType),e[f+"!"]=Ee(u.responseType,k.responseType)}catch(v){throw Ge("INCOMPATIBLE_PROTOCOL",v)}}),e}function De(y,F,e,u){Object.keys(F).forEach(function(f){var k=F[f],v,i;u?(v=e,i=V.forProtocol(k)):(v=V.forProtocol(k),i=e),y[f]=new we(v,i,f,!0)})}function Ue(y,F){var e={};return Object.keys(y).forEach(function(u){var f=y[u];f._isRemote&&(e[u]=(F?f._serverSvc:f._clientSvc).protocol)}),e}function Ne(y){return!!y&&Object.prototype.toString.call(y)==="[object Error]"}function Me(y,F){return y.on("error",function(e){F.emit("error",e,y)})}function Ce(y,F){var e=new Error(y);return e.cause=F,e}function Ge(y,F){var e=Ce(y.toLowerCase().replace(/_/g," "),F);return e.rpcCode=F&&F.rpcCode?F.rpcCode:y,e}function qe(y,F,e){var u=[],f,k,v;for(f=0,k=e.length;f<k;f++)v=e[f],v.type.isValid(F[v.name],{errorHook:w});var i=u.map(function(E){return _("%s = %j but expected %s",E.path,E.value,E.type)}).join(", "),n=new Error(_("%s (%s)",y,i));return n.details=u,n;function w(E,C,R){var oe=[],ue,re,he;for(ue=0,re=E.length;ue<re;ue++)he=E[ue],isNaN(he)?oe.push("."+he):oe.push("["+he+"]");u.push({path:v.name+oe.join(""),value:C,type:R})}}function ae(y){return y?a.getHash(y).readInt16BE(0)<<32-W:0}function le(y,F){return(y^F)>>32-W===0}function p(y){return!!(y&&y.pipe)}function m(y,F){var e=y.message(F);if(!e)throw new Error(_("unknown message: %s",F));return e}function O(y){var F=[y.wreq,y.wres],e=[],u;f(0);function f(v){var i=!1;v<y.fns.length?y.fns[v].apply(y.ctx,F.concat(function(n,w){if(i){y.onError(Ce("duplicate forward middleware call",n));return}if(i=!0,n||y.wres&&(y.wres.error!==void 0||y.wres.response!==void 0)){u=n,k();return}w&&e.push(w),f(++v)})):y.onTransition.apply(y.ctx,F.concat(function(n){if(i){y.onError(Ce("duplicate handler call",n));return}i=!0,u=n,process.nextTick(k)}))}function k(){var v=e.pop();if(v){var i=!1;v.call(y.ctx,u,function(n){if(i){y.onError(Ce("duplicate backward middleware call",n));return}u=n,i=!0,k()})}else y.onCompletion.call(y.ctx,u)}}r.exports={Adapter:we,HANDSHAKE_REQUEST_TYPE:Z,HANDSHAKE_RESPONSE_TYPE:K,Message:Q,Registry:ve,Service:V,discoverProtocol:te,streams:{FrameDecoder:_e,FrameEncoder:ie,NettyDecoder:pe,NettyEncoder:fe}}})),ec=je(((t,r)=>{function s(){return new Error("unsupported in the browser")}function a(){return function(l,h,o){o(s())}}function c(){return function(){throw s()}}r.exports={createImportHook:a,createSyncImportHook:c,existsSync:function(){return!1},readFileSync:function(){throw s()}}})),tc=je(((t,r)=>{var s=ec(),a=cr(),c=Tr(),l=xt().format,h={date:{type:"int",logicalType:"date"},decimal:{type:"bytes",logicalType:"decimal"},time_ms:{type:"long",logicalType:"time-millis"},timestamp_ms:{type:"long",logicalType:"timestamp-millis"}};function o(x,I,H){!H&&typeof I=="function"&&(H=I,I=void 0),I=I||{},I.importHook||(I.importHook=s.createImportHook()),ee(x,function(W,X){if(W){H(W);return}if(!X){H(new Error("empty root import"));return}var Q=X.types;if(Q){var V=_(X)||"";Q.forEach(function(te){te.namespace===V&&delete te.namespace})}H(null,X)});function ee(W,X){I.importHook(W,"idl",function(Q,V){if(Q){X(Q);return}if(V===void 0){X();return}try{var te=new D(V,I)._readProtocol(V,I)}catch(J){J.path=W,X(J);return}Z(te.protocol,te.imports,c.dirname(W),X)})}function Z(W,X,Q,V){var te=[];J();function J(){var G=X.shift();if(!G){te.reverse();try{te.forEach(function(ce){K(W,ce)})}catch(ce){V(ce);return}V(null,W);return}var $=c.join(Q,G.name);G.kind==="idl"?ee($,function(ce,se){if(ce){V(ce);return}se&&te.push(se),J()}):I.importHook($,G.kind,function(ce,se){if(ce){V(ce);return}switch(G.kind){case"protocol":case"schema":if(se===void 0){J();return}try{var g=JSON.parse(se)}catch(j){j.path=$,V(j);return}var L=G.kind==="schema"?{types:[g]}:g;te.push(L),J();return;default:V(new Error(l("invalid import kind: %s",G.kind)))}})}}function K(W,X){var Q=X.types||[];Q.reverse(),Q.forEach(function(V){W.types||(W.types=[]),V.namespace===void 0&&(V.namespace=_(X)||""),W.types.unshift(V)}),Object.keys(X.messages||{}).forEach(function(V){if(W.messages||(W.messages={}),W.messages[V])throw new Error(l("duplicate message: %s",V));W.messages[V]=X.messages[V]})}}function S(x){var I;if(typeof x=="string"&&~x.indexOf(c.sep)&&s.existsSync(x)){var H=s.readFileSync(x,{encoding:"utf8"});try{return JSON.parse(H)}catch{o(x,{importHook:s.createSyncImportHook()},function(Z,K){I=Z?H:K})}}else I=x;if(typeof I!="string"||I==="null")return I;try{return JSON.parse(I)}catch{try{return D.readProtocol(I)}catch{try{return D.readSchema(I)}catch{return I}}}}function D(x,I){I=I||{},this._tk=new U(x),this._ackVoidMessages=!!I.ackVoidMessages,this._implicitTags=!I.delimitedCollections,this._typeRefs=I.typeRefs||h}D.readProtocol=function(x,I){var H=new D(x,I)._readProtocol();if(H.imports.length)throw new Error("unresolvable import");return H.protocol},D.readSchema=function(x,I){var H=new D(x,I),ee=H._readJavadoc(),Z=H._readType(ee===void 0?{}:{doc:ee},!0);return H._tk.next({id:"(eof)"}),Z},D.prototype._readProtocol=function(){var x=this._tk,I=[],H=[],ee={},Z;this._readImports(I);var K={},W=this._readJavadoc();for(W!==void 0&&(K.doc=W),this._readAnnotations(K),x.next({val:"protocol"}),x.next({val:"{",silent:!0})||(K.protocol=x.next({id:"name"}).val,x.next({val:"{"}));!x.next({val:"}",silent:!0});)if(!this._readImports(I)){var X=this._readJavadoc(),Q=this._readType({},!0),V=this._readImports(I,!0),te=void 0;if(Z=x.pos,!V&&(te=this._readMessage(Q))){X!==void 0&&te.schema.doc===void 0&&(te.schema.doc=X);var J=!1;if((te.schema.response==="void"||te.schema.response.type==="void")&&(J=!this._ackVoidMessages&&!te.schema.errors,te.schema.response==="void"?te.schema.response="null":te.schema.response.type="null"),J&&(te.schema["one-way"]=!0),ee[te.name])throw new Error(l("duplicate message: %s",te.name));ee[te.name]=te.schema}else X&&(typeof Q=="string"?Q={doc:X,type:Q}:Q.doc===void 0&&(Q.doc=X)),H.push(Q),x.pos=Z,x.next({val:";",silent:!0});X=void 0}return x.next({id:"(eof)"}),H.length&&(K.types=H),Object.keys(ee).length&&(K.messages=ee),{protocol:K,imports:I}},D.prototype._readAnnotations=function(x){for(var I=this._tk;I.next({val:"@",silent:!0});){for(var H=[];!I.next({val:"(",silent:!0});)H.push(I.next().val);x[H.join("")]=I.next({id:"json"}).val,I.next({val:")"})}},D.prototype._readMessage=function(x){var I=this._tk,H={request:[],response:x};this._readAnnotations(H);var ee=I.next().val;if(I.next().val==="("){if(!I.next({val:")",silent:!0}))do H.request.push(this._readField());while(!I.next({val:")",silent:!0})&&I.next({val:","}));var Z=I.next();switch(Z.val){case"throws":H.errors=[];do H.errors.push(this._readType());while(!I.next({val:";",silent:!0})&&I.next({val:","}));break;case"oneway":H["one-way"]=!0,I.next({val:";"});break;case";":break;default:throw I.error("invalid message suffix",Z)}return{name:ee,schema:H}}},D.prototype._readJavadoc=function(){var x=this._tk.next({id:"javadoc",emitJavadoc:!0,silent:!0});if(x)return x.val},D.prototype._readField=function(){var x=this._tk,I=this._readJavadoc(),H={type:this._readType()};return I!==void 0&&H.doc===void 0&&(H.doc=I),this._readAnnotations(H),H.name=x.next({id:"name"}).val,x.next({val:"=",silent:!0})&&(H.default=x.next({id:"json"}).val),H},D.prototype._readType=function(x,I){switch(x=x||{},this._readAnnotations(x),x.type=this._tk.next({id:"name"}).val,x.type){case"record":case"error":return this._readRecord(x);case"fixed":return this._readFixed(x);case"enum":return this._readEnum(x,I);case"map":return this._readMap(x);case"array":return this._readArray(x);case"union":if(Object.keys(x).length>1)throw new Error("union annotations are not supported");return this._readUnion();default:var H=this._typeRefs[x.type];return H&&(delete x.type,a.copyOwnProperties(H,x)),Object.keys(x).length>1?x:x.type}},D.prototype._readFixed=function(x){var I=this._tk;return I.next({val:"(",silent:!0})||(x.name=I.next({id:"name"}).val,I.next({val:"("})),x.size=parseInt(I.next({id:"number"}).val),I.next({val:")"}),x},D.prototype._readMap=function(x){var I=this._tk,H=this._implicitTags,ee=I.next({val:"<",silent:H})===void 0;return x.values=this._readType(),I.next({val:">",silent:ee}),x},D.prototype._readArray=function(x){var I=this._tk,H=this._implicitTags,ee=I.next({val:"<",silent:H})===void 0;return x.items=this._readType(),I.next({val:">",silent:ee}),x},D.prototype._readEnum=function(x,I){var H=this._tk;H.next({val:"{",silent:!0})||(x.name=H.next({id:"name"}).val,H.next({val:"{"})),x.symbols=[];do x.symbols.push(H.next().val);while(!H.next({val:"}",silent:!0})&&H.next({val:","}));return I&&H.next({val:"=",silent:!0})&&(x.default=H.next().val,H.next({val:";"})),x},D.prototype._readUnion=function(){var x=this._tk,I=[];x.next({val:"{"});do I.push(this._readType());while(!x.next({val:"}",silent:!0})&&x.next({val:","}));return I},D.prototype._readRecord=function(x){var I=this._tk;for(I.next({val:"{",silent:!0})||(x.name=I.next({id:"name"}).val,I.next({val:"{"})),x.fields=[];!I.next({val:"}",silent:!0});)x.fields.push(this._readField()),I.next({val:";"});return x},D.prototype._readImports=function(x,I){for(var H=this._tk,ee=0,Z=H.pos;H.next({val:"import",silent:!0});){if(!ee&&I&&H.next({val:"(",silent:!0})){H.pos=Z;return}var K=H.next({id:"name"}).val,W=JSON.parse(H.next({id:"string"}).val);H.next({val:";"}),x.push({kind:K,name:W}),ee++}return ee};function U(x){this._str=x,this.pos=0}U.prototype.next=function(x){var I={pos:this.pos,id:void 0,val:void 0},H=this._skip(x&&x.emitJavadoc);if(typeof H=="string")I.id="javadoc",I.val=H;else{var ee=this.pos,Z=this._str,K=Z.charAt(ee);if(!K)I.id="(eof)";else if(x&&x.id==="json"?(I.id="json",this.pos=this._endOfJson()):K==='"'?(I.id="string",this.pos=this._endOfString()):/[0-9]/.test(K)?(I.id="number",this.pos=this._endOf(/[0-9]/)):/[`A-Za-z_.]/.test(K)?(I.id="name",this.pos=this._endOf(/[`A-Za-z0-9_.]/)):(I.id="operator",this.pos=ee+1),I.val=Z.slice(ee,this.pos),I.id==="json")try{I.val=JSON.parse(I.val)}catch{throw this.error("invalid JSON",I)}else I.id==="name"&&(I.val=I.val.replace(/`/g,""))}var W;if(x&&x.id&&x.id!==I.id?W=this.error(l("expected ID %s",x.id),I):x&&x.val&&x.val!==I.val&&(W=this.error(l("expected value %s",x.val),I)),W)if(x&&x.silent){this.pos=I.pos;return}else throw W;else return I},U.prototype.error=function(x,I){var H=typeof I!="number",ee=H?I.pos:I,Z=this._str,K=1,W=0,X;for(X=0;X<ee;X++)Z.charAt(X)===`
|
|
88
|
+
`&&(K++,W=X);var Q=H?l("invalid token %j: %s",I,x):x,V=new Error(Q);return V.token=H?I:void 0,V.lineNum=K,V.colNum=ee-W,V},U.prototype._skip=function(x){for(var I=this._str,H=!1,ee,Z;(Z=I.charAt(this.pos))&&/\s/.test(Z);)this.pos++;if(ee=this.pos,Z==="/")switch(I.charAt(this.pos+1)){case"/":for(this.pos+=2;(Z=I.charAt(this.pos))&&Z!==`
|
|
89
|
+
`;)this.pos++;return this._skip(x);case"*":for(this.pos+=2,I.charAt(this.pos)==="*"&&(H=!0);Z=I.charAt(this.pos++);)if(Z==="*"&&I.charAt(this.pos)==="/")return this.pos++,H&&x?M(I.slice(ee+3,this.pos-2)):this._skip(x);throw this.error("unterminated comment",ee)}},U.prototype._endOf=function(x){for(var I=this.pos,H=this._str;x.test(H.charAt(I));)I++;return I},U.prototype._endOfString=function(){for(var x=this.pos+1,I=this._str,H;H=I.charAt(x);){if(H==='"')return x+1;H==="\\"?x+=2:x++}throw this.error("unterminated string",x-1)},U.prototype._endOfJson=function(){var x=a.jsonEnd(this._str,this.pos);if(x<0)throw this.error("invalid JSON",x);return x};function M(x){for(var I=x.replace(/^[ \t]+|[ \t]+$/g,"").split(`
|
|
90
|
+
`).map(function(H,ee){return ee?H.replace(/^\s*\*\s?/,""):H});I.length&&!I[0];)I.shift();for(;I.length&&!I[I.length-1];)I.pop();return I.join(`
|
|
91
|
+
`)}function _(x){if(x.namespace)return x.namespace;var I=/^(.*)\.[^.]+$/.exec(x.protocol);return I?I[1]:void 0}r.exports={Tokenizer:U,assembleProtocol:o,read:S,readProtocol:D.readProtocol,readSchema:D.readSchema}})),rc=je(((t,r)=>{var s=Ju(),a=Qu(),c=tc(),l=cr();function h(o,S){var D=c.read(o);return D.protocol?a.Service.forProtocol(D,S):s.Type.forSchema(D,S)}r.exports={Service:a.Service,assembleProtocol:c.assembleProtocol,discoverProtocol:a.discoverProtocol,parse:h,readProtocol:c.readProtocol,readSchema:c.readSchema},l.copyOwnProperties(s,r.exports)})),nc=je(((t,r)=>{var s=pi(),a=cr(),c=Er(),l=Tr(),h=xt(),o=Tr(),S=c.Buffer,D={namespace:"org.apache.avro.file"},U=s.Type.forSchema("long",D),M=s.Type.forSchema({type:"map",values:"bytes"},D),_=s.Type.forSchema({name:"Header",type:"record",fields:[{name:"magic",type:{type:"fixed",name:"Magic",size:4}},{name:"meta",type:M},{name:"sync",type:{type:"fixed",name:"Sync",size:16}}]},D),x=s.Type.forSchema({name:"Block",type:"record",fields:[{name:"count",type:"long"},{name:"data",type:"bytes"},{name:"sync",type:"Sync"}]},D),I=a.bufferFrom("Obj"),H=h.format,ee=a.Tap;function Z($,ce){ce=ce||{};var se=!!ce.noDecode;l.Duplex.call(this,{readableObjectMode:!se,allowHalfOpen:!1}),this._type=s.Type.forSchema($),this._tap=new ee(a.newBuffer(0)),this._writeCb=null,this._needPush=!1,this._readValue=J(se,this._type),this._finished=!1,this.on("finish",function(){this._finished=!0,this._read()})}h.inherits(Z,l.Duplex),Z.prototype._write=function($,ce,se){this._writeCb=se;var g=this._tap;g.buf=S.concat([g.buf.slice(g.pos),$]),g.pos=0,this._needPush&&(this._needPush=!1,this._read())},Z.prototype._read=function(){this._needPush=!1;var $=this._tap,ce=$.pos,se=this._readValue($);$.isValid()?this.push(se):this._finished?this.push(null):($.pos=ce,this._needPush=!0,this._writeCb&&this._writeCb())};function K($){$=$||{};var ce=!!$.noDecode;l.Duplex.call(this,{allowHalfOpen:!0,readableObjectMode:!ce}),this._rType=$.readerSchema!==void 0?s.Type.forSchema($.readerSchema):void 0,this._wType=null,this._codecs=$.codecs,this._codec=void 0,this._parseHook=$.parseHook,this._tap=new ee(a.newBuffer(0)),this._blockTap=new ee(a.newBuffer(0)),this._syncMarker=null,this._readValue=null,this._noDecode=ce,this._queue=new a.OrderedQueue,this._decompress=null,this._index=0,this._remaining=void 0,this._needPush=!1,this._finished=!1,this.on("finish",function(){this._finished=!0,this._needPush&&this._read()})}h.inherits(K,l.Duplex),K.defaultCodecs=function(){return{null:function($,ce){ce(null,$)},deflate:o.inflateRaw}},K.getDefaultCodecs=K.defaultCodecs,K.prototype._decodeHeader=function(){var $=this._tap;if($.buf.length<I.length)return!1;if(!I.equals($.buf.slice(0,I.length)))return this.emit("error",new Error("invalid magic bytes")),!1;var ce=_._read($);if(!$.isValid())return!1;this._codec=(ce.meta["avro.codec"]||"null").toString();var se=this._codecs||K.getDefaultCodecs();if(this._decompress=se[this._codec],!this._decompress){this.emit("error",new Error(H("unknown codec: %s",this._codec)));return}try{var g=JSON.parse(ce.meta["avro.schema"].toString());this._parseHook&&(g=this._parseHook(g)),this._wType=s.Type.forSchema(g)}catch(L){this.emit("error",L);return}try{this._readValue=J(this._noDecode,this._wType,this._rType)}catch(L){this.emit("error",L);return}return this._syncMarker=ce.sync,this.emit("metadata",this._wType,this._codec,ce),!0},K.prototype._write=function($,ce,se){var g=this._tap;if(g.buf=S.concat([g.buf,$]),g.pos=0,!this._decodeHeader()){process.nextTick(se);return}this._write=this._writeChunk,this._write(a.newBuffer(0),ce,se)},K.prototype._writeChunk=function($,ce,se){var g=this._tap;g.buf=S.concat([g.buf.slice(g.pos),$]),g.pos=0;for(var L=1,j;j=te(g);){if(!this._syncMarker.equals(j.sync)){this.emit("error",new Error("invalid sync marker"));return}L++,this._decompress(j.data,this._createBlockCallback(j.data.length,j.count,ne))}ne();function ne(){--L||se()}},K.prototype._createBlockCallback=function($,ce,se){var g=this,L=this._index++;return function(j,ne){if(j){var z=new Error(H("%s codec decompression error",g._codec));z.cause=j,g.emit("error",z),se()}else g.emit("block",new Q(ce,ne.length,$)),g._queue.push(new V(L,ne,se,ce)),g._needPush&&g._read()}},K.prototype._read=function(){this._needPush=!1;var $=this._blockTap;if(!this._remaining){var ce=this._queue.pop();if(!ce||!ce.count){this._finished?this.push(null):this._needPush=!0,ce&&ce.cb();return}ce.cb(),this._remaining=ce.count,$.buf=ce.buf,$.pos=0}this._remaining--;var se;try{if(se=this._readValue($),!$.isValid())throw new Error("truncated block")}catch(g){this._remaining=0,this.emit("error",g);return}this.push(se)};function W($,ce){ce=ce||{},l.Transform.call(this,{writableObjectMode:!0,allowHalfOpen:!1}),this._type=s.Type.forSchema($),this._writeValue=function(se,g){try{this._type._write(se,g)}catch(L){this.emit("typeError",L,g,this._type)}},this._tap=new ee(a.newBuffer(ce.batchSize||65536)),this.on("typeError",function(se){this.emit("error",se)})}h.inherits(W,l.Transform),W.prototype._transform=function($,ce,se){var g=this._tap,L=g.buf,j=g.pos;if(this._writeValue(g,$),!g.isValid()){j&&this.push(G(g.buf,0,j));var ne=g.pos-j;ne>L.length&&(g.buf=a.newBuffer(2*ne)),g.pos=0,this._writeValue(g,$)}se()},W.prototype._flush=function($){var ce=this._tap,se=ce.pos;se&&this.push(ce.buf.slice(0,se)),$()};function X($,ce){ce=ce||{},l.Duplex.call(this,{allowHalfOpen:!0,writableObjectMode:!0});var se;if(s.Type.isType($)?(se=$,$=void 0):se=s.Type.forSchema($),this._schema=$,this._type=se,this._writeValue=function(L,j){try{this._type._write(L,j)}catch(ne){return this.emit("typeError",ne,j,this._type),!1}return!0},this._blockSize=ce.blockSize||65536,this._tap=new ee(a.newBuffer(this._blockSize)),this._codecs=ce.codecs,this._codec=ce.codec||"null",this._blockCount=0,this._syncMarker=ce.syncMarker||new a.Lcg().nextBuffer(16),this._queue=new a.OrderedQueue,this._pending=0,this._finished=!1,this._needHeader=!1,this._needPush=!1,this._metadata=ce.metadata||{},!M.isValid(this._metadata))throw new Error("invalid metadata");var g=this._codec;if(this._compress=(this._codecs||X.getDefaultCodecs())[g],!this._compress)throw new Error(H("unsupported codec: %s",g));switch(ce.omitHeader!==void 0&&(ce.writeHeader=ce.omitHeader?"never":"auto"),ce.writeHeader){case!1:case"never":break;case void 0:case"auto":this._needHeader=!0;break;default:this._writeHeader()}this.on("finish",function(){this._finished=!0,this._blockCount?this._flushChunk():this._finished&&this._needPush&&this.push(null)}),this.on("typeError",function(L){this.emit("error",L)})}h.inherits(X,l.Duplex),X.defaultCodecs=function(){return{null:function($,ce){ce(null,$)},deflate:o.deflateRaw}},X.getDefaultCodecs=X.defaultCodecs,X.prototype._writeHeader=function(){var $=JSON.stringify(this._schema?this._schema:this._type.getSchema({exportAttrs:!0})),ce=a.copyOwnProperties(this._metadata,{"avro.schema":a.bufferFrom($),"avro.codec":a.bufferFrom(this._codec)},!0),se=new(_.getRecordConstructor())(I,ce,this._syncMarker);this.push(se.toBuffer())},X.prototype._write=function($,ce,se){this._needHeader&&(this._writeHeader(),this._needHeader=!1);var g=this._tap,L=g.pos,j=!1;if(this._writeValue(g,$)){if(!g.isValid()){L&&(this._flushChunk(L,se),j=!0);var ne=g.pos-L;ne>this._blockSize&&(this._blockSize=ne*2),g.buf=a.newBuffer(this._blockSize),g.pos=0,this._writeValue(g,$)}this._blockCount++}else g.pos=L;j||se()},X.prototype._flushChunk=function($,ce){var se=this._tap;$=$||se.pos,this._compress(se.buf.slice(0,$),this._createBlockCallback($,ce)),this._blockCount=0},X.prototype._read=function(){var $=this,ce=this._queue.pop();if(!ce){this._finished&&!this._pending?process.nextTick(function(){$.push(null)}):this._needPush=!0;return}this.push(U.toBuffer(ce.count,!0)),this.push(U.toBuffer(ce.buf.length,!0)),this.push(ce.buf),this.push(this._syncMarker),this._finished||ce.cb()},X.prototype._createBlockCallback=function($,ce){var se=this,g=this._index++,L=this._blockCount;return this._pending++,function(j,ne){if(j){var z=new Error(H("%s codec compression error",se._codec));z.cause=j,se.emit("error",z);return}se._pending--,se.emit("block",new Q(L,$,ne.length)),se._queue.push(new V(g,ne,ce,L)),se._needPush&&(se._needPush=!1,se._read())}};function Q($,ce,se){this.valueCount=$,this.rawDataLength=ce,this.compressedDataLength=se}function V($,ce,se,g){this.index=$,this.buf=ce,this.cb=se,this.count=g|0}function te($){var ce=$.pos,se=x._read($);return $.isValid()?se:($.pos=ce,null)}function J($,ce,se){if($)return(function(L){return function(j){var ne=j.pos;return L(j),j.buf.slice(ne,j.pos)}})(ce._skip);if(se){var g=se.createResolver(ce);return function(L){return g._read(L)}}else return function(L){return ce._read(L)}}function G($,ce,se){var g=a.newBuffer(se);return $.copy(g,0,ce,ce+se),g}r.exports={BLOCK_TYPE:x,HEADER_TYPE:_,MAGIC_BYTES:I,streams:{BlockDecoder:K,BlockEncoder:X,RawDecoder:Z,RawEncoder:W}}})),ic=je(((t,r)=>{var s=rc(),a=nc(),c=cr(),l=Tr(),h=xt();function o(M,_){l.Readable.call(this),_=_||{},this._batchSize=_.batchSize||65536,this._blob=M,this._pos=0}h.inherits(o,l.Readable),o.prototype._read=function(){var M=this._pos;if(M>=this._blob.size){this.push(null);return}this._pos+=this._batchSize;var _=this._blob.slice(M,this._pos,this._blob.type),x=new FileReader,I=this;x.addEventListener("loadend",function H(ee){x.removeEventListener("loadend",H,!1),ee.error?I.emit("error",ee.error):I.push(c.bufferFrom(x.result))},!1),x.readAsArrayBuffer(_)};function S(){l.Transform.call(this,{readableObjectMode:!0}),this._bufs=[]}h.inherits(S,l.Transform),S.prototype._transform=function(M,_,x){this._bufs.push(M),x()},S.prototype._flush=function(M){this.push(new Blob(this._bufs,{type:"application/octet-binary"})),M()};function D(M,_){return new o(M).pipe(new a.streams.BlockDecoder(_))}function U(M,_){var x=new a.streams.BlockEncoder(M,_),I=new S;return x.pipe(I),new l.Duplex({objectMode:!0,read:function(){var H=I.read();H?Z(H):I.once("readable",Z);var ee=this;function Z(K){ee.push(K||I.read()),ee.push(null)}},write:function(H,ee,Z){return x.write(H,ee,Z)}}).on("finish",function(){x.end()})}r.exports={createBlobDecoder:D,createBlobEncoder:U,streams:a.streams},c.copyOwnProperties(s,r.exports)})),ac=je(((t,r)=>{var s=4,a=0,c=1,l=2;function h(n){let w=n.length;for(;--w>=0;)n[w]=0}var o=0,S=1,D=2,U=29,M=256,_=286,x=30,I=19,H=573,ee=15,Z=16,K=7,W=256,X=16,Q=17,V=18,te=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),J=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),G=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),$=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ce=512,se=new Array(288*2);h(se);var g=new Array(x*2);h(g);var L=new Array(ce);h(L);var j=new Array(256);h(j);var ne=new Array(U);h(ne);var z=new Array(x);h(z);function Y(n,w,E,C,R){this.static_tree=n,this.extra_bits=w,this.extra_base=E,this.elems=C,this.max_length=R,this.has_stree=n&&n.length}var ve,we,_e;function ie(n,w){this.dyn_tree=n,this.max_code=0,this.stat_desc=w}var pe=n=>n<256?L[n]:L[256+(n>>>7)],fe=(n,w)=>{n.pending_buf[n.pending++]=w&255,n.pending_buf[n.pending++]=w>>>8&255},ge=(n,w,E)=>{n.bi_valid>Z-E?(n.bi_buf|=w<<n.bi_valid&65535,fe(n,n.bi_buf),n.bi_buf=w>>Z-n.bi_valid,n.bi_valid+=E-Z):(n.bi_buf|=w<<n.bi_valid&65535,n.bi_valid+=E)},ke=(n,w,E)=>{ge(n,E[w*2],E[w*2+1])},Ee=(n,w)=>{let E=0;do E|=n&1,n>>>=1,E<<=1;while(--w>0);return E>>>1},Ie=n=>{n.bi_valid===16?(fe(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)},De=(n,w)=>{const E=w.dyn_tree,C=w.max_code,R=w.stat_desc.static_tree,oe=w.stat_desc.has_stree,ue=w.stat_desc.extra_bits,re=w.stat_desc.extra_base,he=w.stat_desc.max_length;let A,Se,Pe,Te,He,T,d=0;for(Te=0;Te<=ee;Te++)n.bl_count[Te]=0;for(E[n.heap[n.heap_max]*2+1]=0,A=n.heap_max+1;A<H;A++)Se=n.heap[A],Te=E[E[Se*2+1]*2+1]+1,Te>he&&(Te=he,d++),E[Se*2+1]=Te,!(Se>C)&&(n.bl_count[Te]++,He=0,Se>=re&&(He=ue[Se-re]),T=E[Se*2],n.opt_len+=T*(Te+He),oe&&(n.static_len+=T*(R[Se*2+1]+He)));if(d!==0){do{for(Te=he-1;n.bl_count[Te]===0;)Te--;n.bl_count[Te]--,n.bl_count[Te+1]+=2,n.bl_count[he]--,d-=2}while(d>0);for(Te=he;Te!==0;Te--)for(Se=n.bl_count[Te];Se!==0;)Pe=n.heap[--A],!(Pe>C)&&(E[Pe*2+1]!==Te&&(n.opt_len+=(Te-E[Pe*2+1])*E[Pe*2],E[Pe*2+1]=Te),Se--)}},Ue=(n,w,E)=>{const C=new Array(16);let R=0,oe,ue;for(oe=1;oe<=ee;oe++)R=R+E[oe-1]<<1,C[oe]=R;for(ue=0;ue<=w;ue++){let re=n[ue*2+1];re!==0&&(n[ue*2]=Ee(C[re]++,re))}},Ne=()=>{let n,w,E,C,R;const oe=new Array(16);for(E=0,C=0;C<U-1;C++)for(ne[C]=E,n=0;n<1<<te[C];n++)j[E++]=C;for(j[E-1]=C,R=0,C=0;C<16;C++)for(z[C]=R,n=0;n<1<<J[C];n++)L[R++]=C;for(R>>=7;C<x;C++)for(z[C]=R<<7,n=0;n<1<<J[C]-7;n++)L[256+R++]=C;for(w=0;w<=ee;w++)oe[w]=0;for(n=0;n<=143;)se[n*2+1]=8,n++,oe[8]++;for(;n<=255;)se[n*2+1]=9,n++,oe[9]++;for(;n<=279;)se[n*2+1]=7,n++,oe[7]++;for(;n<=287;)se[n*2+1]=8,n++,oe[8]++;for(Ue(se,287,oe),n=0;n<x;n++)g[n*2+1]=5,g[n*2]=Ee(n,5);ve=new Y(se,te,257,_,ee),we=new Y(g,J,0,x,ee),_e=new Y(new Array(0),G,0,I,K)},Me=n=>{let w;for(w=0;w<_;w++)n.dyn_ltree[w*2]=0;for(w=0;w<x;w++)n.dyn_dtree[w*2]=0;for(w=0;w<I;w++)n.bl_tree[w*2]=0;n.dyn_ltree[W*2]=1,n.opt_len=n.static_len=0,n.sym_next=n.matches=0},Ce=n=>{n.bi_valid>8?fe(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0},Ge=(n,w,E,C)=>{const R=w*2,oe=E*2;return n[R]<n[oe]||n[R]===n[oe]&&C[w]<=C[E]},qe=(n,w,E)=>{const C=n.heap[E];let R=E<<1;for(;R<=n.heap_len&&(R<n.heap_len&&Ge(w,n.heap[R+1],n.heap[R],n.depth)&&R++,!Ge(w,C,n.heap[R],n.depth));)n.heap[E]=n.heap[R],E=R,R<<=1;n.heap[E]=C},ae=(n,w,E)=>{let C,R,oe=0,ue,re;if(n.sym_next!==0)do C=n.pending_buf[n.sym_buf+oe++]&255,C+=(n.pending_buf[n.sym_buf+oe++]&255)<<8,R=n.pending_buf[n.sym_buf+oe++],C===0?ke(n,R,w):(ue=j[R],ke(n,ue+M+1,w),re=te[ue],re!==0&&(R-=ne[ue],ge(n,R,re)),C--,ue=pe(C),ke(n,ue,E),re=J[ue],re!==0&&(C-=z[ue],ge(n,C,re)));while(oe<n.sym_next);ke(n,W,w)},le=(n,w)=>{const E=w.dyn_tree,C=w.stat_desc.static_tree,R=w.stat_desc.has_stree,oe=w.stat_desc.elems;let ue,re,he=-1,A;for(n.heap_len=0,n.heap_max=H,ue=0;ue<oe;ue++)E[ue*2]!==0?(n.heap[++n.heap_len]=he=ue,n.depth[ue]=0):E[ue*2+1]=0;for(;n.heap_len<2;)A=n.heap[++n.heap_len]=he<2?++he:0,E[A*2]=1,n.depth[A]=0,n.opt_len--,R&&(n.static_len-=C[A*2+1]);for(w.max_code=he,ue=n.heap_len>>1;ue>=1;ue--)qe(n,E,ue);A=oe;do ue=n.heap[1],n.heap[1]=n.heap[n.heap_len--],qe(n,E,1),re=n.heap[1],n.heap[--n.heap_max]=ue,n.heap[--n.heap_max]=re,E[A*2]=E[ue*2]+E[re*2],n.depth[A]=(n.depth[ue]>=n.depth[re]?n.depth[ue]:n.depth[re])+1,E[ue*2+1]=E[re*2+1]=A,n.heap[1]=A++,qe(n,E,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],De(n,w),Ue(E,he,n.bl_count)},p=(n,w,E)=>{let C,R=-1,oe,ue=w[1],re=0,he=7,A=4;for(ue===0&&(he=138,A=3),w[(E+1)*2+1]=65535,C=0;C<=E;C++)oe=ue,ue=w[(C+1)*2+1],!(++re<he&&oe===ue)&&(re<A?n.bl_tree[oe*2]+=re:oe!==0?(oe!==R&&n.bl_tree[oe*2]++,n.bl_tree[X*2]++):re<=10?n.bl_tree[Q*2]++:n.bl_tree[V*2]++,re=0,R=oe,ue===0?(he=138,A=3):oe===ue?(he=6,A=3):(he=7,A=4))},m=(n,w,E)=>{let C,R=-1,oe,ue=w[1],re=0,he=7,A=4;for(ue===0&&(he=138,A=3),C=0;C<=E;C++)if(oe=ue,ue=w[(C+1)*2+1],!(++re<he&&oe===ue)){if(re<A)do ke(n,oe,n.bl_tree);while(--re!==0);else oe!==0?(oe!==R&&(ke(n,oe,n.bl_tree),re--),ke(n,X,n.bl_tree),ge(n,re-3,2)):re<=10?(ke(n,Q,n.bl_tree),ge(n,re-3,3)):(ke(n,V,n.bl_tree),ge(n,re-11,7));re=0,R=oe,ue===0?(he=138,A=3):oe===ue?(he=6,A=3):(he=7,A=4)}},O=n=>{let w;for(p(n,n.dyn_ltree,n.l_desc.max_code),p(n,n.dyn_dtree,n.d_desc.max_code),le(n,n.bl_desc),w=I-1;w>=3&&n.bl_tree[$[w]*2+1]===0;w--);return n.opt_len+=3*(w+1)+5+5+4,w},y=(n,w,E,C)=>{let R;for(ge(n,w-257,5),ge(n,E-1,5),ge(n,C-4,4),R=0;R<C;R++)ge(n,n.bl_tree[$[R]*2+1],3);m(n,n.dyn_ltree,w-1),m(n,n.dyn_dtree,E-1)},F=n=>{let w=4093624447,E;for(E=0;E<=31;E++,w>>>=1)if(w&1&&n.dyn_ltree[E*2]!==0)return a;if(n.dyn_ltree[18]!==0||n.dyn_ltree[20]!==0||n.dyn_ltree[26]!==0)return c;for(E=32;E<M;E++)if(n.dyn_ltree[E*2]!==0)return c;return a},e=!1,u=n=>{e||(Ne(),e=!0),n.l_desc=new ie(n.dyn_ltree,ve),n.d_desc=new ie(n.dyn_dtree,we),n.bl_desc=new ie(n.bl_tree,_e),n.bi_buf=0,n.bi_valid=0,Me(n)},f=(n,w,E,C)=>{ge(n,(o<<1)+(C?1:0),3),Ce(n),fe(n,E),fe(n,~E),E&&n.pending_buf.set(n.window.subarray(w,w+E),n.pending),n.pending+=E},k=n=>{ge(n,S<<1,3),ke(n,W,se),Ie(n)},v=(n,w,E,C)=>{let R,oe,ue=0;n.level>0?(n.strm.data_type===l&&(n.strm.data_type=F(n)),le(n,n.l_desc),le(n,n.d_desc),ue=O(n),R=n.opt_len+3+7>>>3,oe=n.static_len+3+7>>>3,oe<=R&&(R=oe)):R=oe=E+5,E+4<=R&&w!==-1?f(n,w,E,C):n.strategy===s||oe===R?(ge(n,(S<<1)+(C?1:0),3),ae(n,se,g)):(ge(n,(D<<1)+(C?1:0),3),y(n,n.l_desc.max_code+1,n.d_desc.max_code+1,ue+1),ae(n,n.dyn_ltree,n.dyn_dtree)),Me(n),C&&Ce(n)},i=(n,w,E)=>(n.pending_buf[n.sym_buf+n.sym_next++]=w,n.pending_buf[n.sym_buf+n.sym_next++]=w>>8,n.pending_buf[n.sym_buf+n.sym_next++]=E,w===0?n.dyn_ltree[E*2]++:(n.matches++,w--,n.dyn_ltree[(j[E]+M+1)*2]++,n.dyn_dtree[pe(w)*2]++),n.sym_next===n.sym_end);r.exports._tr_init=u,r.exports._tr_stored_block=f,r.exports._tr_flush_block=v,r.exports._tr_tally=i,r.exports._tr_align=k})),Bo=je(((t,r)=>{var s=(a,c,l,h)=>{let o=a&65535|0,S=a>>>16&65535|0,D=0;for(;l!==0;){D=l>2e3?2e3:l,l-=D;do o=o+c[h++]|0,S=S+o|0;while(--D);o%=65521,S%=65521}return o|S<<16|0};r.exports=s})),xo=je(((t,r)=>{var s=()=>{let l,h=[];for(var o=0;o<256;o++){l=o;for(var S=0;S<8;S++)l=l&1?3988292384^l>>>1:l>>>1;h[o]=l}return h},a=new Uint32Array(s()),c=(l,h,o,S)=>{const D=a,U=S+o;l^=-1;for(let M=S;M<U;M++)l=l>>>8^D[(l^h[M])&255];return l^-1};r.exports=c})),vi=je(((t,r)=>{r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}})),qt=je(((t,r)=>{r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}})),oc=je(((t,r)=>{var{_tr_init:s,_tr_stored_block:a,_tr_flush_block:c,_tr_tally:l,_tr_align:h}=ac(),o=Bo(),S=xo(),D=vi(),{Z_NO_FLUSH:U,Z_PARTIAL_FLUSH:M,Z_FULL_FLUSH:_,Z_FINISH:x,Z_BLOCK:I,Z_OK:H,Z_STREAM_END:ee,Z_STREAM_ERROR:Z,Z_DATA_ERROR:K,Z_BUF_ERROR:W,Z_DEFAULT_COMPRESSION:X,Z_FILTERED:Q,Z_HUFFMAN_ONLY:V,Z_RLE:te,Z_FIXED:J,Z_DEFAULT_STRATEGY:G,Z_UNKNOWN:$,Z_DEFLATED:ce}=qt(),se=9,g=15,L=8,j=573,ne=3,z=258,Y=262,ve=32,we=42,_e=57,ie=69,pe=73,fe=91,ge=103,ke=113,Ee=666,Ie=1,De=2,Ue=3,Ne=4,Me=3,Ce=(d,N)=>(d.msg=D[N],N),Ge=d=>d*2-(d>4?9:0),qe=d=>{let N=d.length;for(;--N>=0;)d[N]=0},ae=d=>{let N,P,me,be=d.w_size;N=d.hash_size,me=N;do P=d.head[--me],d.head[me]=P>=be?P-be:0;while(--N);N=be,me=N;do P=d.prev[--me],d.prev[me]=P>=be?P-be:0;while(--N)},le=(d,N,P)=>(N<<d.hash_shift^P)&d.hash_mask,p=le,m=d=>{const N=d.state;let P=N.pending;P>d.avail_out&&(P=d.avail_out),P!==0&&(d.output.set(N.pending_buf.subarray(N.pending_out,N.pending_out+P),d.next_out),d.next_out+=P,N.pending_out+=P,d.total_out+=P,d.avail_out-=P,N.pending-=P,N.pending===0&&(N.pending_out=0))},O=(d,N)=>{c(d,d.block_start>=0?d.block_start:-1,d.strstart-d.block_start,N),d.block_start=d.strstart,m(d.strm)},y=(d,N)=>{d.pending_buf[d.pending++]=N},F=(d,N)=>{d.pending_buf[d.pending++]=N>>>8&255,d.pending_buf[d.pending++]=N&255},e=(d,N,P,me)=>{let be=d.avail_in;return be>me&&(be=me),be===0?0:(d.avail_in-=be,N.set(d.input.subarray(d.next_in,d.next_in+be),P),d.state.wrap===1?d.adler=o(d.adler,N,be,P):d.state.wrap===2&&(d.adler=S(d.adler,N,be,P)),d.next_in+=be,d.total_in+=be,be)},u=(d,N)=>{let P=d.max_chain_length,me=d.strstart,be,ye,xe=d.prev_length,Re=d.nice_match;const Be=d.strstart>d.w_size-Y?d.strstart-(d.w_size-Y):0,Le=d.window,$e=d.w_mask,Ke=d.prev,rt=d.strstart+z;let ut=Le[me+xe-1],at=Le[me+xe];d.prev_length>=d.good_match&&(P>>=2),Re>d.lookahead&&(Re=d.lookahead);do if(be=N,!(Le[be+xe]!==at||Le[be+xe-1]!==ut||Le[be]!==Le[me]||Le[++be]!==Le[me+1])){me+=2,be++;do;while(Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&Le[++me]===Le[++be]&&me<rt);if(ye=z-(rt-me),me=rt-z,ye>xe){if(d.match_start=N,xe=ye,ye>=Re)break;ut=Le[me+xe-1],at=Le[me+xe]}}while((N=Ke[N&$e])>Be&&--P!==0);return xe<=d.lookahead?xe:d.lookahead},f=d=>{const N=d.w_size;let P,me,be;do{if(me=d.window_size-d.lookahead-d.strstart,d.strstart>=N+(N-Y)&&(d.window.set(d.window.subarray(N,N+N-me),0),d.match_start-=N,d.strstart-=N,d.block_start-=N,d.insert>d.strstart&&(d.insert=d.strstart),ae(d),me+=N),d.strm.avail_in===0)break;if(P=e(d.strm,d.window,d.strstart+d.lookahead,me),d.lookahead+=P,d.lookahead+d.insert>=ne)for(be=d.strstart-d.insert,d.ins_h=d.window[be],d.ins_h=p(d,d.ins_h,d.window[be+1]);d.insert&&(d.ins_h=p(d,d.ins_h,d.window[be+ne-1]),d.prev[be&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=be,be++,d.insert--,!(d.lookahead+d.insert<ne)););}while(d.lookahead<Y&&d.strm.avail_in!==0)},k=(d,N)=>{let P=d.pending_buf_size-5>d.w_size?d.w_size:d.pending_buf_size-5,me,be,ye,xe=0,Re=d.strm.avail_in;do{if(me=65535,ye=d.bi_valid+42>>3,d.strm.avail_out<ye||(ye=d.strm.avail_out-ye,be=d.strstart-d.block_start,me>be+d.strm.avail_in&&(me=be+d.strm.avail_in),me>ye&&(me=ye),me<P&&(me===0&&N!==x||N===U||me!==be+d.strm.avail_in)))break;xe=N===x&&me===be+d.strm.avail_in?1:0,a(d,0,0,xe),d.pending_buf[d.pending-4]=me,d.pending_buf[d.pending-3]=me>>8,d.pending_buf[d.pending-2]=~me,d.pending_buf[d.pending-1]=~me>>8,m(d.strm),be&&(be>me&&(be=me),d.strm.output.set(d.window.subarray(d.block_start,d.block_start+be),d.strm.next_out),d.strm.next_out+=be,d.strm.avail_out-=be,d.strm.total_out+=be,d.block_start+=be,me-=be),me&&(e(d.strm,d.strm.output,d.strm.next_out,me),d.strm.next_out+=me,d.strm.avail_out-=me,d.strm.total_out+=me)}while(xe===0);return Re-=d.strm.avail_in,Re&&(Re>=d.w_size?(d.matches=2,d.window.set(d.strm.input.subarray(d.strm.next_in-d.w_size,d.strm.next_in),0),d.strstart=d.w_size,d.insert=d.strstart):(d.window_size-d.strstart<=Re&&(d.strstart-=d.w_size,d.window.set(d.window.subarray(d.w_size,d.w_size+d.strstart),0),d.matches<2&&d.matches++,d.insert>d.strstart&&(d.insert=d.strstart)),d.window.set(d.strm.input.subarray(d.strm.next_in-Re,d.strm.next_in),d.strstart),d.strstart+=Re,d.insert+=Re>d.w_size-d.insert?d.w_size-d.insert:Re),d.block_start=d.strstart),d.high_water<d.strstart&&(d.high_water=d.strstart),xe?Ne:N!==U&&N!==x&&d.strm.avail_in===0&&d.strstart===d.block_start?De:(ye=d.window_size-d.strstart,d.strm.avail_in>ye&&d.block_start>=d.w_size&&(d.block_start-=d.w_size,d.strstart-=d.w_size,d.window.set(d.window.subarray(d.w_size,d.w_size+d.strstart),0),d.matches<2&&d.matches++,ye+=d.w_size,d.insert>d.strstart&&(d.insert=d.strstart)),ye>d.strm.avail_in&&(ye=d.strm.avail_in),ye&&(e(d.strm,d.window,d.strstart,ye),d.strstart+=ye,d.insert+=ye>d.w_size-d.insert?d.w_size-d.insert:ye),d.high_water<d.strstart&&(d.high_water=d.strstart),ye=d.bi_valid+42>>3,ye=d.pending_buf_size-ye>65535?65535:d.pending_buf_size-ye,P=ye>d.w_size?d.w_size:ye,be=d.strstart-d.block_start,(be>=P||(be||N===x)&&N!==U&&d.strm.avail_in===0&&be<=ye)&&(me=be>ye?ye:be,xe=N===x&&d.strm.avail_in===0&&me===be?1:0,a(d,d.block_start,me,xe),d.block_start+=me,m(d.strm)),xe?Ue:Ie)},v=(d,N)=>{let P,me;for(;;){if(d.lookahead<Y){if(f(d),d.lookahead<Y&&N===U)return Ie;if(d.lookahead===0)break}if(P=0,d.lookahead>=ne&&(d.ins_h=p(d,d.ins_h,d.window[d.strstart+ne-1]),P=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart),P!==0&&d.strstart-P<=d.w_size-Y&&(d.match_length=u(d,P)),d.match_length>=ne)if(me=l(d,d.strstart-d.match_start,d.match_length-ne),d.lookahead-=d.match_length,d.match_length<=d.max_lazy_match&&d.lookahead>=ne){d.match_length--;do d.strstart++,d.ins_h=p(d,d.ins_h,d.window[d.strstart+ne-1]),P=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart;while(--d.match_length!==0);d.strstart++}else d.strstart+=d.match_length,d.match_length=0,d.ins_h=d.window[d.strstart],d.ins_h=p(d,d.ins_h,d.window[d.strstart+1]);else me=l(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++;if(me&&(O(d,!1),d.strm.avail_out===0))return Ie}return d.insert=d.strstart<ne-1?d.strstart:ne-1,N===x?(O(d,!0),d.strm.avail_out===0?Ue:Ne):d.sym_next&&(O(d,!1),d.strm.avail_out===0)?Ie:De},i=(d,N)=>{let P,me,be;for(;;){if(d.lookahead<Y){if(f(d),d.lookahead<Y&&N===U)return Ie;if(d.lookahead===0)break}if(P=0,d.lookahead>=ne&&(d.ins_h=p(d,d.ins_h,d.window[d.strstart+ne-1]),P=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart),d.prev_length=d.match_length,d.prev_match=d.match_start,d.match_length=ne-1,P!==0&&d.prev_length<d.max_lazy_match&&d.strstart-P<=d.w_size-Y&&(d.match_length=u(d,P),d.match_length<=5&&(d.strategy===Q||d.match_length===ne&&d.strstart-d.match_start>4096)&&(d.match_length=ne-1)),d.prev_length>=ne&&d.match_length<=d.prev_length){be=d.strstart+d.lookahead-ne,me=l(d,d.strstart-1-d.prev_match,d.prev_length-ne),d.lookahead-=d.prev_length-1,d.prev_length-=2;do++d.strstart<=be&&(d.ins_h=p(d,d.ins_h,d.window[d.strstart+ne-1]),P=d.prev[d.strstart&d.w_mask]=d.head[d.ins_h],d.head[d.ins_h]=d.strstart);while(--d.prev_length!==0);if(d.match_available=0,d.match_length=ne-1,d.strstart++,me&&(O(d,!1),d.strm.avail_out===0))return Ie}else if(d.match_available){if(me=l(d,0,d.window[d.strstart-1]),me&&O(d,!1),d.strstart++,d.lookahead--,d.strm.avail_out===0)return Ie}else d.match_available=1,d.strstart++,d.lookahead--}return d.match_available&&(me=l(d,0,d.window[d.strstart-1]),d.match_available=0),d.insert=d.strstart<ne-1?d.strstart:ne-1,N===x?(O(d,!0),d.strm.avail_out===0?Ue:Ne):d.sym_next&&(O(d,!1),d.strm.avail_out===0)?Ie:De},n=(d,N)=>{let P,me,be,ye;const xe=d.window;for(;;){if(d.lookahead<=z){if(f(d),d.lookahead<=z&&N===U)return Ie;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=ne&&d.strstart>0&&(be=d.strstart-1,me=xe[be],me===xe[++be]&&me===xe[++be]&&me===xe[++be])){ye=d.strstart+z;do;while(me===xe[++be]&&me===xe[++be]&&me===xe[++be]&&me===xe[++be]&&me===xe[++be]&&me===xe[++be]&&me===xe[++be]&&me===xe[++be]&&be<ye);d.match_length=z-(ye-be),d.match_length>d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=ne?(P=l(d,1,d.match_length-ne),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(P=l(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),P&&(O(d,!1),d.strm.avail_out===0))return Ie}return d.insert=0,N===x?(O(d,!0),d.strm.avail_out===0?Ue:Ne):d.sym_next&&(O(d,!1),d.strm.avail_out===0)?Ie:De},w=(d,N)=>{let P;for(;;){if(d.lookahead===0&&(f(d),d.lookahead===0)){if(N===U)return Ie;break}if(d.match_length=0,P=l(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,P&&(O(d,!1),d.strm.avail_out===0))return Ie}return d.insert=0,N===x?(O(d,!0),d.strm.avail_out===0?Ue:Ne):d.sym_next&&(O(d,!1),d.strm.avail_out===0)?Ie:De};function E(d,N,P,me,be){this.good_length=d,this.max_lazy=N,this.nice_length=P,this.max_chain=me,this.func=be}var C=[new E(0,0,0,0,k),new E(4,4,8,4,v),new E(4,5,16,8,v),new E(4,6,32,32,v),new E(4,4,16,16,i),new E(8,16,32,32,i),new E(8,16,128,128,i),new E(8,32,128,256,i),new E(32,128,258,1024,i),new E(32,258,258,4096,i)],R=d=>{d.window_size=2*d.w_size,qe(d.head),d.max_lazy_match=C[d.level].max_lazy,d.good_match=C[d.level].good_length,d.nice_match=C[d.level].nice_length,d.max_chain_length=C[d.level].max_chain,d.strstart=0,d.block_start=0,d.lookahead=0,d.insert=0,d.match_length=d.prev_length=ne-1,d.match_available=0,d.ins_h=0};function oe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ce,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(j*2),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),qe(this.dyn_ltree),qe(this.dyn_dtree),qe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),qe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),qe(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var ue=d=>{if(!d)return 1;const N=d.state;return!N||N.strm!==d||N.status!==we&&N.status!==_e&&N.status!==ie&&N.status!==pe&&N.status!==fe&&N.status!==ge&&N.status!==ke&&N.status!==Ee?1:0},re=d=>{if(ue(d))return Ce(d,Z);d.total_in=d.total_out=0,d.data_type=$;const N=d.state;return N.pending=0,N.pending_out=0,N.wrap<0&&(N.wrap=-N.wrap),N.status=N.wrap===2?_e:N.wrap?we:ke,d.adler=N.wrap===2?0:1,N.last_flush=-2,s(N),H},he=d=>{const N=re(d);return N===H&&R(d.state),N},A=(d,N)=>ue(d)||d.state.wrap!==2?Z:(d.state.gzhead=N,H),Se=(d,N,P,me,be,ye)=>{if(!d)return Z;let xe=1;if(N===X&&(N=6),me<0?(xe=0,me=-me):me>15&&(xe=2,me-=16),be<1||be>se||P!==ce||me<8||me>15||N<0||N>9||ye<0||ye>J||me===8&&xe!==1)return Ce(d,Z);me===8&&(me=9);const Re=new oe;return d.state=Re,Re.strm=d,Re.status=we,Re.wrap=xe,Re.gzhead=null,Re.w_bits=me,Re.w_size=1<<Re.w_bits,Re.w_mask=Re.w_size-1,Re.hash_bits=be+7,Re.hash_size=1<<Re.hash_bits,Re.hash_mask=Re.hash_size-1,Re.hash_shift=~~((Re.hash_bits+ne-1)/ne),Re.window=new Uint8Array(Re.w_size*2),Re.head=new Uint16Array(Re.hash_size),Re.prev=new Uint16Array(Re.w_size),Re.lit_bufsize=1<<be+6,Re.pending_buf_size=Re.lit_bufsize*4,Re.pending_buf=new Uint8Array(Re.pending_buf_size),Re.sym_buf=Re.lit_bufsize,Re.sym_end=(Re.lit_bufsize-1)*3,Re.level=N,Re.strategy=ye,Re.method=P,he(d)},Pe=(d,N)=>Se(d,N,ce,g,L,G),Te=(d,N)=>{if(ue(d)||N>I||N<0)return d?Ce(d,Z):Z;const P=d.state;if(!d.output||d.avail_in!==0&&!d.input||P.status===Ee&&N!==x)return Ce(d,d.avail_out===0?W:Z);const me=P.last_flush;if(P.last_flush=N,P.pending!==0){if(m(d),d.avail_out===0)return P.last_flush=-1,H}else if(d.avail_in===0&&Ge(N)<=Ge(me)&&N!==x)return Ce(d,W);if(P.status===Ee&&d.avail_in!==0)return Ce(d,W);if(P.status===we&&P.wrap===0&&(P.status=ke),P.status===we){let be=ce+(P.w_bits-8<<4)<<8,ye=-1;if(P.strategy>=V||P.level<2?ye=0:P.level<6?ye=1:P.level===6?ye=2:ye=3,be|=ye<<6,P.strstart!==0&&(be|=ve),be+=31-be%31,F(P,be),P.strstart!==0&&(F(P,d.adler>>>16),F(P,d.adler&65535)),d.adler=1,P.status=ke,m(d),P.pending!==0)return P.last_flush=-1,H}if(P.status===_e){if(d.adler=0,y(P,31),y(P,139),y(P,8),P.gzhead)y(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),y(P,P.gzhead.time&255),y(P,P.gzhead.time>>8&255),y(P,P.gzhead.time>>16&255),y(P,P.gzhead.time>>24&255),y(P,P.level===9?2:P.strategy>=V||P.level<2?4:0),y(P,P.gzhead.os&255),P.gzhead.extra&&P.gzhead.extra.length&&(y(P,P.gzhead.extra.length&255),y(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(d.adler=S(d.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=ie;else if(y(P,0),y(P,0),y(P,0),y(P,0),y(P,0),y(P,P.level===9?2:P.strategy>=V||P.level<2?4:0),y(P,Me),P.status=ke,m(d),P.pending!==0)return P.last_flush=-1,H}if(P.status===ie){if(P.gzhead.extra){let be=P.pending,ye=(P.gzhead.extra.length&65535)-P.gzindex;for(;P.pending+ye>P.pending_buf_size;){let Re=P.pending_buf_size-P.pending;if(P.pending_buf.set(P.gzhead.extra.subarray(P.gzindex,P.gzindex+Re),P.pending),P.pending=P.pending_buf_size,P.gzhead.hcrc&&P.pending>be&&(d.adler=S(d.adler,P.pending_buf,P.pending-be,be)),P.gzindex+=Re,m(d),P.pending!==0)return P.last_flush=-1,H;be=0,ye-=Re}let xe=new Uint8Array(P.gzhead.extra);P.pending_buf.set(xe.subarray(P.gzindex,P.gzindex+ye),P.pending),P.pending+=ye,P.gzhead.hcrc&&P.pending>be&&(d.adler=S(d.adler,P.pending_buf,P.pending-be,be)),P.gzindex=0}P.status=pe}if(P.status===pe){if(P.gzhead.name){let be=P.pending,ye;do{if(P.pending===P.pending_buf_size){if(P.gzhead.hcrc&&P.pending>be&&(d.adler=S(d.adler,P.pending_buf,P.pending-be,be)),m(d),P.pending!==0)return P.last_flush=-1,H;be=0}P.gzindex<P.gzhead.name.length?ye=P.gzhead.name.charCodeAt(P.gzindex++)&255:ye=0,y(P,ye)}while(ye!==0);P.gzhead.hcrc&&P.pending>be&&(d.adler=S(d.adler,P.pending_buf,P.pending-be,be)),P.gzindex=0}P.status=fe}if(P.status===fe){if(P.gzhead.comment){let be=P.pending,ye;do{if(P.pending===P.pending_buf_size){if(P.gzhead.hcrc&&P.pending>be&&(d.adler=S(d.adler,P.pending_buf,P.pending-be,be)),m(d),P.pending!==0)return P.last_flush=-1,H;be=0}P.gzindex<P.gzhead.comment.length?ye=P.gzhead.comment.charCodeAt(P.gzindex++)&255:ye=0,y(P,ye)}while(ye!==0);P.gzhead.hcrc&&P.pending>be&&(d.adler=S(d.adler,P.pending_buf,P.pending-be,be))}P.status=ge}if(P.status===ge){if(P.gzhead.hcrc){if(P.pending+2>P.pending_buf_size&&(m(d),P.pending!==0))return P.last_flush=-1,H;y(P,d.adler&255),y(P,d.adler>>8&255),d.adler=0}if(P.status=ke,m(d),P.pending!==0)return P.last_flush=-1,H}if(d.avail_in!==0||P.lookahead!==0||N!==U&&P.status!==Ee){let be=P.level===0?k(P,N):P.strategy===V?w(P,N):P.strategy===te?n(P,N):C[P.level].func(P,N);if((be===Ue||be===Ne)&&(P.status=Ee),be===Ie||be===Ue)return d.avail_out===0&&(P.last_flush=-1),H;if(be===De&&(N===M?h(P):N!==I&&(a(P,0,0,!1),N===_&&(qe(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),m(d),d.avail_out===0))return P.last_flush=-1,H}return N!==x?H:P.wrap<=0?ee:(P.wrap===2?(y(P,d.adler&255),y(P,d.adler>>8&255),y(P,d.adler>>16&255),y(P,d.adler>>24&255),y(P,d.total_in&255),y(P,d.total_in>>8&255),y(P,d.total_in>>16&255),y(P,d.total_in>>24&255)):(F(P,d.adler>>>16),F(P,d.adler&65535)),m(d),P.wrap>0&&(P.wrap=-P.wrap),P.pending!==0?H:ee)},He=d=>{if(ue(d))return Z;const N=d.state.status;return d.state=null,N===ke?Ce(d,K):H},T=(d,N)=>{let P=N.length;if(ue(d))return Z;const me=d.state,be=me.wrap;if(be===2||be===1&&me.status!==we||me.lookahead)return Z;if(be===1&&(d.adler=o(d.adler,N,P,0)),me.wrap=0,P>=me.w_size){be===0&&(qe(me.head),me.strstart=0,me.block_start=0,me.insert=0);let Be=new Uint8Array(me.w_size);Be.set(N.subarray(P-me.w_size,P),0),N=Be,P=me.w_size}const ye=d.avail_in,xe=d.next_in,Re=d.input;for(d.avail_in=P,d.next_in=0,d.input=N,f(me);me.lookahead>=ne;){let Be=me.strstart,Le=me.lookahead-(ne-1);do me.ins_h=p(me,me.ins_h,me.window[Be+ne-1]),me.prev[Be&me.w_mask]=me.head[me.ins_h],me.head[me.ins_h]=Be,Be++;while(--Le);me.strstart=Be,me.lookahead=ne-1,f(me)}return me.strstart+=me.lookahead,me.block_start=me.strstart,me.insert=me.lookahead,me.lookahead=0,me.match_length=me.prev_length=ne-1,me.match_available=0,d.next_in=xe,d.input=Re,d.avail_in=ye,me.wrap=be,H};r.exports.deflateInit=Pe,r.exports.deflateInit2=Se,r.exports.deflateReset=he,r.exports.deflateResetKeep=re,r.exports.deflateSetHeader=A,r.exports.deflate=Te,r.exports.deflateEnd=He,r.exports.deflateSetDictionary=T,r.exports.deflateInfo="pako deflate (from Nodeca project)"})),Uo=je(((t,r)=>{var s=(a,c)=>Object.prototype.hasOwnProperty.call(a,c);r.exports.assign=function(a){const c=Array.prototype.slice.call(arguments,1);for(;c.length;){const l=c.shift();if(l){if(typeof l!="object")throw new TypeError(l+"must be non-object");for(const h in l)s(l,h)&&(a[h]=l[h])}}return a},r.exports.flattenChunks=a=>{let c=0;for(let h=0,o=a.length;h<o;h++)c+=a[h].length;const l=new Uint8Array(c);for(let h=0,o=0,S=a.length;h<S;h++){let D=a[h];l.set(D,o),o+=D.length}return l}})),Lo=je(((t,r)=>{var s=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{s=!1}var a=new Uint8Array(256);for(let l=0;l<256;l++)a[l]=l>=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,r.exports.string2buf=l=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(l);let h,o,S,D,U,M=l.length,_=0;for(D=0;D<M;D++)o=l.charCodeAt(D),(o&64512)===55296&&D+1<M&&(S=l.charCodeAt(D+1),(S&64512)===56320&&(o=65536+(o-55296<<10)+(S-56320),D++)),_+=o<128?1:o<2048?2:o<65536?3:4;for(h=new Uint8Array(_),U=0,D=0;U<_;D++)o=l.charCodeAt(D),(o&64512)===55296&&D+1<M&&(S=l.charCodeAt(D+1),(S&64512)===56320&&(o=65536+(o-55296<<10)+(S-56320),D++)),o<128?h[U++]=o:o<2048?(h[U++]=192|o>>>6,h[U++]=128|o&63):o<65536?(h[U++]=224|o>>>12,h[U++]=128|o>>>6&63,h[U++]=128|o&63):(h[U++]=240|o>>>18,h[U++]=128|o>>>12&63,h[U++]=128|o>>>6&63,h[U++]=128|o&63);return h};var c=(l,h)=>{if(h<65534&&l.subarray&&s)return String.fromCharCode.apply(null,l.length===h?l:l.subarray(0,h));let o="";for(let S=0;S<h;S++)o+=String.fromCharCode(l[S]);return o};r.exports.buf2string=(l,h)=>{const o=h||l.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(l.subarray(0,h));let S,D;const U=new Array(o*2);for(D=0,S=0;S<o;){let M=l[S++];if(M<128){U[D++]=M;continue}let _=a[M];if(_>4){U[D++]=65533,S+=_-1;continue}for(M&=_===2?31:_===3?15:7;_>1&&S<o;)M=M<<6|l[S++]&63,_--;if(_>1){U[D++]=65533;continue}M<65536?U[D++]=M:(M-=65536,U[D++]=55296|M>>10&1023,U[D++]=56320|M&1023)}return c(U,D)},r.exports.utf8border=(l,h)=>{h=h||l.length,h>l.length&&(h=l.length);let o=h-1;for(;o>=0&&(l[o]&192)===128;)o--;return o<0||o===0?h:o+a[l[o]]>h?o:h}})),Mo=je(((t,r)=>{function s(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}r.exports=s})),sc=je(((t,r)=>{var s=oc(),a=Uo(),c=Lo(),l=vi(),h=Mo(),o=Object.prototype.toString,{Z_NO_FLUSH:S,Z_SYNC_FLUSH:D,Z_FULL_FLUSH:U,Z_FINISH:M,Z_OK:_,Z_STREAM_END:x,Z_DEFAULT_COMPRESSION:I,Z_DEFAULT_STRATEGY:H,Z_DEFLATED:ee}=qt();function Z(Q){this.options=a.assign({level:I,method:ee,chunkSize:16384,windowBits:15,memLevel:8,strategy:H},Q||{});let V=this.options;V.raw&&V.windowBits>0?V.windowBits=-V.windowBits:V.gzip&&V.windowBits>0&&V.windowBits<16&&(V.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;let te=s.deflateInit2(this.strm,V.level,V.method,V.windowBits,V.memLevel,V.strategy);if(te!==_)throw new Error(l[te]);if(V.header&&s.deflateSetHeader(this.strm,V.header),V.dictionary){let J;if(typeof V.dictionary=="string"?J=c.string2buf(V.dictionary):o.call(V.dictionary)==="[object ArrayBuffer]"?J=new Uint8Array(V.dictionary):J=V.dictionary,te=s.deflateSetDictionary(this.strm,J),te!==_)throw new Error(l[te]);this._dict_set=!0}}Z.prototype.push=function(Q,V){const te=this.strm,J=this.options.chunkSize;let G,$;if(this.ended)return!1;for(V===~~V?$=V:$=V===!0?M:S,typeof Q=="string"?te.input=c.string2buf(Q):o.call(Q)==="[object ArrayBuffer]"?te.input=new Uint8Array(Q):te.input=Q,te.next_in=0,te.avail_in=te.input.length;;){if(te.avail_out===0&&(te.output=new Uint8Array(J),te.next_out=0,te.avail_out=J),($===D||$===U)&&te.avail_out<=6){this.onData(te.output.subarray(0,te.next_out)),te.avail_out=0;continue}if(G=s.deflate(te,$),G===x)return te.next_out>0&&this.onData(te.output.subarray(0,te.next_out)),G=s.deflateEnd(this.strm),this.onEnd(G),this.ended=!0,G===_;if(te.avail_out===0){this.onData(te.output);continue}if($>0&&te.next_out>0){this.onData(te.output.subarray(0,te.next_out)),te.avail_out=0;continue}if(te.avail_in===0)break}return!0},Z.prototype.onData=function(Q){this.chunks.push(Q)},Z.prototype.onEnd=function(Q){Q===_&&(this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=Q,this.msg=this.strm.msg};function K(Q,V){const te=new Z(V);if(te.push(Q,!0),te.err)throw te.msg||l[te.err];return te.result}function W(Q,V){return V=V||{},V.raw=!0,K(Q,V)}function X(Q,V){return V=V||{},V.gzip=!0,K(Q,V)}r.exports.Deflate=Z,r.exports.deflate=K,r.exports.deflateRaw=W,r.exports.gzip=X,r.exports.constants=qt()})),lc=je(((t,r)=>{var s=16209,a=16191;r.exports=function(l,h){let o,S,D,U,M,_,x,I,H,ee,Z,K,W,X,Q,V,te,J,G,$,ce,se,g,L;const j=l.state;o=l.next_in,g=l.input,S=o+(l.avail_in-5),D=l.next_out,L=l.output,U=D-(h-l.avail_out),M=D+(l.avail_out-257),_=j.dmax,x=j.wsize,I=j.whave,H=j.wnext,ee=j.window,Z=j.hold,K=j.bits,W=j.lencode,X=j.distcode,Q=(1<<j.lenbits)-1,V=(1<<j.distbits)-1;e:do{K<15&&(Z+=g[o++]<<K,K+=8,Z+=g[o++]<<K,K+=8),te=W[Z&Q];t:for(;;){if(J=te>>>24,Z>>>=J,K-=J,J=te>>>16&255,J===0)L[D++]=te&65535;else if(J&16){G=te&65535,J&=15,J&&(K<J&&(Z+=g[o++]<<K,K+=8),G+=Z&(1<<J)-1,Z>>>=J,K-=J),K<15&&(Z+=g[o++]<<K,K+=8,Z+=g[o++]<<K,K+=8),te=X[Z&V];r:for(;;){if(J=te>>>24,Z>>>=J,K-=J,J=te>>>16&255,J&16){if($=te&65535,J&=15,K<J&&(Z+=g[o++]<<K,K+=8,K<J&&(Z+=g[o++]<<K,K+=8)),$+=Z&(1<<J)-1,$>_){l.msg="invalid distance too far back",j.mode=s;break e}if(Z>>>=J,K-=J,J=D-U,$>J){if(J=$-J,J>I&&j.sane){l.msg="invalid distance too far back",j.mode=s;break e}if(ce=0,se=ee,H===0){if(ce+=x-J,J<G){G-=J;do L[D++]=ee[ce++];while(--J);ce=D-$,se=L}}else if(H<J){if(ce+=x+H-J,J-=H,J<G){G-=J;do L[D++]=ee[ce++];while(--J);if(ce=0,H<G){J=H,G-=J;do L[D++]=ee[ce++];while(--J);ce=D-$,se=L}}}else if(ce+=H-J,J<G){G-=J;do L[D++]=ee[ce++];while(--J);ce=D-$,se=L}for(;G>2;)L[D++]=se[ce++],L[D++]=se[ce++],L[D++]=se[ce++],G-=3;G&&(L[D++]=se[ce++],G>1&&(L[D++]=se[ce++]))}else{ce=D-$;do L[D++]=L[ce++],L[D++]=L[ce++],L[D++]=L[ce++],G-=3;while(G>2);G&&(L[D++]=L[ce++],G>1&&(L[D++]=L[ce++]))}}else if((J&64)===0){te=X[(te&65535)+(Z&(1<<J)-1)];continue r}else{l.msg="invalid distance code",j.mode=s;break e}break}}else if((J&64)===0){te=W[(te&65535)+(Z&(1<<J)-1)];continue t}else if(J&32){j.mode=a;break e}else{l.msg="invalid literal/length code",j.mode=s;break e}break}}while(o<S&&D<M);G=K>>3,o-=G,K-=G<<3,Z&=(1<<K)-1,l.next_in=o,l.next_out=D,l.avail_in=o<S?5+(S-o):5-(o-S),l.avail_out=D<M?257+(M-D):257-(D-M),j.hold=Z,j.bits=K}})),uc=je(((t,r)=>{var s=15,a=852,c=592,l=0,h=1,o=2,S=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),D=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),U=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),M=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),_=(x,I,H,ee,Z,K,W,X)=>{const Q=X.bits;let V=0,te=0,J=0,G=0,$=0,ce=0,se=0,g=0,L=0,j=0,ne,z,Y,ve,we,_e=null,ie;const pe=new Uint16Array(16),fe=new Uint16Array(16);let ge=null,ke,Ee,Ie;for(V=0;V<=s;V++)pe[V]=0;for(te=0;te<ee;te++)pe[I[H+te]]++;for($=Q,G=s;G>=1&&pe[G]===0;G--);if($>G&&($=G),G===0)return Z[K++]=20971520,Z[K++]=20971520,X.bits=1,0;for(J=1;J<G&&pe[J]===0;J++);for($<J&&($=J),g=1,V=1;V<=s;V++)if(g<<=1,g-=pe[V],g<0)return-1;if(g>0&&(x===l||G!==1))return-1;for(fe[1]=0,V=1;V<s;V++)fe[V+1]=fe[V]+pe[V];for(te=0;te<ee;te++)I[H+te]!==0&&(W[fe[I[H+te]]++]=te);if(x===l?(_e=ge=W,ie=20):x===h?(_e=S,ge=D,ie=257):(_e=U,ge=M,ie=0),j=0,te=0,V=J,we=K,ce=$,se=0,Y=-1,L=1<<$,ve=L-1,x===h&&L>a||x===o&&L>c)return 1;for(;;){ke=V-se,W[te]+1<ie?(Ee=0,Ie=W[te]):W[te]>=ie?(Ee=ge[W[te]-ie],Ie=_e[W[te]-ie]):(Ee=96,Ie=0),ne=1<<V-se,z=1<<ce,J=z;do z-=ne,Z[we+(j>>se)+z]=ke<<24|Ee<<16|Ie|0;while(z!==0);for(ne=1<<V-1;j≠)ne>>=1;if(ne!==0?(j&=ne-1,j+=ne):j=0,te++,--pe[V]===0){if(V===G)break;V=I[H+W[te]]}if(V>$&&(j&ve)!==Y){for(se===0&&(se=$),we+=J,ce=V-se,g=1<<ce;ce+se<G&&(g-=pe[ce+se],!(g<=0));)ce++,g<<=1;if(L+=1<<ce,x===h&&L>a||x===o&&L>c)return 1;Y=j&ve,Z[Y]=$<<24|ce<<16|we-K|0}}return j!==0&&(Z[we+j]=V-se<<24|4194304),X.bits=$,0};r.exports=_})),cc=je(((t,r)=>{var s=Bo(),a=xo(),c=lc(),l=uc(),h=0,o=1,S=2,{Z_FINISH:D,Z_BLOCK:U,Z_TREES:M,Z_OK:_,Z_STREAM_END:x,Z_NEED_DICT:I,Z_STREAM_ERROR:H,Z_DATA_ERROR:ee,Z_MEM_ERROR:Z,Z_BUF_ERROR:K,Z_DEFLATED:W}=qt(),X=16180,Q=16181,V=16182,te=16183,J=16184,G=16185,$=16186,ce=16187,se=16188,g=16189,L=16190,j=16191,ne=16192,z=16193,Y=16194,ve=16195,we=16196,_e=16197,ie=16198,pe=16199,fe=16200,ge=16201,ke=16202,Ee=16203,Ie=16204,De=16205,Ue=16206,Ne=16207,Me=16208,Ce=16209,Ge=16210,qe=16211,ae=852,le=592,p=15,m=re=>(re>>>24&255)+(re>>>8&65280)+((re&65280)<<8)+((re&255)<<24);function O(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var y=re=>{if(!re)return 1;const he=re.state;return!he||he.strm!==re||he.mode<X||he.mode>qe?1:0},F=re=>{if(y(re))return H;const he=re.state;return re.total_in=re.total_out=he.total=0,re.msg="",he.wrap&&(re.adler=he.wrap&1),he.mode=X,he.last=0,he.havedict=0,he.flags=-1,he.dmax=32768,he.head=null,he.hold=0,he.bits=0,he.lencode=he.lendyn=new Int32Array(ae),he.distcode=he.distdyn=new Int32Array(le),he.sane=1,he.back=-1,_},e=re=>{if(y(re))return H;const he=re.state;return he.wsize=0,he.whave=0,he.wnext=0,F(re)},u=(re,he)=>{let A;if(y(re))return H;const Se=re.state;return he<0?(A=0,he=-he):(A=(he>>4)+5,he<48&&(he&=15)),he&&(he<8||he>15)?H:(Se.window!==null&&Se.wbits!==he&&(Se.window=null),Se.wrap=A,Se.wbits=he,e(re))},f=(re,he)=>{if(!re)return H;const A=new O;re.state=A,A.strm=re,A.window=null,A.mode=X;const Se=u(re,he);return Se!==_&&(re.state=null),Se},k=re=>f(re,p),v=!0,i,n,w=re=>{if(v){i=new Int32Array(512),n=new Int32Array(32);let he=0;for(;he<144;)re.lens[he++]=8;for(;he<256;)re.lens[he++]=9;for(;he<280;)re.lens[he++]=7;for(;he<288;)re.lens[he++]=8;for(l(o,re.lens,0,288,i,0,re.work,{bits:9}),he=0;he<32;)re.lens[he++]=5;l(S,re.lens,0,32,n,0,re.work,{bits:5}),v=!1}re.lencode=i,re.lenbits=9,re.distcode=n,re.distbits=5},E=(re,he,A,Se)=>{let Pe;const Te=re.state;return Te.window===null&&(Te.wsize=1<<Te.wbits,Te.wnext=0,Te.whave=0,Te.window=new Uint8Array(Te.wsize)),Se>=Te.wsize?(Te.window.set(he.subarray(A-Te.wsize,A),0),Te.wnext=0,Te.whave=Te.wsize):(Pe=Te.wsize-Te.wnext,Pe>Se&&(Pe=Se),Te.window.set(he.subarray(A-Se,A-Se+Pe),Te.wnext),Se-=Pe,Se?(Te.window.set(he.subarray(A-Se,A),0),Te.wnext=Se,Te.whave=Te.wsize):(Te.wnext+=Pe,Te.wnext===Te.wsize&&(Te.wnext=0),Te.whave<Te.wsize&&(Te.whave+=Pe))),0},C=(re,he)=>{let A,Se,Pe,Te,He,T,d,N,P,me,be,ye,xe,Re,Be=0,Le,$e,Ke,rt,ut,at,Qe,st;const Xe=new Uint8Array(4);let ht,ot;const It=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(y(re)||!re.output||!re.input&&re.avail_in!==0)return H;A=re.state,A.mode===j&&(A.mode=ne),He=re.next_out,Pe=re.output,d=re.avail_out,Te=re.next_in,Se=re.input,T=re.avail_in,N=A.hold,P=A.bits,me=T,be=d,st=_;e:for(;;)switch(A.mode){case X:if(A.wrap===0){A.mode=ne;break}for(;P<16;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(A.wrap&2&&N===35615){A.wbits===0&&(A.wbits=15),A.check=0,Xe[0]=N&255,Xe[1]=N>>>8&255,A.check=a(A.check,Xe,2,0),N=0,P=0,A.mode=Q;break}if(A.head&&(A.head.done=!1),!(A.wrap&1)||(((N&255)<<8)+(N>>8))%31){re.msg="incorrect header check",A.mode=Ce;break}if((N&15)!==W){re.msg="unknown compression method",A.mode=Ce;break}if(N>>>=4,P-=4,Qe=(N&15)+8,A.wbits===0&&(A.wbits=Qe),Qe>15||Qe>A.wbits){re.msg="invalid window size",A.mode=Ce;break}A.dmax=1<<A.wbits,A.flags=0,re.adler=A.check=1,A.mode=N&512?g:j,N=0,P=0;break;case Q:for(;P<16;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(A.flags=N,(A.flags&255)!==W){re.msg="unknown compression method",A.mode=Ce;break}if(A.flags&57344){re.msg="unknown header flags set",A.mode=Ce;break}A.head&&(A.head.text=N>>8&1),A.flags&512&&A.wrap&4&&(Xe[0]=N&255,Xe[1]=N>>>8&255,A.check=a(A.check,Xe,2,0)),N=0,P=0,A.mode=V;case V:for(;P<32;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}A.head&&(A.head.time=N),A.flags&512&&A.wrap&4&&(Xe[0]=N&255,Xe[1]=N>>>8&255,Xe[2]=N>>>16&255,Xe[3]=N>>>24&255,A.check=a(A.check,Xe,4,0)),N=0,P=0,A.mode=te;case te:for(;P<16;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}A.head&&(A.head.xflags=N&255,A.head.os=N>>8),A.flags&512&&A.wrap&4&&(Xe[0]=N&255,Xe[1]=N>>>8&255,A.check=a(A.check,Xe,2,0)),N=0,P=0,A.mode=J;case J:if(A.flags&1024){for(;P<16;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}A.length=N,A.head&&(A.head.extra_len=N),A.flags&512&&A.wrap&4&&(Xe[0]=N&255,Xe[1]=N>>>8&255,A.check=a(A.check,Xe,2,0)),N=0,P=0}else A.head&&(A.head.extra=null);A.mode=G;case G:if(A.flags&1024&&(ye=A.length,ye>T&&(ye=T),ye&&(A.head&&(Qe=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Uint8Array(A.head.extra_len)),A.head.extra.set(Se.subarray(Te,Te+ye),Qe)),A.flags&512&&A.wrap&4&&(A.check=a(A.check,Se,ye,Te)),T-=ye,Te+=ye,A.length-=ye),A.length))break e;A.length=0,A.mode=$;case $:if(A.flags&2048){if(T===0)break e;ye=0;do Qe=Se[Te+ye++],A.head&&Qe&&A.length<65536&&(A.head.name+=String.fromCharCode(Qe));while(Qe&&ye<T);if(A.flags&512&&A.wrap&4&&(A.check=a(A.check,Se,ye,Te)),T-=ye,Te+=ye,Qe)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=ce;case ce:if(A.flags&4096){if(T===0)break e;ye=0;do Qe=Se[Te+ye++],A.head&&Qe&&A.length<65536&&(A.head.comment+=String.fromCharCode(Qe));while(Qe&&ye<T);if(A.flags&512&&A.wrap&4&&(A.check=a(A.check,Se,ye,Te)),T-=ye,Te+=ye,Qe)break e}else A.head&&(A.head.comment=null);A.mode=se;case se:if(A.flags&512){for(;P<16;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(A.wrap&4&&N!==(A.check&65535)){re.msg="header crc mismatch",A.mode=Ce;break}N=0,P=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),re.adler=A.check=0,A.mode=j;break;case g:for(;P<32;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}re.adler=A.check=m(N),N=0,P=0,A.mode=L;case L:if(A.havedict===0)return re.next_out=He,re.avail_out=d,re.next_in=Te,re.avail_in=T,A.hold=N,A.bits=P,I;re.adler=A.check=1,A.mode=j;case j:if(he===U||he===M)break e;case ne:if(A.last){N>>>=P&7,P-=P&7,A.mode=Ue;break}for(;P<3;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}switch(A.last=N&1,N>>>=1,P-=1,N&3){case 0:A.mode=z;break;case 1:if(w(A),A.mode=pe,he===M){N>>>=2,P-=2;break e}break;case 2:A.mode=we;break;case 3:re.msg="invalid block type",A.mode=Ce}N>>>=2,P-=2;break;case z:for(N>>>=P&7,P-=P&7;P<32;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if((N&65535)!==(N>>>16^65535)){re.msg="invalid stored block lengths",A.mode=Ce;break}if(A.length=N&65535,N=0,P=0,A.mode=Y,he===M)break e;case Y:A.mode=ve;case ve:if(ye=A.length,ye){if(ye>T&&(ye=T),ye>d&&(ye=d),ye===0)break e;Pe.set(Se.subarray(Te,Te+ye),He),T-=ye,Te+=ye,d-=ye,He+=ye,A.length-=ye;break}A.mode=j;break;case we:for(;P<14;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(A.nlen=(N&31)+257,N>>>=5,P-=5,A.ndist=(N&31)+1,N>>>=5,P-=5,A.ncode=(N&15)+4,N>>>=4,P-=4,A.nlen>286||A.ndist>30){re.msg="too many length or distance symbols",A.mode=Ce;break}A.have=0,A.mode=_e;case _e:for(;A.have<A.ncode;){for(;P<3;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}A.lens[It[A.have++]]=N&7,N>>>=3,P-=3}for(;A.have<19;)A.lens[It[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,ht={bits:A.lenbits},st=l(h,A.lens,0,19,A.lencode,0,A.work,ht),A.lenbits=ht.bits,st){re.msg="invalid code lengths set",A.mode=Ce;break}A.have=0,A.mode=ie;case ie:for(;A.have<A.nlen+A.ndist;){for(;Be=A.lencode[N&(1<<A.lenbits)-1],Le=Be>>>24,$e=Be>>>16&255,Ke=Be&65535,!(Le<=P);){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(Ke<16)N>>>=Le,P-=Le,A.lens[A.have++]=Ke;else{if(Ke===16){for(ot=Le+2;P<ot;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(N>>>=Le,P-=Le,A.have===0){re.msg="invalid bit length repeat",A.mode=Ce;break}Qe=A.lens[A.have-1],ye=3+(N&3),N>>>=2,P-=2}else if(Ke===17){for(ot=Le+3;P<ot;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}N>>>=Le,P-=Le,Qe=0,ye=3+(N&7),N>>>=3,P-=3}else{for(ot=Le+7;P<ot;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}N>>>=Le,P-=Le,Qe=0,ye=11+(N&127),N>>>=7,P-=7}if(A.have+ye>A.nlen+A.ndist){re.msg="invalid bit length repeat",A.mode=Ce;break}for(;ye--;)A.lens[A.have++]=Qe}}if(A.mode===Ce)break;if(A.lens[256]===0){re.msg="invalid code -- missing end-of-block",A.mode=Ce;break}if(A.lenbits=9,ht={bits:A.lenbits},st=l(o,A.lens,0,A.nlen,A.lencode,0,A.work,ht),A.lenbits=ht.bits,st){re.msg="invalid literal/lengths set",A.mode=Ce;break}if(A.distbits=6,A.distcode=A.distdyn,ht={bits:A.distbits},st=l(S,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,ht),A.distbits=ht.bits,st){re.msg="invalid distances set",A.mode=Ce;break}if(A.mode=pe,he===M)break e;case pe:A.mode=fe;case fe:if(T>=6&&d>=258){re.next_out=He,re.avail_out=d,re.next_in=Te,re.avail_in=T,A.hold=N,A.bits=P,c(re,be),He=re.next_out,Pe=re.output,d=re.avail_out,Te=re.next_in,Se=re.input,T=re.avail_in,N=A.hold,P=A.bits,A.mode===j&&(A.back=-1);break}for(A.back=0;Be=A.lencode[N&(1<<A.lenbits)-1],Le=Be>>>24,$e=Be>>>16&255,Ke=Be&65535,!(Le<=P);){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if($e&&($e&240)===0){for(rt=Le,ut=$e,at=Ke;Be=A.lencode[at+((N&(1<<rt+ut)-1)>>rt)],Le=Be>>>24,$e=Be>>>16&255,Ke=Be&65535,!(rt+Le<=P);){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}N>>>=rt,P-=rt,A.back+=rt}if(N>>>=Le,P-=Le,A.back+=Le,A.length=Ke,$e===0){A.mode=De;break}if($e&32){A.back=-1,A.mode=j;break}if($e&64){re.msg="invalid literal/length code",A.mode=Ce;break}A.extra=$e&15,A.mode=ge;case ge:if(A.extra){for(ot=A.extra;P<ot;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}A.length+=N&(1<<A.extra)-1,N>>>=A.extra,P-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=ke;case ke:for(;Be=A.distcode[N&(1<<A.distbits)-1],Le=Be>>>24,$e=Be>>>16&255,Ke=Be&65535,!(Le<=P);){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(($e&240)===0){for(rt=Le,ut=$e,at=Ke;Be=A.distcode[at+((N&(1<<rt+ut)-1)>>rt)],Le=Be>>>24,$e=Be>>>16&255,Ke=Be&65535,!(rt+Le<=P);){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}N>>>=rt,P-=rt,A.back+=rt}if(N>>>=Le,P-=Le,A.back+=Le,$e&64){re.msg="invalid distance code",A.mode=Ce;break}A.offset=Ke,A.extra=$e&15,A.mode=Ee;case Ee:if(A.extra){for(ot=A.extra;P<ot;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}A.offset+=N&(1<<A.extra)-1,N>>>=A.extra,P-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){re.msg="invalid distance too far back",A.mode=Ce;break}A.mode=Ie;case Ie:if(d===0)break e;if(ye=be-d,A.offset>ye){if(ye=A.offset-ye,ye>A.whave&&A.sane){re.msg="invalid distance too far back",A.mode=Ce;break}ye>A.wnext?(ye-=A.wnext,xe=A.wsize-ye):xe=A.wnext-ye,ye>A.length&&(ye=A.length),Re=A.window}else Re=Pe,xe=He-A.offset,ye=A.length;ye>d&&(ye=d),d-=ye,A.length-=ye;do Pe[He++]=Re[xe++];while(--ye);A.length===0&&(A.mode=fe);break;case De:if(d===0)break e;Pe[He++]=A.length,d--,A.mode=fe;break;case Ue:if(A.wrap){for(;P<32;){if(T===0)break e;T--,N|=Se[Te++]<<P,P+=8}if(be-=d,re.total_out+=be,A.total+=be,A.wrap&4&&be&&(re.adler=A.check=A.flags?a(A.check,Pe,be,He-be):s(A.check,Pe,be,He-be)),be=d,A.wrap&4&&(A.flags?N:m(N))!==A.check){re.msg="incorrect data check",A.mode=Ce;break}N=0,P=0}A.mode=Ne;case Ne:if(A.wrap&&A.flags){for(;P<32;){if(T===0)break e;T--,N+=Se[Te++]<<P,P+=8}if(A.wrap&4&&N!==(A.total&4294967295)){re.msg="incorrect length check",A.mode=Ce;break}N=0,P=0}A.mode=Me;case Me:st=x;break e;case Ce:st=ee;break e;case Ge:return Z;case qe:default:return H}return re.next_out=He,re.avail_out=d,re.next_in=Te,re.avail_in=T,A.hold=N,A.bits=P,(A.wsize||be!==re.avail_out&&A.mode<Ce&&(A.mode<Ue||he!==D))&&E(re,re.output,re.next_out,be-re.avail_out)?(A.mode=Ge,Z):(me-=re.avail_in,be-=re.avail_out,re.total_in+=me,re.total_out+=be,A.total+=be,A.wrap&4&&be&&(re.adler=A.check=A.flags?a(A.check,Pe,be,re.next_out-be):s(A.check,Pe,be,re.next_out-be)),re.data_type=A.bits+(A.last?64:0)+(A.mode===j?128:0)+(A.mode===pe||A.mode===Y?256:0),(me===0&&be===0||he===D)&&st===_&&(st=K),st)},R=re=>{if(y(re))return H;let he=re.state;return he.window&&(he.window=null),re.state=null,_},oe=(re,he)=>{if(y(re))return H;const A=re.state;return(A.wrap&2)===0?H:(A.head=he,he.done=!1,_)},ue=(re,he)=>{const A=he.length;let Se,Pe,Te;return y(re)||(Se=re.state,Se.wrap!==0&&Se.mode!==L)?H:Se.mode===L&&(Pe=1,Pe=s(Pe,he,A,0),Pe!==Se.check)?ee:(Te=E(re,he,A,A),Te?(Se.mode=Ge,Z):(Se.havedict=1,_))};r.exports.inflateReset=e,r.exports.inflateReset2=u,r.exports.inflateResetKeep=F,r.exports.inflateInit=k,r.exports.inflateInit2=f,r.exports.inflate=C,r.exports.inflateEnd=R,r.exports.inflateGetHeader=oe,r.exports.inflateSetDictionary=ue,r.exports.inflateInfo="pako inflate (from Nodeca project)"})),fc=je(((t,r)=>{function s(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}r.exports=s})),dc=je(((t,r)=>{var s=cc(),a=Uo(),c=Lo(),l=vi(),h=Mo(),o=fc(),S=Object.prototype.toString,{Z_NO_FLUSH:D,Z_FINISH:U,Z_OK:M,Z_STREAM_END:_,Z_NEED_DICT:x,Z_STREAM_ERROR:I,Z_DATA_ERROR:H,Z_MEM_ERROR:ee}=qt();function Z(X){this.options=a.assign({chunkSize:1024*64,windowBits:15,to:""},X||{});const Q=this.options;Q.raw&&Q.windowBits>=0&&Q.windowBits<16&&(Q.windowBits=-Q.windowBits,Q.windowBits===0&&(Q.windowBits=-15)),Q.windowBits>=0&&Q.windowBits<16&&!(X&&X.windowBits)&&(Q.windowBits+=32),Q.windowBits>15&&Q.windowBits<48&&(Q.windowBits&15)===0&&(Q.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;let V=s.inflateInit2(this.strm,Q.windowBits);if(V!==M)throw new Error(l[V]);if(this.header=new o,s.inflateGetHeader(this.strm,this.header),Q.dictionary&&(typeof Q.dictionary=="string"?Q.dictionary=c.string2buf(Q.dictionary):S.call(Q.dictionary)==="[object ArrayBuffer]"&&(Q.dictionary=new Uint8Array(Q.dictionary)),Q.raw&&(V=s.inflateSetDictionary(this.strm,Q.dictionary),V!==M)))throw new Error(l[V])}Z.prototype.push=function(X,Q){const V=this.strm,te=this.options.chunkSize,J=this.options.dictionary;let G,$,ce;if(this.ended)return!1;for(Q===~~Q?$=Q:$=Q===!0?U:D,S.call(X)==="[object ArrayBuffer]"?V.input=new Uint8Array(X):V.input=X,V.next_in=0,V.avail_in=V.input.length;;){for(V.avail_out===0&&(V.output=new Uint8Array(te),V.next_out=0,V.avail_out=te),G=s.inflate(V,$),G===x&&J&&(G=s.inflateSetDictionary(V,J),G===M?G=s.inflate(V,$):G===H&&(G=x));V.avail_in>0&&G===_&&V.state.wrap>0&&X[V.next_in]!==0;)s.inflateReset(V),G=s.inflate(V,$);switch(G){case I:case H:case x:case ee:return this.onEnd(G),this.ended=!0,!1}if(ce=V.avail_out,V.next_out&&(V.avail_out===0||G===_))if(this.options.to==="string"){let se=c.utf8border(V.output,V.next_out),g=V.next_out-se,L=c.buf2string(V.output,se);V.next_out=g,V.avail_out=te-g,g&&V.output.set(V.output.subarray(se,se+g),0),this.onData(L)}else this.onData(V.output.length===V.next_out?V.output:V.output.subarray(0,V.next_out));if(!(G===M&&ce===0)){if(G===_)return G=s.inflateEnd(this.strm),this.onEnd(G),this.ended=!0,!0;if(V.avail_in===0)break}}return!0},Z.prototype.onData=function(X){this.chunks.push(X)},Z.prototype.onEnd=function(X){X===M&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=X,this.msg=this.strm.msg};function K(X,Q){const V=new Z(Q);if(V.push(X),V.err)throw V.msg||l[V.err];return V.result}function W(X,Q){return Q=Q||{},Q.raw=!0,K(X,Q)}r.exports.Inflate=Z,r.exports.inflate=K,r.exports.inflateRaw=W,r.exports.ungzip=K,r.exports.constants=qt()})),Ro=je(((t,r)=>{var{Deflate:s,deflate:a,deflateRaw:c,gzip:l}=sc(),{Inflate:h,inflate:o,inflateRaw:S,ungzip:D}=dc(),U=qt();r.exports.Deflate=s,r.exports.deflate=a,r.exports.deflateRaw=c,r.exports.gzip=l,r.exports.Inflate=h,r.exports.inflate=o,r.exports.inflateRaw=S,r.exports.ungzip=D,r.exports.constants=U})),hc=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJpeg=void 0;var r=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),s=4017,a=799,c=3406,l=2276,h=1567,o=3784,S=5793,D=2896,U=100,M=64*1024*1024,_=0;function x(Q){var V=_+Q;if(V>M){var te=Math.ceil((V-M)/1024/1024);throw new Error("Max memory limit exceeded by at least ".concat(te,"MB"))}_=V}function I(Q,V){for(var te=16;te>0&&!Q[te-1];)te--;for(var J=[{children:[],index:0}],G=0,$=J[0],ce=0;ce<te;ce++){for(var se=0;se<Q[ce];se++){for($=J.pop(),$.children[$.index]=V[G];$.index>0;){if(J.length===0)throw new Error("Could not recreate Huffman Table");$=J.pop()}for($.index++,J.push($);J.length<=ce;){var g={children:[],index:0};J.push(g),$.children[$.index]=g.children,$=g}G++}if(ce+1<te){var g={children:[],index:0};J.push(g),$.children[$.index]=g.children,$=g}}return J[0].children}function H(Q,V,te,J,G,$,ce,se,g){var L=te.mcusPerLine,j=te.progressive,ne=V,z=0,Y=0;function ve(){if(Y>0)return Y--,z>>Y&1;if(z=Q[V++],z==255){var f=Q[V++];if(f)throw new Error("unexpected marker: ".concat((z<<8|f).toString(16)))}return Y=7,z>>>7}function we(f){for(var k=f;;){if(k=k[ve()],typeof k=="number")return k;if(k===void 0)throw new Error("invalid huffman sequence")}}function _e(f){for(var k=0;f>0;)k=k<<1|ve(),f--;return k}function ie(f){var k=_e(f);return k>=1<<f-1?k:k+(-1<<f)+1}function pe(f,k){var v=we(f.huffmanTableDC),i=v===0?0:ie(v);k[0]=f.pred+=i;for(var n=1;n<64;){var w=we(f.huffmanTableAC),E=w&15,C=w>>4;if(E===0){if(C<15)break;n+=16;continue}n+=C;var R=r[n];k[R]=ie(E),n++}}function fe(f,k){var v=we(f.huffmanTableDC),i=v===0?0:ie(v)<<g;k[0]=f.pred+=i}function ge(f,k){k[0]|=ve()<<g}var ke=0;function Ee(f,k){if(ke>0){ke--;return}for(var v=$,i=ce;v<=i;){var n=we(f.huffmanTableAC),w=n&15,E=n>>4;if(w===0){if(E<15){ke=_e(E)+(1<<E)-1;break}v+=16;continue}v+=E;var C=r[v];k[C]=ie(w)*(1<<g),v++}}var Ie=0,De=0;function Ue(f,k){for(var v=$,i=ce,n=0;v<=i;){var w=r[v],E=k[w]<0?-1:1;switch(Ie){case 0:var C=we(f.huffmanTableAC),R=C&15;if(n=C>>4,R===0)n<15?(ke=_e(n)+(1<<n),Ie=4):(n=16,Ie=1);else{if(R!==1)throw new Error("invalid ACn encoding");De=ie(R),Ie=n?2:3}continue;case 1:case 2:k[w]?k[w]+=(ve()<<g)*E:(n--,n===0&&(Ie=Ie==2?3:0));break;case 3:k[w]?k[w]+=(ve()<<g)*E:(k[w]=De<<g,Ie=0);break;case 4:k[w]&&(k[w]+=(ve()<<g)*E);break}v++}Ie===4&&(ke--,ke===0&&(Ie=0))}function Ne(f,k,v,i,n){var w=v/L|0,E=v%L,C=w*f.v+i,R=E*f.h+n;f.blocks[C]!==void 0&&k(f,f.blocks[C][R])}function Me(f,k,v){var i=v/f.blocksPerLine|0,n=v%f.blocksPerLine;f.blocks[i]!==void 0&&k(f,f.blocks[i][n])}var Ce=J.length,Ge,qe;j?$===0?qe=se===0?fe:ge:qe=se===0?Ee:Ue:qe=pe;var ae=0,le;Ce==1?le=J[0].blocksPerLine*J[0].blocksPerColumn:le=L*te.mcusPerColumn,G||(G=le);for(var p,m,O;ae<le;){for(var y=0;y<Ce;y++)J[y].pred=0;if(ke=0,Ce==1){Ge=J[0];for(var F=0;F<G;F++)Me(Ge,qe,ae),ae++}else for(var F=0;F<G;F++){for(var y=0;y<Ce;y++){Ge=J[y],p=Ge.h,m=Ge.v;for(var e=0;e<m;e++)for(var u=0;u<p;u++)Ne(Ge,qe,ae,e,u)}if(ae++,ae===le)break}if(ae===le)do{if(Q[V]===255&&Q[V+1]!==0)break;V+=1}while(V<Q.length-2);if(Y=0,O=Q[V]<<8|Q[V+1],O<65280)throw new Error("marker was not found");if(O>=65488&&O<=65495)V+=2;else break}return V-ne}function ee(Q){var V=[],te=Q.blocksPerLine,J=Q.blocksPerColumn,G=te<<3,$=new Int32Array(64),ce=new Uint8Array(64);function se(_e,ie,pe){for(var fe=Q.quantizationTable,ge=pe,ke=0;ke<64;ke++)ge[ke]=_e[ke]*fe[ke];for(var ke=0;ke<8;++ke){var Ee=8*ke;if(ge[1+Ee]==0&&ge[2+Ee]==0&&ge[3+Ee]==0&&ge[4+Ee]==0&&ge[5+Ee]==0&&ge[6+Ee]==0&&ge[7+Ee]==0){var Ie=S*ge[0+Ee]+512>>10;ge[0+Ee]=Ie,ge[1+Ee]=Ie,ge[2+Ee]=Ie,ge[3+Ee]=Ie,ge[4+Ee]=Ie,ge[5+Ee]=Ie,ge[6+Ee]=Ie,ge[7+Ee]=Ie;continue}var De=S*ge[0+Ee]+128>>8,Ue=S*ge[4+Ee]+128>>8,Ne=ge[2+Ee],Me=ge[6+Ee],Ce=D*(ge[1+Ee]-ge[7+Ee])+128>>8,Ge=D*(ge[1+Ee]+ge[7+Ee])+128>>8,qe=ge[3+Ee]<<4,ae=ge[5+Ee]<<4,le=De-Ue+1>>1;De=De+Ue+1>>1,Ue=le,le=Ne*o+Me*h+128>>8,Ne=Ne*h-Me*o+128>>8,Me=le,le=Ce-ae+1>>1,Ce=Ce+ae+1>>1,ae=le,le=Ge+qe+1>>1,qe=Ge-qe+1>>1,Ge=le,le=De-Me+1>>1,De=De+Me+1>>1,Me=le,le=Ue-Ne+1>>1,Ue=Ue+Ne+1>>1,Ne=le,le=Ce*l+Ge*c+2048>>12,Ce=Ce*c-Ge*l+2048>>12,Ge=le,le=qe*a+ae*s+2048>>12,qe=qe*s-ae*a+2048>>12,ae=le,ge[0+Ee]=De+Ge,ge[7+Ee]=De-Ge,ge[1+Ee]=Ue+ae,ge[6+Ee]=Ue-ae,ge[2+Ee]=Ne+qe,ge[5+Ee]=Ne-qe,ge[3+Ee]=Me+Ce,ge[4+Ee]=Me-Ce}for(var ke=0;ke<8;++ke){var p=ke;if(ge[8+p]==0&&ge[16+p]==0&&ge[24+p]==0&&ge[32+p]==0&&ge[40+p]==0&&ge[48+p]==0&&ge[56+p]==0){var m=S*pe[ke+0]+8192>>14;ge[0+p]=m,ge[8+p]=m,ge[16+p]=m,ge[24+p]=m,ge[32+p]=m,ge[40+p]=m,ge[48+p]=m,ge[56+p]=m;continue}var De=S*ge[0+p]+2048>>12,Ue=S*ge[32+p]+2048>>12,Ne=ge[16+p],Me=ge[48+p],Ce=D*(ge[8+p]-ge[56+p])+2048>>12,Ge=D*(ge[8+p]+ge[56+p])+2048>>12,qe=ge[24+p],ae=ge[40+p],le=De-Ue+1>>1;De=De+Ue+1>>1,Ue=le,le=Ne*o+Me*h+2048>>12,Ne=Ne*h-Me*o+2048>>12,Me=le,le=Ce-ae+1>>1,Ce=Ce+ae+1>>1,ae=le,le=Ge+qe+1>>1,qe=Ge-qe+1>>1,Ge=le,le=De-Me+1>>1,De=De+Me+1>>1,Me=le,le=Ue-Ne+1>>1,Ue=Ue+Ne+1>>1,Ne=le,le=Ce*l+Ge*c+2048>>12,Ce=Ce*c-Ge*l+2048>>12,Ge=le,le=qe*a+ae*s+2048>>12,qe=qe*s-ae*a+2048>>12,ae=le,ge[0+p]=De+Ge,ge[56+p]=De-Ge,ge[8+p]=Ue+ae,ge[48+p]=Ue-ae,ge[16+p]=Ne+qe,ge[40+p]=Ne-qe,ge[24+p]=Me+Ce,ge[32+p]=Me-Ce}for(var ke=0;ke<64;++ke){var O=128+(ge[ke]+8>>4);ie[ke]=O<0?0:O>255?255:O}}x(G*J*8);for(var g=0;g<J;g++){for(var L=g<<3,j=0;j<8;j++)V.push(new Uint8Array(G));for(var ne=0;ne<te;ne++){se(Q.blocks[g][ne],ce,$);for(var z=0,Y=ne<<3,ve=0;ve<8;ve++)for(var we=V[L+ve],j=0;j<8;j++)we[Y+j]=ce[z++]}}return V}function Z(Q){return Q<0?0:Q>255?255:Q}function K(Q){var V={width:0,height:0,comments:[],adobe:void 0,components:[],exifBuffer:void 0,jfif:void 0},te=U*1e3*1e3,J=0;function G(){var ue=Q[J]<<8|Q[J+1];return J+=2,ue}function $(){var ue=G(),re=Q.subarray(J,J+ue-2);return J+=re.length,re}function ce(ue){var re=0,he=0;for(var A in ue.components)if(ue.components.hasOwnProperty(A)){var Se=ue.components[A];re<Se.h&&(re=Se.h),he<Se.v&&(he=Se.v)}var Pe=Math.ceil(ue.samplesPerLine/8/re),Te=Math.ceil(ue.scanLines/8/he);for(var A in ue.components)if(ue.components.hasOwnProperty(A)){var Se=ue.components[A],He=Math.ceil(Math.ceil(ue.samplesPerLine/8)*Se.h/re),T=Math.ceil(Math.ceil(ue.scanLines/8)*Se.v/he),d=Pe*Se.h,N=Te*Se.v,P=N*d,me=[];x(P*256);for(var be=0;be<N;be++){for(var ye=[],xe=0;xe<d;xe++)ye.push(new Int32Array(64));me.push(ye)}Se.blocksPerLine=He,Se.blocksPerColumn=T,Se.blocks=me}ue.maxH=re,ue.maxV=he,ue.mcusPerLine=Pe,ue.mcusPerColumn=Te}var se=null,g=null,L=void 0,j=0,ne=[],z=[],Y=[],ve=[],we=G(),_e=-1;if(we!=65496)throw new Error("SOI not found");for(we=G();we!=65497;){switch(we){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var ie=$();if(we===65534){for(var pe="",fe=0;fe<ie.byteLength;fe++)pe+=String.fromCharCode(ie[fe]);V.comments.push(pe)}we===65504&&ie[0]===74&&ie[1]===70&&ie[2]===73&&ie[3]===70&&ie[4]===0&&(se={version:{major:ie[5],minor:ie[6]},densityUnits:ie[7],xDensity:ie[8]<<8|ie[9],yDensity:ie[10]<<8|ie[11],thumbWidth:ie[12],thumbHeight:ie[13],thumbData:ie.subarray(14,14+3*ie[12]*ie[13])}),we===65505&&ie[0]===69&&ie[1]===120&&ie[2]===105&&ie[3]===102&&ie[4]===0&&(V.exifBuffer=ie.subarray(5,ie.length)),we===65518&&ie[0]===65&&ie[1]===100&&ie[2]===111&&ie[3]===98&&ie[4]===101&&ie[5]===0&&(g={version:ie[6],flags0:ie[7]<<8|ie[8],flags1:ie[9]<<8|ie[10],transformCode:ie[11]});break;case 65499:for(var ge=G()+J-2;J<ge;){var ke=Q[J++];x(256);var Ee=new Int32Array(64);if(ke>>4===0)for(var Ie=0;Ie<64;Ie++){var De=r[Ie];Ee[De]=Q[J++]}else if(ke>>4===1)for(var Ie=0;Ie<64;Ie++){var De=r[Ie];Ee[De]=G()}else throw new Error("DQT: invalid table spec");ne[ke&15]=Ee}break;case 65472:case 65473:case 65474:G(),L={extended:we===65473,progressive:we===65474,precision:Q[J++],scanLines:G(),samplesPerLine:G(),components:{},componentsOrder:[],maxH:0,maxV:0,mcusPerLine:0,mcusPerColumn:0};var Ue=L.scanLines*L.samplesPerLine;if(Ue>te){var Ne=Math.ceil((Ue-te)/1e6);throw new Error("maxResolutionInMP limit exceeded by ".concat(Ne,"MP"))}for(var Me=Q[J++],Ce=0;Ce<Me;Ce++){var Ge=Q[J],qe=Q[J+1]>>4,ae=Q[J+1]&15,le=Q[J+2];L.componentsOrder.push(Ge),L.components[Ge]={h:qe,v:ae,quantizationIdx:le,blocksPerColumn:0,blocksPerLine:0,blocks:[],pred:0},J+=3}ce(L),z.push(L);break;case 65476:for(var p=G(),Ce=2;Ce<p;){for(var m=Q[J++],O=new Uint8Array(16),y=0,Ie=0;Ie<16;Ie++,J++)y+=O[Ie]=Q[J];x(16+y);for(var F=new Uint8Array(y),Ie=0;Ie<y;Ie++,J++)F[Ie]=Q[J];Ce+=17+y;var e=m&15,u=m>>4===0?ve:Y;u[e]=I(O,F)}break;case 65501:G(),j=G();break;case 65500:G(),G();break;case 65498:G();for(var f=Q[J++],k=[],Ce=0;Ce<f;Ce++){var v=L.components[Q[J++]],i=Q[J++];v.huffmanTableDC=ve[i>>4],v.huffmanTableAC=Y[i&15],k.push(v)}var n=Q[J++],w=Q[J++],E=Q[J++],C=H(Q,J,L,k,j,n,w,E>>4,E&15);J+=C;break;case 65535:Q[J]!==255&&J--;break;default:if(Q[J-3]==255&&Q[J-2]>=192&&Q[J-2]<=254){J-=3;break}else if(we===224||we==225){if(_e!==-1)throw new Error("first unknown JPEG marker at offset ".concat(_e.toString(16),", second unknown JPEG marker ").concat(we.toString(16)," at offset ").concat((J-1).toString(16)));_e=J-1;var R=G();if(Q[J+R-2]===255){J+=R-2;break}}throw new Error("unknown JPEG marker "+we.toString(16))}we=G()}if(z.length!=1)throw new Error("only single frame JPEGs supported");for(var Ce=0;Ce<z.length;Ce++){var oe=z[Ce].components;for(var Ie in oe)oe[Ie].quantizationTable=ne[oe[Ie].quantizationIdx],delete oe[Ie].quantizationIdx}V.width=L.samplesPerLine,V.height=L.scanLines,V.jfif=se,V.adobe=g,V.components=[];for(var Ce=0;Ce<L.componentsOrder.length;Ce++){var v=L.components[L.componentsOrder[Ce]];V.components.push({lines:ee(v),scaleX:v.h/L.maxH,scaleY:v.v/L.maxV})}return V}function W(Q){var V=0,te=!1,J=Q.width,G=Q.height,$=J*G*Q.components.length;x($);var ce=new Uint8Array($);switch(Q.components.length){case 1:for(var ge=Q.components[0],se=0;se<G;se++)for(var g=ge.lines[0|se*ge.scaleY],L=0;L<J;L++){var j=g[0|L*ge.scaleX];ce[V++]=j}break;case 2:for(var ge=Q.components[0],ke=Q.components[1],se=0;se<G;se++)for(var g=ge.lines[0|se*ge.scaleY],ne=ke.lines[0|se*ke.scaleY],L=0;L<J;L++){var z=g[0|L*ge.scaleX];ce[V++]=z;var Y=ne[0|L*ke.scaleX];ce[V++]=Y}break;case 3:te=!0,Q.adobe&&Q.adobe.transformCode&&(te=!0);for(var ge=Q.components[0],ke=Q.components[1],Ee=Q.components[2],se=0;se<G;se++)for(var g=ge.lines[0|se*ge.scaleY],ne=ke.lines[0|se*ke.scaleY],ve=Ee.lines[0|se*Ee.scaleY],L=0;L<J;L++){var j=void 0,we=void 0,_e=void 0,ie=void 0,pe=void 0,fe=void 0;te?(j=g[0|L*ge.scaleX],we=ne[0|L*ke.scaleX],_e=ve[0|L*Ee.scaleX],ie=Z(j+1.402*(_e-128)),pe=Z(j-.3441363*(we-128)-.71413636*(_e-128)),fe=Z(j+1.772*(we-128))):(ie=g[0|L*ge.scaleX],pe=ne[0|L*ke.scaleX],fe=ve[0|L*Ee.scaleX]),ce[V++]=ie,ce[V++]=pe,ce[V++]=fe}break;case 4:if(!Q.adobe)throw new Error("Unsupported color mode (4 components)");te=!1,Q.adobe&&Q.adobe.transformCode&&(te=!0);for(var ge=Q.components[0],ke=Q.components[1],Ee=Q.components[2],Ie=Q.components[3],se=0;se<G;se++)for(var g=ge.lines[0|se*ge.scaleY],ne=ke.lines[0|se*ke.scaleY],ve=Ee.lines[0|se*Ee.scaleY],De=Ie.lines[0|se*Ie.scaleY],L=0;L<J;L++){var j=void 0,we=void 0,_e=void 0,Ue=void 0,Ne=void 0,Me=void 0,Ce=void 0;te?(j=g[0|L*ge.scaleX],we=ne[0|L*ke.scaleX],_e=ve[0|L*Ee.scaleX],Ue=De[0|L*Ie.scaleX],Ne=255-Z(j+1.402*(_e-128)),Me=255-Z(j-.3441363*(we-128)-.71413636*(_e-128)),Ce=255-Z(j+1.772*(we-128))):(Ne=g[0|L*ge.scaleX],Me=ne[0|L*ke.scaleX],Ce=ve[0|L*Ee.scaleX],Ue=De[0|L*Ie.scaleX]),ce[V++]=255-Ne,ce[V++]=255-Me,ce[V++]=255-Ce,ce[V++]=255-Ue}break;default:throw new Error("Unsupported color mode")}return ce}function X(Q,V){if(_=0,Q.length===0)throw new Error("Empty jpeg buffer");var te=K(Q);x(te.width*te.height*4);var J=W(te),G=V(te.width,te.height),$=G.width,ce=G.height,se=G.data,g=0,L=0;switch(te.components.length){case 1:for(var j=0;j<ce;j++)for(var ne=0;ne<$;ne++){var z=J[g++];se[L++]=z,se[L++]=z,se[L++]=z,se[L++]=255}break;case 3:for(var j=0;j<ce;j++)for(var ne=0;ne<$;ne++){var Y=J[g++],ve=J[g++],we=J[g++];se[L++]=Y,se[L++]=ve,se[L++]=we,se[L++]=255}break;case 4:for(var j=0;j<ce;j++)for(var ne=0;ne<$;ne++){var _e=J[g++],ie=J[g++],z=J[g++],pe=J[g++],Y=255-Z(_e*(1-pe/255)+pe),ve=255-Z(ie*(1-pe/255)+pe),we=255-Z(z*(1-pe/255)+pe);se[L++]=Y,se[L++]=ve,se[L++]=we,se[L++]=255}break;default:throw new Error("Unsupported color mode")}return G}t.decodeJpeg=X})),Wt=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.initializeCanvas=t.createImageData=t.createCanvas=t.createCanvasFromData=t.writeDataZipWithoutPrediction=t.writeDataRLE=t.writeDataRaw=t.decodeBitmap=t.imageDataToCanvas=t.resetImageData=t.hasAlpha=t.clamp=t.offsetForChannel=t.MaskParams=t.LayerMaskFlags=t.ColorSpace=t.createEnum=t.revMap=t.largeAdditionalInfoKeys=t.layerColors=t.toBlendMode=t.fromBlendMode=t.RAW_IMAGE_DATA=t.MOCK_HANDLERS=void 0;var r=Ro(),s=hc();t.MOCK_HANDLERS=!1,t.RAW_IMAGE_DATA=!1,t.fromBlendMode={},t.toBlendMode={pass:"pass through",norm:"normal",diss:"dissolve",dark:"darken","mul ":"multiply",idiv:"color burn",lbrn:"linear burn",dkCl:"darker color",lite:"lighten",scrn:"screen","div ":"color dodge",lddg:"linear dodge",lgCl:"lighter color",over:"overlay",sLit:"soft light",hLit:"hard light",vLit:"vivid light",lLit:"linear light",pLit:"pin light",hMix:"hard mix",diff:"difference",smud:"exclusion",fsub:"subtract",fdiv:"divide","hue ":"hue","sat ":"saturation",colr:"color","lum ":"luminosity"},Object.keys(t.toBlendMode).forEach(function(W){return t.fromBlendMode[t.toBlendMode[W]]=W}),t.layerColors=["none","red","orange","yellow","green","blue","violet","gray"],t.largeAdditionalInfoKeys=["LMsk","Lr16","Lr32","Layr","Mt16","Mt32","Mtrn","Alph","FMsk","lnk2","FEid","FXid","PxSD","cinf"];function a(W){var X={};return Object.keys(W).forEach(function(Q){return X[W[Q]]=Q}),X}t.revMap=a;function c(W,X,Q){var V=a(Q),te=function(G){var $=G.split(".")[1];if($&&!V[$])throw new Error("Unrecognized value for enum: '".concat(G,"'"));return V[$]||X},J=function(G){if(G&&!Q[G])throw new Error("Invalid value for enum: '".concat(G,"'"));return"".concat(W,".").concat(Q[G]||Q[X])};return{decode:te,encode:J}}t.createEnum=c,(function(W){W[W.RGB=0]="RGB",W[W.HSB=1]="HSB",W[W.CMYK=2]="CMYK",W[W.Lab=7]="Lab",W[W.Grayscale=8]="Grayscale"})(t.ColorSpace||(t.ColorSpace={})),(function(W){W[W.PositionRelativeToLayer=1]="PositionRelativeToLayer",W[W.LayerMaskDisabled=2]="LayerMaskDisabled",W[W.InvertLayerMaskWhenBlending=4]="InvertLayerMaskWhenBlending",W[W.LayerMaskFromRenderingOtherData=8]="LayerMaskFromRenderingOtherData",W[W.MaskHasParametersAppliedToIt=16]="MaskHasParametersAppliedToIt"})(t.LayerMaskFlags||(t.LayerMaskFlags={})),(function(W){W[W.UserMaskDensity=1]="UserMaskDensity",W[W.UserMaskFeather=2]="UserMaskFeather",W[W.VectorMaskDensity=4]="VectorMaskDensity",W[W.VectorMaskFeather=8]="VectorMaskFeather"})(t.MaskParams||(t.MaskParams={}));function l(W,X){switch(W){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return X?3:W+1;case-1:return X?4:3;default:return W+1}}t.offsetForChannel=l;function h(W,X,Q){return W<X?X:W>Q?Q:W}t.clamp=h;function o(W){for(var X=W.width*W.height*4,Q=3;Q<X;Q+=4)if(W.data[Q]!==255)return!0;return!1}t.hasAlpha=o;function S(W){for(var X=W.data,Q=X instanceof Float32Array?1:X instanceof Uint16Array?65535:255,V=0,te=X.length|0;V<te;V=V+4|0)X[V+0]=0,X[V+1]=0,X[V+2]=0,X[V+3]=Q}t.resetImageData=S;function D(W){var X=(0,t.createCanvas)(W.width,W.height),Q;if(W.data instanceof Uint8ClampedArray)Q=W;else{Q=(0,t.createImageData)(W.width,W.height);var V=W.data,te=Q.data;if(V instanceof Float32Array)for(var J=0,G=V.length;J<G;J+=4)te[J+0]=Math.round(Math.pow(V[J+0],1/2.2)*255),te[J+1]=Math.round(Math.pow(V[J+1],1/2.2)*255),te[J+2]=Math.round(Math.pow(V[J+2],1/2.2)*255),te[J+3]=Math.round(V[J+3]*255);else for(var $=V instanceof Uint16Array?8:0,J=0,G=V.length;J<G;J++)te[J]=V[J]>>>$}return X.getContext("2d").putImageData(Q,0,0),X}t.imageDataToCanvas=D;function U(W,X,Q,V){if(!(W instanceof Uint8Array||W instanceof Uint8ClampedArray))throw new Error("Invalid bit depth");for(var te=0,J=0,G=0;te<V;te++)for(var $=0;$<Q;)for(var ce=W[G++],se=0;se<8&&$<Q;se++,$++,J+=4){var g=ce&128?0:255;ce=ce<<1,X[J+0]=g,X[J+1]=g,X[J+2]=g,X[J+3]=255}}t.decodeBitmap=U;function M(W,X,Q,V){if(!(!Q||!V)){for(var te=new Uint8Array(Q*V),J=0;J<te.length;J++)te[J]=W.data[J*4+X];return te}}t.writeDataRaw=M;function _(W,X,Q,V){var te=X.data,J=X.width,G=X.height;if(!(!J||!G)){for(var $=4*J|0,ce=0,se=Q.length*(V?4:2)*G|0,g=0,L=Q;g<L.length;g++)for(var j=L[g],ne=0,z=j|0;ne<G;ne++){var Y=ne*$|0,ve=Y+$|0,we=ve+j-4|0,_e=we-4|0,ie=se;for(z=Y+j|0;z<ve;z=z+4|0)if(z<_e){var pe=te[z];z=z+4|0;var fe=te[z];z=z+4|0;var ge=te[z];if(pe===fe&&pe===ge){for(var ke=3;ke<128&&z<we&&te[z+4|0]===pe;)ke=ke+1|0,z=z+4|0;W[se++]=1-ke,W[se++]=pe}else{var Ee=se,Ie=!0,ke=1;for(W[se++]=0,W[se++]=pe;z<we&&ke<128;)if(z=z+4|0,pe=fe,fe=ge,ge=te[z],pe===fe&&pe===ge){z=z-12|0,Ie=!1;break}else ke++,W[se++]=pe;Ie&&(ke<127?(W[se++]=fe,W[se++]=ge,ke+=2):ke<128?(W[se++]=fe,ke++,z=z-4|0):z=z-8|0),W[Ee]=ke-1}}else z===we?(W[se++]=0,W[se++]=te[z]):(W[se++]=1,W[se++]=te[z],z=z+4|0,W[se++]=te[z]);var De=se-ie;V&&(W[ce++]=De>>24&255,W[ce++]=De>>16&255),W[ce++]=De>>8&255,W[ce++]=De&255}return W.slice(0,se)}}t.writeDataRLE=_;function x(W,X){for(var Q=W.data,V=W.width*W.height,te=new Uint8Array(V),J=[],G=0,$=0,ce=X;$<ce.length;$++){for(var se=ce[$],g=0,L=se;g<V;g++,L+=4)te[g]=Q[L];var j=(0,r.deflate)(te);J.push(j),G+=j.byteLength}if(J.length>0){for(var j=new Uint8Array(G),se=0,ne=0,z=J;ne<z.length;ne++){var Y=z[ne];j.set(Y,se),se+=Y.byteLength}return j}else return J[0]}t.writeDataZipWithoutPrediction=x;function I(W){var X=(0,t.createCanvas)(100,100);try{var Q=X.getContext("2d"),V=(0,s.decodeJpeg)(W,function(te,J){return Q.createImageData(te,J)});X.width=V.width,X.height=V.height,Q.putImageData(V,0,0)}catch(te){console.error("JPEG decompression error",te.message)}return X}t.createCanvasFromData=I;var H=function(){throw new Error("Canvas not initialized, use initializeCanvas method to set up createCanvas method")};t.createCanvas=H;var ee=void 0,Z=function(W,X){return ee||(ee=(0,t.createCanvas)(1,1)),ee.getContext("2d").createImageData(W,X)};t.createImageData=Z,typeof document<"u"&&(t.createCanvas=function(W,X){var Q=document.createElement("canvas");return Q.width=W,Q.height=X,Q});function K(W,X){t.createCanvas=W,t.createImageData=X||t.createImageData}t.initializeCanvas=K})),pc=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeString=t.encodeString=t.encodeStringTo=t.stringLengthInBytes=void 0;function r(S){return(S&4294967168)===0?1:(S&4294965248)===0?2:(S&4294901760)===0?3:4}function s(S){for(var D=0,U=0;U<S.length;U++){var M=S.charCodeAt(U);if(M>=55296&&M<=56319){if(U+1<S.length){var _=S.charCodeAt(U+1);(_&64512)===56320&&(U++,D+=r(((M&1023)<<10)+(_&1023)+65536))}}else D+=r(M)}return D}t.stringLengthInBytes=s;function a(S,D,U){var M=r(U);switch(M){case 1:S[D]=U;break;case 2:S[D]=U>>6&31|192,S[D+1]=U&63|128;break;case 3:S[D]=U>>12&15|224,S[D+1]=U>>6&63|128,S[D+2]=U&63|128;break;default:S[D]=U>>18&7|240,S[D+1]=U>>12&63|128,S[D+2]=U>>6&63|128,S[D+3]=U&63|128;break}return M}function c(S,D,U){for(var M=0;M<U.length;M++){var _=U.charCodeAt(M);if(_>=55296&&_<=56319){if(M+1<U.length){var x=U.charCodeAt(M+1);if((x&64512)===56320){M++;var I=((_&1023)<<10)+(x&1023)+65536;D+=a(S,D,I)}}}else D+=a(S,D,_)}return D}t.encodeStringTo=c;function l(S){if(S.length>1e3&&typeof TextEncoder<"u")return new TextEncoder().encode(S);var D=new Uint8Array(s(S));return c(D,0,S),D}t.encodeString=l;function h(S,D){if(D>=S.length)throw Error("Invalid byte index");var U=S[D];if((U&192)===128)return U&63;throw Error("Invalid continuation byte")}function o(S){if(S.byteLength>1e3&&typeof TextDecoder<"u")return new TextDecoder().decode(S);for(var D=[],U=0;U<S.length;){var M=S[U++],_=void 0;if((M&128)===0)_=M;else if((M&224)===192){var x=h(S,U++);if(_=(M&31)<<6|x,_<128)throw Error("Invalid continuation byte")}else if((M&240)===224){var x=h(S,U++),I=h(S,U++);if(_=(M&15)<<12|x<<6|I,_<2048)throw Error("Invalid continuation byte");if(_>=55296&&_<=57343)throw Error("Lone surrogate U+".concat(_.toString(16).toUpperCase()," is not a scalar value"))}else if((M&248)===240){var x=h(S,U++),I=h(S,U++),H=h(S,U++);if(_=(M&15)<<18|x<<12|I<<6|H,_<65536||_>1114111)throw Error("Invalid continuation byte")}else throw Error("Invalid UTF-8 detected");_>65535&&(_-=65536,D.push(String.fromCharCode(_>>>10&1023|55296)),_=56320|_&1023),D.push(String.fromCharCode(_))}return D.join("")}t.decodeString=o})),mi=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(T){for(var d,N=1,P=arguments.length;N<P;N++){d=arguments[N];for(var me in d)Object.prototype.hasOwnProperty.call(d,me)&&(T[me]=d[me])}return T},r.apply(this,arguments)},s=t&&t.__rest||function(T,d){var N={};for(var P in T)Object.prototype.hasOwnProperty.call(T,P)&&d.indexOf(P)<0&&(N[P]=T[P]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function")for(var me=0,P=Object.getOwnPropertySymbols(T);me<P.length;me++)d.indexOf(P[me])<0&&Object.prototype.propertyIsEnumerable.call(T,P[me])&&(N[P[me]]=T[P[me]]);return N};Object.defineProperty(t,"__esModule",{value:!0}),t.ESliceOrigin=t.ESliceVertAlign=t.ESliceHorzAlign=t.ESliceType=t.FrFl=t.FStl=t.ClrS=t.gradientInterpolationMethodType=t.stdTrackID=t.animInterpStyleEnum=t.GrdT=t.IGSr=t.BETE=t.BESs=t.bvlT=t.BESl=t.BlnM=t.warpStyle=t.Annt=t.Ornt=t.textGridding=t.frac=t.unitsValue=t.unitsPercentF=t.unitsPercent=t.unitsAngle=t.parseUnitsToNumber=t.parseUnitsOrNumber=t.parseUnits=t.parsePercentOrAngle=t.parsePercent=t.parseAngle=t.serializeColor=t.parseColor=t.serializeVectorContent=t.parseVectorContent=t.serializeTrackList=t.parseTrackList=t.parseEffects=t.serializeEffects=t.boundsToDescBounds=t.descBoundsToBounds=t.xyToHorzVrtc=t.horzVrtcToXY=t.writeVersionAndDescriptor=t.readVersionAndDescriptor=t.writeDescriptorStructure=t.readDescriptorStructure=t.readAsciiStringOrClassId=t.setLogErrors=void 0,t.presetKindType=t.prjM=t.FlMd=t.IntC=t.IntE=t.Drct=t.WndM=t.CntE=t.FlCl=t.ExtR=t.ExtT=t.DfsM=t.blurType=t.Lns=t.MztT=t.Chnl=t.Dstr=t.ZZTy=t.Wvtp=t.SphM=t.RplS=t.Cnvr=t.UndA=t.DspM=t.SmBQ=t.SmBM=t.BlrQ=t.BlrM=t.strokeStyleLineAlignment=t.strokeStyleLineJoinType=t.strokeStyleLineCapType=t.ESliceBGColorType=void 0;var a=Wt(),c=$t(),l=Pr();function h(T){var d={};return Object.keys(T).forEach(function(N){return d[T[N]]=N}),d}var o={"#Ang":"Angle","#Rsl":"Density","#Rlt":"Distance","#Nne":"None","#Prc":"Percent","#Pxl":"Pixels","#Mlm":"Millimeters","#Pnt":"Points",RrPi:"Picas",RrIn:"Inches",RrCm:"Centimeters"},S=h(o),D=!1;function U(T){D=T}t.setLogErrors=U;function M(T,d){return{name:T,classID:d}}for(var _=M("","null"),x=!1,I={strokeStyleContent:M("","solidColorLayer"),printProofSetup:M(x?"校样设置":"Proof Setup","proofSetup"),Grad:M(x?"渐变":"Gradient","Grdn"),Trnf:M(x?"变换":"Transform","Trnf"),patternFill:M("","patternFill"),ebbl:M("","ebbl"),SoFi:M("","SoFi"),GrFl:M("","GrFl"),sdwC:M("","RGBC"),hglC:M("","RGBC"),"Clr ":M("","RGBC"),tintColor:M("","RGBC"),Ofst:M("","Pnt "),ChFX:M("","ChFX"),MpgS:M("","ShpC"),DrSh:M("","DrSh"),IrSh:M("","IrSh"),OrGl:M("","OrGl"),IrGl:M("","IrGl"),TrnS:M("","ShpC"),Ptrn:M("","Ptrn"),FrFX:M("","FrFX"),phase:M("","Pnt "),frameStep:_,duration:_,workInTime:_,workOutTime:_,audioClipGroupList:_,bounds:M("","Rctn"),customEnvelopeWarp:M("","customEnvelopeWarp"),warp:M("","warp"),"Sz ":M("","Pnt "),origin:M("","Pnt "),autoExpandOffset:M("","Pnt "),keyOriginShapeBBox:M("","unitRect"),Vrsn:_,psVersion:_,docDefaultNewArtboardBackgroundColor:M("","RGBC"),artboardRect:M("","classFloatRect"),keyOriginRRectRadii:M("","radii"),keyOriginBoxCorners:_,rectangleCornerA:M("","Pnt "),rectangleCornerB:M("","Pnt "),rectangleCornerC:M("","Pnt "),rectangleCornerD:M("","Pnt "),compInfo:_,quiltWarp:M("","quiltWarp"),generatorSettings:_,crema:_,FrIn:_,blendOptions:_,FXRf:_,Lefx:_,time:_,animKey:_,timeScope:_,inTime:_,outTime:_,sheetStyle:_,translation:_,Skew:_,boundingBox:M("","boundingBox"),"Lnk ":M("","ExternalFileLink"),frameReader:M("","FrameReader"),effectParams:M("","motionTrackEffectParams"),Impr:M("None","none"),Anch:M("","Pnt "),"Fwd ":M("","Pnt "),"Bwd ":M("","Pnt "),FlrC:M("","Pnt "),meshBoundaryPath:M("","pathClass"),filterFX:M("","filterFXStyle"),Fltr:M("","rigidTransform"),FrgC:M("","RGBC"),BckC:M("","RGBC"),sdwM:M("Parameters","adaptCorrectTones"),hglM:M("Parameters","adaptCorrectTones"),customShape:M("","customShape"),origFXRefPoint:_,FXRefPoint:_,ClMg:M("","ClMg")},H={"Crv ":M("","CrPt"),Clrs:M("","Clrt"),Trns:M("","TrnS"),keyDescriptorList:_,solidFillMulti:M("","SoFi"),gradientFillMulti:M("","GrFl"),dropShadowMulti:M("","DrSh"),innerShadowMulti:M("","IrSh"),frameFXMulti:M("","FrFX"),FrIn:_,FSts:_,LaSt:_,sheetTimelineOptions:_,trackList:M("","animationTrack"),globalTrackList:M("","animationTrack"),keyList:_,audioClipGroupList:_,audioClipList:_,countObjectList:M("","countObject"),countGroupList:M("","countGroup"),slices:M("","slice"),"Pts ":M("","Pthp"),SbpL:M("","SbpL"),pathComponents:M("","PaCm"),filterFXList:M("","filterFX"),puppetShapeList:M("","puppetShape"),channelDenoise:M("","channelDenoiseParams"),ShrP:M("","Pnt "),layerSettings:_,list:_,Adjs:M("","CrvA")},ee={TEXT:["Txt ","printerName","Nm ","Idnt","blackAndWhitePresetFileName","LUT3DFileName","presetFileName","curvesPresetFileName","mixerPresetFileName","placed","description","reason","artboardPresetName","json","clipID","relPath","fullPath","mediaDescriptor","Msge","altTag","url","cellText","preset","KnNm","FPth","comment","originalPath"],tdta:["EngineData","LUT3DFileData","indexArray","originalVertexArray","deformedVertexArray","LqMe"],long:["TextIndex","RndS","Mdpn","Smth","Lctn","strokeStyleVersion","LaID","Vrsn","Cnt ","Brgh","Cntr","means","vibrance","Strt","bwPresetKind","comp","compID","originalCompID","curvesPresetKind","mixerPresetKind","uOrder","vOrder","PgNm","totalPages","Crop","numerator","denominator","frameCount","Annt","keyOriginType","unitValueQuadVersion","keyOriginIndex","major","minor","fix","docDefaultNewArtboardBackgroundType","artboardBackgroundType","numModifyingFX","deformNumRows","deformNumCols","FrID","FrDl","FsID","LCnt","AFrm","AFSt","numBefore","numAfter","Spcn","minOpacity","maxOpacity","BlnM","sheetID","gblA","globalAltitude","descVersion","frameReaderType","LyrI","zoomOrigin","fontSize","Rds ","sliceID","topOutset","leftOutset","bottomOutset","rightOutset","filterID","meshQuality","meshExpansion","meshRigidity","VrsM","VrsN","NmbG","WLMn","WLMx","AmMn","AmMx","SclH","SclV","Lvl ","TlNm","TlOf","FlRs","Thsh","ShrS","ShrE","FlRs","Vrnc","Strg","ExtS","ExtD","HrzS","VrtS","NmbR","EdgF","Ang1","Ang2","Ang3","Ang4","lastAppliedComp","capturedInfo"],enum:["textGridding","Ornt","warpStyle","warpRotate","Inte","Bltn","ClrS","BlrQ","bvlT","bvlS","bvlD","Md ","glwS","GrdF","GlwT","RplS","BlrM","SmBM","strokeStyleLineCapType","strokeStyleLineJoinType","strokeStyleLineAlignment","strokeStyleBlendMode","PntT","Styl","lookupType","LUTFormat","dataOrder","tableOrder","enableCompCore","enableCompCoreGPU","compCoreSupport","compCoreGPUSupport","Engn","enableCompCoreThreads","gs99","FrDs","trackID","animInterpStyle","horzAlign","vertAlign","bgColorType","shapeOperation","UndA","Wvtp","Drct","WndM","Edg ","FlCl","IntE","IntC","Cnvr","Fl ","Dstr","MztT","Lns ","ExtT","DspM","ExtR","ZZTy","SphM","SmBQ","placedLayerOCIOConversion","gradientsInterpolationMethod"],bool:["PstS","printSixteenBit","masterFXSwitch","enab","uglg","antialiasGloss","useShape","useTexture","uglg","antialiasGloss","useShape","Vsbl","useTexture","Algn","Rvrs","Dthr","Invr","VctC","ShTr","layerConceals","strokeEnabled","fillEnabled","strokeStyleScaleLock","strokeStyleStrokeAdjust","hardProof","MpBl","paperWhite","useLegacy","Auto","Lab ","useTint","keyShapeInvalidated","autoExpandEnabled","autoNestEnabled","autoPositionEnabled","shrinkwrapOnSaveEnabled","present","showInDialog","overprint","sheetDisclosed","lightsDisclosed","meshesDisclosed","materialsDisclosed","hasMotion","muted","Effc","selected","autoScope","fillCanvas","cellTextIsHTML","Smoo","Clsp","validAtPosition","rigidType","hasoptions","filterMaskEnable","filterMaskLinked","filterMaskExtendWithWhite","removeJPEGArtifact","Mnch","ExtF","ExtM","moreAccurate","GpuY","LIWy","Cnty"],doub:["warpValue","warpPerspective","warpPerspectiveOther","Intr","Wdth","Hght","strokeStyleMiterLimit","strokeStyleResolution","layerTime","keyOriginResolution","xx","xy","yx","yy","tx","ty","FrGA","frameRate","audioLevel","rotation","X ","Y ","redFloat","greenFloat","blueFloat","imageResolution","PuX0","PuX1","PuX2","PuX3","PuY0","PuY1","PuY2","PuY3"],UntF:["sdwO","hglO","lagl","Lald","srgR","blur","Sftn","Opct","Dstn","Angl","Ckmt","Nose","Inpr","ShdN","strokeStyleLineWidth","strokeStyleLineDashOffset","strokeStyleOpacity","H ","Top ","Left","Btom","Rght","Rslt","topRight","topLeft","bottomLeft","bottomRight","ClNs","Shrp"],VlLs:["Crv ","Clrs","Mnm ","Mxm ","Trns","pathList","strokeStyleLineDashSet","FrLs","slices","LaSt","Trnf","nonAffineTransform","keyDescriptorList","guideIndeces","gradientFillMulti","solidFillMulti","frameFXMulti","innerShadowMulti","dropShadowMulti","FrIn","FSts","FsFr","sheetTimelineOptions","audioClipList","trackList","globalTrackList","keyList","audioClipList","warpValues","selectedPin","Pts ","SbpL","pathComponents","pinOffsets","posFinalPins","pinVertexIndices","PinP","PnRt","PnOv","PnDp","filterFXList","puppetShapeList","ShrP","channelDenoise","Mtrx","layerSettings","list","compList","Adjs"],ObAr:["meshPoints","quiltSliceX","quiltSliceY"],"obj ":["null","Chnl"],"Pth ":["DspF"]},Z=["Rd ","Grn ","Bl ","Yllw","Ylw ","Cyn ","Mgnt","Blck","Gry ","Lmnc","A ","B "],K={"Mnm ":"long","Mxm ":"long",FrLs:"long",strokeStyleLineDashSet:"UntF",Trnf:"doub",nonAffineTransform:"doub",keyDescriptorList:"Objc",gradientFillMulti:"Objc",solidFillMulti:"Objc",frameFXMulti:"Objc",innerShadowMulti:"Objc",dropShadowMulti:"Objc",LaSt:"Objc",FrIn:"Objc",FSts:"Objc",FsFr:"long",blendOptions:"Objc",sheetTimelineOptions:"Objc",keyList:"Objc",warpValues:"doub",selectedPin:"long","Pts ":"Objc",SbpL:"Objc",pathComponents:"Objc",pinOffsets:"doub",posFinalPins:"doub",pinVertexIndices:"long",PinP:"doub",PnRt:"long",PnOv:"bool",PnDp:"doub",filterFXList:"Objc",puppetShapeList:"Objc",ShrP:"Objc",channelDenoise:"Objc",Mtrx:"long",compList:"long",Chnl:"enum"},W={},X=0,Q=Object.keys(ee);X<Q.length;X++)for(var V=Q[X],te=0,J=ee[V];te<J.length;te++){var G=J[te];W[G]=V}for(var $=0,ce=Object.keys(I);$<ce.length;$++){var G=ce[$];W[G]||(W[G]="Objc")}for(var se=0,g=Object.keys(H);se<g.length;se++){var G=g[se];K[G]="Objc"}function L(T,d,N,P){return T==="presetKind"?typeof d=="string"?"enum":"long":T==="null"&&N==="slices"?"TEXT":T==="groupID"?N==="slices"?"long":"TEXT":T==="Sz "?"Wdth"in d?"Objc":"units"in d?"UntF":"doub":T==="Type"?typeof d=="string"?"enum":"long":T==="AntA"?typeof d=="string"?"enum":"bool":(T==="Hrzn"||T==="Vrtc")&&(P.Type==="keyType.Pstn"||P._classID==="Ofst")?"long":T==="Hrzn"||T==="Vrtc"||T==="Top "||T==="Left"||T==="Btom"||T==="Rght"?N==="slices"?"long":typeof d=="number"?"doub":"UntF":T==="Vrsn"?typeof d=="number"?"long":"Objc":T==="Rd "||T==="Grn "||T==="Bl "?N==="artd"?"long":"doub":T==="Trnf"?Array.isArray(d)?"VlLs":"Objc":W[T]}function j(T){var d=(0,c.readInt32)(T);return(0,c.readAsciiString)(T,d||4)}t.readAsciiStringOrClassId=j;function ne(T,d){if(d.length===4&&d!=="warp"&&d!=="time"&&d!=="hold"&&d!=="list")(0,l.writeInt32)(T,0),(0,l.writeSignature)(T,d);else{(0,l.writeInt32)(T,d.length);for(var N=0;N<d.length;N++)(0,l.writeUint8)(T,d.charCodeAt(N))}}function z(T,d){for(var N=fe(T),P=d?{_name:N.name,_classID:N.classID}:{},me=(0,c.readUint32)(T),be=0;be<me;be++){var ye=j(T);P[ye]=ve(T,(0,c.readSignature)(T),d)}return P}t.readDescriptorStructure=z;function Y(T,d,N,P,me){D&&!N&&console.log("Missing classId for: ",d,N,P),(0,l.writeUnicodeStringWithPadding)(T,d),ne(T,N);var be=Object.keys(P),ye=be.length;"_name"in P&&ye--,"_classID"in P&&ye--,(0,l.writeUint32)(T,ye);for(var xe=0,Re=be;xe<Re.length;xe++){var Be=Re[xe];if(!(Be==="_name"||Be==="_classID")){var Le=L(Be,P[Be],me,P),$e=I[Be];Be==="bounds"&&me==="text"?$e=M("","bounds"):Be==="origin"?Le=me==="slices"?"enum":"Objc":(Be==="Cyn "||Be==="Mgnt"||Be==="Ylw "||Be==="Blck")&&P._classID==="CMYC"?Le="doub":/^PN[a-z][a-z]$/.test(Be)?Le="TEXT":/^PT[a-z][a-z]$/.test(Be)?Le="long":/^PF[a-z][a-z]$/.test(Be)||(Be==="Rds "||Be==="Thsh")&&typeof P[Be]=="number"&&P._classID==="SmrB"?Le="doub":Be==="ClSz"||Be==="Rds "||Be==="Amnt"?Le=typeof P[Be]=="number"?"long":"UntF":(Be==="sdwM"||Be==="hglM")&&typeof P[Be]=="string"||Be==="blur"&&typeof P[Be]=="string"?Le="enum":Be==="Hght"&&typeof P[Be]=="number"&&P._classID==="Embs"||Be==="Angl"&&typeof P[Be]=="number"&&(P._classID==="Embs"||P._classID==="smartSharpen"||P._classID==="Twrl"||P._classID==="MtnB")?Le="long":Be==="Angl"&&typeof P[Be]=="number"?Le="doub":Be==="bounds"&&me==="slices"?(Le="Objc",$e=M("","Rct1")):Be==="Scl "?typeof P[Be]=="object"&&"Hrzn"in P[Be]?(Le="Objc",$e=_):typeof P[Be]=="number"?Le="long":Le="UntF":Be==="audioClipGroupList"&&be.length===1?Le="VlLs":(Be==="Strt"||Be==="Brgh")&&"H "in P?Le="doub":Be==="Wdth"&&typeof P[Be]=="object"?Le="UntF":Be==="Ofst"&&typeof P[Be]=="number"?Le="long":Be==="Strt"&&typeof P[Be]=="object"?(Le="Objc",$e=_):Z.indexOf(Be)!==-1?Le=N==="RGBC"&&me!=="artd"?"doub":"long":Be==="profile"?Le=N==="printOutput"?"TEXT":"tdta":Be==="strokeStyleContent"?P[Be]["Clr "]?$e=M("","solidColorLayer"):P[Be].Grad?$e=M("","gradientLayer"):P[Be].Ptrn?$e=M("","patternLayer"):D&&console.log("Invalid strokeStyleContent value",P[Be]):Be==="bounds"&&me==="quiltWarp"&&($e=M("","classFloatRect")),$e&&$e.classID==="RGBC"&&"H "in P[Be]&&($e={classID:"HSBC",name:""}),ne(T,Be),(0,l.writeSignature)(T,Le||"long"),_e(T,Le||"long",P[Be],Be,$e,me),D&&!Le&&console.log("Missing descriptor field type for: '".concat(Be,"' in"),P)}}}t.writeDescriptorStructure=Y;function ve(T,d,N){switch(d){case"obj ":return ie(T);case"Objc":case"GlbO":return z(T,N);case"VlLs":for(var P=(0,c.readInt32)(T),Ke=[],me=0;me<P;me++){var be=(0,c.readSignature)(T);Ke.push(ve(T,be,N))}return Ke;case"doub":return(0,c.readFloat64)(T);case"UntF":var ye=(0,c.readSignature)(T),Re=(0,c.readFloat64)(T);if(!o[ye])throw new Error("Invalid units: ".concat(ye));return{units:o[ye],value:Re};case"UnFl":var ye=(0,c.readSignature)(T),Re=(0,c.readFloat32)(T);if(!o[ye])throw new Error("Invalid units: ".concat(ye));return{units:o[ye],value:Re};case"TEXT":return(0,c.readUnicodeString)(T);case"enum":var xe=j(T),Re=j(T);return"".concat(xe,".").concat(Re);case"long":return(0,c.readInt32)(T);case"comp":return{low:(0,c.readUint32)(T),high:(0,c.readUint32)(T)};case"bool":return!!(0,c.readUint8)(T);case"type":case"GlbC":return fe(T);case"alis":var Be=(0,c.readInt32)(T);return(0,c.readAsciiString)(T,Be);case"tdta":var Le=(0,c.readInt32)(T);return(0,c.readBytes)(T,Le);case"ObAr":(0,c.readInt32)(T),(0,c.readUnicodeString)(T),j(T);for(var $e=(0,c.readInt32)(T),Ke=[],me=0;me<$e;me++){var rt=j(T);(0,c.readSignature)(T),(0,c.readSignature)(T);for(var ut=(0,c.readInt32)(T),at=[],Qe=0;Qe<ut;Qe++)at.push((0,c.readFloat64)(T));Ke.push({type:rt,values:at})}return Ke;case"Pth ":(0,c.readInt32)(T);var st=(0,c.readSignature)(T);(0,c.readInt32LE)(T);var Xe=(0,c.readInt32LE)(T);return{sig:st,path:(0,c.readUnicodeStringWithLengthLE)(T,Xe)};default:throw new Error("Invalid TySh descriptor OSType: ".concat(d," at ").concat(T.offset.toString(16)))}}var we={meshPoints:"rationalPoint",quiltSliceX:"UntF",quiltSliceY:"UntF"};function _e(T,d,N,P,me,be){switch(d){case"obj ":pe(T,P,N);break;case"Objc":case"GlbO":if(typeof N!="object")throw new Error("Invalid struct value: ".concat(JSON.stringify(N),", key: ").concat(P));if(!me)throw new Error("Missing ext type for: '".concat(P,"' (").concat(JSON.stringify(N),")"));Y(T,N._name||me.name,N._classID||me.classID,N,be);break;case"VlLs":if(!Array.isArray(N))throw new Error("Invalid list value: ".concat(JSON.stringify(N),", key: ").concat(P));(0,l.writeInt32)(T,N.length);for(var ye=0;ye<N.length;ye++){var xe=K[P];(0,l.writeSignature)(T,xe||"long"),_e(T,xe||"long",N[ye],"".concat(P,"[]"),H[P],be),D&&!xe&&console.log("Missing descriptor array type for: '".concat(P,"' in"),N)}break;case"doub":if(typeof N!="number")throw new Error("Invalid number value: ".concat(JSON.stringify(N),", key: ").concat(P));(0,l.writeFloat64)(T,N);break;case"UntF":if(!S[N.units])throw new Error("Invalid units: ".concat(N.units," in ").concat(P));(0,l.writeSignature)(T,S[N.units]),(0,l.writeFloat64)(T,N.value);break;case"UnFl":if(!S[N.units])throw new Error("Invalid units: ".concat(N.units," in ").concat(P));(0,l.writeSignature)(T,S[N.units]),(0,l.writeFloat32)(T,N.value);break;case"TEXT":(0,l.writeUnicodeStringWithPadding)(T,N);break;case"enum":if(typeof N!="string")throw new Error("Invalid enum value: ".concat(JSON.stringify(N),", key: ").concat(P));var Re=N.split("."),Be=Re[0],Le=Re[1];ne(T,Be),ne(T,Le);break;case"long":if(typeof N!="number")throw new Error("Invalid integer value: ".concat(JSON.stringify(N),", key: ").concat(P));(0,l.writeInt32)(T,N);break;case"bool":if(typeof N!="boolean")throw new Error("Invalid boolean value: ".concat(JSON.stringify(N),", key: ").concat(P));(0,l.writeUint8)(T,N?1:0);break;case"tdta":(0,l.writeInt32)(T,N.byteLength),(0,l.writeBytes)(T,N);break;case"ObAr":(0,l.writeInt32)(T,16),(0,l.writeUnicodeStringWithPadding)(T,"");var $e=we[P];if(!$e)throw new Error("Not implemented ObArType for: ".concat(P));ne(T,$e),(0,l.writeInt32)(T,N.length);for(var ye=0;ye<N.length;ye++){ne(T,N[ye].type),(0,l.writeSignature)(T,"UnFl"),(0,l.writeSignature)(T,"#Pxl"),(0,l.writeInt32)(T,N[ye].values.length);for(var Ke=0;Ke<N[ye].values.length;Ke++)(0,l.writeFloat64)(T,N[ye].values[Ke])}break;case"Pth ":var rt=12+N.path.length*2;(0,l.writeInt32)(T,rt),(0,l.writeSignature)(T,N.sig),(0,l.writeInt32LE)(T,rt),(0,l.writeInt32LE)(T,N.path.length),(0,l.writeUnicodeStringWithoutLengthLE)(T,N.path);break;default:throw new Error("Not implemented descriptor OSType: ".concat(d))}}function ie(T){for(var d=(0,c.readInt32)(T),N=[],P=0;P<d;P++){var me=(0,c.readSignature)(T);switch(me){case"prop":fe(T);var be=j(T);N.push(be);break;case"Clss":N.push(fe(T));break;case"Enmr":fe(T);var ye=j(T),xe=j(T);N.push("".concat(ye,".").concat(xe));break;case"rele":fe(T),N.push((0,c.readUint32)(T));break;case"Idnt":N.push((0,c.readInt32)(T));break;case"indx":N.push((0,c.readInt32)(T));break;case"name":fe(T),N.push((0,c.readUnicodeString)(T));break;default:throw new Error("Invalid descriptor reference type: ".concat(me))}}return N}function pe(T,d,N){(0,l.writeInt32)(T,N.length);for(var P=0;P<N.length;P++){var me=N[P],be="unknown";switch(typeof me=="string"&&(/^[a-z ]+\.[a-z ]+$/i.test(me)?be="Enmr":be="name"),(0,l.writeSignature)(T,be),be){case"Enmr":var ye=me.split("."),xe=ye[0],Re=ye[1];ge(T,"\0",xe),ne(T,xe),ne(T,Re);break;case"name":ge(T,"\0","Lyr "),(0,l.writeUnicodeString)(T,me+"\0");break;default:throw new Error("Invalid descriptor reference type: ".concat(be))}}return N}function fe(T){return{name:(0,c.readUnicodeString)(T),classID:j(T)}}function ge(T,d,N){(0,l.writeUnicodeString)(T,d),ne(T,N)}function ke(T,d){d===void 0&&(d=!1);var N=(0,c.readUint32)(T);if(N!==16)throw new Error("Invalid descriptor version: ".concat(N));return z(T,d)}t.readVersionAndDescriptor=ke;function Ee(T,d,N,P,me){me===void 0&&(me=""),(0,l.writeUint32)(T,16),Y(T,d,N,P,me)}t.writeVersionAndDescriptor=Ee;function Ie(T){return{x:T.Hrzn,y:T.Vrtc}}t.horzVrtcToXY=Ie;function De(T){return{Hrzn:T.x,Vrtc:T.y}}t.xyToHorzVrtc=De;function Ue(T){return{top:ue(T["Top "]),left:ue(T.Left),right:ue(T.Rght),bottom:ue(T.Btom)}}t.descBoundsToBounds=Ue;function Ne(T){var d;return d={Left:Te(T.left,"bounds.left")},d["Top "]=Te(T.top,"bounds.top"),d.Rght=Te(T.right,"bounds.right"),d.Btom=Te(T.bottom,"bounds.bottom"),d}t.boundsToDescBounds=Ne;function Me(T){var d={enabled:!!T.enab,position:t.FStl.decode(T.Styl),fillType:t.FrFl.decode(T.PntT),blendMode:t.BlnM.decode(T["Md "]),opacity:R(T.Opct),size:ue(T["Sz "])};return T.present!==void 0&&(d.present=T.present),T.showInDialog!==void 0&&(d.showInDialog=T.showInDialog),T.overprint!==void 0&&(d.overprint=T.overprint),T["Clr "]&&(d.color=w(T["Clr "])),T.Grad&&(d.gradient=u(T)),T.Ptrn&&(d.pattern=f(T)),d}function Ce(T){var d={};return d.enab=!!T.enabled,T.present!==void 0&&(d.present=!!T.present),T.showInDialog!==void 0&&(d.showInDialog=!!T.showInDialog),d.Styl=t.FStl.encode(T.position),d.PntT=t.FrFl.encode(T.fillType),d["Md "]=t.BlnM.encode(T.blendMode),d.Opct=Se(T.opacity),d["Sz "]=Te(T.size,"size"),T.color&&(d["Clr "]=E(T.color)),T.gradient&&(d=r(r({},d),v(T.gradient))),T.pattern&&(d=r(r({},d),i(T.pattern))),T.overprint!==void 0&&(d.overprint=!!T.overprint),d}function Ge(T,d,N){for(var P,me,be,ye=N?{"Scl ":Pe((P=T.scale)!==null&&P!==void 0?P:1),masterFXSwitch:!T.disabled}:{masterFXSwitch:!T.disabled,"Scl ":Pe((me=T.scale)!==null&&me!==void 0?me:1)},xe=["dropShadow","innerShadow","solidFill","gradientOverlay","stroke"],Re=0,Be=xe;Re<Be.length;Re++){var Le=Be[Re];if(T[Le]&&!Array.isArray(T[Le]))throw new Error("".concat(Le," should be an array"))}var $e=function(Xe){return!!Xe&&Xe.length>1&&N},Ke=function(Xe){return!!Xe&&Xe.length>=1&&(!N||Xe.length===1)};if(Ke(T.dropShadow)&&(ye.DrSh=y(T.dropShadow[0],"dropShadow",d)),$e(T.dropShadow)&&(ye.dropShadowMulti=T.dropShadow.map(function(Xe){return y(Xe,"dropShadow",d)})),Ke(T.innerShadow)&&(ye.IrSh=y(T.innerShadow[0],"innerShadow",d)),$e(T.innerShadow)&&(ye.innerShadowMulti=T.innerShadow.map(function(Xe){return y(Xe,"innerShadow",d)})),T.outerGlow&&(ye.OrGl=y(T.outerGlow,"outerGlow",d)),$e(T.solidFill)&&(ye.solidFillMulti=T.solidFill.map(function(Xe){return y(Xe,"solidFill",d)})),$e(T.gradientOverlay)&&(ye.gradientFillMulti=T.gradientOverlay.map(function(Xe){return y(Xe,"gradientOverlay",d)})),$e(T.stroke)&&(ye.frameFXMulti=T.stroke.map(function(Xe){return Ce(Xe)})),T.innerGlow&&(ye.IrGl=y(T.innerGlow,"innerGlow",d)),T.bevel&&(ye.ebbl=y(T.bevel,"bevel",d)),Ke(T.solidFill)&&(ye.SoFi=y(T.solidFill[0],"solidFill",d)),T.patternOverlay&&(ye.patternFill=y(T.patternOverlay,"patternOverlay",d)),Ke(T.gradientOverlay)&&(ye.GrFl=y(T.gradientOverlay[0],"gradientOverlay",d)),T.satin&&(ye.ChFX=y(T.satin,"satin",d)),Ke(T.stroke)&&(ye.FrFX=Ce((be=T.stroke)===null||be===void 0?void 0:be[0])),N){ye.numModifyingFX=0;for(var rt=0,ut=Object.keys(T);rt<ut.length;rt++){var Le=ut[rt],at=T[Le];if(Array.isArray(at))for(var Qe=0,st=at;Qe<st.length;Qe++)st[Qe].enabled&&ye.numModifyingFX++;else at.enabled&&ye.numModifyingFX++}}return ye}t.serializeEffects=Ge;function qe(T,d){var N={},P=T.masterFXSwitch,me=T.DrSh,be=T.dropShadowMulti,ye=T.IrSh,xe=T.innerShadowMulti,Re=T.OrGl,Be=T.IrGl,Le=T.ebbl,$e=T.SoFi,Ke=T.solidFillMulti,rt=T.patternFill,ut=T.GrFl,at=T.gradientFillMulti,Qe=T.ChFX,st=T.FrFX,Xe=T.frameFXMulti;T.numModifyingFX;var ht=s(T,["masterFXSwitch","DrSh","dropShadowMulti","IrSh","innerShadowMulti","OrGl","IrGl","ebbl","SoFi","solidFillMulti","patternFill","GrFl","gradientFillMulti","ChFX","FrFX","frameFXMulti","numModifyingFX"]);return P||(N.disabled=!0),T["Scl "]&&(N.scale=R(T["Scl "])),me&&(N.dropShadow=[O(me,d)]),be&&(N.dropShadow=be.map(function(ot){return O(ot,d)})),ye&&(N.innerShadow=[O(ye,d)]),xe&&(N.innerShadow=xe.map(function(ot){return O(ot,d)})),Re&&(N.outerGlow=O(Re,d)),Be&&(N.innerGlow=O(Be,d)),Le&&(N.bevel=O(Le,d)),$e&&(N.solidFill=[O($e,d)]),Ke&&(N.solidFill=Ke.map(function(ot){return O(ot,d)})),rt&&(N.patternOverlay=O(rt,d)),ut&&(N.gradientOverlay=[O(ut,d)]),at&&(N.gradientOverlay=at.map(function(ot){return O(ot,d)})),Qe&&(N.satin=O(Qe,d)),st&&(N.stroke=[Me(st)]),Xe&&(N.stroke=Xe.map(function(ot){return Me(ot)})),d&&Object.keys(ht).length>1&&console.log("Unhandled effect keys:",ht),N}t.parseEffects=qe;function ae(T,d){for(var N=[],P=0;P<T.length;P++){var me=T[P],be=me.time,ye=be.denominator,xe=be.numerator,Re=me.selected,Be=me.animKey,Le={numerator:xe,denominator:ye},$e=t.animInterpStyleEnum.decode(me.animInterpStyle);switch(Be.Type){case"keyType.Opct":N.push({interpolation:$e,time:Le,selected:Re,type:"opacity",value:R(Be.Opct)});break;case"keyType.Pstn":N.push({interpolation:$e,time:Le,selected:Re,type:"position",x:Be.Hrzn,y:Be.Vrtc});break;case"keyType.Trnf":N.push({interpolation:$e,time:Le,selected:Re,type:"transform",scale:Ie(Be["Scl "]),skew:Ie(Be.Skew),rotation:Be.rotation,translation:Ie(Be.translation)});break;case"keyType.sheetStyle":var Ke={interpolation:$e,time:Le,selected:Re,type:"style"};Be.sheetStyle.Lefx&&(Ke.style=qe(Be.sheetStyle.Lefx,d)),N.push(Ke);break;case"keyType.globalLighting":N.push({interpolation:$e,time:Le,selected:Re,type:"globalLighting",globalAngle:Be.gblA,globalAltitude:Be.globalAltitude});break;default:throw new Error("Unsupported keyType value")}}return N}function le(T){for(var d=[],N=0;N<T.length;N++){var P=T[N],me=P.time,be=P.selected,ye=be===void 0?!1:be,xe=P.interpolation,Re=t.animInterpStyleEnum.encode(xe),Be=void 0;switch(P.type){case"opacity":Be={Type:"keyType.Opct",Opct:Se(P.value)};break;case"position":Be={Type:"keyType.Pstn",Hrzn:P.x,Vrtc:P.y};break;case"transform":Be={Type:"keyType.Trnf","Scl ":De(P.scale),Skew:De(P.skew),rotation:P.rotation,translation:De(P.translation)};break;case"style":Be={Type:"keyType.sheetStyle",sheetStyle:{Vrsn:1,blendOptions:{}}},P.style&&(Be.sheetStyle={Vrsn:1,Lefx:Ge(P.style,!1,!1),blendOptions:{}});break;case"globalLighting":Be={Type:"keyType.globalLighting",gblA:P.globalAngle,globalAltitude:P.globalAltitude};break;default:throw new Error("Unsupported keyType value")}d.push({Vrsn:1,animInterpStyle:Re,time:me,animKey:Be,selected:ye})}return d}function p(T,d){for(var N=[],P=0;P<T.length;P++){var me=T[P],be={type:t.stdTrackID.decode(me.trackID),enabled:me.enab,keys:ae(me.keyList,d)};me.effectParams&&(be.effectParams={fillCanvas:me.effectParams.fillCanvas,zoomOrigin:me.effectParams.zoomOrigin,keys:ae(me.effectParams.keyList,d)}),N.push(be)}return N}t.parseTrackList=p;function m(T){for(var d=[],N=0;N<T.length;N++){var P=T[N];d.push(r(r({trackID:t.stdTrackID.encode(P.type),Vrsn:1,enab:!!P.enabled,Effc:!!P.effectParams},P.effectParams?{effectParams:{keyList:le(P.keys),fillCanvas:P.effectParams.fillCanvas,zoomOrigin:P.effectParams.zoomOrigin}}:{}),{keyList:le(P.keys)}))}return d}t.serializeTrackList=m;function O(T,d){for(var N={},P=0,me=Object.keys(T);P<me.length;P++){var be=me[P],ye=T[be];switch(be){case"enab":N.enabled=!!ye;break;case"uglg":N.useGlobalLight=!!ye;break;case"AntA":N.antialiased=!!ye;break;case"Algn":N.align=!!ye;break;case"Dthr":N.dither=!!ye;break;case"Invr":N.invert=!!ye;break;case"Rvrs":N.reverse=!!ye;break;case"Clr ":N.color=w(ye);break;case"hglC":N.highlightColor=w(ye);break;case"sdwC":N.shadowColor=w(ye);break;case"Styl":N.position=t.FStl.decode(ye);break;case"Md ":N.blendMode=t.BlnM.decode(ye);break;case"hglM":N.highlightBlendMode=t.BlnM.decode(ye);break;case"sdwM":N.shadowBlendMode=t.BlnM.decode(ye);break;case"bvlS":N.style=t.BESl.decode(ye);break;case"bvlD":N.direction=t.BESs.decode(ye);break;case"bvlT":N.technique=t.bvlT.decode(ye);break;case"GlwT":N.technique=t.BETE.decode(ye);break;case"glwS":N.source=t.IGSr.decode(ye);break;case"Type":N.type=t.GrdT.decode(ye);break;case"gs99":N.interpolationMethod=t.gradientInterpolationMethodType.decode(ye);break;case"Opct":N.opacity=R(ye);break;case"hglO":N.highlightOpacity=R(ye);break;case"sdwO":N.shadowOpacity=R(ye);break;case"lagl":N.angle=C(ye);break;case"Angl":N.angle=C(ye);break;case"Lald":N.altitude=C(ye);break;case"Sftn":N.soften=ue(ye);break;case"srgR":N.strength=R(ye);break;case"blur":N.size=ue(ye);break;case"Nose":N.noise=R(ye);break;case"Inpr":N.range=R(ye);break;case"Ckmt":N.choke=ue(ye);break;case"ShdN":N.jitter=R(ye);break;case"Dstn":N.distance=ue(ye);break;case"Scl ":N.scale=R(ye);break;case"Ptrn":N.pattern={name:ye["Nm "],id:ye.Idnt};break;case"phase":N.phase={x:ye.Hrzn,y:ye.Vrtc};break;case"Ofst":N.offset={x:R(ye.Hrzn),y:R(ye.Vrtc)};break;case"MpgS":case"TrnS":N.contour={name:ye["Nm "],curve:ye["Crv "].map(function(xe){return{x:xe.Hrzn,y:xe.Vrtc}})};break;case"Grad":N.gradient=F(ye);break;case"useTexture":case"useShape":case"layerConceals":case"present":case"showInDialog":case"antialiasGloss":N[be]=ye;break;case"_name":case"_classID":break;default:d&&console.log("Invalid effect key: '".concat(be,"', value:"),ye)}}return N}function y(T,d,N){var P={enab:!1};d==="dropShadow"&&(P.TrnS={"Nm ":"","Crv ":[]});for(var me=0,be=Object.keys(T);me<be.length;me++){var ye=be[me],xe=T[ye];switch(ye){case"enabled":P.enab=!!xe;break;case"useGlobalLight":P.uglg=!!xe;break;case"antialiased":P.AntA=!!xe;break;case"align":P.Algn=!!xe;break;case"dither":P.Dthr=!!xe;break;case"invert":P.Invr=!!xe;break;case"reverse":P.Rvrs=!!xe;break;case"color":P["Clr "]=E(xe);break;case"highlightColor":P.hglC=E(xe);break;case"shadowColor":P.sdwC=E(xe);break;case"position":P.Styl=t.FStl.encode(xe);break;case"blendMode":P["Md "]=t.BlnM.encode(xe);break;case"highlightBlendMode":P.hglM=t.BlnM.encode(xe);break;case"shadowBlendMode":P.sdwM=t.BlnM.encode(xe);break;case"style":P.bvlS=t.BESl.encode(xe);break;case"direction":P.bvlD=t.BESs.encode(xe);break;case"technique":d==="bevel"?P.bvlT=t.bvlT.encode(xe):P.GlwT=t.BETE.encode(xe);break;case"source":P.glwS=t.IGSr.encode(xe);break;case"type":P.Type=t.GrdT.encode(xe);break;case"interpolationMethod":P.gs99=t.gradientInterpolationMethodType.encode(xe);break;case"opacity":P.Opct=Se(xe);break;case"highlightOpacity":P.hglO=Se(xe);break;case"shadowOpacity":P.sdwO=Se(xe);break;case"angle":d==="gradientOverlay"||d==="patternFill"?P.Angl=A(xe):P.lagl=A(xe);break;case"altitude":P.Lald=A(xe);break;case"soften":P.Sftn=Te(xe,ye);break;case"strength":P.srgR=Se(xe);break;case"size":P.blur=Te(xe,ye);break;case"noise":P.Nose=Se(xe);break;case"range":P.Inpr=Se(xe);break;case"choke":P.Ckmt=Te(xe,ye);break;case"jitter":P.ShdN=Se(xe);break;case"distance":P.Dstn=Te(xe,ye);break;case"scale":P["Scl "]=Se(xe);break;case"pattern":P.Ptrn={"Nm ":xe.name,Idnt:xe.id};break;case"phase":P.phase={Hrzn:xe.x,Vrtc:xe.y};break;case"offset":P.Ofst={Hrzn:Se(xe.x),Vrtc:Se(xe.y)};break;case"contour":P[d==="satin"?"MpgS":"TrnS"]={"Nm ":xe.name,"Crv ":xe.curve.map(function(Re){return{Hrzn:Re.x,Vrtc:Re.y}})};break;case"gradient":P.Grad=e(xe);break;case"useTexture":case"useShape":case"layerConceals":case"present":case"showInDialog":case"antialiasGloss":P[ye]=xe;break;default:N&&console.log("Invalid effect key: '".concat(ye,"', value:"),xe)}}return P}function F(T){if(T.GrdF==="GrdF.CstS"){var d=T.Intr||4096;return{type:"solid",name:T["Nm "],smoothness:T.Intr/4096,colorStops:T.Clrs.map(function(N){return{color:w(N["Clr "]),location:N.Lctn/d,midpoint:N.Mdpn/100}}),opacityStops:T.Trns.map(function(N){return{opacity:R(N.Opct),location:N.Lctn/d,midpoint:N.Mdpn/100}})}}else return{type:"noise",name:T["Nm "],roughness:T.Smth/4096,colorModel:t.ClrS.decode(T.ClrS),randomSeed:T.RndS,restrictColors:!!T.VctC,addTransparency:!!T.ShTr,min:T["Mnm "].map(function(N){return N/100}),max:T["Mxm "].map(function(N){return N/100})}}function e(T){var d,N;if(T.type==="solid"){var P=Math.round(((d=T.smoothness)!==null&&d!==void 0?d:1)*4096);return{"Nm ":T.name||"",GrdF:"GrdF.CstS",Intr:P,Clrs:T.colorStops.map(function(me){var be;return{"Clr ":E(me.color),Type:"Clry.UsrS",Lctn:Math.round(me.location*P),Mdpn:Math.round(((be=me.midpoint)!==null&&be!==void 0?be:.5)*100)}}),Trns:T.opacityStops.map(function(me){var be;return{Opct:Se(me.opacity),Lctn:Math.round(me.location*P),Mdpn:Math.round(((be=me.midpoint)!==null&&be!==void 0?be:.5)*100)}})}}else return{GrdF:"GrdF.ClNs","Nm ":T.name||"",ShTr:!!T.addTransparency,VctC:!!T.restrictColors,ClrS:t.ClrS.encode(T.colorModel),RndS:T.randomSeed||0,Smth:Math.round(((N=T.roughness)!==null&&N!==void 0?N:1)*4096),"Mnm ":(T.min||[0,0,0,0]).map(function(me){return me*100}),"Mxm ":(T.max||[1,1,1,1]).map(function(me){return me*100})}}function u(T){var d=F(T.Grad);return d.style=t.GrdT.decode(T.Type),T.Dthr!==void 0&&(d.dither=T.Dthr),T.gradientsInterpolationMethod!==void 0&&(d.interpolationMethod=t.gradientInterpolationMethodType.decode(T.gradientsInterpolationMethod)),T.Rvrs!==void 0&&(d.reverse=T.Rvrs),T.Angl!==void 0&&(d.angle=C(T.Angl)),T["Scl "]!==void 0&&(d.scale=R(T["Scl "])),T.Algn!==void 0&&(d.align=T.Algn),T.Ofst!==void 0&&(d.offset={x:R(T.Ofst.Hrzn),y:R(T.Ofst.Vrtc)}),d}function f(T){var d={name:T.Ptrn["Nm "],id:T.Ptrn.Idnt};return T.Lnkd!==void 0&&(d.linked=T.Lnkd),T.phase!==void 0&&(d.phase={x:T.phase.Hrzn,y:T.phase.Vrtc}),d}function k(T){if("Grad"in T)return u(T);if("Ptrn"in T)return r({type:"pattern"},f(T));if("Clr "in T)return{type:"color",color:w(T["Clr "])};throw new Error("Invalid vector content")}t.parseVectorContent=k;function v(T){var d={};return T.dither!==void 0&&(d.Dthr=T.dither),T.interpolationMethod!==void 0&&(d.gradientsInterpolationMethod=t.gradientInterpolationMethodType.encode(T.interpolationMethod)),T.reverse!==void 0&&(d.Rvrs=T.reverse),T.angle!==void 0&&(d.Angl=A(T.angle)),d.Type=t.GrdT.encode(T.style),T.align!==void 0&&(d.Algn=T.align),T.scale!==void 0&&(d["Scl "]=Se(T.scale)),T.offset&&(d.Ofst={Hrzn:Se(T.offset.x),Vrtc:Se(T.offset.y)}),d.Grad=e(T),d}function i(T){var d={Ptrn:{"Nm ":T.name||"",Idnt:T.id||""}};return T.linked!==void 0&&(d.Lnkd=!!T.linked),T.phase!==void 0&&(d.phase={Hrzn:T.phase.x,Vrtc:T.phase.y}),d}function n(T){return T.type==="color"?{key:"SoCo",descriptor:{"Clr ":E(T.color)}}:T.type==="pattern"?{key:"PtFl",descriptor:i(T)}:{key:"GdFl",descriptor:v(T)}}t.serializeVectorContent=n;function w(T){if("H "in T)return{h:oe(T["H "]),s:T.Strt,b:T.Brgh};if("Rd "in T)return{r:T["Rd "],g:T["Grn "],b:T["Bl "]};if("Cyn "in T)return{c:T["Cyn "],m:T.Mgnt,y:T["Ylw "],k:T.Blck};if("Gry "in T)return{k:T["Gry "]};if("Lmnc"in T)return{l:T.Lmnc,a:T["A "],b:T["B "]};if("redFloat"in T)return{fr:T.redFloat,fg:T.greenFloat,fb:T.blueFloat};throw new Error("Unsupported color descriptor")}t.parseColor=w;function E(T){if(T){if("r"in T)return{_name:"",_classID:"RGBC","Rd ":T.r||0,"Grn ":T.g||0,"Bl ":T.b||0};if("fr"in T)return{_name:"",_classID:"RGBC",redFloat:T.fr,greenFloat:T.fg,blueFloat:T.fb};if("h"in T)return{_name:"",_classID:"HSBC","H ":A(T.h*360),Strt:T.s||0,Brgh:T.b||0};if("c"in T)return{_name:"",_classID:"CMYC","Cyn ":T.c||0,Mgnt:T.m||0,"Ylw ":T.y||0,Blck:T.k||0};if("l"in T)return{_name:"",_classID:"LABC",Lmnc:T.l||0,"A ":T.a||0,"B ":T.b||0};if("k"in T)return{_name:"",_classID:"GRYC","Gry ":T.k};throw new Error("Invalid color value")}else return{_name:"",_classID:"RGBC","Rd ":0,"Grn ":0,"Bl ":0}}t.serializeColor=E;function C(T){if(T===void 0)return 0;if(T.units!=="Angle")throw new Error("Invalid units: ".concat(T.units));return T.value}t.parseAngle=C;function R(T){if(T===void 0)return 1;if(T.units!=="Percent")throw new Error("Invalid units: ".concat(T.units));return T.value/100}t.parsePercent=R;function oe(T){if(T===void 0)return 1;if(T.units==="Percent")return T.value/100;if(T.units==="Angle")return T.value/360;throw new Error("Invalid units: ".concat(T.units))}t.parsePercentOrAngle=oe;function ue(T){var d=T.units,N=T.value;if(d!=="Pixels"&&d!=="Millimeters"&&d!=="Points"&&d!=="None"&&d!=="Picas"&&d!=="Inches"&&d!=="Centimeters"&&d!=="Density")throw new Error("Invalid units: ".concat(JSON.stringify({units:d,value:N})));return{value:N,units:d}}t.parseUnits=ue;function re(T,d){return d===void 0&&(d="Pixels"),typeof T=="number"?{value:T,units:d}:ue(T)}t.parseUnitsOrNumber=re;function he(T,d){var N=T.units,P=T.value;if(N!==d)throw new Error("Invalid units: ".concat(JSON.stringify({units:N,value:P})));return P}t.parseUnitsToNumber=he;function A(T){return{units:"Angle",value:T||0}}t.unitsAngle=A;function Se(T){return{units:"Percent",value:Math.round((T||0)*100)}}t.unitsPercent=Se;function Pe(T){return{units:"Percent",value:(T||0)*100}}t.unitsPercentF=Pe;function Te(T,d){if(T==null)return{units:"Pixels",value:0};if(typeof T!="object")throw new Error("Invalid value: ".concat(JSON.stringify(T)," (key: ").concat(d,") (should have value and units)"));var N=T.units,P=T.value;if(typeof P!="number")throw new Error("Invalid value in ".concat(JSON.stringify(T)," (key: ").concat(d,")"));if(N!=="Pixels"&&N!=="Millimeters"&&N!=="Points"&&N!=="None"&&N!=="Picas"&&N!=="Inches"&&N!=="Centimeters"&&N!=="Density")throw new Error("Invalid units in ".concat(JSON.stringify(T)," (key: ").concat(d,")"));return{units:N,value:P}}t.unitsValue=Te;function He(T){return{numerator:T.numerator,denominator:T.denominator}}t.frac=He,t.textGridding=(0,a.createEnum)("textGridding","none",{none:"None",round:"Rnd "}),t.Ornt=(0,a.createEnum)("Ornt","horizontal",{horizontal:"Hrzn",vertical:"Vrtc"}),t.Annt=(0,a.createEnum)("Annt","sharp",{none:"Anno",sharp:"antiAliasSharp",crisp:"AnCr",strong:"AnSt",smooth:"AnSm",platform:"antiAliasPlatformGray",platformLCD:"antiAliasPlatformLCD"}),t.warpStyle=(0,a.createEnum)("warpStyle","none",{none:"warpNone",arc:"warpArc",arcLower:"warpArcLower",arcUpper:"warpArcUpper",arch:"warpArch",bulge:"warpBulge",shellLower:"warpShellLower",shellUpper:"warpShellUpper",flag:"warpFlag",wave:"warpWave",fish:"warpFish",rise:"warpRise",fisheye:"warpFisheye",inflate:"warpInflate",squeeze:"warpSqueeze",twist:"warpTwist",cylinder:"warpCylinder",custom:"warpCustom"}),t.BlnM=(0,a.createEnum)("BlnM","normal",{normal:"Nrml",dissolve:"Dslv",darken:"Drkn",multiply:"Mltp","color burn":"CBrn","linear burn":"linearBurn","darker color":"darkerColor",lighten:"Lghn",screen:"Scrn","color dodge":"CDdg","linear dodge":"linearDodge","lighter color":"lighterColor",overlay:"Ovrl","soft light":"SftL","hard light":"HrdL","vivid light":"vividLight","linear light":"linearLight","pin light":"pinLight","hard mix":"hardMix",difference:"Dfrn",exclusion:"Xclu",subtract:"blendSubtraction",divide:"blendDivide",hue:"H ",saturation:"Strt",color:"Clr ",luminosity:"Lmns","linear height":"linearHeight",height:"Hght",subtraction:"Sbtr"}),t.BESl=(0,a.createEnum)("BESl","inner bevel",{"inner bevel":"InrB","outer bevel":"OtrB",emboss:"Embs","pillow emboss":"PlEb","stroke emboss":"strokeEmboss"}),t.bvlT=(0,a.createEnum)("bvlT","smooth",{smooth:"SfBL","chisel hard":"PrBL","chisel soft":"Slmt"}),t.BESs=(0,a.createEnum)("BESs","up",{up:"In ",down:"Out "}),t.BETE=(0,a.createEnum)("BETE","softer",{softer:"SfBL",precise:"PrBL"}),t.IGSr=(0,a.createEnum)("IGSr","edge",{edge:"SrcE",center:"SrcC"}),t.GrdT=(0,a.createEnum)("GrdT","linear",{linear:"Lnr ",radial:"Rdl ",angle:"Angl",reflected:"Rflc",diamond:"Dmnd"}),t.animInterpStyleEnum=(0,a.createEnum)("animInterpStyle","linear",{linear:"Lnr ",hold:"hold"}),t.stdTrackID=(0,a.createEnum)("stdTrackID","opacity",{opacity:"opacityTrack",style:"styleTrack",sheetTransform:"sheetTransformTrack",sheetPosition:"sheetPositionTrack",globalLighting:"globalLightingTrack"}),t.gradientInterpolationMethodType=(0,a.createEnum)("gradientInterpolationMethodType","perceptual",{perceptual:"Perc",linear:"Lnr ",classic:"Gcls",smooth:"Smoo"}),t.ClrS=(0,a.createEnum)("ClrS","rgb",{rgb:"RGBC",hsb:"HSBl",lab:"LbCl",hsl:"HSLC"}),t.FStl=(0,a.createEnum)("FStl","outside",{outside:"OutF",center:"CtrF",inside:"InsF"}),t.FrFl=(0,a.createEnum)("FrFl","color",{color:"SClr",gradient:"GrFl",pattern:"Ptrn"}),t.ESliceType=(0,a.createEnum)("ESliceType","image",{image:"Img ",noImage:"noImage"}),t.ESliceHorzAlign=(0,a.createEnum)("ESliceHorzAlign","default",{default:"default"}),t.ESliceVertAlign=(0,a.createEnum)("ESliceVertAlign","default",{default:"default"}),t.ESliceOrigin=(0,a.createEnum)("ESliceOrigin","userGenerated",{userGenerated:"userGenerated",autoGenerated:"autoGenerated",layer:"layer"}),t.ESliceBGColorType=(0,a.createEnum)("ESliceBGColorType","none",{none:"None",matte:"matte",color:"Clr "}),t.strokeStyleLineCapType=(0,a.createEnum)("strokeStyleLineCapType","butt",{butt:"strokeStyleButtCap",round:"strokeStyleRoundCap",square:"strokeStyleSquareCap"}),t.strokeStyleLineJoinType=(0,a.createEnum)("strokeStyleLineJoinType","miter",{miter:"strokeStyleMiterJoin",round:"strokeStyleRoundJoin",bevel:"strokeStyleBevelJoin"}),t.strokeStyleLineAlignment=(0,a.createEnum)("strokeStyleLineAlignment","inside",{inside:"strokeStyleAlignInside",center:"strokeStyleAlignCenter",outside:"strokeStyleAlignOutside"}),t.BlrM=(0,a.createEnum)("BlrM","ispinmage",{spin:"Spn ",zoom:"Zm "}),t.BlrQ=(0,a.createEnum)("BlrQ","good",{draft:"Drft",good:"Gd ",best:"Bst "}),t.SmBM=(0,a.createEnum)("SmBM","normal",{normal:"SBMN","edge only":"SBME","overlay edge":"SBMO"}),t.SmBQ=(0,a.createEnum)("SmBQ","medium",{low:"SBQL",medium:"SBQM",high:"SBQH"}),t.DspM=(0,a.createEnum)("DspM","stretch to fit",{"stretch to fit":"StrF",tile:"Tile"}),t.UndA=(0,a.createEnum)("UndA","repeat edge pixels",{"wrap around":"WrpA","repeat edge pixels":"RptE"}),t.Cnvr=(0,a.createEnum)("Cnvr","rectangular to polar",{"rectangular to polar":"RctP","polar to rectangular":"PlrR"}),t.RplS=(0,a.createEnum)("RplS","medium",{small:"Sml ",medium:"Mdm ",large:"Lrg "}),t.SphM=(0,a.createEnum)("SphM","normal",{normal:"Nrml","horizontal only":"HrzO","vertical only":"VrtO"}),t.Wvtp=(0,a.createEnum)("Wvtp","sine",{sine:"WvSn",triangle:"WvTr",square:"WvSq"}),t.ZZTy=(0,a.createEnum)("ZZTy","pond ripples",{"around center":"ArnC","out from center":"OtFr","pond ripples":"PndR"}),t.Dstr=(0,a.createEnum)("Dstr","uniform",{uniform:"Unfr",gaussian:"Gsn "}),t.Chnl=(0,a.createEnum)("Chnl","composite",{red:"Rd ",green:"Grn ",blue:"Bl ",composite:"Cmps"}),t.MztT=(0,a.createEnum)("MztT","fine dots",{"fine dots":"FnDt","medium dots":"MdmD","grainy dots":"GrnD","coarse dots":"CrsD","short lines":"ShrL","medium lines":"MdmL","long lines":"LngL","short strokes":"ShSt","medium strokes":"MdmS","long strokes":"LngS"}),t.Lns=(0,a.createEnum)("Lns ","50-300mm zoom",{"50-300mm zoom":"Zm ","32mm prime":"Nkn ","105mm prime":"Nkn1","movie prime":"PnVs"}),t.blurType=(0,a.createEnum)("blurType","gaussian blur",{"gaussian blur":"GsnB","lens blur":"lensBlur","motion blur":"MtnB"}),t.DfsM=(0,a.createEnum)("DfsM","normal",{normal:"Nrml","darken only":"DrkO","lighten only":"LghO",anisotropic:"anisotropic"}),t.ExtT=(0,a.createEnum)("ExtT","blocks",{blocks:"Blks",pyramids:"Pyrm"}),t.ExtR=(0,a.createEnum)("ExtR","random",{random:"Rndm","level-based":"LvlB"}),t.FlCl=(0,a.createEnum)("FlCl","background color",{"background color":"FlBc","foreground color":"FlFr","inverse image":"FlIn","unaltered image":"FlSm"}),t.CntE=(0,a.createEnum)("CntE","upper",{lower:"Lwr ",upper:"Upr "}),t.WndM=(0,a.createEnum)("WndM","wind",{wind:"Wnd ",blast:"Blst",stagger:"Stgr"}),t.Drct=(0,a.createEnum)("Drct","from the right",{left:"Left",right:"Rght"}),t.IntE=(0,a.createEnum)("IntE","odd lines",{"odd lines":"ElmO","even lines":"ElmE"}),t.IntC=(0,a.createEnum)("IntC","interpolation",{duplication:"CrtD",interpolation:"CrtI"}),t.FlMd=(0,a.createEnum)("FlMd","wrap around",{"set to transparent":"Bckg","repeat edge pixels":"Rpt ","wrap around":"Wrp "}),t.prjM=(0,a.createEnum)("prjM","fisheye",{fisheye:"fisP",perspective:"perP",auto:"auto","full spherical":"fusP"}),t.presetKindType=(0,a.createEnum)("presetKindType","presetKindCustom",{custom:"presetKindCustom",default:"presetKindDefault"})})),No=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(g){for(var L,j=1,ne=arguments.length;j<ne;j++){L=arguments[j];for(var z in L)Object.prototype.hasOwnProperty.call(L,z)&&(g[z]=L[z])}return g},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.resourceHandlersMap=t.resourceHandlers=void 0;var s=en(),a=$t(),c=Pr(),l=Wt(),h=pc(),o=mi();t.resourceHandlers=[],t.resourceHandlersMap={};function S(g,L,j,ne){var z={key:g,has:L,read:j,write:ne};t.resourceHandlers.push(z),t.resourceHandlersMap[z.key]=z}var D=!1,U=[void 0,"PPI","PPCM"],M=[void 0,"Inches","Centimeters","Points","Picas","Columns"],_="0123456789abcdef";function x(g){return g<=57?g-48:g-87}function I(g,L){return x(g.charCodeAt(L))<<4|x(g.charCodeAt(L+1))}function H(g,L){var j=(0,a.readBytes)(g,L);return(0,h.decodeString)(j)}function ee(g,L){var j=(0,h.encodeString)(L);(0,c.writeBytes)(g,j)}function Z(g){for(var L=(0,a.readUint8)(g),j=(0,a.readBytes)(g,L),ne=!1,z=0;z<j.byteLength;z++)if(j[z]&128){ne=!0;break}return ne?new TextDecoder("gbk").decode(j):(0,h.decodeString)(j)}function K(g,L){for(var j="",ne=0,z=L.codePointAt(ne++);z!==void 0;z=L.codePointAt(ne++))j+=z>127?"?":String.fromCodePoint(z);var Y=(0,h.encodeString)(j);(0,c.writeUint8)(g,Y.byteLength),(0,c.writeBytes)(g,Y)}l.MOCK_HANDLERS&&S(1028,function(g){return g._ir1028!==void 0},function(g,L,j){D&&console.log("image resource 1028",j()),L._ir1028=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1028)}),S(1061,function(g){return g.captionDigest!==void 0},function(g,L){for(var j="",ne=0;ne<16;ne++){var z=(0,a.readUint8)(g);j+=_[z>>4],j+=_[z&15]}L.captionDigest=j},function(g,L){for(var j=0;j<16;j++)(0,c.writeUint8)(g,I(L.captionDigest,j*2))}),S(1060,function(g){return g.xmpMetadata!==void 0},function(g,L,j){L.xmpMetadata=H(g,j())},function(g,L){ee(g,L.xmpMetadata)});var W=(0,l.createEnum)("Inte","perceptual",{perceptual:"Img ",saturation:"Grp ","relative colorimetric":"Clrm","absolute colorimetric":"AClr"});l.MOCK_HANDLERS&&S(1085,function(g){return g._ir1085!==void 0},function(g,L,j){L._ir1085=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1085)}),S(1082,function(g){return g.printInformation!==void 0},function(g,L){var j,ne,z=(0,o.readVersionAndDescriptor)(g);L.printInformation={printerName:z.printerName||"",renderingIntent:W.decode((j=z.Inte)!==null&&j!==void 0?j:"Inte.Img ")};var Y=L.printInformation;z.PstS!==void 0&&(Y.printerManagesColors=z.PstS),z["Nm "]!==void 0&&(Y.printerProfile=z["Nm "]),z.MpBl!==void 0&&(Y.blackPointCompensation=z.MpBl),z.printSixteenBit!==void 0&&(Y.printSixteenBit=z.printSixteenBit),z.hardProof!==void 0&&(Y.hardProof=z.hardProof),z.printProofSetup&&("Bltn"in z.printProofSetup?Y.proofSetup={builtin:z.printProofSetup.Bltn.split(".")[1]}:Y.proofSetup={profile:z.printProofSetup.profile,renderingIntent:W.decode((ne=z.printProofSetup.Inte)!==null&&ne!==void 0?ne:"Inte.Img "),blackPointCompensation:!!z.printProofSetup.MpBl,paperWhite:!!z.printProofSetup.paperWhite})},function(g,L){var j,ne,z=L.printInformation,Y={};z.printerManagesColors?Y.PstS=!0:(z.hardProof!==void 0&&(Y.hardProof=!!z.hardProof),Y.ClrS="ClrS.RGBC",Y["Nm "]=(j=z.printerProfile)!==null&&j!==void 0?j:"CIE RGB"),Y.Inte=W.encode(z.renderingIntent),z.printerManagesColors||(Y.MpBl=!!z.blackPointCompensation),Y.printSixteenBit=!!z.printSixteenBit,Y.printerName=z.printerName||"",z.proofSetup&&"profile"in z.proofSetup?Y.printProofSetup={profile:z.proofSetup.profile||"",Inte:W.encode(z.proofSetup.renderingIntent),MpBl:!!z.proofSetup.blackPointCompensation,paperWhite:!!z.proofSetup.paperWhite}:Y.printProofSetup={Bltn:!((ne=z.proofSetup)===null||ne===void 0)&&ne.builtin?"builtinProof.".concat(z.proofSetup.builtin):"builtinProof.proofCMYK"},(0,o.writeVersionAndDescriptor)(g,"","printOutput",Y)}),l.MOCK_HANDLERS&&S(1083,function(g){return g._ir1083!==void 0},function(g,L,j){D&&console.log("image resource 1083",j()),L._ir1083=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1083)}),S(1005,function(g){return g.resolutionInfo!==void 0},function(g,L){var j=(0,a.readFixedPoint32)(g),ne=(0,a.readUint16)(g),z=(0,a.readUint16)(g),Y=(0,a.readFixedPoint32)(g),ve=(0,a.readUint16)(g),we=(0,a.readUint16)(g);L.resolutionInfo={horizontalResolution:j,horizontalResolutionUnit:U[ne]||"PPI",widthUnit:M[z]||"Inches",verticalResolution:Y,verticalResolutionUnit:U[ve]||"PPI",heightUnit:M[we]||"Inches"}},function(g,L){var j=L.resolutionInfo;(0,c.writeFixedPoint32)(g,j.horizontalResolution||0),(0,c.writeUint16)(g,Math.max(1,U.indexOf(j.horizontalResolutionUnit))),(0,c.writeUint16)(g,Math.max(1,M.indexOf(j.widthUnit))),(0,c.writeFixedPoint32)(g,j.verticalResolution||0),(0,c.writeUint16)(g,Math.max(1,U.indexOf(j.verticalResolutionUnit))),(0,c.writeUint16)(g,Math.max(1,M.indexOf(j.heightUnit)))});var X=["centered","size to fit","user defined"];S(1062,function(g){return g.printScale!==void 0},function(g,L){L.printScale={style:X[(0,a.readInt16)(g)],x:(0,a.readFloat32)(g),y:(0,a.readFloat32)(g),scale:(0,a.readFloat32)(g)}},function(g,L){var j=L.printScale,ne=j.style,z=j.x,Y=j.y,ve=j.scale;(0,c.writeInt16)(g,Math.max(0,X.indexOf(ne))),(0,c.writeFloat32)(g,z||0),(0,c.writeFloat32)(g,Y||0),(0,c.writeFloat32)(g,ve||0)}),S(1006,function(g){return g.alphaChannelNames!==void 0},function(g,L,j){if(L.alphaChannelNames)(0,a.skipBytes)(g,j());else for(L.alphaChannelNames=[];j()>0;){var ne=Z(g);L.alphaChannelNames.push(ne)}},function(g,L){for(var j=0,ne=L.alphaChannelNames;j<ne.length;j++){var z=ne[j];K(g,z)}}),S(1045,function(g){return g.alphaChannelNames!==void 0},function(g,L,j){for(L.alphaChannelNames=[];j()>0;)L.alphaChannelNames.push((0,a.readUnicodeString)(g))},function(g,L){for(var j=0,ne=L.alphaChannelNames;j<ne.length;j++){var z=ne[j];(0,c.writeUnicodeStringWithPadding)(g,z)}}),l.MOCK_HANDLERS&&S(1077,function(g){return g._ir1077!==void 0},function(g,L,j){D&&console.log("image resource 1077",j()),L._ir1077=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1077)}),S(1053,function(g){return g.alphaIdentifiers!==void 0},function(g,L,j){for(L.alphaIdentifiers=[];j()>=4;)L.alphaIdentifiers.push((0,a.readUint32)(g))},function(g,L){for(var j=0,ne=L.alphaIdentifiers;j<ne.length;j++){var z=ne[j];(0,c.writeUint32)(g,z)}}),S(1010,function(g){return g.backgroundColor!==void 0},function(g,L){return L.backgroundColor=(0,a.readColor)(g)},function(g,L){return(0,c.writeColor)(g,L.backgroundColor)}),S(1037,function(g){return g.globalAngle!==void 0},function(g,L){return L.globalAngle=(0,a.readInt32)(g)},function(g,L){return(0,c.writeInt32)(g,L.globalAngle)}),S(1049,function(g){return g.globalAltitude!==void 0},function(g,L){return L.globalAltitude=(0,a.readUint32)(g)},function(g,L){return(0,c.writeUint32)(g,L.globalAltitude)}),S(1011,function(g){return g.printFlags!==void 0},function(g,L){L.printFlags={labels:!!(0,a.readUint8)(g),cropMarks:!!(0,a.readUint8)(g),colorBars:!!(0,a.readUint8)(g),registrationMarks:!!(0,a.readUint8)(g),negative:!!(0,a.readUint8)(g),flip:!!(0,a.readUint8)(g),interpolate:!!(0,a.readUint8)(g),caption:!!(0,a.readUint8)(g),printFlags:!!(0,a.readUint8)(g)}},function(g,L){var j=L.printFlags;(0,c.writeUint8)(g,j.labels?1:0),(0,c.writeUint8)(g,j.cropMarks?1:0),(0,c.writeUint8)(g,j.colorBars?1:0),(0,c.writeUint8)(g,j.registrationMarks?1:0),(0,c.writeUint8)(g,j.negative?1:0),(0,c.writeUint8)(g,j.flip?1:0),(0,c.writeUint8)(g,j.interpolate?1:0),(0,c.writeUint8)(g,j.caption?1:0),(0,c.writeUint8)(g,j.printFlags?1:0)}),S(1034,function(g){return g.copyrighted!==void 0},function(g,L){L.copyrighted=!!(0,a.readUint8)(g)},function(g,L){(0,c.writeUint8)(g,L.copyrighted?1:0)}),S(1035,function(g){return g.url!==void 0},function(g,L,j){L.url=(0,a.readAsciiString)(g,j())},function(g,L){(0,c.writeAsciiString)(g,L.url)}),l.MOCK_HANDLERS&&S(1e4,function(g){return g._ir10000!==void 0},function(g,L,j){D&&console.log("image resource 10000",j()),L._ir10000=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir10000)}),l.MOCK_HANDLERS&&S(1013,function(g){return g._ir1013!==void 0},function(g,L,j){D&&console.log("image resource 1013",j()),L._ir1013=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1013)}),l.MOCK_HANDLERS&&S(1016,function(g){return g._ir1016!==void 0},function(g,L,j){D&&console.log("image resource 1016",j()),L._ir1016=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1016)}),S(1080,function(g){return g.countInformation!==void 0},function(g,L){L.countInformation=(0,o.readVersionAndDescriptor)(g).countGroupList.map(function(j){return{color:{r:j["Rd "],g:j["Grn "],b:j["Bl "]},name:j["Nm "],size:j["Rds "],fontSize:j.fontSize,visible:j.Vsbl,points:j.countObjectList.map(function(ne){return{x:ne["X "],y:ne["Y "]}})}})},function(g,L){var j={Vrsn:1,countGroupList:L.countInformation.map(function(ne){return{"Rd ":ne.color.r,"Grn ":ne.color.g,"Bl ":ne.color.b,"Nm ":ne.name,"Rds ":ne.size,fontSize:ne.fontSize,Vsbl:ne.visible,countObjectList:ne.points.map(function(z){return{"X ":z.x,"Y ":z.y}})}})};(0,o.writeVersionAndDescriptor)(g,"","Cnt ",j)}),S(1024,function(g){return g.layerState!==void 0},function(g,L){return L.layerState=(0,a.readUint16)(g)},function(g,L){return(0,c.writeUint16)(g,L.layerState)}),S(1026,function(g){return g.layersGroup!==void 0},function(g,L,j){for(L.layersGroup=[];j()>0;)L.layersGroup.push((0,a.readUint16)(g))},function(g,L){for(var j=0,ne=L.layersGroup;j<ne.length;j++){var z=ne[j];(0,c.writeUint16)(g,z)}}),S(1072,function(g){return g.layerGroupsEnabledId!==void 0},function(g,L,j){for(L.layerGroupsEnabledId=[];j()>0;)L.layerGroupsEnabledId.push((0,a.readUint8)(g))},function(g,L){for(var j=0,ne=L.layerGroupsEnabledId;j<ne.length;j++){var z=ne[j];(0,c.writeUint8)(g,z)}}),S(1069,function(g){return g.layerSelectionIds!==void 0},function(g,L){var j=(0,a.readUint16)(g);for(L.layerSelectionIds=[];j--;)L.layerSelectionIds.push((0,a.readUint32)(g))},function(g,L){(0,c.writeUint16)(g,L.layerSelectionIds.length);for(var j=0,ne=L.layerSelectionIds;j<ne.length;j++){var z=ne[j];(0,c.writeUint32)(g,z)}}),S(1032,function(g){return g.gridAndGuidesInformation!==void 0},function(g,L){var j=(0,a.readUint32)(g),ne=(0,a.readUint32)(g),z=(0,a.readUint32)(g),Y=(0,a.readUint32)(g);if(j!==1)throw new Error("Invalid 1032 resource version: ".concat(j));L.gridAndGuidesInformation={grid:{horizontal:ne,vertical:z},guides:[]};for(var ve=0;ve<Y;ve++)L.gridAndGuidesInformation.guides.push({location:(0,a.readUint32)(g)/32,direction:(0,a.readUint8)(g)?"horizontal":"vertical"})},function(g,L){var j=L.gridAndGuidesInformation,ne=j.grid||{horizontal:576,vertical:576},z=j.guides||[];(0,c.writeUint32)(g,1),(0,c.writeUint32)(g,ne.horizontal),(0,c.writeUint32)(g,ne.vertical),(0,c.writeUint32)(g,z.length);for(var Y=0,ve=z;Y<ve.length;Y++){var we=ve[Y];(0,c.writeUint32)(g,we.location*32),(0,c.writeUint8)(g,we.direction==="horizontal"?1:0)}}),S(1065,function(g){return g.layerComps!==void 0},function(g,L){var j=(0,o.readVersionAndDescriptor)(g,!0);L.layerComps={list:[]};for(var ne=0,z=j.list;ne<z.length;ne++){var Y=z[ne];L.layerComps.list.push({id:Y.compID,name:Y["Nm "],capturedInfo:Y.capturedInfo}),"comment"in Y&&(L.layerComps.list[L.layerComps.list.length-1].comment=Y.comment)}"lastAppliedComp"in j&&(L.layerComps.lastApplied=j.lastAppliedComp)},function(g,L){for(var j=L.layerComps,ne={list:[]},z=0,Y=j.list;z<Y.length;z++){var ve=Y[z],we={};we._classID="Comp",we["Nm "]=ve.name,"comment"in ve&&(we.comment=ve.comment),we.compID=ve.id,we.capturedInfo=ve.capturedInfo,ne.list.push(we)}"lastApplied"in j&&(ne.lastAppliedComp=j.lastApplied),(0,o.writeVersionAndDescriptor)(g,"","CompList",ne)}),l.MOCK_HANDLERS&&S(1092,function(g){return g._ir1092!==void 0},function(g,L,j){D&&console.log("image resource 1092",j()),L._ir1092=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1092)});var Q=["normal",void 0,void 0,void 0,void 0,void 0,void 0,"multiply","screen",void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,"difference"];S(1078,function(g){return g.onionSkins!==void 0},function(g,L){var j=(0,o.readVersionAndDescriptor)(g);L.onionSkins={enabled:j.enab,framesBefore:j.numBefore,framesAfter:j.numAfter,frameSpacing:j.Spcn,minOpacity:j.minOpacity/100,maxOpacity:j.maxOpacity/100,blendMode:Q[j.BlnM]||"normal"}},function(g,L){var j=L.onionSkins,ne={Vrsn:1,enab:j.enabled,numBefore:j.framesBefore,numAfter:j.framesAfter,Spcn:j.frameSpacing,minOpacity:j.minOpacity*100|0,maxOpacity:j.maxOpacity*100|0,BlnM:Math.max(0,Q.indexOf(j.blendMode))};(0,o.writeVersionAndDescriptor)(g,"","null",ne)}),S(1075,function(g){return g.timelineInformation!==void 0},function(g,L){var j,ne,z=(0,o.readVersionAndDescriptor)(g);L.timelineInformation={enabled:z.enab,frameStep:(0,o.frac)(z.frameStep),frameRate:z.frameRate,time:(0,o.frac)(z.time),duration:(0,o.frac)(z.duration),workInTime:(0,o.frac)(z.workInTime),workOutTime:(0,o.frac)(z.workOutTime),repeats:z.LCnt,hasMotion:z.hasMotion,globalTracks:(0,o.parseTrackList)(z.globalTrackList,!!g.logMissingFeatures)},!((ne=(j=z.audioClipGroupList)===null||j===void 0?void 0:j.audioClipGroupList)===null||ne===void 0)&&ne.length&&(L.timelineInformation.audioClipGroups=z.audioClipGroupList.audioClipGroupList.map(function(Y){return{id:Y.groupID,muted:Y.muted,audioClips:Y.audioClipList.map(function(ve){var we=ve.clipID,_e=ve.timeScope,ie=ve.muted,pe=ve.audioLevel,fe=ve.frameReader;return{id:we,start:(0,o.frac)(_e.Strt),duration:(0,o.frac)(_e.duration),inTime:(0,o.frac)(_e.inTime),outTime:(0,o.frac)(_e.outTime),muted:ie,audioLevel:pe,frameReader:{type:fe.frameReaderType,mediaDescriptor:fe.mediaDescriptor,link:{name:fe["Lnk "]["Nm "],fullPath:fe["Lnk "].fullPath,relativePath:fe["Lnk "].relPath}}}})}}))},function(g,L){var j,ne=L.timelineInformation,z={Vrsn:1,enab:ne.enabled,frameStep:ne.frameStep,frameRate:ne.frameRate,time:ne.time,duration:ne.duration,workInTime:ne.workInTime,workOutTime:ne.workOutTime,LCnt:ne.repeats,globalTrackList:(0,o.serializeTrackList)(ne.globalTracks),audioClipGroupList:{audioClipGroupList:(j=ne.audioClipGroups)===null||j===void 0?void 0:j.map(function(Y){return{groupID:Y.id,muted:Y.muted,audioClipList:Y.audioClips.map(function(ve){return{clipID:ve.id,timeScope:{Vrsn:1,Strt:ve.start,duration:ve.duration,inTime:ve.inTime,outTime:ve.outTime},frameReader:{frameReaderType:ve.frameReader.type,descVersion:1,"Lnk ":{descVersion:1,"Nm ":ve.frameReader.link.name,fullPath:ve.frameReader.link.fullPath,relPath:ve.frameReader.link.relativePath},mediaDescriptor:ve.frameReader.mediaDescriptor},muted:ve.muted,audioLevel:ve.audioLevel}})}})},hasMotion:ne.hasMotion};(0,o.writeVersionAndDescriptor)(g,"","null",z,"anim")}),S(1076,function(g){return g.sheetDisclosure!==void 0},function(g,L){var j=(0,o.readVersionAndDescriptor)(g);L.sheetDisclosure={},j.sheetTimelineOptions&&(L.sheetDisclosure.sheetTimelineOptions=j.sheetTimelineOptions.map(function(ne){return{sheetID:ne.sheetID,sheetDisclosed:ne.sheetDisclosed,lightsDisclosed:ne.lightsDisclosed,meshesDisclosed:ne.meshesDisclosed,materialsDisclosed:ne.materialsDisclosed}}))},function(g,L){var j=L.sheetDisclosure,ne={Vrsn:1};j.sheetTimelineOptions&&(ne.sheetTimelineOptions=j.sheetTimelineOptions.map(function(z){return{Vrsn:2,sheetID:z.sheetID,sheetDisclosed:z.sheetDisclosed,lightsDisclosed:z.lightsDisclosed,meshesDisclosed:z.meshesDisclosed,materialsDisclosed:z.materialsDisclosed}})),(0,o.writeVersionAndDescriptor)(g,"","null",ne)}),S(1054,function(g){return g.urlsList!==void 0},function(g,L){var j=(0,a.readUint32)(g);L.urlsList=[];for(var ne=0;ne<j;ne++){if((0,a.readSignature)(g)!=="slic"&&g.throwForMissingFeatures)throw new Error("Unknown long");var z=(0,a.readUint32)(g),Y=(0,a.readUnicodeString)(g);L.urlsList.push({id:z,url:Y,ref:"slice"})}},function(g,L){var j=L.urlsList;(0,c.writeUint32)(g,j.length);for(var ne=0;ne<j.length;ne++)(0,c.writeSignature)(g,"slic"),(0,c.writeUint32)(g,j[ne].id),(0,c.writeUnicodeString)(g,j[ne].url)});function V(g){return{"Top ":g.top,Left:g.left,Btom:g.bottom,Rght:g.right}}function te(g){return{top:g["Top "],left:g.Left,bottom:g.Btom,right:g.Rght}}function J(g,L){return g[Math.max(0,Math.min(g.length-1,L))]}var G=["autoGenerated","layer","userGenerated"],$=["noImage","image"],ce=["default"];S(1050,function(g){return g.slices?g.slices.length:0},function(g,L){var j=(0,a.readUint32)(g);if(j===6){L.slices||(L.slices=[]);var ne=(0,a.readInt32)(g),z=(0,a.readInt32)(g),Y=(0,a.readInt32)(g),ve=(0,a.readInt32)(g),we=(0,a.readUnicodeString)(g),_e=(0,a.readUint32)(g);L.slices.push({bounds:{top:ne,left:z,bottom:Y,right:ve},groupName:we,slices:[]});for(var ie=L.slices[L.slices.length-1].slices,pe=0;pe<_e;pe++){var fe=(0,a.readUint32)(g),ge=(0,a.readUint32)(g),ke=J(G,(0,a.readUint32)(g)),Ee=ke=="layer"?(0,a.readUint32)(g):0,Ie=(0,a.readUnicodeString)(g),De=J($,(0,a.readUint32)(g)),Ue=(0,a.readInt32)(g),Ne=(0,a.readInt32)(g),Me=(0,a.readInt32)(g),Ce=(0,a.readInt32)(g),Ge=(0,a.readUnicodeString)(g),qe=(0,a.readUnicodeString)(g),ae=(0,a.readUnicodeString)(g),le=(0,a.readUnicodeString)(g),p=!!(0,a.readUint8)(g),m=(0,a.readUnicodeString)(g),O=J(ce,(0,a.readUint32)(g)),y=J(ce,(0,a.readUint32)(g)),F=(0,a.readUint8)(g),e=(0,a.readUint8)(g),u=(0,a.readUint8)(g),f=(0,a.readUint8)(g),k=F+e+u+f===0?"none":F===0?"matte":"color";ie.push({id:fe,groupId:ge,origin:ke,associatedLayerId:Ee,name:Ie,target:qe,message:ae,altTag:le,cellTextIsHTML:p,cellText:m,horizontalAlignment:O,verticalAlignment:y,type:De,url:Ge,bounds:{top:Ne,left:Ue,bottom:Ce,right:Me},backgroundColorType:k,backgroundColor:{r:e,g:u,b:f,a:F}})}var v=(0,o.readVersionAndDescriptor)(g);v.slices.forEach(function(i){var n=ie.find(function(w){return i.sliceID==w.id});n&&(n.topOutset=i.topOutset,n.leftOutset=i.leftOutset,n.bottomOutset=i.bottomOutset,n.rightOutset=i.rightOutset)})}else if(j===7||j===8){var v=(0,o.readVersionAndDescriptor)(g);L.slices||(L.slices=[]),L.slices.push({groupName:v.baseName,bounds:te(v.bounds),slices:v.slices.map(function(n){return r(r({},n["Nm "]?{name:n["Nm "]}:{}),{id:n.sliceID,groupId:n.groupID,associatedLayerId:0,origin:o.ESliceOrigin.decode(n.origin),type:o.ESliceType.decode(n.Type),bounds:te(n.bounds),url:n.url,target:n.null,message:n.Msge,altTag:n.altTag,cellTextIsHTML:n.cellTextIsHTML,cellText:n.cellText,horizontalAlignment:o.ESliceHorzAlign.decode(n.horzAlign),verticalAlignment:o.ESliceVertAlign.decode(n.vertAlign),backgroundColorType:o.ESliceBGColorType.decode(n.bgColorType),backgroundColor:n.bgColor?{r:n.bgColor["Rd "],g:n.bgColor["Grn "],b:n.bgColor["Bl "],a:n.bgColor.alpha}:{r:0,g:0,b:0,a:0},topOutset:n.topOutset||0,leftOutset:n.leftOutset||0,bottomOutset:n.bottomOutset||0,rightOutset:n.rightOutset||0})})})}else throw new Error("Invalid slices version (".concat(j,")"))},function(g,L,j){var ne=L.slices[j],z=ne.bounds,Y=ne.groupName,ve=ne.slices;(0,c.writeUint32)(g,6),(0,c.writeInt32)(g,z.top),(0,c.writeInt32)(g,z.left),(0,c.writeInt32)(g,z.bottom),(0,c.writeInt32)(g,z.right),(0,c.writeUnicodeString)(g,Y),(0,c.writeUint32)(g,ve.length);for(var we=0;we<ve.length;we++){var _e=ve[we],ie=_e.backgroundColor,pe=ie.a,fe=ie.r,ge=ie.g,ke=ie.b;_e.backgroundColorType==="none"?pe=fe=ge=ke=0:_e.backgroundColorType==="matte"&&(pe=0,fe=ge=ke=255),(0,c.writeUint32)(g,_e.id),(0,c.writeUint32)(g,_e.groupId),(0,c.writeUint32)(g,G.indexOf(_e.origin)),_e.origin==="layer"&&(0,c.writeUint32)(g,_e.associatedLayerId),(0,c.writeUnicodeString)(g,_e.name||""),(0,c.writeUint32)(g,$.indexOf(_e.type)),(0,c.writeInt32)(g,_e.bounds.left),(0,c.writeInt32)(g,_e.bounds.top),(0,c.writeInt32)(g,_e.bounds.right),(0,c.writeInt32)(g,_e.bounds.bottom),(0,c.writeUnicodeString)(g,_e.url),(0,c.writeUnicodeString)(g,_e.target),(0,c.writeUnicodeString)(g,_e.message),(0,c.writeUnicodeString)(g,_e.altTag),(0,c.writeUint8)(g,_e.cellTextIsHTML?1:0),(0,c.writeUnicodeString)(g,_e.cellText),(0,c.writeUint32)(g,ce.indexOf(_e.horizontalAlignment)),(0,c.writeUint32)(g,ce.indexOf(_e.verticalAlignment)),(0,c.writeUint8)(g,pe),(0,c.writeUint8)(g,fe),(0,c.writeUint8)(g,ge),(0,c.writeUint8)(g,ke)}var Ee={bounds:V(z),slices:[]};ve.forEach(function(Ie){var De=r(r({sliceID:Ie.id,groupID:Ie.groupId,origin:o.ESliceOrigin.encode(Ie.origin),Type:o.ESliceType.encode(Ie.type),bounds:V(Ie.bounds)},Ie.name?{"Nm ":Ie.name}:{}),{url:Ie.url,null:Ie.target,Msge:Ie.message,altTag:Ie.altTag,cellTextIsHTML:Ie.cellTextIsHTML,cellText:Ie.cellText,horzAlign:o.ESliceHorzAlign.encode(Ie.horizontalAlignment),vertAlign:o.ESliceVertAlign.encode(Ie.verticalAlignment),bgColorType:o.ESliceBGColorType.encode(Ie.backgroundColorType)});if(Ie.backgroundColorType==="color"){var Ue=Ie.backgroundColor;De.bgColor={"Rd ":Ue.r,"Grn ":Ue.g,"Bl ":Ue.b,alpha:Ue.a}}De.topOutset=Ie.topOutset||0,De.leftOutset=Ie.leftOutset||0,De.bottomOutset=Ie.bottomOutset||0,De.rightOutset=Ie.rightOutset||0,Ee.slices.push(De)}),(0,o.writeVersionAndDescriptor)(g,"","null",Ee,"slices")}),S(1064,function(g){return g.pixelAspectRatio!==void 0},function(g,L){if((0,a.readUint32)(g)>2)throw new Error("Invalid pixelAspectRatio version");L.pixelAspectRatio={aspect:(0,a.readFloat64)(g)}},function(g,L){(0,c.writeUint32)(g,2),(0,c.writeFloat64)(g,L.pixelAspectRatio.aspect)}),S(1041,function(g){return g.iccUntaggedProfile!==void 0},function(g,L){L.iccUntaggedProfile=!!(0,a.readUint8)(g)},function(g,L){(0,c.writeUint8)(g,L.iccUntaggedProfile?1:0)}),l.MOCK_HANDLERS&&S(1039,function(g){return g._ir1039!==void 0},function(g,L,j){D&&console.log("image resource 1039",j()),L._ir1039=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1039)}),S(1044,function(g){return g.idsSeedNumber!==void 0},function(g,L){return L.idsSeedNumber=(0,a.readUint32)(g)},function(g,L){return(0,c.writeUint32)(g,L.idsSeedNumber)}),S(1036,function(g){return g.thumbnail!==void 0||g.thumbnailRaw!==void 0},function(g,L,j){var ne=(0,a.readUint32)(g),z=(0,a.readUint32)(g),Y=(0,a.readUint32)(g);(0,a.readUint32)(g),(0,a.readUint32)(g),(0,a.readUint32)(g);var ve=(0,a.readUint16)(g),we=(0,a.readUint16)(g);if(ne!==1||ve!==24||we!==1){g.logMissingFeatures&&g.log("Invalid thumbnail data (format: ".concat(ne,", bitsPerPixel: ").concat(ve,", planes: ").concat(we,")")),(0,a.skipBytes)(g,j());return}var _e=j(),ie=(0,a.readBytes)(g,_e);g.useRawThumbnail?L.thumbnailRaw={width:z,height:Y,data:ie}:ie.byteLength&&(L.thumbnail=(0,l.createCanvasFromData)(ie))},function(g,L){var j,ne=0,z=0,Y=new Uint8Array(0);if(L.thumbnailRaw)ne=L.thumbnailRaw.width,z=L.thumbnailRaw.height,Y=L.thumbnailRaw.data;else try{var ve=(j=L.thumbnail.toDataURL("image/jpeg",1))===null||j===void 0?void 0:j.substring(23);ve&&(Y=(0,s.toByteArray)(ve),ne=L.thumbnail.width,z=L.thumbnail.height)}catch{}var we=24,_e=Math.floor((ne*we+31)/32)*4,ie=1,pe=_e*z*ie,fe=Y.length;(0,c.writeUint32)(g,1),(0,c.writeUint32)(g,ne),(0,c.writeUint32)(g,z),(0,c.writeUint32)(g,_e),(0,c.writeUint32)(g,pe),(0,c.writeUint32)(g,fe),(0,c.writeUint16)(g,we),(0,c.writeUint16)(g,ie),(0,c.writeBytes)(g,Y)}),S(1057,function(g){return g.versionInfo!==void 0},function(g,L,j){if((0,a.readUint32)(g)!==1)throw new Error("Invalid versionInfo version");L.versionInfo={hasRealMergedData:!!(0,a.readUint8)(g),writerName:(0,a.readUnicodeString)(g),readerName:(0,a.readUnicodeString)(g),fileVersion:(0,a.readUint32)(g)},(0,a.skipBytes)(g,j())},function(g,L){var j=L.versionInfo;(0,c.writeUint32)(g,1),(0,c.writeUint8)(g,j.hasRealMergedData?1:0),(0,c.writeUnicodeString)(g,j.writerName),(0,c.writeUnicodeString)(g,j.readerName),(0,c.writeUint32)(g,j.fileVersion)}),l.MOCK_HANDLERS&&S(1058,function(g){return g._ir1058!==void 0},function(g,L,j){D&&console.log("image resource 1058",j()),L._ir1058=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1058)}),S(7e3,function(g){return g.imageReadyVariables!==void 0},function(g,L,j){L.imageReadyVariables=H(g,j())},function(g,L){ee(g,L.imageReadyVariables)}),S(7001,function(g){return g.imageReadyDataSets!==void 0},function(g,L,j){L.imageReadyDataSets=H(g,j())},function(g,L){ee(g,L.imageReadyDataSets)}),S(1088,function(g){return g.pathSelectionState!==void 0},function(g,L,j){L.pathSelectionState=(0,o.readVersionAndDescriptor)(g).null},function(g,L){var j={null:L.pathSelectionState};(0,o.writeVersionAndDescriptor)(g,"","null",j)}),l.MOCK_HANDLERS&&S(1025,function(g){return g._ir1025!==void 0},function(g,L,j){D&&console.log("image resource 1025",j()),L._ir1025=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir1025)});var se=(0,l.createEnum)("FrmD","",{auto:"Auto",none:"None",dispose:"Disp"});S(4e3,function(g){return g.animations!==void 0},function(g,L,j){var ne=(0,a.readSignature)(g);if(ne==="mani")(0,a.checkSignature)(g,"IRFR"),(0,a.readSection)(g,1,function(Y){for(var ve=function(){(0,a.checkSignature)(g,"8BIM");var we=(0,a.readSignature)(g);(0,a.readSection)(g,1,function(_e){if(we==="AnDs"){var ie=(0,o.readVersionAndDescriptor)(g);L.animations={frames:ie.FrIn.map(function(fe){return{id:fe.FrID,delay:(fe.FrDl||0)/100,dispose:fe.FrDs?se.decode(fe.FrDs):"auto"}}),animations:ie.FSts.map(function(fe){return{id:fe.FsID,frames:fe.FsFr,repeats:fe.LCnt,activeFrame:fe.AFrm||0}})}}else if(we==="Roll"){var pe=(0,a.readBytes)(g,_e());g.logDevFeatures&&g.log("#4000 Roll",pe)}else g.logMissingFeatures&&g.log("Unhandled subsection in #4000",we)})};Y()>0;)ve()});else if(ne==="mopt"){var z=(0,a.readBytes)(g,j());g.logDevFeatures&&g.log("#4000 mopt",z)}else g.logMissingFeatures&&g.log("Unhandled key in #4000:",ne)},function(g,L){L.animations&&((0,c.writeSignature)(g,"mani"),(0,c.writeSignature)(g,"IRFR"),(0,c.writeSection)(g,1,function(){(0,c.writeSignature)(g,"8BIM"),(0,c.writeSignature)(g,"AnDs"),(0,c.writeSection)(g,1,function(){for(var j={FrIn:[],FSts:[]},ne=0;ne<L.animations.frames.length;ne++){var z=L.animations.frames[ne],Y={FrID:z.id};z.delay&&(Y.FrDl=z.delay*100|0),Y.FrDs=se.encode(z.dispose),j.FrIn.push(Y)}for(var ne=0;ne<L.animations.animations.length;ne++){var ve=L.animations.animations[ne],we={FsID:ve.id,AFrm:ve.activeFrame|0,FsFr:ve.frames,LCnt:ve.repeats|0};j.FSts.push(we)}(0,o.writeVersionAndDescriptor)(g,"","null",j)})}))}),l.MOCK_HANDLERS&&S(4001,function(g){return g._ir4001!==void 0},function(g,L,j){if(l.MOCK_HANDLERS){D&&console.log("image resource 4001",j()),L._ir4001=(0,a.readBytes)(g,j());return}var ne=(0,a.readSignature)(g);if(ne==="mfri"){if((0,a.readUint32)(g)!==2)throw new Error("Invalid mfri version");var z=(0,a.readUint32)(g),Y=(0,a.readBytes)(g,z);g.logDevFeatures&&g.log("mfri",Y)}else if(ne==="mset"){var ve=(0,o.readVersionAndDescriptor)(g);g.logDevFeatures&&g.log("mset",ve)}else g.logMissingFeatures&&g.log("Unhandled key in #4001",ne)},function(g,L){(0,c.writeBytes)(g,L._ir4001)}),l.MOCK_HANDLERS&&S(4002,function(g){return g._ir4002!==void 0},function(g,L,j){D&&console.log("image resource 4002",j()),L._ir4002=(0,a.readBytes)(g,j())},function(g,L){(0,c.writeBytes)(g,L._ir4002)})})),$t=je((t=>{var r=t&&t.__rest||function(i,n){var w={};for(var E in i)Object.prototype.hasOwnProperty.call(i,E)&&n.indexOf(E)<0&&(w[E]=i[E]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var C=0,E=Object.getOwnPropertySymbols(i);C<E.length;C++)n.indexOf(E[C])<0&&Object.prototype.propertyIsEnumerable.call(i,E[C])&&(w[E[C]]=i[E[C]]);return w};Object.defineProperty(t,"__esModule",{value:!0}),t.readPattern=t.readColor=t.readSection=t.readDataRLE=t.readDataZip=t.createImageDataBitDepth=t.readAdditionalLayerInfo=t.readGlobalLayerMaskInfo=t.decodeLayerImageData=t.readLayerInfo=t.readPsd=t.checkSignature=t.skipBytes=t.readAsciiString=t.readUnicodeStringWithLengthLE=t.readUnicodeStringWithLength=t.readUnicodeString=t.readPascalString=t.validSignatureAt=t.readSignature=t.readBytes=t.readFixedPointPath32=t.readFixedPoint32=t.readFloat64=t.readFloat32=t.readUint32=t.readInt32LE=t.readInt32=t.readUint16LE=t.readUint16=t.readInt16=t.peekUint8=t.readUint8=t.warnOrThrow=t.createReader=t.supportedColorModes=void 0;var s=Ro(),a=Wt(),c=gi(),l=No();t.supportedColorModes=[0,1,3,2];var h=["bitmap","grayscale","indexed","RGB","CMYK","multichannel","duotone","lab"];function o(i){for(var n=i.width*i.height*4,w=0;w<n;w+=4){var E=i.data[w];i.data[w+1]=E,i.data[w+2]=E}}function S(i,n,w){return{view:new DataView(i,n,w),offset:0,strict:!1,debug:!1,large:!1,globalAlpha:!1,log:console.log}}t.createReader=S;function D(i,n){if(i.strict)throw new Error(n);i.debug&&i.log(n)}t.warnOrThrow=D;function U(i){return i.offset+=1,i.view.getUint8(i.offset-1)}t.readUint8=U;function M(i){return i.view.getUint8(i.offset)}t.peekUint8=M;function _(i){return i.offset+=2,i.view.getInt16(i.offset-2,!1)}t.readInt16=_;function x(i){return i.offset+=2,i.view.getUint16(i.offset-2,!1)}t.readUint16=x;function I(i){return i.offset+=2,i.view.getUint16(i.offset-2,!0)}t.readUint16LE=I;function H(i){return i.offset+=4,i.view.getInt32(i.offset-4,!1)}t.readInt32=H;function ee(i){return i.offset+=4,i.view.getInt32(i.offset-4,!0)}t.readInt32LE=ee;function Z(i){return i.offset+=4,i.view.getUint32(i.offset-4,!1)}t.readUint32=Z;function K(i){return i.offset+=4,i.view.getFloat32(i.offset-4,!1)}t.readFloat32=K;function W(i){return i.offset+=8,i.view.getFloat64(i.offset-8,!1)}t.readFloat64=W;function X(i){return H(i)/65536}t.readFixedPoint32=X;function Q(i){return H(i)/(1<<24)}t.readFixedPointPath32=Q;function V(i,n){var w=i.view.byteOffset+i.offset;if(i.offset+=n,w+n>i.view.buffer.byteLength){if(D(i,"Reading bytes exceeding buffer length"),n>100*1024*1024)throw new Error("Reading past end of file");var E=new Uint8Array(n),C=Math.min(n,i.view.byteLength-w);return C>0&&E.set(new Uint8Array(i.view.buffer,w,C)),E}else return new Uint8Array(i.view.buffer,w,n)}t.readBytes=V;function te(i){return ne(i,4)}t.readSignature=te;function J(i,n){var w=String.fromCharCode(i.view.getUint8(n))+String.fromCharCode(i.view.getUint8(n+1))+String.fromCharCode(i.view.getUint8(n+2))+String.fromCharCode(i.view.getUint8(n+3));return w=="8BIM"||w=="8B64"}t.validSignatureAt=J;function G(i,n){for(var w=U(i),E=w?ne(i,w):"";++w%n;)i.offset++;return E}t.readPascalString=G;function $(i){return ce(i,Z(i))}t.readUnicodeString=$;function ce(i,n){for(var w="";n--;){var E=x(i);(E||n>0)&&(w+=String.fromCharCode(E))}return w}t.readUnicodeStringWithLength=ce;function se(i,n){for(var w="";n--;){var E=I(i);(E||n>0)&&(w+=String.fromCharCode(E))}return w}t.readUnicodeStringWithLengthLE=se;function g(i,n){for(var w="";n--;)w+=String.fromCharCode(U(i));return w}t.readAsciiString=g;function L(i,n){i.offset+=n}t.skipBytes=L;function j(i,n,w){var E=i.offset,C=te(i);if(C!==n&&C!==w)throw new Error("Invalid signature: '".concat(C,"' at 0x").concat(E.toString(16)))}t.checkSignature=j;function ne(i,n){for(var w=V(i,n),E="",C=0;C<w.length;C++)E+=String.fromCharCode(w[C]);return E}function z(i){return i==="8BIM"||i==="MeSa"||i==="AgHg"||i==="PHUT"||i==="DCSR"}function Y(i,n){var w;n===void 0&&(n={}),j(i,"8BPS");var E=x(i);if(E!==1&&E!==2)throw new Error("Invalid PSD file version: ".concat(E));L(i,6);var C=x(i),R=Z(i),oe=Z(i),ue=x(i),re=x(i),he=E===1?3e4:3e5;if(oe>he||R>he)throw new Error("Invalid size: ".concat(oe,"x").concat(R));if(C>16)throw new Error("Invalid channel count: ".concat(C));if(![1,8,16,32].includes(ue))throw new Error("Invalid bitsPerChannel: ".concat(ue));if(t.supportedColorModes.indexOf(re)===-1)throw new Error("Color mode not supported: ".concat((w=h[re])!==null&&w!==void 0?w:re));var A={width:oe,height:R,channels:C,bitsPerChannel:ue,colorMode:re};Object.assign(i,n),i.large=E===2,i.globalAlpha=!1,u(i,1,function(He){if(He()){if(re===2){if(He()!=768)throw new Error("Invalid color palette size");A.palette=[];for(var T=0;T<256;T++)A.palette.push({r:U(i),g:0,b:0});for(var T=0;T<256;T++)A.palette[T].g=U(i);for(var T=0;T<256;T++)A.palette[T].b=U(i)}L(i,He())}});var Se={};u(i,1,function(He){for(var T=function(){Ue(i,z);var d=x(i);G(i,2),u(i,2,function(N){var P=l.resourceHandlersMap[d],me=d===1036&&!!i.skipThumbnail;if(P&&!me)try{P.read(i,Se,N)}catch(be){if(i.throwForMissingFeatures)throw be;L(i,N())}else L(i,N())})};He()>0;)T()}),Se.layersGroup,Se.layerGroupsEnabledId;var Pe=r(Se,["layersGroup","layerGroupsEnabledId"]);Object.keys(Pe)&&(A.imageResources=Pe),u(i,1,function(He){if(u(i,2,function(d){ve(i,A,Se),L(i,d())},void 0,i.large),He()>0){var T=Ie(i);T&&(A.globalLayerMaskInfo=T)}else L(i,He());for(;He()>0;){for(;He()&&M(i)===0;)L(i,1);He()>=12?Me(i,A,A,Se):L(i,He())}},void 0,i.large);var Te=A.children&&A.children.length;return i.skipCompositeImageData&&(i.skipLayerImageData||Te)||Ge(i,A),A}t.readPsd=Y;function ve(i,n,w){var E,C,R=w.layersGroup,oe=R===void 0?[]:R,ue=w.layerGroupsEnabledId,re=ue===void 0?[]:ue,he=_(i);he<0&&(i.globalAlpha=!0,he=-he);for(var A=[],Se=[],Pe=0;Pe<he;Pe++){var Te=we(i,n,w),He=Te.layer,T=Te.channels;oe[Pe]!==void 0&&(He.linkGroup=oe[Pe]),re[Pe]!==void 0&&(He.linkGroupEnabled=!!re[Pe]),A.push(He),Se.push(T)}for(var Pe=0;Pe<he;Pe++)fe(i,n,A[Pe],Se[Pe]);n.children||(n.children=[]);for(var d=[n],Pe=A.length-1;Pe>=0;Pe--){var N=A[Pe],P=N.sectionDivider?N.sectionDivider.type:0;P===1||P===2?(N.opened=P===1,N.children=[],!((E=N.sectionDivider)===null||E===void 0)&&E.key&&(N.blendMode=(C=a.toBlendMode[N.sectionDivider.key])!==null&&C!==void 0?C:N.blendMode),d[d.length-1].children.unshift(N),d.push(N)):P===3?d.pop():d[d.length-1].children.unshift(N)}}t.readLayerInfo=ve;function we(i,n,w){var E={};E.top=H(i),E.left=H(i),E.bottom=H(i),E.right=H(i);for(var C=x(i),R=[],oe=0;oe<C;oe++){var ue=_(i),re=Z(i);if(i.large){if(re!==0)throw new Error("Sizes larger than 4GB are not supported");re=Z(i)}R.push({id:ue,length:re})}j(i,"8BIM");var he=te(i);if(!a.toBlendMode[he])throw new Error("Invalid blend mode: '".concat(he,"'"));E.blendMode=a.toBlendMode[he],E.opacity=U(i)/255,E.clipping=U(i)===1;var A=U(i);return E.transparencyProtected=(A&1)!==0,E.hidden=(A&2)!==0,A&32&&(E.effectsOpen=!0),L(i,1),u(i,1,function(Se){_e(i,E);var Pe=pe(i);for(Pe&&(E.blendingRanges=Pe),E.name=G(i,1);Se()>4&&!J(i,i.offset);)i.offset++;for(;Se()>=12;)Me(i,E,n,w);L(i,Se())}),{layer:E,channels:R}}function _e(i,n){return u(i,1,function(w){if(w()){var E={};n.mask=E,E.top=H(i),E.left=H(i),E.bottom=H(i),E.right=H(i),E.defaultColor=U(i);var C=U(i);if(E.positionRelativeToLayer=(C&1)!==0,E.disabled=(C&2)!==0,E.fromVectorData=(C&8)!==0,w()>=18){var R={};n.realMask=R;var oe=U(i);R.positionRelativeToLayer=(oe&1)!==0,R.disabled=(oe&2)!==0,R.fromVectorData=(oe&8)!==0,R.defaultColor=U(i),R.top=H(i),R.left=H(i),R.bottom=H(i),R.right=H(i)}if(C&16){var ue=U(i);ue&1&&(E.userMaskDensity=U(i)/255),ue&2&&(E.userMaskFeather=W(i)),ue&4&&(E.vectorMaskDensity=U(i)/255),ue&8&&(E.vectorMaskFeather=W(i))}L(i,w())}})}function ie(i){return[U(i),U(i),U(i),U(i)]}function pe(i){return u(i,1,function(n){for(var w=ie(i),E=ie(i),C=[];n()>0;){var R=ie(i),oe=ie(i);C.push({sourceRange:R,destRange:oe})}return{compositeGrayBlendSource:w,compositeGraphBlendDestinationRange:E,ranges:C}})}function fe(i,n,w,E){if(!i.skipLayerImageData){var C=n.colorMode,R=C===void 0?3:C,oe=n.bitsPerChannel;w.rawData={colorMode:R,bitsPerChannel:oe===void 0?8:oe,channels:[],large:i.large};for(var ue=0,re=E;ue<re.length;ue++){var he=re[ue],A=i.offset,Se=0,Pe=void 0;if(he.length===1)throw new Error("Invalid channel length");if(he.length){if(Se=x(i),Se>3&&(i.offset-=1,Se=x(i)),Se>3&&(i.offset-=3,Se=x(i)),Se>3)throw new Error("Invalid compression: ".concat(Se));he.length>2&&(Pe=V(i,he.length-2))}i.offset=A+he.length,w.rawData.channels.push({id:he.id,compression:Se,data:Pe})}i.useRawData||ke(w,!!i.useImageData,!!i.throwForMissingFeatures)}}function ge(i,n){for(var w=i.data,E=w instanceof Float32Array?1:w instanceof Uint16Array?65535:255,C=(n?4:3)|0,R=w.length|0,oe=(n?5:4)|0,ue=C;ue<R;ue=ue+oe|0)w[ue]=E}function ke(i,n,w){if(i.rawData){var E=i.rawData,C=E.colorMode,R=E.bitsPerChannel,oe=E.channels,ue=E.large,re=(i.right||0)-(i.left||0),he=(i.bottom||0)-(i.top||0),A=C===4,Se,Pe=!1;if(re&&he)if(A){if(R!==8)throw new Error("bitsPerChannel Not supproted");Se={width:re,height:he,data:new Uint8ClampedArray(re*he*5)}}else Se=Ce(re,he,R);a.RAW_IMAGE_DATA&&(i.imageDataRaw=[],i.imageDataRawCompression=[]);for(var Te=0,He=oe;Te<He.length;Te++){var T=He[Te],d=T.id,N=T.compression,P=T.data;if(P){var me=S(P.buffer,P.byteOffset,P.byteLength);if(d===-2||d===-3){var be=d===-2?i.mask:i.realMask;if(!be)throw new Error("Missing layer ".concat(d===-2?"mask":"real mask"," data"));var ye=(be.right||0)-(be.left||0),xe=(be.bottom||0)-(be.top||0);if(ye<0||xe<0||ye>3e4||xe>3e4)throw new Error("Invalid mask size");if(ye&&xe){var Re=Ce(ye,xe,R);Ee(me,P.byteLength,Re,N,ye,xe,R,0,ue,4),a.RAW_IMAGE_DATA&&(d===-2?(i.maskDataRawCompression=N,i.maskDataRaw=P):(i.realMaskDataRawCompression=N,i.realMaskDataRaw=P)),o(Re),ge(Re,!1),n?be.imageData=Re:be.canvas=(0,a.imageDataToCanvas)(Re)}}else{var Be=(0,a.offsetForChannel)(d,A),Le=Se;if(Be<0&&(Le=void 0,w))throw new Error("Channel not supported: ".concat(d));Ee(me,P.byteLength,Le,N,re,he,R,Be,ue,A?5:4),a.RAW_IMAGE_DATA&&(i.imageDataRawCompression[d]=N,i.imageDataRaw[d]=P),Le&&C===1&&o(Le)}d===-1&&(Pe=!0)}}if(Se){if(Pe||ge(Se,A),A){var $e=Se;Se=(0,a.createImageData)($e.width,$e.height),qe($e,Se,!1)}n?i.imageData=Se:i.canvas=(0,a.imageDataToCanvas)(Se)}delete i.rawData}}t.decodeLayerImageData=ke;function Ee(i,n,w,E,C,R,oe,ue,re,he){if(n)if(E===0){n!==C*R*Math.floor(oe/8)&&i.log("Invalid length (".concat(n,", ").concat(C*R*Math.floor(oe/8),")"));var A=V(i,n);O(A,w,oe,he,ue)}else if(E===1)e(i,w,C,R,oe,he,[ue],re);else if(E===2){var A=V(i,n);F(A,w,C,R,oe,he,ue,!1)}else if(E===3){var A=V(i,n);F(A,w,C,R,oe,he,ue,!0)}else throw new Error("Invalid Compression type: ".concat(E))}function Ie(i){return u(i,1,function(n){if(n()){var w=x(i),E=x(i),C=x(i),R=x(i),oe=x(i),ue=x(i)/255,re=U(i);return L(i,n()),{overlayColorSpace:w,colorSpace1:E,colorSpace2:C,colorSpace3:R,colorSpace4:oe,opacity:ue,kind:re}}})}t.readGlobalLayerMaskInfo=Ie;var De=[0,1,-1,2,-2,3,-3,4,-4];function Ue(i,n){for(var w=i.offset,E="",C=0,R=De;C<R.length;C++){var oe=R[C];try{i.offset=w+oe,E=te(i)}catch{}if(n(E))break}if(!n(E))throw new Error("Invalid signature: '".concat(E,"' at 0x").concat(w.toString(16)));return E}function Ne(i){return i==="8BIM"||i==="8B64"}function Me(i,n,w,E){var C=Ue(i,Ne),R=te(i);u(i,2,function(oe){var ue=c.infoHandlersMap[R];if(ue)try{ue.read(i,n,oe,w,E)}catch(re){if(i.throwForMissingFeatures)throw re}else i.logMissingFeatures&&i.log("Unhandled additional info: ".concat(R)),L(i,oe());oe()&&(i.logMissingFeatures&&i.log("Unread ".concat(oe()," bytes left for additional info: ").concat(R)),L(i,oe()))},!1,C==="8B64"||i.large&&a.largeAdditionalInfoKeys.indexOf(R)!==-1)}t.readAdditionalLayerInfo=Me;function Ce(i,n,w,E){if(E===void 0&&(E=4),w===1||w===8)return E===4?(0,a.createImageData)(i,n):{width:i,height:n,data:new Uint8ClampedArray(i*n*E)};if(w===16)return{width:i,height:n,data:new Uint16Array(i*n*E)};if(w===32)return{width:i,height:n,data:new Float32Array(i*n*E)};throw new Error("Invalid bitDepth (".concat(w,")"))}t.createImageDataBitDepth=Ce;function Ge(i,n){var w,E=x(i),C=(w=n.bitsPerChannel)!==null&&w!==void 0?w:8;if(t.supportedColorModes.indexOf(n.colorMode)===-1)throw new Error("Color mode not supported: ".concat(n.colorMode));if(E!==0&&E!==1)throw new Error("Compression type not supported: ".concat(E));var R=Ce(n.width,n.height,C);switch((0,a.resetImageData)(R),n.colorMode){case 0:if(C!==1)throw new Error("Invalid bitsPerChannel for bitmap color mode");var oe=void 0;if(E===0)oe=V(i,Math.ceil(n.width/8)*n.height);else if(E===1)oe=new Uint8Array(n.width*n.height),e(i,{data:oe,width:n.width,height:n.height},n.width,n.height,8,1,[0],i.large);else throw new Error("Bitmap compression not supported: ".concat(E));(0,a.decodeBitmap)(oe,R.data,n.width,n.height);break;case 3:case 1:var A=n.colorMode===1?[0]:[0,1,2];if(n.channels&&n.channels>3)for(var ue=3;ue<n.channels;ue++)A.push(ue);else i.globalAlpha&&A.push(3);if(E===0)for(var ue=0;ue<A.length;ue++)O(V(i,n.width*n.height*Math.floor(C/8)),R,C,4,A[ue]);else if(E===1){var re=i.offset;e(i,R,n.width,n.height,C,4,A,i.large),a.RAW_IMAGE_DATA&&(n.imageDataRaw=new Uint8Array(i.view.buffer,i.view.byteOffset+re,i.offset-re))}n.colorMode===1&&o(R);break;case 2:if(C!==8)throw new Error("bitsPerChannel Not supproted");if(n.channels!==1)throw new Error("Invalid channel count");if(!n.palette)throw new Error("Missing color palette");if(E===0)throw new Error("Not implemented");if(E===1){var he={width:R.width,height:R.height,data:new Uint8Array(R.width*R.height)};e(i,he,n.width,n.height,C,1,[0],i.large),ae(he,R,n.palette)}else throw new Error("Not implemented");break;case 4:if(C!==8)throw new Error("bitsPerChannel Not supproted");if(n.channels!==4)throw new Error("Invalid channel count");var A=[0,1,2,3];if(i.globalAlpha&&A.push(4),E===0)throw new Error("Not implemented");if(E===1){var Se={width:R.width,height:R.height,data:new Uint8Array(R.width*R.height*5)},re=i.offset;e(i,Se,n.width,n.height,C,5,A,i.large),qe(Se,R,!0),a.RAW_IMAGE_DATA&&(n.imageDataRaw=new Uint8Array(i.view.buffer,i.view.byteOffset+re,i.offset-re))}else throw new Error("Not implemented");break;default:throw new Error("Color mode not supported: ".concat(n.colorMode))}if(i.globalAlpha){if(n.bitsPerChannel!==8)throw new Error("bitsPerChannel Not supproted");for(var Pe=R.data,Te=R.width*R.height*4,ue=0;ue<Te;ue+=4){var He=Pe[ue+3];if(He!=0&&He!=255){var T=1/(He/255),d=255*(1-T);Pe[ue+0]=Pe[ue+0]*T+d,Pe[ue+1]=Pe[ue+1]*T+d,Pe[ue+2]=Pe[ue+2]*T+d}}}i.useImageData?n.imageData=R:n.canvas=(0,a.imageDataToCanvas)(R)}function qe(i,n,w){for(var E=n.width*n.height*4,C=i.data,R=n.data,oe=0,ue=0;ue<E;oe+=5,ue+=4){var re=C[oe],he=C[oe+1],A=C[oe+2],Se=C[oe+3];R[ue]=(re*Se|0)/255|0,R[ue+1]=(he*Se|0)/255|0,R[ue+2]=(A*Se|0)/255|0,R[ue+3]=w?255-C[oe+4]:C[oe+4]}}function ae(i,n,w){for(var E=i.width*i.height,C=i.data,R=n.data,oe=0,ue=0;oe<E;oe++,ue+=4){var re=w[C[oe]];R[ue+0]=re.r,R[ue+1]=re.g,R[ue+2]=re.b,R[ue+3]=255}}function le(i,n){if(i.byteLength/i.length!==n.byteLength/n.length)throw new Error("Invalid array types")}function p(i,n){if(n===8)return i;if(n===16){for(var w=0;w<i.byteLength;w+=2){var E=i[w];i[w]=i[w+1],i[w+1]=E}if(i.byteOffset%2){var C=new Uint16Array(i.byteLength/2);return new Uint8Array(C.buffer,C.byteOffset,C.byteLength).set(i),C}else return new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2)}else if(n===32)if(i.byteOffset%4){var C=new Float32Array(i.byteLength/4);return new Uint8Array(C.buffer,C.byteOffset,C.byteLength).set(i),C}else return new Float32Array(i.buffer,i.byteOffset,i.byteLength/4);else throw new Error("Invalid bitDepth (".concat(n,")"))}function m(i,n,w,E){le(i.data,n);for(var C=i.width*i.height,R=i.data,oe=0,ue=w|0;oe<C;oe++,ue=ue+E|0)R[ue]=n[oe]}function O(i,n,w,E,C){if(w==32)for(var R=0;R<i.byteLength;R+=4){var oe=i[R+0],ue=i[R+1],re=i[R+2],he=i[R+3];i[R+0]=he,i[R+1]=re,i[R+2]=ue,i[R+3]=oe}var A=p(i,w);n&&C<E&&m(n,A,C,E)}function y(i,n,w,E){for(var C=0;C<w;C++)for(var R=C*n,oe=1,ue=R+1;oe<n;oe++,ue++)i[ue]=(i[ue-1]+i[ue])%E}function F(i,n,w,E,C,R,oe,ue){var re=(0,s.inflate)(i);if(n&&oe<R){var he=p(re,C);if(C===8)ue&&y(re,w,E,256),m(n,re,oe,R);else if(C===16)ue&&y(he,w,E,65536),m(n,he,oe,R);else if(C===32){ue&&y(re,w*4,E,256);for(var A=oe,Se=new Uint32Array(n.data.buffer,n.data.byteOffset,n.data.length),Pe=0;Pe<E;Pe++)for(var Te=w*4*Pe,He=0;He<w;He++,Te++,A+=R){var T=Te+w,d=T+w,N=d+w;Se[A]=(re[Te]<<24|re[T]<<16|re[d]<<8|re[N])>>>0}}else throw new Error("Invalid bitDepth")}}t.readDataZip=F;function e(i,n,w,E,C,R,oe,ue){var re=n&&n.data,he;if(ue){he=new Uint32Array(oe.length*E);for(var A=0,Se=0;A<oe.length;A++)for(var Pe=0;Pe<E;Pe++,Se++)he[Se]=Z(i)}else{he=new Uint16Array(oe.length*E);for(var A=0,Se=0;A<oe.length;A++)for(var Pe=0;Pe<E;Pe++,Se++)he[Se]=x(i)}for(var Te=R-1|0,He=0,Se=0;He<oe.length;He++){var T=oe[He]|0;if(!re||He>Te||T>Te)for(var Pe=0;Pe<E;Pe++,Se++)L(i,he[Se]);else for(var Pe=0,d=T|0;Pe<E;Pe++,Se++)for(var N=he[Se],P=V(i,N),me=0,be=0;me<N;me++){var ye=P[me];if(ye>128){var xe=P[++me];ye=256-ye|0;for(var Re=0;Re<=ye&&be<w;Re=Re+1|0,be=be+1|0)re[d]=xe,d=d+R|0}else if(ye<128)for(var Re=0;Re<=ye&&be<w;Re=Re+1|0,be=be+1|0)re[d]=P[++me],d=d+R|0}}}t.readDataRLE=e;function u(i,n,w,E,C){E===void 0&&(E=!0),C===void 0&&(C=!1);var R=Z(i);if(C){if(R!==0)throw new Error("Sizes larger than 4GB are not supported");R=Z(i)}if(!(R<=0&&E)){var oe=i.offset+R;if(oe>i.view.byteLength)throw new Error("Section exceeds file size");var ue=w(function(){return oe-i.offset});for(i.offset!==oe&&(i.offset>oe?D(i,"Exceeded section limits"):D(i,"Unread section data"));R%n;)R++,oe++;return i.offset=oe,ue}}t.readSection=u;function f(i){switch(x(i)){case 0:var n=x(i)/257,w=x(i)/257,Pe=x(i)/257;return L(i,2),{r:n,g:w,b:Pe};case 1:var E=x(i)/65535,C=x(i)/65535,Pe=x(i)/65535;return L(i,2),{h:E,s:C,b:Pe};case 2:var R=x(i)/257,oe=x(i)/257,ue=x(i)/257,Te=x(i)/257;return{c:R,m:oe,y:ue,k:Te};case 7:var re=_(i)/1e4,he=_(i),A=_(i),Se=he<0?he/12800:he/12700,Pe=A<0?A/12800:A/12700;return L(i,2),{l:re,a:Se,b:Pe};case 8:var Te=x(i)*255/1e4;return L(i,6),{k:Te};default:throw new Error("Invalid color space")}}t.readColor=f;function k(i){for(var n=Z(i);n%4;)n++;var w=i.offset+n,E=Z(i);if(E!==1)throw new Error("Invalid pattern version: ".concat(E));var C=Z(i),R=_(i),oe=_(i);if(C!==3&&C!==1&&C!==2)throw new Error("Unsupported pattern color mode: ".concat(C));var ue=$(i),re=G(i,1),he=[];if(C===2){for(var A=0;A<256;A++)he.push({r:U(i),g:U(i),b:U(i)});L(i,4)}var Se=Z(i);if(Se!==3)throw new Error("Invalid pattern VMAL version: ".concat(Se));Z(i);for(var Pe=Z(i),Te=Z(i),He=Z(i),T=Z(i),d=Z(i),N=T-Te,P=He-Pe,me=new Uint8Array(N*P*4),A=3;A<me.byteLength;A+=4)me[A]=255;for(var A=0,be=0;A<d+2;A++)if(Z(i)){var ye=Z(i),xe=Z(i),Re=Z(i),Be=Z(i),Le=Z(i),$e=Z(i),Ke=x(i),rt=U(i),ut=V(i,ye-23);if(xe!==8||Ke!==8)throw new Error("16bit pixel depth not supported for patterns");var at=$e-Be,Qe=Le-Re,st=Be-Te,Xe=Re-Pe;if(rt===0){if(C===3&&be<3)for(var ht=0;ht<Qe;ht++)for(var ot=0;ot<at;ot++){var It=ot+ht*at,Ut=(st+ot+(ht+Xe)*N)*4;me[Ut+be]=ut[It]}if(C===1&&be<1)for(var Et=0;Et<Qe;Et++)for(var Zt=0;Zt<at;Zt++){var It=Zt+Et*at,Ut=(st+Zt+(Et+Xe)*N)*4,Lt=ut[It];me[Ut+0]=Lt,me[Ut+1]=Lt,me[Ut+2]=Lt}if(C===2)throw new Error("Indexed pattern color mode not implemented")}else if(rt===1){var dr={data:me,width:N,height:P},wt={data:new Uint8Array(at*Qe),width:at,height:Qe},hr=S(ut.buffer,ut.byteOffset,ut.byteLength);if(C===3&&be<3&&(e(hr,wt,at,Qe,8,1,[0],!1),v(wt,dr,st,Xe,be)),C===1&&be<1&&(e(hr,wt,at,Qe,8,1,[0],!1),v(wt,dr,st,Xe,0),o(dr)),C===2)throw new Error("Indexed pattern color mode not implemented")}else throw new Error("Invalid pattern compression mode");be++}return i.offset=w,{id:re,name:ue,x:R,y:oe,bounds:{x:Te,y:Pe,w:N,h:P},data:me}}t.readPattern=k;function v(i,n,w,E,C){for(var R=i.width,oe=i.height,ue=n.width,re=0;re<oe;re++)for(var he=0;he<R;he++){var A=he+re*R,Se=(w+he+(re+E)*ue)*4,Pe=i.data[A];n.data[Se+C]=Pe}}})),vc=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.writeEffects=t.readEffects=void 0;var r=Wt(),s=$t(),a=Pr(),c=[void 0,"outer bevel","inner bevel","emboss","pillow emboss","stroke emboss"];function l(_){return(0,s.checkSignature)(_,"8BIM"),r.toBlendMode[(0,s.readSignature)(_)]||"normal"}function h(_,x){(0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,r.fromBlendMode[x]||"norm")}function o(_){return(0,s.readUint8)(_)/255}function S(_,x){(0,a.writeUint8)(_,Math.round(x*255)|0)}function D(_){var x=(0,s.readUint16)(_);if(x!==0)throw new Error("Invalid effects layer version: ".concat(x));for(var I=(0,s.readUint16)(_),H={},ee=0;ee<I;ee++){(0,s.checkSignature)(_,"8BIM");var Z=(0,s.readSignature)(_);switch(Z){case"cmnS":var ie=(0,s.readUint32)(_),K=(0,s.readUint32)(_),W=!!(0,s.readUint8)(_);if((0,s.skipBytes)(_,2),ie!==7||K!==0||!W)throw new Error("Invalid effects common state");break;case"dsdw":case"isdw":var G=(0,s.readUint32)(_),X=(0,s.readUint32)(_);if(G!==41&&G!==51)throw new Error("Invalid shadow size: ".concat(G));if(X!==0&&X!==2)throw new Error("Invalid shadow version: ".concat(X));var ie=(0,s.readFixedPoint32)(_);(0,s.readFixedPoint32)(_);var ce=(0,s.readFixedPoint32)(_),Q=(0,s.readFixedPoint32)(_),ge=(0,s.readColor)(_),fe=l(_),Ee=!!(0,s.readUint8)(_),we=!!(0,s.readUint8)(_),ke=o(_);G>=51&&(0,s.readColor)(_);var V={size:{units:"Pixels",value:ie},distance:{units:"Pixels",value:Q},angle:ce,color:ge,blendMode:fe,enabled:Ee,useGlobalLight:we,opacity:ke};Z==="dsdw"?H.dropShadow=[V]:H.innerShadow=[V];break;case"oglw":var G=(0,s.readUint32)(_),te=(0,s.readUint32)(_);if(G!==32&&G!==42)throw new Error("Invalid outer glow size: ".concat(G));if(te!==0&&te!==2)throw new Error("Invalid outer glow version: ".concat(te));var ie=(0,s.readFixedPoint32)(_);(0,s.readFixedPoint32)(_);var ge=(0,s.readColor)(_),fe=l(_),Ee=!!(0,s.readUint8)(_),ke=o(_);G>=42&&(0,s.readColor)(_),H.outerGlow={size:{units:"Pixels",value:ie},color:ge,blendMode:fe,enabled:Ee,opacity:ke};break;case"iglw":var G=(0,s.readUint32)(_),J=(0,s.readUint32)(_);if(G!==32&&G!==43)throw new Error("Invalid inner glow size: ".concat(G));if(J!==0&&J!==2)throw new Error("Invalid inner glow version: ".concat(J));var ie=(0,s.readFixedPoint32)(_);(0,s.readFixedPoint32)(_);var ge=(0,s.readColor)(_),fe=l(_),Ee=!!(0,s.readUint8)(_),ke=o(_);G>=43&&((0,s.readUint8)(_),(0,s.readColor)(_)),H.innerGlow={size:{units:"Pixels",value:ie},color:ge,blendMode:fe,enabled:Ee,opacity:ke};break;case"bevl":var G=(0,s.readUint32)(_),$=(0,s.readUint32)(_);if(G!==58&&G!==78)throw new Error("Invalid bevel size: ".concat(G));if($!==0&&$!==2)throw new Error("Invalid bevel version: ".concat($));var ce=(0,s.readFixedPoint32)(_),se=(0,s.readFixedPoint32)(_),ie=(0,s.readFixedPoint32)(_),g=l(_),L=l(_),j=(0,s.readColor)(_),ne=(0,s.readColor)(_),z=c[(0,s.readUint8)(_)]||"inner bevel",Y=o(_),ve=o(_),Ee=!!(0,s.readUint8)(_),we=!!(0,s.readUint8)(_),_e=(0,s.readUint8)(_)?"down":"up";G>=78&&((0,s.readColor)(_),(0,s.readColor)(_)),H.bevel={size:{units:"Pixels",value:ie},angle:ce,strength:se,highlightBlendMode:g,shadowBlendMode:L,highlightColor:j,shadowColor:ne,style:z,highlightOpacity:Y,shadowOpacity:ve,enabled:Ee,useGlobalLight:we,direction:_e};break;case"sofi":var ie=(0,s.readUint32)(_),pe=(0,s.readUint32)(_);if(ie!==34)throw new Error("Invalid effects solid fill info size: ".concat(ie));if(pe!==2)throw new Error("Invalid effects solid fill info version: ".concat(pe));var fe=l(_),ge=(0,s.readColor)(_),ke=o(_),Ee=!!(0,s.readUint8)(_);(0,s.readColor)(_),H.solidFill=[{blendMode:fe,color:ge,opacity:ke,enabled:Ee}];break;default:throw new Error("Invalid effect type: '".concat(Z,"'"))}}return H}t.readEffects=D;function U(_,x){var I;(0,a.writeUint32)(_,51),(0,a.writeUint32)(_,2),(0,a.writeFixedPoint32)(_,x.size&&x.size.value||0),(0,a.writeFixedPoint32)(_,0),(0,a.writeFixedPoint32)(_,x.angle||0),(0,a.writeFixedPoint32)(_,x.distance&&x.distance.value||0),(0,a.writeColor)(_,x.color),h(_,x.blendMode),(0,a.writeUint8)(_,x.enabled?1:0),(0,a.writeUint8)(_,x.useGlobalLight?1:0),S(_,(I=x.opacity)!==null&&I!==void 0?I:1),(0,a.writeColor)(_,x.color)}function M(_,x){var I,H,ee,Z,K,W,X=(I=x.dropShadow)===null||I===void 0?void 0:I[0],Q=(H=x.innerShadow)===null||H===void 0?void 0:H[0],V=x.outerGlow,te=x.innerGlow,J=x.bevel,G=(ee=x.solidFill)===null||ee===void 0?void 0:ee[0],$=1;if(X&&$++,Q&&$++,V&&$++,te&&$++,J&&$++,G&&$++,(0,a.writeUint16)(_,0),(0,a.writeUint16)(_,$),(0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"cmnS"),(0,a.writeUint32)(_,7),(0,a.writeUint32)(_,0),(0,a.writeUint8)(_,1),(0,a.writeZeros)(_,2),X&&((0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"dsdw"),U(_,X)),Q&&((0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"isdw"),U(_,Q)),V&&((0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"oglw"),(0,a.writeUint32)(_,42),(0,a.writeUint32)(_,2),(0,a.writeFixedPoint32)(_,((Z=V.size)===null||Z===void 0?void 0:Z.value)||0),(0,a.writeFixedPoint32)(_,0),(0,a.writeColor)(_,V.color),h(_,V.blendMode),(0,a.writeUint8)(_,V.enabled?1:0),S(_,V.opacity||0),(0,a.writeColor)(_,V.color)),te&&((0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"iglw"),(0,a.writeUint32)(_,43),(0,a.writeUint32)(_,2),(0,a.writeFixedPoint32)(_,((K=te.size)===null||K===void 0?void 0:K.value)||0),(0,a.writeFixedPoint32)(_,0),(0,a.writeColor)(_,te.color),h(_,te.blendMode),(0,a.writeUint8)(_,te.enabled?1:0),S(_,te.opacity||0),(0,a.writeUint8)(_,0),(0,a.writeColor)(_,te.color)),J){(0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"bevl"),(0,a.writeUint32)(_,78),(0,a.writeUint32)(_,2),(0,a.writeFixedPoint32)(_,J.angle||0),(0,a.writeFixedPoint32)(_,J.strength||0),(0,a.writeFixedPoint32)(_,((W=J.size)===null||W===void 0?void 0:W.value)||0),h(_,J.highlightBlendMode),h(_,J.shadowBlendMode),(0,a.writeColor)(_,J.highlightColor),(0,a.writeColor)(_,J.shadowColor);var ce=c.indexOf(J.style);(0,a.writeUint8)(_,ce<=0?1:ce),S(_,J.highlightOpacity||0),S(_,J.shadowOpacity||0),(0,a.writeUint8)(_,J.enabled?1:0),(0,a.writeUint8)(_,J.useGlobalLight?1:0),(0,a.writeUint8)(_,J.direction==="down"?1:0),(0,a.writeColor)(_,J.highlightColor),(0,a.writeColor)(_,J.shadowColor)}G&&((0,a.writeSignature)(_,"8BIM"),(0,a.writeSignature)(_,"sofi"),(0,a.writeUint32)(_,34),(0,a.writeUint32)(_,2),h(_,G.blendMode),(0,a.writeColor)(_,G.color),S(_,G.opacity||0),(0,a.writeUint8)(_,G.enabled?1:0),(0,a.writeColor)(_,G.color))}t.writeEffects=M})),mc=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.serializeEngineData=t.parseEngineData=void 0;function r(o){return o===32||o===10||o===13||o===9}function s(o){return o>=48&&o<=57||o===46||o===45}function a(o){var S=0;function D(){for(;S<o.length&&r(o[S]);)S++}function U(){var G=o[S];return S++,G===92&&(G=o[S],S++),G}function M(){var G="";if(o[S]===41)return S++,G;if(o[S]!==254||o[S+1]!==255)throw new Error("Invalid utf-16 BOM");for(S+=2;S<o.length&&o[S]!==41;){var $=U(),ce=U(),se=$<<8|ce;G+=String.fromCharCode(se)}return S++,G}var _=null,x=[];function I(G){x.length?(H(G),x.push(G)):(x.push(G),_=G)}function H(G){if(!x.length)throw new Error("Invalid data");var $=x[x.length-1];if(typeof $=="string")x[x.length-2][$]=G,Z();else if(Array.isArray($))$.push(G);else throw new Error("Invalid data")}function ee(G){x.length||I({});var $=x[x.length-1];if($&&typeof $=="string")H(G==="nil"?null:"/".concat(G));else if($&&typeof $=="object")x.push(G);else throw new Error("Invalid data")}function Z(){if(!x.length)throw new Error("Invalid data");x.pop()}D();for(var K=o.length;K>0&&o[K-1]===0;)K--;for(;S<K;){var W=S,X=o[W];if(X===60&&o[W+1]===60)S+=2,I({});else if(X===62&&o[W+1]===62)S+=2,Z();else if(X===47){S+=1;for(var Q=S;S<o.length&&!r(o[S]);)S++;for(var V="",te=Q;te<S;te++)V+=String.fromCharCode(o[te]);ee(V)}else if(X===40)S+=1,H(M());else if(X===91)S+=1,I([]);else if(X===93)S+=1,Z();else if(X===110&&o[W+1]===117&&o[W+2]===108&&o[W+3]===108)S+=4,H(null);else if(X===116&&o[W+1]===114&&o[W+2]===117&&o[W+3]===101)S+=4,H(!0);else if(X===102&&o[W+1]===97&&o[W+2]===108&&o[W+3]===115&&o[W+4]===101)S+=5,H(!1);else if(s(X)){for(var J="";S<o.length&&s(o[S]);)J+=String.fromCharCode(o[S]),S++;H(parseFloat(J))}else S+=1,console.log("Invalid token '".concat(String.fromCharCode(X),"' (").concat(X,") at ").concat(S));D()}return _}t.parseEngineData=a;var c=["Axis","XY","Zone","WordSpacing","FirstLineIndent","GlyphSpacing","StartIndent","EndIndent","SpaceBefore","SpaceAfter","LetterSpacing","Values","GridSize","GridLeading","PointBase","BoxBounds","TransformPoint0","TransformPoint1","TransformPoint2","FontSize","Leading","HorizontalScale","VerticalScale","BaselineShift","Tsume","OutlineWidth","AutoLeading"],l=["RunLengthArray"];function h(o,S){S===void 0&&(S=!1);var D=new Uint8Array(1024),U=0,M=0;function _(G){if(U>=D.length){var $=new Uint8Array(D.length*2);$.set(D),D=$}D[U]=G,U++}function x(G){for(var $=0;$<G.length;$++)_(G.charCodeAt($))}function I(){if(S)x(" ");else for(var G=0;G<M;G++)x(" ")}function H(G,$){I(),x("/".concat(G)),Q($,G,!0),S||x(`
|
|
92
|
+
`)}function ee(G){return G.toString()}function Z(G){return G.toFixed(5).replace(/(\d)0+$/g,"$1").replace(/^0+\.([1-9])/g,".$1").replace(/^-0+\.0(\d)/g,"-.0$1")}function K(G,$){return $&&c.indexOf($)!==-1||(G|0)!==G?Z(G):ee(G)}function W(G){var $=Object.keys(G);return $.indexOf("98")!==-1&&$.unshift.apply($,$.splice($.indexOf("99"),1)),$.indexOf("99")!==-1&&$.unshift.apply($,$.splice($.indexOf("99"),1)),$}function X(G){(G===40||G===41||G===92)&&_(92),_(G)}function Q(G,$,ce){ce===void 0&&(ce=!1);function se(){ce?x(" "):I()}if(G===null)se(),x(S?"/nil":"null");else if(typeof G=="number")se(),x(K(G,$));else if(typeof G=="boolean")se(),x(G?"true":"false");else if(typeof G=="string")if(se(),($==="99"||$==="98")&&G.charAt(0)==="/")x(G);else{x("("),_(254),_(255);for(var g=0;g<G.length;g++){var L=G.charCodeAt(g);X(L>>8&255),X(L&255)}x(")")}else if(Array.isArray(G))if(se(),G.every(function(fe){return typeof fe=="number"})){x("[");for(var j=l.indexOf($)!==-1,ne=0,z=G;ne<z.length;ne++){var Y=z[ne];x(" "),x(j?K(Y):Z(Y))}x(" ]")}else{x("["),S||x(`
|
|
93
|
+
`);for(var ve=0,we=G;ve<we.length;ve++){var Y=we[ve];Q(Y,$),S||x(`
|
|
94
|
+
`)}I(),x("]")}else if(typeof G=="object"){ce&&!S&&x(`
|
|
95
|
+
`),I(),x("<<"),S||x(`
|
|
96
|
+
`),M++;for(var _e=0,ie=W(G);_e<ie.length;_e++){var pe=ie[_e];H(pe,G[pe])}M--,I(),x(">>")}}if(S){if(typeof o=="object")for(var V=0,te=W(o);V<te.length;V++){var J=te[V];H(J,o[J])}}else x(`
|
|
97
|
+
|
|
98
|
+
`),Q(o);return D.slice(0,U)}t.serializeEngineData=h})),gc=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(G){for(var $,ce=1,se=arguments.length;ce<se;ce++){$=arguments[ce];for(var g in $)Object.prototype.hasOwnProperty.call($,g)&&(G[g]=$[g])}return G},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.encodeEngineData=t.decodeEngineData=void 0;var s={name:"MyriadPro-Regular",script:0,type:0,synthetic:0},a={justification:"left",firstLineIndent:0,startIndent:0,endIndent:0,spaceBefore:0,spaceAfter:0,autoHyphenate:!0,hyphenatedWordSize:6,preHyphen:2,postHyphen:2,consecutiveHyphens:8,zone:36,wordSpacing:[.8,1,1.33],letterSpacing:[0,0,0],glyphSpacing:[1,1,1],autoLeading:1.2,leadingType:0,hanging:!1,burasagari:!1,kinsokuOrder:0,everyLineComposer:!1},c={font:s,fontSize:12,fauxBold:!1,fauxItalic:!1,autoLeading:!0,leading:0,horizontalScale:1,verticalScale:1,tracking:0,autoKerning:!0,kerning:0,baselineShift:0,fontCaps:0,fontBaseline:0,underline:!1,strikethrough:!1,ligatures:!0,dLigatures:!1,baselineDirection:2,tsume:0,styleRunAlignment:2,language:0,noBreak:!1,fillColor:{r:0,g:0,b:0},strokeColor:{r:0,g:0,b:0},fillFlag:!0,strokeFlag:!1,fillFirst:!0,yUnderline:1,outlineWidth:1,characterDirection:0,hindiNumbers:!1,kashida:1,diacriticPos:2},l={isOn:!1,show:!1,size:18,leading:22,color:{r:0,g:0,b:255},leadingFillColor:{r:0,g:0,b:255},alignLineHeightToGridFlags:!1},h=["justification","firstLineIndent","startIndent","endIndent","spaceBefore","spaceAfter","autoHyphenate","hyphenatedWordSize","preHyphen","postHyphen","consecutiveHyphens","zone","wordSpacing","letterSpacing","glyphSpacing","autoLeading","leadingType","hanging","burasagari","kinsokuOrder","everyLineComposer"],o=["font","fontSize","fauxBold","fauxItalic","autoLeading","leading","horizontalScale","verticalScale","tracking","autoKerning","kerning","baselineShift","fontCaps","fontBaseline","underline","strikethrough","ligatures","dLigatures","baselineDirection","tsume","styleRunAlignment","language","noBreak","fillColor","strokeColor","fillFlag","strokeFlag","fillFirst","yUnderline","outlineWidth","characterDirection","hindiNumbers","kashida","diacriticPos"],S=["none","crisp","strong","smooth","sharp"],D=["left","right","center","justify-left","justify-right","justify-center","justify-all"];function U(G){return G.substring(0,1).toUpperCase()+G.substring(1)}function M(G){var $=G.Values;switch(G.Type){case 0:return{k:$[1]*255};case 1:return $[0]===1?{r:$[1]*255,g:$[2]*255,b:$[3]*255}:{r:$[1]*255,g:$[2]*255,b:$[3]*255,a:$[0]*255};case 2:return{c:$[1]*255,m:$[2]*255,y:$[3]*255,k:$[4]*255};default:throw new Error("Unknown color type in text layer")}}function _(G){if(G){if("r"in G)return{Type:1,Values:["a"in G?G.a/255:1,G.r/255,G.g/255,G.b/255]};if("c"in G)return{Type:2,Values:[1,G.c/255,G.m/255,G.y/255,G.k/255]};if("k"in G)return{Type:0,Values:[1,G.k/255]};throw new Error("Invalid color type in text layer")}else return{Type:1,Values:[0,0,0,0]}}function x(G,$){if(!G||!$||G.length!==$.length)return!1;for(var ce=0;ce<G.length;ce++)if(G[ce]!==$[ce])return!1;return!0}function I(G,$){if(!G||!$)return!1;for(var ce=0,se=Object.keys(G);ce<se.length;ce++){var g=se[ce];if(G[g]!==$[g])return!1}for(var L=0,j=Object.keys($);L<j.length;L++){var g=j[L];if(G[g]!==$[g])return!1}return!0}function H(G,$){for(var ce=0;ce<G.length;ce++)if(G[ce].name===$.name)return ce;return G.push($),G.length-1}function ee(G,$,ce){for(var se={},g=0,L=$;g<L.length;g++){var j=L[g],ne=U(j);G[ne]!==void 0&&(j==="justification"?se[j]=D[G[ne]]:j==="font"?se[j]=ce[G[ne]]:j==="fillColor"||j==="strokeColor"?se[j]=M(G[ne]):se[j]=G[ne])}return se}function Z(G,$,ce){for(var se,g={},L=0,j=$;L<j.length;L++){var ne=j[L],z=U(ne);G[ne]!==void 0&&(ne==="justification"?g[z]=D.indexOf((se=G[ne])!==null&&se!==void 0?se:"left"):ne==="font"?g[z]=H(ce,G[ne]):ne==="fillColor"||ne==="strokeColor"?g[z]=_(G[ne]):g[z]=G[ne])}return g}function K(G,$){return ee(G,h,$)}function W(G,$){return ee(G,o,$)}function X(G,$){return Z(G,h,$)}function Q(G,$){return Z(G,o,$)}function V(G,$,ce){if($.length){for(var se=function(ne){var z=$[0].style[ne];if(z!==void 0){var Y=!1;Array.isArray(z)?Y=$.every(function(pe){return x(pe.style[ne],z)}):typeof z=="object"?Y=$.every(function(pe){return I(pe.style[ne],z)}):Y=$.every(function(pe){return pe.style[ne]===z}),Y&&(G[ne]=z)}if(G[ne]!==void 0)for(var ve=0,we=$;ve<we.length;ve++){var _e=we[ve],ie=!1;Array.isArray(z)?ie=x(_e.style[ne],z):typeof z=="object"?ie=I(_e.style[ne],z):ie=_e.style[ne]===z,ie&&delete _e.style[ne]}},g=0,L=ce;g<L.length;g++){var j=L[g];se(j)}$.every(function(ne){return Object.keys(ne.style).length===0})&&($.length=0)}}function te(G){for(var $,ce,se,g,L,j,ne=G.EngineDict,z=G.ResourceDict,Y=z.FontSet.map(function(Ne){return{name:Ne.Name,script:Ne.Script,type:Ne.FontType,synthetic:Ne.Synthetic}}),ve=ne.Editor.Text.replace(/\r/g,`
|
|
99
|
+
`),we=0;/\n$/.test(ve);)ve=ve.substring(0,ve.length-1),we++;var _e={text:ve,antiAlias:($=S[ne.AntiAlias])!==null&&$!==void 0?$:"smooth",useFractionalGlyphWidths:!!ne.UseFractionalGlyphWidths,superscriptSize:z.SuperscriptSize,superscriptPosition:z.SuperscriptPosition,subscriptSize:z.SubscriptSize,subscriptPosition:z.SubscriptPosition,smallCapSize:z.SmallCapSize},ie=(j=(L=(g=(se=(ce=ne.Rendered)===null||ce===void 0?void 0:ce.Shapes)===null||se===void 0?void 0:se.Children)===null||g===void 0?void 0:g[0])===null||L===void 0?void 0:L.Cookie)===null||j===void 0?void 0:j.Photoshop;ie&&(_e.shapeType=ie.ShapeType===1?"box":"point",ie.PointBase&&(_e.pointBase=ie.PointBase),ie.BoxBounds&&(_e.boxBounds=ie.BoxBounds));var pe=ne.ParagraphRun;_e.paragraphStyle={},_e.paragraphStyleRuns=[];for(var fe=0;fe<pe.RunArray.length;fe++){var ge=pe.RunArray[fe],ke=pe.RunLengthArray[fe],Ee=K(ge.ParagraphSheet.Properties,Y);_e.paragraphStyleRuns.push({length:ke,style:Ee})}for(var Ie=we;_e.paragraphStyleRuns.length&&Ie>0;Ie--)--_e.paragraphStyleRuns[_e.paragraphStyleRuns.length-1].length===0&&_e.paragraphStyleRuns.pop();V(_e.paragraphStyle,_e.paragraphStyleRuns,h),_e.paragraphStyleRuns.length||delete _e.paragraphStyleRuns;var De=ne.StyleRun;_e.style={},_e.styleRuns=[];for(var fe=0;fe<De.RunArray.length;fe++){var Ue=De.RunLengthArray[fe],Ee=W(De.RunArray[fe].StyleSheet.StyleSheetData,Y);Ee.font||(Ee.font=Y[0]),_e.styleRuns.push({length:Ue,style:Ee})}for(var Ie=we;_e.styleRuns.length&&Ie>0;Ie--)--_e.styleRuns[_e.styleRuns.length-1].length===0&&_e.styleRuns.pop();return V(_e.style,_e.styleRuns,o),_e.styleRuns.length||delete _e.styleRuns,_e}t.decodeEngineData=te;function J(G){var $,ce,se,g,L,j,ne,z,Y,ve,we,_e,ie="".concat((G.text||"").replace(/\r?\n/g,"\r"),"\r"),pe=[{name:"AdobeInvisFont",script:0,type:0,synthetic:0}],fe=(($=G.style)===null||$===void 0?void 0:$.font)||((se=(ce=G.styleRuns)===null||ce===void 0?void 0:ce.find(function(n){return n.style.font}))===null||se===void 0?void 0:se.style.font)||s,ge=[],ke=[],Ee=G.paragraphStyleRuns;if(Ee&&Ee.length){for(var Ie=ie.length,De=0,Ue=Ee;De<Ue.length;De++){var Ne=Ue[De],Me=Math.min(Ne.length,Ie);Ie-=Me,Me&&(Ie===1&&Ne===Ee[Ee.length-1]&&(Me++,Ie--),ke.push(Me),ge.push({ParagraphSheet:{DefaultStyleSheet:0,Properties:X(r(r(r({},a),G.paragraphStyle),Ne.style),pe)},Adjustments:{Axis:[1,0,1],XY:[0,0]}}))}Ie&&(ke.push(Ie),ge.push({ParagraphSheet:{DefaultStyleSheet:0,Properties:X(r(r({},a),G.paragraphStyle),pe)},Adjustments:{Axis:[1,0,1],XY:[0,0]}}))}else for(var Ce=0,Ge=0;Ce<ie.length;Ce++)ie.charCodeAt(Ce)===13&&(ke.push(Ce-Ge+1),ge.push({ParagraphSheet:{DefaultStyleSheet:0,Properties:X(r(r({},a),G.paragraphStyle),pe)},Adjustments:{Axis:[1,0,1],XY:[0,0]}}),Ge=Ce+1);for(var qe=Q(r(r({},c),{font:fe}),pe),ae=G.styleRuns||[{length:ie.length,style:G.style||{}}],le=[],p=[],m=ie.length,O=0,y=ae;O<y.length;O++){var F=y[O],Me=Math.min(F.length,m);m-=Me,Me&&(m===1&&F===ae[ae.length-1]&&(Me++,m--),p.push(Me),le.push({StyleSheet:{StyleSheetData:Q(r(r({kerning:0,autoKerning:!0,fillColor:{r:0,g:0,b:0}},G.style),F.style),pe)}}))}m&&ae.length&&(p.push(m),le.push({StyleSheet:{StyleSheetData:Q(r({kerning:0,autoKerning:!0,fillColor:{r:0,g:0,b:0}},G.style),pe)}}));var e=r(r({},l),G.gridInfo),u=G.orientation==="vertical"?2:0,f=G.orientation==="vertical"?1:0,k=G.shapeType==="box"?1:0,v={ShapeType:k};k===0?v.PointBase=G.pointBase||[0,0]:v.BoxBounds=G.boxBounds||[0,0,0,0],v.Base={ShapeType:k,TransformPoint0:[1,0],TransformPoint1:[0,1],TransformPoint2:[0,0]};var i={KinsokuSet:[{Name:"PhotoshopKinsokuHard",NoStart:"、。,.・:;?!ー―’”)〕]}〉》」』】ヽヾゝゞ々ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ゛゜?!)]},.:;℃℉¢%‰",NoEnd:"‘“(〔[{〈《「『【([{¥$£@§〒#",Keep:"―‥",Hanging:"、。.,"},{Name:"PhotoshopKinsokuSoft",NoStart:"、。,.・:;?!’”)〕]}〉》」』】ヽヾゝゞ々",NoEnd:"‘“(〔[{〈《「『【",Keep:"―‥",Hanging:"、。.,"}],MojiKumiSet:[{InternalName:"Photoshop6MojiKumiSet1"},{InternalName:"Photoshop6MojiKumiSet2"},{InternalName:"Photoshop6MojiKumiSet3"},{InternalName:"Photoshop6MojiKumiSet4"}],TheNormalStyleSheet:0,TheNormalParagraphSheet:0,ParagraphSheetSet:[{Name:"Normal RGB",DefaultStyleSheet:0,Properties:X(r(r({},a),G.paragraphStyle),pe)}],StyleSheetSet:[{Name:"Normal RGB",StyleSheetData:qe}],FontSet:pe.map(function(n){return{Name:n.name,Script:n.script||0,FontType:n.type||0,Synthetic:n.synthetic||0}}),SuperscriptSize:(g=G.superscriptSize)!==null&&g!==void 0?g:.583,SuperscriptPosition:(L=G.superscriptPosition)!==null&&L!==void 0?L:.333,SubscriptSize:(j=G.subscriptSize)!==null&&j!==void 0?j:.583,SubscriptPosition:(ne=G.subscriptPosition)!==null&&ne!==void 0?ne:.333,SmallCapSize:(z=G.smallCapSize)!==null&&z!==void 0?z:.7};return{EngineDict:{Editor:{Text:ie},ParagraphRun:{DefaultRunData:{ParagraphSheet:{DefaultStyleSheet:0,Properties:{}},Adjustments:{Axis:[1,0,1],XY:[0,0]}},RunArray:ge,RunLengthArray:ke,IsJoinable:1},StyleRun:{DefaultRunData:{StyleSheet:{StyleSheetData:{}}},RunArray:le,RunLengthArray:p,IsJoinable:2},GridInfo:{GridIsOn:!!e.isOn,ShowGrid:!!e.show,GridSize:(Y=e.size)!==null&&Y!==void 0?Y:18,GridLeading:(ve=e.leading)!==null&&ve!==void 0?ve:22,GridColor:_(e.color),GridLeadingFillColor:_(e.color),AlignLineHeightToGridFlags:!!e.alignLineHeightToGridFlags},AntiAlias:S.indexOf((we=G.antiAlias)!==null&&we!==void 0?we:"sharp"),UseFractionalGlyphWidths:(_e=G.useFractionalGlyphWidths)!==null&&_e!==void 0?_e:!0,Rendered:{Version:1,Shapes:{WritingDirection:u,Children:[{ShapeType:k,Procession:f,Lines:{WritingDirection:u,Children:[]},Cookie:{Photoshop:v}}]}}},ResourceDict:r({},i),DocumentResources:r({},i)}}t.encodeEngineData=J})),yc=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decodeEngineData2=void 0;var r={0:{uproot:!0,children:{0:{name:"Type"},1:{name:"Values"}}}},s={0:{name:"Font"},1:{name:"FontSize"},2:{name:"FauxBold"},3:{name:"FauxItalic"},4:{name:"AutoLeading"},5:{name:"Leading"},6:{name:"HorizontalScale"},7:{name:"VerticalScale"},8:{name:"Tracking"},9:{name:"BaselineShift"},11:{name:"Kerning?"},12:{name:"FontCaps"},13:{name:"FontBaseline"},15:{name:"Strikethrough?"},16:{name:"Underline?"},18:{name:"Ligatures"},19:{name:"DLigatures"},23:{name:"Fractions"},24:{name:"Ordinals"},28:{name:"StylisticAlternates"},30:{name:"OldStyle?"},35:{name:"BaselineDirection"},38:{name:"Language"},52:{name:"NoBreak"},53:{name:"FillColor",children:r},54:{name:"StrokeColor",children:r},55:{children:{99:{uproot:!0}}},79:{children:r}},a={0:{name:"Justification"},1:{name:"FirstLineIndent"},2:{name:"StartIndent"},3:{name:"EndIndent"},4:{name:"SpaceBefore"},5:{name:"SpaceAfter"},7:{name:"AutoLeading"},9:{name:"AutoHyphenate"},10:{name:"HyphenatedWordSize"},11:{name:"PreHyphen"},12:{name:"PostHyphen"},13:{name:"ConsecutiveHyphens?"},14:{name:"Zone"},15:{name:"HypenateCapitalizedWords"},17:{name:"WordSpacing"},18:{name:"LetterSpacing"},19:{name:"GlyphSpacing"},32:{name:"StyleSheet",children:s}},c={name:"StyleSheetData",children:s},l={0:{name:"ResourceDict",children:{1:{name:"FontSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},2:{name:"FontType"}}}}}}}}},2:{name:"2",children:{}},3:{name:"MojiKumiSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"InternalName"}}}}}}},4:{name:"KinsokuSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},5:{uproot:!0,children:{0:{name:"NoStart"},1:{name:"NoEnd"},2:{name:"Keep"},3:{name:"Hanging"},4:{name:"Name"}}}}}}}}},5:{name:"StyleSheetSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},6:c}}}}}},6:{name:"ParagraphSheetSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},5:{name:"Properties",children:a},6:{name:"DefaultStyleSheet"}}}}}}},8:{name:"TextFrameSet",children:{0:{uproot:!0,children:{0:{name:"path",children:{0:{name:"name"},1:{name:"bezierCurve",children:{0:{name:"controlPoints"}}},2:{name:"data",children:{0:{name:"type"},1:{name:"orientation"},2:{name:"frameMatrix"},4:{name:"4"},6:{name:"textRange"},7:{name:"rowGutter"},8:{name:"columnGutter"},9:{name:"9"},10:{name:"baselineAlignment",children:{0:{name:"flag"},1:{name:"min"}}},11:{name:"pathData",children:{1:{name:"1"},0:{name:"reversed"},2:{name:"2"},3:{name:"3"},4:{name:"spacing"},5:{name:"5"},6:{name:"6"},7:{name:"7"},18:{name:"18"}}},12:{name:"12"},13:{name:"13"}}},3:{name:"3"},97:{name:"uuid"}}}}}}},9:{name:"Predefined",children:{0:{children:{0:{uproot:!0}}},1:{children:{0:{uproot:!0}}}}}}},1:{name:"EngineDict",children:{0:{name:"0",children:{3:{name:"SuperscriptSize"},4:{name:"SuperscriptPosition"},5:{name:"SubscriptSize"},6:{name:"SubscriptPosition"},7:{name:"SmallCapSize"},8:{name:"UseFractionalGlyphWidths"},15:{children:{0:{uproot:!0}}}}},1:{name:"Editors?",children:{0:{name:"Editor",children:{0:{name:"Text"},5:{name:"ParagraphRun",children:{0:{name:"RunArray",children:{0:{name:"ParagraphSheet",children:{0:{uproot:!0,children:{0:{name:"0"},5:{name:"5",children:a},6:{name:"6"}}}}},1:{name:"RunLength"}}}}},6:{name:"StyleRun",children:{0:{name:"RunArray",children:{0:{name:"StyleSheet",children:{0:{uproot:!0,children:{6:c}}}},1:{name:"RunLength"}}}}}}},1:{name:"FontVectorData ???"}}},2:{name:"StyleSheet",children:s},3:{name:"ParagraphSheet",children:a}}}};function h(S,D){var U,M;if(S===null)return S;if(Array.isArray(S))return S.map(function(ee){return h(ee,D)});if(typeof S!="object")return S;for(var _={},x=0,I=Object.keys(S);x<I.length;x++){var H=I[x];if(D[H])if(D[H].uproot){H!=="99"&&(_=h(S[H],(U=D[H].children)!==null&&U!==void 0?U:{})),S[99]&&(_._type=S[99]);break}else _[D[H].name||H]=h(S[H],(M=D[H].children)!==null&&M!==void 0?M:{});else H==="99"?_._type=S[H]:_[H]=h(S[H],{})}return _}function o(S){return h(S,l)}t.decodeEngineData2=o})),gi=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(e){for(var u,f=1,k=arguments.length;f<k;f++){u=arguments[f];for(var v in u)Object.prototype.hasOwnProperty.call(u,v)&&(e[v]=u[v])}return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.hasMultiEffects=t.readVectorMask=t.booleanOperations=t.readBezierKnot=t.infoHandlersMap=t.infoHandlers=void 0;var s=en(),a=vc(),c=Wt(),l=$t(),h=Pr(),o=mi(),S=mc(),D=gc(),U=yc(),M="abcdefghijklmnopqrstuvwxyz";t.infoHandlers=[],t.infoHandlersMap={};function _(e,u,f,k){var v={key:e,has:u,read:f,write:k};t.infoHandlers.push(v),t.infoHandlersMap[v.key]=v}function x(e,u){t.infoHandlersMap[e]=t.infoHandlersMap[u]}function I(e){return function(u){return u[e]!==void 0}}function H(e){if((0,l.readUint32)(e))throw new Error("Resource size above 4 GB limit at ".concat(e.offset.toString(16)));return(0,l.readUint32)(e)}function ee(e,u){(0,h.writeUint32)(e,0),(0,h.writeUint32)(e,u)}_("TySh",I("text"),function(e,u,f){if((0,l.readInt16)(e)!==1)throw new Error("Invalid TySh version");for(var k=[],v=0;v<6;v++)k.push((0,l.readFloat64)(e));if((0,l.readInt16)(e)!==50)throw new Error("Invalid TySh text version");var i=(0,o.readVersionAndDescriptor)(e);if((0,l.readInt16)(e)!==1)throw new Error("Invalid TySh warp version");var n=(0,o.readVersionAndDescriptor)(e);if(u.text={transform:k,left:(0,l.readFloat32)(e),top:(0,l.readFloat32)(e),right:(0,l.readFloat32)(e),bottom:(0,l.readFloat32)(e),text:i["Txt "].replace(/\r/g,`
|
|
100
|
+
`),index:i.TextIndex||0,gridding:o.textGridding.decode(i.textGridding),antiAlias:o.Annt.decode(i.AntA),orientation:o.Ornt.decode(i.Ornt),warp:{style:o.warpStyle.decode(n.warpStyle),value:n.warpValue||0,perspective:n.warpPerspective||0,perspectiveOther:n.warpPerspectiveOther||0,rotate:o.Ornt.decode(n.warpRotate)}},i.bounds&&(u.text.bounds=(0,o.descBoundsToBounds)(i.bounds)),i.boundingBox&&(u.text.boundingBox=(0,o.descBoundsToBounds)(i.boundingBox)),i.EngineData){var w=(0,S.parseEngineData)(i.EngineData),E=(0,D.decodeEngineData)(w);u.text=r(r({},u.text),E)}(0,l.skipBytes)(e,f())},function(e,u){var f=u.text,k=f.warp||{},v=f.transform||[1,0,0,1,0,0],i=r(r(r({"Txt ":(f.text||"").replace(/\r?\n/g,"\r"),textGridding:o.textGridding.encode(f.gridding),Ornt:o.Ornt.encode(f.orientation),AntA:o.Annt.encode(f.antiAlias)},f.bounds?{bounds:(0,o.boundsToDescBounds)(f.bounds)}:{}),f.boundingBox?{boundingBox:(0,o.boundsToDescBounds)(f.boundingBox)}:{}),{TextIndex:f.index||0,EngineData:(0,S.serializeEngineData)((0,D.encodeEngineData)(f))});(0,h.writeInt16)(e,1);for(var n=0;n<6;n++)(0,h.writeFloat64)(e,v[n]);(0,h.writeInt16)(e,50),(0,o.writeVersionAndDescriptor)(e,"","TxLr",i,"text"),(0,h.writeInt16)(e,1),(0,o.writeVersionAndDescriptor)(e,"","warp",te(k)),(0,h.writeFloat32)(e,f.left),(0,h.writeFloat32)(e,f.top),(0,h.writeFloat32)(e,f.right),(0,h.writeFloat32)(e,f.bottom)}),_("SoCo",function(e){return e.vectorFill!==void 0&&e.vectorStroke===void 0&&e.vectorFill.type==="color"},function(e,u){var f=(0,o.readVersionAndDescriptor)(e);u.vectorFill=(0,o.parseVectorContent)(f)},function(e,u){var f=(0,o.serializeVectorContent)(u.vectorFill).descriptor;(0,o.writeVersionAndDescriptor)(e,"","null",f)}),_("GdFl",function(e){return e.vectorFill!==void 0&&e.vectorStroke===void 0&&(e.vectorFill.type==="solid"||e.vectorFill.type==="noise")},function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);u.vectorFill=(0,o.parseVectorContent)(k),(0,l.skipBytes)(e,f())},function(e,u){var f=(0,o.serializeVectorContent)(u.vectorFill).descriptor;(0,o.writeVersionAndDescriptor)(e,"","null",f)}),_("PtFl",function(e){return e.vectorFill!==void 0&&e.vectorStroke===void 0&&e.vectorFill.type==="pattern"},function(e,u){var f=(0,o.readVersionAndDescriptor)(e);u.vectorFill=(0,o.parseVectorContent)(f)},function(e,u){var f=(0,o.serializeVectorContent)(u.vectorFill).descriptor;(0,o.writeVersionAndDescriptor)(e,"","null",f)}),_("vscg",function(e){return e.vectorFill!==void 0&&e.vectorStroke!==void 0},function(e,u,f){(0,l.readSignature)(e);var k=(0,o.readVersionAndDescriptor)(e);u.vectorFill=(0,o.parseVectorContent)(k),(0,l.skipBytes)(e,f())},function(e,u){var f=(0,o.serializeVectorContent)(u.vectorFill),k=f.descriptor,v=f.key;(0,h.writeSignature)(e,v),(0,o.writeVersionAndDescriptor)(e,"","null",k)});function Z(e,u,f){var k=(0,l.readFixedPointPath32)(e)*f,v=(0,l.readFixedPointPath32)(e)*u,i=(0,l.readFixedPointPath32)(e)*f,n=(0,l.readFixedPointPath32)(e)*u,w=(0,l.readFixedPointPath32)(e)*f;return[v,k,n,i,(0,l.readFixedPointPath32)(e)*u,w]}t.readBezierKnot=Z;function K(e,u,f,k){(0,h.writeFixedPointPath32)(e,u[1]/k),(0,h.writeFixedPointPath32)(e,u[0]/f),(0,h.writeFixedPointPath32)(e,u[3]/k),(0,h.writeFixedPointPath32)(e,u[2]/f),(0,h.writeFixedPointPath32)(e,u[5]/k),(0,h.writeFixedPointPath32)(e,u[4]/f)}t.booleanOperations=["exclude","combine","subtract","intersect"];function W(e,u,f,k,v){for(var i=e.offset+v,n=u.paths,w=void 0;i-e.offset>=26;){var E=(0,l.readUint16)(e);switch(E){case 0:case 3:(0,l.readUint16)(e);var C=(0,l.readInt16)(e),R=(0,l.readUint16)(e);(0,l.skipBytes)(e,18),w={open:E===3,knots:[],fillRule:R===2?"non-zero":"even-odd"},C!==-1&&(w.operation=t.booleanOperations[C]),n.push(w);break;case 1:case 2:case 4:case 5:w.knots.push({linked:E===1||E===4,points:Z(e,f,k)});break;case 6:(0,l.skipBytes)(e,24);break;case 7:var oe=(0,l.readFixedPointPath32)(e),ue=(0,l.readFixedPointPath32)(e),re=(0,l.readFixedPointPath32)(e),he=(0,l.readFixedPointPath32)(e),A=(0,l.readFixedPointPath32)(e);(0,l.skipBytes)(e,4),u.clipboard={top:oe,left:ue,bottom:re,right:he,resolution:A};break;case 8:u.fillStartsWithAllPixels=!!(0,l.readUint16)(e),(0,l.skipBytes)(e,22);break;default:throw new Error("Invalid vmsk section")}}return n}t.readVectorMask=W,_("vmsk",I("vectorMask"),function(e,u,f,k){var v=k.width,i=k.height;if((0,l.readUint32)(e)!==3)throw new Error("Invalid vmsk version");u.vectorMask={paths:[]};var n=u.vectorMask,w=(0,l.readUint32)(e);n.invert=(w&1)!==0,n.notLink=(w&2)!==0,n.disable=(w&4)!==0,W(e,n,v,i,f()),(0,l.skipBytes)(e,f())},function(e,u,f){var k=f.width,v=f.height,i=u.vectorMask,n=(i.invert?1:0)|(i.notLink?2:0)|(i.disable?4:0);(0,h.writeUint32)(e,3),(0,h.writeUint32)(e,n),(0,h.writeUint16)(e,6),(0,h.writeZeros)(e,24);var w=i.clipboard;w&&((0,h.writeUint16)(e,7),(0,h.writeFixedPointPath32)(e,w.top),(0,h.writeFixedPointPath32)(e,w.left),(0,h.writeFixedPointPath32)(e,w.bottom),(0,h.writeFixedPointPath32)(e,w.right),(0,h.writeFixedPointPath32)(e,w.resolution),(0,h.writeZeros)(e,4)),(0,h.writeUint16)(e,8),(0,h.writeUint16)(e,i.fillStartsWithAllPixels?1:0),(0,h.writeZeros)(e,22);for(var E=0,C=i.paths;E<C.length;E++){var R=C[E];(0,h.writeUint16)(e,R.open?3:0),(0,h.writeUint16)(e,R.knots.length),(0,h.writeUint16)(e,R.operation?t.booleanOperations.indexOf(R.operation):-1),(0,h.writeUint16)(e,R.fillRule==="non-zero"?2:1),(0,h.writeZeros)(e,18);for(var oe=R.open?4:1,ue=R.open?5:2,re=0,he=R.knots;re<he.length;re++){var A=he[re],Se=A.linked,Pe=A.points;(0,h.writeUint16)(e,Se?oe:ue),K(e,Pe,k,v)}}}),x("vsms","vmsk"),_("vowv",I("vowv"),function(e,u){u.vowv=(0,l.readUint32)(e)},function(e,u){(0,h.writeUint32)(e,u.vowv)}),_("vogk",I("vectorOrigination"),function(e,u,f){if((0,l.readInt32)(e)!==1)throw new Error("Invalid vogk version");var k=(0,o.readVersionAndDescriptor)(e);u.vectorOrigination={keyDescriptorList:[]};for(var v=0,i=k.keyDescriptorList;v<i.length;v++){var n=i[v],w={};n.keyShapeInvalidated!=null&&(w.keyShapeInvalidated=n.keyShapeInvalidated),n.keyOriginType!=null&&(w.keyOriginType=n.keyOriginType),n.keyOriginResolution!=null&&(w.keyOriginResolution=n.keyOriginResolution),n.keyOriginShapeBBox&&(w.keyOriginShapeBoundingBox={top:(0,o.parseUnitsOrNumber)(n.keyOriginShapeBBox["Top "]),left:(0,o.parseUnitsOrNumber)(n.keyOriginShapeBBox.Left),bottom:(0,o.parseUnitsOrNumber)(n.keyOriginShapeBBox.Btom),right:(0,o.parseUnitsOrNumber)(n.keyOriginShapeBBox.Rght)});var E=n.keyOriginRRectRadii;E&&(w.keyOriginRRectRadii={topRight:(0,o.parseUnits)(E.topRight),topLeft:(0,o.parseUnits)(E.topLeft),bottomLeft:(0,o.parseUnits)(E.bottomLeft),bottomRight:(0,o.parseUnits)(E.bottomRight)});var C=n.keyOriginBoxCorners;C&&(w.keyOriginBoxCorners=[{x:C.rectangleCornerA.Hrzn,y:C.rectangleCornerA.Vrtc},{x:C.rectangleCornerB.Hrzn,y:C.rectangleCornerB.Vrtc},{x:C.rectangleCornerC.Hrzn,y:C.rectangleCornerC.Vrtc},{x:C.rectangleCornerD.Hrzn,y:C.rectangleCornerD.Vrtc}]);var R=n.Trnf;R&&(w.transform=[R.xx,R.xy,R.yx,R.yy,R.tx,R.ty]),u.vectorOrigination.keyDescriptorList.push(w)}(0,l.skipBytes)(e,f())},function(e,u){for(var f=u.vectorOrigination,k={keyDescriptorList:[]},v=0;v<f.keyDescriptorList.length;v++){var i=f.keyDescriptorList[v];k.keyDescriptorList.push({});var n=k.keyDescriptorList[k.keyDescriptorList.length-1];i.keyOriginType!=null&&(n.keyOriginType=i.keyOriginType),i.keyOriginResolution!=null&&(n.keyOriginResolution=i.keyOriginResolution);var w=i.keyOriginRRectRadii;w&&(n.keyOriginRRectRadii={unitValueQuadVersion:1,topRight:(0,o.unitsValue)(w.topRight,"topRight"),topLeft:(0,o.unitsValue)(w.topLeft,"topLeft"),bottomLeft:(0,o.unitsValue)(w.bottomLeft,"bottomLeft"),bottomRight:(0,o.unitsValue)(w.bottomRight,"bottomRight")});var E=i.keyOriginShapeBoundingBox;E&&(n.keyOriginShapeBBox={unitValueQuadVersion:1,"Top ":(0,o.unitsValue)(E.top,"top"),Left:(0,o.unitsValue)(E.left,"left"),Btom:(0,o.unitsValue)(E.bottom,"bottom"),Rght:(0,o.unitsValue)(E.right,"right")});var C=i.keyOriginBoxCorners;C&&C.length===4&&(n.keyOriginBoxCorners={rectangleCornerA:{Hrzn:C[0].x,Vrtc:C[0].y},rectangleCornerB:{Hrzn:C[1].x,Vrtc:C[1].y},rectangleCornerC:{Hrzn:C[2].x,Vrtc:C[2].y},rectangleCornerD:{Hrzn:C[3].x,Vrtc:C[3].y}});var R=i.transform;R&&R.length===6&&(n.Trnf={xx:R[0],xy:R[1],yx:R[2],yy:R[3],tx:R[4],ty:R[5]}),i.keyShapeInvalidated!=null&&(n.keyShapeInvalidated=i.keyShapeInvalidated),n.keyOriginIndex=v}(0,h.writeInt32)(e,1),(0,o.writeVersionAndDescriptor)(e,"","null",k)}),_("lmfx",function(e){return e.effects!==void 0&&F(e.effects)},function(e,u,f){if((0,l.readUint32)(e)!==0)throw new Error("Invalid lmfx version");var k=(0,o.readVersionAndDescriptor)(e);u.effects=(0,o.parseEffects)(k,!!e.logMissingFeatures),(0,l.skipBytes)(e,f())},function(e,u,f,k){var v=(0,o.serializeEffects)(u.effects,!!k.logMissingFeatures,!0);(0,h.writeUint32)(e,0),(0,o.writeVersionAndDescriptor)(e,"","null",v)}),_("lrFX",I("effects"),function(e,u,f){u.effects||(u.effects=(0,a.readEffects)(e)),(0,l.skipBytes)(e,f())},function(e,u){(0,a.writeEffects)(e,u.effects)}),_("luni",I("name"),function(e,u,f){if(f()>4){var k=(0,l.readUint32)(e);f()>=k*2?u.name=(0,l.readUnicodeStringWithLength)(e,k):e.logDevFeatures&&e.log("name in luni section is too long")}else e.logDevFeatures&&e.log("empty luni section");(0,l.skipBytes)(e,f())},function(e,u){(0,h.writeUnicodeString)(e,u.name)}),_("lnsr",I("nameSource"),function(e,u){return u.nameSource=(0,l.readSignature)(e)},function(e,u){return(0,h.writeSignature)(e,u.nameSource)}),_("lyid",I("id"),function(e,u){u.id=(0,l.readUint32)(e)},function(e,u,f,k){for(var v=u.id;k.layerIds.has(v);)v+=100;(0,h.writeUint32)(e,v),k.layerIds.add(v),k.layerToId.set(u,v)}),_("lsct",I("sectionDivider"),function(e,u,f){u.sectionDivider={type:(0,l.readUint32)(e)},f()&&((0,l.checkSignature)(e,"8BIM"),u.sectionDivider.key=(0,l.readSignature)(e)),f()&&(u.sectionDivider.subType=(0,l.readUint32)(e))},function(e,u){(0,h.writeUint32)(e,u.sectionDivider.type),u.sectionDivider.key&&((0,h.writeSignature)(e,"8BIM"),(0,h.writeSignature)(e,u.sectionDivider.key),u.sectionDivider.subType!==void 0&&(0,h.writeUint32)(e,u.sectionDivider.subType))}),x("lsdk","lsct"),_("clbl",I("blendClippendElements"),function(e,u){u.blendClippendElements=!!(0,l.readUint8)(e),(0,l.skipBytes)(e,3)},function(e,u){(0,h.writeUint8)(e,u.blendClippendElements?1:0),(0,h.writeZeros)(e,3)}),_("infx",I("blendInteriorElements"),function(e,u){u.blendInteriorElements=!!(0,l.readUint8)(e),(0,l.skipBytes)(e,3)},function(e,u){(0,h.writeUint8)(e,u.blendInteriorElements?1:0),(0,h.writeZeros)(e,3)}),_("knko",I("knockout"),function(e,u){u.knockout=!!(0,l.readUint8)(e),(0,l.skipBytes)(e,3)},function(e,u){(0,h.writeUint8)(e,u.knockout?1:0),(0,h.writeZeros)(e,3)}),_("lmgm",I("layerMaskAsGlobalMask"),function(e,u){u.layerMaskAsGlobalMask=!!(0,l.readUint8)(e),(0,l.skipBytes)(e,3)},function(e,u){(0,h.writeUint8)(e,u.layerMaskAsGlobalMask?1:0),(0,h.writeZeros)(e,3)}),_("lspf",I("protected"),function(e,u){var f=(0,l.readUint32)(e);u.protected={transparency:(f&1)!==0,composite:(f&2)!==0,position:(f&4)!==0},f&8&&(u.protected.artboards=!0)},function(e,u){var f=(u.protected.transparency?1:0)|(u.protected.composite?2:0)|(u.protected.position?4:0)|(u.protected.artboards?8:0);(0,h.writeUint32)(e,f)}),_("lclr",I("layerColor"),function(e,u){var f=(0,l.readUint16)(e);(0,l.skipBytes)(e,6),u.layerColor=c.layerColors[f]},function(e,u){var f=c.layerColors.indexOf(u.layerColor);(0,h.writeUint16)(e,f===-1?0:f),(0,h.writeZeros)(e,6)}),_("shmd",function(e){return e.timestamp!==void 0||e.animationFrames!==void 0||e.animationFrameFlags!==void 0||e.timeline!==void 0||e.comps!==void 0},function(e,u,f){for(var k=(0,l.readUint32)(e),v=function(n){(0,l.checkSignature)(e,"8BIM");var w=(0,l.readSignature)(e);(0,l.readUint8)(e),(0,l.skipBytes)(e,3),(0,l.readSection)(e,1,function(E){if(w==="cust"){var C=(0,o.readVersionAndDescriptor)(e);C.layerTime!==void 0&&(u.timestamp=C.layerTime)}else if(w==="mlst"){var C=(0,o.readVersionAndDescriptor)(e);u.animationFrames=[];for(var R=0;R<C.LaSt.length;R++){var oe=C.LaSt[R],ue={frames:oe.FrLs};oe.enab!==void 0&&(ue.enable=oe.enab),oe.Ofst&&(ue.offset=(0,o.horzVrtcToXY)(oe.Ofst)),oe.FXRf&&(ue.referencePoint=(0,o.horzVrtcToXY)(oe.FXRf)),oe.Lefx&&(ue.effects=(0,o.parseEffects)(oe.Lefx,!!e.logMissingFeatures)),oe.blendOptions&&oe.blendOptions.Opct&&(ue.opacity=(0,o.parsePercent)(oe.blendOptions.Opct)),u.animationFrames.push(ue)}}else if(w==="mdyn"){(0,l.readUint16)(e);var re=(0,l.readUint8)(e),he=(0,l.readUint8)(e);u.animationFrameFlags={propagateFrameOne:!re,unifyLayerPosition:(he&1)!==0,unifyLayerStyle:(he&2)!==0,unifyLayerVisibility:(he&4)!==0}}else if(w==="tmln"){var C=(0,o.readVersionAndDescriptor)(e),A=C.timeScope,Se={start:(0,o.frac)(A.Strt),duration:(0,o.frac)(A.duration),inTime:(0,o.frac)(A.inTime),outTime:(0,o.frac)(A.outTime),autoScope:C.autoScope,audioLevel:C.audioLevel};C.trackList&&(Se.tracks=(0,o.parseTrackList)(C.trackList,!!e.logMissingFeatures)),u.timeline=Se}else if(w==="cmls"){var C=(0,o.readVersionAndDescriptor)(e);u.comps={settings:[]},C.origFXRefPoint&&(u.comps.originalEffectsReferencePoint={x:C.origFXRefPoint.Hrzn,y:C.origFXRefPoint.Vrtc});for(var Pe=0,Te=C.layerSettings;Pe<Te.length;Pe++){var He=Te[Pe];u.comps.settings.push({compList:He.compList});var T=u.comps.settings[u.comps.settings.length-1];"enab"in He&&(T.enabled=He.enab),He.Ofst&&(T.offset={x:He.Ofst.Hrzn,y:He.Ofst.Vrtc}),He.FXRefPoint&&(T.effectsReferencePoint={x:He.FXRefPoint.Hrzn,y:He.FXRefPoint.Vrtc})}}else if(w==="extn"){var C=(0,o.readVersionAndDescriptor)(e);e.logMissingFeatures&&e.log('Unhandled "shmd" section key',w)}else e.logMissingFeatures&&e.log('Unhandled "shmd" section key',w);(0,l.skipBytes)(e,E())})},i=0;i<k;i++)v(i);(0,l.skipBytes)(e,f())},function(e,u,f,k){var v=u.animationFrames,i=u.animationFrameFlags,n=u.timestamp,w=u.timeline,E=u.comps,C=0;v&&C++,i&&C++,w&&C++,n!==void 0&&C++,E&&C++,(0,h.writeUint32)(e,C),v&&((0,h.writeSignature)(e,"8BIM"),(0,h.writeSignature)(e,"mlst"),(0,h.writeUint8)(e,0),(0,h.writeZeros)(e,3),(0,h.writeSection)(e,2,function(){for(var R,oe={LaID:(R=u.id)!==null&&R!==void 0?R:0,LaSt:[]},ue=0;ue<v.length;ue++){var re=v[ue],he={};re.enable!==void 0&&(he.enab=re.enable),he.FrLs=re.frames,re.offset&&(he.Ofst=(0,o.xyToHorzVrtc)(re.offset)),re.referencePoint&&(he.FXRf=(0,o.xyToHorzVrtc)(re.referencePoint)),re.effects&&(he.Lefx=(0,o.serializeEffects)(re.effects,!1,!1)),re.opacity!==void 0&&(he.blendOptions={Opct:(0,o.unitsPercent)(re.opacity)}),oe.LaSt.push(he)}(0,o.writeVersionAndDescriptor)(e,"","null",oe)},!0)),i&&((0,h.writeSignature)(e,"8BIM"),(0,h.writeSignature)(e,"mdyn"),(0,h.writeUint8)(e,0),(0,h.writeZeros)(e,3),(0,h.writeSection)(e,2,function(){(0,h.writeUint16)(e,0),(0,h.writeUint8)(e,i.propagateFrameOne?0:15),(0,h.writeUint8)(e,(i.unifyLayerPosition?1:0)|(i.unifyLayerStyle?2:0)|(i.unifyLayerVisibility?4:0))})),w&&((0,h.writeSignature)(e,"8BIM"),(0,h.writeSignature)(e,"tmln"),(0,h.writeUint8)(e,0),(0,h.writeZeros)(e,3),(0,h.writeSection)(e,2,function(){var R={Vrsn:1,timeScope:{Vrsn:1,Strt:w.start,duration:w.duration,inTime:w.inTime,outTime:w.outTime},autoScope:w.autoScope,audioLevel:w.audioLevel};w.tracks&&(R.trackList=(0,o.serializeTrackList)(w.tracks));var oe=k.layerToId.get(u)||u.id;if(!oe)throw new Error("You need to provide layer.id value whan writing document with animations");R.LyrI=oe,(0,o.writeVersionAndDescriptor)(e,"","null",R,"anim")},!0)),n!==void 0&&((0,h.writeSignature)(e,"8BIM"),(0,h.writeSignature)(e,"cust"),(0,h.writeUint8)(e,0),(0,h.writeZeros)(e,3),(0,h.writeSection)(e,2,function(){var R={layerTime:n};(0,o.writeVersionAndDescriptor)(e,"","metadata",R)},!0)),E&&((0,h.writeSignature)(e,"8BIM"),(0,h.writeSignature)(e,"cmls"),(0,h.writeUint8)(e,0),(0,h.writeZeros)(e,3),(0,h.writeSection)(e,2,function(){var R=k.layerToId.get(u)||u.id;if(!R)throw new Error("You need to provide layer.id value whan writing document with layer comps");var oe={};E.originalEffectsReferencePoint&&(oe.origFXRefPoint={Hrzn:E.originalEffectsReferencePoint.x,Vrtc:E.originalEffectsReferencePoint.y}),oe.LyrI=R,oe.layerSettings=[];for(var ue=0,re=E.settings;ue<re.length;ue++){var he=re[ue],A={};he.enabled!==void 0&&(A.enab=he.enabled),he.offset&&(A.Ofst={Hrzn:he.offset.x,Vrtc:he.offset.y}),he.effectsReferencePoint&&(A.FXRefPoint={Hrzn:he.effectsReferencePoint.x,Vrtc:he.effectsReferencePoint.y}),A.compList=he.compList,oe.layerSettings.push(A)}(0,o.writeVersionAndDescriptor)(e,"","null",oe)},!0))}),_("PxSc",function(){return!1},function(e,u){var f=(0,o.readVersionAndDescriptor)(e,!0);f.pixelSourceType===1986285651?u.pixelSource={type:"vdPS",origin:{x:f.origin.Hrzn,y:f.origin.Vrtc},interpretation:{interpretAlpha:f.interpretation.interpretAlpha.split(".")[1],profile:f.interpretation.profile},frameReader:{type:"QTFR",link:{name:f.frameReader["Lnk "]["Nm "],fullPath:f.frameReader["Lnk "].fullPath,originalPath:f.frameReader["Lnk "].originalPath,relativePath:f.frameReader["Lnk "].relPath,alias:f.frameReader["Lnk "].alis},mediaDescriptor:f.frameReader.mediaDescriptor},showAlteredVideo:f.showAlteredVideo}:e.log("Unknown pixelSourceType")},function(e,u){var f=u.pixelSource,k={_name:"",_classID:"PixelSource",pixelSourceType:1986285651,descVersion:1,origin:{Hrzn:f.origin.x,Vrtc:f.origin.y},interpretation:{_name:"",_classID:"footageInterpretation",Vrsn:1,interpretAlpha:"alphaInterpretation.".concat(f.interpretation.interpretAlpha),profile:f.interpretation.profile},frameReader:{_name:"",_classID:"FrameReader",frameReaderType:1364477522,descVersion:1,"Lnk ":{_name:"",_classID:"ExternalFileLink",descVersion:2,"Nm ":f.frameReader.link.name,fullPath:f.frameReader.link.fullPath,originalPath:f.frameReader.link.originalPath,alis:f.frameReader.link.alias,relPath:f.frameReader.link.relativePath},mediaDescriptor:f.frameReader.mediaDescriptor},showAlteredVideo:f.showAlteredVideo};(0,o.writeVersionAndDescriptor)(e,"","PixelSource",k)}),_("vstk",I("vectorStroke"),function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);u.vectorStroke={strokeEnabled:k.strokeEnabled,fillEnabled:k.fillEnabled,lineWidth:(0,o.parseUnits)(k.strokeStyleLineWidth),lineDashOffset:(0,o.parseUnits)(k.strokeStyleLineDashOffset),miterLimit:k.strokeStyleMiterLimit,lineCapType:o.strokeStyleLineCapType.decode(k.strokeStyleLineCapType),lineJoinType:o.strokeStyleLineJoinType.decode(k.strokeStyleLineJoinType),lineAlignment:o.strokeStyleLineAlignment.decode(k.strokeStyleLineAlignment),scaleLock:k.strokeStyleScaleLock,strokeAdjust:k.strokeStyleStrokeAdjust,lineDashSet:k.strokeStyleLineDashSet.map(o.parseUnits),blendMode:o.BlnM.decode(k.strokeStyleBlendMode),opacity:(0,o.parsePercent)(k.strokeStyleOpacity),content:(0,o.parseVectorContent)(k.strokeStyleContent),resolution:k.strokeStyleResolution},(0,l.skipBytes)(e,f())},function(e,u){var f,k,v,i=u.vectorStroke,n={strokeStyleVersion:2,strokeEnabled:!!i.strokeEnabled,fillEnabled:!!i.fillEnabled,strokeStyleLineWidth:i.lineWidth||{value:3,units:"Points"},strokeStyleLineDashOffset:i.lineDashOffset||{value:0,units:"Points"},strokeStyleMiterLimit:(f=i.miterLimit)!==null&&f!==void 0?f:100,strokeStyleLineCapType:o.strokeStyleLineCapType.encode(i.lineCapType),strokeStyleLineJoinType:o.strokeStyleLineJoinType.encode(i.lineJoinType),strokeStyleLineAlignment:o.strokeStyleLineAlignment.encode(i.lineAlignment),strokeStyleScaleLock:!!i.scaleLock,strokeStyleStrokeAdjust:!!i.strokeAdjust,strokeStyleLineDashSet:i.lineDashSet||[],strokeStyleBlendMode:o.BlnM.encode(i.blendMode),strokeStyleOpacity:(0,o.unitsPercent)((k=i.opacity)!==null&&k!==void 0?k:1),strokeStyleContent:(0,o.serializeVectorContent)(i.content||{type:"color",color:{r:0,g:0,b:0}}).descriptor,strokeStyleResolution:(v=i.resolution)!==null&&v!==void 0?v:72};(0,o.writeVersionAndDescriptor)(e,"","strokeStyle",n)}),_("artb",I("artboard"),function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e),v=k.artboardRect;u.artboard={rect:{top:v["Top "],left:v.Left,bottom:v.Btom,right:v.Rght},guideIndices:k.guideIndeces,presetName:k.artboardPresetName,color:(0,o.parseColor)(k["Clr "]),backgroundType:k.artboardBackgroundType},(0,l.skipBytes)(e,f())},function(e,u){var f,k=u.artboard,v=k.rect,i={artboardRect:{"Top ":v.top,Left:v.left,Btom:v.bottom,Rght:v.right},guideIndeces:k.guideIndices||[],artboardPresetName:k.presetName||"","Clr ":(0,o.serializeColor)(k.color),artboardBackgroundType:(f=k.backgroundType)!==null&&f!==void 0?f:1};(0,o.writeVersionAndDescriptor)(e,"","artboard",i)}),_("sn2P",I("usingAlignedRendering"),function(e,u){return u.usingAlignedRendering=!!(0,l.readUint32)(e)},function(e,u){return(0,h.writeUint32)(e,u.usingAlignedRendering?1:0)});var X=["unknown","vector","raster","image stack"];function Q(e){var u,f,k,v,i,n,w=r(r({style:o.warpStyle.decode(e.warpStyle)},e.warpValues?{values:e.warpValues}:{value:e.warpValue||0}),{perspective:e.warpPerspective||0,perspectiveOther:e.warpPerspectiveOther||0,rotate:o.Ornt.decode(e.warpRotate),bounds:e.bounds&&{top:(0,o.parseUnitsOrNumber)(e.bounds["Top "]),left:(0,o.parseUnitsOrNumber)(e.bounds.Left),bottom:(0,o.parseUnitsOrNumber)(e.bounds.Btom),right:(0,o.parseUnitsOrNumber)(e.bounds.Rght)},uOrder:e.uOrder,vOrder:e.vOrder});(e.deformNumRows!=null||e.deformNumCols!=null)&&(w.deformNumRows=e.deformNumRows,w.deformNumCols=e.deformNumCols);var E=e.customEnvelopeWarp;if(E){w.customEnvelopeWarp={meshPoints:[]};for(var C=((u=E.meshPoints.find(function(ue){return ue.type==="Hrzn"}))===null||u===void 0?void 0:u.values)||[],R=((f=E.meshPoints.find(function(ue){return ue.type==="Vrtc"}))===null||f===void 0?void 0:f.values)||[],oe=0;oe<C.length;oe++)w.customEnvelopeWarp.meshPoints.push({x:C[oe],y:R[oe]});(E.quiltSliceX||E.quiltSliceY)&&(w.customEnvelopeWarp.quiltSliceX=((v=(k=E.quiltSliceX)===null||k===void 0?void 0:k[0])===null||v===void 0?void 0:v.values)||[],w.customEnvelopeWarp.quiltSliceY=((n=(i=E.quiltSliceY)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.values)||[])}return w}function V(e){var u,f;return e.deformNumCols!=null||e.deformNumRows!=null||((u=e.customEnvelopeWarp)===null||u===void 0?void 0:u.quiltSliceX)||((f=e.customEnvelopeWarp)===null||f===void 0?void 0:f.quiltSliceY)}function te(e){var u=e.bounds,f=r(r({warpStyle:o.warpStyle.encode(e.style)},e.values?{warpValues:e.values}:{warpValue:e.value||0}),{warpPerspective:e.perspective||0,warpPerspectiveOther:e.perspectiveOther||0,warpRotate:o.Ornt.encode(e.rotate),bounds:{"Top ":(0,o.unitsValue)(u&&u.top||{units:"Pixels",value:0},"bounds.top"),Left:(0,o.unitsValue)(u&&u.left||{units:"Pixels",value:0},"bounds.left"),Btom:(0,o.unitsValue)(u&&u.bottom||{units:"Pixels",value:0},"bounds.bottom"),Rght:(0,o.unitsValue)(u&&u.right||{units:"Pixels",value:0},"bounds.right")},uOrder:e.uOrder||0,vOrder:e.vOrder||0}),k=V(e);if(k){var v=f;v.deformNumRows=e.deformNumRows||0,v.deformNumCols=e.deformNumCols||0}var i=e.customEnvelopeWarp;if(i){var n=i.meshPoints||[];if(k){var v=f;v.customEnvelopeWarp={_name:"",_classID:"customEnvelopeWarp",quiltSliceX:[{type:"quiltSliceX",values:i.quiltSliceX||[]}],quiltSliceY:[{type:"quiltSliceY",values:i.quiltSliceY||[]}],meshPoints:[{type:"Hrzn",values:n.map(function(E){return E.x})},{type:"Vrtc",values:n.map(function(E){return E.y})}]}}else f.customEnvelopeWarp={_name:"",_classID:"customEnvelopeWarp",meshPoints:[{type:"Hrzn",values:n.map(function(w){return w.x})},{type:"Vrtc",values:n.map(function(w){return w.y})}]}}return f}_("PlLd",I("placedLayer"),function(e,u,f){if((0,l.readSignature)(e)!=="plcL")throw new Error("Invalid PlLd signature");if((0,l.readInt32)(e)!==3)throw new Error("Invalid PlLd version");var k=(0,l.readPascalString)(e,1),v=(0,l.readInt32)(e),i=(0,l.readInt32)(e);(0,l.readInt32)(e);var n=(0,l.readInt32)(e);if(!X[n])throw new Error("Invalid PlLd type");for(var w=[],E=0;E<8;E++)w.push((0,l.readFloat64)(e));var C=(0,l.readInt32)(e);if(C!==0)throw new Error("Invalid Warp version ".concat(C));var R=(0,o.readVersionAndDescriptor)(e);u.placedLayer=u.placedLayer||{id:k,type:X[n],pageNumber:v,totalPages:i,transform:w,warp:Q(R)},(0,l.skipBytes)(e,f())},function(e,u){var f=u.placedLayer;if((0,h.writeSignature)(e,"plcL"),(0,h.writeInt32)(e,3),!f.id||typeof f.id!="string"||!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(f.id))throw new Error("Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)");if((0,h.writePascalString)(e,f.id,1),(0,h.writeInt32)(e,1),(0,h.writeInt32)(e,1),(0,h.writeInt32)(e,16),X.indexOf(f.type)===-1)throw new Error("Invalid placedLayer type");(0,h.writeInt32)(e,X.indexOf(f.type));for(var k=0;k<8;k++)(0,h.writeFloat64)(e,f.transform[k]);(0,h.writeInt32)(e,0);var v=we(f),i=V(v)?"quiltWarp":"warp";(0,o.writeVersionAndDescriptor)(e,"",i,te(v),i)});function J(e){return new Float32Array(e.buffer.slice(e.byteOffset),0,e.byteLength/4)}function G(e){return new Uint32Array(e.buffer.slice(e.byteOffset),0,e.byteLength/4)}function $(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function ce(e){for(var u=[],f=0;f<e.length;f+=2)u.push({x:e[f],y:e[f+1]});return u}function se(e){for(var u=[],f=0;f<e.length;f++)u.push(e[f].x,e[f].y);return u}function g(e){return ce(J(e))}function L(e){return{x:(0,o.parseUnits)(e.Hrzn),y:(0,o.parseUnits)(e.Vrtc)}}function j(e){return{_name:"",_classID:"Pnt ",Hrzn:(0,o.unitsValue)(e.x,"x"),Vrtc:(0,o.unitsValue)(e.y,"y")}}function ne(e,u){var f={name:e["Nm "],opacity:(0,o.parsePercent)(e.blendOptions.Opct),blendMode:o.BlnM.decode(e.blendOptions["Md "]),enabled:e.enab,hasOptions:e.hasoptions,foregroundColor:(0,o.parseColor)(e.FrgC),backgroundColor:(0,o.parseColor)(e.BckC)};if("Fltr"in e)switch(e.Fltr._classID){case"boxblur":return r(r({},f),{type:"box blur",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "])}});case"GsnB":return r(r({},f),{type:"gaussian blur",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "])}});case"MtnB":return r(r({},f),{type:"motion blur",filter:{angle:e.Fltr.Angl,distance:(0,o.parseUnits)(e.Fltr.Dstn)}});case"RdlB":return r(r({},f),{type:"radial blur",filter:{amount:e.Fltr.Amnt,method:o.BlrM.decode(e.Fltr.BlrM),quality:o.BlrQ.decode(e.Fltr.BlrQ)}});case"shapeBlur":return r(r({},f),{type:"shape blur",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "]),customShape:{name:e.Fltr.customShape["Nm "],id:e.Fltr.customShape.Idnt}}});case"SmrB":return r(r({},f),{type:"smart blur",filter:{radius:e.Fltr["Rds "],threshold:e.Fltr.Thsh,quality:o.SmBQ.decode(e.Fltr.SmBQ),mode:o.SmBM.decode(e.Fltr.SmBM)}});case"surfaceBlur":return r(r({},f),{type:"surface blur",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "]),threshold:e.Fltr.Thsh}});case"Dspl":return r(r({},f),{type:"displace",filter:{horizontalScale:e.Fltr.HrzS,verticalScale:e.Fltr.VrtS,displacementMap:o.DspM.decode(e.Fltr.DspM),undefinedAreas:o.UndA.decode(e.Fltr.UndA),displacementFile:{signature:e.Fltr.DspF.sig,path:e.Fltr.DspF.path}}});case"Pnch":return r(r({},f),{type:"pinch",filter:{amount:e.Fltr.Amnt}});case"Plr ":return r(r({},f),{type:"polar coordinates",filter:{conversion:o.Cnvr.decode(e.Fltr.Cnvr)}});case"Rple":return r(r({},f),{type:"ripple",filter:{amount:e.Fltr.Amnt,size:o.RplS.decode(e.Fltr.RplS)}});case"Shr ":return r(r({},f),{type:"shear",filter:{shearPoints:e.Fltr.ShrP.map(function(w){return{x:w.Hrzn,y:w.Vrtc}}),shearStart:e.Fltr.ShrS,shearEnd:e.Fltr.ShrE,undefinedAreas:o.UndA.decode(e.Fltr.UndA)}});case"Sphr":return r(r({},f),{type:"spherize",filter:{amount:e.Fltr.Amnt,mode:o.SphM.decode(e.Fltr.SphM)}});case"Twrl":return r(r({},f),{type:"twirl",filter:{angle:e.Fltr.Angl}});case"Wave":return r(r({},f),{type:"wave",filter:{numberOfGenerators:e.Fltr.NmbG,type:o.Wvtp.decode(e.Fltr.Wvtp),wavelength:{min:e.Fltr.WLMn,max:e.Fltr.WLMx},amplitude:{min:e.Fltr.AmMn,max:e.Fltr.AmMx},scale:{x:e.Fltr.SclH,y:e.Fltr.SclV},randomSeed:e.Fltr.RndS,undefinedAreas:o.UndA.decode(e.Fltr.UndA)}});case"ZgZg":return r(r({},f),{type:"zigzag",filter:{amount:e.Fltr.Amnt,ridges:e.Fltr.NmbR,style:o.ZZTy.decode(e.Fltr.ZZTy)}});case"AdNs":return r(r({},f),{type:"add noise",filter:{amount:(0,o.parsePercent)(e.Fltr.Nose),distribution:o.Dstr.decode(e.Fltr.Dstr),monochromatic:e.Fltr.Mnch,randomSeed:e.Fltr.FlRs}});case"DstS":return r(r({},f),{type:"dust and scratches",filter:{radius:e.Fltr["Rds "],threshold:e.Fltr.Thsh}});case"Mdn ":return r(r({},f),{type:"median",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "])}});case"denoise":return r(r({},f),{type:"reduce noise",filter:{preset:e.Fltr.preset,removeJpegArtifact:e.Fltr.removeJPEGArtifact,reduceColorNoise:(0,o.parsePercent)(e.Fltr.ClNs),sharpenDetails:(0,o.parsePercent)(e.Fltr.Shrp),channelDenoise:e.Fltr.channelDenoise.map(function(w){return r({channels:w.Chnl.map(o.Chnl.decode),amount:w.Amnt},w.EdgF?{preserveDetails:w.EdgF}:{})})}});case"ClrH":return r(r({},f),{type:"color halftone",filter:{radius:e.Fltr["Rds "],angle1:e.Fltr.Ang1,angle2:e.Fltr.Ang2,angle3:e.Fltr.Ang3,angle4:e.Fltr.Ang4}});case"Crst":return r(r({},f),{type:"crystallize",filter:{cellSize:e.Fltr.ClSz,randomSeed:e.Fltr.FlRs}});case"Mztn":return r(r({},f),{type:"mezzotint",filter:{type:o.MztT.decode(e.Fltr.MztT),randomSeed:e.Fltr.FlRs}});case"Msc ":return r(r({},f),{type:"mosaic",filter:{cellSize:(0,o.parseUnits)(e.Fltr.ClSz)}});case"Pntl":return r(r({},f),{type:"pointillize",filter:{cellSize:e.Fltr.ClSz,randomSeed:e.Fltr.FlRs}});case"Clds":return r(r({},f),{type:"clouds",filter:{randomSeed:e.Fltr.FlRs}});case"DfrC":return r(r({},f),{type:"difference clouds",filter:{randomSeed:e.Fltr.FlRs}});case"Fbrs":return r(r({},f),{type:"fibers",filter:{variance:e.Fltr.Vrnc,strength:e.Fltr.Strg,randomSeed:e.Fltr.RndS}});case"LnsF":return r(r({},f),{type:"lens flare",filter:{brightness:e.Fltr.Brgh,position:{x:e.Fltr.FlrC.Hrzn,y:e.Fltr.FlrC.Vrtc},lensType:o.Lns.decode(e.Fltr["Lns "])}});case"smartSharpen":return r(r({},f),{type:"smart sharpen",filter:{amount:(0,o.parsePercent)(e.Fltr.Amnt),radius:(0,o.parseUnits)(e.Fltr["Rds "]),threshold:e.Fltr.Thsh,angle:e.Fltr.Angl,moreAccurate:e.Fltr.moreAccurate,blur:o.blurType.decode(e.Fltr.blur),preset:e.Fltr.preset,shadow:{fadeAmount:(0,o.parsePercent)(e.Fltr.sdwM.Amnt),tonalWidth:(0,o.parsePercent)(e.Fltr.sdwM.Wdth),radius:e.Fltr.sdwM["Rds "]},highlight:{fadeAmount:(0,o.parsePercent)(e.Fltr.hglM.Amnt),tonalWidth:(0,o.parsePercent)(e.Fltr.hglM.Wdth),radius:e.Fltr.hglM["Rds "]}}});case"UnsM":return r(r({},f),{type:"unsharp mask",filter:{amount:(0,o.parsePercent)(e.Fltr.Amnt),radius:(0,o.parseUnits)(e.Fltr["Rds "]),threshold:e.Fltr.Thsh}});case"Dfs ":return r(r({},f),{type:"diffuse",filter:{mode:o.DfsM.decode(e.Fltr["Md "]),randomSeed:e.Fltr.FlRs}});case"Embs":return r(r({},f),{type:"emboss",filter:{angle:e.Fltr.Angl,height:e.Fltr.Hght,amount:e.Fltr.Amnt}});case"Extr":return r(r({},f),{type:"extrude",filter:{type:o.ExtT.decode(e.Fltr.ExtT),size:e.Fltr.ExtS,depth:e.Fltr.ExtD,depthMode:o.ExtR.decode(e.Fltr.ExtR),randomSeed:e.Fltr.FlRs,solidFrontFaces:e.Fltr.ExtF,maskIncompleteBlocks:e.Fltr.ExtM}});case"Tls ":return r(r({},f),{type:"tiles",filter:{numberOfTiles:e.Fltr.TlNm,maximumOffset:e.Fltr.TlOf,fillEmptyAreaWith:o.FlCl.decode(e.Fltr.FlCl),randomSeed:e.Fltr.FlRs}});case"TrcC":return r(r({},f),{type:"trace contour",filter:{level:e.Fltr["Lvl "],edge:o.CntE.decode(e.Fltr["Edg "])}});case"Wnd ":return r(r({},f),{type:"wind",filter:{method:o.WndM.decode(e.Fltr.WndM),direction:o.Drct.decode(e.Fltr.Drct)}});case"Dntr":return r(r({},f),{type:"de-interlace",filter:{eliminate:o.IntE.decode(e.Fltr.IntE),newFieldsBy:o.IntC.decode(e.Fltr.IntC)}});case"Cstm":return r(r({},f),{type:"custom",filter:{scale:e.Fltr["Scl "],offset:e.Fltr.Ofst,matrix:e.Fltr.Mtrx}});case"HghP":return r(r({},f),{type:"high pass",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "])}});case"Mxm ":return r(r({},f),{type:"maximum",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "])}});case"Mnm ":return r(r({},f),{type:"minimum",filter:{radius:(0,o.parseUnits)(e.Fltr["Rds "])}});case"Ofst":return r(r({},f),{type:"offset",filter:{horizontal:e.Fltr.Hrzn,vertical:e.Fltr.Vrtc,undefinedAreas:o.FlMd.decode(e.Fltr["Fl "])}});case"rigidTransform":return r(r({},f),{type:"puppet",filter:{rigidType:e.Fltr.rigidType,bounds:[{x:e.Fltr.PuX0,y:e.Fltr.PuY0},{x:e.Fltr.PuX1,y:e.Fltr.PuY1},{x:e.Fltr.PuX2,y:e.Fltr.PuY2},{x:e.Fltr.PuX3,y:e.Fltr.PuY3}],puppetShapeList:e.Fltr.puppetShapeList.map(function(w){return{rigidType:w.rigidType,originalVertexArray:g(w.originalVertexArray),deformedVertexArray:g(w.deformedVertexArray),indexArray:Array.from(G(w.indexArray)),pinOffsets:ce(w.pinOffsets),posFinalPins:ce(w.posFinalPins),pinVertexIndices:w.pinVertexIndices,selectedPin:w.selectedPin,pinPosition:ce(w.PinP),pinRotation:w.PnRt,pinOverlay:w.PnOv,pinDepth:w.PnDp,meshQuality:w.meshQuality,meshExpansion:w.meshExpansion,meshRigidity:w.meshRigidity,imageResolution:w.imageResolution,meshBoundaryPath:{pathComponents:w.meshBoundaryPath.pathComponents.map(function(E){return{shapeOperation:E.shapeOperation.split(".")[1],paths:E.SbpL.map(function(C){return{closed:C.Clsp,points:C["Pts "].map(function(R){return{anchor:L(R.Anch),forward:L(R["Fwd "]),backward:L(R["Bwd "]),smooth:R.Smoo}})}})}})}}})}});case"PbPl":for(var k=[],v=e.Fltr,i=0;i<M.length&&v["PN".concat(M[i],"a")];i++)for(var n=0;n<M.length&&v["PN".concat(M[i]).concat(M[n])];n++)k.push({name:v["PN".concat(M[i]).concat(M[n])],value:v["PF".concat(M[i]).concat(M[n])]});return r(r({},f),{type:"oil paint plugin",filter:{name:e.Fltr.KnNm,gpu:e.Fltr.GpuY,lighting:e.Fltr.LIWy,parameters:k}});case"HsbP":return r(r({},f),{type:"hsb/hsl",filter:{inputMode:o.ClrS.decode(e.Fltr.Inpt),rowOrder:o.ClrS.decode(e.Fltr.Otpt)}});case"oilPaint":return r(r({},f),{type:"oil paint",filter:{lightingOn:e.Fltr.lightingOn,stylization:e.Fltr.stylization,cleanliness:e.Fltr.cleanliness,brushScale:e.Fltr.brushScale,microBrush:e.Fltr.microBrush,lightDirection:e.Fltr.LghD,specularity:e.Fltr.specularity}});case"LqFy":return r(r({},f),{type:"liquify",filter:{liquifyMesh:e.Fltr.LqMe}});case"perspectiveWarpTransform":return r(r({},f),{type:"perspective warp",filter:{vertices:e.Fltr.vertices.map(L),warpedVertices:e.Fltr.warpedVertices.map(L),quads:e.Fltr.quads.map(function(w){return w.indices})}});case"Crvs":return r(r({},f),{type:"curves",filter:r({presetKind:o.presetKindType.decode(e.Fltr.presetKind)},e.Fltr.Adjs?{adjustments:e.Fltr.Adjs.map(function(w){var E=w.Chnl.map(o.Chnl.decode);if(w["Crv "])return{channels:E,curve:w["Crv "].map(function(C){var R={x:C.Hrzn,y:C.Vrtc};return C.Cnty&&(R.curved=!0),R})};if(w.Mpng)return{channels:E,values:w.Mpng};throw new Error("Unknown curve adjustment")})}:{})});case"BrgC":return r(r({},f),{type:"brightness/contrast",filter:{brightness:e.Fltr.Brgh,contrast:e.Fltr.Cntr,useLegacy:!!e.Fltr.useLegacy}});default:if(u.throwForMissingFeatures)throw new Error("Unknown filter classId: ".concat(e.Fltr._classID));return}else switch(e.filterID){case 1098281575:return r(r({},f),{type:"average"});case 1114403360:return r(r({},f),{type:"blur"});case 1114403405:return r(r({},f),{type:"blur more"});case 1148416099:return r(r({},f),{type:"despeckle"});case 1180922912:return r(r({},f),{type:"facet"});case 1181902701:return r(r({},f),{type:"fragment"});case 1399353968:return r(r({},f),{type:"sharpen"});case 1399353925:return r(r({},f),{type:"sharpen edges"});case 1399353933:return r(r({},f),{type:"sharpen more"});case 1181639749:return r(r({},f),{type:"find edges"});case 1399616122:return r(r({},f),{type:"solarize"});case 1314149187:return r(r({},f),{type:"ntsc colors"});case 1231976050:return r(r({},f),{type:"invert"});default:if(u.throwForMissingFeatures)throw new Error("Unknown filterID: ".concat(e.filterID))}}function z(e,u){return{enabled:e.enab,validAtPosition:e.validAtPosition,maskEnabled:e.filterMaskEnable,maskLinked:e.filterMaskLinked,maskExtendWithWhite:e.filterMaskExtendWithWhite,list:e.filterFXList.map(function(f){return ne(f,u)}).filter(function(f){return!!f})}}function Y(e){return(0,o.unitsValue)(e.radius,"radius")}function ve(e){var u={_name:"",_classID:"filterFX","Nm ":e.name,blendOptions:{_name:"",_classID:"blendOptions",Opct:(0,o.unitsPercentF)(e.opacity),"Md ":o.BlnM.encode(e.blendMode)},enab:e.enabled,hasoptions:e.hasOptions,FrgC:(0,o.serializeColor)(e.foregroundColor),BckC:(0,o.serializeColor)(e.backgroundColor)};switch(e.type){case"average":return r(r({},u),{filterID:1098281575});case"blur":return r(r({},u),{filterID:1114403360});case"blur more":return r(r({},u),{filterID:1114403405});case"box blur":return r(r({},u),{Fltr:{_name:"Box Blur",_classID:"boxblur","Rds ":Y(e.filter)},filterID:697});case"gaussian blur":return r(r({},u),{Fltr:{_name:"Gaussian Blur",_classID:"GsnB","Rds ":Y(e.filter)},filterID:1198747202});case"motion blur":return r(r({},u),{Fltr:{_name:"Motion Blur",_classID:"MtnB",Angl:e.filter.angle,Dstn:(0,o.unitsValue)(e.filter.distance,"distance")},filterID:1299476034});case"radial blur":return r(r({},u),{Fltr:{_name:"Radial Blur",_classID:"RdlB",Amnt:e.filter.amount,BlrM:o.BlrM.encode(e.filter.method),BlrQ:o.BlrQ.encode(e.filter.quality)},filterID:1382313026});case"shape blur":return r(r({},u),{Fltr:{_name:"Shape Blur",_classID:"shapeBlur","Rds ":Y(e.filter),customShape:{_name:"",_classID:"customShape","Nm ":e.filter.customShape.name,Idnt:e.filter.customShape.id}},filterID:702});case"smart blur":return r(r({},u),{Fltr:{_name:"Smart Blur",_classID:"SmrB","Rds ":e.filter.radius,Thsh:e.filter.threshold,SmBQ:o.SmBQ.encode(e.filter.quality),SmBM:o.SmBM.encode(e.filter.mode)},filterID:1399681602});case"surface blur":return r(r({},u),{Fltr:{_name:"Surface Blur",_classID:"surfaceBlur","Rds ":Y(e.filter),Thsh:e.filter.threshold},filterID:701});case"displace":return r(r({},u),{Fltr:{_name:"Displace",_classID:"Dspl",HrzS:e.filter.horizontalScale,VrtS:e.filter.verticalScale,DspM:o.DspM.encode(e.filter.displacementMap),UndA:o.UndA.encode(e.filter.undefinedAreas),DspF:{sig:e.filter.displacementFile.signature,path:e.filter.displacementFile.path}},filterID:1148416108});case"pinch":return r(r({},u),{Fltr:{_name:"Pinch",_classID:"Pnch",Amnt:e.filter.amount},filterID:1349411688});case"polar coordinates":return r(r({},u),{Fltr:{_name:"Polar Coordinates",_classID:"Plr ",Cnvr:o.Cnvr.encode(e.filter.conversion)},filterID:1349284384});case"ripple":return r(r({},u),{Fltr:{_name:"Ripple",_classID:"Rple",Amnt:e.filter.amount,RplS:o.RplS.encode(e.filter.size)},filterID:1383099493});case"shear":return r(r({},u),{Fltr:{_name:"Shear",_classID:"Shr ",ShrP:e.filter.shearPoints.map(function(E){return{_name:"",_classID:"Pnt ",Hrzn:E.x,Vrtc:E.y}}),UndA:o.UndA.encode(e.filter.undefinedAreas),ShrS:e.filter.shearStart,ShrE:e.filter.shearEnd},filterID:1399353888});case"spherize":return r(r({},u),{Fltr:{_name:"Spherize",_classID:"Sphr",Amnt:e.filter.amount,SphM:o.SphM.encode(e.filter.mode)},filterID:1399875698});case"twirl":return r(r({},u),{Fltr:{_name:"Twirl",_classID:"Twrl",Angl:e.filter.angle},filterID:1417114220});case"wave":return r(r({},u),{Fltr:{_name:"Wave",_classID:"Wave",Wvtp:o.Wvtp.encode(e.filter.type),NmbG:e.filter.numberOfGenerators,WLMn:e.filter.wavelength.min,WLMx:e.filter.wavelength.max,AmMn:e.filter.amplitude.min,AmMx:e.filter.amplitude.max,SclH:e.filter.scale.x,SclV:e.filter.scale.y,UndA:o.UndA.encode(e.filter.undefinedAreas),RndS:e.filter.randomSeed},filterID:1466005093});case"zigzag":return r(r({},u),{Fltr:{_name:"ZigZag",_classID:"ZgZg",Amnt:e.filter.amount,NmbR:e.filter.ridges,ZZTy:o.ZZTy.encode(e.filter.style)},filterID:1516722791});case"add noise":return r(r({},u),{Fltr:{_name:"Add Noise",_classID:"AdNs",Dstr:o.Dstr.encode(e.filter.distribution),Nose:(0,o.unitsPercentF)(e.filter.amount),Mnch:e.filter.monochromatic,FlRs:e.filter.randomSeed},filterID:1097092723});case"despeckle":return r(r({},u),{filterID:1148416099});case"dust and scratches":return r(r({},u),{Fltr:{_name:"Dust & Scratches",_classID:"DstS","Rds ":e.filter.radius,Thsh:e.filter.threshold},filterID:1148417107});case"median":return r(r({},u),{Fltr:{_name:"Median",_classID:"Mdn ","Rds ":Y(e.filter)},filterID:1298427424});case"reduce noise":return r(r({},u),{Fltr:{_name:"Reduce Noise",_classID:"denoise",ClNs:(0,o.unitsPercentF)(e.filter.reduceColorNoise),Shrp:(0,o.unitsPercentF)(e.filter.sharpenDetails),removeJPEGArtifact:e.filter.removeJpegArtifact,channelDenoise:e.filter.channelDenoise.map(function(E){return r({_name:"",_classID:"channelDenoiseParams",Chnl:E.channels.map(function(C){return o.Chnl.encode(C)}),Amnt:E.amount},E.preserveDetails?{EdgF:E.preserveDetails}:{})}),preset:e.filter.preset},filterID:633});case"color halftone":return r(r({},u),{Fltr:{_name:"Color Halftone",_classID:"ClrH","Rds ":e.filter.radius,Ang1:e.filter.angle1,Ang2:e.filter.angle2,Ang3:e.filter.angle3,Ang4:e.filter.angle4},filterID:1131180616});case"crystallize":return r(r({},u),{Fltr:{_name:"Crystallize",_classID:"Crst",ClSz:e.filter.cellSize,FlRs:e.filter.randomSeed},filterID:1131574132});case"facet":return r(r({},u),{filterID:1180922912});case"fragment":return r(r({},u),{filterID:1181902701});case"mezzotint":return r(r({},u),{Fltr:{_name:"Mezzotint",_classID:"Mztn",MztT:o.MztT.encode(e.filter.type),FlRs:e.filter.randomSeed},filterID:1299870830});case"mosaic":return r(r({},u),{Fltr:{_name:"Mosaic",_classID:"Msc ",ClSz:(0,o.unitsValue)(e.filter.cellSize,"cellSize")},filterID:1299407648});case"pointillize":return r(r({},u),{Fltr:{_name:"Pointillize",_classID:"Pntl",ClSz:e.filter.cellSize,FlRs:e.filter.randomSeed},filterID:1349416044});case"clouds":return r(r({},u),{Fltr:{_name:"Clouds",_classID:"Clds",FlRs:e.filter.randomSeed},filterID:1131177075});case"difference clouds":return r(r({},u),{Fltr:{_name:"Difference Clouds",_classID:"DfrC",FlRs:e.filter.randomSeed},filterID:1147564611});case"fibers":return r(r({},u),{Fltr:{_name:"Fibers",_classID:"Fbrs",Vrnc:e.filter.variance,Strg:e.filter.strength,RndS:e.filter.randomSeed},filterID:1180856947});case"lens flare":return r(r({},u),{Fltr:{_name:"Lens Flare",_classID:"LnsF",Brgh:e.filter.brightness,FlrC:{_name:"",_classID:"Pnt ",Hrzn:e.filter.position.x,Vrtc:e.filter.position.y},"Lns ":o.Lns.encode(e.filter.lensType)},filterID:1282306886});case"sharpen":return r(r({},u),{filterID:1399353968});case"sharpen edges":return r(r({},u),{filterID:1399353925});case"sharpen more":return r(r({},u),{filterID:1399353933});case"smart sharpen":return r(r({},u),{Fltr:{_name:"Smart Sharpen",_classID:"smartSharpen",Amnt:(0,o.unitsPercentF)(e.filter.amount),"Rds ":Y(e.filter),Thsh:e.filter.threshold,Angl:e.filter.angle,moreAccurate:e.filter.moreAccurate,blur:o.blurType.encode(e.filter.blur),preset:e.filter.preset,sdwM:{_name:"Parameters",_classID:"adaptCorrectTones",Amnt:(0,o.unitsPercentF)(e.filter.shadow.fadeAmount),Wdth:(0,o.unitsPercentF)(e.filter.shadow.tonalWidth),"Rds ":e.filter.shadow.radius},hglM:{_name:"Parameters",_classID:"adaptCorrectTones",Amnt:(0,o.unitsPercentF)(e.filter.highlight.fadeAmount),Wdth:(0,o.unitsPercentF)(e.filter.highlight.tonalWidth),"Rds ":e.filter.highlight.radius}},filterID:698});case"unsharp mask":return r(r({},u),{Fltr:{_name:"Unsharp Mask",_classID:"UnsM",Amnt:(0,o.unitsPercentF)(e.filter.amount),"Rds ":Y(e.filter),Thsh:e.filter.threshold},filterID:1433301837});case"diffuse":return r(r({},u),{Fltr:{_name:"Diffuse",_classID:"Dfs ","Md ":o.DfsM.encode(e.filter.mode),FlRs:e.filter.randomSeed},filterID:1147564832});case"emboss":return r(r({},u),{Fltr:{_name:"Emboss",_classID:"Embs",Angl:e.filter.angle,Hght:e.filter.height,Amnt:e.filter.amount},filterID:1164796531});case"extrude":return r(r({},u),{Fltr:{_name:"Extrude",_classID:"Extr",ExtS:e.filter.size,ExtD:e.filter.depth,ExtF:e.filter.solidFrontFaces,ExtM:e.filter.maskIncompleteBlocks,ExtT:o.ExtT.encode(e.filter.type),ExtR:o.ExtR.encode(e.filter.depthMode),FlRs:e.filter.randomSeed},filterID:1165522034});case"find edges":return r(r({},u),{filterID:1181639749});case"solarize":return r(r({},u),{filterID:1399616122});case"tiles":return r(r({},u),{Fltr:{_name:"Tiles",_classID:"Tls ",TlNm:e.filter.numberOfTiles,TlOf:e.filter.maximumOffset,FlCl:o.FlCl.encode(e.filter.fillEmptyAreaWith),FlRs:e.filter.randomSeed},filterID:1416393504});case"trace contour":return r(r({},u),{Fltr:{_name:"Trace Contour",_classID:"TrcC","Lvl ":e.filter.level,"Edg ":o.CntE.encode(e.filter.edge)},filterID:1416782659});case"wind":return r(r({},u),{Fltr:{_name:"Wind",_classID:"Wnd ",WndM:o.WndM.encode(e.filter.method),Drct:o.Drct.encode(e.filter.direction)},filterID:1466852384});case"de-interlace":return r(r({},u),{Fltr:{_name:"De-Interlace",_classID:"Dntr",IntE:o.IntE.encode(e.filter.eliminate),IntC:o.IntC.encode(e.filter.newFieldsBy)},filterID:1148089458});case"ntsc colors":return r(r({},u),{filterID:1314149187});case"invert":return r(r({},u),{filterID:1231976050});case"custom":return r(r({},u),{Fltr:{_name:"Custom",_classID:"Cstm","Scl ":e.filter.scale,Ofst:e.filter.offset,Mtrx:e.filter.matrix},filterID:1131639917});case"high pass":return r(r({},u),{Fltr:{_name:"High Pass",_classID:"HghP","Rds ":Y(e.filter)},filterID:1214736464});case"maximum":return r(r({},u),{Fltr:{_name:"Maximum",_classID:"Mxm ","Rds ":Y(e.filter)},filterID:1299737888});case"minimum":return r(r({},u),{Fltr:{_name:"Minimum",_classID:"Mnm ","Rds ":Y(e.filter)},filterID:1299082528});case"offset":return r(r({},u),{Fltr:{_name:"Offset",_classID:"Ofst",Hrzn:e.filter.horizontal,Vrtc:e.filter.vertical,"Fl ":o.FlMd.encode(e.filter.undefinedAreas)},filterID:1332114292});case"puppet":return r(r({},u),{Fltr:{_name:"Rigid Transform",_classID:"rigidTransform",null:["Ordn.Trgt"],rigidType:e.filter.rigidType,puppetShapeList:e.filter.puppetShapeList.map(function(E){return{_name:"",_classID:"puppetShape",rigidType:E.rigidType,VrsM:1,VrsN:0,originalVertexArray:$(new Float32Array(se(E.originalVertexArray))),deformedVertexArray:$(new Float32Array(se(E.deformedVertexArray))),indexArray:$(new Uint32Array(E.indexArray)),pinOffsets:se(E.pinOffsets),posFinalPins:se(E.posFinalPins),pinVertexIndices:E.pinVertexIndices,PinP:se(E.pinPosition),PnRt:E.pinRotation,PnOv:E.pinOverlay,PnDp:E.pinDepth,meshQuality:E.meshQuality,meshExpansion:E.meshExpansion,meshRigidity:E.meshRigidity,imageResolution:E.imageResolution,meshBoundaryPath:{_name:"",_classID:"pathClass",pathComponents:E.meshBoundaryPath.pathComponents.map(function(C){return{_name:"",_classID:"PaCm",shapeOperation:"shapeOperation.".concat(C.shapeOperation),SbpL:C.paths.map(function(R){return{_name:"",_classID:"Sbpl",Clsp:R.closed,"Pts ":R.points.map(function(oe){return{_name:"",_classID:"Pthp",Anch:j(oe.anchor),"Fwd ":j(oe.forward),"Bwd ":j(oe.backward),Smoo:oe.smooth}})}})}})},selectedPin:E.selectedPin}}),PuX0:e.filter.bounds[0].x,PuX1:e.filter.bounds[1].x,PuX2:e.filter.bounds[2].x,PuX3:e.filter.bounds[3].x,PuY0:e.filter.bounds[0].y,PuY1:e.filter.bounds[1].y,PuY2:e.filter.bounds[2].y,PuY3:e.filter.bounds[3].y},filterID:991});case"oil paint plugin":for(var f={},k=0;k<e.filter.parameters.length;k++){var v=e.filter.parameters[k],i=v.name,n=v.value,w="".concat(M[Math.floor(k/M.length)]).concat(M[k%M.length]);f["PN".concat(w)]=i,f["PT".concat(w)]=0,f["PF".concat(w)]=n}return r(r({},u),{Fltr:r({_name:"Oil Paint Plugin",_classID:"PbPl",KnNm:e.filter.name,GpuY:e.filter.gpu,LIWy:e.filter.lighting,FPth:"1"},f),filterID:1348620396});case"oil paint":return r(r({},u),{Fltr:{_name:"Oil Paint",_classID:"oilPaint",lightingOn:e.filter.lightingOn,stylization:e.filter.stylization,cleanliness:e.filter.cleanliness,brushScale:e.filter.brushScale,microBrush:e.filter.microBrush,LghD:e.filter.lightDirection,specularity:e.filter.specularity},filterID:1122});case"liquify":return r(r({},u),{Fltr:{_name:"Liquify",_classID:"LqFy",LqMe:e.filter.liquifyMesh},filterID:1282492025});case"perspective warp":return r(r({},u),{Fltr:{_name:"Perspective Warp",_classID:"perspectiveWarpTransform",vertices:e.filter.vertices.map(j),warpedVertices:e.filter.warpedVertices.map(j),quads:e.filter.quads.map(function(E){return{indices:E}})},filterID:442});case"curves":return r(r({},u),{Fltr:r({_name:"Curves",_classID:"Crvs",presetKind:o.presetKindType.encode(e.filter.presetKind)},e.filter.adjustments?{Adjs:e.filter.adjustments.map(function(E){return"curve"in E?{_name:"",_classID:"CrvA",Chnl:E.channels.map(o.Chnl.encode),"Crv ":E.curve.map(function(C){return r({_name:"",_classID:"Pnt ",Hrzn:C.x,Vrtc:C.y},C.curved?{Cnty:!0}:{})})}:{_name:"",_classID:"CrvA",Chnl:E.channels.map(o.Chnl.encode),Mpng:E.values}})}:{}),filterID:1131574899});case"brightness/contrast":return r(r({},u),{Fltr:{_name:"Brightness/Contrast",_classID:"BrgC",Brgh:e.filter.brightness,Cntr:e.filter.contrast,useLegacy:!!e.filter.useLegacy},filterID:1114793795});default:throw new Error("Unknow filter type: ".concat(e.type))}}function we(e){if(e.warp)return e.warp;if(!e.width||!e.height)throw new Error("You must provide width and height of the linked image in placedLayer");var u=e.width,f=e.height,k=0,v=u/3,i=u*2/3,n=u,w=0,E=f/3,C=f*2/3,R=f;return{style:"custom",value:0,perspective:0,perspectiveOther:0,rotate:"horizontal",bounds:{top:{value:0,units:"Pixels"},left:{value:0,units:"Pixels"},bottom:{value:f,units:"Pixels"},right:{value:u,units:"Pixels"}},uOrder:4,vOrder:4,customEnvelopeWarp:{meshPoints:[{x:k,y:w},{x:v,y:w},{x:i,y:w},{x:n,y:w},{x:k,y:E},{x:v,y:E},{x:i,y:E},{x:n,y:E},{x:k,y:C},{x:v,y:C},{x:i,y:C},{x:n,y:C},{x:k,y:R},{x:v,y:R},{x:i,y:R},{x:n,y:R}]}}}_("SoLd",I("placedLayer"),function(e,u,f){if((0,l.readSignature)(e)!=="soLD")throw new Error("Invalid SoLd type");var k=(0,l.readInt32)(e);if(k!==4&&k!==5)throw new Error("Invalid SoLd version");var v=(0,o.readVersionAndDescriptor)(e,!0);u.placedLayer={id:v.Idnt,placed:v.placed,type:X[v.Type],pageNumber:v.PgNm,totalPages:v.totalPages,frameStep:(0,o.frac)(v.frameStep),duration:(0,o.frac)(v.duration),frameCount:v.frameCount,transform:v.Trnf,width:v["Sz "].Wdth,height:v["Sz "].Hght,resolution:(0,o.parseUnits)(v.Rslt),warp:Q(v.quiltWarp||v.warp)},v.nonAffineTransform&&v.nonAffineTransform.some(function(i,n){return i!==v.Trnf[n]})&&(u.placedLayer.nonAffineTransform=v.nonAffineTransform),v.Crop&&(u.placedLayer.crop=v.Crop),v.comp&&(u.placedLayer.comp=v.comp),v.compInfo&&(u.placedLayer.compInfo={compID:v.compInfo.compID,originalCompID:v.compInfo.originalCompID}),v.filterFX&&(u.placedLayer.filter=z(v.filterFX,e)),(0,l.skipBytes)(e,f())},function(e,u){var f,k;(0,h.writeSignature)(e,"soLD"),(0,h.writeInt32)(e,4);var v=u.placedLayer;if(!v.id||typeof v.id!="string"||!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(v.id))throw new Error("Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)");var i=r(r({Idnt:v.id,placed:(f=v.placed)!==null&&f!==void 0?f:v.id,PgNm:v.pageNumber||1,totalPages:v.totalPages||1},v.crop?{Crop:v.crop}:{}),{frameStep:v.frameStep||{numerator:0,denominator:600},duration:v.duration||{numerator:0,denominator:600},frameCount:v.frameCount||0,Annt:16,Type:X.indexOf(v.type),Trnf:v.transform,nonAffineTransform:(k=v.nonAffineTransform)!==null&&k!==void 0?k:v.transform,warp:te(we(v)),"Sz ":{_name:"",_classID:"Pnt ",Wdth:v.width||0,Hght:v.height||0},Rslt:v.resolution?(0,o.unitsValue)(v.resolution,"resolution"):{units:"Density",value:72}});if(v.filter&&(i.filterFX={_name:"",_classID:"filterFXStyle",enab:v.filter.enabled,validAtPosition:v.filter.validAtPosition,filterMaskEnable:v.filter.maskEnabled,filterMaskLinked:v.filter.maskLinked,filterMaskExtendWithWhite:v.filter.maskExtendWithWhite,filterFXList:v.filter.list.map(function(w){return ve(w)})}),v.warp&&V(v.warp)){var n=te(v.warp);i.quiltWarp=n,i.warp={warpStyle:"warpStyle.warpNone",warpValue:n.warpValue,warpPerspective:n.warpPerspective,warpPerspectiveOther:n.warpPerspectiveOther,warpRotate:n.warpRotate,bounds:n.bounds,uOrder:n.uOrder,vOrder:n.vOrder}}else delete i.quiltWarp;v.comp&&(i.comp=v.comp),v.compInfo&&(i.compInfo=v.compInfo),(0,o.writeVersionAndDescriptor)(e,"","null",i,i.quiltWarp?"quiltWarp":"warp")}),x("SoLE","SoLd"),_("fxrp",I("referencePoint"),function(e,u){u.referencePoint={x:(0,l.readFloat64)(e),y:(0,l.readFloat64)(e)}},function(e,u){(0,h.writeFloat64)(e,u.referencePoint.x),(0,h.writeFloat64)(e,u.referencePoint.y)}),_("Lr16",function(){return!1},function(e,u,f,k,v){(0,l.readLayerInfo)(e,k,v)},function(e,u){}),_("Lr32",function(){return!1},function(e,u,f,k,v){(0,l.readLayerInfo)(e,k,v)},function(e,u){}),_("LMsk",I("userMask"),function(e,u){if(u.userMask={colorSpace:(0,l.readColor)(e),opacity:(0,l.readUint16)(e)/255},(0,l.readUint8)(e)!==128)throw new Error("Invalid flag value");(0,l.skipBytes)(e,1)},function(e,u){var f=u.userMask;(0,h.writeColor)(e,f.colorSpace),(0,h.writeUint16)(e,(0,c.clamp)(f.opacity,0,1)*255),(0,h.writeUint8)(e,128),(0,h.writeZeros)(e,1)}),c.MOCK_HANDLERS?_("Patt",function(e){return e._Patt!==void 0},function(e,u,f){u._Patt=(0,l.readBytes)(e,f())},function(e,u){return!1}):_("Patt",function(e){return!e},function(e,u,f){f()&&(0,l.skipBytes)(e,f())},function(e,u){}),c.MOCK_HANDLERS&&_("CAI ",function(e){return e._CAI_!==void 0},function(e,u,f){u._CAI_=(0,l.readBytes)(e,f())},function(e,u){(0,h.writeBytes)(e,u._CAI_)}),c.MOCK_HANDLERS&&_("OCIO",function(e){return e._OCIO!==void 0},function(e,u,f){u._OCIO=(0,l.readBytes)(e,f())},function(e,u){(0,h.writeBytes)(e,u._OCIO)}),c.MOCK_HANDLERS&&_("GenI",function(e){return e._GenI!==void 0},function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e,!0);console.log("GenI",xt().inspect(k,!1,99,!0)),u._GenI=(0,l.readBytes)(e,f())},function(e,u){(0,h.writeBytes)(e,u._GenI)});function _e(e){return{top:(0,l.readInt32)(e),left:(0,l.readInt32)(e),bottom:(0,l.readInt32)(e),right:(0,l.readInt32)(e)}}function ie(e,u){(0,h.writeInt32)(e,u.top),(0,h.writeInt32)(e,u.left),(0,h.writeInt32)(e,u.bottom),(0,h.writeInt32)(e,u.right)}_("Anno",function(e){return e.annotations!==void 0},function(e,u,f){var k=(0,l.readUint16)(e),v=(0,l.readUint16)(e);if(k!==2||v!==1)throw new Error("Invalid Anno version");for(var i=(0,l.readUint32)(e),n=[],w=0;w<i;w++){(0,l.readUint32)(e);var E=(0,l.readSignature)(e),C=!!(0,l.readUint8)(e);(0,l.readUint8)(e),(0,l.readUint16)(e);var R=_e(e),oe=_e(e),ue=(0,l.readColor)(e),re=(0,l.readPascalString)(e,2),he=(0,l.readPascalString)(e,2),A=(0,l.readPascalString)(e,2);(0,l.readUint32)(e),(0,l.readSignature)(e);var Se=(0,l.readUint32)(e),Pe=void 0;if(E==="txtA")Se>=2&&(0,l.readUint16)(e)===65279?Pe=(0,l.readUnicodeStringWithLength)(e,(Se-2)/2):(e.offset-=2,Pe=(0,l.readAsciiString)(e,Se)),Pe=Pe.replace(/\r/g,`
|
|
101
|
+
`);else if(E==="sndA")Pe=(0,l.readBytes)(e,Se);else throw new Error("Unknown annotation type");n.push({type:E==="txtA"?"text":"sound",open:C,iconLocation:R,popupLocation:oe,color:ue,author:re,name:he,date:A,data:Pe})}u.annotations=n,(0,l.skipBytes)(e,f())},function(e,u){var f=u.annotations;(0,h.writeUint16)(e,2),(0,h.writeUint16)(e,1),(0,h.writeUint32)(e,f.length);for(var k=0,v=f;k<v.length;k++){var i=v[k],n=i.type==="sound";if(n&&!(i.data instanceof Uint8Array))throw new Error("Sound annotation data should be Uint8Array");if(!n&&typeof i.data!="string")throw new Error("Text annotation data should be string");var w=e.offset;(0,h.writeUint32)(e,0),(0,h.writeSignature)(e,n?"sndA":"txtA"),(0,h.writeUint8)(e,i.open?1:0),(0,h.writeUint8)(e,28),(0,h.writeUint16)(e,1),ie(e,i.iconLocation),ie(e,i.popupLocation),(0,h.writeColor)(e,i.color),(0,h.writePascalString)(e,i.author||"",2),(0,h.writePascalString)(e,i.name||"",2),(0,h.writePascalString)(e,i.date||"",2);var E=e.offset;(0,h.writeUint32)(e,0),(0,h.writeSignature)(e,n?"sndM":"txtC"),(0,h.writeUint32)(e,0);var C=e.offset;if(n)(0,h.writeBytes)(e,i.data);else{(0,h.writeUint16)(e,65279);for(var R=i.data.replace(/\n/g,"\r"),oe=0;oe<R.length;oe++)(0,h.writeUint16)(e,R.charCodeAt(oe))}e.view.setUint32(w,e.offset-w,!1),e.view.setUint32(E,e.offset-E,!1),e.view.setUint32(C-4,e.offset-C,!1)}});function pe(e){_(e,function(u){var f=u;return!(!f.linkedFiles||!f.linkedFiles.length||e==="lnkE"&&!f.linkedFiles.some(function(k){return k.linkedFile}))},function(u,f,k,v){var i=f;for(i.linkedFiles=i.linkedFiles||[];k()>8;){var n=H(u),w=u.offset,E=(0,l.readSignature)(u),C=(0,l.readInt32)(u),R=(0,l.readPascalString)(u,1),oe=(0,l.readUnicodeString)(u),ue=(0,l.readSignature)(u).trim(),re=(0,l.readSignature)(u).trim(),he=H(u),A=(0,l.readUint8)(u)?(0,o.readVersionAndDescriptor)(u):void 0,Se=E==="liFE"?(0,o.readVersionAndDescriptor)(u):void 0,Pe={id:R,name:oe};if(ue&&(Pe.type=ue),re&&(Pe.creator=re),A&&(Pe.descriptor={compInfo:{compID:A.compInfo.compID,originalCompID:A.compInfo.originalCompID}}),E==="liFE"&&C>3){var Te=(0,l.readInt32)(u),He=(0,l.readUint8)(u),T=(0,l.readUint8)(u),d=(0,l.readUint8)(u),N=(0,l.readUint8)(u),P=(0,l.readFloat64)(u),me=Math.floor(P),be=(P-me)*1e3;Pe.time=new Date(Date.UTC(Te,He,T,d,N,me,be)).toISOString()}var ye=E==="liFE"?H(u):0;for(E==="liFA"&&(0,l.skipBytes)(u,8),E==="liFD"&&(Pe.data=(0,l.readBytes)(u,he)),C>=5&&(Pe.childDocumentID=(0,l.readUnicodeString)(u)),C>=6&&(Pe.assetModTime=(0,l.readFloat64)(u)),C>=7&&(Pe.assetLockedState=(0,l.readUint8)(u)),E==="liFE"&&C===2&&(Pe.data=(0,l.readBytes)(u,ye)),u.skipLinkedFilesData&&(Pe.data=void 0),e==="lnkE"&&(Pe.linkedFile={fileSize:ye,name:Se?.["Nm "]||"",fullPath:Se?.fullPath||"",originalPath:Se?.originalPath||"",relativePath:Se?.relPath||""}),i.linkedFiles.push(Pe);n%4;)n++;u.offset=w+n}(0,l.skipBytes)(u,k())},function(u,f){for(var k,v,i,n,w,E,C,R,oe,ue=f,re=0,he=ue.linkedFiles;re<he.length;re++){var A=he[re];if(e==="lnkE"==!!A.linkedFile){var Se=2;A.assetLockedState!=null?Se=7:A.assetModTime!=null?Se=6:A.childDocumentID!=null?Se=5:e==="lnkE"&&(Se=3),ee(u,0);var Pe=u.offset;if((0,h.writeSignature)(u,e==="lnkE"?"liFE":A.data?"liFD":"liFA"),(0,h.writeInt32)(u,Se),!A.id||typeof A.id!="string"||!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(A.id))throw new Error("Linked file ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)");if((0,h.writePascalString)(u,A.id,1),(0,h.writeUnicodeStringWithPadding)(u,A.name||""),(0,h.writeSignature)(u,A.type?"".concat(A.type," ").substring(0,4):" "),(0,h.writeSignature)(u,A.creator?"".concat(A.creator," ").substring(0,4):"\0\0\0\0"),ee(u,A.data?A.data.byteLength:0),A.descriptor&&A.descriptor.compInfo){var Te={compInfo:{compID:A.descriptor.compInfo.compID,originalCompID:A.descriptor.compInfo.originalCompID}};(0,h.writeUint8)(u,1),(0,o.writeVersionAndDescriptor)(u,"","null",Te)}else(0,h.writeUint8)(u,0);if(e==="lnkE"){var Te={descVersion:2,"Nm ":(v=(k=A.linkedFile)===null||k===void 0?void 0:k.name)!==null&&v!==void 0?v:"",fullPath:(n=(i=A.linkedFile)===null||i===void 0?void 0:i.fullPath)!==null&&n!==void 0?n:"",originalPath:(E=(w=A.linkedFile)===null||w===void 0?void 0:w.originalPath)!==null&&E!==void 0?E:"",relPath:(R=(C=A.linkedFile)===null||C===void 0?void 0:C.relativePath)!==null&&R!==void 0?R:""};(0,o.writeVersionAndDescriptor)(u,"","ExternalFileLink",Te);var He=A.time?new Date(A.time):new Date;(0,h.writeInt32)(u,He.getUTCFullYear()),(0,h.writeUint8)(u,He.getUTCMonth()),(0,h.writeUint8)(u,He.getUTCDate()),(0,h.writeUint8)(u,He.getUTCHours()),(0,h.writeUint8)(u,He.getUTCMinutes()),(0,h.writeFloat64)(u,He.getUTCSeconds()+He.getUTCMilliseconds()/1e3)}A.data?(0,h.writeBytes)(u,A.data):ee(u,((oe=A.linkedFile)===null||oe===void 0?void 0:oe.fileSize)||0),Se>=5&&(0,h.writeUnicodeStringWithPadding)(u,A.childDocumentID||""),Se>=6&&(0,h.writeFloat64)(u,A.assetModTime||0),Se>=7&&(0,h.writeUint8)(u,A.assetLockedState||0);var T=u.offset-Pe;for(u.view.setUint32(Pe-4,T,!1);T%4;)T++,(0,h.writeUint8)(u,0)}}})}pe("lnk2"),pe("lnkE"),x("lnkD","lnk2"),x("lnk3","lnk2"),_("pths",I("pathList"),function(e,u){(0,o.readVersionAndDescriptor)(e,!0),u.pathList=[]},function(e,u){(0,o.writeVersionAndDescriptor)(e,"","pathsDataClass",{pathList:[]})}),_("lyvr",I("version"),function(e,u){return u.version=(0,l.readUint32)(e)},function(e,u){return(0,h.writeUint32)(e,u.version)}),_("lfxs",function(){return!1},function(e,u,f){if((0,l.readUint32)(e)!==0)throw new Error("Invalid lfxs version");var k=(0,o.readVersionAndDescriptor)(e);u.effects=(0,o.parseEffects)(k,!!e.logMissingFeatures),(0,l.skipBytes)(e,f())},function(e,u,f,k){var v=(0,o.serializeEffects)(u.effects,!!k.logMissingFeatures,!0);(0,h.writeUint32)(e,0),(0,o.writeVersionAndDescriptor)(e,"","null",v)});function fe(e){return function(u){return!!u.adjustment&&u.adjustment.type===e}}_("brit",fe("brightness/contrast"),function(e,u,f){u.adjustment||(u.adjustment={type:"brightness/contrast",brightness:(0,l.readInt16)(e),contrast:(0,l.readInt16)(e),meanValue:(0,l.readInt16)(e),labColorOnly:!!(0,l.readUint8)(e),useLegacy:!0}),(0,l.skipBytes)(e,f())},function(e,u){var f,k=u.adjustment;(0,h.writeInt16)(e,k.brightness||0),(0,h.writeInt16)(e,k.contrast||0),(0,h.writeInt16)(e,(f=k.meanValue)!==null&&f!==void 0?f:127),(0,h.writeUint8)(e,k.labColorOnly?1:0),(0,h.writeZeros)(e,1)});function ge(e){return{shadowInput:(0,l.readInt16)(e),highlightInput:(0,l.readInt16)(e),shadowOutput:(0,l.readInt16)(e),highlightOutput:(0,l.readInt16)(e),midtoneInput:(0,l.readInt16)(e)/100}}function ke(e,u){(0,h.writeInt16)(e,u.shadowInput),(0,h.writeInt16)(e,u.highlightInput),(0,h.writeInt16)(e,u.shadowOutput),(0,h.writeInt16)(e,u.highlightOutput),(0,h.writeInt16)(e,Math.round(u.midtoneInput*100))}_("levl",fe("levels"),function(e,u,f){if((0,l.readUint16)(e)!==2)throw new Error("Invalid levl version");u.adjustment=r(r({},u.adjustment),{type:"levels",rgb:ge(e),red:ge(e),green:ge(e),blue:ge(e)}),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment,k={shadowInput:0,highlightInput:255,shadowOutput:0,highlightOutput:255,midtoneInput:1};(0,h.writeUint16)(e,2),ke(e,f.rgb||k),ke(e,f.red||k),ke(e,f.blue||k),ke(e,f.green||k);for(var v=0;v<59;v++)ke(e,k)});function Ee(e){for(var u=(0,l.readUint16)(e),f=[],k=0;k<u;k++){var v=(0,l.readInt16)(e),i=(0,l.readInt16)(e);f.push({input:i,output:v})}return f}function Ie(e,u){(0,h.writeUint16)(e,u.length);for(var f=0,k=u;f<k.length;f++){var v=k[f];(0,h.writeUint16)(e,v.output),(0,h.writeUint16)(e,v.input)}}_("curv",fe("curves"),function(e,u,f){if((0,l.readUint8)(e),(0,l.readUint16)(e)!==1)throw new Error("Invalid curv version");(0,l.readUint16)(e);var k=(0,l.readUint16)(e),v={type:"curves"};k&1&&(v.rgb=Ee(e)),k&2&&(v.red=Ee(e)),k&4&&(v.green=Ee(e)),k&8&&(v.blue=Ee(e)),u.adjustment=r(r({},u.adjustment),v),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment,k=f.rgb,v=f.red,i=f.green,n=f.blue,w=0,E=0;k&&k.length&&(w|=1,E++),v&&v.length&&(w|=2,E++),i&&i.length&&(w|=4,E++),n&&n.length&&(w|=8,E++),(0,h.writeUint8)(e,0),(0,h.writeUint16)(e,1),(0,h.writeUint16)(e,0),(0,h.writeUint16)(e,w),k&&k.length&&Ie(e,k),v&&v.length&&Ie(e,v),i&&i.length&&Ie(e,i),n&&n.length&&Ie(e,n),(0,h.writeSignature)(e,"Crv "),(0,h.writeUint16)(e,4),(0,h.writeUint16)(e,0),(0,h.writeUint16)(e,E),k&&k.length&&((0,h.writeUint16)(e,0),Ie(e,k)),v&&v.length&&((0,h.writeUint16)(e,1),Ie(e,v)),i&&i.length&&((0,h.writeUint16)(e,2),Ie(e,i)),n&&n.length&&((0,h.writeUint16)(e,3),Ie(e,n))}),_("expA",fe("exposure"),function(e,u,f){if((0,l.readUint16)(e)!==1)throw new Error("Invalid expA version");u.adjustment=r(r({},u.adjustment),{type:"exposure",exposure:(0,l.readFloat32)(e),offset:(0,l.readFloat32)(e),gamma:(0,l.readFloat32)(e)}),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment;(0,h.writeUint16)(e,1),(0,h.writeFloat32)(e,f.exposure),(0,h.writeFloat32)(e,f.offset),(0,h.writeFloat32)(e,f.gamma),(0,h.writeZeros)(e,2)}),_("vibA",fe("vibrance"),function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);u.adjustment={type:"vibrance"},k.vibrance!==void 0&&(u.adjustment.vibrance=k.vibrance),k.Strt!==void 0&&(u.adjustment.saturation=k.Strt),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment,k={};f.vibrance!==void 0&&(k.vibrance=f.vibrance),f.saturation!==void 0&&(k.Strt=f.saturation),(0,o.writeVersionAndDescriptor)(e,"","null",k)});function De(e){return{a:(0,l.readInt16)(e),b:(0,l.readInt16)(e),c:(0,l.readInt16)(e),d:(0,l.readInt16)(e),hue:(0,l.readInt16)(e),saturation:(0,l.readInt16)(e),lightness:(0,l.readInt16)(e)}}function Ue(e,u){var f=u||{};(0,h.writeInt16)(e,f.a||0),(0,h.writeInt16)(e,f.b||0),(0,h.writeInt16)(e,f.c||0),(0,h.writeInt16)(e,f.d||0),(0,h.writeInt16)(e,f.hue||0),(0,h.writeInt16)(e,f.saturation||0),(0,h.writeInt16)(e,f.lightness||0)}_("hue2",fe("hue/saturation"),function(e,u,f){if((0,l.readUint16)(e)!==2)throw new Error("Invalid hue2 version");u.adjustment=r(r({},u.adjustment),{type:"hue/saturation",master:De(e),reds:De(e),yellows:De(e),greens:De(e),cyans:De(e),blues:De(e),magentas:De(e)}),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment;(0,h.writeUint16)(e,2),Ue(e,f.master),Ue(e,f.reds),Ue(e,f.yellows),Ue(e,f.greens),Ue(e,f.cyans),Ue(e,f.blues),Ue(e,f.magentas)});function Ne(e){return{cyanRed:(0,l.readInt16)(e),magentaGreen:(0,l.readInt16)(e),yellowBlue:(0,l.readInt16)(e)}}function Me(e,u){(0,h.writeInt16)(e,u.cyanRed||0),(0,h.writeInt16)(e,u.magentaGreen||0),(0,h.writeInt16)(e,u.yellowBlue||0)}_("blnc",fe("color balance"),function(e,u,f){u.adjustment={type:"color balance",shadows:Ne(e),midtones:Ne(e),highlights:Ne(e),preserveLuminosity:!!(0,l.readUint8)(e)},(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment;Me(e,f.shadows||{}),Me(e,f.midtones||{}),Me(e,f.highlights||{}),(0,h.writeUint8)(e,f.preserveLuminosity?1:0),(0,h.writeZeros)(e,1)}),_("blwh",fe("black & white"),function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);u.adjustment={type:"black & white",reds:k["Rd "],yellows:k.Yllw,greens:k["Grn "],cyans:k["Cyn "],blues:k["Bl "],magentas:k.Mgnt,useTint:!!k.useTint,presetKind:k.bwPresetKind,presetFileName:k.blackAndWhitePresetFileName},k.tintColor!==void 0&&(u.adjustment.tintColor=(0,o.parseColor)(k.tintColor)),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment,k={"Rd ":f.reds||0,Yllw:f.yellows||0,"Grn ":f.greens||0,"Cyn ":f.cyans||0,"Bl ":f.blues||0,Mgnt:f.magentas||0,useTint:!!f.useTint,tintColor:(0,o.serializeColor)(f.tintColor),bwPresetKind:f.presetKind||0,blackAndWhitePresetFileName:f.presetFileName||""};(0,o.writeVersionAndDescriptor)(e,"","null",k)}),_("phfl",fe("photo filter"),function(e,u,f){var k=(0,l.readUint16)(e);if(k!==2&&k!==3)throw new Error("Invalid phfl version");var v;k===2?v=(0,l.readColor)(e):v={l:(0,l.readInt32)(e)/100,a:(0,l.readInt32)(e)/100,b:(0,l.readInt32)(e)/100},u.adjustment={type:"photo filter",color:v,density:(0,l.readUint32)(e)/100,preserveLuminosity:!!(0,l.readUint8)(e)},(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment;(0,h.writeUint16)(e,2),(0,h.writeColor)(e,f.color||{l:0,a:0,b:0}),(0,h.writeUint32)(e,(f.density||0)*100),(0,h.writeUint8)(e,f.preserveLuminosity?1:0),(0,h.writeZeros)(e,3)});function Ce(e){var u=(0,l.readInt16)(e),f=(0,l.readInt16)(e),k=(0,l.readInt16)(e);return(0,l.skipBytes)(e,2),{red:u,green:f,blue:k,constant:(0,l.readInt16)(e)}}function Ge(e,u){var f=u||{};(0,h.writeInt16)(e,f.red),(0,h.writeInt16)(e,f.green),(0,h.writeInt16)(e,f.blue),(0,h.writeZeros)(e,2),(0,h.writeInt16)(e,f.constant)}_("mixr",fe("channel mixer"),function(e,u,f){if((0,l.readUint16)(e)!==1)throw new Error("Invalid mixr version");var k=u.adjustment=r(r({},u.adjustment),{type:"channel mixer",monochrome:!!(0,l.readUint16)(e)});k.monochrome||(k.red=Ce(e),k.green=Ce(e),k.blue=Ce(e)),k.gray=Ce(e),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment;(0,h.writeUint16)(e,1),(0,h.writeUint16)(e,f.monochrome?1:0),f.monochrome?(Ge(e,f.gray),(0,h.writeZeros)(e,30)):(Ge(e,f.red),Ge(e,f.green),Ge(e,f.blue),Ge(e,f.gray))});var qe=(0,c.createEnum)("colorLookupType","3DLUT",{"3dlut":"3DLUT",abstractProfile:"abstractProfile",deviceLinkProfile:"deviceLinkProfile"}),ae=(0,c.createEnum)("LUTFormatType","look",{look:"LUTFormatLOOK",cube:"LUTFormatCUBE","3dl":"LUTFormat3DL"}),le=(0,c.createEnum)("colorLookupOrder","rgb",{rgb:"rgbOrder",bgr:"bgrOrder"});_("clrL",fe("color lookup"),function(e,u,f){if((0,l.readUint16)(e)!==1)throw new Error("Invalid clrL version");var k=(0,o.readVersionAndDescriptor)(e);u.adjustment={type:"color lookup"};var v=u.adjustment;k.lookupType!==void 0&&(v.lookupType=qe.decode(k.lookupType)),k["Nm "]!==void 0&&(v.name=k["Nm "]),k.Dthr!==void 0&&(v.dither=k.Dthr),k.profile!==void 0&&(v.profile=k.profile),k.LUTFormat!==void 0&&(v.lutFormat=ae.decode(k.LUTFormat)),k.dataOrder!==void 0&&(v.dataOrder=le.decode(k.dataOrder)),k.tableOrder!==void 0&&(v.tableOrder=le.decode(k.tableOrder)),k.LUT3DFileData!==void 0&&(v.lut3DFileData=k.LUT3DFileData),k.LUT3DFileName!==void 0&&(v.lut3DFileName=k.LUT3DFileName),(0,l.skipBytes)(e,f())},function(e,u){var f=u.adjustment,k={};f.lookupType!==void 0&&(k.lookupType=qe.encode(f.lookupType)),f.name!==void 0&&(k["Nm "]=f.name),f.dither!==void 0&&(k.Dthr=f.dither),f.profile!==void 0&&(k.profile=f.profile),f.lutFormat!==void 0&&(k.LUTFormat=ae.encode(f.lutFormat)),f.dataOrder!==void 0&&(k.dataOrder=le.encode(f.dataOrder)),f.tableOrder!==void 0&&(k.tableOrder=le.encode(f.tableOrder)),f.lut3DFileData!==void 0&&(k.LUT3DFileData=f.lut3DFileData),f.lut3DFileName!==void 0&&(k.LUT3DFileName=f.lut3DFileName),(0,h.writeUint16)(e,1),(0,o.writeVersionAndDescriptor)(e,"","null",k)}),_("nvrt",fe("invert"),function(e,u,f){u.adjustment={type:"invert"},(0,l.skipBytes)(e,f())},function(){}),_("post",fe("posterize"),function(e,u,f){u.adjustment={type:"posterize",levels:(0,l.readUint16)(e)},(0,l.skipBytes)(e,f())},function(e,u){var f,k=u.adjustment;(0,h.writeUint16)(e,(f=k.levels)!==null&&f!==void 0?f:4),(0,h.writeZeros)(e,2)}),_("thrs",fe("threshold"),function(e,u,f){u.adjustment={type:"threshold",level:(0,l.readUint16)(e)},(0,l.skipBytes)(e,f())},function(e,u){var f,k=u.adjustment;(0,h.writeUint16)(e,(f=k.level)!==null&&f!==void 0?f:128),(0,h.writeZeros)(e,2)});var p=["","","","rgb","hsb","","lab"];_("grdm",fe("gradient map"),function(e,u,f){var k=(0,l.readUint16)(e);if(k!==1&&k!==3)throw new Error("Invalid grdm version");var v={type:"gradient map",gradientType:"solid"};v.reverse=!!(0,l.readUint8)(e),v.dither=!!(0,l.readUint8)(e);var i=!!(0,l.readUint8)(e);if(e.offset--,i){var n=(0,l.readSignature)(e);v.method=o.gradientInterpolationMethodType.decode(n)}v.name=(0,l.readUnicodeString)(e),v.colorStops=[],v.opacityStops=[];for(var w=(0,l.readUint16)(e),E=0;E<w;E++)v.colorStops.push({location:(0,l.readUint32)(e),midpoint:(0,l.readUint32)(e)/100,color:(0,l.readColor)(e)}),(0,l.skipBytes)(e,2);for(var C=(0,l.readUint16)(e),E=0;E<C;E++)v.opacityStops.push({location:(0,l.readUint32)(e),midpoint:(0,l.readUint32)(e)/100,opacity:(0,l.readUint16)(e)/255});if((0,l.readUint16)(e)!==2)throw new Error("Invalid grdm expansion count");var R=(0,l.readUint16)(e);if(v.smoothness=R/4096,(0,l.readUint16)(e)!==32)throw new Error("Invalid grdm length");v.gradientType=(0,l.readUint16)(e)?"noise":"solid",v.randomSeed=(0,l.readUint32)(e),v.addTransparency=!!(0,l.readUint16)(e),v.restrictColors=!!(0,l.readUint16)(e),v.roughness=(0,l.readUint32)(e)/4096,v.colorModel=p[(0,l.readUint16)(e)]||"rgb",v.min=[(0,l.readUint16)(e)/32768,(0,l.readUint16)(e)/32768,(0,l.readUint16)(e)/32768,(0,l.readUint16)(e)/32768],v.max=[(0,l.readUint16)(e)/32768,(0,l.readUint16)(e)/32768,(0,l.readUint16)(e)/32768,(0,l.readUint16)(e)/32768],(0,l.skipBytes)(e,f());for(var oe=0,ue=v.colorStops;oe<ue.length;oe++){var re=ue[oe];re.location/=R}for(var he=0,A=v.opacityStops;he<A.length;he++){var re=A[he];re.location/=R}u.adjustment=v},function(e,u){var f,k,v,i=u.adjustment;(0,h.writeUint16)(e,i.method!==void 0?3:1),(0,h.writeUint8)(e,i.reverse?1:0),(0,h.writeUint8)(e,i.dither?1:0),i.method!==void 0&&(0,h.writeSignature)(e,o.gradientInterpolationMethodType.encode(i.method)),(0,h.writeUnicodeStringWithPadding)(e,i.name||""),(0,h.writeUint16)(e,i.colorStops&&i.colorStops.length||0);for(var n=Math.round(((f=i.smoothness)!==null&&f!==void 0?f:1)*4096),w=0,E=i.colorStops||[];w<E.length;w++){var C=E[w];(0,h.writeUint32)(e,Math.round(C.location*n)),(0,h.writeUint32)(e,Math.round(C.midpoint*100)),(0,h.writeColor)(e,C.color),(0,h.writeZeros)(e,2)}(0,h.writeUint16)(e,i.opacityStops&&i.opacityStops.length||0);for(var R=0,oe=i.opacityStops||[];R<oe.length;R++){var C=oe[R];(0,h.writeUint32)(e,Math.round(C.location*n)),(0,h.writeUint32)(e,Math.round(C.midpoint*100)),(0,h.writeUint16)(e,Math.round(C.opacity*255))}(0,h.writeUint16)(e,2),(0,h.writeUint16)(e,n),(0,h.writeUint16)(e,32),(0,h.writeUint16)(e,i.gradientType==="noise"?1:0),(0,h.writeUint32)(e,i.randomSeed||0),(0,h.writeUint16)(e,i.addTransparency?1:0),(0,h.writeUint16)(e,i.restrictColors?1:0),(0,h.writeUint32)(e,Math.round(((k=i.roughness)!==null&&k!==void 0?k:1)*4096));var ue=p.indexOf((v=i.colorModel)!==null&&v!==void 0?v:"rgb");(0,h.writeUint16)(e,ue===-1?3:ue);for(var re=0;re<4;re++)(0,h.writeUint16)(e,Math.round((i.min&&i.min[re]||0)*32768));for(var re=0;re<4;re++)(0,h.writeUint16)(e,Math.round((i.max&&i.max[re]||0)*32768));(0,h.writeZeros)(e,4)});function m(e){return{c:(0,l.readInt16)(e),m:(0,l.readInt16)(e),y:(0,l.readInt16)(e),k:(0,l.readInt16)(e)}}function O(e,u){var f=u||{};(0,h.writeInt16)(e,f.c),(0,h.writeInt16)(e,f.m),(0,h.writeInt16)(e,f.y),(0,h.writeInt16)(e,f.k)}_("selc",fe("selective color"),function(e,u){if((0,l.readUint16)(e)!==1)throw new Error("Invalid selc version");var f=(0,l.readUint16)(e)?"absolute":"relative";(0,l.skipBytes)(e,8),u.adjustment={type:"selective color",mode:f,reds:m(e),yellows:m(e),greens:m(e),cyans:m(e),blues:m(e),magentas:m(e),whites:m(e),neutrals:m(e),blacks:m(e)}},function(e,u){var f=u.adjustment;(0,h.writeUint16)(e,1),(0,h.writeUint16)(e,f.mode==="absolute"?1:0),(0,h.writeZeros)(e,8),O(e,f.reds),O(e,f.yellows),O(e,f.greens),O(e,f.cyans),O(e,f.blues),O(e,f.magentas),O(e,f.whites),O(e,f.neutrals),O(e,f.blacks)}),_("CgEd",function(e){var u=e.adjustment;return u?u.type==="brightness/contrast"&&!u.useLegacy||(u.type==="levels"||u.type==="curves"||u.type==="exposure"||u.type==="channel mixer"||u.type==="hue/saturation")&&u.presetFileName!==void 0:!1},function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);if(k.Vrsn!==1)throw new Error("Invalid CgEd version");"presetFileName"in k?u.adjustment=r(r({},u.adjustment),{presetKind:k.presetKind,presetFileName:k.presetFileName}):"curvesPresetFileName"in k?u.adjustment=r(r({},u.adjustment),{presetKind:k.curvesPresetKind,presetFileName:k.curvesPresetFileName}):"mixerPresetFileName"in k?u.adjustment=r(r({},u.adjustment),{presetKind:k.mixerPresetKind,presetFileName:k.mixerPresetFileName}):u.adjustment={type:"brightness/contrast",brightness:k.Brgh,contrast:k.Cntr,meanValue:k.means,useLegacy:!!k.useLegacy,labColorOnly:!!k["Lab "],auto:!!k.Auto},(0,l.skipBytes)(e,f())},function(e,u){var f,k,v,i,n=u.adjustment;if(n.type==="levels"||n.type==="exposure"||n.type==="hue/saturation"){var w={Vrsn:1,presetKind:(f=n.presetKind)!==null&&f!==void 0?f:1,presetFileName:n.presetFileName||""};(0,o.writeVersionAndDescriptor)(e,"","null",w)}else if(n.type==="curves"){var w={Vrsn:1,curvesPresetKind:(k=n.presetKind)!==null&&k!==void 0?k:1,curvesPresetFileName:n.presetFileName||""};(0,o.writeVersionAndDescriptor)(e,"","null",w)}else if(n.type==="channel mixer"){var w={Vrsn:1,mixerPresetKind:(v=n.presetKind)!==null&&v!==void 0?v:1,mixerPresetFileName:n.presetFileName||""};(0,o.writeVersionAndDescriptor)(e,"","null",w)}else if(n.type==="brightness/contrast"){var w={Vrsn:1,Brgh:n.brightness||0,Cntr:n.contrast||0,means:(i=n.meanValue)!==null&&i!==void 0?i:127,"Lab ":!!n.labColorOnly,useLegacy:!!n.useLegacy,Auto:!!n.auto};(0,o.writeVersionAndDescriptor)(e,"","null",w)}else throw new Error("Unhandled CgEd case")});function y(e){var u=[];function f(k){var v;if(k.children)for(var i=0,n=k.children;i<n.length;i++){var w=n[i];((v=w.text)===null||v===void 0?void 0:v.index)!==void 0&&(u[w.text.index]=w),f(w)}}return f(e),u}_("Txt2",I("engineData"),function(e,u,f,k){var v=(0,l.readBytes)(e,f());u.engineData=(0,s.fromByteArray)(v);var i=y(k),n=(0,S.parseEngineData)(v),w=(0,U.decodeEngineData2)(n).ResourceDict.TextFrameSet;if(w)for(var E=0;E<w.length;E++){var C=i[E];w[E].path&&C?.text&&(C.text.textPath=w[E].path)}},function(e,u){var f=(0,s.toByteArray)(u.engineData);(0,h.writeBytes)(e,f)}),_("FEid",I("filterEffectsMasks"),function(e,u,f){var k=(0,l.readInt32)(e);if(k<1||k>3)throw new Error("Invalid filterEffects version ".concat(k));for(u.filterEffectsMasks=[];f()>8;){if((0,l.readUint32)(e))throw new Error("filterEffects: 64 bit length is not supported");var v=(0,l.readUint32)(e),i=e.offset+v,n=(0,l.readPascalString)(e,1),w=(0,l.readInt32)(e);if(w!==1)throw new Error("Invalid filterEffect version ".concat(w));if((0,l.readUint32)(e))throw new Error("filterEffect: 64 bit length is not supported");(0,l.readUint32)(e);for(var E=(0,l.readInt32)(e),C=(0,l.readInt32)(e),R=(0,l.readInt32)(e),oe=(0,l.readInt32)(e),ue=(0,l.readInt32)(e),re=(0,l.readInt32)(e),he=[],A=0;A<re+2;A++)if((0,l.readInt32)(e)){if((0,l.readUint32)(e))throw new Error("filterEffect: 64 bit length is not supported");var Se=(0,l.readUint32)(e);if(!Se)throw new Error("filterEffect: Empty channel");var Pe=(0,l.readUint16)(e),Te=(0,l.readBytes)(e,Se-2);he.push({compressionMode:Pe,data:Te})}else he.push(void 0);if(u.filterEffectsMasks.push({id:n,top:E,left:C,bottom:R,right:oe,depth:ue,channels:he}),e.offset<i&&(0,l.readUint8)(e)){var He=(0,l.readInt32)(e),T=(0,l.readInt32)(e),d=(0,l.readInt32)(e),N=(0,l.readInt32)(e);if((0,l.readUint32)(e))throw new Error("filterEffect: 64 bit length is not supported");var P=(0,l.readUint32)(e),Pe=(0,l.readUint16)(e),Te=(0,l.readBytes)(e,P-2);u.filterEffectsMasks[u.filterEffectsMasks.length-1].extra={top:He,left:T,bottom:d,right:N,compressionMode:Pe,data:Te}}e.offset=i;for(var me=v;me%4;)e.offset++,me++}},function(e,u){var f;(0,h.writeInt32)(e,3);for(var k=0,v=u.filterEffectsMasks;k<v.length;k++){var i=v[k];(0,h.writeUint32)(e,0),(0,h.writeUint32)(e,0);var n=e.offset;(0,h.writePascalString)(e,i.id,1),(0,h.writeInt32)(e,1),(0,h.writeUint32)(e,0),(0,h.writeUint32)(e,0);var w=e.offset;(0,h.writeInt32)(e,i.top),(0,h.writeInt32)(e,i.left),(0,h.writeInt32)(e,i.bottom),(0,h.writeInt32)(e,i.right),(0,h.writeInt32)(e,i.depth);var E=Math.max(0,i.channels.length-2);(0,h.writeInt32)(e,E);for(var C=0;C<E+2;C++){var R=i.channels[C];(0,h.writeInt32)(e,R?1:0),R&&((0,h.writeUint32)(e,0),(0,h.writeUint32)(e,R.data.length+2),(0,h.writeUint16)(e,R.compressionMode),(0,h.writeBytes)(e,R.data))}e.view.setUint32(w-4,e.offset-w,!1);var oe=(f=u.filterEffectsMasks[u.filterEffectsMasks.length-1])===null||f===void 0?void 0:f.extra;oe&&((0,h.writeUint8)(e,1),(0,h.writeInt32)(e,oe.top),(0,h.writeInt32)(e,oe.left),(0,h.writeInt32)(e,oe.bottom),(0,h.writeInt32)(e,oe.right),(0,h.writeUint32)(e,0),(0,h.writeUint32)(e,oe.data.byteLength+2),(0,h.writeUint16)(e,oe.compressionMode),(0,h.writeBytes)(e,oe.data));var ue=e.offset-n;for(e.view.setUint32(n-4,ue,!1);ue%4;)(0,h.writeZeros)(e,1),ue++}}),x("FXid","FEid"),_("FMsk",I("filterMask"),function(e,u){u.filterMask={colorSpace:(0,l.readColor)(e),opacity:(0,l.readUint16)(e)/255}},function(e,u){var f;(0,h.writeColor)(e,u.filterMask.colorSpace),(0,h.writeUint16)(e,(0,c.clamp)((f=u.filterMask.opacity)!==null&&f!==void 0?f:1,0,1)*255)}),_("artd",function(e){return e.artboards!==void 0},function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);u.artboards={count:k["Cnt "],autoExpandOffset:{horizontal:k.autoExpandOffset.Hrzn,vertical:k.autoExpandOffset.Vrtc},origin:{horizontal:k.origin.Hrzn,vertical:k.origin.Vrtc},autoExpandEnabled:k.autoExpandEnabled,autoNestEnabled:k.autoNestEnabled,autoPositionEnabled:k.autoPositionEnabled,shrinkwrapOnSaveEnabled:!!k.shrinkwrapOnSaveEnabled,docDefaultNewArtboardBackgroundColor:(0,o.parseColor)(k.docDefaultNewArtboardBackgroundColor),docDefaultNewArtboardBackgroundType:k.docDefaultNewArtboardBackgroundType},(0,l.skipBytes)(e,f())},function(e,u){var f,k,v,i,n,w=u.artboards,E={"Cnt ":w.count,autoExpandOffset:w.autoExpandOffset?{Hrzn:w.autoExpandOffset.horizontal,Vrtc:w.autoExpandOffset.vertical}:{Hrzn:0,Vrtc:0},origin:w.origin?{Hrzn:w.origin.horizontal,Vrtc:w.origin.vertical}:{Hrzn:0,Vrtc:0},autoExpandEnabled:(f=w.autoExpandEnabled)!==null&&f!==void 0?f:!0,autoNestEnabled:(k=w.autoNestEnabled)!==null&&k!==void 0?k:!0,autoPositionEnabled:(v=w.autoPositionEnabled)!==null&&v!==void 0?v:!0,shrinkwrapOnSaveEnabled:(i=w.shrinkwrapOnSaveEnabled)!==null&&i!==void 0?i:!0,docDefaultNewArtboardBackgroundColor:(0,o.serializeColor)(w.docDefaultNewArtboardBackgroundColor),docDefaultNewArtboardBackgroundType:(n=w.docDefaultNewArtboardBackgroundType)!==null&&n!==void 0?n:1};(0,o.writeVersionAndDescriptor)(e,"","null",E,"artd")});function F(e){return Object.keys(e).map(function(u){return e[u]}).some(function(u){return Array.isArray(u)&&u.length>1})}t.hasMultiEffects=F,_("lfx2",function(e){return e.effects!==void 0&&!F(e.effects)},function(e,u,f){if((0,l.readUint32)(e)!==0)throw new Error("Invalid lfx2 version");var k=(0,o.readVersionAndDescriptor)(e);u.effects=(0,o.parseEffects)(k,!!e.logMissingFeatures),(0,l.skipBytes)(e,f())},function(e,u,f,k){var v=(0,o.serializeEffects)(u.effects,!!k.logMissingFeatures,!0);(0,h.writeUint32)(e,0),(0,o.writeVersionAndDescriptor)(e,"","null",v)}),_("cinf",I("compositorUsed"),function(e,u,f){var k=(0,o.readVersionAndDescriptor)(e);function v(i){return i.split(".")[1]}u.compositorUsed={description:k.description,reason:k.reason,engine:v(k.Engn)},k.Vrsn&&(u.compositorUsed.version=k.Vrsn),k.psVersion&&(u.compositorUsed.photoshopVersion=k.psVersion),k.enableCompCore&&(u.compositorUsed.enableCompCore=v(k.enableCompCore)),k.enableCompCoreGPU&&(u.compositorUsed.enableCompCoreGPU=v(k.enableCompCoreGPU)),k.enableCompCoreThreads&&(u.compositorUsed.enableCompCoreThreads=v(k.enableCompCoreThreads)),k.compCoreSupport&&(u.compositorUsed.compCoreSupport=v(k.compCoreSupport)),k.compCoreGPUSupport&&(u.compositorUsed.compCoreGPUSupport=v(k.compCoreGPUSupport)),(0,l.skipBytes)(e,f())},function(e,u){var f=u.compositorUsed,k={Vrsn:f.version||{major:1,minor:0,fix:0}};f.photoshopVersion&&(k.psVersion=f.photoshopVersion),k.description=f.description,k.reason=f.reason,k.Engn="Engn.".concat(f.engine),f.enableCompCore&&(k.enableCompCore="enable.".concat(f.enableCompCore)),f.enableCompCoreGPU&&(k.enableCompCoreGPU="enable.".concat(f.enableCompCoreGPU)),f.enableCompCoreThreads&&(k.enableCompCoreThreads="enable.".concat(f.enableCompCoreThreads)),f.compCoreSupport&&(k.compCoreSupport="reason.".concat(f.compCoreSupport)),f.compCoreGPUSupport&&(k.compCoreGPUSupport="reason.".concat(f.compCoreGPUSupport)),(0,o.writeVersionAndDescriptor)(e,"","null",k)}),_("extn",function(e){return e._extn!==void 0},function(e,u){var f=(0,o.readVersionAndDescriptor)(e);c.MOCK_HANDLERS&&(u._extn=f)},function(e,u){c.MOCK_HANDLERS&&(0,o.writeVersionAndDescriptor)(e,"","null",u._extn)}),_("iOpa",I("fillOpacity"),function(e,u){u.fillOpacity=(0,l.readUint8)(e)/255,(0,l.skipBytes)(e,3)},function(e,u){(0,h.writeUint8)(e,u.fillOpacity*255),(0,h.writeZeros)(e,3)}),_("brst",I("channelBlendingRestrictions"),function(e,u,f){for(u.channelBlendingRestrictions=[];f()>4;)u.channelBlendingRestrictions.push((0,l.readInt32)(e))},function(e,u){for(var f=0,k=u.channelBlendingRestrictions;f<k.length;f++){var v=k[f];(0,h.writeInt32)(e,v)}}),_("tsly",I("transparencyShapesLayer"),function(e,u){u.transparencyShapesLayer=!!(0,l.readUint8)(e),(0,l.skipBytes)(e,3)},function(e,u){(0,h.writeUint8)(e,u.transparencyShapesLayer?1:0),(0,h.writeZeros)(e,3)})})),Pr=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(ae){for(var le,p=1,m=arguments.length;p<m;p++){le=arguments[p];for(var O in le)Object.prototype.hasOwnProperty.call(le,O)&&(ae[O]=le[O])}return ae},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.writeColor=t.writePsd=t.writeSection=t.writeUnicodeStringWithPadding=t.writeUnicodeString=t.writeUnicodeStringWithoutLengthLE=t.writeUnicodeStringWithoutLength=t.writePascalString=t.writeAsciiString=t.writeSignature=t.writeZeros=t.writeBytes=t.writeFixedPointPath32=t.writeFixedPoint32=t.writeFloat64=t.writeFloat32=t.writeUint32=t.writeInt32LE=t.writeInt32=t.writeUint16LE=t.writeUint16=t.writeInt16=t.writeUint8=t.getWriterBufferNoCopy=t.getWriterBuffer=t.createWriter=void 0;var s=Wt(),a=gi(),c=No();function l(ae){ae===void 0&&(ae=4096);var le=new ArrayBuffer(ae);return{buffer:le,view:new DataView(le),offset:0,tempBuffer:void 0}}t.createWriter=l;function h(ae){return ae.buffer.slice(0,ae.offset)}t.getWriterBuffer=h;function o(ae){return new Uint8Array(ae.buffer,0,ae.offset)}t.getWriterBufferNoCopy=o;function S(ae,le){var p=ge(ae,1);ae.view.setUint8(p,le)}t.writeUint8=S;function D(ae,le){var p=ge(ae,2);ae.view.setInt16(p,le,!1)}t.writeInt16=D;function U(ae,le){var p=ge(ae,2);ae.view.setUint16(p,le,!1)}t.writeUint16=U;function M(ae,le){var p=ge(ae,2);ae.view.setUint16(p,le,!0)}t.writeUint16LE=M;function _(ae,le){var p=ge(ae,4);ae.view.setInt32(p,le,!1)}t.writeInt32=_;function x(ae,le){var p=ge(ae,4);ae.view.setInt32(p,le,!0)}t.writeInt32LE=x;function I(ae,le){var p=ge(ae,4);ae.view.setUint32(p,le,!1)}t.writeUint32=I;function H(ae,le){var p=ge(ae,4);ae.view.setFloat32(p,le,!1)}t.writeFloat32=H;function ee(ae,le){var p=ge(ae,8);ae.view.setFloat64(p,le,!1)}t.writeFloat64=ee;function Z(ae,le){_(ae,le*65536)}t.writeFixedPoint32=Z;function K(ae,le){_(ae,le*(1<<24))}t.writeFixedPointPath32=K;function W(ae,le){le&&(fe(ae,ae.offset+le.length),new Uint8Array(ae.buffer).set(le,ae.offset),ae.offset+=le.length)}t.writeBytes=W;function X(ae,le){for(var p=0;p<le;p++)S(ae,0)}t.writeZeros=X;function Q(ae,le){if(le.length!==4)throw new Error("Invalid signature: '".concat(le,"'"));for(var p=0;p<4;p++)S(ae,le.charCodeAt(p))}t.writeSignature=Q;function V(ae,le){for(var p=0;p<le.length;p++)S(ae,le.charCodeAt(p))}t.writeAsciiString=V;function te(ae,le,p){var m=le.length;if(m>255)throw new Error("String too long");S(ae,m);for(var O=0;O<m;O++){var y=le.charCodeAt(O);S(ae,y<128?y:63)}for(;++m%p;)S(ae,0)}t.writePascalString=te;function J(ae,le){for(var p=0;p<le.length;p++)U(ae,le.charCodeAt(p))}t.writeUnicodeStringWithoutLength=J;function G(ae,le){for(var p=0;p<le.length;p++)M(ae,le.charCodeAt(p))}t.writeUnicodeStringWithoutLengthLE=G;function $(ae,le){I(ae,le.length),J(ae,le)}t.writeUnicodeString=$;function ce(ae,le){I(ae,le.length+1);for(var p=0;p<le.length;p++)U(ae,le.charCodeAt(p));U(ae,0)}t.writeUnicodeStringWithPadding=ce;function se(ae){ae===void 0&&(ae=[]);for(var le=0,p=0,m=ae;p<m.length;p++){var O=m[p];if(O.canvas||O.imageData){var y=De(O),F=y.width,e=y.height;le=Math.max(le,2*e+2*F*e)}O.children&&(le=Math.max(le,se(O.children)))}return le}function g(ae,le,p,m,O){m===void 0&&(m=!1),O===void 0&&(O=!1),O&&I(ae,0);var y=ae.offset;I(ae,0),p();for(var F=ae.offset-y-4,e=F;e%le;)S(ae,0),e++;m&&(F=e),ae.view.setUint32(y,F,!1)}t.writeSection=g;function L(ae){var le;(le=ae.children)===null||le===void 0||le.forEach(L);var p=ae.imageData;if(p&&(p.data instanceof Uint32Array||p.data instanceof Uint16Array))throw new Error("imageData has incorrect bitDepth");if("mask"in ae&&ae.mask){var m=ae.mask.imageData;if(m&&(m.data instanceof Uint32Array||m.data instanceof Uint16Array))throw new Error("mask imageData has incorrect bitDepth")}}function j(ae,le,p){var m;if(p===void 0&&(p={}),!(+le.width>0&&+le.height>0))throw new Error("Invalid document size");if((le.width>3e4||le.height>3e4)&&!p.psb)throw new Error("Document size is too large (max is 30000x30000, use PSB format instead)");var O=(m=le.bitsPerChannel)!==null&&m!==void 0?m:8;if(O!==8)throw new Error("bitsPerChannel other than 8 are not supported for writing");L(le);var y=r({},le.imageResources),F=r(r({},p),{layerIds:new Set,layerToId:new Map});F.generateThumbnail&&(y.thumbnail=ke(le));var e=le.imageData;if(!e&&le.canvas&&(e=le.canvas.getContext("2d").getImageData(0,0,le.canvas.width,le.canvas.height)),e&&(le.width!==e.width||le.height!==e.height))throw new Error("Document canvas must have the same size as document");var u=!!e&&(0,s.hasAlpha)(e),f=Math.max(se(le.children),8*le.width*le.height+2*le.height);ae.tempBuffer=new Uint8Array(f),Q(ae,"8BPS"),U(ae,p.psb?2:1),X(ae,6),U(ae,u?4:3),I(ae,le.height),I(ae,le.width),U(ae,O),U(ae,3),g(ae,1,function(){var he,A,Se;if(le.palette){for(var Pe=0;Pe<256;Pe++)S(ae,((he=le.palette[Pe])===null||he===void 0?void 0:he.r)||0);for(var Pe=0;Pe<256;Pe++)S(ae,((A=le.palette[Pe])===null||A===void 0?void 0:A.g)||0);for(var Pe=0;Pe<256;Pe++)S(ae,((Se=le.palette[Pe])===null||Se===void 0?void 0:Se.b)||0)}});var k=[];ie(k,le.children),k.length||k.push({}),y.layersGroup=k.map(function(he){return he.linkGroup||0}),y.layerGroupsEnabledId=k.map(function(he){return he.linkGroupEnabled==!1?0:1}),g(ae,1,function(){for(var he=function(Te){for(var He=Te.has(y),T=He===!1?0:He===!0?1:He,d=function(P){Q(ae,"8BIM"),U(ae,Te.key),te(ae,"",2),g(ae,2,function(){return Te.write(ae,y,P)})},N=0;N<T;N++)d(N)},A=0,Se=c.resourceHandlers;A<Se.length;A++){var Pe=Se[A];he(Pe)}}),g(ae,2,function(){ne(ae,k,le,u,F),we(ae,le.globalLayerMaskInfo),_e(ae,le,le,F)},void 0,!!F.psb);var v=u?[0,1,2,3]:[0,1,2],i=e?e.width:le.width,n=e?e.height:le.height,w={data:new Uint8Array(i*n*4),width:i,height:n};if(U(ae,1),s.RAW_IMAGE_DATA&&le.imageDataRaw)console.log("writing raw image data"),W(ae,le.imageDataRaw);else{if(e&&w.data.set(new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength)),u)for(var E=w.width*w.height*4,C=w.data,R=0;R<E;R+=4){var oe=C[R+3];if(oe!=0&&oe!=255){var ue=oe/255,re=255*(1-ue);C[R+0]=C[R+0]*ue+re,C[R+1]=C[R+1]*ue+re,C[R+2]=C[R+2]*ue+re}}W(ae,(0,s.writeDataRLE)(ae.tempBuffer,w,v,!!p.psb))}}t.writePsd=j;function ne(ae,le,p,m,O){g(ae,4,function(){var y;D(ae,m?-le.length:le.length);for(var F=le.map(function(C,R){return Ie(ae.tempBuffer,C,R===0,O)}),e=function(C){var R=C.layer,oe=C.top,ue=C.left,re=C.bottom,he=C.right,A=C.channels;_(ae,oe),_(ae,ue),_(ae,re),_(ae,he),U(ae,A.length);for(var Se=0,Pe=A;Se<Pe.length;Se++){var Te=Pe[Se];D(ae,Te.channelId),O.psb&&I(ae,0),I(ae,Te.length)}Q(ae,"8BIM"),Q(ae,s.fromBlendMode[R.blendMode]||"norm"),S(ae,Math.round((0,s.clamp)((y=R.opacity)!==null&&y!==void 0?y:1,0,1)*255)),S(ae,R.clipping?1:0);var He=8;R.transparencyProtected&&(He|=1),R.hidden&&(He|=2),(R.vectorMask||R.sectionDivider&&R.sectionDivider.type!==0||R.adjustment)&&(He|=16),R.effectsOpen&&(He|=32),S(ae,He),S(ae,0),g(ae,1,function(){z(ae,R,C),ve(ae,R),te(ae,(R.name||"").substring(0,255),4),_e(ae,R,p,O)})},u=0,f=F;u<f.length;u++){var k=f[u];e(k)}for(var v=0,i=F;v<i.length;v++)for(var k=i[v],n=0,w=k.channels;n<w.length;n++){var E=w[n];U(ae,E.compression),E.buffer&&W(ae,E.buffer)}},!0,O.psb)}function z(ae,le,p){var m=le.mask,O=le.realMask;g(ae,1,function(){if(!(!m&&!O)){var y=0,F=0,e=0;m&&(m.userMaskDensity!==void 0&&(y|=1),m.userMaskFeather!==void 0&&(y|=2),m.vectorMaskDensity!==void 0&&(y|=4),m.vectorMaskFeather!==void 0&&(y|=8),m.disabled&&(F|=2),m.positionRelativeToLayer&&(F|=1),m.fromVectorData&&(F|=8),y&&(F|=16));var u=p.mask||{};if(_(ae,u.top||0),_(ae,u.left||0),_(ae,u.bottom||0),_(ae,u.right||0),S(ae,m&&m.defaultColor||0),S(ae,F),O){O.disabled&&(e|=2),O.positionRelativeToLayer&&(e|=1),O.fromVectorData&&(e|=8);var f=p.realMask||{};S(ae,e),S(ae,O.defaultColor||0),_(ae,f.top||0),_(ae,f.left||0),_(ae,f.bottom||0),_(ae,f.right||0)}y&&m&&(S(ae,y),m.userMaskDensity!==void 0&&S(ae,Math.round(m.userMaskDensity*255)),m.userMaskFeather!==void 0&&ee(ae,m.userMaskFeather),m.vectorMaskDensity!==void 0&&S(ae,Math.round(m.vectorMaskDensity*255)),m.vectorMaskFeather!==void 0&&ee(ae,m.vectorMaskFeather)),X(ae,2)}})}function Y(ae,le){S(ae,le[0]),S(ae,le[1]),S(ae,le[2]),S(ae,le[3])}function ve(ae,le){g(ae,1,function(){var p=le.blendingRanges;if(p){Y(ae,p.compositeGrayBlendSource),Y(ae,p.compositeGraphBlendDestinationRange);for(var m=0,O=p.ranges;m<O.length;m++){var y=O[m];Y(ae,y.sourceRange),Y(ae,y.destRange)}}})}function we(ae,le){g(ae,1,function(){le&&(U(ae,le.overlayColorSpace),U(ae,le.colorSpace1),U(ae,le.colorSpace2),U(ae,le.colorSpace3),U(ae,le.colorSpace4),U(ae,le.opacity*255),S(ae,le.kind),X(ae,3))})}function _e(ae,le,p,m){for(var O=function(u){var f=u.key;if(f==="Txt2"&&m.invalidateTextLayers)return"continue";if(f==="vmsk"&&m.psb&&(f="vsms"),u.has(le)){var k=m.psb&&s.largeAdditionalInfoKeys.indexOf(f)!==-1,v=f!=="Txt2"&&f!=="cinf"&&f!=="extn"&&f!=="CAI "&&f!=="OCIO",i=f==="Txt2"||f==="luni"||f==="vmsk"||f==="artb"||f==="artd"||f==="vogk"||f==="SoLd"||f==="lnk2"||f==="vscg"||f==="vsms"||f==="GdFl"||f==="lmfx"||f==="lrFX"||f==="cinf"||f==="PlLd"||f==="Anno"||f==="CAI "||f==="OCIO"||f==="GenI"||f==="FEid"||f==="curv"||f==="CgEd"||f==="vibA"||f==="blwh"||f==="grdm";Q(ae,k?"8B64":"8BIM"),Q(ae,f),g(ae,i?4:2,function(){u.write(ae,le,p,m)},v,k)}},y=0,F=a.infoHandlers;y<F.length;y++){var e=F[y];O(e)}}function ie(ae,le){if(le)for(var p=0,m=le;p<m.length;p++){var O=m[p];if(O.children&&O.canvas)throw new Error("Invalid layer, cannot have both 'canvas' and 'children' properties");if(O.children&&O.imageData)throw new Error("Invalid layer, cannot have both 'imageData' and 'children' properties");O.children?(ae.push({name:"</Layer group>",sectionDivider:{type:3}}),ie(ae,O.children),ae.push(r(r({},O),{blendMode:O.blendMode==="pass through"?"normal":O.blendMode,sectionDivider:{type:O.opened===!1?2:1,key:s.fromBlendMode[O.blendMode]||"pass",subType:0}}))):ae.push(r({},O))}}function pe(ae,le){var p=ae.buffer.byteLength;do p*=2;while(le>p);var m=new ArrayBuffer(p),O=new Uint8Array(m),y=new Uint8Array(ae.buffer);O.set(y),ae.buffer=m,ae.view=new DataView(ae.buffer)}function fe(ae,le){le>ae.buffer.byteLength&&pe(ae,le)}function ge(ae,le){var p=ae.offset;return fe(ae,ae.offset+=le),p}function ke(ae){var le=(0,s.createCanvas)(10,10),p=1;ae.width>ae.height?(le.width=160,le.height=Math.floor(ae.height*(le.width/ae.width)),p=le.width/ae.width):(le.height=160,le.width=Math.floor(ae.width*(le.height/ae.height)),p=le.height/ae.height);var m=le.getContext("2d");return m.scale(p,p),ae.imageData?m.drawImage((0,s.imageDataToCanvas)(ae.imageData),0,0):ae.canvas&&m.drawImage(ae.canvas,0,0),le}function Ee(ae,le,p,m,O,y){var F=m.top|0,e=m.left|0,u=m.right|0,f=m.bottom|0,k=De(m),v=k.width,i=k.height,n=m.imageData;if(!n&&m.canvas&&v&&i&&(n=m.canvas.getContext("2d").getImageData(0,0,v,i)),n&&(n.width!==v||n.height!==i))throw new Error("Invalid imageData dimentions");u=e+v,f=F+i;var w,E;s.RAW_IMAGE_DATA&&p[y?"realMaskDataRaw":"maskDataRaw"]?(w=p[y?"realMaskDataRaw":"maskDataRaw"],E=p[y?"realMaskDataRawCompression":"maskDataRawCompression"]):n?O.compress?(w=(0,s.writeDataZipWithoutPrediction)(n,[0]),E=2):(w=(0,s.writeDataRLE)(ae,n,[0],!!O.psb),E=1):(w=new Uint8Array(0),E=1),le.channels.push({channelId:y?-3:-2,compression:E,buffer:w,length:2+w.length}),le[y?"realMask":"mask"]={top:F,left:e,right:u,bottom:f}}function Ie(ae,le,p,m){var O=Ne(ae,le,p,m);return le.mask&&Ee(ae,O,le,le.mask,m,!1),le.realMask&&Ee(ae,O,le,le.realMask,m,!0),O}function De(ae){var le,p,m,O,y=ae.canvas,F=ae.imageData;return{width:(p=(le=F?.width)!==null&&le!==void 0?le:y?.width)!==null&&p!==void 0?p:0,height:(O=(m=F?.height)!==null&&m!==void 0?m:y?.height)!==null&&O!==void 0?O:0}}function Ue(ae,le,p,m,O){if(ae.data instanceof Uint32Array||ae.data instanceof Uint16Array)throw new Error("imageData has incorrect bit depth");for(var y=(0,s.createImageData)(m,O),F=ae.data,e=y.data,u=0;u<O;u++)for(var f=0;f<m;f++){var k=(f+le+(u+p)*ae.width)*4,v=(f+u*m)*4;e[v]=F[k],e[v+1]=F[k+1],e[v+2]=F[k+2],e[v+3]=F[k+3]}return y}function Ne(ae,le,p,m){var O,y=le.top|0,F=le.left|0,e=le.right|0,u=le.bottom|0,f=[{channelId:-1,compression:0,buffer:void 0,length:2},{channelId:0,compression:0,buffer:void 0,length:2},{channelId:1,compression:0,buffer:void 0,length:2},{channelId:2,compression:0,buffer:void 0,length:2}],k=De(le),v=k.width,i=k.height;if(!(le.canvas||le.imageData)||!v||!i)return e=F,u=y,{layer:le,top:y,left:F,right:e,bottom:u,channels:f};e=F+v,u=y+i;var n=le.imageData||le.canvas.getContext("2d").getImageData(0,0,v,i);if(m.trimImageData){var w=Ge(n);if(w.left!==0||w.top!==0||w.right!==n.width||w.bottom!==n.height){if(F+=w.left,y+=w.top,e-=n.width-w.right,u-=n.height-w.bottom,v=e-F,i=u-y,!v||!i)return{layer:le,top:y,left:F,right:e,bottom:u,channels:f};n=Ue(n,w.left,w.top,v,i)}}var E=[0,1,2];return(!p||m.noBackground||le.mask||(0,s.hasAlpha)(n)||s.RAW_IMAGE_DATA&&(!((O=le.imageDataRaw)===null||O===void 0)&&O[-1]))&&E.unshift(-1),f=E.map(function(C){var R=(0,s.offsetForChannel)(C,!1),oe,ue;return s.RAW_IMAGE_DATA&&le.imageDataRaw?(oe=le.imageDataRaw[C],ue=le.imageDataRawCompression[C]):m.compress?(oe=(0,s.writeDataZipWithoutPrediction)(n,[R]),ue=2):(oe=(0,s.writeDataRLE)(ae,n,[R],!!m.psb),ue=1),{channelId:C,compression:ue,buffer:oe,length:2+oe.length}}),{layer:le,top:y,left:F,right:e,bottom:u,channels:f}}function Me(ae,le,p,m){for(var O=ae.data,y=(le*ae.width+p)*4+3|0,F=y+(m-p)*4|0,e=y;e<F;e=e+4|0)if(O[e]!==0)return!1;return!0}function Ce(ae,le,p,m){for(var O=ae.data,y=ae.width*4|0,F=p*y+le*4+3|0,e=p,u=F;e<m;e++,u=u+y|0)if(O[u]!==0)return!1;return!0}function Ge(ae){for(var le=0,p=0,m=ae.width,O=ae.height;le<O&&Me(ae,le,p,m);)le++;for(;O>le&&Me(ae,O-1,p,m);)O--;for(;p<m&&Ce(ae,p,le,O);)p++;for(;m>p&&Ce(ae,m-1,le,O);)m--;return{top:le,left:p,right:m,bottom:O}}function qe(ae,le){le?"r"in le?(U(ae,0),U(ae,Math.round(le.r*257)),U(ae,Math.round(le.g*257)),U(ae,Math.round(le.b*257)),U(ae,0)):"fr"in le?(U(ae,0),U(ae,Math.round(le.fr*255*257)),U(ae,Math.round(le.fg*255*257)),U(ae,Math.round(le.fb*255*257)),U(ae,0)):"l"in le?(U(ae,7),D(ae,Math.round(le.l*1e4)),D(ae,Math.round(le.a<0?le.a*12800:le.a*12700)),D(ae,Math.round(le.b<0?le.b*12800:le.b*12700)),U(ae,0)):"h"in le?(U(ae,1),U(ae,Math.round(le.h*65535)),U(ae,Math.round(le.s*65535)),U(ae,Math.round(le.b*65535)),U(ae,0)):"c"in le?(U(ae,2),U(ae,Math.round(le.c*257)),U(ae,Math.round(le.m*257)),U(ae,Math.round(le.y*257)),U(ae,Math.round(le.k*257))):(U(ae,8),U(ae,Math.round(le.k*1e4/255)),X(ae,6)):(U(ae,0),X(ae,8))}t.writeColor=qe})),wc=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(_){for(var x,I=1,H=arguments.length;I<H;I++){x=arguments[I];for(var ee in x)Object.prototype.hasOwnProperty.call(x,ee)&&(_[ee]=x[ee])}return _},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.readAbr=void 0;var s=mi(),a=$t(),c=["off","fade","pen pressure","pen tilt","stylus wheel","initial direction","direction","initial rotation","rotation"],l=["round point","round blunt","round curve","round angle","round fan","flat point","flat blunt","flat curve","flat angle","flat fan"],h=["erodible point","erodible flat","erodible round","erodible square","erodible triangle","custom"],o={_:"brush",MixB:"mixer brush",SmTl:"smudge brush"};function S(_){return{control:c[_.bVTy],steps:_.fStp,jitter:(0,s.parsePercent)(_.jitter),minimum:(0,s.parsePercent)(_["Mnm "])}}function D(_){switch(_._classID){case"computedBrush":return{type:"computed",size:(0,s.parseUnitsToNumber)(_.Dmtr,"Pixels"),angle:(0,s.parseAngle)(_.Angl),roundness:(0,s.parsePercent)(_.Rndn),spacingOn:_.Intr,spacing:(0,s.parsePercent)(_.Spcn),flipX:_.flipX,flipY:_.flipY,hardness:(0,s.parsePercent)(_.Hrdn)};case"sampledBrush":return{type:"sampled",size:(0,s.parseUnitsToNumber)(_.Dmtr,"Pixels"),angle:(0,s.parseAngle)(_.Angl),roundness:(0,s.parsePercent)(_.Rndn),spacingOn:_.Intr,spacing:(0,s.parsePercent)(_.Spcn),flipX:_.flipX,flipY:_.flipY,name:_["Nm "],sampledData:_.sampledData};case"dBrush":return{type:"dynamic",shape:l[_["Shp "]],angle:(0,s.parseAngle)(_.Angl),size:(0,s.parseUnitsToNumber)(_.Dmtr,"Pixels"),density:(0,s.parsePercent)(_.Dnst),length:(0,s.parsePercent)(_.Lngt),clumping:(0,s.parsePercent)(_.clumping),thickness:(0,s.parsePercent)(_.thickness),stiffness:(0,s.parsePercent)(_.stiffness),physics:_.physics,spacing:(0,s.parsePercent)(_.Spcn),spacingOn:_.Intr,flipX:_.flipX,flipY:_.flipY};case"dTips":return r(r({type:"tips",angle:(0,s.parseAngle)(_.Angl),size:(0,s.parseUnitsToNumber)(_.Dmtr,"Pixels"),shape:l[_["Shp "]],physics:_.physics,spacing:(0,s.parsePercent)(_.Spcn),spacingOn:_.Intr,flipX:_.flipX,flipY:_.flipY,tipsType:h[_.dtipsType],tipsLengthRatio:(0,s.parsePercent)(_.dtipsLengthRatio),tipsHardness:(0,s.parsePercent)(_.dtipsHardness)},_.dtipsGridSize&&_.dtipsErodibleTipHeightMap?{tipsGridSize:_.dtipsGridSize,tipsErodibleTipHeightMap:U(_.dtipsErodibleTipHeightMap)}:{}),{tipsAirbrushCutoffAngle:_.dtipsAirbrushCutoffAngle,tipsAirbrushGranularity:(0,s.parsePercent)(_.dtipsAirbrushGranularity),tipsAirbrushStreakiness:(0,s.parsePercent)(_.dtipsAirbrushStreakiness),tipsAirbrushSplatSize:(0,s.parsePercent)(_.dtipsAirbrushSplatSize),tipsAirbrushSplatCount:_.dtipsAirbrushSplatCount});default:throw console.log(xt().inspect(_,!1,99,!0)),new Error("Unknown brush classId: ".concat(_._classID))}}function U(_){for(var x=[],I=0;I<_.byteLength;I++)x.push(_[I]);return x}function M(_,x){var I,H,ee,Z;x===void 0&&(x={});var K=(0,a.createReader)(_.buffer,_.byteOffset,_.byteLength),W=(0,a.readInt16)(K),X=[],Q=[],V=[];if(W===1||W===2)throw new Error("Unsupported ABR version (".concat(W,")"));if(W===6||W===7||W===9||W===10){var te=(0,a.readInt16)(K);if(te!==1&&te!==2)throw new Error("Unsupported ABR minor version");for(;K.offset<K.view.byteLength;){(0,a.checkSignature)(K,"8BIM");var J=(0,a.readSignature)(K),G=(0,a.readUint32)(K),$=K.offset+G;switch(J){case"samp":for(;K.offset<$;){for(var ce=(0,a.readUint32)(K);ce&3;)ce++;var se=K.offset+ce,g=(0,a.readPascalString)(K,1);(0,a.skipBytes)(K,te===1?10:264);var L=(0,a.readInt32)(K),j=(0,a.readInt32)(K),ne=(0,a.readInt32)(K)-L,z=(0,a.readInt32)(K)-j;if(z<=0||ne<=0)throw new Error("Invalid bounds");var Y=(0,a.readInt16)(K),ve=(0,a.readUint8)(K),we=new Uint8Array(z*ne);if(Y===8)if(ve===0)we.set((0,a.readBytes)(K,we.byteLength));else if(ve===1)(0,a.readDataRLE)(K,{width:z,height:ne,data:we},z,ne,Y,1,[0],!1);else throw new Error("Invalid compression");else if(Y===16)if(ve===0)for(var _e=0;_e<we.byteLength;_e++)we[_e]=(0,a.readUint16)(K)>>8;else throw ve===1?new Error("not implemented (16bit RLE)"):new Error("Invalid compression");else throw new Error("Invalid depth");X.push({id:g,bounds:{x:j,y:L,w:z,h:ne},alpha:we}),K.offset=se}break;case"desc":for(var Ie=(0,s.readVersionAndDescriptor)(K,!0),ie=0,pe=Ie.Brsh;ie<pe.length;ie++){var fe=pe[ie],ge={name:fe["Nm "],shape:D(fe.Brsh),spacing:(0,s.parsePercent)(fe.Spcn),wetEdges:fe.Wtdg,noise:fe.Nose,useBrushSize:fe.useBrushSize};fe.interpretation!=null&&(ge.interpretation=fe.interpretation),fe.protectTexture!=null&&(ge.protectTexture=fe.protectTexture),fe.useTipDynamics&&(ge.shapeDynamics={tiltScale:(0,s.parsePercent)(fe.tiltScale),sizeDynamics:S(fe.szVr),angleDynamics:S(fe.angleDynamics),roundnessDynamics:S(fe.roundnessDynamics),flipX:fe.flipX,flipY:fe.flipY,brushProjection:fe.brushProjection,minimumDiameter:(0,s.parsePercent)(fe.minimumDiameter),minimumRoundness:(0,s.parsePercent)(fe.minimumRoundness)}),fe.useScatter&&(ge.scatter={count:fe["Cnt "],bothAxes:fe.bothAxes,countDynamics:S(fe.countDynamics),scatterDynamics:S(fe.scatterDynamics)}),fe.useTexture&&fe.Txtr&&(ge.texture={id:fe.Txtr.Idnt,name:fe.Txtr["Nm "],blendMode:s.BlnM.decode(fe.textureBlendMode),depth:(0,s.parsePercent)(fe.textureDepth),depthMinimum:(0,s.parsePercent)(fe.minimumDepth),depthDynamics:S(fe.textureDepthDynamics),scale:(0,s.parsePercent)(fe.textureScale),invert:fe.InvT,brightness:fe.textureBrightness,contrast:fe.textureContrast,textureEachTip:!!fe.TxtC});var ke=fe.dualBrush;ke&&ke.useDualBrush&&(ge.dualBrush={flip:ke.Flip,shape:D(ke.Brsh),blendMode:s.BlnM.decode(ke.BlnM),useScatter:ke.useScatter,spacing:(0,s.parsePercent)(ke.Spcn),count:ke["Cnt "],bothAxes:ke.bothAxes,countDynamics:S(ke.countDynamics),scatterDynamics:S(ke.scatterDynamics)}),fe.useColorDynamics&&(ge.colorDynamics={foregroundBackground:S(fe.clVr),hue:(0,s.parsePercent)(fe["H "]),saturation:(0,s.parsePercent)(fe.Strt),brightness:(0,s.parsePercent)(fe.Brgh),purity:(0,s.parsePercent)(fe.purity),perTip:fe.colorDynamicsPerTip}),fe.usePaintDynamics&&(ge.transfer={flowDynamics:S(fe.prVr),opacityDynamics:S(fe.opVr),wetnessDynamics:S(fe.wtVr),mixDynamics:S(fe.mxVr)}),fe.useBrushPose&&(ge.brushPose={overrideAngle:fe.overridePoseAngle,overrideTiltX:fe.overridePoseTiltX,overrideTiltY:fe.overridePoseTiltY,overridePressure:fe.overridePosePressure,pressure:(0,s.parsePercent)(fe.brushPosePressure),tiltX:fe.brushPoseTiltX,tiltY:fe.brushPoseTiltY,angle:fe.brushPoseAngle});var Ee=fe.toolOptions;Ee&&(ge.toolOptions={type:o[Ee._classID]||"brush",brushPreset:Ee.brushPreset,flow:(I=Ee.flow)!==null&&I!==void 0?I:100,smooth:(H=Ee.Smoo)!==null&&H!==void 0?H:0,mode:s.BlnM.decode(Ee["Md "]||"BlnM.Nrml"),opacity:(ee=Ee.Opct)!==null&&ee!==void 0?ee:100,smoothing:!!Ee.smoothing,smoothingValue:Ee.smoothingValue||0,smoothingRadiusMode:!!Ee.smoothingRadiusMode,smoothingCatchup:!!Ee.smoothingCatchup,smoothingCatchupAtEnd:!!Ee.smoothingCatchupAtEnd,smoothingZoomCompensation:!!Ee.smoothingZoomCompensation,pressureSmoothing:!!Ee.pressureSmoothing,usePressureOverridesSize:!!Ee.usePressureOverridesSize,usePressureOverridesOpacity:!!Ee.usePressureOverridesOpacity,useLegacy:!!Ee.useLegacy},Ee.prVr&&(ge.toolOptions.flowDynamics=S(Ee.prVr)),Ee.opVr&&(ge.toolOptions.opacityDynamics=S(Ee.opVr)),Ee.szVr&&(ge.toolOptions.sizeDynamics=S(Ee.szVr)),"wetness"in Ee&&(ge.toolOptions.wetness=Ee.wetness),"dryness"in Ee&&(ge.toolOptions.dryness=Ee.dryness),"mix"in Ee&&(ge.toolOptions.mix=Ee.mix),"autoFill"in Ee&&(ge.toolOptions.autoFill=Ee.autoFill),"autoClean"in Ee&&(ge.toolOptions.autoClean=Ee.autoClean),"loadSolidColorOnly"in Ee&&(ge.toolOptions.loadSolidColorOnly=Ee.loadSolidColorOnly),"sampleAllLayers"in Ee&&(ge.toolOptions.sampleAllLayers=Ee.sampleAllLayers),"SmdF"in Ee&&(ge.toolOptions.smudgeFingerPainting=Ee.SmdF),"SmdS"in Ee&&(ge.toolOptions.smudgeSampleAllLayers=Ee.SmdS),"Prs "in Ee&&(ge.toolOptions.strength=Ee["Prs "]),"SmdF"in Ee&&(ge.toolOptions.smudgeFingerPainting=Ee.SmdF),"SmdS"in Ee&&(ge.toolOptions.smudgeSampleAllLayers=Ee.SmdS)),Q.push(ge)}break;case"patt":for(;K.offset<$;)V.push((0,a.readPattern)(K));K.offset=$;break;case"phry":var Ie=(0,s.readVersionAndDescriptor)(K);x.logMissingFeatures&&!((Z=Ie.hierarchy)===null||Z===void 0)&&Z.length;break;default:throw new Error("Invalid brush type: ".concat(J))}for(;G%4;)K.offset++,G++}}else throw new Error("Unsupported ABR version (".concat(W,")"));return{samples:X,patterns:V,brushes:Q}}t.readAbr=M})),bc=je((t=>{var r=t&&t.__assign||function(){return r=Object.assign||function(l){for(var h,o=1,S=arguments.length;o<S;o++){h=arguments[o];for(var D in h)Object.prototype.hasOwnProperty.call(h,D)&&(l[D]=h[D])}return l},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.readCsh=void 0;var s=gi(),a=$t();function c(l){var h=(0,a.createReader)(l.buffer,l.byteOffset,l.byteLength),o={shapes:[]};if((0,a.checkSignature)(h,"cush"),(0,a.readUint32)(h)!==2)throw new Error("Invalid version");for(var S=(0,a.readUint32)(h),D=0;D<S;D++){for(var U=(0,a.readUnicodeString)(h);h.offset%4;)h.offset++;if((0,a.readUint32)(h)!==1)throw new Error("Invalid shape version");var M=(0,a.readUint32)(h),_=h.offset+M,x=(0,a.readPascalString)(h,1),I=(0,a.readUint32)(h),H=(0,a.readUint32)(h),ee=(0,a.readUint32)(h),Z=(0,a.readUint32)(h)-H,K=ee-I,W={paths:[]};(0,s.readVectorMask)(h,W,Z,K,_-h.offset),o.shapes.push(r({name:U,id:x,width:Z,height:K},W)),h.offset=_}return o}t.readCsh=c})),_c=je((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Compression=t.ChannelID=t.LayerCompCapturedInfo=t.SectionDividerType=t.ColorMode=void 0,(function(r){r[r.Bitmap=0]="Bitmap",r[r.Grayscale=1]="Grayscale",r[r.Indexed=2]="Indexed",r[r.RGB=3]="RGB",r[r.CMYK=4]="CMYK",r[r.Multichannel=7]="Multichannel",r[r.Duotone=8]="Duotone",r[r.Lab=9]="Lab"})(t.ColorMode||(t.ColorMode={})),(function(r){r[r.Other=0]="Other",r[r.OpenFolder=1]="OpenFolder",r[r.ClosedFolder=2]="ClosedFolder",r[r.BoundingSectionDivider=3]="BoundingSectionDivider"})(t.SectionDividerType||(t.SectionDividerType={})),(function(r){r[r.None=0]="None",r[r.Visibility=1]="Visibility",r[r.Position=2]="Position",r[r.Appearance=4]="Appearance"})(t.LayerCompCapturedInfo||(t.LayerCompCapturedInfo={})),(function(r){r[r.Color0=0]="Color0",r[r.Color1=1]="Color1",r[r.Color2=2]="Color2",r[r.Color3=3]="Color3",r[r.Transparency=-1]="Transparency",r[r.UserMask=-2]="UserMask",r[r.RealUserMask=-3]="RealUserMask"})(t.ChannelID||(t.ChannelID={})),(function(r){r[r.RawData=0]="RawData",r[r.RleCompressed=1]="RleCompressed",r[r.ZipWithoutPrediction=2]="ZipWithoutPrediction",r[r.ZipWithPrediction=3]="ZipWithPrediction"})(t.Compression||(t.Compression={}))})),Sc=je((t=>{var r=t&&t.__createBinding||(Object.create?(function(_,x,I,H){H===void 0&&(H=I);var ee=Object.getOwnPropertyDescriptor(x,I);(!ee||("get"in ee?!x.__esModule:ee.writable||ee.configurable))&&(ee={enumerable:!0,get:function(){return x[I]}}),Object.defineProperty(_,H,ee)}):(function(_,x,I,H){H===void 0&&(H=I),_[H]=x[I]})),s=t&&t.__exportStar||function(_,x){for(var I in _)I!=="default"&&!Object.prototype.hasOwnProperty.call(x,I)&&r(x,_,I)};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeLayerPixels=t.writePsdBuffer=t.writePsdUint8Array=t.writePsd=t.readPsd=t.byteArrayToBase64=t.initializeCanvas=void 0;var a=Pr(),c=$t(),l=en();s(wc(),t),s(bc(),t);var h=Wt();Object.defineProperty(t,"initializeCanvas",{enumerable:!0,get:function(){return h.initializeCanvas}}),s(_c(),t),t.byteArrayToBase64=l.fromByteArray;function o(_,x){var I="buffer"in _?(0,c.createReader)(_.buffer,_.byteOffset,_.byteLength):(0,c.createReader)(_);return(0,c.readPsd)(I,x)}t.readPsd=o;function S(_,x){var I=(0,a.createWriter)();return(0,a.writePsd)(I,_,x),(0,a.getWriterBuffer)(I)}t.writePsd=S;function D(_,x){var I=(0,a.createWriter)();return(0,a.writePsd)(I,_,x),(0,a.getWriterBufferNoCopy)(I)}t.writePsdUint8Array=D;function U(_,x){if(typeof Buffer>"u")throw new Error("Buffer not supported on this platform");return Buffer.from(D(_,x))}t.writePsdBuffer=U;function M(_,x){(0,c.decodeLayerImageData)(_,x)}t.decodeLayerPixels=M})),Ec=xr({default:()=>Ac});async function Ac(t,r,s){const a=r.ownerDocument||document,c=Tn(s?.options),{readPsd:l}=await Promise.resolve().then(()=>vn(Sc(),1)),h=l(t,{useImageData:!0}),o=yi(a,h.canvas||h.imageData),S=wi(a,h.children),D=S.filter(Y=>Y.canvas),U=new Set(D.filter(Y=>!Y.hidden).map(Y=>Y.id));let M=1;const _=En(),x=it(a,"div","psd-viewer");x.dataset.viewerZoomProvider="psd";const I=it(a,"div","psd-toolbar"),H=it(a,"div","psd-title");H.append(it(a,"strong",void 0,c("psd.title")),it(a,"span",void 0,`${h.width||0} x ${h.height||0} · ${S.length} layers · ag-psd`));const ee=it(a,"div","psd-actions"),Z=it(a,"button",void 0,"-"),K=it(a,"span",void 0,"100%"),W=it(a,"button",void 0,"+"),X=it(a,"button",void 0,c("psd.action.fit")),Q=it(a,"button",void 0,c("psd.action.showAll")),V=it(a,"button",void 0,c("psd.action.hideAll"));[Z,W,X,Q,V].forEach(Y=>{Y.type="button"}),ee.append(Z,K,W,X,Q,V),I.append(H,ee);const te=it(a,"div","psd-layout"),J=it(a,"aside","psd-sidebar"),G=it(a,"div","psd-sidebar-header");G.append(it(a,"span",void 0,c("psd.layers.title")),it(a,"span",void 0,c("psd.layers.redrawable",{count:D.length})));const $=it(a,"ul","psd-layer-list");J.append(G,$);const ce=it(a,"main","psd-stage"),se=it(a,"div","psd-canvas-wrap"),g=it(a,"div","psd-canvas-shell"),L=it(a,"canvas");L.width=Math.max(1,Number(h.width||o?.width||1)),L.height=Math.max(1,Number(h.height||o?.height||1)),g.appendChild(L),se.appendChild(g),ce.appendChild(se),te.append(J,ce),x.append(I,te),r.replaceChildren(jo(a),x);const j=()=>{const Y=L.getContext("2d");if(!Y)return;Y.clearRect(0,0,L.width,L.height);const ve=D.filter(we=>U.has(we.id));if(!ve.length&&o){Y.drawImage(o,0,0);return}ve.slice().reverse().forEach(we=>{we.canvas&&Y.drawImage(we.canvas,we.left,we.top)})};S.length||$.appendChild(it(a,"li","psd-empty",c("psd.layers.empty"))),S.forEach(Y=>{const ve=it(a,"li","psd-layer");ve.style.paddingLeft=`${8+Y.depth*14}px`;const we=it(a,"input");we.type="checkbox",we.disabled=!Y.canvas,we.checked=U.has(Y.id),we.addEventListener("change",()=>{we.checked?U.add(Y.id):U.delete(Y.id),j()});const _e=it(a,"div");_e.append(it(a,"strong",void 0,Y.name),it(a,"span",void 0,`${Y.left},${Y.top} · ${Y.width} x ${Y.height}${Y.hidden?` · ${c("psd.layers.hidden")}`:""}`)),ve.append(we,_e),$.appendChild(ve)});const ne=()=>({scale:M,label:`${Math.round(M*100)}%`,canZoomIn:M<4,canZoomOut:M>.1,canReset:M!==1,minScale:.1,maxScale:4}),z=Y=>(M=Vo(Y),se.style.transform=`scale(${M})`,K.textContent=`${Math.round(M*100)}%`,_.emit(),ne());return Z.addEventListener("click",()=>z(M-.1)),W.addEventListener("click",()=>z(M+.1)),X.addEventListener("click",()=>z(1)),Q.addEventListener("click",()=>{D.forEach(Y=>U.add(Y.id)),$.querySelectorAll('input[type="checkbox"]').forEach(Y=>{Y.disabled||(Y.checked=!0)}),j()}),V.addEventListener("click",()=>{U.clear(),$.querySelectorAll('input[type="checkbox"]').forEach(Y=>{Y.disabled||(Y.checked=!1)}),j()}),_n(x,{zoomIn:()=>z(M+.1),zoomOut:()=>z(M-.1),resetZoom:()=>z(1),setZoom:z,getState:ne,subscribe:_.subscribe}),j(),z(1),{$el:x,unmount(){Sn(x),r.replaceChildren()}}}var zo,it,jo,yi,wi,Vo,Ic=Ze((()=>{Rn(),zo=`
|
|
102
|
+
.psd-viewer{display:grid;height:100%;min-height:460px;grid-template-rows:auto minmax(0,1fr);--psd-bg:#eef1f4;--psd-surface:#fff;--psd-border:rgba(15,23,42,.1);--psd-text:#132235;--psd-muted:#64748b;--psd-accent:#0f766e;background:var(--psd-bg);color:var(--psd-text);box-sizing:border-box}
|
|
103
|
+
.psd-toolbar{position:sticky;top:0;z-index:2;display:flex;min-height:52px;align-items:center;justify-content:space-between;gap:14px;padding:10px 16px;border-bottom:1px solid var(--psd-border);background:rgba(255,255,255,.92);backdrop-filter:blur(12px);box-sizing:border-box}
|
|
104
|
+
.psd-title{display:flex;min-width:0;flex-direction:column;gap:2px}
|
|
105
|
+
.psd-title strong{overflow:hidden;font-size:14px;text-overflow:ellipsis;white-space:nowrap}
|
|
106
|
+
.psd-title span{color:var(--psd-muted);font-size:12px;font-weight:700}
|
|
107
|
+
.psd-actions{display:flex;flex-shrink:0;align-items:center;gap:6px}
|
|
108
|
+
.psd-actions button{height:30px;min-width:34px;border:1px solid rgba(100,116,139,.28);border-radius:6px;background:#fff;color:#132235;cursor:pointer;font-size:12px;font-weight:800}
|
|
109
|
+
.psd-actions button:hover{border-color:rgba(15,118,110,.45);color:var(--psd-accent)}
|
|
110
|
+
.psd-actions span{min-width:48px;color:var(--psd-muted);font-size:12px;font-weight:800;text-align:center}
|
|
111
|
+
.psd-layout{display:grid;min-height:0;grid-template-columns:280px minmax(0,1fr)}
|
|
112
|
+
.psd-sidebar{min-height:0;overflow:auto;border-right:1px solid var(--psd-border);background:rgba(248,250,252,.86)}
|
|
113
|
+
.psd-sidebar-header{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px;border-bottom:1px solid var(--psd-border);background:rgba(248,250,252,.94);font-size:12px;font-weight:800}
|
|
114
|
+
.psd-layer-list{margin:0;padding:8px;list-style:none}
|
|
115
|
+
.psd-layer{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:start;margin:0 0 6px;padding:8px;border:1px solid transparent;border-radius:8px;background:#fff}
|
|
116
|
+
.psd-layer:hover{border-color:rgba(15,118,110,.24)}
|
|
117
|
+
.psd-layer input{margin-top:2px;accent-color:var(--psd-accent)}
|
|
118
|
+
.psd-layer strong{display:block;overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}
|
|
119
|
+
.psd-layer span{display:block;margin-top:3px;color:var(--psd-muted);font-size:11px}
|
|
120
|
+
.psd-stage{min-width:0;min-height:0;overflow:auto;padding:28px}
|
|
121
|
+
.psd-canvas-wrap{display:inline-block;transform-origin:top left;transition:transform .18s ease}
|
|
122
|
+
.psd-canvas-shell{display:inline-block;padding:18px;border:1px solid var(--psd-border);border-radius:8px;background:
|
|
123
|
+
linear-gradient(45deg,#e5e7eb 25%,transparent 25%),
|
|
124
|
+
linear-gradient(-45deg,#e5e7eb 25%,transparent 25%),
|
|
125
|
+
linear-gradient(45deg,transparent 75%,#e5e7eb 75%),
|
|
126
|
+
linear-gradient(-45deg,transparent 75%,#e5e7eb 75%);
|
|
127
|
+
background-color:#fff;background-position:0 0,0 10px,10px -10px,-10px 0;background-size:20px 20px;box-shadow:0 18px 48px rgba(15,23,42,.14)}
|
|
128
|
+
.psd-canvas-shell canvas{display:block;max-width:none;background:transparent}
|
|
129
|
+
.psd-empty{padding:20px;color:var(--psd-muted);font-weight:700}
|
|
130
|
+
.file-viewer[data-viewer-theme='dark'] .psd-viewer{--psd-bg:#0d1117;--psd-surface:#161b22;--psd-border:rgba(139,148,158,.24);--psd-text:#e6edf3;--psd-muted:#8b949e}
|
|
131
|
+
.file-viewer[data-viewer-theme='dark'] .psd-toolbar{background:rgba(13,17,23,.92)}
|
|
132
|
+
.file-viewer[data-viewer-theme='dark'] .psd-sidebar,.file-viewer[data-viewer-theme='dark'] .psd-sidebar-header{background:rgba(22,27,34,.92)}
|
|
133
|
+
.file-viewer[data-viewer-theme='dark'] .psd-layer,.file-viewer[data-viewer-theme='dark'] .psd-actions button{background:#161b22;color:#e6edf3}
|
|
134
|
+
@media (prefers-color-scheme:dark){.file-viewer[data-viewer-theme='system'] .psd-viewer{--psd-bg:#0d1117;--psd-surface:#161b22;--psd-border:rgba(139,148,158,.24);--psd-text:#e6edf3;--psd-muted:#8b949e}.file-viewer[data-viewer-theme='system'] .psd-toolbar{background:rgba(13,17,23,.92)}.file-viewer[data-viewer-theme='system'] .psd-sidebar,.file-viewer[data-viewer-theme='system'] .psd-sidebar-header{background:rgba(22,27,34,.92)}.file-viewer[data-viewer-theme='system'] .psd-layer,.file-viewer[data-viewer-theme='system'] .psd-actions button{background:#161b22;color:#e6edf3}}
|
|
135
|
+
@media (max-width:760px){.psd-layout{grid-template-columns:1fr}.psd-sidebar{max-height:240px;border-right:0;border-bottom:1px solid var(--psd-border)}.psd-stage{padding:14px}}
|
|
136
|
+
`,it=(t,r,s,a)=>{const c=t.createElement(r);return s&&(c.className=s),typeof a=="string"&&(c.textContent=a),c},jo=t=>{const r=t.createElement("style");return r.textContent=zo,r},yi=(t,r)=>{if(!r)return;const s=t.defaultView||(typeof window<"u"?window:void 0);if(s&&r instanceof s.HTMLCanvasElement)return r;if(s&&r instanceof s.ImageData){const a=t.createElement("canvas");return a.width=r.width,a.height=r.height,a.getContext("2d")?.putImageData(r,0,0),a}if(typeof r=="object"&&"data"in r&&"width"in r&&"height"in r){const a=r,c=t.createElement("canvas");c.width=a.width,c.height=a.height;const l=new Uint8ClampedArray(a.data.length);l.set(a.data);const h=s?.ImageData||ImageData;return c.getContext("2d")?.putImageData(new h(l,a.width,a.height),0,0),c}},wi=(t,r,s=0,a="")=>Array.isArray(r)?r.flatMap((c,l)=>{const h=String(c.name||`Layer ${l+1}`),o=`${a}${l}`,S=yi(t,c.canvas||c.imageData);return[{id:o,name:h,depth:s,left:Number(c.left||0),top:Number(c.top||0),width:Math.max(0,Number(c.right||0)-Number(c.left||0)),height:Math.max(0,Number(c.bottom||0)-Number(c.top||0)),hidden:!!c.hidden,canvas:S},...wi(t,c.children,s+1,`${o}.`)]}):[],Vo=t=>Math.min(4,Math.max(.1,Number(t.toFixed(2))))})),kc=xr({default:()=>Tc});async function Tc(t,r,s="bin",a){const c=r.ownerDocument||document,l=s.toLowerCase(),h=Tn(a?.options);if(l==="ai"&&an(t,5)==="%PDF-"&&a?.renderNestedBuffer){const S=await a.renderNestedBuffer(t,"pdf",r,a);if(S)return S}if(l==="psd"){const{default:S}=await Promise.resolve().then(()=>(Ic(),Ec));return S(t,r,a)}const o=ns(c,await es(c,t,l,a,h),l,h);return r.replaceChildren(qo(c),o),{$el:o,unmount(){r.replaceChildren()}}}var Go,Ho,qo,dt,Fr,fr,nn,an,Wo,$o,Zo,Yo,Xo,Jo,Ko,Qo,es,ts,rs,ns,Pc=Ze((()=>{Oi(),Rn(),Go=`
|
|
137
|
+
.data-viewer{min-height:100%;padding:28px;background:#eef1f4;color:#132235}
|
|
138
|
+
.data-card{max-width:1080px;margin:0 auto;overflow:hidden;border:1px solid rgba(15,23,42,.08);border-radius:8px;background:#fff;box-shadow:0 18px 48px rgba(15,23,42,.12)}
|
|
139
|
+
.data-header{padding:20px 24px;border-bottom:1px solid rgba(15,23,42,.08)}
|
|
140
|
+
.data-header span{color:#0f766e;font-size:12px;font-weight:800}
|
|
141
|
+
.data-header h2{margin:6px 0 0;font-size:24px}
|
|
142
|
+
.data-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1px;background:rgba(15,23,42,.08)}
|
|
143
|
+
.data-summary div{min-width:0;padding:15px 18px;background:#f8fafc}
|
|
144
|
+
.data-summary span{display:block;color:#64748b;font-size:12px}
|
|
145
|
+
.data-summary strong{display:block;margin-top:5px;overflow:hidden;color:#132235;font-size:15px;text-overflow:ellipsis;white-space:nowrap}
|
|
146
|
+
.font-preview{padding:34px 28px;border-top:1px solid rgba(15,23,42,.08);font-size:42px;line-height:1.45;word-break:break-word}
|
|
147
|
+
.asset-image{padding:24px;border-top:1px solid rgba(15,23,42,.08);background:#f8fafc;text-align:center}
|
|
148
|
+
.asset-image img{max-width:100%;max-height:70vh;box-shadow:0 10px 30px rgba(15,23,42,.16)}
|
|
149
|
+
.asset-text{margin:0;padding:18px 24px;overflow:auto;border-top:1px solid rgba(15,23,42,.08);background:#111827;color:#e5e7eb;font-size:13px;line-height:1.7}
|
|
150
|
+
.data-table-wrap{max-height:520px;overflow:auto;border-top:1px solid rgba(15,23,42,.08)}
|
|
151
|
+
.data-table{width:100%;border-collapse:collapse;font-size:13px}
|
|
152
|
+
.data-table th,.data-table td{max-width:260px;padding:10px 12px;border-bottom:1px solid rgba(15,23,42,.08);overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}
|
|
153
|
+
.data-table th{position:sticky;top:0;background:#f8fafc;color:#64748b;z-index:1}
|
|
154
|
+
`,Ho={otf:"font/otf",ttf:"font/ttf",woff:"font/woff",woff2:"font/woff2"},qo=t=>{const r=t.createElement("style");return r.textContent=Go,r},dt=(t,r,s,a)=>{const c=t.createElement(r);return s&&(c.className=s),a!==void 0&&(c.textContent=a),c},Fr=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`,fr=t=>t.slice(0,30).map(r=>{const s={};return Object.entries(r).slice(0,24).forEach(([a,c])=>{typeof c=="bigint"?s[a]=c.toString():c instanceof Uint8Array?s[a]=`[bytes:${c.byteLength}]`:c&&typeof c=="object"?s[a]=JSON.stringify(c).slice(0,180):s[a]=c}),s}),nn=(t,r=8e3)=>{const s=new Uint8Array(t);return Array.from(s.slice(0,Math.min(s.length,r))).map(a=>a>=32&&a<=126||a===10||a===13||a===9?String.fromCharCode(a):" ").join("").replace(/[ \t]{3,}/g," ").trim().slice(0,r)},an=(t,r=12)=>String.fromCharCode(...new Uint8Array(t.slice(0,r))),Wo=t=>t.defaultView?.__FLYFISH_DATA_SQL_WASM_URL__||(typeof window<"u"?window.__FLYFISH_DATA_SQL_WASM_URL__:void 0),$o=async(t,r,s,a)=>{const c=`FlyfishPreviewFont-${Date.now()}-${Math.random().toString(36).slice(2)}`,l=(t.defaultView||(typeof window<"u"?window:void 0))?.FontFace||(typeof FontFace<"u"?FontFace:void 0);if(!l)throw new Error(a("data.error.fontFaceUnsupported"));const h=new l(c,r);return await h.load(),t.fonts?.add(h),{title:a("data.title.font"),fontFamily:c,summary:[{label:a("data.label.format"),value:s.toUpperCase()},{label:a("data.label.size"),value:Fr(r.byteLength)},{label:a("data.label.rendering"),value:"Browser FontFace API"}]}},Zo=async(t,r,s,a)=>{const{default:c}=await Promise.resolve().then(()=>vn(ol(),1)),l=Ci(s?.options?.data,[Wo(t)],t.baseURI),h=new(await c({locateFile:()=>l})).Database(new Uint8Array(r));try{const o=h.exec("select name, type from sqlite_master where type in ('table','view') and name not like 'sqlite_%' order by type, name")[0]?.values||[],S=String(o[0]?.[0]||""),D=S?h.exec(`select * from "${S.replace(/"/g,'""')}" limit 30`)[0]:null;return{title:a("data.title.sqlite"),summary:[{label:a("data.label.objects"),value:String(o.length)},{label:a("data.label.sampleTable"),value:S||"-"},{label:a("data.label.rendering"),value:"sql.js WASM"}],rows:fr(D?D.values.map(U=>Object.fromEntries(D.columns.map((M,_)=>[M,U[_]]))):o.map(U=>({name:U[0],type:U[1]})))}}finally{h.close()}},Yo=async(t,r)=>{const{parquetMetadataAsync:s,parquetReadObjects:a}=await Promise.resolve().then(()=>(fu(),cu)),c={byteLength:t.byteLength,slice:(o,S)=>t.slice(o,S)},l=await s(c),h=await a({file:c,rowFormat:"object",rowEnd:30});return{title:r("data.title.parquet"),summary:[{label:r("data.label.rows"),value:l.num_rows?.toString?.()||"-"},{label:r("data.label.columns"),value:String(l.schema?.filter(o=>o.name).length||0)},{label:r("data.label.rendering"),value:"hyparquet"}],rows:fr(h)}},Xo=async(t,r)=>{const s=(await Promise.resolve().then(()=>vn(ic(),1))).createBlobDecoder(new Blob([t])),a=[];let c="";return await new Promise((l,h)=>{s.on("metadata",o=>{c=o?.toString?.()||""}),s.on("data",o=>{a.length<30&&a.push(o)}),s.on("end",l),s.on("error",h)}),{title:r("data.title.avro"),summary:[{label:r("data.label.sampleRows"),value:String(a.length)},{label:"Schema",value:r(c?"data.value.schemaRead":"data.value.schemaUnread")},{label:r("data.label.rendering"),value:"avsc"}],rows:fr(a),text:c.slice(0,6e3)}},Jo=async(t,r)=>{const s=await WebAssembly.compile(t.slice(0)),a=WebAssembly.Module.imports(s),c=WebAssembly.Module.exports(s);return{title:r("data.title.wasm"),summary:[{label:r("data.label.imports"),value:String(a.length)},{label:r("data.label.exports"),value:String(c.length)},{label:r("data.label.rendering"),value:"WebAssembly.Module"}],rows:fr([...a.map(l=>({kind:"import",module:l.module,name:l.name,type:l.kind})),...c.map(l=>({kind:"export",module:"-",name:l.name,type:l.kind}))])}},Ko=async(t,r,s)=>({title:s(r==="eps"?"data.title.eps":"data.title.ai"),summary:[{label:s("data.label.magic"),value:an(t).replace(/\s/g," ")},{label:s("data.label.size"),value:Fr(t.byteLength)},{label:s("data.label.note"),value:s(r==="ai"?"data.note.aiSummary":"data.note.postscriptSummary")}],text:nn(t)}),Qo=async(t,r)=>({title:r("data.title.webarchive"),summary:[{label:r("data.label.container"),value:an(t).startsWith("bplist")?"Binary plist":"WebArchive"},{label:r("data.label.size"),value:Fr(t.byteLength)},{label:r("data.label.note"),value:r("data.note.webarchive")}],text:nn(t)}),es=async(t,r,s,a,c)=>s in Ho?$o(t,r,s,c):s==="sqlite"?Zo(t,r,a,c):s==="parquet"?Yo(r,c):s==="avro"?Xo(r,c):s==="wasm"?Jo(r,c):s==="ai"||s==="eps"?Ko(r,s,c):s==="webarchive"?Qo(r,c):{title:c("data.title.summary"),summary:[{label:c("data.label.format"),value:s.toUpperCase()},{label:c("data.label.size"),value:Fr(r.byteLength)}],text:nn(r)},ts=(t,r,s)=>{const a=dt(t,"div","data-summary");s.forEach(c=>{const l=dt(t,"div");l.append(dt(t,"span",void 0,c.label),dt(t,"strong",void 0,c.value)),a.appendChild(l)}),r.appendChild(a)},rs=(t,r,s)=>{if(!s?.length)return;const a=Object.keys(s[0]),c=dt(t,"div","data-table-wrap"),l=dt(t,"table","data-table"),h=dt(t,"thead"),o=dt(t,"tr");a.forEach(D=>{o.appendChild(dt(t,"th",void 0,D))}),h.appendChild(o);const S=dt(t,"tbody");s.forEach(D=>{const U=dt(t,"tr");a.forEach(M=>{U.appendChild(dt(t,"td",void 0,String(D[M]??"")))}),S.appendChild(U)}),l.append(h,S),c.appendChild(l),r.appendChild(c)},ns=(t,r,s,a)=>{const c=dt(t,"div","data-viewer"),l=dt(t,"section","data-card"),h=dt(t,"header","data-header");if(h.append(dt(t,"span",void 0,s.toUpperCase()),dt(t,"h2",void 0,r.title)),l.appendChild(h),ts(t,l,r.summary),r.fontFamily){const o=dt(t,"div","font-preview",a("data.font.sample"));o.style.fontFamily=r.fontFamily,l.appendChild(o)}if(r.image){const o=dt(t,"div","asset-image"),S=dt(t,"img");S.src=r.image,S.alt=a("data.image.alt"),o.appendChild(S),l.appendChild(o)}return r.text&&l.appendChild(dt(t,"pre","asset-text",r.text)),rs(t,l,r.rows),c.appendChild(l),c}}));Rn();var is=At.find(t=>t.id==="data-asset");if(!is)throw new Error("@file-viewer/renderer-data could not locate the shared data asset renderer definition.");var as=is,Fc=(t,r,s,a)=>Promise.resolve().then(()=>(Pc(),kc)).then(({default:c})=>c(t,r,s,a)),bi={id:"file-viewer-renderer-data",label:"Flyfish File Viewer data asset renderer",definitions:[as],handlers:[{rendererId:as.id,handler:Fc}]},os=globalThis,ss=os.FlyfishFileViewerWebFullRenderers||(os.FlyfishFileViewerWebFullRenderers={});ss.data=bi,ss[bi.id]=bi})();
|