<div id="{{block_id}}">
</div>
<script>
  (function () {
    const width = Number("{{ width }}") // 960
    const height = Number("{{ height }}") // 900

    const iframe = document.createElement("iframe")
    iframe.src = "about:blank"
    iframe.width = width
    iframe.height = height

    const renderBlock = document.getElementById("{{block_id}}")
    renderBlock.appendChild(iframe)

    iframe.contentWindow.__SERVER_ID__ = "{{server_id}}"
    iframe.contentWindow.__ENV__ = "{{env}}"
    iframe.contentWindow.__WIDTH__ = width
    iframe.contentWindow.__HEIGHT__ = height

    const fDocument = iframe.contentDocument
    const container = fDocument.createElement("div")
    container.id = "root"

    const script = fDocument.createElement("script")
    script.src = "https://static.server.retentioneering.com/viztools/preprocessing-graph/v3/preprocessing-graph.umd.js?block={{block_id}}"
    script.type = "text/javascript"

    const link = fDocument.createElement("link")
    link.rel = "stylesheet"
    link.href = "https://static.server.retentioneering.com/viztools/preprocessing-graph/v3/style.css?block={{block_id}}"

    const font1 = fDocument.createElement("link")
    font1.rel = "stylesheet"
    font1.href = "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap"

    const font2 = fDocument.createElement("link")
    font2.rel = "stylesheet"
    font2.href = "https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@300;400&display=swap"

    fDocument.body.appendChild(container)
    fDocument.body.appendChild(script)
    fDocument.body.appendChild(link)
    fDocument.body.appendChild(font1)
    fDocument.body.appendChild(font2)
  })()
</script>
