@tempoxyz/id 0.0.0-pr-315.sha-6d7a310 → 0.0.0-pr-315.sha-708f598
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/server/assets/Grant-D_tun0mF.js.map +1 -1
- package/dist/client/actions/redirect.d.ts +6 -2
- package/dist/client/actions/redirect.d.ts.map +1 -1
- package/dist/client/actions/redirect.js +55 -13
- package/dist/client/actions/redirect.js.map +1 -1
- package/dist/client/internal/verifier.d.ts +25 -0
- package/dist/client/internal/verifier.d.ts.map +1 -0
- package/dist/client/internal/verifier.js +52 -0
- package/dist/client/internal/verifier.js.map +1 -0
- package/package.json +1 -1
- package/src/client/actions/redirect.ts +107 -34
- package/src/client/internal/verifier.ts +75 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grant-D_tun0mF.js","names":["REASONS.closePress","BaseUi.Popover.Close","BaseUi.Popover.Root","BaseUi.Popover.Trigger","_jsx","BaseUi.Popover.Arrow","styles","BaseUi.Popover.Description","BaseUi.Popover.Portal","BaseUi.Popover.Positioner","BaseUi.Popover.Popup","BaseUi.Popover.Title","_jsxs","_jsx","_jsxs","_jsx","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__1_0_","__import_glob__1_1_","useId","useState","_Fragment","__toESM","require_react","require_jsx_runtime","InfoCircle","CheckCircle","Stack","createChangeEventDetails","useRenderElement","useButton","closePress","create","popupStateMapping","useBaseUiId","Tooltip","usePopoverPositionerContext","PopoverRoot","useClosePartRegistration","PopoverPortal","PopoverPositioner","PopoverTrigger","PopoverPopup","usePopoverRootContext","Callout","Inline","Tag","import_react","PopoverArrow","elementProps","componentProps","open","arrowUncentered","forwardedRef","arrowRef","arrowStyles","PopoverTitle","store","id","PopoverDescription","PopoverClose","nativeButton","buttonRef","event","getButtonProps","import_jsx_runtime","Popover","Arrow","attributes","props","styles$1","Description","Popup","Title","BadgeCheck","XCircle","BRLA_default","BRZ_default","CHFAU_default","DLUSD_default","EURAU_default","EURC_e_default","GBPA_default","GUSD_default","MACH_default","OUSD_default","PRIME_default","SBC_default","SEKAU_default","USD1_default","USDB_default","USDC_e_default","USDT0_default","USDY_default","USDe_default","YLDS_default","alphaUSD_default","betaUSD_default","cUSD_default","cbBTC_default","frxUSD_default","goUSD_default","iUSD_default","pathUSD_default","rUSD_default","reUSD_default","sUSDe_default","siUSD_default","stcUSD_default","syrupUSDC_default","thetaUSD_default","wYLDS_default","wsrUSD_default","OUSD_dark_default","OUSD_light_default","icons","file","url","logos","symbol","scheme","result","Grant","deniedId","detailsId","details","setDetails","Heading","channels","calls","call","topUp","styles","limits","limit","format","every","label","token","logo","icon","until","expiry","unrecognized","decimal","relative","spans","units","unit","seconds","period","entry","count","amount","remaining"],"sources":["../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/arrow/PopoverArrow.mjs","../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/title/PopoverTitle.mjs","../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/description/PopoverDescription.mjs","../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/close/PopoverClose.mjs","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/components/Popover.css","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/components/Popover.js","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/icons/BadgeCheck.js","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/icons/XCircle.js","../../../components/icons/BRLA.png?no-inline","../../../components/icons/BRZ.svg?no-inline","../../../components/icons/CHFAU.png?no-inline","../../../components/icons/DLUSD.png?no-inline","../../../components/icons/EURAU.svg?no-inline","../../../components/icons/EURC.e.svg?no-inline","../../../components/icons/GBPA.svg?no-inline","../../../components/icons/GUSD.svg?no-inline","../../../components/icons/MACH.svg?no-inline","../../../components/icons/OUSD.svg?no-inline","../../../components/icons/PRIME.svg?no-inline","../../../components/icons/SBC.svg?no-inline","../../../components/icons/SEKAU.svg?no-inline","../../../components/icons/USD1.svg?no-inline","../../../components/icons/USDB.svg?no-inline","../../../components/icons/USDC.e.svg?no-inline","../../../components/icons/USDT0.svg?no-inline","../../../components/icons/USDY.svg?no-inline","../../../components/icons/USDe.svg?no-inline","../../../components/icons/YLDS.svg?no-inline","../../../components/icons/alphaUSD.svg?no-inline","../../../components/icons/betaUSD.svg?no-inline","../../../components/icons/cUSD.svg?no-inline","../../../components/icons/cbBTC.svg?no-inline","../../../components/icons/frxUSD.svg?no-inline","../../../components/icons/goUSD.svg?no-inline","../../../components/icons/iUSD.svg?no-inline","../../../components/icons/pathUSD.svg?no-inline","../../../components/icons/rUSD.svg?no-inline","../../../components/icons/reUSD.svg?no-inline","../../../components/icons/sUSDe.svg?no-inline","../../../components/icons/siUSD.svg?no-inline","../../../components/icons/stcUSD.svg?no-inline","../../../components/icons/syrupUSDC.svg?no-inline","../../../components/icons/thetaUSD.svg?no-inline","../../../components/icons/wYLDS.svg?no-inline","../../../components/icons/wsrUSD.svg?no-inline","../../../components/logos/OUSD.dark.svg?no-inline","../../../components/logos/OUSD.light.svg?no-inline","../../../components/Grant.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { usePopoverPositionerContext } from \"../positioner/PopoverPositionerContext.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Displays an element positioned against the popover anchor.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverArrow = /*#__PURE__*/React.forwardRef(function PopoverArrow(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const open = store.useState('open');\n const {\n arrowRef,\n side,\n align,\n arrowUncentered,\n arrowStyles\n } = usePopoverPositionerContext();\n const state = {\n open,\n side,\n align,\n uncentered: arrowUncentered\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, arrowRef],\n props: [{\n style: arrowStyles,\n 'aria-hidden': true\n }, elementProps],\n stateAttributesMapping: popupStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverArrow.displayName = \"PopoverArrow\";","'use client';\n\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\n\n/**\n * A heading that labels the popover.\n * Renders an `<h2>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverTitle = /*#__PURE__*/React.forwardRef(function PopoverTitle(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const id = useBaseUiId(elementProps.id);\n store.useSyncedValueWithCleanup('titleElementId', id);\n const element = useRenderElement('h2', componentProps, {\n ref: forwardedRef,\n props: [{\n id\n }, elementProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverTitle.displayName = \"PopoverTitle\";","'use client';\n\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A paragraph with additional information about the popover.\n * Renders a `<p>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverDescription = /*#__PURE__*/React.forwardRef(function PopoverDescription(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const id = useBaseUiId(elementProps.id);\n store.useSyncedValueWithCleanup('descriptionElementId', id);\n const element = useRenderElement('p', componentProps, {\n ref: forwardedRef,\n props: [{\n id\n }, elementProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverDescription.displayName = \"PopoverDescription\";","'use client';\n\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useClosePartRegistration } from \"../../utils/closePart.mjs\";\n\n/**\n * A button that closes the popover.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverClose = /*#__PURE__*/React.forwardRef(function PopoverClose(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n disabled = false,\n nativeButton = true,\n ...elementProps\n } = componentProps;\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n disabled,\n focusableWhenDisabled: false,\n native: nativeButton\n });\n const store = usePopoverRootContext();\n useClosePartRegistration();\n const element = useRenderElement('button', componentProps, {\n ref: [forwardedRef, buttonRef],\n props: [{\n onClick(event) {\n store.setOpen(false, createChangeEventDetails(REASONS.closePress, event.nativeEvent));\n }\n }, elementProps, getButtonProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverClose.displayName = \"PopoverClose\";",".z_tds_2f_web-WYxykg0{color:var(--z-tds_2f_web-color-background-raised,light-dark(#fff,#1f1e1e))}.z_tds_2f_web-WYxykg1{display:flex}.z_tds_2f_web-WYxykg2{&[data-side=bottom]{top:-10px}}.z_tds_2f_web-WYxykg3{&[data-side=left]{right:-14px}}.z_tds_2f_web-WYxykg4{&[data-side=left]{rotate:90deg}}.z_tds_2f_web-WYxykg5{&[data-side=right]{left:-14px}}.z_tds_2f_web-WYxykg6{&[data-side=right]{rotate:-90deg}}.z_tds_2f_web-WYxykg7{&[data-side=top]{bottom:-10px}}.z_tds_2f_web-WYxykg8{&[data-side=top]{rotate:180deg}}.z_tds_2f_web-WYxykg9{color:var(--z-tds_2f_web-color-gray-900,light-dark(#4d4d4d,#bcbbbb))}.z_tds_2f_web-WYxykga{margin:var(--z-tds_2f_web-spacing-0,0rem)}.z_tds_2f_web-WYxykgb{font-family:var(--z-tds_2f_web-typography-copy-14-fontFamily,Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\")}.z_tds_2f_web-WYxykgc{font-size:var(--z-tds_2f_web-typography-copy-14-fontSize,14px)}.z_tds_2f_web-WYxykgd{font-weight:var(--z-tds_2f_web-typography-copy-14-fontWeight,450)}.z_tds_2f_web-WYxykge{letter-spacing:var(--z-tds_2f_web-typography-copy-14-letterSpacing,-.09px)}.z_tds_2f_web-WYxykgf{line-height:var(--z-tds_2f_web-typography-copy-14-lineHeight,20px)}.z_tds_2f_web-WYxykgg{background-color:var(--z-tds_2f_web-color-background-raised,light-dark(#fff,#1f1e1e))}.z_tds_2f_web-WYxykgh{border-radius:var(--z-tds_2f_web-radius-16,1rem)}.z_tds_2f_web-WYxykgi{box-shadow:var(--z-tds_2f_web-shadow-popover,0 0 0 1px light-dark(#0000000f,#ffffff14), 0 8px 24px -4px #0000001f, 0 24px 48px -12px #00000029)}.z_tds_2f_web-WYxykgj{box-sizing:border-box}.z_tds_2f_web-WYxykgk{color:var(--z-tds_2f_web-color-foreground,light-dark(#171717,#fff))}.z_tds_2f_web-WYxykgl{max-width:var(--available-width)}.z_tds_2f_web-WYxykgm{outline:none}.z_tds_2f_web-WYxykgn{padding:var(--z-tds_2f_web-spacing-24,1.5rem)}.z_tds_2f_web-WYxykgo{transform-origin:var(--transform-origin)}.z_tds_2f_web-WYxykgp{transition-duration:var(--z-tds_2f_web-transitionDuration-200,.2s)}.z_tds_2f_web-WYxykgq{transition-property:opacity,scale}.z_tds_2f_web-WYxykgr{transition-timing-function:var(--z-tds_2f_web-ease-snappy,cubic-bezier(.23, 1, .32, 1))}.z_tds_2f_web-WYxykgs{width:max-content}.z_tds_2f_web-WYxykgt{&[data-ending-style]{opacity:0}}.z_tds_2f_web-WYxykgu{&[data-ending-style]{scale:var(--z-tds_2f_web-scale-enter,.96)}}.z_tds_2f_web-WYxykgv{&[data-ending-style]{transition-duration:var(--z-tds_2f_web-transitionDuration-140,.14s)}}.z_tds_2f_web-WYxykgw{&[data-starting-style]{opacity:0}}.z_tds_2f_web-WYxykgx{&[data-starting-style]{scale:var(--z-tds_2f_web-scale-enter,.96)}}@media (prefers-reduced-motion:reduce){.z_tds_2f_web-WYxykgy{transition-property:opacity}.z_tds_2f_web-WYxykgz{&[data-ending-style],&[data-starting-style]{scale:none}}}.z_tds_2f_web-WYxykg10{z-index:var(--z-tds_2f_web-zIndex-popover,50)}.z_tds_2f_web-WYxykg11{font-family:var(--z-tds_2f_web-typography-heading-20-fontFamily,Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\")}.z_tds_2f_web-WYxykg12{font-size:var(--z-tds_2f_web-typography-heading-20-fontSize,20px)}.z_tds_2f_web-WYxykg13{font-weight:var(--z-tds_2f_web-typography-heading-20-fontWeight,600)}.z_tds_2f_web-WYxykg14{letter-spacing:var(--z-tds_2f_web-typography-heading-20-letterSpacing,-.33px)}.z_tds_2f_web-WYxykg15{line-height:var(--z-tds_2f_web-typography-heading-20-lineHeight,26px)}.z_tds_2f_web-WYxykg16{margin:var(--z-tds_2f_web-spacing-0,0rem)}.z_tds_2f_web-WYxykg17{margin-bottom:var(--z-tds_2f_web-spacing-4,.25rem)}","\nimport { Props as __zyzzProps } from 'zyzz/runtime';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as BaseUi from '@base-ui/react/popover';\nimport { style } from '../zyzz.config.js';\n/**\n * A non-modal `dialog` anchored to a trigger and opened on click. Opening moves focus to the first\n * tabbable element inside, or to the popup on touch. Escape and outside presses close it and\n * return focus to the trigger.\n *\n * - Use it for interactive or longer content. Use `Tooltip` for a short hint on hover.\n * - Include `Title` so the dialog has an accessible name, and `Description` for supporting text.\n * - Offer `Close` when the popup holds a form or other controls.\n *\n * @example\n * <Popover.Root>\n * <Popover.Trigger render={<Button variant=\"secondary\" />}>Network fee</Popover.Trigger>\n * <Popover.Popup>\n * <Popover.Title>Network fee</Popover.Title>\n * <Popover.Description>Paid in the token you send.</Popover.Description>\n * </Popover.Popup>\n * </Popover.Root>\n *\n * @see {@link https://base-ui.com/react/components/popover | Base UI Popover}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Popover_API | MDN Popover API}\n * @see {@link https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html | WCAG 2.2 Content on Hover or Focus}\n * @see {@link https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html | WCAG 2.2 Focus Order}\n * @see {@link https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html | WCAG 2.2 Keyboard}\n */\nexport var Popover;\n(function (Popover) {\n /** Renders a `button` that closes the popover. Pass `render` to use a `Button`. */\n Popover.Close = BaseUi.Popover.Close;\n /**\n * Owns the open state. Pass `open` and `onOpenChange` to control it. Unless `modal` is set, the\n * page stays interactive while the popover is open.\n */\n Popover.Root = BaseUi.Popover.Root;\n /**\n * Toggles the popover on click and anchors the popup. Set `openOnHover` to also open it on hover.\n *\n * @example\n * <Popover.Trigger render={<Button variant=\"secondary\" />}>Network fee</Popover.Trigger>\n */\n Popover.Trigger = BaseUi.Popover.Trigger;\n /** Draws a pointer toward the trigger on the popup's anchored side. Place it inside `Popup`. */\n function Arrow(props) {\n const { className, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Arrow, { ...attributes, ...styles.arrow({ className, style: props.style, vars }), children: _jsx(\"svg\", { \"aria-hidden\": \"true\", fill: \"currentColor\", height: \"10\", viewBox: \"0 0 20 10\", width: \"20\", children: _jsx(\"path\", { d: \"M0 10C4 10 7 7 8.6 4.6a2 2 0 0 1 2.8 0C13 7 16 10 20 10Z\" }) }) }));\n }\n Popover.Arrow = Arrow;\n /** Renders a `p` that describes the popup through `aria-describedby`. */\n function Description(props) {\n const { className, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Description, { ...attributes, ...styles.description({ className, style: props.style, vars }) }));\n }\n Popover.Description = Description;\n /**\n * Renders the portal, positioner and popup. Placement props go to the positioner, which sits 8px\n * from the trigger unless `sideOffset` is set. Other props, `ref`, `className` and `style` reach\n * the popup. `initialFocus` and `finalFocus` override where focus moves on open and close.\n */\n function Popup(props) {\n const { align, alignOffset, anchor, className, collisionPadding, side, sideOffset = 8, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Portal, { children: _jsx(BaseUi.Popover.Positioner, { ...styles.positioner(), align: align, alignOffset: alignOffset, anchor: anchor, collisionPadding: collisionPadding, side: side, sideOffset: sideOffset, children: _jsx(BaseUi.Popover.Popup, { ...attributes, ...styles.popup({ className, style: props.style, vars }) }) }) }));\n }\n Popover.Popup = Popup;\n /** Renders an `h2` that names the popup through `aria-labelledby`. */\n function Title(props) {\n const { className, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Title, { ...attributes, ...styles.title({ className, style: props.style, vars }) }));\n }\n Popover.Title = Title;\n})(Popover || (Popover = {}));\nvar styles;\n(function (styles) {\n styles.arrow = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg0 z_tds_2f_web-WYxykg1 z_tds_2f_web-WYxykg2 z_tds_2f_web-WYxykg3 z_tds_2f_web-WYxykg4 z_tds_2f_web-WYxykg5 z_tds_2f_web-WYxykg6 z_tds_2f_web-WYxykg7 z_tds_2f_web-WYxykg8\"});\n styles.description = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg9 z_tds_2f_web-WYxykga z_tds_2f_web-WYxykgb z_tds_2f_web-WYxykgc z_tds_2f_web-WYxykgd z_tds_2f_web-WYxykge z_tds_2f_web-WYxykgf\"});\n styles.popup = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykgg z_tds_2f_web-WYxykgh z_tds_2f_web-WYxykgi z_tds_2f_web-WYxykgj z_tds_2f_web-WYxykgk z_tds_2f_web-WYxykgl z_tds_2f_web-WYxykgm z_tds_2f_web-WYxykgn z_tds_2f_web-WYxykgo z_tds_2f_web-WYxykgp z_tds_2f_web-WYxykgq z_tds_2f_web-WYxykgr z_tds_2f_web-WYxykgb z_tds_2f_web-WYxykgc z_tds_2f_web-WYxykgd z_tds_2f_web-WYxykge z_tds_2f_web-WYxykgf z_tds_2f_web-WYxykgs z_tds_2f_web-WYxykgt z_tds_2f_web-WYxykgu z_tds_2f_web-WYxykgv z_tds_2f_web-WYxykgw z_tds_2f_web-WYxykgx z_tds_2f_web-WYxykgy z_tds_2f_web-WYxykgz\"});\n styles.positioner = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg10\"});\n styles.title = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg11 z_tds_2f_web-WYxykg12 z_tds_2f_web-WYxykg13 z_tds_2f_web-WYxykg14 z_tds_2f_web-WYxykg15 z_tds_2f_web-WYxykg16 z_tds_2f_web-WYxykg17\"});\n})(styles || (styles = {}));\n//# sourceMappingURL=Popover.js.map\nimport './Popover.css';\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function BadgeCheck(props) {\n return (_jsxs(\"svg\", { width: \"1em\", height: \"1em\", viewBox: \"0 0 16 16\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", \"aria-hidden\": props['aria-label'] || props['aria-labelledby'] ? undefined : true, role: props['aria-label'] || props['aria-labelledby'] ? 'img' : undefined, ...props, children: [_jsx(\"path\", { d: \"M9.9691 6.50791C10.1268 6.28127 10.4387 6.2253 10.6654 6.38291C10.8915 6.54061 10.9476 6.85173 10.7904 7.07822L8.1859 10.8253C8.10463 10.9422 7.97661 11.0189 7.83532 11.0362C7.69403 11.0533 7.5516 11.009 7.44469 10.9151L5.95641 9.60361C5.74921 9.42107 5.72894 9.10476 5.91149 8.89756C6.09407 8.69075 6.4095 8.67124 6.61657 8.85361L7.68395 9.79306L9.9691 6.50791Z\", fill: \"currentColor\" }), _jsx(\"path\", { fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M7.67516 1.61826C8.13077 1.16265 8.86994 1.16265 9.32555 1.61826L10.7591 3.05185C10.7902 3.08262 10.8326 3.10058 10.8763 3.10068H12.7338C13.3779 3.10081 13.9006 3.62258 13.9007 4.2667V6.12412C13.9009 6.16817 13.9184 6.21112 13.9496 6.24228L15.3832 7.6749C15.8384 8.13047 15.8385 8.86977 15.3832 9.32529L13.9496 10.7589C13.9185 10.79 13.9008 10.8321 13.9007 10.8761V12.7335C13.9005 13.3776 13.3778 13.9004 12.7338 13.9005H10.8763C10.8323 13.9006 10.7903 13.9182 10.7591 13.9493L9.32555 15.3829C8.87002 15.8381 8.1307 15.8381 7.67516 15.3829L6.24254 13.9493C6.21134 13.9181 6.16849 13.9005 6.12438 13.9005H4.26696C3.6229 13.9003 3.10117 13.3775 3.10094 12.7335V10.8761C3.10084 10.8323 3.08288 10.79 3.05211 10.7589L1.61852 9.32529C1.16294 8.86971 1.163 8.13052 1.61852 7.6749L3.05211 6.24228C3.08324 6.21113 3.10083 6.16815 3.10094 6.12412V4.2667C3.1011 3.62259 3.62285 3.10084 4.26696 3.10068H6.12438C6.16843 3.10062 6.21135 3.08297 6.24254 3.05185L7.67516 1.61826ZM8.61852 2.32529C8.5535 2.26027 8.44827 2.26042 8.38317 2.32529L6.94957 3.75888C6.73085 3.97753 6.43365 4.10062 6.12438 4.10068H4.26696C4.17514 4.10084 4.1011 4.17488 4.10094 4.2667V6.12412C4.10083 6.43336 3.97781 6.73062 3.75914 6.94931L2.32555 8.38291C2.26077 8.44802 2.26056 8.55327 2.32555 8.61826L3.75914 10.0519C3.97744 10.2705 4.10084 10.5671 4.10094 10.8761V12.7335C4.10117 12.8253 4.17518 12.9003 4.26696 12.9005H6.12438C6.43371 12.9005 6.73084 13.0235 6.94957 13.2423L8.38317 14.6749C8.44825 14.7396 8.55353 14.7398 8.61852 14.6749L10.0521 13.2423C10.2708 13.0236 10.5671 12.9006 10.8763 12.9005H12.7338C12.8256 12.9004 12.9005 12.8253 12.9007 12.7335V10.8761C12.9008 10.5669 13.0239 10.2705 13.2425 10.0519L14.6752 8.61826C14.7401 8.55328 14.7399 8.44802 14.6752 8.38291L13.2425 6.94931C13.0239 6.73062 12.9009 6.43339 12.9007 6.12412V4.2667C12.9006 4.17486 12.8256 4.10081 12.7338 4.10068H10.8763C10.5674 4.10058 10.2708 3.97719 10.0521 3.75888L8.61852 2.32529Z\", fill: \"currentColor\" })] }));\n}\n//# sourceMappingURL=BadgeCheck.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function XCircle(props) {\n return (_jsxs(\"svg\", { width: \"1em\", height: \"1em\", viewBox: \"0 0 16 16\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", \"aria-hidden\": props['aria-label'] || props['aria-labelledby'] ? undefined : true, role: props['aria-label'] || props['aria-labelledby'] ? 'img' : undefined, ...props, children: [_jsx(\"path\", { d: \"M9.64648 5.64648C9.84175 5.45122 10.1583 5.45122 10.3535 5.64648C10.5487 5.84175 10.5488 6.15827 10.3535 6.35352L8.70703 8L10.3535 9.64648C10.5487 9.84175 10.5488 10.1583 10.3535 10.3535C10.1583 10.5488 9.84175 10.5487 9.64648 10.3535L8 8.70703L6.35352 10.3535C6.15827 10.5488 5.84175 10.5487 5.64648 10.3535C5.45122 10.1583 5.45122 9.84175 5.64648 9.64648L7.29297 8L5.64648 6.35352C5.45122 6.15825 5.45122 5.84175 5.64648 5.64648C5.84175 5.45122 6.15825 5.45122 6.35352 5.64648L8 7.29297L9.64648 5.64648Z\", fill: \"currentColor\" }), _jsx(\"path\", { fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M8 1.33301C11.6817 1.33318 14.666 4.31919 14.666 8.00098C14.6656 11.6824 11.6815 14.6668 8 14.667C4.31837 14.667 1.33345 11.6825 1.33301 8.00098C1.33301 4.31908 4.3181 1.33301 8 1.33301ZM8 2.33398C4.87039 2.33398 2.33301 4.87137 2.33301 8.00098C2.33345 11.1302 4.87066 13.667 8 13.667C11.1292 13.6668 13.6656 11.1301 13.666 8.00098C13.666 4.87147 11.1294 2.33416 8 2.33398Z\", fill: \"currentColor\" })] }));\n}\n//# sourceMappingURL=XCircle.js.map","export default import.meta.ROLLDOWN_FILE_URL_Msg57USEadASvSStYSdmzA","export default import.meta.ROLLDOWN_FILE_URL_rN_1li4k2aIbHGs0zKW8QQ","export default import.meta.ROLLDOWN_FILE_URL_epdbhdyBUyD3hvxx0_dcTg","export default import.meta.ROLLDOWN_FILE_URL_dJ$ULFcuzX43djbIEsCZPw","export default import.meta.ROLLDOWN_FILE_URL_hO4dd8ILk$iZF7aFIOUkdg","export default import.meta.ROLLDOWN_FILE_URL_ykb1zIozoJBMq4UvQnlhcQ","export default import.meta.ROLLDOWN_FILE_URL_U2YZxvNlcnuoWcGKwa9Wsw","export default import.meta.ROLLDOWN_FILE_URL_BjjUHagISQHtPWYmu3KuwQ","export default import.meta.ROLLDOWN_FILE_URL_gOpBNSELCNdnM_yZlyA5OQ","export default import.meta.ROLLDOWN_FILE_URL_ZoP2ebLT5e$hm8jPkF9mgA","export default import.meta.ROLLDOWN_FILE_URL_2$LtLFQdS6IeO$uJxLxRJQ","export default import.meta.ROLLDOWN_FILE_URL_cLZLOsSELI_GmwKcVOKKRw","export default import.meta.ROLLDOWN_FILE_URL__ewJD0zO9$SsiDvawfmAUw","export default import.meta.ROLLDOWN_FILE_URL_m8R6TgWxwop2r_xOIPNRtg","export default import.meta.ROLLDOWN_FILE_URL_6MQCagmCrZzS5dHPKhXWKQ","export default import.meta.ROLLDOWN_FILE_URL_7PUm3F_uVf$21BIFLSklvQ","export default import.meta.ROLLDOWN_FILE_URL_C$4kQWR6NkPB83QJdL0WCQ","export default import.meta.ROLLDOWN_FILE_URL_pADEGV0e5Qot5ZhzD_GrLg","export default import.meta.ROLLDOWN_FILE_URL_SH3JcDOvWNcn2WIvxBnLpg","export default import.meta.ROLLDOWN_FILE_URL_K1daVVNYU_lXF$FdA5v55g","export default import.meta.ROLLDOWN_FILE_URL_E8wuXQ_AmxPT2QBGX_$9Vw","export default import.meta.ROLLDOWN_FILE_URL_9kBTUqaINCHDANxrI10WCw","export default import.meta.ROLLDOWN_FILE_URL_2ZEzIIM_atdpHcr$6kvj$Q","export default import.meta.ROLLDOWN_FILE_URL_q6tfGKm3Qmt5DJmATeHQdA","export default import.meta.ROLLDOWN_FILE_URL_OestAvA2SyLT4CG6L76dAw","export default import.meta.ROLLDOWN_FILE_URL_nJkgIVJgL11RgZiGUBj6wA","export default import.meta.ROLLDOWN_FILE_URL_tgFyw$X211zXSctfMU9_LA","export default import.meta.ROLLDOWN_FILE_URL_aLISaAY6NSiJFT$6GdtrfA","export default import.meta.ROLLDOWN_FILE_URL_U6muqRGa8aHtq8t0c9wAzg","export default import.meta.ROLLDOWN_FILE_URL_TX5a1iViCylaCWPFSCQG2w","export default import.meta.ROLLDOWN_FILE_URL_LphhLScmzwPqWwTyAbd7ig","export default import.meta.ROLLDOWN_FILE_URL_i2ywl_YzKp2MjtOEr7ngzA","export default import.meta.ROLLDOWN_FILE_URL_yW_eMvu1QqHghXJHMLbBbg","export default import.meta.ROLLDOWN_FILE_URL_y3WuTrdTs_Si7uYpRddj9w","export default import.meta.ROLLDOWN_FILE_URL_kSHvwCjLFxLpY3FM1MyAsA","export default import.meta.ROLLDOWN_FILE_URL_0PgJxXqjw$KAl6PgZjQb5g","export default import.meta.ROLLDOWN_FILE_URL_07gvO1IvTzTCTyYqp_a5mw","export default import.meta.ROLLDOWN_FILE_URL_EsSyonNWXFChOyjfj2S3nw","export default import.meta.ROLLDOWN_FILE_URL_zOyQqdNGsn0lL_XEFrarVA","/** Shows a requested key's limits and expiry, and warns about unrecognized calls. @module */\nimport { Callout, Inline, Popover, Stack, Tag, Tooltip } from '@tempoxyz/ds'\nimport { CheckCircle, InfoCircle, XCircle } from '@tempoxyz/ds/icons'\nimport { type ReactNode, useId, useState } from 'react'\nimport type * as KeyAuthorization from '../../internal/KeyAuthorization.js'\nimport { style } from '../zyzz.config.js'\n\n/**\n * Each token's icon URL, by symbol. Each icon stays its own file, since an inlined icon would put\n * every token's icon in the script of each page that shows a key.\n */\nconst icons = Object.fromEntries(\n Object.entries(\n import.meta.glob<string>('./icons/*.{png,svg,webp}', {\n eager: true,\n import: 'default',\n query: '?no-inline',\n }),\n ).map(([file, url]) => [\n file.slice('./icons/'.length, file.lastIndexOf('.')),\n url,\n ]),\n)\n\n/** Logos from `logos/`, by symbol and color scheme, each its own file. A logo replaces the icon. */\nconst logos = Object.entries(\n import.meta.glob<string>('./logos/*.{light,dark}.{png,svg,webp}', {\n eager: true,\n import: 'default',\n query: '?no-inline',\n }),\n).reduce<Record<string, { dark?: string; light?: string }>>(\n (result, [file, url]) => {\n const [, symbol, scheme] = file.match(\n /^\\.\\/logos\\/(.+)\\.(light|dark)\\.\\w+$/,\n )!\n result[symbol!] = { ...result[symbol!], [scheme!]: url }\n return result\n },\n {},\n)\n\n/** What the requested key may and may not do, with its limits and expiry. */\nexport function Grant(props: Grant.Props): ReactNode {\n // Several grants can share a document, so each derives its own IDs.\n const id = useId()\n const deniedId = useId()\n const detailsId = useId()\n // The unrecognized calls stay collapsed under their one-line warning until the user opens them.\n const [details, setDetails] = useState(false)\n const { calls, expiry, limits, unrecognized } = props.keyAuthorization\n const Heading = props.heading ?? 'h2'\n // MPP sessions pay through payment channels, which `open` starts and `topUp` funds. Both read as\n // funds the app holds, since a channel is an escrow that the service draws from.\n const channels = (() => {\n const open = calls.some((call) => call.call === 'open')\n const topUp = calls.some((call) => call.call === 'topUp')\n if (open) return 'Hold funds for services'\n if (topUp) return 'Add to funds it holds for services'\n return undefined\n })()\n return (\n <>\n <Stack\n {...styles.section()}\n aria-labelledby={id}\n gap=\"24\"\n render={<section />}\n >\n {props.chain ? (\n <Tag\n {...styles.chain()}\n aria-label={`Chain: ${props.chain}`}\n intent=\"neutral\"\n shape=\"rounded\"\n size=\"small\"\n >\n {props.chain}\n </Tag>\n ) : null}\n <Stack gap=\"12\">\n <Heading {...styles.heading()} id={id}>\n This app will be able to:\n </Heading>\n <Stack\n {...styles.list()}\n aria-labelledby={id}\n gap=\"8\"\n render={<ul />}\n >\n <Inline gap=\"8\" render={<li />}>\n <CheckCircle {...styles.allowed()} />\n <span>View your balance and activity</span>\n </Inline>\n {limits.map((limit) => (\n <Inline\n gap=\"8\"\n key={`${limit.currency}:${limit.period ?? 0}`}\n render={<li />}\n >\n <CheckCircle {...styles.allowed()} />\n <span>\n Spend{' '}\n {limit.period\n ? `${format(limit)} ${every(limit.period)}`\n : format(limit)}\n </span>\n <span {...styles.icons()}>\n {limit.tokens.map((token) => {\n // Each token's own limit shows on its icon, since the total spans several.\n const label = `${token.symbol}: ${format({ amount: token.amount, currency: limit.currency })}`\n const logo = logos[token.symbol]\n const icon = logo?.light ?? icons[token.symbol]\n return (\n <Tooltip.Root key={token.symbol}>\n <Tooltip.Trigger\n delay={150}\n render={\n <span {...styles.token()} tabIndex={0}>\n {icon ? (\n // The page follows the system color scheme, so the image does too.\n <picture>\n {logo?.dark ? (\n <source\n media=\"(prefers-color-scheme: dark)\"\n srcSet={logo.dark}\n />\n ) : null}\n <img\n {...styles.icon()}\n alt={label}\n height={20}\n src={icon}\n width={20}\n />\n </picture>\n ) : (\n // A token without a logo shows its initial.\n <span\n {...styles.placeholder()}\n aria-label={label}\n role=\"img\"\n >\n {token.symbol[0]}\n </span>\n )}\n </span>\n }\n />\n <Tooltip.Popup>{label}</Tooltip.Popup>\n </Tooltip.Root>\n )\n })}\n </span>\n </Inline>\n ))}\n {channels ? (\n <Inline gap=\"8\" render={<li />}>\n <CheckCircle {...styles.allowed()} />\n <span>\n {channels.slice(0, channels.lastIndexOf(' ') + 1)}\n {/* The last word and the icon wrap together. */}\n <span {...styles.nowrap()}>\n {channels.slice(channels.lastIndexOf(' ') + 1)}{' '}\n <Popover.Root>\n <Popover.Trigger\n aria-label=\"About funds for services\"\n nativeButton={false}\n openOnHover\n render={<InfoCircle {...styles.info()} tabIndex={0} />}\n />\n <Popover.Popup\n {...styles.popup()}\n aria-label=\"Funds for services\"\n >\n <Popover.Description>\n Set aside for pay-as-you-go services that use{' '}\n <a\n {...styles.popupLink()}\n href=\"https://mpp.dev\"\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n MPP\n </a>\n . They take only what you use, and you get the rest\n back.\n </Popover.Description>\n </Popover.Popup>\n </Popover.Root>\n </span>\n </span>\n </Inline>\n ) : null}\n </Stack>\n </Stack>\n <Stack gap=\"12\">\n <Heading {...styles.heading()} id={deniedId}>\n This app won’t be able to:\n </Heading>\n <Stack\n {...styles.list()}\n aria-labelledby={deniedId}\n gap=\"8\"\n render={<ul />}\n >\n <Inline gap=\"8\" render={<li />}>\n <XCircle {...styles.denied()} />\n <span>Spend more than you approve</span>\n </Inline>\n </Stack>\n </Stack>\n <Stack {...styles.details()} gap=\"8\" render={<dl />}>\n <div>\n <dt {...styles.term()}>Expires</dt>{' '}\n <dd {...styles.value()}>\n {until(expiry)}{' '}\n {/* The tooltip's text never reaches the server render, so it shows the visitor's own time zone. */}\n <Tooltip.Root>\n <Tooltip.Trigger\n delay={150}\n render={\n <InfoCircle\n {...styles.info()}\n aria-label=\"Expiry date\"\n role=\"img\"\n tabIndex={0}\n />\n }\n />\n <Tooltip.Popup>\n {new Date(expiry * 1000).toLocaleString(undefined, {\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n month: 'short',\n timeZoneName: 'short',\n year: 'numeric',\n })}\n </Tooltip.Popup>\n </Tooltip.Root>\n </dd>\n </div>\n </Stack>\n </Stack>\n {unrecognized.length ? (\n // A note, not an alert, since the calls are part of the request and interrupt nothing.\n <Callout intent=\"warning\" role=\"note\" size=\"medium\">\n <Callout.Icon />\n <Callout.Content>\n <Stack gap=\"8\">\n <p {...styles.warningTitle()}>This app can take other actions</p>\n {details ? (\n <Stack gap=\"8\" id={detailsId}>\n <p {...styles.warningText()}>\n Tempo ID can’t tell you what these actions do. Approve only\n if you trust this app.\n </p>\n </Stack>\n ) : null}\n </Stack>\n </Callout.Content>\n <Callout.Action\n aria-controls={detailsId}\n aria-expanded={details}\n onClick={() => setDetails((open) => !open)}\n >\n {details ? 'Hide' : 'Show'}\n </Callout.Action>\n </Callout>\n ) : null}\n </>\n )\n}\n\nexport declare namespace Grant {\n type Props = {\n /** The key's chain, shown in the corner. Absent, none shows. */\n chain?: string | undefined\n /** `h2` by default, or `h5` on the flows canvas. */\n heading?: 'h2' | 'h5' | undefined\n /** The key that the app requests. */\n keyAuthorization: KeyAuthorization.Description\n }\n}\n\n/**\n * Groups thousands and keeps every decimal. Each formatter is built at its first use, since a page's\n * first one loads the locale's data, which a page that shows no key never needs.\n */\nlet decimal: Intl.NumberFormat | undefined\n\n/** Formats an expiry's distance, such as `in 7 days`, from its first use. */\nlet relative: Intl.RelativeTimeFormat | undefined\n\n/** The spans of an expiry, largest first. Months and years are approximate. */\nconst spans = [\n ['year', 31_536_000],\n ['month', 2_592_000],\n ['week', 604_800],\n ['day', 86_400],\n ['hour', 3_600],\n ['minute', 60],\n] as const\n\n/** The units of a period, largest first. */\nconst units = [\n ['week', 604_800],\n ['day', 86_400],\n ['hour', 3_600],\n ['minute', 60],\n ['second', 1],\n] as const\n\n/** Returns how often a limit resets, such as `per day` or `every 2 weeks`. */\nfunction every(period: number) {\n const [unit, seconds] = units.find((entry) => period % entry[1] === 0)!\n const count = period / seconds\n return count === 1 ? `per ${unit}` : `every ${count} ${unit}s`\n}\n\n/** Formats a limit in its currency, such as `$1,000`, or as the amount and its code. */\nfunction format(\n limit: Pick<\n KeyAuthorization.Description['limits'][number],\n 'amount' | 'currency'\n >,\n) {\n const amount = limit.amount as Intl.StringNumericLiteral\n try {\n return new Intl.NumberFormat('en-US', {\n currency: limit.currency,\n maximumFractionDigits: 6,\n style: 'currency',\n trailingZeroDisplay: 'stripIfInteger',\n }).format(amount)\n } catch {\n // A yield-bearing token's own symbol is not a currency code.\n decimal ??= new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 })\n return `${decimal.format(amount)} ${limit.currency}`\n }\n}\n\n/**\n * Returns the time until `expiry`, in Unix seconds, in its largest whole span, such as\n * `in 3 months`.\n */\nfunction until(expiry: number) {\n const remaining = expiry - Date.now() / 1000\n const [unit, seconds] =\n spans.find((entry) => remaining + 60 >= entry[1]) ?? spans.at(-1)!\n relative ??= new Intl.RelativeTimeFormat('en-US', { numeric: 'always' })\n return relative.format(Math.max(1, Math.round(remaining / seconds)), unit)\n}\n\nnamespace styles {\n export const allowed = style({\n color: 'green.700',\n flexShrink: 0,\n height: '20',\n width: '20',\n })\n\n export const chain = style({\n insetBlockStart: '16',\n insetInlineEnd: '16',\n position: 'absolute',\n })\n\n export const denied = style({\n color: 'red.700',\n flexShrink: 0,\n height: '20',\n width: '20',\n })\n\n // Each term and its value read as one line of text.\n export const details = style({ margin: '0', typography: 'copy.14' })\n\n export const heading = style({\n color: 'gray.900',\n margin: '0',\n typography: 'copy.14',\n })\n\n export const icon = style({\n borderRadius: 'full',\n display: 'block',\n height: '20',\n width: '20',\n })\n\n // Several tokens overlap, and spread apart while hovered so each symbol can show.\n export const icons = style({\n display: 'flex',\n flexShrink: 0,\n '& > span + span': { marginInlineStart: '-0.375rem !custom' },\n '&:hover > span + span': { marginInlineStart: '4' },\n })\n\n export const info = style({\n color: 'gray.900',\n display: 'inline',\n height: '16',\n outline: 'none',\n verticalAlign: 'middle',\n width: '16',\n ':focus-visible': {\n outline: '2px solid',\n outlineColor: 'blue.700',\n outlineOffset: '2',\n },\n })\n\n export const list = style({\n listStyle: 'none',\n margin: '0',\n padding: '0',\n typography: 'label.14.strong',\n })\n\n export const nowrap = style({ whiteSpace: 'nowrap' })\n\n export const placeholder = style({\n alignItems: 'center',\n backgroundColor: 'background.surface',\n borderRadius: 'full',\n color: 'gray.900',\n display: 'flex',\n height: '20',\n justifyContent: 'center',\n typography: 'label.12',\n width: '20',\n })\n\n export const popup = style({ maxWidth: '256' })\n\n export const popupLink = style({ color: 'blue.700' })\n\n export const section = style({\n backgroundColor: 'gray.100',\n borderRadius: '16',\n margin: '0',\n padding: '20',\n // The chain's tag sits in the section's top-right corner.\n position: 'relative',\n })\n\n export const term = style({ color: 'gray.900', display: 'inline' })\n\n // The ring matches the section's fill, so overlapping tokens stay apart.\n export const token = style({\n borderRadius: 'full',\n outline: '2px solid',\n outlineColor: 'gray.100',\n ':focus-visible': { outlineColor: 'blue.700' },\n // Under reduced motion, the tokens spread apart without a transition.\n '@media (prefers-reduced-motion: no-preference)': {\n transitionDuration: '150',\n transitionProperty: 'margin',\n transitionTimingFunction: 'in-out',\n },\n })\n\n // The expiry reads in the weight of the permissions above it.\n export const value = style({\n display: 'inline',\n margin: '0',\n overflowWrap: 'anywhere',\n typography: 'label.14.strong',\n })\n\n export const warningText = style({ color: 'foreground' })\n\n export const warningTitle = style({ typography: 'label.14.strong' })\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7],"mappings":"A,4gBAcaoF,GAA4BD,EAAM,WAAW,SAAsB,EAAgB,EAAc,CAC5G,GAAM,CACJ,SACA,YACA,QACA,GAAGE,GACDC,EAEEC,EADQR,EACG,CAAC,CAAC,SAAS,MAAM,EAC5B,CACJ,WACA,OACA,QACA,kBACA,eACEP,EAA4B,EAgBhC,OATgBP,EAAiB,MAAOqB,EAAgB,CACtD,MAAA,CANA,OACA,OACA,QACA,WAAYE,CAGR,EACJ,IAAK,CAACC,EAAcC,CAAQ,EAC5B,MAAO,CAAC,CACN,MAAOC,EACP,cAAe,EACjB,EAAGN,CAAY,EACf,uBAAwBhB,CAC1B,CACa,CACf,CAAC,ECjCYuB,GAA4BT,EAAM,WAAW,SAAsB,EAAgB,EAAc,CAC5G,GAAM,CACJ,SACA,YACA,QACA,GAAGE,GACDC,EACEO,EAAQd,EAAsB,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AM,KAAM,GAAUQ,EAAY,IAAMH,EAAM,EAAE,GAAKL,EAAM,GAAG,EAAE,EAElE,MADA,KAAa,IAAI,KAAK,mBAAmB,QAAS,CAAE,QAAS,QAAS,CAAC,EAChED,EAAS,OAAO,KAAK,IAAI,EAAG,KAAK,MAAMS,EAAYL,CAAO,CAAC,EAAGD,CAAI,CAC3E,CAEA,IAAUhB,GAAV,SAAA,EAAA,CACe,EAAA,QAAU,EAOV,EAAA,MAAQ,EAMR,EAAA,OAAS,EAQT,EAAA,QAAU,EAEV,EAAA,QAAU,EAMV,EAAA,KAAO,EAQP,EAAA,MAAQ,EAOR,EAAA,KAAO,EAcP,EAAA,KAAO,EAOP,EAAA,OAAS,EAET,EAAA,YAAc,EAYd,EAAA,MAAQ,EAER,EAAA,UAAY,EAEZ,EAAA,QAAU,EASV,EAAA,KAAO,EAGP,EAAA,MAAQ,EAcR,EAAA,MAAQ,EAOR,EAAA,YAAc,EAEd,EAAA,aAAe,CAC9B,EAAA,CAAA,AAAAA,IAAA,CAAA,CAAA,E"}
|
|
1
|
+
{"version":3,"file":"Grant-D_tun0mF.js","names":["REASONS.closePress","BaseUi.Popover.Close","BaseUi.Popover.Root","BaseUi.Popover.Trigger","_jsx","BaseUi.Popover.Arrow","styles","BaseUi.Popover.Description","BaseUi.Popover.Portal","BaseUi.Popover.Positioner","BaseUi.Popover.Popup","BaseUi.Popover.Title","_jsxs","_jsx","_jsxs","_jsx","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__1_0_","__import_glob__1_1_","useId","useState","_Fragment","__toESM","require_react","require_jsx_runtime","InfoCircle","CheckCircle","Stack","createChangeEventDetails","useRenderElement","useButton","closePress","create","popupStateMapping","useBaseUiId","Tooltip","usePopoverPositionerContext","PopoverRoot","useClosePartRegistration","PopoverPortal","PopoverPositioner","PopoverTrigger","PopoverPopup","usePopoverRootContext","Callout","Inline","Tag","import_react","PopoverArrow","elementProps","componentProps","open","arrowUncentered","forwardedRef","arrowRef","arrowStyles","PopoverTitle","store","id","PopoverDescription","PopoverClose","nativeButton","buttonRef","event","getButtonProps","import_jsx_runtime","Popover","Arrow","attributes","props","styles$1","Description","Popup","Title","BadgeCheck","XCircle","BRLA_default","BRZ_default","CHFAU_default","DLUSD_default","EURAU_default","EURC_e_default","GBPA_default","GUSD_default","MACH_default","OUSD_default","PRIME_default","SBC_default","SEKAU_default","USD1_default","USDB_default","USDC_e_default","USDT0_default","USDY_default","USDe_default","YLDS_default","alphaUSD_default","betaUSD_default","cUSD_default","cbBTC_default","frxUSD_default","goUSD_default","iUSD_default","pathUSD_default","rUSD_default","reUSD_default","sUSDe_default","siUSD_default","stcUSD_default","syrupUSDC_default","thetaUSD_default","wYLDS_default","wsrUSD_default","OUSD_dark_default","OUSD_light_default","icons","file","url","logos","symbol","scheme","result","Grant","deniedId","detailsId","details","setDetails","Heading","channels","calls","call","topUp","styles","limits","limit","format","every","label","token","logo","icon","until","expiry","unrecognized","decimal","relative","spans","units","unit","seconds","period","entry","count","amount","remaining"],"sources":["../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/arrow/PopoverArrow.mjs","../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/title/PopoverTitle.mjs","../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/description/PopoverDescription.mjs","../../../../../node_modules/.pnpm/@base-ui+react@1.9.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/popover/close/PopoverClose.mjs","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/components/Popover.css","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/components/Popover.js","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/icons/BadgeCheck.js","../../../../../node_modules/.pnpm/@tempoxyz+ds@0.2.6_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react-native@0.86_f564df10a26f3190a3aaf6288ad1f3d1/node_modules/@tempoxyz/ds/dist/web/icons/XCircle.js","../../../components/icons/BRLA.png?no-inline","../../../components/icons/BRZ.svg?no-inline","../../../components/icons/CHFAU.png?no-inline","../../../components/icons/DLUSD.png?no-inline","../../../components/icons/EURAU.svg?no-inline","../../../components/icons/EURC.e.svg?no-inline","../../../components/icons/GBPA.svg?no-inline","../../../components/icons/GUSD.svg?no-inline","../../../components/icons/MACH.svg?no-inline","../../../components/icons/OUSD.svg?no-inline","../../../components/icons/PRIME.svg?no-inline","../../../components/icons/SBC.svg?no-inline","../../../components/icons/SEKAU.svg?no-inline","../../../components/icons/USD1.svg?no-inline","../../../components/icons/USDB.svg?no-inline","../../../components/icons/USDC.e.svg?no-inline","../../../components/icons/USDT0.svg?no-inline","../../../components/icons/USDY.svg?no-inline","../../../components/icons/USDe.svg?no-inline","../../../components/icons/YLDS.svg?no-inline","../../../components/icons/alphaUSD.svg?no-inline","../../../components/icons/betaUSD.svg?no-inline","../../../components/icons/cUSD.svg?no-inline","../../../components/icons/cbBTC.svg?no-inline","../../../components/icons/frxUSD.svg?no-inline","../../../components/icons/goUSD.svg?no-inline","../../../components/icons/iUSD.svg?no-inline","../../../components/icons/pathUSD.svg?no-inline","../../../components/icons/rUSD.svg?no-inline","../../../components/icons/reUSD.svg?no-inline","../../../components/icons/sUSDe.svg?no-inline","../../../components/icons/siUSD.svg?no-inline","../../../components/icons/stcUSD.svg?no-inline","../../../components/icons/syrupUSDC.svg?no-inline","../../../components/icons/thetaUSD.svg?no-inline","../../../components/icons/wYLDS.svg?no-inline","../../../components/icons/wsrUSD.svg?no-inline","../../../components/logos/OUSD.dark.svg?no-inline","../../../components/logos/OUSD.light.svg?no-inline","../../../components/Grant.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { usePopoverPositionerContext } from \"../positioner/PopoverPositionerContext.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Displays an element positioned against the popover anchor.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverArrow = /*#__PURE__*/React.forwardRef(function PopoverArrow(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const open = store.useState('open');\n const {\n arrowRef,\n side,\n align,\n arrowUncentered,\n arrowStyles\n } = usePopoverPositionerContext();\n const state = {\n open,\n side,\n align,\n uncentered: arrowUncentered\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, arrowRef],\n props: [{\n style: arrowStyles,\n 'aria-hidden': true\n }, elementProps],\n stateAttributesMapping: popupStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverArrow.displayName = \"PopoverArrow\";","'use client';\n\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\n\n/**\n * A heading that labels the popover.\n * Renders an `<h2>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverTitle = /*#__PURE__*/React.forwardRef(function PopoverTitle(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const id = useBaseUiId(elementProps.id);\n store.useSyncedValueWithCleanup('titleElementId', id);\n const element = useRenderElement('h2', componentProps, {\n ref: forwardedRef,\n props: [{\n id\n }, elementProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverTitle.displayName = \"PopoverTitle\";","'use client';\n\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A paragraph with additional information about the popover.\n * Renders a `<p>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverDescription = /*#__PURE__*/React.forwardRef(function PopoverDescription(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const id = useBaseUiId(elementProps.id);\n store.useSyncedValueWithCleanup('descriptionElementId', id);\n const element = useRenderElement('p', componentProps, {\n ref: forwardedRef,\n props: [{\n id\n }, elementProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverDescription.displayName = \"PopoverDescription\";","'use client';\n\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useClosePartRegistration } from \"../../utils/closePart.mjs\";\n\n/**\n * A button that closes the popover.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport const PopoverClose = /*#__PURE__*/React.forwardRef(function PopoverClose(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n disabled = false,\n nativeButton = true,\n ...elementProps\n } = componentProps;\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n disabled,\n focusableWhenDisabled: false,\n native: nativeButton\n });\n const store = usePopoverRootContext();\n useClosePartRegistration();\n const element = useRenderElement('button', componentProps, {\n ref: [forwardedRef, buttonRef],\n props: [{\n onClick(event) {\n store.setOpen(false, createChangeEventDetails(REASONS.closePress, event.nativeEvent));\n }\n }, elementProps, getButtonProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverClose.displayName = \"PopoverClose\";",".z_tds_2f_web-WYxykg0{color:var(--z-tds_2f_web-color-background-raised,light-dark(#fff,#1f1e1e))}.z_tds_2f_web-WYxykg1{display:flex}.z_tds_2f_web-WYxykg2{&[data-side=bottom]{top:-10px}}.z_tds_2f_web-WYxykg3{&[data-side=left]{right:-14px}}.z_tds_2f_web-WYxykg4{&[data-side=left]{rotate:90deg}}.z_tds_2f_web-WYxykg5{&[data-side=right]{left:-14px}}.z_tds_2f_web-WYxykg6{&[data-side=right]{rotate:-90deg}}.z_tds_2f_web-WYxykg7{&[data-side=top]{bottom:-10px}}.z_tds_2f_web-WYxykg8{&[data-side=top]{rotate:180deg}}.z_tds_2f_web-WYxykg9{color:var(--z-tds_2f_web-color-gray-900,light-dark(#4d4d4d,#bcbbbb))}.z_tds_2f_web-WYxykga{margin:var(--z-tds_2f_web-spacing-0,0rem)}.z_tds_2f_web-WYxykgb{font-family:var(--z-tds_2f_web-typography-copy-14-fontFamily,Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\")}.z_tds_2f_web-WYxykgc{font-size:var(--z-tds_2f_web-typography-copy-14-fontSize,14px)}.z_tds_2f_web-WYxykgd{font-weight:var(--z-tds_2f_web-typography-copy-14-fontWeight,450)}.z_tds_2f_web-WYxykge{letter-spacing:var(--z-tds_2f_web-typography-copy-14-letterSpacing,-.09px)}.z_tds_2f_web-WYxykgf{line-height:var(--z-tds_2f_web-typography-copy-14-lineHeight,20px)}.z_tds_2f_web-WYxykgg{background-color:var(--z-tds_2f_web-color-background-raised,light-dark(#fff,#1f1e1e))}.z_tds_2f_web-WYxykgh{border-radius:var(--z-tds_2f_web-radius-16,1rem)}.z_tds_2f_web-WYxykgi{box-shadow:var(--z-tds_2f_web-shadow-popover,0 0 0 1px light-dark(#0000000f,#ffffff14), 0 8px 24px -4px #0000001f, 0 24px 48px -12px #00000029)}.z_tds_2f_web-WYxykgj{box-sizing:border-box}.z_tds_2f_web-WYxykgk{color:var(--z-tds_2f_web-color-foreground,light-dark(#171717,#fff))}.z_tds_2f_web-WYxykgl{max-width:var(--available-width)}.z_tds_2f_web-WYxykgm{outline:none}.z_tds_2f_web-WYxykgn{padding:var(--z-tds_2f_web-spacing-24,1.5rem)}.z_tds_2f_web-WYxykgo{transform-origin:var(--transform-origin)}.z_tds_2f_web-WYxykgp{transition-duration:var(--z-tds_2f_web-transitionDuration-200,.2s)}.z_tds_2f_web-WYxykgq{transition-property:opacity,scale}.z_tds_2f_web-WYxykgr{transition-timing-function:var(--z-tds_2f_web-ease-snappy,cubic-bezier(.23, 1, .32, 1))}.z_tds_2f_web-WYxykgs{width:max-content}.z_tds_2f_web-WYxykgt{&[data-ending-style]{opacity:0}}.z_tds_2f_web-WYxykgu{&[data-ending-style]{scale:var(--z-tds_2f_web-scale-enter,.96)}}.z_tds_2f_web-WYxykgv{&[data-ending-style]{transition-duration:var(--z-tds_2f_web-transitionDuration-140,.14s)}}.z_tds_2f_web-WYxykgw{&[data-starting-style]{opacity:0}}.z_tds_2f_web-WYxykgx{&[data-starting-style]{scale:var(--z-tds_2f_web-scale-enter,.96)}}@media (prefers-reduced-motion:reduce){.z_tds_2f_web-WYxykgy{transition-property:opacity}.z_tds_2f_web-WYxykgz{&[data-ending-style],&[data-starting-style]{scale:none}}}.z_tds_2f_web-WYxykg10{z-index:var(--z-tds_2f_web-zIndex-popover,50)}.z_tds_2f_web-WYxykg11{font-family:var(--z-tds_2f_web-typography-heading-20-fontFamily,Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\")}.z_tds_2f_web-WYxykg12{font-size:var(--z-tds_2f_web-typography-heading-20-fontSize,20px)}.z_tds_2f_web-WYxykg13{font-weight:var(--z-tds_2f_web-typography-heading-20-fontWeight,600)}.z_tds_2f_web-WYxykg14{letter-spacing:var(--z-tds_2f_web-typography-heading-20-letterSpacing,-.33px)}.z_tds_2f_web-WYxykg15{line-height:var(--z-tds_2f_web-typography-heading-20-lineHeight,26px)}.z_tds_2f_web-WYxykg16{margin:var(--z-tds_2f_web-spacing-0,0rem)}.z_tds_2f_web-WYxykg17{margin-bottom:var(--z-tds_2f_web-spacing-4,.25rem)}","\nimport { Props as __zyzzProps } from 'zyzz/runtime';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as BaseUi from '@base-ui/react/popover';\nimport { style } from '../zyzz.config.js';\n/**\n * A non-modal `dialog` anchored to a trigger and opened on click. Opening moves focus to the first\n * tabbable element inside, or to the popup on touch. Escape and outside presses close it and\n * return focus to the trigger.\n *\n * - Use it for interactive or longer content. Use `Tooltip` for a short hint on hover.\n * - Include `Title` so the dialog has an accessible name, and `Description` for supporting text.\n * - Offer `Close` when the popup holds a form or other controls.\n *\n * @example\n * <Popover.Root>\n * <Popover.Trigger render={<Button variant=\"secondary\" />}>Network fee</Popover.Trigger>\n * <Popover.Popup>\n * <Popover.Title>Network fee</Popover.Title>\n * <Popover.Description>Paid in the token you send.</Popover.Description>\n * </Popover.Popup>\n * </Popover.Root>\n *\n * @see {@link https://base-ui.com/react/components/popover | Base UI Popover}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Popover_API | MDN Popover API}\n * @see {@link https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html | WCAG 2.2 Content on Hover or Focus}\n * @see {@link https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html | WCAG 2.2 Focus Order}\n * @see {@link https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html | WCAG 2.2 Keyboard}\n */\nexport var Popover;\n(function (Popover) {\n /** Renders a `button` that closes the popover. Pass `render` to use a `Button`. */\n Popover.Close = BaseUi.Popover.Close;\n /**\n * Owns the open state. Pass `open` and `onOpenChange` to control it. Unless `modal` is set, the\n * page stays interactive while the popover is open.\n */\n Popover.Root = BaseUi.Popover.Root;\n /**\n * Toggles the popover on click and anchors the popup. Set `openOnHover` to also open it on hover.\n *\n * @example\n * <Popover.Trigger render={<Button variant=\"secondary\" />}>Network fee</Popover.Trigger>\n */\n Popover.Trigger = BaseUi.Popover.Trigger;\n /** Draws a pointer toward the trigger on the popup's anchored side. Place it inside `Popup`. */\n function Arrow(props) {\n const { className, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Arrow, { ...attributes, ...styles.arrow({ className, style: props.style, vars }), children: _jsx(\"svg\", { \"aria-hidden\": \"true\", fill: \"currentColor\", height: \"10\", viewBox: \"0 0 20 10\", width: \"20\", children: _jsx(\"path\", { d: \"M0 10C4 10 7 7 8.6 4.6a2 2 0 0 1 2.8 0C13 7 16 10 20 10Z\" }) }) }));\n }\n Popover.Arrow = Arrow;\n /** Renders a `p` that describes the popup through `aria-describedby`. */\n function Description(props) {\n const { className, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Description, { ...attributes, ...styles.description({ className, style: props.style, vars }) }));\n }\n Popover.Description = Description;\n /**\n * Renders the portal, positioner and popup. Placement props go to the positioner, which sits 8px\n * from the trigger unless `sideOffset` is set. Other props, `ref`, `className` and `style` reach\n * the popup. `initialFocus` and `finalFocus` override where focus moves on open and close.\n */\n function Popup(props) {\n const { align, alignOffset, anchor, className, collisionPadding, side, sideOffset = 8, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Portal, { children: _jsx(BaseUi.Popover.Positioner, { ...styles.positioner(), align: align, alignOffset: alignOffset, anchor: anchor, collisionPadding: collisionPadding, side: side, sideOffset: sideOffset, children: _jsx(BaseUi.Popover.Popup, { ...attributes, ...styles.popup({ className, style: props.style, vars }) }) }) }));\n }\n Popover.Popup = Popup;\n /** Renders an `h2` that names the popup through `aria-labelledby`. */\n function Title(props) {\n const { className, vars, ...attributes } = props;\n return (_jsx(BaseUi.Popover.Title, { ...attributes, ...styles.title({ className, style: props.style, vars }) }));\n }\n Popover.Title = Title;\n})(Popover || (Popover = {}));\nvar styles;\n(function (styles) {\n styles.arrow = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg0 z_tds_2f_web-WYxykg1 z_tds_2f_web-WYxykg2 z_tds_2f_web-WYxykg3 z_tds_2f_web-WYxykg4 z_tds_2f_web-WYxykg5 z_tds_2f_web-WYxykg6 z_tds_2f_web-WYxykg7 z_tds_2f_web-WYxykg8\"});\n styles.description = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg9 z_tds_2f_web-WYxykga z_tds_2f_web-WYxykgb z_tds_2f_web-WYxykgc z_tds_2f_web-WYxykgd z_tds_2f_web-WYxykge z_tds_2f_web-WYxykgf\"});\n styles.popup = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykgg z_tds_2f_web-WYxykgh z_tds_2f_web-WYxykgi z_tds_2f_web-WYxykgj z_tds_2f_web-WYxykgk z_tds_2f_web-WYxykgl z_tds_2f_web-WYxykgm z_tds_2f_web-WYxykgn z_tds_2f_web-WYxykgo z_tds_2f_web-WYxykgp z_tds_2f_web-WYxykgq z_tds_2f_web-WYxykgr z_tds_2f_web-WYxykgb z_tds_2f_web-WYxykgc z_tds_2f_web-WYxykgd z_tds_2f_web-WYxykge z_tds_2f_web-WYxykgf z_tds_2f_web-WYxykgs z_tds_2f_web-WYxykgt z_tds_2f_web-WYxykgu z_tds_2f_web-WYxykgv z_tds_2f_web-WYxykgw z_tds_2f_web-WYxykgx z_tds_2f_web-WYxykgy z_tds_2f_web-WYxykgz\"});\n styles.positioner = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg10\"});\n styles.title = /*#__PURE__*/__zyzzProps.create({className:\"z_tds_2f_web-WYxykg11 z_tds_2f_web-WYxykg12 z_tds_2f_web-WYxykg13 z_tds_2f_web-WYxykg14 z_tds_2f_web-WYxykg15 z_tds_2f_web-WYxykg16 z_tds_2f_web-WYxykg17\"});\n})(styles || (styles = {}));\n//# sourceMappingURL=Popover.js.map\nimport './Popover.css';\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function BadgeCheck(props) {\n return (_jsxs(\"svg\", { width: \"1em\", height: \"1em\", viewBox: \"0 0 16 16\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", \"aria-hidden\": props['aria-label'] || props['aria-labelledby'] ? undefined : true, role: props['aria-label'] || props['aria-labelledby'] ? 'img' : undefined, ...props, children: [_jsx(\"path\", { d: \"M9.9691 6.50791C10.1268 6.28127 10.4387 6.2253 10.6654 6.38291C10.8915 6.54061 10.9476 6.85173 10.7904 7.07822L8.1859 10.8253C8.10463 10.9422 7.97661 11.0189 7.83532 11.0362C7.69403 11.0533 7.5516 11.009 7.44469 10.9151L5.95641 9.60361C5.74921 9.42107 5.72894 9.10476 5.91149 8.89756C6.09407 8.69075 6.4095 8.67124 6.61657 8.85361L7.68395 9.79306L9.9691 6.50791Z\", fill: \"currentColor\" }), _jsx(\"path\", { fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M7.67516 1.61826C8.13077 1.16265 8.86994 1.16265 9.32555 1.61826L10.7591 3.05185C10.7902 3.08262 10.8326 3.10058 10.8763 3.10068H12.7338C13.3779 3.10081 13.9006 3.62258 13.9007 4.2667V6.12412C13.9009 6.16817 13.9184 6.21112 13.9496 6.24228L15.3832 7.6749C15.8384 8.13047 15.8385 8.86977 15.3832 9.32529L13.9496 10.7589C13.9185 10.79 13.9008 10.8321 13.9007 10.8761V12.7335C13.9005 13.3776 13.3778 13.9004 12.7338 13.9005H10.8763C10.8323 13.9006 10.7903 13.9182 10.7591 13.9493L9.32555 15.3829C8.87002 15.8381 8.1307 15.8381 7.67516 15.3829L6.24254 13.9493C6.21134 13.9181 6.16849 13.9005 6.12438 13.9005H4.26696C3.6229 13.9003 3.10117 13.3775 3.10094 12.7335V10.8761C3.10084 10.8323 3.08288 10.79 3.05211 10.7589L1.61852 9.32529C1.16294 8.86971 1.163 8.13052 1.61852 7.6749L3.05211 6.24228C3.08324 6.21113 3.10083 6.16815 3.10094 6.12412V4.2667C3.1011 3.62259 3.62285 3.10084 4.26696 3.10068H6.12438C6.16843 3.10062 6.21135 3.08297 6.24254 3.05185L7.67516 1.61826ZM8.61852 2.32529C8.5535 2.26027 8.44827 2.26042 8.38317 2.32529L6.94957 3.75888C6.73085 3.97753 6.43365 4.10062 6.12438 4.10068H4.26696C4.17514 4.10084 4.1011 4.17488 4.10094 4.2667V6.12412C4.10083 6.43336 3.97781 6.73062 3.75914 6.94931L2.32555 8.38291C2.26077 8.44802 2.26056 8.55327 2.32555 8.61826L3.75914 10.0519C3.97744 10.2705 4.10084 10.5671 4.10094 10.8761V12.7335C4.10117 12.8253 4.17518 12.9003 4.26696 12.9005H6.12438C6.43371 12.9005 6.73084 13.0235 6.94957 13.2423L8.38317 14.6749C8.44825 14.7396 8.55353 14.7398 8.61852 14.6749L10.0521 13.2423C10.2708 13.0236 10.5671 12.9006 10.8763 12.9005H12.7338C12.8256 12.9004 12.9005 12.8253 12.9007 12.7335V10.8761C12.9008 10.5669 13.0239 10.2705 13.2425 10.0519L14.6752 8.61826C14.7401 8.55328 14.7399 8.44802 14.6752 8.38291L13.2425 6.94931C13.0239 6.73062 12.9009 6.43339 12.9007 6.12412V4.2667C12.9006 4.17486 12.8256 4.10081 12.7338 4.10068H10.8763C10.5674 4.10058 10.2708 3.97719 10.0521 3.75888L8.61852 2.32529Z\", fill: \"currentColor\" })] }));\n}\n//# sourceMappingURL=BadgeCheck.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function XCircle(props) {\n return (_jsxs(\"svg\", { width: \"1em\", height: \"1em\", viewBox: \"0 0 16 16\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", \"aria-hidden\": props['aria-label'] || props['aria-labelledby'] ? undefined : true, role: props['aria-label'] || props['aria-labelledby'] ? 'img' : undefined, ...props, children: [_jsx(\"path\", { d: \"M9.64648 5.64648C9.84175 5.45122 10.1583 5.45122 10.3535 5.64648C10.5487 5.84175 10.5488 6.15827 10.3535 6.35352L8.70703 8L10.3535 9.64648C10.5487 9.84175 10.5488 10.1583 10.3535 10.3535C10.1583 10.5488 9.84175 10.5487 9.64648 10.3535L8 8.70703L6.35352 10.3535C6.15827 10.5488 5.84175 10.5487 5.64648 10.3535C5.45122 10.1583 5.45122 9.84175 5.64648 9.64648L7.29297 8L5.64648 6.35352C5.45122 6.15825 5.45122 5.84175 5.64648 5.64648C5.84175 5.45122 6.15825 5.45122 6.35352 5.64648L8 7.29297L9.64648 5.64648Z\", fill: \"currentColor\" }), _jsx(\"path\", { fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M8 1.33301C11.6817 1.33318 14.666 4.31919 14.666 8.00098C14.6656 11.6824 11.6815 14.6668 8 14.667C4.31837 14.667 1.33345 11.6825 1.33301 8.00098C1.33301 4.31908 4.3181 1.33301 8 1.33301ZM8 2.33398C4.87039 2.33398 2.33301 4.87137 2.33301 8.00098C2.33345 11.1302 4.87066 13.667 8 13.667C11.1292 13.6668 13.6656 11.1301 13.666 8.00098C13.666 4.87147 11.1294 2.33416 8 2.33398Z\", fill: \"currentColor\" })] }));\n}\n//# sourceMappingURL=XCircle.js.map","export default import.meta.ROLLDOWN_FILE_URL_epdbhdyBUyD3hvxx0_dcTg","export default import.meta.ROLLDOWN_FILE_URL_Msg57USEadASvSStYSdmzA","export default import.meta.ROLLDOWN_FILE_URL_dJ$ULFcuzX43djbIEsCZPw","export default import.meta.ROLLDOWN_FILE_URL_ykb1zIozoJBMq4UvQnlhcQ","export default import.meta.ROLLDOWN_FILE_URL_BjjUHagISQHtPWYmu3KuwQ","export default import.meta.ROLLDOWN_FILE_URL_gOpBNSELCNdnM_yZlyA5OQ","export default import.meta.ROLLDOWN_FILE_URL_ZoP2ebLT5e$hm8jPkF9mgA","export default import.meta.ROLLDOWN_FILE_URL_U2YZxvNlcnuoWcGKwa9Wsw","export default import.meta.ROLLDOWN_FILE_URL_2$LtLFQdS6IeO$uJxLxRJQ","export default import.meta.ROLLDOWN_FILE_URL_cLZLOsSELI_GmwKcVOKKRw","export default import.meta.ROLLDOWN_FILE_URL__ewJD0zO9$SsiDvawfmAUw","export default import.meta.ROLLDOWN_FILE_URL_rN_1li4k2aIbHGs0zKW8QQ","export default import.meta.ROLLDOWN_FILE_URL_m8R6TgWxwop2r_xOIPNRtg","export default import.meta.ROLLDOWN_FILE_URL_6MQCagmCrZzS5dHPKhXWKQ","export default import.meta.ROLLDOWN_FILE_URL_hO4dd8ILk$iZF7aFIOUkdg","export default import.meta.ROLLDOWN_FILE_URL_pADEGV0e5Qot5ZhzD_GrLg","export default import.meta.ROLLDOWN_FILE_URL_SH3JcDOvWNcn2WIvxBnLpg","export default import.meta.ROLLDOWN_FILE_URL_K1daVVNYU_lXF$FdA5v55g","export default import.meta.ROLLDOWN_FILE_URL_7PUm3F_uVf$21BIFLSklvQ","export default import.meta.ROLLDOWN_FILE_URL_9kBTUqaINCHDANxrI10WCw","export default import.meta.ROLLDOWN_FILE_URL_E8wuXQ_AmxPT2QBGX_$9Vw","export default import.meta.ROLLDOWN_FILE_URL_2ZEzIIM_atdpHcr$6kvj$Q","export default import.meta.ROLLDOWN_FILE_URL_C$4kQWR6NkPB83QJdL0WCQ","export default import.meta.ROLLDOWN_FILE_URL_q6tfGKm3Qmt5DJmATeHQdA","export default import.meta.ROLLDOWN_FILE_URL_OestAvA2SyLT4CG6L76dAw","export default import.meta.ROLLDOWN_FILE_URL_nJkgIVJgL11RgZiGUBj6wA","export default import.meta.ROLLDOWN_FILE_URL_tgFyw$X211zXSctfMU9_LA","export default import.meta.ROLLDOWN_FILE_URL_aLISaAY6NSiJFT$6GdtrfA","export default import.meta.ROLLDOWN_FILE_URL_LphhLScmzwPqWwTyAbd7ig","export default import.meta.ROLLDOWN_FILE_URL_U6muqRGa8aHtq8t0c9wAzg","export default import.meta.ROLLDOWN_FILE_URL_i2ywl_YzKp2MjtOEr7ngzA","export default import.meta.ROLLDOWN_FILE_URL_TX5a1iViCylaCWPFSCQG2w","export default import.meta.ROLLDOWN_FILE_URL_y3WuTrdTs_Si7uYpRddj9w","export default import.meta.ROLLDOWN_FILE_URL_kSHvwCjLFxLpY3FM1MyAsA","export default import.meta.ROLLDOWN_FILE_URL_0PgJxXqjw$KAl6PgZjQb5g","export default import.meta.ROLLDOWN_FILE_URL_EsSyonNWXFChOyjfj2S3nw","export default import.meta.ROLLDOWN_FILE_URL_zOyQqdNGsn0lL_XEFrarVA","export default import.meta.ROLLDOWN_FILE_URL_07gvO1IvTzTCTyYqp_a5mw","export default import.meta.ROLLDOWN_FILE_URL_yW_eMvu1QqHghXJHMLbBbg","/** Shows a requested key's limits and expiry, and warns about unrecognized calls. @module */\nimport { Callout, Inline, Popover, Stack, Tag, Tooltip } from '@tempoxyz/ds'\nimport { CheckCircle, InfoCircle, XCircle } from '@tempoxyz/ds/icons'\nimport { type ReactNode, useId, useState } from 'react'\nimport type * as KeyAuthorization from '../../internal/KeyAuthorization.js'\nimport { style } from '../zyzz.config.js'\n\n/**\n * Each token's icon URL, by symbol. Each icon stays its own file, since an inlined icon would put\n * every token's icon in the script of each page that shows a key.\n */\nconst icons = Object.fromEntries(\n Object.entries(\n import.meta.glob<string>('./icons/*.{png,svg,webp}', {\n eager: true,\n import: 'default',\n query: '?no-inline',\n }),\n ).map(([file, url]) => [\n file.slice('./icons/'.length, file.lastIndexOf('.')),\n url,\n ]),\n)\n\n/** Logos from `logos/`, by symbol and color scheme, each its own file. A logo replaces the icon. */\nconst logos = Object.entries(\n import.meta.glob<string>('./logos/*.{light,dark}.{png,svg,webp}', {\n eager: true,\n import: 'default',\n query: '?no-inline',\n }),\n).reduce<Record<string, { dark?: string; light?: string }>>(\n (result, [file, url]) => {\n const [, symbol, scheme] = file.match(\n /^\\.\\/logos\\/(.+)\\.(light|dark)\\.\\w+$/,\n )!\n result[symbol!] = { ...result[symbol!], [scheme!]: url }\n return result\n },\n {},\n)\n\n/** What the requested key may and may not do, with its limits and expiry. */\nexport function Grant(props: Grant.Props): ReactNode {\n // Several grants can share a document, so each derives its own IDs.\n const id = useId()\n const deniedId = useId()\n const detailsId = useId()\n // The unrecognized calls stay collapsed under their one-line warning until the user opens them.\n const [details, setDetails] = useState(false)\n const { calls, expiry, limits, unrecognized } = props.keyAuthorization\n const Heading = props.heading ?? 'h2'\n // MPP sessions pay through payment channels, which `open` starts and `topUp` funds. Both read as\n // funds the app holds, since a channel is an escrow that the service draws from.\n const channels = (() => {\n const open = calls.some((call) => call.call === 'open')\n const topUp = calls.some((call) => call.call === 'topUp')\n if (open) return 'Hold funds for services'\n if (topUp) return 'Add to funds it holds for services'\n return undefined\n })()\n return (\n <>\n <Stack\n {...styles.section()}\n aria-labelledby={id}\n gap=\"24\"\n render={<section />}\n >\n {props.chain ? (\n <Tag\n {...styles.chain()}\n aria-label={`Chain: ${props.chain}`}\n intent=\"neutral\"\n shape=\"rounded\"\n size=\"small\"\n >\n {props.chain}\n </Tag>\n ) : null}\n <Stack gap=\"12\">\n <Heading {...styles.heading()} id={id}>\n This app will be able to:\n </Heading>\n <Stack\n {...styles.list()}\n aria-labelledby={id}\n gap=\"8\"\n render={<ul />}\n >\n <Inline gap=\"8\" render={<li />}>\n <CheckCircle {...styles.allowed()} />\n <span>View your balance and activity</span>\n </Inline>\n {limits.map((limit) => (\n <Inline\n gap=\"8\"\n key={`${limit.currency}:${limit.period ?? 0}`}\n render={<li />}\n >\n <CheckCircle {...styles.allowed()} />\n <span>\n Spend{' '}\n {limit.period\n ? `${format(limit)} ${every(limit.period)}`\n : format(limit)}\n </span>\n <span {...styles.icons()}>\n {limit.tokens.map((token) => {\n // Each token's own limit shows on its icon, since the total spans several.\n const label = `${token.symbol}: ${format({ amount: token.amount, currency: limit.currency })}`\n const logo = logos[token.symbol]\n const icon = logo?.light ?? icons[token.symbol]\n return (\n <Tooltip.Root key={token.symbol}>\n <Tooltip.Trigger\n delay={150}\n render={\n <span {...styles.token()} tabIndex={0}>\n {icon ? (\n // The page follows the system color scheme, so the image does too.\n <picture>\n {logo?.dark ? (\n <source\n media=\"(prefers-color-scheme: dark)\"\n srcSet={logo.dark}\n />\n ) : null}\n <img\n {...styles.icon()}\n alt={label}\n height={20}\n src={icon}\n width={20}\n />\n </picture>\n ) : (\n // A token without a logo shows its initial.\n <span\n {...styles.placeholder()}\n aria-label={label}\n role=\"img\"\n >\n {token.symbol[0]}\n </span>\n )}\n </span>\n }\n />\n <Tooltip.Popup>{label}</Tooltip.Popup>\n </Tooltip.Root>\n )\n })}\n </span>\n </Inline>\n ))}\n {channels ? (\n <Inline gap=\"8\" render={<li />}>\n <CheckCircle {...styles.allowed()} />\n <span>\n {channels.slice(0, channels.lastIndexOf(' ') + 1)}\n {/* The last word and the icon wrap together. */}\n <span {...styles.nowrap()}>\n {channels.slice(channels.lastIndexOf(' ') + 1)}{' '}\n <Popover.Root>\n <Popover.Trigger\n aria-label=\"About funds for services\"\n nativeButton={false}\n openOnHover\n render={<InfoCircle {...styles.info()} tabIndex={0} />}\n />\n <Popover.Popup\n {...styles.popup()}\n aria-label=\"Funds for services\"\n >\n <Popover.Description>\n Set aside for pay-as-you-go services that use{' '}\n <a\n {...styles.popupLink()}\n href=\"https://mpp.dev\"\n rel=\"noreferrer\"\n target=\"_blank\"\n >\n MPP\n </a>\n . They take only what you use, and you get the rest\n back.\n </Popover.Description>\n </Popover.Popup>\n </Popover.Root>\n </span>\n </span>\n </Inline>\n ) : null}\n </Stack>\n </Stack>\n <Stack gap=\"12\">\n <Heading {...styles.heading()} id={deniedId}>\n This app won’t be able to:\n </Heading>\n <Stack\n {...styles.list()}\n aria-labelledby={deniedId}\n gap=\"8\"\n render={<ul />}\n >\n <Inline gap=\"8\" render={<li />}>\n <XCircle {...styles.denied()} />\n <span>Spend more than you approve</span>\n </Inline>\n </Stack>\n </Stack>\n <Stack {...styles.details()} gap=\"8\" render={<dl />}>\n <div>\n <dt {...styles.term()}>Expires</dt>{' '}\n <dd {...styles.value()}>\n {until(expiry)}{' '}\n {/* The tooltip's text never reaches the server render, so it shows the visitor's own time zone. */}\n <Tooltip.Root>\n <Tooltip.Trigger\n delay={150}\n render={\n <InfoCircle\n {...styles.info()}\n aria-label=\"Expiry date\"\n role=\"img\"\n tabIndex={0}\n />\n }\n />\n <Tooltip.Popup>\n {new Date(expiry * 1000).toLocaleString(undefined, {\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n month: 'short',\n timeZoneName: 'short',\n year: 'numeric',\n })}\n </Tooltip.Popup>\n </Tooltip.Root>\n </dd>\n </div>\n </Stack>\n </Stack>\n {unrecognized.length ? (\n // A note, not an alert, since the calls are part of the request and interrupt nothing.\n <Callout intent=\"warning\" role=\"note\" size=\"medium\">\n <Callout.Icon />\n <Callout.Content>\n <Stack gap=\"8\">\n <p {...styles.warningTitle()}>This app can take other actions</p>\n {details ? (\n <Stack gap=\"8\" id={detailsId}>\n <p {...styles.warningText()}>\n Tempo ID can’t tell you what these actions do. Approve only\n if you trust this app.\n </p>\n </Stack>\n ) : null}\n </Stack>\n </Callout.Content>\n <Callout.Action\n aria-controls={detailsId}\n aria-expanded={details}\n onClick={() => setDetails((open) => !open)}\n >\n {details ? 'Hide' : 'Show'}\n </Callout.Action>\n </Callout>\n ) : null}\n </>\n )\n}\n\nexport declare namespace Grant {\n type Props = {\n /** The key's chain, shown in the corner. Absent, none shows. */\n chain?: string | undefined\n /** `h2` by default, or `h5` on the flows canvas. */\n heading?: 'h2' | 'h5' | undefined\n /** The key that the app requests. */\n keyAuthorization: KeyAuthorization.Description\n }\n}\n\n/**\n * Groups thousands and keeps every decimal. Each formatter is built at its first use, since a page's\n * first one loads the locale's data, which a page that shows no key never needs.\n */\nlet decimal: Intl.NumberFormat | undefined\n\n/** Formats an expiry's distance, such as `in 7 days`, from its first use. */\nlet relative: Intl.RelativeTimeFormat | undefined\n\n/** The spans of an expiry, largest first. Months and years are approximate. */\nconst spans = [\n ['year', 31_536_000],\n ['month', 2_592_000],\n ['week', 604_800],\n ['day', 86_400],\n ['hour', 3_600],\n ['minute', 60],\n] as const\n\n/** The units of a period, largest first. */\nconst units = [\n ['week', 604_800],\n ['day', 86_400],\n ['hour', 3_600],\n ['minute', 60],\n ['second', 1],\n] as const\n\n/** Returns how often a limit resets, such as `per day` or `every 2 weeks`. */\nfunction every(period: number) {\n const [unit, seconds] = units.find((entry) => period % entry[1] === 0)!\n const count = period / seconds\n return count === 1 ? `per ${unit}` : `every ${count} ${unit}s`\n}\n\n/** Formats a limit in its currency, such as `$1,000`, or as the amount and its code. */\nfunction format(\n limit: Pick<\n KeyAuthorization.Description['limits'][number],\n 'amount' | 'currency'\n >,\n) {\n const amount = limit.amount as Intl.StringNumericLiteral\n try {\n return new Intl.NumberFormat('en-US', {\n currency: limit.currency,\n maximumFractionDigits: 6,\n style: 'currency',\n trailingZeroDisplay: 'stripIfInteger',\n }).format(amount)\n } catch {\n // A yield-bearing token's own symbol is not a currency code.\n decimal ??= new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 })\n return `${decimal.format(amount)} ${limit.currency}`\n }\n}\n\n/**\n * Returns the time until `expiry`, in Unix seconds, in its largest whole span, such as\n * `in 3 months`.\n */\nfunction until(expiry: number) {\n const remaining = expiry - Date.now() / 1000\n const [unit, seconds] =\n spans.find((entry) => remaining + 60 >= entry[1]) ?? spans.at(-1)!\n relative ??= new Intl.RelativeTimeFormat('en-US', { numeric: 'always' })\n return relative.format(Math.max(1, Math.round(remaining / seconds)), unit)\n}\n\nnamespace styles {\n export const allowed = style({\n color: 'green.700',\n flexShrink: 0,\n height: '20',\n width: '20',\n })\n\n export const chain = style({\n insetBlockStart: '16',\n insetInlineEnd: '16',\n position: 'absolute',\n })\n\n export const denied = style({\n color: 'red.700',\n flexShrink: 0,\n height: '20',\n width: '20',\n })\n\n // Each term and its value read as one line of text.\n export const details = style({ margin: '0', typography: 'copy.14' })\n\n export const heading = style({\n color: 'gray.900',\n margin: '0',\n typography: 'copy.14',\n })\n\n export const icon = style({\n borderRadius: 'full',\n display: 'block',\n height: '20',\n width: '20',\n })\n\n // Several tokens overlap, and spread apart while hovered so each symbol can show.\n export const icons = style({\n display: 'flex',\n flexShrink: 0,\n '& > span + span': { marginInlineStart: '-0.375rem !custom' },\n '&:hover > span + span': { marginInlineStart: '4' },\n })\n\n export const info = style({\n color: 'gray.900',\n display: 'inline',\n height: '16',\n outline: 'none',\n verticalAlign: 'middle',\n width: '16',\n ':focus-visible': {\n outline: '2px solid',\n outlineColor: 'blue.700',\n outlineOffset: '2',\n },\n })\n\n export const list = style({\n listStyle: 'none',\n margin: '0',\n padding: '0',\n typography: 'label.14.strong',\n })\n\n export const nowrap = style({ whiteSpace: 'nowrap' })\n\n export const placeholder = style({\n alignItems: 'center',\n backgroundColor: 'background.surface',\n borderRadius: 'full',\n color: 'gray.900',\n display: 'flex',\n height: '20',\n justifyContent: 'center',\n typography: 'label.12',\n width: '20',\n })\n\n export const popup = style({ maxWidth: '256' })\n\n export const popupLink = style({ color: 'blue.700' })\n\n export const section = style({\n backgroundColor: 'gray.100',\n borderRadius: '16',\n margin: '0',\n padding: '20',\n // The chain's tag sits in the section's top-right corner.\n position: 'relative',\n })\n\n export const term = style({ color: 'gray.900', display: 'inline' })\n\n // The ring matches the section's fill, so overlapping tokens stay apart.\n export const token = style({\n borderRadius: 'full',\n outline: '2px solid',\n outlineColor: 'gray.100',\n ':focus-visible': { outlineColor: 'blue.700' },\n // Under reduced motion, the tokens spread apart without a transition.\n '@media (prefers-reduced-motion: no-preference)': {\n transitionDuration: '150',\n transitionProperty: 'margin',\n transitionTimingFunction: 'in-out',\n },\n })\n\n // The expiry reads in the weight of the permissions above it.\n export const value = style({\n display: 'inline',\n margin: '0',\n overflowWrap: 'anywhere',\n typography: 'label.14.strong',\n })\n\n export const warningText = style({ color: 'foreground' })\n\n export const warningTitle = style({ typography: 'label.14.strong' })\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7],"mappings":"A,4gBAcaoF,GAA4BD,EAAM,WAAW,SAAsB,EAAgB,EAAc,CAC5G,GAAM,CACJ,SACA,YACA,QACA,GAAGE,GACDC,EAEEC,EADQR,EACG,CAAC,CAAC,SAAS,MAAM,EAC5B,CACJ,WACA,OACA,QACA,kBACA,eACEP,EAA4B,EAgBhC,OATgBP,EAAiB,MAAOqB,EAAgB,CACtD,MAAA,CANA,OACA,OACA,QACA,WAAYE,CAGR,EACJ,IAAK,CAACC,EAAcC,CAAQ,EAC5B,MAAO,CAAC,CACN,MAAOC,EACP,cAAe,EACjB,EAAGN,CAAY,EACf,uBAAw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OAAOS,CAAM,EAAE,GAAGnB,EAAM,UAC5C,CACF,CAMA,SAASO,GAAM,EAAgB,CAC7B,IAAMa,EAAYZ,EAAS,KAAK,IAAI,EAAI,IAClC,CAACM,EAAMC,GACXH,EAAM,KAAM,GAAUQ,EAAY,IAAMH,EAAM,EAAE,GAAKL,EAAM,GAAG,EAAE,EAElE,MADA,KAAa,IAAI,KAAK,mBAAmB,QAAS,CAAE,QAAS,QAAS,CAAC,EAChED,EAAS,OAAO,KAAK,IAAI,EAAG,KAAK,MAAMS,EAAYL,CAAO,CAAC,EAAGD,CAAI,CAC3E,CAEA,IAAUhB,GAAV,SAAA,EAAA,CACe,EAAA,QAAU,EAOV,EAAA,MAAQ,EAMR,EAAA,OAAS,EAQT,EAAA,QAAU,EAEV,EAAA,QAAU,EAMV,EAAA,KAAO,EAQP,EAAA,MAAQ,EAOR,EAAA,KAAO,EAcP,EAAA,KAAO,EAOP,EAAA,OAAS,EAET,EAAA,YAAc,EAYd,EAAA,MAAQ,EAER,EAAA,UAAY,EAEZ,EAAA,QAAU,EASV,EAAA,KAAO,EAGP,EAAA,MAAQ,EAcR,EAAA,MAAQ,EAOR,EAAA,YAAc,EAEd,EAAA,aAAe,CAC9B,EAAA,CAAA,AAAAA,IAAA,CAAA,CAAA,E"}
|
|
@@ -12,7 +12,9 @@ export declare class KeyMismatchError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Finishes a {@link start} when the page loads with Tempo ID's callback, and returns `undefined`
|
|
15
|
-
* otherwise. It redeems the code once, however often the page calls it.
|
|
15
|
+
* otherwise. It redeems the code once, however often the page calls it. With the default storage,
|
|
16
|
+
* it sends the code exchange at once, from the tab's copy of the verifier, before IndexedDB returns
|
|
17
|
+
* the rest of the redirect's state. A callback that denies the
|
|
16
18
|
* redirect, such as `error=access_denied`, throws a `RequestError` with that `code` and status 0.
|
|
17
19
|
*
|
|
18
20
|
* @example
|
|
@@ -120,7 +122,9 @@ export declare namespace prefetch {
|
|
|
120
122
|
}
|
|
121
123
|
/**
|
|
122
124
|
* Sends the browser to Tempo ID's pages to sign in, and keeps the redirect's state in `storage`.
|
|
123
|
-
*
|
|
125
|
+
* With the default storage, it also keeps the `state`, the redirect URI, and the PKCE verifier in
|
|
126
|
+
* the tab's `sessionStorage`, without the key's material. {@link complete} finishes it when the
|
|
127
|
+
* browser returns.
|
|
124
128
|
*
|
|
125
129
|
* @example
|
|
126
130
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../src/client/actions/redirect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../src/client/actions/redirect.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,KAAK,IAAI,EAA0C,MAAM,YAAY,CAAA;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMxD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,4EAA4E;AAC5E,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,SAAkB,IAAI,uCAAsC;IAE5D,YAAY,OAAO,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,EAMvC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,GAAG,SAAS,OAAO,GAAG,IAAI,EACvD,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAM,GAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAqFnC;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,KAAK,OAAO,CAAC,GAAG,SAAS,OAAO,GAAG,IA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AAC;IAChC,wEAAwE;IACxE,KAAK,UAAU,GAAG,SAAS,MAAM,EAAE,CAAA;CACpC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CACzB,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,KAAK,CAAC,OAAY,GAC1B,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,OAAO,GAAG;QACb,qFAAqF;QACrF,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAA;QACvC;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC9B,wEAAwE;QACxE,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACzB,wFAAwF;QACxF,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KACtC,CAAA;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Signs the user in on Tempo ID's pages, which redirect back with a code. `start` and `complete`
|
|
3
|
-
* keep the redirect's state in `storage
|
|
3
|
+
* keep the redirect's state in `storage`, and, with the default storage, its PKCE verifier in the
|
|
4
|
+
* tab's `sessionStorage` too. `createUrl` and `handleCallback` leave it to the app.
|
|
4
5
|
* @module
|
|
5
6
|
*/
|
|
6
7
|
import { Base64, Bytes, Hash } from 'ox';
|
|
@@ -9,6 +10,7 @@ import * as AccessKey from '../internal/accessKey.js';
|
|
|
9
10
|
import * as Api from '../internal/api.js';
|
|
10
11
|
import { keyAuthorization } from '../internal/request.js';
|
|
11
12
|
import * as Store from '../internal/store.js';
|
|
13
|
+
import * as Verifier from '../internal/verifier.js';
|
|
12
14
|
import * as Pending from '../Pending.js';
|
|
13
15
|
/** `complete` received a `key` other than the one that `start` received. */
|
|
14
16
|
export class KeyMismatchError extends Error {
|
|
@@ -21,7 +23,9 @@ export class KeyMismatchError extends Error {
|
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Finishes a {@link start} when the page loads with Tempo ID's callback, and returns `undefined`
|
|
24
|
-
* otherwise. It redeems the code once, however often the page calls it.
|
|
26
|
+
* otherwise. It redeems the code once, however often the page calls it. With the default storage,
|
|
27
|
+
* it sends the code exchange at once, from the tab's copy of the verifier, before IndexedDB returns
|
|
28
|
+
* the rest of the redirect's state. A callback that denies the
|
|
25
29
|
* redirect, such as `error=access_denied`, throws a `RequestError` with that `code` and status 0.
|
|
26
30
|
*
|
|
27
31
|
* @example
|
|
@@ -33,9 +37,21 @@ export class KeyMismatchError extends Error {
|
|
|
33
37
|
*/
|
|
34
38
|
export function complete(auth, options = {}) {
|
|
35
39
|
completed ??= (async () => {
|
|
40
|
+
const url = new URL(window.location.href);
|
|
41
|
+
// The tab's ticket starts the code exchange before the storage's first read, which waits behind
|
|
42
|
+
// the page's first tasks. It runs only for this page's own redirect, with the `key` it began
|
|
43
|
+
// with, so the checks below refuse nothing that it redeemed.
|
|
44
|
+
const ticket = Verifier.take(auth);
|
|
45
|
+
const early = ticket &&
|
|
46
|
+
url.searchParams.has('code') &&
|
|
47
|
+
url.searchParams.get('state') === ticket.state &&
|
|
48
|
+
ticket.key === (options.key !== false)
|
|
49
|
+
? redeem(auth, { pending: ticket, url })
|
|
50
|
+
: undefined;
|
|
51
|
+
// A refusal surfaces from the await below, after the checks of the stored redirect.
|
|
52
|
+
early?.catch(() => undefined);
|
|
36
53
|
const store = Store.get(auth);
|
|
37
54
|
const stored = (await store.getItem(storageKey));
|
|
38
|
-
const url = new URL(window.location.href);
|
|
39
55
|
// A registered redirect URI may hold its own `error`, which the app keeps. Only an `error` that
|
|
40
56
|
// the callback added after it belongs to the authorization response.
|
|
41
57
|
const redirectUri = stored?.redirectUri ?? url.origin;
|
|
@@ -81,10 +97,12 @@ export function complete(auth, options = {}) {
|
|
|
81
97
|
});
|
|
82
98
|
if (!url.searchParams.has('code') || !stored)
|
|
83
99
|
return undefined;
|
|
84
|
-
return
|
|
100
|
+
return finish({
|
|
85
101
|
accessKey: options.accessKey,
|
|
102
|
+
body: await (ours && early
|
|
103
|
+
? early
|
|
104
|
+
: redeem(auth, { pending: stored, url })),
|
|
86
105
|
pending: stored,
|
|
87
|
-
url,
|
|
88
106
|
});
|
|
89
107
|
})();
|
|
90
108
|
// The check above holds the stored redirect to `key`, which types the result.
|
|
@@ -159,8 +177,22 @@ export async function createUrl(auth, options = {}) {
|
|
|
159
177
|
* ```
|
|
160
178
|
*/
|
|
161
179
|
export async function handleCallback(auth, options) {
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
return finish({
|
|
181
|
+
accessKey: options.accessKey,
|
|
182
|
+
body: await redeem(auth, {
|
|
183
|
+
pending: options.pending,
|
|
184
|
+
url: new URL(options.url),
|
|
185
|
+
}),
|
|
186
|
+
pending: options.pending,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Checks the callback's `state`, and redeems its code with the verifier of `pending`. Throws a
|
|
191
|
+
* `RequestError` for a forged `state`, a callback without a `code`, or a refused code.
|
|
192
|
+
*/
|
|
193
|
+
async function redeem(auth, options) {
|
|
194
|
+
const { redirectUri, state, verifier } = options.pending;
|
|
195
|
+
const { url } = options;
|
|
164
196
|
const added = (name) => response(url, { name, redirectUri });
|
|
165
197
|
// State comes first, so a forged link cannot supply the error an app shows.
|
|
166
198
|
if (url.searchParams.get('state') !== state)
|
|
@@ -179,19 +211,26 @@ export async function handleCallback(auth, options) {
|
|
|
179
211
|
'Missing `code` in the callback URL. Start sign-in again.',
|
|
180
212
|
status: 400,
|
|
181
213
|
});
|
|
182
|
-
|
|
214
|
+
return await Api.token(auth, {
|
|
183
215
|
code,
|
|
184
216
|
code_verifier: verifier,
|
|
185
217
|
grant_type: 'authorization_code',
|
|
186
218
|
redirect_uri: redirectUri,
|
|
187
219
|
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Returns the authorization of a redeemed code, with the key of `pending`, or the tokens and the
|
|
223
|
+
* user for a `Pending.WithoutKey`. Throws a `RequestError` when a redirect with a key receives no
|
|
224
|
+
* key authorization.
|
|
225
|
+
*/
|
|
226
|
+
function finish(options) {
|
|
227
|
+
const { body } = options;
|
|
228
|
+
// The exchange's fields stay out of the key's material.
|
|
229
|
+
const { key, redirectUri: _redirectUri, state: _state, verifier: _verifier, ...material } = options.pending;
|
|
188
230
|
// `pending.key` decides both the type and the runtime value of the result.
|
|
189
231
|
if (key === false) {
|
|
190
232
|
const tokens = Api.tokens(body);
|
|
191
|
-
return {
|
|
192
|
-
...tokens,
|
|
193
|
-
user: Api.user(tokens),
|
|
194
|
-
};
|
|
233
|
+
return { ...tokens, user: Api.user(tokens) };
|
|
195
234
|
}
|
|
196
235
|
if (!body.account || !body.key_authorization)
|
|
197
236
|
throw new RequestError({
|
|
@@ -236,7 +275,9 @@ export async function prefetch(auth) {
|
|
|
236
275
|
}
|
|
237
276
|
/**
|
|
238
277
|
* Sends the browser to Tempo ID's pages to sign in, and keeps the redirect's state in `storage`.
|
|
239
|
-
*
|
|
278
|
+
* With the default storage, it also keeps the `state`, the redirect URI, and the PKCE verifier in
|
|
279
|
+
* the tab's `sessionStorage`, without the key's material. {@link complete} finishes it when the
|
|
280
|
+
* browser returns.
|
|
240
281
|
*
|
|
241
282
|
* @example
|
|
242
283
|
* ```ts
|
|
@@ -246,6 +287,7 @@ export async function prefetch(auth) {
|
|
|
246
287
|
export async function start(auth, options = {}) {
|
|
247
288
|
const { pending, url } = await createUrl(auth, options);
|
|
248
289
|
await Store.get(auth).setItem(storageKey, pending);
|
|
290
|
+
Verifier.save(auth, pending);
|
|
249
291
|
window.location.assign(url);
|
|
250
292
|
}
|
|
251
293
|
/** Unpadded URL-safe Base64, as PKCE and `key_authorization` use. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../src/client/actions/redirect.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"redirect.js","sourceRoot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AAM,UAAU,GAAG,mBAAmB,CAAA;AAEtC;;;GAGG;AACH,SAAS,QAAQ,CAAC,GAAQ,EAAE,OAAyB;IACnD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,MAAM,CACjE,OAAO,CAAC,IAAI,CACb,CAAC,MAAM,CAAA;IACR,OAAO,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps the part of a redirect's state that redeems its code in the tab's `sessionStorage`, beside
|
|
3
|
+
* the default IndexedDB storage: its `state`, redirect URI, and PKCE verifier, and whether it
|
|
4
|
+
* authorizes a key. The callback page reads it at once, so the code exchange starts before
|
|
5
|
+
* IndexedDB's first read, which waits behind the page's first tasks. It holds no key material.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { Auth } from '../Auth.js';
|
|
9
|
+
import type * as Pending from '../Pending.js';
|
|
10
|
+
/** The part of a redirect's state that redeems its code. */
|
|
11
|
+
export type Ticket = {
|
|
12
|
+
/** Whether the redirect authorizes a key, whose material only the instance's storage holds. */
|
|
13
|
+
key: boolean;
|
|
14
|
+
/** Where Tempo ID redirects back to. The code exchange repeats it. */
|
|
15
|
+
redirectUri: string;
|
|
16
|
+
/** The value that the callback must echo. */
|
|
17
|
+
state: string;
|
|
18
|
+
/** The PKCE verifier that redeems the code. */
|
|
19
|
+
verifier: string;
|
|
20
|
+
};
|
|
21
|
+
/** Keeps the ticket of `pending` for the tab, unless the instance has a `storage` of its own. */
|
|
22
|
+
export declare function save(auth: Auth, pending: Pending.Pending | Pending.WithoutKey): void;
|
|
23
|
+
/** Returns the tab's ticket and removes it, or `undefined` without one. */
|
|
24
|
+
export declare function take(auth: Auth): Ticket | undefined;
|
|
25
|
+
//# sourceMappingURL=verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../../src/client/internal/verifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAE7C,4DAA4D;AAC5D,MAAM,MAAM,MAAM,GAAG;IACnB,+FAA+F;IAC/F,GAAG,EAAE,OAAO,CAAA;IACZ,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAA;IACnB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,iGAAiG;AACjG,wBAAgB,IAAI,CAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,UAAU,QAS9C;AAED,2EAA2E;AAC3E,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAUnD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Keeps the ticket of `pending` for the tab, unless the instance has a `storage` of its own. */
|
|
2
|
+
export function save(auth, pending) {
|
|
3
|
+
const storage = session(auth);
|
|
4
|
+
if (!storage)
|
|
5
|
+
return;
|
|
6
|
+
try {
|
|
7
|
+
storage.setItem(storageKey, JSON.stringify(ticket(pending)));
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
// A full or blocked storage leaves the callback to read the instance's storage.
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Returns the tab's ticket and removes it, or `undefined` without one. */
|
|
14
|
+
export function take(auth) {
|
|
15
|
+
const storage = session(auth);
|
|
16
|
+
if (!storage)
|
|
17
|
+
return undefined;
|
|
18
|
+
try {
|
|
19
|
+
const value = storage.getItem(storageKey);
|
|
20
|
+
storage.removeItem(storageKey);
|
|
21
|
+
return value ? JSON.parse(value) : undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Returns the ticket of `pending`, without its key material. */
|
|
28
|
+
function ticket(pending) {
|
|
29
|
+
return {
|
|
30
|
+
key: pending.key !== false,
|
|
31
|
+
redirectUri: pending.redirectUri,
|
|
32
|
+
state: pending.state,
|
|
33
|
+
verifier: pending.verifier,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the tab's `sessionStorage`, or `undefined` for an instance with a `storage` of its own,
|
|
38
|
+
* which then holds the verifier alone, and where the browser blocks storage.
|
|
39
|
+
*/
|
|
40
|
+
function session(auth) {
|
|
41
|
+
if (auth.storage)
|
|
42
|
+
return undefined;
|
|
43
|
+
try {
|
|
44
|
+
return typeof sessionStorage === 'undefined' ? undefined : sessionStorage;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Where a redirect keeps its ticket in `sessionStorage`. */
|
|
51
|
+
const storageKey = 'tempo-id:redirect';
|
|
52
|
+
//# sourceMappingURL=verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../../src/client/internal/verifier.ts"],"names":[],"mappings":"AAuBA,iGAAiG;AACjG,MAAM,UAAU,IAAI,CAClB,IAAU,EACV,OAA6C;IAE7C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAM;IACpB,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,gFAAgF;IAClF,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,IAAI,CAAC,IAAU;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IAC9B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QACzC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QAC9B,OAAO,KAAK,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAY,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,SAAS,MAAM,CAAC,OAA6C;IAC3D,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,KAAK,KAAK;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,OAAO,CAAC,IAAU;IACzB,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IAClC,IAAI,CAAC;QACH,OAAO,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAA;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,GAAG,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Signs the user in on Tempo ID's pages, which redirect back with a code. `start` and `complete`
|
|
3
|
-
* keep the redirect's state in `storage
|
|
3
|
+
* keep the redirect's state in `storage`, and, with the default storage, its PKCE verifier in the
|
|
4
|
+
* tab's `sessionStorage` too. `createUrl` and `handleCallback` leave it to the app.
|
|
4
5
|
* @module
|
|
5
6
|
*/
|
|
6
7
|
import { Base64, Bytes, Hash } from 'ox'
|
|
@@ -11,6 +12,7 @@ import * as AccessKey from '../internal/accessKey.js'
|
|
|
11
12
|
import * as Api from '../internal/api.js'
|
|
12
13
|
import { keyAuthorization } from '../internal/request.js'
|
|
13
14
|
import * as Store from '../internal/store.js'
|
|
15
|
+
import * as Verifier from '../internal/verifier.js'
|
|
14
16
|
import * as Pending from '../Pending.js'
|
|
15
17
|
import type { Permissions } from '../Permissions.js'
|
|
16
18
|
|
|
@@ -29,7 +31,9 @@ export class KeyMismatchError extends Error {
|
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Finishes a {@link start} when the page loads with Tempo ID's callback, and returns `undefined`
|
|
32
|
-
* otherwise. It redeems the code once, however often the page calls it.
|
|
34
|
+
* otherwise. It redeems the code once, however often the page calls it. With the default storage,
|
|
35
|
+
* it sends the code exchange at once, from the tab's copy of the verifier, before IndexedDB returns
|
|
36
|
+
* the rest of the redirect's state. A callback that denies the
|
|
33
37
|
* redirect, such as `error=access_denied`, throws a `RequestError` with that `code` and status 0.
|
|
34
38
|
*
|
|
35
39
|
* @example
|
|
@@ -44,13 +48,26 @@ export function complete<const key extends boolean = true>(
|
|
|
44
48
|
options: complete.Options<key> = {},
|
|
45
49
|
): Promise<complete.ReturnType<key>> {
|
|
46
50
|
completed ??= (async () => {
|
|
51
|
+
const url = new URL(window.location.href)
|
|
52
|
+
// The tab's ticket starts the code exchange before the storage's first read, which waits behind
|
|
53
|
+
// the page's first tasks. It runs only for this page's own redirect, with the `key` it began
|
|
54
|
+
// with, so the checks below refuse nothing that it redeemed.
|
|
55
|
+
const ticket = Verifier.take(auth)
|
|
56
|
+
const early =
|
|
57
|
+
ticket &&
|
|
58
|
+
url.searchParams.has('code') &&
|
|
59
|
+
url.searchParams.get('state') === ticket.state &&
|
|
60
|
+
ticket.key === (options.key !== false)
|
|
61
|
+
? redeem(auth, { pending: ticket, url })
|
|
62
|
+
: undefined
|
|
63
|
+
// A refusal surfaces from the await below, after the checks of the stored redirect.
|
|
64
|
+
early?.catch(() => undefined)
|
|
47
65
|
const store = Store.get(auth)!
|
|
48
66
|
const stored = (await store.getItem(storageKey)) as
|
|
49
67
|
| Pending.Pending
|
|
50
68
|
| Pending.WithoutKey
|
|
51
69
|
| null
|
|
52
70
|
| undefined
|
|
53
|
-
const url = new URL(window.location.href)
|
|
54
71
|
// A registered redirect URI may hold its own `error`, which the app keeps. Only an `error` that
|
|
55
72
|
// the callback added after it belongs to the authorization response.
|
|
56
73
|
const redirectUri = stored?.redirectUri ?? url.origin
|
|
@@ -104,10 +121,12 @@ export function complete<const key extends boolean = true>(
|
|
|
104
121
|
uri: added('error_uri'),
|
|
105
122
|
})
|
|
106
123
|
if (!url.searchParams.has('code') || !stored) return undefined
|
|
107
|
-
return
|
|
124
|
+
return finish({
|
|
108
125
|
accessKey: options.accessKey,
|
|
126
|
+
body: await (ours && early
|
|
127
|
+
? early
|
|
128
|
+
: redeem(auth, { pending: stored, url })),
|
|
109
129
|
pending: stored,
|
|
110
|
-
url,
|
|
111
130
|
})
|
|
112
131
|
})()
|
|
113
132
|
// The check above holds the stored redirect to `key`, which types the result.
|
|
@@ -242,8 +261,48 @@ export async function handleCallback<
|
|
|
242
261
|
auth: Auth,
|
|
243
262
|
options: handleCallback.Options<pending>,
|
|
244
263
|
): Promise<handleCallback.ReturnType<pending>> {
|
|
245
|
-
|
|
246
|
-
|
|
264
|
+
return finish({
|
|
265
|
+
accessKey: options.accessKey,
|
|
266
|
+
body: await redeem(auth, {
|
|
267
|
+
pending: options.pending,
|
|
268
|
+
url: new URL(options.url),
|
|
269
|
+
}),
|
|
270
|
+
pending: options.pending,
|
|
271
|
+
}) as handleCallback.ReturnType<pending>
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export declare namespace handleCallback {
|
|
275
|
+
type Options<
|
|
276
|
+
pending extends Pending.Pending | Pending.WithoutKey = Pending.Pending,
|
|
277
|
+
> = {
|
|
278
|
+
/** The key that the app passed to `createUrl`, if any. */
|
|
279
|
+
accessKey?: Account.Account | undefined
|
|
280
|
+
/** What `createUrl` returned to keep. */
|
|
281
|
+
pending: pending
|
|
282
|
+
/** The callback URL that Tempo ID redirected to. */
|
|
283
|
+
url: string | URL
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** The authorization, without its key for a `Pending.WithoutKey`. */
|
|
287
|
+
type ReturnType<
|
|
288
|
+
pending extends Pending.Pending | Pending.WithoutKey = Pending.Pending,
|
|
289
|
+
> = [pending] extends [Pending.WithoutKey]
|
|
290
|
+
? WithoutKey
|
|
291
|
+
: [pending] extends [Pending.Pending]
|
|
292
|
+
? Authorization
|
|
293
|
+
: Authorization | WithoutKey
|
|
294
|
+
|
|
295
|
+
/** A sign-in without a key: the tokens and the user. */
|
|
296
|
+
type WithoutKey = Omit<Authorization, 'account' | 'key'>
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Checks the callback's `state`, and redeems its code with the verifier of `pending`. Throws a
|
|
301
|
+
* `RequestError` for a forged `state`, a callback without a `code`, or a refused code.
|
|
302
|
+
*/
|
|
303
|
+
async function redeem(auth: Auth, options: redeem.Options) {
|
|
304
|
+
const { redirectUri, state, verifier } = options.pending
|
|
305
|
+
const { url } = options
|
|
247
306
|
const added = (name: string) => response(url, { name, redirectUri })
|
|
248
307
|
// State comes first, so a forged link cannot supply the error an app shows.
|
|
249
308
|
if (url.searchParams.get('state') !== state)
|
|
@@ -265,19 +324,44 @@ export async function handleCallback<
|
|
|
265
324
|
status: 400,
|
|
266
325
|
})
|
|
267
326
|
|
|
268
|
-
|
|
327
|
+
return await Api.token(auth, {
|
|
269
328
|
code,
|
|
270
329
|
code_verifier: verifier,
|
|
271
330
|
grant_type: 'authorization_code',
|
|
272
331
|
redirect_uri: redirectUri,
|
|
273
332
|
})
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
declare namespace redeem {
|
|
336
|
+
type Options = {
|
|
337
|
+
/** The redirect's state, of which the exchange reads `redirectUri`, `state`, and `verifier`. */
|
|
338
|
+
pending: Pick<Pending.Pending, 'redirectUri' | 'state' | 'verifier'>
|
|
339
|
+
/** The callback URL that Tempo ID redirected to. */
|
|
340
|
+
url: URL
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Returns the authorization of a redeemed code, with the key of `pending`, or the tokens and the
|
|
346
|
+
* user for a `Pending.WithoutKey`. Throws a `RequestError` when a redirect with a key receives no
|
|
347
|
+
* key authorization.
|
|
348
|
+
*/
|
|
349
|
+
function finish(
|
|
350
|
+
options: finish.Options,
|
|
351
|
+
): Authorization | handleCallback.WithoutKey {
|
|
352
|
+
const { body } = options
|
|
353
|
+
// The exchange's fields stay out of the key's material.
|
|
354
|
+
const {
|
|
355
|
+
key,
|
|
356
|
+
redirectUri: _redirectUri,
|
|
357
|
+
state: _state,
|
|
358
|
+
verifier: _verifier,
|
|
359
|
+
...material
|
|
360
|
+
} = options.pending
|
|
274
361
|
// `pending.key` decides both the type and the runtime value of the result.
|
|
275
362
|
if (key === false) {
|
|
276
363
|
const tokens = Api.tokens(body)
|
|
277
|
-
return {
|
|
278
|
-
...tokens,
|
|
279
|
-
user: Api.user(tokens),
|
|
280
|
-
} as handleCallback.ReturnType<pending>
|
|
364
|
+
return { ...tokens, user: Api.user(tokens) }
|
|
281
365
|
}
|
|
282
366
|
if (!body.account || !body.key_authorization)
|
|
283
367
|
throw new RequestError({
|
|
@@ -293,32 +377,18 @@ export async function handleCallback<
|
|
|
293
377
|
tokens: body,
|
|
294
378
|
},
|
|
295
379
|
{ accessKey: options.accessKey, material },
|
|
296
|
-
)
|
|
380
|
+
)
|
|
297
381
|
}
|
|
298
382
|
|
|
299
|
-
|
|
300
|
-
type Options
|
|
301
|
-
pending extends Pending.Pending | Pending.WithoutKey = Pending.Pending,
|
|
302
|
-
> = {
|
|
383
|
+
declare namespace finish {
|
|
384
|
+
type Options = {
|
|
303
385
|
/** The key that the app passed to `createUrl`, if any. */
|
|
304
386
|
accessKey?: Account.Account | undefined
|
|
305
|
-
/**
|
|
306
|
-
|
|
307
|
-
/** The
|
|
308
|
-
|
|
387
|
+
/** The token response of the redeemed code. */
|
|
388
|
+
body: Api.TokenResponse
|
|
389
|
+
/** The redirect's state, whose key material the authorization's key holds. */
|
|
390
|
+
pending: Pending.Pending | Pending.WithoutKey
|
|
309
391
|
}
|
|
310
|
-
|
|
311
|
-
/** The authorization, without its key for a `Pending.WithoutKey`. */
|
|
312
|
-
type ReturnType<
|
|
313
|
-
pending extends Pending.Pending | Pending.WithoutKey = Pending.Pending,
|
|
314
|
-
> = [pending] extends [Pending.WithoutKey]
|
|
315
|
-
? WithoutKey
|
|
316
|
-
: [pending] extends [Pending.Pending]
|
|
317
|
-
? Authorization
|
|
318
|
-
: Authorization | WithoutKey
|
|
319
|
-
|
|
320
|
-
/** A sign-in without a key: the tokens and the user. */
|
|
321
|
-
type WithoutKey = Omit<Authorization, 'account' | 'key'>
|
|
322
392
|
}
|
|
323
393
|
|
|
324
394
|
/**
|
|
@@ -363,7 +433,9 @@ export declare namespace prefetch {
|
|
|
363
433
|
|
|
364
434
|
/**
|
|
365
435
|
* Sends the browser to Tempo ID's pages to sign in, and keeps the redirect's state in `storage`.
|
|
366
|
-
*
|
|
436
|
+
* With the default storage, it also keeps the `state`, the redirect URI, and the PKCE verifier in
|
|
437
|
+
* the tab's `sessionStorage`, without the key's material. {@link complete} finishes it when the
|
|
438
|
+
* browser returns.
|
|
367
439
|
*
|
|
368
440
|
* @example
|
|
369
441
|
* ```ts
|
|
@@ -376,6 +448,7 @@ export async function start(
|
|
|
376
448
|
): Promise<void> {
|
|
377
449
|
const { pending, url } = await createUrl(auth, options)
|
|
378
450
|
await Store.get(auth)!.setItem(storageKey, pending)
|
|
451
|
+
Verifier.save(auth, pending)
|
|
379
452
|
window.location.assign(url)
|
|
380
453
|
}
|
|
381
454
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps the part of a redirect's state that redeems its code in the tab's `sessionStorage`, beside
|
|
3
|
+
* the default IndexedDB storage: its `state`, redirect URI, and PKCE verifier, and whether it
|
|
4
|
+
* authorizes a key. The callback page reads it at once, so the code exchange starts before
|
|
5
|
+
* IndexedDB's first read, which waits behind the page's first tasks. It holds no key material.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/* istanbul ignore file -- `sessionStorage` exists only in a browser. */
|
|
9
|
+
import type { Auth } from '../Auth.js'
|
|
10
|
+
import type * as Pending from '../Pending.js'
|
|
11
|
+
|
|
12
|
+
/** The part of a redirect's state that redeems its code. */
|
|
13
|
+
export type Ticket = {
|
|
14
|
+
/** Whether the redirect authorizes a key, whose material only the instance's storage holds. */
|
|
15
|
+
key: boolean
|
|
16
|
+
/** Where Tempo ID redirects back to. The code exchange repeats it. */
|
|
17
|
+
redirectUri: string
|
|
18
|
+
/** The value that the callback must echo. */
|
|
19
|
+
state: string
|
|
20
|
+
/** The PKCE verifier that redeems the code. */
|
|
21
|
+
verifier: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Keeps the ticket of `pending` for the tab, unless the instance has a `storage` of its own. */
|
|
25
|
+
export function save(
|
|
26
|
+
auth: Auth,
|
|
27
|
+
pending: Pending.Pending | Pending.WithoutKey,
|
|
28
|
+
) {
|
|
29
|
+
const storage = session(auth)
|
|
30
|
+
if (!storage) return
|
|
31
|
+
try {
|
|
32
|
+
storage.setItem(storageKey, JSON.stringify(ticket(pending)))
|
|
33
|
+
} catch {
|
|
34
|
+
// A full or blocked storage leaves the callback to read the instance's storage.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Returns the tab's ticket and removes it, or `undefined` without one. */
|
|
39
|
+
export function take(auth: Auth): Ticket | undefined {
|
|
40
|
+
const storage = session(auth)
|
|
41
|
+
if (!storage) return undefined
|
|
42
|
+
try {
|
|
43
|
+
const value = storage.getItem(storageKey)
|
|
44
|
+
storage.removeItem(storageKey)
|
|
45
|
+
return value ? (JSON.parse(value) as Ticket) : undefined
|
|
46
|
+
} catch {
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Returns the ticket of `pending`, without its key material. */
|
|
52
|
+
function ticket(pending: Pending.Pending | Pending.WithoutKey): Ticket {
|
|
53
|
+
return {
|
|
54
|
+
key: pending.key !== false,
|
|
55
|
+
redirectUri: pending.redirectUri,
|
|
56
|
+
state: pending.state,
|
|
57
|
+
verifier: pending.verifier,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns the tab's `sessionStorage`, or `undefined` for an instance with a `storage` of its own,
|
|
63
|
+
* which then holds the verifier alone, and where the browser blocks storage.
|
|
64
|
+
*/
|
|
65
|
+
function session(auth: Auth) {
|
|
66
|
+
if (auth.storage) return undefined
|
|
67
|
+
try {
|
|
68
|
+
return typeof sessionStorage === 'undefined' ? undefined : sessionStorage
|
|
69
|
+
} catch {
|
|
70
|
+
return undefined
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Where a redirect keeps its ticket in `sessionStorage`. */
|
|
75
|
+
const storageKey = 'tempo-id:redirect'
|