{"version":3,"file":"DownloadReference-B0Z1Y1gb.mjs","names":[],"sources":["../src/components/templates/DownloadReference.vue"],"sourcesContent":["<template>\n  <a :href=\"href\" :download=\"saveFilename\" :class=\"classes\">{{\n    saveFilename\n  }}</a>\n</template>\n\n<script setup>\nimport { computed, toRefs, ref } from 'vue'\nimport { useRoute } from 'vue-router'\nimport { useSphinxStore } from '@/stores/sphinx'\n\nimport { determineRouteUrl } from '../../js/utilities'\n\nconst props = defineProps({\n  node: {\n    type: undefined,\n    default: null,\n  },\n  componentName: {\n    type: String,\n  },\n})\n\nconst { node } = toRefs(props)\nconst route = useRoute()\nconst sphinxStore = useSphinxStore()\n\nconst href = computed(() => {\n  let downloadHref = node.value.getAttribute('filename')\n  if (\n    downloadHref &&\n    !downloadHref.startsWith('/') &&\n    !downloadHref.startsWith('http')\n  ) {\n    const routeURL = determineRouteUrl(route)\n    downloadHref = [sphinxStore.getDownloadURL(routeURL), downloadHref].join(\n      '/',\n    )\n  }\n  return downloadHref\n})\n\nconst targetParts = node.value.getAttribute('reftarget').split('/')\nconst downloadName = targetParts[targetParts.length - 1]\nconst classes = ['reference', 'internal', node.value.getAttribute('reftype')]\n\n// Need to use a refernce variable in the template bound attributes.\nconst saveFilename = ref('not-set')\nsaveFilename.value = downloadName\n</script>\n"],"mappings":";;;;;;;;;;;;;;;EAuBA,IAAM,EAAE,YAAS,EAAO,CAAK,GACvB,IAAQ,EAAS,GACjB,IAAc,EAAe,GAE7B,IAAO,QAAe;GAC1B,IAAI,IAAe,EAAK,MAAM,aAAa,UAAU;GACrD,IACE,KACA,CAAC,EAAa,WAAW,GAAG,KAC5B,CAAC,EAAa,WAAW,MAAM,GAC/B;IACA,IAAM,IAAW,EAAkB,CAAK;IACxC,IAAe,CAAC,EAAY,eAAe,CAAQ,GAAG,CAAY,CAAC,CAAC,KAClE,GACF;GACF;GACA,OAAO;EACT,CAAC,GAEK,IAAc,EAAK,MAAM,aAAa,WAAW,CAAC,CAAC,MAAM,GAAG,GAC5D,IAAe,EAAY,EAAY,SAAS,IAChD,IAAU;GAAC;GAAa;GAAY,EAAK,MAAM,aAAa,SAAS;EAAC,GAGtE,IAAe,EAAI,SAAS;SAClC,EAAa,QAAQ,cA/CnB,EAAA,GAAA,EAEM,KAAA;GAFF,MAAM,EAAA;GAAO,UAAU,EAAA;GAAe,OAAK,EAAE,CAAO;EACtD,GAAA,EAAA,EAAA,KAAY,GAAA,GAAA,CAAA"}