@azure/communication-common 2.4.2-alpha.20260210.1 → 2.4.2

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 (90) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  3. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  4. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  5. package/dist/browser/entraTokenCredential.d.ts.map +1 -1
  6. package/dist/browser/entraTokenCredential.js +12 -7
  7. package/dist/browser/entraTokenCredential.js.map +1 -1
  8. package/dist/browser/index.d.ts +3 -3
  9. package/dist/browser/index.d.ts.map +1 -1
  10. package/dist/browser/index.js.map +1 -1
  11. package/dist/commonjs/autoRefreshTokenCredential.js +110 -95
  12. package/dist/commonjs/autoRefreshTokenCredential.js.map +7 -1
  13. package/dist/commonjs/azureCommunicationTokenCredential.js +64 -47
  14. package/dist/commonjs/azureCommunicationTokenCredential.js.map +7 -1
  15. package/dist/commonjs/communicationTokenCredential.js +16 -5
  16. package/dist/commonjs/communicationTokenCredential.js.map +7 -1
  17. package/dist/commonjs/credential/clientArguments.js +46 -40
  18. package/dist/commonjs/credential/clientArguments.js.map +7 -1
  19. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  20. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js +53 -42
  21. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js.map +7 -1
  22. package/dist/commonjs/credential/communicationAuthPolicy.js +39 -26
  23. package/dist/commonjs/credential/communicationAuthPolicy.js.map +7 -1
  24. package/dist/commonjs/credential/connectionString.js +39 -28
  25. package/dist/commonjs/credential/connectionString.js.map +7 -1
  26. package/dist/commonjs/credential/index.js +28 -10
  27. package/dist/commonjs/credential/index.js.map +7 -1
  28. package/dist/commonjs/entraTokenCredential.d.ts.map +1 -1
  29. package/dist/commonjs/entraTokenCredential.js +137 -113
  30. package/dist/commonjs/entraTokenCredential.js.map +7 -1
  31. package/dist/commonjs/identifierModelSerializer.js +172 -159
  32. package/dist/commonjs/identifierModelSerializer.js.map +7 -1
  33. package/dist/commonjs/identifierModels.js +183 -205
  34. package/dist/commonjs/identifierModels.js.map +7 -1
  35. package/dist/commonjs/index.d.ts +3 -3
  36. package/dist/commonjs/index.d.ts.map +1 -1
  37. package/dist/commonjs/index.js +35 -12
  38. package/dist/commonjs/index.js.map +7 -1
  39. package/dist/commonjs/staticTokenCredential.js +36 -20
  40. package/dist/commonjs/staticTokenCredential.js.map +7 -1
  41. package/dist/commonjs/tokenParser.js +33 -13
  42. package/dist/commonjs/tokenParser.js.map +7 -1
  43. package/dist/commonjs/tsdoc-metadata.json +1 -1
  44. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  45. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  46. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  47. package/dist/esm/entraTokenCredential.d.ts.map +1 -1
  48. package/dist/esm/entraTokenCredential.js +12 -7
  49. package/dist/esm/entraTokenCredential.js.map +1 -1
  50. package/dist/esm/index.d.ts +3 -3
  51. package/dist/esm/index.d.ts.map +1 -1
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  54. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  55. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  56. package/dist/react-native/entraTokenCredential.d.ts.map +1 -1
  57. package/dist/react-native/entraTokenCredential.js +12 -7
  58. package/dist/react-native/entraTokenCredential.js.map +1 -1
  59. package/dist/react-native/index.d.ts +3 -3
  60. package/dist/react-native/index.d.ts.map +1 -1
  61. package/dist/react-native/index.js.map +1 -1
  62. package/package.json +30 -37
  63. package/dist/browser/credential/cryptoUtils-browser.d.mts.map +0 -1
  64. package/dist/browser/credential/cryptoUtils-browser.mjs.map +0 -1
  65. package/dist/browser/credential/cryptoUtils.d.ts +0 -3
  66. package/dist/browser/credential/cryptoUtils.js +0 -19
  67. package/dist/browser/credential/encodeUtils-browser.d.mts +0 -4
  68. package/dist/browser/credential/encodeUtils-browser.d.mts.map +0 -1
  69. package/dist/browser/credential/encodeUtils-browser.mjs +0 -19
  70. package/dist/browser/credential/encodeUtils-browser.mjs.map +0 -1
  71. package/dist/commonjs/credential/cryptoUtils.d.ts +0 -3
  72. package/dist/commonjs/credential/cryptoUtils.d.ts.map +0 -1
  73. package/dist/commonjs/credential/cryptoUtils.js +0 -14
  74. package/dist/commonjs/credential/cryptoUtils.js.map +0 -1
  75. package/dist/esm/credential/cryptoUtils.d.ts +0 -3
  76. package/dist/esm/credential/cryptoUtils.d.ts.map +0 -1
  77. package/dist/esm/credential/cryptoUtils.js +0 -9
  78. package/dist/esm/credential/cryptoUtils.js.map +0 -1
  79. package/dist/esm/credential/encodeUtils-browser.d.mts +0 -4
  80. package/dist/esm/credential/encodeUtils-browser.d.mts.map +0 -1
  81. package/dist/esm/credential/encodeUtils-browser.mjs +0 -19
  82. package/dist/esm/credential/encodeUtils-browser.mjs.map +0 -1
  83. package/dist/react-native/credential/cryptoUtils.d.ts +0 -3
  84. package/dist/react-native/credential/cryptoUtils.d.ts.map +0 -1
  85. package/dist/react-native/credential/cryptoUtils.js +0 -9
  86. package/dist/react-native/credential/cryptoUtils.js.map +0 -1
  87. package/dist/react-native/credential/encodeUtils-browser.d.mts +0 -4
  88. package/dist/react-native/credential/encodeUtils-browser.d.mts.map +0 -1
  89. package/dist/react-native/credential/encodeUtils-browser.mjs +0 -19
  90. package/dist/react-native/credential/encodeUtils-browser.mjs.map +0 -1
