{"version":3,"file":"escape-css-id.mjs","names":[],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/escape-css-id/escape-css-id.ts"],"sourcesContent":["function isNameCodeUnit(codeUnit: number) {\n  return (\n    codeUnit >= 0x80 ||\n    codeUnit === 0x2d ||\n    codeUnit === 0x5f ||\n    (codeUnit >= 0x30 && codeUnit <= 0x39) ||\n    (codeUnit >= 0x41 && codeUnit <= 0x5a) ||\n    (codeUnit >= 0x61 && codeUnit <= 0x7a)\n  );\n}\n\nfunction isDigit(codeUnit: number) {\n  return codeUnit >= 0x30 && codeUnit <= 0x39;\n}\n\n/** Serializes a string as a CSS identifier, same output as `CSS.escape`, works on the server */\nexport function escapeCssId(value: string) {\n  let result = '';\n\n  for (let index = 0; index < value.length; index += 1) {\n    const codeUnit = value.charCodeAt(index);\n    const char = value.charAt(index);\n\n    if (codeUnit === 0) {\n      result += String.fromCharCode(0xfffd);\n    } else if (\n      (codeUnit >= 0x1 && codeUnit <= 0x1f) ||\n      codeUnit === 0x7f ||\n      (index === 0 && isDigit(codeUnit)) ||\n      (index === 1 && isDigit(codeUnit) && value.charCodeAt(0) === 0x2d)\n    ) {\n      result += `\\\\${codeUnit.toString(16)} `;\n    } else if (index === 0 && value.length === 1 && codeUnit === 0x2d) {\n      result += `\\\\${char}`;\n    } else if (isNameCodeUnit(codeUnit)) {\n      result += char;\n    } else {\n      result += `\\\\${char}`;\n    }\n  }\n\n  return result;\n}\n"],"mappings":";;AAAA,SAAS,eAAe,UAAkB;CACxC,OACE,YAAY,OACZ,aAAa,MACb,aAAa,MACZ,YAAY,MAAQ,YAAY,MAChC,YAAY,MAAQ,YAAY,MAChC,YAAY,MAAQ,YAAY;AAErC;AAEA,SAAS,QAAQ,UAAkB;CACjC,OAAO,YAAY,MAAQ,YAAY;AACzC;;AAGA,SAAgB,YAAY,OAAe;CACzC,IAAI,SAAS;CAEb,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;EACpD,MAAM,WAAW,MAAM,WAAW,KAAK;EACvC,MAAM,OAAO,MAAM,OAAO,KAAK;EAE/B,IAAI,aAAa,GACf,UAAU,OAAO,aAAa,KAAM;OAC/B,IACJ,YAAY,KAAO,YAAY,MAChC,aAAa,OACZ,UAAU,KAAK,QAAQ,QAAQ,KAC/B,UAAU,KAAK,QAAQ,QAAQ,KAAK,MAAM,WAAW,CAAC,MAAM,IAE7D,UAAU,KAAK,SAAS,SAAS,EAAE,EAAE;OAChC,IAAI,UAAU,KAAK,MAAM,WAAW,KAAK,aAAa,IAC3D,UAAU,KAAK;OACV,IAAI,eAAe,QAAQ,GAChC,UAAU;OAEV,UAAU,KAAK;CAEnB;CAEA,OAAO;AACT"}