{% set inject_edit_url = preprocessor and preprocessor.get_edit_url(doc) %}
{% set translator_edit_url = translator and translator.get_edit_url(doc) %}
<link rel="stylesheet" href="/_grow/ui/css/ui.min.css">
<script src="/_grow/ui/js/ui.min.js"></script>
{% for tool in ui.tools %}
  {% if tool.paths is defined %}
    {% if tool.paths.style is defined %}
      <link rel="stylesheet" href="{{tool.paths.style}}">
    {% endif %}
    {% if tool.paths.script is defined %}
      <script src="{{tool.paths.script}}"></script>
    {% endif %}
  {% else %}
    <link rel="stylesheet" href="/_grow/ui/tools/grow-tool-{{tool.kind}}/tool.css">
    <script src="/_grow/ui/tools/grow-tool-{{tool.kind}}/tool.js"></script>
  {% endif %}
  {% if tool.options is defined %}
    <script>grow.ui.toolConfig('{{tool.kind}}', {{tool.options | jsonify | safe}});</script>
  {% endif %}
{% endfor %}
<script>
  grow.ui.main({
    docPodPath: '{{doc.pod_path}}',
    {% if inject_edit_url %}injectEditUrl: '{{inject_edit_url|safe}}',{% endif %}
    {% if translator_edit_url %}injectTranslateUrl: '{{translator_edit_url|safe}}',{% endif %}
  });
</script>