@@ -1,171 +1,184 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.deserializeCommunicationIdentifier = exports.serializeCommunicationIdentifier = void 0;
6
- const identifierModels_js_1 = require("./identifierModels.js");
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var identifierModelSerializer_exports = {};
19
+ __export(identifierModelSerializer_exports, {
20
+ deserializeCommunicationIdentifier: () => deserializeCommunicationIdentifier,
21
+ serializeCommunicationIdentifier: () => serializeCommunicationIdentifier
22
+ });
23
+ module.exports = __toCommonJS(identifierModelSerializer_exports);
24
+ var import_identifierModels = require("./identifierModels.js");
7
25
  const assertNotNullOrUndefined = (obj, prop) => {
8
- const subObjName = Object.keys(obj)[0];
9
- const subObj = obj[subObjName];
10
- if (prop in subObj) {
11
- return subObj[prop];
12
- }
13
- throw new Error(`Property ${prop} is required for identifier of type ${subObjName}.`);
26
+ const subObjName = Object.keys(obj)[0];
27
+ const subObj = obj[subObjName];
28
+ if (prop in subObj) {
29
+ return subObj[prop];
30
+ }
31
+ throw new Error(`Property ${prop} is required for identifier of type ${subObjName}.`);
14
32
  };
15
33
  const assertMaximumOneNestedModel = (identifier) => {
16
- const presentProperties = [];
17
- if (identifier.communicationUser !== undefined) {
18
- presentProperties.push("communicationUser");
19
- }
20
- if (identifier.microsoftTeamsUser !== undefined) {
21
- presentProperties.push("microsoftTeamsUser");
22
- }
23
- if (identifier.microsoftTeamsApp !== undefined) {
24
- presentProperties.push("microsoftTeamsApp");
25
- }
26
- if (identifier.phoneNumber !== undefined) {
27
- presentProperties.push("phoneNumber");
28
- }
29
- if (identifier.teamsExtensionUser !== undefined) {
30
- presentProperties.push("teamsExtensionUser");
31
- }
32
- if (presentProperties.length > 1) {
33
- throw new Error(`Only one of the properties in ${JSON.stringify(presentProperties)} should be present.`);
34
- }
34
+ const presentProperties = [];
35
+ if (identifier.communicationUser !== void 0) {
36
+ presentProperties.push("communicationUser");
37
+ }
38
+ if (identifier.microsoftTeamsUser !== void 0) {
39
+ presentProperties.push("microsoftTeamsUser");
40
+ }
41
+ if (identifier.microsoftTeamsApp !== void 0) {
42
+ presentProperties.push("microsoftTeamsApp");
43
+ }
44
+ if (identifier.phoneNumber !== void 0) {
45
+ presentProperties.push("phoneNumber");
46
+ }
47
+ if (identifier.teamsExtensionUser !== void 0) {
48
+ presentProperties.push("teamsExtensionUser");
49
+ }
50
+ if (presentProperties.length > 1) {
51
+ throw new Error(
52
+ `Only one of the properties in ${JSON.stringify(presentProperties)} should be present.`
53
+ );
54
+ }
35
55
  };
