Transform vector tile tags
@param {object} options
@param {string} options.nameTag
@param {string} options.multiTag
@param {LanguagePicker} [options.namePicker]
@constructor
967076
function PbfSplicer(options) {
  // tag which will be auto-removed and auto-injected. Usually 'name'
  this.nameTag = options.nameTag;
  // tag that contains JSON initially, and which works as a prefix for multiple values
  this.multiTag = options.multiTag;

  // If options.namePicker is given, this class converts multiple language tags into one
  // Otherwise, it assumes that a single name_ tag exists with JSON content, and it will replace
  // it with multiple tags "name_en", "name_fr", ... depending on the JSON language codes
  this.namePicker = options.namePicker;

  // Flag to make requested_name (local_name) form
  this.combineName = options.combineName;
}
248322
function(name, url, options) { 
        OpenLayers.Layer.XYZ.prototype.initialize.apply(this, arguments);

        if (this.resolutions) {        
            this.serverResolutions = this.resolutions;
            this.maxExtent = this.getMaxExtentForResolution(this.resolutions[0]);
        }

        // this block steps through translating the values from the server layer JSON 
        // capabilities object into values that we can use.  This is also a helpful
        // reference when configuring this layer directly.
        if (this.layerInfo) {
            // alias the object
            var info = this.layerInfo;
            
            // build our extents
            var startingTileExtent = new OpenLayers.Bounds(
                info.fullExtent.xmin, 
                info.fullExtent.ymin, 
                info.fullExtent.xmax, 
                info.fullExtent.ymax  
            );

            // set our projection based on the given spatial reference.
            // esri uses slightly different IDs, so this may not be comprehensive
            this.projection = 'EPSG:' + info.spatialReference.wkid;
            this.sphericalMercator = (info.spatialReference.wkid == 102100);
            
            // convert esri units into openlayers units (basic feet or meters only)
            this.units = (info.units == "esriFeet") ? 'ft' : 'm';

            // optional extended section based on whether or not the server returned
            // specific tile information
            if (!!info.tileInfo) {            
                // either set the tiles based on rows/columns, or specific width/height
                this.tileSize = new OpenLayers.Size(
                    info.tileInfo.width || info.tileInfo.cols, 
                    info.tileInfo.height || info.tileInfo.rows
                );
                
                // this must be set when manually configuring this layer
                this.tileOrigin = new OpenLayers.LonLat(
                    info.tileInfo.origin.x, 
                    info.tileInfo.origin.y
                );

                var upperLeft = new OpenLayers.Geometry.Point(
                    startingTileExtent.left, 
                    startingTileExtent.top
                );
                
                var bottomRight = new OpenLayers.Geometry.Point(
                    startingTileExtent.right, 
                    startingTileExtent.bottom
                );            
                
                if (this.useScales) {
                    this.scales = [];
                } else {
                    this.resolutions = [];
                }
                
                this.lods = [];
                for(var key in info.tileInfo.lods) {
                    if (info.tileInfo.lods.hasOwnProperty(key)) {
                        var lod = info.tileInfo.lods[key];
                        if (this.useScales) {
                            this.scales.push(lod.scale);
                        } else {
                            this.resolutions.push(lod.resolution);
                        }
                    
                        var start = this.getContainingTileCoords(upperLeft, lod.resolution);
                        lod.startTileCol = start.x;
                        lod.startTileRow = start.y;
                    
                        var end = this.getContainingTileCoords(bottomRight, lod.resolution);
                        lod.endTileCol = end.x;
                        lod.endTileRow = end.y;    
                        this.lods.push(lod);
                    }
                }

                this.maxExtent = this.calculateMaxExtentWithLOD(this.lods[0]);
                this.serverResolutions = this.resolutions;
                if (this.overrideDPI && info.tileInfo.dpi) {
                    // see comment above for 'overrideDPI'
                    OpenLayers.DOTS_PER_INCH = info.tileInfo.dpi;
                }
            } 
       }
    }
588752
private function createTagPositionFunction($name, array $options)
    {
        $options = array_merge($options, [
            'node_class' => 'Fxp\Component\RequireAsset\Twig\Node\TagPositionFunctionNode',
            'is_safe' => ['html'],
            'category' => null,
            'type' => null,
        ], $options);
        $callable = [$this, 'createTagPosition'];

        $tagPosition = new TwigFunction($name, $callable, $options);
        $tagPosition->setArguments([
            $options['category'],
            $options['type'],
        ]);

        return $tagPosition;
    }
