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

// BotCommandScopeClassArray is adapter for slice of BotCommandScopeClass.
type BotCommandScopeClassArray []BotCommandScopeClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsBotCommandScopePeer returns copy with only BotCommandScopePeer constructors.
func ( BotCommandScopeClassArray) () ( BotCommandScopePeerArray) {
	for ,  := range  {
		,  := .(*BotCommandScopePeer)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsBotCommandScopePeerAdmins returns copy with only BotCommandScopePeerAdmins constructors.
func ( BotCommandScopeClassArray) () ( BotCommandScopePeerAdminsArray) {
	for ,  := range  {
		,  := .(*BotCommandScopePeerAdmins)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsBotCommandScopePeerUser returns copy with only BotCommandScopePeerUser constructors.
func ( BotCommandScopeClassArray) () ( BotCommandScopePeerUserArray) {
	for ,  := range  {
		,  := .(*BotCommandScopePeerUser)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// BotCommandScopePeerArray is adapter for slice of BotCommandScopePeer.
type BotCommandScopePeerArray []BotCommandScopePeer

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// BotCommandScopePeerAdminsArray is adapter for slice of BotCommandScopePeerAdmins.
type BotCommandScopePeerAdminsArray []BotCommandScopePeerAdmins

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// BotCommandScopePeerUserArray is adapter for slice of BotCommandScopePeerUser.
type BotCommandScopePeerUserArray []BotCommandScopePeerUser

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}