//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{}
)

// InputMessageClassArray is adapter for slice of InputMessageClass.
type InputMessageClassArray []InputMessageClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsInputMessageID returns copy with only InputMessageID constructors.
func ( InputMessageClassArray) () ( InputMessageIDArray) {
	for ,  := range  {
		,  := .(*InputMessageID)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputMessageReplyTo returns copy with only InputMessageReplyTo constructors.
func ( InputMessageClassArray) () ( InputMessageReplyToArray) {
	for ,  := range  {
		,  := .(*InputMessageReplyTo)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputMessageCallbackQuery returns copy with only InputMessageCallbackQuery constructors.
func ( InputMessageClassArray) () ( InputMessageCallbackQueryArray) {
	for ,  := range  {
		,  := .(*InputMessageCallbackQuery)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// InputMessageIDArray is adapter for slice of InputMessageID.
type InputMessageIDArray []InputMessageID

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// FillMap fills constructors to given map.
func ( InputMessageIDArray) ( map[int]InputMessageID) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( InputMessageIDArray) () map[int]InputMessageID {
	 := make(map[int]InputMessageID, len())
	.FillMap()
	return 
}

// InputMessageReplyToArray is adapter for slice of InputMessageReplyTo.
type InputMessageReplyToArray []InputMessageReplyTo

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// FillMap fills constructors to given map.
func ( InputMessageReplyToArray) ( map[int]InputMessageReplyTo) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( InputMessageReplyToArray) () map[int]InputMessageReplyTo {
	 := make(map[int]InputMessageReplyTo, len())
	.FillMap()
	return 
}

// InputMessageCallbackQueryArray is adapter for slice of InputMessageCallbackQuery.
type InputMessageCallbackQueryArray []InputMessageCallbackQuery

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// FillMap fills constructors to given map.
func ( InputMessageCallbackQueryArray) ( map[int]InputMessageCallbackQuery) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( InputMessageCallbackQueryArray) () map[int]InputMessageCallbackQuery {
	 := make(map[int]InputMessageCallbackQuery, len())
	.FillMap()
	return 
}