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

// MessageExtendedMediaClassArray is adapter for slice of MessageExtendedMediaClass.
type MessageExtendedMediaClassArray []MessageExtendedMediaClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsMessageExtendedMediaPreview returns copy with only MessageExtendedMediaPreview constructors.
func ( MessageExtendedMediaClassArray) () ( MessageExtendedMediaPreviewArray) {
	for ,  := range  {
		,  := .(*MessageExtendedMediaPreview)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsMessageExtendedMedia returns copy with only MessageExtendedMedia constructors.
func ( MessageExtendedMediaClassArray) () ( MessageExtendedMediaArray) {
	for ,  := range  {
		,  := .(*MessageExtendedMedia)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// MessageExtendedMediaPreviewArray is adapter for slice of MessageExtendedMediaPreview.
type MessageExtendedMediaPreviewArray []MessageExtendedMediaPreview

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// MessageExtendedMediaArray is adapter for slice of MessageExtendedMedia.
type MessageExtendedMediaArray []MessageExtendedMedia

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}