alchemylab-opencode 2.0.1 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/NODE_COMPAT.md +8 -1
  2. package/dist/20260127222353_familiar_lady_ursula-YYOFSQD5.js +18 -0
  3. package/dist/20260211171708_add_project_commands-3GKQTPBZ.js +18 -0
  4. package/dist/20260213144116_wakeful_the_professor-ROO7OAVL.js +18 -0
  5. package/dist/20260225215848_workspace-V2OZTNFF.js +18 -0
  6. package/dist/20260227213759_add_session_workspace_id-GVDWAXKM.js +18 -0
  7. package/dist/20260228203230_blue_harpoon-Z5QP2II5.js +18 -0
  8. package/dist/20260303231226_add_workspace_fields-QOVAFN7W.js +18 -0
  9. package/dist/20260309230000_move_org_to_state-RQURSDZD.js +18 -0
  10. package/dist/20260312043431_session_message_cursor-VBISKDXL.js +18 -0
  11. package/dist/20260323234822_events-PILJHLNA.js +18 -0
  12. package/dist/20260410174513_workspace-name-63YCZ5NS.js +18 -0
  13. package/dist/20260413175956_chief_energizer-NMAZYGDO.js +18 -0
  14. package/dist/20260423070820_add_icon_url_override-RAJCVNEP.js +18 -0
  15. package/dist/20260427172553_slow_nightmare-ULYYZLR4.js +18 -0
  16. package/dist/20260428004200_add_session_path-U4WO2TGE.js +18 -0
  17. package/dist/20260501142318_next_venus-6BCYATSC.js +18 -0
  18. package/dist/20260504145000_add_sync_owner-RGVHV6LN.js +18 -0
  19. package/dist/20260507164347_add_workspace_time-GE6UHNPM.js +18 -0
  20. package/dist/{20260510033149_session_usage-UGBVOXZB.js → 20260510033149_session_usage-7XHCFVKY.js} +5 -1
  21. package/dist/20260511000411_data_migration_state-2EGZKFLB.js +18 -0
  22. package/dist/20260511173437_session-metadata-K322YY33.js +18 -0
  23. package/dist/20260601010001_normalize_storage_paths-VZDTY366.js +18 -0
  24. package/dist/{20260225215848_workspace-ZMSOZSPA.js → 20260601202201_amazing_prowler-YT6PLK3L.js} +5 -1
  25. package/dist/{20260228203230_blue_harpoon-IW3Z4TQZ.js → 20260602002951_lowly_union_jack-6VLQTBVB.js} +5 -1
  26. package/dist/20260602182828_add_project_directories-TVSRD25A.js +18 -0
  27. package/dist/20260603001617_session_message_projection_indexes-PHKTF6HK.js +18 -0
  28. package/dist/{20260622170816_reset_v2_session_state-5JPHJTZG.js → 20260603040000_session_message_projection_order-7RTV2POG.js} +5 -1
  29. package/dist/20260603141458_session_input_inbox-RSBWABG7.js +18 -0
  30. package/dist/20260603160727_jittery_ezekiel_stane-DXBLLRVV.js +18 -0
  31. package/dist/20260604172448_event_sourced_session_input-H6Z3JEBD.js +18 -0
  32. package/dist/20260605003541_add_session_context_snapshot-6FDPM2TK.js +18 -0
  33. package/dist/20260605042240_add_context_epoch_agent-C2OF2UKR.js +18 -0
  34. package/dist/20260611035744_credential-YNZ47FSH.js +18 -0
  35. package/dist/20260611192811_lush_chimera-E357VI6P.js +18 -0
  36. package/dist/20260612174303_project_dir_strategy-VUGGK42O.js +18 -0
  37. package/dist/20260622142730_simplify_session_context_epoch-UYGXZ5BX.js +18 -0
  38. package/dist/20260622170816_reset_v2_session_state-EILLPCJQ.js +18 -0
  39. package/dist/20260622202450_simplify_session_input-Y65GDGBO.js +18 -0
  40. package/dist/NodeSdk-AGMQWBHH.js +18 -0
  41. package/dist/anthropic-45OFTLAW.js +18 -0
  42. package/dist/anthropic-FVULF7C3.js +18 -0
  43. package/dist/app-runtime-LDQWNGWP.js +18 -0
  44. package/dist/chunk-2JE3QYG6.js +18 -0
  45. package/dist/chunk-2MRHL4B2.js +18 -0
  46. package/dist/chunk-4GJE6OMN.js +190 -0
  47. package/dist/chunk-4MBUHJHY.js +22 -0
  48. package/dist/chunk-5BLZCAU6.js +55 -0
  49. package/dist/chunk-7XX6TY62.js +259 -0
  50. package/dist/chunk-ANF3QA3Z.js +48 -0
  51. package/dist/chunk-AZUMH3TO.js +18 -0
  52. package/dist/chunk-B74WSFN4.js +878 -0
  53. package/dist/chunk-BQ4IEPN3.js +19 -0
  54. package/dist/chunk-CYRZU5QM.js +33 -0
  55. package/dist/chunk-DADVNQTM.js +1490 -0
  56. package/dist/chunk-DO2UZ6NY.js +18 -0
  57. package/dist/chunk-DWEYXIQI.js +780 -0
  58. package/dist/chunk-EK6FQQHY.js +20 -0
  59. package/dist/chunk-ELPXQ32J.js +90 -0
  60. package/dist/chunk-FGLPSSRK.js +19 -0
  61. package/dist/chunk-FOHYZ7MJ.js +55 -0
  62. package/dist/chunk-FV7U6PVP.js +18 -0
  63. package/dist/chunk-FYYAOZPU.js +18 -0
  64. package/dist/chunk-G7PFO5HG.js +920 -0
  65. package/dist/chunk-GDWO6EXN.js +22 -0
  66. package/dist/chunk-GW3ZRKAI.js +20 -0
  67. package/dist/chunk-IYUSBBGY.js +35 -0
  68. package/dist/chunk-JPOFLMNH.js +18 -0
  69. package/dist/{chunk-VURLSDCB.js → chunk-K5LKDIVU.js} +4 -0
  70. package/dist/chunk-KS4WLVK5.js +19 -0
  71. package/dist/chunk-LIXP4TPL.js +18 -0
  72. package/dist/chunk-LSC4RT5V.js +36 -0
  73. package/dist/chunk-M5A6NFHQ.js +28 -0
  74. package/dist/chunk-M6E6KNLV.js +30 -0
  75. package/dist/chunk-MLFZXUGQ.js +18 -0
  76. package/dist/chunk-NDI67DRG.js +31 -0
  77. package/dist/chunk-NGT6LCW6.js +18 -0
  78. package/dist/chunk-OCWGUTZJ.js +36 -0
  79. package/dist/chunk-OGDRUXMJ.js +18 -0
  80. package/dist/chunk-OGJKLJC7.js +29 -0
  81. package/dist/chunk-OT2YNR56.js +19 -0
  82. package/dist/chunk-OUVSKG2H.js +19 -0
  83. package/dist/chunk-P5RLCJUV.js +18 -0
  84. package/dist/chunk-Q3WIUQXB.js +18 -0
  85. package/dist/{20260227213759_add_session_workspace_id-ROENWPKA.js → chunk-QCRIXKIC.js} +5 -1
  86. package/dist/chunk-QD24DLUD.js +18 -0
  87. package/dist/chunk-R2GWBJEP.js +18 -0
  88. package/dist/chunk-RPAXSOGH.js +18 -0
  89. package/dist/chunk-TK5R7QUN.js +18 -0
  90. package/dist/chunk-TNQWZFIZ.js +28 -0
  91. package/dist/chunk-UCLPBO4I.js +18 -0
  92. package/dist/chunk-UPEPL4I2.js +18 -0
  93. package/dist/chunk-V6FDDNGV.js +117 -0
  94. package/dist/chunk-V6HERYFV.js +18 -0
  95. package/dist/chunk-V7XKKJ7X.js +24 -0
  96. package/dist/chunk-VHDYUBBS.js +23 -0
  97. package/dist/chunk-VWLJXTZ5.js +18 -0
  98. package/dist/chunk-VXAPFOIL.js +22 -0
  99. package/dist/chunk-WKZYINC7.js +29 -0
  100. package/dist/chunk-WPMP2ZFE.js +40 -0
  101. package/dist/chunk-WRTNIOI3.js +18 -0
  102. package/dist/chunk-X5F46HR5.js +18 -0
  103. package/dist/chunk-XPS7TQZG.js +22 -0
  104. package/dist/chunk-YJPP6IQ3.js +23 -0
  105. package/dist/chunk-ZYQWFC55.js +22 -0
  106. package/dist/code-mode-YYOGD36U.js +502 -0
  107. package/dist/copilot-provider-QVMLQZZC.js +18 -0
  108. package/dist/dist-5NQOHNPL.js +18 -0
  109. package/dist/dist-7CT3XCNN.js +32 -0
  110. package/dist/dist-CL46WFZG.js +18 -0
  111. package/dist/{20260605042240_add_context_epoch_agent-W6IQYZXE.js → dist-CYBRID2F.js} +5 -1
  112. package/dist/dist-HXJTF22W.js +32 -0
  113. package/dist/dist-JFXI53ZF.js +22 -0
  114. package/dist/dist-KBYKWVT5.js +22 -0
  115. package/dist/dist-KM5HCPZX.js +35 -0
  116. package/dist/dist-KTNLTEHB.js +18 -0
  117. package/dist/dist-KZ5R5QM5.js +24 -0
  118. package/dist/dist-NLXUYBW7.js +32 -0
  119. package/dist/dist-O4DF72J2.js +22 -0
  120. package/dist/dist-PH4MEGVR.js +22 -0
  121. package/dist/{20260511000411_data_migration_state-FB4LBFSE.js → dist-QJPOJCLB.js} +5 -1
  122. package/dist/dist-QYH62TCJ.js +22 -0
  123. package/dist/{20260303231226_add_workspace_fields-OUVZMNAG.js → dist-RIC4WKHC.js} +5 -1
  124. package/dist/dist-T776XKTM.js +22 -0
  125. package/dist/dist-TCE5MKZQ.js +23 -0
  126. package/dist/dist-TH2Q44RX.js +50 -0
  127. package/dist/dist-VV5FV5RT.js +101 -0
  128. package/dist/dist-XAFENVUS.js +22 -0
  129. package/dist/dist-XPFB35TX.js +32 -0
  130. package/dist/dist-YUH4RKR5.js +28 -0
  131. package/dist/dist-es-43ZM44MP.js +18 -0
  132. package/dist/dist-es-6PLFRCS4.js +18 -0
  133. package/dist/dist-es-G5UIJOU7.js +26 -0
  134. package/dist/{20260428004200_add_session_path-LGW75WYA.js → dist-es-HYIIGUNX.js} +5 -1
  135. package/dist/dist-es-L2GU465G.js +18 -0
  136. package/dist/dist-es-LSR2QCFZ.js +18 -0
  137. package/dist/dist-es-RGEIM2BP.js +18 -0
  138. package/dist/dist-es-SITTNOGV.js +18 -0
  139. package/dist/dist-es-W5GYOX6F.js +18 -0
  140. package/dist/esm-NN5W7YCL.js +18 -0
  141. package/dist/esm-XWJSHYHG.js +18 -0
  142. package/dist/getMachineId-bsd-L5I5TZ5I.js +18 -0
  143. package/dist/getMachineId-darwin-YB7KG37W.js +19 -0
  144. package/dist/getMachineId-linux-EL47KXX7.js +18 -0
  145. package/dist/getMachineId-unsupported-QOWPEBPN.js +18 -0
  146. package/dist/getMachineId-win-HCRYRDFJ.js +18 -0
  147. package/dist/lib-ZP7Q6A3E.js +199 -0
  148. package/dist/loadCognitoIdentity-EWT55EI7.js +18 -0
  149. package/dist/loadSso-AGOUE6RL.js +18 -0
  150. package/dist/{20260213144116_wakeful_the_professor-ZVDD54AK.js → loadSts-RH5L3PIX.js} +5 -1
  151. package/dist/mantle-IJXDXT4M.js +25 -0
  152. package/dist/mime-types-46EO4HOZ.js +18 -0
  153. package/dist/multipart-parser-KZWMKXA4.js +19 -0
  154. package/dist/{20260211171708_add_project_commands-GDOHPDPF.js → open-7KXTRM37.js} +5 -1
  155. package/dist/openai-ZOJI6I5R.js +18 -0
  156. package/dist/p-map-CYL6ILJW.js +18 -0
  157. package/dist/photon-W56QZY4L.js +18 -0
  158. package/dist/{20260423070820_add_icon_url_override-X5SHFGTI.js → pkce-VT4ITJTB.js} +5 -1
  159. package/dist/{pty.node-Y3N2XKYG.js → pty.node-IWULXXG6.js} +5 -1
  160. package/dist/run.js +5 -1
  161. package/dist/serve.js +143 -1
  162. package/dist/server-LVIHYOCY.js +21 -0
  163. package/dist/session-6OPJNJMK.js +18 -0
  164. package/dist/signin-OCIW23YM.js +18 -0
  165. package/dist/src-3NCXEROI.js +18 -0
  166. package/dist/src-LXWGIUZH.js +18 -0
  167. package/dist/src-WDYKISPD.js +20 -0
  168. package/dist/src-YAAFIGTW.js +18 -0
  169. package/dist/sso-oidc-OMMKINFE.js +18 -0
  170. package/dist/sts-MWK22JIX.js +18 -0
  171. package/dist/token-QPO3OAGS.js +18 -0
  172. package/dist/token-util-YGPCEEPO.js +18 -0
  173. package/dist/unified-W3ZKZ4HG.js +18 -0
  174. package/dist/worktree-32M5MTFE.js +18 -0
  175. package/package.json +40 -40
  176. package/postinstall.cjs +4 -2
  177. package/dist/20260127222353_familiar_lady_ursula-KV747FJX.js +0 -14
  178. package/dist/20260309230000_move_org_to_state-NOXAPU5V.js +0 -14
  179. package/dist/20260312043431_session_message_cursor-DJ4T3T4R.js +0 -14
  180. package/dist/20260323234822_events-72GIKJ2A.js +0 -14
  181. package/dist/20260410174513_workspace-name-JXSWFBJN.js +0 -14
  182. package/dist/20260413175956_chief_energizer-4HEWZ6U3.js +0 -14
  183. package/dist/20260427172553_slow_nightmare-PS5T2AH2.js +0 -14
  184. package/dist/20260501142318_next_venus-J3TLVXZ6.js +0 -14
  185. package/dist/20260504145000_add_sync_owner-3R52GB4C.js +0 -14
  186. package/dist/20260507164347_add_workspace_time-JHDRCZAR.js +0 -14
  187. package/dist/20260511173437_session-metadata-T2XHGWHS.js +0 -14
  188. package/dist/20260601010001_normalize_storage_paths-5MAY5GT3.js +0 -14
  189. package/dist/20260601202201_amazing_prowler-PET224YG.js +0 -14
  190. package/dist/20260602002951_lowly_union_jack-PG6XDMGL.js +0 -14
  191. package/dist/20260602182828_add_project_directories-ZCH2ACGG.js +0 -14
  192. package/dist/20260603001617_session_message_projection_indexes-XVLJTUF2.js +0 -14
  193. package/dist/20260603040000_session_message_projection_order-XG6RACZQ.js +0 -14
  194. package/dist/20260603141458_session_input_inbox-K2VQ7V6E.js +0 -14
  195. package/dist/20260603160727_jittery_ezekiel_stane-WKJLRDO7.js +0 -14
  196. package/dist/20260604172448_event_sourced_session_input-NTXOECR7.js +0 -14
  197. package/dist/20260605003541_add_session_context_snapshot-DXMQEXMT.js +0 -14
  198. package/dist/20260611035744_credential-XTMSYTJD.js +0 -14
  199. package/dist/20260611192811_lush_chimera-XPLIQMJD.js +0 -14
  200. package/dist/20260612174303_project_dir_strategy-FR2NGQKK.js +0 -14
  201. package/dist/20260622142730_simplify_session_context_epoch-NTQZR3RE.js +0 -14
  202. package/dist/20260622202450_simplify_session_input-2EXF2HMV.js +0 -14
  203. package/dist/app-runtime-HQBOCDV5.js +0 -14
  204. package/dist/chunk-4FEBIOI5.js +0 -865
  205. package/dist/chunk-4K2RXRZL.js +0 -14
  206. package/dist/chunk-4RFMKEKM.js +0 -1455
  207. package/dist/chunk-BM2C7NHL.js +0 -41
  208. package/dist/chunk-MKEMZFJI.js +0 -393
  209. package/dist/chunk-OMDJ6ZZ2.js +0 -684
  210. package/dist/chunk-OWMG4NNF.js +0 -186
  211. package/dist/chunk-QRABYJKL.js +0 -14
  212. package/dist/chunk-RHIWAYN5.js +0 -14
  213. package/dist/chunk-Z5TLIUAI.js +0 -28
  214. package/dist/code-mode-7BQJUARW.js +0 -40
  215. package/dist/copilot-provider-TX4YFKJZ.js +0 -14
  216. package/dist/photon-VQS5F5BI.js +0 -14
  217. package/dist/server-BFUQR7MX.js +0 -17
  218. package/dist/session-6RNXZNG6.js +0 -14
  219. package/dist/worktree-QHQHX3SG.js +0 -14
  220. package/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch +0 -164
  221. package/patches/@ai-sdk%2Fanthropic@3.0.111.patch +0 -528
  222. package/patches/@ai-sdk%2Fgoogle@3.0.73.patch +0 -69
  223. package/patches/@ai-sdk%2Fgroq@3.0.31.patch +0 -79
  224. package/patches/@ai-sdk%2Fmistral@3.0.51.patch +0 -714
  225. package/patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch +0 -39
  226. package/patches/@ai-sdk%2Fopenai@3.0.88.patch +0 -280
  227. package/patches/@ai-sdk%2Fxai@3.0.139.patch +0 -296
  228. package/patches/@modelcontextprotocol%2Fsdk@1.29.0.patch +0 -647
  229. package/patches/@npmcli%2Fagent@4.0.2.patch +0 -13
  230. package/patches/effect@4.0.0-beta.83.patch +0 -57
  231. package/patches/gcp-metadata@8.1.2.patch +0 -14
  232. package/patches/pacote@21.5.0.patch +0 -18
