<commit_before>import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,AfterContentInit,EventEmitter,OnDestroy,Input,Output,TemplateRef,ContentChildren,QueryList,Renderer2,ViewChild,ChangeDetectorRef} from '@angular/core';
import {DomHandler} from '../dom/domhandler';
import {SharedModule,PrimeTemplate} from '../common/shared';
import {CommonModule} from '@angular/common';

@Component({
    selector: 'p-carousel',
    template: `
        <div #container [ngClass]="{'ui-carousel ui-widget ui-widget-content ui-corner-all':true}" [ngStyle]="style" [class]="styleClass">
            <div class="ui-carousel-header ui-widget-header ui-corner-all">
                <span class="ui-carousel-header-title">{{headerText}}</span>
                <span class="ui-carousel-button ui-carousel-next-button pi pi-arrow-circle-right" (click)="onNextNav()" 
                        [ngClass]="{'ui-state-disabled':(page === (totalPages-1)) && !circular}" *ngIf="value&&value.length"></span>
                <span class="ui-carousel-button ui-carousel-prev-button pi pi-arrow-circle-left" (click)="onPrevNav()" 
                        [ngClass]="{'ui-state-disabled':(page === 0 && !circular)}" *ngIf="value&&value.length"></span>
                <div *ngIf="displayPageLinks" class="ui-carousel-page-links">
                    <a href="#" (click)="setPageWithLink($event,i)" class="ui-carousel-page-link pi" *ngFor="let links of anchorPageLinks;let i=index" [ngClass]="{'pi-circle-on': page===i, 'pi-circle-off': page !== i}"></a>
                </div>
                <select *ngIf="displayPageDropdown" class="ui-carousel-dropdown ui-widget ui-state-default ui-corner-left" [value]="page" (change)="onDropdownChange($event.target.value)">
                    <option *ngFor="let option of selectDropdownOptions" [value]="option" [selected]="value == option">{{option+1}}</option>
                </select>
                <select *ngIf="responsive&&value&&value.length" class="ui-carousel-mobiledropdown ui-widget ui-state-default ui-corner-left" [value]="page" (change)="onDropdownChange($event.target.value)"
                    [style.display]="shrinked ? 'block' : 'none'">
                    <option *ngFor="let option of mobileDropdownOptions" [value]="option" [selected]="value == option">{{option+1}}</option>
                </select>
            </div>
            <div #viewport class="ui-carousel-viewport">
                <ul #items class="ui-carousel-items" [style.left.px]="left" [style.transitionProperty]="'left'" 
                            [style.transitionDuration]="effectDuration" [style.transitionTimingFunction]="easing">
                    <li *ngFor="let item of value" class="ui-carousel-item ui-widget-content ui-corner-all">
                        <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
                    </li>
                </ul>
            </div>
        </div>
    `,
    providers: [DomHandler]
})
export class Carousel implements AfterViewChecked,AfterViewInit,OnDestroy{
    
    @Input() numVisible: number = 3;

    @Input() firstVisible: number = 0;

    @Input() headerText: string;

    @Input() circular: boolean = false;

    @Input() breakpoint: number = 560;

    @Input() responsive: boolean = true;

    @Input() autoplayInterval: number = 0;
    
    @Input() effectDuration: any = '1s';
        
    @Input() easing: string = 'ease-out';

    @Input() pageLinks: number = 3;

    @Input() style: any;

    @Input() styleClass: string;
    
    @Output() onPage: EventEmitter<any> = new EventEmitter();
        
    @ContentChildren(PrimeTemplate) templates: QueryList<any>;
    
    public _value: any[];
    
    public itemTemplate: TemplateRef<any>;
            
    public left: any = 0;
        
    public items: any;
    
    public columns: any;
        
    public page: number;
                    
    public valuesChanged: any;
    
    public interval: any;
    
    public anchorPageLinks: any[];
    
    public mobileDropdownOptions: any[];
    
    public selectDropdownOptions: any[];
    
    public shrinked: boolean;
    
    @ViewChild('container') containerViewChild: ElementRef;
    
    @ViewChild('viewport') viewportViewChild: ElementRef;
        
    @ViewChild('items') itemsViewChild: ElementRef;
    
    documentResponsiveListener: any;
    
