@pen.dev/cli 0.3.6 → 0.3.8

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.
Files changed (69) hide show
  1. package/README.md +29 -5
  2. package/dist/browserAll-D_luQzBO.mjs +2 -0
  3. package/dist/dist-CbU0Evuc.mjs +4 -0
  4. package/dist/{esm-Dupm_ZuQ.mjs → esm-DBgQcoAH.mjs} +1 -1
  5. package/dist/index.mjs +2 -2
  6. package/dist/node_modules/@highagency/pencil-wasm/enums.gen.d.ts +44 -0
  7. package/dist/node_modules/@highagency/pencil-wasm/package.json +1 -1
  8. package/dist/node_modules/@highagency/pencil-wasm/pencil.d.ts +22 -6
  9. package/dist/node_modules/@highagency/pencil-wasm/pencil.js +1 -1
  10. package/dist/node_modules/@highagency/pencil-wasm/pencil.wasm +0 -0
  11. package/dist/out/mcp-server-darwin-arm64 +0 -0
  12. package/dist/out/mcp-server-darwin-x64 +0 -0
  13. package/dist/out/mcp-server-linux-arm64 +0 -0
  14. package/dist/out/mcp-server-linux-x64 +0 -0
  15. package/dist/out/mcp-server-windows-arm64.exe +0 -0
  16. package/dist/out/mcp-server-windows-x64.exe +0 -0
  17. package/dist/out/skills/pen-dev/SKILL.md +1 -0
  18. package/dist/out/skills/pen-dev/execute.md +10 -73
  19. package/dist/out/skills/pen-dev/generate.md +124 -0
  20. package/dist/out/skills/pen-dev/pen-schema.md +15 -2
  21. package/dist/webworkerAll-BPqqt3nL.mjs +2 -0
  22. package/package.json +5 -3
  23. package/dist/anthropic-messages-xcJLXjiT.mjs +0 -40
  24. package/dist/azure-openai-responses-CoA9_5_J.mjs +0 -2
  25. package/dist/browserAll-8jKh1NRi.mjs +0 -2
  26. package/dist/deferred-tools-CozAnCQL.mjs +0 -2
  27. package/dist/diagnostics-B0j2bfEp.mjs +0 -2
  28. package/dist/dist-BnoSGZKP.mjs +0 -10
  29. package/dist/dist-CMxAZjfo.mjs +0 -1581
  30. package/dist/dist-L3CkgNK3.mjs +0 -4
  31. package/dist/error-body-BBlqjbe7.mjs +0 -2
  32. package/dist/from-py2TfO8m.mjs +0 -15
  33. package/dist/github-copilot-headers-DCj7hJoC.mjs +0 -2
  34. package/dist/google-generative-ai-CFHCNDEQ.mjs +0 -2
  35. package/dist/google-shared-DolBdAGX.mjs +0 -318
  36. package/dist/google-vertex-tT_ymu8S.mjs +0 -2
  37. package/dist/hash-DNYCELl4.mjs +0 -2
  38. package/dist/headers-DlpC0ues.mjs +0 -2
  39. package/dist/json-parse-BzRcyI3e.mjs +0 -4
  40. package/dist/lib-EA7A-_Pc.mjs +0 -9
  41. package/dist/mistral-conversations-BryMfnnw.mjs +0 -5
  42. package/dist/models-BBd5zwn6.mjs +0 -2
  43. package/dist/multipart-parser-DX5ZDxQv.mjs +0 -3
  44. package/dist/openai-CbFQ5q5I.mjs +0 -18
  45. package/dist/openai-codex-responses-BIh-ZL5a.mjs +0 -8
  46. package/dist/openai-completions-DKf2R9kY.mjs +0 -6
  47. package/dist/openai-prompt-cache-tVHrB8oW.mjs +0 -2
  48. package/dist/openai-responses-DKbl253t.mjs +0 -2
  49. package/dist/openai-responses-shared-Brqyk2bc.mjs +0 -11
  50. package/dist/openrouter-images-C8mOFqx9.mjs +0 -2
  51. package/dist/photon_rs-o0nbTM4F.mjs +0 -2
  52. package/dist/pi-messages-CucvyzBS.mjs +0 -8
  53. package/dist/provider-env-CL5ShLlj.mjs +0 -2
  54. package/dist/provider-retry-GaV_ioT7.mjs +0 -2
  55. package/dist/sanitize-unicode-D-15laVS.mjs +0 -2
  56. package/dist/src-B_lvnEtX.mjs +0 -4
  57. package/dist/transform-messages-1ulTEFY1.mjs +0 -2
  58. package/dist/typescript-D0uAMumm.mjs +0 -6
  59. package/dist/uuid-CwuSNv96.mjs +0 -2
  60. package/dist/webworkerAll-BD-7VH16.mjs +0 -2
  61. /package/dist/{emscripten-module.browser-F76W5DM6-CNibWX-6.mjs → emscripten-module.browser-F76W5DM6-CQ3fNT5V.mjs} +0 -0
  62. /package/dist/{emscripten-module.browser-XIKQQPVU-BNfdGnMe.mjs → emscripten-module.browser-XIKQQPVU-C295tmz_.mjs} +0 -0
  63. /package/dist/{ffi-BuJ13coi.mjs → ffi-CUJpv82f.mjs} +0 -0
  64. /package/dist/{ffi-C5tLdQO9.mjs → ffi-Cplg1Nas.mjs} +0 -0
  65. /package/dist/{html-GGJ1fTRB.mjs → html-BzzLf-XM.mjs} +0 -0
  66. /package/dist/{init-B9LSomNH.mjs → init-B5EVeDge.mjs} +0 -0
  67. /package/dist/{module-ES6BEMUI-DwQ9nTMF.mjs → module-ES6BEMUI-2G5oIxui.mjs} +0 -0
  68. /package/dist/{module-asyncify-2EFITU5U-B54Mkt6K.mjs → module-asyncify-2EFITU5U-CqIYQibj.mjs} +0 -0
  69. /package/dist/{standalone-DYT2Zg6I.mjs → standalone-BxPYxoeE.mjs} +0 -0
package/README.md CHANGED
@@ -30,7 +30,7 @@ Creates a new account. You'll receive a verification email — click the link, t
30
30
  pen login
31
31
  ```
32
32
 
33
- This starts an interactive session where you choose your login method (email + password or email + OTP code). On success the session token is stored in `~/.pencil/session-cli.json`.
33
+ This starts an interactive session where you choose your login method (browser on pen.dev, email + password, or email + OTP). Browser sign-in opens pen.dev for consent, then asks you to paste a one-time code into the CLI. On success the session token is stored in `~/.pencil/session-cli.json`.
34
34
 
35
35
  ### Non-Interactive Login
36
36
 
@@ -62,6 +62,20 @@ pen status
62
62
 
63
63
  Displays the current authentication method, verifies the session with the backend, and shows account details (email, name, organization for CLI keys).
64
64
 
65
+ ### Codex (ChatGPT) Login
66
+
67
+ ```bash
68
+ pen codex-login
69
+ ```
70
+
71
+ Signs in to OpenAI Codex with your ChatGPT Plus/Pro account so the `codex` agent (`--agent codex` or any `gpt-*` model) can run. Choose browser login, or device-code login for headless machines. The credential is stored in `~/.pencil/agent-auth`. Alternatively set `PEN_AGENT_API_KEY` to use an API key instead.
72
+
73
+ ```bash
74
+ pen codex-logout
75
+ ```
76
+
77
+ Removes the stored OpenAI Codex credential.
78
+
65
79
  ## Quick Start
66
80
 
67
81
  ```bash
@@ -91,7 +105,7 @@ pen [command] [options]
91
105
 
92
106
  Commands:
93
107
  signup Create a new account (flags required, see below)
94
- login Log in interactively (email + password or OTP)
108
+ login Log in interactively (browser, email + password, or OTP)
95
109
  status Check authentication status
96
110
  version Show CLI version
97
111
  interactive Start an interactive tool shell (see below)
@@ -222,12 +236,22 @@ PNG/JPEG/WEBP/PDF images and HTML output.
222
236
 
223
237
  ### Image Generation
224
238
 
225
- The `execute` `Generate()` operation supports both AI-generated and stock images. Generated images are saved to an `images/` directory alongside the output `.pen` file.
239
+ The `execute` `Generate()` operation brings images and vector artwork into the
240
+ document, either from a prompt or by transforming an image the document already
241
+ has. Generated images are saved to an `images/` directory alongside the output
242
+ `.pen` file.
226
243
 
227
244
  | Type | Description |
228
245
  |------|-------------|
229
- | `Generate(nodeId, "ai", prompt)` | AI-generated image from a text prompt |
230
- | `Generate(nodeId, "stock", keywords)` | Stock photo from Unsplash |
246
+ | `Generate("ai", nodeId, prompt)` | AI-generated image from a text prompt |
247
+ | `Generate("stock", nodeId, keywords)` | Stock photo from Unsplash |
248
+ | `Generate("svg", frameId, prompt)` | Vector artwork drawn into the frame |
249
+ | `Generate("vectorize-image", frameId, imageUrl)` | Traces an existing image into vector paths inside the frame |
250
+ | `Generate("remove-background", imageUrl)` | Returns the url of a transparent cutout of the subject |
251
+ | `Generate("replace-background", imageUrl, prompt)` | Returns the url of the subject composed onto a described background |
252
+
253
+ The two `*-background` types write nothing themselves - apply the url they
254
+ return with `Update(nodeId, {fill: {type: "image", url}})`.
231
255
 
232
256
  ### Guidelines
