This function converts non-[[\romkaChev\yii2\swiper\Slide]] items
to [[\romkaChev\yii2\swiper\Slide]] respectively

Then it merges [[\romkaChev\yii2\swiper\Swiper::$itemOptions]] with
concrete item options
331143
protected function normalizeItems()
    {
        foreach ($this->items as $index => $item) {
            $this->items[$index] = $this->normalizeItem( $item, $index );
        }
    }
396973
function items2models(items, params) {
        // приводим к формату №2
        if (typeof items === 'string') {
            items = [ items ];
        }

        // приводим №2 к формату №3
        if (typeof items[0] === 'string') {
            params = params || {};
            items = normalizeItems(items, params);
        }

        var models = [];
        for (var i = 0, l = items.length; i < l; i++) {
            var item = items[i];
            // ns.request( [ ModelInstance ] )
            if (item instanceof ns.Model) {
                models.push(item);

            } else if (item.model && item.model instanceof ns.Model) {
                models.push(item.model);

            } else {
                models.push(ns.Model.get(item.id, item.params));
            }
        }

        return models;
    }
795335
def merge_items(items):
    # type: (List[AbstractType]) -> List[AbstractType]
    """"""
    result = []
    while items:
        item = items.pop()
        merged = None
        for i, other in enumerate(items):
            merged = merged_type(item, other)
            if merged:
                break
        if merged:
            del items[i]
            items.append(merged)
        else:
            result.append(item)
    return list(reversed(result))
1271613
protected function transformItems()
    {
        $this->leftItems = array();
        $this->rightItems = array();
        
        foreach ($this->items as $hash => $value) {
            if (array_search($value->getKey(), $this->value) !== false) {
                $this->rightItems[] = $value;
            } else {
                $this->leftItems[] = $value;
            }
        }
    }
1323414
public function initElements()
    {

    	$itemService = taoItems_models_classes_ItemsService::singleton();

		$fileName = '';
    	$options = array();
    	$disabledOptions = array();
    	if(isset($this->data['instance'])){
    		$item = $this->data['instance'];
    		if($item instanceof core_kernel_classes_Resource){
    			if($itemService->hasItemModel($item, array(ItemModel::MODEL_URI))){
    				$fileName = strtolower(tao_helpers_Display::textCleaner($item->getLabel()));
					try{
						$this->isInstanceValid($item);
					}catch(\common_exception_UserReadableException $e){
						$disabledOptions[$item->getUri()] = $e->getUserMessage();
					}
    				$options[$item->getUri()] = $item->getLabel();
    			}
    		}
    	}
    	else {
    		if(isset($this->data['class'])){
	    		$class = $this->data['class'];
	    	}
	    	else{
	    		$class = $itemService->getRootClass();
	    	}
    		if($class instanceof core_kernel_classes_Class){
                    $fileName =  strtolower(tao_helpers_Display::textCleaner($class->getLabel(), '*'));
                    foreach($class->getInstances(true) as $instance){
                        if($itemService->hasItemModel($instance, array(ItemModel::MODEL_URI))){
							try{
								$this->isInstanceValid($instance);
							}catch(\common_exception_UserReadableException $e){
								$disabledOptions[$instance->getUri()] = $e->getUserMessage();
							}
							$options[$instance->getUri()] = $instance->getLabel();
                        }
                    }
    		}
    	}

		$nameElt = tao_helpers_form_FormFactory::getElement('filename', 'Textbox');
		$nameElt->setDescription(__('File name'));
		$nameElt->setValue($fileName);
		$nameElt->setUnit(".zip");
		$nameElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
    	$this->form->addElement($nameElt);

    	$instanceElt = tao_helpers_form_FormFactory::getElement('instances', 'Checkbox');
    	$instanceElt->setDescription(__('Items'));

		if(count($options) > 1){
			$instanceElt->setAttribute('checkAll', true);
		}

		$instanceElt->setOptions(tao_helpers_Uri::encodeArray($options, tao_helpers_Uri::ENCODE_ARRAY_KEYS));
		$instanceElt->setReadOnly(tao_helpers_Uri::encodeArray($disabledOptions, tao_helpers_Uri::ENCODE_ARRAY_KEYS));
    	foreach(array_keys($options) as $value){
			if(!isset($disabledOptions[$value])){
				$instanceElt->setValue($value);
			}
		}
		$this->form->addElement($instanceElt);


    	$this->form->createGroup('options', '<h3>'.$this->getFormGroupName().'</h3>', array('filename', 'instances'));
    }
