@gravity-rail/cli 0.22.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -7
- package/dist/{account-verify-phone-QJDC57CB.js → account-verify-phone-5DY6ETMV.js} +3 -3
- package/dist/{chunk-IYCL6P6B.js → chunk-IGZVMTG5.js} +212 -39
- package/dist/chunk-IGZVMTG5.js.map +1 -0
- package/dist/{chunk-EGO3LMNZ.js → chunk-KHUZAYUS.js} +14 -10
- package/dist/chunk-KHUZAYUS.js.map +1 -0
- package/dist/{cli-client-context-dl4gw0Fb.d.ts → cli-client-context-cd5f2JKX.d.ts} +46 -2
- package/dist/cli-utils.d.ts +13 -2
- package/dist/cli-utils.js +7 -1
- package/dist/gr.js +6098 -515
- package/dist/gr.js.map +1 -1
- package/dist/lib.d.ts +15 -3
- package/dist/lib.js +2586 -427
- package/dist/lib.js.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-EGO3LMNZ.js.map +0 -1
- package/dist/chunk-IYCL6P6B.js.map +0 -1
- /package/dist/{account-verify-phone-QJDC57CB.js.map → account-verify-phone-5DY6ETMV.js.map} +0 -0
package/dist/lib.js
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
startAccountPhoneVerify,
|
|
34
34
|
stderr,
|
|
35
35
|
unwrapItems
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-KHUZAYUS.js";
|
|
37
37
|
import {
|
|
38
38
|
AGUIClient,
|
|
39
39
|
formatTimestamp,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
getTextDelta,
|
|
42
42
|
performOAuthFlow,
|
|
43
43
|
selectFromList
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-IGZVMTG5.js";
|
|
45
45
|
import {
|
|
46
46
|
AuthRequiredError,
|
|
47
47
|
CLIError,
|
|
@@ -122,7 +122,12 @@ function parseArgs(defs, argv) {
|
|
|
122
122
|
if (value === void 0) {
|
|
123
123
|
throw new CLIError(`Missing value for --${def.name}`);
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
if (def.repeatable) {
|
|
126
|
+
const existing = result2[def.name];
|
|
127
|
+
result2[def.name] = Array.isArray(existing) ? [...existing, value] : [value];
|
|
128
|
+
} else {
|
|
129
|
+
result2[def.name] = value;
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
133
|
for (const def of allDefs) {
|
|
@@ -1130,6 +1135,12 @@ function sandboxExample(example) {
|
|
|
1130
1135
|
}
|
|
1131
1136
|
|
|
1132
1137
|
// src/lib/types.ts
|
|
1138
|
+
function repeatedValues(args, name) {
|
|
1139
|
+
const value = args[name];
|
|
1140
|
+
if (Array.isArray(value)) return value;
|
|
1141
|
+
if (typeof value === "string" && value.length > 0) return [value];
|
|
1142
|
+
return [];
|
|
1143
|
+
}
|
|
1133
1144
|
function requireString(args, key) {
|
|
1134
1145
|
const val = args[key];
|
|
1135
1146
|
if (typeof val !== "string") throw new Error(`Missing required argument: --${key}`);
|
|
@@ -1350,6 +1361,7 @@ Optional
|
|
|
1350
1361
|
email / phone / externalId Optional contact fields
|
|
1351
1362
|
labelIds (number[]) Member label ids
|
|
1352
1363
|
codeInterpreterEnabled (bool)
|
|
1364
|
+
webBrowserEnabled (bool)
|
|
1353
1365
|
maxDailyActions (number|null)
|
|
1354
1366
|
|
|
1355
1367
|
Attach an agent\u2019s models/identity to a workflow (draft), then publish:
|
|
@@ -2104,6 +2116,198 @@ var chatsDomain = {
|
|
|
2104
2116
|
]
|
|
2105
2117
|
};
|
|
2106
2118
|
|
|
2119
|
+
// ../sdk/src/types/generated/member_relationship_catalog.ts
|
|
2120
|
+
var MEMBER_RELATIONSHIP_KINDS = [
|
|
2121
|
+
{
|
|
2122
|
+
"kind": "parent_of",
|
|
2123
|
+
"cardinality": "many_to_many",
|
|
2124
|
+
"symmetric": false,
|
|
2125
|
+
"grantsChartAccess": false,
|
|
2126
|
+
"roles": [
|
|
2127
|
+
{
|
|
2128
|
+
"role": "parent",
|
|
2129
|
+
"label": "Parent",
|
|
2130
|
+
"inverseLabel": "Child",
|
|
2131
|
+
"description": "This person is a parent of the member. For a minor, also add Legal guardian if they should read the chart."
|
|
2132
|
+
},
|
|
2133
|
+
{
|
|
2134
|
+
"role": "child",
|
|
2135
|
+
"label": "Child",
|
|
2136
|
+
"inverseLabel": "Parent",
|
|
2137
|
+
"description": "This person is a child of the member."
|
|
2138
|
+
}
|
|
2139
|
+
]
|
|
2140
|
+
},
|
|
2141
|
+
{
|
|
2142
|
+
"kind": "sibling_of",
|
|
2143
|
+
"cardinality": "many_to_many",
|
|
2144
|
+
"symmetric": true,
|
|
2145
|
+
"grantsChartAccess": false,
|
|
2146
|
+
"roles": [
|
|
2147
|
+
{
|
|
2148
|
+
"role": "sibling",
|
|
2149
|
+
"label": "Sibling",
|
|
2150
|
+
"inverseLabel": "Sibling",
|
|
2151
|
+
"description": "These members are siblings."
|
|
2152
|
+
}
|
|
2153
|
+
]
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
"kind": "spouse_of",
|
|
2157
|
+
"cardinality": "one_to_one",
|
|
2158
|
+
"symmetric": true,
|
|
2159
|
+
"grantsChartAccess": false,
|
|
2160
|
+
"roles": [
|
|
2161
|
+
{
|
|
2162
|
+
"role": "spouse",
|
|
2163
|
+
"label": "Spouse",
|
|
2164
|
+
"inverseLabel": "Spouse",
|
|
2165
|
+
"description": "These members are spouses or partners."
|
|
2166
|
+
}
|
|
2167
|
+
]
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
"kind": "caregiver_of",
|
|
2171
|
+
"cardinality": "many_to_many",
|
|
2172
|
+
"symmetric": false,
|
|
2173
|
+
"grantsChartAccess": false,
|
|
2174
|
+
"roles": [
|
|
2175
|
+
{
|
|
2176
|
+
"role": "caregiver",
|
|
2177
|
+
"label": "Caregiver",
|
|
2178
|
+
"inverseLabel": "Care recipient",
|
|
2179
|
+
"description": "This person provides care for the member at home."
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
"role": "care_recipient",
|
|
2183
|
+
"label": "Care recipient",
|
|
2184
|
+
"inverseLabel": "Caregiver",
|
|
2185
|
+
"description": "This person receives care from the member."
|
|
2186
|
+
}
|
|
2187
|
+
]
|
|
2188
|
+
},
|
|
2189
|
+
{
|
|
2190
|
+
"kind": "emergency_contact_of",
|
|
2191
|
+
"cardinality": "many_to_many",
|
|
2192
|
+
"symmetric": false,
|
|
2193
|
+
"grantsChartAccess": false,
|
|
2194
|
+
"roles": [
|
|
2195
|
+
{
|
|
2196
|
+
"role": "emergency_contact",
|
|
2197
|
+
"label": "Emergency contact",
|
|
2198
|
+
"inverseLabel": "Emergency contact for",
|
|
2199
|
+
"description": "This person is the member's emergency contact."
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
"role": "emergency_contact_for",
|
|
2203
|
+
"label": "Emergency contact for",
|
|
2204
|
+
"inverseLabel": "Emergency contact",
|
|
2205
|
+
"description": "The member is listed as this person's emergency contact."
|
|
2206
|
+
}
|
|
2207
|
+
]
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
"kind": "next_of_kin_of",
|
|
2211
|
+
"cardinality": "one_per_target",
|
|
2212
|
+
"symmetric": false,
|
|
2213
|
+
"grantsChartAccess": false,
|
|
2214
|
+
"roles": [
|
|
2215
|
+
{
|
|
2216
|
+
"role": "next_of_kin",
|
|
2217
|
+
"label": "Next of kin",
|
|
2218
|
+
"inverseLabel": "Next of kin for",
|
|
2219
|
+
"description": "This person is the member's designated next of kin. A member has at most one."
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
"role": "next_of_kin_for",
|
|
2223
|
+
"label": "Next of kin for",
|
|
2224
|
+
"inverseLabel": "Next of kin",
|
|
2225
|
+
"description": "The member is this person's designated next of kin."
|
|
2226
|
+
}
|
|
2227
|
+
]
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
"kind": "legal_guardian_of",
|
|
2231
|
+
"cardinality": "many_to_many",
|
|
2232
|
+
"symmetric": false,
|
|
2233
|
+
"grantsChartAccess": true,
|
|
2234
|
+
"roles": [
|
|
2235
|
+
{
|
|
2236
|
+
"role": "legal_guardian",
|
|
2237
|
+
"label": "Legal guardian",
|
|
2238
|
+
"inverseLabel": "Legal guardian for",
|
|
2239
|
+
"description": "Court-appointed guardian, or parent/person with parental responsibility for a minor."
|
|
2240
|
+
},
|
|
2241
|
+
{
|
|
2242
|
+
"role": "legal_guardian_for",
|
|
2243
|
+
"label": "Legal guardian for",
|
|
2244
|
+
"inverseLabel": "Legal guardian",
|
|
2245
|
+
"description": "The member is this person's legal guardian."
|
|
2246
|
+
}
|
|
2247
|
+
]
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
"kind": "healthcare_agent_of",
|
|
2251
|
+
"cardinality": "many_to_many",
|
|
2252
|
+
"symmetric": false,
|
|
2253
|
+
"grantsChartAccess": true,
|
|
2254
|
+
"roles": [
|
|
2255
|
+
{
|
|
2256
|
+
"role": "healthcare_agent",
|
|
2257
|
+
"label": "Healthcare agent",
|
|
2258
|
+
"inverseLabel": "Healthcare agent for",
|
|
2259
|
+
"description": "Healthcare power of attorney or health proxy."
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
"role": "healthcare_agent_for",
|
|
2263
|
+
"label": "Healthcare agent for",
|
|
2264
|
+
"inverseLabel": "Healthcare agent",
|
|
2265
|
+
"description": "The member is this person's healthcare agent (healthcare power of attorney or health proxy)."
|
|
2266
|
+
}
|
|
2267
|
+
]
|
|
2268
|
+
},
|
|
2269
|
+
{
|
|
2270
|
+
"kind": "doctor_of",
|
|
2271
|
+
"cardinality": "many_to_many",
|
|
2272
|
+
"symmetric": false,
|
|
2273
|
+
"grantsChartAccess": true,
|
|
2274
|
+
"roles": [
|
|
2275
|
+
{
|
|
2276
|
+
"role": "doctor",
|
|
2277
|
+
"label": "Doctor",
|
|
2278
|
+
"inverseLabel": "Patient",
|
|
2279
|
+
"description": "This person is a treating clinician for the member."
|
|
2280
|
+
},
|
|
2281
|
+
{
|
|
2282
|
+
"role": "patient",
|
|
2283
|
+
"label": "Patient",
|
|
2284
|
+
"inverseLabel": "Doctor",
|
|
2285
|
+
"description": "This person is a patient of the member."
|
|
2286
|
+
}
|
|
2287
|
+
]
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
"kind": "primary_contact_of",
|
|
2291
|
+
"cardinality": "one_per_target",
|
|
2292
|
+
"symmetric": false,
|
|
2293
|
+
"grantsChartAccess": true,
|
|
2294
|
+
"roles": [
|
|
2295
|
+
{
|
|
2296
|
+
"role": "primary_contact",
|
|
2297
|
+
"label": "Primary contact",
|
|
2298
|
+
"inverseLabel": "Primary contact for",
|
|
2299
|
+
"description": "This person is the organization's primary contact for the member. A member has at most one."
|
|
2300
|
+
},
|
|
2301
|
+
{
|
|
2302
|
+
"role": "primary_contact_for",
|
|
2303
|
+
"label": "Primary contact for",
|
|
2304
|
+
"inverseLabel": "Primary contact",
|
|
2305
|
+
"description": "The member is this person's assigned primary contact inside the organization."
|
|
2306
|
+
}
|
|
2307
|
+
]
|
|
2308
|
+
}
|
|
2309
|
+
];
|
|
2310
|
+
|
|
2107
2311
|
// src/domains/members.ts
|
|
2108
2312
|
var COLUMNS3 = [
|
|
2109
2313
|
COL.id(),
|
|
@@ -2144,9 +2348,7 @@ var membersDomain = {
|
|
|
2144
2348
|
columns: COLUMNS3,
|
|
2145
2349
|
updateExamples: [
|
|
2146
2350
|
`yarn gr members update -w $UUID --id 2 --data '{"phone":"+15551234567"}' --allow-write`,
|
|
2147
|
-
"yarn gr members update --profile acme-demo/acme-admin --id 2 --file /tmp/member.json --allow-write"
|
|
2148
|
-
"# Trust a member's phone so they can use SMS as themselves (no account):",
|
|
2149
|
-
`yarn gr members update -w $UUID --id 2 --data '{"phoneTrusted":true}' --allow-write`
|
|
2351
|
+
"yarn gr members update --profile acme-demo/acme-admin --id 2 --file /tmp/member.json --allow-write"
|
|
2150
2352
|
]
|
|
2151
2353
|
}),
|
|
2152
2354
|
// Current member
|
|
@@ -2159,13 +2361,12 @@ var membersDomain = {
|
|
|
2159
2361
|
outputSingle(result2, ctx, COLUMNS3);
|
|
2160
2362
|
}
|
|
2161
2363
|
},
|
|
2162
|
-
// Send a member an SMS to confirm their phone
|
|
2163
|
-
//
|
|
2164
|
-
//
|
|
2165
|
-
// setting phoneTrusted directly via `members update`.
|
|
2364
|
+
// Send a member an SMS to confirm their phone. On reply, a verified
|
|
2365
|
+
// phone auth binding is created so they can use SMS as themselves
|
|
2366
|
+
// without an account. This is the only way to earn the Verified badge.
|
|
2166
2367
|
{
|
|
2167
2368
|
path: ["members", "confirm-phone"],
|
|
2168
|
-
description: "Text a member to confirm their phone (
|
|
2369
|
+
description: "Text a member to confirm their phone (verifies it on reply)",
|
|
2169
2370
|
mutates: true,
|
|
2170
2371
|
requiresWorkspace: true,
|
|
2171
2372
|
args: [{ name: "id", description: "Member ID", required: true }],
|
|
@@ -2322,6 +2523,90 @@ var membersDomain = {
|
|
|
2322
2523
|
}
|
|
2323
2524
|
},
|
|
2324
2525
|
// Member Roles CRUD
|
|
2526
|
+
{
|
|
2527
|
+
path: ["members", "relationships", "kinds"],
|
|
2528
|
+
description: "List the hardcoded member relationship kinds",
|
|
2529
|
+
requiresWorkspace: false,
|
|
2530
|
+
requiresAuth: false,
|
|
2531
|
+
handler: async ({ ctx }) => {
|
|
2532
|
+
outputData([...MEMBER_RELATIONSHIP_KINDS], ctx, [
|
|
2533
|
+
{ header: "KIND", getValue: (item) => item.kind },
|
|
2534
|
+
{ header: "CARDINALITY", getValue: (item) => item.cardinality },
|
|
2535
|
+
{
|
|
2536
|
+
header: "CHART",
|
|
2537
|
+
getValue: (item) => item.grantsChartAccess ? "read" : ""
|
|
2538
|
+
}
|
|
2539
|
+
]);
|
|
2540
|
+
}
|
|
2541
|
+
},
|
|
2542
|
+
{
|
|
2543
|
+
path: ["members", "relationships", "list"],
|
|
2544
|
+
description: "List relationships for a member",
|
|
2545
|
+
requiresWorkspace: true,
|
|
2546
|
+
args: [{ name: "member-id", description: "Member ID", required: true }],
|
|
2547
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
2548
|
+
const memberId = requireNumber(args, "member-id");
|
|
2549
|
+
const result2 = await requireAuth(ctx).apiClient.getMemberRelationships(
|
|
2550
|
+
workspace,
|
|
2551
|
+
memberId
|
|
2552
|
+
);
|
|
2553
|
+
outputData(result2.items, ctx, [
|
|
2554
|
+
COL.id(),
|
|
2555
|
+
{ header: "ROLE", getValue: (item) => item.relatedRole ?? "" },
|
|
2556
|
+
{ header: "RELATED", getValue: (item) => String(item.relatedMemberId ?? "") },
|
|
2557
|
+
{
|
|
2558
|
+
header: "CHART",
|
|
2559
|
+
getValue: (item) => item.grantsChartAccess ? "read" : ""
|
|
2560
|
+
}
|
|
2561
|
+
]);
|
|
2562
|
+
}
|
|
2563
|
+
},
|
|
2564
|
+
{
|
|
2565
|
+
path: ["members", "relationships", "create"],
|
|
2566
|
+
description: "Create a relationship from a related-member role",
|
|
2567
|
+
mutates: true,
|
|
2568
|
+
requiresWorkspace: true,
|
|
2569
|
+
args: [
|
|
2570
|
+
{ name: "member-id", description: "Member ID", required: true },
|
|
2571
|
+
{ name: "related-member-id", description: "Related member ID", required: true },
|
|
2572
|
+
{
|
|
2573
|
+
name: "related-role",
|
|
2574
|
+
description: "Related role (legal_guardian, doctor, parent, ...)",
|
|
2575
|
+
required: true
|
|
2576
|
+
}
|
|
2577
|
+
],
|
|
2578
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
2579
|
+
const memberId = requireNumber(args, "member-id");
|
|
2580
|
+
const relatedMemberId = requireNumber(args, "related-member-id");
|
|
2581
|
+
const relatedRole = String(args["related-role"]);
|
|
2582
|
+
const result2 = await requireAuth(ctx).apiClient.createMemberRelationship(
|
|
2583
|
+
workspace,
|
|
2584
|
+
memberId,
|
|
2585
|
+
{ relatedMemberId, relatedRole }
|
|
2586
|
+
);
|
|
2587
|
+
outputSingle(result2, ctx);
|
|
2588
|
+
}
|
|
2589
|
+
},
|
|
2590
|
+
{
|
|
2591
|
+
path: ["members", "relationships", "archive"],
|
|
2592
|
+
description: "Archive a member relationship",
|
|
2593
|
+
mutates: true,
|
|
2594
|
+
requiresWorkspace: true,
|
|
2595
|
+
args: [
|
|
2596
|
+
{ name: "member-id", description: "Member ID", required: true },
|
|
2597
|
+
{ name: "id", description: "Relationship ID", required: true }
|
|
2598
|
+
],
|
|
2599
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
2600
|
+
const memberId = requireNumber(args, "member-id");
|
|
2601
|
+
const relationshipId = requireNumber(args, "id");
|
|
2602
|
+
const result2 = await requireAuth(ctx).apiClient.archiveMemberRelationship(
|
|
2603
|
+
workspace,
|
|
2604
|
+
memberId,
|
|
2605
|
+
relationshipId
|
|
2606
|
+
);
|
|
2607
|
+
outputSingle(result2, ctx);
|
|
2608
|
+
}
|
|
2609
|
+
},
|
|
2325
2610
|
...crudCommands({
|
|
2326
2611
|
prefix: ["members", "roles"],
|
|
2327
2612
|
entityName: "member role",
|
|
@@ -3471,6 +3756,470 @@ ${WORKFLOW_FIELD_REFERENCE}`,
|
|
|
3471
3756
|
// src/domains/workspaces.ts
|
|
3472
3757
|
import { writeFile } from "fs/promises";
|
|
3473
3758
|
import { extractWorkspaceExportJson } from "@gravity-rail/sdk/helpers";
|
|
3759
|
+
|
|
3760
|
+
// src/lib/workspace-sync/import-payload.ts
|
|
3761
|
+
var UNRECOGNIZED_PAYLOAD = 'Unrecognized data format. Provide either raw export data (from "workspaces export") or a full import payload with {exportData, importMappings, createNew, autoMap?}.';
|
|
3762
|
+
var MALFORMED_AUTO_MAP = 'autoMap must be an object mapping each entity type to a list of UUIDs (an empty object means "match nothing by name").';
|
|
3763
|
+
function isPlainObject(value) {
|
|
3764
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3765
|
+
}
|
|
3766
|
+
function parseImportPayload(payload) {
|
|
3767
|
+
if (isPlainObject(payload.exportData)) {
|
|
3768
|
+
const importMappings = isPlainObject(payload.importMappings) ? payload.importMappings : {};
|
|
3769
|
+
const createNew = isPlainObject(payload.createNew) ? payload.createNew : {};
|
|
3770
|
+
const parsed = {
|
|
3771
|
+
exportData: payload.exportData,
|
|
3772
|
+
importMappings,
|
|
3773
|
+
createNew
|
|
3774
|
+
};
|
|
3775
|
+
if (payload.autoMap !== void 0) {
|
|
3776
|
+
if (!isPlainObject(payload.autoMap)) {
|
|
3777
|
+
throw new CLIError(MALFORMED_AUTO_MAP);
|
|
3778
|
+
}
|
|
3779
|
+
parsed.autoMap = payload.autoMap;
|
|
3780
|
+
}
|
|
3781
|
+
return parsed;
|
|
3782
|
+
}
|
|
3783
|
+
if (payload.version && payload.workflows) {
|
|
3784
|
+
return { exportData: payload, importMappings: {}, createNew: {} };
|
|
3785
|
+
}
|
|
3786
|
+
throw new CLIError(UNRECOGNIZED_PAYLOAD);
|
|
3787
|
+
}
|
|
3788
|
+
function deriveCreateNew(exportData, existing) {
|
|
3789
|
+
const merged = {};
|
|
3790
|
+
for (const [key, uuids] of Object.entries(existing ?? {})) {
|
|
3791
|
+
if (Array.isArray(uuids)) {
|
|
3792
|
+
merged[key] = [...uuids];
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
for (const [key, value] of Object.entries(exportData)) {
|
|
3796
|
+
if (!Array.isArray(value)) continue;
|
|
3797
|
+
const seen = new Set(merged[key] ?? []);
|
|
3798
|
+
const discovered = [];
|
|
3799
|
+
for (const element of value) {
|
|
3800
|
+
if (!isPlainObject(element)) continue;
|
|
3801
|
+
const uuid = element.uuid;
|
|
3802
|
+
if (typeof uuid !== "string" || uuid.length === 0) continue;
|
|
3803
|
+
if (seen.has(uuid)) continue;
|
|
3804
|
+
seen.add(uuid);
|
|
3805
|
+
discovered.push(uuid);
|
|
3806
|
+
}
|
|
3807
|
+
if (discovered.length === 0) continue;
|
|
3808
|
+
merged[key] = [...merged[key] ?? [], ...discovered];
|
|
3809
|
+
}
|
|
3810
|
+
return merged;
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
// src/lib/workspace-sync/bindings-file.ts
|
|
3814
|
+
function requireString2(value, field, where) {
|
|
3815
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
3816
|
+
throw new CLIError(`${where}: "${field}" must be a non-empty string.`);
|
|
3817
|
+
}
|
|
3818
|
+
return value;
|
|
3819
|
+
}
|
|
3820
|
+
function optionalString2(value, field, where) {
|
|
3821
|
+
if (value === void 0 || value === null) return void 0;
|
|
3822
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
3823
|
+
throw new CLIError(`${where}: "${field}" must be a non-empty string when present.`);
|
|
3824
|
+
}
|
|
3825
|
+
return value;
|
|
3826
|
+
}
|
|
3827
|
+
function parseBindingsFile(payload) {
|
|
3828
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
3829
|
+
throw new CLIError("The bindings file must be a JSON object keyed by target workspace UUID.");
|
|
3830
|
+
}
|
|
3831
|
+
const parsed = {};
|
|
3832
|
+
for (const [targetUuid, entries] of Object.entries(payload)) {
|
|
3833
|
+
if (!Array.isArray(entries)) {
|
|
3834
|
+
throw new CLIError(
|
|
3835
|
+
`Bindings for target ${targetUuid} must be a JSON array of binding objects.`
|
|
3836
|
+
);
|
|
3837
|
+
}
|
|
3838
|
+
parsed[targetUuid] = entries.map((entry, index) => {
|
|
3839
|
+
const where = `Bindings for target ${targetUuid}, entry ${index}`;
|
|
3840
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
3841
|
+
throw new CLIError(`${where}: each binding must be a JSON object.`);
|
|
3842
|
+
}
|
|
3843
|
+
const record = entry;
|
|
3844
|
+
const value = record.value;
|
|
3845
|
+
if (typeof value !== "string" && typeof value !== "boolean") {
|
|
3846
|
+
throw new CLIError(`${where}: "value" must be a string or a boolean.`);
|
|
3847
|
+
}
|
|
3848
|
+
if (typeof value === "string" && value.length === 0) {
|
|
3849
|
+
throw new CLIError(`${where}: "value" must not be empty.`);
|
|
3850
|
+
}
|
|
3851
|
+
const binding = {
|
|
3852
|
+
entityType: requireString2(record.entityType, "entityType", where),
|
|
3853
|
+
sourceUuid: requireString2(record.sourceUuid, "sourceUuid", where),
|
|
3854
|
+
fieldPath: requireString2(record.fieldPath, "fieldPath", where),
|
|
3855
|
+
value
|
|
3856
|
+
};
|
|
3857
|
+
const parentKind = optionalString2(record.parentKind, "parentKind", where);
|
|
3858
|
+
if (parentKind !== void 0) binding.parentKind = parentKind;
|
|
3859
|
+
const parentUuid = optionalString2(record.parentUuid, "parentUuid", where);
|
|
3860
|
+
if (parentUuid !== void 0) binding.parentUuid = parentUuid;
|
|
3861
|
+
return binding;
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
return parsed;
|
|
3865
|
+
}
|
|
3866
|
+
function bindingsForTarget(parsed, targetUuid) {
|
|
3867
|
+
return parsed[targetUuid] ?? [];
|
|
3868
|
+
}
|
|
3869
|
+
function unusedBindingTargets(parsed, selected) {
|
|
3870
|
+
const chosen = new Set(selected);
|
|
3871
|
+
return Object.keys(parsed).filter((uuid) => !chosen.has(uuid));
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
// src/lib/workspace-sync/output.ts
|
|
3875
|
+
function projectReadiness(readiness, skipped) {
|
|
3876
|
+
return {
|
|
3877
|
+
issues: (readiness.issues ?? []).map((issue) => {
|
|
3878
|
+
const projected = {
|
|
3879
|
+
code: issue.code,
|
|
3880
|
+
resourceType: issue.resourceType,
|
|
3881
|
+
resourceId: issue.resourceId,
|
|
3882
|
+
resourceUuid: issue.resourceUuid
|
|
3883
|
+
};
|
|
3884
|
+
if (issue.resourceName) projected.resourceName = issue.resourceName;
|
|
3885
|
+
return projected;
|
|
3886
|
+
}),
|
|
3887
|
+
truncated: readiness.truncated === true,
|
|
3888
|
+
outstandingGroups: (skipped.groups ?? []).map((group) => ({
|
|
3889
|
+
resourceType: group.resourceType,
|
|
3890
|
+
outstandingCount: group.outstandingCount,
|
|
3891
|
+
activeCount: group.activeCount,
|
|
3892
|
+
ruleCount: (group.rules ?? []).length
|
|
3893
|
+
})),
|
|
3894
|
+
skippedTruncated: skipped.truncated === true
|
|
3895
|
+
};
|
|
3896
|
+
}
|
|
3897
|
+
function readinessIsIncomplete(projection) {
|
|
3898
|
+
return projection.truncated || projection.skippedTruncated;
|
|
3899
|
+
}
|
|
3900
|
+
function renderReadiness(projection) {
|
|
3901
|
+
const lines = ["Import readiness (server-owned)"];
|
|
3902
|
+
if (projection.issues.length === 0) {
|
|
3903
|
+
lines.push(" no binding gaps reported");
|
|
3904
|
+
} else {
|
|
3905
|
+
for (const issue of projection.issues) {
|
|
3906
|
+
lines.push(
|
|
3907
|
+
` ${issue.code} ${issue.resourceType} id=${issue.resourceId} uuid=${issue.resourceUuid}` + (issue.resourceName ? ` name=${issue.resourceName}` : "")
|
|
3908
|
+
);
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
if (projection.truncated) {
|
|
3912
|
+
lines.push(
|
|
3913
|
+
" INCOMPLETE: the readiness scan was truncated. This report does not mean the workspace is ready."
|
|
3914
|
+
);
|
|
3915
|
+
}
|
|
3916
|
+
lines.push("");
|
|
3917
|
+
lines.push("Outstanding skipped EventRule groups");
|
|
3918
|
+
if (projection.outstandingGroups.length === 0) {
|
|
3919
|
+
lines.push(" none outstanding");
|
|
3920
|
+
} else {
|
|
3921
|
+
for (const group of projection.outstandingGroups) {
|
|
3922
|
+
lines.push(
|
|
3923
|
+
` ${group.resourceType} outstanding=${group.outstandingCount} active=${group.activeCount} rules=${group.ruleCount}`
|
|
3924
|
+
);
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
if (projection.skippedTruncated) {
|
|
3928
|
+
lines.push(" INCOMPLETE: the skipped-rule listing was truncated.");
|
|
3929
|
+
}
|
|
3930
|
+
return lines.join("\n") + "\n";
|
|
3931
|
+
}
|
|
3932
|
+
var MAX_RENDERED_PATHS = 5;
|
|
3933
|
+
function renderPaths(paths) {
|
|
3934
|
+
if (paths.length === 0) return "";
|
|
3935
|
+
const head = paths.slice(0, MAX_RENDERED_PATHS).join(", ");
|
|
3936
|
+
const extra = paths.length - MAX_RENDERED_PATHS;
|
|
3937
|
+
return extra > 0 ? `${head} (+${extra} more)` : head;
|
|
3938
|
+
}
|
|
3939
|
+
function padded(cells, widths) {
|
|
3940
|
+
return cells.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" ").trimEnd();
|
|
3941
|
+
}
|
|
3942
|
+
var PLAN_CONTRACT_FAILURE_CODE = "plan_contract_incomplete";
|
|
3943
|
+
var MissingPlanContract = class extends CLIError {
|
|
3944
|
+
code = PLAN_CONTRACT_FAILURE_CODE;
|
|
3945
|
+
constructor(missing) {
|
|
3946
|
+
super(`The server's plan response omitted ${missing}, so this target could not be planned.`);
|
|
3947
|
+
this.name = "MissingPlanContract";
|
|
3948
|
+
}
|
|
3949
|
+
};
|
|
3950
|
+
function isPlanRowShaped(row) {
|
|
3951
|
+
if (typeof row !== "object" || row === null) return false;
|
|
3952
|
+
const candidate = row;
|
|
3953
|
+
return typeof candidate.entityType === "string" && typeof candidate.sourceUuid === "string" && typeof candidate.action === "string";
|
|
3954
|
+
}
|
|
3955
|
+
function projectImportPlan(response) {
|
|
3956
|
+
if (!Array.isArray(response.planRows)) throw new MissingPlanContract("planRows");
|
|
3957
|
+
if (!response.planFingerprint) throw new MissingPlanContract("planFingerprint");
|
|
3958
|
+
if (!response.sourceFingerprint) throw new MissingPlanContract("sourceFingerprint");
|
|
3959
|
+
if (!response.planRows.every(isPlanRowShaped)) {
|
|
3960
|
+
throw new MissingPlanContract("well-formed planRows");
|
|
3961
|
+
}
|
|
3962
|
+
const rows = response.planRows.map((row) => {
|
|
3963
|
+
const projected = {
|
|
3964
|
+
entityType: row.entityType,
|
|
3965
|
+
sourceUuid: row.sourceUuid,
|
|
3966
|
+
action: row.action,
|
|
3967
|
+
changedPaths: [...row.changedPaths ?? []],
|
|
3968
|
+
retainedPaths: [...row.retainedPaths ?? []],
|
|
3969
|
+
reasonCodes: [...row.reasonCodes ?? []],
|
|
3970
|
+
blocksApply: row.blocksApply === true
|
|
3971
|
+
};
|
|
3972
|
+
if (row.targetUuid) projected.targetUuid = row.targetUuid;
|
|
3973
|
+
if ("name" in row && row.name) projected.name = row.name;
|
|
3974
|
+
return projected;
|
|
3975
|
+
});
|
|
3976
|
+
const counts = {};
|
|
3977
|
+
for (const row of rows) counts[row.action] = (counts[row.action] ?? 0) + 1;
|
|
3978
|
+
return {
|
|
3979
|
+
rows,
|
|
3980
|
+
counts,
|
|
3981
|
+
blocked: rows.some((row) => row.blocksApply),
|
|
3982
|
+
// Derived from the projection the operator is shown, not from a separate
|
|
3983
|
+
// server field: what they approve is what these rows say.
|
|
3984
|
+
hasWrites: rows.some((row) => row.action === "create" || row.action === "update"),
|
|
3985
|
+
planFingerprint: response.planFingerprint,
|
|
3986
|
+
sourceFingerprint: response.sourceFingerprint
|
|
3987
|
+
};
|
|
3988
|
+
}
|
|
3989
|
+
var PLAN_ACTION_ORDER = ["refuse", "create", "update", "retain"];
|
|
3990
|
+
function renderImportPlan(projection) {
|
|
3991
|
+
const header = ["ACTION", "ENTITY", "SOURCE", "NAME", "CHANGED", "RETAINED", "REASONS"];
|
|
3992
|
+
const body = projection.rows.map((row) => [
|
|
3993
|
+
row.action,
|
|
3994
|
+
row.entityType,
|
|
3995
|
+
row.sourceUuid,
|
|
3996
|
+
row.name ?? "",
|
|
3997
|
+
renderPaths(row.changedPaths),
|
|
3998
|
+
renderPaths(row.retainedPaths),
|
|
3999
|
+
row.reasonCodes.join(", ")
|
|
4000
|
+
]);
|
|
4001
|
+
const widths = header.map(
|
|
4002
|
+
(cell, i) => Math.max(cell.length, ...body.map((cells) => (cells[i] ?? "").length), 0)
|
|
4003
|
+
);
|
|
4004
|
+
const lines = [padded(header, widths)];
|
|
4005
|
+
for (const cells of body) lines.push(padded(cells, widths));
|
|
4006
|
+
if (body.length === 0) lines.push("(the template describes no rows for this target)");
|
|
4007
|
+
lines.push("");
|
|
4008
|
+
lines.push(
|
|
4009
|
+
PLAN_ACTION_ORDER.map((action) => `${action}=${projection.counts[action] ?? 0}`).join(" ")
|
|
4010
|
+
);
|
|
4011
|
+
if (projection.blocked) {
|
|
4012
|
+
lines.push(
|
|
4013
|
+
"BLOCKED: at least one row cannot be applied safely. Nothing may be written until each refusing row is resolved."
|
|
4014
|
+
);
|
|
4015
|
+
} else if (!projection.hasWrites) {
|
|
4016
|
+
lines.push("This target already matches the template; applying would write nothing.");
|
|
4017
|
+
}
|
|
4018
|
+
return lines.join("\n") + "\n";
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
// src/domains/workspaces.ts
|
|
4022
|
+
function archiveBlob(zip) {
|
|
4023
|
+
return new Blob([new Uint8Array(zip)]);
|
|
4024
|
+
}
|
|
4025
|
+
var REAPPLY_EXPORT_EXCLUDE = "channels";
|
|
4026
|
+
async function exportTemplateArchive(client, templateUuid) {
|
|
4027
|
+
return client.exportWorkspaceZip(templateUuid, void 0, void 0, REAPPLY_EXPORT_EXCLUDE);
|
|
4028
|
+
}
|
|
4029
|
+
async function readBindingsFile(filePath, targets) {
|
|
4030
|
+
if (!filePath) return {};
|
|
4031
|
+
const { readFile } = await import("fs/promises");
|
|
4032
|
+
let raw;
|
|
4033
|
+
try {
|
|
4034
|
+
raw = await readFile(filePath, "utf8");
|
|
4035
|
+
} catch (err) {
|
|
4036
|
+
throw new CLIError(
|
|
4037
|
+
`Could not read --bindings-file ${filePath}: ${err instanceof Error ? err.name : "unknown error"}`
|
|
4038
|
+
);
|
|
4039
|
+
}
|
|
4040
|
+
let payload;
|
|
4041
|
+
try {
|
|
4042
|
+
payload = JSON.parse(raw);
|
|
4043
|
+
} catch {
|
|
4044
|
+
throw new CLIError(`--bindings-file ${filePath} is not valid JSON.`);
|
|
4045
|
+
}
|
|
4046
|
+
const parsed = parseBindingsFile(payload);
|
|
4047
|
+
const unused = unusedBindingTargets(parsed, targets);
|
|
4048
|
+
if (unused.length > 0) {
|
|
4049
|
+
throw new CLIError(
|
|
4050
|
+
`--bindings-file names ${unused.length} target(s) that no --target selected: ${unused.join(", ")}. Add them as --target, or remove them from the file.`
|
|
4051
|
+
);
|
|
4052
|
+
}
|
|
4053
|
+
return parsed;
|
|
4054
|
+
}
|
|
4055
|
+
async function confirmApply(ctx, targetUuid) {
|
|
4056
|
+
if (!isTerminalReport(ctx)) {
|
|
4057
|
+
stderr(
|
|
4058
|
+
`Output is not a terminal report, so the plan for ${targetUuid} was not shown and was not confirmed. Run --plan-only to review it, then re-run with --yes.`
|
|
4059
|
+
);
|
|
4060
|
+
return false;
|
|
4061
|
+
}
|
|
4062
|
+
if (!process.stdout.isTTY) {
|
|
4063
|
+
stderr(
|
|
4064
|
+
`stdout is not a terminal, so the plan for ${targetUuid} was written where it cannot be read before confirming; not confirmed. Re-run in a terminal, or review with --plan-only and re-run with --yes.`
|
|
4065
|
+
);
|
|
4066
|
+
return false;
|
|
4067
|
+
}
|
|
4068
|
+
if (!process.stdin.isTTY) {
|
|
4069
|
+
stderr(
|
|
4070
|
+
`Not a terminal, so ${targetUuid} was not confirmed. Re-run with --yes to apply without prompting.`
|
|
4071
|
+
);
|
|
4072
|
+
return false;
|
|
4073
|
+
}
|
|
4074
|
+
const readline4 = await import("readline");
|
|
4075
|
+
const rl = readline4.createInterface({ input: process.stdin, output: process.stderr });
|
|
4076
|
+
const answer = await new Promise(
|
|
4077
|
+
(resolve) => rl.question(`Apply this plan to ${targetUuid}? [y/N] `, resolve)
|
|
4078
|
+
);
|
|
4079
|
+
rl.close();
|
|
4080
|
+
return answer.trim().toLowerCase() === "y";
|
|
4081
|
+
}
|
|
4082
|
+
function structuredErrorData(error) {
|
|
4083
|
+
const data = error?.errorData;
|
|
4084
|
+
if (typeof data !== "object" || data === null) return void 0;
|
|
4085
|
+
return data;
|
|
4086
|
+
}
|
|
4087
|
+
function failureCode(error) {
|
|
4088
|
+
if (error instanceof MissingPlanContract) return error.code;
|
|
4089
|
+
const code = structuredErrorData(error)?.code;
|
|
4090
|
+
if (typeof code === "string") return code;
|
|
4091
|
+
const status = error?.statusCode;
|
|
4092
|
+
if (typeof status === "number") return `http_${status}`;
|
|
4093
|
+
return error instanceof Error ? error.name : "unknown_error";
|
|
4094
|
+
}
|
|
4095
|
+
function conflictPlan(error) {
|
|
4096
|
+
const data = structuredErrorData(error);
|
|
4097
|
+
if (!data || !Array.isArray(data.planRows)) return void 0;
|
|
4098
|
+
try {
|
|
4099
|
+
return projectImportPlan(data);
|
|
4100
|
+
} catch (projectionError) {
|
|
4101
|
+
if (projectionError instanceof MissingPlanContract) return void 0;
|
|
4102
|
+
throw projectionError;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
async function reapplyOneTarget(ctx, client, options) {
|
|
4106
|
+
const { targetUuid, bindings, planOnly, autoConfirm } = options;
|
|
4107
|
+
let projection;
|
|
4108
|
+
try {
|
|
4109
|
+
const preview = await client.previewWorkspaceImportZip(
|
|
4110
|
+
targetUuid,
|
|
4111
|
+
archiveBlob(options.archive),
|
|
4112
|
+
{ intent: "template_reapply", bindings }
|
|
4113
|
+
);
|
|
4114
|
+
projection = projectImportPlan(preview);
|
|
4115
|
+
} catch (err) {
|
|
4116
|
+
const code = failureCode(err);
|
|
4117
|
+
stderr(`${targetUuid}: planning failed (${code})`);
|
|
4118
|
+
return { target: targetUuid, status: "failed", code };
|
|
4119
|
+
}
|
|
4120
|
+
if (isTerminalReport(ctx)) {
|
|
4121
|
+
process.stdout.write(`
|
|
4122
|
+
${targetUuid}
|
|
4123
|
+
${renderImportPlan(projection)}`);
|
|
4124
|
+
}
|
|
4125
|
+
if (projection.blocked) {
|
|
4126
|
+
return {
|
|
4127
|
+
target: targetUuid,
|
|
4128
|
+
status: "refused",
|
|
4129
|
+
refusedRows: projection.counts.refuse ?? 0,
|
|
4130
|
+
code: "import_plan_refused",
|
|
4131
|
+
plan: projection
|
|
4132
|
+
};
|
|
4133
|
+
}
|
|
4134
|
+
if (planOnly) {
|
|
4135
|
+
return {
|
|
4136
|
+
target: targetUuid,
|
|
4137
|
+
status: "planned",
|
|
4138
|
+
counts: projection.counts,
|
|
4139
|
+
plan: projection
|
|
4140
|
+
};
|
|
4141
|
+
}
|
|
4142
|
+
if (!projection.hasWrites) {
|
|
4143
|
+
return {
|
|
4144
|
+
target: targetUuid,
|
|
4145
|
+
status: "noop",
|
|
4146
|
+
counts: projection.counts,
|
|
4147
|
+
plan: projection
|
|
4148
|
+
};
|
|
4149
|
+
}
|
|
4150
|
+
if (!autoConfirm && !await confirmApply(ctx, targetUuid)) {
|
|
4151
|
+
return { target: targetUuid, status: "skipped", code: "not_confirmed", plan: projection };
|
|
4152
|
+
}
|
|
4153
|
+
try {
|
|
4154
|
+
const applied = await client.importWorkspaceZip(targetUuid, archiveBlob(options.archive), {
|
|
4155
|
+
intent: "template_reapply",
|
|
4156
|
+
expectedPlanFingerprint: projection.planFingerprint,
|
|
4157
|
+
bindings
|
|
4158
|
+
});
|
|
4159
|
+
if (applied.status === "noop") {
|
|
4160
|
+
return {
|
|
4161
|
+
target: targetUuid,
|
|
4162
|
+
status: "noop",
|
|
4163
|
+
counts: projection.counts,
|
|
4164
|
+
plan: projection
|
|
4165
|
+
};
|
|
4166
|
+
}
|
|
4167
|
+
return {
|
|
4168
|
+
target: targetUuid,
|
|
4169
|
+
status: "applied",
|
|
4170
|
+
counts: projection.counts,
|
|
4171
|
+
plan: projection
|
|
4172
|
+
};
|
|
4173
|
+
} catch (err) {
|
|
4174
|
+
const conflict = conflictPlan(err);
|
|
4175
|
+
if (conflict && isTerminalReport(ctx)) {
|
|
4176
|
+
process.stdout.write(renderImportPlan(conflict));
|
|
4177
|
+
}
|
|
4178
|
+
const code = failureCode(err);
|
|
4179
|
+
stderr(`${targetUuid}: apply failed (${code})`);
|
|
4180
|
+
return {
|
|
4181
|
+
target: targetUuid,
|
|
4182
|
+
status: code === "import_plan_refused" ? "refused" : "failed",
|
|
4183
|
+
code,
|
|
4184
|
+
plan: conflict ?? projection
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
function renderReapplySummary(summary) {
|
|
4189
|
+
const lines = ["", "Re-apply summary"];
|
|
4190
|
+
for (const result2 of summary.targets) {
|
|
4191
|
+
lines.push(
|
|
4192
|
+
` ${result2.status.padEnd(8)} ${result2.target}` + (result2.code ? ` ${result2.code}` : "")
|
|
4193
|
+
);
|
|
4194
|
+
}
|
|
4195
|
+
lines.push("");
|
|
4196
|
+
lines.push(
|
|
4197
|
+
Object.entries(summary.counts).map(([status, count]) => `${status}=${count}`).join(" ")
|
|
4198
|
+
);
|
|
4199
|
+
return lines.join("\n") + "\n";
|
|
4200
|
+
}
|
|
4201
|
+
function requireArg(hctx, name) {
|
|
4202
|
+
const value = hctx.args[name];
|
|
4203
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
4204
|
+
throw new CLIError(`Missing required argument: --${name}`);
|
|
4205
|
+
}
|
|
4206
|
+
return value;
|
|
4207
|
+
}
|
|
4208
|
+
function emitReport(ctx, table, json) {
|
|
4209
|
+
const format = ctx.jq ? "json" : ctx.outputFormat ?? "table";
|
|
4210
|
+
if (format === "table") {
|
|
4211
|
+
process.stdout.write(table);
|
|
4212
|
+
return;
|
|
4213
|
+
}
|
|
4214
|
+
outputSingle(json, ctx);
|
|
4215
|
+
}
|
|
4216
|
+
function failCommand(reason) {
|
|
4217
|
+
stderr(reason);
|
|
4218
|
+
process.exitCode = 1;
|
|
4219
|
+
}
|
|
4220
|
+
function isTerminalReport(ctx) {
|
|
4221
|
+
return !ctx.jq && (ctx.outputFormat ?? "table") === "table";
|
|
4222
|
+
}
|
|
3474
4223
|
var COLUMNS6 = [
|
|
3475
4224
|
COL.id(),
|
|
3476
4225
|
COL.uuid(),
|
|
@@ -3748,12 +4497,18 @@ Provisioning started. Watch it come up with:
|
|
|
3748
4497
|
name: "create-all",
|
|
3749
4498
|
description: "Auto-generate createNew entries for all entities in the export data. Use when importing into a fresh workspace.",
|
|
3750
4499
|
isFlag: true
|
|
4500
|
+
},
|
|
4501
|
+
{
|
|
4502
|
+
name: "activate-webhooks",
|
|
4503
|
+
description: "Keep imported webhook:send EventRules at their exported active state. Safety default: OFF \u2014 without this flag, an exported-active webhook rule is force-disabled on import so a cloned workspace never calls the source workspace's webhook URLs. An exported-inactive rule stays inactive either way. Only pass this once you have verified the destination should own those webhook calls.",
|
|
4504
|
+
isFlag: true
|
|
3751
4505
|
}
|
|
3752
4506
|
],
|
|
3753
4507
|
examples: [
|
|
3754
4508
|
"yarn gr workspaces import -w $UUID --env dev --file export.json --create-all",
|
|
3755
4509
|
"yarn gr workspaces import -w $UUID --env dev --file export.zip --create-all",
|
|
3756
|
-
`yarn gr workspaces import -w $UUID --env dev --data '{"exportData": ..., "createNew": ..., "importMappings": {}}'
|
|
4510
|
+
`yarn gr workspaces import -w $UUID --env dev --data '{"exportData": ..., "createNew": ..., "importMappings": {}}'`,
|
|
4511
|
+
"yarn gr workspaces import -w $UUID --env dev --file export.json --create-all --activate-webhooks"
|
|
3757
4512
|
],
|
|
3758
4513
|
handler: async ({ ctx, workspace, data, args }) => {
|
|
3759
4514
|
if (!data) throw new CLIError("JSON or ZIP data required (--data, --file, or stdin)");
|
|
@@ -3772,68 +4527,22 @@ Provisioning started. Watch it come up with:
|
|
|
3772
4527
|
payload = data;
|
|
3773
4528
|
}
|
|
3774
4529
|
const createAll = args["create-all"] === true;
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
exportData = payload.exportData;
|
|
3780
|
-
importMappings = payload.importMappings ?? {};
|
|
3781
|
-
createNew = payload.createNew ?? {};
|
|
3782
|
-
} else if (payload.version && payload.workflows) {
|
|
3783
|
-
exportData = payload;
|
|
3784
|
-
importMappings = {};
|
|
3785
|
-
createNew = {};
|
|
3786
|
-
} else {
|
|
3787
|
-
throw new CLIError(
|
|
3788
|
-
'Unrecognized data format. Provide either raw export data (from "workspaces export") or a full import payload with {exportData, importMappings, createNew}.'
|
|
3789
|
-
);
|
|
3790
|
-
}
|
|
3791
|
-
if (createAll) {
|
|
3792
|
-
const entityKeys = [
|
|
3793
|
-
"workflows",
|
|
3794
|
-
"tasks",
|
|
3795
|
-
"dataTypes",
|
|
3796
|
-
"agents",
|
|
3797
|
-
"memberLabels",
|
|
3798
|
-
"files",
|
|
3799
|
-
"eventRules",
|
|
3800
|
-
"memberRoles",
|
|
3801
|
-
"phoneNumbers",
|
|
3802
|
-
"sites",
|
|
3803
|
-
"inboxes",
|
|
3804
|
-
"routines",
|
|
3805
|
-
"memberFilters",
|
|
3806
|
-
"customToolkits",
|
|
3807
|
-
"customTools",
|
|
3808
|
-
"pages",
|
|
3809
|
-
"menuItems",
|
|
3810
|
-
"mcpServers",
|
|
3811
|
-
"fileFolders",
|
|
3812
|
-
"fileLabels",
|
|
3813
|
-
"workflowNotes",
|
|
3814
|
-
"abilities",
|
|
3815
|
-
"qualifications",
|
|
3816
|
-
"chatLabels",
|
|
3817
|
-
"chatFilters",
|
|
3818
|
-
"chatFilterRules",
|
|
3819
|
-
"calendars",
|
|
3820
|
-
"calendarEventTypes",
|
|
3821
|
-
"calendarSchedules",
|
|
3822
|
-
"journeys"
|
|
3823
|
-
];
|
|
3824
|
-
for (const key of entityKeys) {
|
|
3825
|
-
const entities = exportData[key];
|
|
3826
|
-
if (Array.isArray(entities)) {
|
|
3827
|
-
createNew[key] = entities.map((e) => e.uuid).filter(Boolean);
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
4530
|
+
const activateWebhooks = args["activate-webhooks"] === true;
|
|
4531
|
+
const parsed = parseImportPayload(payload);
|
|
4532
|
+
const { exportData, importMappings } = parsed;
|
|
4533
|
+
const createNew = createAll ? deriveCreateNew(exportData, parsed.createNew) : parsed.createNew;
|
|
3831
4534
|
const result2 = await requireAuth(ctx).apiClient.importWorkspace(
|
|
3832
4535
|
workspace,
|
|
3833
4536
|
exportData,
|
|
3834
4537
|
importMappings,
|
|
3835
4538
|
createNew,
|
|
3836
|
-
archive
|
|
4539
|
+
archive,
|
|
4540
|
+
activateWebhooks,
|
|
4541
|
+
// Forwarded as parsed: present when the payload carried it,
|
|
4542
|
+
// absent otherwise. The server reads presence (see
|
|
4543
|
+
// `ParsedImportPayload`), so this is the operator's choice of
|
|
4544
|
+
// name-matching, not the CLI's.
|
|
4545
|
+
parsed.autoMap
|
|
3837
4546
|
);
|
|
3838
4547
|
outputSingle(result2, ctx);
|
|
3839
4548
|
}
|
|
@@ -3853,71 +4562,218 @@ Provisioning started. Watch it come up with:
|
|
|
3853
4562
|
if (!data) throw new CLIError("JSON data required (--data, --file, or stdin)");
|
|
3854
4563
|
const payload = data;
|
|
3855
4564
|
const createAll = args["create-all"] === true;
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
if (payload.exportData && typeof payload.exportData === "object") {
|
|
3860
|
-
exportData = payload.exportData;
|
|
3861
|
-
importMappings = payload.importMappings ?? {};
|
|
3862
|
-
createNew = payload.createNew ?? {};
|
|
3863
|
-
} else if (payload.version && payload.workflows) {
|
|
3864
|
-
exportData = payload;
|
|
3865
|
-
importMappings = {};
|
|
3866
|
-
createNew = {};
|
|
3867
|
-
} else {
|
|
3868
|
-
throw new CLIError(
|
|
3869
|
-
'Unrecognized data format. Provide either raw export data (from "workspaces export") or a full import payload with {exportData, importMappings, createNew}.'
|
|
3870
|
-
);
|
|
3871
|
-
}
|
|
3872
|
-
if (createAll) {
|
|
3873
|
-
const entityKeys = [
|
|
3874
|
-
"workflows",
|
|
3875
|
-
"tasks",
|
|
3876
|
-
"dataTypes",
|
|
3877
|
-
"agents",
|
|
3878
|
-
"memberLabels",
|
|
3879
|
-
"files",
|
|
3880
|
-
"eventRules",
|
|
3881
|
-
"memberRoles",
|
|
3882
|
-
"phoneNumbers",
|
|
3883
|
-
"sites",
|
|
3884
|
-
"inboxes",
|
|
3885
|
-
"routines",
|
|
3886
|
-
"memberFilters",
|
|
3887
|
-
"customToolkits",
|
|
3888
|
-
"customTools",
|
|
3889
|
-
"pages",
|
|
3890
|
-
"menuItems",
|
|
3891
|
-
"mcpServers",
|
|
3892
|
-
"fileFolders",
|
|
3893
|
-
"fileLabels",
|
|
3894
|
-
"workflowNotes",
|
|
3895
|
-
"abilities",
|
|
3896
|
-
"qualifications",
|
|
3897
|
-
"chatLabels",
|
|
3898
|
-
"chatFilters",
|
|
3899
|
-
"chatFilterRules",
|
|
3900
|
-
"calendars",
|
|
3901
|
-
"calendarEventTypes",
|
|
3902
|
-
"calendarSchedules",
|
|
3903
|
-
"journeys"
|
|
3904
|
-
];
|
|
3905
|
-
for (const key of entityKeys) {
|
|
3906
|
-
const entities = exportData[key];
|
|
3907
|
-
if (Array.isArray(entities)) {
|
|
3908
|
-
createNew[key] = entities.map((e) => e.uuid).filter(Boolean);
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
}
|
|
4565
|
+
const parsed = parseImportPayload(payload);
|
|
4566
|
+
const { exportData, importMappings } = parsed;
|
|
4567
|
+
const createNew = createAll ? deriveCreateNew(exportData, parsed.createNew) : parsed.createNew;
|
|
3912
4568
|
const result2 = await requireAuth(ctx).apiClient.previewImportWorkspace(
|
|
3913
4569
|
workspace,
|
|
3914
4570
|
exportData,
|
|
3915
4571
|
importMappings,
|
|
3916
|
-
createNew
|
|
4572
|
+
createNew,
|
|
4573
|
+
parsed.autoMap
|
|
3917
4574
|
);
|
|
3918
4575
|
outputSingle(result2, ctx);
|
|
3919
4576
|
}
|
|
3920
4577
|
},
|
|
4578
|
+
{
|
|
4579
|
+
path: ["workspaces", "configuration-readiness"],
|
|
4580
|
+
description: "Check configuration health, post-import bindings, and skipped EventRules",
|
|
4581
|
+
requiresWorkspace: true,
|
|
4582
|
+
handler: async ({ ctx, workspace }) => {
|
|
4583
|
+
const client = requireAuth(ctx).apiClient;
|
|
4584
|
+
const [configurationHealth, importReadiness, skippedRules] = await Promise.all([
|
|
4585
|
+
client.getConfigurationHealth(workspace, { page: 1, pageSize: 100 }),
|
|
4586
|
+
client.getImportReadiness(workspace),
|
|
4587
|
+
client.getImportSkippedRules(workspace, "outstanding")
|
|
4588
|
+
]);
|
|
4589
|
+
const failedChecks = configurationHealth.checks.filter(
|
|
4590
|
+
(check) => check.status !== "complete"
|
|
4591
|
+
);
|
|
4592
|
+
const configurationBlockers = configurationHealth.summary.critical + configurationHealth.summary.warning;
|
|
4593
|
+
const bindingBlockers = importReadiness.issues.length;
|
|
4594
|
+
const skippedRuleBlockers = skippedRules.rules.length;
|
|
4595
|
+
const incomplete = Boolean(importReadiness.truncated || skippedRules.truncated);
|
|
4596
|
+
const blockerDetails = {
|
|
4597
|
+
failedChecks: failedChecks.map((check) => ({
|
|
4598
|
+
checkSlug: check.checkSlug,
|
|
4599
|
+
status: check.status,
|
|
4600
|
+
issueCount: check.issueCount,
|
|
4601
|
+
failureCode: check.failureCode
|
|
4602
|
+
})),
|
|
4603
|
+
bindings: importReadiness.issues.map((issue) => ({
|
|
4604
|
+
code: issue.code,
|
|
4605
|
+
resourceType: issue.resourceType,
|
|
4606
|
+
resourceId: issue.resourceId,
|
|
4607
|
+
resourceUuid: issue.resourceUuid
|
|
4608
|
+
})),
|
|
4609
|
+
skippedRules: skippedRules.rules.map((rule) => ({
|
|
4610
|
+
uuid: rule.uuid,
|
|
4611
|
+
status: rule.status
|
|
4612
|
+
}))
|
|
4613
|
+
};
|
|
4614
|
+
outputSingle(
|
|
4615
|
+
{
|
|
4616
|
+
configurationReady: configurationBlockers === 0 && bindingBlockers === 0 && skippedRuleBlockers === 0 && failedChecks.length === 0 && !incomplete,
|
|
4617
|
+
blockerCounts: {
|
|
4618
|
+
configuration: configurationBlockers,
|
|
4619
|
+
binding: bindingBlockers,
|
|
4620
|
+
skippedRules: skippedRuleBlockers,
|
|
4621
|
+
failedChecks: failedChecks.length
|
|
4622
|
+
},
|
|
4623
|
+
incomplete,
|
|
4624
|
+
blockerDetails
|
|
4625
|
+
},
|
|
4626
|
+
ctx
|
|
4627
|
+
);
|
|
4628
|
+
}
|
|
4629
|
+
},
|
|
4630
|
+
// ---- Template re-apply (removed at Installable Definitions N8) ----
|
|
4631
|
+
{
|
|
4632
|
+
path: ["workspaces", "diff"],
|
|
4633
|
+
description: "Render the target server's plan for a template workspace",
|
|
4634
|
+
requiresWorkspace: true,
|
|
4635
|
+
args: [
|
|
4636
|
+
{
|
|
4637
|
+
name: "template",
|
|
4638
|
+
description: "Template workspace UUID to plan against this target",
|
|
4639
|
+
required: true
|
|
4640
|
+
}
|
|
4641
|
+
],
|
|
4642
|
+
examples: [
|
|
4643
|
+
"gr workspaces diff --template $TEMPLATE_UUID -w $TARGET_UUID",
|
|
4644
|
+
"gr workspaces diff --template $TEMPLATE_UUID -w $TARGET_UUID -o json"
|
|
4645
|
+
],
|
|
4646
|
+
handler: async (hctx) => {
|
|
4647
|
+
const ctx = requireAuth(hctx.ctx);
|
|
4648
|
+
const templateUuid = requireArg(hctx, "template");
|
|
4649
|
+
const client = ctx.apiClient;
|
|
4650
|
+
const archive = await exportTemplateArchive(client, templateUuid);
|
|
4651
|
+
const preview = await client.previewWorkspaceImportZip(
|
|
4652
|
+
hctx.workspace,
|
|
4653
|
+
archiveBlob(archive),
|
|
4654
|
+
{ intent: "template_reapply" }
|
|
4655
|
+
);
|
|
4656
|
+
const projection = projectImportPlan(preview);
|
|
4657
|
+
emitReport(ctx, renderImportPlan(projection), projection);
|
|
4658
|
+
if (projection.blocked) {
|
|
4659
|
+
failCommand(
|
|
4660
|
+
`${projection.counts.refuse ?? 0} row(s) cannot be applied safely. Nothing may be written until each is resolved.`
|
|
4661
|
+
);
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
},
|
|
4665
|
+
{
|
|
4666
|
+
path: ["workspaces", "reapply"],
|
|
4667
|
+
description: "Apply one template workspace to explicitly named targets",
|
|
4668
|
+
mutates: true,
|
|
4669
|
+
requiresWorkspace: false,
|
|
4670
|
+
args: [
|
|
4671
|
+
{
|
|
4672
|
+
name: "template",
|
|
4673
|
+
description: "Template workspace UUID to apply",
|
|
4674
|
+
required: true
|
|
4675
|
+
},
|
|
4676
|
+
{
|
|
4677
|
+
name: "target",
|
|
4678
|
+
description: "Target workspace UUID. Repeat the flag for each target; there is no fleet discovery.",
|
|
4679
|
+
required: true,
|
|
4680
|
+
repeatable: true
|
|
4681
|
+
},
|
|
4682
|
+
{
|
|
4683
|
+
name: "plan-only",
|
|
4684
|
+
description: "Render each target's plan and write nothing",
|
|
4685
|
+
isFlag: true
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
name: "bindings-file",
|
|
4689
|
+
description: "Local JSON keyed by target workspace UUID, supplying that target's phone / inbox / Member / webhook endpoint / signing secret / active state. Values are sent in the request body and never printed."
|
|
4690
|
+
},
|
|
4691
|
+
{
|
|
4692
|
+
name: "yes",
|
|
4693
|
+
description: "Skip the per-target confirmation prompt",
|
|
4694
|
+
isFlag: true
|
|
4695
|
+
}
|
|
4696
|
+
],
|
|
4697
|
+
examples: [
|
|
4698
|
+
"gr workspaces reapply --template $TEMPLATE_UUID --target $A --target $B --plan-only",
|
|
4699
|
+
"gr workspaces reapply --template $TEMPLATE_UUID --target $A --bindings-file ./bindings.json"
|
|
4700
|
+
],
|
|
4701
|
+
handler: async (hctx) => {
|
|
4702
|
+
const ctx = requireAuth(hctx.ctx);
|
|
4703
|
+
const templateUuid = requireArg(hctx, "template");
|
|
4704
|
+
const targets = repeatedValues(hctx.args, "target");
|
|
4705
|
+
if (targets.length === 0) {
|
|
4706
|
+
throw new CLIError("Missing required argument: --target <workspace-uuid>");
|
|
4707
|
+
}
|
|
4708
|
+
const duplicate = targets.find((uuid, index) => targets.indexOf(uuid) !== index);
|
|
4709
|
+
if (duplicate) {
|
|
4710
|
+
throw new CLIError(`--target ${duplicate} was given more than once.`);
|
|
4711
|
+
}
|
|
4712
|
+
const planOnly = hctx.args["plan-only"] === true;
|
|
4713
|
+
const bindings = await readBindingsFile(
|
|
4714
|
+
hctx.args["bindings-file"],
|
|
4715
|
+
targets
|
|
4716
|
+
);
|
|
4717
|
+
const client = ctx.apiClient;
|
|
4718
|
+
const archive = await exportTemplateArchive(client, templateUuid);
|
|
4719
|
+
const results = [];
|
|
4720
|
+
for (const targetUuid of targets) {
|
|
4721
|
+
results.push(
|
|
4722
|
+
await reapplyOneTarget(ctx, client, {
|
|
4723
|
+
archive,
|
|
4724
|
+
targetUuid,
|
|
4725
|
+
bindings: bindingsForTarget(bindings, targetUuid),
|
|
4726
|
+
planOnly,
|
|
4727
|
+
autoConfirm: hctx.args.yes === true
|
|
4728
|
+
})
|
|
4729
|
+
);
|
|
4730
|
+
}
|
|
4731
|
+
const summary = {
|
|
4732
|
+
template: templateUuid,
|
|
4733
|
+
planOnly,
|
|
4734
|
+
targets: results,
|
|
4735
|
+
counts: {
|
|
4736
|
+
applied: results.filter((r) => r.status === "applied").length,
|
|
4737
|
+
noop: results.filter((r) => r.status === "noop").length,
|
|
4738
|
+
planned: results.filter((r) => r.status === "planned").length,
|
|
4739
|
+
skipped: results.filter((r) => r.status === "skipped").length,
|
|
4740
|
+
refused: results.filter((r) => r.status === "refused").length,
|
|
4741
|
+
failed: results.filter((r) => r.status === "failed").length
|
|
4742
|
+
}
|
|
4743
|
+
};
|
|
4744
|
+
emitReport(ctx, renderReapplySummary(summary), summary);
|
|
4745
|
+
if (summary.counts.refused > 0 || summary.counts.failed > 0 || summary.counts.skipped > 0) {
|
|
4746
|
+
failCommand(
|
|
4747
|
+
`${summary.counts.refused} target(s) refused, ${summary.counts.failed} failed and ${summary.counts.skipped} not confirmed. Each target is independent; the rest were processed.`
|
|
4748
|
+
);
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
},
|
|
4752
|
+
{
|
|
4753
|
+
path: ["workspaces", "readiness"],
|
|
4754
|
+
description: "Report server-owned import readiness and outstanding skipped EventRules",
|
|
4755
|
+
requiresWorkspace: true,
|
|
4756
|
+
examples: ["gr workspaces readiness -w $TARGET_UUID"],
|
|
4757
|
+
handler: async (hctx) => {
|
|
4758
|
+
const ctx = requireAuth(hctx.ctx);
|
|
4759
|
+
const client = ctx.apiClient;
|
|
4760
|
+
const readiness = await client.getImportReadiness(hctx.workspace);
|
|
4761
|
+
const skipped = await client.getImportSkippedRules(hctx.workspace, "outstanding");
|
|
4762
|
+
const projection = projectReadiness(readiness, skipped);
|
|
4763
|
+
emitReport(ctx, renderReadiness(projection), projection);
|
|
4764
|
+
if (readinessIsIncomplete(projection)) {
|
|
4765
|
+
failCommand(
|
|
4766
|
+
"The readiness report is incomplete (truncated). It cannot establish that this workspace is ready."
|
|
4767
|
+
);
|
|
4768
|
+
return;
|
|
4769
|
+
}
|
|
4770
|
+
if (projection.issues.length > 0 || projection.outstandingGroups.length > 0) {
|
|
4771
|
+
failCommand(
|
|
4772
|
+
`${projection.issues.length} readiness issue(s) and ${projection.outstandingGroups.length} outstanding skipped-rule group(s) need attention.`
|
|
4773
|
+
);
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
},
|
|
3921
4777
|
// Features
|
|
3922
4778
|
{
|
|
3923
4779
|
path: ["workspaces", "features"],
|
|
@@ -4586,6 +5442,107 @@ var calendarsDomain = {
|
|
|
4586
5442
|
]
|
|
4587
5443
|
};
|
|
4588
5444
|
|
|
5445
|
+
// src/domains/data-type-schema.ts
|
|
5446
|
+
function counter(args, key, minimum = 0) {
|
|
5447
|
+
const value = requireNumber(args, key);
|
|
5448
|
+
if (!Number.isSafeInteger(value) || value < minimum) {
|
|
5449
|
+
throw new Error(`--${key} must be an integer of at least ${minimum}`);
|
|
5450
|
+
}
|
|
5451
|
+
return value;
|
|
5452
|
+
}
|
|
5453
|
+
var idArg = { name: "id", description: "Form ID", required: true };
|
|
5454
|
+
var expectedArgs = [
|
|
5455
|
+
{
|
|
5456
|
+
name: "expected-version",
|
|
5457
|
+
description: "Published version from schema draft get",
|
|
5458
|
+
required: true
|
|
5459
|
+
},
|
|
5460
|
+
{
|
|
5461
|
+
name: "expected-draft-generation",
|
|
5462
|
+
description: "Draft generation from schema draft get",
|
|
5463
|
+
required: true
|
|
5464
|
+
}
|
|
5465
|
+
];
|
|
5466
|
+
var expected = (args) => ({
|
|
5467
|
+
expectedVersion: counter(args, "expected-version"),
|
|
5468
|
+
expectedDraftGeneration: counter(args, "expected-draft-generation")
|
|
5469
|
+
});
|
|
5470
|
+
var dataTypeSchemaCommands = [
|
|
5471
|
+
{
|
|
5472
|
+
path: ["data-types", "schema", "draft", "get"],
|
|
5473
|
+
description: "Read the saved schema draft and concurrency counters (does not enable versioning)",
|
|
5474
|
+
requiresWorkspace: true,
|
|
5475
|
+
args: [idArg],
|
|
5476
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
5477
|
+
outputSingle(
|
|
5478
|
+
await requireAuth(ctx).apiClient.getDataTypeDraft(workspace, counter(args, "id", 1)),
|
|
5479
|
+
ctx
|
|
5480
|
+
);
|
|
5481
|
+
}
|
|
5482
|
+
},
|
|
5483
|
+
{
|
|
5484
|
+
path: ["data-types", "schema", "draft", "save"],
|
|
5485
|
+
description: 'Save a complete schema draft from --file JSON {"fields": [...]}, without publishing. First save enables versioning; do not enable connector-managed Forms until their schema writer supports drafts.',
|
|
5486
|
+
mutates: true,
|
|
5487
|
+
requiresWorkspace: true,
|
|
5488
|
+
args: [idArg, ...expectedArgs],
|
|
5489
|
+
handler: async ({ ctx, workspace, args, data }) => {
|
|
5490
|
+
if (!data || typeof data !== "object" || !("fields" in data) || !Array.isArray(data.fields)) {
|
|
5491
|
+
throw new Error("Provide --file JSON with a fields array");
|
|
5492
|
+
}
|
|
5493
|
+
outputSingle(
|
|
5494
|
+
await requireAuth(ctx).apiClient.saveDataTypeDraft(workspace, counter(args, "id", 1), {
|
|
5495
|
+
...expected(args),
|
|
5496
|
+
fields: data.fields
|
|
5497
|
+
}),
|
|
5498
|
+
ctx
|
|
5499
|
+
);
|
|
5500
|
+
}
|
|
5501
|
+
},
|
|
5502
|
+
{
|
|
5503
|
+
path: ["data-types", "schema", "publish"],
|
|
5504
|
+
description: "Publish the saved draft using its exact expected counters. Conflicts require explicit reload and reconciliation.",
|
|
5505
|
+
mutates: true,
|
|
5506
|
+
requiresWorkspace: true,
|
|
5507
|
+
args: [idArg, ...expectedArgs],
|
|
5508
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
5509
|
+
outputSingle(
|
|
5510
|
+
await requireAuth(ctx).apiClient.publishDataTypeDraft(
|
|
5511
|
+
workspace,
|
|
5512
|
+
counter(args, "id", 1),
|
|
5513
|
+
expected(args)
|
|
5514
|
+
),
|
|
5515
|
+
ctx
|
|
5516
|
+
);
|
|
5517
|
+
}
|
|
5518
|
+
},
|
|
5519
|
+
{
|
|
5520
|
+
path: ["data-types", "schema", "versions"],
|
|
5521
|
+
description: "Read immutable schema history, newest first. Use the last version as --before-version.",
|
|
5522
|
+
requiresWorkspace: true,
|
|
5523
|
+
args: [
|
|
5524
|
+
idArg,
|
|
5525
|
+
{ name: "before-version", description: "Exclusive version cursor" },
|
|
5526
|
+
{ name: "limit", description: "Page size (1\u2013100, default 25)" }
|
|
5527
|
+
],
|
|
5528
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
5529
|
+
const limit = args.limit === void 0 ? 25 : counter(args, "limit", 1);
|
|
5530
|
+
if (limit > 100) throw new Error("--limit must not exceed 100");
|
|
5531
|
+
outputSingle(
|
|
5532
|
+
await requireAuth(ctx).apiClient.getDataTypeVersions(
|
|
5533
|
+
workspace,
|
|
5534
|
+
counter(args, "id", 1),
|
|
5535
|
+
{
|
|
5536
|
+
limit,
|
|
5537
|
+
...args["before-version"] !== void 0 ? { beforeVersion: counter(args, "before-version", 1) } : {}
|
|
5538
|
+
}
|
|
5539
|
+
),
|
|
5540
|
+
ctx
|
|
5541
|
+
);
|
|
5542
|
+
}
|
|
5543
|
+
}
|
|
5544
|
+
];
|
|
5545
|
+
|
|
4589
5546
|
// src/domains/data-types.ts
|
|
4590
5547
|
var COLUMNS9 = [
|
|
4591
5548
|
COL.id(),
|
|
@@ -4630,6 +5587,7 @@ var dataTypesDomain = {
|
|
|
4630
5587
|
name: "data-types",
|
|
4631
5588
|
description: "Manage data types and records",
|
|
4632
5589
|
commands: [
|
|
5590
|
+
...dataTypeSchemaCommands,
|
|
4633
5591
|
...crudCommands({
|
|
4634
5592
|
prefix: ["data-types"],
|
|
4635
5593
|
entityName: "data type",
|
|
@@ -4814,128 +5772,11 @@ ${DATA_TYPE_FIELD_REFERENCE}`
|
|
|
4814
5772
|
handler: async ({ ctx, workspace, args }) => {
|
|
4815
5773
|
await requireAuth(ctx).apiClient.deleteDataRecord(
|
|
4816
5774
|
workspace,
|
|
4817
|
-
requireNumber(args, "data-type-id"),
|
|
4818
|
-
requireNumber(args, "id")
|
|
4819
|
-
);
|
|
4820
|
-
process.stdout.write(`Deleted data record ${args.id}
|
|
4821
|
-
`);
|
|
4822
|
-
}
|
|
4823
|
-
}
|
|
4824
|
-
]
|
|
4825
|
-
};
|
|
4826
|
-
|
|
4827
|
-
// src/domains/devices.ts
|
|
4828
|
-
var DEVICE_COLUMNS = [
|
|
4829
|
-
{ header: "UUID", getValue: (item) => item.uuid ?? "" },
|
|
4830
|
-
{ header: "NAME", getValue: (item) => item.displayName ?? "" },
|
|
4831
|
-
{ header: "KIND", getValue: (item) => item.kindName ?? "" },
|
|
4832
|
-
{ header: "SLUG", getValue: (item) => item.slug ?? "" },
|
|
4833
|
-
{ header: "MEMBER", getValue: (item) => String(item.memberId ?? "") },
|
|
4834
|
-
{ header: "REVOKED", getValue: (item) => item.isRevoked ? "yes" : "" },
|
|
4835
|
-
{ header: "LAST SEEN", getValue: (item) => item.lastSeenAt ?? "" },
|
|
4836
|
-
{ header: "FIRMWARE", getValue: (item) => item.firmwareVersion ?? "" }
|
|
4837
|
-
];
|
|
4838
|
-
var KIND_COLUMNS = [
|
|
4839
|
-
{ header: "SLUG", getValue: (item) => item.slug ?? "" },
|
|
4840
|
-
{ header: "NAME", getValue: (item) => item.name ?? "" },
|
|
4841
|
-
{ header: "FAMILY", getValue: (item) => item.family ?? "" }
|
|
4842
|
-
];
|
|
4843
|
-
var devicesDomain = {
|
|
4844
|
-
name: "devices",
|
|
4845
|
-
description: "Registered devices: list, inspect, rename, revoke, claim pairing",
|
|
4846
|
-
commands: [
|
|
4847
|
-
{
|
|
4848
|
-
path: ["devices", "list"],
|
|
4849
|
-
description: "List registered devices (all with devices:admin; --mine for the session member\u2019s own)",
|
|
4850
|
-
requiresWorkspace: true,
|
|
4851
|
-
args: [
|
|
4852
|
-
{
|
|
4853
|
-
name: "mine",
|
|
4854
|
-
description: "Only the session member\u2019s own devices",
|
|
4855
|
-
isFlag: true
|
|
4856
|
-
}
|
|
4857
|
-
],
|
|
4858
|
-
examples: ["gr devices list -w $WID", "gr devices list -w $WID --mine"],
|
|
4859
|
-
handler: async ({ ctx, workspace, args }) => {
|
|
4860
|
-
const auth = requireAuth(ctx);
|
|
4861
|
-
const result2 = await auth.apiClient.getDevices(workspace, {
|
|
4862
|
-
mine: args.mine === true
|
|
4863
|
-
});
|
|
4864
|
-
outputData(result2, ctx, DEVICE_COLUMNS);
|
|
4865
|
-
}
|
|
4866
|
-
},
|
|
4867
|
-
{
|
|
4868
|
-
path: ["devices", "get"],
|
|
4869
|
-
description: "Show one device",
|
|
4870
|
-
requiresWorkspace: true,
|
|
4871
|
-
args: [{ name: "uuid", description: "Device UUID", required: true }],
|
|
4872
|
-
handler: async ({ ctx, workspace, args }) => {
|
|
4873
|
-
const auth = requireAuth(ctx);
|
|
4874
|
-
const result2 = await auth.apiClient.getDevice(workspace, requireString(args, "uuid"));
|
|
4875
|
-
outputSingle(result2, ctx, DEVICE_COLUMNS);
|
|
4876
|
-
}
|
|
4877
|
-
},
|
|
4878
|
-
{
|
|
4879
|
-
path: ["devices", "kinds"],
|
|
4880
|
-
description: "List the device catalog (kinds a device can register as)",
|
|
4881
|
-
requiresWorkspace: true,
|
|
4882
|
-
handler: async ({ ctx, workspace }) => {
|
|
4883
|
-
const auth = requireAuth(ctx);
|
|
4884
|
-
const result2 = await auth.apiClient.getDeviceKinds(workspace);
|
|
4885
|
-
outputData(result2, ctx, KIND_COLUMNS);
|
|
4886
|
-
}
|
|
4887
|
-
},
|
|
4888
|
-
{
|
|
4889
|
-
path: ["devices", "update"],
|
|
4890
|
-
description: "Update a device (displayName, lanReceive, lanBroadcast)",
|
|
4891
|
-
mutates: true,
|
|
4892
|
-
requiresWorkspace: true,
|
|
4893
|
-
args: [{ name: "uuid", description: "Device UUID", required: true }],
|
|
4894
|
-
examples: [
|
|
4895
|
-
`gr devices update -w $WID --uuid $UUID --data '{"displayName":"Kitchen Lantern"}' --allow-write`
|
|
4896
|
-
],
|
|
4897
|
-
handler: async ({ ctx, workspace, args, data }) => {
|
|
4898
|
-
const auth = requireAuth(ctx);
|
|
4899
|
-
const result2 = await auth.apiClient.updateDevice(
|
|
4900
|
-
workspace,
|
|
4901
|
-
requireString(args, "uuid"),
|
|
4902
|
-
data ?? {}
|
|
4903
|
-
);
|
|
4904
|
-
outputSingle(result2, ctx, DEVICE_COLUMNS);
|
|
4905
|
-
}
|
|
4906
|
-
},
|
|
4907
|
-
{
|
|
4908
|
-
path: ["devices", "revoke"],
|
|
4909
|
-
description: "Revoke a device credential (the device must pair again)",
|
|
4910
|
-
mutates: true,
|
|
4911
|
-
requiresWorkspace: true,
|
|
4912
|
-
args: [{ name: "uuid", description: "Device UUID", required: true }],
|
|
4913
|
-
handler: async ({ ctx, workspace, args }) => {
|
|
4914
|
-
const auth = requireAuth(ctx);
|
|
4915
|
-
const result2 = await auth.apiClient.revokeDevice(
|
|
4916
|
-
workspace,
|
|
4917
|
-
requireString(args, "uuid")
|
|
4918
|
-
);
|
|
4919
|
-
outputSingle(result2, ctx, DEVICE_COLUMNS);
|
|
4920
|
-
}
|
|
4921
|
-
},
|
|
4922
|
-
{
|
|
4923
|
-
path: ["devices", "claim"],
|
|
4924
|
-
description: "Claim a device pairing code (binds the device to the CLAIMING member \u2014 the normal self-service pairing flow)",
|
|
4925
|
-
mutates: true,
|
|
4926
|
-
requiresWorkspace: true,
|
|
4927
|
-
args: [
|
|
4928
|
-
{ name: "code", description: "Pairing code shown on the device", required: true },
|
|
4929
|
-
{ name: "name", description: "Optional display name", required: false }
|
|
4930
|
-
],
|
|
4931
|
-
handler: async ({ ctx, workspace, args }) => {
|
|
4932
|
-
const auth = requireAuth(ctx);
|
|
4933
|
-
const displayName = optionalString(args, "name");
|
|
4934
|
-
const result2 = await auth.apiClient.claimDevicePairing(workspace, {
|
|
4935
|
-
pairingCode: requireString(args, "code"),
|
|
4936
|
-
...displayName !== void 0 ? { displayName } : {}
|
|
4937
|
-
});
|
|
4938
|
-
outputSingle(result2, ctx, DEVICE_COLUMNS);
|
|
5775
|
+
requireNumber(args, "data-type-id"),
|
|
5776
|
+
requireNumber(args, "id")
|
|
5777
|
+
);
|
|
5778
|
+
process.stdout.write(`Deleted data record ${args.id}
|
|
5779
|
+
`);
|
|
4939
5780
|
}
|
|
4940
5781
|
}
|
|
4941
5782
|
]
|
|
@@ -4986,7 +5827,7 @@ var ACTION_PARAM_HINTS = {
|
|
|
4986
5827
|
],
|
|
4987
5828
|
notes: [
|
|
4988
5829
|
"inboxUUID is required \u2014 list them with `gr inboxes list -w $WID`.",
|
|
4989
|
-
'Optional: toEmail, contentType ("text" default), initialUserMessage.'
|
|
5830
|
+
'Optional: toEmail (one address or up to 20 comma-separated addresses), contentType ("text" default), initialUserMessage.'
|
|
4990
5831
|
]
|
|
4991
5832
|
},
|
|
4992
5833
|
"member:label": {
|
|
@@ -8969,85 +9810,1000 @@ var abilitiesDomain = {
|
|
|
8969
9810
|
);
|
|
8970
9811
|
outputData(task.abilities ?? [], hctx.ctx, ATTACHED_COLUMNS);
|
|
8971
9812
|
}
|
|
8972
|
-
},
|
|
8973
|
-
{
|
|
8974
|
-
path: ["abilities", "attach"],
|
|
8975
|
-
description: "Attach an ability to a task. Reads the task, appends the new ability (generating its uuid), and saves \u2014 so existing abilities aren't lost. Find slugs via 'gr abilities list' and the config schema via 'gr abilities get'.",
|
|
8976
|
-
mutates: true,
|
|
8977
|
-
requiresWorkspace: true,
|
|
8978
|
-
args: [
|
|
8979
|
-
{ name: "task", description: "Task ID to attach to", required: true },
|
|
8980
|
-
{
|
|
8981
|
-
name: "type",
|
|
8982
|
-
aliases: ["ability-type", "slug"],
|
|
8983
|
-
description: "Ability type slug, e.g. 'integration:data_access'",
|
|
8984
|
-
required: true
|
|
8985
|
-
},
|
|
9813
|
+
},
|
|
9814
|
+
{
|
|
9815
|
+
path: ["abilities", "attach"],
|
|
9816
|
+
description: "Attach an ability to a task. Reads the task, appends the new ability (generating its uuid), and saves \u2014 so existing abilities aren't lost. Find slugs via 'gr abilities list' and the config schema via 'gr abilities get'.",
|
|
9817
|
+
mutates: true,
|
|
9818
|
+
requiresWorkspace: true,
|
|
9819
|
+
args: [
|
|
9820
|
+
{ name: "task", description: "Task ID to attach to", required: true },
|
|
9821
|
+
{
|
|
9822
|
+
name: "type",
|
|
9823
|
+
aliases: ["ability-type", "slug"],
|
|
9824
|
+
description: "Ability type slug, e.g. 'integration:data_access'",
|
|
9825
|
+
required: true
|
|
9826
|
+
},
|
|
9827
|
+
{
|
|
9828
|
+
name: "config",
|
|
9829
|
+
description: `Ability config as a JSON object, e.g. '{"pauseOnEscalate":true}'`
|
|
9830
|
+
},
|
|
9831
|
+
{ name: "cel", description: "Optional CEL activation condition" },
|
|
9832
|
+
{
|
|
9833
|
+
name: "disabled",
|
|
9834
|
+
description: "Attach in a disabled state (default: enabled)",
|
|
9835
|
+
isFlag: true
|
|
9836
|
+
}
|
|
9837
|
+
],
|
|
9838
|
+
handler: async (hctx) => {
|
|
9839
|
+
const api = requireAuth(hctx.ctx).apiClient;
|
|
9840
|
+
const taskId = requireNumber(hctx.args, "task");
|
|
9841
|
+
const abilityType = hctx.args.type ?? hctx.args["ability-type"] ?? hctx.args.slug;
|
|
9842
|
+
if (!abilityType) throw new CLIError("--type is required (an ability type slug)");
|
|
9843
|
+
let config = {};
|
|
9844
|
+
if (hctx.args.config) {
|
|
9845
|
+
try {
|
|
9846
|
+
config = JSON.parse(hctx.args.config);
|
|
9847
|
+
} catch {
|
|
9848
|
+
throw new CLIError("--config must be a valid JSON object");
|
|
9849
|
+
}
|
|
9850
|
+
}
|
|
9851
|
+
const task = await api.getTask(hctx.workspace, taskId);
|
|
9852
|
+
const existing = (task.abilities ?? []).map(toAbilityData);
|
|
9853
|
+
const next = {
|
|
9854
|
+
uuid: randomUUID(),
|
|
9855
|
+
abilityType,
|
|
9856
|
+
config,
|
|
9857
|
+
enabled: hctx.args.disabled !== true,
|
|
9858
|
+
...hctx.args.cel ? { celCondition: hctx.args.cel } : {}
|
|
9859
|
+
};
|
|
9860
|
+
const updated = await api.updateTask(hctx.workspace, taskId, {
|
|
9861
|
+
abilities: [...existing, next]
|
|
9862
|
+
});
|
|
9863
|
+
outputData(updated.abilities ?? [], hctx.ctx, ATTACHED_COLUMNS);
|
|
9864
|
+
}
|
|
9865
|
+
},
|
|
9866
|
+
{
|
|
9867
|
+
path: ["abilities", "detach"],
|
|
9868
|
+
description: "Detach an ability from a task by its uuid (from `gr abilities attached`). Re-saves the remaining task-specific abilities so the rest are preserved.",
|
|
9869
|
+
mutates: true,
|
|
9870
|
+
requiresWorkspace: true,
|
|
9871
|
+
args: [
|
|
9872
|
+
{ name: "task", description: "Task ID", required: true },
|
|
9873
|
+
{ name: "uuid", description: "UUID of the attached ability to remove", required: true }
|
|
9874
|
+
],
|
|
9875
|
+
handler: async (hctx) => {
|
|
9876
|
+
const api = requireAuth(hctx.ctx).apiClient;
|
|
9877
|
+
const taskId = requireNumber(hctx.args, "task");
|
|
9878
|
+
const uuid = hctx.args.uuid;
|
|
9879
|
+
if (!uuid) throw new CLIError("--uuid is required");
|
|
9880
|
+
const task = await api.getTask(hctx.workspace, taskId);
|
|
9881
|
+
const existing = task.abilities ?? [];
|
|
9882
|
+
const remaining = existing.filter((a) => a.uuid !== uuid).map(toAbilityData);
|
|
9883
|
+
if (remaining.length === existing.length) {
|
|
9884
|
+
throw new CLIError(`No attached ability with uuid '${uuid}' on task ${taskId}`);
|
|
9885
|
+
}
|
|
9886
|
+
const updated = await api.updateTask(hctx.workspace, taskId, {
|
|
9887
|
+
abilities: remaining
|
|
9888
|
+
});
|
|
9889
|
+
outputData(updated.abilities ?? [], hctx.ctx, ATTACHED_COLUMNS);
|
|
9890
|
+
}
|
|
9891
|
+
}
|
|
9892
|
+
]
|
|
9893
|
+
};
|
|
9894
|
+
|
|
9895
|
+
// src/lib/activity-query.ts
|
|
9896
|
+
import {
|
|
9897
|
+
ActivityGrain,
|
|
9898
|
+
ActivityGroupBy,
|
|
9899
|
+
ActivityOpenItemOrder,
|
|
9900
|
+
ActivityEventType,
|
|
9901
|
+
ActivityWindowBasis,
|
|
9902
|
+
EntityKind
|
|
9903
|
+
} from "@gravity-rail/sdk";
|
|
9904
|
+
var DEFAULT_WINDOW_DAYS = 30;
|
|
9905
|
+
var ACTIVITY_MOUNT_ARGS = [
|
|
9906
|
+
{
|
|
9907
|
+
name: "org-uuid",
|
|
9908
|
+
aliases: ["org"],
|
|
9909
|
+
description: "Answer from the org mount (organization UUID)"
|
|
9910
|
+
},
|
|
9911
|
+
{
|
|
9912
|
+
name: "workspace",
|
|
9913
|
+
alias: "w",
|
|
9914
|
+
description: "Answer from the workspace mount (workspace UUID)"
|
|
9915
|
+
}
|
|
9916
|
+
];
|
|
9917
|
+
var SCOPE_ARGS = [
|
|
9918
|
+
{
|
|
9919
|
+
name: "scope-workspace",
|
|
9920
|
+
description: "Narrow to these workspace UUIDs (comma-separated); intersected, never widening"
|
|
9921
|
+
},
|
|
9922
|
+
{
|
|
9923
|
+
name: "scope-org",
|
|
9924
|
+
description: "Narrow to these org UUIDs (comma-separated); intersected, never widening"
|
|
9925
|
+
}
|
|
9926
|
+
];
|
|
9927
|
+
var WINDOW_ARGS = [
|
|
9928
|
+
{ name: "from", description: "Window start, inclusive (ISO-8601 or YYYY-MM-DD, UTC midnight)" },
|
|
9929
|
+
{ name: "to", description: "Window end, exclusive (ISO-8601 or YYYY-MM-DD, UTC midnight)" },
|
|
9930
|
+
{
|
|
9931
|
+
name: "last",
|
|
9932
|
+
description: `Relative window ending now, e.g. 24h, 7d, 3mo (default: ${DEFAULT_WINDOW_DAYS}d)`
|
|
9933
|
+
},
|
|
9934
|
+
{
|
|
9935
|
+
name: "window-basis",
|
|
9936
|
+
// Server-issued, and listed anyway: a printed drill command carries it,
|
|
9937
|
+
// and a flag a pasted command contains but `--help` does not name reads
|
|
9938
|
+
// as a typo. Typing it by hand is legal and almost never wanted.
|
|
9939
|
+
description: "absolute | workspace_local \u2014 whose clock --from/--to are in (default: absolute; drill commands carry workspace_local)"
|
|
9940
|
+
}
|
|
9941
|
+
];
|
|
9942
|
+
var RESOLUTION_ARGS = [
|
|
9943
|
+
{
|
|
9944
|
+
name: "ids",
|
|
9945
|
+
isFlag: true,
|
|
9946
|
+
description: "Print bare kind:uuid refs and make zero hydration calls"
|
|
9947
|
+
}
|
|
9948
|
+
];
|
|
9949
|
+
var ACTIVITY_QUERY_ARGS = [
|
|
9950
|
+
...ACTIVITY_MOUNT_ARGS,
|
|
9951
|
+
...WINDOW_ARGS,
|
|
9952
|
+
{
|
|
9953
|
+
name: "grain",
|
|
9954
|
+
// The ladder, coarsest first, so `--help` reads the way a drill does.
|
|
9955
|
+
// Weeks start on SUNDAY, matching every calendar surface in the product.
|
|
9956
|
+
description: "month | week | day | hour | event (server default: day)"
|
|
9957
|
+
},
|
|
9958
|
+
{ name: "group-by", description: "workspace | event_type (server default: event_type)" },
|
|
9959
|
+
{ name: "types", description: "Event types to include (comma-separated)" },
|
|
9960
|
+
{
|
|
9961
|
+
name: "subject",
|
|
9962
|
+
description: "Narrow to one entity, as kind:uuid (implies --grain event)"
|
|
9963
|
+
},
|
|
9964
|
+
...SCOPE_ARGS,
|
|
9965
|
+
{ name: "cursor", description: "Opaque cursor from a previous page (sent back unchanged)" },
|
|
9966
|
+
{ name: "page-size", description: "Rows per page, 1-200" },
|
|
9967
|
+
...RESOLUTION_ARGS
|
|
9968
|
+
];
|
|
9969
|
+
var ACTIVITY_OPEN_ITEMS_ARGS = [
|
|
9970
|
+
...ACTIVITY_MOUNT_ARGS,
|
|
9971
|
+
{ name: "order", description: "priority | recency (server default: priority)" },
|
|
9972
|
+
{ name: "kinds", description: "Open-item kinds to include (comma-separated)" },
|
|
9973
|
+
{ name: "assigned-to-me", isFlag: true, description: "Only items assigned directly to you" },
|
|
9974
|
+
{
|
|
9975
|
+
name: "point-person",
|
|
9976
|
+
isFlag: true,
|
|
9977
|
+
description: "Only items whose subject member you are point person for"
|
|
9978
|
+
},
|
|
9979
|
+
...SCOPE_ARGS,
|
|
9980
|
+
{ name: "page-size", description: "Rows to show, 1-200" },
|
|
9981
|
+
...RESOLUTION_ARGS
|
|
9982
|
+
];
|
|
9983
|
+
var ACTIVITY_COUNTS_ARGS = [
|
|
9984
|
+
...ACTIVITY_MOUNT_ARGS,
|
|
9985
|
+
...WINDOW_ARGS,
|
|
9986
|
+
{ name: "types", description: "Event types to count (comma-separated)" },
|
|
9987
|
+
...SCOPE_ARGS,
|
|
9988
|
+
{
|
|
9989
|
+
name: "no-open-items",
|
|
9990
|
+
isFlag: true,
|
|
9991
|
+
description: "Skip the open-items badge count"
|
|
9992
|
+
}
|
|
9993
|
+
];
|
|
9994
|
+
function optional(args, name) {
|
|
9995
|
+
const raw = args[name];
|
|
9996
|
+
if (typeof raw !== "string" || raw === "") return void 0;
|
|
9997
|
+
return raw;
|
|
9998
|
+
}
|
|
9999
|
+
function resolveActivityMount(args) {
|
|
10000
|
+
const org = optional(args, "org-uuid") ?? optional(args, "org");
|
|
10001
|
+
const workspace = optional(args, "workspace") ?? optional(args, "w");
|
|
10002
|
+
if (org && workspace) {
|
|
10003
|
+
throw new CLIError("Pass --org or --workspace, not both \u2014 they select different mounts");
|
|
10004
|
+
}
|
|
10005
|
+
if (org) return { kind: "org", uuid: org };
|
|
10006
|
+
if (workspace) return { kind: "workspace", uuid: workspace };
|
|
10007
|
+
return { kind: "account" };
|
|
10008
|
+
}
|
|
10009
|
+
function mountFlags(mount) {
|
|
10010
|
+
switch (mount.kind) {
|
|
10011
|
+
case "account":
|
|
10012
|
+
return [];
|
|
10013
|
+
case "org":
|
|
10014
|
+
return ["--org", mount.uuid];
|
|
10015
|
+
case "workspace":
|
|
10016
|
+
return ["--workspace", mount.uuid];
|
|
10017
|
+
}
|
|
10018
|
+
}
|
|
10019
|
+
function describeMount(mount) {
|
|
10020
|
+
return mount.kind === "account" ? "account" : `${mount.kind} ${mount.uuid}`;
|
|
10021
|
+
}
|
|
10022
|
+
var RELATIVE_WINDOW = /^(\d+)(h|d|w|mo)$/;
|
|
10023
|
+
var RELATIVE_MS = {
|
|
10024
|
+
h: 60 * 60 * 1e3,
|
|
10025
|
+
d: 24 * 60 * 60 * 1e3,
|
|
10026
|
+
w: 7 * 24 * 60 * 60 * 1e3,
|
|
10027
|
+
mo: 30 * 24 * 60 * 60 * 1e3
|
|
10028
|
+
};
|
|
10029
|
+
function normalizeInstant(raw, flag) {
|
|
10030
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(raw)) return `${raw}T00:00:00Z`;
|
|
10031
|
+
if (Number.isNaN(Date.parse(raw))) {
|
|
10032
|
+
throw new CLIError(`--${flag} must be ISO-8601 (2026-08-01T00:00:00Z) or YYYY-MM-DD`);
|
|
10033
|
+
}
|
|
10034
|
+
if (!/(Z|[+-]\d{2}:?\d{2})$/.test(raw)) {
|
|
10035
|
+
throw new CLIError(
|
|
10036
|
+
`--${flag} needs a timezone: append Z for UTC, or an offset like -07:00. At aggregate grains the offset chooses the local calendar label.`
|
|
10037
|
+
);
|
|
10038
|
+
}
|
|
10039
|
+
return raw;
|
|
10040
|
+
}
|
|
10041
|
+
function buildWindow(args, now = /* @__PURE__ */ new Date()) {
|
|
10042
|
+
const from = optional(args, "from");
|
|
10043
|
+
const to = optional(args, "to");
|
|
10044
|
+
const last = optional(args, "last");
|
|
10045
|
+
if (last && (from || to)) {
|
|
10046
|
+
throw new CLIError("Pass --last or --from/--to, not both");
|
|
10047
|
+
}
|
|
10048
|
+
const basis = parseEnum(args, "window-basis", ActivityWindowBasis);
|
|
10049
|
+
const explicitFrom = from ? normalizeInstant(from, "from") : void 0;
|
|
10050
|
+
const explicitTo = to ? normalizeInstant(to, "to") : void 0;
|
|
10051
|
+
if (explicitFrom && explicitTo) {
|
|
10052
|
+
return withBasis({ occurredFrom: explicitFrom, occurredBefore: explicitTo }, basis);
|
|
10053
|
+
}
|
|
10054
|
+
const end = explicitTo ? new Date(explicitTo) : now;
|
|
10055
|
+
let spanMs = DEFAULT_WINDOW_DAYS * RELATIVE_MS.d;
|
|
10056
|
+
if (last) {
|
|
10057
|
+
const match = RELATIVE_WINDOW.exec(last);
|
|
10058
|
+
if (!match) {
|
|
10059
|
+
throw new CLIError("--last must look like 24h, 7d, 2w or 3mo");
|
|
10060
|
+
}
|
|
10061
|
+
spanMs = Number(match[1]) * RELATIVE_MS[match[2]];
|
|
10062
|
+
if (spanMs === 0) throw new CLIError("--last must be a non-zero duration");
|
|
10063
|
+
}
|
|
10064
|
+
const start = explicitFrom ? new Date(explicitFrom) : new Date(end.getTime() - spanMs);
|
|
10065
|
+
return withBasis(
|
|
10066
|
+
{
|
|
10067
|
+
occurredFrom: explicitFrom ?? start.toISOString(),
|
|
10068
|
+
occurredBefore: explicitTo ?? end.toISOString()
|
|
10069
|
+
},
|
|
10070
|
+
basis
|
|
10071
|
+
);
|
|
10072
|
+
}
|
|
10073
|
+
function withBasis(window, basis) {
|
|
10074
|
+
return basis ? { ...window, basis } : window;
|
|
10075
|
+
}
|
|
10076
|
+
function parseCsv(raw) {
|
|
10077
|
+
if (!raw) return [];
|
|
10078
|
+
return raw.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
|
|
10079
|
+
}
|
|
10080
|
+
var EVENT_TYPE_VALUES = Object.values(ActivityEventType);
|
|
10081
|
+
var ENTITY_KIND_VALUES = Object.values(EntityKind);
|
|
10082
|
+
function activityEventTypes() {
|
|
10083
|
+
return [...EVENT_TYPE_VALUES].sort();
|
|
10084
|
+
}
|
|
10085
|
+
function parseEventTypes(args) {
|
|
10086
|
+
const requested = parseCsv(optional(args, "types"));
|
|
10087
|
+
const unknown = requested.filter((value) => !EVENT_TYPE_VALUES.includes(value));
|
|
10088
|
+
if (unknown.length > 0) {
|
|
10089
|
+
throw new CLIError(
|
|
10090
|
+
`Unknown event type(s): ${unknown.join(", ")}. Run \`gr activity event-types\` for the closed vocabulary.`
|
|
10091
|
+
);
|
|
10092
|
+
}
|
|
10093
|
+
return requested;
|
|
10094
|
+
}
|
|
10095
|
+
function parseSubject(args) {
|
|
10096
|
+
const raw = optional(args, "subject");
|
|
10097
|
+
if (!raw) return void 0;
|
|
10098
|
+
const separator = raw.indexOf(":");
|
|
10099
|
+
if (separator <= 0) {
|
|
10100
|
+
throw new CLIError("--subject must be kind:uuid, e.g. member:8f1c\u2026");
|
|
10101
|
+
}
|
|
10102
|
+
const kind = raw.slice(0, separator);
|
|
10103
|
+
const uuid = raw.slice(separator + 1);
|
|
10104
|
+
if (!ENTITY_KIND_VALUES.includes(kind)) {
|
|
10105
|
+
throw new CLIError(
|
|
10106
|
+
`Unknown subject kind "${kind}". Known kinds: ${[...ENTITY_KIND_VALUES].sort().join(", ")}`
|
|
10107
|
+
);
|
|
10108
|
+
}
|
|
10109
|
+
if (!uuid) throw new CLIError("--subject must be kind:uuid, e.g. member:8f1c\u2026");
|
|
10110
|
+
return { kind, uuid };
|
|
10111
|
+
}
|
|
10112
|
+
function parseScope(args) {
|
|
10113
|
+
const workspaceUuids = parseCsv(optional(args, "scope-workspace"));
|
|
10114
|
+
const orgUuids = parseCsv(optional(args, "scope-org"));
|
|
10115
|
+
if (workspaceUuids.length === 0 && orgUuids.length === 0) return void 0;
|
|
10116
|
+
const scope = {};
|
|
10117
|
+
if (workspaceUuids.length > 0) scope.workspaceUuids = workspaceUuids;
|
|
10118
|
+
if (orgUuids.length > 0) scope.orgUuids = orgUuids;
|
|
10119
|
+
return scope;
|
|
10120
|
+
}
|
|
10121
|
+
function parsePageSize(args) {
|
|
10122
|
+
const raw = optional(args, "page-size");
|
|
10123
|
+
if (raw === void 0) return void 0;
|
|
10124
|
+
const value = Number(raw);
|
|
10125
|
+
if (!Number.isInteger(value) || value < 1 || value > 200) {
|
|
10126
|
+
throw new CLIError("--page-size must be an integer between 1 and 200");
|
|
10127
|
+
}
|
|
10128
|
+
return value;
|
|
10129
|
+
}
|
|
10130
|
+
function parseEnum(args, flag, allowed) {
|
|
10131
|
+
const raw = optional(args, flag);
|
|
10132
|
+
if (raw === void 0) return void 0;
|
|
10133
|
+
const values = Object.values(allowed);
|
|
10134
|
+
if (!values.includes(raw)) {
|
|
10135
|
+
throw new CLIError(`--${flag} must be one of: ${values.join(" | ")}`);
|
|
10136
|
+
}
|
|
10137
|
+
return raw;
|
|
10138
|
+
}
|
|
10139
|
+
function buildQueryRequest(args, now) {
|
|
10140
|
+
const request = { window: buildWindow(args, now) };
|
|
10141
|
+
const grain = parseEnum(args, "grain", ActivityGrain);
|
|
10142
|
+
if (grain) request.grain = grain;
|
|
10143
|
+
const groupBy = parseEnum(args, "group-by", ActivityGroupBy);
|
|
10144
|
+
if (groupBy) request.groupBy = groupBy;
|
|
10145
|
+
const eventTypes = parseEventTypes(args);
|
|
10146
|
+
if (eventTypes.length > 0) request.eventTypes = eventTypes;
|
|
10147
|
+
const subject = parseSubject(args);
|
|
10148
|
+
if (subject) {
|
|
10149
|
+
request.subject = subject;
|
|
10150
|
+
if (!request.grain) request.grain = ActivityGrain.event;
|
|
10151
|
+
}
|
|
10152
|
+
const scope = parseScope(args);
|
|
10153
|
+
if (scope) request.scope = scope;
|
|
10154
|
+
const cursor = optional(args, "cursor");
|
|
10155
|
+
if (cursor) request.cursor = cursor;
|
|
10156
|
+
const pageSize = parsePageSize(args);
|
|
10157
|
+
if (pageSize !== void 0) request.pageSize = pageSize;
|
|
10158
|
+
return request;
|
|
10159
|
+
}
|
|
10160
|
+
function buildOpenItemsRequest(args) {
|
|
10161
|
+
const request = {};
|
|
10162
|
+
const order = parseEnum(args, "order", ActivityOpenItemOrder);
|
|
10163
|
+
if (order) request.order = order;
|
|
10164
|
+
const kinds = parseCsv(optional(args, "kinds"));
|
|
10165
|
+
if (kinds.length > 0) request.kinds = kinds;
|
|
10166
|
+
const scope = parseScope(args);
|
|
10167
|
+
if (scope) request.scope = scope;
|
|
10168
|
+
if (args["assigned-to-me"] === true) request.assignedToMe = true;
|
|
10169
|
+
if (args["point-person"] === true) request.pointPerson = true;
|
|
10170
|
+
const pageSize = parsePageSize(args);
|
|
10171
|
+
if (pageSize !== void 0) request.pageSize = pageSize;
|
|
10172
|
+
return request;
|
|
10173
|
+
}
|
|
10174
|
+
function buildCountsRequest(args, now) {
|
|
10175
|
+
const request = { window: buildWindow(args, now) };
|
|
10176
|
+
const eventTypes = parseEventTypes(args);
|
|
10177
|
+
if (eventTypes.length > 0) request.eventTypes = eventTypes;
|
|
10178
|
+
const scope = parseScope(args);
|
|
10179
|
+
if (scope) request.scope = scope;
|
|
10180
|
+
if (args["no-open-items"] === true) request.includeOpenItems = false;
|
|
10181
|
+
return request;
|
|
10182
|
+
}
|
|
10183
|
+
function shellArg(value) {
|
|
10184
|
+
return /^[A-Za-z0-9_@%+=:,./-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
10185
|
+
}
|
|
10186
|
+
function renderQueryCommand(mount, request, options = {}) {
|
|
10187
|
+
const program = options.binary ?? "gr";
|
|
10188
|
+
const parts = ["activity", "query", ...mountFlags(mount)];
|
|
10189
|
+
parts.push("--from", request.window.occurredFrom, "--to", request.window.occurredBefore);
|
|
10190
|
+
if (request.window.basis) parts.push("--window-basis", request.window.basis);
|
|
10191
|
+
if (request.grain) parts.push("--grain", request.grain);
|
|
10192
|
+
if (request.groupBy) parts.push("--group-by", request.groupBy);
|
|
10193
|
+
if (request.eventTypes && request.eventTypes.length > 0) {
|
|
10194
|
+
parts.push("--types", request.eventTypes.join(","));
|
|
10195
|
+
}
|
|
10196
|
+
if (request.subject) parts.push("--subject", `${request.subject.kind}:${request.subject.uuid}`);
|
|
10197
|
+
if (request.scope?.workspaceUuids && request.scope.workspaceUuids.length > 0) {
|
|
10198
|
+
parts.push("--scope-workspace", request.scope.workspaceUuids.join(","));
|
|
10199
|
+
}
|
|
10200
|
+
if (request.scope?.orgUuids && request.scope.orgUuids.length > 0) {
|
|
10201
|
+
parts.push("--scope-org", request.scope.orgUuids.join(","));
|
|
10202
|
+
}
|
|
10203
|
+
if (request.cursor) parts.push("--cursor", request.cursor);
|
|
10204
|
+
if (request.pageSize !== void 0) parts.push("--page-size", String(request.pageSize));
|
|
10205
|
+
if (options.ids) parts.push("--ids");
|
|
10206
|
+
if (options.globals) parts.push(...options.globals);
|
|
10207
|
+
return [program, ...parts.map(shellArg)].join(" ");
|
|
10208
|
+
}
|
|
10209
|
+
|
|
10210
|
+
// src/lib/activity-refs.ts
|
|
10211
|
+
import { ApiError } from "@gravity-rail/sdk";
|
|
10212
|
+
var BATCH_RESOLVABLE = /* @__PURE__ */ new Set([
|
|
10213
|
+
"agent",
|
|
10214
|
+
"assignment",
|
|
10215
|
+
"call",
|
|
10216
|
+
"chat",
|
|
10217
|
+
"connection",
|
|
10218
|
+
"data_type",
|
|
10219
|
+
"escalation",
|
|
10220
|
+
"inbox",
|
|
10221
|
+
"journey",
|
|
10222
|
+
"journey_step",
|
|
10223
|
+
"member",
|
|
10224
|
+
"member_label",
|
|
10225
|
+
"operator_group",
|
|
10226
|
+
"phone_number",
|
|
10227
|
+
"routine",
|
|
10228
|
+
"task",
|
|
10229
|
+
"voicemail",
|
|
10230
|
+
"workflow",
|
|
10231
|
+
"workflow_revision"
|
|
10232
|
+
]);
|
|
10233
|
+
var NO_UUID_LOOKUP = /* @__PURE__ */ new Set([
|
|
10234
|
+
"account",
|
|
10235
|
+
"org_account",
|
|
10236
|
+
"subscription",
|
|
10237
|
+
"member_subscription",
|
|
10238
|
+
"purchase",
|
|
10239
|
+
"import",
|
|
10240
|
+
"invoice",
|
|
10241
|
+
"workspace_config"
|
|
10242
|
+
]);
|
|
10243
|
+
var HYDRATORS = {
|
|
10244
|
+
workspace: async ({ client }, ref) => (await client.getWorkspace(ref.uuid)).name,
|
|
10245
|
+
org: async ({ orgNames }, ref) => (await orgNames()).get(ref.uuid),
|
|
10246
|
+
workflow: async ({ client }, ref) => {
|
|
10247
|
+
const detail = await client.getWorkflow(requireWorkspace(ref), ref.uuid);
|
|
10248
|
+
return detail.workflow?.name;
|
|
10249
|
+
},
|
|
10250
|
+
task: async ({ client }, ref) => (await client.getTask(requireWorkspace(ref), ref.uuid)).name,
|
|
10251
|
+
data_type: async ({ client }, ref) => (await client.getDataTypeByUuid(requireWorkspace(ref), ref.uuid)).name,
|
|
10252
|
+
member_label: async ({ client }, ref) => (await client.getMemberLabelByUuid(requireWorkspace(ref), ref.uuid)).name,
|
|
10253
|
+
inbox: async ({ client }, ref) => (await client.getInbox(requireWorkspace(ref), ref.uuid)).name,
|
|
10254
|
+
phone_number: async ({ client }, ref) => {
|
|
10255
|
+
const phoneNumber = await client.getPhoneNumber(requireWorkspace(ref), ref.uuid);
|
|
10256
|
+
return phoneNumber.name || phoneNumber.number;
|
|
10257
|
+
},
|
|
10258
|
+
domain: async ({ client }, ref) => {
|
|
10259
|
+
if (!ref.orgUuid) return null;
|
|
10260
|
+
return (await client.getOrgDomain(ref.orgUuid, ref.uuid)).domain;
|
|
10261
|
+
}
|
|
10262
|
+
};
|
|
10263
|
+
var MissingScopeError = class extends Error {
|
|
10264
|
+
};
|
|
10265
|
+
function requireWorkspace(ref) {
|
|
10266
|
+
if (!ref.workspaceUuid) {
|
|
10267
|
+
throw new MissingScopeError(`${ref.kind} ref carries no workspace scope`);
|
|
10268
|
+
}
|
|
10269
|
+
return ref.workspaceUuid;
|
|
10270
|
+
}
|
|
10271
|
+
function shortUuid(uuid) {
|
|
10272
|
+
return uuid.length > 8 ? uuid.slice(0, 8) : uuid;
|
|
10273
|
+
}
|
|
10274
|
+
function bareLabel(ref) {
|
|
10275
|
+
return `${ref.kind}:${shortUuid(ref.uuid)}`;
|
|
10276
|
+
}
|
|
10277
|
+
var MAX_REFS_PER_BATCH = 500;
|
|
10278
|
+
function batchResolution(ref, entry) {
|
|
10279
|
+
if (entry.status === "resolved") {
|
|
10280
|
+
return { label: entry.label || bareLabel(ref), status: "resolved" };
|
|
10281
|
+
}
|
|
10282
|
+
if (entry.status === "unresolved") {
|
|
10283
|
+
return { label: `${bareLabel(ref)} (no access)`, status: "unresolved" };
|
|
10284
|
+
}
|
|
10285
|
+
return null;
|
|
10286
|
+
}
|
|
10287
|
+
var ActivityRefResolver = class {
|
|
10288
|
+
constructor(client, options = {}) {
|
|
10289
|
+
this.client = client;
|
|
10290
|
+
this.options = options;
|
|
10291
|
+
}
|
|
10292
|
+
client;
|
|
10293
|
+
options;
|
|
10294
|
+
cache = /* @__PURE__ */ new Map();
|
|
10295
|
+
/**
|
|
10296
|
+
* In-flight batches, keyed by workspace and the exact set asked about.
|
|
10297
|
+
*
|
|
10298
|
+
* The per-ref cache is only populated once a batch *settles*, so two
|
|
10299
|
+
* concurrent priming paths sharing one resolver would both look, both find
|
|
10300
|
+
* nothing, and both fire — which is the N+1 this endpoint exists to remove,
|
|
10301
|
+
* reappearing at a different layer. The promise is cached rather than its
|
|
10302
|
+
* value, which is the same rule the ref cache already follows.
|
|
10303
|
+
*/
|
|
10304
|
+
inFlight = /* @__PURE__ */ new Map();
|
|
10305
|
+
fetches = 0;
|
|
10306
|
+
/** The org membership listing, fetched at most once per invocation. */
|
|
10307
|
+
orgNamesPromise;
|
|
10308
|
+
/** How many API calls hydration actually made. `--ids` must keep this at 0. */
|
|
10309
|
+
get fetchCount() {
|
|
10310
|
+
return this.fetches;
|
|
10311
|
+
}
|
|
10312
|
+
/** Distinct refs seen, resolved or not — the denominator the memo divides. */
|
|
10313
|
+
get cacheSize() {
|
|
10314
|
+
return this.cache.size;
|
|
10315
|
+
}
|
|
10316
|
+
async resolve(ref) {
|
|
10317
|
+
if (this.options.bare) {
|
|
10318
|
+
return { label: bareLabel(ref), status: "skipped" };
|
|
10319
|
+
}
|
|
10320
|
+
const key = this.cacheKey(ref);
|
|
10321
|
+
const cached = this.cache.get(key);
|
|
10322
|
+
if (cached) return cached;
|
|
10323
|
+
const pending = this.lookup(ref);
|
|
10324
|
+
this.cache.set(key, pending);
|
|
10325
|
+
return pending;
|
|
10326
|
+
}
|
|
10327
|
+
/** Resolve many refs, deduped through the same cache. */
|
|
10328
|
+
async resolveAll(refs) {
|
|
10329
|
+
await this.prime(refs);
|
|
10330
|
+
return Promise.all(refs.map((ref) => this.resolve(ref)));
|
|
10331
|
+
}
|
|
10332
|
+
/**
|
|
10333
|
+
* Seed the cache with one batch call per workspace.
|
|
10334
|
+
*
|
|
10335
|
+
* The N+1 relief valve, used: a listing's whole set of workspace-scoped refs
|
|
10336
|
+
* becomes one `POST /w/{wid}/entity-refs/resolve` per workspace instead of
|
|
10337
|
+
* one request per ref. Call it before rendering; `resolve()` then reads the
|
|
10338
|
+
* cache. It is idempotent and skips anything already cached, so a renderer
|
|
10339
|
+
* that primes twice pays once.
|
|
10340
|
+
*
|
|
10341
|
+
* **A failed batch is not a failed listing.** If the call throws — an older
|
|
10342
|
+
* server with no such route, a network blip, a 5xx — nothing is seeded and
|
|
10343
|
+
* every ref falls through to its per-entity hydrator, which is the behaviour
|
|
10344
|
+
* this resolver had before the batch existed. That is why the fallback is
|
|
10345
|
+
* kept rather than deleted: it is the same code path on a bad day as on a
|
|
10346
|
+
* server that predates this endpoint.
|
|
10347
|
+
*/
|
|
10348
|
+
async prime(refs) {
|
|
10349
|
+
if (this.options.bare) return;
|
|
10350
|
+
const byWorkspace = /* @__PURE__ */ new Map();
|
|
10351
|
+
for (const ref of refs) {
|
|
10352
|
+
if (!ref.workspaceUuid || !BATCH_RESOLVABLE.has(ref.kind)) continue;
|
|
10353
|
+
if (this.cache.has(this.cacheKey(ref))) continue;
|
|
10354
|
+
const forWorkspace = byWorkspace.get(ref.workspaceUuid) ?? /* @__PURE__ */ new Map();
|
|
10355
|
+
forWorkspace.set(`${ref.kind}|${ref.uuid}`, ref);
|
|
10356
|
+
byWorkspace.set(ref.workspaceUuid, forWorkspace);
|
|
10357
|
+
}
|
|
10358
|
+
await Promise.all(
|
|
10359
|
+
[...byWorkspace].map(
|
|
10360
|
+
([workspaceUuid, wanted]) => this.primeWorkspace(workspaceUuid, [...wanted.values()])
|
|
10361
|
+
)
|
|
10362
|
+
);
|
|
10363
|
+
}
|
|
10364
|
+
async primeWorkspace(workspaceUuid, refs) {
|
|
10365
|
+
for (let start = 0; start < refs.length; start += MAX_REFS_PER_BATCH) {
|
|
10366
|
+
const chunk = refs.slice(start, start + MAX_REFS_PER_BATCH);
|
|
10367
|
+
const key = `${workspaceUuid}|${chunk.map((ref) => `${ref.kind}|${ref.uuid}`).sort().join(",")}`;
|
|
10368
|
+
const pending = this.inFlight.get(key) ?? this.fetchChunk(workspaceUuid, chunk, key);
|
|
10369
|
+
this.inFlight.set(key, pending);
|
|
10370
|
+
await pending;
|
|
10371
|
+
}
|
|
10372
|
+
}
|
|
10373
|
+
/**
|
|
10374
|
+
* One batch call, seeded into the per-ref cache.
|
|
10375
|
+
*
|
|
10376
|
+
* A failed batch is deliberately **not** negatively memoized: the entry is
|
|
10377
|
+
* dropped on the way out, so a later prime tries again. That is the right
|
|
10378
|
+
* trade for a CLI invocation — a transient 5xx should not silently mark
|
|
10379
|
+
* every ref unresolvable for the rest of the run — and the per-entity
|
|
10380
|
+
* hydrators cover the refs in flight when it fails.
|
|
10381
|
+
*/
|
|
10382
|
+
async fetchChunk(workspaceUuid, chunk, key) {
|
|
10383
|
+
const lookups = chunk.map((ref) => ({
|
|
10384
|
+
kind: ref.kind,
|
|
10385
|
+
uuid: ref.uuid
|
|
10386
|
+
}));
|
|
10387
|
+
try {
|
|
10388
|
+
this.fetches += 1;
|
|
10389
|
+
const response = await this.client.resolveEntityRefs(workspaceUuid, {
|
|
10390
|
+
refs: lookups
|
|
10391
|
+
});
|
|
10392
|
+
const byKey = new Map(
|
|
10393
|
+
[...response.refs].map((entry) => [`${entry.kind}|${entry.uuid}`, entry])
|
|
10394
|
+
);
|
|
10395
|
+
for (const ref of chunk) {
|
|
10396
|
+
const entry = byKey.get(`${ref.kind}|${ref.uuid}`);
|
|
10397
|
+
if (!entry) continue;
|
|
10398
|
+
const resolution = batchResolution(ref, entry);
|
|
10399
|
+
if (resolution) this.cache.set(this.cacheKey(ref), Promise.resolve(resolution));
|
|
10400
|
+
}
|
|
10401
|
+
} catch {
|
|
10402
|
+
this.inFlight.delete(key);
|
|
10403
|
+
}
|
|
10404
|
+
}
|
|
10405
|
+
/**
|
|
10406
|
+
* The scope chain is part of the key: the same UUID observed under two
|
|
10407
|
+
* workspaces is two lookups against two authorizers, and collapsing them
|
|
10408
|
+
* would let one workspace's answer render another workspace's row.
|
|
10409
|
+
*/
|
|
10410
|
+
cacheKey(ref) {
|
|
10411
|
+
return `${ref.workspaceUuid ?? ref.orgUuid ?? ref.accountUuid ?? ""}|${ref.kind}|${ref.uuid}`;
|
|
10412
|
+
}
|
|
10413
|
+
/** `label` for display; the bare ref when nothing better is available. */
|
|
10414
|
+
async label(ref) {
|
|
10415
|
+
if (!ref) return "";
|
|
10416
|
+
const resolution = await this.resolve(ref);
|
|
10417
|
+
return resolution.label;
|
|
10418
|
+
}
|
|
10419
|
+
/**
|
|
10420
|
+
* The caller's org memberships as uuid → name, fetched once.
|
|
10421
|
+
*
|
|
10422
|
+
* The promise is cached, not its value, so N org refs resolving at once
|
|
10423
|
+
* share one request — the same rule the ref cache follows.
|
|
10424
|
+
*/
|
|
10425
|
+
orgNames() {
|
|
10426
|
+
this.orgNamesPromise ??= this.client.getMyOrganizations().then(
|
|
10427
|
+
(memberships) => new Map(
|
|
10428
|
+
memberships.map((membership) => [
|
|
10429
|
+
membership.organizationUuid,
|
|
10430
|
+
membership.organizationName
|
|
10431
|
+
])
|
|
10432
|
+
)
|
|
10433
|
+
);
|
|
10434
|
+
return this.orgNamesPromise;
|
|
10435
|
+
}
|
|
10436
|
+
async lookup(ref) {
|
|
10437
|
+
const hydrator = HYDRATORS[ref.kind];
|
|
10438
|
+
if (!hydrator) {
|
|
10439
|
+
const known = NO_UUID_LOOKUP.has(ref.kind);
|
|
10440
|
+
return {
|
|
10441
|
+
label: `${bareLabel(ref)} (${known ? "no uuid lookup" : "unhydrated kind"})`,
|
|
10442
|
+
status: "no-lookup"
|
|
10443
|
+
};
|
|
10444
|
+
}
|
|
10445
|
+
this.fetches += 1;
|
|
10446
|
+
try {
|
|
10447
|
+
const name = await hydrator({ client: this.client, orgNames: () => this.orgNames() }, ref);
|
|
10448
|
+
if (!name) return { label: bareLabel(ref), status: "unresolved" };
|
|
10449
|
+
return { label: name, status: "resolved" };
|
|
10450
|
+
} catch (error) {
|
|
10451
|
+
if (error instanceof MissingScopeError) {
|
|
10452
|
+
return { label: `${bareLabel(ref)} (no scope)`, status: "no-lookup" };
|
|
10453
|
+
}
|
|
10454
|
+
if (error instanceof ApiError) {
|
|
10455
|
+
const denied = error.statusCode === 403 || error.statusCode === 404;
|
|
10456
|
+
return {
|
|
10457
|
+
label: `${bareLabel(ref)} (${denied ? "no access" : `http ${error.statusCode}`})`,
|
|
10458
|
+
status: denied ? "unresolved" : "error"
|
|
10459
|
+
};
|
|
10460
|
+
}
|
|
10461
|
+
return { label: `${bareLabel(ref)} (lookup failed)`, status: "error" };
|
|
10462
|
+
}
|
|
10463
|
+
}
|
|
10464
|
+
};
|
|
10465
|
+
|
|
10466
|
+
// src/lib/activity-render.ts
|
|
10467
|
+
var DIM = "\x1B[2m";
|
|
10468
|
+
var RESET = "\x1B[0m";
|
|
10469
|
+
function dim(text) {
|
|
10470
|
+
return process.stdout.isTTY ? `${DIM}${text}${RESET}` : text;
|
|
10471
|
+
}
|
|
10472
|
+
function envelopeLine(envelope, mount) {
|
|
10473
|
+
return dim(
|
|
10474
|
+
`mount=${mount} generated=${envelope.generatedAt} vocabulary=v${envelope.vocabularyVersion} priority-policy=v${envelope.priorityPolicyVersion}`
|
|
10475
|
+
);
|
|
10476
|
+
}
|
|
10477
|
+
function actorLabel(actor) {
|
|
10478
|
+
if (!actor.uuid) return actor.kind;
|
|
10479
|
+
return `${actor.kind}:${shortUuid(actor.uuid)}`;
|
|
10480
|
+
}
|
|
10481
|
+
function detailSummary(detail) {
|
|
10482
|
+
if (!detail || typeof detail !== "object") return "";
|
|
10483
|
+
return Object.entries(detail).filter(([key, value]) => key !== "type" && value !== null && value !== void 0).map(([key, value]) => `${key}=${formatDetailValue(value)}`).join(" ");
|
|
10484
|
+
}
|
|
10485
|
+
function formatDetailValue(value) {
|
|
10486
|
+
if (Array.isArray(value)) return `[${value.length}]`;
|
|
10487
|
+
if (typeof value === "object") return "{\u2026}";
|
|
10488
|
+
return String(value);
|
|
10489
|
+
}
|
|
10490
|
+
async function aggregateRows(response, mount, resolver, options) {
|
|
10491
|
+
return Promise.all(
|
|
10492
|
+
response.lines.map(async (line) => ({
|
|
10493
|
+
bucketLabel: line.bucketLabel,
|
|
10494
|
+
group: await groupLabel(line, resolver),
|
|
10495
|
+
count: line.count,
|
|
10496
|
+
drillCommand: line.drill ? renderQueryCommand(mount, line.drill, {
|
|
10497
|
+
binary: options.binary,
|
|
10498
|
+
globals: options.globals,
|
|
10499
|
+
ids: options.ids
|
|
10500
|
+
}) : null
|
|
10501
|
+
}))
|
|
10502
|
+
);
|
|
10503
|
+
}
|
|
10504
|
+
async function groupLabel(line, resolver) {
|
|
10505
|
+
if (line.groupKey.eventType) return line.groupKey.eventType;
|
|
10506
|
+
if (line.groupKey.workspaceUuid) {
|
|
10507
|
+
return resolver.label({ kind: "workspace", uuid: line.groupKey.workspaceUuid });
|
|
10508
|
+
}
|
|
10509
|
+
return "(all)";
|
|
10510
|
+
}
|
|
10511
|
+
function printAggregateLines(rows) {
|
|
10512
|
+
if (rows.length === 0) {
|
|
10513
|
+
console.log("\nNo activity in this window.");
|
|
10514
|
+
return;
|
|
10515
|
+
}
|
|
10516
|
+
const headers2 = ["BUCKET", "GROUP", "COUNT"];
|
|
10517
|
+
const widths = [
|
|
10518
|
+
Math.max(headers2[0].length, ...rows.map((row) => row.bucketLabel.length)),
|
|
10519
|
+
Math.max(headers2[1].length, ...rows.map((row) => row.group.length)),
|
|
10520
|
+
Math.max(headers2[2].length, ...rows.map((row) => String(row.count).length))
|
|
10521
|
+
];
|
|
10522
|
+
console.log("");
|
|
10523
|
+
console.log(
|
|
10524
|
+
`${headers2[0].padEnd(widths[0])} ${headers2[1].padEnd(widths[1])} ${headers2[2].padStart(widths[2])}`
|
|
10525
|
+
);
|
|
10526
|
+
console.log(widths.map((width) => "-".repeat(width)).join(" "));
|
|
10527
|
+
for (const row of rows) {
|
|
10528
|
+
console.log(
|
|
10529
|
+
`${row.bucketLabel.padEnd(widths[0])} ${row.group.padEnd(widths[1])} ${String(row.count).padStart(widths[2])}`
|
|
10530
|
+
);
|
|
10531
|
+
if (row.drillCommand) {
|
|
10532
|
+
console.log(dim(` \u21B3 ${row.drillCommand}`));
|
|
10533
|
+
}
|
|
10534
|
+
}
|
|
10535
|
+
}
|
|
10536
|
+
async function eventRows(response, resolver) {
|
|
10537
|
+
await resolver.prime(response.items.flatMap((item) => [item.subject, ...item.refs ?? []]));
|
|
10538
|
+
return Promise.all(
|
|
10539
|
+
response.items.map(async (item) => ({
|
|
10540
|
+
occurredAt: item.occurredAt,
|
|
10541
|
+
eventType: item.eventType ?? "Unknown activity",
|
|
10542
|
+
subject: await resolver.label(item.subject),
|
|
10543
|
+
actor: actorLabel(item.actor),
|
|
10544
|
+
workspace: item.workspaceUuid ? await resolver.label({ kind: "workspace", uuid: item.workspaceUuid }) : "",
|
|
10545
|
+
detail: detailSummary(item.detail),
|
|
10546
|
+
visibility: item.visibility
|
|
10547
|
+
}))
|
|
10548
|
+
);
|
|
10549
|
+
}
|
|
10550
|
+
var EVENT_COLUMNS2 = [
|
|
10551
|
+
{ header: "OCCURRED", getValue: (row) => row.occurredAt },
|
|
10552
|
+
{ header: "TYPE", getValue: (row) => row.eventType },
|
|
10553
|
+
{ header: "SUBJECT", getValue: (row) => row.subject, maxWidth: 42 },
|
|
10554
|
+
{ header: "ACTOR", getValue: (row) => row.actor },
|
|
10555
|
+
{ header: "WORKSPACE", getValue: (row) => row.workspace, maxWidth: 28 },
|
|
10556
|
+
{ header: "VISIBILITY", getValue: (row) => row.visibility },
|
|
10557
|
+
{ header: "DETAIL", getValue: (row) => row.detail, maxWidth: 48 }
|
|
10558
|
+
];
|
|
10559
|
+
async function openItemRows(items, resolver) {
|
|
10560
|
+
await resolver.prime(items.flatMap((item) => [item.ref, ...item.responsible ?? []]));
|
|
10561
|
+
return Promise.all(
|
|
10562
|
+
items.map(async (item) => ({
|
|
10563
|
+
rank: item.priorityRank === null || item.priorityRank === void 0 ? "" : String(item.priorityRank),
|
|
10564
|
+
kind: item.kind,
|
|
10565
|
+
reasons: item.reasons.join(","),
|
|
10566
|
+
ref: await resolver.label(item.ref),
|
|
10567
|
+
workspace: await resolver.label({ kind: "workspace", uuid: item.workspaceUuid }),
|
|
10568
|
+
responsible: (await labelAll(item.responsible ?? [], resolver)).join(", "),
|
|
10569
|
+
openedAt: item.openedAt,
|
|
10570
|
+
lastEventAt: item.lastEventAt
|
|
10571
|
+
}))
|
|
10572
|
+
);
|
|
10573
|
+
}
|
|
10574
|
+
async function labelAll(refs, resolver) {
|
|
10575
|
+
const resolutions = await resolver.resolveAll(refs);
|
|
10576
|
+
return resolutions.map((resolution) => resolution.label);
|
|
10577
|
+
}
|
|
10578
|
+
var OPEN_ITEM_COLUMNS = [
|
|
10579
|
+
{ header: "RANK", getValue: (row) => row.rank },
|
|
10580
|
+
{ header: "KIND", getValue: (row) => row.kind },
|
|
10581
|
+
{ header: "REASONS", getValue: (row) => row.reasons, maxWidth: 36 },
|
|
10582
|
+
{ header: "REF", getValue: (row) => row.ref, maxWidth: 42 },
|
|
10583
|
+
{ header: "WORKSPACE", getValue: (row) => row.workspace, maxWidth: 28 },
|
|
10584
|
+
{ header: "RESPONSIBLE", getValue: (row) => row.responsible, maxWidth: 36 },
|
|
10585
|
+
{ header: "OPENED", getValue: (row) => row.openedAt },
|
|
10586
|
+
{ header: "LAST EVENT", getValue: (row) => row.lastEventAt }
|
|
10587
|
+
];
|
|
10588
|
+
async function eventLabels(item, resolver) {
|
|
10589
|
+
return {
|
|
10590
|
+
subjectLabel: await resolver.label(item.subject),
|
|
10591
|
+
actorLabel: actorLabel(item.actor),
|
|
10592
|
+
refLabels: await labelAll(item.refs ?? [], resolver)
|
|
10593
|
+
};
|
|
10594
|
+
}
|
|
10595
|
+
async function openItemLabels(item, resolver) {
|
|
10596
|
+
return {
|
|
10597
|
+
refLabel: await resolver.label(item.ref),
|
|
10598
|
+
workspaceLabel: await resolver.label({ kind: "workspace", uuid: item.workspaceUuid }),
|
|
10599
|
+
responsibleLabels: await labelAll(item.responsible ?? [], resolver)
|
|
10600
|
+
};
|
|
10601
|
+
}
|
|
10602
|
+
|
|
10603
|
+
// src/domains/activity.ts
|
|
10604
|
+
function binaryName() {
|
|
10605
|
+
if (process.env.GRAVITY_RAIL_SANDBOX === "1") return "gr";
|
|
10606
|
+
const entry = process.argv[1] ?? "";
|
|
10607
|
+
return entry.includes("gr-cli") ? "yarn gr" : "gr";
|
|
10608
|
+
}
|
|
10609
|
+
function globalFlags(ctx) {
|
|
10610
|
+
const flags = ["--env", ctx.env];
|
|
10611
|
+
if (ctx.profile && ctx.profile !== "default") flags.push("--profile", ctx.profile);
|
|
10612
|
+
return flags;
|
|
10613
|
+
}
|
|
10614
|
+
function resolverFor(hctx) {
|
|
10615
|
+
return new ActivityRefResolver(requireAuth(hctx.ctx).apiClient, {
|
|
10616
|
+
bare: hctx.args.ids === true
|
|
10617
|
+
});
|
|
10618
|
+
}
|
|
10619
|
+
function isAggregate(response) {
|
|
10620
|
+
return "lines" in response;
|
|
10621
|
+
}
|
|
10622
|
+
var queryCommand = {
|
|
10623
|
+
path: ["activity", "query"],
|
|
10624
|
+
description: "Query the activity feed at any grain. Aggregate grains (month/day/hour) read the hourly rollup; grain=event reads the log. Each aggregate line prints the server-issued drill query that reproduces exactly its count \u2014 run it to go a level deeper.",
|
|
10625
|
+
requiresWorkspace: false,
|
|
10626
|
+
args: ACTIVITY_QUERY_ARGS,
|
|
10627
|
+
examples: [
|
|
10628
|
+
"gr activity query --last 7d",
|
|
10629
|
+
"gr activity query --group-by workspace --grain month --last 3mo",
|
|
10630
|
+
"gr activity query --workspace $WORKSPACE_UUID --grain event --types chat.started --last 24h",
|
|
10631
|
+
"gr activity query --org $ORG_UUID --grain day --last 30d -o json",
|
|
10632
|
+
"gr activity query --grain event --subject member:$MEMBER_UUID --last 90d --ids"
|
|
10633
|
+
],
|
|
10634
|
+
handler: async (hctx) => {
|
|
10635
|
+
const ctx = requireAuth(hctx.ctx);
|
|
10636
|
+
const mount = resolveActivityMount(hctx.args);
|
|
10637
|
+
const request = buildQueryRequest(hctx.args);
|
|
10638
|
+
const response = mount.kind === "account" ? await ctx.apiClient.queryActivity(request) : mount.kind === "org" ? await ctx.apiClient.queryOrgActivity(mount.uuid, request) : await ctx.apiClient.queryWorkspaceActivity(mount.uuid, request);
|
|
10639
|
+
const resolver = resolverFor(hctx);
|
|
10640
|
+
const binary = binaryName();
|
|
10641
|
+
const globals = globalFlags(ctx);
|
|
10642
|
+
if (isAggregate(response)) {
|
|
10643
|
+
const rows = await aggregateRows(response, mount, resolver, {
|
|
10644
|
+
binary,
|
|
10645
|
+
globals,
|
|
10646
|
+
ids: hctx.args.ids === true
|
|
10647
|
+
});
|
|
10648
|
+
if (hctx.ctx.outputFormat === "table") {
|
|
10649
|
+
console.log(envelopeLine(response.envelope, describeMount(mount)));
|
|
10650
|
+
printAggregateLines(rows);
|
|
10651
|
+
printPagingHint(hctx, mount, request, response.nextCursor, binary, globals);
|
|
10652
|
+
return;
|
|
10653
|
+
}
|
|
10654
|
+
outputSingle(
|
|
8986
10655
|
{
|
|
8987
|
-
|
|
8988
|
-
|
|
10656
|
+
...response,
|
|
10657
|
+
lines: response.lines.map((line, index) => ({
|
|
10658
|
+
...line,
|
|
10659
|
+
drillCommand: rows[index]?.drillCommand ?? null,
|
|
10660
|
+
groupLabel: rows[index]?.group ?? null
|
|
10661
|
+
}))
|
|
8989
10662
|
},
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
const api = requireAuth(hctx.ctx).apiClient;
|
|
8999
|
-
const taskId = requireNumber(hctx.args, "task");
|
|
9000
|
-
const abilityType = hctx.args.type ?? hctx.args["ability-type"] ?? hctx.args.slug;
|
|
9001
|
-
if (!abilityType) throw new CLIError("--type is required (an ability type slug)");
|
|
9002
|
-
let config = {};
|
|
9003
|
-
if (hctx.args.config) {
|
|
9004
|
-
try {
|
|
9005
|
-
config = JSON.parse(hctx.args.config);
|
|
9006
|
-
} catch {
|
|
9007
|
-
throw new CLIError("--config must be a valid JSON object");
|
|
9008
|
-
}
|
|
9009
|
-
}
|
|
9010
|
-
const task = await api.getTask(hctx.workspace, taskId);
|
|
9011
|
-
const existing = (task.abilities ?? []).map(toAbilityData);
|
|
9012
|
-
const next = {
|
|
9013
|
-
uuid: randomUUID(),
|
|
9014
|
-
abilityType,
|
|
9015
|
-
config,
|
|
9016
|
-
enabled: hctx.args.disabled !== true,
|
|
9017
|
-
...hctx.args.cel ? { celCondition: hctx.args.cel } : {}
|
|
9018
|
-
};
|
|
9019
|
-
const updated = await api.updateTask(hctx.workspace, taskId, {
|
|
9020
|
-
abilities: [...existing, next]
|
|
9021
|
-
});
|
|
9022
|
-
outputData(updated.abilities ?? [], hctx.ctx, ATTACHED_COLUMNS);
|
|
9023
|
-
}
|
|
9024
|
-
},
|
|
9025
|
-
{
|
|
9026
|
-
path: ["abilities", "detach"],
|
|
9027
|
-
description: "Detach an ability from a task by its uuid (from `gr abilities attached`). Re-saves the remaining task-specific abilities so the rest are preserved.",
|
|
9028
|
-
mutates: true,
|
|
9029
|
-
requiresWorkspace: true,
|
|
9030
|
-
args: [
|
|
9031
|
-
{ name: "task", description: "Task ID", required: true },
|
|
9032
|
-
{ name: "uuid", description: "UUID of the attached ability to remove", required: true }
|
|
9033
|
-
],
|
|
9034
|
-
handler: async (hctx) => {
|
|
9035
|
-
const api = requireAuth(hctx.ctx).apiClient;
|
|
9036
|
-
const taskId = requireNumber(hctx.args, "task");
|
|
9037
|
-
const uuid = hctx.args.uuid;
|
|
9038
|
-
if (!uuid) throw new CLIError("--uuid is required");
|
|
9039
|
-
const task = await api.getTask(hctx.workspace, taskId);
|
|
9040
|
-
const existing = task.abilities ?? [];
|
|
9041
|
-
const remaining = existing.filter((a) => a.uuid !== uuid).map(toAbilityData);
|
|
9042
|
-
if (remaining.length === existing.length) {
|
|
9043
|
-
throw new CLIError(`No attached ability with uuid '${uuid}' on task ${taskId}`);
|
|
9044
|
-
}
|
|
9045
|
-
const updated = await api.updateTask(hctx.workspace, taskId, {
|
|
9046
|
-
abilities: remaining
|
|
9047
|
-
});
|
|
9048
|
-
outputData(updated.abilities ?? [], hctx.ctx, ATTACHED_COLUMNS);
|
|
10663
|
+
hctx.ctx
|
|
10664
|
+
);
|
|
10665
|
+
return;
|
|
10666
|
+
}
|
|
10667
|
+
if (hctx.ctx.outputFormat === "table") {
|
|
10668
|
+
console.log(envelopeLine(response.envelope, describeMount(mount)));
|
|
10669
|
+
if (response.totalMatched !== null && response.totalMatched !== void 0) {
|
|
10670
|
+
console.log(`showing ${response.items.length} of ${response.totalMatched} matched`);
|
|
9049
10671
|
}
|
|
10672
|
+
outputData(await eventRows(response, resolver), hctx.ctx, EVENT_COLUMNS2);
|
|
10673
|
+
printPagingHint(hctx, mount, request, response.nextCursor, binary, globals);
|
|
10674
|
+
return;
|
|
10675
|
+
}
|
|
10676
|
+
const bare = hctx.args.ids === true;
|
|
10677
|
+
const items = await Promise.all(
|
|
10678
|
+
response.items.map(
|
|
10679
|
+
async (item) => bare ? item : { ...item, ...await eventLabels(item, resolver) }
|
|
10680
|
+
)
|
|
10681
|
+
);
|
|
10682
|
+
outputSingle({ ...response, items }, hctx.ctx);
|
|
10683
|
+
}
|
|
10684
|
+
};
|
|
10685
|
+
function printPagingHint(hctx, mount, request, nextCursor, binary, globals) {
|
|
10686
|
+
if (!nextCursor) return;
|
|
10687
|
+
const next = renderQueryCommand(
|
|
10688
|
+
mount,
|
|
10689
|
+
{ ...request, cursor: nextCursor },
|
|
10690
|
+
{ binary, globals, ids: hctx.args.ids === true }
|
|
10691
|
+
);
|
|
10692
|
+
hint(hctx.ctx, [`next page:`, ` ${next}`]);
|
|
10693
|
+
}
|
|
10694
|
+
var openItemsCommand = {
|
|
10695
|
+
path: ["activity", "open-items"],
|
|
10696
|
+
description: "The priority lane \u2014 what needs a human now, ordered by read-time policy. Deliberately not paged: narrow with --kinds, --scope-workspace or the responsibility filters rather than walking pages.",
|
|
10697
|
+
requiresWorkspace: false,
|
|
10698
|
+
args: ACTIVITY_OPEN_ITEMS_ARGS,
|
|
10699
|
+
examples: [
|
|
10700
|
+
"gr activity open-items",
|
|
10701
|
+
"gr activity open-items --assigned-to-me --order recency",
|
|
10702
|
+
"gr activity open-items --workspace $WORKSPACE_UUID --kinds awaiting_human,missed_call",
|
|
10703
|
+
"gr activity open-items --org $ORG_UUID --point-person -o json"
|
|
10704
|
+
],
|
|
10705
|
+
handler: async (hctx) => {
|
|
10706
|
+
const ctx = requireAuth(hctx.ctx);
|
|
10707
|
+
const mount = resolveActivityMount(hctx.args);
|
|
10708
|
+
const request = buildOpenItemsRequest(hctx.args);
|
|
10709
|
+
const response = mount.kind === "account" ? await ctx.apiClient.queryActivityOpenItems(request) : mount.kind === "org" ? await ctx.apiClient.queryOrgActivityOpenItems(mount.uuid, request) : await ctx.apiClient.queryWorkspaceActivityOpenItems(mount.uuid, request);
|
|
10710
|
+
const resolver = resolverFor(hctx);
|
|
10711
|
+
if (hctx.ctx.outputFormat === "table") {
|
|
10712
|
+
console.log(envelopeLine(response.envelope, describeMount(mount)));
|
|
10713
|
+
const total = response.truncated ? `${response.totalOpen}+` : `${response.totalOpen}`;
|
|
10714
|
+
console.log(`showing ${response.items.length} of ${total} open`);
|
|
10715
|
+
outputData(await openItemRows(response.items, resolver), hctx.ctx, OPEN_ITEM_COLUMNS);
|
|
10716
|
+
return;
|
|
10717
|
+
}
|
|
10718
|
+
const bare = hctx.args.ids === true;
|
|
10719
|
+
const items = await Promise.all(
|
|
10720
|
+
response.items.map(
|
|
10721
|
+
async (item) => bare ? item : { ...item, ...await openItemLabels(item, resolver) }
|
|
10722
|
+
)
|
|
10723
|
+
);
|
|
10724
|
+
outputSingle({ ...response, items }, hctx.ctx);
|
|
10725
|
+
}
|
|
10726
|
+
};
|
|
10727
|
+
var countsCommand = {
|
|
10728
|
+
path: ["activity", "counts"],
|
|
10729
|
+
description: "Badge numbers: how many open items, and how much happened in the window, by type.",
|
|
10730
|
+
requiresWorkspace: false,
|
|
10731
|
+
args: ACTIVITY_COUNTS_ARGS,
|
|
10732
|
+
examples: [
|
|
10733
|
+
"gr activity counts --last 24h",
|
|
10734
|
+
"gr activity counts --workspace $WORKSPACE_UUID --last 7d",
|
|
10735
|
+
"gr activity counts --org $ORG_UUID --from 2026-08-01 --to 2026-09-01 -o json"
|
|
10736
|
+
],
|
|
10737
|
+
handler: async (hctx) => {
|
|
10738
|
+
const ctx = requireAuth(hctx.ctx);
|
|
10739
|
+
const mount = resolveActivityMount(hctx.args);
|
|
10740
|
+
const request = buildCountsRequest(hctx.args);
|
|
10741
|
+
const response = mount.kind === "account" ? await ctx.apiClient.getActivityCounts(request) : mount.kind === "org" ? await ctx.apiClient.getOrgActivityCounts(mount.uuid, request) : await ctx.apiClient.getWorkspaceActivityCounts(mount.uuid, request);
|
|
10742
|
+
if (hctx.ctx.outputFormat !== "table") {
|
|
10743
|
+
outputSingle(response, hctx.ctx);
|
|
10744
|
+
return;
|
|
10745
|
+
}
|
|
10746
|
+
console.log(envelopeLine(response.envelope, describeMount(mount)));
|
|
10747
|
+
console.log(`open items: ${response.openItems}`);
|
|
10748
|
+
console.log(`events in window: ${response.totalEvents}`);
|
|
10749
|
+
outputData(response.byEventType ?? [], hctx.ctx, [
|
|
10750
|
+
{ header: "EVENT TYPE", getValue: (row) => row.eventType },
|
|
10751
|
+
{ header: "COUNT", getValue: (row) => String(row.count) }
|
|
10752
|
+
]);
|
|
10753
|
+
}
|
|
10754
|
+
};
|
|
10755
|
+
var capabilitiesCommand = {
|
|
10756
|
+
path: ["activity", "capabilities"],
|
|
10757
|
+
description: "What this caller may see: capability classes, how many workspaces the grant set admits, org:read coverage, and whether a private lane exists. Account mount only.",
|
|
10758
|
+
requiresWorkspace: false,
|
|
10759
|
+
// The mount flags are declared so that naming one gets the explanation
|
|
10760
|
+
// below rather than a generic "unknown flag".
|
|
10761
|
+
args: ACTIVITY_MOUNT_ARGS,
|
|
10762
|
+
examples: ["gr activity capabilities", "gr activity capabilities --env prod -o json"],
|
|
10763
|
+
handler: async (hctx) => {
|
|
10764
|
+
const mount = resolveActivityMount(hctx.args);
|
|
10765
|
+
if (mount.kind !== "account") {
|
|
10766
|
+
throw new CLIError(
|
|
10767
|
+
"activity capabilities is served by the account mount only \u2014 drop --org/--workspace. Org and workspace membership is answered by `gr org` and `gr workspaces`."
|
|
10768
|
+
);
|
|
9050
10769
|
}
|
|
10770
|
+
const response = await requireAuth(hctx.ctx).apiClient.getActivityCapabilities();
|
|
10771
|
+
outputSingle(response, hctx.ctx, [
|
|
10772
|
+
{
|
|
10773
|
+
header: "CAPABILITIES",
|
|
10774
|
+
getValue: (row) => row.capabilities.join(","),
|
|
10775
|
+
maxWidth: 80
|
|
10776
|
+
},
|
|
10777
|
+
{ header: "WORKSPACES", getValue: (row) => String(row.workspaceCount) },
|
|
10778
|
+
{ header: "ORG:READ", getValue: (row) => String(row.orgReadCount) },
|
|
10779
|
+
{ header: "PRIVATE LANE", getValue: (row) => String(row.hasPrivateLane) }
|
|
10780
|
+
]);
|
|
10781
|
+
}
|
|
10782
|
+
};
|
|
10783
|
+
var eventTypesCommand = {
|
|
10784
|
+
path: ["activity", "event-types"],
|
|
10785
|
+
description: "The closed event-type vocabulary this build knows, for --types. Local; calls no API.",
|
|
10786
|
+
requiresWorkspace: false,
|
|
10787
|
+
requiresAuth: false,
|
|
10788
|
+
args: [],
|
|
10789
|
+
examples: ["gr activity event-types"],
|
|
10790
|
+
handler: async (hctx) => {
|
|
10791
|
+
outputData(
|
|
10792
|
+
activityEventTypes().map((eventType) => ({ eventType })),
|
|
10793
|
+
hctx.ctx,
|
|
10794
|
+
[{ header: "EVENT TYPE", getValue: (row) => row.eventType }]
|
|
10795
|
+
);
|
|
10796
|
+
}
|
|
10797
|
+
};
|
|
10798
|
+
var activityDomain = {
|
|
10799
|
+
name: "activity",
|
|
10800
|
+
description: "Activity feed: what has been happening, and what needs a human now",
|
|
10801
|
+
commands: [
|
|
10802
|
+
queryCommand,
|
|
10803
|
+
openItemsCommand,
|
|
10804
|
+
countsCommand,
|
|
10805
|
+
capabilitiesCommand,
|
|
10806
|
+
eventTypesCommand
|
|
9051
10807
|
]
|
|
9052
10808
|
};
|
|
9053
10809
|
|
|
@@ -11174,7 +12930,7 @@ var commands2 = [
|
|
|
11174
12930
|
},
|
|
11175
12931
|
{
|
|
11176
12932
|
path: ["org", "business-profile", "get"],
|
|
11177
|
-
description: "Read a legal entity's business profile
|
|
12933
|
+
description: "Read a legal entity's business profile: a live Twilio fetch with any locally saved draft overlaid on top. draftPending=YES means the fields shown include saved edits that no submit has pushed \u2014 on this path a real Twilio fetch is compared, so it is only set when the draft differs from what the carrier holds. SUBMITTABLE is derived from evaluationStatus, not status.",
|
|
11178
12934
|
requiresWorkspace: false,
|
|
11179
12935
|
args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
|
|
11180
12936
|
examples: ["yarn gr org business-profile get --org-uuid $ORG_UUID"],
|
|
@@ -11192,6 +12948,7 @@ var commands2 = [
|
|
|
11192
12948
|
legalName: profile.businessInfo?.legalName ?? "(missing)",
|
|
11193
12949
|
authorizedReps: (profile.authorizedReps ?? []).length,
|
|
11194
12950
|
hasAddress: profile.address ? "yes" : "no",
|
|
12951
|
+
draftPending: profile.draftPending ? "YES" : "no",
|
|
11195
12952
|
failureReasons: (profile.failureReasons ?? []).join("; ") || "(none)",
|
|
11196
12953
|
profileRecoveryFailed: profile.profileRecoveryFailed ? "YES" : "no"
|
|
11197
12954
|
},
|
|
@@ -11201,7 +12958,7 @@ var commands2 = [
|
|
|
11201
12958
|
},
|
|
11202
12959
|
{
|
|
11203
12960
|
path: ["org", "business-profile", "update"],
|
|
11204
|
-
description: "
|
|
12961
|
+
description: "Save the business profile locally. Makes NO provider call, so nothing reaches the carrier until `submit` \u2014 a representative removed here stays attached at Twilio until then. The evaluation returned is the last known one, not a fresh check.",
|
|
11205
12962
|
mutates: true,
|
|
11206
12963
|
requiresWorkspace: false,
|
|
11207
12964
|
args: [ORG_UUID_ARG, LEGAL_ENTITY_UUID_ARG],
|
|
@@ -11265,7 +13022,7 @@ var commands2 = [
|
|
|
11265
13022
|
},
|
|
11266
13023
|
{
|
|
11267
13024
|
path: ["org", "trust-products", "sync"],
|
|
11268
|
-
description: "Reconcile voice trust products against Twilio: claim products staged outside the app and refresh non-terminal statuses.
|
|
13025
|
+
description: "Reconcile voice trust products against Twilio: claim products staged outside the app and refresh non-terminal statuses. Strongly advised before `admin phone-numbers migrate`, whose preflight attaches only the bundles approved in the cached state \u2014 an unreconciled product is simply left off the number, and needs a later `--reattach-trust` trip. 409 if another Trust Hub operation holds this legal entity lock \u2014 it fails fast and sends no Retry-After, because holders range from milliseconds to minutes. Back off on your own schedule and re-read before retrying.",
|
|
11269
13026
|
// Writes trust_hub_state and calls Twilio. Read-only in business terms
|
|
11270
13027
|
// (it discovers, it does not create or submit), but it mutates our cache,
|
|
11271
13028
|
// so it takes --allow-write like every other state-changing verb.
|
|
@@ -12117,7 +13874,7 @@ async function findOutboundPhoneUsers(client, workspace, phone) {
|
|
|
12117
13874
|
}
|
|
12118
13875
|
|
|
12119
13876
|
// ../../node_modules/libphonenumber-js/metadata.min.json.js
|
|
12120
|
-
var metadata_min_json_default = { "version": 4, "country_calling_codes": { "1": ["US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", "TC", "TT", "VC", "VG", "VI"], "7": ["RU", "KZ"], "20": ["EG"], "27": ["ZA"], "30": ["GR"], "31": ["NL"], "32": ["BE"], "33": ["FR"], "34": ["ES"], "36": ["HU"], "39": ["IT", "VA"], "40": ["RO"], "41": ["CH"], "43": ["AT"], "44": ["GB", "GG", "IM", "JE"], "45": ["DK"], "46": ["SE"], "47": ["NO", "SJ"], "48": ["PL"], "49": ["DE"], "51": ["PE"], "52": ["MX"], "53": ["CU"], "54": ["AR"], "55": ["BR"], "56": ["CL"], "57": ["CO"], "58": ["VE"], "60": ["MY"], "61": ["AU", "CC", "CX"], "62": ["ID"], "63": ["PH"], "64": ["NZ"], "65": ["SG"], "66": ["TH"], "81": ["JP"], "82": ["KR"], "84": ["VN"], "86": ["CN"], "90": ["TR"], "91": ["IN"], "92": ["PK"], "93": ["AF"], "94": ["LK"], "95": ["MM"], "98": ["IR"], "211": ["SS"], "212": ["MA", "EH"], "213": ["DZ"], "216": ["TN"], "218": ["LY"], "220": ["GM"], "221": ["SN"], "222": ["MR"], "223": ["ML"], "224": ["GN"], "225": ["CI"], "226": ["BF"], "227": ["NE"], "228": ["TG"], "229": ["BJ"], "230": ["MU"], "231": ["LR"], "232": ["SL"], "233": ["GH"], "234": ["NG"], "235": ["TD"], "236": ["CF"], "237": ["CM"], "238": ["CV"], "239": ["ST"], "240": ["GQ"], "241": ["GA"], "242": ["CG"], "243": ["CD"], "244": ["AO"], "245": ["GW"], "246": ["IO"], "247": ["AC"], "248": ["SC"], "249": ["SD"], "250": ["RW"], "251": ["ET"], "252": ["SO"], "253": ["DJ"], "254": ["KE"], "255": ["TZ"], "256": ["UG"], "257": ["BI"], "258": ["MZ"], "260": ["ZM"], "261": ["MG"], "262": ["RE", "YT"], "263": ["ZW"], "264": ["NA"], "265": ["MW"], "266": ["LS"], "267": ["BW"], "268": ["SZ"], "269": ["KM"], "290": ["SH", "TA"], "291": ["ER"], "297": ["AW"], "298": ["FO"], "299": ["GL"], "350": ["GI"], "351": ["PT"], "352": ["LU"], "353": ["IE"], "354": ["IS"], "355": ["AL"], "356": ["MT"], "357": ["CY"], "358": ["FI", "AX"], "359": ["BG"], "370": ["LT"], "371": ["LV"], "372": ["EE"], "373": ["MD"], "374": ["AM"], "375": ["BY"], "376": ["AD"], "377": ["MC"], "378": ["SM"], "380": ["UA"], "381": ["RS"], "382": ["ME"], "383": ["XK"], "385": ["HR"], "386": ["SI"], "387": ["BA"], "389": ["MK"], "420": ["CZ"], "421": ["SK"], "423": ["LI"], "500": ["FK"], "501": ["BZ"], "502": ["GT"], "503": ["SV"], "504": ["HN"], "505": ["NI"], "506": ["CR"], "507": ["PA"], "508": ["PM"], "509": ["HT"], "590": ["GP", "BL", "MF"], "591": ["BO"], "592": ["GY"], "593": ["EC"], "594": ["GF"], "595": ["PY"], "596": ["MQ"], "597": ["SR"], "598": ["UY"], "599": ["CW", "BQ"], "670": ["TL"], "672": ["NF"], "673": ["BN"], "674": ["NR"], "675": ["PG"], "676": ["TO"], "677": ["SB"], "678": ["VU"], "679": ["FJ"], "680": ["PW"], "681": ["WF"], "682": ["CK"], "683": ["NU"], "685": ["WS"], "686": ["KI"], "687": ["NC"], "688": ["TV"], "689": ["PF"], "690": ["TK"], "691": ["FM"], "692": ["MH"], "850": ["KP"], "852": ["HK"], "853": ["MO"], "855": ["KH"], "856": ["LA"], "880": ["BD"], "886": ["TW"], "960": ["MV"], "961": ["LB"], "962": ["JO"], "963": ["SY"], "964": ["IQ"], "965": ["KW"], "966": ["SA"], "967": ["YE"], "968": ["OM"], "970": ["PS"], "971": ["AE"], "972": ["IL"], "973": ["BH"], "974": ["QA"], "975": ["BT"], "976": ["MN"], "977": ["NP"], "992": ["TJ"], "993": ["TM"], "994": ["AZ"], "995": ["GE"], "996": ["KG"], "998": ["UZ"] }, "countries": { "AC": ["247", "00", "(?:[01589]\\d|[2-467])\\d{4}", [5, 6]], "AD": ["376", "00", "(?:1|6\\d)\\d{7}|[135-9]\\d{5}", [6, 8, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["[135-9]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["1"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]]], "AE": ["971", "00", "(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{2,9})", "$1 $2", ["60|8"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[236]|[479][2-8]"], "0$1"], ["(\\d{3})(\\d)(\\d{5})", "$1 $2 $3", ["[479]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"]], "0"], "AF": ["93", "00", "[2-7]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"]], "0"], "AG": ["1", "011", "(?:268|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([457]\\d{6})$|1", "268$1", 0, "268"], "AI": ["1", "011", "(?:264|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2457]\\d{6})$|1", "264$1", 0, "264"], "AL": ["355", "00", "(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}", [6, 7, 8, 9], [["(\\d{3})(\\d{3,4})", "$1 $2", ["80|9"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["4[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2358][2-5]|4"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["[23578]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["6"], "0$1"]], "0"], "AM": ["374", "00", "(?:[1-489]\\d|55|60|77)\\d{6}", [8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[89]0"], "0 $1"], ["(\\d{3})(\\d{5})", "$1 $2", ["2|3[12]"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["1|47"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[3-9]"], "0$1"]], "0"], "AO": ["244", "00", "[29]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[29]"]]]], "AR": ["54", "00", "(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}", [10, 11], [["(\\d{4})(\\d{2})(\\d{4})", "$1 $2-$3", ["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])", "2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["1"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2-$3", ["[23]"], "0$1", 1], ["(\\d)(\\d{4})(\\d{2})(\\d{4})", "$2 15-$3-$4", ["9(?:2[2-469]|3[3-578])", "9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))", "9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 15-$3-$4", ["91"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d{3})(\\d{3})(\\d{5})", "$1-$2-$3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 15-$3-$4", ["9"], "0$1", 0, "$1 $2 $3-$4"]], "0", 0, "0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?", "9$1"], "AS": ["1", "011", "(?:[58]\\d\\d|684|900)\\d{7}", [10], 0, "1", 0, "([267]\\d{6})$|1", "684$1", 0, "684"], "AT": ["43", "00", "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3,12})", "$1 $2", ["1(?:11|[2-9])"], "0$1"], ["(\\d{3})(\\d{2})", "$1 $2", ["517"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["5[079]"], "0$1"], ["(\\d{3})(\\d{3,10})", "$1 $2", ["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]", "(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"], "0$1"], ["(\\d{4})(\\d{3,9})", "$1 $2", ["[2-467]|5[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,7})", "$1 $2 $3", ["5"], "0$1"]], "0"], "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "(183[12])|0", 0, 0, 0, [["(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}", [9]], ["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "AW": ["297", "00", "(?:[25-79]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[25-9]"]]]], "AX": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}", [5, 6, 7, 8, 9, 10, 11, 12], 0, "0", 0, 0, 0, 0, "18", 0, "00"], "AZ": ["994", "00", "365\\d{6}|(?:[124579]\\d|60|88)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[28]|2|365|46", "1[28]|2|365[45]|46", "1[28]|2|365(?:4|5[02])|46"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[13-9]"], "0$1"]], "0"], "BA": ["387", "00", "6\\d{8}|(?:[35689]\\d|49|70)\\d{6}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[1-3]|[7-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2-$3", ["[3-5]|6[56]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["6"], "0$1"]], "0"], "BB": ["1", "011", "(?:246|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "246$1", 0, "246"], "BD": ["880", "00", "[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{4,6})", "$1-$2", ["31[5-8]|[459]1"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1-$2", ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"], "0$1"], ["(\\d{4})(\\d{3,6})", "$1-$2", ["[13-9]|2[23]"], "0$1"], ["(\\d)(\\d{7,8})", "$1-$2", ["2"], "0$1"]], "0"], "BE": ["32", "00", "4\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:80|9)0"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[239]|4[23]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[15-8]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4"], "0$1"]], "0"], "BF": ["226", "00", "[024-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[024-7]"]]]], "BG": ["359", "00", "00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}", [6, 7, 8, 9, 12], [["(\\d)(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["43[1-6]|70[1-9]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:70|8)0"], "0$1"], ["(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3", ["43[1-7]|7"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[48]|9[08]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"]], "0"], "BH": ["973", "00", "[136-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[13679]|8[02-4679]"]]]], "BI": ["257", "00", "(?:[267]\\d|31)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2367]"]]]], "BJ": ["229", "00", "(?:01\\d|8)\\d{7}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["0"]]]], "BL": ["590", "00", "7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"], ["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"], ["80[0-5]\\d{6}"], ["8[129]\\d{7}"], 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]], "BM": ["1", "011", "(?:441|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "441$1", 0, "441"], "BN": ["673", "00", "[2-578]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-578]"]]]], "BO": ["591", "00(?:1\\d)?", "(?:[2-7]\\d\\d|8001)\\d{5}", [8, 9], [["(\\d)(\\d{7})", "$1 $2", ["[23]|4[46]|50"]], ["(\\d{8})", "$1", ["[5-7]"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["8"]]], "0", 0, "0(1\\d)?"], "BQ": ["599", "00", "(?:[34]1|7\\d)\\d{5}", [7], 0, 0, 0, 0, 0, 0, "[347]"], "BR": ["55", "00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)", "[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}", [8, 9, 10, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["300|4(?:0[02]|37|86)", "300|4(?:0(?:0|20)|370|864)"]], ["(\\d{3})(\\d{2,3})(\\d{4})", "$1 $2 $3", ["(?:[358]|90)0"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"], "($1)"], ["(\\d{2})(\\d{5})(\\d{4})", "$1 $2-$3", ["[16][1-9]|[2-57-9]"], "($1)"]], "0", 0, "(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?", "$2"], "BS": ["1", "011", "(?:242|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([3-8]\\d{6})$|1", "242$1", 0, "242"], "BT": ["975", "00", "[178]\\d{7}|[2-8]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-6]|7[246]|8[2-4]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[67]|[78]"]]]], "BW": ["267", "00", "(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["90"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[24-6]|3[15-9]"]], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37]"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["8"]]]], "BY": ["375", "810", "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3})", "$1 $2", ["800"], "8 $1"], ["(\\d{3})(\\d{2})(\\d{2,4})", "$1 $2 $3", ["800"], "8 $1"], ["(\\d{4})(\\d{2})(\\d{3})", "$1 $2-$3", ["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])", "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"], "8 0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["1(?:[56]|7[467])|2[1-3]"], "8 0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-4]"], "8 0$1"], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[89]"], "8 $1"]], "8", 0, "0|80?", 0, 0, 0, 0, "8~10"], "BZ": ["501", "00", "(?:0800\\d|[2-8])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-8]"]], ["(\\d)(\\d{3})(\\d{4})(\\d{3})", "$1-$2-$3-$4", ["0"]]]], "CA": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [7, 10], 0, "1", 0, 0, 0, 0, 0, [["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}", [10]], ["", [10]], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]], ["900[2-9]\\d{6}", [10]], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}", [10]], 0, ["310\\d{4}", [7]], 0, ["600[2-9]\\d{6}", [10]]]], "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CD": ["243", "00", "(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[1-6]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["5"], "0$1"]], "0"], "CF": ["236", "00", "8776\\d{4}|(?:[27]\\d|61)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[26-8]"]]]], "CG": ["242", "00", "222\\d{6}|(?:0\\d|80)\\d{7}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[02]"]]]], "CH": ["41", "00", "8\\d{11}|[2-9]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8[047]|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]|81"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["8"], "0$1"]], "0"], "CI": ["225", "00", "[02]\\d{9}", [10], [["(\\d{2})(\\d{2})(\\d)(\\d{5})", "$1 $2 $3 $4", ["2"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3 $4", ["0"]]]], "CK": ["682", "00", "[2-578]\\d{4}", [5], [["(\\d{2})(\\d{3})", "$1 $2", ["[2-578]"]]]], "CL": ["56", "(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0", "12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}", [9, 10, 11], [["(\\d{5})(\\d{4})", "$1 $2", ["219", "2196"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["60|809"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["44"]], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2[1-36]"], "($1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["9(?:10|[2-9])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["60|8"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{3})(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["60"]]]], "CM": ["237", "00", "[26]\\d{8}|88\\d{6,7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["88"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[26]|88"]]]], "CN": ["86", "00|1(?:[12]\\d|79)\\d\\d00", "(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5,6})", "$1 $2", ["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]", "(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"], "0$1"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]", "(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]", "85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])", "85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["(?:4|80)0"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|2(?:[02-57-9]|1[1-9])", "10|2(?:[02-57-9]|1[1-9])", "10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"], "0$1", 1], ["(\\d{3})(\\d{7,8})", "$1 $2", ["9"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["80"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[3-578]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["1[3-9]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["[12]"], "0$1", 1]], "0", 0, "(1(?:[12]\\d|79)\\d\\d)|0", 0, 0, 0, 0, "00"], "CO": ["57", "00(?:4(?:[14]4|56)|[579])", "(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["46"]], ["(\\d{3})(\\d{7})", "$1 $2", ["6|90"], "($1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3[0-357]|9[14]"]], ["(\\d)(\\d{3})(\\d{7})", "$1-$2-$3", ["1"], "0$1", 0, "$1 $2 $3"]], "0", 0, "0([3579]|4(?:[14]4|56))?"], "CR": ["506", "00", "(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}", [8, 10], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[3-9]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[89]"]]], 0, 0, "(19(?:0[0-2468]|1[09]|20|66|77|99))"], "CU": ["53", "119", "(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}", [6, 7, 8, 10], [["(\\d{2})(\\d{4,6})", "$1 $2", ["2[1-4]|[34]"], "(0$1)"], ["(\\d)(\\d{6,7})", "$1 $2", ["7"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["[56]"], "0$1"], ["(\\d{3})(\\d{7})", "$1 $2", ["8"], "0$1"]], "0"], "CV": ["238", "0", "(?:[2-59]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-589]"]]]], "CW": ["599", "00", "(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[3467]"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["9[4-8]"]]], 0, 0, 0, 0, 0, "[69]"], "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CY": ["357", "00", "(?:[279]\\d|[58]0)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[257-9]"]]]], "CZ": ["420", "00", "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}", [9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]]], "DE": ["49", "00", "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [["(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"], ["(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"], ["(\\d{4})(\\d{2,11})", "$1 $2", ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"], ["(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"], ["(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"], ["(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"], ["(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"], ["(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"], ["(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"], ["(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"], ["(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]], "0"], "DJ": ["253", "00", "(?:2\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[27]"]]]], "DK": ["45", "00", "[2-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-9]"]]]], "DM": ["1", "011", "(?:[58]\\d\\d|767|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "767$1", 0, "767"], "DO": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "8001|8[024]9"], "DZ": ["213", "00", "(?:[1-4]|[5-79]\\d|80)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["9"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-8]"], "0$1"]], "0"], "EC": ["593", "00", "1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}", [8, 9, 10, 11], [["(\\d)(\\d{3})(\\d{4})", "$1 $2-$3", ["[2-7]"], "(0$1)", 0, "$1-$2-$3"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1"]]], "0"], "EE": ["372", "00", "8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88", "[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]], ["(\\d{4})(\\d{3,4})", "$1 $2", ["[45]|8(?:00|[1-49])", "[45]|8(?:00[1-9]|[1-49])"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], "EG": ["20", "00", "[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}", [8, 9, 10], [["(\\d)(\\d{7,8})", "$1 $2", ["[23]"], "0$1"], ["(\\d{2})(\\d{6,7})", "$1 $2", ["1[35]|[4-6]|8[2468]|9[235-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{8})", "$1 $2", ["1"], "0$1"]], "0"], "EH": ["212", "00", "[5-8]\\d{8}", [9], 0, "0", 0, 0, 0, 0, 0, [["528[89]\\d{5}"], ["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|3[01]|5[0-5]))\\d{6}"], ["80[0-7]\\d{6}"], ["89\\d{7}"], 0, 0, 0, 0, ["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]], "ER": ["291", "00", "[178]\\d{6}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[178]"], "0$1"]], "0"], "ES": ["34", "00", "(?:400|[5-9]\\d\\d)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]00"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[4-9]"]]]], "ET": ["251", "00", "(?:11|[2-57-9]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-57-9]"], "0$1"]], "0"], "FI": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{5})", "$1", ["20[2-59]"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1 $2", ["(?:[1-3]0|[68])0|70[07-9]"], "0$1"], ["(\\d{2})(\\d{4,8})", "$1 $2", ["[14]|2[09]|50|7[135]"], "0$1"], ["(\\d{2})(\\d{6,10})", "$1 $2", ["7"], "0$1"], ["(\\d)(\\d{4,9})", "$1 $2", ["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"], "0$1"]], "0", 0, 0, 0, 0, "1[03-79]|[2-9]", 0, "00"], "FJ": ["679", "0(?:0|52)", "45\\d{5}|(?:0800\\d|[235-9])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|45"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "FK": ["500", "00", "[2-7]\\d{4}", [5]], "FM": ["691", "00", "(?:[39]\\d\\d|820)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[389]"]]]], "FO": ["298", "00", "[2-9]\\d{5}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-9]"]]], 0, 0, "(10(?:01|[12]0|88))"], "FR": ["33", "00", "[1-9]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0 $1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[1-79]"], "0$1"]], "0"], "GA": ["241", "00", "(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}", [7, 8], [["(\\d)(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-7]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["11|[67]"], "0$1"]], 0, 0, "0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})", "$1"], "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, "0|180020", 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"], "GD": ["1", "011", "(?:473|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "473$1", 0, "473"], "GE": ["995", "00", "(?:[3-57]\\d\\d|800)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["32"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[57]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[348]"], "0$1"]], "0"], "GF": ["594", "00", "(?:694\\d|7093)\\d{5}|(?:59|[89]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]|80[6-9]|9[47]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[89]"], "0$1"]], "0"], "GG": ["44", "00", "(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?", [7, 9, 10], 0, "0", 0, "([25-9]\\d{5})$|0|180020", "1481$1", 0, 0, [["1481[25-9]\\d{5}", [10]], ["7(?:(?:781|839)\\d|911[17])\\d{5}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]]], "GH": ["233", "00", "[235]\\d{8}|800\\d{5,6}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2358]"], "0$1"]], "0"], "GI": ["350", "00", "(?:[25]\\d|60)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["2"]]]], "GL": ["299", "00", "(?:19|[2-689]\\d|70)\\d{4}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["19|[2-9]"]]]], "GM": ["220", "00", "[48]\\d{8}|[2-9]\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|4(?:[0-35]|4[16-9])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[48]"]]]], "GN": ["224", "00", "722\\d{6}|(?:3|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["3"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[67]"]]]], "GP": ["590", "00", "7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-79]|80[6-9]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}"], ["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"], ["80[0-5]\\d{6}"], ["8[129]\\d{7}"], 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]], "GQ": ["240", "00", "222\\d{6}|(?:3\\d|55|[89]0)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235]"]], ["(\\d{3})(\\d{6})", "$1 $2", ["[89]"]]]], "GR": ["30", "00", "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}", [10, 11, 12], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["21|7"]], ["(\\d{4})(\\d{6})", "$1 $2", ["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2689]"]], ["(\\d{3})(\\d{3,4})(\\d{5})", "$1 $2 $3", ["8"]]]], "GT": ["502", "00", "80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-8]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], "GU": ["1", "011", "(?:[58]\\d\\d|671|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "671$1", 0, "671"], "GW": ["245", "00", "[49]\\d{8}|4\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["40"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"]]]], "GY": ["592", "001", "(?:[2-8]\\d{3}|9008)\\d{3}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "HK": ["852", "00(?:30|5[09]|[126-9]?)", "8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}", [5, 6, 7, 8, 9, 11], [["(\\d{3})(\\d{2,5})", "$1 $2", ["900", "9003"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{3})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "HN": ["504", "00", "8\\d{10}|[237-9]\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["[237-9]"]]]], "HR": ["385", "00", "[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}", [7, 8, 9], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["6[01]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{4})(\\d{3})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6|7[245]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-57]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"]], "0"], "HT": ["509", "00", "[2-589]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[2-589]"]]]], "HU": ["36", "00", "[235-7]\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "06 $1"]], "06"], "ID": ["62", "00[89]", "00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}", [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["15"]], ["(\\d{2})(\\d{5,9})", "$1 $2", ["2[124]|[36]1"], "(0$1)"], ["(\\d{3})(\\d{5,7})", "$1 $2", ["800"], "0$1"], ["(\\d{3})(\\d{5,8})", "$1 $2", ["[2-79]"], "(0$1)"], ["(\\d{3})(\\d{3,4})(\\d{3})", "$1-$2-$3", ["8[1-35-9]"], "0$1"], ["(\\d{3})(\\d{6,8})", "$1 $2", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["804"], "0$1"], ["(\\d{3})(\\d)(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["80"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1-$2-$3", ["8"], "0$1"]], "0"], "IE": ["353", "00", "(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["2[24-9]|47|58|6[237-9]|9[35-9]"], "(0$1)"], ["(\\d{3})(\\d{5})", "$1 $2", ["[45]0"], "(0$1)"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2569]|4[1-69]|7[14]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["81"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["4"], "(0$1)"], ["(\\d{2})(\\d)(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "IL": ["972", "0(?:0|1(?:05|[2-9]))", "1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}", [7, 8, 9, 10, 11, 12], [["(\\d{4})(\\d{3})", "$1-$2", ["125"]], ["(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3", ["121"]], ["(\\d)(\\d{3})(\\d{4})", "$1-$2-$3", ["[2-489]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1-$2-$3", ["12"]], ["(\\d{4})(\\d{6})", "$1-$2", ["159"]], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3-$4", ["1[7-9]"]], ["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})", "$1-$2 $3-$4", ["15"]]], "0"], "IM": ["44", "00", "1624\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([25-8]\\d{5})$|0|180020", "1624$1", 0, "74576|(?:16|7[56])24"], "IN": ["91", "00", "(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}", [8, 9, 10, 11, 12, 13], [["(\\d{8})", "$1", ["5(?:0|2[23]|3[03]|[67]1|88)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"], 0, 1], ["(\\d{4})(\\d{4,5})", "$1 $2", ["180", "1800"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["140"], 0, 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["11|2[02]|33|4[04]|79[1-7]|80[2-46]", "11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])", "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"], "0$1", 1], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807", "1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]", "1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\d|7(?:[23569]\\d|8[0-57-9])|8(?:[14-6]\\d|2[0-79]))|7(?:1(?:[013-8]\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"], "0$1", 1], ["(\\d{5})(\\d{5})", "$1 $2", ["16|[6-9]"], "0$1", 1], ["(\\d{4})(\\d{2,4})(\\d{4})", "$1 $2 $3", ["18[06]", "18[06]0"], 0, 1], ["(\\d{4})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["18"], 0, 1]], "0"], "IO": ["246", "00", "3\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["3"]]]], "IQ": ["964", "00", "(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-6]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0"], "IR": ["98", "00", "[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}", [4, 5, 6, 7, 10], [["(\\d{4,5})", "$1", ["96"], "0$1"], ["(\\d{2})(\\d{4,5})", "$1 $2", ["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[1-8]"], "0$1"]], "0"], "IS": ["354", "00|1(?:0(?:01|[12]0)|100)", "(?:38\\d|[4-9])\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "IT": ["39", "00", "0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", [6, 7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], ["(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], ["(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], ["(\\d{4})(\\d{4})", "$1 $2", ["894"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1(?:44|[679])|[378]|43"]], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], ["(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]], 0, 0, 0, 0, 0, 0, [["0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"], ["3[2-9]\\d{7,8}|(?:31|43)\\d{8}", [9, 10]], ["80(?:0\\d{3}|3)\\d{3}", [6, 9]], ["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", [6, 8, 9, 10]], ["1(?:78\\d|99)\\d{6}", [9, 10]], ["3[2-8]\\d{9,10}", [11, 12]], 0, 0, ["55\\d{8}", [10]], ["84(?:[08]\\d{3}|[17])\\d{3}", [6, 9]]]], "JE": ["44", "00", "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([0-24-8]\\d{5})$|0|180020", "1534$1", 0, 0, [["1534[0-24-8]\\d{5}"], ["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"], ["80(?:07(?:35|81)|8901)\\d{4}"], ["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"], ["701511\\d{4}"], 0, ["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"], ["56\\d{8}"]]], "JM": ["1", "011", "(?:[58]\\d\\d|658|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "658|876"], "JO": ["962", "00", "(?:(?:[2689]|7\\d)\\d|32|427|53)\\d{6}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2356]|87"], "(0$1)"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["70"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[47]"], "0$1"]], "0"], "JP": ["81", "010", "00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}", [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3", ["(?:12|57|99)0"], "0$1"], ["(\\d{4})(\\d)(\\d{4})", "$1-$2-$3", ["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2-$3", ["3|4(?:2[09]|7[01])|6[1-9]", "3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3", ["[14]|[289][2-9]|5[3-9]|7[2-4679]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["800"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[25-9]"], "0$1"]], "0", 0, "(000[2569]\\d{4,6})$|(?:(?:003768)0?)|0", "$1"], "KE": ["254", "000", "(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}", [7, 8, 9, 10], [["(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0"], "KG": ["996", "00", "8\\d{9}|[235-9]\\d{8}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["3(?:1[346]|[24-79])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-79]|88"], "0$1"], ["(\\d{3})(\\d{3})(\\d)(\\d{2,3})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "KH": ["855", "00[14-9]", "1\\d{9}|[1-9]\\d{7,8}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "KI": ["686", "00", "(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}", [5, 8], 0, "0"], "KM": ["269", "00", "[3478]\\d{6}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[3478]"]]]], "KN": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "869$1", 0, "869"], "KP": ["850", "00|99", "85\\d{6}|(?:19\\d|[2-7])\\d{7}", [8, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"]], "0"], "KR": ["82", "00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))", "00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}", [5, 6, 8, 9, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{3,4})", "$1-$2", ["(?:3[1-3]|[46][1-4]|5[1-5])1"], "0$1"], ["(\\d{4})(\\d{4})", "$1-$2", ["1"]], ["(\\d)(\\d{3,4})(\\d{4})", "$1-$2-$3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[36]0|8"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1-$2-$3", ["[1346]|5[1-5]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{2})(\\d{5})(\\d{4})", "$1-$2-$3", ["5"], "0$1"]], "0", 0, "0(8(?:[1-46-8]|5\\d\\d))?"], "KW": ["965", "00", "18\\d{5}|(?:[2569]\\d|41)\\d{6}", [7, 8], [["(\\d{4})(\\d{3,4})", "$1 $2", ["[169]|2(?:[235]|4[1-35-9])|52"]], ["(\\d{3})(\\d{5})", "$1 $2", ["[245]"]]]], "KY": ["1", "011", "(?:345|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "345$1", 0, "345"], "KZ": ["7", "810", "8\\d{13}|[78]\\d{9}", [10, 14], 0, "8", 0, 0, 0, 0, "7", 0, "8~10"], "LA": ["856", "00", "[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2[13]|3[14]|[4-8]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["3"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0"], "LB": ["961", "00", "[27-9]\\d{7}|[13-9]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27-9]"]]], "0"], "LC": ["1", "011", "(?:[58]\\d\\d|758|900)\\d{7}", [10], 0, "1", 0, "([2-8]\\d{6})$|1", "758$1", 0, "758"], "LI": ["423", "00", "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", [7, 9], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2379]|8(?:0[09]|7)", "[2379]|8(?:0(?:02|9)|7)"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["69"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]], "0", 0, "(1001)|0"], "LK": ["94", "00", "[1-9]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[1-689]"], "0$1"]], "0"], "LR": ["231", "00", "(?:[2457]\\d|33|88)\\d{7}|(?:2\\d|[4-6])\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["4[67]|[56]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-578]"], "0$1"]], "0"], "LS": ["266", "00", "(?:[256]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2568]"]]]], "LT": ["370", "00", "(?:[3469]\\d|52|[78]0)\\d{6}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["52[0-7]"], "(0-$1)", 1], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0 $1", 1], ["(\\d{2})(\\d{6})", "$1 $2", ["37|4(?:[15]|6[1-8])"], "(0-$1)", 1], ["(\\d{3})(\\d{5})", "$1 $2", ["[3-6]"], "(0-$1)", 1]], "0", 0, "[08]"], "LU": ["352", "00", "35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}", [4, 5, 6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{3})", "$1 $2", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["20[2-689]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4", ["20"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["80[01]|90[015]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["20"]]], 0, 0, "(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"], "LV": ["371", "00", "(?:[268]\\d|78|90)\\d{6}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2679]|8[01]"]]]], "LY": ["218", "00", "[2-9]\\d{8}", [9], [["(\\d{2})(\\d{7})", "$1-$2", ["[2-9]"], "0$1"]], "0"], "MA": ["212", "00", "[5-8]\\d{8}", [9], [["(\\d{4})(\\d{5})", "$1-$2", ["892"], "0$1"], ["(\\d{2})(\\d{7})", "$1-$2", ["8(?:0[0-7]|9)"], "0$1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[5-8]"], "0$1"]], "0", 0, 0, 0, 0, "[5-8]"], "MC": ["377", "00", "(?:[3489]|[67]\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["4"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[389]"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[67]"], "0$1"]], "0"], "MD": ["373", "00", "(?:[235-7]\\d|[89]0)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["22|3"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[25-7]"], "0$1"]], "0"], "ME": ["382", "00", "(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], "0"], "MF": ["590", "00", "7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"], ["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"], ["80[0-5]\\d{6}"], ["8[129]\\d{7}"], 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]], "MG": ["261", "00", "[23]\\d{8}", [9], [["(\\d{2})(\\d{2})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0", 0, "([24-9]\\d{6})$|0", "20$1"], "MH": ["692", "011", "329\\d{4}|(?:[256]\\d|45)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-6]"]]], "1"], "MK": ["389", "00", "[2-578]\\d{7}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2|34[47]|4(?:[37]7|5[47]|64)"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[347]"], "0$1"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[58]"], "0$1"]], "0"], "ML": ["223", "00", "[24-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-9]"]]]], "MM": ["95", "00", "1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}", [6, 7, 8, 9, 10], [["(\\d)(\\d{2})(\\d{3})", "$1 $2 $3", ["16|2"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]|452|678|86", "[12]|452|6788|86"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[4-7]|8[1-35]"], "0$1"], ["(\\d)(\\d{3})(\\d{4,6})", "$1 $2 $3", ["9(?:2[0-4]|[35-9]|4[137-9])"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["92"], "0$1"], ["(\\d)(\\d{5})(\\d{4})", "$1 $2 $3", ["9"], "0$1"]], "0"], "MN": ["976", "001", "[12]\\d{7,9}|[5-9]\\d{7}", [8, 9, 10], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["11|2[16]"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[5-9]"]], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[12]2[1-3]"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["[12](?:27|3[2-8]|4[2-68]|5[1-4689])", "[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["[12]"], "0$1"]], "0"], "MO": ["853", "00", "0800\\d{3}|(?:28|[68]\\d)\\d{6}", [7, 8], [["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[268]"]]]], "MP": ["1", "011", "[58]\\d{9}|(?:67|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "670$1", 0, "670"], "MQ": ["596", "00", "7091\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-79]|8(?:0[6-9]|[36])"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "MR": ["222", "00", "(?:[2-4]\\d\\d|800)\\d{5}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-48]"]]]], "MS": ["1", "011", "(?:[58]\\d\\d|664|900)\\d{7}", [10], 0, "1", 0, "([34]\\d{6})$|1", "664$1", 0, "664"], "MT": ["356", "00", "3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2357-9]"]]]], "MU": ["230", "0(?:0|[24-7]0|3[03])", "(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46]|8[013]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[57]"]], ["(\\d{5})(\\d{5})", "$1 $2", ["8"]]], 0, 0, 0, 0, 0, 0, 0, "020"], "MV": ["960", "0(?:0|19)", "(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}", [7, 10], [["(\\d{3})(\\d{4})", "$1-$2", ["[34679]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "MW": ["265", "00", "(?:[1289]\\d|31|77)\\d{7}|1\\d{6}", [7, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["1[2-9]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-37-9]"], "0$1"]], "0"], "MX": ["52", "0[09]", "[2-9]\\d{9}", [10], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["33|5[56]|81"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-9]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "MY": ["60", "00", "1\\d{8,9}|(?:3\\d|[4-9])\\d{7}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1-$2 $3", ["[4-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1-$2 $3", ["1(?:[02469]|[378][1-9]|53)|8", "1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2 $3", ["3"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3-$4", ["1(?:[367]|80)"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2 $3", ["15"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2 $3", ["1"], "0$1"]], "0"], "MZ": ["258", "00", "(?:2|8\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2|8[2-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], "NA": ["264", "00", "[68]\\d{7,8}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["87"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], "NC": ["687", "00", "(?:050|[2-57-9]\\d\\d)\\d{3}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1.$2.$3", ["[02-57-9]"]]]], "NE": ["227", "00", "[027-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["08"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[089]|2[013]|7[0467]"]]]], "NF": ["672", "00", "[13]\\d{5}", [6], [["(\\d{2})(\\d{4})", "$1 $2", ["1[0-3]"]], ["(\\d)(\\d{5})", "$1 $2", ["[13]"]]], 0, 0, "([0-258]\\d{4})$", "3$1"], "NG": ["234", "009", "(?:20|9\\d)\\d{8}|[78]\\d{9,13}", [10, 11, 12, 13, 14], [["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["20[129]"], "0$1"], ["(\\d{4})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{3})(\\d{5})(\\d{5,6})", "$1 $2 $3", ["[78]"], "0$1"]], "0"], "NI": ["505", "00", "(?:1800|[25-8]\\d{3})\\d{4}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[125-8]"]]]], "NL": ["31", "00", "(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}", [5, 6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{4,7})", "$1 $2", ["[89]0"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["66"], "0$1"], ["(\\d)(\\d{8})", "$1 $2", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-578]|91"], "0$1"], ["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3", ["9"], "0$1"]], "0"], "NO": ["47", "00", "(?:0|[2-9]\\d{3})\\d{4}", [5, 8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]"]]], 0, 0, 0, 0, 0, "[02-689]|7[0-8]"], "NP": ["977", "00", "(?:1\\d|9)\\d{9}|[1-9]\\d{7}", [8, 10, 11], [["(\\d)(\\d{7})", "$1-$2", ["1[2-6]"], "0$1"], ["(\\d{2})(\\d{6})", "$1-$2", ["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"], "0$1"], ["(\\d{3})(\\d{7})", "$1-$2", ["9"]]], "0"], "NR": ["674", "00", "(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[24-9]"]]]], "NU": ["683", "00", "(?:[4-7]|888\\d)\\d{3}", [4, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["8"]]]], "NZ": ["64", "0(?:0|161)", "[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,8})", "$1 $2", ["8[1-79]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["50[036-8]|8|90", "50(?:[0367]|88)|8|90"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["24|[346]|7[2-57-9]|9[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:10|74)|[589]"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1|2[028]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,5})", "$1 $2 $3", ["2(?:[169]|7[0-35-9])|7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "00"], "OM": ["968", "00", "(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}", [7, 8, 9], [["(\\d{3})(\\d{4,6})", "$1 $2", ["[58]"]], ["(\\d{2})(\\d{6})", "$1 $2", ["2"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[179]"]]]], "PA": ["507", "00", "(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}", [7, 8, 10, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[1-57-9]"]], ["(\\d{4})(\\d{4})", "$1-$2", ["[68]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]]], "PE": ["51", "00|19(?:1[124]|77|90)00", "(?:[14-8]|9\\d)\\d{7}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["80"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["1"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[4-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"]]], "0", 0, 0, 0, 0, 0, 0, "00", " Anexo "], "PF": ["689", "00", "4\\d{5}(?:\\d{2})?|8\\d{7,8}", [6, 8, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["44"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4|8[7-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], "PG": ["675", "00|140[1-3]", "(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["18|[2-69]|85"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[78]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "PH": ["63", "00", "(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}", [6, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{5})", "$1 $2", ["2"], "(0$1)"], ["(\\d{4})(\\d{4,6})", "$1 $2", ["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2", "3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"], "(0$1)"], ["(\\d{5})(\\d{4})", "$1 $2", ["346|4(?:27|9[35])|883", "3469|4(?:279|9(?:30|56))|8834"], "(0$1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|8[2-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["1"]]], "0"], "PK": ["92", "00", "122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,7})", "$1 $2 $3", ["[89]0"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["1"]], ["(\\d{3})(\\d{6,7})", "$1 $2", ["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])", "9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"], "(0$1)"], ["(\\d{2})(\\d{7,8})", "$1 $2", ["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"], "(0$1)"], ["(\\d{5})(\\d{5})", "$1 $2", ["58"], "(0$1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[24-9]"], "(0$1)"]], "0"], "PL": ["48", "00", "(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{5})", "$1", ["19"]], ["(\\d{3})(\\d{3})", "$1 $2", ["11|20|64"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1", "30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["64"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[2-8]|[2-7]|8[1-79]|9[145]"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["8"]]]], "PM": ["508", "00", "[78]\\d{8}|[2-9]\\d{5}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "PR": ["1", "011", "(?:[589]\\d\\d|787)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "787|939"], "PS": ["970", "00", "[2489]2\\d{6}|(?:1\\d|5)\\d{8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2489]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "PT": ["351", "00", "1693\\d{5}|(?:[26-9]\\d|30)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["2[12]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["16|[236-9]"]]]], "PW": ["680", "01[12]", "(?:[24-8]\\d\\d|345|900)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "PY": ["595", "00", "[36-8]\\d{5,8}|4\\d{6,8}|59\\d{6}|9\\d{5,10}|(?:2\\d|5[0-8])\\d{6,7}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3,6})", "$1 $2", ["[2-9]0"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["3[289]|4[246-8]|61|7[1-3]|8[1-36]"], "(0$1)"], ["(\\d{3})(\\d{4,5})", "$1 $2", ["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["87"]], ["(\\d{3})(\\d{6})", "$1 $2", ["9(?:[5-79]|8[1-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"]]], "0"], "QA": ["974", "00", "800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}", [7, 8, 9, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["2[136]|8"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[3-7]"]]]], "RE": ["262", "00", "709\\d{6}|(?:26|[689]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[26-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}"], ["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"], ["80\\d{7}"], ["89[1-37-9]\\d{6}"], 0, 0, 0, 0, ["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"], ["8(?:1[019]|2[0156]|84|90)\\d{6}"]]], "RO": ["40", "00", "(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}", [6, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["2[3-6]", "2[3-6]\\d9"], "0$1"], ["(\\d{2})(\\d{4})", "$1 $2", ["219|31"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[23]1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[236-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, " int "], "RS": ["381", "00", "38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}", [6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{3,9})", "$1 $2", ["(?:2[389]|39)0|[7-9]"], "0$1"], ["(\\d{2})(\\d{5,10})", "$1 $2", ["[1-36]"], "0$1"]], "0"], "RU": ["7", "810", "8\\d{13}|[347-9]\\d{9}", [10, 14], [["(\\d{4})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-8]|2[1-9])", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"], "8 ($1)", 1], ["(\\d{5})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-68]|2[1-9])", "7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))", "7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[349]|8(?:[02-7]|1[1-8])"], "8 ($1)", 1], ["(\\d{4})(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["8"], "8 ($1)"]], "8", 0, 0, 0, 0, "[3489]", 0, "8~10"], "RW": ["250", "00", "(?:06|[27]\\d\\d|[89]00)\\d{6}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0$1"]], "0"], "SA": ["966", "00", "(?:[15]\\d|800|92)\\d{7}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["9"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]], "0"], "SB": ["677", "0[01]", "[6-9]\\d{6}|[1-6]\\d{4}", [5, 7], [["(\\d{2})(\\d{5})", "$1 $2", ["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]], "SC": ["248", "010|0[0-2]", "(?:[2489]\\d|64)\\d{5}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[246]|9[57]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "SD": ["249", "00", "[19]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], "SE": ["46", "00", "(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}", [6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["20"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{4})", "$1-$2", ["9(?:00|39|44|9)"], "0$1", 0, "$1 $2"], ["(\\d{2})(\\d{3})(\\d{2})", "$1-$2 $3", ["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3"], ["(\\d)(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{2,3})(\\d{3})", "$1-$2 $3", ["9(?:00|39|44)"], "0$1", 0, "$1 $2 $3"], ["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["10|7"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{3})", "$1-$2 $3 $4", ["9"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4 $5", ["[26]"], "0$1", 0, "$1 $2 $3 $4 $5"]], "0"], "SG": ["65", "0[0-3]\\d", "(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-9]|[1-9])"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{4})(\\d{4})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], "SH": ["290", "00", "(?:[256]\\d|8)\\d{3}", [4, 5], 0, 0, 0, 0, 0, 0, "[256]"], "SI": ["386", "00|10(?:22|66|88|99)", "[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}", [5, 6, 7, 8], [["(\\d{2})(\\d{3,6})", "$1 $2", ["8[09]|9"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["59|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37][01]|4[013]|51|6"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-57]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, 0, "00"], "SJ": ["47", "00", "0\\d{4}|(?:[489]\\d|79)\\d{6}", [5, 8], 0, 0, 0, 0, 0, 0, "79"], "SK": ["421", "00", "[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}", [6, 7, 9], [["(\\d)(\\d{2})(\\d{3,4})", "$1 $2 $3", ["21"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["[3-5][1-8]1", "[3-5][1-8]1[67]"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[689]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[3-5]"], "0$1"]], "0"], "SL": ["232", "00", "(?:[237-9]\\d|66)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[236-9]"], "(0$1)"]], "0"], "SM": ["378", "00", "(?:0549|[5-7]\\d)\\d{6}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]"]], ["(\\d{4})(\\d{6})", "$1 $2", ["0"]]], 0, 0, "([89]\\d{5})$", "0549$1"], "SN": ["221", "00", "(?:[378]\\d|93)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[379]"]]]], "SO": ["252", "00", "[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}", [6, 7, 8, 9], [["(\\d{2})(\\d{4})", "$1 $2", ["8[125]"]], ["(\\d{6})", "$1", ["[134]"]], ["(\\d)(\\d{6})", "$1 $2", ["[15]|2[0-79]|3[0-46-8]|4[0-7]"]], ["(\\d{2})(\\d{5,7})", "$1 $2", ["1|28|9[2-9]"]], ["(\\d)(\\d{7})", "$1 $2", ["[267]|904"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[346-9]"]]], "0"], "SR": ["597", "00", "(?:[2-5]|[6-9]\\d)\\d{5}", [6, 7], [["(\\d{2})(\\d{2})(\\d{2})", "$1-$2-$3", ["56"]], ["(\\d{3})(\\d{3})", "$1-$2", ["[2-5]"]], ["(\\d{3})(\\d{4})", "$1-$2", ["[6-9]"]]]], "SS": ["211", "00", "[19]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], "ST": ["239", "00", "(?:22|9\\d)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[29]"]]]], "SV": ["503", "00", "[25-7]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?", [7, 8, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[89]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[25-7]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[89]"]]]], "SX": ["1", "011", "7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "(5\\d{6})$|1", "721$1", 0, "721"], "SY": ["963", "00", "[1-359]\\d{8}|[1-5]\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-4]|5[1-3]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[59]"], "0$1", 1]], "0"], "SZ": ["268", "00", "0800\\d{4}|(?:[237]\\d|900)\\d{6}", [8, 9], [["(\\d{4})(\\d{4})", "$1 $2", ["[0237]"]], ["(\\d{5})(\\d{4})", "$1 $2", ["9"]]]], "TA": ["290", "00", "8\\d{3}", [4], 0, 0, 0, 0, 0, 0, "8"], "TC": ["1", "011", "(?:[58]\\d\\d|649|900)\\d{7}", [10], 0, "1", 0, "([2-479]\\d{6})$|1", "649$1", 0, "649"], "TD": ["235", "00|16", "(?:22|[3689]\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[236-9]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "TG": ["228", "00", "[279]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[279]"]]]], "TH": ["66", "00[1-9]", "(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}", [8, 9, 10, 13], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[13-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "TJ": ["992", "810", "(?:[0-57-9]\\d|66)\\d{7}", [9], [["(\\d{6})(\\d)(\\d{2})", "$1 $2 $3", ["331", "3317"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["44[02-479]|[34]7"]], ["(\\d{4})(\\d)(\\d{4})", "$1 $2 $3", ["3(?:[1245]|3[12])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["\\d"]]], 0, 0, 0, 0, 0, 0, 0, "8~10"], "TK": ["690", "00", "[2-47]\\d{3,6}", [4, 5, 6, 7]], "TL": ["670", "00", "7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-489]|70"]], ["(\\d{4})(\\d{4})", "$1 $2", ["7"]]]], "TM": ["993", "810", "[1-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["12"], "(8 $1)"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-5]"], "(8 $1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[67]"], "8 $1"]], "8", 0, 0, 0, 0, 0, 0, "8~10"], "TN": ["216", "00", "[2-57-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-57-9]"]]]], "TO": ["676", "00", "(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}", [5, 7], [["(\\d{2})(\\d{3})", "$1-$2", ["[2-4]|50|6[09]|7[0-24-69]|8[05]"]], ["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[5-9]"]]]], "TR": ["90", "00", "4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}", [7, 10, 12, 13], [["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["512|8[01589]|90"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24][1-8]|3[1-9]"], "(0$1)", 1], ["(\\d{3})(\\d{3})(\\d{6,7})", "$1 $2 $3", ["80"], "0$1", 1]], "0"], "TT": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-46-8]\\d{6})$|1", "868$1", 0, "868"], "TV": ["688", "00", "(?:2|7\\d\\d|90)\\d{4}", [5, 6, 7], [["(\\d{2})(\\d{3})", "$1 $2", ["2"]], ["(\\d{2})(\\d{4})", "$1 $2", ["90"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], "TW": ["886", "0(?:0[25-79]|19)", "[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}", [7, 8, 9, 10, 11], [["(\\d{2})(\\d)(\\d{4})", "$1 $2 $3", ["202"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["826"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["83"], "0$1"], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["82"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[25]0|37|49|8[09]"], "0$1"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[23568]|4(?:0[02-48]|[1-478])|7[1-9]", "[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, "#"], "TZ": ["255", "00[056]", "(?:[25-8]\\d|41|90)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[24]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["5"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[67]"], "0$1"]], "0"], "UA": ["380", "00", "[89]\\d{9}|[3-9]\\d{8}", [9, 10], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]", "6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])", "3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|89|9[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "0~0"], "UG": ["256", "00[057]", "800\\d{6}|(?:[29]0|[347]\\d)\\d{7}", [9], [["(\\d{4})(\\d{5})", "$1 $2", ["202", "2024", "20240"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["20[0-35-7]|4(?:6[45]|[7-9])|[7-9]", "20(?:[0135-7]|2[5-9])|4(?:6[45]|[7-9])|[7-9]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[2-4]"], "0$1"]], "0"], "US": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [10], [["(\\d{3})(\\d{4})", "$1-$2", ["310"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3", ["[2-9]"], 0, 1, "$1-$2-$3"]], "1", 0, 0, 0, 0, 0, [["(?:472[2-47-9]|983[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[02469]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}"]]], "UY": ["598", "0(?:0|1[3-9]\\d)", "0004\\d{2,9}|[1249]\\d{7}|2\\d{3,4}|(?:[49]\\d|80)\\d{5}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d{4,5})", "$1", ["21"]], ["(\\d{3})(\\d{3,4})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[49]0|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[124]"]], ["(\\d{3})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})", "$1 $2 $3 $4", ["0"]]], "0", 0, 0, 0, 0, 0, 0, "00", " int. "], "UZ": ["998", "00", "(?:20|33|[5-9]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[235-9]"]]]], "VA": ["39", "00", "0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}", [6, 7, 8, 9, 10, 11, 12], 0, 0, 0, 0, 0, 0, "06698"], "VC": ["1", "011", "(?:[58]\\d\\d|784|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "784$1", 0, "784"], "VE": ["58", "00", "[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}", [10], [["(\\d{3})(\\d{7})", "$1-$2", ["[24-689]"], "0$1"]], "0"], "VG": ["1", "011", "(?:284|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-578]\\d{6})$|1", "284$1", 0, "284"], "VI": ["1", "011", "[58]\\d{9}|(?:34|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "340$1", 0, "340"], "VN": ["84", "00", "[12]\\d{9}|[135-9]\\d{8}|[16]\\d{6,7}|7\\d{6}", [7, 8, 9, 10], [["(\\d{4})(\\d{4,6})", "$1 $2", ["1(?:2[02]|[89])"], 0, 1], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[26]|6"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[357-9]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["2[48]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["2"], "0$1", 1]], "0"], "VU": ["678", "00", "[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}", [5, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["[57-9]"]]]], "WF": ["681", "00", "(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[47-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], "WS": ["685", "0", "(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}", [5, 6, 7, 10], [["(\\d{5})", "$1", ["[2-5]|6[1-9]"]], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[68]"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], "XK": ["383", "00", "2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2|39"], "0$1"], ["(\\d{2})(\\d{7,10})", "$1 $2", ["3"], "0$1"]], "0"], "YE": ["967", "00", "(?:1|7\\d)\\d{7}|[1-7]\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-6]|7(?:[24-6]|8[0-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"], "0$1"]], "0"], "YT": ["262", "00", "(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}"], ["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"], ["80\\d{7}"], 0, 0, 0, 0, 0, ["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]], "ZA": ["27", "00", "[1-79]\\d{8}|8\\d{4,9}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,4})", "$1 $2", ["8[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["8[1-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["860"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], "ZM": ["260", "00", "800\\d{6}|(?:21|[579]\\d|63)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[28]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[579]"], "0$1"]], "0"], "ZW": ["263", "00", "2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}", [5, 6, 7, 8, 9, 10], [["(\\d{3})(\\d{3,5})", "$1 $2", ["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"], "0$1"], ["(\\d)(\\d{3})(\\d{2,4})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["80"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2", "2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)", "2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["29[013-9]|39|54"], "0$1"], ["(\\d{4})(\\d{3,5})", "$1 $2", ["(?:25|54)8", "258|5483"], "0$1"]], "0"] }, "nonGeographic": { "800": ["800", 0, "(?:00|[1-9]\\d)\\d{6}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["\\d"]]], 0, 0, 0, 0, 0, 0, [0, 0, ["(?:00|[1-9]\\d)\\d{6}"]]], "808": ["808", 0, "[1-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[1-9]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, ["[1-9]\\d{7}"]]], "870": ["870", 0, "7\\d{11}|[235-7]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-7]"]]], 0, 0, 0, 0, 0, 0, [0, ["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"], 0, 0, 0, 0, 0, 0, ["2\\d{8}", [9]]]], "878": ["878", 0, "10\\d{10}", [12], [["(\\d{2})(\\d{5})(\\d{5})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["10\\d{10}"]]], "881": ["881", 0, "6\\d{9}|[0-36-9]\\d{8}", [9, 10], [["(\\d)(\\d{3})(\\d{5})", "$1 $2 $3", ["[0-37-9]"]], ["(\\d)(\\d{3})(\\d{5,6})", "$1 $2 $3", ["6"]]], 0, 0, 0, 0, 0, 0, [0, ["6\\d{9}|[0-36-9]\\d{8}"]]], "882": ["882", 0, "[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5})", "$1 $2", ["16|342"]], ["(\\d{2})(\\d{6})", "$1 $2", ["49"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["1[36]|9"]], ["(\\d{2})(\\d{4})(\\d{3})", "$1 $2 $3", ["3[23]"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["16"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|23|3(?:[15]|4[57])|4|5[12]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["34"]], ["(\\d{2})(\\d{4,5})(\\d{5})", "$1 $2 $3", ["[1-35]"]]], 0, 0, 0, 0, 0, 0, [0, ["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|5(?:0\\d{3}|2[0-2]))\\d{7}", [7, 8, 9, 10, 12]], 0, 0, 0, ["348[57]\\d{7}", [11]], 0, 0, ["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]], "883": ["883", 0, "(?:[1-4]\\d|51)\\d{6,10}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,8})", "$1 $2 $3", ["[14]|2[24-689]|3[02-689]|51[24-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["510"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["21"]], ["(\\d{4})(\\d{4})(\\d{4})", "$1 $2 $3", ["51[13]"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[235]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]], "888": ["888", 0, "\\d{11}", [11], [["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, ["\\d{11}"]]], "979": ["979", 0, "[1359]\\d{8}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, ["[1359]\\d{8}"]]] } };
|
|
13877
|
+
var metadata_min_json_default = { "version": 4, "country_calling_codes": { "1": ["US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", "TC", "TT", "VC", "VG", "VI"], "7": ["RU", "KZ"], "20": ["EG"], "27": ["ZA"], "30": ["GR"], "31": ["NL"], "32": ["BE"], "33": ["FR"], "34": ["ES"], "36": ["HU"], "39": ["IT", "VA"], "40": ["RO"], "41": ["CH"], "43": ["AT"], "44": ["GB", "GG", "IM", "JE"], "45": ["DK"], "46": ["SE"], "47": ["NO", "SJ"], "48": ["PL"], "49": ["DE"], "51": ["PE"], "52": ["MX"], "53": ["CU"], "54": ["AR"], "55": ["BR"], "56": ["CL"], "57": ["CO"], "58": ["VE"], "60": ["MY"], "61": ["AU", "CC", "CX"], "62": ["ID"], "63": ["PH"], "64": ["NZ"], "65": ["SG"], "66": ["TH"], "81": ["JP"], "82": ["KR"], "84": ["VN"], "86": ["CN"], "90": ["TR"], "91": ["IN"], "92": ["PK"], "93": ["AF"], "94": ["LK"], "95": ["MM"], "98": ["IR"], "211": ["SS"], "212": ["MA", "EH"], "213": ["DZ"], "216": ["TN"], "218": ["LY"], "220": ["GM"], "221": ["SN"], "222": ["MR"], "223": ["ML"], "224": ["GN"], "225": ["CI"], "226": ["BF"], "227": ["NE"], "228": ["TG"], "229": ["BJ"], "230": ["MU"], "231": ["LR"], "232": ["SL"], "233": ["GH"], "234": ["NG"], "235": ["TD"], "236": ["CF"], "237": ["CM"], "238": ["CV"], "239": ["ST"], "240": ["GQ"], "241": ["GA"], "242": ["CG"], "243": ["CD"], "244": ["AO"], "245": ["GW"], "246": ["IO"], "247": ["AC"], "248": ["SC"], "249": ["SD"], "250": ["RW"], "251": ["ET"], "252": ["SO"], "253": ["DJ"], "254": ["KE"], "255": ["TZ"], "256": ["UG"], "257": ["BI"], "258": ["MZ"], "260": ["ZM"], "261": ["MG"], "262": ["RE", "YT"], "263": ["ZW"], "264": ["NA"], "265": ["MW"], "266": ["LS"], "267": ["BW"], "268": ["SZ"], "269": ["KM"], "290": ["SH", "TA"], "291": ["ER"], "297": ["AW"], "298": ["FO"], "299": ["GL"], "350": ["GI"], "351": ["PT"], "352": ["LU"], "353": ["IE"], "354": ["IS"], "355": ["AL"], "356": ["MT"], "357": ["CY"], "358": ["FI", "AX"], "359": ["BG"], "370": ["LT"], "371": ["LV"], "372": ["EE"], "373": ["MD"], "374": ["AM"], "375": ["BY"], "376": ["AD"], "377": ["MC"], "378": ["SM"], "380": ["UA"], "381": ["RS"], "382": ["ME"], "383": ["XK"], "385": ["HR"], "386": ["SI"], "387": ["BA"], "389": ["MK"], "420": ["CZ"], "421": ["SK"], "423": ["LI"], "500": ["FK"], "501": ["BZ"], "502": ["GT"], "503": ["SV"], "504": ["HN"], "505": ["NI"], "506": ["CR"], "507": ["PA"], "508": ["PM"], "509": ["HT"], "590": ["GP", "BL", "MF"], "591": ["BO"], "592": ["GY"], "593": ["EC"], "594": ["GF"], "595": ["PY"], "596": ["MQ"], "597": ["SR"], "598": ["UY"], "599": ["CW", "BQ"], "670": ["TL"], "672": ["NF"], "673": ["BN"], "674": ["NR"], "675": ["PG"], "676": ["TO"], "677": ["SB"], "678": ["VU"], "679": ["FJ"], "680": ["PW"], "681": ["WF"], "682": ["CK"], "683": ["NU"], "685": ["WS"], "686": ["KI"], "687": ["NC"], "688": ["TV"], "689": ["PF"], "690": ["TK"], "691": ["FM"], "692": ["MH"], "850": ["KP"], "852": ["HK"], "853": ["MO"], "855": ["KH"], "856": ["LA"], "880": ["BD"], "886": ["TW"], "960": ["MV"], "961": ["LB"], "962": ["JO"], "963": ["SY"], "964": ["IQ"], "965": ["KW"], "966": ["SA"], "967": ["YE"], "968": ["OM"], "970": ["PS"], "971": ["AE"], "972": ["IL"], "973": ["BH"], "974": ["QA"], "975": ["BT"], "976": ["MN"], "977": ["NP"], "992": ["TJ"], "993": ["TM"], "994": ["AZ"], "995": ["GE"], "996": ["KG"], "998": ["UZ"] }, "countries": { "AC": ["247", "00", "(?:[01589]\\d|[2-467])\\d{4}", [5, 6]], "AD": ["376", "00", "(?:1|6\\d)\\d{7}|[135-9]\\d{5}", [6, 8, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["[135-9]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["1"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]]], "AE": ["971", "00", "(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{2,9})", "$1 $2", ["60|8"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[236]|[479][2-8]"], "0$1"], ["(\\d{3})(\\d)(\\d{5})", "$1 $2 $3", ["[479]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"]], "0"], "AF": ["93", "00", "[2-7]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"]], "0"], "AG": ["1", "011", "(?:268|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([457]\\d{6})$|1", "268$1", 0, "268"], "AI": ["1", "011", "(?:264|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2457]\\d{6})$|1", "264$1", 0, "264"], "AL": ["355", "00", "(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}", [6, 7, 8, 9], [["(\\d{3})(\\d{3,4})", "$1 $2", ["80|9"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["4[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2358][2-5]|4"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["[23578]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["6"], "0$1"]], "0"], "AM": ["374", "00", "(?:[1-489]\\d|55|60|77)\\d{6}", [8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[89]0"], "0 $1"], ["(\\d{3})(\\d{5})", "$1 $2", ["2|3[12]"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["1|47"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[3-9]"], "0$1"]], "0"], "AO": ["244", "00", "[29]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[29]"]]]], "AR": ["54", "00", "(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}", [10, 11], [["(\\d{4})(\\d{2})(\\d{4})", "$1 $2-$3", ["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])", "2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["1"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2-$3", ["[23]"], "0$1", 1], ["(\\d)(\\d{4})(\\d{2})(\\d{4})", "$2 15-$3-$4", ["9(?:2[2-469]|3[3-578])", "9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))", "9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 15-$3-$4", ["91"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d{3})(\\d{3})(\\d{5})", "$1-$2-$3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 15-$3-$4", ["9"], "0$1", 0, "$1 $2 $3-$4"]], "0", 0, "0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?", "9$1"], "AS": ["1", "011", "(?:[58]\\d\\d|684|900)\\d{7}", [10], 0, "1", 0, "([267]\\d{6})$|1", "684$1", 0, "684"], "AT": ["43", "00", "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3,12})", "$1 $2", ["1(?:11|[2-9])"], "0$1"], ["(\\d{3})(\\d{2})", "$1 $2", ["517"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["5[079]"], "0$1"], ["(\\d{3})(\\d{3,10})", "$1 $2", ["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]", "(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"], "0$1"], ["(\\d{4})(\\d{3,9})", "$1 $2", ["[2-467]|5[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,7})", "$1 $2 $3", ["5"], "0$1"]], "0"], "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "(183[12])|0", 0, 0, 0, [["(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}", [9]], ["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "AW": ["297", "00", "(?:[25-79]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[25-9]"]]]], "AX": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}", [5, 6, 7, 8, 9, 10, 11, 12], 0, "0", 0, 0, 0, 0, "18", 0, "00"], "AZ": ["994", "00", "365\\d{6}|(?:[124579]\\d|60|88)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[28]|2|365|46", "1[28]|2|365[45]|46", "1[28]|2|365(?:4|5[02])|46"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[13-9]"], "0$1"]], "0"], "BA": ["387", "00", "6\\d{8}|(?:[35689]\\d|49|70)\\d{6}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[1-3]|[7-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2-$3", ["[3-5]|6[56]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["6"], "0$1"]], "0"], "BB": ["1", "011", "(?:246|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "246$1", 0, "246"], "BD": ["880", "00", "[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{4,6})", "$1-$2", ["31[5-8]|[459]1"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1-$2", ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"], "0$1"], ["(\\d{4})(\\d{3,6})", "$1-$2", ["[13-9]|2[23]"], "0$1"], ["(\\d)(\\d{7,8})", "$1-$2", ["2"], "0$1"]], "0"], "BE": ["32", "00", "4\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:80|9)0"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[239]|4[23]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[15-8]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4"], "0$1"]], "0"], "BF": ["226", "00", "[024-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[024-7]"]]]], "BG": ["359", "00", "00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}", [6, 7, 8, 9, 12], [["(\\d)(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["43[1-6]|70[1-9]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:70|8)0"], "0$1"], ["(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3", ["43[1-7]|7"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[48]|9[08]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"]], "0"], "BH": ["973", "00", "[136-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[13679]|8[02-4679]"]]]], "BI": ["257", "00", "(?:[267]\\d|31)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2367]"]]]], "BJ": ["229", "00", "(?:01\\d|8)\\d{7}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["0"]]]], "BL": ["590", "00", "7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"], ["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"], ["80[0-5]\\d{6}"], ["8[129]\\d{7}"], 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]], "BM": ["1", "011", "(?:441|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "441$1", 0, "441"], "BN": ["673", "00", "[2-578]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-578]"]]]], "BO": ["591", "00(?:1\\d)?", "(?:[2-7]\\d\\d|8001)\\d{5}", [8, 9], [["(\\d)(\\d{7})", "$1 $2", ["[23]|4[46]|50"]], ["(\\d{8})", "$1", ["[5-7]"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["8"]]], "0", 0, "0(1\\d)?"], "BQ": ["599", "00", "(?:[34]1|7\\d)\\d{5}", [7], 0, 0, 0, 0, 0, 0, "[347]"], "BR": ["55", "00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)", "[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}", [8, 9, 10, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["300|4(?:0[02]|37|86)", "300|4(?:0(?:0|20)|370|864)"]], ["(\\d{3})(\\d{2,3})(\\d{4})", "$1 $2 $3", ["(?:[358]|90)0"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"], "($1)"], ["(\\d{2})(\\d{5})(\\d{4})", "$1 $2-$3", ["[16][1-9]|[2-57-9]"], "($1)"]], "0", 0, "(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?", "$2"], "BS": ["1", "011", "(?:242|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([3-8]\\d{6})$|1", "242$1", 0, "242"], "BT": ["975", "00", "[178]\\d{7}|[2-8]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-6]|7[246]|8[2-4]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[67]|[78]"]]]], "BW": ["267", "00", "(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["90"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[24-6]|3[15-9]"]], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37]"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["8"]]]], "BY": ["375", "810", "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3})", "$1 $2", ["800"], "8 $1"], ["(\\d{3})(\\d{2})(\\d{2,4})", "$1 $2 $3", ["800"], "8 $1"], ["(\\d{4})(\\d{2})(\\d{3})", "$1 $2-$3", ["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])", "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"], "8 0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["1(?:[56]|7[467])|2[1-3]"], "8 0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-4]"], "8 0$1"], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[89]"], "8 $1"]], "8", 0, "0|80?", 0, 0, 0, 0, "8~10"], "BZ": ["501", "00", "(?:0800\\d|[2-8])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-8]"]], ["(\\d)(\\d{3})(\\d{4})(\\d{3})", "$1-$2-$3-$4", ["0"]]]], "CA": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [7, 10], 0, "1", 0, 0, 0, 0, 0, [["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}", [10]], ["", [10]], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]], ["900[2-9]\\d{6}", [10]], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}", [10]], 0, ["310\\d{4}", [7]], 0, ["600[2-9]\\d{6}", [10]]]], "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CD": ["243", "00", "(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[1-6]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["5"], "0$1"]], "0"], "CF": ["236", "00", "8776\\d{4}|(?:[27]\\d|61)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[26-8]"]]]], "CG": ["242", "00", "222\\d{6}|(?:0\\d|80)\\d{7}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[02]"]]]], "CH": ["41", "00", "8\\d{11}|[2-9]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8[047]|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]|81"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["8"], "0$1"]], "0"], "CI": ["225", "00", "[02]\\d{9}", [10], [["(\\d{2})(\\d{2})(\\d)(\\d{5})", "$1 $2 $3 $4", ["2"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3 $4", ["0"]]]], "CK": ["682", "00", "[2-578]\\d{4}", [5], [["(\\d{2})(\\d{3})", "$1 $2", ["[2-578]"]]]], "CL": ["56", "(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0", "12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}", [9, 10, 11], [["(\\d{5})(\\d{4})", "$1 $2", ["219", "2196"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["60|809"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["44"]], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2[1-36]"], "($1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["9(?:10|[2-9])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["60|8"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{3})(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["60"]]]], "CM": ["237", "00", "[26]\\d{8}|88\\d{6,7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["88"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[26]|88"]]]], "CN": ["86", "00|1(?:[12]\\d|79)\\d\\d00", "(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5,6})", "$1 $2", ["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]", "(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"], "0$1"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]", "(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]", "85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])", "85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["(?:4|80)0"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|2(?:[02-57-9]|1[1-9])", "10|2(?:[02-57-9]|1[1-9])", "10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"], "0$1", 1], ["(\\d{3})(\\d{7,8})", "$1 $2", ["9"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["80"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[3-578]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["1[3-9]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["[12]"], "0$1", 1]], "0", 0, "(1(?:[12]\\d|79)\\d\\d)|0", 0, 0, 0, 0, "00"], "CO": ["57", "00(?:4(?:[14]4|56)|[579])", "(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["46"]], ["(\\d{3})(\\d{7})", "$1 $2", ["6|90"], "($1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3[0-357]|9[14]"]], ["(\\d)(\\d{3})(\\d{7})", "$1-$2-$3", ["1"], "0$1", 0, "$1 $2 $3"]], "0", 0, "0([3579]|4(?:[14]4|56))?"], "CR": ["506", "00", "(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}", [8, 10], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[3-9]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[89]"]]], 0, 0, "(19(?:0[0-2468]|1[09]|20|66|77|99))"], "CU": ["53", "119", "(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}", [6, 7, 8, 10], [["(\\d{2})(\\d{4,6})", "$1 $2", ["2[1-4]|[34]"], "(0$1)"], ["(\\d)(\\d{6,7})", "$1 $2", ["7"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["[56]"], "0$1"], ["(\\d{3})(\\d{7})", "$1 $2", ["8"], "0$1"]], "0"], "CV": ["238", "0", "(?:[2-59]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-589]"]]]], "CW": ["599", "00", "(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[3467]"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["9[4-8]"]]], 0, 0, 0, 0, 0, "[69]"], "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CY": ["357", "00", "(?:[279]\\d|[58]0)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[257-9]"]]]], "CZ": ["420", "00", "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}", [9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]]], "DE": ["49", "00", "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [["(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"], ["(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"], ["(\\d{4})(\\d{2,11})", "$1 $2", ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"], ["(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"], ["(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"], ["(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"], ["(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"], ["(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"], ["(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"], ["(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"], ["(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]], "0"], "DJ": ["253", "00", "(?:2\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[27]"]]]], "DK": ["45", "00", "[2-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-9]"]]]], "DM": ["1", "011", "(?:[58]\\d\\d|767|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "767$1", 0, "767"], "DO": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "8001|8[024]9"], "DZ": ["213", "00", "(?:[1-4]|[5-79]\\d|80)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["9"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-8]"], "0$1"]], "0"], "EC": ["593", "00", "1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}", [8, 9, 10, 11], [["(\\d)(\\d{3})(\\d{4})", "$1 $2-$3", ["[2-7]"], "(0$1)", 0, "$1-$2-$3"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1"]]], "0"], "EE": ["372", "00", "8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88", "[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]], ["(\\d{4})(\\d{3,4})", "$1 $2", ["[45]|8(?:00|[1-49])", "[45]|8(?:00[1-9]|[1-49])"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], "EG": ["20", "00", "[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}", [8, 9, 10], [["(\\d)(\\d{7,8})", "$1 $2", ["[23]"], "0$1"], ["(\\d{2})(\\d{6,7})", "$1 $2", ["1[35]|[4-6]|8[2468]|9[235-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{8})", "$1 $2", ["1"], "0$1"]], "0"], "EH": ["212", "00", "[5-8]\\d{8}", [9], 0, "0", 0, 0, 0, 0, 0, [["528[89]\\d{5}"], ["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|3[01]|5[0-5]))\\d{6}"], ["80[0-7]\\d{6}"], ["89\\d{7}"], 0, 0, 0, 0, ["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]], "ER": ["291", "00", "[178]\\d{6}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[178]"], "0$1"]], "0"], "ES": ["34", "00", "(?:400|[5-9]\\d\\d)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]00"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[4-9]"]]]], "ET": ["251", "00", "(?:11|[2-57-9]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-57-9]"], "0$1"]], "0"], "FI": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{5})", "$1", ["20[2-59]"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1 $2", ["(?:[1-3]0|[68])0|70[07-9]"], "0$1"], ["(\\d{2})(\\d{4,8})", "$1 $2", ["[14]|2[09]|50|7[135]"], "0$1"], ["(\\d{2})(\\d{6,10})", "$1 $2", ["7"], "0$1"], ["(\\d)(\\d{4,9})", "$1 $2", ["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"], "0$1"]], "0", 0, 0, 0, 0, "1[03-79]|[2-9]", 0, "00"], "FJ": ["679", "0(?:0|52)", "45\\d{5}|(?:0800\\d|[235-9])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|45"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "FK": ["500", "00", "[2-7]\\d{4}", [5]], "FM": ["691", "00", "(?:[39]\\d\\d|820)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[389]"]]]], "FO": ["298", "00", "[2-9]\\d{5}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-9]"]]], 0, 0, "(10(?:01|[12]0|88))"], "FR": ["33", "00", "[1-9]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0 $1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[1-79]"], "0$1"]], "0"], "GA": ["241", "00", "(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}", [7, 8], [["(\\d)(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-7]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["11|[67]"], "0$1"]], 0, 0, "0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})", "$1"], "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, "0|180020", 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"], "GD": ["1", "011", "(?:473|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "473$1", 0, "473"], "GE": ["995", "00", "(?:[3-57]\\d\\d|800)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["32"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[57]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[348]"], "0$1"]], "0"], "GF": ["594", "00", "(?:694\\d|7093)\\d{5}|(?:59|[89]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]|80[6-9]|9[47]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[89]"], "0$1"]], "0"], "GG": ["44", "00", "(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?", [7, 9, 10], 0, "0", 0, "([25-9]\\d{5})$|0|180020", "1481$1", 0, 0, [["1481[25-9]\\d{5}", [10]], ["7(?:(?:781|839)\\d|911[17])\\d{5}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]]], "GH": ["233", "00", "[235]\\d{8}|800\\d{5,6}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2358]"], "0$1"]], "0"], "GI": ["350", "00", "(?:[25]\\d|60)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["2"]]]], "GL": ["299", "00", "(?:19|[2-689]\\d|70)\\d{4}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["19|[2-9]"]]]], "GM": ["220", "00", "[48]\\d{8}|[2-9]\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|4(?:[0-35]|4[16-9])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[48]"]]]], "GN": ["224", "00", "722\\d{6}|(?:3|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["3"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[67]"]]]], "GP": ["590", "00", "7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-79]|80[6-9]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}"], ["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"], ["80[0-5]\\d{6}"], ["8[129]\\d{7}"], 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]], "GQ": ["240", "00", "222\\d{6}|(?:3\\d|55|[89]0)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235]"]], ["(\\d{3})(\\d{6})", "$1 $2", ["[89]"]]]], "GR": ["30", "00", "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}", [10, 11, 12], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["21|7"]], ["(\\d{4})(\\d{6})", "$1 $2", ["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2689]"]], ["(\\d{3})(\\d{3,4})(\\d{5})", "$1 $2 $3", ["8"]]]], "GT": ["502", "00", "80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-8]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], "GU": ["1", "011", "(?:[58]\\d\\d|671|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "671$1", 0, "671"], "GW": ["245", "00", "[49]\\d{8}|4\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["40"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"]]]], "GY": ["592", "001", "(?:[2-8]\\d{3}|9008)\\d{3}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "HK": ["852", "00(?:30|5[09]|[126-9]?)", "8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}", [5, 6, 7, 8, 9, 11], [["(\\d{3})(\\d{2,5})", "$1 $2", ["900", "9003"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{3})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "HN": ["504", "00", "8\\d{10}|[237-9]\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["[237-9]"]]]], "HR": ["385", "00", "[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}", [7, 8, 9], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["6[01]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{4})(\\d{3})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6|7[245]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-57]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"]], "0"], "HT": ["509", "00", "[2-589]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[2-589]"]]]], "HU": ["36", "00", "[235-7]\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "06 $1"]], "06"], "ID": ["62", "00[89]", "00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}", [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["15"]], ["(\\d{2})(\\d{5,9})", "$1 $2", ["2[124]|[36]1"], "(0$1)"], ["(\\d{3})(\\d{5,7})", "$1 $2", ["800"], "0$1"], ["(\\d{3})(\\d{5,8})", "$1 $2", ["[2-79]"], "(0$1)"], ["(\\d{3})(\\d{3,4})(\\d{3})", "$1-$2-$3", ["8[1-35-9]"], "0$1"], ["(\\d{3})(\\d{6,8})", "$1 $2", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["804"], "0$1"], ["(\\d{3})(\\d)(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["80"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1-$2-$3", ["8"], "0$1"]], "0"], "IE": ["353", "00", "(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["2[24-9]|47|58|6[237-9]|9[35-9]"], "(0$1)"], ["(\\d{3})(\\d{5})", "$1 $2", ["[45]0"], "(0$1)"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2569]|4[1-69]|7[14]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["81"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["4"], "(0$1)"], ["(\\d{2})(\\d)(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "IL": ["972", "0(?:0|1(?:05|[2-9]))", "1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}", [7, 8, 9, 10, 11, 12], [["(\\d{4})(\\d{3})", "$1-$2", ["125"]], ["(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3", ["121"]], ["(\\d)(\\d{3})(\\d{4})", "$1-$2-$3", ["[2-489]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1-$2-$3", ["12"]], ["(\\d{4})(\\d{6})", "$1-$2", ["159"]], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3-$4", ["1[7-9]"]], ["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})", "$1-$2 $3-$4", ["15"]]], "0"], "IM": ["44", "00", "1624\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([25-8]\\d{5})$|0|180020", "1624$1", 0, "74576|(?:16|7[56])24"], "IN": ["91", "00", "(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}", [8, 9, 10, 11, 12, 13], [["(\\d{8})", "$1", ["5(?:0|2[23]|3[03]|[67]1|88)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"], 0, 1], ["(\\d{4})(\\d{4,5})", "$1 $2", ["180", "1800"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["140"], 0, 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["11|2[02]|33|4[04]|79[1-7]|80[2-46]", "11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])", "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"], "0$1", 1], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807", "1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]", "1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\d|7(?:[23569]\\d|8[0-57-9])|8(?:[14-6]\\d|2[0-79]))|7(?:1(?:[013-8]\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"], "0$1", 1], ["(\\d{5})(\\d{5})", "$1 $2", ["16|[6-9]"], "0$1", 1], ["(\\d{4})(\\d{2,4})(\\d{4})", "$1 $2 $3", ["18[06]", "18[06]0"], 0, 1], ["(\\d{4})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["18"], 0, 1]], "0"], "IO": ["246", "00", "3\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["3"]]]], "IQ": ["964", "00", "(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-6]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0"], "IR": ["98", "00", "[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}", [4, 5, 6, 7, 10], [["(\\d{4,5})", "$1", ["96"], "0$1"], ["(\\d{2})(\\d{4,5})", "$1 $2", ["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[1-8]"], "0$1"]], "0"], "IS": ["354", "00|1(?:0(?:01|[12]0)|100)", "(?:38\\d|[4-9])\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "IT": ["39", "00", "0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", [6, 7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], ["(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], ["(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], ["(\\d{4})(\\d{4})", "$1 $2", ["894"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1(?:44|[679])|[378]|43"]], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], ["(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]], 0, 0, 0, 0, 0, 0, [["0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"], ["3[2-9]\\d{7,8}|(?:31|43)\\d{8}", [9, 10]], ["80(?:0\\d{3}|3)\\d{3}", [6, 9]], ["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", [6, 8, 9, 10]], ["1(?:78\\d|99)\\d{6}", [9, 10]], ["3[2-8]\\d{9,10}", [11, 12]], 0, 0, ["55\\d{8}", [10]], ["84(?:[08]\\d{3}|[17])\\d{3}", [6, 9]]]], "JE": ["44", "00", "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([0-24-8]\\d{5})$|0|180020", "1534$1", 0, 0, [["1534[0-24-8]\\d{5}"], ["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"], ["80(?:07(?:35|81)|8901)\\d{4}"], ["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"], ["701511\\d{4}"], 0, ["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"], ["56\\d{8}"]]], "JM": ["1", "011", "(?:[58]\\d\\d|658|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "658|876"], "JO": ["962", "00", "(?:(?:[2689]|7\\d)\\d|32|427|53)\\d{6}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2356]|87"], "(0$1)"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["70"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[47]"], "0$1"]], "0"], "JP": ["81", "010", "00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}", [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3", ["(?:12|57|99)0"], "0$1"], ["(\\d{4})(\\d)(\\d{4})", "$1-$2-$3", ["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2-$3", ["3|4(?:2[09]|7[01])|6[1-9]", "3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3", ["[14]|[289][2-9]|5[3-9]|7[2-4679]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["800"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[25-9]"], "0$1"]], "0", 0, "(000[2569]\\d{4,6})$|(?:(?:003768)0?)|0", "$1"], "KE": ["254", "000", "(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}", [7, 8, 9, 10], [["(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0"], "KG": ["996", "00", "8\\d{9}|[235-9]\\d{8}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["3(?:1[346]|[24-79])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-79]|88"], "0$1"], ["(\\d{3})(\\d{3})(\\d)(\\d{2,3})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "KH": ["855", "00[14-9]", "1\\d{9}|[1-9]\\d{7,8}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "KI": ["686", "00", "(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}", [5, 8], 0, "0"], "KM": ["269", "00", "[3478]\\d{6}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[3478]"]]]], "KN": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "869$1", 0, "869"], "KP": ["850", "00|99", "85\\d{6}|(?:19\\d|[2-7])\\d{7}", [8, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"]], "0"], "KR": ["82", "00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))", "00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}", [5, 6, 8, 9, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{3,4})", "$1-$2", ["(?:3[1-3]|[46][1-4]|5[1-5])1"], "0$1"], ["(\\d{4})(\\d{4})", "$1-$2", ["1"]], ["(\\d)(\\d{3,4})(\\d{4})", "$1-$2-$3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[36]0|8"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1-$2-$3", ["[1346]|5[1-5]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{2})(\\d{5})(\\d{4})", "$1-$2-$3", ["5"], "0$1"]], "0", 0, "0(8(?:[1-46-8]|5\\d\\d))?"], "KW": ["965", "00", "18\\d{5}|(?:[2569]\\d|41)\\d{6}", [7, 8], [["(\\d{4})(\\d{3,4})", "$1 $2", ["[169]|2(?:[235]|4[1-35-9])|52"]], ["(\\d{3})(\\d{5})", "$1 $2", ["[245]"]]]], "KY": ["1", "011", "(?:345|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "345$1", 0, "345"], "KZ": ["7", "810", "8\\d{13}|[78]\\d{9}", [10, 14], 0, "8", 0, 0, 0, 0, "7", 0, "8~10"], "LA": ["856", "00", "[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2[13]|3[14]|[4-8]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["3"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0"], "LB": ["961", "00", "[27-9]\\d{7}|[13-9]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27-9]"]]], "0"], "LC": ["1", "011", "(?:[58]\\d\\d|758|900)\\d{7}", [10], 0, "1", 0, "([2-8]\\d{6})$|1", "758$1", 0, "758"], "LI": ["423", "00", "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", [7, 9], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2379]|8(?:0[09]|7)", "[2379]|8(?:0(?:02|9)|7)"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["69"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]], "0", 0, "(1001)|0"], "LK": ["94", "00", "[1-9]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[1-689]"], "0$1"]], "0"], "LR": ["231", "00", "(?:[2457]\\d|33|88)\\d{7}|(?:2\\d|[4-6])\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["4[67]|[56]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-578]"], "0$1"]], "0"], "LS": ["266", "00", "(?:[256]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2568]"]]]], "LT": ["370", "00", "(?:[3469]\\d|52|[78]0)\\d{6}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["52[0-7]"], "(0-$1)", 1], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0 $1", 1], ["(\\d{2})(\\d{6})", "$1 $2", ["37|4(?:[15]|6[1-8])"], "(0-$1)", 1], ["(\\d{3})(\\d{5})", "$1 $2", ["[3-6]"], "(0-$1)", 1]], "0", 0, "[08]"], "LU": ["352", "00", "35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}", [4, 5, 6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{3})", "$1 $2", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["20[2-689]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4", ["20"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["80[01]|90[015]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["20"]]], 0, 0, "(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"], "LV": ["371", "00", "(?:[268]\\d|78|90)\\d{6}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2679]|8[01]"]]]], "LY": ["218", "00", "[2-9]\\d{8}", [9], [["(\\d{2})(\\d{7})", "$1-$2", ["[2-9]"], "0$1"]], "0"], "MA": ["212", "00", "[5-8]\\d{8}", [9], [["(\\d{4})(\\d{5})", "$1-$2", ["892"], "0$1"], ["(\\d{2})(\\d{7})", "$1-$2", ["8(?:0[0-7]|9)"], "0$1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[5-8]"], "0$1"]], "0", 0, 0, 0, 0, "[5-8]"], "MC": ["377", "00", "(?:[3489]|[67]\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["4"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[389]"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[67]"], "0$1"]], "0"], "MD": ["373", "00", "(?:[235-7]\\d|[89]0)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["22|3"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[25-7]"], "0$1"]], "0"], "ME": ["382", "00", "(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], "0"], "MF": ["590", "00", "7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"], ["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"], ["80[0-5]\\d{6}"], ["8[129]\\d{7}"], 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]], "MG": ["261", "00", "[23]\\d{8}", [9], [["(\\d{2})(\\d{2})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0", 0, "([24-9]\\d{6})$|0", "20$1"], "MH": ["692", "011", "329\\d{4}|(?:[256]\\d|45)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-6]"]]], "1"], "MK": ["389", "00", "[2-578]\\d{7}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2|34[47]|4(?:[37]7|5[47]|64)"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[347]"], "0$1"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[58]"], "0$1"]], "0"], "ML": ["223", "00", "[24-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-9]"]]]], "MM": ["95", "00", "1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}", [6, 7, 8, 9, 10], [["(\\d)(\\d{2})(\\d{3})", "$1 $2 $3", ["16|2"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]|452|678|86", "[12]|452|6788|86"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[4-7]|8[1-35]"], "0$1"], ["(\\d)(\\d{3})(\\d{4,6})", "$1 $2 $3", ["9(?:2[0-4]|[35-9]|4[137-9])"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["92"], "0$1"], ["(\\d)(\\d{5})(\\d{4})", "$1 $2 $3", ["9"], "0$1"]], "0"], "MN": ["976", "001", "[12]\\d{7,9}|[5-9]\\d{7}", [8, 9, 10], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["11|2[16]"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[5-9]"]], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[12]2[1-3]"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["[12](?:27|3[2-8]|4[2-68]|5[1-4689])", "[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["[12]"], "0$1"]], "0"], "MO": ["853", "00", "0800\\d{3}|(?:28|[68]\\d)\\d{6}", [7, 8], [["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[268]"]]]], "MP": ["1", "011", "[58]\\d{9}|(?:67|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "670$1", 0, "670"], "MQ": ["596", "00", "7091\\d{5}|(?:[56]9|[89]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-79]|8(?:0[6-9]|[36])"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "MR": ["222", "00", "(?:[2-4]\\d\\d|800)\\d{5}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-48]"]]]], "MS": ["1", "011", "(?:[58]\\d\\d|664|900)\\d{7}", [10], 0, "1", 0, "([34]\\d{6})$|1", "664$1", 0, "664"], "MT": ["356", "00", "3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2357-9]"]]]], "MU": ["230", "0(?:0|[24-7]0|3[03])", "(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46]|8[013]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[57]"]], ["(\\d{5})(\\d{5})", "$1 $2", ["8"]]], 0, 0, 0, 0, 0, 0, 0, "020"], "MV": ["960", "0(?:0|19)", "(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}", [7, 10], [["(\\d{3})(\\d{4})", "$1-$2", ["[34679]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "MW": ["265", "00", "(?:[1289]\\d|31|77)\\d{7}|1\\d{6}", [7, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["1[2-9]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-37-9]"], "0$1"]], "0"], "MX": ["52", "0[09]", "[2-9]\\d{9}", [10], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["33|5[56]|81"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-9]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "MY": ["60", "00", "1\\d{8,9}|(?:3\\d|[4-9])\\d{7}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1-$2 $3", ["[4-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1-$2 $3", ["1(?:[02469]|[378][1-9]|53)|8", "1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2 $3", ["3"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3-$4", ["1(?:[367]|80)"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2 $3", ["15"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2 $3", ["1"], "0$1"]], "0"], "MZ": ["258", "00", "(?:2|8\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2|8[2-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], "NA": ["264", "00", "[68]\\d{7,8}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["87"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], "NC": ["687", "00", "(?:050|[2-57-9]\\d\\d)\\d{3}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1.$2.$3", ["[02-57-9]"]]]], "NE": ["227", "00", "[027-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["08"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[089]|2[013]|7[0467]"]]]], "NF": ["672", "00", "[13]\\d{5}", [6], [["(\\d{2})(\\d{4})", "$1 $2", ["1[0-3]"]], ["(\\d)(\\d{5})", "$1 $2", ["[13]"]]], 0, 0, "([0-258]\\d{4})$", "3$1"], "NG": ["234", "009", "(?:20|9\\d)\\d{8}|[78]\\d{9,13}", [10, 11, 12, 13, 14], [["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["20[129]"], "0$1"], ["(\\d{4})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{3})(\\d{5})(\\d{5,6})", "$1 $2 $3", ["[78]"], "0$1"]], "0"], "NI": ["505", "00", "(?:1800|[25-8]\\d{3})\\d{4}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[125-8]"]]]], "NL": ["31", "00", "(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}", [5, 6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{4,7})", "$1 $2", ["[89]0"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["66"], "0$1"], ["(\\d)(\\d{8})", "$1 $2", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-578]|91"], "0$1"], ["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3", ["9"], "0$1"]], "0"], "NO": ["47", "00", "(?:0|[2-9]\\d{3})\\d{4}", [5, 8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]"]]], 0, 0, 0, 0, 0, "[02-689]|7[0-8]"], "NP": ["977", "00", "(?:1\\d|9)\\d{9}|[1-9]\\d{7}", [8, 10, 11], [["(\\d)(\\d{7})", "$1-$2", ["1[2-6]"], "0$1"], ["(\\d{2})(\\d{6})", "$1-$2", ["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"], "0$1"], ["(\\d{3})(\\d{7})", "$1-$2", ["9"]]], "0"], "NR": ["674", "00", "(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[24-9]"]]]], "NU": ["683", "00", "(?:[4-7]|888\\d)\\d{3}", [4, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["8"]]]], "NZ": ["64", "0(?:0|161)", "[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,8})", "$1 $2", ["8[1-79]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["50[036-8]|8|90", "50(?:[0367]|88)|8|90"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["24|[346]|7[2-57-9]|9[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:10|74)|[589]"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1|2[028]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,5})", "$1 $2 $3", ["2(?:[169]|7[0-35-9])|7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "00"], "OM": ["968", "00", "(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}", [7, 8, 9], [["(\\d{3})(\\d{4,6})", "$1 $2", ["[58]"]], ["(\\d{2})(\\d{6})", "$1 $2", ["2"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[179]"]]]], "PA": ["507", "00", "(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}", [7, 8, 10, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[1-57-9]"]], ["(\\d{4})(\\d{4})", "$1-$2", ["[68]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]]], "PE": ["51", "00|19(?:1[124]|77|90)00", "(?:[14-8]|9\\d)\\d{7}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["80"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["1"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[4-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"]]], "0", 0, 0, 0, 0, 0, 0, "00", " Anexo "], "PF": ["689", "00", "4\\d{5}(?:\\d{2})?|8\\d{7,8}", [6, 8, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["44"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4|8[7-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], "PG": ["675", "00|140[1-3]", "(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["18|[2-69]|85[02-46-9]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[78]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "PH": ["63", "00", "(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}", [6, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{5})", "$1 $2", ["2"], "(0$1)"], ["(\\d{4})(\\d{4,6})", "$1 $2", ["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2", "3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"], "(0$1)"], ["(\\d{5})(\\d{4})", "$1 $2", ["346|4(?:27|9[35])|883", "3469|4(?:279|9(?:30|56))|8834"], "(0$1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|8[2-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["1"]]], "0"], "PK": ["92", "00", "122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,7})", "$1 $2 $3", ["[89]0"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["1"]], ["(\\d{3})(\\d{6,7})", "$1 $2", ["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])", "9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"], "(0$1)"], ["(\\d{2})(\\d{7,8})", "$1 $2", ["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"], "(0$1)"], ["(\\d{5})(\\d{5})", "$1 $2", ["58"], "(0$1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[24-9]"], "(0$1)"]], "0"], "PL": ["48", "00", "(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{5})", "$1", ["19"]], ["(\\d{3})(\\d{3})", "$1 $2", ["11|20|64"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1", "30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["64"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[2-8]|[2-7]|8[1-79]|9[145]"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["8"]]]], "PM": ["508", "00", "[78]\\d{8}|[2-9]\\d{5}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "PR": ["1", "011", "(?:[589]\\d\\d|787)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "787|939"], "PS": ["970", "00", "[2489]2\\d{6}|(?:1\\d|5)\\d{8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2489]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "PT": ["351", "00", "1693\\d{5}|(?:[26-9]\\d|30)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["2[12]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["16|[236-9]"]]]], "PW": ["680", "01[12]", "(?:[24-8]\\d\\d|345|900)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "PY": ["595", "00", "[36-8]\\d{5,8}|4\\d{6,8}|59\\d{6}|9\\d{5,10}|(?:2\\d|5[0-8])\\d{6,7}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3,6})", "$1 $2", ["[2-9]0"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["3[289]|4[246-8]|61|7[1-3]|8[1-36]"], "(0$1)"], ["(\\d{3})(\\d{4,5})", "$1 $2", ["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["87"]], ["(\\d{3})(\\d{6})", "$1 $2", ["9(?:[5-79]|8[1-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"]]], "0"], "QA": ["974", "00", "800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}", [7, 8, 9, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["2[136]|8"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[3-7]"]]]], "RE": ["262", "00", "709\\d{6}|(?:26|[689]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[26-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}"], ["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"], ["80\\d{7}"], ["89[1-37-9]\\d{6}"], 0, 0, 0, 0, ["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"], ["8(?:1[019]|2[0156]|84|90)\\d{6}"]]], "RO": ["40", "00", "(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}", [6, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["2[3-6]", "2[3-6]\\d9"], "0$1"], ["(\\d{2})(\\d{4})", "$1 $2", ["219|31"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[23]1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[236-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, " int "], "RS": ["381", "00", "38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}", [6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{3,9})", "$1 $2", ["(?:2[389]|39)0|[7-9]"], "0$1"], ["(\\d{2})(\\d{5,10})", "$1 $2", ["[1-36]"], "0$1"]], "0"], "RU": ["7", "810", "8\\d{13}|[347-9]\\d{9}", [10, 14], [["(\\d{4})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-8]|2[1-9])", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"], "8 ($1)", 1], ["(\\d{5})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-68]|2[1-9])", "7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))", "7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[349]|8(?:[02-7]|1[1-8])"], "8 ($1)", 1], ["(\\d{4})(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["8"], "8 ($1)"]], "8", 0, 0, 0, 0, "[3489]", 0, "8~10"], "RW": ["250", "00", "(?:06|[27]\\d\\d|[89]00)\\d{6}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0$1"]], "0"], "SA": ["966", "00", "(?:[15]\\d|800|92)\\d{7}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["9"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]], "0"], "SB": ["677", "0[01]", "[6-9]\\d{6}|[1-6]\\d{4}", [5, 7], [["(\\d{2})(\\d{5})", "$1 $2", ["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]], "SC": ["248", "010|0[0-2]", "(?:[2489]\\d|64)\\d{5}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[246]|9[57]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "SD": ["249", "00", "[19]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], "SE": ["46", "00", "(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}", [6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["20"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{4})", "$1-$2", ["9(?:00|39|44|9)"], "0$1", 0, "$1 $2"], ["(\\d{2})(\\d{3})(\\d{2})", "$1-$2 $3", ["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3"], ["(\\d)(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{2,3})(\\d{3})", "$1-$2 $3", ["9(?:00|39|44)"], "0$1", 0, "$1 $2 $3"], ["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["10|7"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{3})", "$1-$2 $3 $4", ["9"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4 $5", ["[26]"], "0$1", 0, "$1 $2 $3 $4 $5"]], "0"], "SG": ["65", "0[0-3]\\d", "(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-9]|[1-9])"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{4})(\\d{4})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], "SH": ["290", "00", "(?:[256]\\d|8)\\d{3}", [4, 5], 0, 0, 0, 0, 0, 0, "[256]"], "SI": ["386", "00|10(?:22|66|88|99)", "[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}", [5, 6, 7, 8], [["(\\d{2})(\\d{3,6})", "$1 $2", ["8[09]|9"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["59|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37][01]|4[013]|51|6"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-57]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, 0, "00"], "SJ": ["47", "00", "0\\d{4}|(?:[489]\\d|79)\\d{6}", [5, 8], 0, 0, 0, 0, 0, 0, "79"], "SK": ["421", "00", "[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}", [6, 7, 9], [["(\\d)(\\d{2})(\\d{3,4})", "$1 $2 $3", ["21"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["[3-5][1-8]1", "[3-5][1-8]1[67]"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[689]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[3-5]"], "0$1"]], "0"], "SL": ["232", "00", "(?:[237-9]\\d|66)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[236-9]"], "(0$1)"]], "0"], "SM": ["378", "00", "(?:0549|[5-7]\\d)\\d{6}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]"]], ["(\\d{4})(\\d{6})", "$1 $2", ["0"]]], 0, 0, "([89]\\d{5})$", "0549$1"], "SN": ["221", "00", "(?:[378]\\d|93)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[379]"]]]], "SO": ["252", "00", "[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}", [6, 7, 8, 9], [["(\\d{2})(\\d{4})", "$1 $2", ["8[125]"]], ["(\\d{6})", "$1", ["[134]"]], ["(\\d)(\\d{6})", "$1 $2", ["[15]|2[0-79]|3[0-46-8]|4[0-7]"]], ["(\\d{2})(\\d{5,7})", "$1 $2", ["1|28|9[2-9]"]], ["(\\d)(\\d{7})", "$1 $2", ["[267]|904"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[346-9]"]]], "0"], "SR": ["597", "00", "(?:[2-5]|[6-9]\\d)\\d{5}", [6, 7], [["(\\d{2})(\\d{2})(\\d{2})", "$1-$2-$3", ["56"]], ["(\\d{3})(\\d{3})", "$1-$2", ["[2-5]"]], ["(\\d{3})(\\d{4})", "$1-$2", ["[6-9]"]]]], "SS": ["211", "00", "[19]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], "ST": ["239", "00", "(?:22|9\\d)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[29]"]]]], "SV": ["503", "00", "[25-7]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?", [7, 8, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[89]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[25-7]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[89]"]]]], "SX": ["1", "011", "7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "(5\\d{6})$|1", "721$1", 0, "721"], "SY": ["963", "00", "[1-359]\\d{8}|[1-5]\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-4]|5[1-3]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[59]"], "0$1", 1]], "0"], "SZ": ["268", "00", "0800\\d{4}|(?:[237]\\d|900)\\d{6}", [8, 9], [["(\\d{4})(\\d{4})", "$1 $2", ["[0237]"]], ["(\\d{5})(\\d{4})", "$1 $2", ["9"]]]], "TA": ["290", "00", "8\\d{3}", [4], 0, 0, 0, 0, 0, 0, "8"], "TC": ["1", "011", "(?:[58]\\d\\d|649|900)\\d{7}", [10], 0, "1", 0, "([2-479]\\d{6})$|1", "649$1", 0, "649"], "TD": ["235", "00|16", "(?:22|[3689]\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[236-9]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "TG": ["228", "00", "[279]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[279]"]]]], "TH": ["66", "00[1-9]", "(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}", [8, 9, 10, 13], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[13-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "TJ": ["992", "810", "(?:[0-57-9]\\d|66)\\d{7}", [9], [["(\\d{6})(\\d)(\\d{2})", "$1 $2 $3", ["331", "3317"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["44[02-479]|[34]7"]], ["(\\d{4})(\\d)(\\d{4})", "$1 $2 $3", ["3(?:[1245]|3[12])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["\\d"]]], 0, 0, 0, 0, 0, 0, 0, "8~10"], "TK": ["690", "00", "[2-47]\\d{3,6}", [4, 5, 6, 7]], "TL": ["670", "00", "7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-489]|70"]], ["(\\d{4})(\\d{4})", "$1 $2", ["7"]]]], "TM": ["993", "810", "[1-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["12"], "(8 $1)"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-5]"], "(8 $1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[67]"], "8 $1"]], "8", 0, 0, 0, 0, 0, 0, "8~10"], "TN": ["216", "00", "[2-57-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-57-9]"]]]], "TO": ["676", "00", "(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}", [5, 7], [["(\\d{2})(\\d{3})", "$1-$2", ["[2-4]|50|6[09]|7[0-24-69]|8[05]"]], ["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[5-9]"]]]], "TR": ["90", "00", "4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}", [7, 10, 12, 13], [["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["512|8[01589]|90"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24][1-8]|3[1-9]"], "(0$1)", 1], ["(\\d{3})(\\d{3})(\\d{6,7})", "$1 $2 $3", ["80"], "0$1", 1]], "0"], "TT": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-46-8]\\d{6})$|1", "868$1", 0, "868"], "TV": ["688", "00", "(?:2|7\\d\\d|90)\\d{4}", [5, 6, 7], [["(\\d{2})(\\d{3})", "$1 $2", ["2"]], ["(\\d{2})(\\d{4})", "$1 $2", ["90"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], "TW": ["886", "0(?:0[25-79]|19)", "[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}", [7, 8, 9, 10, 11], [["(\\d{2})(\\d)(\\d{4})", "$1 $2 $3", ["202"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["826"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["83"], "0$1"], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["82"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[25]0|37|49|8[09]"], "0$1"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[23568]|4(?:0[02-48]|[1-478])|7[1-9]", "[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, "#"], "TZ": ["255", "00[056]", "(?:[25-8]\\d|41|90)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[24]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["5"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[67]"], "0$1"]], "0"], "UA": ["380", "00", "[89]\\d{9}|[3-9]\\d{8}", [9, 10], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]", "6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])", "3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|89|9[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "0~0"], "UG": ["256", "00[057]", "800\\d{6}|(?:[29]0|[347]\\d)\\d{7}", [9], [["(\\d{4})(\\d{5})", "$1 $2", ["202", "2024", "20240"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["20[0-35-7]|4(?:6[45]|[7-9])|[7-9]", "20(?:[0135-7]|2[5-9])|4(?:6[45]|[7-9])|[7-9]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[2-4]"], "0$1"]], "0"], "US": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [10], [["(\\d{3})(\\d{4})", "$1-$2", ["310"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3", ["[2-9]"], 0, 1, "$1-$2-$3"]], "1", 0, 0, 0, 0, 0, [["(?:472[2-47-9]|983[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[02469]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}"]]], "UY": ["598", "0(?:0|1[3-9]\\d)", "0004\\d{2,9}|[1249]\\d{7}|2\\d{3,4}|(?:[49]\\d|80)\\d{5}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d{4,5})", "$1", ["21"]], ["(\\d{3})(\\d{3,4})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[49]0|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[124]"]], ["(\\d{3})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})", "$1 $2 $3 $4", ["0"]]], "0", 0, 0, 0, 0, 0, 0, "00", " int. "], "UZ": ["998", "00", "(?:20|33|[5-9]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[235-9]"]]]], "VA": ["39", "00", "0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}", [6, 7, 8, 9, 10, 11, 12], 0, 0, 0, 0, 0, 0, "06698"], "VC": ["1", "011", "(?:[58]\\d\\d|784|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "784$1", 0, "784"], "VE": ["58", "00", "[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}", [10], [["(\\d{3})(\\d{7})", "$1-$2", ["[24-689]"], "0$1"]], "0"], "VG": ["1", "011", "(?:284|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-578]\\d{6})$|1", "284$1", 0, "284"], "VI": ["1", "011", "[58]\\d{9}|(?:34|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "340$1", 0, "340"], "VN": ["84", "00", "[12]\\d{9}|[135-9]\\d{8}|[16]\\d{6,7}|7\\d{6}", [7, 8, 9, 10], [["(\\d{4})(\\d{4,6})", "$1 $2", ["1(?:2[02]|[89])"], 0, 1], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[26]|6"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[357-9]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["2[48]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["2"], "0$1", 1]], "0"], "VU": ["678", "00", "[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}", [5, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["[57-9]"]]]], "WF": ["681", "00", "(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[47-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], "WS": ["685", "0", "(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}", [5, 6, 7, 10], [["(\\d{5})", "$1", ["[2-5]|6[1-9]"]], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[68]"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], "XK": ["383", "00", "2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2|39"], "0$1"], ["(\\d{2})(\\d{7,10})", "$1 $2", ["3"], "0$1"]], "0"], "YE": ["967", "00", "(?:1|7\\d)\\d{7}|[1-7]\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-6]|7(?:[24-6]|8[0-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"], "0$1"]], "0"], "YT": ["262", "00", "(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}"], ["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"], ["80\\d{7}"], 0, 0, 0, 0, 0, ["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]], "ZA": ["27", "00", "[1-79]\\d{8}|8\\d{4,9}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,4})", "$1 $2", ["8[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["8[1-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["860"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], "ZM": ["260", "00", "800\\d{6}|(?:21|[579]\\d|63)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[28]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[579]"], "0$1"]], "0"], "ZW": ["263", "00", "(?:13|8\\d{4})\\d{5}|[235-8]\\d{8}|[2-689]\\d{6}", [7, 9, 10], [["(\\d{2})(\\d{3,5})", "$1 $2", ["1|2(?:0[0-36-9]|29|58)|67[0-46-9]|(?:55|68)[0-69]"], "0$1"], ["(\\d{3})(\\d{3,5})", "$1 $2", ["2(?:0[45]|[27]|48)|37|675|(?:55|68)[78]"], "0$1"], ["(\\d)(\\d{3})(\\d{2,4})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["80"], "0$1"], ["(\\d{4})(\\d{3,5})", "$1 $2", ["548"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["29[013-9]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[256]|39|8[13-59]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["3"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["8"], "0$1"]], "0"] }, "nonGeographic": { "800": ["800", 0, "(?:00|[1-9]\\d)\\d{6}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["\\d"]]], 0, 0, 0, 0, 0, 0, [0, 0, ["(?:00|[1-9]\\d)\\d{6}"]]], "808": ["808", 0, "[1-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[1-9]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, ["[1-9]\\d{7}"]]], "870": ["870", 0, "7\\d{11}|[235-7]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-7]"]]], 0, 0, 0, 0, 0, 0, [0, ["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"], 0, 0, 0, 0, 0, 0, ["2\\d{8}", [9]]]], "878": ["878", 0, "10\\d{10}", [12], [["(\\d{2})(\\d{5})(\\d{5})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["10\\d{10}"]]], "881": ["881", 0, "6\\d{9}|[0-36-9]\\d{8}", [9, 10], [["(\\d)(\\d{3})(\\d{5})", "$1 $2 $3", ["[0-37-9]"]], ["(\\d)(\\d{3})(\\d{5,6})", "$1 $2 $3", ["6"]]], 0, 0, 0, 0, 0, 0, [0, ["6\\d{9}|[0-36-9]\\d{8}"]]], "882": ["882", 0, "[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5})", "$1 $2", ["16|342"]], ["(\\d{2})(\\d{6})", "$1 $2", ["49"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["1[36]|9"]], ["(\\d{2})(\\d{4})(\\d{3})", "$1 $2 $3", ["3[23]"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["16"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|23|3(?:[15]|4[57])|4|5[12]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["34"]], ["(\\d{2})(\\d{4,5})(\\d{5})", "$1 $2 $3", ["[1-35]"]]], 0, 0, 0, 0, 0, 0, [0, ["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|5(?:0\\d{3}|2[0-2]))\\d{7}", [7, 8, 9, 10, 12]], 0, 0, 0, ["348[57]\\d{7}", [11]], 0, 0, ["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]], "883": ["883", 0, "(?:[1-4]\\d|51)\\d{6,10}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,8})", "$1 $2 $3", ["[14]|2[24-689]|3[02-689]|51[24-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["510"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["21"]], ["(\\d{4})(\\d{4})(\\d{4})", "$1 $2 $3", ["51[13]"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[235]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]], "888": ["888", 0, "\\d{11}", [11], [["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, ["\\d{11}"]]], "979": ["979", 0, "[1359]\\d{8}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, ["[1359]\\d{8}"]]] } };
|
|
12121
13878
|
|
|
12122
13879
|
// ../../node_modules/libphonenumber-js/min/exports/withMetadataArgument.js
|
|
12123
13880
|
function withMetadataArgument(func, _arguments) {
|
|
@@ -16742,6 +18499,36 @@ var COLUMNS32 = [
|
|
|
16742
18499
|
{ header: "URL", getValue: (item) => item.baseUrl ?? "" },
|
|
16743
18500
|
COL.status()
|
|
16744
18501
|
];
|
|
18502
|
+
function summarizeReasons(collections, key) {
|
|
18503
|
+
if (!collections?.length) return "";
|
|
18504
|
+
const parts = [];
|
|
18505
|
+
for (const collection of collections) {
|
|
18506
|
+
const counts = collection?.[key];
|
|
18507
|
+
if (!counts) continue;
|
|
18508
|
+
for (const [reason, count] of Object.entries(counts)) {
|
|
18509
|
+
parts.push(`${collection.collection}:${reason} x${count}`);
|
|
18510
|
+
}
|
|
18511
|
+
}
|
|
18512
|
+
return parts.join(", ");
|
|
18513
|
+
}
|
|
18514
|
+
var ENCOUNTER_RUN_COLUMNS = [
|
|
18515
|
+
{ header: "RUN ID", getValue: (item) => item.runId ?? "" },
|
|
18516
|
+
{ header: "STATUS", getValue: (item) => item.status ?? "" },
|
|
18517
|
+
{ header: "KIND", getValue: (item) => item.runKind ?? "full_sweep" },
|
|
18518
|
+
{ header: "SOURCE", getValue: (item) => item.source ?? "" },
|
|
18519
|
+
{ header: "TOTAL", getValue: (item) => String(item.total ?? 0) },
|
|
18520
|
+
{ header: "UPDATED", getValue: (item) => String(item.synced ?? 0) },
|
|
18521
|
+
{ header: "FAILED", getValue: (item) => String(item.failed ?? 0) },
|
|
18522
|
+
{ header: "STARTED", getValue: (item) => item.startedAt ?? "" },
|
|
18523
|
+
{
|
|
18524
|
+
header: "SKIPPED (BY DESIGN)",
|
|
18525
|
+
getValue: (item) => summarizeReasons(item.attribution?.collections, "skipReasonCounts")
|
|
18526
|
+
},
|
|
18527
|
+
{
|
|
18528
|
+
header: "COLLECTION ERRORS",
|
|
18529
|
+
getValue: (item) => summarizeReasons(item.attribution?.collections, "errorReasonCounts")
|
|
18530
|
+
}
|
|
18531
|
+
];
|
|
16745
18532
|
var fhirConnectionsDomain = {
|
|
16746
18533
|
name: "fhir-connections",
|
|
16747
18534
|
description: "Manage FHIR connections",
|
|
@@ -16769,6 +18556,36 @@ var fhirConnectionsDomain = {
|
|
|
16769
18556
|
);
|
|
16770
18557
|
outputSingle(result2, ctx);
|
|
16771
18558
|
}
|
|
18559
|
+
},
|
|
18560
|
+
{
|
|
18561
|
+
// Deliberately separate from `gr sync runs`, which stays generic and
|
|
18562
|
+
// connector-neutral. Encounter-sync attribution is eCW-specific, so
|
|
18563
|
+
// it lives on the eCW route and on this eCW command.
|
|
18564
|
+
//
|
|
18565
|
+
// Note an aggregate eCW full sweep publishes NO per-item rows, so
|
|
18566
|
+
// `gr sync items` is expected to come back empty for these runs —
|
|
18567
|
+
// the per-collection counters below are the item-level detail.
|
|
18568
|
+
path: ["fhir-connections", "encounter-sync", "runs"],
|
|
18569
|
+
description: "List encounter-sync runs for a FHIR connection, with collection attribution",
|
|
18570
|
+
requiresWorkspace: true,
|
|
18571
|
+
args: [
|
|
18572
|
+
{ name: "id", description: "FHIR connection ID", required: true },
|
|
18573
|
+
{ name: "limit", description: "Max runs to return (default 20)" }
|
|
18574
|
+
],
|
|
18575
|
+
examples: [
|
|
18576
|
+
"fhir-connections encounter-sync runs --id 12",
|
|
18577
|
+
"fhir-connections encounter-sync runs --id 12 --output json",
|
|
18578
|
+
"fhir-connections encounter-sync runs --id 12 --limit 5 --output json"
|
|
18579
|
+
],
|
|
18580
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
18581
|
+
const limit = args["limit"] ? Number(args["limit"]) : 20;
|
|
18582
|
+
const runs = await requireAuth(ctx).apiClient.fhirGetEncounterSyncRuns(
|
|
18583
|
+
workspace,
|
|
18584
|
+
requireNumber(args, "id"),
|
|
18585
|
+
limit
|
|
18586
|
+
);
|
|
18587
|
+
outputData(runs, ctx, ENCOUNTER_RUN_COLUMNS);
|
|
18588
|
+
}
|
|
16772
18589
|
}
|
|
16773
18590
|
]
|
|
16774
18591
|
};
|
|
@@ -18115,7 +19932,6 @@ function registerPublicDomains(registry) {
|
|
|
18115
19932
|
registry.register(agentTasksDomain);
|
|
18116
19933
|
registry.register(assignmentsDomain);
|
|
18117
19934
|
registry.register(dataTypesDomain);
|
|
18118
|
-
registry.register(devicesDomain);
|
|
18119
19935
|
registry.register(sitesDomain);
|
|
18120
19936
|
registry.register(filesDomain);
|
|
18121
19937
|
registry.register(eventsDomain);
|
|
@@ -18127,6 +19943,7 @@ function registerPublicDomains(registry) {
|
|
|
18127
19943
|
registry.register(personasDomain);
|
|
18128
19944
|
registry.register(metricsDomain);
|
|
18129
19945
|
registry.register(journeysDomain);
|
|
19946
|
+
registry.register(activityDomain);
|
|
18130
19947
|
registry.register(abilitiesDomain);
|
|
18131
19948
|
registry.register(phoneNumbersDomain);
|
|
18132
19949
|
registry.register(recordingsDomain);
|
|
@@ -18341,6 +20158,90 @@ var UI_CHOICE_DECLINE_MESSAGE = "The user declined to make a selection.";
|
|
|
18341
20158
|
// src/lib/openui-terminal.ts
|
|
18342
20159
|
import * as readline from "readline";
|
|
18343
20160
|
|
|
20161
|
+
// src/lib/ui-prompt-response.ts
|
|
20162
|
+
var UI_PROMPT_KINDS = {
|
|
20163
|
+
render_ui: true,
|
|
20164
|
+
present_choice_list: true,
|
|
20165
|
+
inline_connect: true
|
|
20166
|
+
};
|
|
20167
|
+
function isUiPromptKind(value) {
|
|
20168
|
+
return typeof value === "string" && Object.hasOwn(UI_PROMPT_KINDS, value);
|
|
20169
|
+
}
|
|
20170
|
+
function multiChoiceValue(values) {
|
|
20171
|
+
return JSON.stringify(values);
|
|
20172
|
+
}
|
|
20173
|
+
function serializeBody(body) {
|
|
20174
|
+
if (body.status === "declined") {
|
|
20175
|
+
return JSON.stringify({ status: "declined" });
|
|
20176
|
+
}
|
|
20177
|
+
if ("values" in body) {
|
|
20178
|
+
return JSON.stringify({ status: "submitted", values: body.values });
|
|
20179
|
+
}
|
|
20180
|
+
return JSON.stringify({ status: "submitted", chosenValue: body.chosenValue });
|
|
20181
|
+
}
|
|
20182
|
+
function formatUiPromptResponse(args) {
|
|
20183
|
+
const { promptId, kind, body } = args;
|
|
20184
|
+
if (!promptId || /["\r\n]/.test(promptId)) {
|
|
20185
|
+
throw new Error(
|
|
20186
|
+
"formatUiPromptResponse: promptId must be a non-empty id without quotes or newlines"
|
|
20187
|
+
);
|
|
20188
|
+
}
|
|
20189
|
+
return [
|
|
20190
|
+
`<ui-prompt-response prompt_id="${promptId}" kind="${kind}">`,
|
|
20191
|
+
serializeBody(body),
|
|
20192
|
+
"</ui-prompt-response>"
|
|
20193
|
+
].join("\n");
|
|
20194
|
+
}
|
|
20195
|
+
var BLOCK_RE = /^<ui-prompt-response\s+prompt_id="([^"]+)"\s+kind="([^"]+)">\n([\s\S]*)\n<\/ui-prompt-response>$/;
|
|
20196
|
+
function parseUiPromptResponse(content) {
|
|
20197
|
+
if (typeof content !== "string") return null;
|
|
20198
|
+
const match = BLOCK_RE.exec(content.trim());
|
|
20199
|
+
if (!match) return null;
|
|
20200
|
+
const [, promptId, kind, json] = match;
|
|
20201
|
+
if (!promptId || !isUiPromptKind(kind) || json === void 0) return null;
|
|
20202
|
+
let parsed;
|
|
20203
|
+
try {
|
|
20204
|
+
parsed = JSON.parse(json);
|
|
20205
|
+
} catch {
|
|
20206
|
+
return null;
|
|
20207
|
+
}
|
|
20208
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
20209
|
+
const record = parsed;
|
|
20210
|
+
const hasChoice = record.chosenValue !== void 0;
|
|
20211
|
+
const hasValues = record.values !== void 0;
|
|
20212
|
+
if (record.status === "declined") {
|
|
20213
|
+
return hasChoice || hasValues ? null : { promptId, kind, body: { status: "declined" } };
|
|
20214
|
+
}
|
|
20215
|
+
if (record.status !== "submitted" || hasChoice === hasValues) return null;
|
|
20216
|
+
if (hasChoice) {
|
|
20217
|
+
return typeof record.chosenValue === "string" ? { promptId, kind, body: { status: "submitted", chosenValue: record.chosenValue } } : null;
|
|
20218
|
+
}
|
|
20219
|
+
const values = parseFormValues(record.values);
|
|
20220
|
+
return values ? { promptId, kind, body: { status: "submitted", values } } : null;
|
|
20221
|
+
}
|
|
20222
|
+
function parseFormValues(raw) {
|
|
20223
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
|
|
20224
|
+
const values = {};
|
|
20225
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
20226
|
+
if (typeof value !== "string") return null;
|
|
20227
|
+
values[key] = value;
|
|
20228
|
+
}
|
|
20229
|
+
return values;
|
|
20230
|
+
}
|
|
20231
|
+
function summarizeUiPromptResponse(response) {
|
|
20232
|
+
const { body } = response;
|
|
20233
|
+
if (body.status === "declined") return "Declined";
|
|
20234
|
+
if ("values" in body) {
|
|
20235
|
+
const count = Object.keys(body.values).length;
|
|
20236
|
+
return `Submitted form (${count} field${count === 1 ? "" : "s"})`;
|
|
20237
|
+
}
|
|
20238
|
+
return `Selected: ${body.chosenValue}`;
|
|
20239
|
+
}
|
|
20240
|
+
function displayUserMessage(content) {
|
|
20241
|
+
const parsed = parseUiPromptResponse(content);
|
|
20242
|
+
return parsed ? summarizeUiPromptResponse(parsed) : content;
|
|
20243
|
+
}
|
|
20244
|
+
|
|
18344
20245
|
// src/lib/openui-parse.ts
|
|
18345
20246
|
function markupIsInteractive(markup) {
|
|
18346
20247
|
return markup.includes("ChoiceButton(") || markup.includes("Form(") || markup.includes("Input(") || markup.includes("TextArea(") || markup.includes("Select(") || markup.includes("ChoiceField(");
|
|
@@ -18573,11 +20474,11 @@ function resolveFormControl(bindings, ref) {
|
|
|
18573
20474
|
}
|
|
18574
20475
|
return null;
|
|
18575
20476
|
}
|
|
18576
|
-
function
|
|
20477
|
+
function isPlainObject2(arg) {
|
|
18577
20478
|
return !!arg && typeof arg === "object" && !Array.isArray(arg) && !("__ref" in arg);
|
|
18578
20479
|
}
|
|
18579
20480
|
function rulesRequired(arg) {
|
|
18580
|
-
if (!
|
|
20481
|
+
if (!isPlainObject2(arg)) return false;
|
|
18581
20482
|
return arg["required"] === true;
|
|
18582
20483
|
}
|
|
18583
20484
|
function splitPlaceholderAndRules(args, start) {
|
|
@@ -18592,7 +20493,7 @@ function splitPlaceholderAndRules(args, start) {
|
|
|
18592
20493
|
if (placeholder === void 0) placeholder = arg;
|
|
18593
20494
|
continue;
|
|
18594
20495
|
}
|
|
18595
|
-
if (
|
|
20496
|
+
if (isPlainObject2(arg)) {
|
|
18596
20497
|
required = rulesRequired(arg);
|
|
18597
20498
|
break;
|
|
18598
20499
|
}
|
|
@@ -18673,16 +20574,16 @@ function extractDisplay(bindings) {
|
|
|
18673
20574
|
|
|
18674
20575
|
// src/lib/openui-terminal.ts
|
|
18675
20576
|
var CYAN = "\x1B[36m";
|
|
18676
|
-
var
|
|
20577
|
+
var DIM2 = "\x1B[90m";
|
|
18677
20578
|
var BOLD = "\x1B[1m";
|
|
18678
|
-
var
|
|
20579
|
+
var RESET2 = "\x1B[0m";
|
|
18679
20580
|
var INVERSE = "\x1B[7m";
|
|
18680
20581
|
var GREEN = "\x1B[32m";
|
|
18681
|
-
async function
|
|
20582
|
+
async function promptOpenUiTerminalResult(payload, opts = {}) {
|
|
18682
20583
|
const prompt = payload.userPrompt && payload.userPrompt.trim() || payload.description && payload.description.trim() || "Choose an option";
|
|
18683
20584
|
const markup = payload.openuiMarkup ?? "";
|
|
18684
20585
|
writeOut(`
|
|
18685
|
-
${CYAN}${BOLD}${prompt}${
|
|
20586
|
+
${CYAN}${BOLD}${prompt}${RESET2}
|
|
18686
20587
|
`);
|
|
18687
20588
|
if (!markup.trim()) {
|
|
18688
20589
|
return promptFreeform("Your reply");
|
|
@@ -18691,22 +20592,39 @@ ${CYAN}${BOLD}${prompt}${RESET}
|
|
|
18691
20592
|
renderDisplay(parsed.display);
|
|
18692
20593
|
if (!process.stdin.isTTY) {
|
|
18693
20594
|
writeParsedSummary(parsed, markup);
|
|
18694
|
-
return "";
|
|
20595
|
+
return { kind: "skipped" };
|
|
18695
20596
|
}
|
|
18696
20597
|
if (parsed.form) {
|
|
18697
20598
|
return promptForm(parsed.form, parsed.choices);
|
|
18698
20599
|
}
|
|
18699
20600
|
if (parsed.choices.length > 0) {
|
|
18700
|
-
return promptChoices(parsed.choices);
|
|
20601
|
+
return promptChoices(parsed.choices, opts.multi === true);
|
|
18701
20602
|
}
|
|
18702
20603
|
if (markupIsInteractive(markup)) {
|
|
18703
|
-
writeOut(`${
|
|
20604
|
+
writeOut(`${DIM2}(Could not fully parse UI controls \u2014 enter a value manually.)${RESET2}
|
|
18704
20605
|
`);
|
|
18705
|
-
writeOut(`${
|
|
20606
|
+
writeOut(`${DIM2}${markup.slice(0, 500)}${markup.length > 500 ? "\u2026" : ""}${RESET2}
|
|
18706
20607
|
`);
|
|
18707
20608
|
}
|
|
18708
20609
|
return promptFreeform("Your reply");
|
|
18709
20610
|
}
|
|
20611
|
+
async function promptOpenUiTerminal(payload) {
|
|
20612
|
+
return resumeValueFor(await promptOpenUiTerminalResult(payload));
|
|
20613
|
+
}
|
|
20614
|
+
function resumeValueFor(result2) {
|
|
20615
|
+
switch (result2.kind) {
|
|
20616
|
+
case "choice":
|
|
20617
|
+
return result2.value;
|
|
20618
|
+
case "form":
|
|
20619
|
+
return JSON.stringify(result2.values);
|
|
20620
|
+
case "text":
|
|
20621
|
+
return result2.text;
|
|
20622
|
+
case "declined":
|
|
20623
|
+
return UI_CHOICE_DECLINE_MESSAGE;
|
|
20624
|
+
case "skipped":
|
|
20625
|
+
return "";
|
|
20626
|
+
}
|
|
20627
|
+
}
|
|
18710
20628
|
function writeOut(text) {
|
|
18711
20629
|
process.stderr.write(text);
|
|
18712
20630
|
}
|
|
@@ -18714,7 +20632,7 @@ function writeParsedSummary(parsed, markup) {
|
|
|
18714
20632
|
if (parsed.choices.length) {
|
|
18715
20633
|
for (const [i, c] of parsed.choices.entries()) {
|
|
18716
20634
|
writeOut(
|
|
18717
|
-
` ${i + 1}. ${c.label}${c.value !== c.label ? ` ${
|
|
20635
|
+
` ${i + 1}. ${c.label}${c.value !== c.label ? ` ${DIM2}[${c.value}]${RESET2}` : ""}
|
|
18718
20636
|
`
|
|
18719
20637
|
);
|
|
18720
20638
|
}
|
|
@@ -18734,17 +20652,17 @@ function renderDisplay(display) {
|
|
|
18734
20652
|
for (const item of display) {
|
|
18735
20653
|
if (item.kind === "info") {
|
|
18736
20654
|
writeOut(`
|
|
18737
|
-
${BOLD}${item.icon ? `${item.icon} ` : ""}${item.title}${
|
|
20655
|
+
${BOLD}${item.icon ? `${item.icon} ` : ""}${item.title}${RESET2}
|
|
18738
20656
|
`);
|
|
18739
20657
|
if (item.body) {
|
|
18740
20658
|
for (const line of item.body.split("\n")) {
|
|
18741
|
-
writeOut(` ${
|
|
20659
|
+
writeOut(` ${DIM2}${line}${RESET2}
|
|
18742
20660
|
`);
|
|
18743
20661
|
}
|
|
18744
20662
|
}
|
|
18745
20663
|
} else if (item.kind === "stat") {
|
|
18746
20664
|
const trend = item.trend === "up" ? " \u2191" : item.trend === "down" ? " \u2193" : item.trend === "neutral" ? "" : "";
|
|
18747
|
-
writeOut(` ${
|
|
20665
|
+
writeOut(` ${DIM2}${item.label}${RESET2} ${BOLD}${item.value}${trend}${RESET2}
|
|
18748
20666
|
`);
|
|
18749
20667
|
} else if (item.kind === "table") {
|
|
18750
20668
|
writeOut("\n");
|
|
@@ -18760,13 +20678,46 @@ function renderDisplay(display) {
|
|
|
18760
20678
|
}
|
|
18761
20679
|
if (display.length) writeOut("\n");
|
|
18762
20680
|
}
|
|
20681
|
+
async function promptConnectTerminal(connect) {
|
|
20682
|
+
writeOut(`
|
|
20683
|
+
${CYAN}${BOLD}Connect ${connect.label}${RESET2}
|
|
20684
|
+
`);
|
|
20685
|
+
if (connect.connectUrl === null) {
|
|
20686
|
+
writeOut(
|
|
20687
|
+
` ${DIM2}This secure link is no longer available \u2014 ask the assistant for a new one.${RESET2}
|
|
20688
|
+
`
|
|
20689
|
+
);
|
|
20690
|
+
} else {
|
|
20691
|
+
writeOut(" Open this URL in a browser to finish connecting:\n");
|
|
20692
|
+
writeOut(` ${connect.connectUrl}
|
|
20693
|
+
`);
|
|
20694
|
+
if (connect.expiresInMinutes > 0) {
|
|
20695
|
+
writeOut(` ${DIM2}The link expires in ${connect.expiresInMinutes} minutes.${RESET2}
|
|
20696
|
+
`);
|
|
20697
|
+
}
|
|
20698
|
+
}
|
|
20699
|
+
if (!process.stdin.isTTY) return "pending";
|
|
20700
|
+
const outcome = await selectChoice([
|
|
20701
|
+
{
|
|
20702
|
+
label: `I'll connect ${connect.label} now`,
|
|
20703
|
+
value: "connect",
|
|
20704
|
+
terminal: true,
|
|
20705
|
+
variant: "primary"
|
|
20706
|
+
},
|
|
20707
|
+
{ label: "Don't connect", value: "decline", terminal: true }
|
|
20708
|
+
]);
|
|
20709
|
+
if (outcome.kind === "abort") return "declined";
|
|
20710
|
+
if (outcome.kind === "escape") return "pending";
|
|
20711
|
+
return outcome.choice.value === "decline" ? "declined" : "pending";
|
|
20712
|
+
}
|
|
18763
20713
|
var OpenUiTerminalAbortError = class extends Error {
|
|
18764
20714
|
constructor() {
|
|
18765
20715
|
super("UI choice cancelled");
|
|
18766
20716
|
this.name = "OpenUiTerminalAbortError";
|
|
18767
20717
|
}
|
|
18768
20718
|
};
|
|
18769
|
-
async function promptChoices(choices) {
|
|
20719
|
+
async function promptChoices(choices, multi) {
|
|
20720
|
+
if (multi) return promptMultiChoices(choices);
|
|
18770
20721
|
for (; ; ) {
|
|
18771
20722
|
const outcome = await selectChoice(choices);
|
|
18772
20723
|
if (outcome.kind === "abort") {
|
|
@@ -18779,48 +20730,67 @@ async function promptChoices(choices) {
|
|
|
18779
20730
|
if (!selected.terminal) {
|
|
18780
20731
|
const body = selected.auxiliaryBody?.trim() || selected.description?.trim() || `Selected "${selected.label}".`;
|
|
18781
20732
|
writeOut(`
|
|
18782
|
-
${BOLD}${selected.label}${
|
|
20733
|
+
${BOLD}${selected.label}${RESET2}
|
|
18783
20734
|
`);
|
|
18784
20735
|
for (const line of body.split("\n")) {
|
|
18785
20736
|
writeOut(` ${line}
|
|
18786
20737
|
`);
|
|
18787
20738
|
}
|
|
18788
20739
|
writeOut(`
|
|
18789
|
-
${
|
|
20740
|
+
${DIM2}(Press Enter to return to choices)${RESET2}
|
|
18790
20741
|
`);
|
|
18791
20742
|
await promptLine("");
|
|
18792
20743
|
continue;
|
|
18793
20744
|
}
|
|
18794
|
-
writeOut(`${GREEN}\u2713${
|
|
20745
|
+
writeOut(`${GREEN}\u2713${RESET2} ${selected.label}
|
|
18795
20746
|
`);
|
|
18796
|
-
return selected.value;
|
|
20747
|
+
return { kind: "choice", value: selected.value };
|
|
18797
20748
|
}
|
|
18798
20749
|
}
|
|
20750
|
+
async function promptMultiChoices(choices) {
|
|
20751
|
+
const selectable = choices.filter((c) => c.terminal);
|
|
20752
|
+
if (selectable.length === 0) return promptFreeform("Your reply (or empty to cancel)");
|
|
20753
|
+
const outcome = await runPicker(selectable, true);
|
|
20754
|
+
if (outcome.kind === "abort") throw new OpenUiTerminalAbortError();
|
|
20755
|
+
if (outcome.kind === "escape") return promptFreeform("Your reply (or empty to cancel)");
|
|
20756
|
+
const picked = outcome.indices.map((i) => selectable[i]);
|
|
20757
|
+
writeOut(`${GREEN}\u2713${RESET2} ${picked.map((c) => c.label).join(", ")}
|
|
20758
|
+
`);
|
|
20759
|
+
return { kind: "choice", value: multiChoiceValue(picked.map((c) => c.value)) };
|
|
20760
|
+
}
|
|
18799
20761
|
async function selectChoice(choices) {
|
|
18800
|
-
|
|
20762
|
+
const outcome = await runPicker(choices, false);
|
|
20763
|
+
if (outcome.kind !== "pick") return outcome;
|
|
20764
|
+
return { kind: "pick", choice: choices[outcome.indices[0]] };
|
|
20765
|
+
}
|
|
20766
|
+
function runPicker(choices, multi) {
|
|
20767
|
+
if (choices.length === 0) return Promise.resolve({ kind: "escape" });
|
|
18801
20768
|
return new Promise((resolve) => {
|
|
18802
20769
|
let index = 0;
|
|
18803
20770
|
let linesDrawn = 0;
|
|
20771
|
+
const ticked = /* @__PURE__ */ new Set();
|
|
18804
20772
|
const draw = () => {
|
|
18805
20773
|
if (linesDrawn > 0) {
|
|
18806
20774
|
process.stderr.write(`\x1B[${linesDrawn}A`);
|
|
18807
20775
|
}
|
|
20776
|
+
const jump = `1-${Math.min(choices.length, 9)}`;
|
|
18808
20777
|
const lines = [
|
|
18809
|
-
`${
|
|
20778
|
+
multi ? `${DIM2}\u2191/\u2193 move \xB7 Space toggle \xB7 Enter confirm \xB7 ${jump} toggle \xB7 Esc type freely${RESET2}` : `${DIM2}\u2191/\u2193 move \xB7 Enter select \xB7 ${jump} jump \xB7 Esc type freely${RESET2}`,
|
|
18810
20779
|
""
|
|
18811
20780
|
];
|
|
18812
20781
|
for (let i = 0; i < choices.length; i++) {
|
|
18813
20782
|
const c = choices[i];
|
|
18814
20783
|
const selected = i === index;
|
|
18815
20784
|
const marker = selected ? ">" : " ";
|
|
20785
|
+
const box = multi ? ticked.has(i) ? "[x] " : "[ ] " : "";
|
|
18816
20786
|
const num = String(i + 1).padStart(2);
|
|
18817
20787
|
const descPlain = c.description ? ` \u2014 ${c.description}` : "";
|
|
18818
20788
|
if (selected) {
|
|
18819
|
-
lines.push(`${INVERSE} ${marker} ${num}. ${c.label}${descPlain}${
|
|
20789
|
+
lines.push(`${INVERSE} ${marker} ${num}. ${box}${c.label}${descPlain}${RESET2}`);
|
|
18820
20790
|
} else {
|
|
18821
|
-
const label = c.variant === "primary" ? `${BOLD}${c.label}${
|
|
18822
|
-
const desc = c.description ? `${
|
|
18823
|
-
lines.push(` ${marker} ${num}. ${label}${desc}`);
|
|
20791
|
+
const label = c.variant === "primary" ? `${BOLD}${c.label}${RESET2}` : c.label;
|
|
20792
|
+
const desc = c.description ? `${DIM2}${descPlain}${RESET2}` : "";
|
|
20793
|
+
lines.push(` ${marker} ${num}. ${box}${label}${desc}`);
|
|
18824
20794
|
}
|
|
18825
20795
|
}
|
|
18826
20796
|
lines.push("");
|
|
@@ -18848,6 +20818,12 @@ async function selectChoice(choices) {
|
|
|
18848
20818
|
const onClose = () => {
|
|
18849
20819
|
settle({ kind: "abort" });
|
|
18850
20820
|
};
|
|
20821
|
+
const toggle = (i) => {
|
|
20822
|
+
if (ticked.has(i)) ticked.delete(i);
|
|
20823
|
+
else ticked.add(i);
|
|
20824
|
+
index = i;
|
|
20825
|
+
draw();
|
|
20826
|
+
};
|
|
18851
20827
|
const onKey = (_str, key) => {
|
|
18852
20828
|
if (!key) return;
|
|
18853
20829
|
if (key.name === "up") {
|
|
@@ -18860,8 +20836,13 @@ async function selectChoice(choices) {
|
|
|
18860
20836
|
draw();
|
|
18861
20837
|
return;
|
|
18862
20838
|
}
|
|
20839
|
+
if (multi && key.name === "space") {
|
|
20840
|
+
toggle(index);
|
|
20841
|
+
return;
|
|
20842
|
+
}
|
|
18863
20843
|
if (key.name === "return") {
|
|
18864
|
-
|
|
20844
|
+
const picked = multi ? [...ticked].sort((a, b) => a - b) : [index];
|
|
20845
|
+
settle({ kind: "pick", indices: picked.length > 0 ? picked : [index] });
|
|
18865
20846
|
return;
|
|
18866
20847
|
}
|
|
18867
20848
|
if (key.ctrl && key.name === "c") {
|
|
@@ -18875,7 +20856,8 @@ async function selectChoice(choices) {
|
|
|
18875
20856
|
if (_str && /^[0-9]$/.test(_str)) {
|
|
18876
20857
|
const n = _str === "0" ? 10 : Number(_str);
|
|
18877
20858
|
if (n >= 1 && n <= choices.length) {
|
|
18878
|
-
|
|
20859
|
+
if (multi) toggle(n - 1);
|
|
20860
|
+
else settle({ kind: "pick", indices: [n - 1] });
|
|
18879
20861
|
}
|
|
18880
20862
|
}
|
|
18881
20863
|
};
|
|
@@ -18886,11 +20868,11 @@ async function selectChoice(choices) {
|
|
|
18886
20868
|
async function promptForm(form, extraChoices) {
|
|
18887
20869
|
if (form.title) {
|
|
18888
20870
|
writeOut(`
|
|
18889
|
-
${BOLD}${form.title}${
|
|
20871
|
+
${BOLD}${form.title}${RESET2}
|
|
18890
20872
|
`);
|
|
18891
20873
|
}
|
|
18892
20874
|
if (form.description) {
|
|
18893
|
-
writeOut(`${
|
|
20875
|
+
writeOut(`${DIM2}${form.description}${RESET2}
|
|
18894
20876
|
`);
|
|
18895
20877
|
}
|
|
18896
20878
|
writeOut("\n");
|
|
@@ -18898,7 +20880,7 @@ ${BOLD}${form.title}${RESET}
|
|
|
18898
20880
|
for (const field of form.fields) {
|
|
18899
20881
|
const answer = await promptField(field);
|
|
18900
20882
|
if (answer === null && field.required) {
|
|
18901
|
-
writeOut(`${
|
|
20883
|
+
writeOut(`${DIM2}Required field \u2014 try again.${RESET2}
|
|
18902
20884
|
`);
|
|
18903
20885
|
const retry = await promptField(field);
|
|
18904
20886
|
if (retry === null) {
|
|
@@ -18912,13 +20894,13 @@ ${BOLD}${form.title}${RESET}
|
|
|
18912
20894
|
}
|
|
18913
20895
|
const actions = buildFormActions(form.buttons, extraChoices);
|
|
18914
20896
|
if (actions.length === 0) {
|
|
18915
|
-
writeOut(`${GREEN}\u2713${
|
|
20897
|
+
writeOut(`${GREEN}\u2713${RESET2} Submitted
|
|
18916
20898
|
`);
|
|
18917
|
-
return
|
|
20899
|
+
return { kind: "form", values };
|
|
18918
20900
|
}
|
|
18919
20901
|
for (; ; ) {
|
|
18920
20902
|
writeOut(`
|
|
18921
|
-
${
|
|
20903
|
+
${DIM2}Select an action:${RESET2}
|
|
18922
20904
|
`);
|
|
18923
20905
|
const outcome = await selectChoice(
|
|
18924
20906
|
actions.map((a) => ({
|
|
@@ -18933,42 +20915,42 @@ ${DIM}Select an action:${RESET}
|
|
|
18933
20915
|
throw new OpenUiTerminalAbortError();
|
|
18934
20916
|
}
|
|
18935
20917
|
if (outcome.kind === "escape") {
|
|
18936
|
-
writeOut(`${GREEN}\u2713${
|
|
20918
|
+
writeOut(`${GREEN}\u2713${RESET2} Submitted
|
|
18937
20919
|
`);
|
|
18938
|
-
return
|
|
20920
|
+
return { kind: "form", values };
|
|
18939
20921
|
}
|
|
18940
20922
|
const action = actions.find((a) => a.id === outcome.choice.value);
|
|
18941
20923
|
if (!action || action.kind === "submit") {
|
|
18942
|
-
writeOut(`${GREEN}\u2713${
|
|
20924
|
+
writeOut(`${GREEN}\u2713${RESET2} ${action?.label ?? "Submitted"}
|
|
18943
20925
|
`);
|
|
18944
|
-
return
|
|
20926
|
+
return { kind: "form", values };
|
|
18945
20927
|
}
|
|
18946
20928
|
if (action.kind === "choice") {
|
|
18947
|
-
writeOut(`${GREEN}\u2713${
|
|
20929
|
+
writeOut(`${GREEN}\u2713${RESET2} ${action.label}
|
|
18948
20930
|
`);
|
|
18949
|
-
return action.choiceValue ?? action.label;
|
|
20931
|
+
return { kind: "choice", value: action.choiceValue ?? action.label };
|
|
18950
20932
|
}
|
|
18951
20933
|
if (action.kind === "cancel") {
|
|
18952
|
-
return
|
|
20934
|
+
return { kind: "declined" };
|
|
18953
20935
|
}
|
|
18954
20936
|
if (action.kind === "open_url" && action.url) {
|
|
18955
|
-
writeOut(`${
|
|
20937
|
+
writeOut(`${DIM2}Open URL: ${action.url}${RESET2}
|
|
18956
20938
|
`);
|
|
18957
20939
|
continue;
|
|
18958
20940
|
}
|
|
18959
20941
|
if (action.kind === "auxiliary") {
|
|
18960
20942
|
const body = action.context?.replace(/^auxiliary:/i, "").trim() || action.label;
|
|
18961
20943
|
writeOut(`
|
|
18962
|
-
${BOLD}${action.label}${
|
|
20944
|
+
${BOLD}${action.label}${RESET2}
|
|
18963
20945
|
`);
|
|
18964
20946
|
for (const line of body.split("\n")) writeOut(` ${line}
|
|
18965
20947
|
`);
|
|
18966
20948
|
writeOut(`
|
|
18967
|
-
${
|
|
20949
|
+
${DIM2}(Returning to actions \u2014 pick Submit when ready)${RESET2}
|
|
18968
20950
|
`);
|
|
18969
20951
|
continue;
|
|
18970
20952
|
}
|
|
18971
|
-
return
|
|
20953
|
+
return { kind: "form", values };
|
|
18972
20954
|
}
|
|
18973
20955
|
}
|
|
18974
20956
|
function buildFormActions(buttons, extraChoices) {
|
|
@@ -19024,10 +21006,10 @@ function buildFormActions(buttons, extraChoices) {
|
|
|
19024
21006
|
}
|
|
19025
21007
|
async function promptField(field) {
|
|
19026
21008
|
const req = field.required ? " *" : "";
|
|
19027
|
-
const hint2 = field.hint ? ` ${
|
|
21009
|
+
const hint2 = field.hint ? ` ${DIM2}(${field.hint})${RESET2}` : "";
|
|
19028
21010
|
if (field.kind === "select" && field.options && field.options.length > 0) {
|
|
19029
21011
|
writeOut(`
|
|
19030
|
-
${BOLD}${field.label}${req}${
|
|
21012
|
+
${BOLD}${field.label}${req}${RESET2}${hint2}
|
|
19031
21013
|
`);
|
|
19032
21014
|
const outcome = await selectChoice(
|
|
19033
21015
|
field.options.map((o) => ({
|
|
@@ -19045,7 +21027,7 @@ ${BOLD}${field.label}${req}${RESET}${hint2}
|
|
|
19045
21027
|
}
|
|
19046
21028
|
return outcome.choice.value;
|
|
19047
21029
|
}
|
|
19048
|
-
const placeholder = field.placeholder ? ` ${
|
|
21030
|
+
const placeholder = field.placeholder ? ` ${DIM2}[${field.placeholder}]${RESET2}` : "";
|
|
19049
21031
|
const answer = await promptLine(`${field.label}${req}${placeholder}: `);
|
|
19050
21032
|
if (!answer.trim()) {
|
|
19051
21033
|
if (field.required) return null;
|
|
@@ -19063,9 +21045,9 @@ function promptLine(question) {
|
|
|
19063
21045
|
});
|
|
19064
21046
|
}
|
|
19065
21047
|
async function promptFreeform(label) {
|
|
19066
|
-
if (!process.stdin.isTTY) return "";
|
|
19067
|
-
const answer = await promptLine(`${label}: `);
|
|
19068
|
-
return answer
|
|
21048
|
+
if (!process.stdin.isTTY) return { kind: "skipped" };
|
|
21049
|
+
const answer = (await promptLine(`${label}: `)).trim();
|
|
21050
|
+
return answer ? { kind: "text", text: answer } : { kind: "skipped" };
|
|
19069
21051
|
}
|
|
19070
21052
|
|
|
19071
21053
|
// src/lib/trusted-dirs.ts
|
|
@@ -19165,12 +21147,7 @@ Re-run with --trust-cwd (or --trust-dir <path>) after reviewing files in that di
|
|
|
19165
21147
|
}
|
|
19166
21148
|
|
|
19167
21149
|
// src/lib/cli-hitl.ts
|
|
19168
|
-
var UI_CHOICE_INTERRUPT_TYPES = /* @__PURE__ */ new Set([
|
|
19169
|
-
"render_ui",
|
|
19170
|
-
"present_choice_list",
|
|
19171
|
-
/** @deprecated Pre-rename interrupt type */
|
|
19172
|
-
"present_choice"
|
|
19173
|
-
]);
|
|
21150
|
+
var UI_CHOICE_INTERRUPT_TYPES = /* @__PURE__ */ new Set(["render_ui"]);
|
|
19174
21151
|
function extractHumanInputRequest(event) {
|
|
19175
21152
|
const type = String(event.type ?? "").toUpperCase();
|
|
19176
21153
|
if (type === "CUSTOM" && event.name === "human_input_request") {
|
|
@@ -19253,27 +21230,155 @@ async function handleUIChoiceTerminal(payload) {
|
|
|
19253
21230
|
}
|
|
19254
21231
|
}
|
|
19255
21232
|
|
|
21233
|
+
// src/lib/ui-prompt-presented.ts
|
|
21234
|
+
function optionalString3(record, key) {
|
|
21235
|
+
const value = record[key];
|
|
21236
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
21237
|
+
}
|
|
21238
|
+
var CONNECT_TOOL_NAME = /^connect_[a-z0-9_]+_account$/;
|
|
21239
|
+
function isUiPromptToolName(name) {
|
|
21240
|
+
if (typeof name !== "string" || !name) return false;
|
|
21241
|
+
return name === "render_ui" || name === "present_choice_list" || CONNECT_TOOL_NAME.test(name);
|
|
21242
|
+
}
|
|
21243
|
+
function parseConnect(value) {
|
|
21244
|
+
if (!value || typeof value !== "object") return void 0;
|
|
21245
|
+
const record = value;
|
|
21246
|
+
const appSlug = optionalString3(record, "appSlug");
|
|
21247
|
+
if (!appSlug) return void 0;
|
|
21248
|
+
return {
|
|
21249
|
+
appSlug,
|
|
21250
|
+
connectionUuid: optionalString3(record, "connectionUuid") ?? "",
|
|
21251
|
+
label: optionalString3(record, "label") ?? appSlug,
|
|
21252
|
+
expiresInMinutes: typeof record.expiresInMinutes === "number" ? record.expiresInMinutes : 0
|
|
21253
|
+
};
|
|
21254
|
+
}
|
|
21255
|
+
function parseUiPromptPresented(content) {
|
|
21256
|
+
let value = content;
|
|
21257
|
+
if (typeof value === "string") {
|
|
21258
|
+
const trimmed = value.trim();
|
|
21259
|
+
if (!trimmed.startsWith("{") || !trimmed.includes('"presented"')) return null;
|
|
21260
|
+
try {
|
|
21261
|
+
value = JSON.parse(trimmed);
|
|
21262
|
+
} catch {
|
|
21263
|
+
return null;
|
|
21264
|
+
}
|
|
21265
|
+
}
|
|
21266
|
+
if (!value || typeof value !== "object") return null;
|
|
21267
|
+
const record = value;
|
|
21268
|
+
if (record.status !== "presented") return null;
|
|
21269
|
+
const promptId = optionalString3(record, "promptId");
|
|
21270
|
+
const kind = record.kind;
|
|
21271
|
+
if (!promptId || !isUiPromptKind(kind)) return null;
|
|
21272
|
+
const connect = parseConnect(record.connect);
|
|
21273
|
+
if (kind === "inline_connect" && !connect) return null;
|
|
21274
|
+
return {
|
|
21275
|
+
status: "presented",
|
|
21276
|
+
promptId,
|
|
21277
|
+
kind,
|
|
21278
|
+
userPrompt: optionalString3(record, "userPrompt"),
|
|
21279
|
+
openuiMarkup: optionalString3(record, "openuiMarkup"),
|
|
21280
|
+
description: optionalString3(record, "description"),
|
|
21281
|
+
multi: record.multi === true,
|
|
21282
|
+
// LLM-facing guidance. The CLI never renders it, but it is part of the
|
|
21283
|
+
// result, so it travels rather than being dropped on the floor.
|
|
21284
|
+
instructions: typeof record.instructions === "string" ? record.instructions : "",
|
|
21285
|
+
...connect ? { connect } : {}
|
|
21286
|
+
};
|
|
21287
|
+
}
|
|
21288
|
+
function extractUiPromptPresented(event, toolCallNames) {
|
|
21289
|
+
if (String(event.type ?? "").toUpperCase() !== "TOOL_CALL_RESULT") return null;
|
|
21290
|
+
const toolCallId = String(event.toolCallId ?? event.tool_call_id ?? "");
|
|
21291
|
+
const toolName = event.toolName ?? event.tool_name ?? event.toolCallName ?? toolCallNames?.get(toolCallId);
|
|
21292
|
+
if (!isUiPromptToolName(toolName)) return null;
|
|
21293
|
+
return parseUiPromptPresented(event.content ?? event.result);
|
|
21294
|
+
}
|
|
21295
|
+
|
|
21296
|
+
// src/lib/ui-prompt-terminal.ts
|
|
21297
|
+
function responseAnswer(prompt, body) {
|
|
21298
|
+
return {
|
|
21299
|
+
content: formatUiPromptResponse({ promptId: prompt.promptId, kind: prompt.kind, body }),
|
|
21300
|
+
summary: summarizeUiPromptResponse({ promptId: prompt.promptId, kind: prompt.kind, body })
|
|
21301
|
+
};
|
|
21302
|
+
}
|
|
21303
|
+
async function promptUiPromptTerminal(prompt, opts = {}) {
|
|
21304
|
+
if (prompt.kind === "inline_connect") {
|
|
21305
|
+
if (!prompt.connect) return null;
|
|
21306
|
+
const link = opts.fetchConnectLink ? await opts.fetchConnectLink(prompt.connect.appSlug) : null;
|
|
21307
|
+
const outcome = await promptConnectTerminal({
|
|
21308
|
+
label: prompt.connect.label,
|
|
21309
|
+
connectUrl: link?.connectUrl ?? null,
|
|
21310
|
+
expiresInMinutes: prompt.connect.expiresInMinutes
|
|
21311
|
+
});
|
|
21312
|
+
if (outcome === "declined") {
|
|
21313
|
+
return responseAnswer(prompt, { status: "declined" });
|
|
21314
|
+
}
|
|
21315
|
+
return null;
|
|
21316
|
+
}
|
|
21317
|
+
let result2;
|
|
21318
|
+
try {
|
|
21319
|
+
result2 = await promptOpenUiTerminalResult(
|
|
21320
|
+
// The wire model spells "absent" as null; the renderer's optionals
|
|
21321
|
+
// mean undefined. Normalized at the boundary rather than widened on
|
|
21322
|
+
// the renderer, which has no business knowing the wire has two of them.
|
|
21323
|
+
{
|
|
21324
|
+
userPrompt: prompt.userPrompt ?? void 0,
|
|
21325
|
+
openuiMarkup: prompt.openuiMarkup ?? void 0
|
|
21326
|
+
},
|
|
21327
|
+
{ multi: prompt.multi }
|
|
21328
|
+
);
|
|
21329
|
+
} catch (err) {
|
|
21330
|
+
if (err instanceof OpenUiTerminalAbortError) {
|
|
21331
|
+
return responseAnswer(prompt, { status: "declined" });
|
|
21332
|
+
}
|
|
21333
|
+
throw err;
|
|
21334
|
+
}
|
|
21335
|
+
switch (result2.kind) {
|
|
21336
|
+
case "choice":
|
|
21337
|
+
return responseAnswer(prompt, { status: "submitted", chosenValue: result2.value });
|
|
21338
|
+
case "form":
|
|
21339
|
+
return responseAnswer(prompt, { status: "submitted", values: result2.values });
|
|
21340
|
+
case "declined":
|
|
21341
|
+
return responseAnswer(prompt, { status: "declined" });
|
|
21342
|
+
case "text":
|
|
21343
|
+
return { content: result2.text, summary: result2.text };
|
|
21344
|
+
case "skipped":
|
|
21345
|
+
return null;
|
|
21346
|
+
}
|
|
21347
|
+
}
|
|
21348
|
+
|
|
19256
21349
|
// src/lib/concierge-agui-loop.ts
|
|
19257
|
-
var
|
|
21350
|
+
var MAX_TURN_ROUNDS = 25;
|
|
19258
21351
|
async function runConciergeAguiLoop(client, initialMessages, onEvent, opts) {
|
|
19259
21352
|
let streamText = "";
|
|
19260
21353
|
let hasToolCalls = false;
|
|
19261
21354
|
let errorMessage;
|
|
19262
21355
|
let resume;
|
|
19263
|
-
|
|
21356
|
+
let followUpMessages;
|
|
21357
|
+
const answeredPromptIds = /* @__PURE__ */ new Set();
|
|
21358
|
+
const pendingPrompts = /* @__PURE__ */ new Map();
|
|
21359
|
+
const toolCallNames = /* @__PURE__ */ new Map();
|
|
21360
|
+
for (let round = 0; round < MAX_TURN_ROUNDS; round++) {
|
|
19264
21361
|
let hitlPayload = null;
|
|
19265
21362
|
await client.streamRequest(
|
|
19266
21363
|
resume ? {
|
|
19267
21364
|
messages: [],
|
|
19268
21365
|
resumeValue: resume.resumeValue,
|
|
19269
21366
|
resumeInterruptId: resume.resumeInterruptId
|
|
19270
|
-
} : { messages: initialMessages },
|
|
21367
|
+
} : { messages: followUpMessages ?? initialMessages },
|
|
19271
21368
|
(event) => {
|
|
19272
21369
|
onEvent(event);
|
|
19273
21370
|
const delta = getTextDelta(event);
|
|
19274
21371
|
if (delta) streamText += delta;
|
|
19275
21372
|
const type = event.type?.toLowerCase() ?? "";
|
|
19276
|
-
if (type === "tool_call_start")
|
|
21373
|
+
if (type === "tool_call_start") {
|
|
21374
|
+
hasToolCalls = true;
|
|
21375
|
+
const record = event;
|
|
21376
|
+
const callId = record.toolCallId ?? record.tool_call_id;
|
|
21377
|
+
const name = record.toolCallName ?? record.tool_call_name ?? record.toolName;
|
|
21378
|
+
if (typeof callId === "string" && typeof name === "string") {
|
|
21379
|
+
toolCallNames.set(callId, name);
|
|
21380
|
+
}
|
|
21381
|
+
}
|
|
19277
21382
|
const errorMsg = getErrorMessage(event);
|
|
19278
21383
|
if (errorMsg) {
|
|
19279
21384
|
errorMessage = errorMsg;
|
|
@@ -19282,13 +21387,34 @@ async function runConciergeAguiLoop(client, initialMessages, onEvent, opts) {
|
|
|
19282
21387
|
}
|
|
19283
21388
|
const hitl = extractHumanInputRequest(event);
|
|
19284
21389
|
if (hitl) hitlPayload = hitl;
|
|
21390
|
+
const prompt = extractUiPromptPresented(
|
|
21391
|
+
event,
|
|
21392
|
+
toolCallNames
|
|
21393
|
+
);
|
|
21394
|
+
if (prompt && !answeredPromptIds.has(prompt.promptId)) {
|
|
21395
|
+
pendingPrompts.set(prompt.promptId, prompt);
|
|
21396
|
+
}
|
|
19285
21397
|
},
|
|
19286
21398
|
{ autoApprove: opts.autoApprove }
|
|
19287
21399
|
);
|
|
19288
21400
|
if (!hitlPayload) {
|
|
19289
|
-
break;
|
|
21401
|
+
if (pendingPrompts.size === 0) break;
|
|
21402
|
+
const prompts = [...pendingPrompts.values()];
|
|
21403
|
+
pendingPrompts.clear();
|
|
21404
|
+
const answers = await answerPresentedPrompts(prompts, answeredPromptIds, {
|
|
21405
|
+
...opts,
|
|
21406
|
+
// The prompt names the account but carries no link; the client
|
|
21407
|
+
// fetches the operator's own from the self-access endpoint.
|
|
21408
|
+
fetchConnectLink: (appSlug) => client.fetchInlineConnectLink(appSlug)
|
|
21409
|
+
});
|
|
21410
|
+
if (answers.length === 0) break;
|
|
21411
|
+
followUpMessages = answers;
|
|
21412
|
+
resume = void 0;
|
|
21413
|
+
streamText = "";
|
|
21414
|
+
errorMessage = void 0;
|
|
21415
|
+
continue;
|
|
19290
21416
|
}
|
|
19291
|
-
opts.
|
|
21417
|
+
opts.onTerminalPromptStart?.();
|
|
19292
21418
|
let next;
|
|
19293
21419
|
try {
|
|
19294
21420
|
next = await handleCliHitlInterrupt(hitlPayload, {
|
|
@@ -19299,7 +21425,7 @@ async function runConciergeAguiLoop(client, initialMessages, onEvent, opts) {
|
|
|
19299
21425
|
nonInteractive: opts.nonInteractive
|
|
19300
21426
|
});
|
|
19301
21427
|
} finally {
|
|
19302
|
-
opts.
|
|
21428
|
+
opts.onTerminalPromptEnd?.();
|
|
19303
21429
|
}
|
|
19304
21430
|
if (!next) {
|
|
19305
21431
|
process.stderr.write(
|
|
@@ -19313,11 +21439,30 @@ async function runConciergeAguiLoop(client, initialMessages, onEvent, opts) {
|
|
|
19313
21439
|
};
|
|
19314
21440
|
}
|
|
19315
21441
|
resume = next;
|
|
21442
|
+
followUpMessages = void 0;
|
|
19316
21443
|
streamText = "";
|
|
19317
21444
|
errorMessage = void 0;
|
|
19318
21445
|
}
|
|
19319
21446
|
return { streamText, hasToolCalls, errorMessage };
|
|
19320
21447
|
}
|
|
21448
|
+
async function answerPresentedPrompts(prompts, answeredPromptIds, opts) {
|
|
21449
|
+
const answers = [];
|
|
21450
|
+
opts.onTerminalPromptStart?.();
|
|
21451
|
+
try {
|
|
21452
|
+
for (const prompt of prompts) {
|
|
21453
|
+
answeredPromptIds.add(prompt.promptId);
|
|
21454
|
+
const answer = await promptUiPromptTerminal(prompt, {
|
|
21455
|
+
fetchConnectLink: opts.fetchConnectLink
|
|
21456
|
+
});
|
|
21457
|
+
if (!answer) continue;
|
|
21458
|
+
answers.push({ role: "user", content: answer.content });
|
|
21459
|
+
opts.onPromptAnswered?.(answer.summary);
|
|
21460
|
+
}
|
|
21461
|
+
} finally {
|
|
21462
|
+
opts.onTerminalPromptEnd?.();
|
|
21463
|
+
}
|
|
21464
|
+
return answers;
|
|
21465
|
+
}
|
|
19321
21466
|
function normalizeUnsupportedHitl(raw) {
|
|
19322
21467
|
const payload = raw && typeof raw === "object" ? raw : {};
|
|
19323
21468
|
return {
|
|
@@ -19629,7 +21774,7 @@ var SHOW_CURSOR = `${CSI}?25h`;
|
|
|
19629
21774
|
var ALT_SCREEN_ON = `${CSI}?1049h`;
|
|
19630
21775
|
var ALT_SCREEN_OFF = `${CSI}?1049l`;
|
|
19631
21776
|
var CLEAR_EOL = `${CSI}K`;
|
|
19632
|
-
var
|
|
21777
|
+
var RESET3 = `${CSI}0m`;
|
|
19633
21778
|
var MOUSE_ON = `${CSI}?1000h${CSI}?1006h`;
|
|
19634
21779
|
var MOUSE_OFF = `${CSI}?1000l${CSI}?1006l`;
|
|
19635
21780
|
var BRACKETED_PASTE_ON = `${CSI}?2004h`;
|
|
@@ -19640,7 +21785,7 @@ var GRAY = `${CSI}90m`;
|
|
|
19640
21785
|
var YELLOW = `${CSI}33m`;
|
|
19641
21786
|
var ORANGE = `${CSI}38;5;208m`;
|
|
19642
21787
|
var LIGHT_BLUE = `${CSI}38;5;117m`;
|
|
19643
|
-
var
|
|
21788
|
+
var DIM3 = `${CSI}2m`;
|
|
19644
21789
|
var DIM_ITALIC_GRAY = `${CSI}2;3;90m`;
|
|
19645
21790
|
var RED = `${CSI}31m`;
|
|
19646
21791
|
var CYAN2 = `${CSI}36m`;
|
|
@@ -20217,7 +22362,7 @@ var ChatTUI = class {
|
|
|
20217
22362
|
CLEAR_EOL,
|
|
20218
22363
|
// clear to end handles rest, but we need to position divider
|
|
20219
22364
|
moveTo(msgTop + i, divCol),
|
|
20220
|
-
`${
|
|
22365
|
+
`${DIM3}\u2502${RESET3}`,
|
|
20221
22366
|
debugLine
|
|
20222
22367
|
);
|
|
20223
22368
|
buf.push(CLEAR_EOL);
|
|
@@ -20231,7 +22376,7 @@ var ChatTUI = class {
|
|
|
20231
22376
|
for (let i = 0; i < inputRows; i++) {
|
|
20232
22377
|
const row = startRow + i;
|
|
20233
22378
|
const line = inputLines[i] ?? "";
|
|
20234
|
-
const prefix = i === 0 ? `${BLUE}${INPUT_LABEL}${
|
|
22379
|
+
const prefix = i === 0 ? `${BLUE}${INPUT_LABEL}${RESET3} ` : " ".repeat(INPUT_LABEL_WIDTH);
|
|
20235
22380
|
buf.push(moveTo(row, 1), prefix, line, CLEAR_EOL);
|
|
20236
22381
|
}
|
|
20237
22382
|
}
|
|
@@ -20254,27 +22399,27 @@ var ChatTUI = class {
|
|
|
20254
22399
|
buildTitleBar() {
|
|
20255
22400
|
const parts = [];
|
|
20256
22401
|
if (this.options.title) {
|
|
20257
|
-
parts.push(`${CYAN2}${this.options.title}${
|
|
22402
|
+
parts.push(`${CYAN2}${this.options.title}${RESET3}`);
|
|
20258
22403
|
}
|
|
20259
22404
|
if (this.options.subtitle) {
|
|
20260
|
-
parts.push(`${
|
|
22405
|
+
parts.push(`${DIM3}${this.options.subtitle}${RESET3}`);
|
|
20261
22406
|
}
|
|
20262
22407
|
let status = "";
|
|
20263
22408
|
switch (this.runState) {
|
|
20264
22409
|
case "thinking":
|
|
20265
|
-
status = `${YELLOW}Thinking\u2026${
|
|
22410
|
+
status = `${YELLOW}Thinking\u2026${RESET3}`;
|
|
20266
22411
|
break;
|
|
20267
22412
|
case "tool_running":
|
|
20268
|
-
status = `${YELLOW}Running ${this.activeToolName}\u2026${
|
|
22413
|
+
status = `${YELLOW}Running ${this.activeToolName}\u2026${RESET3}`;
|
|
20269
22414
|
break;
|
|
20270
22415
|
case "streaming":
|
|
20271
|
-
status = `${GREEN2}Writing\u2026${
|
|
22416
|
+
status = `${GREEN2}Writing\u2026${RESET3}`;
|
|
20272
22417
|
break;
|
|
20273
22418
|
default:
|
|
20274
22419
|
break;
|
|
20275
22420
|
}
|
|
20276
22421
|
if (status) parts.push(status);
|
|
20277
|
-
const line = parts.join(` ${
|
|
22422
|
+
const line = parts.join(` ${DIM3}|${RESET3} `);
|
|
20278
22423
|
return truncateAnsi(line, this.cols);
|
|
20279
22424
|
}
|
|
20280
22425
|
// ─── Separator ────────────────────────────────────────────────────
|
|
@@ -20293,13 +22438,13 @@ var ChatTUI = class {
|
|
|
20293
22438
|
hints.push("Enter send");
|
|
20294
22439
|
const lineWidth = Math.min(this.cols, 60);
|
|
20295
22440
|
if (!hints.length) {
|
|
20296
|
-
return `${GRAY}${"\u2500".repeat(lineWidth)}${
|
|
22441
|
+
return `${GRAY}${"\u2500".repeat(lineWidth)}${RESET3}`;
|
|
20297
22442
|
}
|
|
20298
22443
|
const hintStr = ` ${hints.join(" ")} `;
|
|
20299
22444
|
const dashes = Math.max(0, lineWidth - hintStr.length);
|
|
20300
22445
|
const left = Math.max(2, Math.floor(dashes / 2));
|
|
20301
22446
|
const right = Math.max(2, dashes - left);
|
|
20302
|
-
return `${GRAY}${"\u2500".repeat(left)}${hintStr}${"\u2500".repeat(right)}${
|
|
22447
|
+
return `${GRAY}${"\u2500".repeat(left)}${hintStr}${"\u2500".repeat(right)}${RESET3}`;
|
|
20303
22448
|
}
|
|
20304
22449
|
// ─── Chat display line building ───────────────────────────────────
|
|
20305
22450
|
buildDisplayLines() {
|
|
@@ -20323,7 +22468,7 @@ var ChatTUI = class {
|
|
|
20323
22468
|
appendToolCallLines(lines, tc, width) {
|
|
20324
22469
|
const status = tc.done ? "\u2713" : "\u2026";
|
|
20325
22470
|
const verb = tc.done ? "Called" : "Calling";
|
|
20326
|
-
const summary = ` ${tc.done ? GREEN2 : YELLOW}${status}${
|
|
22471
|
+
const summary = ` ${tc.done ? GREEN2 : YELLOW}${status}${RESET3} ${GRAY}${verb} ${tc.name}${RESET3}`;
|
|
20327
22472
|
if (!this.expandDetails) {
|
|
20328
22473
|
lines.push(summary);
|
|
20329
22474
|
return;
|
|
@@ -20338,21 +22483,21 @@ var ChatTUI = class {
|
|
|
20338
22483
|
const indent = " ";
|
|
20339
22484
|
for (const argLine of formatted.split("\n")) {
|
|
20340
22485
|
for (const wl of this.wrapText(argLine, width - indent.length)) {
|
|
20341
|
-
lines.push(`${indent}${GRAY}${wl}${
|
|
22486
|
+
lines.push(`${indent}${GRAY}${wl}${RESET3}`);
|
|
20342
22487
|
}
|
|
20343
22488
|
}
|
|
20344
22489
|
}
|
|
20345
22490
|
}
|
|
20346
22491
|
appendToolResultLines(lines, tr, width) {
|
|
20347
|
-
const mark = tr.failed ? `${RED}\u2717${
|
|
22492
|
+
const mark = tr.failed ? `${RED}\u2717${RESET3}` : `${GREEN2}\u2713${RESET3}`;
|
|
20348
22493
|
if (!this.expandDetails) {
|
|
20349
22494
|
const maxLen = width - 12;
|
|
20350
22495
|
const preview = tr.content.replace(/\n/g, " ").slice(0, maxLen);
|
|
20351
22496
|
const truncated = preview.length < tr.content.length ? "..." : "";
|
|
20352
|
-
lines.push(` ${mark} ${GRAY}${tr.toolName}: ${preview}${truncated}${
|
|
22497
|
+
lines.push(` ${mark} ${GRAY}${tr.toolName}: ${preview}${truncated}${RESET3}`);
|
|
20353
22498
|
return;
|
|
20354
22499
|
}
|
|
20355
|
-
lines.push(` ${mark} ${GRAY}${tr.toolName} result:${
|
|
22500
|
+
lines.push(` ${mark} ${GRAY}${tr.toolName} result:${RESET3}`);
|
|
20356
22501
|
let formatted = tr.content;
|
|
20357
22502
|
try {
|
|
20358
22503
|
formatted = JSON.stringify(JSON.parse(tr.content), null, 2);
|
|
@@ -20361,7 +22506,7 @@ var ChatTUI = class {
|
|
|
20361
22506
|
const indent = " ";
|
|
20362
22507
|
for (const resultLine of formatted.split("\n")) {
|
|
20363
22508
|
for (const wl of this.wrapText(resultLine, width - indent.length)) {
|
|
20364
|
-
lines.push(`${indent}${GRAY}${wl}${
|
|
22509
|
+
lines.push(`${indent}${GRAY}${wl}${RESET3}`);
|
|
20365
22510
|
}
|
|
20366
22511
|
}
|
|
20367
22512
|
}
|
|
@@ -20369,13 +22514,13 @@ var ChatTUI = class {
|
|
|
20369
22514
|
if (msg.role === "system") {
|
|
20370
22515
|
for (const para of msg.content.split("\n")) {
|
|
20371
22516
|
for (const wl of this.wrapText(para, width - 2)) {
|
|
20372
|
-
lines.push(` ${GRAY}${wl}${
|
|
22517
|
+
lines.push(` ${GRAY}${wl}${RESET3}`);
|
|
20373
22518
|
}
|
|
20374
22519
|
}
|
|
20375
22520
|
return;
|
|
20376
22521
|
}
|
|
20377
22522
|
const isUser = msg.role === "user";
|
|
20378
|
-
const label = isUser ? `${BLUE}You:${
|
|
22523
|
+
const label = isUser ? `${BLUE}You:${RESET3} ` : `${GREEN2}Assistant:${RESET3} `;
|
|
20379
22524
|
const labelWidth = isUser ? 5 : 12;
|
|
20380
22525
|
const indent = " ".repeat(labelWidth);
|
|
20381
22526
|
let first = true;
|
|
@@ -20388,25 +22533,25 @@ var ChatTUI = class {
|
|
|
20388
22533
|
}
|
|
20389
22534
|
if (msg.truncationReason) {
|
|
20390
22535
|
const reasonLabel = getTruncationLabel(msg.truncationReason, msg.truncatedAtMs);
|
|
20391
|
-
lines.push(`${indent}${YELLOW}[${reasonLabel}]${
|
|
22536
|
+
lines.push(`${indent}${YELLOW}[${reasonLabel}]${RESET3}`);
|
|
20392
22537
|
const extra = getExtraContent(msg.content, msg.originalContent);
|
|
20393
22538
|
if (extra) {
|
|
20394
22539
|
for (const para of extra.split("\n")) {
|
|
20395
22540
|
for (const wl of this.wrapText(para, width - labelWidth)) {
|
|
20396
|
-
lines.push(`${indent}${DIM_ITALIC_GRAY}${wl}${
|
|
22541
|
+
lines.push(`${indent}${DIM_ITALIC_GRAY}${wl}${RESET3}`);
|
|
20397
22542
|
}
|
|
20398
22543
|
}
|
|
20399
22544
|
}
|
|
20400
22545
|
}
|
|
20401
22546
|
}
|
|
20402
22547
|
appendStreamLines(lines, width) {
|
|
20403
|
-
const label = `${GREEN2}Assistant:${
|
|
22548
|
+
const label = `${GREEN2}Assistant:${RESET3} `;
|
|
20404
22549
|
const labelWidth = 12;
|
|
20405
22550
|
const indent = " ".repeat(labelWidth);
|
|
20406
22551
|
if (!this.streamContent) {
|
|
20407
22552
|
if (this.runState === "thinking" || this.runState === "tool_running") {
|
|
20408
22553
|
const hint2 = this.runState === "tool_running" && this.activeToolName ? `Running ${this.activeToolName}\u2026` : "Thinking\u2026";
|
|
20409
|
-
lines.push(`${label}${YELLOW}${hint2}${
|
|
22554
|
+
lines.push(`${label}${YELLOW}${hint2}${RESET3}`);
|
|
20410
22555
|
} else {
|
|
20411
22556
|
lines.push(label);
|
|
20412
22557
|
}
|
|
@@ -20428,18 +22573,18 @@ var ChatTUI = class {
|
|
|
20428
22573
|
for (const entry of this.debugEntries) {
|
|
20429
22574
|
const color = entry.direction === "in" ? ORANGE : LIGHT_BLUE;
|
|
20430
22575
|
const arrow = entry.direction === "in" ? "\u25BC" : "\u25B2";
|
|
20431
|
-
const prefix = `${
|
|
22576
|
+
const prefix = `${DIM3}${entry.ts}${RESET3} ${color}${arrow}${RESET3} `;
|
|
20432
22577
|
const prefixWidth = entry.ts.length + 3;
|
|
20433
22578
|
if (!this.expandDetails) {
|
|
20434
22579
|
const maxSummary = dw - prefixWidth;
|
|
20435
22580
|
const summaryText = entry.summary.slice(0, maxSummary);
|
|
20436
|
-
lines.push(`${prefix}${color}${summaryText}${
|
|
22581
|
+
lines.push(`${prefix}${color}${summaryText}${RESET3}`);
|
|
20437
22582
|
} else {
|
|
20438
|
-
lines.push(`${prefix}${color}${entry.summary}${
|
|
22583
|
+
lines.push(`${prefix}${color}${entry.summary}${RESET3}`);
|
|
20439
22584
|
const indent = " ".repeat(prefixWidth);
|
|
20440
22585
|
for (const detailLine of entry.detail.split("\n")) {
|
|
20441
22586
|
for (const wl of this.wrapText(detailLine, dw - prefixWidth)) {
|
|
20442
|
-
lines.push(`${indent}${color}${
|
|
22587
|
+
lines.push(`${indent}${color}${DIM3}${wl}${RESET3}`);
|
|
20443
22588
|
}
|
|
20444
22589
|
}
|
|
20445
22590
|
lines.push("");
|
|
@@ -20489,7 +22634,7 @@ function truncateAnsi(s, maxCols) {
|
|
|
20489
22634
|
i++;
|
|
20490
22635
|
}
|
|
20491
22636
|
}
|
|
20492
|
-
return s.slice(0, i) +
|
|
22637
|
+
return s.slice(0, i) + RESET3;
|
|
20493
22638
|
}
|
|
20494
22639
|
function redactAudio(msg) {
|
|
20495
22640
|
if (!msg || typeof msg !== "object") return msg;
|
|
@@ -20565,6 +22710,14 @@ function handleAguiEvent(tui, event) {
|
|
|
20565
22710
|
case "tool_call_result": {
|
|
20566
22711
|
const toolCallId = event.toolCallId ?? "";
|
|
20567
22712
|
const toolName = tui.findToolCallName(toolCallId);
|
|
22713
|
+
const prompt = extractUiPromptPresented(
|
|
22714
|
+
event,
|
|
22715
|
+
/* @__PURE__ */ new Map([[toolCallId, toolName]])
|
|
22716
|
+
);
|
|
22717
|
+
if (prompt) {
|
|
22718
|
+
tui.toolCallResult(toolCallId, toolName, "Waiting for your answer\u2026");
|
|
22719
|
+
break;
|
|
22720
|
+
}
|
|
20568
22721
|
const content = typeof event.content === "string" ? event.content : typeof event.result === "string" ? event.result : JSON.stringify(event.result ?? event.content ?? "");
|
|
20569
22722
|
tui.toolCallResult(toolCallId, toolName, content);
|
|
20570
22723
|
break;
|
|
@@ -20601,7 +22754,7 @@ function createFeedRenderer(tui, isTurnInProgress) {
|
|
|
20601
22754
|
const text = (userMessageBuffers.get(messageId) ?? "").trim();
|
|
20602
22755
|
userMessageBuffers.delete(messageId);
|
|
20603
22756
|
renderedMessageIds.add(messageId);
|
|
20604
|
-
if (text) tui.addUserMessage(text);
|
|
22757
|
+
if (text) tui.addUserMessage(displayUserMessage(text));
|
|
20605
22758
|
}
|
|
20606
22759
|
return;
|
|
20607
22760
|
}
|
|
@@ -21106,8 +23259,11 @@ async function interactiveChatSession(session, debug, autoApprove, allowWrite) {
|
|
|
21106
23259
|
debug,
|
|
21107
23260
|
trustCwd: session.trustCwd,
|
|
21108
23261
|
trustDir: session.trustDir,
|
|
21109
|
-
|
|
21110
|
-
|
|
23262
|
+
onTerminalPromptStart: () => tui.pauseForPrompt(),
|
|
23263
|
+
onTerminalPromptEnd: () => tui.resumeAfterPrompt(),
|
|
23264
|
+
// A prompt answered inline is a message the operator sent; show
|
|
23265
|
+
// it in the transcript the way their typed messages appear.
|
|
23266
|
+
onPromptAnswered: (summary) => tui.addUserMessage(summary)
|
|
21111
23267
|
}
|
|
21112
23268
|
);
|
|
21113
23269
|
if (streamText && !assistantContent) {
|
|
@@ -21178,7 +23334,10 @@ function buildHistory(messages, limit) {
|
|
|
21178
23334
|
const text = typeof msg.content === "string" ? msg.content : "";
|
|
21179
23335
|
if (msg.role === "user" || msg.role === "assistant") {
|
|
21180
23336
|
if (text.trim()) {
|
|
21181
|
-
history.push({
|
|
23337
|
+
history.push({
|
|
23338
|
+
role: msg.role,
|
|
23339
|
+
content: msg.role === "user" ? displayUserMessage(text) : text
|
|
23340
|
+
});
|
|
21182
23341
|
}
|
|
21183
23342
|
if (msg.role === "assistant" && msg.tool_calls) {
|
|
21184
23343
|
for (const tc of msg.tool_calls) {
|
|
@@ -22262,7 +24421,7 @@ var topLevelCommands = [
|
|
|
22262
24421
|
mutates: true,
|
|
22263
24422
|
args: [{ name: "phone", description: "E.164 phone number (optional; prompts if omitted)" }],
|
|
22264
24423
|
handler: async (hctx) => {
|
|
22265
|
-
const { accountVerifyPhoneCommand } = await import("./account-verify-phone-
|
|
24424
|
+
const { accountVerifyPhoneCommand } = await import("./account-verify-phone-5DY6ETMV.js");
|
|
22266
24425
|
await accountVerifyPhoneCommand(hctx);
|
|
22267
24426
|
}
|
|
22268
24427
|
},
|