Latest repo

This commit is contained in:
Marc
2025-06-02 16:42:16 +00:00
parent 53ddf1a329
commit cde5fae175
27907 changed files with 3875388 additions and 1 deletions

43
node_modules/react-pdf/dist/cjs/shared/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
export declare const PDF_ROLE_TO_HTML_ROLE: {
Document: null;
DocumentFragment: null;
Part: string;
Sect: string;
Div: string;
Aside: string;
NonStruct: string;
P: null;
H: string;
Title: null;
FENote: string;
Sub: string;
Lbl: null;
Span: null;
Em: null;
Strong: null;
Link: string;
Annot: string;
Form: string;
Ruby: null;
RB: null;
RT: null;
RP: null;
Warichu: null;
WT: null;
WP: null;
L: string;
LI: string;
LBody: null;
Table: string;
TR: string;
TH: string;
TD: string;
THead: string;
TBody: null;
TFoot: null;
Caption: null;
Figure: string;
Formula: null;
Artifact: null;
};
export declare const HEADING_PATTERN: RegExp;

60
node_modules/react-pdf/dist/cjs/shared/constants.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
// From pdfjs-dist/lib/web/struct_tree_layer_builder.js
Object.defineProperty(exports, "__esModule", { value: true });
exports.HEADING_PATTERN = exports.PDF_ROLE_TO_HTML_ROLE = void 0;
exports.PDF_ROLE_TO_HTML_ROLE = {
// Document level structure types
Document: null, // There's a "document" role, but it doesn't make sense here.
DocumentFragment: null,
// Grouping level structure types
Part: 'group',
Sect: 'group', // XXX: There's a "section" role, but it's abstract.
Div: 'group',
Aside: 'note',
NonStruct: 'none',
// Block level structure types
P: null,
// H<n>,
H: 'heading',
Title: null,
FENote: 'note',
// Sub-block level structure type
Sub: 'group',
// General inline level structure types
Lbl: null,
Span: null,
Em: null,
Strong: null,
Link: 'link',
Annot: 'note',
Form: 'form',
// Ruby and Warichu structure types
Ruby: null,
RB: null,
RT: null,
RP: null,
Warichu: null,
WT: null,
WP: null,
// List standard structure types
L: 'list',
LI: 'listitem',
LBody: null,
// Table standard structure types
Table: 'table',
TR: 'row',
TH: 'columnheader',
TD: 'cell',
THead: 'columnheader',
TBody: null,
TFoot: null,
// Standard structure type Caption
Caption: null,
// Standard structure type Figure
Figure: 'figure',
// Standard structure type Formula
Formula: null,
// standard structure type Artifact
Artifact: null,
};
exports.HEADING_PATTERN = /^H(\d+)$/;

View File

@@ -0,0 +1 @@
export default function useCachedValue<T>(getter: () => T): () => T;

View File

@@ -0,0 +1,18 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useCachedValue;
const react_1 = require("react");
const utils_js_1 = require("../utils.js");
function useCachedValue(getter) {
const ref = (0, react_1.useRef)(undefined);
const currentValue = ref.current;
if ((0, utils_js_1.isDefined)(currentValue)) {
return () => currentValue;
}
return () => {
const value = getter();
ref.current = value;
return value;
};
}

View File

@@ -0,0 +1,2 @@
import type { DocumentContextType } from '../types.js';
export default function useDocumentContext(): DocumentContextType;

View File

@@ -0,0 +1,11 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useDocumentContext;
const react_1 = require("react");
const DocumentContext_js_1 = __importDefault(require("../../DocumentContext.js"));
function useDocumentContext() {
return (0, react_1.useContext)(DocumentContext_js_1.default);
}

View File

@@ -0,0 +1,2 @@
import type { OutlineContextType } from '../types.js';
export default function useOutlineContext(): OutlineContextType;

View File

@@ -0,0 +1,11 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useOutlineContext;
const react_1 = require("react");
const OutlineContext_js_1 = __importDefault(require("../../OutlineContext.js"));
function useOutlineContext() {
return (0, react_1.useContext)(OutlineContext_js_1.default);
}