1216149
protected function getItemOrderOptions($item)
    {
        $result = array();
        if ($options = $item->getProductOptions()) {
            if (isset($options['options'])) {
                $result = array_merge($result, $options['options']);
            }
            if (isset($options['additional_options'])) {
                $result = array_merge($result, $options['additional_options']);
            }
            if (!empty($options['attributes_info'])) {
                $result = array_merge($options['attributes_info'], $result);
            }
        }
        return $result;
    }
71946
public function getItemAlignOptions()
    {
        return [
            self::ITEM_ALIGN_START => _t(__CLASS__ . '.START', 'Start'),
            self::ITEM_ALIGN_CENTER => _t(__CLASS__ . '.CENTER', 'Center'),
            self::ITEM_ALIGN_END => _t(__CLASS__ . '.END', 'End'),
            self::ITEM_ALIGN_BETWEEN => _t(__CLASS__ . '.BETWEEN', 'Between'),
            self::ITEM_ALIGN_AROUND => _t(__CLASS__ . '.AROUND', 'Around')
        ];
    }
1030554
public function cleanOptions($options = [])
    {
        // If item is null or empty we will remove them.
        return collect($options)->reject(function ($item) {
            return empty($item) || is_null($item);
        })->all();
    }
691846
public static function mergeOptions($options1, $options2, $recursive = true)
    {
        if (!$recursive) {
            return array_merge($options1, $options2);
        }

        return Arr::mergeRecursive($options1, $options2);
    }
651153
def convert_items(self, items):
        """"""
        return ((key, self.convert(value, self)) for key, value in items)
779284
def convert_options(opts)
      converted = {}

      opts.each_pair do |name, value|
        if /_/ =~ name
          name = name.to_s.gsub(/_\w/) { |i| i.delete("_").upcase }.to_sym
        end
        value = convert_options(value) if value.is_a? Hash
        converted[name] = value
      end

      converted
    end
1053612
def _merge(self, value):
        
        if not value:
            return []

        if value is not None and not isinstance(value, list):
            # bogus value; will not pass validation but should be preserved
            return value

        item_spec = self._nested_validator
        return [x if x is None else item_spec.get_default_for(x) for x in value]
500240
protected function mergeItems() {
        ksort($this->items);
        $this->mergedItems = array();
        foreach ($this->items as $items) {
            $this->mergedItems = array_merge($this->mergedItems, $items);
        }
        return $this;
    }
828031
function flatten(arr) {
  if (!isArray(arr)) {
    return arr;
  }
  var result = [];
  each(arr, function (item) {
    if (isArray(item)) {
      each(item, function (subItem) {
        result.push(subItem);
      });
    } else {
      result.push(item);
    }
  });
  return result;
}
532943
private function addMultiItem()
    {
        $args = func_get_args();
        $optionKey = array_shift($args);
        $this->items[] = sprintf("%s:%s", $optionKey, implode(',', $args));
        return $this;
    }
467869
public static function filterActiveOptions($data, $options_active, $existing_values = [], $skip_values = []) {
		if (!empty($existing_values) && !is_array($existing_values)) {
			$existing_values = [$existing_values];
		}
		foreach ($data as $k => $v) {
			// existing values
			if (!empty($existing_values) && in_array($k, $existing_values)) {
				continue;
			}
			// skip values
			if (!empty($skip_values) && in_array($k, $skip_values)) {
				unset($data[$k]);
				continue;
			}
			// options active
			if (!empty($options_active)) {
				foreach ($options_active as $k2 => $v2) {
					if (($v[$k2] ?? '') !== $v2) {
						unset($data[$k]);
						break;
					}
				}
			}
		}
		return $data;
	}
1027835
private function getDefaultPluginOptions()
    {
        $options = [
            'namePlaceholder' => $this->getPlaceholderForName(),
            'deleteAlert' => Yii::t('voskobovich/nestedsets',
                'The nobe will be removed together with the children. Are you sure?'),
            'newNodeTitle' => Yii::t('voskobovich/nestedsets', 'Enter the new node name'),
        ];

        $controller = Yii::$app->controller;
        if ($controller) {
            $options['moveUrl'] = Url::to(["{$controller->id}/moveNode"]);
            $options['createUrl'] = Url::to(["{$controller->id}/createNode"]);
            $options['updateUrl'] = Url::to(["{$controller->id}/updateNode"]);
            $options['deleteUrl'] = Url::to(["{$controller->id}/deleteNode"]);
        }

        if ($this->moveUrl) {
            $this->pluginOptions['moveUrl'] = $this->moveUrl;
        }
        if ($this->createUrl) {
            $this->pluginOptions['createUrl'] = $this->createUrl;
        }
        if ($this->updateUrl) {
            $this->pluginOptions['updateUrl'] = $this->updateUrl;
        }
        if ($this->deleteUrl) {
            $this->pluginOptions['deleteUrl'] = $this->deleteUrl;
        }

        return $options;
    }