{"version":3,"sources":["../../src/client/index.ts"],"sourcesContent":["export type IdempotencyClientFetchOptions = {\n  header?: string;\n  createKey?: () => string;\n  fetch?: typeof fetch;\n};\n\n/**\n * Adds a stable Idempotency-Key header per submit intent (generate once, reuse on retry).\n */\nexport function createIdempotencyClientFetch(options: IdempotencyClientFetchOptions = {}) {\n  const header = options.header ?? \"Idempotency-Key\";\n  const fetchImpl = options.fetch ?? fetch;\n  const createKey = options.createKey ?? (() => crypto.randomUUID());\n\n  return async function idempotentFetch(\n    input: string | URL,\n    init?: RequestInit & { idempotencyKey?: string },\n  ): Promise<Response> {\n    const key = init?.idempotencyKey ?? createKey();\n    const headers = new Headers(init?.headers);\n    if (!headers.has(header)) headers.set(header, key);\n    const { idempotencyKey: _drop, ...rest } = init ?? {};\n    return fetchImpl(input, { ...rest, headers });\n  };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,SAAS,6BAA6B,UAAyC,CAAC,GAAG;AACxF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,YAAY,QAAQ,SAAS;AACnC,QAAM,YAAY,QAAQ,cAAc,MAAM,OAAO,WAAW;AAEhE,SAAO,eAAe,gBACpB,OACA,MACmB;AACnB,UAAM,MAAM,MAAM,kBAAkB,UAAU;AAC9C,UAAM,UAAU,IAAI,QAAQ,MAAM,OAAO;AACzC,QAAI,CAAC,QAAQ,IAAI,MAAM,EAAG,SAAQ,IAAI,QAAQ,GAAG;AACjD,UAAM,EAAE,gBAAgB,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC;AACpD,WAAO,UAAU,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC;AAAA,EAC9C;AACF;","names":[]}