View File

@@ -0,0 +1,2 @@
import type { PageContextType } from '../types.js';
export default function usePageContext(): PageContextType;

View File

@@ -0,0 +1,11 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = usePageContext;
const react_1 = require("react");
const PageContext_js_1 = __importDefault(require("../../PageContext.js"));
function usePageContext() {
return (0, react_1.useContext)(PageContext_js_1.default);
}

View File

@@ -0,0 +1,21 @@
type State<T> = {
value: T;
error: undefined;
} | {
value: false;
error: Error;
} | {
value: undefined;
error: undefined;
};
type Action<T> = {
type: 'RESOLVE';
value: T;
} | {
type: 'REJECT';
error: Error;
} | {
type: 'RESET';
};
export default function useResolver<T>(): [State<T>, React.Dispatch<Action<T>>];
export {};

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useResolver;
const react_1 = require("react");
function reducer(state, action) {
switch (action.type) {
case 'RESOLVE':
return { value: action.value, error: undefined };
case 'REJECT':
return { value: false, error: action.error };
case 'RESET':
return { value: undefined, error: undefined };
default:
return state;
}
}
function useResolver() {
return (0, react_1.useReducer)((reducer), { value: undefined, error: undefined });
}

View File

@@ -0,0 +1,12 @@
import { PDF_ROLE_TO_HTML_ROLE } from './constants.js';
import type { StructTreeContent, StructTreeNode } from 'pdfjs-dist/types/src/display/api.js';
import type { StructTreeNodeWithExtraAttributes } from './types.js';
type PdfRole = keyof typeof PDF_ROLE_TO_HTML_ROLE;
type Attributes = React.HTMLAttributes<HTMLElement>;
export declare function isPdfRole(role: string): role is PdfRole;
export declare function isStructTreeNode(node: StructTreeNode | StructTreeContent): node is StructTreeNode;
export declare function isStructTreeNodeWithOnlyContentChild(node: StructTreeNode | StructTreeContent): boolean;
export declare function getRoleAttributes(node: StructTreeNode | StructTreeContent): Attributes;
export declare function getBaseAttributes(node: StructTreeNodeWithExtraAttributes | StructTreeContent): Attributes;
export declare function getAttributes(node: StructTreeNodeWithExtraAttributes | StructTreeContent): Attributes | null;
export {};

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPdfRole = isPdfRole;
exports.isStructTreeNode = isStructTreeNode;
exports.isStructTreeNodeWithOnlyContentChild = isStructTreeNodeWithOnlyContentChild;
exports.getRoleAttributes = getRoleAttributes;
exports.getBaseAttributes = getBaseAttributes;
exports.getAttributes = getAttributes;
const constants_js_1 = require("./constants.js");
function isPdfRole(role) {
return role in constants_js_1.PDF_ROLE_TO_HTML_ROLE;
}
function isStructTreeNode(node) {
return 'children' in node;
}
function isStructTreeNodeWithOnlyContentChild(node) {
if (!isStructTreeNode(node)) {
return false;
}
return node.children.length === 1 && 0 in node.children && 'id' in node.children[0];
}
function getRoleAttributes(node) {
const attributes = {};
if (isStructTreeNode(node)) {
const { role } = node;
const matches = role.match(constants_js_1.HEADING_PATTERN);
if (matches) {
attributes.role = 'heading';
attributes['aria-level'] = Number(matches[1]);
}
else if (isPdfRole(role)) {
const htmlRole = constants_js_1.PDF_ROLE_TO_HTML_ROLE[role];
if (htmlRole) {
attributes.role = htmlRole;
}
}
}
return attributes;
}
function getBaseAttributes(node) {
const attributes = {};
if (isStructTreeNode(node)) {
if (node.alt !== undefined) {
attributes['aria-label'] = node.alt;
}
if (node.lang !== undefined) {
attributes.lang = node.lang;
}
if (isStructTreeNodeWithOnlyContentChild(node)) {
const [child] = node.children;
if (child) {
const childAttributes = getBaseAttributes(child);
return Object.assign(Object.assign({}, attributes), childAttributes);
}
}
}
else {
if ('id' in node) {
attributes['aria-owns'] = node.id;
}
}
return attributes;
}
function getAttributes(node) {
if (!node) {
return null;
}
return Object.assign(Object.assign({}, getRoleAttributes(node)), getBaseAttributes(node));
}

