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EACR,OAAQ,EACR,OAAQ,GACN,GAAW,CAAC,EACZ,EAAe,GAEnB,GAAI,MAAM,QAAQ,IAAY,EAAQ,OAAM,GAAiB,iBAAL,IACtD,GAAgB,EAAQ,KAAK,SACxB,GAAsB,iBAAX,EAChB,EAAe,MACV,KAAI,CAAC,EAAU,EAAU,GAAU,MAAK,GAAK,IAGlD,MAAM,IAAI,MAAM,qBAAqB,KAAK,UAAU,MAFpD,GAAgB,OAAO,EAAU,GAAU,OAAO,EAAU,GAAU,OAAO,EAAU,EAGzF,CAGA,IAAI,EAAQ,sBAAsB,EAAe,GASjD,OARA,EAAM,sBAAwB,oBAAoB,EAAO,iBACzD,EAAe,QAAI,MACnB,EAAe,QAAI,YAAY,KAAK,GAAW,IAAM,EAAU,QA7BrC,CAAC,UAAW,SAAU,gBAAiB,UA8B/C,SAAQ,IACpB,EAAO,KACT,EAAM,GAAS,EAAO,GACxB,IAEK,IAAI,cAAe,EAAO,EACnC,CAEA,QAAQ,OAAS,OACjB,QAAQ,OAAS,OACjB,QAAQ,OAAS,OACjB,QAAQ,QAAU,QAClB,QAAQ,YAAc","file":"/npm/geojson-to-wfs-t-2@1.5.2/dist/es6.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/geojson-to-wfs-t-2@1.5.2/dist/es6.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/* eslint-disable no-console */\n/**\n * reorder coordinates to lat, lng iff config.coordinateOrder is false.\n * @param  {Number[]} coords An array of coordinates,  [lng, lat, ...etc]\n * @return {Number[]} An array of coordinates in the correct order.\n */\n\nfunction orderCoords(coords) {\n  {\n    return coords;\n  }\n\n  if (coords[2]) {\n    return [coords[1], coords[0], coords[2]];\n  }\n\n  return coords.reverse();\n}\n/** @private*/\n\n\nfunction attrs(attrMappings) {\n  // return Object.entries()\n  let results = '';\n\n  for (let attrName in attrMappings) {\n    let value = attrMappings[attrName];\n    results += value ? ` ${attrName}=\"${value}\"` : '';\n  }\n\n  return results;\n}\n/**\n * Optional parameters for conversion of geojson to gml geometries\n * @typedef {Object} Params\n * @property {?String} params.srsName as string specifying SRS, e.g. 'EPSG:4326'. Only applies to multigeometries.\n * @property {?Number[]|?String[]} params.gmlIds an array of number/string gml:ids of the member geometries.\n * @property {?Number|?String} params.srsDimension the dimensionality of each coordinate, i.e. 2 or 3.\n */\n\n/**\n * A handler to compile geometries to multigeometries\n * @function\n * @param {String} name the name of the target multigeometry\n * @param {String} memberName the gml:tag of each multigeometry member.\n * @param {Object[]|Array} geom an array of geojson geometries\n * @param {String|Number} gmlId the gml:id of the multigeometry\n * @param {Params} params optional parameters. Omit gmlIds at your own risk, however.\n * @returns {String} a string containing gml describing the input multigeometry\n * @throws {Error} if a member geometry cannot be converted to gml\n */\n\n\nfunction multi(name, memberName, membercb, geom, gmlId, params = {}) {\n  var {\n    srsName,\n    gmlIds\n  } = params;\n  let multi = `<gml:${name}${attrs({\n    srsName,\n    'gml:id': gmlId\n  })}>`;\n  multi += `<gml:${memberName}>`;\n  geom.forEach(function (member, i) {\n    let _gmlId = member.id || (gmlIds || [])[i] || '';\n\n    if (name == 'MultiGeometry') {\n      let memberType = member.type;\n      member = member.coordinates;\n      multi += membercb[memberType](member, _gmlId, params);\n    } else {\n      multi += membercb(member, _gmlId, params);\n    }\n  });\n  multi += `</gml:${memberName}>`;\n  return multi + `</gml:${name}>`;\n}\n/**\n * Converts an input geojson Point geometry to gml\n * @function\n * @param {Number[]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\n\nfunction point(coords, gmlId, params = {}) {\n  var {\n    srsName: srsName,\n    srsDimension: srsDimension\n  } = params;\n  return `<gml:Point${attrs({\n    srsName: srsName,\n    'gml:id': gmlId\n  })}>` + `<gml:pos${attrs({\n    srsDimension\n  })}>` + orderCoords(coords).join(' ') + '</gml:pos>' + '</gml:Point>';\n}\n/**\n * Converts an input geojson LineString geometry to gml\n * @function\n * @param {Number[][]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction lineString(coords, gmlId, params = {}) {\n  var {\n    srsName: srsName,\n    srsDimension: srsDimension\n  } = params;\n  return `<gml:LineString${attrs({\n    srsName,\n    'gml:id': gmlId\n  })}>` + `<gml:posList${attrs({\n    srsDimension\n  })}>` + coords.map(e => orderCoords(e).join(' ')).join(' ') + '</gml:posList>' + '</gml:LineString>';\n}\n/**\n * Converts an input geojson LinearRing member of a polygon geometry to gml\n * @function\n * @param {Number[][]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction linearRing(coords, gmlId, params = {}) {\n  var {\n    srsName: srsName,\n    srsDimension: srsDimension\n  } = params;\n  return `<gml:LinearRing${attrs({\n    'gml:id': gmlId,\n    srsName\n  })}>` + `<gml:posList${attrs({\n    srsDimension\n  })}>` + coords.map(e => orderCoords(e).join(' ')).join(' ') + '</gml:posList>' + '</gml:LinearRing>';\n}\n/**\n * Converts an input geojson Polygon geometry to gml\n * @function\n * @param {Number[][][]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction polygon(coords, gmlId, params = {}) {\n  // geom.coordinates are arrays of LinearRings\n  var {\n    srsName\n  } = params;\n  let polygon = `<gml:Polygon${attrs({\n    srsName,\n    'gml:id': gmlId\n  })}>` + '<gml:exterior>' + linearRing(coords[0]) + '</gml:exterior>';\n\n  if (coords.length >= 2) {\n    for (let ring of coords.slice(1)) {\n      polygon += '<gml:interior>' + linearRing(ring) + '</gml:interior>';\n    }\n  }\n\n  polygon += '</gml:Polygon>';\n  return polygon;\n}\n/**\n * Converts an input geojson MultiPoint geometry to gml\n * @function\n * @param {Number[][]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction multiPoint(coords, gmlId, params = {}) {\n  return multi('MultiPoint', 'pointMembers', point, coords, gmlId, params);\n}\n/**\n * Converts an input geojson MultiLineString geometry to gml\n * @function\n * @param {Number[][][]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction multiLineString(coords, gmlId, params = {}) {\n  return multi('MultiCurve', 'curveMembers', lineString, coords, gmlId, params);\n}\n/**\n * Converts an input geojson MultiPolygon geometry to gml\n * @function\n * @param {Number[][][][]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Params} params optional parameters\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction multiPolygon(coords, gmlId, params = {}) {\n  return multi('MultiSurface', 'surfaceMembers', polygon, coords, gmlId, params);\n}\n/**\n * A helper to de-camelcase this module's geometry conversion methods\n * @param  {Object} obj a mapping of camelcase geometry types to converter functions\n * @return {Object} a mapping of capitalized geometry types to converter functions\n * @example\n * makeConverter({lineString})\n * // returns {LineString: lineString}\n */\n\nfunction makeConverter(obj) {\n  return Object.entries(obj).map(([type, converter]) => {\n    return {\n      [type[0].toUpperCase() + type.slice(1)]: converter\n    };\n  }).reduce((a, b) => Object.assign(a, b), {});\n}\n/**\n* A helper to map geometry types to converter functions.\n* @function\n* @param {Object} obj an object mapping camelcase-d geometry type names to\n* converter functions for that type.\n* @example\n* import {point, lineString} from 'geojson-to-gml-3';\n* const geomToGml = makeTranslator({point, lineString});\n* geomToGml({type: 'Point', coordinates: [0, 0]});\n*/\n\n\nfunction makeTranslator(obj) {\n  const converter = makeConverter(obj);\n  return function (geom, gmlId, params) {\n    const warn = () => new Error(`unkown: ${geom.type} ` + [...arguments].join());\n\n    const convert = converter[geom.type] || warn;\n    return convert(geom.coordinates || geom.geometries, gmlId, params);\n  };\n}\n/**\n * a namespace to switch between geojson-handling functions by geojson.type\n * @const\n * @type {Object}\n */\n\nconst allTypes = makeConverter({\n  point,\n  lineString,\n  linearRing,\n  polygon,\n  multiPoint,\n  multiLineString,\n  multiPolygon\n});\n/**\n * Converts an input geojson GeometryCollection geometry to gml\n * @function\n * @param {Object[]} coords the coordinates member of the geojson geometry\n * @param {String|Number} gmlId the gml:id\n * @param {Object} params optional parameters\n * @param {?String} params.srsName as string specifying SRS\n * @param {?Number|?String} params.srsDimension the dimensionality of each coordinate, i.e. 2 or 3.\n * @returns {String} a string containing gml representing the input geometry\n */\n\nfunction geometryCollection(geoms, gmlId, params = {}) {\n  return multi('MultiGeometry', 'geometryMembers', allTypes, geoms, gmlId, params);\n}\n/**\n * Translates any geojson geometry into GML 3.2.1\n * @public\n * @function\n * @param {Object} geom a geojson geometry object\n * @param {?Array} geom.coordinates the nested array of coordinates forming the geometry\n * @param {?Object[]} geom.geometries for a GeometryCollection only, the array of member geometry objects\n * @param {String|Number} gmlId the gml:id of the geometry\n * @param {object} params optional parameters\n * @param {?String} params.srsName a string specifying the SRS\n * @param {?String} params.srsDimension the dimensionality of each coordinate, i.e. 2 or 3.\n * @param {?Number[]|?String[]} gmlIds  an array of number/string gml:ids of the member geometries of a multigeometry.\n * @returns {String} a valid gml string describing the input geojson geometry\n */\n\nconst geomToGml = makeTranslator(Object.assign({\n  geometryCollection\n}, allTypes));\n\n/**\n * common checks, coersions, and informative errors/ warnings\n * @module ensure\n */\n\n/**\n * Ensures the result is an array.\n * @private\n * @function\n * @param {Feature|Feature[]|FeatureCollection} maybe a GeoJSON\n * FeatureCollection, Feature, or an array of Features.\n * @return {Feature[]}\n */\nconst array = (...maybe) => (maybe[0].features || [].concat(...maybe)).filter(Boolean);\n/**\n * Ensures a layer.id format of an input id.\n * @function\n * @param {String} lyr layer name\n * @param {String} id id, possibly already in correct layer.id format.\n * @return {String} a correctly-formatted gml:id\n */\n\nconst id = (lyr, id) => /\\./.exec(id || '') ? id : `${lyr}.${id}`;\n/**\n * return a correctly-formatted typeName\n * @function\n * @param {String} ns namespace\n * @param {String} layer layer name\n * @param {String} typeName typeName to check\n * @return {String} a correctly-formatted typeName\n * @throws {Error} if typeName it cannot form a typeName from ns and layer\n */\n\nconst typeName = (ns, layer, typeName) => {\n  if (!typeName && !(ns && layer)) {\n    throw new Error(`no typename possible: ${JSON.stringify({\n      typeName,\n      ns,\n      layer\n    }, null, 2)}`);\n  }\n\n  return typeName || `${layer}`;\n}; // http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#286\n\n/**\n * xml utilities.\n * @module xml\n */\n\n/**\n * Turns an object into a string of xml attribute key-value pairs.\n * @function\n * @param {Object} attrs an object mapping attribute names to attribute values\n * @return {String} a string of xml attribute key-value pairs\n */\n\nfunction attrs$1(attrs) {\n  return Object.keys(attrs).map(a => attrs[a] ? ` ${a}=\"${escape(attrs[a])}\"` : '').join('');\n}\n/**\n * Creates a string xml tag.\n * @function\n * @param {String} ns the tag's xml namespace abbreviation.\n * @param {String} tagName the tag name.\n * @param {Object} attrsObj @see xml.attrs.\n * @param {String} inner inner xml.\n * @return {String} an xml string.\n */\n\nfunction tag(ns, tagName, attrsObj, inner) {\n  let tag = (ns ? `${ns}:` : '') + tagName;\n\n  if (tagName) {\n    return `<${tag}${attrs$1(attrsObj)}${inner !== null ? `>${inner}</${tag}` : ' /'}>`;\n  } else {\n    throw new Error('no tag supplied ' + JSON.stringify({\n      ns,\n      tagName,\n      attrsObj,\n      inner\n    }, null, 2));\n  }\n}\n/**\n * Shorthand for creating a wfs xml tag.\n * @param {String} tagName a valid wfs tag name.\n * @param {Object} attrsObj @see xml.attrs.\n * @param {String} inner @see xml.tag.\n * @return {String} a wfs element.\n */\n\nconst wfs = (tagName, attrsObj, inner) => tag('wfs', tagName, attrsObj, inner);\n/**\n * Creates a fes:ResourceId filter from a layername and id\n * @function\n * @param {String} lyr layer name of the filtered feature\n * @param {String} id feature id\n * @return {String} a filter-ecoding of the filter.\n */\n\nconst idFilter = (lyr, id$$1) => {\n  return `<fes:ResourceId rid=\"${id(lyr, id$$1)}\"/>`;\n};\n/**\n * Creates an xml-safe string from a given input string\n * @function\n * @param {String} input String to escape\n * @return {String} XML-safe string\n */\n\nfunction escape(input) {\n  if (typeof input !== 'string') {\n    // Backup check for non-strings\n    return input;\n  }\n\n  const output = input.replace(/[<>&'\"]/g, char => {\n    switch (char) {\n      case '<':\n        return '&lt;';\n\n      case '>':\n        return '&gt;';\n\n      case '&':\n        return '&amp;';\n\n      case `'`:\n        return '&apos;';\n\n      case '\"':\n        return '&quot;';\n    }\n  });\n  return output;\n}\n\n/* eslint-disable camelcase */\n\n/**\n * Common utilities for handling parameters for creation of WFS trasactions.\n * @module utils\n */\n\n/**\n * Iterates over the key-value pairs, filtering by a whitelist if available.\n * @function\n * @param {Array<String>} whitelist a whitelist of property names\n * @param {Object} properties an object mapping property names to values\n * @param {Function} cb a function to call on each (whitelisted key, value) pair\n */\n\nconst useWhitelistIfAvailable = (whitelist, properties, cb) => {\n  for (let prop of whitelist || Object.keys(properties)) {\n    const val = properties[prop];\n\n    if (Number.isNaN(val)) {\n      throw new Error('NaN is not allowed.');\n    }\n\n    if (val !== undefined) {\n      cb(prop, val);\n    }\n  }\n};\nconst featureMembers = new Set(['properties', 'geometry', 'id', 'layer']);\n/**\n* Resolves attributes from feature, then params unless they are normally\n* found in the feature\n* @param {Object} feature a geojson feature\n* @param {Object} params an object of backup / override parameters\n* @param {Array<String>} args parameter names to resolve from feature or\n* params\n* @return {Object} an object mapping each named parameter to its resolved\n* value\n*/\n\nfunction unpack(feature, params, ...args) {\n  let results = {};\n\n  for (let arg of args) {\n    if (arg === 'layer') {\n      results[arg] = (params.layer || {}).id || params.layer || (feature.layer || {}).id || feature.layer || '';\n    } else if (!featureMembers.has(arg)) {\n      results[arg] = feature[arg] || params[arg] || '';\n    } else {\n      results[arg] = params[arg] || feature[arg] || '';\n    }\n  }\n\n  return results;\n}\n/**\n * Generates an object to be passed to @see xml.attrs xmlns:ns=\"uri\" definitions\n * for a wfs:Transaction\n * @param {Object} nsAssignments @see Params.nsAssignments\n * @param {String} xml arbitrary xml.\n * @return {Object} an object mapping each ns to its URI as 'xmlns:ns' : 'URI'.\n * @throws {Error} if any namespace used within `xml` is missing a URI\n * definition\n */\n\nfunction generateNsAssignments(nsAssignments, xml) {\n  let attrs = {};\n\n  const makeNsAssignment = (ns, uri) => attrs[`xmlns:${ns}`] = uri;\n\n  Object.keys(nsAssignments).forEach(ns => {\n    makeNsAssignment(ns, nsAssignments[ns]);\n  }); // check all ns's assigned\n\n  let re = /(<|typeName=\")(\\w+):/g;\n  let arr;\n  let allNamespaces = new Set();\n\n  while ((arr = re.exec(xml)) !== null) {\n    allNamespaces.add(arr[2]);\n  }\n\n  if (allNamespaces.has('fes')) {\n    makeNsAssignment('fes', 'http://www.opengis.net/fes/2.0');\n  }\n  makeNsAssignment('xsi', 'http://www.w3.org/2001/XMLSchema-instance');\n  makeNsAssignment('gml', 'http://www.opengis.net/gml/3.2');\n  makeNsAssignment('wfs', 'http://www.opengis.net/wfs/2.0');\n\n  for (let ns of allNamespaces) {\n    if (!attrs['xmlns:' + ns]) {\n      throw new Error(`unassigned namespace ${ns}`);\n    }\n  }\n  /* , schemaLocations*/\n\n\n  return attrs;\n}\n/**\n * Returns a string alternating uri, whitespace, and the uri's schema's\n * location.\n * @param {Object} schemaLocations an object mapping uri:schemalocation\n * @return {string} a string that is a valid xsi:schemaLocation value.\n */\n\nfunction generateSchemaLines(schemaLocations = {}) {\n  // TODO: add ns assignment check\n  schemaLocations['http://www.opengis.net/wfs/2.0'] = 'http://schemas.opengis.net/wfs/2.0/wfs.xsd';\n  let schemaLines = [];\n  Object.entries(schemaLocations).forEach(entry => schemaLines.push(entry.join('\\n')));\n  return schemaLines.join('\\n');\n}\n/**\n * Turns an array of geojson features into gml:_feature strings describing them.\n * @function\n * @param {Feature[]} features an array of features to translate to\n * gml:_features.\n * @param {Params} params an object of backup / override parameters\n * @return {String} a gml:_feature string.\n */\n\nfunction translateFeatures(features, params = {}) {\n  let inner = '';\n  let {\n    srsName,\n    srsDimension\n  } = params;\n\n  for (let feature of features) {\n    // TODO: add whitelist support\n    let {\n      ns,\n      layer,\n      geometry_name,\n      properties,\n      id: id$$1,\n      whitelist\n    } = unpack(feature, params, 'ns', 'layer', 'geometry_name', 'properties', 'id', 'whitelist');\n    let fields = '';\n\n    if (geometry_name) {\n      fields += tag(ns, geometry_name, {}, geomToGml(feature.geometry, '', {\n        srsName,\n        srsDimension\n      }));\n    }\n\n    useWhitelistIfAvailable(whitelist, properties, (prop, val) => {\n      if (val === null) {\n        return fields;\n      }\n\n      return fields += tag(ns, prop, {}, escape(properties[prop]));\n    });\n    inner += tag(ns, layer, {\n      'gml:id': id(layer, id$$1)\n    }, fields);\n  }\n\n  return inner;\n}\n\n/**\n * Builds a filter from feature ids if one is not already input.\n * @function\n * @param {?String} filter a possible string filter\n * @param {Array<Object>} features an array of geojson feature objects\n * @param {Object} params an object of backup / override parameters\n * @return {String} A filter, or the input filter if it was a string.\n */\n\nfunction filter(filter, features, params) {\n  if (!filter) {\n    filter = '';\n\n    for (let feature of features) {\n      let layer = unpack(feature, params);\n      filter += idFilter(layer, feature.id);\n    }\n\n    return `<fes:Filter>${filter}</fes:Filter>`;\n  } else {\n    return filter;\n  }\n}\n\n/* eslint-disable camelcase, new-cap */\n/**\n * Returns a wfs:Insert tag wrapping a translated feature\n * @function\n * @param {Feature[]|FeatureCollection|Feature} features Feature(s) to pass to\n *  @see translateFeatures\n * @param {Params} params to be passed to @see translateFeatures, with optional\n * inputFormat, srsName, handle for the wfs:Insert tag.\n * @return {string} a wfs:Insert string.\n */\n\nfunction Insert(features, params = {}) {\n  features = array(features);\n  let {\n    inputFormat,\n    srsName,\n    handle\n  } = params;\n\n  if (!features.length) {\n    console.warn('no features supplied');\n    return '';\n  }\n\n  let toInsert = translateFeatures(features, params);\n  return tag('wfs', 'Insert', {\n    inputFormat,\n    srsName,\n    handle\n  }, toInsert);\n}\n/**\n * Updates the input features in bulk with params.properties or by id.\n * @param {Feature[]|FeatureCollection} features features to update.  These may\n * pass in geometry_name, properties, and layer (overruled by params) and\n * ns, layer, srsName (overruling params).\n * @param {Params} params with optional properties, ns (namespace), layer,\n *  geometry_name, filter, typeName, whitelist.\n * @return {string} a string wfs:Upate action.\n */\n\nfunction Update(features, params = {}) {\n  features = array(features);\n  /**\n   * makes a wfs:Property string containg a wfs:ValueReference, wfs:Value pair.\n   * @private\n   * @function\n   * @memberof Update~\n   * @param {string} prop the field/property name\n   * @param {string} val the field/property value\n   * @param {string} action one of 'insertBefore', 'insertAfter', 'remove',\n   * 'replace'. See [OGC 09-025r2 § 15.2.5.2.1]{@link http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#286}.\n   * `action` would delete or modify the order of fields within the remote\n   * feature. There is currently no way to input `action,` since wfs:Update's\n   * default action, 'replace', is sufficient.\n   * @return {string} a wfs:Property(wfs:ValueReference) pair.\n   */\n\n  const makeKvp = (prop, val, action$$1) => {\n    let value = '';\n\n    if (val === null) {\n      value = wfs('Value', {\n        'xsi:nil': true\n      }, '');\n    } else if (val !== undefined) {\n      value = wfs('Value', {}, val);\n    }\n\n    return wfs('Property', {}, wfs('ValueReference', {\n      action: action$$1\n    }, prop) + value);\n  };\n\n  if (params.properties) {\n    let {\n      /* handle, */\n      inputFormat,\n      filter: filter$$1,\n      typeName: typeName$$1,\n      whitelist\n    } = params;\n    let {\n      srsName,\n      ns,\n      layer,\n      geometry_name\n    } = unpack(features[0] || {}, params, 'srsName', 'ns', 'layer', 'geometry_name');\n    typeName$$1 = typeName(ns, layer, typeName$$1);\n    filter$$1 = filter(filter$$1, features, params);\n\n    if (!filter$$1 && !features.length) {\n      console.warn('neither features nor filter supplied');\n      return '';\n    }\n\n    let fields = '';\n    useWhitelistIfAvailable( // TODO: action attr\n    whitelist, params.properties, (k, v) => fields += makeKvp(k, escape(v)));\n\n    if (geometry_name) {\n      fields += makeKvp(geometry_name, tag(ns, geometry_name, {}, geomToGml(params.geometry, '', {\n        srsName\n      })));\n    }\n\n    return wfs('Update', {\n      inputFormat,\n      srsName,\n      typeName: typeName$$1\n    }, fields + filter$$1);\n  } else {\n    // encapsulate each update in its own Update tag\n    return features.map(f => Update(f, Object.assign({}, params, {\n      properties: f.properties\n    }))).join('');\n  }\n}\n/**\n * Creates a wfs:Delete action, creating a filter and typeName from feature ids\n * if none are supplied.\n * @param {Feature[]|FeatureCollection|Feature} features\n * @param {Params} params optional parameter overrides.\n * @param {string} [params.ns] @see Params.ns\n * @param {string|Object} [params.layer] @see Params.layer\n * @param {string} [params.typeName] @see Params.typeName. This will be inferred\n * from feature/params layer and ns if this is left undefined.\n * @param {filter} [params.filter] @see Params.filter.  This will be inferred\n * from feature ids and layer(s) if left undefined (@see ensureFilter).\n * @return {string} a wfs:Delete string.\n */\n\nfunction Delete(features, params = {}) {\n  features = array(features);\n  let {\n    filter: filter$$1,\n    typeName: typeName$$1\n  } = params; // TODO: recur & encapsulate by typeName\n\n  let {\n    ns,\n    layer\n  } = unpack(features[0] || {}, params, 'layer', 'ns');\n  typeName$$1 = typeName(ns, layer, typeName$$1);\n  filter$$1 = filter(filter$$1, features, params);\n  return wfs('Delete', {\n    typeName: typeName$$1\n  }, filter$$1);\n}\n/**\n * Returns a string wfs:Replace action.\n * @param {Feature[]|FeatureCollection|Feature} features feature(s) to replace\n * @param {Params} params with optional filter, inputFormat, srsName\n * @return {string} a string wfs:Replace action.\n */\n\nfunction Replace(features, params = {}) {\n  features = array(features);\n  let {\n    filter: filter$$1,\n    inputFormat,\n    srsName\n  } = unpack(features[0] || {}, params || {}, 'filter', 'inputFormat', 'srsName');\n  let replacements = translateFeatures([features[0]].filter(f => f), params || {\n    srsName\n  });\n  filter$$1 = filter(filter$$1, features, params);\n  return wfs('Replace', {\n    inputFormat,\n    srsName\n  }, replacements + filter$$1);\n}\n/**\n * Wraps the input actions in a wfs:Transaction.\n * @param {Object|string[]|string} actions an object mapping {Insert, Update,\n * Delete} to feature(s) to pass to Insert, Update, Delete, or wfs:action\n * string(s) to wrap in a transaction.\n * @param {TransactionParams} params optional srsName, lockId, releaseAction,\n *  handle, inputFormat, version, and required nsAssignments, schemaLocations.\n * @return {string} A wfs:transaction wrapping the input actions.\n * @throws {Error} if `actions` is not an array of strings, a string, or\n * {@see Insert, @see Update, @see Delete}, where each action are valid inputs\n * to the eponymous function.\n */\n\nfunction Transaction(actions, params = {}) {\n  const transactionParams = ['srsName', 'lockId', 'releaseAction', 'handle'];\n  let {\n    version,\n    // optional\n    nsAssignments = {} // required\n\n  } = params; // let converter = {Insert, Update, Delete};\n\n  let {\n    insert: toInsert,\n    update: toUpdate,\n    delete: toDelete\n  } = actions || {};\n  let finalActions = ''; // processedActions would be more accurate\n\n  if (Array.isArray(actions) && actions.every(v => typeof v == 'string')) {\n    finalActions += actions.join('');\n  } else if (typeof actions == 'string') {\n    finalActions = actions;\n  } else if ([toInsert, toUpdate, toDelete].some(e => e)) {\n    finalActions += Insert(toInsert, params) + Update(toUpdate, params) + Delete(toDelete, params);\n  } else {\n    throw new Error(`unexpected input: ${JSON.stringify(actions)}`);\n  } // generate schemaLocation, xmlns's\n\n\n  let attrs = generateNsAssignments(nsAssignments, actions);\n  attrs['xsi:schemaLocation'] = generateSchemaLines(params.schemaLocations);\n  attrs['service'] = 'WFS';\n  attrs['version'] = /2\\.0\\.\\d+/.exec(version || '') ? version : '2.0.0';\n  transactionParams.forEach(param => {\n    if (params[param]) {\n      attrs[param] = params[param];\n    }\n  });\n  return wfs('Transaction', attrs, finalActions);\n}\n\nexports.Insert = Insert;\nexports.Update = Update;\nexports.Delete = Delete;\nexports.Replace = Replace;\nexports.Transaction = Transaction;\n"]}