<commit_before>import { inject as service } from '@ember/service';
import Component from '@ember/component';
import layout from './template';
import { computed } from '@ember/object';
import appFiles from 'ember-cli-addon-docs/app-files';
import { dasherize } from '@ember/string';

export default Component.extend({
  layout,

  docsRoutes: service(),
  router: service(),

  tagName: 'main',

  elementId: 'docs-viewer__scroll-body',
  classNames: 'docs-viewer__main',

  editCurrentPageUrl: computed('router.currentRouteName', function() {
    let path = this.get('router.currentRouteName');
    if (!path) {
      // `routing` doesn't exist for old ember versions via ember-try
      return;
    }
    path = path.replace(/\./g, '/');

    if (path === 'docs/api/class') {
      let params = this.get('router._router._routerMicrolib.state').params['docs.api.class'];
      let klass = dasherize(params.class_id.replace(/-.+$/g, ''));
      let path = `pods/${path}`;

      return `https://github.com/ember-learn/ember-cli-addon-docs/edit/master/addon/components/${klass}/component.js`;
    } else {
      let templatePath = `pods/${path}`;
      let file = appFiles.find(file => file.match(`${templatePath}/template.(hbs|md)`));

      return `https://github.com/ember-learn/ember-cli-addon-docs/edit/master/tests/dummy/app/${file}`;
    }
  })

});<commit_msg>Remove hard-coded reference to addon-docs<commit_after>import { inject as service } from '@ember/service';
import Component from '@ember/component';
import layout from './template';
import { computed } from '@ember/object';
import appFiles from 'ember-cli-addon-docs/app-files';
import { dasherize } from '@ember/string';
import config from 'dummy/config/environment';

const packageJson = config['ember-cli-addon-docs'].packageJson;

export default Component.extend({
  layout,

  docsRoutes: service(),
  router: service(),

  tagName: 'main',

  elementId: 'docs-viewer__scroll-body',
  classNames: 'docs-viewer__main',

  editCurrentPageUrl: computed('router.currentRouteName', function() {
    let path = this.get('router.currentRouteName');
    if (!path) {
      // `routing` doesn't exist for old ember versions via ember-try
      return;
    }
    path = path.replace(/\./g, '/');

    if (path === 'docs/api/class') {
      let params = this.get('router._router._routerMicrolib.state').params['docs.api.class'];
      let klass = dasherize(params.class_id.replace(/-.+$/g, ''));
      let path = `pods/${path}`;

      return `${packageJson.repository}/edit/master/addon/components/${klass}/component.js`;
    } else {
      let templatePath = `pods/${path}`;
      let file = appFiles.find(file => file.match(`${templatePath}/template.(hbs|md)`));

      return `${packageJson.repository}/edit/master/tests/dummy/app/${file}`;
    }
  })

});
{'fraction_non_alphanumeric': 0.174822695035461, 'fraction_numerical': 0.0, 'mean_word_length': 3.717391304347826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1782532', 'n_tokens_mistral': 894, 'n_tokens_neox': 900, 'n_words': 179}