119
node_modules/react-pdf/dist/cjs/shared/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import type { PDFDataRangeTransport, PDFDocumentProxy, PDFPageProxy, PasswordResponses } from 'pdfjs-dist';
import type { TypedArray, DocumentInitParameters, RefProxy, StructTreeNode, TextContent, TextItem } from 'pdfjs-dist/types/src/display/api.js';
import type { AnnotationLayerParameters } from 'pdfjs-dist/types/src/display/annotation_layer.js';
import type LinkService from '../LinkService.js';
type NullableObject<T extends object> = {
[P in keyof T]: T[P] | null;
};
type KeyOfUnion<T> = T extends unknown ? keyof T : never;
export type Annotations = AnnotationLayerParameters['annotations'];
export type ClassName = string | null | undefined | (string | null | undefined)[];
export type ResolvedDest = (RefProxy | number)[];
export type Dest = Promise<ResolvedDest> | ResolvedDest | string | null;
export type ExternalLinkRel = string;
export type ExternalLinkTarget = '_self' | '_blank' | '_parent' | '_top';
export type ImageResourcesPath = string;
export type OnError = (error: Error) => void;
export type OnItemClickArgs = {
dest?: Dest;
pageIndex: number;
pageNumber: number;
};
export type OnLoadProgressArgs = {
loaded: number;
total: number;
};
export type RegisterPage = (pageIndex: number, ref: HTMLDivElement) => void;
export type RenderMode = 'canvas' | 'custom' | 'none';
export type ScrollPageIntoViewArgs = {
dest?: ResolvedDest;
pageIndex?: number;
pageNumber: number;
};
type BinaryData = TypedArray | ArrayBuffer | number[] | string;
export type Source = {
data: BinaryData | undefined;
} | {
range: PDFDataRangeTransport;
} | {
url: string;
};
export type UnregisterPage = (pageIndex: number) => void;
export type CustomRenderer = React.FunctionComponent | React.ComponentClass;
export type CustomTextRenderer = (props: {
pageIndex: number;
pageNumber: number;
itemIndex: number;
} & TextItem) => string;
export type DocumentCallback = PDFDocumentProxy;
export type File = string | ArrayBuffer | Blob | Source | null;
export type PageCallback = PDFPageProxy & {
width: number;
height: number;
originalWidth: number;
originalHeight: number;
};
export type NodeOrRenderer = React.ReactNode | (() => React.ReactNode);
export type OnDocumentLoadError = OnError;
export type OnDocumentLoadProgress = (args: OnLoadProgressArgs) => void;
export type OnDocumentLoadSuccess = (document: DocumentCallback) => void;
export type OnGetAnnotationsError = OnError;
export type OnGetAnnotationsSuccess = (annotations: Annotations) => void;
export type OnGetStructTreeError = OnError;
export type OnGetStructTreeSuccess = (tree: StructTreeNode) => void;
export type OnGetTextError = OnError;
export type OnGetTextSuccess = (textContent: TextContent) => void;
export type OnPageLoadError = OnError;
export type OnPageLoadSuccess = (page: PageCallback) => void;
export type OnPasswordCallback = (password: string | null) => void;
export type OnRenderAnnotationLayerError = (error: unknown) => void;
export type OnRenderAnnotationLayerSuccess = () => void;
export type OnRenderError = OnError;
export type OnRenderSuccess = (page: PageCallback) => void;
export type OnRenderTextLayerError = OnError;
export type OnRenderTextLayerSuccess = () => void;
export type PasswordResponse = (typeof PasswordResponses)[keyof typeof PasswordResponses];
export type Options = NullableObject<Omit<DocumentInitParameters, KeyOfUnion<Source>>>;
export type DocumentContextType = {
imageResourcesPath?: ImageResourcesPath;
linkService: LinkService;
onItemClick?: (args: OnItemClickArgs) => void;
pdf?: PDFDocumentProxy | false;
registerPage: RegisterPage;
renderMode?: RenderMode;
rotate?: number | null;
unregisterPage: UnregisterPage;
} | null;
export type PageContextType = {
_className?: string;
canvasBackground?: string;
customTextRenderer?: CustomTextRenderer;
devicePixelRatio?: number;
onGetAnnotationsError?: OnGetAnnotationsError;
onGetAnnotationsSuccess?: OnGetAnnotationsSuccess;
onGetStructTreeError?: OnGetStructTreeError;
onGetStructTreeSuccess?: OnGetStructTreeSuccess;
onGetTextError?: OnGetTextError;
onGetTextSuccess?: OnGetTextSuccess;
onRenderAnnotationLayerError?: OnRenderAnnotationLayerError;
onRenderAnnotationLayerSuccess?: OnRenderAnnotationLayerSuccess;
onRenderError?: OnRenderError;
onRenderSuccess?: OnRenderSuccess;
onRenderTextLayerError?: OnRenderTextLayerError;
onRenderTextLayerSuccess?: OnRenderTextLayerSuccess;
page: PDFPageProxy | false | undefined;
pageIndex: number;
pageNumber: number;
renderForms: boolean;
renderTextLayer: boolean;
rotate: number;
scale: number;
} | null;
export type OutlineContextType = {
onItemClick?: (args: OnItemClickArgs) => void;
} | null;
export type StructTreeNodeWithExtraAttributes = StructTreeNode & {
alt?: string;
lang?: string;
};
export {};