1310707
function overrideTags (parent, child, telegraf) {
  const childCopy = {};
  const toAppend = [];
  formatTags(child, telegraf).forEach(tag => {
    const idx = typeof tag === 'string' ? tag.indexOf(':') : -1;
    if (idx < 1) { // Not found or first character
      toAppend.push(tag);
    } else {
      childCopy[tag.substring(0, idx)] = tag.substring(idx + 1);
    }
  });
  const result = parent.map(tag => {
    const idx = typeof tag === 'string' ? tag.indexOf(':') : -1;
    if (idx < 1) { // Not found or first character
      return tag;
    }
    const key = tag.substring(0, idx);
    if (childCopy.hasOwnProperty(key)) {
      const value = childCopy[key];
      delete childCopy[key];
      return `${key}:${value}`;
    }
    return tag;
  });
  Object.keys(childCopy).forEach(key => {
    result.push(`${key}:${childCopy[key]}`);
  });
  return result.concat(toAppend);
}
527299
function (options) {
            google.maps.Marker.prototype.setMap.apply(this, [options]);
            (this.MarkerLabel) && this.MarkerLabel.setMap.apply(this.MarkerLabel, [options]);
        }
681004
function _getTagsInPlatform(pelem, tag, platform, transform) {
    var platformTag = pelem.find('./platform[@name="' + platform + '"]');
    var tags = platformTag ? platformTag.findall(tag) : [];
    if ( typeof transform === 'function' ) {
        tags = tags.map(transform);
    }
    return tags;
}
1073977
function taggedAs(taggedItem, name, namespace, namespaceEx) {
  var tags = taggedItem.tags || taggedItem.Tags;

  if (!namespace)                                           { return /* undefined */; }
  if (!tags)                                                { return /* undefined */; }

  // The new, improved way (item.namespace=foo && item[name]=value)
  if (tags.namespace === namespace) {
    if (name in tags)                                       { return tags[name]; }
  }

  if (tags[namespace]   && (name in tags[namespace]))       { return tags[namespace][name]; }

  if (!namespaceEx)                                         { return /* undefined */; }
  if (tags[namespaceEx] && (name in tags[namespaceEx]))     { return tags[namespaceEx][name]; }

  return /* undefined */;
}
652714
function() {
            var tpl = this.options.template;

            //first pass
            $.each(this.map, function(k, v) {
                v = v[0]; 
                var r = new RegExp(v+'+'),
                    token = v.length > 1 ? v.substring(1, 2) : v;
                    
                tpl = tpl.replace(r, '{'+token+'}');
            });

            //replace spaces with &nbsp;
            tpl = tpl.replace(/ /g, '&nbsp;');

            //second pass
            $.each(this.map, function(k, v) {
                v = v[0];
                var token = v.length > 1 ? v.substring(1, 2) : v;
                    
                tpl = tpl.replace('{'+token+'}', '<select class="'+k+'"></select>');
            });   

            return tpl;
        }
976454
function(options)
	{
		options = options || {};

		this._modelBindersMap = null;
		this._collectionBinder = null;
		this._bindingIndex = null;
		this._itemAlias = null;

		this._subviewsStruct = null;
		this._explicitSubviewsStruct = null;
		this._pendingRefresh = false;
		this._pendingRefreshRoot = false;
		this._subviewsArgs = null;
		this._isRunning = false;
		this._isSuspended = false;
		this._template = null;
		this._isolated = false;
		this.subviews = null;

		if(options.isolated)
		{
			this._isolated = true;
		}

		if(options.parentView)
		{
			this.scope = options.scope || null;
			this._setParentView(options.parentView);
		}
		else if(options.scope) this.scope = mixin({}, options.scope);
		else this.scope = {};

		options.scope = null;

		if(options.events)
		{
			this.domEvents = options.events.slice();
		}
		else this.domEvents = [];

		if(options.dispatcher)
		{
			this.dispatcher = options.dispatcher;
		}
		else this.dispatcher = null;

		if(options.actions)
		{
			this.actions = mixin({
				set: actionSet
			}, options.actions);
		}
		else if((this.parentView == null || this._isolated )&& !options._clone)
		{
			this.actions = {
				set: actionSet
			};
		}
		else this.actions = null;

		if(options.env)
		{
			this.env = options.env;
		}
		else this.env = { document: document, window: window };

		if(options.element)
		{
			this.element = options.element
			options.element = null;
		}
		else this.element = this.env.document.body;

		this.options = options;
	}
