<% unless source.include?("://")%>
  <% source = "https://#{source}" %>
<% end %>
<div class="flex items-center justify-between gap-2 py-1 first:pt-0 last:pb-0">
  <div class="flex items-center gap-2 justify-center h-full min-w-0 flex-shrink">
    <% if icon_path = icon_asset_for_url(source) %>
      <%= image_tag icon_path, class: "h-6 w-6 mt-1 flex-shrink-0" %>
    <% else %>
      <i class="fa-solid fa-link mt-1 h-6 w-6 flex-shrink-0"></i>
    <% end %>
    <%= link_to source,
              source,
              class: "text-blue-600 hover:underline truncate",
              target: "_blank" %>
  </div>
  <% if lfs = link_for_source(source) %>
    <%= link_to lfs.model_path,
                class:
                  "flex items-center rounded overflow-hidden bg-blue-600 text-sm text-white hover:bg-blue-700 h-8 flex-shrink-0" do %>
      <% if lfs.icon_path %>
        <%= image_tag lfs.icon_path, class: "h-full" %>
      <% end %>
      <span class="truncate overflow-ellipsis px-3 py-1"><%= lfs.title %></span>
    <% end %>
  <% end %>
</div>
