{"version":3,"file":"interface.cjs","sourceRoot":"","sources":["../../src/types/interface.ts"],"names":[],"mappings":";;;AACA,uDAM+B;AAC/B,2CAKyB;AAEzB,mDAIoB;AACpB,sDAA8C;AAE9C,0CAA8C;AAE9C,wCAAwC;AAExC;;;;;GAKG;AAEU,QAAA,WAAW,GAAG,IAAA,mBAAK,EAAC;IAC/B,qCAA0B;IAC1B,mCAAwB;IACxB,qBAAU;IACV,IAAA,oBAAM,GAAE;IACR,IAAA,qBAAO,GAAE;IACT,2BAAmB;CACpB,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC,CAAC,CAAC;AAE1D,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EACxC,IAAA,oBAAM,GAAE,EACR,IAAA,mBAAK,EAAC,CAAC,uBAAe,EAAE,IAAA,sBAAQ,EAAC,mBAAW,CAAC,CAAC,CAAC,CAChD,CAAC;AAOW,QAAA,wBAAwB,GAAG,IAAA,0BAAc,EAAC,CAAC,KAAK,EAAE,EAAE;IAC/D,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,mBAAW,EAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,oBAAe,CAAC;IACzB,CAAC;IACD,OAAO,0BAAoB,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC;AAGnE,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,4CAA6B,CAAA;IAC7B,oCAAqB,CAAA;AACvB,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n  boolean,\n  nullable,\n  record,\n  string,\n  union,\n} from '@metamask/superstruct';\nimport {\n  CaipAccountIdStruct,\n  JsonStruct,\n  hasProperty,\n  isObject,\n} from '@metamask/utils';\n\nimport {\n  AssetSelectorStateStruct,\n  FileStruct,\n  AccountSelectorStateStruct,\n} from './handlers';\nimport { selectiveUnion } from '../internals';\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([\n  AccountSelectorStateStruct,\n  AssetSelectorStateStruct,\n  FileStruct,\n  string(),\n  boolean(),\n  CaipAccountIdStruct,\n]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n  string(),\n  union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer<typeof StateStruct>;\nexport type FormState = Infer<typeof FormStateStruct>;\nexport type InterfaceState = Infer<typeof InterfaceStateStruct>;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = selectiveUnion((value) => {\n  if (isObject(value) && !hasProperty(value, 'props')) {\n    return ComponentStruct;\n  }\n  return RootJSXElementStruct;\n});\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer<typeof InterfaceContextStruct>;\n\nexport enum ContentType {\n  Insight = 'Insight',\n  Dialog = 'Dialog',\n  Notification = 'Notification',\n  HomePage = 'HomePage',\n}\n"]}