{"version":3,"sources":["jsdelivr-header.js","/npm/tsid@1.0.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,SAAW,mCAEjB,SAAS,OAAQ,GACf,IAAI,EAAI,GACR,KAAO,GAAG,CACR,MAAM,EAAI,EAAI,GACd,EAAI,KAAK,MAAM,EAAI,IACnB,EAAI,SAAS,OAAO,GAAK,CAC3B,CACA,OAAO,CACT,CAEA,SAAS,OAAQ,GACf,IAAI,EAAI,EACR,IAAK,MAAM,KAAK,EACd,EAAQ,GAAJ,EAAS,SAAS,QAAQ,GAEhC,OAAO,CACT,CAEA,IAAI,KAAO,EACP,aAAe,EACnB,MAAM,QAAU,WAEhB,SAAS,MAAO,GAOd,OANI,IAAc,KAChB,eAEA,aAAe,EAEjB,KAAO,EACa,IAAZ,EAAoB,YAC9B,CAEA,SAAS,WACP,OAAO,KAAK,MAAsB,GAAhB,KAAK,SACzB,gBAEe,MAAM,KACnB,WAAO,GACL,OAAO,KAAK,SAAS,KAAK,MAAO,QACnC,CAEA,eAAO,CAAU,EAAW,EAAU,YACpC,MAAO,GAAG,OAAO,MAAM,MAAc,OAAO,GAAS,SAAS,EAAG,MACnE,CAEA,gBAAO,CAAW,GAChB,MAAM,EAAS,EAAK,MAAM,EAAG,IAC7B,OAAO,KAAK,MAAM,OAAO,GAAU,IACrC","file":"/npm/tsid@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/tsid@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const ALPHAPET = '234567abcdefghijklmnopqrstuvwxyz'\n\nfunction encode (i) {\n  let s = ''\n  while (i) {\n    const c = i % 32\n    i = Math.floor(i / 32)\n    s = ALPHAPET.charAt(c) + s\n  }\n  return s\n};\n\nfunction decode (s) {\n  let i = 0\n  for (const c of s) {\n    i = i * 32 + ALPHAPET.indexOf(c)\n  }\n  return i\n}\n\nlet last = 0\nlet milliSeconds = 0\nconst clockid = _clockid()\n\nfunction micro (timestamp) {\n  if (timestamp === last) {\n    milliSeconds++\n  } else {\n    milliSeconds = 0\n  }\n  last = timestamp\n  return (timestamp * 1000) + milliSeconds\n}\n\nfunction _clockid () {\n  return Math.floor(Math.random() * 64)\n}\n\nexport default class TSID {\n  static next () {\n    return TSID.fromTime(Date.now(), clockid)\n  }\n\n  static fromTime (timestamp, clockid = _clockid()) {\n    return `${encode(micro(timestamp))}${encode(clockid).padStart(2, '2')}`\n  }\n\n  static timestamp (tsid) {\n    const substr = tsid.slice(0, 11)\n    return Math.floor(decode(substr) / 1000)\n  }\n}\n"]}