@shumai-one/shumai 0.2.3 → 0.3.0

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 (144) hide show
  1. package/bin/{chunk-e7ndw3hg.js → chunk-0p333kh7.js} +3 -3
  2. package/bin/chunk-1wz0dge4.js +3 -0
  3. package/bin/{chunk-gtrc5ka2.js → chunk-1yqar2gz.js} +1 -1
  4. package/bin/{chunk-fz88kkk1.js → chunk-1zpw2mbj.js} +2 -2
  5. package/bin/{chunk-46ar48f9.js → chunk-28egv700.js} +1 -1
  6. package/bin/{chunk-0xbf8bcg.js → chunk-2m2saan7.js} +2 -2
  7. package/bin/chunk-2p0rg6xs.js +1 -0
  8. package/bin/{chunk-w88219ex.js → chunk-2xmsa8wv.js} +1 -1
  9. package/bin/{chunk-mzg1h07d.js → chunk-36wf2dq0.js} +1 -1
  10. package/bin/{chunk-ta7bfdrn.js → chunk-3g54qkv5.js} +1 -1
  11. package/bin/chunk-3ge0s4k2.js +1 -0
  12. package/bin/{chunk-hr97a5j5.js → chunk-449feg7g.js} +1 -1
  13. package/bin/{chunk-hkbybhww.js → chunk-48ebezek.js} +1 -1
  14. package/bin/{chunk-8qg47kj6.js → chunk-4gbs9swm.js} +1 -1
  15. package/bin/{chunk-thsbcbay.js → chunk-4tt3jvm1.js} +1 -1
  16. package/bin/{chunk-15sefy5t.js → chunk-5jhrqbk2.js} +2 -2
  17. package/bin/{chunk-dm2w12rc.js → chunk-5x1ppya9.js} +2 -2
  18. package/bin/{chunk-nrwna4ha.js → chunk-652x28v2.js} +1 -1
  19. package/bin/{chunk-0qkj838r.js → chunk-6f1twjf6.js} +1 -1
  20. package/bin/{chunk-8dqq1fk0.js → chunk-6ks4277t.js} +1 -1
  21. package/bin/{chunk-0rxhc7ka.js → chunk-6wa075zh.js} +2 -2
  22. package/bin/{chunk-qksb0v3c.js → chunk-736tcjve.js} +2 -2
  23. package/bin/chunk-80d6p55n.js +1 -0
  24. package/bin/{chunk-gswbc6y9.js → chunk-8a9k4qj6.js} +2 -2
  25. package/bin/{chunk-jqh8kavv.js → chunk-8g1s0pq1.js} +1 -1
  26. package/bin/chunk-8gkm2ysh.js +1 -0
  27. package/bin/chunk-8nvybmyv.js +2 -0
  28. package/bin/{chunk-srn8t0v7.js → chunk-8rkp0fc5.js} +1 -1
  29. package/bin/{chunk-1wm57c6y.js → chunk-8sr8ff6a.js} +3 -3
  30. package/bin/{chunk-2aamsc5v.js → chunk-93jcw0pn.js} +1 -1
  31. package/bin/{chunk-3rmc8nz6.js → chunk-9bvwwj5y.js} +1 -1
  32. package/bin/{chunk-925q4paa.js → chunk-9fefn2st.js} +1 -1
  33. package/bin/{chunk-262hkppb.js → chunk-9h3c60vw.js} +2 -2
  34. package/bin/{chunk-b73ktdmd.js → chunk-9jd3d3f3.js} +1 -1
  35. package/bin/chunk-9nwjhams.js +1 -0
  36. package/bin/{chunk-7b17fb36.js → chunk-9q32g9jd.js} +1 -1
  37. package/bin/{chunk-0aj303as.js → chunk-9zy0a8kt.js} +2 -2
  38. package/bin/{chunk-w7dn1m95.js → chunk-a06432s3.js} +1 -1
  39. package/bin/{chunk-g21jxrt9.js → chunk-a1mtpcrd.js} +2 -2
  40. package/bin/{chunk-3hzj13pj.js → chunk-a2njf6av.js} +1 -1
  41. package/bin/{chunk-5d2q46mx.js → chunk-a6dvjjce.js} +1 -1
  42. package/bin/{chunk-s46zwr4p.js → chunk-aa2tkqg0.js} +1 -1
  43. package/bin/{chunk-fbte2rmd.js → chunk-ab45988z.js} +1 -1
  44. package/bin/chunk-af3nys0r.js +1 -0
  45. package/bin/{chunk-29tx9qe2.js → chunk-agd2jevj.js} +1 -1
  46. package/bin/{chunk-9h027f50.js → chunk-bf5a4yc8.js} +1 -1
  47. package/bin/{chunk-ybhgmvxa.js → chunk-bjfwz2m7.js} +2 -2
  48. package/bin/{chunk-e52nga6c.js → chunk-bnpw72vt.js} +2 -2
  49. package/bin/{chunk-c45rh4hk.js → chunk-c003q4v6.js} +1 -1
  50. package/bin/{chunk-dgat7wqv.js → chunk-cfamv4b2.js} +2 -2
  51. package/bin/{chunk-922nnh39.js → chunk-cm25nm9t.js} +1 -1
  52. package/bin/{chunk-9h3ds7rn.js → chunk-cmcsxkh1.js} +2 -2
  53. package/bin/{chunk-zemrvz79.js → chunk-cspp4n1d.js} +2 -2
  54. package/bin/{chunk-kfhtk3eh.js → chunk-cwebycwv.js} +1 -1
  55. package/bin/chunk-cx1ebj9k.js +1 -0
  56. package/bin/chunk-d1p9qz3y.js +7 -0
  57. package/bin/{chunk-wfx81mfv.js → chunk-d3cqp0tb.js} +2 -2
  58. package/bin/{chunk-97jzve52.js → chunk-d5fapvnp.js} +2 -2
  59. package/bin/{chunk-e3s3rz2e.js → chunk-ddag2ezv.js} +2 -2
  60. package/bin/{chunk-7hsgmjpa.js → chunk-dk45f6mp.js} +2 -2
  61. package/bin/{chunk-9ab6k4rq.js → chunk-e0kw3bst.js} +1 -1
  62. package/bin/{chunk-bd71dp4j.js → chunk-e56nza63.js} +1 -1
  63. package/bin/{chunk-re0b7sj7.js → chunk-e66j69wz.js} +1 -1
  64. package/bin/{chunk-crt1e1w1.js → chunk-ea0fh29m.js} +1 -1
  65. package/bin/{chunk-s1n39qte.js → chunk-en4m76fw.js} +1 -1
  66. package/bin/{chunk-jyzegph4.js → chunk-epsctccj.js} +1 -1
  67. package/bin/{chunk-qwg2e3wr.js → chunk-evzxjqr3.js} +2 -2
  68. package/bin/{chunk-ymeycphq.js → chunk-f4x2dxe5.js} +3 -3
  69. package/bin/{chunk-pxw97qbq.js → chunk-fr3dg9aj.js} +1 -1
  70. package/bin/{chunk-fcvtgx1y.js → chunk-fvf7j1qj.js} +1 -1
  71. package/bin/{chunk-bs0fjz3w.js → chunk-fwcm78s9.js} +2 -2
  72. package/bin/{chunk-xcwbg4w9.js → chunk-fytbcgak.js} +2 -2
  73. package/bin/{chunk-wc8sc9r9.js → chunk-gc7b9j22.js} +1 -1
  74. package/bin/{chunk-b8js74jk.js → chunk-h1hj60fr.js} +2 -2
  75. package/bin/{chunk-9avkn3x1.js → chunk-h3y7szbm.js} +2 -2
  76. package/bin/{chunk-j8qtab70.js → chunk-hdqvbds8.js} +1 -1
  77. package/bin/{chunk-q09dfja5.js → chunk-he4h8e9e.js} +2 -2
  78. package/bin/{chunk-d2vxmn9v.js → chunk-hktggc90.js} +1 -1
  79. package/bin/{chunk-mnfqdxms.js → chunk-jh6pw37a.js} +1 -1
  80. package/bin/{chunk-ygz6pawn.js → chunk-jjgwrvdb.js} +1 -1
  81. package/bin/{chunk-2dsmsa6a.js → chunk-jmh934ca.js} +1 -1
  82. package/bin/{chunk-dghtwyq1.js → chunk-jtwvd0te.js} +2 -2
  83. package/bin/{chunk-4qpa7b5t.js → chunk-jxxq76at.js} +1 -1
  84. package/bin/chunk-jyr3g5m4.js +1 -0
  85. package/bin/{chunk-zzx99j8t.js → chunk-k0s6gfg6.js} +1 -1
  86. package/bin/chunk-ky3dx324.js +2 -0
  87. package/bin/{chunk-6zascpcz.js → chunk-mw0rc5m7.js} +1 -1
  88. package/bin/chunk-mzre12bp.js +1 -0
  89. package/bin/{chunk-s8t74q9m.js → chunk-n0cn0xfg.js} +1 -1
  90. package/bin/{chunk-88fg1sw7.js → chunk-nd6psyzq.js} +2 -2
  91. package/bin/{chunk-m4zpf9gg.js → chunk-nmzvxgd6.js} +2 -2
  92. package/bin/{chunk-891h8br6.js → chunk-nxhzchen.js} +1 -1
  93. package/bin/{chunk-yj4x7tpw.js → chunk-phc9efjf.js} +2 -2
  94. package/bin/{chunk-n4meg9wb.js → chunk-pna93n17.js} +1 -1
  95. package/bin/{chunk-d3wmdjze.js → chunk-pvx55h1v.js} +1 -1
  96. package/bin/{chunk-g8th86na.js → chunk-pzehf31g.js} +1 -1
  97. package/bin/{chunk-nyhqy6q2.js → chunk-q0dhm16d.js} +5 -5
  98. package/bin/chunk-q11m2cp3.js +2 -0
  99. package/bin/{chunk-31baz5n0.js → chunk-qjf561n2.js} +1 -1
  100. package/bin/chunk-qs5k9j8s.js +1 -0
  101. package/bin/{chunk-ztmj61z9.js → chunk-qt9efp9y.js} +1 -1
  102. package/bin/{chunk-1xpec5r8.js → chunk-qwxt1cha.js} +2 -2
  103. package/bin/{chunk-5t6c3038.js → chunk-r8vrfefa.js} +1 -1
  104. package/bin/{chunk-cxhmr356.js → chunk-rybbss5f.js} +1 -1
  105. package/bin/{chunk-t3t6021k.js → chunk-sa4gc1f5.js} +2 -2
  106. package/bin/{chunk-898q6x3q.js → chunk-sprpjp4t.js} +2 -2
  107. package/bin/{chunk-nnkkem25.js → chunk-swa43tzr.js} +2 -2
  108. package/bin/{chunk-14fh4s1a.js → chunk-szs8dy1s.js} +2 -2
  109. package/bin/{chunk-3qks722n.js → chunk-t0detvbj.js} +2 -2
  110. package/bin/chunk-t0fq8b99.js +2 -0
  111. package/bin/{chunk-wsyg4rwg.js → chunk-vdn3jymh.js} +1 -1
  112. package/bin/{chunk-8wqfkm4c.js → chunk-vjxgv3r6.js} +1 -1
  113. package/bin/{chunk-dqgv5yy1.js → chunk-w3m9g3e9.js} +1 -1
  114. package/bin/{chunk-js9yf457.js → chunk-wcfpdfgy.js} +2 -2
  115. package/bin/{chunk-rtngbgpk.js → chunk-wv8xk7n7.js} +1 -1
  116. package/bin/{chunk-nhsqp8jc.js → chunk-wwsvnz4v.js} +1 -1
  117. package/bin/{chunk-6xg65n5y.js → chunk-y132jbf0.js} +1 -1
  118. package/bin/{chunk-2aascrtb.js → chunk-yaydmgcg.js} +1 -1
  119. package/bin/{chunk-7we7ex0m.js → chunk-yvgs4kmv.js} +1 -1
  120. package/bin/{chunk-3n1rezd0.js → chunk-z5p39kpk.js} +2 -2
  121. package/bin/{chunk-77r8w95d.js → chunk-zct68gc7.js} +2 -2
  122. package/bin/{chunk-mqjzmn0e.js → chunk-zy2sqtt9.js} +1 -1
  123. package/bin/shumai-app.html +1 -1
  124. package/bin/shumai-app.js +260 -208
  125. package/package.json +8 -8
  126. package/prisma/migrations/20260728024147_add_agent_session_entry_columns/migration.sql +14 -0
  127. package/prisma/migrations/20260728024205_migrate_agent_session_entry_data/migration.sql +12 -0
  128. package/prisma/migrations/20260728031230_remove_agent_session_entry_legacy_entry_column/migration.sql +8 -0
  129. package/prisma/schema.prisma +12 -6
  130. package/bin/chunk-23d3968z.js +0 -2
  131. package/bin/chunk-2a9n3dhx.js +0 -1
  132. package/bin/chunk-5vkf99sk.js +0 -1
  133. package/bin/chunk-6z65xd0w.js +0 -3
  134. package/bin/chunk-8tf6kgdj.js +0 -2
  135. package/bin/chunk-av71yjaa.js +0 -1
  136. package/bin/chunk-carknytp.js +0 -1
  137. package/bin/chunk-chkx04mw.js +0 -1
  138. package/bin/chunk-hnhq0dh9.js +0 -1
  139. package/bin/chunk-j0c7d9y1.js +0 -1
  140. package/bin/chunk-kr06nrbx.js +0 -2
  141. package/bin/chunk-se8rgwp8.js +0 -1
  142. package/bin/chunk-wckjyvtb.js +0 -5
  143. package/bin/chunk-wtjc4565.js +0 -1
  144. package/bin/chunk-y79r28gd.js +0 -1
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{Vk as I8,Wk as b,_k as a}from"./chunk-0qkj838r.js";var gZ=b((tU,fZ)=>{function O0(Z,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(Z)),this._timeouts=Z,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}fZ.exports=O0;O0.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};O0.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null};O0.prototype.retry=function(Z){if(this._timeout)clearTimeout(this._timeout);if(!Z)return!1;var $=new Date().getTime();if(Z&&$-this._operationStart>=this._maxRetryTime)return this._errors.push(Z),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(Z);var Q=this._timeouts.shift();if(Q===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),Q=this._cachedTimeouts.slice(-1);else return!1;var Y=this;if(this._timer=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},Q),this._options.unref)this._timer.unref();return!0};O0.prototype.attempt=function(Z,$){if(this._fn=Z,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var Q=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){Q._operationTimeoutCb()},Q._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};O0.prototype.try=function(Z){console.log("Using RetryOperation.try() is deprecated"),this.attempt(Z)};O0.prototype.start=function(Z){console.log("Using RetryOperation.start() is deprecated"),this.attempt(Z)};O0.prototype.start=O0.prototype.try;O0.prototype.errors=function(){return this._errors};O0.prototype.attempts=function(){return this._attempts};O0.prototype.mainError=function(){if(this._errors.length===0)return null;var Z={},$=null,Q=0;for(var Y=0;Y<this._errors.length;Y++){var W=this._errors[Y],J=W.message,K=(Z[J]||0)+1;if(Z[J]=K,K>=Q)$=W,Q=K}return $}});var mZ=b((kJ)=>{var hJ=gZ();kJ.operation=function(Z){var $=kJ.timeouts(Z);return new hJ($,{forever:Z&&(Z.forever||Z.retries===1/0),unref:Z&&Z.unref,maxRetryTime:Z&&Z.maxRetryTime})};kJ.timeouts=function(Z){if(Z instanceof Array)return[].concat(Z);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var Q in Z)$[Q]=Z[Q];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var W=0;W<$.retries;W++)Y.push(this.createTimeout(W,$));if(Z&&Z.forever&&!Y.length)Y.push(this.createTimeout(W,$));return Y.sort(function(J,K){return J-K}),Y};kJ.createTimeout=function(Z,$){var Q=$.randomize?Math.random()+1:1,Y=Math.round(Q*Math.max($.minTimeout,1)*Math.pow($.factor,Z));return Y=Math.min(Y,$.maxTimeout),Y};kJ.wrap=function(Z,$,Q){if($ instanceof Array)Q=$,$=null;if(!Q){Q=[];for(var Y in Z)if(typeof Z[Y]==="function")Q.push(Y)}for(var W=0;W<Q.length;W++){var J=Q[W],K=Z[J];Z[J]=function(H){var w=kJ.operation($),F=Array.prototype.slice.call(arguments,1),z=F.pop();F.push(function(G){if(w.retry(G))return;if(G)arguments[0]=w.mainError();z.apply(this,arguments)}),w.attempt(function(){H.apply(Z,F)})}.bind(Z,K),Z[J].options=$}}});var dZ=b((ZD,H1)=>{var gJ=mZ(),bJ=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class z8 extends Error{constructor(Z){super();if(Z instanceof Error)this.originalError=Z,{message:Z}=Z;else this.originalError=Error(Z),this.originalError.stack=this.stack;this.name="AbortError",this.message=Z}}var mJ=(Z,$,Q)=>{let Y=Q.retries-($-1);return Z.attemptNumber=$,Z.retriesLeft=Y,Z},uJ=(Z)=>bJ.includes(Z),uZ=(Z,$)=>new Promise((Q,Y)=>{$={onFailedAttempt:()=>{},retries:10,...$};let W=gJ.operation($);W.attempt(async(J)=>{try{Q(await Z(J))}catch(K){if(!(K instanceof Error)){Y(TypeError(`Non-error was thrown: "${K}". You should only throw errors.`));return}if(K instanceof z8)W.stop(),Y(K.originalError);else if(K instanceof TypeError&&!uJ(K.message))W.stop(),Y(K);else{mJ(K,J,$);try{await $.onFailedAttempt(K)}catch(q){Y(q);return}if(!W.retry(K))Y(W.mainError())}}})});H1.exports=uZ;H1.exports.default=uZ;H1.exports.AbortError=z8});var F8=b(($D,sZ)=>{var w1=Object.prototype.hasOwnProperty,rZ=Object.prototype.toString,lZ=Object.defineProperty,cZ=Object.getOwnPropertyDescriptor,pZ=function($){if(typeof Array.isArray==="function")return Array.isArray($);return rZ.call($)==="[object Array]"},iZ=function($){if(!$||rZ.call($)!=="[object Object]")return!1;var Q=w1.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&w1.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var W;for(W in $);return typeof W>"u"||w1.call($,W)},aZ=function($,Q){if(lZ&&Q.name==="__proto__")lZ($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},nZ=function($,Q){if(Q==="__proto__"){if(!w1.call($,Q))return;else if(cZ)return cZ($,Q).value}return $[Q]};sZ.exports=function Z(){var $,Q,Y,W,J,K,q=arguments[0],H=1,w=arguments.length,F=!1;if(typeof q==="boolean")F=q,q=arguments[1]||{},H=2;if(q==null||typeof q!=="object"&&typeof q!=="function")q={};for(;H<w;++H)if($=arguments[H],$!=null){for(Q in $)if(Y=nZ(q,Q),W=nZ($,Q),q!==W){if(F&&W&&(iZ(W)||(J=pZ(W)))){if(J)J=!1,K=Y&&pZ(Y)?Y:[];else K=Y&&iZ(Y)?Y:{};aZ(q,{name:Q,newValue:Z(F,K,W)})}else if(typeof W<"u")aZ(q,{name:Q,newValue:W})}}return q}});var oZ=b((QD,dJ)=>{dJ.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 eZ=b((YD,tZ)=>{var lJ=oZ();tZ.exports={pkg:lJ}});var D8=b((j0)=>{var $$=j0&&j0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(j0,"__esModule",{value:!0});j0.GaxiosError=j0.GAXIOS_ERROR_SYMBOL=void 0;j0.defaultErrorRedactor=Q$;var Z$=$$(F8()),cJ=$$(eZ()),G8=cJ.default.pkg;j0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${G8.name}-gaxios-error`);class U8 extends Error{config;response;code;status;error;[j0.GAXIOS_ERROR_SYMBOL]=G8.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&j0.GAXIOS_ERROR_SYMBOL in Z&&Z[j0.GAXIOS_ERROR_SYMBOL]===G8.version)return!0;return Function.prototype[Symbol.hasInstance].call(U8,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,Z$.default)(!0,{},$),this.response)this.response.config=(0,Z$.default)(!0,{},this.response.config);if(this.response){try{this.response.data=pJ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,W="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let J=[];for(let K of Z.data.error.errors)if(typeof K==="object"&&"message"in K&&typeof K.message==="string")J.push(K.message);return Object.assign({message:J.join(`
2
+ import{$k as a,Wk as I8,Xk as b}from"./chunk-6f1twjf6.js";var gZ=b((tU,fZ)=>{function O0(Z,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(Z)),this._timeouts=Z,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}fZ.exports=O0;O0.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};O0.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null};O0.prototype.retry=function(Z){if(this._timeout)clearTimeout(this._timeout);if(!Z)return!1;var $=new Date().getTime();if(Z&&$-this._operationStart>=this._maxRetryTime)return this._errors.push(Z),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(Z);var Q=this._timeouts.shift();if(Q===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),Q=this._cachedTimeouts.slice(-1);else return!1;var Y=this;if(this._timer=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},Q),this._options.unref)this._timer.unref();return!0};O0.prototype.attempt=function(Z,$){if(this._fn=Z,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var Q=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){Q._operationTimeoutCb()},Q._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};O0.prototype.try=function(Z){console.log("Using RetryOperation.try() is deprecated"),this.attempt(Z)};O0.prototype.start=function(Z){console.log("Using RetryOperation.start() is deprecated"),this.attempt(Z)};O0.prototype.start=O0.prototype.try;O0.prototype.errors=function(){return this._errors};O0.prototype.attempts=function(){return this._attempts};O0.prototype.mainError=function(){if(this._errors.length===0)return null;var Z={},$=null,Q=0;for(var Y=0;Y<this._errors.length;Y++){var W=this._errors[Y],J=W.message,K=(Z[J]||0)+1;if(Z[J]=K,K>=Q)$=W,Q=K}return $}});var mZ=b((kJ)=>{var hJ=gZ();kJ.operation=function(Z){var $=kJ.timeouts(Z);return new hJ($,{forever:Z&&(Z.forever||Z.retries===1/0),unref:Z&&Z.unref,maxRetryTime:Z&&Z.maxRetryTime})};kJ.timeouts=function(Z){if(Z instanceof Array)return[].concat(Z);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var Q in Z)$[Q]=Z[Q];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var W=0;W<$.retries;W++)Y.push(this.createTimeout(W,$));if(Z&&Z.forever&&!Y.length)Y.push(this.createTimeout(W,$));return Y.sort(function(J,K){return J-K}),Y};kJ.createTimeout=function(Z,$){var Q=$.randomize?Math.random()+1:1,Y=Math.round(Q*Math.max($.minTimeout,1)*Math.pow($.factor,Z));return Y=Math.min(Y,$.maxTimeout),Y};kJ.wrap=function(Z,$,Q){if($ instanceof Array)Q=$,$=null;if(!Q){Q=[];for(var Y in Z)if(typeof Z[Y]==="function")Q.push(Y)}for(var W=0;W<Q.length;W++){var J=Q[W],K=Z[J];Z[J]=function(H){var w=kJ.operation($),F=Array.prototype.slice.call(arguments,1),z=F.pop();F.push(function(G){if(w.retry(G))return;if(G)arguments[0]=w.mainError();z.apply(this,arguments)}),w.attempt(function(){H.apply(Z,F)})}.bind(Z,K),Z[J].options=$}}});var dZ=b((ZD,H1)=>{var gJ=mZ(),bJ=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class z8 extends Error{constructor(Z){super();if(Z instanceof Error)this.originalError=Z,{message:Z}=Z;else this.originalError=Error(Z),this.originalError.stack=this.stack;this.name="AbortError",this.message=Z}}var mJ=(Z,$,Q)=>{let Y=Q.retries-($-1);return Z.attemptNumber=$,Z.retriesLeft=Y,Z},uJ=(Z)=>bJ.includes(Z),uZ=(Z,$)=>new Promise((Q,Y)=>{$={onFailedAttempt:()=>{},retries:10,...$};let W=gJ.operation($);W.attempt(async(J)=>{try{Q(await Z(J))}catch(K){if(!(K instanceof Error)){Y(TypeError(`Non-error was thrown: "${K}". You should only throw errors.`));return}if(K instanceof z8)W.stop(),Y(K.originalError);else if(K instanceof TypeError&&!uJ(K.message))W.stop(),Y(K);else{mJ(K,J,$);try{await $.onFailedAttempt(K)}catch(q){Y(q);return}if(!W.retry(K))Y(W.mainError())}}})});H1.exports=uZ;H1.exports.default=uZ;H1.exports.AbortError=z8});var F8=b(($D,sZ)=>{var w1=Object.prototype.hasOwnProperty,rZ=Object.prototype.toString,lZ=Object.defineProperty,cZ=Object.getOwnPropertyDescriptor,pZ=function($){if(typeof Array.isArray==="function")return Array.isArray($);return rZ.call($)==="[object Array]"},iZ=function($){if(!$||rZ.call($)!=="[object Object]")return!1;var Q=w1.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&w1.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var W;for(W in $);return typeof W>"u"||w1.call($,W)},aZ=function($,Q){if(lZ&&Q.name==="__proto__")lZ($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},nZ=function($,Q){if(Q==="__proto__"){if(!w1.call($,Q))return;else if(cZ)return cZ($,Q).value}return $[Q]};sZ.exports=function Z(){var $,Q,Y,W,J,K,q=arguments[0],H=1,w=arguments.length,F=!1;if(typeof q==="boolean")F=q,q=arguments[1]||{},H=2;if(q==null||typeof q!=="object"&&typeof q!=="function")q={};for(;H<w;++H)if($=arguments[H],$!=null){for(Q in $)if(Y=nZ(q,Q),W=nZ($,Q),q!==W){if(F&&W&&(iZ(W)||(J=pZ(W)))){if(J)J=!1,K=Y&&pZ(Y)?Y:[];else K=Y&&iZ(Y)?Y:{};aZ(q,{name:Q,newValue:Z(F,K,W)})}else if(typeof W<"u")aZ(q,{name:Q,newValue:W})}}return q}});var oZ=b((QD,dJ)=>{dJ.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 eZ=b((YD,tZ)=>{var lJ=oZ();tZ.exports={pkg:lJ}});var D8=b((j0)=>{var $$=j0&&j0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(j0,"__esModule",{value:!0});j0.GaxiosError=j0.GAXIOS_ERROR_SYMBOL=void 0;j0.defaultErrorRedactor=Q$;var Z$=$$(F8()),cJ=$$(eZ()),G8=cJ.default.pkg;j0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${G8.name}-gaxios-error`);class U8 extends Error{config;response;code;status;error;[j0.GAXIOS_ERROR_SYMBOL]=G8.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&j0.GAXIOS_ERROR_SYMBOL in Z&&Z[j0.GAXIOS_ERROR_SYMBOL]===G8.version)return!0;return Function.prototype[Symbol.hasInstance].call(U8,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,Z$.default)(!0,{},$),this.response)this.response.config=(0,Z$.default)(!0,{},this.response.config);if(this.response){try{this.response.data=pJ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,W="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let J=[];for(let K of Z.data.error.errors)if(typeof K==="object"&&"message"in K&&typeof K.message==="string")J.push(K.message);return Object.assign({message:J.join(`
3
3
  `)||Q,code:W,status:Y},Z.data.error)}return Object.assign({message:Q,code:W,status:Y},Z.data.error)}}return{message:Q,code:Z.status,status:Z.statusText}}}j0.GaxiosError=U8;function pJ(Z,$){switch(Z){case"stream":return $;case"json":return JSON.parse(JSON.stringify($));case"arraybuffer":return JSON.parse(Buffer.from($).toString("utf8"));case"blob":return JSON.parse($.text());default:return $}}function Q$(Z){function Q(J){if(!J)return;J.forEach((K,q)=>{if(/^authentication$/i.test(q)||/^authorization$/i.test(q)||/secret/i.test(q))J.set(q,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")})}function Y(J,K){if(typeof J==="object"&&J!==null&&typeof J[K]==="string"){let q=J[K];if(/grant_type=/i.test(q)||/assertion=/i.test(q)||/secret/i.test(q))J[K]="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}function W(J){if(!J||typeof J!=="object")return;else if(J instanceof FormData||J instanceof URLSearchParams||"forEach"in J&&"set"in J)J.forEach((K,q)=>{if(["grant_type","assertion"].includes(q)||/secret/.test(q))J.set(q,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")});else{if("grant_type"in J)J.grant_type="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("assertion"in J)J.assertion="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("client_secret"in J)J.client_secret="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}if(Z.config){if(Q(Z.config.headers),Y(Z.config,"data"),W(Z.config.data),Y(Z.config,"body"),W(Z.config.body),Z.config.url.searchParams.has("token"))Z.config.url.searchParams.set("token","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.");if(Z.config.url.searchParams.has("client_secret"))Z.config.url.searchParams.set("client_secret","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")}if(Z.response){if(Q$({config:Z.response.config}),Q(Z.response.headers),Z.response.bodyUsed)Y(Z.response,"data"),W(Z.response.data)}return Z}});var V$=b((W$)=>{Object.defineProperty(W$,"__esModule",{value:!0});W$.getRetryConfig=iJ;async function iJ(Z){let $=Y$(Z);if(!Z||!Z.config||!$&&!Z.config.retry)return{shouldRetry:!1};$=$||{},$.currentRetryAttempt=$.currentRetryAttempt||0,$.retry=$.retry===void 0||$.retry===null?3:$.retry,$.httpMethodsToRetry=$.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],$.noResponseRetries=$.noResponseRetries===void 0||$.noResponseRetries===null?2:$.noResponseRetries,$.retryDelayMultiplier=$.retryDelayMultiplier?$.retryDelayMultiplier:2,$.timeOfFirstRequest=$.timeOfFirstRequest?$.timeOfFirstRequest:Date.now(),$.totalTimeout=$.totalTimeout?$.totalTimeout:Number.MAX_SAFE_INTEGER,$.maxRetryDelay=$.maxRetryDelay?$.maxRetryDelay:Number.MAX_SAFE_INTEGER;let Q=[[100,199],[408,408],[429,429],[500,599]];if($.statusCodesToRetry=$.statusCodesToRetry||Q,Z.config.retryConfig=$,!await($.shouldRetry||aJ)(Z))return{shouldRetry:!1,config:Z.config};let W=nJ($);Z.config.retryConfig.currentRetryAttempt+=1;let J=$.retryBackoff?$.retryBackoff(Z,W):new Promise((K)=>{setTimeout(K,W)});if($.onRetryAttempt)await $.onRetryAttempt(Z);return await J,{shouldRetry:!0,config:Z.config}}function aJ(Z){let $=Y$(Z);if(Z.config.signal?.aborted&&Z.code!=="TimeoutError"||Z.code==="AbortError")return!1;if(!$||$.retry===0)return!1;if(!Z.response&&($.currentRetryAttempt||0)>=$.noResponseRetries)return!1;if(!$.httpMethodsToRetry||!$.httpMethodsToRetry.includes(Z.config.method?.toUpperCase()||"GET"))return!1;if(Z.response&&Z.response.status){let Q=!1;for(let[Y,W]of $.statusCodesToRetry){let J=Z.response.status;if(J>=Y&&J<=W){Q=!0;break}}if(!Q)return!1}if($.currentRetryAttempt=$.currentRetryAttempt||0,$.currentRetryAttempt>=$.retry)return!1;return!0}function Y$(Z){if(Z&&Z.config&&Z.config.retryConfig)return Z.config.retryConfig;return}function nJ(Z){let Q=(Z.currentRetryAttempt?0:Z.retryDelay??100)+(Math.pow(Z.retryDelayMultiplier,Z.currentRetryAttempt)-1)/2*1000,Y=Z.totalTimeout-(Date.now()-Z.timeOfFirstRequest);return Math.min(Q,Y,Z.maxRetryDelay)}});var M8=b((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});X$.GaxiosInterceptorManager=void 0;class J$ extends Set{}X$.GaxiosInterceptorManager=J$});var w$=b((T4)=>{var sJ=T4&&T4.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}},N4;Object.defineProperty(T4,"__esModule",{value:!0});T4.Gaxios=void 0;var oJ=sJ(F8()),tJ=a("https"),z4=D8(),eJ=V$(),q$=a("stream"),H$=M8(),Z7=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),$7=204;class N8{agentCache=new Map;defaults;interceptors;constructor(Z){this.defaults=Z||{},this.interceptors={request:new H$.GaxiosInterceptorManager,response:new H$.GaxiosInterceptorManager}}fetch(...Z){let $=Z[0],Q=Z[1],Y=void 0,W=new Headers;if(typeof $==="string")Y=new URL($);else if($ instanceof URL)Y=$;else if($&&$.url)Y=new URL($.url);if($&&typeof $==="object"&&"headers"in $)N4.mergeHeaders(W,$.headers);if(Q)N4.mergeHeaders(W,new Headers(Q.headers));if(typeof $==="object"&&!($ instanceof URL))return this.request({...Q,...$,headers:W,url:Y});else return this.request({...Q,headers:W,url:Y})}async request(Z={}){let $=await this.#Y(Z);return $=await this.#$($),this.#Q(this._request($))}async _defaultAdapter(Z){let $=Z.fetchImplementation||this.defaults.fetchImplementation||await N4.#K(),Q={...Z};delete Q.data;let Y=await $(Z.url,Q),W=await this.getResponseData(Z,Y);if(!Object.getOwnPropertyDescriptor(Y,"data")?.configurable)Object.defineProperties(Y,{data:{configurable:!0,writable:!0,enumerable:!0,value:W}});return Object.assign(Y,{config:Z,data:W})}async _request(Z){try{let $;if(Z.adapter)$=await Z.adapter(Z,this._defaultAdapter.bind(this));else $=await this._defaultAdapter(Z);if(!Z.validateStatus($.status)){if(Z.responseType==="stream"){let Y=[];for await(let W of $.data)Y.push(W);$.data=Y.toString()}let Q=z4.GaxiosError.extractAPIErrorFromResponse($,`Request failed with status code ${$.status}`);throw new z4.GaxiosError(Q?.message,Z,$,Q)}return $}catch($){let Q;if($ instanceof z4.GaxiosError)Q=$;else if($ instanceof Error)Q=new z4.GaxiosError($.message,Z,void 0,$);else Q=new z4.GaxiosError("Unexpected Gaxios Error",Z,void 0,$);let{shouldRetry:Y,config:W}=await(0,eJ.getRetryConfig)(Q);if(Y&&W)return Q.config.retryConfig.currentRetryAttempt=W.retryConfig.currentRetryAttempt,Z.retryConfig=Q.config?.retryConfig,this.#W(Z),this._request(Z);if(Z.errorRedactor)Z.errorRedactor(Q);throw Q}}async getResponseData(Z,$){if($.status===$7)return"";if(Z.maxContentLength&&$.headers.has("content-length")&&Z.maxContentLength<Number.parseInt($.headers?.get("content-length")||""))throw new z4.GaxiosError("Response's `Content-Length` is over the limit.",Z,Object.assign($,{config:Z}));switch(Z.responseType){case"stream":return $.body;case"json":{let Q=await $.text();try{return JSON.parse(Q)}catch{return Q}}case"arraybuffer":return $.arrayBuffer();case"blob":return $.blob();case"text":return $.text();default:return this.getResponseDataFromContentType($)}}#Z(Z,$=[]){let Q=new URL(Z),Y=[...$],W=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let J of W)Y.push(J.trim());for(let J of Y)if(J instanceof RegExp){if(J.test(Q.toString()))return!1}else if(J instanceof URL){if(J.origin===Q.origin)return!1}else if(J.startsWith("*.")||J.startsWith(".")){let K=J.replace(/^\*\./,".");if(Q.hostname.endsWith(K))return!1}else if(J===Q.origin||J===Q.hostname||J===Q.href)return!1;return!0}async#$(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.request.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Q(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.response.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Y(Z){let $=new Headers(this.defaults.headers);N4.mergeHeaders($,Z.headers);let Q=(0,oJ.default)(!0,{},this.defaults,Z);if(!Q.url)throw Error("URL is required.");if(Q.baseURL)Q.url=new URL(Q.url,Q.baseURL);if(Q.url=new URL(Q.url),Q.params)if(Q.paramsSerializer){let J=Q.paramsSerializer(Q.params);if(J.startsWith("?"))J=J.slice(1);let K=Q.url.toString().includes("?")?"&":"?";Q.url=Q.url+K+J}else{let J=Q.url instanceof URL?Q.url:new URL(Q.url);for(let[K,q]of new URLSearchParams(Q.params))J.searchParams.append(K,q);Q.url=J}if(typeof Z.maxContentLength==="number")Q.size=Z.maxContentLength;if(typeof Z.maxRedirects==="number")Q.follow=Z.maxRedirects;let Y=typeof Q.data==="string"||Q.data instanceof ArrayBuffer||Q.data instanceof Blob||globalThis.File&&Q.data instanceof File||Q.data instanceof FormData||Q.data instanceof q$.Readable||Q.data instanceof ReadableStream||Q.data instanceof String||Q.data instanceof URLSearchParams||ArrayBuffer.isView(Q.data)||["Blob","File","FormData"].includes(Q.data?.constructor?.name||"");if(Q.multipart?.length){let J=await Z7();$.set("content-type",`multipart/related; boundary=${J}`),Q.body=q$.Readable.from(this.getMultipartRequest(Q.multipart,J))}else if(Y)Q.body=Q.data;else if(typeof Q.data==="object")if($.get("Content-Type")==="application/x-www-form-urlencoded")Q.body=Q.paramsSerializer?Q.paramsSerializer(Q.data):new URLSearchParams(Q.data);else{if(!$.has("content-type"))$.set("content-type","application/json");Q.body=JSON.stringify(Q.data)}else if(Q.data)Q.body=Q.data;if(Q.validateStatus=Q.validateStatus||this.validateStatus,Q.responseType=Q.responseType||"unknown",!$.has("accept")&&Q.responseType==="json")$.set("accept","application/json");let W=Q.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(Q.agent);else if(W&&this.#Z(Q.url,Q.noProxy)){let J=await N4.#X();if(this.agentCache.has(W))Q.agent=this.agentCache.get(W);else Q.agent=new J(W,{cert:Q.cert,key:Q.key}),this.agentCache.set(W,Q.agent)}else if(Q.cert&&Q.key)if(this.agentCache.has(Q.key))Q.agent=this.agentCache.get(Q.key);else Q.agent=new tJ.Agent({cert:Q.cert,key:Q.key}),this.agentCache.set(Q.key,Q.agent);if(typeof Q.errorRedactor!=="function"&&Q.errorRedactor!==!1)Q.errorRedactor=z4.defaultErrorRedactor;if(Q.body&&!("duplex"in Q))Q.duplex="half";return this.#W(Q),Object.assign(Q,{headers:$,url:Q.url instanceof URL?Q.url:new URL(Q.url)})}#W(Z){if(Z.timeout){let $=AbortSignal.timeout(Z.timeout);if(Z.signal&&!Z.signal.aborted)Z.signal=AbortSignal.any([Z.signal,$]);else Z.signal=$}}validateStatus(Z){return Z>=200&&Z<300}async getResponseDataFromContentType(Z){let $=Z.headers.get("Content-Type");if($===null)return Z.text();if($=$.toLowerCase(),$.includes("application/json")){let Q=await Z.text();try{Q=JSON.parse(Q)}catch{}return Q}else if($.match(/^text\//))return Z.text();else return Z.blob()}async*getMultipartRequest(Z,$){let Q=`--${$}--`;for(let Y of Z){let W=Y.headers.get("Content-Type")||"application/octet-stream";if(yield`--${$}\r
4
4
  Content-Type: ${W}\r
5
5
  \r
6
6
  `,typeof Y.content==="string")yield Y.content;else yield*Y.content;yield`\r
7
- `}yield Q}static#V;static#J;static async#X(){return this.#V||=(await import("./chunk-46ar48f9.js").then((m)=>I8(m.default))).HttpsProxyAgent,this.#V}static async#K(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((W,J)=>{J==="set-cookie"?Z.append(J,W):Z.set(J,W)});return Z}}T4.Gaxios=N8;N4=N8});var G0=b((I0)=>{var Q7=I0&&I0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var W=Object.getOwnPropertyDescriptor($,Q);if(!W||("get"in W?!$.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,W)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),Y7=I0&&I0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))Q7($,Z,Q)};Object.defineProperty(I0,"__esModule",{value:!0});I0.instance=I0.Gaxios=I0.GaxiosError=void 0;I0.request=V7;var z$=w$();Object.defineProperty(I0,"Gaxios",{enumerable:!0,get:function(){return z$.Gaxios}});var W7=D8();Object.defineProperty(I0,"GaxiosError",{enumerable:!0,get:function(){return W7.GaxiosError}});Y7(M8(),I0);I0.instance=new z$.Gaxios;async function V7(Z){return I0.instance.request(Z)}});var T8=b((F$,z1)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,W=Math.floor,J="[BigNumber Error] ",K=J+"Number primitive has more than 15 significant digits: ",q=100000000000000,H=14,w=9007199254740991,F=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],z=1e7,G=1e9;function D(f){var S,d,h,_=g.prototype={constructor:g,toString:null,valueOf:null},n=new g(1),o=20,t=4,J0=-7,$0=21,V0=-1e7,q0=1e7,L0=!1,R0=1,H0=0,H4={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},w4="0123456789abcdefghijklmnopqrstuvwxyz",X8=!0;function g(U,M){var N,v,L,A,j,B,R,E,C=this;if(!(C instanceof g))return new g(U,M);if(M==null){if(U&&U._isBigNumber===!0){if(C.s=U.s,!U.c||U.e>q0)C.c=C.e=null;else if(U.e<V0)C.c=[C.e=0];else C.e=U.e,C.c=U.c.slice();return}if((B=typeof U=="number")&&U*0==0){if(C.s=1/U<0?(U=-U,-1):1,U===~~U){for(A=0,j=U;j>=10;j/=10,A++);if(A>q0)C.c=C.e=null;else C.e=A,C.c=[U];return}E=String(U)}else{if(!Q.test(E=String(U)))return h(C,E,B);C.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}if((A=E.indexOf("."))>-1)E=E.replace(".","");if((j=E.search(/e/i))>0){if(A<0)A=j;A+=+E.slice(j+1),E=E.substring(0,j)}else if(A<0)A=E.length}else{if(O(M,2,w4.length,"Base"),M==10&&X8)return C=new g(U),v0(C,o+C.e+1,t);if(E=String(U),B=typeof U=="number"){if(U*0!=0)return h(C,E,B,M);if(C.s=1/U<0?(E=E.slice(1),-1):1,g.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(K+U)}else C.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;N=w4.slice(0,M),A=j=0;for(R=E.length;j<R;j++)if(N.indexOf(v=E.charAt(j))<0){if(v=="."){if(j>A){A=R;continue}}else if(!L){if(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase())){L=!0,j=-1,A=0;continue}}return h(C,String(U),B,M)}if(B=!1,E=d(E,M,10,C.s),(A=E.indexOf("."))>-1)E=E.replace(".","");else A=E.length}for(j=0;E.charCodeAt(j)===48;j++);for(R=E.length;E.charCodeAt(--R)===48;);if(E=E.slice(j,++R)){if(R-=j,B&&g.DEBUG&&R>15&&(U>w||U!==W(U)))throw Error(K+C.s*U);if((A=A-j-1)>q0)C.c=C.e=null;else if(A<V0)C.c=[C.e=0];else{if(C.e=A,C.c=[],j=(A+1)%H,A<0)j+=H;if(j<R){if(j)C.c.push(+E.slice(0,j));for(R-=H;j<R;)C.c.push(+E.slice(j,j+=H));j=H-(E=E.slice(j)).length}else j-=R;for(;j--;E+="0");C.c.push(+E)}}else C.c=[C.e=0]}g.clone=D,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(U){var M,N;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(M="DECIMAL_PLACES"))N=U[M],O(N,0,G,M),o=N;if(U.hasOwnProperty(M="ROUNDING_MODE"))N=U[M],O(N,0,8,M),t=N;if(U.hasOwnProperty(M="EXPONENTIAL_AT"))if(N=U[M],N&&N.pop)O(N[0],-G,0,M),O(N[1],0,G,M),J0=N[0],$0=N[1];else O(N,-G,G,M),J0=-($0=N<0?-N:N);if(U.hasOwnProperty(M="RANGE"))if(N=U[M],N&&N.pop)O(N[0],-G,-1,M),O(N[1],1,G,M),V0=N[0],q0=N[1];else if(O(N,-G,G,M),N)V0=-(q0=N<0?-N:N);else throw Error(J+M+" cannot be zero: "+N);if(U.hasOwnProperty(M="CRYPTO"))if(N=U[M],N===!!N)if(N)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))L0=N;else throw L0=!N,Error(J+"crypto unavailable");else L0=N;else throw Error(J+M+" not true or false: "+N);if(U.hasOwnProperty(M="MODULO_MODE"))N=U[M],O(N,0,9,M),R0=N;if(U.hasOwnProperty(M="POW_PRECISION"))N=U[M],O(N,0,G,M),H0=N;if(U.hasOwnProperty(M="FORMAT"))if(N=U[M],typeof N=="object")H4=N;else throw Error(J+M+" not an object: "+N);if(U.hasOwnProperty(M="ALPHABET"))if(N=U[M],typeof N=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(N))X8=N.slice(0,10)=="0123456789",w4=N;else throw Error(J+M+" invalid: "+N)}else throw Error(J+"Object expected: "+U);return{DECIMAL_PLACES:o,ROUNDING_MODE:t,EXPONENTIAL_AT:[J0,$0],RANGE:[V0,q0],CRYPTO:L0,MODULO_MODE:R0,POW_PRECISION:H0,FORMAT:H4,ALPHABET:w4}},g.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var M,N,v=U.c,L=U.e,A=U.s;Z:if({}.toString.call(v)=="[object Array]"){if((A===1||A===-1)&&L>=-G&&L<=G&&L===W(L)){if(v[0]===0){if(L===0&&v.length===1)return!0;break Z}if(M=(L+1)%H,M<1)M+=H;if(String(v[0]).length==M){for(M=0;M<v.length;M++)if(N=v[M],N<0||N>=q||N!==W(N))break Z;if(N!==0)return!0}}}else if(v===null&&L===null&&(A===null||A===1||A===-1))return!0;throw Error(J+"Invalid BigNumber: "+U)},g.maximum=g.max=function(){return xZ(arguments,-1)},g.minimum=g.min=function(){return xZ(arguments,1)},g.random=function(){var U=9007199254740992,M=Math.random()*U&2097151?function(){return W(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var v,L,A,j,B,R=0,E=[],C=new g(n);if(N==null)N=o;else O(N,0,G);if(j=Y(N/H),L0)if(crypto.getRandomValues){v=crypto.getRandomValues(new Uint32Array(j*=2));for(;R<j;)if(B=v[R]*131072+(v[R+1]>>>11),B>=9000000000000000)L=crypto.getRandomValues(new Uint32Array(2)),v[R]=L[0],v[R+1]=L[1];else E.push(B%100000000000000),R+=2;R=j/2}else if(crypto.randomBytes){v=crypto.randomBytes(j*=7);for(;R<j;)if(B=(v[R]&31)*281474976710656+v[R+1]*1099511627776+v[R+2]*4294967296+v[R+3]*16777216+(v[R+4]<<16)+(v[R+5]<<8)+v[R+6],B>=9000000000000000)crypto.randomBytes(7).copy(v,R);else E.push(B%100000000000000),R+=7;R=j/7}else throw L0=!1,Error(J+"crypto unavailable");if(!L0){for(;R<j;)if(B=M(),B<9000000000000000)E[R++]=B%100000000000000}if(j=E[--R],N%=H,j&&N)B=F[H-N],E[R]=W(j/B)*B;for(;E[R]===0;E.pop(),R--);if(R<0)E=[A=0];else{for(A=-1;E[0]===0;E.splice(0,1),A-=H);for(R=1,B=E[0];B>=10;B/=10,R++);if(R<H)A-=H-R}return C.e=A,C.c=E,C}}(),g.sum=function(){var U=1,M=arguments,N=new g(M[0]);for(;U<M.length;)N=N.plus(M[U++]);return N},d=function(){var U="0123456789";function M(N,v,L,A){var j,B=[0],R,E=0,C=N.length;for(;E<C;){for(R=B.length;R--;B[R]*=v);B[0]+=A.indexOf(N.charAt(E++));for(j=0;j<B.length;j++)if(B[j]>L-1){if(B[j+1]==null)B[j+1]=0;B[j+1]+=B[j]/L|0,B[j]%=L}}return B.reverse()}return function(N,v,L,A,j){var B,R,E,C,k,c,p,Q0,X0=N.indexOf("."),z0=o,e=t;if(X0>=0)C=H0,H0=0,N=N.replace(".",""),Q0=new g(v),c=Q0.pow(N.length-X0),H0=C,Q0.c=M(m(I(c.c),c.e,"0"),10,L,U),Q0.e=Q0.c.length;p=M(N,v,L,j?(B=w4,U):(B=U,w4)),E=C=p.length;for(;p[--C]==0;p.pop());if(!p[0])return B.charAt(0);if(X0<0)--E;else c.c=p,c.e=E,c.s=A,c=S(c,Q0,z0,e,L),p=c.c,k=c.r,E=c.e;if(R=E+z0+1,X0=p[R],C=L/2,k=k||R<0||p[R+1]!=null,k=e<4?(X0!=null||k)&&(e==0||e==(c.s<0?3:2)):X0>C||X0==C&&(e==4||k||e==6&&p[R-1]&1||e==(c.s<0?8:7)),R<1||!p[0])N=k?m(B.charAt(1),-z0,B.charAt(0)):B.charAt(0);else{if(p.length=R,k){for(--L;++p[--R]>L;)if(p[R]=0,!R)++E,p=[1].concat(p)}for(C=p.length;!p[--C];);for(X0=0,N="";X0<=C;N+=B.charAt(p[X0++]));N=m(N,E,B.charAt(0))}return N}}(),S=function(){function U(v,L,A){var j,B,R,E,C=0,k=v.length,c=L%z,p=L/z|0;for(v=v.slice();k--;)R=v[k]%z,E=v[k]/z|0,j=p*R+E*c,B=c*R+j%z*z+C,C=(B/A|0)+(j/z|0)+p*E,v[k]=B%A;if(C)v=[C].concat(v);return v}function M(v,L,A,j){var B,R;if(A!=j)R=A>j?1:-1;else for(B=R=0;B<A;B++)if(v[B]!=L[B]){R=v[B]>L[B]?1:-1;break}return R}function N(v,L,A,j){var B=0;for(;A--;)v[A]-=B,B=v[A]<L[A]?1:0,v[A]=B*j+v[A]-L[A];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,L,A,j,B){var R,E,C,k,c,p,Q0,X0,z0,e,Y0,D0,q1,H8,w8,l0,u4,E0=v.s==L.s?1:-1,M0=v.c,K0=L.c;if(!M0||!M0[0]||!K0||!K0[0])return new g(!v.s||!L.s||(M0?K0&&M0[0]==K0[0]:!K0)?NaN:M0&&M0[0]==0||!K0?E0*0:E0/0);if(X0=new g(E0),z0=X0.c=[],E=v.e-L.e,E0=A+E+1,!B)B=q,E=T(v.e/H)-T(L.e/H),E0=E0/H|0;for(C=0;K0[C]==(M0[C]||0);C++);if(K0[C]>(M0[C]||0))E--;if(E0<0)z0.push(1),k=!0;else{if(H8=M0.length,l0=K0.length,C=0,E0+=2,c=W(B/(K0[0]+1)),c>1)K0=U(K0,c,B),M0=U(M0,c,B),l0=K0.length,H8=M0.length;q1=l0,e=M0.slice(0,l0),Y0=e.length;for(;Y0<l0;e[Y0++]=0);if(u4=K0.slice(),u4=[0].concat(u4),w8=K0[0],K0[1]>=B/2)w8++;do{if(c=0,R=M(K0,e,l0,Y0),R<0){if(D0=e[0],l0!=Y0)D0=D0*B+(e[1]||0);if(c=W(D0/w8),c>1){if(c>=B)c=B-1;p=U(K0,c,B),Q0=p.length,Y0=e.length;while(M(p,e,Q0,Y0)==1)c--,N(p,l0<Q0?u4:K0,Q0,B),Q0=p.length,R=1}else{if(c==0)R=c=1;p=K0.slice(),Q0=p.length}if(Q0<Y0)p=[0].concat(p);if(N(e,p,Y0,B),Y0=e.length,R==-1)while(M(K0,e,l0,Y0)<1)c++,N(e,l0<Y0?u4:K0,Y0,B),Y0=e.length}else if(R===0)c++,e=[0];if(z0[C++]=c,e[0])e[Y0++]=M0[q1]||0;else e=[M0[q1]],Y0=1}while((q1++<H8||e[0]!=null)&&E0--);if(k=e[0]!=null,!z0[0])z0.splice(0,1)}if(B==q){for(C=1,E0=z0[0];E0>=10;E0/=10,C++);v0(X0,A+(X0.e=C+E*H-1)+1,j,k)}else X0.e=E,X0.r=+k;return X0}}();function K8(U,M,N,v){var L,A,j,B,R;if(N==null)N=t;else O(N,0,8);if(!U.c)return U.toString();if(L=U.c[0],j=U.e,M==null)R=I(U.c),R=v==1||v==2&&(j<=J0||j>=$0)?x(R,j):m(R,j,"0");else if(U=v0(new g(U),M,N),A=U.e,R=I(U.c),B=R.length,v==1||v==2&&(M<=A||A<=J0)){for(;B<M;R+="0",B++);R=x(R,A)}else if(M-=j+(v===2&&A>j),R=m(R,A,"0"),A+1>B){if(--M>0)for(R+=".";M--;R+="0");}else if(M+=A-B,M>0){if(A+1==B)R+=".";for(;M--;R+="0");}return U.s<0&&L?"-"+R:R}function xZ(U,M){var N,v,L=1,A=new g(U[0]);for(;L<U.length;L++)if(v=new g(U[L]),!v.s||(N=P(A,v))===M||N===0&&A.s===M)A=v;return A}function q8(U,M,N){var v=1,L=M.length;for(;!M[--L];M.pop());for(L=M[0];L>=10;L/=10,v++);if((N=v+N*H-1)>q0)U.c=U.e=null;else if(N<V0)U.c=[U.e=0];else U.e=N,U.c=M;return U}h=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,N=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,L=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,j,B,R){var E,C=B?j:j.replace(L,"");if(v.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!B){if(C=C.replace(U,function(k,c,p){return E=(p=p.toLowerCase())=="x"?16:p=="b"?2:8,!R||R==E?c:k}),R)E=R,C=C.replace(M,"$1").replace(N,"0.$1");if(j!=C)return new g(C,E)}if(g.DEBUG)throw Error(J+"Not a"+(R?" base "+R:"")+" number: "+j);A.s=null}A.c=A.e=null}}();function v0(U,M,N,v){var L,A,j,B,R,E,C,k=U.c,c=F;if(k){Z:{for(L=1,B=k[0];B>=10;B/=10,L++);if(A=M-L,A<0)A+=H,j=M,R=k[E=0],C=W(R/c[L-j-1]%10);else if(E=Y((A+1)/H),E>=k.length)if(v){for(;k.length<=E;k.push(0));R=C=0,L=1,A%=H,j=A-H+1}else break Z;else{R=B=k[E];for(L=1;B>=10;B/=10,L++);A%=H,j=A-H+L,C=j<0?0:W(R/c[L-j-1]%10)}if(v=v||M<0||k[E+1]!=null||(j<0?R:R%c[L-j-1]),v=N<4?(C||v)&&(N==0||N==(U.s<0?3:2)):C>5||C==5&&(N==4||v||N==6&&(A>0?j>0?R/c[L-j]:0:k[E-1])%10&1||N==(U.s<0?8:7)),M<1||!k[0]){if(k.length=0,v)M-=U.e+1,k[0]=c[(H-M%H)%H],U.e=-M||0;else k[0]=U.e=0;return U}if(A==0)k.length=E,B=1,E--;else k.length=E+1,B=c[H-A],k[E]=j>0?W(R/c[L-j]%c[j])*B:0;if(v)for(;;)if(E==0){for(A=1,j=k[0];j>=10;j/=10,A++);j=k[0]+=B;for(B=1;j>=10;j/=10,B++);if(A!=B){if(U.e++,k[0]==q)k[0]=1}break}else{if(k[E]+=B,k[E]!=q)break;k[E--]=0,B=1}for(A=k.length;k[--A]===0;k.pop());}if(U.e>q0)U.c=U.e=null;else if(U.e<V0)U.c=[U.e=0]}return U}function n0(U){var M,N=U.e;if(N===null)return U.toString();return M=I(U.c),M=N<=J0||N>=$0?x(M,N):m(M,N,"0"),U.s<0?"-"+M:M}if(_.absoluteValue=_.abs=function(){var U=new g(this);if(U.s<0)U.s=1;return U},_.comparedTo=function(U,M){return P(this,new g(U,M))},_.decimalPlaces=_.dp=function(U,M){var N,v,L,A=this;if(U!=null){if(O(U,0,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U+A.e+1,M)}if(!(N=A.c))return null;if(v=((L=N.length-1)-T(this.e/H))*H,L=N[L])for(;L%10==0;L/=10,v--);if(v<0)v=0;return v},_.dividedBy=_.div=function(U,M){return S(this,new g(U,M),o,t)},_.dividedToIntegerBy=_.idiv=function(U,M){return S(this,new g(U,M),0,1)},_.exponentiatedBy=_.pow=function(U,M){var N,v,L,A,j,B,R,E,C,k=this;if(U=new g(U),U.c&&!U.isInteger())throw Error(J+"Exponent not an integer: "+n0(U));if(M!=null)M=new g(M);if(B=U.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!U.c||!U.c[0])return C=new g(Math.pow(+n0(k),B?U.s*(2-y(U)):+n0(U))),M?C.mod(M):C;if(R=U.s<0,M){if(M.c?!M.c[0]:!M.s)return new g(NaN);if(v=!R&&k.isInteger()&&M.isInteger(),v)k=k.mod(M)}else if(U.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||B&&k.c[1]>=240000000:k.c[0]<80000000000000||B&&k.c[0]<=99999750000000))){if(A=k.s<0&&y(U)?-0:0,k.e>-1)A=1/A;return new g(R?1/A:A)}else if(H0)A=Y(H0/H+2);if(B){if(N=new g(0.5),R)U.s=1;E=y(U)}else L=Math.abs(+n0(U)),E=L%2;C=new g(n);for(;;){if(E){if(C=C.times(k),!C.c)break;if(A){if(C.c.length>A)C.c.length=A}else if(v)C=C.mod(M)}if(L){if(L=W(L/2),L===0)break;E=L%2}else if(U=U.times(N),v0(U,U.e+1,1),U.e>14)E=y(U);else{if(L=+n0(U),L===0)break;E=L%2}if(k=k.times(k),A){if(k.c&&k.c.length>A)k.c.length=A}else if(v)k=k.mod(M)}if(v)return C;if(R)C=n.div(C);return M?C.mod(M):A?v0(C,H0,t,j):C},_.integerValue=function(U){var M=new g(this);if(U==null)U=t;else O(U,0,8);return v0(M,M.e+1,U)},_.isEqualTo=_.eq=function(U,M){return P(this,new g(U,M))===0},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(U,M){return P(this,new g(U,M))>0},_.isGreaterThanOrEqualTo=_.gte=function(U,M){return(M=P(this,new g(U,M)))===1||M===0},_.isInteger=function(){return!!this.c&&T(this.e/H)>this.c.length-2},_.isLessThan=_.lt=function(U,M){return P(this,new g(U,M))<0},_.isLessThanOrEqualTo=_.lte=function(U,M){return(M=P(this,new g(U,M)))===-1||M===0},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&this.c[0]==0},_.minus=function(U,M){var N,v,L,A,j=this,B=j.s;if(U=new g(U,M),M=U.s,!B||!M)return new g(NaN);if(B!=M)return U.s=-M,j.plus(U);var R=j.e/H,E=U.e/H,C=j.c,k=U.c;if(!R||!E){if(!C||!k)return C?(U.s=-M,U):new g(k?j:NaN);if(!C[0]||!k[0])return k[0]?(U.s=-M,U):new g(C[0]?j:t==3?-0:0)}if(R=T(R),E=T(E),C=C.slice(),B=R-E){if(A=B<0)B=-B,L=C;else E=R,L=k;L.reverse();for(M=B;M--;L.push(0));L.reverse()}else{v=(A=(B=C.length)<(M=k.length))?B:M;for(B=M=0;M<v;M++)if(C[M]!=k[M]){A=C[M]<k[M];break}}if(A)L=C,C=k,k=L,U.s=-U.s;if(M=(v=k.length)-(N=C.length),M>0)for(;M--;C[N++]=0);M=q-1;for(;v>B;){if(C[--v]<k[v]){for(N=v;N&&!C[--N];C[N]=M);--C[N],C[v]+=q}C[v]-=k[v]}for(;C[0]==0;C.splice(0,1),--E);if(!C[0])return U.s=t==3?-1:1,U.c=[U.e=0],U;return q8(U,C,E)},_.modulo=_.mod=function(U,M){var N,v,L=this;if(U=new g(U,M),!L.c||!U.s||U.c&&!U.c[0])return new g(NaN);else if(!U.c||L.c&&!L.c[0])return new g(L);if(R0==9)v=U.s,U.s=1,N=S(L,U,0,3),U.s=v,N.s*=v;else N=S(L,U,0,R0);if(U=L.minus(N.times(U)),!U.c[0]&&R0==1)U.s=L.s;return U},_.multipliedBy=_.times=function(U,M){var N,v,L,A,j,B,R,E,C,k,c,p,Q0,X0,z0,e=this,Y0=e.c,D0=(U=new g(U,M)).c;if(!Y0||!D0||!Y0[0]||!D0[0]){if(!e.s||!U.s||Y0&&!Y0[0]&&!D0||D0&&!D0[0]&&!Y0)U.c=U.e=U.s=null;else if(U.s*=e.s,!Y0||!D0)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(v=T(e.e/H)+T(U.e/H),U.s*=e.s,R=Y0.length,k=D0.length,R<k)Q0=Y0,Y0=D0,D0=Q0,L=R,R=k,k=L;for(L=R+k,Q0=[];L--;Q0.push(0));X0=q,z0=z;for(L=k;--L>=0;){N=0,c=D0[L]%z0,p=D0[L]/z0|0;for(j=R,A=L+j;A>L;)E=Y0[--j]%z0,C=Y0[j]/z0|0,B=p*E+C*c,E=c*E+B%z0*z0+Q0[A]+N,N=(E/X0|0)+(B/z0|0)+p*C,Q0[A--]=E%X0;Q0[A]=N}if(N)++v;else Q0.splice(0,1);return q8(U,Q0,v)},_.negated=function(){var U=new g(this);return U.s=-U.s||null,U},_.plus=function(U,M){var N,v=this,L=v.s;if(U=new g(U,M),M=U.s,!L||!M)return new g(NaN);if(L!=M)return U.s=-M,v.minus(U);var A=v.e/H,j=U.e/H,B=v.c,R=U.c;if(!A||!j){if(!B||!R)return new g(L/0);if(!B[0]||!R[0])return R[0]?U:new g(B[0]?v:L*0)}if(A=T(A),j=T(j),B=B.slice(),L=A-j){if(L>0)j=A,N=R;else L=-L,N=B;N.reverse();for(;L--;N.push(0));N.reverse()}if(L=B.length,M=R.length,L-M<0)N=R,R=B,B=N,M=L;for(L=0;M;)L=(B[--M]=B[M]+R[M]+L)/q|0,B[M]=q===B[M]?0:B[M]%q;if(L)B=[L].concat(B),++j;return q8(U,B,j)},_.precision=_.sd=function(U,M){var N,v,L,A=this;if(U!=null&&U!==!!U){if(O(U,1,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U,M)}if(!(N=A.c))return null;if(L=N.length-1,v=L*H+1,L=N[L]){for(;L%10==0;L/=10,v--);for(L=N[0];L>=10;L/=10,v++);}if(U&&A.e+1>v)v=A.e+1;return v},_.shiftedBy=function(U){return O(U,-w,w),this.times("1e"+U)},_.squareRoot=_.sqrt=function(){var U,M,N,v,L,A=this,j=A.c,B=A.s,R=A.e,E=o+4,C=new g("0.5");if(B!==1||!j||!j[0])return new g(!B||B<0&&(!j||j[0])?NaN:j?A:1/0);if(B=Math.sqrt(+n0(A)),B==0||B==1/0){if(M=I(j),(M.length+R)%2==0)M+="0";if(B=Math.sqrt(+M),R=T((R+1)/2)-(R<0||R%2),B==1/0)M="5e"+R;else M=B.toExponential(),M=M.slice(0,M.indexOf("e")+1)+R;N=new g(M)}else N=new g(B+"");if(N.c[0]){if(R=N.e,B=R+E,B<3)B=0;for(;;)if(L=N,N=C.times(L.plus(S(A,L,E,1))),I(L.c).slice(0,B)===(M=I(N.c)).slice(0,B)){if(N.e<R)--B;if(M=M.slice(B-3,B+1),M=="9999"||!v&&M=="4999"){if(!v){if(v0(L,L.e+o+2,0),L.times(L).eq(A)){N=L;break}}E+=4,B+=4,v=1}else{if(!+M||!+M.slice(1)&&M.charAt(0)=="5")v0(N,N.e+o+2,1),U=!N.times(N).eq(A);break}}}return v0(N,N.e+o+1,t,U)},_.toExponential=function(U,M){if(U!=null)O(U,0,G),U++;return K8(this,U,M,1)},_.toFixed=function(U,M){if(U!=null)O(U,0,G),U=U+this.e+1;return K8(this,U,M)},_.toFormat=function(U,M,N){var v,L=this;if(N==null)if(U!=null&&M&&typeof M=="object")N=M,M=null;else if(U&&typeof U=="object")N=U,U=M=null;else N=H4;else if(typeof N!="object")throw Error(J+"Argument not an object: "+N);if(v=L.toFixed(U,M),L.c){var A,j=v.split("."),B=+N.groupSize,R=+N.secondaryGroupSize,E=N.groupSeparator||"",C=j[0],k=j[1],c=L.s<0,p=c?C.slice(1):C,Q0=p.length;if(R)A=B,B=R,R=A,Q0-=A;if(B>0&&Q0>0){A=Q0%B||B,C=p.substr(0,A);for(;A<Q0;A+=B)C+=E+p.substr(A,B);if(R>0)C+=E+p.slice(A);if(c)C="-"+C}v=k?C+(N.decimalSeparator||"")+((R=+N.fractionGroupSize)?k.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):k):C}return(N.prefix||"")+v+(N.suffix||"")},_.toFraction=function(U){var M,N,v,L,A,j,B,R,E,C,k,c,p=this,Q0=p.c;if(U!=null){if(B=new g(U),!B.isInteger()&&(B.c||B.s!==1)||B.lt(n))throw Error(J+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+n0(B))}if(!Q0)return new g(p);M=new g(n),E=N=new g(n),v=R=new g(n),c=I(Q0),A=M.e=c.length-p.e-1,M.c[0]=F[(j=A%H)<0?H+j:j],U=!U||B.comparedTo(M)>0?A>0?M:E:B,j=q0,q0=1/0,B=new g(c),R.c[0]=0;for(;;){if(C=S(B,M,0,1),L=N.plus(C.times(v)),L.comparedTo(U)==1)break;N=v,v=L,E=R.plus(C.times(L=E)),R=L,M=B.minus(C.times(L=M)),B=L}return L=S(U.minus(N),v,0,1),R=R.plus(L.times(E)),N=N.plus(L.times(v)),R.s=E.s=p.s,A=A*2,k=S(E,v,A,t).minus(p).abs().comparedTo(S(R,N,A,t).minus(p).abs())<1?[E,v]:[R,N],q0=j,k},_.toNumber=function(){return+n0(this)},_.toPrecision=function(U,M){if(U!=null)O(U,1,G);return K8(this,U,M,2)},_.toString=function(U){var M,N=this,v=N.s,L=N.e;if(L===null)if(v){if(M="Infinity",v<0)M="-"+M}else M="NaN";else{if(U==null)M=L<=J0||L>=$0?x(I(N.c),L):m(I(N.c),L,"0");else if(U===10&&X8)N=v0(new g(N),o+L+1,t),M=m(I(N.c),N.e,"0");else O(U,2,w4.length,"Base"),M=d(m(I(N.c),L,"0"),10,U,v,!0);if(v<0&&N.c[0])M="-"+M}return M},_.valueOf=_.toJSON=function(){return n0(this)},_._isBigNumber=!0,f!=null)g.set(f);return g}function T(f){var S=f|0;return f>0||f===S?S:S-1}function I(f){var S,d,h=1,_=f.length,n=f[0]+"";for(;h<_;){S=f[h++]+"",d=H-S.length;for(;d--;S="0"+S);n+=S}for(_=n.length;n.charCodeAt(--_)===48;);return n.slice(0,_+1||1)}function P(f,S){var d,h,_=f.c,n=S.c,o=f.s,t=S.s,J0=f.e,$0=S.e;if(!o||!t)return null;if(d=_&&!_[0],h=n&&!n[0],d||h)return d?h?0:-t:o;if(o!=t)return o;if(d=o<0,h=J0==$0,!_||!n)return h?0:!_^d?1:-1;if(!h)return J0>$0^d?1:-1;t=(J0=_.length)<($0=n.length)?J0:$0;for(o=0;o<t;o++)if(_[o]!=n[o])return _[o]>n[o]^d?1:-1;return J0==$0?0:J0>$0^d?1:-1}function O(f,S,d,h){if(f<S||f>d||f!==W(f))throw Error(J+(h||"Argument")+(typeof f=="number"?f<S||f>d?" out of range: ":" not an integer: ":" not a primitive number: ")+String(f))}function y(f){var S=f.c.length-1;return T(f.e/H)==S&&f.c[S]%2!=0}function x(f,S){return(f.length>1?f.charAt(0)+"."+f.slice(1):f)+(S<0?"e":"e+")+S}function m(f,S,d){var h,_;if(S<0){for(_=d+".";++S;_+=d);f=_+f}else if(h=f.length,++S>h){for(_=d,S-=h;--S;_+=d);f+=_}else if(S<h)f=f.slice(0,S)+"."+f.slice(S);return f}if($=D(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof z1<"u"&&z1.exports)z1.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(F$)});var M$=b((qD,D$)=>{var G$=T8(),U$=qD;(function(){function Z(w){return w<10?"0"+w:w}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,W,J={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},K;function q(w){return Q.lastIndex=0,Q.test(w)?'"'+w.replace(Q,function(F){var z=J[F];return typeof z==="string"?z:"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+w+'"'}function H(w,F){var z,G,D,T,I=Y,P,O=F[w],y=O!=null&&(O instanceof G$||G$.isBigNumber(O));if(O&&typeof O==="object"&&typeof O.toJSON==="function")O=O.toJSON(w);if(typeof K==="function")O=K.call(F,w,O);switch(typeof O){case"string":if(y)return O;else return q(O);case"number":return isFinite(O)?String(O):"null";case"boolean":case"null":case"bigint":return String(O);case"object":if(!O)return"null";if(Y+=W,P=[],Object.prototype.toString.apply(O)==="[object Array]"){T=O.length;for(z=0;z<T;z+=1)P[z]=H(z,O)||"null";return D=P.length===0?"[]":Y?`[
7
+ `}yield Q}static#V;static#J;static async#X(){return this.#V||=(await import("./chunk-28egv700.js").then((m)=>I8(m.default))).HttpsProxyAgent,this.#V}static async#K(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((W,J)=>{J==="set-cookie"?Z.append(J,W):Z.set(J,W)});return Z}}T4.Gaxios=N8;N4=N8});var G0=b((I0)=>{var Q7=I0&&I0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var W=Object.getOwnPropertyDescriptor($,Q);if(!W||("get"in W?!$.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,W)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),Y7=I0&&I0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))Q7($,Z,Q)};Object.defineProperty(I0,"__esModule",{value:!0});I0.instance=I0.Gaxios=I0.GaxiosError=void 0;I0.request=V7;var z$=w$();Object.defineProperty(I0,"Gaxios",{enumerable:!0,get:function(){return z$.Gaxios}});var W7=D8();Object.defineProperty(I0,"GaxiosError",{enumerable:!0,get:function(){return W7.GaxiosError}});Y7(M8(),I0);I0.instance=new z$.Gaxios;async function V7(Z){return I0.instance.request(Z)}});var T8=b((F$,z1)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,W=Math.floor,J="[BigNumber Error] ",K=J+"Number primitive has more than 15 significant digits: ",q=100000000000000,H=14,w=9007199254740991,F=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],z=1e7,G=1e9;function D(f){var S,d,h,_=g.prototype={constructor:g,toString:null,valueOf:null},n=new g(1),o=20,t=4,J0=-7,$0=21,V0=-1e7,q0=1e7,L0=!1,R0=1,H0=0,H4={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},w4="0123456789abcdefghijklmnopqrstuvwxyz",X8=!0;function g(U,M){var N,v,L,A,j,B,R,E,C=this;if(!(C instanceof g))return new g(U,M);if(M==null){if(U&&U._isBigNumber===!0){if(C.s=U.s,!U.c||U.e>q0)C.c=C.e=null;else if(U.e<V0)C.c=[C.e=0];else C.e=U.e,C.c=U.c.slice();return}if((B=typeof U=="number")&&U*0==0){if(C.s=1/U<0?(U=-U,-1):1,U===~~U){for(A=0,j=U;j>=10;j/=10,A++);if(A>q0)C.c=C.e=null;else C.e=A,C.c=[U];return}E=String(U)}else{if(!Q.test(E=String(U)))return h(C,E,B);C.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}if((A=E.indexOf("."))>-1)E=E.replace(".","");if((j=E.search(/e/i))>0){if(A<0)A=j;A+=+E.slice(j+1),E=E.substring(0,j)}else if(A<0)A=E.length}else{if(O(M,2,w4.length,"Base"),M==10&&X8)return C=new g(U),v0(C,o+C.e+1,t);if(E=String(U),B=typeof U=="number"){if(U*0!=0)return h(C,E,B,M);if(C.s=1/U<0?(E=E.slice(1),-1):1,g.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(K+U)}else C.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;N=w4.slice(0,M),A=j=0;for(R=E.length;j<R;j++)if(N.indexOf(v=E.charAt(j))<0){if(v=="."){if(j>A){A=R;continue}}else if(!L){if(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase())){L=!0,j=-1,A=0;continue}}return h(C,String(U),B,M)}if(B=!1,E=d(E,M,10,C.s),(A=E.indexOf("."))>-1)E=E.replace(".","");else A=E.length}for(j=0;E.charCodeAt(j)===48;j++);for(R=E.length;E.charCodeAt(--R)===48;);if(E=E.slice(j,++R)){if(R-=j,B&&g.DEBUG&&R>15&&(U>w||U!==W(U)))throw Error(K+C.s*U);if((A=A-j-1)>q0)C.c=C.e=null;else if(A<V0)C.c=[C.e=0];else{if(C.e=A,C.c=[],j=(A+1)%H,A<0)j+=H;if(j<R){if(j)C.c.push(+E.slice(0,j));for(R-=H;j<R;)C.c.push(+E.slice(j,j+=H));j=H-(E=E.slice(j)).length}else j-=R;for(;j--;E+="0");C.c.push(+E)}}else C.c=[C.e=0]}g.clone=D,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(U){var M,N;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(M="DECIMAL_PLACES"))N=U[M],O(N,0,G,M),o=N;if(U.hasOwnProperty(M="ROUNDING_MODE"))N=U[M],O(N,0,8,M),t=N;if(U.hasOwnProperty(M="EXPONENTIAL_AT"))if(N=U[M],N&&N.pop)O(N[0],-G,0,M),O(N[1],0,G,M),J0=N[0],$0=N[1];else O(N,-G,G,M),J0=-($0=N<0?-N:N);if(U.hasOwnProperty(M="RANGE"))if(N=U[M],N&&N.pop)O(N[0],-G,-1,M),O(N[1],1,G,M),V0=N[0],q0=N[1];else if(O(N,-G,G,M),N)V0=-(q0=N<0?-N:N);else throw Error(J+M+" cannot be zero: "+N);if(U.hasOwnProperty(M="CRYPTO"))if(N=U[M],N===!!N)if(N)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))L0=N;else throw L0=!N,Error(J+"crypto unavailable");else L0=N;else throw Error(J+M+" not true or false: "+N);if(U.hasOwnProperty(M="MODULO_MODE"))N=U[M],O(N,0,9,M),R0=N;if(U.hasOwnProperty(M="POW_PRECISION"))N=U[M],O(N,0,G,M),H0=N;if(U.hasOwnProperty(M="FORMAT"))if(N=U[M],typeof N=="object")H4=N;else throw Error(J+M+" not an object: "+N);if(U.hasOwnProperty(M="ALPHABET"))if(N=U[M],typeof N=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(N))X8=N.slice(0,10)=="0123456789",w4=N;else throw Error(J+M+" invalid: "+N)}else throw Error(J+"Object expected: "+U);return{DECIMAL_PLACES:o,ROUNDING_MODE:t,EXPONENTIAL_AT:[J0,$0],RANGE:[V0,q0],CRYPTO:L0,MODULO_MODE:R0,POW_PRECISION:H0,FORMAT:H4,ALPHABET:w4}},g.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var M,N,v=U.c,L=U.e,A=U.s;Z:if({}.toString.call(v)=="[object Array]"){if((A===1||A===-1)&&L>=-G&&L<=G&&L===W(L)){if(v[0]===0){if(L===0&&v.length===1)return!0;break Z}if(M=(L+1)%H,M<1)M+=H;if(String(v[0]).length==M){for(M=0;M<v.length;M++)if(N=v[M],N<0||N>=q||N!==W(N))break Z;if(N!==0)return!0}}}else if(v===null&&L===null&&(A===null||A===1||A===-1))return!0;throw Error(J+"Invalid BigNumber: "+U)},g.maximum=g.max=function(){return xZ(arguments,-1)},g.minimum=g.min=function(){return xZ(arguments,1)},g.random=function(){var U=9007199254740992,M=Math.random()*U&2097151?function(){return W(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var v,L,A,j,B,R=0,E=[],C=new g(n);if(N==null)N=o;else O(N,0,G);if(j=Y(N/H),L0)if(crypto.getRandomValues){v=crypto.getRandomValues(new Uint32Array(j*=2));for(;R<j;)if(B=v[R]*131072+(v[R+1]>>>11),B>=9000000000000000)L=crypto.getRandomValues(new Uint32Array(2)),v[R]=L[0],v[R+1]=L[1];else E.push(B%100000000000000),R+=2;R=j/2}else if(crypto.randomBytes){v=crypto.randomBytes(j*=7);for(;R<j;)if(B=(v[R]&31)*281474976710656+v[R+1]*1099511627776+v[R+2]*4294967296+v[R+3]*16777216+(v[R+4]<<16)+(v[R+5]<<8)+v[R+6],B>=9000000000000000)crypto.randomBytes(7).copy(v,R);else E.push(B%100000000000000),R+=7;R=j/7}else throw L0=!1,Error(J+"crypto unavailable");if(!L0){for(;R<j;)if(B=M(),B<9000000000000000)E[R++]=B%100000000000000}if(j=E[--R],N%=H,j&&N)B=F[H-N],E[R]=W(j/B)*B;for(;E[R]===0;E.pop(),R--);if(R<0)E=[A=0];else{for(A=-1;E[0]===0;E.splice(0,1),A-=H);for(R=1,B=E[0];B>=10;B/=10,R++);if(R<H)A-=H-R}return C.e=A,C.c=E,C}}(),g.sum=function(){var U=1,M=arguments,N=new g(M[0]);for(;U<M.length;)N=N.plus(M[U++]);return N},d=function(){var U="0123456789";function M(N,v,L,A){var j,B=[0],R,E=0,C=N.length;for(;E<C;){for(R=B.length;R--;B[R]*=v);B[0]+=A.indexOf(N.charAt(E++));for(j=0;j<B.length;j++)if(B[j]>L-1){if(B[j+1]==null)B[j+1]=0;B[j+1]+=B[j]/L|0,B[j]%=L}}return B.reverse()}return function(N,v,L,A,j){var B,R,E,C,k,c,p,Q0,X0=N.indexOf("."),z0=o,e=t;if(X0>=0)C=H0,H0=0,N=N.replace(".",""),Q0=new g(v),c=Q0.pow(N.length-X0),H0=C,Q0.c=M(m(I(c.c),c.e,"0"),10,L,U),Q0.e=Q0.c.length;p=M(N,v,L,j?(B=w4,U):(B=U,w4)),E=C=p.length;for(;p[--C]==0;p.pop());if(!p[0])return B.charAt(0);if(X0<0)--E;else c.c=p,c.e=E,c.s=A,c=S(c,Q0,z0,e,L),p=c.c,k=c.r,E=c.e;if(R=E+z0+1,X0=p[R],C=L/2,k=k||R<0||p[R+1]!=null,k=e<4?(X0!=null||k)&&(e==0||e==(c.s<0?3:2)):X0>C||X0==C&&(e==4||k||e==6&&p[R-1]&1||e==(c.s<0?8:7)),R<1||!p[0])N=k?m(B.charAt(1),-z0,B.charAt(0)):B.charAt(0);else{if(p.length=R,k){for(--L;++p[--R]>L;)if(p[R]=0,!R)++E,p=[1].concat(p)}for(C=p.length;!p[--C];);for(X0=0,N="";X0<=C;N+=B.charAt(p[X0++]));N=m(N,E,B.charAt(0))}return N}}(),S=function(){function U(v,L,A){var j,B,R,E,C=0,k=v.length,c=L%z,p=L/z|0;for(v=v.slice();k--;)R=v[k]%z,E=v[k]/z|0,j=p*R+E*c,B=c*R+j%z*z+C,C=(B/A|0)+(j/z|0)+p*E,v[k]=B%A;if(C)v=[C].concat(v);return v}function M(v,L,A,j){var B,R;if(A!=j)R=A>j?1:-1;else for(B=R=0;B<A;B++)if(v[B]!=L[B]){R=v[B]>L[B]?1:-1;break}return R}function N(v,L,A,j){var B=0;for(;A--;)v[A]-=B,B=v[A]<L[A]?1:0,v[A]=B*j+v[A]-L[A];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,L,A,j,B){var R,E,C,k,c,p,Q0,X0,z0,e,Y0,D0,q1,H8,w8,l0,u4,E0=v.s==L.s?1:-1,M0=v.c,K0=L.c;if(!M0||!M0[0]||!K0||!K0[0])return new g(!v.s||!L.s||(M0?K0&&M0[0]==K0[0]:!K0)?NaN:M0&&M0[0]==0||!K0?E0*0:E0/0);if(X0=new g(E0),z0=X0.c=[],E=v.e-L.e,E0=A+E+1,!B)B=q,E=T(v.e/H)-T(L.e/H),E0=E0/H|0;for(C=0;K0[C]==(M0[C]||0);C++);if(K0[C]>(M0[C]||0))E--;if(E0<0)z0.push(1),k=!0;else{if(H8=M0.length,l0=K0.length,C=0,E0+=2,c=W(B/(K0[0]+1)),c>1)K0=U(K0,c,B),M0=U(M0,c,B),l0=K0.length,H8=M0.length;q1=l0,e=M0.slice(0,l0),Y0=e.length;for(;Y0<l0;e[Y0++]=0);if(u4=K0.slice(),u4=[0].concat(u4),w8=K0[0],K0[1]>=B/2)w8++;do{if(c=0,R=M(K0,e,l0,Y0),R<0){if(D0=e[0],l0!=Y0)D0=D0*B+(e[1]||0);if(c=W(D0/w8),c>1){if(c>=B)c=B-1;p=U(K0,c,B),Q0=p.length,Y0=e.length;while(M(p,e,Q0,Y0)==1)c--,N(p,l0<Q0?u4:K0,Q0,B),Q0=p.length,R=1}else{if(c==0)R=c=1;p=K0.slice(),Q0=p.length}if(Q0<Y0)p=[0].concat(p);if(N(e,p,Y0,B),Y0=e.length,R==-1)while(M(K0,e,l0,Y0)<1)c++,N(e,l0<Y0?u4:K0,Y0,B),Y0=e.length}else if(R===0)c++,e=[0];if(z0[C++]=c,e[0])e[Y0++]=M0[q1]||0;else e=[M0[q1]],Y0=1}while((q1++<H8||e[0]!=null)&&E0--);if(k=e[0]!=null,!z0[0])z0.splice(0,1)}if(B==q){for(C=1,E0=z0[0];E0>=10;E0/=10,C++);v0(X0,A+(X0.e=C+E*H-1)+1,j,k)}else X0.e=E,X0.r=+k;return X0}}();function K8(U,M,N,v){var L,A,j,B,R;if(N==null)N=t;else O(N,0,8);if(!U.c)return U.toString();if(L=U.c[0],j=U.e,M==null)R=I(U.c),R=v==1||v==2&&(j<=J0||j>=$0)?x(R,j):m(R,j,"0");else if(U=v0(new g(U),M,N),A=U.e,R=I(U.c),B=R.length,v==1||v==2&&(M<=A||A<=J0)){for(;B<M;R+="0",B++);R=x(R,A)}else if(M-=j+(v===2&&A>j),R=m(R,A,"0"),A+1>B){if(--M>0)for(R+=".";M--;R+="0");}else if(M+=A-B,M>0){if(A+1==B)R+=".";for(;M--;R+="0");}return U.s<0&&L?"-"+R:R}function xZ(U,M){var N,v,L=1,A=new g(U[0]);for(;L<U.length;L++)if(v=new g(U[L]),!v.s||(N=P(A,v))===M||N===0&&A.s===M)A=v;return A}function q8(U,M,N){var v=1,L=M.length;for(;!M[--L];M.pop());for(L=M[0];L>=10;L/=10,v++);if((N=v+N*H-1)>q0)U.c=U.e=null;else if(N<V0)U.c=[U.e=0];else U.e=N,U.c=M;return U}h=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,N=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,L=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,j,B,R){var E,C=B?j:j.replace(L,"");if(v.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!B){if(C=C.replace(U,function(k,c,p){return E=(p=p.toLowerCase())=="x"?16:p=="b"?2:8,!R||R==E?c:k}),R)E=R,C=C.replace(M,"$1").replace(N,"0.$1");if(j!=C)return new g(C,E)}if(g.DEBUG)throw Error(J+"Not a"+(R?" base "+R:"")+" number: "+j);A.s=null}A.c=A.e=null}}();function v0(U,M,N,v){var L,A,j,B,R,E,C,k=U.c,c=F;if(k){Z:{for(L=1,B=k[0];B>=10;B/=10,L++);if(A=M-L,A<0)A+=H,j=M,R=k[E=0],C=W(R/c[L-j-1]%10);else if(E=Y((A+1)/H),E>=k.length)if(v){for(;k.length<=E;k.push(0));R=C=0,L=1,A%=H,j=A-H+1}else break Z;else{R=B=k[E];for(L=1;B>=10;B/=10,L++);A%=H,j=A-H+L,C=j<0?0:W(R/c[L-j-1]%10)}if(v=v||M<0||k[E+1]!=null||(j<0?R:R%c[L-j-1]),v=N<4?(C||v)&&(N==0||N==(U.s<0?3:2)):C>5||C==5&&(N==4||v||N==6&&(A>0?j>0?R/c[L-j]:0:k[E-1])%10&1||N==(U.s<0?8:7)),M<1||!k[0]){if(k.length=0,v)M-=U.e+1,k[0]=c[(H-M%H)%H],U.e=-M||0;else k[0]=U.e=0;return U}if(A==0)k.length=E,B=1,E--;else k.length=E+1,B=c[H-A],k[E]=j>0?W(R/c[L-j]%c[j])*B:0;if(v)for(;;)if(E==0){for(A=1,j=k[0];j>=10;j/=10,A++);j=k[0]+=B;for(B=1;j>=10;j/=10,B++);if(A!=B){if(U.e++,k[0]==q)k[0]=1}break}else{if(k[E]+=B,k[E]!=q)break;k[E--]=0,B=1}for(A=k.length;k[--A]===0;k.pop());}if(U.e>q0)U.c=U.e=null;else if(U.e<V0)U.c=[U.e=0]}return U}function n0(U){var M,N=U.e;if(N===null)return U.toString();return M=I(U.c),M=N<=J0||N>=$0?x(M,N):m(M,N,"0"),U.s<0?"-"+M:M}if(_.absoluteValue=_.abs=function(){var U=new g(this);if(U.s<0)U.s=1;return U},_.comparedTo=function(U,M){return P(this,new g(U,M))},_.decimalPlaces=_.dp=function(U,M){var N,v,L,A=this;if(U!=null){if(O(U,0,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U+A.e+1,M)}if(!(N=A.c))return null;if(v=((L=N.length-1)-T(this.e/H))*H,L=N[L])for(;L%10==0;L/=10,v--);if(v<0)v=0;return v},_.dividedBy=_.div=function(U,M){return S(this,new g(U,M),o,t)},_.dividedToIntegerBy=_.idiv=function(U,M){return S(this,new g(U,M),0,1)},_.exponentiatedBy=_.pow=function(U,M){var N,v,L,A,j,B,R,E,C,k=this;if(U=new g(U),U.c&&!U.isInteger())throw Error(J+"Exponent not an integer: "+n0(U));if(M!=null)M=new g(M);if(B=U.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!U.c||!U.c[0])return C=new g(Math.pow(+n0(k),B?U.s*(2-y(U)):+n0(U))),M?C.mod(M):C;if(R=U.s<0,M){if(M.c?!M.c[0]:!M.s)return new g(NaN);if(v=!R&&k.isInteger()&&M.isInteger(),v)k=k.mod(M)}else if(U.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||B&&k.c[1]>=240000000:k.c[0]<80000000000000||B&&k.c[0]<=99999750000000))){if(A=k.s<0&&y(U)?-0:0,k.e>-1)A=1/A;return new g(R?1/A:A)}else if(H0)A=Y(H0/H+2);if(B){if(N=new g(0.5),R)U.s=1;E=y(U)}else L=Math.abs(+n0(U)),E=L%2;C=new g(n);for(;;){if(E){if(C=C.times(k),!C.c)break;if(A){if(C.c.length>A)C.c.length=A}else if(v)C=C.mod(M)}if(L){if(L=W(L/2),L===0)break;E=L%2}else if(U=U.times(N),v0(U,U.e+1,1),U.e>14)E=y(U);else{if(L=+n0(U),L===0)break;E=L%2}if(k=k.times(k),A){if(k.c&&k.c.length>A)k.c.length=A}else if(v)k=k.mod(M)}if(v)return C;if(R)C=n.div(C);return M?C.mod(M):A?v0(C,H0,t,j):C},_.integerValue=function(U){var M=new g(this);if(U==null)U=t;else O(U,0,8);return v0(M,M.e+1,U)},_.isEqualTo=_.eq=function(U,M){return P(this,new g(U,M))===0},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(U,M){return P(this,new g(U,M))>0},_.isGreaterThanOrEqualTo=_.gte=function(U,M){return(M=P(this,new g(U,M)))===1||M===0},_.isInteger=function(){return!!this.c&&T(this.e/H)>this.c.length-2},_.isLessThan=_.lt=function(U,M){return P(this,new g(U,M))<0},_.isLessThanOrEqualTo=_.lte=function(U,M){return(M=P(this,new g(U,M)))===-1||M===0},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&this.c[0]==0},_.minus=function(U,M){var N,v,L,A,j=this,B=j.s;if(U=new g(U,M),M=U.s,!B||!M)return new g(NaN);if(B!=M)return U.s=-M,j.plus(U);var R=j.e/H,E=U.e/H,C=j.c,k=U.c;if(!R||!E){if(!C||!k)return C?(U.s=-M,U):new g(k?j:NaN);if(!C[0]||!k[0])return k[0]?(U.s=-M,U):new g(C[0]?j:t==3?-0:0)}if(R=T(R),E=T(E),C=C.slice(),B=R-E){if(A=B<0)B=-B,L=C;else E=R,L=k;L.reverse();for(M=B;M--;L.push(0));L.reverse()}else{v=(A=(B=C.length)<(M=k.length))?B:M;for(B=M=0;M<v;M++)if(C[M]!=k[M]){A=C[M]<k[M];break}}if(A)L=C,C=k,k=L,U.s=-U.s;if(M=(v=k.length)-(N=C.length),M>0)for(;M--;C[N++]=0);M=q-1;for(;v>B;){if(C[--v]<k[v]){for(N=v;N&&!C[--N];C[N]=M);--C[N],C[v]+=q}C[v]-=k[v]}for(;C[0]==0;C.splice(0,1),--E);if(!C[0])return U.s=t==3?-1:1,U.c=[U.e=0],U;return q8(U,C,E)},_.modulo=_.mod=function(U,M){var N,v,L=this;if(U=new g(U,M),!L.c||!U.s||U.c&&!U.c[0])return new g(NaN);else if(!U.c||L.c&&!L.c[0])return new g(L);if(R0==9)v=U.s,U.s=1,N=S(L,U,0,3),U.s=v,N.s*=v;else N=S(L,U,0,R0);if(U=L.minus(N.times(U)),!U.c[0]&&R0==1)U.s=L.s;return U},_.multipliedBy=_.times=function(U,M){var N,v,L,A,j,B,R,E,C,k,c,p,Q0,X0,z0,e=this,Y0=e.c,D0=(U=new g(U,M)).c;if(!Y0||!D0||!Y0[0]||!D0[0]){if(!e.s||!U.s||Y0&&!Y0[0]&&!D0||D0&&!D0[0]&&!Y0)U.c=U.e=U.s=null;else if(U.s*=e.s,!Y0||!D0)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(v=T(e.e/H)+T(U.e/H),U.s*=e.s,R=Y0.length,k=D0.length,R<k)Q0=Y0,Y0=D0,D0=Q0,L=R,R=k,k=L;for(L=R+k,Q0=[];L--;Q0.push(0));X0=q,z0=z;for(L=k;--L>=0;){N=0,c=D0[L]%z0,p=D0[L]/z0|0;for(j=R,A=L+j;A>L;)E=Y0[--j]%z0,C=Y0[j]/z0|0,B=p*E+C*c,E=c*E+B%z0*z0+Q0[A]+N,N=(E/X0|0)+(B/z0|0)+p*C,Q0[A--]=E%X0;Q0[A]=N}if(N)++v;else Q0.splice(0,1);return q8(U,Q0,v)},_.negated=function(){var U=new g(this);return U.s=-U.s||null,U},_.plus=function(U,M){var N,v=this,L=v.s;if(U=new g(U,M),M=U.s,!L||!M)return new g(NaN);if(L!=M)return U.s=-M,v.minus(U);var A=v.e/H,j=U.e/H,B=v.c,R=U.c;if(!A||!j){if(!B||!R)return new g(L/0);if(!B[0]||!R[0])return R[0]?U:new g(B[0]?v:L*0)}if(A=T(A),j=T(j),B=B.slice(),L=A-j){if(L>0)j=A,N=R;else L=-L,N=B;N.reverse();for(;L--;N.push(0));N.reverse()}if(L=B.length,M=R.length,L-M<0)N=R,R=B,B=N,M=L;for(L=0;M;)L=(B[--M]=B[M]+R[M]+L)/q|0,B[M]=q===B[M]?0:B[M]%q;if(L)B=[L].concat(B),++j;return q8(U,B,j)},_.precision=_.sd=function(U,M){var N,v,L,A=this;if(U!=null&&U!==!!U){if(O(U,1,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U,M)}if(!(N=A.c))return null;if(L=N.length-1,v=L*H+1,L=N[L]){for(;L%10==0;L/=10,v--);for(L=N[0];L>=10;L/=10,v++);}if(U&&A.e+1>v)v=A.e+1;return v},_.shiftedBy=function(U){return O(U,-w,w),this.times("1e"+U)},_.squareRoot=_.sqrt=function(){var U,M,N,v,L,A=this,j=A.c,B=A.s,R=A.e,E=o+4,C=new g("0.5");if(B!==1||!j||!j[0])return new g(!B||B<0&&(!j||j[0])?NaN:j?A:1/0);if(B=Math.sqrt(+n0(A)),B==0||B==1/0){if(M=I(j),(M.length+R)%2==0)M+="0";if(B=Math.sqrt(+M),R=T((R+1)/2)-(R<0||R%2),B==1/0)M="5e"+R;else M=B.toExponential(),M=M.slice(0,M.indexOf("e")+1)+R;N=new g(M)}else N=new g(B+"");if(N.c[0]){if(R=N.e,B=R+E,B<3)B=0;for(;;)if(L=N,N=C.times(L.plus(S(A,L,E,1))),I(L.c).slice(0,B)===(M=I(N.c)).slice(0,B)){if(N.e<R)--B;if(M=M.slice(B-3,B+1),M=="9999"||!v&&M=="4999"){if(!v){if(v0(L,L.e+o+2,0),L.times(L).eq(A)){N=L;break}}E+=4,B+=4,v=1}else{if(!+M||!+M.slice(1)&&M.charAt(0)=="5")v0(N,N.e+o+2,1),U=!N.times(N).eq(A);break}}}return v0(N,N.e+o+1,t,U)},_.toExponential=function(U,M){if(U!=null)O(U,0,G),U++;return K8(this,U,M,1)},_.toFixed=function(U,M){if(U!=null)O(U,0,G),U=U+this.e+1;return K8(this,U,M)},_.toFormat=function(U,M,N){var v,L=this;if(N==null)if(U!=null&&M&&typeof M=="object")N=M,M=null;else if(U&&typeof U=="object")N=U,U=M=null;else N=H4;else if(typeof N!="object")throw Error(J+"Argument not an object: "+N);if(v=L.toFixed(U,M),L.c){var A,j=v.split("."),B=+N.groupSize,R=+N.secondaryGroupSize,E=N.groupSeparator||"",C=j[0],k=j[1],c=L.s<0,p=c?C.slice(1):C,Q0=p.length;if(R)A=B,B=R,R=A,Q0-=A;if(B>0&&Q0>0){A=Q0%B||B,C=p.substr(0,A);for(;A<Q0;A+=B)C+=E+p.substr(A,B);if(R>0)C+=E+p.slice(A);if(c)C="-"+C}v=k?C+(N.decimalSeparator||"")+((R=+N.fractionGroupSize)?k.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):k):C}return(N.prefix||"")+v+(N.suffix||"")},_.toFraction=function(U){var M,N,v,L,A,j,B,R,E,C,k,c,p=this,Q0=p.c;if(U!=null){if(B=new g(U),!B.isInteger()&&(B.c||B.s!==1)||B.lt(n))throw Error(J+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+n0(B))}if(!Q0)return new g(p);M=new g(n),E=N=new g(n),v=R=new g(n),c=I(Q0),A=M.e=c.length-p.e-1,M.c[0]=F[(j=A%H)<0?H+j:j],U=!U||B.comparedTo(M)>0?A>0?M:E:B,j=q0,q0=1/0,B=new g(c),R.c[0]=0;for(;;){if(C=S(B,M,0,1),L=N.plus(C.times(v)),L.comparedTo(U)==1)break;N=v,v=L,E=R.plus(C.times(L=E)),R=L,M=B.minus(C.times(L=M)),B=L}return L=S(U.minus(N),v,0,1),R=R.plus(L.times(E)),N=N.plus(L.times(v)),R.s=E.s=p.s,A=A*2,k=S(E,v,A,t).minus(p).abs().comparedTo(S(R,N,A,t).minus(p).abs())<1?[E,v]:[R,N],q0=j,k},_.toNumber=function(){return+n0(this)},_.toPrecision=function(U,M){if(U!=null)O(U,1,G);return K8(this,U,M,2)},_.toString=function(U){var M,N=this,v=N.s,L=N.e;if(L===null)if(v){if(M="Infinity",v<0)M="-"+M}else M="NaN";else{if(U==null)M=L<=J0||L>=$0?x(I(N.c),L):m(I(N.c),L,"0");else if(U===10&&X8)N=v0(new g(N),o+L+1,t),M=m(I(N.c),N.e,"0");else O(U,2,w4.length,"Base"),M=d(m(I(N.c),L,"0"),10,U,v,!0);if(v<0&&N.c[0])M="-"+M}return M},_.valueOf=_.toJSON=function(){return n0(this)},_._isBigNumber=!0,f!=null)g.set(f);return g}function T(f){var S=f|0;return f>0||f===S?S:S-1}function I(f){var S,d,h=1,_=f.length,n=f[0]+"";for(;h<_;){S=f[h++]+"",d=H-S.length;for(;d--;S="0"+S);n+=S}for(_=n.length;n.charCodeAt(--_)===48;);return n.slice(0,_+1||1)}function P(f,S){var d,h,_=f.c,n=S.c,o=f.s,t=S.s,J0=f.e,$0=S.e;if(!o||!t)return null;if(d=_&&!_[0],h=n&&!n[0],d||h)return d?h?0:-t:o;if(o!=t)return o;if(d=o<0,h=J0==$0,!_||!n)return h?0:!_^d?1:-1;if(!h)return J0>$0^d?1:-1;t=(J0=_.length)<($0=n.length)?J0:$0;for(o=0;o<t;o++)if(_[o]!=n[o])return _[o]>n[o]^d?1:-1;return J0==$0?0:J0>$0^d?1:-1}function O(f,S,d,h){if(f<S||f>d||f!==W(f))throw Error(J+(h||"Argument")+(typeof f=="number"?f<S||f>d?" out of range: ":" not an integer: ":" not a primitive number: ")+String(f))}function y(f){var S=f.c.length-1;return T(f.e/H)==S&&f.c[S]%2!=0}function x(f,S){return(f.length>1?f.charAt(0)+"."+f.slice(1):f)+(S<0?"e":"e+")+S}function m(f,S,d){var h,_;if(S<0){for(_=d+".";++S;_+=d);f=_+f}else if(h=f.length,++S>h){for(_=d,S-=h;--S;_+=d);f+=_}else if(S<h)f=f.slice(0,S)+"."+f.slice(S);return f}if($=D(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof z1<"u"&&z1.exports)z1.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(F$)});var M$=b((qD,D$)=>{var G$=T8(),U$=qD;(function(){function Z(w){return w<10?"0"+w:w}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,W,J={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},K;function q(w){return Q.lastIndex=0,Q.test(w)?'"'+w.replace(Q,function(F){var z=J[F];return typeof z==="string"?z:"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+w+'"'}function H(w,F){var z,G,D,T,I=Y,P,O=F[w],y=O!=null&&(O instanceof G$||G$.isBigNumber(O));if(O&&typeof O==="object"&&typeof O.toJSON==="function")O=O.toJSON(w);if(typeof K==="function")O=K.call(F,w,O);switch(typeof O){case"string":if(y)return O;else return q(O);case"number":return isFinite(O)?String(O):"null";case"boolean":case"null":case"bigint":return String(O);case"object":if(!O)return"null";if(Y+=W,P=[],Object.prototype.toString.apply(O)==="[object Array]"){T=O.length;for(z=0;z<T;z+=1)P[z]=H(z,O)||"null";return D=P.length===0?"[]":Y?`[
8
8
  `+Y+P.join(`,
9
9
  `+Y)+`
10
10
  `+I+"]":"["+P.join(",")+"]",Y=I,D}if(K&&typeof K==="object"){T=K.length;for(z=0;z<T;z+=1)if(typeof K[z]==="string"){if(G=K[z],D=H(G,O),D)P.push(q(G)+(Y?": ":":")+D)}}else Object.keys(O).forEach(function(x){var m=H(x,O);if(m)P.push(q(x)+(Y?": ":":")+m)});return D=P.length===0?"{}":Y?`{
@@ -41,4 +41,4 @@ ${z}`)}return K},b0=DU(DJ);class OZ extends V8{create(Z,$){var Q;let{api_version
41
41
  `,"\r"]);K1.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function IU(Z,$){let W=$!==null&&$!==void 0?$:0,J=Z.indexOf(10,W),K=Z.indexOf(13,W);if(J===-1&&K===-1)return null;let q;if(J!==-1&&K!==-1)q=Math.min(J,K);else q=J!==-1?J:K;if(Z[q]===10)return{preceding:q,index:q+1,carriage:!1};return{preceding:q,index:q+1,carriage:!0}}var t1={off:0,error:200,warn:300,info:400,debug:500},WV=(Z,$,Q)=>{if(!Z)return;if(ZU(t1,Z))return Z;N0(Q).warn(`${$} was set to ${JSON.stringify(Z)}, expected one of ${JSON.stringify(Object.keys(t1))}`);return};function V1(){}function c1(Z,$,Q){if(!$||t1[Z]>t1[Q])return V1;else return $[Z].bind($)}var NU={error:V1,warn:V1,info:V1,debug:V1},VV=new WeakMap;function N0(Z){var $;let Q=Z.logger,Y=($=Z.logLevel)!==null&&$!==void 0?$:"off";if(!Q)return NU;let W=VV.get(Q);if(W&&W[0]===Y)return W[1];let J={error:c1("error",Q,Y),warn:c1("warn",Q,Y),info:c1("info",Q,Y),debug:c1("debug",Q,Y)};return VV.set(Q,[Y,J]),J}var M4=(Z)=>{if(Z.options)Z.options=Object.assign({},Z.options),delete Z.options.headers;if(Z.headers)Z.headers=Object.fromEntries((Z.headers instanceof Headers?[...Z.headers]:Object.entries(Z.headers)).map(([$,Q])=>[$,$.toLowerCase()==="x-goog-api-key"||$.toLowerCase()==="authorization"||$.toLowerCase()==="cookie"||$.toLowerCase()==="set-cookie"?"***":Q]));if("retryOfRequestLogID"in Z){if(Z.retryOfRequestLogID)Z.retryOf=Z.retryOfRequestLogID;delete Z.retryOfRequestLogID}return Z};class k4{constructor(Z,$,Q){this.iterator=Z,this.controller=$,this.client=Q}static fromSSEResponse(Z,$,Q){let Y=!1,W=Q?N0(Q):console;function J(){return m0(this,arguments,function*(){var q,H,w,F;if(Y)throw new C0("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let z=!1;try{try{for(var G=!0,D=u0(TU(Z,$)),T;T=yield r(D.next()),q=T.done,!q;G=!0){F=T.value,G=!1;let I=F;if(z)continue;if(I.data.startsWith("[DONE]")){z=!0;continue}else try{yield yield r(JSON.parse(I.data))}catch(P){throw W.error("Could not parse message into JSON:",I.data),W.error("From chunk:",I.raw),P}}}catch(I){H={error:I}}finally{try{if(!G&&!q&&(w=D.return))yield r(w.call(D))}finally{if(H)throw H.error}}z=!0}catch(I){if(XZ(I))return yield r(void 0);throw I}finally{if(!z)$.abort()}})}return new k4(J,$,Q)}static fromReadableStream(Z,$,Q){let Y=!1;function W(){return m0(this,arguments,function*(){var q,H,w,F;let z=new K1,G=FJ(Z);try{for(var D=!0,T=u0(G),I;I=yield r(T.next()),q=I.done,!q;D=!0){F=I.value,D=!1;let P=F;for(let O of z.decode(P))yield yield r(O)}}catch(P){H={error:P}}finally{try{if(!D&&!q&&(w=T.return))yield r(w.call(T))}finally{if(H)throw H.error}}for(let P of z.flush())yield yield r(P)})}function J(){return m0(this,arguments,function*(){var q,H,w,F;if(Y)throw new C0("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let z=!1;try{try{for(var G=!0,D=u0(W()),T;T=yield r(D.next()),q=T.done,!q;G=!0){F=T.value,G=!1;let I=F;if(z)continue;if(I)yield yield r(JSON.parse(I))}}catch(I){H={error:I}}finally{try{if(!G&&!q&&(w=D.return))yield r(w.call(D))}finally{if(H)throw H.error}}z=!0}catch(I){if(XZ(I))return yield r(void 0);throw I}finally{if(!z)$.abort()}})}return new k4(J,$,Q)}[Symbol.asyncIterator](){return this.iterator()}tee(){let Z=[],$=[],Q=this.iterator(),Y=(W)=>{return{next:()=>{if(W.length===0){let J=Q.next();Z.push(J),$.push(J)}return W.shift()}}};return[new k4(()=>Y(Z),this.controller,this.client),new k4(()=>Y($),this.controller,this.client)]}toReadableStream(){let Z=this,$;return zJ({async start(){$=Z[Symbol.asyncIterator]()},async pull(Q){try{let{value:Y,done:W}=await $.next();if(W)return Q.close();let J=kZ(JSON.stringify(Y)+`
42
42
  `);Q.enqueue(J)}catch(Y){Q.error(Y)}},async cancel(){var Q;await((Q=$.return)===null||Q===void 0?void 0:Q.call($))}})}}function TU(Z,$){return m0(this,arguments,function*(){var Y,W,J,K;if(!Z.body){if($.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new C0("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new C0("Attempted to iterate over a response with no body")}let q=new MJ,H=new K1,w=FJ(Z.body);try{for(var F=!0,z=u0(BU(w)),G;G=yield r(z.next()),Y=G.done,!Y;F=!0){K=G.value,F=!1;let D=K;for(let T of H.decode(D)){let I=q.decode(T);if(I)yield yield r(I)}}}catch(D){W={error:D}}finally{try{if(!F&&!Y&&(J=z.return))yield r(J.call(z))}finally{if(W)throw W.error}}for(let D of H.flush()){let T=q.decode(D);if(T)yield yield r(T)}})}function BU(Z){return m0(this,arguments,function*(){var Q,Y,W,J;try{for(var K=!0,q=u0(Z),H;H=yield r(q.next()),Q=H.done,!Q;K=!0){J=H.value,K=!1;let w=J;if(w==null)continue;let F=w instanceof ArrayBuffer?new Uint8Array(w):typeof w==="string"?kZ(w):w;yield yield r(F)}}catch(w){Y={error:w}}finally{try{if(!K&&!Q&&(W=q.return))yield r(W.call(q))}finally{if(Y)throw Y.error}}})}class MJ{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(Z){if(Z.endsWith("\r"))Z=Z.substring(0,Z.length-1);if(!Z){if(!this.event&&!this.data.length)return null;let W={event:this.event,data:this.data.join(`
43
43
  `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],W}if(this.chunks.push(Z),Z.startsWith(":"))return null;let[$,Q,Y]=LU(Z,":");if(Y.startsWith(" "))Y=Y.substring(1);if($==="event")this.event=Y;else if($==="data")this.data.push(Y);return null}}function LU(Z,$){let Q=Z.indexOf($);if(Q!==-1)return[Z.substring(0,Q),$,Z.substring(Q+$.length)];return[Z,"",""]}async function RU(Z,$){let{response:Q,requestLogID:Y,retryOfRequestLogID:W,startTime:J}=$,K=await(async()=>{var q;if($.options.stream){if(N0(Z).debug("response",Q.status,Q.url,Q.headers,Q.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(Q,$.controller,Z);return k4.fromSSEResponse(Q,$.controller,Z)}if(Q.status===204)return null;if($.options.__binaryResponse)return Q;let H=Q.headers.get("content-type"),w=(q=H===null||H===void 0?void 0:H.split(";")[0])===null||q===void 0?void 0:q.trim();if((w===null||w===void 0?void 0:w.includes("application/json"))||(w===null||w===void 0?void 0:w.endsWith("+json"))){if(Q.headers.get("content-length")==="0")return;return await Q.json()}return await Q.text()})();return N0(Z).debug(`[${Y}] response parsed`,M4({retryOfRequestLogID:W,url:Q.url,status:Q.status,body:K,durationMs:Date.now()-J})),K}class yZ extends Promise{constructor(Z,$,Q=RU){super((Y)=>{Y(null)});this.responsePromise=$,this.parseResponse=Q,this.client=Z}_thenUnwrap(Z){return new yZ(this.client,this.responsePromise,async($,Q)=>Z(await this.parseResponse($,Q),Q))}asResponse(){return this.responsePromise.then((Z)=>Z.response)}async withResponse(){let[Z,$]=await Promise.all([this.parse(),this.asResponse()]);return{data:Z,response:$}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((Z)=>this.parseResponse(this.client,Z));return this.parsedPromise}then(Z,$){return this.parse().then(Z,$)}catch(Z){return this.parse().catch(Z)}finally(Z){return this.parse().finally(Z)}}var IJ=Symbol("brand.privateNullableHeaders");function*AU(Z){if(!Z)return;if(IJ in Z){let{values:Y,nulls:W}=Z;yield*Y.entries();for(let J of W)yield[J,null];return}let $=!1,Q;if(Z instanceof Headers)Q=Z.entries();else if(ZV(Z))Q=Z;else $=!0,Q=Object.entries(Z!==null&&Z!==void 0?Z:{});for(let Y of Q){let W=Y[0];if(typeof W!=="string")throw TypeError("expected header name to be a string");let J=ZV(Y[1])?Y[1]:[Y[1]],K=!1;for(let q of J){if(q===void 0)continue;if($&&!K)K=!0,yield[W,null];yield[W,q]}}}var Y1=(Z)=>{let $=new Headers,Q=new Set;for(let Y of Z){let W=new Set;for(let[J,K]of AU(Y)){let q=J.toLowerCase();if(!W.has(q))$.delete(J),W.add(q);if(K===null)$.delete(J),Q.add(q);else $.append(J,K),Q.delete(q)}}return{[IJ]:!0,values:$,nulls:Q}},d6=(Z)=>{var $,Q,Y,W,J;if(typeof globalThis.process<"u")return((Q=($=globalThis.process.env)===null||$===void 0?void 0:$[Z])===null||Q===void 0?void 0:Q.trim())||void 0;if(typeof globalThis.Deno<"u")return((J=(W=(Y=globalThis.Deno.env)===null||Y===void 0?void 0:Y.get)===null||W===void 0?void 0:W.call(Y,Z))===null||J===void 0?void 0:J.trim())||void 0;return},NJ;class J8{constructor(Z){var $,Q,Y,W,J,K,q,{baseURL:H=d6("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:w=($=d6("GEMINI_API_KEY"))!==null&&$!==void 0?$:null,apiVersion:F="v1beta"}=Z,z=V4(Z,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:w,apiVersion:F},z),{baseURL:H||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(Q=G.timeout)!==null&&Q!==void 0?Q:J8.DEFAULT_TIMEOUT,this.logger=(Y=G.logger)!==null&&Y!==void 0?Y:console;let D="warn";this.logLevel=D,this.logLevel=(J=(W=WV(G.logLevel,"ClientOptions.logLevel",this))!==null&&W!==void 0?W:WV(d6("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&J!==void 0?J:D,this.fetchOptions=G.fetchOptions,this.maxRetries=(K=G.maxRetries)!==null&&K!==void 0?K:2,this.fetch=(q=G.fetch)!==null&&q!==void 0?q:WU(),this.encoder=XU,this._options=G,this.apiKey=w,this.apiVersion=F,this.clientAdapter=G.clientAdapter}withOptions(Z){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),Z))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:Z,nulls:$}){if(Z.has("authorization")||Z.has("x-goog-api-key"))return;if(this.apiKey&&Z.get("x-goog-api-key"))return;if($.has("x-goog-api-key"))return;throw Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(Z){let $=Y1([Z.headers]);if($.values.has("authorization")||$.values.has("x-goog-api-key"))return;if(this.apiKey)return Y1([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter&&this.clientAdapter.isVertexAI())return Y1([await this.clientAdapter.getAuthHeaders()]);return}stringifyQuery(Z){return KU(Z)}getUserAgent(){return`${this.constructor.name}/JS ${qU}`}defaultIdempotencyKey(){return`stainless-node-retry-${rG()}`}makeStatusError(Z,$,Q,Y){return T0.generate(Z,$,Q,Y)}buildURL(Z,$,Q){let Y=!this.baseURLOverridden()&&Q||this.baseURL,W=oG(Z)?new URL(Z):new URL(Y+(Y.endsWith("/")&&Z.startsWith("/")?Z.slice(1):Z)),J=this.defaultQuery(),K=Object.fromEntries(W.searchParams);if(!$V(J)||!$V(K))$=Object.assign(Object.assign(Object.assign({},K),J),$);if(typeof $==="object"&&$&&!Array.isArray($))W.search=this.stringifyQuery($);return W.toString()}async prepareOptions(Z){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!Z.path.startsWith(`/${this.apiVersion}/projects/`)){let $=Z.path.slice(this.apiVersion.length+1);Z.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${$}`}}async prepareRequest(Z,{url:$,options:Q}){}get(Z,$){return this.methodRequest("get",Z,$)}post(Z,$){return this.methodRequest("post",Z,$)}patch(Z,$){return this.methodRequest("patch",Z,$)}put(Z,$){return this.methodRequest("put",Z,$)}delete(Z,$){return this.methodRequest("delete",Z,$)}methodRequest(Z,$,Q){return this.request(Promise.resolve(Q).then((Y)=>{return Object.assign({method:Z,path:$},Y)}))}request(Z,$=null){return new yZ(this,this.makeRequest(Z,$,void 0))}async makeRequest(Z,$,Q){var Y,W,J;let K=await Z,q=(Y=K.maxRetries)!==null&&Y!==void 0?Y:this.maxRetries;if($==null)$=q;await this.prepareOptions(K);let{req:H,url:w,timeout:F}=await this.buildRequest(K,{retryCount:q-$});await this.prepareRequest(H,{url:w,options:K});let z="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=Q===void 0?"":`, retryOf: ${Q}`,D=Date.now();if(N0(this).debug(`[${z}] sending request`,M4({retryOfRequestLogID:Q,method:K.method,url:w,options:K,headers:H.headers})),(W=K.signal)===null||W===void 0?void 0:W.aborted)throw new o1;let T=new AbortController,I=await this.fetchWithTimeout(w,H,F,T).catch(KZ),P=Date.now();if(I instanceof globalThis.Error){let y=`retrying, ${$} attempts remaining`;if((J=K.signal)===null||J===void 0?void 0:J.aborted)throw new o1;let x=XZ(I)||/timed? ?out/i.test(String(I)+("cause"in I?String(I.cause):""));if($)return N0(this).info(`[${z}] connection ${x?"timed out":"failed"} - ${y}`),N0(this).debug(`[${z}] connection ${x?"timed out":"failed"} (${y})`,M4({retryOfRequestLogID:Q,url:w,durationMs:P-D,message:I.message})),this.retryRequest(K,$,Q!==null&&Q!==void 0?Q:z);if(N0(this).info(`[${z}] connection ${x?"timed out":"failed"} - error; no more retries left`),N0(this).debug(`[${z}] connection ${x?"timed out":"failed"} (error; no more retries left)`,M4({retryOfRequestLogID:Q,url:w,durationMs:P-D,message:I.message})),x)throw new BZ;throw new X1({cause:I})}let O=`[${z}${G}] ${H.method} ${w} ${I.ok?"succeeded":"failed"} with status ${I.status} in ${P-D}ms`;if(!I.ok){let y=await this.shouldRetry(I);if($&&y){let h=`retrying, ${$} attempts remaining`;return await JU(I.body),N0(this).info(`${O} - ${h}`),N0(this).debug(`[${z}] response error (${h})`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,durationMs:P-D})),this.retryRequest(K,$,Q!==null&&Q!==void 0?Q:z,I.headers)}let x=y?"error; no more retries left":"error; not retryable";N0(this).info(`${O} - ${x}`);let m=await I.text().catch((h)=>KZ(h).message),f=QU(m),S=f?void 0:m;throw N0(this).debug(`[${z}] response error (${x})`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,message:S,durationMs:Date.now()-D})),this.makeStatusError(I.status,f,S,I.headers)}return N0(this).info(O),N0(this).debug(`[${z}] response start`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,durationMs:P-D})),{response:I,options:K,controller:T,requestLogID:z,retryOfRequestLogID:Q,startTime:D}}async fetchWithTimeout(Z,$,Q,Y){let W=$||{},{signal:J,method:K}=W,q=V4(W,["signal","method"]),H=this._makeAbort(Y);if(J)J.addEventListener("abort",H,{once:!0});let w=setTimeout(H,Q),F=globalThis.ReadableStream&&q.body instanceof globalThis.ReadableStream||typeof q.body==="object"&&q.body!==null&&Symbol.asyncIterator in q.body,z=Object.assign(Object.assign(Object.assign({signal:Y.signal},F?{duplex:"half"}:{}),{method:"GET"}),q);if(K)z.method=K.toUpperCase();try{return await this.fetch.call(void 0,Z,z)}finally{clearTimeout(w)}}async shouldRetry(Z){let $=Z.headers.get("x-should-retry");if($==="true")return!0;if($==="false")return!1;if(Z.status===408)return!0;if(Z.status===409)return!0;if(Z.status===429)return!0;if(Z.status>=500)return!0;return!1}async retryRequest(Z,$,Q,Y){var W;let J,K=Y===null||Y===void 0?void 0:Y.get("retry-after-ms");if(K){let H=parseFloat(K);if(!Number.isNaN(H))J=H}let q=Y===null||Y===void 0?void 0:Y.get("retry-after");if(q&&!J){let H=parseFloat(q);if(!Number.isNaN(H))J=H*1000;else J=Date.parse(q)-Date.now()}if(J===void 0){let H=(W=Z.maxRetries)!==null&&W!==void 0?W:this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis($,H)}return await YU(J),this.makeRequest(Z,$-1,Q)}calculateDefaultRetryTimeoutMillis(Z,$){let W=$-Z,J=Math.min(0.5*Math.pow(2,W),8),K=1-Math.random()*0.25;return J*K*1000}async buildRequest(Z,{retryCount:$=0}={}){var Q,Y,W;let J=Object.assign({},Z),{method:K,path:q,query:H,defaultBaseURL:w}=J,F=this.buildURL(q,H,w);if("timeout"in J)$U("timeout",J.timeout);J.timeout=(Q=J.timeout)!==null&&Q!==void 0?Q:this.timeout;let{bodyHeaders:z,body:G}=this.buildBody({options:J}),D=await this.buildHeaders({options:Z,method:K,bodyHeaders:z,retryCount:$});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:K,headers:D},J.signal&&{signal:J.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(Y=this.fetchOptions)!==null&&Y!==void 0?Y:{}),(W=J.fetchOptions)!==null&&W!==void 0?W:{}),url:F,timeout:J.timeout}}async buildHeaders({options:Z,method:$,bodyHeaders:Q,retryCount:Y}){let W={};if(this.idempotencyHeader&&$!=="get"){if(!Z.idempotencyKey)Z.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=Z.idempotencyKey}let J=await this.authHeaders(Z),K=Y1([W,{Accept:"application/json","User-Agent":this.getUserAgent()},this._options.defaultHeaders,Q,Z.headers,J]);return this.validateHeaders(K),K.values}_makeAbort(Z){return()=>Z.abort()}buildBody({options:{body:Z,headers:$}}){if(!Z)return{bodyHeaders:void 0,body:void 0};let Q=Y1([$]);if(ArrayBuffer.isView(Z)||Z instanceof ArrayBuffer||Z instanceof DataView||typeof Z==="string"&&Q.values.has("content-type")||globalThis.Blob&&Z instanceof globalThis.Blob||Z instanceof FormData||Z instanceof URLSearchParams||globalThis.ReadableStream&&Z instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:Z};else if(typeof Z==="object"&&((Symbol.asyncIterator in Z)||(Symbol.iterator in Z)&&("next"in Z)&&typeof Z.next==="function"))return{bodyHeaders:void 0,body:VU(Z)};else if(typeof Z==="object"&&Q.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(Z)};else return this.encoder({body:Z,headers:Q})}}J8.DEFAULT_TIMEOUT=60000;class w0 extends J8{constructor(){super(...arguments);this.interactions=new jZ(this),this.webhooks=new hZ(this)}}NJ=w0;w0.GeminiNextGenAPIClient=NJ;w0.GeminiNextGenAPIClientError=C0;w0.APIError=T0;w0.APIConnectionError=X1;w0.APIConnectionTimeoutError=BZ;w0.APIUserAbortError=o1;w0.NotFoundError=PZ;w0.ConflictError=SZ;w0.RateLimitError=vZ;w0.BadRequestError=LZ;w0.AuthenticationError=RZ;w0.InternalServerError=EZ;w0.PermissionDeniedError=AZ;w0.UnprocessableEntityError=CZ;w0.toFile=GU;w0.Interactions=jZ;w0.Webhooks=hZ;var JV="x-goog-api-key",W1="https://www.googleapis.com/auth/cloud-platform";class TJ{constructor(Z){if(Z.apiKey!==void 0){this.apiKey=Z.apiKey;return}let $=PU(Z.googleAuthOptions);this.googleAuth=new KV.GoogleAuth($)}async addAuthHeaders(Z,$){if(this.apiKey!==void 0){if(this.apiKey.startsWith("auth_tokens/"))throw Error("Ephemeral tokens are only supported by the live API.");this.addKeyHeader(Z);return}return this.addGoogleAuthHeaders(Z,$)}addKeyHeader(Z){if(Z.get(JV)!==null)return;if(this.apiKey===void 0)throw Error("Trying to set API key header but apiKey is not set");Z.append(JV,this.apiKey)}async addGoogleAuthHeaders(Z,$){if(this.googleAuth===void 0)throw Error("Trying to set google-auth headers but googleAuth is unset");let Q=await this.googleAuth.getRequestHeaders($);for(let[Y,W]of Q){if(Z.get(Y)!==null)continue;Z.append(Y,W)}}}function PU(Z){let $;if(!Z)return $={scopes:[W1]},$;else{if($=Z,!$.scopes)return $.scopes=[W1],$;else if(typeof $.scopes==="string"&&$.scopes!==W1||Array.isArray($.scopes)&&$.scopes.indexOf(W1)<0)throw Error(`Invalid auth scopes. Scopes must include: ${W1}`);return $}}class BJ{async download(Z,$){if(Z.downloadPath){let Q=await SU(Z,$);if(Q instanceof I4){let Y=Jw(Z.downloadPath);Kw.fromWeb(Q.responseInternal.body).pipe(Y),await qw(Y)}else try{await Xw(Z.downloadPath,Q,{encoding:"base64"})}catch(Y){throw Error(`Failed to write file to ${Z.downloadPath}: ${Y}`)}}}}async function SU(Z,$){var Q,Y,W;let J=NZ(Z.file);if(J!==void 0)return await $.request({path:`files/${J}:download`,httpMethod:"GET",queryParams:{alt:"media"},httpOptions:(Q=Z.config)===null||Q===void 0?void 0:Q.httpOptions,abortSignal:(Y=Z.config)===null||Y===void 0?void 0:Y.abortSignal});else if(_V(Z.file)){let K=(W=Z.file.video)===null||W===void 0?void 0:W.videoBytes;if(typeof K==="string")return K;else throw Error("Failed to download generated video, Uri or videoBytes not found.")}else if(hV(Z.file)){let K=Z.file.videoBytes;if(typeof K==="string")return K;else throw Error("Failed to download video, Uri or videoBytes not found.")}else throw Error("Unsupported file type")}class LJ{create(Z,$,Q){return new RJ(Z,$,Q)}}class RJ{constructor(Z,$,Q){this.url=Z,this.headers=$,this.callbacks=Q}connect(){this.ws=new qV.WebSocket(this.url,{headers:this.headers}),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(Z){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.send(Z)}close(){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.close()}}function CU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function vU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function EU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);return Q}function OU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);return Q}function jU(Z,$,Q){let Y={};if(V(Z,["validationDataset"])!==void 0)throw Error("validationDataset parameter is not supported in Gemini API.");let W=V(Z,["tunedModelDisplayName"]);if($!==void 0&&W!=null)X($,["displayName"],W);if(V(Z,["description"])!==void 0)throw Error("description parameter is not supported in Gemini API.");let J=V(Z,["epochCount"]);if($!==void 0&&J!=null)X($,["tuningTask","hyperparameters","epochCount"],J);let K=V(Z,["learningRateMultiplier"]);if(K!=null)X(Y,["tuningTask","hyperparameters","learningRateMultiplier"],K);if(V(Z,["exportLastCheckpointOnly"])!==void 0)throw Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(V(Z,["preTunedModelCheckpointId"])!==void 0)throw Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(V(Z,["adapterSize"])!==void 0)throw Error("adapterSize parameter is not supported in Gemini API.");if(V(Z,["tuningMode"])!==void 0)throw Error("tuningMode parameter is not supported in Gemini API.");if(V(Z,["customBaseModel"])!==void 0)throw Error("customBaseModel parameter is not supported in Gemini API.");let q=V(Z,["batchSize"]);if($!==void 0&&q!=null)X($,["tuningTask","hyperparameters","batchSize"],q);let H=V(Z,["learningRate"]);if($!==void 0&&H!=null)X($,["tuningTask","hyperparameters","learningRate"],H);if(V(Z,["labels"])!==void 0)throw Error("labels parameter is not supported in Gemini API.");if(V(Z,["beta"])!==void 0)throw Error("beta parameter is not supported in Gemini API.");if(V(Z,["baseTeacherModel"])!==void 0)throw Error("baseTeacherModel parameter is not supported in Gemini API.");if(V(Z,["tunedTeacherModelSource"])!==void 0)throw Error("tunedTeacherModelSource parameter is not supported in Gemini API.");if(V(Z,["sftLossWeightMultiplier"])!==void 0)throw Error("sftLossWeightMultiplier parameter is not supported in Gemini API.");if(V(Z,["outputUri"])!==void 0)throw Error("outputUri parameter is not supported in Gemini API.");if(V(Z,["encryptionSpec"])!==void 0)throw Error("encryptionSpec parameter is not supported in Gemini API.");return Y}function _U(Z,$,Q){let Y={},W=V(Q,["config","method"]);if(W===void 0)W="SUPERVISED_FINE_TUNING";if(W==="SUPERVISED_FINE_TUNING"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec"],l6(S))}else if(W==="PREFERENCE_TUNING"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec"],l6(S))}else if(W==="DISTILLATION"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["distillationSpec"],l6(S))}let J=V(Z,["tunedModelDisplayName"]);if($!==void 0&&J!=null)X($,["tunedModelDisplayName"],J);let K=V(Z,["description"]);if($!==void 0&&K!=null)X($,["description"],K);let q=V(Q,["config","method"]);if(q===void 0)q="SUPERVISED_FINE_TUNING";if(q==="SUPERVISED_FINE_TUNING"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","epochCount"],S)}else if(q==="PREFERENCE_TUNING"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","epochCount"],S)}else if(q==="DISTILLATION"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","epochCount"],S)}let H=V(Q,["config","method"]);if(H===void 0)H="SUPERVISED_FINE_TUNING";if(H==="SUPERVISED_FINE_TUNING"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],S)}else if(H==="PREFERENCE_TUNING"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],S)}else if(H==="DISTILLATION"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","learningRateMultiplier"],S)}let w=V(Q,["config","method"]);if(w===void 0)w="SUPERVISED_FINE_TUNING";if(w==="SUPERVISED_FINE_TUNING"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","exportLastCheckpointOnly"],S)}else if(w==="PREFERENCE_TUNING"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","exportLastCheckpointOnly"],S)}else if(w==="DISTILLATION"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["distillationSpec","exportLastCheckpointOnly"],S)}let F=V(Q,["config","method"]);if(F===void 0)F="SUPERVISED_FINE_TUNING";if(F==="SUPERVISED_FINE_TUNING"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","adapterSize"],S)}else if(F==="PREFERENCE_TUNING"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","adapterSize"],S)}else if(F==="DISTILLATION"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","adapterSize"],S)}let z=V(Q,["config","method"]);if(z===void 0)z="SUPERVISED_FINE_TUNING";if(z==="SUPERVISED_FINE_TUNING"){let S=V(Z,["tuningMode"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","tuningMode"],S)}else if(z==="DISTILLATION"){let S=V(Z,["tuningMode"]);if($!==void 0&&S!=null)X($,["distillationSpec","tuningMode"],S)}let G=V(Z,["customBaseModel"]);if($!==void 0&&G!=null)X($,["customBaseModel"],G);let D=V(Q,["config","method"]);if(D===void 0)D="SUPERVISED_FINE_TUNING";if(D==="SUPERVISED_FINE_TUNING"){let S=V(Z,["batchSize"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","batchSize"],S)}else if(D==="DISTILLATION"){let S=V(Z,["batchSize"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","batchSize"],S)}let T=V(Q,["config","method"]);if(T===void 0)T="SUPERVISED_FINE_TUNING";if(T==="SUPERVISED_FINE_TUNING"){let S=V(Z,["learningRate"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","learningRate"],S)}else if(T==="DISTILLATION"){let S=V(Z,["learningRate"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","learningRate"],S)}let I=V(Z,["labels"]);if($!==void 0&&I!=null)X($,["labels"],I);let P=V(Z,["beta"]);if($!==void 0&&P!=null)X($,["preferenceOptimizationSpec","hyperParameters","beta"],P);let O=V(Z,["baseTeacherModel"]);if($!==void 0&&O!=null)X($,["distillationSpec","baseTeacherModel"],O);let y=V(Z,["tunedTeacherModelSource"]);if($!==void 0&&y!=null)X($,["distillationSpec","tunedTeacherModelSource"],y);let x=V(Z,["sftLossWeightMultiplier"]);if($!==void 0&&x!=null)X($,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],x);let m=V(Z,["outputUri"]);if($!==void 0&&m!=null)X($,["outputUri"],m);let f=V(Z,["encryptionSpec"]);if($!==void 0&&f!=null)X($,["encryptionSpec"],f);return Y}function hU(Z,$){let Q={},Y=V(Z,["baseModel"]);if(Y!=null)X(Q,["baseModel"],Y);let W=V(Z,["preTunedModel"]);if(W!=null)X(Q,["preTunedModel"],W);let J=V(Z,["trainingDataset"]);if(J!=null)uU(J);let K=V(Z,["config"]);if(K!=null)jU(K,Q);return Q}function kU(Z,$){let Q={},Y=V(Z,["baseModel"]);if(Y!=null)X(Q,["baseModel"],Y);let W=V(Z,["preTunedModel"]);if(W!=null)X(Q,["preTunedModel"],W);let J=V(Z,["trainingDataset"]);if(J!=null)dU(J,Q,$);let K=V(Z,["config"]);if(K!=null)_U(K,Q,$);return Q}function yU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function xU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function fU(Z,$,Q){let Y={},W=V(Z,["pageSize"]);if($!==void 0&&W!=null)X($,["_query","pageSize"],W);let J=V(Z,["pageToken"]);if($!==void 0&&J!=null)X($,["_query","pageToken"],J);let K=V(Z,["filter"]);if($!==void 0&&K!=null)X($,["_query","filter"],K);return Y}function gU(Z,$){let Q={},Y=V(Z,["config"]);if(Y!=null)fU(Y,Q);return Q}function bU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["nextPageToken"]);if(W!=null)X(Q,["nextPageToken"],W);let J=V(Z,["tuningJobs"]);if(J!=null){let K=J;if(Array.isArray(K))K=K.map((q)=>{return wZ(q)});X(Q,["tuningJobs"],K)}return Q}function mU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["model"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["endpoint"],W);return Q}function uU(Z,$){let Q={};if(V(Z,["gcsUri"])!==void 0)throw Error("gcsUri parameter is not supported in Gemini API.");if(V(Z,["vertexDatasetResource"])!==void 0)throw Error("vertexDatasetResource parameter is not supported in Gemini API.");let Y=V(Z,["examples"]);if(Y!=null){let W=Y;if(Array.isArray(W))W=W.map((J)=>{return J});X(Q,["examples","examples"],W)}return Q}function dU(Z,$,Q){let Y={},W=V(Q,["config","method"]);if(W===void 0)W="SUPERVISED_FINE_TUNING";if(W==="SUPERVISED_FINE_TUNING"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["supervisedTuningSpec","trainingDatasetUri"],K)}else if(W==="PREFERENCE_TUNING"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["preferenceOptimizationSpec","trainingDatasetUri"],K)}else if(W==="DISTILLATION"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["distillationSpec","promptDatasetUri"],K)}let J=V(Q,["config","method"]);if(J===void 0)J="SUPERVISED_FINE_TUNING";if(J==="SUPERVISED_FINE_TUNING"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["supervisedTuningSpec","trainingDatasetUri"],K)}else if(J==="PREFERENCE_TUNING"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["preferenceOptimizationSpec","trainingDatasetUri"],K)}else if(J==="DISTILLATION"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["distillationSpec","promptDatasetUri"],K)}if(V(Z,["examples"])!==void 0)throw Error("examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return Y}function lU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["state"]);if(J!=null)X(Q,["state"],jV(J));let K=V(Z,["createTime"]);if(K!=null)X(Q,["createTime"],K);let q=V(Z,["tuningTask","startTime"]);if(q!=null)X(Q,["startTime"],q);let H=V(Z,["tuningTask","completeTime"]);if(H!=null)X(Q,["endTime"],H);let w=V(Z,["updateTime"]);if(w!=null)X(Q,["updateTime"],w);let F=V(Z,["description"]);if(F!=null)X(Q,["description"],F);let z=V(Z,["baseModel"]);if(z!=null)X(Q,["baseModel"],z);let G=V(Z,["_self"]);if(G!=null)X(Q,["tunedModel"],mU(G));return Q}function wZ(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["state"]);if(J!=null)X(Q,["state"],jV(J));let K=V(Z,["createTime"]);if(K!=null)X(Q,["createTime"],K);let q=V(Z,["startTime"]);if(q!=null)X(Q,["startTime"],q);let H=V(Z,["endTime"]);if(H!=null)X(Q,["endTime"],H);let w=V(Z,["updateTime"]);if(w!=null)X(Q,["updateTime"],w);let F=V(Z,["error"]);if(F!=null)X(Q,["error"],F);let z=V(Z,["description"]);if(z!=null)X(Q,["description"],z);let G=V(Z,["baseModel"]);if(G!=null)X(Q,["baseModel"],G);let D=V(Z,["tunedModel"]);if(D!=null)X(Q,["tunedModel"],D);let T=V(Z,["preTunedModel"]);if(T!=null)X(Q,["preTunedModel"],T);let I=V(Z,["supervisedTuningSpec"]);if(I!=null)X(Q,["supervisedTuningSpec"],I);let P=V(Z,["preferenceOptimizationSpec"]);if(P!=null)X(Q,["preferenceOptimizationSpec"],P);let O=V(Z,["distillationSpec"]);if(O!=null)X(Q,["distillationSpec"],O);let y=V(Z,["tuningDataStats"]);if(y!=null)X(Q,["tuningDataStats"],y);let x=V(Z,["encryptionSpec"]);if(x!=null)X(Q,["encryptionSpec"],x);let m=V(Z,["partnerModelTuningSpec"]);if(m!=null)X(Q,["partnerModelTuningSpec"],m);let f=V(Z,["customBaseModel"]);if(f!=null)X(Q,["customBaseModel"],f);let S=V(Z,["evaluateDatasetRuns"]);if(S!=null){let R0=S;if(Array.isArray(R0))R0=R0.map((H0)=>{return H0});X(Q,["evaluateDatasetRuns"],R0)}let d=V(Z,["experiment"]);if(d!=null)X(Q,["experiment"],d);let h=V(Z,["fullFineTuningSpec"]);if(h!=null)X(Q,["fullFineTuningSpec"],h);let _=V(Z,["labels"]);if(_!=null)X(Q,["labels"],_);let n=V(Z,["outputUri"]);if(n!=null)X(Q,["outputUri"],n);let o=V(Z,["pipelineJob"]);if(o!=null)X(Q,["pipelineJob"],o);let t=V(Z,["serviceAccount"]);if(t!=null)X(Q,["serviceAccount"],t);let J0=V(Z,["tunedModelDisplayName"]);if(J0!=null)X(Q,["tunedModelDisplayName"],J0);let $0=V(Z,["tuningJobState"]);if($0!=null)X(Q,["tuningJobState"],$0);let V0=V(Z,["veoTuningSpec"]);if(V0!=null)X(Q,["veoTuningSpec"],V0);let q0=V(Z,["distillationSamplingSpec"]);if(q0!=null)X(Q,["distillationSamplingSpec"],q0);let L0=V(Z,["tuningJobMetadata"]);if(L0!=null)X(Q,["tuningJobMetadata"],L0);return Q}function cU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["metadata"]);if(J!=null)X(Q,["metadata"],J);let K=V(Z,["done"]);if(K!=null)X(Q,["done"],K);let q=V(Z,["error"]);if(q!=null)X(Q,["error"],q);return Q}function l6(Z,$){let Q={},Y=V(Z,["gcsUri"]);if(Y!=null)X(Q,["validationDatasetUri"],Y);let W=V(Z,["vertexDatasetResource"]);if(W!=null)X(Q,["validationDatasetUri"],W);return Q}class AJ extends a0{constructor(Z){super();this.apiClient=Z,this.list=async($={})=>{return new q4(e0.PAGED_ITEM_TUNING_JOBS,(Q)=>this.listInternal(Q),await this.listInternal($),$)},this.get=async($)=>{return await this.getInternal($)},this.tune=async($)=>{var Q;if(this.apiClient.isVertexAI())if($.baseModel.startsWith("projects/")){let Y={tunedModelName:$.baseModel};if((Q=$.config)===null||Q===void 0?void 0:Q.preTunedModelCheckpointId)Y.checkpointId=$.config.preTunedModelCheckpointId;let W=Object.assign(Object.assign({},$),{preTunedModel:Y});return W.baseModel=void 0,await this.tuneInternal(W)}else{let Y=Object.assign({},$);return await this.tuneInternal(Y)}else{let Y=Object.assign({},$),W=await this.tuneMldevInternal(Y),J="";if(W.metadata!==void 0&&W.metadata.tunedModel!==void 0)J=W.metadata.tunedModel;else if(W.name!==void 0&&W.name.includes("/operations/"))J=W.name.split("/operations/")[0];return{name:J,state:p6.JOB_STATE_QUEUED}}}}async getInternal(Z){var $,Q,Y,W;let J,K="",q={};if(this.apiClient.isVertexAI()){let H=xU(Z);return K=u("{name}",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"GET",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{return wZ(w)})}else{let H=yU(Z);return K=u("{name}",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"GET",httpOptions:(Y=Z.config)===null||Y===void 0?void 0:Y.httpOptions,abortSignal:(W=Z.config)===null||W===void 0?void 0:W.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{return lU(w)})}}async listInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI()){let K=gU(Z);return W=u("tuningJobs",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"GET",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{let H=bU(q),w=new DV;return Object.assign(w,H),w})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(Z){var $,Q,Y,W;let J,K="",q={};if(this.apiClient.isVertexAI()){let H=vU(Z);return K=u("{name}:cancel",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{let F=OU(w),z=new t6;return Object.assign(z,F),z})}else{let H=CU(Z);return K=u("{name}:cancel",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"POST",httpOptions:(Y=Z.config)===null||Y===void 0?void 0:Y.httpOptions,abortSignal:(W=Z.config)===null||W===void 0?void 0:W.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{let F=EU(w),z=new t6;return Object.assign(z,F),z})}}async tuneInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI()){let K=kU(Z,Z);return W=u("tuningJobs",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{return wZ(q)})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async tuneMldevInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let K=hU(Z);return W=u("tunedModels",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{return cU(q)})}}}var PJ=8388608,SJ=3,CJ=1000,vJ=2,J4="x-goog-upload-status";async function pU(Z,$,Q,Y){var W;let J=await EJ(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return K.file}async function iU(Z,$,Q,Y){var W;let J=await EJ(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let q=FZ(K),H=new $8;return Object.assign(H,q),H}async function EJ(Z,$,Q,Y){var W,J,K;let q=$,H=(Y===null||Y===void 0?void 0:Y.baseUrl)||((W=Q.clientOptions.httpOptions)===null||W===void 0?void 0:W.baseUrl);if(H){let D=new URL(H),T=new URL($);T.protocol=D.protocol,T.host=D.host,T.port=D.port,q=T.toString()}let w=0,F=0,z=new I4(new Response),G="upload";w=Z.size;while(F<w){let D=Math.min(PJ,w-F),T=Z.slice(F,F+D);if(F+D>=w)G+=", finalize";let I=0,P=CJ;while(I<SJ){let O=Object.assign(Object.assign({},(Y===null||Y===void 0?void 0:Y.headers)||{}),{"X-Goog-Upload-Command":G,"X-Goog-Upload-Offset":String(F),"Content-Length":String(D)});if(z=await Q.request({path:"",body:T,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},Y),{apiVersion:"",baseUrl:q,headers:O})}),(J=z===null||z===void 0?void 0:z.headers)===null||J===void 0?void 0:J[J4])break;I++,await OJ(P),P=P*vJ}if(F+=D,((K=z===null||z===void 0?void 0:z.headers)===null||K===void 0?void 0:K[J4])!=="active")break;if(w<=F)throw Error("All content has been uploaded, but the upload status is not finalized.")}return z}async function aU(Z){return{size:Z.size,type:Z.type}}function OJ(Z){return new Promise(($)=>setTimeout($,Z))}class jJ{async stat(Z){let $={size:0,type:void 0};if(typeof Z==="string"){let Q=await Z8.stat(Z);return $.size=Q.size,$.type=this.inferMimeType(Z),$}else return await aU(Z)}async upload(Z,$,Q,Y){if(typeof Z==="string")return await this.uploadFileFromPath(Z,$,Q,Y);else return pU(Z,$,Q,Y)}async uploadToFileSearchStore(Z,$,Q,Y){if(typeof Z==="string")return await this.uploadFileToFileSearchStoreFromPath(Z,$,Q,Y);else return iU(Z,$,Q,Y)}inferMimeType(Z){let $=Z.slice(Z.lastIndexOf(".")+1);return{aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gz:"application/gzip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz+xml",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"}[$.toLowerCase()]}async uploadFileFromPath(Z,$,Q,Y){var W;let J=await this.uploadFileFromPathInternal(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return K.file}async uploadFileToFileSearchStoreFromPath(Z,$,Q,Y){var W;let J=await this.uploadFileFromPathInternal(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let q=FZ(K),H=new $8;return Object.assign(H,q),H}async uploadFileFromPathInternal(Z,$,Q,Y){var W,J,K;let q=$,H=(Y===null||Y===void 0?void 0:Y.baseUrl)||((W=Q.clientOptions.httpOptions)===null||W===void 0?void 0:W.baseUrl);if(H){let I=new URL(H),P=new URL($);P.protocol=I.protocol,P.host=I.host,P.port=I.port,q=P.toString()}let w=0,F=0,z=new I4(new Response),G="upload",D,T=HV.basename(Z);try{if(D=await Z8.open(Z,"r"),!D)throw Error("Failed to open file");w=(await D.stat()).size;while(F<w){let I=Math.min(PJ,w-F);if(F+I>=w)G+=", finalize";let P=new Uint8Array(I),{bytesRead:O}=await D.read(P,0,I,F);if(O!==I)throw Error(`Failed to read ${I} bytes from file at offset ${F}. bytes actually read: ${O}`);let y=new Blob([P]),x=0,m=CJ;while(x<SJ){let f=Object.assign(Object.assign({},(Y===null||Y===void 0?void 0:Y.headers)||{}),{"X-Goog-Upload-Command":G,"X-Goog-Upload-Offset":String(F),"Content-Length":String(O),"X-Goog-Upload-File-Name":T});if(z=await Q.request({path:"",body:y,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},Y),{apiVersion:"",baseUrl:q,headers:f})}),(J=z===null||z===void 0?void 0:z.headers)===null||J===void 0?void 0:J[J4])break;x++,await OJ(m),m=m*vJ}if(F+=O,((K=z===null||z===void 0?void 0:z.headers)===null||K===void 0?void 0:K[J4])!=="active")break;if(w<=F)throw Error("All content has been uploaded, but the upload status is not finalized.")}return z}finally{if(D)await D.close()}}}class _J extends pV{async registerFiles(Z){if(typeof process>"u"||!process.versions||!process.versions.node)throw Error("registerFiles is only supported in Node.js environments.");let Q=await Z.auth.getRequestHeaders(),Y=Z.config||{},W=Y.httpOptions||{},J=Object.assign({},W.headers||{});if(Q)if(typeof Q[Symbol.iterator]==="function")for(let[K,q]of Q)J[K]=q;else for(let[K,q]of Object.entries(Q))J[K]=q;return this._registerFiles({uris:Z.uris,config:Object.assign(Object.assign({},Y),{httpOptions:Object.assign(Object.assign({},W),{headers:J})})})}}var nU="gl-node/";function rU(Z){var $;if(Z.enterprise!==void 0||Z.vertexai!==void 0){if(Z.enterprise!==void 0&&Z.vertexai!==void 0&&Z.enterprise!==Z.vertexai)throw Error("enterprise and vertexAI flags have conflicting values, please set enterprise value only.");return($=Z.enterprise)!==null&&$!==void 0?$:Z.vertexai}let Q=X4("GOOGLE_GENAI_USE_ENTERPRISE"),Y=X4("GOOGLE_GENAI_USE_VERTEXAI"),W=XV(Q),J=XV(Y);if(Q!==void 0&&Y!==void 0&&W!==J)console.warn("Warning: Both GOOGLE_GENAI_USE_ENTERPRISE and GOOGLE_GENAI_USE_VERTEXAI are set with conflicting values. The value of GOOGLE_GENAI_USE_ENTERPRISE will be used.");if(Q!==void 0)return W;if(Y!==void 0)return J;return!1}class sU{getNextGenClient(){var Z;let $=this.httpOptions;if(this._nextGenClient===void 0)this._nextGenClient=new w0({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:$===null||$===void 0?void 0:$.timeout,maxRetries:(Z=$===null||$===void 0?void 0:$.retryOptions)===null||Z===void 0?void 0:Z.attempts});if($===null||$===void 0?void 0:$.extraBody)console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");return this._nextGenClient}get interactions(){if(this._interactions!==void 0)return this._interactions;return console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions."),this._interactions=this.getNextGenClient().interactions,this._interactions}get webhooks(){if(this._webhooks!==void 0)return this._webhooks;return this._webhooks=this.getNextGenClient().webhooks,this._webhooks}constructor(Z){var $,Q,Y,W;if((Z.project||Z.location)&&Z.apiKey)throw Error("Project/location and API key are mutually exclusive in the client initializer.");this.vertexai=rU(Z);let J=oU(),K=X4("GOOGLE_CLOUD_PROJECT"),q=X4("GOOGLE_CLOUD_LOCATION");if(this.apiKey=($=Z.apiKey)!==null&&$!==void 0?$:J,this.project=(Q=Z.project)!==null&&Q!==void 0?Q:K,this.location=(Y=Z.location)!==null&&Y!==void 0?Y:q,!this.vertexai&&!this.apiKey)console.warn("API key should be set when using the Gemini API.");if(this.vertexai){if((W=Z.googleAuthOptions)===null||W===void 0?void 0:W.credentials)console.debug("The user provided Google Cloud credentials will take precedence over the API key from the environment variable."),this.apiKey=void 0;if((K||q)&&Z.apiKey)console.debug("The user provided Vertex AI API key will take precedence over the project/location from the environment variables."),this.project=void 0,this.location=void 0;else if((Z.project||Z.location)&&J)console.debug("The user provided project/location will take precedence over the API key from the environment variables."),this.apiKey=void 0;else if((K||q)&&J)console.debug("The project/location from the environment variables will take precedence over the API key from the environment variables."),this.apiKey=void 0;if(!this.location&&!this.apiKey)this.location="global"}let H=Fw(Z.httpOptions,this.vertexai,X4("GOOGLE_VERTEX_BASE_URL"),X4("GOOGLE_GEMINI_BASE_URL"));if(H)if(Z.httpOptions)Z.httpOptions.baseUrl=H;else Z.httpOptions={baseUrl:H};this.apiVersion=Z.apiVersion,this.httpOptions=Z.httpOptions;let w=new TJ({apiKey:this.apiKey,googleAuthOptions:Z.googleAuthOptions});this.apiClient=new eV({auth:w,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:nU+process.version,uploader:new jJ,downloader:new BJ}),this.models=new JJ(this.apiClient),this.live=new WJ(this.apiClient,w,new LJ),this.batches=new mV(this.apiClient),this.chats=new lV(this.models,this.apiClient),this.caches=new uV(this.apiClient),this.files=new _J(this.apiClient),this.operations=new XJ(this.apiClient),this.authTokens=new KJ(this.apiClient),this.tunings=new AJ(this.apiClient),this.fileSearchStores=new HJ(this.apiClient)}}function X4(Z){var $,Q,Y;return(Y=(Q=($=process===null||process===void 0?void 0:process.env)===null||$===void 0?void 0:$[Z])===null||Q===void 0?void 0:Q.trim())!==null&&Y!==void 0?Y:void 0}function XV(Z){if(Z===void 0)return!1;return Z.toLowerCase()==="true"}function oU(){let Z=X4("GOOGLE_API_KEY"),$=X4("GEMINI_API_KEY");if(Z&&$)console.warn("Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.");return Z||$||void 0}
44
- export{bW as Jk,mW as Kk,iW as Lk,i6 as Mk,sU as Nk};
44
+ export{bW as Kk,mW as Lk,iW as Mk,i6 as Nk,sU as Ok};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ec as b,fc as E}from"./chunk-w88219ex.js";import{kc as S}from"./chunk-ta7bfdrn.js";import{lc as L,mc as M}from"./chunk-pxw97qbq.js";import{xk as I}from"./chunk-9ab6k4rq.js";import"./chunk-0qkj838r.js";var P=async(B,J,D)=>{let F={api:B.api,provider:B.provider,model:B.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let G=D?.apiKey;if(!G)throw Error(`No API key for provider: ${B.provider}`);let V=v(B,G,D?.headers),Q=z(B,J),X=await D?.onPayload?.(Q,B);if(X!==void 0)Q=X;let N={...D?.signal?{signal:D.signal}:{},...D?.timeoutMs!==void 0?{timeout:D.timeoutMs}:{},maxRetries:D?.maxRetries??0},{data:O,response:q}=await V.chat.completions.create(Q,N).withResponse();await D?.onResponse?.({status:q.status,headers:L(q.headers)},B);let Y=O;if(F.responseId=Y.id,Y.usage)F.usage=C(Y.usage,B);let Z=Y.choices[0];if(Z){let _=Z.message.content;if(typeof _==="string"&&_.length>0)F.output.push({type:"text",text:_});for(let $ of Z.message.images??[]){let A=typeof $.image_url==="string"?$.image_url:$.image_url?.url;if(!A?.startsWith("data:"))continue;let f=A.match(/^data:([^;]+);base64,(.+)$/);if(!f)continue;F.output.push({type:"image",mimeType:f[1],data:f[2]})}}return F}catch(G){return F.stopReason=D?.signal?.aborted?"aborted":"error",F.errorMessage=E(b(G)),F}};function v(B,J,D){return new I({apiKey:J,baseURL:B.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:M({...B.headers,...D})})}function z(B,J){let D=J.input.map((F)=>{if(F.type==="text")return{type:"text",text:S(F.text)};return{type:"image_url",image_url:{url:`data:${F.mimeType};base64,${F.data}`}}});return{model:B.id,messages:[{role:"user",content:D}],stream:!1,modalities:B.output.includes("text")?["image","text"]:["image"]}}function C(B,J){let D=B.prompt_tokens||0,F=B.prompt_tokens_details?.cached_tokens||0,G=B.prompt_tokens_details?.cache_write_tokens||0,V=G>0?Math.max(0,F-G):F,Q=Math.max(0,D-V-G),X=B.completion_tokens||0,N={input:Q,output:X,cacheRead:V,cacheWrite:G,totalTokens:Q+X+V+G,cost:{input:J.cost.input/1e6*Q,output:J.cost.output/1e6*X,cacheRead:J.cost.cacheRead/1e6*V,cacheWrite:J.cost.cacheWrite/1e6*G,total:0}};return N.cost.total=N.cost.input+N.cost.output+N.cost.cacheRead+N.cost.cacheWrite,N}export{P as generateImages};
2
+ import{fc as b,gc as E}from"./chunk-2xmsa8wv.js";import{lc as S}from"./chunk-bf5a4yc8.js";import{mc as L,nc as M}from"./chunk-fr3dg9aj.js";import{yk as I}from"./chunk-e0kw3bst.js";import"./chunk-6f1twjf6.js";var P=async(B,J,D)=>{let F={api:B.api,provider:B.provider,model:B.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let G=D?.apiKey;if(!G)throw Error(`No API key for provider: ${B.provider}`);let V=v(B,G,D?.headers),Q=z(B,J),X=await D?.onPayload?.(Q,B);if(X!==void 0)Q=X;let N={...D?.signal?{signal:D.signal}:{},...D?.timeoutMs!==void 0?{timeout:D.timeoutMs}:{},maxRetries:D?.maxRetries??0},{data:O,response:q}=await V.chat.completions.create(Q,N).withResponse();await D?.onResponse?.({status:q.status,headers:L(q.headers)},B);let Y=O;if(F.responseId=Y.id,Y.usage)F.usage=C(Y.usage,B);let Z=Y.choices[0];if(Z){let _=Z.message.content;if(typeof _==="string"&&_.length>0)F.output.push({type:"text",text:_});for(let $ of Z.message.images??[]){let A=typeof $.image_url==="string"?$.image_url:$.image_url?.url;if(!A?.startsWith("data:"))continue;let f=A.match(/^data:([^;]+);base64,(.+)$/);if(!f)continue;F.output.push({type:"image",mimeType:f[1],data:f[2]})}}return F}catch(G){return F.stopReason=D?.signal?.aborted?"aborted":"error",F.errorMessage=E(b(G)),F}};function v(B,J,D){return new I({apiKey:J,baseURL:B.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:M({...B.headers,...D})})}function z(B,J){let D=J.input.map((F)=>{if(F.type==="text")return{type:"text",text:S(F.text)};return{type:"image_url",image_url:{url:`data:${F.mimeType};base64,${F.data}`}}});return{model:B.id,messages:[{role:"user",content:D}],stream:!1,modalities:B.output.includes("text")?["image","text"]:["image"]}}function C(B,J){let D=B.prompt_tokens||0,F=B.prompt_tokens_details?.cached_tokens||0,G=B.prompt_tokens_details?.cache_write_tokens||0,V=G>0?Math.max(0,F-G):F,Q=Math.max(0,D-V-G),X=B.completion_tokens||0,N={input:Q,output:X,cacheRead:V,cacheWrite:G,totalTokens:Q+X+V+G,cost:{input:J.cost.input/1e6*Q,output:J.cost.output/1e6*X,cacheRead:J.cost.cacheRead/1e6*V,cacheWrite:J.cost.cacheWrite/1e6*G,total:0}};return N.cost.total=N.cost.input+N.cost.output+N.cost.cacheRead+N.cost.cacheWrite,N}export{P as generateImages};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function q(k){let b=3735928559,d=1103547991;for(let f=0;f<k.length;f++){let l=k.charCodeAt(f);b=Math.imul(b^l,2654435761),d=Math.imul(d^l,1597334677)}return b=Math.imul(b^b>>>16,2246822507)^Math.imul(d^d>>>13,3266489909),d=Math.imul(d^d>>>16,2246822507)^Math.imul(b^b>>>13,3266489909),(d>>>0).toString(36)+(b>>>0).toString(36)}
3
- export{q as Xb};
3
+ export{q as wk};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{nk as V,ok as k,pk as _,qk as E}from"./chunk-hkbybhww.js";import{sk as b,tk as f,uk as A}from"./chunk-7hsgmjpa.js";import"./chunk-j8qtab70.js";import{wk as L}from"./chunk-5t6c3038.js";import{xk as N}from"./chunk-9ab6k4rq.js";import"./chunk-zemrvz79.js";import"./chunk-bs0fjz3w.js";import{Ck as B}from"./chunk-4qpa7b5t.js";import{Ok as M}from"./chunk-re0b7sj7.js";import{Sk as D,Tk as U}from"./chunk-922nnh39.js";import"./chunk-9h027f50.js";import"./chunk-0qkj838r.js";var y=new Set(["openai","openai-codex","opencode"]);function H(w){if(w)return w;if(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long")return"long";return"short"}function S(w){return{sendSessionIdHeader:w.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:w.compat?.supportsLongCacheRetention??!0}}function T(w,F){return F==="long"&&w.supportsLongCacheRetention?"24h":void 0}function C(w){if(w instanceof Error){let F=w.status,z=typeof F==="number"?F:void 0;if(z!==void 0)return`OpenAI API error (${z}): ${w.message}`;return w.message}try{return JSON.stringify(w)}catch{return String(w)}}var I=(w,F,z)=>{let G=new U;return(async()=>{let Q={role:"assistant",content:[],api:w.api,provider:w.provider,model:w.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let W=z?.apiKey;if(!W)throw Error(`No API key for provider: ${w.provider}`);let X=H(z?.cacheRetention)==="none"?void 0:z?.sessionId,Z=v(w,F,W,z?.headers,X),Y=x(w,F,z),$=await z?.onPayload?.(Y,w);if($!==void 0)Y=$;let j={...z?.signal?{signal:z.signal}:{},...z?.timeoutMs!==void 0?{timeout:z.timeoutMs}:{},maxRetries:z?.maxRetries??0},{data:K,response:q}=await Z.responses.create(Y,j).withResponse();if(await z?.onResponse?.({status:q.status,headers:B(q.headers)},w),G.push({type:"start",partial:Q}),await A(K,Q,G,w,{serviceTier:z?.serviceTier,applyServiceTierPricing:(P,O)=>h(P,O,w)}),z?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");G.push({type:"done",reason:Q.stopReason,message:Q}),G.end()}catch(W){for(let J of Q.content)delete J.index,delete J.partialJson;Q.stopReason=z?.signal?.aborted?"aborted":"error",Q.errorMessage=C(W),G.push({type:"error",reason:Q.stopReason,error:Q}),G.end()}})(),G},i=(w,F,z)=>{let G=z?.apiKey;if(!G)throw Error(`No API key for provider: ${w.provider}`);let Q=M(w,z,G),W=z?.reasoning?D(w,z.reasoning):void 0;return I(w,F,{...Q,reasoningEffort:W==="off"?void 0:W})};function v(w,F,z,G,Q){let W=S(w),J={...w.headers};if(w.provider==="github-copilot"){let Z=_(F.messages),Y=E({messages:F.messages,hasImages:Z});Object.assign(J,Y)}if(Q){if(W.sendSessionIdHeader)J.session_id=Q;J["x-client-request-id"]=Q}if(G)Object.assign(J,G);let X=w.provider==="cloudflare-ai-gateway"?{...J,Authorization:J.Authorization??null,"cf-aig-authorization":`Bearer ${z}`}:J;return new N({apiKey:z,baseURL:V(w.provider)?k(w):w.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:X})}function x(w,F,z){let G=b(w,F,y),Q=H(z?.cacheRetention),W=S(w),J={model:w.id,input:G,stream:!0,prompt_cache_key:Q==="none"?void 0:L(z?.sessionId),prompt_cache_retention:T(W,Q),store:!1};if(z?.maxTokens)J.max_output_tokens=z?.maxTokens;if(z?.temperature!==void 0)J.temperature=z?.temperature;if(z?.serviceTier!==void 0)J.service_tier=z.serviceTier;if(F.tools&&F.tools.length>0)J.tools=f(F.tools);if(w.reasoning){if(z?.reasoningEffort||z?.reasoningSummary){let X=z?.reasoningEffort?w.thinkingLevelMap?.[z.reasoningEffort]??z.reasoningEffort:"medium";J.reasoning={effort:X,summary:z?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(w.provider!=="github-copilot"&&w.thinkingLevelMap?.off!==null)J.reasoning={effort:w.thinkingLevelMap?.off??"none"}}return J}function R(w,F){switch(F){case"flex":return 0.5;case"priority":return w.id==="gpt-5.5"?2.5:2;default:return 1}}function h(w,F,z){let G=R(z,F);if(G===1)return;w.cost.input*=G,w.cost.output*=G,w.cost.cacheRead*=G,w.cost.cacheWrite*=G,w.cost.total=w.cost.input+w.cost.output+w.cost.cacheRead+w.cost.cacheWrite}export{i as streamSimpleOpenAIResponses,I as streamOpenAIResponses};
2
+ import{ok as V,pk as k,qk as _,rk as E}from"./chunk-48ebezek.js";import{tk as b,uk as f,vk as A}from"./chunk-dk45f6mp.js";import"./chunk-9bvwwj5y.js";import{xk as L}from"./chunk-r8vrfefa.js";import{yk as N}from"./chunk-e0kw3bst.js";import"./chunk-bjfwz2m7.js";import"./chunk-fwcm78s9.js";import{Dk as B}from"./chunk-jxxq76at.js";import{Pk as M}from"./chunk-e66j69wz.js";import{Tk as D,Uk as U}from"./chunk-cm25nm9t.js";import"./chunk-3g54qkv5.js";import"./chunk-6f1twjf6.js";var y=new Set(["openai","openai-codex","opencode"]);function H(w){if(w)return w;if(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long")return"long";return"short"}function S(w){return{sendSessionIdHeader:w.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:w.compat?.supportsLongCacheRetention??!0}}function T(w,F){return F==="long"&&w.supportsLongCacheRetention?"24h":void 0}function C(w){if(w instanceof Error){let F=w.status,z=typeof F==="number"?F:void 0;if(z!==void 0)return`OpenAI API error (${z}): ${w.message}`;return w.message}try{return JSON.stringify(w)}catch{return String(w)}}var I=(w,F,z)=>{let G=new U;return(async()=>{let Q={role:"assistant",content:[],api:w.api,provider:w.provider,model:w.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let W=z?.apiKey;if(!W)throw Error(`No API key for provider: ${w.provider}`);let X=H(z?.cacheRetention)==="none"?void 0:z?.sessionId,Z=v(w,F,W,z?.headers,X),Y=x(w,F,z),$=await z?.onPayload?.(Y,w);if($!==void 0)Y=$;let j={...z?.signal?{signal:z.signal}:{},...z?.timeoutMs!==void 0?{timeout:z.timeoutMs}:{},maxRetries:z?.maxRetries??0},{data:K,response:q}=await Z.responses.create(Y,j).withResponse();if(await z?.onResponse?.({status:q.status,headers:B(q.headers)},w),G.push({type:"start",partial:Q}),await A(K,Q,G,w,{serviceTier:z?.serviceTier,applyServiceTierPricing:(P,O)=>h(P,O,w)}),z?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");G.push({type:"done",reason:Q.stopReason,message:Q}),G.end()}catch(W){for(let J of Q.content)delete J.index,delete J.partialJson;Q.stopReason=z?.signal?.aborted?"aborted":"error",Q.errorMessage=C(W),G.push({type:"error",reason:Q.stopReason,error:Q}),G.end()}})(),G},i=(w,F,z)=>{let G=z?.apiKey;if(!G)throw Error(`No API key for provider: ${w.provider}`);let Q=M(w,z,G),W=z?.reasoning?D(w,z.reasoning):void 0;return I(w,F,{...Q,reasoningEffort:W==="off"?void 0:W})};function v(w,F,z,G,Q){let W=S(w),J={...w.headers};if(w.provider==="github-copilot"){let Z=_(F.messages),Y=E({messages:F.messages,hasImages:Z});Object.assign(J,Y)}if(Q){if(W.sendSessionIdHeader)J.session_id=Q;J["x-client-request-id"]=Q}if(G)Object.assign(J,G);let X=w.provider==="cloudflare-ai-gateway"?{...J,Authorization:J.Authorization??null,"cf-aig-authorization":`Bearer ${z}`}:J;return new N({apiKey:z,baseURL:V(w.provider)?k(w):w.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:X})}function x(w,F,z){let G=b(w,F,y),Q=H(z?.cacheRetention),W=S(w),J={model:w.id,input:G,stream:!0,prompt_cache_key:Q==="none"?void 0:L(z?.sessionId),prompt_cache_retention:T(W,Q),store:!1};if(z?.maxTokens)J.max_output_tokens=z?.maxTokens;if(z?.temperature!==void 0)J.temperature=z?.temperature;if(z?.serviceTier!==void 0)J.service_tier=z.serviceTier;if(F.tools&&F.tools.length>0)J.tools=f(F.tools);if(w.reasoning){if(z?.reasoningEffort||z?.reasoningSummary){let X=z?.reasoningEffort?w.thinkingLevelMap?.[z.reasoningEffort]??z.reasoningEffort:"medium";J.reasoning={effort:X,summary:z?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(w.provider!=="github-copilot"&&w.thinkingLevelMap?.off!==null)J.reasoning={effort:w.thinkingLevelMap?.off??"none"}}return J}function R(w,F){switch(F){case"flex":return 0.5;case"priority":return w.id==="gpt-5.5"?2.5:2;default:return 1}}function h(w,F,z){let G=R(z,F);if(G===1)return;w.cost.input*=G,w.cost.output*=G,w.cost.cacheRead*=G,w.cost.cacheWrite*=G,w.cost.total=w.cost.input+w.cost.output+w.cost.cacheRead+w.cost.cacheWrite}export{i as streamSimpleOpenAIResponses,I as streamOpenAIResponses};
@@ -1,2 +1,2 @@
1
- import{Fh as n,Sh as e,mk as c,oh as r}from"./chunk-nyhqy6q2.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
- export{i as ef,l as ff,u as gf};
1
+ import{Gh as n,Th as e,nk as c,ph as r}from"./chunk-q0dhm16d.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
+ export{i as ff,l as gf,u as hf};
@@ -1,4 +1,4 @@
1
- import{B as gO,D as Jd,F as F5,G as B5,H as O5,O as Qd,P as bO,Q as $k,R as cl,S as i3,T as P7,U as H3}from"./chunk-crt1e1w1.js";import{ea as Ed}from"./chunk-wsyg4rwg.js";import{Wa as _p}from"./chunk-kfhtk3eh.js";import{$a as Hd,_a as Od,ab as Md,bb as Dd,cb as Td,db as Rd,eb as Nd,fb as zd}from"./chunk-0xbf8bcg.js";import{Bf as C3,Cf as _3,Df as v_,Ff as kb,Gf as S_,Hf as y_,Jf as k_,Kf as M_,Lf as Cb,Mf as C_,Nf as __,Of as wd,Pf as jd,Qf as dd,Rf as qd,Sf as hO,Tf as cO,Uf as kp,Vf as Cp,ag as _5}from"./chunk-77r8w95d.js";import{og as uO,pg as wo,qg as hi}from"./chunk-3n1rezd0.js";import{Mg as yd}from"./chunk-fz88kkk1.js";import{Og as c8}from"./chunk-dghtwyq1.js";import{Qg as Ln,Rg as Mf,Tg as Df,Ug as Tf,Vg as l1,Yg as n3,bh as Yd,ch as mO,dh as h8,eh as kd,fh as Cd,gh as _d,ih as Fd,jh as Bd}from"./chunk-gswbc6y9.js";import{$h as bd,Aj as l8,Cj as pd,Ei as Gd,Ej as Vd,Gi as $_,Ji as Vn,Jj as Qk,Kj as Zk,Lh as xd,Mi as C5,Mj as qo,Sh as Le,ai as Zd,bk as E2,dj as l3,gk as Mi,hj as f3,hk as Ad,ij as ul,ik as vd,ji as Ud,jk as Sd,li as r8,lj as Xd,mh as Pa,mj as Vk,mk as It,nh as mo,ni as O3,nj as hh,oh as x,oj as ch,ph as rt,qh as k5,qj as Kd,rj as Yk,si as Id,th as po,tj as Jk,vh as Hf,vi as oh,wh as oO,wi as jo,xi as aO,xj as Ld,yi as iO}from"./chunk-nyhqy6q2.js";import{Vk as Ie,Wk as Me,Xk as o4}from"./chunk-0qkj838r.js";var kw=Me((lJ,yw)=>{var qw=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,wM=/\n/g,jM=/^\s*/,dM=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,qM=/^:\s*/,AM=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,vM=/^[;\s]*/,SM=/^\s+|\s+$/g,yM=`
1
+ import{B as gO,D as Jd,F as F5,G as B5,H as O5,O as Qd,P as bO,Q as $k,R as cl,S as i3,T as P7,U as H3}from"./chunk-ea0fh29m.js";import{ea as Ed}from"./chunk-vdn3jymh.js";import{Wa as _p}from"./chunk-cwebycwv.js";import{$a as Od,ab as Hd,bb as Md,cb as Dd,db as Td,eb as Rd,fb as Nd,gb as zd}from"./chunk-2m2saan7.js";import{Cf as C3,Df as _3,Ef as v_,Gf as kb,Hf as S_,If as y_,Kf as k_,Lf as M_,Mf as Cb,Nf as C_,Of as __,Pf as wd,Qf as jd,Rf as dd,Sf as qd,Tf as hO,Uf as cO,Vf as kp,Wf as Cp,bg as _5}from"./chunk-zct68gc7.js";import{pg as uO,qg as wo,rg as hi}from"./chunk-z5p39kpk.js";import{Ng as yd}from"./chunk-1zpw2mbj.js";import{Pg as c8}from"./chunk-jtwvd0te.js";import{Rg as Ln,Sg as Mf,Ug as Df,Vg as Tf,Wg as l1,Zg as n3,ch as Yd,dh as mO,eh as h8,fh as kd,gh as Cd,hh as _d,jh as Fd,kh as Bd}from"./chunk-8a9k4qj6.js";import{Bj as l8,Dj as pd,Fi as Gd,Fj as Vd,Hi as $_,Ki as Vn,Kj as Qk,Lj as Zk,Mh as xd,Ni as C5,Nj as qo,Th as Le,ai as bd,bi as Zd,ck as E2,ej as l3,hk as Mi,ij as f3,ik as Ad,jj as ul,jk as vd,ki as Ud,kk as Sd,mi as r8,mj as Xd,nh as Pa,nj as Vk,nk as It,oh as mo,oi as O3,oj as hh,ph as x,pj as ch,qh as rt,rh as k5,rj as Kd,sj as Yk,ti as Id,uh as po,uj as Jk,wh as Hf,wi as oh,xh as oO,xi as jo,yi as aO,yj as Ld,zi as iO}from"./chunk-q0dhm16d.js";import{Wk as Ie,Xk as Me,Yk as o4}from"./chunk-6f1twjf6.js";var kw=Me((lJ,yw)=>{var qw=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,wM=/\n/g,jM=/^\s*/,dM=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,qM=/^:\s*/,AM=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,vM=/^[;\s]*/,SM=/^\s+|\s+$/g,yM=`
2
2
  `,Aw="/",vw="*",Cf="",kM="comment",CM="declaration";function _M(t,e){if(typeof t!=="string")throw TypeError("First argument must be a string");if(!t)return[];e=e||{};var a=1,i=1;function s(d){var v=d.match(wM);if(v)a+=v.length;var k=d.lastIndexOf(yM);i=~k?d.length-k:i+d.length}function n(){var d={line:a,column:i};return function(v){return v.position=new l(d),c(),v}}function l(d){this.start=d,this.end={line:a,column:i},this.source=e.source}l.prototype.content=t;function f(d){var v=Error(e.source+":"+a+":"+i+": "+d);if(v.reason=d,v.filename=e.source,v.line=a,v.column=i,v.source=t,e.silent);else throw v}function o(d){var v=d.exec(t);if(!v)return;var k=v[0];return s(k),t=t.slice(k.length),v}function c(){o(jM)}function u(d){var v;d=d||[];while(v=m())if(v!==!1)d.push(v);return d}function m(){var d=n();if(Aw!=t.charAt(0)||vw!=t.charAt(1))return;var v=2;while(Cf!=t.charAt(v)&&(vw!=t.charAt(v)||Aw!=t.charAt(v+1)))++v;if(v+=2,Cf===t.charAt(v-1))return f("End of comment missing");var k=t.slice(2,v-2);return i+=2,s(k),t=t.slice(v),i+=2,d({type:kM,comment:k})}function p(){var d=n(),v=o(dM);if(!v)return;if(m(),!o(qM))return f("property missing ':'");var k=o(AM),y=d({type:CM,property:Sw(v[0].replace(qw,Cf)),value:k?Sw(k[0].replace(qw,Cf)):Cf});return o(vM),y}function w(){var d=[];u(d);var v;while(v=p())if(v!==!1)d.push(v),u(d);return d}return c(),w()}function Sw(t){return t?t.replace(SM,Cf):Cf}yw.exports=_M});var Cw=Me((Dc)=>{var FM=Dc&&Dc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dc,"__esModule",{value:!0});Dc.default=OM;var BM=FM(kw());function OM(t,e){let a=null;if(!t||typeof t!=="string")return a;let i=(0,BM.default)(t),s=typeof e==="function";return i.forEach((n)=>{if(n.type!=="declaration")return;let{property:l,value:f}=n;if(s)e(l,f,n);else if(f)a=a||{},a[l]=f}),a}});var Ow=Me((Fw)=>{Object.defineProperty(Fw,"__esModule",{value:!0});Fw.camelCase=void 0;var HM=/^--[a-zA-Z0-9_-]+$/,MM=/-([a-z])/g,DM=/^[^-]+$/,TM=/^-(webkit|moz|ms|o|khtml)-/,RM=/^-(ms)-/,NM=function(t){return!t||DM.test(t)||HM.test(t)},zM=function(t,e){return e.toUpperCase()},_w=function(t,e){return"".concat(e,"-")},EM=function(t,e){if(e===void 0)e={};if(NM(t))return t;if(t=t.toLowerCase(),e.reactCompat)t=t.replace(RM,_w);else t=t.replace(TM,_w);return t.replace(MM,zM)};Fw.camelCase=EM});var Mw=Me((j4,Hw)=>{var xM=j4&&j4.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},UM=xM(Cw()),IM=Ow();function w4(t,e){var a={};if(!t||typeof t!=="string")return a;return(0,UM.default)(t,function(i,s){if(i&&s)a[(0,IM.camelCase)(i,e)]=s}),a}w4.default=w4;Hw.exports=w4});var ad=Me((ZP,ed)=>{var v5=Object.prototype.hasOwnProperty,td=Object.prototype.toString,Jj=Object.defineProperty,Qj=Object.getOwnPropertyDescriptor,Zj=function(e){if(typeof Array.isArray==="function")return Array.isArray(e);return td.call(e)==="[object Array]"},$j=function(e){if(!e||td.call(e)!=="[object Object]")return!1;var a=v5.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&v5.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!a&&!i)return!1;var s;for(s in e);return typeof s>"u"||v5.call(e,s)},Wj=function(e,a){if(Jj&&a.name==="__proto__")Jj(e,a.name,{enumerable:!0,configurable:!0,value:a.newValue,writable:!0});else e[a.name]=a.newValue},Pj=function(e,a){if(a==="__proto__"){if(!v5.call(e,a))return;else if(Qj)return Qj(e,a).value}return e[a]};ed.exports=function t(){var e,a,i,s,n,l,f=arguments[0],o=1,c=arguments.length,u=!1;if(typeof f==="boolean")u=f,f=arguments[1]||{},o=2;if(f==null||typeof f!=="object"&&typeof f!=="function")f={};for(;o<c;++o)if(e=arguments[o],e!=null){for(a in e)if(i=Pj(f,a),s=Pj(e,a),f!==s){if(u&&s&&($j(s)||(n=Zj(s)))){if(n)n=!1,l=i&&Zj(i)?i:[];else l=i&&$j(i)?i:{};Wj(f,{name:a,newValue:t(u,l,s)})}else if(typeof s<"u")Wj(f,{name:a,newValue:s})}}return f}});var h0=Me((Met,Wd)=>{var $c;if(typeof window<"u")$c=window;else if(typeof global<"u")$c=global;else if(typeof self<"u")$c=self;else $c={};Wd.exports=$c});var u8=Me((Det,tq)=>{var Pd=Array.prototype.slice;tq.exports=AR;function AR(t,e){if(!("length"in t))t=[t];t=Pd.call(t);while(t.length){var a=t.shift(),i=e(a);if(i)return i;if(a.childNodes&&a.childNodes.length)t=Pd.call(a.childNodes).concat(t)}}});var aq=Me((Tet,eq)=>{eq.exports=Ao;function Ao(t,e){if(!(this instanceof Ao))return new Ao(t,e);this.data=t,this.nodeValue=t,this.length=t.length,this.ownerDocument=e||null}Ao.prototype.nodeType=8;Ao.prototype.nodeName="#comment";Ao.prototype.toString=function(){return"[object Comment]"}});var sq=Me((Ret,iq)=>{iq.exports=ml;function ml(t,e){if(!(this instanceof ml))return new ml(t);this.data=t||"",this.length=this.data.length,this.ownerDocument=e||null}ml.prototype.type="DOMTextNode";ml.prototype.nodeType=3;ml.prototype.nodeName="#text";ml.prototype.toString=function(){return this.data};ml.prototype.replaceData=function(e,a,i){var s=this.data,n=s.substring(0,e),l=s.substring(e+a,s.length);this.data=n+i+l,this.length=this.data.length}});var m8=Me((Net,nq)=>{nq.exports=vR;function vR(t){var e=this,a=t.type;if(!t.target)t.target=e;if(!e.listeners)e.listeners={};var i=e.listeners[a];if(i)return i.forEach(function(s){if(t.currentTarget=e,typeof s==="function")s(t);else s.handleEvent(t)});if(e.parentNode)e.parentNode.dispatchEvent(t)}});var g8=Me((zet,lq)=>{lq.exports=SR;function SR(t,e){var a=this;if(!a.listeners)a.listeners={};if(!a.listeners[t])a.listeners[t]=[];if(a.listeners[t].indexOf(e)===-1)a.listeners[t].push(e)}});var b8=Me((Eet,fq)=>{fq.exports=yR;function yR(t,e){var a=this;if(!a.listeners)return;if(!a.listeners[t])return;var i=a.listeners[t],s=i.indexOf(e);if(s!==-1)i.splice(s,1)}});var cq=Me((xet,hq)=>{hq.exports=rq;var kR=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function rq(t){switch(t.nodeType){case 3:return p8(t.data);case 8:return"<!--"+t.data+"-->";default:return CR(t)}}function CR(t){var e=[],a=t.tagName;if(t.namespaceURI==="http://www.w3.org/1999/xhtml")a=a.toLowerCase();if(e.push("<"+a+OR(t)+BR(t)),kR.indexOf(a)>-1)e.push(" />");else{if(e.push(">"),t.childNodes.length)e.push.apply(e,t.childNodes.map(rq));else if(t.textContent||t.innerText)e.push(p8(t.textContent||t.innerText));else if(t.innerHTML)e.push(t.innerHTML);e.push("</"+a+">")}return e.join("")}function _R(t,e){var a=typeof t[e];if(e==="style"&&Object.keys(t.style).length>0)return!0;return t.hasOwnProperty(e)&&(a==="string"||a==="boolean"||a==="number")&&e!=="nodeName"&&e!=="className"&&e!=="tagName"&&e!=="textContent"&&e!=="innerText"&&e!=="namespaceURI"&&e!=="innerHTML"}function FR(t){if(typeof t==="string")return t;var e="";return Object.keys(t).forEach(function(a){var i=t[a];a=a.replace(/[A-Z]/g,function(s){return"-"+s.toLowerCase()}),e+=a+":"+i+";"}),e}function BR(t){var e=t.dataset,a=[];for(var i in e)a.push({name:"data-"+i,value:e[i]});return a.length?oq(a):""}function oq(t){var e=[];return t.forEach(function(a){var{name:i,value:s}=a;if(i==="style")s=FR(s);e.push(i+'="'+HR(s)+'"')}),e.length?" "+e.join(" "):""}function OR(t){var e=[];for(var a in t)if(_R(t,a))e.push({name:a,value:t[a]});for(var i in t._attributes)for(var s in t._attributes[i]){var n=t._attributes[i][s],l=(n.prefix?n.prefix+":":"")+s;e.push({name:l,value:n.value})}if(t.className)e.push({name:"class",value:t.className});return e.length?oq(e):""}function p8(t){var e="";if(typeof t==="string")e=t;else if(t)e=t.toString();return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HR(t){return p8(t).replace(/"/g,"&quot;")}});var j8=Me((Uet,mq)=>{var w8=u8(),MR=m8(),DR=g8(),TR=b8(),RR=cq(),uq="http://www.w3.org/1999/xhtml";mq.exports=Ca;function Ca(t,e,a){if(!(this instanceof Ca))return new Ca(t);var i=a===void 0?uq:a||null;if(this.tagName=i===uq?String(t).toUpperCase():t,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=e||null,this.namespaceURI=i,this._attributes={},this.tagName==="INPUT")this.type="text"}Ca.prototype.type="DOMElement";Ca.prototype.nodeType=1;Ca.prototype.appendChild=function(e){if(e.parentNode)e.parentNode.removeChild(e);return this.childNodes.push(e),e.parentNode=this,e};Ca.prototype.replaceChild=function(e,a){if(e.parentNode)e.parentNode.removeChild(e);var i=this.childNodes.indexOf(a);return a.parentNode=null,this.childNodes[i]=e,e.parentNode=this,a};Ca.prototype.removeChild=function(e){var a=this.childNodes.indexOf(e);return this.childNodes.splice(a,1),e.parentNode=null,e};Ca.prototype.insertBefore=function(e,a){if(e.parentNode)e.parentNode.removeChild(e);var i=a===null||a===void 0?-1:this.childNodes.indexOf(a);if(i>-1)this.childNodes.splice(i,0,e);else this.childNodes.push(e);return e.parentNode=this,e};Ca.prototype.setAttributeNS=function(e,a,i){var s=null,n=a,l=a.indexOf(":");if(l>-1)s=a.substr(0,l),n=a.substr(l+1);if(this.tagName==="INPUT"&&a==="type")this.type=i;else{var f=this._attributes[e]||(this._attributes[e]={});f[n]={value:i,prefix:s}}};Ca.prototype.getAttributeNS=function(e,a){var i=this._attributes[e],s=i&&i[a]&&i[a].value;if(this.tagName==="INPUT"&&a==="type")return this.type;if(typeof s!=="string")return null;return s};Ca.prototype.removeAttributeNS=function(e,a){if(!Object.prototype.hasOwnProperty.call(this._attributes,e))return;var i=this._attributes[e];if(i&&Object.prototype.hasOwnProperty.call(i,a))delete i[a]};Ca.prototype.hasAttributeNS=function(e,a){var i=this._attributes[e];return!!i&&a in i};Ca.prototype.setAttribute=function(e,a){return this.setAttributeNS(null,e,a)};Ca.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)};Ca.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)};Ca.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)};Ca.prototype.removeEventListener=TR;Ca.prototype.addEventListener=DR;Ca.prototype.dispatchEvent=MR;Ca.prototype.focus=function(){return};Ca.prototype.toString=function(){return RR(this)};Ca.prototype.getElementsByClassName=function(e){var a=e.split(" "),i=[];return w8(this,function(s){if(s.nodeType===1){var n=s.className||"",l=n.split(" ");if(a.every(function(f){return l.indexOf(f)!==-1}))i.push(s)}}),i};Ca.prototype.getElementsByTagName=function(e){e=e.toLowerCase();var a=[];return w8(this.childNodes,function(i){if(i.nodeType===1&&(e==="*"||i.tagName.toLowerCase()===e))a.push(i)}),a};Ca.prototype.contains=function(e){return w8(this,function(a){return e===a})||!1}});var bq=Me((Iet,gq)=>{var d8=j8();gq.exports=c0;function c0(t){if(!(this instanceof c0))return new c0;this.childNodes=[],this.parentNode=null,this.ownerDocument=t||null}c0.prototype.type="DocumentFragment";c0.prototype.nodeType=11;c0.prototype.nodeName="#document-fragment";c0.prototype.appendChild=d8.prototype.appendChild;c0.prototype.replaceChild=d8.prototype.replaceChild;c0.prototype.removeChild=d8.prototype.removeChild;c0.prototype.toString=function(){return this.childNodes.map(function(e){return String(e)}).join("")}});var wq=Me((Get,pq)=>{pq.exports=q8;function q8(t){}q8.prototype.initEvent=function(e,a,i){this.type=e,this.bubbles=a,this.cancelable=i};q8.prototype.preventDefault=function(){}});var dq=Me((Xet,jq)=>{var NR=u8(),zR=aq(),ER=sq(),Wc=j8(),xR=bq(),UR=wq(),IR=m8(),GR=g8(),XR=b8();jq.exports=H5;function H5(){if(!(this instanceof H5))return new H5;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var Ws=H5.prototype;Ws.createTextNode=function(e){return new ER(e,this)};Ws.createElementNS=function(e,a){var i=e===null?null:String(e);return new Wc(a,this,i)};Ws.createElement=function(e){return new Wc(e,this)};Ws.createDocumentFragment=function(){return new xR(this)};Ws.createEvent=function(e){return new UR(e)};Ws.createComment=function(e){return new zR(e,this)};Ws.getElementById=function(e){e=String(e);var a=NR(this.childNodes,function(i){if(String(i.id)===e)return i});return a||null};Ws.getElementsByClassName=Wc.prototype.getElementsByClassName;Ws.getElementsByTagName=Wc.prototype.getElementsByTagName;Ws.contains=Wc.prototype.contains;Ws.removeEventListener=XR;Ws.addEventListener=GR;Ws.dispatchEvent=IR});var Aq=Me((Ket,qq)=>{var KR=dq();qq.exports=new KR});var A8=Me((Let,Sq)=>{var vq=typeof global<"u"?global:typeof window<"u"?window:{},LR=Aq(),Pc;if(typeof document<"u")Pc=document;else if(Pc=vq["__GLOBAL_DOCUMENT_CACHE@4"],!Pc)Pc=vq["__GLOBAL_DOCUMENT_CACHE@4"]=LR;Sq.exports=Pc});var yq=Me((Vet,f1)=>{function v8(){return f1.exports=v8=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var i in a)({}).hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},f1.exports.__esModule=!0,f1.exports.default=f1.exports,v8.apply(null,arguments)}f1.exports=v8,f1.exports.__esModule=!0,f1.exports.default=f1.exports});var Cq=Me((Yet,kq)=>{kq.exports=YR;var VR=Object.prototype.toString;function YR(t){if(!t)return!1;var e=VR.call(t);return e==="[object Function]"||typeof t==="function"&&e!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}});var Bq=Me((Jet,Fq)=>{function JR(t,e){var a=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(a)return(a=a.call(t)).next.bind(a);if(Array.isArray(t)||(a=QR(t))||e&&t&&typeof t.length==="number"){if(a)t=a;var i=0;return function(){if(i>=t.length)return{done:!0};return{done:!1,value:t[i++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QR(t,e){if(!t)return;if(typeof t==="string")return _q(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor)a=t.constructor.name;if(a==="Map"||a==="Set")return Array.from(t);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _q(t,e)}function _q(t,e){if(e==null||e>t.length)e=t.length;for(var a=0,i=Array(e);a<e;a++)i[a]=t[a];return i}var ZR=function(){function t(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=t.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(i,s){if(!this.typeToInterceptorsMap_.has(i))this.typeToInterceptorsMap_.set(i,new Set);var n=this.typeToInterceptorsMap_.get(i);if(n.has(s))return!1;return n.add(s),!0},e.removeInterceptor=function(i,s){var n=this.typeToInterceptorsMap_.get(i);if(n&&n.has(s))return n.delete(s),!0;return!1},e.clearInterceptorsByType=function(i){var s=this.typeToInterceptorsMap_.get(i);if(!s)return!1;return this.typeToInterceptorsMap_.delete(i),this.typeToInterceptorsMap_.set(i,new Set),!0},e.clear=function(){if(!this.typeToInterceptorsMap_.size)return!1;return this.typeToInterceptorsMap_=new Map,!0},e.getForType=function(i){return this.typeToInterceptorsMap_.get(i)||new Set},e.execute=function(i,s){var n=this.getForType(i);for(var l=JR(n),f;!(f=l()).done;){var o=f.value;try{s=o(s)}catch(c){}}return s},t}();Fq.exports=ZR});var Hq=Me((Qet,Oq)=>{var $R=function(){function t(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1}var e=t.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(i){this.maxAttempts_=i},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(i){this.delayFactor_=i},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(i){this.fuzzFactor_=i},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(i){this.initialDelay_=i},e.createRetry=function(i){var s=i===void 0?{}:i,n=s.maxAttempts,l=s.delayFactor,f=s.fuzzFactor,o=s.initialDelay;return new WR({maxAttempts:n||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:f||this.fuzzFactor_,initialDelay:o||this.initialDelay_})},t}(),WR=function(){function t(a){this.maxAttempts_=a.maxAttempts,this.delayFactor_=a.delayFactor,this.fuzzFactor_=a.fuzzFactor,this.currentDelay_=a.initialDelay,this.currentAttempt_=1}var e=t.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var i=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+i},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var i=this.getCurrentMinPossibleDelay(),s=this.getCurrentMaxPossibleDelay();return i+Math.random()*(s-i)},t}();Oq.exports=$R});var Dq=Me((Zet,Mq)=>{var PR=h0(),tN=function(e,a){if(a===void 0)a=!1;return function(i,s,n){if(i){e(i);return}if(s.statusCode>=400&&s.statusCode<=599){var l=n;if(a)if(PR.TextDecoder){var f=eN(s.headers&&s.headers["content-type"]);try{l=new TextDecoder(f).decode(n)}catch(o){}}else l=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:l});return}e(null,n)}};function eN(t){if(t===void 0)t="";return t.toLowerCase().split(";").reduce(function(e,a){var i=a.split("="),s=i[0],n=i[1];if(s.trim()==="charset")return n.trim();return e},"utf-8")}Mq.exports=tN});var zq=Me(($et,y8)=>{var Tq=h0(),aN=yq(),iN=Cq(),Rq=Bq(),sN=Hq();ti.httpHandler=Dq();ti.requestInterceptorsStorage=new Rq;ti.responseInterceptorsStorage=new Rq;ti.retryManager=new sN;var nN=function(e){var a={};if(!e)return a;return e.trim().split(`
4
4
  `).forEach(function(i){var s=i.indexOf(":"),n=i.slice(0,s).trim().toLowerCase(),l=i.slice(s+1).trim();if(typeof a[n]>"u")a[n]=l;else if(Array.isArray(a[n]))a[n].push(l);else a[n]=[a[n],l]}),a};y8.exports=ti;y8.exports.default=ti;ti.XMLHttpRequest=Tq.XMLHttpRequest||oN;ti.XDomainRequest="withCredentials"in new ti.XMLHttpRequest?ti.XMLHttpRequest:Tq.XDomainRequest;lN(["get","put","post","patch","head","delete"],function(t){ti[t==="delete"?"del":t]=function(e,a,i){return a=Nq(e,a,i),a.method=t.toUpperCase(),S8(a)}});function lN(t,e){for(var a=0;a<t.length;a++)e(t[a])}function fN(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function Nq(t,e,a){var i=t;if(iN(e)){if(a=e,typeof t==="string")i={uri:t}}else i=aN({},e,{uri:t});return i.callback=a,i}function ti(t,e,a){return e=Nq(t,e,a),S8(e)}function S8(t){if(typeof t.callback>"u")throw Error("callback argument missing");if(t.requestType&&ti.requestInterceptorsStorage.getIsEnabled()){var e={uri:t.uri||t.url,headers:t.headers||{},body:t.body,metadata:t.metadata||{},retry:t.retry,timeout:t.timeout},a=ti.requestInterceptorsStorage.execute(t.requestType,e);t.uri=a.uri,t.headers=a.headers,t.body=a.body,t.metadata=a.metadata,t.retry=a.retry,t.timeout=a.timeout}var i=!1,s=function(D,T,z){if(!i)i=!0,t.callback(D,T,z)};function n(){if(c.readyState===4&&!ti.responseInterceptorsStorage.getIsEnabled())setTimeout(o,0)}function l(){var M=void 0;if(c.response)M=c.response;else M=c.responseText||rN(c);if(y)try{M=JSON.parse(M)}catch(D){}return M}function f(M){if(clearTimeout(B),clearTimeout(t.retryTimeout),!(M instanceof Error))M=Error(""+(M||"Unknown XMLHttpRequest Error"));if(M.statusCode=0,!m&&ti.retryManager.getIsEnabled()&&t.retry&&t.retry.shouldRetry()){t.retryTimeout=setTimeout(function(){t.retry.moveToNextAttempt(),t.xhr=c,S8(t)},t.retry.getCurrentFuzzedDelay());return}if(t.requestType&&ti.responseInterceptorsStorage.getIsEnabled()){var D={headers:H.headers||{},body:H.body,responseUrl:c.responseURL,responseType:c.responseType},T=ti.responseInterceptorsStorage.execute(t.requestType,D);H.body=T.body,H.headers=T.headers}return s(M,H)}function o(){if(m)return;var M;if(clearTimeout(B),clearTimeout(t.retryTimeout),t.useXDR&&c.status===void 0)M=200;else M=c.status===1223?204:c.status;var D=H,T=null;if(M!==0){if(D={body:l(),statusCode:M,method:w,headers:{},url:p,rawRequest:c},c.getAllResponseHeaders)D.headers=nN(c.getAllResponseHeaders())}else T=Error("Internal XMLHttpRequest Error");if(t.requestType&&ti.responseInterceptorsStorage.getIsEnabled()){var z={headers:D.headers||{},body:D.body,responseUrl:c.responseURL,responseType:c.responseType},E=ti.responseInterceptorsStorage.execute(t.requestType,z);D.body=E.body,D.headers=E.headers}return s(T,D,D.body)}var c=t.xhr||null;if(!c)if(t.cors||t.useXDR)c=new ti.XDomainRequest;else c=new ti.XMLHttpRequest;var u,m,p=c.url=t.uri||t.url,w=c.method=t.method||"GET",d=t.body||t.data,v=c.headers=t.headers||{},k=!!t.sync,y=!1,B,H={body:void 0,headers:{},statusCode:0,method:w,url:p,rawRequest:c};if("json"in t&&t.json!==!1){if(y=!0,v.accept||v.Accept||(v.Accept="application/json"),w!=="GET"&&w!=="HEAD")v["content-type"]||v["Content-Type"]||(v["Content-Type"]="application/json"),d=JSON.stringify(t.json===!0?d:t.json)}if(c.onreadystatechange=n,c.onload=o,c.onerror=f,c.onprogress=function(){},c.onabort=function(){m=!0,clearTimeout(t.retryTimeout)},c.ontimeout=f,c.open(w,p,!k,t.username,t.password),!k)c.withCredentials=!!t.withCredentials;if(!k&&t.timeout>0)B=setTimeout(function(){if(m)return;m=!0,c.abort("timeout");var M=Error("XMLHttpRequest timeout");M.code="ETIMEDOUT",f(M)},t.timeout);if(c.setRequestHeader){for(u in v)if(v.hasOwnProperty(u))c.setRequestHeader(u,v[u])}else if(t.headers&&!fN(t.headers))throw Error("Headers cannot be set on an XDomainRequest object");if("responseType"in t)c.responseType=t.responseType;if("beforeSend"in t&&typeof t.beforeSend==="function")t.beforeSend(c);return c.send(d||null),c}function rN(t){try{if(t.responseType==="document")return t.responseXML;var e=t.responseXML&&t.responseXML.documentElement.nodeName==="parsererror";if(t.responseType===""&&!e)return t.responseXML}catch(a){}return null}function oN(){}});var Kq=Me((Wet,Xq)=>{var Eq=A8(),C8=Object.create||function(){function t(){}return function(e){if(arguments.length!==1)throw Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();function Ps(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}Ps.prototype=C8(Error.prototype);Ps.prototype.constructor=Ps;Ps.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function _8(t){function e(i,s,n,l){return(i|0)*3600+(s|0)*60+(n|0)+(l|0)/1000}var a=t.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!a)return null;if(a[3])return e(a[1],a[2],a[3].replace(":",""),a[4]);else if(a[1]>59)return e(a[1],a[2],0,a[4]);else return e(0,a[1],a[2],a[4])}function e2(){this.values=C8(null)}e2.prototype={set:function(t,e){if(!this.get(t)&&e!=="")this.values[t]=e},get:function(t,e,a){if(a)return this.has(t)?this.values[t]:e[a];return this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,a){for(var i=0;i<a.length;++i)if(e===a[i]){this.set(t,e);break}},integer:function(t,e){if(/^-?\d+$/.test(e))this.set(t,parseInt(e,10))},percent:function(t,e){var a;if(a=e.match(/^([\d]{1,3})(\.[\d]*)?%$/)){if(e=parseFloat(e),e>=0&&e<=100)return this.set(t,e),!0}return!1}};function t2(t,e,a,i){var s=i?t.split(i):[t];for(var n in s){if(typeof s[n]!=="string")continue;var l=s[n].split(a);if(l.length!==2)continue;var f=l[0].trim(),o=l[1].trim();e(f,o)}}function hN(t,e,a){var i=t;function s(){var f=_8(t);if(f===null)throw new Ps(Ps.Errors.BadTimeStamp,"Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),f}function n(f,o){var c=new e2;t2(f,function(u,m){switch(u){case"region":for(var p=a.length-1;p>=0;p--)if(a[p].id===m){c.set(u,a[p].region);break}break;case"vertical":c.alt(u,m,["rl","lr"]);break;case"line":var w=m.split(","),d=w[0];if(c.integer(u,d),c.percent(u,d)&&c.set("snapToLines",!1),c.alt(u,d,["auto"]),w.length===2)c.alt("lineAlign",w[1],["start","center","end"]);break;case"position":if(w=m.split(","),c.percent(u,w[0]),w.length===2)c.alt("positionAlign",w[1],["start","center","end"]);break;case"size":c.percent(u,m);break;case"align":c.alt(u,m,["start","center","end","left","right"]);break}},/:/,/\s/),o.region=c.get("region",null),o.vertical=c.get("vertical","");try{o.line=c.get("line","auto")}catch(u){}o.lineAlign=c.get("lineAlign","start"),o.snapToLines=c.get("snapToLines",!0),o.size=c.get("size",100);try{o.align=c.get("align","center")}catch(u){o.align=c.get("align","middle")}try{o.position=c.get("position","auto")}catch(u){o.position=c.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},o.align)}o.positionAlign=c.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},o.align)}function l(){t=t.replace(/^\s+/,"")}if(l(),e.startTime=s(),l(),t.substr(0,3)!=="-->")throw new Ps(Ps.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+i);t=t.substr(3),l(),e.endTime=s(),l(),n(t,e)}var k8=Eq.createElement&&Eq.createElement("textarea"),cN={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},xq={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},uN={v:"title",lang:"lang"},Uq={rt:"ruby"};function Gq(t,e){function a(){if(!e)return null;function d(k){return e=e.substr(k.length),k}var v=e.match(/^([^<]*)(<[^>]*>?)?/);return d(v[1]?v[1]:v[2])}function i(d){return k8.innerHTML=d,d=k8.textContent,k8.textContent="",d}function s(d,v){return!Uq[v.localName]||Uq[v.localName]===d.localName}function n(d,v){var k=cN[d];if(!k)return null;var y=t.document.createElement(k),B=uN[d];if(B&&v)y[B]=v.trim();return y}var l=t.document.createElement("div"),f=l,o,c=[];while((o=a())!==null){if(o[0]==="<"){if(o[1]==="/"){if(c.length&&c[c.length-1]===o.substr(2).replace(">",""))c.pop(),f=f.parentNode;continue}var u=_8(o.substr(1,o.length-2)),m;if(u){m=t.document.createProcessingInstruction("timestamp",u),f.appendChild(m);continue}var p=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p)continue;if(m=n(p[1],p[3]),!m)continue;if(!s(f,m))continue;if(p[2]){var w=p[2].split(".");w.forEach(function(d){var v=/^bg_/.test(d),k=v?d.slice(3):d;if(xq.hasOwnProperty(k)){var y=v?"background-color":"color",B=xq[k];m.style[y]=B}}),m.className=w.join(" ")}c.push(p[1]),f.appendChild(m),f=m;continue}f.appendChild(t.document.createTextNode(i(o)))}return l}var Iq=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function mN(t){for(var e=0;e<Iq.length;e++){var a=Iq[e];if(t>=a[0]&&t<=a[1])return!0}return!1}function gN(t){var e=[],a="",i;if(!t||!t.childNodes)return"ltr";function s(f,o){for(var c=o.childNodes.length-1;c>=0;c--)f.push(o.childNodes[c])}function n(f){if(!f||!f.length)return null;var o=f.pop(),c=o.textContent||o.innerText;if(c){var u=c.match(/^.*(\n|\r)/);if(u)return f.length=0,u[0];return c}if(o.tagName==="ruby")return n(f);if(o.childNodes)return s(f,o),n(f)}s(e,t);while(a=n(e))for(var l=0;l<a.length;l++)if(i=a.charCodeAt(l),mN(i))return"rtl";return"ltr"}function bN(t){if(typeof t.line==="number"&&(t.snapToLines||t.line>=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;var e=t.track,a=e.textTrackList,i=0;for(var s=0;s<a.length&&a[s]!==e;s++)if(a[s].mode==="showing")i++;return++i*-1}function D5(){}D5.prototype.applyStyles=function(t,e){e=e||this.div;for(var a in t)if(t.hasOwnProperty(a))e.style[a]=t[a]};D5.prototype.formatStyle=function(t,e){return t===0?0:t+e};function M5(t,e,a){D5.call(this),this.cue=e,this.cueDiv=Gq(t,e.text);var i={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(i,this.cueDiv),this.div=t.document.createElement("div"),i={direction:gN(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:a.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv);var s=0;switch(e.positionAlign){case"start":case"line-left":s=e.position;break;case"center":s=e.position-e.size/2;break;case"end":case"line-right":s=e.position-e.size;break}if(e.vertical==="")this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(e.size,"%")});else this.applyStyles({top:this.formatStyle(s,"%"),height:this.formatStyle(e.size,"%")});this.move=function(n){this.applyStyles({top:this.formatStyle(n.top,"px"),bottom:this.formatStyle(n.bottom,"px"),left:this.formatStyle(n.left,"px"),right:this.formatStyle(n.right,"px"),height:this.formatStyle(n.height,"px"),width:this.formatStyle(n.width,"px")})}}M5.prototype=C8(D5.prototype);M5.prototype.constructor=M5;function hs(t){var e,a,i,s;if(t.div){a=t.div.offsetHeight,i=t.div.offsetWidth,s=t.div.offsetTop;var n=(n=t.div.childNodes)&&(n=n[0])&&n.getClientRects&&n.getClientRects();t=t.div.getBoundingClientRect(),e=n?Math.max(n[0]&&n[0].height||0,t.height/n.length):0}this.left=t.left,this.right=t.right,this.top=t.top||s,this.height=t.height||a,this.bottom=t.bottom||s+(t.height||a),this.width=t.width||i,this.lineHeight=e!==void 0?e:t.lineHeight}hs.prototype.move=function(t,e){switch(e=e!==void 0?e:this.lineHeight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e;break}};hs.prototype.overlaps=function(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top};hs.prototype.overlapsAny=function(t){for(var e=0;e<t.length;e++)if(this.overlaps(t[e]))return!0;return!1};hs.prototype.within=function(t){return this.top>=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right};hs.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.left<t.left;case"-x":return this.right>t.right;case"+y":return this.top<t.top;case"-y":return this.bottom>t.bottom}};hs.prototype.intersectPercentage=function(t){var e=Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left)),a=Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top)),i=e*a;return i/(this.height*this.width)};hs.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}};hs.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,a=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,i=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t;var s={left:t.left,right:t.right,top:t.top||i,height:t.height||e,bottom:t.bottom||i+(t.height||e),width:t.width||a};return s};function pN(t,e,a,i){function s(k,y){var B,H=new hs(k),M=1;for(var D=0;D<y.length;D++){while(k.overlapsOppositeAxis(a,y[D])||k.within(a)&&k.overlapsAny(i))k.move(y[D]);if(k.within(a))return k;var T=k.intersectPercentage(a);if(M>T)B=new hs(k),M=T;k=new hs(H)}return B||H}var n=new hs(e),l=e.cue,f=bN(l),o=[];if(l.snapToLines){var c;switch(l.vertical){case"":o=["+y","-y"],c="height";break;case"rl":o=["+x","-x"],c="width";break;case"lr":o=["-x","+x"],c="width";break}var u=n.lineHeight,m=u*Math.round(f),p=a[c]+u,w=o[0];if(Math.abs(m)>p)m=m<0?-1:1,m*=Math.ceil(p/u)*u;if(f<0)m+=l.vertical===""?a.height:a.width,o=o.reverse();n.move(w,m)}else{var d=n.lineHeight/a.height*100;switch(l.lineAlign){case"center":f-=d/2;break;case"end":f-=d;break}switch(l.vertical){case"":e.applyStyles({top:e.formatStyle(f,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(f,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(f,"%")});break}o=["+y","-x","+x","-y"],n=new hs(e)}var v=s(n,o);e.move(v.toCSSCompatValues(a))}function vo(){}vo.StringDecoder=function(){return{decode:function(t){if(!t)return"";if(typeof t!=="string")throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};vo.convertCueToDOMTree=function(t,e){if(!t||!e)return null;return Gq(t,e)};var wN=0.05,jN="sans-serif",dN="1.5%";vo.processCues=function(t,e,a){if(!t||!e||!a)return null;while(a.firstChild)a.removeChild(a.firstChild);var i=t.document.createElement("div");i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin=dN,a.appendChild(i);function s(u){for(var m=0;m<u.length;m++)if(u[m].hasBeenReset||!u[m].displayState)return!0;return!1}if(!s(e)){for(var n=0;n<e.length;n++)i.appendChild(e[n].displayState);return}var l=[],f=hs.getSimpleBoxPosition(i),o=Math.round(f.height*wN*100)/100,c={font:o+"px "+jN};(function(){var u,m;for(var p=0;p<e.length;p++)m=e[p],u=new M5(t,m,c),i.appendChild(u.div),pN(t,u,f,l),m.displayState=u.div,l.push(hs.getSimpleBoxPosition(u))})()};vo.Parser=function(t,e,a){if(!a)a=e,e={};if(!e)e={};this.window=t,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=a||new TextDecoder("utf8"),this.regionList=[]};vo.Parser.prototype={reportOrThrowError:function(t){if(t instanceof Ps)this.onparsingerror&&this.onparsingerror(t);else throw t},parse:function(t){var e=this;if(t)e.buffer+=e.decoder.decode(t,{stream:!0});function a(){var u=e.buffer,m=0;while(m<u.length&&u[m]!=="\r"&&u[m]!==`
@@ -0,0 +1 @@
1
+ import{g as B}from"./chunk-y132jbf0.js";import"./chunk-mw0rc5m7.js";import"./chunk-9jd3d3f3.js";import"./chunk-d1p9qz3y.js";import"./chunk-ea0fh29m.js";import"./chunk-vdn3jymh.js";import"./chunk-wwsvnz4v.js";import"./chunk-8rkp0fc5.js";import"./chunk-cwebycwv.js";import"./chunk-ky3dx324.js";import"./chunk-q11m2cp3.js";import"./chunk-h1hj60fr.js";import"./chunk-2m2saan7.js";import"./chunk-5x1ppya9.js";import"./chunk-5jhrqbk2.js";import"./chunk-zct68gc7.js";import"./chunk-sa4gc1f5.js";import"./chunk-swa43tzr.js";import"./chunk-qwxt1cha.js";import"./chunk-6wa075zh.js";import"./chunk-z5p39kpk.js";import"./chunk-1zpw2mbj.js";import"./chunk-jtwvd0te.js";import"./chunk-8a9k4qj6.js";import{Hh as w,ph as q}from"./chunk-q0dhm16d.js";import"./chunk-6f1twjf6.js";function O(){let{shareId:C,fileId:D}=k.useParams(),{start:E,version:G,compare:H,cmpLeft:J,cmpRight:K,cmpActive:N}=k.useSearch();return q(B,{shareId:C,initialFileId:D,startTime:E,versionId:G,compare:H,compareLeftId:J,compareRightId:K,compareActiveSide:N})}var k=w("/share/$shareId/files/$fileId")({component:O});export{k as Route};