{"version":3,"file":"main.gE8rzS.js","sources":["theme-9/virtual:theme","theme-9/discourse/components/topic-list-thumbnail.gjs","theme-9/discourse/lib/masonry-calculator.js","theme-9/discourse/connectors/before-topic-list-body/topic-list-masonry-styles.gjs","theme-9/discourse/initializers/topic-thumbnails-init.gjs","theme-9/discourse/services/topic-thumbnails.js","theme-9/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(9);\n\nexport function themePrefix(key) {\n  return `theme_translations.9.${key}`;\n}\n","import Component from \"@glimmer/component\";\nimport { service } from \"@ember/service\";\nimport coldAgeClass from \"discourse/helpers/cold-age-class\";\nimport concatClass from \"discourse/helpers/concat-class\";\nimport dIcon from \"discourse/helpers/d-icon\";\nimport formatDate from \"discourse/helpers/format-date\";\n\nexport default class TopicListThumbnail extends Component {\n  @service topicThumbnails;\n\n  responsiveRatios = [1, 1.5, 2];\n\n  // Make sure to update about.json thumbnail sizes if you change these variables\n  get displayWidth() {\n    return this.topicThumbnails.displayList\n      ? settings.list_thumbnail_size\n      : 400;\n  }\n\n  get topic() {\n    return this.args.topic;\n  }\n\n  get hasThumbnail() {\n    return !!this.topic.thumbnails;\n  }\n\n  get srcSet() {\n    const srcSetArray = [];\n\n    this.responsiveRatios.forEach((ratio) => {\n      const target = ratio * this.displayWidth;\n      const match = this.topic.thumbnails.find(\n        (t) => t.url && t.max_width === target\n      );\n      if (match) {\n        srcSetArray.push(`${match.url} ${ratio}x`);\n      }\n    });\n\n    if (srcSetArray.length === 0) {\n      srcSetArray.push(`${this.original.url} 1x`);\n    }\n\n    return srcSetArray.join(\",\");\n  }\n\n  get original() {\n    return this.topic.thumbnails[0];\n  }\n\n  get width() {\n    return this.original.width;\n  }\n\n  get isLandscape() {\n    return this.original.width >= this.original.height;\n  }\n\n  get height() {\n    return this.original.height;\n  }\n\n  get fallbackSrc() {\n    const largeEnough = this.topic.thumbnails.filter((t) => {\n      if (!t.url) {\n        return false;\n      }\n      return t.max_width > this.displayWidth * this.responsiveRatios.at(-1);\n    });\n\n    const largest = largeEnough.at(-1);\n    if (largest) {\n      return largest.url;\n    }\n\n    return this.original.url;\n  }\n\n  get url() {\n    return this.topic.get(\"linked_post_number\")\n      ? this.topic.urlForPostNumber(this.topic.get(\"linked_post_number\"))\n      : this.topic.get(\"lastUnreadUrl\");\n  }\n\n  <template>\n    <div\n      class={{concatClass\n        \"topic-list-thumbnail\"\n        (if this.hasThumbnail \"has-thumbnail\" \"no-thumbnail\")\n      }}\n    >\n      <a href={{this.url}} role=\"img\" aria-label={{this.topic.title}}>\n        {{#if this.hasThumbnail}}\n          <img\n            class=\"background-thumbnail\"\n            src={{this.fallbackSrc}}\n            srcset={{this.srcSet}}\n            width={{this.width}}\n            height={{this.height}}\n            loading=\"lazy\"\n            alt=\"\"\n          />\n          <img\n            class=\"main-thumbnail\"\n            src={{this.fallbackSrc}}\n            srcset={{this.srcSet}}\n            width={{this.width}}\n            height={{this.height}}\n            loading=\"lazy\"\n            alt=\"\"\n          />\n        {{else}}\n          <div class=\"thumbnail-placeholder\">\n            {{dIcon settings.placeholder_icon}}\n          </div>\n        {{/if}}\n      </a>\n    </div>\n\n    {{#if this.topicThumbnails.showLikes}}\n      <div class=\"topic-thumbnail-likes\">\n        {{dIcon \"heart\"}}\n        <span class=\"number\">\n          {{this.topic.like_count}}\n        </span>\n      </div>\n    {{/if}}\n\n    {{#if this.topicThumbnails.displayBlogStyle}}\n      <div class=\"topic-thumbnail-blog-data\">\n        <div class=\"topic-thumbnail-blog-data-views\">\n          {{dIcon \"eye\"}}\n          <span class=\"number\">\n            {{this.topic.views}}\n          </span>\n        </div>\n        <div class=\"topic-thumbnail-blog-data-likes\">\n          {{dIcon \"heart\"}}\n          <span class=\"number\">\n            {{this.topic.like_count}}\n          </span>\n        </div>\n        <div class=\"topic-thumbnail-blog-data-comments\">\n          {{dIcon \"comment\"}}\n          <span class=\"number\">\n            {{this.topic.replyCount}}\n          </span>\n        </div>\n        <div\n          class={{concatClass\n            \"topic-thumbnail-blog-data-activity\"\n            \"activity\"\n            (coldAgeClass\n              this.topic.createdAt startDate=this.topic.bumpedAt class=\"\"\n            )\n          }}\n          title={{this.topic.bumpedAtTitle}}\n        >\n          <a class=\"post-activity\" href={{this.topic.lastPostUrl}}>\n            {{~formatDate this.topic.bumpedAt format=\"tiny\" noTitle=\"true\"~}}\n          </a>\n        </div>\n      </div>\n    {{/if}}\n  </template>\n}\n","import { htmlSafe } from \"@ember/template\";\n\nexport default class MasonryCalculator {\n  masonryTargetColumnWidth = 300;\n  gridSpacingPixels = 10;\n  masonryTitleSpacePixels = 76;\n  masonryDefaultAspect = 1.3;\n  masonryMinAspect = 0.7;\n\n  topics;\n  masonryContainerWidth;\n\n  constructor(topicThumbnails, topics, masonryContainerWidth) {\n    this.topicThumbnails = topicThumbnails;\n    this.topics = topics;\n    this.masonryContainerWidth = masonryContainerWidth;\n  }\n\n  get numColumns() {\n    return Math.floor(\n      this.masonryContainerWidth / this.masonryTargetColumnWidth\n    );\n  }\n\n  get columnWidth() {\n    return (\n      (this.masonryContainerWidth -\n        (this.numColumns - 1) * this.gridSpacingPixels) /\n      this.numColumns\n    );\n  }\n\n  calculateMasonryLayout() {\n    const numColumns = this.numColumns;\n    const gridSpacingPixels = this.gridSpacingPixels;\n\n    const columnHeights = [];\n    for (let n = 0; n < numColumns; n++) {\n      columnHeights[n] = 0;\n    }\n\n    this.topicData = this.topics.map((topic) => {\n      // Pick the column with the lowest height\n      const smallestColumn = columnHeights.indexOf(Math.min(...columnHeights));\n\n      // Get the height of this topic\n      let aspect = this.masonryDefaultAspect;\n      if (topic.thumbnails) {\n        aspect = topic.thumbnails[0].width / topic.thumbnails[0].height;\n      }\n      aspect = Math.max(aspect, this.masonryMinAspect);\n      const thisHeight =\n        this.columnWidth / aspect + this.masonryTitleSpacePixels;\n\n      const dataForTopic = {\n        columnIndex: smallestColumn,\n        height: thisHeight,\n        heightAbove: columnHeights[smallestColumn],\n      };\n\n      columnHeights[smallestColumn] += thisHeight + gridSpacingPixels;\n\n      return dataForTopic;\n    });\n\n    this.tallestColumn = Math.max(...columnHeights);\n  }\n\n  get masonryStyle() {\n    return htmlSafe(\n      [\n        `.topic-list {`,\n        `--masonry-num-columns: ${Math.round(this.numColumns)};`,\n        `--masonry-grid-spacing: ${this.gridSpacingPixels}px;`,\n        `--masonry-tallest-column: ${Math.round(this.tallestColumn)}px;`,\n        `--masonry-column-width: ${Math.round(this.columnWidth)}px;`,\n        `}`,\n\n        ...this.topicData.map((topicData, index) => {\n          return [\n            `.masonry-${index} {`,\n            `--masonry-column-index: ${topicData.columnIndex};`,\n            `--masonry-height: ${Math.round(topicData.height)}px;`,\n            `--masonry-height-above: ${Math.round(topicData.heightAbove)}px;`,\n            `}`,\n          ].join(\"\\n\");\n        }),\n      ].join(\"\\n\")\n    );\n  }\n}\n","import Component from \"@glimmer/component\";\nimport { service } from \"@ember/service\";\nimport { modifier } from \"ember-modifier\";\nimport MasonryCalculator from \"../../lib/masonry-calculator\";\n\nexport default class TopicListMasonryStyles extends Component {\n  @service topicThumbnails;\n\n  attachResizeObserver = modifier((element) => {\n    const topicList = element.closest(\".topic-list\");\n\n    if (!topicList) {\n      // eslint-disable-next-line no-console\n      console.error(\n        \"topic-list-thumbnails resize-observer must be inside a topic-list\"\n      );\n      return;\n    }\n\n    this.topicThumbnails.masonryContainerWidth =\n      topicList.getBoundingClientRect().width;\n\n    const observer = new ResizeObserver(() => {\n      this.topicThumbnails.masonryContainerWidth =\n        topicList.getBoundingClientRect().width;\n    });\n    observer.observe(topicList);\n\n    return () => {\n      observer.disconnect();\n      this.topicThumbnails.masonryContainerWidth = null;\n    };\n  });\n\n  get masonryStyle() {\n    if (!this.topicThumbnails.displayMasonry) {\n      return;\n    }\n\n    if (!this.topicThumbnails.masonryContainerWidth) {\n      return;\n    }\n\n    const calculator = new MasonryCalculator(\n      this.topicThumbnails,\n      this.args.outletArgs.topics,\n      this.topicThumbnails.masonryContainerWidth\n    );\n    calculator.calculateMasonryLayout();\n    return calculator.masonryStyle;\n  }\n\n  <template>\n    {{#if this.topicThumbnails.displayMasonry}}\n      {{! template-lint-disable no-forbidden-elements }}\n      <style {{this.attachResizeObserver}}>\n        {{this.masonryStyle}}\n      </style>\n    {{/if}}\n  </template>\n}\n","import { readOnly } from \"@ember/object/computed\";\nimport { service } from \"@ember/service\";\nimport { apiInitializer } from \"discourse/lib/api\";\nimport TopicListThumbnail from \"../components/topic-list-thumbnail\";\n\nexport default apiInitializer((api) => {\n  const ttService = api.container.lookup(\"service:topic-thumbnails\");\n\n  api.registerValueTransformer(\"topic-list-class\", ({ value }) => {\n    if (ttService.displayMinimalGrid) {\n      value.push(\"topic-thumbnails-minimal\");\n    } else if (ttService.displayGrid) {\n      value.push(\"topic-thumbnails-grid\");\n    } else if (ttService.displayList) {\n      value.push(\"topic-thumbnails-list\");\n    } else if (ttService.displayMasonry) {\n      value.push(\"topic-thumbnails-masonry\");\n    } else if (ttService.displayBlogStyle) {\n      value.push(\"topic-thumbnails-blog-style-grid\");\n    }\n    return value;\n  });\n\n  api.registerValueTransformer(\"topic-list-columns\", ({ value: columns }) => {\n    if (ttService.enabledForRoute && !ttService.displayList) {\n      columns.add(\n        \"thumbnail\",\n        { item: TopicListThumbnail },\n        { before: \"topic\" }\n      );\n    }\n    return columns;\n  });\n\n  api.renderInOutlet(\n    \"topic-list-before-link\",\n    <template>\n      {{#if ttService.displayList}}\n        <TopicListThumbnail @topic={{@outletArgs.topic}} />\n      {{/if}}\n    </template>\n  );\n\n  api.registerValueTransformer(\"topic-list-item-mobile-layout\", ({ value }) => {\n    if (ttService.enabledForRoute && !ttService.displayList) {\n      // Force the desktop layout\n      return false;\n    }\n    return value;\n  });\n\n  api.registerValueTransformer(\n    \"topic-list-item-class\",\n    ({ value, context: { index } }) => {\n      if (ttService.displayMasonry) {\n        value.push(`masonry-${index}`);\n      }\n      return value;\n    }\n  );\n\n  const siteSettings = api.container.lookup(\"service:site-settings\");\n  if (settings.docs_thumbnail_mode !== \"none\" && siteSettings.docs_enabled) {\n    api.modifyClass(\"component:docs-topic-list\", {\n      pluginId: \"topic-thumbnails\",\n      topicThumbnailsService: service(\"topic-thumbnails\"),\n      classNameBindings: [\n        \"isMinimalGrid:topic-thumbnails-minimal\",\n        \"isThumbnailGrid:topic-thumbnails-grid\",\n        \"isThumbnailList:topic-thumbnails-list\",\n        \"isMasonryList:topic-thumbnails-masonry\",\n        \"isBlogStyleGrid:topic-thumbnails-blog-style-grid\",\n      ],\n      isMinimalGrid: readOnly(\"topicThumbnailsService.displayMinimalGrid\"),\n      isThumbnailGrid: readOnly(\"topicThumbnailsService.displayGrid\"),\n      isThumbnailList: readOnly(\"topicThumbnailsService.displayList\"),\n      isMasonryList: readOnly(\"topicThumbnailsService.displayMasonry\"),\n      isBlogStyleGrid: readOnly(\"topicThumbnailsService.displayBlogStyle\"),\n    });\n  }\n});\n","import { tracked } from \"@glimmer/tracking\";\nimport { computed } from \"@ember/object\";\nimport { dependentKeyCompat } from \"@ember/object/compat\";\nimport Service, { service } from \"@ember/service\";\nimport Site from \"discourse/models/site\";\n\nconst minimalGridCategories = settings.minimal_grid_categories\n  .split(\"|\")\n  .map((id) => parseInt(id, 10));\n\nconst listCategories = settings.list_categories\n  .split(\"|\")\n  .map((id) => parseInt(id, 10));\n\nconst gridCategories = settings.grid_categories\n  .split(\"|\")\n  .map((id) => parseInt(id, 10));\n\nconst masonryCategories = settings.masonry_categories\n  .split(\"|\")\n  .map((id) => parseInt(id, 10));\n\nconst blogStyleCategories = settings.blog_style_categories\n  .split(\"|\")\n  .map((id) => parseInt(id, 10));\n\nconst minimalGridTags = settings.minimal_grid_tags.split(\"|\");\nconst listTags = settings.list_tags.split(\"|\");\nconst gridTags = settings.grid_tags.split(\"|\");\nconst masonryTags = settings.masonry_tags.split(\"|\");\nconst blogStyleTags = settings.blog_style_tags.split(\"|\");\n\nexport default class TopicThumbnailService extends Service {\n  @service router;\n  @service discovery;\n\n  @tracked masonryContainerWidth;\n\n  @dependentKeyCompat\n  get isTopicListRoute() {\n    return this.discovery.onDiscoveryRoute;\n  }\n\n  @computed(\"router.currentRouteName\")\n  get isTopicRoute() {\n    return this.router?.currentRouteName?.match(/^topic\\./);\n  }\n\n  @computed(\"router.currentRouteName\")\n  get isDocsRoute() {\n    return this.router?.currentRouteName?.match(/^docs\\./);\n  }\n\n  @dependentKeyCompat\n  get viewingCategoryId() {\n    return this.discovery.category?.id;\n  }\n\n  @dependentKeyCompat\n  get viewingTagName() {\n    return this.discovery.tag?.name;\n  }\n\n  @computed(\n    \"viewingCategoryId\",\n    \"viewingTagName\",\n    \"router.currentRoute.metadata.customThumbnailMode\",\n    \"isTopicListRoute\",\n    \"isTopicRoute\",\n    \"isDocsRoute\"\n  )\n  get displayMode() {\n    if (this.router?.currentRoute?.metadata?.customThumbnailMode) {\n      return this.router?.currentRoute?.metadata?.customThumbnailMode;\n    }\n    if (minimalGridCategories.includes(this.viewingCategoryId)) {\n      return \"minimal-grid\";\n    } else if (blogStyleCategories.includes(this.viewingCategoryId)) {\n      return \"blog-style\";\n    } else if (masonryCategories.includes(this.viewingCategoryId)) {\n      return \"masonry\";\n    } else if (gridCategories.includes(this.viewingCategoryId)) {\n      return \"grid\";\n    } else if (listCategories.includes(this.viewingCategoryId)) {\n      return \"list\";\n    } else if (masonryTags.includes(this.viewingTagName)) {\n      return \"masonry\";\n    } else if (minimalGridTags.includes(this.viewingTagName)) {\n      return \"minimal-grid\";\n    } else if (blogStyleTags.includes(this.viewingTagName)) {\n      return \"blog-style\";\n    } else if (gridTags.includes(this.viewingTagName)) {\n      return \"grid\";\n    } else if (listTags.includes(this.viewingTagName)) {\n      return \"list\";\n    } else if (this.isTopicRoute && settings.suggested_topics_mode) {\n      return settings.suggested_topics_mode;\n    } else if (this.isTopicListRoute || settings.enable_outside_topic_lists) {\n      return settings.default_thumbnail_mode;\n    } else if (this.isDocsRoute) {\n      return settings.docs_thumbnail_mode;\n    } else {\n      return \"none\";\n    }\n  }\n\n  @computed(\"displayMode\")\n  get enabledForRoute() {\n    return this.displayMode !== \"none\";\n  }\n\n  @computed()\n  get enabledForDevice() {\n    return Site.current().mobileView ? settings.mobile_thumbnails : true;\n  }\n\n  @computed(\"enabledForRoute\", \"enabledForDevice\")\n  get shouldDisplay() {\n    return this.enabledForRoute && this.enabledForDevice;\n  }\n\n  @computed(\"shouldDisplay\", \"displayMode\")\n  get displayMinimalGrid() {\n    return this.shouldDisplay && this.displayMode === \"minimal-grid\";\n  }\n\n  @computed(\"shouldDisplay\", \"displayMode\")\n  get displayList() {\n    return this.shouldDisplay && this.displayMode === \"list\";\n  }\n\n  @computed(\"shouldDisplay\", \"displayMode\")\n  get displayGrid() {\n    return this.shouldDisplay && this.displayMode === \"grid\";\n  }\n\n  @computed(\"shouldDisplay\", \"displayMode\")\n  get displayMasonry() {\n    return this.shouldDisplay && this.displayMode === \"masonry\";\n  }\n\n  @computed(\"shouldDisplay\", \"displayMode\")\n  get displayBlogStyle() {\n    return this.shouldDisplay && this.displayMode === \"blog-style\";\n  }\n\n  @computed(\"displayMinimalGrid\", \"displayBlogStyle\")\n  get showLikes() {\n    return this.displayMinimalGrid;\n  }\n}\n","import * as Mod1 from \"./discourse/components/topic-list-thumbnail\";\nimport * as Mod2 from \"./discourse/connectors/before-topic-list-body/topic-list-masonry-styles.gjs\";\nimport * as Mod3 from \"./discourse/initializers/topic-thumbnails-init\";\nimport * as Mod4 from \"./discourse/lib/masonry-calculator\";\nimport * as Mod5 from \"./discourse/services/topic-thumbnails\";\nconst compatModules = {\n  \"discourse/components/topic-list-thumbnail\": Mod1,\n  \"discourse/connectors/before-topic-list-body/topic-list-masonry-styles\": Mod2,\n  \"discourse/initializers/topic-thumbnails-init\": Mod3,\n  \"discourse/lib/masonry-calculator\": Mod4,\n  \"discourse/services/topic-thumbnails\": Mod5,\n};\nexport { compatModules };\nexport default compatModules;\n"],"names":["settings","getObjectForTheme","TopicListThumbnail","Component","dt7948","g","this","prototype","service","topicThumbnails","i","responsiveRatios","displayWidth","displayList","list_thumbnail_size","topic","args","hasThumbnail","thumbnails","srcSet","srcSetArray","forEach","ratio","target","match","find","t","url","max_width","push","length","original","join","width","isLandscape","height","fallbackSrc","largest","filter","at","get","urlForPostNumber","setComponentTemplate","createTemplateFactory","id","block","moduleName","scope","concatClass","dIcon","coldAgeClass","formatDate","isStrictMode","MasonryCalculator","masonryTargetColumnWidth","gridSpacingPixels","masonryTitleSpacePixels","masonryDefaultAspect","masonryMinAspect","topics","masonryContainerWidth","constructor","numColumns","Math","floor","columnWidth","calculateMasonryLayout","columnHeights","n","topicData","map","smallestColumn","indexOf","min","aspect","max","thisHeight","dataForTopic","columnIndex","heightAbove","tallestColumn","masonryStyle","htmlSafe","round","index","TopicListMasonryStyles","attachResizeObserver","modifier","element","topicList","closest","console","error","getBoundingClientRect","observer","ResizeObserver","observe","disconnect","displayMasonry","calculator","outletArgs","topicThumbnailsInit","apiInitializer","api","ttService","container","lookup","registerValueTransformer","value","displayMinimalGrid","displayGrid","displayBlogStyle","columns","enabledForRoute","add","item","before","renderInOutlet","templateOnly","context","siteSettings","docs_thumbnail_mode","docs_enabled","modifyClass","pluginId","topicThumbnailsService","classNameBindings","isMinimalGrid","readOnly","isThumbnailGrid","isThumbnailList","isMasonryList","isBlogStyleGrid","minimalGridCategories","minimal_grid_categories","split","parseInt","listCategories","list_categories","gridCategories","grid_categories","masonryCategories","masonry_categories","blogStyleCategories","blog_style_categories","minimalGridTags","minimal_grid_tags","listTags","list_tags","gridTags","grid_tags","masonryTags","masonry_tags","blogStyleTags","blog_style_tags","TopicThumbnailService","Service","router","discovery","tracked","isTopicListRoute","onDiscoveryRoute","dependentKeyCompat","isTopicRoute","currentRouteName","computed","isDocsRoute","viewingCategoryId","category","viewingTagName","tag","name","displayMode","currentRoute","metadata","customThumbnailMode","includes","suggested_topics_mode","enable_outside_topic_lists","default_thumbnail_mode","enabledForDevice","Site","current","mobileView","mobile_thumb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