{
  "version": 3,
  "sources": ["../../../../src/lib/editor/overlays/getOverlayDisplayValues.ts"],
  "sourcesContent": ["import { TLTheme } from '@tldraw/tlschema'\nimport type { Editor } from '../Editor'\nimport { TLOverlay } from './OverlayUtil'\n\n/** @public */\nexport interface OverlayOptionsWithDisplayValues<\n\tOverlay extends TLOverlay,\n\tDisplayValues extends object,\n> {\n\tgetDefaultDisplayValues(\n\t\teditor: Editor,\n\t\toverlay: Overlay,\n\t\ttheme: TLTheme,\n\t\tcolorMode: 'light' | 'dark'\n\t): DisplayValues\n\tgetCustomDisplayValues(\n\t\teditor: Editor,\n\t\toverlay: Overlay,\n\t\ttheme: TLTheme,\n\t\tcolorMode: 'light' | 'dark'\n\t): Partial<DisplayValues>\n}\n\nconst dvCache = new WeakMap<\n\tTLOverlay,\n\t{ theme: TLTheme; colorMode: 'light' | 'dark'; values: object }\n>()\n\n/**\n * Get the resolved display values for an overlay, merging the base values with any overrides.\n *\n * @public\n */\nexport function getOverlayDisplayValues<Overlay extends TLOverlay, DisplayValues extends object>(\n\tutil: { editor: Editor; options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues> },\n\toverlay: Overlay,\n\tcolorMode?: 'light' | 'dark'\n): DisplayValues {\n\tconst theme = util.editor.getCurrentTheme()\n\tconst resolvedColorMode = colorMode ?? util.editor.getColorMode()\n\tconst cached = dvCache.get(overlay)\n\tif (cached && cached.theme === theme && cached.colorMode === resolvedColorMode) {\n\t\treturn cached.values as DisplayValues\n\t}\n\tconst values = {\n\t\t...util.options.getDefaultDisplayValues(util.editor, overlay, theme, resolvedColorMode),\n\t\t...util.options.getCustomDisplayValues(util.editor, overlay, theme, resolvedColorMode),\n\t}\n\tdvCache.set(overlay, { theme, colorMode: resolvedColorMode, values })\n\treturn values\n}\n"],
  "mappings": "AAuBA,MAAM,UAAU,oBAAI,QAGlB;AAOK,SAAS,wBACf,MACA,SACA,WACgB;AAChB,QAAM,QAAQ,KAAK,OAAO,gBAAgB;AAC1C,QAAM,oBAAoB,aAAa,KAAK,OAAO,aAAa;AAChE,QAAM,SAAS,QAAQ,IAAI,OAAO;AAClC,MAAI,UAAU,OAAO,UAAU,SAAS,OAAO,cAAc,mBAAmB;AAC/E,WAAO,OAAO;AAAA,EACf;AACA,QAAM,SAAS;AAAA,IACd,GAAG,KAAK,QAAQ,wBAAwB,KAAK,QAAQ,SAAS,OAAO,iBAAiB;AAAA,IACtF,GAAG,KAAK,QAAQ,uBAAuB,KAAK,QAAQ,SAAS,OAAO,iBAAiB;AAAA,EACtF;AACA,UAAQ,IAAI,SAAS,EAAE,OAAO,WAAW,mBAAmB,OAAO,CAAC;AACpE,SAAO;AACR;",
  "names": []
}
