LiquidAI/LFM2-WebGPU
94
1/**2 * Open a webpage3 * @param {string} src - The URL of the webpage.4 * @returns {string} The validated URL.5 */6export function open_webpage(src) {7 try {8 const urlObj = new URL(src);9 if (!["http:", "https:"].includes(urlObj.protocol)) {10 throw new Error("Only HTTP and HTTPS URLs are allowed.");11 }12 return urlObj.href;13 } catch (error) {14 throw new Error("Invalid URL provided.");15 }16}17 18export default (input, output) => {19 return React.createElement(20 "div",21 { className: "bg-blue-50 border border-blue-200 rounded-lg p-4" },22 React.createElement(23 "div",24 { className: "flex items-center mb-2" },25 React.createElement(26 "div",27 {28 className:29 "w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center mr-3",30 },31 "🌐",32 ),33 React.createElement(34 "h3",35 { className: "text-blue-900 font-semibold" },36 "Web Page",37 ),38 ),39 React.createElement("iframe", {40 src: output,41 className: "w-full border border-blue-300 rounded",42 width: 480,43 height: 360,44 title: "Embedded content",45 allow: "autoplay",46 frameBorder: "0",47 }),48 );49};50 