@maincode-ai/matilda-code 0.21.13 → 0.22.0-nightly.20261102.db95a17c4
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/chunks/agent-4GIFJO5G.js +3 -0
- package/chunks/agent-headless-DXJESNI4.js +3 -0
- package/chunks/{askUserQuestion-BNSWGD26.js → askUserQuestion-7PM7G5YF.js} +3 -3
- package/chunks/ca-JKEHLTNL.js +23 -0
- package/chunks/chunk-225CZWD7.js +89 -0
- package/chunks/chunk-2QIC3OCV.js +9 -0
- package/chunks/chunk-33UVJMVE.js +120 -0
- package/chunks/chunk-35BBGAHD.js +2604 -0
- package/chunks/{chunk-DHDD5YJC.js → chunk-4KS2KEXK.js} +69 -69
- package/chunks/chunk-4MLFC664.js +3 -0
- package/chunks/{chunk-RNKDFE2S.js → chunk-5B2QERWR.js} +1 -1
- package/chunks/chunk-66WJUORA.js +8 -0
- package/chunks/chunk-6U5VOTWB.js +56 -0
- package/chunks/chunk-7MUWF4DK.js +80 -0
- package/chunks/{chunk-6M5G5FBH.js → chunk-BVTXZTL3.js} +1 -1
- package/chunks/chunk-CVGGYRNK.js +31 -0
- package/chunks/chunk-DUB7JMQV.js +13 -0
- package/chunks/chunk-ESNPNLMQ.js +8 -0
- package/chunks/chunk-GT6MSEK4.js +3 -0
- package/chunks/chunk-HEJO7OBH.js +3 -0
- package/chunks/chunk-JNHB73E3.js +9 -0
- package/chunks/chunk-JR5CSCG4.js +8 -0
- package/chunks/{chunk-EZDV7A76.js → chunk-KRVXBQRC.js} +1 -1
- package/chunks/{chunk-AOOZREGV.js → chunk-LBQNFSZ2.js} +1 -1
- package/chunks/{chunk-MEV5XQI2.js → chunk-QBXL5UBB.js} +1 -1
- package/chunks/{chunk-P5TG5CON.js → chunk-QDWS3VZT.js} +1 -1
- package/chunks/{chunk-QZI2ZGZY.js → chunk-QMZREVY3.js} +1 -1
- package/chunks/chunk-QUYQBKDE.js +8 -0
- package/chunks/chunk-QXSBPCBA.js +8 -0
- package/chunks/chunk-S2E5ZRPH.js +14 -0
- package/chunks/chunk-TUKNB5CQ.js +33 -0
- package/chunks/chunk-UM6CLO7D.js +7 -0
- package/chunks/{chunk-6T2GIM76.js → chunk-VVUY7VKR.js} +1 -1
- package/chunks/{chunk-5OHGYMKP.js → chunk-WENVHSCJ.js} +1 -1
- package/chunks/{chunk-27Q5KW3A.js → chunk-ZABH4QIL.js} +10 -10
- package/chunks/chunk-ZSGBDQXU.js +11 -0
- package/chunks/{computer-use-J4GAM4M6.js → computer-use-IZGLKENV.js} +1 -1
- package/chunks/{cron-create-IDWSZENI.js → cron-create-BTSJUVNT.js} +1 -1
- package/chunks/cron-delete-PTE3RC2W.js +3 -0
- package/chunks/cron-list-SINKHOIZ.js +5 -0
- package/chunks/de-GMGNR5CZ.js +23 -0
- package/chunks/{devtools-XRQ4YJ5S.js → devtools-7YNCRYZV.js} +1 -1
- package/chunks/{chunk-OOEH6ZSV.js → dist-UWUWLWTO.js} +2 -2
- package/chunks/{edit-X2S2ZXRN.js → edit-MDQEZ7BA.js} +1 -1
- package/chunks/en-3NQMLVKW.js +23 -0
- package/chunks/{enter-worktree-TUCGNCLO.js → enter-worktree-SZK65VXF.js} +1 -1
- package/chunks/enterPlanMode-5VWIIVHI.js +18 -0
- package/chunks/{exit-worktree-7FLITFZI.js → exit-worktree-OBHUK4TF.js} +1 -1
- package/chunks/{exitPlanMode-O5UUJ3GM.js → exitPlanMode-SXFQC4G2.js} +2 -2
- package/chunks/fr-WS3EBB36.js +23 -0
- package/chunks/{getMachineId-bsd-ZYBNK2JG.js → getMachineId-bsd-ETKQTB6C.js} +1 -1
- package/chunks/{getMachineId-darwin-CM2MQGUI.js → getMachineId-darwin-AKNRWOWB.js} +1 -1
- package/chunks/{getMachineId-linux-SYE2KMCW.js → getMachineId-linux-2QSD7FTP.js} +1 -1
- package/chunks/{getMachineId-unsupported-6IHVG2XO.js → getMachineId-unsupported-UXSV7I24.js} +1 -1
- package/chunks/{getMachineId-win-S3J3JSUM.js → getMachineId-win-4MTFXGP3.js} +1 -1
- package/chunks/glob-JKIZ3ZJQ.js +22 -0
- package/chunks/{goal-tools-YQOA6OKU.js → goal-tools-YJMECZYD.js} +3 -3
- package/chunks/{grep-VAB2VSXM.js → grep-Q4T5AE6K.js} +1 -1
- package/chunks/ja-GBCDQ43R.js +23 -0
- package/chunks/keychain-token-storage-4PY5J6U6.js +3 -0
- package/chunks/ls-BQCCCPIX.js +15 -0
- package/chunks/{lsp-NGLDRHZU.js → lsp-MHJJJ7K3.js} +1 -1
- package/chunks/mcp-client-CSF5QZEY.js +3 -0
- package/chunks/monitor-JUAVWVLY.js +32 -0
- package/chunks/{multipart-parser-JI75T2O5.js → multipart-parser-FKHYAVGR.js} +1 -1
- package/chunks/notebook-edit-NNOMEUER.js +17 -0
- package/chunks/openaiContentGenerator-DTKOYRBL.js +47 -0
- package/chunks/pt-VID6J2CM.js +23 -0
- package/chunks/read-file-4EX4B3TB.js +3 -0
- package/chunks/ripGrep-JL6UDNCR.js +3 -0
- package/chunks/ru-EB6V6EAN.js +23 -0
- package/chunks/scheduler-GCGZAI7D.js +8 -0
- package/chunks/send-message-S4P5QKSW.js +8 -0
- package/chunks/shell-J7EX7B57.js +3 -0
- package/chunks/{skill-ETQM5NI3.js → skill-V6NTJ4O4.js} +1 -1
- package/chunks/src-LZEU4AYF.js +5 -0
- package/chunks/symbol-search-5QJNW7PY.js +19 -0
- package/chunks/{syntheticOutput-WZDPECYS.js → syntheticOutput-3XIAIUIR.js} +1 -1
- package/chunks/task-create-KGPY7O4J.js +3 -0
- package/chunks/{task-detach-TBAVUOTC.js → task-detach-ZD3A7225.js} +1 -1
- package/chunks/task-list-P7GQWYAD.js +9 -0
- package/chunks/{task-stop-HDSARSJ6.js → task-stop-VFJRBA6P.js} +1 -1
- package/chunks/{task-update-MW2VT2XV.js → task-update-OOMH4WRA.js} +1 -1
- package/chunks/{team-create-VMYNLZCC.js → team-create-POMZOM44.js} +2 -2
- package/chunks/team-delete-ZJBEQDPE.js +8 -0
- package/chunks/todoWrite-EWYRFK7W.js +3 -0
- package/chunks/{tool-search-WX6FOE35.js → tool-search-5Z7MO565.js} +1 -1
- package/chunks/{web-fetch-CKYBHGLF.js → web-fetch-M4TUYAFG.js} +17 -17
- package/chunks/web-search-CBKF36JM.js +26 -0
- package/chunks/{workflow-WBSRQG3N.js → workflow-F57TWWPS.js} +2 -2
- package/chunks/write-file-UK4BVL3M.js +15 -0
- package/cli.js +642 -678
- package/examples/starter/README.md +0 -3
- package/locales/ca.js +3 -87
- package/locales/de.js +3 -91
- package/locales/en.js +3 -91
- package/locales/fr.js +3 -88
- package/locales/ja.js +3 -92
- package/locales/pt.js +3 -92
- package/locales/ru.js +3 -91
- package/package.json +2 -2
- package/sandbox-macos-permissive-proxied.sb +1 -1
- package/sandbox-macos-restrictive-closed.sb +14 -1
- package/sandbox-macos-restrictive-open.sb +14 -1
- package/sandbox-macos-restrictive-proxied.sb +15 -2
- package/bundled/mainy/SKILL.md +0 -157
- package/bundled/mainy/docs/_meta.ts +0 -32
- package/bundled/mainy/docs/common-workflow.md +0 -571
- package/bundled/mainy/docs/configuration/_meta.ts +0 -7
- package/bundled/mainy/docs/configuration/auth.md +0 -82
- package/bundled/mainy/docs/configuration/matilda-ignore.md +0 -55
- package/bundled/mainy/docs/configuration/model-providers.md +0 -516
- package/bundled/mainy/docs/configuration/settings.md +0 -818
- package/bundled/mainy/docs/configuration/themes.md +0 -199
- package/bundled/mainy/docs/configuration/trusted-folders.md +0 -67
- package/bundled/mainy/docs/extension/_meta.ts +0 -9
- package/bundled/mainy/docs/extension/extension-releasing.md +0 -204
- package/bundled/mainy/docs/extension/getting-started-extensions.md +0 -299
- package/bundled/mainy/docs/extension/introduction.md +0 -338
- package/bundled/mainy/docs/features/_meta.ts +0 -27
- package/bundled/mainy/docs/features/approval-mode.md +0 -388
- package/bundled/mainy/docs/features/arena.md +0 -219
- package/bundled/mainy/docs/features/auto-mode.md +0 -308
- package/bundled/mainy/docs/features/channels/_meta.ts +0 -5
- package/bundled/mainy/docs/features/channels/overview.md +0 -328
- package/bundled/mainy/docs/features/channels/plugins.md +0 -87
- package/bundled/mainy/docs/features/channels/telegram.md +0 -120
- package/bundled/mainy/docs/features/code-review.md +0 -291
- package/bundled/mainy/docs/features/commands.md +0 -528
- package/bundled/mainy/docs/features/dual-output.md +0 -627
- package/bundled/mainy/docs/features/followup-suggestions.md +0 -109
- package/bundled/mainy/docs/features/headless.md +0 -448
- package/bundled/mainy/docs/features/hooks.md +0 -1308
- package/bundled/mainy/docs/features/language.md +0 -144
- package/bundled/mainy/docs/features/lsp.md +0 -496
- package/bundled/mainy/docs/features/markdown-rendering.md +0 -183
- package/bundled/mainy/docs/features/mcp.md +0 -423
- package/bundled/mainy/docs/features/memory.md +0 -185
- package/bundled/mainy/docs/features/sandbox.md +0 -249
- package/bundled/mainy/docs/features/scheduled-tasks.md +0 -139
- package/bundled/mainy/docs/features/skills.md +0 -347
- package/bundled/mainy/docs/features/status-line.md +0 -397
- package/bundled/mainy/docs/features/structured-output.md +0 -309
- package/bundled/mainy/docs/features/sub-agents.md +0 -737
- package/bundled/mainy/docs/features/tips.md +0 -54
- package/bundled/mainy/docs/features/token-caching.md +0 -29
- package/bundled/mainy/docs/features/tool-use-summaries.md +0 -178
- package/bundled/mainy/docs/features/worktree.md +0 -343
- package/bundled/mainy/docs/ide-integration/_meta.ts +0 -4
- package/bundled/mainy/docs/ide-integration/ide-companion-spec.md +0 -182
- package/bundled/mainy/docs/ide-integration/ide-integration.md +0 -144
- package/bundled/mainy/docs/integration-github-action.md +0 -241
- package/bundled/mainy/docs/integration-jetbrains.md +0 -81
- package/bundled/mainy/docs/integration-vscode.md +0 -39
- package/bundled/mainy/docs/integration-zed.md +0 -72
- package/bundled/mainy/docs/matilda-serve-deploy-local.md +0 -221
- package/bundled/mainy/docs/matilda-serve.md +0 -661
- package/bundled/mainy/docs/overview.md +0 -64
- package/bundled/mainy/docs/quickstart.md +0 -234
- package/bundled/mainy/docs/reference/_meta.ts +0 -3
- package/bundled/mainy/docs/reference/keyboard-shortcuts.md +0 -91
- package/bundled/mainy/docs/support/Uninstall.md +0 -65
- package/bundled/mainy/docs/support/_meta.ts +0 -6
- package/bundled/mainy/docs/support/tos-privacy.md +0 -94
- package/bundled/mainy/docs/support/troubleshooting.md +0 -127
- package/chunks/agent-SRAIVZEE.js +0 -3
- package/chunks/agent-headless-XRDOZESG.js +0 -3
- package/chunks/anthropicContentGenerator-LLDIKDMQ.js +0 -39
- package/chunks/ca-NPYL24ME.js +0 -25
- package/chunks/chunk-27HUYW23.js +0 -22
- package/chunks/chunk-2HTPVSGT.js +0 -3
- package/chunks/chunk-3B2HABK7.js +0 -30
- package/chunks/chunk-3MTZTNAU.js +0 -101
- package/chunks/chunk-3YLXGE6T.js +0 -8
- package/chunks/chunk-47XR7IMP.js +0 -8
- package/chunks/chunk-4F4DA5UI.js +0 -8
- package/chunks/chunk-4Q2SNBUH.js +0 -18
- package/chunks/chunk-6EQMZNIY.js +0 -8
- package/chunks/chunk-6I6VGTKD.js +0 -8
- package/chunks/chunk-DC7LAFZZ.js +0 -8
- package/chunks/chunk-DE3HKC2W.js +0 -9
- package/chunks/chunk-FWDMPRKU.js +0 -3
- package/chunks/chunk-G7R2XEEF.js +0 -7
- package/chunks/chunk-GOJCMVJJ.js +0 -8
- package/chunks/chunk-GTVCJCHR.js +0 -8
- package/chunks/chunk-IJEGHQ7Z.js +0 -32
- package/chunks/chunk-JCE3JAVC.js +0 -25
- package/chunks/chunk-KHHJYBR5.js +0 -9
- package/chunks/chunk-LUNDTQ3G.js +0 -8
- package/chunks/chunk-LWARA7JY.js +0 -37
- package/chunks/chunk-M53RP3YP.js +0 -31
- package/chunks/chunk-MTMU7JYZ.js +0 -11
- package/chunks/chunk-O44XK65C.js +0 -8
- package/chunks/chunk-OA56BXPD.js +0 -3
- package/chunks/chunk-PEKAUGYV.js +0 -2621
- package/chunks/chunk-PGUG43HG.js +0 -24
- package/chunks/chunk-PGXQZVLX.js +0 -8
- package/chunks/chunk-QKYGQLWC.js +0 -8
- package/chunks/chunk-QN6Y6NPA.js +0 -3
- package/chunks/chunk-RI54U73U.js +0 -56
- package/chunks/chunk-RPFSFS7Z.js +0 -39
- package/chunks/chunk-SDTWBD62.js +0 -8
- package/chunks/chunk-SOEIVSM5.js +0 -113
- package/chunks/chunk-SVSY6AWS.js +0 -59
- package/chunks/chunk-T2T2UEPY.js +0 -4
- package/chunks/chunk-TISQNFB5.js +0 -3
- package/chunks/chunk-TWJLOEAI.js +0 -31
- package/chunks/chunk-VI74YQQO.js +0 -8
- package/chunks/chunk-VYZOOSMP.js +0 -30
- package/chunks/chunk-W4QSMIWO.js +0 -9
- package/chunks/chunk-WC2VTVCE.js +0 -27
- package/chunks/chunk-YV3PUOBU.js +0 -65
- package/chunks/chunk-ZX34M2GF.js +0 -14
- package/chunks/contextCommand-5F5M7NA4.js +0 -3
- package/chunks/cron-delete-NQCDZDUI.js +0 -3
- package/chunks/cron-list-Z4XMC3TO.js +0 -5
- package/chunks/de-34YZHGC6.js +0 -25
- package/chunks/dist-7UYRLSLE.js +0 -3
- package/chunks/dist-PH6JW7XD.js +0 -42
- package/chunks/en-QLGMD6OS.js +0 -25
- package/chunks/enterPlanMode-SQEZAAIR.js +0 -18
- package/chunks/fileFromPath-7UCWPD4W.js +0 -3
- package/chunks/fr-EDNBQACJ.js +0 -25
- package/chunks/geminiContentGenerator-FIZFLPU3.js +0 -8
- package/chunks/glob-GSFTYAS2.js +0 -22
- package/chunks/ja-LV4RLM3M.js +0 -25
- package/chunks/keychain-token-storage-KQK6MNOJ.js +0 -3
- package/chunks/ls-IZJ3CKZY.js +0 -15
- package/chunks/matildaAgentContentGenerator-QQHPCFJ5.js +0 -8
- package/chunks/matildaContentGenerator-W7Z33ONU.js +0 -8
- package/chunks/matildaOAuth2-7COTQQR2.js +0 -3
- package/chunks/mcp-client-DXUNIEIB.js +0 -3
- package/chunks/monitor-4PFIGAGG.js +0 -32
- package/chunks/notebook-edit-MWJYAATJ.js +0 -17
- package/chunks/openaiContentGenerator-NDVJL6QL.js +0 -3
- package/chunks/pt-5SQ4DGL7.js +0 -25
- package/chunks/read-file-WPZKPXWA.js +0 -3
- package/chunks/ripGrep-7LZDZFTX.js +0 -3
- package/chunks/ru-7K24S53N.js +0 -25
- package/chunks/scheduler-DK2MVKXX.js +0 -8
- package/chunks/send-message-TCPX5UDU.js +0 -8
- package/chunks/serve-GSZPJI2O.js +0 -1026
- package/chunks/shell-PRS47PDP.js +0 -3
- package/chunks/src-UB7DZRYK.js +0 -3
- package/chunks/src-WZTRMETQ.js +0 -5
- package/chunks/symbol-search-HARHZ5AH.js +0 -19
- package/chunks/task-create-XRNIDT4T.js +0 -3
- package/chunks/task-list-Z6BDZZID.js +0 -9
- package/chunks/team-delete-F7QDC2TE.js +0 -8
- package/chunks/todoWrite-SCF5M24M.js +0 -3
- package/chunks/web-search-67DFNS5V.js +0 -26
- package/chunks/write-file-S5FAX4JJ.js +0 -15
package/chunks/chunk-3YLXGE6T.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as o}from"./chunk-GZPNIYVZ.js";o();var i=["www-browser"];function a(r){let s=r.replace(/\\/g,"/").split("/").pop();return!!s&&i.includes(s)}function p(r={}){let e=process.env.BROWSER?.trim()?.match(/^\S+/)?.[0];if(!r.ignoreBrowserBlocklist&&process.platform!=="win32"&&e&&a(e)||process.env.CI||process.env.DEBIAN_FRONTEND==="noninteractive")return!1;let n=!!process.env.SSH_CONNECTION;return!(process.platform==="linux"&&!["DISPLAY","WAYLAND_DISPLAY","MIR_SOCKET"].some(t=>!!process.env[t])||n&&process.platform!=="linux")}export{a,p as b};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-47XR7IMP.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as r}from"./chunk-GZPNIYVZ.js";r();var n=(s=>(s.TEXT="text",s.STREAM_JSON="stream-json",s))(n||{}),t=(e=>(e.TEXT="text",e.JSON="json",e.STREAM_JSON="stream-json",e))(t||{});export{n as a,t as b};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-4F4DA5UI.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as D}from"./chunk-GZPNIYVZ.js";D();var o="coder-model",L="coder-model",e="text-embedding-v4",t="matilda3.5-plus";export{o as a,L as b,e as c,t as d};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-4Q2SNBUH.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as H}from"./chunk-GZPNIYVZ.js";H();H();H();var S=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:e=>`Symbol(${e})`;function pr(){}function B(e){return typeof e=="object"&&e!==null||typeof e=="function"}var yr=pr;function T(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}var Ct=Promise,po=Promise.prototype.then,yo=Promise.resolve.bind(Ct),mo=Promise.reject.bind(Ct);function M(e){return new Ct(e)}function q(e){return yo(e)}function b(e){return mo(e)}function te(e,t,r){return po.call(e,t,r)}function z(e,t,r){te(te(e,t,r),void 0,yr)}function Qt(e,t){z(e,t)}function Ut(e,t){z(e,void 0,t)}function V(e,t,r){return te(e,t,r)}function ve(e){te(e,void 0,yr)}var Ue=e=>{if(typeof queueMicrotask=="function")Ue=queueMicrotask;else{let t=q(void 0);Ue=r=>te(t,r)}return Ue(e)};function st(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function _e(e,t,r){try{return q(st(e,t,r))}catch(o){return b(o)}}var x=class{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){let r=this._back,o=r;r._elements.length===16383&&(o={_elements:[],_next:void 0}),r._elements.push(t),o!==r&&(this._back=o,r._next=o),++this._size}shift(){let t=this._front,r=t,o=this._cursor,n=o+1,i=t._elements,a=i[o];return n===16384&&(r=t._next,n=0),--this._size,this._cursor=n,t!==r&&(this._front=r),i[o]=void 0,a}forEach(t){let r=this._cursor,o=this._front,n=o._elements;for(;!(r===n.length&&o._next===void 0||r===n.length&&(o=o._next,n=o._elements,r=0,n.length===0));)t(n[r]),++r}peek(){let t=this._front,r=this._cursor;return t._elements[r]}},mr=S("[[AbortSteps]]"),wr=S("[[ErrorSteps]]"),Ot=S("[[CancelSteps]]"),Wt=S("[[PullSteps]]"),At=S("[[ReleaseSteps]]");function gr(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?St(e):t._state==="closed"?function(r){St(r),Tr(r)}(e):Rr(e,t._storedError)}function vr(e,t){return eo(e._ownerReadableStream,t)}function Sr(e){let t=e._ownerReadableStream;t._state==="readable"?jt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(r,o){Rr(r,o)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[At](),t._reader=void 0,e._ownerReadableStream=void 0}function Se(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function St(e){e._closedPromise=M((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function Rr(e,t){St(e),jt(e,t)}function jt(e,t){e._closedPromise_reject!==void 0&&(ve(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function Tr(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var Yt=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},wo=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function re(e,t){if(e!==void 0&&typeof(r=e)!="object"&&typeof r!="function")throw new TypeError(`${t} is not an object.`);var r}function D(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function qr(e,t){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(e))throw new TypeError(`${t} is not an object.`)}function oe(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Rt(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function Ft(e){return Number(e)}function Gt(e){return e===0?0:e}function Er(e,t){let r=Number.MAX_SAFE_INTEGER,o=Number(e);if(o=Gt(o),!Yt(o))throw new TypeError(`${t} is not a finite number`);if(o=function(n){return Gt(wo(n))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return Yt(o)&&o!==0?o:0}function Ce(e){if(!B(e)||typeof e.getReader!="function")return!1;try{return typeof e.locked=="boolean"}catch{return!1}}function Pr(e){if(!B(e)||typeof e.getWriter!="function")return!1;try{return typeof e.locked=="boolean"}catch{return!1}}function kr(e,t){if(!he(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Cr(e,t){e._reader._readRequests.push(t)}function zt(e,t,r){let o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function lt(e){return e._reader._readRequests.length}function Or(e){let t=e._reader;return t!==void 0&&!!fe(t)}var G=class{constructor(t){if(oe(t,1,"ReadableStreamDefaultReader"),kr(t,"First parameter"),qe(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");gr(this,t),this._readRequests=new x}get closed(){return fe(this)?this._closedPromise:b(Me("closed"))}cancel(t){return fe(this)?this._ownerReadableStream===void 0?b(Se("cancel")):vr(this,t):b(Me("cancel"))}read(){if(!fe(this))return b(Me("read"));if(this._ownerReadableStream===void 0)return b(Se("read from"));let t,r,o=M((n,i)=>{t=n,r=i});return function(n,i){let a=n._ownerReadableStream;a._disturbed=!0,a._state==="closed"?i._closeSteps():a._state==="errored"?i._errorSteps(a._storedError):a._readableStreamController[Wt](i)}(this,{_chunkSteps:n=>t({value:n,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:n=>r(n)}),o}releaseLock(){if(!fe(this))throw Me("releaseLock");this._ownerReadableStream!==void 0&&function(t){Sr(t);let r=new TypeError("Reader was released");Wr(t,r)}(this)}};function fe(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof G}function Wr(e,t){let r=e._readRequests;e._readRequests=new x,r.forEach(o=>{o._errorSteps(t)})}function Me(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}Object.defineProperties(G.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),T(G.prototype.cancel,"cancel"),T(G.prototype.read,"read"),T(G.prototype.releaseLock,"releaseLock"),typeof S.toStringTag=="symbol"&&Object.defineProperty(G.prototype,S.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});var Ze=class{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){let t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?V(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){let r=()=>this._returnSteps(t);return this._ongoingPromise?V(this._ongoingPromise,r,r):r()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let t=this._reader;return t===void 0?b(Se("iterate")):te(t.read(),r=>{var o;return this._ongoingPromise=void 0,r.done&&(this._isFinished=!0,(o=this._reader)===null||o===void 0||o.releaseLock(),this._reader=void 0),r},r=>{var o;throw this._ongoingPromise=void 0,this._isFinished=!0,(o=this._reader)===null||o===void 0||o.releaseLock(),this._reader=void 0,r})}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;let r=this._reader;if(r===void 0)return b(Se("finish iterating"));if(this._reader=void 0,!this._preventCancel){let o=r.cancel(t);return r.releaseLock(),V(o,()=>({value:t,done:!0}))}return r.releaseLock(),q({value:t,done:!0})}},Ar={next(){return Kt(this)?this._asyncIteratorImpl.next():b(Xt("next"))},return(e){return Kt(this)?this._asyncIteratorImpl.return(e):b(Xt("return"))}};function Kt(e){if(!B(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Ze}catch{return!1}}function Xt(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}typeof S.asyncIterator=="symbol"&&Object.defineProperty(Ar,S.asyncIterator,{value(){return this},writable:!0,configurable:!0});var jr=Number.isNaN||function(e){return e!=e};function Fr(e,t,r,o,n){new Uint8Array(e).set(new Uint8Array(r,o,n),t)}function Zt(e){let t=function(r,o,n){if(r.slice)return r.slice(o,n);let i=n-o,a=new ArrayBuffer(i);return Fr(a,0,r,o,i),a}(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Tt(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Bt(e,t,r){if(typeof(o=r)!="number"||jr(o)||o<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var o;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function ae(e){e._queue=new x,e._queueTotalSize=0}var ne=class{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!yt(this))throw mt("view");return this._view}respond(t){if(!yt(this))throw mt("respond");if(oe(t,1,"respond"),t=Er(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(r,o){let n=r._pendingPullIntos.peek();if(r._controlledReadableByteStream._state==="closed"){if(o!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(o===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(n.bytesFilled+o>n.byteLength)throw new RangeError("bytesWritten out of range")}n.buffer=n.buffer,Jt(r,o)}(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!yt(this))throw mt("respondWithNewView");if(oe(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");t.buffer,function(r,o){let n=r._pendingPullIntos.peek();if(r._controlledReadableByteStream._state==="closed"){if(o.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(o.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(n.byteOffset+n.bytesFilled!==o.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(n.bufferByteLength!==o.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(n.bytesFilled+o.byteLength>n.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let i=o.byteLength;n.buffer=o.buffer,Jt(r,i)}(this._associatedReadableByteStreamController,t)}};Object.defineProperties(ne.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),T(ne.prototype.respond,"respond"),T(ne.prototype.respondWithNewView,"respondWithNewView"),typeof S.toStringTag=="symbol"&&Object.defineProperty(ne.prototype,S.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var K=class{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!me(this))throw Pe("byobRequest");return function(t){if(t._byobRequest===null&&t._pendingPullIntos.length>0){let r=t._pendingPullIntos.peek(),o=new Uint8Array(r.buffer,r.byteOffset+r.bytesFilled,r.byteLength-r.bytesFilled),n=Object.create(ne.prototype);(function(i,a,s){i._associatedReadableByteStreamController=a,i._view=s})(n,t,o),t._byobRequest=n}return t._byobRequest}(this)}get desiredSize(){if(!me(this))throw Pe("desiredSize");return Nr(this)}close(){if(!me(this))throw Pe("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);(function(r){let o=r._controlledReadableByteStream;if(!(r._closeRequested||o._state!=="readable")){if(r._queueTotalSize>0)return void(r._closeRequested=!0);if(r._pendingPullIntos.length>0&&r._pendingPullIntos.peek().bytesFilled>0){let n=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Re(r,n),n}Je(r),Fe(o)}})(this)}enqueue(t){if(!me(this))throw Pe("enqueue");if(oe(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);(function(o,n){let i=o._controlledReadableByteStream;if(o._closeRequested||i._state!=="readable")return;let a=n.buffer,s=n.byteOffset,u=n.byteLength,l=a;if(o._pendingPullIntos.length>0){let d=o._pendingPullIntos.peek();d.buffer,Lt(o),d.buffer=d.buffer,d.readerType==="none"&&Ir(o,d)}Or(i)?(function(d){let f=d._controlledReadableByteStream._reader;for(;f._readRequests.length>0;){if(d._queueTotalSize===0)return;er(d,f._readRequests.shift())}}(o),lt(i)===0?Ye(o,l,s,u):(o._pendingPullIntos.length>0&&ge(o),zt(i,new Uint8Array(l,s,u),!1))):It(i)?(Ye(o,l,s,u),Et(o)):Ye(o,l,s,u),be(o)})(this,t)}error(t){if(!me(this))throw Pe("error");Re(this,t)}[Ot](t){zr(this),ae(this);let r=this._cancelAlgorithm(t);return Je(this),r}[Wt](t){let r=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void er(this,t);let o=this._autoAllocateChunkSize;if(o!==void 0){let n;try{n=new ArrayBuffer(o)}catch(a){return void t._errorSteps(a)}let i={buffer:n,bufferByteLength:o,byteOffset:0,byteLength:o,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}Cr(r,t),be(this)}[At](){if(this._pendingPullIntos.length>0){let t=this._pendingPullIntos.peek();t.readerType="none",this._pendingPullIntos=new x,this._pendingPullIntos.push(t)}}};function me(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof K}function yt(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof ne}function be(e){if(function(r){let o=r._controlledReadableByteStream;return o._state!=="readable"||r._closeRequested||!r._started?!1:!!(Or(o)&<(o)>0||It(o)&&Hr(o)>0||Nr(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,z(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,be(e)),null),r=>(Re(e,r),null))}}function zr(e){Lt(e),e._pendingPullIntos=new x}function qt(e,t){let r=!1;e._state==="closed"&&(r=!0);let o=Br(t);t.readerType==="default"?zt(e,o,r):function(n,i,a){let s=n._reader._readIntoRequests.shift();a?s._closeSteps(i):s._chunkSteps(i)}(e,o,r)}function Br(e){let t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Ye(e,t,r,o){e._queue.push({buffer:t,byteOffset:r,byteLength:o}),e._queueTotalSize+=o}function Lr(e,t,r,o){let n;try{n=t.slice(r,r+o)}catch(i){throw Re(e,i),i}Ye(e,n,0,o)}function Ir(e,t){t.bytesFilled>0&&Lr(e,t.buffer,t.byteOffset,t.bytesFilled),ge(e)}function Mr(e,t){let r=t.elementSize,o=t.bytesFilled-t.bytesFilled%r,n=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),i=t.bytesFilled+n,a=i-i%r,s=n,u=!1;a>o&&(s=a-t.bytesFilled,u=!0);let l=e._queue;for(;s>0;){let d=l.peek(),f=Math.min(s,d.byteLength),c=t.byteOffset+t.bytesFilled;Fr(t.buffer,c,d.buffer,d.byteOffset,f),d.byteLength===f?l.shift():(d.byteOffset+=f,d.byteLength-=f),e._queueTotalSize-=f,$r(e,f,t),s-=f}return u}function $r(e,t,r){r.bytesFilled+=t}function xr(e){e._queueTotalSize===0&&e._closeRequested?(Je(e),Fe(e._controlledReadableByteStream)):be(e)}function Lt(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Et(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;let t=e._pendingPullIntos.peek();Mr(e,t)&&(ge(e),qt(e._controlledReadableByteStream,t))}}function Jt(e,t){let r=e._pendingPullIntos.peek();Lt(e),e._controlledReadableByteStream._state==="closed"?function(o,n){n.readerType==="none"&&ge(o);let i=o._controlledReadableByteStream;if(It(i))for(;Hr(i)>0;)qt(i,ge(o))}(e,r):function(o,n,i){if($r(0,n,i),i.readerType==="none")return Ir(o,i),void Et(o);if(i.bytesFilled<i.elementSize)return;ge(o);let a=i.bytesFilled%i.elementSize;if(a>0){let s=i.byteOffset+i.bytesFilled;Lr(o,i.buffer,s-a,a)}i.bytesFilled-=a,qt(o._controlledReadableByteStream,i),Et(o)}(e,t,r),be(e)}function ge(e){return e._pendingPullIntos.shift()}function Je(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Re(e,t){let r=e._controlledReadableByteStream;r._state==="readable"&&(zr(e),ae(e),Je(e),to(r,t))}function er(e,t){let r=e._queue.shift();e._queueTotalSize-=r.byteLength,xr(e);let o=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(o)}function Nr(e){let t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function go(e,t,r){let o=Object.create(K.prototype),n,i,a;n=t.start!==void 0?()=>t.start(o):()=>{},i=t.pull!==void 0?()=>t.pull(o):()=>q(void 0),a=t.cancel!==void 0?u=>t.cancel(u):()=>q(void 0);let s=t.autoAllocateChunkSize;if(s===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");(function(u,l,d,f,c,h,y){l._controlledReadableByteStream=u,l._pullAgain=!1,l._pulling=!1,l._byobRequest=null,l._queue=l._queueTotalSize=void 0,ae(l),l._closeRequested=!1,l._started=!1,l._strategyHWM=h,l._pullAlgorithm=f,l._cancelAlgorithm=c,l._autoAllocateChunkSize=y,l._pendingPullIntos=new x,u._readableStreamController=l,z(q(d()),()=>(l._started=!0,be(l),null),E=>(Re(l,E),null))})(e,o,n,i,a,r,s)}function mt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Pe(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function tr(e,t){e._reader._readIntoRequests.push(t)}function Hr(e){return e._reader._readIntoRequests.length}function It(e){let t=e._reader;return t!==void 0&&!!we(t)}Object.defineProperties(K.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),T(K.prototype.close,"close"),T(K.prototype.enqueue,"enqueue"),T(K.prototype.error,"error"),typeof S.toStringTag=="symbol"&&Object.defineProperty(K.prototype,S.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var X=class{constructor(t){if(oe(t,1,"ReadableStreamBYOBReader"),kr(t,"First parameter"),qe(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!me(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");gr(this,t),this._readIntoRequests=new x}get closed(){return we(this)?this._closedPromise:b($e("closed"))}cancel(t){return we(this)?this._ownerReadableStream===void 0?b(Se("cancel")):vr(this,t):b($e("cancel"))}read(t){if(!we(this))return b($e("read"));if(!ArrayBuffer.isView(t))return b(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return b(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return b(new TypeError("view's buffer must have non-zero byteLength"));if(t.buffer,this._ownerReadableStream===void 0)return b(Se("read from"));let r,o,n=M((i,a)=>{r=i,o=a});return function(i,a,s){let u=i._ownerReadableStream;u._disturbed=!0,u._state==="errored"?s._errorSteps(u._storedError):function(l,d,f){let c=l._controlledReadableByteStream,h=1;d.constructor!==DataView&&(h=d.constructor.BYTES_PER_ELEMENT);let y=d.constructor,E=d.buffer,R={buffer:E,bufferByteLength:E.byteLength,byteOffset:d.byteOffset,byteLength:d.byteLength,bytesFilled:0,elementSize:h,viewConstructor:y,readerType:"byob"};if(l._pendingPullIntos.length>0)return l._pendingPullIntos.push(R),void tr(c,f);if(c._state!=="closed"){if(l._queueTotalSize>0){if(Mr(l,R)){let m=Br(R);return xr(l),void f._chunkSteps(m)}if(l._closeRequested){let m=new TypeError("Insufficient bytes to fill elements in the given buffer");return Re(l,m),void f._errorSteps(m)}}l._pendingPullIntos.push(R),tr(c,f),be(l)}else{let m=new y(R.buffer,R.byteOffset,0);f._closeSteps(m)}}(u._readableStreamController,a,s)}(this,t,{_chunkSteps:i=>r({value:i,done:!1}),_closeSteps:i=>r({value:i,done:!0}),_errorSteps:i=>o(i)}),n}releaseLock(){if(!we(this))throw $e("releaseLock");this._ownerReadableStream!==void 0&&function(t){Sr(t);let r=new TypeError("Reader was released");Vr(t,r)}(this)}};function we(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof X}function Vr(e,t){let r=e._readIntoRequests;e._readIntoRequests=new x,r.forEach(o=>{o._errorSteps(t)})}function $e(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function je(e,t){let{highWaterMark:r}=e;if(r===void 0)return t;if(jr(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function et(e){let{size:t}=e;return t||(()=>1)}function tt(e,t){re(e,t);let r=e?.highWaterMark,o=e?.size;return{highWaterMark:r===void 0?void 0:Ft(r),size:o===void 0?void 0:vo(o,`${t} has member 'size' that`)}}function vo(e,t){return D(e,t),r=>Ft(e(r))}function So(e,t,r){return D(e,r),o=>_e(e,t,[o])}function Ro(e,t,r){return D(e,r),()=>_e(e,t,[])}function To(e,t,r){return D(e,r),o=>st(e,t,[o])}function qo(e,t,r){return D(e,r),(o,n)=>_e(e,t,[o,n])}Object.defineProperties(X.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),T(X.prototype.cancel,"cancel"),T(X.prototype.read,"read"),T(X.prototype.releaseLock,"releaseLock"),typeof S.toStringTag=="symbol"&&Object.defineProperty(X.prototype,S.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Eo=typeof AbortController=="function",Z=class{constructor(t={},r={}){t===void 0?t=null:qr(t,"First parameter");let o=tt(r,"Second parameter"),n=function(s,u){re(s,u);let l=s?.abort,d=s?.close,f=s?.start,c=s?.type,h=s?.write;return{abort:l===void 0?void 0:So(l,s,`${u} has member 'abort' that`),close:d===void 0?void 0:Ro(d,s,`${u} has member 'close' that`),start:f===void 0?void 0:To(f,s,`${u} has member 'start' that`),write:h===void 0?void 0:qo(h,s,`${u} has member 'write' that`),type:c}}(t,"First parameter");var i;if((i=this)._state="writable",i._storedError=void 0,i._writer=void 0,i._writableStreamController=void 0,i._writeRequests=new x,i._inFlightWriteRequest=void 0,i._closeRequest=void 0,i._inFlightCloseRequest=void 0,i._pendingAbortRequest=void 0,i._backpressure=!1,n.type!==void 0)throw new RangeError("Invalid type is specified");let a=et(o);(function(s,u,l,d){let f=Object.create(Te.prototype),c,h,y,E;c=u.start!==void 0?()=>u.start(f):()=>{},h=u.write!==void 0?R=>u.write(R,f):()=>q(void 0),y=u.close!==void 0?()=>u.close():()=>q(void 0),E=u.abort!==void 0?R=>u.abort(R):()=>q(void 0),function(R,m,W,L,k,j,$,Q){m._controlledWritableStream=R,R._writableStreamController=m,m._queue=void 0,m._queueTotalSize=void 0,ae(m),m._abortReason=void 0,m._abortController=function(){if(Eo)return new AbortController}(),m._started=!1,m._strategySizeAlgorithm=Q,m._strategyHWM=$,m._writeAlgorithm=L,m._closeAlgorithm=k,m._abortAlgorithm=j;let _=Nt(m);xt(R,_);let p=W();z(q(p),()=>(m._started=!0,ut(m),null),v=>(m._started=!0,Pt(R,v),null))}(s,f,c,h,y,E,l,d)})(this,n,je(o,1),a)}get locked(){if(!Y(this))throw Ne("locked");return Ge(this)}abort(t){return Y(this)?Ge(this)?b(new TypeError("Cannot abort a stream that already has a writer")):Dr(this,t):b(Ne("abort"))}close(){return Y(this)?Ge(this)?b(new TypeError("Cannot close a stream that already has a writer")):ie(this)?b(new TypeError("Cannot close an already-closing stream")):Qr(this):b(Ne("close"))}getWriter(){if(!Y(this))throw Ne("getWriter");return new U(this)}};function Y(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Z}function Ge(e){return e._writer!==void 0}function Dr(e,t){var r;if(e._state==="closed"||e._state==="errored")return q(void 0);e._writableStreamController._abortReason=t,(r=e._writableStreamController._abortController)===null||r===void 0||r.abort(t);let o=e._state;if(o==="closed"||o==="errored")return q(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let n=!1;o==="erroring"&&(n=!0,t=void 0);let i=M((a,s)=>{e._pendingAbortRequest={_promise:void 0,_resolve:a,_reject:s,_reason:t,_wasAlreadyErroring:n}});return e._pendingAbortRequest._promise=i,n||Mt(e,t),i}function Qr(e){let t=e._state;if(t==="closed"||t==="errored")return b(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let r=M((i,a)=>{let s={_resolve:i,_reject:a};e._closeRequest=s}),o=e._writer;var n;return o!==void 0&&e._backpressure&&t==="writable"&&Vt(o),Bt(n=e._writableStreamController,Yr,0),ut(n),r}function Pt(e,t){e._state!=="writable"?$t(e):Mt(e,t)}function Mt(e,t){let r=e._writableStreamController;e._state="erroring",e._storedError=t;let o=e._writer;o!==void 0&&Ur(o,t),!function(n){return!(n._inFlightWriteRequest===void 0&&n._inFlightCloseRequest===void 0)}(e)&&r._started&&$t(e)}function $t(e){e._state="errored",e._writableStreamController[wr]();let t=e._storedError;if(e._writeRequests.forEach(o=>{o._reject(t)}),e._writeRequests=new x,e._pendingAbortRequest===void 0)return void xe(e);let r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void xe(e);z(e._writableStreamController[mr](r._reason),()=>(r._resolve(),xe(e),null),o=>(r._reject(o),xe(e),null))}function ie(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function xe(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&Ht(t,e._storedError)}function xt(e,t){let r=e._writer;r!==void 0&&t!==e._backpressure&&(t?function(o){ct(o)}(r):Vt(r)),e._backpressure=t}Object.defineProperties(Z.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),T(Z.prototype.abort,"abort"),T(Z.prototype.close,"close"),T(Z.prototype.getWriter,"getWriter"),typeof S.toStringTag=="symbol"&&Object.defineProperty(Z.prototype,S.toStringTag,{value:"WritableStream",configurable:!0});var U=class{constructor(t){if(oe(t,1,"WritableStreamDefaultWriter"),function(n,i){if(!Y(n))throw new TypeError(`${i} is not a WritableStream.`)}(t,"First parameter"),Ge(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;let r=t._state;if(r==="writable")!ie(t)&&t._backpressure?ct(this):nr(this),Ke(this);else if(r==="erroring")kt(this,t._storedError),Ke(this);else if(r==="closed")nr(this),Ke(o=this),Xr(o);else{let n=t._storedError;kt(this,n),or(this,n)}var o}get closed(){return ue(this)?this._closedPromise:b(ce("closed"))}get desiredSize(){if(!ue(this))throw ce("desiredSize");if(this._ownerWritableStream===void 0)throw ke("desiredSize");return function(t){let r=t._ownerWritableStream,o=r._state;return o==="errored"||o==="erroring"?null:o==="closed"?0:Gr(r._writableStreamController)}(this)}get ready(){return ue(this)?this._readyPromise:b(ce("ready"))}abort(t){return ue(this)?this._ownerWritableStream===void 0?b(ke("abort")):function(r,o){return Dr(r._ownerWritableStream,o)}(this,t):b(ce("abort"))}close(){if(!ue(this))return b(ce("close"));let t=this._ownerWritableStream;return t===void 0?b(ke("close")):ie(t)?b(new TypeError("Cannot close an already-closing stream")):Qr(this._ownerWritableStream)}releaseLock(){if(!ue(this))throw ce("releaseLock");this._ownerWritableStream!==void 0&&function(t){let r=t._ownerWritableStream,o=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Ur(t,o),function(n,i){n._closedPromiseState==="pending"?Ht(n,i):function(a,s){or(a,s)}(n,i)}(t,o),r._writer=void 0,t._ownerWritableStream=void 0}(this)}write(t){return ue(this)?this._ownerWritableStream===void 0?b(ke("write to")):function(r,o){let n=r._ownerWritableStream,i=n._writableStreamController,a=function(l,d){try{return l._strategySizeAlgorithm(d)}catch(f){return rr(l,f),1}}(i,o);if(n!==r._ownerWritableStream)return b(ke("write to"));let s=n._state;if(s==="errored")return b(n._storedError);if(ie(n)||s==="closed")return b(new TypeError("The stream is closing or closed and cannot be written to"));if(s==="erroring")return b(n._storedError);let u=function(l){return M((d,f)=>{let c={_resolve:d,_reject:f};l._writeRequests.push(c)})}(n);return function(l,d,f){try{Bt(l,d,f)}catch(h){return void rr(l,h)}let c=l._controlledWritableStream;!ie(c)&&c._state==="writable"&&xt(c,Nt(l)),ut(l)}(i,o,a),u}(this,t):b(ce("write"))}};function ue(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof U}function Ur(e,t){e._readyPromiseState==="pending"?Zr(e,t):function(r,o){kt(r,o)}(e,t)}Object.defineProperties(U.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),T(U.prototype.abort,"abort"),T(U.prototype.close,"close"),T(U.prototype.releaseLock,"releaseLock"),T(U.prototype.write,"write"),typeof S.toStringTag=="symbol"&&Object.defineProperty(U.prototype,S.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var Yr={},Te=class{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!wt(this))throw gt("abortReason");return this._abortReason}get signal(){if(!wt(this))throw gt("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t){if(!wt(this))throw gt("error");this._controlledWritableStream._state==="writable"&&Kr(this,t)}[mr](t){let r=this._abortAlgorithm(t);return rt(this),r}[wr](){ae(this)}};function wt(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Te}function rt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Gr(e){return e._strategyHWM-e._queueTotalSize}function ut(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring")return void $t(t);if(e._queue.length===0)return;let r=e._queue.peek().value;r===Yr?function(o){let n=o._controlledWritableStream;(function(a){a._inFlightCloseRequest=a._closeRequest,a._closeRequest=void 0})(n),Tt(o);let i=o._closeAlgorithm();rt(o),z(i,()=>(function(a){a._inFlightCloseRequest._resolve(void 0),a._inFlightCloseRequest=void 0,a._state==="erroring"&&(a._storedError=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._resolve(),a._pendingAbortRequest=void 0)),a._state="closed";let s=a._writer;s!==void 0&&Xr(s)}(n),null),a=>(function(s,u){s._inFlightCloseRequest._reject(u),s._inFlightCloseRequest=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._reject(u),s._pendingAbortRequest=void 0),Pt(s,u)}(n,a),null))}(e):function(o,n){let i=o._controlledWritableStream;(function(a){a._inFlightWriteRequest=a._writeRequests.shift()})(i),z(o._writeAlgorithm(n),()=>{(function(s){s._inFlightWriteRequest._resolve(void 0),s._inFlightWriteRequest=void 0})(i);let a=i._state;if(Tt(o),!ie(i)&&a==="writable"){let s=Nt(o);xt(i,s)}return ut(o),null},a=>(i._state==="writable"&&rt(o),function(s,u){s._inFlightWriteRequest._reject(u),s._inFlightWriteRequest=void 0,Pt(s,u)}(i,a),null))}(e,r)}function rr(e,t){e._controlledWritableStream._state==="writable"&&Kr(e,t)}function Nt(e){return Gr(e)<=0}function Kr(e,t){let r=e._controlledWritableStream;rt(e),Mt(r,t)}function Ne(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function gt(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function ce(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function ke(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Ke(e){e._closedPromise=M((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function or(e,t){Ke(e),Ht(e,t)}function Ht(e,t){e._closedPromise_reject!==void 0&&(ve(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Xr(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function ct(e){e._readyPromise=M((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function kt(e,t){ct(e),Zr(e,t)}function nr(e){ct(e),Vt(e)}function Zr(e,t){e._readyPromise_reject!==void 0&&(ve(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Vt(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Te.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof S.toStringTag=="symbol"&&Object.defineProperty(Te.prototype,S.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var ir=typeof DOMException<"u"?DOMException:void 0,Po=function(e){if(typeof e!="function"&&typeof e!="object")return!1;try{return new e,!0}catch{return!1}}(ir)?ir:function(){let e=function(t,r){this.message=t||"",this.name=r||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function ar(e,t,r,o,n,i){let a=e.getReader(),s=t.getWriter();he(e)&&(e._disturbed=!0);let u,l,d,f=!1,c=!1,h="readable",y="writable",E=!1,R=!1,m=M(L=>{d=L}),W=Promise.resolve(void 0);return M((L,k)=>{let j;function $(){if(f)return;let w=M((O,g)=>{(function P(N){N?O():te(function(){return f?q(!0):te(s.ready,()=>te(a.read(),I=>!!I.done||(W=s.write(I.value),ve(W),!1)))}(),P,g)})(!1)});ve(w)}function Q(){return h="closed",r?C():v(()=>(Y(t)&&(E=ie(t),y=t._state),E||y==="closed"?q(void 0):y==="erroring"||y==="errored"?b(l):(E=!0,s.close())),!1,void 0),null}function _(w){return f||(h="errored",u=w,o?C(!0,w):v(()=>s.abort(w),!0,w)),null}function p(w){return c||(y="errored",l=w,n?C(!0,w):v(()=>a.cancel(w),!0,w)),null}if(i!==void 0&&(j=()=>{let w=i.reason!==void 0?i.reason:new Po("Aborted","AbortError"),O=[];o||O.push(()=>y==="writable"?s.abort(w):q(void 0)),n||O.push(()=>h==="readable"?a.cancel(w):q(void 0)),v(()=>Promise.all(O.map(g=>g())),!0,w)},i.aborted?j():i.addEventListener("abort",j)),he(e)&&(h=e._state,u=e._storedError),Y(t)&&(y=t._state,l=t._storedError,E=ie(t)),he(e)&&Y(t)&&(R=!0,d()),h==="errored")_(u);else if(y==="erroring"||y==="errored")p(l);else if(h==="closed")Q();else if(E||y==="closed"){let w=new TypeError("the destination writable stream closed before all data could be piped to it");n?C(!0,w):v(()=>a.cancel(w),!0,w)}function v(w,O,g){function P(){return y!=="writable"||E?N():Qt(function(){let I;return q(function ye(){if(I!==W)return I=W,V(W,ye,ye)}())}(),N),null}function N(){return w?z(w(),()=>F(O,g),I=>F(!0,I)):F(O,g),null}f||(f=!0,R?P():Qt(m,P))}function C(w,O){v(void 0,w,O)}function F(w,O){return c=!0,s.releaseLock(),a.releaseLock(),i!==void 0&&i.removeEventListener("abort",j),w?k(O):L(void 0),null}f||(z(a.closed,Q,_),z(s.closed,function(){return c||(y="closed"),null},p)),R?$():Ue(()=>{R=!0,d(),$()})})}function ko(e,t){return function(r){try{return r.getReader({mode:"byob"}).releaseLock(),!0}catch{return!1}}(e)?function(r){let o,n,i,a,s,u=r.getReader(),l=!1,d=!1,f=!1,c=!1,h=!1,y=!1,E=M(p=>{s=p});function R(p){Ut(p.closed,v=>(p!==u||(i.error(v),a.error(v),h&&y||s(void 0)),null))}function m(){l&&(u.releaseLock(),u=r.getReader(),R(u),l=!1),z(u.read(),p=>{var v,C;if(f=!1,c=!1,p.done)return h||i.close(),y||a.close(),(v=i.byobRequest)===null||v===void 0||v.respond(0),(C=a.byobRequest)===null||C===void 0||C.respond(0),h&&y||s(void 0),null;let F=p.value,w=F,O=F;if(!h&&!y)try{O=Zt(F)}catch(g){return i.error(g),a.error(g),s(u.cancel(g)),null}return h||i.enqueue(w),y||a.enqueue(O),d=!1,f?L():c&&k(),null},()=>(d=!1,null))}function W(p,v){l||(u.releaseLock(),u=r.getReader({mode:"byob"}),R(u),l=!0);let C=v?a:i,F=v?i:a;z(u.read(p),w=>{var O;f=!1,c=!1;let g=v?y:h,P=v?h:y;if(w.done){g||C.close(),P||F.close();let I=w.value;return I!==void 0&&(g||C.byobRequest.respondWithNewView(I),P||(O=F.byobRequest)===null||O===void 0||O.respond(0)),g&&P||s(void 0),null}let N=w.value;if(P)g||C.byobRequest.respondWithNewView(N);else{let I;try{I=Zt(N)}catch(ye){return C.error(ye),F.error(ye),s(u.cancel(ye)),null}g||C.byobRequest.respondWithNewView(N),F.enqueue(I)}return d=!1,f?L():c&&k(),null},()=>(d=!1,null))}function L(){if(d)return f=!0,q(void 0);d=!0;let p=i.byobRequest;return p===null?m():W(p.view,!1),q(void 0)}function k(){if(d)return c=!0,q(void 0);d=!0;let p=a.byobRequest;return p===null?m():W(p.view,!0),q(void 0)}function j(p){if(h=!0,o=p,y){let v=[o,n],C=u.cancel(v);s(C)}return E}function $(p){if(y=!0,n=p,h){let v=[o,n],C=u.cancel(v);s(C)}return E}let Q=new A({type:"bytes",start(p){i=p},pull:L,cancel:j}),_=new A({type:"bytes",start(p){a=p},pull:k,cancel:$});return R(u),[Q,_]}(e):function(r,o){let n=r.getReader(),i,a,s,u,l,d=!1,f=!1,c=!1,h=!1,y=M(k=>{l=k});function E(){return d?(f=!0,q(void 0)):(d=!0,z(n.read(),k=>{if(f=!1,k.done)return c||s.close(),h||u.close(),c&&h||l(void 0),null;let j=k.value,$=j,Q=j;return c||s.enqueue($),h||u.enqueue(Q),d=!1,f&&E(),null},()=>(d=!1,null)),q(void 0))}function R(k){if(c=!0,i=k,h){let j=[i,a],$=n.cancel(j);l($)}return y}function m(k){if(h=!0,a=k,c){let j=[i,a],$=n.cancel(j);l($)}return y}let W=new A({start(k){s=k},pull:E,cancel:R}),L=new A({start(k){u=k},pull:E,cancel:m});return Ut(n.closed,k=>(s.error(k),u.error(k),c&&h||l(void 0),null)),[W,L]}(e)}var J=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!He(this))throw Ve("desiredSize");return Jr(this)}close(){if(!He(this))throw Ve("close");if(!Oe(this))throw new TypeError("The stream is not in a state that permits close");(function(t){if(!Oe(t))return;let r=t._controlledReadableStream;t._closeRequested=!0,t._queue.length===0&&(Xe(t),Fe(r))})(this)}enqueue(t){if(!He(this))throw Ve("enqueue");if(!Oe(this))throw new TypeError("The stream is not in a state that permits enqueue");return function(r,o){if(!Oe(r))return;let n=r._controlledReadableStream;if(qe(n)&<(n)>0)zt(n,o,!1);else{let i;try{i=r._strategySizeAlgorithm(o)}catch(a){throw Ae(r,a),a}try{Bt(r,o,i)}catch(a){throw Ae(r,a),a}}We(r)}(this,t)}error(t){if(!He(this))throw Ve("error");Ae(this,t)}[Ot](t){ae(this);let r=this._cancelAlgorithm(t);return Xe(this),r}[Wt](t){let r=this._controlledReadableStream;if(this._queue.length>0){let o=Tt(this);this._closeRequested&&this._queue.length===0?(Xe(this),Fe(r)):We(this),t._chunkSteps(o)}else Cr(r,t),We(this)}[At](){}};function He(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof J}function We(e){if(function(r){let o=r._controlledReadableStream;return!Oe(r)||!r._started?!1:!!(qe(o)&<(o)>0||Jr(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,z(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,We(e)),null),r=>(Ae(e,r),null))}}function Xe(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Ae(e,t){let r=e._controlledReadableStream;r._state==="readable"&&(ae(e),Xe(e),to(r,t))}function Jr(e){let t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Oe(e){return!e._closeRequested&&e._controlledReadableStream._state==="readable"}function Co(e,t,r,o){let n=Object.create(J.prototype),i,a,s;i=t.start!==void 0?()=>t.start(n):()=>{},a=t.pull!==void 0?()=>t.pull(n):()=>q(void 0),s=t.cancel!==void 0?u=>t.cancel(u):()=>q(void 0),function(u,l,d,f,c,h,y){l._controlledReadableStream=u,l._queue=void 0,l._queueTotalSize=void 0,ae(l),l._started=!1,l._closeRequested=!1,l._pullAgain=!1,l._pulling=!1,l._strategySizeAlgorithm=y,l._strategyHWM=h,l._pullAlgorithm=f,l._cancelAlgorithm=c,u._readableStreamController=l,z(q(d()),()=>(l._started=!0,We(l),null),E=>(Ae(l,E),null))}(e,n,i,a,s,r,o)}function Ve(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Oo(e,t,r){return D(e,r),o=>_e(e,t,[o])}function Wo(e,t,r){return D(e,r),o=>_e(e,t,[o])}function Ao(e,t,r){return D(e,r),o=>st(e,t,[o])}function jo(e,t){if((e=`${e}`)!="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function Fo(e,t){if((e=`${e}`)!="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function sr(e,t){re(e,t);let r=e?.preventAbort,o=e?.preventCancel,n=e?.preventClose,i=e?.signal;return i!==void 0&&function(a,s){if(!function(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}(a))throw new TypeError(`${s} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:!!r,preventCancel:!!o,preventClose:!!n,signal:i}}function zo(e,t){re(e,t);let r=e?.readable;Rt(r,"readable","ReadableWritablePair"),function(n,i){if(!Ce(n))throw new TypeError(`${i} is not a ReadableStream.`)}(r,`${t} has member 'readable' that`);let o=e?.writable;return Rt(o,"writable","ReadableWritablePair"),function(n,i){if(!Pr(n))throw new TypeError(`${i} is not a WritableStream.`)}(o,`${t} has member 'writable' that`),{readable:r,writable:o}}Object.defineProperties(J.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),T(J.prototype.close,"close"),T(J.prototype.enqueue,"enqueue"),T(J.prototype.error,"error"),typeof S.toStringTag=="symbol"&&Object.defineProperty(J.prototype,S.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var A=class{constructor(t={},r={}){t===void 0?t=null:qr(t,"First parameter");let o=tt(r,"Second parameter"),n=function(a,s){re(a,s);let u=a,l=u?.autoAllocateChunkSize,d=u?.cancel,f=u?.pull,c=u?.start,h=u?.type;return{autoAllocateChunkSize:l===void 0?void 0:Er(l,`${s} has member 'autoAllocateChunkSize' that`),cancel:d===void 0?void 0:Oo(d,u,`${s} has member 'cancel' that`),pull:f===void 0?void 0:Wo(f,u,`${s} has member 'pull' that`),start:c===void 0?void 0:Ao(c,u,`${s} has member 'start' that`),type:h===void 0?void 0:jo(h,`${s} has member 'type' that`)}}(t,"First parameter");var i;if((i=this)._state="readable",i._reader=void 0,i._storedError=void 0,i._disturbed=!1,n.type==="bytes"){if(o.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");go(this,n,je(o,0))}else{let a=et(o);Co(this,n,je(o,1),a)}}get locked(){if(!he(this))throw de("locked");return qe(this)}cancel(t){return he(this)?qe(this)?b(new TypeError("Cannot cancel a stream that already has a reader")):eo(this,t):b(de("cancel"))}getReader(t){if(!he(this))throw de("getReader");return function(r,o){re(r,o);let n=r?.mode;return{mode:n===void 0?void 0:Fo(n,`${o} has member 'mode' that`)}}(t,"First parameter").mode===void 0?new G(this):function(r){return new X(r)}(this)}pipeThrough(t,r={}){if(!Ce(this))throw de("pipeThrough");oe(t,1,"pipeThrough");let o=zo(t,"First parameter"),n=sr(r,"Second parameter");if(this.locked)throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(o.writable.locked)throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return ve(ar(this,o.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),o.readable}pipeTo(t,r={}){if(!Ce(this))return b(de("pipeTo"));if(t===void 0)return b("Parameter 1 is required in 'pipeTo'.");if(!Pr(t))return b(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let o;try{o=sr(r,"Second parameter")}catch(n){return b(n)}return this.locked?b(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):t.locked?b(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ar(this,t,o.preventClose,o.preventAbort,o.preventCancel,o.signal)}tee(){if(!Ce(this))throw de("tee");if(this.locked)throw new TypeError("Cannot tee a stream that already has a reader");return ko(this)}values(t){if(!Ce(this))throw de("values");return function(r,o){let n=r.getReader(),i=new Ze(n,o),a=Object.create(Ar);return a._asyncIteratorImpl=i,a}(this,function(r,o){return re(r,o),{preventCancel:!!r?.preventCancel}}(t,"First parameter").preventCancel)}};function he(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof A}function qe(e){return e._reader!==void 0}function eo(e,t){if(e._disturbed=!0,e._state==="closed")return q(void 0);if(e._state==="errored")return b(e._storedError);Fe(e);let r=e._reader;if(r!==void 0&&we(r)){let o=r._readIntoRequests;r._readIntoRequests=new x,o.forEach(n=>{n._closeSteps(void 0)})}return V(e._readableStreamController[Ot](t),pr)}function Fe(e){e._state="closed";let t=e._reader;if(t!==void 0&&(Tr(t),fe(t))){let r=t._readRequests;t._readRequests=new x,r.forEach(o=>{o._closeSteps()})}}function to(e,t){e._state="errored",e._storedError=t;let r=e._reader;r!==void 0&&(jt(r,t),fe(r)?Wr(r,t):Vr(r,t))}function de(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function ro(e,t){re(e,t);let r=e?.highWaterMark;return Rt(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Ft(r)}}Object.defineProperties(A.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),T(A.prototype.cancel,"cancel"),T(A.prototype.getReader,"getReader"),T(A.prototype.pipeThrough,"pipeThrough"),T(A.prototype.pipeTo,"pipeTo"),T(A.prototype.tee,"tee"),T(A.prototype.values,"values"),typeof S.toStringTag=="symbol"&&Object.defineProperty(A.prototype,S.toStringTag,{value:"ReadableStream",configurable:!0}),typeof S.asyncIterator=="symbol"&&Object.defineProperty(A.prototype,S.asyncIterator,{value:A.prototype.values,writable:!0,configurable:!0});var oo=e=>e.byteLength;T(oo,"size");var ze=class{constructor(t){oe(t,1,"ByteLengthQueuingStrategy"),t=ro(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!ur(this))throw lr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!ur(this))throw lr("size");return oo}};function lr(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function ur(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof ze}Object.defineProperties(ze.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof S.toStringTag=="symbol"&&Object.defineProperty(ze.prototype,S.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var no=()=>1;T(no,"size");var Be=class{constructor(t){oe(t,1,"CountQueuingStrategy"),t=ro(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!dr(this))throw cr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!dr(this))throw cr("size");return no}};function cr(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function dr(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Be}function Bo(e,t,r){return D(e,r),o=>_e(e,t,[o])}function Lo(e,t,r){return D(e,r),o=>st(e,t,[o])}function Io(e,t,r){return D(e,r),(o,n)=>_e(e,t,[o,n])}Object.defineProperties(Be.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof S.toStringTag=="symbol"&&Object.defineProperty(Be.prototype,S.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var Le=class{constructor(t={},r={},o={}){t===void 0&&(t=null);let n=tt(r,"Second parameter"),i=tt(o,"Third parameter"),a=function(c,h){re(c,h);let y=c?.flush,E=c?.readableType,R=c?.start,m=c?.transform,W=c?.writableType;return{flush:y===void 0?void 0:Bo(y,c,`${h} has member 'flush' that`),readableType:E,start:R===void 0?void 0:Lo(R,c,`${h} has member 'start' that`),transform:m===void 0?void 0:Io(m,c,`${h} has member 'transform' that`),writableType:W}}(t,"First parameter");if(a.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(a.writableType!==void 0)throw new RangeError("Invalid writableType specified");let s=je(i,0),u=et(i),l=je(n,1),d=et(n),f;(function(c,h,y,E,R,m){function W(){return h}function L(_){return function(p,v){let C=p._transformStreamController;return p._backpressure?V(p._backpressureChangePromise,()=>{if((Y(p._writable)?p._writable._state:p._writableState)==="erroring")throw Y(p._writable)?p._writable._storedError:p._writableStoredError;return hr(C,v)}):hr(C,v)}(c,_)}function k(_){return function(p,v){return ot(p,v),q(void 0)}(c,_)}function j(){return function(_){let p=_._transformStreamController,v=p._flushAlgorithm();return io(p),V(v,()=>{if(_._readableState==="errored")throw _._readableStoredError;it(_)&&so(_)},C=>{throw ot(_,C),_._readableStoredError})}(c)}function $(){return function(_){return nt(_,!1),_._backpressureChangePromise}(c)}function Q(_){return dt(c,_),q(void 0)}c._writableState="writable",c._writableStoredError=void 0,c._writableHasInFlightOperation=!1,c._writableStarted=!1,c._writable=function(_,p,v,C,F,w,O){return new Z({start(g){_._writableController=g;try{let P=g.signal;P!==void 0&&P.addEventListener("abort",()=>{_._writableState==="writable"&&(_._writableState="erroring",P.reason&&(_._writableStoredError=P.reason))})}catch{}return V(p(),()=>(_._writableStarted=!0,_r(_),null),P=>{throw _._writableStarted=!0,vt(_,P),P})},write:g=>(function(P){P._writableHasInFlightOperation=!0}(_),V(v(g),()=>(function(P){P._writableHasInFlightOperation=!1}(_),_r(_),null),P=>{throw function(N,I){N._writableHasInFlightOperation=!1,vt(N,I)}(_,P),P})),close:()=>(function(g){g._writableHasInFlightOperation=!0}(_),V(C(),()=>(function(g){g._writableHasInFlightOperation=!1,g._writableState==="erroring"&&(g._writableStoredError=void 0),g._writableState="closed"}(_),null),g=>{throw function(P,N){P._writableHasInFlightOperation=!1,P._writableState,vt(P,N)}(_,g),g})),abort:g=>(_._writableState="errored",_._writableStoredError=g,F(g))},{highWaterMark:w,size:O})}(c,W,L,j,k,y,E),c._readableState="readable",c._readableStoredError=void 0,c._readableCloseRequested=!1,c._readablePulling=!1,c._readable=function(_,p,v,C,F,w){return new A({start:O=>(_._readableController=O,p().catch(g=>{at(_,g)})),pull:()=>(_._readablePulling=!0,v().catch(O=>{at(_,O)})),cancel:O=>(_._readableState="closed",C(O))},{highWaterMark:F,size:w})}(c,W,$,Q,R,m),c._backpressure=void 0,c._backpressureChangePromise=void 0,c._backpressureChangePromise_resolve=void 0,nt(c,!0),c._transformStreamController=void 0})(this,M(c=>{f=c}),l,d,s,u),function(c,h){let y=Object.create(ee.prototype),E,R;E=h.transform!==void 0?m=>h.transform(m,y):m=>{try{return ao(y,m),q(void 0)}catch(W){return b(W)}},R=h.flush!==void 0?()=>h.flush(y):()=>q(void 0),function(m,W,L,k){W._controlledTransformStream=m,m._transformStreamController=W,W._transformAlgorithm=L,W._flushAlgorithm=k}(c,y,E,R)}(this,a),a.start!==void 0?f(a.start(this._transformStreamController)):f(void 0)}get readable(){if(!fr(this))throw br("readable");return this._readable}get writable(){if(!fr(this))throw br("writable");return this._writable}};function fr(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof Le}function ot(e,t){at(e,t),dt(e,t)}function dt(e,t){io(e._transformStreamController),function(r,o){r._writableController.error(o),r._writableState==="writable"&&uo(r,o)}(e,t),e._backpressure&&nt(e,!1)}function nt(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=M(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}Object.defineProperties(Le.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof S.toStringTag=="symbol"&&Object.defineProperty(Le.prototype,S.toStringTag,{value:"TransformStream",configurable:!0});var ee=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!De(this))throw Qe("desiredSize");return lo(this._controlledTransformStream)}enqueue(t){if(!De(this))throw Qe("enqueue");ao(this,t)}error(t){if(!De(this))throw Qe("error");var r;r=t,ot(this._controlledTransformStream,r)}terminate(){if(!De(this))throw Qe("terminate");(function(t){let r=t._controlledTransformStream;it(r)&&so(r);let o=new TypeError("TransformStream terminated");dt(r,o)})(this)}};function De(e){return!!B(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof ee}function io(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function ao(e,t){let r=e._controlledTransformStream;if(!it(r))throw new TypeError("Readable side is not in a state that permits enqueue");try{(function(n,i){n._readablePulling=!1;try{n._readableController.enqueue(i)}catch(a){throw at(n,a),a}})(r,t)}catch(n){throw dt(r,n),r._readableStoredError}(function(n){return!function(i){return it(i)?!!(i._readablePulling||lo(i)>0):!1}(n)})(r)!==r._backpressure&&nt(r,!0)}function hr(e,t){return V(e._transformAlgorithm(t),void 0,r=>{throw ot(e._controlledTransformStream,r),r})}function Qe(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function br(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}function it(e){return!e._readableCloseRequested&&e._readableState==="readable"}function so(e){e._readableState="closed",e._readableCloseRequested=!0,e._readableController.close()}function at(e,t){e._readableState==="readable"&&(e._readableState="errored",e._readableStoredError=t),e._readableController.error(t)}function lo(e){return e._readableController.desiredSize}function vt(e,t){e._writableState!=="writable"?Dt(e):uo(e,t)}function uo(e,t){e._writableState="erroring",e._writableStoredError=t,!function(r){return r._writableHasInFlightOperation}(e)&&e._writableStarted&&Dt(e)}function Dt(e){e._writableState="errored"}function _r(e){e._writableState==="erroring"&&Dt(e)}Object.defineProperties(ee.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),T(ee.prototype.enqueue,"enqueue"),T(ee.prototype.error,"error"),T(ee.prototype.terminate,"terminate"),typeof S.toStringTag=="symbol"&&Object.defineProperty(ee.prototype,S.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});H();var se=e=>typeof e=="function";H();var co=65536;async function*Mo(e){let t=e.byteOffset+e.byteLength,r=e.byteOffset;for(;r!==t;){let o=Math.min(t-r,co),n=e.buffer.slice(r,r+o);r+=n.byteLength,yield new Uint8Array(n)}}async function*$o(e){let t=0;for(;t!==e.size;){let o=await e.slice(t,Math.min(e.size,t+co)).arrayBuffer();t+=o.byteLength,yield new Uint8Array(o)}}async function*ft(e,t=!1){for(let r of e)ArrayBuffer.isView(r)?t?yield*Mo(r):yield r:se(r.stream)?yield*r.stream():yield*$o(r)}function*fo(e,t,r=0,o){o??(o=t);let n=r<0?Math.max(t+r,0):Math.min(r,t),i=o<0?Math.max(t+o,0):Math.min(o,t),a=Math.max(i-n,0),s=0;for(let u of e){if(s>=a)break;let l=ArrayBuffer.isView(u)?u.byteLength:u.size;if(n&&l<=n)n-=l,i-=l;else{let d;ArrayBuffer.isView(u)?(d=u.subarray(n,Math.min(l,i)),s+=d.byteLength):(d=u.slice(n,Math.min(l,i)),s+=d.size),i-=l,n=0,yield d}}}var le=function(e,t,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)},ho=function(e,t,r,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r},pe,ht,Ie,Ee=class e{constructor(t=[],r={}){if(pe.set(this,[]),ht.set(this,""),Ie.set(this,0),r??(r={}),typeof t!="object"||t===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(!se(t[Symbol.iterator]))throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&!se(r))throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");let o=new TextEncoder;for(let i of t){let a;ArrayBuffer.isView(i)?a=new Uint8Array(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)):i instanceof ArrayBuffer?a=new Uint8Array(i.slice(0)):i instanceof e?a=i:a=o.encode(String(i)),ho(this,Ie,le(this,Ie,"f")+(ArrayBuffer.isView(a)?a.byteLength:a.size),"f"),le(this,pe,"f").push(a)}let n=r.type===void 0?"":String(r.type);ho(this,ht,/^[\x20-\x7E]*$/.test(n)?n:"","f")}static[(pe=new WeakMap,ht=new WeakMap,Ie=new WeakMap,Symbol.hasInstance)](t){return!!(t&&typeof t=="object"&&se(t.constructor)&&(se(t.stream)||se(t.arrayBuffer))&&/^(Blob|File)$/.test(t[Symbol.toStringTag]))}get type(){return le(this,ht,"f")}get size(){return le(this,Ie,"f")}slice(t,r,o){return new e(fo(le(this,pe,"f"),this.size,t,r),{type:o})}async text(){let t=new TextDecoder,r="";for await(let o of ft(le(this,pe,"f")))r+=t.decode(o,{stream:!0});return r+=t.decode(),r}async arrayBuffer(){let t=new Uint8Array(this.size),r=0;for await(let o of ft(le(this,pe,"f")))t.set(o,r),r+=o.length;return t.buffer}stream(){let t=ft(le(this,pe,"f"),!0);return new A({async pull(r){let{value:o,done:n}=await t.next();if(n)return queueMicrotask(()=>r.close());r.enqueue(o)},async cancel(){await t.return()}})}get[Symbol.toStringTag](){return"Blob"}};Object.defineProperties(Ee.prototype,{type:{enumerable:!0},size:{enumerable:!0},slice:{enumerable:!0},stream:{enumerable:!0},text:{enumerable:!0},arrayBuffer:{enumerable:!0}});var bo=function(e,t,r,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r},_o=function(e,t,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)},bt,_t,pt=class extends Ee{constructor(t,r,o={}){if(super(t,o),bt.set(this,void 0),_t.set(this,0),arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);bo(this,bt,String(r),"f");let n=o.lastModified===void 0?Date.now():Number(o.lastModified);Number.isNaN(n)||bo(this,_t,n,"f")}static[(bt=new WeakMap,_t=new WeakMap,Symbol.hasInstance)](t){return t instanceof Ee&&t[Symbol.toStringTag]==="File"&&typeof t.name=="string"}get name(){return _o(this,bt,"f")}get lastModified(){return _o(this,_t,"f")}get webkitRelativePath(){return""}get[Symbol.toStringTag](){return"File"}};H();var on=e=>e instanceof pt;export{se as a,Ee as b,pt as c,on as d};
|
|
4
|
-
/*! Bundled license information:
|
|
5
|
-
|
|
6
|
-
web-streams-polyfill/dist/ponyfill.mjs:
|
|
7
|
-
(**
|
|
8
|
-
* @license
|
|
9
|
-
* web-streams-polyfill v4.0.0-beta.3
|
|
10
|
-
* Copyright 2021 Mattias Buelens, Diwank Singh Tomer and other contributors.
|
|
11
|
-
* This code is released under the MIT license.
|
|
12
|
-
* SPDX-License-Identifier: MIT
|
|
13
|
-
*)
|
|
14
|
-
|
|
15
|
-
formdata-node/lib/esm/blobHelpers.js:
|
|
16
|
-
formdata-node/lib/esm/Blob.js:
|
|
17
|
-
(*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank *)
|
|
18
|
-
*/
|
package/chunks/chunk-6EQMZNIY.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{e as l}from"./chunk-LUNDTQ3G.js";import{Q as a,ba as e}from"./chunk-27Q5KW3A.js";import{b as n}from"./chunk-GZPNIYVZ.js";n();import*as i from"node:fs";import{randomUUID as d}from"node:crypto";import*as s from"node:path";var m=e("INSTALLATION"),o=class{getInstallationIdPath(){return a.getInstallationIdPath()}readInstallationIdFromFile(){let t=this.getInstallationIdPath();return i.existsSync(t)&&i.readFileSync(t,"utf-8").trim()||null}writeInstallationIdToFile(t){let r=this.getInstallationIdPath(),I=s.dirname(r);i.mkdirSync(I,{recursive:!0}),l(r,t,{encoding:"utf-8"})}getInstallationId(){try{let t=this.readInstallationIdFromFile();return t||(t=d(),this.writeInstallationIdToFile(t)),t}catch(t){return m.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}};export{o as a};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-6I6VGTKD.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{f as T}from"./chunk-ZX34M2GF.js";import{b as X}from"./chunk-7ZODGQO6.js";import{b as P}from"./chunk-TISQNFB5.js";import{c as g}from"./chunk-LUNDTQ3G.js";import{b as l,ba as $}from"./chunk-27Q5KW3A.js";import{b as _}from"./chunk-GZPNIYVZ.js";import{f as W}from"./chunk-OWGSC52X.js";_();var R=W(X(),1);import*as d from"node:fs/promises";import{constants as B}from"node:fs";import*as b from"node:path";var f=$("AGENTS_TEAM_TASKS"),v=32768,A=16;function C(r){if(!r)return;let e=Buffer.byteLength(JSON.stringify(r),"utf-8");if(e>v)throw new Error(`Task metadata is too large (${e} bytes; max ${v}). Trim the payload or store the bulk content elsewhere.`)}var K={retries:{retries:30,minTimeout:5,maxTimeout:100,factor:2,randomize:!0},stale:5e3,onCompromised:r=>{f.warn("task lock compromised:",r?.message??r)}},j=new Map;function q(r){let e=j.get(r);return e||(e=new P,j.set(r,e)),e}async function h(r,e,t){return q(r).runExclusive(async()=>{let a;try{a=await R.default.lock(r,K)}catch(o){if(l(o)&&o.code==="ENOENT")return t();throw o}try{return await e()}finally{await a()}})}var z="__reciprocal__",L=new Map;function Y(r){let e=L.get(r);return e||(e=new P,L.set(r,e)),e}function G(r){if(!/^[1-9]\d*$/.test(r))throw new Error(`Invalid task ID "${r}". Task IDs must be positive integers.`)}function m(r,e){return G(e),b.join(T(r),`${e}.json`)}var O=new Set;function ie(r){return O.add(r),()=>{O.delete(r)}}function k(r){for(let e of O)try{e(r)}catch(t){f.warn(`task update listener failed: ${t}`)}}async function oe(r,e){C(e.metadata);let t=T(r);await d.mkdir(t,{recursive:!0});let a=15;for(let o=0;o<a;o++){let c=await I(t),s={id:c,subject:e.subject,description:e.description,activeForm:e.activeForm,owner:e.owner,status:"pending",blocks:[],blockedBy:[],metadata:e.metadata},n=b.join(t,`${c}.json`);try{await(await d.open(n,B.O_WRONLY|B.O_CREAT|B.O_EXCL)).close()}catch(i){if(l(i)&&i.code==="EEXIST")continue;throw i}try{await g(n,s)}catch(i){throw await d.unlink(n).catch(()=>{}),i}return k(r),s}throw new Error(`Failed to create task after ${a} attempts (ID contention).`)}async function ce(r,e){let t=m(r,e);try{let a=await d.readFile(t,"utf-8");return JSON.parse(a)}catch(a){if(l(a)&&a.code==="ENOENT")return;throw a}}var p=class extends Error{constructor(t,a,o){super(`Task #${t} is owned by "${o}". Only the leader or the owner can change status / owner / subject / description / blocks.`);this.taskId=t;this.callerName=a;this.actualOwner=o;this.name="TaskOwnershipError"}};async function F(r,e,t,a){let o=m(r,e);return h(o,async()=>{let c;try{c=await d.readFile(o,"utf-8")}catch(n){if(l(n)&&n.code==="ENOENT")return;throw n}let s=JSON.parse(c);if(a?.callerName!==void 0&&a.callerName!==z&&(t.status!==void 0||t.owner!==void 0||t.subject!==void 0||t.description!==void 0||(t.addBlocks?.length??0)>0||(t.addBlockedBy?.length??0)>0)&&s.owner&&s.owner!==a.callerName)throw new p(e,a.callerName,s.owner);if(t.addBlocks?.length){let n=new Set(s.blocks);for(let i of t.addBlocks)n.add(i);s.blocks=Array.from(n)}if(t.addBlockedBy?.length){let n=new Set(s.blockedBy);for(let i of t.addBlockedBy)n.add(i);s.blockedBy=Array.from(n)}if(t.status!==void 0&&(s.status=t.status,t.status==="completed"&&s.blocks.length>0&&await V(r,e,s.blocks)),t.owner!==void 0&&(s.owner=t.owner?t.owner:void 0),t.subject!==void 0&&(s.subject=t.subject),t.description!==void 0&&(s.description=t.description),t.activeForm!==void 0&&(s.activeForm=t.activeForm??void 0),t.metadata!==void 0){s.metadata=s.metadata??{};for(let[n,i]of Object.entries(t.metadata))n==="__proto__"||n==="constructor"||n==="prototype"||(i===null?delete s.metadata[n]:s.metadata[n]=i);Object.keys(s.metadata).length===0&&(s.metadata=void 0),C(s.metadata)}return await g(o,s),k(r),s},()=>{})}async function de(r,e,t){let a=m(r,e),o=await h(a,async()=>{let s;try{let i=await d.readFile(a,"utf-8");s=JSON.parse(i)}catch(i){if(l(i)&&i.code==="ENOENT")return null;throw i}if(t?.callerName!==void 0&&s.owner&&s.owner!==t.callerName)throw new p(e,t.callerName,s.owner);let n=new Set([...s.blocks,...s.blockedBy]);n.delete(e);try{await d.unlink(a)}catch(i){if(l(i)&&i.code==="ENOENT")return null;throw i}return n},()=>null);if(o===null)return!1;let c=await Promise.allSettled(Array.from(o).map(s=>Q(r,s,e)));for(let s of c)s.status==="rejected"&&f.warn(`deleteTask(${e}): edge cleanup failed: ${s.reason}`);return k(r),!0}async function Q(r,e,t){let a=m(r,e);await h(a,async()=>{try{let o=await d.readFile(a,"utf-8"),c=JSON.parse(o),s=c.blocks.length,n=c.blockedBy.length;if(c.blocks=c.blocks.filter(i=>i!==t),c.blockedBy=c.blockedBy.filter(i=>i!==t),c.blocks.length===s&&c.blockedBy.length===n)return;await g(a,c)}catch(o){if(l(o)&&o.code==="ENOENT")return;throw o}},()=>{})}async function x(r,e){let t=T(r),a;try{a=await d.readdir(t)}catch(n){if(l(n)&&n.code==="ENOENT")return[];let i=n instanceof Error?n.message:String(n);throw f.warn(`Failed to list tasks dir ${t}: ${i}`),n instanceof Error?n:new Error(i)}let o=a.filter(n=>n.endsWith(".json")),c=[];for(let n=0;n<o.length;n+=A){let i=o.slice(n,n+A),w=await Promise.all(i.map(async D=>{let y=b.join(t,D),S;try{S=await d.readFile(y,"utf-8")}catch(u){if(l(u)&&u.code==="ENOENT")return;let E=u instanceof Error?u.message:String(u);f.warn(`Failed to read task file ${y}: ${E}`);return}if(S.trim()!=="")try{return JSON.parse(S)}catch(u){let E=u instanceof Error?u.message:String(u);f.warn(`Quarantining corrupt task file ${y}: ${E}`);let J=`${y}.corrupt-${Date.now()}`;try{await d.rename(y,J)}catch(N){let U=N instanceof Error?N.message:String(N);f.warn(`Failed to quarantine ${y}: ${U}`)}return}}));c.push(...w)}let s=c.filter(n=>n!==void 0);return s.sort((n,i)=>Number(n.id)-Number(i.id)),e?s.filter(n=>!(e.status!==void 0&&n.status!==e.status||e.owner!==void 0&&n.owner!==e.owner||e.blockedBy!==void 0&&!n.blockedBy.includes(e.blockedBy))):s}async function le(r){let e=T(r);await d.rm(e,{recursive:!0,force:!0}),k(r)}async function V(r,e,t){let a=await Promise.allSettled(t.map(async o=>{let c=m(r,o);await h(c,async()=>{let s;try{s=await d.readFile(c,"utf-8")}catch(w){if(l(w)&&w.code==="ENOENT")return;throw w}let n=JSON.parse(s),i=n.blockedBy.length;n.blockedBy=n.blockedBy.filter(w=>w!==e),n.blockedBy.length!==i&&await g(c,n)},()=>{})}));for(let o of a)o.status==="rejected"&&f.warn(`unblockDependents(${e}): ${o.reason}`);k(r)}async function ue(r,e,t){await F(r,e,{addBlocks:[t]}),await F(r,t,{addBlockedBy:[e]})}async function fe(r,e,t,a){return a?.checkAgentBusy?Y(t).runExclusive(()=>M(r,e,t,a,!0)):M(r,e,t,a,!1)}async function M(r,e,t,a,o){if(o&&await H(r,t))return;let c=m(r,e);return h(c,async()=>{let s;try{s=await d.readFile(c,"utf-8")}catch(i){if(l(i)&&i.code==="ENOENT")return;throw i}let n=JSON.parse(s);if(n.status==="pending"&&!n.owner)return n.owner=a?.ownerName??t,n.status="in_progress",await g(c,n),k(r),n},()=>{})}async function H(r,e){let t=await x(r,{status:"in_progress"}),a=e.split("@")[0];return t.some(o=>o.owner===e||o.owner===a)}async function Z(r,e,t){let a=m(r,e);return h(a,async()=>{let o;try{o=await d.readFile(a,"utf-8")}catch(s){if(l(s)&&s.code==="ENOENT")return!1;throw s}let c=JSON.parse(o);return c.status!=="in_progress"||c.owner!==t?!1:(c.owner=void 0,c.status="pending",await g(a,c),!0)},()=>!1)}async function we(r,e){let t=e.split("@")[0],o=(await x(r,{status:"in_progress"})).filter(i=>i.owner===e||i.owner===t),c=await Promise.allSettled(o.map(i=>Z(r,i.id,i.owner))),s=c.filter(i=>i.status==="rejected");s.length>0&&f.warn(`unassignTeammateTasks: ${s.length}/${o.length} task(s) failed to unassign for ${e}`);let n=c.filter(i=>i.status==="fulfilled"&&i.value===!0).length;return n>0&&k(r),n}async function ge(r){let e=await x(r),t=new Map;for(let a of e){if(!a.owner)continue;let o=t.get(a.owner)??{inProgress:0,completed:0};a.status==="in_progress"?o.inProgress++:a.status==="completed"&&o.completed++,t.set(a.owner,o)}return t}async function I(r){let e;try{e=await d.readdir(r)}catch{return"1"}let t=0;for(let a of e){if(!a.endsWith(".json"))continue;let o=parseInt(a.replace(".json",""),10);!isNaN(o)&&o>t&&(t=o)}return String(t+1)}export{z as a,G as b,m as c,ie as d,k as e,oe as f,ce as g,p as h,F as i,de as j,x as k,le as l,ue as m,fe as n,Z as o,we as p,ge as q};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Matilda
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-DC7LAFZZ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as i}from"./chunk-GZPNIYVZ.js";i();var m="MATILDA_API_KEY";var g="matilda-code-1.0",u="Matilda",_="https://matilda.maincode.com/api/v1/code";var A={id:"matilda",label:"Matilda",description:"Connect to the Matilda Core code API endpoint",protocol:"openai",baseUrl:_,envKey:m,models:[{id:g,displayName:u,contextWindowSize:1048576,description:"Matilda Code model",generationConfig:{openAIRequestProfile:"matilda-code",timeout:6e5,samplingParams:{max_tokens:65536,chat_template_kwargs:{enable_thinking:!0}},schemaCompliance:"openapi_30",splitToolMedia:!0,customHeaders:{"User-Agent":"MatildaCode/0.1"}}}],modelNamePrefix:"",documentationUrl:"https://matilda.maincode.help/welcome/external-api",uiGroup:"third-party"};function h(o){return o.trim().replace(/\/+$/,"").replace(/\/api\/v1(?:\/code)?$/i,"")}async function f(o){let{baseUrl:n,email:s,password:d,signal:l}=o,r=h(n),p=`${r}/api/auth/login`,t;try{t=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,password:d}),signal:l})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Could not reach Matilda at ${r}: ${c}`)}if(t.status===401)throw new Error("Invalid email or password.");if(!t.ok)throw new Error(`Matilda sign-in failed (HTTP ${t.status}). Please try again.`);let e;try{e=await t.json()}catch{throw new Error("Matilda sign-in returned an unreadable response.")}if(!e||typeof e.token!="string"||e.token.length===0)throw new Error("Matilda sign-in did not return a token.");return{token:e.token,refreshToken:typeof e.refreshToken=="string"?e.refreshToken:void 0,userId:typeof e.userId=="string"?e.userId:void 0,email:typeof e.email=="string"?e.email:void 0,displayName:typeof e.displayName=="string"?e.displayName:void 0}}export{m as a,g as b,u as c,_ as d,A as e,h as f,f as g};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2026 Matilda Team
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-DE3HKC2W.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{ba as f}from"./chunk-27Q5KW3A.js";import{b as x}from"./chunk-GZPNIYVZ.js";x();var k=f("TRUSTED_HOOKS"),h=(t=>(t.Project="project",t.User="user",t.System="system",t.Extensions="extensions",t.Session="session",t))(h||{}),_=(i=>(i.PreToolUse="PreToolUse",i.PostToolUse="PostToolUse",i.PostToolUseFailure="PostToolUseFailure",i.PostToolBatch="PostToolBatch",i.Notification="Notification",i.UserPromptSubmit="UserPromptSubmit",i.UserPromptExpansion="UserPromptExpansion",i.SessionStart="SessionStart",i.Stop="Stop",i.SubagentStart="SubagentStart",i.SubagentStop="SubagentStop",i.PreCompact="PreCompact",i.PostCompact="PostCompact",i.SessionEnd="SessionEnd",i.PermissionRequest="PermissionRequest",i.PermissionDenied="PermissionDenied",i.StopFailure="StopFailure",i.TodoCreated="TodoCreated",i.TodoCompleted="TodoCompleted",i.InstructionsLoaded="InstructionsLoaded",i))(_||{}),P=(s=>(s.Validation="validation",s.PostWrite="postWrite",s))(P||{}),E=["enabled","disabled","notifications"],S=(n=>(n.Command="command",n.Http="http",n.Function="function",n.Prompt="prompt",n))(S||{});function v(o){let e=o.name??"";switch(o.type){case"command":return e?`${e}:${o.command}`:o.command;case"http":return e?`${e}:${o.url}`:o.url;case"function":return e?`${e}:${o.id??"function"}`:o.id??"function";case"prompt":return e?`${e}:${o.prompt}`:o.prompt;default:return e||"unknown"}}var O=1e4;function C(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").slice(0,O).replace(/&(?:a(?:mp?)?|lt?|gt?)?$/,"")}function U(o,e){switch(o){case"PreToolUse":return new p(e);case"PostToolUse":return new a(e);case"PostToolUseFailure":return new c(e);case"UserPromptExpansion":return new d(e);case"PostToolBatch":return new l(e);case"Stop":case"SubagentStop":return new g(e);case"PermissionRequest":return new m(e);default:return new r(e)}}var r=class{continue;stopReason;suppressOutput;systemMessage;terminalSequence;decision;reason;hookSpecificOutput;constructor(e={}){this.continue=e.continue,this.stopReason=e.stopReason,this.suppressOutput=e.suppressOutput,this.systemMessage=e.systemMessage,this.terminalSequence=e.terminalSequence,this.decision=e.decision,this.reason=e.reason,this.hookSpecificOutput=e.hookSpecificOutput}isBlockingDecision(){return this.decision==="block"||this.decision==="deny"}shouldStopExecution(){return this.continue===!1}getEffectiveReason(){return this.stopReason||this.reason||"No reason provided"}getRawAdditionalContext(){if(this.hookSpecificOutput&&"additionalContext"in this.hookSpecificOutput){let e=this.hookSpecificOutput.additionalContext;return typeof e=="string"?e:void 0}}getAdditionalContext(){let e=this.getRawAdditionalContext();if(e!==void 0)return e.replace(/</g,"<").replace(/>/g,">")}getBlockingError(){return this.isBlockingDecision()?{blocked:!0,reason:this.getEffectiveReason()}:{blocked:!1,reason:""}}shouldClearContext(){return!1}},p=class extends r{getPermissionDecision(){if(this.hookSpecificOutput&&"permissionDecision"in this.hookSpecificOutput){let e=this.hookSpecificOutput.permissionDecision;if(e==="allow"||e==="deny"||e==="ask")return e}if(this.decision==="allow"||this.decision==="approve")return"allow";if(this.decision==="deny"||this.decision==="block")return"deny";if(this.decision==="ask")return"ask"}getPermissionDecisionReason(){if(this.hookSpecificOutput&&"permissionDecisionReason"in this.hookSpecificOutput){let e=this.hookSpecificOutput.permissionDecisionReason;if(typeof e=="string")return e}return this.reason}isDenied(){return this.getPermissionDecision()==="deny"}isAsk(){return this.getPermissionDecision()==="ask"}isAllowed(){return this.getPermissionDecision()==="allow"}},a=class extends r{decision;reason;constructor(e={}){super(e),this.decision=e.decision??"allow",this.reason=e.reason??"No reason provided",e.decision===void 0&&k.debug('PostToolUseHookOutput: No explicit decision set, defaulting to "allow"'),e.reason===void 0&&k.debug('PostToolUseHookOutput: No explicit reason set, defaulting to "No reason provided"')}},c=class extends r{getAdditionalContext(){return super.getAdditionalContext()}},d=class extends r{getAdditionalContext(){let e=this.getRawAdditionalContext();if(e!==void 0)return C(e)}},l=class extends r{shouldStopExecution(){return super.shouldStopExecution()||this.isBlockingDecision()}},g=class extends r{stopReason;constructor(e={}){super(e),this.stopReason=e.stopReason}getStopReason(){if(this.stopReason)return`Stop hook feedback:
|
|
4
|
-
${this.stopReason}`}},m=class extends r{getPermissionDecision(){if(this.hookSpecificOutput&&"decision"in this.hookSpecificOutput){let e=this.hookSpecificOutput.decision;if(typeof e=="object"&&e!==null&&!Array.isArray(e))return e}}isPermissionDenied(){return this.getPermissionDecision()?.behavior==="deny"}getDenyMessage(){return this.getPermissionDecision()?.message}shouldInterrupt(){return this.getPermissionDecision()?.interrupt===!0}getUpdatedToolInput(){return this.getPermissionDecision()?.updatedInput}getUpdatedPermissions(){return this.getPermissionDecision()?.updatedPermissions}},b=(n=>(n.PermissionPrompt="permission_prompt",n.IdlePrompt="idle_prompt",n.AuthSuccess="auth_success",n.ElicitationDialog="elicitation_dialog",n))(b||{}),H=(t=>(t.Startup="startup",t.Resume="resume",t.Clear="clear",t.Compact="compact",t.Branch="branch",t))(H||{}),I=(t=>(t.Default="default",t.Plan="plan",t.AutoEdit="auto_edit",t.Auto="auto",t.Bogan="bogan",t))(I||{}),T=(t=>(t.Clear="clear",t.Logout="logout",t.PromptInputExit="prompt_input_exit",t.Bypass_permissions_disabled="bypass_permissions_disabled",t.Other="other",t))(T||{}),y=(s=>(s.Manual="manual",s.Auto="auto",s))(y||{}),R=(s=>(s.Manual="manual",s.Auto="auto",s))(R||{}),w=(n=>(n.Bash="Bash",n.Explorer="Explorer",n.Plan="Plan",n.Custom="Custom",n))(w||{});function A(o,e){let s=new Map(o.map(n=>[n.id,n])),u={created:[],completed:[]};for(let n of e){let t=s.get(n.id);t?t.status!=="completed"&&n.status==="completed"&&u.completed.push(n):u.created.push(n)}return u}export{h as a,_ as b,P as c,E as d,S as e,v as f,O as g,C as h,U as i,r as j,p as k,a as l,c as m,d as n,l as o,g as p,m as q,b as r,H as s,I as t,T as u,y as v,R as w,w as x,A as y};
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2026 Matilda Team
|
|
8
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
*/
|
package/chunks/chunk-FWDMPRKU.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as i}from"./chunk-GZPNIYVZ.js";import{c as p,e as Vr}from"./chunk-OWGSC52X.js";var V,Ct=p(()=>{i();(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(V||(V={}))});var B,St=p(()=>{i();(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(B||(B={}))});function b(t){return Symbol.for(t)}var Br,L,O=p(()=>{i();Br=function(){function t(r){var e=this;e._currentContext=r?new Map(r):new Map,e.getValue=function(n){return e._currentContext.get(n)},e.setValue=function(n,a){var o=new t(e._currentContext);return o._currentContext.set(n,a),o},e.deleteValue=function(n){var a=new t(e._currentContext);return a._currentContext.delete(n),a}}return t}(),L=new Br});var Lr,Ur,Rt,Mt=p(()=>{i();O();Lr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],u;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(c){u={error:c}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(u)throw u.error}}return o},Ur=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},Rt=function(){function t(){}return t.prototype.active=function(){return L},t.prototype.with=function(r,e,n){for(var a=[],o=3;o<arguments.length;o++)a[o-3]=arguments[o];return e.call.apply(e,Ur([n],Lr(a),!1))},t.prototype.bind=function(r,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}()});var wt,Dt=p(()=>{i();wt=globalThis});var Gt=p(()=>{i();Dt()});var Vt=p(()=>{i();Gt()});var d,Z=p(()=>{i();d="1.9.0"});function jr(t){var r=new Set([t]),e=new Set,n=t.match(Bt);if(!n)return function(){return!1};var a={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(a.prerelease!=null)return function(f){return f===t};function o(c){return e.add(c),!1}function u(c){return r.add(c),!0}return function(f){if(r.has(f))return!0;if(e.has(f))return!1;var g=f.match(Bt);if(!g)return o(f);var m={major:+g[1],minor:+g[2],patch:+g[3],prerelease:g[4]};return m.prerelease!=null||a.major!==m.major?o(f):a.major===0?a.minor===m.minor&&a.patch<=m.patch?u(f):o(f):a.minor<=m.minor?u(f):o(f)}}var Bt,Lt,Ut=p(()=>{i();Z();Bt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;Lt=jr(d)});function _(t,r,e,n){var a;n===void 0&&(n=!1);var o=C[P]=(a=C[P])!==null&&a!==void 0?a:{version:d};if(!n&&o[t]){var u=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return e.error(u.stack||u.message),!1}if(o.version!==d){var u=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+d);return e.error(u.stack||u.message),!1}return o[t]=r,e.debug("@opentelemetry/api: Registered a global for "+t+" v"+d+"."),!0}function v(t){var r,e,n=(r=C[P])===null||r===void 0?void 0:r.version;if(!(!n||!Lt(n)))return(e=C[P])===null||e===void 0?void 0:e[t]}function y(t,r){r.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+d+".");var e=C[P];e&&delete e[t]}var kr,P,C,E=p(()=>{i();Vt();Z();Ut();kr=d.split(".")[0],P=Symbol.for("opentelemetry.js.api."+kr),C=wt});function S(t,r,e){var n=v("diag");if(n)return e.unshift(r),n[t].apply(n,Kr([],Xr(e),!1))}var Xr,Kr,jt,kt=p(()=>{i();E();Xr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],u;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(c){u={error:c}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(u)throw u.error}}return o},Kr=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},jt=function(){function t(r){this._namespace=r.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return S("debug",this._namespace,r)},t.prototype.error=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return S("error",this._namespace,r)},t.prototype.info=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return S("info",this._namespace,r)},t.prototype.warn=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return S("warn",this._namespace,r)},t.prototype.verbose=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return S("verbose",this._namespace,r)},t}()});var s,U=p(()=>{i();(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(s||(s={}))});function Xt(t,r){t<s.NONE?t=s.NONE:t>s.ALL&&(t=s.ALL),r=r||{};function e(n,a){var o=r[n];return typeof o=="function"&&t>=a?o.bind(r):function(){}}return{error:e("error",s.ERROR),warn:e("warn",s.WARN),info:e("info",s.INFO),debug:e("debug",s.DEBUG),verbose:e("verbose",s.VERBOSE)}}var Kt=p(()=>{i();U()});var Fr,Yr,zr,l,A=p(()=>{i();kt();Kt();U();E();Fr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],u;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(c){u={error:c}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(u)throw u.error}}return o},Yr=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},zr="diag",l=function(){function t(){function r(a){return function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];var c=v("diag");if(c)return c[a].apply(c,Yr([],Fr(o),!1))}}var e=this,n=function(a,o){var u,c,f;if(o===void 0&&(o={logLevel:s.INFO}),a===e){var g=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error((u=g.stack)!==null&&u!==void 0?u:g.message),!1}typeof o=="number"&&(o={logLevel:o});var m=v("diag"),Ot=Xt((c=o.logLevel)!==null&&c!==void 0?c:s.INFO,a);if(m&&!o.suppressOverrideMessage){var Pt=(f=new Error().stack)!==null&&f!==void 0?f:"<failed to generate stacktrace>";m.warn("Current logger will be overwritten from "+Pt),Ot.warn("Current logger will overwrite one already registered from "+Pt)}return _("diag",Ot,e,!0)};e.setLogger=n,e.disable=function(){y(zr,e)},e.createComponentLogger=function(a){return new jt(a)},e.verbose=r("verbose"),e.debug=r("debug"),e.info=r("info"),e.warn=r("warn"),e.error=r("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}()});var Wr,Hr,tt,$r,h,R=p(()=>{i();Mt();E();A();Wr=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],u;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(c){u={error:c}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(u)throw u.error}}return o},Hr=function(t,r,e){if(e||arguments.length===2)for(var n=0,a=r.length,o;n<a;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return t.concat(o||Array.prototype.slice.call(r))},tt="context",$r=new Rt,h=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(r){return _(tt,r,l.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(r,e,n){for(var a,o=[],u=3;u<arguments.length;u++)o[u-3]=arguments[u];return(a=this._getContextManager()).with.apply(a,Hr([r,e,n],Wr(o),!1))},t.prototype.bind=function(r,e){return this._getContextManager().bind(r,e)},t.prototype._getContextManager=function(){return v(tt)||$r},t.prototype.disable=function(){this._getContextManager().disable(),y(tt,l.instance())},t}()});var rt,Ft=p(()=>{i();R();rt=h.getInstance()});var T,et=p(()=>{i();(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(T||(T={}))});var M,w,j,k=p(()=>{i();et();M="0000000000000000",w="00000000000000000000000000000000",j={traceId:w,spanId:M,traceFlags:T.NONE}});var x,X=p(()=>{i();k();x=function(){function t(r){r===void 0&&(r=j),this._spanContext=r}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(r,e){return this},t.prototype.setAttributes=function(r){return this},t.prototype.addEvent=function(r,e){return this},t.prototype.addLink=function(r){return this},t.prototype.addLinks=function(r){return this},t.prototype.setStatus=function(r){return this},t.prototype.updateName=function(r){return this},t.prototype.end=function(r){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(r,e){},t}()});function K(t){return t.getValue(nt)||void 0}function Yt(){return K(h.getInstance().active())}function D(t,r){return t.setValue(nt,r)}function zt(t){return t.deleteValue(nt)}function Wt(t,r){return D(t,new x(r))}function F(t){var r;return(r=K(t))===null||r===void 0?void 0:r.spanContext()}var nt,ot=p(()=>{i();O();X();R();nt=b("OpenTelemetry Context Key SPAN")});function at(t){return Qr.test(t)&&t!==w}function it(t){return qr.test(t)&&t!==M}function I(t){return at(t.traceId)&&it(t.spanId)}function Ht(t){return new x(t)}var Qr,qr,Y=p(()=>{i();k();X();Qr=/^([0-9a-f]{32})$/i,qr=/^[0-9a-f]{16}$/i});function Jr(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var ut,z,pt=p(()=>{i();R();ot();X();Y();ut=h.getInstance(),z=function(){function t(){}return t.prototype.startSpan=function(r,e,n){n===void 0&&(n=ut.active());var a=!!e?.root;if(a)return new x;var o=n&&F(n);return Jr(o)&&I(o)?new x(o):new x},t.prototype.startActiveSpan=function(r,e,n,a){var o,u,c;if(!(arguments.length<2)){arguments.length===2?c=e:arguments.length===3?(o=e,c=n):(o=e,u=n,c=a);var f=u??ut.active(),g=this.startSpan(r,o,f),m=D(f,g);return ut.with(m,c,void 0,g)}},t}()});var Zr,W,ct=p(()=>{i();pt();Zr=new z,W=function(){function t(r,e,n,a){this._provider=r,this.name=e,this.version=n,this.options=a}return t.prototype.startSpan=function(r,e,n){return this._getTracer().startSpan(r,e,n)},t.prototype.startActiveSpan=function(r,e,n,a){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var r=this._provider.getDelegateTracer(this.name,this.version,this.options);return r?(this._delegate=r,this._delegate):Zr},t}()});var $t,Qt=p(()=>{i();pt();$t=function(){function t(){}return t.prototype.getTracer=function(r,e,n){return new z},t}()});var te,G,ft=p(()=>{i();ct();Qt();te=new $t,G=function(){function t(){}return t.prototype.getTracer=function(r,e,n){var a;return(a=this.getDelegateTracer(r,e,n))!==null&&a!==void 0?a:new W(this,r,e,n)},t.prototype.getDelegate=function(){var r;return(r=this._delegate)!==null&&r!==void 0?r:te},t.prototype.setDelegate=function(r){this._delegate=r},t.prototype.getDelegateTracer=function(r,e,n){var a;return(a=this._delegate)===null||a===void 0?void 0:a.getTracer(r,e,n)},t}()});var st,qt,Jt=p(()=>{i();E();ft();Y();ot();A();st="trace",qt=function(){function t(){this._proxyTracerProvider=new G,this.wrapSpanContext=Ht,this.isSpanContextValid=I,this.deleteSpan=zt,this.getSpan=K,this.getActiveSpan=Yt,this.getSpanContext=F,this.setSpan=D,this.setSpanContext=Wt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(r){var e=_(st,this._proxyTracerProvider,l.instance());return e&&this._proxyTracerProvider.setDelegate(r),e},t.prototype.getTracerProvider=function(){return v(st)||this._proxyTracerProvider},t.prototype.getTracer=function(r,e){return this.getTracerProvider().getTracer(r,e)},t.prototype.disable=function(){y(st,l.instance()),this._proxyTracerProvider=new G},t}()});var lt,Zt=p(()=>{i();Jt();lt=qt.getInstance()});var re,ee,tr,rr=p(()=>{i();re=function(t,r){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),a,o=[],u;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(c){u={error:c}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(u)throw u.error}}return o},ee=function(t){var r=typeof Symbol=="function"&&Symbol.iterator,e=r&&t[r],n=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")},tr=function(){function t(r){this._entries=r?new Map(r):new Map}return t.prototype.getEntry=function(r){var e=this._entries.get(r);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(r){var e=re(r,2),n=e[0],a=e[1];return[n,a]})},t.prototype.setEntry=function(r,e){var n=new t(this._entries);return n._entries.set(r,e),n},t.prototype.removeEntry=function(r){var e=new t(this._entries);return e._entries.delete(r),e},t.prototype.removeEntries=function(){for(var r,e,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var o=new t(this._entries);try{for(var u=ee(n),c=u.next();!c.done;c=u.next()){var f=c.value;o._entries.delete(f)}}catch(g){r={error:g}}finally{try{c&&!c.done&&(e=u.return)&&e.call(u)}finally{if(r)throw r.error}}return o},t.prototype.clear=function(){return new t},t}()});var er,nr=p(()=>{i();er=Symbol("BaggageEntryMetadata")});function or(t){return t===void 0&&(t={}),new tr(new Map(Object.entries(t)))}function ar(t){return typeof t!="string"&&(ne.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:er,toString:function(){return t}}}var ne,gt=p(()=>{i();A();rr();nr();ne=l.instance()});var vt,ir,ur=p(()=>{i();vt=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],ir=function(){function t(){function r(n){return function(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];if(console){var u=console[n];if(typeof u!="function"&&(u=console.log),typeof u=="function")return u.apply(console,a)}}}for(var e=0;e<vt.length;e++)this[vt[e].n]=r(vt[e].c)}return t}()});function pr(){return _t}var N,oe,H,ae,ie,ue,pe,mt,ce,fe,se,_t,le,ge,ve,me,_e,ye,de,yt=p(()=>{i();N=function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])},t(r,e)};return function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(r,e);function n(){this.constructor=r}r.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),oe=function(){function t(){}return t.prototype.createGauge=function(r,e){return ge},t.prototype.createHistogram=function(r,e){return ve},t.prototype.createCounter=function(r,e){return le},t.prototype.createUpDownCounter=function(r,e){return me},t.prototype.createObservableGauge=function(r,e){return ye},t.prototype.createObservableCounter=function(r,e){return _e},t.prototype.createObservableUpDownCounter=function(r,e){return de},t.prototype.addBatchObservableCallback=function(r,e){},t.prototype.removeBatchObservableCallback=function(r){},t}(),H=function(){function t(){}return t}(),ae=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.add=function(e,n){},r}(H),ie=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.add=function(e,n){},r}(H),ue=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.record=function(e,n){},r}(H),pe=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r.prototype.record=function(e,n){},r}(H),mt=function(){function t(){}return t.prototype.addCallback=function(r){},t.prototype.removeCallback=function(r){},t}(),ce=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r}(mt),fe=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r}(mt),se=function(t){N(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}return r}(mt),_t=new oe,le=new ae,ge=new ue,ve=new pe,me=new ie,_e=new ce,ye=new fe,de=new se});var $,Q,dt=p(()=>{i();$={get:function(t,r){if(t!=null)return t[r]},keys:function(t){return t==null?[]:Object.keys(t)}},Q={set:function(t,r,e){t!=null&&(t[r]=e)}}});var q,cr=p(()=>{i();(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(q||(q={}))});var J,fr=p(()=>{i();(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(J||(J={}))});function sr(t){return Ee.test(t)}function lr(t){return Ae.test(t)&&!Ne.test(t)}var ht,he,xe,Ee,Ae,Ne,gr=p(()=>{i();ht="[_0-9a-z-*/]",he="[a-z]"+ht+"{0,255}",xe="[a-z0-9]"+ht+"{0,240}@[a-z]"+ht+"{0,13}",Ee=new RegExp("^(?:"+he+"|"+xe+")$"),Ae=/^[ -~]{0,255}[!-~]$/,Ne=/,|=/});var vr,be,mr,_r,yr,dr=p(()=>{i();gr();vr=32,be=512,mr=",",_r="=",yr=function(){function t(r){this._internalState=new Map,r&&this._parse(r)}return t.prototype.set=function(r,e){var n=this._clone();return n._internalState.has(r)&&n._internalState.delete(r),n._internalState.set(r,e),n},t.prototype.unset=function(r){var e=this._clone();return e._internalState.delete(r),e},t.prototype.get=function(r){return this._internalState.get(r)},t.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,n){return e.push(n+_r+r.get(n)),e},[]).join(mr)},t.prototype._parse=function(r){r.length>be||(this._internalState=r.split(mr).reverse().reduce(function(e,n){var a=n.trim(),o=a.indexOf(_r);if(o!==-1){var u=a.slice(0,o),c=a.slice(o+1,n.length);sr(u)&&lr(c)&&e.set(u,c)}return e},new Map),this._internalState.size>vr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,vr))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var r=new t;return r._internalState=new Map(this._internalState),r},t}()});function hr(t){return new yr(t)}var xr=p(()=>{i();dr()});var xt,Er=p(()=>{i();A();xt=l.instance()});var Te,Ar,Nr=p(()=>{i();yt();Te=function(){function t(){}return t.prototype.getMeter=function(r,e,n){return _t},t}(),Ar=new Te});var Et,br,Tr=p(()=>{i();Nr();E();A();Et="metrics",br=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(r){return _(Et,r,l.instance())},t.prototype.getMeterProvider=function(){return v(Et)||Ar},t.prototype.getMeter=function(r,e,n){return this.getMeterProvider().getMeter(r,e,n)},t.prototype.disable=function(){y(Et,l.instance())},t}()});var At,Ir=p(()=>{i();Tr();At=br.getInstance()});var Or,Pr=p(()=>{i();Or=function(){function t(){}return t.prototype.inject=function(r,e){},t.prototype.extract=function(r,e){return r},t.prototype.fields=function(){return[]},t}()});function bt(t){return t.getValue(Nt)||void 0}function Cr(){return bt(h.getInstance().active())}function Sr(t,r){return t.setValue(Nt,r)}function Rr(t){return t.deleteValue(Nt)}var Nt,Mr=p(()=>{i();R();O();Nt=b("OpenTelemetry Baggage Key")});var Tt,Ie,wr,Dr=p(()=>{i();E();Pr();dt();Mr();gt();A();Tt="propagation",Ie=new Or,wr=function(){function t(){this.createBaggage=or,this.getBaggage=bt,this.getActiveBaggage=Cr,this.setBaggage=Sr,this.deleteBaggage=Rr}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(r){return _(Tt,r,l.instance())},t.prototype.inject=function(r,e,n){return n===void 0&&(n=Q),this._getGlobalPropagator().inject(r,e,n)},t.prototype.extract=function(r,e,n){return n===void 0&&(n=$),this._getGlobalPropagator().extract(r,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){y(Tt,l.instance())},t.prototype._getGlobalPropagator=function(){return v(Tt)||Ie},t}()});var It,Gr=p(()=>{i();Dr();It=wr.getInstance()});var Pe={};Vr(Pe,{DiagConsoleLogger:()=>ir,DiagLogLevel:()=>s,INVALID_SPANID:()=>M,INVALID_SPAN_CONTEXT:()=>j,INVALID_TRACEID:()=>w,ProxyTracer:()=>W,ProxyTracerProvider:()=>G,ROOT_CONTEXT:()=>L,SamplingDecision:()=>q,SpanKind:()=>J,SpanStatusCode:()=>B,TraceFlags:()=>T,ValueType:()=>V,baggageEntryMetadataFromString:()=>ar,context:()=>rt,createContextKey:()=>b,createNoopMeter:()=>pr,createTraceState:()=>hr,default:()=>Oe,defaultTextMapGetter:()=>$,defaultTextMapSetter:()=>Q,diag:()=>xt,isSpanContextValid:()=>I,isValidSpanId:()=>it,isValidTraceId:()=>at,metrics:()=>At,propagation:()=>It,trace:()=>lt});var Oe,Ce=p(()=>{i();gt();O();ur();U();yt();Ct();dt();ct();ft();cr();fr();St();et();xr();Y();k();Ft();Er();Ir();Gr();Zt();Oe={context:rt,diag:xt,metrics:At,propagation:It,trace:lt}});export{s as a,L as b,V as c,T as d,I as e,J as f,B as g,rt as h,xt as i,At as j,It as k,lt as l,Pe as m,Ce as n};
|
package/chunks/chunk-G7R2XEEF.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as W}from"./chunk-OA56BXPD.js";import{b as p}from"./chunk-GZPNIYVZ.js";import{a as R,d as b}from"./chunk-OWGSC52X.js";var A=b((de,L)=>{p();function J(e){t.debug=t,t.default=t,t.coerce=U,t.disable=G,t.enable=d,t.enabled=P,t.humanize=W(),t.destroy=z,Object.keys(e).forEach(o=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let n=0;for(let i=0;i<o.length;i++)n=(n<<5)-n+o.charCodeAt(i),n|=0;return t.colors[Math.abs(n)%t.colors.length]}t.selectColor=r;function t(o){let n,i=null,u,g;function f(...a){if(!f.enabled)return;let h=f,y=Number(new Date),V=y-(n||y);h.diff=V,h.prev=n,h.curr=y,n=y,a[0]=t.coerce(a[0]),typeof a[0]!="string"&&a.unshift("%O");let w=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(I,$)=>{if(I==="%%")return"%";w++;let M=t.formatters[$];if(typeof M=="function"){let Y=a[w];I=M.call(h,Y),a.splice(w,1),w--}return I}),t.formatArgs.call(h,a),(h.log||t.log).apply(h,a)}return f.namespace=o,f.useColors=t.useColors(),f.color=t.selectColor(o),f.extend=s,f.destroy=t.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>i!==null?i:(u!==t.namespaces&&(u=t.namespaces,g=t.enabled(o)),g),set:a=>{i=a}}),typeof t.init=="function"&&t.init(f),f}function s(o,n){let i=t(this.namespace+(typeof n>"u"?":":n)+o);return i.log=this.log,i}function d(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let n=(typeof o=="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let i of n)i[0]==="-"?t.skips.push(i.slice(1)):t.names.push(i)}function m(o,n){let i=0,u=0,g=-1,f=0;for(;i<o.length;)if(u<n.length&&(n[u]===o[i]||n[u]==="*"))n[u]==="*"?(g=u,f=i,u++):(i++,u++);else if(g!==-1)u=g+1,f++,i=f;else return!1;for(;u<n.length&&n[u]==="*";)u++;return u===n.length}function G(){let o=[...t.names,...t.skips.map(n=>"-"+n)].join(",");return t.enable(""),o}function P(o){for(let n of t.skips)if(m(o,n))return!1;for(let n of t.names)if(m(o,n))return!0;return!1}function U(o){return o instanceof Error?o.stack||o.message:o}function z(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}L.exports=J});var j=b((C,v)=>{p();C.formatArgs=H;C.save=K;C.load=Q;C.useColors=Z;C.storage=X();C.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();C.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Z(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function H(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+v.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,s=0;e[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(t++,d==="%c"&&(s=t))}),e.splice(s,0,r)}C.log=console.debug||console.log||(()=>{});function K(e){try{e?C.storage.setItem("debug",e):C.storage.removeItem("debug")}catch{}}function Q(){let e;try{e=C.storage.getItem("debug")||C.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function X(){try{return localStorage}catch{}}v.exports=A()(C);var{formatters:ee}=v.exports;ee.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var N=b((he,B)=>{"use strict";p();B.exports=(e,r)=>{r=r||process.argv;let t=e.startsWith("-")?"":e.length===1?"-":"--",s=r.indexOf(t+e),d=r.indexOf("--");return s!==-1&&(d===-1?!0:s<d)}});var D=b((be,k)=>{"use strict";p();var te=R("os"),F=N(),l=process.env,O;F("no-color")||F("no-colors")||F("color=false")?O=!1:(F("color")||F("colors")||F("color=true")||F("color=always"))&&(O=!0);"FORCE_COLOR"in l&&(O=l.FORCE_COLOR.length===0||parseInt(l.FORCE_COLOR,10)!==0);function re(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function oe(e){if(O===!1)return 0;if(F("color=16m")||F("color=full")||F("color=truecolor"))return 3;if(F("color=256"))return 2;if(e&&!e.isTTY&&O!==!0)return 0;let r=O?1:0;if(process.platform==="win32"){let t=te.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in l)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in l)||l.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in l)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0;if(l.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in l){let t=parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(l.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)||"COLORTERM"in l?1:(l.TERM==="dumb",r)}function T(e){let r=oe(e);return re(r)}k.exports={supportsColor:T,stdout:T(process.stdout),stderr:T(process.stderr)}});var S=b((c,E)=>{p();var ne=R("tty"),x=R("util");c.init=Ce;c.log=le;c.formatArgs=ie;c.save=ue;c.load=fe;c.useColors=se;c.destroy=x.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");c.colors=[6,2,3,4,5,1];try{let e=D();e&&(e.stderr||e).level>=2&&(c.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}c.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(d,m)=>m.toUpperCase()),s=process.env[r];return/^(yes|on|true|enabled)$/i.test(s)?s=!0:/^(no|off|false|disabled)$/i.test(s)?s=!1:s==="null"?s=null:s=Number(s),e[t]=s,e},{});function se(){return"colors"in c.inspectOpts?!!c.inspectOpts.colors:ne.isatty(process.stderr.fd)}function ie(e){let{namespace:r,useColors:t}=this;if(t){let s=this.color,d="\x1B[3"+(s<8?s:"8;5;"+s),m=` ${d};1m${r} \x1B[0m`;e[0]=m+e[0].split(`
|
|
4
|
-
`).join(`
|
|
5
|
-
`+m),e.push(d+"m+"+E.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=ce()+r+" "+e[0]}function ce(){return c.inspectOpts.hideDate?"":new Date().toISOString()+" "}function le(...e){return process.stderr.write(x.formatWithOptions(c.inspectOpts,...e)+`
|
|
6
|
-
`)}function ue(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function fe(){return process.env.DEBUG}function Ce(e){e.inspectOpts={};let r=Object.keys(c.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=c.inspectOpts[r[t]]}E.exports=A()(c);var{formatters:q}=E.exports;q.o=function(e){return this.inspectOpts.colors=this.useColors,x.inspect(e,this.inspectOpts).split(`
|
|
7
|
-
`).map(r=>r.trim()).join(" ")};q.O=function(e){return this.inspectOpts.colors=this.useColors,x.inspect(e,this.inspectOpts)}});var ae=b((we,_)=>{p();typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?_.exports=j():_.exports=S()});export{ae as a};
|
package/chunks/chunk-GOJCMVJJ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{g as w,i as x}from"./chunk-YV3PUOBU.js";import{ba as I}from"./chunk-27Q5KW3A.js";import{b as m}from"./chunk-GZPNIYVZ.js";m();m();var p=I("IMAGE_TOKENIZER"),E=class l{static PIXELS_PER_TOKEN=28*28;static MIN_TOKENS_PER_IMAGE=4;static MAX_TOKENS_PER_IMAGE=16384;static VISION_SPECIAL_TOKENS=2;async extractImageMetadata(t,e){try{if(!x(e))return p.warn(`Unsupported image format: ${e}`),{width:512,height:512,mimeType:e,dataSize:Math.floor(t.length*.75)};let n=t.replace(/^data:[^;]+;base64,/,""),r=Buffer.from(n,"base64"),i=await this.extractDimensions(r,e);return{width:i.width,height:i.height,mimeType:e,dataSize:r.length}}catch(n){return p.warn("Failed to extract image metadata:",n),{width:512,height:512,mimeType:e,dataSize:Math.floor(t.length*.75)}}}async extractDimensions(t,e){return e.includes("png")?this.extractPngDimensions(t):e.includes("jpeg")||e.includes("jpg")?this.extractJpegDimensions(t):e.includes("webp")?this.extractWebpDimensions(t):e.includes("gif")?this.extractGifDimensions(t):e.includes("bmp")?this.extractBmpDimensions(t):e.includes("tiff")?this.extractTiffDimensions(t):e.includes("heic")?this.extractHeicDimensions(t):{width:512,height:512}}extractPngDimensions(t){if(t.length<24)throw new Error("Invalid PNG: buffer too short");let e=t.subarray(0,8),n=Buffer.from([137,80,78,71,13,10,26,10]);if(!e.equals(n))throw new Error("Invalid PNG signature");let r=t.readUInt32BE(16),i=t.readUInt32BE(20);return{width:r,height:i}}extractJpegDimensions(t){if(t.length<4||t[0]!==255||t[1]!==216)throw new Error("Invalid JPEG signature");let e=2;for(;e<t.length-8;){if(t[e]!==255){e++;continue}let n=t[e+1];if(n>=192&&n<=195||n>=197&&n<=199||n>=201&&n<=203||n>=205&&n<=207){let i=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:i}}let r=t.readUInt16BE(e+2);e+=2+r}throw new Error("Could not find JPEG dimensions")}extractWebpDimensions(t){if(t.length<30)throw new Error("Invalid WebP: too short");let e=t.subarray(0,4).toString("ascii"),n=t.subarray(8,12).toString("ascii");if(e!=="RIFF"||n!=="WEBP")throw new Error("Invalid WebP signature");let r=t.subarray(12,16).toString("ascii");if(r==="VP8 "){let i=t.readUInt16LE(26)&16383,a=t.readUInt16LE(28)&16383;return{width:i,height:a}}else if(r==="VP8L"){let i=t.readUInt32LE(21),a=(i&16383)+1,s=(i>>14&16383)+1;return{width:a,height:s}}else if(r==="VP8X"){let i=(t.readUInt32LE(24)&16777215)+1,a=(t.readUInt32LE(26)&16777215)+1;return{width:i,height:a}}throw new Error("Unsupported WebP format")}extractGifDimensions(t){if(t.length<10)throw new Error("Invalid GIF: too short");let e=t.subarray(0,6).toString("ascii");if(e!=="GIF87a"&&e!=="GIF89a")throw new Error("Invalid GIF signature");let n=t.readUInt16LE(6),r=t.readUInt16LE(8);return{width:n,height:r}}calculateTokens(t){return this.calculateTokensWithScaling(t.width,t.height)}calculateTokensWithScaling(t,e){let n=Math.round(e/28)*28,r=Math.round(t/28)*28,i=l.MIN_TOKENS_PER_IMAGE*l.PIXELS_PER_TOKEN,a=l.MAX_TOKENS_PER_IMAGE*l.PIXELS_PER_TOKEN;if(n*r>a){let o=Math.sqrt(e*t/a);n=Math.floor(e/o/28)*28,r=Math.floor(t/o/28)*28}else if(n*r<i){let o=Math.sqrt(i/(e*t));n=Math.ceil(e*o/28)*28,r=Math.ceil(t*o/28)*28}return Math.floor(n*r/l.PIXELS_PER_TOKEN)+l.VISION_SPECIAL_TOKENS}async calculateTokensBatch(t){let e=[];for(let{data:n,mimeType:r}of t)try{let i=await this.extractImageMetadata(n,r);e.push(this.calculateTokens(i))}catch(i){p.warn("Error calculating tokens for image:",i),e.push(l.MIN_TOKENS_PER_IMAGE+l.VISION_SPECIAL_TOKENS)}return e}extractBmpDimensions(t){if(t.length<26)throw new Error("Invalid BMP: buffer too short");if(t[0]!==66||t[1]!==77)throw new Error("Invalid BMP signature");let e=t.readUInt32LE(18),n=t.readUInt32LE(22);return{width:e,height:Math.abs(n)}}extractTiffDimensions(t){if(t.length<8)throw new Error("Invalid TIFF: buffer too short");let e=t.subarray(0,2).toString("ascii"),n=e==="II";if(!n&&!(e==="MM"))throw new Error("Invalid TIFF byte order");if((n?t.readUInt16LE(2):t.readUInt16BE(2))!==42)throw new Error("Invalid TIFF magic number");let a=n?t.readUInt32LE(4):t.readUInt32BE(4);if(a>=t.length)throw new Error("Invalid TIFF IFD offset");let s=n?t.readUInt16LE(a):t.readUInt16BE(a),o=0,h=0;for(let g=0;g<s;g++){let c=a+2+g*12;if(c+12>t.length)break;let u=n?t.readUInt16LE(c):t.readUInt16BE(c),f=(n?t.readUInt16LE(c+2):t.readUInt16BE(c+2))===3?n?t.readUInt16LE(c+8):t.readUInt16BE(c+8):n?t.readUInt32LE(c+8):t.readUInt32BE(c+8);if(u===256?o=f:u===257&&(h=f),o>0&&h>0)break}if(o===0||h===0)throw new Error("Could not find TIFF dimensions");return{width:o,height:h}}extractHeicDimensions(t){if(t.length<12)throw new Error("Invalid HEIC: buffer too short");if(t.subarray(4,8).toString("ascii")!=="ftyp")throw new Error("Invalid HEIC: missing ftyp box");let n=t.subarray(8,12).toString("ascii");if(!["heic","heix","hevc","hevx"].includes(n))throw new Error("Invalid HEIC brand");let r=0;for(;r<t.length-8;){let i=t.readUInt32BE(r);if(t.subarray(r+4,r+8).toString("ascii")==="meta"){let o=r+8+4;for(;o<r+i-8;){let h=t.readUInt32BE(o);if(t.subarray(o+4,o+8).toString("ascii")==="ispe"&&o+20<=t.length){let c=t.readUInt32BE(o+12),u=t.readUInt32BE(o+16);return{width:c,height:u}}if(h===0)break;o+=h}}if(i===0)break;r+=i}return p.warn("Could not extract HEIC dimensions, using default"),{width:512,height:512}}};var d=I("TOKENIZER"),T=class{textTokenizer;imageTokenizer;constructor(){this.textTokenizer=new w,this.imageTokenizer=new E}async calculateTokens(t){let e=performance.now();try{let{textContents:n,imageContents:r,audioContents:i,otherContents:a}=this.processAndGroupContents(t);if(n.length===0&&r.length===0&&i.length===0&&a.length===0)return{totalTokens:0,breakdown:{textTokens:0,imageTokens:0,audioTokens:0,otherTokens:0},processingTime:performance.now()-e};let s=await this.calculateTextTokens(n),o=await this.calculateImageTokens(r),h=await this.calculateAudioTokens(i),g=await this.calculateOtherTokens(a),c=s+o+h+g,u=performance.now()-e;return{totalTokens:c,breakdown:{textTokens:s,imageTokens:o,audioTokens:h,otherTokens:g},processingTime:u}}catch(n){d.error("Error calculating tokens:",n);let r=this.calculateFallbackTokens(t);return{totalTokens:r,breakdown:{textTokens:r,imageTokens:0,audioTokens:0,otherTokens:0},processingTime:performance.now()-e}}}async calculateTextTokens(t){if(t.length===0)return 0;try{return await this.textTokenizer.calculateTokens(t.join(""))}catch(e){d.warn("Error calculating text tokens:",e);let n=t.join("").length;return Math.ceil(n/4)}}async calculateImageTokens(t){if(t.length===0)return 0;try{return(await this.imageTokenizer.calculateTokensBatch(t)).reduce((n,r)=>n+r,0)}catch(e){return d.warn("Error calculating image tokens:",e),t.length*6}}async calculateAudioTokens(t){if(t.length===0)return 0;let e=0;for(let n of t)try{let r=Math.floor(n.data.length*.75);e+=Math.max(Math.ceil(r/100),10)}catch(r){d.warn("Error calculating audio tokens:",r),e+=10}return e}async calculateOtherTokens(t){if(t.length===0)return 0;try{return await this.textTokenizer.calculateTokens(t.join(""))}catch(e){d.warn("Error calculating other content tokens:",e);let n=t.join("").length;return Math.ceil(n/4)}}calculateFallbackTokens(t){try{let e=JSON.stringify(t.contents);return Math.ceil(e.length/4)}catch(e){return d.warn("Error in fallback token calculation:",e),100}}processAndGroupContents(t){let e=[],n=[],r=[],i=[];if(!t.contents)return{textContents:e,imageContents:n,audioContents:r,otherContents:i};let a=Array.isArray(t.contents)?t.contents:[t.contents];for(let s of a)this.processContent(s,e,n,r,i);return{textContents:e,imageContents:n,audioContents:r,otherContents:i}}processContent(t,e,n,r,i){if(typeof t=="string"){t.trim()&&e.push(t);return}if("parts"in t&&t.parts){for(let a of t.parts)this.processPart(a,e,n,r,i);return}this.processPart(t,e,n,r,i)}processPart(t,e,n,r,i){if(typeof t=="string"){t.trim()&&e.push(t);return}if("text"in t&&t.text){e.push(t.text);return}if("inlineData"in t&&t.inlineData){let{data:a,mimeType:s}=t.inlineData;if(s&&s.startsWith("image/")){n.push({data:a||"",mimeType:s});return}if(s&&s.startsWith("audio/")){r.push({data:a||"",mimeType:s});return}}if("fileData"in t&&t.fileData){i.push(JSON.stringify(t.fileData));return}if("functionCall"in t&&t.functionCall){i.push(JSON.stringify(t.functionCall));return}if("functionResponse"in t&&t.functionResponse){i.push(JSON.stringify(t.functionResponse));return}try{let a=JSON.stringify(t);a&&a!=="{}"&&i.push(a)}catch(a){d.warn("Failed to serialize unknown part type:",a)}}};m();export{T as a};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Matilda
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-GTVCJCHR.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{ba as d}from"./chunk-27Q5KW3A.js";import{b as n}from"./chunk-GZPNIYVZ.js";n();import*as w from"node:crypto";n();var l=class{serviceName;constructor(e){this.serviceName=e}validateCredentials(e){if(!e.serverName)throw new Error("Server name is required");if(!e.token)throw new Error("Token is required");if(!e.token.accessToken)throw new Error("Access token is required");if(!e.token.tokenType)throw new Error("Token type is required")}isTokenExpired(e){if(!e.token.expiresAt)return!1;let t=5*60*1e3;return Date.now()>e.token.expiresAt-t}sanitizeServerName(e){return e.replace(/[^a-zA-Z0-9-_.]/g,"_")}};var o=d("MCP_KEYCHAIN"),c="__keychain_test__",s="__secret__",y=class extends l{keychainAvailable=null;keytarModule=null;keytarLoadAttempted=!1;async getKeytar(){if(this.keytarLoadAttempted)return this.keytarModule;this.keytarLoadAttempted=!0;try{let t=await import("keytar");this.keytarModule=t.default||t}catch(e){o.error(`Failed to load keytar module: ${e}`)}return this.keytarModule}async getCredentials(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");try{let r=this.sanitizeServerName(e),a=await t.getPassword(this.serviceName,r);if(!a)return null;let i=JSON.parse(a);return this.isTokenExpired(i)?null:i}catch(r){throw r instanceof SyntaxError?new Error(`Failed to parse stored credentials for ${e}`):r}}async setCredentials(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");this.validateCredentials(e);let r=this.sanitizeServerName(e.serverName),a={...e,updatedAt:Date.now()},i=JSON.stringify(a);await t.setPassword(this.serviceName,r,i)}async deleteCredentials(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");let r=this.sanitizeServerName(e);if(!await t.deletePassword(this.serviceName,r))throw new Error(`No credentials found for ${e}`)}async listServers(){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let e=await this.getKeytar();if(!e)throw new Error("Keytar module not available");try{return(await e.findCredentials(this.serviceName)).filter(r=>!r.account.startsWith(c)).filter(r=>!r.account.startsWith(s)).map(r=>r.account)}catch(t){return o.error(`Failed to list servers from keychain: ${t}`),[]}}async getAllCredentials(){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let e=await this.getKeytar();if(!e)throw new Error("Keytar module not available");let t=new Map;try{let r=(await e.findCredentials(this.serviceName)).filter(a=>!a.account.startsWith(c)).filter(a=>!a.account.startsWith(s));for(let a of r)try{let i=JSON.parse(a.password);this.isTokenExpired(i)||t.set(a.account,i)}catch(i){o.error(`Failed to parse credentials for ${a.account}: ${i}`)}}catch(r){o.error(`Failed to get all credentials from keychain: ${r}`)}return t}async clearAll(){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let e=this.keytarModule?await this.keytarModule.findCredentials(this.serviceName).then(r=>r.map(a=>a.account)).catch(r=>{throw new Error(`Failed to list servers for clearing: ${r.message}`)}):[],t=[];for(let r of e)try{await this.deleteCredentials(r)}catch(a){t.push(a)}if(t.length>0)throw new Error(`Failed to clear some credentials: ${t.map(r=>r.message).join(", ")}`)}async checkKeychainAvailability(){if(this.keychainAvailable!==null)return this.keychainAvailable;try{let e=await this.getKeytar();if(!e)return this.keychainAvailable=!1,!1;let t=`${c}${w.randomBytes(8).toString("hex")}`,r="test";await e.setPassword(this.serviceName,t,r);let a=await e.getPassword(this.serviceName,t),h=await e.deletePassword(this.serviceName,t)&&a===r;return this.keychainAvailable=h,h}catch{return this.keychainAvailable=!1,!1}}async isAvailable(){return this.checkKeychainAvailability()}async setSecret(e,t){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let r=await this.getKeytar();if(!r)throw new Error("Keytar module not available");await r.setPassword(this.serviceName,`${s}${e}`,t)}async getSecret(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");return t.getPassword(this.serviceName,`${s}${e}`)}async deleteSecret(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");if(!await t.deletePassword(this.serviceName,`${s}${e}`))throw new Error(`No secret found for key: ${e}`)}async listSecrets(){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let e=await this.getKeytar();if(!e)throw new Error("Keytar module not available");try{return(await e.findCredentials(this.serviceName)).filter(r=>r.account.startsWith(s)).map(r=>r.account.substring(s.length))}catch(t){return o.error(`Failed to list secrets from keychain: ${t}`),[]}}};export{l as a,y as b};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/chunk-IJEGHQ7Z.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{M as j,N as L,O as W,g as D,ma as B,ra as _}from"./chunk-SOEIVSM5.js";import{b as m,e as w}from"./chunk-SVSY6AWS.js";import{k as x,n as O}from"./chunk-SDTWBD62.js";import{q as b,s as I,t as F,u as U}from"./chunk-27Q5KW3A.js";import{b as $}from"./chunk-GZPNIYVZ.js";$();var K="2026-06-23",z="auto",Y="instant",Q=12e4,h=18e4,Z=5e4,R=16e3,E=class extends Error{constructor(t,s){super(t);this.status=s;this.name="MatildaAgentHttpError"}},S=class extends Error{code="EMATILDA_STREAM_INCOMPLETE";constructor(){super("Matilda agent stream ended without an authoritative done signal."),this.name="MatildaAgentStreamProtocolError"}},q=["Treat this as Matilda Code traffic.","Prefer the code specialist path for implementation, debugging, refactoring, tests, repo edits, and code review.","Use the fast instruct path for simple coordination, status, clarification, or non-code conversational replies.","Keep the response concise and action-oriented."].join(" "),ee=["You are powering Matilda Code, an interactive terminal coding agent.","Matilda Code owns the local agent loop: codebase reads, edits, shell commands, approvals, memory, subagents, skills, and MCP tools run through the CLI.","Use the conversation context and tool results as facts. Do not claim to have inspected files, run commands, or edited code unless that action appears in the provided context.",`When the user gives a vague starter such as "let's code" without a concrete development task, ask a concise clarifying question instead of inventing an app or dumping code.`].join(" ");function te(n){let e=(n||"https://matilda.maincode.com/api/v1").trim().replace(/\/+$/,"");return/\/api\/v1$/i.test(e)?e.replace(/\/api\/v1$/i,"/api"):/\/api$/i.test(e)?e:`${e}/api`}function y(n){try{let e=JSON.parse(n);return e&&typeof e=="object"?e:void 0}catch{return}}var ne="Your message was blocked by our content safety system.";function se(n){let e=y(n);if(!e||e.error!=="content_blocked")return;let t=Array.isArray(e.categories)?e.categories.filter(o=>typeof o=="string"):[],s=typeof e.assistant_message=="string"&&e.assistant_message.trim().length>0?e.assistant_message:typeof e.message=="string"?e.message:ne;return{categories:t,severity:typeof e.severity=="string"?e.severity:void 0,assistantMessage:s}}function u(n,e){let s=y(n)?.[e];return typeof s=="string"?s:void 0}function H(n){return P(n)}function P(n){return typeof n=="string"?n:Array.isArray(n)?n.map(e=>{if(typeof e=="string")return e;if(!e||typeof e!="object")return"";let t=e;return typeof t.text=="string"?t.text:t.image_url?"[image omitted: Matilda native chat accepts text only]":t.input_audio?"[audio omitted: Matilda native chat accepts text only]":t.file?"[file omitted: Matilda native chat accepts text only]":""}).filter(Boolean).join(`
|
|
4
|
-
`):""}function f(n,e){if(n.length<=e)return n;let t=`
|
|
5
|
-
[...omitted to fit Matilda native agent context...]
|
|
6
|
-
`,s=e-t.length,o=Math.floor(s*.6),i=s-o;return`${n.slice(0,o)}${t}${n.slice(-i)}`}function oe(n){return(n.candidates?.[0]?.content?.parts??[]).map(t=>typeof t=="string"?t:"thought"in t&&t.thought?"":"text"in t&&t.text||"").join("")}function ae(n){let e=y(n),t=typeof e?.output_tokens=="number"?e.output_tokens:void 0;if(t!==void 0)return{promptTokenCount:0,candidatesTokenCount:t,totalTokenCount:t,usageIsIncomplete:!0}}function C(n){return JSON.stringify(n).length}function ie(n){if(C(n)<=h)return n;let e=`
|
|
7
|
-
[...omitted to fit Matilda native request limit...]
|
|
8
|
-
`;for(let t=0;t<n.messages.length;t+=1){let s=n.messages[t];!s||s.content.length<=R||(n.messages[t]={...s,content:f(s.content,R)})}if(C(n)<=h)return n;for(;n.messages.length>2&&C(n)>h;){n.messages.splice(1,1);let t=n.messages[0];t&&!t.content.includes(e.trim())&&(n.messages[0]={...t,content:`${t.content}${e}`})}for(;C(n)>h;){let t=n.messages.length>1?n.messages.length-1:0,s=n.messages[t];if(!s||s.content.length<=1e3)break;let o=C(n)-h,i=Math.max(1e3,s.content.length-o-e.length-2e3);n.messages[t]={...s,content:f(s.content,i)}}return C(n)<=h||n.clientTools&&delete n.clientTools,n}function re(n){let e=y(n.data);if(!e)return;let t=typeof e.name=="string"?e.name:void 0;if(!t)return;let s=e.args&&typeof e.args=="object"?e.args:{};return{id:typeof e.id=="string"?e.id:void 0,name:t,args:s}}function le(n){let e=y(n.data);if(n.event==="thinking"){let t=u(n.data,"content");return t?`**Thinking** ${t}`:void 0}if(n.event==="generation_status"){let t=u(n.data,"phase");return t?`**Planning** ${t}`:void 0}if(n.event==="status"){let t=u(n.data,"state");if(!t)return;let s=typeof e?.position=="number"?` position ${e.position}`:"";return`**Status** ${t}${s}`}if(n.event==="tool_start"){let t=u(n.data,"tool");if(!t)return;let s=u(n.data,"input")??(e?.args?JSON.stringify(e.args):void 0);return`**Remote tool** Starting ${t}${s?` with ${s}`:""}`}if(n.event==="tool_progress"){let t=u(n.data,"tool"),s=u(n.data,"message");return t&&s?`**Remote tool** ${t}: ${s}`:void 0}if(n.event==="tool_result"){let t=u(n.data,"tool"),s=u(n.data,"status"),o=u(n.data,"output")??u(n.data,"result");return t?`**Remote tool** ${t} ${s??"completed"}${o?`: ${f(o,600)}`:""}`:void 0}}function T(n,e,t){let s=new w;return s.candidates=[{content:{parts:n?[{text:n}]:[],role:"model"},index:0,safetyRatings:[]}],s.createTime=Date.now().toString(),s.modelVersion=e,t&&(s.usageMetadata=t),s}function ce(n,e){let t=new w;return t.candidates=[{content:{parts:n?[{text:n,thought:!0}]:[],role:"model"},index:0,safetyRatings:[]}],t.createTime=Date.now().toString(),t.modelVersion=e,t}function de(n,e){let t=new w;return t.candidates=[{content:{parts:[{functionCall:n}],role:"model"},index:0,safetyRatings:[]}],t.createTime=Date.now().toString(),t.modelVersion=e,Object.defineProperty(t,"functionCalls",{value:[n],writable:!0,configurable:!0,enumerable:!0}),t}function J(n){let e=T("",n);return e.matildaReplace=!0,e}function ue(n){return n.matildaReplace===!0}function V(n,e,t){let s=T("",n,t);return s.candidates=[{content:{parts:[],role:"model"},finishReason:e,index:0,safetyRatings:[]}],s}async function*ge(n,e){let t=n.body?.getReader();if(!t)throw new Error("Matilda agent stream returned no response body");let s=new TextDecoder,o="",i="message",r=[],d=!1,c,a=()=>{e<=0||(c&&clearTimeout(c),c=setTimeout(()=>{d=!0,t.cancel().catch(()=>{})},e))},l=()=>{c&&(clearTimeout(c),c=void 0)},g=()=>{if(r.length===0){i="message";return}let A={event:i,data:r.join(`
|
|
9
|
-
`)};return i="message",r=[],a(),A};a();try{for(;;){let{done:v,value:p}=await t.read();if(v||d)break;a(),o+=s.decode(p,{stream:!0});let N=o.split(`
|
|
10
|
-
`);o=N.pop()??"";for(let k of N){let M=k.endsWith("\r")?k.slice(0,-1):k;if(M.length===0){let G=g();G&&(yield G)}else M.startsWith("event:")?i=M.slice(6).trim():M.startsWith("data:")&&r.push(M.slice(5).trimStart())}}if(o+=s.decode(),o.length>0)for(let v of o.split(`
|
|
11
|
-
`)){let p=v.endsWith("\r")?v.slice(0,-1):v;p.startsWith("event:")?i=p.slice(6).trim():p.startsWith("data:")&&r.push(p.slice(5).trimStart())}let A=g();A&&(yield A)}finally{l()}if(d)throw Object.assign(new Error(`No Matilda agent SSE events for ${e}ms`),{code:"ETIMEDOUT"})}var X=class{constructor(e,t){this.contentGeneratorConfig=e;this.cliConfig=t}async generateContent(e,t){let s=await this.generateContentStream(e,t),o="",i,r=m.STOP,d=!1;for await(let a of s){ue(a)?o="":o+=oe(a),a.usageMetadata&&(i=a.usageMetadata);let l=a.candidates?.[0]?.finishReason;l&&(d=!0,r=l)}if(!d)throw new S;let c=T(o,this.modelFor(e),i);return c.candidates=[{content:{parts:o?[{text:o}]:[],role:"model"},index:0,safetyRatings:[]}],r&&(c.candidates[0].finishReason=r),c}async generateContentStream(e,t){return this.streamNativeChat(e)}async countTokens(e){return{totalTokens:Math.ceil(JSON.stringify(e.contents??"").length/4)}}async embedContent(e){throw new Error("Matilda agent SDK transport does not support embeddings.")}useSummarizedThinking(){return!1}async*streamNativeChat(e){let t=this.modelFor(e),s=await this.fetchNativeChat(e),o=!1,i=!1,r,d,c=!1;for await(let a of ge(s,Q))if(a.data!=="[DONE]"){if(a.event==="token"){let l=u(a.data,"content");l&&(i=!0,yield T(l,t))}else if(a.event==="thinking"||a.event==="generation_status"||a.event==="status"||a.event==="tool_start"||a.event==="tool_progress"||a.event==="tool_result"){let l=le(a);l&&(i=!0,yield ce(l,t))}else if(a.event==="client_tool_call"){let l=re(a);l&&(i=!0,yield de(l,t))}else if(a.event==="usage")d=ae(a.data)??d;else if(a.event==="replace")yield J(t);else if(a.event==="safety_replace"){yield J(t);let l=u(a.data,"message")??u(a.data,"content");l&&(i=!0,yield T(l,t))}else if(a.event==="truncated")c=!0,r=m.MAX_TOKENS;else if(a.event==="done"){if(c=!0,r=u(a.data,"reason")==="max_tokens"?m.MAX_TOKENS:r??m.STOP,!i)throw new Error("Matilda agent returned an empty response.");yield V(t,r,d),o=!0}else if(a.event==="error"){let l=y(a.data),g=typeof l?.error=="string"?l.error:"Unknown Matilda agent stream error";throw new Error(`Matilda agent stream error: ${g}`)}}if(!o){if(e.config?.abortSignal?.aborted)return;if(!i)throw new Error("Matilda agent returned an empty response.");if(c)yield V(t,r??m.STOP,d);else throw new S}}async fetchNativeChat(e){let t=await _({baseUrl:this.contentGeneratorConfig.baseUrl,fallbackAccessToken:this.contentGeneratorConfig.apiKey,signal:e.config?.abortSignal,channel:this.cliConfig.getChannel?.()}),s=await this.postNativeChat(e,t);if(s.status!==401)return this.assertOkResponse(s);let o;try{o=await _({baseUrl:this.contentGeneratorConfig.baseUrl,fallbackAccessToken:t,forceRefresh:!0,signal:e.config?.abortSignal,channel:this.cliConfig.getChannel?.()})}catch(r){throw B(r)?new b(r instanceof Error?r.message:String(r)):r}if(!o||o===t)throw new b("Matilda session expired. Please sign in again.");let i=await x("retry",()=>this.postNativeChat(e,o));return this.assertOkResponse(i)}async postNativeChat(e,t){return fetch(`${te(this.contentGeneratorConfig.baseUrl)}/chat`,{method:"POST",headers:this.buildHeaders(t),body:JSON.stringify(this.buildNativeRequest(e)),signal:e.config?.abortSignal})}async assertOkResponse(e){if(e.ok)return e;let t=await e.text();if(e.status===403){let o;try{o=JSON.parse(t)}catch{}if(F(o))throw new I}if(e.status===422){let o=se(t);if(o)throw new U(`Matilda agent request blocked (422): ${t}`,o.categories,o.severity,o.assistantMessage)}let s=`Matilda agent request failed (${e.status}): ${t}`;throw e.status===401?new b(s):new E(s,e.status)}buildHeaders(e){let t={"Content-Type":"application/json",Accept:"text/event-stream","X-Matilda-API-Version":K,"X-Matilda-Client":"matilda-code","User-Agent":`MatildaCode/${this.cliConfig.getCliVersion?.()||"unknown"}`};for(let[s,o]of Object.entries(this.contentGeneratorConfig.customHeaders??{}))s.toLowerCase()!=="x-matilda-response-mode"&&!L(s)&&(t[s]=o);return W(this.contentGeneratorConfig,e)&&Object.assign(t,j(this.cliConfig),O()),e&&(t.Authorization=`Bearer ${e}`),t}buildNativeRequest(e){let t=this.inferPurpose(e),s=this.clientToolsFromRequest(e),o={messages:this.buildNativeMessages(e,t),responseMode:this.responseModeForPurpose(t)};return s.length>0&&(o.clientTools=s),ie(o)}buildNativeMessages(e,t){let s=this.openAIMessagesFromRequest(e),i=[{role:"user",content:this.buildSystemContext(e,t)}];for(let d of s){if(d.role==="system")continue;let c=this.nativeMessageFromOpenAIMessage(d);c&&i.push(c)}i.length===1&&i.push({role:"user",content:`${this.purposeLabel(t)}:
|
|
12
|
-
(empty prompt)`});let r=i[i.length-1];return r?.role!=="user"?i.push({role:"user",content:`${this.purposeLabel(t)}:
|
|
13
|
-
Continue from the previous assistant response.`}):r.content.startsWith(`${this.purposeLabel(t)}:
|
|
14
|
-
`)||(i[i.length-1]={...r,content:`${this.purposeLabel(t)}:
|
|
15
|
-
${r.content}`}),i}buildSystemContext(e,t){let s=["Agent: Matilda Code",t==="code"?`Routing intent:
|
|
16
|
-
${q}`:void 0,`Instructions:
|
|
17
|
-
${this.instructionsFromRequest(e)}`].filter(o=>!!o);return f(s.join(`
|
|
18
|
-
|
|
19
|
-
`),Z)}nativeMessageFromOpenAIMessage(e){let t=this.describeMessage(e);if(t.trim())return{role:e.role==="assistant"?"assistant":"user",content:t}}inferPurpose(e){if(this.contentGeneratorConfig.matildaAgentPurpose)return this.contentGeneratorConfig.matildaAgentPurpose;if(this.contentGeneratorConfig.matildaAgentResponseMode==="instant")return"general";if(this.contentGeneratorConfig.matildaAgentResponseMode==="deep")return"analysis";let s=(this.userMessagesFromRequest(e).at(-1)?.trim()??"").toLowerCase().replace(/\s+/g," ");return/^(hi|hey|hello|thanks|thank you|ok|okay|cool|nice|what'?s up)[.!?]*$/.test(s)||/^(ok|okay)?\s*(let'?s|lets)\s+(code|build|start|get started)[.!?]*$/.test(s)?"general":"code"}responseModeForPurpose(e){return this.contentGeneratorConfig.matildaAgentResponseMode?this.contentGeneratorConfig.matildaAgentResponseMode:e==="general"?Y:e==="analysis"?"deep":z}purposeLabel(e){return e==="code"?"Code task":e==="analysis"?"Analysis task":"Task"}instructionsFromRequest(e){let t=this.openAIMessagesFromRequest(e).filter(s=>s.role==="system").map(s=>P(s.content)).filter(s=>s.trim().length>0);return[ee,...t,this.localAgentContext()].join(`
|
|
20
|
-
|
|
21
|
-
`)}localAgentContext(){let e=["Local agent context:","- CLI: Matilda Code terminal agent."],t=this.cliConfig.getModel?.();t&&e.push(`- Active model: ${t}`);let s=this.cliConfig.getApprovalMode?.();s&&e.push(`- Approval mode: ${s}`);let o=this.cliConfig.getSandbox?.();e.push(o?`- Sandbox: ${o.command} (${o.image}).`:"- Sandbox: disabled.");let i=[["allow",this.cliConfig.getPermissionsAllow?.()??[]],["ask",this.cliConfig.getPermissionsAsk?.()??[]],["deny",this.cliConfig.getPermissionsDeny?.()??[]]];for(let[l,g]of i)g.length>0&&e.push(`- Permission ${l} rules: ${g.join(", ")}`);let r=this.cliConfig.getIdeMode?.()?"IDE/ACP":this.cliConfig.isInteractive?.()?"interactive TUI":"headless";e.push(`- Interface mode: ${r}`);let d=this.cliConfig.getProjectRoot?.();d&&e.push(`- Project root: ${d}`);let c=this.cliConfig.getWorkingDir?.();c&&c!==d&&e.push(`- Working directory: ${c}`);let a=this.cliConfig.getToolRegistry?.()?.getAllToolNames?.().slice(0,30)??[];return a.length>0&&e.push(`- Local tools available through the CLI loop: ${a.join(", ")}`),e.join(`
|
|
22
|
-
`)}clientToolsFromRequest(e){let t=[];for(let s of e.config?.tools??[])"functionDeclarations"in s&&t.push(...(s.functionDeclarations??[]).filter(o=>!!o.name));return t.map(s=>({name:s.name,...s.description?{description:s.description}:{},...s.parametersJsonSchema?{parameters:s.parametersJsonSchema}:s.parameters?{parameters:s.parameters}:{}}))}userMessagesFromRequest(e){return this.openAIMessagesFromRequest(e).filter(t=>t.role==="user").map(t=>H(t.content)).filter(t=>t.trim().length>0)}openAIMessagesFromRequest(e){let t={model:this.modelFor(e),modalities:this.contentGeneratorConfig.modalities??{},startTime:Date.now(),splitToolMedia:this.contentGeneratorConfig.splitToolMedia??!0};return D.convertGeminiRequestToOpenAI(e,t,{cleanOrphanToolCalls:!1})}describeMessage(e){if(e.role==="user")return`User:
|
|
23
|
-
${f(H(e.content),R)}`;if(e.role==="assistant"){let t=P(e.content),s="tool_calls"in e&&Array.isArray(e.tool_calls)?e.tool_calls.map(o=>`Tool request: ${o.function.name}(${o.function.arguments})`).join(`
|
|
24
|
-
`):"";return`Assistant:
|
|
25
|
-
${f([t,s].filter(Boolean).join(`
|
|
26
|
-
`),R)}`}return e.role==="tool"?`Tool result ${e.tool_call_id}:
|
|
27
|
-
${f(P(e.content),R)}`:""}modelFor(e){return e.model||this.contentGeneratorConfig.model}};export{ue as a,X as b};
|
|
28
|
-
/**
|
|
29
|
-
* @license
|
|
30
|
-
* Copyright 2026 Matilda Team
|
|
31
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
32
|
-
*/
|
package/chunks/chunk-JCE3JAVC.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{ba as te}from"./chunk-27Q5KW3A.js";import{b as f}from"./chunk-GZPNIYVZ.js";f();var Ne="MATILDA_CODE_PROFILE_RUNTIME";function ne(t=process.env){return t[Ne]==="1"}var W=class{enabled;now;startedAt;requestIndex=0;openAIWireRequestIndex=0;anthropicWireRequestIndex=0;requests=[];openaiWireRequests=[];anthropicWireRequests=[];tools=oe();constructor(e={}){this.enabled=e.enabled??ne(),this.now=e.now??(()=>new Date().toISOString()),this.startedAt=this.now()}reset(e={}){this.enabled=e.enabled??ne(),this.startedAt=this.now(),this.requestIndex=0,this.openAIWireRequestIndex=0,this.anthropicWireRequestIndex=0,this.requests=[],this.openaiWireRequests=[],this.anthropicWireRequests=[],this.tools=oe()}isEnabled(){return this.enabled}recordGenerateContentRequest(e,n){this.enabled&&(this.requestIndex+=1,this.requests.push({index:this.requestIndex,timestamp:this.now(),source:n.source,model:e.model,stream:n.stream,serializedBytes:p(We(e)),contents:re(e.contents),systemInstructionBytes:ve(e.config?.systemInstruction),generationConfigBytes:p(se(e.config)),tools:Me(e.config?.tools)}))}recordOpenAIWireRequest(e){this.enabled&&(this.openAIWireRequestIndex+=1,this.openaiWireRequests.push({index:this.openAIWireRequestIndex,timestamp:this.now(),...Ie(e)}))}recordAnthropicWireRequest(e){this.enabled&&(this.anthropicWireRequestIndex+=1,this.anthropicWireRequests.push({index:this.anthropicWireRequestIndex,timestamp:this.now(),...Le(e)}))}recordToolUse(e,n){if(!this.enabled)return;let o=p(n),r=this.getToolNameDiagnostics(e);r.uses+=1,r.argBytes+=o,r.maxArgBytes=Math.max(r.maxArgBytes,o),this.tools.toolUseCount+=1,this.tools.totalToolUseArgBytes+=o,this.tools.maxToolUseArgBytes=Math.max(this.tools.maxToolUseArgBytes,o)}recordToolResult(e){if(!this.enabled)return;let n=this.getToolNameDiagnostics(e.name);n.results+=1,n.resultBytes+=e.resultBytes,n.maxResultBytes=Math.max(n.maxResultBytes,e.resultBytes),e.isError&&(n.errors+=1,this.tools.toolResultErrorCount+=1),this.tools.toolResultCount+=1,this.tools.totalToolResultBytes+=e.resultBytes,this.tools.maxToolResultBytes=Math.max(this.tools.maxToolResultBytes,e.resultBytes)}snapshot(){return{enabled:this.enabled,startedAt:this.startedAt,requests:this.requests.map(e=>({...e,contents:{...e.contents,roleCounts:{...e.contents.roleCounts}},tools:{...e.tools}})),openaiWireRequests:this.openaiWireRequests.map(e=>({...e,messageBytesByRole:{...e.messageBytesByRole},topLevelKeys:[...e.topLevelKeys]})),anthropicWireRequests:this.anthropicWireRequests.map(e=>({...e,messageBytesByRole:{...e.messageBytesByRole},topLevelKeys:[...e.topLevelKeys]})),tools:{...this.tools,byName:Object.fromEntries(Object.entries(this.tools.byName).map(([e,n])=>[e,{...n}]))}}}getToolNameDiagnostics(e){let n=this.tools.byName[e];if(n)return n;let o=xe();return this.tools.byName[e]=o,o}},He=new W;function Ie(t){let e=b(t),n=Array.isArray(e.messages)?e.messages:[],o=Array.isArray(e.tools)?e.tools:[],r={};for(let u of n){let a=b(u),d=typeof a.role=="string"?a.role:"unknown";r[d]=(r[d]??0)+p(a.content)}return{model:typeof e.model=="string"?e.model:"unknown",stream:e.stream===!0,bodyBytes:p(t),messageCount:n.length,messageBytesByRole:r,toolsCount:o.length,toolSchemaBytes:p(o),topLevelKeys:Object.keys(e).sort()}}function Le(t){let e=b(t),n=Array.isArray(e.messages)?e.messages:[],o=Array.isArray(e.tools)?e.tools:[],r={};for(let u of n){let a=b(u),d=typeof a.role=="string"?a.role:"unknown";r[d]=(r[d]??0)+p(a.content)}return{model:typeof e.model=="string"?e.model:"unknown",stream:e.stream===!0,bodyBytes:p(t),messageCount:n.length,messageBytesByRole:r,systemBytes:p(e.system),toolsCount:o.length,toolSchemaBytes:p(o),topLevelKeys:Object.keys(e).sort()}}function oe(){return{toolUseCount:0,toolResultCount:0,toolResultErrorCount:0,totalToolUseArgBytes:0,maxToolUseArgBytes:0,totalToolResultBytes:0,maxToolResultBytes:0,byName:Object.create(null)}}function xe(){return{uses:0,argBytes:0,maxArgBytes:0,results:0,errors:0,resultBytes:0,maxResultBytes:0}}function re(t){let e={count:0,roleCounts:{},partCount:0,textBytes:0,functionCallCount:0,functionCallArgBytes:0,functionResponseCount:0,functionResponseBytes:0,inlineDataCount:0,inlineDataBytes:0,fileDataCount:0},n=Array.isArray(t)?t:t==null?[]:[t];for(let o of n){if(e.count+=1,typeof o=="string"){e.roleCounts.user=(e.roleCounts.user??0)+1,e.partCount+=1,e.textBytes+=p(o);continue}let r=b(o),u=typeof r.role=="string"?r.role:"unknown";e.roleCounts[u]=(e.roleCounts[u]??0)+1;let a=Array.isArray(r.parts)?r.parts:[];Ue(a,e)}return e}function ve(t){return re(t).textBytes}function Ue(t,e){for(let n of t){if(e.partCount+=1,typeof n=="string"){e.textBytes+=p(n);continue}let o=b(n);typeof o.text=="string"&&(e.textBytes+=p(o.text));let r=M(o.functionCall);r&&(e.functionCallCount+=1,e.functionCallArgBytes+=p(r.args));let u=M(o.functionResponse);u&&(e.functionResponseCount+=1,e.functionResponseBytes+=p(u.response)+p(u.parts));let a=M(o.inlineData);a&&(e.inlineDataCount+=1,e.inlineDataBytes+=p(a.data)),o.fileData&&(e.fileDataCount+=1)}}function Me(t){let e=Array.isArray(t)?t:[],n=0;for(let o of e){let r=b(o),u=Array.isArray(r.functionDeclarations)?r.functionDeclarations:[];n+=u.length}return{count:e.length,functionDeclarationCount:n,schemaBytes:p(e)}}function We(t){return{model:t.model,contents:t.contents,config:se(t.config)}}function se(t){if(!t)return;let e=b(t),n={};for(let[o,r]of Object.entries(e))o!=="abortSignal"&&(n[o]=r);return n}function p(t){return t==null?0:typeof t=="string"?Buffer.byteLength(t,"utf8"):Buffer.byteLength(Pe(t),"utf8")}function Pe(t){try{return JSON.stringify(t)??""}catch{return"[unserializable]"}}function b(t){return typeof t=="object"&&t!==null?t:{}}function M(t){return typeof t=="object"&&t!==null?t:null}f();var et=131072,tt=32e3,nt=8e3,ot=64e3,rt=2048;function st(t,e,n,o=2048){let r=e-n-o;return!Number.isFinite(r)||r<=0?0:Math.min(t,r)}var i={"32k":32768,"64k":65536,"128k":131072,"192k":196608,"200k":2e5,"256k":262144,"272k":272e3,"384k":384e3,"400k":4e5,"512k":524288,"1m":1e6,"4k":4096,"8k":8192,"16k":16384};function ie(t){let e=(t??"").toLowerCase().trim();return e=e.replace(/^.*\//,""),e=e.split("|").pop()??e,e=e.split(":").pop()??e,e=e.replace(/\s+/g,"-"),e=e.replace(/-preview/g,""),!e.match(/^matilda-(?:plus|flash|vl-max)-latest$/)&&!e.match(/^kimi-k2-\d{4}$/)&&(e=e.replace(/-(?:\d{4,}|\d+x\d+b|v\d+(?:\.\d+)*|(?<=-[^-]+-)\d+(?:\.\d+)+|latest|exp)$/g,"")),e=e.replace(/-(?:\d?bit|int[48]|bf16|fp16|q[45]|quantized)$/g,""),e}var qe=[[/^gemini-3/,i["1m"]],[/^gemini-/,i["1m"]],[/^gpt-5/,i["272k"]],[/^gpt-/,i["128k"]],[/^o\d/,i["200k"]],[/^claude-/,i["200k"]],[/^matilda3-coder-plus/,i["1m"]],[/^matilda3-coder-flash/,i["1m"]],[/^matilda3\.\d/,i["1m"]],[/^matilda-plus-latest$/,i["1m"]],[/^matilda-flash-latest$/,i["1m"]],[/^coder-model$/,i["1m"]],[/^matilda-code$/,i["1m"]],[/^matilda3-max/,i["256k"]],[/^matilda3-coder-/,i["256k"]],[/^matilda/,i["256k"]],[/^deepseek-v4/,i["1m"]],[/^deepseek/,i["128k"]],[/^glm-5(\.[01])?(-|$)/,202752],[/^glm-(?:[5-9]|\d{2,})/,i["1m"]],[/^glm-/,202752],[/^matilda/,i["256k"]],[/^ornith/,i["64k"]],[/^minimax-m3/i,i["1m"]],[/^minimax-m2\.5/i,i["192k"]],[/^minimax-/i,i["200k"]],[/^kimi-/,i["256k"]],[/^seed-oss/,i["512k"]]],ue=[[/^gemini-3/,i["64k"]],[/^gemini-/,i["8k"]],[/^gpt-5/,i["128k"]],[/^gpt-/,i["16k"]],[/^o\d/,i["128k"]],[/^claude-opus-4-6/,i["128k"]],[/^claude-sonnet-4-6/,i["64k"]],[/^claude-/,i["64k"]],[/^matilda3\.\d/,i["64k"]],[/^coder-model$/,i["64k"]],[/^matilda-code$/,i["64k"]],[/^matilda$/,i["64k"]],[/^matilda-core$/,i["64k"]],[/^matilda/,i["32k"]],[/^deepseek-v4/,i["384k"]],[/^deepseek-reasoner/,i["64k"]],[/^deepseek-r1/,i["64k"]],[/^deepseek-chat/,i["8k"]],[/^glm-5\.2/,i["64k"]],[/^glm-5/,i["64k"]],[/^glm-4\.7/,i["16k"]],[/^ornith/,i["32k"]],[/^minimax-m2\.5/i,i["64k"]],[/^kimi-k2\.5/,i["32k"]]];function $e(t,e="input"){let n=ie(t),o=e==="output"?ue:qe;for(let[r,u]of o)if(r.test(n))return u}function it(t){let e=ie(t);return ue.some(([n])=>n.test(e))}function Fe(t,e="input"){return $e(t,e)}function ut(t,e="input"){return Fe(t,e)??(e==="output"?32e3:131072)}f();f();f();f();var y=class extends Error{constructor(e,n){super(`${e} at position ${n}`),this.position=n}};f();function ae(t){return/^[0-9A-Fa-f]$/.test(t)}function k(t){return t>="0"&&t<="9"}function ce(t){return t>=" "}function _(t){return`,:[]/{}()
|
|
4
|
-
+`.includes(t)}function P(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"||t==="$"}function q(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"||t==="$"||t>="0"&&t<="9"}var $=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,F=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function K(t){return`,[]/{}
|
|
5
|
-
+`.includes(t)}function J(t){return E(t)||Ke.test(t)}var Ke=/^[[{\w-]$/;function le(t){return t===`
|
|
6
|
-
`||t==="\r"||t===" "||t==="\b"||t==="\f"}function C(t,e){let n=t.charCodeAt(e);return n===32||n===10||n===9||n===13}function me(t,e){let n=t.charCodeAt(e);return n===32||n===9||n===13}function fe(t,e){let n=t.charCodeAt(e);return n===160||n>=8192&&n<=8202||n===8239||n===8287||n===12288}function E(t){return Q(t)||L(t)}function Q(t){return t==='"'||t==="\u201C"||t==="\u201D"}function z(t){return t==='"'}function L(t){return t==="'"||t==="\u2018"||t==="\u2019"||t==="`"||t==="\xB4"}function G(t){return t==="'"}function B(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=t.lastIndexOf(e);return o!==-1?t.substring(0,o)+(n?"":t.substring(o+1)):t}function h(t,e){let n=t.length;if(!C(t,n-1))return t+e;for(;C(t,n-1);)n--;return t.substring(0,n)+e+t.substring(n)}function pe(t,e,n){return t.substring(0,e)+t.substring(e+n)}function de(t){return/[,\n][ \t\r]*$/.test(t)}var Je={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Qe={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
7
|
-
`,r:"\r",t:" "};function x(t){let e=0,n="";V(["```","[```","{```"]),u()||_e(),V(["```","```]","```}"]);let r=S(",");for(r&&a(),J(t[e])&&de(n)?(r||(n=h(n,",")),Ae()):r&&(n=B(n,","));t[e]==="}"||t[e]==="]";)e++,a();if(e>=t.length)return n;De();function u(){a();let s=Ce()||ke()||T()||Te()||we()||H(!1)||Be();return a(),s}function a(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,c=e,l=d(s);do l=ye(),l&&(l=d(s));while(l);return e>c}function d(s){let c=s?C:me,l="";for(;;)if(c(t,e))l+=t[e],e++;else if(fe(t,e))l+=" ",e++;else break;return l.length>0?(n+=l,!0):!1}function ye(){if(t[e]==="/"&&t[e+1]==="*"){for(;e<t.length&&!ze(t,e);)e++;return e+=2,!0}if(t[e]==="/"&&t[e+1]==="/"){for(;e<t.length&&t[e]!==`
|
|
8
|
-
`;)e++;return!0}return!1}function V(s){if(Re(s)){if(P(t[e]))for(;e<t.length&&q(t[e]);)e++;return a(),!0}return!1}function Re(s){d(!0);for(let c of s){let l=e+c.length;if(t.slice(e,l)===c)return e=l,!0}return!1}function S(s){return t[e]===s?(n+=t[e],e++,!0):!1}function O(s){return t[e]===s?(e++,!0):!1}function be(){return O("\\")}function j(){return a(),t[e]==="."&&t[e+1]==="."&&t[e+2]==="."?(e+=3,a(),O(","),!0):!1}function Ce(){if(t[e]==="{"){n+="{",e++,a(),O(",")&&a();let s=!0;for(;e<t.length&&t[e]!=="}";){let c;if(s?(c=!0,s=!1):(c=S(","),c||(n=h(n,",")),a()),j(),!(T()||H(!0))){t[e]==="}"||t[e]==="{"||t[e]==="]"||t[e]==="["||t[e]===void 0?n=B(n,","):Ee();break}a();let I=S(":"),A=e>=t.length;I||(J(t[e])||A?n=h(n,":"):Z()),u()||(I||A?n+="null":Z())}return t[e]==="}"?(n+="}",e++):n=h(n,"}"),!0}return!1}function ke(){if(t[e]==="["){n+="[",e++,a(),O(",")&&a();let s=!0;for(;e<t.length&&t[e]!=="]";)if(s?s=!1:S(",")||(n=h(n,",")),j(),!u()){n=B(n,",");break}return t[e]==="]"?(n+="]",e++):n=h(n,"]"),!0}return!1}function Ae(){let s=!0,c=!0;for(;c;)s?s=!1:S(",")||(n=h(n,",")),c=u();c||(n=B(n,",")),n=`[
|
|
9
|
-
${n}
|
|
10
|
-
]`}function T(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,l=t[e]==="\\";if(l&&(e++,l=!0),E(t[e])){let I=z(t[e])?z:G(t[e])?G:L(t[e])?L:Q,A=e,D=n.length,m='"';for(e++;;){if(e>=t.length){let g=Y(e-1);return!s&&_(t.charAt(g))?(e=A,n=n.substring(0,D),T(!0)):(m=h(m,'"'),n+=m,!0)}if(e===c)return m=h(m,'"'),n+=m,!0;if(I(t[e])){let g=e,U=m.length;if(m+='"',e++,n+=m,a(!1),s||e>=t.length||_(t[e])||E(t[e])||k(t[e]))return X(),!0;let R=Y(g-1),ee=t.charAt(R);if(ee===",")return e=A,n=n.substring(0,D),T(!1,R);if(_(ee))return e=A,n=n.substring(0,D),T(!0);n=n.substring(0,D),e=g+1,m=`${m.substring(0,U)}\\${m.substring(U)}`}else if(s&&K(t[e])){if(t[e-1]===":"&&$.test(t.substring(A+1,e+2)))for(;e<t.length&&F.test(t[e]);)m+=t[e],e++;return m=h(m,'"'),n+=m,X(),!0}else if(t[e]==="\\"){let g=t.charAt(e+1);if(Qe[g]!==void 0)m+=t.slice(e,e+2),e+=2;else if(g==="u"){let R=2;for(;R<6&&ae(t[e+R]);)R++;R===6?(m+=t.slice(e,e+6),e+=6):e+R>=t.length?e=t.length:Oe()}else m+=g,e+=2}else{let g=t.charAt(e);g==='"'&&t[e-1]!=="\\"?(m+=`\\${g}`,e++):le(g)?(m+=Je[g],e++):(ce(g)||Se(g),m+=g,e++)}l&&be()}}return!1}function X(){let s=!1;for(a();t[e]==="+";){s=!0,e++,a(),n=B(n,'"',!0);let c=n.length;T()?n=pe(n,c,1):n=h(n,'"')}return s}function Te(){let s=e;if(t[e]==="-"){if(e++,N())return v(s),!0;if(!k(t[e]))return e=s,!1}for(;k(t[e]);)e++;if(t[e]==="."){if(e++,N())return v(s),!0;if(!k(t[e]))return e=s,!1;for(;k(t[e]);)e++}if(t[e]==="e"||t[e]==="E"){if(e++,(t[e]==="-"||t[e]==="+")&&e++,N())return v(s),!0;if(!k(t[e]))return e=s,!1;for(;k(t[e]);)e++}if(!N())return e=s,!1;if(e>s){let c=t.slice(s,e),l=/^0\d/.test(c);return n+=l?`"${c}"`:c,!0}return!1}function we(){return w("true","true")||w("false","false")||w("null","null")||w("True","true")||w("False","false")||w("None","null")}function w(s,c){return t.slice(e,e+s.length)===s?(n+=c,e+=s.length,!0):!1}function H(s){let c=e;if(P(t[e])){for(;e<t.length&&q(t[e]);)e++;let l=e;for(;C(t,l);)l++;if(t[l]==="(")return e=l+1,u(),t[e]===")"&&(e++,t[e]===";"&&e++),!0}for(;e<t.length&&!K(t[e])&&!E(t[e])&&(!s||t[e]!==":");)e++;if(t[e-1]===":"&&$.test(t.substring(c,e+2)))for(;e<t.length&&F.test(t[e]);)e++;if(e>c){for(;C(t,e-1)&&e>0;)e--;let l=t.slice(c,e);return n+=l==="undefined"?"null":JSON.stringify(l),t[e]==='"'&&e++,!0}}function Be(){if(t[e]==="/"){let s=e;for(e++;e<t.length&&(t[e]!=="/"||t[e-1]==="\\");)e++;return e++,n+=`"${t.substring(s,e)}"`,!0}}function Y(s){let c=s;for(;c>0&&C(t,c);)c--;return c}function N(){return e>=t.length||_(t[e])||C(t,e)}function v(s){n+=`${t.slice(s,e)}0`}function Se(s){throw new y(`Invalid character ${JSON.stringify(s)}`,e)}function De(){throw new y(`Unexpected character ${JSON.stringify(t[e])}`,e)}function _e(){throw new y("Unexpected end of json string",t.length)}function Ee(){throw new y("Object key expected",e)}function Z(){throw new y("Colon expected",e)}function Oe(){let s=t.slice(e,e+6);throw new y(`Invalid unicode character "${s}"`,e)}}function ze(t,e){return t[e]==="*"&&t[e+1]==="/"}var Ge=te("JSON_PARSE");function Ve(t,e={}){if(!t||typeof t!="string")return e;try{return JSON.parse(t)}catch(n){let o=je(t);if(o!==void 0)return o;try{let r=x(t);return JSON.parse(r)}catch(r){let u=he(t);if(u&&u!==t)try{return JSON.parse(x(u))}catch{}return Ge.error("Failed to parse JSON even with jsonrepair:",{originalError:n,repairError:r,jsonString:t}),e}}}var ge=Symbol("tool-args-parse-failed");function Tt(t){if(t==null)return{};let e=typeof t=="string"?t.trim():"";if(!e)return{};let n=Ve(e,ge);return n===ge?null:n&&typeof n=="object"&&!Array.isArray(n)?n:null}function je(t){let e=he(t);if(e&&e!==t.trim())try{return JSON.parse(e)}catch{return}}function he(t){let e=t.trimStart();if(!e)return null;let n=e[0];if(n!=="{"&&n!=="[")return null;let o=0,r=!1,u=!1;for(let a=0;a<e.length;a++){let d=e[a];if(r){u?u=!1:d==="\\"?u=!0:d==='"'&&(r=!1);continue}if(d==='"'){r=!0;continue}if(d==="{"||d==="[")o++;else if(d==="}"||d==="]"){if(o--,o===0)return e.slice(0,a+1);if(o<0)return null}}return null}f();function St(t,e="auto"){return e==="openapi_30"?Xe(t):t}function Xe(t){let e=n=>{if(typeof n!="object"||n===null)return n;if(Array.isArray(n))return n.map(e);let o=n,r={};if(Array.isArray(o.type)){let u=o.type;u.length===2&&u.includes("null")?(r.type=u.find(a=>a!=="null"),r.nullable=!0):r.type=u[0]}else o.type!==void 0&&(r.type=o.type);o.const!==void 0&&(r.enum=[o.const],delete r.const),typeof o.exclusiveMinimum=="number"&&(r.minimum=o.exclusiveMinimum,r.exclusiveMinimum=!0),typeof o.exclusiveMaximum=="number"&&(r.maximum=o.exclusiveMaximum,r.exclusiveMaximum=!0),Array.isArray(o.items)?delete r.items:typeof o.items=="object"&&o.items!==null&&(r.items=e(o.items)),Array.isArray(o.enum)&&(r.enum=o.enum.map(String));for(let[u,a]of Object.entries(o))u==="type"||u==="const"||u==="exclusiveMinimum"||u==="exclusiveMaximum"||u==="items"||u==="enum"||u==="$schema"||u==="$id"||u==="default"||u==="dependencies"||u==="patternProperties"||(r[u]=e(a));return r};return e(t)}f();var Et="https://api.openai.com/v1",Ot="https://matilda.maincode.com/api/v1/code";var Nt=process.env.MATILDA_COMPAT_PROXY_BASE_URL;export{Ve as a,Tt as b,he as c,St as d,ne as e,W as f,He as g,Ie as h,Le as i,Et as j,Ot as k,Nt as l,et as m,tt as n,nt as o,ot as p,rt as q,st as r,ie as s,it as t,Fe as u,ut as v};
|
|
11
|
-
/**
|
|
12
|
-
* @license
|
|
13
|
-
* Copyright 2026 Matilda
|
|
14
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2025 Matilda
|
|
19
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2025 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
25
|
-
*/
|
package/chunks/chunk-KHHJYBR5.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{d as m}from"./chunk-27Q5KW3A.js";import{b as w}from"./chunk-GZPNIYVZ.js";w();import{URL as E}from"node:url";var p=[/^10\./,/^127\./,/^172\.(1[6-9]|2[0-9]|3[0-1])\./,/^192\.168\./,/^::1$/,/^fc00:/,/^fe80:/],T=new Set(["UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","CERT_HAS_EXPIRED","ERR_TLS_CERT_ALTNAME_INVALID"]),S=new Set([...T,"ECONNRESET","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH"]),o=class extends Error{constructor(n,s){super(n);this.code=s;this.name="FetchError"}};function N(e){try{let t=new E(e).hostname;return p.some(n=>n.test(t))}catch{return!1}}var b=new Set([301,302,303,307,308]);function _(e,t){try{let n=new E(e),s=new E(t),f=n.protocol==="http:"&&s.protocol==="https:";return s.protocol!==n.protocol&&!f||s.port!==n.port||s.username||s.password?!1:s.hostname===n.hostname}catch{return!1}}async function U(e,t){let n=AbortSignal.timeout(t.timeoutMs),s=t.signal?AbortSignal.any([t.signal,n]):n,f=a=>t.signal?.aborted?new o("Request aborted","ABORT_ERR"):n.aborted?new o(`Request timed out after ${t.timeoutMs}ms`,"ETIMEDOUT"):a instanceof o?a:new o(m(a),d(a)),i=e;for(let a=0;a<=t.maxRedirects;a++){let r;try{r=await fetch(i,{signal:s,headers:t.headers,redirect:"manual"})}catch(c){throw f(c)}if(b.has(r.status)){let c=r.headers.get("location");if(await r.body?.cancel().catch(()=>{}),!c)throw new o("Redirect response missing Location header");let u;try{u=new E(c,i).toString()}catch{throw new o(`Redirect response has a malformed Location header: ${c}`)}if(!_(i,u))return{kind:"cross-host-redirect",originalUrl:i,redirectUrl:u,status:r.status};i=u;continue}let l=r.headers.get("content-type")??"";if(r.status<200||r.status>=300)return await r.body?.cancel().catch(()=>{}),{kind:"response",status:r.status,statusText:r.statusText,contentType:l,body:Buffer.alloc(0),finalUrl:i};let h=Number(r.headers.get("content-length"));if(Number.isFinite(h)&&h>t.maxBytes)throw await r.body?.cancel().catch(()=>{}),new o(`Response too large: ${h} bytes exceeds the ${t.maxBytes}-byte limit`,"EMSGSIZE");let R=[],g=0;if(r.body){let c=r.body.getReader();try{for(;;){let{done:u,value:y}=await c.read();if(u)break;if(g+=y.byteLength,g>t.maxBytes)throw new o(`Response too large: exceeded the ${t.maxBytes}-byte limit while reading`,"EMSGSIZE");R.push(y)}}catch(u){throw await c.cancel().catch(()=>{}),f(u)}finally{c.releaseLock()}}return{kind:"response",status:r.status,statusText:r.statusText,contentType:l,body:Buffer.concat(R,g),finalUrl:i}}throw new o(`Too many redirects (more than ${t.maxRedirects})`,"EMAXREDIRECTS")}function d(e){if(!(!e||typeof e!="object")&&"code"in e&&typeof e.code=="string")return e.code}function A(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);if(e instanceof Error)return e.message;if(!e||typeof e!="object")return;let t=e.message;if(typeof t=="string")return t}function x(e){if(!(e instanceof Error))return;let t=e.cause;if(!t)return;let n=d(t),s=A(t);if(!(!n&&!s))return n&&s&&!s.includes(n)?`${n}: ${s}`:s??n}function L(e,t={}){let n=m(e),s=e instanceof Error?d(e.cause)??d(e):d(e),f=x(e),i=[n,f?`(cause: ${f})`:void 0].filter(Boolean).join(" "),a=n.toLowerCase().includes("fetch failed")||s!=null&&S.has(s),r=s!=null&&T.has(s);if(!a)return i;let l=["","Troubleshooting:",...t.url?[`- Confirm you can reach ${t.url} from this machine.`]:[],"- If you are behind a proxy, pass `--proxy <url>` (or set `proxy` in settings).",...r?["- If your network uses a corporate TLS inspection CA, set `NODE_EXTRA_CA_CERTS` to your CA bundle."]:[]];return`${i}${l.join(`
|
|
4
|
-
`)}`}export{N as a,U as b,L as c};
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2025 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
*/
|