36
- /**
37
- * @hidden
38
- * Translates a CommunicationIdentifier to its serialized format for sending a request.
39
- * @param identifier - The CommunicationIdentifier to be serialized.
40
- */
41
56
  const serializeCommunicationIdentifier = (identifier) => {
42
- const identifierKind = (0, identifierModels_js_1.getIdentifierKind)(identifier);
43
- switch (identifierKind.kind) {
44
- case "communicationUser":
45
- return {
46
- rawId: (0, identifierModels_js_1.getIdentifierRawId)(identifierKind),
47
- communicationUser: { id: identifierKind.communicationUserId },
48
- };
49
- case "phoneNumber":
50
- return {
51
- rawId: identifierKind.rawId ?? (0, identifierModels_js_1.getIdentifierRawId)(identifierKind),
52
- phoneNumber: {
53
- value: identifierKind.phoneNumber,
54
- isAnonymous: identifierKind.isAnonymous ?? false,
55
- assertedId: identifierKind.assertedId,
56
- },
57
- };
58
- case "microsoftTeamsUser":
59
- return {
60
- rawId: identifierKind.rawId ?? (0, identifierModels_js_1.getIdentifierRawId)(identifierKind),
61
- microsoftTeamsUser: {
62
- userId: identifierKind.microsoftTeamsUserId,
63
- isAnonymous: identifierKind.isAnonymous ?? false,
64
- cloud: identifierKind.cloud ?? "public",
65
- },
66
- };
67
- case "microsoftTeamsApp":
68
- return {
69
- rawId: identifierKind.rawId ?? (0, identifierModels_js_1.getIdentifierRawId)(identifierKind),
70
- microsoftTeamsApp: {
71
- appId: identifierKind.teamsAppId,
72
- cloud: identifierKind.cloud ?? "public",
73
- },
74
- };
75
- case "teamsExtensionUser":
76
- return {
77
- rawId: identifierKind.rawId ?? (0, identifierModels_js_1.getIdentifierRawId)(identifierKind),
78
- teamsExtensionUser: {
79
- userId: identifierKind.userId,
80
- tenantId: identifierKind.tenantId,
81
- resourceId: identifierKind.resourceId,
82
- cloud: identifierKind.cloud ?? "public",
83
- },
84
- };
85
- case "unknown":
86
- return { rawId: identifierKind.id };
87
- default:
88
- throw new Error(`Can't serialize an identifier with kind ${identifierKind.kind}`);
89
- }
57
+ const identifierKind = (0, import_identifierModels.getIdentifierKind)(identifier);
58
+ switch (identifierKind.kind) {
59
+ case "communicationUser":
60
+ return {
61
+ rawId: (0, import_identifierModels.getIdentifierRawId)(identifierKind),
62
+ communicationUser: { id: identifierKind.communicationUserId }
63
+ };
64
+ case "phoneNumber":
65
+ return {
66
+ rawId: identifierKind.rawId ?? (0, import_identifierModels.getIdentifierRawId)(identifierKind),
67
+ phoneNumber: {
68
+ value: identifierKind.phoneNumber,
69
+ isAnonymous: identifierKind.isAnonymous ?? false,
70
+ assertedId: identifierKind.assertedId
71
+ }
72
+ };
73
+ case "microsoftTeamsUser":
74
+ return {
75
+ rawId: identifierKind.rawId ?? (0, import_identifierModels.getIdentifierRawId)(identifierKind),
76
+ microsoftTeamsUser: {
77
+ userId: identifierKind.microsoftTeamsUserId,
78
+ isAnonymous: identifierKind.isAnonymous ?? false,
79
+ cloud: identifierKind.cloud ?? "public"
80
+ }
81
+ };
82
+ case "microsoftTeamsApp":
83
+ return {
84
+ rawId: identifierKind.rawId ?? (0, import_identifierModels.getIdentifierRawId)(identifierKind),
85
+ microsoftTeamsApp: {
86
+ appId: identifierKind.teamsAppId,
87
+ cloud: identifierKind.cloud ?? "public"
88
+ }
89
+ };
90
+ case "teamsExtensionUser":
91
+ return {
92
+ rawId: identifierKind.rawId ?? (0, import_identifierModels.getIdentifierRawId)(identifierKind),
93
+ teamsExtensionUser: {
94
+ userId: identifierKind.userId,
95
+ tenantId: identifierKind.tenantId,
96
+ resourceId: identifierKind.resourceId,
97
+ cloud: identifierKind.cloud ?? "public"
98
+ }
99
+ };
100
+ case "unknown":
101
+ return { rawId: identifierKind.id };
102
+ default:
103
+ throw new Error(`Can't serialize an identifier with kind ${identifierKind.kind}`);
104
+ }
90
105
  };
91
- exports.serializeCommunicationIdentifier = serializeCommunicationIdentifier;
92
106
  const getKind = (serializedIdentifier) => {
93
- if (serializedIdentifier.communicationUser) {
94
- return "communicationUser";
95
- }
96
- if (serializedIdentifier.phoneNumber) {
97
- return "phoneNumber";
98
- }
99
- if (serializedIdentifier.microsoftTeamsUser) {
100
- return "microsoftTeamsUser";
101
- }
102
- if (serializedIdentifier.microsoftTeamsApp) {
103
- return "microsoftTeamsApp";
104
- }
105
- if (serializedIdentifier.teamsExtensionUser) {
106
- return "teamsExtensionUser";
107
- }
108
- return "unknown";
107
+ if (serializedIdentifier.communicationUser) {
108
+ return "communicationUser";
109
+ }
110
+ if (serializedIdentifier.phoneNumber) {
111
+ return "phoneNumber";
112
+ }
113
+ if (serializedIdentifier.microsoftTeamsUser) {
114
+ return "microsoftTeamsUser";
115
+ }
116
+ if (serializedIdentifier.microsoftTeamsApp) {
117
+ return "microsoftTeamsApp";
118
+ }
119
+ if (serializedIdentifier.teamsExtensionUser) {
120
+ return "teamsExtensionUser";
121
+ }
122
+ return "unknown";
109
123
  };