233
257
 
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{A as e,C as t,O as n,S as r,j as i,k as a,w as o}from"./index.mjs";import"./init-B5EVeDge.mjs";i.add(a),i.mixin(e,n),i.add(t),i.mixin(e,r),i.add(o);export{};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{promises as e,statSync as t}from"fs";import n from"path";import{createRequire as r}from"module";import i from"os";import{spawn as a}from"child_process";import o from"readline";async function s(t){if(t===void 0)return{cleanup:async()=>{}};if(!c(t))throw Error(`outputSchema must be a plain JSON object`);let r=await e.mkdtemp(n.join(i.tmpdir(),`codex-output-schema-`)),a=n.join(r,`schema.json`),o=async()=>{try{await e.rm(r,{recursive:!0,force:!0})}catch{}};try{return await e.writeFile(a,JSON.stringify(t),`utf8`),{schemaPath:a,cleanup:o}}catch(e){throw await o(),e}}function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var l=class{_exec;_options;_id;_threadOptions;get id(){return this._id}constructor(e,t,n,r=null){this._exec=e,this._options=t,this._id=r,this._threadOptions=n}async runStreamed(e,t={}){return{events:this.runStreamedInternal(e,t)}}async*runStreamedInternal(e,t={}){let{schemaPath:n,cleanup:r}=await s(t.outputSchema),i=this._threadOptions,{prompt:a,images:o}=u(e),c=this._exec.run({input:a,baseUrl:this._options.baseUrl,apiKey:this._options.apiKey,threadId:this._id,images:o,model:i?.model,threadSource:i?.threadSource,sandboxMode:i?.sandboxMode,workingDirectory:i?.workingDirectory,skipGitRepoCheck:i?.skipGitRepoCheck,outputSchemaFile:n,modelReasoningEffort:i?.modelReasoningEffort,signal:t.signal,networkAccessEnabled:i?.networkAccessEnabled,webSearchMode:i?.webSearchMode,webSearchEnabled:i?.webSearchEnabled,approvalPolicy:i?.approvalPolicy,additionalDirectories:i?.additionalDirectories});try{for await(let e of c){let t;try{t=JSON.parse(e)}catch(t){throw Error(`Failed to parse item: ${e}`,{cause:t})}t.type===`thread.started`?this._id=t.thread_id:t.type===`turn.completed`&&(t.usage.cache_write_input_tokens??=0),yield t}}finally{await r()}}async run(e,t={}){let n=this.runStreamedInternal(e,t),r=[],i=``,a=null,o=null;for await(let e of n)if(e.type===`item.completed`)e.item.type===`agent_message`&&(i=e.item.text),r.push(e.item);else if(e.type===`turn.completed`)a=e.usage;else if(e.type===`turn.failed`){o=e.error;break}if(o)throw Error(o.message);return{items:r,finalResponse:i,usage:a}}};function u(e){if(typeof e==`string`)return{prompt:e,images:[]};let t=[],n=[];for(let r of e)r.type===`text`?t.push(r.text):r.type===`local_image`&&n.push(r.path);return{prompt:t.join(`
3
+
4
+ `),images:n}}var d=`CODEX_INTERNAL_ORIGINATOR_OVERRIDE`,f=`codex_sdk_ts`,p=`@openai/codex`,m={"x86_64-unknown-linux-musl":`@openai/codex-linux-x64`,"aarch64-unknown-linux-musl":`@openai/codex-linux-arm64`,"x86_64-apple-darwin":`@openai/codex-darwin-x64`,"aarch64-apple-darwin":`@openai/codex-darwin-arm64`,"x86_64-pc-windows-msvc":`@openai/codex-win32-x64`,"aarch64-pc-windows-msvc":`@openai/codex-win32-arm64`},h=r(import.meta.url),g=class{executablePath;pathDirs;envOverride;configOverrides;rawConfigOverrides;constructor(e=null,t,n,r){if(e)this.executablePath=e,this.pathDirs=[];else{let e=C();this.executablePath=e.executablePath,this.pathDirs=e.pathDirs}this.envOverride=t,this.configOverrides=n,this.rawConfigOverrides=r}async*run(e){let t=[`exec`,`--experimental-json`];if(this.configOverrides)for(let e of _(this.configOverrides))t.push(`--config`,e);if(this.rawConfigOverrides)for(let e of this.rawConfigOverrides)t.push(`--config`,e);if(e.baseUrl&&t.push(`--config`,`openai_base_url=${y(e.baseUrl,`openai_base_url`)}`),e.model&&t.push(`--model`,e.model),e.threadSource!==void 0&&!e.threadId&&t.push(`--thread-source`,e.threadSource),e.sandboxMode&&t.push(`--sandbox`,e.sandboxMode),e.workingDirectory&&t.push(`--cd`,e.workingDirectory),e.additionalDirectories?.length)for(let n of e.additionalDirectories)t.push(`--add-dir`,n);if(e.skipGitRepoCheck&&t.push(`--skip-git-repo-check`),e.outputSchemaFile&&t.push(`--output-schema`,e.outputSchemaFile),e.modelReasoningEffort&&t.push(`--config`,`model_reasoning_effort="${e.modelReasoningEffort}"`),e.networkAccessEnabled!==void 0&&t.push(`--config`,`sandbox_workspace_write.network_access=${e.networkAccessEnabled}`),e.webSearchMode?t.push(`--config`,`web_search="${e.webSearchMode}"`):e.webSearchEnabled===!0?t.push(`--config`,`web_search="live"`):e.webSearchEnabled===!1&&t.push(`--config`,`web_search="disabled"`),e.approvalPolicy&&t.push(`--config`,`approval_policy="${e.approvalPolicy}"`),e.threadId&&t.push(`resume`,e.threadId),e.images?.length)for(let n of e.images)t.push(`--image`,n);let n={};if(this.envOverride)Object.assign(n,this.envOverride);else for(let[e,t]of Object.entries(process.env))t!==void 0&&(n[e]=t);n[d]||(n[d]=f),e.apiKey&&(n.CODEX_API_KEY=e.apiKey),this.pathDirs.length>0&&E(n,this.pathDirs);let r=a(this.executablePath,t,{env:n,signal:e.signal}),i=null;if(r.once(`error`,e=>i=e),!r.stdin)throw r.kill(),Error(`Child process has no stdin`);if(r.stdin.write(e.input),r.stdin.end(),!r.stdout)throw r.kill(),Error(`Child process has no stdout`);let s=[];r.stderr&&r.stderr.on(`data`,e=>{s.push(e)});let c=new Promise(e=>{r.once(`exit`,(t,n)=>{e({code:t,signal:n})})}),l=o.createInterface({input:r.stdout,crlfDelay:1/0});try{for await(let e of l)yield e;if(i)throw i;let{code:e,signal:t}=await c;if(e!==0||t){let n=Buffer.concat(s),r=t?`signal ${t}`:`code ${e??1}`;throw Error(`Codex Exec exited with ${r}: ${n.toString(`utf8`)}`)}}finally{l.close(),r.removeAllListeners();try{r.killed||r.kill()}catch{}}}};function _(e){let t=[];return v(e,``,t),t}function v(e,t,n){if(!S(e))if(t){n.push(`${t}=${y(e,t)}`);return}else throw Error(`Codex config overrides must be a plain object`);let r=Object.entries(e);if(!(!t&&r.length===0)){if(t&&r.length===0){n.push(`${t}={}`);return}for(let[e,i]of r){if(!e)throw Error(`Codex config override keys must be non-empty strings`);if(i===void 0)continue;let r=t?`${t}.${e}`:e;S(i)?v(i,r,n):n.push(`${r}=${y(i,r)}`)}}}function y(e,t){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Codex config override at ${t} must be a finite number`);return`${e}`}else if(typeof e==`boolean`)return e?`true`:`false`;else if(Array.isArray(e))return`[${e.map((e,n)=>y(e,`${t}[${n}]`)).join(`, `)}]`;else if(S(e)){let n=[];for(let[r,i]of Object.entries(e)){if(!r)throw Error(`Codex config override keys must be non-empty strings`);i!==void 0&&n.push(`${x(r)} = ${y(i,`${t}.${r}`)}`)}return`{${n.join(`, `)}}`}else if(e===null)throw Error(`Codex config override at ${t} cannot be null`);else{let n=typeof e;throw Error(`Unsupported Codex config override value at ${t}: ${n}`)}}var b=/^[A-Za-z0-9_-]+$/;function x(e){return b.test(e)?e:JSON.stringify(e)}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function C(){let{platform:e,arch:t}=process,i=null;switch(e){case`linux`:case`android`:switch(t){case`x64`:i=`x86_64-unknown-linux-musl`;break;case`arm64`:i=`aarch64-unknown-linux-musl`;break;default:break}break;case`darwin`:switch(t){case`x64`:i=`x86_64-apple-darwin`;break;case`arm64`:i=`aarch64-apple-darwin`;break;default:break}break;case`win32`:switch(t){case`x64`:i=`x86_64-pc-windows-msvc`;break;case`arm64`:i=`aarch64-pc-windows-msvc`;break;default:break}break;default:break}if(!i)throw Error(`Unsupported platform: ${e} (${t})`);let a=m[i];if(!a)throw Error(`Unsupported target triple: ${i}`);let o;try{let e=r(h.resolve(`${p}/package.json`)).resolve(`${a}/package.json`);o=n.join(n.dirname(e),`vendor`)}catch{throw Error(`Unable to locate Codex CLI binaries. Ensure ${p} is installed with optional dependencies.`)}let s=process.platform===`win32`?`codex.exe`:`codex`,c=w(o,i,s);if(!c)throw Error(`Unable to locate Codex CLI binaries for ${i}. Ensure ${p} is installed with optional dependencies.`);return c}function w(e,t,r){let i=n.join(e,t),a=n.join(i,`bin`,r);if(O(a)&&O(n.join(i,`codex-package.json`)))return{executablePath:a,pathDirs:T(n.join(i,`codex-path`))};let o=n.join(i,`codex`,r);return O(o)?{executablePath:o,pathDirs:T(n.join(i,`path`))}:null}function T(...e){return e.filter(k)}function E(e,t,r=process.platform){let i=D(e,r);if(r===`win32`)for(let t of Object.keys(e))t.toLowerCase()===`path`&&t!==i&&delete e[t];let a=(e[i]??``).split(n.delimiter).filter(e=>e.length>0&&!t.includes(e));e[i]=[...t,...a].join(n.delimiter)}function D(e,t){if(t!==`win32`)return`PATH`;let n=Object.keys(e).filter(e=>e.toLowerCase()===`path`);return n.includes(`Path`)?`Path`:n.at(-1)??`PATH`}function O(e){try{return t(e).isFile()}catch{return!1}}function k(e){try{return t(e).isDirectory()}catch{return!1}}var A=class{exec;options;constructor(e={}){let{codexPathOverride:t,env:n,config:r,configOverrides:i}=e;this.exec=new g(t,n,r,i),this.options=e}startThread(e={}){return new l(this.exec,this.options,e)}resumeThread(e,t={}){return new l(this.exec,this.options,t,e)}};export{A as Codex};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,L as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,V as y,X as b,Y as x,Z as S,_ as C,_t as w,a as T,at as E,b as D,c as O,ct as k,d as A,dt as j,et as M,g as N,gt as P,h as F,ht as I,it as L,j as ee,k as R,l as te,lt as ne,m as z,mt as B,n as V,nt as H,o as re,ot as U,p as ie,pt as ae,q as oe,r as se,rt as ce,s as le,st as ue,tt as de,ut as fe,v as pe,w as me,x as he,y as ge,z as _e}from"./validate-response-CezyBuEO.mjs";import{$ as W,B as ve,F as ye,G as be,H as xe,I as Se,J as Ce,L as we,M as Te,N as Ee,P as De,Q as Oe,R as ke,U as Ae,V as je,W as Me,ct as G,dt as K,it as Ne,nt as q,ot as Pe,rt as Fe,z as J}from"./index.mjs";import*as Ie from"zlib";import*as Le from"http";import{promisify as Re}from"util";import*as ze from"http2";import*as Be from"https";function Ve(e){let t;if(e.timeoutMs!==void 0){let n=new Date(Date.now()+e.timeoutMs);t=()=>n.getTime()-Date.now()}else t=()=>void 0;let n=B(e.timeoutMs),r=I(n.signal,e.requestSignal,e.shutdownSignal);return Object.assign(Object.assign({},e),{signal:r.signal,timeoutMs:t,requestHeader:new Headers(e.requestHeader),responseHeader:new Headers(e.responseHeader),responseTrailer:new Headers(e.responseTrailer),abort(e){n.cleanup(),r.abort(e)},values:e.contextValues??ae()})}function He(e,t,n){return{kind:t.kind,service:e,method:t,impl:n}}function Ue(e,t){let n={service:e,methods:{}};for(let[r,i]of Object.entries(e.methods)){let a=t[r];if(typeof a==`function`)a=a.bind(t);else{let t=`${e.typeName}.${i.name} is not implemented`;a=function(){throw new W(t,q.Unimplemented)}}n.methods[r]=He(e,i,a)}return n}function We(e,t){if(e===null)return{};let n=/^(\d{1,8})([HMSmun])$/.exec(e);if(n===null)return{error:new W(`protocol error: invalid grpc timeout value: ${e}`,q.InvalidArgument)};let r={H:3600*1e3,M:60*1e3,S:1e3,m:1,u:.001,n:1e-6}[n[2]]*parseInt(n[1]);return r>t?{timeoutMs:r,error:new W(`timeout ${r}ms must be <= ${t}`,q.InvalidArgument)}:{timeoutMs:r}}function Ge(...e){let t=new Map,n=e.reduce((e,t)=>e.concat(`supported`in t?t.supported:t),[]);function r(e){if(e===null||e.length==0)return!1;let r=t.get(e);if(r!==void 0)return r;let i=n.some(t=>t.test(e));return t.size<1024&&t.set(e,i),i}return r.supported=n,r}var Ke=function(e){return this instanceof Ke?(this.v=e,this):new Ke(e)},Y=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Ke?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}},qe=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},Je=function(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:Ke(e[r](t)),done:!1}:i?i(t):t}:i}};async function Ye(e,t,n,r){let{message:i}=await oe(async n=>({message:u(e.method.O,await e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!1,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),r)({init:{method:t.requestMethod},message:n,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!1});return i}function Xe(e,t,n){switch(e.kind){case Ne.Unary:return function(r){return Y(this,arguments,function*(){let i=r[Symbol.asyncIterator](),a=yield Ke(i.next());if(a.done===!0)throw new W(`protocol error: missing input message for unary method`,q.Unimplemented);let{message:o,header:s,trailer:c}=yield Ke(oe(async n=>({message:u(e.method.O,await e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!1,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:a.value,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!1}));if(Ze(s,t.responseHeader),Ze(c,t.responseTrailer),yield yield Ke(o),(yield Ke(i.next())).done!==!0)throw new W(`protocol error: received extra input message for unary method`,q.Unimplemented)})};case Ne.ServerStreaming:return function(r){return Y(this,arguments,function*(){let i=r[Symbol.asyncIterator](),a=yield Ke(i.next());if(a.done===!0)throw new W(`protocol error: missing input message for server-streaming method`,q.Unimplemented);let{message:o,header:s,trailer:c}=yield Ke(oe(async n=>({message:x(e.method.O,e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!0,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:a.value,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!1}));if(Ze(s,t.responseHeader),Ze(c,t.responseTrailer),yield Ke(yield*Je(qe(o))),(yield Ke(i.next())).done!==!0)throw new W(`protocol error: received extra input message for server-streaming method`,q.Unimplemented)})};case Ne.ClientStreaming:return function(r){return Y(this,arguments,function*(){let{message:i,header:a,trailer:o}=yield Ke(oe(async n=>({message:u(e.method.O,await e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!1,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:r,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!0}));Ze(a,t.responseHeader),Ze(o,t.responseTrailer),yield yield Ke(i)})};case Ne.BiDiStreaming:return function(r){return Y(this,arguments,function*(){let{message:i,header:a,trailer:o}=yield Ke(oe(async n=>({message:x(e.method.O,e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!0,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:r,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!0}));Ze(a,t.responseHeader),Ze(o,t.responseTrailer),yield Ke(yield*Je(qe(i)))})}}}function Ze(e,t){e!==t&&(t.forEach((e,n)=>{t.delete(n)}),e.forEach((e,n)=>{t.set(n,e)}))}function Qe(e){if(!(typeof e.body==`object`&&e.body!==null&&Symbol.asyncIterator in e.body))throw Error(`byte stream required, but received JSON`)}const $e={status:200},et={status:404},tt={status:415},nt={status:405},rt={status:505};function it(e){e??={};let t=e.acceptCompression?[...e.acceptCompression]:[],n=e.requireConnectProtocolHeader??!1,r=e.maxTimeoutMs??2**53-1;return Object.assign(Object.assign({acceptCompression:t},Ce(e.readMaxBytes,e.writeMaxBytes,e.compressMinBytes)),{jsonOptions:e.jsonOptions,binaryOptions:e.binaryOptions,maxTimeoutMs:r,shutdownSignal:e.shutdownSignal,requireConnectProtocolHeader:n,interceptors:e.interceptors??[]})}function at(e,t){return Object.entries(e.methods).map(([,e])=>ot(e,t))}function ot(e,t){return st(t.map(t=>t(e)))}function st(e){if(e.length==0)throw new W(`at least one protocol is required`,q.Internal);let t=e[0].service,n=e[0].method,r=e[0].requestPath;if(e.some(e=>e.service!==t||e.method!==n))throw new W(`cannot negotiate protocol for different RPCs`,q.Internal);if(e.some(e=>e.requestPath!==r))throw new W(`cannot negotiate protocol for different requestPaths`,q.Internal);async function i(t){if(n.kind==Ne.BiDiStreaming&&t.httpVersion.startsWith(`1.`))return Object.assign(Object.assign({},rt),{header:new Headers({Connection:`close`})});let r=t.header.get(`Content-Type`)??``,i=e.filter(e=>e.allowedMethods.includes(t.method));if(i.length==0)return nt;if(i.length==1&&r===``){let e=i[0];return e(t)}let a=i.filter(e=>e.supportedContentType(r));if(a.length==0)return tt;let o=a[0];return o(t)}return Object.assign(i,{service:t,method:n,requestPath:r,supportedContentType:Ge(...e.map(e=>e.supportedContentType)),protocolNames:e.flatMap(e=>e.protocolNames).filter((e,t,n)=>n.indexOf(e)===t),allowedMethods:e.flatMap(e=>e.allowedMethods).filter((e,t,n)=>n.indexOf(e)===t)})}const ct=`grpc-web`,lt=`POST`;function ut(e){let t=it(e),n=fe();function r(e){let r=dt(t,n,e);return Object.assign(r,{protocolNames:[ct],allowedMethods:[lt],supportedContentType:Ge(H),requestPath:b(`/`,e.service,e.method),service:e.service,method:e.method})}return r.protocolName=ct,r}function dt(t,n,r){let i=s(r.method,t.binaryOptions,t.jsonOptions,t);return async function(a){Qe(a);let o=ce(a.header.get(E));if(o==null||o.text)return tt;if(a.method!==lt)return nt;let s=We(a.header.get(k),t.maxTimeoutMs),c=Ve(Object.assign(Object.assign({},r),{requestMethod:a.method,protocolName:ct,timeoutMs:s.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:a.signal,requestHeader:a.header,url:a.url,responseHeader:{[E]:o.binary?de:M},responseTrailer:{[ue]:m},contextValues:a.contextValues})),l=Oe(t.acceptCompression,a.header.get(U),a.header.get(L),L);l.response&&c.responseHeader.set(U,l.response.name);let u=Ee(a.body,xe(()=>{if(l.error)throw l.error;if(s.error)throw s.error}),Me(t.readMaxBytes),J(l.request,t.readMaxBytes),je(i.getI(o.binary),j)),d=Xe(r,c,t.interceptors)(u)[Symbol.asyncIterator](),f=Ee({[Symbol.asyncIterator](){return{next:()=>d.next(),throw:e=>(c.abort(e),d.throw?.call(d,e)??Promise.reject({done:!0})),return:e=>(c.abort(),d.return?.call(d,e)??Promise.resolve({done:!0,value:e}))}}},Ae(i.getO(o.binary)),we(t=>(c.abort(),t instanceof W?e(c.responseTrailer,t):t!==void 0&&e(c.responseTrailer,new W(`internal error`,q.Internal,void 0,void 0,t)),{flags:j,data:n.serialize(c.responseTrailer)})),ke(l.response,t.compressMinBytes),ve(),{propagateDownStreamError:!0});return Object.assign(Object.assign({},$e),{body:await be(f),header:c.responseHeader})}}const ft=/^application\/grpc(?:\+(?:(json)(?:; ?charset=utf-?8)?|proto))?$/i,pt=`application/grpc+proto`,mt=`application/grpc+json`;function ht(e){let t=e?.match(ft);if(t)return{binary:!t[1]}}const gt=`grpc`,_t=`POST`;function vt(e){let t=it(e);function n(e){let n=yt(t,e);return Object.assign(n,{protocolNames:[gt],allowedMethods:[_t],supportedContentType:Ge(ft),requestPath:b(`/`,e.service,e.method),service:e.service,method:e.method})}return n.protocolName=gt,n}function yt(t,n){let r=s(n.method,t.binaryOptions,t.jsonOptions,t);return async function(i){Qe(i);let a=ht(i.header.get(E));if(a==null)return tt;if(i.method!==_t)return nt;let o=We(i.header.get(k),t.maxTimeoutMs),s=Ve(Object.assign(Object.assign({},n),{requestMethod:i.method,protocolName:gt,timeoutMs:o.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:i.signal,requestHeader:i.header,url:i.url,responseHeader:{[E]:a.binary?pt:mt},responseTrailer:{[ue]:m},contextValues:i.contextValues})),c=Oe(t.acceptCompression,i.header.get(U),i.header.get(L),L);c.response&&s.responseHeader.set(U,c.response.name);let l=Ee(i.body,xe(()=>{if(c.error)throw c.error;if(o.error)throw o.error}),Me(t.readMaxBytes),J(c.request,t.readMaxBytes),je(r.getI(a.binary))),u=Xe(n,s,t.interceptors)(l)[Symbol.asyncIterator](),d=Ee({[Symbol.asyncIterator](){return{next:()=>u.next(),throw:e=>(s.abort(e),u.throw?.call(u,e)??Promise.reject({done:!0})),return:e=>(s.abort(),u.return?.call(u,e)??Promise.resolve({done:!0,value:e}))}}},Ae(r.getO(a.binary)),ke(c.response,t.compressMinBytes),ve(),we(t=>{s.abort(),t instanceof W?e(s.responseTrailer,t):t!==void 0&&e(s.responseTrailer,new W(`internal error`,q.Internal,void 0,void 0,t))}),{propagateDownStreamError:!0});return Object.assign(Object.assign({},$e),{body:await be(d),header:s.responseHeader,trailer:s.responseTrailer})}}function bt(e,t){if(e===null)return{};let n=/^\d{1,10}$/.exec(e);if(n===null)return{error:new W(`protocol error: invalid connect timeout value: ${e}`,q.InvalidArgument)};let r=parseInt(n[0]);return r>t?{timeoutMs:r,error:new W(`timeout ${r}ms must be <= ${t}`,q.InvalidArgument)}:{timeoutMs:parseInt(n[0])}}const xt=`connect`,St=`POST`;function Ct(e){let n=it(e),r=t(n.jsonOptions);function i(e){let t,i,a=s(e.method,n.binaryOptions,n.jsonOptions,n);switch(e.kind){case Ne.Unary:i=y,t=wt(n,e,a);break;default:i=h,t=Ot(n,e,a,r);break}let o=[St];return e.method.idempotency===Fe.NoSideEffects&&o.push(`GET`),Object.assign(t,{protocolNames:[xt],supportedContentType:Ge(i),allowedMethods:o,requestPath:b(`/`,e.service,e.method),service:e.service,method:e.method})}return i.protocolName=xt,i}function wt(e,t,s){return async function(l){let u=l.method==`GET`;if(u&&t.method.idempotency!=Fe.NoSideEffects)return nt;let d=new URL(l.url).searchParams,p=u?d.get(ge):l.header.get(R),m=u?v(d.get(D)):c(l.header.get(r));if(m==null||m.stream)return tt;let h=bt(l.header.get(a),e.maxTimeoutMs),_=Ve(Object.assign(Object.assign({},t),{requestMethod:l.method,protocolName:xt,timeoutMs:h.timeoutMs,shutdownSignal:e.shutdownSignal,requestSignal:l.signal,requestHeader:l.header,url:l.url,responseHeader:{[r]:m.binary?n:_e},contextValues:l.contextValues})),y=Oe(e.acceptCompression,p,l.header.get(i),i),b=$e.status,x;try{if(e.requireConnectProtocolHeader&&(u?F(d):z(l.header)),y.error)throw y.error;if(h.error)throw h.error;let n;n=u?await Et(e.readMaxBytes,y.request,d):await Tt(e.readMaxBytes,y.request,l);let r=await Ye(t,_,Dt(t.method,m.binary,s,n),e.interceptors);x=s.getO(m.binary).serialize(r)}catch(t){let n;n=t instanceof W?t:new W(`internal error`,q.Internal,void 0,void 0,t),b=g(n.code),_.responseHeader.set(r,_e),n.metadata.forEach((e,t)=>{_.responseHeader.set(t,e)}),x=o(n,e.jsonOptions)}finally{_.abort()}y.response&&x.byteLength>=e.compressMinBytes&&(x=await y.response.compress(x),_.responseHeader.set(R,y.response.name));let S=C(_.responseHeader,_.responseTrailer);return S.set(f,x.byteLength.toString(10)),{status:b,body:Te([x]),header:S}}}async function Tt(e,t,n){if(typeof n.body==`object`&&n.body!==null&&Symbol.asyncIterator in n.body){let r=await ye(n.body,e,n.header.get(f));return t&&(r=await t.decompress(r,e)),r}return n.body}async function Et(e,t,n){let r=n.get(pe),i=n.get(he)??``,a;return a=r===`1`?Pe.dec(i):new TextEncoder().encode(i),t&&(a=await t.decompress(a,e)),a}function Dt(e,t,n,r){if(r instanceof Uint8Array)return n.getI(t).parse(r);if(t)throw new W(`received parsed JSON request body, but content-type indicates binary format`,q.Internal);try{return e.I.fromJson(r)}catch(e){throw W.from(e,q.InvalidArgument)}}function Ot(e,t,n,i){return async function(o){Qe(o);let s=c(o.header.get(r));if(s==null||!s.stream)return tt;if(o.method!==St)return nt;let u=bt(o.header.get(a),e.maxTimeoutMs),f=Ve(Object.assign(Object.assign({},t),{requestMethod:o.method,protocolName:xt,timeoutMs:u.timeoutMs,shutdownSignal:e.shutdownSignal,requestSignal:o.signal,requestHeader:o.header,url:o.url,responseHeader:{[r]:s.binary?d:l},contextValues:o.contextValues})),p=Oe(e.acceptCompression,o.header.get(_),o.header.get(me),me);p.response&&f.responseHeader.set(_,p.response.name);let m=Ee(o.body,xe(()=>{if(e.requireConnectProtocolHeader&&z(o.header),p.error)throw p.error;if(u.error)throw u.error}),Me(e.readMaxBytes),J(p.request,e.readMaxBytes),je(n.getI(s.binary),ee)),h=Xe(t,f,e.interceptors)(m)[Symbol.asyncIterator](),g=Ee({[Symbol.asyncIterator](){return{next:()=>h.next(),throw:e=>(f.abort(e),h.throw?.call(h,e)??Promise.reject({done:!0})),return:e=>(f.abort(),h.return?.call(h,e)??Promise.resolve({done:!0,value:e}))}}},Ae(n.getO(s.binary)),we(e=>{f.abort();let t={metadata:f.responseTrailer};return e instanceof W?t.error=e:e!==void 0&&(t.error=new W(`internal error`,q.Internal,void 0,void 0,e)),{flags:ee,data:i.serialize(t)}}),ke(p.response,e.compressMinBytes),ve(),{propagateDownStreamError:!0});return Object.assign(Object.assign({},$e),{body:await be(g),header:f.responseHeader})}}function kt(e){let t=At(e),n=[];return{handlers:n,service(e,r,i){let{protocols:a}=At(i,t);return n.push(...at(Ue(e,r),a)),this},rpc(e,r,i,a){let o,s,c,l;`typeName`in e?(o=e,s=r,c=i,l=a):(o=Object.assign(Object.assign({},e.service),{methods:{}}),s=e,c=r,l=i);let{protocols:u}=At(l,t);return n.push(ot(He(o,s,c),u)),this}}}function At(e,t){if(t&&!e)return t;let n=t?Object.assign(Object.assign({},it(t.options)),e):Object.assign(Object.assign({},e),it(e??{})),r=[];if(e?.grpc!==!1&&r.push(vt(n)),e?.grpcWeb!==!1&&r.push(ut(n)),e?.connect!==!1&&r.push(Ct(n)),r.length===0)throw new W(`cannot create handler, all protocols are disabled`,q.InvalidArgument);return{options:n,protocols:r}}var jt=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},Mt=function(e){return this instanceof Mt?(this.v=e,this):new Mt(e)},Nt=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Mt?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function Pt(e){return{async unary(t,n,r,i,a,o,c){let l=s(n,e.binaryOptions,e.jsonOptions,e);return i=i===void 0?e.defaultTimeoutMs:i<=0?void 0:i,await O({interceptors:e.interceptors,signal:r,timeoutMs:i,req:{stream:!1,service:t,method:n,url:b(e.baseUrl,t,n),init:{},header:ie(n.kind,e.useBinaryFormat,i,a,e.acceptCompression,e.sendCompression,!0),contextValues:c??ae(),message:o},next:async r=>{let i=l.getI(e.useBinaryFormat).serialize(r.message);e.sendCompression&&i.byteLength>e.compressMinBytes?(i=await e.sendCompression.compress(i),r.header.set(R,e.sendCompression.name)):r.header.delete(R);let a=e.useHttpGet===!0&&n.idempotency===Fe.NoSideEffects,o;a?r=te(r,i,e.useBinaryFormat):o=Te([i]);let s=await e.httpClient({url:r.url,method:r.init.method??`POST`,header:r.header,signal:r.signal,body:o}),{compression:c,isUnaryError:u,unaryError:d}=A(n.kind,e.acceptCompression,e.useBinaryFormat,s.status,s.header),[m,h]=N(s.header),g=await De(s.body,Se(e.readMaxBytes,s.header.get(f)),{propagateDownStreamError:!1});if(c&&(g=await c.decompress(g,e.readMaxBytes)),u)throw p(g,w(m,h),d);return{stream:!1,service:t,method:n,header:m,message:l.getO(e.useBinaryFormat).parse(g),trailer:h}}})},async stream(n,r,i,a,o,c,l){let u=s(r,e.binaryOptions,e.jsonOptions,e),d=t(e.jsonOptions);return a=a===void 0?e.defaultTimeoutMs:a<=0?void 0:a,le({interceptors:e.interceptors,signal:i,timeoutMs:a,req:{stream:!0,service:n,method:r,url:b(e.baseUrl,n,r),init:{method:`POST`,redirect:`error`,mode:`cors`},header:ie(r.kind,e.useBinaryFormat,a,o,e.acceptCompression,e.sendCompression,!0),contextValues:l??ae(),message:c},next:async t=>{let n=await e.httpClient({url:t.url,method:`POST`,header:t.header,signal:t.signal,body:Ee(t.message,Ae(u.getI(e.useBinaryFormat)),ke(e.sendCompression,e.compressMinBytes),ve(),{propagateDownStreamError:!0})}),{compression:i}=A(r.kind,e.acceptCompression,e.useBinaryFormat,n.status,n.header),a=Object.assign(Object.assign({},t),{header:n.header,trailer:new Headers,message:Ee(n.body,Me(e.readMaxBytes),J(i??null,e.readMaxBytes),je(u.getO(e.useBinaryFormat),ee,d),function(e){return Nt(this,arguments,function*(){var t,r,i,o;let s=!1;try{for(var c=!0,l=jt(e),u;u=yield Mt(l.next()),t=u.done,!t;c=!0){o=u.value,c=!1;let e=o;if(e.end){if(s)throw new W(`protocol error: received extra EndStreamResponse`,q.InvalidArgument);if(s=!0,e.value.error){let t=e.value.error;throw n.header.forEach((e,n)=>{t.metadata.append(n,e)}),t}e.value.metadata.forEach((e,t)=>a.trailer.set(t,e));continue}if(s)throw new W(`protocol error: received extra message after EndStreamResponse`,q.InvalidArgument);yield yield Mt(e.value)}}catch(e){r={error:e}}finally{try{!c&&!t&&(i=l.return)&&(yield Mt(i.call(l)))}finally{if(r)throw r.error}}if(!s)throw new W(`protocol error: missing EndStreamResponse`,q.InvalidArgument)})},{propagateDownStreamError:!0})});return a}})}}}var X=G(((e,t)=>{t.exports={kClose:Symbol(`close`),kDestroy:Symbol(`destroy`),kDispatch:Symbol(`dispatch`),kUrl:Symbol(`url`),kWriting:Symbol(`writing`),kResuming:Symbol(`resuming`),kQueue:Symbol(`queue`),kConnect:Symbol(`connect`),kConnecting:Symbol(`connecting`),kHeadersList:Symbol(`headers list`),kKeepAliveDefaultTimeout:Symbol(`default keep alive timeout`),kKeepAliveMaxTimeout:Symbol(`max keep alive timeout`),kKeepAliveTimeoutThreshold:Symbol(`keep alive timeout threshold`),kKeepAliveTimeoutValue:Symbol(`keep alive timeout`),kKeepAlive:Symbol(`keep alive`),kHeadersTimeout:Symbol(`headers timeout`),kBodyTimeout:Symbol(`body timeout`),kServerName:Symbol(`server name`),kLocalAddress:Symbol(`local address`),kHost:Symbol(`host`),kNoRef:Symbol(`no ref`),kBodyUsed:Symbol(`used`),kRunning:Symbol(`running`),kBlocking:Symbol(`blocking`),kPending:Symbol(`pending`),kSize:Symbol(`size`),kBusy:Symbol(`busy`),kQueued:Symbol(`queued`),kFree:Symbol(`free`),kConnected:Symbol(`connected`),kClosed:Symbol(`closed`),kNeedDrain:Symbol(`need drain`),kReset:Symbol(`reset`),kDestroyed:Symbol.for(`nodejs.stream.destroyed`),kMaxHeadersSize:Symbol(`max headers size`),kRunningIdx:Symbol(`running index`),kPendingIdx:Symbol(`pending index`),kError:Symbol(`error`),kClients:Symbol(`clients`),kClient:Symbol(`client`),kParser:Symbol(`parser`),kOnDestroyed:Symbol(`destroy callbacks`),kPipelining:Symbol(`pipelining`),kSocket:Symbol(`socket`),kHostHeader:Symbol(`host header`),kConnector:Symbol(`connector`),kStrictContentLength:Symbol(`strict content length`),kMaxRedirections:Symbol(`maxRedirections`),kMaxRequests:Symbol(`maxRequestsPerClient`),kProxy:Symbol(`proxy agent options`),kCounter:Symbol(`socket request counter`),kInterceptors:Symbol(`dispatch interceptors`),kMaxResponseSize:Symbol(`max response size`),kHTTP2Session:Symbol(`http2Session`),kHTTP2SessionState:Symbol(`http2Session state`),kHTTP2BuildRequest:Symbol(`http2 build request`),kHTTP1BuildRequest:Symbol(`http1 build request`),kHTTP2CopyHeaders:Symbol(`http2 copy headers`),kHTTPConnVersion:Symbol(`http connection version`),kRetryHandlerDefaultRetry:Symbol(`retry agent default retry`),kConstruct:Symbol(`constructable`)}})),Z=G(((e,t)=>{var n=class extends Error{constructor(e){super(e),this.name=`UndiciError`,this.code=`UND_ERR`}},r=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ConnectTimeoutError`,this.message=t||`Connect Timeout Error`,this.code=`UND_ERR_CONNECT_TIMEOUT`}},i=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`HeadersTimeoutError`,this.message=t||`Headers Timeout Error`,this.code=`UND_ERR_HEADERS_TIMEOUT`}},a=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`HeadersOverflowError`,this.message=t||`Headers Overflow Error`,this.code=`UND_ERR_HEADERS_OVERFLOW`}},o=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`BodyTimeoutError`,this.message=t||`Body Timeout Error`,this.code=`UND_ERR_BODY_TIMEOUT`}},s=class e extends n{constructor(t,n,r,i){super(t),Error.captureStackTrace(this,e),this.name=`ResponseStatusCodeError`,this.message=t||`Response Status Code Error`,this.code=`UND_ERR_RESPONSE_STATUS_CODE`,this.body=i,this.status=n,this.statusCode=n,this.headers=r}},c=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`InvalidArgumentError`,this.message=t||`Invalid Argument Error`,this.code=`UND_ERR_INVALID_ARG`}},l=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`InvalidReturnValueError`,this.message=t||`Invalid Return Value Error`,this.code=`UND_ERR_INVALID_RETURN_VALUE`}},u=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`AbortError`,this.message=t||`Request aborted`,this.code=`UND_ERR_ABORTED`}},d=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`InformationalError`,this.message=t||`Request information`,this.code=`UND_ERR_INFO`}},f=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`RequestContentLengthMismatchError`,this.message=t||`Request body length does not match content-length header`,this.code=`UND_ERR_REQ_CONTENT_LENGTH_MISMATCH`}},p=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ResponseContentLengthMismatchError`,this.message=t||`Response body length does not match content-length header`,this.code=`UND_ERR_RES_CONTENT_LENGTH_MISMATCH`}},m=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ClientDestroyedError`,this.message=t||`The client is destroyed`,this.code=`UND_ERR_DESTROYED`}},h=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ClientClosedError`,this.message=t||`The client is closed`,this.code=`UND_ERR_CLOSED`}},g=class e extends n{constructor(t,n){super(t),Error.captureStackTrace(this,e),this.name=`SocketError`,this.message=t||`Socket error`,this.code=`UND_ERR_SOCKET`,this.socket=n}},_=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`NotSupportedError`,this.message=t||`Not supported error`,this.code=`UND_ERR_NOT_SUPPORTED`}},v=class extends n{constructor(e){super(e),Error.captureStackTrace(this,_),this.name=`MissingUpstreamError`,this.message=e||`No upstream has been added to the BalancedPool`,this.code=`UND_ERR_BPL_MISSING_UPSTREAM`}};t.exports={HTTPParserError:class e extends Error{constructor(t,n,r){super(t),Error.captureStackTrace(this,e),this.name=`HTTPParserError`,this.code=n?`HPE_${n}`:void 0,this.data=r?r.toString():void 0}},UndiciError:n,HeadersTimeoutError:i,HeadersOverflowError:a,BodyTimeoutError:o,RequestContentLengthMismatchError:f,ConnectTimeoutError:r,ResponseStatusCodeError:s,InvalidArgumentError:c,InvalidReturnValueError:l,RequestAbortedError:u,ClientDestroyedError:m,ClientClosedError:h,InformationalError:d,SocketError:g,NotSupportedError:_,ResponseContentLengthMismatchError:p,BalancedPoolMissingUpstreamError:v,ResponseExceededMaxSizeError:class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ResponseExceededMaxSizeError`,this.message=t||`Response content exceeded max size`,this.code=`UND_ERR_RES_EXCEEDED_MAX_SIZE`}},RequestRetryError:class e extends n{constructor(t,n,{headers:r,data:i}){super(t),Error.captureStackTrace(this,e),this.name=`RequestRetryError`,this.message=t||`Request retry error`,this.code=`UND_ERR_REQ_RETRY`,this.statusCode=n,this.data=i,this.headers=r}}}})),Ft=G(((e,t)=>{let n={},r=`Accept.Accept-Encoding.Accept-Language.Accept-Ranges.Access-Control-Allow-Credentials.Access-Control-Allow-Headers.Access-Control-Allow-Methods.Access-Control-Allow-Origin.Access-Control-Expose-Headers.Access-Control-Max-Age.Access-Control-Request-Headers.Access-Control-Request-Method.Age.Allow.Alt-Svc.Alt-Used.Authorization.Cache-Control.Clear-Site-Data.Connection.Content-Disposition.Content-Encoding.Content-Language.Content-Length.Content-Location.Content-Range.Content-Security-Policy.Content-Security-Policy-Report-Only.Content-Type.Cookie.Cross-Origin-Embedder-Policy.Cross-Origin-Opener-Policy.Cross-Origin-Resource-Policy.Date.Device-Memory.Downlink.ECT.ETag.Expect.Expect-CT.Expires.Forwarded.From.Host.If-Match.If-Modified-Since.If-None-Match.If-Range.If-Unmodified-Since.Keep-Alive.Last-Modified.Link.Location.Max-Forwards.Origin.Permissions-Policy.Pragma.Proxy-Authenticate.Proxy-Authorization.RTT.Range.Referer.Referrer-Policy.Refresh.Retry-After.Sec-WebSocket-Accept.Sec-WebSocket-Extensions.Sec-WebSocket-Key.Sec-WebSocket-Protocol.Sec-WebSocket-Version.Server.Server-Timing.Service-Worker-Allowed.Service-Worker-Navigation-Preload.Set-Cookie.SourceMap.Strict-Transport-Security.Supports-Loading-Mode.TE.Timing-Allow-Origin.Trailer.Transfer-Encoding.Upgrade.Upgrade-Insecure-Requests.User-Agent.Vary.Via.WWW-Authenticate.X-Content-Type-Options.X-DNS-Prefetch-Control.X-Frame-Options.X-Permitted-Cross-Domain-Policies.X-Powered-By.X-Requested-With.X-XSS-Protection`.split(`.`);for(let e=0;e<r.length;++e){let t=r[e],i=t.toLowerCase();n[t]=n[i]=i}Object.setPrototypeOf(n,null),t.exports={wellknownHeaderNames:r,headerNameLowerCasedRecord:n}})),Q=G(((e,t)=>{let n=K(`assert`),{kDestroyed:r,kBodyUsed:i}=X(),{IncomingMessage:a}=K(`http`),o=K(`stream`),s=K(`net`),{InvalidArgumentError:c}=Z(),{Blob:l}=K(`buffer`),u=K(`util`),{stringify:d}=K(`querystring`),{headerNameLowerCasedRecord:f}=Ft(),[p,m]=process.versions.node.split(`.`).map(e=>Number(e));function h(){}function g(e){return e&&typeof e==`object`&&typeof e.pipe==`function`&&typeof e.on==`function`}function _(e){return l&&e instanceof l||e&&typeof e==`object`&&(typeof e.stream==`function`||typeof e.arrayBuffer==`function`)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function v(e,t){if(e.includes(`?`)||e.includes(`#`))throw Error(`Query params cannot be passed when url already contains "?" or "#".`);let n=d(t);return n&&(e+=`?`+n),e}function y(e){if(typeof e==`string`){if(e=new URL(e),!/^https?:/.test(e.origin||e.protocol))throw new c("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}if(!e||typeof e!=`object`)throw new c(`Invalid URL: The URL argument must be a non-null object.`);if(!/^https?:/.test(e.origin||e.protocol))throw new c("Invalid URL protocol: the URL must start with `http:` or `https:`.");if(!(e instanceof URL)){if(e.port!=null&&e.port!==``&&!Number.isFinite(parseInt(e.port)))throw new c(`Invalid URL: port must be a valid integer or a string representation of an integer.`);if(e.path!=null&&typeof e.path!=`string`)throw new c(`Invalid URL path: the path must be a string or null/undefined.`);if(e.pathname!=null&&typeof e.pathname!=`string`)throw new c(`Invalid URL pathname: the pathname must be a string or null/undefined.`);if(e.hostname!=null&&typeof e.hostname!=`string`)throw new c(`Invalid URL hostname: the hostname must be a string or null/undefined.`);if(e.origin!=null&&typeof e.origin!=`string`)throw new c(`Invalid URL origin: the origin must be a string or null/undefined.`);let t=e.port==null?e.protocol===`https:`?443:80:e.port,n=e.origin==null?`${e.protocol}//${e.hostname}:${t}`:e.origin,r=e.path==null?`${e.pathname||``}${e.search||``}`:e.path;n.endsWith(`/`)&&(n=n.substring(0,n.length-1)),r&&!r.startsWith(`/`)&&(r=`/${r}`),e=new URL(n+r)}return e}function b(e){if(e=y(e),e.pathname!==`/`||e.search||e.hash)throw new c(`invalid url`);return e}function x(e){if(e[0]===`[`){let t=e.indexOf(`]`);return n(t!==-1),e.substring(1,t)}let t=e.indexOf(`:`);return t===-1?e:e.substring(0,t)}function S(e){if(!e)return null;n.strictEqual(typeof e,`string`);let t=x(e);return s.isIP(t)?``:t}function C(e){return JSON.parse(JSON.stringify(e))}function w(e){return e!=null&&typeof e[Symbol.asyncIterator]==`function`}function T(e){return e!=null&&(typeof e[Symbol.iterator]==`function`||typeof e[Symbol.asyncIterator]==`function`)}function E(e){if(e==null)return 0;if(g(e)){let t=e._readableState;return t&&t.objectMode===!1&&t.ended===!0&&Number.isFinite(t.length)?t.length:null}else if(_(e))return e.size==null?null:e.size;else if(F(e))return e.byteLength;return null}function D(e){return!e||!!(e.destroyed||e[r])}function O(e){let t=e&&e._readableState;return D(e)&&t&&!t.endEmitted}function k(e,t){e==null||!g(e)||D(e)||(typeof e.destroy==`function`?(Object.getPrototypeOf(e).constructor===a&&(e.socket=null),e.destroy(t)):t&&process.nextTick((e,t)=>{e.emit(`error`,t)},e,t),e.destroyed!==!0&&(e[r]=!0))}let A=/timeout=(\d+)/;function j(e){let t=e.toString().match(A);return t?parseInt(t[1],10)*1e3:null}function M(e){return f[e]||e.toLowerCase()}function N(e,t={}){if(!Array.isArray(e))return e;for(let n=0;n<e.length;n+=2){let r=e[n].toString().toLowerCase(),i=t[r];i?(Array.isArray(i)||(i=[i],t[r]=i),i.push(e[n+1].toString(`utf8`))):Array.isArray(e[n+1])?t[r]=e[n+1].map(e=>e.toString(`utf8`)):t[r]=e[n+1].toString(`utf8`)}return`content-length`in t&&`content-disposition`in t&&(t[`content-disposition`]=Buffer.from(t[`content-disposition`]).toString(`latin1`)),t}function P(e){let t=[],n=!1,r=-1;for(let i=0;i<e.length;i+=2){let a=e[i+0].toString(),o=e[i+1].toString(`utf8`);a.length===14&&(a===`content-length`||a.toLowerCase()===`content-length`)?(t.push(a,o),n=!0):a.length===19&&(a===`content-disposition`||a.toLowerCase()===`content-disposition`)?r=t.push(a,o)-1:t.push(a,o)}return n&&r!==-1&&(t[r]=Buffer.from(t[r]).toString(`latin1`)),t}function F(e){return e instanceof Uint8Array||Buffer.isBuffer(e)}function I(e,t,n){if(!e||typeof e!=`object`)throw new c(`handler must be an object`);if(typeof e.onConnect!=`function`)throw new c(`invalid onConnect method`);if(typeof e.onError!=`function`)throw new c(`invalid onError method`);if(typeof e.onBodySent!=`function`&&e.onBodySent!==void 0)throw new c(`invalid onBodySent method`);if(n||t===`CONNECT`){if(typeof e.onUpgrade!=`function`)throw new c(`invalid onUpgrade method`)}else{if(typeof e.onHeaders!=`function`)throw new c(`invalid onHeaders method`);if(typeof e.onData!=`function`)throw new c(`invalid onData method`);if(typeof e.onComplete!=`function`)throw new c(`invalid onComplete method`)}}function L(e){return!!(e&&(o.isDisturbed?o.isDisturbed(e)||e[i]:e[i]||e.readableDidRead||e._readableState&&e._readableState.dataEmitted||O(e)))}function ee(e){return!!(e&&(o.isErrored?o.isErrored(e):/state: 'errored'/.test(u.inspect(e))))}function R(e){return!!(e&&(o.isReadable?o.isReadable(e):/state: 'readable'/.test(u.inspect(e))))}function te(e){return{localAddress:e.localAddress,localPort:e.localPort,remoteAddress:e.remoteAddress,remotePort:e.remotePort,remoteFamily:e.remoteFamily,timeout:e.timeout,bytesWritten:e.bytesWritten,bytesRead:e.bytesRead}}async function*ne(e){for await(let t of e)yield Buffer.isBuffer(t)?t:Buffer.from(t)}let z;function B(e){if(z||=K(`stream/web`).ReadableStream,z.from)return z.from(ne(e));let t;return new z({async start(){t=e[Symbol.asyncIterator]()},async pull(e){let{done:n,value:r}=await t.next();if(n)queueMicrotask(()=>{e.close()});else{let t=Buffer.isBuffer(r)?r:Buffer.from(r);e.enqueue(new Uint8Array(t))}return e.desiredSize>0},async cancel(e){await t.return()}},0)}function V(e){return e&&typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&e[Symbol.toStringTag]===`FormData`}function H(e){if(e){if(typeof e.throwIfAborted==`function`)e.throwIfAborted();else if(e.aborted){let e=Error(`The operation was aborted`);throw e.name=`AbortError`,e}}}function re(e,t){return`addEventListener`in e?(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)):(e.addListener(`abort`,t),()=>e.removeListener(`abort`,t))}let U=!!String.prototype.toWellFormed;function ie(e){return U?`${e}`.toWellFormed():u.toUSVString?u.toUSVString(e):`${e}`}function ae(e){if(e==null||e===``)return{start:0,end:null,size:null};let t=e?e.match(/^bytes (\d+)-(\d+)\/(\d+)?$/):null;return t?{start:parseInt(t[1]),end:t[2]?parseInt(t[2]):null,size:t[3]?parseInt(t[3]):null}:null}let oe=Object.create(null);oe.enumerable=!0,t.exports={kEnumerableProperty:oe,nop:h,isDisturbed:L,isErrored:ee,isReadable:R,toUSVString:ie,isReadableAborted:O,isBlobLike:_,parseOrigin:b,parseURL:y,getServerName:S,isStream:g,isIterable:T,isAsyncIterable:w,isDestroyed:D,headerNameToString:M,parseRawHeaders:P,parseHeaders:N,parseKeepAliveTimeout:j,destroy:k,bodyLength:E,deepClone:C,ReadableStreamFrom:B,isBuffer:F,validateHandler:I,getSocketInfo:te,isFormDataLike:V,buildURL:v,throwIfAborted:H,addAbortListener:re,parseRangeHeader:ae,nodeMajor:p,nodeMinor:m,nodeHasAutoSelectFamily:p>18||p===18&&m>=13,safeHTTPMethods:[`GET`,`HEAD`,`OPTIONS`,`TRACE`]}})),It=G(((e,t)=>{let n=Date.now(),r,i=[];function a(){n=Date.now();let e=i.length,t=0;for(;t<e;){let r=i[t];r.state===0?r.state=n+r.delay:r.state>0&&n>=r.state&&(r.state=-1,r.callback(r.opaque)),r.state===-1?(r.state=-2,t===e-1?i.pop():i[t]=i.pop(),--e):t+=1}i.length>0&&o()}function o(){r&&r.refresh?r.refresh():(clearTimeout(r),r=setTimeout(a,1e3),r.unref&&r.unref())}var s=class{constructor(e,t,n){this.callback=e,this.delay=t,this.opaque=n,this.state=-2,this.refresh()}refresh(){this.state===-2&&(i.push(this),(!r||i.length===1)&&o()),this.state=0}clear(){this.state=-1}};t.exports={setTimeout(e,t,n){return t<1e3?setTimeout(e,t,n):new s(e,t,n)},clearTimeout(e){e instanceof s?e.clear():clearTimeout(e)}}})),Lt=G(((e,t)=>{let n=K(`node:events`).EventEmitter,r=K(`node:util`).inherits;function i(e){if(typeof e==`string`&&(e=Buffer.from(e)),!Buffer.isBuffer(e))throw TypeError(`The needle has to be a String or a Buffer.`);let t=e.length;if(t===0)throw Error(`The needle cannot be an empty String/Buffer.`);if(t>256)throw Error(`The needle cannot have a length bigger than 256.`);this.maxMatches=1/0,this.matches=0,this._occ=Array(256).fill(t),this._lookbehind_size=0,this._needle=e,this._bufpos=0,this._lookbehind=Buffer.alloc(t);for(var n=0;n<t-1;++n)this._occ[e[n]]=t-1-n}r(i,n),i.prototype.reset=function(){this._lookbehind_size=0,this.matches=0,this._bufpos=0},i.prototype.push=function(e,t){Buffer.isBuffer(e)||(e=Buffer.from(e,`binary`));let n=e.length;this._bufpos=t||0;let r;for(;r!==n&&this.matches<this.maxMatches;)r=this._sbmh_feed(e);return r},i.prototype._sbmh_feed=function(e){let t=e.length,n=this._needle,r=n.length,i=n[r-1],a=-this._lookbehind_size,o;if(a<0){for(;a<0&&a<=t-r;){if(o=this._sbmh_lookup_char(e,a+r-1),o===i&&this._sbmh_memcmp(e,a,r-1))return this._lookbehind_size=0,++this.matches,this.emit(`info`,!0),this._bufpos=a+r;a+=this._occ[o]}if(a<0)for(;a<0&&!this._sbmh_memcmp(e,a,t-a);)++a;if(a>=0)this.emit(`info`,!1,this._lookbehind,0,this._lookbehind_size),this._lookbehind_size=0;else{let n=this._lookbehind_size+a;return n>0&&this.emit(`info`,!1,this._lookbehind,0,n),this._lookbehind.copy(this._lookbehind,0,n,this._lookbehind_size-n),this._lookbehind_size-=n,e.copy(this._lookbehind,this._lookbehind_size),this._lookbehind_size+=t,this._bufpos=t,t}}if(a+=(a>=0)*this._bufpos,e.indexOf(n,a)!==-1)return a=e.indexOf(n,a),++this.matches,a>0?this.emit(`info`,!0,e,this._bufpos,a):this.emit(`info`,!0),this._bufpos=a+r;for(a=t-r;a<t&&(e[a]!==n[0]||Buffer.compare(e.subarray(a,a+t-a),n.subarray(0,t-a))!==0);)++a;return a<t&&(e.copy(this._lookbehind,0,a,a+(t-a)),this._lookbehind_size=t-a),a>0&&this.emit(`info`,!1,e,this._bufpos,a<t?a:t),this._bufpos=t,t},i.prototype._sbmh_lookup_char=function(e,t){return t<0?this._lookbehind[this._lookbehind_size+t]:e[t]},i.prototype._sbmh_memcmp=function(e,t,n){for(var r=0;r<n;++r)if(this._sbmh_lookup_char(e,t+r)!==this._needle[r])return!1;return!0},t.exports=i})),Rt=G(((e,t)=>{let n=K(`node:util`).inherits,r=K(`node:stream`).Readable;function i(e){r.call(this,e)}n(i,r),i.prototype._read=function(e){},t.exports=i})),zt=G(((e,t)=>{t.exports=function(e,t,n){if(!e||e[t]===void 0||e[t]===null)return n;if(typeof e[t]!=`number`||isNaN(e[t]))throw TypeError(`Limit `+t+` is not a valid number`);return e[t]}})),Bt=G(((e,t)=>{let n=K(`node:events`).EventEmitter,r=K(`node:util`).inherits,i=zt(),a=Lt(),o=Buffer.from(`\r
2
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,L as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,V as y,X as b,Y as x,Z as S,_ as C,_t as w,a as T,at as E,b as D,c as O,ct as k,d as A,dt as j,et as M,g as N,gt as P,h as F,ht as I,it as L,j as ee,k as R,l as te,lt as ne,m as z,mt as B,n as V,nt as H,o as re,ot as U,p as ie,pt as ae,q as oe,r as se,rt as ce,s as le,st as ue,tt as de,ut as fe,v as pe,w as me,x as he,y as ge,z as _e}from"./validate-response-CezyBuEO.mjs";import{$ as W,B as ve,F as ye,G as be,H as xe,I as Se,J as Ce,L as we,M as Te,N as Ee,P as De,Q as Oe,R as ke,U as Ae,V as je,W as Me,ct as G,it as Ne,lt as K,nt as q,ot as Pe,rt as Fe,z as J}from"./index.mjs";import*as Ie from"zlib";import*as Le from"http";import{promisify as Re}from"util";import*as ze from"http2";import*as Be from"https";function Ve(e){let t;if(e.timeoutMs!==void 0){let n=new Date(Date.now()+e.timeoutMs);t=()=>n.getTime()-Date.now()}else t=()=>void 0;let n=B(e.timeoutMs),r=I(n.signal,e.requestSignal,e.shutdownSignal);return Object.assign(Object.assign({},e),{signal:r.signal,timeoutMs:t,requestHeader:new Headers(e.requestHeader),responseHeader:new Headers(e.responseHeader),responseTrailer:new Headers(e.responseTrailer),abort(e){n.cleanup(),r.abort(e)},values:e.contextValues??ae()})}function He(e,t,n){return{kind:t.kind,service:e,method:t,impl:n}}function Ue(e,t){let n={service:e,methods:{}};for(let[r,i]of Object.entries(e.methods)){let a=t[r];if(typeof a==`function`)a=a.bind(t);else{let t=`${e.typeName}.${i.name} is not implemented`;a=function(){throw new W(t,q.Unimplemented)}}n.methods[r]=He(e,i,a)}return n}function We(e,t){if(e===null)return{};let n=/^(\d{1,8})([HMSmun])$/.exec(e);if(n===null)return{error:new W(`protocol error: invalid grpc timeout value: ${e}`,q.InvalidArgument)};let r={H:3600*1e3,M:60*1e3,S:1e3,m:1,u:.001,n:1e-6}[n[2]]*parseInt(n[1]);return r>t?{timeoutMs:r,error:new W(`timeout ${r}ms must be <= ${t}`,q.InvalidArgument)}:{timeoutMs:r}}function Ge(...e){let t=new Map,n=e.reduce((e,t)=>e.concat(`supported`in t?t.supported:t),[]);function r(e){if(e===null||e.length==0)return!1;let r=t.get(e);if(r!==void 0)return r;let i=n.some(t=>t.test(e));return t.size<1024&&t.set(e,i),i}return r.supported=n,r}var Ke=function(e){return this instanceof Ke?(this.v=e,this):new Ke(e)},Y=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Ke?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}},qe=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},Je=function(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:Ke(e[r](t)),done:!1}:i?i(t):t}:i}};async function Ye(e,t,n,r){let{message:i}=await oe(async n=>({message:u(e.method.O,await e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!1,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),r)({init:{method:t.requestMethod},message:n,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!1});return i}function Xe(e,t,n){switch(e.kind){case Ne.Unary:return function(r){return Y(this,arguments,function*(){let i=r[Symbol.asyncIterator](),a=yield Ke(i.next());if(a.done===!0)throw new W(`protocol error: missing input message for unary method`,q.Unimplemented);let{message:o,header:s,trailer:c}=yield Ke(oe(async n=>({message:u(e.method.O,await e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!1,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:a.value,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!1}));if(Ze(s,t.responseHeader),Ze(c,t.responseTrailer),yield yield Ke(o),(yield Ke(i.next())).done!==!0)throw new W(`protocol error: received extra input message for unary method`,q.Unimplemented)})};case Ne.ServerStreaming:return function(r){return Y(this,arguments,function*(){let i=r[Symbol.asyncIterator](),a=yield Ke(i.next());if(a.done===!0)throw new W(`protocol error: missing input message for server-streaming method`,q.Unimplemented);let{message:o,header:s,trailer:c}=yield Ke(oe(async n=>({message:x(e.method.O,e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!0,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:a.value,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!1}));if(Ze(s,t.responseHeader),Ze(c,t.responseTrailer),yield Ke(yield*Je(qe(o))),(yield Ke(i.next())).done!==!0)throw new W(`protocol error: received extra input message for server-streaming method`,q.Unimplemented)})};case Ne.ClientStreaming:return function(r){return Y(this,arguments,function*(){let{message:i,header:a,trailer:o}=yield Ke(oe(async n=>({message:u(e.method.O,await e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!1,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:r,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!0}));Ze(a,t.responseHeader),Ze(o,t.responseTrailer),yield yield Ke(i)})};case Ne.BiDiStreaming:return function(r){return Y(this,arguments,function*(){let{message:i,header:a,trailer:o}=yield Ke(oe(async n=>({message:x(e.method.O,e.impl(n.message,Object.assign(Object.assign({},t),{service:n.service,method:n.method,requestHeader:n.header,values:n.contextValues,signal:n.signal}))),stream:!0,service:n.service,method:n.method,header:t.responseHeader,trailer:t.responseTrailer}),n)({init:{method:t.requestMethod},message:r,url:t.url,signal:t.signal,service:e.service,method:e.method,header:t.requestHeader,contextValues:t.values,stream:!0}));Ze(a,t.responseHeader),Ze(o,t.responseTrailer),yield Ke(yield*Je(qe(i)))})}}}function Ze(e,t){e!==t&&(t.forEach((e,n)=>{t.delete(n)}),e.forEach((e,n)=>{t.set(n,e)}))}function Qe(e){if(!(typeof e.body==`object`&&e.body!==null&&Symbol.asyncIterator in e.body))throw Error(`byte stream required, but received JSON`)}const $e={status:200},et={status:404},tt={status:415},nt={status:405},rt={status:505};function it(e){e??={};let t=e.acceptCompression?[...e.acceptCompression]:[],n=e.requireConnectProtocolHeader??!1,r=e.maxTimeoutMs??2**53-1;return Object.assign(Object.assign({acceptCompression:t},Ce(e.readMaxBytes,e.writeMaxBytes,e.compressMinBytes)),{jsonOptions:e.jsonOptions,binaryOptions:e.binaryOptions,maxTimeoutMs:r,shutdownSignal:e.shutdownSignal,requireConnectProtocolHeader:n,interceptors:e.interceptors??[]})}function at(e,t){return Object.entries(e.methods).map(([,e])=>ot(e,t))}function ot(e,t){return st(t.map(t=>t(e)))}function st(e){if(e.length==0)throw new W(`at least one protocol is required`,q.Internal);let t=e[0].service,n=e[0].method,r=e[0].requestPath;if(e.some(e=>e.service!==t||e.method!==n))throw new W(`cannot negotiate protocol for different RPCs`,q.Internal);if(e.some(e=>e.requestPath!==r))throw new W(`cannot negotiate protocol for different requestPaths`,q.Internal);async function i(t){if(n.kind==Ne.BiDiStreaming&&t.httpVersion.startsWith(`1.`))return Object.assign(Object.assign({},rt),{header:new Headers({Connection:`close`})});let r=t.header.get(`Content-Type`)??``,i=e.filter(e=>e.allowedMethods.includes(t.method));if(i.length==0)return nt;if(i.length==1&&r===``){let e=i[0];return e(t)}let a=i.filter(e=>e.supportedContentType(r));if(a.length==0)return tt;let o=a[0];return o(t)}return Object.assign(i,{service:t,method:n,requestPath:r,supportedContentType:Ge(...e.map(e=>e.supportedContentType)),protocolNames:e.flatMap(e=>e.protocolNames).filter((e,t,n)=>n.indexOf(e)===t),allowedMethods:e.flatMap(e=>e.allowedMethods).filter((e,t,n)=>n.indexOf(e)===t)})}const ct=`grpc-web`,lt=`POST`;function ut(e){let t=it(e),n=fe();function r(e){let r=dt(t,n,e);return Object.assign(r,{protocolNames:[ct],allowedMethods:[lt],supportedContentType:Ge(H),requestPath:b(`/`,e.service,e.method),service:e.service,method:e.method})}return r.protocolName=ct,r}function dt(t,n,r){let i=s(r.method,t.binaryOptions,t.jsonOptions,t);return async function(a){Qe(a);let o=ce(a.header.get(E));if(o==null||o.text)return tt;if(a.method!==lt)return nt;let s=We(a.header.get(k),t.maxTimeoutMs),c=Ve(Object.assign(Object.assign({},r),{requestMethod:a.method,protocolName:ct,timeoutMs:s.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:a.signal,requestHeader:a.header,url:a.url,responseHeader:{[E]:o.binary?de:M},responseTrailer:{[ue]:m},contextValues:a.contextValues})),l=Oe(t.acceptCompression,a.header.get(U),a.header.get(L),L);l.response&&c.responseHeader.set(U,l.response.name);let u=Ee(a.body,xe(()=>{if(l.error)throw l.error;if(s.error)throw s.error}),Me(t.readMaxBytes),J(l.request,t.readMaxBytes),je(i.getI(o.binary),j)),d=Xe(r,c,t.interceptors)(u)[Symbol.asyncIterator](),f=Ee({[Symbol.asyncIterator](){return{next:()=>d.next(),throw:e=>(c.abort(e),d.throw?.call(d,e)??Promise.reject({done:!0})),return:e=>(c.abort(),d.return?.call(d,e)??Promise.resolve({done:!0,value:e}))}}},Ae(i.getO(o.binary)),we(t=>(c.abort(),t instanceof W?e(c.responseTrailer,t):t!==void 0&&e(c.responseTrailer,new W(`internal error`,q.Internal,void 0,void 0,t)),{flags:j,data:n.serialize(c.responseTrailer)})),ke(l.response,t.compressMinBytes),ve(),{propagateDownStreamError:!0});return Object.assign(Object.assign({},$e),{body:await be(f),header:c.responseHeader})}}const ft=/^application\/grpc(?:\+(?:(json)(?:; ?charset=utf-?8)?|proto))?$/i,pt=`application/grpc+proto`,mt=`application/grpc+json`;function ht(e){let t=e?.match(ft);if(t)return{binary:!t[1]}}const gt=`grpc`,_t=`POST`;function vt(e){let t=it(e);function n(e){let n=yt(t,e);return Object.assign(n,{protocolNames:[gt],allowedMethods:[_t],supportedContentType:Ge(ft),requestPath:b(`/`,e.service,e.method),service:e.service,method:e.method})}return n.protocolName=gt,n}function yt(t,n){let r=s(n.method,t.binaryOptions,t.jsonOptions,t);return async function(i){Qe(i);let a=ht(i.header.get(E));if(a==null)return tt;if(i.method!==_t)return nt;let o=We(i.header.get(k),t.maxTimeoutMs),s=Ve(Object.assign(Object.assign({},n),{requestMethod:i.method,protocolName:gt,timeoutMs:o.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:i.signal,requestHeader:i.header,url:i.url,responseHeader:{[E]:a.binary?pt:mt},responseTrailer:{[ue]:m},contextValues:i.contextValues})),c=Oe(t.acceptCompression,i.header.get(U),i.header.get(L),L);c.response&&s.responseHeader.set(U,c.response.name);let l=Ee(i.body,xe(()=>{if(c.error)throw c.error;if(o.error)throw o.error}),Me(t.readMaxBytes),J(c.request,t.readMaxBytes),je(r.getI(a.binary))),u=Xe(n,s,t.interceptors)(l)[Symbol.asyncIterator](),d=Ee({[Symbol.asyncIterator](){return{next:()=>u.next(),throw:e=>(s.abort(e),u.throw?.call(u,e)??Promise.reject({done:!0})),return:e=>(s.abort(),u.return?.call(u,e)??Promise.resolve({done:!0,value:e}))}}},Ae(r.getO(a.binary)),ke(c.response,t.compressMinBytes),ve(),we(t=>{s.abort(),t instanceof W?e(s.responseTrailer,t):t!==void 0&&e(s.responseTrailer,new W(`internal error`,q.Internal,void 0,void 0,t))}),{propagateDownStreamError:!0});return Object.assign(Object.assign({},$e),{body:await be(d),header:s.responseHeader,trailer:s.responseTrailer})}}function bt(e,t){if(e===null)return{};let n=/^\d{1,10}$/.exec(e);if(n===null)return{error:new W(`protocol error: invalid connect timeout value: ${e}`,q.InvalidArgument)};let r=parseInt(n[0]);return r>t?{timeoutMs:r,error:new W(`timeout ${r}ms must be <= ${t}`,q.InvalidArgument)}:{timeoutMs:parseInt(n[0])}}const xt=`connect`,St=`POST`;function Ct(e){let n=it(e),r=t(n.jsonOptions);function i(e){let t,i,a=s(e.method,n.binaryOptions,n.jsonOptions,n);switch(e.kind){case Ne.Unary:i=y,t=wt(n,e,a);break;default:i=h,t=Ot(n,e,a,r);break}let o=[St];return e.method.idempotency===Fe.NoSideEffects&&o.push(`GET`),Object.assign(t,{protocolNames:[xt],supportedContentType:Ge(i),allowedMethods:o,requestPath:b(`/`,e.service,e.method),service:e.service,method:e.method})}return i.protocolName=xt,i}function wt(e,t,s){return async function(l){let u=l.method==`GET`;if(u&&t.method.idempotency!=Fe.NoSideEffects)return nt;let d=new URL(l.url).searchParams,p=u?d.get(ge):l.header.get(R),m=u?v(d.get(D)):c(l.header.get(r));if(m==null||m.stream)return tt;let h=bt(l.header.get(a),e.maxTimeoutMs),_=Ve(Object.assign(Object.assign({},t),{requestMethod:l.method,protocolName:xt,timeoutMs:h.timeoutMs,shutdownSignal:e.shutdownSignal,requestSignal:l.signal,requestHeader:l.header,url:l.url,responseHeader:{[r]:m.binary?n:_e},contextValues:l.contextValues})),y=Oe(e.acceptCompression,p,l.header.get(i),i),b=$e.status,x;try{if(e.requireConnectProtocolHeader&&(u?F(d):z(l.header)),y.error)throw y.error;if(h.error)throw h.error;let n;n=u?await Et(e.readMaxBytes,y.request,d):await Tt(e.readMaxBytes,y.request,l);let r=await Ye(t,_,Dt(t.method,m.binary,s,n),e.interceptors);x=s.getO(m.binary).serialize(r)}catch(t){let n;n=t instanceof W?t:new W(`internal error`,q.Internal,void 0,void 0,t),b=g(n.code),_.responseHeader.set(r,_e),n.metadata.forEach((e,t)=>{_.responseHeader.set(t,e)}),x=o(n,e.jsonOptions)}finally{_.abort()}y.response&&x.byteLength>=e.compressMinBytes&&(x=await y.response.compress(x),_.responseHeader.set(R,y.response.name));let S=C(_.responseHeader,_.responseTrailer);return S.set(f,x.byteLength.toString(10)),{status:b,body:Te([x]),header:S}}}async function Tt(e,t,n){if(typeof n.body==`object`&&n.body!==null&&Symbol.asyncIterator in n.body){let r=await ye(n.body,e,n.header.get(f));return t&&(r=await t.decompress(r,e)),r}return n.body}async function Et(e,t,n){let r=n.get(pe),i=n.get(he)??``,a;return a=r===`1`?Pe.dec(i):new TextEncoder().encode(i),t&&(a=await t.decompress(a,e)),a}function Dt(e,t,n,r){if(r instanceof Uint8Array)return n.getI(t).parse(r);if(t)throw new W(`received parsed JSON request body, but content-type indicates binary format`,q.Internal);try{return e.I.fromJson(r)}catch(e){throw W.from(e,q.InvalidArgument)}}function Ot(e,t,n,i){return async function(o){Qe(o);let s=c(o.header.get(r));if(s==null||!s.stream)return tt;if(o.method!==St)return nt;let u=bt(o.header.get(a),e.maxTimeoutMs),f=Ve(Object.assign(Object.assign({},t),{requestMethod:o.method,protocolName:xt,timeoutMs:u.timeoutMs,shutdownSignal:e.shutdownSignal,requestSignal:o.signal,requestHeader:o.header,url:o.url,responseHeader:{[r]:s.binary?d:l},contextValues:o.contextValues})),p=Oe(e.acceptCompression,o.header.get(_),o.header.get(me),me);p.response&&f.responseHeader.set(_,p.response.name);let m=Ee(o.body,xe(()=>{if(e.requireConnectProtocolHeader&&z(o.header),p.error)throw p.error;if(u.error)throw u.error}),Me(e.readMaxBytes),J(p.request,e.readMaxBytes),je(n.getI(s.binary),ee)),h=Xe(t,f,e.interceptors)(m)[Symbol.asyncIterator](),g=Ee({[Symbol.asyncIterator](){return{next:()=>h.next(),throw:e=>(f.abort(e),h.throw?.call(h,e)??Promise.reject({done:!0})),return:e=>(f.abort(),h.return?.call(h,e)??Promise.resolve({done:!0,value:e}))}}},Ae(n.getO(s.binary)),we(e=>{f.abort();let t={metadata:f.responseTrailer};return e instanceof W?t.error=e:e!==void 0&&(t.error=new W(`internal error`,q.Internal,void 0,void 0,e)),{flags:ee,data:i.serialize(t)}}),ke(p.response,e.compressMinBytes),ve(),{propagateDownStreamError:!0});return Object.assign(Object.assign({},$e),{body:await be(g),header:f.responseHeader})}}function kt(e){let t=At(e),n=[];return{handlers:n,service(e,r,i){let{protocols:a}=At(i,t);return n.push(...at(Ue(e,r),a)),this},rpc(e,r,i,a){let o,s,c,l;`typeName`in e?(o=e,s=r,c=i,l=a):(o=Object.assign(Object.assign({},e.service),{methods:{}}),s=e,c=r,l=i);let{protocols:u}=At(l,t);return n.push(ot(He(o,s,c),u)),this}}}function At(e,t){if(t&&!e)return t;let n=t?Object.assign(Object.assign({},it(t.options)),e):Object.assign(Object.assign({},e),it(e??{})),r=[];if(e?.grpc!==!1&&r.push(vt(n)),e?.grpcWeb!==!1&&r.push(ut(n)),e?.connect!==!1&&r.push(Ct(n)),r.length===0)throw new W(`cannot create handler, all protocols are disabled`,q.InvalidArgument);return{options:n,protocols:r}}var jt=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},Mt=function(e){return this instanceof Mt?(this.v=e,this):new Mt(e)},Nt=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Mt?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function Pt(e){return{async unary(t,n,r,i,a,o,c){let l=s(n,e.binaryOptions,e.jsonOptions,e);return i=i===void 0?e.defaultTimeoutMs:i<=0?void 0:i,await O({interceptors:e.interceptors,signal:r,timeoutMs:i,req:{stream:!1,service:t,method:n,url:b(e.baseUrl,t,n),init:{},header:ie(n.kind,e.useBinaryFormat,i,a,e.acceptCompression,e.sendCompression,!0),contextValues:c??ae(),message:o},next:async r=>{let i=l.getI(e.useBinaryFormat).serialize(r.message);e.sendCompression&&i.byteLength>e.compressMinBytes?(i=await e.sendCompression.compress(i),r.header.set(R,e.sendCompression.name)):r.header.delete(R);let a=e.useHttpGet===!0&&n.idempotency===Fe.NoSideEffects,o;a?r=te(r,i,e.useBinaryFormat):o=Te([i]);let s=await e.httpClient({url:r.url,method:r.init.method??`POST`,header:r.header,signal:r.signal,body:o}),{compression:c,isUnaryError:u,unaryError:d}=A(n.kind,e.acceptCompression,e.useBinaryFormat,s.status,s.header),[m,h]=N(s.header),g=await De(s.body,Se(e.readMaxBytes,s.header.get(f)),{propagateDownStreamError:!1});if(c&&(g=await c.decompress(g,e.readMaxBytes)),u)throw p(g,w(m,h),d);return{stream:!1,service:t,method:n,header:m,message:l.getO(e.useBinaryFormat).parse(g),trailer:h}}})},async stream(n,r,i,a,o,c,l){let u=s(r,e.binaryOptions,e.jsonOptions,e),d=t(e.jsonOptions);return a=a===void 0?e.defaultTimeoutMs:a<=0?void 0:a,le({interceptors:e.interceptors,signal:i,timeoutMs:a,req:{stream:!0,service:n,method:r,url:b(e.baseUrl,n,r),init:{method:`POST`,redirect:`error`,mode:`cors`},header:ie(r.kind,e.useBinaryFormat,a,o,e.acceptCompression,e.sendCompression,!0),contextValues:l??ae(),message:c},next:async t=>{let n=await e.httpClient({url:t.url,method:`POST`,header:t.header,signal:t.signal,body:Ee(t.message,Ae(u.getI(e.useBinaryFormat)),ke(e.sendCompression,e.compressMinBytes),ve(),{propagateDownStreamError:!0})}),{compression:i}=A(r.kind,e.acceptCompression,e.useBinaryFormat,n.status,n.header),a=Object.assign(Object.assign({},t),{header:n.header,trailer:new Headers,message:Ee(n.body,Me(e.readMaxBytes),J(i??null,e.readMaxBytes),je(u.getO(e.useBinaryFormat),ee,d),function(e){return Nt(this,arguments,function*(){var t,r,i,o;let s=!1;try{for(var c=!0,l=jt(e),u;u=yield Mt(l.next()),t=u.done,!t;c=!0){o=u.value,c=!1;let e=o;if(e.end){if(s)throw new W(`protocol error: received extra EndStreamResponse`,q.InvalidArgument);if(s=!0,e.value.error){let t=e.value.error;throw n.header.forEach((e,n)=>{t.metadata.append(n,e)}),t}e.value.metadata.forEach((e,t)=>a.trailer.set(t,e));continue}if(s)throw new W(`protocol error: received extra message after EndStreamResponse`,q.InvalidArgument);yield yield Mt(e.value)}}catch(e){r={error:e}}finally{try{!c&&!t&&(i=l.return)&&(yield Mt(i.call(l)))}finally{if(r)throw r.error}}if(!s)throw new W(`protocol error: missing EndStreamResponse`,q.InvalidArgument)})},{propagateDownStreamError:!0})});return a}})}}}var X=G(((e,t)=>{t.exports={kClose:Symbol(`close`),kDestroy:Symbol(`destroy`),kDispatch:Symbol(`dispatch`),kUrl:Symbol(`url`),kWriting:Symbol(`writing`),kResuming:Symbol(`resuming`),kQueue:Symbol(`queue`),kConnect:Symbol(`connect`),kConnecting:Symbol(`connecting`),kHeadersList:Symbol(`headers list`),kKeepAliveDefaultTimeout:Symbol(`default keep alive timeout`),kKeepAliveMaxTimeout:Symbol(`max keep alive timeout`),kKeepAliveTimeoutThreshold:Symbol(`keep alive timeout threshold`),kKeepAliveTimeoutValue:Symbol(`keep alive timeout`),kKeepAlive:Symbol(`keep alive`),kHeadersTimeout:Symbol(`headers timeout`),kBodyTimeout:Symbol(`body timeout`),kServerName:Symbol(`server name`),kLocalAddress:Symbol(`local address`),kHost:Symbol(`host`),kNoRef:Symbol(`no ref`),kBodyUsed:Symbol(`used`),kRunning:Symbol(`running`),kBlocking:Symbol(`blocking`),kPending:Symbol(`pending`),kSize:Symbol(`size`),kBusy:Symbol(`busy`),kQueued:Symbol(`queued`),kFree:Symbol(`free`),kConnected:Symbol(`connected`),kClosed:Symbol(`closed`),kNeedDrain:Symbol(`need drain`),kReset:Symbol(`reset`),kDestroyed:Symbol.for(`nodejs.stream.destroyed`),kMaxHeadersSize:Symbol(`max headers size`),kRunningIdx:Symbol(`running index`),kPendingIdx:Symbol(`pending index`),kError:Symbol(`error`),kClients:Symbol(`clients`),kClient:Symbol(`client`),kParser:Symbol(`parser`),kOnDestroyed:Symbol(`destroy callbacks`),kPipelining:Symbol(`pipelining`),kSocket:Symbol(`socket`),kHostHeader:Symbol(`host header`),kConnector:Symbol(`connector`),kStrictContentLength:Symbol(`strict content length`),kMaxRedirections:Symbol(`maxRedirections`),kMaxRequests:Symbol(`maxRequestsPerClient`),kProxy:Symbol(`proxy agent options`),kCounter:Symbol(`socket request counter`),kInterceptors:Symbol(`dispatch interceptors`),kMaxResponseSize:Symbol(`max response size`),kHTTP2Session:Symbol(`http2Session`),kHTTP2SessionState:Symbol(`http2Session state`),kHTTP2BuildRequest:Symbol(`http2 build request`),kHTTP1BuildRequest:Symbol(`http1 build request`),kHTTP2CopyHeaders:Symbol(`http2 copy headers`),kHTTPConnVersion:Symbol(`http connection version`),kRetryHandlerDefaultRetry:Symbol(`retry agent default retry`),kConstruct:Symbol(`constructable`)}})),Z=G(((e,t)=>{var n=class extends Error{constructor(e){super(e),this.name=`UndiciError`,this.code=`UND_ERR`}},r=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ConnectTimeoutError`,this.message=t||`Connect Timeout Error`,this.code=`UND_ERR_CONNECT_TIMEOUT`}},i=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`HeadersTimeoutError`,this.message=t||`Headers Timeout Error`,this.code=`UND_ERR_HEADERS_TIMEOUT`}},a=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`HeadersOverflowError`,this.message=t||`Headers Overflow Error`,this.code=`UND_ERR_HEADERS_OVERFLOW`}},o=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`BodyTimeoutError`,this.message=t||`Body Timeout Error`,this.code=`UND_ERR_BODY_TIMEOUT`}},s=class e extends n{constructor(t,n,r,i){super(t),Error.captureStackTrace(this,e),this.name=`ResponseStatusCodeError`,this.message=t||`Response Status Code Error`,this.code=`UND_ERR_RESPONSE_STATUS_CODE`,this.body=i,this.status=n,this.statusCode=n,this.headers=r}},c=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`InvalidArgumentError`,this.message=t||`Invalid Argument Error`,this.code=`UND_ERR_INVALID_ARG`}},l=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`InvalidReturnValueError`,this.message=t||`Invalid Return Value Error`,this.code=`UND_ERR_INVALID_RETURN_VALUE`}},u=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`AbortError`,this.message=t||`Request aborted`,this.code=`UND_ERR_ABORTED`}},d=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`InformationalError`,this.message=t||`Request information`,this.code=`UND_ERR_INFO`}},f=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`RequestContentLengthMismatchError`,this.message=t||`Request body length does not match content-length header`,this.code=`UND_ERR_REQ_CONTENT_LENGTH_MISMATCH`}},p=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ResponseContentLengthMismatchError`,this.message=t||`Response body length does not match content-length header`,this.code=`UND_ERR_RES_CONTENT_LENGTH_MISMATCH`}},m=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ClientDestroyedError`,this.message=t||`The client is destroyed`,this.code=`UND_ERR_DESTROYED`}},h=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ClientClosedError`,this.message=t||`The client is closed`,this.code=`UND_ERR_CLOSED`}},g=class e extends n{constructor(t,n){super(t),Error.captureStackTrace(this,e),this.name=`SocketError`,this.message=t||`Socket error`,this.code=`UND_ERR_SOCKET`,this.socket=n}},_=class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`NotSupportedError`,this.message=t||`Not supported error`,this.code=`UND_ERR_NOT_SUPPORTED`}},v=class extends n{constructor(e){super(e),Error.captureStackTrace(this,_),this.name=`MissingUpstreamError`,this.message=e||`No upstream has been added to the BalancedPool`,this.code=`UND_ERR_BPL_MISSING_UPSTREAM`}};t.exports={HTTPParserError:class e extends Error{constructor(t,n,r){super(t),Error.captureStackTrace(this,e),this.name=`HTTPParserError`,this.code=n?`HPE_${n}`:void 0,this.data=r?r.toString():void 0}},UndiciError:n,HeadersTimeoutError:i,HeadersOverflowError:a,BodyTimeoutError:o,RequestContentLengthMismatchError:f,ConnectTimeoutError:r,ResponseStatusCodeError:s,InvalidArgumentError:c,InvalidReturnValueError:l,RequestAbortedError:u,ClientDestroyedError:m,ClientClosedError:h,InformationalError:d,SocketError:g,NotSupportedError:_,ResponseContentLengthMismatchError:p,BalancedPoolMissingUpstreamError:v,ResponseExceededMaxSizeError:class e extends n{constructor(t){super(t),Error.captureStackTrace(this,e),this.name=`ResponseExceededMaxSizeError`,this.message=t||`Response content exceeded max size`,this.code=`UND_ERR_RES_EXCEEDED_MAX_SIZE`}},RequestRetryError:class e extends n{constructor(t,n,{headers:r,data:i}){super(t),Error.captureStackTrace(this,e),this.name=`RequestRetryError`,this.message=t||`Request retry error`,this.code=`UND_ERR_REQ_RETRY`,this.statusCode=n,this.data=i,this.headers=r}}}})),Ft=G(((e,t)=>{let n={},r=`Accept.Accept-Encoding.Accept-Language.Accept-Ranges.Access-Control-Allow-Credentials.Access-Control-Allow-Headers.Access-Control-Allow-Methods.Access-Control-Allow-Origin.Access-Control-Expose-Headers.Access-Control-Max-Age.Access-Control-Request-Headers.Access-Control-Request-Method.Age.Allow.Alt-Svc.Alt-Used.Authorization.Cache-Control.Clear-Site-Data.Connection.Content-Disposition.Content-Encoding.Content-Language.Content-Length.Content-Location.Content-Range.Content-Security-Policy.Content-Security-Policy-Report-Only.Content-Type.Cookie.Cross-Origin-Embedder-Policy.Cross-Origin-Opener-Policy.Cross-Origin-Resource-Policy.Date.Device-Memory.Downlink.ECT.ETag.Expect.Expect-CT.Expires.Forwarded.From.Host.If-Match.If-Modified-Since.If-None-Match.If-Range.If-Unmodified-Since.Keep-Alive.Last-Modified.Link.Location.Max-Forwards.Origin.Permissions-Policy.Pragma.Proxy-Authenticate.Proxy-Authorization.RTT.Range.Referer.Referrer-Policy.Refresh.Retry-After.Sec-WebSocket-Accept.Sec-WebSocket-Extensions.Sec-WebSocket-Key.Sec-WebSocket-Protocol.Sec-WebSocket-Version.Server.Server-Timing.Service-Worker-Allowed.Service-Worker-Navigation-Preload.Set-Cookie.SourceMap.Strict-Transport-Security.Supports-Loading-Mode.TE.Timing-Allow-Origin.Trailer.Transfer-Encoding.Upgrade.Upgrade-Insecure-Requests.User-Agent.Vary.Via.WWW-Authenticate.X-Content-Type-Options.X-DNS-Prefetch-Control.X-Frame-Options.X-Permitted-Cross-Domain-Policies.X-Powered-By.X-Requested-With.X-XSS-Protection`.split(`.`);for(let e=0;e<r.length;++e){let t=r[e],i=t.toLowerCase();n[t]=n[i]=i}Object.setPrototypeOf(n,null),t.exports={wellknownHeaderNames:r,headerNameLowerCasedRecord:n}})),Q=G(((e,t)=>{let n=K(`assert`),{kDestroyed:r,kBodyUsed:i}=X(),{IncomingMessage:a}=K(`http`),o=K(`stream`),s=K(`net`),{InvalidArgumentError:c}=Z(),{Blob:l}=K(`buffer`),u=K(`util`),{stringify:d}=K(`querystring`),{headerNameLowerCasedRecord:f}=Ft(),[p,m]=process.versions.node.split(`.`).map(e=>Number(e));function h(){}function g(e){return e&&typeof e==`object`&&typeof e.pipe==`function`&&typeof e.on==`function`}function _(e){return l&&e instanceof l||e&&typeof e==`object`&&(typeof e.stream==`function`||typeof e.arrayBuffer==`function`)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function v(e,t){if(e.includes(`?`)||e.includes(`#`))throw Error(`Query params cannot be passed when url already contains "?" or "#".`);let n=d(t);return n&&(e+=`?`+n),e}function y(e){if(typeof e==`string`){if(e=new URL(e),!/^https?:/.test(e.origin||e.protocol))throw new c("Invalid URL protocol: the URL must start with `http:` or `https:`.");return e}if(!e||typeof e!=`object`)throw new c(`Invalid URL: The URL argument must be a non-null object.`);if(!/^https?:/.test(e.origin||e.protocol))throw new c("Invalid URL protocol: the URL must start with `http:` or `https:`.");if(!(e instanceof URL)){if(e.port!=null&&e.port!==``&&!Number.isFinite(parseInt(e.port)))throw new c(`Invalid URL: port must be a valid integer or a string representation of an integer.`);if(e.path!=null&&typeof e.path!=`string`)throw new c(`Invalid URL path: the path must be a string or null/undefined.`);if(e.pathname!=null&&typeof e.pathname!=`string`)throw new c(`Invalid URL pathname: the pathname must be a string or null/undefined.`);if(e.hostname!=null&&typeof e.hostname!=`string`)throw new c(`Invalid URL hostname: the hostname must be a string or null/undefined.`);if(e.origin!=null&&typeof e.origin!=`string`)throw new c(`Invalid URL origin: the origin must be a string or null/undefined.`);let t=e.port==null?e.protocol===`https:`?443:80:e.port,n=e.origin==null?`${e.protocol}//${e.hostname}:${t}`:e.origin,r=e.path==null?`${e.pathname||``}${e.search||``}`:e.path;n.endsWith(`/`)&&(n=n.substring(0,n.length-1)),r&&!r.startsWith(`/`)&&(r=`/${r}`),e=new URL(n+r)}return e}function b(e){if(e=y(e),e.pathname!==`/`||e.search||e.hash)throw new c(`invalid url`);return e}function x(e){if(e[0]===`[`){let t=e.indexOf(`]`);return n(t!==-1),e.substring(1,t)}let t=e.indexOf(`:`);return t===-1?e:e.substring(0,t)}function S(e){if(!e)return null;n.strictEqual(typeof e,`string`);let t=x(e);return s.isIP(t)?``:t}function C(e){return JSON.parse(JSON.stringify(e))}function w(e){return e!=null&&typeof e[Symbol.asyncIterator]==`function`}function T(e){return e!=null&&(typeof e[Symbol.iterator]==`function`||typeof e[Symbol.asyncIterator]==`function`)}function E(e){if(e==null)return 0;if(g(e)){let t=e._readableState;return t&&t.objectMode===!1&&t.ended===!0&&Number.isFinite(t.length)?t.length:null}else if(_(e))return e.size==null?null:e.size;else if(F(e))return e.byteLength;return null}function D(e){return!e||!!(e.destroyed||e[r])}function O(e){let t=e&&e._readableState;return D(e)&&t&&!t.endEmitted}function k(e,t){e==null||!g(e)||D(e)||(typeof e.destroy==`function`?(Object.getPrototypeOf(e).constructor===a&&(e.socket=null),e.destroy(t)):t&&process.nextTick((e,t)=>{e.emit(`error`,t)},e,t),e.destroyed!==!0&&(e[r]=!0))}let A=/timeout=(\d+)/;function j(e){let t=e.toString().match(A);return t?parseInt(t[1],10)*1e3:null}function M(e){return f[e]||e.toLowerCase()}function N(e,t={}){if(!Array.isArray(e))return e;for(let n=0;n<e.length;n+=2){let r=e[n].toString().toLowerCase(),i=t[r];i?(Array.isArray(i)||(i=[i],t[r]=i),i.push(e[n+1].toString(`utf8`))):Array.isArray(e[n+1])?t[r]=e[n+1].map(e=>e.toString(`utf8`)):t[r]=e[n+1].toString(`utf8`)}return`content-length`in t&&`content-disposition`in t&&(t[`content-disposition`]=Buffer.from(t[`content-disposition`]).toString(`latin1`)),t}function P(e){let t=[],n=!1,r=-1;for(let i=0;i<e.length;i+=2){let a=e[i+0].toString(),o=e[i+1].toString(`utf8`);a.length===14&&(a===`content-length`||a.toLowerCase()===`content-length`)?(t.push(a,o),n=!0):a.length===19&&(a===`content-disposition`||a.toLowerCase()===`content-disposition`)?r=t.push(a,o)-1:t.push(a,o)}return n&&r!==-1&&(t[r]=Buffer.from(t[r]).toString(`latin1`)),t}function F(e){return e instanceof Uint8Array||Buffer.isBuffer(e)}function I(e,t,n){if(!e||typeof e!=`object`)throw new c(`handler must be an object`);if(typeof e.onConnect!=`function`)throw new c(`invalid onConnect method`);if(typeof e.onError!=`function`)throw new c(`invalid onError method`);if(typeof e.onBodySent!=`function`&&e.onBodySent!==void 0)throw new c(`invalid onBodySent method`);if(n||t===`CONNECT`){if(typeof e.onUpgrade!=`function`)throw new c(`invalid onUpgrade method`)}else{if(typeof e.onHeaders!=`function`)throw new c(`invalid onHeaders method`);if(typeof e.onData!=`function`)throw new c(`invalid onData method`);if(typeof e.onComplete!=`function`)throw new c(`invalid onComplete method`)}}function L(e){return!!(e&&(o.isDisturbed?o.isDisturbed(e)||e[i]:e[i]||e.readableDidRead||e._readableState&&e._readableState.dataEmitted||O(e)))}function ee(e){return!!(e&&(o.isErrored?o.isErrored(e):/state: 'errored'/.test(u.inspect(e))))}function R(e){return!!(e&&(o.isReadable?o.isReadable(e):/state: 'readable'/.test(u.inspect(e))))}function te(e){return{localAddress:e.localAddress,localPort:e.localPort,remoteAddress:e.remoteAddress,remotePort:e.remotePort,remoteFamily:e.remoteFamily,timeout:e.timeout,bytesWritten:e.bytesWritten,bytesRead:e.bytesRead}}async function*ne(e){for await(let t of e)yield Buffer.isBuffer(t)?t:Buffer.from(t)}let z;function B(e){if(z||=K(`stream/web`).ReadableStream,z.from)return z.from(ne(e));let t;return new z({async start(){t=e[Symbol.asyncIterator]()},async pull(e){let{done:n,value:r}=await t.next();if(n)queueMicrotask(()=>{e.close()});else{let t=Buffer.isBuffer(r)?r:Buffer.from(r);e.enqueue(new Uint8Array(t))}return e.desiredSize>0},async cancel(e){await t.return()}},0)}function V(e){return e&&typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&e[Symbol.toStringTag]===`FormData`}function H(e){if(e){if(typeof e.throwIfAborted==`function`)e.throwIfAborted();else if(e.aborted){let e=Error(`The operation was aborted`);throw e.name=`AbortError`,e}}}function re(e,t){return`addEventListener`in e?(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)):(e.addListener(`abort`,t),()=>e.removeListener(`abort`,t))}let U=!!String.prototype.toWellFormed;function ie(e){return U?`${e}`.toWellFormed():u.toUSVString?u.toUSVString(e):`${e}`}function ae(e){if(e==null||e===``)return{start:0,end:null,size:null};let t=e?e.match(/^bytes (\d+)-(\d+)\/(\d+)?$/):null;return t?{start:parseInt(t[1]),end:t[2]?parseInt(t[2]):null,size:t[3]?parseInt(t[3]):null}:null}let oe=Object.create(null);oe.enumerable=!0,t.exports={kEnumerableProperty:oe,nop:h,isDisturbed:L,isErrored:ee,isReadable:R,toUSVString:ie,isReadableAborted:O,isBlobLike:_,parseOrigin:b,parseURL:y,getServerName:S,isStream:g,isIterable:T,isAsyncIterable:w,isDestroyed:D,headerNameToString:M,parseRawHeaders:P,parseHeaders:N,parseKeepAliveTimeout:j,destroy:k,bodyLength:E,deepClone:C,ReadableStreamFrom:B,isBuffer:F,validateHandler:I,getSocketInfo:te,isFormDataLike:V,buildURL:v,throwIfAborted:H,addAbortListener:re,parseRangeHeader:ae,nodeMajor:p,nodeMinor:m,nodeHasAutoSelectFamily:p>18||p===18&&m>=13,safeHTTPMethods:[`GET`,`HEAD`,`OPTIONS`,`TRACE`]}})),It=G(((e,t)=>{let n=Date.now(),r,i=[];function a(){n=Date.now();let e=i.length,t=0;for(;t<e;){let r=i[t];r.state===0?r.state=n+r.delay:r.state>0&&n>=r.state&&(r.state=-1,r.callback(r.opaque)),r.state===-1?(r.state=-2,t===e-1?i.pop():i[t]=i.pop(),--e):t+=1}i.length>0&&o()}function o(){r&&r.refresh?r.refresh():(clearTimeout(r),r=setTimeout(a,1e3),r.unref&&r.unref())}var s=class{constructor(e,t,n){this.callback=e,this.delay=t,this.opaque=n,this.state=-2,this.refresh()}refresh(){this.state===-2&&(i.push(this),(!r||i.length===1)&&o()),this.state=0}clear(){this.state=-1}};t.exports={setTimeout(e,t,n){return t<1e3?setTimeout(e,t,n):new s(e,t,n)},clearTimeout(e){e instanceof s?e.clear():clearTimeout(e)}}})),Lt=G(((e,t)=>{let n=K(`node:events`).EventEmitter,r=K(`node:util`).inherits;function i(e){if(typeof e==`string`&&(e=Buffer.from(e)),!Buffer.isBuffer(e))throw TypeError(`The needle has to be a String or a Buffer.`);let t=e.length;if(t===0)throw Error(`The needle cannot be an empty String/Buffer.`);if(t>256)throw Error(`The needle cannot have a length bigger than 256.`);this.maxMatches=1/0,this.matches=0,this._occ=Array(256).fill(t),this._lookbehind_size=0,this._needle=e,this._bufpos=0,this._lookbehind=Buffer.alloc(t);for(var n=0;n<t-1;++n)this._occ[e[n]]=t-1-n}r(i,n),i.prototype.reset=function(){this._lookbehind_size=0,this.matches=0,this._bufpos=0},i.prototype.push=function(e,t){Buffer.isBuffer(e)||(e=Buffer.from(e,`binary`));let n=e.length;this._bufpos=t||0;let r;for(;r!==n&&this.matches<this.maxMatches;)r=this._sbmh_feed(e);return r},i.prototype._sbmh_feed=function(e){let t=e.length,n=this._needle,r=n.length,i=n[r-1],a=-this._lookbehind_size,o;if(a<0){for(;a<0&&a<=t-r;){if(o=this._sbmh_lookup_char(e,a+r-1),o===i&&this._sbmh_memcmp(e,a,r-1))return this._lookbehind_size=0,++this.matches,this.emit(`info`,!0),this._bufpos=a+r;a+=this._occ[o]}if(a<0)for(;a<0&&!this._sbmh_memcmp(e,a,t-a);)++a;if(a>=0)this.emit(`info`,!1,this._lookbehind,0,this._lookbehind_size),this._lookbehind_size=0;else{let n=this._lookbehind_size+a;return n>0&&this.emit(`info`,!1,this._lookbehind,0,n),this._lookbehind.copy(this._lookbehind,0,n,this._lookbehind_size-n),this._lookbehind_size-=n,e.copy(this._lookbehind,this._lookbehind_size),this._lookbehind_size+=t,this._bufpos=t,t}}if(a+=(a>=0)*this._bufpos,e.indexOf(n,a)!==-1)return a=e.indexOf(n,a),++this.matches,a>0?this.emit(`info`,!0,e,this._bufpos,a):this.emit(`info`,!0),this._bufpos=a+r;for(a=t-r;a<t&&(e[a]!==n[0]||Buffer.compare(e.subarray(a,a+t-a),n.subarray(0,t-a))!==0);)++a;return a<t&&(e.copy(this._lookbehind,0,a,a+(t-a)),this._lookbehind_size=t-a),a>0&&this.emit(`info`,!1,e,this._bufpos,a<t?a:t),this._bufpos=t,t},i.prototype._sbmh_lookup_char=function(e,t){return t<0?this._lookbehind[this._lookbehind_size+t]:e[t]},i.prototype._sbmh_memcmp=function(e,t,n){for(var r=0;r<n;++r)if(this._sbmh_lookup_char(e,t+r)!==this._needle[r])return!1;return!0},t.exports=i})),Rt=G(((e,t)=>{let n=K(`node:util`).inherits,r=K(`node:stream`).Readable;function i(e){r.call(this,e)}n(i,r),i.prototype._read=function(e){},t.exports=i})),zt=G(((e,t)=>{t.exports=function(e,t,n){if(!e||e[t]===void 0||e[t]===null)return n;if(typeof e[t]!=`number`||isNaN(e[t]))throw TypeError(`Limit `+t+` is not a valid number`);return e[t]}})),Bt=G(((e,t)=>{let n=K(`node:events`).EventEmitter,r=K(`node:util`).inherits,i=zt(),a=Lt(),o=Buffer.from(`\r
3
3
  \r
4
4
  `),s=/\r\n/g,c=/^([^:]+):[ \t]?([\x00-\xFF]+)?$/;function l(e){n.call(this),e||={};let t=this;this.nread=0,this.maxed=!1,this.npairs=0,this.maxHeaderPairs=i(e,`maxHeaderPairs`,2e3),this.maxHeaderSize=i(e,`maxHeaderSize`,80*1024),this.buffer=``,this.header={},this.finished=!1,this.ss=new a(o),this.ss.on(`info`,function(e,n,r,i){n&&!t.maxed&&(t.nread+i-r>=t.maxHeaderSize?(i=t.maxHeaderSize-t.nread+r,t.nread=t.maxHeaderSize,t.maxed=!0):t.nread+=i-r,t.buffer+=n.toString(`binary`,r,i)),e&&t._finish()})}r(l,n),l.prototype.push=function(e){let t=this.ss.push(e);if(this.finished)return t},l.prototype.reset=function(){this.finished=!1,this.buffer=``,this.header={},this.ss.reset()},l.prototype._finish=function(){this.buffer&&this._parseHeader(),this.ss.matches=this.ss.maxMatches;let e=this.header;this.header={},this.buffer=``,this.finished=!0,this.nread=this.npairs=0,this.maxed=!1,this.emit(`header`,e)},l.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs)return;let e=this.buffer.split(s),t=e.length,n,r;for(var i=0;i<t;++i){if(e[i].length===0)continue;if((e[i][0]===` `||e[i][0]===` `)&&r){this.header[r][this.header[r].length-1]+=e[i];continue}let t=e[i].indexOf(`:`);if(t===-1||t===0)return;if(n=c.exec(e[i]),r=n[1].toLowerCase(),this.header[r]=this.header[r]||[],this.header[r].push(n[2]||``),++this.npairs===this.maxHeaderPairs)break}},t.exports=l})),Vt=G(((e,t)=>{let n=K(`node:stream`).Writable,r=K(`node:util`).inherits,i=Lt(),a=Rt(),o=Bt(),s=Buffer.from(`-`),c=Buffer.from(`\r
5
5
  `),l=function(){};function u(e){if(!(this instanceof u))return new u(e);if(n.call(this,e),!e||!e.headerFirst&&typeof e.boundary!=`string`)throw TypeError(`Boundary required`);typeof e.boundary==`string`?this.setBoundary(e.boundary):this._bparser=void 0,this._headerFirst=e.headerFirst,this._dashes=0,this._parts=0,this._finished=!1,this._realFinish=!1,this._isPreamble=!0,this._justMatched=!1,this._firstWrite=!0,this._inHeader=!0,this._part=void 0,this._cb=void 0,this._ignoreData=!1,this._partOpts={highWaterMark:e.partHwm},this._pause=!1;let t=this;this._hparser=new o(e),this._hparser.on(`header`,function(e){t._inHeader=!1,t._part.emit(`header`,e)})}r(u,n),u.prototype.emit=function(e){if(e===`finish`&&!this._realFinish){if(!this._finished){let e=this;process.nextTick(function(){if(e.emit(`error`,Error(`Unexpected end of multipart data`)),e._part&&!e._ignoreData){let t=e._isPreamble?`Preamble`:`Part`;e._part.emit(`error`,Error(t+` terminated early due to unexpected end of multipart data`)),e._part.push(null),process.nextTick(function(){e._realFinish=!0,e.emit(`finish`),e._realFinish=!1});return}e._realFinish=!0,e.emit(`finish`),e._realFinish=!1})}}else n.prototype.emit.apply(this,arguments)},u.prototype._write=function(e,t,n){if(!this._hparser&&!this._bparser)return n();if(this._headerFirst&&this._isPreamble){this._part||(this._part=new a(this._partOpts),this.listenerCount(`preamble`)===0?this._ignore():this.emit(`preamble`,this._part));let t=this._hparser.push(e);if(!this._inHeader&&t!==void 0&&t<e.length)e=e.slice(t);else return n()}this._firstWrite&&=(this._bparser.push(c),!1),this._bparser.push(e),this._pause?this._cb=n:n()},u.prototype.reset=function(){this._part=void 0,this._bparser=void 0,this._hparser=void 0},u.prototype.setBoundary=function(e){let t=this;this._bparser=new i(`\r