From 59f7191a523e46c79f406c483e415fa702b235f5 Mon Sep 17 00:00:00 2001 From: RGBKnights Date: Tue, 10 Nov 2026 09:47:43 -0500 Subject: [PATCH 1/2] Accept raw media in Studio imports and exports --- docs/ARCHITECTURE.md | 2 +- .../api/studio/revisions/[id]/file/route.ts | 11 +- src/components/studio/AssetBridgeDialog.tsx | 12 +- .../studio/ImportDocumentDialog.tsx | 8 +- src/components/studio/ProjectWorkspace.tsx | 10 +- src/components/studio/StudioLibrary.tsx | 6 +- src/studio/mcp/runtime-release.json | 10 +- src/studio/package-store.ts | 6 +- src/studio/source-import.ts | 6 +- .../workstation-pixelcraft-release.json | 12 +- tests/asset-bridge-browser.test.mjs | 25 + tests/asset-package.test.ts | 3 + tests/native-import-browser.test.mjs | 11 +- tests/saved-file-route.test.mjs | 50 + tests/source-import.test.ts | 2 +- .../1.2.1-8acb4493e73b/BUBBLEWRAP-LICENSE.txt | 1506 + .../1.2.1-8acb4493e73b/BUBBLEWRAP-SOURCE.txt | 2 + .../bubblewrap-no-loopback.patch | 12 + .../1.2.1-8acb4493e73b/bwrap | Bin 0 -> 101304 bytes .../1.2.1-8acb4493e73b/studio-mcp.cjs | 40082 ++++++++++ .../0.19.0-48e90164aac9/configure-hermes.py | 240 + .../0.19.0-48e90164aac9/skills/pixelcraft.md | 43 + .../0.19.0-48e90164aac9/studio-mcp.cjs | 60329 ++++++++++++++++ 23 files changed, 102345 insertions(+), 43 deletions(-) create mode 100644 tests/saved-file-route.test.mjs create mode 100644 vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-LICENSE.txt create mode 100644 vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-SOURCE.txt create mode 100644 vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bubblewrap-no-loopback.patch create mode 100644 vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bwrap create mode 100644 vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/studio-mcp.cjs create mode 100644 vendor/robyn-workstation/0.19.0-48e90164aac9/configure-hermes.py create mode 100644 vendor/robyn-workstation/0.19.0-48e90164aac9/skills/pixelcraft.md create mode 100644 vendor/robyn-workstation/0.19.0-48e90164aac9/studio-mcp.cjs diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index c2aeba9..fa4bbe2 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -67,7 +67,7 @@ Assets also provides **Asset Bridge** for arbitrary files, complete local direct Asset Bridge uses the same owner-authorized BFF, immutable revisions and direct resumable Storage transfers as native packages. Creation and first revision reservation are atomic; an uncertain creation or commit response reuses the saved operation identity, including after selecting the same files again. The selection is checked in full before upload: at most 200 files, 512 MiB per file and 1 GiB total after extraction. ZIP extraction occurs locally in the browser with bounded streaming, verified CRC/size, portable relative paths and matching local/central records. Encrypted, split, ZIP64, symbolic-link and colliding-path ZIP inputs are refused before publication; unpack unsupported archives locally and upload the directory. Only the selected ZIP is expanded; nested archives remain original files. Ordinary file/folder selection can also preserve archive files without extraction. -[`upload-policy.ts`](../src/studio/upload-policy.ts) owns the shared executable/installer extension denylist. Browser intake and the BFF apply it to every incoming revision package, including paths in expanded application bundles and ZIP selections. Scripts, including MATLAB `.m`, and data remain allowed. A regression check covers every current Craft native format through the package validator. Craft-specific native imports and editor saves retain their format validation alongside this policy. Uploaded collections use attachment downloads and a neutral binary media type. Robyn reads them through the existing project-scoped `studio_list_assets` / `studio_open_asset` tools; workstation client 0.10.1 adds zero-byte collection materialization without weakening native/source validation. +[`upload-policy.ts`](../src/studio/upload-policy.ts) owns the shared executable/installer extension denylist. Browser intake and the BFF apply it to every incoming revision package, including paths in expanded application bundles and ZIP selections. Scripts, including MATLAB `.m`, and data remain allowed. A regression check covers every current Craft native format through the package validator. Craft-specific native imports and known source previews retain their format validation. Normal Import files sends unrecognized selections to Asset Bridge, which stores the originals with neutral binary types and attachment downloads. Native task exports use known media types when available and preserve unfamiliar formats as binary attachments under the same BFF upload policy. Robyn reads exact collections through the project-scoped `studio_list_assets` / `studio_open_asset` tools. ## Workstation jobs and browser control diff --git a/src/app/api/studio/revisions/[id]/file/route.ts b/src/app/api/studio/revisions/[id]/file/route.ts index 21fe2e7..fccc472 100644 --- a/src/app/api/studio/revisions/[id]/file/route.ts +++ b/src/app/api/studio/revisions/[id]/file/route.ts @@ -1,6 +1,7 @@ import { ApiError, handleError } from "@/lib/http"; -import { requireStudio, ownedRevision, dbFailure, STUDIO_BUCKET } from "@/studio/server"; +import { requireStudio, ownedRevision, dbFailure } from "@/studio/server"; import { validatePackagePath } from "@/studio/assets"; +import { signSavedFile } from "@/studio/package-store"; /** Authorize the exact file on every open/seek; bytes stay in private Storage. */ export async function GET(request: Request, context: { params: Promise<{ id: string }> }) { @@ -13,12 +14,10 @@ export async function GET(request: Request, context: { params: Promise<{ id: str let path: string; try { path = validatePackagePath(url.searchParams.get("path")); } catch { throw new ApiError(400, "invalid_path", "Choose a file from this saved revision."); } - const { data: file, error } = await db.from("studio_package_files").select("storage_key,path").eq("workspace_id", workspaceId).eq("revision_id", id).eq("path", path).maybeSingle(); + const { data: file, error } = await db.from("studio_package_files").select("storage_key,path,mime_type").eq("workspace_id", workspaceId).eq("revision_id", id).eq("path", path).maybeSingle(); dbFailure(error); if (!file) throw new ApiError(404, "not_found", "Saved file not found."); - const { data, error: storageError } = await db.storage.from(STUDIO_BUCKET).createSignedUrl(file.storage_key, 300, - url.searchParams.get("inline") === "1" ? undefined : { download: file.path.split("/").pop() }); - if (storageError || !data) throw new ApiError(503, "storage_unavailable", "The file could not be opened. Try again shortly."); - return new Response(null, { status: 307, headers: { Location: data.signedUrl, "Cache-Control": "private, no-store" } }); + const signedUrl = await signSavedFile(db, file, url.searchParams.get("inline") === "1"); + return new Response(null, { status: 307, headers: { Location: signedUrl, "Cache-Control": "private, no-store" } }); } catch (error) { return handleError(error); } } diff --git a/src/components/studio/AssetBridgeDialog.tsx b/src/components/studio/AssetBridgeDialog.tsx index 08bc8a9..d06e8b6 100644 --- a/src/components/studio/AssetBridgeDialog.tsx +++ b/src/components/studio/AssetBridgeDialog.tsx @@ -7,13 +7,21 @@ import {BLOCKED_UPLOAD_EXTENSIONS} from "@/studio/upload-policy"; import {describeLocalPackage,digestFile,savePackage,type LocalPackageFile,type SaveResult} from "@/studio/transfer-client"; import {StudioDialog} from "./StudioDialog"; -export function AssetBridgeDialog({projectId,close,saved,returnFocusRef}:{projectId:string;close:()=>void;saved:(result:SaveResult)=>Promise;returnFocusRef:React.RefObject}) { +export interface BridgeSelection { files: File[]; mode: "files" | "folder" } + +export function AssetBridgeDialog({projectId,close,saved,returnFocusRef,initialSelection}:{projectId:string;close:()=>void;saved:(result:SaveResult)=>Promise;returnFocusRef:React.RefObject;initialSelection?:BridgeSelection}) { const [files,setFiles]=useState([]),[name,setName]=useState(""); const [busy,setBusy]=useState(false),[locked,setLocked]=useState(false),[error,setError]=useState(""); const [status,setStatus]=useState(""),[progress,setProgress]=useState(0); const filePicker=useRef(null),folderPicker=useRef(null),archivePicker=useRef(null); const controller=useRef(null),running=useRef(false),pending=useRef<{id:string;name:string;key:string}|null>(null); - useEffect(()=>()=>controller.current?.abort(),[]); + const initial=useRef(initialSelection); + useEffect(()=>{ + const selection=initial.current; + initial.current=undefined; + if(selection)void choose(selection.files,selection.mode); + return()=>controller.current?.abort(); + },[]); async function choose(selected:File[],mode:"files"|"folder"|"archive") { if(!selected.length||running.current||pending.current)return; diff --git a/src/components/studio/ImportDocumentDialog.tsx b/src/components/studio/ImportDocumentDialog.tsx index 0b1801b..91c2f69 100644 --- a/src/components/studio/ImportDocumentDialog.tsx +++ b/src/components/studio/ImportDocumentDialog.tsx @@ -6,6 +6,7 @@ import {validatePackagePath,type AssetSummary} from "@/studio/assets"; import {checkNativeImport,importPath,importedDocumentName,nativeImportApp,nativeImportApps} from "@/studio/native-import"; import {sourceFormat,sourceImportFiles} from "@/studio/source-import"; import {savePackage,type LocalPackageFile,type SaveResult} from "@/studio/transfer-client"; +import {AssetBridgeDialog,type BridgeSelection} from "./AssetBridgeDialog"; import {StudioDialog} from "./StudioDialog"; interface ImportTask {id:string;name:string;appId:string|null;files:LocalPackageFile[];created?:boolean;result?:SaveResult} @@ -20,6 +21,7 @@ export function ImportDocumentDialog({projectId,initialFiles,folder=false,close, const [application,setApplication]=useState(""); const [busy,setBusy]=useState(false),[error,setError]=useState(""),[progress,setProgress]=useState(0),[status,setStatus]=useState(""); const [locked,setLocked]=useState(false),[completed,setCompleted]=useState(0); + const [bridgeSelection,setBridgeSelection]=useState(null); const started=useRef(false),running=useRef(false),tasks=useRef(null),controller=useRef(null); const extraFiles=useRef(null),folderPicker=useRef(null); const candidates=files.filter(file=>nativeImportApps(file.name).length),choices=nativeImportApps(master); @@ -29,7 +31,9 @@ export function ImportDocumentDialog({projectId,initialFiles,folder=false,close, async function run(selected:File[]=files,main:string=master,chosen:string=application) { if(running.current||!selected.length)return; if(!main&&!selected.every(file=>sourceFormat(file.name))){ - if(!selected.some(file=>nativeImportApp(file.name)))setError("No supported project was found. Choose a native Craft project, or supported images, audio and video."); + if(!selected.some(file=>nativeImportApps(file.name).length)){ + setBridgeSelection({files:selected,mode:selected.every(file=>file.webkitRelativePath)?"folder":"files"}); + } return; } const available=nativeImportApps(main); @@ -91,6 +95,8 @@ export function ImportDocumentDialog({projectId,initialFiles,folder=false,close, } useEffect(()=>{if(started.current)return;started.current=true;void run(initialFiles,master);},[]); + if(bridgeSelection)return ; + return {files.length>0&&

{master||files[0].name}{files.length>1&& · {files.length} files selected}

}

{sources?"Images, audio and video stay available across your project. We’ll save the originals in your project and library, then open a preview.":choices.length>1?"Choose the application for this file. Robyn keeps the original bytes and any linked files together.":"Robyn selects the Craft, keeps the original files and opens your saved project. Linked files stay together."}

diff --git a/src/components/studio/ProjectWorkspace.tsx b/src/components/studio/ProjectWorkspace.tsx index 7d106e8..7374fd1 100644 --- a/src/components/studio/ProjectWorkspace.tsx +++ b/src/components/studio/ProjectWorkspace.tsx @@ -21,8 +21,6 @@ import type { SaveResult } from "@/studio/transfer-client"; import type { EditorSaveResult } from "@/studio/editor-host"; import { UploadPackageDialog } from "./UploadPackageDialog"; import { ImportDocumentDialog } from "./ImportDocumentDialog"; -import { nativeImportApp } from "@/studio/native-import"; -import { sourceFormat } from "@/studio/source-import"; import { StudioDialog } from "./StudioDialog"; import { EmbeddedEditor, type EmbeddedEditorHandle, type EditorViewState } from "./EmbeddedEditor"; import { ProjectHeader } from "./ProjectHeader"; @@ -189,10 +187,10 @@ export function ProjectWorkspace({projectId,initialAssetId,initialRevisionId,ini const launcher=chooseFiles()} onFolder={()=>chooseFiles(true)} importButtonRef={importButton} employeesHref={employeesHref} compact={Boolean(asset)} mailcraftLinked={mailcraftLinked}/>; const importReturnFocus=asset?applicationsButton:importButton; const sourceMedia=Boolean(asset?.asset_kind&&asset.asset_kind!=="native"); + const rawFiles=asset?.asset_kind==="file"; const preview=sourceMedia?(packageData?.files.find(file=>file.role==="preview")??packageData?.files.find(file=>file.role==="export"&&file.mimeType.startsWith(`${asset?.asset_kind}/`))??packageData?.files.find(file=>file.role==="master")):packageData?.files.find(file=>file.role==="preview"); - const assetDetails = asset&&<>{packageData&&

{sourceMedia?"SOURCE MEDIA":"NATIVE PACKAGE"} {packageData.files.length} {packageData.files.length===1?"file":"files"}

{packageData.files.map(file=>{file.path}{file.role} · {(file.bytes/1024).toFixed(1)} KB)}{packageData.dependencies.length>0&&

{packageData.dependencies.length} exact saved {packageData.dependencies.length===1?"revision":"revisions"} linked to this package.

}{packageData.revision.state==="conflict"&&

This save is preserved separately because the asset changed while you were working.

}
} + const assetDetails = asset&&<>{packageData&&

{rawFiles?"UPLOADED FILES":sourceMedia?"SOURCE MEDIA":"NATIVE PACKAGE"} {packageData.files.length} {packageData.files.length===1?"file":"files"}

{packageData.files.map(file=>{file.path}{file.role} · {(file.bytes/1024).toFixed(1)} KB)}{packageData.dependencies.length>0&&

{packageData.dependencies.length} exact saved {packageData.dependencies.length===1?"revision":"revisions"} linked to this package.

}{packageData.revision.state==="conflict"&&

This save is preserved separately because the asset changed while you were working.

}
} {history&&

Saved revisions

{revisionCursor&&}{revisions.length?revisions.map(revision=>
{revision.state==="committed"&&revision.id!==asset.current_revision_id&&}{revision.state==="conflict"&&}{revision.state==="uploading"&&}
):

The first saved revision will appear here.

}
}; - const simpleImport=intake&&(intake.folder||intake.files.some(file=>nativeImportApp(file.name))||intake.files.every(file=>sourceFormat(file.name))); const hasEditor=Boolean((editorUrl||asset?.app_id==="research")&&targetRevision); const statusLabel=editorState.error?"Needs attention":app?.editor.mode==="readOnly"?"Read only":/conflict/i.test(editorState.status)?"Conflict preserved":/opening/i.test(editorState.status)?"Opening…":editorState.dirty?(/upload|hash|confirm|prepar|saving/i.test(editorState.status)?"Saving…":"Unsaved"):"Saved"; return
@@ -220,7 +218,7 @@ export function ProjectWorkspace({projectId,initialAssetId,initialRevisionId,ini
} } {!asset?
{launcher}
:<> - {asset.app_id==="research"&&targetRevision?{editorDirty.current=dirty;}} onSaved={editorSaved} onRequest={()=>{window.open(`${employeesHref}&view=jobs`,"_blank","noopener");}}/>:editorUrl&&targetRevision?{void reload().catch(error=>setError(error.message));}} onState={setEditorState} key={editorEpoch} projectId={projectId} initialRef={{assetId:asset.id,revisionId:targetRevision}} bundleUrl={editorUrl} readOnly={app?.editor.mode==="readOnly"} name={app?.name??"Creative"} onSaved={editorSaved} onDirty={dirty=>{editorDirty.current=dirty;}}/>:!canOpenAsset?

{asset.name}

{mailcraftLinked === null ? "Checking connected mail…" : {MAILCRAFT_LOCKED}}

:opening?

Opening the native package…

:
{sourceMedia&&
{asset.name}

Saved as reusable source media. Use Place from studio in a compatible Craft to add it to your work.

file.role==="master")?.path??preview?.path??"")}>Download original
}{preview?.mimeType.startsWith("image/")?:preview&&(preview.mimeType.startsWith("video/")||preview.mimeType.startsWith("audio/"))?:

{asset.name}

{packageData?"Your native package is saved.":"Import the native master to create its first saved revision."}

{app?.editor.status==="verified"?"The browser editor is ready to connect.":`${app?.name}'s browser integration is being prepared.`}

}
} + {asset.app_id==="research"&&targetRevision?{editorDirty.current=dirty;}} onSaved={editorSaved} onRequest={()=>{window.open(`${employeesHref}&view=jobs`,"_blank","noopener");}}/>:editorUrl&&targetRevision?{void reload().catch(error=>setError(error.message));}} onState={setEditorState} key={editorEpoch} projectId={projectId} initialRef={{assetId:asset.id,revisionId:targetRevision}} bundleUrl={editorUrl} readOnly={app?.editor.mode==="readOnly"} name={app?.name??"Creative"} onSaved={editorSaved} onDirty={dirty=>{editorDirty.current=dirty;}}/>:!canOpenAsset?

{asset.name}

{mailcraftLinked === null ? "Checking connected mail…" : {MAILCRAFT_LOCKED}}

:opening?

Opening the saved files…

:rawFiles?
{assetDetails}
:
{sourceMedia&&
{asset.name}

Saved as reusable source media. Use Place from studio in a compatible Craft to add it to your work.

file.role==="master")?.path??preview?.path??"")}>Download original
}{preview?.mimeType.startsWith("image/")?:preview&&(preview.mimeType.startsWith("video/")||preview.mimeType.startsWith("audio/"))?:

{asset.name}

{packageData?"Your native package is saved.":"Import the native master to create its first saved revision."}

{app?.editor.status==="verified"?"The browser editor is ready to connect.":`${app?.name}'s browser integration is being prepared.`}

}
} {fileDetails&&{setFileDetails(false);setHistory(false);}} returnFocusRef={documentMenuButton}>{assetDetails}} } @@ -231,7 +229,7 @@ export function ProjectWorkspace({projectId,initialAssetId,initialRevisionId,ini if(select(report.id)){setFocusedRevision({assetId:report.id,revisionId:report.current_revision_id});setReadOnlyApplication("");} }}/>} {upload&&setUpload(null)} saved={saved} returnFocusRef={upload==="revision"?documentMenuButton:importReturnFocus}/>} - {intake&&(simpleImport?{setIntake(null);void reload().catch(error=>setError(error.message));}} saved={saved} returnFocusRef={importReturnFocus}/>:setIntake(null)} saved={saved} returnFocusRef={importReturnFocus}/>)} + {intake&&{setIntake(null);void reload().catch(error=>setError(error.message));}} saved={saved} returnFocusRef={importReturnFocus}/>} {fork&&setFork(null)} busy={busy}>

The native package and exact dependencies will be preserved in a new asset.

{error&&

{error}

}
} ; } diff --git a/src/components/studio/StudioLibrary.tsx b/src/components/studio/StudioLibrary.tsx index bdb81e4..9696237 100644 --- a/src/components/studio/StudioLibrary.tsx +++ b/src/components/studio/StudioLibrary.tsx @@ -5,13 +5,10 @@ import Link from "next/link"; import {Search,ArrowUpRight,Upload,FolderOpen,Images,LayoutGrid,List} from "lucide-react"; import {studioTools} from "@/studio/tools"; import type {AssetSummary,ProjectSummary} from "@/studio/assets"; -import {nativeImportApp} from "@/studio/native-import"; -import {sourceFormat} from "@/studio/source-import"; import {apiFetch} from "@/lib/api"; import {AppIcon} from "./AppIcon"; import {usePagedStudioList} from "./usePagedStudioList"; import {ImportDocumentDialog} from "./ImportDocumentDialog"; -import {UploadPackageDialog} from "./UploadPackageDialog"; import {MediaPanel} from "./MediaPanel"; import {ProjectSection} from "./ProjectSection"; import {AssetBridgeDialog} from "./AssetBridgeDialog"; @@ -45,7 +42,6 @@ function ProjectLibrary({project}:{project:ProjectSummary}) { setMedia({projectId:id,assets}); }catch(reason){setMediaError((reason as Error).message);}finally{setLoadingMedia(false);} } - const simple=intake&&(intake.folder||intake.files.some(file=>nativeImportApp(file.name))||intake.files.every(file=>sourceFormat(file.name))); return
YOUR PROJECT LIBRARY

Assets.

Bring files in. Keep your versions together. Take your work anywhere.

@@ -66,7 +62,7 @@ function ProjectLibrary({project}:{project:ProjectSummary}) {

{asset.name}

{asset.project?.name??project?.name??"Project"}

{app?.name??(asset.asset_kind==="file"?"Files & folders":`${asset.asset_kind} source`)} · {asset.current_revision_id?"Saved":"Awaiting first save"}
;})}
:

{search||kind||appId?"No matching assets.":"Make room for your next idea."}

{search||kind||appId?"Try another search or filter.":"Import native projects, images, audio or video. Open an asset to rename it, manage versions or download its files."}

} {library.nextCursor&&} - {intake&&(simple?{setIntake(null);void library.reload();}} saved={imported} returnFocusRef={importButton}/>:setIntake(null)} saved={imported} returnFocusRef={importButton}/>)} + {intake&&{setIntake(null);void library.reload();}} saved={imported} returnFocusRef={importButton}/>} {bridge&&setBridge(false)} saved={async()=>{await library.reload();setBridge(false);setNotice("All files are saved in your private library and available to Robyn.");}} returnFocusRef={bridgeButton}/>} {media&&setMedia(null)} onSaved={async()=>{await library.reload();await showMedia(media.projectId);}} onOpen={async ref=>{window.location.assign(`/dashboard/projects/${projectId}/library/${ref.assetId}?revision=${ref.revisionId}`);}}/>}
; diff --git a/src/studio/mcp/runtime-release.json b/src/studio/mcp/runtime-release.json index 6e782e5..b0fd0e1 100644 --- a/src/studio/mcp/runtime-release.json +++ b/src/studio/mcp/runtime-release.json @@ -1,7 +1,7 @@ { - "version": "1.2.0", - "fingerprint": "ef686b08822830ca863a899ab38d1c67c4a3c8718b9c096de33bf8e3f24181e2", - "directory": "vendor/robyn-mcp-workstation/1.2.0-ef686b088228", + "version": "1.2.1", + "fingerprint": "8acb4493e73b5bd61d6572f7bf37c8283d2671c1aa803e04138681150a0bc507", + "directory": "vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b", "applications": [ "bimcraft", "cadcraft", @@ -39,8 +39,8 @@ ], "files": { "studio-mcp.cjs": { - "bytes": 1560503, - "sha256": "053e4725a59dd327b70744da0f72f0e4b6a3dd5d9ea4b1613b368e91043712e1" + "bytes": 1565316, + "sha256": "f5b726ff7f0c42d9f08b39771f5f3f71d50fb8e68f236bed63fbbfee92b1a171" }, "bwrap": { "bytes": 101304, diff --git a/src/studio/package-store.ts b/src/studio/package-store.ts index 54046bc..cd877b0 100644 --- a/src/studio/package-store.ts +++ b/src/studio/package-store.ts @@ -5,9 +5,11 @@ import { ownedRevision, revisionFiles, mapInBatches, verifyStoredFiles, dbFailur export const savedDownloadSeconds = 300; -export async function signSavedFile(db: DB, file: Pick, inline = false) { +export async function signSavedFile(db: DB, file: Pick, inline = false) { + // Opaque uploads and exports stay downloads even when a caller asks to preview them. + const preview = inline && /^(image|audio|video)\//.test(file.mime_type); const { data, error } = await db.storage.from(STUDIO_BUCKET).createSignedUrl(file.storage_key, savedDownloadSeconds, - inline ? undefined : { download: file.path.split("/").pop() }); + preview ? undefined : { download: file.path.split("/").pop() }); if (error || !data) throw new ApiError(503, "storage_unavailable", "The package could not be opened. Please retry."); return data.signedUrl; } diff --git a/src/studio/source-import.ts b/src/studio/source-import.ts index 5fe45f7..efbdeac 100644 --- a/src/studio/source-import.ts +++ b/src/studio/source-import.ts @@ -10,7 +10,8 @@ const formats: Record = { }; export function sourceFormat(filename: string) { - const format = formats[filename.split(".").pop()?.toLowerCase() ?? ""]; + const extension = /\.([^./]+)$/.exec(filename)?.[1].toLowerCase() ?? ""; + const format = Object.hasOwn(formats, extension) ? formats[extension] : undefined; return format ? {kind:format[0], mimeType:format[1]} : null; } @@ -43,7 +44,8 @@ export async function sourceImportFiles(file:File) { if(!format||!file.size||file.size>256*1024**2)throw Error("Choose a supported image, audio or video file up to 256 MiB."); const head=new Uint8Array(await file.slice(0,512).arrayBuffer()); const ascii=(offset:number,value:string)=>hasAscii(head,offset,value); - const rasterFormat=sourceFormat(rasterImageExtension(head)??""); + const rasterExtension=rasterImageExtension(head); + const rasterFormat=rasterExtension?sourceFormat(`image.${rasterExtension}`):null; // Catch accidental renames before writing. This is a container signature // check; the chosen Craft still determines supported media codecs/content. const valid:Record={ diff --git a/src/studio/workstation-pixelcraft-release.json b/src/studio/workstation-pixelcraft-release.json index 08f7d08..df42f08 100644 --- a/src/studio/workstation-pixelcraft-release.json +++ b/src/studio/workstation-pixelcraft-release.json @@ -1,15 +1,15 @@ { - "version": "0.18.0", - "directory": "vendor/robyn-workstation/0.18.0-19ac70f24555", - "fingerprint": "19ac70f2455555fd1ff26c6045d21dbe319270cbe59be0f913ab376bdbb653e6", + "version": "0.19.0", + "directory": "vendor/robyn-workstation/0.19.0-48e90164aac9", + "fingerprint": "48e90164aac9cb06e7fcfc661bfb94345eaa7607b888dc712705177c04712ca4", "files": { "studio-mcp.cjs": { - "bytes": 2358030, - "sha256": "47126392337e4b4aa086f0cc28eb4d2f91cc69aacf17d75a0b8d7efbd5b7aa23" + "bytes": 2358054, + "sha256": "2950f5e175f8023d4622ffe58af8e4f6a19b2cff6b45e4b34450f349d0b068df" }, "configure-hermes.py": { "bytes": 11962, - "sha256": "657bc3eb96d3f15aecd6038a41b35466e7a9cf23f694f33d094e62bc6fa224d0" + "sha256": "905f14a8c53213bdf67dd5c88bdb07924f8e005a1970619edd7e9b631588f93a" }, "skills/pixelcraft.md": { "bytes": 2682, diff --git a/tests/asset-bridge-browser.test.mjs b/tests/asset-bridge-browser.test.mjs index 965465f..8b6188c 100644 --- a/tests/asset-bridge-browser.test.mjs +++ b/tests/asset-bridge-browser.test.mjs @@ -11,6 +11,31 @@ import {extractBridgeZip} from '../src/studio/archive-import.ts'; const browsers=process.env.BRIDGE_TEST_BROWSERS?.split(',')??['chromium']; async function openBridge(page){await page.getByRole('button',{name:'Asset Bridge',exact:true}).click();await page.getByRole('dialog').waitFor();} +test('Import files preserves unfamiliar raw media and refuses executables before saving',async()=>{ + const browser=await chromium.launch({headless:true}); + try { + const {page,state}=await nativeImportFixture(browser,{initialPath:`/dashboard/projects/${projectId}/library`}); + const picker=page.getByLabel('Import assets',{exact:true}); + const raw=Buffer.from([0,118,47,49,128,255]); + await picker.setInputFiles([ + {name:'render.exr',mimeType:'application/octet-stream',buffer:raw}, + {name:'setup.EXE',mimeType:'application/octet-stream',buffer:Buffer.from('blocked')}, + ]); + await page.getByRole('alert').filter({hasText:'Blocked: setup.EXE'}).waitFor(); + assert.equal(state.requests.filter(request=>request.method==='POST').length,0); + await page.keyboard.press('Escape'); + await picker.setInputFiles({name:'render.exr',mimeType:'application/octet-stream',buffer:raw}); + await page.getByRole('button',{name:'Upload all files',exact:true}).click(); + await page.getByText('Your files are saved in the asset library.',{exact:true}).waitFor(); + const asset=[...state.assets.values()][0],revision=[...state.revisions.values()][0]; + assert.equal(asset.asset_kind,'file'); + assert.equal(asset.app_id,null); + assert.equal(revision.package.files[0].mimeType,'application/octet-stream'); + assert.deepEqual(state.bytes.get(revision.id+'/render.exr'),raw); + assert.deepEqual(state.errors,[]); + }finally{await browser.close();} +}); + test('directory upload preserves every file and resumes unknown creation and commit replies without duplicates',async()=>{ const browser=await chromium.launch({headless:true}),parent=resolve(tmpdir()),folder=await mkdtemp(join(parent,'robyn-bridge-')); try{ diff --git a/tests/asset-package.test.ts b/tests/asset-package.test.ts index 30a9966..3494bc4 100644 --- a/tests/asset-package.test.ts +++ b/tests/asset-package.test.ts @@ -8,6 +8,9 @@ test("native package paths remain relative and portable across browser and works const file={path:"master.native",role:"master",bytes:42,mimeType:"application/octet-stream",sha256:"a".repeat(64)}; const pkg={files:[file],dependencies:[],message:"Native save"}; assert.equal(validateRevisionPackage(pkg).files.length,1); + const output={...file,path:"exports/camera-original.dng",role:"export"}; + assert.deepEqual(validateRevisionPackage({...pkg,files:[file,output]}).files[1],output); + assert.throws(()=>validateRevisionPackage({...pkg,files:[file,{...output,path:"exports/Setup.EXE"}]}),/Executable files/); assert.throws(()=>validateRevisionPackage({...pkg,files:[file,{...file,path:"MASTER.native",role:"dependency"}]}),/unique/); assert.throws(()=>validateRevisionPackage({...pkg,files:[{...file,role:"preview"}]}),/native master/); assert.throws(()=>validateRevisionPackage({...pkg,dependencies:[{assetId:"latest",revisionId:"latest"}]}),/Invalid/); diff --git a/tests/native-import-browser.test.mjs b/tests/native-import-browser.test.mjs index 8366d55..c33489a 100644 --- a/tests/native-import-browser.test.mjs +++ b/tests/native-import-browser.test.mjs @@ -92,16 +92,15 @@ test('PDF import requires an explicit Craft and preserves that choice through an }finally{await browser.close();} }); -test('unrecognised and mixed files stay editable in the detailed import without starting a save',async()=>{ +test('unrecognised files route to Asset Bridge and native project choices stay intact',async()=>{ const browser=await browserType.launch({headless:true}); try{ const {page,state}=await nativeImportFixture(browser); await dropDocument(page,'Slides.odp','Unsupported transport fixture'); - await page.getByRole('dialog').waitFor(); - assert.match(await page.getByRole('status').innerText(),/recognised/); - assert.equal(await page.getByLabel('Application',{exact:true}).inputValue(),''); - assert.equal(await page.getByLabel('Native master',{exact:true}).inputValue(),'Slides.odp'); - assert.equal(await page.getByRole('button',{name:'Save native package'}).isDisabled(),true); + await page.getByLabel('Upload name',{exact:true}).waitFor(); + assert.equal(await page.getByLabel('Upload name',{exact:true}).inputValue(),'Slides.odp'); + assert.equal(await page.getByLabel('Application',{exact:true}).count(),0); + assert.equal(await page.getByRole('button',{name:'Upload all files'}).isEnabled(),true); assert.equal(state.assets.size,0); await page.keyboard.press('Escape'); await page.getByRole('button',{name:'Open existing files',exact:true}).and(page.locator(':focus')).waitFor(); diff --git a/tests/saved-file-route.test.mjs b/tests/saved-file-route.test.mjs new file mode 100644 index 0000000..5df8e46 --- /dev/null +++ b/tests/saved-file-route.test.mjs @@ -0,0 +1,50 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import {httpMock,loadModule} from "./helpers/module.mjs"; + +test("opaque library files download even when inline is requested",async()=>{ + const tickets=[]; + const files=new Map([ + ["render.exr",{storage_key:"workspace/raw",path:"render.exr",mime_type:"application/octet-stream"}], + ["loop.gif",{storage_key:"workspace/gif",path:"loop.gif",mime_type:"image/gif"}], + ]); + globalThis.__savedFileFixture={ + from(table){ + assert.equal(table,"studio_package_files"); + const filters={}; + return { + select(){return this;}, + eq(key,value){filters[key]=value;return this;}, + async maybeSingle(){ + assert.equal(filters.workspace_id,"workspace"); + assert.equal(filters.revision_id,"revision"); + return {data:files.get(filters.path),error:null}; + }, + }; + }, + storage:{from(bucket){ + assert.equal(bucket,"private"); + return {async createSignedUrl(key,seconds,options){ + tickets.push({key,seconds,options}); + return {data:{signedUrl:"https://storage.example/saved"},error:null}; + }}; + }}, + }; + const server=` + export const STUDIO_BUCKET="private"; + export const requireStudio=async()=>({db:globalThis.__savedFileFixture,workspaceId:"workspace"}); + export const ownedRevision=async()=>({state:"committed"}); + export const dbFailure=error=>{if(error)throw error;}; + export const revisionFiles=()=>[],mapInBatches=()=>[],verifyStoredFiles=()=>[]; + `; + try{ + const {GET}=await loadModule("../../src/app/api/studio/revisions/[id]/file/route.ts",{ + "server-only":"","@/lib/http":httpMock,"@/studio/server":server,"./server":server, + }); + const open=(path,inline)=>GET(new Request(`https://studio.example/file?${new URLSearchParams({path,inline})}`),{params:Promise.resolve({id:"revision"})}); + assert.equal((await open("render.exr","1")).status,307); + assert.equal((await open("loop.gif","1")).status,307); + assert.equal((await open("loop.gif","0")).status,307); + assert.deepEqual(tickets.map(ticket=>ticket.options),[{download:"render.exr"},undefined,{download:"loop.gif"}]); + }finally{delete globalThis.__savedFileFixture;} +}); diff --git a/tests/source-import.test.ts b/tests/source-import.test.ts index 2a689be..6a9a3f6 100644 --- a/tests/source-import.test.ts +++ b/tests/source-import.test.ts @@ -21,7 +21,7 @@ test("common files stay reusable sources with exact originals and honest media t assert.throws(()=>validateSourcePackage({...pkg,files:pkg.files.map(f=>({...f,mimeType:"text/html"}))}),/supported/); if(pkg.files.length>1)assert.throws(()=>validateSourcePackage({...pkg,files:pkg.files.map((f,i)=>i?{...f,sha256:"f".repeat(64)}:f)}),/preserve/); } - for(const name of ["file.psd","file.pptx","file.docx","file.exe","file.html"])assert.equal(sourceFormat(name),null); + for(const name of ["file.psd","file.pptx","file.docx","file.exe","file.html","png","file.constructor"])assert.equal(sourceFormat(name),null); await assert.rejects(sourceImportFiles(new File(['not PNG'],'fake.png')),/contents do not match/); await assert.rejects(sourceImportFiles(new File([''],'external.svg')),/standalone SVG/); }); diff --git a/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-LICENSE.txt b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-LICENSE.txt new file mode 100644 index 0000000..5bf559a --- /dev/null +++ b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-LICENSE.txt @@ -0,0 +1,1506 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-SOURCE.txt b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-SOURCE.txt new file mode 100644 index 0000000..2949524 --- /dev/null +++ b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/BUBBLEWRAP-SOURCE.txt @@ -0,0 +1,2 @@ +https://codeload.github.com/containers/bubblewrap/tar.gz/refs/tags/v0.13.1 +b5cdc362b4bbe8906318ec68418de1fb050a8c6701534a81c0e94088ad74c22e diff --git a/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bubblewrap-no-loopback.patch b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bubblewrap-no-loopback.patch new file mode 100644 index 0000000..7bd904d --- /dev/null +++ b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bubblewrap-no-loopback.patch @@ -0,0 +1,12 @@ +--- a/bubblewrap.c ++++ b/bubblewrap.c +@@ -3245,8 +3245,7 @@ + switch_to_user_with_privs (); + +- if (opt_unshare_net) +- loopback_setup (); /* Will exit if unsuccessful */ ++ /* Direct Craft commands use a new network namespace with no interfaces up. */ + + ns_uid = opt_sandbox_uid; + ns_gid = opt_sandbox_gid; + if (opt_unshare_user && opt_userns_block_fd == -1) diff --git a/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bwrap b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/bwrap new file mode 100644 index 0000000000000000000000000000000000000000..4e01530cd56600e53f6852f843c927fc4311dee8 GIT binary patch literal 101304 zcmeFadw5hu()d4t3;^R6tPj{Z#jvlf%fo&-?tI=l%V)@sV?? zy1Kfmy1Kf%PMG*d z`9DsVc-_>3LjK~{G!431a+P`+a&wex7maqsukqI9D)o~6&Ck*$@vAFc!&1*Jw|z96 zccPDdaAu2t$GR9(knGSes$Ip+oTt3$6{i(eb-YRM_)l6rkE)%1O? zJ@V?Z>>0nt?I|+K|9O@@6R(MCC)OKp)l0kEg%mEdOa|IPd_f7xB{ z?DA2?y2<%_BVBIkyrQed{`ud5FmL~7v}<`1{5>>$H2NQs;FrStX!H}4(BFf?N2A}C zgwNwi=&w$~-$i$p5_$S2!S_od&pS!l{WuBziAnT*H3^@TBzz7g;jjhsY&SPCc&SW1V1i`JQ+#o*CoNra`LN3+jcN$6WA;lDKr{Vz%QU!8>Wvp*1Rm-QteoS?B1+rC+nJ~#UcEYsEvBGmw)fnG+ML4;797JrL$}J@(kC`w9 zOl8%y2~&KPW#!{1O8dU4{zNi(_1RXt%GGQ)0aRmBw5JeV8hSuJ`t=CBBf|kHOu9n!Zyv~J;~*tJf>O!r;`-B2d>q0m=F3rciM;>RSDD<+Ett9@gq`hBkQNmHvUu!ReK zs$JEyCW|EWMdh@L3QO3kF%;8wHI)^)t73Wu_E4QMMdYt6A3u5OSh4vyvAJ*Bq>3qW z8SAg2M#Y$E6;r0W=yg#5B7w@vL=Hc~Q921K z(L@}=61QR|JuJqUeuOoI0_DWg6UJ3dn_8|-3p*IQZlFt)Ji@GM!t|-WvT0MNDiO=d z{nL=zS4M5iO{Y$iPQmx5xn_)+;8QZ9`{b$qDVVE#if@u`W=y$n!c^3^jWI>c062bX zwNLpdmQhYDrVxW+KIwtVvEmh~FQy_L_JTmnNRv~g!={z1K{9CQ5p6jZZiOgkX6L7%%{IY5+fI&qO873HhJiX+qoH1>JufkO|t=u<>@rNw5 z7&o)>rZMFc#hLUNLa8a$2&y`10z=q`J*1X$7d(AxmCq&PX-t*QJ;=S>^>qy{DIPGe z?A){S?YndH?AzwM^K9G&_Fc~T_U(DinhtMD3* zQ@3!n1uJd0L?$hNb6Fd^hRg&hu47#V>;d9=rOp#3v~yAaQVTc#?)yl`9P1ip!5OOj z7+0AEcTjK}*8~ebQNd}hY71VZ>bG{yw&2$k+{!iIf;%dDx9c7YeqEKPx*oP*U*`#A z5?i_!Td@Bmfm^s<2bRBh{xLqExvtar3@a}g$JbhU-^>Jjo|PlcPQYJm;rk@u2U+-n z1bm5w_a@-4u<)e`_^T}Zhy?sd3qLvmf1QONpMWp7@HGkeaTb1l0)C=}UzmWOW#J!4 zz|Xeuixco8vh_M*X#zg`XKnxY67UTc{iX!`ItyyJpl-(=B`PQbrx(N`tl=UMigpMd|s;3b>ImM_Mhp%7ur~t z>qiG(auo5u0}lMmI8v@w`;u>#Jwp61zU~yfJMdO0QDx&Dc=cSxs!`>@tNgTupXtEIAALwsjRPNl6e9Tf4*W5Ku>KZ0@W;lH zTpw`Y+dA-%I`GFi@QWRI!-0Rrfse;}DPHQpAMc>Ab>Q1O@b5YB9US=e4!k@Mi2rSJ z;5)^UT(>&#Cphq?1An3e|Dyw+;lLko;5$3;u2Ic?a*_j|=D@QXvj5T@`1rFqDa>%- zoevu_9r#mhEnGSrF1E1}{&vf8>IPf(N{8G1OFEXez5~z>cGF^z+d6OFLmIr zbl__p_@NH`dk(xjYm5J_ci{CCUR|=ufxjwF%yp{+f3*W|I`AVL_#YkkYaI9k4!pI* z*QM5aL;T;`5-5C{13%KiC*6S`<-lh+@RBQw|7AMxWpO0eYzKa{1K-DiALGF1Iq)|) z@C6QhxdZQY;Kw@fr4D?B13$unuXNx?JMiNi`0)<>cn7}9fuG>O&vf8#bl__o_=yhu zdyxIaH9 z#pMmv`dT!t_Xgfgt5c0P<+ksY;@aDEdIv5>H{m$OlH%(1V3l%IWl)bT!Y*-S@ zdt<9?xTS($wP8sl?~OfX!;(PW8@t6BVZS$aybVjDcyBDlh9yC~H}=!vxW1AYMt>WYgfRNs zuq1-f--aatyf^l$4NKw|{cTthzUXhmlITT$8a=D*$N(G!;(-%e;bxWD*D^7Bv8@ch9z-|{x&QLQ}nlC zNtB|$4NHO){eO?^FNsn5--ab2ivBh%iBR;nVM&0}|28a%PxQB8NqC~a4NIaE{cTth zobSQ41%Z^M$fM1LEWgeCghup}zc--abYiT;P;`WGnp z8yhZE@JBW*2}<<0;eiT%)rKV@iT*Y$iAeOfVM#!uzYPyo@J%-CRqz-amP8}^+pr`U z(cgw8v55XQED1&Qw_!;nqQ4DG0ulXfSQ3Zme=x4UBn;_)8N{cppPAVhx~mc$_a zZ^M!hM1LEWL?HUxup|J{--adeNB`TfB>d=q8L`rEK1_|V^mC9#M8HY^D}^tWM2 zJ<>|IrHm#)c(PhyFG!2|Dz*;c^APYQvI{Lw_5VL>&6tuq5En z--adehW<7z6A=2_uq4{h--ac@hW<7zi8b`MVM(Z=zYR}T@bNY*i8b`MVM(Z=|ADyv zl1QWfZCDa$=pTofEg$A_y3q|km-!L+tE?m8jS27v3GkW(_?-m!jRg3`1o){0_~8Wj z-UK+B0EZIb*$J>e0iK)yS0uor65!zp@Q?&}Py*~pfO8Yz-U;yO32@g0xKje$E&+BY zz<-=}WdHq|0PjkGzfXX_N`N;ez#k;QYZBmh65uxy;1?6%rxM_Y6X1Ij;AjFIN`Pl4 z!2SeyasphD0FO$5hbO>865v4zuqOe|O@MnRz^5m`T@&C=32?gv*qs3XacV;UC&0TB z;O`UQuM*&m3GfFA@R|hpodo!e1o*`S_^AZ=;RN{J1UQ-ihZ5k~39vr_o}2(zB*3E* z;Nc1IkOX*80_;hEa}(g+3GnF&aMuL5Qv%#B0d^;7|fQI|245z>^c;iUfF60zBLa7hb(gc1VR+ z6%H>PHhgIKkaynB1MDHgw`TS8MqkJ(;NBbdW%cof_l)&MQcsulzc(DrGAYQZW$Sud zOb|s`Rr1fwoZ6qg&j${*@Mm}oNy0{hM7`0~Lnf4ZGLl5awM_huy2>c99h1ziWh+u{rZbgIV$- zk~cajt5ift8x;D^2z|%C)f@3;rBxbxYLVUBP?S}Asyi)H+Np(J{)`^Fu6ZTQk#GLR zFswADXe>8(X1xt*rE$ZmO5;=atr%`lPHoQGoDDg(D}={N*)5r$Xzk_?Q{v=Ke20R6 zuz@uny3^$<4!_IB-U#-faJg)bbM|?|4d!U-gx$O0D1|4ni^Nu!+cn3inrl?eJ#0B0 zHP28rU$JV|Q&(!uwn~l(2aE%N@w++UE z-`MpBJaxj;-!|f&3rX1h24KMRTpU@ckpBRz@pKTj{&oS6PfCqoDp`jb&jDn2`H%Ak zJRixO5n7=H`dt9u$u*wM3L9Jk78<{%QBbt&fR!#+W5-IhE;T>?wW%qPmuiHbffQGA zxiYcc7V|9}J8+=M_jQfuE~y=Muc3WBHydwi^0lk+EYwXDpj!!}^HGd0y}yCw?+O`3 z0(_5y;Gwv~ZnKTFbN~&~u)uOy($4Oc!p;0AjfHCG{!rsN9i}OrH_!W);veVL9q($9 zUgJ4VTJm)acqVies~tP<-;`!5`D;9T5XX8dAlE z|I)w}q@7SZ&6U$+KBdRG60-(;z|%^a^ks+_Rw*h|_FIA46eIWv(JJEkx(i*0Mb4ts zm2RH5PgL=BF>n4w410nRtRSs~OKsSyT&ixCaD9|YO}h+DslczI({#nGJ ze@m6LF4W1Xg)Wo+*=KIVPo0Jmh6km4BLv{UnhZGk z--8L9U?SAF;}Ip{{icD85zpNxYeTlzhWr8hNsRC#5qX`Pzn8;aA~BcM1+B8Bq9Ihwlsu>_r!S z^^{@?^ZB`Ygq15B?olJooR04>)Rw!_(p-TLo6J^7R2W{P9H$d@WUj0c-i+c(uHSOqXT^A27t{m>!qcz@><&u~JdV5UYSnjdQENwyzY6 znp2dU84IQWD-i+>{e}0~6-<+vEdj4l9Ona~6V8`kOfG?fVJ8O#? zy#r=o(uEOsC49yIPoPg@?=VhRibI;OiF=0Ky(o>XQlaAYtV~K^@ZB4f2Y%ARRWY@i z`}T;_w=jZh=w2w6Y*tP5_e*a+8LwAEy^`>D)2pk7u4Khi67Bu@=L#)h{A`QqHrPN} z5Q0c9lrWN9{ z<{3CMgCkpfDD;eC<2mrUk~!jo%NgiX<4J*qE8_CC4;&!8ev!`bKY*`v!>oY=U5wyn zS#L!>dv(PtsTlF};e!W6X(Kd_!iXm~4qmRnQ{!N+s>+yGJ}drm9tz5JGYT-H-EOp79?e?e){MW^3S#Uj=?nZ9&kcdO+K2gDcL z|AOWscNHYC$@3X_Z>3^xBTvxh7pDrt}~xCn8)k*;qbFr>Y_q0Rp6#)~Q!mPE?a zau}C8%*TZyJW!&u5u7dhM6T-tov%}*W#B-|=^FzFTKU#nNPlBVG`HmvJqa;SFLTwV zNpLfN->sYX9H(r#8(Xs6)UF*q$ojAWjQOdi3Y`a)`K&Y?^}IxZEWR?#_pH*^l;Sc^ z;Rh>r(RCu_3%eBmkdH_%>(~v;TUk*J`|&LRAB{3&e}2Q!892qvC$d67a0S zZm{nCB5l&bTU_RhSMehJHGa!%x@cCMMYy3Dvz~9YJB%qMZMpA->QA3z|qrZLuzaP5^RJv zo3gm}BF}c1T@0Z)+p0Vn(-})V$I+m<>_X|wuFE^gq`cX8hSD=~ONO|0@Jp5h<^|ZT zVPJ-Y$aw#5LCT?Uv|6c6rEm6|r&#P=uvgKZc6&>^8Df-VYa{)I5{dL{7|>EX z2UrOrM5Vg={NtoLP1OLGly6mgsrk5sR4hS*i0AqaM=TlMwAvkjS!+CBbi_G~CGJnS z`dB{~L5!uU3C}g26;kMLQ{!18H@@~PiCMf&M_I%P$`(ft;#5|$0Z%)rdgOZIp&yi8 zWIgd?d&hdBC4$A*6Q5CFK8{cU&s*F!`A%Xj{yDsefO$G1KPe<-EWMdKdYMb8ToUPh zCNd2P?J|NZS?o#toulOnji8b>6Yj>?`(;0Ss$bmVRvB+GiH=_gf8TNDh0?Cfp`E0q zh-WW&^VbmS2=aYaF*TkKv@D^P0xT9lZ7D8M=-?R8=6UpUdZq`b1#bIcRdr#-0!Ug}8# zN61e6Yi<8eOiPQ8iDaz*XcOb@q($Zo?pRxjWQax?O;97Std$Z@{iU{yy%n4Wp?GTYGQ_Jq8KcD zi1%}aq@PU^&ApJi=1@g*I%x9%{-c_DiOETtnjuX+27qaAH9x1Ao0+EUFXSd%XRZMk zt3hA$ExD5giTSGBE#^+v@tNkSfZ{aM=s+_xReJH_f;_-a?i8AboQ)IO&UJ$z)gJ6z7HmHKbbcPuwe8fIQw)lj+ ziLuOtTx`gseFpzBu`?kXp;2&+xO;<<={MjxNy>~+RM5k+@^WfxJRuC^DwHh^35W)O zNbVZ`H3qFOG>YC0H-w?1a;DjVr%hti(3@`LGqwjnJ{IoMLD4PsCkB#eDb8$H{_f6j3eW zK3ieN3MROTfrLe#Sg$Oya}pBl_+BJPHG*Sg5gGMV5SVe@J`*YXH)RplPn0gCG;rWp zBY3+e8>q?J2-%Ys8KquD27P}`cGW)>w{15{)P0w1S!_N9C2aOGWS}iaeTl98ND0t( zUva+e-!(NAhb6Vd3YgjXK8q#;8m9FdU&NMexi{Y-qQ{QGB-DINYjhGCF=MLi)}WkS z=5l85c!F!18Y?@P``&zxX13tROe~?=BBQ9$e2hj11$P;t8yWhs!H`DWIqh`c#~x&7 zp;$`BVjL_HORc2b(ADH!UT7>@W0t`|FN42dCqnEn+bO~Qi{k>By=-ZG_ox#q?B_D` z+kMbhx+ct?B3SDy^G3UVhHV>*6C}-EnwJNmd?VF_V=+q*D%ZMLg&5 zuX&{mo6UG8tIfWQ$%uO<(yXAiD>}1B(Kb=$Ccub`2?cuh!c?q)ltLN^`sSRzQ6YpdyVV&tUidUDUY%Od^y-ijv=Ef>P z?;k|GI=D@o=k&LbX-Mchf5*m|YCUq=x0a<|K%(MEzpNFm6jC>}<}nyam<`+OwNXjE^2-87& z<2*(`LNLf$^RGD#n-q}-Nh=~gWm}3zM`jht?DaiD6cXHL(;ALl7&zSI8&#Cg=GMQ} zu}Q5FV;*IbS}60^n}yM$tQ7A9vWPBiY+V?b?Mn4O9^XVu-o(HLVo%?kF_j zy!%)}$AM#fU1BViU6EVTLQONp=E63a3^HS`6L zUeQimtcur4aU}O&w4~?unYc0Z-Jem#&*|FZ8L)K9KQ#1*uDU=&$33gcYBaP{mrWB0 zIY|_IeuBUo=|laIn&$GSRgKFvbd|1=K2EjUM?>f8vY+2ml<(@Ymvp@oblEv;Rau&b ze$$i(E3^kkJuhnF7zkwe;3-ACSwp|;s*^R_dJUCnXugK7(9rTVs@^~irD`MI3m5F4 z2j63!QRM-}x82_eg3G5eREcq;YgNO`(8v7c8`UGbh)d=HE$`p7c$aE{KK_ql^QA76 zI#}y$%Jga`su5i^apO~}*w9es`wDtYSG`A5{ybJS-b+K@Ysjr-{Y*n4Ex?1C%d;AK z>xi=1y6kM-LVw*tsfKbiG)+UNX{cJY*Wm7z##AklV9@Nq-#ZYm#aG6 zK2UU9fr=yNXTc?)%hxqy{;4rI*x41x? z?^azlMMG0GbeV=mYv^nZU8$iC8Y>x_lCE51K<5vI!v~dYmu*z2-DQ*9(RiCmu7nKkF{bdh`RqSm;3|1POQJDLnM=Z zo2IQsw;JJFXI-JcNzv!tD3>0Gz2P6dt9JMIt~$`tn^N!n=&-LN3)pA~rHrDk-M-Y1&7d$Y4`*Rl z!L%lrnREKb{<{)l=??pq?eW!StC?ual60#_qb-y%sUE#>M z-bmv=ZAChQE=}bh2-D3+#ZMzcNp7;qX=q%b_F>V~_TK3E8=-MEeqOn-a2Q?F6?uxo zzj&jaLiG7?wUQ41!Fomu(e6WK?X_N`=sn#3SshyLfV3q1&GK2D*s^0|msvvrOO9)} z&?(wqtcSRY5xW-&b*}Kn;_x~nG*501^Sn0ddHo)$|1?gdSObUK*;g?`6woXyMsIkH z=@v}XGxc$o%gR0NE)Lgv!v|UEnIo`bsMbH4<$*6vR$&caFnmJ0B(2MO6M#*$FIOxE zJ1c=3dmMZv{l!Wod>G!Rhzt^+k-_qSA{wQVRijSUDN)by&|!s-M^m^QN0Gm|;14cS z_{K7ZOLLE-c%D4&bv&nLxs+3D^pMmuj~CMP17Nlcn8Q^NZ1Uyt5V9o(^<5otKgJEu zeBJlz>-tJ#>U*-i;PG!Q|G&?DR;4j%m1f673KGa9pUv+#i%Di?%7mD0C$s%IsFPP0 z@Eo5CfB&P6Tg@*&m*r53zfHjNyK3|URJr7DN|j7hF;9lmk@}<+7)zSW(@)S* z*ry-iKRjIES*}Yqr@@C%HvB8=OZIErN^2}aTQ#1b!j#K*yonB9Gcd*= zuF6nt_6E!p|8PAGJp~usdn~ad;%QGCl7u0P@UEFdk4HRBO&Ir6v-Jvf466AuUFGO)vAe{}b~5iSf4L=s zM{{p^Q!btkR1>qC$I`N+j<&Nz&kX4}mwD(@OMm~c@Rns9<8v)vm2wOw*o~H7V}fvl ztoT1;v=o_#5uounY1gcy9{U9UY3eEISyF*@{fkr(@~!BRaowo8g@FUd`@Rxjsn`Jw zBeJb|n>2cBR@*?{@xJHG#c)-{jcXScUR@aePzA;CMv3+GmS^N$1l^%U;X09;b1iMn z6L83gXC&5DPiR#K)FbcNG+)F*y)7HL`M=VWMd9~#x19@*@ES;-zd^7#7|D507qE04 z=tZDQn6aa|#|z~if}A;;$xL>H?ALj;;4di&|3G3-q!+#MK`%Z={s;hwpCWdzvzYd-Gc9Ofjha zaE-zjbm8BnFzUHMLw5q{INVbsZUN!we~t`=|4@_Y@SI&k-=e#fn=}?!<9kr>J6|sy zfCv~r=zwt!ROaLK5?#x#T-7<$!w9ZccWY84W$6w4(QU>R5%;l&;b=TzPJ4sgf$tkT zmf;^Od8Ftvuho3~Z<{rrXxBTz_X-cDd_4P;JmI$2mCkk7sPP@?wBir!V+OW%gX`+* z{s?Gj~Z8_n#YsA4u9W_rAU0u7xNNEBUw%sTD_1?R%&J5@QC!tY_QwC;jSluHOHvAQce>2Mp0s} zl5UTrW;F~_F=26Qf1Y=h*|H>Do>s{UF}Z6Xc?h1i8-}t=cPYv!1 z0p$;cFmqjlyN87!nCIpoH_BY1m6j7tBD#kzVYIa=TkK2dkP!aD@)>$6M$=7FvGO z0qRr>-C4Ke0d;|eYGqL#R(XirG7G)uW6_CYS9nFeI~%D|Vr}pR{HEsCECb7gv6E%8 z?%Wm=v@r?~3Dn^>^K$qWv+qvhSWL~uY$(qXQOE`N!F7yK7a;i0@2CW1drkuGvaw^f{K(B9#*@l1d&9l5 zih3Lv6h4dujmNTHjm}K*<{z4V&cJA|3kn1EDP*8}4GQ~Rh4T)JYZ!N>Vqca*9O>(E z(3~u-vNnFNkl2IK2SqPQDK0;-B8{fa(TpZUx|_}=jfWJz^LR80_ZcTN_OSe0+A9t; zq)D5dio^YF&K)eyJbdtF709ZyS4lXgvXLctZ-IF#xg+%yVF5QXedK&dP@4xJeoyDU zN1zoqD~1yy=GMD=AxTQT`&51DsxO`O<#>H*E0nSogbP_%0Kq$bGjeHbULH zI7bw&p3V%N7G~#GBpL5axq9s-kP)hvo({Y_!ZF*aP#mkodvR0M)(yI?ALr|~PS?_P zL%K!_)m}^2v)=v7eo?m%HR|0lb)Uuk3ULQw&)%0*==^z@K)G*OwLe*}hPyCaW}#Lo zls}{1{g`61g@k*(`#yF5G53%@VUgaaN%QO7vnY1OUZ>dX{u4Bj+~xad4}TYk9oy}y zb-!xea~F^~f%}rEr(E+Y2_H5GYj#7`Nc8n5!t@fhz7tAh6_Zh>l3t3k}r~8&oJRO_O>Vs@}^A zGf=ikNS|SP_Oqm8Hf|Za=>T_#)52JA9>%a|q5?e=y^GXpCPJS0WW*wj_+6A$Agn`s zfH*Tfe}`bBxpg6taF5yeAFb|A(B|1l+rXYqidI`{4d4i3k;;I)rK)tyGRIvdj5~5n zdw`NXJ$$W*@0%l{wm@(eCNel(-qr%DEDmcnm_q^Xeg zu+_i)wXBP3r3qt6ZAxu;U>DV9>`L0wgZ1FEs)tW2rJ1P52q>tNhBm{9AkiAg9H6A3 z$s=@)8L}c)qyAOR=!?Gyg{;gU)rhq=qL*g36ojSc*RV594ll&5cr-m1C+c~XrRN_A z8|#1oirbuN=06oDE#sd#`3l6v#Cg)iTHP%!5#jQItaOyrKhPXHcd(`YTq9c8i1#$& zr_1At4%0^4Y9pT36d&4%b2Y^Z8xhnLFWLy5csKuHBW}#DSKmLd@j0HUb%z2!wIbvuL<5DSBL#u`xiE(-$rJ29* zd_UlRhw3RhB^MRhx$%u}jKI}>#~mAW0a zo1XE`cAi9wcsn)mc4(tW+Gv6s3)DQhKW~g$YX=K-YjbG=1Ph9 z*WL!D;3bxS^-Y1~Y#z%dx>TBF+MuLAl}1|4()4=w{kvtM@abOVN<|jq2Nh!@#C&48 zQnk5p$DbLu(TsgO5H3xRbo$p$6xcA!y?ht#giBc#c4`fKX-u`+;Jy%^R@r9~R?j<#=(wDhXJA20V$sr%d+R;#z^R;zTYqs)3v9VFWMSlz1cY;BGw z8Xe}a&5m6f+(C-O4zW?PhE(FXwK!*M5n71|r)m+}TOzbnA{e26(Ts?}Jo*r~iSy{K zkj3Xwc67c;@d?y_Lum8N>&>=EF6$|#@wQZNC}43N;GKE z;9g6S68-TX`ab0=~yJ$T_79jTa%#5qu1k?h`{PW`wg*VR;QTW2bP(nA$u? z%l6NAwQLVI%SJ@`lWZp*DVvX^yAa zGxT9(Wz?T32y(!;D5$fBj=@FDcIrO&LQCG=bz0tNT;4f1n`hB@qHh|MO9x+u9hh+G zet~+4RqW1uCEzG6;B7XdL?ir~`i0q0Pf+){E4Y{b zzEsKRA7;g=7cqOWykb*x5$ntaKq_IUpOU;J>P0#|6XQZYCdfVl9s`v3>4Z+$eTNi= zGh&%a+}wFqGvBV(roc)%Y8gSXN}^khL>h-%`L4ISZWvux8gW+(`-sQKMM77!D#csA z&%0`SOEX7=EAMnAC2BmA1-YF2=%p#)E(^o$F62HIVF3z$x5@orggS_hel0ngkW47T`$b={-Q6UhYw|EyR54oWeV$C01I zl{`*?ii48Xkvz_+T$@9YI}`q~&sjzy*F=%)yXSW{Ig`||L-K*_&t){$0`>qjS(wNLKf~v zXvwbEl9e}0*6(PN-2oT7qo@6|*=Cm?MY6xc;eTPX3q-QtS@NU(Igw}l&rr)vXhS@**G}FZTUY)_RBX&wiaJN zvH>F5Be=Enf3>pN-3rQ;5_;L3_O>!ua6Vnk5~8n#zD}Y21JxRBP9JGDU3sQT9m{NM zjwsSz-y$|rH+Gh8ppS0uS7L{mr5kHyadm61xq5CmRWVeq+t1>a5=)1d`2oWv)=G2T zD15%ewdm;W+*_`>{4J5&KgXVCGEv)(KEFKJ+{x?v{kfC7AV}Plykn9ATYFSj0LiEx z#nmyYS8YY6X{!jw&9`wE?%Q+E!s{g4tX zs|7fT)HjqVu^yWAJRQdW@QC=i4_d@u(;j`xGk~`g@$ak!DZbMxUTGJ1qVuaq&imeqfY)3ncaKeOr(~-X^PDqT1o{?*@xssp4mZ zYGGvYeAdD9OvUr@IM4Q)=T+yZRek&nq1)Vqzo@4;!eyexWutH@fy-f*X&>{FGWC~$>+WtN z^_S`Tk4yarRQ=r7xR)N8MPd;-LhGQG6HWzOr*WqwFu$Zb zm4CeZprLiREzn90ZG+N$P2K1I$h|1JNSjH{%l%2o8*pd_LN+au zmzBhp>3?0sV&rm~MxK{7P=xY4FFYAWg@OJstusRB3+?A|6L=$>G+5DoUr}iauSaJH zSJ_9Y$BOd%*(3#xP>P`0=>-o+Yx8UQ*ESCi)t?mmbmDv=Za&PCeUtJeBeWaZBRYsZ zvvisgREen$o0~F95wAJ>{g70&MUicU5+x|;d52UV-D0lh3{3O*jz6bhU)>(E@Q6&c z^8UM>+Bj{IGI_~`@L-};e{<=W#`_iie8EROQ4O7;p&OYO%#-x}L%O7`hQ89!;e1uA zT)9H{Q9CQ9_x`;GmKzcMp#L7c3aFhnj#q?585?9 zQ#IezHLtdcZ`Q?U*1KO;#Sc(iGuzeM2yK-yqqYx0Xz{NyEz*Tn%>rGs1A6uYWxnz+ zbvm>S%THj!fee;kOp>CA;%41*-2<<@t1hx*Vttyb|i}Sl2#<@|+ z-_%zGsi9eAv(i@~j|}B#M;#w|*x-L6{)Ds6aUQPuyu-Ym^2o{?Xq$!C?0gSDE|`C7 zR)5El2fiJ_tUwT5Cn~Z`MO6BPbfA2IBv0B!waRJg@QZk#5DQggW*P_f-~^_zrtEqzLRk!czMq?C7WK~W4=b`$jPs- zIicFXsh?#oS0)A9OgeTXRD0r6>< z%=)w3$!P-_QiF1u3f1TWAz2;{2Oz*7B51T--lLp1%W0+T)N!F)Jda4|TTH*k<%=_t z&n%T>r5A=jDT&O|EqYREv5*!+eYgu8Y;WA&m!@HS<|ACnJKpV0dH>?3ZM-{qv5S8^ zDKL|Wr;P-VDXGy&X=Z4{%(G%Ym-7q8lEEAsYDnpKj_;Qu*09+UEWSWpdpz*H779a*=_)!6fsd3mJdCm;4y9x(q14M*9HZxZGnVZ4zkn@xiHmpGP&wP&k5Toj z)UzqkAtma$aEf?pRXQ=U)wwF<6yb8u=c?|DcU0(V)KzV%P$juL&FMTiF=DbqYiGWs zI0Bqs6v^ZRR>60VBTDnK*ROKA@3su0BCB;o`i;^19Bzwj=Myq&CVDQtO+ zYfyN*;oZb*%59g*kyc}nSs30K{)*&bcH@b*|39w}ArjFF=oSvU$BHCs9p*Ia7W5Y% z_+n7_7v5GAPOMjOVp&Gs%2kZ?16?QZ^&LeO#(YtvJCx}&PFUVFjsyC}6Wgkf^|&6T zgM-=7sJ`~K=YW-m<;it%jQ<=kBpI^f=FFXJoAYYSNo1nyRZP+miZ+NK%i2K|ZI{E6 zgBKsX<*D<$Deqm}v{lwEqwxohJ?`Q0^?v!RPL06)$zk|X`KQYC43 z=3b)2SUt%SqYg>%z6=qAGw%$qE#~HDc^GX)cl!m1dXUI}udZlbEqwIEIHC`cTb7F} zkHN1lY9-@{50P-(ke2{UID43BguW6RTJLX^M5@yoGn&sVn$N>p={o=hc0Ac*-XnoX z=0{E^l!W)jqlwIsyUi1ZO82QZA|JvZ2T1^Vv6BcjENiAHUFE%KQC5w#8+;DFUiGdE zpYAIPpMSqNp?{FX!FqK#b`=D21ei&A4rq18Y-1b2?KeMIEaR0Pl6ArdAhErim{6~! zqOK9_DY1aw&nTf;!YS&DumkTC zJNDV@W^a^Dk~cDfMaTFwa|p9KhNSh-WW3DF$Sq(Lv{AY;vqwrZMLB4f=n67BV|m=D&4qi5FtUn0Q3qmMUL*zh9~b~OQpacvWlQQQk99R ztHn)gRf!SWfv-nqX3(=QQ6^IFhGi}U_{h_gqF^Ym>>oF{KY zoC`%9`+YmbgXPUsCZ7@}ANzZKr#)?r!+p+ixWhb_@ukLLc#UHio{A~An|J+1)->{7 zawi&5qp%RUWPo)XfCN_0)8R5eTT?WT_e#W1zGQ}y0T;zT#JvBq;89P}D|t-G!ef1* z(xTu7{h1lQ1$U6;ifkm7AgojyE7d}~{O`t6siW;PGm|Cg{2Y3I9y7Z%)=K%3ml0K! zT@>DHE?r9_AO9{DurwH6Uza5yW*MO-k;~G}MbOAJ5Sf^6=HW56oen)|*=aX}+>TeQ z|L`Ymr@DBoIu#Xv5Ic>#96N0hJMBVnWv4N8w1i1c2fH)s#WRT>tjvld-SDHOf+)GED2nRYdor^tX-17t(3OVQ-b&p?z ze)$JD*~;KjVN$J|ayEOTz3*qli0)~uU)6_|F6tvZ_n|H|zkZj}NWV>tTaIp;E71uV z=D$F-ya60oLzc-EgFjDXG3qB_k5bccVBjNL$P|U_#o!e35G`1L?({uXxzdu*27q z%BM^pTPumcU?1{-*y4r>Tx8oIt0nk|P0d@-Mr_kw8qpDWKLfu^(T-0yFQbLV6YcnI z9{ZTppDPHhj`998kt*4EpK+-OEo18sT2tfwCX|--VW}GEIDYwRk%u*+H!{kVvsS%F zXZh6#nq-gyni}#za8Jr>!_pFQ}S&X`&~2T ze+3dMSW<1a`g#KtIN$_Hx3UoDGltu-@p5`u_K0@pnC}s5#AI)Z4pzSm;3+n7)N}V(5nGv{AxnZ`4RYgpdmU@zl{DUDnqFB%)yFpeDoyFdTu8pB z>Rh+Unm(HQU`Nr`AG!yOeO< zVBTY4W(u1sVjZcj4!keL7pp=|v&O1d!1C*+aT=k)90zS|00LDmREf7=QN-(bv04^i zHQ>xs&Xfjajf>}0(M;@Abdq@h*-x=#m+!g7dV)9SiUnzYrnIKy@aAtaZl8%!q}d-I zrrCc(*laOLKWU@AHdq^N8-ooMdzt5+Ctfg<*WTH)MUIcD&mTy~>1-R@!W5%v{8$IZt?WzF@#T8V!jCN2aJNCnF-Z8+_^b6;)v?gNG3jSf$%Es-s z!F$EW{Kwbff`B^#G@qq}It%Ovf0`(Gz zZxdxRVG#z~O7z3$Cvd*gln(&$3a3iVf5qU7uauWb;!?KIc*8dH!AEG7I`jVtNqsO? z*3$GkmXS6=L8A;5KHilygzkHo4s(PzY6 z&}nKwbVM1o+=%%Pi(2E;nWx^oL4DWB|99yDtevf_WX;Mu%u$bMTYnv9Z~udHM&53I zGmyr&uzDVk8xm;eznNpvoRSLmp(g4A@qlJD&)d^-vyWV{L>0u+J zh$BHoEZBwkml1kM(OR3CpXpa?GXuNtfnuc`$7D;|*4Ku&o{iv73@+VyQBOYM)^g<^ zPI1m};xDm>p$xpA5?hKDk4%Qh$BBO%fW&pN1GX;^0b*lgLi$5x6WT{@joZ zFmI$lWp*-H_OyS{GVywpaV&cd5!;Gz?xtN6e{)H8doip_nyT4kVC;@ehNb`x~e zldg$grDM$(?w2;0QKX^LKpyG5n>4E%<|tNgIauA(>=mDMQLMh7t%xdNB^6ta}kZZa^b11ti z6F&J$w080q)bih@JEOTL%#e$xBXs6-(t5O=ys@g7e6D#Ze1ME#nYttM2gK*?{oA- zRd|nl?y4kGhymMugpte^VAH!>bqkUvPwE?6r>pNz)4Ei-$F=xf|hopUr?Tp=}B{fav9xyGicLd zzFKNo-B$%VQpJl%<_iw&#Af1qRTCbegXne#(U;mGBr9L#K)>3IzQ%!`-HaaKK=*G( z_l%=i51_&C%`zM>CDC>VgQ)p(OS#Y8?URe=Hg@OcU+E8J@9-jJ?;+u>vAdWESU^GY z{%|Gv2c6?es|oM6X6~;^iF!CZ^eRRAxFDkKo{;9YY7d&Ln-e9>4$}S6c0noLqKilC z;=f4oFLZj`y4#yu=^ED#k(M;0``ThfJ-J9q7s&|g23jROVrjAgB^6AyOSO0{9aUO_ zva0ONP*U#-AXX>s3u~(dp$va3AdlSJNT(){Cd$T`wT}k-I_&12W zk&AP7v99>#HDuaDZ=?pZ}}k^7UR4=Edb5J9^t}Bvaw*ToN6h5}S$wBFoES+Z0oM_p&%Vg--y~r^k+? zuzCMmcy(ZZ3WpYqB@Nmt@)-pA{6RV{ki}0$@Z>&4dQQ#uGc%1P1?jvZFJDREDPJu_ z95o$@5|*KT zN+`%S*Q(X!b=f6&VRp)z5|$Qyim;Ct9x^rOmGDmig(d!%hD0W37pCl{VSltJe5f$| z*^o$a_MnvgLwN3}J~QG4E|PB$0O!y(@~um%Y!dxLEkO(lHw?iUi&98w_RFC!w%o}ani}{vrN;Bfn<8IP)}(Mfy*Azm?gy^%JSt)vp&$5{=e+7S zpm=Ec0HFMNJJ%Y=>mS~L4&vSq2}AIBKWS6*VRQ#jaU`%Fm2NSp#!^1r_EmrPLeMyb70Q!jY%KlDt{P zw00+<%N)>KWs!oVP?~QSo3X66su)E;{Fxx zBcA(~NK3hgS)tXtg8-~wP8D*=)<}O`Ndv}`beIy4k$G*9@!AUhvQMlzc#J$SA_y5v zHl%z6U2uc{2Rc0?{Gm4=7S%@0%%)>}?f}(Om>@D%^pPflopci;ByyChBx*0(k#Uki zOEaaVLDKpVu#!EaV1#_Qg74sd2Z5wBnk3SW?-)0eNX!ngDC^cC1bBcx0;tqZww+&C zL0ScS^E{7!Q0fh6f#PC<5d>O(SUZ|~GNyner?!a?jmTj27Dq2nWj8DHP=Og<*wl1= znS6mc^r7^4IgOO0959xo)%{l>!#eln|S0+kuW@jM?GK) zjCRvt}5!jjywGc3L>}>{Eq3jBz&Mb9ve$aHNS(x?;!l*>|kXCA0|`^hu|V^ z_}<4tW62e2{;09((G}%nT&9~Z-6=B}cVrfZL_4+~lK)wCkA(L4uv&de&B2jIa4V)0 zUFKiaRGhzh#&`9t)Qp`uBs^y)AI&I?v?`2To?0B4vvWvz$}jov86~Uu$+aS*WUHA= zcL!@RUz#y!jU1u5NUeSO;x;_v{mt~#C!ZOdj3#OqhquHox55&kv)0FF;QR2wVS8ZD zy941FX9dDQ<`0+e7|9+MnBypsDIoMMed}c(y_iDB(X5^LKeCMGc$SQL$MLL%#){Gu zV+G$&=4*1%et*;;z^ZMn+8i{N%xntm>C@(*R^GV%TS{UF`A5&w;!>j{EG(m4TE|{z zKW(2Y@}}Uv(mA1WsOgi~&2p9KtdtG)M;b=H5&Vd-Rme*nDeCht@&)JXS@+BL-DGm* zNu7)VNp>;ryyf1GvNQ;%u0zy5`5R~K;)DkIPWYyK%LfwQFDi-js^>wxnb$#b%e#ED z`la~&C6SiJe7&Y5Oc7(voQMmEUuSUc+Fe*bC_QCJv?7yviOFP_Zvc7C#ty`JnW%>F zu^U15hIcV9m6%%)FIemE?v0!$Jk1X^{4pG|RRyNCkBh@yvI;qgMb5NOQT`vs?bk4J zOUij4^Doh{lU>EDzDq4>IW}vAp2Uk;!da8JbaX#P%WP)v$&T53m+vH6XS`5ij$|LN zC(#C(M7Mj9Q%#pV#EjmOq7tBD$&Ng;l$E~BHfzii*vZTHDa-4;s|e;PW^q2#hN1E+ zVr#rjC7n;1FXKb39>=s*7)epLPJk`Wg^CJXCjYVpTU}`Xe68fa> z;B++zN29+?6CyzDW_pQV1S3Z_n}%hXMeRJ=qh$2 zFEAezM`rLEX@jWge?(fOLEWNC6mmGD21KmK0jY13>eW}{hy1>Un$h$lckvZEQ_X0h zFhNOqpnf}ap*$iZJ@%aR5=0W!2-&K!k(@cFWjX|sjM(5qx`(|k`DEjM^C|Uot=T5T zN8S+-KDYryeTAsTL8P2W7UAaKL+Sw1Xgm_7z%;m64Y**!EZ+uN6Qq!q1pK#^VlG9}cWL`rT zl!VRLdF)|@m(or0b8Os3;cd(Rz>G}Gogt^zwOq_M=vOq)aPfgnyaLM8gmRFk+~Zf2 z7jiKpP@4O+nvh6AyZtkum0zfXYn`S&S!m0krG>M&N3JnEl7sktAr5Nd`!w;JLVPa7 zl?$!)Z}>CWIIb%kUMycXU{vPK&{NRSyl{*hG!kr<{Am?;cwVXTj*exOS(Vec?9}~)T~Tu$ehetu_!AOmra!b zpk`^a%U|ifL#>V5uT~z@X_9zMdFtQ2DeL7_WW;kFJeJ8=w3v7LavE*^D$)B!3Arja zvBIZ3aIPBAo@}ZRa@SoXjjU4j5DvdsNiFI5)*^Al&MJ(HjWPPs0ESO8z8)$C6-pS0ajdfM$6K zbz>LVU>P9NyrN=(=Ng#Bl|Oi)5}CrE8BVcMyUH+KWj0k}x7gU}U>i+@+r^E!kTien zONM{*@>ss#s=n9Ams^MPMPD|f8N?=s69lu;K;+aGhrj2PfQx%31To?OwrP^lQA@Ge z(xD7BzMgu(nDc2#xUum9HI9lRx3o0}a}ugBzro+bcynNCW#B*y-+2CQ>6^wcx3MqW z`g?JYdT&Zyap15q=kNIw(|l`}q5?g!NHxw%w4?e>Wd9&mpdz1R1sXpW{Ow#F2iC-f zQ`O#2LRRWIMtxl&@UPww) zXHj?*-ifG3wfTRMf~6T$=;(5{QhVy?NIBNYz=^oedzSHgJdf?7rE=6fJKU)|7}G>` zr0UZmt>&Y|KqPB+JEy@LbM+@8I}`qaOTr^&?ML` zgU%dwtITHK`MQEw41zD|tC+><>}aQ=zEBLHBC$0>Vc|#>U1ffZMG%pBJp3CKr&88j z>*q<-YD+DZf3?P|`hNDybn^10THPnm2HPx?i+n%(-}Ikj!c^-GSzr*^)=Le1qmN2M z{vXYje?tcZ3TAEP%H)@>8a?Xd=f43f-|}RFl~Y7*HxWw5e3@9cVVj}QnY-C#V8g-O z>-lL2+RD;6quJMb;%lO*`Yi=**At;{w(CO^;q*F#va!Z&N4GhwrPpWjF=g9ajMV>Q zo0-{Yg{35_Mo36mrgJP4^uj?e7%oHbl|(3da+^$^;Z>%b*VU8sON>5;I##~*|8IRp zFtJ({Z0BF6jl4?n2iS2>cu48`X1BBeuf`|OQ~q#$d+oK?UVH7eA7^iwM#Th1U11ej15qv<@V1GQ zzX_9j@57J+dVzb;Zozkv&G(nXpmg~4V$t%;36Q!%5}FrCKg9G;nDiqi{kNI^i%h@Q zrbpTf*hqMII>dYliJgJjlp5R*zG5p#%6tk|J~*EO&M>F4;p$_ph}nD4Cp#;jy1VP@ z?taJUE6w@od-+Y_=q1g$mquT0&e!#0e)U6`+2RCgbMAReeb1h_MC!%Dd-g1=!hHGP zjspP`yzZgg$(T}Ga7ONDxS|5>x$f@Om>X`!6%&ulW=zZ!e#svQU=Vc*zIZ%&!3nuz-u)OX7+BxGH;>$wHWFL$v_N-t^VAq}S(RTCDS zeyynMRj&rrRq_-3gF>~0|6)S$AA`z;`7`vPzkd1;8vNVJ;L{~|4f^rIT5co7_dSK% zkr^gdIpa8k6KsFS_bMptN2&^c4b|dYA=J1PnoFmk*32XpK9z396|u@-D*&Gm%mF$;yaj>`%ziGWPpz9%IXeG2sF|$RmYk zvl6Ae;(M=W3rh@RETZMLMM0=Gu&cgYVL3St*f&_`0#s40^8$9CZL+RMm!p>h^vj`J z7jl4(u{pjds+)7mtWl)k7=5pVUzoK|!n<^A{*77V@_yeecJ0358AbtgvABVW7v=Pf z;TxqLvyKDFxDT+(>{rE)o=J1v0!TeU2v2X(7`N~Ts2j~C{5PcFh5%l(qru8XyK9Er*W(>=IGjsKSm_fdpqO)6~dUf$Qy6URB7REu+Nd+^=|8vX1zmp zLfDk~ldvCp;eX_R&HcmTzxl3|IR`Bsn=)PwjBz29=YU#R$=tqQ_z;9==+ge1GZ5H5 zyT&ladi-N&@Olu_pXL^I%{kar1<^fuJ&u0G$AdC>{~}}pd5s(`d?hXQko(038FRA{ z(r#{OHSKXXq91WM0G#-lweOfQ;GPc|EWj-Mcx|B{Sg;2ZC+x)@)ciL2oPhVO^AjHQ zvCAMoJ0Hgebu9(A2`u2&7I2Y2V`8Jn@73LN9s<8uoVb1k1{uol3(SE0cHA@%TQ;ZW zp7|!mj9BCS6+RIzoB?s*-r^1TqSo#!vGjmH@o(ri5Vrny;s=jRVNoP)`?sW2_xY@& z`ipi?3kO5cX54bL6FWfgDa^!4d)v2PGz*iHH%jKP=r0xi5rs3Kq5OjD$GAuCKMOm- zu9oezi5|)=Hz4IY$Z~y9%Eh7ayR}$9@4RU~7JXQ*_HV*J;JoBw$ft8`{wz!+T2;V( zCq%@pu&j(x@ZcEq4W$XpgSc~42JBkCe<@Qw-pR&-{SlUGABgx`sae2>Nr4Hh2Y0BQ zGr7m%<4-#u;dZoZ3KO&<*_%81W({_ z>S=>`8b|QHsU5RwTpAl(tTXlktc&;`_d0;VIPi|ynXDD`Ze%M%g&BA^4Nxded;>;we_=f`627JV8|&N78<^NruPyv!P)eZfF^{Qnwnk2) z-v_NS+WJd6NN5-5;`@fF`DM6ciQ4=a;_=(N@!R~46sm}>f+LxlLXT+?x$9w{q37-2A_DmA8GC-kp1I9E zb0%=PP1VFZtiBZ{wrD?c1L~+`;MRc&)Wqlb^uM-3D7iwVF^5BO2W1p579wDLQ_TZLABFN%#K zzXt`KIh&1qa@#xw%1R2bKSl|kDm;NAc=ajv#7r8zK}Po@2{QVCmyw*TkY5R7Gszk( z*BniEgmIhLljjO6(JIg^^WQBzpJ2V0jKja0{;=>Q;E!PT6!UyEq!XVn%t5|h|19lA zwkxU=S-0b-z#Y8=D`Vfs11uxjQQ;xffps{(1908l(5(p^bYjn;u;-ufycEg-4qZK- z+bkT*{Kt8rR$3W<0+smE5o~Z`*Z0x@sH4KrUug|`{DICPoOz6(}nLLC-Y)fD<^gp{_%L&Uu|EQHRcD$E^Ri%?;*pJBUyCmZf?X;$nERQD)_&B@ooRWdfJ|1F%^8OYz)rBFZ6 zGroe(5!3h6IDIeN2fGm1gw}Bsf!9ttg$AS8=VO!%M|^7gfvJGri{8ih;DrKM1xwg# zhIA#CPKUJX<=V#8R|`L*zX3lVVKMeBT4z`s0?5am&d;&B%(CCD$i!D+X1^WlY{#rm zAnIWg!1Ki}5egoo1gS{Y8=f{wJpfUvhbOX`dXfjAw=urU1(*upPSou!d<2V=vOfDg zK&|ZG0SQQVc@(m*+x2zQ;XW|#!jxmYy0*Vkw{>loj7c!>EM~Q>tLlCl)r-1tw$;LP zO@7+;SI@>9j8SOg40C+fh^>)5}MUERL@H&wZ4SJjhf;2gowJ{b#=y8=jf#s;G2 z3MYXo3O$0s?{lrcE&R3*udoDN*2%MW`{9mh%pw>AI|wGPGc5nt1ep9@IsJgw%E=r| zyKv^~Aw7SIhUa&27ISzyI-kPRP&9t!jv8p}#@O*haEbj@9I3&+Oe&S@ zMyoG;0La?k94uUpOs)N4dl5^@duO}GUjOz2h^Fv&(0DR`(3_u-dubW}8OCo7#>;dQ z#93GcBS3~ulEk#Dn0S%N#rW7sh0U1*5?Xj3Mh zEWAhsJmpuIU$gxcod=nrGc&*cho|JR`=uV6m$32vm-x)XXHei17;C~6{gq?Kx*oZo zJqt}q4KK5vf~{AuBd(lZf`JE(9_?Za8wil<3*V)}$Btn8)Gk@gnsRl0-3=UqcP+fS zrtTAa1n~$(Sa-vIz8Epq?fSgL2~d_ z(FCh56Fc#PXHiYdkKvz(HsPO*zcll)*!XWonCrUlt7=0+2v4TZIO5{e)lF;baR+t{ z_F>&LrS9&P4vgH6M{@()kIfx@rDfX*-F2UTER!@}GCWjeXmyRP#SKF1i@U&_Nu7TH zqB<4B{o$()FcYfW!iT%+79Xbq7P4&WP`pb-@t9ci$=`~}FQ3Yp{*=DT9%c!rn|a-f z{>Rx>Kk=!;wFR`0!2DMGx|L(t3)Ve$XzYh**J#ufW#ONp&VjL;=O3!S5AV0q2+a@2 z2NOOG+%c;Q%0%0OvD%L@>sPm97`b7779XDQkh*K}hI8k3tU<^T%=9Sr^SPebQChjz zHp0s7Ielu^$6tMoBZ*HOBpS?J8@iP$`S2Mw4_wId%h{bUd_j;bU8C zSB^d1jqXA4a=)#+dvI1;`@>UbHTR7Ds10%-XnnkA?3JE9-APbMPXYBjzpPsq~KJ%5O`X2pQl~Z@)7vP5)Jz+0$X9Na_1#@7#%l-d+bx`M}1tiC);@?uCak zAM9E9d}hYPeCi3`F{-)0s%;m7gP4Dx1D5M{+y}BoB6KR40HZ4OgN5g>rk_6xK z57ZJgSuG2MGEno@W-S|iET>xl!!o;gQQd^W|xVrUg}!50L=-z&1qntHng z$^cl+u?zm>$s5OUNmYEXIsXT=^J839qaIO(P%|e3bLF0Ov#O4L5(}u%H)u}X_D7iB z(Beo6YIf`yiEcwBP^1(Juo&_e{Iq#boXmRB!G6uQzX-Tc0droiQOS z2KtBXV~^njEBZbs@?w%3PXgQRFFoiu)p+>}yui+|U#7CsmOS+ey-7O()HQsl9Om;^xQh8&FO6qJrTZ z)O8=m`LNv4kGYrU3av=b0ft(hsk2#^*yRjLYI(fzy%-;{Tl6Q#a3x_MDvnt}cddAK z{9Kw9TIxx&3eWr;8$g;t5UvdGHh<9KQ&8M$)%xft`oY|(=*)ZO6uS5HRPnRMm35up z3re_))V97%R*~C{=(X?1$q2~FObZ-4PZ|!2`g8~Spt0|p8T-G5s$f*k!Q8u$87pMR z6ky_{tE&8T91e<3=y|e>O>Fg@V?VzKf`=YMSC?YyMP&Xhg4iLyavAYpmt5%GDXMpc zd1y5lN9I?Fb-?#DMExCrW*iAuY<}0R=%})2kX*H37yUU10n;J1qxYRnV&EYK9ts6y zV5WTf_i{zxK2}$u8py|1BVObVV{7QJd87Iul%JC?3I(kh7b1^$LO6S-zO$#U(_`@P!9U@#wM7F{kU1#7?KMWgUACcq+(eN{`RtvG8@21?TOUxu&3h6a2t$0h$6P z#o^vy(fAjI+bJX4<6h&|4A;q{xjbS4ekQOPEUFM-vP=ND^NLP z=bvV~ukZl!(($tRd!1ts$w2glwPW9f*Xu7cHsqlZVzsRXt8Lw5PvjFFI4ndDU^^2H z&YaY;>%CAt>RSGU(T_sc-_CQ>=zpLp#tu?9-%Z_wfnMM_>vcDtN!a!Wu>x`2*Yn%) z!3{;s;@IRAOPzi#jWnf~gpOQEOi zY<(0Pvak}^F55J}{XdZ%3WGsU3+f2X70Sd#UAOQlsYp3;22aI8`+7D)MBl_ElHC67 zFVDz*W&6wT$)(YY9;j zoZBBw495HLMl1sQ@h#+t9lvvbJ*_{+29Ry|Q_%CLZl`<6Gm&99}-+o)aHVYNMR*$MZf(;a4%NN$d#qqzZh(IR)%`ko#q z8z1aNGZ{w#GAq(UHb%CWg0x_+T0VVA%xj0cdQDW;SOvaC6Zu@vIw7x&Y>fkc-ou z+!`GO1O0uFO4gr?Nog}df~_rv%+?mAlS;-*gajQ?`D`4;$q(id=|R*-Vkpks2T>7& zjp|B+Z0g8*`ZvA1IM#5pC*pqR;o1jOToB`5d#gm@$$5 zB!E&kyqNT{fxZNpkg$9?`x04dV9#Zjg2S`knwL>iee!QQ?L}1 zHMp^H=(>D79|wwgD2roi75|ovC8Nr(#)m6KWT_3#R*Sx7M}}ZVwjjMeRUk2#ifs{* z0MmOe%T9JA88cO=Pi3(-86u)o`dAjv=xL)5ohH)I*Qc`SuFa;BjoDl@m(MCQ#_q77 zYJtktMzpWb#+zhbJ24Ms^Dx=&Nj-vc`5%-}xISSSES`NV znCu@R;m*fi*su@S4-1F38-86BeL*~c>J8XJ@GZ75Y%?Rj4! z-ncE18)!_k#I$+QY$GJo*osGV8jYxc(o-3N?daw5$t}s$wj?_lWriuSC5e59eJqm} zEkB+aqLq@cECxG#ATTH!9~*#gz-$;QM!0&Csa#`}YLrJOI?}iazCvGAx`Mv=ru^o{ zR64iF=}%>1aXiM8(OhFc`jSo2*cOEv!;3nO=5m=*WIB^bf^s&C-mkB53k*06RZA28 zbJnX!Xo)ln7ky(st^)E9kT-f(_LkFK{G7S7v**mtHnJwO>1a&+i)-_a-QuNvs<;%{ zR30psI@-|DQ8w0Cj0r7}`t(9uW1987I9$;zcEN$o;sE^Ws!D_k+P z|8?m#rILdqfx;QKr6co~IU0+hsi7?J{QMajKr?!&W(5c9poFe)+Zkv=aVE9D4HEDn zLP(}#-V#e?;uX;*MW~laT3jJs*-FUIF4i_(STYRq<;q?OiEKL~zXrJw`f}qkFGl7u=^~)57 zo^@P2Q##kdMxfHC*TBZ1twvvk8C99TREOV?oLoS`m1Y#ggiUcv=32N~pNtQuC-Wtda`w|Q`TISeDb;U-q&Bh)zvpw`f>)H2IjAU2ibK;WOW@^9F zg3*T=^EAwHvWd-9yP;@yO9)pT;&dV%KM#mYXiiv-=xSWgkXZ(2_cg=Mm0B@5qO#Es zYuVP?QINR9=UMPa#5kT48%PZHv3rtHmopv1E{w%OP*VlA-6S?Aql0J(=@do>X24@X zHZS7{CgkOqe7_MQW=htis(qQ zn;nd9jpNeQp|n4)G@5nH*kMyN8<(MFK)T%YYefW2vg1d{U1Df3OZd7;*y1Bc>xnmt zEo}tjeju$TVd=!yR4zh-%1g7`Kz7iVW~bkyR^0HI6Ye ztZH>bBj9p#COVY$2Jxy;LK78-TI^cAveW6ktb>F0ESioCQ6e0zl*|fR=N2&-)TCDQ z_g0bUU3+FGkxb;=ZP7#y?S|>Mrb(fMEMf_yFx-^dkCV-zSLDB`e2xL;3!G#g+Wz4< zhKl`s%4edV#>T5%%#N&VU)AAmXkW8Tz|*HYbX&|!0iVkJdg&&)xdC_#oKKLZ?9C~Z z!FNppopexiPCU3vJIbO*GtfrNx4^}Ne*;&hk3(SCluT*}X-X6@qwt~jp7ot!DzF4h zv2{bs)ohx%fw*zj6nj$~l^J(4`DBu6%xF~-CGDS(2+{7%#Nkq6?x<;VlY7y;i%GvP z5#5}GyPk--@bW0`tP)b4#_?~h`-M9Fz` z5n*Dky9Ul|A}M9TTm{>@k7h#*<8bkDFf{}#5_dU9KrQ?Dn-gMLno%$x=?LP|4VXq| zom#hHC_3V9!h}ygml{H65krAT+{93NFoDWT^owgr>rgHi&Qtg@s+Y<-6rF1D)1fi6ugHS@( zmvT}Kg;HaF>J3sewi3st>kcIL<*Tu8oH$S&Z;+VP`roP!aRJJ<`Sqwvu_s}*g5Gja zQbB8p?J1N{Kd&75_Wm4t1ekVAD`mZ2zf68}O&bAOSXr-$2w|cCt}(fxf~q zD{FJt+X@KiwA&EP>Ik!>aIE%xmJO|BK9I_*2Q-=W-DU0il6)4{LEJ61R4N6xArrqY zpUA|sKAIvpc*J(n$7Vp6Y}p%TK#cz%8F=pds`izko<&RGVZ51Ka#_o{adSGl*97!N zUX~0*lbbPUfed1~6wD!d6(DNG+4-x<>DY^~uS55OX{|&imE^oVI=f7Q?uqS&fP-lC zerqQ6m(o=x%cj=cVMa^IgDhz7Z6ncLm1*o{5A{;yyihA z)?Qkfu~VL9w0K24o;FqllMv!h{TW&^wXt^1lF5v@i%YW}^bT0z;vTz1S5}oHQW29m znNsI<`RE|4(#-F>oANmqgBAE5oNGy9Iy{j@#pFm;sbQ!s)A*86P+)I{r@2&x)Hb$G zP)cCB#mrcQsF&f_$E(M~o8VVxyUVcq#xnFzy0Dnapq)IYM-Y;yk3pO1o8V7s2l@bg z2};v7{E42FnjP$ojO?gEMj=Ctl_4edQkf1*+GyvO{6+PaePl0>YQp+4oHlx+>4VhVHJ1_j zvej!=(0++1SIVGP(aka~;d4#LX%c|>VEf@5hfL6Lp|MXg@i930(dG#MH9nNaYNxNR zjJKPG2WAR2g2puDB1_3z3*Z|8hvodn1yC+Gr(}qLML0~6!o(Wy6IA=HafLRj5W*R_ z;T$UILTO#h?P*`!+2fN#CkLT29+kl-r5W@cSf6GYZBp8$G^M_@kYFlLp{Abu7 z6_pJ5!>z=yVhY0fA0m}1TT{YfOe(vUp_GzH!A2!gET6EH%pe65>a<`vUP}o}bBDyU zoMIlKTrzO0t}bU9Fo)?&BU6QC3<%St(j#_QDkDMPgu0J{SRpP5PPRi~3X&N*E=*0K z^OJ-_Y-kup1!Z7OWf`(>Ow(GEHzIB)b3-qiCG5CabFn;|-xpk4e7kYZWUNm%Cu>~Pj= z5EFo~HzIU&?35+zDY_MII(gJ`(|Jv1y;W5|;mH))rh~%-@q0jeM9JBO*fL_gOlG@@ zkm0}^IugZt7^i1S6C4~SV{!n460q#ep9EKM{VckMXepUl=QXKmV7(n2%h#@6g-$6Z z+eNHFgqg4_l17N7e^q&+GKYXs*$`HrAX2k@={3>75@so}>#j%)4rYz2t?gd6qPwTZ zmC0hUN*p0I=!DiBciR9q>Bwdy7hR4#yw@AdV3jo6q}kc^QGY)A+>w%b3k=zE^su9> zZmeB+xyd9-Z+FL{R;9(YQD~>Tq`fyxt{q@ROO)_tXP+QWtUGRnsosn>PCf7uVF@PMa;;EVJ6>Yu7Gc^PEKf)?%?J(a(7^)AgC9@>B{vIjpPOfZcNL#V-DxWAICp z%V3n-%`h8GM~HK9bd1o<=)yqHILbx`6~`6>*(?{{CP!O~c}L{j*}V!At4(f07p8hI zG@~kSj2?B(QWV{X{>0{d1_`7oELpv3Y4rRY&5ENP3-LtN9O_Olm)YM$s9@uEM z2l^mQF;hH;$}SUoP-H`DEk@NmNdes;r!?MsZdic(-^(lc35LmrgkII}T9V%=$O z$e@R3d`uYvK-gvzT<35s9`8dLvFMN($`858{Lm&?0T8k{SP{-U*lNK^YSyk!;35s& z>k<;%jpMAQUQi_lqp}K*v8veZZ7^=K;lYjf_hTABn8ZK+onpEnBDA;8x}RoSNp2t$ zM`4tG?#8h3r5en+*b;->Nyv+rJ%Y>+dgrB?yj3L_|K@12EVBR1vND-$Fn%&wZUPCj zDkAc4D=V|51av8Pb&<>FTXN4-g5~$ziTx|PB}MrN_xfcr6FG!>-tuVR+iJ4TfHe>XOA=oy~GSG+{D+lK&8lygY zcwX^RF?6GzV!Gafzah)=a#PTsBWv-LtW2bEWz5$sH;v@t)O(>P%j#lD=g{~LCWf#* z0Jaqif7o^`a`5jp;zG%v=c)7N+oz@5M#48LpV~b%$M+D<`_#1qHUS-&|Sg|ytqL9nDg|$ z08rP*>l_W+PQVpewK}q@^Rh_qn(hy+_4dH{%O}iM-1ovwF@|p}9K#2DLqyHr;J-0l z?x%TEbcv`xyKqq&1$v!YY2}1n#+$*nn{t6`=~_MDZhwsYxF{-ZAx!+ghtH{D!w|MQ z2KKUx`&ed?M%j0oxjO?Yk0HEl(kSiCXyz*Z5Ecsv8QSx!jfxA#MEO z5$YR?0?n!*Mq|`S3!6Xi3#8+k(Em<4Z>gtTV(gy_=i`kg%iv>`tTH~^qkreOHWnG^ z#D3&?UC6P1CTyt-7XwIXF zdGTlS`!ji!HbQY)(p%Ej?ND>k(Qo18_?r<)uq;{SWK}9KDu(S=(VN)|FUL2Pl`PAM zuM!&UmpIQhxvMb(;l2{=F;2jhkR|FE9w125Zq)I6FPa)YcG5a-$|p-iWm{A-8;K3V z30TznUThbp6T%8CC#MSmr48qLQ5su9&?}W`m+vdJ_?-Ct`mhuVs z8W@m5hdHTgRm$Thh^O9whvwftCw;%}FLN_2EZi!iEsg^LN!MQbDvO4Qbz0u0sO*T) zRL1DIi?F+kKdEg_s6lNhx{#J&mzNpr*;V$y2pj2r`#!yqD}52JTFD?$`bqd=D42K$ zz{={F`Vyp{WPjBpl(F|>^SpkB%;WbH9F=GPeu2}!{@mY7z_))jI9b0IhYH%T5oc-I zzo&2>r~Uglj{o0{^S*zGBR==xZxDZ@IDU0L{&@B-|GvHzeBcn%D{$KNgMb_E9PYKt zrz5F!gu}0hxODt7PvMZb>?Rz-#HC5WQ&srOYy%36m84+5=p?wcFB!piHt{T8F7lpd z%SU;$^B2y}yR(yl9^6X}Ly?R-SdNW57tQXw*nFUPq3f*8%U*B9Wa(8T;md8szg((8 zfEI;MGXP9re;OY%@j>&Txs*2aHHWw@Kkva+WZ}u1_khuiVBVW$dykP0-ZmtSq_S5# zoTZ3hMh9c6hEjaX)lKq}hSko^MW2UV*IVO#5&Dv*rCNVS(C9&D^P9|b!|d!Fm~gI8 z(;~=+iqvEF*z{cumhON>!|?g1s3Lk${M4zz*P-C+u~l&6U{&xD1W!-GuS8Ea)G~t8 zB!;+5^oQ~6PJLf~LeKa+*ze9=6K?-t6yGxX=||IP^ZP! zeZ~41^=j?fC2Kl66e^<+Ael)`6(k)Haa(hFe2FCMe;Ttj%N`%!F0%rAIHNJSSN0}v zmkh+QL0RS_N?m(DU3DyIHKGUPKq3o4CSv@wcrL$E&<&ieE&OQ*FAK@yM+9a#VF$!d zLAQ!oXYganslF1J#L7Y(J7n=q21Wam_w;}%h#o}?`4$LhUc}@8Ngrkf{cpJj5#$xdh z!aETb7&aA)ynS@Ixma9>@BqRz!j}>5MtFHkv3M84I}tvJuz>J5!`5PP)-=bNi8BJ* z5FS7{%=h`|dl4@9K(RRU1l(P5J`U1DcnIMr-*FP$VT1<|)`Q;z=z9+!JhZJ?`~$+m z21%x?-HJ`#koCv!R^1k|A2oE8=6X7!m49(5BweSN4VhD zV)12!cOq;#8T|YMr9d83Cjx!5?^YJ(E`s>9O z=!#QYzqEGd^12z@YDS$)&b;t_^JYm8&h$K@Iz0`%BeXxlbNCwo++}+GF|XZxo>MF? zVc1byf9>?zn#D8L)I#-~nfSX4e=UfACqk#aw!Xc#W<@RKgx5p(n~ykg0~goU@2>8s zowK)T-8#-!T#DD^bFPqT^NV^Zxj_ic*KF}L@U$OWQ z>2=h$Ro{$)A(mwtMcmo27Z;hh`h%lvDzPY-ycIGEpAA6>D);8>(wxYIW=Lzk#3%0*)S#59i z|D0aC0PLZrfZ^3o=Zrky?UUfhgDZWs=ksBQd158=*uy+_Q!YEFE~#zUKCQbJroKvQ z7-cqf4phpi18HZ%RzHAeBU3bqom0B4oQC~!S~f${3?t1qkmhSlv%0o^XEoAnpVC$9 zR$nI~g(%t&KD+`nrtC!dsh4*lO&e_g0v9hL2b50bu$Xc{=~NCKwR@|k{B}yE6617o zka!LBT6&AcJMiqRsjdHH^;+urO6qwB^&IrJpHRIyq}B%?e(ZbS??sY}&bW;2l= z>-HJYd^uSxo}hL6N!G2uJxe)ZZ2}FteMT43y68tAOBIXnLLHbgita6??v<1IpQ_3! znX!d~ptbM1V)1qKai(nL>aWx2@$srD2dZmduIjBFt-cIldo3W}Eib*rGekcg1O2wY z!nm5{6xj){onAXZtJrx$_4OzyU|!2uI^$!2psfJg=ryD_7bMPxkI?c_+;YdVgPy-l zKtI?fMj6E)WknyO_hZH4D+H9&2g!elDc|9m>V0KZp=(APlHUqiQ%4~yFK_6D4>=e+o3lZzvYOglDIl`YrX2vhSW+4QoAfnb$3dy*&y2 zQQP*(w#!BG2E?sH+_@^--POx$k5*Oxdb*J4m_b|K1DuUJ)DCpAO%uoT0RxCT{l;SP z`@nNTaXS!q2ywhEfN^O0C|#BCv=4EE@V`i3<5tq1^8G% z?^-hBG6V73vlh_%4e0Fyy$6&Z@e$RZSzbF{RlVEaQLixeAIw~Yam^n!%_Lt?cvx1u zAKlyjw(i>Tw(47_i<9AJsY_@Lg4S`+y33KGE+;Q4tC4{%TP+Fx9K#D zZRrKAxfu6dMZQ+l?yss|44qsuqXDmjh)W~x4#t)ANJPH^x?>#4r8C$rZUycifGd5r z@PzXD?LT>9zvXWi%Z+dK1kxVDSaX_Zt06kA=cTp#s;Zy#*K_*}7x~p-eD?*6H$RPM z+S%>ZAA&2k9_F2nnCTDa0>{PJGfBE)!$EgD{Ji~DQ$B#6naXdljs9K*{EZl!ex5W- za)li#`IPk917+x<{~LhNY)gN97wC0sK(Q^S1LrB=I~e=^1@U3u zJ_JijILERaEBoQJCnsSnTMszv%0Vx)3PUFLC$zH-h?|8tbRF^|>>|M25UdxlvjKaT z53dif2Edp%f2`kOz~%#XGXW*pl=}DOW>mnI?dcr+9NLv{Anh)s-LLh#hq|x6y7(o_ z;FnCvqecR$J)8Rnq<{C3Ky1>^YJFmG^LA3g+vKB&gk1}sSg+GD$ zjo;y!d8y1x^|h?_PPe=ExLf_Dklfn zS$4W-RDS~zux-nNqq`oqk+*(tN#HFByd{CRB=D95{;!q52E+L{Zo1`fK@~ep$GKR; zP7MW!e{ijoJYK5dhcvuO!wnk7G_>h#xLM&_G#t_Jqapmu<&tQ#R?4&u&l?JM{^t>m z$5fmAzOU~!`u>EzJBsk6eOH8E*muX36uDdOY--26L|k>GNge~94l`y6SRaIp>v)ocfE$LhAkSlY1pgbMh(*%j%v79!+jd=*Kl0J!x|pd@VJJK zEJmUH8oC;`XxOGW!=oA=*U*s(RphUst6__VZ5sA!xKYEjhNBwp)o`DN z`!yWb@UVtQH9W4NbH3KUhOUM!8n$WJtKmis(;ALyxL3n{8t&I{T*Jc}9@X%;hRy|= zzlN@cEgH6IXt3V=zcm|8yM}#v(?3%G(tnve?urKO!gUJ&mk|8pp?=MB_&vq{Y6$uzx|9?YpOD`Of3JX@XY{`-f-G=p>u&pNVwzf9SZ)$05&C6@+_2-?})H1(m z-W-hx6Y;&1-c;xJ-abhiMf+ZbnB8jcU5z*mVL5!pS7U~!Uj2?Giryk12I7hMTl|dzc4nKv*(&&_IjflWZ<%{j>o4I zel%v_517Dt32@4xEhLANpbwP8{yu~FHN}4~;Ka{`>g8g^Psa`70@s9>D*kwg{sw`c z>C}hh)35l$A^e=ecZJ|LDBRi)6i0r4qwudNzJ-5D;nsdw_&o}@_Qt{=Rk*ch7XEJv z|5}Lt?-c&^5WJ{xYcDOGQ(-SC&jX=y{iVYHM~KdRg?}RiU#;*_g9i@IcPjh=#oxHo0Avpd9uEutsm=nmKbWeQ z-?IWg!)eoTnRUm1uW(o4c3ktiz|V4yDxbFhnlX*?Kf@VSd{^neOWMT|M@hZO$;h|jr8wH$l>(%kTqB}8#kA~n|6>jGTEdFl5*?t?8 zA6vh-3j7`3c-G>7Tj@C3|62HW1^?~d_}IdK4R|^JUs5_7zi2RJy$+8jU?5C6?^8Lm z-{tQ#z**k(?dDzf)!^~Hf`6t{P(88yUo7xbo!<8wi0zMTKh>si^px^j2mEq;UIRGu zb^n*adqwe+LjNph>Lx?q*1OF&&5jj69o{>`73hyz`u}PO)1Tn)CWRkX_-q4qEd5Sf!8}nzhn5hOL?8BfPVrMpj^4m6*$WE zb3@>(DyHTN_&pWi5vAjN&(Kl#+8L^V|M3d&zXjaYviO6q0e%YXlB0GBukw2l6Ll{1 z%2B z1^ju6fAmKN5!ENZi!0z?s`z{VhryFQdU(950)EEgf7jsu)&$PSE8yR1@$WQL9T`3{)C zIT`bw>-`*s%d6(kIaUGx4iGO# z|FsJEb(qL5hyN~t*E=mwn3CSC1%7V@e16x#dQ6WS#P=vZH*1umKLEQ?4!&OLv^{PJ zd|v6qE6^FP0RNi`@Y^fE@2LQPOyH2ixM9SuBRo+7|5?SaSGk?8{J*I1eM+ZI;jdSq zb4msIyr%+ufxyupse;T>`fU~P*H(b{Re%pyfZtRB{?8TQcUORaw*vfU0*Cw$n*x1W z%k>AqX&=JH7dbrTR?A&iC4^E~tRN zyaN2H3h*rHGw0)mvi0Y05PZxdh4h@?ah2oqvx-0Zn4vSGjDDp8{(}|ZKUF&W)K6$o zI=`rZ|6&FBiDLgT%DK-FkbUTQJWb)FO8+mE{<|ym7ndmhVa2z8%cT|Y`v5-$?d3Px zpIUkH`?hj&+gSm=Pw1TGoEY*$?ghLa{z<*Um3`;iLI-x~VFMY|i0>*qt^K~OmshpD zyEg5T=PaEE4XmJ1uT;Q438F7oUha!42fwHSycckmH|(EWRRKROaQM9! z8wTaO7(C`H;P0vc-&z6w4;A2Ft^ogL1^D3#@MkN)Ullm~w;z~t$zEMNo?O9ibOny} zg^-@VuLAzXitl{O(Eq*(oV5z?eZ&ABS9sLYf5-r2-#i`%6ns}m!B1*=n=9a7qWH(Po#wR6%PZh-r~n_T03QXM{m9E9KYw=x{M#$Q?*ZIZ z-u%IjD&Rj`0scw__{pc0m*+VGhkvf)P3w2fRruj=7;fa-D?GMWptA<>bNr0!^APc? zVH8_}ky)kRJ8t0CFa3zZkN?QP-=)d^THyNP3-(oje+_UM?}zOC;}!6KEpW8!?-}BE zXdW*p9XB*@Py@%9ep;{21K6^^Ti`wh?c>^5CfC}Oav~8N3yY&tHsjVad)OR~cHq%6 zI01ymsNgUeho`LqgyZILCP73mBa7hJE!^{lGqL*naBM^bCucfxUs~yO8aX=B9K(TI z4s#J6)e{+%JFIy+a|CA#M0j$KMB;%oBB@M7B5`IA@0!-6 zCi_4Z=Tb*_h8u1M+Rw+iCu=1deP>13V0 z{7^a~XNQ=BeIs&Mwv;zwj`S9$c^s*}^8lXm=ki!yA~>6`bKSZtB1_k=TEg4pB9W$6 zC!WmW7~lvG$%#aBO*j}ho5M{3X)rJMD6qT{oWT|uilzgxa`>OfB>)Z;jTP9G$Y!FT zC-oSLcX;ZdIrk%?XGBJD{{^Z$>+mS+05HaLFK~Je&IgR}#NLRxOCv6_001}HOBy-l z(>(H&5aL>tY=nmk%Nq{;;AQpTFc)|?=cq+^njW>rqVeW=|2s~)2)y$Sdw)C+otjJp zzyOxXOh9tUkhxisbo6j4Jrzta%w<#doG^QOl|(_;Jy97kkp_=EQjO`oD^8ju!;m=R9zcyYdnY^cstMHLZ~i`jRGUblhABAFYy=raT1|o!j0cjKE2$&)OmD|K zB`$)qPa@J59Pq}H@rFvCfMrj*D%Y~kcOYlBs%+DI-UW%{$mC_7Lv|y$|B)5p#HjSN z12J%#$u@m}hcOMZ!8wfKb+M-W_JuL!@>_sY&vMxu4ugRK#i={-&Ag!q8aQMQl*=Mj zUn;VBFtrKv`*2lNHWJMbg8^LihXWq_&_K&#Ks}NPG@(p%Bm&EZR?*KRAtNwRLnBDy zdxLNi5T*}xlmBq67;dV;aZh>-mLumnNpnQjqH-Ez?S(luiDxxMypu6~)RrpYktJNPhr@-u zqy#|@rmyEIzC8CS8B31@Fa#FjIns@zw@M9X-O43AhjE>pd1|h74U-5{4QUB;Mt2IH z=Q%^X06mx<-VIL03c_pxCym}F5G8Jl*mDO*yTW<|V%f~p(ZSu&<`nM$!XU0}F*1?v z59W)9G{HUwuu5cTg0+?4meWD2L)sU5iRL>ruPNMT+iz|wiFZEiFvbBK2#%_^)rrJ~T~D1%=WXs7J};1je3-iyO@9}W1Kb>*0tTy8I?2j7Qt-Fp z^wWaMES8S7hLg$y#KjN=AZRo>9NR{nMuSfbdXe+3Lq%tknh5vFi)8t!6azt3pzF!Q zv*f5wA{gJ7olLT%1+DWvV?~@vRIIeol;q4TdbaUWbue$Z+gWthXdQl*wN~PjI8B%f zyFKNT!@HAiUnXy7i#rGTX^o^72=OL>oR1lWf3?b!4!U`p111v@&n}^Jp1Zoz+b>O(8K0qqbFKV7k!DPjU z15qONV8)PIHWe{rEb)w}NnRq@RVl6qKpQEE+=Ghhcdv%*aXmM^=RRlH8US;Kc>uL! zE2BA78-_#WB#NdDS1g#2LrZVGN!P%qEAyc$X(S4y@Ej4}_3F}n=|Ri%2}N9iRHiRb zH4{5y+F$@lTuNB+2;7fUY~jL47S)>U_i!#i%+_eOOy9gf++tYHnDuZw%O=?@g5JxCV599PSRR*bM(Rk_-Gh3Zvj{&vMHO@rbQPe z+^@<>w79Dt{y-pI8V+dyzz#3~pqu8aL^9kTOXddsum#f5p{D#mAW8*=U^Jj&8Q4b5 zaf)bDVS#0$+l#v_~Pqu5V4mv(TV%tPvfGF+4Bf>W4G(mDWU>G5KW(f!ElX!P&rwIph;{^6(zKOF}aB@a` zpiTM2U|%Cf&IYS}ad#sp9R(d0Y`|&i8%ZJy6Xr4|MrRrWFA>D?z-T7Wr}SXXX%Znf z;jw9R3a@;?u*hl3VGhe_;t(3xDe-2T;sZKp9_Rx#`(|jE(X&ZmpP7o8f`Bj>9ZG<* zp#{U|VE%20mq**#)&K1fJHi|;Ayg}cnN!Sz4eh+NMhmWeW_T|CxOQpNFVOTh3{87` z-#0QXf9K=RpMF5o+tAL(3o`z(>z?+#JCxpjZ(~E(B5D{;e;ME};#*0}|9;Kih6^;^ z2^!XDXoDyoum!{`zy03ShPxPvAInHN+w^uHQvxt%Y4f+=ui9`t#4u_2f7js!pEG&< z+wVVZ_@W|P{%t-sydLrVw$#4c?@MhsuIa=4E7;kC2eN3>+wWa%cwFUa^ADH*?=}5m zC1}5&wW0mqmg(P#zi|4028=SX^u2W!RXpmq{}&Rca~mT4>0M1{!xk3Y_p8@u8{UC; zfBN1F41x_Uo+V-5ZMZ*_exs(hq5Eg@zbBO5u20+WvtO_|o6zQKq1-;_=ih#xZ9{A; z3H-wH<1#JN+xoZrJ#2V~u9sUP;rzMWFW&} zz%W18K4>@{@zi~r-tOOSS*{6HepZbv-&QPNL0W(Q_Ivl19+UpCC9L_`^fo*VX#Vux zey(1Vp7QbkT>lH6-w8C*^0Lu&#@}oDKUaQ!&&HfuLUe8V#t__aWzsN;?;#bF6z-)4 zvrQLZ-wo(C{Mm9_`+Xu{9`BOU{IgLP=3B8I>i^mNEey;5Wz&D^27~$DP=e5_^Zx-b CfsMTY literal 0 HcmV?d00001 diff --git a/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/studio-mcp.cjs b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/studio-mcp.cjs new file mode 100644 index 0000000..298bbdd --- /dev/null +++ b/vendor/robyn-mcp-workstation/1.2.1-8acb4493e73b/studio-mcp.cjs @@ -0,0 +1,40082 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __commonJS = (cb, mod) => function __require() { + try { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + } catch (e) { + throw mod = 0, e; + } +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); + +// node_modules/@xmldom/xmldom/lib/conventions.js +var require_conventions = __commonJS({ + "node_modules/@xmldom/xmldom/lib/conventions.js"(exports2) { + "use strict"; + function find(list, predicate, ac) { + if (ac === void 0) { + ac = Array.prototype; + } + if (list && typeof ac.find === "function") { + return ac.find.call(list, predicate); + } + for (var i = 0; i < list.length; i++) { + if (hasOwn(list, i)) { + var item = list[i]; + if (predicate.call(void 0, item, i, list)) { + return item; + } + } + } + } + function freeze(object8, oc) { + if (oc === void 0) { + oc = Object; + } + if (oc && typeof oc.getOwnPropertyDescriptors === "function") { + object8 = oc.create(null, oc.getOwnPropertyDescriptors(object8)); + } + return oc && typeof oc.freeze === "function" ? oc.freeze(object8) : object8; + } + function hasOwn(object8, key) { + return Object.prototype.hasOwnProperty.call(object8, key); + } + function assign(target, source) { + if (target === null || typeof target !== "object") { + throw new TypeError("target is not an object"); + } + for (var key in source) { + if (hasOwn(source, key)) { + target[key] = source[key]; + } + } + return target; + } + var HTML_BOOLEAN_ATTRIBUTES = freeze({ + allowfullscreen: true, + async: true, + autofocus: true, + autoplay: true, + checked: true, + controls: true, + default: true, + defer: true, + disabled: true, + formnovalidate: true, + hidden: true, + ismap: true, + itemscope: true, + loop: true, + multiple: true, + muted: true, + nomodule: true, + novalidate: true, + open: true, + playsinline: true, + readonly: true, + required: true, + reversed: true, + selected: true + }); + function isHTMLBooleanAttribute(name) { + return hasOwn(HTML_BOOLEAN_ATTRIBUTES, name.toLowerCase()); + } + var HTML_VOID_ELEMENTS = freeze({ + area: true, + base: true, + br: true, + col: true, + embed: true, + hr: true, + img: true, + input: true, + link: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true + }); + function isHTMLVoidElement(tagName) { + return hasOwn(HTML_VOID_ELEMENTS, tagName.toLowerCase()); + } + var HTML_RAW_TEXT_ELEMENTS = freeze({ + script: false, + style: false, + textarea: true, + title: true + }); + function isHTMLRawTextElement(tagName) { + var key = tagName.toLowerCase(); + return hasOwn(HTML_RAW_TEXT_ELEMENTS, key) && !HTML_RAW_TEXT_ELEMENTS[key]; + } + function isHTMLEscapableRawTextElement(tagName) { + var key = tagName.toLowerCase(); + return hasOwn(HTML_RAW_TEXT_ELEMENTS, key) && HTML_RAW_TEXT_ELEMENTS[key]; + } + function isHTMLMimeType(mimeType) { + return mimeType === MIME_TYPE.HTML; + } + function hasDefaultHTMLNamespace(mimeType) { + return isHTMLMimeType(mimeType) || mimeType === MIME_TYPE.XML_XHTML_APPLICATION; + } + var MIME_TYPE = freeze({ + /** + * `text/html`, the only mime type that triggers treating an XML document as HTML. + * + * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration + * @see https://en.wikipedia.org/wiki/HTML Wikipedia + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN + * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring + * WHATWG HTML Spec + */ + HTML: "text/html", + /** + * `application/xml`, the standard mime type for XML documents. + * + * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType + * registration + * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303 + * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia + */ + XML_APPLICATION: "application/xml", + /** + * `text/xml`, an alias for `application/xml`. + * + * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303 + * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration + * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia + */ + XML_TEXT: "text/xml", + /** + * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace, + * but is parsed as an XML document. + * + * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType + * registration + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec + * @see https://en.wikipedia.org/wiki/XHTML Wikipedia + */ + XML_XHTML_APPLICATION: "application/xhtml+xml", + /** + * `image/svg+xml`, + * + * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration + * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1 + * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia + */ + XML_SVG_IMAGE: "image/svg+xml" + }); + var _MIME_TYPES = Object.keys(MIME_TYPE).map(function(key) { + return MIME_TYPE[key]; + }); + function isValidMimeType(mimeType) { + return _MIME_TYPES.indexOf(mimeType) > -1; + } + var NAMESPACE = freeze({ + /** + * The XHTML namespace. + * + * @see http://www.w3.org/1999/xhtml + */ + HTML: "http://www.w3.org/1999/xhtml", + /** + * The SVG namespace. + * + * @see http://www.w3.org/2000/svg + */ + SVG: "http://www.w3.org/2000/svg", + /** + * The `xml:` namespace. + * + * @see http://www.w3.org/XML/1998/namespace + */ + XML: "http://www.w3.org/XML/1998/namespace", + /** + * The `xmlns:` namespace. + * + * @see https://www.w3.org/2000/xmlns/ + */ + XMLNS: "http://www.w3.org/2000/xmlns/" + }); + exports2.assign = assign; + exports2.find = find; + exports2.freeze = freeze; + exports2.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES; + exports2.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS; + exports2.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS; + exports2.hasDefaultHTMLNamespace = hasDefaultHTMLNamespace; + exports2.hasOwn = hasOwn; + exports2.isHTMLBooleanAttribute = isHTMLBooleanAttribute; + exports2.isHTMLRawTextElement = isHTMLRawTextElement; + exports2.isHTMLEscapableRawTextElement = isHTMLEscapableRawTextElement; + exports2.isHTMLMimeType = isHTMLMimeType; + exports2.isHTMLVoidElement = isHTMLVoidElement; + exports2.isValidMimeType = isValidMimeType; + exports2.MIME_TYPE = MIME_TYPE; + exports2.NAMESPACE = NAMESPACE; + } +}); + +// node_modules/@xmldom/xmldom/lib/errors.js +var require_errors = __commonJS({ + "node_modules/@xmldom/xmldom/lib/errors.js"(exports2) { + "use strict"; + var conventions = require_conventions(); + function extendError(constructor, writableName) { + constructor.prototype = Object.create(Error.prototype, { + constructor: { value: constructor }, + name: { value: constructor.name, enumerable: true, writable: writableName } + }); + } + var DOMExceptionName = conventions.freeze({ + /** + * the default value as defined by the spec + */ + Error: "Error", + /** + * @deprecated + * Use RangeError instead. + */ + IndexSizeError: "IndexSizeError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + DomstringSizeError: "DomstringSizeError", + HierarchyRequestError: "HierarchyRequestError", + WrongDocumentError: "WrongDocumentError", + InvalidCharacterError: "InvalidCharacterError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + NoDataAllowedError: "NoDataAllowedError", + NoModificationAllowedError: "NoModificationAllowedError", + NotFoundError: "NotFoundError", + NotSupportedError: "NotSupportedError", + InUseAttributeError: "InUseAttributeError", + InvalidStateError: "InvalidStateError", + SyntaxError: "SyntaxError", + InvalidModificationError: "InvalidModificationError", + NamespaceError: "NamespaceError", + /** + * @deprecated + * Use TypeError for invalid arguments, + * "NotSupportedError" DOMException for unsupported operations, + * and "NotAllowedError" DOMException for denied requests instead. + */ + InvalidAccessError: "InvalidAccessError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + ValidationError: "ValidationError", + /** + * @deprecated + * Use TypeError instead. + */ + TypeMismatchError: "TypeMismatchError", + SecurityError: "SecurityError", + NetworkError: "NetworkError", + AbortError: "AbortError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + URLMismatchError: "URLMismatchError", + QuotaExceededError: "QuotaExceededError", + TimeoutError: "TimeoutError", + InvalidNodeTypeError: "InvalidNodeTypeError", + DataCloneError: "DataCloneError", + EncodingError: "EncodingError", + NotReadableError: "NotReadableError", + UnknownError: "UnknownError", + ConstraintError: "ConstraintError", + DataError: "DataError", + TransactionInactiveError: "TransactionInactiveError", + ReadOnlyError: "ReadOnlyError", + VersionError: "VersionError", + OperationError: "OperationError", + NotAllowedError: "NotAllowedError", + OptOutError: "OptOutError" + }); + var DOMExceptionNames = Object.keys(DOMExceptionName); + function isValidDomExceptionCode(value2) { + return typeof value2 === "number" && value2 >= 1 && value2 <= 25; + } + function endsWithError(value2) { + return typeof value2 === "string" && value2.substring(value2.length - DOMExceptionName.Error.length) === DOMExceptionName.Error; + } + function DOMException(messageOrCode, nameOrMessage) { + if (isValidDomExceptionCode(messageOrCode)) { + this.name = DOMExceptionNames[messageOrCode]; + this.message = nameOrMessage || ""; + } else { + this.message = messageOrCode; + this.name = endsWithError(nameOrMessage) ? nameOrMessage : DOMExceptionName.Error; + } + if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException); + } + extendError(DOMException, true); + Object.defineProperties(DOMException.prototype, { + code: { + enumerable: true, + get: function() { + var code = DOMExceptionNames.indexOf(this.name); + if (isValidDomExceptionCode(code)) return code; + return 0; + } + } + }); + var ExceptionCode = { + INDEX_SIZE_ERR: 1, + DOMSTRING_SIZE_ERR: 2, + HIERARCHY_REQUEST_ERR: 3, + WRONG_DOCUMENT_ERR: 4, + INVALID_CHARACTER_ERR: 5, + NO_DATA_ALLOWED_ERR: 6, + NO_MODIFICATION_ALLOWED_ERR: 7, + NOT_FOUND_ERR: 8, + NOT_SUPPORTED_ERR: 9, + INUSE_ATTRIBUTE_ERR: 10, + INVALID_STATE_ERR: 11, + SYNTAX_ERR: 12, + INVALID_MODIFICATION_ERR: 13, + NAMESPACE_ERR: 14, + INVALID_ACCESS_ERR: 15, + VALIDATION_ERR: 16, + TYPE_MISMATCH_ERR: 17, + SECURITY_ERR: 18, + NETWORK_ERR: 19, + ABORT_ERR: 20, + URL_MISMATCH_ERR: 21, + QUOTA_EXCEEDED_ERR: 22, + TIMEOUT_ERR: 23, + INVALID_NODE_TYPE_ERR: 24, + DATA_CLONE_ERR: 25 + }; + var entries = Object.entries(ExceptionCode); + for (i = 0; i < entries.length; i++) { + key = entries[i][0]; + DOMException[key] = entries[i][1]; + } + var key; + var i; + function ParseError(message, locator, cause) { + this.message = message; + this.locator = locator; + this.cause = cause; + if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError); + } + extendError(ParseError); + exports2.DOMException = DOMException; + exports2.DOMExceptionName = DOMExceptionName; + exports2.ExceptionCode = ExceptionCode; + exports2.ParseError = ParseError; + } +}); + +// node_modules/@xmldom/xmldom/lib/grammar.js +var require_grammar = __commonJS({ + "node_modules/@xmldom/xmldom/lib/grammar.js"(exports2) { + "use strict"; + function detectUnicodeSupport(RegExpImpl) { + try { + if (typeof RegExpImpl !== "function") { + RegExpImpl = RegExp; + } + var match = new RegExpImpl("\u{1D306}", "u").exec("\u{1D306}"); + return !!match && match[0].length === 2; + } catch (error2) { + } + return false; + } + var UNICODE_SUPPORT = detectUnicodeSupport(); + function chars(regexp) { + if (regexp.source[0] !== "[") { + throw new Error(regexp + " can not be used with chars"); + } + return regexp.source.slice(1, regexp.source.lastIndexOf("]")); + } + function chars_without(regexp, search) { + if (regexp.source[0] !== "[") { + throw new Error("/" + regexp.source + "/ can not be used with chars_without"); + } + if (!search || typeof search !== "string") { + throw new Error(JSON.stringify(search) + " is not a valid search"); + } + if (regexp.source.indexOf(search) === -1) { + throw new Error('"' + search + '" is not is /' + regexp.source + "/"); + } + if (search === "-" && regexp.source.indexOf(search) !== 1) { + throw new Error('"' + search + '" is not at the first postion of /' + regexp.source + "/"); + } + return new RegExp(regexp.source.replace(search, ""), UNICODE_SUPPORT ? "u" : ""); + } + function reg(args) { + var self2 = this; + return new RegExp( + Array.prototype.slice.call(arguments).map(function(part) { + var isStr = typeof part === "string"; + if (isStr && self2 === void 0 && part === "|") { + throw new Error("use regg instead of reg to wrap expressions with `|`!"); + } + return isStr ? part : part.source; + }).join(""), + UNICODE_SUPPORT ? "u" : "" + ); + } + function regg(args) { + if (arguments.length === 0) { + throw new Error("no parameters provided"); + } + return reg.apply(regg, ["(?:"].concat(Array.prototype.slice.call(arguments), [")"])); + } + var UNICODE_REPLACEMENT_CHARACTER = "\uFFFD"; + var Char = /[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/; + if (UNICODE_SUPPORT) { + Char = reg("[", chars(Char), "\\u{10000}-\\u{10FFFF}", "]"); + } + var InvalidChar = new RegExp("[^" + chars(Char) + "]", UNICODE_SUPPORT ? "u" : ""); + var _SChar = /[\x20\x09\x0D\x0A]/; + var SChar_s = chars(_SChar); + var S = reg(_SChar, "+"); + var S_OPT = reg(_SChar, "*"); + var NameStartChar = /[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; + if (UNICODE_SUPPORT) { + NameStartChar = reg("[", chars(NameStartChar), "\\u{10000}-\\u{10FFFF}", "]"); + } + var NameStartChar_s = chars(NameStartChar); + var NameChar = reg("[", NameStartChar_s, chars(/[-.0-9\xB7]/), chars(/[\u0300-\u036F\u203F-\u2040]/), "]"); + var Name = reg(NameStartChar, NameChar, "*"); + var Name_exact = reg("^", Name, "$"); + var Nmtoken = reg(NameChar, "+"); + var EntityRef = reg("&", Name, ";"); + var CharRef = regg(/&#[0-9]+;|&#x[0-9a-fA-F]+;/); + var Reference = regg(EntityRef, "|", CharRef); + var PEReference = reg("%", Name, ";"); + var EntityValue = regg( + reg('"', regg(/[^%&"]/, "|", PEReference, "|", Reference), "*", '"'), + "|", + reg("'", regg(/[^%&']/, "|", PEReference, "|", Reference), "*", "'") + ); + var AttValue = regg('"', regg(/[^<&"]/, "|", Reference), "*", '"', "|", "'", regg(/[^<&']/, "|", Reference), "*", "'"); + var NCNameStartChar = chars_without(NameStartChar, ":"); + var NCNameChar = chars_without(NameChar, ":"); + var NCName = reg(NCNameStartChar, NCNameChar, "*"); + var NCName_exact = reg("^", NCName, "$"); + var QName = reg(NCName, regg(":", NCName), "?"); + var QName_exact = reg("^", QName, "$"); + var QName_group = reg("(", QName, ")"); + var SystemLiteral = regg(/"[^"]*"|'[^']*'/); + var PI = reg(/^<\?/, "(", Name, ")", regg(S, "(?!", _SChar, ")(", Char, "*?)"), "?", /\?>/); + var PubidChar = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/; + var PubidLiteral = regg('"', PubidChar, '*"', "|", "'", chars_without(PubidChar, "'"), "*'"); + var COMMENT_START = ""; + var Comment = reg(COMMENT_START, regg(chars_without(Char, "-"), "|", reg("-", chars_without(Char, "-"))), "*", COMMENT_END); + var PCDATA = "#PCDATA"; + var Mixed = regg( + reg(/\(/, S_OPT, PCDATA, regg(S_OPT, /\|/, S_OPT, QName), "*", S_OPT, /\)\*/), + "|", + reg(/\(/, S_OPT, PCDATA, S_OPT, /\)/) + ); + var _children_quantity = /[?*+]?/; + var children = reg( + /\([^>]+\)/, + _children_quantity + /*regg(choice, '|', seq), _children_quantity*/ + ); + var contentspec = regg("EMPTY", "|", "ANY", "|", Mixed, "|", children); + var ELEMENTDECL_START = ""); + var NotationType = reg("NOTATION", S, /\(/, S_OPT, Name, regg(S_OPT, /\|/, S_OPT, Name), "*", S_OPT, /\)/); + var Enumeration = reg(/\(/, S_OPT, Nmtoken, regg(S_OPT, /\|/, S_OPT, Nmtoken), "*", S_OPT, /\)/); + var EnumeratedType = regg(NotationType, "|", Enumeration); + var AttType = regg(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", EnumeratedType); + var DefaultDecl = regg(/#REQUIRED|#IMPLIED/, "|", regg(regg("#FIXED", S), "?", AttValue)); + var AttDef = regg(S, Name, S, AttType, S, DefaultDecl); + var ATTLIST_DECL_START = ""); + var ABOUT_LEGACY_COMPAT = "about:legacy-compat"; + var ABOUT_LEGACY_COMPAT_SystemLiteral = regg('"' + ABOUT_LEGACY_COMPAT + '"', "|", "'" + ABOUT_LEGACY_COMPAT + "'"); + var SYSTEM = "SYSTEM"; + var PUBLIC = "PUBLIC"; + var ExternalID = regg(regg(SYSTEM, S, SystemLiteral), "|", regg(PUBLIC, S, PubidLiteral, S, SystemLiteral)); + var ExternalID_match = reg( + "^", + regg( + regg(SYSTEM, S, "(?", SystemLiteral, ")"), + "|", + regg(PUBLIC, S, "(?", PubidLiteral, ")", S, "(?", SystemLiteral, ")") + ) + ); + var PubidLiteral_match = reg("^", PubidLiteral, "$"); + var SystemLiteral_match = reg("^", SystemLiteral, "$"); + var NDataDecl = regg(S, "NDATA", S, Name); + var EntityDef = regg(EntityValue, "|", regg(ExternalID, NDataDecl, "?")); + var ENTITY_DECL_START = ""); + var PEDef = regg(EntityValue, "|", ExternalID); + var PEDecl = reg(ENTITY_DECL_START, S, "%", S, Name, S, PEDef, S_OPT, ">"); + var EntityDecl = regg(GEDecl, "|", PEDecl); + var PublicID = reg(PUBLIC, S, PubidLiteral); + var NotationDecl = reg(""); + var Eq = reg(S_OPT, "=", S_OPT); + var VersionNum = /1[.]\d+/; + var VersionInfo = reg(S, "version", Eq, regg("'", VersionNum, "'", "|", '"', VersionNum, '"')); + var EncName = /[A-Za-z][-A-Za-z0-9._]*/; + var EncodingDecl = regg(S, "encoding", Eq, regg('"', EncName, '"', "|", "'", EncName, "'")); + var SDDecl = regg(S, "standalone", Eq, regg("'", regg("yes", "|", "no"), "'", "|", '"', regg("yes", "|", "no"), '"')); + var XMLDecl = reg(/^<\?xml/, VersionInfo, EncodingDecl, "?", SDDecl, "?", S_OPT, /\?>/); + var DOCTYPE_DECL_START = ""; + var CDStart = //; + var CData = reg(Char, "*?", CDEnd); + var CDSect = reg(CDStart, CData); + exports2.chars = chars; + exports2.chars_without = chars_without; + exports2.detectUnicodeSupport = detectUnicodeSupport; + exports2.reg = reg; + exports2.regg = regg; + exports2.ABOUT_LEGACY_COMPAT = ABOUT_LEGACY_COMPAT; + exports2.ABOUT_LEGACY_COMPAT_SystemLiteral = ABOUT_LEGACY_COMPAT_SystemLiteral; + exports2.AttlistDecl = AttlistDecl; + exports2.CDATA_START = CDATA_START; + exports2.CDATA_END = CDATA_END; + exports2.CDSect = CDSect; + exports2.Char = Char; + exports2.Comment = Comment; + exports2.COMMENT_START = COMMENT_START; + exports2.COMMENT_END = COMMENT_END; + exports2.DOCTYPE_DECL_START = DOCTYPE_DECL_START; + exports2.elementdecl = elementdecl; + exports2.EntityDecl = EntityDecl; + exports2.EntityValue = EntityValue; + exports2.ExternalID = ExternalID; + exports2.ExternalID_match = ExternalID_match; + exports2.Name = Name; + exports2.Name_exact = Name_exact; + exports2.NCName_exact = NCName_exact; + exports2.NotationDecl = NotationDecl; + exports2.Reference = Reference; + exports2.PEReference = PEReference; + exports2.PI = PI; + exports2.PUBLIC = PUBLIC; + exports2.PubidLiteral = PubidLiteral; + exports2.PubidLiteral_match = PubidLiteral_match; + exports2.QName = QName; + exports2.QName_exact = QName_exact; + exports2.QName_group = QName_group; + exports2.S = S; + exports2.SChar_s = SChar_s; + exports2.S_OPT = S_OPT; + exports2.SYSTEM = SYSTEM; + exports2.SystemLiteral = SystemLiteral; + exports2.SystemLiteral_match = SystemLiteral_match; + exports2.InvalidChar = InvalidChar; + exports2.UNICODE_REPLACEMENT_CHARACTER = UNICODE_REPLACEMENT_CHARACTER; + exports2.UNICODE_SUPPORT = UNICODE_SUPPORT; + exports2.XMLDecl = XMLDecl; + } +}); + +// node_modules/@xmldom/xmldom/lib/dom.js +var require_dom = __commonJS({ + "node_modules/@xmldom/xmldom/lib/dom.js"(exports2) { + "use strict"; + var conventions = require_conventions(); + var find = conventions.find; + var hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace; + var hasOwn = conventions.hasOwn; + var isHTMLMimeType = conventions.isHTMLMimeType; + var isHTMLRawTextElement = conventions.isHTMLRawTextElement; + var isHTMLVoidElement = conventions.isHTMLVoidElement; + var MIME_TYPE = conventions.MIME_TYPE; + var NAMESPACE = conventions.NAMESPACE; + var PDC = /* @__PURE__ */ Symbol(); + var errors = require_errors(); + var DOMException = errors.DOMException; + var DOMExceptionName = errors.DOMExceptionName; + var g = require_grammar(); + function checkSymbol(symbol) { + if (symbol !== PDC) { + throw new TypeError("Illegal constructor"); + } + } + function notEmptyString(input3) { + return input3 !== ""; + } + function splitOnASCIIWhitespace(input3) { + return input3 ? input3.split(/[\t\n\f\r ]+/).filter(notEmptyString) : []; + } + function orderedSetReducer(current, element) { + if (!hasOwn(current, element)) { + current[element] = true; + } + return current; + } + function toOrderedSet(input3) { + if (!input3) return []; + var list = splitOnASCIIWhitespace(input3); + return Object.keys(list.reduce(orderedSetReducer, {})); + } + function arrayIncludes(list) { + return function(element) { + return list && list.indexOf(element) !== -1; + }; + } + function validateQualifiedName(qualifiedName) { + if (!g.QName_exact.test(qualifiedName)) { + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in qualified name "' + qualifiedName + '"'); + } + } + function validateAndExtract(namespace, qualifiedName) { + validateQualifiedName(qualifiedName); + namespace = namespace || null; + var prefix = null; + var localName = qualifiedName; + if (qualifiedName.indexOf(":") >= 0) { + var splitResult = qualifiedName.split(":"); + prefix = splitResult[0]; + localName = splitResult[1]; + } + if (prefix !== null && namespace === null) { + throw new DOMException(DOMException.NAMESPACE_ERR, "prefix is non-null and namespace is null"); + } + if (prefix === "xml" && namespace !== conventions.NAMESPACE.XML) { + throw new DOMException(DOMException.NAMESPACE_ERR, 'prefix is "xml" and namespace is not the XML namespace'); + } + if ((prefix === "xmlns" || qualifiedName === "xmlns") && namespace !== conventions.NAMESPACE.XMLNS) { + throw new DOMException( + DOMException.NAMESPACE_ERR, + 'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace' + ); + } + if (namespace === conventions.NAMESPACE.XMLNS && prefix !== "xmlns" && qualifiedName !== "xmlns") { + throw new DOMException( + DOMException.NAMESPACE_ERR, + 'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"' + ); + } + return [namespace, prefix, localName]; + } + function copy(src, dest) { + for (var p in src) { + if (hasOwn(src, p)) { + dest[p] = src[p]; + } + } + } + function _extends(Class2, Super) { + var pt = Class2.prototype; + if (!(pt instanceof Super)) { + let t = function() { + }; + t.prototype = Super.prototype; + t = new t(); + copy(pt, t); + Class2.prototype = pt = t; + } + if (pt.constructor != Class2) { + if (typeof Class2 != "function") { + console.error("unknown Class:" + Class2); + } + pt.constructor = Class2; + } + } + var NodeType = {}; + var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; + var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; + var TEXT_NODE = NodeType.TEXT_NODE = 3; + var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; + var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; + var ENTITY_NODE = NodeType.ENTITY_NODE = 6; + var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; + var COMMENT_NODE = NodeType.COMMENT_NODE = 8; + var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; + var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; + var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; + var NOTATION_NODE = NodeType.NOTATION_NODE = 12; + var DocumentPosition = conventions.freeze({ + DOCUMENT_POSITION_DISCONNECTED: 1, + DOCUMENT_POSITION_PRECEDING: 2, + DOCUMENT_POSITION_FOLLOWING: 4, + DOCUMENT_POSITION_CONTAINS: 8, + DOCUMENT_POSITION_CONTAINED_BY: 16, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32 + }); + function commonAncestor(a, b) { + if (b.length < a.length) return commonAncestor(b, a); + var c = null; + for (var n in a) { + if (a[n] !== b[n]) return c; + c = a[n]; + } + return c; + } + function docGUID(doc) { + if (!doc.guid) doc.guid = Math.random(); + return doc.guid; + } + function NodeList() { + } + NodeList.prototype = { + /** + * The number of nodes in the list. The range of valid child node indices is 0 to length-1 + * inclusive. + * + * @type {number} + */ + length: 0, + /** + * Returns the item at `index`. If index is greater than or equal to the number of nodes in + * the list, this returns null. + * + * @param index + * Unsigned long Index into the collection. + * @returns {Node | null} + * The node at position `index` in the NodeList, + * or null if that is not a valid index. + */ + item: function(index) { + return index >= 0 && index < this.length ? this[index] : null; + }, + /** + * Returns a string representation of the NodeList. + * + * Accepts the same `options` object as `XMLSerializer.prototype.serializeToString` + * (`requireWellFormed`, `splitCDATASections`, `nodeFilter`). Passing a function is treated as + * a legacy `nodeFilter` for backward compatibility. + * + * @param {Object | function} [options] + * @param {boolean} [options.requireWellFormed=false] + * @param {boolean} [options.splitCDATASections=true] + * @param {function} [options.nodeFilter] + * @returns {string} + */ + toString: function(options) { + var opts; + if (typeof options === "function") { + opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: options }; + } else if (!!options) { + opts = { + requireWellFormed: !!options.requireWellFormed, + splitCDATASections: options.splitCDATASections !== false, + nodeFilter: options.nodeFilter || null + }; + } else { + opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: null }; + } + for (var buf = [], i = 0; i < this.length; i++) { + serializeToString(this[i], buf, null, opts); + } + return buf.join(""); + }, + /** + * Filters the NodeList based on a predicate. + * + * @param {function(Node): boolean} predicate + * - A predicate function to filter the NodeList. + * @returns {Node[]} + * An array of nodes that satisfy the predicate. + * @private + */ + filter: function(predicate) { + return Array.prototype.filter.call(this, predicate); + }, + /** + * Returns the first index at which a given node can be found in the NodeList, or -1 if it is + * not present. + * + * @param {Node} item + * - The Node item to locate in the NodeList. + * @returns {number} + * The first index of the node in the NodeList; -1 if not found. + * @private + */ + indexOf: function(item) { + return Array.prototype.indexOf.call(this, item); + } + }; + NodeList.prototype[Symbol.iterator] = function() { + var me = this; + var index = 0; + return { + next: function() { + if (index < me.length) { + return { + value: me[index++], + done: false + }; + } else { + return { + done: true + }; + } + }, + return: function() { + return { + done: true + }; + } + }; + }; + function LiveNodeList(node2, refresh) { + this._node = node2; + this._refresh = refresh; + _updateLiveList(this); + } + function _updateLiveList(list) { + var inc = list._node._inc || list._node.ownerDocument._inc; + if (list._inc !== inc) { + var ls = list._refresh(list._node); + __set__(list, "length", ls.length); + if (!list.$$length || ls.length < list.$$length) { + for (var i = ls.length; i in list; i++) { + if (hasOwn(list, i)) { + delete list[i]; + } + } + } + copy(ls, list); + list._inc = inc; + } + } + LiveNodeList.prototype.item = function(i) { + _updateLiveList(this); + return this[i] || null; + }; + _extends(LiveNodeList, NodeList); + function NamedNodeMap() { + this._nsIndex = /* @__PURE__ */ Object.create(null); + this._noNsIndex = /* @__PURE__ */ Object.create(null); + } + function _findNodeIndex(list, node2) { + var i = 0; + while (i < list.length) { + if (list[i] === node2) { + return i; + } + i++; + } + } + function _nnmBucket(map, namespaceURI, create) { + if (!namespaceURI) { + return map._noNsIndex; + } + var bucket = map._nsIndex[namespaceURI]; + if (!bucket && create) { + bucket = map._nsIndex[namespaceURI] = /* @__PURE__ */ Object.create(null); + } + return bucket; + } + function _nnmIndexFind(map, namespaceURI, localName) { + var bucket = _nnmBucket(map, namespaceURI, false); + var found = bucket && bucket[localName]; + return found ? found : null; + } + function _nnmIndexAdd(map, attr) { + _nnmBucket(map, attr.namespaceURI, true)[attr.localName] = attr; + } + function _nnmIndexRemove(map, attr) { + var bucket = _nnmBucket(map, attr.namespaceURI, false); + if (bucket) { + delete bucket[attr.localName]; + } + } + function _addNamedNode(el, list, newAttr, oldAttr) { + if (oldAttr) { + list[_findNodeIndex(list, oldAttr)] = newAttr; + } else { + list[list.length] = newAttr; + list.length++; + } + _nnmIndexAdd(list, newAttr); + if (el) { + newAttr.ownerElement = el; + var doc = el.ownerDocument; + if (doc) { + oldAttr && _onRemoveAttribute(doc, el, oldAttr); + _onAddAttribute(doc, el, newAttr); + } + } + } + function _removeNamedNode(el, list, attr) { + var i = _findNodeIndex(list, attr); + if (i >= 0) { + var lastIndex = list.length - 1; + while (i <= lastIndex) { + list[i] = list[++i]; + } + list.length = lastIndex; + _nnmIndexRemove(list, attr); + if (el) { + var doc = el.ownerDocument; + if (doc) { + _onRemoveAttribute(doc, el, attr); + } + attr.ownerElement = null; + } + } + } + NamedNodeMap.prototype = { + length: 0, + item: NodeList.prototype.item, + /** + * Get an attribute by name. Note: Name is in lower case in case of HTML namespace and + * document. + * + * @param {string} localName + * The local name of the attribute. + * @returns {Attr | null} + * The attribute with the given local name, or null if no such attribute exists. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name + */ + getNamedItem: function(localName) { + if (this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace()) { + localName = localName.toLowerCase(); + } + var i = 0; + while (i < this.length) { + var attr = this[i]; + if (attr.nodeName === localName) { + return attr; + } + i++; + } + return null; + }, + /** + * Set an attribute. + * + * @param {Attr} attr + * The attribute to set. + * @returns {Attr | null} + * The old attribute with the same local name and namespace URI as the new one, or null if no + * such attribute exists. + * @throws {DOMException} + * With code: + * - {@link INUSE_ATTRIBUTE_ERR} - If the attribute is already an attribute of another + * element. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-set + */ + setNamedItem: function(attr) { + var el = attr.ownerElement; + if (el && el !== this._ownerElement) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + var oldAttr = _nnmIndexFind(this, attr.namespaceURI, attr.localName); + if (oldAttr === attr) { + return attr; + } + _addNamedNode(this._ownerElement, this, attr, oldAttr); + return oldAttr; + }, + /** + * Set an attribute, replacing an existing attribute with the same local name and namespace + * URI if one exists. + * + * @param {Attr} attr + * The attribute to set. + * @returns {Attr | null} + * The old attribute with the same local name and namespace URI as the new one, or null if no + * such attribute exists. + * @throws {DOMException} + * Throws a DOMException with the name "InUseAttributeError" if the attribute is already an + * attribute of another element. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-set + */ + setNamedItemNS: function(attr) { + return this.setNamedItem(attr); + }, + /** + * Removes an attribute specified by the local name. + * + * @param {string} localName + * The local name of the attribute to be removed. + * @returns {Attr} + * The attribute node that was removed. + * @throws {DOMException} + * With code: + * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given name is found. + * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem + * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name + */ + removeNamedItem: function(localName) { + var attr = this.getNamedItem(localName); + if (!attr) { + throw new DOMException(DOMException.NOT_FOUND_ERR, localName); + } + _removeNamedNode(this._ownerElement, this, attr); + return attr; + }, + /** + * Removes an attribute specified by the namespace and local name. + * + * @param {string | null} namespaceURI + * The namespace URI of the attribute to be removed. + * @param {string} localName + * The local name of the attribute to be removed. + * @returns {Attr} + * The attribute node that was removed. + * @throws {DOMException} + * With code: + * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given namespace URI and local + * name is found. + * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns + * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace + */ + removeNamedItemNS: function(namespaceURI, localName) { + var attr = this.getNamedItemNS(namespaceURI, localName); + if (!attr) { + throw new DOMException(DOMException.NOT_FOUND_ERR, namespaceURI ? namespaceURI + " : " + localName : localName); + } + _removeNamedNode(this._ownerElement, this, attr); + return attr; + }, + /** + * Get an attribute by namespace and local name. + * + * @param {string | null} namespaceURI + * The namespace URI of the attribute. + * @param {string} localName + * The local name of the attribute. + * @returns {Attr | null} + * The attribute with the given namespace URI and local name, or null if no such attribute + * exists. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace + */ + getNamedItemNS: function(namespaceURI, localName) { + if (!namespaceURI) { + namespaceURI = null; + } + var i = 0; + while (i < this.length) { + var node2 = this[i]; + if (node2.localName === localName && node2.namespaceURI === namespaceURI) { + return node2; + } + i++; + } + return null; + } + }; + NamedNodeMap.prototype[Symbol.iterator] = function() { + var me = this; + var index = 0; + return { + next: function() { + if (index < me.length) { + return { + value: me[index++], + done: false + }; + } else { + return { + done: true + }; + } + }, + return: function() { + return { + done: true + }; + } + }; + }; + function DOMImplementation() { + } + DOMImplementation.prototype = { + /** + * Test if the DOM implementation implements a specific feature and version, as specified in + * {@link https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures DOM Features}. + * + * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given + * feature is supported. The different implementations fairly diverged in what kind of + * features were reported. The latest version of the spec settled to force this method to + * always return true, where the functionality was accurate and in use. + * + * @deprecated + * It is deprecated and modern browsers return true in all cases. + * @function DOMImplementation#hasFeature + * @param {string} feature + * The name of the feature to test. + * @param {string} [version] + * This is the version number of the feature to test. + * @returns {boolean} + * Always returns true. + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN + * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core + * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7 DOM Level 3 Core + */ + hasFeature: function(feature, version2) { + return true; + }, + /** + * Creates a DOM Document object of the specified type with its document element. Note that + * based on the {@link DocumentType} + * given to create the document, the implementation may instantiate specialized + * {@link Document} objects that support additional features than the "Core", such as "HTML" + * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML}. + * On the other hand, setting the {@link DocumentType} after the document was created makes + * this very unlikely to happen. Alternatively, specialized {@link Document} creation methods, + * such as createHTMLDocument + * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML}, + * can be used to obtain specific types of {@link Document} objects. + * + * __It behaves slightly different from the description in the living standard__: + * - There is no interface/class `XMLDocument`, it returns a `Document` + * instance (with it's `type` set to `'xml'`). + * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. + * + * @function DOMImplementation.createDocument + * @param {string | null} namespaceURI + * The + * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-namespaceURI namespace URI} + * of the document element to create or null. + * @param {string | null} qualifiedName + * The + * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified name} + * of the document element to be created or null. + * @param {DocumentType | null} [doctype=null] + * The type of document to be created or null. When doctype is not null, its + * {@link Node#ownerDocument} attribute is set to the document being created. Default is + * `null` + * @returns {Document} + * A new {@link Document} object with its document element. If the NamespaceURI, + * qualifiedName, and doctype are null, the returned {@link Document} is empty with no + * document element. + * @throws {DOMException} + * With code: + * + * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name + * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}. + * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed, if the qualifiedName has a + * prefix and the namespaceURI is null, or if the qualifiedName is null and the namespaceURI + * is different from null, or if the qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from "{@link http://www.w3.org/XML/1998/namespace}" + * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#Namespaces XML Namespaces}, + * or if the DOM implementation does not support the "XML" feature but a non-null namespace + * URI was provided, since namespaces were defined by XML. + * - `WRONG_DOCUMENT_ERR`: Raised if doctype has already been used with a different document + * or was created from a different implementation. + * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature + * "XML" and the language exposed through the Document does not support XML Namespaces (such + * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}). + * @since DOM Level 2. + * @see {@link #createHTMLDocument} + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Living Standard + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument DOM + * Level 3 Core + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM + * Level 2 Core (initial) + */ + createDocument: function(namespaceURI, qualifiedName, doctype) { + var contentType = MIME_TYPE.XML_APPLICATION; + if (namespaceURI === NAMESPACE.HTML) { + contentType = MIME_TYPE.XML_XHTML_APPLICATION; + } else if (namespaceURI === NAMESPACE.SVG) { + contentType = MIME_TYPE.XML_SVG_IMAGE; + } + var doc = new Document(PDC, { contentType }); + doc.implementation = this; + doc.childNodes = new NodeList(); + doc.doctype = doctype || null; + if (doctype) { + doc.appendChild(doctype); + } + if (qualifiedName) { + var root = doc.createElementNS(namespaceURI, qualifiedName); + doc.appendChild(root); + } + return doc; + }, + /** + * Creates an empty DocumentType node. Entity declarations and notations are not made + * available. Entity reference expansions and default attribute additions do not occur. + * + * **This behavior is slightly different from the one in the specs**: + * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. + * - `publicId` and `systemId` contain the raw data including any possible quotes, + * so they can always be serialized back to the original value + * - `internalSubset` contains the raw string between `[` and `]` if present, + * but is not parsed or validated in any form. + * + * @function DOMImplementation#createDocumentType + * @param {string} qualifiedName + * The {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified + * name} of the document type to be created. + * @param {string} [publicId] + * The external subset public identifier. Stored verbatim including surrounding quotes. + * When serialized with `requireWellFormed: true`, the serializer throws `InvalidStateError` + * if the value is non-empty and does not match the XML `PubidLiteral` production + * (W3C DOM Parsing §3.2.1.3; XML 1.0 production [12]). Creation-time validation is not + * enforced — deferred to a future breaking release. + * @param {string} [systemId] + * The external subset system identifier. Stored verbatim including surrounding quotes. + * When serialized with `requireWellFormed: true`, the serializer throws `InvalidStateError` + * if the value is non-empty and does not match the XML `SystemLiteral` production + * (W3C DOM Parsing §3.2.1.3; XML 1.0 production [11]). Creation-time validation is not + * enforced — deferred to a future breaking release. + * @param {string} [internalSubset] + * The internal subset or an empty string if it is not present. Stored verbatim. + * When serialized with `requireWellFormed: true`, the serializer throws `InvalidStateError` + * if the value contains `"]>"`. Creation-time validation is not enforced. + * @returns {DocumentType} + * A new {@link DocumentType} node with {@link Node#ownerDocument} set to null. + * @throws {DOMException} + * With code: + * + * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name + * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}. + * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed. + * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature + * "XML" and the language exposed through the Document does not support XML Namespaces (such + * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}). + * @since DOM Level 2. + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType + * MDN + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living + * Standard + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-3-Core-DOM-createDocType DOM + * Level 3 Core + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM + * Level 2 Core + * @see https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md#050 + * @see https://www.w3.org/TR/DOM-Level-2-Core/#core-ID-Core-DocType-internalSubset + * @prettierignore + */ + createDocumentType: function(qualifiedName, publicId, systemId, internalSubset) { + validateQualifiedName(qualifiedName); + var node2 = new DocumentType(PDC); + node2.name = qualifiedName; + node2.nodeName = qualifiedName; + node2.publicId = publicId || ""; + node2.systemId = systemId || ""; + node2.internalSubset = internalSubset || ""; + node2.childNodes = new NodeList(); + return node2; + }, + /** + * Returns an HTML document, that might already have a basic DOM structure. + * + * __It behaves slightly different from the description in the living standard__: + * - If the first argument is `false` no initial nodes are added (steps 3-7 in the specs are + * omitted) + * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. + * + * @param {string | false} [title] + * A string containing the title to give the new HTML document. + * @returns {Document} + * The HTML document. + * @since WHATWG Living Standard. + * @see {@link #createDocument} + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument + * @see https://dom.spec.whatwg.org/#html-document + */ + createHTMLDocument: function(title) { + var doc = new Document(PDC, { contentType: MIME_TYPE.HTML }); + doc.implementation = this; + doc.childNodes = new NodeList(); + if (title !== false) { + doc.doctype = this.createDocumentType("html"); + doc.doctype.ownerDocument = doc; + doc.appendChild(doc.doctype); + var htmlNode = doc.createElement("html"); + doc.appendChild(htmlNode); + var headNode = doc.createElement("head"); + htmlNode.appendChild(headNode); + if (typeof title === "string") { + var titleNode = doc.createElement("title"); + titleNode.appendChild(doc.createTextNode(title)); + headNode.appendChild(titleNode); + } + htmlNode.appendChild(doc.createElement("body")); + } + return doc; + } + }; + function Node(symbol) { + checkSymbol(symbol); + } + Node.prototype = { + /** + * The first child of this node. + * + * @type {Node | null} + */ + firstChild: null, + /** + * The last child of this node. + * + * @type {Node | null} + */ + lastChild: null, + /** + * The previous sibling of this node. + * + * @type {Node | null} + */ + previousSibling: null, + /** + * The next sibling of this node. + * + * @type {Node | null} + */ + nextSibling: null, + /** + * The parent node of this node. + * + * @type {Node | null} + */ + parentNode: null, + /** + * The parent element of this node. + * + * @type {Element | null} + */ + get parentElement() { + return this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null; + }, + /** + * The child nodes of this node. + * + * @type {NodeList} + */ + childNodes: null, + /** + * The document object associated with this node. + * + * @type {Document | null} + */ + ownerDocument: null, + /** + * The value of this node. + * + * @type {string | null} + */ + nodeValue: null, + /** + * The namespace URI of this node. + * + * @type {string | null} + */ + namespaceURI: null, + /** + * The prefix of the namespace for this node. + * + * @type {string | null} + */ + prefix: null, + /** + * The local part of the qualified name of this node. + * + * @type {string | null} + */ + localName: null, + /** + * The baseURI is currently always `about:blank`, + * since that's what happens when you create a document from scratch. + * + * @type {'about:blank'} + */ + baseURI: "about:blank", + /** + * Is true if this node is part of a document. + * + * @type {boolean} + */ + get isConnected() { + var rootNode = this.getRootNode(); + return rootNode && rootNode.nodeType === rootNode.DOCUMENT_NODE; + }, + /** + * Checks whether `other` is an inclusive descendant of this node. + * + * @param {Node | null | undefined} other + * The node to check. + * @returns {boolean} + * True if `other` is an inclusive descendant of this node; false otherwise. + * @see https://dom.spec.whatwg.org/#dom-node-contains + */ + contains: function(other) { + if (!other) return false; + var parent = other; + do { + if (this === parent) return true; + parent = parent.parentNode; + } while (parent); + return false; + }, + /** + * @typedef GetRootNodeOptions + * @property {boolean} [composed=false] + */ + /** + * Searches for the root node of this node. + * + * **This behavior is slightly different from the in the specs**: + * - ignores `options.composed`, since `ShadowRoot`s are unsupported, always returns root. + * + * @param {GetRootNodeOptions} [options] + * @returns {Node} + * Root node. + * @see https://dom.spec.whatwg.org/#dom-node-getrootnode + * @see https://dom.spec.whatwg.org/#concept-shadow-including-root + */ + getRootNode: function(options) { + var parent = this; + do { + if (!parent.parentNode) { + return parent; + } + parent = parent.parentNode; + } while (parent); + }, + /** + * Checks whether the given node is equal to this node. + * + * Two nodes are equal when they have the same type, defining characteristics (for the type), + * and the same childNodes. The comparison is iterative to avoid stack overflows on + * deeply-nested trees. Attribute nodes of each Element pair are also pushed onto the stack + * and compared the same way. + * + * @param {Node} [otherNode] + * @returns {boolean} + * @see https://dom.spec.whatwg.org/#concept-node-equals + * @see ../docs/walk-dom.md. + */ + isEqualNode: function(otherNode) { + if (!otherNode) return false; + var stack = [{ node: this, other: otherNode }]; + while (stack.length > 0) { + var pair = stack.pop(); + var node2 = pair.node; + var other = pair.other; + if (node2.nodeType !== other.nodeType) return false; + switch (node2.nodeType) { + case node2.DOCUMENT_TYPE_NODE: + if (node2.name !== other.name) return false; + if (node2.publicId !== other.publicId) return false; + if (node2.systemId !== other.systemId) return false; + break; + case node2.ELEMENT_NODE: + if (node2.namespaceURI !== other.namespaceURI) return false; + if (node2.prefix !== other.prefix) return false; + if (node2.localName !== other.localName) return false; + if (node2.attributes.length !== other.attributes.length) return false; + for (var i = 0; i < node2.attributes.length; i++) { + var attr = node2.attributes.item(i); + var otherAttr = other.getAttributeNodeNS(attr.namespaceURI, attr.localName); + if (!otherAttr) return false; + stack.push({ node: attr, other: otherAttr }); + } + break; + case node2.ATTRIBUTE_NODE: + if (node2.namespaceURI !== other.namespaceURI) return false; + if (node2.localName !== other.localName) return false; + if (node2.value !== other.value) return false; + break; + case node2.PROCESSING_INSTRUCTION_NODE: + if (node2.target !== other.target || node2.data !== other.data) return false; + break; + case node2.TEXT_NODE: + case node2.CDATA_SECTION_NODE: + case node2.COMMENT_NODE: + if (node2.data !== other.data) return false; + break; + } + if (node2.childNodes.length !== other.childNodes.length) return false; + for (var i = node2.childNodes.length - 1; i >= 0; i--) { + stack.push({ node: node2.childNodes[i], other: other.childNodes[i] }); + } + } + return true; + }, + /** + * Checks whether or not the given node is this node. + * + * @param {Node} [otherNode] + */ + isSameNode: function(otherNode) { + return this === otherNode; + }, + /** + * Inserts a node before a reference node as a child of this node. + * + * @param {Node} newChild + * The new child node to be inserted. + * @param {Node | null} refChild + * The reference node before which newChild will be inserted. + * @returns {Node} + * The new child node successfully inserted. + * @throws {DOMException} + * Throws a DOMException if inserting the node would result in a DOM tree that is not + * well-formed, or if `child` is provided but is not a child of `parent`. + * See {@link _insertBefore} for more details. + * @since Modified in DOM L2 + */ + insertBefore: function(newChild, refChild) { + return _insertBefore(this, newChild, refChild); + }, + /** + * Replaces an old child node with a new child node within this node. + * + * @param {Node} newChild + * The new node that is to replace the old node. + * If it already exists in the DOM, it is removed from its original position. + * @param {Node} oldChild + * The existing child node to be replaced. + * @returns {Node} + * Returns the replaced child node. + * @throws {DOMException} + * Throws a DOMException if replacing the node would result in a DOM tree that is not + * well-formed, or if `oldChild` is not a child of `this`. + * This can also occur if the pre-replacement validity assertion fails. + * See {@link _insertBefore}, {@link Node.removeChild}, and + * {@link assertPreReplacementValidityInDocument} for more details. + * @see https://dom.spec.whatwg.org/#concept-node-replace + */ + replaceChild: function(newChild, oldChild) { + _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument); + if (oldChild) { + this.removeChild(oldChild); + } + }, + /** + * Removes an existing child node from this node. + * + * @param {Node} oldChild + * The child node to be removed. + * @returns {Node} + * Returns the removed child node. + * @throws {DOMException} + * Throws a DOMException if `oldChild` is not a child of `this`. + * See {@link _removeChild} for more details. + */ + removeChild: function(oldChild) { + return _removeChild(this, oldChild); + }, + /** + * Appends a child node to this node. + * + * @param {Node} newChild + * The child node to be appended to this node. + * If it already exists in the DOM, it is removed from its original position. + * @returns {Node} + * Returns the appended child node. + * @throws {DOMException} + * Throws a DOMException if appending the node would result in a DOM tree that is not + * well-formed, or if `newChild` is not a valid Node. + * See {@link insertBefore} for more details. + */ + appendChild: function(newChild) { + return this.insertBefore(newChild, null); + }, + /** + * Determines whether this node has any child nodes. + * + * @returns {boolean} + * Returns true if this node has any child nodes, and false otherwise. + */ + hasChildNodes: function() { + return this.firstChild != null; + }, + /** + * Creates a copy of the calling node. + * + * @param {boolean} deep + * If true, the contents of the node are recursively copied. + * If false, only the node itself (and its attributes, if it is an element) are copied. + * @returns {Node} + * Returns the newly created copy of the node. + * @throws {DOMException} + * May throw a DOMException if operations within {@link Element#setAttributeNode} or + * {@link Node#appendChild} (which are potentially invoked in this method) do not meet their + * specific constraints. + * @see {@link cloneNode} + */ + cloneNode: function(deep) { + return cloneNode(this.ownerDocument || this, this, deep); + }, + /** + * Puts the specified node and all of its subtree into a "normalized" form. In a normalized + * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes. + * + * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType` + * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text + * nodes. + * + * This method iterativly traverses all child nodes to normalize all descendent nodes within + * the subtree. + * + * @throws {DOMException} + * May throw a DOMException if operations within removeChild or appendData (which are + * potentially invoked in this method) do not meet their specific constraints. + * @since Modified in DOM Level 2 + * @see {@link Node.removeChild} + * @see {@link CharacterData.appendData} + * @see ../docs/walk-dom.md. + */ + normalize: function() { + walkDOM(this, null, { + enter: function(node2) { + var child2 = node2.firstChild; + while (child2) { + var next = child2.nextSibling; + if (next !== null && next.nodeType === TEXT_NODE && child2.nodeType === TEXT_NODE) { + var tail = []; + var sibling = next; + while (sibling !== null && sibling.nodeType === TEXT_NODE) { + tail.push(sibling.data); + sibling = sibling.nextSibling; + } + var removed = child2.nextSibling; + while (removed !== sibling) { + var following = removed.nextSibling; + removed.parentNode = null; + removed.previousSibling = null; + removed.nextSibling = null; + removed = following; + } + child2.nextSibling = sibling; + if (sibling !== null) { + sibling.previousSibling = child2; + } else { + node2.lastChild = child2; + } + child2.appendData(tail.join("")); + _onUpdateChild(node2.ownerDocument, node2); + child2 = sibling; + } else { + child2 = next; + } + } + return true; + } + }); + }, + /** + * Checks whether the DOM implementation implements a specific feature and its version. + * + * @deprecated + * Since `DOMImplementation.hasFeature` is deprecated and always returns true. + * @param {string} feature + * The package name of the feature to test. This is the same name that can be passed to the + * method `hasFeature` on `DOMImplementation`. + * @param {string} version + * This is the version number of the package name to test. + * @returns {boolean} + * Returns true in all cases in the current implementation. + * @since Introduced in DOM Level 2 + * @see {@link DOMImplementation.hasFeature} + */ + isSupported: function(feature, version2) { + return this.ownerDocument.implementation.hasFeature(feature, version2); + }, + /** + * Look up the prefix associated to the given namespace URI, starting from this node. + * **The default namespace declarations are ignored by this method.** + * See Namespace Prefix Lookup for details on the algorithm used by this method. + * + * **This behavior is different from the in the specs**: + * - no node type specific handling + * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes + * + * @param {string | null} namespaceURI + * The namespace URI for which to find the associated prefix. + * @returns {string | null} + * The associated prefix, if found; otherwise, null. + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix + * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo + * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix + * @see https://github.com/xmldom/xmldom/issues/322 + * @prettierignore + */ + lookupPrefix: function(namespaceURI) { + var el = this; + while (el) { + var map = el._nsMap; + if (map) { + for (var n in map) { + if (hasOwn(map, n) && map[n] === namespaceURI) { + return n; + } + } + } + el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; + } + return null; + }, + /** + * This function is used to look up the namespace URI associated with the given prefix, + * starting from this node. + * + * **This behavior is different from the in the specs**: + * - no node type specific handling + * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes + * + * @param {string | null} prefix + * The prefix for which to find the associated namespace URI. + * @returns {string | null} + * The associated namespace URI, if found; otherwise, null. + * @since DOM Level 3 + * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI + * @prettierignore + */ + lookupNamespaceURI: function(prefix) { + var el = this; + while (el) { + var map = el._nsMap; + if (map) { + if (hasOwn(map, prefix)) { + return map[prefix]; + } + } + el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; + } + return null; + }, + /** + * Determines whether the given namespace URI is the default namespace. + * + * The function works by looking up the prefix associated with the given namespace URI. If no + * prefix is found (i.e., the namespace URI is not registered in the namespace map of this + * node or any of its ancestors), it returns `true`, implying the namespace URI is considered + * the default. + * + * **This behavior is different from the in the specs**: + * - no node type specific handling + * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes + * + * @param {string | null} namespaceURI + * The namespace URI to be checked. + * @returns {boolean} + * Returns true if the given namespace URI is the default namespace, false otherwise. + * @since DOM Level 3 + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace + * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace + * @prettierignore + */ + isDefaultNamespace: function(namespaceURI) { + var prefix = this.lookupPrefix(namespaceURI); + return prefix == null; + }, + /** + * Compares the reference node with a node with regard to their position in the document and + * according to the document order. + * + * @param {Node} other + * The node to compare the reference node to. + * @returns {number} + * Returns how the node is positioned relatively to the reference node according to the + * bitmask. 0 if reference node and given node are the same. + * @since DOM Level 3 + * @see https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-compare + * @see https://dom.spec.whatwg.org/#dom-node-comparedocumentposition + */ + compareDocumentPosition: function(other) { + if (this === other) return 0; + var node1 = other; + var node2 = this; + var attr1 = null; + var attr2 = null; + if (node1 instanceof Attr) { + attr1 = node1; + node1 = attr1.ownerElement; + } + if (node2 instanceof Attr) { + attr2 = node2; + node2 = attr2.ownerElement; + if (attr1 && node1 && node2 === node1) { + for (var i = 0, attr; attr = node2.attributes[i]; i++) { + if (attr === attr1) + return DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_PRECEDING; + if (attr === attr2) + return DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_FOLLOWING; + } + } + } + if (!node1 || !node2 || node2.ownerDocument !== node1.ownerDocument) { + return DocumentPosition.DOCUMENT_POSITION_DISCONNECTED + DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + (docGUID(node2.ownerDocument) > docGUID(node1.ownerDocument) ? DocumentPosition.DOCUMENT_POSITION_FOLLOWING : DocumentPosition.DOCUMENT_POSITION_PRECEDING); + } + if (attr2 && node1 === node2) { + return DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING; + } + if (attr1 && node1 === node2) { + return DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING; + } + var chain1 = []; + var ancestor1 = node1.parentNode; + while (ancestor1) { + if (!attr2 && ancestor1 === node2) { + return DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING; + } + chain1.push(ancestor1); + ancestor1 = ancestor1.parentNode; + } + chain1.reverse(); + var chain2 = []; + var ancestor2 = node2.parentNode; + while (ancestor2) { + if (!attr1 && ancestor2 === node1) { + return DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING; + } + chain2.push(ancestor2); + ancestor2 = ancestor2.parentNode; + } + chain2.reverse(); + var ca = commonAncestor(chain1, chain2); + for (var n in ca.childNodes) { + var child2 = ca.childNodes[n]; + if (child2 === node2) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING; + if (child2 === node1) return DocumentPosition.DOCUMENT_POSITION_PRECEDING; + if (chain2.indexOf(child2) >= 0) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING; + if (chain1.indexOf(child2) >= 0) return DocumentPosition.DOCUMENT_POSITION_PRECEDING; + } + return 0; + } + }; + function _xmlEncoder(c) { + return c == "<" && "<" || c == ">" && ">" || c == "&" && "&" || c == '"' && """ || "&#" + c.charCodeAt() + ";"; + } + copy(NodeType, Node); + copy(NodeType, Node.prototype); + copy(DocumentPosition, Node); + copy(DocumentPosition, Node.prototype); + function _visitNode(node2, callback) { + walkDOM(node2, null, { + enter: function(n) { + return callback(n) ? walkDOM.STOP : true; + } + }); + } + function walkDOM(node2, context, callbacks) { + var stack = [{ node: node2, context, phase: walkDOM.ENTER }]; + while (stack.length > 0) { + var frame = stack.pop(); + if (frame.phase === walkDOM.ENTER) { + var childContext = callbacks.enter(frame.node, frame.context); + if (childContext === walkDOM.STOP) { + return walkDOM.STOP; + } + stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT }); + if (childContext === null || childContext === void 0) { + continue; + } + var child2 = frame.node.lastChild; + while (child2) { + stack.push({ node: child2, context: childContext, phase: walkDOM.ENTER }); + child2 = child2.previousSibling; + } + } else { + if (callbacks.exit) { + callbacks.exit(frame.node, frame.context); + } + } + } + } + walkDOM.STOP = /* @__PURE__ */ Symbol("walkDOM.STOP"); + walkDOM.ENTER = 0; + walkDOM.EXIT = 1; + function Document(symbol, options) { + checkSymbol(symbol); + var opt = options || {}; + this.ownerDocument = this; + this.contentType = opt.contentType || MIME_TYPE.XML_APPLICATION; + this.type = isHTMLMimeType(this.contentType) ? "html" : "xml"; + } + function _onAddAttribute(doc, el, newAttr) { + doc && doc._inc++; + var ns = newAttr.namespaceURI; + if (ns === NAMESPACE.XMLNS) { + el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value; + } + } + function _onRemoveAttribute(doc, el, newAttr, remove) { + doc && doc._inc++; + var ns = newAttr.namespaceURI; + if (ns === NAMESPACE.XMLNS) { + delete el._nsMap[newAttr.prefix ? newAttr.localName : ""]; + } + } + function _onUpdateChild(doc, parent, newChild) { + if (doc && doc._inc) { + doc._inc++; + var childNodes = parent.childNodes; + if (newChild && !newChild.nextSibling) { + childNodes[childNodes.length++] = newChild; + } else { + var child2 = parent.firstChild; + var i = 0; + while (child2) { + childNodes[i++] = child2; + child2 = child2.nextSibling; + } + childNodes.length = i; + delete childNodes[childNodes.length]; + } + } + } + function _removeChild(parentNode, child2) { + if (parentNode !== child2.parentNode) { + throw new DOMException(DOMException.NOT_FOUND_ERR, "child's parent is not parent"); + } + var oldPreviousSibling = child2.previousSibling; + var oldNextSibling = child2.nextSibling; + if (oldPreviousSibling) { + oldPreviousSibling.nextSibling = oldNextSibling; + } else { + parentNode.firstChild = oldNextSibling; + } + if (oldNextSibling) { + oldNextSibling.previousSibling = oldPreviousSibling; + } else { + parentNode.lastChild = oldPreviousSibling; + } + _onUpdateChild(parentNode.ownerDocument, parentNode); + child2.parentNode = null; + child2.previousSibling = null; + child2.nextSibling = null; + return child2; + } + function hasValidParentNodeType(node2) { + return node2 && (node2.nodeType === Node.DOCUMENT_NODE || node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node2.nodeType === Node.ELEMENT_NODE); + } + function hasInsertableNodeType(node2) { + return node2 && (node2.nodeType === Node.CDATA_SECTION_NODE || node2.nodeType === Node.COMMENT_NODE || node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node2.nodeType === Node.DOCUMENT_TYPE_NODE || node2.nodeType === Node.ELEMENT_NODE || node2.nodeType === Node.PROCESSING_INSTRUCTION_NODE || node2.nodeType === Node.TEXT_NODE); + } + function isDocTypeNode(node2) { + return node2 && node2.nodeType === Node.DOCUMENT_TYPE_NODE; + } + function isElementNode(node2) { + return node2 && node2.nodeType === Node.ELEMENT_NODE; + } + function isTextNode(node2) { + return node2 && node2.nodeType === Node.TEXT_NODE; + } + function isElementInsertionPossible(doc, child2) { + var parentChildNodes = doc.childNodes || []; + if (find(parentChildNodes, isElementNode) || isDocTypeNode(child2)) { + return false; + } + var docTypeNode = find(parentChildNodes, isDocTypeNode); + return !(child2 && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child2)); + } + function isElementReplacementPossible(doc, child2) { + var parentChildNodes = doc.childNodes || []; + function hasElementChildThatIsNotChild(node2) { + return isElementNode(node2) && node2 !== child2; + } + if (find(parentChildNodes, hasElementChildThatIsNotChild)) { + return false; + } + var docTypeNode = find(parentChildNodes, isDocTypeNode); + return !(child2 && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child2)); + } + function assertPreInsertionValidity1to5(parent, node2, child2) { + if (!hasValidParentNodeType(parent)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType); + } + if (child2 && child2.parentNode !== parent) { + throw new DOMException(DOMException.NOT_FOUND_ERR, "child not in parent"); + } + if ( + // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException. + !hasInsertableNodeType(node2) || // 5. If either `node` is a Text node and `parent` is a document, + // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0 + // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE) + // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException. + isDocTypeNode(node2) && parent.nodeType !== Node.DOCUMENT_NODE + ) { + throw new DOMException( + DOMException.HIERARCHY_REQUEST_ERR, + "Unexpected node type " + node2.nodeType + " for parent node type " + parent.nodeType + ); + } + } + function assertPreInsertionValidityInDocument(parent, node2, child2) { + var parentChildNodes = parent.childNodes || []; + var nodeChildNodes = node2.childNodes || []; + if (node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + var nodeChildElements = nodeChildNodes.filter(isElementNode); + if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment"); + } + if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child2)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype"); + } + } + if (isElementNode(node2)) { + if (!isElementInsertionPossible(parent, child2)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype"); + } + } + if (isDocTypeNode(node2)) { + if (find(parentChildNodes, isDocTypeNode)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed"); + } + var parentElementChild = find(parentChildNodes, isElementNode); + if (child2 && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child2)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element"); + } + if (!child2 && parentElementChild) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present"); + } + } + } + function assertPreReplacementValidityInDocument(parent, node2, child2) { + var parentChildNodes = parent.childNodes || []; + var nodeChildNodes = node2.childNodes || []; + if (node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + var nodeChildElements = nodeChildNodes.filter(isElementNode); + if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment"); + } + if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child2)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype"); + } + } + if (isElementNode(node2)) { + if (!isElementReplacementPossible(parent, child2)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype"); + } + } + if (isDocTypeNode(node2)) { + let hasDoctypeChildThatIsNotChild = function(node3) { + return isDocTypeNode(node3) && node3 !== child2; + }; + if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed"); + } + var parentElementChild = find(parentChildNodes, isElementNode); + if (child2 && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child2)) { + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element"); + } + } + } + function _insertBefore(parent, node2, child2, _inDocumentAssertion) { + assertPreInsertionValidity1to5(parent, node2, child2); + if (parent.nodeType === Node.DOCUMENT_NODE) { + (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node2, child2); + } + var cp = node2.parentNode; + if (cp) { + cp.removeChild(node2); + } + if (node2.nodeType === DOCUMENT_FRAGMENT_NODE) { + var newFirst = node2.firstChild; + if (newFirst == null) { + return node2; + } + var newLast = node2.lastChild; + } else { + newFirst = newLast = node2; + } + var pre = child2 ? child2.previousSibling : parent.lastChild; + newFirst.previousSibling = pre; + newLast.nextSibling = child2; + if (pre) { + pre.nextSibling = newFirst; + } else { + parent.firstChild = newFirst; + } + if (child2 == null) { + parent.lastChild = newLast; + } else { + child2.previousSibling = newLast; + } + do { + newFirst.parentNode = parent; + } while (newFirst !== newLast && (newFirst = newFirst.nextSibling)); + _onUpdateChild(parent.ownerDocument || parent, parent, node2); + if (node2.nodeType == DOCUMENT_FRAGMENT_NODE) { + node2.firstChild = node2.lastChild = null; + } + return node2; + } + Document.prototype = { + /** + * The implementation that created this document. + * + * @type DOMImplementation + * @readonly + */ + implementation: null, + nodeName: "#document", + nodeType: DOCUMENT_NODE, + /** + * The DocumentType node of the document. + * + * @type DocumentType + * @readonly + */ + doctype: null, + documentElement: null, + _inc: 1, + insertBefore: function(newChild, refChild) { + if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { + var child2 = newChild.firstChild; + while (child2) { + var next = child2.nextSibling; + this.insertBefore(child2, refChild); + child2 = next; + } + return newChild; + } + _insertBefore(this, newChild, refChild); + newChild.ownerDocument = this; + if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) { + this.documentElement = newChild; + } + return newChild; + }, + removeChild: function(oldChild) { + var removed = _removeChild(this, oldChild); + if (removed === this.documentElement) { + this.documentElement = null; + } + return removed; + }, + replaceChild: function(newChild, oldChild) { + _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument); + newChild.ownerDocument = this; + if (oldChild) { + this.removeChild(oldChild); + } + if (isElementNode(newChild)) { + this.documentElement = newChild; + } + }, + /** + * Imports a node from another document into this document, creating a new copy owned by this + * document. The source node and its subtree are not modified. + * + * @param {Node} importedNode + * The node to import. + * @param {boolean} deep + * If true, the contents of the node are recursively imported. + * If false, only the node itself (and its attributes, if it is an element) are imported. + * @returns {Node} + * Returns the newly created import of the node. + * @see {@link importNode} + * @see {@link https://dom.spec.whatwg.org/#dom-document-importnode} + */ + importNode: function(importedNode, deep) { + return importNode(this, importedNode, deep); + }, + // Introduced in DOM Level 2: + getElementById: function(id) { + var rtv = null; + _visitNode(this.documentElement, function(node2) { + if (node2.nodeType == ELEMENT_NODE) { + if (node2.getAttribute("id") == id) { + rtv = node2; + return true; + } + } + }); + return rtv; + }, + /** + * Creates a new `Element` that is owned by this `Document`. + * In HTML Documents `localName` is the lower cased `tagName`, + * otherwise no transformation is being applied. + * When `contentType` implies the HTML namespace, it will be set as `namespaceURI`. + * + * __This implementation differs from the specification:__ - The provided name is not checked + * against the `Name` production, + * so no related error will be thrown. + * - There is no interface `HTMLElement`, it is always an `Element`. + * - There is no support for a second argument to indicate using custom elements. + * + * @param {string} tagName + * @returns {Element} + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement + * @see https://dom.spec.whatwg.org/#dom-document-createelement + * @see https://dom.spec.whatwg.org/#concept-create-element + */ + createElement: function(tagName) { + var node2 = new Element(PDC); + node2.ownerDocument = this; + if (this.type === "html") { + tagName = tagName.toLowerCase(); + } + if (hasDefaultHTMLNamespace(this.contentType)) { + node2.namespaceURI = NAMESPACE.HTML; + } + node2.nodeName = tagName; + node2.tagName = tagName; + node2.localName = tagName; + node2.childNodes = new NodeList(); + var attrs = node2.attributes = new NamedNodeMap(); + attrs._ownerElement = node2; + return node2; + }, + /** + * @returns {DocumentFragment} + */ + createDocumentFragment: function() { + var node2 = new DocumentFragment(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + return node2; + }, + /** + * @param {string} data + * @returns {Text} + */ + createTextNode: function(data) { + var node2 = new Text(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.appendData(data); + return node2; + }, + /** + * @param {string} data + * @returns {Comment} + * @see https://dom.spec.whatwg.org/#dom-document-createcomment + * @see https://www.w3.org/TR/xml/#NT-Comment XML 1.0 production [15] + * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.3 + * + * Note: no validation is performed at creation time. When the resulting document is + * serialized with `requireWellFormed: true`, the serializer throws `InvalidStateError` + * if the comment data contains `--` anywhere, ends with `-`, or contains characters + * outside the XML Char production (W3C DOM Parsing §3.2.1.3). Without that option the + * data is emitted verbatim. + */ + createComment: function(data) { + var node2 = new Comment(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.appendData(data); + return node2; + }, + /** + * Returns a new CDATASection node whose data is `data`. + * + * __This implementation differs from the specification:__ - calling this method on an HTML + * document does not throw `NotSupportedError`. + * + * @param {string} data + * @returns {CDATASection} + * @throws {DOMException} + * With code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection + * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection + */ + createCDATASection: function(data) { + if (data.indexOf("]]>") !== -1) { + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'data contains "]]>"'); + } + var node2 = new CDATASection(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.appendData(data); + return node2; + }, + /** + * Returns a ProcessingInstruction node whose target is target and data is data. + * + * __This behavior is slightly different from the in the specs__: + * - it does not do any input validation on the arguments and doesn't throw + * "InvalidCharacterError". + * + * Note: When the resulting document is serialized with `requireWellFormed: true`, the + * serializer throws `InvalidStateError` if `.target` is not a valid XML `NCName` (a `Name` + * with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data` contains + * `?>` or characters outside the XML Char production (W3C DOM Parsing §3.2.1.7). Without that + * option the target and data are emitted verbatim. + * + * @param {string} target + * @param {string} data + * @returns {ProcessingInstruction} + * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction + * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction + * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7 + */ + createProcessingInstruction: function(target, data) { + var node2 = new ProcessingInstruction(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.nodeName = node2.target = target; + node2.nodeValue = node2.data = data; + return node2; + }, + /** + * Creates an `Attr` node that is owned by this document. + * In HTML Documents `localName` is the lower cased `name`, + * otherwise no transformation is being applied. + * + * __This implementation differs from the specification:__ - The provided name is not checked + * against the `Name` production, + * so no related error will be thrown. + * + * @param {string} name + * @returns {Attr} + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute + * @see https://dom.spec.whatwg.org/#dom-document-createattribute + */ + createAttribute: function(name) { + if (!g.QName_exact.test(name)) { + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in name "' + name + '"'); + } + if (this.type === "html") { + name = name.toLowerCase(); + } + return this._createAttribute(name); + }, + _createAttribute: function(name) { + var node2 = new Attr(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.name = name; + node2.nodeName = name; + node2.localName = name; + node2.specified = true; + return node2; + }, + /** + * Creates an EntityReference object. + * The current implementation does not fill the `childNodes` with those of the corresponding + * `Entity` + * + * The `name` is validated against the XML `Name` production at creation time; an invalid name + * throws `InvalidCharacterError`. When the resulting node is serialized with + * `requireWellFormed: true`, the serializer re-validates `nodeName` against the XML `Name` + * production and throws `InvalidStateError` if a later `nodeName` mutation made it invalid; + * without that option the name is emitted verbatim. + * + * __This implementation differs from the specification:__ xmldom does not expand entities — + * the parser resolves entity references inline and never constructs `EntityReference` nodes, + * so this method is the only producer. + * + * @deprecated + * In DOM Level 4. + * @param {string} name + * The name of the entity to reference. No namespace well-formedness checks are performed. + * @returns {EntityReference} + * @throws {DOMException} + * With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`. + * @throws {DOMException} + * with code `NOT_SUPPORTED_ERR` when the document is of type `html` + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE + */ + createEntityReference: function(name) { + if (!g.Name_exact.test(name)) { + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"'); + } + if (this.type === "html") { + throw new DOMException("document is an html document", DOMExceptionName.NotSupportedError); + } + var node2 = new EntityReference(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.nodeName = name; + return node2; + }, + // Introduced in DOM Level 2: + /** + * @param {string} namespaceURI + * @param {string} qualifiedName + * @returns {Element} + */ + createElementNS: function(namespaceURI, qualifiedName) { + var validated = validateAndExtract(namespaceURI, qualifiedName); + var node2 = new Element(PDC); + var attrs = node2.attributes = new NamedNodeMap(); + node2.childNodes = new NodeList(); + node2.ownerDocument = this; + node2.nodeName = qualifiedName; + node2.tagName = qualifiedName; + node2.namespaceURI = validated[0]; + node2.prefix = validated[1]; + node2.localName = validated[2]; + attrs._ownerElement = node2; + return node2; + }, + // Introduced in DOM Level 2: + /** + * @param {string} namespaceURI + * @param {string} qualifiedName + * @returns {Attr} + */ + createAttributeNS: function(namespaceURI, qualifiedName) { + var validated = validateAndExtract(namespaceURI, qualifiedName); + var node2 = new Attr(PDC); + node2.ownerDocument = this; + node2.childNodes = new NodeList(); + node2.nodeName = qualifiedName; + node2.name = qualifiedName; + node2.specified = true; + node2.namespaceURI = validated[0]; + node2.prefix = validated[1]; + node2.localName = validated[2]; + return node2; + } + }; + _extends(Document, Node); + function Element(symbol) { + checkSymbol(symbol); + this._nsMap = /* @__PURE__ */ Object.create(null); + } + Element.prototype = { + nodeType: ELEMENT_NODE, + /** + * The attributes of this element. + * + * @type {NamedNodeMap | null} + */ + attributes: null, + getQualifiedName: function() { + return this.prefix ? this.prefix + ":" + this.localName : this.localName; + }, + _isInHTMLDocumentAndNamespace: function() { + return this.ownerDocument.type === "html" && this.namespaceURI === NAMESPACE.HTML; + }, + /** + * Implementaton of Level2 Core function hasAttributes. + * + * @returns {boolean} + * True if attribute list is not empty. + * @see https://www.w3.org/TR/DOM-Level-2-Core/#core-ID-NodeHasAttrs + */ + hasAttributes: function() { + return !!(this.attributes && this.attributes.length); + }, + hasAttribute: function(name) { + return !!this.getAttributeNode(name); + }, + /** + * Returns element’s first attribute whose qualified name is `name`, and `null` + * if there is no such attribute. + * + * @param {string} name + * @returns {string | null} + */ + getAttribute: function(name) { + var attr = this.getAttributeNode(name); + return attr ? attr.value : null; + }, + getAttributeNode: function(name) { + if (this._isInHTMLDocumentAndNamespace()) { + name = name.toLowerCase(); + } + return this.attributes.getNamedItem(name); + }, + /** + * Sets the value of element’s first attribute whose qualified name is qualifiedName to value. + * + * @param {string} name + * @param {string} value + */ + setAttribute: function(name, value2) { + if (this._isInHTMLDocumentAndNamespace()) { + name = name.toLowerCase(); + } + var attr = this.getAttributeNode(name); + if (attr) { + attr.value = attr.nodeValue = "" + value2; + } else { + attr = this.ownerDocument._createAttribute(name); + attr.value = attr.nodeValue = "" + value2; + this.setAttributeNode(attr); + } + }, + removeAttribute: function(name) { + var attr = this.getAttributeNode(name); + attr && this.removeAttributeNode(attr); + }, + setAttributeNode: function(newAttr) { + return this.attributes.setNamedItem(newAttr); + }, + setAttributeNodeNS: function(newAttr) { + return this.attributes.setNamedItemNS(newAttr); + }, + removeAttributeNode: function(oldAttr) { + return this.attributes.removeNamedItem(oldAttr.nodeName); + }, + //get real attribute name,and remove it by removeAttributeNode + removeAttributeNS: function(namespaceURI, localName) { + var old = this.getAttributeNodeNS(namespaceURI, localName); + old && this.removeAttributeNode(old); + }, + hasAttributeNS: function(namespaceURI, localName) { + return this.getAttributeNodeNS(namespaceURI, localName) != null; + }, + /** + * Returns element’s attribute whose namespace is `namespaceURI` and local name is + * `localName`, + * or `null` if there is no such attribute. + * + * @param {string} namespaceURI + * @param {string} localName + * @returns {string | null} + */ + getAttributeNS: function(namespaceURI, localName) { + var attr = this.getAttributeNodeNS(namespaceURI, localName); + return attr ? attr.value : null; + }, + /** + * Sets the value of element’s attribute whose namespace is `namespaceURI` and local name is + * `localName` to value. + * + * @param {string} namespaceURI + * @param {string} qualifiedName + * @param {string} value + * @see https://dom.spec.whatwg.org/#dom-element-setattributens + */ + setAttributeNS: function(namespaceURI, qualifiedName, value2) { + var validated = validateAndExtract(namespaceURI, qualifiedName); + var localName = validated[2]; + var attr = this.getAttributeNodeNS(namespaceURI, localName); + if (attr) { + attr.value = attr.nodeValue = "" + value2; + } else { + attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); + attr.value = attr.nodeValue = "" + value2; + this.setAttributeNode(attr); + } + }, + getAttributeNodeNS: function(namespaceURI, localName) { + return this.attributes.getNamedItemNS(namespaceURI, localName); + }, + /** + * Returns a LiveNodeList of all child elements which have **all** of the given class name(s). + * + * Returns an empty list if `classNames` is an empty string or only contains HTML white space + * characters. + * + * Warning: This returns a live LiveNodeList. + * Changes in the DOM will reflect in the array as the changes occur. + * If an element selected by this array no longer qualifies for the selector, + * it will automatically be removed. Be aware of this for iteration purposes. + * + * @param {string} classNames + * Is a string representing the class name(s) to match; multiple class names are separated by + * (ASCII-)whitespace. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName + * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname + */ + getElementsByClassName: function(classNames) { + var classNamesSet = toOrderedSet(classNames); + return new LiveNodeList(this, function(base) { + var ls = []; + if (classNamesSet.length > 0) { + _visitNode(base, function(node2) { + if (node2 !== base && node2.nodeType === ELEMENT_NODE) { + var nodeClassNames = node2.getAttribute("class"); + if (nodeClassNames) { + var matches = classNames === nodeClassNames; + if (!matches) { + var nodeClassNamesSet = toOrderedSet(nodeClassNames); + matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet)); + } + if (matches) { + ls.push(node2); + } + } + } + }); + } + return ls; + }); + }, + /** + * Returns a LiveNodeList of elements with the given qualifiedName. + * Searching for all descendants can be done by passing `*` as `qualifiedName`. + * + * All descendants of the specified element are searched, but not the element itself. + * The returned list is live, which means it updates itself with the DOM tree automatically. + * Therefore, there is no need to call `Element.getElementsByTagName()` + * with the same element and arguments repeatedly if the DOM changes in between calls. + * + * When called on an HTML element in an HTML document, + * `getElementsByTagName` lower-cases the argument before searching for it. + * This is undesirable when trying to match camel-cased SVG elements (such as + * ``) in an HTML document. + * Instead, use `Element.getElementsByTagNameNS()`, + * which preserves the capitalization of the tag name. + * + * `Element.getElementsByTagName` is similar to `Document.getElementsByTagName()`, + * except that it only searches for elements that are descendants of the specified element. + * + * @param {string} qualifiedName + * @returns {LiveNodeList} + * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName + * @see https://dom.spec.whatwg.org/#concept-getelementsbytagname + */ + getElementsByTagName: function(qualifiedName) { + var isHTMLDocument = (this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument).type === "html"; + var lowerQualifiedName = qualifiedName.toLowerCase(); + return new LiveNodeList(this, function(base) { + var ls = []; + _visitNode(base, function(node2) { + if (node2 === base || node2.nodeType !== ELEMENT_NODE) { + return; + } + if (qualifiedName === "*") { + ls.push(node2); + } else { + var nodeQualifiedName = node2.getQualifiedName(); + var matchingQName = isHTMLDocument && node2.namespaceURI === NAMESPACE.HTML ? lowerQualifiedName : qualifiedName; + if (nodeQualifiedName === matchingQName) { + ls.push(node2); + } + } + }); + return ls; + }); + }, + getElementsByTagNameNS: function(namespaceURI, localName) { + return new LiveNodeList(this, function(base) { + var ls = []; + _visitNode(base, function(node2) { + if (node2 !== base && node2.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node2.namespaceURI === namespaceURI) && (localName === "*" || node2.localName == localName)) { + ls.push(node2); + } + }); + return ls; + }); + } + }; + Document.prototype.getElementsByClassName = Element.prototype.getElementsByClassName; + Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; + Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; + _extends(Element, Node); + function Attr(symbol) { + checkSymbol(symbol); + this.namespaceURI = null; + this.prefix = null; + this.ownerElement = null; + } + Attr.prototype.nodeType = ATTRIBUTE_NODE; + _extends(Attr, Node); + function CharacterData(symbol) { + checkSymbol(symbol); + } + CharacterData.prototype = { + data: "", + substringData: function(offset, count) { + return this.data.substring(offset, offset + count); + }, + appendData: function(text) { + text = this.data + text; + this.nodeValue = this.data = text; + this.length = text.length; + }, + insertData: function(offset, text) { + this.replaceData(offset, 0, text); + }, + deleteData: function(offset, count) { + this.replaceData(offset, count, ""); + }, + replaceData: function(offset, count, text) { + var start = this.data.substring(0, offset); + var end = this.data.substring(offset + count); + text = start + text + end; + this.nodeValue = this.data = text; + this.length = text.length; + } + }; + _extends(CharacterData, Node); + function Text(symbol) { + checkSymbol(symbol); + } + Text.prototype = { + nodeName: "#text", + nodeType: TEXT_NODE, + splitText: function(offset) { + var text = this.data; + var newText = text.substring(offset); + text = text.substring(0, offset); + this.data = this.nodeValue = text; + this.length = text.length; + var newNode = this.ownerDocument.createTextNode(newText); + if (this.parentNode) { + this.parentNode.insertBefore(newNode, this.nextSibling); + } + return newNode; + } + }; + _extends(Text, CharacterData); + function Comment(symbol) { + checkSymbol(symbol); + } + Comment.prototype = { + nodeName: "#comment", + nodeType: COMMENT_NODE + }; + _extends(Comment, CharacterData); + function CDATASection(symbol) { + checkSymbol(symbol); + } + CDATASection.prototype = { + nodeName: "#cdata-section", + nodeType: CDATA_SECTION_NODE + }; + _extends(CDATASection, Text); + function DocumentType(symbol) { + checkSymbol(symbol); + } + DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; + _extends(DocumentType, Node); + function Notation(symbol) { + checkSymbol(symbol); + } + Notation.prototype.nodeType = NOTATION_NODE; + _extends(Notation, Node); + function Entity(symbol) { + checkSymbol(symbol); + } + Entity.prototype.nodeType = ENTITY_NODE; + _extends(Entity, Node); + function EntityReference(symbol) { + checkSymbol(symbol); + } + EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; + _extends(EntityReference, Node); + function DocumentFragment(symbol) { + checkSymbol(symbol); + } + DocumentFragment.prototype.nodeName = "#document-fragment"; + DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; + _extends(DocumentFragment, Node); + function ProcessingInstruction(symbol) { + checkSymbol(symbol); + } + ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; + _extends(ProcessingInstruction, CharacterData); + function XMLSerializer() { + } + XMLSerializer.prototype.serializeToString = function(node2, options) { + return nodeSerializeToString.call(node2, options); + }; + Node.prototype.toString = nodeSerializeToString; + function nodeSerializeToString(options) { + var opts; + if (typeof options === "function") { + opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: options }; + } else if (options != null) { + opts = { + requireWellFormed: !!options.requireWellFormed, + splitCDATASections: options.splitCDATASections !== false, + nodeFilter: options.nodeFilter || null + }; + } else { + opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: null }; + } + var buf = []; + var refNode = this.nodeType === DOCUMENT_NODE && this.documentElement || this; + var prefix = refNode.prefix; + var uri = refNode.namespaceURI; + if (uri && prefix == null) { + var prefix = refNode.lookupPrefix(uri); + if (prefix == null) { + var visibleNamespaces = [ + { namespace: uri, prefix: null } + //{namespace:uri,prefix:''} + ]; + } + } + serializeToString(this, buf, visibleNamespaces, opts); + return buf.join(""); + } + function needNamespaceDefine(node2, isHTML, visibleNamespaces) { + var prefix = node2.prefix || ""; + var uri = node2.namespaceURI; + if (!uri) { + return false; + } + if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) { + return false; + } + var i = visibleNamespaces.length; + while (i--) { + var ns = visibleNamespaces[i]; + if (ns.prefix === prefix) { + return ns.namespace !== uri; + } + } + return true; + } + function addSerializedAttribute(buf, qualifiedName, value2, requireWellFormed) { + if (requireWellFormed && !g.QName_exact.test(qualifiedName)) { + throw new DOMException( + 'The attribute name "' + qualifiedName + '" is not a valid XML QName', + DOMExceptionName.InvalidStateError + ); + } + buf.push(" ", qualifiedName, '="', value2.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"'); + } + function serializeToString(node2, buf, visibleNamespaces, opts) { + if (!visibleNamespaces) { + visibleNamespaces = []; + } + var nodeFilter = opts.nodeFilter; + var requireWellFormed = opts.requireWellFormed; + var splitCDATASections = opts.splitCDATASections; + var doc = node2.nodeType === DOCUMENT_NODE ? node2 : node2.ownerDocument; + var isHTML = doc.type === "html"; + walkDOM( + node2, + { ns: visibleNamespaces }, + { + enter: function(n, ctx) { + var namespaces = ctx.ns; + if (nodeFilter) { + n = nodeFilter(n); + if (n) { + if (typeof n == "string") { + buf.push(n); + return null; + } + } else { + return null; + } + } + switch (n.nodeType) { + case ELEMENT_NODE: + var attrs = n.attributes; + var len = attrs.length; + var nodeName = n.tagName; + var prefixedNodeName = nodeName; + if (!isHTML && !n.prefix && n.namespaceURI) { + var defaultNS; + for (var ai = 0; ai < attrs.length; ai++) { + if (attrs.item(ai).name === "xmlns") { + defaultNS = attrs.item(ai).value; + break; + } + } + if (!defaultNS) { + for (var nsi = namespaces.length - 1; nsi >= 0; nsi--) { + var nsEntry = namespaces[nsi]; + if (nsEntry.prefix === "" && nsEntry.namespace === n.namespaceURI) { + defaultNS = nsEntry.namespace; + break; + } + } + } + if (defaultNS !== n.namespaceURI) { + for (var nsi = namespaces.length - 1; nsi >= 0; nsi--) { + var nsEntry = namespaces[nsi]; + if (nsEntry.namespace === n.namespaceURI) { + if (nsEntry.prefix) { + prefixedNodeName = nsEntry.prefix + ":" + nodeName; + } + break; + } + } + } + } + if (requireWellFormed && !g.QName_exact.test(prefixedNodeName)) { + throw new DOMException( + 'The element name "' + prefixedNodeName + '" is not a valid XML QName', + DOMExceptionName.InvalidStateError + ); + } + buf.push("<", prefixedNodeName); + var childNamespaces = namespaces.slice(); + for (var i = 0; i < len; i++) { + var attr = attrs.item(i); + if (attr.prefix == "xmlns") { + childNamespaces.push({ + prefix: attr.localName, + namespace: attr.value + }); + } else if (attr.nodeName == "xmlns") { + childNamespaces.push({ prefix: "", namespace: attr.value }); + } + } + for (var i = 0; i < len; i++) { + var attr = attrs.item(i); + if (needNamespaceDefine(attr, isHTML, childNamespaces)) { + var attrPrefix = attr.prefix || ""; + var uri = attr.namespaceURI; + addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri, requireWellFormed); + childNamespaces.push({ prefix: attrPrefix, namespace: uri }); + } + var filteredAttr = nodeFilter ? nodeFilter(attr) : attr; + if (filteredAttr) { + if (typeof filteredAttr === "string") { + buf.push(filteredAttr); + } else { + addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed); + } + } + } + if (nodeName === prefixedNodeName && needNamespaceDefine(n, isHTML, childNamespaces)) { + var nodePrefix = n.prefix || ""; + var uri = n.namespaceURI; + addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri, requireWellFormed); + childNamespaces.push({ prefix: nodePrefix, namespace: uri }); + } + var canCloseTag = !n.firstChild; + if (canCloseTag && (isHTML || n.namespaceURI === NAMESPACE.HTML)) { + canCloseTag = isHTMLVoidElement(nodeName); + } + if (canCloseTag) { + buf.push("/>"); + return null; + } + buf.push(">"); + if (isHTML && isHTMLRawTextElement(nodeName)) { + var child2 = n.firstChild; + while (child2) { + if (child2.data) { + buf.push(child2.data); + } else { + serializeToString(child2, buf, childNamespaces.slice(), opts); + } + child2 = child2.nextSibling; + } + buf.push(""); + return null; + } + return { ns: childNamespaces, tag: prefixedNodeName }; + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + if (requireWellFormed && n.nodeType === DOCUMENT_NODE && n.documentElement == null) { + throw new DOMException("The Document has no documentElement", DOMExceptionName.InvalidStateError); + } + return { ns: namespaces }; + case ATTRIBUTE_NODE: + addSerializedAttribute(buf, n.name, n.value, requireWellFormed); + return null; + case TEXT_NODE: + if (requireWellFormed && g.InvalidChar.test(n.data)) { + throw new DOMException( + "The Text node data contains characters outside the XML Char production", + DOMExceptionName.InvalidStateError + ); + } + buf.push(n.data.replace(/[<&>]/g, _xmlEncoder)); + return null; + case CDATA_SECTION_NODE: + if (requireWellFormed && n.data.indexOf("]]>") !== -1) { + throw new DOMException('The CDATASection data contains "]]>"', DOMExceptionName.InvalidStateError); + } + if (splitCDATASections) { + buf.push(g.CDATA_START, n.data.replace(/]]>/g, "]]]]>"), g.CDATA_END); + } else { + buf.push(g.CDATA_START, n.data, g.CDATA_END); + } + return null; + case COMMENT_NODE: + if (requireWellFormed) { + if (g.InvalidChar.test(n.data)) { + throw new DOMException( + "The comment node data contains characters outside the XML Char production", + DOMExceptionName.InvalidStateError + ); + } + if (n.data.indexOf("--") !== -1 || n.data[n.data.length - 1] === "-") { + throw new DOMException( + 'The comment node data contains "--" or ends with "-"', + DOMExceptionName.InvalidStateError + ); + } + } + buf.push(g.COMMENT_START, n.data, g.COMMENT_END); + return null; + case DOCUMENT_TYPE_NODE: + var pubid = n.publicId; + var sysid = n.systemId; + if (requireWellFormed) { + if (!g.Name_exact.test(n.name)) { + throw new DOMException( + 'The doctype name "' + n.name + '" is not a valid XML Name', + DOMExceptionName.InvalidStateError + ); + } + if (pubid && !g.PubidLiteral_match.test(pubid)) { + throw new DOMException("DocumentType publicId is not a valid PubidLiteral", DOMExceptionName.InvalidStateError); + } + if (sysid && sysid !== "." && !g.SystemLiteral_match.test(sysid)) { + throw new DOMException("DocumentType systemId is not a valid SystemLiteral", DOMExceptionName.InvalidStateError); + } + if (n.internalSubset && n.internalSubset.indexOf("]>") !== -1) { + throw new DOMException('DocumentType internalSubset contains "]>"', DOMExceptionName.InvalidStateError); + } + } + buf.push(g.DOCTYPE_DECL_START, " ", n.name); + if (pubid) { + buf.push(" ", g.PUBLIC, " ", pubid); + if (sysid && sysid !== ".") { + buf.push(" ", sysid); + } + } else if (sysid && sysid !== ".") { + buf.push(" ", g.SYSTEM, " ", sysid); + } + if (n.internalSubset) { + buf.push(" [", n.internalSubset, "]"); + } + buf.push(">"); + return null; + case PROCESSING_INSTRUCTION_NODE: + if (requireWellFormed) { + if (!g.NCName_exact.test(n.target) || n.target.toLowerCase() === "xml") { + throw new DOMException( + 'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved', + DOMExceptionName.InvalidStateError + ); + } + if (g.InvalidChar.test(n.data)) { + throw new DOMException( + "The ProcessingInstruction data contains characters outside the XML Char production", + DOMExceptionName.InvalidStateError + ); + } + if (n.data.indexOf("?>") !== -1) { + throw new DOMException('The ProcessingInstruction data contains "?>"', DOMExceptionName.InvalidStateError); + } + } + buf.push(""); + return null; + case ENTITY_REFERENCE_NODE: + if (requireWellFormed && !g.Name_exact.test(n.nodeName)) { + throw new DOMException( + 'The entity reference name "' + n.nodeName + '" is not a valid XML Name', + DOMExceptionName.InvalidStateError + ); + } + buf.push("&", n.nodeName, ";"); + return null; + //case ENTITY_NODE: + //case NOTATION_NODE: + default: + buf.push("??", n.nodeName); + return null; + } + }, + exit: function(n, childCtx) { + if (childCtx && childCtx.tag) { + buf.push(""); + } + } + } + ); + } + function importNode(doc, node2, deep) { + var destRoot; + walkDOM(node2, null, { + enter: function(srcNode, destParent) { + var destNode = srcNode.cloneNode(false); + destNode.ownerDocument = doc; + destNode.parentNode = null; + if (destParent === null) { + destRoot = destNode; + } else { + destParent.appendChild(destNode); + } + var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep; + return shouldDeep ? destNode : null; + } + }); + return destRoot; + } + function cloneNode(doc, node2, deep) { + var destRoot; + walkDOM(node2, null, { + enter: function(srcNode, destParent) { + var destNode = new srcNode.constructor(PDC); + for (var n in srcNode) { + if (hasOwn(srcNode, n)) { + var v = srcNode[n]; + if (typeof v != "object") { + if (v != destNode[n]) { + destNode[n] = v; + } + } + } + } + if (srcNode.childNodes) { + destNode.childNodes = new NodeList(); + } + destNode.ownerDocument = doc; + var shouldDeep = deep; + switch (destNode.nodeType) { + case ELEMENT_NODE: + var attrs = srcNode.attributes; + var attrs2 = destNode.attributes = new NamedNodeMap(); + var len = attrs.length; + attrs2._ownerElement = destNode; + for (var i = 0; i < len; i++) { + destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true)); + } + break; + case ATTRIBUTE_NODE: + shouldDeep = true; + } + if (destParent !== null) { + destParent.appendChild(destNode); + } else { + destRoot = destNode; + } + return shouldDeep ? destNode : null; + } + }); + return destRoot; + } + function __set__(object8, key, value2) { + object8[key] = value2; + } + function childrenRefresh(node2) { + var ls = []; + var child2 = node2.firstChild; + while (child2) { + if (child2.nodeType === ELEMENT_NODE) { + ls.push(child2); + } + child2 = child2.nextSibling; + } + return ls; + } + try { + if (Object.defineProperty) { + Object.defineProperty(LiveNodeList.prototype, "length", { + get: function() { + _updateLiveList(this); + return this.$$length; + } + }); + Object.defineProperty(Node.prototype, "textContent", { + get: function() { + if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) { + var buf = []; + walkDOM(this, null, { + enter: function(n) { + if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) { + return true; + } + if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) { + return null; + } + buf.push(n.nodeValue); + } + }); + return buf.join(""); + } + return this.nodeValue; + }, + set: function(data) { + switch (this.nodeType) { + case ELEMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + while (this.firstChild) { + this.removeChild(this.firstChild); + } + if (data || String(data)) { + this.appendChild(this.ownerDocument.createTextNode(data)); + } + break; + default: + this.data = data; + this.value = data; + this.nodeValue = data; + } + } + }); + Object.defineProperty(CharacterData.prototype, "data", { + get: function() { + return this._data != null ? this._data : ""; + }, + set: function(v) { + this._data = v; + this.length = typeof v === "string" ? v.length : 0; + } + }); + Object.defineProperty(CharacterData.prototype, "nodeValue", { + get: function() { + return this.data; + }, + set: function(v) { + this.data = v; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Element.prototype, "children", { + get: function() { + return new LiveNodeList(this, childrenRefresh); + } + }); + Object.defineProperty(Document.prototype, "children", { + get: function() { + return new LiveNodeList(this, childrenRefresh); + } + }); + Object.defineProperty(DocumentFragment.prototype, "children", { + get: function() { + return new LiveNodeList(this, childrenRefresh); + } + }); + __set__ = function(object8, key, value2) { + object8["$$" + key] = value2; + }; + } + } catch (e) { + } + exports2._updateLiveList = _updateLiveList; + exports2.Attr = Attr; + exports2.CDATASection = CDATASection; + exports2.CharacterData = CharacterData; + exports2.Comment = Comment; + exports2.Document = Document; + exports2.DocumentFragment = DocumentFragment; + exports2.DocumentType = DocumentType; + exports2.DOMImplementation = DOMImplementation; + exports2.Element = Element; + exports2.Entity = Entity; + exports2.EntityReference = EntityReference; + exports2.LiveNodeList = LiveNodeList; + exports2.NamedNodeMap = NamedNodeMap; + exports2.Node = Node; + exports2.NodeList = NodeList; + exports2.Notation = Notation; + exports2.Text = Text; + exports2.ProcessingInstruction = ProcessingInstruction; + exports2.walkDOM = walkDOM; + exports2.XMLSerializer = XMLSerializer; + } +}); + +// node_modules/@xmldom/xmldom/lib/entities.js +var require_entities = __commonJS({ + "node_modules/@xmldom/xmldom/lib/entities.js"(exports2) { + "use strict"; + var freeze = require_conventions().freeze; + exports2.XML_ENTITIES = freeze({ + amp: "&", + apos: "'", + gt: ">", + lt: "<", + quot: '"' + }); + exports2.HTML_ENTITIES = freeze({ + Aacute: "\xC1", + aacute: "\xE1", + Abreve: "\u0102", + abreve: "\u0103", + ac: "\u223E", + acd: "\u223F", + acE: "\u223E\u0333", + Acirc: "\xC2", + acirc: "\xE2", + acute: "\xB4", + Acy: "\u0410", + acy: "\u0430", + AElig: "\xC6", + aelig: "\xE6", + af: "\u2061", + Afr: "\u{1D504}", + afr: "\u{1D51E}", + Agrave: "\xC0", + agrave: "\xE0", + alefsym: "\u2135", + aleph: "\u2135", + Alpha: "\u0391", + alpha: "\u03B1", + Amacr: "\u0100", + amacr: "\u0101", + amalg: "\u2A3F", + AMP: "&", + amp: "&", + And: "\u2A53", + and: "\u2227", + andand: "\u2A55", + andd: "\u2A5C", + andslope: "\u2A58", + andv: "\u2A5A", + ang: "\u2220", + ange: "\u29A4", + angle: "\u2220", + angmsd: "\u2221", + angmsdaa: "\u29A8", + angmsdab: "\u29A9", + angmsdac: "\u29AA", + angmsdad: "\u29AB", + angmsdae: "\u29AC", + angmsdaf: "\u29AD", + angmsdag: "\u29AE", + angmsdah: "\u29AF", + angrt: "\u221F", + angrtvb: "\u22BE", + angrtvbd: "\u299D", + angsph: "\u2222", + angst: "\xC5", + angzarr: "\u237C", + Aogon: "\u0104", + aogon: "\u0105", + Aopf: "\u{1D538}", + aopf: "\u{1D552}", + ap: "\u2248", + apacir: "\u2A6F", + apE: "\u2A70", + ape: "\u224A", + apid: "\u224B", + apos: "'", + ApplyFunction: "\u2061", + approx: "\u2248", + approxeq: "\u224A", + Aring: "\xC5", + aring: "\xE5", + Ascr: "\u{1D49C}", + ascr: "\u{1D4B6}", + Assign: "\u2254", + ast: "*", + asymp: "\u2248", + asympeq: "\u224D", + Atilde: "\xC3", + atilde: "\xE3", + Auml: "\xC4", + auml: "\xE4", + awconint: "\u2233", + awint: "\u2A11", + backcong: "\u224C", + backepsilon: "\u03F6", + backprime: "\u2035", + backsim: "\u223D", + backsimeq: "\u22CD", + Backslash: "\u2216", + Barv: "\u2AE7", + barvee: "\u22BD", + Barwed: "\u2306", + barwed: "\u2305", + barwedge: "\u2305", + bbrk: "\u23B5", + bbrktbrk: "\u23B6", + bcong: "\u224C", + Bcy: "\u0411", + bcy: "\u0431", + bdquo: "\u201E", + becaus: "\u2235", + Because: "\u2235", + because: "\u2235", + bemptyv: "\u29B0", + bepsi: "\u03F6", + bernou: "\u212C", + Bernoullis: "\u212C", + Beta: "\u0392", + beta: "\u03B2", + beth: "\u2136", + between: "\u226C", + Bfr: "\u{1D505}", + bfr: "\u{1D51F}", + bigcap: "\u22C2", + bigcirc: "\u25EF", + bigcup: "\u22C3", + bigodot: "\u2A00", + bigoplus: "\u2A01", + bigotimes: "\u2A02", + bigsqcup: "\u2A06", + bigstar: "\u2605", + bigtriangledown: "\u25BD", + bigtriangleup: "\u25B3", + biguplus: "\u2A04", + bigvee: "\u22C1", + bigwedge: "\u22C0", + bkarow: "\u290D", + blacklozenge: "\u29EB", + blacksquare: "\u25AA", + blacktriangle: "\u25B4", + blacktriangledown: "\u25BE", + blacktriangleleft: "\u25C2", + blacktriangleright: "\u25B8", + blank: "\u2423", + blk12: "\u2592", + blk14: "\u2591", + blk34: "\u2593", + block: "\u2588", + bne: "=\u20E5", + bnequiv: "\u2261\u20E5", + bNot: "\u2AED", + bnot: "\u2310", + Bopf: "\u{1D539}", + bopf: "\u{1D553}", + bot: "\u22A5", + bottom: "\u22A5", + bowtie: "\u22C8", + boxbox: "\u29C9", + boxDL: "\u2557", + boxDl: "\u2556", + boxdL: "\u2555", + boxdl: "\u2510", + boxDR: "\u2554", + boxDr: "\u2553", + boxdR: "\u2552", + boxdr: "\u250C", + boxH: "\u2550", + boxh: "\u2500", + boxHD: "\u2566", + boxHd: "\u2564", + boxhD: "\u2565", + boxhd: "\u252C", + boxHU: "\u2569", + boxHu: "\u2567", + boxhU: "\u2568", + boxhu: "\u2534", + boxminus: "\u229F", + boxplus: "\u229E", + boxtimes: "\u22A0", + boxUL: "\u255D", + boxUl: "\u255C", + boxuL: "\u255B", + boxul: "\u2518", + boxUR: "\u255A", + boxUr: "\u2559", + boxuR: "\u2558", + boxur: "\u2514", + boxV: "\u2551", + boxv: "\u2502", + boxVH: "\u256C", + boxVh: "\u256B", + boxvH: "\u256A", + boxvh: "\u253C", + boxVL: "\u2563", + boxVl: "\u2562", + boxvL: "\u2561", + boxvl: "\u2524", + boxVR: "\u2560", + boxVr: "\u255F", + boxvR: "\u255E", + boxvr: "\u251C", + bprime: "\u2035", + Breve: "\u02D8", + breve: "\u02D8", + brvbar: "\xA6", + Bscr: "\u212C", + bscr: "\u{1D4B7}", + bsemi: "\u204F", + bsim: "\u223D", + bsime: "\u22CD", + bsol: "\\", + bsolb: "\u29C5", + bsolhsub: "\u27C8", + bull: "\u2022", + bullet: "\u2022", + bump: "\u224E", + bumpE: "\u2AAE", + bumpe: "\u224F", + Bumpeq: "\u224E", + bumpeq: "\u224F", + Cacute: "\u0106", + cacute: "\u0107", + Cap: "\u22D2", + cap: "\u2229", + capand: "\u2A44", + capbrcup: "\u2A49", + capcap: "\u2A4B", + capcup: "\u2A47", + capdot: "\u2A40", + CapitalDifferentialD: "\u2145", + caps: "\u2229\uFE00", + caret: "\u2041", + caron: "\u02C7", + Cayleys: "\u212D", + ccaps: "\u2A4D", + Ccaron: "\u010C", + ccaron: "\u010D", + Ccedil: "\xC7", + ccedil: "\xE7", + Ccirc: "\u0108", + ccirc: "\u0109", + Cconint: "\u2230", + ccups: "\u2A4C", + ccupssm: "\u2A50", + Cdot: "\u010A", + cdot: "\u010B", + cedil: "\xB8", + Cedilla: "\xB8", + cemptyv: "\u29B2", + cent: "\xA2", + CenterDot: "\xB7", + centerdot: "\xB7", + Cfr: "\u212D", + cfr: "\u{1D520}", + CHcy: "\u0427", + chcy: "\u0447", + check: "\u2713", + checkmark: "\u2713", + Chi: "\u03A7", + chi: "\u03C7", + cir: "\u25CB", + circ: "\u02C6", + circeq: "\u2257", + circlearrowleft: "\u21BA", + circlearrowright: "\u21BB", + circledast: "\u229B", + circledcirc: "\u229A", + circleddash: "\u229D", + CircleDot: "\u2299", + circledR: "\xAE", + circledS: "\u24C8", + CircleMinus: "\u2296", + CirclePlus: "\u2295", + CircleTimes: "\u2297", + cirE: "\u29C3", + cire: "\u2257", + cirfnint: "\u2A10", + cirmid: "\u2AEF", + cirscir: "\u29C2", + ClockwiseContourIntegral: "\u2232", + CloseCurlyDoubleQuote: "\u201D", + CloseCurlyQuote: "\u2019", + clubs: "\u2663", + clubsuit: "\u2663", + Colon: "\u2237", + colon: ":", + Colone: "\u2A74", + colone: "\u2254", + coloneq: "\u2254", + comma: ",", + commat: "@", + comp: "\u2201", + compfn: "\u2218", + complement: "\u2201", + complexes: "\u2102", + cong: "\u2245", + congdot: "\u2A6D", + Congruent: "\u2261", + Conint: "\u222F", + conint: "\u222E", + ContourIntegral: "\u222E", + Copf: "\u2102", + copf: "\u{1D554}", + coprod: "\u2210", + Coproduct: "\u2210", + COPY: "\xA9", + copy: "\xA9", + copysr: "\u2117", + CounterClockwiseContourIntegral: "\u2233", + crarr: "\u21B5", + Cross: "\u2A2F", + cross: "\u2717", + Cscr: "\u{1D49E}", + cscr: "\u{1D4B8}", + csub: "\u2ACF", + csube: "\u2AD1", + csup: "\u2AD0", + csupe: "\u2AD2", + ctdot: "\u22EF", + cudarrl: "\u2938", + cudarrr: "\u2935", + cuepr: "\u22DE", + cuesc: "\u22DF", + cularr: "\u21B6", + cularrp: "\u293D", + Cup: "\u22D3", + cup: "\u222A", + cupbrcap: "\u2A48", + CupCap: "\u224D", + cupcap: "\u2A46", + cupcup: "\u2A4A", + cupdot: "\u228D", + cupor: "\u2A45", + cups: "\u222A\uFE00", + curarr: "\u21B7", + curarrm: "\u293C", + curlyeqprec: "\u22DE", + curlyeqsucc: "\u22DF", + curlyvee: "\u22CE", + curlywedge: "\u22CF", + curren: "\xA4", + curvearrowleft: "\u21B6", + curvearrowright: "\u21B7", + cuvee: "\u22CE", + cuwed: "\u22CF", + cwconint: "\u2232", + cwint: "\u2231", + cylcty: "\u232D", + Dagger: "\u2021", + dagger: "\u2020", + daleth: "\u2138", + Darr: "\u21A1", + dArr: "\u21D3", + darr: "\u2193", + dash: "\u2010", + Dashv: "\u2AE4", + dashv: "\u22A3", + dbkarow: "\u290F", + dblac: "\u02DD", + Dcaron: "\u010E", + dcaron: "\u010F", + Dcy: "\u0414", + dcy: "\u0434", + DD: "\u2145", + dd: "\u2146", + ddagger: "\u2021", + ddarr: "\u21CA", + DDotrahd: "\u2911", + ddotseq: "\u2A77", + deg: "\xB0", + Del: "\u2207", + Delta: "\u0394", + delta: "\u03B4", + demptyv: "\u29B1", + dfisht: "\u297F", + Dfr: "\u{1D507}", + dfr: "\u{1D521}", + dHar: "\u2965", + dharl: "\u21C3", + dharr: "\u21C2", + DiacriticalAcute: "\xB4", + DiacriticalDot: "\u02D9", + DiacriticalDoubleAcute: "\u02DD", + DiacriticalGrave: "`", + DiacriticalTilde: "\u02DC", + diam: "\u22C4", + Diamond: "\u22C4", + diamond: "\u22C4", + diamondsuit: "\u2666", + diams: "\u2666", + die: "\xA8", + DifferentialD: "\u2146", + digamma: "\u03DD", + disin: "\u22F2", + div: "\xF7", + divide: "\xF7", + divideontimes: "\u22C7", + divonx: "\u22C7", + DJcy: "\u0402", + djcy: "\u0452", + dlcorn: "\u231E", + dlcrop: "\u230D", + dollar: "$", + Dopf: "\u{1D53B}", + dopf: "\u{1D555}", + Dot: "\xA8", + dot: "\u02D9", + DotDot: "\u20DC", + doteq: "\u2250", + doteqdot: "\u2251", + DotEqual: "\u2250", + dotminus: "\u2238", + dotplus: "\u2214", + dotsquare: "\u22A1", + doublebarwedge: "\u2306", + DoubleContourIntegral: "\u222F", + DoubleDot: "\xA8", + DoubleDownArrow: "\u21D3", + DoubleLeftArrow: "\u21D0", + DoubleLeftRightArrow: "\u21D4", + DoubleLeftTee: "\u2AE4", + DoubleLongLeftArrow: "\u27F8", + DoubleLongLeftRightArrow: "\u27FA", + DoubleLongRightArrow: "\u27F9", + DoubleRightArrow: "\u21D2", + DoubleRightTee: "\u22A8", + DoubleUpArrow: "\u21D1", + DoubleUpDownArrow: "\u21D5", + DoubleVerticalBar: "\u2225", + DownArrow: "\u2193", + Downarrow: "\u21D3", + downarrow: "\u2193", + DownArrowBar: "\u2913", + DownArrowUpArrow: "\u21F5", + DownBreve: "\u0311", + downdownarrows: "\u21CA", + downharpoonleft: "\u21C3", + downharpoonright: "\u21C2", + DownLeftRightVector: "\u2950", + DownLeftTeeVector: "\u295E", + DownLeftVector: "\u21BD", + DownLeftVectorBar: "\u2956", + DownRightTeeVector: "\u295F", + DownRightVector: "\u21C1", + DownRightVectorBar: "\u2957", + DownTee: "\u22A4", + DownTeeArrow: "\u21A7", + drbkarow: "\u2910", + drcorn: "\u231F", + drcrop: "\u230C", + Dscr: "\u{1D49F}", + dscr: "\u{1D4B9}", + DScy: "\u0405", + dscy: "\u0455", + dsol: "\u29F6", + Dstrok: "\u0110", + dstrok: "\u0111", + dtdot: "\u22F1", + dtri: "\u25BF", + dtrif: "\u25BE", + duarr: "\u21F5", + duhar: "\u296F", + dwangle: "\u29A6", + DZcy: "\u040F", + dzcy: "\u045F", + dzigrarr: "\u27FF", + Eacute: "\xC9", + eacute: "\xE9", + easter: "\u2A6E", + Ecaron: "\u011A", + ecaron: "\u011B", + ecir: "\u2256", + Ecirc: "\xCA", + ecirc: "\xEA", + ecolon: "\u2255", + Ecy: "\u042D", + ecy: "\u044D", + eDDot: "\u2A77", + Edot: "\u0116", + eDot: "\u2251", + edot: "\u0117", + ee: "\u2147", + efDot: "\u2252", + Efr: "\u{1D508}", + efr: "\u{1D522}", + eg: "\u2A9A", + Egrave: "\xC8", + egrave: "\xE8", + egs: "\u2A96", + egsdot: "\u2A98", + el: "\u2A99", + Element: "\u2208", + elinters: "\u23E7", + ell: "\u2113", + els: "\u2A95", + elsdot: "\u2A97", + Emacr: "\u0112", + emacr: "\u0113", + empty: "\u2205", + emptyset: "\u2205", + EmptySmallSquare: "\u25FB", + emptyv: "\u2205", + EmptyVerySmallSquare: "\u25AB", + emsp: "\u2003", + emsp13: "\u2004", + emsp14: "\u2005", + ENG: "\u014A", + eng: "\u014B", + ensp: "\u2002", + Eogon: "\u0118", + eogon: "\u0119", + Eopf: "\u{1D53C}", + eopf: "\u{1D556}", + epar: "\u22D5", + eparsl: "\u29E3", + eplus: "\u2A71", + epsi: "\u03B5", + Epsilon: "\u0395", + epsilon: "\u03B5", + epsiv: "\u03F5", + eqcirc: "\u2256", + eqcolon: "\u2255", + eqsim: "\u2242", + eqslantgtr: "\u2A96", + eqslantless: "\u2A95", + Equal: "\u2A75", + equals: "=", + EqualTilde: "\u2242", + equest: "\u225F", + Equilibrium: "\u21CC", + equiv: "\u2261", + equivDD: "\u2A78", + eqvparsl: "\u29E5", + erarr: "\u2971", + erDot: "\u2253", + Escr: "\u2130", + escr: "\u212F", + esdot: "\u2250", + Esim: "\u2A73", + esim: "\u2242", + Eta: "\u0397", + eta: "\u03B7", + ETH: "\xD0", + eth: "\xF0", + Euml: "\xCB", + euml: "\xEB", + euro: "\u20AC", + excl: "!", + exist: "\u2203", + Exists: "\u2203", + expectation: "\u2130", + ExponentialE: "\u2147", + exponentiale: "\u2147", + fallingdotseq: "\u2252", + Fcy: "\u0424", + fcy: "\u0444", + female: "\u2640", + ffilig: "\uFB03", + fflig: "\uFB00", + ffllig: "\uFB04", + Ffr: "\u{1D509}", + ffr: "\u{1D523}", + filig: "\uFB01", + FilledSmallSquare: "\u25FC", + FilledVerySmallSquare: "\u25AA", + fjlig: "fj", + flat: "\u266D", + fllig: "\uFB02", + fltns: "\u25B1", + fnof: "\u0192", + Fopf: "\u{1D53D}", + fopf: "\u{1D557}", + ForAll: "\u2200", + forall: "\u2200", + fork: "\u22D4", + forkv: "\u2AD9", + Fouriertrf: "\u2131", + fpartint: "\u2A0D", + frac12: "\xBD", + frac13: "\u2153", + frac14: "\xBC", + frac15: "\u2155", + frac16: "\u2159", + frac18: "\u215B", + frac23: "\u2154", + frac25: "\u2156", + frac34: "\xBE", + frac35: "\u2157", + frac38: "\u215C", + frac45: "\u2158", + frac56: "\u215A", + frac58: "\u215D", + frac78: "\u215E", + frasl: "\u2044", + frown: "\u2322", + Fscr: "\u2131", + fscr: "\u{1D4BB}", + gacute: "\u01F5", + Gamma: "\u0393", + gamma: "\u03B3", + Gammad: "\u03DC", + gammad: "\u03DD", + gap: "\u2A86", + Gbreve: "\u011E", + gbreve: "\u011F", + Gcedil: "\u0122", + Gcirc: "\u011C", + gcirc: "\u011D", + Gcy: "\u0413", + gcy: "\u0433", + Gdot: "\u0120", + gdot: "\u0121", + gE: "\u2267", + ge: "\u2265", + gEl: "\u2A8C", + gel: "\u22DB", + geq: "\u2265", + geqq: "\u2267", + geqslant: "\u2A7E", + ges: "\u2A7E", + gescc: "\u2AA9", + gesdot: "\u2A80", + gesdoto: "\u2A82", + gesdotol: "\u2A84", + gesl: "\u22DB\uFE00", + gesles: "\u2A94", + Gfr: "\u{1D50A}", + gfr: "\u{1D524}", + Gg: "\u22D9", + gg: "\u226B", + ggg: "\u22D9", + gimel: "\u2137", + GJcy: "\u0403", + gjcy: "\u0453", + gl: "\u2277", + gla: "\u2AA5", + glE: "\u2A92", + glj: "\u2AA4", + gnap: "\u2A8A", + gnapprox: "\u2A8A", + gnE: "\u2269", + gne: "\u2A88", + gneq: "\u2A88", + gneqq: "\u2269", + gnsim: "\u22E7", + Gopf: "\u{1D53E}", + gopf: "\u{1D558}", + grave: "`", + GreaterEqual: "\u2265", + GreaterEqualLess: "\u22DB", + GreaterFullEqual: "\u2267", + GreaterGreater: "\u2AA2", + GreaterLess: "\u2277", + GreaterSlantEqual: "\u2A7E", + GreaterTilde: "\u2273", + Gscr: "\u{1D4A2}", + gscr: "\u210A", + gsim: "\u2273", + gsime: "\u2A8E", + gsiml: "\u2A90", + Gt: "\u226B", + GT: ">", + gt: ">", + gtcc: "\u2AA7", + gtcir: "\u2A7A", + gtdot: "\u22D7", + gtlPar: "\u2995", + gtquest: "\u2A7C", + gtrapprox: "\u2A86", + gtrarr: "\u2978", + gtrdot: "\u22D7", + gtreqless: "\u22DB", + gtreqqless: "\u2A8C", + gtrless: "\u2277", + gtrsim: "\u2273", + gvertneqq: "\u2269\uFE00", + gvnE: "\u2269\uFE00", + Hacek: "\u02C7", + hairsp: "\u200A", + half: "\xBD", + hamilt: "\u210B", + HARDcy: "\u042A", + hardcy: "\u044A", + hArr: "\u21D4", + harr: "\u2194", + harrcir: "\u2948", + harrw: "\u21AD", + Hat: "^", + hbar: "\u210F", + Hcirc: "\u0124", + hcirc: "\u0125", + hearts: "\u2665", + heartsuit: "\u2665", + hellip: "\u2026", + hercon: "\u22B9", + Hfr: "\u210C", + hfr: "\u{1D525}", + HilbertSpace: "\u210B", + hksearow: "\u2925", + hkswarow: "\u2926", + hoarr: "\u21FF", + homtht: "\u223B", + hookleftarrow: "\u21A9", + hookrightarrow: "\u21AA", + Hopf: "\u210D", + hopf: "\u{1D559}", + horbar: "\u2015", + HorizontalLine: "\u2500", + Hscr: "\u210B", + hscr: "\u{1D4BD}", + hslash: "\u210F", + Hstrok: "\u0126", + hstrok: "\u0127", + HumpDownHump: "\u224E", + HumpEqual: "\u224F", + hybull: "\u2043", + hyphen: "\u2010", + Iacute: "\xCD", + iacute: "\xED", + ic: "\u2063", + Icirc: "\xCE", + icirc: "\xEE", + Icy: "\u0418", + icy: "\u0438", + Idot: "\u0130", + IEcy: "\u0415", + iecy: "\u0435", + iexcl: "\xA1", + iff: "\u21D4", + Ifr: "\u2111", + ifr: "\u{1D526}", + Igrave: "\xCC", + igrave: "\xEC", + ii: "\u2148", + iiiint: "\u2A0C", + iiint: "\u222D", + iinfin: "\u29DC", + iiota: "\u2129", + IJlig: "\u0132", + ijlig: "\u0133", + Im: "\u2111", + Imacr: "\u012A", + imacr: "\u012B", + image: "\u2111", + ImaginaryI: "\u2148", + imagline: "\u2110", + imagpart: "\u2111", + imath: "\u0131", + imof: "\u22B7", + imped: "\u01B5", + Implies: "\u21D2", + in: "\u2208", + incare: "\u2105", + infin: "\u221E", + infintie: "\u29DD", + inodot: "\u0131", + Int: "\u222C", + int: "\u222B", + intcal: "\u22BA", + integers: "\u2124", + Integral: "\u222B", + intercal: "\u22BA", + Intersection: "\u22C2", + intlarhk: "\u2A17", + intprod: "\u2A3C", + InvisibleComma: "\u2063", + InvisibleTimes: "\u2062", + IOcy: "\u0401", + iocy: "\u0451", + Iogon: "\u012E", + iogon: "\u012F", + Iopf: "\u{1D540}", + iopf: "\u{1D55A}", + Iota: "\u0399", + iota: "\u03B9", + iprod: "\u2A3C", + iquest: "\xBF", + Iscr: "\u2110", + iscr: "\u{1D4BE}", + isin: "\u2208", + isindot: "\u22F5", + isinE: "\u22F9", + isins: "\u22F4", + isinsv: "\u22F3", + isinv: "\u2208", + it: "\u2062", + Itilde: "\u0128", + itilde: "\u0129", + Iukcy: "\u0406", + iukcy: "\u0456", + Iuml: "\xCF", + iuml: "\xEF", + Jcirc: "\u0134", + jcirc: "\u0135", + Jcy: "\u0419", + jcy: "\u0439", + Jfr: "\u{1D50D}", + jfr: "\u{1D527}", + jmath: "\u0237", + Jopf: "\u{1D541}", + jopf: "\u{1D55B}", + Jscr: "\u{1D4A5}", + jscr: "\u{1D4BF}", + Jsercy: "\u0408", + jsercy: "\u0458", + Jukcy: "\u0404", + jukcy: "\u0454", + Kappa: "\u039A", + kappa: "\u03BA", + kappav: "\u03F0", + Kcedil: "\u0136", + kcedil: "\u0137", + Kcy: "\u041A", + kcy: "\u043A", + Kfr: "\u{1D50E}", + kfr: "\u{1D528}", + kgreen: "\u0138", + KHcy: "\u0425", + khcy: "\u0445", + KJcy: "\u040C", + kjcy: "\u045C", + Kopf: "\u{1D542}", + kopf: "\u{1D55C}", + Kscr: "\u{1D4A6}", + kscr: "\u{1D4C0}", + lAarr: "\u21DA", + Lacute: "\u0139", + lacute: "\u013A", + laemptyv: "\u29B4", + lagran: "\u2112", + Lambda: "\u039B", + lambda: "\u03BB", + Lang: "\u27EA", + lang: "\u27E8", + langd: "\u2991", + langle: "\u27E8", + lap: "\u2A85", + Laplacetrf: "\u2112", + laquo: "\xAB", + Larr: "\u219E", + lArr: "\u21D0", + larr: "\u2190", + larrb: "\u21E4", + larrbfs: "\u291F", + larrfs: "\u291D", + larrhk: "\u21A9", + larrlp: "\u21AB", + larrpl: "\u2939", + larrsim: "\u2973", + larrtl: "\u21A2", + lat: "\u2AAB", + lAtail: "\u291B", + latail: "\u2919", + late: "\u2AAD", + lates: "\u2AAD\uFE00", + lBarr: "\u290E", + lbarr: "\u290C", + lbbrk: "\u2772", + lbrace: "{", + lbrack: "[", + lbrke: "\u298B", + lbrksld: "\u298F", + lbrkslu: "\u298D", + Lcaron: "\u013D", + lcaron: "\u013E", + Lcedil: "\u013B", + lcedil: "\u013C", + lceil: "\u2308", + lcub: "{", + Lcy: "\u041B", + lcy: "\u043B", + ldca: "\u2936", + ldquo: "\u201C", + ldquor: "\u201E", + ldrdhar: "\u2967", + ldrushar: "\u294B", + ldsh: "\u21B2", + lE: "\u2266", + le: "\u2264", + LeftAngleBracket: "\u27E8", + LeftArrow: "\u2190", + Leftarrow: "\u21D0", + leftarrow: "\u2190", + LeftArrowBar: "\u21E4", + LeftArrowRightArrow: "\u21C6", + leftarrowtail: "\u21A2", + LeftCeiling: "\u2308", + LeftDoubleBracket: "\u27E6", + LeftDownTeeVector: "\u2961", + LeftDownVector: "\u21C3", + LeftDownVectorBar: "\u2959", + LeftFloor: "\u230A", + leftharpoondown: "\u21BD", + leftharpoonup: "\u21BC", + leftleftarrows: "\u21C7", + LeftRightArrow: "\u2194", + Leftrightarrow: "\u21D4", + leftrightarrow: "\u2194", + leftrightarrows: "\u21C6", + leftrightharpoons: "\u21CB", + leftrightsquigarrow: "\u21AD", + LeftRightVector: "\u294E", + LeftTee: "\u22A3", + LeftTeeArrow: "\u21A4", + LeftTeeVector: "\u295A", + leftthreetimes: "\u22CB", + LeftTriangle: "\u22B2", + LeftTriangleBar: "\u29CF", + LeftTriangleEqual: "\u22B4", + LeftUpDownVector: "\u2951", + LeftUpTeeVector: "\u2960", + LeftUpVector: "\u21BF", + LeftUpVectorBar: "\u2958", + LeftVector: "\u21BC", + LeftVectorBar: "\u2952", + lEg: "\u2A8B", + leg: "\u22DA", + leq: "\u2264", + leqq: "\u2266", + leqslant: "\u2A7D", + les: "\u2A7D", + lescc: "\u2AA8", + lesdot: "\u2A7F", + lesdoto: "\u2A81", + lesdotor: "\u2A83", + lesg: "\u22DA\uFE00", + lesges: "\u2A93", + lessapprox: "\u2A85", + lessdot: "\u22D6", + lesseqgtr: "\u22DA", + lesseqqgtr: "\u2A8B", + LessEqualGreater: "\u22DA", + LessFullEqual: "\u2266", + LessGreater: "\u2276", + lessgtr: "\u2276", + LessLess: "\u2AA1", + lesssim: "\u2272", + LessSlantEqual: "\u2A7D", + LessTilde: "\u2272", + lfisht: "\u297C", + lfloor: "\u230A", + Lfr: "\u{1D50F}", + lfr: "\u{1D529}", + lg: "\u2276", + lgE: "\u2A91", + lHar: "\u2962", + lhard: "\u21BD", + lharu: "\u21BC", + lharul: "\u296A", + lhblk: "\u2584", + LJcy: "\u0409", + ljcy: "\u0459", + Ll: "\u22D8", + ll: "\u226A", + llarr: "\u21C7", + llcorner: "\u231E", + Lleftarrow: "\u21DA", + llhard: "\u296B", + lltri: "\u25FA", + Lmidot: "\u013F", + lmidot: "\u0140", + lmoust: "\u23B0", + lmoustache: "\u23B0", + lnap: "\u2A89", + lnapprox: "\u2A89", + lnE: "\u2268", + lne: "\u2A87", + lneq: "\u2A87", + lneqq: "\u2268", + lnsim: "\u22E6", + loang: "\u27EC", + loarr: "\u21FD", + lobrk: "\u27E6", + LongLeftArrow: "\u27F5", + Longleftarrow: "\u27F8", + longleftarrow: "\u27F5", + LongLeftRightArrow: "\u27F7", + Longleftrightarrow: "\u27FA", + longleftrightarrow: "\u27F7", + longmapsto: "\u27FC", + LongRightArrow: "\u27F6", + Longrightarrow: "\u27F9", + longrightarrow: "\u27F6", + looparrowleft: "\u21AB", + looparrowright: "\u21AC", + lopar: "\u2985", + Lopf: "\u{1D543}", + lopf: "\u{1D55D}", + loplus: "\u2A2D", + lotimes: "\u2A34", + lowast: "\u2217", + lowbar: "_", + LowerLeftArrow: "\u2199", + LowerRightArrow: "\u2198", + loz: "\u25CA", + lozenge: "\u25CA", + lozf: "\u29EB", + lpar: "(", + lparlt: "\u2993", + lrarr: "\u21C6", + lrcorner: "\u231F", + lrhar: "\u21CB", + lrhard: "\u296D", + lrm: "\u200E", + lrtri: "\u22BF", + lsaquo: "\u2039", + Lscr: "\u2112", + lscr: "\u{1D4C1}", + Lsh: "\u21B0", + lsh: "\u21B0", + lsim: "\u2272", + lsime: "\u2A8D", + lsimg: "\u2A8F", + lsqb: "[", + lsquo: "\u2018", + lsquor: "\u201A", + Lstrok: "\u0141", + lstrok: "\u0142", + Lt: "\u226A", + LT: "<", + lt: "<", + ltcc: "\u2AA6", + ltcir: "\u2A79", + ltdot: "\u22D6", + lthree: "\u22CB", + ltimes: "\u22C9", + ltlarr: "\u2976", + ltquest: "\u2A7B", + ltri: "\u25C3", + ltrie: "\u22B4", + ltrif: "\u25C2", + ltrPar: "\u2996", + lurdshar: "\u294A", + luruhar: "\u2966", + lvertneqq: "\u2268\uFE00", + lvnE: "\u2268\uFE00", + macr: "\xAF", + male: "\u2642", + malt: "\u2720", + maltese: "\u2720", + Map: "\u2905", + map: "\u21A6", + mapsto: "\u21A6", + mapstodown: "\u21A7", + mapstoleft: "\u21A4", + mapstoup: "\u21A5", + marker: "\u25AE", + mcomma: "\u2A29", + Mcy: "\u041C", + mcy: "\u043C", + mdash: "\u2014", + mDDot: "\u223A", + measuredangle: "\u2221", + MediumSpace: "\u205F", + Mellintrf: "\u2133", + Mfr: "\u{1D510}", + mfr: "\u{1D52A}", + mho: "\u2127", + micro: "\xB5", + mid: "\u2223", + midast: "*", + midcir: "\u2AF0", + middot: "\xB7", + minus: "\u2212", + minusb: "\u229F", + minusd: "\u2238", + minusdu: "\u2A2A", + MinusPlus: "\u2213", + mlcp: "\u2ADB", + mldr: "\u2026", + mnplus: "\u2213", + models: "\u22A7", + Mopf: "\u{1D544}", + mopf: "\u{1D55E}", + mp: "\u2213", + Mscr: "\u2133", + mscr: "\u{1D4C2}", + mstpos: "\u223E", + Mu: "\u039C", + mu: "\u03BC", + multimap: "\u22B8", + mumap: "\u22B8", + nabla: "\u2207", + Nacute: "\u0143", + nacute: "\u0144", + nang: "\u2220\u20D2", + nap: "\u2249", + napE: "\u2A70\u0338", + napid: "\u224B\u0338", + napos: "\u0149", + napprox: "\u2249", + natur: "\u266E", + natural: "\u266E", + naturals: "\u2115", + nbsp: "\xA0", + nbump: "\u224E\u0338", + nbumpe: "\u224F\u0338", + ncap: "\u2A43", + Ncaron: "\u0147", + ncaron: "\u0148", + Ncedil: "\u0145", + ncedil: "\u0146", + ncong: "\u2247", + ncongdot: "\u2A6D\u0338", + ncup: "\u2A42", + Ncy: "\u041D", + ncy: "\u043D", + ndash: "\u2013", + ne: "\u2260", + nearhk: "\u2924", + neArr: "\u21D7", + nearr: "\u2197", + nearrow: "\u2197", + nedot: "\u2250\u0338", + NegativeMediumSpace: "\u200B", + NegativeThickSpace: "\u200B", + NegativeThinSpace: "\u200B", + NegativeVeryThinSpace: "\u200B", + nequiv: "\u2262", + nesear: "\u2928", + nesim: "\u2242\u0338", + NestedGreaterGreater: "\u226B", + NestedLessLess: "\u226A", + NewLine: "\n", + nexist: "\u2204", + nexists: "\u2204", + Nfr: "\u{1D511}", + nfr: "\u{1D52B}", + ngE: "\u2267\u0338", + nge: "\u2271", + ngeq: "\u2271", + ngeqq: "\u2267\u0338", + ngeqslant: "\u2A7E\u0338", + nges: "\u2A7E\u0338", + nGg: "\u22D9\u0338", + ngsim: "\u2275", + nGt: "\u226B\u20D2", + ngt: "\u226F", + ngtr: "\u226F", + nGtv: "\u226B\u0338", + nhArr: "\u21CE", + nharr: "\u21AE", + nhpar: "\u2AF2", + ni: "\u220B", + nis: "\u22FC", + nisd: "\u22FA", + niv: "\u220B", + NJcy: "\u040A", + njcy: "\u045A", + nlArr: "\u21CD", + nlarr: "\u219A", + nldr: "\u2025", + nlE: "\u2266\u0338", + nle: "\u2270", + nLeftarrow: "\u21CD", + nleftarrow: "\u219A", + nLeftrightarrow: "\u21CE", + nleftrightarrow: "\u21AE", + nleq: "\u2270", + nleqq: "\u2266\u0338", + nleqslant: "\u2A7D\u0338", + nles: "\u2A7D\u0338", + nless: "\u226E", + nLl: "\u22D8\u0338", + nlsim: "\u2274", + nLt: "\u226A\u20D2", + nlt: "\u226E", + nltri: "\u22EA", + nltrie: "\u22EC", + nLtv: "\u226A\u0338", + nmid: "\u2224", + NoBreak: "\u2060", + NonBreakingSpace: "\xA0", + Nopf: "\u2115", + nopf: "\u{1D55F}", + Not: "\u2AEC", + not: "\xAC", + NotCongruent: "\u2262", + NotCupCap: "\u226D", + NotDoubleVerticalBar: "\u2226", + NotElement: "\u2209", + NotEqual: "\u2260", + NotEqualTilde: "\u2242\u0338", + NotExists: "\u2204", + NotGreater: "\u226F", + NotGreaterEqual: "\u2271", + NotGreaterFullEqual: "\u2267\u0338", + NotGreaterGreater: "\u226B\u0338", + NotGreaterLess: "\u2279", + NotGreaterSlantEqual: "\u2A7E\u0338", + NotGreaterTilde: "\u2275", + NotHumpDownHump: "\u224E\u0338", + NotHumpEqual: "\u224F\u0338", + notin: "\u2209", + notindot: "\u22F5\u0338", + notinE: "\u22F9\u0338", + notinva: "\u2209", + notinvb: "\u22F7", + notinvc: "\u22F6", + NotLeftTriangle: "\u22EA", + NotLeftTriangleBar: "\u29CF\u0338", + NotLeftTriangleEqual: "\u22EC", + NotLess: "\u226E", + NotLessEqual: "\u2270", + NotLessGreater: "\u2278", + NotLessLess: "\u226A\u0338", + NotLessSlantEqual: "\u2A7D\u0338", + NotLessTilde: "\u2274", + NotNestedGreaterGreater: "\u2AA2\u0338", + NotNestedLessLess: "\u2AA1\u0338", + notni: "\u220C", + notniva: "\u220C", + notnivb: "\u22FE", + notnivc: "\u22FD", + NotPrecedes: "\u2280", + NotPrecedesEqual: "\u2AAF\u0338", + NotPrecedesSlantEqual: "\u22E0", + NotReverseElement: "\u220C", + NotRightTriangle: "\u22EB", + NotRightTriangleBar: "\u29D0\u0338", + NotRightTriangleEqual: "\u22ED", + NotSquareSubset: "\u228F\u0338", + NotSquareSubsetEqual: "\u22E2", + NotSquareSuperset: "\u2290\u0338", + NotSquareSupersetEqual: "\u22E3", + NotSubset: "\u2282\u20D2", + NotSubsetEqual: "\u2288", + NotSucceeds: "\u2281", + NotSucceedsEqual: "\u2AB0\u0338", + NotSucceedsSlantEqual: "\u22E1", + NotSucceedsTilde: "\u227F\u0338", + NotSuperset: "\u2283\u20D2", + NotSupersetEqual: "\u2289", + NotTilde: "\u2241", + NotTildeEqual: "\u2244", + NotTildeFullEqual: "\u2247", + NotTildeTilde: "\u2249", + NotVerticalBar: "\u2224", + npar: "\u2226", + nparallel: "\u2226", + nparsl: "\u2AFD\u20E5", + npart: "\u2202\u0338", + npolint: "\u2A14", + npr: "\u2280", + nprcue: "\u22E0", + npre: "\u2AAF\u0338", + nprec: "\u2280", + npreceq: "\u2AAF\u0338", + nrArr: "\u21CF", + nrarr: "\u219B", + nrarrc: "\u2933\u0338", + nrarrw: "\u219D\u0338", + nRightarrow: "\u21CF", + nrightarrow: "\u219B", + nrtri: "\u22EB", + nrtrie: "\u22ED", + nsc: "\u2281", + nsccue: "\u22E1", + nsce: "\u2AB0\u0338", + Nscr: "\u{1D4A9}", + nscr: "\u{1D4C3}", + nshortmid: "\u2224", + nshortparallel: "\u2226", + nsim: "\u2241", + nsime: "\u2244", + nsimeq: "\u2244", + nsmid: "\u2224", + nspar: "\u2226", + nsqsube: "\u22E2", + nsqsupe: "\u22E3", + nsub: "\u2284", + nsubE: "\u2AC5\u0338", + nsube: "\u2288", + nsubset: "\u2282\u20D2", + nsubseteq: "\u2288", + nsubseteqq: "\u2AC5\u0338", + nsucc: "\u2281", + nsucceq: "\u2AB0\u0338", + nsup: "\u2285", + nsupE: "\u2AC6\u0338", + nsupe: "\u2289", + nsupset: "\u2283\u20D2", + nsupseteq: "\u2289", + nsupseteqq: "\u2AC6\u0338", + ntgl: "\u2279", + Ntilde: "\xD1", + ntilde: "\xF1", + ntlg: "\u2278", + ntriangleleft: "\u22EA", + ntrianglelefteq: "\u22EC", + ntriangleright: "\u22EB", + ntrianglerighteq: "\u22ED", + Nu: "\u039D", + nu: "\u03BD", + num: "#", + numero: "\u2116", + numsp: "\u2007", + nvap: "\u224D\u20D2", + nVDash: "\u22AF", + nVdash: "\u22AE", + nvDash: "\u22AD", + nvdash: "\u22AC", + nvge: "\u2265\u20D2", + nvgt: ">\u20D2", + nvHarr: "\u2904", + nvinfin: "\u29DE", + nvlArr: "\u2902", + nvle: "\u2264\u20D2", + nvlt: "<\u20D2", + nvltrie: "\u22B4\u20D2", + nvrArr: "\u2903", + nvrtrie: "\u22B5\u20D2", + nvsim: "\u223C\u20D2", + nwarhk: "\u2923", + nwArr: "\u21D6", + nwarr: "\u2196", + nwarrow: "\u2196", + nwnear: "\u2927", + Oacute: "\xD3", + oacute: "\xF3", + oast: "\u229B", + ocir: "\u229A", + Ocirc: "\xD4", + ocirc: "\xF4", + Ocy: "\u041E", + ocy: "\u043E", + odash: "\u229D", + Odblac: "\u0150", + odblac: "\u0151", + odiv: "\u2A38", + odot: "\u2299", + odsold: "\u29BC", + OElig: "\u0152", + oelig: "\u0153", + ofcir: "\u29BF", + Ofr: "\u{1D512}", + ofr: "\u{1D52C}", + ogon: "\u02DB", + Ograve: "\xD2", + ograve: "\xF2", + ogt: "\u29C1", + ohbar: "\u29B5", + ohm: "\u03A9", + oint: "\u222E", + olarr: "\u21BA", + olcir: "\u29BE", + olcross: "\u29BB", + oline: "\u203E", + olt: "\u29C0", + Omacr: "\u014C", + omacr: "\u014D", + Omega: "\u03A9", + omega: "\u03C9", + Omicron: "\u039F", + omicron: "\u03BF", + omid: "\u29B6", + ominus: "\u2296", + Oopf: "\u{1D546}", + oopf: "\u{1D560}", + opar: "\u29B7", + OpenCurlyDoubleQuote: "\u201C", + OpenCurlyQuote: "\u2018", + operp: "\u29B9", + oplus: "\u2295", + Or: "\u2A54", + or: "\u2228", + orarr: "\u21BB", + ord: "\u2A5D", + order: "\u2134", + orderof: "\u2134", + ordf: "\xAA", + ordm: "\xBA", + origof: "\u22B6", + oror: "\u2A56", + orslope: "\u2A57", + orv: "\u2A5B", + oS: "\u24C8", + Oscr: "\u{1D4AA}", + oscr: "\u2134", + Oslash: "\xD8", + oslash: "\xF8", + osol: "\u2298", + Otilde: "\xD5", + otilde: "\xF5", + Otimes: "\u2A37", + otimes: "\u2297", + otimesas: "\u2A36", + Ouml: "\xD6", + ouml: "\xF6", + ovbar: "\u233D", + OverBar: "\u203E", + OverBrace: "\u23DE", + OverBracket: "\u23B4", + OverParenthesis: "\u23DC", + par: "\u2225", + para: "\xB6", + parallel: "\u2225", + parsim: "\u2AF3", + parsl: "\u2AFD", + part: "\u2202", + PartialD: "\u2202", + Pcy: "\u041F", + pcy: "\u043F", + percnt: "%", + period: ".", + permil: "\u2030", + perp: "\u22A5", + pertenk: "\u2031", + Pfr: "\u{1D513}", + pfr: "\u{1D52D}", + Phi: "\u03A6", + phi: "\u03C6", + phiv: "\u03D5", + phmmat: "\u2133", + phone: "\u260E", + Pi: "\u03A0", + pi: "\u03C0", + pitchfork: "\u22D4", + piv: "\u03D6", + planck: "\u210F", + planckh: "\u210E", + plankv: "\u210F", + plus: "+", + plusacir: "\u2A23", + plusb: "\u229E", + pluscir: "\u2A22", + plusdo: "\u2214", + plusdu: "\u2A25", + pluse: "\u2A72", + PlusMinus: "\xB1", + plusmn: "\xB1", + plussim: "\u2A26", + plustwo: "\u2A27", + pm: "\xB1", + Poincareplane: "\u210C", + pointint: "\u2A15", + Popf: "\u2119", + popf: "\u{1D561}", + pound: "\xA3", + Pr: "\u2ABB", + pr: "\u227A", + prap: "\u2AB7", + prcue: "\u227C", + prE: "\u2AB3", + pre: "\u2AAF", + prec: "\u227A", + precapprox: "\u2AB7", + preccurlyeq: "\u227C", + Precedes: "\u227A", + PrecedesEqual: "\u2AAF", + PrecedesSlantEqual: "\u227C", + PrecedesTilde: "\u227E", + preceq: "\u2AAF", + precnapprox: "\u2AB9", + precneqq: "\u2AB5", + precnsim: "\u22E8", + precsim: "\u227E", + Prime: "\u2033", + prime: "\u2032", + primes: "\u2119", + prnap: "\u2AB9", + prnE: "\u2AB5", + prnsim: "\u22E8", + prod: "\u220F", + Product: "\u220F", + profalar: "\u232E", + profline: "\u2312", + profsurf: "\u2313", + prop: "\u221D", + Proportion: "\u2237", + Proportional: "\u221D", + propto: "\u221D", + prsim: "\u227E", + prurel: "\u22B0", + Pscr: "\u{1D4AB}", + pscr: "\u{1D4C5}", + Psi: "\u03A8", + psi: "\u03C8", + puncsp: "\u2008", + Qfr: "\u{1D514}", + qfr: "\u{1D52E}", + qint: "\u2A0C", + Qopf: "\u211A", + qopf: "\u{1D562}", + qprime: "\u2057", + Qscr: "\u{1D4AC}", + qscr: "\u{1D4C6}", + quaternions: "\u210D", + quatint: "\u2A16", + quest: "?", + questeq: "\u225F", + QUOT: '"', + quot: '"', + rAarr: "\u21DB", + race: "\u223D\u0331", + Racute: "\u0154", + racute: "\u0155", + radic: "\u221A", + raemptyv: "\u29B3", + Rang: "\u27EB", + rang: "\u27E9", + rangd: "\u2992", + range: "\u29A5", + rangle: "\u27E9", + raquo: "\xBB", + Rarr: "\u21A0", + rArr: "\u21D2", + rarr: "\u2192", + rarrap: "\u2975", + rarrb: "\u21E5", + rarrbfs: "\u2920", + rarrc: "\u2933", + rarrfs: "\u291E", + rarrhk: "\u21AA", + rarrlp: "\u21AC", + rarrpl: "\u2945", + rarrsim: "\u2974", + Rarrtl: "\u2916", + rarrtl: "\u21A3", + rarrw: "\u219D", + rAtail: "\u291C", + ratail: "\u291A", + ratio: "\u2236", + rationals: "\u211A", + RBarr: "\u2910", + rBarr: "\u290F", + rbarr: "\u290D", + rbbrk: "\u2773", + rbrace: "}", + rbrack: "]", + rbrke: "\u298C", + rbrksld: "\u298E", + rbrkslu: "\u2990", + Rcaron: "\u0158", + rcaron: "\u0159", + Rcedil: "\u0156", + rcedil: "\u0157", + rceil: "\u2309", + rcub: "}", + Rcy: "\u0420", + rcy: "\u0440", + rdca: "\u2937", + rdldhar: "\u2969", + rdquo: "\u201D", + rdquor: "\u201D", + rdsh: "\u21B3", + Re: "\u211C", + real: "\u211C", + realine: "\u211B", + realpart: "\u211C", + reals: "\u211D", + rect: "\u25AD", + REG: "\xAE", + reg: "\xAE", + ReverseElement: "\u220B", + ReverseEquilibrium: "\u21CB", + ReverseUpEquilibrium: "\u296F", + rfisht: "\u297D", + rfloor: "\u230B", + Rfr: "\u211C", + rfr: "\u{1D52F}", + rHar: "\u2964", + rhard: "\u21C1", + rharu: "\u21C0", + rharul: "\u296C", + Rho: "\u03A1", + rho: "\u03C1", + rhov: "\u03F1", + RightAngleBracket: "\u27E9", + RightArrow: "\u2192", + Rightarrow: "\u21D2", + rightarrow: "\u2192", + RightArrowBar: "\u21E5", + RightArrowLeftArrow: "\u21C4", + rightarrowtail: "\u21A3", + RightCeiling: "\u2309", + RightDoubleBracket: "\u27E7", + RightDownTeeVector: "\u295D", + RightDownVector: "\u21C2", + RightDownVectorBar: "\u2955", + RightFloor: "\u230B", + rightharpoondown: "\u21C1", + rightharpoonup: "\u21C0", + rightleftarrows: "\u21C4", + rightleftharpoons: "\u21CC", + rightrightarrows: "\u21C9", + rightsquigarrow: "\u219D", + RightTee: "\u22A2", + RightTeeArrow: "\u21A6", + RightTeeVector: "\u295B", + rightthreetimes: "\u22CC", + RightTriangle: "\u22B3", + RightTriangleBar: "\u29D0", + RightTriangleEqual: "\u22B5", + RightUpDownVector: "\u294F", + RightUpTeeVector: "\u295C", + RightUpVector: "\u21BE", + RightUpVectorBar: "\u2954", + RightVector: "\u21C0", + RightVectorBar: "\u2953", + ring: "\u02DA", + risingdotseq: "\u2253", + rlarr: "\u21C4", + rlhar: "\u21CC", + rlm: "\u200F", + rmoust: "\u23B1", + rmoustache: "\u23B1", + rnmid: "\u2AEE", + roang: "\u27ED", + roarr: "\u21FE", + robrk: "\u27E7", + ropar: "\u2986", + Ropf: "\u211D", + ropf: "\u{1D563}", + roplus: "\u2A2E", + rotimes: "\u2A35", + RoundImplies: "\u2970", + rpar: ")", + rpargt: "\u2994", + rppolint: "\u2A12", + rrarr: "\u21C9", + Rrightarrow: "\u21DB", + rsaquo: "\u203A", + Rscr: "\u211B", + rscr: "\u{1D4C7}", + Rsh: "\u21B1", + rsh: "\u21B1", + rsqb: "]", + rsquo: "\u2019", + rsquor: "\u2019", + rthree: "\u22CC", + rtimes: "\u22CA", + rtri: "\u25B9", + rtrie: "\u22B5", + rtrif: "\u25B8", + rtriltri: "\u29CE", + RuleDelayed: "\u29F4", + ruluhar: "\u2968", + rx: "\u211E", + Sacute: "\u015A", + sacute: "\u015B", + sbquo: "\u201A", + Sc: "\u2ABC", + sc: "\u227B", + scap: "\u2AB8", + Scaron: "\u0160", + scaron: "\u0161", + sccue: "\u227D", + scE: "\u2AB4", + sce: "\u2AB0", + Scedil: "\u015E", + scedil: "\u015F", + Scirc: "\u015C", + scirc: "\u015D", + scnap: "\u2ABA", + scnE: "\u2AB6", + scnsim: "\u22E9", + scpolint: "\u2A13", + scsim: "\u227F", + Scy: "\u0421", + scy: "\u0441", + sdot: "\u22C5", + sdotb: "\u22A1", + sdote: "\u2A66", + searhk: "\u2925", + seArr: "\u21D8", + searr: "\u2198", + searrow: "\u2198", + sect: "\xA7", + semi: ";", + seswar: "\u2929", + setminus: "\u2216", + setmn: "\u2216", + sext: "\u2736", + Sfr: "\u{1D516}", + sfr: "\u{1D530}", + sfrown: "\u2322", + sharp: "\u266F", + SHCHcy: "\u0429", + shchcy: "\u0449", + SHcy: "\u0428", + shcy: "\u0448", + ShortDownArrow: "\u2193", + ShortLeftArrow: "\u2190", + shortmid: "\u2223", + shortparallel: "\u2225", + ShortRightArrow: "\u2192", + ShortUpArrow: "\u2191", + shy: "\xAD", + Sigma: "\u03A3", + sigma: "\u03C3", + sigmaf: "\u03C2", + sigmav: "\u03C2", + sim: "\u223C", + simdot: "\u2A6A", + sime: "\u2243", + simeq: "\u2243", + simg: "\u2A9E", + simgE: "\u2AA0", + siml: "\u2A9D", + simlE: "\u2A9F", + simne: "\u2246", + simplus: "\u2A24", + simrarr: "\u2972", + slarr: "\u2190", + SmallCircle: "\u2218", + smallsetminus: "\u2216", + smashp: "\u2A33", + smeparsl: "\u29E4", + smid: "\u2223", + smile: "\u2323", + smt: "\u2AAA", + smte: "\u2AAC", + smtes: "\u2AAC\uFE00", + SOFTcy: "\u042C", + softcy: "\u044C", + sol: "/", + solb: "\u29C4", + solbar: "\u233F", + Sopf: "\u{1D54A}", + sopf: "\u{1D564}", + spades: "\u2660", + spadesuit: "\u2660", + spar: "\u2225", + sqcap: "\u2293", + sqcaps: "\u2293\uFE00", + sqcup: "\u2294", + sqcups: "\u2294\uFE00", + Sqrt: "\u221A", + sqsub: "\u228F", + sqsube: "\u2291", + sqsubset: "\u228F", + sqsubseteq: "\u2291", + sqsup: "\u2290", + sqsupe: "\u2292", + sqsupset: "\u2290", + sqsupseteq: "\u2292", + squ: "\u25A1", + Square: "\u25A1", + square: "\u25A1", + SquareIntersection: "\u2293", + SquareSubset: "\u228F", + SquareSubsetEqual: "\u2291", + SquareSuperset: "\u2290", + SquareSupersetEqual: "\u2292", + SquareUnion: "\u2294", + squarf: "\u25AA", + squf: "\u25AA", + srarr: "\u2192", + Sscr: "\u{1D4AE}", + sscr: "\u{1D4C8}", + ssetmn: "\u2216", + ssmile: "\u2323", + sstarf: "\u22C6", + Star: "\u22C6", + star: "\u2606", + starf: "\u2605", + straightepsilon: "\u03F5", + straightphi: "\u03D5", + strns: "\xAF", + Sub: "\u22D0", + sub: "\u2282", + subdot: "\u2ABD", + subE: "\u2AC5", + sube: "\u2286", + subedot: "\u2AC3", + submult: "\u2AC1", + subnE: "\u2ACB", + subne: "\u228A", + subplus: "\u2ABF", + subrarr: "\u2979", + Subset: "\u22D0", + subset: "\u2282", + subseteq: "\u2286", + subseteqq: "\u2AC5", + SubsetEqual: "\u2286", + subsetneq: "\u228A", + subsetneqq: "\u2ACB", + subsim: "\u2AC7", + subsub: "\u2AD5", + subsup: "\u2AD3", + succ: "\u227B", + succapprox: "\u2AB8", + succcurlyeq: "\u227D", + Succeeds: "\u227B", + SucceedsEqual: "\u2AB0", + SucceedsSlantEqual: "\u227D", + SucceedsTilde: "\u227F", + succeq: "\u2AB0", + succnapprox: "\u2ABA", + succneqq: "\u2AB6", + succnsim: "\u22E9", + succsim: "\u227F", + SuchThat: "\u220B", + Sum: "\u2211", + sum: "\u2211", + sung: "\u266A", + Sup: "\u22D1", + sup: "\u2283", + sup1: "\xB9", + sup2: "\xB2", + sup3: "\xB3", + supdot: "\u2ABE", + supdsub: "\u2AD8", + supE: "\u2AC6", + supe: "\u2287", + supedot: "\u2AC4", + Superset: "\u2283", + SupersetEqual: "\u2287", + suphsol: "\u27C9", + suphsub: "\u2AD7", + suplarr: "\u297B", + supmult: "\u2AC2", + supnE: "\u2ACC", + supne: "\u228B", + supplus: "\u2AC0", + Supset: "\u22D1", + supset: "\u2283", + supseteq: "\u2287", + supseteqq: "\u2AC6", + supsetneq: "\u228B", + supsetneqq: "\u2ACC", + supsim: "\u2AC8", + supsub: "\u2AD4", + supsup: "\u2AD6", + swarhk: "\u2926", + swArr: "\u21D9", + swarr: "\u2199", + swarrow: "\u2199", + swnwar: "\u292A", + szlig: "\xDF", + Tab: " ", + target: "\u2316", + Tau: "\u03A4", + tau: "\u03C4", + tbrk: "\u23B4", + Tcaron: "\u0164", + tcaron: "\u0165", + Tcedil: "\u0162", + tcedil: "\u0163", + Tcy: "\u0422", + tcy: "\u0442", + tdot: "\u20DB", + telrec: "\u2315", + Tfr: "\u{1D517}", + tfr: "\u{1D531}", + there4: "\u2234", + Therefore: "\u2234", + therefore: "\u2234", + Theta: "\u0398", + theta: "\u03B8", + thetasym: "\u03D1", + thetav: "\u03D1", + thickapprox: "\u2248", + thicksim: "\u223C", + ThickSpace: "\u205F\u200A", + thinsp: "\u2009", + ThinSpace: "\u2009", + thkap: "\u2248", + thksim: "\u223C", + THORN: "\xDE", + thorn: "\xFE", + Tilde: "\u223C", + tilde: "\u02DC", + TildeEqual: "\u2243", + TildeFullEqual: "\u2245", + TildeTilde: "\u2248", + times: "\xD7", + timesb: "\u22A0", + timesbar: "\u2A31", + timesd: "\u2A30", + tint: "\u222D", + toea: "\u2928", + top: "\u22A4", + topbot: "\u2336", + topcir: "\u2AF1", + Topf: "\u{1D54B}", + topf: "\u{1D565}", + topfork: "\u2ADA", + tosa: "\u2929", + tprime: "\u2034", + TRADE: "\u2122", + trade: "\u2122", + triangle: "\u25B5", + triangledown: "\u25BF", + triangleleft: "\u25C3", + trianglelefteq: "\u22B4", + triangleq: "\u225C", + triangleright: "\u25B9", + trianglerighteq: "\u22B5", + tridot: "\u25EC", + trie: "\u225C", + triminus: "\u2A3A", + TripleDot: "\u20DB", + triplus: "\u2A39", + trisb: "\u29CD", + tritime: "\u2A3B", + trpezium: "\u23E2", + Tscr: "\u{1D4AF}", + tscr: "\u{1D4C9}", + TScy: "\u0426", + tscy: "\u0446", + TSHcy: "\u040B", + tshcy: "\u045B", + Tstrok: "\u0166", + tstrok: "\u0167", + twixt: "\u226C", + twoheadleftarrow: "\u219E", + twoheadrightarrow: "\u21A0", + Uacute: "\xDA", + uacute: "\xFA", + Uarr: "\u219F", + uArr: "\u21D1", + uarr: "\u2191", + Uarrocir: "\u2949", + Ubrcy: "\u040E", + ubrcy: "\u045E", + Ubreve: "\u016C", + ubreve: "\u016D", + Ucirc: "\xDB", + ucirc: "\xFB", + Ucy: "\u0423", + ucy: "\u0443", + udarr: "\u21C5", + Udblac: "\u0170", + udblac: "\u0171", + udhar: "\u296E", + ufisht: "\u297E", + Ufr: "\u{1D518}", + ufr: "\u{1D532}", + Ugrave: "\xD9", + ugrave: "\xF9", + uHar: "\u2963", + uharl: "\u21BF", + uharr: "\u21BE", + uhblk: "\u2580", + ulcorn: "\u231C", + ulcorner: "\u231C", + ulcrop: "\u230F", + ultri: "\u25F8", + Umacr: "\u016A", + umacr: "\u016B", + uml: "\xA8", + UnderBar: "_", + UnderBrace: "\u23DF", + UnderBracket: "\u23B5", + UnderParenthesis: "\u23DD", + Union: "\u22C3", + UnionPlus: "\u228E", + Uogon: "\u0172", + uogon: "\u0173", + Uopf: "\u{1D54C}", + uopf: "\u{1D566}", + UpArrow: "\u2191", + Uparrow: "\u21D1", + uparrow: "\u2191", + UpArrowBar: "\u2912", + UpArrowDownArrow: "\u21C5", + UpDownArrow: "\u2195", + Updownarrow: "\u21D5", + updownarrow: "\u2195", + UpEquilibrium: "\u296E", + upharpoonleft: "\u21BF", + upharpoonright: "\u21BE", + uplus: "\u228E", + UpperLeftArrow: "\u2196", + UpperRightArrow: "\u2197", + Upsi: "\u03D2", + upsi: "\u03C5", + upsih: "\u03D2", + Upsilon: "\u03A5", + upsilon: "\u03C5", + UpTee: "\u22A5", + UpTeeArrow: "\u21A5", + upuparrows: "\u21C8", + urcorn: "\u231D", + urcorner: "\u231D", + urcrop: "\u230E", + Uring: "\u016E", + uring: "\u016F", + urtri: "\u25F9", + Uscr: "\u{1D4B0}", + uscr: "\u{1D4CA}", + utdot: "\u22F0", + Utilde: "\u0168", + utilde: "\u0169", + utri: "\u25B5", + utrif: "\u25B4", + uuarr: "\u21C8", + Uuml: "\xDC", + uuml: "\xFC", + uwangle: "\u29A7", + vangrt: "\u299C", + varepsilon: "\u03F5", + varkappa: "\u03F0", + varnothing: "\u2205", + varphi: "\u03D5", + varpi: "\u03D6", + varpropto: "\u221D", + vArr: "\u21D5", + varr: "\u2195", + varrho: "\u03F1", + varsigma: "\u03C2", + varsubsetneq: "\u228A\uFE00", + varsubsetneqq: "\u2ACB\uFE00", + varsupsetneq: "\u228B\uFE00", + varsupsetneqq: "\u2ACC\uFE00", + vartheta: "\u03D1", + vartriangleleft: "\u22B2", + vartriangleright: "\u22B3", + Vbar: "\u2AEB", + vBar: "\u2AE8", + vBarv: "\u2AE9", + Vcy: "\u0412", + vcy: "\u0432", + VDash: "\u22AB", + Vdash: "\u22A9", + vDash: "\u22A8", + vdash: "\u22A2", + Vdashl: "\u2AE6", + Vee: "\u22C1", + vee: "\u2228", + veebar: "\u22BB", + veeeq: "\u225A", + vellip: "\u22EE", + Verbar: "\u2016", + verbar: "|", + Vert: "\u2016", + vert: "|", + VerticalBar: "\u2223", + VerticalLine: "|", + VerticalSeparator: "\u2758", + VerticalTilde: "\u2240", + VeryThinSpace: "\u200A", + Vfr: "\u{1D519}", + vfr: "\u{1D533}", + vltri: "\u22B2", + vnsub: "\u2282\u20D2", + vnsup: "\u2283\u20D2", + Vopf: "\u{1D54D}", + vopf: "\u{1D567}", + vprop: "\u221D", + vrtri: "\u22B3", + Vscr: "\u{1D4B1}", + vscr: "\u{1D4CB}", + vsubnE: "\u2ACB\uFE00", + vsubne: "\u228A\uFE00", + vsupnE: "\u2ACC\uFE00", + vsupne: "\u228B\uFE00", + Vvdash: "\u22AA", + vzigzag: "\u299A", + Wcirc: "\u0174", + wcirc: "\u0175", + wedbar: "\u2A5F", + Wedge: "\u22C0", + wedge: "\u2227", + wedgeq: "\u2259", + weierp: "\u2118", + Wfr: "\u{1D51A}", + wfr: "\u{1D534}", + Wopf: "\u{1D54E}", + wopf: "\u{1D568}", + wp: "\u2118", + wr: "\u2240", + wreath: "\u2240", + Wscr: "\u{1D4B2}", + wscr: "\u{1D4CC}", + xcap: "\u22C2", + xcirc: "\u25EF", + xcup: "\u22C3", + xdtri: "\u25BD", + Xfr: "\u{1D51B}", + xfr: "\u{1D535}", + xhArr: "\u27FA", + xharr: "\u27F7", + Xi: "\u039E", + xi: "\u03BE", + xlArr: "\u27F8", + xlarr: "\u27F5", + xmap: "\u27FC", + xnis: "\u22FB", + xodot: "\u2A00", + Xopf: "\u{1D54F}", + xopf: "\u{1D569}", + xoplus: "\u2A01", + xotime: "\u2A02", + xrArr: "\u27F9", + xrarr: "\u27F6", + Xscr: "\u{1D4B3}", + xscr: "\u{1D4CD}", + xsqcup: "\u2A06", + xuplus: "\u2A04", + xutri: "\u25B3", + xvee: "\u22C1", + xwedge: "\u22C0", + Yacute: "\xDD", + yacute: "\xFD", + YAcy: "\u042F", + yacy: "\u044F", + Ycirc: "\u0176", + ycirc: "\u0177", + Ycy: "\u042B", + ycy: "\u044B", + yen: "\xA5", + Yfr: "\u{1D51C}", + yfr: "\u{1D536}", + YIcy: "\u0407", + yicy: "\u0457", + Yopf: "\u{1D550}", + yopf: "\u{1D56A}", + Yscr: "\u{1D4B4}", + yscr: "\u{1D4CE}", + YUcy: "\u042E", + yucy: "\u044E", + Yuml: "\u0178", + yuml: "\xFF", + Zacute: "\u0179", + zacute: "\u017A", + Zcaron: "\u017D", + zcaron: "\u017E", + Zcy: "\u0417", + zcy: "\u0437", + Zdot: "\u017B", + zdot: "\u017C", + zeetrf: "\u2128", + ZeroWidthSpace: "\u200B", + Zeta: "\u0396", + zeta: "\u03B6", + Zfr: "\u2128", + zfr: "\u{1D537}", + ZHcy: "\u0416", + zhcy: "\u0436", + zigrarr: "\u21DD", + Zopf: "\u2124", + zopf: "\u{1D56B}", + Zscr: "\u{1D4B5}", + zscr: "\u{1D4CF}", + zwj: "\u200D", + zwnj: "\u200C" + }); + exports2.entityMap = exports2.HTML_ENTITIES; + } +}); + +// node_modules/@xmldom/xmldom/lib/sax.js +var require_sax = __commonJS({ + "node_modules/@xmldom/xmldom/lib/sax.js"(exports2) { + "use strict"; + var conventions = require_conventions(); + var g = require_grammar(); + var errors = require_errors(); + var isHTMLEscapableRawTextElement = conventions.isHTMLEscapableRawTextElement; + var isHTMLMimeType = conventions.isHTMLMimeType; + var isHTMLRawTextElement = conventions.isHTMLRawTextElement; + var hasOwn = conventions.hasOwn; + var NAMESPACE = conventions.NAMESPACE; + var ParseError = errors.ParseError; + var DOMException = errors.DOMException; + var S_TAG = 0; + var S_ATTR = 1; + var S_ATTR_SPACE = 2; + var S_EQ = 3; + var S_ATTR_NOQUOT_VALUE = 4; + var S_ATTR_END = 5; + var S_TAG_SPACE = 6; + var S_TAG_CLOSE = 7; + function XMLReader() { + } + XMLReader.prototype = { + parse: function(source, defaultNSMap, entityMap) { + var domBuilder = this.domBuilder; + domBuilder.startDocument(); + _copy(defaultNSMap, defaultNSMap = /* @__PURE__ */ Object.create(null)); + parse4(source, defaultNSMap, entityMap, domBuilder, this.errorHandler); + domBuilder.endDocument(); + } + }; + var ENTITY_REG = /&#?\w+;?/g; + function parse4(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) { + var isHTML = isHTMLMimeType(domBuilder.mimeType); + if (source.indexOf(g.UNICODE_REPLACEMENT_CHARACTER) >= 0) { + errorHandler.warning("Unicode replacement character detected, source encoding issues?"); + } + function fixedFromCharCode(code) { + if (code > 65535) { + code -= 65536; + var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023); + return String.fromCharCode(surrogate1, surrogate2); + } else { + return String.fromCharCode(code); + } + } + function entityReplacer(a2) { + var complete = a2[a2.length - 1] === ";" ? a2 : a2 + ";"; + if (!isHTML && complete !== a2) { + errorHandler.error("EntityRef: expecting ;"); + return a2; + } + var match = g.Reference.exec(complete); + if (!match || match[0].length !== complete.length) { + errorHandler.error("entity not matching Reference production: " + a2); + return a2; + } + var k = complete.slice(1, -1); + if (hasOwn(entityMap, k)) { + return entityMap[k]; + } else if (k.charAt(0) === "#") { + return fixedFromCharCode(parseInt(k.substring(1).replace("x", "0x"))); + } else { + errorHandler.error("entity not found:" + a2); + return a2; + } + } + function appendText(end2) { + if (end2 > start) { + var xt = source.substring(start, end2).replace(ENTITY_REG, entityReplacer); + locator && position(start); + domBuilder.characters(xt, 0, end2 - start); + start = end2; + } + } + var lineStart = 0; + var lineEnd = 0; + var linePattern = /\r\n?|\n|$/g; + var locator = domBuilder.locator; + function position(p, m) { + while (p >= lineEnd && (m = linePattern.exec(source))) { + lineStart = lineEnd; + lineEnd = m.index + m[0].length; + locator.lineNumber++; + } + locator.columnNumber = p - lineStart + 1; + } + var parseStack = [{ currentNSMap: defaultNSMapCopy }]; + var unclosedTags = []; + var start = 0; + while (true) { + try { + var tagStart = source.indexOf("<", start); + if (tagStart < 0) { + if (!isHTML && unclosedTags.length > 0) { + return errorHandler.fatalError("unclosed xml tag(s): " + unclosedTags.join(", ")); + } + if (!source.substring(start).match(/^\s*$/)) { + var doc = domBuilder.doc; + var text = doc.createTextNode(source.substring(start)); + if (doc.documentElement) { + return errorHandler.error("Extra content at the end of the document"); + } + doc.appendChild(text); + domBuilder.currentElement = text; + } + return; + } + if (tagStart > start) { + var fromSource = source.substring(start, tagStart); + if (!isHTML && unclosedTags.length === 0) { + fromSource = fromSource.replace(new RegExp(g.S_OPT.source, "g"), ""); + fromSource && errorHandler.error("Unexpected content outside root element: '" + fromSource + "'"); + } + appendText(tagStart); + } + switch (source.charAt(tagStart + 1)) { + case "/": + var end = source.indexOf(">", tagStart + 2); + var tagNameRaw = source.substring(tagStart + 2, end > 0 ? end : void 0); + if (!tagNameRaw) { + return errorHandler.fatalError("end tag name missing"); + } + var endTagNameStrict = g.reg("^", g.QName_group, g.S_OPT, "$"); + var tagNameMatch = end > 0 && endTagNameStrict.exec(tagNameRaw); + if (!tagNameMatch) { + var leadingTagNameMatch = end > 0 && g.reg("^", g.QName_group).exec(tagNameRaw); + if (isHTML && leadingTagNameMatch) { + errorHandler.warning('end tag name contains invalid trailing characters: "' + tagNameRaw + '"'); + tagNameMatch = leadingTagNameMatch; + } else if ( + // Backward compatibility, remove this whole `else if` arm in the next breaking release + // (XML then falls through to the `fatalError` below, for a clean mode split: XML fatal, + // HTML warning). A valid end-tag name followed by a line break and trailing content was + // silently accepted while `reg` still used the `m` flag; re-adding `m` here matches exactly + // those inputs, kept recoverable and reported. + leadingTagNameMatch && new RegExp(endTagNameStrict.source, endTagNameStrict.flags + "m").test(tagNameRaw) + ) { + errorHandler.error('end tag name is followed by a line break and trailing content: "' + tagNameRaw + '"'); + tagNameMatch = leadingTagNameMatch; + } else { + return errorHandler.fatalError('end tag name contains invalid characters: "' + tagNameRaw + '"'); + } + } + if (!domBuilder.currentElement && !domBuilder.doc.documentElement) { + return; + } + var currentTagName = unclosedTags[unclosedTags.length - 1] || domBuilder.currentElement.tagName || domBuilder.doc.documentElement.tagName || ""; + if (currentTagName !== tagNameMatch[1]) { + var tagNameLower = tagNameMatch[1].toLowerCase(); + if (!isHTML || currentTagName.toLowerCase() !== tagNameLower) { + return errorHandler.fatalError('Opening and ending tag mismatch: "' + currentTagName + '" != "' + tagNameRaw + '"'); + } + } + var config3 = parseStack.pop(); + unclosedTags.pop(); + var localNSMap = config3.localNSMap; + domBuilder.endElement(config3.uri, config3.localName, currentTagName); + if (localNSMap) { + for (var prefix in localNSMap) { + if (hasOwn(localNSMap, prefix)) { + domBuilder.endPrefixMapping(prefix); + } + } + } + end++; + break; + // end element + case "?": + locator && position(tagStart); + end = parseProcessingInstruction(source, tagStart, domBuilder, errorHandler); + break; + case "!": + locator && position(tagStart); + end = parseDoctypeCommentOrCData(source, tagStart, domBuilder, errorHandler, isHTML); + break; + default: + locator && position(tagStart); + var el = new ElementAttributes(); + var currentNSMap = parseStack[parseStack.length - 1].currentNSMap; + var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler, isHTML); + var len = el.length; + if (!el.closed) { + if (isHTML && conventions.isHTMLVoidElement(el.tagName)) { + el.closed = true; + } else { + unclosedTags.push(el.tagName); + } + } + if (locator && len) { + var locator2 = copyLocator(locator, {}); + for (var i = 0; i < len; i++) { + var a = el[i]; + position(a.offset); + a.locator = copyLocator(locator, {}); + } + domBuilder.locator = locator2; + if (appendElement(el, domBuilder, currentNSMap)) { + parseStack.push(el); + } + domBuilder.locator = locator; + } else { + if (appendElement(el, domBuilder, currentNSMap)) { + parseStack.push(el); + } + } + if (isHTML && !el.closed) { + end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder); + } else { + end++; + } + } + } catch (e) { + if (e instanceof ParseError) { + throw e; + } else if (e instanceof DOMException) { + return errorHandler.fatalError("Error constructing the DOM: " + e.name + ": " + e.message, e); + } + errorHandler.error("element parse error: " + e); + end = -1; + } + if (end > start) { + start = end; + } else { + appendText(Math.max(tagStart, start) + 1); + } + } + } + function copyLocator(f, t) { + t.lineNumber = f.lineNumber; + t.columnNumber = f.columnNumber; + return t; + } + function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler, isHTML) { + function addAttribute(qname, value3, startIndex) { + if (hasOwn(el.attributeNames, qname)) { + return errorHandler.fatalError("Attribute " + qname + " redefined"); + } + if (!isHTML && value3.indexOf("<") >= 0) { + return errorHandler.fatalError("Unescaped '<' not allowed in attributes values"); + } + el.addValue( + qname, + // @see https://www.w3.org/TR/xml/#AVNormalize + // since the xmldom sax parser does not "interpret" DTD the following is not implemented: + // - recursive replacement of (DTD) entity references + // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA + value3.replace(/[\t\n\r]/g, " ").replace(ENTITY_REG, entityReplacer), + startIndex + ); + } + var attrName; + var value2; + var p = ++start; + var s = S_TAG; + while (true) { + var c = source.charAt(p); + if (s === S_TAG && c === "<") { + throw new Error("unexpected < in tag name: " + source.slice(start, p)); + } + switch (c) { + case "=": + if (s === S_ATTR) { + attrName = source.slice(start, p); + s = S_EQ; + } else if (s === S_ATTR_SPACE) { + s = S_EQ; + } else { + throw new Error("attribute equal must after attrName"); + } + break; + case "'": + case '"': + if (s === S_EQ || s === S_ATTR) { + if (s === S_ATTR) { + errorHandler.warning('attribute value must after "="'); + attrName = source.slice(start, p); + } + start = p + 1; + p = source.indexOf(c, start); + if (p > 0) { + value2 = source.slice(start, p); + addAttribute(attrName, value2, start - 1); + s = S_ATTR_END; + } else { + throw new Error("attribute value no end '" + c + "' match"); + } + } else if (s == S_ATTR_NOQUOT_VALUE) { + value2 = source.slice(start, p); + addAttribute(attrName, value2, start); + errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!"); + start = p + 1; + s = S_ATTR_END; + } else { + throw new Error('attribute value must after "="'); + } + break; + case "/": + switch (s) { + case S_TAG: + el.setTagName(source.slice(start, p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + s = S_TAG_CLOSE; + el.closed = true; + case S_ATTR_NOQUOT_VALUE: + case S_ATTR: + break; + case S_ATTR_SPACE: + el.closed = true; + break; + //case S_EQ: + default: + throw new Error("attribute invalid close char('/')"); + } + break; + case "": + errorHandler.error("unexpected end of input"); + if (s == S_TAG) { + el.setTagName(source.slice(start, p)); + } + return p; + case ">": + switch (s) { + case S_TAG: + el.setTagName(source.slice(start, p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + break; + //normal + case S_ATTR_NOQUOT_VALUE: + //Compatible state + case S_ATTR: + value2 = source.slice(start, p); + if (value2.slice(-1) === "/") { + el.closed = true; + value2 = value2.slice(0, -1); + } + case S_ATTR_SPACE: + if (s === S_ATTR_SPACE) { + value2 = attrName; + } + if (s == S_ATTR_NOQUOT_VALUE) { + errorHandler.warning('attribute "' + value2 + '" missed quot(")!'); + addAttribute(attrName, value2, start); + } else { + if (!isHTML) { + errorHandler.warning('attribute "' + value2 + '" missed value!! "' + value2 + '" instead!!'); + } + addAttribute(value2, value2, start); + } + break; + case S_EQ: + if (!isHTML) { + return errorHandler.fatalError(`AttValue: ' or " expected`); + } + } + return p; + /*xml space '\x20' | #x9 | #xD | #xA; */ + case "\x80": + c = " "; + default: + if (c <= " ") { + switch (s) { + case S_TAG: + el.setTagName(source.slice(start, p)); + s = S_TAG_SPACE; + break; + case S_ATTR: + attrName = source.slice(start, p); + s = S_ATTR_SPACE; + break; + case S_ATTR_NOQUOT_VALUE: + var value2 = source.slice(start, p); + errorHandler.warning('attribute "' + value2 + '" missed quot(")!!'); + addAttribute(attrName, value2, start); + case S_ATTR_END: + s = S_TAG_SPACE; + break; + } + } else { + switch (s) { + //case S_TAG:void();break; + //case S_ATTR:void();break; + //case S_ATTR_NOQUOT_VALUE:void();break; + case S_ATTR_SPACE: + if (!isHTML) { + errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!'); + } + addAttribute(attrName, attrName, start); + start = p; + s = S_ATTR; + break; + case S_ATTR_END: + errorHandler.warning('attribute space is required"' + attrName + '"!!'); + case S_TAG_SPACE: + s = S_ATTR; + start = p; + break; + case S_EQ: + s = S_ATTR_NOQUOT_VALUE; + start = p; + break; + case S_TAG_CLOSE: + throw new Error("elements closed character '/' and '>' must be connected to"); + } + } + } + p++; + } + } + function appendElement(el, domBuilder, currentNSMap) { + var tagName = el.tagName; + var localNSMap = null; + var i = el.length; + while (i--) { + var a = el[i]; + var qName = a.qName; + var value2 = a.value; + var nsp = qName.indexOf(":"); + if (nsp > 0) { + var prefix = a.prefix = qName.slice(0, nsp); + var localName = qName.slice(nsp + 1); + var nsPrefix = prefix === "xmlns" && localName; + } else { + localName = qName; + prefix = null; + nsPrefix = qName === "xmlns" && ""; + } + a.localName = localName; + if (nsPrefix !== false) { + if (localNSMap == null) { + localNSMap = /* @__PURE__ */ Object.create(null); + currentNSMap = Object.create(currentNSMap); + } + currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value2; + a.uri = NAMESPACE.XMLNS; + domBuilder.startPrefixMapping(nsPrefix, value2); + } + } + var i = el.length; + while (i--) { + a = el[i]; + if (a.prefix) { + if (a.prefix === "xml") { + a.uri = NAMESPACE.XML; + } + if (a.prefix !== "xmlns") { + a.uri = currentNSMap[a.prefix]; + } + } + } + var nsp = tagName.indexOf(":"); + if (nsp > 0) { + prefix = el.prefix = tagName.slice(0, nsp); + localName = el.localName = tagName.slice(nsp + 1); + } else { + prefix = null; + localName = el.localName = tagName; + } + var ns = el.uri = currentNSMap[prefix || ""]; + domBuilder.startElement(ns, localName, tagName, el); + if (el.closed) { + domBuilder.endElement(ns, localName, tagName); + if (localNSMap) { + for (prefix in localNSMap) { + if (hasOwn(localNSMap, prefix)) { + domBuilder.endPrefixMapping(prefix); + } + } + } + } else { + el.currentNSMap = currentNSMap; + el.localNSMap = localNSMap; + return true; + } + } + function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) { + var isEscapableRaw = isHTMLEscapableRawTextElement(tagName); + if (isEscapableRaw || isHTMLRawTextElement(tagName)) { + var closeTag = new RegExp("", "ig"); + closeTag.lastIndex = elStartEnd; + var match = closeTag.exec(source); + var elEndStart = match ? match.index : -1; + if (elEndStart < 0) { + return elStartEnd + 1; + } + var text = source.substring(elStartEnd + 1, elEndStart); + if (isEscapableRaw) { + text = text.replace(ENTITY_REG, entityReplacer); + } + domBuilder.characters(text, 0, text.length); + return elEndStart; + } + return elStartEnd + 1; + } + function _copy(source, target) { + for (var n in source) { + if (hasOwn(source, n)) { + target[n] = source[n]; + } + } + } + function parseUtils(source, start) { + var index = start; + function char(n) { + n = n || 0; + return source.charAt(index + n); + } + function skip(n) { + n = n || 1; + index += n; + } + function skipBlanks() { + var blanks = 0; + while (index < source.length) { + var c = char(); + if (c !== " " && c !== "\n" && c !== " " && c !== "\r") { + return blanks; + } + blanks++; + skip(); + } + return -1; + } + function substringFromIndex() { + return source.substring(index); + } + function substringStartsWith(text) { + return source.substring(index, index + text.length) === text; + } + function substringStartsWithCaseInsensitive(text) { + return source.substring(index, index + text.length).toUpperCase() === text.toUpperCase(); + } + function getMatch(args) { + var expr = g.reg("^", args); + var match = expr.exec(substringFromIndex()); + if (match) { + skip(match[0].length); + return match[0]; + } + return null; + } + return { + char, + getIndex: function() { + return index; + }, + getMatch, + getSource: function() { + return source; + }, + skip, + skipBlanks, + substringFromIndex, + substringStartsWith, + substringStartsWithCaseInsensitive + }; + } + function parseDoctypeInternalSubset(p, errorHandler) { + function parsePI(p2, errorHandler2) { + var match = g.PI.exec(p2.substringFromIndex()); + if (!match) { + return errorHandler2.fatalError("processing instruction is not well-formed at position " + p2.getIndex()); + } + if (match[1].toLowerCase() === "xml") { + return errorHandler2.fatalError( + "xml declaration is only allowed at the start of the document, but found at position " + p2.getIndex() + ); + } + p2.skip(match[0].length); + return match[0]; + } + var source = p.getSource(); + if (p.char() === "[") { + p.skip(1); + var intSubsetStart = p.getIndex(); + while (p.getIndex() < source.length) { + p.skipBlanks(); + if (p.char() === "]") { + var internalSubset = source.substring(intSubsetStart, p.getIndex()); + p.skip(1); + return internalSubset; + } + var current = null; + if (p.char() === "<" && p.char(1) === "!") { + switch (p.char(2)) { + case "E": + if (p.char(3) === "L") { + current = p.getMatch(g.elementdecl); + } else if (p.char(3) === "N") { + current = p.getMatch(g.EntityDecl); + } + break; + case "A": + current = p.getMatch(g.AttlistDecl); + break; + case "N": + current = p.getMatch(g.NotationDecl); + break; + case "-": + current = p.getMatch(g.Comment); + break; + } + } else if (p.char() === "<" && p.char(1) === "?") { + current = parsePI(p, errorHandler); + } else if (p.char() === "%") { + current = p.getMatch(g.PEReference); + } else { + return errorHandler.fatalError("Error detected in Markup declaration"); + } + if (!current) { + return errorHandler.fatalError("Error in internal subset at position " + p.getIndex()); + } + } + return errorHandler.fatalError("doctype internal subset is not well-formed, missing ]"); + } + } + function parseDoctypeCommentOrCData(source, start, domBuilder, errorHandler, isHTML) { + var p = parseUtils(source, start); + switch (isHTML ? p.char(2).toUpperCase() : p.char(2)) { + case "-": + var comment = p.getMatch(g.Comment); + if (comment) { + domBuilder.comment(comment, g.COMMENT_START.length, comment.length - g.COMMENT_START.length - g.COMMENT_END.length); + return p.getIndex(); + } else { + return errorHandler.fatalError("comment is not well-formed at position " + p.getIndex()); + } + case "[": + var cdata = p.getMatch(g.CDSect); + if (cdata) { + if (!isHTML && !domBuilder.currentElement) { + return errorHandler.fatalError("CDATA outside of element"); + } + domBuilder.startCDATA(); + domBuilder.characters(cdata, g.CDATA_START.length, cdata.length - g.CDATA_START.length - g.CDATA_END.length); + domBuilder.endCDATA(); + return p.getIndex(); + } else { + return errorHandler.fatalError("Invalid CDATA starting at position " + start); + } + case "D": { + if (domBuilder.doc && domBuilder.doc.documentElement) { + return errorHandler.fatalError("Doctype not allowed inside or after documentElement at position " + p.getIndex()); + } + if (isHTML ? !p.substringStartsWithCaseInsensitive(g.DOCTYPE_DECL_START) : !p.substringStartsWith(g.DOCTYPE_DECL_START)) { + return errorHandler.fatalError("Expected " + g.DOCTYPE_DECL_START + " at position " + p.getIndex()); + } + p.skip(g.DOCTYPE_DECL_START.length); + if (p.skipBlanks() < 1) { + return errorHandler.fatalError("Expected whitespace after " + g.DOCTYPE_DECL_START + " at position " + p.getIndex()); + } + var doctype = { + name: void 0, + publicId: void 0, + systemId: void 0, + internalSubset: void 0 + }; + doctype.name = p.getMatch(g.Name); + if (!doctype.name) + return errorHandler.fatalError("doctype name missing or contains unexpected characters at position " + p.getIndex()); + if (isHTML && doctype.name.toLowerCase() !== "html") { + errorHandler.warning("Unexpected DOCTYPE in HTML document at position " + p.getIndex()); + } + p.skipBlanks(); + if (p.substringStartsWith(g.PUBLIC) || p.substringStartsWith(g.SYSTEM)) { + var match = g.ExternalID_match.exec(p.substringFromIndex()); + if (!match) { + return errorHandler.fatalError("doctype external id is not well-formed at position " + p.getIndex()); + } + if (match.groups.SystemLiteralOnly !== void 0) { + doctype.systemId = match.groups.SystemLiteralOnly; + } else { + doctype.systemId = match.groups.SystemLiteral; + doctype.publicId = match.groups.PubidLiteral; + } + p.skip(match[0].length); + } else if (isHTML && p.substringStartsWithCaseInsensitive(g.SYSTEM)) { + p.skip(g.SYSTEM.length); + if (p.skipBlanks() < 1) { + return errorHandler.fatalError("Expected whitespace after " + g.SYSTEM + " at position " + p.getIndex()); + } + doctype.systemId = p.getMatch(g.ABOUT_LEGACY_COMPAT_SystemLiteral); + if (!doctype.systemId) { + return errorHandler.fatalError( + "Expected " + g.ABOUT_LEGACY_COMPAT + " in single or double quotes after " + g.SYSTEM + " at position " + p.getIndex() + ); + } + } + if (isHTML && doctype.systemId && !g.ABOUT_LEGACY_COMPAT_SystemLiteral.test(doctype.systemId)) { + errorHandler.warning("Unexpected doctype.systemId in HTML document at position " + p.getIndex()); + } + if (!isHTML) { + p.skipBlanks(); + doctype.internalSubset = parseDoctypeInternalSubset(p, errorHandler); + } + p.skipBlanks(); + if (p.char() !== ">") { + return errorHandler.fatalError("doctype not terminated with > at position " + p.getIndex()); + } + p.skip(1); + domBuilder.startDTD(doctype.name, doctype.publicId, doctype.systemId, doctype.internalSubset); + domBuilder.endDTD(); + return p.getIndex(); + } + default: + return errorHandler.fatalError('Not well-formed XML starting with " 0) { + return errorHandler.fatalError( + "processing instruction at position " + start + " is an xml declaration which is only at the start of the document" + ); + } + if (!g.XMLDecl.test(source.substring(start))) { + return errorHandler.fatalError("xml declaration is not well-formed"); + } + } + domBuilder.processingInstruction(match[1], match[2]); + return start + match[0].length; + } + function ElementAttributes() { + this.attributeNames = /* @__PURE__ */ Object.create(null); + } + ElementAttributes.prototype = { + setTagName: function(tagName) { + if (!g.QName_exact.test(tagName)) { + throw new Error("invalid tagName:" + tagName); + } + this.tagName = tagName; + }, + addValue: function(qName, value2, offset) { + if (!g.QName_exact.test(qName)) { + throw new Error("invalid attribute:" + qName); + } + this.attributeNames[qName] = this.length; + this[this.length++] = { qName, value: value2, offset }; + }, + length: 0, + getLocalName: function(i) { + return this[i].localName; + }, + getLocator: function(i) { + return this[i].locator; + }, + getQName: function(i) { + return this[i].qName; + }, + getURI: function(i) { + return this[i].uri; + }, + getValue: function(i) { + return this[i].value; + } + // ,getIndex:function(uri, localName)){ + // if(localName){ + // + // }else{ + // var qName = uri + // } + // }, + // getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))}, + // getType:function(uri,localName){} + // getType:function(i){}, + }; + exports2.XMLReader = XMLReader; + exports2.parseUtils = parseUtils; + exports2.parseDoctypeCommentOrCData = parseDoctypeCommentOrCData; + } +}); + +// node_modules/@xmldom/xmldom/lib/dom-parser.js +var require_dom_parser = __commonJS({ + "node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports2) { + "use strict"; + var conventions = require_conventions(); + var dom = require_dom(); + var errors = require_errors(); + var entities = require_entities(); + var sax = require_sax(); + var DOMImplementation = dom.DOMImplementation; + var hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace; + var isHTMLMimeType = conventions.isHTMLMimeType; + var isValidMimeType = conventions.isValidMimeType; + var MIME_TYPE = conventions.MIME_TYPE; + var NAMESPACE = conventions.NAMESPACE; + var ParseError = errors.ParseError; + var XMLReader = sax.XMLReader; + function normalizeLineEndings(input3) { + return input3.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n"); + } + function DOMParser3(options) { + options = options || {}; + if (options.locator === void 0) { + options.locator = true; + } + this.assign = options.assign || conventions.assign; + this.domHandler = options.domHandler || DOMHandler; + this.onError = options.onError || options.errorHandler; + if (options.errorHandler && typeof options.errorHandler !== "function") { + throw new TypeError("errorHandler object is no longer supported, switch to onError!"); + } else if (options.errorHandler) { + options.errorHandler("warning", "The `errorHandler` option has been deprecated, use `onError` instead!", this); + } + this.normalizeLineEndings = options.normalizeLineEndings || normalizeLineEndings; + this.locator = !!options.locator; + this.xmlns = this.assign(/* @__PURE__ */ Object.create(null), options.xmlns); + } + DOMParser3.prototype.parseFromString = function(source, mimeType) { + if (!isValidMimeType(mimeType)) { + throw new TypeError('DOMParser.parseFromString: the provided mimeType "' + mimeType + '" is not valid.'); + } + var defaultNSMap = this.assign(/* @__PURE__ */ Object.create(null), this.xmlns); + var entityMap = entities.XML_ENTITIES; + var defaultNamespace = defaultNSMap[""] || null; + if (hasDefaultHTMLNamespace(mimeType)) { + entityMap = entities.HTML_ENTITIES; + defaultNamespace = NAMESPACE.HTML; + } else if (mimeType === MIME_TYPE.XML_SVG_IMAGE) { + defaultNamespace = NAMESPACE.SVG; + } + defaultNSMap[""] = defaultNamespace; + defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML; + var domBuilder = new this.domHandler({ + mimeType, + defaultNamespace, + onError: this.onError + }); + var locator = this.locator ? {} : void 0; + if (this.locator) { + domBuilder.setDocumentLocator(locator); + } + var sax2 = new XMLReader(); + sax2.errorHandler = domBuilder; + sax2.domBuilder = domBuilder; + var isXml = !conventions.isHTMLMimeType(mimeType); + if (isXml && typeof source !== "string") { + sax2.errorHandler.fatalError("source is not a string"); + } + sax2.parse(this.normalizeLineEndings(String(source)), defaultNSMap, entityMap); + if (!domBuilder.doc.documentElement) { + sax2.errorHandler.fatalError("missing root element"); + } + return domBuilder.doc; + }; + function DOMHandler(options) { + var opt = options || {}; + this.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION; + this.defaultNamespace = opt.defaultNamespace || null; + this.cdata = false; + this.currentElement = void 0; + this.doc = void 0; + this.locator = void 0; + this.onError = opt.onError; + } + function position(locator, node2) { + node2.lineNumber = locator.lineNumber; + node2.columnNumber = locator.columnNumber; + } + DOMHandler.prototype = { + /** + * Either creates an XML or an HTML document and stores it under `this.doc`. + * If it is an XML document, `this.defaultNamespace` is used to create it, + * and it will not contain any `childNodes`. + * If it is an HTML document, it will be created without any `childNodes`. + * + * @see http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ + startDocument: function() { + var impl = new DOMImplementation(); + this.doc = isHTMLMimeType(this.mimeType) ? impl.createHTMLDocument(false) : impl.createDocument(this.defaultNamespace, ""); + }, + startElement: function(namespaceURI, localName, qName, attrs) { + var doc = this.doc; + var el = doc.createElementNS(namespaceURI, qName || localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; + this.locator && position(this.locator, el); + for (var i = 0; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value2 = attrs.getValue(i); + var qName = attrs.getQName(i); + var attr = doc.createAttributeNS(namespaceURI, qName); + this.locator && position(attrs.getLocator(i), attr); + attr.value = attr.nodeValue = value2; + el.setAttributeNode(attr); + } + }, + endElement: function(namespaceURI, localName, qName) { + this.currentElement = this.currentElement.parentNode; + }, + startPrefixMapping: function(prefix, uri) { + }, + endPrefixMapping: function(prefix) { + }, + processingInstruction: function(target, data) { + var ins = this.doc.createProcessingInstruction(target, data); + this.locator && position(this.locator, ins); + appendElement(this, ins); + }, + ignorableWhitespace: function(ch, start, length) { + }, + characters: function(chars, start, length) { + chars = _toString.apply(this, arguments); + if (chars) { + if (this.cdata) { + var charNode = this.doc.createCDATASection(chars); + } else { + var charNode = this.doc.createTextNode(chars); + } + if (this.currentElement) { + this.currentElement.appendChild(charNode); + } else if (/^\s*$/.test(chars)) { + this.doc.appendChild(charNode); + } + this.locator && position(this.locator, charNode); + } + }, + skippedEntity: function(name) { + }, + endDocument: function() { + this.doc.normalize(); + }, + /** + * Stores the locator to be able to set the `columnNumber` and `lineNumber` + * on the created DOM nodes. + * + * @param {Locator} locator + */ + setDocumentLocator: function(locator) { + if (locator) { + locator.lineNumber = 0; + } + this.locator = locator; + }, + //LexicalHandler + comment: function(chars, start, length) { + chars = _toString.apply(this, arguments); + var comm = this.doc.createComment(chars); + this.locator && position(this.locator, comm); + appendElement(this, comm); + }, + startCDATA: function() { + this.cdata = true; + }, + endCDATA: function() { + this.cdata = false; + }, + startDTD: function(name, publicId, systemId, internalSubset) { + var impl = this.doc.implementation; + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId, internalSubset); + this.locator && position(this.locator, dt); + appendElement(this, dt); + this.doc.doctype = dt; + } + }, + reportError: function(level, message) { + if (typeof this.onError === "function") { + try { + this.onError(level, message, this); + } catch (e) { + throw new ParseError("Reporting " + level + ' "' + message + '" caused ' + e, this.locator); + } + } else { + console.error("[xmldom " + level + "] " + message, _locator(this.locator)); + } + }, + /** + * @see http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + warning: function(message) { + this.reportError("warning", message); + }, + error: function(message) { + this.reportError("error", message); + }, + /** + * This function reports a fatal error and throws a ParseError. + * + * @param {string} message + * - The message to be used for reporting and throwing the error. + * @param {Error} [cause] + * The error that caused this fatal error, preserved as the thrown `ParseError`'s `cause`. + * @returns {never} + * This function always throws an error and never returns a value. + * @throws {ParseError} + * Always throws a ParseError with the provided message. + */ + fatalError: function(message, cause) { + this.reportError("fatalError", message); + throw new ParseError(message, this.locator, cause); + } + }; + function _locator(l) { + if (l) { + return "\n@#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]"; + } + } + function _toString(chars, start, length) { + if (typeof chars == "string") { + return chars.substr(start, length); + } else { + if (chars.length >= start + length || start) { + return new java.lang.String(chars, start, length) + ""; + } + return chars; + } + } + "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace( + /\w+/g, + function(key) { + DOMHandler.prototype[key] = function() { + return null; + }; + } + ); + function appendElement(handler, node2) { + if (!handler.currentElement) { + handler.doc.appendChild(node2); + } else { + handler.currentElement.appendChild(node2); + } + } + function onErrorStopParsing(level) { + if (level === "error") throw "onErrorStopParsing"; + } + function onWarningStopParsing() { + throw "onWarningStopParsing"; + } + exports2.__DOMHandler = DOMHandler; + exports2.DOMParser = DOMParser3; + exports2.normalizeLineEndings = normalizeLineEndings; + exports2.onErrorStopParsing = onErrorStopParsing; + exports2.onWarningStopParsing = onWarningStopParsing; + } +}); + +// node_modules/@xmldom/xmldom/lib/index.js +var require_lib = __commonJS({ + "node_modules/@xmldom/xmldom/lib/index.js"(exports2) { + "use strict"; + var conventions = require_conventions(); + exports2.assign = conventions.assign; + exports2.hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace; + exports2.isHTMLMimeType = conventions.isHTMLMimeType; + exports2.isValidMimeType = conventions.isValidMimeType; + exports2.MIME_TYPE = conventions.MIME_TYPE; + exports2.NAMESPACE = conventions.NAMESPACE; + var errors = require_errors(); + exports2.DOMException = errors.DOMException; + exports2.DOMExceptionName = errors.DOMExceptionName; + exports2.ExceptionCode = errors.ExceptionCode; + exports2.ParseError = errors.ParseError; + var dom = require_dom(); + exports2.Attr = dom.Attr; + exports2.CDATASection = dom.CDATASection; + exports2.CharacterData = dom.CharacterData; + exports2.Comment = dom.Comment; + exports2.Document = dom.Document; + exports2.DocumentFragment = dom.DocumentFragment; + exports2.DocumentType = dom.DocumentType; + exports2.DOMImplementation = dom.DOMImplementation; + exports2.Element = dom.Element; + exports2.Entity = dom.Entity; + exports2.EntityReference = dom.EntityReference; + exports2.LiveNodeList = dom.LiveNodeList; + exports2.NamedNodeMap = dom.NamedNodeMap; + exports2.Node = dom.Node; + exports2.NodeList = dom.NodeList; + exports2.Notation = dom.Notation; + exports2.ProcessingInstruction = dom.ProcessingInstruction; + exports2.Text = dom.Text; + exports2.XMLSerializer = dom.XMLSerializer; + var domParser = require_dom_parser(); + exports2.DOMParser = domParser.DOMParser; + exports2.normalizeLineEndings = domParser.normalizeLineEndings; + exports2.onErrorStopParsing = domParser.onErrorStopParsing; + exports2.onWarningStopParsing = domParser.onWarningStopParsing; + } +}); + +// node_modules/ajv/dist/compile/codegen/code.js +var require_code = __commonJS({ + "node_modules/ajv/dist/compile/codegen/code.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.regexpCode = exports2.getEsmExportName = exports2.getProperty = exports2.safeStringify = exports2.stringify = exports2.strConcat = exports2.addCodeArg = exports2.str = exports2._ = exports2.nil = exports2._Code = exports2.Name = exports2.IDENTIFIER = exports2._CodeOrName = void 0; + var _CodeOrName = class { + }; + exports2._CodeOrName = _CodeOrName; + exports2.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; + var Name = class extends _CodeOrName { + constructor(s) { + super(); + if (!exports2.IDENTIFIER.test(s)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = s; + } + toString() { + return this.str; + } + emptyStr() { + return false; + } + get names() { + return { [this.str]: 1 }; + } + }; + exports2.Name = Name; + var _Code = class extends _CodeOrName { + constructor(code) { + super(); + this._items = typeof code === "string" ? [code] : code; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return false; + const item = this._items[0]; + return item === "" || item === '""'; + } + get str() { + var _a3; + return (_a3 = this._str) !== null && _a3 !== void 0 ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, ""); + } + get names() { + var _a3; + return (_a3 = this._names) !== null && _a3 !== void 0 ? _a3 : this._names = this._items.reduce((names, c) => { + if (c instanceof Name) + names[c.str] = (names[c.str] || 0) + 1; + return names; + }, {}); + } + }; + exports2._Code = _Code; + exports2.nil = new _Code(""); + function _(strs, ...args) { + const code = [strs[0]]; + let i = 0; + while (i < args.length) { + addCodeArg(code, args[i]); + code.push(strs[++i]); + } + return new _Code(code); + } + exports2._ = _; + var plus = new _Code("+"); + function str(strs, ...args) { + const expr = [safeStringify(strs[0])]; + let i = 0; + while (i < args.length) { + expr.push(plus); + addCodeArg(expr, args[i]); + expr.push(plus, safeStringify(strs[++i])); + } + optimize(expr); + return new _Code(expr); + } + exports2.str = str; + function addCodeArg(code, arg) { + if (arg instanceof _Code) + code.push(...arg._items); + else if (arg instanceof Name) + code.push(arg); + else + code.push(interpolate(arg)); + } + exports2.addCodeArg = addCodeArg; + function optimize(expr) { + let i = 1; + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]); + if (res !== void 0) { + expr.splice(i - 1, 3, res); + continue; + } + expr[i++] = "+"; + } + i++; + } + } + function mergeExprItems(a, b) { + if (b === '""') + return a; + if (a === '""') + return b; + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') + return; + if (typeof b != "string") + return `${a.slice(0, -1)}${b}"`; + if (b[0] === '"') + return a.slice(0, -1) + b.slice(1); + return; + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) + return `"${a}${b.slice(1)}`; + return; + } + function strConcat(c1, c2) { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`; + } + exports2.strConcat = strConcat; + function interpolate(x) { + return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x); + } + function stringify2(x) { + return new _Code(safeStringify(x)); + } + exports2.stringify = stringify2; + function safeStringify(x) { + return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + } + exports2.safeStringify = safeStringify; + function getProperty(key) { + return typeof key == "string" && exports2.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`; + } + exports2.getProperty = getProperty; + function getEsmExportName(key) { + if (typeof key == "string" && exports2.IDENTIFIER.test(key)) { + return new _Code(`${key}`); + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`); + } + exports2.getEsmExportName = getEsmExportName; + function regexpCode(rx) { + return new _Code(rx.toString()); + } + exports2.regexpCode = regexpCode; + } +}); + +// node_modules/ajv/dist/compile/codegen/scope.js +var require_scope = __commonJS({ + "node_modules/ajv/dist/compile/codegen/scope.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ValueScope = exports2.ValueScopeName = exports2.Scope = exports2.varKinds = exports2.UsedValueState = void 0; + var code_1 = require_code(); + var ValueError = class extends Error { + constructor(name) { + super(`CodeGen: "code" for ${name} not defined`); + this.value = name.value; + } + }; + var UsedValueState; + (function(UsedValueState2) { + UsedValueState2[UsedValueState2["Started"] = 0] = "Started"; + UsedValueState2[UsedValueState2["Completed"] = 1] = "Completed"; + })(UsedValueState || (exports2.UsedValueState = UsedValueState = {})); + exports2.varKinds = { + const: new code_1.Name("const"), + let: new code_1.Name("let"), + var: new code_1.Name("var") + }; + var Scope = class { + constructor({ prefixes, parent } = {}) { + this._names = {}; + this._prefixes = prefixes; + this._parent = parent; + } + toName(nameOrPrefix) { + return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix); + } + name(prefix) { + return new code_1.Name(this._newName(prefix)); + } + _newName(prefix) { + const ng = this._names[prefix] || this._nameGroup(prefix); + return `${prefix}${ng.index++}`; + } + _nameGroup(prefix) { + var _a3, _b; + if (((_b = (_a3 = this._parent) === null || _a3 === void 0 ? void 0 : _a3._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); + } + return this._names[prefix] = { prefix, index: 0 }; + } + }; + exports2.Scope = Scope; + var ValueScopeName = class extends code_1.Name { + constructor(prefix, nameStr) { + super(nameStr); + this.prefix = prefix; + } + setValue(value2, { property, itemIndex }) { + this.value = value2; + this.scopePath = (0, code_1._)`.${new code_1.Name(property)}[${itemIndex}]`; + } + }; + exports2.ValueScopeName = ValueScopeName; + var line = (0, code_1._)`\n`; + var ValueScope = class extends Scope { + constructor(opts) { + super(opts); + this._values = {}; + this._scope = opts.scope; + this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; + } + get() { + return this._scope; + } + name(prefix) { + return new ValueScopeName(prefix, this._newName(prefix)); + } + value(nameOrPrefix, value2) { + var _a3; + if (value2.ref === void 0) + throw new Error("CodeGen: ref must be passed in value"); + const name = this.toName(nameOrPrefix); + const { prefix } = name; + const valueKey = (_a3 = value2.key) !== null && _a3 !== void 0 ? _a3 : value2.ref; + let vs = this._values[prefix]; + if (vs) { + const _name = vs.get(valueKey); + if (_name) + return _name; + } else { + vs = this._values[prefix] = /* @__PURE__ */ new Map(); + } + vs.set(valueKey, name); + const s = this._scope[prefix] || (this._scope[prefix] = []); + const itemIndex = s.length; + s[itemIndex] = value2.ref; + name.setValue(value2, { property: prefix, itemIndex }); + return name; + } + getValue(prefix, keyOrRef) { + const vs = this._values[prefix]; + if (!vs) + return; + return vs.get(keyOrRef); + } + scopeRefs(scopeName, values = this._values) { + return this._reduceValues(values, (name) => { + if (name.scopePath === void 0) + throw new Error(`CodeGen: name "${name}" has no value`); + return (0, code_1._)`${scopeName}${name.scopePath}`; + }); + } + scopeCode(values = this._values, usedValues, getCode) { + return this._reduceValues(values, (name) => { + if (name.value === void 0) + throw new Error(`CodeGen: name "${name}" has no value`); + return name.value.code; + }, usedValues, getCode); + } + _reduceValues(values, valueCode, usedValues = {}, getCode) { + let code = code_1.nil; + for (const prefix in values) { + const vs = values[prefix]; + if (!vs) + continue; + const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map(); + vs.forEach((name) => { + if (nameSet.has(name)) + return; + nameSet.set(name, UsedValueState.Started); + let c = valueCode(name); + if (c) { + const def = this.opts.es5 ? exports2.varKinds.var : exports2.varKinds.const; + code = (0, code_1._)`${code}${def} ${name} = ${c};${this.opts._n}`; + } else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name)) { + code = (0, code_1._)`${code}${c}${this.opts._n}`; + } else { + throw new ValueError(name); + } + nameSet.set(name, UsedValueState.Completed); + }); + } + return code; + } + }; + exports2.ValueScope = ValueScope; + } +}); + +// node_modules/ajv/dist/compile/codegen/index.js +var require_codegen = __commonJS({ + "node_modules/ajv/dist/compile/codegen/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.or = exports2.and = exports2.not = exports2.CodeGen = exports2.operators = exports2.varKinds = exports2.ValueScopeName = exports2.ValueScope = exports2.Scope = exports2.Name = exports2.regexpCode = exports2.stringify = exports2.getProperty = exports2.nil = exports2.strConcat = exports2.str = exports2._ = void 0; + var code_1 = require_code(); + var scope_1 = require_scope(); + var code_2 = require_code(); + Object.defineProperty(exports2, "_", { enumerable: true, get: function() { + return code_2._; + } }); + Object.defineProperty(exports2, "str", { enumerable: true, get: function() { + return code_2.str; + } }); + Object.defineProperty(exports2, "strConcat", { enumerable: true, get: function() { + return code_2.strConcat; + } }); + Object.defineProperty(exports2, "nil", { enumerable: true, get: function() { + return code_2.nil; + } }); + Object.defineProperty(exports2, "getProperty", { enumerable: true, get: function() { + return code_2.getProperty; + } }); + Object.defineProperty(exports2, "stringify", { enumerable: true, get: function() { + return code_2.stringify; + } }); + Object.defineProperty(exports2, "regexpCode", { enumerable: true, get: function() { + return code_2.regexpCode; + } }); + Object.defineProperty(exports2, "Name", { enumerable: true, get: function() { + return code_2.Name; + } }); + var scope_2 = require_scope(); + Object.defineProperty(exports2, "Scope", { enumerable: true, get: function() { + return scope_2.Scope; + } }); + Object.defineProperty(exports2, "ValueScope", { enumerable: true, get: function() { + return scope_2.ValueScope; + } }); + Object.defineProperty(exports2, "ValueScopeName", { enumerable: true, get: function() { + return scope_2.ValueScopeName; + } }); + Object.defineProperty(exports2, "varKinds", { enumerable: true, get: function() { + return scope_2.varKinds; + } }); + exports2.operators = { + GT: new code_1._Code(">"), + GTE: new code_1._Code(">="), + LT: new code_1._Code("<"), + LTE: new code_1._Code("<="), + EQ: new code_1._Code("==="), + NEQ: new code_1._Code("!=="), + NOT: new code_1._Code("!"), + OR: new code_1._Code("||"), + AND: new code_1._Code("&&"), + ADD: new code_1._Code("+") + }; + var Node = class { + optimizeNodes() { + return this; + } + optimizeNames(_names, _constants) { + return this; + } + }; + var Def = class extends Node { + constructor(varKind, name, rhs) { + super(); + this.varKind = varKind; + this.name = name; + this.rhs = rhs; + } + render({ es5, _n }) { + const varKind = es5 ? scope_1.varKinds.var : this.varKind; + const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`; + return `${varKind} ${this.name}${rhs};` + _n; + } + optimizeNames(names, constants4) { + if (!names[this.name.str]) + return; + if (this.rhs) + this.rhs = optimizeExpr(this.rhs, names, constants4); + return this; + } + get names() { + return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; + } + }; + var Assign = class extends Node { + constructor(lhs, rhs, sideEffects) { + super(); + this.lhs = lhs; + this.rhs = rhs; + this.sideEffects = sideEffects; + } + render({ _n }) { + return `${this.lhs} = ${this.rhs};` + _n; + } + optimizeNames(names, constants4) { + if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) + return; + this.rhs = optimizeExpr(this.rhs, names, constants4); + return this; + } + get names() { + const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; + return addExprNames(names, this.rhs); + } + }; + var AssignOp = class extends Assign { + constructor(lhs, op, rhs, sideEffects) { + super(lhs, rhs, sideEffects); + this.op = op; + } + render({ _n }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n; + } + }; + var Label = class extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + return `${this.label}:` + _n; + } + }; + var Break = class extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + const label = this.label ? ` ${this.label}` : ""; + return `break${label};` + _n; + } + }; + var Throw = class extends Node { + constructor(error2) { + super(); + this.error = error2; + } + render({ _n }) { + return `throw ${this.error};` + _n; + } + get names() { + return this.error.names; + } + }; + var AnyCode = class extends Node { + constructor(code) { + super(); + this.code = code; + } + render({ _n }) { + return `${this.code};` + _n; + } + optimizeNodes() { + return `${this.code}` ? this : void 0; + } + optimizeNames(names, constants4) { + this.code = optimizeExpr(this.code, names, constants4); + return this; + } + get names() { + return this.code instanceof code_1._CodeOrName ? this.code.names : {}; + } + }; + var ParentNode = class extends Node { + constructor(nodes = []) { + super(); + this.nodes = nodes; + } + render(opts) { + return this.nodes.reduce((code, n) => code + n.render(opts), ""); + } + optimizeNodes() { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i].optimizeNodes(); + if (Array.isArray(n)) + nodes.splice(i, 1, ...n); + else if (n) + nodes[i] = n; + else + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : void 0; + } + optimizeNames(names, constants4) { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i]; + if (n.optimizeNames(names, constants4)) + continue; + subtractNames(names, n.names); + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : void 0; + } + get names() { + return this.nodes.reduce((names, n) => addNames(names, n.names), {}); + } + }; + var BlockNode = class extends ParentNode { + render(opts) { + return "{" + opts._n + super.render(opts) + "}" + opts._n; + } + }; + var Root = class extends ParentNode { + }; + var Else = class extends BlockNode { + }; + Else.kind = "else"; + var If = class _If extends BlockNode { + constructor(condition, nodes) { + super(nodes); + this.condition = condition; + } + render(opts) { + let code = `if(${this.condition})` + super.render(opts); + if (this.else) + code += "else " + this.else.render(opts); + return code; + } + optimizeNodes() { + super.optimizeNodes(); + const cond = this.condition; + if (cond === true) + return this.nodes; + let e = this.else; + if (e) { + const ns = e.optimizeNodes(); + e = this.else = Array.isArray(ns) ? new Else(ns) : ns; + } + if (e) { + if (cond === false) + return e instanceof _If ? e : e.nodes; + if (this.nodes.length) + return this; + return new _If(not(cond), e instanceof _If ? [e] : e.nodes); + } + if (cond === false || !this.nodes.length) + return void 0; + return this; + } + optimizeNames(names, constants4) { + var _a3; + this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants4); + if (!(super.optimizeNames(names, constants4) || this.else)) + return; + this.condition = optimizeExpr(this.condition, names, constants4); + return this; + } + get names() { + const names = super.names; + addExprNames(names, this.condition); + if (this.else) + addNames(names, this.else.names); + return names; + } + }; + If.kind = "if"; + var For = class extends BlockNode { + }; + For.kind = "for"; + var ForLoop = class extends For { + constructor(iteration) { + super(); + this.iteration = iteration; + } + render(opts) { + return `for(${this.iteration})` + super.render(opts); + } + optimizeNames(names, constants4) { + if (!super.optimizeNames(names, constants4)) + return; + this.iteration = optimizeExpr(this.iteration, names, constants4); + return this; + } + get names() { + return addNames(super.names, this.iteration.names); + } + }; + var ForRange = class extends For { + constructor(varKind, name, from, to) { + super(); + this.varKind = varKind; + this.name = name; + this.from = from; + this.to = to; + } + render(opts) { + const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; + const { name, from, to } = this; + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts); + } + get names() { + const names = addExprNames(super.names, this.from); + return addExprNames(names, this.to); + } + }; + var ForIter = class extends For { + constructor(loop, varKind, name, iterable) { + super(); + this.loop = loop; + this.varKind = varKind; + this.name = name; + this.iterable = iterable; + } + render(opts) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts); + } + optimizeNames(names, constants4) { + if (!super.optimizeNames(names, constants4)) + return; + this.iterable = optimizeExpr(this.iterable, names, constants4); + return this; + } + get names() { + return addNames(super.names, this.iterable.names); + } + }; + var Func = class extends BlockNode { + constructor(name, args, async) { + super(); + this.name = name; + this.args = args; + this.async = async; + } + render(opts) { + const _async = this.async ? "async " : ""; + return `${_async}function ${this.name}(${this.args})` + super.render(opts); + } + }; + Func.kind = "func"; + var Return = class extends ParentNode { + render(opts) { + return "return " + super.render(opts); + } + }; + Return.kind = "return"; + var Try = class extends BlockNode { + render(opts) { + let code = "try" + super.render(opts); + if (this.catch) + code += this.catch.render(opts); + if (this.finally) + code += this.finally.render(opts); + return code; + } + optimizeNodes() { + var _a3, _b; + super.optimizeNodes(); + (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNodes(); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); + return this; + } + optimizeNames(names, constants4) { + var _a3, _b; + super.optimizeNames(names, constants4); + (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants4); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants4); + return this; + } + get names() { + const names = super.names; + if (this.catch) + addNames(names, this.catch.names); + if (this.finally) + addNames(names, this.finally.names); + return names; + } + }; + var Catch = class extends BlockNode { + constructor(error2) { + super(); + this.error = error2; + } + render(opts) { + return `catch(${this.error})` + super.render(opts); + } + }; + Catch.kind = "catch"; + var Finally = class extends BlockNode { + render(opts) { + return "finally" + super.render(opts); + } + }; + Finally.kind = "finally"; + var CodeGen = class { + constructor(extScope, opts = {}) { + this._values = {}; + this._blockStarts = []; + this._constants = {}; + this.opts = { ...opts, _n: opts.lines ? "\n" : "" }; + this._extScope = extScope; + this._scope = new scope_1.Scope({ parent: extScope }); + this._nodes = [new Root()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(prefix) { + return this._scope.name(prefix); + } + // reserves unique name in the external scope + scopeName(prefix) { + return this._extScope.name(prefix); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName, value2) { + const name = this._extScope.value(prefixOrName, value2); + const vs = this._values[name.prefix] || (this._values[name.prefix] = /* @__PURE__ */ new Set()); + vs.add(name); + return name; + } + getScopeValue(prefix, keyOrRef) { + return this._extScope.getValue(prefix, keyOrRef); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName) { + return this._extScope.scopeRefs(scopeName, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(varKind, nameOrPrefix, rhs, constant) { + const name = this._scope.toName(nameOrPrefix); + if (rhs !== void 0 && constant) + this._constants[name.str] = rhs; + this._leafNode(new Def(varKind, name, rhs)); + return name; + } + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant); + } + // `var` declaration with optional assignment + var(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant); + } + // assignment code + assign(lhs, rhs, sideEffects) { + return this._leafNode(new Assign(lhs, rhs, sideEffects)); + } + // `+=` code + add(lhs, rhs) { + return this._leafNode(new AssignOp(lhs, exports2.operators.ADD, rhs)); + } + // appends passed SafeExpr to code or executes Block + code(c) { + if (typeof c == "function") + c(); + else if (c !== code_1.nil) + this._leafNode(new AnyCode(c)); + return this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues) { + const code = ["{"]; + for (const [key, value2] of keyValues) { + if (code.length > 1) + code.push(","); + code.push(key); + if (key !== value2 || this.opts.es5) { + code.push(":"); + (0, code_1.addCodeArg)(code, value2); + } + } + code.push("}"); + return new code_1._Code(code); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition, thenBody, elseBody) { + this._blockNode(new If(condition)); + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf(); + } else if (thenBody) { + this.code(thenBody).endIf(); + } else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body'); + } + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition) { + return this._elseNode(new If(condition)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new Else()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode(If, Else); + } + _for(node2, forBody) { + this._blockNode(node2); + if (forBody) + this.code(forBody).endFor(); + return this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration, forBody) { + return this._for(new ForLoop(iteration), forBody); + } + // `for` statement for a range of values + forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) { + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) { + const name = this._scope.toName(nameOrPrefix); + if (this.opts.es5) { + const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable); + return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => { + this.var(name, (0, code_1._)`${arr}[${i}]`); + forBody(name); + }); + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody); + } + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)); + } + // end `for` loop + endFor() { + return this._endBlockNode(For); + } + // `label` statement + label(label) { + return this._leafNode(new Label(label)); + } + // `break` statement + break(label) { + return this._leafNode(new Break(label)); + } + // `return` statement + return(value2) { + const node2 = new Return(); + this._blockNode(node2); + this.code(value2); + if (node2.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(Return); + } + // `try` statement + try(tryBody, catchCode, finallyCode) { + if (!catchCode && !finallyCode) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const node2 = new Try(); + this._blockNode(node2); + this.code(tryBody); + if (catchCode) { + const error2 = this.name("e"); + this._currNode = node2.catch = new Catch(error2); + catchCode(error2); + } + if (finallyCode) { + this._currNode = node2.finally = new Finally(); + this.code(finallyCode); + } + return this._endBlockNode(Catch, Finally); + } + // `throw` statement + throw(error2) { + return this._leafNode(new Throw(error2)); + } + // start self-balancing block + block(body, nodeCount) { + this._blockStarts.push(this._nodes.length); + if (body) + this.code(body).endBlock(nodeCount); + return this; + } + // end the current self-balancing block + endBlock(nodeCount) { + const len = this._blockStarts.pop(); + if (len === void 0) + throw new Error("CodeGen: not in self-balancing block"); + const toClose = this._nodes.length - len; + if (toClose < 0 || nodeCount !== void 0 && toClose !== nodeCount) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`); + } + this._nodes.length = len; + return this; + } + // `function` heading (or definition if funcBody is passed) + func(name, args = code_1.nil, async, funcBody) { + this._blockNode(new Func(name, args, async)); + if (funcBody) + this.code(funcBody).endFunc(); + return this; + } + // end function definition + endFunc() { + return this._endBlockNode(Func); + } + optimize(n = 1) { + while (n-- > 0) { + this._root.optimizeNodes(); + this._root.optimizeNames(this._root.names, this._constants); + } + } + _leafNode(node2) { + this._currNode.nodes.push(node2); + return this; + } + _blockNode(node2) { + this._currNode.nodes.push(node2); + this._nodes.push(node2); + } + _endBlockNode(N1, N2) { + const n = this._currNode; + if (n instanceof N1 || N2 && n instanceof N2) { + this._nodes.pop(); + return this; + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); + } + _elseNode(node2) { + const n = this._currNode; + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"'); + } + this._currNode = n.else = node2; + return this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const ns = this._nodes; + return ns[ns.length - 1]; + } + set _currNode(node2) { + const ns = this._nodes; + ns[ns.length - 1] = node2; + } + }; + exports2.CodeGen = CodeGen; + function addNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) + (from[n] || 0); + return names; + } + function addExprNames(names, from) { + return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names; + } + function optimizeExpr(expr, names, constants4) { + if (expr instanceof code_1.Name) + return replaceName(expr); + if (!canOptimize(expr)) + return expr; + return new code_1._Code(expr._items.reduce((items, c) => { + if (c instanceof code_1.Name) + c = replaceName(c); + if (c instanceof code_1._Code) + items.push(...c._items); + else + items.push(c); + return items; + }, [])); + function replaceName(n) { + const c = constants4[n.str]; + if (c === void 0 || names[n.str] !== 1) + return n; + delete names[n.str]; + return c; + } + function canOptimize(e) { + return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants4[c.str] !== void 0); + } + } + function subtractNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) - (from[n] || 0); + } + function not(x) { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`; + } + exports2.not = not; + var andCode = mappend(exports2.operators.AND); + function and(...args) { + return args.reduce(andCode); + } + exports2.and = and; + var orCode = mappend(exports2.operators.OR); + function or(...args) { + return args.reduce(orCode); + } + exports2.or = or; + function mappend(op) { + return (x, y) => x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._)`${par(x)} ${op} ${par(y)}`; + } + function par(x) { + return x instanceof code_1.Name ? x : (0, code_1._)`(${x})`; + } + } +}); + +// node_modules/ajv/dist/compile/util.js +var require_util = __commonJS({ + "node_modules/ajv/dist/compile/util.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.checkStrictMode = exports2.getErrorPath = exports2.Type = exports2.useFunc = exports2.setEvaluated = exports2.evaluatedPropsToName = exports2.mergeEvaluated = exports2.eachItem = exports2.unescapeJsonPointer = exports2.escapeJsonPointer = exports2.escapeFragment = exports2.unescapeFragment = exports2.schemaRefOrVal = exports2.schemaHasRulesButRef = exports2.schemaHasRules = exports2.checkUnknownRules = exports2.alwaysValidSchema = exports2.toHash = void 0; + var codegen_1 = require_codegen(); + var code_1 = require_code(); + function toHash(arr) { + const hash3 = {}; + for (const item of arr) + hash3[item] = true; + return hash3; + } + exports2.toHash = toHash; + function alwaysValidSchema(it, schema) { + if (typeof schema == "boolean") + return schema; + if (Object.keys(schema).length === 0) + return true; + checkUnknownRules(it, schema); + return !schemaHasRules(schema, it.self.RULES.all); + } + exports2.alwaysValidSchema = alwaysValidSchema; + function checkUnknownRules(it, schema = it.schema) { + const { opts, self: self2 } = it; + if (!opts.strictSchema) + return; + if (typeof schema === "boolean") + return; + const rules = self2.RULES.keywords; + for (const key in schema) { + if (!rules[key]) + checkStrictMode(it, `unknown keyword: "${key}"`); + } + } + exports2.checkUnknownRules = checkUnknownRules; + function schemaHasRules(schema, rules) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (rules[key]) + return true; + return false; + } + exports2.schemaHasRules = schemaHasRules; + function schemaHasRulesButRef(schema, RULES) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (key !== "$ref" && RULES.all[key]) + return true; + return false; + } + exports2.schemaHasRulesButRef = schemaHasRulesButRef; + function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") + return schema; + if (typeof schema == "string") + return (0, codegen_1._)`${schema}`; + } + return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`; + } + exports2.schemaRefOrVal = schemaRefOrVal; + function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); + } + exports2.unescapeFragment = unescapeFragment; + function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); + } + exports2.escapeFragment = escapeFragment; + function escapeJsonPointer(str) { + if (typeof str == "number") + return `${str}`; + return str.replace(/~/g, "~0").replace(/\//g, "~1"); + } + exports2.escapeJsonPointer = escapeJsonPointer; + function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); + } + exports2.unescapeJsonPointer = unescapeJsonPointer; + function eachItem(xs, f) { + if (Array.isArray(xs)) { + for (const x of xs) + f(x); + } else { + f(xs); + } + } + exports2.eachItem = eachItem; + function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues2, resultToName }) { + return (gen, from, to, toName) => { + const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues2(from, to); + return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; + }; + } + exports2.mergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => { + gen.if((0, codegen_1._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from})`)); + }), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => { + if (from === true) { + gen.assign(to, true); + } else { + gen.assign(to, (0, codegen_1._)`${to} || {}`); + setEvaluated(gen, to, from); + } + }), + mergeValues: (from, to) => from === true ? true : { ...from, ...to }, + resultToName: evaluatedPropsToName + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._)`${to} > ${from} ? ${to} : ${from}`)), + mergeValues: (from, to) => from === true ? true : Math.max(from, to), + resultToName: (gen, items) => gen.var("items", items) + }) + }; + function evaluatedPropsToName(gen, ps) { + if (ps === true) + return gen.var("props", true); + const props = gen.var("props", (0, codegen_1._)`{}`); + if (ps !== void 0) + setEvaluated(gen, props, ps); + return props; + } + exports2.evaluatedPropsToName = evaluatedPropsToName; + function setEvaluated(gen, props, ps) { + Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p)}`, true)); + } + exports2.setEvaluated = setEvaluated; + var snippets = {}; + function useFunc(gen, f) { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)) + }); + } + exports2.useFunc = useFunc; + var Type; + (function(Type2) { + Type2[Type2["Num"] = 0] = "Num"; + Type2[Type2["Str"] = 1] = "Str"; + })(Type || (exports2.Type = Type = {})); + function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { + if (dataProp instanceof codegen_1.Name) { + const isNumber2 = dataPropType === Type.Num; + return jsPropertySyntax ? isNumber2 ? (0, codegen_1._)`"[" + ${dataProp} + "]"` : (0, codegen_1._)`"['" + ${dataProp} + "']"` : isNumber2 ? (0, codegen_1._)`"/" + ${dataProp}` : (0, codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; + } + return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp); + } + exports2.getErrorPath = getErrorPath; + function checkStrictMode(it, msg, mode = it.opts.strictSchema) { + if (!mode) + return; + msg = `strict mode: ${msg}`; + if (mode === true) + throw new Error(msg); + it.self.logger.warn(msg); + } + exports2.checkStrictMode = checkStrictMode; + } +}); + +// node_modules/ajv/dist/compile/names.js +var require_names = __commonJS({ + "node_modules/ajv/dist/compile/names.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var names = { + // validation function arguments + data: new codegen_1.Name("data"), + // data passed to validation function + // args passed from referencing schema + valCxt: new codegen_1.Name("valCxt"), + // validation/data context - should not be used directly, it is destructured to the names below + instancePath: new codegen_1.Name("instancePath"), + parentData: new codegen_1.Name("parentData"), + parentDataProperty: new codegen_1.Name("parentDataProperty"), + rootData: new codegen_1.Name("rootData"), + // root data - same as the data passed to the first/top validation function + dynamicAnchors: new codegen_1.Name("dynamicAnchors"), + // used to support recursiveRef and dynamicRef + // function scoped variables + vErrors: new codegen_1.Name("vErrors"), + // null or array of validation errors + errors: new codegen_1.Name("errors"), + // counter of validation errors + this: new codegen_1.Name("this"), + // "globals" + self: new codegen_1.Name("self"), + scope: new codegen_1.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new codegen_1.Name("json"), + jsonPos: new codegen_1.Name("jsonPos"), + jsonLen: new codegen_1.Name("jsonLen"), + jsonPart: new codegen_1.Name("jsonPart") + }; + exports2.default = names; + } +}); + +// node_modules/ajv/dist/compile/errors.js +var require_errors2 = __commonJS({ + "node_modules/ajv/dist/compile/errors.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.extendErrors = exports2.resetErrorsCount = exports2.reportExtraError = exports2.reportError = exports2.keyword$DataError = exports2.keywordError = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var names_1 = require_names(); + exports2.keywordError = { + message: ({ keyword }) => (0, codegen_1.str)`must pass "${keyword}" keyword validation` + }; + exports2.keyword$DataError = { + message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)` + }; + function reportError(cxt, error2 = exports2.keywordError, errorPaths, overrideAllErrors) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error2, errorPaths); + if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) { + addError(gen, errObj); + } else { + returnErrors(it, (0, codegen_1._)`[${errObj}]`); + } + } + exports2.reportError = reportError; + function reportExtraError(cxt, error2 = exports2.keywordError, errorPaths) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error2, errorPaths); + addError(gen, errObj); + if (!(compositeRule || allErrors)) { + returnErrors(it, names_1.default.vErrors); + } + } + exports2.reportExtraError = reportExtraError; + function resetErrorsCount(gen, errsCount) { + gen.assign(names_1.default.errors, errsCount); + gen.if((0, codegen_1._)`${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._)`${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null))); + } + exports2.resetErrorsCount = resetErrorsCount; + function extendErrors({ gen, keyword, schemaValue, data, errsCount, it }) { + if (errsCount === void 0) + throw new Error("ajv implementation error"); + const err2 = gen.name("err"); + gen.forRange("i", errsCount, names_1.default.errors, (i) => { + gen.const(err2, (0, codegen_1._)`${names_1.default.vErrors}[${i}]`); + gen.if((0, codegen_1._)`${err2}.instancePath === undefined`, () => gen.assign((0, codegen_1._)`${err2}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath))); + gen.assign((0, codegen_1._)`${err2}.schemaPath`, (0, codegen_1.str)`${it.errSchemaPath}/${keyword}`); + if (it.opts.verbose) { + gen.assign((0, codegen_1._)`${err2}.schema`, schemaValue); + gen.assign((0, codegen_1._)`${err2}.data`, data); + } + }); + } + exports2.extendErrors = extendErrors; + function addError(gen, errObj) { + const err2 = gen.const("err", errObj); + gen.if((0, codegen_1._)`${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._)`[${err2}]`), (0, codegen_1._)`${names_1.default.vErrors}.push(${err2})`); + gen.code((0, codegen_1._)`${names_1.default.errors}++`); + } + function returnErrors(it, errs) { + const { gen, validateName, schemaEnv } = it; + if (schemaEnv.$async) { + gen.throw((0, codegen_1._)`new ${it.ValidationError}(${errs})`); + } else { + gen.assign((0, codegen_1._)`${validateName}.errors`, errs); + gen.return(false); + } + } + var E = { + keyword: new codegen_1.Name("keyword"), + schemaPath: new codegen_1.Name("schemaPath"), + // also used in JTD errors + params: new codegen_1.Name("params"), + propertyName: new codegen_1.Name("propertyName"), + message: new codegen_1.Name("message"), + schema: new codegen_1.Name("schema"), + parentSchema: new codegen_1.Name("parentSchema") + }; + function errorObjectCode(cxt, error2, errorPaths) { + const { createErrors } = cxt.it; + if (createErrors === false) + return (0, codegen_1._)`{}`; + return errorObject(cxt, error2, errorPaths); + } + function errorObject(cxt, error2, errorPaths = {}) { + const { gen, it } = cxt; + const keyValues = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths) + ]; + extraErrorProps(cxt, error2, keyValues); + return gen.object(...keyValues); + } + function errorInstancePath({ errorPath }, { instancePath }) { + const instPath = instancePath ? (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` : errorPath; + return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)]; + } + function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) { + let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str)`${errSchemaPath}/${keyword}`; + if (schemaPath) { + schPath = (0, codegen_1.str)`${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`; + } + return [E.schemaPath, schPath]; + } + function extraErrorProps(cxt, { params, message }, keyValues) { + const { keyword, data, schemaValue, it } = cxt; + const { opts, propertyName, topSchemaRef, schemaPath } = it; + keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._)`{}`]); + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]); + } + if (opts.verbose) { + keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._)`${topSchemaRef}${schemaPath}`], [names_1.default.data, data]); + } + if (propertyName) + keyValues.push([E.propertyName, propertyName]); + } + } +}); + +// node_modules/ajv/dist/compile/validate/boolSchema.js +var require_boolSchema = __commonJS({ + "node_modules/ajv/dist/compile/validate/boolSchema.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.boolOrEmptySchema = exports2.topBoolOrEmptySchema = void 0; + var errors_1 = require_errors2(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var boolError = { + message: "boolean schema is false" + }; + function topBoolOrEmptySchema(it) { + const { gen, schema, validateName } = it; + if (schema === false) { + falseSchemaError(it, false); + } else if (typeof schema == "object" && schema.$async === true) { + gen.return(names_1.default.data); + } else { + gen.assign((0, codegen_1._)`${validateName}.errors`, null); + gen.return(true); + } + } + exports2.topBoolOrEmptySchema = topBoolOrEmptySchema; + function boolOrEmptySchema(it, valid) { + const { gen, schema } = it; + if (schema === false) { + gen.var(valid, false); + falseSchemaError(it); + } else { + gen.var(valid, true); + } + } + exports2.boolOrEmptySchema = boolOrEmptySchema; + function falseSchemaError(it, overrideAllErrors) { + const { gen, data } = it; + const cxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it + }; + (0, errors_1.reportError)(cxt, boolError, void 0, overrideAllErrors); + } + } +}); + +// node_modules/ajv/dist/compile/rules.js +var require_rules = __commonJS({ + "node_modules/ajv/dist/compile/rules.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRules = exports2.isJSONType = void 0; + var _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"]; + var jsonTypes = new Set(_jsonTypes); + function isJSONType(x) { + return typeof x == "string" && jsonTypes.has(x); + } + exports2.isJSONType = isJSONType; + function getRules() { + const groups = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] } + }; + return { + types: { ...groups, integer: true, boolean: true, null: true }, + rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object], + post: { rules: [] }, + all: {}, + keywords: {} + }; + } + exports2.getRules = getRules; + } +}); + +// node_modules/ajv/dist/compile/validate/applicability.js +var require_applicability = __commonJS({ + "node_modules/ajv/dist/compile/validate/applicability.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shouldUseRule = exports2.shouldUseGroup = exports2.schemaHasRulesForType = void 0; + function schemaHasRulesForType({ schema, self: self2 }, type) { + const group = self2.RULES.types[type]; + return group && group !== true && shouldUseGroup(schema, group); + } + exports2.schemaHasRulesForType = schemaHasRulesForType; + function shouldUseGroup(schema, group) { + return group.rules.some((rule) => shouldUseRule(schema, rule)); + } + exports2.shouldUseGroup = shouldUseGroup; + function shouldUseRule(schema, rule) { + var _a3; + return schema[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema[kwd] !== void 0)); + } + exports2.shouldUseRule = shouldUseRule; + } +}); + +// node_modules/ajv/dist/compile/validate/dataType.js +var require_dataType = __commonJS({ + "node_modules/ajv/dist/compile/validate/dataType.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.reportTypeError = exports2.checkDataTypes = exports2.checkDataType = exports2.coerceAndCheckDataType = exports2.getJSONTypes = exports2.getSchemaTypes = exports2.DataType = void 0; + var rules_1 = require_rules(); + var applicability_1 = require_applicability(); + var errors_1 = require_errors2(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var DataType; + (function(DataType2) { + DataType2[DataType2["Correct"] = 0] = "Correct"; + DataType2[DataType2["Wrong"] = 1] = "Wrong"; + })(DataType || (exports2.DataType = DataType = {})); + function getSchemaTypes(schema) { + const types = getJSONTypes(schema.type); + const hasNull = types.includes("null"); + if (hasNull) { + if (schema.nullable === false) + throw new Error("type: null contradicts nullable: false"); + } else { + if (!types.length && schema.nullable !== void 0) { + throw new Error('"nullable" cannot be used without "type"'); + } + if (schema.nullable === true) + types.push("null"); + } + return types; + } + exports2.getSchemaTypes = getSchemaTypes; + function getJSONTypes(ts) { + const types = Array.isArray(ts) ? ts : ts ? [ts] : []; + if (types.every(rules_1.isJSONType)) + return types; + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); + } + exports2.getJSONTypes = getJSONTypes; + function coerceAndCheckDataType(it, types) { + const { gen, data, opts } = it; + const coerceTo = coerceToTypes(types, opts.coerceTypes); + const checkTypes = types.length > 0 && !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0])); + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong); + gen.if(wrongType, () => { + if (coerceTo.length) + coerceData(it, types, coerceTo); + else + reportTypeError(it); + }); + } + return checkTypes; + } + exports2.coerceAndCheckDataType = coerceAndCheckDataType; + var COERCIBLE = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); + function coerceToTypes(types, coerceTypes) { + return coerceTypes ? types.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : []; + } + function coerceData(it, types, coerceTo) { + const { gen, data, opts } = it; + const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`); + const coerced = gen.let("coerced", (0, codegen_1._)`undefined`); + if (opts.coerceTypes === "array") { + gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))); + } + gen.if((0, codegen_1._)`${coerced} !== undefined`); + for (const t of coerceTo) { + if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") { + coerceSpecificType(t); + } + } + gen.else(); + reportTypeError(it); + gen.endIf(); + gen.if((0, codegen_1._)`${coerced} !== undefined`, () => { + gen.assign(data, coerced); + assignParentData(it, coerced); + }); + function coerceSpecificType(t) { + switch (t) { + case "string": + gen.elseIf((0, codegen_1._)`${dataType} == "number" || ${dataType} == "boolean"`).assign(coerced, (0, codegen_1._)`"" + ${data}`).elseIf((0, codegen_1._)`${data} === null`).assign(coerced, (0, codegen_1._)`""`); + return; + case "number": + gen.elseIf((0, codegen_1._)`${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1._)`+${data}`); + return; + case "integer": + gen.elseIf((0, codegen_1._)`${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1._)`+${data}`); + return; + case "boolean": + gen.elseIf((0, codegen_1._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1._)`${data} === "true" || ${data} === 1`).assign(coerced, true); + return; + case "null": + gen.elseIf((0, codegen_1._)`${data} === "" || ${data} === 0 || ${data} === false`); + gen.assign(coerced, null); + return; + case "array": + gen.elseIf((0, codegen_1._)`${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1._)`[${data}]`); + } + } + } + function assignParentData({ gen, parentData, parentDataProperty }, expr) { + gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr)); + } + function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { + const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; + let cond; + switch (dataType) { + case "null": + return (0, codegen_1._)`${data} ${EQ} null`; + case "array": + cond = (0, codegen_1._)`Array.isArray(${data})`; + break; + case "object": + cond = (0, codegen_1._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`; + break; + case "integer": + cond = numCond((0, codegen_1._)`!(${data} % 1) && !isNaN(${data})`); + break; + case "number": + cond = numCond(); + break; + default: + return (0, codegen_1._)`typeof ${data} ${EQ} ${dataType}`; + } + return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); + function numCond(_cond = codegen_1.nil) { + return (0, codegen_1.and)((0, codegen_1._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._)`isFinite(${data})` : codegen_1.nil); + } + } + exports2.checkDataType = checkDataType; + function checkDataTypes(dataTypes, data, strictNums, correct) { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct); + } + let cond; + const types = (0, util_1.toHash)(dataTypes); + if (types.array && types.object) { + const notObj = (0, codegen_1._)`typeof ${data} != "object"`; + cond = types.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`; + delete types.null; + delete types.array; + delete types.object; + } else { + cond = codegen_1.nil; + } + if (types.number) + delete types.integer; + for (const t in types) + cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct)); + return cond; + } + exports2.checkDataTypes = checkDataTypes; + var typeError = { + message: ({ schema }) => `must be ${schema}`, + params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._)`{type: ${schema}}` : (0, codegen_1._)`{type: ${schemaValue}}` + }; + function reportTypeError(it) { + const cxt = getTypeErrorContext(it); + (0, errors_1.reportError)(cxt, typeError); + } + exports2.reportTypeError = reportTypeError; + function getTypeErrorContext(it) { + const { gen, data, schema } = it; + const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type"); + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it + }; + } + } +}); + +// node_modules/ajv/dist/compile/validate/defaults.js +var require_defaults = __commonJS({ + "node_modules/ajv/dist/compile/validate/defaults.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.assignDefaults = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + function assignDefaults(it, ty) { + const { properties, items } = it.schema; + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default); + } + } else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i) => assignDefault(it, i, sch.default)); + } + } + exports2.assignDefaults = assignDefaults; + function assignDefault(it, prop, defaultValue) { + const { gen, compositeRule, data, opts } = it; + if (defaultValue === void 0) + return; + const childData = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(prop)}`; + if (compositeRule) { + (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`); + return; + } + let condition = (0, codegen_1._)`${childData} === undefined`; + if (opts.useDefaults === "empty") { + condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`; + } + gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`); + } + } +}); + +// node_modules/ajv/dist/vocabularies/code.js +var require_code2 = __commonJS({ + "node_modules/ajv/dist/vocabularies/code.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.validateUnion = exports2.validateArray = exports2.usePattern = exports2.callValidateCode = exports2.schemaProperties = exports2.allSchemaProperties = exports2.noPropertyInData = exports2.propertyInData = exports2.isOwnProperty = exports2.hasPropFunc = exports2.reportMissingProp = exports2.checkMissingProp = exports2.checkReportMissingProp = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var names_1 = require_names(); + var util_2 = require_util(); + function checkReportMissingProp(cxt, prop) { + const { gen, data, it } = cxt; + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({ missingProperty: (0, codegen_1._)`${prop}` }, true); + cxt.error(); + }); + } + exports2.checkReportMissingProp = checkReportMissingProp; + function checkMissingProp({ gen, data, it: { opts } }, properties, missing) { + return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._)`${missing} = ${prop}`))); + } + exports2.checkMissingProp = checkMissingProp; + function reportMissingProp(cxt, missing) { + cxt.setParams({ missingProperty: missing }, true); + cxt.error(); + } + exports2.reportMissingProp = reportMissingProp; + function hasPropFunc(gen) { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, codegen_1._)`Object.prototype.hasOwnProperty` + }); + } + exports2.hasPropFunc = hasPropFunc; + function isOwnProperty(gen, data, property) { + return (0, codegen_1._)`${hasPropFunc(gen)}.call(${data}, ${property})`; + } + exports2.isOwnProperty = isOwnProperty; + function propertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(property)} !== undefined`; + return ownProperties ? (0, codegen_1._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond; + } + exports2.propertyInData = propertyInData; + function noPropertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(property)} === undefined`; + return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond; + } + exports2.noPropertyInData = noPropertyInData; + function allSchemaProperties(schemaMap) { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : []; + } + exports2.allSchemaProperties = allSchemaProperties; + function schemaProperties(it, schemaMap) { + return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p])); + } + exports2.schemaProperties = schemaProperties; + function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) { + const dataAndSchema = passSchema ? (0, codegen_1._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data; + const valCxt = [ + [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)], + [names_1.default.parentData, it.parentData], + [names_1.default.parentDataProperty, it.parentDataProperty], + [names_1.default.rootData, names_1.default.rootData] + ]; + if (it.opts.dynamicRef) + valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]); + const args = (0, codegen_1._)`${dataAndSchema}, ${gen.object(...valCxt)}`; + return context !== codegen_1.nil ? (0, codegen_1._)`${func}.call(${context}, ${args})` : (0, codegen_1._)`${func}(${args})`; + } + exports2.callValidateCode = callValidateCode; + var newRegExp = (0, codegen_1._)`new RegExp`; + function usePattern({ gen, it: { opts } }, pattern) { + const u = opts.unicodeRegExp ? "u" : ""; + const { regExp } = opts.code; + const rx = regExp(pattern, u); + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: (0, codegen_1._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})` + }); + } + exports2.usePattern = usePattern; + function validateArray(cxt) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + if (it.allErrors) { + const validArr = gen.let("valid", true); + validateItems(() => gen.assign(validArr, false)); + return validArr; + } + gen.var(valid, true); + validateItems(() => gen.break()); + return valid; + function validateItems(notValid) { + const len = gen.const("len", (0, codegen_1._)`${data}.length`); + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword, + dataProp: i, + dataPropType: util_1.Type.Num + }, valid); + gen.if((0, codegen_1.not)(valid), notValid); + }); + } + } + exports2.validateArray = validateArray; + function validateUnion(cxt) { + const { gen, schema, keyword, it } = cxt; + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch)); + if (alwaysValid && !it.opts.unevaluated) + return; + const valid = gen.let("valid", false); + const schValid = gen.name("_valid"); + gen.block(() => schema.forEach((_sch, i) => { + const schCxt = cxt.subschema({ + keyword, + schemaProp: i, + compositeRule: true + }, schValid); + gen.assign(valid, (0, codegen_1._)`${valid} || ${schValid}`); + const merged = cxt.mergeValidEvaluated(schCxt, schValid); + if (!merged) + gen.if((0, codegen_1.not)(valid)); + })); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + } + exports2.validateUnion = validateUnion; + } +}); + +// node_modules/ajv/dist/compile/validate/keyword.js +var require_keyword = __commonJS({ + "node_modules/ajv/dist/compile/validate/keyword.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.validateKeywordUsage = exports2.validSchemaType = exports2.funcKeywordCode = exports2.macroKeywordCode = void 0; + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var code_1 = require_code2(); + var errors_1 = require_errors2(); + function macroKeywordCode(cxt, def) { + const { gen, keyword, schema, parentSchema, it } = cxt; + const macroSchema = def.macro.call(it.self, schema, parentSchema, it); + const schemaRef = useKeyword(gen, keyword, macroSchema); + if (it.opts.validateSchema !== false) + it.self.validateSchema(macroSchema, true); + const valid = gen.name("valid"); + cxt.subschema({ + schema: macroSchema, + schemaPath: codegen_1.nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true + }, valid); + cxt.pass(valid, () => cxt.error(true)); + } + exports2.macroKeywordCode = macroKeywordCode; + function funcKeywordCode(cxt, def) { + var _a3; + const { gen, keyword, schema, parentSchema, $data, it } = cxt; + checkAsyncKeyword(it, def); + const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate2); + const valid = gen.let("valid"); + cxt.block$data(valid, validateKeyword); + cxt.ok((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid); + function validateKeyword() { + if (def.errors === false) { + assignValid(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => cxt.error()); + } else { + const ruleErrs = def.async ? validateAsync3() : validateSync(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => addErrs(cxt, ruleErrs)); + } + } + function validateAsync3() { + const ruleErrs = gen.let("ruleErrs", null); + gen.try(() => assignValid((0, codegen_1._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), () => gen.throw(e))); + return ruleErrs; + } + function validateSync() { + const validateErrs = (0, codegen_1._)`${validateRef}.errors`; + gen.assign(validateErrs, null); + assignValid(codegen_1.nil); + return validateErrs; + } + function assignValid(_await = def.async ? (0, codegen_1._)`await ` : codegen_1.nil) { + const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self; + const passSchema = !("compile" in def && !$data || def.schema === false); + gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying); + } + function reportErrs(errors) { + var _a4; + gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid), errors); + } + } + exports2.funcKeywordCode = funcKeywordCode; + function modifyData(cxt) { + const { gen, data, it } = cxt; + gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._)`${it.parentData}[${it.parentDataProperty}]`)); + } + function addErrs(cxt, errs) { + const { gen } = cxt; + gen.if((0, codegen_1._)`Array.isArray(${errs})`, () => { + gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`).assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`); + (0, errors_1.extendErrors)(cxt); + }, () => cxt.error()); + } + function checkAsyncKeyword({ schemaEnv }, def) { + if (def.async && !schemaEnv.$async) + throw new Error("async keyword in sync schema"); + } + function useKeyword(gen, keyword, result) { + if (result === void 0) + throw new Error(`keyword "${keyword}" failed to compile`); + return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) }); + } + function validSchemaType(schema, schemaType, allowUndefined = false) { + return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined"); + } + exports2.validSchemaType = validSchemaType; + function validateKeywordUsage({ schema, opts, self: self2, errSchemaPath }, def, keyword) { + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error"); + } + const deps = def.dependencies; + if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); + } + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]); + if (!valid) { + const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self2.errorsText(def.validateSchema.errors); + if (opts.validateSchema === "log") + self2.logger.error(msg); + else + throw new Error(msg); + } + } + } + exports2.validateKeywordUsage = validateKeywordUsage; + } +}); + +// node_modules/ajv/dist/compile/validate/subschema.js +var require_subschema = __commonJS({ + "node_modules/ajv/dist/compile/validate/subschema.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.extendSubschemaMode = exports2.extendSubschemaData = exports2.getSubschema = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) { + if (keyword !== void 0 && schema !== void 0) { + throw new Error('both "keyword" and "schema" passed, only one allowed'); + } + if (keyword !== void 0) { + const sch = it.schema[keyword]; + return schemaProp === void 0 ? { + schema: sch, + schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}` + } : { + schema: sch[schemaProp], + schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}` + }; + } + if (schema !== void 0) { + if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath + }; + } + throw new Error('either "keyword" or "schema" must be passed'); + } + exports2.getSubschema = getSubschema; + function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) { + if (data !== void 0 && dataProp !== void 0) { + throw new Error('both "data" and "dataProp" passed, only one allowed'); + } + const { gen } = it; + if (dataProp !== void 0) { + const { errorPath, dataPathArr, opts } = it; + const nextData = gen.let("data", (0, codegen_1._)`${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true); + dataContextProps(nextData); + subschema.errorPath = (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`; + subschema.parentDataProperty = (0, codegen_1._)`${dataProp}`; + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]; + } + if (data !== void 0) { + const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); + dataContextProps(nextData); + if (propertyName !== void 0) + subschema.propertyName = propertyName; + } + if (dataTypes) + subschema.dataTypes = dataTypes; + function dataContextProps(_nextData) { + subschema.data = _nextData; + subschema.dataLevel = it.dataLevel + 1; + subschema.dataTypes = []; + it.definedProperties = /* @__PURE__ */ new Set(); + subschema.parentData = it.data; + subschema.dataNames = [...it.dataNames, _nextData]; + } + } + exports2.extendSubschemaData = extendSubschemaData; + function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) { + if (compositeRule !== void 0) + subschema.compositeRule = compositeRule; + if (createErrors !== void 0) + subschema.createErrors = createErrors; + if (allErrors !== void 0) + subschema.allErrors = allErrors; + subschema.jtdDiscriminator = jtdDiscriminator; + subschema.jtdMetadata = jtdMetadata; + } + exports2.extendSubschemaMode = extendSubschemaMode; + } +}); + +// node_modules/fast-deep-equal/index.js +var require_fast_deep_equal = __commonJS({ + "node_modules/fast-deep-equal/index.js"(exports2, module2) { + "use strict"; + module2.exports = function equal(a, b) { + if (a === b) return true; + if (a && b && typeof a == "object" && typeof b == "object") { + if (a.constructor !== b.constructor) return false; + var length, i, keys3; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0; ) + if (!equal(a[i], b[i])) return false; + return true; + } + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + keys3 = Object.keys(a); + length = keys3.length; + if (length !== Object.keys(b).length) return false; + for (i = length; i-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(b, keys3[i])) return false; + for (i = length; i-- !== 0; ) { + var key = keys3[i]; + if (!equal(a[key], b[key])) return false; + } + return true; + } + return a !== a && b !== b; + }; + } +}); + +// node_modules/json-schema-traverse/index.js +var require_json_schema_traverse = __commonJS({ + "node_modules/json-schema-traverse/index.js"(exports2, module2) { + "use strict"; + var traverse = module2.exports = function(schema, opts, cb) { + if (typeof opts == "function") { + cb = opts; + opts = {}; + } + cb = opts.cb || cb; + var pre = typeof cb == "function" ? cb : cb.pre || function() { + }; + var post = cb.post || function() { + }; + _traverse(opts, pre, post, schema, "", schema); + }; + traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true, + if: true, + then: true, + else: true + }; + traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true + }; + traverse.propsKeywords = { + $defs: true, + definitions: true, + properties: true, + patternProperties: true, + dependencies: true + }; + traverse.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true + }; + function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == "object" && !Array.isArray(schema)) { + pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i = 0; i < sch.length; i++) + _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i); + } + } else if (key in traverse.propsKeywords) { + if (sch && typeof sch == "object") { + for (var prop in sch) + _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop); + } + } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) { + _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema); + } + } + post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + } + } + function escapeJsonPtr(str) { + return str.replace(/~/g, "~0").replace(/\//g, "~1"); + } + } +}); + +// node_modules/ajv/dist/compile/resolve.js +var require_resolve = __commonJS({ + "node_modules/ajv/dist/compile/resolve.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSchemaRefs = exports2.resolveUrl = exports2.normalizeId = exports2._getFullPath = exports2.getFullPath = exports2.inlineRef = void 0; + var util_1 = require_util(); + var equal = require_fast_deep_equal(); + var traverse = require_json_schema_traverse(); + var SIMPLE_INLINED = /* @__PURE__ */ new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const" + ]); + function inlineRef(schema, limit = true) { + if (typeof schema == "boolean") + return true; + if (limit === true) + return !hasRef(schema); + if (!limit) + return false; + return countKeys(schema) <= limit; + } + exports2.inlineRef = inlineRef; + var REF_KEYWORDS = /* @__PURE__ */ new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor" + ]); + function hasRef(schema) { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) + return true; + const sch = schema[key]; + if (Array.isArray(sch) && sch.some(hasRef)) + return true; + if (typeof sch == "object" && hasRef(sch)) + return true; + } + return false; + } + function countKeys(schema) { + let count = 0; + for (const key in schema) { + if (key === "$ref") + return Infinity; + count++; + if (SIMPLE_INLINED.has(key)) + continue; + if (typeof schema[key] == "object") { + (0, util_1.eachItem)(schema[key], (sch) => count += countKeys(sch)); + } + if (count === Infinity) + return Infinity; + } + return count; + } + function getFullPath(resolver, id = "", normalize) { + if (normalize !== false) + id = normalizeId(id); + const p = resolver.parse(id); + return _getFullPath(resolver, p); + } + exports2.getFullPath = getFullPath; + function _getFullPath(resolver, p) { + const serialized = resolver.serialize(p); + return serialized.split("#")[0] + "#"; + } + exports2._getFullPath = _getFullPath; + var TRAILING_SLASH_HASH = /#\/?$/; + function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; + } + exports2.normalizeId = normalizeId; + function resolveUrl(resolver, baseId, id) { + id = normalizeId(id); + return resolver.resolve(baseId, id); + } + exports2.resolveUrl = resolveUrl; + var ANCHOR = /^[a-z_][-a-z0-9._]*$/i; + function getSchemaRefs(schema, baseId) { + if (typeof schema == "boolean") + return {}; + const { schemaId, uriResolver } = this.opts; + const schId = normalizeId(schema[schemaId] || baseId); + const baseIds = { "": schId }; + const pathPrefix = getFullPath(uriResolver, schId, false); + const localRefs = {}; + const schemaRefs = /* @__PURE__ */ new Set(); + traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === void 0) + return; + const fullPath = pathPrefix + jsonPtr; + let innerBaseId = baseIds[parentJsonPtr]; + if (typeof sch[schemaId] == "string") + innerBaseId = addRef.call(this, sch[schemaId]); + addAnchor.call(this, sch.$anchor); + addAnchor.call(this, sch.$dynamicAnchor); + baseIds[jsonPtr] = innerBaseId; + function addRef(ref) { + const _resolve = this.opts.uriResolver.resolve; + ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref); + if (schemaRefs.has(ref)) + throw ambiguos(ref); + schemaRefs.add(ref); + let schOrRef = this.refs[ref]; + if (typeof schOrRef == "string") + schOrRef = this.refs[schOrRef]; + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref); + } else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref); + localRefs[ref] = sch; + } else { + this.refs[ref] = fullPath; + } + } + return ref; + } + function addAnchor(anchor2) { + if (typeof anchor2 == "string") { + if (!ANCHOR.test(anchor2)) + throw new Error(`invalid anchor "${anchor2}"`); + addRef.call(this, `#${anchor2}`); + } + } + }); + return localRefs; + function checkAmbiguosRef(sch1, sch2, ref) { + if (sch2 !== void 0 && !equal(sch1, sch2)) + throw ambiguos(ref); + } + function ambiguos(ref) { + return new Error(`reference "${ref}" resolves to more than one schema`); + } + } + exports2.getSchemaRefs = getSchemaRefs; + } +}); + +// node_modules/ajv/dist/compile/validate/index.js +var require_validate = __commonJS({ + "node_modules/ajv/dist/compile/validate/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getData = exports2.KeywordCxt = exports2.validateFunctionCode = void 0; + var boolSchema_1 = require_boolSchema(); + var dataType_1 = require_dataType(); + var applicability_1 = require_applicability(); + var dataType_2 = require_dataType(); + var defaults_1 = require_defaults(); + var keyword_1 = require_keyword(); + var subschema_1 = require_subschema(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var resolve_1 = require_resolve(); + var util_1 = require_util(); + var errors_1 = require_errors2(); + function validateFunctionCode(it) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it); + return; + } + } + validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it)); + } + exports2.validateFunctionCode = validateFunctionCode; + function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) { + if (opts.code.es5) { + gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => { + gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema, opts)}`); + destructureValCxtES5(gen, opts); + gen.code(body); + }); + } else { + gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body)); + } + } + function destructureValCxt(opts) { + return (0, codegen_1._)`{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._)`, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`; + } + function destructureValCxtES5(gen, opts) { + gen.if(names_1.default.valCxt, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.instancePath}`); + gen.var(names_1.default.parentData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentData}`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentDataProperty}`); + gen.var(names_1.default.rootData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.rootData}`); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`); + }, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._)`""`); + gen.var(names_1.default.parentData, (0, codegen_1._)`undefined`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`undefined`); + gen.var(names_1.default.rootData, names_1.default.data); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`{}`); + }); + } + function topSchemaObjCode(it) { + const { schema, opts, gen } = it; + validateFunction(it, () => { + if (opts.$comment && schema.$comment) + commentKeyword(it); + checkNoDefault(it); + gen.let(names_1.default.vErrors, null); + gen.let(names_1.default.errors, 0); + if (opts.unevaluated) + resetEvaluated(it); + typeAndKeywords(it); + returnResults(it); + }); + return; + } + function resetEvaluated(it) { + const { gen, validateName } = it; + it.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName}.evaluated`); + gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`)); + gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`)); + } + function funcSourceUrl(schema, opts) { + const schId = typeof schema == "object" && schema[opts.schemaId]; + return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil; + } + function subschemaCode(it, valid) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid); + return; + } + } + (0, boolSchema_1.boolOrEmptySchema)(it, valid); + } + function schemaCxtHasRules({ schema, self: self2 }) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (self2.RULES.all[key]) + return true; + return false; + } + function isSchemaObj(it) { + return typeof it.schema != "boolean"; + } + function subSchemaObjCode(it, valid) { + const { schema, gen, opts } = it; + if (opts.$comment && schema.$comment) + commentKeyword(it); + updateContext(it); + checkAsyncSchema(it); + const errsCount = gen.const("_errs", names_1.default.errors); + typeAndKeywords(it, errsCount); + gen.var(valid, (0, codegen_1._)`${errsCount} === ${names_1.default.errors}`); + } + function checkKeywords(it) { + (0, util_1.checkUnknownRules)(it); + checkRefsAndKeywords(it); + } + function typeAndKeywords(it, errsCount) { + if (it.opts.jtd) + return schemaKeywords(it, [], false, errsCount); + const types = (0, dataType_1.getSchemaTypes)(it.schema); + const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types); + schemaKeywords(it, types, !checkedTypes, errsCount); + } + function checkRefsAndKeywords(it) { + const { schema, errSchemaPath, opts, self: self2 } = it; + if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self2.RULES)) { + self2.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`); + } + } + function checkNoDefault(it) { + const { schema, opts } = it; + if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) { + (0, util_1.checkStrictMode)(it, "default is ignored in the schema root"); + } + } + function updateContext(it) { + const schId = it.schema[it.opts.schemaId]; + if (schId) + it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId); + } + function checkAsyncSchema(it) { + if (it.schema.$async && !it.schemaEnv.$async) + throw new Error("async schema in sync schema"); + } + function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) { + const msg = schema.$comment; + if (opts.$comment === true) { + gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`); + } else if (typeof opts.$comment == "function") { + const schemaPath = (0, codegen_1.str)`${errSchemaPath}/$comment`; + const rootName = gen.scopeValue("root", { ref: schemaEnv.root }); + gen.code((0, codegen_1._)`${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`); + } + } + function returnResults(it) { + const { gen, schemaEnv, validateName, ValidationError, opts } = it; + if (schemaEnv.$async) { + gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError}(${names_1.default.vErrors})`)); + } else { + gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors); + if (opts.unevaluated) + assignEvaluated(it); + gen.return((0, codegen_1._)`${names_1.default.errors} === 0`); + } + } + function assignEvaluated({ gen, evaluated, props, items }) { + if (props instanceof codegen_1.Name) + gen.assign((0, codegen_1._)`${evaluated}.props`, props); + if (items instanceof codegen_1.Name) + gen.assign((0, codegen_1._)`${evaluated}.items`, items); + } + function schemaKeywords(it, types, typeErrors, errsCount) { + const { gen, schema, data, allErrors, opts, self: self2 } = it; + const { RULES } = self2; + if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); + return; + } + if (!opts.jtd) + checkStrictTypes(it, types); + gen.block(() => { + for (const group of RULES.rules) + groupKeywords(group); + groupKeywords(RULES.post); + }); + function groupKeywords(group) { + if (!(0, applicability_1.shouldUseGroup)(schema, group)) + return; + if (group.type) { + gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers)); + iterateKeywords(it, group); + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else(); + (0, dataType_2.reportTypeError)(it); + } + gen.endIf(); + } else { + iterateKeywords(it, group); + } + if (!allErrors) + gen.if((0, codegen_1._)`${names_1.default.errors} === ${errsCount || 0}`); + } + } + function iterateKeywords(it, group) { + const { gen, schema, opts: { useDefaults } } = it; + if (useDefaults) + (0, defaults_1.assignDefaults)(it, group.type); + gen.block(() => { + for (const rule of group.rules) { + if ((0, applicability_1.shouldUseRule)(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type); + } + } + }); + } + function checkStrictTypes(it, types) { + if (it.schemaEnv.meta || !it.opts.strictTypes) + return; + checkContextTypes(it, types); + if (!it.opts.allowUnionTypes) + checkMultipleTypes(it, types); + checkKeywordTypes(it, it.dataTypes); + } + function checkContextTypes(it, types) { + if (!types.length) + return; + if (!it.dataTypes.length) { + it.dataTypes = types; + return; + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`); + } + }); + narrowSchemaTypes(it, types); + } + function checkMultipleTypes(it, ts) { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword"); + } + } + function checkKeywordTypes(it, ts) { + const rules = it.self.RULES.all; + for (const keyword in rules) { + const rule = rules[keyword]; + if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) { + const { type } = rule.definition; + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`); + } + } + } + } + function hasApplicableType(schTs, kwdT) { + return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer"); + } + function includesType(ts, t) { + return ts.includes(t) || t === "integer" && ts.includes("number"); + } + function narrowSchemaTypes(it, withTypes) { + const ts = []; + for (const t of it.dataTypes) { + if (includesType(withTypes, t)) + ts.push(t); + else if (withTypes.includes("integer") && t === "number") + ts.push("integer"); + } + it.dataTypes = ts; + } + function strictTypesError(it, msg) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + msg += ` at "${schemaPath}" (strictTypes)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes); + } + var KeywordCxt = class { + constructor(it, def, keyword) { + (0, keyword_1.validateKeywordUsage)(it, def, keyword); + this.gen = it.gen; + this.allErrors = it.allErrors; + this.keyword = keyword; + this.data = it.data; + this.schema = it.schema[keyword]; + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data; + this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data); + this.schemaType = def.schemaType; + this.parentSchema = it.schema; + this.params = {}; + this.it = it; + this.def = def; + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)); + } else { + this.schemaCode = this.schemaValue; + if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`); + } + } + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", names_1.default.errors); + } + } + result(condition, successAction, failAction) { + this.failResult((0, codegen_1.not)(condition), successAction, failAction); + } + failResult(condition, successAction, failAction) { + this.gen.if(condition); + if (failAction) + failAction(); + else + this.error(); + if (successAction) { + this.gen.else(); + successAction(); + if (this.allErrors) + this.gen.endIf(); + } else { + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + } + pass(condition, failAction) { + this.failResult((0, codegen_1.not)(condition), void 0, failAction); + } + fail(condition) { + if (condition === void 0) { + this.error(); + if (!this.allErrors) + this.gen.if(false); + return; + } + this.gen.if(condition); + this.error(); + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + fail$data(condition) { + if (!this.$data) + return this.fail(condition); + const { schemaCode } = this; + this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`); + } + error(append, errorParams, errorPaths) { + if (errorParams) { + this.setParams(errorParams); + this._error(append, errorPaths); + this.setParams({}); + return; + } + this._error(append, errorPaths); + } + _error(append, errorPaths) { + ; + (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths); + } + $dataError() { + (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError); + } + reset() { + if (this.errsCount === void 0) + throw new Error('add "trackErrors" to keyword definition'); + (0, errors_1.resetErrorsCount)(this.gen, this.errsCount); + } + ok(cond) { + if (!this.allErrors) + this.gen.if(cond); + } + setParams(obj, assign) { + if (assign) + Object.assign(this.params, obj); + else + this.params = obj; + } + block$data(valid, codeBlock, $dataValid = codegen_1.nil) { + this.gen.block(() => { + this.check$data(valid, $dataValid); + codeBlock(); + }); + } + check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { + if (!this.$data) + return; + const { gen, schemaCode, schemaType, def } = this; + gen.if((0, codegen_1.or)((0, codegen_1._)`${schemaCode} === undefined`, $dataValid)); + if (valid !== codegen_1.nil) + gen.assign(valid, true); + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()); + this.$dataError(); + if (valid !== codegen_1.nil) + gen.assign(valid, false); + } + gen.else(); + } + invalid$data() { + const { gen, schemaCode, schemaType, def, it } = this; + return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema()); + function wrong$DataType() { + if (schemaType.length) { + if (!(schemaCode instanceof codegen_1.Name)) + throw new Error("ajv implementation error"); + const st = Array.isArray(schemaType) ? schemaType : [schemaType]; + return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`; + } + return codegen_1.nil; + } + function invalid$DataSchema() { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); + return (0, codegen_1._)`!${validateSchemaRef}(${schemaCode})`; + } + return codegen_1.nil; + } + } + subschema(appl, valid) { + const subschema = (0, subschema_1.getSubschema)(this.it, appl); + (0, subschema_1.extendSubschemaData)(subschema, this.it, appl); + (0, subschema_1.extendSubschemaMode)(subschema, appl); + const nextContext = { ...this.it, ...subschema, items: void 0, props: void 0 }; + subschemaCode(nextContext, valid); + return nextContext; + } + mergeEvaluated(schemaCxt, toName) { + const { it, gen } = this; + if (!it.opts.unevaluated) + return; + if (it.props !== true && schemaCxt.props !== void 0) { + it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName); + } + if (it.items !== true && schemaCxt.items !== void 0) { + it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName); + } + } + mergeValidEvaluated(schemaCxt, valid) { + const { it, gen } = this; + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name)); + return true; + } + } + }; + exports2.KeywordCxt = KeywordCxt; + function keywordCode(it, keyword, def, ruleType) { + const cxt = new KeywordCxt(it, def, keyword); + if ("code" in def) { + def.code(cxt, ruleType); + } else if (cxt.$data && def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } else if ("macro" in def) { + (0, keyword_1.macroKeywordCode)(cxt, def); + } else if (def.compile || def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } + } + var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; + var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; + function getData($data, { dataLevel, dataNames, dataPathArr }) { + let jsonPointer; + let data; + if ($data === "") + return names_1.default.rootData; + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) + throw new Error(`Invalid JSON-pointer: ${$data}`); + jsonPointer = $data; + data = names_1.default.rootData; + } else { + const matches = RELATIVE_JSON_POINTER.exec($data); + if (!matches) + throw new Error(`Invalid JSON-pointer: ${$data}`); + const up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer === "#") { + if (up >= dataLevel) + throw new Error(errorMsg("property/index", up)); + return dataPathArr[dataLevel - up]; + } + if (up > dataLevel) + throw new Error(errorMsg("data", up)); + data = dataNames[dataLevel - up]; + if (!jsonPointer) + return data; + } + let expr = data; + const segments = jsonPointer.split("/"); + for (const segment of segments) { + if (segment) { + data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`; + expr = (0, codegen_1._)`${expr} && ${data}`; + } + } + return expr; + function errorMsg(pointerType, up) { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; + } + } + exports2.getData = getData; + } +}); + +// node_modules/ajv/dist/runtime/validation_error.js +var require_validation_error = __commonJS({ + "node_modules/ajv/dist/runtime/validation_error.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var ValidationError = class extends Error { + constructor(errors) { + super("validation failed"); + this.errors = errors; + this.ajv = this.validation = true; + } + }; + exports2.default = ValidationError; + } +}); + +// node_modules/ajv/dist/compile/ref_error.js +var require_ref_error = __commonJS({ + "node_modules/ajv/dist/compile/ref_error.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var resolve_1 = require_resolve(); + var MissingRefError = class extends Error { + constructor(resolver, baseId, ref, msg) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`); + this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref); + this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef)); + } + }; + exports2.default = MissingRefError; + } +}); + +// node_modules/ajv/dist/compile/index.js +var require_compile = __commonJS({ + "node_modules/ajv/dist/compile/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveSchema = exports2.getCompilingSchema = exports2.resolveRef = exports2.compileSchema = exports2.SchemaEnv = void 0; + var codegen_1 = require_codegen(); + var validation_error_1 = require_validation_error(); + var names_1 = require_names(); + var resolve_1 = require_resolve(); + var util_1 = require_util(); + var validate_1 = require_validate(); + var SchemaEnv = class { + constructor(env) { + var _a3; + this.refs = {}; + this.dynamicAnchors = {}; + let schema; + if (typeof env.schema == "object") + schema = env.schema; + this.schema = env.schema; + this.schemaId = env.schemaId; + this.root = env.root || this; + this.baseId = (_a3 = env.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); + this.schemaPath = env.schemaPath; + this.localRefs = env.localRefs; + this.meta = env.meta; + this.$async = schema === null || schema === void 0 ? void 0 : schema.$async; + this.refs = {}; + } + }; + exports2.SchemaEnv = SchemaEnv; + function compileSchema(sch) { + const _sch = getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + let _ValidationError; + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: validation_error_1.default, + code: (0, codegen_1._)`require("ajv/dist/runtime/validation_error").default` + }); + } + const validateName = gen.scopeName("validate"); + sch.validateName = validateName; + const schemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: names_1.default.data, + parentData: names_1.default.parentData, + parentDataProperty: names_1.default.parentDataProperty, + dataNames: [names_1.default.data], + dataPathArr: [codegen_1.nil], + // TODO can its length be used as dataLevel if nil is removed? + dataLevel: 0, + dataTypes: [], + definedProperties: /* @__PURE__ */ new Set(), + topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } : { ref: sch.schema }), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: codegen_1.nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, codegen_1._)`""`, + opts: this.opts, + self: this + }; + let sourceCode; + try { + this._compilations.add(sch); + (0, validate_1.validateFunctionCode)(schemaCxt); + gen.optimize(this.opts.code.optimize); + const validateCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`; + if (this.opts.code.process) + sourceCode = this.opts.code.process(sourceCode, sch); + const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); + const validate2 = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate2 }); + validate2.errors = null; + validate2.schema = sch.schema; + validate2.schemaEnv = sch; + if (sch.$async) + validate2.$async = true; + if (this.opts.code.source === true) { + validate2.source = { validateName, validateCode, scopeValues: gen._values }; + } + if (this.opts.unevaluated) { + const { props, items } = schemaCxt; + validate2.evaluated = { + props: props instanceof codegen_1.Name ? void 0 : props, + items: items instanceof codegen_1.Name ? void 0 : items, + dynamicProps: props instanceof codegen_1.Name, + dynamicItems: items instanceof codegen_1.Name + }; + if (validate2.source) + validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated); + } + sch.validate = validate2; + return sch; + } catch (e) { + delete sch.validate; + delete sch.validateName; + if (sourceCode) + this.logger.error("Error compiling schema, function code:", sourceCode); + throw e; + } finally { + this._compilations.delete(sch); + } + } + exports2.compileSchema = compileSchema; + function resolveRef(root, baseId, ref) { + var _a3; + ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); + const schOrFunc = root.refs[ref]; + if (schOrFunc) + return schOrFunc; + let _sch = resolve41.call(this, root, ref); + if (_sch === void 0) { + const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref]; + const { schemaId } = this.opts; + if (schema) + _sch = new SchemaEnv({ schema, schemaId, root, baseId }); + } + if (_sch === void 0) + return; + return root.refs[ref] = inlineOrCompile.call(this, _sch); + } + exports2.resolveRef = resolveRef; + function inlineOrCompile(sch) { + if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) + return sch.schema; + return sch.validate ? sch : compileSchema.call(this, sch); + } + function getCompilingSchema(schEnv) { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) + return sch; + } + } + exports2.getCompilingSchema = getCompilingSchema; + function sameSchemaEnv(s1, s2) { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId; + } + function resolve41(root, ref) { + let sch; + while (typeof (sch = this.refs[ref]) == "string") + ref = sch; + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); + } + function resolveSchema(root, ref) { + const p = this.opts.uriResolver.parse(ref); + const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p); + let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0); + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root); + } + const id = (0, resolve_1.normalizeId)(refPath); + const schOrRef = this.refs[id] || this.schemas[id]; + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef); + if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") + return; + return getJsonPointer.call(this, p, sch); + } + if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") + return; + if (!schOrRef.validate) + compileSchema.call(this, schOrRef); + if (id === (0, resolve_1.normalizeId)(ref)) { + const { schema } = schOrRef; + const { schemaId } = this.opts; + const schId = schema[schemaId]; + if (schId) + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + return new SchemaEnv({ schema, schemaId, root, baseId }); + } + return getJsonPointer.call(this, p, schOrRef); + } + exports2.resolveSchema = resolveSchema; + var PREVENT_SCOPE_CHANGE = /* @__PURE__ */ new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions" + ]); + function getJsonPointer(parsedRef, { baseId, schema, root }) { + var _a3; + if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/") + return; + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") + return; + const partSchema = schema[(0, util_1.unescapeFragment)(part)]; + if (partSchema === void 0) + return; + schema = partSchema; + const schId = typeof schema === "object" && schema[this.opts.schemaId]; + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + } + } + let env; + if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) { + const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref); + env = resolveSchema.call(this, root, $ref); + } + const { schemaId } = this.opts; + env = env || new SchemaEnv({ schema, schemaId, root, baseId }); + if (env.schema !== env.root.schema) + return env; + return void 0; + } + } +}); + +// node_modules/ajv/dist/refs/data.json +var require_data = __commonJS({ + "node_modules/ajv/dist/refs/data.json"(exports2, module2) { + module2.exports = { + $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + description: "Meta-schema for $data reference (JSON AnySchema extension proposal)", + type: "object", + required: ["$data"], + properties: { + $data: { + type: "string", + anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }] + } + }, + additionalProperties: false + }; + } +}); + +// node_modules/fast-uri/lib/utils.js +var require_utils = __commonJS({ + "node_modules/fast-uri/lib/utils.js"(exports2, module2) { + "use strict"; + var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu); + var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u); + var isPort = RegExp.prototype.test.bind(/^\d*$/u); + var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu); + var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu); + var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u); + var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u); + var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u); + var BYTE_HEX = new Array(256); + { + const HEX_DIGITS = "0123456789ABCDEF"; + for (let i = 0; i < 256; i++) { + BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15]; + } + } + function percentEncodeNonAscii(cp) { + if (cp < 2048) { + return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63]; + } + if (cp < 65536) { + return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; + } + return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; + } + function stringArrayToHexStripped(input3) { + let acc = ""; + let code = 0; + let i = 0; + for (i = 0; i < input3.length; i++) { + code = input3[i].charCodeAt(0); + if (code === 48) { + continue; + } + if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { + return ""; + } + acc += input3[i]; + break; + } + for (i += 1; i < input3.length; i++) { + code = input3[i].charCodeAt(0); + if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { + return ""; + } + acc += input3[i]; + } + return acc; + } + var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/); + var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/); + var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/); + var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u); + function isZoneIdentifier(zone) { + if (zone.length === 0) return false; + for (let i = 0; i < zone.length; i++) { + if (isZoneCharacter(zone[i])) continue; + if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) { + i += 2; + continue; + } + return false; + } + return true; + } + function compressIPv6ZeroRun(hextets) { + let bestStart = -1; + let bestLength = 0; + let runStart = -1; + let runLength = 0; + for (let i = 0; i < hextets.length; i++) { + if (hextets[i] === "0") { + if (runStart === -1) runStart = i; + runLength++; + if (runLength > bestLength) { + bestLength = runLength; + bestStart = runStart; + } + } else { + runStart = -1; + runLength = 0; + } + } + if (bestLength < 2) return hextets.join(":"); + const head = hextets.slice(0, bestStart).join(":"); + const tail = hextets.slice(bestStart + bestLength).join(":"); + return head + "::" + tail; + } + function normalizeIPv6Address(input3) { + const compression = input3.indexOf("::"); + if (compression !== -1 && input3.indexOf("::", compression + 1) !== -1) return void 0; + const left = compression === -1 ? input3.split(":") : input3.slice(0, compression).split(":"); + const right = compression === -1 ? [] : input3.slice(compression + 2).split(":"); + if (compression !== -1) { + if (left.length === 1 && left[0] === "") left.length = 0; + if (right.length === 1 && right[0] === "") right.length = 0; + } + const parts = left.concat(right); + let hextetCount = 0; + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + if (part === "") return void 0; + if (part.indexOf(".") !== -1) { + if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0; + hextetCount += 2; + continue; + } + if (!isHextet(part)) return void 0; + parts[i] = parseInt(part, 16).toString(16); + hextetCount++; + } + if (compression === -1) { + if (hextetCount !== 8) return void 0; + return compressIPv6ZeroRun(parts); + } + if (hextetCount >= 8) return void 0; + const expanded = parts.slice(0, left.length); + for (let i = hextetCount; i < 8; i++) expanded.push("0"); + for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]); + return compressIPv6ZeroRun(expanded); + } + function normalizeIPv6(host) { + const bracketed = host[0] === "[" && host[host.length - 1] === "]"; + const hasBracket = host[0] === "[" || host[host.length - 1] === "]"; + if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }; + let input3 = bracketed ? host.slice(1, -1) : host; + if (bracketed && isIPvFuture(input3)) { + input3 = input3.toLowerCase(); + return { host: `[${input3}]`, escapedHost: input3, isIPV6: false, isIPVFuture: true }; + } + if (findToken(input3, ":") < 2) { + return { host, isIPV6: false, error: bracketed }; + } + let zoneIdentifier = ""; + const zoneSeparator = input3.indexOf("%"); + if (zoneSeparator !== -1) { + const separatorLength = input3.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; + zoneIdentifier = input3.slice(zoneSeparator + separatorLength); + if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }; + input3 = input3.slice(0, zoneSeparator); + } + const address = normalizeIPv6Address(input3); + if (address === void 0) return { host, isIPV6: false, error: true }; + return { + host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""), + escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""), + isIPV6: true + }; + } + function findToken(str, token) { + let ind = 0; + for (let i = 0; i < str.length; i++) { + if (str[i] === token) ind++; + } + return ind; + } + function removeDotSegments(path) { + let input3 = path; + const output = []; + let nextSlash = -1; + let len = 0; + while (len = input3.length) { + if (len === 1) { + if (input3 === ".") { + break; + } else if (input3 === "/") { + output.push("/"); + break; + } else { + output.push(input3); + break; + } + } else if (len === 2) { + if (input3[0] === ".") { + if (input3[1] === ".") { + break; + } else if (input3[1] === "/") { + input3 = input3.slice(2); + continue; + } + } else if (input3[0] === "/") { + if (input3[1] === "." || input3[1] === "/") { + output.push("/"); + break; + } + } + } else if (len === 3) { + if (input3 === "/..") { + if (output.length !== 0) { + output.pop(); + } + output.push("/"); + break; + } + } + if (input3[0] === ".") { + if (input3[1] === ".") { + if (input3[2] === "/") { + input3 = input3.slice(3); + continue; + } + } else if (input3[1] === "/") { + input3 = input3.slice(2); + continue; + } + } else if (input3[0] === "/") { + if (input3[1] === ".") { + if (input3[2] === "/") { + input3 = input3.slice(2); + continue; + } else if (input3[2] === ".") { + if (input3[3] === "/") { + input3 = input3.slice(3); + if (output.length !== 0) { + output.pop(); + } + continue; + } + } + } + } + if ((nextSlash = input3.indexOf("/", 1)) === -1) { + output.push(input3); + break; + } else { + output.push(input3.slice(0, nextSlash)); + input3 = input3.slice(nextSlash); + } + } + return output.join(""); + } + function removeDotSegmentsRelative(path) { + if (path === "" || path[0] === "/") { + return removeDotSegments(path); + } + const segments = path.split("/"); + const last = segments.length - 1; + const output = []; + let trailingDirectory = false; + for (let i = 0; i <= last; i++) { + const segment = segments[i]; + if (segment === "." || segment === "..") { + if (segment === "..") { + if (output.length !== 0 && output[output.length - 1] !== "..") { + output.pop(); + } else { + output.push(".."); + } + } + trailingDirectory = i === last; + } else { + output.push(segment); + } + } + if (trailingDirectory && output[output.length - 1] !== "..") { + output.push(""); + } + if (output.length === 0 || output[0] === "" || output[0].includes(":")) { + output.unshift("."); + } + return output.join("/"); + } + var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" }; + var HOST_DELIM_RE = /[@/?#:]/g; + var HOST_DELIM_NO_COLON_RE = /[@/?#]/g; + function reescapeHostDelimiters(host, isIP) { + const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE; + re.lastIndex = 0; + return host.replace(re, (ch) => HOST_DELIMS[ch]); + } + function normalizePercentEncoding(input3, decodeUnreserved = false) { + if (input3.indexOf("%") === -1) { + return input3; + } + let output = ""; + for (let i = 0; i < input3.length; i++) { + if (input3[i] === "%" && i + 2 < input3.length) { + const hex = input3.slice(i + 1, i + 3); + if (isHexPair(hex)) { + const normalizedHex = hex.toUpperCase(); + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); + if (decodeUnreserved && isUnreserved(decoded)) { + output += decoded; + } else { + output += "%" + normalizedHex; + } + i += 2; + continue; + } + } + output += input3[i]; + } + return output; + } + function normalizePathEncoding(input3) { + let output = ""; + for (let i = 0; i < input3.length; i++) { + const ch = input3[i]; + if (ch === "%" && i + 2 < input3.length) { + const hex = input3.slice(i + 1, i + 3); + if (isHexPair(hex)) { + const normalizedHex = hex.toUpperCase(); + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); + if (decoded !== "." && isUnreserved(decoded)) { + output += decoded; + } else { + output += "%" + normalizedHex; + } + i += 2; + continue; + } + } + if (isPathCharacter(ch)) { + output += ch; + } else { + const code = input3.charCodeAt(i); + if (code < 128) { + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input3.length) { + const low = input3.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function serializePathEncoding(input3, pathNoScheme = false) { + let output = ""; + let firstSegment = pathNoScheme && input3[0] !== "/"; + for (let i = 0; i < input3.length; i++) { + const ch = input3[i]; + if (ch === "%" && i + 2 < input3.length) { + const hex = input3.slice(i + 1, i + 3); + if (isHexPair(hex)) { + output += "%" + hex.toUpperCase(); + i += 2; + continue; + } + } + if (ch === "/") { + firstSegment = false; + } + if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) { + output += ch; + } else { + const code = input3.charCodeAt(i); + if (code < 128) { + output += BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input3.length) { + const low = input3.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function encodeComponent(input3, isAllowed) { + let output = ""; + for (let i = 0; i < input3.length; i++) { + const ch = input3[i]; + if (ch === "%" && i + 2 < input3.length) { + const hex = input3.slice(i + 1, i + 3); + if (isHexPair(hex)) { + output += "%" + hex.toUpperCase(); + i += 2; + continue; + } + } + if (isAllowed(ch)) { + output += ch; + } else { + const code = input3.charCodeAt(i); + if (code < 128) { + output += BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input3.length) { + const low = input3.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function encodeUserinfo(input3) { + return encodeComponent(input3, isUserinfoCharacter); + } + function encodeQuery(input3) { + return encodeComponent(input3, isQueryFragmentCharacter); + } + function encodeFragment(input3) { + return encodeComponent(input3, isQueryFragmentCharacter); + } + function isEscapeSafe(cp) { + return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95; + } + function normalizeQueryFragmentEncoding(input3) { + let output = ""; + for (let i = 0; i < input3.length; i++) { + const ch = input3[i]; + if (ch === "%" && i + 2 < input3.length) { + const hex = input3.slice(i + 1, i + 3); + if (isHexPair(hex)) { + const normalizedHex = hex.toUpperCase(); + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); + if (isUnreserved(decoded)) { + output += decoded; + } else { + output += "%" + normalizedHex; + } + i += 2; + continue; + } + } + if (isQueryFragmentCharacter(ch)) { + output += ch; + } else { + const code = input3.charCodeAt(i); + if (code < 128) { + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + } else if (code < 55296 || code > 57343) { + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input3.length) { + const low = input3.charCodeAt(i + 1); + if (low >= 56320 && low <= 57343) { + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + i++; + } else { + output += percentEncodeNonAscii(65533); + } + } else { + output += percentEncodeNonAscii(65533); + } + } + } + return output; + } + function escapePreservingEscapes(input3) { + let output = ""; + for (let i = 0; i < input3.length; i++) { + if (input3[i] === "%" && i + 2 < input3.length) { + const hex = input3.slice(i + 1, i + 3); + if (isHexPair(hex)) { + output += "%" + hex.toUpperCase(); + i += 2; + continue; + } + } + output += escape(input3[i]); + } + return output; + } + function recomposeAuthority(component) { + const uriTokens = []; + if (component.userinfo !== void 0) { + uriTokens.push(encodeUserinfo(component.userinfo)); + uriTokens.push("@"); + } + if (component.host !== void 0) { + let host = component.host; + if (!isIPv4(host)) { + let ipV6res = normalizeIPv6(host); + if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) { + host = normalizePercentEncoding(host, true); + ipV6res = normalizeIPv6(host); + } + if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) { + host = `[${ipV6res.escapedHost}]`; + } else { + host = reescapeHostDelimiters(host, false); + } + } + uriTokens.push(host); + } + if (typeof component.port === "number" || typeof component.port === "string") { + const port = String(component.port); + if (!isPort(port)) { + throw new TypeError("URI port is malformed."); + } + uriTokens.push(":"); + uriTokens.push(port); + } + return uriTokens.length ? uriTokens.join("") : void 0; + } + module2.exports = { + nonSimpleDomain, + recomposeAuthority, + reescapeHostDelimiters, + normalizePercentEncoding, + normalizePathEncoding, + serializePathEncoding, + normalizeQueryFragmentEncoding, + encodeUserinfo, + encodeQuery, + encodeFragment, + escapePreservingEscapes, + removeDotSegments, + removeDotSegmentsRelative, + isIPv4, + isUUID, + normalizeIPv6, + stringArrayToHexStripped + }; + } +}); + +// node_modules/fast-uri/lib/schemes.js +var require_schemes = __commonJS({ + "node_modules/fast-uri/lib/schemes.js"(exports2, module2) { + "use strict"; + var { isUUID } = require_utils(); + var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu; + var supportedSchemeNames = ( + /** @type {const} */ + [ + "http", + "https", + "ws", + "wss", + "urn", + "urn:uuid" + ] + ); + function isValidSchemeName(name) { + return supportedSchemeNames.indexOf( + /** @type {*} */ + name + ) !== -1; + } + function wsIsSecure(wsComponent) { + if (wsComponent.secure === true) { + return true; + } else if (wsComponent.secure === false) { + return false; + } else if (wsComponent.scheme) { + return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S"); + } else { + return false; + } + } + function httpParse(component) { + if (!component.host) { + component.error = component.error || "HTTP URIs must have a host."; + } + return component; + } + function httpSerialize(component) { + const secure = String(component.scheme).toLowerCase() === "https"; + if (component.port === (secure ? 443 : 80) || component.port === "") { + component.port = void 0; + } + if (!component.path) { + component.path = "/"; + } + return component; + } + function wsParse(wsComponent) { + wsComponent.secure = wsIsSecure(wsComponent); + wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : ""); + wsComponent.path = void 0; + wsComponent.query = void 0; + return wsComponent; + } + function wsSerialize(wsComponent) { + if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") { + wsComponent.port = void 0; + } + if (typeof wsComponent.secure === "boolean") { + wsComponent.scheme = wsComponent.secure ? "wss" : "ws"; + wsComponent.secure = void 0; + } + if (wsComponent.resourceName) { + const queryIndex = wsComponent.resourceName.indexOf("?"); + const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex); + wsComponent.path = path && path !== "/" ? path : void 0; + wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1); + wsComponent.resourceName = void 0; + } + wsComponent.fragment = void 0; + return wsComponent; + } + function urnParse(urnComponent, options) { + if (!urnComponent.path) { + urnComponent.error = "URN can not be parsed"; + return urnComponent; + } + const matches = urnComponent.path.match(URN_REG); + if (matches && matches[0] === urnComponent.path) { + const scheme = options.scheme || urnComponent.scheme || "urn"; + urnComponent.nid = matches[1].toLowerCase(); + urnComponent.nss = matches[2]; + const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`; + const schemeHandler = getSchemeHandler(urnScheme); + urnComponent.path = void 0; + if (schemeHandler) { + urnComponent = schemeHandler.parse(urnComponent, options); + } + } else { + urnComponent.error = urnComponent.error || "URN can not be parsed."; + } + return urnComponent; + } + function urnSerialize(urnComponent, options) { + if (urnComponent.nid === void 0) { + throw new Error("URN without nid cannot be serialized"); + } + const scheme = options.scheme || urnComponent.scheme || "urn"; + const nid = urnComponent.nid.toLowerCase(); + const urnScheme = `${scheme}:${options.nid || nid}`; + const schemeHandler = getSchemeHandler(urnScheme); + if (schemeHandler) { + urnComponent = schemeHandler.serialize(urnComponent, options); + } + const uriComponent = urnComponent; + const nss = urnComponent.nss; + uriComponent.path = `${nid || options.nid}:${nss}`; + options.skipEscape = true; + return uriComponent; + } + function urnuuidParse(urnComponent, options) { + const uuidComponent = urnComponent; + uuidComponent.uuid = uuidComponent.nss; + uuidComponent.nss = void 0; + if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) { + uuidComponent.error = uuidComponent.error || "UUID is not valid."; + } + return uuidComponent; + } + function urnuuidSerialize(uuidComponent) { + const urnComponent = uuidComponent; + urnComponent.nss = (uuidComponent.uuid || "").toLowerCase(); + return urnComponent; + } + var http = ( + /** @type {SchemeHandler} */ + { + scheme: "http", + domainHost: true, + parse: httpParse, + serialize: httpSerialize + } + ); + var https = ( + /** @type {SchemeHandler} */ + { + scheme: "https", + domainHost: http.domainHost, + parse: httpParse, + serialize: httpSerialize + } + ); + var ws = ( + /** @type {SchemeHandler} */ + { + scheme: "ws", + domainHost: true, + parse: wsParse, + serialize: wsSerialize + } + ); + var wss = ( + /** @type {SchemeHandler} */ + { + scheme: "wss", + domainHost: ws.domainHost, + parse: ws.parse, + serialize: ws.serialize + } + ); + var urn = ( + /** @type {SchemeHandler} */ + { + scheme: "urn", + parse: urnParse, + serialize: urnSerialize, + skipNormalize: true + } + ); + var urnuuid = ( + /** @type {SchemeHandler} */ + { + scheme: "urn:uuid", + parse: urnuuidParse, + serialize: urnuuidSerialize, + skipNormalize: true + } + ); + var SCHEMES = ( + /** @type {Record} */ + { + http, + https, + ws, + wss, + urn, + "urn:uuid": urnuuid + } + ); + Object.setPrototypeOf(SCHEMES, null); + function getSchemeHandler(scheme) { + return scheme && (SCHEMES[ + /** @type {SchemeName} */ + scheme + ] || SCHEMES[ + /** @type {SchemeName} */ + scheme.toLowerCase() + ]) || void 0; + } + module2.exports = { + wsIsSecure, + SCHEMES, + isValidSchemeName, + getSchemeHandler + }; + } +}); + +// node_modules/fast-uri/index.js +var require_fast_uri = __commonJS({ + "node_modules/fast-uri/index.js"(exports2, module2) { + "use strict"; + var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils(); + var { SCHEMES, getSchemeHandler } = require_schemes(); + var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u; + var MALFORMED_SCHEME_ERROR = "URI scheme is malformed."; + var MALFORMED_HOST_ERROR = "URI host is malformed."; + var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u; + function validateScheme(scheme) { + const stringScheme = String(scheme); + if (!VALID_SCHEME.test(stringScheme)) { + throw new TypeError(MALFORMED_SCHEME_ERROR); + } + return stringScheme; + } + function normalize(uri, options) { + if (typeof uri === "string") { + uri = /** @type {T} */ + normalizeString(uri, options); + } else if (typeof uri === "object") { + uri = /** @type {T} */ + parse4(serialize(uri, options), options); + } + return uri; + } + function resolve41(baseURI, relativeURI, options) { + const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" }; + const { + parsed: baseParsed, + malformedAuthorityOrPort: baseMalformed, + malformedPercentEncoding: baseMalformedPercentEncoding, + malformedSchemeSpecific: baseMalformedSchemeSpecific, + malformedHost: baseMalformedHost, + malformedScheme: baseMalformedScheme + } = parseWithStatus(baseURI, schemelessOptions); + const { + parsed: relativeParsed, + malformedAuthorityOrPort: relativeMalformed, + malformedPercentEncoding: relativeMalformedPercentEncoding, + malformedSchemeSpecific: relativeMalformedSchemeSpecific, + malformedHost: relativeMalformedHost, + malformedScheme: relativeMalformedScheme + } = parseWithStatus(relativeURI, schemelessOptions); + if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) { + throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed."); + } + const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true); + const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme); + const resolvedHost = resolved.host; + const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6); + if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) { + throw new Error(MALFORMED_HOST_ERROR); + } + canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP); + const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost); + if (resolved.error && !encodedASCIIHost) { + throw new Error(resolved.error); + } + schemelessOptions.skipEscape = true; + return serialize(resolved, schemelessOptions); + } + function resolveComponent(base, relative29, options, skipNormalization) { + const target = {}; + if (!skipNormalization) { + base = parse4(serialize(base, options), options); + relative29 = parse4(serialize(relative29, options), options); + } + options = options || {}; + if (!options.tolerant && relative29.scheme) { + target.scheme = relative29.scheme; + target.userinfo = relative29.userinfo; + target.host = relative29.host; + target.port = relative29.port; + target.path = removeDotSegments(relative29.path || ""); + target.query = relative29.query; + } else { + if (relative29.userinfo !== void 0 || relative29.host !== void 0 || relative29.port !== void 0) { + target.userinfo = relative29.userinfo; + target.host = relative29.host; + target.port = relative29.port; + target.path = removeDotSegments(relative29.path || ""); + target.query = relative29.query; + } else { + if (!relative29.path) { + target.path = base.path; + if (relative29.query !== void 0) { + target.query = relative29.query; + } else { + target.query = base.query; + } + } else { + if (relative29.path[0] === "/") { + target.path = removeDotSegments(relative29.path); + } else { + const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0; + if (baseHasAuthority && !base.path) { + target.path = "/" + relative29.path; + } else if (!base.path) { + target.path = relative29.path; + } else { + target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative29.path; + } + target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path); + } + target.query = relative29.query; + } + target.userinfo = base.userinfo; + target.host = base.host; + target.port = base.port; + } + target.scheme = base.scheme; + } + target.fragment = relative29.fragment; + return target; + } + function equal(uriA, uriB, options) { + const normalizedA = normalizeComparableURI(uriA, options); + const normalizedB = normalizeComparableURI(uriB, options); + return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB; + } + function serialize(cmpts, opts) { + const component = { + host: cmpts.host, + scheme: cmpts.scheme, + userinfo: cmpts.userinfo, + port: cmpts.port, + path: cmpts.path, + query: cmpts.query, + nid: cmpts.nid, + nss: cmpts.nss, + uuid: cmpts.uuid, + fragment: cmpts.fragment, + reference: cmpts.reference, + resourceName: cmpts.resourceName, + secure: cmpts.secure, + error: "" + }; + const options = Object.assign({}, opts); + const uriTokens = []; + if (component.scheme) { + component.scheme = validateScheme(component.scheme); + } + const schemeHandler = getSchemeHandler(options.scheme || component.scheme); + if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options); + const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0; + const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority; + const pathNoScheme = !options.skipEscape && schemelessReference; + if (component.path !== void 0) { + if (!options.skipEscape) { + component.path = serializePathEncoding(component.path, pathNoScheme); + } else { + component.path = normalizePercentEncoding(component.path); + } + } + if (options.reference !== "suffix" && component.scheme) { + component.scheme = validateScheme(component.scheme); + uriTokens.push(component.scheme, ":"); + } + const authority = recomposeAuthority(component); + if (authority !== void 0) { + if (options.reference !== "suffix") { + uriTokens.push("//"); + } + uriTokens.push(authority); + if (component.path && component.path[0] !== "/") { + uriTokens.push("/"); + } + } + if (component.path !== void 0) { + let s = component.path; + if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { + s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s); + } + if (schemelessReference) { + s = serializePathEncoding(s, true); + } + if (authority === void 0 && s[0] === "/" && s[1] === "/") { + s = "/%2F" + s.slice(2); + } + uriTokens.push(s); + } + if (component.query !== void 0) { + uriTokens.push("?", encodeQuery(component.query)); + } + if (component.fragment !== void 0) { + uriTokens.push("#", encodeFragment(component.fragment)); + } + return uriTokens.join(""); + } + var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u; + var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/; + var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/; + function getParseError(parsed, matches) { + if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") { + return 'URI path must start with "/" when authority is present.'; + } + if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) { + return "URI port is malformed."; + } + return void 0; + } + function hasMalformedPercentEncoding(component) { + if (component === void 0) return false; + let percent = component.indexOf("%"); + while (percent !== -1) { + if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) { + return true; + } + percent = component.indexOf("%", percent + 3); + } + return false; + } + function isIPLiteral(host) { + return host[0] === "[" && host[host.length - 1] === "]"; + } + function hasMalformedComponentPercentEncoding(matches) { + const host = matches[4]; + return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]); + } + function canonicalizeHost(parsed, options, schemeHandler, isIP) { + if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) { + parsed.error = parsed.error || MALFORMED_HOST_ERROR; + return true; + } + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) { + let url; + try { + url = new URL("http://" + parsed.host); + } catch (e) { + parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e; + return true; + } + if (!isHostOnlyURL(url)) { + parsed.error = parsed.error || MALFORMED_HOST_ERROR; + return true; + } + parsed.host = url.hostname; + } + return false; + } + function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) { + return Boolean( + parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host) + ); + } + function isHostOnlyURL(url) { + return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== ""; + } + function parseWithStatus(uri, opts) { + const options = Object.assign({}, opts); + const parsed = { + scheme: void 0, + userinfo: void 0, + host: "", + port: void 0, + path: "", + query: void 0, + fragment: void 0 + }; + let malformedAuthorityOrPort = false; + let malformedPercentEncoding = false; + let malformedSchemeSpecific = false; + let malformedHost = false; + let malformedIPLiteral = false; + let malformedScheme = false; + let isIP = false; + if (options.reference === "suffix") { + if (options.scheme) { + uri = options.scheme + ":" + uri; + } else { + uri = "//" + uri; + } + } + const authorityMatch = uri.match(AUTHORITY_PREFIX); + if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) { + parsed.error = "URI authority must not contain a literal backslash."; + malformedAuthorityOrPort = true; + } + const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION); + if (introducerMatch !== null) { + const region = introducerMatch[1]; + const normalizedRegion = region.replace(/[\t\n\r]/g, ""); + if (normalizedRegion.length >= 2) { + if (normalizedRegion.slice(0, 2) !== "//") { + parsed.error = parsed.error || "URI authority must not contain a literal backslash."; + malformedAuthorityOrPort = true; + } else if (region.length !== normalizedRegion.length) { + parsed.error = parsed.error || "URI authority introducer must not contain whitespace."; + malformedAuthorityOrPort = true; + } + } + } + const matches = uri.match(URI_PARSE); + if (matches) { + parsed.scheme = matches[1]; + parsed.userinfo = matches[3]; + parsed.host = matches[4]; + parsed.port = parseInt(matches[5], 10); + parsed.path = matches[6] || ""; + parsed.query = matches[7]; + parsed.fragment = matches[8]; + if (parsed.scheme !== void 0) { + if (VALID_SCHEME.test(parsed.scheme)) { + parsed.scheme = parsed.scheme.toLowerCase(); + } else { + parsed.error = parsed.error || MALFORMED_SCHEME_ERROR; + malformedScheme = true; + } + } + malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches); + if (malformedPercentEncoding) { + parsed.error = parsed.error || "URI contains malformed percent-encoding."; + } + if (isNaN(parsed.port)) { + parsed.port = matches[5]; + } + const parseError = getParseError(parsed, matches); + if (parseError !== void 0) { + parsed.error = parsed.error || parseError; + malformedAuthorityOrPort = true; + } + if (parsed.host) { + const ipv4result = isIPv4(parsed.host); + if (ipv4result === false) { + const bracketedIPLiteral = isIPLiteral(parsed.host); + const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1; + const ipv6result = normalizeIPv6(parsed.host); + isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true; + malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true); + parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase(); + if (malformedIPLiteral) { + parsed.error = parsed.error || MALFORMED_HOST_ERROR; + malformedAuthorityOrPort = true; + } + } else { + isIP = true; + } + } + if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) { + parsed.reference = "same-document"; + } else if (parsed.scheme === void 0) { + parsed.reference = "relative"; + } else if (parsed.fragment === void 0) { + parsed.reference = "absolute"; + } else { + parsed.reference = "uri"; + } + if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) { + parsed.error = parsed.error || "URI is not a " + options.reference + " reference."; + } + const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme); + if (!malformedIPLiteral) { + malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP); + } + if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) { + let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true); + if (!isIP) { + host = normalizePercentEncoding(host.toLowerCase()); + } + parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host; + } + if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) { + if (parsed.path) { + parsed.path = normalizePathEncoding(parsed.path); + } + if (parsed.query) { + parsed.query = normalizeQueryFragmentEncoding(parsed.query); + } + if (parsed.fragment) { + parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment); + } + } + if (schemeHandler && schemeHandler.parse) { + schemeHandler.parse(parsed, options); + if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) { + malformedSchemeSpecific = true; + } + } + } else { + parsed.error = parsed.error || "URI can not be parsed."; + } + return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme }; + } + function parse4(uri, opts) { + return parseWithStatus(uri, opts).parsed; + } + function normalizeString(uri, opts) { + return normalizeStringWithStatus(uri, opts).normalized; + } + function normalizeStringWithStatus(uri, opts) { + const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts); + return { + normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts), + malformedAuthorityOrPort, + malformedPercentEncoding, + malformedSchemeSpecific, + malformedHost, + malformedScheme + }; + } + function normalizeComparableURI(uri, opts) { + if (typeof uri !== "string" && typeof uri !== "object") { + return void 0; + } + let value2; + try { + value2 = typeof uri === "string" ? uri : serialize(uri, opts); + } catch { + return void 0; + } + const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value2, opts); + return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized; + } + var fastUri = { + SCHEMES, + normalize, + resolve: resolve41, + resolveComponent, + equal, + serialize, + parse: parse4 + }; + module2.exports = fastUri; + module2.exports.default = fastUri; + module2.exports.fastUri = fastUri; + } +}); + +// node_modules/ajv/dist/runtime/uri.js +var require_uri = __commonJS({ + "node_modules/ajv/dist/runtime/uri.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var uri = require_fast_uri(); + uri.code = 'require("ajv/dist/runtime/uri").default'; + exports2.default = uri; + } +}); + +// node_modules/ajv/dist/core.js +var require_core = __commonJS({ + "node_modules/ajv/dist/core.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CodeGen = exports2.Name = exports2.nil = exports2.stringify = exports2.str = exports2._ = exports2.KeywordCxt = void 0; + var validate_1 = require_validate(); + Object.defineProperty(exports2, "KeywordCxt", { enumerable: true, get: function() { + return validate_1.KeywordCxt; + } }); + var codegen_1 = require_codegen(); + Object.defineProperty(exports2, "_", { enumerable: true, get: function() { + return codegen_1._; + } }); + Object.defineProperty(exports2, "str", { enumerable: true, get: function() { + return codegen_1.str; + } }); + Object.defineProperty(exports2, "stringify", { enumerable: true, get: function() { + return codegen_1.stringify; + } }); + Object.defineProperty(exports2, "nil", { enumerable: true, get: function() { + return codegen_1.nil; + } }); + Object.defineProperty(exports2, "Name", { enumerable: true, get: function() { + return codegen_1.Name; + } }); + Object.defineProperty(exports2, "CodeGen", { enumerable: true, get: function() { + return codegen_1.CodeGen; + } }); + var validation_error_1 = require_validation_error(); + var ref_error_1 = require_ref_error(); + var rules_1 = require_rules(); + var compile_1 = require_compile(); + var codegen_2 = require_codegen(); + var resolve_1 = require_resolve(); + var dataType_1 = require_dataType(); + var util_1 = require_util(); + var $dataRefSchema = require_data(); + var uri_1 = require_uri(); + var defaultRegExp = (str, flags) => new RegExp(str, flags); + defaultRegExp.code = "new RegExp"; + var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"]; + var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error" + ]); + var removedOptions = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now." + }; + var deprecatedOptions = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.' + }; + var MAX_EXPRESSION = 200; + function requiredOptions(o) { + var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; + const s = o.strict; + const _optz = (_a3 = o.code) === null || _a3 === void 0 ? void 0 : _a3.optimize; + const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0; + const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp; + const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default; + return { + strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true, + strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true, + strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log", + strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log", + strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false, + code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp }, + loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION, + loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION, + meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true, + messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true, + inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true, + schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id", + addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true, + validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true, + validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true, + unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true, + int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true, + uriResolver + }; + } + var Ajv2 = class { + constructor(opts = {}) { + this.schemas = {}; + this.refs = {}; + this.formats = /* @__PURE__ */ Object.create(null); + this._compilations = /* @__PURE__ */ new Set(); + this._loading = {}; + this._cache = /* @__PURE__ */ new Map(); + opts = this.opts = { ...opts, ...requiredOptions(opts) }; + const { es5, lines } = this.opts.code; + this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines }); + this.logger = getLogger(opts.logger); + const formatOpt = opts.validateFormats; + opts.validateFormats = false; + this.RULES = (0, rules_1.getRules)(); + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED"); + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn"); + this._metaOpts = getMetaSchemaOptions.call(this); + if (opts.formats) + addInitialFormats.call(this); + this._addVocabularies(); + this._addDefaultMetaSchema(); + if (opts.keywords) + addInitialKeywords.call(this, opts.keywords); + if (typeof opts.meta == "object") + this.addMetaSchema(opts.meta); + addInitialSchemas.call(this); + opts.validateFormats = formatOpt; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data, meta: meta2, schemaId } = this.opts; + let _dataRefSchema = $dataRefSchema; + if (schemaId === "id") { + _dataRefSchema = { ...$dataRefSchema }; + _dataRefSchema.id = _dataRefSchema.$id; + delete _dataRefSchema.$id; + } + if (meta2 && $data) + this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false); + } + defaultMeta() { + const { meta: meta2, schemaId } = this.opts; + return this.opts.defaultMeta = typeof meta2 == "object" ? meta2[schemaId] || meta2 : void 0; + } + validate(schemaKeyRef, data) { + let v; + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef); + if (!v) + throw new Error(`no schema with key or ref "${schemaKeyRef}"`); + } else { + v = this.compile(schemaKeyRef); + } + const valid = v(data); + if (!("$async" in v)) + this.errors = v.errors; + return valid; + } + compile(schema, _meta) { + const sch = this._addSchema(schema, _meta); + return sch.validate || this._compileSchemaEnv(sch); + } + compileAsync(schema, meta2) { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function"); + } + const { loadSchema } = this.opts; + return runCompileAsync.call(this, schema, meta2); + async function runCompileAsync(_schema, _meta) { + await loadMetaSchema.call(this, _schema.$schema); + const sch = this._addSchema(_schema, _meta); + return sch.validate || _compileAsync.call(this, sch); + } + async function loadMetaSchema($ref) { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, { $ref }, true); + } + } + async function _compileAsync(sch) { + try { + return this._compileSchemaEnv(sch); + } catch (e) { + if (!(e instanceof ref_error_1.default)) + throw e; + checkLoaded.call(this, e); + await loadMissingSchema.call(this, e.missingSchema); + return _compileAsync.call(this, sch); + } + } + function checkLoaded({ missingSchema: ref, missingRef }) { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`); + } + } + async function loadMissingSchema(ref) { + const _schema = await _loadSchema.call(this, ref); + if (!this.refs[ref]) + await loadMetaSchema.call(this, _schema.$schema); + if (!this.refs[ref]) + this.addSchema(_schema, ref, meta2); + } + async function _loadSchema(ref) { + const p = this._loading[ref]; + if (p) + return p; + try { + return await (this._loading[ref] = loadSchema(ref)); + } finally { + delete this._loading[ref]; + } + } + } + // Adds schema to the instance + addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) { + if (Array.isArray(schema)) { + for (const sch of schema) + this.addSchema(sch, void 0, _meta, _validateSchema); + return this; + } + let id; + if (typeof schema === "object") { + const { schemaId } = this.opts; + id = schema[schemaId]; + if (id !== void 0 && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`); + } + } + key = (0, resolve_1.normalizeId)(key || id); + this._checkUnique(key); + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true); + return this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) { + this.addSchema(schema, key, true, _validateSchema); + return this; + } + // Validate schema against its meta-schema + validateSchema(schema, throwOrLogError) { + if (typeof schema == "boolean") + return true; + let $schema; + $schema = schema.$schema; + if ($schema !== void 0 && typeof $schema != "string") { + throw new Error("$schema must be a string"); + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); + if (!$schema) { + this.logger.warn("meta-schema not available"); + this.errors = null; + return true; + } + const valid = this.validate($schema, schema); + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(message); + else + throw new Error(message); + } + return valid; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef) { + let sch; + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") + keyRef = sch; + if (sch === void 0) { + const { schemaId } = this.opts; + const root = new compile_1.SchemaEnv({ schema: {}, schemaId }); + sch = compile_1.resolveSchema.call(this, root, keyRef); + if (!sch) + return; + this.refs[keyRef] = sch; + } + return sch.validate || this._compileSchemaEnv(sch); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef); + this._removeAllSchemas(this.refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas); + this._removeAllSchemas(this.refs); + this._cache.clear(); + return this; + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef); + if (typeof sch == "object") + this._cache.delete(sch.schema); + delete this.schemas[schemaKeyRef]; + delete this.refs[schemaKeyRef]; + return this; + } + case "object": { + const cacheKey = schemaKeyRef; + this._cache.delete(cacheKey); + let id = schemaKeyRef[this.opts.schemaId]; + if (id) { + id = (0, resolve_1.normalizeId)(id); + delete this.schemas[id]; + delete this.refs[id]; + } + return this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(definitions) { + for (const def of definitions) + this.addKeyword(def); + return this; + } + addKeyword(kwdOrDef, def) { + let keyword; + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef; + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword"); + def.keyword = keyword; + } + } else if (typeof kwdOrDef == "object" && def === void 0) { + def = kwdOrDef; + keyword = def.keyword; + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array"); + } + } else { + throw new Error("invalid addKeywords parameters"); + } + checkKeyword.call(this, keyword, def); + if (!def) { + (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd)); + return this; + } + keywordMetaschema.call(this, def); + const definition = { + ...def, + type: (0, dataType_1.getJSONTypes)(def.type), + schemaType: (0, dataType_1.getJSONTypes)(def.schemaType) + }; + (0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))); + return this; + } + getKeyword(keyword) { + const rule = this.RULES.all[keyword]; + return typeof rule == "object" ? rule.definition : !!rule; + } + // Remove keyword + removeKeyword(keyword) { + const { RULES } = this; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword); + if (i >= 0) + group.rules.splice(i, 1); + } + return this; + } + // Add format + addFormat(name, format) { + if (typeof format == "string") + format = new RegExp(format); + this.formats[name] = format; + return this; + } + errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) { + if (!errors || errors.length === 0) + return "No errors"; + return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg); + } + $dataMetaSchema(metaSchema, keywordsJsonPointers) { + const rules = this.RULES.all; + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1); + let keywords = metaSchema; + for (const seg of segments) + keywords = keywords[seg]; + for (const key in rules) { + const rule = rules[key]; + if (typeof rule != "object") + continue; + const { $data } = rule.definition; + const schema = keywords[key]; + if ($data && schema) + keywords[key] = schemaOrData(schema); + } + } + return metaSchema; + } + _removeAllSchemas(schemas, regex) { + for (const keyRef in schemas) { + const sch = schemas[keyRef]; + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef]; + } else if (sch && !sch.meta) { + this._cache.delete(sch.schema); + delete schemas[keyRef]; + } + } + } + } + _addSchema(schema, meta2, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { + let id; + const { schemaId } = this.opts; + if (typeof schema == "object") { + id = schema[schemaId]; + } else { + if (this.opts.jtd) + throw new Error("schema must be object"); + else if (typeof schema != "boolean") + throw new Error("schema must be object or boolean"); + } + let sch = this._cache.get(schema); + if (sch !== void 0) + return sch; + baseId = (0, resolve_1.normalizeId)(id || baseId); + const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId); + sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta2, baseId, localRefs }); + this._cache.set(sch.schema, sch); + if (addSchema && !baseId.startsWith("#")) { + if (baseId) + this._checkUnique(baseId); + this.refs[baseId] = sch; + } + if (validateSchema) + this.validateSchema(schema, true); + return sch; + } + _checkUnique(id) { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`); + } + } + _compileSchemaEnv(sch) { + if (sch.meta) + this._compileMetaSchema(sch); + else + compile_1.compileSchema.call(this, sch); + if (!sch.validate) + throw new Error("ajv implementation error"); + return sch.validate; + } + _compileMetaSchema(sch) { + const currentOpts = this.opts; + this.opts = this._metaOpts; + try { + compile_1.compileSchema.call(this, sch); + } finally { + this.opts = currentOpts; + } + } + }; + Ajv2.ValidationError = validation_error_1.default; + Ajv2.MissingRefError = ref_error_1.default; + exports2.default = Ajv2; + function checkOptions(checkOpts2, options, msg, log = "error") { + for (const key in checkOpts2) { + const opt = key; + if (opt in options) + this.logger[log](`${msg}: option ${key}. ${checkOpts2[opt]}`); + } + } + function getSchEnv(keyRef) { + keyRef = (0, resolve_1.normalizeId)(keyRef); + return this.schemas[keyRef] || this.refs[keyRef]; + } + function addInitialSchemas() { + const optsSchemas = this.opts.schemas; + if (!optsSchemas) + return; + if (Array.isArray(optsSchemas)) + this.addSchema(optsSchemas); + else + for (const key in optsSchemas) + this.addSchema(optsSchemas[key], key); + } + function addInitialFormats() { + for (const name in this.opts.formats) { + const format = this.opts.formats[name]; + if (format) + this.addFormat(name, format); + } + } + function addInitialKeywords(defs) { + if (Array.isArray(defs)) { + this.addVocabulary(defs); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const keyword in defs) { + const def = defs[keyword]; + if (!def.keyword) + def.keyword = keyword; + this.addKeyword(def); + } + } + function getMetaSchemaOptions() { + const metaOpts = { ...this.opts }; + for (const opt of META_IGNORE_OPTIONS) + delete metaOpts[opt]; + return metaOpts; + } + var noLogs = { log() { + }, warn() { + }, error() { + } }; + function getLogger(logger) { + if (logger === false) + return noLogs; + if (logger === void 0) + return console; + if (logger.log && logger.warn && logger.error) + return logger; + throw new Error("logger must implement log, warn and error methods"); + } + var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i; + function checkKeyword(keyword, def) { + const { RULES } = this; + (0, util_1.eachItem)(keyword, (kwd) => { + if (RULES.keywords[kwd]) + throw new Error(`Keyword ${kwd} is already defined`); + if (!KEYWORD_NAME.test(kwd)) + throw new Error(`Keyword ${kwd} has invalid name`); + }); + if (!def) + return; + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function'); + } + } + function addRule(keyword, definition, dataType) { + var _a3; + const post = definition === null || definition === void 0 ? void 0 : definition.post; + if (dataType && post) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES } = this; + let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType); + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.rules.push(ruleGroup); + } + RULES.keywords[keyword] = true; + if (!definition) + return; + const rule = { + keyword, + definition: { + ...definition, + type: (0, dataType_1.getJSONTypes)(definition.type), + schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType) + } + }; + if (definition.before) + addBeforeRule.call(this, ruleGroup, rule, definition.before); + else + ruleGroup.rules.push(rule); + RULES.all[keyword] = rule; + (_a3 = definition.implements) === null || _a3 === void 0 ? void 0 : _a3.forEach((kwd) => this.addKeyword(kwd)); + } + function addBeforeRule(ruleGroup, rule, before) { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule); + } else { + ruleGroup.rules.push(rule); + this.logger.warn(`rule ${before} is not defined`); + } + } + function keywordMetaschema(def) { + let { metaSchema } = def; + if (metaSchema === void 0) + return; + if (def.$data && this.opts.$data) + metaSchema = schemaOrData(metaSchema); + def.validateSchema = this.compile(metaSchema, true); + } + var $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" + }; + function schemaOrData(schema) { + return { anyOf: [schema, $dataRef] }; + } + } +}); + +// node_modules/ajv/dist/vocabularies/core/id.js +var require_id = __commonJS({ + "node_modules/ajv/dist/vocabularies/core/id.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var def = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/core/ref.js +var require_ref = __commonJS({ + "node_modules/ajv/dist/vocabularies/core/ref.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.callRef = exports2.getValidate = void 0; + var ref_error_1 = require_ref_error(); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var compile_1 = require_compile(); + var util_1 = require_util(); + var def = { + keyword: "$ref", + schemaType: "string", + code(cxt) { + const { gen, schema: $ref, it } = cxt; + const { baseId, schemaEnv: env, validateName, opts, self: self2 } = it; + const { root } = env; + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) + return callRootRef(); + const schOrEnv = compile_1.resolveRef.call(self2, root, baseId, $ref); + if (schOrEnv === void 0) + throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref); + if (schOrEnv instanceof compile_1.SchemaEnv) + return callValidate(schOrEnv); + return inlineRefSchema(schOrEnv); + function callRootRef() { + if (env === root) + return callRef(cxt, validateName, env, env.$async); + const rootName = gen.scopeValue("root", { ref: root }); + return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async); + } + function callValidate(sch) { + const v = getValidate(cxt, sch); + callRef(cxt, v, sch, sch.$async); + } + function inlineRefSchema(sch) { + const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch }); + const valid = gen.name("valid"); + const schCxt = cxt.subschema({ + schema: sch, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: $ref + }, valid); + cxt.mergeEvaluated(schCxt); + cxt.ok(valid); + } + } + }; + function getValidate(cxt, sch) { + const { gen } = cxt; + return sch.validate ? gen.scopeValue("validate", { ref: sch.validate }) : (0, codegen_1._)`${gen.scopeValue("wrapper", { ref: sch })}.validate`; + } + exports2.getValidate = getValidate; + function callRef(cxt, v, sch, $async) { + const { gen, it } = cxt; + const { allErrors, schemaEnv: env, opts } = it; + const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; + if ($async) + callAsyncRef(); + else + callSyncRef(); + function callAsyncRef() { + if (!env.$async) + throw new Error("async schema referenced by sync schema"); + const valid = gen.let("valid"); + gen.try(() => { + gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`); + addEvaluatedFrom(v); + if (!allErrors) + gen.assign(valid, true); + }, (e) => { + gen.if((0, codegen_1._)`!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e)); + addErrorsFrom(e); + if (!allErrors) + gen.assign(valid, false); + }); + cxt.ok(valid); + } + function callSyncRef() { + cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v)); + } + function addErrorsFrom(source) { + const errs = (0, codegen_1._)`${source}.errors`; + gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); + gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`); + } + function addEvaluatedFrom(source) { + var _a3; + if (!it.opts.unevaluated) + return; + const schEvaluated = (_a3 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a3 === void 0 ? void 0 : _a3.evaluated; + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== void 0) { + it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props); + } + } else { + const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`); + it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name); + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== void 0) { + it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items); + } + } else { + const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`); + it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name); + } + } + } + } + exports2.callRef = callRef; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/core/index.js +var require_core2 = __commonJS({ + "node_modules/ajv/dist/vocabularies/core/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var id_1 = require_id(); + var ref_1 = require_ref(); + var core = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + id_1.default, + ref_1.default + ]; + exports2.default = core; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/limitNumber.js +var require_limitNumber = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var ops = codegen_1.operators; + var KWDs = { + maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE } + }; + var error2 = { + message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}` + }; + var def = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error: error2, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/multipleOf.js +var require_multipleOf = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var error2 = { + message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`, + params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}` + }; + var def = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error: error2, + code(cxt) { + const { gen, data, schemaCode, it } = cxt; + const prec = it.opts.multipleOfPrecision; + const res = gen.let("res"); + const invalid = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`; + cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/runtime/ucs2length.js +var require_ucs2length = __commonJS({ + "node_modules/ajv/dist/runtime/ucs2length.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + function ucs2length(str) { + const len = str.length; + let length = 0; + let pos = 0; + let value2; + while (pos < len) { + length++; + value2 = str.charCodeAt(pos++); + if (value2 >= 55296 && value2 <= 56319 && pos < len) { + value2 = str.charCodeAt(pos); + if ((value2 & 64512) === 56320) + pos++; + } + } + return length; + } + exports2.default = ucs2length; + ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/limitLength.js +var require_limitLength = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var ucs2length_1 = require_ucs2length(); + var error2 = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxLength" ? "more" : "fewer"; + return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`; + }, + params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}` + }; + var def = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error: error2, + code(cxt) { + const { keyword, data, schemaCode, it } = cxt; + const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; + const len = it.opts.unicode === false ? (0, codegen_1._)`${data}.length` : (0, codegen_1._)`${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`; + cxt.fail$data((0, codegen_1._)`${len} ${op} ${schemaCode}`); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/pattern.js +var require_pattern = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var code_1 = require_code2(); + var util_1 = require_util(); + var codegen_1 = require_codegen(); + var error2 = { + message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}` + }; + var def = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error: error2, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const u = it.opts.unicodeRegExp ? "u" : ""; + if ($data) { + const { regExp } = it.opts.code; + const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp); + const valid = gen.let("valid"); + gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false)); + cxt.fail$data((0, codegen_1._)`!${valid}`); + } else { + const regExp = (0, code_1.usePattern)(cxt, schema); + cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/limitProperties.js +var require_limitProperties = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var error2 = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxProperties" ? "more" : "fewer"; + return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`; + }, + params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}` + }; + var def = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error: error2, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._)`Object.keys(${data}).length ${op} ${schemaCode}`); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/required.js +var require_required = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/required.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error2 = { + message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`, + params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}` + }; + var def = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error: error2, + code(cxt) { + const { gen, schema, schemaCode, data, $data, it } = cxt; + const { opts } = it; + if (!$data && schema.length === 0) + return; + const useLoop = schema.length >= opts.loopRequired; + if (it.allErrors) + allErrorsMode(); + else + exitOnErrorMode(); + if (opts.strictRequired) { + const props = cxt.parentSchema.properties; + const { definedProperties } = cxt.it; + for (const requiredKey of schema) { + if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired); + } + } + } + function allErrorsMode() { + if (useLoop || $data) { + cxt.block$data(codegen_1.nil, loopAllRequired); + } else { + for (const prop of schema) { + (0, code_1.checkReportMissingProp)(cxt, prop); + } + } + } + function exitOnErrorMode() { + const missing = gen.let("missing"); + if (useLoop || $data) { + const valid = gen.let("valid", true); + cxt.block$data(valid, () => loopUntilMissing(missing, valid)); + cxt.ok(valid); + } else { + gen.if((0, code_1.checkMissingProp)(cxt, schema, missing)); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + function loopAllRequired() { + gen.forOf("prop", schemaCode, (prop) => { + cxt.setParams({ missingProperty: prop }); + gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error()); + }); + } + function loopUntilMissing(missing, valid) { + cxt.setParams({ missingProperty: missing }); + gen.forOf(missing, schemaCode, () => { + gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties)); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(); + gen.break(); + }); + }, codegen_1.nil); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/limitItems.js +var require_limitItems = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var error2 = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxItems" ? "more" : "fewer"; + return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}` + }; + var def = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error: error2, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._)`${data}.length ${op} ${schemaCode}`); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/runtime/equal.js +var require_equal = __commonJS({ + "node_modules/ajv/dist/runtime/equal.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var equal = require_fast_deep_equal(); + equal.code = 'require("ajv/dist/runtime/equal").default'; + exports2.default = equal; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +var require_uniqueItems = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var dataType_1 = require_dataType(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var equal_1 = require_equal(); + var error2 = { + message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}` + }; + var def = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error: error2, + code(cxt) { + const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; + if (!$data && !schema) + return; + const valid = gen.let("valid"); + const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : []; + cxt.block$data(valid, validateUniqueItems, (0, codegen_1._)`${schemaCode} === false`); + cxt.ok(valid); + function validateUniqueItems() { + const i = gen.let("i", (0, codegen_1._)`${data}.length`); + const j = gen.let("j"); + cxt.setParams({ i, j }); + gen.assign(valid, true); + gen.if((0, codegen_1._)`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)); + } + function canOptimize() { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array"); + } + function loopN(i, j) { + const item = gen.name("item"); + const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong); + const indices = gen.const("indices", (0, codegen_1._)`{}`); + gen.for((0, codegen_1._)`;${i}--;`, () => { + gen.let(item, (0, codegen_1._)`${data}[${i}]`); + gen.if(wrongType, (0, codegen_1._)`continue`); + if (itemTypes.length > 1) + gen.if((0, codegen_1._)`typeof ${item} == "string"`, (0, codegen_1._)`${item} += "_"`); + gen.if((0, codegen_1._)`typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, (0, codegen_1._)`${indices}[${item}]`); + cxt.error(); + gen.assign(valid, false).break(); + }).code((0, codegen_1._)`${indices}[${item}] = ${i}`); + }); + } + function loopN2(i, j) { + const eql = (0, util_1.useFunc)(gen, equal_1.default); + const outer = gen.name("outer"); + gen.label(outer).for((0, codegen_1._)`;${i}--;`, () => gen.for((0, codegen_1._)`${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._)`${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error(); + gen.assign(valid, false).break(outer); + }))); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/const.js +var require_const = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/const.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var equal_1 = require_equal(); + var error2 = { + message: "must be equal to constant", + params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}` + }; + var def = { + keyword: "const", + $data: true, + error: error2, + code(cxt) { + const { gen, data, $data, schemaCode, schema } = cxt; + if ($data || schema && typeof schema == "object") { + cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`); + } else { + cxt.fail((0, codegen_1._)`${schema} !== ${data}`); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/enum.js +var require_enum = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/enum.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var equal_1 = require_equal(); + var error2 = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}` + }; + var def = { + keyword: "enum", + schemaType: "array", + $data: true, + error: error2, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + if (!$data && schema.length === 0) + throw new Error("enum must have non-empty array"); + const useLoop = schema.length >= it.opts.loopEnum; + let eql; + const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default); + let valid; + if (useLoop || $data) { + valid = gen.let("valid"); + cxt.block$data(valid, loopEnum); + } else { + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const vSchema = gen.const("vSchema", schemaCode); + valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i))); + } + cxt.pass(valid); + function loopEnum() { + gen.assign(valid, false); + gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())); + } + function equalCode(vSchema, i) { + const sch = schema[i]; + return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`; + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/validation/index.js +var require_validation = __commonJS({ + "node_modules/ajv/dist/vocabularies/validation/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var limitNumber_1 = require_limitNumber(); + var multipleOf_1 = require_multipleOf(); + var limitLength_1 = require_limitLength(); + var pattern_1 = require_pattern(); + var limitProperties_1 = require_limitProperties(); + var required_1 = require_required(); + var limitItems_1 = require_limitItems(); + var uniqueItems_1 = require_uniqueItems(); + var const_1 = require_const(); + var enum_1 = require_enum(); + var validation = [ + // number + limitNumber_1.default, + multipleOf_1.default, + // string + limitLength_1.default, + pattern_1.default, + // object + limitProperties_1.default, + required_1.default, + // array + limitItems_1.default, + uniqueItems_1.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + const_1.default, + enum_1.default + ]; + exports2.default = validation; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +var require_additionalItems = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.validateAdditionalItems = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error2 = { + message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` + }; + var def = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error: error2, + code(cxt) { + const { parentSchema, it } = cxt; + const { items } = parentSchema; + if (!Array.isArray(items)) { + (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + validateAdditionalItems(cxt, items); + } + }; + function validateAdditionalItems(cxt, items) { + const { gen, schema, data, keyword, it } = cxt; + it.items = true; + const len = gen.const("len", (0, codegen_1._)`${data}.length`); + if (schema === false) { + cxt.setParams({ len: items.length }); + cxt.pass((0, codegen_1._)`${len} <= ${items.length}`); + } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`); + gen.if((0, codegen_1.not)(valid), () => validateItems(valid)); + cxt.ok(valid); + } + function validateItems(valid) { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } + } + exports2.validateAdditionalItems = validateAdditionalItems; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/items.js +var require_items = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/items.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.validateTuple = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var code_1 = require_code2(); + var def = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt) { + const { schema, it } = cxt; + if (Array.isArray(schema)) + return validateTuple(cxt, "additionalItems", schema); + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + cxt.ok((0, code_1.validateArray)(cxt)); + } + }; + function validateTuple(cxt, extraItems, schArr = cxt.schema) { + const { gen, parentSchema, data, keyword, it } = cxt; + checkStrictTuple(parentSchema); + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items); + } + const valid = gen.name("valid"); + const len = gen.const("len", (0, codegen_1._)`${data}.length`); + schArr.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + gen.if((0, codegen_1._)`${len} > ${i}`, () => cxt.subschema({ + keyword, + schemaProp: i, + dataProp: i + }, valid)); + cxt.ok(valid); + }); + function checkStrictTuple(sch) { + const { opts, errSchemaPath } = it; + const l = schArr.length; + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false); + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; + (0, util_1.checkStrictMode)(it, msg, opts.strictTuples); + } + } + } + exports2.validateTuple = validateTuple; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +var require_prefixItems = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var items_1 = require_items(); + var def = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => (0, items_1.validateTuple)(cxt, "items") + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/items2020.js +var require_items2020 = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var code_1 = require_code2(); + var additionalItems_1 = require_additionalItems(); + var error2 = { + message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` + }; + var def = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error: error2, + code(cxt) { + const { schema, parentSchema, it } = cxt; + const { prefixItems } = parentSchema; + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + if (prefixItems) + (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems); + else + cxt.ok((0, code_1.validateArray)(cxt)); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/contains.js +var require_contains = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error2 = { + message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}` + }; + var def = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error: error2, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + let min; + let max; + const { minContains, maxContains } = parentSchema; + if (it.opts.next) { + min = minContains === void 0 ? 1 : minContains; + max = maxContains; + } else { + min = 1; + } + const len = gen.const("len", (0, codegen_1._)`${data}.length`); + cxt.setParams({ min, max }); + if (max === void 0 && min === 0) { + (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`); + return; + } + if (max !== void 0 && min > max) { + (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`); + cxt.fail(); + return; + } + if ((0, util_1.alwaysValidSchema)(it, schema)) { + let cond = (0, codegen_1._)`${len} >= ${min}`; + if (max !== void 0) + cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`; + cxt.pass(cond); + return; + } + it.items = true; + const valid = gen.name("valid"); + if (max === void 0 && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())); + } else if (min === 0) { + gen.let(valid, true); + if (max !== void 0) + gen.if((0, codegen_1._)`${data}.length > 0`, validateItemsWithCount); + } else { + gen.let(valid, false); + validateItemsWithCount(); + } + cxt.result(valid, () => cxt.reset()); + function validateItemsWithCount() { + const schValid = gen.name("_valid"); + const count = gen.let("count", 0); + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))); + } + function validateItems(_valid, block) { + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword: "contains", + dataProp: i, + dataPropType: util_1.Type.Num, + compositeRule: true + }, _valid); + block(); + }); + } + function checkLimits(count) { + gen.code((0, codegen_1._)`${count}++`); + if (max === void 0) { + gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break()); + } else { + gen.if((0, codegen_1._)`${count} > ${max}`, () => gen.assign(valid, false).break()); + if (min === 1) + gen.assign(valid, true); + else + gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true)); + } + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/dependencies.js +var require_dependencies = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.validateSchemaDeps = exports2.validatePropertyDeps = exports2.error = void 0; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var code_1 = require_code2(); + exports2.error = { + message: ({ params: { property, depsCount, deps } }) => { + const property_ies = depsCount === 1 ? "property" : "properties"; + return (0, codegen_1.str)`must have ${property_ies} ${deps} when property ${property} is present`; + }, + params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._)`{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}` + // TODO change to reference + }; + var def = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: exports2.error, + code(cxt) { + const [propDeps, schDeps] = splitDependencies(cxt); + validatePropertyDeps(cxt, propDeps); + validateSchemaDeps(cxt, schDeps); + } + }; + function splitDependencies({ schema }) { + const propertyDeps = {}; + const schemaDeps = {}; + for (const key in schema) { + if (key === "__proto__") + continue; + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; + deps[key] = schema[key]; + } + return [propertyDeps, schemaDeps]; + } + function validatePropertyDeps(cxt, propertyDeps = cxt.schema) { + const { gen, data, it } = cxt; + if (Object.keys(propertyDeps).length === 0) + return; + const missing = gen.let("missing"); + for (const prop in propertyDeps) { + const deps = propertyDeps[prop]; + if (deps.length === 0) + continue; + const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties); + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", ") + }); + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + (0, code_1.checkReportMissingProp)(cxt, depProp); + } + }); + } else { + gen.if((0, codegen_1._)`${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + } + exports2.validatePropertyDeps = validatePropertyDeps; + function validateSchemaDeps(cxt, schemaDeps = cxt.schema) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + for (const prop in schemaDeps) { + if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop])) + continue; + gen.if( + (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), + () => { + const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid); + cxt.mergeValidEvaluated(schCxt, valid); + }, + () => gen.var(valid, true) + // TODO var + ); + cxt.ok(valid); + } + } + exports2.validateSchemaDeps = validateSchemaDeps; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +var require_propertyNames = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error2 = { + message: "property name must be valid", + params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}` + }; + var def = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error: error2, + code(cxt) { + const { gen, schema, data, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + gen.forIn("key", data, (key) => { + cxt.setParams({ propertyName: key }); + cxt.subschema({ + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true + }, valid); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(true); + if (!it.allErrors) + gen.break(); + }); + }); + cxt.ok(valid); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +var require_additionalProperties = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var util_1 = require_util(); + var error2 = { + message: "must NOT have additional properties", + params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}` + }; + var def = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error: error2, + code(cxt) { + const { gen, schema, parentSchema, data, errsCount, it } = cxt; + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, opts } = it; + it.props = true; + if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema)) + return; + const props = (0, code_1.allSchemaProperties)(parentSchema.properties); + const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties); + checkAdditionalProperties(); + cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`); + function checkAdditionalProperties() { + gen.forIn("key", data, (key) => { + if (!props.length && !patProps.length) + additionalPropertyCode(key); + else + gen.if(isAdditional(key), () => additionalPropertyCode(key)); + }); + } + function isAdditional(key) { + let definedProp; + if (props.length > 8) { + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties"); + definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key); + } else if (props.length) { + definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key} === ${p}`)); + } else { + definedProp = codegen_1.nil; + } + if (patProps.length) { + definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key})`)); + } + return (0, codegen_1.not)(definedProp); + } + function deleteAdditional(key) { + gen.code((0, codegen_1._)`delete ${data}[${key}]`); + } + function additionalPropertyCode(key) { + if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) { + deleteAdditional(key); + return; + } + if (schema === false) { + cxt.setParams({ additionalProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false); + gen.if((0, codegen_1.not)(valid), () => { + cxt.reset(); + deleteAdditional(key); + }); + } else { + applyAdditionalSchema(key, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + } + function applyAdditionalSchema(key, valid, errors) { + const subschema = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: util_1.Type.Str + }; + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false + }); + } + cxt.subschema(subschema, valid); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/properties.js +var require_properties = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var validate_1 = require_validate(); + var code_1 = require_code2(); + var util_1 = require_util(); + var additionalProperties_1 = require_additionalProperties(); + var def = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) { + additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties")); + } + const allProps = (0, code_1.allSchemaProperties)(schema); + for (const prop of allProps) { + it.definedProperties.add(prop); + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props); + } + const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + if (properties.length === 0) + return; + const valid = gen.name("valid"); + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop); + } else { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties)); + applyPropertySchema(prop); + if (!it.allErrors) + gen.else().var(valid, true); + gen.endIf(); + } + cxt.it.definedProperties.add(prop); + cxt.ok(valid); + } + function hasDefault(prop) { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== void 0; + } + function applyPropertySchema(prop) { + cxt.subschema({ + keyword: "properties", + schemaProp: prop, + dataProp: prop + }, valid); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +var require_patternProperties = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var util_2 = require_util(); + var def = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, data, parentSchema, it } = cxt; + const { opts } = it; + const patterns = (0, code_1.allSchemaProperties)(schema); + const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p])); + if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) { + return; + } + const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties; + const valid = gen.name("valid"); + if (it.props !== true && !(it.props instanceof codegen_1.Name)) { + it.props = (0, util_2.evaluatedPropsToName)(gen, it.props); + } + const { props } = it; + validatePatternProperties(); + function validatePatternProperties() { + for (const pat of patterns) { + if (checkProperties) + checkMatchingProperties(pat); + if (it.allErrors) { + validateProperties(pat); + } else { + gen.var(valid, true); + validateProperties(pat); + gen.if(valid); + } + } + } + function checkMatchingProperties(pat) { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`); + } + } + } + function validateProperties(pat) { + gen.forIn("key", data, (key) => { + gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat); + if (!alwaysValid) { + cxt.subschema({ + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: util_2.Type.Str + }, valid); + } + if (it.opts.unevaluated && props !== true) { + gen.assign((0, codegen_1._)`${props}[${key}]`, true); + } else if (!alwaysValid && !it.allErrors) { + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + }); + }); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/not.js +var require_not = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/not.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var util_1 = require_util(); + var def = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) { + cxt.fail(); + return; + } + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false + }, valid); + cxt.failResult(valid, () => cxt.reset(), () => cxt.error()); + }, + error: { message: "must NOT be valid" } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/anyOf.js +var require_anyOf = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var code_1 = require_code2(); + var def = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in anyOf" } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/oneOf.js +var require_oneOf = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error2 = { + message: "must match exactly one schema in oneOf", + params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}` + }; + var def = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error: error2, + code(cxt) { + const { gen, schema, parentSchema, it } = cxt; + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + if (it.opts.discriminator && parentSchema.discriminator) + return; + const schArr = schema; + const valid = gen.let("valid", false); + const passing = gen.let("passing", null); + const schValid = gen.name("_valid"); + cxt.setParams({ passing }); + gen.block(validateOneOf); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + function validateOneOf() { + schArr.forEach((sch, i) => { + let schCxt; + if ((0, util_1.alwaysValidSchema)(it, sch)) { + gen.var(schValid, true); + } else { + schCxt = cxt.subschema({ + keyword: "oneOf", + schemaProp: i, + compositeRule: true + }, schValid); + } + if (i > 0) { + gen.if((0, codegen_1._)`${schValid} && ${valid}`).assign(valid, false).assign(passing, (0, codegen_1._)`[${passing}, ${i}]`).else(); + } + gen.if(schValid, () => { + gen.assign(valid, true); + gen.assign(passing, i); + if (schCxt) + cxt.mergeEvaluated(schCxt, codegen_1.Name); + }); + }); + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/allOf.js +var require_allOf = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var util_1 = require_util(); + var def = { + keyword: "allOf", + schemaType: "array", + code(cxt) { + const { gen, schema, it } = cxt; + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const valid = gen.name("valid"); + schema.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid); + cxt.ok(valid); + cxt.mergeEvaluated(schCxt); + }); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/if.js +var require_if = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/if.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error2 = { + message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`, + params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}` + }; + var def = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error: error2, + code(cxt) { + const { gen, parentSchema, it } = cxt; + if (parentSchema.then === void 0 && parentSchema.else === void 0) { + (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored'); + } + const hasThen = hasSchema(it, "then"); + const hasElse = hasSchema(it, "else"); + if (!hasThen && !hasElse) + return; + const valid = gen.let("valid", true); + const schValid = gen.name("_valid"); + validateIf(); + cxt.reset(); + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause"); + cxt.setParams({ ifClause }); + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)); + } else if (hasThen) { + gen.if(schValid, validateClause("then")); + } else { + gen.if((0, codegen_1.not)(schValid), validateClause("else")); + } + cxt.pass(valid, () => cxt.error(true)); + function validateIf() { + const schCxt = cxt.subschema({ + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false + }, schValid); + cxt.mergeEvaluated(schCxt); + } + function validateClause(keyword, ifClause) { + return () => { + const schCxt = cxt.subschema({ keyword }, schValid); + gen.assign(valid, schValid); + cxt.mergeValidEvaluated(schCxt, valid); + if (ifClause) + gen.assign(ifClause, (0, codegen_1._)`${keyword}`); + else + cxt.setParams({ ifClause: keyword }); + }; + } + } + }; + function hasSchema(it, keyword) { + const schema = it.schema[keyword]; + return schema !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema); + } + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/thenElse.js +var require_thenElse = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var util_1 = require_util(); + var def = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword, parentSchema, it }) { + if (parentSchema.if === void 0) + (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`); + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/applicator/index.js +var require_applicator = __commonJS({ + "node_modules/ajv/dist/vocabularies/applicator/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var additionalItems_1 = require_additionalItems(); + var prefixItems_1 = require_prefixItems(); + var items_1 = require_items(); + var items2020_1 = require_items2020(); + var contains_1 = require_contains(); + var dependencies_1 = require_dependencies(); + var propertyNames_1 = require_propertyNames(); + var additionalProperties_1 = require_additionalProperties(); + var properties_1 = require_properties(); + var patternProperties_1 = require_patternProperties(); + var not_1 = require_not(); + var anyOf_1 = require_anyOf(); + var oneOf_1 = require_oneOf(); + var allOf_1 = require_allOf(); + var if_1 = require_if(); + var thenElse_1 = require_thenElse(); + function getApplicator(draft2020 = false) { + const applicator = [ + // any + not_1.default, + anyOf_1.default, + oneOf_1.default, + allOf_1.default, + if_1.default, + thenElse_1.default, + // object + propertyNames_1.default, + additionalProperties_1.default, + dependencies_1.default, + properties_1.default, + patternProperties_1.default + ]; + if (draft2020) + applicator.push(prefixItems_1.default, items2020_1.default); + else + applicator.push(additionalItems_1.default, items_1.default); + applicator.push(contains_1.default); + return applicator; + } + exports2.default = getApplicator; + } +}); + +// node_modules/ajv/dist/vocabularies/format/format.js +var require_format = __commonJS({ + "node_modules/ajv/dist/vocabularies/format/format.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var error2 = { + message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}` + }; + var def = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error: error2, + code(cxt, ruleType) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const { opts, errSchemaPath, schemaEnv, self: self2 } = it; + if (!opts.validateFormats) + return; + if ($data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self2.formats, + code: opts.code.formats + }); + const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`); + const fType = gen.let("fType"); + const format = gen.let("format"); + gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format, fDef)); + cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt())); + function unknownFmt() { + if (opts.strictSchema === false) + return codegen_1.nil; + return (0, codegen_1._)`${schemaCode} && !${format}`; + } + function invalidFmt() { + const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` : (0, codegen_1._)`${format}(${data})`; + const validData = (0, codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; + return (0, codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; + } + } + function validateFormat() { + const formatDef = self2.formats[schema]; + if (!formatDef) { + unknownFormat(); + return; + } + if (formatDef === true) + return; + const [fmtType, format, fmtRef] = getFormat(formatDef); + if (fmtType === ruleType) + cxt.pass(validCondition()); + function unknownFormat() { + if (opts.strictSchema === false) { + self2.logger.warn(unknownMsg()); + return; + } + throw new Error(unknownMsg()); + function unknownMsg() { + return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; + } + } + function getFormat(fmtDef) { + const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0; + const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code }); + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`]; + } + return ["string", fmtDef, fmt]; + } + function validCondition() { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) + throw new Error("async format in sync schema"); + return (0, codegen_1._)`await ${fmtRef}(${data})`; + } + return typeof format == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`; + } + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/vocabularies/format/index.js +var require_format2 = __commonJS({ + "node_modules/ajv/dist/vocabularies/format/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var format_1 = require_format(); + var format = [format_1.default]; + exports2.default = format; + } +}); + +// node_modules/ajv/dist/vocabularies/metadata.js +var require_metadata = __commonJS({ + "node_modules/ajv/dist/vocabularies/metadata.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.contentVocabulary = exports2.metadataVocabulary = void 0; + exports2.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples" + ]; + exports2.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema" + ]; + } +}); + +// node_modules/ajv/dist/vocabularies/draft7.js +var require_draft7 = __commonJS({ + "node_modules/ajv/dist/vocabularies/draft7.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var core_1 = require_core2(); + var validation_1 = require_validation(); + var applicator_1 = require_applicator(); + var format_1 = require_format2(); + var metadata_1 = require_metadata(); + var draft7Vocabularies = [ + core_1.default, + validation_1.default, + (0, applicator_1.default)(), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary + ]; + exports2.default = draft7Vocabularies; + } +}); + +// node_modules/ajv/dist/vocabularies/discriminator/types.js +var require_types = __commonJS({ + "node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DiscrError = void 0; + var DiscrError; + (function(DiscrError2) { + DiscrError2["Tag"] = "tag"; + DiscrError2["Mapping"] = "mapping"; + })(DiscrError || (exports2.DiscrError = DiscrError = {})); + } +}); + +// node_modules/ajv/dist/vocabularies/discriminator/index.js +var require_discriminator = __commonJS({ + "node_modules/ajv/dist/vocabularies/discriminator/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var types_1 = require_types(); + var compile_1 = require_compile(); + var ref_error_1 = require_ref_error(); + var util_1 = require_util(); + var error2 = { + message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`, + params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}` + }; + var def = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error: error2, + code(cxt) { + const { gen, data, schema, parentSchema, it } = cxt; + const { oneOf } = parentSchema; + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option"); + } + const tagName = schema.propertyName; + if (typeof tagName != "string") + throw new Error("discriminator: requires propertyName"); + if (schema.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!oneOf) + throw new Error("discriminator: requires oneOf keyword"); + const valid = gen.let("valid", false); + const tag = gen.const("tag", (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(tagName)}`); + gen.if((0, codegen_1._)`typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName })); + cxt.ok(valid); + function validateMapping() { + const mapping = getMapping(); + gen.if(false); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._)`${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(mapping[tagValue])); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + return _valid; + } + function getMapping() { + var _a3; + const oneOfMapping = {}; + const topRequired = hasRequired(parentSchema); + let tagRequired = true; + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i]; + if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { + const ref = sch.$ref; + sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref); + if (sch instanceof compile_1.SchemaEnv) + sch = sch.schema; + if (sch === void 0) + throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref); + } + const propSch = (_a3 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a3 === void 0 ? void 0 : _a3[tagName]; + if (typeof propSch != "object") { + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`); + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)); + addMappings(propSch, i); + } + if (!tagRequired) + throw new Error(`discriminator: "${tagName}" must be required`); + return oneOfMapping; + function hasRequired({ required: required2 }) { + return Array.isArray(required2) && required2.includes(tagName); + } + function addMappings(sch, i) { + if (sch.const) { + addMapping(sch.const, i); + } else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i); + } + } else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`); + } + } + function addMapping(tagValue, i) { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`); + } + oneOfMapping[tagValue] = i; + } + } + } + }; + exports2.default = def; + } +}); + +// node_modules/ajv/dist/refs/json-schema-draft-07.json +var require_json_schema_draft_07 = __commonJS({ + "node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports2, module2) { + module2.exports = { + $schema: "http://json-schema.org/draft-07/schema#", + $id: "http://json-schema.org/draft-07/schema#", + title: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" } + }, + nonNegativeInteger: { + type: "integer", + minimum: 0 + }, + nonNegativeIntegerDefault0: { + allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }] + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + uniqueItems: true, + default: [] + } + }, + type: ["object", "boolean"], + properties: { + $id: { + type: "string", + format: "uri-reference" + }, + $schema: { + type: "string", + format: "uri" + }, + $ref: { + type: "string", + format: "uri-reference" + }, + $comment: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: true, + readOnly: { + type: "boolean", + default: false + }, + examples: { + type: "array", + items: true + }, + multipleOf: { + type: "number", + exclusiveMinimum: 0 + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "number" + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "number" + }, + maxLength: { $ref: "#/definitions/nonNegativeInteger" }, + minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { $ref: "#" }, + items: { + anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }], + default: true + }, + maxItems: { $ref: "#/definitions/nonNegativeInteger" }, + minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + contains: { $ref: "#" }, + maxProperties: { $ref: "#/definitions/nonNegativeInteger" }, + minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { $ref: "#" }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: {} + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: {} + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + propertyNames: { format: "regex" }, + default: {} + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }] + } + }, + propertyNames: { $ref: "#" }, + const: true, + enum: { + type: "array", + items: true, + minItems: 1, + uniqueItems: true + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true + } + ] + }, + format: { type: "string" }, + contentMediaType: { type: "string" }, + contentEncoding: { type: "string" }, + if: { $ref: "#" }, + then: { $ref: "#" }, + else: { $ref: "#" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" } + }, + default: true + }; + } +}); + +// node_modules/ajv/dist/ajv.js +var require_ajv = __commonJS({ + "node_modules/ajv/dist/ajv.js"(exports2, module2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MissingRefError = exports2.ValidationError = exports2.CodeGen = exports2.Name = exports2.nil = exports2.stringify = exports2.str = exports2._ = exports2.KeywordCxt = exports2.Ajv = void 0; + var core_1 = require_core(); + var draft7_1 = require_draft7(); + var discriminator_1 = require_discriminator(); + var draft7MetaSchema = require_json_schema_draft_07(); + var META_SUPPORT_DATA = ["/properties"]; + var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"; + var Ajv2 = class extends core_1.default { + _addVocabularies() { + super._addVocabularies(); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + const metaSchema = this.opts.$data ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) : draft7MetaSchema; + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0); + } + }; + exports2.Ajv = Ajv2; + module2.exports = exports2 = Ajv2; + module2.exports.Ajv = Ajv2; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.default = Ajv2; + var validate_1 = require_validate(); + Object.defineProperty(exports2, "KeywordCxt", { enumerable: true, get: function() { + return validate_1.KeywordCxt; + } }); + var codegen_1 = require_codegen(); + Object.defineProperty(exports2, "_", { enumerable: true, get: function() { + return codegen_1._; + } }); + Object.defineProperty(exports2, "str", { enumerable: true, get: function() { + return codegen_1.str; + } }); + Object.defineProperty(exports2, "stringify", { enumerable: true, get: function() { + return codegen_1.stringify; + } }); + Object.defineProperty(exports2, "nil", { enumerable: true, get: function() { + return codegen_1.nil; + } }); + Object.defineProperty(exports2, "Name", { enumerable: true, get: function() { + return codegen_1.Name; + } }); + Object.defineProperty(exports2, "CodeGen", { enumerable: true, get: function() { + return codegen_1.CodeGen; + } }); + var validation_error_1 = require_validation_error(); + Object.defineProperty(exports2, "ValidationError", { enumerable: true, get: function() { + return validation_error_1.default; + } }); + var ref_error_1 = require_ref_error(); + Object.defineProperty(exports2, "MissingRefError", { enumerable: true, get: function() { + return ref_error_1.default; + } }); + } +}); + +// node_modules/ajv-formats/dist/formats.js +var require_formats = __commonJS({ + "node_modules/ajv-formats/dist/formats.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.formatNames = exports2.fastFormats = exports2.fullFormats = void 0; + function fmtDef(validate2, compare) { + return { validate: validate2, compare }; + } + exports2.fullFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date3, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(getTime(true), compareTime), + "date-time": fmtDef(getDateTime(true), compareDateTime), + "iso-time": fmtDef(getTime(), compareIsoTime), + "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, + uri, + "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: { type: "number", validate: validateInt32 }, + // signed 64 bit integer + int64: { type: "number", validate: validateInt64 }, + // C-type float + float: { type: "number", validate: validateNumber }, + // C-type double + double: { type: "number", validate: validateNumber }, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true + }; + exports2.fastFormats = { + ...exports2.fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime), + "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime), + "iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime), + "iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i + }; + exports2.formatNames = Object.keys(exports2.fullFormats); + function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + } + var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; + var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + function date3(str) { + const matches = DATE.exec(str); + if (!matches) + return false; + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]); + } + function compareDate(d1, d2) { + if (!(d1 && d2)) + return void 0; + if (d1 > d2) + return 1; + if (d1 < d2) + return -1; + return 0; + } + var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i; + function getTime(strictTimeZone) { + return function time3(str) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hr = +matches[1]; + const min = +matches[2]; + const sec = +matches[3]; + const tz = matches[4]; + const tzSign = matches[5] === "-" ? -1 : 1; + const tzH = +(matches[6] || 0); + const tzM = +(matches[7] || 0); + if (tzH > 23 || tzM > 59 || strictTimeZone && !tz) + return false; + if (hr <= 23 && min <= 59 && sec < 60) + return true; + const utcMin = min - tzM * tzSign; + const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0); + return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61; + }; + } + function compareTime(s1, s2) { + if (!(s1 && s2)) + return void 0; + const t1 = (/* @__PURE__ */ new Date("2020-01-01T" + s1)).valueOf(); + const t2 = (/* @__PURE__ */ new Date("2020-01-01T" + s2)).valueOf(); + if (!(t1 && t2)) + return void 0; + return t1 - t2; + } + function compareIsoTime(t1, t2) { + if (!(t1 && t2)) + return void 0; + const a1 = TIME.exec(t1); + const a2 = TIME.exec(t2); + if (!(a1 && a2)) + return void 0; + t1 = a1[1] + a1[2] + a1[3]; + t2 = a2[1] + a2[2] + a2[3]; + if (t1 > t2) + return 1; + if (t1 < t2) + return -1; + return 0; + } + var DATE_TIME_SEPARATOR = /t|\s/i; + function getDateTime(strictTimeZone) { + const time3 = getTime(strictTimeZone); + return function date_time(str) { + const dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length === 2 && date3(dateTime[0]) && time3(dateTime[1]); + }; + } + function compareDateTime(dt1, dt2) { + if (!(dt1 && dt2)) + return void 0; + const d1 = new Date(dt1).valueOf(); + const d2 = new Date(dt2).valueOf(); + if (!(d1 && d2)) + return void 0; + return d1 - d2; + } + function compareIsoDateTime(dt1, dt2) { + if (!(dt1 && dt2)) + return void 0; + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR); + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR); + const res = compareDate(d1, d2); + if (res === void 0) + return void 0; + return res || compareTime(t1, t2); + } + var NOT_URI_FRAGMENT = /\/|:/; + var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; + function uri(str) { + return NOT_URI_FRAGMENT.test(str) && URI.test(str); + } + var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm; + function byte(str) { + BYTE.lastIndex = 0; + return BYTE.test(str); + } + var MIN_INT32 = -(2 ** 31); + var MAX_INT32 = 2 ** 31 - 1; + function validateInt32(value2) { + return Number.isInteger(value2) && value2 <= MAX_INT32 && value2 >= MIN_INT32; + } + function validateInt64(value2) { + return Number.isInteger(value2); + } + function validateNumber() { + return true; + } + var Z_ANCHOR = /[^\\]\\Z/; + function regex(str) { + if (Z_ANCHOR.test(str)) + return false; + try { + new RegExp(str); + return true; + } catch (e) { + return false; + } + } + } +}); + +// node_modules/ajv-formats/dist/limit.js +var require_limit = __commonJS({ + "node_modules/ajv-formats/dist/limit.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.formatLimitDefinition = void 0; + var ajv_1 = require_ajv(); + var codegen_1 = require_codegen(); + var ops = codegen_1.operators; + var KWDs = { + formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE } + }; + var error2 = { + message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}` + }; + exports2.formatLimitDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error: error2, + code(cxt) { + const { gen, data, schemaCode, keyword, it } = cxt; + const { opts, self: self2 } = it; + if (!opts.validateFormats) + return; + const fCxt = new ajv_1.KeywordCxt(it, self2.RULES.all.format.definition, "format"); + if (fCxt.$data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self2.formats, + code: opts.code.formats + }); + const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`); + cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt))); + } + function validateFormat() { + const format = fCxt.schema; + const fmtDef = self2.formats[format]; + if (!fmtDef || fmtDef === true) + return; + if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`); + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0 + }); + cxt.fail$data(compareCode(fmt)); + } + function compareCode(fmt) { + return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`; + } + }, + dependencies: ["format"] + }; + var formatLimitPlugin = (ajv) => { + ajv.addKeyword(exports2.formatLimitDefinition); + return ajv; + }; + exports2.default = formatLimitPlugin; + } +}); + +// node_modules/ajv-formats/dist/index.js +var require_dist = __commonJS({ + "node_modules/ajv-formats/dist/index.js"(exports2, module2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var formats_1 = require_formats(); + var limit_1 = require_limit(); + var codegen_1 = require_codegen(); + var fullName = new codegen_1.Name("fullFormats"); + var fastName = new codegen_1.Name("fastFormats"); + var formatsPlugin = (ajv, opts = { keywords: true }) => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, formats_1.fullFormats, fullName); + return ajv; + } + const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName]; + const list = opts.formats || formats_1.formatNames; + addFormats(ajv, list, formats, exportName); + if (opts.keywords) + (0, limit_1.default)(ajv); + return ajv; + }; + formatsPlugin.get = (name, mode = "full") => { + const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats; + const f = formats[name]; + if (!f) + throw new Error(`Unknown format "${name}"`); + return f; + }; + function addFormats(ajv, list, fs, exportName) { + var _a3; + var _b; + (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`; + for (const f of list) + ajv.addFormat(f, fs[f]); + } + module2.exports = exports2 = formatsPlugin; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.default = formatsPlugin; + } +}); + +// node_modules/isexe/windows.js +var require_windows = __commonJS({ + "node_modules/isexe/windows.js"(exports2, module2) { + module2.exports = isexe; + isexe.sync = sync; + var fs = require("fs"); + function checkPathExt(path, options) { + var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT; + if (!pathext) { + return true; + } + pathext = pathext.split(";"); + if (pathext.indexOf("") !== -1) { + return true; + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase(); + if (p && path.substr(-p.length).toLowerCase() === p) { + return true; + } + } + return false; + } + function checkStat(stat30, path, options) { + if (!stat30.isSymbolicLink() && !stat30.isFile()) { + return false; + } + return checkPathExt(path, options); + } + function isexe(path, options, cb) { + fs.stat(path, function(er, stat30) { + cb(er, er ? false : checkStat(stat30, path, options)); + }); + } + function sync(path, options) { + return checkStat(fs.statSync(path), path, options); + } + } +}); + +// node_modules/isexe/mode.js +var require_mode = __commonJS({ + "node_modules/isexe/mode.js"(exports2, module2) { + module2.exports = isexe; + isexe.sync = sync; + var fs = require("fs"); + function isexe(path, options, cb) { + fs.stat(path, function(er, stat30) { + cb(er, er ? false : checkStat(stat30, options)); + }); + } + function sync(path, options) { + return checkStat(fs.statSync(path), options); + } + function checkStat(stat30, options) { + return stat30.isFile() && checkMode(stat30, options); + } + function checkMode(stat30, options) { + var mod = stat30.mode; + var uid = stat30.uid; + var gid = stat30.gid; + var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid(); + var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid(); + var u = parseInt("100", 8); + var g = parseInt("010", 8); + var o = parseInt("001", 8); + var ug = u | g; + var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0; + return ret; + } + } +}); + +// node_modules/isexe/index.js +var require_isexe = __commonJS({ + "node_modules/isexe/index.js"(exports2, module2) { + var fs = require("fs"); + var core; + if (process.platform === "win32" || global.TESTING_WINDOWS) { + core = require_windows(); + } else { + core = require_mode(); + } + module2.exports = isexe; + isexe.sync = sync; + function isexe(path, options, cb) { + if (typeof options === "function") { + cb = options; + options = {}; + } + if (!cb) { + if (typeof Promise !== "function") { + throw new TypeError("callback not provided"); + } + return new Promise(function(resolve41, reject) { + isexe(path, options || {}, function(er, is) { + if (er) { + reject(er); + } else { + resolve41(is); + } + }); + }); + } + core(path, options || {}, function(er, is) { + if (er) { + if (er.code === "EACCES" || options && options.ignoreErrors) { + er = null; + is = false; + } + } + cb(er, is); + }); + } + function sync(path, options) { + try { + return core.sync(path, options || {}); + } catch (er) { + if (options && options.ignoreErrors || er.code === "EACCES") { + return false; + } else { + throw er; + } + } + } + } +}); + +// node_modules/which/which.js +var require_which = __commonJS({ + "node_modules/which/which.js"(exports2, module2) { + var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys"; + var path = require("path"); + var COLON = isWindows ? ";" : ":"; + var isexe = require_isexe(); + var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }); + var getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON; + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [ + // windows always checks the cwd first + ...isWindows ? [process.cwd()] : [], + ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */ + "").split(colon) + ]; + const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : ""; + const pathExt = isWindows ? pathExtExe.split(colon) : [""]; + if (isWindows) { + if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") + pathExt.unshift(""); + } + return { + pathEnv, + pathExt, + pathExtExe + }; + }; + var which = (cmd, opt, cb) => { + if (typeof opt === "function") { + cb = opt; + opt = {}; + } + if (!opt) + opt = {}; + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); + const found = []; + const step = (i) => new Promise((resolve41, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve41(found) : reject(getNotFoundError(cmd)); + const ppRaw = pathEnv[i]; + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; + const pCmd = path.join(pathPart, cmd); + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; + resolve41(subStep(p, i, 0)); + }); + const subStep = (p, i, ii) => new Promise((resolve41, reject) => { + if (ii === pathExt.length) + return resolve41(step(i + 1)); + const ext = pathExt[ii]; + isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext); + else + return resolve41(p + ext); + } + return resolve41(subStep(p, i, ii + 1)); + }); + }); + return cb ? step(0).then((res) => cb(null, res), cb) : step(0); + }; + var whichSync = (cmd, opt) => { + opt = opt || {}; + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); + const found = []; + for (let i = 0; i < pathEnv.length; i++) { + const ppRaw = pathEnv[i]; + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; + const pCmd = path.join(pathPart, cmd); + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; + for (let j = 0; j < pathExt.length; j++) { + const cur = p + pathExt[j]; + try { + const is = isexe.sync(cur, { pathExt: pathExtExe }); + if (is) { + if (opt.all) + found.push(cur); + else + return cur; + } + } catch (ex) { + } + } + } + if (opt.all && found.length) + return found; + if (opt.nothrow) + return null; + throw getNotFoundError(cmd); + }; + module2.exports = which; + which.sync = whichSync; + } +}); + +// node_modules/path-key/index.js +var require_path_key = __commonJS({ + "node_modules/path-key/index.js"(exports2, module2) { + "use strict"; + var pathKey = (options = {}) => { + const environment = options.env || process.env; + const platform = options.platform || process.platform; + if (platform !== "win32") { + return "PATH"; + } + return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path"; + }; + module2.exports = pathKey; + module2.exports.default = pathKey; + } +}); + +// node_modules/cross-spawn/lib/util/resolveCommand.js +var require_resolveCommand = __commonJS({ + "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) { + "use strict"; + var path = require("path"); + var which = require_which(); + var getPathKey = require_path_key(); + function resolveCommandAttempt(parsed, withoutPathExt) { + const env = parsed.options.env || process.env; + const cwd = process.cwd(); + const hasCustomCwd = parsed.options.cwd != null; + const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled; + if (shouldSwitchCwd) { + try { + process.chdir(parsed.options.cwd); + } catch (err2) { + } + } + let resolved; + try { + resolved = which.sync(parsed.command, { + path: env[getPathKey({ env })], + pathExt: withoutPathExt ? path.delimiter : void 0 + }); + } catch (e) { + } finally { + if (shouldSwitchCwd) { + process.chdir(cwd); + } + } + if (resolved) { + resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved); + } + return resolved; + } + function resolveCommand(parsed) { + return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); + } + module2.exports = resolveCommand; + } +}); + +// node_modules/cross-spawn/lib/util/escape.js +var require_escape = __commonJS({ + "node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) { + "use strict"; + var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; + function escapeCommand(arg) { + arg = arg.replace(metaCharsRegExp, "^$1"); + return arg; + } + function escapeArgument(arg, doubleEscapeMetaChars) { + arg = `${arg}`; + arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"'); + arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1"); + arg = `"${arg}"`; + arg = arg.replace(metaCharsRegExp, "^$1"); + if (doubleEscapeMetaChars) { + arg = arg.replace(metaCharsRegExp, "^$1"); + } + return arg; + } + module2.exports.command = escapeCommand; + module2.exports.argument = escapeArgument; + } +}); + +// node_modules/shebang-regex/index.js +var require_shebang_regex = __commonJS({ + "node_modules/shebang-regex/index.js"(exports2, module2) { + "use strict"; + module2.exports = /^#!(.*)/; + } +}); + +// node_modules/shebang-command/index.js +var require_shebang_command = __commonJS({ + "node_modules/shebang-command/index.js"(exports2, module2) { + "use strict"; + var shebangRegex = require_shebang_regex(); + module2.exports = (string3 = "") => { + const match = string3.match(shebangRegex); + if (!match) { + return null; + } + const [path, argument] = match[0].replace(/#! ?/, "").split(" "); + const binary = path.split("/").pop(); + if (binary === "env") { + return argument; + } + return argument ? `${binary} ${argument}` : binary; + }; + } +}); + +// node_modules/cross-spawn/lib/util/readShebang.js +var require_readShebang = __commonJS({ + "node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) { + "use strict"; + var fs = require("fs"); + var shebangCommand = require_shebang_command(); + function readShebang(command) { + const size = 150; + const buffer = Buffer.alloc(size); + let fd; + try { + fd = fs.openSync(command, "r"); + fs.readSync(fd, buffer, 0, size, 0); + fs.closeSync(fd); + } catch (e) { + } + return shebangCommand(buffer.toString()); + } + module2.exports = readShebang; + } +}); + +// node_modules/cross-spawn/lib/parse.js +var require_parse = __commonJS({ + "node_modules/cross-spawn/lib/parse.js"(exports2, module2) { + "use strict"; + var path = require("path"); + var resolveCommand = require_resolveCommand(); + var escape2 = require_escape(); + var readShebang = require_readShebang(); + var isWin = process.platform === "win32"; + var isExecutableRegExp = /\.(?:com|exe)$/i; + var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; + function detectShebang(parsed) { + parsed.file = resolveCommand(parsed); + const shebang = parsed.file && readShebang(parsed.file); + if (shebang) { + parsed.args.unshift(parsed.file); + parsed.command = shebang; + return resolveCommand(parsed); + } + return parsed.file; + } + function parseNonShell(parsed) { + if (!isWin) { + return parsed; + } + const commandFile = detectShebang(parsed); + const needsShell = !isExecutableRegExp.test(commandFile); + if (parsed.options.forceShell || needsShell) { + const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); + parsed.command = path.normalize(parsed.command); + parsed.command = escape2.command(parsed.command); + parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars)); + const shellCommand = [parsed.command].concat(parsed.args).join(" "); + parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`]; + parsed.command = process.env.comspec || "cmd.exe"; + parsed.options.windowsVerbatimArguments = true; + } + return parsed; + } + function parse4(command, args, options) { + if (args && !Array.isArray(args)) { + options = args; + args = null; + } + args = args ? args.slice(0) : []; + options = Object.assign({}, options); + const parsed = { + command, + args, + options, + file: void 0, + original: { + command, + args + } + }; + return options.shell ? parsed : parseNonShell(parsed); + } + module2.exports = parse4; + } +}); + +// node_modules/cross-spawn/lib/enoent.js +var require_enoent = __commonJS({ + "node_modules/cross-spawn/lib/enoent.js"(exports2, module2) { + "use strict"; + var isWin = process.platform === "win32"; + function notFoundError(original, syscall) { + return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { + code: "ENOENT", + errno: "ENOENT", + syscall: `${syscall} ${original.command}`, + path: original.command, + spawnargs: original.args + }); + } + function hookChildProcess(cp, parsed) { + if (!isWin) { + return; + } + const originalEmit = cp.emit; + cp.emit = function(name, arg1) { + if (name === "exit") { + const err2 = verifyENOENT(arg1, parsed); + if (err2) { + return originalEmit.call(cp, "error", err2); + } + } + return originalEmit.apply(cp, arguments); + }; + } + function verifyENOENT(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, "spawn"); + } + return null; + } + function verifyENOENTSync(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, "spawnSync"); + } + return null; + } + module2.exports = { + hookChildProcess, + verifyENOENT, + verifyENOENTSync, + notFoundError + }; + } +}); + +// node_modules/cross-spawn/index.js +var require_cross_spawn = __commonJS({ + "node_modules/cross-spawn/index.js"(exports2, module2) { + "use strict"; + var cp = require("child_process"); + var parse4 = require_parse(); + var enoent = require_enoent(); + function spawn9(command, args, options) { + const parsed = parse4(command, args, options); + const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); + enoent.hookChildProcess(spawned, parsed); + return spawned; + } + function spawnSync(command, args, options) { + const parsed = parse4(command, args, options); + const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); + result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); + return result; + } + module2.exports = spawn9; + module2.exports.spawn = spawn9; + module2.exports.sync = spawnSync; + module2.exports._parse = parse4; + module2.exports._enoent = enoent; + } +}); + +// node_modules/tus-js-client/lib.es5/error.js +var require_error = __commonJS({ + "node_modules/tus-js-client/lib.es5/error.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _possibleConstructorReturn(self2, call) { + if (call && (_typeof(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return _assertThisInitialized(self2); + } + function _assertThisInitialized(self2) { + if (self2 === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self2; + } + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + function _wrapNativeSuper(Class2) { + var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; + _wrapNativeSuper = function _wrapNativeSuper2(Class3) { + if (Class3 === null || !_isNativeFunction(Class3)) return Class3; + if (typeof Class3 !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + if (typeof _cache !== "undefined") { + if (_cache.has(Class3)) return _cache.get(Class3); + _cache.set(Class3, Wrapper); + } + function Wrapper() { + return _construct(Class3, arguments, _getPrototypeOf(this).constructor); + } + Wrapper.prototype = Object.create(Class3.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class3); + }; + return _wrapNativeSuper(Class2); + } + function _construct(t, e, r) { + if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && _setPrototypeOf(p, r.prototype), p; + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + } catch (t2) { + } + return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() { + return !!t; + })(); + } + function _isNativeFunction(fn) { + try { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } catch (e) { + return typeof fn === "function"; + } + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { + o2.__proto__ = p2; + return o2; + }; + return _setPrototypeOf(o, p); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { + return o2.__proto__ || Object.getPrototypeOf(o2); + }; + return _getPrototypeOf(o); + } + var DetailedError = /* @__PURE__ */ (function(_Error) { + function DetailedError2(message) { + var _this; + var causingErr = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + var req = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null; + var res = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; + _classCallCheck(this, DetailedError2); + _this = _callSuper(this, DetailedError2, [message]); + _this.originalRequest = req; + _this.originalResponse = res; + _this.causingError = causingErr; + if (causingErr != null) { + message += ", caused by ".concat(causingErr.toString()); + } + if (req != null) { + var requestId = req.getHeader("X-Request-ID") || "n/a"; + var method = req.getMethod(); + var url = req.getURL(); + var status = res ? res.getStatus() : "n/a"; + var body = res ? res.getBody() || "" : "n/a"; + message += ", originated from request (method: ".concat(method, ", url: ").concat(url, ", response code: ").concat(status, ", response text: ").concat(body, ", request id: ").concat(requestId, ")"); + } + _this.message = message; + return _this; + } + _inherits(DetailedError2, _Error); + return _createClass(DetailedError2); + })(/* @__PURE__ */ _wrapNativeSuper(Error)); + var _default2 = exports2.default = DetailedError; + } +}); + +// node_modules/tus-js-client/lib.es5/logger.js +var require_logger = __commonJS({ + "node_modules/tus-js-client/lib.es5/logger.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.enableDebugLog = enableDebugLog; + exports2.log = log; + var isEnabled = false; + function enableDebugLog() { + isEnabled = true; + } + function log(msg) { + if (!isEnabled) return; + console.log(msg); + } + } +}); + +// node_modules/tus-js-client/lib.es5/noopUrlStorage.js +var require_noopUrlStorage = __commonJS({ + "node_modules/tus-js-client/lib.es5/noopUrlStorage.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var NoopUrlStorage = exports2.default = /* @__PURE__ */ (function() { + function NoopUrlStorage2() { + _classCallCheck(this, NoopUrlStorage2); + } + return _createClass(NoopUrlStorage2, [{ + key: "listAllUploads", + value: function listAllUploads() { + return Promise.resolve([]); + } + }, { + key: "findUploadsByFingerprint", + value: function findUploadsByFingerprint(_fingerprint) { + return Promise.resolve([]); + } + }, { + key: "removeUpload", + value: function removeUpload(_urlStorageKey) { + return Promise.resolve(); + } + }, { + key: "addUpload", + value: function addUpload(_fingerprint, _upload) { + return Promise.resolve(null); + } + }]); + })(); + } +}); + +// node_modules/js-base64/base64.js +var require_base64 = __commonJS({ + "node_modules/js-base64/base64.js"(exports2, module2) { + (function(global2, factory) { + typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, (function() { + var current = global2.Base64; + var exports3 = global2.Base64 = {}; + factory(exports3); + exports3.noConflict = function() { + global2.Base64 = current; + return exports3; + }; + })()); + })(exports2, (function(exports3) { + "use strict"; + var version2 = "3.9.4"; + var VERSION = version2; + var _TD = typeof TextDecoder === "function" ? new TextDecoder("utf-8", { ignoreBOM: true }) : void 0; + var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0; + var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + var b64chs = Array.prototype.slice.call(b64ch); + var b64tab = (function(a) { + var tab = {}; + a.forEach(function(c, i) { + return tab[c] = i; + }); + return tab; + })(b64chs); + var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; + var _fromCC = String.fromCharCode.bind(String); + var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : function(it) { + return new Uint8Array(Array.prototype.slice.call(it, 0)); + }; + var _mkUriSafe = function(src) { + return src.replace(/=/g, "").replace(/[+\/]/g, function(m0) { + return m0 == "+" ? "-" : "_"; + }); + }; + var _tidyB64 = function(s) { + return s.replace(/[^A-Za-z0-9\+\/]/g, ""); + }; + var btoaPolyfill = function(bin) { + var u322, c0, c1, c2, asc = ""; + var pad = bin.length % 3; + for (var i = 0; i < bin.length; ) { + if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255) + throw new TypeError("invalid character found"); + u322 = c0 << 16 | c1 << 8 | c2; + asc += b64chs[u322 >> 18 & 63] + b64chs[u322 >> 12 & 63] + b64chs[u322 >> 6 & 63] + b64chs[u322 & 63]; + } + return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc; + }; + var _btoa = typeof btoa === "function" ? function(bin) { + return btoa(bin); + } : btoaPolyfill; + var _fromUint8Array = typeof Uint8Array.prototype.toBase64 === "function" ? function(u8a) { + return u8a.toBase64(); + } : function(u8a) { + var maxargs = 4096; + var strs = []; + for (var i = 0, l = u8a.length; i < l; i += maxargs) { + strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); + } + return _btoa(strs.join("")); + }; + var fromUint8Array = function(u8a, urlsafe) { + if (urlsafe === void 0) { + urlsafe = false; + } + return urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); + }; + var cb_utob = function(c) { + if (c.length < 2) { + var cc = c.charCodeAt(0); + return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63); + } else { + var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320); + return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63); + } + }; + var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\x00-\x7F]/g; + var utob = function(u) { + return u.replace(re_utob, cb_utob); + }; + var _encode3 = _TE ? function(s) { + return _fromUint8Array(_TE.encode(s)); + } : function(s) { + return _btoa(utob(s)); + }; + var encode3 = function(src, urlsafe) { + if (urlsafe === void 0) { + urlsafe = false; + } + return urlsafe ? _mkUriSafe(_encode3(src)) : _encode3(src); + }; + var encodeURI = function(src) { + return encode3(src, true); + }; + var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; + var cb_btou = function(cccc) { + switch (cccc.length) { + case 4: + var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536; + return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320); + case 3: + return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2)); + default: + return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1)); + } + }; + var btou = function(b) { + return b.replace(re_btou, cb_btou); + }; + var atobPolyfill = function(asc) { + asc = asc.replace(/\s+/g, ""); + if (!b64re.test(asc)) + throw new TypeError("malformed base64."); + asc += "==".slice(2 - (asc.length & 3)); + var u24, r1, r2; + var binArray = []; + for (var i = 0; i < asc.length; ) { + u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]); + if (r1 === 64) { + binArray.push(_fromCC(u24 >> 16 & 255)); + } else if (r2 === 64) { + binArray.push(_fromCC(u24 >> 16 & 255, u24 >> 8 & 255)); + } else { + binArray.push(_fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255)); + } + } + return binArray.join(""); + }; + var _atob = typeof atob === "function" ? function(asc) { + return atob(_tidyB64(asc)); + } : atobPolyfill; + var _toUint8Array = typeof Uint8Array.fromBase64 === "function" ? function(a) { + return Uint8Array.fromBase64(a); + } : function(a) { + return _U8Afrom(_atob(a).split("").map(function(c) { + return c.charCodeAt(0); + })); + }; + var toUint8Array = function(a) { + return _toUint8Array(_unURI(a)); + }; + var _decode3 = _TD ? function(a) { + return _TD.decode(_toUint8Array(a)); + } : function(a) { + return btou(_atob(a)); + }; + var _unURI = function(a) { + return _tidyB64(a.replace(/[-_]/g, function(m0) { + return m0 == "-" ? "+" : "/"; + })); + }; + var decode3 = function(src) { + return _decode3(_unURI(src)); + }; + var isValid = function(src) { + if (typeof src !== "string") + return false; + var s = src.replace(/\s+/g, "").replace(/={0,2}$/, ""); + return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s); + }; + var _noEnum = function(v) { + return { + value: v, + enumerable: false, + writable: true, + configurable: true + }; + }; + var extendString = function() { + var _add = function(name, body) { + return Object.defineProperty(String.prototype, name, _noEnum(body)); + }; + _add("fromBase64", function() { + return decode3(this); + }); + _add("toBase64", function(urlsafe) { + return encode3(this, urlsafe); + }); + _add("toBase64URI", function() { + return encode3(this, true); + }); + _add("toBase64URL", function() { + return encode3(this, true); + }); + _add("toUint8Array", function() { + return toUint8Array(this); + }); + }; + var extendUint8Array = function() { + var _add = function(name, body) { + return Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); + }; + _add("toBase64", function(urlsafe) { + return fromUint8Array(this, urlsafe); + }); + _add("toBase64URI", function() { + return fromUint8Array(this, true); + }); + _add("toBase64URL", function() { + return fromUint8Array(this, true); + }); + }; + var extendBuiltins = function() { + extendString(); + extendUint8Array(); + }; + var gBase64 = { + version: version2, + VERSION, + atob: _atob, + atobPolyfill, + btoa: _btoa, + btoaPolyfill, + fromBase64: decode3, + toBase64: encode3, + encode: encode3, + encodeURI, + encodeURL: encodeURI, + utob, + btou, + decode: decode3, + isValid, + fromUint8Array, + toUint8Array, + extendString, + extendUint8Array, + extendBuiltins + }; + exports3.Base64 = gBase64; + exports3.VERSION = VERSION; + exports3.atob = _atob; + exports3.atobPolyfill = atobPolyfill; + exports3.btoa = _btoa; + exports3.btoaPolyfill = btoaPolyfill; + exports3.btou = btou; + exports3.decode = decode3; + exports3.encode = encode3; + exports3.encodeURI = encodeURI; + exports3.encodeURL = encodeURI; + exports3.extendBuiltins = extendBuiltins; + exports3.extendString = extendString; + exports3.extendUint8Array = extendUint8Array; + exports3.fromBase64 = decode3; + exports3.fromUint8Array = fromUint8Array; + exports3.isValid = isValid; + exports3.toBase64 = encode3; + exports3.toUint8Array = toUint8Array; + exports3.utob = utob; + exports3.version = version2; + })); + } +}); + +// node_modules/requires-port/index.js +var require_requires_port = __commonJS({ + "node_modules/requires-port/index.js"(exports2, module2) { + "use strict"; + module2.exports = function required2(port, protocol) { + protocol = protocol.split(":")[0]; + port = +port; + if (!port) return false; + switch (protocol) { + case "http": + case "ws": + return port !== 80; + case "https": + case "wss": + return port !== 443; + case "ftp": + return port !== 21; + case "gopher": + return port !== 70; + case "file": + return false; + } + return port !== 0; + }; + } +}); + +// node_modules/querystringify/index.js +var require_querystringify = __commonJS({ + "node_modules/querystringify/index.js"(exports2) { + "use strict"; + var has = Object.prototype.hasOwnProperty; + var undef; + function decode3(input3) { + try { + return decodeURIComponent(input3.replace(/\+/g, " ")); + } catch (e) { + return null; + } + } + function encode3(input3) { + try { + return encodeURIComponent(input3); + } catch (e) { + return null; + } + } + function querystring(query) { + var parser = /([^=?#&]+)=?([^&]*)/g, result = {}, part; + while (part = parser.exec(query)) { + var key = decode3(part[1]), value2 = decode3(part[2]); + if (key === null || value2 === null || key in result) continue; + result[key] = value2; + } + return result; + } + function querystringify(obj, prefix) { + prefix = prefix || ""; + var pairs = [], value2, key; + if ("string" !== typeof prefix) prefix = "?"; + for (key in obj) { + if (has.call(obj, key)) { + value2 = obj[key]; + if (!value2 && (value2 === null || value2 === undef || isNaN(value2))) { + value2 = ""; + } + key = encode3(key); + value2 = encode3(value2); + if (key === null || value2 === null) continue; + pairs.push(key + "=" + value2); + } + } + return pairs.length ? prefix + pairs.join("&") : ""; + } + exports2.stringify = querystringify; + exports2.parse = querystring; + } +}); + +// node_modules/url-parse/index.js +var require_url_parse = __commonJS({ + "node_modules/url-parse/index.js"(exports2, module2) { + "use strict"; + var required2 = require_requires_port(); + var qs = require_querystringify(); + var controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/; + var CRHTLF = /[\n\r\t]/g; + var slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//; + var port = /:\d+$/; + var protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i; + var windowsDriveLetter = /^[a-zA-Z]:/; + function trimLeft(str) { + return (str ? str : "").toString().replace(controlOrWhitespace, ""); + } + var rules = [ + ["#", "hash"], + // Extract from the back. + ["?", "query"], + // Extract from the back. + function sanitize(address, url) { + return isSpecial(url.protocol) ? address.replace(/\\/g, "/") : address; + }, + ["/", "pathname"], + // Extract from the back. + ["@", "auth", 1], + // Extract from the front. + [NaN, "host", void 0, 1, 1], + // Set left over value. + [/:(\d*)$/, "port", void 0, 1], + // RegExp the back. + [NaN, "hostname", void 0, 1, 1] + // Set left over. + ]; + var ignore = { hash: 1, query: 1 }; + function lolcation(loc) { + var globalVar; + if (typeof window !== "undefined") globalVar = window; + else if (typeof global !== "undefined") globalVar = global; + else if (typeof self !== "undefined") globalVar = self; + else globalVar = {}; + var location = globalVar.location || {}; + loc = loc || location; + var finaldestination = {}, type = typeof loc, key; + if ("blob:" === loc.protocol) { + finaldestination = new Url(unescape(loc.pathname), {}); + } else if ("string" === type) { + finaldestination = new Url(loc, {}); + for (key in ignore) delete finaldestination[key]; + } else if ("object" === type) { + for (key in loc) { + if (key in ignore) continue; + finaldestination[key] = loc[key]; + } + if (finaldestination.slashes === void 0) { + finaldestination.slashes = slashes.test(loc.href); + } + } + return finaldestination; + } + function isSpecial(scheme) { + return scheme === "file:" || scheme === "ftp:" || scheme === "http:" || scheme === "https:" || scheme === "ws:" || scheme === "wss:"; + } + function extractProtocol(address, location) { + address = trimLeft(address); + address = address.replace(CRHTLF, ""); + location = location || {}; + var match = protocolre.exec(address); + var protocol = match[1] ? match[1].toLowerCase() : ""; + var forwardSlashes = !!match[2]; + var otherSlashes = !!match[3]; + var slashesCount = 0; + var rest; + if (forwardSlashes) { + if (otherSlashes) { + rest = match[2] + match[3] + match[4]; + slashesCount = match[2].length + match[3].length; + } else { + rest = match[2] + match[4]; + slashesCount = match[2].length; + } + } else { + if (otherSlashes) { + rest = match[3] + match[4]; + slashesCount = match[3].length; + } else { + rest = match[4]; + } + } + if (protocol === "file:") { + if (slashesCount >= 2) { + rest = rest.slice(2); + } + } else if (isSpecial(protocol)) { + rest = match[4]; + } else if (protocol) { + if (forwardSlashes) { + rest = rest.slice(2); + } + } else if (slashesCount >= 2 && isSpecial(location.protocol)) { + rest = match[4]; + } + return { + protocol, + slashes: forwardSlashes || isSpecial(protocol), + slashesCount, + rest + }; + } + function resolve41(relative29, base) { + if (relative29 === "") return base; + var path = (base || "/").split("/").slice(0, -1).concat(relative29.split("/")), i = path.length, last = path[i - 1], unshift = false, up = 0; + while (i--) { + if (path[i] === ".") { + path.splice(i, 1); + } else if (path[i] === "..") { + path.splice(i, 1); + up++; + } else if (up) { + if (i === 0) unshift = true; + path.splice(i, 1); + up--; + } + } + if (unshift) path.unshift(""); + if (last === "." || last === "..") path.push(""); + return path.join("/"); + } + function Url(address, location, parser) { + address = trimLeft(address); + address = address.replace(CRHTLF, ""); + if (!(this instanceof Url)) { + return new Url(address, location, parser); + } + var relative29, extracted, parse4, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0; + if ("object" !== type && "string" !== type) { + parser = location; + location = null; + } + if (parser && "function" !== typeof parser) parser = qs.parse; + location = lolcation(location); + extracted = extractProtocol(address || "", location); + relative29 = !extracted.protocol && !extracted.slashes; + url.slashes = extracted.slashes || relative29 && location.slashes; + url.protocol = extracted.protocol || location.protocol || ""; + address = extracted.rest; + if (extracted.protocol === "file:" && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) { + instructions[3] = [/(.*)/, "pathname"]; + } + for (; i < instructions.length; i++) { + instruction = instructions[i]; + if (typeof instruction === "function") { + address = instruction(address, url); + continue; + } + parse4 = instruction[0]; + key = instruction[1]; + if (parse4 !== parse4) { + url[key] = address; + } else if ("string" === typeof parse4) { + index = parse4 === "@" ? address.lastIndexOf(parse4) : address.indexOf(parse4); + if (~index) { + if ("number" === typeof instruction[2]) { + url[key] = address.slice(0, index); + address = address.slice(index + instruction[2]); + } else { + url[key] = address.slice(index); + address = address.slice(0, index); + } + } + } else if (index = parse4.exec(address)) { + url[key] = index[1]; + address = address.slice(0, index.index); + } + url[key] = url[key] || (relative29 && instruction[3] ? location[key] || "" : ""); + if (instruction[4]) url[key] = url[key].toLowerCase(); + } + if (parser) url.query = parser(url.query); + if (relative29 && location.slashes && url.pathname.charAt(0) !== "/" && (url.pathname !== "" || location.pathname !== "")) { + url.pathname = resolve41(url.pathname, location.pathname); + } + if (url.pathname.charAt(0) !== "/" && isSpecial(url.protocol)) { + url.pathname = "/" + url.pathname; + } + if (!required2(url.port, url.protocol)) { + url.host = url.hostname; + url.port = ""; + } + url.username = url.password = ""; + if (url.auth) { + index = url.auth.indexOf(":"); + if (~index) { + url.username = url.auth.slice(0, index); + url.username = encodeURIComponent(decodeURIComponent(url.username)); + url.password = url.auth.slice(index + 1); + url.password = encodeURIComponent(decodeURIComponent(url.password)); + } else { + url.username = encodeURIComponent(decodeURIComponent(url.auth)); + } + url.auth = url.password ? url.username + ":" + url.password : url.username; + } + url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null"; + url.href = url.toString(); + } + function set(part, value2, fn) { + var url = this; + switch (part) { + case "query": + if ("string" === typeof value2 && value2.length) { + value2 = (fn || qs.parse)(value2); + } + url[part] = value2; + break; + case "port": + url[part] = value2; + if (!required2(value2, url.protocol)) { + url.host = url.hostname; + url[part] = ""; + } else if (value2) { + url.host = url.hostname + ":" + value2; + } + break; + case "hostname": + url[part] = value2; + if (url.port) value2 += ":" + url.port; + url.host = value2; + break; + case "host": + url[part] = value2; + if (port.test(value2)) { + value2 = value2.split(":"); + url.port = value2.pop(); + url.hostname = value2.join(":"); + } else { + url.hostname = value2; + url.port = ""; + } + break; + case "protocol": + url.protocol = value2.toLowerCase(); + url.slashes = !fn; + break; + case "pathname": + case "hash": + if (value2) { + var char = part === "pathname" ? "/" : "#"; + url[part] = value2.charAt(0) !== char ? char + value2 : value2; + } else { + url[part] = value2; + } + break; + case "username": + case "password": + url[part] = encodeURIComponent(value2); + break; + case "auth": + var index = value2.indexOf(":"); + if (~index) { + url.username = value2.slice(0, index); + url.username = encodeURIComponent(decodeURIComponent(url.username)); + url.password = value2.slice(index + 1); + url.password = encodeURIComponent(decodeURIComponent(url.password)); + } else { + url.username = encodeURIComponent(decodeURIComponent(value2)); + } + } + for (var i = 0; i < rules.length; i++) { + var ins = rules[i]; + if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase(); + } + url.auth = url.password ? url.username + ":" + url.password : url.username; + url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null"; + url.href = url.toString(); + return url; + } + function toString(stringify2) { + if (!stringify2 || "function" !== typeof stringify2) stringify2 = qs.stringify; + var query, url = this, host = url.host, protocol = url.protocol; + if (protocol && protocol.charAt(protocol.length - 1) !== ":") protocol += ":"; + var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? "//" : ""); + if (url.username) { + result += url.username; + if (url.password) result += ":" + url.password; + result += "@"; + } else if (url.password) { + result += ":" + url.password; + result += "@"; + } else if (url.protocol !== "file:" && isSpecial(url.protocol) && !host && url.pathname !== "/") { + result += "@"; + } + if (host[host.length - 1] === ":" || port.test(url.hostname) && !url.port) { + host += ":"; + } + result += host + url.pathname; + query = "object" === typeof url.query ? stringify2(url.query) : url.query; + if (query) result += "?" !== query.charAt(0) ? "?" + query : query; + if (url.hash) result += url.hash; + return result; + } + Url.prototype = { set, toString }; + Url.extractProtocol = extractProtocol; + Url.location = lolcation; + Url.trimLeft = trimLeft; + Url.qs = qs; + module2.exports = Url; + } +}); + +// node_modules/tus-js-client/lib.es5/uuid.js +var require_uuid = __commonJS({ + "node_modules/tus-js-client/lib.es5/uuid.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = uuid3; + function uuid3() { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { + var r = Math.random() * 16 | 0; + var v = c === "x" ? r : r & 3 | 8; + return v.toString(16); + }); + } + } +}); + +// node_modules/tus-js-client/lib.es5/upload.js +var require_upload = __commonJS({ + "node_modules/tus-js-client/lib.es5/upload.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _jsBase = require_base64(); + var _urlParse = _interopRequireDefault(require_url_parse()); + var _error = _interopRequireDefault(require_error()); + var _logger = require_logger(); + var _uuid2 = _interopRequireDefault(require_uuid()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + function _regeneratorRuntime() { + "use strict"; + _regeneratorRuntime = function _regeneratorRuntime2() { + return e; + }; + var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) { + t2[e2] = r2.value; + }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; + function define2(t2, e2, r2) { + return Object.defineProperty(t2, e2, { + value: r2, + enumerable: true, + configurable: true, + writable: true + }), t2[e2]; + } + try { + define2({}, ""); + } catch (t2) { + define2 = function define3(t3, e2, r2) { + return t3[e2] = r2; + }; + } + function wrap(t2, e2, r2, n2) { + var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []); + return o(a2, "_invoke", { + value: makeInvokeMethod(t2, r2, c2) + }), a2; + } + function tryCatch(t2, e2, r2) { + try { + return { + type: "normal", + arg: t2.call(e2, r2) + }; + } catch (t3) { + return { + type: "throw", + arg: t3 + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; + function Generator() { + } + function GeneratorFunction() { + } + function GeneratorFunctionPrototype() { + } + var p = {}; + define2(p, a, function() { + return this; + }); + var d = Object.getPrototypeOf, v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t2) { + ["next", "throw", "return"].forEach(function(e2) { + define2(t2, e2, function(t3) { + return this._invoke(e2, t3); + }); + }); + } + function AsyncIterator(t2, e2) { + function invoke(r3, o2, i2, a2) { + var c2 = tryCatch(t2[r3], t2, o2); + if ("throw" !== c2.type) { + var u2 = c2.arg, h2 = u2.value; + return h2 && "object" == _typeof(h2) && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) { + invoke("next", t3, i2, a2); + }, function(t3) { + invoke("throw", t3, i2, a2); + }) : e2.resolve(h2).then(function(t3) { + u2.value = t3, i2(u2); + }, function(t3) { + return invoke("throw", t3, i2, a2); + }); + } + a2(c2.arg); + } + var r2; + o(this, "_invoke", { + value: function value2(t3, n2) { + function callInvokeWithMethodAndArg() { + return new e2(function(e3, r3) { + invoke(t3, n2, e3, r3); + }); + } + return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e2, r2, n2) { + var o2 = h; + return function(i2, a2) { + if (o2 === f) throw Error("Generator is already running"); + if (o2 === s) { + if ("throw" === i2) throw a2; + return { + value: t, + done: true + }; + } + for (n2.method = i2, n2.arg = a2; ; ) { + var c2 = n2.delegate; + if (c2) { + var u2 = maybeInvokeDelegate(c2, n2); + if (u2) { + if (u2 === y) continue; + return u2; + } + } + if ("next" === n2.method) n2.sent = n2._sent = n2.arg; + else if ("throw" === n2.method) { + if (o2 === h) throw o2 = s, n2.arg; + n2.dispatchException(n2.arg); + } else "return" === n2.method && n2.abrupt("return", n2.arg); + o2 = f; + var p2 = tryCatch(e2, r2, n2); + if ("normal" === p2.type) { + if (o2 = n2.done ? s : l, p2.arg === y) continue; + return { + value: p2.arg, + done: n2.done + }; + } + "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg); + } + }; + } + function maybeInvokeDelegate(e2, r2) { + var n2 = r2.method, o2 = e2.iterator[n2]; + if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator["return"] && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y; + var i2 = tryCatch(o2, e2.iterator, r2.arg); + if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y; + var a2 = i2.arg; + return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y); + } + function pushTryEntry(t2) { + var e2 = { + tryLoc: t2[0] + }; + 1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2); + } + function resetTryEntry(t2) { + var e2 = t2.completion || {}; + e2.type = "normal", delete e2.arg, t2.completion = e2; + } + function Context(t2) { + this.tryEntries = [{ + tryLoc: "root" + }], t2.forEach(pushTryEntry, this), this.reset(true); + } + function values(e2) { + if (e2 || "" === e2) { + var r2 = e2[a]; + if (r2) return r2.call(e2); + if ("function" == typeof e2.next) return e2; + if (!isNaN(e2.length)) { + var o2 = -1, i2 = function next() { + for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next; + return next.value = t, next.done = true, next; + }; + return i2.next = i2; + } + } + throw new TypeError(_typeof(e2) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: true + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: true + }), GeneratorFunction.displayName = define2(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) { + var e2 = "function" == typeof t2 && t2.constructor; + return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name)); + }, e.mark = function(t2) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define2(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2; + }, e.awrap = function(t2) { + return { + __await: t2 + }; + }, defineIteratorMethods(AsyncIterator.prototype), define2(AsyncIterator.prototype, c, function() { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) { + void 0 === i2 && (i2 = Promise); + var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2); + return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) { + return t3.done ? t3.value : a2.next(); + }); + }, defineIteratorMethods(g), define2(g, u, "Generator"), define2(g, a, function() { + return this; + }), define2(g, "toString", function() { + return "[object Generator]"; + }), e.keys = function(t2) { + var e2 = Object(t2), r2 = []; + for (var n2 in e2) r2.push(n2); + return r2.reverse(), function next() { + for (; r2.length; ) { + var t3 = r2.pop(); + if (t3 in e2) return next.value = t3, next.done = false, next; + } + return next.done = true, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e2) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t); + }, + stop: function stop() { + this.done = true; + var t2 = this.tryEntries[0].completion; + if ("throw" === t2.type) throw t2.arg; + return this.rval; + }, + dispatchException: function dispatchException(e2) { + if (this.done) throw e2; + var r2 = this; + function handle(n2, o3) { + return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3; + } + for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) { + var i2 = this.tryEntries[o2], a2 = i2.completion; + if ("root" === i2.tryLoc) return handle("end"); + if (i2.tryLoc <= this.prev) { + var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc"); + if (c2 && u2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } else if (c2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + } else { + if (!u2) throw Error("try statement without catch or finally"); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t2, e2) { + for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) { + var o2 = this.tryEntries[r2]; + if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) { + var i2 = o2; + break; + } + } + i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null); + var a2 = i2 ? i2.completion : {}; + return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2); + }, + complete: function complete(t2, e2) { + if ("throw" === t2.type) throw t2.arg; + return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y; + }, + finish: function finish(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y; + } + }, + "catch": function _catch2(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.tryLoc === t2) { + var n2 = r2.completion; + if ("throw" === n2.type) { + var o2 = n2.arg; + resetTryEntry(r2); + } + return o2; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e2, r2, n2) { + return this.delegate = { + iterator: values(e2), + resultName: r2, + nextLoc: n2 + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function asyncGeneratorStep(gen, resolve41, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value2 = info.value; + } catch (error2) { + reject(error2); + return; + } + if (info.done) { + resolve41(value2); + } else { + Promise.resolve(value2).then(_next, _throw); + } + } + function _asyncToGenerator(fn) { + return function() { + var self2 = this, args = arguments; + return new Promise(function(resolve41, reject) { + var gen = fn.apply(self2, args); + function _next(value2) { + asyncGeneratorStep(gen, resolve41, reject, _next, _throw, "next", value2); + } + function _throw(err2) { + asyncGeneratorStep(gen, resolve41, reject, _next, _throw, "throw", err2); + } + _next(void 0); + }); + }; + } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, n, i, u, a = [], f = true, o = false; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = false; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ; + } catch (r2) { + o = true, n = r2; + } finally { + try { + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _createForOfIteratorHelper(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (!it) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + var F = function F2() { + }; + return { + s: F, + n: function n() { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function e(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var normalCompletion = true, didErr = false, err2; + return { + s: function s() { + it = it.call(o); + }, + n: function n() { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function e(_e2) { + didErr = true; + err2 = _e2; + }, + f: function f() { + try { + if (!normalCompletion && it["return"] != null) it["return"](); + } finally { + if (didErr) throw err2; + } + } + }; + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { + _defineProperty(e, r2, t[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); + }); + } + return e; + } + function _defineProperty(obj, key, value2) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value2, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value2; + } + return obj; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var PROTOCOL_TUS_V1 = "tus-v1"; + var PROTOCOL_IETF_DRAFT_03 = "ietf-draft-03"; + var PROTOCOL_IETF_DRAFT_05 = "ietf-draft-05"; + var defaultOptions = { + endpoint: null, + uploadUrl: null, + metadata: {}, + metadataForPartialUploads: {}, + fingerprint: null, + uploadSize: null, + onProgress: null, + onChunkComplete: null, + onSuccess: null, + onError: null, + onUploadUrlAvailable: null, + overridePatchMethod: false, + headers: {}, + addRequestId: false, + onBeforeRequest: null, + onAfterResponse: null, + onShouldRetry: defaultOnShouldRetry, + chunkSize: Number.POSITIVE_INFINITY, + retryDelays: [0, 1e3, 3e3, 5e3], + parallelUploads: 1, + parallelUploadBoundaries: null, + storeFingerprintForResuming: true, + removeFingerprintOnSuccess: false, + uploadLengthDeferred: false, + uploadDataDuringCreation: false, + urlStorage: null, + fileReader: null, + httpStack: null, + protocol: PROTOCOL_TUS_V1 + }; + var BaseUpload = /* @__PURE__ */ (function() { + function BaseUpload2(file, options) { + _classCallCheck(this, BaseUpload2); + if ("resume" in options) { + console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."); + } + this.options = options; + this.options.chunkSize = Number(this.options.chunkSize); + this._urlStorage = this.options.urlStorage; + this.file = file; + this.url = null; + this._req = null; + this._fingerprint = null; + this._urlStorageKey = null; + this._offset = null; + this._aborted = false; + this._size = null; + this._source = null; + this._retryAttempt = 0; + this._retryTimeout = null; + this._offsetBeforeRetry = 0; + this._parallelUploads = null; + this._parallelUploadUrls = null; + } + return _createClass(BaseUpload2, [{ + key: "findPreviousUploads", + value: function findPreviousUploads() { + var _this = this; + return this.options.fingerprint(this.file, this.options).then(function(fingerprint) { + return _this._urlStorage.findUploadsByFingerprint(fingerprint); + }); + } + }, { + key: "resumeFromPreviousUpload", + value: function resumeFromPreviousUpload(previousUpload) { + this.url = previousUpload.uploadUrl || null; + this._parallelUploadUrls = previousUpload.parallelUploadUrls || null; + this._urlStorageKey = previousUpload.urlStorageKey; + } + }, { + key: "start", + value: function start() { + var _this2 = this; + var file = this.file; + if (!file) { + this._emitError(new Error("tus: no file or stream to upload provided")); + return; + } + if (![PROTOCOL_TUS_V1, PROTOCOL_IETF_DRAFT_03, PROTOCOL_IETF_DRAFT_05].includes(this.options.protocol)) { + this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol))); + return; + } + if (!this.options.endpoint && !this.options.uploadUrl && !this.url) { + this._emitError(new Error("tus: neither an endpoint or an upload URL is provided")); + return; + } + var retryDelays = this.options.retryDelays; + if (retryDelays != null && Object.prototype.toString.call(retryDelays) !== "[object Array]") { + this._emitError(new Error("tus: the `retryDelays` option must either be an array or null")); + return; + } + if (this.options.parallelUploads > 1) { + for (var _i = 0, _arr = ["uploadUrl", "uploadSize", "uploadLengthDeferred"]; _i < _arr.length; _i++) { + var optionName = _arr[_i]; + if (this.options[optionName]) { + this._emitError(new Error("tus: cannot use the ".concat(optionName, " option when parallelUploads is enabled"))); + return; + } + } + } + if (this.options.parallelUploadBoundaries) { + if (this.options.parallelUploads <= 1) { + this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled")); + return; + } + if (this.options.parallelUploads !== this.options.parallelUploadBoundaries.length) { + this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`")); + return; + } + } + this.options.fingerprint(file, this.options).then(function(fingerprint) { + if (fingerprint == null) { + (0, _logger.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."); + } else { + (0, _logger.log)("Calculated fingerprint: ".concat(fingerprint)); + } + _this2._fingerprint = fingerprint; + if (_this2._source) { + return _this2._source; + } + return _this2.options.fileReader.openFile(file, _this2.options.chunkSize); + }).then(function(source) { + _this2._source = source; + if (_this2.options.uploadLengthDeferred) { + _this2._size = null; + } else if (_this2.options.uploadSize != null) { + _this2._size = Number(_this2.options.uploadSize); + if (Number.isNaN(_this2._size)) { + _this2._emitError(new Error("tus: cannot convert `uploadSize` option into a number")); + return; + } + } else { + _this2._size = _this2._source.size; + if (_this2._size == null) { + _this2._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option")); + return; + } + } + if (_this2.options.parallelUploads > 1 || _this2._parallelUploadUrls != null) { + _this2._startParallelUpload(); + } else { + _this2._startSingleUpload(); + } + })["catch"](function(err2) { + _this2._emitError(err2); + }); + } + /** + * Initiate the uploading procedure for a parallelized upload, where one file is split into + * multiple request which are run in parallel. + * + * @api private + */ + }, { + key: "_startParallelUpload", + value: function _startParallelUpload() { + var _this$options$paralle, _this3 = this; + var totalSize = this._size; + var totalProgress = 0; + this._parallelUploads = []; + var partCount = this._parallelUploadUrls != null ? this._parallelUploadUrls.length : this.options.parallelUploads; + var parts = (_this$options$paralle = this.options.parallelUploadBoundaries) !== null && _this$options$paralle !== void 0 ? _this$options$paralle : splitSizeIntoParts(this._source.size, partCount); + if (this._parallelUploadUrls) { + parts.forEach(function(part, index) { + part.uploadUrl = _this3._parallelUploadUrls[index] || null; + }); + } + this._parallelUploadUrls = new Array(parts.length); + var uploads = parts.map(function(part, index) { + var lastPartProgress = 0; + return _this3._source.slice(part.start, part.end).then(function(_ref) { + var value2 = _ref.value; + return new Promise(function(resolve41, reject) { + var options = _objectSpread(_objectSpread({}, _this3.options), {}, { + // If available, the partial upload should be resumed from a previous URL. + uploadUrl: part.uploadUrl || null, + // We take manually care of resuming for partial uploads, so they should + // not be stored in the URL storage. + storeFingerprintForResuming: false, + removeFingerprintOnSuccess: false, + // Reset the parallelUploads option to not cause recursion. + parallelUploads: 1, + // Reset this option as we are not doing a parallel upload. + parallelUploadBoundaries: null, + metadata: _this3.options.metadataForPartialUploads, + // Add the header to indicate the this is a partial upload. + headers: _objectSpread(_objectSpread({}, _this3.options.headers), {}, { + "Upload-Concat": "partial" + }), + // Reject or resolve the promise if the upload errors or completes. + onSuccess: resolve41, + onError: reject, + // Based in the progress for this partial upload, calculate the progress + // for the entire final upload. + onProgress: function onProgress(newPartProgress) { + totalProgress = totalProgress - lastPartProgress + newPartProgress; + lastPartProgress = newPartProgress; + _this3._emitProgress(totalProgress, totalSize); + }, + // Wait until every partial upload has an upload URL, so we can add + // them to the URL storage. + onUploadUrlAvailable: function onUploadUrlAvailable() { + _this3._parallelUploadUrls[index] = upload.url; + if (_this3._parallelUploadUrls.filter(function(u) { + return Boolean(u); + }).length === parts.length) { + _this3._saveUploadInUrlStorage(); + } + } + }); + var upload = new BaseUpload2(value2, options); + upload.start(); + _this3._parallelUploads.push(upload); + }); + }); + }); + var req; + Promise.all(uploads).then(function() { + req = _this3._openRequest("POST", _this3.options.endpoint); + req.setHeader("Upload-Concat", "final;".concat(_this3._parallelUploadUrls.join(" "))); + var metadata = encodeMetadata(_this3.options.metadata); + if (metadata !== "") { + req.setHeader("Upload-Metadata", metadata); + } + return _this3._sendRequest(req, null); + }).then(function(res) { + if (!inStatusCategory(res.getStatus(), 200)) { + _this3._emitHttpError(req, res, "tus: unexpected response while creating upload"); + return; + } + var location = res.getHeader("Location"); + if (location == null) { + _this3._emitHttpError(req, res, "tus: invalid or missing Location header"); + return; + } + _this3.url = resolveUrl(_this3.options.endpoint, location); + (0, _logger.log)("Created upload at ".concat(_this3.url)); + _this3._emitSuccess(res); + })["catch"](function(err2) { + _this3._emitError(err2); + }); + } + /** + * Initiate the uploading procedure for a non-parallel upload. Here the entire file is + * uploaded in a sequential matter. + * + * @api private + */ + }, { + key: "_startSingleUpload", + value: function _startSingleUpload() { + this._aborted = false; + if (this.url != null) { + (0, _logger.log)("Resuming upload from previous URL: ".concat(this.url)); + this._resumeUpload(); + return; + } + if (this.options.uploadUrl != null) { + (0, _logger.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)); + this.url = this.options.uploadUrl; + this._resumeUpload(); + return; + } + (0, _logger.log)("Creating a new upload"); + this._createUpload(); + } + /** + * Abort any running request and stop the current upload. After abort is called, no event + * handler will be invoked anymore. You can use the `start` method to resume the upload + * again. + * If `shouldTerminate` is true, the `terminate` function will be called to remove the + * current upload from the server. + * + * @param {boolean} shouldTerminate True if the upload should be deleted from the server. + * @return {Promise} The Promise will be resolved/rejected when the requests finish. + */ + }, { + key: "abort", + value: function abort(shouldTerminate) { + var _this4 = this; + if (this._parallelUploads != null) { + var _iterator = _createForOfIteratorHelper(this._parallelUploads), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var upload = _step.value; + upload.abort(shouldTerminate); + } + } catch (err2) { + _iterator.e(err2); + } finally { + _iterator.f(); + } + } + if (this._req !== null) { + this._req.abort(); + } + this._aborted = true; + if (this._retryTimeout != null) { + clearTimeout(this._retryTimeout); + this._retryTimeout = null; + } + if (!shouldTerminate || this.url == null) { + return Promise.resolve(); + } + return BaseUpload2.terminate(this.url, this.options).then(function() { + return _this4._removeFromUrlStorage(); + }); + } + }, { + key: "_emitHttpError", + value: function _emitHttpError(req, res, message, causingErr) { + this._emitError(new _error.default(message, causingErr, req, res)); + } + }, { + key: "_emitError", + value: function _emitError(err2) { + var _this5 = this; + if (this._aborted) return; + if (this.options.retryDelays != null) { + var shouldResetDelays = this._offset != null && this._offset > this._offsetBeforeRetry; + if (shouldResetDelays) { + this._retryAttempt = 0; + } + if (shouldRetry(err2, this._retryAttempt, this.options)) { + var delay = this.options.retryDelays[this._retryAttempt++]; + this._offsetBeforeRetry = this._offset; + this._retryTimeout = setTimeout(function() { + _this5.start(); + }, delay); + return; + } + } + if (typeof this.options.onError === "function") { + this.options.onError(err2); + } else { + throw err2; + } + } + /** + * Publishes notification if the upload has been successfully completed. + * + * @param {object} lastResponse Last HTTP response. + * @api private + */ + }, { + key: "_emitSuccess", + value: function _emitSuccess(lastResponse) { + if (this.options.removeFingerprintOnSuccess) { + this._removeFromUrlStorage(); + } + if (typeof this.options.onSuccess === "function") { + this.options.onSuccess({ + lastResponse + }); + } + } + /** + * Publishes notification when data has been sent to the server. This + * data may not have been accepted by the server yet. + * + * @param {number} bytesSent Number of bytes sent to the server. + * @param {number} bytesTotal Total number of bytes to be sent to the server. + * @api private + */ + }, { + key: "_emitProgress", + value: function _emitProgress(bytesSent, bytesTotal) { + if (typeof this.options.onProgress === "function") { + this.options.onProgress(bytesSent, bytesTotal); + } + } + /** + * Publishes notification when a chunk of data has been sent to the server + * and accepted by the server. + * @param {number} chunkSize Size of the chunk that was accepted by the server. + * @param {number} bytesAccepted Total number of bytes that have been + * accepted by the server. + * @param {number} bytesTotal Total number of bytes to be sent to the server. + * @api private + */ + }, { + key: "_emitChunkComplete", + value: function _emitChunkComplete(chunkSize, bytesAccepted, bytesTotal) { + if (typeof this.options.onChunkComplete === "function") { + this.options.onChunkComplete(chunkSize, bytesAccepted, bytesTotal); + } + } + /** + * Create a new upload using the creation extension by sending a POST + * request to the endpoint. After successful creation the file will be + * uploaded + * + * @api private + */ + }, { + key: "_createUpload", + value: function _createUpload() { + var _this6 = this; + if (!this.options.endpoint) { + this._emitError(new Error("tus: unable to create upload because no endpoint is provided")); + return; + } + var req = this._openRequest("POST", this.options.endpoint); + if (this.options.uploadLengthDeferred) { + req.setHeader("Upload-Defer-Length", "1"); + } else { + req.setHeader("Upload-Length", "".concat(this._size)); + } + var metadata = encodeMetadata(this.options.metadata); + if (metadata !== "") { + req.setHeader("Upload-Metadata", metadata); + } + var promise; + if (this.options.uploadDataDuringCreation && !this.options.uploadLengthDeferred) { + this._offset = 0; + promise = this._addChunkToRequest(req); + } else { + if (this.options.protocol === PROTOCOL_IETF_DRAFT_03 || this.options.protocol === PROTOCOL_IETF_DRAFT_05) { + req.setHeader("Upload-Complete", "?0"); + } + promise = this._sendRequest(req, null); + } + promise.then(function(res) { + if (!inStatusCategory(res.getStatus(), 200)) { + _this6._emitHttpError(req, res, "tus: unexpected response while creating upload"); + return; + } + var location = res.getHeader("Location"); + if (location == null) { + _this6._emitHttpError(req, res, "tus: invalid or missing Location header"); + return; + } + _this6.url = resolveUrl(_this6.options.endpoint, location); + (0, _logger.log)("Created upload at ".concat(_this6.url)); + if (typeof _this6.options.onUploadUrlAvailable === "function") { + _this6.options.onUploadUrlAvailable(); + } + if (_this6._size === 0) { + _this6._emitSuccess(res); + _this6._source.close(); + return; + } + _this6._saveUploadInUrlStorage().then(function() { + if (_this6.options.uploadDataDuringCreation) { + _this6._handleUploadResponse(req, res); + } else { + _this6._offset = 0; + _this6._performUpload(); + } + }); + })["catch"](function(err2) { + _this6._emitHttpError(req, null, "tus: failed to create upload", err2); + }); + } + /* + * Try to resume an existing upload. First a HEAD request will be sent + * to retrieve the offset. If the request fails a new upload will be + * created. In the case of a successful response the file will be uploaded. + * + * @api private + */ + }, { + key: "_resumeUpload", + value: function _resumeUpload() { + var _this7 = this; + var req = this._openRequest("HEAD", this.url); + var promise = this._sendRequest(req, null); + promise.then(function(res) { + var status = res.getStatus(); + if (!inStatusCategory(status, 200)) { + if (status === 423) { + _this7._emitHttpError(req, res, "tus: upload is currently locked; retry later"); + return; + } + if (inStatusCategory(status, 400)) { + _this7._removeFromUrlStorage(); + } + if (!_this7.options.endpoint) { + _this7._emitHttpError(req, res, "tus: unable to resume upload (new upload cannot be created without an endpoint)"); + return; + } + _this7.url = null; + _this7._createUpload(); + return; + } + var offset = Number.parseInt(res.getHeader("Upload-Offset"), 10); + if (Number.isNaN(offset)) { + _this7._emitHttpError(req, res, "tus: invalid or missing offset value"); + return; + } + var length = Number.parseInt(res.getHeader("Upload-Length"), 10); + if (Number.isNaN(length) && !_this7.options.uploadLengthDeferred && _this7.options.protocol === PROTOCOL_TUS_V1) { + _this7._emitHttpError(req, res, "tus: invalid or missing length value"); + return; + } + if (typeof _this7.options.onUploadUrlAvailable === "function") { + _this7.options.onUploadUrlAvailable(); + } + _this7._saveUploadInUrlStorage().then(function() { + if (offset === length) { + _this7._emitProgress(length, length); + _this7._emitSuccess(res); + return; + } + _this7._offset = offset; + _this7._performUpload(); + }); + })["catch"](function(err2) { + _this7._emitHttpError(req, null, "tus: failed to resume upload", err2); + }); + } + /** + * Start uploading the file using PATCH requests. The file will be divided + * into chunks as specified in the chunkSize option. During the upload + * the onProgress event handler may be invoked multiple times. + * + * @api private + */ + }, { + key: "_performUpload", + value: function _performUpload() { + var _this8 = this; + if (this._aborted) { + return; + } + var req; + if (this.options.overridePatchMethod) { + req = this._openRequest("POST", this.url); + req.setHeader("X-HTTP-Method-Override", "PATCH"); + } else { + req = this._openRequest("PATCH", this.url); + } + req.setHeader("Upload-Offset", "".concat(this._offset)); + var promise = this._addChunkToRequest(req); + promise.then(function(res) { + if (!inStatusCategory(res.getStatus(), 200)) { + _this8._emitHttpError(req, res, "tus: unexpected response while uploading chunk"); + return; + } + _this8._handleUploadResponse(req, res); + })["catch"](function(err2) { + if (_this8._aborted) { + return; + } + _this8._emitHttpError(req, null, "tus: failed to upload chunk at offset ".concat(_this8._offset), err2); + }); + } + /** + * _addChunktoRequest reads a chunk from the source and sends it using the + * supplied request object. It will not handle the response. + * + * @api private + */ + }, { + key: "_addChunkToRequest", + value: function _addChunkToRequest(req) { + var _this9 = this; + var start = this._offset; + var end = this._offset + this.options.chunkSize; + req.setProgressHandler(function(bytesSent) { + _this9._emitProgress(start + bytesSent, _this9._size); + }); + if (this.options.protocol === PROTOCOL_TUS_V1) { + req.setHeader("Content-Type", "application/offset+octet-stream"); + } else if (this.options.protocol === PROTOCOL_IETF_DRAFT_05) { + req.setHeader("Content-Type", "application/partial-upload"); + } + if ((end === Number.POSITIVE_INFINITY || end > this._size) && !this.options.uploadLengthDeferred) { + end = this._size; + } + return this._source.slice(start, end).then(function(_ref2) { + var value2 = _ref2.value, done = _ref2.done; + var valueSize = value2 !== null && value2 !== void 0 && value2.size ? value2.size : 0; + if (_this9.options.uploadLengthDeferred && done) { + _this9._size = _this9._offset + valueSize; + req.setHeader("Upload-Length", "".concat(_this9._size)); + } + var newSize = _this9._offset + valueSize; + if (!_this9.options.uploadLengthDeferred && done && newSize !== _this9._size) { + return Promise.reject(new Error("upload was configured with a size of ".concat(_this9._size, " bytes, but the source is done after ").concat(newSize, " bytes"))); + } + if (value2 === null) { + return _this9._sendRequest(req); + } + if (_this9.options.protocol === PROTOCOL_IETF_DRAFT_03 || _this9.options.protocol === PROTOCOL_IETF_DRAFT_05) { + req.setHeader("Upload-Complete", done ? "?1" : "?0"); + } + _this9._emitProgress(_this9._offset, _this9._size); + return _this9._sendRequest(req, value2); + }); + } + /** + * _handleUploadResponse is used by requests that haven been sent using _addChunkToRequest + * and already have received a response. + * + * @api private + */ + }, { + key: "_handleUploadResponse", + value: function _handleUploadResponse(req, res) { + var offset = Number.parseInt(res.getHeader("Upload-Offset"), 10); + if (Number.isNaN(offset)) { + this._emitHttpError(req, res, "tus: invalid or missing offset value"); + return; + } + this._emitProgress(offset, this._size); + this._emitChunkComplete(offset - this._offset, offset, this._size); + this._offset = offset; + if (offset === this._size) { + this._emitSuccess(res); + this._source.close(); + return; + } + this._performUpload(); + } + /** + * Create a new HTTP request object with the given method and URL. + * + * @api private + */ + }, { + key: "_openRequest", + value: function _openRequest(method, url) { + var req = openRequest(method, url, this.options); + this._req = req; + return req; + } + /** + * Remove the entry in the URL storage, if it has been saved before. + * + * @api private + */ + }, { + key: "_removeFromUrlStorage", + value: function _removeFromUrlStorage() { + var _this10 = this; + if (!this._urlStorageKey) return; + this._urlStorage.removeUpload(this._urlStorageKey)["catch"](function(err2) { + _this10._emitError(err2); + }); + this._urlStorageKey = null; + } + /** + * Add the upload URL to the URL storage, if possible. + * + * @api private + */ + }, { + key: "_saveUploadInUrlStorage", + value: function _saveUploadInUrlStorage() { + var _this11 = this; + if (!this.options.storeFingerprintForResuming || !this._fingerprint || this._urlStorageKey !== null) { + return Promise.resolve(); + } + var storedUpload = { + size: this._size, + metadata: this.options.metadata, + creationTime: (/* @__PURE__ */ new Date()).toString() + }; + if (this._parallelUploads) { + storedUpload.parallelUploadUrls = this._parallelUploadUrls; + } else { + storedUpload.uploadUrl = this.url; + } + return this._urlStorage.addUpload(this._fingerprint, storedUpload).then(function(urlStorageKey) { + _this11._urlStorageKey = urlStorageKey; + }); + } + /** + * Send a request with the provided body. + * + * @api private + */ + }, { + key: "_sendRequest", + value: function _sendRequest(req) { + var body = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + return sendRequest(req, body, this.options); + } + }], [{ + key: "terminate", + value: function terminate(url) { + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + var req = openRequest("DELETE", url, options); + return sendRequest(req, null, options).then(function(res) { + if (res.getStatus() === 204) { + return; + } + throw new _error.default("tus: unexpected response while terminating upload", null, req, res); + })["catch"](function(err2) { + if (!(err2 instanceof _error.default)) { + err2 = new _error.default("tus: failed to terminate upload", err2, req, null); + } + if (!shouldRetry(err2, 0, options)) { + throw err2; + } + var delay = options.retryDelays[0]; + var remainingDelays = options.retryDelays.slice(1); + var newOptions = _objectSpread(_objectSpread({}, options), {}, { + retryDelays: remainingDelays + }); + return new Promise(function(resolve41) { + return setTimeout(resolve41, delay); + }).then(function() { + return BaseUpload2.terminate(url, newOptions); + }); + }); + } + }]); + })(); + function encodeMetadata(metadata) { + return Object.entries(metadata).map(function(_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], value2 = _ref4[1]; + return "".concat(key, " ").concat(_jsBase.Base64.encode(String(value2))); + }).join(","); + } + function inStatusCategory(status, category) { + return status >= category && status < category + 100; + } + function openRequest(method, url, options) { + var req = options.httpStack.createRequest(method, url); + if (options.protocol === PROTOCOL_IETF_DRAFT_03) { + req.setHeader("Upload-Draft-Interop-Version", "5"); + } else if (options.protocol === PROTOCOL_IETF_DRAFT_05) { + req.setHeader("Upload-Draft-Interop-Version", "6"); + } else { + req.setHeader("Tus-Resumable", "1.0.0"); + } + var headers = options.headers || {}; + for (var _i2 = 0, _Object$entries = Object.entries(headers); _i2 < _Object$entries.length; _i2++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2), name = _Object$entries$_i[0], value2 = _Object$entries$_i[1]; + req.setHeader(name, value2); + } + if (options.addRequestId) { + var requestId = (0, _uuid2.default)(); + req.setHeader("X-Request-ID", requestId); + } + return req; + } + function sendRequest(_x, _x2, _x3) { + return _sendRequest2.apply(this, arguments); + } + function _sendRequest2() { + _sendRequest2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(req, body, options) { + var res; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + if (!(typeof options.onBeforeRequest === "function")) { + _context.next = 3; + break; + } + _context.next = 3; + return options.onBeforeRequest(req); + case 3: + _context.next = 5; + return req.send(body); + case 5: + res = _context.sent; + if (!(typeof options.onAfterResponse === "function")) { + _context.next = 9; + break; + } + _context.next = 9; + return options.onAfterResponse(req, res); + case 9: + return _context.abrupt("return", res); + case 10: + case "end": + return _context.stop(); + } + }, _callee); + })); + return _sendRequest2.apply(this, arguments); + } + function isOnline() { + var online = true; + if (typeof navigator !== "undefined" && navigator.onLine === false) { + online = false; + } + return online; + } + function shouldRetry(err2, retryAttempt, options) { + if (options.retryDelays == null || retryAttempt >= options.retryDelays.length || err2.originalRequest == null) { + return false; + } + if (options && typeof options.onShouldRetry === "function") { + return options.onShouldRetry(err2, retryAttempt, options); + } + return defaultOnShouldRetry(err2); + } + function defaultOnShouldRetry(err2) { + var status = err2.originalResponse ? err2.originalResponse.getStatus() : 0; + return (!inStatusCategory(status, 400) || status === 409 || status === 423) && isOnline(); + } + function resolveUrl(origin, link2) { + return new _urlParse.default(link2, origin).toString(); + } + function splitSizeIntoParts(totalSize, partCount) { + var partSize = Math.floor(totalSize / partCount); + var parts = []; + for (var i = 0; i < partCount; i++) { + parts.push({ + start: partSize * i, + end: partSize * (i + 1) + }); + } + parts[partCount - 1].end = totalSize; + return parts; + } + BaseUpload.defaultOptions = defaultOptions; + var _default2 = exports2.default = BaseUpload; + } +}); + +// node_modules/is-stream/index.js +var require_is_stream = __commonJS({ + "node_modules/is-stream/index.js"(exports2, module2) { + "use strict"; + var isStream = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function"; + isStream.writable = (stream) => isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object"; + isStream.readable = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object"; + isStream.duplex = (stream) => isStream.writable(stream) && isStream.readable(stream); + isStream.transform = (stream) => isStream.duplex(stream) && typeof stream._transform === "function"; + module2.exports = isStream; + } +}); + +// node_modules/tus-js-client/lib.es5/node/sources/BufferSource.js +var require_BufferSource = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/sources/BufferSource.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var BufferSource = exports2.default = /* @__PURE__ */ (function() { + function BufferSource2(buffer) { + _classCallCheck(this, BufferSource2); + this._buffer = buffer; + this.size = buffer.length; + } + return _createClass(BufferSource2, [{ + key: "slice", + value: function slice(start, end) { + var value2 = this._buffer.slice(start, end); + value2.size = value2.length; + var done = end >= this.size; + return Promise.resolve({ + value: value2, + done + }); + } + }, { + key: "close", + value: function close() { + } + }]); + })(); + } +}); + +// node_modules/tus-js-client/lib.es5/node/sources/FileSource.js +var require_FileSource = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/sources/FileSource.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = getFileSource; + var _fs = require("fs"); + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _regeneratorRuntime() { + "use strict"; + _regeneratorRuntime = function _regeneratorRuntime2() { + return e; + }; + var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) { + t2[e2] = r2.value; + }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; + function define2(t2, e2, r2) { + return Object.defineProperty(t2, e2, { + value: r2, + enumerable: true, + configurable: true, + writable: true + }), t2[e2]; + } + try { + define2({}, ""); + } catch (t2) { + define2 = function define3(t3, e2, r2) { + return t3[e2] = r2; + }; + } + function wrap(t2, e2, r2, n2) { + var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []); + return o(a2, "_invoke", { + value: makeInvokeMethod(t2, r2, c2) + }), a2; + } + function tryCatch(t2, e2, r2) { + try { + return { + type: "normal", + arg: t2.call(e2, r2) + }; + } catch (t3) { + return { + type: "throw", + arg: t3 + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; + function Generator() { + } + function GeneratorFunction() { + } + function GeneratorFunctionPrototype() { + } + var p = {}; + define2(p, a, function() { + return this; + }); + var d = Object.getPrototypeOf, v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t2) { + ["next", "throw", "return"].forEach(function(e2) { + define2(t2, e2, function(t3) { + return this._invoke(e2, t3); + }); + }); + } + function AsyncIterator(t2, e2) { + function invoke(r3, o2, i2, a2) { + var c2 = tryCatch(t2[r3], t2, o2); + if ("throw" !== c2.type) { + var u2 = c2.arg, h2 = u2.value; + return h2 && "object" == _typeof(h2) && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) { + invoke("next", t3, i2, a2); + }, function(t3) { + invoke("throw", t3, i2, a2); + }) : e2.resolve(h2).then(function(t3) { + u2.value = t3, i2(u2); + }, function(t3) { + return invoke("throw", t3, i2, a2); + }); + } + a2(c2.arg); + } + var r2; + o(this, "_invoke", { + value: function value2(t3, n2) { + function callInvokeWithMethodAndArg() { + return new e2(function(e3, r3) { + invoke(t3, n2, e3, r3); + }); + } + return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e2, r2, n2) { + var o2 = h; + return function(i2, a2) { + if (o2 === f) throw Error("Generator is already running"); + if (o2 === s) { + if ("throw" === i2) throw a2; + return { + value: t, + done: true + }; + } + for (n2.method = i2, n2.arg = a2; ; ) { + var c2 = n2.delegate; + if (c2) { + var u2 = maybeInvokeDelegate(c2, n2); + if (u2) { + if (u2 === y) continue; + return u2; + } + } + if ("next" === n2.method) n2.sent = n2._sent = n2.arg; + else if ("throw" === n2.method) { + if (o2 === h) throw o2 = s, n2.arg; + n2.dispatchException(n2.arg); + } else "return" === n2.method && n2.abrupt("return", n2.arg); + o2 = f; + var p2 = tryCatch(e2, r2, n2); + if ("normal" === p2.type) { + if (o2 = n2.done ? s : l, p2.arg === y) continue; + return { + value: p2.arg, + done: n2.done + }; + } + "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg); + } + }; + } + function maybeInvokeDelegate(e2, r2) { + var n2 = r2.method, o2 = e2.iterator[n2]; + if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator["return"] && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y; + var i2 = tryCatch(o2, e2.iterator, r2.arg); + if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y; + var a2 = i2.arg; + return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y); + } + function pushTryEntry(t2) { + var e2 = { + tryLoc: t2[0] + }; + 1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2); + } + function resetTryEntry(t2) { + var e2 = t2.completion || {}; + e2.type = "normal", delete e2.arg, t2.completion = e2; + } + function Context(t2) { + this.tryEntries = [{ + tryLoc: "root" + }], t2.forEach(pushTryEntry, this), this.reset(true); + } + function values(e2) { + if (e2 || "" === e2) { + var r2 = e2[a]; + if (r2) return r2.call(e2); + if ("function" == typeof e2.next) return e2; + if (!isNaN(e2.length)) { + var o2 = -1, i2 = function next() { + for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next; + return next.value = t, next.done = true, next; + }; + return i2.next = i2; + } + } + throw new TypeError(_typeof(e2) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: true + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: true + }), GeneratorFunction.displayName = define2(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) { + var e2 = "function" == typeof t2 && t2.constructor; + return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name)); + }, e.mark = function(t2) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define2(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2; + }, e.awrap = function(t2) { + return { + __await: t2 + }; + }, defineIteratorMethods(AsyncIterator.prototype), define2(AsyncIterator.prototype, c, function() { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) { + void 0 === i2 && (i2 = Promise); + var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2); + return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) { + return t3.done ? t3.value : a2.next(); + }); + }, defineIteratorMethods(g), define2(g, u, "Generator"), define2(g, a, function() { + return this; + }), define2(g, "toString", function() { + return "[object Generator]"; + }), e.keys = function(t2) { + var e2 = Object(t2), r2 = []; + for (var n2 in e2) r2.push(n2); + return r2.reverse(), function next() { + for (; r2.length; ) { + var t3 = r2.pop(); + if (t3 in e2) return next.value = t3, next.done = false, next; + } + return next.done = true, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e2) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t); + }, + stop: function stop() { + this.done = true; + var t2 = this.tryEntries[0].completion; + if ("throw" === t2.type) throw t2.arg; + return this.rval; + }, + dispatchException: function dispatchException(e2) { + if (this.done) throw e2; + var r2 = this; + function handle(n2, o3) { + return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3; + } + for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) { + var i2 = this.tryEntries[o2], a2 = i2.completion; + if ("root" === i2.tryLoc) return handle("end"); + if (i2.tryLoc <= this.prev) { + var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc"); + if (c2 && u2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } else if (c2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + } else { + if (!u2) throw Error("try statement without catch or finally"); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t2, e2) { + for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) { + var o2 = this.tryEntries[r2]; + if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) { + var i2 = o2; + break; + } + } + i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null); + var a2 = i2 ? i2.completion : {}; + return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2); + }, + complete: function complete(t2, e2) { + if ("throw" === t2.type) throw t2.arg; + return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y; + }, + finish: function finish(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y; + } + }, + "catch": function _catch2(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.tryLoc === t2) { + var n2 = r2.completion; + if ("throw" === n2.type) { + var o2 = n2.arg; + resetTryEntry(r2); + } + return o2; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e2, r2, n2) { + return this.delegate = { + iterator: values(e2), + resultName: r2, + nextLoc: n2 + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function asyncGeneratorStep(gen, resolve41, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value2 = info.value; + } catch (error2) { + reject(error2); + return; + } + if (info.done) { + resolve41(value2); + } else { + Promise.resolve(value2).then(_next, _throw); + } + } + function _asyncToGenerator(fn) { + return function() { + var self2 = this, args = arguments; + return new Promise(function(resolve41, reject) { + var gen = fn.apply(self2, args); + function _next(value2) { + asyncGeneratorStep(gen, resolve41, reject, _next, _throw, "next", value2); + } + function _throw(err2) { + asyncGeneratorStep(gen, resolve41, reject, _next, _throw, "throw", err2); + } + _next(void 0); + }); + }; + } + function getFileSource(_x) { + return _getFileSource.apply(this, arguments); + } + function _getFileSource() { + _getFileSource = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(stream) { + var _stream$start; + var path, _yield$fsPromises$sta, size, start, end, actualSize; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + path = stream.path.toString(); + _context.next = 3; + return _fs.promises.stat(path); + case 3: + _yield$fsPromises$sta = _context.sent; + size = _yield$fsPromises$sta.size; + start = (_stream$start = stream.start) !== null && _stream$start !== void 0 ? _stream$start : 0; + end = Number.isFinite(stream.end) ? stream.end + 1 : size; + actualSize = end - start; + return _context.abrupt("return", new FileSource(stream, path, actualSize)); + case 9: + case "end": + return _context.stop(); + } + }, _callee); + })); + return _getFileSource.apply(this, arguments); + } + var FileSource = /* @__PURE__ */ (function() { + function FileSource2(stream, path, size) { + _classCallCheck(this, FileSource2); + this._stream = stream; + this._path = path; + this.size = size; + } + return _createClass(FileSource2, [{ + key: "slice", + value: function slice(start, end) { + var _this$_stream$start; + var offset = (_this$_stream$start = this._stream.start) !== null && _this$_stream$start !== void 0 ? _this$_stream$start : 0; + var stream = (0, _fs.createReadStream)(this._path, { + start: offset + start, + // The `end` option for createReadStream is treated inclusively + // (see https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options). + // However, the Buffer#slice(start, end) and also our Source#slice(start, end) + // method treat the end range exclusively, so we have to subtract 1. + // This prevents an off-by-one error when reporting upload progress. + end: offset + end - 1, + autoClose: true + }); + stream.size = Math.min(end - start, this.size); + var done = stream.size >= this.size; + return Promise.resolve({ + value: stream, + done + }); + } + }, { + key: "close", + value: function close() { + this._stream.destroy(); + } + }]); + })(); + } +}); + +// node_modules/tus-js-client/lib.es5/node/sources/StreamSource.js +var require_StreamSource = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/sources/StreamSource.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _regeneratorRuntime() { + "use strict"; + _regeneratorRuntime = function _regeneratorRuntime2() { + return e; + }; + var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) { + t2[e2] = r2.value; + }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; + function define2(t2, e2, r2) { + return Object.defineProperty(t2, e2, { + value: r2, + enumerable: true, + configurable: true, + writable: true + }), t2[e2]; + } + try { + define2({}, ""); + } catch (t2) { + define2 = function define3(t3, e2, r2) { + return t3[e2] = r2; + }; + } + function wrap(t2, e2, r2, n2) { + var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []); + return o(a2, "_invoke", { + value: makeInvokeMethod(t2, r2, c2) + }), a2; + } + function tryCatch(t2, e2, r2) { + try { + return { + type: "normal", + arg: t2.call(e2, r2) + }; + } catch (t3) { + return { + type: "throw", + arg: t3 + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; + function Generator() { + } + function GeneratorFunction() { + } + function GeneratorFunctionPrototype() { + } + var p = {}; + define2(p, a, function() { + return this; + }); + var d = Object.getPrototypeOf, v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t2) { + ["next", "throw", "return"].forEach(function(e2) { + define2(t2, e2, function(t3) { + return this._invoke(e2, t3); + }); + }); + } + function AsyncIterator(t2, e2) { + function invoke(r3, o2, i2, a2) { + var c2 = tryCatch(t2[r3], t2, o2); + if ("throw" !== c2.type) { + var u2 = c2.arg, h2 = u2.value; + return h2 && "object" == _typeof(h2) && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) { + invoke("next", t3, i2, a2); + }, function(t3) { + invoke("throw", t3, i2, a2); + }) : e2.resolve(h2).then(function(t3) { + u2.value = t3, i2(u2); + }, function(t3) { + return invoke("throw", t3, i2, a2); + }); + } + a2(c2.arg); + } + var r2; + o(this, "_invoke", { + value: function value2(t3, n2) { + function callInvokeWithMethodAndArg() { + return new e2(function(e3, r3) { + invoke(t3, n2, e3, r3); + }); + } + return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e2, r2, n2) { + var o2 = h; + return function(i2, a2) { + if (o2 === f) throw Error("Generator is already running"); + if (o2 === s) { + if ("throw" === i2) throw a2; + return { + value: t, + done: true + }; + } + for (n2.method = i2, n2.arg = a2; ; ) { + var c2 = n2.delegate; + if (c2) { + var u2 = maybeInvokeDelegate(c2, n2); + if (u2) { + if (u2 === y) continue; + return u2; + } + } + if ("next" === n2.method) n2.sent = n2._sent = n2.arg; + else if ("throw" === n2.method) { + if (o2 === h) throw o2 = s, n2.arg; + n2.dispatchException(n2.arg); + } else "return" === n2.method && n2.abrupt("return", n2.arg); + o2 = f; + var p2 = tryCatch(e2, r2, n2); + if ("normal" === p2.type) { + if (o2 = n2.done ? s : l, p2.arg === y) continue; + return { + value: p2.arg, + done: n2.done + }; + } + "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg); + } + }; + } + function maybeInvokeDelegate(e2, r2) { + var n2 = r2.method, o2 = e2.iterator[n2]; + if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator["return"] && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y; + var i2 = tryCatch(o2, e2.iterator, r2.arg); + if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y; + var a2 = i2.arg; + return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y); + } + function pushTryEntry(t2) { + var e2 = { + tryLoc: t2[0] + }; + 1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2); + } + function resetTryEntry(t2) { + var e2 = t2.completion || {}; + e2.type = "normal", delete e2.arg, t2.completion = e2; + } + function Context(t2) { + this.tryEntries = [{ + tryLoc: "root" + }], t2.forEach(pushTryEntry, this), this.reset(true); + } + function values(e2) { + if (e2 || "" === e2) { + var r2 = e2[a]; + if (r2) return r2.call(e2); + if ("function" == typeof e2.next) return e2; + if (!isNaN(e2.length)) { + var o2 = -1, i2 = function next() { + for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next; + return next.value = t, next.done = true, next; + }; + return i2.next = i2; + } + } + throw new TypeError(_typeof(e2) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: true + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: true + }), GeneratorFunction.displayName = define2(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) { + var e2 = "function" == typeof t2 && t2.constructor; + return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name)); + }, e.mark = function(t2) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define2(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2; + }, e.awrap = function(t2) { + return { + __await: t2 + }; + }, defineIteratorMethods(AsyncIterator.prototype), define2(AsyncIterator.prototype, c, function() { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) { + void 0 === i2 && (i2 = Promise); + var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2); + return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) { + return t3.done ? t3.value : a2.next(); + }); + }, defineIteratorMethods(g), define2(g, u, "Generator"), define2(g, a, function() { + return this; + }), define2(g, "toString", function() { + return "[object Generator]"; + }), e.keys = function(t2) { + var e2 = Object(t2), r2 = []; + for (var n2 in e2) r2.push(n2); + return r2.reverse(), function next() { + for (; r2.length; ) { + var t3 = r2.pop(); + if (t3 in e2) return next.value = t3, next.done = false, next; + } + return next.done = true, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e2) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t); + }, + stop: function stop() { + this.done = true; + var t2 = this.tryEntries[0].completion; + if ("throw" === t2.type) throw t2.arg; + return this.rval; + }, + dispatchException: function dispatchException(e2) { + if (this.done) throw e2; + var r2 = this; + function handle(n2, o3) { + return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3; + } + for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) { + var i2 = this.tryEntries[o2], a2 = i2.completion; + if ("root" === i2.tryLoc) return handle("end"); + if (i2.tryLoc <= this.prev) { + var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc"); + if (c2 && u2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } else if (c2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + } else { + if (!u2) throw Error("try statement without catch or finally"); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t2, e2) { + for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) { + var o2 = this.tryEntries[r2]; + if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) { + var i2 = o2; + break; + } + } + i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null); + var a2 = i2 ? i2.completion : {}; + return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2); + }, + complete: function complete(t2, e2) { + if ("throw" === t2.type) throw t2.arg; + return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y; + }, + finish: function finish(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y; + } + }, + "catch": function _catch2(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.tryLoc === t2) { + var n2 = r2.completion; + if ("throw" === n2.type) { + var o2 = n2.arg; + resetTryEntry(r2); + } + return o2; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e2, r2, n2) { + return this.delegate = { + iterator: values(e2), + resultName: r2, + nextLoc: n2 + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function asyncGeneratorStep(gen, resolve41, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value2 = info.value; + } catch (error2) { + reject(error2); + return; + } + if (info.done) { + resolve41(value2); + } else { + Promise.resolve(value2).then(_next, _throw); + } + } + function _asyncToGenerator(fn) { + return function() { + var self2 = this, args = arguments; + return new Promise(function(resolve41, reject) { + var gen = fn.apply(self2, args); + function _next(value2) { + asyncGeneratorStep(gen, resolve41, reject, _next, _throw, "next", value2); + } + function _throw(err2) { + asyncGeneratorStep(gen, resolve41, reject, _next, _throw, "throw", err2); + } + _next(void 0); + }); + }; + } + function readChunk(_x, _x2) { + return _readChunk.apply(this, arguments); + } + function _readChunk() { + _readChunk = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(stream, size) { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + return _context2.abrupt("return", new Promise(function(resolve41, reject) { + var onError = function onError2(err2) { + stream.off("readable", onReadable); + reject(err2); + }; + var onReadable = function onReadable2() { + var chunk = stream.read(size); + if (chunk !== null) { + stream.off("error", onError); + stream.off("readable", onReadable2); + resolve41(chunk); + } + }; + stream.once("error", onError); + stream.on("readable", onReadable); + })); + case 1: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + return _readChunk.apply(this, arguments); + } + var StreamSource = exports2.default = /* @__PURE__ */ (function() { + function StreamSource2(stream) { + var _this = this; + _classCallCheck(this, StreamSource2); + this._stream = stream; + this.size = null; + this._buf = Buffer.alloc(0); + this._bufPos = 0; + this._ended = false; + this._error = null; + stream.pause(); + stream.on("end", function() { + _this._ended = true; + }); + stream.on("error", function(err2) { + _this._error = err2; + }); + } + return _createClass(StreamSource2, [{ + key: "slice", + value: (function() { + var _slice = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(start, end) { + var returnBuffer, bufStart, bufEnd, requestedSize, newChunk; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + if (!(start < this._bufPos)) { + _context.next = 2; + break; + } + throw new Error("cannot slice from position which we already seeked away"); + case 2: + if (!(start > this._bufPos + this._buf.length)) { + _context.next = 4; + break; + } + throw new Error("slice start is outside of buffer (currently not implemented)"); + case 4: + if (!this._error) { + _context.next = 6; + break; + } + throw this._error; + case 6: + if (start < this._bufPos + this._buf.length) { + bufStart = start - this._bufPos; + bufEnd = Math.min(this._buf.length, end - this._bufPos); + returnBuffer = this._buf.slice(bufStart, bufEnd); + } else { + returnBuffer = Buffer.alloc(0); + } + if (!this._ended) { + _context.next = 10; + break; + } + returnBuffer.size = returnBuffer.length; + return _context.abrupt("return", { + value: returnBuffer, + done: true + }); + case 10: + requestedSize = end - start; + if (!(requestedSize > returnBuffer.length)) { + _context.next = 16; + break; + } + _context.next = 14; + return readChunk(this._stream, requestedSize - returnBuffer.length); + case 14: + newChunk = _context.sent; + returnBuffer = Buffer.concat([returnBuffer, newChunk]); + case 16: + this._buf = returnBuffer; + this._bufPos = start; + returnBuffer.size = returnBuffer.length; + return _context.abrupt("return", { + value: returnBuffer, + done: this._ended + }); + case 20: + case "end": + return _context.stop(); + } + }, _callee, this); + })); + function slice(_x3, _x4) { + return _slice.apply(this, arguments); + } + return slice; + })() + }, { + key: "close", + value: function close() { + this._stream.destroy(); + } + }]); + })(); + } +}); + +// node_modules/tus-js-client/lib.es5/node/fileReader.js +var require_fileReader = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/fileReader.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var _fs = require("fs"); + var _isStream = _interopRequireDefault(require_is_stream()); + var _BufferSource = _interopRequireDefault(require_BufferSource()); + var _FileSource = _interopRequireDefault(require_FileSource()); + var _StreamSource = _interopRequireDefault(require_StreamSource()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var FileReader = exports2.default = /* @__PURE__ */ (function() { + function FileReader2() { + _classCallCheck(this, FileReader2); + } + return _createClass(FileReader2, [{ + key: "openFile", + value: function openFile(input3, chunkSize) { + if (Buffer.isBuffer(input3)) { + return Promise.resolve(new _BufferSource.default(input3)); + } + if (input3 instanceof _fs.ReadStream && input3.path != null) { + return (0, _FileSource.default)(input3); + } + if (_isStream.default.readable(input3)) { + chunkSize = Number(chunkSize); + if (!Number.isFinite(chunkSize)) { + return Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption")); + } + return Promise.resolve(new _StreamSource.default(input3)); + } + return Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment")); + } + }]); + })(); + } +}); + +// node_modules/tus-js-client/lib.es5/node/fileSignature.js +var require_fileSignature = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/fileSignature.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = fingerprint; + var _crypto = require("crypto"); + var fs = _interopRequireWildcard(require("fs")); + var path = _interopRequireWildcard(require("path")); + function _getRequireWildcardCache(e) { + if ("function" != typeof WeakMap) return null; + var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(); + return (_getRequireWildcardCache = function(e2) { + return e2 ? t : r; + })(e); + } + function _interopRequireWildcard(e, r) { + if (!r && e && e.__esModule) return e; + if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; + var t = _getRequireWildcardCache(r); + if (t && t.has(e)) return t.get(e); + var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { + var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; + i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; + } + return n.default = e, t && t.set(e, n), n; + } + function fingerprint(file, options) { + if (Buffer.isBuffer(file)) { + var blockSize = 64 * 1024; + var content = file.slice(0, Math.min(blockSize, file.length)); + var hash3 = (0, _crypto.createHash)("md5").update(content).digest("hex"); + var ret = ["node-buffer", hash3, file.length, options.endpoint].join("-"); + return Promise.resolve(ret); + } + if (file instanceof fs.ReadStream && file.path != null) { + return new Promise(function(resolve41, reject) { + var name = path.resolve(file.path); + fs.stat(file.path, function(err2, info) { + if (err2) { + reject(err2); + return; + } + var ret2 = ["node-file", name, info.size, info.mtime.getTime(), options.endpoint].join("-"); + resolve41(ret2); + }); + }); + } + return Promise.resolve(null); + } + } +}); + +// node_modules/lodash.throttle/index.js +var require_lodash = __commonJS({ + "node_modules/lodash.throttle/index.js"(exports2, module2) { + var FUNC_ERROR_TEXT = "Expected a function"; + var NAN = 0 / 0; + var symbolTag = "[object Symbol]"; + var reTrim = /^\s+|\s+$/g; + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + var reIsBinary = /^0b[01]+$/i; + var reIsOctal = /^0o[0-7]+$/i; + var freeParseInt = parseInt; + var freeGlobal = typeof global == "object" && global && global.Object === Object && global; + var freeSelf = typeof self == "object" && self && self.Object === Object && self; + var root = freeGlobal || freeSelf || Function("return this")(); + var objectProto = Object.prototype; + var objectToString = objectProto.toString; + var nativeMax = Math.max; + var nativeMin = Math.min; + var now = function() { + return root.Date.now(); + }; + function debounce(func, wait, options) { + var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; + if (typeof func != "function") { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject3(options)) { + leading = !!options.leading; + maxing = "maxWait" in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = "trailing" in options ? !!options.trailing : trailing; + } + function invokeFunc(time3) { + var args = lastArgs, thisArg = lastThis; + lastArgs = lastThis = void 0; + lastInvokeTime = time3; + result = func.apply(thisArg, args); + return result; + } + function leadingEdge(time3) { + lastInvokeTime = time3; + timerId = setTimeout(timerExpired, wait); + return leading ? invokeFunc(time3) : result; + } + function remainingWait(time3) { + var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime, result2 = wait - timeSinceLastCall; + return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2; + } + function shouldInvoke(time3) { + var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime; + return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; + } + function timerExpired() { + var time3 = now(); + if (shouldInvoke(time3)) { + return trailingEdge(time3); + } + timerId = setTimeout(timerExpired, remainingWait(time3)); + } + function trailingEdge(time3) { + timerId = void 0; + if (trailing && lastArgs) { + return invokeFunc(time3); + } + lastArgs = lastThis = void 0; + return result; + } + function cancel() { + if (timerId !== void 0) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = void 0; + } + function flush() { + return timerId === void 0 ? result : trailingEdge(now()); + } + function debounced() { + var time3 = now(), isInvoking = shouldInvoke(time3); + lastArgs = arguments; + lastThis = this; + lastCallTime = time3; + if (isInvoking) { + if (timerId === void 0) { + return leadingEdge(lastCallTime); + } + if (maxing) { + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === void 0) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + function throttle(func, wait, options) { + var leading = true, trailing = true; + if (typeof func != "function") { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject3(options)) { + leading = "leading" in options ? !!options.leading : leading; + trailing = "trailing" in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + "leading": leading, + "maxWait": wait, + "trailing": trailing + }); + } + function isObject3(value2) { + var type = typeof value2; + return !!value2 && (type == "object" || type == "function"); + } + function isObjectLike(value2) { + return !!value2 && typeof value2 == "object"; + } + function isSymbol(value2) { + return typeof value2 == "symbol" || isObjectLike(value2) && objectToString.call(value2) == symbolTag; + } + function toNumber(value2) { + if (typeof value2 == "number") { + return value2; + } + if (isSymbol(value2)) { + return NAN; + } + if (isObject3(value2)) { + var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2; + value2 = isObject3(other) ? other + "" : other; + } + if (typeof value2 != "string") { + return value2 === 0 ? value2 : +value2; + } + value2 = value2.replace(reTrim, ""); + var isBinary = reIsBinary.test(value2); + return isBinary || reIsOctal.test(value2) ? freeParseInt(value2.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value2) ? NAN : +value2; + } + module2.exports = throttle; + } +}); + +// node_modules/tus-js-client/lib.es5/node/httpStack.js +var require_httpStack = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/httpStack.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = void 0; + var http = _interopRequireWildcard(require("http")); + var https = _interopRequireWildcard(require("https")); + var _stream = require("stream"); + var _url2 = require("url"); + var _lodash = _interopRequireDefault(require_lodash()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + function _getRequireWildcardCache(e) { + if ("function" != typeof WeakMap) return null; + var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(); + return (_getRequireWildcardCache = function(e2) { + return e2 ? t : r; + })(e); + } + function _interopRequireWildcard(e, r) { + if (!r && e && e.__esModule) return e; + if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; + var t = _getRequireWildcardCache(r); + if (t && t.has(e)) return t.get(e); + var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { + var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; + i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; + } + return n.default = e, t && t.set(e, n), n; + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _possibleConstructorReturn(self2, call) { + if (call && (_typeof(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return _assertThisInitialized(self2); + } + function _assertThisInitialized(self2) { + if (self2 === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self2; + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + } catch (t2) { + } + return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() { + return !!t; + })(); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { + return o2.__proto__ || Object.getPrototypeOf(o2); + }; + return _getPrototypeOf(o); + } + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { + o2.__proto__ = p2; + return o2; + }; + return _setPrototypeOf(o, p); + } + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { + _defineProperty(e, r2, t[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); + }); + } + return e; + } + function _defineProperty(obj, key, value2) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value2, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value2; + } + return obj; + } + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var NodeHttpStack = exports2.default = /* @__PURE__ */ (function() { + function NodeHttpStack2() { + var requestOptions = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + _classCallCheck(this, NodeHttpStack2); + this._requestOptions = requestOptions; + } + return _createClass(NodeHttpStack2, [{ + key: "createRequest", + value: function createRequest(method, url) { + return new Request(method, url, this._requestOptions); + } + }, { + key: "getName", + value: function getName() { + return "NodeHttpStack"; + } + }]); + })(); + var Request = /* @__PURE__ */ (function() { + function Request2(method, url, options) { + _classCallCheck(this, Request2); + this._method = method; + this._url = url; + this._headers = {}; + this._request = null; + this._progressHandler = function() { + }; + this._requestOptions = options || {}; + } + return _createClass(Request2, [{ + key: "getMethod", + value: function getMethod() { + return this._method; + } + }, { + key: "getURL", + value: function getURL() { + return this._url; + } + }, { + key: "setHeader", + value: function setHeader(header, value2) { + this._headers[header] = value2; + } + }, { + key: "getHeader", + value: function getHeader(header) { + return this._headers[header]; + } + }, { + key: "setProgressHandler", + value: function setProgressHandler(progressHandler) { + this._progressHandler = progressHandler; + } + }, { + key: "send", + value: function send() { + var _this = this; + var body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + return new Promise(function(resolve41, reject) { + var options = _objectSpread(_objectSpread(_objectSpread({}, (0, _url2.parse)(_this._url)), _this._requestOptions), {}, { + method: _this._method, + headers: _objectSpread(_objectSpread({}, _this._requestOptions.headers || {}), _this._headers) + }); + if (body !== null && body !== void 0 && body.size) { + options.headers["Content-Length"] = body.size; + } + var httpModule = options.protocol === "https:" ? https : http; + _this._request = httpModule.request(options); + var req = _this._request; + req.on("response", function(res) { + var resChunks = []; + res.on("data", function(data) { + resChunks.push(data); + }); + res.on("end", function() { + var responseText = Buffer.concat(resChunks).toString("utf8"); + resolve41(new Response(res, responseText)); + }); + }); + req.on("error", function(err2) { + reject(err2); + }); + if (body instanceof _stream.Readable) { + body.pipe(new ProgressEmitter(_this._progressHandler)).pipe(req); + } else if (body instanceof Uint8Array) { + writeBufferToStreamWithProgress(req, body, _this._progressHandler); + } else { + req.end(body); + } + }); + } + }, { + key: "abort", + value: function abort() { + if (this._request !== null) this._request.abort(); + return Promise.resolve(); + } + }, { + key: "getUnderlyingObject", + value: function getUnderlyingObject() { + return this._request; + } + }]); + })(); + var Response = /* @__PURE__ */ (function() { + function Response2(res, body) { + _classCallCheck(this, Response2); + this._response = res; + this._body = body; + } + return _createClass(Response2, [{ + key: "getStatus", + value: function getStatus() { + return this._response.statusCode; + } + }, { + key: "getHeader", + value: function getHeader(header) { + return this._response.headers[header.toLowerCase()]; + } + }, { + key: "getBody", + value: function getBody() { + return this._body; + } + }, { + key: "getUnderlyingObject", + value: function getUnderlyingObject() { + return this._response; + } + }]); + })(); + var ProgressEmitter = /* @__PURE__ */ (function(_Transform) { + function ProgressEmitter2(onprogress) { + var _this2; + _classCallCheck(this, ProgressEmitter2); + _this2 = _callSuper(this, ProgressEmitter2); + _this2._onprogress = (0, _lodash.default)(onprogress, 100, { + leading: true, + trailing: false + }); + _this2._position = 0; + return _this2; + } + _inherits(ProgressEmitter2, _Transform); + return _createClass(ProgressEmitter2, [{ + key: "_transform", + value: function _transform(chunk, _encoding, callback) { + this._position += chunk.length; + this._onprogress(this._position); + callback(null, chunk); + } + }]); + })(_stream.Transform); + var writeBufferToStreamWithProgress = function writeBufferToStreamWithProgress2(stream, source, onprogress) { + onprogress = (0, _lodash.default)(onprogress, 100, { + leading: true, + trailing: false + }); + var offset = 0; + function writeNextChunk() { + var chunkSize = Math.min(stream.writableHighWaterMark, source.length - offset); + var chunk = source.subarray(offset, offset + chunkSize); + offset += chunk.length; + var canContinue = stream.write(chunk); + if (!canContinue) { + stream.once("drain", writeNextChunk); + onprogress(offset); + } else if (offset < source.length) { + writeNextChunk(); + } else { + stream.end(); + } + } + writeNextChunk(); + }; + } +}); + +// node_modules/custom-error-instance/bin/factories.js +var require_factories = __commonJS({ + "node_modules/custom-error-instance/bin/factories.js"(exports2) { + "use strict"; + exports2.expectReceive = function(properties, configuration, factory) { + var message; + factory.root(properties, configuration, factory); + message = this.message; + if (properties.hasOwnProperty("expected")) message += " Expected " + properties.expected + "."; + if (properties.hasOwnProperty("received")) message += " Received: " + properties.received + "."; + this.message = message; + }; + exports2.root = function(properties, configuration, factories) { + var _this = this; + var code; + var config3 = { stackLength: Error.stackTraceLimit, rootOnly: true }; + var messageStr = ""; + var originalStackLength = Error.stackTraceLimit; + var stack; + function updateStack() { + stack[0] = _this.toString(); + _this.stack = stack.join("\n"); + } + if (!configuration || typeof configuration !== "object") configuration = {}; + if (configuration.hasOwnProperty("stackLength") && typeof configuration.stackLength === "number" && !isNaN(configuration.stackLength) && configuration.stackLength >= 0) config3.stackLength = configuration.stackLength; + if (!configuration.hasOwnProperty("rootOnly")) config3.rootOnly = configuration.rootOnly; + if (!config3.rootOnly || this.CustomError.parent === Error) { + Object.keys(properties).forEach(function(key) { + switch (key) { + case "code": + code = properties.code || void 0; + break; + case "message": + messageStr = properties.message || ""; + break; + default: + _this[key] = properties[key]; + } + }); + Error.stackTraceLimit = config3.stackLength + 2; + stack = new Error().stack.split("\n"); + stack.splice(0, 3); + stack.unshift(""); + Error.stackTraceLimit = originalStackLength; + this.stack = stack.join("\n"); + Object.defineProperty(this, "code", { + configurable: true, + enumerable: true, + get: function() { + return code; + }, + set: function(value2) { + code = value2; + updateStack(); + } + }); + Object.defineProperty(this, "message", { + configurable: true, + enumerable: true, + get: function() { + return messageStr; + }, + set: function(value2) { + messageStr = value2; + updateStack(); + } + }); + updateStack(); + } + }; + } +}); + +// node_modules/custom-error-instance/bin/error.js +var require_error2 = __commonJS({ + "node_modules/custom-error-instance/bin/error.js"(exports2, module2) { + "use strict"; + module2.exports = CustomError; + CustomError.factory = require_factories(); + var Err = CustomError("CustomError"); + Err.order = CustomError(Err, { message: "Arguments out of order.", code: "EOARG" }); + function CustomError(name, parent, properties, factory) { + var construct; + var isRoot; + parent = findArg(arguments, 1, Error, isParentArg, [isPropertiesArg, isFactoryArg]); + properties = findArg(arguments, 2, {}, isPropertiesArg, [isFactoryArg]); + factory = findArg(arguments, 3, noop, isFactoryArg, []); + name = findArg(arguments, 0, parent === Error ? "Error" : parent.prototype.CustomError.name, isNameArg, [isParentArg, isPropertiesArg, isFactoryArg]); + isRoot = parent === Error; + if (isRoot && factory === noop) factory = CustomError.factory.root; + construct = function(message, configuration) { + var _this; + var ar; + var factories; + var i; + var item; + var props; + if (!(this instanceof construct)) return new construct(message, configuration); + delete this.constructor.name; + Object.defineProperty(this.constructor, "name", { + enumerable: false, + configurable: true, + value: name, + writable: false + }); + if (typeof message === "string") message = { message }; + if (!message) message = {}; + ar = this.CustomError.chain.slice(0).reverse().map(function(value2) { + return value2.properties; + }); + ar.push(message); + ar.unshift({}); + props = Object.assign.apply(Object, ar); + _this = this; + factories = {}; + Object.keys(CustomError.factory).forEach(function(key) { + factories[key] = function(props2, config3) { + CustomError.factory[key].call(_this, props2, config3, factories); + }; + }); + for (i = this.CustomError.chain.length - 1; i >= 0; i--) { + item = this.CustomError.chain[i]; + if (item.factory !== noop) { + item.factory.call(this, props, configuration, factories); + } + } + }; + construct.prototype = Object.create(parent.prototype); + construct.prototype.constructor = construct; + construct.prototype.name = name; + construct.prototype.CustomError = { + chain: isRoot ? [] : parent.prototype.CustomError.chain.slice(0), + factory, + name, + parent, + properties + }; + construct.prototype.CustomError.chain.unshift(construct.prototype.CustomError); + construct.prototype.toString = function() { + var result = this.CustomError.chain[this.CustomError.chain.length - 1].name; + if (this.code) result += " " + this.code; + if (this.message) result += ": " + this.message; + return result; + }; + return construct; + } + function findArg(args, index, defaultValue, filter, antiFilters) { + var anti = -1; + var found = -1; + var i; + var j; + var len = index < args.length ? index : args.length; + var val; + for (i = 0; i <= len; i++) { + val = args[i]; + if (anti === -1) { + for (j = 0; j < antiFilters.length; j++) { + if (antiFilters[j](val)) anti = i; + } + } + if (found === -1 && filter(val)) { + found = i; + } + } + if (found !== -1 && anti !== -1 && anti < found) throw new Err.order(); + return found !== -1 ? args[found] : defaultValue; + } + function isFactoryArg(value2) { + return typeof value2 === "function" && value2 !== Error && !value2.prototype.CustomError; + } + function isNameArg(value2) { + return typeof value2 === "string"; + } + function isParentArg(value2) { + return typeof value2 === "function" && (value2 === Error || value2.prototype.CustomError); + } + function isPropertiesArg(value2) { + return value2 && typeof value2 === "object"; + } + function noop() { + } + } +}); + +// node_modules/custom-error-instance/index.js +var require_custom_error_instance = __commonJS({ + "node_modules/custom-error-instance/index.js"(exports2, module2) { + module2.exports = require_error2(); + } +}); + +// node_modules/lodash._basetostring/index.js +var require_lodash2 = __commonJS({ + "node_modules/lodash._basetostring/index.js"(exports2, module2) { + var INFINITY = 1 / 0; + var symbolTag = "[object Symbol]"; + var objectTypes = { + "function": true, + "object": true + }; + var freeExports = objectTypes[typeof exports2] && exports2 && !exports2.nodeType ? exports2 : void 0; + var freeModule = objectTypes[typeof module2] && module2 && !module2.nodeType ? module2 : void 0; + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == "object" && global); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var thisGlobal = checkGlobal(objectTypes[typeof exports2] && exports2); + var root = freeGlobal || freeWindow !== (thisGlobal && thisGlobal.window) && freeWindow || freeSelf || thisGlobal || Function("return this")(); + function checkGlobal(value2) { + return value2 && value2.Object === Object ? value2 : null; + } + var objectProto = Object.prototype; + var objectToString = objectProto.toString; + var Symbol2 = root.Symbol; + var symbolProto = Symbol2 ? Symbol2.prototype : void 0; + var symbolToString = symbolProto ? symbolProto.toString : void 0; + function baseToString(value2) { + if (typeof value2 == "string") { + return value2; + } + if (isSymbol(value2)) { + return symbolToString ? symbolToString.call(value2) : ""; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY ? "-0" : result; + } + function isObjectLike(value2) { + return !!value2 && typeof value2 == "object"; + } + function isSymbol(value2) { + return typeof value2 == "symbol" || isObjectLike(value2) && objectToString.call(value2) == symbolTag; + } + module2.exports = baseToString; + } +}); + +// node_modules/lodash._stringtopath/index.js +var require_lodash3 = __commonJS({ + "node_modules/lodash._stringtopath/index.js"(exports2, module2) { + var baseToString = require_lodash2(); + var FUNC_ERROR_TEXT = "Expected a function"; + var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var funcTag = "[object Function]"; + var genTag = "[object GeneratorFunction]"; + var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + var reEscapeChar = /\\(\\)?/g; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + var objectTypes = { + "function": true, + "object": true + }; + var freeExports = objectTypes[typeof exports2] && exports2 && !exports2.nodeType ? exports2 : void 0; + var freeModule = objectTypes[typeof module2] && module2 && !module2.nodeType ? module2 : void 0; + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == "object" && global); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var thisGlobal = checkGlobal(objectTypes[typeof exports2] && exports2); + var root = freeGlobal || freeWindow !== (thisGlobal && thisGlobal.window) && freeWindow || freeSelf || thisGlobal || Function("return this")(); + function checkGlobal(value2) { + return value2 && value2.Object === Object ? value2 : null; + } + function isHostObject(value2) { + var result = false; + if (value2 != null && typeof value2.toString != "function") { + try { + result = !!(value2 + ""); + } catch (e) { + } + } + return result; + } + var arrayProto = Array.prototype; + var objectProto = Object.prototype; + var funcToString = Function.prototype.toString; + var hasOwnProperty = objectProto.hasOwnProperty; + var objectToString = objectProto.toString; + var reIsNative = RegExp( + "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + var splice = arrayProto.splice; + var Map2 = getNative(root, "Map"); + var nativeCreate = getNative(Object, "create"); + function Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + } + function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; + } + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty.call(data, key) ? data[key] : void 0; + } + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); + } + function hashSet(key, value2) { + var data = this.__data__; + data[key] = nativeCreate && value2 === void 0 ? HASH_UNDEFINED : value2; + return this; + } + Hash.prototype.clear = hashClear; + Hash.prototype["delete"] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + function ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function listCacheClear() { + this.__data__ = []; + } + function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; + } + function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? void 0 : data[index][1]; + } + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + function listCacheSet(key, value2) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + data.push([key, value2]); + } else { + data[index][1] = value2; + } + return this; + } + ListCache.prototype.clear = listCacheClear; + ListCache.prototype["delete"] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + function MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear() { + this.__data__ = { + "hash": new Hash(), + "map": new (Map2 || ListCache)(), + "string": new Hash() + }; + } + function mapCacheDelete(key) { + return getMapData(this, key)["delete"](key); + } + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + function mapCacheSet(key, value2) { + getMapData(this, key).set(key, value2); + return this; + } + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype["delete"] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + function assocIndexOf(array2, key) { + var length = array2.length; + while (length--) { + if (eq(array2[length][0], key)) { + return length; + } + } + return -1; + } + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + } + function getNative(object8, key) { + var value2 = object8[key]; + return isNative11(value2) ? value2 : void 0; + } + function isKeyable(value2) { + var type = typeof value2; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value2 !== "__proto__" : value2 === null; + } + var stringToPath = memoize(function(string3) { + var result = []; + toString(string3).replace(rePropName, function(match, number3, quote, string4) { + result.push(quote ? string4.replace(reEscapeChar, "$1") : number3 || match); + }); + return result; + }); + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + function memoize(func, resolver) { + if (typeof func != "function" || resolver && typeof resolver != "function") { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new (memoize.Cache || MapCache)(); + return memoized; + } + memoize.Cache = MapCache; + function eq(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + function isFunction(value2) { + var tag = isObject3(value2) ? objectToString.call(value2) : ""; + return tag == funcTag || tag == genTag; + } + function isObject3(value2) { + var type = typeof value2; + return !!value2 && (type == "object" || type == "function"); + } + function isNative11(value2) { + if (!isObject3(value2)) { + return false; + } + var pattern = isFunction(value2) || isHostObject(value2) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value2)); + } + function toString(value2) { + return value2 == null ? "" : baseToString(value2); + } + module2.exports = stringToPath; + } +}); + +// node_modules/lodash._baseiteratee/index.js +var require_lodash4 = __commonJS({ + "node_modules/lodash._baseiteratee/index.js"(exports2, module2) { + var stringToPath = require_lodash3(); + var LARGE_ARRAY_SIZE = 200; + var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var UNORDERED_COMPARE_FLAG = 1; + var PARTIAL_COMPARE_FLAG = 2; + var INFINITY = 1 / 0; + var MAX_SAFE_INTEGER = 9007199254740991; + var argsTag = "[object Arguments]"; + var arrayTag = "[object Array]"; + var boolTag = "[object Boolean]"; + var dateTag = "[object Date]"; + var errorTag = "[object Error]"; + var funcTag = "[object Function]"; + var genTag = "[object GeneratorFunction]"; + var mapTag = "[object Map]"; + var numberTag = "[object Number]"; + var objectTag = "[object Object]"; + var promiseTag = "[object Promise]"; + var regexpTag = "[object RegExp]"; + var setTag = "[object Set]"; + var stringTag = "[object String]"; + var symbolTag = "[object Symbol]"; + var weakMapTag = "[object WeakMap]"; + var arrayBufferTag = "[object ArrayBuffer]"; + var dataViewTag = "[object DataView]"; + var float32Tag = "[object Float32Array]"; + var float64Tag = "[object Float64Array]"; + var int8Tag = "[object Int8Array]"; + var int16Tag = "[object Int16Array]"; + var int32Tag = "[object Int32Array]"; + var uint8Tag = "[object Uint8Array]"; + var uint8ClampedTag = "[object Uint8ClampedArray]"; + var uint16Tag = "[object Uint16Array]"; + var uint32Tag = "[object Uint32Array]"; + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; + var reIsPlainProp = /^\w*$/; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + var reIsUint = /^(?:0|[1-9]\d*)$/; + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + var objectTypes = { + "function": true, + "object": true + }; + var freeExports = objectTypes[typeof exports2] && exports2 && !exports2.nodeType ? exports2 : void 0; + var freeModule = objectTypes[typeof module2] && module2 && !module2.nodeType ? module2 : void 0; + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == "object" && global); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var thisGlobal = checkGlobal(objectTypes[typeof exports2] && exports2); + var root = freeGlobal || freeWindow !== (thisGlobal && thisGlobal.window) && freeWindow || freeSelf || thisGlobal || Function("return this")(); + function arrayMap(array2, iteratee) { + var index = -1, length = array2.length, result = Array(length); + while (++index < length) { + result[index] = iteratee(array2[index], index, array2); + } + return result; + } + function arraySome(array2, predicate) { + var index = -1, length = array2.length; + while (++index < length) { + if (predicate(array2[index], index, array2)) { + return true; + } + } + return false; + } + function baseTimes(n, iteratee) { + var index = -1, result = Array(n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + function baseToPairs(object8, props) { + return arrayMap(props, function(key) { + return [key, object8[key]]; + }); + } + function checkGlobal(value2) { + return value2 && value2.Object === Object ? value2 : null; + } + function isHostObject(value2) { + var result = false; + if (value2 != null && typeof value2.toString != "function") { + try { + result = !!(value2 + ""); + } catch (e) { + } + } + return result; + } + function mapToArray(map) { + var index = -1, result = Array(map.size); + map.forEach(function(value2, key) { + result[++index] = [key, value2]; + }); + return result; + } + function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value2) { + result[++index] = value2; + }); + return result; + } + function setToPairs(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value2) { + result[++index] = [value2, value2]; + }); + return result; + } + var arrayProto = Array.prototype; + var objectProto = Object.prototype; + var funcToString = Function.prototype.toString; + var hasOwnProperty = objectProto.hasOwnProperty; + var objectToString = objectProto.toString; + var reIsNative = RegExp( + "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + var Symbol2 = root.Symbol; + var Uint8Array2 = root.Uint8Array; + var propertyIsEnumerable = objectProto.propertyIsEnumerable; + var splice = arrayProto.splice; + var nativeGetPrototype = Object.getPrototypeOf; + var nativeKeys = Object.keys; + var DataView2 = getNative(root, "DataView"); + var Map2 = getNative(root, "Map"); + var Promise2 = getNative(root, "Promise"); + var Set2 = getNative(root, "Set"); + var WeakMap2 = getNative(root, "WeakMap"); + var nativeCreate = getNative(Object, "create"); + var dataViewCtorString = toSource(DataView2); + var mapCtorString = toSource(Map2); + var promiseCtorString = toSource(Promise2); + var setCtorString = toSource(Set2); + var weakMapCtorString = toSource(WeakMap2); + var symbolProto = Symbol2 ? Symbol2.prototype : void 0; + var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; + function Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + } + function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; + } + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty.call(data, key) ? data[key] : void 0; + } + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); + } + function hashSet(key, value2) { + var data = this.__data__; + data[key] = nativeCreate && value2 === void 0 ? HASH_UNDEFINED : value2; + return this; + } + Hash.prototype.clear = hashClear; + Hash.prototype["delete"] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + function ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function listCacheClear() { + this.__data__ = []; + } + function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; + } + function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? void 0 : data[index][1]; + } + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + function listCacheSet(key, value2) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + data.push([key, value2]); + } else { + data[index][1] = value2; + } + return this; + } + ListCache.prototype.clear = listCacheClear; + ListCache.prototype["delete"] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + function MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear() { + this.__data__ = { + "hash": new Hash(), + "map": new (Map2 || ListCache)(), + "string": new Hash() + }; + } + function mapCacheDelete(key) { + return getMapData(this, key)["delete"](key); + } + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + function mapCacheSet(key, value2) { + getMapData(this, key).set(key, value2); + return this; + } + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype["delete"] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + function SetCache(values) { + var index = -1, length = values ? values.length : 0; + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values[index]); + } + } + function setCacheAdd(value2) { + this.__data__.set(value2, HASH_UNDEFINED); + return this; + } + function setCacheHas(value2) { + return this.__data__.has(value2); + } + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + function Stack(entries) { + this.__data__ = new ListCache(entries); + } + function stackClear() { + this.__data__ = new ListCache(); + } + function stackDelete(key) { + return this.__data__["delete"](key); + } + function stackGet(key) { + return this.__data__.get(key); + } + function stackHas(key) { + return this.__data__.has(key); + } + function stackSet(key, value2) { + var cache = this.__data__; + if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) { + cache = this.__data__ = new MapCache(cache.__data__); + } + cache.set(key, value2); + return this; + } + Stack.prototype.clear = stackClear; + Stack.prototype["delete"] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + function assocIndexOf(array2, key) { + var length = array2.length; + while (length--) { + if (eq(array2[length][0], key)) { + return length; + } + } + return -1; + } + function baseGet(object8, path) { + path = isKey(path, object8) ? [path] : castPath(path); + var index = 0, length = path.length; + while (object8 != null && index < length) { + object8 = object8[toKey(path[index++])]; + } + return index && index == length ? object8 : void 0; + } + function baseHas(object8, key) { + return hasOwnProperty.call(object8, key) || typeof object8 == "object" && key in object8 && getPrototype(object8) === null; + } + function baseHasIn(object8, key) { + return key in Object(object8); + } + function baseIsEqual(value2, other, customizer, bitmask, stack) { + if (value2 === other) { + return true; + } + if (value2 == null || other == null || !isObject3(value2) && !isObjectLike(other)) { + return value2 !== value2 && other !== other; + } + return baseIsEqualDeep(value2, other, baseIsEqual, customizer, bitmask, stack); + } + function baseIsEqualDeep(object8, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object8), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; + if (!objIsArr) { + objTag = getTag(object8); + objTag = objTag == argsTag ? objectTag : objTag; + } + if (!othIsArr) { + othTag = getTag(other); + othTag = othTag == argsTag ? objectTag : othTag; + } + var objIsObj = objTag == objectTag && !isHostObject(object8), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; + if (isSameTag && !objIsObj) { + stack || (stack = new Stack()); + return objIsArr || isTypedArray(object8) ? equalArrays(object8, other, equalFunc, customizer, bitmask, stack) : equalByTag(object8, other, objTag, equalFunc, customizer, bitmask, stack); + } + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object8, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object8.value() : object8, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack()); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack()); + return equalObjects(object8, other, equalFunc, customizer, bitmask, stack); + } + function baseIsMatch(object8, source, matchData, customizer) { + var index = matchData.length, length = index, noCustomizer = !customizer; + if (object8 == null) { + return !length; + } + object8 = Object(object8); + while (index--) { + var data = matchData[index]; + if (noCustomizer && data[2] ? data[1] !== object8[data[0]] : !(data[0] in object8)) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], objValue = object8[key], srcValue = data[1]; + if (noCustomizer && data[2]) { + if (objValue === void 0 && !(key in object8)) { + return false; + } + } else { + var stack = new Stack(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object8, source, stack); + } + if (!(result === void 0 ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { + return false; + } + } + } + return true; + } + function baseIteratee(value2) { + if (typeof value2 == "function") { + return value2; + } + if (value2 == null) { + return identity; + } + if (typeof value2 == "object") { + return isArray(value2) ? baseMatchesProperty(value2[0], value2[1]) : baseMatches(value2); + } + return property(value2); + } + function baseKeys(object8) { + return nativeKeys(Object(object8)); + } + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object8) { + return object8 === source || baseIsMatch(object8, source, matchData); + }; + } + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object8) { + var objValue = get(object8, path); + return objValue === void 0 && objValue === srcValue ? hasIn(object8, path) : baseIsEqual(srcValue, objValue, void 0, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); + }; + } + function baseProperty(key) { + return function(object8) { + return object8 == null ? void 0 : object8[key]; + }; + } + function basePropertyDeep(path) { + return function(object8) { + return baseGet(object8, path); + }; + } + function castPath(value2) { + return isArray(value2) ? value2 : stringToPath(value2); + } + function createToPairs(keysFunc) { + return function(object8) { + var tag = getTag(object8); + if (tag == mapTag) { + return mapToArray(object8); + } + if (tag == setTag) { + return setToPairs(object8); + } + return baseToPairs(object8, keysFunc(object8)); + }; + } + function equalArrays(array2, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array2.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var stacked = stack.get(array2); + if (stacked) { + return stacked == other; + } + var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : void 0; + stack.set(array2, other); + while (++index < arrLength) { + var arrValue = array2[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack); + } + if (compared !== void 0) { + if (compared) { + continue; + } + result = false; + break; + } + if (seen) { + if (!arraySome(other, function(othValue2, othIndex) { + if (!seen.has(othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, customizer, bitmask, stack))) { + return seen.add(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; + } + } + stack["delete"](array2); + return result; + } + function equalByTag(object8, other, tag, equalFunc, customizer, bitmask, stack) { + switch (tag) { + case dataViewTag: + if (object8.byteLength != other.byteLength || object8.byteOffset != other.byteOffset) { + return false; + } + object8 = object8.buffer; + other = other.buffer; + case arrayBufferTag: + if (object8.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object8), new Uint8Array2(other))) { + return false; + } + return true; + case boolTag: + case dateTag: + return +object8 == +other; + case errorTag: + return object8.name == other.name && object8.message == other.message; + case numberTag: + return object8 != +object8 ? other != +other : object8 == +other; + case regexpTag: + case stringTag: + return object8 == other + ""; + case mapTag: + var convert = mapToArray; + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + if (object8.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object8); + if (stacked) { + return stacked == other; + } + bitmask |= UNORDERED_COMPARE_FLAG; + stack.set(object8, other); + return equalArrays(convert(object8), convert(other), equalFunc, customizer, bitmask, stack); + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object8) == symbolValueOf.call(other); + } + } + return false; + } + function equalObjects(object8, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys3(object8), objLength = objProps.length, othProps = keys3(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : baseHas(other, key))) { + return false; + } + } + var stacked = stack.get(object8); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(object8, other); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object8[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object8, stack) : customizer(objValue, othValue, key, object8, other, stack); + } + if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object8.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object8 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result = false; + } + } + stack["delete"](object8); + return result; + } + var getLength = baseProperty("length"); + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + } + function getMatchData(object8) { + var result = toPairs(object8), length = result.length; + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; + } + function getNative(object8, key) { + var value2 = object8[key]; + return isNative11(value2) ? value2 : void 0; + } + function getPrototype(value2) { + return nativeGetPrototype(Object(value2)); + } + function getTag(value2) { + return objectToString.call(value2); + } + if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) { + getTag = function(value2) { + var result = objectToString.call(value2), Ctor = result == objectTag ? value2.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : void 0; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + } + return result; + }; + } + function hasPath(object8, path, hasFunc) { + path = isKey(path, object8) ? [path] : castPath(path); + var result, index = -1, length = path.length; + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object8 != null && hasFunc(object8, key))) { + break; + } + object8 = object8[key]; + } + if (result) { + return result; + } + var length = object8 ? object8.length : 0; + return !!length && isLength(length) && isIndex(key, length) && (isArray(object8) || isString(object8) || isArguments(object8)); + } + function indexKeys(object8) { + var length = object8 ? object8.length : void 0; + if (isLength(length) && (isArray(object8) || isString(object8) || isArguments(object8))) { + return baseTimes(length, String); + } + return null; + } + function isIndex(value2, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (typeof value2 == "number" || reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length); + } + function isKey(value2, object8) { + if (isArray(value2)) { + return false; + } + var type = typeof value2; + if (type == "number" || type == "symbol" || type == "boolean" || value2 == null || isSymbol(value2)) { + return true; + } + return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object8 != null && value2 in Object(object8); + } + function isKeyable(value2) { + var type = typeof value2; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value2 !== "__proto__" : value2 === null; + } + function isPrototype(value2) { + var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; + return value2 === proto; + } + function isStrictComparable(value2) { + return value2 === value2 && !isObject3(value2); + } + function matchesStrictComparable(key, srcValue) { + return function(object8) { + if (object8 == null) { + return false; + } + return object8[key] === srcValue && (srcValue !== void 0 || key in Object(object8)); + }; + } + function toKey(value2) { + if (typeof value2 == "string" || isSymbol(value2)) { + return value2; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY ? "-0" : result; + } + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + function eq(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + function isArguments(value2) { + return isArrayLikeObject(value2) && hasOwnProperty.call(value2, "callee") && (!propertyIsEnumerable.call(value2, "callee") || objectToString.call(value2) == argsTag); + } + var isArray = Array.isArray; + function isArrayLike(value2) { + return value2 != null && isLength(getLength(value2)) && !isFunction(value2); + } + function isArrayLikeObject(value2) { + return isObjectLike(value2) && isArrayLike(value2); + } + function isFunction(value2) { + var tag = isObject3(value2) ? objectToString.call(value2) : ""; + return tag == funcTag || tag == genTag; + } + function isLength(value2) { + return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER; + } + function isObject3(value2) { + var type = typeof value2; + return !!value2 && (type == "object" || type == "function"); + } + function isObjectLike(value2) { + return !!value2 && typeof value2 == "object"; + } + function isNative11(value2) { + if (!isObject3(value2)) { + return false; + } + var pattern = isFunction(value2) || isHostObject(value2) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value2)); + } + function isString(value2) { + return typeof value2 == "string" || !isArray(value2) && isObjectLike(value2) && objectToString.call(value2) == stringTag; + } + function isSymbol(value2) { + return typeof value2 == "symbol" || isObjectLike(value2) && objectToString.call(value2) == symbolTag; + } + function isTypedArray(value2) { + return isObjectLike(value2) && isLength(value2.length) && !!typedArrayTags[objectToString.call(value2)]; + } + function get(object8, path, defaultValue) { + var result = object8 == null ? void 0 : baseGet(object8, path); + return result === void 0 ? defaultValue : result; + } + function hasIn(object8, path) { + return object8 != null && hasPath(object8, path, baseHasIn); + } + function keys3(object8) { + var isProto = isPrototype(object8); + if (!(isProto || isArrayLike(object8))) { + return baseKeys(object8); + } + var indexes = indexKeys(object8), skipIndexes = !!indexes, result = indexes || [], length = result.length; + for (var key in object8) { + if (baseHas(object8, key) && !(skipIndexes && (key == "length" || isIndex(key, length))) && !(isProto && key == "constructor")) { + result.push(key); + } + } + return result; + } + var toPairs = createToPairs(keys3); + function identity(value2) { + return value2; + } + function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); + } + module2.exports = baseIteratee; + } +}); + +// node_modules/lodash._createset/index.js +var require_lodash5 = __commonJS({ + "node_modules/lodash._createset/index.js"(exports2, module2) { + var INFINITY = 1 / 0; + var funcTag = "[object Function]"; + var genTag = "[object GeneratorFunction]"; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + var objectTypes = { + "function": true, + "object": true + }; + var freeExports = objectTypes[typeof exports2] && exports2 && !exports2.nodeType ? exports2 : void 0; + var freeModule = objectTypes[typeof module2] && module2 && !module2.nodeType ? module2 : void 0; + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == "object" && global); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var thisGlobal = checkGlobal(objectTypes[typeof exports2] && exports2); + var root = freeGlobal || freeWindow !== (thisGlobal && thisGlobal.window) && freeWindow || freeSelf || thisGlobal || Function("return this")(); + function checkGlobal(value2) { + return value2 && value2.Object === Object ? value2 : null; + } + function isHostObject(value2) { + var result = false; + if (value2 != null && typeof value2.toString != "function") { + try { + result = !!(value2 + ""); + } catch (e) { + } + } + return result; + } + function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value2) { + result[++index] = value2; + }); + return result; + } + var objectProto = Object.prototype; + var funcToString = Function.prototype.toString; + var hasOwnProperty = objectProto.hasOwnProperty; + var objectToString = objectProto.toString; + var reIsNative = RegExp( + "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + var Set2 = getNative(root, "Set"); + var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values) { + return new Set2(values); + }; + function getNative(object8, key) { + var value2 = object8[key]; + return isNative11(value2) ? value2 : void 0; + } + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + function isFunction(value2) { + var tag = isObject3(value2) ? objectToString.call(value2) : ""; + return tag == funcTag || tag == genTag; + } + function isObject3(value2) { + var type = typeof value2; + return !!value2 && (type == "object" || type == "function"); + } + function isNative11(value2) { + if (!isObject3(value2)) { + return false; + } + var pattern = isFunction(value2) || isHostObject(value2) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value2)); + } + function noop() { + } + module2.exports = createSet; + } +}); + +// node_modules/lodash._root/index.js +var require_lodash6 = __commonJS({ + "node_modules/lodash._root/index.js"(exports2, module2) { + var objectTypes = { + "function": true, + "object": true + }; + var freeExports = objectTypes[typeof exports2] && exports2 && !exports2.nodeType ? exports2 : void 0; + var freeModule = objectTypes[typeof module2] && module2 && !module2.nodeType ? module2 : void 0; + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == "object" && global); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var thisGlobal = checkGlobal(objectTypes[typeof exports2] && exports2); + var root = freeGlobal || freeWindow !== (thisGlobal && thisGlobal.window) && freeWindow || freeSelf || thisGlobal || Function("return this")(); + function checkGlobal(value2) { + return value2 && value2.Object === Object ? value2 : null; + } + module2.exports = root; + } +}); + +// node_modules/lodash._baseuniq/index.js +var require_lodash7 = __commonJS({ + "node_modules/lodash._baseuniq/index.js"(exports2, module2) { + var createSet = require_lodash5(); + var root = require_lodash6(); + var LARGE_ARRAY_SIZE = 200; + var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var funcTag = "[object Function]"; + var genTag = "[object GeneratorFunction]"; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + function arrayIncludes(array2, value2) { + return !!array2.length && baseIndexOf(array2, value2, 0) > -1; + } + function arrayIncludesWith(array2, value2, comparator) { + var index = -1, length = array2.length; + while (++index < length) { + if (comparator(value2, array2[index])) { + return true; + } + } + return false; + } + function baseIndexOf(array2, value2, fromIndex) { + if (value2 !== value2) { + return indexOfNaN(array2, fromIndex); + } + var index = fromIndex - 1, length = array2.length; + while (++index < length) { + if (array2[index] === value2) { + return index; + } + } + return -1; + } + function cacheHas(cache, key) { + return cache.has(key); + } + function indexOfNaN(array2, fromIndex, fromRight) { + var length = array2.length, index = fromIndex + (fromRight ? 0 : -1); + while (fromRight ? index-- : ++index < length) { + var other = array2[index]; + if (other !== other) { + return index; + } + } + return -1; + } + function isHostObject(value2) { + var result = false; + if (value2 != null && typeof value2.toString != "function") { + try { + result = !!(value2 + ""); + } catch (e) { + } + } + return result; + } + function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value2) { + result[++index] = value2; + }); + return result; + } + var arrayProto = Array.prototype; + var objectProto = Object.prototype; + var funcToString = Function.prototype.toString; + var hasOwnProperty = objectProto.hasOwnProperty; + var objectToString = objectProto.toString; + var reIsNative = RegExp( + "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + var splice = arrayProto.splice; + var Map2 = getNative(root, "Map"); + var nativeCreate = getNative(Object, "create"); + function Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + } + function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; + } + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty.call(data, key) ? data[key] : void 0; + } + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); + } + function hashSet(key, value2) { + var data = this.__data__; + data[key] = nativeCreate && value2 === void 0 ? HASH_UNDEFINED : value2; + return this; + } + Hash.prototype.clear = hashClear; + Hash.prototype["delete"] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + function ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function listCacheClear() { + this.__data__ = []; + } + function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; + } + function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? void 0 : data[index][1]; + } + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + function listCacheSet(key, value2) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + data.push([key, value2]); + } else { + data[index][1] = value2; + } + return this; + } + ListCache.prototype.clear = listCacheClear; + ListCache.prototype["delete"] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + function MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear() { + this.__data__ = { + "hash": new Hash(), + "map": new (Map2 || ListCache)(), + "string": new Hash() + }; + } + function mapCacheDelete(key) { + return getMapData(this, key)["delete"](key); + } + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + function mapCacheSet(key, value2) { + getMapData(this, key).set(key, value2); + return this; + } + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype["delete"] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + function SetCache(values) { + var index = -1, length = values ? values.length : 0; + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values[index]); + } + } + function setCacheAdd(value2) { + this.__data__.set(value2, HASH_UNDEFINED); + return this; + } + function setCacheHas(value2) { + return this.__data__.has(value2); + } + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + function assocIndexOf(array2, key) { + var length = array2.length; + while (length--) { + if (eq(array2[length][0], key)) { + return length; + } + } + return -1; + } + function baseUniq(array2, iteratee, comparator) { + var index = -1, includes = arrayIncludes, length = array2.length, isCommon = true, result = [], seen = result; + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array2); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache(); + } else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value2 = array2[index], computed = iteratee ? iteratee(value2) : value2; + value2 = comparator || value2 !== 0 ? value2 : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value2); + } else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value2); + } + } + return result; + } + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + } + function getNative(object8, key) { + var value2 = object8[key]; + return isNative11(value2) ? value2 : void 0; + } + function isKeyable(value2) { + var type = typeof value2; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value2 !== "__proto__" : value2 === null; + } + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + function eq(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + function isFunction(value2) { + var tag = isObject3(value2) ? objectToString.call(value2) : ""; + return tag == funcTag || tag == genTag; + } + function isObject3(value2) { + var type = typeof value2; + return !!value2 && (type == "object" || type == "function"); + } + function isNative11(value2) { + if (!isObject3(value2)) { + return false; + } + var pattern = isFunction(value2) || isHostObject(value2) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value2)); + } + module2.exports = baseUniq; + } +}); + +// node_modules/lodash.uniqby/index.js +var require_lodash8 = __commonJS({ + "node_modules/lodash.uniqby/index.js"(exports2, module2) { + var baseIteratee = require_lodash4(); + var baseUniq = require_lodash7(); + function uniqBy(array2, iteratee) { + return array2 && array2.length ? baseUniq(array2, baseIteratee(iteratee)) : []; + } + module2.exports = uniqBy; + } +}); + +// node_modules/combine-errors/index.js +var require_combine_errors = __commonJS({ + "node_modules/combine-errors/index.js"(exports2, module2) { + "use strict"; + var Custom = require_custom_error_instance(); + var uniq = require_lodash8(); + var MultiError = Custom("MultiError"); + module2.exports = error2; + function error2(errors) { + if (!(this instanceof error2)) return new error2(errors); + errors = Array.isArray(errors) ? errors : [errors]; + errors = uniq(errors, function(err2) { + return err2.stack; + }); + if (errors.length === 1) return errors[0]; + var multierror = new MultiError({ + message: errors.map(function(err2) { + return err2.message; + }).join("; "), + errors: errors.reduce(function(errs, err2) { + return errs.concat(err2.errors || err2); + }, []) + }); + multierror.__defineGetter__("stack", function() { + return errors.map(function(err2) { + return err2.stack; + }).join("\n\n"); + }); + multierror.__defineSetter__("stack", function(value2) { + return [value2].concat(multierror.stack).join("\n\n"); + }); + return multierror; + } + } +}); + +// node_modules/graceful-fs/polyfills.js +var require_polyfills = __commonJS({ + "node_modules/graceful-fs/polyfills.js"(exports2, module2) { + var constants4 = require("constants"); + var origCwd = process.cwd; + var cwd = null; + var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; + process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process); + return cwd; + }; + try { + process.cwd(); + } catch (er) { + } + if (typeof process.chdir === "function") { + chdir = process.chdir; + process.chdir = function(d) { + cwd = null; + chdir.call(process, d); + }; + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir); + } + var chdir; + module2.exports = patch; + function patch(fs) { + if (constants4.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs); + } + if (!fs.lutimes) { + patchLutimes(fs); + } + fs.chown = chownFix(fs.chown); + fs.fchown = chownFix(fs.fchown); + fs.lchown = chownFix(fs.lchown); + fs.chmod = chmodFix(fs.chmod); + fs.fchmod = chmodFix(fs.fchmod); + fs.lchmod = chmodFix(fs.lchmod); + fs.chownSync = chownFixSync(fs.chownSync); + fs.fchownSync = chownFixSync(fs.fchownSync); + fs.lchownSync = chownFixSync(fs.lchownSync); + fs.chmodSync = chmodFixSync(fs.chmodSync); + fs.fchmodSync = chmodFixSync(fs.fchmodSync); + fs.lchmodSync = chmodFixSync(fs.lchmodSync); + fs.stat = statFix(fs.stat); + fs.fstat = statFix(fs.fstat); + fs.lstat = statFix(fs.lstat); + fs.statSync = statFixSync(fs.statSync); + fs.fstatSync = statFixSync(fs.fstatSync); + fs.lstatSync = statFixSync(fs.lstatSync); + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function(path, mode, cb) { + if (cb) process.nextTick(cb); + }; + fs.lchmodSync = function() { + }; + } + if (fs.chown && !fs.lchown) { + fs.lchown = function(path, uid, gid, cb) { + if (cb) process.nextTick(cb); + }; + fs.lchownSync = function() { + }; + } + if (platform === "win32") { + fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) { + function rename6(from, to, cb) { + var start = Date.now(); + var backoff = 0; + fs$rename(from, to, function CB(er) { + if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) { + setTimeout(function() { + fs.stat(to, function(stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er); + }); + }, backoff); + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er); + }); + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename6, fs$rename); + return rename6; + })(fs.rename); + } + fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) { + function read(fd, buffer, offset, length, position, callback_) { + var callback; + if (callback_ && typeof callback_ === "function") { + var eagCounter = 0; + callback = function(er, _, __) { + if (er && er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + return fs$read.call(fs, fd, buffer, offset, length, position, callback); + } + callback_.apply(this, arguments); + }; + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback); + } + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); + return read; + })(fs.read); + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) { + return function(fd, buffer, offset, length, position) { + var eagCounter = 0; + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position); + } catch (er) { + if (er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + continue; + } + throw er; + } + } + }; + })(fs.readSync); + function patchLchmod(fs2) { + fs2.lchmod = function(path, mode, callback) { + fs2.open( + path, + constants4.O_WRONLY | constants4.O_SYMLINK, + mode, + function(err2, fd) { + if (err2) { + if (callback) callback(err2); + return; + } + fs2.fchmod(fd, mode, function(err3) { + fs2.close(fd, function(err22) { + if (callback) callback(err3 || err22); + }); + }); + } + ); + }; + fs2.lchmodSync = function(path, mode) { + var fd = fs2.openSync(path, constants4.O_WRONLY | constants4.O_SYMLINK, mode); + var threw = true; + var ret; + try { + ret = fs2.fchmodSync(fd, mode); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret; + }; + } + function patchLutimes(fs2) { + if (constants4.hasOwnProperty("O_SYMLINK") && fs2.futimes) { + fs2.lutimes = function(path, at, mt, cb) { + fs2.open(path, constants4.O_SYMLINK, function(er, fd) { + if (er) { + if (cb) cb(er); + return; + } + fs2.futimes(fd, at, mt, function(er2) { + fs2.close(fd, function(er22) { + if (cb) cb(er2 || er22); + }); + }); + }); + }; + fs2.lutimesSync = function(path, at, mt) { + var fd = fs2.openSync(path, constants4.O_SYMLINK); + var ret; + var threw = true; + try { + ret = fs2.futimesSync(fd, at, mt); + threw = false; + } finally { + if (threw) { + try { + fs2.closeSync(fd); + } catch (er) { + } + } else { + fs2.closeSync(fd); + } + } + return ret; + }; + } else if (fs2.futimes) { + fs2.lutimes = function(_a3, _b, _c, cb) { + if (cb) process.nextTick(cb); + }; + fs2.lutimesSync = function() { + }; + } + } + function chmodFix(orig) { + if (!orig) return orig; + return function(target, mode, cb) { + return orig.call(fs, target, mode, function(er) { + if (chownErOk(er)) er = null; + if (cb) cb.apply(this, arguments); + }); + }; + } + function chmodFixSync(orig) { + if (!orig) return orig; + return function(target, mode) { + try { + return orig.call(fs, target, mode); + } catch (er) { + if (!chownErOk(er)) throw er; + } + }; + } + function chownFix(orig) { + if (!orig) return orig; + return function(target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function(er) { + if (chownErOk(er)) er = null; + if (cb) cb.apply(this, arguments); + }); + }; + } + function chownFixSync(orig) { + if (!orig) return orig; + return function(target, uid, gid) { + try { + return orig.call(fs, target, uid, gid); + } catch (er) { + if (!chownErOk(er)) throw er; + } + }; + } + function statFix(orig) { + if (!orig) return orig; + return function(target, options, cb) { + if (typeof options === "function") { + cb = options; + options = null; + } + function callback(er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 4294967296; + if (stats.gid < 0) stats.gid += 4294967296; + } + if (cb) cb.apply(this, arguments); + } + return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback); + }; + } + function statFixSync(orig) { + if (!orig) return orig; + return function(target, options) { + var stats = options ? orig.call(fs, target, options) : orig.call(fs, target); + if (stats) { + if (stats.uid < 0) stats.uid += 4294967296; + if (stats.gid < 0) stats.gid += 4294967296; + } + return stats; + }; + } + function chownErOk(er) { + if (!er) + return true; + if (er.code === "ENOSYS") + return true; + var nonroot = !process.getuid || process.getuid() !== 0; + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true; + } + return false; + } + } + } +}); + +// node_modules/graceful-fs/legacy-streams.js +var require_legacy_streams = __commonJS({ + "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { + var Stream = require("stream").Stream; + module2.exports = legacy; + function legacy(fs) { + return { + ReadStream, + WriteStream + }; + function ReadStream(path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + Stream.call(this); + var self2 = this; + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + this.flags = "r"; + this.mode = 438; + this.bufferSize = 64 * 1024; + options = options || {}; + var keys3 = Object.keys(options); + for (var index = 0, length = keys3.length; index < length; index++) { + var key = keys3[index]; + this[key] = options[key]; + } + if (this.encoding) this.setEncoding(this.encoding); + if (this.start !== void 0) { + if ("number" !== typeof this.start) { + throw TypeError("start must be a Number"); + } + if (this.end === void 0) { + this.end = Infinity; + } else if ("number" !== typeof this.end) { + throw TypeError("end must be a Number"); + } + if (this.start > this.end) { + throw new Error("start must be <= end"); + } + this.pos = this.start; + } + if (this.fd !== null) { + process.nextTick(function() { + self2._read(); + }); + return; + } + fs.open(this.path, this.flags, this.mode, function(err2, fd) { + if (err2) { + self2.emit("error", err2); + self2.readable = false; + return; + } + self2.fd = fd; + self2.emit("open", fd); + self2._read(); + }); + } + function WriteStream(path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + Stream.call(this); + this.path = path; + this.fd = null; + this.writable = true; + this.flags = "w"; + this.encoding = "binary"; + this.mode = 438; + this.bytesWritten = 0; + options = options || {}; + var keys3 = Object.keys(options); + for (var index = 0, length = keys3.length; index < length; index++) { + var key = keys3[index]; + this[key] = options[key]; + } + if (this.start !== void 0) { + if ("number" !== typeof this.start) { + throw TypeError("start must be a Number"); + } + if (this.start < 0) { + throw new Error("start must be >= zero"); + } + this.pos = this.start; + } + this.busy = false; + this._queue = []; + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); + this.flush(); + } + } + } + } +}); + +// node_modules/graceful-fs/clone.js +var require_clone = __commonJS({ + "node_modules/graceful-fs/clone.js"(exports2, module2) { + "use strict"; + module2.exports = clone2; + var getPrototypeOf = Object.getPrototypeOf || function(obj) { + return obj.__proto__; + }; + function clone2(obj) { + if (obj === null || typeof obj !== "object") + return obj; + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) }; + else + var copy = /* @__PURE__ */ Object.create(null); + Object.getOwnPropertyNames(obj).forEach(function(key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); + }); + return copy; + } + } +}); + +// node_modules/graceful-fs/graceful-fs.js +var require_graceful_fs = __commonJS({ + "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { + var fs = require("fs"); + var polyfills = require_polyfills(); + var legacy = require_legacy_streams(); + var clone2 = require_clone(); + var util = require("util"); + var gracefulQueue; + var previousSymbol; + if (typeof Symbol === "function" && typeof Symbol.for === "function") { + gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue"); + previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous"); + } else { + gracefulQueue = "___graceful-fs.queue"; + previousSymbol = "___graceful-fs.previous"; + } + function noop() { + } + function publishQueue(context, queue2) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue2; + } + }); + } + var debug = noop; + if (util.debuglog) + debug = util.debuglog("gfs4"); + else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) + debug = function() { + var m = util.format.apply(util, arguments); + m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); + console.error(m); + }; + if (!fs[gracefulQueue]) { + queue = global[gracefulQueue] || []; + publishQueue(fs, queue); + fs.close = (function(fs$close) { + function close(fd, cb) { + return fs$close.call(fs, fd, function(err2) { + if (!err2) { + resetQueue(); + } + if (typeof cb === "function") + cb.apply(this, arguments); + }); + } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }); + return close; + })(fs.close); + fs.closeSync = (function(fs$closeSync) { + function closeSync(fd) { + fs$closeSync.apply(fs, arguments); + resetQueue(); + } + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }); + return closeSync; + })(fs.closeSync); + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { + process.on("exit", function() { + debug(fs[gracefulQueue]); + require("assert").equal(fs[gracefulQueue].length, 0); + }); + } + } + var queue; + if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); + } + module2.exports = patch(clone2(fs)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module2.exports = patch(fs); + fs.__patched = true; + } + function patch(fs2) { + polyfills(fs2); + fs2.gracefulify = patch; + fs2.createReadStream = createReadStream4; + fs2.createWriteStream = createWriteStream2; + var fs$readFile = fs2.readFile; + fs2.readFile = readFile37; + function readFile37(path, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$readFile(path, options, cb); + function go$readFile(path2, options2, cb2, startTime) { + return fs$readFile(path2, options2, function(err2) { + if (err2 && (err2.code === "EMFILE" || err2.code === "ENFILE")) + enqueue([go$readFile, [path2, options2, cb2], err2, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$writeFile = fs2.writeFile; + fs2.writeFile = writeFile34; + function writeFile34(path, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$writeFile(path, data, options, cb); + function go$writeFile(path2, data2, options2, cb2, startTime) { + return fs$writeFile(path2, data2, options2, function(err2) { + if (err2 && (err2.code === "EMFILE" || err2.code === "ENFILE")) + enqueue([go$writeFile, [path2, data2, options2, cb2], err2, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$appendFile = fs2.appendFile; + if (fs$appendFile) + fs2.appendFile = appendFile; + function appendFile(path, data, options, cb) { + if (typeof options === "function") + cb = options, options = null; + return go$appendFile(path, data, options, cb); + function go$appendFile(path2, data2, options2, cb2, startTime) { + return fs$appendFile(path2, data2, options2, function(err2) { + if (err2 && (err2.code === "EMFILE" || err2.code === "ENFILE")) + enqueue([go$appendFile, [path2, data2, options2, cb2], err2, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$copyFile = fs2.copyFile; + if (fs$copyFile) + fs2.copyFile = copyFile5; + function copyFile5(src, dest, flags, cb) { + if (typeof flags === "function") { + cb = flags; + flags = 0; + } + return go$copyFile(src, dest, flags, cb); + function go$copyFile(src2, dest2, flags2, cb2, startTime) { + return fs$copyFile(src2, dest2, flags2, function(err2) { + if (err2 && (err2.code === "EMFILE" || err2.code === "ENFILE")) + enqueue([go$copyFile, [src2, dest2, flags2, cb2], err2, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$readdir = fs2.readdir; + fs2.readdir = readdir5; + var noReaddirOptionVersions = /^v[0-5]\./; + function readdir5(path, options, cb) { + if (typeof options === "function") + cb = options, options = null; + var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) { + return fs$readdir(path2, fs$readdirCallback( + path2, + options2, + cb2, + startTime + )); + } : function go$readdir2(path2, options2, cb2, startTime) { + return fs$readdir(path2, options2, fs$readdirCallback( + path2, + options2, + cb2, + startTime + )); + }; + return go$readdir(path, options, cb); + function fs$readdirCallback(path2, options2, cb2, startTime) { + return function(err2, files) { + if (err2 && (err2.code === "EMFILE" || err2.code === "ENFILE")) + enqueue([ + go$readdir, + [path2, options2, cb2], + err2, + startTime || Date.now(), + Date.now() + ]); + else { + if (files && files.sort) + files.sort(); + if (typeof cb2 === "function") + cb2.call(this, err2, files); + } + }; + } + } + if (process.version.substr(0, 4) === "v0.8") { + var legStreams = legacy(fs2); + ReadStream = legStreams.ReadStream; + WriteStream = legStreams.WriteStream; + } + var fs$ReadStream = fs2.ReadStream; + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype); + ReadStream.prototype.open = ReadStream$open; + } + var fs$WriteStream = fs2.WriteStream; + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype); + WriteStream.prototype.open = WriteStream$open; + } + Object.defineProperty(fs2, "ReadStream", { + get: function() { + return ReadStream; + }, + set: function(val) { + ReadStream = val; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(fs2, "WriteStream", { + get: function() { + return WriteStream; + }, + set: function(val) { + WriteStream = val; + }, + enumerable: true, + configurable: true + }); + var FileReadStream = ReadStream; + Object.defineProperty(fs2, "FileReadStream", { + get: function() { + return FileReadStream; + }, + set: function(val) { + FileReadStream = val; + }, + enumerable: true, + configurable: true + }); + var FileWriteStream = WriteStream; + Object.defineProperty(fs2, "FileWriteStream", { + get: function() { + return FileWriteStream; + }, + set: function(val) { + FileWriteStream = val; + }, + enumerable: true, + configurable: true + }); + function ReadStream(path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this; + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments); + } + function ReadStream$open() { + var that = this; + open4(that.path, that.flags, that.mode, function(err2, fd) { + if (err2) { + if (that.autoClose) + that.destroy(); + that.emit("error", err2); + } else { + that.fd = fd; + that.emit("open", fd); + that.read(); + } + }); + } + function WriteStream(path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this; + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments); + } + function WriteStream$open() { + var that = this; + open4(that.path, that.flags, that.mode, function(err2, fd) { + if (err2) { + that.destroy(); + that.emit("error", err2); + } else { + that.fd = fd; + that.emit("open", fd); + } + }); + } + function createReadStream4(path, options) { + return new fs2.ReadStream(path, options); + } + function createWriteStream2(path, options) { + return new fs2.WriteStream(path, options); + } + var fs$open = fs2.open; + fs2.open = open4; + function open4(path, flags, mode, cb) { + if (typeof mode === "function") + cb = mode, mode = null; + return go$open(path, flags, mode, cb); + function go$open(path2, flags2, mode2, cb2, startTime) { + return fs$open(path2, flags2, mode2, function(err2, fd) { + if (err2 && (err2.code === "EMFILE" || err2.code === "ENFILE")) + enqueue([go$open, [path2, flags2, mode2, cb2], err2, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + return fs2; + } + function enqueue(elem) { + debug("ENQUEUE", elem[0].name, elem[1]); + fs[gracefulQueue].push(elem); + retry(); + } + var retryTimer; + function resetQueue() { + var now = Date.now(); + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now; + fs[gracefulQueue][i][4] = now; + } + } + retry(); + } + function retry() { + clearTimeout(retryTimer); + retryTimer = void 0; + if (fs[gracefulQueue].length === 0) + return; + var elem = fs[gracefulQueue].shift(); + var fn = elem[0]; + var args = elem[1]; + var err2 = elem[2]; + var startTime = elem[3]; + var lastTime = elem[4]; + if (startTime === void 0) { + debug("RETRY", fn.name, args); + fn.apply(null, args); + } else if (Date.now() - startTime >= 6e4) { + debug("TIMEOUT", fn.name, args); + var cb = args.pop(); + if (typeof cb === "function") + cb.call(null, err2); + } else { + var sinceAttempt = Date.now() - lastTime; + var sinceStart = Math.max(lastTime - startTime, 1); + var desiredDelay = Math.min(sinceStart * 1.2, 100); + if (sinceAttempt >= desiredDelay) { + debug("RETRY", fn.name, args); + fn.apply(null, args.concat([startTime])); + } else { + fs[gracefulQueue].push(elem); + } + } + if (retryTimer === void 0) { + retryTimer = setTimeout(retry, 0); + } + } + } +}); + +// node_modules/retry/lib/retry_operation.js +var require_retry_operation = __commonJS({ + "node_modules/retry/lib/retry_operation.js"(exports2, module2) { + function RetryOperation(timeouts, options) { + if (typeof options === "boolean") { + options = { forever: options }; + } + this._originalTimeouts = JSON.parse(JSON.stringify(timeouts)); + this._timeouts = timeouts; + this._options = options || {}; + this._maxRetryTime = options && options.maxRetryTime || Infinity; + this._fn = null; + this._errors = []; + this._attempts = 1; + this._operationTimeout = null; + this._operationTimeoutCb = null; + this._timeout = null; + this._operationStart = null; + if (this._options.forever) { + this._cachedTimeouts = this._timeouts.slice(0); + } + } + module2.exports = RetryOperation; + RetryOperation.prototype.reset = function() { + this._attempts = 1; + this._timeouts = this._originalTimeouts; + }; + RetryOperation.prototype.stop = function() { + if (this._timeout) { + clearTimeout(this._timeout); + } + this._timeouts = []; + this._cachedTimeouts = null; + }; + RetryOperation.prototype.retry = function(err2) { + if (this._timeout) { + clearTimeout(this._timeout); + } + if (!err2) { + return false; + } + var currentTime = (/* @__PURE__ */ new Date()).getTime(); + if (err2 && currentTime - this._operationStart >= this._maxRetryTime) { + this._errors.unshift(new Error("RetryOperation timeout occurred")); + return false; + } + this._errors.push(err2); + var timeout = this._timeouts.shift(); + if (timeout === void 0) { + if (this._cachedTimeouts) { + this._errors.splice(this._errors.length - 1, this._errors.length); + this._timeouts = this._cachedTimeouts.slice(0); + timeout = this._timeouts.shift(); + } else { + return false; + } + } + var self2 = this; + var timer = setTimeout(function() { + self2._attempts++; + if (self2._operationTimeoutCb) { + self2._timeout = setTimeout(function() { + self2._operationTimeoutCb(self2._attempts); + }, self2._operationTimeout); + if (self2._options.unref) { + self2._timeout.unref(); + } + } + self2._fn(self2._attempts); + }, timeout); + if (this._options.unref) { + timer.unref(); + } + return true; + }; + RetryOperation.prototype.attempt = function(fn, timeoutOps) { + this._fn = fn; + if (timeoutOps) { + if (timeoutOps.timeout) { + this._operationTimeout = timeoutOps.timeout; + } + if (timeoutOps.cb) { + this._operationTimeoutCb = timeoutOps.cb; + } + } + var self2 = this; + if (this._operationTimeoutCb) { + this._timeout = setTimeout(function() { + self2._operationTimeoutCb(); + }, self2._operationTimeout); + } + this._operationStart = (/* @__PURE__ */ new Date()).getTime(); + this._fn(this._attempts); + }; + RetryOperation.prototype.try = function(fn) { + console.log("Using RetryOperation.try() is deprecated"); + this.attempt(fn); + }; + RetryOperation.prototype.start = function(fn) { + console.log("Using RetryOperation.start() is deprecated"); + this.attempt(fn); + }; + RetryOperation.prototype.start = RetryOperation.prototype.try; + RetryOperation.prototype.errors = function() { + return this._errors; + }; + RetryOperation.prototype.attempts = function() { + return this._attempts; + }; + RetryOperation.prototype.mainError = function() { + if (this._errors.length === 0) { + return null; + } + var counts = {}; + var mainError = null; + var mainErrorCount = 0; + for (var i = 0; i < this._errors.length; i++) { + var error2 = this._errors[i]; + var message = error2.message; + var count = (counts[message] || 0) + 1; + counts[message] = count; + if (count >= mainErrorCount) { + mainError = error2; + mainErrorCount = count; + } + } + return mainError; + }; + } +}); + +// node_modules/retry/lib/retry.js +var require_retry = __commonJS({ + "node_modules/retry/lib/retry.js"(exports2) { + var RetryOperation = require_retry_operation(); + exports2.operation = function(options) { + var timeouts = exports2.timeouts(options); + return new RetryOperation(timeouts, { + forever: options && options.forever, + unref: options && options.unref, + maxRetryTime: options && options.maxRetryTime + }); + }; + exports2.timeouts = function(options) { + if (options instanceof Array) { + return [].concat(options); + } + var opts = { + retries: 10, + factor: 2, + minTimeout: 1 * 1e3, + maxTimeout: Infinity, + randomize: false + }; + for (var key in options) { + opts[key] = options[key]; + } + if (opts.minTimeout > opts.maxTimeout) { + throw new Error("minTimeout is greater than maxTimeout"); + } + var timeouts = []; + for (var i = 0; i < opts.retries; i++) { + timeouts.push(this.createTimeout(i, opts)); + } + if (options && options.forever && !timeouts.length) { + timeouts.push(this.createTimeout(i, opts)); + } + timeouts.sort(function(a, b) { + return a - b; + }); + return timeouts; + }; + exports2.createTimeout = function(attempt, opts) { + var random = opts.randomize ? Math.random() + 1 : 1; + var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt)); + timeout = Math.min(timeout, opts.maxTimeout); + return timeout; + }; + exports2.wrap = function(obj, options, methods) { + if (options instanceof Array) { + methods = options; + options = null; + } + if (!methods) { + methods = []; + for (var key in obj) { + if (typeof obj[key] === "function") { + methods.push(key); + } + } + } + for (var i = 0; i < methods.length; i++) { + var method = methods[i]; + var original = obj[method]; + obj[method] = function retryWrapper(original2) { + var op = exports2.operation(options); + var args = Array.prototype.slice.call(arguments, 1); + var callback = args.pop(); + args.push(function(err2) { + if (op.retry(err2)) { + return; + } + if (err2) { + arguments[0] = op.mainError(); + } + callback.apply(this, arguments); + }); + op.attempt(function() { + original2.apply(obj, args); + }); + }.bind(obj, original); + obj[method].options = options; + } + }; + } +}); + +// node_modules/retry/index.js +var require_retry2 = __commonJS({ + "node_modules/retry/index.js"(exports2, module2) { + module2.exports = require_retry(); + } +}); + +// node_modules/signal-exit/signals.js +var require_signals = __commonJS({ + "node_modules/signal-exit/signals.js"(exports2, module2) { + module2.exports = [ + "SIGABRT", + "SIGALRM", + "SIGHUP", + "SIGINT", + "SIGTERM" + ]; + if (process.platform !== "win32") { + module2.exports.push( + "SIGVTALRM", + "SIGXCPU", + "SIGXFSZ", + "SIGUSR2", + "SIGTRAP", + "SIGSYS", + "SIGQUIT", + "SIGIOT" + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ); + } + if (process.platform === "linux") { + module2.exports.push( + "SIGIO", + "SIGPOLL", + "SIGPWR", + "SIGSTKFLT", + "SIGUNUSED" + ); + } + } +}); + +// node_modules/signal-exit/index.js +var require_signal_exit = __commonJS({ + "node_modules/signal-exit/index.js"(exports2, module2) { + var process3 = global.process; + var processOk = function(process4) { + return process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function"; + }; + if (!processOk(process3)) { + module2.exports = function() { + return function() { + }; + }; + } else { + assert2 = require("assert"); + signals = require_signals(); + isWin = /^win/i.test(process3.platform); + EE = require("events"); + if (typeof EE !== "function") { + EE = EE.EventEmitter; + } + if (process3.__signal_exit_emitter__) { + emitter = process3.__signal_exit_emitter__; + } else { + emitter = process3.__signal_exit_emitter__ = new EE(); + emitter.count = 0; + emitter.emitted = {}; + } + if (!emitter.infinite) { + emitter.setMaxListeners(Infinity); + emitter.infinite = true; + } + module2.exports = function(cb, opts) { + if (!processOk(global.process)) { + return function() { + }; + } + assert2.equal(typeof cb, "function", "a callback must be provided for exit handler"); + if (loaded === false) { + load2(); + } + var ev = "exit"; + if (opts && opts.alwaysLast) { + ev = "afterexit"; + } + var remove = function() { + emitter.removeListener(ev, cb); + if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) { + unload(); + } + }; + emitter.on(ev, cb); + return remove; + }; + unload = function unload2() { + if (!loaded || !processOk(global.process)) { + return; + } + loaded = false; + signals.forEach(function(sig) { + try { + process3.removeListener(sig, sigListeners[sig]); + } catch (er) { + } + }); + process3.emit = originalProcessEmit; + process3.reallyExit = originalProcessReallyExit; + emitter.count -= 1; + }; + module2.exports.unload = unload; + emit = function emit2(event, code, signal) { + if (emitter.emitted[event]) { + return; + } + emitter.emitted[event] = true; + emitter.emit(event, code, signal); + }; + sigListeners = {}; + signals.forEach(function(sig) { + sigListeners[sig] = function listener() { + if (!processOk(global.process)) { + return; + } + var listeners = process3.listeners(sig); + if (listeners.length === emitter.count) { + unload(); + emit("exit", null, sig); + emit("afterexit", null, sig); + if (isWin && sig === "SIGHUP") { + sig = "SIGINT"; + } + process3.kill(process3.pid, sig); + } + }; + }); + module2.exports.signals = function() { + return signals; + }; + loaded = false; + load2 = function load3() { + if (loaded || !processOk(global.process)) { + return; + } + loaded = true; + emitter.count += 1; + signals = signals.filter(function(sig) { + try { + process3.on(sig, sigListeners[sig]); + return true; + } catch (er) { + return false; + } + }); + process3.emit = processEmit; + process3.reallyExit = processReallyExit; + }; + module2.exports.load = load2; + originalProcessReallyExit = process3.reallyExit; + processReallyExit = function processReallyExit2(code) { + if (!processOk(global.process)) { + return; + } + process3.exitCode = code || /* istanbul ignore next */ + 0; + emit("exit", process3.exitCode, null); + emit("afterexit", process3.exitCode, null); + originalProcessReallyExit.call(process3, process3.exitCode); + }; + originalProcessEmit = process3.emit; + processEmit = function processEmit2(ev, arg) { + if (ev === "exit" && processOk(global.process)) { + if (arg !== void 0) { + process3.exitCode = arg; + } + var ret = originalProcessEmit.apply(this, arguments); + emit("exit", process3.exitCode, null); + emit("afterexit", process3.exitCode, null); + return ret; + } else { + return originalProcessEmit.apply(this, arguments); + } + }; + } + var assert2; + var signals; + var isWin; + var EE; + var emitter; + var unload; + var emit; + var sigListeners; + var loaded; + var load2; + var originalProcessReallyExit; + var processReallyExit; + var originalProcessEmit; + var processEmit; + } +}); + +// node_modules/proper-lockfile/lib/mtime-precision.js +var require_mtime_precision = __commonJS({ + "node_modules/proper-lockfile/lib/mtime-precision.js"(exports2, module2) { + "use strict"; + var cacheSymbol = /* @__PURE__ */ Symbol(); + function probe(file, fs, callback) { + const cachedPrecision = fs[cacheSymbol]; + if (cachedPrecision) { + return fs.stat(file, (err2, stat30) => { + if (err2) { + return callback(err2); + } + callback(null, stat30.mtime, cachedPrecision); + }); + } + const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5); + fs.utimes(file, mtime, mtime, (err2) => { + if (err2) { + return callback(err2); + } + fs.stat(file, (err3, stat30) => { + if (err3) { + return callback(err3); + } + const precision = stat30.mtime.getTime() % 1e3 === 0 ? "s" : "ms"; + Object.defineProperty(fs, cacheSymbol, { value: precision }); + callback(null, stat30.mtime, precision); + }); + }); + } + function getMtime(precision) { + let now = Date.now(); + if (precision === "s") { + now = Math.ceil(now / 1e3) * 1e3; + } + return new Date(now); + } + module2.exports.probe = probe; + module2.exports.getMtime = getMtime; + } +}); + +// node_modules/proper-lockfile/lib/lockfile.js +var require_lockfile = __commonJS({ + "node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) { + "use strict"; + var path = require("path"); + var fs = require_graceful_fs(); + var retry = require_retry2(); + var onExit = require_signal_exit(); + var mtimePrecision = require_mtime_precision(); + var locks = {}; + function getLockFile(file, options) { + return options.lockfilePath || `${file}.lock`; + } + function resolveCanonicalPath(file, options, callback) { + if (!options.realpath) { + return callback(null, path.resolve(file)); + } + options.fs.realpath(file, callback); + } + function acquireLock(file, options, callback) { + const lockfilePath = getLockFile(file, options); + options.fs.mkdir(lockfilePath, (err2) => { + if (!err2) { + return mtimePrecision.probe(lockfilePath, options.fs, (err3, mtime, mtimePrecision2) => { + if (err3) { + options.fs.rmdir(lockfilePath, () => { + }); + return callback(err3); + } + callback(null, mtime, mtimePrecision2); + }); + } + if (err2.code !== "EEXIST") { + return callback(err2); + } + if (options.stale <= 0) { + return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file })); + } + options.fs.stat(lockfilePath, (err3, stat30) => { + if (err3) { + if (err3.code === "ENOENT") { + return acquireLock(file, { ...options, stale: 0 }, callback); + } + return callback(err3); + } + if (!isLockStale(stat30, options)) { + return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file })); + } + removeLock(file, options, (err4) => { + if (err4) { + return callback(err4); + } + acquireLock(file, { ...options, stale: 0 }, callback); + }); + }); + }); + } + function isLockStale(stat30, options) { + return stat30.mtime.getTime() < Date.now() - options.stale; + } + function removeLock(file, options, callback) { + options.fs.rmdir(getLockFile(file, options), (err2) => { + if (err2 && err2.code !== "ENOENT") { + return callback(err2); + } + callback(); + }); + } + function updateLock(file, options) { + const lock2 = locks[file]; + if (lock2.updateTimeout) { + return; + } + lock2.updateDelay = lock2.updateDelay || options.update; + lock2.updateTimeout = setTimeout(() => { + lock2.updateTimeout = null; + options.fs.stat(lock2.lockfilePath, (err2, stat30) => { + const isOverThreshold = lock2.lastUpdate + options.stale < Date.now(); + if (err2) { + if (err2.code === "ENOENT" || isOverThreshold) { + return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" })); + } + lock2.updateDelay = 1e3; + return updateLock(file, options); + } + const isMtimeOurs = lock2.mtime.getTime() === stat30.mtime.getTime(); + if (!isMtimeOurs) { + return setLockAsCompromised( + file, + lock2, + Object.assign( + new Error("Unable to update lock within the stale threshold"), + { code: "ECOMPROMISED" } + ) + ); + } + const mtime = mtimePrecision.getMtime(lock2.mtimePrecision); + options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err3) => { + const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now(); + if (lock2.released) { + return; + } + if (err3) { + if (err3.code === "ENOENT" || isOverThreshold2) { + return setLockAsCompromised(file, lock2, Object.assign(err3, { code: "ECOMPROMISED" })); + } + lock2.updateDelay = 1e3; + return updateLock(file, options); + } + lock2.mtime = mtime; + lock2.lastUpdate = Date.now(); + lock2.updateDelay = null; + updateLock(file, options); + }); + }); + }, lock2.updateDelay); + if (lock2.updateTimeout.unref) { + lock2.updateTimeout.unref(); + } + } + function setLockAsCompromised(file, lock2, err2) { + lock2.released = true; + if (lock2.updateTimeout) { + clearTimeout(lock2.updateTimeout); + } + if (locks[file] === lock2) { + delete locks[file]; + } + lock2.options.onCompromised(err2); + } + function lock(file, options, callback) { + options = { + stale: 1e4, + update: null, + realpath: true, + retries: 0, + fs, + onCompromised: (err2) => { + throw err2; + }, + ...options + }; + options.retries = options.retries || 0; + options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries; + options.stale = Math.max(options.stale || 0, 2e3); + options.update = options.update == null ? options.stale / 2 : options.update || 0; + options.update = Math.max(Math.min(options.update, options.stale / 2), 1e3); + resolveCanonicalPath(file, options, (err2, file2) => { + if (err2) { + return callback(err2); + } + const operation = retry.operation(options.retries); + operation.attempt(() => { + acquireLock(file2, options, (err3, mtime, mtimePrecision2) => { + if (operation.retry(err3)) { + return; + } + if (err3) { + return callback(operation.mainError()); + } + const lock2 = locks[file2] = { + lockfilePath: getLockFile(file2, options), + mtime, + mtimePrecision: mtimePrecision2, + options, + lastUpdate: Date.now() + }; + updateLock(file2, options); + callback(null, (releasedCallback) => { + if (lock2.released) { + return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" })); + } + unlock(file2, { ...options, realpath: false }, releasedCallback); + }); + }); + }); + }); + } + function unlock(file, options, callback) { + options = { + fs, + realpath: true, + ...options + }; + resolveCanonicalPath(file, options, (err2, file2) => { + if (err2) { + return callback(err2); + } + const lock2 = locks[file2]; + if (!lock2) { + return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" })); + } + lock2.updateTimeout && clearTimeout(lock2.updateTimeout); + lock2.released = true; + delete locks[file2]; + removeLock(file2, options, callback); + }); + } + function check(file, options, callback) { + options = { + stale: 1e4, + realpath: true, + fs, + ...options + }; + options.stale = Math.max(options.stale || 0, 2e3); + resolveCanonicalPath(file, options, (err2, file2) => { + if (err2) { + return callback(err2); + } + options.fs.stat(getLockFile(file2, options), (err3, stat30) => { + if (err3) { + return err3.code === "ENOENT" ? callback(null, false) : callback(err3); + } + return callback(null, !isLockStale(stat30, options)); + }); + }); + } + function getLocks() { + return locks; + } + onExit(() => { + for (const file in locks) { + const options = locks[file].options; + try { + options.fs.rmdirSync(getLockFile(file, options)); + } catch (e) { + } + } + }); + module2.exports.lock = lock; + module2.exports.unlock = unlock; + module2.exports.check = check; + module2.exports.getLocks = getLocks; + } +}); + +// node_modules/proper-lockfile/lib/adapter.js +var require_adapter = __commonJS({ + "node_modules/proper-lockfile/lib/adapter.js"(exports2, module2) { + "use strict"; + var fs = require_graceful_fs(); + function createSyncFs(fs2) { + const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"]; + const newFs = { ...fs2 }; + methods.forEach((method) => { + newFs[method] = (...args) => { + const callback = args.pop(); + let ret; + try { + ret = fs2[`${method}Sync`](...args); + } catch (err2) { + return callback(err2); + } + callback(null, ret); + }; + }); + return newFs; + } + function toPromise(method) { + return (...args) => new Promise((resolve41, reject) => { + args.push((err2, result) => { + if (err2) { + reject(err2); + } else { + resolve41(result); + } + }); + method(...args); + }); + } + function toSync(method) { + return (...args) => { + let err2; + let result; + args.push((_err, _result) => { + err2 = _err; + result = _result; + }); + method(...args); + if (err2) { + throw err2; + } + return result; + }; + } + function toSyncOptions(options) { + options = { ...options }; + options.fs = createSyncFs(options.fs || fs); + if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) { + throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" }); + } + return options; + } + module2.exports = { + toPromise, + toSync, + toSyncOptions + }; + } +}); + +// node_modules/proper-lockfile/index.js +var require_proper_lockfile = __commonJS({ + "node_modules/proper-lockfile/index.js"(exports2, module2) { + "use strict"; + var lockfile = require_lockfile(); + var { toPromise, toSync, toSyncOptions } = require_adapter(); + async function lock(file, options) { + const release = await toPromise(lockfile.lock)(file, options); + return toPromise(release); + } + function lockSync(file, options) { + const release = toSync(lockfile.lock)(file, toSyncOptions(options)); + return toSync(release); + } + function unlock(file, options) { + return toPromise(lockfile.unlock)(file, options); + } + function unlockSync(file, options) { + return toSync(lockfile.unlock)(file, toSyncOptions(options)); + } + function check(file, options) { + return toPromise(lockfile.check)(file, options); + } + function checkSync(file, options) { + return toSync(lockfile.check)(file, toSyncOptions(options)); + } + module2.exports = lock; + module2.exports.lock = lock; + module2.exports.unlock = unlock; + module2.exports.lockSync = lockSync; + module2.exports.unlockSync = unlockSync; + module2.exports.check = check; + module2.exports.checkSync = checkSync; + } +}); + +// node_modules/tus-js-client/lib.es5/node/urlStorage.js +var require_urlStorage = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/urlStorage.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.canStoreURLs = exports2.FileUrlStorage = void 0; + var _fs = require("fs"); + var _combineErrors = _interopRequireDefault(require_combine_errors()); + var lockfile = _interopRequireWildcard(require_proper_lockfile()); + function _getRequireWildcardCache(e) { + if ("function" != typeof WeakMap) return null; + var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(); + return (_getRequireWildcardCache = function(e2) { + return e2 ? t : r; + })(e); + } + function _interopRequireWildcard(e, r) { + if (!r && e && e.__esModule) return e; + if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; + var t = _getRequireWildcardCache(r); + if (t && t.has(e)) return t.get(e); + var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { + var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; + i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; + } + return n.default = e, t && t.set(e, n), n; + } + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var canStoreURLs = exports2.canStoreURLs = true; + var FileUrlStorage2 = exports2.FileUrlStorage = /* @__PURE__ */ (function() { + function FileUrlStorage3(filePath) { + _classCallCheck(this, FileUrlStorage3); + this.path = filePath; + } + return _createClass(FileUrlStorage3, [{ + key: "findAllUploads", + value: function findAllUploads() { + var _this = this; + return new Promise(function(resolve41, reject) { + _this._getItems("tus::", function(err2, results) { + if (err2) reject(err2); + else resolve41(results); + }); + }); + } + }, { + key: "findUploadsByFingerprint", + value: function findUploadsByFingerprint(fingerprint) { + var _this2 = this; + return new Promise(function(resolve41, reject) { + _this2._getItems("tus::".concat(fingerprint), function(err2, results) { + if (err2) reject(err2); + else resolve41(results); + }); + }); + } + }, { + key: "removeUpload", + value: function removeUpload(urlStorageKey) { + var _this3 = this; + return new Promise(function(resolve41, reject) { + _this3._removeItem(urlStorageKey, function(err2) { + if (err2) reject(err2); + else resolve41(); + }); + }); + } + }, { + key: "addUpload", + value: function addUpload(fingerprint, upload) { + var _this4 = this; + var id = Math.round(Math.random() * 1e12); + var key = "tus::".concat(fingerprint, "::").concat(id); + return new Promise(function(resolve41, reject) { + _this4._setItem(key, upload, function(err2) { + if (err2) reject(err2); + else resolve41(key); + }); + }); + } + }, { + key: "_setItem", + value: function _setItem(key, value2, cb) { + var _this5 = this; + lockfile.lock(this.path, this._lockfileOptions()).then(function(release) { + cb = _this5._releaseAndCb(release, cb); + _this5._getData(function(err2, data) { + if (err2) { + cb(err2); + return; + } + data[key] = value2; + _this5._writeData(data, function(err22) { + return cb(err22); + }); + }); + })["catch"](cb); + } + }, { + key: "_getItems", + value: function _getItems(prefix, cb) { + this._getData(function(err2, data) { + if (err2) { + cb(err2); + return; + } + var results = Object.keys(data).filter(function(key) { + return key.startsWith(prefix); + }).map(function(key) { + var obj = data[key]; + obj.urlStorageKey = key; + return obj; + }); + cb(null, results); + }); + } + }, { + key: "_removeItem", + value: function _removeItem(key, cb) { + var _this6 = this; + lockfile.lock(this.path, this._lockfileOptions()).then(function(release) { + cb = _this6._releaseAndCb(release, cb); + _this6._getData(function(err2, data) { + if (err2) { + cb(err2); + return; + } + delete data[key]; + _this6._writeData(data, function(err22) { + return cb(err22); + }); + }); + })["catch"](cb); + } + }, { + key: "_lockfileOptions", + value: function _lockfileOptions() { + return { + realpath: false, + retries: { + retries: 5, + minTimeout: 20 + } + }; + } + }, { + key: "_releaseAndCb", + value: function _releaseAndCb(release, cb) { + return function(err2) { + if (err2) { + release().then(function() { + return cb(err2); + })["catch"](function(releaseErr) { + return cb((0, _combineErrors.default)([err2, releaseErr])); + }); + return; + } + release().then(cb)["catch"](cb); + }; + } + }, { + key: "_writeData", + value: function _writeData(data, cb) { + var opts = { + encoding: "utf8", + mode: 432, + flag: "w" + }; + (0, _fs.writeFile)(this.path, JSON.stringify(data), opts, function(err2) { + return cb(err2); + }); + } + }, { + key: "_getData", + value: function _getData(cb) { + (0, _fs.readFile)(this.path, "utf8", function(err2, data) { + if (err2) { + if (err2.code === "ENOENT") cb(null, {}); + else cb(err2); + return; + } + try { + data = !data.trim().length ? {} : JSON.parse(data); + } catch (error2) { + cb(error2); + return; + } + cb(null, data); + }); + } + }]); + })(); + } +}); + +// node_modules/tus-js-client/lib.es5/node/index.js +var require_node = __commonJS({ + "node_modules/tus-js-client/lib.es5/node/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + Object.defineProperty(exports2, "DefaultHttpStack", { + enumerable: true, + get: function() { + return _httpStack.default; + } + }); + Object.defineProperty(exports2, "DetailedError", { + enumerable: true, + get: function() { + return _error.default; + } + }); + Object.defineProperty(exports2, "FileUrlStorage", { + enumerable: true, + get: function() { + return _urlStorage.FileUrlStorage; + } + }); + Object.defineProperty(exports2, "StreamSource", { + enumerable: true, + get: function() { + return _StreamSource.default; + } + }); + exports2.Upload = void 0; + Object.defineProperty(exports2, "canStoreURLs", { + enumerable: true, + get: function() { + return _urlStorage.canStoreURLs; + } + }); + exports2.defaultOptions = void 0; + Object.defineProperty(exports2, "enableDebugLog", { + enumerable: true, + get: function() { + return _logger.enableDebugLog; + } + }); + exports2.isSupported = void 0; + var _error = _interopRequireDefault(require_error()); + var _logger = require_logger(); + var _noopUrlStorage = _interopRequireDefault(require_noopUrlStorage()); + var _upload = _interopRequireDefault(require_upload()); + var _fileReader = _interopRequireDefault(require_fileReader()); + var _fileSignature = _interopRequireDefault(require_fileSignature()); + var _httpStack = _interopRequireDefault(require_httpStack()); + var _StreamSource = _interopRequireDefault(require_StreamSource()); + var _urlStorage = require_urlStorage(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _possibleConstructorReturn(self2, call) { + if (call && (_typeof(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return _assertThisInitialized(self2); + } + function _assertThisInitialized(self2) { + if (self2 === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self2; + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + } catch (t2) { + } + return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() { + return !!t; + })(); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { + return o2.__proto__ || Object.getPrototypeOf(o2); + }; + return _getPrototypeOf(o); + } + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { + o2.__proto__ = p2; + return o2; + }; + return _setPrototypeOf(o, p); + } + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { + _defineProperty(e, r2, t[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); + }); + } + return e; + } + function _defineProperty(obj, key, value2) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value2, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value2; + } + return obj; + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; + } + function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + var defaultOptions = exports2.defaultOptions = _objectSpread(_objectSpread({}, _upload.default.defaultOptions), {}, { + httpStack: new _httpStack.default(), + fileReader: new _fileReader.default(), + urlStorage: new _noopUrlStorage.default(), + fingerprint: _fileSignature.default + }); + var Upload2 = exports2.Upload = /* @__PURE__ */ (function(_BaseUpload) { + function Upload3() { + var file = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + _classCallCheck(this, Upload3); + options = _objectSpread(_objectSpread({}, defaultOptions), options); + return _callSuper(this, Upload3, [file, options]); + } + _inherits(Upload3, _BaseUpload); + return _createClass(Upload3, null, [{ + key: "terminate", + value: function terminate(url) { + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + options = _objectSpread(_objectSpread({}, defaultOptions), options); + return _upload.default.terminate(url, options); + } + }]); + })(_upload.default); + var isSupported = exports2.isSupported = true; + } +}); + +// lib/direct-mcp.mjs +var import_promises47 = require("node:fs/promises"); +var import_node_path46 = require("node:path"); + +// apps/filmcraft/native-package.mjs +var import_promises = require("node:fs/promises"); +var import_node_fs = require("node:fs"); +var import_node_path = require("node:path"); + +// node_modules/lossless-json/lib/esm/utils.js +function isInteger(value2) { + return INTEGER_REGEX.test(value2); +} +var INTEGER_REGEX = /^-?[0-9]+$/; +function isNumber(value2) { + return NUMBER_REGEX.test(value2); +} +var NUMBER_REGEX = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/; +function isSafeNumber(value2, config3) { + if (isInteger(value2)) { + return Number.isSafeInteger(Number.parseInt(value2, 10)); + } + const num = Number.parseFloat(value2); + if (Number.isInteger(num) && !Number.isSafeInteger(num)) { + return false; + } + const parsed = String(num); + if (value2 === parsed) { + return true; + } + const valueDigits = extractSignificantDigits(value2); + const parsedDigits = extractSignificantDigits(parsed); + if (valueDigits === parsedDigits) { + return true; + } + if (config3?.approx === true) { + const requiredDigits = 14; + if (parsedDigits.length >= requiredDigits && valueDigits.startsWith(parsedDigits.substring(0, requiredDigits))) { + return true; + } + } + return false; +} +var UnsafeNumberReason = /* @__PURE__ */ (function(UnsafeNumberReason2) { + UnsafeNumberReason2["underflow"] = "underflow"; + UnsafeNumberReason2["overflow"] = "overflow"; + UnsafeNumberReason2["truncate_integer"] = "truncate_integer"; + UnsafeNumberReason2["truncate_float"] = "truncate_float"; + return UnsafeNumberReason2; +})({}); +function getUnsafeNumberReason(value2) { + if (isSafeNumber(value2, { + approx: false + })) { + return void 0; + } + if (isInteger(value2)) { + return UnsafeNumberReason.truncate_integer; + } + const num = Number.parseFloat(value2); + if (!Number.isFinite(num)) { + return UnsafeNumberReason.overflow; + } + if (num === 0) { + return UnsafeNumberReason.underflow; + } + return UnsafeNumberReason.truncate_float; +} +function extractSignificantDigits(value2) { + const { + start, + end + } = getSignificantDigitRange(value2); + const digits = value2.substring(start, end); + const dot = digits.indexOf("."); + if (dot === -1) { + return digits; + } + return digits.substring(0, dot) + digits.substring(dot + 1); +} +function getSignificantDigitRange(value2) { + let start = 0; + if (value2[0] === "-") { + start++; + } + while (value2[start] === "0" || value2[start] === ".") { + start++; + } + let end = value2.lastIndexOf("e"); + if (end === -1) { + end = value2.lastIndexOf("E"); + } + if (end === -1) { + end = value2.length; + } + while ((value2[end - 1] === "0" || value2[end - 1] === ".") && end > start) { + end--; + } + return { + start, + end + }; +} + +// node_modules/lossless-json/lib/esm/LosslessNumber.js +var losslessNumberMarker = /* @__PURE__ */ Symbol.for("lossless-json.LosslessNumber"); +var LosslessNumber = class { + // numeric value as string + value; + /** + * @deprecated Use the isLosslessNumber(value) function instead. + * + * Ordinary objects may also have an isLosslessNumber property, so this + * field cannot reliably identify lossless numbers. + */ + isLosslessNumber = true; + get [losslessNumberMarker]() { + return true; + } + constructor(value2) { + if (!isNumber(value2)) { + throw new Error(`Invalid number (value: "${value2}")`); + } + this.value = value2; + } + /** + * Get the value of the LosslessNumber as number or bigint. + * + * - a number is returned for safe numbers and decimal values that only lose some insignificant digits + * - a bigint is returned for big integer numbers + * - an Error is thrown for values that will overflow or underflow + * + * Note that you can implement your own strategy for conversion by just getting the value as string + * via .toString(), and using util functions like isInteger, isSafeNumber, getUnsafeNumberReason, + * and toSafeNumberOrThrow to convert it to a numeric value. + */ + valueOf() { + const unsafeReason = getUnsafeNumberReason(this.value); + if (unsafeReason === void 0 || unsafeReason === UnsafeNumberReason.truncate_float) { + return Number.parseFloat(this.value); + } + if (isInteger(this.value)) { + return BigInt(this.value); + } + throw new Error(`Cannot safely convert to number: the value '${this.value}' would ${unsafeReason} and become ${Number.parseFloat(this.value)}`); + } + /** + * Get the value of the LosslessNumber as string. + */ + toString() { + return this.value; + } + // Note: we do NOT implement a .toJSON() method, and you should not implement + // or use that, it cannot safely turn the numeric value in the string into + // stringified JSON since it has to be parsed into a number first. +}; +function isLosslessNumber(value2) { + return value2 !== null && typeof value2 === "object" && value2[losslessNumberMarker] === true; +} + +// node_modules/lossless-json/lib/esm/numberParsers.js +function parseLosslessNumber(value2) { + return new LosslessNumber(value2); +} + +// node_modules/lossless-json/lib/esm/revive.js +function revive(json, reviver) { + return reviveValue({ + "": json + }, "", json, reviver); +} +function reviveValue(context, key, value2, reviver) { + if (Array.isArray(value2)) { + return reviver.call(context, key, reviveArray(value2, reviver)); + } + if (value2 && typeof value2 === "object" && !isLosslessNumber(value2)) { + return reviver.call(context, key, reviveObject(value2, reviver)); + } + return reviver.call(context, key, value2); +} +function reviveObject(object8, reviver) { + for (const key of Object.keys(object8)) { + const value2 = reviveValue(object8, key, object8[key], reviver); + if (value2 !== void 0) { + object8[key] = value2; + } else { + delete object8[key]; + } + } + return object8; +} +function reviveArray(array2, reviver) { + for (let i = 0; i < array2.length; i++) { + const value2 = reviveValue(array2, String(i), array2[i], reviver); + if (value2 === void 0) { + delete array2[i]; + } else { + array2[i] = value2; + } + } + return array2; +} + +// node_modules/lossless-json/lib/esm/parse.js +function parse(text, reviver, options) { + const optionsObj = typeof options === "function" ? { + parseNumber: options + } : options; + const parseNumber = optionsObj?.parseNumber ?? parseLosslessNumber; + const onDuplicateKey = optionsObj?.onDuplicateKey ?? throwDuplicateKey; + let i = 0; + const value2 = parseValue(); + expectValue(value2); + expectEndOfInput(); + return reviver ? revive(value2, reviver) : value2; + function parseObject() { + if (text.charCodeAt(i) === codeOpeningBrace) { + i++; + skipWhitespace(); + const object8 = {}; + let initial = true; + while (i < text.length && text.charCodeAt(i) !== codeClosingBrace) { + if (!initial) { + eatComma(); + skipWhitespace(); + } else { + initial = false; + } + const start = i; + const key = parseString(); + if (key === void 0) { + throwObjectKeyExpected(); + return; + } + skipWhitespace(); + eatColon(); + const value3 = parseValue(); + if (value3 === void 0) { + throwObjectValueExpected(); + return; + } + if (Object.prototype.hasOwnProperty.call(object8, key) && !isDeepEqual(value3, object8[key])) { + const returnedValue = onDuplicateKey({ + key, + position: start + 1, + oldValue: object8[key], + newValue: value3 + }); + if (returnedValue !== void 0) { + setObjectKey(object8, key, returnedValue); + } + } else { + setObjectKey(object8, key, value3); + } + } + if (text.charCodeAt(i) !== codeClosingBrace) { + throwObjectKeyOrEndExpected(); + } + i++; + return object8; + } + } + function parseArray() { + if (text.charCodeAt(i) === codeOpeningBracket) { + i++; + skipWhitespace(); + const array2 = []; + let initial = true; + while (i < text.length && text.charCodeAt(i) !== codeClosingBracket) { + if (!initial) { + eatComma(); + } else { + initial = false; + } + const value3 = parseValue(); + expectArrayItem(value3); + array2.push(value3); + } + if (text.charCodeAt(i) !== codeClosingBracket) { + throwArrayItemOrEndExpected(); + } + i++; + return array2; + } + } + function parseValue() { + skipWhitespace(); + const value3 = parseString() ?? parseNumeric() ?? parseObject() ?? parseArray() ?? parseKeyword("true", true) ?? parseKeyword("false", false) ?? parseKeyword("null", null); + skipWhitespace(); + return value3; + } + function parseKeyword(name, value3) { + if (text.slice(i, i + name.length) === name) { + i += name.length; + return value3; + } + } + function skipWhitespace() { + while (isWhitespace(text.charCodeAt(i))) { + i++; + } + } + function parseString() { + if (text.charCodeAt(i) === codeDoubleQuote) { + i++; + let result = ""; + while (i < text.length && text.charCodeAt(i) !== codeDoubleQuote) { + if (text.charCodeAt(i) === codeBackslash) { + const char = text[i + 1]; + const escapeChar = escapeCharacters[char]; + if (escapeChar !== void 0) { + result += escapeChar; + i++; + } else if (char === "u") { + if (isHex(text.charCodeAt(i + 2)) && isHex(text.charCodeAt(i + 3)) && isHex(text.charCodeAt(i + 4)) && isHex(text.charCodeAt(i + 5))) { + result += String.fromCharCode(Number.parseInt(text.slice(i + 2, i + 6), 16)); + i += 5; + } else { + throwInvalidUnicodeCharacter(i); + } + } else { + throwInvalidEscapeCharacter(i); + } + } else { + if (isValidStringCharacter(text.charCodeAt(i))) { + result += text[i]; + } else { + throwInvalidCharacter(text[i]); + } + } + i++; + } + expectEndOfString(); + i++; + return result; + } + } + function parseNumeric() { + const start = i; + if (text.charCodeAt(i) === codeMinus) { + i++; + expectDigit(start); + } + if (text.charCodeAt(i) === codeZero) { + i++; + } else if (isNonZeroDigit(text.charCodeAt(i))) { + i++; + while (isDigit(text.charCodeAt(i))) { + i++; + } + } else { + return void 0; + } + if (text.charCodeAt(i) === codeDot) { + i++; + expectDigit(start); + while (isDigit(text.charCodeAt(i))) { + i++; + } + } + if (text.charCodeAt(i) === codeLowercaseE || text.charCodeAt(i) === codeUppercaseE) { + i++; + if (text.charCodeAt(i) === codeMinus || text.charCodeAt(i) === codePlus) { + i++; + } + expectDigit(start); + while (isDigit(text.charCodeAt(i))) { + i++; + } + } + if (i > start) { + return parseNumber(text.slice(start, i)); + } + } + function eatComma() { + if (text.charCodeAt(i) !== codeComma) { + throw new SyntaxError(`Comma ',' expected after value ${gotAt()}`); + } + i++; + } + function eatColon() { + if (text.charCodeAt(i) !== codeColon) { + throw new SyntaxError(`Colon ':' expected after property name ${gotAt()}`); + } + i++; + } + function expectValue(value3) { + if (value3 === void 0) { + throw new SyntaxError(`JSON value expected ${gotAt()}`); + } + } + function expectArrayItem(value3) { + if (value3 === void 0) { + throw new SyntaxError(`Array item expected ${gotAt()}`); + } + } + function expectEndOfInput() { + if (i < text.length) { + throw new SyntaxError(`Expected end of input ${gotAt()}`); + } + } + function expectDigit(start) { + if (!isDigit(text.charCodeAt(i))) { + const numSoFar = text.slice(start, i); + throw new SyntaxError(`Invalid number '${numSoFar}', expecting a digit ${gotAt()}`); + } + } + function expectEndOfString() { + if (text.charCodeAt(i) !== codeDoubleQuote) { + throw new SyntaxError(`End of string '"' expected ${gotAt()}`); + } + } + function throwObjectKeyExpected() { + throw new SyntaxError(`Quoted object key expected ${gotAt()}`); + } + function throwDuplicateKey({ + key, + position + }) { + throw new SyntaxError(`Duplicate key '${key}' encountered at position ${position}`); + } + function throwObjectKeyOrEndExpected() { + throw new SyntaxError(`Quoted object key or end of object '}' expected ${gotAt()}`); + } + function throwArrayItemOrEndExpected() { + throw new SyntaxError(`Array item or end of array ']' expected ${gotAt()}`); + } + function throwInvalidCharacter(char) { + throw new SyntaxError(`Invalid character '${char}' ${pos()}`); + } + function throwInvalidEscapeCharacter(start) { + const chars = text.slice(start, start + 2); + throw new SyntaxError(`Invalid escape character '${chars}' ${pos()}`); + } + function throwObjectValueExpected() { + throw new SyntaxError(`Object value expected after ':' ${pos()}`); + } + function throwInvalidUnicodeCharacter(start) { + const chars = text.slice(start, start + 6); + throw new SyntaxError(`Invalid unicode character '${chars}' ${pos()}`); + } + function pos() { + return `at position ${i}`; + } + function got() { + return i < text.length ? `but got '${text[i]}'` : "but reached end of input"; + } + function gotAt() { + return `${got()} ${pos()}`; + } +} +function setObjectKey(object8, key, value2) { + if (key === "__proto__") { + Object.defineProperty(object8, key, { + value: value2, + writable: true, + enumerable: true, + configurable: true + }); + } else { + object8[key] = value2; + } +} +function isWhitespace(code) { + return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn; +} +function isHex(code) { + return code >= codeZero && code <= codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; +} +function isDigit(code) { + return code >= codeZero && code <= codeNine; +} +function isNonZeroDigit(code) { + return code >= codeOne && code <= codeNine; +} +function isValidStringCharacter(code) { + return code >= 32 && code <= 1114111; +} +function isDeepEqual(a, b) { + if (a === b) { + return true; + } + if (Array.isArray(a) && Array.isArray(b)) { + return a.length === b.length && a.every((item, index) => isDeepEqual(item, b[index])); + } + if (isObject(a) && isObject(b)) { + const keys3 = [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])]; + return keys3.every((key) => isDeepEqual(a[key], b[key])); + } + return false; +} +function isObject(value2) { + return typeof value2 === "object" && value2 !== null; +} +var escapeCharacters = { + '"': '"', + "\\": "\\", + "/": "/", + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: " " + // note that \u is handled separately in parseString() +}; +var codeBackslash = 92; +var codeOpeningBrace = 123; +var codeClosingBrace = 125; +var codeOpeningBracket = 91; +var codeClosingBracket = 93; +var codeSpace = 32; +var codeNewline = 10; +var codeTab = 9; +var codeReturn = 13; +var codeDoubleQuote = 34; +var codePlus = 43; +var codeMinus = 45; +var codeZero = 48; +var codeOne = 49; +var codeNine = 57; +var codeComma = 44; +var codeDot = 46; +var codeColon = 58; +var codeUppercaseA = 65; +var codeLowercaseA = 97; +var codeUppercaseE = 69; +var codeLowercaseE = 101; +var codeUppercaseF = 70; +var codeLowercaseF = 102; + +// node_modules/lossless-json/lib/esm/stringify.js +function stringify(value2, replacer, space, numberStringifiers) { + const resolvedSpace = resolveSpace(space); + const replacedValue = typeof replacer === "function" ? replacer.call({ + "": value2 + }, "", value2) : value2; + return stringifyValue(replacedValue, ""); + function stringifyValue(value3, indent) { + if (Array.isArray(numberStringifiers)) { + const stringifier = numberStringifiers.find((item) => item.test(value3)); + if (stringifier) { + const str = stringifier.stringify(value3); + if (typeof str !== "string" || !isNumber(str)) { + throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${str})`); + } + return str; + } + } + if (typeof value3 === "boolean" || typeof value3 === "number" || typeof value3 === "string" || value3 === null || value3 instanceof Date || value3 instanceof Boolean || value3 instanceof Number || value3 instanceof String) { + return JSON.stringify(value3); + } + if (isLosslessNumber(value3)) { + return value3.toString(); + } + if (typeof value3 === "bigint") { + return value3.toString(); + } + if (Array.isArray(value3)) { + return stringifyArray(value3, indent); + } + if (value3 && typeof value3 === "object") { + return stringifyObject(value3, indent); + } + return void 0; + } + function stringifyArray(array2, indent) { + if (array2.length === 0) { + return "[]"; + } + const childIndent = resolvedSpace ? indent + resolvedSpace : void 0; + let str = resolvedSpace ? "[\n" : "["; + for (let i = 0; i < array2.length; i++) { + const item = typeof replacer === "function" ? replacer.call(array2, String(i), array2[i]) : array2[i]; + if (resolvedSpace) { + str += childIndent; + } + if (typeof item !== "undefined" && typeof item !== "function") { + const serialized = stringifyValue(item, childIndent); + str += serialized === void 0 ? "null" : serialized; + } else { + str += "null"; + } + if (i < array2.length - 1) { + str += resolvedSpace ? ",\n" : ","; + } + } + str += resolvedSpace ? ` +${indent}]` : "]"; + return str; + } + function stringifyObject(object8, indent) { + if (typeof object8.toJSON === "function") { + return stringifyValue(object8.toJSON(), indent); + } + const keys3 = Array.isArray(replacer) ? [...new Set(replacer.map(String))] : Object.keys(object8); + if (keys3.length === 0) { + return "{}"; + } + const childIndent = resolvedSpace ? indent + resolvedSpace : void 0; + let first = true; + let str = resolvedSpace ? "{\n" : "{"; + for (const key of keys3) { + const value3 = typeof replacer === "function" ? replacer.call(object8, key, object8[key]) : object8[key]; + if (includeProperty(key, value3)) { + const serialized = stringifyValue(value3, childIndent); + if (serialized === void 0) { + continue; + } + if (first) { + first = false; + } else { + str += resolvedSpace ? ",\n" : ","; + } + const keyStr = JSON.stringify(key); + str += resolvedSpace ? `${childIndent + keyStr}: ` : `${keyStr}:`; + str += serialized; + } + } + str += resolvedSpace ? ` +${indent}}` : "}"; + return str; + } + function includeProperty(_key, value3) { + return typeof value3 !== "undefined" && typeof value3 !== "function" && typeof value3 !== "symbol"; + } +} +var MAX_SPACE_LENGTH = 10; +function resolveSpace(space) { + if (typeof space === "number") { + const count = Math.min(Math.trunc(space), MAX_SPACE_LENGTH); + return count >= 1 ? " ".repeat(count) : void 0; + } + if (typeof space === "string" && space !== "") { + return space.slice(0, MAX_SPACE_LENGTH); + } + return void 0; +} + +// node_modules/@noble/hashes/_u64.js +var fromNumH = (n) => n / 2 ** 32 | 0; +var fromNumL = (n) => n >>> 0; +function setU64FromNum(view, byteOffset, n, isLE2) { + const h = fromNumH(n); + const l = fromNumL(n); + view.setUint32(byteOffset, isLE2 ? l : h, isLE2); + view.setUint32(byteOffset + 4, isLE2 ? h : l, isLE2); +} + +// node_modules/@noble/hashes/utils.js +function isBytes(a) { + return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1; +} +var atitle = (title) => title ? `"${title}" ` : ""; +function anumber(n, title = "") { + if (typeof n !== "number") + throw new TypeError(atitle(title) + "expected number, got " + typeof n); + if (!Number.isSafeInteger(n) || n < 0) + throw new RangeError(atitle(title) + "expected integer >= 0, got " + n); + return n; +} +function abytes(value2, length, title = "") { + if (isBytes(value2) && (length === void 0 || value2.length === length)) + return value2; + if (length !== void 0) + anumber(length, "length"); + const bytes5 = isBytes(value2); + const ofLen = length !== void 0 ? ` of length ${length}` : ""; + const got = bytes5 ? `length=${value2.length}` : `type=${typeof value2}`; + const message = atitle(title) + "expected Uint8Array" + ofLen + ", got " + got; + if (!bytes5) + throw new TypeError(message); + throw new RangeError(message); +} +function copyBytes(bytes5) { + return Uint8Array.from(abytes(bytes5)); +} +var aobject = (value2, label) => { + if (value2 === null || typeof value2 !== "object" || Array.isArray(value2)) + throw new TypeError((label === "object" ? "" : `"${label}" `) + "expected object, got type=" + typeof value2); +}; +var aopts = (value2, label) => { + aobject(value2, label); + const proto = Object.getPrototypeOf(value2); + if (proto !== Object.prototype && proto !== null) + throw new TypeError(`"${label}" expected plain object`); + if (Object.hasOwn(value2, "__proto__")) + throw new TypeError(`"${label}.__proto__" is not allowed`); +}; +function aexists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error("hash was destroyed"); + if (checkFinished && instance.finished) + throw new Error("digest() was already called"); +} +function aoutput(out, instance) { + abytes(out, void 0, "output"); + const min = instance.outputLen; + if (!(out.length >= min)) { + throw new RangeError('"output" expected length >= ' + min); + } +} +function u8(arr) { + return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +} +function u32(arr) { + return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +} +function clean(...arrays) { + for (let i = 0; i < arrays.length; i++) { + arrays[i].fill(0); + } +} +function createView(arr) { + return new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +} +function rotr(word, shift) { + return word << 32 - shift | word >>> shift; +} +var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)(); +function byteSwap(word) { + return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255; +} +var swap8IfBE = isLE ? (n) => n : (n) => byteSwap(n) >>> 0; +function byteSwap32(arr) { + for (let i = 0; i < arr.length; i++) { + arr[i] = byteSwap(arr[i]); + } + return arr; +} +var swap32IfBE = isLE ? (u) => u : byteSwap32; +var hasHexBuiltin = /* @__PURE__ */ (() => ( + // @ts-ignore + typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function" +))(); +var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); +function bytesToHex(bytes5) { + abytes(bytes5); + if (hasHexBuiltin) + return bytes5.toHex(); + let hex = ""; + for (let i = 0; i < bytes5.length; i++) { + hex += hexes[bytes5[i]]; + } + return hex; +} +function checkOpts(defaults, opts, title = "opts") { + aopts(defaults, "defaults"); + if (opts !== void 0) + aopts(opts, title); + const merged = Object.assign(/* @__PURE__ */ Object.create(null), defaults, opts); + return merged; +} +function createHasher(hashCons, info = {}) { + if (typeof hashCons !== "function") + throw new TypeError('"hashCons" expected function, got type=' + typeof hashCons); + info = checkOpts({}, info, "info"); + const hashC = (msg, opts) => hashCons(opts).update(msg).digest(); + const tmp = hashCons(void 0); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.canXOF = tmp.canXOF; + hashC.create = (opts) => hashCons(opts); + Object.assign(hashC, info); + return Object.freeze(hashC); +} +var oidNist = (suffix) => ({ + // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet. + // Larger suffix values would need base-128 OID encoding and a different length byte. + oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix]) +}); + +// node_modules/@noble/hashes/_md.js +function Chi(a, b, c) { + return a & b ^ ~a & c; +} +function Maj(a, b, c) { + return a & b ^ a & c ^ b & c; +} +var HashMD = class { + blockLen; + outputLen; + canXOF = false; + padOffset; + isLE; + // For partial updates less than block size + buffer; + view; + finished = false; + length = 0; + pos = 0; + destroyed = false; + constructor(blockLen, outputLen, padOffset, isLE2) { + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE2; + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data) { + aexists(this); + abytes(data); + const { view, buffer, blockLen } = this; + const len = data.length; + let processed = false; + for (let pos = 0; pos < len; ) { + const take = Math.min(blockLen - this.pos, len - pos); + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) + this.process(dataView, pos); + processed = true; + continue; + } + buffer.set(pos === 0 && take === len ? data : data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + processed = true; + } + } + this.length += data.length; + if (processed) + this.roundClean(); + return this; + } + digestInto(out) { + aexists(this); + aoutput(out, this); + this.finished = true; + const { buffer, view, blockLen, isLE: isLE2 } = this; + let { pos } = this; + buffer[pos++] = 128; + buffer.fill(0, pos); + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + buffer.fill(0); + } + setU64FromNum(view, blockLen - 8, this.length * 8, isLE2); + this.process(view, 0); + this.roundClean(); + const oview = out === buffer ? view : createView(out); + const len = this.outputLen; + const outLen = len / 4; + const state = this.get(); + if (len % 4 || outLen > state.length) + throw new Error("invalid outputLen"); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE2); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneIntoMeta(to) { + const { buffer, length, finished, destroyed, pos } = this; + to.destroyed = destroyed; + to.finished = finished; + to.length = length; + to.pos = pos; + if (pos) + to.buffer.set(buffer); + return to; + } + clone() { + return this._cloneInto(); + } +}; +var SHA256_IV = /* @__PURE__ */ Uint32Array.from([ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 +]); + +// node_modules/@noble/hashes/sha2.js +var SHA256_K = /* @__PURE__ */ Uint32Array.from([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 +]); +var SHA256_W = /* @__PURE__ */ new Uint32Array(64); +var SHA2_32B = class extends HashMD { + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + // Numeric initializers matter: starting the fields as `undefined` changes + // V8's field representation and makes sha256 3x slower (measured). + A = 0; + B = 0; + C = 0; + D = 0; + E = 0; + F = 0; + G = 0; + H = 0; + constructor(outputLen, IV) { + super(64, outputLen, 8, false); + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + _cloneInto(to) { + (to ||= new this.constructor()).set(...this.get()); + return this._cloneIntoMeta(to); + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3; + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10; + SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0; + } + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = sigma0 + Maj(A, B, C) | 0; + H = G; + G = F; + F = E; + E = D + T1 | 0; + D = C; + C = B; + B = A; + A = T1 + T2 | 0; + } + A = A + this.A | 0; + B = B + this.B | 0; + C = C + this.C | 0; + D = D + this.D | 0; + E = E + this.E | 0; + F = F + this.F | 0; + G = G + this.G | 0; + H = H + this.H | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + clean(SHA256_W); + } + destroy() { + this.destroyed = true; + this.set(0, 0, 0, 0, 0, 0, 0, 0); + clean(this.buffer); + } +}; +var _SHA256 = class extends SHA2_32B { + constructor() { + super(32, SHA256_IV); + } +}; +var sha256 = /* @__PURE__ */ createHasher( + () => new _SHA256(), + /* @__PURE__ */ oidNist(1) +); + +// lib/package.mjs +function packagePath(value2) { + if (typeof value2 !== "string" || !value2 || value2.length > 512 || value2.normalize("NFC") !== value2 || /[\\:%?*<>|\x00-\x1f\x7f]/.test(value2)) throw Error("Invalid package path"); + for (const part of value2.split("/")) { + if (!part || part === "." || part === ".." || part.endsWith(".") || part !== part.trim() || /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(?:\.|$)/i.test(part)) throw Error("Invalid package path"); + } + return value2; +} +async function digestBlob(blob) { + const hash3 = sha256.create(); + for (let at = 0; at < blob.size; at += 1024 * 1024) { + hash3.update(new Uint8Array(await blob.slice(at, at + 1024 * 1024).arrayBuffer())); + } + return Array.from(hash3.digest(), (byte) => byte.toString(16).padStart(2, "0")).join(""); +} +function resolveReference(masterPath, reference) { + if (typeof reference !== "string" || !reference || reference.startsWith("/") || /[\\:]/.test(reference)) throw Error("Native media references must be relative"); + const parts = masterPath.split("/").slice(0, -1); + for (const part of reference.split("/")) { + if (part === ".") continue; + if (part === "..") { + if (!parts.length) throw Error("Media reference escapes the package"); + parts.pop(); + } else parts.push(part); + } + return packagePath(parts.join("/")); +} +function relativeReference(masterPath, filePath) { + const from = packagePath(masterPath).split("/").slice(0, -1); + const to = packagePath(filePath).split("/"); + while (from.length && to.length && from[0] === to[0]) { + from.shift(); + to.shift(); + } + return [...from.map(() => ".."), ...to].join("/"); +} + +// apps/filmcraft/package.mjs +async function readProject(blob) { + if (blob.size > 256 * 1024 ** 2) throw Error("FilmCraft project exceeds the browser's 256 MiB master limit"); + const doc = parse(await blob.text()); + if (doc?.format !== "filmcraft.project" || !doc.project?.items || Number(doc.schema_version) !== 15) throw Error("This adapter requires FilmCraft's version 15 project schema"); + return doc; +} +function mediaReferences(doc) { + const refs = []; + for (const item of Object.values(doc.project.items)) { + const media = item?.kind?.Media; + for (const ref of [media?.media, media?.proxy]) { + if (ref?.File) { + if (typeof ref.File.path !== "string") throw Error("Invalid FilmCraft media reference"); + refs.push({ get path() { + return ref.File.path; + }, set path(value2) { + ref.File.path = value2; + }, sequence: ref === media.media && media.info?.kind === "ImageSequence" ? media.info : null }); + } + } + } + return refs; +} +function sequencePaths(first, info, available) { + const path = first.replaceAll("\\", "/"); + const slash = path.lastIndexOf("/"); + const dir = path.slice(0, slash + 1); + const name = path.slice(slash + 1); + const match = name.match(/^(.*?)([0-9]{1,18})([^0-9]*)\.[^.]+$/); + if (!match) throw Error("An image sequence needs a numbered first frame"); + const prefix = match[1], digits = match[2], suffix = name.slice(prefix.length + digits.length); + const start = BigInt(digits); + let count; + try { + const num = BigInt(String(info.video.frame_rate.num)), den = BigInt(String(info.video.frame_rate.den)); + const duration3 = BigInt(String(info.duration)); + if (num <= 0n || den <= 0n || duration3 <= 0n) throw Error(); + const unit = 254016000000n * den; + count = Number((duration3 * num + unit - 1n) / unit); + } catch { + throw Error("The image sequence has invalid native timing"); + } + if (!Number.isSafeInteger(count) || count < 1 || count > 199) throw Error("This image sequence exceeds the library's 200-file package limit; use a video export or a shorter sequence"); + const found = /* @__PURE__ */ new Map(); + for (const original of available) { + const candidate = original.replaceAll("\\", "/"); + if (candidate.slice(0, candidate.lastIndexOf("/") + 1) !== dir) continue; + const filename = candidate.slice(dir.length); + if (!filename.startsWith(prefix) || !filename.toLowerCase().endsWith(suffix.toLowerCase())) continue; + const number3 = filename.slice(prefix.length, -suffix.length); + if (!/^[0-9]{1,18}$/.test(number3) || number3.length !== digits.length && (number3.length < digits.length || number3.startsWith("0"))) continue; + const index = BigInt(number3) - start; + if (index < 0n || index >= BigInt(count)) continue; + if (found.has(Number(index))) throw Error("Ambiguous image sequence frame names"); + found.set(Number(index), original); + } + return Array.from({ length: count }, (_, index) => { + const frame = found.get(index); + if (!frame) throw Error(`Image sequence frame is missing: ${prefix}${String(start + BigInt(index)).padStart(digits.length, "0")}${suffix}`); + return frame; + }); +} + +// apps/filmcraft/native-package.mjs +async function packageNativeProject({ source, allowedRoot, output }) { + const root = await (0, import_promises.realpath)(allowedRoot); + const sourcePath = await (0, import_promises.realpath)(source); + const inside12 = (path) => path === root || path.startsWith(root + import_node_path.sep); + if (!inside12(sourcePath)) throw Error("Native master is outside the assignment folder"); + if ((await (0, import_promises.stat)(sourcePath)).size > 256 * 1024 ** 2) throw Error("Native master exceeds 256 MiB"); + const doc = await readProject(new Blob([await (0, import_promises.readFile)(sourcePath)])); + const masterPath = packagePath((0, import_node_path.basename)(sourcePath)); + const files = /* @__PURE__ */ new Map(); + const casePaths = /* @__PURE__ */ new Set([masterPath.toLowerCase()]); + let total = (await (0, import_promises.stat)(sourcePath)).size; + async function addFile(sourceFile) { + const file = await (0, import_promises.realpath)(sourceFile).catch(() => { + throw Error("Linked native media is missing"); + }); + if (!inside12(file)) throw Error("Linked media is outside the assignment folder"); + if (!files.has(file)) { + const path = packagePath((0, import_node_path.relative)(root, file).split(import_node_path.sep).join("/")); + if (casePaths.has(path.toLowerCase())) throw Error("Native package path collision"); + const info = await (0, import_promises.stat)(file); + if (!info.isFile() || !info.size || info.size > 10 * 1024 ** 3) throw Error("Linked media must be a nonempty file no larger than 10 GiB"); + total += info.size; + if (files.size >= 199 || total > 50 * 1024 ** 3) throw Error("Native package exceeds the library's file or size limit"); + casePaths.add(path.toLowerCase()); + files.set(file, path); + } + return files.get(file); + } + for (const ref of mediaReferences(doc)) { + const first = (0, import_node_path.isAbsolute)(ref.path) ? ref.path : (0, import_node_path.resolve)((0, import_node_path.dirname)(sourcePath), ref.path); + if (ref.sequence) { + const directory = await (0, import_promises.realpath)((0, import_node_path.dirname)(first)); + if (!inside12(directory)) throw Error("Linked media is outside the assignment folder"); + const canonical = (0, import_node_path.resolve)(directory, (0, import_node_path.basename)(first)); + const frames = sequencePaths(canonical, ref.sequence, (await (0, import_promises.readdir)(directory)).map((name) => (0, import_node_path.resolve)(directory, name))); + for (const frame of frames) await addFile(frame); + } + ref.path = relativeReference(masterPath, await addFile(first)); + } + await (0, import_promises.mkdir)(output); + for (const [file, path] of files) { + const target = (0, import_node_path.resolve)(output, path); + await (0, import_promises.mkdir)((0, import_node_path.dirname)(target), { recursive: true }); + await (0, import_promises.copyFile)(file, target, import_node_fs.constants.COPYFILE_EXCL); + } + await (0, import_promises.writeFile)((0, import_node_path.resolve)(output, masterPath), stringify(doc), { flag: "wx" }); + return { masterPath, files: [masterPath, ...files.values()] }; +} + +// apps/vectorcraft/native-package.mjs +var import_promises2 = require("node:fs/promises"); +var import_node_path2 = require("node:path"); + +// apps/vectorcraft/package.mjs +var MAGIC = new Uint8Array([10, 0, 86, 67, 66, 76, 79, 66, 83, 0]); +var MAX_MASTER = 256 * 1024 ** 2; +var isNative = (path) => /\.(vectorcraft|drawcraft)$/i.test(path); +async function boundedBytes(stream) { + const reader = stream.getReader(), chunks = []; + let total = 0; + try { + while (true) { + const { done, value: value2 } = await reader.read(); + if (done) break; + total += value2.byteLength; + if (total > MAX_MASTER) throw Error("VectorCraft master exceeds the 256 MiB unpacked limit"); + chunks.push(value2); + } + } catch (error2) { + await reader.cancel().catch(() => { + }); + throw error2; + } + return new Uint8Array(await new Blob(chunks).arrayBuffer()); +} +async function readProject2(blob) { + if (!(blob instanceof Blob) || !blob.size || blob.size > MAX_MASTER) throw Error("Invalid VectorCraft master size"); + const head = new Uint8Array(await blob.slice(0, 2).arrayBuffer()); + const compressed = head[0] === 31 && head[1] === 139; + const bytes5 = await boundedBytes(compressed ? blob.stream().pipeThrough(new DecompressionStream("gzip")) : blob.stream()); + const nul = bytes5.indexOf(0), at = nul - 1; + let json = bytes5, tail = new Uint8Array(); + if (nul !== -1) { + if (at < 0 || !MAGIC.every((byte, i) => bytes5[at + i] === byte)) throw Error("Invalid VectorCraft binary marker"); + json = bytes5.subarray(0, at); + tail = bytes5.slice(at + MAGIC.length); + } + const doc = parse(new TextDecoder("utf-8", { fatal: true }).decode(json)); + const version2 = Number(doc?.version); + if (!["vectorcraft", "drawcraft"].includes(doc?.format) || !Number.isInteger(version2) || version2 < 1 || version2 > 4 || !Array.isArray(doc.document?.layers) || tail.length && version2 < 4) throw Error("Unsupported VectorCraft native format"); + const project = { doc, tail, compressed }; + for (const entry of [...Object.values(doc.images ?? {}), ...Object.values(doc.profiles ?? {}), doc.preview, doc.pdf]) { + if (entry?.blob) readEntry(project, entry); + } + return project; +} +function readEntry(project, entry) { + if (!entry || typeof entry !== "object") throw Error("Invalid VectorCraft binary entry"); + if (entry.blob) { + const pair = entry.blob.map(Number); + if (pair.length !== 2 || pair.some((n) => !Number.isSafeInteger(n) || n < 0) || pair[0] + pair[1] > project.tail.length) throw Error("Truncated VectorCraft binary data"); + return project.tail.slice(pair[0], pair[0] + pair[1]); + } + if (typeof entry.data !== "string" || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(entry.data)) throw Error("Invalid VectorCraft embedded data"); + return Uint8Array.from(atob(entry.data), (c) => c.charCodeAt(0)); +} +function replaceEntry(project, key, bytes5) { + const entry = project.doc.images?.[key]; + if (!entry) throw Error("Placed VectorCraft document has no embedded source"); + const data = new Uint8Array(project.tail.length + bytes5.length); + data.set(project.tail); + data.set(bytes5, project.tail.length); + entry.blob = [project.tail.length, bytes5.length]; + delete entry.data; + delete entry.proxy; + project.doc.version = 4; + project.tail = data; +} +async function writeProject(project) { + const blob = new Blob([stringify(project.doc), ...project.tail.length ? [MAGIC, project.tail] : []], { type: "application/octet-stream" }); + if (blob.size > MAX_MASTER) throw Error("VectorCraft master exceeds the 256 MiB unpacked limit"); + return project.compressed ? new Blob([await boundedBytes(blob.stream().pipeThrough(new CompressionStream("gzip")))], { type: "application/octet-stream" }) : blob; +} +function mediaReferences2(project) { + const d = project.doc.document; + const stack = [...d.layers, ...(d.symbols ?? []).map((s) => s.art), ...(d.graph_designs ?? []).map((s) => s.art), ...(d.patterns ?? []).flatMap((p) => p.art)]; + const refs = []; + let count = 0; + while (stack.length) { + const node2 = stack.pop(); + if (!node2) continue; + if (++count > 1e6) throw Error("VectorCraft object limit exceeded"); + const kind = node2.kind; + if (!kind || typeof kind !== "object") throw Error("Invalid VectorCraft node"); + if (["image", "placeddocument"].includes(kind.type) && kind.link != null) { + if (typeof kind.link === "string") kind.link = { path: kind.link }; + if (typeof kind.link.path !== "string" || !kind.link.path) throw Error("Invalid VectorCraft linked file"); + refs.push({ link: kind.link, key: kind.key, placed: kind.type === "placeddocument" }); + } + if (node2.mask?.art) stack.push(node2.mask.art); + const children = kind.type === "envelope" ? kind.content : kind.type === "repeat" ? kind.source : ["layer", "group", "compound", "blend", "intertwine"].includes(kind.type) ? kind.children : []; + if (children != null && !Array.isArray(children)) throw Error("Invalid VectorCraft children"); + for (const child2 of children ?? []) stack.push(child2); + } + return refs; +} +async function nativeHash(blob) { + let hash3 = 0xcbf29ce484222325n; + const reader = blob.stream().getReader(); + while (true) { + const { done, value: value2 } = await reader.read(); + if (done) break; + for (const byte of value2) hash3 = BigInt.asUintN(64, (hash3 ^ BigInt(byte)) * 0x100000001b3n); + } + return `img${hash3.toString(16).padStart(16, "0")}`; +} +async function rewriteProject(blob, transform2) { + const project = await readProject2(blob); + for (const ref of mediaReferences2(project)) { + const mapped = await transform2(ref); + ref.link.path = mapped.path; + ref.link.relative = mapped.relative ?? mapped.path; + delete ref.link.modified; + ref.link.size = mapped.blob.size; + ref.link.hash = await nativeHash(mapped.blob); + if (ref.placed) replaceEntry(project, ref.key, new Uint8Array(await mapped.blob.arrayBuffer())); + } + return writeProject(project); +} + +// apps/vectorcraft/native-package.mjs +async function packageNativeProject2({ source, allowedRoot, output }) { + const root = await (0, import_promises2.realpath)(allowedRoot), master = await (0, import_promises2.realpath)(source); + const inside12 = (path) => path === root || path.startsWith(root + import_node_path2.sep); + if (!inside12(master) || !isNative(master)) throw Error("VectorCraft master is outside the assignment folder or is not native"); + const masterPath = packagePath((0, import_node_path2.basename)(master)); + const files = /* @__PURE__ */ new Map(), visiting = /* @__PURE__ */ new Set(), names = /* @__PURE__ */ new Map(); + let total = 0; + async function pack(input3, depth = 0) { + const file = await (0, import_promises2.realpath)(input3).catch(() => { + throw Error("Linked native artwork is missing"); + }); + if (!inside12(file)) throw Error("Linked artwork is outside the assignment folder"); + if (files.has(file)) return files.get(file); + if (depth > 8 || visiting.has(file)) throw Error("Cyclic or overly nested placed VectorCraft document"); + if (files.size + visiting.size >= 200) throw Error("VectorCraft package exceeds 200 files"); + const info = await (0, import_promises2.stat)(file); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("VectorCraft package files must be nonempty and no larger than 256 MiB"); + total += info.size; + if (total > 512 * 1024 ** 2) throw Error("VectorCraft package exceeds the 512 MiB browser memory limit"); + const path = file === master ? masterPath : packagePath((0, import_node_path2.relative)(root, file).split(import_node_path2.sep).join("/")); + if (names.has(path.toLowerCase()) && names.get(path.toLowerCase()) !== file) throw Error("Native package path collision"); + names.set(path.toLowerCase(), file); + visiting.add(file); + const original = new Blob([await (0, import_promises2.readFile)(file)]); + const blob = isNative(file) ? await rewriteProject(original, async (ref) => { + const input4 = ref.link.relative || ref.link.path; + const linked = await pack((0, import_node_path2.isAbsolute)(input4) ? input4 : (0, import_node_path2.resolve)((0, import_node_path2.dirname)(file), input4), depth + 1); + return { path: relativeReference(path, linked.path), blob: linked.blob }; + }) : original; + const result = { path, blob }; + files.set(file, result); + visiting.delete(file); + return result; + } + await pack(master); + await (0, import_promises2.mkdir)(output); + for (const { path, blob } of files.values()) { + const target = (0, import_node_path2.resolve)(output, path); + await (0, import_promises2.mkdir)((0, import_node_path2.dirname)(target), { recursive: true }); + await (0, import_promises2.writeFile)(target, new Uint8Array(await blob.arrayBuffer()), { flag: "wx" }); + } + return { masterPath, files: [masterPath, ...[...files.values()].map((f) => f.path).filter((path) => path !== masterPath)] }; +} + +// apps/photocraft/native-package.mjs +var import_promises3 = require("node:fs/promises"); +var import_node_path3 = require("node:path"); + +// node_modules/@noble/hashes/_blake.js +function G1s(a, b, c, d, x) { + a = a + b + x | 0; + d = rotr(d ^ a, 16); + c = c + d | 0; + b = rotr(b ^ c, 12); + return { a, b, c, d }; +} +function G2s(a, b, c, d, x) { + a = a + b + x | 0; + d = rotr(d ^ a, 8); + c = c + d | 0; + b = rotr(b ^ c, 7); + return { a, b, c, d }; +} + +// node_modules/@noble/hashes/blake2.js +var _BLAKE2 = class { + buffer; + buffer32; + finished = false; + destroyed = false; + length = 0; + pos = 0; + blockLen; + outputLen; + canXOF = false; + constructor(blockLen, outputLen) { + anumber(blockLen); + anumber(outputLen); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.buffer = new Uint8Array(blockLen); + this.buffer32 = u32(this.buffer); + } + update(data) { + aexists(this); + abytes(data); + const { blockLen, buffer, buffer32 } = this; + const len = data.length; + const offset = data.byteOffset; + const buf = data.buffer; + for (let pos = 0; pos < len; ) { + if (this.pos === blockLen) { + swap32IfBE(buffer32); + this.compress(buffer32, 0, false); + swap32IfBE(buffer32); + this.pos = 0; + } + const take = Math.min(blockLen - this.pos, len - pos); + const dataOffset = offset + pos; + if (take === blockLen && !(dataOffset % 4) && pos + take < len) { + const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); + swap32IfBE(data32); + for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { + this.length += blockLen; + this.compress(data32, pos32, false); + } + swap32IfBE(data32); + continue; + } + buffer.set(pos === 0 && take === len ? data : data.subarray(pos, pos + take), this.pos); + this.pos += take; + this.length += take; + pos += take; + } + return this; + } + digestInto(out) { + aexists(this); + aoutput(out, this); + if (out.byteOffset & 3) + throw new RangeError('"output" expected 4-byte aligned byteOffset, got ' + out.byteOffset); + const { pos, buffer32 } = this; + this.finished = true; + this.buffer.fill(0, pos); + swap32IfBE(buffer32); + this.compress(buffer32, 0, true); + swap32IfBE(buffer32); + const state = this.get(); + const out32 = out === this.buffer ? buffer32 : u32(out); + const full = Math.floor(this.outputLen / 4); + for (let i = 0; i < full; i++) + out32[i] = swap8IfBE(state[i]); + const tail = this.outputLen % 4; + if (!tail) + return; + const off = full * 4; + const word = state[full]; + for (let i = 0; i < tail; i++) + out[off + i] = word >>> 8 * i; + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + const { buffer, length, finished, destroyed, outputLen, pos } = this; + to ||= new this.constructor({ dkLen: outputLen }); + to.set(...this.get()); + to.buffer.set(buffer); + to.destroyed = destroyed; + to.finished = finished; + to.length = length; + to.pos = pos; + to.outputLen = outputLen; + return to; + } + clone() { + return this._cloneInto(); + } +}; +function _compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { + let j = 0; + for (let i = 0; i < rounds; i++) { + ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]])); + ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]])); + } + return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; +} + +// node_modules/@noble/hashes/blake3.js +var B3_Flags = { + CHUNK_START: 1, + CHUNK_END: 2, + PARENT: 4, + ROOT: 8, + KEYED_HASH: 16, + DERIVE_KEY_CONTEXT: 32, + DERIVE_KEY_MATERIAL: 64 +}; +var B3_IV = /* @__PURE__ */ SHA256_IV.slice(); +var B3_SIGMA = /* @__PURE__ */ (() => { + const Id = Array.from({ length: 16 }, (_, i) => i); + const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); + const res = []; + for (let i = 0, v = Id; i < 7; i++, v = permute(v)) + res.push(...v); + return Uint8Array.from(res); +})(); +var _BLAKE3 = class __BLAKE3 extends _BLAKE2 { + canXOF = true; + chunkPos = 0; + // Position of current block in chunk + // How many chunks we already have; exact while this stays within + // JS's safe-integer range. + chunksDone = 0; + flags = 0 | 0; + IV; + state; + stack = []; + // Output + posOut = 0; + bufferOut32 = new Uint32Array(16); + bufferOut; + // Index of output chunk; exact while this stays within JS's + // safe-integer range. + chunkOut = 0; + enableXOF = true; + constructor(opts = {}, flags = 0) { + opts = checkOpts({}, opts); + super(64, opts.dkLen === void 0 ? 32 : opts.dkLen); + const { key, context } = opts; + const hasContext = context !== void 0; + if (key !== void 0) { + if (hasContext) + throw new Error('cannot use both "key" and "context"'); + abytes(key, 32, "key"); + const k = copyBytes(key); + this.IV = u32(k); + swap32IfBE(this.IV); + this.flags = flags | B3_Flags.KEYED_HASH; + } else if (hasContext) { + abytes(context, void 0, "context"); + const ctx = context; + const contextKey = new __BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT).update(ctx).digest(); + this.IV = u32(contextKey); + swap32IfBE(this.IV); + this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL; + } else { + this.IV = B3_IV; + this.flags = flags; + } + this.state = this.IV.slice(); + this.bufferOut = u8(this.bufferOut32); + } + // _BLAKE2's scalar-state hooks are unused here: BLAKE3 keeps its tree/XOF state in arrays and + // copies it directly in _cloneInto(). + get() { + return []; + } + set() { + } + // Truncated chunk/parent compression: seed v8..v15 as IV[0..3], t0, t1, + // block length, and flags, then keep only the first 8 output words. + b2Compress(counter, flags, buf, bufPos = 0) { + const { state: s, pos } = this; + const t0 = fromNumL(counter); + const t1 = fromNumH(counter); + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = _compress(B3_SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], t0, t1, pos, flags); + s[0] = v0 ^ v8; + s[1] = v1 ^ v9; + s[2] = v2 ^ v10; + s[3] = v3 ^ v11; + s[4] = v4 ^ v12; + s[5] = v5 ^ v13; + s[6] = v6 ^ v14; + s[7] = v7 ^ v15; + } + compress(buf, bufPos = 0, isLast = false) { + let flags = this.flags; + if (!this.chunkPos) + flags |= B3_Flags.CHUNK_START; + if (this.chunkPos === 15 || isLast) + flags |= B3_Flags.CHUNK_END; + if (!isLast) + this.pos = this.blockLen; + this.b2Compress(this.chunksDone, flags, buf, bufPos); + this.chunkPos += 1; + if (this.chunkPos === 16 || isLast) { + let chunk = this.state; + this.state = this.IV.slice(); + for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks = Math.floor(chunks / 2)) { + if (!(last = this.stack.pop())) + break; + this.buffer32.set(last, 0); + this.buffer32.set(chunk, 8); + this.pos = this.blockLen; + this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0); + chunk = this.state; + this.state = this.IV.slice(); + } + this.chunksDone++; + this.chunkPos = 0; + this.stack.push(chunk); + } + this.pos = 0; + } + // Overriding hides _BLAKE2's flat implementation, which would otherwise be inherited + // and silently miss the tree state (CV stack, chunk counters; get()/set() are stubs here). + _cloneInto(to) { + const staleOutput = !!to && to.finished && !to.destroyed; + to = super._cloneInto(to); + const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; + to.state.set(state); + to.stack = stack.map((i) => Uint32Array.from(i)); + if (IV === B3_IV) { + if (to.IV !== B3_IV) + clean(to.IV); + to.IV = B3_IV; + } else if (to.IV === B3_IV) { + to.IV = IV.slice(); + } else { + to.IV.set(IV); + } + to.flags = flags; + to.chunkPos = chunkPos; + to.chunksDone = chunksDone; + to.posOut = posOut; + to.chunkOut = chunkOut; + to.enableXOF = this.enableXOF; + if (this.finished) { + to.bufferOut32.set(this.bufferOut32); + } else if (staleOutput) { + clean(to.bufferOut32); + } + return to; + } + destroy() { + this.destroyed = true; + clean(this.state, this.buffer32, this.bufferOut32); + if (this.IV !== B3_IV) + clean(this.IV); + clean(...this.stack); + } + // Root/XOF compression: rerun the same ROOT inputs with incrementing output + // counter `t` and materialize all 16 output words. + // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) + b2CompressOut() { + const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; + const outCounter = this.chunkOut++; + const t0 = fromNumL(outCounter); + const t1 = fromNumH(outCounter); + swap32IfBE(buffer32); + const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = _compress(B3_SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], t0, t1, pos, flags); + out32[0] = v0 ^ v8; + out32[1] = v1 ^ v9; + out32[2] = v2 ^ v10; + out32[3] = v3 ^ v11; + out32[4] = v4 ^ v12; + out32[5] = v5 ^ v13; + out32[6] = v6 ^ v14; + out32[7] = v7 ^ v15; + out32[8] = s[0] ^ v8; + out32[9] = s[1] ^ v9; + out32[10] = s[2] ^ v10; + out32[11] = s[3] ^ v11; + out32[12] = s[4] ^ v12; + out32[13] = s[5] ^ v13; + out32[14] = s[6] ^ v14; + out32[15] = s[7] ^ v15; + swap32IfBE(buffer32); + swap32IfBE(out32); + this.posOut = 0; + } + finish() { + if (this.finished) + return; + this.finished = true; + this.buffer.fill(0, this.pos); + let flags = this.flags | B3_Flags.ROOT; + if (this.stack.length) { + flags |= B3_Flags.PARENT; + swap32IfBE(this.buffer32); + this.compress(this.buffer32, 0, true); + swap32IfBE(this.buffer32); + this.chunksDone = 0; + this.pos = this.blockLen; + } else { + flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END; + } + this.flags = flags; + this.b2CompressOut(); + } + writeInto(out) { + aexists(this, false); + abytes(out); + this.finish(); + const { blockLen, bufferOut } = this; + for (let pos = 0, len = out.length; pos < len; ) { + if (this.posOut >= blockLen) + this.b2CompressOut(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + if (!this.enableXOF) + throw new Error("no XOF after digest()"); + return this.writeInto(out); + } + xof(bytes5) { + anumber(bytes5); + return this.xofInto(new Uint8Array(bytes5)); + } + digestInto(out) { + aoutput(out, this); + if (this.finished) + throw new Error("digest() was already called"); + this.enableXOF = false; + this.writeInto(out.length === this.outputLen ? out : out.subarray(0, this.outputLen)); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.outputLen); + this.digestInto(out); + return out; + } +}; +var blake3 = /* @__PURE__ */ createHasher((opts = {}) => new _BLAKE3(opts)); + +// node_modules/fzstd/esm/index.mjs +var ab = ArrayBuffer; +var u82 = Uint8Array; +var u16 = Uint16Array; +var i16 = Int16Array; +var i32 = Int32Array; +var slc = function(v, s, e) { + if (u82.prototype.slice) + return u82.prototype.slice.call(v, s, e); + if (s == null || s < 0) + s = 0; + if (e == null || e > v.length) + e = v.length; + var n = new u82(e - s); + n.set(v.subarray(s, e)); + return n; +}; +var fill = function(v, n, s, e) { + if (u82.prototype.fill) + return u82.prototype.fill.call(v, n, s, e); + if (s == null || s < 0) + s = 0; + if (e == null || e > v.length) + e = v.length; + for (; s < e; ++s) + v[s] = n; + return v; +}; +var cpw = function(v, t, s, e) { + if (u82.prototype.copyWithin) + return u82.prototype.copyWithin.call(v, t, s, e); + if (s == null || s < 0) + s = 0; + if (e == null || e > v.length) + e = v.length; + while (s < e) { + v[t++] = v[s++]; + } +}; +var ec = [ + "invalid zstd data", + "window size too large (>2046MB)", + "invalid block type", + "FSE accuracy too high", + "match distance too far back", + "unexpected EOF" +]; +var err = function(ind, msg, nt) { + var e = new Error(msg || ec[ind]); + e.code = ind; + if (Error.captureStackTrace) + Error.captureStackTrace(e, err); + if (!nt) + throw e; + return e; +}; +var rb = function(d, b, n) { + var i = 0, o = 0; + for (; i < n; ++i) + o |= d[b++] << (i << 3); + return o; +}; +var b4 = function(d, b) { + return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0; +}; +var rzfh = function(dat, w) { + var n3 = dat[0] | dat[1] << 8 | dat[2] << 16; + if (n3 == 3126568 && dat[3] == 253) { + var flg = dat[4]; + var ss = flg >> 5 & 1, cc = flg >> 2 & 1, df = flg & 3, fcf = flg >> 6; + if (flg & 8) + err(0); + var bt = 6 - ss; + var db = df == 3 ? 4 : df; + var di = rb(dat, bt, db); + bt += db; + var fsb = fcf ? 1 << fcf : ss; + var fss = rb(dat, bt, fsb) + (fcf == 1 && 256); + var ws = fss; + if (!ss) { + var wb = 1 << 10 + (dat[5] >> 3); + ws = wb + (wb >> 3) * (dat[5] & 7); + } + if (ws > 2145386496) + err(1); + var buf = new u82((w == 1 ? fss || ws : w ? 0 : ws) + 12); + buf[0] = 1, buf[4] = 4, buf[8] = 8; + return { + b: bt + fsb, + y: 0, + l: 0, + d: di, + w: w && w != 1 ? w : buf.subarray(12), + e: ws, + o: new i32(buf.buffer, 0, 3), + u: fss, + c: cc, + m: Math.min(131072, ws) + }; + } else if ((n3 >> 4 | dat[3] << 20) == 25481893) { + return b4(dat, 4) + 8; + } + err(0); +}; +var msb = function(val) { + var bits = 0; + for (; 1 << bits <= val; ++bits) + ; + return bits - 1; +}; +var rfse = function(dat, bt, mal) { + var tpos = (bt << 3) + 4; + var al = (dat[bt] & 15) + 5; + if (al > mal) + err(3); + var sz = 1 << al; + var probs = sz, sym = -1, re = -1, i = -1, ht = sz; + var buf = new ab(512 + (sz << 2)); + var freq = new i16(buf, 0, 256); + var dstate = new u16(buf, 0, 256); + var nstate = new u16(buf, 512, sz); + var bb1 = 512 + (sz << 1); + var syms = new u82(buf, bb1, sz); + var nbits = new u82(buf, bb1 + sz); + while (sym < 255 && probs > 0) { + var bits = msb(probs + 1); + var cbt = tpos >> 3; + var msk = (1 << bits + 1) - 1; + var val = (dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (tpos & 7) & msk; + var msk1fb = (1 << bits) - 1; + var msv = msk - probs - 1; + var sval = val & msk1fb; + if (sval < msv) + tpos += bits, val = sval; + else { + tpos += bits + 1; + if (val > msk1fb) + val -= msv; + } + freq[++sym] = --val; + if (val == -1) { + probs += val; + syms[--ht] = sym; + } else + probs -= val; + if (!val) { + do { + var rbt = tpos >> 3; + re = (dat[rbt] | dat[rbt + 1] << 8) >> (tpos & 7) & 3; + tpos += 2; + sym += re; + } while (re == 3); + } + } + if (sym > 255 || probs) + err(0); + var sympos = 0; + var sstep = (sz >> 1) + (sz >> 3) + 3; + var smask = sz - 1; + for (var s = 0; s <= sym; ++s) { + var sf = freq[s]; + if (sf < 1) { + dstate[s] = -sf; + continue; + } + for (i = 0; i < sf; ++i) { + syms[sympos] = s; + do { + sympos = sympos + sstep & smask; + } while (sympos >= ht); + } + } + if (sympos) + err(0); + for (i = 0; i < sz; ++i) { + var ns = dstate[syms[i]]++; + var nb = nbits[i] = al - msb(ns); + nstate[i] = (ns << nb) - sz; + } + return [tpos + 7 >> 3, { + b: al, + s: syms, + n: nbits, + t: nstate + }]; +}; +var rhu = function(dat, bt) { + var i = 0, wc = -1; + var buf = new u82(292), hb = dat[bt]; + var hw = buf.subarray(0, 256); + var rc = buf.subarray(256, 268); + var ri = new u16(buf.buffer, 268); + if (hb < 128) { + var _a3 = rfse(dat, bt + 1, 6), ebt = _a3[0], fdt = _a3[1]; + bt += hb; + var epos = ebt << 3; + var lb = dat[bt]; + if (!lb) + err(0); + var st1 = 0, st2 = 0, btr1 = fdt.b, btr2 = btr1; + var fpos = (++bt << 3) - 8 + msb(lb); + for (; ; ) { + fpos -= btr1; + if (fpos < epos) + break; + var cbt = fpos >> 3; + st1 += (dat[cbt] | dat[cbt + 1] << 8) >> (fpos & 7) & (1 << btr1) - 1; + hw[++wc] = fdt.s[st1]; + fpos -= btr2; + if (fpos < epos) + break; + cbt = fpos >> 3; + st2 += (dat[cbt] | dat[cbt + 1] << 8) >> (fpos & 7) & (1 << btr2) - 1; + hw[++wc] = fdt.s[st2]; + btr1 = fdt.n[st1]; + st1 = fdt.t[st1]; + btr2 = fdt.n[st2]; + st2 = fdt.t[st2]; + } + if (++wc > 255) + err(0); + } else { + wc = hb - 127; + for (; i < wc; i += 2) { + var byte = dat[++bt]; + hw[i] = byte >> 4; + hw[i + 1] = byte & 15; + } + ++bt; + } + var wes = 0; + for (i = 0; i < wc; ++i) { + var wt = hw[i]; + if (wt > 11) + err(0); + wes += wt && 1 << wt - 1; + } + var mb = msb(wes) + 1; + var ts = 1 << mb; + var rem = ts - wes; + if (rem & rem - 1) + err(0); + hw[wc++] = msb(rem) + 1; + for (i = 0; i < wc; ++i) { + var wt = hw[i]; + ++rc[hw[i] = wt && mb + 1 - wt]; + } + var hbuf = new u82(ts << 1); + var syms = hbuf.subarray(0, ts), nb = hbuf.subarray(ts); + ri[mb] = 0; + for (i = mb; i > 0; --i) { + var pv = ri[i]; + fill(nb, i, pv, ri[i - 1] = pv + rc[i] * (1 << mb - i)); + } + if (ri[0] != ts) + err(0); + for (i = 0; i < wc; ++i) { + var bits = hw[i]; + if (bits) { + var code = ri[bits]; + fill(syms, i, code, ri[bits] = code + (1 << mb - bits)); + } + } + return [bt, { + n: nb, + b: mb, + s: syms + }]; +}; +var dllt = rfse(/* @__PURE__ */ new u82([ + 81, + 16, + 99, + 140, + 49, + 198, + 24, + 99, + 12, + 33, + 196, + 24, + 99, + 102, + 102, + 134, + 70, + 146, + 4 +]), 0, 6)[1]; +var dmlt = rfse(/* @__PURE__ */ new u82([ + 33, + 20, + 196, + 24, + 99, + 140, + 33, + 132, + 16, + 66, + 8, + 33, + 132, + 16, + 66, + 8, + 33, + 68, + 68, + 68, + 68, + 68, + 68, + 68, + 68, + 36, + 9 +]), 0, 6)[1]; +var doct = rfse(/* @__PURE__ */ new u82([ + 32, + 132, + 16, + 66, + 102, + 70, + 68, + 68, + 68, + 68, + 36, + 73, + 2 +]), 0, 5)[1]; +var b2bl = function(b, s) { + var len = b.length, bl = new i32(len); + for (var i = 0; i < len; ++i) { + bl[i] = s; + s += 1 << b[i]; + } + return bl; +}; +var llb = /* @__PURE__ */ new u82((/* @__PURE__ */ new i32([ + 0, + 0, + 0, + 0, + 16843009, + 50528770, + 134678020, + 202050057, + 269422093 +])).buffer, 0, 36); +var llbl = /* @__PURE__ */ b2bl(llb, 0); +var mlb = /* @__PURE__ */ new u82((/* @__PURE__ */ new i32([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 16843009, + 50528770, + 117769220, + 185207048, + 252579084, + 16 +])).buffer, 0, 53); +var mlbl = /* @__PURE__ */ b2bl(mlb, 3); +var dhu = function(dat, out, hu) { + var len = dat.length, ss = out.length, lb = dat[len - 1], msk = (1 << hu.b) - 1, eb = -hu.b; + if (!lb) + err(0); + var st = 0, btr = hu.b, pos = (len << 3) - 8 + msb(lb) - btr, i = -1; + for (; pos > eb && i < ss; ) { + var cbt = pos >> 3; + var val = (dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (pos & 7); + st = (st << btr | val) & msk; + out[++i] = hu.s[st]; + pos -= btr = hu.n[st]; + } + if (pos != eb || i + 1 != ss) + err(0); +}; +var dhu4 = function(dat, out, hu) { + var bt = 6; + var ss = out.length, sz1 = ss + 3 >> 2, sz2 = sz1 << 1, sz3 = sz1 + sz2; + dhu(dat.subarray(bt, bt += dat[0] | dat[1] << 8), out.subarray(0, sz1), hu); + dhu(dat.subarray(bt, bt += dat[2] | dat[3] << 8), out.subarray(sz1, sz2), hu); + dhu(dat.subarray(bt, bt += dat[4] | dat[5] << 8), out.subarray(sz2, sz3), hu); + dhu(dat.subarray(bt), out.subarray(sz3), hu); +}; +var rzb = function(dat, st, out) { + var _a3; + var bt = st.b; + var b0 = dat[bt], btype = b0 >> 1 & 3; + st.l = b0 & 1; + var sz = b0 >> 3 | dat[bt + 1] << 5 | dat[bt + 2] << 13; + var ebt = (bt += 3) + sz; + if (btype == 1) { + if (bt >= dat.length) + return; + st.b = bt + 1; + if (out) { + fill(out, dat[bt], st.y, st.y += sz); + return out; + } + return fill(new u82(sz), dat[bt]); + } + if (ebt > dat.length) + return; + if (btype == 0) { + st.b = ebt; + if (out) { + out.set(dat.subarray(bt, ebt), st.y); + st.y += sz; + return out; + } + return slc(dat, bt, ebt); + } + if (btype == 2) { + var b3 = dat[bt], lbt = b3 & 3, sf = b3 >> 2 & 3; + var lss = b3 >> 4, lcs = 0, s4 = 0; + if (lbt < 2) { + if (sf & 1) + lss |= dat[++bt] << 4 | (sf & 2 && dat[++bt] << 12); + else + lss = b3 >> 3; + } else { + s4 = sf; + if (sf < 2) + lss |= (dat[++bt] & 63) << 4, lcs = dat[bt] >> 6 | dat[++bt] << 2; + else if (sf == 2) + lss |= dat[++bt] << 4 | (dat[++bt] & 3) << 12, lcs = dat[bt] >> 2 | dat[++bt] << 6; + else + lss |= dat[++bt] << 4 | (dat[++bt] & 63) << 12, lcs = dat[bt] >> 6 | dat[++bt] << 2 | dat[++bt] << 10; + } + ++bt; + var buf = out ? out.subarray(st.y, st.y + st.m) : new u82(st.m); + var spl = buf.length - lss; + if (lbt == 0) + buf.set(dat.subarray(bt, bt += lss), spl); + else if (lbt == 1) + fill(buf, dat[bt++], spl); + else { + var hu = st.h; + if (lbt == 2) { + var hud = rhu(dat, bt); + lcs += bt - (bt = hud[0]); + st.h = hu = hud[1]; + } else if (!hu) + err(0); + (s4 ? dhu4 : dhu)(dat.subarray(bt, bt += lcs), buf.subarray(spl), hu); + } + var ns = dat[bt++]; + if (ns) { + if (ns == 255) + ns = (dat[bt++] | dat[bt++] << 8) + 32512; + else if (ns > 127) + ns = ns - 128 << 8 | dat[bt++]; + var scm = dat[bt++]; + if (scm & 3) + err(0); + var dts = [dmlt, doct, dllt]; + for (var i = 2; i > -1; --i) { + var md = scm >> (i << 1) + 2 & 3; + if (md == 1) { + var rbuf = new u82([0, 0, dat[bt++]]); + dts[i] = { + s: rbuf.subarray(2, 3), + n: rbuf.subarray(0, 1), + t: new u16(rbuf.buffer, 0, 1), + b: 0 + }; + } else if (md == 2) { + _a3 = rfse(dat, bt, 9 - (i & 1)), bt = _a3[0], dts[i] = _a3[1]; + } else if (md == 3) { + if (!st.t) + err(0); + dts[i] = st.t[i]; + } + } + var _b = st.t = dts, mlt = _b[0], oct = _b[1], llt = _b[2]; + var lb = dat[ebt - 1]; + if (!lb) + err(0); + var spos = (ebt << 3) - 8 + msb(lb) - llt.b, cbt = spos >> 3, oubt = 0; + var lst = (dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << llt.b) - 1; + cbt = (spos -= oct.b) >> 3; + var ost = (dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << oct.b) - 1; + cbt = (spos -= mlt.b) >> 3; + var mst = (dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << mlt.b) - 1; + for (++ns; --ns; ) { + var llc = llt.s[lst]; + var lbtr = llt.n[lst]; + var mlc = mlt.s[mst]; + var mbtr = mlt.n[mst]; + var ofc = oct.s[ost]; + var obtr = oct.n[ost]; + cbt = (spos -= ofc) >> 3; + var ofp = 1 << ofc; + var off = ofp + ((dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16 | dat[cbt + 3] << 24) >>> (spos & 7) & ofp - 1); + cbt = (spos -= mlb[mlc]) >> 3; + var ml = mlbl[mlc] + ((dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (spos & 7) & (1 << mlb[mlc]) - 1); + cbt = (spos -= llb[llc]) >> 3; + var ll = llbl[llc] + ((dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (spos & 7) & (1 << llb[llc]) - 1); + cbt = (spos -= lbtr) >> 3; + lst = llt.t[lst] + ((dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << lbtr) - 1); + cbt = (spos -= mbtr) >> 3; + mst = mlt.t[mst] + ((dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << mbtr) - 1); + cbt = (spos -= obtr) >> 3; + ost = oct.t[ost] + ((dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << obtr) - 1); + if (off > 3) { + st.o[2] = st.o[1]; + st.o[1] = st.o[0]; + st.o[0] = off -= 3; + } else { + var idx = off - (ll != 0); + if (idx) { + off = idx == 3 ? st.o[0] - 1 : st.o[idx]; + if (idx > 1) + st.o[2] = st.o[1]; + st.o[1] = st.o[0]; + st.o[0] = off; + } else + off = st.o[0]; + } + for (var i = 0; i < ll; ++i) { + buf[oubt + i] = buf[spl + i]; + } + oubt += ll, spl += ll; + var stin = oubt - off; + if (stin < 0) { + var len = -stin; + var bs = st.e + stin; + if (len > ml) + len = ml; + for (var i = 0; i < len; ++i) { + buf[oubt + i] = st.w[bs + i]; + } + oubt += len, ml -= len, stin = 0; + } + for (var i = 0; i < ml; ++i) { + buf[oubt + i] = buf[stin + i]; + } + oubt += ml; + } + if (oubt != spl) { + while (spl < buf.length) { + buf[oubt++] = buf[spl++]; + } + } else + oubt = buf.length; + if (out) + st.y += oubt; + else + buf = slc(buf, 0, oubt); + } else if (out) { + st.y += lss; + if (spl) { + for (var i = 0; i < lss; ++i) { + buf[i] = buf[spl + i]; + } + } + } else if (spl) + buf = slc(buf, spl); + st.b = ebt; + return buf; + } + err(2); +}; +var cct = function(bufs, ol) { + if (bufs.length == 1) + return bufs[0]; + var buf = new u82(ol); + for (var i = 0, b = 0; i < bufs.length; ++i) { + var chk = bufs[i]; + buf.set(chk, b); + b += chk.length; + } + return buf; +}; +var Decompress = /* @__PURE__ */ (function() { + function Decompress2(ondata) { + this.ondata = ondata; + this.c = []; + this.l = 0; + this.z = 0; + } + Decompress2.prototype.push = function(chunk, final) { + if (typeof this.s == "number") { + var sub = Math.min(chunk.length, this.s); + chunk = chunk.subarray(sub); + this.s -= sub; + } + var sl = chunk.length; + var ncs = sl + this.l; + if (!this.s) { + if (final) { + if (!ncs) { + this.ondata(new u82(0), true); + return; + } + if (ncs < 5) + err(5); + } else if (ncs < 18) { + this.c.push(chunk); + this.l = ncs; + return; + } + if (this.l) { + this.c.push(chunk); + chunk = cct(this.c, ncs); + this.c = []; + this.l = 0; + } + if (typeof (this.s = rzfh(chunk)) == "number") + return this.push(chunk, final); + } + if (typeof this.s != "number") { + if (ncs < (this.z || 3)) { + if (final) + err(5); + this.c.push(chunk); + this.l = ncs; + return; + } + if (this.l) { + this.c.push(chunk); + chunk = cct(this.c, ncs); + this.c = []; + this.l = 0; + } + if (!this.z && ncs < (this.z = chunk[this.s.b] & 2 ? 4 : 3 + (chunk[this.s.b] >> 3 | chunk[this.s.b + 1] << 5 | chunk[this.s.b + 2] << 13))) { + if (final) + err(5); + this.c.push(chunk); + this.l = ncs; + return; + } else + this.z = 0; + for (; ; ) { + var blk = rzb(chunk, this.s); + if (!blk) { + if (final) + err(5); + var adc = chunk.subarray(this.s.b); + this.s.b = 0; + this.c.push(adc), this.l += adc.length; + return; + } else { + this.ondata(blk, false); + cpw(this.s.w, 0, blk.length); + this.s.w.set(blk, this.s.w.length - blk.length); + } + if (this.s.l) { + var rest = chunk.subarray(this.s.b); + this.s = this.s.c * 4; + this.push(rest, final); + return; + } + } + } else if (final) + err(5); + }; + return Decompress2; +})(); + +// apps/photocraft/container.mjs +var MAX_FILE = 256 * 1024 ** 2; +var encoder = new TextEncoder(); +var decoder = new TextDecoder("utf-8", { fatal: true }); +var crcTable = Uint32Array.from({ length: 256 }, (_, i) => { + let c = i; + for (let j = 0; j < 8; j++) c = c >>> 1 ^ (c & 1 ? 3988292384 : 0); + return c >>> 0; +}); +function crc32(bytes5) { + let c = 4294967295; + for (const b of bytes5) c = c >>> 8 ^ crcTable[(c ^ b) & 255]; + return (c ^ 4294967295) >>> 0; +} +async function bounded(stream, limit) { + const reader = stream.getReader(), parts = []; + let total = 0; + try { + while (true) { + const { done, value: value2 } = await reader.read(); + if (done) break; + total += value2.length; + if (total > limit) throw Error("PhotoCraft archive exceeds its expanded size limit"); + parts.push(value2); + } + } catch (error2) { + await reader.cancel().catch(() => { + }); + throw error2; + } + return new Uint8Array(await new Blob(parts).arrayBuffer()); +} +async function readZip(blob) { + if (!(blob instanceof Blob) || blob.size < 22 || blob.size > MAX_FILE) throw Error("Invalid PhotoCraft archive size"); + const bytes5 = new Uint8Array(await blob.arrayBuffer()), v = new DataView(bytes5.buffer); + const u162 = (p) => v.getUint16(p, true), u322 = (p) => v.getUint32(p, true); + let end = -1; + for (let p = bytes5.length - 22; p >= Math.max(0, bytes5.length - 65557); p--) if (u322(p) === 101010256 && p + 22 + u162(p + 20) === bytes5.length) { + end = p; + break; + } + if (end < 0 || u162(end + 4) || u162(end + 6) || u162(end + 8) !== u162(end + 10)) throw Error("Invalid or multi-disk PhotoCraft ZIP"); + const count = u162(end + 10), cd = u322(end + 16), cdEnd = cd + u322(end + 12); + if (!count || count === 65535 || cdEnd !== end) throw Error("Unsupported PhotoCraft ZIP directory"); + const entries = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(); + let at = cd, total = 0; + for (let i = 0; i < count; i++) { + if (at + 46 > cdEnd || u322(at) !== 33639248) throw Error("Truncated PhotoCraft ZIP directory"); + const flags = u162(at + 8), method = u162(at + 10), crc = u322(at + 16), size = u322(at + 20), expanded = u322(at + 24); + const nameLen = u162(at + 28), extra = u162(at + 30), comment = u162(at + 32), local = u322(at + 42), next = at + 46 + nameLen + extra + comment; + if (next > cdEnd || u162(at + 34) || flags & ~2062 || ![0, 8].includes(method) || expanded > MAX_FILE || (total += expanded) > MAX_FILE) throw Error("Unsupported or oversized PhotoCraft ZIP entry"); + const name = packagePath(decoder.decode(bytes5.subarray(at + 46, at + 46 + nameLen))); + if (names.has(name.toLowerCase())) throw Error("Duplicate PhotoCraft ZIP entry"); + names.add(name.toLowerCase()); + if (local + 30 > cd || u322(local) !== 67324752 || u162(local + 6) !== flags || u162(local + 8) !== method) throw Error("Invalid PhotoCraft ZIP local header"); + const data = local + 30 + u162(local + 26) + u162(local + 28); + if (data + size > cd || data > cd || decoder.decode(bytes5.subarray(local + 30, local + 30 + u162(local + 26))) !== name) throw Error("Truncated PhotoCraft ZIP entry"); + if (!(flags & 8) && (u322(local + 14) !== crc || u322(local + 18) !== size || u322(local + 22) !== expanded)) throw Error("Mismatched PhotoCraft ZIP header"); + const raw = bytes5.subarray(data, data + size); + const content = method === 0 ? raw : await bounded(new Blob([raw]).stream().pipeThrough(new DecompressionStream("deflate-raw")), expanded); + if (content.length !== expanded || crc32(content) !== crc) throw Error(`PhotoCraft ZIP integrity failed: ${name}`); + entries.set(name, content); + at = next; + } + if (at !== cdEnd) throw Error("Invalid PhotoCraft ZIP directory length"); + return entries; +} +function writeZip(entries) { + if (!entries.size || entries.size >= 65535) throw Error("Invalid PhotoCraft archive entry count"); + const local = [], central = []; + let offset = 0, centralSize = 0; + for (const [path, bytes5] of entries) { + const name = encoder.encode(packagePath(path)); + if (!(bytes5 instanceof Uint8Array) || offset + bytes5.length > MAX_FILE) throw Error("PhotoCraft archive exceeds 256 MiB"); + const crc = crc32(bytes5), head = new Uint8Array(30), h = new DataView(head.buffer); + h.setUint32(0, 67324752, true); + h.setUint16(4, 20, true); + h.setUint16(6, 2048, true); + h.setUint16(12, 33, true); + h.setUint32(14, crc, true); + h.setUint32(18, bytes5.length, true); + h.setUint32(22, bytes5.length, true); + h.setUint16(26, name.length, true); + local.push(head, name, bytes5); + const row = new Uint8Array(46), c = new DataView(row.buffer); + c.setUint32(0, 33639248, true); + c.setUint16(4, 20, true); + c.setUint16(6, 20, true); + c.setUint16(8, 2048, true); + c.setUint16(14, 33, true); + c.setUint32(16, crc, true); + c.setUint32(20, bytes5.length, true); + c.setUint32(24, bytes5.length, true); + c.setUint16(28, name.length, true); + c.setUint32(42, offset, true); + central.push(row, name); + centralSize += 46 + name.length; + offset += 30 + name.length + bytes5.length; + } + const end = new Uint8Array(22), e = new DataView(end.buffer); + e.setUint32(0, 101010256, true); + e.setUint16(8, entries.size, true); + e.setUint16(10, entries.size, true); + e.setUint32(12, centralSize, true); + e.setUint32(16, offset, true); + const blob = new Blob([...local, ...central, end], { type: "application/octet-stream" }); + if (blob.size > MAX_FILE) throw Error("PhotoCraft archive exceeds 256 MiB"); + return blob; +} + +// apps/photocraft/package.mjs +var isNative2 = (path) => /\.pcraft$/i.test(path); +var utf8 = new TextEncoder(); +var hash = (bytes5) => Array.from(blake3(bytes5), (b) => b.toString(16).padStart(2, "0")).join(""); +async function readProject3(blob) { + const entries = await readZip(blob), manifest = entries.get("manifest.json"); + if (!manifest || manifest.length > 32 * 1024 ** 2) throw Error("PhotoCraft manifest is missing or too large"); + const doc = parse(new TextDecoder("utf-8", { fatal: true }).decode(manifest)); + if (Number(doc.format_version) !== 1 || !Array.isArray(doc.document?.layers)) throw Error("Unsupported PhotoCraft native format"); + return { doc, entries }; +} +function writeProject2(project) { + project.entries.set("manifest.json", utf8.encode(stringify(project.doc))); + return writeZip(project.entries); +} +function unpackEmbedded(bytes5) { + const v = new DataView(bytes5.buffer, bytes5.byteOffset, bytes5.byteLength); + if (bytes5.length < 7 || v.getUint32(0, true) !== 4247762216) throw Error("Invalid PhotoCraft embedded Zstandard frame"); + const flags = bytes5[4], single = !!(flags & 32), fcsFlag = flags >>> 6, dict = [0, 1, 2, 4][flags & 3]; + if (flags & 24 || dict) throw Error("Unsupported PhotoCraft Zstandard dictionary or flags"); + let at = 5 + (single ? 0 : 1), sizeBytes = fcsFlag ? 2 ** fcsFlag : single ? 1 : 0; + if (at + sizeBytes > bytes5.length) throw Error("Truncated PhotoCraft Zstandard header"); + let size = 0n; + for (let i = 0; i < sizeBytes; i++) size += BigInt(bytes5[at + i]) << BigInt(8 * i); + if (fcsFlag === 1) size += 256n; + if (size > BigInt(MAX_FILE)) throw Error("PhotoCraft embedded document exceeds 256 MiB"); + const window2 = single ? Number(size) : 2 ** (10 + (bytes5[5] >>> 3)) * (1 + (bytes5[5] & 7) / 8); + if (window2 > 32 * 1024 ** 2) throw Error("PhotoCraft embedded compression window exceeds 32 MiB"); + at += sizeBytes; + let last = false; + while (!last) { + if (at + 3 > bytes5.length) throw Error("Truncated PhotoCraft Zstandard block"); + const header = bytes5[at] | bytes5[at + 1] << 8 | bytes5[at + 2] << 16; + at += 3; + last = !!(header & 1); + const type = header >>> 1 & 3; + if (type === 3) throw Error("Invalid PhotoCraft Zstandard block type"); + const blockSize = header >>> 3; + if (blockSize > 131072) throw Error("Oversized PhotoCraft Zstandard block"); + at += type === 1 ? 1 : blockSize; + if (at > bytes5.length) throw Error("Truncated PhotoCraft Zstandard data"); + } + if (at + (flags & 4 ? 4 : 0) !== bytes5.length) throw Error("Unsupported concatenated PhotoCraft Zstandard frames"); + const chunks = []; + let total = 0; + const decoder9 = new Decompress((chunk) => { + total += chunk.length; + if (total > MAX_FILE) throw Error("PhotoCraft embedded data exceeds 256 MiB"); + chunks.push(chunk.slice()); + }); + decoder9.push(bytes5, true); + if (sizeBytes && BigInt(total) !== size) throw Error("PhotoCraft embedded content length mismatch"); + const out = new Uint8Array(total); + let offset = 0; + for (const c of chunks) { + out.set(c, offset); + offset += c.length; + } + return out; +} +function packEmbedded(bytes5) { + if (bytes5.length > MAX_FILE) throw Error("PhotoCraft embedded data exceeds 256 MiB"); + const blocks = Math.max(1, Math.ceil(bytes5.length / 131072)), out = new Uint8Array(10 + blocks * 3 + bytes5.length), v = new DataView(out.buffer); + v.setUint32(0, 4247762216, true); + out[4] = 128; + out[5] = 56; + v.setUint32(6, bytes5.length, true); + let at = 10; + for (let i = 0; i < blocks; i++) { + const block = bytes5.subarray(i * 131072, (i + 1) * 131072), h = block.length << 3 | (i === blocks - 1 ? 1 : 0); + out[at++] = h & 255; + out[at++] = h >>> 8 & 255; + out[at++] = h >>> 16; + out.set(block, at); + at += block.length; + } + return out; +} +function references(project) { + const direct = [], embedded = [], stack = [...project.doc.document.layers]; + let count = 0; + const add = (object8, key) => { + if (typeof object8?.[key] !== "string" || !object8[key]) throw Error("Invalid PhotoCraft linked path"); + direct.push({ object: object8, key }); + }; + while (stack.length) { + const layer = stack.pop(); + if (++count > 1e5) throw Error("PhotoCraft layer limit exceeded"); + const c = layer?.content; + if (!c || typeof c.kind !== "string") throw Error("Invalid PhotoCraft layer"); + if (c.kind === "group") { + if (!Array.isArray(c.children)) throw Error("Invalid PhotoCraft group"); + stack.push(...c.children); + } + if (c.kind === "smart") { + if (c.source?.kind === "linked") add(c.source, "path"); + else if (c.source?.kind === "embedded" && isNative2(c.source.file_name)) embedded.push(c.source); + for (const filter of c.smart_filters ?? []) for (const key of ["path", "mapPath", "lutPath"]) if (typeof filter.params?.[key] === "string") add(filter.params, key); + } + if (layer.video?.source?.File) add(layer.video.source.File, "path"); + } + for (const set of project.doc.document.variables?.data_sets ?? []) for (const value2 of set.values ?? []) if (value2.kind === "pixels") add(value2, "value"); + return { direct, embedded }; +} +async function rewriteProject2(blob, transform2, depth = 0, budget = { bytes: 0 }) { + if (depth > 8) throw Error("PhotoCraft embedded document depth exceeds 8"); + budget.bytes += blob.size; + if (budget.bytes > 512 * 1024 ** 2) throw Error("PhotoCraft expanded document exceeds 512 MiB"); + const project = await readProject3(blob), refs = references(project); + for (const ref of refs.direct) { + const mapped = await transform2({ link: { path: ref.object[ref.key] } }); + ref.object[ref.key] = mapped.path; + } + for (const ref of refs.embedded) { + if (typeof ref.blob !== "string" || !/^[a-f0-9]{64}$/.test(ref.blob)) throw Error("Invalid PhotoCraft embedded hash"); + const stored = project.entries.get(`blobs/${ref.blob}.zst`); + if (!stored) throw Error("Missing PhotoCraft embedded document"); + const original = unpackEmbedded(stored); + if (hash(original) !== ref.blob) throw Error("PhotoCraft embedded document hash mismatch"); + const rewritten = await rewriteProject2(new Blob([original]), transform2, depth + 1, budget), bytes5 = new Uint8Array(await rewritten.arrayBuffer()), key = hash(bytes5); + if (key !== ref.blob) { + project.entries.set(`blobs/${key}.zst`, packEmbedded(bytes5)); + ref.blob = key; + } + } + return writeProject2(project); +} + +// apps/photocraft/native-package.mjs +async function packageNativeProject3({ source, allowedRoot, output }) { + const root = await (0, import_promises3.realpath)(allowedRoot), master = await (0, import_promises3.realpath)(source); + const inside12 = (path) => path === root || path.startsWith(root + import_node_path3.sep); + if (!inside12(master) || !isNative2(master)) throw Error("PhotoCraft master is outside the assignment folder or is not native"); + const masterPath = packagePath((0, import_node_path3.basename)(master)); + const files = /* @__PURE__ */ new Map(), visiting = /* @__PURE__ */ new Set(), names = /* @__PURE__ */ new Map(); + let total = 0; + async function pack(input3, depth = 0) { + const file = await (0, import_promises3.realpath)(input3).catch(() => { + throw Error("Linked native artwork is missing"); + }); + if (!inside12(file)) throw Error("Linked artwork is outside the assignment folder"); + if (files.has(file)) return files.get(file); + if (depth > 8 || visiting.has(file)) throw Error("Cyclic or overly nested placed PhotoCraft document"); + if (files.size + visiting.size >= 200) throw Error("PhotoCraft package exceeds 200 files"); + const info = await (0, import_promises3.stat)(file); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("PhotoCraft package files must be nonempty and no larger than 256 MiB"); + total += info.size; + if (total > 512 * 1024 ** 2) throw Error("PhotoCraft package exceeds the 512 MiB browser memory limit"); + const path = file === master ? masterPath : packagePath((0, import_node_path3.relative)(root, file).split(import_node_path3.sep).join("/")); + if (names.has(path.toLowerCase()) && names.get(path.toLowerCase()) !== file) throw Error("Native package path collision"); + names.set(path.toLowerCase(), file); + visiting.add(file); + const original = new Blob([await (0, import_promises3.readFile)(file)]); + const blob = isNative2(file) ? await rewriteProject2(original, async (ref) => { + const input4 = ref.link.relative || ref.link.path; + const linked = await pack((0, import_node_path3.isAbsolute)(input4) ? input4 : (0, import_node_path3.resolve)((0, import_node_path3.dirname)(file), input4), depth + 1); + return { path: relativeReference(path, linked.path), blob: linked.blob }; + }) : original; + const result = { path, blob }; + files.set(file, result); + visiting.delete(file); + return result; + } + await pack(master); + await (0, import_promises3.mkdir)(output); + for (const { path, blob } of files.values()) { + const target = (0, import_node_path3.resolve)(output, path); + await (0, import_promises3.mkdir)((0, import_node_path3.dirname)(target), { recursive: true }); + await (0, import_promises3.writeFile)(target, new Uint8Array(await blob.arrayBuffer()), { flag: "wx" }); + } + return { masterPath, files: [masterPath, ...[...files.values()].map((f) => f.path).filter((path) => path !== masterPath)] }; +} + +// apps/lightcraft/native-package.mjs +var import_promises4 = require("node:fs/promises"); +var import_node_path4 = require("node:path"); + +// apps/lightcraft/package.mjs +var encoder2 = new TextEncoder(); +var MAX_CATALOG_BYTES = 32 * 1024 ** 2; +var LIBRARY_FILES = ["catalog.snap", "presets.json", "view.json", "prefs.json", "ui.json"]; +async function readCatalog(blob) { + if (!(blob instanceof Blob) || !blob.size || blob.size > MAX_CATALOG_BYTES) throw Error("LightCraft catalog must be nonempty and no larger than 32 MiB"); + const catalog = parse(new TextDecoder("utf-8", { fatal: true }).decode(await blob.arrayBuffer())); + if (catalog.format !== "lightcraft-catalog" || Number(catalog.version) !== 9 || !catalog.catalog?.photos || Array.isArray(catalog.catalog.photos) || typeof catalog.catalog.photos !== "object") throw Error("Unsupported LightCraft catalog format"); + if (!/^\d+$/.test(String(catalog.seq)) || Object.keys(catalog.catalog.photos).length > 1e5) throw Error("Invalid LightCraft catalog sequence or photo count"); + return catalog; +} +async function rewriteCatalog(blob, transform2) { + const document = await readCatalog(blob); + for (const photo of Object.values(document.catalog.photos)) { + if (photo?.source?.type === "file") { + if (typeof photo.source.path !== "string" || !photo.source.path) throw Error("LightCraft photo has no original path"); + photo.source.path = await transform2(photo.source.path, photo); + } else if (photo?.source?.type !== "demo") throw Error("Unsupported LightCraft photo source"); + } + const bytes5 = encoder2.encode(stringify(document)); + if (bytes5.length > MAX_CATALOG_BYTES) throw Error("LightCraft catalog exceeds 32 MiB"); + return new Blob([bytes5], { type: "application/json" }); +} +function requireCompacted(log) { + if (log && new TextDecoder("utf-8", { fatal: true }).decode(log).trim()) throw Error("Optimize this LightCraft library with library.compact before publishing so every edit is in catalog.snap"); +} + +// apps/lightcraft/native-package.mjs +async function packageNativeProject4({ source, allowedRoot, output }) { + const root = await (0, import_promises4.realpath)(allowedRoot), master = await (0, import_promises4.realpath)(source), folder = (0, import_node_path4.dirname)(master); + const inside12 = (path) => path === root || path.startsWith(root + import_node_path4.sep); + if (!inside12(master) || (0, import_node_path4.basename)(master) !== "catalog.snap") throw Error("LightCraft requires catalog.snap inside the assignment folder"); + const optional2 = async (path) => { + const file = await (0, import_promises4.realpath)(path).catch((error2) => { + if (error2.code === "ENOENT") return null; + throw error2; + }); + if (!file) return null; + const info = await (0, import_promises4.stat)(file); + if (!inside12(file) || !info.isFile() || info.size > 32 * 1024 ** 2) throw Error("LightCraft journal is outside the assignment or exceeds 32 MiB"); + return (0, import_promises4.readFile)(file); + }; + requireCompacted(await optional2((0, import_node_path4.resolve)(folder, "catalog.log"))); + const files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Map(); + let total = 0; + async function include(input3, requested) { + const file = await (0, import_promises4.realpath)(input3).catch(() => { + throw Error("A LightCraft original or settings file is missing"); + }); + if (!inside12(file)) throw Error("LightCraft original is outside the assignment folder"); + if (files.has(file)) return files.get(file); + const info = await (0, import_promises4.stat)(file); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2 || (total += info.size) > 512 * 1024 ** 2 || files.size >= 200) throw Error("LightCraft package exceeds its file or memory limit"); + const path = packagePath(requested ?? `originals/${(0, import_node_path4.relative)(root, file).split(import_node_path4.sep).join("/")}`); + if (names.has(path.toLowerCase())) throw Error("LightCraft package path collision"); + names.set(path.toLowerCase(), file); + const item = { path, bytes: await (0, import_promises4.readFile)(file) }; + files.set(file, item); + return item; + } + const original = await include(master, "catalog.snap"); + const rewritten = await rewriteCatalog(new Blob([original.bytes]), async (path) => (await include((0, import_node_path4.isAbsolute)(path) ? path : (0, import_node_path4.resolve)(folder, path))).path); + original.bytes = new Uint8Array(await rewritten.arrayBuffer()); + for (const name of LIBRARY_FILES.slice(1)) { + const file = (0, import_node_path4.resolve)(folder, name), exists = await (0, import_promises4.stat)(file).catch((error2) => { + if (error2.code === "ENOENT") return null; + throw error2; + }); + if (exists) await include(file, name); + } + await (0, import_promises4.mkdir)(output); + for (const { path, bytes: bytes5 } of files.values()) { + const target = (0, import_node_path4.resolve)(output, path); + await (0, import_promises4.mkdir)((0, import_node_path4.dirname)(target), { recursive: true }); + await (0, import_promises4.writeFile)(target, bytes5, { flag: "wx" }); + } + return { masterPath: "catalog.snap", files: [...files.values()].map((f) => f.path) }; +} +async function materializeNativeProject({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises4.realpath)(folder); + packagePath(masterPath); + if (masterPath !== "catalog.snap") throw Error("LightCraft requires a native catalog.snap at the package root"); + const files = /* @__PURE__ */ new Map(); + let total = 0; + async function include(path) { + packagePath(path); + if (files.has(path)) return; + const file = await (0, import_promises4.realpath)((0, import_node_path4.resolve)(root, path)); + if (!file.startsWith(root + import_node_path4.sep)) throw Error("LightCraft dependency escapes its saved package"); + const info = await (0, import_promises4.stat)(file); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2 || (total += info.size) > 512 * 1024 ** 2 || files.size >= 200) throw Error("LightCraft saved package exceeds its file or memory limit"); + files.set(path, await (0, import_promises4.readFile)(file)); + } + await include(masterPath); + const native2 = await rewriteCatalog(new Blob([files.get(masterPath)]), async (path) => { + const relativePath = packagePath(path); + await include(relativePath); + return (0, import_node_path4.resolve)(output, relativePath); + }); + files.set(masterPath, new Uint8Array(await native2.arrayBuffer())); + for (const name of LIBRARY_FILES.slice(1)) { + const file = (0, import_node_path4.resolve)(root, name), exists = await (0, import_promises4.stat)(file).catch((error2) => { + if (error2.code === "ENOENT") return null; + throw error2; + }); + if (exists) await include(name); + } + if (packageFiles) for (const path of packageFiles) await include(path); + requireCompacted(files.get("catalog.log")); + await (0, import_promises4.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path4.resolve)(output, path); + await (0, import_promises4.mkdir)((0, import_node_path4.dirname)(target), { recursive: true }); + await (0, import_promises4.writeFile)(target, bytes5, { flag: "wx" }); + } + return { masterPath: (0, import_node_path4.resolve)(output, masterPath), folder: output }; +} + +// apps/effectcraft/native-package.mjs +var import_promises5 = require("node:fs/promises"); +var import_node_fs2 = require("node:fs"); +var import_node_path5 = require("node:path"); + +// apps/effectcraft/linked-files.mjs +async function linkedFiles(path, blob, resolveLink, readBlob) { + const extension = path.split(".").pop().toLowerCase(); + if (extension === "fbx") throw Error("FBX resources are not packaged by this adapter yet. Import a GLB or glTF model with its textures instead."); + const link2 = (ref) => resolveLink(path, ref); + if (extension === "gltf" || extension === "glb") { + let text; + if (extension === "gltf") { + if (blob.size > 32 * 1024 ** 2) throw Error("glTF metadata exceeds 32 MiB"); + text = await blob.text(); + } else { + const header = new DataView(await blob.slice(0, 20).arrayBuffer()); + if (header.byteLength < 20 || header.getUint32(0, true) !== 1179937895 || header.getUint32(4, true) !== 2 || header.getUint32(8, true) !== blob.size || header.getUint32(16, true) !== 1313821514) throw Error("Invalid GLB model header"); + const length = header.getUint32(12, true); + if (length > 32 * 1024 ** 2 || length + 20 > blob.size || length % 4) throw Error("Invalid GLB metadata length"); + text = await blob.slice(20, 20 + length).text(); + } + const model = JSON.parse(text); + if (model.asset?.version !== "2.0") throw Error("This adapter requires glTF 2.0 models"); + const entries = [...model.buffers ?? [], ...model.images ?? []]; + if (entries.length > 1e4) throw Error("The model has too many resources"); + return entries.flatMap((item) => { + if (item.uri === void 0) return []; + if (typeof item.uri !== "string") throw Error("Invalid model resource URI"); + if (item.uri.startsWith("data:")) return []; + let ref; + try { + ref = decodeURIComponent(item.uri); + } catch { + throw Error("Invalid encoded model resource URI"); + } + return [link2(ref)]; + }); + } + if (extension === "obj") { + const result = []; + for (const line of (await blob.text()).split(/\r?\n/)) { + const match = line.split("#")[0].trim().match(/^mtllib\s+(.+)$/); + if (!match) continue; + let material; + for (const name of /* @__PURE__ */ new Set([match[1], ...match[1].split(/\s+/)])) { + const candidate = link2(name), bytes5 = await readBlob(candidate); + if (bytes5) { + material = bytes5; + result.push(candidate); + break; + } + } + if (!material) throw Error(`Linked model material is missing: ${match[1]}`); + for (const materialLine of (await material.text()).split(/\r?\n/)) { + const values = materialLine.split("#")[0].trim().split(/\s+/); + if (["map_Kd", "map_Ke", "map_Bump", "map_bump", "bump", "norm"].includes(values[0])) { + if (values.length < 2) throw Error("A model texture has no filename"); + result.push(link2(values.at(-1))); + } + } + } + return result; + } + return []; +} + +// apps/effectcraft/package.mjs +async function readProject4(blob) { + if (!(blob instanceof Blob) || !blob.size || blob.size > 32 * 1024 ** 2) throw Error("EffectCraft metadata must be nonempty and no larger than 32 MiB"); + const doc = parse(await blob.text()); + if (Number(doc?.schema) !== 2 || !doc.items || Array.isArray(doc.items) || typeof doc.items !== "object" || typeof doc.savedBy !== "string") throw Error("This adapter requires an EffectCraft schema 2 .ecproj save"); + return doc; +} +function mediaReferences3(doc) { + const refs = []; + for (const item of Object.values(doc.items)) { + for (const footage of [item?.kind?.type === "Footage" ? item.kind : null, item?.proxy?.footage]) { + if (!footage) continue; + if (typeof footage.path !== "string" || !footage.path) throw Error("An EffectCraft footage item has no source file"); + refs.push({ get path() { + return footage.path; + }, set path(value2) { + footage.path = value2; + } }); + if (footage.sequence !== void 0 && !Array.isArray(footage.sequence)) throw Error("Invalid footage sequence"); + if (footage.kind === "Sequence" && !footage.sequence?.length) throw Error("An image sequence has no frames"); + for (let i = 0; i < (footage.sequence?.length ?? 0); i++) { + if (typeof footage.sequence[i] !== "string" || !footage.sequence[i]) throw Error("An image sequence frame is missing"); + refs.push({ get path() { + return footage.sequence[i]; + }, set path(value2) { + footage.sequence[i] = value2; + } }); + } + } + } + return refs; +} + +// apps/effectcraft/native-package.mjs +async function packageNativeProject5({ source, allowedRoot, output }) { + const root = await (0, import_promises5.realpath)(allowedRoot), master = await (0, import_promises5.realpath)(source), inside12 = (p) => p === root || p.startsWith(root + import_node_path5.sep); + if (!inside12(master) || !master.toLowerCase().endsWith(".ecproj")) throw Error("EffectCraft master is outside the assignment or is not an .ecproj file"); + if ((await (0, import_promises5.stat)(master)).size > 32 * 1024 ** 2) throw Error("EffectCraft metadata exceeds 32 MiB"); + const doc = await readProject4(new Blob([await (0, import_promises5.readFile)(master)])), masterPath = packagePath((0, import_node_path5.basename)(master)); + const files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set([masterPath.toLowerCase()]); + let total = (await (0, import_promises5.stat)(master)).size; + async function read(path) { + const actual = await (0, import_promises5.realpath)(path).catch((error2) => { + if (error2.code === "ENOENT") return null; + throw error2; + }); + if (!actual) return null; + if (!inside12(actual)) throw Error("Linked media is outside the assignment folder"); + const info = await (0, import_promises5.stat)(actual); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("Linked files must be nonempty and no larger than 256 MiB"); + return new Blob([await (0, import_promises5.readFile)(actual)]); + } + const link2 = (from, ref) => { + const rel = resolveReference(packagePath((0, import_node_path5.relative)(root, from).split(import_node_path5.sep).join("/")), ref); + return (0, import_node_path5.resolve)(root, rel); + }; + async function add(path, depth = 0) { + const file = await (0, import_promises5.realpath)(path).catch(() => { + throw Error("Linked native media is missing"); + }); + if (!inside12(file)) throw Error("Linked media is outside the assignment folder"); + if (files.has(file)) return files.get(file); + if (depth > 8 || files.size >= 199) throw Error("EffectCraft dependency or file limit exceeded"); + const pathInPackage = packagePath((0, import_node_path5.relative)(root, file).split(import_node_path5.sep).join("/")); + if (names.has(pathInPackage.toLowerCase())) throw Error("Native package path collision"); + const blob = await read(file); + if (!blob) throw Error("Linked native media is missing"); + if ((total += blob.size) > 512 * 1024 ** 2) throw Error("EffectCraft package exceeds 512 MiB"); + names.add(pathInPackage.toLowerCase()); + files.set(file, pathInPackage); + for (const child2 of await linkedFiles(file, blob, link2, read)) await add(child2, depth + 1); + return pathInPackage; + } + for (const ref of mediaReferences3(doc)) ref.path = relativeReference(masterPath, await add((0, import_node_path5.isAbsolute)(ref.path) ? ref.path : (0, import_node_path5.resolve)((0, import_node_path5.dirname)(master), ref.path))); + await (0, import_promises5.mkdir)(output); + for (const [file, path] of files) { + const target = (0, import_node_path5.resolve)(output, path); + await (0, import_promises5.mkdir)((0, import_node_path5.dirname)(target), { recursive: true }); + await (0, import_promises5.copyFile)(file, target, import_node_fs2.constants.COPYFILE_EXCL); + } + await (0, import_promises5.writeFile)((0, import_node_path5.resolve)(output, masterPath), stringify(doc), { flag: "wx" }); + return { masterPath, files: [masterPath, ...files.values()] }; +} +async function materializeNativeProject2({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises5.realpath)(folder), files = /* @__PURE__ */ new Map(); + let total = 0; + if (!Array.isArray(packageFiles) || packageFiles.length > 200) throw Error("Invalid EffectCraft package file list"); + for (const path of packageFiles) { + packagePath(path); + const source = await (0, import_promises5.realpath)((0, import_node_path5.resolve)(root, path)); + if (!source.startsWith(root + import_node_path5.sep)) throw Error("Package file escapes its folder"); + const info = await (0, import_promises5.stat)(source); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2 || (total += info.size) > 512 * 1024 ** 2) throw Error("EffectCraft package exceeds its size limit"); + files.set(path, await (0, import_promises5.readFile)(source)); + } + if (!files.has(masterPath)) throw Error("EffectCraft master is missing"); + const doc = await readProject4(new Blob([files.get(masterPath)])); + const checked = /* @__PURE__ */ new Set(); + async function check(path, depth = 0) { + if (depth > 8) throw Error("Model dependencies are too deeply nested"); + if (checked.has(path)) return; + checked.add(path); + if (!files.has(path)) throw Error("Linked native media is missing"); + const read = (p) => files.has(p) ? new Blob([files.get(p)]) : null; + for (const child2 of await linkedFiles(path, read(path), resolveReference, read)) await check(child2, depth + 1); + } + for (const ref of mediaReferences3(doc)) { + const path = resolveReference(masterPath, ref.path); + await check(path); + ref.path = (0, import_node_path5.resolve)(output, path); + } + files.set(masterPath, new TextEncoder().encode(stringify(doc))); + await (0, import_promises5.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path5.resolve)(output, path); + await (0, import_promises5.mkdir)((0, import_node_path5.dirname)(target), { recursive: true }); + await (0, import_promises5.writeFile)(target, bytes5, { flag: "wx" }); + } + return { folder: output, masterPath: (0, import_node_path5.resolve)(output, masterPath) }; +} + +// apps/soundcraft/native-package.mjs +var import_promises6 = require("node:fs/promises"); +var import_node_fs3 = require("node:fs"); +var import_node_path6 = require("node:path"); + +// apps/soundcraft/package.mjs +async function readProject5(blob) { + if (!(blob instanceof Blob) || !blob.size || blob.size > 32 * 1024 ** 2) throw Error("SoundCraft metadata must be nonempty and no larger than 32 MiB"); + const doc = parse(await blob.text()); + if (Number(doc?.format_version) !== 1 || typeof doc.name !== "string" || !Array.isArray(doc.tracks) || !Array.isArray(doc.sources) || !Array.isArray(doc.videos ?? [])) throw Error("This adapter requires a SoundCraft version 1 .scraft session"); + return doc; +} +function mediaReferences4(doc) { + return [...doc.sources, ...doc.videos ?? []].map((source) => { + if (!source || typeof source.path !== "string" || !source.path) throw Error("A SoundCraft media source has no file"); + return { get path() { + return source.path; + }, set path(value2) { + source.path = value2; + } }; + }); +} + +// apps/soundcraft/native-package.mjs +async function packageNativeProject6({ source, allowedRoot, output }) { + const root = await (0, import_promises6.realpath)(allowedRoot), master = await (0, import_promises6.realpath)(source), inside12 = (path) => path.startsWith(root + import_node_path6.sep); + if (!inside12(master) || !master.toLowerCase().endsWith(".scraft")) throw Error("SoundCraft master is outside the assignment or is not a .scraft file"); + const info = await (0, import_promises6.stat)(master); + if (!info.isFile() || info.size > 32 * 1024 ** 2) throw Error("SoundCraft metadata exceeds 32 MiB"); + const doc = await readProject5(new Blob([await (0, import_promises6.readFile)(master)])), masterPath = packagePath((0, import_node_path6.basename)(master)); + const files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set([masterPath.toLowerCase()]); + let total = info.size; + for (const ref of mediaReferences4(doc)) { + const candidate = (0, import_node_path6.isAbsolute)(ref.path) ? ref.path : (0, import_node_path6.resolve)((0, import_node_path6.dirname)(master), ref.path); + const file = await (0, import_promises6.realpath)(candidate).catch(() => { + throw Error("Linked native media is missing"); + }); + if (!inside12(file)) throw Error("Linked media is outside the assignment folder"); + if (!files.has(file)) { + const path = packagePath((0, import_node_path6.relative)(root, file).split(import_node_path6.sep).join("/")); + if (names.has(path.toLowerCase())) throw Error("Native package path collision"); + const size = await (0, import_promises6.stat)(file); + if (!size.isFile() || !size.size || size.size > 256 * 1024 ** 2 || (total += size.size) > 512 * 1024 ** 2 || files.size >= 199) throw Error("SoundCraft native package exceeds its file or size limit"); + names.add(path.toLowerCase()); + files.set(file, path); + } + ref.path = relativeReference(masterPath, files.get(file)); + } + await (0, import_promises6.mkdir)(output); + for (const [file, path] of files) { + const target = (0, import_node_path6.resolve)(output, path); + await (0, import_promises6.mkdir)((0, import_node_path6.dirname)(target), { recursive: true }); + await (0, import_promises6.copyFile)(file, target, import_node_fs3.constants.COPYFILE_EXCL); + } + await (0, import_promises6.writeFile)((0, import_node_path6.resolve)(output, masterPath), stringify(doc), { flag: "wx" }); + return { masterPath, files: [masterPath, ...files.values()] }; +} +async function materializeNativeProject3({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises6.realpath)(folder), files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(); + let total = 0; + packagePath(masterPath); + if (!Array.isArray(packageFiles) || !packageFiles.length || packageFiles.length > 200) throw Error("Invalid SoundCraft package file list"); + for (const path of packageFiles) { + packagePath(path); + if (names.has(path.toLowerCase())) throw Error("Native package path collision"); + names.add(path.toLowerCase()); + const source = await (0, import_promises6.realpath)((0, import_node_path6.resolve)(root, path)), info = await (0, import_promises6.stat)(source); + if (!source.startsWith(root + import_node_path6.sep)) throw Error("Package file escapes its folder"); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2 || (total += info.size) > 512 * 1024 ** 2) throw Error("SoundCraft package exceeds its size limit"); + files.set(path, await (0, import_promises6.readFile)(source)); + } + if (!files.has(masterPath)) throw Error("SoundCraft master is missing"); + const doc = await readProject5(new Blob([files.get(masterPath)])); + for (const ref of mediaReferences4(doc)) if (!files.has(resolveReference(masterPath, ref.path))) throw Error("Linked native media is missing"); + await (0, import_promises6.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path6.resolve)(output, path); + await (0, import_promises6.mkdir)((0, import_node_path6.dirname)(target), { recursive: true }); + await (0, import_promises6.writeFile)(target, bytes5, { flag: "wx" }); + } + return { folder: output, masterPath: (0, import_node_path6.resolve)(output, masterPath) }; +} + +// apps/designcraft/native-package.mjs +var import_promises7 = require("node:fs/promises"); +var import_node_path7 = require("node:path"); + +// apps/designcraft/container.mjs +var MAX_FILE2 = 256 * 1024 ** 2; +var encoder3 = new TextEncoder(); +var decoder2 = new TextDecoder("utf-8", { fatal: true }); +var crcTable2 = Uint32Array.from({ length: 256 }, (_, i) => { + let c = i; + for (let j = 0; j < 8; j++) c = c >>> 1 ^ (c & 1 ? 3988292384 : 0); + return c >>> 0; +}); +function crc322(bytes5) { + let c = 4294967295; + for (const b of bytes5) c = c >>> 8 ^ crcTable2[(c ^ b) & 255]; + return (c ^ 4294967295) >>> 0; +} +async function bounded2(stream, limit) { + const reader = stream.getReader(), parts = []; + let total = 0; + try { + while (true) { + const { done, value: value2 } = await reader.read(); + if (done) break; + total += value2.length; + if (total > limit) throw Error("DesignCraft archive exceeds its expanded size limit"); + parts.push(value2); + } + } catch (error2) { + await reader.cancel().catch(() => { + }); + throw error2; + } + return new Uint8Array(await new Blob(parts).arrayBuffer()); +} +async function readZip2(blob) { + if (!(blob instanceof Blob) || blob.size < 22 || blob.size > MAX_FILE2) throw Error("Invalid DesignCraft archive size"); + const bytes5 = new Uint8Array(await blob.arrayBuffer()), v = new DataView(bytes5.buffer); + const u162 = (p) => v.getUint16(p, true), u322 = (p) => v.getUint32(p, true); + let end = -1; + for (let p = bytes5.length - 22; p >= Math.max(0, bytes5.length - 65557); p--) if (u322(p) === 101010256 && p + 22 + u162(p + 20) === bytes5.length) { + end = p; + break; + } + if (end < 0 || u162(end + 4) || u162(end + 6) || u162(end + 8) !== u162(end + 10)) throw Error("Invalid or multi-disk DesignCraft ZIP"); + const count = u162(end + 10), cd = u322(end + 16), cdEnd = cd + u322(end + 12); + if (!count || count === 65535 || cdEnd !== end) throw Error("Unsupported DesignCraft ZIP directory"); + const entries = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(); + let at = cd, total = 0; + for (let i = 0; i < count; i++) { + if (at + 46 > cdEnd || u322(at) !== 33639248) throw Error("Truncated DesignCraft ZIP directory"); + const flags = u162(at + 8), method = u162(at + 10), crc = u322(at + 16), size = u322(at + 20), expanded = u322(at + 24); + const nameLen = u162(at + 28), extra = u162(at + 30), comment = u162(at + 32), local = u322(at + 42), next = at + 46 + nameLen + extra + comment; + if (next > cdEnd || u162(at + 34) || flags & ~2062 || ![0, 8].includes(method) || expanded > MAX_FILE2 || (total += expanded) > MAX_FILE2) throw Error("Unsupported or oversized DesignCraft ZIP entry"); + const name = packagePath(decoder2.decode(bytes5.subarray(at + 46, at + 46 + nameLen))); + if (names.has(name.toLowerCase())) throw Error("Duplicate DesignCraft ZIP entry"); + names.add(name.toLowerCase()); + if (local + 30 > cd || u322(local) !== 67324752 || u162(local + 6) !== flags || u162(local + 8) !== method) throw Error("Invalid DesignCraft ZIP local header"); + const data = local + 30 + u162(local + 26) + u162(local + 28); + if (data + size > cd || data > cd || decoder2.decode(bytes5.subarray(local + 30, local + 30 + u162(local + 26))) !== name) throw Error("Truncated DesignCraft ZIP entry"); + if (!(flags & 8) && (u322(local + 14) !== crc || u322(local + 18) !== size || u322(local + 22) !== expanded)) throw Error("Mismatched DesignCraft ZIP header"); + const raw = bytes5.subarray(data, data + size); + const content = method === 0 ? raw : await bounded2(new Blob([raw]).stream().pipeThrough(new DecompressionStream("deflate-raw")), expanded); + if (content.length !== expanded || crc322(content) !== crc) throw Error(`DesignCraft ZIP integrity failed: ${name}`); + entries.set(name, content); + at = next; + } + if (at !== cdEnd) throw Error("Invalid DesignCraft ZIP directory length"); + return entries; +} +function writeZip2(entries) { + if (!entries.size || entries.size >= 65535) throw Error("Invalid DesignCraft archive entry count"); + const local = [], central = []; + let offset = 0, centralSize = 0; + for (const [path, bytes5] of entries) { + const name = encoder3.encode(packagePath(path)); + if (!(bytes5 instanceof Uint8Array) || offset + bytes5.length > MAX_FILE2) throw Error("DesignCraft archive exceeds 256 MiB"); + const crc = crc322(bytes5), head = new Uint8Array(30), h = new DataView(head.buffer); + h.setUint32(0, 67324752, true); + h.setUint16(4, 20, true); + h.setUint16(6, 2048, true); + h.setUint16(12, 33, true); + h.setUint32(14, crc, true); + h.setUint32(18, bytes5.length, true); + h.setUint32(22, bytes5.length, true); + h.setUint16(26, name.length, true); + local.push(head, name, bytes5); + const row = new Uint8Array(46), c = new DataView(row.buffer); + c.setUint32(0, 33639248, true); + c.setUint16(4, 20, true); + c.setUint16(6, 20, true); + c.setUint16(8, 2048, true); + c.setUint16(14, 33, true); + c.setUint32(16, crc, true); + c.setUint32(20, bytes5.length, true); + c.setUint32(24, bytes5.length, true); + c.setUint16(28, name.length, true); + c.setUint32(42, offset, true); + central.push(row, name); + centralSize += 46 + name.length; + offset += 30 + name.length + bytes5.length; + } + const end = new Uint8Array(22), e = new DataView(end.buffer); + e.setUint32(0, 101010256, true); + e.setUint16(8, entries.size, true); + e.setUint16(10, entries.size, true); + e.setUint32(12, centralSize, true); + e.setUint32(16, offset, true); + const blob = new Blob([...local, ...central, end], { type: "application/octet-stream" }); + if (blob.size > MAX_FILE2) throw Error("DesignCraft archive exceeds 256 MiB"); + return blob; +} + +// apps/designcraft/package.mjs +var utf82 = new TextEncoder(); +var decoder3 = new TextDecoder("utf-8", { fatal: true }); +var isNative3 = (path) => /\.designcraft$/i.test(path); +async function readProject6(blob) { + if (!(blob instanceof Blob) || !blob.size || blob.size > MAX_FILE2) throw Error("Invalid DesignCraft master size"); + const zip = await blob.slice(0, 2).text() === "PK"; + const entries = zip ? await readZip2(blob) : null; + const metadata = entries?.get("meta.json"); + if (metadata) { + const meta2 = parse(decoder3.decode(metadata)); + if (meta2.format !== "designcraft" || Number(meta2.version) > 3) throw Error("Unsupported DesignCraft native format"); + } + const data = entries ? entries.get("document.json") : new Uint8Array(await blob.arrayBuffer()); + if (!data || data.length > 32 * 1024 ** 2) throw Error("DesignCraft document metadata is missing or exceeds 32 MiB"); + const doc = parse(decoder3.decode(data)); + if (!doc || typeof doc.title !== "string" || !Array.isArray(doc.spreads) || !Array.isArray(doc.layers) || !doc.stories || typeof doc.stories !== "object") throw Error("Invalid DesignCraft document"); + return { doc, entries }; +} +function writeProject3({ doc, entries }) { + const data = utf82.encode(stringify(doc)); + if (data.length > 32 * 1024 ** 2) throw Error("DesignCraft document metadata exceeds 32 MiB"); + if (!entries) return new Blob([data], { type: "application/json" }); + entries.set("document.json", data); + return writeZip2(entries); +} +function fileReferences(doc) { + const out = []; + const add = (object8, key, base, imageCell = false) => { + if (typeof object8[key] !== "string" || !object8[key]) throw Error("Invalid DesignCraft linked path"); + out.push({ object: object8, key, path: object8[key], base, imageCell }); + }; + for (const asset of Object.values(doc.assets ?? {})) if (asset.link != null) add(asset, "link"); + for (const story of Object.values(doc.stories ?? {})) if (story.fileLink) add(story.fileLink, "path"); + for (const source of doc.dataMerge?.sources ?? []) { + const base = source.path ?? source.relativePath; + if (base != null) { + if (source.path != null) add(source, "path"); + if (source.relativePath != null) add(source, "relativePath"); + } + const imageNames = new Set((doc.dataMerge?.placeholders ?? []).filter((p) => p.role === "image" && String(p.sourceId) === String(source.id)).map((p) => p.field)); + const columns = (source.fields ?? []).flatMap((field, i) => field.kind === "image" || imageNames.has(field.name) ? [i] : []); + for (const row of source.rows ?? []) for (const i of columns) if (row[i]?.trim()) add(row, i, base, true); + } + if (out.length > 1e5) throw Error("DesignCraft has too many linked references"); + return out; +} +async function rewriteProject3(blob, transform2) { + const project = await readProject6(blob); + for (const ref of fileReferences(project.doc)) ref.object[ref.key] = await transform2(ref); + return writeProject3(project); +} + +// apps/designcraft/native-package.mjs +async function packageNativeProject7({ source, allowedRoot, output }) { + const root = await (0, import_promises7.realpath)(allowedRoot), master = await (0, import_promises7.realpath)(source); + const inside12 = (path) => path.startsWith(root + import_node_path7.sep); + if (!inside12(master) || !isNative3(master)) throw Error("DesignCraft master is outside the assignment or is not a .designcraft file"); + const masterPath = packagePath((0, import_node_path7.basename)(master)), files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(), visiting = /* @__PURE__ */ new Set(); + let total = 0; + async function add(candidate, depth = 0) { + const actual = await (0, import_promises7.realpath)(candidate).catch(() => { + throw Error("Linked native DesignCraft file is missing"); + }); + if (!inside12(actual)) throw Error("Linked DesignCraft file is outside the assignment folder"); + if (files.has(actual)) return files.get(actual).path; + if (depth > 8 || visiting.has(actual) || files.size + visiting.size >= 200) throw Error("DesignCraft package has cyclic or excessive dependencies"); + const info = await (0, import_promises7.stat)(actual); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2 || (total += info.size) > 512 * 1024 ** 2) throw Error("DesignCraft package exceeds its file or memory limit"); + const path = actual === master ? masterPath : packagePath((0, import_node_path7.relative)(root, actual).split(import_node_path7.sep).join("/")); + if (names.has(path.toLowerCase())) throw Error("DesignCraft package path collision"); + names.add(path.toLowerCase()); + visiting.add(actual); + let blob = new Blob([await (0, import_promises7.readFile)(actual)]); + if (isNative3(actual)) blob = await rewriteProject3(blob, async (ref) => { + if (ref.imageCell && (/^(?:[\/\\]|[a-z][a-z0-9+.-]*:)/i.test(ref.path) || ref.path.includes("\\"))) { + throw Error("Use relative image paths with forward slashes in the DesignCraft data source before saving it to the library"); + } + const base = ref.base ? (0, import_node_path7.isAbsolute)(ref.base) ? ref.base : (0, import_node_path7.resolve)((0, import_node_path7.dirname)(actual), ref.base) : actual; + const target = await add((0, import_node_path7.isAbsolute)(ref.path) ? ref.path : (0, import_node_path7.resolve)((0, import_node_path7.dirname)(base), ref.path), depth + 1); + const packageBase = ref.base ? packagePath((0, import_node_path7.relative)(root, await (0, import_promises7.realpath)(base)).split(import_node_path7.sep).join("/")) : path; + return relativeReference(packageBase, target); + }); + files.set(actual, { path, bytes: new Uint8Array(await blob.arrayBuffer()) }); + visiting.delete(actual); + return path; + } + await add(master); + await (0, import_promises7.mkdir)(output); + for (const file of files.values()) { + const target = (0, import_node_path7.resolve)(output, file.path); + await (0, import_promises7.mkdir)((0, import_node_path7.dirname)(target), { recursive: true }); + await (0, import_promises7.writeFile)(target, file.bytes, { flag: "wx" }); + } + return { masterPath, files: [...files.values()].map((f) => f.path) }; +} +async function materializeNativeProject4({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises7.realpath)(folder), files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(); + let total = 0; + packagePath(masterPath); + if (!Array.isArray(packageFiles) || !packageFiles.length || packageFiles.length > 200 || !isNative3(masterPath)) throw Error("Invalid DesignCraft native package"); + for (const path of packageFiles) { + packagePath(path); + if (names.has(path.toLowerCase())) throw Error("DesignCraft package path collision"); + names.add(path.toLowerCase()); + const actual = await (0, import_promises7.realpath)((0, import_node_path7.resolve)(root, path)), info = await (0, import_promises7.stat)(actual); + if (!actual.startsWith(root + import_node_path7.sep)) throw Error("DesignCraft package file escapes its folder"); + if (!info.isFile() || !info.size || info.size > 256 * 1024 ** 2 || (total += info.size) > 512 * 1024 ** 2) throw Error("DesignCraft package exceeds its file or memory limit"); + files.set(path, await (0, import_promises7.readFile)(actual)); + } + if (!files.has(masterPath)) throw Error("DesignCraft master is missing"); + const checked = /* @__PURE__ */ new Set(), visiting = /* @__PURE__ */ new Set(); + async function check(path, depth = 0) { + if (checked.has(path)) return; + if (depth > 8 || visiting.has(path)) throw Error("DesignCraft native links are cyclic or too deeply nested"); + const bytes5 = files.get(path); + if (!bytes5) throw Error("Linked native DesignCraft file is missing"); + visiting.add(path); + if (isNative3(path)) for (const ref of fileReferences((await readProject6(new Blob([bytes5]))).doc)) { + const base = ref.base ? resolveReference(path, ref.base) : path; + await check(resolveReference(base, ref.path), depth + 1); + } + visiting.delete(path); + checked.add(path); + } + await check(masterPath); + await (0, import_promises7.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path7.resolve)(output, path); + await (0, import_promises7.mkdir)((0, import_node_path7.dirname)(target), { recursive: true }); + await (0, import_promises7.writeFile)(target, bytes5, { flag: "wx" }); + } + return { folder: output, masterPath: (0, import_node_path7.resolve)(output, masterPath) }; +} + +// apps/pdfcraft/native-package.mjs +var import_promises8 = require("node:fs/promises"); +var import_node_path8 = require("node:path"); + +// apps/pdfcraft/package.mjs +var MAX_PDF_BYTES = 256 * 1024 ** 2; +var isNative4 = (path) => typeof path === "string" && /\.pdf$/i.test(path); +async function checkedPdf(blob) { + if (!(blob instanceof Blob) || blob.size < 8 || blob.size > MAX_PDF_BYTES) throw Error("PDF files must be nonempty and no larger than 256 MiB"); + if (!/%PDF-[12]\.\d/.test(await blob.slice(0, 1024).text())) throw Error("This file has no supported PDF header"); + return blob; +} + +// apps/pdfcraft/native-package.mjs +async function confinedFile(root, candidate) { + const actual = await (0, import_promises8.realpath)(candidate), info = await (0, import_promises8.stat)(actual); + if (!actual.startsWith(root + import_node_path8.sep)) throw Error("PDF file escapes the assignment folder"); + if (!info.isFile() || info.size < 8 || info.size > MAX_PDF_BYTES) throw Error("PDF file is empty or exceeds 256 MiB"); + return (0, import_promises8.readFile)(actual); +} +async function packageNativeProject8({ source, allowedRoot, output }) { + const root = await (0, import_promises8.realpath)(allowedRoot), masterPath = packagePath((0, import_node_path8.basename)(source)); + if (!isNative4(masterPath)) throw Error("PdfCraft requires a .pdf master"); + const bytes5 = await confinedFile(root, source); + await checkedPdf(new Blob([bytes5])); + await (0, import_promises8.mkdir)(output); + await (0, import_promises8.writeFile)((0, import_node_path8.resolve)(output, masterPath), bytes5, { flag: "wx" }); + return { masterPath, files: [masterPath] }; +} +async function materializeNativeProject5({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises8.realpath)(folder); + packagePath(masterPath); + if (!isNative4(masterPath) || !Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("PDF master is missing from its saved package"); + const bytes5 = await confinedFile(root, (0, import_node_path8.resolve)(root, masterPath)); + await checkedPdf(new Blob([bytes5])); + await (0, import_promises8.mkdir)(output); + const target = (0, import_node_path8.resolve)(output, masterPath); + await (0, import_promises8.mkdir)((0, import_node_path8.dirname)(target), { recursive: true }); + await (0, import_promises8.writeFile)(target, bytes5, { flag: "wx" }); + return { folder: output, masterPath: target }; +} + +// apps/pdfcraft/native-batch.mjs +var import_promises9 = require("node:fs/promises"); +var import_node_path9 = require("node:path"); +var import_node_crypto = require("node:crypto"); +async function prepareNativeBatch({ workRoot, steps }) { + if (!Array.isArray(steps) || !steps.length || steps.length > 100) throw Error("A native PDF batch needs 1\u2013100 tool steps"); + const root = await (0, import_promises9.realpath)(workRoot); + for (const step of steps) { + if (!step || typeof step !== "object" || Array.isArray(step) || Object.keys(step).some((k) => !["tool", "args", "out"].includes(k)) || typeof step.tool !== "string" || !/^[a-z][a-z0-9_]{0,63}$/.test(step.tool) || !step.args || typeof step.args !== "object" || Array.isArray(step.args)) throw Error("Each native PDF step needs a tool name and an arguments object"); + if (step.out !== void 0) { + if (typeof step.out !== "string" || !step.out || step.out.includes("\0") || !(0, import_node_path9.resolve)(root, step.out).startsWith(root + import_node_path9.sep)) throw Error("Native batch output must stay inside the assignment"); + } + } + const json = JSON.stringify(steps); + if (Buffer.byteLength(json) > 262144) throw Error("A native PDF batch is limited to 256 KiB"); + const script = (0, import_node_path9.resolve)(root, `.pdf-batch-${(0, import_node_crypto.randomUUID)()}.json`); + await (0, import_promises9.writeFile)(script, json, { flag: "wx", mode: 384 }); + return ["run", "--script", script, "--root", root, "--report"]; +} + +// apps/wordcraft/native-package.mjs +var import_promises10 = require("node:fs/promises"); +var import_node_path10 = require("node:path"); + +// apps/wordcraft/package.mjs +var MAX_WORD_BYTES = 256 * 1024 ** 2; +var isNative5 = (path) => typeof path === "string" && /\.(docx|docm|dotx|dotm)$/i.test(path); +async function checkedWord(blob) { + if (!(blob instanceof Blob) || blob.size < 8 || blob.size > MAX_WORD_BYTES) throw Error("Word documents must be nonempty and no larger than 256 MiB"); + const head = new Uint8Array(await blob.slice(0, 8).arrayBuffer()); + const zip = head[0] === 80 && head[1] === 75 && head[2] === 3 && head[3] === 4; + const encrypted = [208, 207, 17, 224, 161, 177, 26, 225].every((byte, i) => head[i] === byte); + if (!zip && !encrypted) throw Error("Expected a native OOXML or encrypted Word package"); + return blob; +} + +// apps/wordcraft/native-package.mjs +async function confinedFile2(root, candidate) { + const actual = await (0, import_promises10.realpath)(candidate), info = await (0, import_promises10.stat)(actual); + if (!actual.startsWith(root + import_node_path10.sep)) throw Error("Word document escapes the assignment folder"); + if (!info.isFile() || info.size < 8 || info.size > MAX_WORD_BYTES) throw Error("Word document is empty or exceeds 256 MiB"); + const bytes5 = await (0, import_promises10.readFile)(actual); + await checkedWord(new Blob([bytes5])); + return bytes5; +} +async function packageNativeProject9({ source, allowedRoot, output }) { + const root = await (0, import_promises10.realpath)(allowedRoot), masterPath = packagePath((0, import_node_path10.basename)(source)); + if (!isNative5(masterPath)) throw Error("WordCraft requires an editable OOXML master"); + const bytes5 = await confinedFile2(root, source); + await (0, import_promises10.mkdir)(output); + await (0, import_promises10.writeFile)((0, import_node_path10.resolve)(output, masterPath), bytes5, { flag: "wx" }); + return { masterPath, files: [masterPath] }; +} +async function materializeNativeProject6({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises10.realpath)(folder); + packagePath(masterPath); + if (!isNative5(masterPath) || !Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("Word master is missing from its saved package"); + const bytes5 = await confinedFile2(root, (0, import_node_path10.resolve)(root, masterPath)); + await (0, import_promises10.mkdir)(output); + const target = (0, import_node_path10.resolve)(output, masterPath); + await (0, import_promises10.mkdir)((0, import_node_path10.dirname)(target), { recursive: true }); + await (0, import_promises10.writeFile)(target, bytes5, { flag: "wx" }); + return { folder: output, masterPath: target }; +} + +// apps/deckcraft/native-package.mjs +var import_promises11 = require("node:fs/promises"); +var import_node_path11 = require("node:path"); + +// apps/deckcraft/container.mjs +var MAX_FILE3 = 256 * 1024 ** 2; +var encoder4 = new TextEncoder(); +var decoder4 = new TextDecoder("utf-8", { fatal: true }); +var crcTable3 = Uint32Array.from({ length: 256 }, (_, i) => { + let c = i; + for (let j = 0; j < 8; j++) c = c >>> 1 ^ (c & 1 ? 3988292384 : 0); + return c >>> 0; +}); +function crc323(bytes5) { + let c = 4294967295; + for (const b of bytes5) c = c >>> 8 ^ crcTable3[(c ^ b) & 255]; + return (c ^ 4294967295) >>> 0; +} +async function bounded3(stream, limit) { + const reader = stream.getReader(), parts = []; + let total = 0; + try { + while (true) { + const { done, value: value2 } = await reader.read(); + if (done) break; + total += value2.length; + if (total > limit) throw Error("DeckCraft archive exceeds its expanded size limit"); + parts.push(value2); + } + } catch (error2) { + await reader.cancel().catch(() => { + }); + throw error2; + } + return new Uint8Array(await new Blob(parts).arrayBuffer()); +} +async function readZip3(blob) { + if (!(blob instanceof Blob) || blob.size < 22 || blob.size > MAX_FILE3) throw Error("Invalid DeckCraft archive size"); + const bytes5 = new Uint8Array(await blob.arrayBuffer()), v = new DataView(bytes5.buffer); + const u162 = (p) => v.getUint16(p, true), u322 = (p) => v.getUint32(p, true); + let end = -1; + for (let p = bytes5.length - 22; p >= Math.max(0, bytes5.length - 65557); p--) if (u322(p) === 101010256 && p + 22 + u162(p + 20) === bytes5.length) { + end = p; + break; + } + if (end < 0 || u162(end + 4) || u162(end + 6) || u162(end + 8) !== u162(end + 10)) throw Error("Invalid or multi-disk DeckCraft ZIP"); + const count = u162(end + 10), cd = u322(end + 16), cdEnd = cd + u322(end + 12); + if (!count || count === 65535 || cdEnd !== end) throw Error("Unsupported DeckCraft ZIP directory"); + const entries = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(); + let at = cd, total = 0; + for (let i = 0; i < count; i++) { + if (at + 46 > cdEnd || u322(at) !== 33639248) throw Error("Truncated DeckCraft ZIP directory"); + const flags = u162(at + 8), method = u162(at + 10), crc = u322(at + 16), size = u322(at + 20), expanded = u322(at + 24); + const nameLen = u162(at + 28), extra = u162(at + 30), comment = u162(at + 32), local = u322(at + 42), next = at + 46 + nameLen + extra + comment; + if (next > cdEnd || u162(at + 34) || flags & ~2062 || ![0, 8].includes(method) || expanded > MAX_FILE3 || (total += expanded) > MAX_FILE3) throw Error("Unsupported or oversized DeckCraft ZIP entry"); + const name = packagePath(decoder4.decode(bytes5.subarray(at + 46, at + 46 + nameLen))); + if (names.has(name.toLowerCase())) throw Error("Duplicate DeckCraft ZIP entry"); + names.add(name.toLowerCase()); + if (local + 30 > cd || u322(local) !== 67324752 || u162(local + 6) !== flags || u162(local + 8) !== method) throw Error("Invalid DeckCraft ZIP local header"); + const data = local + 30 + u162(local + 26) + u162(local + 28); + if (data + size > cd || data > cd || decoder4.decode(bytes5.subarray(local + 30, local + 30 + u162(local + 26))) !== name) throw Error("Truncated DeckCraft ZIP entry"); + if (!(flags & 8) && (u322(local + 14) !== crc || u322(local + 18) !== size || u322(local + 22) !== expanded)) throw Error("Mismatched DeckCraft ZIP header"); + const raw = bytes5.subarray(data, data + size); + const content = method === 0 ? raw : await bounded3(new Blob([raw]).stream().pipeThrough(new DecompressionStream("deflate-raw")), expanded); + if (content.length !== expanded || crc323(content) !== crc) throw Error(`DeckCraft ZIP integrity failed: ${name}`); + entries.set(name, content); + at = next; + } + if (at !== cdEnd) throw Error("Invalid DeckCraft ZIP directory length"); + return entries; +} +function writeZip3(entries) { + if (!entries.size || entries.size >= 65535) throw Error("Invalid DeckCraft archive entry count"); + const local = [], central = []; + let offset = 0, centralSize = 0; + for (const [path, bytes5] of entries) { + const name = encoder4.encode(packagePath(path)); + if (!(bytes5 instanceof Uint8Array) || offset + bytes5.length > MAX_FILE3) throw Error("DeckCraft archive exceeds 256 MiB"); + const crc = crc323(bytes5), head = new Uint8Array(30), h = new DataView(head.buffer); + h.setUint32(0, 67324752, true); + h.setUint16(4, 20, true); + h.setUint16(6, 2048, true); + h.setUint16(12, 33, true); + h.setUint32(14, crc, true); + h.setUint32(18, bytes5.length, true); + h.setUint32(22, bytes5.length, true); + h.setUint16(26, name.length, true); + local.push(head, name, bytes5); + const row = new Uint8Array(46), c = new DataView(row.buffer); + c.setUint32(0, 33639248, true); + c.setUint16(4, 20, true); + c.setUint16(6, 20, true); + c.setUint16(8, 2048, true); + c.setUint16(14, 33, true); + c.setUint32(16, crc, true); + c.setUint32(20, bytes5.length, true); + c.setUint32(24, bytes5.length, true); + c.setUint16(28, name.length, true); + c.setUint32(42, offset, true); + central.push(row, name); + centralSize += 46 + name.length; + offset += 30 + name.length + bytes5.length; + } + const end = new Uint8Array(22), e = new DataView(end.buffer); + e.setUint32(0, 101010256, true); + e.setUint16(8, entries.size, true); + e.setUint16(10, entries.size, true); + e.setUint32(12, centralSize, true); + e.setUint32(16, offset, true); + const blob = new Blob([...local, ...central, end], { type: "application/octet-stream" }); + if (blob.size > MAX_FILE3) throw Error("DeckCraft archive exceeds 256 MiB"); + return blob; +} + +// apps/deckcraft/package.mjs +var import_xmldom = __toESM(require_lib(), 1); +var utf83 = new TextEncoder(); +var decoder5 = new TextDecoder("utf-8", { fatal: true }); +var isOffice = (path) => /\.(pptx|pptm|potx|potm|ppsx|ppsm)$/i.test(path); +var isNative6 = (path) => /\.deckcraft$/i.test(path) || isOffice(path); +async function checkedOffice(blob) { + const entries = await readZip3(blob); + if (!entries.has("[Content_Types].xml") || !entries.has("ppt/presentation.xml")) throw Error("Choose a complete native PowerPoint package"); + for (const [path, data] of entries) { + if (!path.endsWith(".rels")) continue; + if (data.length > 16 * 1024 ** 2) throw Error("PowerPoint relationships exceed 16 MiB"); + const xml = decoder5.decode(data); + if (/ { + if (level !== "warning") throw Error("Invalid PowerPoint relationships"); + } }).parseFromString(xml, "application/xml"); + for (const relationship of Array.from(document.getElementsByTagNameNS("*", "Relationship"))) { + if (relationship.getAttribute("TargetMode")?.toLowerCase() === "external" && !relationship.getAttribute("Type")?.endsWith("/hyperlink")) throw Error("Embed externally linked PowerPoint inputs in the native app before importing"); + } + } + return blob; +} +function mediaReferences5(presentation) { + const media = presentation.media ?? []; + if (!Array.isArray(media) || media.length > 1e5) throw Error("Invalid DeckCraft media list"); + const seen = /* @__PURE__ */ new Set(); + for (const item of media) { + const id = Number(item.id); + if (!Number.isInteger(id) || id < 0 || id > 4294967295 || seen.has(id)) throw Error("Invalid or duplicate DeckCraft media identity"); + seen.add(id); + if (item.link != null && (typeof item.link !== "string" || !item.link || item.link.length > 4096)) throw Error("Invalid DeckCraft media link"); + } + return media.filter((item) => item.link != null); +} +function checkParts(presentation, entries) { + const owners = [...presentation.slides, ...presentation.masters]; + for (const master of [presentation.notesMaster, presentation.handoutMaster]) if (master) owners.push(master); + const roots = []; + for (const owner of owners) { + roots.push(owner.shapes ?? []); + for (const layout of owner.layouts ?? []) roots.push(layout.shapes ?? []); + } + const pending = roots.map((shapes) => ({ shapes, depth: 0 })), seen = /* @__PURE__ */ new Set(); + let count = 0; + while (pending.length) { + const { shapes, depth } = pending.pop(); + if (!Array.isArray(shapes) || depth > 64) throw Error("DeckCraft shape tree is invalid or too deeply nested"); + for (const shape of shapes) { + if (++count > 1e5) throw Error("DeckCraft has too many shapes"); + if (shape.kind?.type === "group") pending.push({ shapes: shape.kind.children ?? [], depth: depth + 1 }); + if (shape.kind?.type !== "chart") continue; + const parts = shape.kind.kept?.parts ?? []; + if (!Array.isArray(parts)) throw Error("Invalid DeckCraft chart parts"); + for (const part of parts) { + if (part.nativeEntry == null) continue; + const name = part.nativeEntry; + if (typeof name !== "string" || !/^chart-parts\/(0|[1-9][0-9]*)$/.test(name) || seen.has(name) || (part.bytes?.length ?? 0) > 0) throw Error("Invalid or ambiguous DeckCraft chart reference"); + if (!entries.has(name)) throw Error("DeckCraft chart part is missing"); + seen.add(name); + } + } + } +} +async function readProject7(blob) { + const entries = await readZip3(blob), data = entries.get("presentation.json"); + if (!data || data.length > 32 * 1024 ** 2) throw Error("DeckCraft presentation metadata is missing or exceeds 32 MiB"); + const manifest = parse(decoder5.decode(data)), p = manifest?.presentation; + if (manifest?.format !== "deckcraft" || Number(manifest.version) !== 1 || !p || !Array.isArray(p.slides) || !Array.isArray(p.masters)) throw Error("Unsupported DeckCraft presentation"); + const mimetype = entries.get("mimetype"); + if (!mimetype || decoder5.decode(mimetype) !== "application/vnd.storyteller.deckcraft+zip") throw Error("Invalid DeckCraft native mimetype"); + mediaReferences5(p); + for (const item of p.media ?? []) if (item.link == null && !entries.has(`media/${item.id}`)) throw Error("DeckCraft embedded media is missing"); + checkParts(p, entries); + return { manifest, entries }; +} +function writeProject4(project) { + const bytes5 = utf83.encode(stringify(project.manifest)); + if (bytes5.length > 32 * 1024 ** 2) throw Error("DeckCraft metadata exceeds 32 MiB"); + project.entries.set("presentation.json", bytes5); + return writeZip3(project.entries); +} +async function completeLinkedMedia(project, load2) { + for (const item of mediaReferences5(project.manifest.presentation)) { + const bytes5 = await load2(item.link, item); + if (!(bytes5 instanceof Uint8Array) || !bytes5.length || bytes5.length > MAX_FILE3) throw Error("Linked DeckCraft media is missing or oversized"); + const key = `media/${item.id}`; + if (!project.entries.get(key)?.length) project.entries.set(key, bytes5); + } +} + +// apps/deckcraft/native-package.mjs +async function fileBytes(root, candidate) { + const actual = await (0, import_promises11.realpath)(candidate).catch(() => { + throw Error("Linked DeckCraft file is missing"); + }); + if (!actual.startsWith(root + import_node_path11.sep)) throw Error("DeckCraft file is outside the assignment folder"); + const info = await (0, import_promises11.stat)(actual); + if (!info.isFile() || !info.size || info.size > MAX_FILE3) throw Error("DeckCraft file is empty or exceeds 256 MiB"); + return { actual, bytes: await (0, import_promises11.readFile)(actual) }; +} +async function packageNativeProject10({ source, allowedRoot, output }) { + const root = await (0, import_promises11.realpath)(allowedRoot), master = await fileBytes(root, source); + if (!isNative6(master.actual)) throw Error("DeckCraft requires an editable .deckcraft or PowerPoint master"); + const masterPath = packagePath((0, import_node_path11.basename)(master.actual)); + if (isOffice(masterPath)) { + await checkedOffice(new Blob([master.bytes])); + await (0, import_promises11.mkdir)(output); + await (0, import_promises11.writeFile)((0, import_node_path11.resolve)(output, masterPath), master.bytes, { flag: "wx" }); + return { masterPath, files: [masterPath] }; + } + const project = await readProject7(new Blob([master.bytes])); + const files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Map([[masterPath.toLowerCase(), master.actual]]); + let total = master.bytes.length; + await completeLinkedMedia(project, async (link2, item) => { + if (/^[a-z][a-z0-9+.-]*:/i.test(link2) && !(0, import_node_path11.isAbsolute)(link2)) throw Error("DeckCraft media must be a local assignment file"); + const loaded = await fileBytes(root, (0, import_node_path11.isAbsolute)(link2) ? link2 : (0, import_node_path11.resolve)((0, import_node_path11.dirname)(master.actual), link2)); + const path = packagePath((0, import_node_path11.relative)(root, loaded.actual).split(import_node_path11.sep).join("/")); + const old = names.get(path.toLowerCase()); + if (old && (!files.has(path) || old !== loaded.actual)) throw Error("DeckCraft package path collision"); + if (!files.has(path)) { + if (files.size >= 199 || (total += loaded.bytes.length) > 512 * 1024 ** 2) throw Error("DeckCraft package exceeds its limit"); + files.set(path, loaded.bytes); + names.set(path.toLowerCase(), loaded.actual); + } + item.link = relativeReference(masterPath, path); + return loaded.bytes; + }); + files.set(masterPath, new Uint8Array(await writeProject4(project).arrayBuffer())); + await (0, import_promises11.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path11.resolve)(output, path); + await (0, import_promises11.mkdir)((0, import_node_path11.dirname)(target), { recursive: true }); + await (0, import_promises11.writeFile)(target, bytes5, { flag: "wx" }); + } + return { masterPath, files: [...files.keys()] }; +} +async function materializeNativeProject7({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises11.realpath)(folder), files = /* @__PURE__ */ new Map(), seen = /* @__PURE__ */ new Set(); + let total = 0; + packagePath(masterPath); + if (!isNative6(masterPath) || !Array.isArray(packageFiles) || !packageFiles.length || packageFiles.length > 200) throw Error("Invalid DeckCraft native package"); + for (const path of packageFiles) { + packagePath(path); + if (seen.has(path.toLowerCase())) throw Error("DeckCraft package path collision"); + seen.add(path.toLowerCase()); + const { bytes: bytes5 } = await fileBytes(root, (0, import_node_path11.resolve)(root, path)); + if ((total += bytes5.length) > 512 * 1024 ** 2) throw Error("DeckCraft package exceeds 512 MiB"); + files.set(path, bytes5); + } + const master = files.get(masterPath); + if (!master) throw Error("DeckCraft master is missing"); + if (isOffice(masterPath)) { + await checkedOffice(new Blob([master])); + await (0, import_promises11.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path11.resolve)(output, path); + await (0, import_promises11.mkdir)((0, import_node_path11.dirname)(target), { recursive: true }); + await (0, import_promises11.writeFile)(target, bytes5, { flag: "wx" }); + } + return { folder: output, masterPath: (0, import_node_path11.resolve)(output, masterPath) }; + } + const project = await readProject7(new Blob([master])); + let supplemented = false; + await completeLinkedMedia(project, async (link2, item) => { + const data = files.get(resolveReference(masterPath, link2)); + if (!data) throw Error("Linked DeckCraft file is missing"); + if (!project.entries.get(`media/${item.id}`)?.length) supplemented = true; + return data; + }); + if (supplemented) files.set(masterPath, new Uint8Array(await writeProject4(project).arrayBuffer())); + await (0, import_promises11.mkdir)(output); + for (const [path, bytes5] of files) { + const target = (0, import_node_path11.resolve)(output, path); + await (0, import_promises11.mkdir)((0, import_node_path11.dirname)(target), { recursive: true }); + await (0, import_promises11.writeFile)(target, bytes5, { flag: "wx" }); + } + return { folder: output, masterPath: (0, import_node_path11.resolve)(output, masterPath) }; +} + +// apps/gridcraft/native-package.mjs +var import_promises12 = require("node:fs/promises"); +var import_node_path12 = require("node:path"); + +// apps/gridcraft/package.mjs +var MAX_WORKBOOK_BYTES = 256 * 1024 ** 2; +var isNative7 = (path) => typeof path === "string" && /\.(xlsx|xlsm|xltx|xltm)$/i.test(path); +async function checkedWorkbook(blob) { + if (!(blob instanceof Blob) || blob.size < 8 || blob.size > MAX_WORKBOOK_BYTES) throw Error("Workbooks must be nonempty and no larger than 256 MiB"); + const head = new Uint8Array(await blob.slice(0, 8).arrayBuffer()); + const zip = head[0] === 80 && head[1] === 75 && head[2] === 3 && head[3] === 4; + const encrypted = [208, 207, 17, 224, 161, 177, 26, 225].every((byte, i) => head[i] === byte); + if (!zip && !encrypted) throw Error("Expected a native OOXML or encrypted Workbook package"); + return blob; +} + +// apps/gridcraft/native-package.mjs +async function confinedFile3(root, candidate) { + const actual = await (0, import_promises12.realpath)(candidate), info = await (0, import_promises12.stat)(actual); + if (!actual.startsWith(root + import_node_path12.sep)) throw Error("Workbook workbook escapes the assignment folder"); + if (!info.isFile() || info.size < 8 || info.size > MAX_WORKBOOK_BYTES) throw Error("Workbook workbook is empty or exceeds 256 MiB"); + const bytes5 = await (0, import_promises12.readFile)(actual); + await checkedWorkbook(new Blob([bytes5])); + return bytes5; +} +async function packageNativeProject11({ source, allowedRoot, output }) { + const root = await (0, import_promises12.realpath)(allowedRoot), masterPath = packagePath((0, import_node_path12.basename)(source)); + if (!isNative7(masterPath)) throw Error("GridCraft requires an editable OOXML master"); + const bytes5 = await confinedFile3(root, source); + await (0, import_promises12.mkdir)(output); + await (0, import_promises12.writeFile)((0, import_node_path12.resolve)(output, masterPath), bytes5, { flag: "wx" }); + return { masterPath, files: [masterPath] }; +} +async function materializeNativeProject8({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises12.realpath)(folder); + packagePath(masterPath); + if (!isNative7(masterPath) || !Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("Workbook master is missing from its saved package"); + const bytes5 = await confinedFile3(root, (0, import_node_path12.resolve)(root, masterPath)); + await (0, import_promises12.mkdir)(output); + const target = (0, import_node_path12.resolve)(output, masterPath); + await (0, import_promises12.mkdir)((0, import_node_path12.dirname)(target), { recursive: true }); + await (0, import_promises12.writeFile)(target, bytes5, { flag: "wx" }); + return { folder: output, masterPath: target }; +} + +// apps/figcraft/native-package.mjs +var import_promises13 = require("node:fs/promises"); +var import_node_path13 = require("node:path"); + +// apps/figcraft/package.mjs +var MAX_DESIGN_BYTES = 256 * 1024 ** 2; +var isNative8 = (path) => typeof path === "string" && /\.figcraft$/i.test(path); +async function checkedDesign(blob) { + if (!(blob instanceof Blob) || blob.size < 22 || blob.size > MAX_DESIGN_BYTES) throw Error("FigCraft designs must be no larger than 256 MiB"); + const head = new Uint8Array(await blob.slice(0, 4).arrayBuffer()); + if (![80, 75, 3, 4].every((byte, i) => head[i] === byte)) throw Error("Expected a native .figcraft archive"); + return blob; +} + +// apps/figcraft/native-package.mjs +async function confinedFile4(root, candidate) { + const actual = await (0, import_promises13.realpath)(candidate), info = await (0, import_promises13.stat)(actual); + if (!actual.startsWith(root + import_node_path13.sep)) throw Error("Design master escapes the assignment folder"); + if (!info.isFile() || info.size < 22 || info.size > MAX_DESIGN_BYTES) throw Error("Design master is empty or exceeds 256 MiB"); + const bytes5 = await (0, import_promises13.readFile)(actual); + await checkedDesign(new Blob([bytes5])); + return bytes5; +} +async function packageNativeProject12({ source, allowedRoot, output }) { + const root = await (0, import_promises13.realpath)(allowedRoot), masterPath = packagePath((0, import_node_path13.basename)(source)); + if (!isNative8(masterPath)) throw Error("FigCraft requires an editable .figcraft master"); + const bytes5 = await confinedFile4(root, source); + await (0, import_promises13.mkdir)(output); + await (0, import_promises13.writeFile)((0, import_node_path13.resolve)(output, masterPath), bytes5, { flag: "wx" }); + return { masterPath, files: [masterPath] }; +} +async function materializeNativeProject9({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises13.realpath)(folder); + packagePath(masterPath); + if (!isNative8(masterPath) || !Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("Design master is missing from its saved package"); + const bytes5 = await confinedFile4(root, (0, import_node_path13.resolve)(root, masterPath)); + await (0, import_promises13.mkdir)(output); + const target = (0, import_node_path13.resolve)(output, masterPath); + await (0, import_promises13.mkdir)((0, import_node_path13.dirname)(target), { recursive: true }); + await (0, import_promises13.writeFile)(target, bytes5, { flag: "wx" }); + return { folder: output, masterPath: target }; +} + +// apps/cadcraft/native-package.mjs +var import_promises14 = require("node:fs/promises"); +var import_node_path14 = require("node:path"); + +// apps/cadcraft/package.mjs +var MAX_DRAWING_BYTES = 256 * 1024 ** 2; +var isNative9 = (path) => typeof path === "string" && /\.dxf$/i.test(path); +async function checkedDrawing(blob) { + if (!(blob instanceof Blob) || blob.size < 12 || blob.size > MAX_DRAWING_BYTES) throw Error("CADCraft drawings must be no larger than 256 MiB"); + const text = await blob.text(); + if (text.includes("\0") || text.startsWith("AutoCAD Binary DXF")) throw Error("Save the editable drawing as ASCII DXF"); + const lines = text.replace(/^\uFEFF/, "").split(/\r\n|\n|\r/); + while (lines.length && !lines.at(-1).trim()) lines.pop(); + if (lines.length % 2 || lines.length > 4e6) throw Error("Invalid or oversized DXF group stream"); + let type = "", record2 = [], hasSection = false, hasEof = false; + function check() { + const value2 = (code) => record2.find((t) => t.code === code)?.value ?? ""; + const linked = ["IMAGEDEF", "PDFDEFINITION", "DGNDEFINITION", "DWFDEFINITION", "POINTCLOUDDEF", "ACDBPOINTCLOUDDEFEX"].includes(type) || type === "BLOCK" && (Number(value2(70)) & 12) !== 0; + if (linked && value2(1)) throw Error("Bind external drawing references and remove unembedded image or underlay links before saving this library master"); + } + for (let i = 0; i < lines.length; i += 2) { + const raw = lines[i].trim(); + if (!/^-?\d+$/.test(raw)) throw Error("Invalid DXF group code"); + const code = Number(raw), value2 = lines[i + 1].trim(); + if (code === 0) { + check(); + type = value2.toUpperCase(); + record2 = []; + if (type === "SECTION") hasSection = true; + if (type === "EOF") hasEof = true; + } else record2.push({ code, value: value2 }); + } + check(); + if (!hasSection || !hasEof) throw Error("Expected a complete native DXF drawing"); + return blob; +} + +// apps/cadcraft/native-package.mjs +async function confinedFile5(root, candidate) { + const actual = await (0, import_promises14.realpath)(candidate), info = await (0, import_promises14.stat)(actual); + if (!actual.startsWith(root + import_node_path14.sep)) throw Error("Drawing master escapes the assignment folder"); + if (!info.isFile() || info.size < 12 || info.size > MAX_DRAWING_BYTES) throw Error("Drawing master is empty or exceeds 256 MiB"); + const bytes5 = await (0, import_promises14.readFile)(actual); + await checkedDrawing(new Blob([bytes5])); + return bytes5; +} +async function packageNativeProject13({ source, allowedRoot, output }) { + const root = await (0, import_promises14.realpath)(allowedRoot), masterPath = packagePath((0, import_node_path14.basename)(source)); + if (!isNative9(masterPath)) throw Error("CADCraft requires an editable .dxf master"); + const bytes5 = await confinedFile5(root, source); + await (0, import_promises14.mkdir)(output); + await (0, import_promises14.writeFile)((0, import_node_path14.resolve)(output, masterPath), bytes5, { flag: "wx" }); + return { masterPath, files: [masterPath] }; +} +async function materializeNativeProject10({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises14.realpath)(folder); + packagePath(masterPath); + if (!isNative9(masterPath) || !Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("Drawing master is missing from its saved package"); + const bytes5 = await confinedFile5(root, (0, import_node_path14.resolve)(root, masterPath)); + await (0, import_promises14.mkdir)(output); + const target = (0, import_node_path14.resolve)(output, masterPath); + await (0, import_promises14.mkdir)((0, import_node_path14.dirname)(target), { recursive: true }); + await (0, import_promises14.writeFile)(target, bytes5, { flag: "wx" }); + return { folder: output, masterPath: target }; +} + +// apps/solidcraft/native-package.mjs +var import_promises15 = require("node:fs/promises"); +var import_node_path15 = require("node:path"); + +// apps/solidcraft/container.mjs +var MAX_FILE4 = 256 * 1024 ** 2; +var encoder5 = new TextEncoder(); +var decoder6 = new TextDecoder("utf-8", { fatal: true }); +var crcTable4 = Uint32Array.from({ length: 256 }, (_, i) => { + let c = i; + for (let j = 0; j < 8; j++) c = c >>> 1 ^ (c & 1 ? 3988292384 : 0); + return c >>> 0; +}); +function crc324(bytes5) { + let c = 4294967295; + for (const b of bytes5) c = c >>> 8 ^ crcTable4[(c ^ b) & 255]; + return (c ^ 4294967295) >>> 0; +} +async function bounded4(stream, limit) { + const reader = stream.getReader(), parts = []; + let total = 0; + try { + while (true) { + const { done, value: value2 } = await reader.read(); + if (done) break; + total += value2.length; + if (total > limit) throw Error("SolidCraft archive exceeds its expanded size limit"); + parts.push(value2); + } + } catch (error2) { + await reader.cancel().catch(() => { + }); + throw error2; + } + return new Uint8Array(await new Blob(parts).arrayBuffer()); +} +async function readZip4(blob) { + if (!(blob instanceof Blob) || blob.size < 22 || blob.size > MAX_FILE4) throw Error("Invalid SolidCraft archive size"); + const bytes5 = new Uint8Array(await blob.arrayBuffer()), v = new DataView(bytes5.buffer); + const u162 = (p) => v.getUint16(p, true), u322 = (p) => v.getUint32(p, true); + let end = -1; + for (let p = bytes5.length - 22; p >= Math.max(0, bytes5.length - 65557); p--) if (u322(p) === 101010256 && p + 22 + u162(p + 20) === bytes5.length) { + end = p; + break; + } + if (end < 0 || u162(end + 4) || u162(end + 6) || u162(end + 8) !== u162(end + 10)) throw Error("Invalid or multi-disk SolidCraft ZIP"); + const count = u162(end + 10), cd = u322(end + 16), cdEnd = cd + u322(end + 12); + if (!count || count === 65535 || cdEnd !== end) throw Error("Unsupported SolidCraft ZIP directory"); + const entries = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Set(); + let at = cd, total = 0; + for (let i = 0; i < count; i++) { + if (at + 46 > cdEnd || u322(at) !== 33639248) throw Error("Truncated SolidCraft ZIP directory"); + const flags = u162(at + 8), method = u162(at + 10), crc = u322(at + 16), size = u322(at + 20), expanded = u322(at + 24); + const nameLen = u162(at + 28), extra = u162(at + 30), comment = u162(at + 32), local = u322(at + 42), next = at + 46 + nameLen + extra + comment; + if (next > cdEnd || u162(at + 34) || flags & ~2062 || ![0, 8].includes(method) || expanded > MAX_FILE4 || (total += expanded) > MAX_FILE4) throw Error("Unsupported or oversized SolidCraft ZIP entry"); + const name = packagePath(decoder6.decode(bytes5.subarray(at + 46, at + 46 + nameLen))); + if (names.has(name.toLowerCase())) throw Error("Duplicate SolidCraft ZIP entry"); + names.add(name.toLowerCase()); + if (local + 30 > cd || u322(local) !== 67324752 || u162(local + 6) !== flags || u162(local + 8) !== method) throw Error("Invalid SolidCraft ZIP local header"); + const data = local + 30 + u162(local + 26) + u162(local + 28); + if (data + size > cd || data > cd || decoder6.decode(bytes5.subarray(local + 30, local + 30 + u162(local + 26))) !== name) throw Error("Truncated SolidCraft ZIP entry"); + if (!(flags & 8) && (u322(local + 14) !== crc || u322(local + 18) !== size || u322(local + 22) !== expanded)) throw Error("Mismatched SolidCraft ZIP header"); + const raw = bytes5.subarray(data, data + size); + const content = method === 0 ? raw : await bounded4(new Blob([raw]).stream().pipeThrough(new DecompressionStream("deflate-raw")), expanded); + if (content.length !== expanded || crc324(content) !== crc) throw Error(`SolidCraft ZIP integrity failed: ${name}`); + entries.set(name, content); + at = next; + } + if (at !== cdEnd) throw Error("Invalid SolidCraft ZIP directory length"); + return entries; +} + +// apps/solidcraft/package.mjs +var MAX_DESIGN_BYTES2 = 256 * 1024 ** 2; +var decoder7 = new TextDecoder("utf-8", { fatal: true }); +var isNative10 = (path) => typeof path === "string" && /\.(sc|solidcraft|solvecraft)$/i.test(path); +async function readProject8(blob) { + if (!(blob instanceof Blob) || blob.size < 2 || blob.size > MAX_DESIGN_BYTES2) throw Error("SolidCraft designs must be between 2 bytes and 256 MiB"); + const head = new Uint8Array(await blob.slice(0, 4).arrayBuffer()); + let metadata, entries; + if (head[0] === 80 && head[1] === 75 && head[2] === 3 && head[3] === 4) { + entries = await readZip4(blob); + const container = entries.get("container.json"), document = entries.get("document.json"); + if (!container || container.length > 4096 || !document || document.length > 32 * 1024 ** 2) throw Error("SolidCraft container metadata is missing or oversized"); + if (!["solidcraft-container/1", "solvecraft-container/1"].includes(JSON.parse(decoder7.decode(container)).format)) throw Error("Unsupported SolidCraft container"); + metadata = JSON.parse(decoder7.decode(document)); + } else metadata = JSON.parse(decoder7.decode(await blob.arrayBuffer())); + if (!metadata || typeof metadata.name !== "string" || !Array.isArray(metadata.features) || !/^(solidcraft|solvecraft)\/[1-9][0-9]*$/.test(metadata.format ?? "")) throw Error("Expected an editable SolidCraft design"); + const links = metadata.links ?? {}; + if (!links || Array.isArray(links) || typeof links !== "object" || Object.keys(links).length > 199) throw Error("Invalid SolidCraft design links"); + const references2 = []; + for (const link2 of Object.values(links)) { + if (!link2 || typeof link2.path !== "string" || !isNative10(link2.path)) throw Error("A linked SolidCraft design is missing its native path"); + references2.push(link2.path); + } + if (entries) { + const queue = [{ value: metadata, depth: 0 }], checked = /* @__PURE__ */ new Set(); + let count = 0; + while (queue.length) { + const { value: value2, depth } = queue.pop(); + if (++count > 1e6 || depth > 128) throw Error("SolidCraft metadata exceeds its inspection limit"); + if (!value2 || typeof value2 !== "object") continue; + for (const [key, child2] of Object.entries(value2)) { + if (key.endsWith("_blob")) { + if (typeof child2 !== "string" || !/^blobs\/[a-f0-9]{64}\.[a-z0-9]+$/.test(child2)) throw Error("Invalid SolidCraft embedded blob reference"); + if (!checked.has(child2)) { + const bytes5 = entries.get(child2); + if (!bytes5 || bytesToHex(sha256(bytes5)) !== child2.slice(6, 70)) throw Error("SolidCraft embedded blob is missing or corrupt"); + checked.add(child2); + } + } else if (child2 && typeof child2 === "object") queue.push({ value: child2, depth: depth + 1 }); + } + } + } + return { metadata, references: references2 }; +} +async function collectProject(masterPath, load2) { + packagePath(masterPath); + if (!isNative10(masterPath)) throw Error("SolidCraft requires an editable .sc design"); + const files = /* @__PURE__ */ new Map(), active = /* @__PURE__ */ new Set(); + let total = 0; + async function visit(path) { + if (active.has(path)) throw Error("SolidCraft linked designs contain a cycle"); + if (files.has(path)) return; + if (files.size >= 200) throw Error("SolidCraft packages accept at most 200 files"); + const file = await load2(path); + if (!(file instanceof Blob) || !file.size || file.size > MAX_DESIGN_BYTES2 || (total += file.size) > 512 * 1024 ** 2) throw Error("A linked SolidCraft design is missing or the package exceeds 512 MiB"); + const project = await readProject8(file); + files.set(path, { path, file, role: path === masterPath ? "master" : "dependency", mimeType: "application/octet-stream" }); + active.add(path); + for (const reference of project.references) await visit(resolveReference(path, reference)); + active.delete(path); + } + await visit(masterPath); + return [...files.values()]; +} + +// apps/solidcraft/native-package.mjs +async function loadFile(root, path) { + packagePath(path); + const actual = await (0, import_promises15.realpath)((0, import_node_path15.resolve)(root, path)), inside12 = (0, import_node_path15.relative)(root, actual); + if (!inside12 || inside12 === ".." || inside12.startsWith(".." + import_node_path15.sep) || (0, import_node_path15.isAbsolute)(inside12)) throw Error("SolidCraft file escapes the assignment folder"); + const info = await (0, import_promises15.stat)(actual); + if (!info.isFile() || !info.size || info.size > MAX_DESIGN_BYTES2) throw Error("SolidCraft file is empty or exceeds 256 MiB"); + return new Blob([await (0, import_promises15.readFile)(actual)]); +} +async function writeProject5(output, files) { + await (0, import_promises15.mkdir)(output); + for (const { path, file } of files) { + const destination = (0, import_node_path15.resolve)(output, path); + await (0, import_promises15.mkdir)((0, import_node_path15.dirname)(destination), { recursive: true }); + await (0, import_promises15.writeFile)(destination, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject14({ source, allowedRoot, output }) { + const root = await (0, import_promises15.realpath)(allowedRoot); + const masterPath = packagePath((0, import_node_path15.relative)(root, (0, import_node_path15.resolve)(source)).split(import_node_path15.sep).join("/")); + const files = await collectProject(masterPath, (path) => loadFile(root, path)); + await writeProject5(output, files); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject11({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises15.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("SolidCraft master is missing from its saved package"); + const allowed = new Set(packageFiles); + const files = await collectProject(masterPath, (path) => { + if (!allowed.has(path)) throw Error("A linked SolidCraft design is missing from its saved package"); + return loadFile(root, path); + }); + await writeProject5(output, files); + return { folder: output, masterPath: (0, import_node_path15.resolve)(output, masterPath) }; +} + +// apps/research/native-package.mjs +var import_promises16 = require("node:fs/promises"); +var import_node_path16 = require("node:path"); +async function packageNativeProject15({ source, allowedRoot, output }) { + const root = await (0, import_promises16.realpath)(allowedRoot), actual = await (0, import_promises16.realpath)(source), masterPath = packagePath((0, import_node_path16.basename)(source)); + if (!actual.startsWith(root + import_node_path16.sep) || !masterPath.endsWith(".md")) throw Error("Research requires a Markdown notebook inside the assignment folder"); + const info = await (0, import_promises16.stat)(actual); + if (!info.isFile() || info.size < 1 || info.size > 1024 * 1024) throw Error("Research notebooks must be between 1 byte and 1 MiB"); + const bytes5 = await (0, import_promises16.readFile)(actual); + new TextDecoder("utf-8", { fatal: true }).decode(bytes5); + if (bytes5.includes(0)) throw Error("Research notebook must contain text"); + await (0, import_promises16.mkdir)(output); + await (0, import_promises16.writeFile)((0, import_node_path16.resolve)(output, masterPath), bytes5, { flag: "wx" }); + return { masterPath, files: [masterPath] }; +} + +// apps/matcraft/native-package.mjs +var import_promises17 = require("node:fs/promises"); +var import_node_path17 = require("node:path"); + +// apps/matcraft/package.mjs +async function collectMatProject({ masterPath, readBlob, paths = [masterPath] }) { + const path = packagePath(masterPath), blob = await readBlob(path); + if (!(blob instanceof Blob) || !blob.size || blob.size > 256 * 1024 ** 2) throw Error("Choose a nonempty native MatCraft file up to 256 MiB"); + if (/\.m$/i.test(path)) { + const bytes5 = new Uint8Array(await blob.arrayBuffer()); + if (bytes5.includes(0)) throw Error("This .m file contains binary data"); + } else if (/\.mat$/i.test(path)) { + const header = new Uint8Array(await blob.slice(0, 128).arrayBuffer()); + if (header.length !== 128 || header[124] !== 0 || header[125] !== 1 || header[126] !== 77 || header[127] !== 73) throw Error("Choose a native little-endian MAT v5 workspace"); + if (blob.size > 128) { + const tag = new DataView(await blob.slice(128, 136).arrayBuffer()); + if (tag.byteLength !== 8 || ![14, 15].includes(tag.getUint32(0, true)) || tag.getUint32(4, true) > blob.size - 136) throw Error("The MAT workspace has an incomplete data element"); + } + } else throw Error("MatCraft opens .m scripts and .mat workspaces"); + const result = [{ path, role: "master", file: blob }], seen = /* @__PURE__ */ new Set([path.toLowerCase()]); + if (!Array.isArray(paths) || paths.length > 200) throw Error("Choose up to 200 native script and numeric input files"); + let total = blob.size; + for (const candidate of paths) { + const dependency = packagePath(candidate); + if (dependency === path) continue; + if (seen.has(dependency.toLowerCase())) throw Error("Two MatCraft input paths have the same name"); + seen.add(dependency.toLowerCase()); + if (!/\.(m|mat|csv|tsv|txt)$/i.test(dependency)) throw Error("Choose only linked .m, .mat, .csv, .tsv or .txt inputs beside the native master"); + const file = await readBlob(dependency); + if (!(file instanceof Blob) || !file.size || file.size > 256 * 1024 ** 2 || (total += file.size) > 512 * 1024 ** 2) throw Error("The selected MatCraft inputs must be nonempty and total at most 512 MiB"); + if (/\.(m|mat)$/i.test(dependency)) await collectMatProject({ masterPath: dependency, readBlob: () => file }); + result.push({ path: dependency, role: "dependency", file }); + } + return result; +} + +// apps/matcraft/native-package.mjs +function inside(root, path) { + const rel = (0, import_node_path17.relative)(root, path); + return rel && rel !== ".." && !rel.startsWith(".." + import_node_path17.sep) && !(0, import_node_path17.isAbsolute)(rel); +} +async function bytes(root, path) { + if (!inside(root, path)) throw Error("MatCraft input escapes the assigned task folder"); + const actual = await (0, import_promises17.realpath)(path), info = await (0, import_promises17.stat)(actual); + if (!inside(root, actual) || !info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("MatCraft input is outside the task, empty or oversized"); + return new Blob([await (0, import_promises17.readFile)(actual)]); +} +async function write(output, files) { + await (0, import_promises17.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path17.resolve)(output, packagePath(path)); + await (0, import_promises17.mkdir)((0, import_node_path17.dirname)(target), { recursive: true }); + await (0, import_promises17.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject16({ source, allowedRoot, output, projectFiles, baseFiles, baseMasterPath }) { + const root = await (0, import_promises17.realpath)(allowedRoot), master = (0, import_node_path17.resolve)(root, source), selected = [master]; + if (projectFiles !== void 0) { + if (!Array.isArray(projectFiles) || projectFiles.length > 199 || projectFiles.some((path) => typeof path !== "string")) throw Error("List at most 199 exact linked MatCraft input paths"); + selected.push(...projectFiles.map((path) => (0, import_node_path17.resolve)(root, path))); + } else if (baseFiles?.length) { + packagePath(baseMasterPath); + let anchor2 = (0, import_node_path17.dirname)(master); + for (const _ of baseMasterPath.split("/").slice(0, -1)) anchor2 = (0, import_node_path17.dirname)(anchor2); + if (anchor2 !== root && !inside(root, anchor2)) throw Error("The MatCraft working copy escapes this task"); + selected.push(...baseFiles.map((path) => (0, import_node_path17.resolve)(anchor2, packagePath(path)))); + } + const paths = [...new Set(selected)], contents = /* @__PURE__ */ new Map(); + for (const path of paths) contents.set(path, await bytes(root, path)); + let common = (0, import_node_path17.dirname)(master); + for (const path of paths) while (!inside(common, path)) { + const parent = (0, import_node_path17.dirname)(common); + if (parent === common) throw Error("MatCraft inputs have no common task folder"); + common = parent; + } + if (common !== root && !inside(root, common)) throw Error("MatCraft project root escapes this task"); + const named = new Map(paths.map((path) => [packagePath((0, import_node_path17.relative)(common, path).split(import_node_path17.sep).join("/")), contents.get(path)])); + const masterPath = packagePath((0, import_node_path17.relative)(common, master).split(import_node_path17.sep).join("/")); + const files = await collectMatProject({ masterPath, paths: [...named.keys()], readBlob: (path) => named.get(path) }); + await write(output, files); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject12({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises17.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("The native MatCraft master is missing"); + const paths = packageFiles.map(packagePath); + const files = await collectMatProject({ masterPath, paths, readBlob: (path) => bytes(root, (0, import_node_path17.resolve)(root, path)) }); + await write(output, files); + return { folder: output, masterPath: (0, import_node_path17.resolve)(output, masterPath) }; +} + +// apps/materialcraft/native-package.mjs +var import_promises18 = require("node:fs/promises"); +var import_node_path18 = require("node:path"); + +// apps/materialcraft/package.mjs +var import_xmldom2 = __toESM(require_lib(), 1); +var child = (node2, name) => Array.from(node2.childNodes ?? []).find((item) => item.nodeType === 1 && item.nodeName === name); +var value = (node2, name) => child(node2, name)?.getAttribute("v") ?? ""; +function sbsReferencesFromBytes(bytes5) { + if (!(bytes5 instanceof Uint8Array) || !bytes5.length || bytes5.length > 64 * 1024 ** 2) throw Error("Choose a nonempty editable .sbs package up to 64 MiB"); + const text = new TextDecoder("utf-8", { fatal: true }).decode(bytes5); + if (/ { + throw Error("Malformed SBS XML"); + } }).parseFromString(text, "application/xml"); + } catch { + throw Error("This is not a complete native SBS XML package"); + } + const root = doc.documentElement, content = root && child(root, "content"); + if (root?.nodeName !== "package" || !content || !content.getElementsByTagName("graph").length) throw Error("Choose an editable SBS package with a material graph"); + const all = root.getElementsByTagName("*"); + if (all.length > 1e6) throw Error("The SBS package has too many XML elements"); + const refs = []; + for (const item of Array.from(child(root, "dependencies")?.childNodes ?? [])) { + if (item.nodeType !== 1) continue; + const path = value(item, "filename"); + if (path && path !== "?himself" && !path.startsWith("sbs://")) refs.push(path); + } + for (const resource of Array.from(content.getElementsByTagName("resource"))) { + const source = child(resource, "source"); + if (source && (child(source, "embedded") || child(source, "binembedded"))) continue; + const path = value(resource, "filepath") || value(resource, "filePath"); + if (path) refs.push(path); + } + return [...new Set(refs)]; +} +async function sbsReferences(file) { + if (!(file instanceof Blob) || !file.size || file.size > 64 * 1024 ** 2) throw Error("Choose a nonempty editable .sbs package up to 64 MiB"); + return sbsReferencesFromBytes(new Uint8Array(await file.arrayBuffer())); +} +async function collectMaterialProject({ masterPath, readBlob }) { + const master = packagePath(masterPath); + if (!/\.sbs$/i.test(master)) throw Error("MaterialCraft opens editable .sbs packages"); + const files = [], seen = /* @__PURE__ */ new Map(), queue = [master]; + let total = 0; + while (queue.length) { + const path = packagePath(queue.shift()), folded = path.toLowerCase(); + if (seen.has(folded)) { + if (seen.get(folded) !== path) throw Error("Two MaterialCraft files have the same package name"); + continue; + } + seen.set(folded, path); + if (seen.size > 200) throw Error("A MaterialCraft package can contain at most 200 exact files"); + const file = await readBlob(path); + if (!(file instanceof Blob) || !file.size) throw Error(`The linked MaterialCraft file is missing: ${path}`); + if (file.size > 256 * 1024 ** 2 || (total += file.size) > 512 * 1024 ** 2) throw Error("The MaterialCraft package exceeds the supported working size"); + files.push({ path, role: path === master ? "master" : "dependency", file }); + if (/\.sbs$/i.test(path)) for (const ref of await sbsReferences(file)) queue.push(resolveReference(path, ref)); + } + return files; +} + +// apps/materialcraft/native-package.mjs +var inside2 = (root, path) => { + const rel = (0, import_node_path18.relative)(root, path); + return rel && rel !== ".." && !rel.startsWith(".." + import_node_path18.sep) && !(0, import_node_path18.isAbsolute)(rel); +}; +async function bytes2(root, path) { + if (!inside2(root, path)) throw Error("MaterialCraft input escapes the assigned task folder"); + const actual = await (0, import_promises18.realpath)(path), info = await (0, import_promises18.stat)(actual); + if (!inside2(root, actual) || !info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("MaterialCraft input is outside the task, empty or oversized"); + return new Blob([await (0, import_promises18.readFile)(actual)]); +} +async function write2(output, files) { + await (0, import_promises18.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path18.resolve)(output, packagePath(path)); + await (0, import_promises18.mkdir)((0, import_node_path18.dirname)(target), { recursive: true }); + await (0, import_promises18.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject17({ source, allowedRoot, output }) { + const root = await (0, import_promises18.realpath)(allowedRoot), master = (0, import_node_path18.resolve)(root, source), masterPath = packagePath((0, import_node_path18.relative)(root, master).split(import_node_path18.sep).join("/")); + const selected = await collectMaterialProject({ masterPath, readBlob: (path) => bytes2(root, (0, import_node_path18.resolve)(root, path)) }); + let common = (0, import_node_path18.dirname)(master); + for (const file of selected) while (!inside2(common, (0, import_node_path18.resolve)(root, file.path))) common = (0, import_node_path18.dirname)(common); + if (common !== root && !inside2(root, common)) throw Error("The MaterialCraft project root escapes its task"); + const files = selected.map((file) => ({ ...file, path: packagePath((0, import_node_path18.relative)(common, (0, import_node_path18.resolve)(root, file.path)).split(import_node_path18.sep).join("/")) })); + const normalized = files.find((f) => f.role === "master").path; + await write2(output, files); + return { masterPath: normalized, files: files.map((f) => f.path) }; +} +async function materializeNativeProject13({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises18.realpath)(folder), available = new Set(packageFiles?.map(packagePath)); + if (!available.has(masterPath)) throw Error("The native MaterialCraft master is missing"); + const files = await collectMaterialProject({ masterPath, readBlob: (path) => { + if (!available.has(path)) throw Error("The linked MaterialCraft input is missing"); + return bytes2(root, (0, import_node_path18.resolve)(root, path)); + } }); + await write2(output, files); + return { folder: output, masterPath: (0, import_node_path18.resolve)(output, masterPath) }; +} + +// apps/subcraft/native-package.mjs +var import_promises19 = require("node:fs/promises"); +var import_node_path19 = require("node:path"); + +// apps/subcraft/package.mjs +async function checkProject(file) { + let entries; + try { + entries = await readZip3(file); + } catch { + throw Error("Choose a complete native SubCraft project up to 256 MiB, including its embedded mesh and textures"); + } + let manifest; + try { + const bytes5 = entries.get("manifest.json"); + if (!bytes5 || bytes5.length > 1024 ** 2) throw Error("Invalid manifest"); + manifest = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes5)); + } catch { + throw Error("The native SubCraft project manifest is missing or invalid"); + } + if (manifest.format !== "subcraft-project" || !Number.isInteger(manifest.schema_version) || manifest.schema_version < 1 || manifest.schema_version > 13) throw Error("This SubCraft project uses an unsupported native schema"); + for (const name of ["mesh", "document"]) { + if (typeof manifest[name] !== "string" || !entries.get(packagePath(manifest[name]))?.length) throw Error("The native SubCraft project is missing its embedded mesh or document"); + } + return manifest; +} +async function collectProject2(masterPath, readBlob) { + const path = packagePath(masterPath); + if (!/\.subcraft$/i.test(path)) throw Error("SubCraft opens native .subcraft projects"); + const file = await readBlob(path); + await checkProject(file); + return [{ path, role: "master", file }]; +} + +// apps/subcraft/native-package.mjs +async function load(root, path) { + const full = await (0, import_promises19.realpath)((0, import_node_path19.resolve)(root, path)), rel = (0, import_node_path19.relative)(root, full), info = await (0, import_promises19.stat)(full); + if (!rel || rel === ".." || rel.startsWith(".." + import_node_path19.sep) || (0, import_node_path19.isAbsolute)(rel) || !info.isFile() || !info.size || info.size > MAX_FILE3) throw Error("The SubCraft project is outside this task, empty or oversized"); + return new Blob([await (0, import_promises19.readFile)(full)]); +} +async function write3(output, files) { + await (0, import_promises19.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path19.resolve)(output, packagePath(path)); + await (0, import_promises19.mkdir)((0, import_node_path19.dirname)(target), { recursive: true }); + await (0, import_promises19.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject18({ source, allowedRoot, output }) { + const root = await (0, import_promises19.realpath)(allowedRoot), masterPath = packagePath((0, import_node_path19.relative)(root, (0, import_node_path19.resolve)(root, source)).split(import_node_path19.sep).join("/")); + const files = await collectProject2(masterPath, (path) => load(root, path)); + await write3(output, files); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject14({ folder, masterPath, packageFiles, output }) { + const root = await (0, import_promises19.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("The saved native SubCraft master is missing"); + const files = await collectProject2(masterPath, (path) => load(root, path)); + await write3(output, files); + return { folder: output, masterPath: (0, import_node_path19.resolve)(output, masterPath) }; +} + +// apps/dashcraft/native-package.mjs +var import_promises20 = require("node:fs/promises"); +var import_node_path20 = require("node:path"); + +// apps/dashcraft/package.mjs +var MAX_FILE5 = 256 * 1024 ** 2; +var MAX_TOTAL = 512 * 1024 ** 2; +var MASTER = /\.(pbix|pbit|pbip|pbir|pbism|bim|tmdl|pbids|rdl|abf|vpax)$/i; +var INPUT = /\.(pbix|pbit|pbip|pbir|pbism|bim|tmdl|pbids|rdl|abf|vpax|json|csv|tsv|txt|png|jpe?g|gif|svg|webp|woff2?|ttf|otf)$/i; +var JSON_FILE = /\.(json|pbip|pbir|pbism|bim|pbids)$/i; +var FORBIDDEN = /(?:^|\/)(?:\.env(?:\..*)?|\.git|node_modules|target|credentials?|secrets?)(?:\/|$)/i; +function isProjectInput(path) { + return !FORBIDDEN.test(path) && path.split("/").every((part) => !part.startsWith(".") || part === ".pbi" || part === ".platform") && (INPUT.test(path) || path.endsWith("/.platform")); +} +function checkSecrets(value2, depth = 0) { + if (depth > 128) throw Error("The report metadata is nested too deeply"); + if (typeof value2 === "string") { + if (/(?:[?&](?:sig|token|access_token|api_key|key|password)=|\b(?:password|pwd|client_secret|access_token)\s*=\s*[^;\s"}]+|\b(?:Bearer|Basic)\s+[A-Za-z0-9+\/_=-]{12,})/i.test(value2)) throw Error("Keep credentials and signed connection URLs out of report packages"); + } else if (value2 && typeof value2 === "object") { + for (const [key, child2] of Object.entries(value2)) { + if (/^(?:password|pwd|clientSecret|client_secret|accessToken|access_token|refreshToken|refresh_token|apiKey|api_key|privateKey|authorization)$/i.test(key) && child2 !== null && child2 !== "") throw Error("Keep connection credentials out of report packages"); + checkSecrets(child2, depth + 1); + } + } +} +async function collectProject3({ masterPath, paths = [masterPath], readBlob }) { + const master = packagePath(masterPath); + if (!MASTER.test(master)) throw Error("Choose a native Power BI report, model or TMDL file"); + if (!Array.isArray(paths) || !paths.includes(master) || paths.length > 200) throw Error("Choose the report and at most 199 exact linked input files"); + const available = /* @__PURE__ */ new Set(), caseNames = /* @__PURE__ */ new Set(); + for (const raw of paths) { + const path = packagePath(raw); + if (caseNames.has(path.toLowerCase())) throw Error("Two report inputs have the same path"); + available.add(path); + caseNames.add(path.toLowerCase()); + } + const selected = /* @__PURE__ */ new Set([master]), base = master.slice(0, master.lastIndexOf("/") + 1); + const addFolder = (folder) => { + for (const path of available) { + const contained = folder ? path.startsWith(folder + "/") : /^(?:definition|StaticResources)\//.test(path) || /^(?:database|model|relationships|expressions)\.tmdl$|^model\.bim$|^diagramLayout\.json$/.test(path); + if (contained && isProjectInput(path)) selected.add(path); + } + }; + if (/\.pbip$/i.test(master)) { + for (const path of available) { + const part = path.slice(base.length).split("/")[0]; + if (path.startsWith(base) && /\.(?:Report|SemanticModel)$/i.test(part)) addFolder(base + part); + } + } else if (/\.(?:pbir|pbism)$/i.test(master)) addFolder(base.replace(/\/$/, "")); + else if (/\.tmdl$/i.test(master)) { + for (const path of available) if (path.startsWith(base) && (/\.tmdl$/i.test(path) || path.endsWith("/diagramLayout.json"))) selected.add(path); + } + const maps = [...available].filter((path) => path.split("/").pop() === "blob-map.json"); + if (maps.length > 1) throw Error("Choose one offline blob map per report package"); + for (const map of maps) selected.add(map); + const seen = /* @__PURE__ */ new Set(), contents = /* @__PURE__ */ new Map(), metadata = /* @__PURE__ */ new Map(); + let total = 0; + for (const raw of selected) { + const path = packagePath(raw), key = path.toLowerCase(); + if (seen.has(key)) throw Error("Two report inputs have the same path"); + seen.add(key); + if (!isProjectInput(path)) throw Error("Choose only report, model, resource and data inputs; exclude settings and credentials"); + const file = await readBlob(path); + if (!(file instanceof Blob) || !file.size || file.size > MAX_FILE5 || (total += file.size) > MAX_TOTAL) throw Error("Report inputs must be nonempty, at most 256 MiB each and 512 MiB in total"); + if (JSON_FILE.test(path) || path.endsWith("/.platform") || /\.(tmdl|rdl)$/i.test(path)) { + if (file.size > 16 * 1024 ** 2) throw Error("Each report metadata file must be at most 16 MiB"); + const text = new TextDecoder("utf-8", { fatal: true }).decode(await file.arrayBuffer()); + if (text.includes("\0")) throw Error("Report metadata contains binary data"); + if (JSON_FILE.test(path) || path.endsWith("/.platform")) { + let json; + try { + json = JSON.parse(text.replace(/^\uFEFF/, "")); + } catch { + throw Error(`Invalid report metadata: ${path}`); + } + checkSecrets(json); + metadata.set(path, json); + if (/\.pbip$/i.test(path) && Array.isArray(json.artifacts)) for (const item of json.artifacts) { + if (typeof item?.report?.path === "string") addFolder(resolveReference(path, item.report.path)); + } + if (/\.pbir$/i.test(path) && typeof json?.datasetReference?.byPath?.path === "string") addFolder(resolveReference(path, json.datasetReference.byPath.path)); + if (path.split("/").pop() === "blob-map.json" && json.containers && typeof json.containers === "object") { + for (const blobs of Object.values(json.containers)) if (blobs && typeof blobs === "object") for (const target of Object.values(blobs)) { + if (typeof target === "string") { + const input3 = resolveReference(path, target); + if (available.has(input3)) selected.add(input3); + } + } + } + } else checkSecrets(text); + } + if (/\.(pbix|pbit|vpax)$/i.test(path)) { + const bytes5 = new Uint8Array(await file.slice(0, 4).arrayBuffer()); + if (bytes5.length !== 4 || bytes5[0] !== 80 || bytes5[1] !== 75 || bytes5[2] !== 3 || bytes5[3] !== 4) throw Error("The report container is not a complete native ZIP document"); + } + contents.set(path, file); + } + function requireFolder(from, reference) { + const folder = resolveReference(from, reference); + if (![...contents.keys()].some((path) => path === folder || path.startsWith(folder + "/"))) throw Error(`The report is missing its linked model or report folder: ${folder}`); + } + for (const [path, json] of metadata) { + if (/\.pbip$/i.test(path)) { + if (!Array.isArray(json.artifacts) || !json.artifacts.length) throw Error("The PBIP project has no report artifacts"); + for (const item of json.artifacts) { + const reference = item?.report?.path; + if (typeof reference !== "string") throw Error("The PBIP report reference is missing"); + requireFolder(path, reference); + } + } + if (/\.pbir$/i.test(path) && json?.datasetReference?.byPath) requireFolder(path, json.datasetReference.byPath.path); + if (path.split("/").pop() === "blob-map.json") { + if (!json.containers || typeof json.containers !== "object" || Array.isArray(json.containers)) throw Error("The offline blob map is invalid"); + for (const [url, blobs] of Object.entries(json.containers)) { + if (!/^https?:\/\//i.test(url) || !blobs || typeof blobs !== "object" || Array.isArray(blobs)) throw Error("The offline blob map is invalid"); + for (const target of Object.values(blobs)) { + if (typeof target !== "string" || !contents.has(resolveReference(path, target))) throw Error("The report is missing an exact offline data input"); + } + } + } + } + return [{ path: master, role: "master", file: contents.get(master) }, ...[...contents].filter(([path]) => path !== master).map(([path, file]) => ({ path, role: "dependency", file }))]; +} + +// apps/dashcraft/native-package.mjs +function inside3(root, path) { + const rel = (0, import_node_path20.relative)(root, path); + return rel && rel !== ".." && !rel.startsWith(".." + import_node_path20.sep) && !(0, import_node_path20.isAbsolute)(rel); +} +async function bytes3(root, path) { + if (!inside3(root, path)) throw Error("The report input escapes the assigned task folder"); + const actual = await (0, import_promises20.realpath)(path), info = await (0, import_promises20.stat)(actual); + if (!inside3(root, actual) || !info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("The report input is outside the task, empty or oversized"); + return new Blob([await (0, import_promises20.readFile)(actual)]); +} +async function write4(output, files) { + await (0, import_promises20.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path20.resolve)(output, packagePath(path)); + await (0, import_promises20.mkdir)((0, import_node_path20.dirname)(target), { recursive: true }); + await (0, import_promises20.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject19({ source, allowedRoot, output, projectFiles }) { + const root = await (0, import_promises20.realpath)(allowedRoot), master = (0, import_node_path20.resolve)(root, source); + if (projectFiles !== void 0 && (!Array.isArray(projectFiles) || projectFiles.length > 199 || projectFiles.some((path) => typeof path !== "string"))) throw Error("List at most 199 exact linked report input paths"); + const paths = [.../* @__PURE__ */ new Set([master, ...(projectFiles ?? []).map((path) => (0, import_node_path20.resolve)(root, path))])], contents = /* @__PURE__ */ new Map(); + for (const path of paths) contents.set(path, await bytes3(root, path)); + let common = (0, import_node_path20.dirname)(master); + for (const path of paths) while (!inside3(common, path)) { + const parent = (0, import_node_path20.dirname)(common); + if (parent === common) throw Error("Report inputs have no common task folder"); + common = parent; + } + if (common !== root && !inside3(root, common)) throw Error("The report root escapes the assigned task"); + const named = new Map(paths.map((path) => [packagePath((0, import_node_path20.relative)(common, path).split(import_node_path20.sep).join("/")), contents.get(path)])); + const masterPath = packagePath((0, import_node_path20.relative)(common, master).split(import_node_path20.sep).join("/")); + const files = await collectProject3({ masterPath, paths: [...named.keys()], readBlob: (path) => named.get(path) }); + await write4(output, files); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject15({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises20.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("The native report master is missing"); + const paths = packageFiles.map(packagePath); + const files = await collectProject3({ masterPath, paths, readBlob: (path) => bytes3(root, (0, import_node_path20.resolve)(root, path)) }); + await write4(output, files); + return { folder: output, masterPath: (0, import_node_path20.resolve)(output, masterPath) }; +} + +// apps/datacraft/native-package.mjs +var import_promises21 = require("node:fs/promises"); +var import_node_path21 = require("node:path"); + +// apps/datacraft/package.mjs +var SQLITE_EXT = /\.(?:sqlite3?|db3?)$/i; +async function validateDatabase(path, file) { + path = packagePath(path); + if (!SQLITE_EXT.test(path) || !(file instanceof Blob) || file.size < 512 || file.size > 256 * 1024 ** 2) throw Error("Choose a complete SQLite .sqlite, .sqlite3, .db or .db3 database up to 256 MiB"); + const header = new Uint8Array(await file.slice(0, 100).arrayBuffer()); + if (new TextDecoder().decode(header.subarray(0, 16)) !== "SQLite format 3\0") throw Error("The database does not have a native SQLite header"); + const view = new DataView(header.buffer, header.byteOffset, header.byteLength); + const raw = view.getUint16(16), page = raw === 1 ? 65536 : raw; + if (page < 512 || page > 65536 || page & page - 1 || file.size % page || view.getUint32(28) > file.size / page || ![1, 2].includes(header[18]) || ![1, 2].includes(header[19])) throw Error("The SQLite database is incomplete or has an invalid page layout"); + return file; +} +async function collectProject4({ masterPath, paths = [masterPath], readBlob }) { + const master = packagePath(masterPath); + if (!Array.isArray(paths) || paths.length > 101 || !paths.includes(master)) throw Error("Choose one SQLite database and at most 100 SQL scripts"); + const database = await validateDatabase(master, await readBlob(master)); + const files = [{ path: master, role: "master", file: database }], seen = /* @__PURE__ */ new Set([master.toLowerCase()]); + let total = database.size; + for (const raw of paths) { + const path = packagePath(raw); + if (path === master) continue; + if (seen.has(path.toLowerCase())) throw Error("Two database inputs have the same path"); + seen.add(path.toLowerCase()); + if (!/\.sql$/i.test(path)) throw Error("Include only the standalone SQLite database and selected .sql scripts; close or checkpoint hot database journals in the native app first"); + const file = await readBlob(path); + if (!(file instanceof Blob) || !file.size || file.size > 16 * 1024 ** 2 || (total += file.size) > 512 * 1024 ** 2) throw Error("SQL scripts must be nonempty and at most 16 MiB each, and the package at most 512 MiB"); + const text = new TextDecoder("utf-8", { fatal: true }).decode(await file.arrayBuffer()); + if (text.includes("\0")) throw Error("The SQL script contains binary data"); + files.push({ path, role: "dependency", file }); + } + return files; +} + +// apps/datacraft/native-package.mjs +function inside4(root, path) { + const rel = (0, import_node_path21.relative)(root, path); + return rel && rel !== ".." && !rel.startsWith(".." + import_node_path21.sep) && !(0, import_node_path21.isAbsolute)(rel); +} +async function bytes4(root, path) { + if (!inside4(root, path)) throw Error("DataCraft input escapes the assigned task folder"); + const actual = await (0, import_promises21.realpath)(path), info = await (0, import_promises21.stat)(actual); + if (/\.(?:sqlite3?|db3?)$/i.test(path) && await (0, import_promises21.stat)(actual + "-wal").then((info2) => info2.size > 0, (error2) => { + if (error2.code === "ENOENT") return false; + throw error2; + })) throw Error("Close or checkpoint the native SQLite database before packaging its standalone file"); + if (!inside4(root, actual) || !info.isFile() || !info.size || info.size > 256 * 1024 ** 2) throw Error("DataCraft input is outside the task, empty or oversized"); + return new Blob([await (0, import_promises21.readFile)(actual)]); +} +async function write5(output, files) { + await (0, import_promises21.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path21.resolve)(output, packagePath(path)); + await (0, import_promises21.mkdir)((0, import_node_path21.dirname)(target), { recursive: true }); + await (0, import_promises21.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject20({ source, allowedRoot, output, projectFiles, baseFiles, baseMasterPath }) { + const root = await (0, import_promises21.realpath)(allowedRoot), master = (0, import_node_path21.resolve)(root, source), selected = [master]; + if (projectFiles !== void 0) { + if (!Array.isArray(projectFiles) || projectFiles.length > 199 || projectFiles.some((path) => typeof path !== "string")) throw Error("List at most 199 exact linked DataCraft input paths"); + selected.push(...projectFiles.map((path) => (0, import_node_path21.resolve)(root, path))); + } else if (baseFiles?.length) { + packagePath(baseMasterPath); + let anchor2 = (0, import_node_path21.dirname)(master); + for (const _ of baseMasterPath.split("/").slice(0, -1)) anchor2 = (0, import_node_path21.dirname)(anchor2); + if (anchor2 !== root && !inside4(root, anchor2)) throw Error("The DataCraft working copy escapes this task"); + selected.push(...baseFiles.map((path) => (0, import_node_path21.resolve)(anchor2, packagePath(path)))); + } + const paths = [...new Set(selected)], contents = /* @__PURE__ */ new Map(); + for (const path of paths) contents.set(path, await bytes4(root, path)); + let common = (0, import_node_path21.dirname)(master); + for (const path of paths) while (!inside4(common, path)) { + const parent = (0, import_node_path21.dirname)(common); + if (parent === common) throw Error("DataCraft inputs have no common task folder"); + common = parent; + } + if (common !== root && !inside4(root, common)) throw Error("DataCraft project root escapes this task"); + const named = new Map(paths.map((path) => [packagePath((0, import_node_path21.relative)(common, path).split(import_node_path21.sep).join("/")), contents.get(path)])); + const masterPath = packagePath((0, import_node_path21.relative)(common, master).split(import_node_path21.sep).join("/")); + const files = await collectProject4({ masterPath, paths: [...named.keys()], readBlob: (path) => named.get(path) }); + await write5(output, files); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject16({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises21.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("The native DataCraft master is missing"); + const paths = packageFiles.map(packagePath); + const files = await collectProject4({ masterPath, paths, readBlob: (path) => bytes4(root, (0, import_node_path21.resolve)(root, path)) }); + await write5(output, files); + return { folder: output, masterPath: (0, import_node_path21.resolve)(output, masterPath) }; +} + +// apps/plancraft/native-package.mjs +var import_promises22 = require("node:fs/promises"); +var import_node_path22 = require("node:path"); + +// apps/plancraft/package.mjs +var MAX_PLAN_BYTES = 64 * 1024 ** 2; +function planReferencesFromBytes(bytes5) { + if (!(bytes5 instanceof Uint8Array) || !bytes5.length || bytes5.length > MAX_PLAN_BYTES) throw Error("Choose a nonempty PlanCraft project up to 64 MiB"); + const project = parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes5)); + if (!project || Array.isArray(project) || project.format !== "plancraft" || !["0", "1"].includes(String(project.version ?? 0))) throw Error("Choose a supported native .plancraft project"); + const linked = project.external_projects ?? []; + if (!Array.isArray(linked) || linked.length > 199) throw Error("A PlanCraft package can contain at most 199 linked projects"); + return linked.map((item) => { + if (!item || typeof item.path !== "string" || !item.path || !item.path.toLowerCase().endsWith(".plancraft")) throw Error("A linked PlanCraft project must name a relative .plancraft file"); + return item.path; + }); +} +async function collectPlanProject({ masterPath, readBlob }) { + const master = packagePath(masterPath); + if (!/\.plancraft$/i.test(master)) throw Error("Choose a native .plancraft project"); + const queue = [master], seen = /* @__PURE__ */ new Map(), files = []; + let total = 0; + while (queue.length) { + const path = packagePath(queue.shift()), key = path.toLowerCase(); + if (seen.has(key)) { + if (seen.get(key) !== path) throw Error("Two PlanCraft input paths have the same name"); + continue; + } + seen.set(key, path); + if (seen.size > 200) throw Error("A PlanCraft package can contain at most 200 native files"); + const file = await readBlob(path); + if (!(file instanceof Blob) || !file.size) throw Error(`The exact linked PlanCraft input is missing: ${path}`); + if (file.size > MAX_PLAN_BYTES || (total += file.size) > 512 * 1024 ** 2) throw Error("PlanCraft projects must be at most 64 MiB each and 512 MiB together"); + const refs = planReferencesFromBytes(new Uint8Array(await file.arrayBuffer())); + files.push({ path, role: path === master ? "master" : "dependency", file }); + for (const ref of refs) queue.push(resolveReference(path, ref)); + } + return files; +} + +// apps/plancraft/native-package.mjs +function inside5(root, path) { + const rel = (0, import_node_path22.relative)(root, path); + return rel && rel !== ".." && !rel.startsWith(".." + import_node_path22.sep) && !(0, import_node_path22.isAbsolute)(rel); +} +async function input(root, path) { + if (!inside5(root, path)) throw Error("PlanCraft input escapes the assigned task folder"); + const actual = await (0, import_promises22.realpath)(path), info = await (0, import_promises22.stat)(actual); + if (!inside5(root, actual) || !info.isFile() || !info.size || info.size > MAX_PLAN_BYTES) throw Error("PlanCraft input is outside the task, empty or oversized"); + return new Blob([await (0, import_promises22.readFile)(actual)]); +} +async function write6(output, files) { + await (0, import_promises22.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path22.resolve)(output, packagePath(path)); + await (0, import_promises22.mkdir)((0, import_node_path22.dirname)(target), { recursive: true }); + await (0, import_promises22.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject21({ source, allowedRoot, output }) { + const root = await (0, import_promises22.realpath)(allowedRoot), master = (0, import_node_path22.resolve)(root, source); + const masterPath = packagePath((0, import_node_path22.relative)(root, master).split(import_node_path22.sep).join("/")); + const selected = await collectPlanProject({ masterPath, readBlob: (path2) => input(root, (0, import_node_path22.resolve)(root, path2)) }); + let common = (0, import_node_path22.dirname)(master); + for (const file of selected) { + const path2 = (0, import_node_path22.resolve)(root, file.path); + while (!inside5(common, path2)) { + const parent = (0, import_node_path22.dirname)(common); + if (parent === common) throw Error("PlanCraft inputs have no common task folder"); + common = parent; + } + } + if (common !== root && !inside5(root, common)) throw Error("PlanCraft project root escapes this task"); + const files = selected.map((file) => ({ ...file, path: packagePath((0, import_node_path22.relative)(common, (0, import_node_path22.resolve)(root, file.path)).split(import_node_path22.sep).join("/")) })); + const path = files.find((file) => file.role === "master").path; + await write6(output, files); + return { masterPath: path, files: files.map((file) => file.path) }; +} +async function materializeNativeProject17({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises22.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("The native PlanCraft master is missing"); + const allowed = new Set(packageFiles.map(packagePath)); + const files = await collectPlanProject({ masterPath, readBlob: (path) => allowed.has(path) ? input(root, (0, import_node_path22.resolve)(root, path)) : void 0 }); + await write6(output, files); + return { folder: output, masterPath: (0, import_node_path22.resolve)(output, masterPath) }; +} + +// apps/geocraft/native-package.mjs +var import_promises23 = require("node:fs/promises"); +var import_node_path23 = require("node:path"); + +// apps/geocraft/package.mjs +var MAX_GEO_BYTES = 256 * 1024 ** 2; +var remote = (value2) => typeof value2 === "string" && /^https?:\/\//i.test(value2); +var object = (value2) => value2 && typeof value2 === "object" && !Array.isArray(value2); +function readGeoProject(bytes5) { + if (!(bytes5 instanceof Uint8Array) || !bytes5.length || bytes5.length > MAX_GEO_BYTES) throw Error("Choose a nonempty RustGIS .rgis project up to 256 MiB"); + const project = parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes5)); + if (!object(project) || typeof project.name !== "string" || !Array.isArray(project.maps) || !project.maps.length || project.maps.length > 200) throw Error("Choose a native RustGIS .rgis project"); + if (!["0", "1"].includes(String(project.format))) throw Error("Choose a supported native RustGIS format version"); + return project; +} +function geoReferences(project) { + const refs = []; + const add = (holder, key, kind, required2 = true) => { + const path = holder?.[key]; + if (typeof path === "string" && path && !remote(path)) refs.push({ holder, key, path, kind, required: required2 }); + }; + const maps = [...project.maps, ...(project.offline_areas ?? []).map((area) => area.data)]; + if (maps.length > 400) throw Error("The native project contains too many maps and offline areas"); + for (const map of maps) { + if (!object(map) || !Array.isArray(map.layers)) throw Error("Invalid native RustGIS map"); + for (const layer of map.layers) { + if (!object(layer)) throw Error("Invalid native RustGIS layer"); + const src = layer.source; + if (src?.gdal) add(src.gdal, "path", "gdal"); + else if (src?.duckdb) add(src.duckdb, "database", "duckdb"); + else if (src && !src.postgis && !src.mysql && !src.sqlserver) add(src, "path", "source", !src.embedded); + const raster = layer.raster; + if (raster) { + add(raster, "path", "raster", !raster.embedded); + if (raster.time_zarr) add(raster.time_zarr, "store", "zarr"); + } + if (layer.gpkg) add(layer.gpkg, "path", "gpkg"); + } + for (const tile of map.tiles ?? []) if (typeof tile.url === "string" && /\.(?:pmtiles|mbtiles)$/i.test(tile.url)) add(tile, "url", "tiles"); + } + return refs; +} +async function collectGeoProject({ masterPath, readBlob }) { + const master = packagePath(masterPath); + if (!/\.rgis$/i.test(master)) throw Error("Choose a native .rgis project"); + const file = await readBlob(master); + if (!(file instanceof Blob)) throw Error("The exact native RustGIS project is missing"); + const project = readGeoProject(new Uint8Array(await file.arrayBuffer())); + const files = [{ path: master, role: "master", file }], seen = /* @__PURE__ */ new Map([[master.toLowerCase(), master]]); + let total = file.size; + for (const ref of geoReferences(project)) { + const path = resolveReference(master, ref.path), key = path.toLowerCase(); + if (seen.has(key)) { + if (seen.get(key) !== path) throw Error("Two GeoCraft paths have the same name"); + continue; + } + const input3 = await readBlob(path); + if (!(input3 instanceof Blob)) { + if (!ref.required) continue; + throw Error(`The exact linked GeoCraft input is missing: ${path}`); + } + if (!input3.size || input3.size > MAX_GEO_BYTES || (total += input3.size) > 512 * 1024 ** 2) throw Error("GeoCraft inputs must be nonempty, at most 256 MiB each and 512 MiB together"); + seen.set(key, path); + if (seen.size > 200) throw Error("A GeoCraft package can contain at most 200 files"); + files.push({ path, role: "dependency", file: input3 }); + } + return files; +} + +// apps/geocraft/native-package.mjs +function inside6(root, path) { + const name = (0, import_node_path23.relative)(root, path); + return name && name !== ".." && !name.startsWith(".." + import_node_path23.sep) && !(0, import_node_path23.isAbsolute)(name); +} +async function input2(root, path) { + if (!inside6(root, path)) throw Error("GeoCraft input escapes the assigned task folder"); + const actual = await (0, import_promises23.realpath)(path), info = await (0, import_promises23.stat)(actual); + if (!inside6(root, actual) || !info.isFile() || !info.size || info.size > MAX_GEO_BYTES) throw Error("GeoCraft input is outside the task, empty or oversized"); + return new Blob([await (0, import_promises23.readFile)(actual)]); +} +async function write7(output, files) { + await (0, import_promises23.mkdir)(output); + for (const { path, file } of files) { + const target = (0, import_node_path23.resolve)(output, packagePath(path)); + await (0, import_promises23.mkdir)((0, import_node_path23.dirname)(target), { recursive: true }); + await (0, import_promises23.writeFile)(target, new Uint8Array(await file.arrayBuffer()), { flag: "wx" }); + } +} +async function packageNativeProject22({ source, allowedRoot, output }) { + const root = await (0, import_promises23.realpath)(allowedRoot), master = (0, import_node_path23.resolve)(root, source); + const masterPath = packagePath((0, import_node_path23.relative)(root, master).split(import_node_path23.sep).join("/")); + const selected = await collectGeoProject({ masterPath, readBlob: (path2) => input2(root, (0, import_node_path23.resolve)(root, path2)) }); + let common = (0, import_node_path23.dirname)(master); + for (const file of selected) { + const path2 = (0, import_node_path23.resolve)(root, file.path); + while (!inside6(common, path2)) { + const parent = (0, import_node_path23.dirname)(common); + if (parent === common) throw Error("GeoCraft inputs have no common task folder"); + common = parent; + } + } + if (common !== root && !inside6(root, common)) throw Error("GeoCraft project root escapes this task"); + const files = selected.map((file) => ({ ...file, path: packagePath((0, import_node_path23.relative)(common, (0, import_node_path23.resolve)(root, file.path)).split(import_node_path23.sep).join("/")) })); + const path = files.find((file) => file.role === "master").path; + await write7(output, files); + return { masterPath: path, files: files.map((file) => file.path) }; +} +async function materializeNativeProject18({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises23.realpath)(folder); + if (!Array.isArray(packageFiles) || !packageFiles.includes(masterPath)) throw Error("The native GeoCraft master is missing"); + const allowed = new Set(packageFiles.map(packagePath)); + const files = await collectGeoProject({ masterPath, readBlob: (path) => allowed.has(path) ? input2(root, (0, import_node_path23.resolve)(root, path)) : void 0 }); + await write7(output, files); + return { folder: output, masterPath: (0, import_node_path23.resolve)(output, masterPath) }; +} + +// apps/ledgercraft/native-package.mjs +var import_promises24 = require("node:fs/promises"); +var import_node_path24 = require("node:path"); + +// apps/ledgercraft/package.mjs +async function validateCompany(path, file) { + path = packagePath(path); + if (!/\.lcdb$/i.test(path) || !(file instanceof Blob) || file.size < 512 || file.size > 256 * 1024 ** 2) throw Error("Choose one complete LedgerCraft .lcdb company file up to 256 MiB"); + const header = new Uint8Array(await file.slice(0, 100).arrayBuffer()); + if (new TextDecoder().decode(header.subarray(0, 16)) !== "SQLite format 3\0") throw Error("The company file does not have a native SQLite header"); + const view = new DataView(header.buffer, header.byteOffset, header.byteLength), raw = view.getUint16(16), page = raw === 1 ? 65536 : raw; + if (page < 512 || page > 65536 || page & page - 1 || file.size % page || view.getUint32(28) > file.size / page || ![1, 2].includes(header[18]) || ![1, 2].includes(header[19])) throw Error("The company database is incomplete or has an invalid page layout"); + return file; +} +async function collectProject5({ masterPath, paths = [masterPath], readBlob }) { + const master = packagePath(masterPath); + if (paths.length !== 1 || paths[0] !== master) throw Error("Save a self-contained .lcdb snapshot. Do not include hot WAL/SHM files or unrelated company files."); + return [{ path: master, role: "master", file: await validateCompany(master, await readBlob(master)) }]; +} + +// apps/ledgercraft/native-package.mjs +var inside7 = (root, path) => { + const rel = (0, import_node_path24.relative)(root, path); + return !!rel && rel !== ".." && !rel.startsWith(".." + import_node_path24.sep) && !(0, import_node_path24.isAbsolute)(rel); +}; +async function cold(path) { + for (const ext of ["-wal", "-journal"]) { + const info = await (0, import_promises24.lstat)(path + ext).catch((error2) => { + if (error2.code === "ENOENT") return null; + throw error2; + }); + if (info?.size) throw Error("Close the native company before packaging it; its hot journal has not been checkpointed"); + } +} +async function company(root, path) { + const actual = await (0, import_promises24.realpath)(path), info = await (0, import_promises24.lstat)(path); + if (!inside7(root, path) || !inside7(root, actual) || info.isSymbolicLink() || !info.isFile() || info.size > 256 * 1024 ** 2) throw Error("The company is outside this task, linked or oversized"); + await cold(actual); + const bytes5 = await (0, import_promises24.readFile)(actual); + await cold(actual); + const after = await (0, import_promises24.lstat)(actual); + if (after.size !== info.size || after.mtimeMs !== info.mtimeMs) throw Error("The native company changed while being packaged. Preserve it and retry after closing the editor."); + return new Blob([bytes5]); +} +async function write8(output, files) { + for (const file of files) { + const destination = (0, import_node_path24.resolve)(output, file.path); + await (0, import_promises24.mkdir)((0, import_node_path24.dirname)(destination), { recursive: true, mode: 448 }); + await (0, import_promises24.writeFile)(destination, new Uint8Array(await file.file.arrayBuffer()), { flag: "wx", mode: 384 }); + } +} +async function packageNativeProject23({ source, allowedRoot, output, projectFiles }) { + const root = await (0, import_promises24.realpath)(allowedRoot), master = (0, import_node_path24.resolve)(root, source); + if (!inside7(root, master)) throw Error("The company is outside this task"); + if (projectFiles?.length) throw Error("LedgerCraft packages contain exactly one self-contained .lcdb file"); + const masterPath = packagePath((0, import_node_path24.relative)(root, master).split(import_node_path24.sep).join("/")); + const files = await collectProject5({ masterPath, readBlob: () => company(root, master) }); + await write8(output, files); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject19({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises24.realpath)(folder); + if (!Array.isArray(packageFiles) || packageFiles.length !== 1 || packageFiles[0] !== masterPath) throw Error("The exact company package must contain one .lcdb master"); + masterPath = packagePath(masterPath); + const files = await collectProject5({ masterPath, readBlob: () => company(root, (0, import_node_path24.resolve)(root, masterPath)) }); + await write8(output, files); + return { folder: output, masterPath: (0, import_node_path24.resolve)(output, masterPath) }; +} + +// lib/task-native-master.mjs +var import_promises25 = require("node:fs/promises"); +var import_node_path25 = require("node:path"); +function taskNativeMaster({ name, extension, maxBytes, signature: signature2, validate: validate2 }) { + const accepts5 = (path) => typeof path === "string" && extension.test(path); + async function locate5(root, input3, { existing = true } = {}) { + if (typeof input3 !== "string" || !input3) throw Error(`Choose a ${name} file in this task.`); + const path = (0, import_node_path25.resolve)(root, input3); + const rel = (0, import_node_path25.relative)(root, path); + if (!rel || rel === ".." || rel.startsWith(".." + import_node_path25.sep) || (0, import_node_path25.isAbsolute)(rel)) throw Error("The project is outside this task."); + const nameInPackage = packagePath(rel.split(import_node_path25.sep).join("/")); + if (!accepts5(nameInPackage)) throw Error(`Choose a native ${name} project.`); + if (await (0, import_promises25.realpath)((0, import_node_path25.dirname)(path)) !== (0, import_node_path25.dirname)(path)) throw Error("Linked project folders are unavailable."); + const info = await (0, import_promises25.lstat)(path).catch((error2) => { + if (!existing && error2.code === "ENOENT") return null; + throw error2; + }); + if (info && (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1 || info.size < 1 || info.size > maxBytes)) { + throw Error("The project is linked, empty or too large."); + } + return { path, name: nameInPackage, info }; + } + async function copy(root, source, output) { + const { path, name: nameInPackage, info } = await locate5(root, source); + const bytes5 = await (0, import_promises25.readFile)(path); + const after = await (0, import_promises25.lstat)(path); + if (after.mtimeMs !== info.mtimeMs || after.ino !== info.ino || bytes5.length !== info.size) { + throw Error("The project changed while being packaged. Save it and retry."); + } + if (signature2 && !bytes5.subarray(0, signature2.length).equals(signature2)) throw Error(`Invalid ${name} project header.`); + validate2?.(bytes5); + const destination = (0, import_node_path25.resolve)(output, nameInPackage); + await (0, import_promises25.mkdir)((0, import_node_path25.dirname)(destination), { recursive: true, mode: 448 }); + await (0, import_promises25.writeFile)(destination, bytes5, { flag: "wx", mode: 384 }); + return { nameInPackage, destination }; + } + return { + accepts: accepts5, + locate: locate5, + async packageNativeProject({ source, allowedRoot, output }) { + const { nameInPackage } = await copy(await (0, import_promises25.realpath)(allowedRoot), source, output); + return { masterPath: nameInPackage, files: [nameInPackage] }; + }, + async materializeNativeProject({ folder, masterPath, output, packageFiles }) { + if (!Array.isArray(packageFiles) || packageFiles.length !== 1 || packageFiles[0] !== masterPath) { + throw Error(`Open one exact ${name} master file.`); + } + const { destination } = await copy(await (0, import_promises25.realpath)(folder), masterPath, output); + return { folder: output, masterPath: destination }; + } + }; +} + +// apps/scriptcraft/package.mjs +var MAX_SCRIPT_BYTES = 128 * 1024 ** 2; +var scriptExtension = /\.(fdx|fountain)$/i; +var isScriptPath = (path) => scriptExtension.test(path); + +// apps/scriptcraft/native-package.mjs +var { + locate: taskScriptPath, + packageNativeProject: packageNativeProject24, + materializeNativeProject: materializeNativeProject20 +} = taskNativeMaster({ name: "ScriptCraft", extension: scriptExtension, maxBytes: MAX_SCRIPT_BYTES }); + +// apps/flarecraft/native-package.mjs +var native_package_exports = {}; +__export(native_package_exports, { + accepts: () => accepts, + locate: () => locate, + materializeNativeProject: () => materializeNativeProject21, + packageNativeProject: () => packageNativeProject25 +}); + +// apps/flarecraft/format.mjs +var flareExtension = /\.flare$/i; +var MAX_FLARE_BYTES = 256 * 1024 ** 2; +var FLARE_HEADER = "SQLite format 3\0"; + +// apps/flarecraft/native-package.mjs +var { accepts, locate, packageNativeProject: packageNativeProject25, materializeNativeProject: materializeNativeProject21 } = taskNativeMaster({ + name: "Flare", + extension: flareExtension, + maxBytes: MAX_FLARE_BYTES, + signature: Buffer.from(FLARE_HEADER) +}); + +// apps/pcbcraft/native-package.mjs +var native_package_exports2 = {}; +__export(native_package_exports2, { + accepts: () => accepts2, + locate: () => locate2, + materializeNativeProject: () => materializeNativeProject22, + packageNativeProject: () => packageNativeProject26 +}); + +// apps/pcbcraft/format.mjs +var pcbExtension = /\.pc\.zip$/i; +var MAX_PCB_BYTES = 64 * 1024 ** 2; +var PCB_HEADER = "PK"; + +// apps/pcbcraft/native-package.mjs +var { accepts: accepts2, locate: locate2, packageNativeProject: packageNativeProject26, materializeNativeProject: materializeNativeProject22 } = taskNativeMaster({ + name: "PCBCraft", + extension: pcbExtension, + maxBytes: MAX_PCB_BYTES, + signature: Buffer.from(PCB_HEADER) +}); + +// apps/pixelcraft/native-package.mjs +var native_package_exports3 = {}; +__export(native_package_exports3, { + accepts: () => accepts3, + locate: () => locate3, + materializeNativeProject: () => materializeNativeProject23, + packageNativeProject: () => packageNativeProject27 +}); +var import_promises26 = require("node:fs/promises"); +var import_node_path26 = require("node:path"); + +// apps/pixelcraft/format.mjs +var pixelExtension = /\.oxypix$/i; +var referenceExtension = /\.(png|jpe?g)$/i; +var MAX_PIXEL_BYTES = 80 * 1024 ** 2; +var MAX_SIDECAR_BYTES = 256 * 1024; +var signature = new TextEncoder().encode("OXYPIX1\0"); +var decoder8 = new TextDecoder("utf-8", { fatal: true }); +function referencePaths(masterPath, bytes5) { + if (bytes5.length > MAX_SIDECAR_BYTES) throw Error("The reference sidecar is too large."); + let offset = 0; + function line() { + const end = bytes5.indexOf(10, offset); + if (end < 0) throw Error("Invalid OxyPixel reference sidecar."); + const value2 = decoder8.decode(bytes5.subarray(offset, end)); + offset = end + 1; + return value2; + } + if (line() !== "OXYREFS1") throw Error("Invalid OxyPixel reference sidecar."); + const count = line(); + if (!/^[0-8]$/.test(count)) throw Error("Choose up to eight reference images."); + const paths = /* @__PURE__ */ new Set(); + for (let index = 0; index < Number(count); index++) { + const length = line(); + if (!/^\d{1,4}$/.test(length) || Number(length) < 1 || Number(length) > 4096) { + throw Error("Invalid OxyPixel reference path length."); + } + const end = offset + Number(length); + if (bytes5[end] !== 10) throw Error("Truncated OxyPixel reference path."); + const path = resolveReference(masterPath, decoder8.decode(bytes5.subarray(offset, end))); + if (!referenceExtension.test(path)) throw Error("Use PNG or JPEG reference images."); + paths.add(path); + offset = end + 1; + line(); + line(); + } + if (offset !== bytes5.length) throw Error("Unexpected bytes after the OxyPixel references."); + return [...paths]; +} +async function collectPixelProject(masterPath, readBlob) { + packagePath(masterPath); + const master = await readBlob(masterPath); + if (!pixelExtension.test(masterPath) || !master?.size || master.size > MAX_PIXEL_BYTES) { + throw Error("Choose an editable .oxypix project up to 80 MiB."); + } + const header = new Uint8Array(await master.slice(0, signature.length).arrayBuffer()); + if (header.length !== signature.length || !signature.every((byte, i) => header[i] === byte)) { + throw Error("Invalid OxyPixel project header."); + } + const files = [{ path: masterPath, role: "master", file: master }]; + const sidecarPath = masterPath + ".refs"; + const sidecar = await readBlob(sidecarPath); + if (!sidecar) return files; + if (!sidecar.size || sidecar.size > MAX_SIDECAR_BYTES) throw Error("Invalid OxyPixel reference sidecar."); + files.push({ path: sidecarPath, role: "dependency", file: sidecar }); + for (const path of referencePaths(masterPath, new Uint8Array(await sidecar.arrayBuffer()))) { + const file = await readBlob(path); + if (!file?.size || file.size > MAX_PIXEL_BYTES) throw Error(`Missing or oversized reference image: ${path}`); + files.push({ path, role: "dependency", file }); + } + return files; +} + +// apps/pixelcraft/native-package.mjs +var { accepts: accepts3, locate: locate3 } = taskNativeMaster({ + name: "PixelCraft", + extension: pixelExtension, + maxBytes: MAX_PIXEL_BYTES, + signature: Buffer.from("OXYPIX1\0") +}); +async function nativeFiles(root, masterPath) { + return collectPixelProject(masterPath, async (name) => { + const path = (0, import_node_path26.resolve)(root, packagePath(name)); + const info = await (0, import_promises26.lstat)(path).catch((error2) => { + if (error2.code === "ENOENT") return void 0; + throw error2; + }); + if (!info) return void 0; + if (await (0, import_promises26.realpath)(path) !== path || !info.isFile() || info.nlink !== 1 || info.size > MAX_PIXEL_BYTES) { + throw Error(`Use an ordinary task file: ${name}`); + } + const bytes5 = await (0, import_promises26.readFile)(path); + const after = await (0, import_promises26.lstat)(path); + if (after.mtimeMs !== info.mtimeMs || after.ino !== info.ino || bytes5.length !== info.size) { + throw Error("A PixelCraft file changed while packaging. Save it and retry."); + } + return new Blob([bytes5]); + }); +} +async function copyFiles(files, output) { + for (const { path, file } of files) { + const destination = (0, import_node_path26.resolve)(output, path); + await (0, import_promises26.mkdir)((0, import_node_path26.dirname)(destination), { recursive: true, mode: 448 }); + await (0, import_promises26.writeFile)(destination, Buffer.from(await file.arrayBuffer()), { flag: "wx", mode: 384 }); + } +} +async function packageNativeProject27({ source, allowedRoot, output }) { + const root = await (0, import_promises26.realpath)(allowedRoot); + const { name: masterPath } = await locate3(root, source); + const files = await nativeFiles(root, masterPath); + await copyFiles(files, output); + return { masterPath, files: files.map((file) => file.path) }; +} +async function materializeNativeProject23({ folder, masterPath, output, packageFiles }) { + const root = await (0, import_promises26.realpath)(folder); + await locate3(root, masterPath); + const files = await nativeFiles(root, masterPath); + const declared = new Set(packageFiles); + if (declared.size !== files.length || files.some((file) => !declared.has(file.path))) { + throw Error("The saved PixelCraft package has different reference files."); + } + await copyFiles(files, output); + return { folder: output, masterPath: (0, import_node_path26.resolve)(output, masterPath) }; +} + +// apps/mailcraft/native-package.mjs +var native_package_exports4 = {}; +__export(native_package_exports4, { + accepts: () => accepts4, + locate: () => locate4, + materializeNativeProject: () => materializeNativeProject24, + packageNativeProject: () => packageNativeProject28 +}); + +// apps/mailcraft/format.mjs +var mailcraftExtension = /\.mailcraft$/i; +var MAX_MAILCRAFT_BYTES = 64 * 1024 ** 2; +function validatePortableMailbox(bytes5) { + try { + if (!bytes5.byteLength || bytes5.byteLength > MAX_MAILCRAFT_BYTES) throw Error(); + const mailbox = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes5)); + if (!mailbox || typeof mailbox !== "object" || Array.isArray(mailbox) || ![0, 1].includes(mailbox.version ?? 0) || !["version", "accounts", "folders", "messages"].some((key) => Object.hasOwn(mailbox, key)) || ["accounts", "folders"].some((key) => mailbox[key] !== void 0 && !Array.isArray(mailbox[key]))) throw Error(); + } catch { + throw Error("Choose a self-contained MailCraft mailbox saved with Save Mailbox As."); + } +} + +// apps/mailcraft/native-package.mjs +var { accepts: accepts4, locate: locate4, packageNativeProject: packageNativeProject28, materializeNativeProject: materializeNativeProject24 } = taskNativeMaster({ + name: "MailCraft", + extension: mailcraftExtension, + maxBytes: MAX_MAILCRAFT_BYTES, + validate: validatePortableMailbox +}); + +// lib/drafting-native-session.mjs +var import_promises27 = require("node:fs/promises"); +var import_node_path27 = require("node:path"); +var import_node_url = require("node:url"); +var import_node_module = require("node:module"); +var import_node_crypto2 = require("node:crypto"); + +// lib/drafting-package.mjs +var draftingApps = Object.freeze({ + bimcraft: { extension: ".ifc", mimeType: "application/x-step" }, + modelcraft: { extension: ".modelcraft", format: "modelcraft", mimeType: "application/json" }, + markupcraft: { extension: ".pdf", mimeType: "application/pdf" }, + takeoffcraft: { extension: ".takeoff.json", format: "takeoffcraft-project", mimeType: "application/json" }, + civilcraft: { extension: ".civilcraft.json", format: "civilcraft-project", mimeType: "application/json" }, + detailcraft: { extension: ".detailcraft.json", format: "detailcraft", mimeType: "application/json" }, + partcraft: { extension: ".partcraft.json", extensions: [".partcraft.json", ".partcraft-asm.json"], format: "partcraft", mimeType: "application/json" } +}); +var MAX_DRAFTING_BYTES = 256 * 1024 ** 2; +async function checkedDraftingDocument(id, path, blob) { + const spec = draftingApps[id]; + if (!spec) throw Error("Unknown Drafting application"); + packagePath(path); + if (!(spec.extensions ?? [spec.extension]).some((ext) => path.toLowerCase().endsWith(ext))) throw Error(`Keep the editable ${spec.extension} master`); + if (!(blob instanceof Blob) || !blob.size || blob.size > MAX_DRAFTING_BYTES) throw Error("Drafting files must be between 1 byte and 256 MiB"); + if (id === "markupcraft") { + if (!(await blob.slice(0, 8).text()).startsWith("%PDF-")) throw Error("Expected a native PDF document"); + return null; + } + const text = await blob.text(); + if (id === "bimcraft") { + if (!/^\s*ISO-10303-21;/i.test(text) || !/END-ISO-10303-21;\s*$/i.test(text) || !/FILE_SCHEMA\s*\(\s*\(\s*'IFC/i.test(text)) throw Error("Expected a complete IFC model"); + return null; + } + let doc; + try { + doc = JSON.parse(text); + } catch { + throw Error("The editable project is not valid JSON"); + } + const assembly = id === "partcraft" && path.toLowerCase().endsWith(".partcraft-asm.json"); + if (!doc || Array.isArray(doc) || doc.format !== (assembly ? "partcraft-assembly" : spec.format) || !Number.isSafeInteger(doc.version) || doc.version < 1) throw Error(`Expected a native ${id} project`); + if (id === "modelcraft" && (!Array.isArray(doc.defs) || !doc.defs.length)) throw Error("The model has no editable definitions"); + if (id === "partcraft" && (assembly ? !Array.isArray(doc.instances) || !doc.parts || !Array.isArray(doc.joints) : !Array.isArray(doc.features))) throw Error("The part or assembly has no editable feature history"); + if (id === "detailcraft" && !Array.isArray(doc.members)) throw Error("The detail model has no member collection"); + if (id === "takeoffcraft" && (!Array.isArray(doc.files) || !Array.isArray(doc.items) || !Array.isArray(doc.marks) || doc.files.length > 199)) throw Error("Invalid takeoff project"); + return doc; +} +async function collectDraftingProject({ id, masterPath, readBlob, paths = [] }) { + const spec = draftingApps[id]; + const master = await readBlob(masterPath); + const doc = await checkedDraftingDocument(id, masterPath, master); + const files = [{ path: masterPath, file: master, role: "master", mimeType: spec.mimeType }]; + if (id !== "takeoffcraft") return files; + const used = /* @__PURE__ */ new Set([masterPath.toLowerCase()]); + let total = master.size; + for (const source of doc.files) { + if (!source || typeof source.name !== "string" || !/\.(pdf|dwg|dxf)$/i.test(source.name) || !/^[a-f0-9]{64}$/.test(source.hash) || !Number.isSafeInteger(source.size) || source.size < 1 || source.size > MAX_DRAFTING_BYTES) throw Error("Invalid takeoff drawing reference"); + packagePath(source.name); + const candidates = paths.filter((path) => path !== masterPath && path.split("/").pop() === source.name); + let found; + for (const path of candidates) { + packagePath(path); + const blob = await readBlob(path); + if (blob.size === source.size && await digestBlob(blob) === source.hash) { + found = { path, file: blob }; + break; + } + } + if (!found) throw Error(`The exact original drawing is missing: ${source.name}`); + if (used.has(found.path.toLowerCase())) continue; + used.add(found.path.toLowerCase()); + total += found.file.size; + if (total > 1024 ** 3) throw Error("A takeoff package must be no larger than 1 GiB"); + files.push({ ...found, role: "dependency", mimeType: /\.pdf$/i.test(found.path) ? "application/pdf" : "application/octet-stream" }); + } + return files; +} + +// lib/drafting-native-session.mjs +var engines = { + bimcraft: ["ifc/model.js", "6b16b92af75bade74c37451a391823da92698e55730f9616ec36f5308ba6e914"], + modelcraft: ["model.js", "0a46e9ba5820fc8eb6192a60b98c4456d22bbb109c7c436858d79908e5f401e7"], + markupcraft: ["pdf-write.js", "035b95bbc328864ce3fe3ece59c46e8b40bbfbac33b1422c99abb7009ca218e0"], + takeoffcraft: ["model.js", "67600180de8a91bffab730003ef0326f064d6eac501a893260b890adc4af9223"], + civilcraft: ["project.js", "908145aeeff09f02cc99cfd11c39db9ce3ea2dfe4b5e02d40fff8fdaadef04dd"], + detailcraft: ["model.js", "3f26002122f29cfec5bba2e82d32c50e982282b45b0e9bfb1e6592ea06c490b6"], + partcraft: ["part.js", "3ce4ff2815d917c7957e262a1cd1077adb9819135a7b5c4f988a3caae912cc35"] +}; +var draftingNativeIds = Object.freeze(Object.keys(engines)); +var draftingSuiteRoot = "/usr/lib/CadCraft Studio/app"; +async function loadNativeDrafting(id, suiteRoot = draftingSuiteRoot) { + if (!engines[id]) throw Error("Unknown native Drafting application"); + const suite = (0, import_node_path27.resolve)(suiteRoot), edition = (0, import_node_path27.resolve)(suite, "apps", id), source = (0, import_node_path27.resolve)(edition, `assets/apps/${id}/0.7`); + const [engine, expected] = engines[id]; + if ((0, import_node_crypto2.createHash)("sha256").update(await (0, import_promises27.readFile)((0, import_node_path27.resolve)(source, engine))).digest("hex") !== expected) throw Error("The installed native engine does not match its immutable pin"); + const page = await (0, import_promises27.readFile)((0, import_node_path27.resolve)(edition, "index.html"), "utf8"); + const imports = JSON.parse(page.match(/