110
- /**
111
- * @hidden
112
- * Translates the serialized format of a communication identifier to CommunicationIdentifier.
113
- * @param serializedIdentifier - The SerializedCommunicationIdentifier to be deserialized.
114
- */
115
124
  const deserializeCommunicationIdentifier = (serializedIdentifier) => {
116
- assertMaximumOneNestedModel(serializedIdentifier);
117
- const communicationUser = serializedIdentifier.communicationUser;
118
- const microsoftTeamsUser = serializedIdentifier.microsoftTeamsUser;
119
- const microsoftTeamsApp = serializedIdentifier.microsoftTeamsApp;
120
- const phoneNumber = serializedIdentifier.phoneNumber;
121
- const teamsExtensionUser = serializedIdentifier.teamsExtensionUser;
122
- const kind = serializedIdentifier.kind ?? getKind(serializedIdentifier);
123
- if (kind === "communicationUser" && communicationUser) {
124
- return {
125
- kind: "communicationUser",
126
- communicationUserId: assertNotNullOrUndefined({ communicationUser }, "id"),
127
- };
128
- }
129
- if (kind === "phoneNumber" && phoneNumber) {
130
- return {
131
- kind: "phoneNumber",
132
- phoneNumber: assertNotNullOrUndefined({ phoneNumber }, "value"),
133
- rawId: assertNotNullOrUndefined({ phoneNumber: serializedIdentifier }, "rawId"),
134
- isAnonymous: phoneNumber.isAnonymous ?? false,
135
- assertedId: phoneNumber.assertedId,
136
- };
137
- }
138
- if (kind === "microsoftTeamsUser" && microsoftTeamsUser) {
139
- return {
140
- kind: "microsoftTeamsUser",
141
- microsoftTeamsUserId: assertNotNullOrUndefined({ microsoftTeamsUser }, "userId"),
142
- isAnonymous: assertNotNullOrUndefined({ microsoftTeamsUser }, "isAnonymous"),
143
- cloud: assertNotNullOrUndefined({ microsoftTeamsUser }, "cloud"),
144
- rawId: assertNotNullOrUndefined({ microsoftTeamsUser: serializedIdentifier }, "rawId"),
145
- };
146
- }
147
- if (kind === "microsoftTeamsApp" && microsoftTeamsApp) {
148
- return {
149
- kind: "microsoftTeamsApp",
150
- teamsAppId: assertNotNullOrUndefined({ microsoftTeamsApp }, "appId"),
151
- cloud: assertNotNullOrUndefined({ microsoftTeamsApp }, "cloud"),
152
- rawId: assertNotNullOrUndefined({ microsoftTeamsApp: serializedIdentifier }, "rawId"),
153
- };
154
- }
155
- if (kind === "teamsExtensionUser" && teamsExtensionUser) {
156
- return {
157
- kind: "teamsExtensionUser",
158
- userId: assertNotNullOrUndefined({ teamsExtensionUser }, "userId"),
159
- tenantId: assertNotNullOrUndefined({ teamsExtensionUser }, "tenantId"),
160
- resourceId: assertNotNullOrUndefined({ teamsExtensionUser }, "resourceId"),
161
- cloud: assertNotNullOrUndefined({ teamsExtensionUser }, "cloud"),
162
- rawId: assertNotNullOrUndefined({ teamsExtensionUser: serializedIdentifier }, "rawId"),
163
- };
164
- }
125
+ assertMaximumOneNestedModel(serializedIdentifier);
126
+ const communicationUser = serializedIdentifier.communicationUser;
127
+ const microsoftTeamsUser = serializedIdentifier.microsoftTeamsUser;
128
+ const microsoftTeamsApp = serializedIdentifier.microsoftTeamsApp;
129
+ const phoneNumber = serializedIdentifier.phoneNumber;
130
+ const teamsExtensionUser = serializedIdentifier.teamsExtensionUser;
131
+ const kind = serializedIdentifier.kind ?? getKind(serializedIdentifier);
132
+ if (kind === "communicationUser" && communicationUser) {
133
+ return {
134
+ kind: "communicationUser",
135
+ communicationUserId: assertNotNullOrUndefined({ communicationUser }, "id")
136
+ };
137
+ }
138
+ if (kind === "phoneNumber" && phoneNumber) {
139
+ return {
140
+ kind: "phoneNumber",
141
+ phoneNumber: assertNotNullOrUndefined({ phoneNumber }, "value"),
142
+ rawId: assertNotNullOrUndefined({ phoneNumber: serializedIdentifier }, "rawId"),
143
+ isAnonymous: phoneNumber.isAnonymous ?? false,
144
+ assertedId: phoneNumber.assertedId
145
+ };
146
+ }
147
+ if (kind === "microsoftTeamsUser" && microsoftTeamsUser) {
148
+ return {
149
+ kind: "microsoftTeamsUser",
150
+ microsoftTeamsUserId: assertNotNullOrUndefined({ microsoftTeamsUser }, "userId"),
151
+ isAnonymous: assertNotNullOrUndefined({ microsoftTeamsUser }, "isAnonymous"),
152
+ cloud: assertNotNullOrUndefined({ microsoftTeamsUser }, "cloud"),
153
+ rawId: assertNotNullOrUndefined({ microsoftTeamsUser: serializedIdentifier }, "rawId")
154
+ };
155
+ }
156
+ if (kind === "microsoftTeamsApp" && microsoftTeamsApp) {
157
+ return {
158
+ kind: "microsoftTeamsApp",
159
+ teamsAppId: assertNotNullOrUndefined({ microsoftTeamsApp }, "appId"),
160
+ cloud: assertNotNullOrUndefined({ microsoftTeamsApp }, "cloud"),
161
+ rawId: assertNotNullOrUndefined({ microsoftTeamsApp: serializedIdentifier }, "rawId")
162
+ };
163
+ }
164
+ if (kind === "teamsExtensionUser" && teamsExtensionUser) {
165
165
  return {
166
- kind: "unknown",
167
- id: assertNotNullOrUndefined({ unknown: serializedIdentifier }, "rawId"),
166
+ kind: "teamsExtensionUser",
167
+ userId: assertNotNullOrUndefined({ teamsExtensionUser }, "userId"),
168
+ tenantId: assertNotNullOrUndefined({ teamsExtensionUser }, "tenantId"),
169
+ resourceId: assertNotNullOrUndefined({ teamsExtensionUser }, "resourceId"),
170
+ cloud: assertNotNullOrUndefined({ teamsExtensionUser }, "cloud"),
171
+ rawId: assertNotNullOrUndefined({ teamsExtensionUser: serializedIdentifier }, "rawId")
168
172
  };
173
+ }
174
+ return {
175
+ kind: "unknown",
176
+ id: assertNotNullOrUndefined({ unknown: serializedIdentifier }, "rawId")
177
+ };
169
178
  };
