openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 856 B
JavaScript
import{n as e}from"./rolldown-runtime-8BhlS34s.js";function t(e,t){let n=new URL(e||t,t);if(n.protocol===`ws:`?n.protocol=`http:`:n.protocol===`wss:`&&(n.protocol=`https:`),n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`Gateway URL is invalid`);return n.origin}function n(e,n,r,i,a,o=`Sandbox host URL is invalid`){if(!Number.isInteger(n)||n<1||n>65535)throw Error(o);let s;try{s=t(i,a)}catch{throw Error(o)}let c=r?new URL(r):new URL(s);if(r){if(c.origin!==r.replace(/\/$/u,``)||c.username!==``||c.password!==``)throw Error(o)}else c.port=String(n);c.pathname=`/`,c.search=``,c.hash=``;let l=new URL(e,c);if(c.protocol!==`http:`&&c.protocol!==`https:`||c.origin===new URL(a).origin||c.origin===s||l.origin!==c.origin||l.pathname!==`/mcp-app-sandbox`)throw Error(o);return l.href}function r(){return(r=e((()=>{})))()}export{t as n,n as r,r as t};