TODO, make this a proxy once that hits standards so that .R/.G/.B can proxy through to the storage array TODO types: string of #FFF/#FFFFFF
348236
function Pixel(fakeArgs) {
  var i;
  var args = slice(arguments);
  this.channels = [];
  if(args.length == 1 && is.instance(args[0], Pixel)) {
    this.channels = slice(args[0].channels);
  } else if(args.length == 1 && Buffer.isBuffer(args[0])) {
    for(i=0;i<args[0].length;i++) {
      this.channels.push(args[0][i]);
    }
  } else if((args.length == 1 || args.length == 3 || args.length == 4) && is.number(args[0])) {
    for(i=0;i<args.length;i++) {
      if(!is.number(args[i])) throw new TypeError("Invalid argument type. Expected all to be numbers.");
      this.channels.push(args[i]);
    }
  } else if(args.length == 1 && is.array(args[0])) {
    this.channels = slice(args[0]);
  } else {
    console.log(args);
    throw new TypeError("Argument type unsupported for now");
  }
  if(this.channels.length == 3) this.type = TYPES.RGB;
  if(this.channels.length == 4) this.type = TYPES.RGBA;
  if(this.channels.length == 1) this.type = TYPES.GRAYSCALE;

}
894911
function _gpfLoadSources () { //jshint ignore:line
    var sourceListContent = _gpfSyncReadForBoot(gpfSourcesPath + "sources.json"),
        _gpfSources = _GpfFunc("return " + sourceListContent)(),
        allContent = [],
        idx = 0;
    for (; idx < _gpfSources.length; ++idx) {
        _gpfProcessSource(_gpfSources[idx], allContent);
    }
    return allContent.join("\n");
}
1323006
function () {
    debug('invoking proxy function');

    if (arguments.length !== numArgs) {
      throw new TypeError('Expected ' + numArgs +
          ' arguments, got ' + arguments.length);
    }

    // storage buffers for input arguments and the return value
    const result = Buffer.alloc(resultSize);
    const argsList = Buffer.alloc(argsArraySize);

    // write arguments to storage areas
    let i;
    try {
      for (i = 0; i < numArgs; i++) {
        const argType = argTypes[i];
        const val = arguments[i];
        const valPtr = ref.alloc(argType, val);
        argsList.writePointer(valPtr, i * POINTER_SIZE);
      }
    } catch (e) {
      // counting arguments from 1 is more human readable
      i++;
      e.message = 'error setting argument ' + i + ' - ' + e.message;
      throw e;
    }

    // invoke the `ffi_call()` function
    bindings.ffi_call(cif, funcPtr, result, argsList);

    result.type = returnType;
    return result.deref();
  }
73075
function parse_PtgAttrIf(blob, length, opts) {
	var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0;
	blob.l += 2;
	return [bitIf, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)];
}
995439
function proxy()
    {
        if (!UserRights(EDITOR))
            die;

        $filename = Eresus_CMS::getLegacyKernel()->request['path'] .
            Eresus_CMS::getLegacyKernel()->request['file'];
        $filename = Eresus_CMS::getLegacyKernel()->froot . substr($filename,
                strlen(Eresus_CMS::getLegacyKernel()->root));

        if (is_dir($filename))
        {
            $filename = Eresus_FS_Tool::normalize($filename . '/index.php');
        }

        if (!is_file($filename))
        {
            header('Not found', true, 404);
            die('<h1>Not found.</h1>');
        }

        $ext = strtolower(substr($filename, strrpos($filename, '.') + 1));

        switch (true)
        {
            case in_array($ext, array('png', 'jpg', 'jpeg', 'gif')):
                $info = getimagesize($filename);
                header('Content-type: '.$info['mime']);
                echo file_get_contents($filename);
                break;

            case $ext == 'js':
                header('Content-type: text/javascript');
                $s = file_get_contents($filename);
                $s = $this->replaceMacros($s);
                echo $s;
                break;

            case $ext == 'css':
                header('Content-type: text/css');
                $s = file_get_contents($filename);
                $s = $this->replaceMacros($s);
                echo $s;
                break;

            case $ext == 'html':
            case $ext == 'htm':
                header('Content-type: text/html');
                $s = file_get_contents($filename);
                $s = $this->replaceMacros($s);
                echo $s;
                break;

            case $ext == 'php':
                Eresus_CMS::getLegacyKernel()->conf['debug']['enable'] = false;
                restore_error_handler();
                chdir(dirname($filename));
                require $filename;
                break;
        }
    }
