File size: 1,224 Bytes
68185ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
 * Open a webpage
 * @param {string} src - The URL of the webpage.
 * @returns {string} The validated URL.
 */
export function open_webpage(src) {
  try {
    const urlObj = new URL(src);
    if (!["http:", "https:"].includes(urlObj.protocol)) {
      throw new Error("Only HTTP and HTTPS URLs are allowed.");
    }
    return urlObj.href;
  } catch (error) {
    throw new Error("Invalid URL provided.");
  }
}

export default (input, output) => {
  return React.createElement(
    "div",
    { className: "bg-blue-50 border border-blue-200 rounded-lg p-4" },
    React.createElement(
      "div",
      { className: "flex items-center mb-2" },
      React.createElement(
        "div",
        {
          className:
            "w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center mr-3",
        },
        "🌐",
      ),
      React.createElement(
        "h3",
        { className: "text-blue-900 font-semibold" },
        "Web Page",
      ),
    ),
    React.createElement("iframe", {
      src: output,
      className: "w-full border border-blue-300 rounded",
      width: 480,
      height: 360,
      title: "Embedded content",
      allow: "autoplay",
      frameBorder: "0",
    }),
  );
};