//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// InputThemeClassArray is adapter for slice of InputThemeClass.
type InputThemeClassArray []InputThemeClass

// Sort sorts slice of InputThemeClass.
func ( InputThemeClassArray) ( func(,  InputThemeClass) bool) InputThemeClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of InputThemeClass.
func ( InputThemeClassArray) ( func(,  InputThemeClass) bool) InputThemeClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of InputThemeClass.
func ( InputThemeClassArray) ( func( InputThemeClass) bool) InputThemeClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( InputThemeClassArray) () ( InputThemeClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( InputThemeClassArray) () ( InputThemeClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *InputThemeClassArray) () ( InputThemeClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  InputThemeClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *InputThemeClassArray) () ( InputThemeClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsInputTheme returns copy with only InputTheme constructors.
func ( InputThemeClassArray) () ( InputThemeArray) {
	for ,  := range  {
		,  := .(*InputTheme)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputThemeSlug returns copy with only InputThemeSlug constructors.
func ( InputThemeClassArray) () ( InputThemeSlugArray) {
	for ,  := range  {
		,  := .(*InputThemeSlug)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// InputThemeArray is adapter for slice of InputTheme.
type InputThemeArray []InputTheme

// Sort sorts slice of InputTheme.
func ( InputThemeArray) ( func(,  InputTheme) bool) InputThemeArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of InputTheme.
func ( InputThemeArray) ( func(,  InputTheme) bool) InputThemeArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of InputTheme.
func ( InputThemeArray) ( func( InputTheme) bool) InputThemeArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( InputThemeArray) () ( InputTheme,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( InputThemeArray) () ( InputTheme,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *InputThemeArray) () ( InputTheme,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  InputTheme
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *InputThemeArray) () ( InputTheme,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of InputTheme by ID.
func ( InputThemeArray) () InputThemeArray {
	return .Sort(func(,  InputTheme) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of InputTheme by ID.
func ( InputThemeArray) () InputThemeArray {
	return .SortStable(func(,  InputTheme) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( InputThemeArray) ( map[int64]InputTheme) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( InputThemeArray) () map[int64]InputTheme {
	 := make(map[int64]InputTheme, len())
	.FillMap()
	return 
}

// InputThemeSlugArray is adapter for slice of InputThemeSlug.
type InputThemeSlugArray []InputThemeSlug

// Sort sorts slice of InputThemeSlug.
func ( InputThemeSlugArray) ( func(,  InputThemeSlug) bool) InputThemeSlugArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of InputThemeSlug.
func ( InputThemeSlugArray) ( func(,  InputThemeSlug) bool) InputThemeSlugArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of InputThemeSlug.
func ( InputThemeSlugArray) ( func( InputThemeSlug) bool) InputThemeSlugArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( InputThemeSlugArray) () ( InputThemeSlug,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( InputThemeSlugArray) () ( InputThemeSlug,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *InputThemeSlugArray) () ( InputThemeSlug,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  InputThemeSlug
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *InputThemeSlugArray) () ( InputThemeSlug,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}