@shumai-one/shumai 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/{chunk-9nyhmtp9.js → chunk-0mmw31pj.js} +2 -2
- package/bin/{chunk-gjn3w26y.js → chunk-0pm8c9bq.js} +2 -2
- package/bin/{chunk-50keqtz9.js → chunk-0qpz48vc.js} +1 -1
- package/bin/{chunk-zjj9qj6y.js → chunk-0zbwpfsk.js} +2 -2
- package/bin/chunk-15jsnygy.js +5 -0
- package/bin/chunk-16s5kfy8.css +1 -0
- package/bin/{chunk-hqkmdp31.js → chunk-21rp4vzr.js} +2 -2
- package/bin/chunk-24ke0th1.css +1 -0
- package/bin/{chunk-260wywfb.js → chunk-28n8xqhm.js} +1 -1
- package/bin/{chunk-7hnw6y6d.js → chunk-2dxd0bar.js} +2 -2
- package/bin/{chunk-3dx0p1ge.js → chunk-2ejky9qv.js} +1 -1
- package/bin/{chunk-dej1gq35.js → chunk-2em77vjv.js} +1 -1
- package/bin/{chunk-zg60j9x2.js → chunk-2q26gz0p.js} +1 -1
- package/bin/{chunk-9s02m95j.js → chunk-2t0asg3w.js} +2 -2
- package/bin/{chunk-rfyaphas.js → chunk-2xaq1y16.js} +2 -2
- package/bin/{chunk-qmpph1gt.js → chunk-33r4w0yv.js} +2 -2
- package/bin/{chunk-1xzc6z02.js → chunk-3bm3be9d.js} +1 -1
- package/bin/{chunk-1sqz0va1.js → chunk-3mx22sn7.js} +2 -2
- package/bin/chunk-4cmw4qmt.js +1 -0
- package/bin/chunk-4d3wm83a.js +2 -0
- package/bin/{chunk-0jkqmbcx.js → chunk-4g4g02e0.js} +1 -1
- package/bin/{chunk-tpp9qf5m.js → chunk-5386brz2.js} +2 -2
- package/bin/{chunk-98j2z6he.js → chunk-5f9fk8x0.js} +3 -3
- package/bin/chunk-5fj5w0gg.js +2 -0
- package/bin/chunk-61bxmjd9.js +2 -0
- package/bin/{chunk-ptw49k86.js → chunk-6pcs8810.js} +1 -1
- package/bin/{chunk-x3ynjbt5.js → chunk-6pmsknnk.js} +2 -2
- package/bin/{chunk-9xhnmnnb.js → chunk-6vwqg1ra.js} +2 -2
- package/bin/{chunk-2mqqghrz.js → chunk-75segwsp.js} +2 -2
- package/bin/{chunk-ftc48rbb.js → chunk-7c85cyn0.js} +3 -3
- package/bin/chunk-7eyg2kgv.js +1 -0
- package/bin/chunk-7r22vcjy.js +2 -0
- package/bin/{chunk-0ycwr0kb.js → chunk-80g5kcm0.js} +1 -1
- package/bin/{chunk-5gtew41y.js → chunk-8bhsdk1v.js} +1 -1
- package/bin/{chunk-1khzycf9.js → chunk-8fsrs7mh.js} +1 -1
- package/bin/chunk-8jfm1j41.js +1 -0
- package/bin/chunk-8n6segk5.js +1 -0
- package/bin/chunk-99f9r6xm.js +2 -0
- package/bin/{chunk-2086rsb2.js → chunk-9acfydwy.js} +1 -1
- package/bin/{chunk-vxpnp4xg.js → chunk-9ntwrvhz.js} +2 -2
- package/bin/{chunk-s0hgykza.js → chunk-agdza65r.js} +2 -2
- package/bin/{chunk-6zs49mef.js → chunk-antsxrw9.js} +1 -1
- package/bin/chunk-bapy3qv8.js +1 -0
- package/bin/chunk-bc2bf144.js +2 -0
- package/bin/{chunk-v8w2nxew.js → chunk-bznz6h19.js} +1 -1
- package/bin/{chunk-qcqw7wnv.js → chunk-c24an5j3.js} +1 -1
- package/bin/chunk-cm74nd4n.js +1 -0
- package/bin/{chunk-87wqbn4g.js → chunk-cynjx7ha.js} +2 -2
- package/bin/chunk-cyq3m4qz.js +1 -0
- package/bin/chunk-ddff7vm3.js +2 -0
- package/bin/{chunk-br5xkaf7.js → chunk-djqs6m7w.js} +3 -3
- package/bin/{chunk-60hpa5kf.js → chunk-dn8k5ef5.js} +1 -1
- package/bin/chunk-dqdqs0d9.js +1 -0
- package/bin/chunk-drjaw6a5.js +14 -0
- package/bin/chunk-drvwchyn.js +2 -0
- package/bin/{chunk-esrtafz0.js → chunk-e4se9q6n.js} +1 -1
- package/bin/chunk-eb551xw7.js +1 -0
- package/bin/{chunk-nvjp2rnh.js → chunk-en96pr5c.js} +2 -2
- package/bin/{chunk-r5dv0rfv.js → chunk-ep138kb3.js} +2 -2
- package/bin/{chunk-jszpvg8e.js → chunk-eqf7k7ax.js} +2 -2
- package/bin/{chunk-f2j2cqd1.js → chunk-f3rqamey.js} +2 -2
- package/bin/{chunk-3kqdgddm.js → chunk-fvwz4mgw.js} +2 -2
- package/bin/chunk-g3p6h6sw.js +68 -0
- package/bin/{chunk-81tb4v5v.js → chunk-h9f55mjv.js} +2 -2
- package/bin/{chunk-n4gghgrj.js → chunk-jfjjh86p.js} +2 -2
- package/bin/{chunk-83k0wa5k.js → chunk-jg31cnqc.js} +2 -2
- package/bin/chunk-jk87gxbb.js +2 -0
- package/bin/{chunk-4bn9eb9h.js → chunk-jqzvazsf.js} +1 -1
- package/bin/chunk-jyk483r4.js +1 -0
- package/bin/{chunk-48nzw50r.js → chunk-k0ysbh3h.js} +1 -1
- package/bin/{chunk-fcs4v6jq.js → chunk-k5yxntns.js} +2 -2
- package/bin/chunk-khjybf4y.js +1 -0
- package/bin/{chunk-38g3s1f3.js → chunk-kmt9fj1z.js} +2 -2
- package/bin/{chunk-503qq6sa.js → chunk-m49ar48r.js} +2 -2
- package/bin/{chunk-a0k1b4sq.js → chunk-m7d52gfe.js} +1 -1
- package/bin/{chunk-x6532q76.js → chunk-mjxay7yv.js} +1 -1
- package/bin/{chunk-zqg4f56h.js → chunk-mp5etccz.js} +1 -1
- package/bin/{chunk-9gzy30zm.js → chunk-n8pas7tj.js} +2 -2
- package/bin/{chunk-b8v7jvkb.js → chunk-nc632fxz.js} +2 -2
- package/bin/{chunk-6fv38qdc.js → chunk-nffrjwb7.js} +2 -2
- package/bin/{chunk-7k3ccca6.js → chunk-p1rrkrn4.js} +1 -1
- package/bin/chunk-p6ep6grv.js +1 -0
- package/bin/{chunk-p4c4z0f2.js → chunk-ph43tgr6.js} +1 -1
- package/bin/{chunk-3xzgddev.js → chunk-pqtwzb3s.js} +1 -1
- package/bin/chunk-q0xv46wa.js +2 -0
- package/bin/{chunk-qh9rz2ee.js → chunk-qhxznkjk.js} +5 -5
- package/bin/chunk-qmja7bsr.js +2 -0
- package/bin/{chunk-v98e3gex.js → chunk-qyegjbzd.js} +1 -1
- package/bin/{chunk-gjdmnfms.js → chunk-r5rf62aa.js} +1 -1
- package/bin/{chunk-2xmsrq7f.js → chunk-rjkj0dr9.js} +2 -2
- package/bin/chunk-rjr8c8be.js +3 -0
- package/bin/{chunk-af6wbhkv.js → chunk-rq4h4p2g.js} +2 -2
- package/bin/{chunk-zwgf211t.js → chunk-scmhhrte.js} +2 -2
- package/bin/chunk-sjr6mvgm.js +78 -0
- package/bin/{chunk-t9t9evan.js → chunk-ssz62jfs.js} +2 -2
- package/bin/{chunk-g60v3jc1.js → chunk-ta02azkp.js} +1 -1
- package/bin/{chunk-tzt4c1dm.js → chunk-tfnh9sk9.js} +2 -2
- package/bin/{chunk-cqq8e3hc.js → chunk-thqahbva.js} +2 -2
- package/bin/chunk-tvzfm7g8.js +2 -0
- package/bin/{chunk-k48y9e5s.js → chunk-twm329fs.js} +1 -1
- package/bin/{chunk-0t8q76ac.js → chunk-ve826t5r.js} +1 -1
- package/bin/chunk-vpfj3q7r.js +1 -0
- package/bin/chunk-vqakgjsf.js +1 -0
- package/bin/chunk-wgjghs54.js +7 -0
- package/bin/chunk-wy1ytxw7.js +41 -0
- package/bin/{chunk-t3tp9trj.js → chunk-x788nk6z.js} +2 -2
- package/bin/{chunk-b3jh3hf1.js → chunk-x8ksced7.js} +2 -2
- package/bin/{chunk-qdycy714.js → chunk-xexxh1zq.js} +1 -1
- package/bin/{chunk-6v39c8eg.js → chunk-xktnqktj.js} +2 -2
- package/bin/{chunk-7872prvg.js → chunk-xpce3j7g.js} +1 -1
- package/bin/{chunk-karn564z.js → chunk-xyzsmjtk.js} +2 -2
- package/bin/chunk-y03s8bkz.js +1 -0
- package/bin/{chunk-kpn9d97x.js → chunk-y5g2ge6f.js} +1 -1
- package/bin/{chunk-qy93r7tm.js → chunk-ygcmv04c.js} +2 -2
- package/bin/{chunk-ytzk81tr.js → chunk-ykarhcph.js} +1 -1
- package/bin/{chunk-bancgvrc.js → chunk-yr8a8nzv.js} +2 -2
- package/bin/chunk-yxtb7xn8.js +2 -0
- package/bin/{chunk-n76r6s9k.js → chunk-zaft3sfe.js} +2 -2
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +237 -215
- package/package.json +7 -7
- package/prisma/migrations/20260814090300_add_asset_agentmd/migration.sql +2 -0
- package/prisma/migrations/20260814125921_create_asset_agentmd_table/migration.sql +21 -0
- package/prisma/schema.prisma +12 -0
- package/bin/chunk-0xern7e4.js +0 -1
- package/bin/chunk-0yngn45x.js +0 -2
- package/bin/chunk-4egayx81.js +0 -2
- package/bin/chunk-4rbzswqs.js +0 -71
- package/bin/chunk-69tt1pvr.js +0 -2
- package/bin/chunk-815ezj20.js +0 -1
- package/bin/chunk-85eg9xqx.js +0 -1
- package/bin/chunk-86aagej8.js +0 -1
- package/bin/chunk-8y1v9dm9.js +0 -2
- package/bin/chunk-9gq9782d.js +0 -1
- package/bin/chunk-bv88se28.css +0 -1
- package/bin/chunk-dv1zpd2p.js +0 -15
- package/bin/chunk-eetrc0j1.js +0 -3
- package/bin/chunk-eztggp8r.js +0 -1
- package/bin/chunk-gf5ds9r9.js +0 -2
- package/bin/chunk-h9emz0zb.js +0 -2
- package/bin/chunk-h9k2atte.js +0 -1
- package/bin/chunk-kkq4wvnc.js +0 -1
- package/bin/chunk-ksx113sp.js +0 -1
- package/bin/chunk-m6a4rzdt.js +0 -62
- package/bin/chunk-mw8f8ngt.js +0 -7
- package/bin/chunk-rvspnthy.js +0 -1
- package/bin/chunk-sjjndwt4.js +0 -2
- package/bin/chunk-tvg9gvqs.js +0 -1
- package/bin/chunk-xp4dcyk3.js +0 -1
- package/bin/chunk-y8aehqr8.js +0 -2
- package/bin/chunk-yvxt48r4.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Nl as I8,Ol as b,Sl as a}from"./chunk-dej1gq35.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{em as I8,fm as b,jm as a}from"./chunk-2em77vjv.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-7872prvg.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-xpce3j7g.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
|
|
44
|
+
export{bW as Dl,mW as El,iW as Fl,i6 as Gl,sU as Hl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Hh as e,Hk as r,Wk as o}from"./chunk-sjr6mvgm.js";function u({className:a,size:t="default",...s}){return e(r.Root,{"data-slot":"avatar","data-size":t,className:o("group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",a),...s})}function l({className:a,...t}){return e(r.Image,{"data-slot":"avatar-image",className:o("aspect-square size-full",a),...t})}function d({className:a,...t}){return e(r.Fallback,{"data-slot":"avatar-fallback",className:o("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",a),...t})}
|
|
2
|
+
export{u as mh,l as nh,d as oh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{X as i,Y as o,Z as p}from"./chunk-jg31cnqc.js";import{$ as b,aa as N0,ga as P5,ha as d0}from"./chunk-yxtb7xn8.js";import{ta as u0}from"./chunk-fvwz4mgw.js";import{Kf as o0,Lf as m5,Mf as F5}from"./chunk-q0xv46wa.js";import{Cg as k5,rg as _5,sg as U5,tg as V5}from"./chunk-g3p6h6sw.js";import{Qg as W0}from"./chunk-rq4h4p2g.js";import{Sg as R0,Tg as x,Yg as S2,bh as G0,gh as G2}from"./chunk-75segwsp.js";import{mh as V0,nh as k0,oh as m0}from"./chunk-5fj5w0gg.js";import{ph as W5,rh as z5,sh as w5,th as M5}from"./chunk-jfjjh86p.js";import{$i as v2,$k as U,Ai as $5,Ak as M0,Dj as Y5,Fh as h,Hh as X,Ih as H,Jh as N5,Ji as u2,Ni as n0,Oh as W2,Qi as J5,Rk as g0,Si as i0,Ti as z0,Ui as b2,Uj as q0,Vi as y2,Wk as F0,Yk as u,al as i2,bk as w0,bl as o2,ci as v0,cl as p2,di as g2,dk as K5,dl as r2,fl as s2,gl as a2,hi as U0,hl as O0,ji as r,jk as h0,lk as Q5,nj as Z5,nk as q5,oj as X5,pi as B2,pk as H5,vk as G5,wk as B5,yi as c0}from"./chunk-sjr6mvgm.js";import{em as j}from"./chunk-2em77vjv.js";function f5(N){let $=N.lastIndexOf(".");if($>0)return[0,$];return[0,N.length]}function B1(N){N.focus();let[$,J]=f5(N.value);if(typeof N.setSelectionRange==="function")N.setSelectionRange($,J);else N.select()}var F2=Symbol.for("immer-nothing"),M2=Symbol.for("immer-draftable"),v=Symbol.for("immer-state");function d(N,...$){throw Error(`[Immer] minified error nr: ${N}. Full error at: https://bit.ly/3cXEKWf`)}var P0=Object.getPrototypeOf;function H0(N){return!!N&&!!N[v]}function Y0(N){if(!N)return!1;return P2(N)||Array.isArray(N)||!!N[M2]||!!N.constructor?.[M2]||A0(N)||b0(N)}var S5=Object.prototype.constructor.toString(),_2=new WeakMap;function P2(N){if(!N||typeof N!=="object")return!1;let $=Object.getPrototypeOf(N);if($===null||$===Object.prototype)return!0;let J=Object.hasOwnProperty.call($,"constructor")&&$.constructor;if(J===Object)return!0;if(typeof J!=="function")return!1;let Z=_2.get(J);if(Z===void 0)Z=Function.toString.call(J),_2.set(J,Z);return Z===S5}function S0(N,$,J=!0){if(x0(N)===0)(J?Reflect.ownKeys(N):Object.keys(N)).forEach((Y)=>{$(Y,N[Y],N)});else N.forEach((Z,Y)=>$(Y,Z,N))}function x0(N){let $=N[v];return $?$.type_:Array.isArray(N)?1:A0(N)?2:b0(N)?3:0}function a0(N,$){return x0(N)===2?N.has($):Object.prototype.hasOwnProperty.call(N,$)}function L2(N,$,J){let Z=x0(N);if(Z===2)N.set($,J);else if(Z===3)N.add(J);else N[$]=J}function T5(N,$){if(N===$)return N!==0||1/N===1/$;else return N!==N&&$!==$}function A0(N){return N instanceof Map}function b0(N){return N instanceof Set}function X0(N){return N.copy_||N.base_}function t0(N,$){if(A0(N))return new Map(N);if(b0(N))return new Set(N);if(Array.isArray(N))return Array.prototype.slice.call(N);let J=P2(N);if($===!0||$==="class_only"&&!J){let Z=Object.getOwnPropertyDescriptors(N);delete Z[v];let Y=Reflect.ownKeys(Z);for(let q=0;q<Y.length;q++){let K=Y[q],Q=Z[K];if(Q.writable===!1)Q.writable=!0,Q.configurable=!0;if(Q.get||Q.set)Z[K]={configurable:!0,writable:!0,enumerable:Q.enumerable,value:N[K]}}return Object.create(P0(N),Z)}else{let Z=P0(N);if(Z!==null&&J)return{...N};let Y=Object.create(Z);return Object.assign(Y,N)}}function Z2(N,$=!1){if(y0(N)||H0(N)||!Y0(N))return N;if(x0(N)>1)Object.defineProperties(N,{set:f0,add:f0,clear:f0,delete:f0});if(Object.freeze(N),$)Object.values(N).forEach((J)=>Z2(J,!0));return N}function E5(){d(2)}var f0={value:E5};function y0(N){if(N===null||typeof N!=="object")return!0;return Object.isFrozen(N)}var x5={};function K0(N){let $=x5[N];if(!$)d(0,N);return $}var L0;function C2(){return L0}function b5(N,$){return{drafts_:[],parent_:N,immer_:$,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function U2(N,$){if($)K0("Patches"),N.patches_=[],N.inversePatches_=[],N.patchListener_=$}function e0(N){N2(N),N.drafts_.forEach(y5),N.drafts_=null}function N2(N){if(N===L0)L0=N.parent_}function V2(N){return L0=b5(L0,N)}function y5(N){let $=N[v];if($.type_===0||$.type_===1)$.revoke_();else $.revoked_=!0}function k2(N,$){$.unfinalizedDrafts_=$.drafts_.length;let J=$.drafts_[0];if(N!==void 0&&N!==J){if(J[v].modified_)e0($),d(4);if(Y0(N)){if(N=T0($,N),!$.parent_)E0($,N)}if($.patches_)K0("Patches").generateReplacementPatches_(J[v].base_,N,$.patches_,$.inversePatches_)}else N=T0($,J,[]);if(e0($),$.patches_)$.patchListener_($.patches_,$.inversePatches_);return N!==F2?N:void 0}function T0(N,$,J){if(y0($))return $;let Z=N.immer_.shouldUseStrictIteration(),Y=$[v];if(!Y)return S0($,(q,K)=>m2(N,Y,$,q,K,J),Z),$;if(Y.scope_!==N)return $;if(!Y.modified_)return E0(N,Y.base_,!0),Y.base_;if(!Y.finalized_){Y.finalized_=!0,Y.scope_.unfinalizedDrafts_--;let q=Y.copy_,K=q,Q=!1;if(Y.type_===3)K=new Set(q),q.clear(),Q=!0;if(S0(K,(W,z)=>m2(N,Y,q,W,z,J,Q),Z),E0(N,q,!1),J&&N.patches_)K0("Patches").generatePatches_(Y,J,N.patches_,N.inversePatches_)}return Y.copy_}function m2(N,$,J,Z,Y,q,K){if(Y==null)return;if(typeof Y!=="object"&&!K)return;let Q=y0(Y);if(Q&&!K)return;if(H0(Y)){let W=q&&$&&$.type_!==3&&!a0($.assigned_,Z)?q.concat(Z):void 0,z=T0(N,Y,W);if(L2(J,Z,z),H0(z))N.canAutoFreeze_=!1;else return}else if(K)J.add(Y);if(Y0(Y)&&!Q){if(!N.immer_.autoFreeze_&&N.unfinalizedDrafts_<1)return;if($&&$.base_&&$.base_[Z]===Y&&Q)return;if(T0(N,Y),(!$||!$.scope_.parent_)&&typeof Z!=="symbol"&&(A0(J)?J.has(Z):Object.prototype.propertyIsEnumerable.call(J,Z)))E0(N,Y)}}function E0(N,$,J=!1){if(!N.parent_&&N.immer_.autoFreeze_&&N.canAutoFreeze_)Z2($,J)}function v5(N,$){let J=Array.isArray(N),Z={type_:J?1:0,scope_:$?$.scope_:C2(),modified_:!1,finalized_:!1,assigned_:{},parent_:$,base_:N,draft_:null,copy_:null,revoke_:null,isManual_:!1},Y=Z,q=X2;if(J)Y=[Z],q=C0;let{revoke:K,proxy:Q}=Proxy.revocable(Y,q);return Z.draft_=Q,Z.revoke_=K,Q}var X2={get(N,$){if($===v)return N;let J=X0(N);if(!a0(J,$))return D5(N,J,$);let Z=J[$];if(N.finalized_||!Y0(Z))return Z;if(Z===r0(N.base_,$))return s0(N),N.copy_[$]=J2(Z,N);return Z},has(N,$){return $ in X0(N)},ownKeys(N){return Reflect.ownKeys(X0(N))},set(N,$,J){let Z=A2(X0(N),$);if(Z?.set)return Z.set.call(N.draft_,J),!0;if(!N.modified_){let Y=r0(X0(N),$),q=Y?.[v];if(q&&q.base_===J)return N.copy_[$]=J,N.assigned_[$]=!1,!0;if(T5(J,Y)&&(J!==void 0||a0(N.base_,$)))return!0;s0(N),$2(N)}if(N.copy_[$]===J&&(J!==void 0||($ in N.copy_))||Number.isNaN(J)&&Number.isNaN(N.copy_[$]))return!0;return N.copy_[$]=J,N.assigned_[$]=!0,!0},deleteProperty(N,$){if(r0(N.base_,$)!==void 0||$ in N.base_)N.assigned_[$]=!1,s0(N),$2(N);else delete N.assigned_[$];if(N.copy_)delete N.copy_[$];return!0},getOwnPropertyDescriptor(N,$){let J=X0(N),Z=Reflect.getOwnPropertyDescriptor(J,$);if(!Z)return Z;return{writable:!0,configurable:N.type_!==1||$!=="length",enumerable:Z.enumerable,value:J[$]}},defineProperty(){d(11)},getPrototypeOf(N){return P0(N.base_)},setPrototypeOf(){d(12)}},C0={};S0(X2,(N,$)=>{C0[N]=function(){return arguments[0]=arguments[0][0],$.apply(this,arguments)}});C0.deleteProperty=function(N,$){return C0.set.call(this,N,$,void 0)};C0.set=function(N,$,J){return X2.set.call(this,N[0],$,J,N[0])};function r0(N,$){let J=N[v];return(J?X0(J):N)[$]}function D5(N,$,J){let Z=A2($,J);return Z?"value"in Z?Z.value:Z.get?.call(N.draft_):void 0}function A2(N,$){if(!($ in N))return;let J=P0(N);while(J){let Z=Object.getOwnPropertyDescriptor(J,$);if(Z)return Z;J=P0(J)}return}function $2(N){if(!N.modified_){if(N.modified_=!0,N.parent_)$2(N.parent_)}}function s0(N){if(!N.copy_)N.copy_=t0(N.base_,N.scope_.immer_.useStrictShallowCopy_)}var j5=class{constructor(N){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=($,J,Z)=>{if(typeof $==="function"&&typeof J!=="function"){let q=J;J=$;let K=this;return function(W=q,...z){return K.produce(W,(w)=>J.call(this,w,...z))}}if(typeof J!=="function")d(6);if(Z!==void 0&&typeof Z!=="function")d(7);let Y;if(Y0($)){let q=V2(this),K=J2($,void 0),Q=!0;try{Y=J(K),Q=!1}finally{if(Q)e0(q);else N2(q)}return U2(q,Z),k2(Y,q)}else if(!$||typeof $!=="object"){if(Y=J($),Y===void 0)Y=$;if(Y===F2)Y=void 0;if(this.autoFreeze_)Z2(Y,!0);if(Z){let q=[],K=[];K0("Patches").generateReplacementPatches_($,Y,q,K),Z(q,K)}return Y}else d(1,$)},this.produceWithPatches=($,J)=>{if(typeof $==="function")return(K,...Q)=>this.produceWithPatches(K,(W)=>$(W,...Q));let Z,Y;return[this.produce($,J,(K,Q)=>{Z=K,Y=Q}),Z,Y]},typeof N?.autoFreeze==="boolean")this.setAutoFreeze(N.autoFreeze);if(typeof N?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(N.useStrictShallowCopy);if(typeof N?.useStrictIteration==="boolean")this.setUseStrictIteration(N.useStrictIteration)}createDraft(N){if(!Y0(N))d(8);if(H0(N))N=h5(N);let $=V2(this),J=J2(N,void 0);return J[v].isManual_=!0,N2($),J}finishDraft(N,$){let J=N&&N[v];if(!J||!J.isManual_)d(9);let{scope_:Z}=J;return U2(Z,$),k2(void 0,Z)}setAutoFreeze(N){this.autoFreeze_=N}setUseStrictShallowCopy(N){this.useStrictShallowCopy_=N}setUseStrictIteration(N){this.useStrictIteration_=N}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(N,$){let J;for(J=$.length-1;J>=0;J--){let Y=$[J];if(Y.path.length===0&&Y.op==="replace"){N=Y.value;break}}if(J>-1)$=$.slice(J+1);let Z=K0("Patches").applyPatches_;if(H0(N))return Z(N,$);return this.produce(N,(Y)=>Z(Y,$))}};function J2(N,$){let J=A0(N)?K0("MapSet").proxyMap_(N,$):b0(N)?K0("MapSet").proxySet_(N,$):v5(N,$);return($?$.scope_:C2()).drafts_.push(J),J}function h5(N){if(!H0(N))d(10,N);return R2(N)}function R2(N){if(!Y0(N)||y0(N))return N;let $=N[v],J,Z=!0;if($){if(!$.modified_)return $.base_;$.finalized_=!0,J=t0(N,$.scope_.immer_.useStrictShallowCopy_),Z=$.scope_.immer_.shouldUseStrictIteration()}else J=t0(N,!0);if(S0(J,(Y,q)=>{L2(J,Y,R2(q))},Z),$)$.finalized_=!1;return J}var c5=new j5,O2=c5.produce;var n5=(N)=>($,J,Z)=>{return Z.setState=(Y,q,...K)=>{let Q=typeof Y==="function"?O2(Y):Y;return $(Q,q,...K)},N(Z.setState,J,Z)},I2=n5;var D0=v0()(g2(I2((N,$)=>({members:[],loading:!1,fetchMembers:async(J,Z,Y)=>{if(!Y&&$().loadedTeamId===J&&$().loadedWithAgents===Z)return;N({loading:!0});try{let q=await r.api.teams[":teamId"].members.$get({param:{teamId:J},query:{includeAgents:Z?"true":"false"}});if(!q.ok)throw Error("failed to fetch members");let K=await q.json();N({members:K||[],loadedTeamId:J,loadedWithAgents:Z,loading:!1})}catch{N({loading:!1})}}}))));var a=v0((N)=>({fields:[],loadedProjectId:null,setFields:($,J)=>N({fields:$,loadedProjectId:J}),updateFields:($)=>N({fields:$})}));function Y2(N,$,J){let Z=x(N,J?.in);if(isNaN($))return R0(J?.in||N,NaN);if(!$)return Z;let Y=Z.getDate(),q=R0(J?.in||N,Z.getTime());q.setMonth(Z.getMonth()+$+1,0);let K=q.getDate();if(Y>=K)return q;else return Z.setFullYear(q.getFullYear(),q.getMonth(),Y),Z}function f2(N,$){let J=x(N,$?.in),Z=J.getMonth();return J.setFullYear(J.getFullYear(),Z+1,0),J.setHours(23,59,59,999),J}function T2(N,$){let[J,Z]=S2(N,$.start,$.end);return{start:J,end:Z}}function E2(N,$){let{start:J,end:Z}=T2($?.in,N),Y=+J>+Z,q=Y?+J:+Z,K=Y?Z:J;K.setHours(0,0,0,0);let Q=$?.step??1;if(!Q)return[];if(Q<0)Q=-Q,Y=!Y;let W=[];while(+K<=q)W.push(R0(J,K)),K.setDate(K.getDate()+Q),K.setHours(0,0,0,0);return Y?W.reverse():W}function j0(N,$){return x(N,$?.in).getDate()}function x2(N,$){return x(N,$?.in).getDay()}function K2(N,$){return x(N,$?.in).getHours()}function Q2(N,$){return x(N,$?.in).getMinutes()}function q2(N,$){return x(N,$?.in).getMonth()}function H2(N,$){return x(N,$?.in).getFullYear()}var t=j(h(),1);var d5=({value:N,config:$,onSave:J,readOnly:Z})=>{let Y=$?.date,[q,K]=t.useState(!1),Q=t.useRef(null),W=N?new Date(N):new Date,z=G0(W)?W:new Date,[w,M]=t.useState(z);t.useEffect(()=>{if(q&&N){let k=new Date(N);if(G0(k))M(k)}},[q,N]),t.useEffect(()=>{let k=(B)=>{if(Q.current&&!Q.current.contains(B.target)){if(q)K(!1)}};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[q]);let F=()=>{if(!Z)K(!0)},A=(k)=>{if(!k)return"";let B=new Date(k);if(!G0(B))return"Invalid Date";let P="PPP";if(Y?.displayFormat==="usa")P="MM/dd/yyyy";else if(Y?.displayFormat==="euro")P="dd/MM/yyyy";else if(Y?.displayFormat==="iso")P="yyyy-MM-dd";if(Y?.includeTime)if(Y?.timeFormat==="twenty_four_hour")P+=" HH:mm";else P+=" p";let g=G2(B,P);if(Y?.displayTimezone)g+=` (${Intl.DateTimeFormat().resolvedOptions().timeZone})`;return g},G=new Date(w.getFullYear(),w.getMonth(),1),L=f2(w),O=E2({start:G,end:L}),T=x2(G),V=(k)=>{let B=new Date(k);if(Y?.includeTime)B.setHours(K2(z)),B.setMinutes(Q2(z));let P=B.toISOString();if(J(P),!Y?.includeTime)K(!1)},I=(k,B)=>{let P=N?new Date(N):new Date;if(!G0(P))P.setTime(new Date().getTime());if(k==="hour")P.setHours(B);if(k==="minute")P.setMinutes(B);let g=P.toISOString();J(g)},m=Array.from({length:24},(k,B)=>B),E=Array.from({length:12},(k,B)=>B*5);if(q)return H("div",{className:"relative w-full",ref:Q,children:[X("div",{className:"w-full px-2 py-1 border border-ring rounded bg-background text-sm shadow-sm min-h-[28px] flex items-center",children:N?A(N):X("span",{className:"text-muted-foreground",children:"Select date..."})}),H("div",{className:"absolute z-50 top-full left-0 mt-1 bg-popover border border-border rounded-lg shadow-xl flex flex-col md:flex-row overflow-hidden min-w-[280px]",children:[H("div",{className:"p-4 w-64",children:[H("div",{className:"flex justify-between items-center mb-4",children:[X("button",{onClick:()=>M(Y2(w,-1)),className:"p-1 hover:bg-accent rounded",children:X(b2,{className:"w-4 h-4"})}),X("span",{className:"font-semibold text-sm",children:G2(w,"MMMM yyyy")}),X("button",{onClick:()=>M(Y2(w,1)),className:"p-1 hover:bg-accent rounded",children:X(y2,{className:"w-4 h-4"})})]}),X("div",{className:"grid grid-cols-7 gap-1 text-center text-xs mb-2 text-muted-foreground",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map((k)=>X("div",{children:k},k))}),H("div",{className:"grid grid-cols-7 gap-1 text-center text-sm",children:[Array.from({length:T}).map((k,B)=>X("div",{},`empty-${B}`)),O.map((k)=>{let B=N?new Date(N):null,P=B&&G0(B)&&j0(B)===j0(k)&&q2(B)===q2(k)&&H2(B)===H2(k);return X("button",{onClick:()=>V(k),className:`w-8 h-8 rounded-full flex items-center justify-center hover:bg-accent transition-colors ${P?"bg-primary text-primary-foreground hover:bg-primary/90":"text-foreground"}`,children:j0(k)},k.toString())})]})]}),Y?.includeTime&&H("div",{className:"border-l border-border bg-muted w-32 flex flex-col",children:[H("div",{className:"p-2 border-b border-border text-xs font-semibold text-muted-foreground flex items-center justify-center gap-1",children:[X(v2,{className:"w-3 h-3"})," Time"]}),H("div",{className:"flex flex-1 h-64",children:[X("div",{className:"flex-1 overflow-y-auto scrollbar-hide border-r border-border",children:m.map((k)=>X("div",{onClick:()=>I("hour",k),className:`px-2 py-1 text-center text-sm cursor-pointer hover:bg-accent ${K2(z)===k?"bg-primary/10 font-medium text-primary":""}`,children:k.toString().padStart(2,"0")},k))}),X("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:E.map((k)=>X("div",{onClick:()=>I("minute",k),className:`px-2 py-1 text-center text-sm cursor-pointer hover:bg-accent ${Q2(z)===k?"bg-primary/10 font-medium text-primary":""}`,children:k.toString().padStart(2,"0")},k))})]})]})]})]});return X("div",{onClick:F,className:`w-full min-h-[28px] px-2 py-1 text-sm text-foreground rounded border border-transparent transition-colors ${!Z?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:N?A(N):X("span",{className:"text-muted-foreground italic",children:"Empty"})})},D2=d5;var l=j(h(),1);var l5=({value:N,onSave:$,readOnly:J})=>{let[Z,Y]=l.useState(!1),[q,K]=l.useState(N||""),Q=l.useRef(null),W=l.useRef(null),[z,w]=l.useState(!1);l.useEffect(()=>{K(N||"")},[N]),l.useEffect(()=>{if(Z&&Q.current)Q.current.focus(),w(!1)},[Z]),l.useEffect(()=>{let G=(L)=>{if(z&&W.current&&!W.current.contains(L.target))w(!1)};if(z)document.addEventListener("mousedown",G);return()=>{document.removeEventListener("mousedown",G)}},[z]);let M=()=>{Y(!1),$(q)},F=(G)=>{G.stopPropagation(),w(!0)},A=(G)=>{if(G.stopPropagation(),!J)Y(!0)};if(Z)return X("textarea",{ref:Q,value:q,onChange:(G)=>K(G.target.value),onBlur:M,className:"w-full min-h-[80px] p-2 border border-ring rounded bg-background text-sm outline-none shadow-sm resize-none"});return H("div",{ref:W,className:"relative w-full text-sm",children:[X("div",{onClick:F,className:`w-full text-foreground rounded border border-transparent transition-all px-2 py-1 h-[48px] line-clamp-2 whitespace-pre-wrap overflow-hidden ${!J?"cursor-pointer hover:bg-accent hover:border-border":"cursor-pointer"}`,title:"Click to expand",children:N?N:X("span",{className:"text-muted-foreground italic",children:"Empty"})}),z&&X("div",{onClick:A,className:`absolute top-0 left-0 w-full min-h-full h-auto z-50 bg-background border border-ring rounded shadow-lg px-2 py-1 whitespace-pre-wrap ${!J?"cursor-text":""}`,children:N?N:X("span",{className:"text-muted-foreground italic",children:"Empty"})})]})},j2=l5;var e=j(h(),1);var u5=({value:N,config:$,onSave:J,readOnly:Z})=>{let Y=$?.number,[q,K]=e.useState(!1),[Q,W]=e.useState(""),z=e.useRef(null);e.useEffect(()=>{W(N!==void 0&&N!==null?N.toString():"")},[N]),e.useEffect(()=>{if(q&&z.current)z.current.focus()},[q]);let w=()=>{if(!Z)K(!0)},M=()=>{if(K(!1),Q==="")J(void 0);else{let G=parseFloat(Q);J(isNaN(G)?void 0:G)}},F=(G)=>{if(G.key==="Enter")G.stopPropagation(),z.current?.blur()},A=(G)=>{if(G===void 0||G===null||isNaN(G))return"";return G.toFixed(Y?.scale)};if(q)return X("input",{ref:z,type:"number",step:1/Math.pow(10,Y?.scale||0),value:Q,onChange:(G)=>W(G.target.value),onBlur:M,onKeyDown:F,onDoubleClick:(G)=>G.stopPropagation(),className:"w-full px-2 py-1 border border-ring rounded bg-background text-sm outline-none shadow-sm text-left font-mono"});return X("div",{onClick:w,onDoubleClick:(G)=>G.stopPropagation(),className:`w-full min-h-[28px] px-2 py-1 text-sm text-foreground rounded border border-transparent transition-colors text-left font-mono ${!Z?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:N!==void 0&&N!==null?A(N):X("span",{className:"text-muted-foreground italic font-sans text-left block",children:"Empty"})})},h2=u5;var c2=j(h(),1);var i5=({value:N,config:$,onSave:J,readOnly:Z})=>{let Y=$?.rating,q=Math.max(2,Math.min(6,Y?.maxValue||5)),[K,Q]=c2.useState(null),W=(w,M)=>{if(w.stopPropagation(),Z)return;let F;if(N===M)F=0;else F=M;J(F)},z=Array.from({length:q},(w,M)=>M+1);return X("div",{className:"flex items-center gap-1 h-[28px]",onMouseLeave:()=>!Z&&Q(null),onDoubleClick:(w)=>w.stopPropagation(),children:z.map((w)=>{let M=K!==null?w<=K:w<=(N||0);return X("button",{onClick:(F)=>W(F,w),onMouseEnter:()=>!Z&&Q(w),className:`focus:outline-none transition-transform ${!Z?"cursor-pointer hover:scale-110":"cursor-default"}`,type:"button",disabled:Z,children:X(h0,{className:`w-5 h-5 transition-colors ${M?"fill-yellow-400 text-yellow-400":"fill-muted text-muted-foreground/30"}`})},w)})})},n2=i5;var w2=j(h(),1);var Q0;(function(N){N.Base32IncorrectEncoding="B32_ENC_INVALID",N.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",N.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",N.EncodeTimeNegative="ENC_TIME_NEG",N.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",N.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",N.PRNGDetectFailure="PRNG_DETECT",N.ULIDInvalid="ULID_INVALID",N.Unexpected="UNEXPECTED",N.UUIDInvalid="UUID_INVALID"})(Q0||(Q0={}));class B0 extends Error{constructor(N,$){super(`${$} (${N})`);this.name="ULIDError",this.code=N}}function o5(N){let $=Math.floor(N()*32)%32;return"0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt($)}function p5(N){let $=r5(),J=$&&($.crypto||$.msCrypto)||null;if(typeof J?.getRandomValues==="function")return()=>{let Z=new Uint8Array(1);return J.getRandomValues(Z),Z[0]/256};else if(typeof J?.randomBytes==="function")return()=>J.randomBytes(1).readUInt8()/256;throw new B0(Q0.PRNGDetectFailure,"Failed to find a reliable PRNG")}function r5(){if(t5())return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof globalThis<"u")return globalThis;return null}function s5(N,$){let J="";for(;N>0;N--)J=o5($)+J;return J}function a5(N,$=10){if(isNaN(N))throw new B0(Q0.EncodeTimeValueMalformed,`Time must be a number: ${N}`);else if(N>281474976710655)throw new B0(Q0.EncodeTimeSizeExceeded,`Cannot encode a time larger than 281474976710655: ${N}`);else if(N<0)throw new B0(Q0.EncodeTimeNegative,`Time must be positive: ${N}`);else if(Number.isInteger(N)===!1)throw new B0(Q0.EncodeTimeValueMalformed,`Time must be an integer: ${N}`);let J,Z="";for(let Y=$;Y>0;Y--)J=N%32,Z="0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(J)+Z,N=(N-J)/32;return Z}function t5(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function d2(N,$){let J=$||p5(),Z=!N||isNaN(N)?Date.now():N;return a5(Z,10)+s5(16,J)}function e5(N,$,J){let Z=N.slice();return Z.splice(J,0,Z.splice($,1)[0]),Z}function l2(N,$,J,Z){if(J===Z)return N;let Y=e5($,J,Z),q=new Set($.map((Q)=>Q.id)),K=0;return N.map((Q)=>q.has(Q.id)?Y[K++]:Q)}async function q4(N){let $=[],J=[],Z=N.items;if(Z)for(let K=0;K<Z.length;K++){let Q=Z[K];if(Q.kind==="file"){let W=Q.webkitGetAsEntry?.();if(W)J.push({entry:W,path:""})}}else return Array.from(N.files);let Y=(K)=>{return new Promise((Q)=>{K.readEntries((W)=>Q(W),()=>Q([]))})},q=(K)=>{return new Promise((Q,W)=>{K.file((z)=>Q(z),(z)=>W(z))})};while(J.length>0){let K=J.shift();if(!K)continue;let{entry:Q,path:W}=K;if(Q.isFile)try{let z=await q(Q),w=W?`${W}/${z.name}`:z.name;Object.defineProperty(z,"webkitRelativePath",{value:w,writable:!1,configurable:!0}),$.push(z)}catch(z){console.error("Error reading file entry:",z)}else if(Q.isDirectory){let z=Q.createReader(),w=[],M=await Y(z);while(M.length>0)w=w.concat(M),M=await Y(z);let F=W?`${W}/${Q.name}`:Q.name;for(let A of w)J.push({entry:A,path:F})}}return $}var c=j(h(),1);var t2=j(h(),1);function e2(){let[N,$]=t2.useState(!1);return H(i2,{open:N,onOpenChange:$,children:[X(o2,{asChild:!0,children:H(u,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-transparent text-muted-foreground hover:text-foreground inline-flex items-center justify-center shrink-0 ml-1",title:U.autofill_source_help_title(),children:[X(B2,{className:"h-3.5 w-3.5"}),X("span",{className:"sr-only",children:U.autofill_source_help_title()})]})}),H(p2,{className:"sm:max-w-[500px]",children:[H(r2,{children:[H(s2,{className:"flex items-center gap-2",children:[X(B2,{className:"h-5 w-5 text-muted-foreground"}),U.autofill_source_help_title()]}),X(a2,{children:U.autofill_source_help_desc()})]}),H("div",{className:"space-y-4 py-2",children:[H("div",{className:"rounded-lg border p-3.5 space-y-1.5 bg-muted/30",children:[H("div",{className:"flex items-center gap-2 font-medium text-sm",children:[X(u2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),X("span",{children:U.autofill_source_none()})]}),X("p",{className:"text-xs text-muted-foreground leading-relaxed",children:U.autofill_source_none_desc()}),X("p",{className:"text-xs italic text-muted-foreground/80",children:U.autofill_source_none_example()})]}),H("div",{className:"rounded-lg border p-3.5 space-y-1.5 bg-muted/30",children:[H("div",{className:"flex items-center gap-2 font-medium text-sm",children:[X(c0,{className:"h-4 w-4 text-amber-500 shrink-0"}),X("span",{children:U.autofill_source_content()})]}),X("p",{className:"text-xs text-muted-foreground leading-relaxed",children:U.autofill_source_content_desc()}),X("p",{className:"text-xs italic text-muted-foreground/80",children:U.autofill_source_content_example()})]}),H("div",{className:"rounded-lg border p-3.5 space-y-1.5 bg-muted/30",children:[H("div",{className:"flex items-center gap-2 font-medium text-sm",children:[X(n0,{className:"h-4 w-4 text-blue-500 shrink-0"}),X("span",{children:U.autofill_source_creation_context()})]}),X("p",{className:"text-xs text-muted-foreground leading-relaxed",children:U.autofill_source_creation_context_desc()}),X("p",{className:"text-xs italic text-muted-foreground/80",children:U.autofill_source_creation_context_example()})]})]})]})]})}var l0=["red","orange","yellow","green","blue","purple","gray"],z2={red:{bg:"rgba(239, 68, 68, 0.15)",text:"#ef4444",hex:"#ef4444"},orange:{bg:"rgba(249, 115, 22, 0.15)",text:"#f97316",hex:"#f97316"},yellow:{bg:"rgba(234, 179, 8, 0.15)",text:"#ca8a04",hex:"#eab308"},green:{bg:"rgba(34, 197, 94, 0.15)",text:"#16a34a",hex:"#22c55e"},blue:{bg:"rgba(59, 130, 246, 0.15)",text:"#2563eb",hex:"#3b82f6"},purple:{bg:"rgba(168, 85, 247, 0.15)",text:"#9333ea",hex:"#a855f7"},gray:{bg:"rgba(128, 128, 128, 0.15)",text:"#4b5563",hex:"#808080"},system:{bg:"rgba(128, 128, 128, 0.1)",text:"#6b7280",hex:"#808080"}};function _0(N){if(!N)return{backgroundColor:"rgba(128, 128, 128, 0.1)",color:"#6b7280"};let $=N.toLowerCase(),J=z2[$];if(J)return{backgroundColor:J.bg,color:J.text};if(N.startsWith("#"))return{backgroundColor:`${N}33`,color:N};return{backgroundColor:"rgba(128, 128, 128, 0.1)",color:N}}function I0(N=[]){let $=new Set(N.map((Z)=>Z.color?.toLowerCase()).filter(Boolean)),J=l0.filter((Z)=>!$.has(Z.toLowerCase()));if(J.length>0)return J[Math.floor(Math.random()*J.length)];return l0[Math.floor(Math.random()*l0.length)]}var N1={[b.text]:H5,[b.longText]:$5,[b.select]:Y5,[b.selectMulti]:Q5,[b.rating]:h0,[b.number]:X5,[b.toggle]:q5,[b.date]:J5,[b.user]:G5,[b.userMulti]:B5};function $1({field:N,index:$,onVisibilityChange:J}){let{ref:Z,handleRef:Y}=F5({id:N.id,index:$}),q=N.config?.type?N1[N.config.type]:null;return H("div",{ref:Z,className:"flex items-center justify-between p-2 rounded-md hover:bg-muted",children:[H("div",{className:"flex items-center gap-2",children:[X("div",{ref:Y,className:"cursor-grab",children:X(Z5,{className:"h-4 w-4 text-muted-foreground"})}),q&&X(q,{className:"h-4 w-4 text-muted-foreground shrink-0"}),N.config?.autofillSource===N0.CONTENT&&X(c0,{className:"h-4 w-4 text-muted-foreground shrink-0"}),N.config?.autofillSource===N0.CREATION_CONTEXT&&X(n0,{className:"h-4 w-4 text-muted-foreground shrink-0"}),X("span",{className:"text-sm truncate",children:N.config?.name})]}),X(u0,{checked:N.visible,onCheckedChange:(K)=>J(N.id,K)})]})}function b4({projectId:N,onManageFields:$,onSave:J}){let{fields:Z,updateFields:Y}=a(),[q,K]=c.useState(""),[Q,W]=c.useState("list"),[z,w]=c.useState(""),[M,F]=c.useState(""),[A,G]=c.useState(N0.NONE),[L,O]=c.useState(""),[T,V]=c.useState([]),I=N5();c.useEffect(()=>{I.invalidateQueries({queryKey:["fields",N]})},[N,I]);let m=r.api.projects[":projectId"].fields.order.$patch,{mutate:E}=W2({mutationFn:async(_)=>{if(!(await m(_)).ok)throw Error(U.failed_update_fields_order());return null}}),k=r.api.projects[":projectId"].fields.$post,{mutate:B}=W2({mutationFn:async(_)=>{let R=await k(_);if(!R.ok)throw Error(U.failed_create_field());return await R.json()},onSuccess:(_)=>{let R={..._,visible:!0},S=[...Z,R];Y(S),w(""),V([]),E({param:{projectId:N},json:S.map((C)=>({fieldId:C.id,visible:C.visible||!1}))}),J?.()}}),P=c.useMemo(()=>Z.filter((_)=>_.config?.name?.toLowerCase().includes(q.toLowerCase())),[Z,q]),g=(_)=>{if(_.canceled)return;let{source:R}=_.operation;if(!m5(R))return;let{initialIndex:S,index:C}=R;if(S===C)return;let n=l2(Z,P,S,C);Y(n),E({param:{projectId:N},json:n.map((Z0)=>({fieldId:Z0.id,visible:Z0.visible||!1}))})},y=(_,R)=>{let S=Z.map((C)=>C.id===_?{...C,visible:R}:C);Y(S),E({param:{projectId:N},json:S.map((C)=>({fieldId:C.id,visible:C.visible||!1}))})},f=()=>{if(!z||!M)return;let _=M===b.select?{select:{options:T}}:M===b.selectMulti?{selectMulti:{options:T}}:{};B({param:{projectId:N},json:{config:{name:z,type:M,autofillSource:A,..._},label:z,description:L}})},D=Z.filter((_)=>_.visible).length;if(Q==="create")return X("div",{className:"w-80 p-4",children:H("div",{className:"space-y-4",children:[H("div",{className:"space-y-2",children:[X(W0,{htmlFor:"field-name",children:U.field_name()}),X(O0,{id:"field-name",placeholder:U.new_field_placeholder(),value:z,onChange:(_)=>w(_.target.value),autoFocus:!0})]}),H("div",{className:"space-y-2",children:[X(W0,{children:U.field_type()}),H(W5,{children:[X(z5,{asChild:!0,children:H(u,{variant:"outline",className:"w-full justify-between font-normal",children:[M?X("span",{className:"capitalize",children:M.replace(/_/g," ")}):X("span",{className:"text-muted-foreground border-dashed",children:U.select_field_type()}),X(z0,{className:"ml-2 h-4 w-4 opacity-50"})]})}),X(w5,{className:"w-[--radix-dropdown-menu-trigger-width]",children:Object.values(b).map((_)=>X(M5,{onClick:()=>{F(_),V([])},className:"capitalize",children:_.replace(/_/g," ")},_))})]})]}),H("div",{className:"space-y-2",children:[X(W0,{htmlFor:"field-desc",children:U.description()}),X(O0,{id:"field-desc",placeholder:U.description_optional_placeholder(),value:L,onChange:(_)=>O(_.target.value)})]}),H("div",{className:"space-y-2",children:[H("div",{className:"flex items-center gap-1",children:[X(W0,{children:U.autofill_source()}),X(e2,{})]}),H(P5,{type:"single",value:A,onValueChange:(_)=>{if(_)G(_)},className:"w-full grid grid-cols-3 border rounded-md p-1 gap-1",children:[X(d0,{value:N0.NONE,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:U.autofill_source_none()}),X(d0,{value:N0.CONTENT,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:U.autofill_source_content()}),X(d0,{value:N0.CREATION_CONTEXT,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:U.autofill_source_creation_context()})]})]}),(M===b.select||M===b.selectMulti)&&H("div",{className:"space-y-2",children:[H("div",{className:"flex items-center justify-between",children:[X(W0,{className:"text-sm font-medium",children:U.options()}),H(u,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{let _={id:d2(),displayName:U.new_option(),color:I0(T)};V([...T,_])},children:[X(q0,{className:"h-4 w-4 mr-1"})," ",U.add_option()]})]}),X("div",{className:"space-y-2 max-h-40 overflow-y-auto pr-1",children:T.map((_,R)=>H("div",{className:"flex items-center gap-2",children:[X(O0,{value:_.displayName,onChange:(S)=>{let C=[...T];C[R]={..._,displayName:S.target.value},V(C)},placeholder:U.option_name_placeholder(),className:"h-8 flex-1"}),H(i,{children:[X(o,{asChild:!0,children:X("button",{type:"button",className:"w-6 h-6 rounded-full border shrink-0 cursor-pointer focus:outline-none hover:scale-105 transition-transform",style:{backgroundColor:z2[_.color||""]?.hex||_.color||"#808080"}})}),X(p,{className:"p-2 w-auto",align:"end",children:X("div",{className:"flex gap-1",children:l0.map((S)=>X("button",{type:"button",className:"w-5 h-5 rounded-full border cursor-pointer hover:scale-110 transition-transform",style:{backgroundColor:z2[S]?.hex||S},onClick:()=>{let C=[...T];C[R]={..._,color:S},V(C)}},S))})})]}),X(u,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>{V(T.filter((S,C)=>C!==R))},children:X(M0,{className:"h-4 w-4"})})]},_.id))})]}),H("div",{className:"flex gap-2 pt-2",children:[X(u,{variant:"secondary",className:"flex-1",onClick:()=>{W("list"),w(""),F(""),G(N0.NONE),O(""),V([])},children:U.cancel()}),X(u,{className:"flex-1",onClick:f,disabled:!z||!M,children:U.save()})]})]})});return H("div",{className:"w-80 p-4",children:[X("div",{className:"flex items-center justify-between mb-4",children:H("h3",{className:"font-semibold",children:[U.fields()," ",X("span",{className:"text-muted-foreground text-sm font-normal",children:U.visible_count({count:D})})]})}),H("div",{className:"relative mb-4",children:[X(w0,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),X(O0,{placeholder:U.search_fields_placeholder(),value:q,onChange:(_)=>K(_.target.value),className:"pl-8"})]}),X("div",{className:"max-h-60 overflow-y-auto pr-2",children:X(k5,{sensors:[V5.configure({activationConstraints:[new U5.Distance({value:8})]}),_5],onDragEnd:g,children:P.map((_,R)=>X($1,{field:_,index:R,onVisibilityChange:y},_.id))})}),$&&H("div",{className:"mt-4 space-y-2",children:[H(u,{variant:"secondary",className:"w-full",onClick:$,children:[X(K5,{className:"h-4 w-4 mr-2"}),U.manage_fields()]}),H(u,{className:"w-full",onClick:()=>W("create"),children:[X(q0,{className:"h-4 w-4 mr-2"}),U.new_field()]})]})]})}var J1=({value:N,config:$,onSave:J,readOnly:Z,fieldId:Y})=>{let q=$?.select,K=q?.options||[],[Q,W]=w2.useState(!1),[z,w]=w2.useState(""),M=K.find((m)=>m.id===N),F=z.trim(),A=K.filter((m)=>m.displayName.toLowerCase().includes(F.toLowerCase())),G=K.some((m)=>m.displayName.trim().toLowerCase()===F.toLowerCase()||m.id.toLowerCase()===F.toLowerCase()),L=()=>{if(!Z)W(!0)},O=(m)=>{J(m),W(!1),w("")},T=(m)=>{if(Z)return;if(W(m),!m)w("")},V=async()=>{if(!F)return;let m={id:F.toLowerCase().replace(/\s+/g,"-"),displayName:F,color:I0(K)},E=[...K,m],k={...$,select:{...q,options:E}};if(Y)try{let B=await r.api.fields[":fieldId"].$put({param:{fieldId:Y},json:{config:k}});if(!B.ok){U0.error(U.failed_update_field());return}let P=await B.json(),y=a.getState().fields.map((f)=>f.id===P.id?{...f,...P,visible:f.visible}:f);a.getState().updateFields(y)}catch{U0.error(U.failed_update_field());return}J(m.id),w(""),W(!1)};return X("div",{className:"relative w-full",onClick:(m)=>m.stopPropagation(),children:H(i,{open:!Z&&Q,onOpenChange:T,children:[X(o,{asChild:!0,children:H("div",{onClick:L,className:`flex items-center justify-between w-full h-[28px] px-2 rounded border border-transparent transition-colors ${!Z?"cursor-pointer hover:bg-accent hover:border-border group":""}`,children:[((m)=>{if(!m)return X("span",{className:"text-muted-foreground italic text-sm",children:"Select an option"});return X("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium h-[22px]",style:_0(m.color),children:m.displayName})})(M),!Z&&X(z0,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100"})]})}),H(p,{side:"bottom",align:"start",sideOffset:4,className:"p-1.5 w-64 max-h-72 flex flex-col bg-popover border border-border rounded-lg shadow-lg",children:[H("div",{className:"relative pb-1.5 border-b border-border mb-1",onClick:(m)=>m.stopPropagation(),children:[X(w0,{className:"w-3.5 h-3.5 absolute left-2 top-2 text-muted-foreground"}),X("input",{type:"text",className:"w-full pl-7 pr-2 py-1 text-xs bg-muted/50 border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-ring text-foreground",placeholder:U.search_options_placeholder(),value:z,onChange:(m)=>w(m.target.value),autoFocus:!0})]}),H("div",{className:"overflow-y-auto max-h-48 min-h-[120px] space-y-0.5",children:[z===""&&H("div",{onClick:()=>O(""),className:"px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded cursor-pointer flex items-center gap-2",children:[X(M0,{className:"w-3.5 h-3.5"})," Clear"]}),A.map((m)=>X("div",{onClick:()=>O(m.id),className:`px-2.5 py-1.5 text-xs hover:bg-accent rounded cursor-pointer flex items-center justify-between ${N===m.id?"bg-accent/50 font-medium":""}`,children:X("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:_0(m.color),children:m.displayName})},m.id)),A.length===0&&!F&&X("div",{className:"px-2.5 py-2 text-xs text-muted-foreground italic text-center",children:U.no_options_found()}),F!==""&&!G&&H("div",{onClick:V,className:"px-2.5 py-1.5 text-xs text-primary hover:bg-accent rounded cursor-pointer flex items-center gap-1.5 font-medium border-t border-border mt-1 pt-1.5",children:[X(q0,{className:"w-3.5 h-3.5 shrink-0"}),X("span",{className:"truncate",children:U.add_option_with_name({name:F})})]})]})]})]})})},L5=J1;var $0=j(h(),1);var Z1=({value:N=[],config:$,onSave:J,readOnly:Z,fieldId:Y})=>{let q=$?.selectMulti,K=q?.options||[],Q=$0.useRef(null),[W,z]=$0.useState(!1),[w,M]=$0.useState(N.length),[F,A]=$0.useState(""),G=K.filter((B)=>(N||[]).includes(B.id))||[],L=F.trim(),O=K.filter((B)=>B.displayName.toLowerCase().includes(L.toLowerCase())),T=K.some((B)=>B.displayName.trim().toLowerCase()===L.toLowerCase()||B.id.toLowerCase()===L.toLowerCase());$0.useLayoutEffect(()=>{if(W){M(G.length);return}if(Q.current){let B=Q.current.clientWidth-8,g=document.createElement("canvas").getContext("2d");if(g&&B>0){g.font="500 12px ui-sans-serif, system-ui, sans-serif";let y=4,f=G.map((n)=>Math.ceil(g.measureText(n.displayName).width)+18);if(f.reduce((n,Z0)=>n+Z0,0)+Math.max(0,f.length-1)*y<=B){M(G.length);return}let R=B-32-y,S=0,C=0;for(let n=0;n<f.length;n++){let Z0=C>0?S+y+f[n]:f[n];if(Z0>R)break;S=Z0,C++}M(C)}}},[G,W,N]);let V=(B)=>{let P=N||[],g;if(P.includes(B))g=P.filter((y)=>y!==B);else g=[...P,B];J(g)},I=async()=>{if(!L)return;let B={id:L.toLowerCase().replace(/\s+/g,"-"),displayName:L,color:I0(K)},P=[...K,B],g={...$,selectMulti:{...q,options:P}};if(Y)try{let y=await r.api.fields[":fieldId"].$put({param:{fieldId:Y},json:{config:g}});if(!y.ok){U0.error(U.failed_update_field());return}let f=await y.json(),_=a.getState().fields.map((R)=>R.id===f.id?{...R,...f,visible:R.visible}:R);a.getState().updateFields(_)}catch{U0.error(U.failed_update_field());return}J([...N||[],B.id]),A("")},m=(B)=>{if(B.stopPropagation(),!Z)z(!0)},E=G.length-w;return X("div",{className:"relative w-full",onClick:(B)=>B.stopPropagation(),children:H(i,{open:!Z&&W,onOpenChange:(B)=>{if(Z)return;if(z(B),!B)A("")},children:[X(o,{asChild:!0,children:H("div",{ref:Q,onClick:m,className:`w-full px-1 py-1 flex flex-wrap gap-1 rounded border border-transparent transition-all box-border h-[32px] overflow-hidden ${!Z||E>0?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:[G.length===0&&X("span",{className:"text-muted-foreground text-sm italic px-1 pt-0.5",children:"Empty"}),G.slice(0,w).map((B)=>X("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border border-transparent whitespace-nowrap h-[22px]",style:_0(B.color),children:B.displayName},B.id)),E>0&&H("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground h-[22px]",children:["+",E]})]})}),H(p,{side:"bottom",align:"start",sideOffset:4,className:"p-1.5 w-64 max-h-72 flex flex-col bg-popover border border-border rounded-lg shadow-lg",children:[H("div",{className:"relative pb-1.5 border-b border-border mb-1",onClick:(B)=>B.stopPropagation(),children:[X(w0,{className:"w-3.5 h-3.5 absolute left-2 top-2 text-muted-foreground"}),X("input",{type:"text",className:"w-full pl-7 pr-2 py-1 text-xs bg-muted/50 border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-ring text-foreground",placeholder:U.search_options_placeholder(),value:F,onChange:(B)=>A(B.target.value),autoFocus:!0})]}),H("div",{className:"overflow-y-auto max-h-48 min-h-[120px] space-y-0.5",children:[O.map((B)=>{let P=(N||[]).includes(B.id);return H("div",{onClick:()=>V(B.id),className:`px-2.5 py-1.5 hover:bg-accent rounded cursor-pointer flex items-center justify-between text-xs ${P?"bg-accent/30 font-medium":""}`,children:[X("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:_0(B.color),children:B.displayName}),P&&X(i0,{className:"w-3.5 h-3.5 text-primary"})]},B.id)}),O.length===0&&!L&&X("div",{className:"px-2.5 py-2 text-xs text-muted-foreground italic text-center",children:U.no_options_found()}),L!==""&&!T&&H("div",{onClick:I,className:"px-2.5 py-1.5 text-xs text-primary hover:bg-accent rounded cursor-pointer flex items-center gap-1.5 font-medium border-t border-border mt-1 pt-1.5",children:[X(q0,{className:"w-3.5 h-3.5 shrink-0"}),X("span",{className:"truncate",children:U.add_option_with_name({name:L})})]})]})]})]})})},C5=Z1;var J0=j(h(),1);var X1=({value:N,onSave:$,readOnly:J})=>{let[Z,Y]=J0.useState(!1),[q,K]=J0.useState(N||""),Q=J0.useRef(null);J0.useEffect(()=>{K(N||"")},[N]),J0.useEffect(()=>{if(Z&&Q.current)Q.current.focus()},[Z]);let W=()=>{if(!J)Y(!0)},z=()=>{Y(!1),$(q)},w=(M)=>{if(M.key==="Enter")Q.current?.blur()};if(Z)return X("input",{ref:Q,type:"text",value:q,onChange:(M)=>K(M.target.value),onBlur:z,onKeyDown:w,className:"w-full px-2 py-1 border border-ring rounded bg-background text-sm outline-none shadow-sm"});return X("div",{onClick:W,className:`w-full min-h-[28px] px-2 py-1 text-sm text-foreground rounded truncate border border-transparent transition-colors ${!J?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:N||X("span",{className:"text-muted-foreground italic",children:"Empty"})})},A5=X1;var Y1=({value:N,onSave:$,readOnly:J})=>{return X("div",{className:"flex items-center h-[28px] w-full",onClick:(Y)=>Y.stopPropagation(),children:X(u0,{checked:N,onCheckedChange:(Y)=>{if(!J)$(Y)},disabled:J,className:"cursor-pointer"})})},R5=Y1;var p0=j(h(),1);var K1=({value:N,onSave:$,readOnly:J})=>{let Z=o0(),{members:Y,fetchMembers:q}=D0(),[K,Q]=p0.useState(!1);p0.useEffect(()=>{if(Z)q(Z)},[Z,q]);let W=Y.find((G)=>G.id===N),z=()=>{if(!J)Q(!0)},w=(G)=>{$(G),Q(!1)},M=(G)=>{if(J)return;Q(G)},F=(G)=>{return G.split(" ").map((L)=>L[0]).slice(0,2).join("").toUpperCase()};return X("div",{className:"relative w-full",onClick:(G)=>G.stopPropagation(),children:H(i,{open:!J&&K,onOpenChange:M,children:[X(o,{asChild:!0,children:H("div",{onClick:z,className:`flex items-center justify-between w-full h-[28px] px-2 rounded border border-transparent transition-colors ${!J?"cursor-pointer hover:bg-accent hover:border-border group":""}`,children:[((G)=>{if(!G)return X("span",{className:"text-muted-foreground italic text-sm",children:"Select user"});return H("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-foreground border h-[22px]",children:[H(V0,{className:"w-4 h-4",children:[X(k0,{src:G.image,alt:G.name,className:"object-cover"}),X(m0,{className:"text-[8px] bg-rose-400 text-black font-semibold",children:F(G.name)})]}),X("span",{className:"truncate max-w-[120px]",children:G.name})]})})(W),!J&&X(z0,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100"})]})}),H(p,{className:"p-1 w-[--radix-popover-trigger-width] min-w-[200px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg",align:"start",children:[H("div",{onClick:()=>w(""),className:"px-3 py-2 text-sm text-muted-foreground hover:bg-accent cursor-pointer flex items-center gap-2 rounded-sm",children:[X(M0,{className:"w-3 h-3"})," Clear"]}),Y.map((G)=>H("div",{onClick:()=>w(G.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center gap-2 rounded-sm",children:[H(V0,{className:"w-5 h-5",children:[X(k0,{src:G.image,alt:G.name,className:"object-cover"}),X(m0,{className:"text-[10px] bg-rose-400 text-black font-semibold",children:F(G.name)})]}),X("span",{className:"text-sm font-medium text-foreground",children:G.name})]},G.id))]})]})})},O5=K1;var s=j(h(),1);var Q1=({value:N=[],onSave:$,readOnly:J})=>{let Z=o0(),{members:Y,fetchMembers:q}=D0(),K=s.useRef(null),[Q,W]=s.useState(!1),[z,w]=s.useState(N.length);s.useEffect(()=>{if(Z)q(Z)},[Z,q]);let M=Y.filter((V)=>(N||[]).includes(V.id)),F=(V)=>{return V.split(" ").map((I)=>I[0]).slice(0,2).join("").toUpperCase()};s.useLayoutEffect(()=>{if(Q){w(M.length);return}if(K.current){let V=K.current.clientWidth-8,m=document.createElement("canvas").getContext("2d");if(m&&V>0){m.font="500 12px ui-sans-serif, system-ui, sans-serif";let E=4,k=M.map((D)=>{return Math.min(100,Math.ceil(m.measureText(D.name).width))+40});if(k.reduce((D,_)=>D+_,0)+Math.max(0,k.length-1)*E<=V){w(M.length);return}let g=V-32-E,y=0,f=0;for(let D=0;D<k.length;D++){let _=f>0?y+E+k[D]:k[D];if(_>g)break;y=_,f++}w(f)}}},[M,Q,N]);let A=(V)=>{let I=N||[],m;if(I.includes(V))m=I.filter((E)=>E!==V);else m=[...I,V];$(m)},G=(V)=>{if(V.stopPropagation(),!J)W(!0)},L=M.length-z,O=(V)=>{if(J)return;W(V)},T=(V)=>{return H("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-foreground border whitespace-nowrap h-[22px]",children:[H(V0,{className:"w-4 h-4",children:[X(k0,{src:V.image,alt:V.name,className:"object-cover"}),X(m0,{className:"text-[8px] bg-rose-400 text-black font-semibold",children:F(V.name)})]}),X("span",{className:"truncate max-w-[100px]",children:V.name})]},V.id)};return X("div",{className:"relative w-full",onClick:(V)=>V.stopPropagation(),children:H(i,{open:!J&&Q,onOpenChange:O,children:[X(o,{asChild:!0,children:H("div",{ref:K,onClick:G,className:`w-full px-1 py-1 flex flex-wrap gap-1 rounded border border-transparent transition-all box-border h-[32px] overflow-hidden ${!J||L>0?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:[M.length===0&&X("span",{className:"text-muted-foreground text-sm italic px-1 pt-0.5",children:"Empty"}),M.slice(0,z).map(T),L>0&&H("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground h-[22px]",children:["+",L]})]})}),X(p,{className:"p-1 w-[--radix-popover-trigger-width] min-w-[200px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg",align:"start",children:Y.map((V)=>{let I=(N||[]).includes(V.id);return H("div",{onClick:()=>A(V.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between rounded-sm",children:[H("div",{className:"flex items-center gap-2",children:[H(V0,{className:"w-5 h-5",children:[X(k0,{src:V.image,alt:V.name,className:"object-cover"}),X(m0,{className:"text-[10px] bg-rose-400 text-black font-semibold",children:F(V.name)})]}),X("span",{className:"text-sm font-medium text-foreground",children:V.name})]}),I&&X(i0,{className:"w-4 h-4 text-primary"})]},V.id)})})]})})},I5=Q1;var q1=(N)=>{if(!N.config)return X("div",{children:"Unknown Field Type"});switch(N.config.type){case"text":return X(A5,{...N,value:N.value,onSave:N.onSave});case"longText":return X(j2,{...N,value:N.value,onSave:N.onSave});case"select":return X(L5,{...N,value:N.value,onSave:N.onSave});case"selectMulti":return X(C5,{...N,value:N.value,onSave:N.onSave});case"rating":return X(n2,{...N,value:N.value,onSave:N.onSave});case"number":return X(h2,{...N,value:N.value,onSave:N.onSave});case"toggle":return X(R5,{...N,value:N.value,onSave:N.onSave});case"date":return X(D2,{...N,value:N.value,onSave:N.onSave});case"user":return X(O5,{...N,value:N.value,onSave:N.onSave});case"userMulti":return X(I5,{...N,value:N.value,onSave:N.onSave});default:return X("div",{children:"Unknown Field Type"})}},vN=q1;var hN=({progress:N,className:$})=>{let Z=2*Math.PI*20,Y=Z-Math.min(100,Math.max(0,N))/100*Z;return H("svg",{viewBox:"0 0 50 50",className:F0("w-12 h-12",$),children:[X("circle",{cx:"25",cy:"25",r:20,className:"stroke-muted",strokeWidth:"4",fill:"transparent"}),X("circle",{cx:"25",cy:"25",r:20,className:"stroke-primary transition-all duration-300 ease-out",strokeWidth:"4",fill:"transparent",strokeDasharray:Z,strokeDashoffset:Y,transform:"rotate(-90 25 25)"}),X("text",{x:"50%",y:"50%",textAnchor:"middle",dy:".3em",className:"fill-foreground text-[10px] font-bold",children:`${Math.round(N)}%`})]})};var H1=(N)=>{if(isNaN(N))return"00:00";let $=new Date(N*1000),J=$.getUTCHours(),Z=$.getUTCMinutes().toString().padStart(2,"0"),Y=$.getUTCSeconds().toString().padStart(2,"0");if(J)return`${J}:${Z}:${Y}`;return`${Z}:${Y}`},dN=(N,$,J,Z)=>{if(J==="frames")return`${N} fr`;if(J==="standard")return H1(N/$);let Y=Math.round($),q=$!==Y,K=!1;if(q&&(Y===30||Y===60))K=!0;let Q=0;if(Z){let G=Z.match(/^([012]\d):(\d\d):(\d\d)(:|;|\.)(\d+)$/);if(G){let L=parseInt(G[1],10),O=parseInt(G[2],10),T=parseInt(G[3],10),V=parseInt(G[5],10);if(K=G[4]!==":",Q=(L*3600+O*60+T)*Y+V,K){let I=L*60+O,m=$<30?2:4;Q-=m*(I-Math.floor(I/10))}}}let W=N+Q;if(K){let G=$<30?2:4,L=Math.floor(W/(17982*G/2)),O=W%(17982*G/2);if(O<G)O=O+G;W+=9*G*L+G*Math.floor((O-G)/(1798*G/2))}let z=W%Y,w=Math.floor(W/Y)%60,M=Math.floor(W/(Y*60))%60,F=Math.floor(W/(Y*3600))%24,A=K?";":":";return`${F.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}:${w.toString().padStart(2,"0")}${A}${z.toString().padStart(2,"0")}`};var lN=(N,$)=>{if(!$)return 0;let J=1/$;return N*J+J/2},G1=(N)=>Math.max(100,3000/(N||30)),uN=({dbTotalFrames:N,containerDuration:$,frameRate:J})=>{let Z=J||30,Y=Math.round($*Z);if(N<=0)return Y;let q=N/Z,K=$-q,Q=G1(Z)/1000;return K>Q?Y:N};var g5=j(h(),1);function rN({className:N,defaultValue:$,value:J,min:Z=0,max:Y=100,...q}){let K=g5.useMemo(()=>Array.isArray(J)?J:Array.isArray($)?$:[Z,Y],[J,$,Z,Y]);return H(g0.Root,{"data-slot":"slider",defaultValue:$,value:J,min:Z,max:Y,className:F0("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",N),...q,children:[X(g0.Track,{"data-slot":"slider-track",className:F0("relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:X(g0.Range,{"data-slot":"slider-range",className:F0("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:K.length},(Q,W)=>X(g0.Thumb,{"data-slot":"slider-thumb",className:"block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},W))]})}
|
|
2
|
+
export{Y2 as u,f2 as v,T2 as w,q2 as x,H2 as y,l2 as z,q4 as A,a as B,d2 as C,hN as D,B1 as E,n2 as F,e2 as G,l0 as H,z2 as I,_0 as J,I0 as K,N1 as L,b4 as M,D0 as N,vN as O,H1 as P,dN as Q,lN as R,G1 as S,uN as T,rN as U};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{jl as Xq,kl as Yq}from"./chunk-9acfydwy.js";import{ol as _q}from"./chunk-3bm3be9d.js";import{pl as a}from"./chunk-ta02azkp.js";import{ql as c}from"./chunk-twm329fs.js";import{sl as e}from"./chunk-antsxrw9.js";import{tl as t}from"./chunk-21rp4vzr.js";import{vl as C}from"./chunk-tfnh9sk9.js";import{Il as n,Jl as s}from"./chunk-xexxh1zq.js";import{Kl as o,Ll as qq,Ml as Jq,Nl as Qq,Ol as u,Ql as $q,Sl as Zq}from"./chunk-ph43tgr6.js";import{Tl as M}from"./chunk-mjxay7yv.js";import{Ul as l}from"./chunk-r5rf62aa.js";import{$l as m,_l as i}from"./chunk-h9f55mjv.js";import{am as d}from"./chunk-m7d52gfe.js";import"./chunk-2em77vjv.js";function g(q,Q){if(!q)return!1;let J=Q.toLowerCase();for(let[X,Y]of Object.entries(q))if(X.toLowerCase()===J&&Y!==null&&Y.trim().length>0)return!0;return!1}function Kq(q,Q,J){if(Q)return Q;if(g(J,"authorization")||g(J,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${q}`)}function Fq(q){for(let Q of q){if(Q.role==="toolResult")return!0;if(Q.role==="assistant"){if(Q.content.some((J)=>J.type==="toolCall"))return!0}}return!1}function Nq(q){let Q=new Set;for(let J of q)if(J.role==="toolResult")for(let X of J.addedToolNames??[])Q.add(X);return Q}function Aq(q,Q){if(!q)return[];let J=new Map(q.map((X)=>[X.name,X]));return Array.from(Q).map((X)=>J.get(X)).filter((X)=>X!==void 0)}function r(q){return q.type==="text"}function Eq(q){return q.type==="thinking"}function Dq(q){return q.type==="toolCall"}function Pq(q){return q.type==="image"}function wq(q){if(typeof q!=="object"||q===null)return!1;let Q=q;return Q.type==="reasoning.encrypted"&&typeof Q.id==="string"&&Q.id.length>0&&typeof Q.data==="string"&&Q.data.length>0}function jq(q,Q){if(q)return q;if(t("PI_CACHE_RETENTION",Q)==="long")return"long";return"short"}var Uq=(q,Q,J)=>{let X=new d;return(async()=>{let Y={role:"assistant",content:[],api:q.api,provider:q.provider,model:q.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 V=Kq(q.provider,J?.apiKey,J?.headers),j=h(q),F=u(Q.tools,j.supportsOpenAIGrammarTools),$=jq(J?.cacheRetention,J?.env),W=$==="none"?void 0:J?.sessionId,z=Bq(q,Q,V,J?.headers,W,j),Z=yq(q,Q,J,j,$,F),S=await J?.onPayload?.(Z,q);if(S!==void 0)Z=S;let O={...J?.signal?{signal:J.signal}:{},...J?.timeoutMs!==void 0?{timeout:J.timeoutMs}:{},maxRetries:0},{data:P,response:U}=await e(()=>z.chat.completions.create(Z,O).withResponse(),{maxRetries:J?.maxRetries,maxRetryDelayMs:J?.maxRetryDelayMs,signal:J?.signal});await J?.onResponse?.({status:U.status,headers:l(U.headers)},q),X.push({type:"start",partial:Y});let B=null,G=null,N=!1,D=new Map,T=new Map,x=new Map,f=Y.content,v=(_)=>f.indexOf(_),b=(_)=>{let K=_.customInput?.property;if(K===void 0)return"";let E=_.arguments[K];return typeof E==="string"?E:""},k=(_,K,E)=>{let H=_.customInput;if(!H)return;let w=qq(H.jsonBuffer,H.property,K,E);return _.arguments={[H.property]:K},w},Lq=(_)=>{let K=v(_);if(K===-1)return;if(_.type==="text")X.push({type:"text_end",contentIndex:K,content:_.text,partial:Y});else if(_.type==="thinking")X.push({type:"thinking_end",contentIndex:K,content:_.thinking,partial:Y});else if(_.type==="toolCall"){if(_.customInput){let E=k(_,b(_),!0);if(E!==void 0)X.push({type:"toolcall_delta",contentIndex:K,delta:E,partial:Y})}else _.arguments=C(_.partialArgs);delete _.partialArgs,delete _.customInput,delete _.streamIndex,X.push({type:"toolcall_end",contentIndex:K,toolCall:_,partial:Y})}},Vq=()=>{if(!B)B={type:"text",text:""},f.push(B),X.push({type:"text_start",contentIndex:v(B),partial:Y});return B},Wq=(_)=>{if(!G)G={type:"thinking",thinking:"",thinkingSignature:_},f.push(G),X.push({type:"thinking_start",contentIndex:v(G),partial:Y});return G},Gq=(_)=>{if(!_.id)return;let K=x.get(_.id);if(K)_.thoughtSignature=K,x.delete(_.id)},Sq=(_)=>{let K=typeof _.index==="number"?_.index:void 0,E=_.function?.name??_.custom?.name??"",H=K!==void 0?D.get(K):void 0;if(!H&&_.id)H=T.get(_.id);if(!H){let w=_.custom?F.get(E)??"input":void 0,R=w!==void 0;if(H={type:"toolCall",id:_.id||"",name:E,arguments:R?{[w]:""}:{},partialArgs:R?void 0:"",customInput:R?{property:w,jsonBuffer:{input:"",started:!1,closed:!1}}:void 0,streamIndex:K},K!==void 0)D.set(K,H);if(_.id)T.set(_.id,H);f.push(H),X.push({type:"toolcall_start",contentIndex:v(H),partial:Y})}if(K!==void 0&&H.streamIndex===void 0)H.streamIndex=K,D.set(K,H);if(_.id)T.set(_.id,H);if(!H.name&&E)H.name=E;if(_.custom&&!H.customInput){let w=F.get(H.name)??"input";H.arguments={[w]:""},H.customInput={property:w,jsonBuffer:{input:"",started:!1,closed:!1}},delete H.partialArgs}return Gq(H),H};for await(let _ of P){if(!_||typeof _!=="object")continue;if(Y.responseId||=_.id,typeof _.model==="string"&&_.model.length>0&&_.model!==q.id)Y.responseModel||=_.model;if(_.usage)Y.usage=p(_.usage,q);let K=Array.isArray(_.choices)?_.choices[0]:void 0;if(!K)continue;if(!_.usage&&K.usage)Y.usage=p(K.usage,q);if(K.finish_reason){let E=bq(K.finish_reason);if(Y.stopReason=E.stopReason,E.errorMessage)Y.errorMessage=E.errorMessage;N=!0}if(K.delta){if(K.delta.content!==null&&K.delta.content!==void 0&&K.delta.content.length>0){let L=Vq();L.text+=K.delta.content,X.push({type:"text_delta",contentIndex:v(L),delta:K.delta.content,partial:Y})}let E=["reasoning_content","reasoning","reasoning_text"],H=K.delta,w=null;for(let L of E){let A=H[L];if(typeof A==="string"&&A.length>0){w=L;break}}if(w){let L=H[w];if(typeof L==="string"&&L.length>0){let A=q.provider==="opencode-go"&&w==="reasoning"?"reasoning_content":w,y=Wq(A);y.thinking+=L,X.push({type:"thinking_delta",contentIndex:v(y),delta:L,partial:Y})}}if(K?.delta?.tool_calls)for(let L of K.delta.tool_calls){let A=Sq(L);if(!A.id&&L.id)A.id=L.id,T.set(L.id,A);let y=L.function?.name??L.custom?.name;if(!A.name&&y)A.name=y;let I="";if(L.function?.arguments)I=L.function.arguments,A.partialArgs=(A.partialArgs??"")+L.function.arguments,A.arguments=C(A.partialArgs);else if(L.custom?.input){let Oq=b(A)+L.custom.input;I=k(A,Oq,!1)??""}X.push({type:"toolcall_delta",contentIndex:v(A),delta:I,partial:Y})}let R=K.delta.reasoning_details;if(Array.isArray(R)){for(let L of R)if(wq(L)){let A=JSON.stringify(L),y=T.get(L.id);if(y)y.thoughtSignature=A;else x.set(L.id,A)}}}}for(let _ of f)Lq(_);if(J?.signal?.aborted)throw Error("Request was aborted");if(Y.stopReason==="aborted")throw Error("Request was aborted");if(Y.stopReason==="error")throw Error(Y.errorMessage||"Provider returned an error stop reason");if(!N)throw Error("Stream ended without finish_reason");X.push({type:"done",reason:Y.stopReason,message:Y}),X.end()}catch(V){for(let F of Y.content)delete F.index,delete F.partialArgs,delete F.customInput,delete F.streamIndex;Y.stopReason=J?.signal?.aborted?"aborted":"error",Y.errorMessage=s(n(V));let j=V?.error?.metadata?.raw;if(j&&!Y.errorMessage.includes(String(j)))Y.errorMessage+=`
|
|
3
3
|
${j}`;X.push({type:"error",reason:Y.stopReason,error:Y}),X.end()}})(),X},JJ=(q,Q,J)=>{Kq(q.provider,J?.apiKey,J?.headers);let X=$q(q,Q,J,J?.apiKey),Y=J?.reasoning?m(q,J.reasoning):void 0,V=Y==="off"?void 0:Y,j=J?.toolChoice;return Uq(q,Q,{...X,reasoningEffort:V,toolChoice:j})};function Bq(q,Q,J,X,Y,V=h(q)){let j={...q.headers};if(q.provider==="github-copilot"){let F=Xq(Q.messages),$=Yq({messages:Q.messages,hasImages:F});Object.assign(j,$)}if(Y&&V.sendSessionAffinityHeaders)if(V.sessionAffinityFormat==="openrouter")j["x-session-id"]=Y;else{if(V.sessionAffinityFormat==="openai")j.session_id=Y;j["x-client-request-id"]=Y,j["x-session-affinity"]=Y}if(X)Object.assign(j,X);return new c({apiKey:J,baseURL:q.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:j})}function yq(q,Q,J,X=h(q),Y=jq(J?.cacheRetention,J?.env),V=u(Q.tools,X.supportsOpenAIGrammarTools)){let j=hq(q,Q,X,{grammarToolInputProperties:V}),F=Rq(X,Y),$={model:q.id,messages:j,stream:!0,prompt_cache_key:q.baseUrl.includes("api.openai.com")&&Y!=="none"||Y==="long"&&X.supportsLongCacheRetention?_q(J?.sessionId):void 0,prompt_cache_retention:Y==="long"&&X.supportsLongCacheRetention?"24h":void 0};if(X.supportsUsageInStreaming!==!1)$.stream_options={include_usage:!0};if(X.supportsStore)$.store=!1;if(J?.maxTokens)if(X.maxTokensField==="max_tokens")$.max_tokens=J.maxTokens;else $.max_completion_tokens=J.maxTokens;if(J?.temperature!==void 0)$.temperature=J.temperature;let W=X.deferredToolsMode==="kimi"?Nq(Q.messages):new Set,z=Q.tools?.filter((Z)=>!W.has(Z.name));if(z&&z.length>0){if($.tools=Hq(z,X),X.zaiToolStream)$.tool_stream=!0}else if(Fq(Q.messages))$.tools=[];if(F)Tq(j,$.tools,F);if(J?.toolChoice)$.tool_choice=J.toolChoice;if(X.thinkingFormat==="zai"&&q.reasoning){let Z=$;if(Z.thinking=J?.reasoningEffort?{type:"enabled",clear_thinking:!1}:{type:"disabled"},J?.reasoningEffort&&X.supportsReasoningEffort){let S=q.thinkingLevelMap?.[J.reasoningEffort],O=S===void 0?J.reasoningEffort:S;if(typeof O==="string")Z.reasoning_effort=O}}else if(X.thinkingFormat==="qwen"&&q.reasoning)$.enable_thinking=!!J?.reasoningEffort;else if(X.thinkingFormat==="qwen-chat-template"&&q.reasoning)$.chat_template_kwargs={enable_thinking:!!J?.reasoningEffort,preserve_thinking:!0};else if(X.thinkingFormat==="chat-template"&&q.reasoning){let Z=Mq(q,J,X);if(Z)$.chat_template_kwargs=Z}else if(X.thinkingFormat==="deepseek"&&q.reasoning){if(J?.reasoningEffort)$.thinking={type:"enabled"};else if(q.thinkingLevelMap?.off!==null)$.thinking={type:"disabled"};if(J?.reasoningEffort&&X.supportsReasoningEffort)$.reasoning_effort=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort}else if(X.thinkingFormat==="openrouter"&&q.reasoning){let Z=$;if(J?.reasoningEffort)Z.reasoning={effort:q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort};else if(q.thinkingLevelMap?.off!==null)Z.reasoning={effort:q.thinkingLevelMap?.off??"none"}}else if(X.thinkingFormat==="ant-ling"&&q.reasoning&&J?.reasoningEffort){let Z=q.thinkingLevelMap?.[J.reasoningEffort];if(typeof Z==="string")$.reasoning={effort:Z}}else if(X.thinkingFormat==="together"&&q.reasoning){let Z=$;if(Z.reasoning={enabled:!!J?.reasoningEffort},J?.reasoningEffort&&X.supportsReasoningEffort)Z.reasoning_effort=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort}else if(X.thinkingFormat==="string-thinking"&&q.reasoning){let Z=$;if(J?.reasoningEffort)Z.thinking=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort;else if(q.thinkingLevelMap?.off!==null)Z.thinking=q.thinkingLevelMap?.off??"none"}else if(J?.reasoningEffort&&q.reasoning&&X.supportsReasoningEffort)$.reasoning_effort=q.thinkingLevelMap?.[J.reasoningEffort]??J.reasoningEffort;else if(!J?.reasoningEffort&&q.reasoning&&X.supportsReasoningEffort){let Z=q.thinkingLevelMap?.off;if(typeof Z==="string")$.reasoning_effort=Z}if(q.compat?.openRouterRouting)$.provider=q.compat.openRouterRouting;if(q.compat?.vercelGatewayRouting){let Z=q.compat.vercelGatewayRouting;if(Z.only||Z.order){let S={};if(Z.only)S.only=Z.only;if(Z.order)S.order=Z.order;$.providerOptions={gateway:S}}}return $}function Mq(q,Q,J){let X={};for(let[Y,V]of Object.entries(J.chatTemplateKwargs)){let j=vq(q,Q,V);if(j!==void 0)X[Y]=j}return Object.keys(X).length>0?X:void 0}function vq(q,Q,J){if(typeof J!=="object"||J===null)return J;let X=Q?.reasoningEffort;if(!X&&J.omitWhenOff)return;if(J.$var==="thinking.enabled")return!!X;let Y=X?q.thinkingLevelMap?.[X]:q.thinkingLevelMap?.off;return Y===void 0?X:typeof Y==="string"?Y:void 0}function Rq(q,Q){if(q.cacheControlFormat!=="anthropic"||Q==="none")return;let J=Q==="long"&&q.supportsLongCacheRetention?"1h":void 0;return{type:"ephemeral",...J?{ttl:J}:{}}}function Tq(q,Q,J){fq(q,J),Iq(Q,J),xq(q,J)}function fq(q,Q){for(let J of q)if(J.role==="system"||J.role==="developer"){Cq(J,Q);return}}function xq(q,Q){for(let J=q.length-1;J>=0;J--){let X=q[J];if(X.role==="user"||X.role==="assistant"||X.role==="tool"){if(uq(X,Q))return}}}function Iq(q,Q){if(!q||q.length===0)return;let J=q[q.length-1];J.cache_control=Q}function Cq(q,Q){return zq(q,Q)}function uq(q,Q){if(q.role==="user"||q.role==="assistant"||q.role==="tool")return zq(q,Q);return!1}function zq(q,Q){let J=q.content;if(typeof J==="string"){if(J.length===0)return!1;return q.content=[{type:"text",text:J,cache_control:Q}],!0}if(!Array.isArray(J))return!1;for(let X=J.length-1;X>=0;X--){let Y=J[X];if(Y?.type==="text"){let V=Y;return V.cache_control=Q,!0}}return!1}function hq(q,Q,J,X){let Y=[],V=($)=>{if($.includes("|")){let W=$.indexOf("|"),z=$.slice(0,W).replace(/[^a-zA-Z0-9_-]/g,"_"),Z=$.slice(W+1).replace(/[^a-zA-Z0-9_-]/g,"_"),S=Z.length>0?`${z}_${Z}`:z;if(S.length<=40)return S;let O=a($).slice(0,8);return`${z.slice(0,Math.max(1,40-O.length-1))}_${O}`}if(q.provider==="openai")return $.length>40?$.slice(0,40):$;return $},j=Zq(Q.messages,q,($)=>V($));if(Q.systemPrompt){let W=q.reasoning&&J.supportsDeveloperRole?"developer":"system";Y.push({role:W,content:M(Q.systemPrompt)})}let F=null;for(let $=0;$<j.length;$++){let W=j[$];if(J.requiresAssistantAfterToolResult&&F==="toolResult"&&W.role==="user")Y.push({role:"assistant",content:"I have processed the tool results."});if(W.role==="user")if(typeof W.content==="string")Y.push({role:"user",content:M(W.content)});else{let z=W.content.map((Z)=>{if(Z.type==="text")return{type:"text",text:M(Z.text)};else return{type:"image_url",image_url:{url:`data:${Z.mimeType};base64,${Z.data}`}}});if(z.length===0)continue;Y.push({role:"user",content:z})}else if(W.role==="assistant"){let z={role:"assistant",content:J.requiresAssistantAfterToolResult?"":null},Z=W.content.filter(r).filter((G)=>G.text.trim().length>0).map((G)=>({type:"text",text:M(G.text)})),S=Z.map((G)=>G.text).join(""),O=W.content.filter(Eq).filter((G)=>G.thinking.trim().length>0);if(O.length>0)if(J.requiresThinkingAsText){let G=O.map((N)=>M(N.thinking)).join(`
|
|
4
4
|
|
|
5
5
|
`);z.content=[{type:"text",text:G},...Z]}else{if(S.length>0)z.content=S;let G=O[0].thinkingSignature;if(q.provider==="opencode-go"&&G==="reasoning")G="reasoning_content";if(G&&G.length>0)z[G]=O.map((N)=>N.thinking).join(`
|