@@ -0,0 +1,55 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+ import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
14
+ import { dirname as __alchemyDirname } from 'node:path';
15
+ const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
16
+ const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
17
+
18
+ import{a as s,b as L,d as k}from"./chunk-2MRHL4B2.js";var Xr=k((Zf,is)=>{"use strict";var Wt=Object.prototype.hasOwnProperty,ns=Object.prototype.toString,Xi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Zi=s(function(e){return typeof Array.isArray=="function"?Array.isArray(e):ns.call(e)==="[object Array]"},"isArray"),es=s(function(e){if(!e||ns.call(e)!=="[object Object]")return!1;var t=Wt.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Wt.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!r)return!1;var i;for(i in e);return typeof i>"u"||Wt.call(e,i)},"isPlainObject"),ts=s(function(e,t){Xi&&t.name==="__proto__"?Xi(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},"setProperty"),rs=s(function(e,t){if(t==="__proto__")if(Wt.call(e,t)){if(Qi)return Qi(e,t).value}else return;return e[t]},"getProperty");is.exports=s(function n(){var e,t,r,i,o,u,l=arguments[0],d=1,T=arguments.length,v=!1;for(typeof l=="boolean"&&(v=l,l=arguments[1]||{},d=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});d<T;++d)if(e=arguments[d],e!=null)for(t in e)r=rs(l,t),i=rs(e,t),l!==i&&(v&&i&&(es(i)||(o=Zi(i)))?(o?(o=!1,u=r&&Zi(r)?r:[]):u=r&&es(r)?r:{},ts(l,{name:t,newValue:n(v,u,i)})):typeof i<"u"&&ts(l,{name:t,newValue:i}));return l},"extend")});var ss=k((th,Fa)=>{Fa.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var as=k((rh,os)=>{"use strict";var Ma=ss();os.exports={pkg:Ma}});var en=k(ve=>{"use strict";var us=ve&&ve.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ve,"__esModule",{value:!0});ve.GaxiosError=ve.GAXIOS_ERROR_SYMBOL=void 0;ve.defaultErrorRedactor=ls;var cs=us(Xr()),La=us(as()),Qr=La.default.pkg;ve.GAXIOS_ERROR_SYMBOL=Symbol.for(`${Qr.name}-gaxios-error`);var Zr=class n extends Error{static{s(this,"GaxiosError")}config;response;code;status;error;[ve.GAXIOS_ERROR_SYMBOL]=Qr.version;static[Symbol.hasInstance](e){return e&&typeof e=="object"&&ve.GAXIOS_ERROR_SYMBOL in e&&e[ve.GAXIOS_ERROR_SYMBOL]===Qr.version?!0:Function.prototype[Symbol.hasInstance].call(n,e)}constructor(e,t,r,i){if(super(e,{cause:i}),this.config=t,this.response=r,this.error=i instanceof Error?i:void 0,this.config=(0,cs.default)(!0,{},t),this.response&&(this.response.config=(0,cs.default)(!0,{},this.response.config)),this.response){try{this.response.data=Ga(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}i instanceof DOMException?this.code=i.name:i&&typeof i=="object"&&"code"in i&&(typeof i.code=="string"||typeof i.code=="number")&&(this.code=i.code)}static extractAPIErrorFromResponse(e,t="The request failed"){let r=t;if(typeof e.data=="string"&&(r=e.data),e.data&&typeof e.data=="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error=="string")return{message:e.data.error,code:e.status,status:e.statusText};if(typeof e.data.error=="object"){r="message"in e.data.error&&typeof e.data.error.message=="string"?e.data.error.message:r;let i="status"in e.data.error&&typeof e.data.error.status=="string"?e.data.error.status:e.statusText,o="code"in e.data.error&&typeof e.data.error.code=="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){let u=[];for(let l of e.data.error.errors)typeof l=="object"&&"message"in l&&typeof l.message=="string"&&u.push(l.message);return Object.assign({message:u.join(`
19
+ `)||r,code:o,status:i},e.data.error)}return Object.assign({message:r,code:o,status:i},e.data.error)}}return{message:r,code:e.status,status:e.statusText}}};ve.GaxiosError=Zr;function Ga(n,e){switch(n){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}s(Ga,"translateData");function ls(n){let e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function t(o){o&&o.forEach((u,l)=>{(/^authentication$/i.test(l)||/^authorization$/i.test(l)||/secret/i.test(l))&&o.set(l,e)})}s(t,"redactHeaders");function r(o,u){if(typeof o=="object"&&o!==null&&typeof o[u]=="string"){let l=o[u];(/grant_type=/i.test(l)||/assertion=/i.test(l)||/secret/i.test(l))&&(o[u]=e)}}s(r,"redactString");function i(o){!o||typeof o!="object"||(o instanceof FormData||o instanceof URLSearchParams||"forEach"in o&&"set"in o?o.forEach((u,l)=>{(["grant_type","assertion"].includes(l)||/secret/.test(l))&&o.set(l,e)}):("grant_type"in o&&(o.grant_type=e),"assertion"in o&&(o.assertion=e),"client_secret"in o&&(o.client_secret=e)))}return s(i,"redactObject"),n.config&&(t(n.config.headers),r(n.config,"data"),i(n.config.data),r(n.config,"body"),i(n.config.body),n.config.url.searchParams.has("token")&&n.config.url.searchParams.set("token",e),n.config.url.searchParams.has("client_secret")&&n.config.url.searchParams.set("client_secret",e)),n.response&&(ls({config:n.response.config}),t(n.response.headers),n.response.bodyUsed&&(r(n.response,"data"),i(n.response.data))),n}s(ls,"defaultErrorRedactor")});var hs=k(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getRetryConfig=Ba;async function Ba(n){let e=fs(n);if(!n||!n.config||!e&&!n.config.retry)return{shouldRetry:!1};e=e||{},e.currentRetryAttempt=e.currentRetryAttempt||0,e.retry=e.retry===void 0||e.retry===null?3:e.retry,e.httpMethodsToRetry=e.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],e.noResponseRetries=e.noResponseRetries===void 0||e.noResponseRetries===null?2:e.noResponseRetries,e.retryDelayMultiplier=e.retryDelayMultiplier?e.retryDelayMultiplier:2,e.timeOfFirstRequest=e.timeOfFirstRequest?e.timeOfFirstRequest:Date.now(),e.totalTimeout=e.totalTimeout?e.totalTimeout:Number.MAX_SAFE_INTEGER,e.maxRetryDelay=e.maxRetryDelay?e.maxRetryDelay:Number.MAX_SAFE_INTEGER;let t=[[100,199],[408,408],[429,429],[500,599]];if(e.statusCodesToRetry=e.statusCodesToRetry||t,n.config.retryConfig=e,!await(e.shouldRetry||Ha)(n))return{shouldRetry:!1,config:n.config};let i=$a(e);n.config.retryConfig.currentRetryAttempt+=1;let o=e.retryBackoff?e.retryBackoff(n,i):new Promise(u=>{setTimeout(u,i)});return e.onRetryAttempt&&await e.onRetryAttempt(n),await o,{shouldRetry:!0,config:n.config}}s(Ba,"getRetryConfig");function Ha(n){let e=fs(n);if(n.config.signal?.aborted&&n.code!=="TimeoutError"||n.code==="AbortError"||!e||e.retry===0||!n.response&&(e.currentRetryAttempt||0)>=e.noResponseRetries||!e.httpMethodsToRetry||!e.httpMethodsToRetry.includes(n.config.method?.toUpperCase()||"GET"))return!1;if(n.response&&n.response.status){let t=!1;for(let[r,i]of e.statusCodesToRetry){let o=n.response.status;if(o>=r&&o<=i){t=!0;break}}if(!t)return!1}return e.currentRetryAttempt=e.currentRetryAttempt||0,!(e.currentRetryAttempt>=e.retry)}s(Ha,"shouldRetryRequest");function fs(n){if(n&&n.config&&n.config.retryConfig)return n.config.retryConfig}s(fs,"getConfig");function $a(n){let t=(n.currentRetryAttempt?0:n.retryDelay??100)+(Math.pow(n.retryDelayMultiplier,n.currentRetryAttempt)-1)/2*1e3,r=n.totalTimeout-(Date.now()-n.timeOfFirstRequest);return Math.min(t,r,n.maxRetryDelay)}s($a,"getNextRetryDelay")});var nn=k(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.GaxiosInterceptorManager=void 0;var rn=class extends Set{static{s(this,"GaxiosInterceptorManager")}};Yt.GaxiosInterceptorManager=rn});var gs=k(at=>{"use strict";var Ka=at&&at.__importDefault||function(n){return n&&n.__esModule?n:{default:n}},ot;Object.defineProperty(at,"__esModule",{value:!0});at.Gaxios=void 0;var Ja=Ka(Xr()),Va=L("https"),et=en(),Wa=hs(),ds=L("stream"),ps=nn(),Ya=s(async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),"randomUUID"),za=204,zt=class{static{s(this,"Gaxios")}agentCache=new Map;defaults;interceptors;constructor(e){this.defaults=e||{},this.interceptors={request:new ps.GaxiosInterceptorManager,response:new ps.GaxiosInterceptorManager}}fetch(...e){let t=e[0],r=e[1],i,o=new Headers;return typeof t=="string"?i=new URL(t):t instanceof URL?i=t:t&&t.url&&(i=new URL(t.url)),t&&typeof t=="object"&&"headers"in t&&ot.mergeHeaders(o,t.headers),r&&ot.mergeHeaders(o,new Headers(r.headers)),typeof t=="object"&&!(t instanceof URL)?this.request({...r,...t,headers:o,url:i}):this.request({...r,headers:o,url:i})}async request(e={}){let t=await this.#n(e);return t=await this.#t(t),this.#r(this._request(t))}async _defaultAdapter(e){let t=e.fetchImplementation||this.defaults.fetchImplementation||await ot.#c(),r={...e};delete r.data;let i=await t(e.url,r),o=await this.getResponseData(e,i);return Object.getOwnPropertyDescriptor(i,"data")?.configurable||Object.defineProperties(i,{data:{configurable:!0,writable:!0,enumerable:!0,value:o}}),Object.assign(i,{config:e,data:o})}async _request(e){try{let t;if(e.adapter?t=await e.adapter(e,this._defaultAdapter.bind(this)):t=await this._defaultAdapter(e),!e.validateStatus(t.status)){if(e.responseType==="stream"){let i=[];for await(let o of t.data)i.push(o);t.data=i.toString()}let r=et.GaxiosError.extractAPIErrorFromResponse(t,`Request failed with status code ${t.status}`);throw new et.GaxiosError(r?.message,e,t,r)}return t}catch(t){let r;t instanceof et.GaxiosError?r=t:t instanceof Error?r=new et.GaxiosError(t.message,e,void 0,t):r=new et.GaxiosError("Unexpected Gaxios Error",e,void 0,t);let{shouldRetry:i,config:o}=await(0,Wa.getRetryConfig)(r);if(i&&o)return r.config.retryConfig.currentRetryAttempt=o.retryConfig.currentRetryAttempt,e.retryConfig=r.config?.retryConfig,this.#i(e),this._request(e);throw e.errorRedactor&&e.errorRedactor(r),r}}async getResponseData(e,t){if(t.status===za)return"";if(e.maxContentLength&&t.headers.has("content-length")&&e.maxContentLength<Number.parseInt(t.headers?.get("content-length")||""))throw new et.GaxiosError("Response's `Content-Length` is over the limit.",e,Object.assign(t,{config:e}));switch(e.responseType){case"stream":return t.body;case"json":{let r=await t.text();try{return JSON.parse(r)}catch{return r}}case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"text":return t.text();default:return this.getResponseDataFromContentType(t)}}#e(e,t=[]){let r=new URL(e),i=[...t],o=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let u of o)i.push(u.trim());for(let u of i)if(u instanceof RegExp){if(u.test(r.toString()))return!1}else if(u instanceof URL){if(u.origin===r.origin)return!1}else if(u.startsWith("*.")||u.startsWith(".")){let l=u.replace(/^\*\./,".");if(r.hostname.endsWith(l))return!1}else if(u===r.origin||u===r.hostname||u===r.href)return!1;return!0}async#t(e){let t=Promise.resolve(e);for(let r of this.interceptors.request.values())r&&(t=t.then(r.resolved,r.rejected));return t}async#r(e){let t=Promise.resolve(e);for(let r of this.interceptors.response.values())r&&(t=t.then(r.resolved,r.rejected));return t}async#n(e){let t=new Headers(this.defaults.headers);ot.mergeHeaders(t,e.headers);let r=(0,Ja.default)(!0,{},this.defaults,e);if(!r.url)throw new Error("URL is required.");if(r.baseURL&&(r.url=new URL(r.url,r.baseURL)),r.url=new URL(r.url),r.params)if(r.paramsSerializer){let u=r.paramsSerializer(r.params);u.startsWith("?")&&(u=u.slice(1));let l=r.url.toString().includes("?")?"&":"?";r.url=r.url+l+u}else{let u=r.url instanceof URL?r.url:new URL(r.url);for(let[l,d]of new URLSearchParams(r.params))u.searchParams.append(l,d);r.url=u}typeof e.maxContentLength=="number"&&(r.size=e.maxContentLength),typeof e.maxRedirects=="number"&&(r.follow=e.maxRedirects);let i=typeof r.data=="string"||r.data instanceof ArrayBuffer||r.data instanceof Blob||globalThis.File&&r.data instanceof File||r.data instanceof FormData||r.data instanceof ds.Readable||r.data instanceof ReadableStream||r.data instanceof String||r.data instanceof URLSearchParams||ArrayBuffer.isView(r.data)||["Blob","File","FormData"].includes(r.data?.constructor?.name||"");if(r.multipart?.length){let u=await Ya();t.set("content-type",`multipart/related; boundary=${u}`),r.body=ds.Readable.from(this.getMultipartRequest(r.multipart,u))}else i?r.body=r.data:typeof r.data=="object"?t.get("Content-Type")==="application/x-www-form-urlencoded"?r.body=r.paramsSerializer?r.paramsSerializer(r.data):new URLSearchParams(r.data):(t.has("content-type")||t.set("content-type","application/json"),r.body=JSON.stringify(r.data)):r.data&&(r.body=r.data);r.validateStatus=r.validateStatus||this.validateStatus,r.responseType=r.responseType||"unknown",!t.has("accept")&&r.responseType==="json"&&t.set("accept","application/json");let o=r.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(!r.agent)if(o&&this.#e(r.url,r.noProxy)){let u=await ot.#a();this.agentCache.has(o)?r.agent=this.agentCache.get(o):(r.agent=new u(o,{cert:r.cert,key:r.key}),this.agentCache.set(o,r.agent))}else r.cert&&r.key&&(this.agentCache.has(r.key)?r.agent=this.agentCache.get(r.key):(r.agent=new Va.Agent({cert:r.cert,key:r.key}),this.agentCache.set(r.key,r.agent)));return typeof r.errorRedactor!="function"&&r.errorRedactor!==!1&&(r.errorRedactor=et.defaultErrorRedactor),r.body&&!("duplex"in r)&&(r.duplex="half"),this.#i(r),Object.assign(r,{headers:t,url:r.url instanceof URL?r.url:new URL(r.url)})}#i(e){if(e.timeout){let t=AbortSignal.timeout(e.timeout);e.signal&&!e.signal.aborted?e.signal=AbortSignal.any([e.signal,t]):e.signal=t}}validateStatus(e){return e>=200&&e<300}async getResponseDataFromContentType(e){let t=e.headers.get("Content-Type");if(t===null)return e.text();if(t=t.toLowerCase(),t.includes("application/json")){let r=await e.text();try{r=JSON.parse(r)}catch{}return r}else return t.match(/^text\//)?e.text():e.blob()}async*getMultipartRequest(e,t){let r=`--${t}--`;for(let i of e){let o=i.headers.get("Content-Type")||"application/octet-stream";yield`--${t}\r
20
+ Content-Type: ${o}\r
21
+ \r
22
+ `,typeof i.content=="string"?yield i.content:yield*i.content,yield`\r
23
+ `}yield r}static#s;static#o;static async#a(){return this.#s||=(await import("./dist-CYBRID2F.js")).HttpsProxyAgent,this.#s}static async#c(){let e=typeof window<"u"&&!!window;return this.#o||=e?window.fetch:(await import("./src-WDYKISPD.js")).default,this.#o}static mergeHeaders(e,...t){e=e instanceof Headers?e:new Headers(e);for(let r of t)(r instanceof Headers?r:new Headers(r)).forEach((o,u)=>{u==="set-cookie"?e.append(u,o):e.set(u,o)});return e}};at.Gaxios=zt;ot=zt});var ce=k(he=>{"use strict";var Xa=he&&he.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:s(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Qa=he&&he.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Xa(e,n,t)};Object.defineProperty(he,"__esModule",{value:!0});he.instance=he.Gaxios=he.GaxiosError=void 0;he.request=ec;var ys=gs();Object.defineProperty(he,"Gaxios",{enumerable:!0,get:s(function(){return ys.Gaxios},"get")});var Za=en();Object.defineProperty(he,"GaxiosError",{enumerable:!0,get:s(function(){return Za.GaxiosError},"get")});Qa(nn(),he);he.instance=new ys.Gaxios;async function ec(n){return he.instance.request(n)}s(ec,"request")});var sn=k((ms,Xt)=>{(function(n){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,i=Math.floor,o="[BigNumber Error] ",u=o+"Number primitive has more than 15 significant digits: ",l=1e14,d=14,T=9007199254740991,v=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,b=1e9;function F(M){var N,D,G,O=C.prototype={constructor:C,toString:null,valueOf:null},Q=new C(1),J=20,H=4,oe=-7,z=21,ne=-1e7,Z=1e7,ie=!1,$e=1,de=0,Kr={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},Ze="0123456789abcdefghijklmnopqrstuvwxyz",Jr=!0;function C(a,c){var f,_,p,y,E,h,g,w,m=this;if(!(m instanceof C))return new C(a,c);if(c==null){if(a&&a._isBigNumber===!0){m.s=a.s,!a.c||a.e>Z?m.c=m.e=null:a.e<ne?m.c=[m.e=0]:(m.e=a.e,m.c=a.c.slice());return}if((h=typeof a=="number")&&a*0==0){if(m.s=1/a<0?(a=-a,-1):1,a===~~a){for(y=0,E=a;E>=10;E/=10,y++);y>Z?m.c=m.e=null:(m.e=y,m.c=[a]);return}w=String(a)}else{if(!t.test(w=String(a)))return G(m,w,h);m.s=w.charCodeAt(0)==45?(w=w.slice(1),-1):1}(y=w.indexOf("."))>-1&&(w=w.replace(".","")),(E=w.search(/e/i))>0?(y<0&&(y=E),y+=+w.slice(E+1),w=w.substring(0,E)):y<0&&(y=w.length)}else{if(R(c,2,Ze.length,"Base"),c==10&&Jr)return m=new C(a),Ae(m,J+m.e+1,H);if(w=String(a),h=typeof a=="number"){if(a*0!=0)return G(m,w,h,c);if(m.s=1/a<0?(w=w.slice(1),-1):1,C.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(u+a)}else m.s=w.charCodeAt(0)===45?(w=w.slice(1),-1):1;for(f=Ze.slice(0,c),y=E=0,g=w.length;E<g;E++)if(f.indexOf(_=w.charAt(E))<0){if(_=="."){if(E>y){y=g;continue}}else if(!p&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){p=!0,E=-1,y=0;continue}return G(m,String(a),h,c)}h=!1,w=D(w,c,10,m.s),(y=w.indexOf("."))>-1?w=w.replace(".",""):y=w.length}for(E=0;w.charCodeAt(E)===48;E++);for(g=w.length;w.charCodeAt(--g)===48;);if(w=w.slice(E,++g)){if(g-=E,h&&C.DEBUG&&g>15&&(a>T||a!==i(a)))throw Error(u+m.s*a);if((y=y-E-1)>Z)m.c=m.e=null;else if(y<ne)m.c=[m.e=0];else{if(m.e=y,m.c=[],E=(y+1)%d,y<0&&(E+=d),E<g){for(E&&m.c.push(+w.slice(0,E)),g-=d;E<g;)m.c.push(+w.slice(E,E+=d));E=d-(w=w.slice(E)).length}else E-=g;for(;E--;w+="0");m.c.push(+w)}}else m.c=[m.e=0]}s(C,"BigNumber"),C.clone=F,C.ROUND_UP=0,C.ROUND_DOWN=1,C.ROUND_CEIL=2,C.ROUND_FLOOR=3,C.ROUND_HALF_UP=4,C.ROUND_HALF_DOWN=5,C.ROUND_HALF_EVEN=6,C.ROUND_HALF_CEIL=7,C.ROUND_HALF_FLOOR=8,C.EUCLID=9,C.config=C.set=function(a){var c,f;if(a!=null)if(typeof a=="object"){if(a.hasOwnProperty(c="DECIMAL_PLACES")&&(f=a[c],R(f,0,b,c),J=f),a.hasOwnProperty(c="ROUNDING_MODE")&&(f=a[c],R(f,0,8,c),H=f),a.hasOwnProperty(c="EXPONENTIAL_AT")&&(f=a[c],f&&f.pop?(R(f[0],-b,0,c),R(f[1],0,b,c),oe=f[0],z=f[1]):(R(f,-b,b,c),oe=-(z=f<0?-f:f))),a.hasOwnProperty(c="RANGE"))if(f=a[c],f&&f.pop)R(f[0],-b,-1,c),R(f[1],1,b,c),ne=f[0],Z=f[1];else if(R(f,-b,b,c),f)ne=-(Z=f<0?-f:f);else throw Error(o+c+" cannot be zero: "+f);if(a.hasOwnProperty(c="CRYPTO"))if(f=a[c],f===!!f)if(f)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))ie=f;else throw ie=!f,Error(o+"crypto unavailable");else ie=f;else throw Error(o+c+" not true or false: "+f);if(a.hasOwnProperty(c="MODULO_MODE")&&(f=a[c],R(f,0,9,c),$e=f),a.hasOwnProperty(c="POW_PRECISION")&&(f=a[c],R(f,0,b,c),de=f),a.hasOwnProperty(c="FORMAT"))if(f=a[c],typeof f=="object")Kr=f;else throw Error(o+c+" not an object: "+f);if(a.hasOwnProperty(c="ALPHABET"))if(f=a[c],typeof f=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(f))Jr=f.slice(0,10)=="0123456789",Ze=f;else throw Error(o+c+" invalid: "+f)}else throw Error(o+"Object expected: "+a);return{DECIMAL_PLACES:J,ROUNDING_MODE:H,EXPONENTIAL_AT:[oe,z],RANGE:[ne,Z],CRYPTO:ie,MODULO_MODE:$e,POW_PRECISION:de,FORMAT:Kr,ALPHABET:Ze}},C.isBigNumber=function(a){if(!a||a._isBigNumber!==!0)return!1;if(!C.DEBUG)return!0;var c,f,_=a.c,p=a.e,y=a.s;e:if({}.toString.call(_)=="[object Array]"){if((y===1||y===-1)&&p>=-b&&p<=b&&p===i(p)){if(_[0]===0){if(p===0&&_.length===1)return!0;break e}if(c=(p+1)%d,c<1&&(c+=d),String(_[0]).length==c){for(c=0;c<_.length;c++)if(f=_[c],f<0||f>=l||f!==i(f))break e;if(f!==0)return!0}}}else if(_===null&&p===null&&(y===null||y===1||y===-1))return!0;throw Error(o+"Invalid BigNumber: "+a)},C.maximum=C.max=function(){return zi(arguments,-1)},C.minimum=C.min=function(){return zi(arguments,1)},C.random=(function(){var a=9007199254740992,c=Math.random()*a&2097151?function(){return i(Math.random()*a)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(f){var _,p,y,E,h,g=0,w=[],m=new C(Q);if(f==null?f=J:R(f,0,b),E=r(f/d),ie)if(crypto.getRandomValues){for(_=crypto.getRandomValues(new Uint32Array(E*=2));g<E;)h=_[g]*131072+(_[g+1]>>>11),h>=9e15?(p=crypto.getRandomValues(new Uint32Array(2)),_[g]=p[0],_[g+1]=p[1]):(w.push(h%1e14),g+=2);g=E/2}else if(crypto.randomBytes){for(_=crypto.randomBytes(E*=7);g<E;)h=(_[g]&31)*281474976710656+_[g+1]*1099511627776+_[g+2]*4294967296+_[g+3]*16777216+(_[g+4]<<16)+(_[g+5]<<8)+_[g+6],h>=9e15?crypto.randomBytes(7).copy(_,g):(w.push(h%1e14),g+=7);g=E/7}else throw ie=!1,Error(o+"crypto unavailable");if(!ie)for(;g<E;)h=c(),h<9e15&&(w[g++]=h%1e14);for(E=w[--g],f%=d,E&&f&&(h=v[d-f],w[g]=i(E/h)*h);w[g]===0;w.pop(),g--);if(g<0)w=[y=0];else{for(y=-1;w[0]===0;w.splice(0,1),y-=d);for(g=1,h=w[0];h>=10;h/=10,g++);g<d&&(y-=d-g)}return m.e=y,m.c=w,m}})(),C.sum=function(){for(var a=1,c=arguments,f=new C(c[0]);a<c.length;)f=f.plus(c[a++]);return f},D=(function(){var a="0123456789";function c(f,_,p,y){for(var E,h=[0],g,w=0,m=f.length;w<m;){for(g=h.length;g--;h[g]*=_);for(h[0]+=y.indexOf(f.charAt(w++)),E=0;E<h.length;E++)h[E]>p-1&&(h[E+1]==null&&(h[E+1]=0),h[E+1]+=h[E]/p|0,h[E]%=p)}return h.reverse()}return s(c,"toBaseOut"),function(f,_,p,y,E){var h,g,w,m,S,U,j,K,ee=f.indexOf("."),ae=J,$=H;for(ee>=0&&(m=de,de=0,f=f.replace(".",""),K=new C(_),U=K.pow(f.length-ee),de=m,K.c=c(re(I(U.c),U.e,"0"),10,p,a),K.e=K.c.length),j=c(f,_,p,E?(h=Ze,a):(h=a,Ze)),w=m=j.length;j[--m]==0;j.pop());if(!j[0])return h.charAt(0);if(ee<0?--w:(U.c=j,U.e=w,U.s=y,U=N(U,K,ae,$,p),j=U.c,S=U.r,w=U.e),g=w+ae+1,ee=j[g],m=p/2,S=S||g<0||j[g+1]!=null,S=$<4?(ee!=null||S)&&($==0||$==(U.s<0?3:2)):ee>m||ee==m&&($==4||S||$==6&&j[g-1]&1||$==(U.s<0?8:7)),g<1||!j[0])f=S?re(h.charAt(1),-ae,h.charAt(0)):h.charAt(0);else{if(j.length=g,S)for(--p;++j[--g]>p;)j[g]=0,g||(++w,j=[1].concat(j));for(m=j.length;!j[--m];);for(ee=0,f="";ee<=m;f+=h.charAt(j[ee++]));f=re(f,w,h.charAt(0))}return f}})(),N=(function(){function a(_,p,y){var E,h,g,w,m=0,S=_.length,U=p%A,j=p/A|0;for(_=_.slice();S--;)g=_[S]%A,w=_[S]/A|0,E=j*g+w*U,h=U*g+E%A*A+m,m=(h/y|0)+(E/A|0)+j*w,_[S]=h%y;return m&&(_=[m].concat(_)),_}s(a,"multiply");function c(_,p,y,E){var h,g;if(y!=E)g=y>E?1:-1;else for(h=g=0;h<y;h++)if(_[h]!=p[h]){g=_[h]>p[h]?1:-1;break}return g}s(c,"compare");function f(_,p,y,E){for(var h=0;y--;)_[y]-=h,h=_[y]<p[y]?1:0,_[y]=h*E+_[y]-p[y];for(;!_[0]&&_.length>1;_.splice(0,1));}return s(f,"subtract"),function(_,p,y,E,h){var g,w,m,S,U,j,K,ee,ae,$,W,ue,Vt,Yr,zr,je,Ot,Te=_.s==p.s?1:-1,fe=_.c,te=p.c;if(!fe||!fe[0]||!te||!te[0])return new C(!_.s||!p.s||(fe?te&&fe[0]==te[0]:!te)?NaN:fe&&fe[0]==0||!te?Te*0:Te/0);for(ee=new C(Te),ae=ee.c=[],w=_.e-p.e,Te=y+w+1,h||(h=l,w=B(_.e/d)-B(p.e/d),Te=Te/d|0),m=0;te[m]==(fe[m]||0);m++);if(te[m]>(fe[m]||0)&&w--,Te<0)ae.push(1),S=!0;else{for(Yr=fe.length,je=te.length,m=0,Te+=2,U=i(h/(te[0]+1)),U>1&&(te=a(te,U,h),fe=a(fe,U,h),je=te.length,Yr=fe.length),Vt=je,$=fe.slice(0,je),W=$.length;W<je;$[W++]=0);Ot=te.slice(),Ot=[0].concat(Ot),zr=te[0],te[1]>=h/2&&zr++;do{if(U=0,g=c(te,$,je,W),g<0){if(ue=$[0],je!=W&&(ue=ue*h+($[1]||0)),U=i(ue/zr),U>1)for(U>=h&&(U=h-1),j=a(te,U,h),K=j.length,W=$.length;c(j,$,K,W)==1;)U--,f(j,je<K?Ot:te,K,h),K=j.length,g=1;else U==0&&(g=U=1),j=te.slice(),K=j.length;if(K<W&&(j=[0].concat(j)),f($,j,W,h),W=$.length,g==-1)for(;c(te,$,je,W)<1;)U++,f($,je<W?Ot:te,W,h),W=$.length}else g===0&&(U++,$=[0]);ae[m++]=U,$[0]?$[W++]=fe[Vt]||0:($=[fe[Vt]],W=1)}while((Vt++<Yr||$[0]!=null)&&Te--);S=$[0]!=null,ae[0]||ae.splice(0,1)}if(h==l){for(m=1,Te=ae[0];Te>=10;Te/=10,m++);Ae(ee,y+(ee.e=m+w*d-1)+1,E,S)}else ee.e=w,ee.r=+S;return ee}})();function Vr(a,c,f,_){var p,y,E,h,g;if(f==null?f=H:R(f,0,8),!a.c)return a.toString();if(p=a.c[0],E=a.e,c==null)g=I(a.c),g=_==1||_==2&&(E<=oe||E>=z)?V(g,E):re(g,E,"0");else if(a=Ae(new C(a),c,f),y=a.e,g=I(a.c),h=g.length,_==1||_==2&&(c<=y||y<=oe)){for(;h<c;g+="0",h++);g=V(g,y)}else if(c-=E+(_===2&&y>E),g=re(g,y,"0"),y+1>h){if(--c>0)for(g+=".";c--;g+="0");}else if(c+=y-h,c>0)for(y+1==h&&(g+=".");c--;g+="0");return a.s<0&&p?"-"+g:g}s(Vr,"format");function zi(a,c){for(var f,_,p=1,y=new C(a[0]);p<a.length;p++)_=new C(a[p]),(!_.s||(f=x(y,_))===c||f===0&&y.s===c)&&(y=_);return y}s(zi,"maxOrMin");function Wr(a,c,f){for(var _=1,p=c.length;!c[--p];c.pop());for(p=c[0];p>=10;p/=10,_++);return(f=_+f*d-1)>Z?a.c=a.e=null:f<ne?a.c=[a.e=0]:(a.e=f,a.c=c),a}s(Wr,"normalise"),G=(function(){var a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,f=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,E,h,g){var w,m=h?E:E.replace(p,"");if(_.test(m))y.s=isNaN(m)?null:m<0?-1:1;else{if(!h&&(m=m.replace(a,function(S,U,j){return w=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!g||g==w?U:S}),g&&(w=g,m=m.replace(c,"$1").replace(f,"0.$1")),E!=m))return new C(m,w);if(C.DEBUG)throw Error(o+"Not a"+(g?" base "+g:"")+" number: "+E);y.s=null}y.c=y.e=null}})();function Ae(a,c,f,_){var p,y,E,h,g,w,m,S=a.c,U=v;if(S){e:{for(p=1,h=S[0];h>=10;h/=10,p++);if(y=c-p,y<0)y+=d,E=c,g=S[w=0],m=i(g/U[p-E-1]%10);else if(w=r((y+1)/d),w>=S.length)if(_){for(;S.length<=w;S.push(0));g=m=0,p=1,y%=d,E=y-d+1}else break e;else{for(g=h=S[w],p=1;h>=10;h/=10,p++);y%=d,E=y-d+p,m=E<0?0:i(g/U[p-E-1]%10)}if(_=_||c<0||S[w+1]!=null||(E<0?g:g%U[p-E-1]),_=f<4?(m||_)&&(f==0||f==(a.s<0?3:2)):m>5||m==5&&(f==4||_||f==6&&(y>0?E>0?g/U[p-E]:0:S[w-1])%10&1||f==(a.s<0?8:7)),c<1||!S[0])return S.length=0,_?(c-=a.e+1,S[0]=U[(d-c%d)%d],a.e=-c||0):S[0]=a.e=0,a;if(y==0?(S.length=w,h=1,w--):(S.length=w+1,h=U[d-y],S[w]=E>0?i(g/U[p-E]%U[E])*h:0),_)for(;;)if(w==0){for(y=1,E=S[0];E>=10;E/=10,y++);for(E=S[0]+=h,h=1;E>=10;E/=10,h++);y!=h&&(a.e++,S[0]==l&&(S[0]=1));break}else{if(S[w]+=h,S[w]!=l)break;S[w--]=0,h=1}for(y=S.length;S[--y]===0;S.pop());}a.e>Z?a.c=a.e=null:a.e<ne&&(a.c=[a.e=0])}return a}s(Ae,"round");function Ke(a){var c,f=a.e;return f===null?a.toString():(c=I(a.c),c=f<=oe||f>=z?V(c,f):re(c,f,"0"),a.s<0?"-"+c:c)}return s(Ke,"valueOf"),O.absoluteValue=O.abs=function(){var a=new C(this);return a.s<0&&(a.s=1),a},O.comparedTo=function(a,c){return x(this,new C(a,c))},O.decimalPlaces=O.dp=function(a,c){var f,_,p,y=this;if(a!=null)return R(a,0,b),c==null?c=H:R(c,0,8),Ae(new C(y),a+y.e+1,c);if(!(f=y.c))return null;if(_=((p=f.length-1)-B(this.e/d))*d,p=f[p])for(;p%10==0;p/=10,_--);return _<0&&(_=0),_},O.dividedBy=O.div=function(a,c){return N(this,new C(a,c),J,H)},O.dividedToIntegerBy=O.idiv=function(a,c){return N(this,new C(a,c),0,1)},O.exponentiatedBy=O.pow=function(a,c){var f,_,p,y,E,h,g,w,m,S=this;if(a=new C(a),a.c&&!a.isInteger())throw Error(o+"Exponent not an integer: "+Ke(a));if(c!=null&&(c=new C(c)),h=a.e>14,!S.c||!S.c[0]||S.c[0]==1&&!S.e&&S.c.length==1||!a.c||!a.c[0])return m=new C(Math.pow(+Ke(S),h?a.s*(2-X(a)):+Ke(a))),c?m.mod(c):m;if(g=a.s<0,c){if(c.c?!c.c[0]:!c.s)return new C(NaN);_=!g&&S.isInteger()&&c.isInteger(),_&&(S=S.mod(c))}else{if(a.e>9&&(S.e>0||S.e<-1||(S.e==0?S.c[0]>1||h&&S.c[1]>=24e7:S.c[0]<8e13||h&&S.c[0]<=9999975e7)))return y=S.s<0&&X(a)?-0:0,S.e>-1&&(y=1/y),new C(g?1/y:y);de&&(y=r(de/d+2))}for(h?(f=new C(.5),g&&(a.s=1),w=X(a)):(p=Math.abs(+Ke(a)),w=p%2),m=new C(Q);;){if(w){if(m=m.times(S),!m.c)break;y?m.c.length>y&&(m.c.length=y):_&&(m=m.mod(c))}if(p){if(p=i(p/2),p===0)break;w=p%2}else if(a=a.times(f),Ae(a,a.e+1,1),a.e>14)w=X(a);else{if(p=+Ke(a),p===0)break;w=p%2}S=S.times(S),y?S.c&&S.c.length>y&&(S.c.length=y):_&&(S=S.mod(c))}return _?m:(g&&(m=Q.div(m)),c?m.mod(c):y?Ae(m,de,H,E):m)},O.integerValue=function(a){var c=new C(this);return a==null?a=H:R(a,0,8),Ae(c,c.e+1,a)},O.isEqualTo=O.eq=function(a,c){return x(this,new C(a,c))===0},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(a,c){return x(this,new C(a,c))>0},O.isGreaterThanOrEqualTo=O.gte=function(a,c){return(c=x(this,new C(a,c)))===1||c===0},O.isInteger=function(){return!!this.c&&B(this.e/d)>this.c.length-2},O.isLessThan=O.lt=function(a,c){return x(this,new C(a,c))<0},O.isLessThanOrEqualTo=O.lte=function(a,c){return(c=x(this,new C(a,c)))===-1||c===0},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&this.c[0]==0},O.minus=function(a,c){var f,_,p,y,E=this,h=E.s;if(a=new C(a,c),c=a.s,!h||!c)return new C(NaN);if(h!=c)return a.s=-c,E.plus(a);var g=E.e/d,w=a.e/d,m=E.c,S=a.c;if(!g||!w){if(!m||!S)return m?(a.s=-c,a):new C(S?E:NaN);if(!m[0]||!S[0])return S[0]?(a.s=-c,a):new C(m[0]?E:H==3?-0:0)}if(g=B(g),w=B(w),m=m.slice(),h=g-w){for((y=h<0)?(h=-h,p=m):(w=g,p=S),p.reverse(),c=h;c--;p.push(0));p.reverse()}else for(_=(y=(h=m.length)<(c=S.length))?h:c,h=c=0;c<_;c++)if(m[c]!=S[c]){y=m[c]<S[c];break}if(y&&(p=m,m=S,S=p,a.s=-a.s),c=(_=S.length)-(f=m.length),c>0)for(;c--;m[f++]=0);for(c=l-1;_>h;){if(m[--_]<S[_]){for(f=_;f&&!m[--f];m[f]=c);--m[f],m[_]+=l}m[_]-=S[_]}for(;m[0]==0;m.splice(0,1),--w);return m[0]?Wr(a,m,w):(a.s=H==3?-1:1,a.c=[a.e=0],a)},O.modulo=O.mod=function(a,c){var f,_,p=this;return a=new C(a,c),!p.c||!a.s||a.c&&!a.c[0]?new C(NaN):!a.c||p.c&&!p.c[0]?new C(p):($e==9?(_=a.s,a.s=1,f=N(p,a,0,3),a.s=_,f.s*=_):f=N(p,a,0,$e),a=p.minus(f.times(a)),!a.c[0]&&$e==1&&(a.s=p.s),a)},O.multipliedBy=O.times=function(a,c){var f,_,p,y,E,h,g,w,m,S,U,j,K,ee,ae,$=this,W=$.c,ue=(a=new C(a,c)).c;if(!W||!ue||!W[0]||!ue[0])return!$.s||!a.s||W&&!W[0]&&!ue||ue&&!ue[0]&&!W?a.c=a.e=a.s=null:(a.s*=$.s,!W||!ue?a.c=a.e=null:(a.c=[0],a.e=0)),a;for(_=B($.e/d)+B(a.e/d),a.s*=$.s,g=W.length,S=ue.length,g<S&&(K=W,W=ue,ue=K,p=g,g=S,S=p),p=g+S,K=[];p--;K.push(0));for(ee=l,ae=A,p=S;--p>=0;){for(f=0,U=ue[p]%ae,j=ue[p]/ae|0,E=g,y=p+E;y>p;)w=W[--E]%ae,m=W[E]/ae|0,h=j*w+m*U,w=U*w+h%ae*ae+K[y]+f,f=(w/ee|0)+(h/ae|0)+j*m,K[y--]=w%ee;K[y]=f}return f?++_:K.splice(0,1),Wr(a,K,_)},O.negated=function(){var a=new C(this);return a.s=-a.s||null,a},O.plus=function(a,c){var f,_=this,p=_.s;if(a=new C(a,c),c=a.s,!p||!c)return new C(NaN);if(p!=c)return a.s=-c,_.minus(a);var y=_.e/d,E=a.e/d,h=_.c,g=a.c;if(!y||!E){if(!h||!g)return new C(p/0);if(!h[0]||!g[0])return g[0]?a:new C(h[0]?_:p*0)}if(y=B(y),E=B(E),h=h.slice(),p=y-E){for(p>0?(E=y,f=g):(p=-p,f=h),f.reverse();p--;f.push(0));f.reverse()}for(p=h.length,c=g.length,p-c<0&&(f=g,g=h,h=f,c=p),p=0;c;)p=(h[--c]=h[c]+g[c]+p)/l|0,h[c]=l===h[c]?0:h[c]%l;return p&&(h=[p].concat(h),++E),Wr(a,h,E)},O.precision=O.sd=function(a,c){var f,_,p,y=this;if(a!=null&&a!==!!a)return R(a,1,b),c==null?c=H:R(c,0,8),Ae(new C(y),a,c);if(!(f=y.c))return null;if(p=f.length-1,_=p*d+1,p=f[p]){for(;p%10==0;p/=10,_--);for(p=f[0];p>=10;p/=10,_++);}return a&&y.e+1>_&&(_=y.e+1),_},O.shiftedBy=function(a){return R(a,-T,T),this.times("1e"+a)},O.squareRoot=O.sqrt=function(){var a,c,f,_,p,y=this,E=y.c,h=y.s,g=y.e,w=J+4,m=new C("0.5");if(h!==1||!E||!E[0])return new C(!h||h<0&&(!E||E[0])?NaN:E?y:1/0);if(h=Math.sqrt(+Ke(y)),h==0||h==1/0?(c=I(E),(c.length+g)%2==0&&(c+="0"),h=Math.sqrt(+c),g=B((g+1)/2)-(g<0||g%2),h==1/0?c="5e"+g:(c=h.toExponential(),c=c.slice(0,c.indexOf("e")+1)+g),f=new C(c)):f=new C(h+""),f.c[0]){for(g=f.e,h=g+w,h<3&&(h=0);;)if(p=f,f=m.times(p.plus(N(y,p,w,1))),I(p.c).slice(0,h)===(c=I(f.c)).slice(0,h))if(f.e<g&&--h,c=c.slice(h-3,h+1),c=="9999"||!_&&c=="4999"){if(!_&&(Ae(p,p.e+J+2,0),p.times(p).eq(y))){f=p;break}w+=4,h+=4,_=1}else{(!+c||!+c.slice(1)&&c.charAt(0)=="5")&&(Ae(f,f.e+J+2,1),a=!f.times(f).eq(y));break}}return Ae(f,f.e+J+1,H,a)},O.toExponential=function(a,c){return a!=null&&(R(a,0,b),a++),Vr(this,a,c,1)},O.toFixed=function(a,c){return a!=null&&(R(a,0,b),a=a+this.e+1),Vr(this,a,c)},O.toFormat=function(a,c,f){var _,p=this;if(f==null)a!=null&&c&&typeof c=="object"?(f=c,c=null):a&&typeof a=="object"?(f=a,a=c=null):f=Kr;else if(typeof f!="object")throw Error(o+"Argument not an object: "+f);if(_=p.toFixed(a,c),p.c){var y,E=_.split("."),h=+f.groupSize,g=+f.secondaryGroupSize,w=f.groupSeparator||"",m=E[0],S=E[1],U=p.s<0,j=U?m.slice(1):m,K=j.length;if(g&&(y=h,h=g,g=y,K-=y),h>0&&K>0){for(y=K%h||h,m=j.substr(0,y);y<K;y+=h)m+=w+j.substr(y,h);g>0&&(m+=w+j.slice(y)),U&&(m="-"+m)}_=S?m+(f.decimalSeparator||"")+((g=+f.fractionGroupSize)?S.replace(new RegExp("\\d{"+g+"}\\B","g"),"$&"+(f.fractionGroupSeparator||"")):S):m}return(f.prefix||"")+_+(f.suffix||"")},O.toFraction=function(a){var c,f,_,p,y,E,h,g,w,m,S,U,j=this,K=j.c;if(a!=null&&(h=new C(a),!h.isInteger()&&(h.c||h.s!==1)||h.lt(Q)))throw Error(o+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+Ke(h));if(!K)return new C(j);for(c=new C(Q),w=f=new C(Q),_=g=new C(Q),U=I(K),y=c.e=U.length-j.e-1,c.c[0]=v[(E=y%d)<0?d+E:E],a=!a||h.comparedTo(c)>0?y>0?c:w:h,E=Z,Z=1/0,h=new C(U),g.c[0]=0;m=N(h,c,0,1),p=f.plus(m.times(_)),p.comparedTo(a)!=1;)f=_,_=p,w=g.plus(m.times(p=w)),g=p,c=h.minus(m.times(p=c)),h=p;return p=N(a.minus(f),_,0,1),g=g.plus(p.times(w)),f=f.plus(p.times(_)),g.s=w.s=j.s,y=y*2,S=N(w,_,y,H).minus(j).abs().comparedTo(N(g,f,y,H).minus(j).abs())<1?[w,_]:[g,f],Z=E,S},O.toNumber=function(){return+Ke(this)},O.toPrecision=function(a,c){return a!=null&&R(a,1,b),Vr(this,a,c,2)},O.toString=function(a){var c,f=this,_=f.s,p=f.e;return p===null?_?(c="Infinity",_<0&&(c="-"+c)):c="NaN":(a==null?c=p<=oe||p>=z?V(I(f.c),p):re(I(f.c),p,"0"):a===10&&Jr?(f=Ae(new C(f),J+p+1,H),c=re(I(f.c),f.e,"0")):(R(a,2,Ze.length,"Base"),c=D(re(I(f.c),p,"0"),10,a,_,!0)),_<0&&f.c[0]&&(c="-"+c)),c},O.valueOf=O.toJSON=function(){return Ke(this)},O._isBigNumber=!0,M!=null&&C.set(M),C}s(F,"clone");function B(M){var N=M|0;return M>0||M===N?N:N-1}s(B,"bitFloor");function I(M){for(var N,D,G=1,O=M.length,Q=M[0]+"";G<O;){for(N=M[G++]+"",D=d-N.length;D--;N="0"+N);Q+=N}for(O=Q.length;Q.charCodeAt(--O)===48;);return Q.slice(0,O+1||1)}s(I,"coeffToString");function x(M,N){var D,G,O=M.c,Q=N.c,J=M.s,H=N.s,oe=M.e,z=N.e;if(!J||!H)return null;if(D=O&&!O[0],G=Q&&!Q[0],D||G)return D?G?0:-H:J;if(J!=H)return J;if(D=J<0,G=oe==z,!O||!Q)return G?0:!O^D?1:-1;if(!G)return oe>z^D?1:-1;for(H=(oe=O.length)<(z=Q.length)?oe:z,J=0;J<H;J++)if(O[J]!=Q[J])return O[J]>Q[J]^D?1:-1;return oe==z?0:oe>z^D?1:-1}s(x,"compare");function R(M,N,D,G){if(M<N||M>D||M!==i(M))throw Error(o+(G||"Argument")+(typeof M=="number"?M<N||M>D?" out of range: ":" not an integer: ":" not a primitive number: ")+String(M))}s(R,"intCheck");function X(M){var N=M.c.length-1;return B(M.e/d)==N&&M.c[N]%2!=0}s(X,"isOdd");function V(M,N){return(M.length>1?M.charAt(0)+"."+M.slice(1):M)+(N<0?"e":"e+")+N}s(V,"toExponential");function re(M,N,D){var G,O;if(N<0){for(O=D+".";++N;O+=D);M=O+M}else if(G=M.length,++N>G){for(O=D,N-=G;--N;O+=D);M+=O}else N<G&&(M=M.slice(0,N)+"."+M.slice(N));return M}s(re,"toFixedPoint"),e=F(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Xt<"u"&&Xt.exports?Xt.exports=e:(n||(n=typeof self<"u"&&self?self:window),n.BigNumber=e)})(ms)});var As=k((ph,Es)=>{var _s=sn(),ws=Es.exports;(function(){"use strict";function n(T){return T<10?"0"+T:T}s(n,"f");var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,t=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r,i,o={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},u;function l(T){return t.lastIndex=0,t.test(T)?'"'+T.replace(t,function(v){var A=o[v];return typeof A=="string"?A:"\\u"+("0000"+v.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+T+'"'}s(l,"quote");function d(T,v){var A,b,F,B,I=r,x,R=v[T],X=R!=null&&(R instanceof _s||_s.isBigNumber(R));switch(R&&typeof R=="object"&&typeof R.toJSON=="function"&&(R=R.toJSON(T)),typeof u=="function"&&(R=u.call(v,T,R)),typeof R){case"string":return X?R:l(R);case"number":return isFinite(R)?String(R):"null";case"boolean":case"null":case"bigint":return String(R);case"object":if(!R)return"null";if(r+=i,x=[],Object.prototype.toString.apply(R)==="[object Array]"){for(B=R.length,A=0;A<B;A+=1)x[A]=d(A,R)||"null";return F=x.length===0?"[]":r?`[
24
+ `+r+x.join(`,
25
+ `+r)+`
26
+ `+I+"]":"["+x.join(",")+"]",r=I,F}if(u&&typeof u=="object")for(B=u.length,A=0;A<B;A+=1)typeof u[A]=="string"&&(b=u[A],F=d(b,R),F&&x.push(l(b)+(r?": ":":")+F));else Object.keys(R).forEach(function(V){var re=d(V,R);re&&x.push(l(V)+(r?": ":":")+re)});return F=x.length===0?"{}":r?`{
27
+ `+r+x.join(`,
28
+ `+r)+`
29
+ `+I+"}":"{"+x.join(",")+"}",r=I,F}}s(d,"str"),typeof ws.stringify!="function"&&(ws.stringify=function(T,v,A){var b;if(r="",i="",typeof A=="number")for(b=0;b<A;b+=1)i+=" ";else typeof A=="string"&&(i=A);if(u=v,v&&typeof v!="function"&&(typeof v!="object"||typeof v.length!="number"))throw new Error("JSON.stringify");return d("",{"":T})})})()});var vs=k((yh,Ts)=>{var Qt=null,tc=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,rc=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,nc=s(function(n){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(n!=null){if(n.strict===!0&&(e.strict=!0),n.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=n.alwaysParseAsBig===!0?n.alwaysParseAsBig:!1,e.useNativeBigInt=n.useNativeBigInt===!0?n.useNativeBigInt:!1,typeof n.constructorAction<"u")if(n.constructorAction==="error"||n.constructorAction==="ignore"||n.constructorAction==="preserve")e.constructorAction=n.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${n.constructorAction}`);if(typeof n.protoAction<"u")if(n.protoAction==="error"||n.protoAction==="ignore"||n.protoAction==="preserve")e.protoAction=n.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${n.protoAction}`)}var t,r,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
30
+ `,r:"\r",t:" "},o,u=s(function(I){throw{name:"SyntaxError",message:I,at:t,text:o}},"error"),l=s(function(I){return I&&I!==r&&u("Expected '"+I+"' instead of '"+r+"'"),r=o.charAt(t),t+=1,r},"next"),d=s(function(){var I,x="";for(r==="-"&&(x="-",l("-"));r>="0"&&r<="9";)x+=r,l();if(r===".")for(x+=".";l()&&r>="0"&&r<="9";)x+=r;if(r==="e"||r==="E")for(x+=r,l(),(r==="-"||r==="+")&&(x+=r,l());r>="0"&&r<="9";)x+=r,l();if(I=+x,!isFinite(I))u("Bad number");else return Qt==null&&(Qt=sn()),x.length>15?e.storeAsString?x:e.useNativeBigInt?BigInt(x):new Qt(x):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(I):new Qt(I):I},"number"),T=s(function(){var I,x,R="",X;if(r==='"')for(var V=t;l();){if(r==='"')return t-1>V&&(R+=o.substring(V,t-1)),l(),R;if(r==="\\"){if(t-1>V&&(R+=o.substring(V,t-1)),l(),r==="u"){for(X=0,x=0;x<4&&(I=parseInt(l(),16),!!isFinite(I));x+=1)X=X*16+I;R+=String.fromCharCode(X)}else if(typeof i[r]=="string")R+=i[r];else break;V=t}}u("Bad string")},"string"),v=s(function(){for(;r&&r<=" ";)l()},"white"),A=s(function(){switch(r){case"t":return l("t"),l("r"),l("u"),l("e"),!0;case"f":return l("f"),l("a"),l("l"),l("s"),l("e"),!1;case"n":return l("n"),l("u"),l("l"),l("l"),null}u("Unexpected '"+r+"'")},"word"),b,F=s(function(){var I=[];if(r==="["){if(l("["),v(),r==="]")return l("]"),I;for(;r;){if(I.push(b()),v(),r==="]")return l("]"),I;l(","),v()}}u("Bad array")},"array"),B=s(function(){var I,x=Object.create(null);if(r==="{"){if(l("{"),v(),r==="}")return l("}"),x;for(;r;){if(I=T(),v(),l(":"),e.strict===!0&&Object.hasOwnProperty.call(x,I)&&u('Duplicate key "'+I+'"'),tc.test(I)===!0?e.protoAction==="error"?u("Object contains forbidden prototype property"):e.protoAction==="ignore"?b():x[I]=b():rc.test(I)===!0?e.constructorAction==="error"?u("Object contains forbidden constructor property"):e.constructorAction==="ignore"?b():x[I]=b():x[I]=b(),v(),r==="}")return l("}"),x;l(","),v()}}u("Bad object")},"object");return b=s(function(){switch(v(),r){case"{":return B();case"[":return F();case'"':return T();case"-":return d();default:return r>="0"&&r<="9"?d():A()}},"value"),function(I,x){var R;return o=I+"",t=0,r=" ",R=b(),v(),r&&u("Syntax error"),typeof x=="function"?s((function X(V,re){var M,N,D=V[re];return D&&typeof D=="object"&&Object.keys(D).forEach(function(G){N=X(D,G),N!==void 0?D[G]=N:delete D[G]}),x.call(V,re,D)}),"walk")({"":R},""):R}},"json_parse");Ts.exports=nc});var Os=k((_h,Zt)=>{var Ss=As().stringify,Cs=vs();Zt.exports=function(n){return{parse:Cs(n),stringify:Ss}};Zt.exports.parse=Cs();Zt.exports.stringify=Ss});var on=k(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.GCE_LINUX_BIOS_PATHS=void 0;ke.isGoogleCloudServerless=Rs;ke.isGoogleComputeEngineLinux=Ps;ke.isGoogleComputeEngineMACAddress=Ns;ke.isGoogleComputeEngine=Is;ke.detectGCPResidency=sc;var bs=L("fs"),ks=L("os");ke.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var ic=/^42:01/;function Rs(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}s(Rs,"isGoogleCloudServerless");function Ps(){if((0,ks.platform)()!=="linux")return!1;try{(0,bs.statSync)(ke.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let n=(0,bs.readFileSync)(ke.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(n)}catch{return!1}}s(Ps,"isGoogleComputeEngineLinux");function Ns(){let n=(0,ks.networkInterfaces)();for(let e of Object.values(n))if(e){for(let{mac:t}of e)if(ic.test(t))return!0}return!1}s(Ns,"isGoogleComputeEngineMACAddress");function Is(){return Ps()||Ns()}s(Is,"isGoogleComputeEngine");function sc(){return Rs()||Is()}s(sc,"detectGCPResidency")});var xs=k(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.Colours=void 0;var le=class n{static{s(this,"Colours")}static isEnabled(e){return e&&e.isTTY&&(typeof e.getColorDepth=="function"?e.getColorDepth()>2:!0)}static refresh(){n.enabled=n.isEnabled(process==null?void 0:process.stderr),this.enabled?(n.reset="\x1B[0m",n.bright="\x1B[1m",n.dim="\x1B[2m",n.red="\x1B[31m",n.green="\x1B[32m",n.yellow="\x1B[33m",n.blue="\x1B[34m",n.magenta="\x1B[35m",n.cyan="\x1B[36m",n.white="\x1B[37m",n.grey="\x1B[90m"):(n.reset="",n.bright="",n.dim="",n.red="",n.green="",n.yellow="",n.blue="",n.magenta="",n.cyan="",n.white="",n.grey="")}};er.Colours=le;le.enabled=!1;le.reset="";le.bright="";le.dim="";le.red="";le.green="";le.yellow="";le.blue="";le.magenta="";le.cyan="";le.white="";le.grey="";le.refresh()});var qs=k(Y=>{"use strict";var oc=Y&&Y.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:s(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),ac=Y&&Y.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Us=Y&&Y.__importStar||(function(){var n=s(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&oc(t,e,r[i]);return ac(t,e),t}})();Object.defineProperty(Y,"__esModule",{value:!0});Y.env=Y.DebugLogBackendBase=Y.placeholder=Y.AdhocDebugLogger=Y.LogSeverity=void 0;Y.getNodeBackend=cn;Y.getDebugBackend=uc;Y.getStructuredBackend=lc;Y.setBackend=fc;Y.log=Ds;var cc=L("events"),bt=Us(L("process")),js=Us(L("util")),pe=xs(),Re;(function(n){n.DEFAULT="DEFAULT",n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(Re||(Y.LogSeverity=Re={}));var kt=class extends cc.EventEmitter{static{s(this,"AdhocDebugLogger")}constructor(e,t){super(),this.namespace=e,this.upstream=t,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:s((r,i)=>this.on(r,i),"on")}),this.func.debug=(...r)=>this.invokeSeverity(Re.DEBUG,...r),this.func.info=(...r)=>this.invokeSeverity(Re.INFO,...r),this.func.warn=(...r)=>this.invokeSeverity(Re.WARNING,...r),this.func.error=(...r)=>this.invokeSeverity(Re.ERROR,...r),this.func.sublog=r=>Ds(r,this.func)}invoke(e,...t){if(this.upstream)try{this.upstream(e,...t)}catch{}try{this.emit("log",e,t)}catch{}}invokeSeverity(e,...t){this.invoke({severity:e},...t)}};Y.AdhocDebugLogger=kt;Y.placeholder=new kt("",()=>{}).func;var ct=class{static{s(this,"DebugLogBackendBase")}constructor(){var e;this.cached=new Map,this.filters=[],this.filtersSet=!1;let t=(e=bt.env[Y.env.nodeEnables])!==null&&e!==void 0?e:"*";t==="all"&&(t="*"),this.filters=t.split(",")}log(e,t,...r){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let i=this.cached.get(e);i||(i=this.makeLogger(e),this.cached.set(e,i)),i(t,...r)}catch(i){console.error(i)}}};Y.DebugLogBackendBase=ct;var an=class extends ct{static{s(this,"NodeBackend")}constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(e){return this.enabledRegexp.test(e)}makeLogger(e){return this.enabledRegexp.test(e)?(t,...r)=>{var i;let o=`${pe.Colours.green}${e}${pe.Colours.reset}`,u=`${pe.Colours.yellow}${bt.pid}${pe.Colours.reset}`,l;switch(t.severity){case Re.ERROR:l=`${pe.Colours.red}${t.severity}${pe.Colours.reset}`;break;case Re.INFO:l=`${pe.Colours.magenta}${t.severity}${pe.Colours.reset}`;break;case Re.WARNING:l=`${pe.Colours.yellow}${t.severity}${pe.Colours.reset}`;break;default:l=(i=t.severity)!==null&&i!==void 0?i:Re.DEFAULT;break}let d=js.formatWithOptions({colors:pe.Colours.enabled},...r),T=Object.assign({},t);delete T.severity;let v=Object.getOwnPropertyNames(T).length?JSON.stringify(T):"",A=v?`${pe.Colours.grey}${v}${pe.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",u,o,l,d,v?` ${A}`:"")}:()=>{}}setFilters(){let t=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${t}$`,"i")}};function cn(){return new an}s(cn,"getNodeBackend");var un=class extends ct{static{s(this,"DebugBackend")}constructor(e){super(),this.debugPkg=e}makeLogger(e){let t=this.debugPkg(e);return(r,...i)=>{t(i[0],...i.slice(1))}}setFilters(){var e;let t=(e=bt.env.NODE_DEBUG)!==null&&e!==void 0?e:"";bt.env.NODE_DEBUG=`${t}${t?",":""}${this.filters.join(",")}`}};function uc(n){return new un(n)}s(uc,"getDebugBackend");var ln=class extends ct{static{s(this,"StructuredBackend")}constructor(e){var t;super(),this.upstream=(t=e)!==null&&t!==void 0?t:void 0}makeLogger(e){var t;let r=(t=this.upstream)===null||t===void 0?void 0:t.makeLogger(e);return(i,...o)=>{var u;let l=(u=i.severity)!==null&&u!==void 0?u:Re.INFO,d=Object.assign({severity:l,message:js.format(...o)},i),T=JSON.stringify(d);r?r(i,T):console.log("%s",T)}}setFilters(){var e;(e=this.upstream)===null||e===void 0||e.setFilters()}};function lc(n){return new ln(n)}s(lc,"getStructuredBackend");Y.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var fn=new Map,ge;function fc(n){ge=n,fn.clear()}s(fc,"setBackend");function Ds(n,e){if(!ge&&!bt.env[Y.env.nodeEnables]||!n)return Y.placeholder;e&&(n=`${e.instance.namespace}:${n}`);let t=fn.get(n);if(t)return t.func;if(ge===null)return Y.placeholder;ge===void 0&&(ge=cn());let r=(()=>{let i;return new kt(n,(u,...l)=>{if(i!==ge){if(ge===null)return;ge===void 0&&(ge=cn()),i=ge}ge?.log(n,u,...l)})})();return fn.set(n,r),r.func}s(Ds,"log")});var hn=k(tt=>{"use strict";var hc=tt&&tt.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:s(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),dc=tt&&tt.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hc(e,n,t)};Object.defineProperty(tt,"__esModule",{value:!0});dc(qs(),tt)});var Pt=k(q=>{"use strict";var Ms=q&&q.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:s(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),pc=q&&q.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),gc=q&&q.__importStar||(function(){var n=s(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&Ms(t,e,r[i]);return pc(t,e),t}})(),yc=q&&q.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ms(e,n,t)};Object.defineProperty(q,"__esModule",{value:!0});q.gcpResidencyCache=q.METADATA_SERVER_DETECTION=q.HEADERS=q.HEADER_VALUE=q.HEADER_NAME=q.SECONDARY_HOST_ADDRESS=q.HOST_ADDRESS=q.BASE_PATH=void 0;q.instance=Tc;q.project=vc;q.universe=Sc;q.bulk=Cc;q.isAvailable=bc;q.resetIsAvailableCache=kc;q.getGCPResidency=gn;q.setGCPResidency=Ls;q.requestTimeout=Gs;var dn=ce(),mc=Os(),_c=on(),wc=gc(hn());q.BASE_PATH="/computeMetadata/v1";q.HOST_ADDRESS="http://169.254.169.254";q.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";q.HEADER_NAME="Metadata-Flavor";q.HEADER_VALUE="Google";q.HEADERS=Object.freeze({[q.HEADER_NAME]:q.HEADER_VALUE});var Fs=wc.log("gcp-metadata");q.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function pn(n){return n||(n=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||q.HOST_ADDRESS),/^https?:\/\//.test(n)||(n=`http://${n}`),new URL(q.BASE_PATH,n).href}s(pn,"getBaseUrl");function Ec(n){Object.keys(n).forEach(e=>{switch(e){case"params":case"property":case"headers":break;case"qs":throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw new Error(`'${e}' is not a valid configuration option.`)}})}s(Ec,"validate");async function Rt(n,e={},t=3,r=!1){let i=new Headers(q.HEADERS),o="",u={};if(typeof n=="object"){let A=n;new Headers(A.headers).forEach((b,F)=>i.set(F,b)),o=A.metadataKey,u=A.params||u,t=A.noResponseRetries||t,r=A.fastFail||r}else o=n;typeof e=="string"?o+=`/${e}`:(Ec(e),e.property&&(o+=`/${e.property}`),new Headers(e.headers).forEach((A,b)=>i.set(b,A)),u=e.params||u);let l=r?Ac:dn.request,d={url:`${pn()}/${o}`,headers:i,retryConfig:{noResponseRetries:t},params:u,responseType:"text",timeout:Gs()};Fs.info("instance request %j",d);let T=await l(d);Fs.info("instance metadata is %s",T.data);let v=T.headers.get(q.HEADER_NAME);if(v!==q.HEADER_VALUE)throw new RangeError(`Invalid response from metadata service: incorrect ${q.HEADER_NAME} header. Expected '${q.HEADER_VALUE}', got ${v?`'${v}'`:"no header"}`);if(typeof T.data=="string")try{return mc.parse(T.data)}catch{}return T.data}s(Rt,"metadataAccessor");async function Ac(n){let e={...n,url:n.url?.toString().replace(pn(),pn(q.SECONDARY_HOST_ADDRESS))},t=(0,dn.request)(n),r=(0,dn.request)(e);return Promise.any([t,r])}s(Ac,"fastFailMetadataRequest");function Tc(n){return Rt("instance",n)}s(Tc,"instance");function vc(n){return Rt("project",n)}s(vc,"project");function Sc(n){return Rt("universe",n)}s(Sc,"universe");async function Cc(n){let e={};return await Promise.all(n.map(t=>(async()=>{let r=await Rt(t),i=t.metadataKey;e[i]=r})())),e}s(Cc,"bulk");function Oc(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}s(Oc,"detectGCPAvailableRetries");var tr;async function bc(){if(process.env.METADATA_SERVER_DETECTION){let n=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(n in q.METADATA_SERVER_DETECTION))throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${n}\`, but it should be \`${Object.keys(q.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(n){case"assume-present":return!0;case"none":return!1;case"bios-only":return gn();case"ping-only":}}try{return tr===void 0&&(tr=Rt("instance",void 0,Oc(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await tr,!0}catch(n){let e=n;if(process.env.DEBUG_AUTH&&console.info(e),e instanceof AggregateError||e.type==="request-timeout"||e.response&&e.response.status===404)return!1;if(!(e.response&&e.response.status===404)&&(!e.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(e.code.toString()))){let t="UNKNOWN";e.code&&(t=e.code.toString()),process.emitWarning(`received unexpected error = ${e.message} code = ${t}`,"MetadataLookupWarning")}return!1}}s(bc,"isAvailable");function kc(){tr=void 0}s(kc,"resetIsAvailableCache");q.gcpResidencyCache=null;function gn(){return q.gcpResidencyCache===null&&Ls(),q.gcpResidencyCache}s(gn,"getGCPResidency");function Ls(n=null){q.gcpResidencyCache=n!==null?n:(0,_c.detectGCPResidency)()}s(Ls,"setGCPResidency");function Gs(){return gn()?0:3e3}s(Gs,"requestTimeout");yc(on(),q)});var $s=k(rr=>{"use strict";rr.byteLength=Pc;rr.toByteArray=Ic;rr.fromByteArray=jc;var De=[],Se=[],Rc=typeof Uint8Array<"u"?Uint8Array:Array,yn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(rt=0,Bs=yn.length;rt<Bs;++rt)De[rt]=yn[rt],Se[yn.charCodeAt(rt)]=rt;var rt,Bs;Se[45]=62;Se[95]=63;function Hs(n){var e=n.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}s(Hs,"getLens");function Pc(n){var e=Hs(n),t=e[0],r=e[1];return(t+r)*3/4-r}s(Pc,"byteLength");function Nc(n,e,t){return(e+t)*3/4-t}s(Nc,"_byteLength");function Ic(n){var e,t=Hs(n),r=t[0],i=t[1],o=new Rc(Nc(n,r,i)),u=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)e=Se[n.charCodeAt(d)]<<18|Se[n.charCodeAt(d+1)]<<12|Se[n.charCodeAt(d+2)]<<6|Se[n.charCodeAt(d+3)],o[u++]=e>>16&255,o[u++]=e>>8&255,o[u++]=e&255;return i===2&&(e=Se[n.charCodeAt(d)]<<2|Se[n.charCodeAt(d+1)]>>4,o[u++]=e&255),i===1&&(e=Se[n.charCodeAt(d)]<<10|Se[n.charCodeAt(d+1)]<<4|Se[n.charCodeAt(d+2)]>>2,o[u++]=e>>8&255,o[u++]=e&255),o}s(Ic,"toByteArray");function xc(n){return De[n>>18&63]+De[n>>12&63]+De[n>>6&63]+De[n&63]}s(xc,"tripletToBase64");function Uc(n,e,t){for(var r,i=[],o=e;o<t;o+=3)r=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(n[o+2]&255),i.push(xc(r));return i.join("")}s(Uc,"encodeChunk");function jc(n){for(var e,t=n.length,r=t%3,i=[],o=16383,u=0,l=t-r;u<l;u+=o)i.push(Uc(n,u,u+o>l?l:u+o));return r===1?(e=n[t-1],i.push(De[e>>2]+De[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(De[e>>10]+De[e>>4&63]+De[e<<2&63]+"=")),i.join("")}s(jc,"fromByteArray")});var _n=k(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.fromArrayBufferToHex=Dc;function Dc(n){return Array.from(new Uint8Array(n)).map(t=>t.toString(16).padStart(2,"0")).join("")}s(Dc,"fromArrayBufferToHex")});var Ks=k(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.BrowserCrypto=void 0;var ut=$s(),qc=_n(),wn=class n{static{s(this,"BrowserCrypto")}constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(e){let t=new TextEncoder().encode(e),r=await window.crypto.subtle.digest("SHA-256",t);return ut.fromByteArray(new Uint8Array(r))}randomBytesBase64(e){let t=new Uint8Array(e);return window.crypto.getRandomValues(t),ut.fromByteArray(t)}static padBase64(e){for(;e.length%4!==0;)e+="=";return e}async verify(e,t,r){let i={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},o=new TextEncoder().encode(t),u=ut.toByteArray(n.padBase64(r)),l=await window.crypto.subtle.importKey("jwk",e,i,!0,["verify"]);return await window.crypto.subtle.verify(i,l,u,o)}async sign(e,t){let r={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},i=new TextEncoder().encode(t),o=await window.crypto.subtle.importKey("jwk",e,r,!0,["sign"]),u=await window.crypto.subtle.sign(r,o,i);return ut.fromByteArray(new Uint8Array(u))}decodeBase64StringUtf8(e){let t=ut.toByteArray(n.padBase64(e));return new TextDecoder().decode(t)}encodeBase64StringUtf8(e){let t=new TextEncoder().encode(e);return ut.fromByteArray(t)}async sha256DigestHex(e){let t=new TextEncoder().encode(e),r=await window.crypto.subtle.digest("SHA-256",t);return(0,qc.fromArrayBufferToHex)(r)}async signWithHmacSha256(e,t){let r=typeof e=="string"?e:String.fromCharCode(...new Uint16Array(e)),i=new TextEncoder,o=await window.crypto.subtle.importKey("raw",i.encode(r),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",o,i.encode(t))}};nr.BrowserCrypto=wn});var Js=k(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.NodeCrypto=void 0;var lt=L("crypto"),En=class{static{s(this,"NodeCrypto")}async sha256DigestBase64(e){return lt.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return lt.randomBytes(e).toString("base64")}async verify(e,t,r){let i=lt.createVerify("RSA-SHA256");return i.update(t),i.end(),i.verify(e,r,"base64")}async sign(e,t){let r=lt.createSign("RSA-SHA256");return r.update(t),r.end(),r.sign(e,"base64")}decodeBase64StringUtf8(e){return Buffer.from(e,"base64").toString("utf-8")}encodeBase64StringUtf8(e){return Buffer.from(e,"utf-8").toString("base64")}async sha256DigestHex(e){return lt.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,t){let r=typeof e=="string"?e:Mc(e);return Fc(lt.createHmac("sha256",r).update(t).digest())}};ir.NodeCrypto=En;function Fc(n){return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}s(Fc,"toArrayBuffer");function Mc(n){return Buffer.from(n)}s(Mc,"toBuffer")});var Nt=k(Je=>{"use strict";var Lc=Je&&Je.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:s(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Gc=Je&&Je.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Lc(e,n,t)};Object.defineProperty(Je,"__esModule",{value:!0});Je.createCrypto=$c;Je.hasBrowserCrypto=Vs;var Bc=Ks(),Hc=Js();Gc(_n(),Je);function $c(){return Vs()?new Bc.BrowserCrypto:new Hc.NodeCrypto}s($c,"createCrypto");function Vs(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}s(Vs,"hasBrowserCrypto")});var ft=k((An,Ys)=>{var sr=L("buffer"),qe=sr.Buffer;function Ws(n,e){for(var t in n)e[t]=n[t]}s(Ws,"copyProps");qe.from&&qe.alloc&&qe.allocUnsafe&&qe.allocUnsafeSlow?Ys.exports=sr:(Ws(sr,An),An.Buffer=nt);function nt(n,e,t){return qe(n,e,t)}s(nt,"SafeBuffer");nt.prototype=Object.create(qe.prototype);Ws(qe,nt);nt.from=function(n,e,t){if(typeof n=="number")throw new TypeError("Argument must not be a number");return qe(n,e,t)};nt.alloc=function(n,e,t){if(typeof n!="number")throw new TypeError("Argument must be a number");var r=qe(n);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};nt.allocUnsafe=function(n){if(typeof n!="number")throw new TypeError("Argument must be a number");return qe(n)};nt.allocUnsafeSlow=function(n){if(typeof n!="number")throw new TypeError("Argument must be a number");return sr.SlowBuffer(n)}});var Xs=k((Lh,zs)=>{"use strict";function Tn(n){var e=(n/8|0)+(n%8===0?0:1);return e}s(Tn,"getParamSize");var Kc={ES256:Tn(256),ES384:Tn(384),ES512:Tn(521)};function Jc(n){var e=Kc[n];if(e)return e;throw new Error('Unknown algorithm "'+n+'"')}s(Jc,"getParamBytesForAlg");zs.exports=Jc});var vn=k((Bh,no)=>{"use strict";var or=ft().Buffer,Zs=Xs(),ar=128,eo=0,Vc=32,Wc=16,Yc=2,to=Wc|Vc|eo<<6,cr=Yc|eo<<6;function zc(n){return n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}s(zc,"base64Url");function ro(n){if(or.isBuffer(n))return n;if(typeof n=="string")return or.from(n,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}s(ro,"signatureAsBuffer");function Xc(n,e){n=ro(n);var t=Zs(e),r=t+1,i=n.length,o=0;if(n[o++]!==to)throw new Error('Could not find expected "seq"');var u=n[o++];if(u===(ar|1)&&(u=n[o++]),i-o<u)throw new Error('"seq" specified length of "'+u+'", only "'+(i-o)+'" remaining');if(n[o++]!==cr)throw new Error('Could not find expected "int" for "r"');var l=n[o++];if(i-o-2<l)throw new Error('"r" specified length of "'+l+'", only "'+(i-o-2)+'" available');if(r<l)throw new Error('"r" specified length of "'+l+'", max of "'+r+'" is acceptable');var d=o;if(o+=l,n[o++]!==cr)throw new Error('Could not find expected "int" for "s"');var T=n[o++];if(i-o!==T)throw new Error('"s" specified length of "'+T+'", expected "'+(i-o)+'"');if(r<T)throw new Error('"s" specified length of "'+T+'", max of "'+r+'" is acceptable');var v=o;if(o+=T,o!==i)throw new Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var A=t-l,b=t-T,F=or.allocUnsafe(A+l+b+T);for(o=0;o<A;++o)F[o]=0;n.copy(F,o,d+Math.max(-A,0),d+l),o=t;for(var B=o;o<B+b;++o)F[o]=0;return n.copy(F,o,v+Math.max(-b,0),v+T),F=F.toString("base64"),F=zc(F),F}s(Xc,"derToJose");function Qs(n,e,t){for(var r=0;e+r<t&&n[e+r]===0;)++r;var i=n[e+r]>=ar;return i&&--r,r}s(Qs,"countPadding");function Qc(n,e){n=ro(n);var t=Zs(e),r=n.length;if(r!==t*2)throw new TypeError('"'+e+'" signatures must be "'+t*2+'" bytes, saw "'+r+'"');var i=Qs(n,0,t),o=Qs(n,t,n.length),u=t-i,l=t-o,d=2+u+1+1+l,T=d<ar,v=or.allocUnsafe((T?2:3)+d),A=0;return v[A++]=to,T?v[A++]=d:(v[A++]=ar|1,v[A++]=d&255),v[A++]=cr,v[A++]=u,i<0?(v[A++]=0,A+=n.copy(v,A,0,t)):A+=n.copy(v,A,i,t),v[A++]=cr,v[A++]=l,o<0?(v[A++]=0,n.copy(v,A,t)):n.copy(v,A,t+o),v}s(Qc,"joseToDer");no.exports={derToJose:Xc,joseToDer:Qc}});var Pe=k(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.LRUCache=void 0;Ve.snakeToCamel=so;Ve.originalOrCamelOptions=ru;Ve.removeUndefinedValuesInObject=nu;Ve.isValidFile=iu;Ve.getWellKnownCertificateConfigFileLocation=su;var Zc=L("fs"),eu=L("os"),Sn=L("path"),tu="certificate_config.json",io="gcloud";function so(n){return n.replace(/([_][^_])/g,e=>e.slice(1).toUpperCase())}s(so,"snakeToCamel");function ru(n){function e(t){let r=n||{};return r[t]??r[so(t)]}return s(e,"get"),{get:e}}s(ru,"originalOrCamelOptions");var Cn=class{static{s(this,"LRUCache")}capacity;#e=new Map;maxAge;constructor(e){this.capacity=e.capacity,this.maxAge=e.maxAge}#t(e,t){this.#e.delete(e),this.#e.set(e,{value:t,lastAccessed:Date.now()})}set(e,t){this.#t(e,t),this.#r()}get(e){let t=this.#e.get(e);if(t)return this.#t(e,t.value),this.#r(),t.value}#r(){let e=this.maxAge?Date.now()-this.maxAge:0,t=this.#e.entries().next();for(;!t.done&&(this.#e.size>this.capacity||t.value[1].lastAccessed<e);)this.#e.delete(t.value[0]),t=this.#e.entries().next()}};Ve.LRUCache=Cn;function nu(n){return Object.entries(n).forEach(([e,t])=>{(t===void 0||t==="undefined")&&delete n[e]}),n}s(nu,"removeUndefinedValuesInObject");async function iu(n){try{return(await Zc.promises.lstat(n)).isFile()}catch{return!1}}s(iu,"isValidFile");function su(){let n=process.env.CLOUDSDK_CONFIG||(ou()?Sn.join(process.env.APPDATA||"",io):Sn.join(process.env.HOME||"",".config",io));return Sn.join(n,tu)}s(su,"getWellKnownCertificateConfigFileLocation");function ou(){return eu.platform().startsWith("win")}s(ou,"_isWindows")});var oo=k((Jh,au)=>{au.exports={name:"google-auth-library",version:"10.5.0",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:"googleapis/google-auth-library-nodejs.git",keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.0.0","gcp-metadata":"^8.0.0","google-logging-utils":"^1.0.0",gtoken:"^8.0.0",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.1","@types/node":"^22.0.0","@types/sinon":"^17.0.0","assert-rejects":"^1.0.0",c8:"^10.0.0",codecov:"^3.0.2",gts:"^6.0.0","is-docker":"^3.0.0",jsdoc:"^4.0.0","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","ts-loader":"^8.0.0",typescript:"5.8.2",webpack:"^5.21.2","webpack-cli":"^4.0.0"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start","docs-test":"echo 'disabled until linkinator is fixed'","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0"}});var On=k(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.USER_AGENT=ze.PRODUCT_NAME=ze.pkg=void 0;var ao=oo();ze.pkg=ao;var co="google-api-nodejs-client";ze.PRODUCT_NAME=co;var cu=`${co}/${ao.version}`;ze.USER_AGENT=cu});var ye=k(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.AuthClient=Ne.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=Ne.DEFAULT_UNIVERSE=void 0;var uu=L("events"),bn=ce(),lu=Pe(),fu=hn(),kn=On();Ne.DEFAULT_UNIVERSE="googleapis.com";Ne.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300*1e3;var Rn=class n extends uu.EventEmitter{static{s(this,"AuthClient")}apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=Ne.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=Ne.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(e={}){super();let t=(0,lu.originalOrCamelOptions)(e);this.apiKey=e.apiKey,this.projectId=t.get("project_id")??null,this.quotaProjectId=t.get("quota_project_id"),this.credentials=t.get("credentials")??{},this.universeDomain=t.get("universe_domain")??Ne.DEFAULT_UNIVERSE,this.transporter=e.transporter??new bn.Gaxios(e.transporterOptions),t.get("useAuthRequestParameters")!==!1&&(this.transporter.interceptors.request.add(n.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(n.DEFAULT_RESPONSE_INTERCEPTOR)),e.eagerRefreshThresholdMillis&&(this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis),this.forceRefreshOnFailure=e.forceRefreshOnFailure??!1}fetch(...e){let t=e[0],r=e[1],i,o=new Headers;return typeof t=="string"?i=new URL(t):t instanceof URL?i=t:t&&t.url&&(i=new URL(t.url)),t&&typeof t=="object"&&"headers"in t&&bn.Gaxios.mergeHeaders(o,t.headers),r&&bn.Gaxios.mergeHeaders(o,new Headers(r.headers)),typeof t=="object"&&!(t instanceof URL)?this.request({...r,...t,headers:o,url:i}):this.request({...r,headers:o,url:i})}setCredentials(e){this.credentials=e}addSharedMetadataHeaders(e){return!e.has("x-goog-user-project")&&this.quotaProjectId&&e.set("x-goog-user-project",this.quotaProjectId),e}addUserProjectAndAuthHeaders(e,t){let r=t.get("x-goog-user-project"),i=t.get("authorization");return r&&e.set("x-goog-user-project",r),i&&e.set("authorization",i),e}static log=(0,fu.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:s(async e=>{if(!e.headers.has("x-goog-api-client")){let r=process.version.replace(/^v/,"");e.headers.set("x-goog-api-client",`gl-node/${r}`)}let t=e.headers.get("User-Agent");t?t.includes(`${kn.PRODUCT_NAME}/`)||e.headers.set("User-Agent",`${t} ${kn.USER_AGENT}`):e.headers.set("User-Agent",kn.USER_AGENT);try{let r=e,i=r[n.RequestMethodNameSymbol],o=`${Math.floor(Math.random()*1e3)}`;r[n.RequestLogIdSymbol]=o;let u={url:e.url,headers:e.headers};i?n.log.info("%s [%s] request %j",i,o,u):n.log.info("[%s] request %j",o,u)}catch{}return e},"resolved")};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:s(async e=>{try{let t=e.config,r=t[n.RequestMethodNameSymbol],i=t[n.RequestLogIdSymbol];r?n.log.info("%s [%s] response %j",r,i,e.data):n.log.info("[%s] response %j",i,e.data)}catch{}return e},"resolved"),rejected:s(async e=>{try{let t=e.config,r=t[n.RequestMethodNameSymbol],i=t[n.RequestLogIdSymbol];r?n.log.info("%s [%s] error %j",r,i,e.response?.data):n.log.error("[%s] error %j",i,e.response?.data)}catch{}throw e},"rejected")};static setMethodName(e,t){try{let r=e;r[n.RequestMethodNameSymbol]=t}catch{}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};Ne.AuthClient=Rn});var Nn=k(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.LoginTicket=void 0;var Pn=class{static{s(this,"LoginTicket")}envelope;payload;constructor(e,t){this.envelope=e,this.payload=t}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let e=this.getPayload();return e&&e.sub?e.sub:null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}};ur.LoginTicket=Pn});var it=k(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.OAuth2Client=Fe.ClientAuthentication=Fe.CertificateFormat=Fe.CodeChallengeMethod=void 0;var uo=ce(),hu=L("querystring"),du=L("stream"),pu=vn(),lo=Pe(),In=Nt(),ht=ye(),gu=Nn(),fo;(function(n){n.Plain="plain",n.S256="S256"})(fo||(Fe.CodeChallengeMethod=fo={}));var We;(function(n){n.PEM="PEM",n.JWK="JWK"})(We||(Fe.CertificateFormat=We={}));var It;(function(n){n.ClientSecretPost="ClientSecretPost",n.ClientSecretBasic="ClientSecretBasic",n.None="None"})(It||(Fe.ClientAuthentication=It={}));var xn=class n extends ht.AuthClient{static{s(this,"OAuth2Client")}redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=We.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(e={},t,r){super(typeof e=="object"?e:{}),typeof e!="object"&&(e={clientId:e,clientSecret:t,redirectUri:r}),this._clientId=e.clientId||e.client_id,this._clientSecret=e.clientSecret||e.client_secret,this.redirectUri=e.redirectUri||e.redirect_uris?.[0],this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...e.endpoints},this.clientAuthentication=e.clientAuthentication||It.ClientSecretPost,this.issuers=e.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;generateAuthUrl(e={}){if(e.code_challenge_method&&!e.code_challenge)throw new Error("If a code_challenge_method is provided, code_challenge must be included.");return e.response_type=e.response_type||"code",e.client_id=e.client_id||this._clientId,e.redirect_uri=e.redirect_uri||this.redirectUri,Array.isArray(e.scope)&&(e.scope=e.scope.join(" ")),this.endpoints.oauth2AuthBaseUrl.toString()+"?"+hu.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let e=(0,In.createCrypto)(),r=e.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),o=(await e.sha256DigestBase64(r)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:r,codeChallenge:o}}getToken(e,t){let r=typeof e=="string"?{code:e}:e;if(t)this.getTokenAsync(r).then(i=>t(null,i.tokens,i.res),i=>t(i,null,i.response));else return this.getTokenAsync(r)}async getTokenAsync(e){let t=this.endpoints.oauth2TokenUrl.toString(),r=new Headers,i={client_id:e.client_id||this._clientId,code_verifier:e.codeVerifier,code:e.code,grant_type:"authorization_code",redirect_uri:e.redirect_uri||this.redirectUri};if(this.clientAuthentication===It.ClientSecretBasic){let d=Buffer.from(`${this._clientId}:${this._clientSecret}`);r.set("authorization",`Basic ${d.toString("base64")}`)}this.clientAuthentication===It.ClientSecretPost&&(i.client_secret=this._clientSecret);let o={...n.RETRY_CONFIG,method:"POST",url:t,data:new URLSearchParams((0,lo.removeUndefinedValuesInObject)(i)),headers:r};ht.AuthClient.setMethodName(o,"getTokenAsync");let u=await this.transporter.request(o),l=u.data;return u.data&&u.data.expires_in&&(l.expiry_date=new Date().getTime()+u.data.expires_in*1e3,delete l.expires_in),this.emit("tokens",l),{tokens:l,res:u}}async refreshToken(e){if(!e)return this.refreshTokenNoCache(e);if(this.refreshTokenPromises.has(e))return this.refreshTokenPromises.get(e);let t=this.refreshTokenNoCache(e).then(r=>(this.refreshTokenPromises.delete(e),r),r=>{throw this.refreshTokenPromises.delete(e),r});return this.refreshTokenPromises.set(e,t),t}async refreshTokenNoCache(e){if(!e)throw new Error("No refresh token is set.");let t=this.endpoints.oauth2TokenUrl.toString(),r={refresh_token:e,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},i;try{let u={...n.RETRY_CONFIG,method:"POST",url:t,data:new URLSearchParams((0,lo.removeUndefinedValuesInObject)(r))};ht.AuthClient.setMethodName(u,"refreshTokenNoCache"),i=await this.transporter.request(u)}catch(u){throw u instanceof uo.GaxiosError&&u.message==="invalid_grant"&&u.response?.data&&/ReAuth/i.test(u.response.data.error_description)&&(u.message=JSON.stringify(u.response.data)),u}let o=i.data;return i.data&&i.data.expires_in&&(o.expiry_date=new Date().getTime()+i.data.expires_in*1e3,delete o.expires_in),this.emit("tokens",o),{tokens:o,res:i}}refreshAccessToken(e){if(e)this.refreshAccessTokenAsync().then(t=>e(null,t.credentials,t.res),e);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let e=await this.refreshToken(this.credentials.refresh_token),t=e.tokens;return t.refresh_token=this.credentials.refresh_token,this.credentials=t,{credentials:this.credentials,res:e.res}}getAccessToken(e){if(e)this.getAccessTokenAsync().then(t=>e(null,t.token,t.res),e);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let r=await this.processAndValidateRefreshHandler();if(r?.access_token)return this.setCredentials(r),{token:this.credentials.access_token}}else throw new Error("No refresh token or refresh handler callback is set.");let t=await this.refreshAccessTokenAsync();if(!t.credentials||t.credentials&&!t.credentials.access_token)throw new Error("Could not refresh access token.");return{token:t.credentials.access_token,res:t.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(e){return(await this.getRequestMetadataAsync(e)).headers}async getRequestMetadataAsync(e){let t=this.credentials;if(!t.access_token&&!t.refresh_token&&!this.apiKey&&!this.refreshHandler)throw new Error("No access, refresh token, API key or refresh handler callback is set.");if(t.access_token&&!this.isTokenExpiring()){t.token_type=t.token_type||"Bearer";let l=new Headers({authorization:t.token_type+" "+t.access_token});return{headers:this.addSharedMetadataHeaders(l)}}if(this.refreshHandler){let l=await this.processAndValidateRefreshHandler();if(l?.access_token){this.setCredentials(l);let d=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(d)}}}if(this.apiKey)return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})};let r=null,i=null;try{r=await this.refreshToken(t.refresh_token),i=r.tokens}catch(l){let d=l;throw d.response&&(d.response.status===403||d.response.status===404)&&(d.message=`Could not refresh access token: ${d.message}`),d}let o=this.credentials;o.token_type=o.token_type||"Bearer",i.refresh_token=o.refresh_token,this.credentials=i;let u=new Headers({authorization:o.token_type+" "+i.access_token});return{headers:this.addSharedMetadataHeaders(u),res:r.res}}static getRevokeTokenUrl(e){return new n().getRevokeTokenURL(e).toString()}getRevokeTokenURL(e){let t=new URL(this.endpoints.oauth2RevokeUrl);return t.searchParams.append("token",e),t}revokeToken(e,t){let r={...n.RETRY_CONFIG,url:this.getRevokeTokenURL(e).toString(),method:"POST"};if(ht.AuthClient.setMethodName(r,"revokeToken"),t)this.transporter.request(r).then(i=>t(null,i),t);else return this.transporter.request(r)}revokeCredentials(e){if(e)this.revokeCredentialsAsync().then(t=>e(null,t),e);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let e=this.credentials.access_token;if(this.credentials={},e)return this.revokeToken(e);throw new Error("No access token to revoke.")}request(e,t){if(t)this.requestAsync(e).then(r=>t(null,r),r=>t(r,r.response));else return this.requestAsync(e)}async requestAsync(e,t=!1){try{let r=await this.getRequestMetadataAsync();return e.headers=uo.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,r.headers),this.apiKey&&e.headers.set("X-Goog-Api-Key",this.apiKey),await this.transporter.request(e)}catch(r){let i=r.response;if(i){let o=i.status,u=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),l=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,d=i.config.data instanceof du.Readable,T=o===401||o===403;if(!t&&T&&!d&&u)return await this.refreshAccessTokenAsync(),this.requestAsync(e,!0);if(!t&&T&&!d&&l){let v=await this.processAndValidateRefreshHandler();return v?.access_token&&this.setCredentials(v),this.requestAsync(e,!0)}}throw r}}verifyIdToken(e,t){if(t&&typeof t!="function")throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(t)this.verifyIdTokenAsync(e).then(r=>t(null,r),t);else return this.verifyIdTokenAsync(e)}async verifyIdTokenAsync(e){if(!e.idToken)throw new Error("The verifyIdToken method requires an ID Token");let t=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(e.idToken,t.certs,e.audience,this.issuers,e.maxExpiry)}async getTokenInfo(e){let{data:t}=await this.transporter.request({...n.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${e}`},url:this.endpoints.tokenInfoUrl.toString()}),r=Object.assign({expiry_date:new Date().getTime()+t.expires_in*1e3,scopes:t.scope.split(" ")},t);return delete r.expires_in,delete r.scope,r}getFederatedSignonCerts(e){if(e)this.getFederatedSignonCertsAsync().then(t=>e(null,t.certs,t.res),e);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let e=new Date().getTime(),t=(0,In.hasBrowserCrypto)()?We.JWK:We.PEM;if(this.certificateExpiry&&e<this.certificateExpiry.getTime()&&this.certificateCacheFormat===t)return{certs:this.certificateCache,format:t};let r,i;switch(t){case We.PEM:i=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case We.JWK:i=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${t}`)}try{let T={...n.RETRY_CONFIG,url:i};ht.AuthClient.setMethodName(T,"getFederatedSignonCertsAsync"),r=await this.transporter.request(T)}catch(T){throw T instanceof Error&&(T.message=`Failed to retrieve verification certificates: ${T.message}`),T}let o=r?.headers.get("cache-control"),u=-1;if(o){let T=/max-age=(?<maxAge>[0-9]+)/.exec(o)?.groups?.maxAge;T&&(u=Number(T)*1e3)}let l={};switch(t){case We.PEM:l=r.data;break;case We.JWK:for(let T of r.data.keys)l[T.kid]=T;break;default:throw new Error(`Unsupported certificate format ${t}`)}let d=new Date;return this.certificateExpiry=u===-1?null:new Date(d.getTime()+u),this.certificateCache=l,this.certificateCacheFormat=t,{certs:l,format:t,res:r}}getIapPublicKeys(e){if(e)this.getIapPublicKeysAsync().then(t=>e(null,t.pubkeys,t.res),e);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let e,t=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let r={...n.RETRY_CONFIG,url:t};ht.AuthClient.setMethodName(r,"getIapPublicKeysAsync"),e=await this.transporter.request(r)}catch(r){throw r instanceof Error&&(r.message=`Failed to retrieve verification certificates: ${r.message}`),r}return{pubkeys:e.data,res:e}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(e,t,r,i,o){let u=(0,In.createCrypto)();o||(o=n.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);let l=e.split(".");if(l.length!==3)throw new Error("Wrong number of segments in token: "+e);let d=l[0]+"."+l[1],T=l[2],v,A;try{v=JSON.parse(u.decodeBase64StringUtf8(l[0]))}catch(V){throw V instanceof Error&&(V.message=`Can't parse token envelope: ${l[0]}': ${V.message}`),V}if(!v)throw new Error("Can't parse token envelope: "+l[0]);try{A=JSON.parse(u.decodeBase64StringUtf8(l[1]))}catch(V){throw V instanceof Error&&(V.message=`Can't parse token payload '${l[0]}`),V}if(!A)throw new Error("Can't parse token payload: "+l[1]);if(!Object.prototype.hasOwnProperty.call(t,v.kid))throw new Error("No pem found for envelope: "+JSON.stringify(v));let b=t[v.kid];if(v.alg==="ES256"&&(T=pu.joseToDer(T,"ES256").toString("base64")),!await u.verify(b,d,T))throw new Error("Invalid token signature: "+e);if(!A.iat)throw new Error("No issue time in token: "+JSON.stringify(A));if(!A.exp)throw new Error("No expiration time in token: "+JSON.stringify(A));let B=Number(A.iat);if(isNaN(B))throw new Error("iat field using invalid format");let I=Number(A.exp);if(isNaN(I))throw new Error("exp field using invalid format");let x=new Date().getTime()/1e3;if(I>=x+o)throw new Error("Expiration time too far in future: "+JSON.stringify(A));let R=B-n.CLOCK_SKEW_SECS_,X=I+n.CLOCK_SKEW_SECS_;if(x<R)throw new Error("Token used too early, "+x+" < "+R+": "+JSON.stringify(A));if(x>X)throw new Error("Token used too late, "+x+" > "+X+": "+JSON.stringify(A));if(i&&i.indexOf(A.iss)<0)throw new Error("Invalid issuer, expected one of ["+i+"], but got "+A.iss);if(typeof r<"u"&&r!==null){let V=A.aud,re=!1;if(r.constructor===Array?re=r.indexOf(V)>-1:re=V===r,!re)throw new Error("Wrong recipient, payload audience != requiredAudience")}return new gu.LoginTicket(v,A)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let e=await this.refreshHandler();if(!e.access_token)throw new Error("No access token is returned by the refreshHandler callback.");return e}}isTokenExpiring(){let e=this.credentials.expiry_date;return e?e<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};Fe.OAuth2Client=xn});var jn=k(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.Compute=void 0;var yu=ce(),ho=Pt(),mu=it(),Un=class extends mu.OAuth2Client{static{s(this,"Compute")}serviceAccountEmail;scopes;constructor(e={}){super(e),this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=e.serviceAccountEmail||"default",this.scopes=Array.isArray(e.scopes)?e.scopes:e.scopes?[e.scopes]:[]}async refreshTokenNoCache(){let e=`service-accounts/${this.serviceAccountEmail}/token`,t;try{let i={property:e};this.scopes.length>0&&(i.params={scopes:this.scopes.join(",")}),t=await ho.instance(i)}catch(i){throw i instanceof yu.GaxiosError&&(i.message=`Could not refresh access token: ${i.message}`,this.wrapError(i)),i}let r=t;return t&&t.expires_in&&(r.expiry_date=new Date().getTime()+t.expires_in*1e3,delete r.expires_in),this.emit("tokens",r),{tokens:r,res:null}}async fetchIdToken(e){let t=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${e}`,r;try{let i={property:t};r=await ho.instance(i)}catch(i){throw i instanceof Error&&(i.message=`Could not fetch ID token: ${i.message}`),i}return r}wrapError(e){let t=e.response;t&&t.status&&(e.status=t.status,t.status===403?e.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+e.message:t.status===404&&(e.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+e.message))}};lr.Compute=Un});var qn=k(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.IdTokenClient=void 0;var _u=it(),Dn=class extends _u.OAuth2Client{static{s(this,"IdTokenClient")}targetAudience;idTokenProvider;constructor(e){super(e),this.targetAudience=e.targetAudience,this.idTokenProvider=e.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let t=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:t,expiry_date:this.getIdTokenExpiryDate(t)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(e){let t=e.split(".")[1];if(t)return JSON.parse(Buffer.from(t,"base64").toString("ascii")).exp*1e3}};fr.IdTokenClient=Dn});var Fn=k(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.GCPEnv=void 0;dt.clear=wu;dt.getEnv=Eu;var po=Pt(),Me;(function(n){n.APP_ENGINE="APP_ENGINE",n.KUBERNETES_ENGINE="KUBERNETES_ENGINE",n.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",n.COMPUTE_ENGINE="COMPUTE_ENGINE",n.CLOUD_RUN="CLOUD_RUN",n.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",n.NONE="NONE"})(Me||(dt.GCPEnv=Me={}));var xt;function wu(){xt=void 0}s(wu,"clear");async function Eu(){return xt||(xt=Au(),xt)}s(Eu,"getEnv");async function Au(){let n=Me.NONE;return Tu()?n=Me.APP_ENGINE:vu()?n=Me.CLOUD_FUNCTIONS:await bu()?await Ou()?n=Me.KUBERNETES_ENGINE:Su()?n=Me.CLOUD_RUN:Cu()?n=Me.CLOUD_RUN_JOBS:n=Me.COMPUTE_ENGINE:n=Me.NONE,n}s(Au,"getEnvMemoized");function Tu(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}s(Tu,"isAppEngine");function vu(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}s(vu,"isCloudFunction");function Su(){return!!process.env.K_CONFIGURATION}s(Su,"isCloudRun");function Cu(){return!!process.env.CLOUD_RUN_JOB}s(Cu,"isCloudRunJob");async function Ou(){try{return await po.instance("attributes/cluster-name"),!0}catch{return!1}}s(Ou,"isKubernetesEngine");async function bu(){return po.isAvailable()}s(bu,"isComputeEngine")});var Mn=k((od,go)=>{var hr=ft().Buffer,ku=L("stream"),Ru=L("util");function dr(n){if(this.buffer=null,this.writable=!0,this.readable=!0,!n)return this.buffer=hr.alloc(0),this;if(typeof n.pipe=="function")return this.buffer=hr.alloc(0),n.pipe(this),this;if(n.length||typeof n=="object")return this.buffer=n,this.writable=!1,process.nextTick(function(){this.emit("end",n),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof n+")")}s(dr,"DataStream");Ru.inherits(dr,ku);dr.prototype.write=s(function(e){this.buffer=hr.concat([this.buffer,hr.from(e)]),this.emit("data",e)},"write");dr.prototype.end=s(function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},"end");go.exports=dr});var mo=k((cd,yo)=>{"use strict";var Ut=L("buffer").Buffer,Ln=L("buffer").SlowBuffer;yo.exports=pr;function pr(n,e){if(!Ut.isBuffer(n)||!Ut.isBuffer(e)||n.length!==e.length)return!1;for(var t=0,r=0;r<n.length;r++)t|=n[r]^e[r];return t===0}s(pr,"bufferEq");pr.install=function(){Ut.prototype.equal=Ln.prototype.equal=s(function(e){return pr(this,e)},"equal")};var Pu=Ut.prototype.equal,Nu=Ln.prototype.equal;pr.restore=function(){Ut.prototype.equal=Pu,Ln.prototype.equal=Nu}});var $n=k((ld,Oo)=>{var gt=ft().Buffer,Ce=L("crypto"),wo=vn(),_o=L("util"),Iu=`"%s" is not a valid algorithm.
31
+ Supported algorithms are:
32
+ "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,jt="secret must be a string or buffer",pt="key must be a string or a buffer",xu="key must be a string, a buffer or an object",Bn=typeof Ce.createPublicKey=="function";Bn&&(pt+=" or a KeyObject",jt+="or a KeyObject");function Eo(n){if(!gt.isBuffer(n)&&typeof n!="string"&&(!Bn||typeof n!="object"||typeof n.type!="string"||typeof n.asymmetricKeyType!="string"||typeof n.export!="function"))throw Ie(pt)}s(Eo,"checkIsPublicKey");function Ao(n){if(!gt.isBuffer(n)&&typeof n!="string"&&typeof n!="object")throw Ie(xu)}s(Ao,"checkIsPrivateKey");function Uu(n){if(!gt.isBuffer(n)){if(typeof n=="string")return n;if(!Bn||typeof n!="object"||n.type!=="secret"||typeof n.export!="function")throw Ie(jt)}}s(Uu,"checkIsSecretKey");function Hn(n){return n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}s(Hn,"fromBase64");function To(n){n=n.toString();var e=4-n.length%4;if(e!==4)for(var t=0;t<e;++t)n+="=";return n.replace(/\-/g,"+").replace(/_/g,"/")}s(To,"toBase64");function Ie(n){var e=[].slice.call(arguments,1),t=_o.format.bind(_o,n).apply(null,e);return new TypeError(t)}s(Ie,"typeError");function ju(n){return gt.isBuffer(n)||typeof n=="string"}s(ju,"bufferOrString");function Dt(n){return ju(n)||(n=JSON.stringify(n)),n}s(Dt,"normalizeInput");function vo(n){return s(function(t,r){Uu(r),t=Dt(t);var i=Ce.createHmac("sha"+n,r),o=(i.update(t),i.digest("base64"));return Hn(o)},"sign")}s(vo,"createHmacSigner");var Gn,Du="timingSafeEqual"in Ce?s(function(e,t){return e.byteLength!==t.byteLength?!1:Ce.timingSafeEqual(e,t)},"timingSafeEqual"):s(function(e,t){return Gn||(Gn=mo()),Gn(e,t)},"timingSafeEqual");function qu(n){return s(function(t,r,i){var o=vo(n)(t,i);return Du(gt.from(r),gt.from(o))},"verify")}s(qu,"createHmacVerifier");function So(n){return s(function(t,r){Ao(r),t=Dt(t);var i=Ce.createSign("RSA-SHA"+n),o=(i.update(t),i.sign(r,"base64"));return Hn(o)},"sign")}s(So,"createKeySigner");function Co(n){return s(function(t,r,i){Eo(i),t=Dt(t),r=To(r);var o=Ce.createVerify("RSA-SHA"+n);return o.update(t),o.verify(i,r,"base64")},"verify")}s(Co,"createKeyVerifier");function Fu(n){return s(function(t,r){Ao(r),t=Dt(t);var i=Ce.createSign("RSA-SHA"+n),o=(i.update(t),i.sign({key:r,padding:Ce.constants.RSA_PKCS1_PSS_PADDING,saltLength:Ce.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Hn(o)},"sign")}s(Fu,"createPSSKeySigner");function Mu(n){return s(function(t,r,i){Eo(i),t=Dt(t),r=To(r);var o=Ce.createVerify("RSA-SHA"+n);return o.update(t),o.verify({key:i,padding:Ce.constants.RSA_PKCS1_PSS_PADDING,saltLength:Ce.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")},"verify")}s(Mu,"createPSSKeyVerifier");function Lu(n){var e=So(n);return s(function(){var r=e.apply(null,arguments);return r=wo.derToJose(r,"ES"+n),r},"sign")}s(Lu,"createECDSASigner");function Gu(n){var e=Co(n);return s(function(r,i,o){i=wo.joseToDer(i,"ES"+n).toString("base64");var u=e(r,i,o);return u},"verify")}s(Gu,"createECDSAVerifer");function Bu(){return s(function(){return""},"sign")}s(Bu,"createNoneSigner");function Hu(){return s(function(e,t){return t===""},"verify")}s(Hu,"createNoneVerifier");Oo.exports=s(function(e){var t={hs:vo,rs:So,ps:Fu,es:Lu,none:Bu},r={hs:qu,rs:Co,ps:Mu,es:Gu,none:Hu},i=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw Ie(Iu,e);var o=(i[1]||i[3]).toLowerCase(),u=i[2];return{sign:t[o](u),verify:r[o](u)}},"jwa")});var Kn=k((hd,bo)=>{var $u=L("buffer").Buffer;bo.exports=s(function(e){return typeof e=="string"?e:typeof e=="number"||$u.isBuffer(e)?e.toString():JSON.stringify(e)},"toString")});var xo=k((pd,Io)=>{var Ku=ft().Buffer,ko=Mn(),Ju=$n(),Vu=L("stream"),Ro=Kn(),Jn=L("util");function Po(n,e){return Ku.from(n,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}s(Po,"base64url");function Wu(n,e,t){t=t||"utf8";var r=Po(Ro(n),"binary"),i=Po(Ro(e),t);return Jn.format("%s.%s",r,i)}s(Wu,"jwsSecuredInput");function No(n){var e=n.header,t=n.payload,r=n.secret||n.privateKey,i=n.encoding,o=Ju(e.alg),u=Wu(e,t,i),l=o.sign(u,r);return Jn.format("%s.%s",u,l)}s(No,"jwsSign");function gr(n){var e=n.secret;if(e=e??n.privateKey,e=e??n.key,/^hs/i.test(n.header.alg)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var t=new ko(e);this.readable=!0,this.header=n.header,this.encoding=n.encoding,this.secret=this.privateKey=this.key=t,this.payload=new ko(n.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}s(gr,"SignStream");Jn.inherits(gr,Vu);gr.prototype.sign=s(function(){try{var e=No({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},"sign");gr.sign=No;Io.exports=gr});var Ho=k((yd,Bo)=>{var jo=ft().Buffer,Uo=Mn(),Yu=$n(),zu=L("stream"),Do=Kn(),Xu=L("util"),Qu=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Zu(n){return Object.prototype.toString.call(n)==="[object Object]"}s(Zu,"isObject");function el(n){if(Zu(n))return n;try{return JSON.parse(n)}catch{return}}s(el,"safeJsonParse");function qo(n){var e=n.split(".",1)[0];return el(jo.from(e,"base64").toString("binary"))}s(qo,"headerFromJWS");function tl(n){return n.split(".",2).join(".")}s(tl,"securedInputFromJWS");function Fo(n){return n.split(".")[2]}s(Fo,"signatureFromJWS");function rl(n,e){e=e||"utf8";var t=n.split(".")[1];return jo.from(t,"base64").toString(e)}s(rl,"payloadFromJWS");function Mo(n){return Qu.test(n)&&!!qo(n)}s(Mo,"isValidJws");function Lo(n,e,t){if(!e){var r=new Error("Missing algorithm parameter for jws.verify");throw r.code="MISSING_ALGORITHM",r}n=Do(n);var i=Fo(n),o=tl(n),u=Yu(e);return u.verify(o,i,t)}s(Lo,"jwsVerify");function Go(n,e){if(e=e||{},n=Do(n),!Mo(n))return null;var t=qo(n);if(!t)return null;var r=rl(n);return(t.typ==="JWT"||e.json)&&(r=JSON.parse(r,e.encoding)),{header:t,payload:r,signature:Fo(n)}}s(Go,"jwsDecode");function yt(n){n=n||{};var e=n.secret;if(e=e??n.publicKey,e=e??n.key,/^hs/i.test(n.algorithm)===!0&&e==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var t=new Uo(e);this.readable=!0,this.algorithm=n.algorithm,this.encoding=n.encoding,this.secret=this.publicKey=this.key=t,this.signature=new Uo(n.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}s(yt,"VerifyStream");Xu.inherits(yt,zu);yt.prototype.verify=s(function(){try{var e=Lo(this.signature.buffer,this.algorithm,this.key.buffer),t=Go(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}},"verify");yt.decode=Go;yt.isValid=Mo;yt.verify=Lo;Bo.exports=yt});var Vn=k(Xe=>{var $o=xo(),yr=Ho(),nl=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Xe.ALGORITHMS=nl;Xe.sign=$o.sign;Xe.verify=yr.verify;Xe.decode=yr.decode;Xe.isValid=yr.isValid;Xe.createSign=s(function(e){return new $o(e)},"createSign");Xe.createVerify=s(function(e){return new yr(e)},"createVerify")});var sa=k(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.GoogleToken=void 0;var Ko=mr(L("fs")),il=ce(),sl=mr(Vn()),ol=mr(L("path")),al=L("util");function mr(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(mr=s(function(o,u){if(!u&&o&&o.__esModule)return o;var l,d,T={__proto__:null,default:o};if(o===null||Ye(o)!="object"&&typeof o!="function")return T;if(l=u?r:t){if(l.has(o))return l.get(o);l.set(o,T)}for(var v in o)v!=="default"&&{}.hasOwnProperty.call(o,v)&&((d=(l=Object.defineProperty)&&Object.getOwnPropertyDescriptor(o,v))&&(d.get||d.set)?l(T,v,d):T[v]=o[v]);return T},"_interopRequireWildcard"))(n,e)}s(mr,"_interopRequireWildcard");function Ye(n){"@babel/helpers - typeof";return Ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(n)}s(Ye,"_typeof");function cl(n,e){ea(n,e),e.add(n)}s(cl,"_classPrivateMethodInitSpec");function ul(n,e,t){ea(n,e),e.set(n,t)}s(ul,"_classPrivateFieldInitSpec");function ea(n,e){if(e.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(ea,"_checkPrivateRedeclaration");function Jo(n,e,t){return n.set(xe(n,e),t),t}s(Jo,"_classPrivateFieldSet");function Vo(n,e){return n.get(xe(n,e))}s(Vo,"_classPrivateFieldGet");function xe(n,e,t){if(typeof n=="function"?n===e:n.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}s(xe,"_assertClassBrand");function Wo(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,na(r.key),r)}}s(Wo,"_defineProperties");function ta(n,e,t){return e&&Wo(n.prototype,e),t&&Wo(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}s(ta,"_createClass");function ra(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}s(ra,"_classCallCheck");function ll(n,e,t){return e=Lt(e),fl(n,Zn()?Reflect.construct(e,t||[],Lt(n).constructor):e.apply(n,t))}s(ll,"_callSuper");function fl(n,e){if(e&&(Ye(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hl(n)}s(fl,"_possibleConstructorReturn");function hl(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}s(hl,"_assertThisInitialized");function dl(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Mt(n,e)}s(dl,"_inherits");function Wn(n){var e=typeof Map=="function"?new Map:void 0;return Wn=s(function(r){if(r===null||!gl(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return pl(r,arguments,Lt(this).constructor)}return s(i,"Wrapper"),i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Mt(i,r)},"_wrapNativeSuper"),Wn(n)}s(Wn,"_wrapNativeSuper");function pl(n,e,t){if(Zn())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(n.bind.apply(n,r));return t&&Mt(i,t.prototype),i}s(pl,"_construct");function Zn(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zn=s(function(){return!!n},"_isNativeReflectConstruct"))()}s(Zn,"_isNativeReflectConstruct");function gl(n){try{return Function.toString.call(n).indexOf("[native code]")!==-1}catch{return typeof n=="function"}}s(gl,"_isNativeFunction");function Mt(n,e){return Mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Mt(n,e)}s(Mt,"_setPrototypeOf");function Lt(n){return Lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lt(n)}s(Lt,"_getPrototypeOf");function me(n,e,t){return(e=na(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}s(me,"_defineProperty");function na(n){var e=yl(n,"string");return Ye(e)=="symbol"?e:e+""}s(na,"_toPropertyKey");function yl(n,e){if(Ye(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ye(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}s(yl,"_toPrimitive");function we(){var n,e,t=typeof Symbol=="function"?Symbol:{},r=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function o(F,B,I,x){var R=B&&B.prototype instanceof l?B:l,X=Object.create(R.prototype);return _e(X,"_invoke",(function(V,re,M){var N,D,G,O=0,Q=M||[],J=!1,H={p:0,n:0,v:n,a:oe,f:oe.bind(n,4),d:s(function(ne,Z){return N=ne,D=0,G=n,H.n=Z,u},"d")};function oe(z,ne){for(D=z,G=ne,e=0;!J&&O&&!Z&&e<Q.length;e++){var Z,ie=Q[e],$e=H.p,de=ie[2];z>3?(Z=de===ne)&&(G=ie[(D=ie[4])?5:(D=3,3)],ie[4]=ie[5]=n):ie[0]<=$e&&((Z=z<2&&$e<ie[1])?(D=0,H.v=ne,H.n=ie[1]):$e<de&&(Z=z<3||ie[0]>ne||ne>de)&&(ie[4]=z,ie[5]=ne,H.n=de,D=0))}if(Z||z>1)return u;throw J=!0,ne}return s(oe,"d"),function(z,ne,Z){if(O>1)throw TypeError("Generator is already running");for(J&&ne===1&&oe(ne,Z),D=ne,G=Z;(e=D<2?n:G)||!J;){N||(D?D<3?(D>1&&(H.n=-1),oe(D,G)):H.n=G:H.v=G);try{if(O=2,N){if(D||(z="next"),e=N[z]){if(!(e=e.call(N,G)))throw TypeError("iterator result is not an object");if(!e.done)return e;G=e.value,D<2&&(D=0)}else D===1&&(e=N.return)&&e.call(N),D<2&&(G=TypeError("The iterator does not provide a '"+z+"' method"),D=1);N=n}else if((e=(J=H.n<0)?G:V.call(re,H))!==u)break}catch(ie){N=n,D=1,G=ie}finally{O=1}}return{value:e,done:J}}})(F,I,x),!0),X}s(o,"i");var u={};function l(){}s(l,"Generator");function d(){}s(d,"GeneratorFunction");function T(){}s(T,"GeneratorFunctionPrototype"),e=Object.getPrototypeOf;var v=[][r]?e(e([][r]())):(_e(e={},r,function(){return this}),e),A=T.prototype=l.prototype=Object.create(v);function b(F){return Object.setPrototypeOf?Object.setPrototypeOf(F,T):(F.__proto__=T,_e(F,i,"GeneratorFunction")),F.prototype=Object.create(A),F}return s(b,"f"),d.prototype=T,_e(A,"constructor",T),_e(T,"constructor",d),d.displayName="GeneratorFunction",_e(T,i,"GeneratorFunction"),_e(A),_e(A,i,"Generator"),_e(A,r,function(){return this}),_e(A,"toString",function(){return"[object Generator]"}),(we=s(function(){return{w:o,m:b}},"_regenerator"))()}s(we,"_regenerator");function _e(n,e,t,r){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}_e=s(function(u,l,d,T){if(l)i?i(u,l,{value:d,enumerable:!T,configurable:!T,writable:!T}):u[l]=d;else{var v=s(function(b,F){_e(u,b,function(B){return this._invoke(b,F,B)})},"o");v("next",0),v("throw",1),v("return",2)}},"_regeneratorDefine"),_e(n,e,t,r)}s(_e,"_regeneratorDefine2");function Yo(n,e,t,r,i,o,u){try{var l=n[o](u),d=l.value}catch(T){return void t(T)}l.done?e(d):Promise.resolve(d).then(r,i)}s(Yo,"asyncGeneratorStep");function mt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function u(d){Yo(o,r,i,u,l,"next",d)}s(u,"_next");function l(d){Yo(o,r,i,u,l,"throw",d)}s(l,"_throw"),u(void 0)})}}s(mt,"_asyncToGenerator");var zo=Ko.readFile?(0,al.promisify)(Ko.readFile):mt(we().m(s(function n(){return we().w(function(e){for(;;)switch(e.n){case 0:throw new Ft("use key rather than keyFile.","MISSING_CREDENTIALS");case 1:return e.a(2)}},n)},"_callee"))),Xo="https://oauth2.googleapis.com/token",ml="https://oauth2.googleapis.com/revoke?token=",Ft=(function(n){function e(t,r){var i;return ra(this,e),i=ll(this,e,[t]),me(i,"code",void 0),i.code=r,i}return s(e,"ErrorWithCode"),dl(e,n),ta(e)})(Wn(Error)),qt=new WeakMap,Le=new WeakSet,Ed=_r.GoogleToken=(function(){function n(e){ra(this,n),cl(this,Le),me(this,"expiresAt",void 0),me(this,"key",void 0),me(this,"keyFile",void 0),me(this,"iss",void 0),me(this,"sub",void 0),me(this,"scope",void 0),me(this,"rawToken",void 0),me(this,"tokenExpires",void 0),me(this,"email",void 0),me(this,"additionalClaims",void 0),me(this,"eagerRefreshThresholdMillis",void 0),me(this,"transporter",{request:s(function(r){return(0,il.request)(r)},"request")}),ul(this,qt,void 0),xe(Le,this,ia).call(this,e)}return s(n,"GoogleToken"),ta(n,[{key:"accessToken",get:s(function(){return this.rawToken?this.rawToken.access_token:void 0},"get")},{key:"idToken",get:s(function(){return this.rawToken?this.rawToken.id_token:void 0},"get")},{key:"tokenType",get:s(function(){return this.rawToken?this.rawToken.token_type:void 0},"get")},{key:"refreshToken",get:s(function(){return this.rawToken?this.rawToken.refresh_token:void 0},"get")},{key:"hasExpired",value:s(function(){var t=new Date().getTime();return this.rawToken&&this.expiresAt?t>=this.expiresAt:!0},"hasExpired")},{key:"isTokenExpiring",value:s(function(){var t,r=new Date().getTime(),i=(t=this.eagerRefreshThresholdMillis)!==null&&t!==void 0?t:0;return this.rawToken&&this.expiresAt?this.expiresAt<=r+i:!0},"isTokenExpiring")},{key:"getToken",value:s(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Ye(t)==="object"&&(r=t,t=void 0),r=Object.assign({forceRefresh:!1},r),t){var i=t;xe(Le,this,Qo).call(this,r).then(function(o){return i(null,o)},t);return}return xe(Le,this,Qo).call(this,r)},"getToken")},{key:"getCredentials",value:(function(){var e=mt(we().m(s(function r(i){var o,u,l,d,T,v,A;return we().w(function(b){for(;;)switch(b.n){case 0:o=ol.extname(i),A=o,b.n=A===".json"?1:A===".der"||A===".crt"||A===".pem"?4:A===".p12"||A===".pfx"?6:7;break;case 1:return b.n=2,zo(i,"utf8");case 2:if(u=b.v,l=JSON.parse(u),d=l.private_key,T=l.client_email,!(!d||!T)){b.n=3;break}throw new Ft("private_key and client_email are required.","MISSING_CREDENTIALS");case 3:return b.a(2,{privateKey:d,clientEmail:T});case 4:return b.n=5,zo(i,"utf8");case 5:return v=b.v,b.a(2,{privateKey:v});case 6:throw new Ft("*.p12 certificates are not supported after v6.1.2. Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE");case 7:throw new Ft("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE");case 8:return b.a(2)}},r)},"_callee2")));function t(r){return e.apply(this,arguments)}return s(t,"getCredentials"),t})()},{key:"revokeToken",value:s(function(t){if(t){xe(Le,this,Zo).call(this).then(function(){return t()},t);return}return xe(Le,this,Zo).call(this)},"revokeToken")}])})();function Qo(n){return Yn.apply(this,arguments)}s(Qo,"_getTokenAsync");function Yn(){return Yn=mt(we().m(s(function n(e){return we().w(function(t){for(;;)switch(t.n){case 0:if(!(Vo(qt,this)&&!e.forceRefresh)){t.n=1;break}return t.a(2,Vo(qt,this));case 1:return t.p=1,t.n=2,Jo(qt,this,xe(Le,this,_l).call(this,e));case 2:return t.a(2,t.v);case 3:return t.p=3,Jo(qt,this,void 0),t.f(3);case 4:return t.a(2)}},n,this,[[1,,3,4]])},"_callee3"))),Yn.apply(this,arguments)}s(Yn,"_getTokenAsync2");function _l(n){return zn.apply(this,arguments)}s(_l,"_getTokenAsyncInner");function zn(){return zn=mt(we().m(s(function n(e){var t;return we().w(function(r){for(;;)switch(r.n){case 0:if(!(this.isTokenExpiring()===!1&&e.forceRefresh===!1)){r.n=1;break}return r.a(2,Promise.resolve(this.rawToken));case 1:if(!(!this.key&&!this.keyFile)){r.n=2;break}throw new Error("No key or keyFile set.");case 2:if(!(!this.key&&this.keyFile)){r.n=4;break}return r.n=3,this.getCredentials(this.keyFile);case 3:t=r.v,this.key=t.privateKey,this.iss=t.clientEmail||this.iss,t.clientEmail||xe(Le,this,wl).call(this);case 4:return r.a(2,xe(Le,this,El).call(this))}},n,this)},"_callee4"))),zn.apply(this,arguments)}s(zn,"_getTokenAsyncInner2");function wl(){if(!this.iss)throw new Ft("email is required.","MISSING_CREDENTIALS")}s(wl,"_ensureEmail");function Zo(){return Xn.apply(this,arguments)}s(Zo,"_revokeTokenAsync");function Xn(){return Xn=mt(we().m(s(function n(){var e;return we().w(function(t){for(;;)switch(t.n){case 0:if(this.accessToken){t.n=1;break}throw new Error("No token to revoke.");case 1:return e=ml+this.accessToken,t.n=2,this.transporter.request({url:e,retry:!0});case 2:xe(Le,this,ia).call(this,{email:this.iss,sub:this.sub,key:this.key,keyFile:this.keyFile,scope:this.scope,additionalClaims:this.additionalClaims});case 3:return t.a(2)}},n,this)},"_callee5"))),Xn.apply(this,arguments)}s(Xn,"_revokeTokenAsync2");function ia(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.keyFile=n.keyFile,this.key=n.key,this.rawToken=void 0,this.iss=n.email||n.iss,this.sub=n.sub,this.additionalClaims=n.additionalClaims,Ye(n.scope)==="object"?this.scope=n.scope.join(" "):this.scope=n.scope,this.eagerRefreshThresholdMillis=n.eagerRefreshThresholdMillis,n.transporter&&(this.transporter=n.transporter)}s(ia,"_configure");function El(){return Qn.apply(this,arguments)}s(El,"_requestToken");function Qn(){return Qn=mt(we().m(s(function n(){var e,t,r,i,o,u,l,d,T,v;return we().w(function(A){for(;;)switch(A.n){case 0:return e=Math.floor(new Date().getTime()/1e3),t=this.additionalClaims||{},r=Object.assign({iss:this.iss,scope:this.scope,aud:Xo,exp:e+3600,iat:e,sub:this.sub},t),i=sl.sign({header:{alg:"RS256"},payload:r,secret:this.key}),A.p=1,A.n=2,this.transporter.request({method:"POST",url:Xo,data:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}});case 2:return o=A.v,this.rawToken=o.data,this.expiresAt=o.data.expires_in===null||o.data.expires_in===void 0?void 0:(e+o.data.expires_in)*1e3,A.a(2,this.rawToken);case 3:throw A.p=3,v=A.v,this.rawToken=void 0,this.tokenExpires=void 0,d=v.response&&(u=v.response)!==null&&u!==void 0&&u.data?(l=v.response)===null||l===void 0?void 0:l.data:{},d.error&&(T=d.error_description?": ".concat(d.error_description):"",v.message="".concat(d.error).concat(T)),v;case 4:return A.a(2)}},n,this,[[1,3]])},"_callee6"))),Qn.apply(this,arguments)}s(Qn,"_requestToken2")});var ti=k(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.JWTAccess=void 0;var Al=Vn(),Tl=Pe(),oa={alg:"RS256",typ:"JWT"},ei=class n{static{s(this,"JWTAccess")}email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new Tl.LRUCache({capacity:500,maxAge:3600*1e3});constructor(e,t,r,i){this.email=e,this.key=t,this.keyId=r,this.eagerRefreshThresholdMillis=i??300*1e3}getCachedKey(e,t){let r=e;if(t&&Array.isArray(t)&&t.length?r=e?`${e}_${t.join("_")}`:`${t.join("_")}`:typeof t=="string"&&(r=e?`${e}_${t}`:t),!r)throw Error("Scopes or url must be provided");return r}getRequestHeaders(e,t,r){let i=this.getCachedKey(e,r),o=this.cache.get(i),u=Date.now();if(o&&o.expiration-u>this.eagerRefreshThresholdMillis)return new Headers(o.headers);let l=Math.floor(Date.now()/1e3),d=n.getExpirationTime(l),T;if(Array.isArray(r)&&(r=r.join(" ")),r?T={iss:this.email,sub:this.email,scope:r,exp:d,iat:l}:T={iss:this.email,sub:this.email,aud:e,exp:d,iat:l},t){for(let B in T)if(t[B])throw new Error(`The '${B}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let v=this.keyId?{...oa,kid:this.keyId}:oa,A=Object.assign(T,t),b=Al.sign({header:v,payload:A,secret:this.key}),F=new Headers({authorization:`Bearer ${b}`});return this.cache.set(i,{expiration:d*1e3,headers:F}),F}static getExpirationTime(e){return e+3600}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!e.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!e.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=e.client_email,this.key=e.private_key,this.keyId=e.private_key_id,this.projectId=e.project_id}fromStream(e,t){if(t)this.fromStreamAsync(e).then(()=>t(),t);else return this.fromStreamAsync(e)}fromStreamAsync(e){return new Promise((t,r)=>{e||r(new Error("Must pass in a stream containing the service account auth settings."));let i="";e.setEncoding("utf8").on("data",o=>i+=o).on("error",r).on("end",()=>{try{let o=JSON.parse(i);this.fromJSON(o),t()}catch(o){r(o)}})})}};wr.JWTAccess=ei});var ni=k(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.JWT=void 0;var aa=sa(),vl=ti(),Sl=it(),Er=ye(),ri=class n extends Sl.OAuth2Client{static{s(this,"JWT")}email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(e={}){super(e),this.email=e.email,this.keyFile=e.keyFile,this.key=e.key,this.keyId=e.keyId,this.scopes=e.scopes,this.subject=e.subject,this.additionalClaims=e.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(e){let t=new n(this);return t.scopes=e,t}async getRequestMetadataAsync(e){e=this.defaultServicePath?`https://${this.defaultServicePath}/`:e;let t=!this.hasUserScopes()&&e||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==Er.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==Er.DEFAULT_UNIVERSE)throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${Er.DEFAULT_UNIVERSE}`);if(!this.apiKey&&t)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:r}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${r.id_token}`}))}}else{this.access||(this.access=new vl.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis));let r;this.hasUserScopes()?r=this.scopes:e||(r=this.defaultScopes);let i=this.useJWTAccessWithScope||this.universeDomain!==Er.DEFAULT_UNIVERSE,o=await this.access.getRequestHeaders(e??void 0,this.additionalClaims,i?r:void 0);return{headers:this.addSharedMetadataHeaders(o)}}else return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(e):{headers:new Headers}}async fetchIdToken(e){let t=new aa.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:e},transporter:this.transporter});if(await t.getToken({forceRefresh:!0}),!t.idToken)throw new Error("Unknown error: Failed to fetch ID token");return t.idToken}hasUserScopes(){return this.scopes?this.scopes.length>0:!1}hasAnyScopes(){return!!(this.scopes&&this.scopes.length>0||this.defaultScopes&&this.defaultScopes.length>0)}authorize(e){if(e)this.authorizeAsync().then(t=>e(null,t),e);else return this.authorizeAsync()}async authorizeAsync(){let e=await this.refreshToken();if(!e)throw new Error("No result returned");return this.credentials=e.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.key,this.email=this.gtoken.iss,e.tokens}async refreshTokenNoCache(){let e=this.createGToken(),r={access_token:(await e.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:e.expiresAt,id_token:e.idToken};return this.emit("tokens",r),{res:null,tokens:r}}createGToken(){return this.gtoken||(this.gtoken=new aa.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})),this.gtoken}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the service account auth settings.");if(!e.client_email)throw new Error("The incoming JSON object does not contain a client_email field");if(!e.private_key)throw new Error("The incoming JSON object does not contain a private_key field");this.email=e.client_email,this.key=e.private_key,this.keyId=e.private_key_id,this.projectId=e.project_id,this.quotaProjectId=e.quota_project_id,this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,t){if(t)this.fromStreamAsync(e).then(()=>t(),t);else return this.fromStreamAsync(e)}fromStreamAsync(e){return new Promise((t,r)=>{if(!e)throw new Error("Must pass in a stream containing the service account auth settings.");let i="";e.setEncoding("utf8").on("error",r).on("data",o=>i+=o).on("end",()=>{try{let o=JSON.parse(i);this.fromJSON(o),t()}catch(o){r(o)}})})}fromAPIKey(e){if(typeof e!="string")throw new Error("Must provide an API Key string.");this.apiKey=e}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){let t=await this.createGToken().getCredentials(this.keyFile);return{private_key:t.privateKey,client_email:t.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};Ar.JWT=ri});var si=k(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.UserRefreshClient=_t.USER_REFRESH_ACCOUNT_TYPE=void 0;var Cl=it(),Ol=ye();_t.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var ii=class n extends Cl.OAuth2Client{static{s(this,"UserRefreshClient")}_refreshToken;constructor(e,t,r,i,o){let u=e&&typeof e=="object"?e:{clientId:e,clientSecret:t,refreshToken:r,eagerRefreshThresholdMillis:i,forceRefreshOnFailure:o};super(u),this._refreshToken=u.refreshToken,this.credentials.refresh_token=u.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(e){let t={...n.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:e})};return Ol.AuthClient.setMethodName(t,"fetchIdToken"),(await this.transporter.request(t)).data.id_token}fromJSON(e){if(!e)throw new Error("Must pass in a JSON object containing the user refresh token");if(e.type!=="authorized_user")throw new Error('The incoming JSON object does not have the "authorized_user" type');if(!e.client_id)throw new Error("The incoming JSON object does not contain a client_id field");if(!e.client_secret)throw new Error("The incoming JSON object does not contain a client_secret field");if(!e.refresh_token)throw new Error("The incoming JSON object does not contain a refresh_token field");this._clientId=e.client_id,this._clientSecret=e.client_secret,this._refreshToken=e.refresh_token,this.credentials.refresh_token=e.refresh_token,this.quotaProjectId=e.quota_project_id,this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,t){if(t)this.fromStreamAsync(e).then(()=>t(),t);else return this.fromStreamAsync(e)}async fromStreamAsync(e){return new Promise((t,r)=>{if(!e)return r(new Error("Must pass in a stream containing the user refresh token."));let i="";e.setEncoding("utf8").on("error",r).on("data",o=>i+=o).on("end",()=>{try{let o=JSON.parse(i);return this.fromJSON(o),t()}catch(o){return r(o)}})})}static fromJSON(e){let t=new n;return t.fromJSON(e),t}};_t.UserRefreshClient=ii});var ai=k(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.Impersonated=wt.IMPERSONATED_ACCOUNT_TYPE=void 0;var ca=it(),bl=ce(),kl=Pe();wt.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var oi=class n extends ca.OAuth2Client{static{s(this,"Impersonated")}sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(e={}){if(super(e),this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=e.sourceClient??new ca.OAuth2Client,this.targetPrincipal=e.targetPrincipal??"",this.delegates=e.delegates??[],this.targetScopes=e.targetScopes??[],this.lifetime=e.lifetime??3600,!!!(0,kl.originalOrCamelOptions)(e).get("universe_domain"))this.universeDomain=this.sourceClient.universeDomain;else if(this.sourceClient.universeDomain!==this.universeDomain)throw new RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`);this.endpoint=e.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(e){await this.sourceClient.getAccessToken();let t=`projects/-/serviceAccounts/${this.targetPrincipal}`,r=`${this.endpoint}/v1/${t}:signBlob`,i={delegates:this.delegates,payload:Buffer.from(e).toString("base64")};return(await this.sourceClient.request({...n.RETRY_CONFIG,url:r,data:i,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let e="projects/-/serviceAccounts/"+this.targetPrincipal,t=`${this.endpoint}/v1/${e}:generateAccessToken`,r={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},i=await this.sourceClient.request({...n.RETRY_CONFIG,url:t,data:r,method:"POST"}),o=i.data;return this.credentials.access_token=o.accessToken,this.credentials.expiry_date=Date.parse(o.expireTime),{tokens:this.credentials,res:i}}catch(e){if(!(e instanceof Error))throw e;let t=0,r="";throw e instanceof bl.GaxiosError&&(t=e?.response?.data?.error?.status,r=e?.response?.data?.error?.message),t&&r?(e.message=`${t}: unable to impersonate: ${r}`,e):(e.message=`unable to impersonate: ${e}`,e)}}async fetchIdToken(e,t){await this.sourceClient.getAccessToken();let r=`projects/-/serviceAccounts/${this.targetPrincipal}`,i=`${this.endpoint}/v1/${r}:generateIdToken`,o={delegates:this.delegates,audience:e,includeEmail:t?.includeEmail??!0,useEmailAzp:t?.includeEmail??!0};return(await this.sourceClient.request({...n.RETRY_CONFIG,url:i,data:o,method:"POST"})).data.token}};wt.Impersonated=oi});var ui=k(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.OAuthClientAuthHandler=void 0;Gt.getErrorFromOAuthErrorResponse=Nl;var Et=ce(),Rl=Nt(),Pl=["PUT","POST","PATCH"],ci=class{static{s(this,"OAuthClientAuthHandler")}#e=(0,Rl.createCrypto)();#t;transporter;constructor(e){e&&"clientId"in e?(this.#t=e,this.transporter=new Et.Gaxios):(this.#t=e?.clientAuthentication,this.transporter=e?.transporter||new Et.Gaxios)}applyClientAuthenticationOptions(e,t){e.headers=Et.Gaxios.mergeHeaders(e.headers),this.injectAuthenticatedHeaders(e,t),t||this.injectAuthenticatedRequestBody(e)}injectAuthenticatedHeaders(e,t){if(t)e.headers=Et.Gaxios.mergeHeaders(e.headers,{authorization:`Bearer ${t}`});else if(this.#t?.confidentialClientType==="basic"){e.headers=Et.Gaxios.mergeHeaders(e.headers);let r=this.#t.clientId,i=this.#t.clientSecret||"",o=this.#e.encodeBase64StringUtf8(`${r}:${i}`);Et.Gaxios.mergeHeaders(e.headers,{authorization:`Basic ${o}`})}}injectAuthenticatedRequestBody(e){if(this.#t?.confidentialClientType==="request-body"){let t=(e.method||"GET").toUpperCase();if(!Pl.includes(t))throw new Error(`${t} HTTP method does not support ${this.#t.confidentialClientType} client authentication`);let i=new Headers(e.headers).get("content-type");if(i?.startsWith("application/x-www-form-urlencoded")||e.data instanceof URLSearchParams){let o=new URLSearchParams(e.data??"");o.append("client_id",this.#t.clientId),o.append("client_secret",this.#t.clientSecret||""),e.data=o}else if(i?.startsWith("application/json"))e.data=e.data||{},Object.assign(e.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""});else throw new Error(`${i} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};Gt.OAuthClientAuthHandler=ci;function Nl(n,e){let t=n.error,r=n.error_description,i=n.error_uri,o=`Error code ${t}`;typeof r<"u"&&(o+=`: ${r}`),typeof i<"u"&&(o+=` - ${i}`);let u=new Error(o);if(e){let l=Object.keys(e);e.stack&&l.push("stack"),l.forEach(d=>{d!=="message"&&Object.defineProperty(u,d,{value:e[d],writable:!1,enumerable:!0})})}return u}s(Nl,"getErrorFromOAuthErrorResponse")});var vr=k(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.StsCredentials=void 0;var Il=ce(),xl=ye(),ua=ui(),Ul=Pe(),li=class n extends ua.OAuthClientAuthHandler{static{s(this,"StsCredentials")}#e;constructor(e={tokenExchangeEndpoint:""},t){(typeof e!="object"||e instanceof URL)&&(e={tokenExchangeEndpoint:e,clientAuthentication:t}),super(e),this.#e=e.tokenExchangeEndpoint}async exchangeToken(e,t,r){let i={grant_type:e.grantType,resource:e.resource,audience:e.audience,scope:e.scope?.join(" "),requested_token_type:e.requestedTokenType,subject_token:e.subjectToken,subject_token_type:e.subjectTokenType,actor_token:e.actingParty?.actorToken,actor_token_type:e.actingParty?.actorTokenType,options:r&&JSON.stringify(r)},o={...n.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:t,data:new URLSearchParams((0,Ul.removeUndefinedValuesInObject)(i))};xl.AuthClient.setMethodName(o,"exchangeToken"),this.applyClientAuthenticationOptions(o);try{let u=await this.transporter.request(o),l=u.data;return l.res=u,l}catch(u){throw u instanceof Il.GaxiosError&&u.response?(0,ua.getErrorFromOAuthErrorResponse)(u.response.data,u):u}}};Tr.StsCredentials=li});var Qe=k(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.BaseExternalAccountClient=Oe.CLOUD_RESOURCE_MANAGER=Oe.EXTERNAL_ACCOUNT_TYPE=Oe.EXPIRATION_TIME_OFFSET=void 0;var jl=ce(),Dl=L("stream"),fi=ye(),ql=vr(),la=Pe(),Fl=On(),Ml="urn:ietf:params:oauth:grant-type:token-exchange",Ll="urn:ietf:params:oauth:token-type:access_token",hi="https://www.googleapis.com/auth/cloud-platform",Gl=3600;Oe.EXPIRATION_TIME_OFFSET=300*1e3;Oe.EXTERNAL_ACCOUNT_TYPE="external_account";Oe.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var Bl="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",Hl="https://sts.{universeDomain}/v1/token",di=class n extends fi.AuthClient{static{s(this,"BaseExternalAccountClient")}scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(e){super(e);let t=(0,la.originalOrCamelOptions)(e),r=t.get("type");if(r&&r!==Oe.EXTERNAL_ACCOUNT_TYPE)throw new Error(`Expected "${Oe.EXTERNAL_ACCOUNT_TYPE}" type but received "${e.type}"`);let i=t.get("client_id"),o=t.get("client_secret");this.tokenUrl=t.get("token_url")??Hl.replace("{universeDomain}",this.universeDomain);let u=t.get("subject_token_type"),l=t.get("workforce_pool_user_project"),d=t.get("service_account_impersonation_url"),T=t.get("service_account_impersonation"),v=(0,la.originalOrCamelOptions)(T).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(t.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),i&&(this.clientAuth={confidentialClientType:"basic",clientId:i,clientSecret:o}),this.stsCredential=new ql.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=t.get("scopes")||[hi],this.cachedAccessToken=null,this.audience=t.get("audience"),this.subjectTokenType=u,this.workforcePoolUserProject=l;let A=new RegExp(Bl);if(this.workforcePoolUserProject&&!this.audience.match(A))throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");this.serviceAccountImpersonationUrl=d,this.serviceAccountImpersonationLifetime=v,this.serviceAccountImpersonationLifetime?this.configLifetimeRequested=!0:(this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=Gl),this.projectNumber=this.getProjectNumber(this.audience),this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256)throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);return/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl)?.groups?.email||null}return null}setCredentials(e){super.setCredentials(e),this.cachedAccessToken=e}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),t=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(t)}request(e,t){if(t)this.requestAsync(e).then(r=>t(null,r),r=>t(r,r.response));else return this.requestAsync(e)}async getProjectId(){let e=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;if(e){let t=await this.getRequestHeaders(),r={...n.RETRY_CONFIG,headers:t,url:`${this.cloudResourceManagerURL.toString()}${e}`};fi.AuthClient.setMethodName(r,"getProjectId");let i=await this.transporter.request(r);return this.projectId=i.data.projectId,this.projectId}return null}async requestAsync(e,t=!1){let r;try{let i=await this.getRequestHeaders();e.headers=jl.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),r=await this.transporter.request(e)}catch(i){let o=i.response;if(o){let u=o.status,l=o.config.data instanceof Dl.Readable;if(!t&&(u===401||u===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return r}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){let e=await this.retrieveSubjectToken(),t={grantType:Ml,audience:this.audience,requestedTokenType:Ll,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[hi]:this.getScopesArray()},r=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,i=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),o=await this.stsCredential.exchangeToken(t,i,r);return this.serviceAccountImpersonationUrl?this.cachedAccessToken=await this.getImpersonatedAccessToken(o.access_token):o.expires_in?this.cachedAccessToken={access_token:o.access_token,expiry_date:new Date().getTime()+o.expires_in*1e3,res:o.res}:this.cachedAccessToken={access_token:o.access_token,res:o.res},this.credentials={},Object.assign(this.credentials,this.cachedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedAccessToken}getProjectNumber(e){let t=e.match(/\/projects\/([^/]+)/);return t?t[1]:null}async getImpersonatedAccessToken(e){let t={...n.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"}};fi.AuthClient.setMethodName(t,"getImpersonatedAccessToken");let r=await this.transporter.request(t),i=r.data;return{access_token:i.accessToken,expiry_date:new Date(i.expireTime).getTime(),res:r}}isExpired(e){let t=new Date().getTime();return e.expiry_date?t>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){return typeof this.scopes=="string"?[this.scopes]:this.scopes||[hi]}getMetricsHeaderValue(){let e=process.version.replace(/^v/,""),t=this.serviceAccountImpersonationUrl!==void 0,r=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${Fl.pkg.version} google-byoid-sdk source/${r} sa-impersonation/${t} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};Oe.BaseExternalAccountClient=di});var fa=k(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.FileSubjectTokenSupplier=void 0;var gi=L("util"),yi=L("fs"),$l=(0,gi.promisify)(yi.readFile??(()=>{})),Kl=(0,gi.promisify)(yi.realpath??(()=>{})),Jl=(0,gi.promisify)(yi.lstat??(()=>{})),pi=class{static{s(this,"FileSubjectTokenSupplier")}filePath;formatType;subjectTokenFieldName;constructor(e){this.filePath=e.filePath,this.formatType=e.formatType,this.subjectTokenFieldName=e.subjectTokenFieldName}async getSubjectToken(){let e=this.filePath;try{if(e=await Kl(e),!(await Jl(e)).isFile())throw new Error}catch(i){throw i instanceof Error&&(i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`),i}let t,r=await $l(e,{encoding:"utf8"});if(this.formatType==="text"?t=r:this.formatType==="json"&&this.subjectTokenFieldName&&(t=JSON.parse(r)[this.subjectTokenFieldName]),!t)throw new Error("Unable to parse the subject_token from the credential_source file");return t}};Sr.FileSubjectTokenSupplier=pi});var ha=k(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.UrlSubjectTokenSupplier=void 0;var Vl=ye(),mi=class{static{s(this,"UrlSubjectTokenSupplier")}url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(e){this.url=e.url,this.formatType=e.formatType,this.subjectTokenFieldName=e.subjectTokenFieldName,this.headers=e.headers,this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getSubjectToken(e){let t={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers};Vl.AuthClient.setMethodName(t,"getSubjectToken");let r;if(this.formatType==="text"?r=(await e.transporter.request(t)).data:this.formatType==="json"&&this.subjectTokenFieldName&&(r=(await e.transporter.request(t)).data[this.subjectTokenFieldName]),!r)throw new Error("Unable to parse the subject_token from the credential_source URL");return r}};Cr.UrlSubjectTokenSupplier=mi});var da=k(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CertificateSubjectTokenSupplier=Ee.InvalidConfigurationError=Ee.CertificateSourceUnavailableError=Ee.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var Or=Pe(),br=L("fs"),kr=L("crypto"),Wl=L("https");Ee.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var Ge=class extends Error{static{s(this,"CertificateSourceUnavailableError")}constructor(e){super(e),this.name="CertificateSourceUnavailableError"}};Ee.CertificateSourceUnavailableError=Ge;var be=class extends Error{static{s(this,"InvalidConfigurationError")}constructor(e){super(e),this.name="InvalidConfigurationError"}};Ee.InvalidConfigurationError=be;var _i=class{static{s(this,"CertificateSubjectTokenSupplier")}certificateConfigPath;trustChainPath;cert;key;constructor(e){if(!e.useDefaultCertificateConfig&&!e.certificateConfigLocation)throw new be("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(e.useDefaultCertificateConfig&&e.certificateConfigLocation)throw new be("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=e.trustChainPath,this.certificateConfigPath=e.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new be("Cannot create mTLS Agent with missing certificate or key");return new Wl.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();let{certPath:e,keyPath:t}=await this.#t();return{cert:this.cert,key:this.key}=await this.#r(e,t),await this.#n(this.cert)}async#e(){let e=this.certificateConfigPath;if(e){if(await(0,Or.isValidFile)(e))return e;throw new Ge(`Provided certificate config path is invalid: ${e}`)}let t=process.env[Ee.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(t){if(await(0,Or.isValidFile)(t))return t;throw new Ge(`Path from environment variable "${Ee.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${t}`)}let r=(0,Or.getWellKnownCertificateConfigFileLocation)();if(await(0,Or.isValidFile)(r))return r;throw new Ge(`Could not find certificate configuration file. Searched override path, the "${Ee.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${r}).`)}async#t(){let e=this.certificateConfigPath,t;try{t=await br.promises.readFile(e,"utf8")}catch{throw new Ge(`Failed to read certificate config file at: ${e}`)}try{let r=JSON.parse(t),i=r?.cert_configs?.workload?.cert_path,o=r?.cert_configs?.workload?.key_path;if(!i||!o)throw new be(`Certificate config file (${e}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:i,keyPath:o}}catch(r){throw r instanceof be?r:new be(`Failed to parse certificate config from ${e}: ${r.message}`)}}async#r(e,t){let r,i;try{r=await br.promises.readFile(e),new kr.X509Certificate(r)}catch(o){let u=o instanceof Error?o.message:String(o);throw new Ge(`Failed to read certificate file at ${e}: ${u}`)}try{i=await br.promises.readFile(t),(0,kr.createPrivateKey)(i)}catch(o){let u=o instanceof Error?o.message:String(o);throw new Ge(`Failed to read private key file at ${t}: ${u}`)}return{cert:r,key:i}}async#n(e){let t=new kr.X509Certificate(e);if(!this.trustChainPath)return JSON.stringify([t.raw.toString("base64")]);try{let o=((await br.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((d,T)=>{try{return new kr.X509Certificate(d)}catch(v){let A=v instanceof Error?v.message:String(v);throw new be(`Failed to parse certificate at index ${T} in trust chain file ${this.trustChainPath}: ${A}`)}}),u=o.findIndex(d=>t.raw.equals(d.raw)),l;if(u===-1)l=[t,...o];else if(u===0)l=o;else throw new be(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${u}).`);return JSON.stringify(l.map(d=>d.raw.toString("base64")))}catch(r){if(r instanceof be)throw r;let i=r instanceof Error?r.message:String(r);throw new Ge(`Failed to process certificate chain from ${this.trustChainPath}: ${i}`)}}};Ee.CertificateSubjectTokenSupplier=_i});var Ai=k(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.IdentityPoolClient=void 0;var Yl=Qe(),wi=Pe(),zl=fa(),Xl=ha(),pa=da(),Ql=vr(),ga=ce(),Ei=class n extends Yl.BaseExternalAccountClient{static{s(this,"IdentityPoolClient")}subjectTokenSupplier;constructor(e){super(e);let t=(0,wi.originalOrCamelOptions)(e),r=t.get("credential_source"),i=t.get("subject_token_supplier");if(!r&&!i)throw new Error("A credential source or subject token supplier must be specified.");if(r&&i)throw new Error("Only one of credential source or subject token supplier can be specified.");if(i)this.subjectTokenSupplier=i,this.credentialSourceType="programmatic";else{let o=(0,wi.originalOrCamelOptions)(r),u=(0,wi.originalOrCamelOptions)(o.get("format")),l=u.get("type")||"text",d=u.get("subject_token_field_name");if(l!=="json"&&l!=="text")throw new Error(`Invalid credential_source format "${l}"`);if(l==="json"&&!d)throw new Error("Missing subject_token_field_name for JSON credential_source format");let T=o.get("file"),v=o.get("url"),A=o.get("certificate"),b=o.get("headers");if(T&&v||v&&A||T&&A)throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');if(T)this.credentialSourceType="file",this.subjectTokenSupplier=new zl.FileSubjectTokenSupplier({filePath:T,formatType:l,subjectTokenFieldName:d});else if(v)this.credentialSourceType="url",this.subjectTokenSupplier=new Xl.UrlSubjectTokenSupplier({url:v,formatType:l,subjectTokenFieldName:d,headers:b,additionalGaxiosOptions:n.RETRY_CONFIG});else if(A){this.credentialSourceType="certificate";let F=new pa.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:A.use_default_certificate_config,certificateConfigLocation:A.certificate_config_location,trustChainPath:A.trust_chain_path});this.subjectTokenSupplier=F}else throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let e=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof pa.CertificateSubjectTokenSupplier){let t=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new Ql.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new ga.Gaxios({agent:t})}),this.transporter=new ga.Gaxios({...this.transporter.defaults||{},agent:t})}return e}};Rr.IdentityPoolClient=Ei});var vi=k(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.AwsRequestSigner=void 0;var Pr=ce(),ma=Nt(),ya="AWS4-HMAC-SHA256",Zl="aws4_request",Ti=class{static{s(this,"AwsRequestSigner")}getCredentials;region;crypto;constructor(e,t){this.getCredentials=e,this.region=t,this.crypto=(0,ma.createCrypto)()}async getRequestOptions(e){if(!e.url)throw new RangeError('"url" is required in "amzOptions"');let t=typeof e.data=="object"?JSON.stringify(e.data):e.data,r=e.url,i=e.method||"GET",o=e.body||t,u=e.headers,l=await this.getCredentials(),d=new URL(r);if(typeof o!="string"&&o!==void 0)throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${o}`);let T=await tf({crypto:this.crypto,host:d.host,canonicalUri:d.pathname,canonicalQuerystring:d.search.slice(1),method:i,region:this.region,securityCredentials:l,requestPayload:o,additionalAmzHeaders:u}),v=Pr.Gaxios.mergeHeaders(T.amzDate?{"x-amz-date":T.amzDate}:{},{authorization:T.authorizationHeader,host:d.host},u||{});l.token&&Pr.Gaxios.mergeHeaders(v,{"x-amz-security-token":l.token});let A={url:r,method:i,headers:v};return o!==void 0&&(A.body=o),A}};Nr.AwsRequestSigner=Ti;async function Bt(n,e,t){return await n.signWithHmacSha256(e,t)}s(Bt,"sign");async function ef(n,e,t,r,i){let o=await Bt(n,`AWS4${e}`,t),u=await Bt(n,o,r),l=await Bt(n,u,i);return await Bt(n,l,"aws4_request")}s(ef,"getSigningKey");async function tf(n){let e=Pr.Gaxios.mergeHeaders(n.additionalAmzHeaders),t=n.requestPayload||"",r=n.host.split(".")[0],i=new Date,o=i.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),u=i.toISOString().replace(/[-]/g,"").replace(/T.*/,"");n.securityCredentials.token&&e.set("x-amz-security-token",n.securityCredentials.token);let l=Pr.Gaxios.mergeHeaders({host:n.host},e.has("date")?{}:{"x-amz-date":o},e),d="",T=[...l.keys()].sort();T.forEach(X=>{d+=`${X}:${l.get(X)}
33
+ `});let v=T.join(";"),A=await n.crypto.sha256DigestHex(t),b=`${n.method.toUpperCase()}
34
+ ${n.canonicalUri}
35
+ ${n.canonicalQuerystring}
36
+ ${d}
37
+ ${v}
38
+ ${A}`,F=`${u}/${n.region}/${r}/${Zl}`,B=`${ya}
39
+ ${o}
40
+ ${F}
41
+ `+await n.crypto.sha256DigestHex(b),I=await ef(n.crypto,n.securityCredentials.secretAccessKey,u,n.region,r),x=await Bt(n.crypto,I,B),R=`${ya} Credential=${n.securityCredentials.accessKeyId}/${F}, SignedHeaders=${v}, Signature=${(0,ma.fromArrayBufferToHex)(x)}`;return{amzDate:e.has("date")?void 0:o,authorizationHeader:R,canonicalQuerystring:n.canonicalQuerystring}}s(tf,"generateAuthenticationHeaderMap")});var _a=k(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.DefaultAwsSecurityCredentialsSupplier=void 0;var Ir=ye(),Si=class{static{s(this,"DefaultAwsSecurityCredentialsSupplier")}regionUrl;securityCredentialsUrl;imdsV2SessionTokenUrl;additionalGaxiosOptions;constructor(e){this.regionUrl=e.regionUrl,this.securityCredentialsUrl=e.securityCredentialsUrl,this.imdsV2SessionTokenUrl=e.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getAwsRegion(e){if(this.#n)return this.#n;let t=new Headers;if(!this.#n&&this.imdsV2SessionTokenUrl&&t.set("x-aws-ec2-metadata-token",await this.#e(e.transporter)),!this.regionUrl)throw new RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let r={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",headers:t};Ir.AuthClient.setMethodName(r,"getAwsRegion");let i=await e.transporter.request(r);return i.data.substr(0,i.data.length-1)}async getAwsSecurityCredentials(e){if(this.#i)return this.#i;let t=new Headers;this.imdsV2SessionTokenUrl&&t.set("x-aws-ec2-metadata-token",await this.#e(e.transporter));let r=await this.#t(t,e.transporter),i=await this.#r(r,t,e.transporter);return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,token:i.Token}}async#e(e){let t={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return Ir.AuthClient.setMethodName(t,"#getImdsV2SessionToken"),(await e.request(t)).data}async#t(e,t){if(!this.securityCredentialsUrl)throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let r={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",headers:e};return Ir.AuthClient.setMethodName(r,"#getAwsRoleName"),(await t.request(r)).data}async#r(e,t,r){let i={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${e}`,headers:t};return Ir.AuthClient.setMethodName(i,"#retrieveAwsSecurityCredentials"),(await r.request(i)).data}get#n(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get#i(){return process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY?{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN}:null}};xr.DefaultAwsSecurityCredentialsSupplier=Si});var Oi=k(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.AwsClient=void 0;var rf=vi(),nf=Qe(),sf=_a(),wa=Pe(),of=ce(),Ci=class n extends nf.BaseExternalAccountClient{static{s(this,"AwsClient")}environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static#e="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(e){super(e);let t=(0,wa.originalOrCamelOptions)(e),r=t.get("credential_source"),i=t.get("aws_security_credentials_supplier");if(!r&&!i)throw new Error("A credential source or AWS security credentials supplier must be specified.");if(r&&i)throw new Error("Only one of credential source or AWS security credentials supplier can be specified.");if(i)this.awsSecurityCredentialsSupplier=i,this.regionalCredVerificationUrl=n.#e,this.credentialSourceType="programmatic";else{let o=(0,wa.originalOrCamelOptions)(r);this.environmentId=o.get("environment_id");let u=o.get("region_url"),l=o.get("url"),d=o.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new sf.DefaultAwsSecurityCredentialsSupplier({regionUrl:u,securityCredentialsUrl:l,imdsV2SessionTokenUrl:d}),this.regionalCredVerificationUrl=o.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let e=this.environmentId?.match(/^(aws)(\d+)$/);if(!e||!this.regionalCredVerificationUrl)throw new Error('No valid AWS "credential_source" provided');if(parseInt(e[2],10)!==1)throw new Error(`aws version "${e[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new rf.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let e=await this.awsRequestSigner.getRequestOptions({...n.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),t=[];return of.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},e.headers).forEach((i,o)=>t.push({key:o,value:i})),encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:t}))}};Ur.AwsClient=Ci});var Ni=k(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.InvalidSubjectTokenError=se.InvalidMessageFieldError=se.InvalidCodeFieldError=se.InvalidTokenTypeFieldError=se.InvalidExpirationTimeFieldError=se.InvalidSuccessFieldError=se.InvalidVersionFieldError=se.ExecutableResponseError=se.ExecutableResponse=void 0;var jr="urn:ietf:params:oauth:token-type:saml2",bi="urn:ietf:params:oauth:token-type:id_token",ki="urn:ietf:params:oauth:token-type:jwt",Ri=class{static{s(this,"ExecutableResponse")}version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(e){if(!e.version)throw new Dr("Executable response must contain a 'version' field.");if(e.success===void 0)throw new qr("Executable response must contain a 'success' field.");if(this.version=e.version,this.success=e.success,this.success){if(this.expirationTime=e.expiration_time,this.tokenType=e.token_type,this.tokenType!==jr&&this.tokenType!==bi&&this.tokenType!==ki)throw new Fr(`Executable response must contain a 'token_type' field when successful and it must be one of ${bi}, ${ki}, or ${jr}.`);if(this.tokenType===jr){if(!e.saml_response)throw new Ht(`Executable response must contain a 'saml_response' field when token_type=${jr}.`);this.subjectToken=e.saml_response}else{if(!e.id_token)throw new Ht(`Executable response must contain a 'id_token' field when token_type=${bi} or ${ki}.`);this.subjectToken=e.id_token}}else{if(!e.code)throw new Mr("Executable response must contain a 'code' field when unsuccessful.");if(!e.message)throw new Lr("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=e.code,this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};se.ExecutableResponse=Ri;var Be=class extends Error{static{s(this,"ExecutableResponseError")}constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}};se.ExecutableResponseError=Be;var Dr=class extends Be{static{s(this,"InvalidVersionFieldError")}};se.InvalidVersionFieldError=Dr;var qr=class extends Be{static{s(this,"InvalidSuccessFieldError")}};se.InvalidSuccessFieldError=qr;var Pi=class extends Be{static{s(this,"InvalidExpirationTimeFieldError")}};se.InvalidExpirationTimeFieldError=Pi;var Fr=class extends Be{static{s(this,"InvalidTokenTypeFieldError")}};se.InvalidTokenTypeFieldError=Fr;var Mr=class extends Be{static{s(this,"InvalidCodeFieldError")}};se.InvalidCodeFieldError=Mr;var Lr=class extends Be{static{s(this,"InvalidMessageFieldError")}};se.InvalidMessageFieldError=Lr;var Ht=class extends Be{static{s(this,"InvalidSubjectTokenError")}};se.InvalidSubjectTokenError=Ht});var Ui=k(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.PluggableAuthHandler=At.ExecutableError=void 0;var st=Ni(),af=L("child_process"),Ii=L("fs"),Gr=class extends Error{static{s(this,"ExecutableError")}code;constructor(e,t){super(`The executable failed with exit code: ${t} and error message: ${e}.`),this.code=t,Object.setPrototypeOf(this,new.target.prototype)}};At.ExecutableError=Gr;var xi=class n{static{s(this,"PluggableAuthHandler")}commandComponents;timeoutMillis;outputFile;constructor(e){if(!e.command)throw new Error("No command provided.");if(this.commandComponents=n.parseCommand(e.command),this.timeoutMillis=e.timeoutMillis,!this.timeoutMillis)throw new Error("No timeoutMillis provided.");this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((t,r)=>{let i=af.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}}),o="";i.stdout.on("data",l=>{o+=l}),i.stderr.on("data",l=>{o+=l});let u=setTimeout(()=>(i.removeAllListeners(),i.kill(),r(new Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);i.on("close",l=>{if(clearTimeout(u),l===0)try{let d=JSON.parse(o),T=new st.ExecutableResponse(d);return t(T)}catch(d){return d instanceof st.ExecutableResponseError?r(d):r(new st.ExecutableResponseError(`The executable returned an invalid response: ${o}`))}else return r(new Gr(o,l.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let e;try{e=await Ii.promises.realpath(this.outputFile)}catch{return}if(!(await Ii.promises.lstat(e)).isFile())return;let t=await Ii.promises.readFile(e,{encoding:"utf8"});if(t!=="")try{let r=JSON.parse(t);return new st.ExecutableResponse(r).isValid()?new st.ExecutableResponse(r):void 0}catch(r){throw r instanceof st.ExecutableResponseError?r:new st.ExecutableResponseError(`The output file contained an invalid response: ${t}`)}}static parseCommand(e){let t=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!t)throw new Error(`Provided command: "${e}" could not be parsed.`);for(let r=0;r<t.length;r++)t[r][0]==='"'&&t[r].slice(-1)==='"'&&(t[r]=t[r].slice(1,-1));return t}};At.PluggableAuthHandler=xi});var Di=k(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.PluggableAuthClient=Tt.ExecutableError=void 0;var cf=Qe(),uf=Ni(),Ea=Ui(),lf=Ui();Object.defineProperty(Tt,"ExecutableError",{enumerable:!0,get:s(function(){return lf.ExecutableError},"get")});var ff=30*1e3,Aa=5*1e3,Ta=120*1e3,hf="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",va=1,ji=class extends cf.BaseExternalAccountClient{static{s(this,"PluggableAuthClient")}command;timeoutMillis;outputFile;handler;constructor(e){if(super(e),!e.credential_source.executable)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(this.command=e.credential_source.executable.command,!this.command)throw new Error('No valid Pluggable Auth "credential_source" provided.');if(e.credential_source.executable.timeout_millis===void 0)this.timeoutMillis=ff;else if(this.timeoutMillis=e.credential_source.executable.timeout_millis,this.timeoutMillis<Aa||this.timeoutMillis>Ta)throw new Error(`Timeout must be between ${Aa} and ${Ta} milliseconds.`);this.outputFile=e.credential_source.executable.output_file,this.handler=new Ea.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[hf]!=="1")throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let e;if(this.outputFile&&(e=await this.handler.retrieveCachedResponse()),!e){let t=new Map;t.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),t.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),t.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile&&t.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let r=this.getServiceAccountEmail();r&&t.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",r),e=await this.handler.retrieveResponseFromExecutable(t)}if(e.version>va)throw new Error(`Version of executable is not currently supported, maximum supported version is ${va}.`);if(!e.success)throw new Ea.ExecutableError(e.errorMessage,e.errorCode);if(this.outputFile&&!e.expirationTime)throw new uf.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.");if(e.isExpired())throw new Error("Executable response is expired.");return e.subjectToken}};Tt.PluggableAuthClient=ji});var Fi=k(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ExternalAccountClient=void 0;var df=Qe(),pf=Ai(),gf=Oi(),yf=Di(),qi=class{static{s(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e){return e&&e.type===df.EXTERNAL_ACCOUNT_TYPE?e.credential_source?.environment_id?new gf.AwsClient(e):e.credential_source?.executable?new yf.PluggableAuthClient(e):new pf.IdentityPoolClient(e):null}};Br.ExternalAccountClient=qi});var Gi=k(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.ExternalAccountAuthorizedUserClient=vt.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var Ca=ye(),Sa=ui(),Oa=ce(),mf=L("stream"),_f=Qe();vt.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var wf="https://sts.{universeDomain}/v1/oauthtoken",Mi=class n extends Sa.OAuthClientAuthHandler{static{s(this,"ExternalAccountAuthorizedUserHandler")}#e;constructor(e){super(e),this.#e=e.tokenRefreshEndpoint}async refreshToken(e,t){let r={...n.RETRY_CONFIG,url:this.#e,method:"POST",headers:t,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:e})};Ca.AuthClient.setMethodName(r,"refreshToken"),this.applyClientAuthenticationOptions(r);try{let i=await this.transporter.request(r),o=i.data;return o.res=i,o}catch(i){throw i instanceof Oa.GaxiosError&&i.response?(0,Sa.getErrorFromOAuthErrorResponse)(i.response.data,i):i}}},Li=class extends Ca.AuthClient{static{s(this,"ExternalAccountAuthorizedUserClient")}cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(e){super(e),e.universe_domain&&(this.universeDomain=e.universe_domain),this.refreshToken=e.refresh_token;let t={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new Mi({tokenRefreshEndpoint:e.token_url??wf.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:t}),this.cachedAccessToken=null,this.quotaProjectId=e.quota_project_id,typeof e?.eagerRefreshThresholdMillis!="number"?this.eagerRefreshThresholdMillis=_f.EXPIRATION_TIME_OFFSET:this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis,this.forceRefreshOnFailure=!!e?.forceRefreshOnFailure}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),t=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(t)}request(e,t){if(t)this.requestAsync(e).then(r=>t(null,r),r=>t(r,r.response));else return this.requestAsync(e)}async requestAsync(e,t=!1){let r;try{let i=await this.getRequestHeaders();e.headers=Oa.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),r=await this.transporter.request(e)}catch(i){let o=i.response;if(o){let u=o.status,l=o.config.data instanceof mf.Readable;if(!t&&(u===401||u===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return r}async refreshAccessTokenAsync(){let e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);return this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res},e.refresh_token!==void 0&&(this.refreshToken=e.refresh_token),this.cachedAccessToken}isExpired(e){let t=new Date().getTime();return e.expiry_date?t>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}};vt.ExternalAccountAuthorizedUserClient=Li});var Pa=k(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.GoogleAuth=Ue.GoogleAuthExceptionMessages=void 0;var Ef=L("child_process"),$t=L("fs"),Af=ce(),Kt=Pt(),Tf=L("os"),Bi=L("path"),vf=Nt(),Sf=jn(),Cf=qn(),Of=Fn(),St=ni(),ba=si(),Ct=ai(),bf=Fi(),Jt=Qe(),Hi=ye(),ka=Gi(),Ra=Pe();Ue.GoogleAuthExceptionMessages={API_KEY_WITH_CREDENTIALS:"API Keys and Credentials are mutually exclusive authentication methods and cannot be used together.",NO_PROJECT_ID_FOUND:`Unable to detect a Project Id in the current environment.
42
+ To learn more about authentication and Google APIs, visit:
43
+ https://cloud.google.com/docs/authentication/getting-started`,NO_CREDENTIALS_FOUND:`Unable to find credentials in current environment.
44
+ To learn more about authentication and Google APIs, visit:
45
+ https://cloud.google.com/docs/authentication/getting-started`,NO_ADC_FOUND:"Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.",NO_UNIVERSE_DOMAIN_FOUND:`Unable to detect a Universe Domain in the current environment.
46
+ To learn more about Universe Domain retrieval, visit:
47
+ https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`};var $i=class{static{s(this,"GoogleAuth")}checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#e=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(e={}){if(this._cachedProjectId=e.projectId||null,this.cachedCredential=e.authClient||null,this.keyFilename=e.keyFilename||e.keyFile,this.scopes=e.scopes,this.clientOptions=e.clientOptions||{},this.jsonContent=e.credentials||null,this.apiKey=e.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw new RangeError(Ue.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);e.universeDomain&&(this.clientOptions.universeDomain=e.universeDomain)}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath,e.useJWTAccessWithScope=this.useJWTAccessWithScope,e.defaultScopes=this.defaultScopes}getProjectId(e){if(e)this.getProjectIdAsync().then(t=>e(null,t),e);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===Ue.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;throw e}}async findAndCacheProjectId(){let e=null;if(e||=await this.getProductionProjectId(),e||=await this.getFileProjectId(),e||=await this.getDefaultServiceProjectId(),e||=await this.getGCEProjectId(),e||=await this.getExternalAccountClientProjectId(),e)return this._cachedProjectId=e,e;throw new Error(Ue.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){return this._cachedProjectId?this._cachedProjectId:(this._findProjectIdPromise||(this._findProjectIdPromise=this.findAndCacheProjectId()),this._findProjectIdPromise)}async getUniverseDomainFromMetadataServer(){let e;try{e=await Kt.universe("universe-domain"),e||=Hi.DEFAULT_UNIVERSE}catch(t){if(t&&t?.response?.status===404)e=Hi.DEFAULT_UNIVERSE;else throw t}return e}async getUniverseDomain(){let e=(0,Ra.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{e??=(await this.getClient()).universeDomain}catch{e??=Hi.DEFAULT_UNIVERSE}return e}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},t){let r;if(typeof e=="function"?t=e:r=e,t)this.getApplicationDefaultAsync(r).then(i=>t(null,i.credential,i.projectId),t);else return this.getApplicationDefaultAsync(r)}async getApplicationDefaultAsync(e={}){if(this.cachedCredential)return await this.#t(this.cachedCredential,null);let t;if(t=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e),t)return t instanceof St.JWT?t.scopes=this.scopes:t instanceof Jt.BaseExternalAccountClient&&(t.scopes=this.getAnyScopes()),await this.#t(t);if(t=await this._tryGetApplicationCredentialsFromWellKnownFile(e),t)return t instanceof St.JWT?t.scopes=this.scopes:t instanceof Jt.BaseExternalAccountClient&&(t.scopes=this.getAnyScopes()),await this.#t(t);if(await this._checkIsGCE())return e.scopes=this.getAnyScopes(),await this.#t(new Sf.Compute(e));throw new Error(Ue.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#t(e,t=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let r=await this.getProjectIdOptional();return t&&(e.quotaProjectId=t),this.cachedCredential=e,{credential:e,projectId:r}}async _checkIsGCE(){return this.checkIsGCE===void 0&&(this.checkIsGCE=Kt.getGCPResidency()||await Kt.isAvailable()),this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){let t=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!t||t.length===0)return null;try{return this._getApplicationCredentialsFromFilePath(t,e)}catch(r){throw r instanceof Error&&(r.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${r.message}`),r}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let t=null;if(this._isWindows())t=process.env.APPDATA;else{let i=process.env.HOME;i&&(t=Bi.join(i,".config"))}return t&&(t=Bi.join(t,"gcloud","application_default_credentials.json"),$t.existsSync(t)||(t=null)),t?await this._getApplicationCredentialsFromFilePath(t,e):null}async _getApplicationCredentialsFromFilePath(e,t={}){if(!e||e.length===0)throw new Error("The file path is invalid.");try{if(e=$t.realpathSync(e),!$t.lstatSync(e).isFile())throw new Error}catch(i){throw i instanceof Error&&(i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`),i}let r=$t.createReadStream(e);return this.fromStream(r,t)}fromImpersonatedJSON(e){if(!e)throw new Error("Must pass in a JSON object containing an impersonated refresh token");if(e.type!==Ct.IMPERSONATED_ACCOUNT_TYPE)throw new Error(`The incoming JSON object does not have the "${Ct.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!e.source_credentials)throw new Error("The incoming JSON object does not contain a source_credentials field");if(!e.service_account_impersonation_url)throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field");let t=this.fromJSON(e.source_credentials);if(e.service_account_impersonation_url?.length>256)throw new RangeError(`Target principal is too long: ${e.service_account_impersonation_url}`);let r=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(e.service_account_impersonation_url)?.groups?.target;if(!r)throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`);let i=(this.scopes||e.scopes||this.defaultScopes)??[];return new Ct.Impersonated({...e,sourceClient:t,targetPrincipal:r,targetScopes:Array.isArray(i)?i:[i]})}fromJSON(e,t={}){let r,i=(0,Ra.originalOrCamelOptions)(t).get("universe_domain");return e.type===ba.USER_REFRESH_ACCOUNT_TYPE?(r=new ba.UserRefreshClient(t),r.fromJSON(e)):e.type===Ct.IMPERSONATED_ACCOUNT_TYPE?r=this.fromImpersonatedJSON(e):e.type===Jt.EXTERNAL_ACCOUNT_TYPE?(r=bf.ExternalAccountClient.fromJSON({...e,...t}),r.scopes=this.getAnyScopes()):e.type===ka.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?r=new ka.ExternalAccountAuthorizedUserClient({...e,...t}):(t.scopes=this.scopes,r=new St.JWT(t),this.setGapicJWTValues(r),r.fromJSON(e)),i&&(r.universeDomain=i),r}_cacheClientFromJSON(e,t){let r=this.fromJSON(e,t);return this.jsonContent=e,this.cachedCredential=r,r}fromStream(e,t={},r){let i={};if(typeof t=="function"?r=t:i=t,r)this.fromStreamAsync(e,i).then(o=>r(null,o),r);else return this.fromStreamAsync(e,i)}fromStreamAsync(e,t){return new Promise((r,i)=>{if(!e)throw new Error("Must pass in a stream containing the Google auth settings.");let o=[];e.setEncoding("utf8").on("error",i).on("data",u=>o.push(u)).on("end",()=>{try{try{let u=JSON.parse(o.join("")),l=this._cacheClientFromJSON(u,t);return r(l)}catch(u){if(!this.keyFilename)throw u;let l=new St.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=l,this.setGapicJWTValues(l),r(l)}}catch(u){return i(u)}})})}fromAPIKey(e,t={}){return new St.JWT({...t,apiKey:e})}_isWindows(){let e=Tf.platform();return!!(e&&e.length>=3&&e.substring(0,3).toLowerCase()==="win")}async getDefaultServiceProjectId(){return new Promise(e=>{(0,Ef.exec)("gcloud config config-helper --format json",(t,r)=>{if(!t&&r)try{let i=JSON.parse(r).configuration.properties.core.project;e(i);return}catch{}e(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let t=await this.getClient();if(t&&t.projectId)return t.projectId}let e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();return e?e.projectId:null}async getExternalAccountClientProjectId(){return!this.jsonContent||this.jsonContent.type!==Jt.EXTERNAL_ACCOUNT_TYPE?null:await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await Kt.project("project-id")}catch{return null}}getCredentials(e){if(e)this.getCredentialsAsync().then(t=>e(null,t),e);else return this.getCredentialsAsync()}async getCredentialsAsync(){let e=await this.getClient();if(e instanceof Ct.Impersonated)return{client_email:e.getTargetPrincipal()};if(e instanceof Jt.BaseExternalAccountClient){let t=e.getServiceAccountEmail();if(t)return{client_email:t,universe_domain:e.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[t,r]=await Promise.all([Kt.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:t,universe_domain:r}}throw new Error(Ue.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#e=this.#e||this.#r();try{return await this.#e}finally{this.#e=null}}async#r(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);if(this.keyFilename){let e=Bi.resolve(this.keyFilename),t=$t.createReadStream(e);return await this.fromStreamAsync(t,this.clientOptions)}else if(this.apiKey){let e=await this.fromAPIKey(this.apiKey,this.clientOptions);e.scopes=this.scopes;let{credential:t}=await this.#t(e);return t}else{let{credential:e}=await this.getApplicationDefaultAsync(this.clientOptions);return e}}async getIdTokenClient(e){let t=await this.getClient();if(!("fetchIdToken"in t))throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new Cf.IdTokenClient({targetAudience:e,idTokenProvider:t})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(e){return(await this.getClient()).getRequestHeaders(e)}async authorizeRequest(e={}){let t=e.url,i=await(await this.getClient()).getRequestHeaders(t);return e.headers=Af.Gaxios.mergeHeaders(e.headers,i),e}async fetch(...e){return(await this.getClient()).fetch(...e)}async request(e){return(await this.getClient()).request(e)}getEnv(){return(0,Of.getEnv)()}async sign(e,t){let r=await this.getClient(),i=await this.getUniverseDomain();if(t=t||`https://iamcredentials.${i}/v1/projects/-/serviceAccounts/`,r instanceof Ct.Impersonated)return(await r.sign(e)).signedBlob;let o=(0,vf.createCrypto)();if(r instanceof St.JWT&&r.key)return await o.sign(r.key,e);let u=await this.getCredentials();if(!u.client_email)throw new Error("Cannot sign data without `client_email`.");return this.signBlob(o,u.client_email,e,t)}async signBlob(e,t,r,i){let o=new URL(i+`${t}:signBlob`);return(await this.request({method:"POST",url:o.href,data:{payload:e.encodeBase64StringUtf8(r)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};Ue.GoogleAuth=$i});var Na=k(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.IAMAuth=void 0;var Ki=class{static{s(this,"IAMAuth")}selector;token;constructor(e,t){this.selector=e,this.token=t,this.selector=e,this.token=t}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};Hr.IAMAuth=Ki});var Ia=k(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.DownscopedClient=He.EXPIRATION_TIME_OFFSET=He.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var kf=ce(),Rf=L("stream"),Ji=ye(),Pf=vr(),Nf="urn:ietf:params:oauth:grant-type:token-exchange",If="urn:ietf:params:oauth:token-type:access_token",xf="urn:ietf:params:oauth:token-type:access_token";He.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;He.EXPIRATION_TIME_OFFSET=300*1e3;var Vi=class extends Ji.AuthClient{static{s(this,"DownscopedClient")}authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(e,t={accessBoundary:{accessBoundaryRules:[]}}){if(super(e instanceof Ji.AuthClient?{}:e),e instanceof Ji.AuthClient?(this.authClient=e,this.credentialAccessBoundary=t):(this.authClient=e.authClient,this.credentialAccessBoundary=e.credentialAccessBoundary),this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw new Error("At least one access boundary rule needs to be defined.");if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>He.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw new Error(`The provided access boundary has more than ${He.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let r of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(r.availablePermissions.length===0)throw new Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new Pf.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(e){if(!e.expiry_date)throw new Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(e),this.cachedDownscopedAccessToken=e}async getAccessToken(){return(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let e=await this.getAccessToken(),t=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(t)}request(e,t){if(t)this.requestAsync(e).then(r=>t(null,r),r=>t(r,r.response));else return this.requestAsync(e)}async requestAsync(e,t=!1){let r;try{let i=await this.getRequestHeaders();e.headers=kf.Gaxios.mergeHeaders(e.headers),this.addUserProjectAndAuthHeaders(e.headers,i),r=await this.transporter.request(e)}catch(i){let o=i.response;if(o){let u=o.status,l=o.config.data instanceof Rf.Readable;if(!t&&(u===401||u===403)&&!l&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(e,!0)}throw i}return r}async refreshAccessTokenAsync(){let e=(await this.authClient.getAccessToken()).token,t={grantType:Nf,requestedTokenType:If,subjectToken:e,subjectTokenType:xf},r=await this.stsCredential.exchangeToken(t,void 0,this.credentialAccessBoundary),i=this.authClient.credentials?.expiry_date||null,o=r.expires_in?new Date().getTime()+r.expires_in*1e3:i;return this.cachedDownscopedAccessToken={access_token:r.access_token,expiry_date:o,res:r.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(e){let t=new Date().getTime();return e.expiry_date?t>=e.expiry_date-this.eagerRefreshThresholdMillis:!1}};He.DownscopedClient=Vi});var xa=k($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.PassThroughClient=void 0;var Uf=ye(),Wi=class extends Uf.AuthClient{static{s(this,"PassThroughClient")}async request(e){return this.transporter.request(e)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};$r.PassThroughClient=Wi});var Qf=k(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.GoogleAuth=P.auth=P.PassThroughClient=P.ExternalAccountAuthorizedUserClient=P.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=P.ExecutableError=P.PluggableAuthClient=P.DownscopedClient=P.BaseExternalAccountClient=P.ExternalAccountClient=P.IdentityPoolClient=P.AwsRequestSigner=P.AwsClient=P.UserRefreshClient=P.LoginTicket=P.ClientAuthentication=P.OAuth2Client=P.CodeChallengeMethod=P.Impersonated=P.JWT=P.JWTAccess=P.IdTokenClient=P.IAMAuth=P.GCPEnv=P.Compute=P.DEFAULT_UNIVERSE=P.AuthClient=P.gaxios=P.gcpMetadata=void 0;var Ua=Pa();Object.defineProperty(P,"GoogleAuth",{enumerable:!0,get:s(function(){return Ua.GoogleAuth},"get")});P.gcpMetadata=Pt();P.gaxios=ce();var ja=ye();Object.defineProperty(P,"AuthClient",{enumerable:!0,get:s(function(){return ja.AuthClient},"get")});Object.defineProperty(P,"DEFAULT_UNIVERSE",{enumerable:!0,get:s(function(){return ja.DEFAULT_UNIVERSE},"get")});var jf=jn();Object.defineProperty(P,"Compute",{enumerable:!0,get:s(function(){return jf.Compute},"get")});var Df=Fn();Object.defineProperty(P,"GCPEnv",{enumerable:!0,get:s(function(){return Df.GCPEnv},"get")});var qf=Na();Object.defineProperty(P,"IAMAuth",{enumerable:!0,get:s(function(){return qf.IAMAuth},"get")});var Ff=qn();Object.defineProperty(P,"IdTokenClient",{enumerable:!0,get:s(function(){return Ff.IdTokenClient},"get")});var Mf=ti();Object.defineProperty(P,"JWTAccess",{enumerable:!0,get:s(function(){return Mf.JWTAccess},"get")});var Lf=ni();Object.defineProperty(P,"JWT",{enumerable:!0,get:s(function(){return Lf.JWT},"get")});var Gf=ai();Object.defineProperty(P,"Impersonated",{enumerable:!0,get:s(function(){return Gf.Impersonated},"get")});var Yi=it();Object.defineProperty(P,"CodeChallengeMethod",{enumerable:!0,get:s(function(){return Yi.CodeChallengeMethod},"get")});Object.defineProperty(P,"OAuth2Client",{enumerable:!0,get:s(function(){return Yi.OAuth2Client},"get")});Object.defineProperty(P,"ClientAuthentication",{enumerable:!0,get:s(function(){return Yi.ClientAuthentication},"get")});var Bf=Nn();Object.defineProperty(P,"LoginTicket",{enumerable:!0,get:s(function(){return Bf.LoginTicket},"get")});var Hf=si();Object.defineProperty(P,"UserRefreshClient",{enumerable:!0,get:s(function(){return Hf.UserRefreshClient},"get")});var $f=Oi();Object.defineProperty(P,"AwsClient",{enumerable:!0,get:s(function(){return $f.AwsClient},"get")});var Kf=vi();Object.defineProperty(P,"AwsRequestSigner",{enumerable:!0,get:s(function(){return Kf.AwsRequestSigner},"get")});var Jf=Ai();Object.defineProperty(P,"IdentityPoolClient",{enumerable:!0,get:s(function(){return Jf.IdentityPoolClient},"get")});var Vf=Fi();Object.defineProperty(P,"ExternalAccountClient",{enumerable:!0,get:s(function(){return Vf.ExternalAccountClient},"get")});var Wf=Qe();Object.defineProperty(P,"BaseExternalAccountClient",{enumerable:!0,get:s(function(){return Wf.BaseExternalAccountClient},"get")});var Yf=Ia();Object.defineProperty(P,"DownscopedClient",{enumerable:!0,get:s(function(){return Yf.DownscopedClient},"get")});var Da=Di();Object.defineProperty(P,"PluggableAuthClient",{enumerable:!0,get:s(function(){return Da.PluggableAuthClient},"get")});Object.defineProperty(P,"ExecutableError",{enumerable:!0,get:s(function(){return Da.ExecutableError},"get")});var qa=Gi();Object.defineProperty(P,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:s(function(){return qa.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE},"get")});Object.defineProperty(P,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:s(function(){return qa.ExternalAccountAuthorizedUserClient},"get")});var zf=xa();Object.defineProperty(P,"PassThroughClient",{enumerable:!0,get:s(function(){return zf.PassThroughClient},"get")});var Xf=new Ua.GoogleAuth;P.auth=Xf});export{Qf as a};
48
+ /*! Bundled license information:
49
+
50
+ safe-buffer/index.js:
51
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
52
+
53
+ gtoken/build/cjs/src/index.cjs:
54
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
55
+ */