2
node_modules/react-pdf/dist/cjs/shared/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

56
node_modules/react-pdf/dist/cjs/shared/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import type { PDFPageProxy } from 'pdfjs-dist';
import type { PageCallback } from './types.js';
/**
* Checks if we're running in a browser environment.
*/
export declare const isBrowser: boolean;
/**
* Checks whether we're running from a local file system.
*/
export declare const isLocalFileSystem: boolean;
/**
* Checks whether a variable is defined.
*
* @param {*} variable Variable to check
*/
export declare function isDefined<T>(variable: T | undefined): variable is T;
/**
* Checks whether a variable is defined and not null.
*
* @param {*} variable Variable to check
*/
export declare function isProvided<T>(variable: T | null | undefined): variable is T;
/**
* Checks whether a variable provided is a string.
*
* @param {*} variable Variable to check
*/
export declare function isString(variable: unknown): variable is string;
/**
* Checks whether a variable provided is an ArrayBuffer.
*
* @param {*} variable Variable to check
*/
export declare function isArrayBuffer(variable: unknown): variable is ArrayBuffer;
/**
* Checks whether a variable provided is a Blob.
*
* @param {*} variable Variable to check
*/
export declare function isBlob(variable: unknown): variable is Blob;
/**
* Checks whether a variable provided is a data URI.
*
* @param {*} variable String to check
*/
export declare function isDataURI(variable: unknown): variable is `data:${string}`;
export declare function dataURItoByteString(dataURI: unknown): string;
export declare function getDevicePixelRatio(): number;
export declare function displayCORSWarning(): void;
export declare function displayWorkerWarning(): void;
export declare function cancelRunningTask(runningTask?: {
cancel?: () => void;
} | null): void;
export declare function makePageCallback(page: PDFPageProxy, scale: number): PageCallback;
export declare function isCancelException(error: Error): boolean;
export declare function loadFromFile(file: Blob): Promise<ArrayBuffer>;

163
node_modules/react-pdf/dist/cjs/shared/utils.js generated vendored Normal file
View File

