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

// DialogClassArray is adapter for slice of DialogClass.
type DialogClassArray []DialogClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsDialog returns copy with only Dialog constructors.
func ( DialogClassArray) () ( DialogArray) {
	for ,  := range  {
		,  := .(*Dialog)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsDialogFolder returns copy with only DialogFolder constructors.
func ( DialogClassArray) () ( DialogFolderArray) {
	for ,  := range  {
		,  := .(*DialogFolder)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// DialogArray is adapter for slice of Dialog.
type DialogArray []Dialog

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// DialogFolderArray is adapter for slice of DialogFolder.
type DialogFolderArray []DialogFolder

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}