@datadog/apps-frontend 0.0.8 → 0.0.10

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.
Files changed (43) hide show
  1. package/README.md +7 -0
  2. package/dist/src/_chunks/chunk-64RLSXHA.js +184 -0
  3. package/dist/src/_chunks/chunk-64RLSXHA.js.map +7 -0
  4. package/dist/src/_chunks/chunk-BWBMAWDD.js +235 -0
  5. package/dist/src/_chunks/{chunk-G2SXTUX4.js.map → chunk-BWBMAWDD.js.map} +3 -3
  6. package/dist/src/_chunks/chunk-E6L6DSL7.js +230 -0
  7. package/dist/src/_chunks/{chunk-LEEYMNMO.js.map → chunk-E6L6DSL7.js.map} +1 -1
  8. package/dist/src/_chunks/chunk-OF23NNWB.js +34 -0
  9. package/dist/src/_chunks/chunk-OF23NNWB.js.map +7 -0
  10. package/dist/src/_chunks/chunk-ONCDAC2F.js +802 -0
  11. package/dist/src/_chunks/chunk-ONCDAC2F.js.map +7 -0
  12. package/dist/src/_chunks/chunk-SSORLL57.js +219 -0
  13. package/dist/src/_chunks/{chunk-2ZECSTB4.js.map → chunk-SSORLL57.js.map} +1 -1
  14. package/dist/src/_chunks/chunk-VSZMABRM.js +54 -0
  15. package/dist/src/_chunks/{chunk-2V2HASKF.js.map → chunk-VSZMABRM.js.map} +1 -1
  16. package/dist/src/deep-links/react/index.js +8 -1
  17. package/dist/src/druids/react/index.js +25 -1
  18. package/dist/src/druids/react/index.js.map +1 -1
  19. package/dist/src/embedding/react/index.js +2908 -1
  20. package/dist/src/embedding/react/index.js.map +1 -1
  21. package/dist/src/inputs/published-definition.d.ts +52 -8
  22. package/dist/src/inputs/react/index.js +9 -1
  23. package/dist/src/inputs/schemas/generated/consumers/dashboard.d.ts +35 -0
  24. package/dist/src/inputs/schemas/generated/consumers/index.d.ts +15 -0
  25. package/dist/src/inputs/schemas/generated/consumers/notebook.d.ts +36 -0
  26. package/dist/src/inputs/schemas/generated/consumers/service-panel.d.ts +15 -0
  27. package/dist/src/inputs/schemas/generated/consumers/theme.d.ts +15 -0
  28. package/dist/src/inputs/schemas/index.d.ts +1 -20
  29. package/dist/src/inputs/schemas/index.js +15 -1
  30. package/dist/src/inputs/types.d.ts +19 -7
  31. package/package.json +5 -1
  32. package/dist/src/_chunks/chunk-2V2HASKF.js +0 -7
  33. package/dist/src/_chunks/chunk-2ZECSTB4.js +0 -7
  34. package/dist/src/_chunks/chunk-627KNBXP.js +0 -7
  35. package/dist/src/_chunks/chunk-627KNBXP.js.map +0 -7
  36. package/dist/src/_chunks/chunk-G2SXTUX4.js +0 -7
  37. package/dist/src/_chunks/chunk-LEEYMNMO.js +0 -7
  38. package/dist/src/_chunks/chunk-PA4Z7DNH.js +0 -7
  39. package/dist/src/_chunks/chunk-PA4Z7DNH.js.map +0 -7
  40. package/dist/src/_chunks/chunk-QOXXZE7D.js +0 -7
  41. package/dist/src/_chunks/chunk-QOXXZE7D.js.map +0 -7
  42. package/dist/src/inputs/schemas/dashboard.d.ts +0 -30
  43. package/dist/src/inputs/schemas/theme.d.ts +0 -15
@@ -30,13 +30,33 @@ export type PublishedDatadogAppInputsDefinition<TSchema extends AnyDatadogAppInp
30
30
  export type AnyPublishedDatadogAppInputsDefinition = AnyDatadogAppInputsSchema & Readonly<{
31
31
  [publishedDefinitionBrand]: unknown;
32
32
  }>;
33
+ /**
34
+ * Selected-public-version descriptor. Its exported object/API and declaration
35
+ * omit host construction and retained-version operations; this is not a
36
+ * transitive-source or bundle-secrecy boundary.
37
+ */
38
+ export type PublishedDatadogAppInput<TCurrent extends AnyContract, TSurfaces extends readonly SurfaceId[] = typeof EVERY_SURFACE> = Readonly<{
39
+ identifier: TCurrent['identifier'];
40
+ latest: TCurrent;
41
+ fields: TCurrent['fields'];
42
+ surfaces: TSurfaces;
43
+ [publishedDefinitionBrand]: (fields: TCurrent['fields']) => TCurrent['fields'];
44
+ }>;
45
+ /** The common claimable shape shared by package-owned host and consumer definitions. */
46
+ export type AnyPublishedDatadogAppInput = Readonly<{
47
+ identifier: string;
48
+ latest: AnyContract;
49
+ fields: Readonly<Record<string, AnyField>>;
50
+ surfaces: readonly SurfaceId[];
51
+ [publishedDefinitionBrand]: unknown;
52
+ }>;
33
53
  type PortableSchema<TSchema extends AnySchema> = ValueSchema<InferOf<TSchema>>;
34
54
  interface PortableValueBuilder {
35
55
  readOnly<TSchema extends AnySchema>(schema: ValidationOnlySchema<TSchema>): ValueField<PortableSchema<TSchema>>;
36
56
  }