1038875
function moveChildTag(tag, tagName, newPos) {
  var parent = tag.parent,
    tags
  // no parent no move
  if (!parent) return

  tags = parent.tags[tagName]

  if (isArray(tags))
    tags.splice(newPos, 0, tags.splice(tags.indexOf(tag), 1)[0])
  else addChildTag(tag, tagName, parent)
}
158326
function(options) {
    var pattern = orthographyMatchers[options.language];
    if (!pattern) {
        WordTokenizer.call(this, options);
    } else {
        this._pattern = pattern;
        RegexpTokenizer.call(this, options);
    }
}
236827
function parse(tag, options) {
  var settings = options || {}
  var warning = settings.warning
  var forgiving = settings.forgiving
  var normalize = settings.normalize
  var result = {}
  var sensitive
  var code
  var index
  var count
  var groupCount
  var offset

  /* Check input. */
  if (tag === null || tag === undefined) {
    throw new Error('Expected string, got `' + tag + '`')
  }

  normalize = normalize === null || normalize === undefined ? true : normalize

  /* Let’s start. */
  result = empty()
  tag = String(tag)
  sensitive = tag
  tag = tag.toLowerCase()

  if (own.call(normal, tag)) {
    if (normalize && normal[tag]) {
      return parse(normal[tag])
    }

    result[regular.indexOf(tag) === -1 ? 'irregular' : 'regular'] = sensitive

    return result
  }

  index = 0
  code = char(index)

  while (alphabetical(code)) {
    index++
    code = char(index)
  }

  /* Parse a normal tag. */
  if (index < MIN_ISO_639 || index > MAX_SUBTAG) {
    index = 0
  } else {
    if (index > MAX_RESERVED) {
      /* Subtag language. */
      result.language = sensitive.slice(0, index)
    } else if (index > MAX_ISO_639) {
      /* Reserved language. */
      result.language = sensitive.slice(0, index)
    } else {
      groupCount = 0

      /* ISO 639 language. */
      result.language = sensitive.slice(0, index)

      while (
        dash(char(index)) &&
        alphabetical(char(index + 1)) &&
        alphabetical(char(index + 2)) &&
        alphabetical(char(index + 3)) &&
        !alphabetical(char(index + 4))
      ) {
        if (groupCount >= MAX_EXTENDED_LANGUAGE_SUBTAG_COUNT) {
          return fail(index, ERR_TOO_MANY_SUBTAGS)
        }

        /* Extended language subtag. */
        result.extendedLanguageSubtags.push(
          sensitive.slice(index + 1, index + 4)
        )

        index += 4
        groupCount++
      }
    }

    if (
      dash(char(index)) &&
      alphabetical(char(index + 1)) &&
      alphabetical(char(index + 2)) &&
      alphabetical(char(index + 3)) &&
      alphabetical(char(index + 4)) &&
      !alphabetical(char(index + 5))
    ) {
      /* ISO 15924 script. */
      result.script = sensitive.slice(index + 1, index + 5)

      index += 5
    }

    if (dash(char(index))) {
      if (
        alphabetical(char(index + 1)) &&
        alphabetical(char(index + 2)) &&
        !alphabetical(char(index + 3))
      ) {
        /* ISO 3166-1 region. */
        result.region = sensitive.slice(index + 1, index + 3)
        index += 3
      } else if (
        decimal(char(index + 1)) &&
        decimal(char(index + 2)) &&
        decimal(char(index + 3)) &&
        !decimal(char(index + 4))
      ) {
        /* UN M49 region. */
        result.region = sensitive.slice(index + 1, index + 4)
        index += 4
      }
    }

    while (dash(char(index))) {
      offset = index + 1
      count = 0

      while (alphanumeric(char(offset))) {
        offset++
        count++

        if (count > MAX_VARIANT) {
          return fail(offset, ERR_VARIANT_TOO_LONG)
        }
      }

      if (count >= MIN_ALPHANUMERIC_VARIANT) {
        /* Long variant. */
        result.variants.push(sensitive.slice(index + 1, offset))
        index = offset
      } else if (decimal(char(index + 1)) && count >= MIN_VARIANT) {
        /* Short variant. */
        result.variants.push(sensitive.slice(index + 1, offset))
        index = offset
      } else {
        break
      }
    }

    while (dash(char(index))) {
      if (
        x(char(index + 1)) ||
        !alphanumeric(char(index + 1)) ||
        !dash(char(index + 2)) ||
        !alphanumeric(char(index + 3))
      ) {
        break
      }

      offset = index + 2
      groupCount = 0

      while (
        dash(char(offset)) &&
        alphanumeric(char(offset + 1)) &&
        alphanumeric(char(offset + 2))
      ) {
        offset += 2
        count = 2
        groupCount++

        while (alphanumeric(char(offset))) {
          if (count > MAX_EXTENSION) {
            return fail(offset, ERR_EXTENSION_TOO_LONG)
          }

          offset++
          count++
        }
      }

      if (!groupCount) {
        return fail(offset, ERR_EMPTY_EXTENSION)
      }

      /* Extension. */
      result.extensions.push({
        singleton: sensitive.charAt(index + 1),
        extensions: sensitive.slice(index + 3, offset).split('-')
      })

      index = offset
    }
  }

  if (
    (index === 0 && x(char(0))) ||
    (index !== 1 && dash(char(index)) && x(char(index + 1)))
  ) {
    index = index ? index + 2 : 1
    offset = index

    while (dash(char(offset)) && alphanumeric(char(offset + 1))) {
      offset += 2
      count = 1

      while (alphanumeric(char(offset))) {
        if (count >= MAX_PRIVATE_USE) {
          return fail(offset, ERR_PRIVATE_USE_TOO_LONG)
        }

        offset++
        count++
      }

      result.privateuse.push(sensitive.slice(index + 1, offset))
      index = offset
    }
  }

  if (index !== tag.length) {
    return fail(index, ERR_EXTRA_CONTENT)
  }

  return result

  function char(pos) {
    return tag.charCodeAt(pos)
  }

  function fail(offset, code) {
    if (warning) {
      warning(ERRORS[code], code, offset)
    }

    return forgiving ? result : empty()
  }
}
5397
public static function widget(Tag $tag, $name, $options = array()) {
    //$tag->addClass('\Psc\jquery-widget');
    
    $js = sprintf("%s(%s)",
                  $name, JSHelper::convertHashMap((object) $options)
                  );
    
    $tag->chain(new Code($js));
    
    return $tag;
  }
