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ACD;AACD;;AAED,UAAI,GAAG,KAAK,IAAR,IAAgB,EAAE,KAAK,GAA3B,EAAgC;AAC9B,QAAA,GAAG,GAAG,KAAN;AACA,QAAA,KAAK,GAAG,EAAR;AACA;AACD;;AAED,UAAI,EAAE,KAAK,GAAP,IAAc,EAAE,KAAK,GAArB,IAA4B,EAAE,KAAK,GAAvC,EAA4C;AAC1C,YAAI,GAAG,KAAK,IAAZ,EAAkB;AAChB,UAAA,MAAM,CAAC,GAAP,CAAW,GAAX,EAAgB,KAAhB;AACD;;AACD,QAAA,GAAG,GAAG,IAAN;AACA,QAAA,KAAK,GAAG,EAAR;AACA;AACD;AACF;;AAED,QAAI,EAAE,KAAK,GAAP,IAAc,CAAC,MAAnB,EAA2B;AACzB,UAAI,KAAK,CAAC,MAAN,KAAiB,CAArB,EAAwB;AACtB;AACD;;AAED,UAAI,CAAC,GAAG,YAAR,EAAsB;AACpB,YAAI,CAAC,GAAG,CAAR;;AACA,eAAO,GAAG,CAAC,CAAD,CAAH,KAAW,GAAlB,EAAuB;AACrB,UAAA,CAAC;AACF;;AACD,QAAA,YAAY,GAAG,CAAf;AACD;;AAED,UAAI,YAAY,IAAI,GAAG,CAAC,MAApB,IACC,GAAG,CAAC,YAAD,CAAH,KAAsB,GADvB,IAEC,GAAG,CAAC,YAAD,CAAH,KAAsB,GAFvB,IAGE,GAAG,KAAK,IAAR,IAAgB,GAAG,CAAC,YAAD,CAAH,KAAsB,GAHxC,IAIE,GAAG,KAAK,IAAR,IAAgB,GAAG,CAAC,YAAD,CAAH,KAAsB,GAJ5C,EAKE;AACA,QAAA,CAAC,GAAG,YAAY,GAAG,CAAnB;AACA;AACD;AACF;;AAED,IAAA,KAAK,IAAI,EAAT;AACD;;AAED,SAAO,MAAP;AACD,C","sourcesContent":["export function parseDn(seq: string): Map<string, string> {\n let quoted = false\n let key: string | null = null\n let token = \"\"\n let nextNonSpace = 0\n\n seq = seq.trim()\n const result = new Map<string, string>()\n for (let i = 0; i <= seq.length; i++) {\n if (i === seq.length) {\n if (key !== null) {\n result.set(key, token)\n }\n break\n }\n\n const ch = seq[i]\n if (quoted) {\n if (ch === '\"') {\n quoted = false\n continue\n }\n }\n else {\n if (ch === '\"') {\n quoted = true\n continue\n }\n\n if (ch === \"\\\\\") {\n i++\n const ord = parseInt(seq.slice(i, i + 2), 16)\n if (Number.isNaN(ord)) {\n token += seq[i]\n }\n else {\n i++\n token += String.fromCharCode(ord)\n }\n continue\n }\n\n if (key === null && ch === \"=\") {\n key = token\n token = \"\"\n continue\n }\n\n if (ch === \",\" || ch === \";\" || ch === \"+\") {\n if (key !== null) {\n result.set(key, token)\n }\n key = null\n token = \"\"\n continue\n }\n }\n\n if (ch === \" \" && !quoted) {\n if (token.length === 0) {\n continue\n }\n\n if (i > nextNonSpace) {\n let j = i\n while (seq[j] === \" \") {\n j++\n }\n nextNonSpace = j\n }\n\n if (nextNonSpace >= seq.length\n || seq[nextNonSpace] === \",\"\n || seq[nextNonSpace] === \";\"\n || (key === null && seq[nextNonSpace] === \"=\")\n || (key !== null && seq[nextNonSpace] === \"+\")\n ) {\n i = nextNonSpace - 1\n continue\n }\n }\n\n token += ch\n }\n\n return result\n}"],"sourceRoot":""}
|