    differ: any;
<commit_msg>Fix carousel when data is loaded from service<commit_after>import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,AfterContentInit,EventEmitter,OnDestroy,Input,Output,TemplateRef,ContentChildren,QueryList,Renderer2,ViewChild,ChangeDetectorRef} from '@angular/core';
import {DomHandler} from '../dom/domhandler';
import {SharedModule,PrimeTemplate} from '../common/shared';
import {CommonModule} from '@angular/common';

@Component({
    selector: 'p-carousel',
    template: `
        <div #container [ngClass]="{'ui-carousel ui-widget ui-widget-content ui-corner-all':true}" [ngStyle]="style" [class]="styleClass">
            <div class="ui-carousel-header ui-widget-header ui-corner-all">
                <span class="ui-carousel-header-title">{{headerText}}</span>
                <span class="ui-carousel-button ui-carousel-next-button pi pi-arrow-circle-right" (click)="onNextNav()" 
                        [ngClass]="{'ui-state-disabled':(page === (totalPages-1)) && !circular}" *ngIf="value&&value.length"></span>
                <span class="ui-carousel-button ui-carousel-prev-button pi pi-arrow-circle-left" (click)="onPrevNav()" 
                        [ngClass]="{'ui-state-disabled':(page === 0 && !circular)}" *ngIf="value&&value.length"></span>
                <div *ngIf="displayPageLinks" class="ui-carousel-page-links">
                    <a href="#" (click)="setPageWithLink($event,i)" class="ui-carousel-page-link pi" *ngFor="let links of anchorPageLinks;let i=index" [ngClass]="{'pi-circle-on': page===i, 'pi-circle-off': page !== i}"></a>
                </div>
                <select *ngIf="displayPageDropdown" class="ui-carousel-dropdown ui-widget ui-state-default ui-corner-left" [value]="page" (change)="onDropdownChange($event.target.value)">
                    <option *ngFor="let option of selectDropdownOptions" [value]="option" [selected]="value == option">{{option+1}}</option>
                </select>
                <select *ngIf="responsive&&value&&value.length" class="ui-carousel-mobiledropdown ui-widget ui-state-default ui-corner-left" [value]="page" (change)="onDropdownChange($event.target.value)"
                    [style.display]="shrinked ? 'block' : 'none'">
                    <option *ngFor="let option of mobileDropdownOptions" [value]="option" [selected]="value == option">{{option+1}}</option>
                </select>
            </div>
            <div #viewport class="ui-carousel-viewport">
                <ul #items class="ui-carousel-items" [style.left.px]="left" [style.transitionProperty]="'left'" 
                            [style.transitionDuration]="effectDuration" [style.transitionTimingFunction]="easing">
                    <li *ngFor="let item of value" class="ui-carousel-item ui-widget-content ui-corner-all">
                        <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
                    </li>
                </ul>
            </div>
        </div>
    `,
    providers: [DomHandler]
})
export class Carousel implements AfterViewChecked,AfterViewInit,OnDestroy{
    
    @Input() numVisible: number = 3;

    @Input() firstVisible: number = 0;

    @Input() headerText: string;

    @Input() circular: boolean = false;

    @Input() breakpoint: number = 560;

    @Input() responsive: boolean = true;

    @Input() autoplayInterval: number = 0;
    
    @Input() effectDuration: any = '1s';
        
    @Input() easing: string = 'ease-out';

    @Input() pageLinks: number = 3;

    @Input() style: any;

    @Input() styleClass: string;
    
    @Output() onPage: EventEmitter<any> = new EventEmitter();
        
    @ContentChildren(PrimeTemplate) templates: QueryList<any>;
    
    public _value: any[];
    
    public itemTemplate: TemplateRef<any>;
            
    public left: any = 0;
        
    public items: any;
    
    public columns: number = 0;
        
    public page: number;
                    
    public valuesChanged: any;
    
    public interval: any;
    
    public anchorPageLinks: any[];
    
    public mobileDropdownOptions: any[];
    
    public selectDropdownOptions: any[];
    
    public shrinked: boolean;
    
    @ViewChild('container') containerViewChild: ElementRef;
    
    @ViewChild('viewport') viewportViewChild: ElementRef;
        
    @ViewChild('items') itemsViewChild: ElementRef;
    
    documentResponsiveListener: any;
    
    differ: any;

{'fraction_non_alphanumeric': 0.15238202500281564, 'fraction_numerical': 0.0032661335736006306, 'mean_word_length': 2.844155844155844, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, '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': '3002727', 'n_tokens_mistral': 2678, 'n_tokens_neox': 2570, 'n_words': 504}