427494
function createDelimiterRegex(options) {
  const opts = Object.assign({}, options);
  let tagname = options.tagname;
  let layoutDelims = options.delims || options.layoutDelims || `{% (${tagname}) %}`;
  let key = tagname;

  if (layoutDelims) key += layoutDelims.toString();
  if (layouts.memo.has(key)) {
    return layouts.memo.get(key);
  }

  if (layoutDelims instanceof RegExp) {
    layouts.memo.set(key, layoutDelims);
    return layoutDelims;
  }

  if (Array.isArray(layoutDelims)) {
    layoutDelims = `${opts.layoutDelims[0]} (${tagname}) ${opts.layoutDelims[1]}`;
  }

  if (typeof layoutDelims !== 'string') {
    throw new TypeError('expected options.layoutDelims to be a string, array or regex');
  }

  const regex = new RegExp(layoutDelims, 'g');
  layouts.memo.set(key, regex);
  return regex;
}
288555
function(name, optionData, multipleSelect) {
    const optionInputType = {
      selected: multipleSelect ? 'checkbox' : 'radio',
    }
    const optionDataOrder = ['value', 'label', 'selected']
    const optionInputs = []
    const optionTemplate = { selected: false, label: '', value: '' }

    optionData = Object.assign(optionTemplate, optionData)

    for (let i = optionDataOrder.length - 1; i >= 0; i--) {
      const prop = optionDataOrder[i]
      if (optionData.hasOwnProperty(prop)) {
        const attrs = {
          type: optionInputType[prop] || 'text',
          className: 'option-' + prop,
          value: optionData[prop],
          name: name + '-option',
        }

        attrs.placeholder = mi18n.get(`placeholder.${prop}`) || ''

        if (prop === 'selected' && optionData.selected === true) {
          attrs.checked = optionData.selected
        }

        optionInputs.push(m('input', null, attrs))
      }
    }

    const removeAttrs = {
      className: 'remove btn icon-cancel',
      title: mi18n.get('removeMessage'),
    }
    optionInputs.push(m('a', null, removeAttrs))

    return m('li', optionInputs).outerHTML
  }
19563
function tagName(tag, options) {
  if (tag == null || tag === '') {
    tag = options.defaultTag || 'Api';
  }
  tag = toIdentifier(tag);
  return tag.charAt(0).toUpperCase() + (tag.length == 1 ? '' : tag.substr(1));
}
308785
function TagsInput(element, options) {
    this.itemsArray = [];

    this.$element = $(element);
    this.$element.hide();

    this.isSelect = (element.tagName === 'SELECT');
    this.multiple = (this.isSelect && element.hasAttribute('multiple'));
    this.objectItems = options && options.itemValue;
    this.placeholderText = element.hasAttribute('placeholder') ? this.$element.attr('placeholder') : '';
    this.inputSize = Math.max(1, this.placeholderText.length);

    this.$container = $('<div class="bootstrap-tagsinput"></div>');
    this.$input = $('<input type="text" placeholder="' + this.placeholderText + '"/>').appendTo(this.$container);

    this.$element.after(this.$container);

    var inputWidth = (this.inputSize < 3 ? 3 : this.inputSize) + "em";
    this.$input.get(0).style.cssText = "width: " + inputWidth + " !important;";
    this.build(options);
  }