170
- exports.deserializeCommunicationIdentifier = deserializeCommunicationIdentifier;
171
- //# sourceMappingURL=identifierModelSerializer.js.map
179
+ // Annotate the CommonJS export names for ESM import in node:
180
+ 0 && (module.exports = {
181
+ deserializeCommunicationIdentifier,
182
+ serializeCommunicationIdentifier
183
+ });
184
+ //# sourceMappingURL=identifierModelSerializer.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"identifierModelSerializer.js","sourceRoot":"","sources":["../../src/identifierModelSerializer.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+DAK+B;AAsI/B,MAAM,wBAAwB,GAAG,CAK/B,GAAM,EACN,IAAO,EACsB,EAAE;IAC/B,MAAM,UAAU,GAAG,M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iB,EAAE,EAAE,OAAO,CAAC;YACpE,KAAK,EAAE,wBAAwB,CAAC,EAAE,iBAAiB,EAAE,EAAE,OAAO,CAAC;YAC/D,KAAK,EAAE,wBAAwB,CAAC,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC;SACtF,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,KAAK,oBAAoB,IAAI,kBAAkB,EAAE,CAAC;QACxD,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,MAAM,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,EAAE,EAAE,QAAQ,CAAC;YAClE,QAAQ,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC;YACtE,UAAU,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,EAAE,EAAE,YAAY,CAAC;YAC1E,KAAK,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC;YAChE,KAAK,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC;SACvF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,wBAAwB,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,kCAAkC,sCA0D7C","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n type CommunicationIdentifier,\n type CommunicationIdentifierKind,\n getIdentifierKind,\n getIdentifierRawId,\n} from \"./identifierModels.js\";\n\n/**\n * @hidden\n * Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set.\n */\nexport interface SerializedCommunicationIdentifier {\n /**\n * Kind of the identifier, optional.\n */\n kind?: string;\n /**\n * Raw Id of the identifier. Optional in requests, required in responses.\n */\n rawId?: string;\n /**\n * The communication user.\n */\n communicationUser?: SerializedCommunicationUserIdentifier;\n /**\n * The phone number.\n */\n phoneNumber?: SerializedPhoneNumberIdentifier;\n /**\n * The Microsoft Teams user.\n */\n microsoftTeamsUser?: SerializedMicrosoftTeamsUserIdentifier;\n /**\n * The Microsoft Teams App.\n */\n microsoftTeamsApp?: SerializedMicrosoftTeamsAppIdentifier;\n /**\n * The Microsoft Teams Extension user.\n */\n teamsExtensionUser?: SerializedTeamsExtensionUserIdentifier;\n}\n\n/**\n * @hidden\n * A user that got created with an Azure Communication Services resource.\n */\nexport interface SerializedCommunicationUserIdentifier {\n /**\n * The Id of the communication user.\n */\n id: string;\n}\n\n/**\n * @hidden\n * A phone number.\n */\nexport interface SerializedPhoneNumberIdentifier {\n /**\n * The phone number in E.164 format.\n */\n value: string;\n /**\n * The asserted Id is set on a phone number that is already in the same call to distinguish from other connections made through the same number.\n */\n assertedId?: string;\n /**\n * True if the phone number is anonymous.\n */\n isAnonymous?: boolean;\n}\n\n/**\n * @hidden\n * A Microsoft Teams user.\n */\nexport interface SerializedMicrosoftTeamsUserIdentifier {\n /**\n * The Id of the Microsoft Teams user. If not anonymous, this is the Entra ID object Id of the user.\n */\n userId: string;\n /**\n * True if the Microsoft Teams user is anonymous. By default false if missing.\n */\n isAnonymous?: boolean;\n /**\n * The cloud that the Microsoft Teams user belongs to. By default 'public' if missing.\n */\n cloud?: SerializedCommunicationCloudEnvironment;\n}\n\n/**\n * @hidden\n * A Microsoft Teams App.\n */\nexport interface SerializedMicrosoftTeamsAppIdentifier {\n /**\n * Id of the Microsoft Teams App.\n */\n appId: string;\n\n /**\n * The cloud that the Microsoft Teams App belongs to. By default 'public' if missing.\n */\n cloud?: SerializedCommunicationCloudEnvironment;\n}\n\n/**\n * @hidden\n * A Microsoft Teams Phone user who is using the Azure Communication Services resource to extend their Teams Phone set up.\n */\nexport interface SerializedTeamsExtensionUserIdentifier {\n /**\n * The Id of the Microsoft Teams Extension user, i.e. the Entra ID object Id of the user.\n */\n userId: string;\n\n /**\n * The tenant Id of the Microsoft Teams Extension user.\n */\n tenantId: string;\n\n /**\n * The Azure Communication Services resource Id.\n */\n resourceId: string;\n\n /**\n * The cloud that the Microsoft Teams Extension user belongs to. If missing, the cloud is \"public\".\n */\n cloud?: SerializedCommunicationCloudEnvironment;\n}\n\n/**\n * @hidden\n * Defines values for CommunicationCloudEnvironmentModel.\n */\nexport type SerializedCommunicationCloudEnvironment = \"public\" | \"dod\" | \"gcch\";\n\nconst assertNotNullOrUndefined = <\n T extends Record<string, unknown>,\n P extends keyof T,\n Q extends string & keyof T[P],\n>(\n obj: T,\n prop: Q,\n): Required<Required<T>[P]>[Q] => {\n const subObjName = Object.keys(obj)[0];\n const subObj = (obj as any)[subObjName];\n if (prop in subObj) {\n return subObj[prop];\n }\n throw new Error(`Property ${prop} is required for identifier of type ${subObjName}.`);\n};\n\nconst assertMaximumOneNestedModel = (identifier: SerializedCommunicationIdentifier): void => {\n const presentProperties: string[] = [];\n if (identifier.communicationUser !== undefined) {\n presentProperties.push(\"communicationUser\");\n }\n if (identifier.microsoftTeamsUser !== undefined) {\n presentProperties.push(\"microsoftTeamsUser\");\n }\n if (identifier.microsoftTeamsApp !== undefined) {\n presentProperties.push(\"microsoftTeamsApp\");\n }\n if (identifier.phoneNumber !== undefined) {\n presentProperties.push(\"phoneNumber\");\n }\n if (identifier.teamsExtensionUser !== undefined) {\n presentProperties.push(\"teamsExtensionUser\");\n }\n if (presentProperties.length > 1) {\n throw new Error(\n `Only one of the properties in ${JSON.stringify(presentProperties)} should be present.`,\n );\n }\n};\n\n/**\n * @hidden\n * Translates a CommunicationIdentifier to its serialized format for sending a request.\n * @param identifier - The CommunicationIdentifier to be serialized.\n */\nexport const serializeCommunicationIdentifier = (\n identifier: CommunicationIdentifier,\n): SerializedCommunicationIdentifier => {\n const identifierKind = getIdentifierKind(identifier);\n switch (identifierKind.kind) {\n case \"communicationUser\":\n return {\n rawId: getIdentifierRawId(identifierKind),\n communicationUser: { id: identifierKind.communicationUserId },\n };\n case \"phoneNumber\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n phoneNumber: {\n value: identifierKind.phoneNumber,\n isAnonymous: identifierKind.isAnonymous ?? false,\n assertedId: identifierKind.assertedId,\n },\n };\n case \"microsoftTeamsUser\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n microsoftTeamsUser: {\n userId: identifierKind.microsoftTeamsUserId,\n isAnonymous: identifierKind.isAnonymous ?? false,\n cloud: identifierKind.cloud ?? \"public\",\n },\n };\n case \"microsoftTeamsApp\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n microsoftTeamsApp: {\n appId: identifierKind.teamsAppId,\n cloud: identifierKind.cloud ?? \"public\",\n },\n };\n case \"teamsExtensionUser\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n teamsExtensionUser: {\n userId: identifierKind.userId,\n tenantId: identifierKind.tenantId,\n resourceId: identifierKind.resourceId,\n cloud: identifierKind.cloud ?? \"public\",\n },\n };\n case \"unknown\":\n return { rawId: identifierKind.id };\n default:\n throw new Error(`Can't serialize an identifier with kind ${(identifierKind as any).kind}`);\n }\n};\n\nconst getKind = (serializedIdentifier: SerializedCommunicationIdentifier): string => {\n if (serializedIdentifier.communicationUser) {\n return \"communicationUser\";\n }\n\n if (serializedIdentifier.phoneNumber) {\n return \"phoneNumber\";\n }\n\n if (serializedIdentifier.microsoftTeamsUser) {\n return \"microsoftTeamsUser\";\n }\n\n if (serializedIdentifier.microsoftTeamsApp) {\n return \"microsoftTeamsApp\";\n }\n\n if (serializedIdentifier.teamsExtensionUser) {\n return \"teamsExtensionUser\";\n }\n\n return \"unknown\";\n};\n\n/**\n * @hidden\n * Translates the serialized format of a communication identifier to CommunicationIdentifier.\n * @param serializedIdentifier - The SerializedCommunicationIdentifier to be deserialized.\n */\nexport const deserializeCommunicationIdentifier = (\n serializedIdentifier: SerializedCommunicationIdentifier,\n): CommunicationIdentifierKind => {\n assertMaximumOneNestedModel(serializedIdentifier);\n\n const communicationUser = serializedIdentifier.communicationUser;\n const microsoftTeamsUser = serializedIdentifier.microsoftTeamsUser;\n const microsoftTeamsApp = serializedIdentifier.microsoftTeamsApp;\n const phoneNumber = serializedIdentifier.phoneNumber;\n const teamsExtensionUser = serializedIdentifier.teamsExtensionUser;\n const kind = serializedIdentifier.kind ?? getKind(serializedIdentifier);\n\n if (kind === \"communicationUser\" && communicationUser) {\n return {\n kind: \"communicationUser\",\n communicationUserId: assertNotNullOrUndefined({ communicationUser }, \"id\"),\n };\n }\n if (kind === \"phoneNumber\" && phoneNumber) {\n return {\n kind: \"phoneNumber\",\n phoneNumber: assertNotNullOrUndefined({ phoneNumber }, \"value\"),\n rawId: assertNotNullOrUndefined({ phoneNumber: serializedIdentifier }, \"rawId\"),\n isAnonymous: phoneNumber.isAnonymous ?? false,\n assertedId: phoneNumber.assertedId,\n };\n }\n if (kind === \"microsoftTeamsUser\" && microsoftTeamsUser) {\n return {\n kind: \"microsoftTeamsUser\",\n microsoftTeamsUserId: assertNotNullOrUndefined({ microsoftTeamsUser }, \"userId\"),\n isAnonymous: assertNotNullOrUndefined({ microsoftTeamsUser }, \"isAnonymous\"),\n cloud: assertNotNullOrUndefined({ microsoftTeamsUser }, \"cloud\"),\n rawId: assertNotNullOrUndefined({ microsoftTeamsUser: serializedIdentifier }, \"rawId\"),\n };\n }\n if (kind === \"microsoftTeamsApp\" && microsoftTeamsApp) {\n return {\n kind: \"microsoftTeamsApp\",\n teamsAppId: assertNotNullOrUndefined({ microsoftTeamsApp }, \"appId\"),\n cloud: assertNotNullOrUndefined({ microsoftTeamsApp }, \"cloud\"),\n rawId: assertNotNullOrUndefined({ microsoftTeamsApp: serializedIdentifier }, \"rawId\"),\n };\n }\n if (kind === \"teamsExtensionUser\" && teamsExtensionUser) {\n return {\n kind: \"teamsExtensionUser\",\n userId: assertNotNullOrUndefined({ teamsExtensionUser }, \"userId\"),\n tenantId: assertNotNullOrUndefined({ teamsExtensionUser }, \"tenantId\"),\n resourceId: assertNotNullOrUndefined({ teamsExtensionUser }, \"resourceId\"),\n cloud: assertNotNullOrUndefined({ teamsExtensionUser }, \"cloud\"),\n rawId: assertNotNullOrUndefined({ teamsExtensionUser: serializedIdentifier }, \"rawId\"),\n };\n }\n return {\n kind: \"unknown\",\n id: assertNotNullOrUndefined({ unknown: serializedIdentifier }, \"rawId\"),\n };\n};\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/identifierModelSerializer.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n type CommunicationIdentifier,\n type CommunicationIdentifierKind,\n getIdentifierKind,\n getIdentifierRawId,\n} from \"./identifierModels.js\";\n\n/**\n * @hidden\n * Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set.\n */\nexport interface SerializedCommunicationIdentifier {\n /**\n * Kind of the identifier, optional.\n */\n kind?: string;\n /**\n * Raw Id of the identifier. Optional in requests, required in responses.\n */\n rawId?: string;\n /**\n * The communication user.\n */\n communicationUser?: SerializedCommunicationUserIdentifier;\n /**\n * The phone number.\n */\n phoneNumber?: SerializedPhoneNumberIdentifier;\n /**\n * The Microsoft Teams user.\n */\n microsoftTeamsUser?: SerializedMicrosoftTeamsUserIdentifier;\n /**\n * The Microsoft Teams App.\n */\n microsoftTeamsApp?: SerializedMicrosoftTeamsAppIdentifier;\n /**\n * The Microsoft Teams Extension user.\n */\n teamsExtensionUser?: SerializedTeamsExtensionUserIdentifier;\n}\n\n/**\n * @hidden\n * A user that got created with an Azure Communication Services resource.\n */\nexport interface SerializedCommunicationUserIdentifier {\n /**\n * The Id of the communication user.\n */\n id: string;\n}\n\n/**\n * @hidden\n * A phone number.\n */\nexport interface SerializedPhoneNumberIdentifier {\n /**\n * The phone number in E.164 format.\n */\n value: string;\n /**\n * The asserted Id is set on a phone number that is already in the same call to distinguish from other connections made through the same number.\n */\n assertedId?: string;\n /**\n * True if the phone number is anonymous.\n */\n isAnonymous?: boolean;\n}\n\n/**\n * @hidden\n * A Microsoft Teams user.\n */\nexport interface SerializedMicrosoftTeamsUserIdentifier {\n /**\n * The Id of the Microsoft Teams user. If not anonymous, this is the Entra ID object Id of the user.\n */\n userId: string;\n /**\n * True if the Microsoft Teams user is anonymous. By default false if missing.\n */\n isAnonymous?: boolean;\n /**\n * The cloud that the Microsoft Teams user belongs to. By default 'public' if missing.\n */\n cloud?: SerializedCommunicationCloudEnvironment;\n}\n\n/**\n * @hidden\n * A Microsoft Teams App.\n */\nexport interface SerializedMicrosoftTeamsAppIdentifier {\n /**\n * Id of the Microsoft Teams App.\n */\n appId: string;\n\n /**\n * The cloud that the Microsoft Teams App belongs to. By default 'public' if missing.\n */\n cloud?: SerializedCommunicationCloudEnvironment;\n}\n\n/**\n * @hidden\n * A Microsoft Teams Phone user who is using the Azure Communication Services resource to extend their Teams Phone set up.\n */\nexport interface SerializedTeamsExtensionUserIdentifier {\n /**\n * The Id of the Microsoft Teams Extension user, i.e. the Entra ID object Id of the user.\n */\n userId: string;\n\n /**\n * The tenant Id of the Microsoft Teams Extension user.\n */\n tenantId: string;\n\n /**\n * The Azure Communication Services resource Id.\n */\n resourceId: string;\n\n /**\n * The cloud that the Microsoft Teams Extension user belongs to. If missing, the cloud is \"public\".\n */\n cloud?: SerializedCommunicationCloudEnvironment;\n}\n\n/**\n * @hidden\n * Defines values for CommunicationCloudEnvironmentModel.\n */\nexport type SerializedCommunicationCloudEnvironment = \"public\" | \"dod\" | \"gcch\";\n\nconst assertNotNullOrUndefined = <\n T extends Record<string, unknown>,\n P extends keyof T,\n Q extends string & keyof T[P],\n>(\n obj: T,\n prop: Q,\n): Required<Required<T>[P]>[Q] => {\n const subObjName = Object.keys(obj)[0];\n const subObj = (obj as any)[subObjName];\n if (prop in subObj) {\n return subObj[prop];\n }\n throw new Error(`Property ${prop} is required for identifier of type ${subObjName}.`);\n};\n\nconst assertMaximumOneNestedModel = (identifier: SerializedCommunicationIdentifier): void => {\n const presentProperties: string[] = [];\n if (identifier.communicationUser !== undefined) {\n presentProperties.push(\"communicationUser\");\n }\n if (identifier.microsoftTeamsUser !== undefined) {\n presentProperties.push(\"microsoftTeamsUser\");\n }\n if (identifier.microsoftTeamsApp !== undefined) {\n presentProperties.push(\"microsoftTeamsApp\");\n }\n if (identifier.phoneNumber !== undefined) {\n presentProperties.push(\"phoneNumber\");\n }\n if (identifier.teamsExtensionUser !== undefined) {\n presentProperties.push(\"teamsExtensionUser\");\n }\n if (presentProperties.length > 1) {\n throw new Error(\n `Only one of the properties in ${JSON.stringify(presentProperties)} should be present.`,\n );\n }\n};\n\n/**\n * @hidden\n * Translates a CommunicationIdentifier to its serialized format for sending a request.\n * @param identifier - The CommunicationIdentifier to be serialized.\n */\nexport const serializeCommunicationIdentifier = (\n identifier: CommunicationIdentifier,\n): SerializedCommunicationIdentifier => {\n const identifierKind = getIdentifierKind(identifier);\n switch (identifierKind.kind) {\n case \"communicationUser\":\n return {\n rawId: getIdentifierRawId(identifierKind),\n communicationUser: { id: identifierKind.communicationUserId },\n };\n case \"phoneNumber\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n phoneNumber: {\n value: identifierKind.phoneNumber,\n isAnonymous: identifierKind.isAnonymous ?? false,\n assertedId: identifierKind.assertedId,\n },\n };\n case \"microsoftTeamsUser\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n microsoftTeamsUser: {\n userId: identifierKind.microsoftTeamsUserId,\n isAnonymous: identifierKind.isAnonymous ?? false,\n cloud: identifierKind.cloud ?? \"public\",\n },\n };\n case \"microsoftTeamsApp\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n microsoftTeamsApp: {\n appId: identifierKind.teamsAppId,\n cloud: identifierKind.cloud ?? \"public\",\n },\n };\n case \"teamsExtensionUser\":\n return {\n rawId: identifierKind.rawId ?? getIdentifierRawId(identifierKind),\n teamsExtensionUser: {\n userId: identifierKind.userId,\n tenantId: identifierKind.tenantId,\n resourceId: identifierKind.resourceId,\n cloud: identifierKind.cloud ?? \"public\",\n },\n };\n case \"unknown\":\n return { rawId: identifierKind.id };\n default:\n throw new Error(`Can't serialize an identifier with kind ${(identifierKind as any).kind}`);\n }\n};\n\nconst getKind = (serializedIdentifier: SerializedCommunicationIdentifier): string => {\n if (serializedIdentifier.communicationUser) {\n return \"communicationUser\";\n }\n\n if (serializedIdentifier.phoneNumber) {\n return \"phoneNumber\";\n }\n\n if (serializedIdentifier.microsoftTeamsUser) {\n return \"microsoftTeamsUser\";\n }\n\n if (serializedIdentifier.microsoftTeamsApp) {\n return \"microsoftTeamsApp\";\n }\n\n if (serializedIdentifier.teamsExtensionUser) {\n return \"teamsExtensionUser\";\n }\n\n return \"unknown\";\n};\n\n/**\n * @hidden\n * Translates the serialized format of a communication identifier to CommunicationIdentifier.\n * @param serializedIdentifier - The SerializedCommunicationIdentifier to be deserialized.\n */\nexport const deserializeCommunicationIdentifier = (\n serializedIdentifier: SerializedCommunicationIdentifier,\n): CommunicationIdentifierKind => {\n assertMaximumOneNestedModel(serializedIdentifier);\n\n const communicationUser = serializedIdentifier.communicationUser;\n const microsoftTeamsUser = serializedIdentifier.microsoftTeamsUser;\n const microsoftTeamsApp = serializedIdentifier.microsoftTeamsApp;\n const phoneNumber = serializedIdentifier.phoneNumber;\n const teamsExtensionUser = serializedIdentifier.teamsExtensionUser;\n const kind = serializedIdentifier.kind ?? getKind(serializedIdentifier);\n\n if (kind === \"communicationUser\" && communicationUser) {\n return {\n kind: \"communicationUser\",\n communicationUserId: assertNotNullOrUndefined({ communicationUser }, \"id\"),\n };\n }\n if (kind === \"phoneNumber\" && phoneNumber) {\n return {\n kind: \"phoneNumber\",\n phoneNumber: assertNotNullOrUndefined({ phoneNumber }, \"value\"),\n rawId: assertNotNullOrUndefined({ phoneNumber: serializedIdentifier }, \"rawId\"),\n isAnonymous: phoneNumber.isAnonymous ?? false,\n assertedId: phoneNumber.assertedId,\n };\n }\n if (kind === \"microsoftTeamsUser\" && microsoftTeamsUser) {\n return {\n kind: \"microsoftTeamsUser\",\n microsoftTeamsUserId: assertNotNullOrUndefined({ microsoftTeamsUser }, \"userId\"),\n isAnonymous: assertNotNullOrUndefined({ microsoftTeamsUser }, \"isAnonymous\"),\n cloud: assertNotNullOrUndefined({ microsoftTeamsUser }, \"cloud\"),\n rawId: assertNotNullOrUndefined({ microsoftTeamsUser: serializedIdentifier }, \"rawId\"),\n };\n }\n if (kind === \"microsoftTeamsApp\" && microsoftTeamsApp) {\n return {\n kind: \"microsoftTeamsApp\",\n teamsAppId: assertNotNullOrUndefined({ microsoftTeamsApp }, \"appId\"),\n cloud: assertNotNullOrUndefined({ microsoftTeamsApp }, \"cloud\"),\n rawId: assertNotNullOrUndefined({ microsoftTeamsApp: serializedIdentifier }, \"rawId\"),\n };\n }\n if (kind === \"teamsExtensionUser\" && teamsExtensionUser) {\n return {\n kind: \"teamsExtensionUser\",\n userId: assertNotNullOrUndefined({ teamsExtensionUser }, \"userId\"),\n tenantId: assertNotNullOrUndefined({ teamsExtensionUser }, \"tenantId\"),\n resourceId: assertNotNullOrUndefined({ teamsExtensionUser }, \"resourceId\"),\n cloud: assertNotNullOrUndefined({ teamsExtensionUser }, \"cloud\"),\n rawId: assertNotNullOrUndefined({ teamsExtensionUser: serializedIdentifier }, \"rawId\"),\n };\n }\n return {\n kind: \"unknown\",\n id: assertNotNullOrUndefined({ unknown: serializedIdentifier }, \"rawId\"),\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,8BAKO;AAsIP,MAAM,2BAA2B,CAK/B,KACA,SACgC;AAChC,QAAM,aAAa,OAAO,KAAK,GAAG,EAAE,CAAC;AACrC,QAAM,SAAU,IAAY,UAAU;AACtC,MAAI,QAAQ,QAAQ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