1{"version":3,"file":"Strings.js","names":["_Paths","data","require","getProjectStringsXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","setStringItem","itemToAdd","stringFileContentsJSON","_stringFileContentsJS","resources","string","newItem","stringNameExists","findIndex","e","$","concat","removeStringItem","named","_stringFileContentsJS2","splice"],"sources":["../../src/android/Strings.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport { ResourceItemXML, ResourceKind, ResourceXML } from './Resources';\n\nexport async function getProjectStringsXMLPathAsync(\n  projectRoot: string,\n  { kind }: { kind?: ResourceKind } = {}\n): Promise<string> {\n  return getResourceXMLPathAsync(projectRoot, { kind, name: 'strings' });\n}\n\nexport function setStringItem(\n  itemToAdd: ResourceItemXML[],\n  stringFileContentsJSON: ResourceXML\n): ResourceXML {\n  if (!stringFileContentsJSON?.resources?.string) {\n    if (!stringFileContentsJSON.resources || typeof stringFileContentsJSON.resources === 'string') {\n      // file was empty and JSON is `{resources : ''}`\n      stringFileContentsJSON.resources = {};\n    }\n    stringFileContentsJSON.resources.string = itemToAdd;\n    return stringFileContentsJSON;\n  }\n\n  for (const newItem of itemToAdd) {\n    const stringNameExists = stringFileContentsJSON.resources.string.findIndex(\n      (e: ResourceItemXML) => e.$.name === newItem.$.name\n    );\n    if (stringNameExists > -1) {\n      // replace the previous item\n      stringFileContentsJSON.resources.string[stringNameExists] = newItem;\n    } else {\n      stringFileContentsJSON.resources.string =\n        stringFileContentsJSON.resources.string.concat(newItem);\n    }\n  }\n  return stringFileContentsJSON;\n}\n\nexport function removeStringItem(named: string, stringFileContentsJSON: ResourceXML): ResourceXML {\n  if (stringFileContentsJSON?.resources?.string) {\n    const stringNameExists = stringFileContentsJSON.resources.string.findIndex(\n      (e: ResourceItemXML) => e.$.name === named\n    );\n    if (stringNameExists > -1) {\n      // replace the previous value\n      stringFileContentsJSON.resources.string.splice(stringNameExists, 1);\n    }\n  }\n  return stringFileContentsJSON;\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,O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