ima2-gen 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/bin/commands/gen.js +7 -5
- package/bin/commands/multimode.js +7 -5
- package/bin/commands/node.js +2 -1
- package/config.js +8 -1
- package/docs/API.md +5 -4
- package/docs/CLI.md +4 -4
- package/docs/FAQ.ko.md +1 -1
- package/docs/FAQ.md +1 -1
- package/docs/migration/runtime-test-inventory.md +11 -1
- package/lib/agentCommandParser.js +10 -6
- package/lib/agentGenerationPlanner.js +96 -19
- package/lib/agentImageVideoGen.js +26 -6
- package/lib/agentPlannerModel.js +172 -0
- package/lib/agentQuestionResponder.js +9 -3
- package/lib/agentQueueStore.js +42 -0
- package/lib/agentQueueWorker.js +57 -7
- package/lib/agentRuntime.js +96 -12
- package/lib/agentSettings.js +9 -6
- package/lib/agentToolManifest.js +90 -0
- package/lib/agentTypes.js +1 -0
- package/lib/agyCli.js +31 -0
- package/lib/agyImageAdapter.js +73 -8
- package/lib/capabilities.js +7 -5
- package/lib/configKeys.js +6 -0
- package/lib/geminiApiImageAdapter.js +11 -4
- package/lib/generationRequestLog.js +25 -0
- package/lib/grokImageAdapter.js +27 -34
- package/lib/grokMultimodeAdapter.js +2 -1
- package/lib/grokVideoAdapter.js +3 -2
- package/lib/grokVideoPlannerPrompt.js +18 -25
- package/lib/inflight.js +1 -1
- package/lib/multimodeHelpers.js +3 -2
- package/lib/oauthProxy/generators.js +6 -5
- package/lib/oauthProxy/prompts.js +41 -16
- package/lib/oauthProxy/streams.js +1 -1
- package/lib/promptSafetyPolicy.js +1 -1
- package/lib/responsesDoctor.js +3 -3
- package/lib/responsesFallback.js +27 -14
- package/lib/responsesImageAdapter.js +11 -7
- package/node_modules/qs/CHANGELOG.md +10 -0
- package/node_modules/qs/README.md +1 -1
- package/node_modules/qs/dist/qs.js +15 -15
- package/node_modules/qs/eslint.config.mjs +1 -0
- package/node_modules/qs/lib/parse.js +52 -22
- package/node_modules/qs/lib/stringify.js +11 -4
- package/node_modules/qs/package.json +2 -2
- package/node_modules/qs/test/parse.js +49 -0
- package/node_modules/qs/test/stringify.js +129 -0
- package/package.json +1 -1
- package/routes/agent.js +19 -2
- package/routes/agy.js +5 -1
- package/routes/generate.js +12 -1
- package/routes/generationRequestLog.js +16 -0
- package/routes/index.js +2 -0
- package/routes/keys.js +22 -2
- package/routes/multimode.js +1 -1
- package/routes/nodes.js +5 -5
- package/ui/dist/.vite/manifest.json +22 -12
- package/ui/dist/assets/AgentWorkspace-qEMrATBP.js +3 -0
- package/ui/dist/assets/{CardNewsWorkspace-Dav3K5CT.js → CardNewsWorkspace-DoJnVHmn.js} +1 -1
- package/ui/dist/assets/GenerationRequestLogPanel-BDWRRLNV.js +1 -0
- package/ui/dist/assets/{NodeCanvas-C4ifFzB1.js → NodeCanvas-DIMo45sp.js} +3 -3
- package/ui/dist/assets/{PromptBuilderPanel-CEcyU9PL.js → PromptBuilderPanel-BF3lcSJD.js} +2 -2
- package/ui/dist/assets/{PromptImportDialog-CgQ94Gth.js → PromptImportDialog-Cy6ZymKG.js} +2 -2
- package/ui/dist/assets/{PromptImportDiscoverySection-CuzyzbNI.js → PromptImportDiscoverySection-CzuW-8P2.js} +1 -1
- package/ui/dist/assets/PromptImportFolderSection-DP5ywnsv.js +1 -0
- package/ui/dist/assets/{PromptLibraryPanel-BOe18we8.js → PromptLibraryPanel-CAsKr7CV.js} +2 -2
- package/ui/dist/assets/SettingsWorkspace-_PdPVsxi.js +1 -0
- package/ui/dist/assets/index-BUinlX2n.js +4 -0
- package/ui/dist/assets/index-CX3fge8X.css +1 -0
- package/ui/dist/assets/index-ygo6nfqx.js +23 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/AgentWorkspace-Dth6YijN.js +0 -3
- package/ui/dist/assets/PromptImportFolderSection-DHLGlO6l.js +0 -1
- package/ui/dist/assets/SettingsWorkspace-Cdgnm4Wa.js +0 -1
- package/ui/dist/assets/index-C5PSahkr.js +0 -1
- package/ui/dist/assets/index-Dn2AhL6d.css +0 -1
- package/ui/dist/assets/index-Tjqx6wUV.js +0 -23
package/lib/multimodeHelpers.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export function normalizeMaxImages(value) {
|
|
2
|
-
|
|
1
|
+
export function normalizeMaxImages(value, maxGeneratedImages = 24) {
|
|
2
|
+
const max = Math.max(1, Math.trunc(Number(maxGeneratedImages) || 24));
|
|
3
|
+
return Math.min(max, Math.max(1, Math.trunc(Number(value) || 1)));
|
|
3
4
|
}
|
|
4
5
|
export function sequenceStatus(returned, requested) {
|
|
5
6
|
if (returned <= 0)
|
|
@@ -20,7 +20,7 @@ export async function generateViaOAuth(prompt, quality, size, moderation = "low"
|
|
|
20
20
|
moderation,
|
|
21
21
|
...(options.partialImages ? { partial_images: options.partialImages } : {}),
|
|
22
22
|
});
|
|
23
|
-
const textPrompt = buildUserTextPrompt(prompt, mode, { webSearchEnabled });
|
|
23
|
+
const textPrompt = buildUserTextPrompt(prompt, mode, { webSearchEnabled, size });
|
|
24
24
|
const referenceInputs = references.map(normalizeReferenceForOAuth);
|
|
25
25
|
const referenceDiagnostics = safeReferenceDiagnostics(referenceInputs);
|
|
26
26
|
const referenceMismatchCount = referenceDiagnostics.filter((ref) => ref.warnings.includes("mime_mismatch")).length;
|
|
@@ -117,7 +117,7 @@ export async function generateViaOAuth(prompt, quality, size, moderation = "low"
|
|
|
117
117
|
signal: timeout.signal,
|
|
118
118
|
body: JSON.stringify({
|
|
119
119
|
model,
|
|
120
|
-
input: [{ role: "user", content: buildUserTextPrompt(prompt, mode, { webSearchEnabled }) }],
|
|
120
|
+
input: [{ role: "user", content: buildUserTextPrompt(prompt, mode, { webSearchEnabled, size }) }],
|
|
121
121
|
tools: [{ type: "image_generation", quality, size, moderation }],
|
|
122
122
|
tool_choice: "required",
|
|
123
123
|
reasoning: { effort: reasoningEffort },
|
|
@@ -188,7 +188,8 @@ export async function generateMultimodeViaOAuth(prompt, quality, size, moderatio
|
|
|
188
188
|
await waitForOAuthReady(ctx);
|
|
189
189
|
const oauthUrl = getOAuthUrl(ctx);
|
|
190
190
|
const model = options.model || ctx.config?.imageModels?.default || "gpt-5.4-mini";
|
|
191
|
-
const
|
|
191
|
+
const maxGeneratedImages = Math.max(1, Math.trunc(Number(ctx.config?.limits?.maxGeneratedImages) || 24));
|
|
192
|
+
const maxImages = Math.min(maxGeneratedImages, Math.max(1, Math.trunc(Number(options.maxImages) || 1)));
|
|
192
193
|
const webSearchEnabled = resolveWebSearchEnabled(options);
|
|
193
194
|
const tools = buildImageTools(webSearchEnabled, {
|
|
194
195
|
quality,
|
|
@@ -199,7 +200,7 @@ export async function generateMultimodeViaOAuth(prompt, quality, size, moderatio
|
|
|
199
200
|
const referenceInputs = references.map(normalizeReferenceForOAuth);
|
|
200
201
|
const userText = buildMultimodeSequencePrompt(mode === "direct"
|
|
201
202
|
? `${prompt}${DIRECT_PROMPT_FIDELITY_SUFFIX}`
|
|
202
|
-
: `${prompt}${webSearchEnabled ? RESEARCH_SUFFIX : ""}${AUTO_PROMPT_FIDELITY_SUFFIX}`, maxImages, { webSearchEnabled });
|
|
203
|
+
: `${prompt}${webSearchEnabled ? RESEARCH_SUFFIX : ""}${AUTO_PROMPT_FIDELITY_SUFFIX}`, maxImages, { webSearchEnabled, size });
|
|
203
204
|
const userContent = referenceInputs.length
|
|
204
205
|
? [
|
|
205
206
|
...referenceInputs.map(({ b64, requestMime }) => ({
|
|
@@ -321,7 +322,7 @@ export async function editViaOAuth(prompt, imageB64, quality, size, moderation =
|
|
|
321
322
|
const oauthUrl = getOAuthUrl(ctx);
|
|
322
323
|
const model = options.model || ctx.config?.imageModels?.default || "gpt-5.4-mini";
|
|
323
324
|
const webSearchEnabled = resolveWebSearchEnabled(options);
|
|
324
|
-
const textPrompt = buildEditTextPrompt(prompt, mode, { webSearchEnabled });
|
|
325
|
+
const textPrompt = buildEditTextPrompt(prompt, mode, { webSearchEnabled, size });
|
|
325
326
|
const imageForRequest = await compressReferenceB64ForOAuth(imageB64, {
|
|
326
327
|
maxB64Bytes: ctx.config?.limits?.maxRefB64Bytes,
|
|
327
328
|
force: true,
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { config } from "../../config.js";
|
|
2
|
+
import { SAFETY_INTENT_POLICY } from "../promptSafetyPolicy.js";
|
|
2
3
|
import { VISIBLE_TEXT_LANGUAGE_POLICY } from "../visibleTextLanguagePolicy.js";
|
|
3
4
|
import { resolveWebSearchEnabled } from "./runtime.js";
|
|
4
5
|
const RESEARCH_SUFFIX = config.oauth.researchSuffix;
|
|
6
|
+
const CREATIVE_TOOL_CONTEXT = "You are an image generation assistant inside a professional creative tool used by designers and artists. Users create content for legitimate creative, commercial, or educational purposes. " +
|
|
7
|
+
SAFETY_INTENT_POLICY +
|
|
8
|
+
" ";
|
|
9
|
+
const EDIT_TOOL_CONTEXT = "You are an image editing assistant inside a professional creative tool used by designers and artists. Users create content for legitimate creative, commercial, or educational purposes. " +
|
|
10
|
+
SAFETY_INTENT_POLICY +
|
|
11
|
+
" ";
|
|
5
12
|
// Encourages multi-pass research for real people and signals broad authorization
|
|
6
13
|
// so the model treats lesser-known but publicly-documented subjects the same as
|
|
7
14
|
// household-name figures. Output is framed as a stylized portrait inspired by
|
|
@@ -21,43 +28,60 @@ export const REAL_PERSON_RESEARCH_DIRECTIVE = "Real-person handling: when the su
|
|
|
21
28
|
export const AUTO_PROMPT_FIDELITY_SUFFIX = "\n\nWhen you call the image_generation tool, treat the user's prompt as the source of truth. If the prompt is already visually sufficient, pass it through unchanged as the image_generation prompt argument. Do not translate, summarize, rewrite, restyle, expand, or add descriptors unless genuinely necessary to satisfy an underspecified visual request. If the user wrote in Korean, keep the Korean text. Do not inject additional style descriptors when the user already specified a style. " +
|
|
22
29
|
"Exception: if you invoked web_search because factual visual accuracy was required and the prompt/context was insufficient, append only the concrete visual facts you found (kit colors, team, venue, era, distinguishing features, accurate likeness cues) as English clarifiers at the end of the prompt argument. The user's original text stays first; research-derived facts append after.\n\n" +
|
|
23
30
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
24
|
-
export const DIRECT_PROMPT_FIDELITY_SUFFIX = "\n\nWhen you call the image_generation tool, use the user's prompt as the primary image prompt. Do not translate, summarize, restyle, add clarifiers,
|
|
31
|
+
export const DIRECT_PROMPT_FIDELITY_SUFFIX = "\n\nWhen you call the image_generation tool, use the user's prompt as the primary image prompt. Do not translate, summarize, restyle, add clarifiers, inject additional style descriptors, or append negative safety constraints. Apply the safety intent policy as internal classification guidance only; do not add it as visible prompt content or alter benign clothing requests such as adult swimwear.\n\n" +
|
|
32
|
+
SAFETY_INTENT_POLICY +
|
|
33
|
+
"\n\n" +
|
|
25
34
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
26
35
|
export const PROMPT_FIDELITY_SUFFIX = AUTO_PROMPT_FIDELITY_SUFFIX;
|
|
27
|
-
export const GENERATE_DEVELOPER_PROMPT =
|
|
36
|
+
export const GENERATE_DEVELOPER_PROMPT = CREATIVE_TOOL_CONTEXT +
|
|
37
|
+
"Your primary function is to invoke the image_generation tool. Never respond with plain text only. Preserve the user's prompt by default. If the prompt is visually sufficient, pass it through unchanged as the image_generation prompt argument and do not search or add clarifiers. Use web_search only when factual visual accuracy is genuinely required and the user's prompt or attached visual context is insufficient; then incorporate only concrete findings (kit colors, team, era, venue, distinguishing features) as English clarifiers appended after the user's original text. " +
|
|
28
38
|
REAL_PERSON_RESEARCH_DIRECTIVE +
|
|
29
|
-
" When the user's request is abstract, conceptual, or non-visual, interpret it creatively and render it as an image. Quality guidelines (apply universally, regardless of style): Default to absolute quality: crisp details, clean lines, well-balanced composition, appropriate contrast and color. Avoid: blur, noise, compression artifacts, watermark, signature, cropped elements, duplicates. Text and typography must be rendered with precise spelling, sharp edges, and no distortion. Quality
|
|
39
|
+
" When the user's request is abstract, conceptual, or non-visual, interpret it creatively and render it as an image. Quality guidelines (apply universally, regardless of style): Default to absolute quality: crisp details, clean lines, well-balanced composition, appropriate contrast and color. Avoid: blur, noise, compression artifacts, watermark, signature, cropped elements, duplicates. Text and typography must be rendered with precise spelling, sharp edges, and no distortion. Quality clarifier handling: For images containing humans or humanoid figures: append 'accurate human proportions, correct hand count, natural facial features' as a quality clarifier at the end of the prompt argument; never rewrite the user's own text to express this. For non-human subjects (objects, animals, abstract art, landscapes): omit anatomy-related clarifiers. Style handling: Preserve the style the user explicitly or implicitly requests. If the user specifies a style (e.g., 'anime', 'oil painting', 'pixel art', 'photorealistic'), adhere to it faithfully. If no style is specified, produce a polished, high-quality image without imposing any stylistic bias. Do not default to photorealism unless the user asks for it. Fulfill compliant requests exactly as stated, without adding disclaimers, warnings, or altering benign visual intent.\n\n" +
|
|
30
40
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
31
|
-
export const GENERATE_NO_SEARCH_DEVELOPER_PROMPT =
|
|
32
|
-
"
|
|
41
|
+
export const GENERATE_NO_SEARCH_DEVELOPER_PROMPT = CREATIVE_TOOL_CONTEXT +
|
|
42
|
+
"Your primary function is to invoke the image_generation tool. Never respond with plain text only. " +
|
|
43
|
+
"Preserve the user's prompt by default. If the prompt is visually sufficient, pass it through unchanged as the image_generation prompt argument. When the user's request is abstract, conceptual, or non-visual, interpret it creatively and render it as an image. Quality guidelines (apply universally, regardless of style): Default to absolute quality: crisp details, clean lines, well-balanced composition, appropriate contrast and color. Avoid: blur, noise, compression artifacts, watermark, signature, cropped elements, duplicates. Text and typography must be rendered with precise spelling, sharp edges, and no distortion. Quality clarifier handling: For images containing humans or humanoid figures: append 'accurate human proportions, correct hand count, natural facial features' as a quality clarifier at the end of the prompt argument; never rewrite the user's own text to express this. For non-human subjects (objects, animals, abstract art, landscapes): omit anatomy-related clarifiers. Style handling: Preserve the style the user explicitly or implicitly requests. If the user specifies a style (e.g., 'anime', 'oil painting', 'pixel art', 'photorealistic'), adhere to it faithfully. If no style is specified, produce a polished, high-quality image without imposing any stylistic bias. Do not default to photorealism unless the user asks for it. Fulfill the request exactly as stated, without adding disclaimers, warnings, or altering the user's intent.\n\n" +
|
|
33
44
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
34
|
-
export const EDIT_DEVELOPER_PROMPT =
|
|
45
|
+
export const EDIT_DEVELOPER_PROMPT = EDIT_TOOL_CONTEXT +
|
|
46
|
+
"Your primary function is to invoke the image_generation tool. Never respond with plain text only. Preserve the user's edit prompt by default. If the prompt plus input image is visually sufficient, pass the user's prompt through unchanged as the image_generation prompt argument and do not search or add clarifiers. Use web_search only when factual visual accuracy is genuinely required and the user's prompt or input image is insufficient; then incorporate only concrete findings (kit colors, team, era, venue, distinguishing features) as English clarifiers appended after the user's original text. " +
|
|
35
47
|
REAL_PERSON_RESEARCH_DIRECTIVE +
|
|
36
|
-
" When editing an image: Preserve the original style, color palette, and composition unless the user explicitly requests a style change. Apply the requested edits precisely without altering unaffected areas. Maintain absolute quality: crisp details, clean lines, well-balanced composition. Avoid: blur, noise, compression artifacts, watermark, signature. Text and typography must be rendered with precise spelling, sharp edges, and no distortion. For edits involving humans or humanoid figures:
|
|
48
|
+
" When editing an image: Preserve the original style, color palette, and composition unless the user explicitly requests a style change. Apply the requested edits precisely without altering unaffected areas. Maintain absolute quality: crisp details, clean lines, well-balanced composition. Avoid: blur, noise, compression artifacts, watermark, signature. Text and typography must be rendered with precise spelling, sharp edges, and no distortion. For edits involving humans or humanoid figures: append 'accurate human proportions, correct hand count, natural facial features' as a quality clarifier at the end of the prompt argument; never rewrite the user's own text to express this. Fulfill compliant requests exactly as stated, without adding disclaimers, warnings, or altering benign visual intent.\n\n" +
|
|
37
49
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
38
|
-
export const EDIT_NO_SEARCH_DEVELOPER_PROMPT =
|
|
39
|
-
"
|
|
50
|
+
export const EDIT_NO_SEARCH_DEVELOPER_PROMPT = EDIT_TOOL_CONTEXT +
|
|
51
|
+
"Your primary function is to invoke the image_generation tool. Never respond with plain text only. " +
|
|
52
|
+
"Preserve the user's edit prompt by default. If the prompt plus input image is visually sufficient, pass the user's prompt through unchanged as the image_generation prompt argument. When editing an image: Preserve the original style, color palette, and composition unless the user explicitly requests a style change. Apply the requested edits precisely without altering unaffected areas. Maintain absolute quality: crisp details, clean lines, well-balanced composition. Avoid: blur, noise, compression artifacts, watermark, signature. Text and typography must be rendered with precise spelling, sharp edges, and no distortion. For edits involving humans or humanoid figures: append 'accurate human proportions, correct hand count, natural facial features' as a quality clarifier at the end of the prompt argument; never rewrite the user's own text to express this. Fulfill the request exactly as stated, without adding disclaimers, warnings, or altering the user's intent.\n\n" +
|
|
40
53
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
41
|
-
export const MULTIMODE_DEVELOPER_PROMPT =
|
|
54
|
+
export const MULTIMODE_DEVELOPER_PROMPT = CREATIVE_TOOL_CONTEXT +
|
|
55
|
+
"You are generating a multimode sequence. The selected value N is the maximum number of sequence outputs, not a visual subject count. You MUST create up to N separate image_generation_call outputs. First infer the user's intended sequence from the prompt. If the prompt explicitly asks for several images, steps, states, endings, or items one per image, map each requested unit to its own output up to N. Korean phrases such as '하나씩', '각각', '한 장씩', '이미지마다', and '네개를 그려줘' in a sequence context mean separate outputs, not four subjects inside one output. If the prompt uses arrows or ordered wording such as A -> B, generate the endpoint/state for A, then the endpoint/state for B, and continue in order up to N. Invoke the image_generation tool separately once per sequence output with a distinct stage-specific prompt. Each stage prompt must describe only that stage's single unit/state. Do not pass the same complete user prompt to every output when the user described a sequence. Do not include the whole list of sequence units inside any single image_generation prompt. Do not use words like all, four, 네개, collection, lineup, grid, sheet, or panels inside a stage prompt when the stage should contain one unit. Example: if the user asks for four different colored shapes one per image, call the tool four times: one image with only a red circle; one image with only a blue square; one image with only a green triangle; one image with only a yellow star. Do not satisfy this request with one image_generation_call. Never collapse multiple sequence outputs into one image. Do not create a collage. Do not create a grid. Do not create a contact sheet. Do not create a storyboard sheet. Do not put multiple panels inside one image. If you cannot complete all outputs, return as many separate image_generation_call outputs as possible. Stop after N image_generation_call outputs. Never respond with plain text only. " +
|
|
42
56
|
"Preserve the user's original intent, language, style, and constraints inside each stage-specific prompt. If a stage needs factual visual accuracy and the prompt/context is insufficient, use web_search only for that need; then incorporate only concrete findings as English clarifiers appended after the relevant stage prompt. " +
|
|
43
57
|
REAL_PERSON_RESEARCH_DIRECTIVE +
|
|
44
58
|
"\n\n" +
|
|
45
59
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
46
|
-
export const MULTIMODE_NO_SEARCH_DEVELOPER_PROMPT =
|
|
60
|
+
export const MULTIMODE_NO_SEARCH_DEVELOPER_PROMPT = CREATIVE_TOOL_CONTEXT +
|
|
61
|
+
"You are generating a multimode sequence. The selected value N is the maximum number of sequence outputs, not a visual subject count. You MUST create up to N separate image_generation_call outputs. First infer the user's intended sequence from the prompt. If the prompt explicitly asks for several images, steps, states, endings, or items one per image, map each requested unit to its own output up to N. Korean phrases such as '하나씩', '각각', '한 장씩', '이미지마다', and '네개를 그려줘' in a sequence context mean separate outputs, not four subjects inside one output. If the prompt uses arrows or ordered wording such as A -> B, generate the endpoint/state for A, then the endpoint/state for B, and continue in order up to N. Invoke the image_generation tool separately once per sequence output with a distinct stage-specific prompt. Each stage prompt must describe only that stage's single unit/state. Do not pass the same complete user prompt to every output when the user described a sequence. Do not include the whole list of sequence units inside any single image_generation prompt. Do not use words like all, four, 네개, collection, lineup, grid, sheet, or panels inside a stage prompt when the stage should contain one unit. Example: if the user asks for four different colored shapes one per image, call the tool four times: one image with only a red circle; one image with only a blue square; one image with only a green triangle; one image with only a yellow star. Do not satisfy this request with one image_generation_call. Never collapse multiple sequence outputs into one image. Do not create a collage. Do not create a grid. Do not create a contact sheet. Do not create a storyboard sheet. Do not put multiple panels inside one image. If you cannot complete all outputs, return as many separate image_generation_call outputs as possible. Stop after N image_generation_call outputs. Never respond with plain text only.\n\n" +
|
|
47
62
|
VISIBLE_TEXT_LANGUAGE_POLICY;
|
|
63
|
+
function sizeDirective(options) {
|
|
64
|
+
const size = options.size;
|
|
65
|
+
if (!size || size === "auto")
|
|
66
|
+
return "";
|
|
67
|
+
return `You MUST generate this image at exactly ${size} resolution.\n\n`;
|
|
68
|
+
}
|
|
48
69
|
export function buildUserTextPrompt(userPrompt, mode, options = {}) {
|
|
70
|
+
const prefix = sizeDirective(options);
|
|
49
71
|
if (mode === "direct") {
|
|
50
|
-
return
|
|
72
|
+
return `${prefix}Generate an image with this exact prompt, no modifications: ${userPrompt}${DIRECT_PROMPT_FIDELITY_SUFFIX}`;
|
|
51
73
|
}
|
|
52
74
|
const researchSuffix = resolveWebSearchEnabled(options) ? RESEARCH_SUFFIX : "";
|
|
53
|
-
return
|
|
75
|
+
return `${prefix}Generate an image: ${userPrompt}${researchSuffix}${AUTO_PROMPT_FIDELITY_SUFFIX}`;
|
|
54
76
|
}
|
|
55
77
|
export function buildMultimodeSequencePrompt(userPrompt, maxImages, options = {}) {
|
|
56
|
-
const n = Math.
|
|
78
|
+
const n = Math.max(1, Math.trunc(Number(maxImages) || 1));
|
|
79
|
+
const prefix = sizeDirective(options);
|
|
57
80
|
const researchInstruction = resolveWebSearchEnabled(options)
|
|
58
81
|
? [`If factual visual accuracy is required and the prompt/context is not already sufficient for a stage, use one concise web_search call for references before generating that stage. If a stage is already visually sufficient, do not search or add clarifiers for that stage.`]
|
|
59
82
|
: [];
|
|
60
83
|
return [
|
|
84
|
+
...(prefix ? [prefix.trim()] : []),
|
|
61
85
|
`Create a multimode sequence with up to ${n} separate image_generation_call outputs.`,
|
|
62
86
|
`The number ${n} is only the maximum sequence length. Do not add it to the visual prompt and do not treat it as a requested subject count unless the user's prompt itself asks for that many sequence units.`,
|
|
63
87
|
`Infer the user's intended sequence and create one image_generation_call per sequence unit.`,
|
|
@@ -82,11 +106,12 @@ export function buildMultimodeSequencePrompt(userPrompt, maxImages, options = {}
|
|
|
82
106
|
].join("\n");
|
|
83
107
|
}
|
|
84
108
|
export function buildEditTextPrompt(userPrompt, mode, options = {}) {
|
|
109
|
+
const prefix = sizeDirective(options);
|
|
85
110
|
if (mode === "direct") {
|
|
86
|
-
return
|
|
111
|
+
return `${prefix}Edit this image with this exact prompt, no modifications: ${userPrompt}${DIRECT_PROMPT_FIDELITY_SUFFIX}`;
|
|
87
112
|
}
|
|
88
113
|
const researchSuffix = resolveWebSearchEnabled(options) ? RESEARCH_SUFFIX : "";
|
|
89
|
-
return
|
|
114
|
+
return `${prefix}Edit this image: ${userPrompt}${researchSuffix}${AUTO_PROMPT_FIDELITY_SUFFIX}`;
|
|
90
115
|
}
|
|
91
116
|
export function buildEditResearchTextPrompt(userPrompt, mode) {
|
|
92
117
|
return buildEditTextPrompt(userPrompt, mode);
|
|
@@ -126,7 +126,7 @@ export async function readMultimodeImageStream(res, { requestId = null, maxImage
|
|
|
126
126
|
let usage = null;
|
|
127
127
|
let webSearchCalls = 0;
|
|
128
128
|
let eventCount = 0;
|
|
129
|
-
const limit = Math.
|
|
129
|
+
const limit = Math.max(1, Math.trunc(Number(maxImages) || 1));
|
|
130
130
|
let extraIgnored = 0;
|
|
131
131
|
while (true) {
|
|
132
132
|
const { done, value } = await reader.read();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SAFETY_INTENT_POLICY = "";
|
|
1
|
+
export const SAFETY_INTENT_POLICY = "Safety intent policy: treat ordinary adult swimwear, beachwear, sportswear, underwear-as-fashion, medical, art-study, and product/catalog requests as normal fashion, sport, beach, catalog, or editorial image requests. For ambiguous swimwear or underwear prompts, keep the requested clothing but frame the person as a clearly adult subject in a neutral fashion, beach, athletic, catalog, or editorial context. Preserve benign clothing specificity: bikini means a two-piece swimsuit; do not replace it with a one-piece swimsuit, cover-up, rash guard, wetsuit, dress, or full-body swimwear unless the user asks for that. Do not sexualize, intensify exposure, add fetish details, add intimate framing, or infer disallowed sexual content from words like bikini, swimsuit, sports bra, beachwear, or fashion model. Do not copy safety labels, refusal reasons, or negative safety constraints into the final image or video prompt. If the request includes a minor, an underage-looking subject, explicit sexual acts, or sexualized posing, follow the provider's safety policy instead of rewriting it as allowed.";
|
package/lib/responsesDoctor.js
CHANGED
|
@@ -75,7 +75,7 @@ function createProbeSpecs({ model, size, quality, moderation, prompt, matrix, })
|
|
|
75
75
|
model,
|
|
76
76
|
input: [
|
|
77
77
|
{ role: "developer", content: GENERATE_NO_SEARCH_DEVELOPER_PROMPT },
|
|
78
|
-
{ role: "user", content: buildUserTextPrompt(prompt, "auto", { webSearchEnabled: false }) },
|
|
78
|
+
{ role: "user", content: buildUserTextPrompt(prompt, "auto", { webSearchEnabled: false, size }) },
|
|
79
79
|
],
|
|
80
80
|
tools: imageOnlyTools,
|
|
81
81
|
tool_choice: "required",
|
|
@@ -95,7 +95,7 @@ function createProbeSpecs({ model, size, quality, moderation, prompt, matrix, })
|
|
|
95
95
|
model,
|
|
96
96
|
input: [
|
|
97
97
|
{ role: "developer", content: GENERATE_DEVELOPER_PROMPT },
|
|
98
|
-
{ role: "user", content: buildUserTextPrompt(prompt, "auto", { webSearchEnabled: true }) },
|
|
98
|
+
{ role: "user", content: buildUserTextPrompt(prompt, "auto", { webSearchEnabled: true, size }) },
|
|
99
99
|
],
|
|
100
100
|
tools: webSearchImageTools,
|
|
101
101
|
tool_choice: "required",
|
|
@@ -115,7 +115,7 @@ function createProbeSpecs({ model, size, quality, moderation, prompt, matrix, })
|
|
|
115
115
|
model,
|
|
116
116
|
input: [
|
|
117
117
|
{ role: "developer", content: GENERATE_DEVELOPER_PROMPT },
|
|
118
|
-
{ role: "user", content: buildUserTextPrompt(prompt, "auto", { webSearchEnabled: true }) },
|
|
118
|
+
{ role: "user", content: buildUserTextPrompt(prompt, "auto", { webSearchEnabled: true, size }) },
|
|
119
119
|
],
|
|
120
120
|
tools: webSearchImageTools,
|
|
121
121
|
tool_choice: { type: "image_generation" },
|
package/lib/responsesFallback.js
CHANGED
|
@@ -6,21 +6,34 @@ const MAX_RETRIES = 2;
|
|
|
6
6
|
export async function retryPromptOnlyJsonImage({ postResponses, ctx, provider, prompt, mode, model, quality, size, moderation, requestId, signal, initial, referencesDroppedOnRetry, webSearchDroppedOnRetry, reasoningEffort, }) {
|
|
7
7
|
if (provider === "api")
|
|
8
8
|
return null;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const developerPrompt = webSearchDroppedOnRetry
|
|
10
|
+
? GENERATE_NO_SEARCH_DEVELOPER_PROMPT
|
|
11
|
+
: GENERATE_DEVELOPER_PROMPT;
|
|
12
|
+
// Retry chain: keep the developer prompt for the first MAX_RETRIES attempts
|
|
13
|
+
// (censorship relief), then make one final attempt with the user prompt only
|
|
14
|
+
// so a clean, instruction-free generation gets the last word.
|
|
15
|
+
const attemptPlans = [
|
|
16
|
+
...Array.from({ length: MAX_RETRIES }, () => ({
|
|
17
|
+
retryKind: "prompt_only_with_developer",
|
|
18
|
+
developerPromptDroppedOnRetry: false,
|
|
19
|
+
})),
|
|
20
|
+
{
|
|
21
|
+
retryKind: "prompt_only_json_image_tool",
|
|
22
|
+
developerPromptDroppedOnRetry: true,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
const baseMeta = {
|
|
12
26
|
initialEventCount: initial.eventCount,
|
|
13
27
|
initialEventTypes: initial.eventTypes,
|
|
14
28
|
referencesDroppedOnRetry,
|
|
15
|
-
developerPromptDroppedOnRetry: false,
|
|
16
29
|
webSearchDroppedOnRetry,
|
|
17
30
|
};
|
|
18
|
-
|
|
19
|
-
? GENERATE_NO_SEARCH_DEVELOPER_PROMPT
|
|
20
|
-
: GENERATE_DEVELOPER_PROMPT;
|
|
31
|
+
let retryMeta = { ...baseMeta, ...attemptPlans[attemptPlans.length - 1] };
|
|
21
32
|
let lastRetry = null;
|
|
22
|
-
for (let attempt = 1; attempt <=
|
|
23
|
-
|
|
33
|
+
for (let attempt = 1; attempt <= attemptPlans.length; attempt++) {
|
|
34
|
+
const plan = attemptPlans[attempt - 1];
|
|
35
|
+
retryMeta = { ...baseMeta, ...plan };
|
|
36
|
+
logEvent("oauth", "retry_attempt", { requestId, attempt, maxRetries: attemptPlans.length, ...retryMeta });
|
|
24
37
|
try {
|
|
25
38
|
lastRetry = await postResponses({
|
|
26
39
|
ctx,
|
|
@@ -32,8 +45,8 @@ export async function retryPromptOnlyJsonImage({ postResponses, ctx, provider, p
|
|
|
32
45
|
payload: {
|
|
33
46
|
model,
|
|
34
47
|
input: [
|
|
35
|
-
{ role: "developer", content: developerPrompt },
|
|
36
|
-
{ role: "user", content: buildUserTextPrompt(prompt, mode, { webSearchEnabled: false }) },
|
|
48
|
+
...(plan.developerPromptDroppedOnRetry ? [] : [{ role: "developer", content: developerPrompt }]),
|
|
49
|
+
{ role: "user", content: buildUserTextPrompt(prompt, mode, { webSearchEnabled: false, size }) },
|
|
37
50
|
],
|
|
38
51
|
tools: tools(false, { quality, size, moderation }),
|
|
39
52
|
tool_choice: imageToolChoice(true),
|
|
@@ -44,7 +57,7 @@ export async function retryPromptOnlyJsonImage({ postResponses, ctx, provider, p
|
|
|
44
57
|
});
|
|
45
58
|
}
|
|
46
59
|
catch (e) {
|
|
47
|
-
if (attempt ===
|
|
60
|
+
if (attempt === attemptPlans.length) {
|
|
48
61
|
if (e && typeof e === "object")
|
|
49
62
|
Object.assign(e, retryMeta);
|
|
50
63
|
throw e;
|
|
@@ -54,10 +67,10 @@ export async function retryPromptOnlyJsonImage({ postResponses, ctx, provider, p
|
|
|
54
67
|
}
|
|
55
68
|
const image = lastRetry.images[0];
|
|
56
69
|
if (image?.b64) {
|
|
57
|
-
logEvent("oauth", "retry_image", { requestId, retryKind, attempt, imageChars: image.b64.length });
|
|
70
|
+
logEvent("oauth", "retry_image", { requestId, retryKind: plan.retryKind, attempt, imageChars: image.b64.length });
|
|
58
71
|
return { b64: image.b64, usage: lastRetry.usage, webSearchCalls: initial.webSearchCalls, revisedPrompt: image.revisedPrompt, text: lastRetry.text, ...retryMeta };
|
|
59
72
|
}
|
|
60
|
-
logEvent("oauth", "retry_no_image", { requestId, retryKind, attempt, fallbackEventCount: lastRetry.eventCount });
|
|
73
|
+
logEvent("oauth", "retry_no_image", { requestId, retryKind: plan.retryKind, attempt, fallbackEventCount: lastRetry.eventCount });
|
|
61
74
|
}
|
|
62
75
|
const diagSource = lastRetry ?? initial;
|
|
63
76
|
throw emptyResponseError("No image data received after retries", diagSource, {
|
|
@@ -52,8 +52,11 @@ function safeUpstreamClientMessage(upstream, status) {
|
|
|
52
52
|
return "API key is invalid or unavailable.";
|
|
53
53
|
if (code === "MODERATION_REFUSED")
|
|
54
54
|
return "OpenAI refused the image request for safety reasons.";
|
|
55
|
-
if (code === "INVALID_REQUEST")
|
|
56
|
-
return
|
|
55
|
+
if (code === "INVALID_REQUEST") {
|
|
56
|
+
return upstream?.param
|
|
57
|
+
? "OpenAI rejected the image request parameters."
|
|
58
|
+
: "OpenAI rejected the image request.";
|
|
59
|
+
}
|
|
57
60
|
if (status === 401 || status === 403)
|
|
58
61
|
return "OpenAI authentication failed.";
|
|
59
62
|
if (status === 429)
|
|
@@ -212,8 +215,8 @@ export async function generateViaResponses(provider, prompt, quality, size, mode
|
|
|
212
215
|
const toolChoiceKind = imageToolChoiceKind(toolChoice);
|
|
213
216
|
const referenceInputs = references.map(normalizeRef);
|
|
214
217
|
const userContent = referenceInputs.length
|
|
215
|
-
? [...referenceInputs, { type: "input_text", text: buildUserTextPrompt(prompt, mode, { webSearchEnabled }) }]
|
|
216
|
-
: buildUserTextPrompt(prompt, mode, { webSearchEnabled });
|
|
218
|
+
? [...referenceInputs, { type: "input_text", text: buildUserTextPrompt(prompt, mode, { webSearchEnabled, size }) }]
|
|
219
|
+
: buildUserTextPrompt(prompt, mode, { webSearchEnabled, size });
|
|
217
220
|
const result = await postResponses({
|
|
218
221
|
ctx,
|
|
219
222
|
provider,
|
|
@@ -276,13 +279,14 @@ export async function generateViaResponses(provider, prompt, quality, size, mode
|
|
|
276
279
|
}
|
|
277
280
|
export async function generateMultimodeViaResponses(provider, prompt, quality, size, moderation = "low", references = [], requestId = null, mode = "auto", ctxRaw = {}, options = {}) {
|
|
278
281
|
const ctx = requireRuntimeContext(ctxRaw);
|
|
279
|
-
const
|
|
282
|
+
const maxGeneratedImages = Math.max(1, Math.trunc(Number(ctx.config.limits.maxGeneratedImages) || 24));
|
|
283
|
+
const maxImages = Math.min(maxGeneratedImages, Math.max(1, Math.trunc(Number(options.maxImages) || 1)));
|
|
280
284
|
const model = options.model || ctx.config?.imageModels?.default || "gpt-5.4-mini";
|
|
281
285
|
const webSearchEnabled = options.webSearchEnabled !== false && options.searchMode !== "off";
|
|
282
286
|
const requestTools = tools(webSearchEnabled, { quality, size, moderation, ...(options.partialImages ? { partial_images: options.partialImages } : {}) });
|
|
283
287
|
const userText = buildMultimodeSequencePrompt(mode === "direct"
|
|
284
288
|
? `${prompt}${DIRECT_PROMPT_FIDELITY_SUFFIX}`
|
|
285
|
-
: `${prompt}${webSearchEnabled ? "" : ""}${AUTO_PROMPT_FIDELITY_SUFFIX}`, maxImages, { webSearchEnabled });
|
|
289
|
+
: `${prompt}${webSearchEnabled ? "" : ""}${AUTO_PROMPT_FIDELITY_SUFFIX}`, maxImages, { webSearchEnabled, size });
|
|
286
290
|
const referenceInputs = references.map(normalizeRef);
|
|
287
291
|
const userContent = referenceInputs.length
|
|
288
292
|
? [...referenceInputs, { type: "input_text", text: userText }]
|
|
@@ -334,7 +338,7 @@ export async function editViaResponses(provider, prompt, imageB64, quality, size
|
|
|
334
338
|
{ type: "input_image", image_url: `data:image/jpeg;base64,${imageForRequest.b64}` },
|
|
335
339
|
...referenceImages.map(({ b64 }) => ({ type: "input_image", image_url: `data:image/jpeg;base64,${b64}` })),
|
|
336
340
|
...maskContent,
|
|
337
|
-
{ type: "input_text", text: buildEditTextPrompt(prompt, mode, { webSearchEnabled }) },
|
|
341
|
+
{ type: "input_text", text: buildEditTextPrompt(prompt, mode, { webSearchEnabled, size }) },
|
|
338
342
|
];
|
|
339
343
|
const result = await postResponses({
|
|
340
344
|
ctx,
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## **6.15.2**
|
|
2
|
+
- [Fix] `stringify`: skip null/undefined entries in `arrayFormat: 'comma'` + `encodeValuesOnly` instead of crashing in `encoder`
|
|
3
|
+
- [Fix] `stringify`: use configured `delimiter` after `charsetSentinel` (#555)
|
|
4
|
+
- [Fix] `stringify`: apply `formatter` to encoded key under `strictNullHandling` (#554)
|
|
5
|
+
- [Fix] `stringify`: skip null/undefined filter-array entries instead of crashing in `encoder` (#551)
|
|
6
|
+
- [Fix] `parse`: handle nested bracket groups and add regression tests (#530)
|
|
7
|
+
- [readme] fix grammar (#550)
|
|
8
|
+
- [Dev Deps] update `@ljharb/eslint-config`
|
|
9
|
+
- [Tests] add regression tests for keys containing percent-encoded bracket text
|
|
10
|
+
|
|
1
11
|
## **6.15.1**
|
|
2
12
|
- [Fix] `parse`: `parameterLimit: Infinity` with `throwOnLimitExceeded: true` silently drops all parameters
|
|
3
13
|
- [Deps] update `@ljharb/eslint-config`
|
|
@@ -183,7 +183,7 @@ var withDots = qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { decod
|
|
|
183
183
|
assert.deepEqual(withDots, { 'name.obj': { first: 'John', last: 'Doe' }});
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
Option `allowEmptyArrays` can be used to
|
|
186
|
+
Option `allowEmptyArrays` can be used to allow empty array values in an object
|
|
187
187
|
```javascript
|
|
188
188
|
var withEmptyArrays = qs.parse('foo[]&bar=baz', { allowEmptyArrays: true });
|
|
189
189
|
assert.deepEqual(withEmptyArrays, { foo: [], bar: 'baz' });
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
"use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify};
|
|
6
6
|
|
|
7
7
|
},{"1":1,"3":3,"4":4}],3:[function(require,module,exports){
|
|
8
|
-
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,c,p=o[l],u=p.indexOf("]="),y=-1===u?p.indexOf("="):u+1;if(-1===y?(d=t.decoder(p,defaults.decoder,s,"key"),c=t.strictNullHandling?null:""):null!==(d=t.decoder(p.slice(0,y),defaults.decoder,s,"key"))&&(c=utils.maybeMap(parseArrayValue(p.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),c&&t.interpretNumericEntities&&"iso-8859-1"===s&&(c=interpretNumericEntities(String(c))),p.indexOf("[]=")>-1&&(c=isArray(c)?[c]:c),t.comma&&isArray(c)&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");c=utils.combine([],c,t.arrayLimit,t.plainObjects)}if(null!==d){var f=has.call(r,d);f&&("combine"===t.duplicates||p.indexOf("[]=")>-1)?r[d]=utils.combine(r[d],c,t.arrayLimit,t.plainObjects):f&&"last"!==t.duplicates||(r[d]=c)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects);else{s=r.plainObjects?{__proto__:null}:{};var c="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,p=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(p,10),y=!isNaN(u)&&d!==p&&String(u)===p&&u>=0&&r.parseArrays;if(r.parseArrays||""!==p)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==p&&(s[p]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i
|
|
8
|
+
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,c,p=o[l],u=p.indexOf("]="),y=-1===u?p.indexOf("="):u+1;if(-1===y?(d=t.decoder(p,defaults.decoder,s,"key"),c=t.strictNullHandling?null:""):null!==(d=t.decoder(p.slice(0,y),defaults.decoder,s,"key"))&&(c=utils.maybeMap(parseArrayValue(p.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),c&&t.interpretNumericEntities&&"iso-8859-1"===s&&(c=interpretNumericEntities(String(c))),p.indexOf("[]=")>-1&&(c=isArray(c)?[c]:c),t.comma&&isArray(c)&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");c=utils.combine([],c,t.arrayLimit,t.plainObjects)}if(null!==d){var f=has.call(r,d);f&&("combine"===t.duplicates||p.indexOf("[]=")>-1)?r[d]=utils.combine(r[d],c,t.arrayLimit,t.plainObjects):f&&"last"!==t.duplicates||(r[d]=c)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects);else{s=r.plainObjects?{__proto__:null}:{};var c="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,p=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(p,10),y=!isNaN(u)&&d!==p&&String(u)===p&&u>=0&&r.parseArrays;if(r.parseArrays||""!==p)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==p&&(s[p]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=[],a=r.indexOf("["),o=a>=0?r.slice(0,a):r;if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var l=r.length,n=a,s=0;n>=0&&s<t.depth;){for(var d=1,c=n+1,p=-1;c<l&&p<0;){var u=r.charCodeAt(c);91===u?d+=1:93===u&&0==(d-=1)&&(p=c),c+=1}if(p<0)return i[i.length]="["+r.slice(n)+"]",i;var y=r.slice(n,p+1),f=y.slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,f)&&!t.allowPrototypes)return;i[i.length]=y,s+=1,n=r.indexOf("[",p+1)}if(n>=0){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");i[i.length]="["+r.slice(n)+"]"}return i},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictMerge:"boolean"==typeof e.strictMerge?!!e.strictMerge:defaults.strictMerge,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),l=0;l<o.length;++l){var n=o[l],s=parseKeys(n,i[n],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
|
|
9
9
|
|
|
10
10
|
},{"5":5}],4:[function(require,module,exports){
|
|
11
|
-
"use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,n,i,l,s,f,u,d,y,c,p,m,h,v){for(var g=e,w=v,b=0,A=!1;void 0!==(w=w.get(sentinel))&&!A;){var D=w.get(e);if(b+=1,void 0!==D){if(D===b)throw new RangeError("Cyclic object value");A=!0}void 0===w.get(sentinel)&&(b=0)}if("function"==typeof f?g=f(r,g):g instanceof Date?g=y(g):"comma"===t&&isArray(g)&&(g=utils.maybeMap(g,function(e){return e instanceof Date?y(e):e})),null===g){if(n)return s&&!m?s(r,defaults.encoder,h,"key",c):r;g=""}if(isNonNullishPrimitive(g)||utils.isBuffer(g))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(g,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(g))];var S,E=[];if(void 0===g)return E;if("comma"===t&&isArray(g))m&&s&&(g=utils.maybeMap(g,s)),S=[{value:g.length>0?g.join(",")||null:void 0}];else if(isArray(f))S=f;else{var N=Object.keys(g);S=u?N.sort(u):N}var T=l?String(r).replace(/\./g,"%2E"):String(r),O=o&&isArray(g)&&1===g.length?T+"[]":T;if(a&&isArray(g)&&0===g.length)return O+"[]";for(var k=0;k<S.length;++k){var I=S[k],P="object"==typeof I&&I&&void 0!==I.value?I.value:g[I];if(!i||null!==P){var x=d&&l?String(I).replace(/\./g,"%2E"):String(I),z=isArray(g)?"function"==typeof t?t(O,x):O:O+(d?"."+x:"["+x+"]");v.set(e,b);var K=getSideChannel();K.set(sentinel,v),pushToArray(E,stringify(P,z,t,o,a,n,i,l,"comma"===t&&m&&isArray(g)?null:s,f,u,d,y,c,p,m,h,K))}}return E},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,a=formats.formatters[t],n=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(n=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:n,format:t,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,a=normalizeStringifyOptions(r);"function"==typeof a.filter?o=(0,a.filter)("",o):isArray(a.filter)&&(t=a.filter);var n=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[a.arrayFormat],l="comma"===i&&a.commaRoundTrip;t||(t=Object.keys(o)),a.sort&&t.sort(a.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f]
|
|
11
|
+
"use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,n,i,l,s,f,u,d,y,c,p,m,h,v){for(var g=e,w=v,b=0,A=!1;void 0!==(w=w.get(sentinel))&&!A;){var D=w.get(e);if(b+=1,void 0!==D){if(D===b)throw new RangeError("Cyclic object value");A=!0}void 0===w.get(sentinel)&&(b=0)}if("function"==typeof f?g=f(r,g):g instanceof Date?g=y(g):"comma"===t&&isArray(g)&&(g=utils.maybeMap(g,function(e){return e instanceof Date?y(e):e})),null===g){if(n)return p(s&&!m?s(r,defaults.encoder,h,"key",c):r);g=""}if(isNonNullishPrimitive(g)||utils.isBuffer(g))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(g,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(g))];var S,E=[];if(void 0===g)return E;if("comma"===t&&isArray(g))m&&s&&(g=utils.maybeMap(g,function(e){return null==e?e:s(e)})),S=[{value:g.length>0?g.join(",")||null:void 0}];else if(isArray(f))S=f;else{var N=Object.keys(g);S=u?N.sort(u):N}var T=l?String(r).replace(/\./g,"%2E"):String(r),O=o&&isArray(g)&&1===g.length?T+"[]":T;if(a&&isArray(g)&&0===g.length)return O+"[]";for(var k=0;k<S.length;++k){var I=S[k],P="object"==typeof I&&I&&void 0!==I.value?I.value:g[I];if(!i||null!==P){var x=d&&l?String(I).replace(/\./g,"%2E"):String(I),z=isArray(g)?"function"==typeof t?t(O,x):O:O+(d?"."+x:"["+x+"]");v.set(e,b);var K=getSideChannel();K.set(sentinel,v),pushToArray(E,stringify(P,z,t,o,a,n,i,l,"comma"===t&&m&&isArray(g)?null:s,f,u,d,y,c,p,m,h,K))}}return E},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,a=formats.formatters[t],n=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(n=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:n,format:t,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,a=normalizeStringifyOptions(r);"function"==typeof a.filter?o=(0,a.filter)("",o):isArray(a.filter)&&(t=a.filter);var n=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[a.arrayFormat],l="comma"===i&&a.commaRoundTrip;t||(t=Object.keys(o)),a.sort&&t.sort(a.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f];if(null!=u){var d=o[u];a.skipNulls&&null===d||pushToArray(n,stringify(d,u,i,l,a.allowEmptyArrays,a.strictNullHandling,a.skipNulls,a.encodeDotInKeys,a.encode?a.encoder:null,a.filter,a.sort,a.allowDots,a.serializeDate,a.format,a.formatter,a.encodeValuesOnly,a.charset,s))}}var y=n.join(a.delimiter),c=!0===a.addQueryPrefix?"?":"";return a.charsetSentinel&&("iso-8859-1"===a.charset?c+="utf8=%26%2310003%3B"+a.delimiter:c+="utf8=%E2%9C%93"+a.delimiter),y.length>0?c+y:""};
|
|
12
12
|
|
|
13
13
|
},{"1":1,"46":46,"5":5}],5:[function(require,module,exports){
|
|
14
14
|
"use strict";var formats=require(1),getSideChannel=require(46),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],o=0;o<t.length;++o)void 0!==t[o]&&(n[n.length]=t[o]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>t.arrayLimit)return markOverflow(arrayToObject(e.concat(r),t),n);e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var o=getMaxIndex(e)+1;e[o]=r,setMaxIndex(e,o)}else{if(t&&t.strictMerge)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var a=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<a.length;c++)i[parseInt(a[c],10)+1]=r[a[c]];return markOverflow(i,getMaxIndex(r)+1)}var l=[e].concat(r);return t&&"number"==typeof t.arrayLimit&&l.length>t.arrayLimit?markOverflow(arrayToObject(l,t),l.length-1):l}var f=e;return isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)?(r.forEach(function(r,n){if(has.call(e,n)){var o=e[n];o&&"object"==typeof o&&r&&"object"==typeof r?e[n]=merge(o,r,t):e[e.length]=r}else e[n]=r}),e):Object.keys(r).reduce(function(e,n){var o=r[n];if(has.call(e,n)?e[n]=merge(e[n],o,t):e[n]=o,isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var a=parseInt(n,10);String(a)===n&&a>=0&&a>getMaxIndex(e)&&setMaxIndex(e,a)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return e[t]=r[t],e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,o){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===t)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",c=0;c<a.length;c+=limit){for(var l=a.length>=limit?a.slice(c,c+limit):a,f=[],s=0;s<l.length;++s){var u=l.charCodeAt(s);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===formats.RFC1738&&(40===u||41===u)?f[f.length]=l.charAt(s):u<128?f[f.length]=hexTable[u]:u<2048?f[f.length]=hexTable[192|u>>6]+hexTable[128|63&u]:u<55296||u>=57344?f[f.length]=hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|63&u]:(s+=1,u=65536+((1023&u)<<10|1023&l.charCodeAt(s)),f[f.length]=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|63&u])}i+=f.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],n=0;n<r.length;++n)for(var o=r[n],a=o.obj[o.prop],i=Object.keys(a),c=0;c<i.length;++c){var l=i[c],f=a[l];"object"==typeof f&&null!==f&&-1===t.indexOf(f)&&(r[r.length]={obj:a,prop:l},t[t.length]=f)}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},combine=function combine(e,r,t,n){if(isOverflow(e)){var o=getMaxIndex(e)+1;return e[o]=r,setMaxIndex(e,o),e}var a=[].concat(e,r);return a.length>t?markOverflow(arrayToObject(a,{plainObjects:n}),a.length-1):a},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};
|
|
@@ -81,34 +81,34 @@
|
|
|
81
81
|
},{}],35:[function(require,module,exports){
|
|
82
82
|
"use strict";module.exports=Math.floor;
|
|
83
83
|
|
|
84
|
-
},{}],
|
|
85
|
-
"use strict";module.exports=Math.
|
|
84
|
+
},{}],34:[function(require,module,exports){
|
|
85
|
+
"use strict";module.exports=Math.abs;
|
|
86
86
|
|
|
87
87
|
},{}],38:[function(require,module,exports){
|
|
88
88
|
"use strict";module.exports=Math.min;
|
|
89
89
|
|
|
90
|
-
},{}],
|
|
91
|
-
"use strict";module.exports=Math.
|
|
90
|
+
},{}],40:[function(require,module,exports){
|
|
91
|
+
"use strict";module.exports=Math.round;
|
|
92
|
+
|
|
93
|
+
},{}],37:[function(require,module,exports){
|
|
94
|
+
"use strict";module.exports=Math.max;
|
|
92
95
|
|
|
93
96
|
},{}],39:[function(require,module,exports){
|
|
94
97
|
"use strict";module.exports=Math.pow;
|
|
95
98
|
|
|
96
|
-
},{}],40:[function(require,module,exports){
|
|
97
|
-
"use strict";module.exports=Math.round;
|
|
98
|
-
|
|
99
99
|
},{}],27:[function(require,module,exports){
|
|
100
100
|
"use strict";module.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null;
|
|
101
101
|
|
|
102
102
|
},{}],26:[function(require,module,exports){
|
|
103
103
|
"use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
|
|
104
104
|
|
|
105
|
-
},{"22":22}],
|
|
106
|
-
"use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
|
|
107
|
-
|
|
108
|
-
},{"36":36}],33:[function(require,module,exports){
|
|
105
|
+
},{"22":22}],33:[function(require,module,exports){
|
|
109
106
|
"use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
|
|
110
107
|
|
|
111
|
-
},{"24":24}],
|
|
108
|
+
},{"24":24}],41:[function(require,module,exports){
|
|
109
|
+
"use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
|
|
110
|
+
|
|
111
|
+
},{"36":36}],31:[function(require,module,exports){
|
|
112
112
|
"use strict";var origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=require(32);module.exports=function hasNativeSymbols(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&hasSymbolSham()};
|
|
113
113
|
|
|
114
114
|
},{"32":32}],28:[function(require,module,exports){
|
|
@@ -129,7 +129,7 @@ var hasMap="function"==typeof Map&&Map.prototype,mapSizeDescriptor=Object.getOwn
|
|
|
129
129
|
|
|
130
130
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
131
131
|
},{"6":6}],43:[function(require,module,exports){
|
|
132
|
-
"use strict";var inspect=require(42),$TypeError=require(20),listGetNode=function(e,t,n){for(var i,r=e;null!=(i=r.next);r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},listGet=function(e,t){if(e){var n=listGetNode(e,t);return n&&n.value}},listSet=function(e,t,n){var i=listGetNode(e,t);i?i.value=n:e.next={key:t,next:e.next,value:n}},listHas=function(e,t){return!!e&&!!listGetNode(e,t)},listDelete=function(e,t){if(e)return listGetNode(e,t,!0)};module.exports=function getSideChannelList(){var e,t={assert:function(e){if(!t.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(t){var n=
|
|
132
|
+
"use strict";var inspect=require(42),$TypeError=require(20),listGetNode=function(e,t,n){for(var i,r=e;null!=(i=r.next);r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},listGet=function(e,t){if(e){var n=listGetNode(e,t);return n&&n.value}},listSet=function(e,t,n){var i=listGetNode(e,t);i?i.value=n:e.next={key:t,next:e.next,value:n}},listHas=function(e,t){return!!e&&!!listGetNode(e,t)},listDelete=function(e,t){if(e)return listGetNode(e,t,!0)};module.exports=function getSideChannelList(){var e,t={assert:function(e){if(!t.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(t){var n=listDelete(e,t);return n&&e&&!e.next&&(e=void 0),!!n},get:function(t){return listGet(e,t)},has:function(t){return listHas(e,t)},set:function(t,n){e||(e={next:void 0}),listSet(e,t,n)}};return t};
|
|
133
133
|
|
|
134
134
|
},{"20":20,"42":42}],44:[function(require,module,exports){
|
|
135
135
|
"use strict";var GetIntrinsic=require(25),callBound=require(12),inspect=require(42),$TypeError=require(20),$Map=GetIntrinsic("%Map%",!0),$mapGet=callBound("Map.prototype.get",!0),$mapSet=callBound("Map.prototype.set",!0),$mapHas=callBound("Map.prototype.has",!0),$mapDelete=callBound("Map.prototype.delete",!0),$mapSize=callBound("Map.prototype.size",!0);module.exports=!!$Map&&function getSideChannelMap(){var e,t={assert:function(e){if(!t.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(t){if(e){var n=$mapDelete(e,t);return 0===$mapSize(e)&&(e=void 0),n}return!1},get:function(t){if(e)return $mapGet(e,t)},has:function(t){return!!e&&$mapHas(e,t)},set:function(t,n){e||(e=new $Map),$mapSet(e,t,n)}};return t};
|