UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 885 B
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{ii as t}from"./control-ui-foundation-ZY_Flbbd.js";import{Dt as n}from"./control-ui-boot-shared-3SP_aL-Y.js";function r(e){let t=e.get(`content-length`);if(!t||!/^\d+$/u.test(t))return null;let n=Number(t);return Number.isSafeInteger(n)?n:1/0}async function i(e,t){let i=r(e.headers);if(i!==null&&i>t.maxBytes)throw e.body?.cancel().catch(()=>void 0),Error(t.tooLargeMessage);if(!e.body){if(t.missingBodyMessage)throw Error(t.missingBodyMessage);return``}let a=e.body.getReader(),o=new TextDecoder,s=[];try{await n({maxBytes:t.maxBytes,skipEmptyChunks:!1,read:()=>a.read(),onChunk:e=>{s.push(o.decode(e,{stream:!0}))},onLimit:()=>{throw a.cancel().catch(()=>void 0),Error(t.tooLargeMessage)}});let e=o.decode();e&&s.push(e)}finally{a.releaseLock()}return s.join(``)}function a(){return(a=e((()=>{t()})))()}export{i as n,a as t};