@@ -0,0 +1,163 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLocalFileSystem = exports.isBrowser = void 0;
exports.isDefined = isDefined;
exports.isProvided = isProvided;
exports.isString = isString;
exports.isArrayBuffer = isArrayBuffer;
exports.isBlob = isBlob;
exports.isDataURI = isDataURI;
exports.dataURItoByteString = dataURItoByteString;
exports.getDevicePixelRatio = getDevicePixelRatio;
exports.displayCORSWarning = displayCORSWarning;
exports.displayWorkerWarning = displayWorkerWarning;
exports.cancelRunningTask = cancelRunningTask;
exports.makePageCallback = makePageCallback;
exports.isCancelException = isCancelException;
exports.loadFromFile = loadFromFile;
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
const warning_1 = __importDefault(require("warning"));
/**
* Checks if we're running in a browser environment.
*/
exports.isBrowser = typeof window !== 'undefined';
/**
* Checks whether we're running from a local file system.
*/
exports.isLocalFileSystem = exports.isBrowser && window.location.protocol === 'file:';
/**
* Checks whether a variable is defined.
*
* @param {*} variable Variable to check
*/
function isDefined(variable) {
return typeof variable !== 'undefined';
}
/**
* Checks whether a variable is defined and not null.
*
* @param {*} variable Variable to check
*/
function isProvided(variable) {
return isDefined(variable) && variable !== null;
}
/**
* Checks whether a variable provided is a string.
*
* @param {*} variable Variable to check
*/
function isString(variable) {
return typeof variable === 'string';
}
/**
* Checks whether a variable provided is an ArrayBuffer.
*
* @param {*} variable Variable to check
*/
function isArrayBuffer(variable) {
return variable instanceof ArrayBuffer;
}
/**
* Checks whether a variable provided is a Blob.
*
* @param {*} variable Variable to check
*/
function isBlob(variable) {
(0, tiny_invariant_1.default)(exports.isBrowser, 'isBlob can only be used in a browser environment');
return variable instanceof Blob;
}
/**
* Checks whether a variable provided is a data URI.
*
* @param {*} variable String to check
*/
function isDataURI(variable) {
return isString(variable) && /^data:/.test(variable);
}
function dataURItoByteString(dataURI) {
(0, tiny_invariant_1.default)(isDataURI(dataURI), 'Invalid data URI.');
const [headersString = '', dataString = ''] = dataURI.split(',');
const headers = headersString.split(';');
if (headers.indexOf('base64') !== -1) {
return atob(dataString);
}
return unescape(dataString);
}
function getDevicePixelRatio() {
return (exports.isBrowser && window.devicePixelRatio) || 1;
}
const allowFileAccessFromFilesTip = 'On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.';
function displayCORSWarning() {
(0, warning_1.default)(!exports.isLocalFileSystem, `Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${allowFileAccessFromFilesTip}`);
}
function displayWorkerWarning() {
(0, warning_1.default)(!exports.isLocalFileSystem, `Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${allowFileAccessFromFilesTip}`);
}
function cancelRunningTask(runningTask) {
if (runningTask === null || runningTask === void 0 ? void 0 : runningTask.cancel)
runningTask.cancel();
}
function makePageCallback(page, scale) {
Object.defineProperty(page, 'width', {
get() {
return this.view[2] * scale;
},
configurable: true,
});
Object.defineProperty(page, 'height', {
get() {
return this.view[3] * scale;
},
configurable: true,
});
Object.defineProperty(page, 'originalWidth', {
get() {
return this.view[2];
},
configurable: true,
});
Object.defineProperty(page, 'originalHeight', {
get() {
return this.view[3];
},
configurable: true,
});
return page;
}
function isCancelException(error) {
return error.name === 'RenderingCancelledException';
}
function loadFromFile(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
if (!reader.result) {
return reject(new Error('Error while reading a file.'));
}
resolve(reader.result);
};
reader.onerror = (event) => {
if (!event.target) {
return reject(new Error('Error while reading a file.'));
}
const { error } = event.target;
if (!error) {
return reject(new Error('Error while reading a file.'));
}
switch (error.code) {
case error.NOT_FOUND_ERR:
return reject(new Error('Error while reading a file: File not found.'));
case error.SECURITY_ERR:
return reject(new Error('Error while reading a file: Security error.'));
case error.ABORT_ERR:
return reject(new Error('Error while reading a file: Aborted.'));
default:
return reject(new Error('Error while reading a file.'));
}
};
reader.readAsArrayBuffer(file);
});
}