<commit_before>
import { InjectionToken } from '@angular/core';
import { NavController } from '../providers/nav-controller';
import { NavParams } from '../providers/nav-params';

export const NavControllerToken = new InjectionToken<any>('NavControllerToken');
export const NavParamsToken = new InjectionToken<any>('NavParamsToken');

export function getProviders(element: HTMLElement, data: any) {
  if (element.tagName !== 'ion-nav') {
    element.closest('ion-nav');
  }

  const nearestNavElement = (element.tagName.toLowerCase() === 'ion-nav' ? element : element.closest('ion-nav')) as HTMLIonNavElement;

  return [
    {
      provide: NavControllerToken, useValue: nearestNavElement
    },

    {
      provide: NavController, useFactory: provideNavControllerInjectable, deps: [NavControllerToken]
    },

    {
      provide: NavControllerToken, useValue: data
    },

    {
      provide: NavParams, useFactory: provideNavParamsInjectable, deps: [NavControllerToken]
    },
  ]
}

export function provideNavControllerInjectable(element: HTMLIonNavElement) {
  return new NavController(element);
}

export function provideNavParamsInjectable(data: any) {
  return new NavParams(data);
}<commit_msg>fix(di): fix ionic/angular di bug<commit_after>
import { InjectionToken } from '@angular/core';
import { NavController } from '../providers/nav-controller';
import { NavParams } from '../providers/nav-params';

export const NavControllerToken = new InjectionToken<any>('NavControllerToken');
export const NavParamsToken = new InjectionToken<any>('NavParamsToken');

export function getProviders(element: HTMLElement, data: any) {
  if (element.tagName !== 'ion-nav') {
    element.closest('ion-nav');
  }

  const nearestNavElement = (element.tagName.toLowerCase() === 'ion-nav' ? element : element.closest('ion-nav')) as HTMLIonNavElement;

  return [
    {
      provide: NavControllerToken, useValue: nearestNavElement
    },

    {
      provide: NavController, useFactory: provideNavControllerInjectable, deps: [NavControllerToken]
    },

    {
      provide: NavParamsToken, useValue: data
    },

    {
      provide: NavParams, useFactory: provideNavParamsInjectable, deps: [NavParamsToken]
    },
  ]
}

export function provideNavControllerInjectable(element: HTMLIonNavElement) {
  return new NavController(element);
}

export function provideNavParamsInjectable(data: any) {
  return new NavParams(data);
}
{'fraction_non_alphanumeric': 0.11963696369636964, 'fraction_numerical': 0.0, 'mean_word_length': 4.71933962264151, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '2735995', 'n_tokens_mistral': 703, 'n_tokens_neox': 704, 'n_words': 156}