{"version":3,"file":"readableStream.cjs","sources":["../src/readableStream.ts"],"sourcesContent":["import type { InlineOptions, InlineMinify } from '@twind/core'\n\nimport { createState } from './internal'\n\nexport type { InlineOptions, InlineMinify }\n\nconst encoder = /* #__PURE__ */ new TextEncoder()\nconst decoder = /* #__PURE__ */ new TextDecoder()\n\nexport default class InlineStream extends TransformStream<Uint8Array, Uint8Array> {\n  constructor(options?: InlineOptions['tw'] | InlineOptions) {\n    const state = createState(options)\n\n    const flush: TransformerFlushCallback<Uint8Array> = (controller) => {\n      const markup = state.flush()\n      if (markup) {\n        controller.enqueue(encoder.encode(markup))\n      }\n    }\n\n    super({\n      transform(chunk, controller) {\n        if (state.push(decoder.decode(chunk))) {\n          return flush(controller)\n        }\n      },\n      flush,\n    })\n  }\n}\n"],"names":["encoder","TextEncoder","decoder","TextDecoder","InlineStream","TransformStream","constructor","options","state","createState","flush","controller","markup","enqueue","encode","transform","chunk","push","decode"],"mappings":";uDAMMA,UAAAA,aAAAA,GAA0B,IAAIC,eAC9BC,UAAAA,aAAAA,GAA0B,IAAIC;AAErB,IAAMC,eAAN,MAAMA,qBAAqBC;IACxCC,YAAYC,OAA6C,CAAE;QACzD,IAAMC,QAAQC,oBAAYF,CAAAA,UAEpBG,QAA8C,CAACC,aAAe;YAClE,IAAMC,SAASJ,MAAME,KAAK;YACtBE,UACFD,WAAWE,OAAO,CAACb,QAAQc,MAAM,CAACF;QAEtC;QAEA,KAAK,CAAC;YACJG,WAAUC,KAAK,EAAEL,UAAU,EAAE;gBAC3B,IAAIH,MAAMS,IAAI,CAACf,QAAQgB,MAAM,CAACF,SAC5B,OAAON,MAAMC;YAEjB;YACAD;QACF;IACF;AACF;"}