37
57
  interface PortableFunctionBuilder {
38
58
  readOnly<const TInputs extends Readonly<Record<string, AnySchema>>, TResult extends AnySchema>(definition: Readonly<{
39
- inputs: {
59
+ inputs: TInputs & {
40
60
  readonly [TName in keyof TInputs]: ValidationOnlySchema<TInputs[TName]>;
41
61
  };
42
62
  result: ValidationOnlySchema<TResult>;
@@ -82,7 +102,8 @@ export declare function datadogAppInputsVersion<const TIdentifier extends string
82
102
  fields: ValidationOnlyFields<TFields>;
83
103
  }>): PortableContract<TIdentifier, TVersion, TFields>;
84
104
  /**
85
- * Publishes one package-owned inputs definition.
105
+ * Builds one package-owned versioned host definition. Schema publication
106
+ * separately chooses which served version the public SDK descriptor exposes.
86
107
  *
87
108
  * The common case is one version, declared inline -- `identifier`, `version`,
88
109
  * `fields`, and optionally the `surfaces` it is offered on. A schema that has
@@ -106,15 +127,38 @@ export declare function datadogAppInputsDefinition<TLatest extends AnyContract,
106
127
  surfaces?: TSurfaces;
107
128
  olderVersions?: TOlderVersions;
108
129
  }>): PublishedDatadogAppInputsDefinition<DatadogAppInputsSchema<TLatest, TSurfaces, TOlderVersions>>;
130
+ type ServedContract<TDefinition extends AnyPublishedDatadogAppInputsDefinition> = TDefinition['latest'] | Extract<TDefinition['olderVersions'][number], {
131
+ readonly contract: AnyContract;
132
+ }>['contract'];
133
+ /**
134
+ * Creates a selected-public-version descriptor for a contract the host serves.
135
+ * The boundary is its exported object/API and declaration, not transitive
136
+ * source dependencies or bundle secrecy.
137
+ */
138
+ export declare function createDatadogAppInputConsumer<TDefinition extends AnyPublishedDatadogAppInputsDefinition>(definition: TDefinition): PublishedDatadogAppInput<TDefinition['latest'], TDefinition['surfaces']>;
139
+ export declare function createDatadogAppInputConsumer<TDefinition extends AnyPublishedDatadogAppInputsDefinition, TContract extends ServedContract<TDefinition>>(definition: TDefinition, contract: TContract): PublishedDatadogAppInput<TContract, TDefinition['surfaces']>;
140
+ /**
141
+ * Attaches a build marker to a generated consumer. Build tooling (the Datadog
142
+ * Apps Vite plugin) reads these literals from an app's final bundle to learn
143
+ * which inputs the app actually uses, and tags the app with their surfaces.
144
+ * A marker only survives tree-shaking when its consumer does. Holding it at
145
+ * runtime keeps minifiers from discarding it as an unused argument.
146
+ *
147
+ * Format: `dd-app-input/v1 <identifier> surfaces=<id>,<id>` — no quotes or
148
+ * escapes, so any minifier leaves it intact. `surfaces` is empty for inputs
149
+ * offered on every surface, since those say nothing about where an app is
150
+ * meant to run.
151
+ */
152
+ export declare function withInputBuildMarker<TConsumer extends object>(consumer: TConsumer, marker: string): TConsumer;
109
153
  /** Rejects copied or user-authored definitions at the public React boundary. */
110
- export declare function assertPublishedDatadogAppInputsDefinition(definition: unknown): asserts definition is AnyPublishedDatadogAppInputsDefinition;
154
+ export declare function assertPublishedDatadogAppInputsDefinition(definition: unknown): asserts definition is AnyPublishedDatadogAppInput;
111
155
  /**
112
- * Reports whether a value is a definition created by `datadogAppInputsDefinition()`
113
- * (i.e. published through `@datadog/apps-frontend/inputs/schema`). Backed by the
114
- * same `WeakSet` brand as `assertPublishedDatadogAppInputsDefinition`, so it
115
- * cannot be spoofed by a duck-typed lookalike.
156
+ * Reports whether a value is a package-created host definition or consumer
157
+ * descriptor. This ownership brand does not decide public SDK publication or
158
+ * authorization. It uses the same `WeakSet` as
159
+ * `assertPublishedDatadogAppInputsDefinition`, so a copied lookalike does not match.
116
160
  */
117
- export declare function isPublishedDatadogAppInputsDefinition(definition: unknown): definition is PublishedDatadogAppInputsDefinition<AnyDatadogAppInputsSchema>;
161
+ export declare function isPublishedDatadogAppInputsDefinition(definition: unknown): definition is AnyPublishedDatadogAppInput;
118
162
  /**
119
163
  * Turns one plain value into the field descriptor that carries it: a function
120
164
  * becomes a callable field with validated inputs and result, anything else a
@@ -3,5 +3,13 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import{a}from"../../_chunks/chunk-627KNBXP.js";import"../../_chunks/chunk-2V2HASKF.js";import"../../_chunks/chunk-G2SXTUX4.js";import"../../_chunks/chunk-LEEYMNMO.js";export{a as useDatadogAppInput};
6
+ import {
7
+ a
8
+ } from "../../_chunks/chunk-OF23NNWB.js";
9
+ import "../../_chunks/chunk-VSZMABRM.js";
10
+ import "../../_chunks/chunk-BWBMAWDD.js";
11
+ import "../../_chunks/chunk-E6L6DSL7.js";
12
+ export {
13
+ a as useDatadogAppInput
14
+ };
7
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,35 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import type { ValueSchema, ValueField } from '../../../../embedding/types.js';
7
+ import type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition.js';
8
+ import type { DatadogAppInputsHostValues } from '../../../types.js';
9
+ type Payload0 = {
10
+ "timeframe": Payload1;
11
+ "templateVariables": Payload3;
12
+ };
13
+ type Payload1 = {
14
+ "start": number;
15
+ "end": number;
16
+ "isLive": Payload2;
17
+ };
18
+ type Payload2 = false | true;
19
+ type Payload3 = Array<Payload4>;
20
+ type Payload4 = {
21
+ "name": string;
22
+ "value": string;
23
+ "values"?: Payload5;
24
+ "prefix"?: Payload7;
25
+ "default"?: Payload7;
26
+ };
27
+ type Payload5 = undefined | Payload6;
28
+ type Payload6 = Array<string>;
29
+ type Payload7 = undefined | string;
30
+ type Current = PortableContract<"datadog.dashboard", 1, {
31
+ "dashboard": ValueField<ValueSchema<Payload0>>;
32
+ }>;
33
+ export declare const datadogDashboard: PublishedDatadogAppInput<Current, readonly ["datadog.dashboard"]>;
34
+ export type DashboardInputs = DatadogAppInputsHostValues<typeof datadogDashboard>;
35
+ export {};
@@ -0,0 +1,15 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import type { AnyPublishedDatadogAppInput } from '../../../published-definition.js';
7
+ export { datadogTheme } from './theme.js';
8
+ export type { DatadogAppTheme } from './theme.js';
9
+ export { datadogDashboard } from './dashboard.js';
10
+ export type { DashboardInputs } from './dashboard.js';
11
+ export { datadogNotebook } from './notebook.js';
12
+ export type { NotebookInputs } from './notebook.js';
13
+ export { datadogServicePanel } from './service-panel.js';
14
+ export type { ServicePanelInputs } from './service-panel.js';
15
+ export type DatadogAppInputDefinition = Extract<(typeof import('./index.js'))[keyof typeof import('./index.js')], AnyPublishedDatadogAppInput>;
@@ -0,0 +1,36 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import type { ValueSchema, ValueField } from '../../../../embedding/types.js';
7
+ import type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition.js';
8
+ import type { DatadogAppInputsHostValues } from '../../../types.js';
9
+ type Payload0 = {
10
+ "timeframe": Payload1;
11
+ "templateVariables": Payload3;
12
+ };
13
+ type Payload1 = {
14
+ "start": number;
15
+ "end": number;
16
+ "isLive": Payload2;
17
+ };
18
+ type Payload2 = false | true;
19
+ type Payload3 = Array<Payload4>;
20
+ type Payload4 = {
21
+ "name": string;
22
+ "value": string;
23
+ "values"?: Payload5;
24
+ "prefix"?: Payload7;
25
+ "default"?: Payload7;
26
+ "availableValues"?: Payload5;
27
+ };
28
+ type Payload5 = undefined | Payload6;
29
+ type Payload6 = Array<string>;
30
+ type Payload7 = undefined | string;
31
+ type Current = PortableContract<"datadog.notebook", 1, {
32
+ "notebook": ValueField<ValueSchema<Payload0>>;
33
+ }>;
34
+ export declare const datadogNotebook: PublishedDatadogAppInput<Current, readonly ["datadog.notebook"]>;
35
+ export type NotebookInputs = DatadogAppInputsHostValues<typeof datadogNotebook>;
36
+ export {};
@@ -0,0 +1,15 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types.js';
7
+ import type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition.js';
8
+ import type { DatadogAppInputsHostValues } from '../../../types.js';
9
+ type Current = PortableContract<"datadog.idp.service-panel", 1, {
10
+ "service": ValueField<ValueSchema<string>>;
11
+ "close": FunctionField<{}, ValueSchema<undefined>>;
12
+ }>;
13
+ export declare const datadogServicePanel: PublishedDatadogAppInput<Current, readonly ["datadog.idp.service-panel"]>;
14
+ export type ServicePanelInputs = DatadogAppInputsHostValues<typeof datadogServicePanel>;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import type { ValueSchema, ValueField } from '../../../../embedding/types.js';
7
+ import type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition.js';
8
+ import type { DatadogAppInputsHostValues } from '../../../types.js';
9
+ type Payload0 = "light" | "dark";
10
+ type Current = PortableContract<"datadog.theme", 1, {
11
+ "theme": ValueField<ValueSchema<Payload0>>;
12
+ }>;
13
+ export declare const datadogTheme: PublishedDatadogAppInput<Current, readonly ["datadog.idp.homepage", "datadog.idp.service-panel", "datadog.idp.self-service", "datadog.app-builder", "datadog.appsec", "datadog.notebook", "datadog.dashboard"]>;
14
+ export type DatadogAppTheme = DatadogAppInputsHostValues<typeof datadogTheme>['theme'];
15
+ export {};
@@ -3,23 +3,4 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- /**
7
- * `@datadog/apps-frontend/inputs/schema`'s npm entry. Anything defined under
8
- * this directory that should reach consumers of the published package must
9
- * be exported from this file -- not from any individual schema module.
10
- *
11
- * Exporting a schema here is the whole of publishing it:
12
- * `DatadogAppInputDefinition` is derived from what this file hands out, so the
13
- * hook accepts exactly that and nothing else.
14
- */
15
- import type { AnyDatadogAppInputsSchema } from '../published-definition.js';
16
- export { datadogTheme } from './theme.js';
17
- export type { DatadogAppTheme } from './theme.js';
18
- export { datadogDashboard } from './dashboard.js';
19
- export type { DashboardInputs } from './dashboard.js';
20
- /**
21
- * Every published input an app may claim -- read off this module's own exports,
22
- * so exporting a schema above is the whole of publishing it. There is no second
23
- * list to keep in step, and `useDatadogAppInput` widens automatically.
24
- */
25
- export type DatadogAppInputDefinition = Extract<(typeof import('./index.js'))[keyof typeof import('./index.js')], AnyDatadogAppInputsSchema>;
6
+ export * from './generated/consumers/index.js';
@@ -3,5 +3,19 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import{a,b}from"../../_chunks/chunk-QOXXZE7D.js";import"../../_chunks/chunk-PA4Z7DNH.js";import"../../_chunks/chunk-G2SXTUX4.js";import"../../_chunks/chunk-LEEYMNMO.js";export{b as datadogDashboard,a as datadogTheme};
6
+ import {
7
+ a,
8
+ b,
9
+ c,
10
+ d
11
+ } from "../../_chunks/chunk-64RLSXHA.js";
12
+ import "../../_chunks/chunk-ONCDAC2F.js";
13
+ import "../../_chunks/chunk-BWBMAWDD.js";
14
+ import "../../_chunks/chunk-E6L6DSL7.js";
15
+ export {
16
+ b as datadogDashboard,
17
+ c as datadogNotebook,
18
+ d as datadogServicePanel,
19
+ a as datadogTheme
20
+ };
7
21
  //# sourceMappingURL=index.js.map
@@ -3,8 +3,8 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import type { AnyContract, AnyField, AnySchema, ClaimedValues, FunctionField, FunctionInputs, HostFunctionContext, InferOf, ValueField } from '../embedding/types.js';
7
- import type { UnionToIntersection } from '../embedding/versioning.js';
6
+ import type { AnyContract, AnyField, ClaimedValues, FunctionField, FunctionInputs, HostFunctionContext, InferOf, ValueField } from '../embedding/types.js';
7
+ import type { AnyVersionedContract, UnionToIntersection } from '../embedding/versioning.js';
8
8
  /**
9
9
  * Anything a host supplies values for: one flat namespace of fields. An
10
10
  * inputs definition satisfies this with the union of every version's fields,
@@ -39,12 +39,24 @@ export type FieldsHostImplementation<TFields extends Record<string, AnyField>> =
39
39
  * versions need, with nothing marking which is which.
40
40
  */
41
41
  export type DatadogAppInputImplementations<TSchema extends AnyFieldsOwner> = FieldsHostImplementation<TSchema['fields']>;
42
- export type DatadogAppInputValueUpdates<TSchema extends AnyFieldsOwner> = Readonly<{
43
- [TKey in keyof TSchema['fields'] as TSchema['fields'][TKey] extends ValueField<AnySchema> ? TKey : never]: TSchema['fields'][TKey] extends ValueField<infer TSchema2> ? InferOf<TSchema2> : never;
44
- }>;
45
42
  /**
46
- * `update()`'s shape: unlike construction, a caller only names the value
47
- * fields it wants to change, so every field is optional.
43
+ * A retained contract derives ordinary values and callbacks from current inputs
44
+ * and its named extras. Conversion is synchronous and pure; returned callbacks
45
+ * may be asynchronous and receive the original host context.
48
46
  */
47
+ export interface RetainedDatadogAppInputsVersion<TCurrent extends AnyContract, TRetained extends AnyContract, TExtras extends Record<string, AnyField>> {
48
+ readonly contract: TRetained;
49
+ readonly extraInputs: TExtras;
50
+ convert(current: FieldsHostImplementation<TCurrent['fields']>, extra: FieldsHostImplementation<TExtras>): FieldsHostImplementation<TRetained['fields']>;
51
+ }
52
+ /** A host-side definition and its complete, plain implementations. */
53
+ export interface DatadogAppInputBinding<TDefinition extends AnyVersionedContract> {
54
+ readonly definition: TDefinition;
55
+ readonly values: DatadogAppInputImplementations<TDefinition>;
56
+ }
57
+ export type DatadogAppInputValueUpdates<TSchema extends AnyFieldsOwner> = Readonly<{
58
+ [TKey in keyof TSchema['fields'] as TSchema['fields'][TKey]['kind'] extends 'value' ? TKey : never]: TSchema['fields'][TKey] extends ValueField<infer TSchema2> ? InferOf<TSchema2> : never;
59
+ }>;
60
+ /** `update()` accepts a partial record of value fields; callbacks stay session-stable. */
49
61
  export type DatadogAppInputPartialValueUpdates<TSchema extends AnyFieldsOwner> = Partial<DatadogAppInputValueUpdates<TSchema>>;
50
62
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/apps-frontend",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "private": false,
5
5
  "description": "React inputs for Datadog Apps",
6
6
  "homepage": "https://datadoghq.com",
@@ -81,6 +81,9 @@
81
81
  },
82
82
  "scripts": {
83
83
  "build": "node build.cjs",
84
+ "generate:inputs": "node src/inputs/schemas/tooling/generate.cjs --write",
85
+ "check:inputs": "node src/inputs/schemas/tooling/generate.cjs --check",
86
+ "test:inputs-codegen": "node --test src/inputs/schemas/tooling/*.test.cjs",
84
87
  "lint": "lint:workspace",
85
88
  "test-unit": "test-unit:workspace",
86
89
  "typecheck": "typecheck:workspace"
@@ -101,6 +104,7 @@
101
104
  "esbuild": "0.27.5",
102
105
  "react": "catalog:",
103
106
  "react-dom": "catalog:",
107
+ "rollup": "4.45.1",
104
108
  "typescript": "patch:typescript%40npm%3A6.0.2#~/.yarn/patches/typescript-npm-6.0.2-no-dts-errors.patch"
105
109
  },
106
110
  "peerDependencies": {
@@ -1,7 +0,0 @@
1
- /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
- * Copyright 2019-Present Datadog, Inc.
4
- */
5
-
6
- var n=new WeakMap,o=3e4;function l(e){let t=n.get(e);if(t)return t.cleanupTimer!==void 0&&(globalThis.clearTimeout(t.cleanupTimer),t.cleanupTimer=void 0),t;let r={release:e.start()};return n.set(e,r),r}function p(e){let t=n.get(e);return t?(n.delete(e),t.cleanupTimer!==void 0&&globalThis.clearTimeout(t.cleanupTimer),t.release):e.start()}function c(e,t){n.get(e)!==t||t.cleanupTimer!==void 0||(t.cleanupTimer=globalThis.setTimeout(()=>{n.get(e)===t&&(n.delete(e),t.release())},o))}import{createContext as a,createElement as s,useContext as u,useEffect as d}from"react";var i=a(null);function g(e){return function({children:r}){return d(()=>p(e),[]),s(i.Provider,{value:e},r)}}function A(){let e=u(i);if(!e)throw new Error("Datadog App hooks must be used within DatadogAppProvider.");return e}export{l as a,c as b,g as c,A as d};
7
- //# sourceMappingURL=chunk-2V2HASKF.js.map
@@ -1,7 +0,0 @@
1
- /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
- * Copyright 2019-Present Datadog, Inc.
4
- */
5
-
6
- import{a as u,d as b,g as v}from"./chunk-PA4Z7DNH.js";import{J as h,K as f}from"./chunk-LEEYMNMO.js";var y=Symbol("DatadogAppProviderModule");function A(t,e,n){if(t.length===0)throw new Error("A Datadog App provider module requires an id.");return Object.freeze({id:t,config:Object.freeze({...e}),[y]:n})}function k(t,e){try{console.error(`Installing the "${t}" Datadog App provider module failed; the remaining modules and the app still run.`,e)}catch{}}function F(t,e,n){let a=new Set;for(let o of t){if(a.has(o.id))throw new Error(`DatadogAppProvider received duplicate module "${o.id}".`);a.add(o.id)}let d=Object.freeze({embedding:e,disposeSignal:n});for(let o of t)try{o[y].install(d)}catch(i){k(o.id,i)}}var S=u(),D=b(),P=f({identifier:"datadog.deep-links",version:2,fields:{setDeepLinkState:h.readOnly({inputs:{search:S,fragment:S},result:D})}}),T=v(u(),u()),_=f({identifier:"datadog.deep-links",version:1,fields:{setDeepLinkVariables:h.readOnly({inputs:{variables:T,fragment:S},result:D})}});var C=Object.freeze({search:"",fragment:""});function M(){return typeof globalThis.location>"u"?C:Object.freeze({search:globalThis.location.search,fragment:globalThis.location.hash})}function x(t,e){console.error(`[datadog-apps:deep-links] ${t}`,e??"")}var r=null;function l(){m()}function E({search:t,fragment:e}){return JSON.stringify([t,e])}function m(t=!1){let e=r;if(e===null)return;let n=M(),a=E(n);!t&&e.lastPublishedFingerprint===a||(e.lastPublishedFingerprint=a,R(n))}function R(t){let e=r?.publishers;if(e===void 0)return;let n=e.values().next();n.done===!1&&n.value(t)}function I(t){let e=r?.publishers;if(e===void 0)return!1;let n=e.values().next();return n.done===!1&&n.value===t}function w(t){if(r!==null)return r.publishers.add(t),r;let e=globalThis.history,n=e.pushState,a=e.replaceState,d=new Set([t]),o=()=>{m()},i=function(s,c,g){n.call(e,s,c,g),o()},p=function(s,c,g){a.call(e,s,c,g),o()};try{e.pushState=i,e.replaceState=p,globalThis.addEventListener("popstate",l),globalThis.addEventListener("hashchange",l)}catch(s){throw e.replaceState===p&&(e.replaceState=a),e.pushState===i&&(e.pushState=n),globalThis.removeEventListener("popstate",l),globalThis.removeEventListener("hashchange",l),s}return r={pushState:i,replaceState:p,originalPushState:n,originalReplaceState:a,publishers:d,lastPublishedFingerprint:null},r}function z(t){let e=r;if(e===null||(e.publishers.delete(t),e.publishers.size>0))return;let n=globalThis.history;n.pushState===e.pushState&&(n.pushState=e.originalPushState),n.replaceState===e.replaceState&&(n.replaceState=e.originalReplaceState),globalThis.removeEventListener("popstate",l),globalThis.removeEventListener("hashchange",l),r=null}function L({embedding:t,disposeSignal:e}){if(e.aborted)return;let n=t.getClaim(P),a=({search:i,fragment:p})=>{let s=n.getSnapshot();s.status==="ready"&&s.fields.setDeepLinkState({search:i,fragment:p}).catch(c=>x("The app URL state could not be synchronized to the embedding host.",c))},d=i=>{i.status==="ready"&&I(a)&&m(!0)},o=n.subscribe(()=>{d(n.getSnapshot())});try{w(a)}catch(i){throw o(),i}d(n.getSnapshot()),e.addEventListener("abort",()=>{o(),z(a)},{once:!0})}var O=Object.freeze({});function J(){return A("datadog.deep-links",O,{install({embedding:t,disposeSignal:e}){L({embedding:t,disposeSignal:e})}})}export{F as a,J as b};
7
- //# sourceMappingURL=chunk-2ZECSTB4.js.map
@@ -1,7 +0,0 @@
1
- /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
- * Copyright 2019-Present Datadog, Inc.
4
- */
5
-
6
- import{d as i}from"./chunk-2V2HASKF.js";import{c as n}from"./chunk-G2SXTUX4.js";import{useSyncExternalStore as a}from"react";function o(t){let p=i();n(t);let e=p.getClaim(t.latest);return a(e.subscribe,e.getSnapshot,e.getSnapshot)}function d(t){return o(t)}export{d as a};
7
- //# sourceMappingURL=chunk-627KNBXP.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/inputs/react/use-package-datadog-app-input.ts", "../../../src/inputs/react/use-datadog-app-input.ts"],
4
- "sourcesContent": ["import { useSyncExternalStore } from 'react';\n\nimport { useAppEmbedding } from '../../embedding/react/context';\nimport type { ClaimState } from '../../embedding/types';\nimport type { AnyPublishedDatadogAppInputsDefinition } from '../published-definition';\nimport { assertPublishedDatadogAppInputsDefinition } from '../published-definition';\n\n/** Claims a package-owned definition that is absent from the public schema barrel. */\nexport function usePackageDatadogAppInput<\n TDefinition extends AnyPublishedDatadogAppInputsDefinition,\n>(definition: TDefinition): ClaimState<TDefinition['latest']> {\n const embedding = useAppEmbedding();\n assertPublishedDatadogAppInputsDefinition(definition);\n const store = embedding.getClaim<TDefinition['latest']>(definition.latest);\n return useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getSnapshot,\n );\n}\n", "import type { ClaimState } from '../../embedding/types';\nimport type { DatadogAppInputDefinition } from '../schemas/index';\n\nimport { usePackageDatadogAppInput } from './use-package-datadog-app-input';\n\n/**\n * What {@link useDatadogAppInput} gives back for one input: `pending` while the\n * connection or claim is in flight, `ready` with validated `fields`, `unavailable`\n * when this host does not provide the input, or `failed` with an actionable\n * `error`. `fields` exists only on `ready`, so stale values can never be read as\n * live.\n *\n * Named in terms of the input rather than the contract behind it -- which\n * version is being served is not a caller's concern.\n */\nexport type DatadogAppInputState<\n TDefinition extends DatadogAppInputDefinition,\n> = ClaimState<TDefinition['latest']>;\n\n/**\n * A type that refuses to match while saying why.\n *\n * A compiler error is the one piece of documentation a caller cannot skip, so\n * rejections here resolve to a sentence rather than to a bare `never` -- the\n * message becomes the error text, at the call site, in the editor.\n */\ntype Rejected<TMessage extends string> = Readonly<{\n __datadogAppInputsError: TMessage;\n}>;\n\ntype PublishedDefinitionFor<TDefinition extends DatadogAppInputDefinition> =\n Extract<\n DatadogAppInputDefinition,\n Readonly<{ identifier: TDefinition['identifier'] }>\n >;\n\ntype NoExtraFields<TDefinition extends DatadogAppInputDefinition> =\n Exclude<\n keyof TDefinition['latest']['fields'],\n keyof PublishedDefinitionFor<TDefinition>['latest']['fields']\n > extends never\n ? unknown\n : Rejected<'This definition has fields the published one does not. Pass a definition exported from @datadog/apps-frontend/inputs/schema, unmodified.'>;\n\n/**\n * Claims one Datadog App input and tracks its state across renders. Call it\n * below {@link DatadogAppProvider}.\n *\n * Pass a definition exported from `@datadog/apps-frontend/inputs/schema` --\n * {@link datadogTheme} is one. Hovering a definition shows the surfaces it is\n * offered on; the returned {@link ClaimState} says whether its values are usable\n * yet, and carries `fields` only while they are.\n *\n * Versions are not a caller's concern: this claims whichever version the\n * installed copy of the package treats as latest. An older copy asks for an\n * older version and keeps working for as long as the host still converts to it.\n * Past that the claim fails with `APP_MAJOR_TOO_OLD` -- update this package and\n * re-upload the app -- rather than silently degrading.\n *\n * @param definition An input definition from `@datadog/apps-frontend/inputs/schema`.\n * @returns The claim's current state: `pending`, `ready` (with `fields`),\n * `unavailable` when this host does not provide the input, or `failed` with an\n * actionable `error`.\n */\nexport function useDatadogAppInput<\n const TDefinition extends DatadogAppInputDefinition,\n>(\n definition: TDefinition & NoExtraFields<TDefinition>,\n): DatadogAppInputState<TDefinition> {\n return usePackageDatadogAppInput<TDefinition>(definition);\n}\n"],
5
- "mappings": "gFAAA,OAAS,wBAAAA,MAA4B,QAQ9B,SAASC,EAEdC,EAA4D,CAC1D,IAAMC,EAAYC,EAAgB,EAClCC,EAA0CH,CAAU,EACpD,IAAMI,EAAQH,EAAU,SAAgCD,EAAW,MAAM,EACzE,OAAOK,EACHD,EAAM,UACNA,EAAM,YACNA,EAAM,WACV,CACJ,CC6CO,SAASE,EAGZC,EACiC,CACjC,OAAOC,EAAuCD,CAAU,CAC5D",
6
- "names": ["useSyncExternalStore", "usePackageDatadogAppInput", "definition", "embedding", "useAppEmbedding", "assertPublishedDatadogAppInputsDefinition", "store", "useSyncExternalStore", "useDatadogAppInput", "definition", "usePackageDatadogAppInput"]
7
- }
@@ -1,7 +0,0 @@
1
- /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
- * Copyright 2019-Present Datadog, Inc.
4
- */
5
-
6
- import{A as d,E as s,F as O,G as p,H as C,I as A,K as I,r as u,s as l}from"./chunk-LEEYMNMO.js";var F=["datadog.idp.homepage","datadog.idp.service-panel","datadog.idp.self-service","datadog.app-builder","datadog.appsec","datadog.notebook","datadog.dashboard"];function S(e,n,t){let o=Object.create(null),a=n;for(let[r,i]of Object.entries(e.fields))o[r]=i.kind==="value"?a[r]:Object.freeze({invoke:a[r]});return O(e,Object.freeze(o),t)}function h(e,n){let t=Object.create(null);for(let o of n)t[o]=e[o];return t}function E(e,n){if(e.kind!==n.kind)return!1;if(e.kind==="value"&&n.kind==="value")return e.schema===n.schema;if(e.kind==="function"&&n.kind==="function"){let t=Object.keys(e.inputs),o=Object.keys(n.inputs);return!(t.length!==o.length||e.result!==n.result||t.some(a=>!Object.prototype.hasOwnProperty.call(n.inputs,a)||e.inputs[a]!==n.inputs[a]))}return!1}function L(e,n){let t=Object.create(null);for(let[o,a]of Object.entries(e.fields))t[o]=a;for(let o of n)for(let[a,r]of Object.entries(o.extraInputs)){if(Object.prototype.hasOwnProperty.call(e.fields,a))throw new Error(`"${e.identifier}" v${o.contract.version} declares extra input "${a}", which already names a field of v${e.version}.`);let i=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(i&&!E(i,r))throw new Error(`"${e.identifier}" extra input "${a}" is declared with conflicting schemas by more than one older version.`);t[a]=r}return Object.freeze(t)}function V(e,...n){let t=new Set([e.version]);for(let r of n){if(r.contract.identifier!==e.identifier)throw new Error(`Older version "${r.contract.identifier}" v${r.contract.version} must share identifier "${e.identifier}" with its latest contract.`);if(r.contract.version>=e.version)throw new Error(`Older version "${e.identifier}" v${r.contract.version} must be older than latest v${e.version}.`);if(t.has(r.contract.version))throw new Error(`"${e.identifier}" declares version ${r.contract.version} more than once.`);t.add(r.contract.version)}let o=L(e,n),a=Object.keys(e.fields);return Object.freeze({identifier:e.identifier,latest:e,olderVersions:Object.freeze([...n]),fields:o,buildModules(r,i){let y=r,f=h(y,a),m=[S(e,f,i)];for(let c of n){let g=c.convert(f,h(y,Object.keys(c.extraInputs)));m.push(S(c.contract,g,i))}return Object.freeze(m)}})}var R=new WeakSet,x=/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;function b(e,n,t){if(!s.test(n)||n.length>l||!p(t))throw new Error(`Datadog App input field "${e}.${n}" must have a name matching ${String(s)} of at most ${l} characters and be a read-only value or function whose schemas implement Standard Schema V1.`);if(t.kind==="function"){for(let o of Object.keys(t.inputs))if(!s.test(o))throw new Error(`Datadog App input function parameter "${e}.${n}.${o}" must have a name matching ${String(s)}.`);if(!C(t))throw new Error(`Datadog App input function field "${e}.${n}" declares a timeoutMs no call could meet. It must be greater than 0 and at most ${2147483647}.`)}}function T(e){if(!d(e)||typeof e.identifier!="string"||!x.test(e.identifier))throw new Error(`Datadog App input contract identifier "${String(d(e)?e.identifier:void 0)}" must match ${String(x)}.`);if(typeof e.version!="number"||!Number.isSafeInteger(e.version)||e.version<1)throw new Error(`Datadog App input contract "${e.identifier}" must have a positive integer version.`);if(!d(e.fields)||Object.keys(e.fields).length===0||Object.keys(e.fields).length>u)throw new Error(`Datadog App input contract "${e.identifier}" must define between 1 and ${u} fields.`);for(let[n,t]of Object.entries(e.fields))b(e.identifier,n,t)}function D(e,n){if(!d(n))throw new Error(`Older Datadog App input contract "${e}" must declare its extra inputs as an object.`);for(let[t,o]of Object.entries(n))b(e,t,o)}var J=Object.freeze({readOnly(e){return A.readOnly(e)}});function N(e){let n=I(e);return T(n),n}function Y(e){let n=e,t="latest"in n?n.latest:N(n),o=n.olderVersions??[];T(t);for(let i of o)T(i.contract),D(t.identifier,i.extraInputs);let a=V(t,...o),r=Object.freeze({...a,surfaces:Object.freeze([...n.surfaces??F])});return R.add(r),r}function K(e){if(typeof e!="object"||e===null||!R.has(e))throw new Error("useDatadogAppInput() requires a definition exported by @datadog/apps-frontend/inputs/schema.")}export{J as a,Y as b,K as c};
7
- //# sourceMappingURL=chunk-G2SXTUX4.js.map
@@ -1,7 +0,0 @@
1
- /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
- * Copyright 2019-Present Datadog, Inc.
4
- */
5
-
6
- var _=Object.defineProperty;var u=e=>{throw TypeError(e)};var A=(e,n,t)=>n in e?_(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var I=(e,n,t)=>A(e,typeof n!="symbol"?n+"":n,t),s=(e,n,t)=>n.has(e)||u("Cannot "+t);var v=(e,n,t)=>(s(e,n,"read from private field"),t?t.call(e):n.get(e)),w=(e,n,t)=>n.has(e)?u("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),V=(e,n,t,r)=>(s(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t),L=(e,n,t)=>(s(e,n,"access private method"),t);function k(e,n){if(!Number.isFinite(n)||n<0||n>2147483647)throw new RangeError(`${e} must be a finite number between 0 and 2147483647.`)}var C=1e4,D=5e3,j=250,H=1e3,$=1e4,X=45e3,z=128,U=256,P=256,B=128,Y=32,a=128,f=256;var g="[Datadog Apps embedding]";function o(e,n=0){if(!(e instanceof Error))return e;try{let t={name:e.name,message:e.message};return typeof e.stack=="string"&&(t.stack=e.stack),e.cause!==void 0&&(t.cause=n<3?o(e.cause,n+1):"(cause chain truncated)"),t}catch{return"(cause could not be described)"}}function W(e){return"cause"in e?{...e,cause:o(e.cause)}:e}function m(e,n,t){try{globalThis.console?.[e](`${g} ${n}`,t)}catch{}}function Z(e,n={}){m("warn",e,n)}function c(e,n={}){m("error",e,n)}var p=0;function K(e){return p+=1,`${e}:${S()}:${p.toString(36)}`}function S(){let e=new Uint8Array(8);globalThis.crypto.getRandomValues(e);let n="";for(let t of e)n+=t.toString(16).padStart(2,"0");return n}function Q(e){return{ok:!0,value:e}}function ee(e){return{ok:!1,error:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e,n){return typeof e=="string"&&e.length>0&&(n===void 0||e.length<=n)}function ne(e,n){try{n()}catch(t){c("a teardown step failed",{description:e,cause:o(t)})}}function te(e,...n){for(let t of[...e])try{t(...n)}catch(r){c("an embedding listener threw",{cause:o(r)}),globalThis.queueMicrotask(()=>{throw r})}}var O=/^[A-Za-z][A-Za-z0-9_]*$/,b=new WeakSet;function se(e,n,t){let r=Object.create(null);for(let[h,E]of Object.entries(n))r[h]=E;Object.freeze(r);let l=Object.freeze(t===void 0?{contract:e,implementation:r}:{contract:e,implementation:r,signal:t});return b.add(l),l}function d(e){if(!(typeof e=="object"&&e!==null||typeof e=="function"))return!1;let n=e["~standard"];return i(n)&&n.version===1&&typeof n.validate=="function"}function M(e){return i(e)&&e.kind==="value"&&d(e.schema)}function R(e){return i(e)&&e.kind==="function"&&i(e.inputs)&&Object.entries(e.inputs).every(([n,t])=>n.length>0&&d(t))&&d(e.result)}function x(e){return M(e)||R(e)}function F(e){return e.kind!=="function"||e.timeoutMs===void 0||typeof e.timeoutMs=="number"&&Number.isFinite(e.timeoutMs)&&e.timeoutMs>0&&e.timeoutMs<=2147483647}var ae=Object.freeze({readOnly(e){return Object.freeze({kind:"value",schema:e})}}),ce=Object.freeze({readOnly({inputs:e,result:n,timeoutMs:t}){return Object.freeze(t===void 0?{kind:"function",inputs:e,result:n}:{kind:"function",inputs:e,result:n,timeoutMs:t})}});function de(e){if(!y(e.identifier))throw new Error(`Invalid embedding contract identifier "${String(e.identifier)}".`);if(!Number.isSafeInteger(e.version)||e.version<1)throw new Error(`Embedding contract "${e.identifier}" must have a positive integer version.`);let n=Object.entries(e.fields);if(n.length===0||n.length>a)throw new Error(`Embedding contract "${e.identifier}" must define between 1 and ${a} fields.`);for(let[t,r]of n){if(!O.test(t)||t.length>f||!x(r))throw new Error(`Embedding contract field "${e.identifier}.${t}" must be a named read-only value or function whose schemas implement Standard Schema V1.`);if(!F(r))throw new Error(`Embedding contract field "${e.identifier}.${t}" declares a timeoutMs no call could meet. It must be greater than 0 and at most ${2147483647}.`)}return Object.freeze({identifier:e.identifier,version:e.version,fields:Object.freeze(Object.fromEntries(n.map(([t,r])=>[t,r.kind==="value"?Object.freeze({...r,schema:r.schema}):Object.freeze({...r,inputs:Object.freeze({...r.inputs}),result:r.result})])))})}export{I as a,v as b,w as c,V as d,L as e,k as f,C as g,D as h,j as i,H as j,$ as k,X as l,z as m,U as n,P as o,B as p,Y as q,a as r,f as s,o as t,W as u,Z as v,c as w,K as x,Q as y,ee as z,i as A,y as B,ne as C,te as D,O as E,se as F,x as G,F as H,ae as I,ce as J,de as K};
7
- //# sourceMappingURL=chunk-LEEYMNMO.js.map
@@ -1,7 +0,0 @@
1
- /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
- * Copyright 2019-Present Datadog, Inc.
4
- */
5
-
6
- var Oe=Object.freeze({status:"aborted"});function v(e,t,r){function n(o,l){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),o._zod.traits.has(e))return;o._zod.traits.add(e),t(o,l);let c=a.prototype,f=Object.keys(c);for(let g=0;g<f.length;g++){let $=f[g];$ in o||(o[$]=c[$].bind(o))}}let i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function a(o){var l;let c=r?.Parent?new s:this;n(c,o),(l=c._zod).deferred??(l.deferred=[]);for(let f of c._zod.deferred)f();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var x=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};var F={};function k(e){return e&&Object.assign(F,e),F}function J(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function Q(e,t){return typeof t=="bigint"?t.toString():t}function G(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ee(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var H=Symbol("evaluating");function I(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==H)return n===void 0&&(n=H,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var K="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function T(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Te=G(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function te(e){if(T(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(T(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}var re=new Set(["string","number","symbol"]);function N(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ne(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ne={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function j(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function z(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function O(e){return typeof e=="string"?e:e?.message}function S(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(r.customError?.(e))??O(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}var ie=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Q,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oe=v("$ZodError",ie),U=v("$ZodError",ie,{Parent:Error});var Ae=e=>(t,r,n,i)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new x;if(a.issues.length){let o=new(i?.Err??e)(a.issues.map(l=>S(l,s,k())));throw K(o,i?.callee),o}return a.value},A=Ae(U),Me=e=>async(t,r,n,i)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let o=new(i?.Err??e)(a.issues.map(l=>S(l,s,k())));throw K(o,i?.callee),o}return a.value},M=Me(U),Le=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new x;return s.issues.length?{success:!1,error:new(e??oe)(s.issues.map(a=>S(a,i,k())))}:{success:!0,data:s.value}},P=Le(U),Re=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>S(a,i,k())))}:{success:!0,data:s.value}},Z=Re(U);var Ce="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Fe=new RegExp(`^${Ce}$`);var ae=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var W=/^-?\d+(?:\.\d+)?$/,ue=/^(?:true|false)$/i;var ce=/^undefined$/i;var se={major:4,minor:3,patch:6};var h=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=se;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,o,l)=>{let c=j(a),f;for(let g of o){if(g._zod.def.when){if(!g._zod.def.when(a))continue}else if(c)continue;let $=a.issues.length,b=g._zod.check(a);if(b instanceof Promise&&l?.async===!1)throw new x;if(f||b instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await b,a.issues.length!==$&&(c||(c=j(a,$)))});else{if(a.issues.length===$)continue;c||(c=j(a,$))}}return f?f.then(()=>a):a},s=(a,o,l)=>{if(j(a))return a.aborted=!0,a;let c=i(o,n,l);if(c instanceof Promise){if(l.async===!1)throw new x;return c.then(f=>e._zod.parse(f,l))}return e._zod.parse(c,l)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction==="backward"){let c=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return c instanceof Promise?c.then(f=>s(f,a,o)):s(c,a,o)}let l=e._zod.parse(a,o);if(l instanceof Promise){if(o.async===!1)throw new x;return l.then(c=>i(c,n,o))}return i(l,n,o)}}I(e,"~standard",()=>({validate:i=>{try{let s=P(e,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Z(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),B=v("$ZodString",(e,t)=>{h.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ae(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var fe=v("$ZodNumber",(e,t)=>{h.init(e,t),e._zod.pattern=e._zod.bag.pattern??W,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),r}});var X=v("$ZodBoolean",(e,t)=>{h.init(e,t),e._zod.pattern=ue,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}});var ge=v("$ZodUndefined",(e,t)=>{h.init(e,t),e._zod.pattern=ce,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}});function de(e,t,r){e.issues.length&&t.issues.push(...z(r,e.issues)),t.value[r]=e.value}var ve=v("$ZodArray",(e,t)=>{h.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let s=[];for(let a=0;a<i.length;a++){let o=i[a],l=t.element._zod.run({value:o,issues:[]},n);l instanceof Promise?s.push(l.then(c=>de(c,r,a))):de(l,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function L(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...z(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Je(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ne(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ge(e,t,r,n,i,s){let a=[],o=i.keySet,l=i.catchall._zod,c=l.def.type,f=l.optout==="optional";for(let g in t){if(o.has(g))continue;if(c==="never"){a.push(g);continue}let $=l.run({value:t[g],issues:[]},n);$ instanceof Promise?e.push($.then(b=>L(b,r,g,t,f))):L($,r,g,t,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var $e=v("$ZodObject",(e,t)=>{if(h.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let o=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),l}})}let n=G(()=>Je(t));I(e._zod,"propValues",()=>{let o=t.shape,l={};for(let c in o){let f=o[c]._zod;if(f.values){l[c]??(l[c]=new Set);for(let g of f.values)l[c].add(g)}}return l});let i=T,s=t.catchall,a;e._zod.parse=(o,l)=>{a??(a=n.value);let c=o.value;if(!i(c))return o.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),o;o.value={};let f=[],g=a.shape;for(let $ of a.keys){let b=g[$],w=b._zod.optout==="optional",C=b._zod.run({value:c[$],issues:[]},l);C instanceof Promise?f.push(C.then(De=>L(De,o,$,c,w))):L(C,o,$,c,w)}return s?Ge(f,c,o,l,n.value,e):f.length?Promise.all(f).then(()=>o):o}});var he=v("$ZodRecord",(e,t)=>{h.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!te(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a){r.value={};let o=new Set;for(let c of a)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){o.add(typeof c=="number"?c.toString():c);let f=t.valueType._zod.run({value:i[c],issues:[]},n);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&r.issues.push(...z(c,g.issues)),r.value[c]=g.value})):(f.issues.length&&r.issues.push(...z(c,f.issues)),r.value[c]=f.value)}let l;for(let c in i)o.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{r.value={};for(let o of Reflect.ownKeys(i)){if(o==="__proto__")continue;let l=t.keyType._zod.run({value:o,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof o=="string"&&W.test(o)&&l.issues.length){let g=t.keyType._zod.run({value:Number(o),issues:[]},n);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>S(g,n,k())),input:o,path:[o],inst:e});continue}let f=t.valueType._zod.run({value:i[o],issues:[]},n);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&r.issues.push(...z(o,g.issues)),r.value[l.value]=g.value})):(f.issues.length&&r.issues.push(...z(o,f.issues)),r.value[l.value]=f.value)}}return s.length?Promise.all(s).then(()=>r):r}});var _e=v("$ZodEnum",(e,t)=>{h.init(e,t);let r=J(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>re.has(typeof i)).map(i=>typeof i=="string"?N(i):i.toString()).join("|")})$`),e._zod.parse=(i,s)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}});function me(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var xe=v("$ZodOptional",(e,t)=>{h.init(e,t),e._zod.optin="optional",e._zod.optout="optional",I(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),I(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ee(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>me(s,r.value)):me(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var be;var q=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function ke(){return new q}(be=globalThis).__zod_globalRegistry??(be.__zod_globalRegistry=ke());var Y=globalThis.__zod_globalRegistry;function ze(e,t){return new e({type:"string",..._(t)})}function Ie(e,t){return new e({type:"number",checks:[],..._(t)})}function Se(e,t){return new e({type:"boolean",..._(t)})}function we(e,t){return new e({type:"undefined",..._(t)})}var y=v("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");h.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>A(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>P(e,r,n),e.parseAsync=async(r,n)=>M(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Z(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>E(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),je=v("ZodMiniString",(e,t)=>{B.init(e,t),y.init(e,t)});function Bu(e){return ze(je,e)}var Ue=v("ZodMiniNumber",(e,t)=>{fe.init(e,t),y.init(e,t)});function Xu(e){return Ie(Ue,e)}var Pe=v("ZodMiniBoolean",(e,t)=>{X.init(e,t),y.init(e,t)});function qu(e){return Se(Pe,e)}var it=v("ZodMiniUndefined",(e,t)=>{ge.init(e,t),y.init(e,t)});function Yu(e){return we(it,e)}var ot=v("ZodMiniArray",(e,t)=>{ve.init(e,t),y.init(e,t)});function Hu(e,t){return new ot({type:"array",element:e,..._(t)})}var at=v("ZodMiniObject",(e,t)=>{$e.init(e,t),y.init(e,t),I(e,"shape",()=>t.shape)});function Qu(e,t){let r={type:"object",shape:e??{},..._(t)};return new at(r)}var ut=v("ZodMiniRecord",(e,t)=>{he.init(e,t),y.init(e,t)});function ec(e,t,r){return new ut({type:"record",keyType:e,valueType:t,..._(r)})}var ct=v("ZodMiniEnum",(e,t)=>{_e.init(e,t),y.init(e,t),e.options=Object.values(t.entries)});function tc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ct({type:"enum",entries:r,..._(t)})}var lt=v("ZodMiniOptional",(e,t)=>{xe.init(e,t),y.init(e,t)});function rc(e){return new lt({type:"optional",innerType:e})}export{Bu as a,Xu as b,qu as c,Yu as d,Hu as e,Qu as f,ec as g,tc as h,rc as i};
7
- //# sourceMappingURL=chunk-PA4Z7DNH.js.map