513069
function _gpfGetMimeType (fileExtension) {
    var mimeType = _gpfMimeTypesFromExtension[fileExtension.toLowerCase()];
    if (undefined === mimeType) {
        // Default
        mimeType = "application/octet-stream";
    }
    return mimeType;
}
80514
function parse_PtgAttrIfError(blob) {
	var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0;
	blob.l += 2;
	return [bitIf, blob.read_shift(2)];
}
1044220
async def call_with_fd_list(proxy, method_name, signature, args, fds,
                            flags=0, timeout_msec=-1):
    
    future = Future()
    cancellable = None
    fd_list = Gio.UnixFDList.new_from_array(fds)
    proxy.call_with_unix_fd_list(
        method_name,
        GLib.Variant(signature, tuple(args)),
        flags,
        timeout_msec,
        fd_list,
        cancellable,
        gio_callback,
        future,
    )
    result = await future
    value, fds = proxy.call_with_unix_fd_list_finish(result)
    return pack(*unpack_variant(value))
455562
function(p) {

				// The proxy supports allow-cross-origin-resource
				// Alas that's the only thing we're using.
				if (p.data && p.data.file) {
					var file = p.data.file;
					if (file) {
						if (file.files) {
							p.data = file.files[0];
						}
						else {
							p.data = file;
						}
					}
				}

				if (p.method === 'delete') {
					p.method = 'post';
				}

				return true;
			}
606107
def url2fs(url):
    
    uri, extension = posixpath.splitext(url)
    return safe64.dir(uri) + extension
14535
function parse_PtgAttrChoose(blob, length, opts)/*:Array<number>*/ {
	blob.l +=2;
	var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2);
	var o/*:Array<number>*/ = [];
	/* offset is 1 less than the number of elements */
	for(var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2));
	return o;
}
356569
function getLayerDefsString_(defs) {
  var strDefs = '';
  for (var x in defs) {
    if (defs.hasOwnProperty(x)) {
      if (strDefs.length > 0) {
        strDefs += ';';
      }
      strDefs += (x + ':' + defs[x]);
    }
  }
  return strDefs;
}
1157294
function proxyLogRewrite(daArgs) {
  const args = Array.prototype.slice.call(daArgs);

  return args.map(arg => {
    if (typeof arg === 'string') {
      return arg.replace(/\[HPM\] /g, '').replace(/ {2}/g, ' ');
    }

    return arg;
  });
}
1273071
function _safeSetDataURI(fSuccess, fFail) {
            var self = this;
            self._fFail = fFail;
            self._fSuccess = fSuccess;

            // Check it just once
            if (self._bSupportDataURI === null) {
                var el = document.createElement("img");
                var fOnError = function() {
                    self._bSupportDataURI = false;

                    if (self._fFail) {
                        self._fFail.call(self);
                    }
                };
                var fOnSuccess = function() {
                    self._bSupportDataURI = true;

                    if (self._fSuccess) {
                        self._fSuccess.call(self);
                    }
                };

                el.onabort = fOnError;
                el.onerror = fOnError;
                el.onload = fOnSuccess;
                el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
                return;
            } else if (self._bSupportDataURI === true && self._fSuccess) {
                self._fSuccess.call(self);
            } else if (self._bSupportDataURI === false && self._fFail) {
                self._fFail.call(self);
            }
		}
1019763
function parse(fileString, callback) {
	return NginxConf.parse(fileString, function(err, _config) {
		if (err) {
			return callback(err);
		}

		return parseNginxConf(_config, callback);
	});
}
1223361
function createRGBProxy(raw = false) {
    function get(me, key) {
        switch (key) {
            case "color": {
                if (typeof me.color === "string" && rgbRegex.test(me.color)) {
                    // predefined color, return it
                    return me.color;
                }
                else {
                    // calculate it from hue/saturation
                    const { r, g, b } = conversions_1.conversions.rgbFromHSV(me.hue, me.saturation / 100, 1);
                    return conversions_1.conversions.rgbToString(r, g, b);
                }
            }
            default: return me[key];
        }
    }
    function set(me, key, value) {
        switch (key) {
            case "color": {
                if (predefined_colors_1.predefinedColors.has(value)) {
                    // its a predefined color, use the predefined values
                    const definition = predefined_colors_1.predefinedColors.get(value); // we checked with `has`
                    if (raw) {
                        me.hue = definition.hue_raw;
                        me.saturation = definition.saturation_raw;
                    }
                    else {
                        me.hue = definition.hue;
                        me.saturation = definition.saturation;
                    }
                }
                else {
                    // only accept HEX colors
                    if (rgbRegex.test(value)) {
                        // calculate the X/Y values
                        const { r, g, b } = conversions_1.conversions.rgbFromString(value);
                        const { h, s /* ignore v */ } = conversions_1.conversions.rgbToHSV(r, g, b);
                        if (raw) {
                            me.hue = Math.round(h / 360 * predefined_colors_1.MAX_COLOR);
                            me.saturation = Math.round(s * predefined_colors_1.MAX_COLOR);
                        }
                        else {
                            me.hue = h;
                            me.saturation = s * 100;
                        }
                    }
                }
                break;
            }
            default: me[key] = value;
        }
        return true;
    }
    return { get, set };
}
1123509
function TF(key) {
  this.tf = createTwofish();
  this.tf.open(Array.from(key), 0);

  this.encrypt = function(block) {
    return this.tf.encrypt(Array.from(block), 0);
  };
}