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

// InputPeerClassArray is adapter for slice of InputPeerClass.
type InputPeerClassArray []InputPeerClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsInputPeerChat returns copy with only InputPeerChat constructors.
func ( InputPeerClassArray) () ( InputPeerChatArray) {
	for ,  := range  {
		,  := .(*InputPeerChat)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputPeerUser returns copy with only InputPeerUser constructors.
func ( InputPeerClassArray) () ( InputPeerUserArray) {
	for ,  := range  {
		,  := .(*InputPeerUser)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputPeerChannel returns copy with only InputPeerChannel constructors.
func ( InputPeerClassArray) () ( InputPeerChannelArray) {
	for ,  := range  {
		,  := .(*InputPeerChannel)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputPeerUserFromMessage returns copy with only InputPeerUserFromMessage constructors.
func ( InputPeerClassArray) () ( InputPeerUserFromMessageArray) {
	for ,  := range  {
		,  := .(*InputPeerUserFromMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsInputPeerChannelFromMessage returns copy with only InputPeerChannelFromMessage constructors.
func ( InputPeerClassArray) () ( InputPeerChannelFromMessageArray) {
	for ,  := range  {
		,  := .(*InputPeerChannelFromMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// InputPeerChatArray is adapter for slice of InputPeerChat.
type InputPeerChatArray []InputPeerChat

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// InputPeerUserArray is adapter for slice of InputPeerUser.
type InputPeerUserArray []InputPeerUser

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// InputPeerChannelArray is adapter for slice of InputPeerChannel.
type InputPeerChannelArray []InputPeerChannel

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// InputPeerUserFromMessageArray is adapter for slice of InputPeerUserFromMessage.
type InputPeerUserFromMessageArray []InputPeerUserFromMessage

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// InputPeerChannelFromMessageArray is adapter for slice of InputPeerChannelFromMessage.
type InputPeerChannelFromMessageArray []InputPeerChannelFromMessage

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}