@treasuredata/tdx 2026.3.25 → 2026.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.d.ts.map +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/oauth.js.map +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.d.ts +5 -0
- package/dist/sdk/segment.d.ts.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/segment.js.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x2d1bab=a30_0x5468;(function(_0x35b21d,_0x3d033b){const _0x453dc8=a30_0x5468,_0xc1ade7=_0x35b21d();while(!![]){try{const _0x10c55c=parseInt(_0x453dc8(0xfd))/0x1*(-parseInt(_0x453dc8(0x1f6))/0x2)+parseInt(_0x453dc8(0x253))/0x3*(parseInt(_0x453dc8(0x1fb))/0x4)+-parseInt(_0x453dc8(0x1f5))/0x5+-parseInt(_0x453dc8(0x14e))/0x6*(-parseInt(_0x453dc8(0x25a))/0x7)+-parseInt(_0x453dc8(0x269))/0x8+-parseInt(_0x453dc8(0x1bd))/0x9+-parseInt(_0x453dc8(0x115))/0xa*(-parseInt(_0x453dc8(0x237))/0xb);if(_0x10c55c===_0x3d033b)break;else _0xc1ade7['push'](_0xc1ade7['shift']());}catch(_0x390357){_0xc1ade7['push'](_0xc1ade7['shift']());}}}(a30_0x2faa,0x969ce));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x44ecf0 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0xc6b51f from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x38c9f0){const _0x460a02=a30_0x5468,_0xb86ca2=process[_0x460a02(0x1ec)],_0x2a17af=_0xb86ca2===_0x460a02(0xf8)?'open':_0xb86ca2===_0x460a02(0x15c)?_0x460a02(0x1a4):_0x460a02(0x1eb);spawn(_0x2a17af,[_0x38c9f0],{'detached':!![],'stdio':_0x460a02(0x182)})[_0x460a02(0x169)]();}function migrateLegacyDirectory(){const _0x22dac5=a30_0x5468;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x5b6e98=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x5b6e98[_0x22dac5(0x1e6)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a30_0xc6b51f[_0x22dac5(0x184)](_0x22dac5(0x270)+LEGACY_PARENT_SEGMENT_DIR+_0x22dac5(0x138)+PARENT_SEGMENT_DIR+_0x22dac5(0x256))),console[_0x22dac5(0x24c)](a30_0xc6b51f[_0x22dac5(0x203)](_0x22dac5(0x1c4)+LEGACY_PARENT_SEGMENT_DIR+_0x22dac5(0x14f))),![];console[_0x22dac5(0x24c)](a30_0xc6b51f[_0x22dac5(0x184)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x22dac5(0x24c)](a30_0xc6b51f[_0x22dac5(0x148)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4101b5){const _0x4d5e57=_0x4101b5 instanceof Error?_0x4101b5['message']:String(_0x4101b5);return console['error'](a30_0xc6b51f[_0x22dac5(0x198)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x4d5e57+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x2d1bab(0x104)](_0x25f3fc){const _0x87153=a30_0x2d1bab;return migrateLegacyDirectory(),super[_0x87153(0x104)](_0x25f3fc);}}function resolveYamlFile(_0x2d307b){const _0x5beb48=a30_0x2d1bab;if(_0x2d307b[_0x5beb48(0x258)](_0x5beb48(0x241))||_0x2d307b[_0x5beb48(0x258)](_0x5beb48(0x195)))return _0x2d307b;return a30_0x44ecf0[_0x5beb48(0x123)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2d307b)+'.yml');}function a30_0x5468(_0x1e5ea2,_0x23976b){_0x1e5ea2=_0x1e5ea2-0xf0;const _0x2faa43=a30_0x2faa();let _0x5468f2=_0x2faa43[_0x1e5ea2];return _0x5468f2;}function formatProgressMessage(_0xb42b25){const _0x3d23e7=a30_0x2d1bab,_0x188f7a=_0xb42b25[_0x3d23e7(0x21c)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x188f7a){const [,_0x4c7f8e,_0x59bb4a,_0x4f59bf='']=_0x188f7a;return a30_0xc6b51f[_0x3d23e7(0x203)](_0x4c7f8e+':')+'\x20'+_0x59bb4a+a30_0xc6b51f[_0x3d23e7(0x203)](_0x4f59bf);}return a30_0xc6b51f[_0x3d23e7(0x203)](_0xb42b25);}function showFileNotFoundError(_0x163835,_0x2f97b8){const _0x3496d7=a30_0x2d1bab;console['error'](a30_0xc6b51f['red'](_0x3496d7(0x100)+_0x163835+'\x0a')),console[_0x3496d7(0x24c)](a30_0xc6b51f[_0x3496d7(0x102)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x2f97b8+_0x3496d7(0x170)));}function displayRealtimeValidation(_0x48175a){const _0x16ff74=a30_0x2d1bab;if(!_0x48175a[_0x16ff74(0x21e)])return;const _0xd9fc7b=_0x48175a[_0x16ff74(0x21e)],_0x4942ed=_0xd9fc7b[_0x16ff74(0x202)]?a30_0xc6b51f['green'](_0x16ff74(0x1a2)):a30_0xc6b51f[_0x16ff74(0x184)](_0x16ff74(0x209));console['error']('\x0a'+a30_0xc6b51f['dim'](_0x16ff74(0x139))+'\x20'+_0x4942ed);if(_0xd9fc7b[_0x16ff74(0x1c5)]&&_0xd9fc7b[_0x16ff74(0x1c5)][_0x16ff74(0x112)]>0x0){console[_0x16ff74(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x16ff74(0x203)](_0x16ff74(0x21a))+'\x20'+_0xd9fc7b['events'][_0x16ff74(0x112)]+_0x16ff74(0x1e2));for(const _0x2f0d9f of _0xd9fc7b['events']){const _0xf48041=_0x2f0d9f[_0x16ff74(0x26a)]===![]?a30_0xc6b51f[_0x16ff74(0x198)]('✘'):a30_0xc6b51f[_0x16ff74(0x148)]('✔');console[_0x16ff74(0x24c)](_0x16ff74(0xf7)+_0xf48041+'\x20'+_0x2f0d9f['name']),_0x2f0d9f[_0x16ff74(0x1ba)]&&console['error']('\x20\x20\x20\x20\x20\x20'+a30_0xc6b51f[_0x16ff74(0x198)](_0x2f0d9f['sourceTableError']));}}if(_0xd9fc7b[_0x16ff74(0x20c)]&&_0xd9fc7b['attributes'][_0x16ff74(0x112)]>0x0){console['error']('\x20\x20'+a30_0xc6b51f[_0x16ff74(0x203)]('Attributes:')+'\x20'+_0xd9fc7b['attributes'][_0x16ff74(0x112)]+_0x16ff74(0x1e2));for(const _0x2c1dbf of _0xd9fc7b['attributes']){const _0x500c26=_0x2c1dbf[_0x16ff74(0x13f)]?a30_0xc6b51f[_0x16ff74(0x148)]('✔'):a30_0xc6b51f['red']('✘');console[_0x16ff74(0x24c)](_0x16ff74(0xf7)+_0x500c26+'\x20'+_0x2c1dbf[_0x16ff74(0xf1)]+'\x20'+a30_0xc6b51f[_0x16ff74(0x203)]('('+_0x2c1dbf['type']+')'));}}if(_0xd9fc7b[_0x16ff74(0x136)]){const _0x4c8aee=_0xd9fc7b[_0x16ff74(0x136)]['stitchingKeys']?.['length']?_0x16ff74(0xff)+_0xd9fc7b[_0x16ff74(0x136)][_0x16ff74(0x281)][_0x16ff74(0x123)](',\x20')+']':'';console[_0x16ff74(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x16ff74(0x203)]('ID\x20Stitching:')+'\x20'+_0xd9fc7b[_0x16ff74(0x136)][_0x16ff74(0x1e8)]+_0x4c8aee);}if(_0xd9fc7b[_0x16ff74(0x1a1)]&&_0xd9fc7b['personalizationServices'][_0x16ff74(0x112)]>0x0){console['error']('\x20\x20'+a30_0xc6b51f[_0x16ff74(0x203)](_0x16ff74(0x16d))+'\x20'+_0xd9fc7b[_0x16ff74(0x1a1)]['length']+'\x20service'+(_0xd9fc7b[_0x16ff74(0x1a1)]['length']!==0x1?'s':''));for(const _0x2ca51a of _0xd9fc7b['personalizationServices']){console[_0x16ff74(0x24c)](_0x16ff74(0xfb)+_0x2ca51a[_0x16ff74(0xf1)]);}}}function showParentSegmentNotSetError(_0x24dda4){const _0x229afa=a30_0x2d1bab;console[_0x229afa(0x24c)](a30_0xc6b51f['yellow'](_0x229afa(0x20d))),console[_0x229afa(0x24c)](_0x24dda4);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x1ee);['description']='List\x20parent\x20segments';async[a30_0x2d1bab(0x26d)](_0x4da55d){const _0x5599f0=a30_0x2d1bab,{options:_0x4b39f6,args:_0x6ff8c3,tdx:_0x44bd5c}=_0x4da55d,_0x2dcdec=_0x6ff8c3[0x0];_0x4b39f6[_0x5599f0(0xf6)]&&(console[_0x5599f0(0x24c)]('Site:\x20'+_0x4b39f6['site']),_0x2dcdec&&console[_0x5599f0(0x24c)](_0x5599f0(0x153)+_0x2dcdec));const _0x4cce35=await withSpinner(_0x2dcdec?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x2dcdec+_0x5599f0(0x27b):_0x5599f0(0x1a3),()=>_0x44bd5c[_0x5599f0(0x10a)][_0x5599f0(0x1da)](),{'verbose':_0x4b39f6['verbose']});let _0x1110d8=_0x4cce35[_0x5599f0(0x1d8)];if(_0x2dcdec){const _0x514527=_0x2dcdec[_0x5599f0(0x1f8)](/[.+^${}()|[\]\\]/g,_0x5599f0(0xfc))[_0x5599f0(0x1f8)](/\*/g,'.*')[_0x5599f0(0x1f8)](/\?/g,'.'),_0x368d01=new RegExp('^'+_0x514527+'$','i');_0x1110d8=_0x1110d8['filter'](_0x53d9fd=>_0x368d01['test'](_0x53d9fd[_0x5599f0(0x20c)][_0x5599f0(0xf1)]));}_0x1110d8[_0x5599f0(0x1de)]((_0x150aec,_0x176f79)=>_0x150aec[_0x5599f0(0x20c)]['name'][_0x5599f0(0x230)](_0x176f79[_0x5599f0(0x20c)][_0x5599f0(0xf1)])),console['error'](_0x5599f0(0x180)+_0x1110d8[_0x5599f0(0x112)]+_0x5599f0(0x263)+(_0x1110d8[_0x5599f0(0x112)]!==0x1?'s':''));const _0x2177bf=_0x1e5366=>{const _0x54c59d=_0x5599f0;return getConsoleNextUrl(_0x4b39f6[_0x54c59d(0x12f)],_0x54c59d(0x20e)+_0x1e5366);};if(_0x4b39f6[_0x5599f0(0x107)]==='json'||_0x4b39f6[_0x5599f0(0x107)]===_0x5599f0(0x1e4)){const _0x544de6=_0x1110d8[_0x5599f0(0x173)](_0x53dfce=>({..._0x53dfce,'url':_0x2177bf(_0x53dfce['id'])}));await handleSDKOutput(_0x544de6,_0x4b39f6);}else{if(_0x1110d8[_0x5599f0(0x112)]===0x0)_0x2dcdec?console[_0x5599f0(0x23f)](_0x5599f0(0x19a)+_0x2dcdec):console[_0x5599f0(0x23f)](_0x5599f0(0x119));else for(const _0x46c759 of _0x1110d8){const _0x329a89=_0x46c759[_0x5599f0(0x20c)][_0x5599f0(0x22f)]?a30_0xc6b51f[_0x5599f0(0x203)]('\x20('+formatRows(_0x46c759['attributes'][_0x5599f0(0x22f)])+')'):'',_0x2bfdbe=hyperlink(_0x46c759[_0x5599f0(0x20c)][_0x5599f0(0xf1)],_0x2177bf(_0x46c759['id']));console[_0x5599f0(0x23f)]('👥\x20'+_0x2bfdbe+_0x329a89);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x183);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x1fa);async[a30_0x2d1bab(0x26d)](_0x57aa21){const _0x6d56a8=a30_0x2d1bab,{options:_0xa70f67,args:_0x22b9d1,tdx:_0x6f070e}=_0x57aa21;console[_0x6d56a8(0x24c)](_0x6d56a8(0x1b7)+_0x6d56a8(0x20f)+_0x6d56a8(0x1c7));const _0xfda8af=_0xa70f67;if(_0x22b9d1[_0x6d56a8(0x112)]===0x0)return console[_0x6d56a8(0x24c)](a30_0xc6b51f[_0x6d56a8(0x198)](_0x6d56a8(0x14b))),console[_0x6d56a8(0x24c)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x277966=_0x22b9d1[0x0];if(!_0xfda8af[_0x6d56a8(0x13d)]||!_0xfda8af[_0x6d56a8(0x262)])return console[_0x6d56a8(0x24c)](_0x6d56a8(0x120)),console['error'](_0x6d56a8(0x229)),0x1;_0xfda8af[_0x6d56a8(0xf6)]&&(console[_0x6d56a8(0x24c)](_0x6d56a8(0x1ce)+_0xfda8af[_0x6d56a8(0x12f)]),console['error'](_0x6d56a8(0x19f)+_0x277966),console['error'](_0x6d56a8(0x10b)+_0xfda8af['database']),console[_0x6d56a8(0x24c)](_0x6d56a8(0x135)+_0xfda8af[_0x6d56a8(0x262)]));const _0x37ecd4=await loadJSONFromOptions(_0xfda8af[_0x6d56a8(0x20c)],_0xfda8af[_0x6d56a8(0x25c)]),_0x42c6b2=await loadJSONFromOptions(_0xfda8af[_0x6d56a8(0x218)],_0xfda8af[_0x6d56a8(0x156)]),_0x19183b=await loadJSONFromOptions(_0xfda8af['customerGroup'],_0xfda8af[_0x6d56a8(0xf2)]),_0xc56ae6={'name':_0x277966,'description':_0xfda8af[_0x6d56a8(0x1f1)],'scheduleType':_0xfda8af['scheduleType'],'scheduleOption':_0xfda8af[_0x6d56a8(0xf9)],'timezone':_0xfda8af[_0x6d56a8(0x168)],'master':{'parentDatabaseName':_0xfda8af[_0x6d56a8(0x13d)],'parentTableName':_0xfda8af[_0x6d56a8(0x262)]},'attributes':_0x37ecd4,'behaviors':_0x42c6b2,'customerGroup':_0x19183b},_0x3c1aba=await withSpinner(_0x6d56a8(0x1ac)+_0x277966+_0x6d56a8(0x27b),()=>_0x6f070e[_0x6d56a8(0x10a)][_0x6d56a8(0x167)](_0xc56ae6),{'verbose':_0xa70f67[_0x6d56a8(0xf6)]}),_0xc63a1b=_0x3c1aba[_0x6d56a8(0x1d8)];return console['error'](_0x6d56a8(0x164)+_0xc63a1b['name']+_0x6d56a8(0xf5)+_0xc63a1b['id']),await handleSDKOutput([_0xc63a1b],_0xa70f67),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x10f);['description']=a30_0x2d1bab(0x1b1);async[a30_0x2d1bab(0x26d)](_0x53d35b){const _0x116657=a30_0x2d1bab,{options:_0x3c9692,args:_0x3b9499,tdx:_0xe7291}=_0x53d35b;console['error'](_0x116657(0x118)+_0x116657(0x20f)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x44b27d=_0x3c9692;if(_0x3b9499[_0x116657(0x112)]===0x0)return console['error'](a30_0xc6b51f[_0x116657(0x198)](_0x116657(0x14b))),console['error'](_0x116657(0x190)),0x1;const _0xe7a0fe=_0x3b9499[0x0];_0x44b27d[_0x116657(0xf6)]&&(console['error'](_0x116657(0x1ce)+_0x44b27d['site']),console[_0x116657(0x24c)](_0x116657(0x1a6)+_0xe7a0fe));const _0x2952f0=await withSpinner(_0x116657(0x242)+_0xe7a0fe+_0x116657(0x27b),()=>_0xe7291['segment'][_0x116657(0x12b)](_0xe7a0fe),{'verbose':_0x44b27d['verbose']}),_0x40def0=_0x2952f0[_0x116657(0x1d8)],_0x3dd11b=await loadJSONFromOptions(_0x44b27d[_0x116657(0x252)],_0x44b27d[_0x116657(0x1f9)]),_0x2c553d=await loadJSONFromOptions(_0x44b27d[_0x116657(0x162)],_0x44b27d['addBehaviorsFile']),_0x4171ef={'name':_0x40def0[_0x116657(0xf1)],'description':_0x44b27d[_0x116657(0x1f1)]!==undefined?_0x44b27d[_0x116657(0x1f1)]:_0x40def0[_0x116657(0x1f1)],'scheduleType':_0x44b27d[_0x116657(0x268)]!==undefined?_0x44b27d[_0x116657(0x268)]:_0x40def0[_0x116657(0x268)],'scheduleOption':_0x44b27d['scheduleOption']!==undefined?_0x44b27d['scheduleOption']:_0x40def0[_0x116657(0xf9)],'timezone':_0x44b27d[_0x116657(0x168)]!==undefined?_0x44b27d['timezone']:_0x40def0[_0x116657(0x168)],'master':_0x40def0['master'],'attributes':_0x3dd11b?[..._0x40def0[_0x116657(0x20c)]||[],..._0x3dd11b]:_0x40def0[_0x116657(0x20c)],'behaviors':_0x2c553d?[..._0x40def0['behaviors']||[],..._0x2c553d]:_0x40def0[_0x116657(0x218)],'customerGroup':_0x40def0['customerGroup']},_0x21a1cb=await withSpinner(_0x116657(0x15b)+_0xe7a0fe+_0x116657(0x27b),()=>_0xe7291[_0x116657(0x10a)][_0x116657(0x214)](_0xe7a0fe,_0x4171ef),{'verbose':_0x44b27d[_0x116657(0xf6)]}),_0x9a2fb2=_0x21a1cb['data'];return console['error'](_0x116657(0x126)+_0x9a2fb2[_0x116657(0xf1)]+'\x27'),await handleSDKOutput([_0x9a2fb2],_0x44b27d),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a30_0x2d1bab(0x197);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x134);async['execute'](_0x517a30){const _0xc3f022=a30_0x2d1bab,{options:_0xf17de5,args:_0x3888bf,tdx:_0x29e4c3}=_0x517a30,_0x550f6b=_0xf17de5,_0x26f4ff=_0x3888bf[0x0]||_0xf17de5[_0xc3f022(0x1c8)];if(!_0x26f4ff)return showParentSegmentNotSetError(_0xc3f022(0x16c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x550f6b[_0xc3f022(0x26e)]&&_0x550f6b[_0xc3f022(0x249)])return console[_0xc3f022(0x24c)](a30_0xc6b51f[_0xc3f022(0x198)](_0xc3f022(0x275))),console[_0xc3f022(0x24c)](a30_0xc6b51f[_0xc3f022(0x203)](_0xc3f022(0x121))),console[_0xc3f022(0x24c)](a30_0xc6b51f['dim'](_0xc3f022(0x22d)+PARENT_SEGMENT_DIR+_0xc3f022(0x1ae))),console[_0xc3f022(0x24c)](a30_0xc6b51f[_0xc3f022(0x102)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0xccf6ff=_0x550f6b[_0xc3f022(0x249)]||a30_0x44ecf0[_0xc3f022(0x123)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x26f4ff)+'.yml');_0x550f6b[_0xc3f022(0xf6)]&&(console['error'](_0xc3f022(0x1ce)+_0x550f6b['site']),console[_0xc3f022(0x24c)](_0xc3f022(0x1a6)+_0x26f4ff),console[_0xc3f022(0x24c)]('Output\x20file:\x20'+_0xccf6ff));const _0x2255b9=await withSpinner(_0xc3f022(0x271)+_0x26f4ff+_0xc3f022(0x27b),()=>_0x29e4c3['segment'][_0xc3f022(0x142)](_0x26f4ff),{'verbose':_0x550f6b[_0xc3f022(0xf6)]}),_0x443b46=_0x2255b9[_0xc3f022(0x1d8)];if(existsSync(_0xccf6ff)){const _0x28578f=readFileSync(_0xccf6ff,_0xc3f022(0x24f)),_0xc3357=generateDiff(_0x28578f,_0x443b46);if(!hasChanges(_0xc3357))console['error'](a30_0xc6b51f['green']('✔')+'\x20No\x20changes\x20-\x20'+a30_0xc6b51f[_0xc3f022(0x102)](_0xccf6ff)+_0xc3f022(0x1d3));else{console[_0xc3f022(0x24c)](_0xc3f022(0x151)+_0xccf6ff+'\x27:'),console[_0xc3f022(0x24c)]('─'[_0xc3f022(0x221)](0x3c)),console[_0xc3f022(0x24c)](formatDiffWithColors(_0xc3357)),console['error']('─'[_0xc3f022(0x221)](0x3c));if(!_0x550f6b[_0xc3f022(0x1d5)]){if(!isInteractive())return console[_0xc3f022(0x24c)](a30_0xc6b51f['red'](_0xc3f022(0x1a0)),_0xc3f022(0x17c)),console[_0xc3f022(0x24c)](a30_0xc6b51f['dim'](_0xc3f022(0x10e))),0x1;const _0x5500a7=await confirmKey(_0xc3f022(0x1c9)+_0xccf6ff+'\x27?');if(!_0x5500a7)return console[_0xc3f022(0x24c)](a30_0xc6b51f[_0xc3f022(0x184)](_0xc3f022(0x131))),0x1;}writeFileSync(_0xccf6ff,_0x443b46,_0xc3f022(0x24f)),console[_0xc3f022(0x24c)](a30_0xc6b51f[_0xc3f022(0x148)]('✔')+_0xc3f022(0x194)+a30_0xc6b51f[_0xc3f022(0x102)](_0xccf6ff));}}else{const _0x37cca2=a30_0x44ecf0[_0xc3f022(0x152)](_0xccf6ff);!existsSync(_0x37cca2)&&mkdirSync(_0x37cca2,{'recursive':!![]}),writeFileSync(_0xccf6ff,_0x443b46,_0xc3f022(0x24f)),console['error'](a30_0xc6b51f[_0xc3f022(0x148)]('✔')+_0xc3f022(0x194)+a30_0xc6b51f[_0xc3f022(0x102)](_0xccf6ff));}return saveSessionContext({'parent_segment':_0x26f4ff},_0x550f6b[_0xc3f022(0x129)]),console[_0xc3f022(0x24c)](a30_0xc6b51f['green']('✔')+'\x20Context\x20set:\x20'+a30_0xc6b51f[_0xc3f022(0x203)](_0xc3f022(0x199))+_0xc3f022(0x161)+a30_0xc6b51f['cyan'](_0x26f4ff)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x2d1bab(0xf1)]='segment:parent:push';[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x266);async[a30_0x2d1bab(0x26d)](_0x3a054c){const _0x1d107b=a30_0x2d1bab,{options:_0x94deb,args:_0x259b46,tdx:_0x247d29}=_0x3a054c,_0x33ab80=_0x94deb,_0x1b122b=_0x259b46[0x0]||_0x94deb[_0x1d107b(0x1c8)];if(!_0x1b122b)return showParentSegmentNotSetError(_0x1d107b(0x204)+_0x1d107b(0x125)),0x1;const _0x133711=resolveYamlFile(_0x1b122b);if(!existsSync(_0x133711))return showFileNotFoundError(_0x133711,_0x1b122b),0x1;_0x33ab80[_0x1d107b(0xf6)]&&(console[_0x1d107b(0x24c)]('Site:\x20'+_0x33ab80[_0x1d107b(0x12f)]),console[_0x1d107b(0x24c)]('YAML\x20file:\x20'+_0x133711));let _0x222152;try{_0x222152=readFileSync(_0x133711,_0x1d107b(0x24f));}catch(_0x43e3c8){const _0x50cd74=_0x43e3c8 instanceof Error?_0x43e3c8['message']:String(_0x43e3c8);return console['error'](_0x1d107b(0x264)+_0x50cd74),0x1;}const _0xa0c8c5=await withSpinner(_0x1d107b(0x15a),()=>_0x247d29[_0x1d107b(0x10a)][_0x1d107b(0x1cc)](_0x222152),{'verbose':_0x33ab80[_0x1d107b(0xf6)]}),_0x2cd64d=_0xa0c8c5['data'],{isNew:_0x496015,name:_0x28c07d,hasChanges:_0x1995a0,diffFormatted:_0x5375cf}=_0x2cd64d;if(!_0x1995a0)return console[_0x1d107b(0x24c)](_0x1d107b(0x18d)+_0x28c07d+_0x1d107b(0x246)),0x0;_0x496015?console[_0x1d107b(0x24c)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x28c07d+'\x27:'):console[_0x1d107b(0x24c)](_0x1d107b(0x110)+_0x28c07d+'\x27:');console['error']('─'[_0x1d107b(0x221)](0x3c)),console[_0x1d107b(0x24c)](_0x5375cf),console[_0x1d107b(0x24c)]('─'[_0x1d107b(0x221)](0x3c));const _0x380105=_0x496015?'Create\x20parent\x20segment\x20\x27'+_0x28c07d+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x28c07d+'\x27?';if(!_0x33ab80['yes']){if(!isInteractive())return console[_0x1d107b(0x24c)](a30_0xc6b51f['red']('\x0aError:'),_0x1d107b(0x17c)),console[_0x1d107b(0x24c)](a30_0xc6b51f[_0x1d107b(0x203)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x37f17e=await confirmKey(_0x380105);if(!_0x37f17e)return console['error'](a30_0xc6b51f[_0x1d107b(0x184)]('Aborted.')),0x1;}const _0x21d856=_0x496015?_0x1d107b(0x261):_0x1d107b(0x105),_0x5df73d=await withSpinner(_0x21d856+_0x1d107b(0x210)+_0x28c07d+'\x27...',()=>_0x2cd64d[_0x1d107b(0x19d)](),{'verbose':_0x33ab80['verbose']}),_0x565f6c=_0x5df73d['data'],_0x253d88=getConsoleNextUrl(_0x33ab80[_0x1d107b(0x12f)],_0x1d107b(0x20e)+_0x565f6c['id']),_0x42b0c8=_0x496015?_0x1d107b(0x144):_0x1d107b(0x10c);return console[_0x1d107b(0x24c)]('✔\x20'+_0x42b0c8+'\x20parent\x20segment\x20\x27'+_0x565f6c[_0x1d107b(0xf1)]+'\x27'),console[_0x1d107b(0x24c)]('\x20\x20'+_0x253d88),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x208);['description']=a30_0x2d1bab(0x1fd);async[a30_0x2d1bab(0x26d)](_0x2a8b67){const _0x3e9afe=a30_0x2d1bab,{options:_0x56bf05,args:_0x11a45e,tdx:_0xff95c4}=_0x2a8b67,_0x55697b=_0x56bf05,_0x427d58=_0x11a45e[0x0]||_0x56bf05[_0x3e9afe(0x1c8)];if(!_0x427d58)return showParentSegmentNotSetError(_0x3e9afe(0x1a5)+_0x3e9afe(0x22e)+_0x3e9afe(0x251)+_0x3e9afe(0x147)+_0x3e9afe(0x187)+_0x3e9afe(0x1dc)),0x1;const _0x1610e9=resolveYamlFile(_0x427d58);if(!existsSync(_0x1610e9))return showFileNotFoundError(_0x1610e9,_0x427d58),0x1;_0x55697b[_0x3e9afe(0xf6)]&&(console[_0x3e9afe(0x24c)](_0x3e9afe(0x1ce)+_0x55697b['site']),console[_0x3e9afe(0x24c)](_0x3e9afe(0x27d)+_0x1610e9));let _0xa51d1;try{_0xa51d1=readFileSync(_0x1610e9,_0x3e9afe(0x24f));}catch(_0x352564){const _0x50c4e6=_0x352564 instanceof Error?_0x352564['message']:String(_0x352564);return console[_0x3e9afe(0x24c)](_0x3e9afe(0x264)+_0x50c4e6),0x1;}const _0x3f5333=createCommandSpinner(a30_0xc6b51f[_0x3e9afe(0x203)](_0x3e9afe(0x201)),{'verbose':_0x55697b[_0x3e9afe(0xf6)]});_0x3f5333[_0x3e9afe(0x1a4)]();const _0x2a66b3={'onProgress':_0x40c158=>{const _0x2c1b85=_0x3e9afe;_0x3f5333[_0x2c1b85(0x1e7)]=formatProgressMessage(_0x40c158);}};if(_0x55697b[_0x3e9afe(0x24a)])_0x2a66b3[_0x3e9afe(0x24a)]=!![];if(_0x55697b[_0x3e9afe(0x27a)])_0x2a66b3['enriched']=!![];_0x55697b[_0x3e9afe(0x22b)]&&(_0x2a66b3['attribute']=_0x55697b[_0x3e9afe(0x22b)]);_0x55697b['behavior']&&(_0x2a66b3['behavior']=_0x55697b[_0x3e9afe(0x160)]);if(_0x55697b[_0x3e9afe(0x1e1)])_0x2a66b3[_0x3e9afe(0x1e1)]=_0x55697b[_0x3e9afe(0x1e1)];let _0x457ee8;try{_0x457ee8=await _0xff95c4[_0x3e9afe(0x10a)][_0x3e9afe(0x13a)](_0xa51d1,_0x2a66b3),_0x3f5333[_0x3e9afe(0x250)]();}catch(_0xb4782c){_0x3f5333[_0x3e9afe(0x250)]();throw _0xb4782c;}const _0x41b881=_0x55697b[_0x3e9afe(0x1e1)]||_0x3e9afe(0x109);return this[_0x3e9afe(0x1cd)](_0x457ee8,_0x2a66b3,_0x1610e9,_0x41b881),_0x457ee8[_0x3e9afe(0x11d)]?0x0:0x1;}[a30_0x2d1bab(0x1cd)](_0x2d5cdd,_0x580607,_0x22033c,_0x51a804){const _0x4cffb2=a30_0x2d1bab;console[_0x4cffb2(0x24c)]('\x0a'+a30_0xc6b51f[_0x4cffb2(0x18b)](_0x4cffb2(0x21b))+'\x20'+_0x2d5cdd['name']),console[_0x4cffb2(0x24c)]('═'[_0x4cffb2(0x221)](0x3c)),this[_0x4cffb2(0x1b4)](_0x2d5cdd);if(typeof _0x580607[_0x4cffb2(0x22b)]===_0x4cffb2(0x24b)){this[_0x4cffb2(0x22a)](_0x2d5cdd),this[_0x4cffb2(0x14d)](_0x2d5cdd),this[_0x4cffb2(0x1fe)](_0x22033c,_0x51a804,_0x4cffb2(0x22b),_0x580607[_0x4cffb2(0x22b)]);return;}if(_0x580607[_0x4cffb2(0x22b)]===!![]){this['displayAttributesStats'](_0x2d5cdd),this['displaySummary'](_0x2d5cdd),this[_0x4cffb2(0x1fe)](_0x22033c,_0x51a804,'attributes');return;}if(typeof _0x580607[_0x4cffb2(0x160)]===_0x4cffb2(0x24b)){this[_0x4cffb2(0x1b8)](_0x2d5cdd,_0x51a804),this[_0x4cffb2(0x14d)](_0x2d5cdd),this[_0x4cffb2(0x1fe)](_0x22033c,_0x51a804,'behavior',_0x580607[_0x4cffb2(0x160)]);return;}if(_0x580607[_0x4cffb2(0x160)]===!![]){this[_0x4cffb2(0x1b8)](_0x2d5cdd,_0x51a804),this[_0x4cffb2(0x14d)](_0x2d5cdd),this[_0x4cffb2(0x1fe)](_0x22033c,_0x51a804,_0x4cffb2(0x218));return;}this['displayAttributesStats'](_0x2d5cdd),this['displayBehaviorsStats'](_0x2d5cdd,_0x51a804),this['displayRealtimeInfo'](_0x2d5cdd),this[_0x4cffb2(0x14d)](_0x2d5cdd),this[_0x4cffb2(0x1fe)](_0x22033c,_0x51a804,'all');}[a30_0x2d1bab(0x1d9)](_0x4a3727){displayRealtimeValidation(_0x4a3727);}[a30_0x2d1bab(0x1fe)](_0x1593da,_0x163170,_0x150a19,_0x59fc1f){const _0x316122=a30_0x2d1bab;console[_0x316122(0x24c)]('\x0a'+a30_0xc6b51f['dim'](_0x316122(0x235)));const _0x50bd8a=_0x163170!==_0x316122(0x109)?_0x316122(0x174)+_0x163170:'';if(_0x150a19===_0x316122(0x22b)&&_0x59fc1f)console[_0x316122(0x24c)]('\x20\x20'+a30_0xc6b51f['dim'](_0x316122(0x103)+_0x1593da+_0x316122(0x213)+_0x59fc1f+'\x22'+_0x50bd8a));else{if(_0x150a19==='behavior'&&_0x59fc1f)console[_0x316122(0x24c)]('\x20\x20'+a30_0xc6b51f['dim'](_0x316122(0x103)+_0x1593da+_0x316122(0x18c)+_0x59fc1f+'\x22'+_0x50bd8a));else(_0x150a19===_0x316122(0x20c)||_0x150a19===_0x316122(0x114))&&console[_0x316122(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x316122(0x203)](_0x316122(0x103)+_0x1593da+_0x316122(0x225)+_0x50bd8a));}(_0x150a19===_0x316122(0x218)||_0x150a19==='all')&&console[_0x316122(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x316122(0x203)](_0x316122(0x103)+_0x1593da+_0x316122(0x1b0)+_0x50bd8a)),_0x150a19==='all'&&console[_0x316122(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x316122(0x203)](_0x316122(0x103)+_0x1593da+_0x316122(0x158)+_0x50bd8a));}[a30_0x2d1bab(0x1b4)](_0x110b85){const _0x34ca28=a30_0x2d1bab,{master:_0xf392e1}=_0x110b85,_0xceb623=_0xf392e1[_0x34ca28(0x277)]?a30_0xc6b51f[_0x34ca28(0x148)]('✔'):a30_0xc6b51f[_0x34ca28(0x198)]('✘');console[_0x34ca28(0x24c)]('\x0a'+a30_0xc6b51f[_0x34ca28(0x203)](_0x34ca28(0x25b))),console[_0x34ca28(0x24c)](_0xceb623+'\x20'+a30_0xc6b51f[_0x34ca28(0x18b)](_0xf392e1[_0x34ca28(0x13d)]+'.'+_0xf392e1[_0x34ca28(0x262)])),_0xf392e1[_0x34ca28(0x277)]?_0xf392e1['rowCount']!==undefined&&console[_0x34ca28(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x34ca28(0x203)](_0x34ca28(0x219))+'\x20'+a30_0xc6b51f['cyan'](formatRows(_0xf392e1[_0x34ca28(0x1d2)]))):console[_0x34ca28(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x34ca28(0x198)](_0x34ca28(0x276))+'\x20'+_0xf392e1['schemaError']);}['displayAttributesStats'](_0x4507bc){const _0x11bdb6=a30_0x2d1bab;if(_0x4507bc['attributes'][_0x11bdb6(0x112)]===0x0)return;console[_0x11bdb6(0x24c)]('\x0a'+a30_0xc6b51f['dim'](_0x11bdb6(0x13c)));for(const _0x314ff8 of _0x4507bc[_0x11bdb6(0x20c)]){const _0x3fcac0=_0x314ff8[_0x11bdb6(0x277)]?a30_0xc6b51f[_0x11bdb6(0x148)]('✔'):a30_0xc6b51f[_0x11bdb6(0x198)]('✘');let _0xd7b9a6='';if(_0x314ff8[_0x11bdb6(0x277)]&&_0x314ff8[_0x11bdb6(0x13b)]!==undefined&&_0x314ff8[_0x11bdb6(0x25f)]!==undefined){const _0x4bf632=_0x314ff8[_0x11bdb6(0x25f)][_0x11bdb6(0x227)](0x1),_0x4e4830=_0x314ff8[_0x11bdb6(0x25f)]>=0x50?a30_0xc6b51f['green']:_0x314ff8['coveragePercent']>=0x32?a30_0xc6b51f[_0x11bdb6(0x184)]:a30_0xc6b51f[_0x11bdb6(0x198)];_0xd7b9a6='\x20'+a30_0xc6b51f[_0x11bdb6(0x203)](_0x11bdb6(0x234))+'\x20'+_0x4e4830(_0x4bf632+'%')+'\x20('+formatRows(_0x314ff8[_0x11bdb6(0x13b)])+_0x11bdb6(0x1ed);}console[_0x11bdb6(0x24c)](_0x3fcac0+'\x20'+a30_0xc6b51f[_0x11bdb6(0x18b)](_0x314ff8[_0x11bdb6(0xf1)])+_0xd7b9a6),console[_0x11bdb6(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x11bdb6(0x203)](_0x11bdb6(0x25d))+'\x20'+a30_0xc6b51f[_0x11bdb6(0x18b)](_0x314ff8[_0x11bdb6(0x13d)]+'.'+_0x314ff8[_0x11bdb6(0x262)]));const _0x5a4149=_0x314ff8[_0x11bdb6(0x1a7)]===_0x314ff8['foreignKey']?a30_0xc6b51f[_0x11bdb6(0x203)]('Join\x20on:')+'\x20'+_0x314ff8[_0x11bdb6(0x1a7)]:a30_0xc6b51f[_0x11bdb6(0x203)](_0x11bdb6(0x149))+'\x20'+_0x314ff8[_0x11bdb6(0x1a7)]+_0x11bdb6(0x161)+_0x314ff8[_0x11bdb6(0x25e)];console[_0x11bdb6(0x24c)]('\x20\x20'+_0x5a4149),console[_0x11bdb6(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x11bdb6(0x203)](_0x11bdb6(0x211))),this[_0x11bdb6(0x21d)](_0x314ff8[_0x11bdb6(0x1d4)]),!_0x314ff8[_0x11bdb6(0x277)]&&console[_0x11bdb6(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x11bdb6(0x198)](_0x11bdb6(0x276))+'\x20'+_0x314ff8[_0x11bdb6(0x1b2)]);}}['displayBehaviorsStats'](_0x366e96,_0x538f5f){const _0x584820=a30_0x2d1bab;if(_0x366e96[_0x584820(0x218)]['length']===0x0)return;console[_0x584820(0x24c)]('\x0a'+a30_0xc6b51f[_0x584820(0x203)](_0x584820(0x24d))+'\x20'+a30_0xc6b51f[_0x584820(0x203)]('('+_0x538f5f+')'));for(const _0x1a8996 of _0x366e96[_0x584820(0x218)]){const _0x11a8da=_0x1a8996[_0x584820(0x277)]?a30_0xc6b51f['green']('✔'):a30_0xc6b51f['red']('✘');let _0x32c948='';if(_0x1a8996[_0x584820(0x277)]&&_0x1a8996[_0x584820(0x20b)]!==undefined&&_0x1a8996[_0x584820(0x12a)]!==undefined){const _0x3edfe7=_0x1a8996[_0x584820(0x228)]?.[_0x584820(0x227)](0x1)||'?',_0x597b1c=(_0x1a8996[_0x584820(0x228)]??0x0)>=0x32?a30_0xc6b51f[_0x584820(0x148)]:(_0x1a8996[_0x584820(0x228)]??0x0)>=0x14?a30_0xc6b51f[_0x584820(0x184)]:a30_0xc6b51f['red'];_0x32c948='\x20'+a30_0xc6b51f['dim']('Customers:')+'\x20'+_0x597b1c(formatRows(_0x1a8996['customersWithEvents']))+'\x20('+_0x3edfe7+_0x584820(0x196)+a30_0xc6b51f[_0x584820(0x203)](_0x584820(0x21a))+'\x20'+a30_0xc6b51f[_0x584820(0x102)](formatRows(_0x1a8996['totalEvents']));}console['error'](_0x11a8da+'\x20'+a30_0xc6b51f[_0x584820(0x18b)](_0x1a8996[_0x584820(0xf1)])+_0x32c948),console['error']('\x20\x20'+a30_0xc6b51f[_0x584820(0x203)](_0x584820(0x25d))+'\x20'+a30_0xc6b51f[_0x584820(0x18b)](_0x1a8996[_0x584820(0x13d)]+'.'+_0x1a8996['table']));const _0x55054b=_0x1a8996[_0x584820(0x1a7)]===_0x1a8996[_0x584820(0x25e)]?a30_0xc6b51f[_0x584820(0x203)](_0x584820(0xfa))+'\x20'+_0x1a8996[_0x584820(0x1a7)]:a30_0xc6b51f[_0x584820(0x203)](_0x584820(0x149))+'\x20'+_0x1a8996[_0x584820(0x1a7)]+_0x584820(0x161)+_0x1a8996[_0x584820(0x25e)];console[_0x584820(0x24c)]('\x20\x20'+_0x55054b),console[_0x584820(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x584820(0x203)](_0x584820(0x211))),this['displayColumns'](_0x1a8996[_0x584820(0x1d4)]),!_0x1a8996['schemaValid']&&console[_0x584820(0x24c)]('\x20\x20'+a30_0xc6b51f['red'](_0x584820(0x276))+'\x20'+_0x1a8996[_0x584820(0x1b2)]);}}[a30_0x2d1bab(0x21d)](_0x2e356a){const _0x4cf253=a30_0x2d1bab;for(const _0x47bf59 of _0x2e356a){_0x47bf59[_0x4cf253(0x206)]===_0x47bf59['column']||_0x47bf59['column']==='*'?console[_0x4cf253(0x24c)]('\x20\x20\x20\x20-\x20'+_0x47bf59['label']):console[_0x4cf253(0x24c)]('\x20\x20\x20\x20-\x20'+_0x47bf59[_0x4cf253(0x206)]+'\x20'+a30_0xc6b51f[_0x4cf253(0x203)]('('+_0x47bf59[_0x4cf253(0x1ff)]+')'));}}[a30_0x2d1bab(0x14d)](_0x471531){const _0x307009=a30_0x2d1bab;console[_0x307009(0x24c)]('─'['repeat'](0x3c));if(_0x471531[_0x307009(0x11c)][_0x307009(0x112)]>0x0){console[_0x307009(0x24c)]('\x0a'+a30_0xc6b51f['red'](_0x307009(0x177)));for(const _0x2ffea9 of _0x471531[_0x307009(0x11c)]){console[_0x307009(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x307009(0x198)]('•')+'\x20'+_0x2ffea9);}}_0x471531['allValid']&&console[_0x307009(0x24c)]('\x0a'+a30_0xc6b51f[_0x307009(0x148)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0xfe);['description']=a30_0x2d1bab(0x232);async[a30_0x2d1bab(0x26d)](_0x51b80a){const _0x53b7b9=a30_0x2d1bab,{options:_0x592e77,args:_0x3226db,tdx:_0x253218}=_0x51b80a,_0x4b0960=_0x592e77,_0x289714=_0x3226db[0x0]||_0x592e77[_0x53b7b9(0x1c8)];if(!_0x289714)return showParentSegmentNotSetError(_0x53b7b9(0x137)+_0x53b7b9(0x165)+_0x53b7b9(0x122)+_0x53b7b9(0x260)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x53b7b9(0x1c1)+_0x53b7b9(0x17e)+_0x53b7b9(0x1dc)),0x1;if(!_0x4b0960['master']&&!_0x4b0960['attribute']&&!_0x4b0960[_0x53b7b9(0x160)]&&!_0x4b0960[_0x53b7b9(0x27a)])return console[_0x53b7b9(0x24c)](a30_0xc6b51f[_0x53b7b9(0x198)](_0x53b7b9(0x178))),console[_0x53b7b9(0x24c)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x53b7b9(0x24c)]('Options:'),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x53b7b9(0x24c)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x53b7b9(0x24c)](_0x53b7b9(0x116)),console[_0x53b7b9(0x24c)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x18b301=resolveYamlFile(_0x289714);if(!existsSync(_0x18b301))return showFileNotFoundError(_0x18b301,_0x289714),0x1;_0x4b0960[_0x53b7b9(0xf6)]&&(console[_0x53b7b9(0x24c)]('Site:\x20'+_0x4b0960[_0x53b7b9(0x12f)]),console[_0x53b7b9(0x24c)]('YAML\x20file:\x20'+_0x18b301));let _0x3ab468;try{_0x3ab468=readFileSync(_0x18b301,'utf-8');}catch(_0x213da9){const _0x568598=_0x213da9 instanceof Error?_0x213da9[_0x53b7b9(0x226)]:String(_0x213da9);return console[_0x53b7b9(0x24c)]('Error\x20reading\x20file:\x20'+_0x568598),0x1;}let _0x7b62a9;try{_0x7b62a9=parseDef(_0x3ab468);}catch(_0x5992a9){const _0xc755f3=_0x5992a9 instanceof Error?_0x5992a9[_0x53b7b9(0x226)]:String(_0x5992a9);return console[_0x53b7b9(0x24c)](a30_0xc6b51f[_0x53b7b9(0x198)](_0x53b7b9(0x1c3)+_0xc755f3)),0x1;}if(_0x4b0960[_0x53b7b9(0x22b)]===!![]||_0x4b0960[_0x53b7b9(0x22b)]===''){const _0x8f06e6=_0x7b62a9[_0x53b7b9(0x20c)]?.[_0x53b7b9(0x173)](_0x37bacc=>_0x37bacc[_0x53b7b9(0xf1)])||[];if(_0x8f06e6[_0x53b7b9(0x112)]===0x0)console['error'](a30_0xc6b51f[_0x53b7b9(0x198)](_0x53b7b9(0x1df)));else{console[_0x53b7b9(0x24c)](a30_0xc6b51f[_0x53b7b9(0x198)](_0x53b7b9(0x22c))),console[_0x53b7b9(0x24c)](_0x53b7b9(0x279));for(const _0x18b775 of _0x8f06e6){console[_0x53b7b9(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x53b7b9(0x102)](_0x18b775));}console[_0x53b7b9(0x24c)](_0x53b7b9(0x1cf)+_0x289714+'\x20--attribute\x20\x22'+_0x8f06e6[0x0]+'\x22');}return 0x1;}if(_0x4b0960[_0x53b7b9(0x160)]===!![]||_0x4b0960['behavior']===''){const _0x27c595=_0x7b62a9[_0x53b7b9(0x218)]?.[_0x53b7b9(0x173)](_0x43b7e1=>_0x43b7e1[_0x53b7b9(0xf1)])||[];if(_0x27c595['length']===0x0)console[_0x53b7b9(0x24c)](a30_0xc6b51f[_0x53b7b9(0x198)](_0x53b7b9(0x273)));else{console[_0x53b7b9(0x24c)](a30_0xc6b51f[_0x53b7b9(0x198)](_0x53b7b9(0xf3))),console[_0x53b7b9(0x24c)]('Available\x20behaviors:');for(const _0x2e05a1 of _0x27c595){console[_0x53b7b9(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x53b7b9(0x102)](_0x2e05a1));}console[_0x53b7b9(0x24c)](_0x53b7b9(0x1cf)+_0x289714+'\x20--behavior\x20\x22'+_0x27c595[0x0]+'\x22');}return 0x1;}const _0x4fdf41=createCommandSpinner(a30_0xc6b51f[_0x53b7b9(0x203)]('Fetching\x20sample\x20data...'),{'verbose':_0x4b0960[_0x53b7b9(0xf6)]});_0x4fdf41[_0x53b7b9(0x1a4)]();const _0x1f5bd6={'onProgress':_0x1b8c05=>{const _0x7889ef=_0x53b7b9;_0x4fdf41[_0x7889ef(0x1e7)]=formatProgressMessage(_0x1b8c05);}};if(_0x4b0960['master'])_0x1f5bd6['master']=!![];if(_0x4b0960[_0x53b7b9(0x22b)]&&typeof _0x4b0960['attribute']==='string')_0x1f5bd6['attribute']=_0x4b0960['attribute'];if(_0x4b0960['behavior']&&typeof _0x4b0960[_0x53b7b9(0x160)]===_0x53b7b9(0x24b))_0x1f5bd6[_0x53b7b9(0x160)]=_0x4b0960['behavior'];if(_0x4b0960[_0x53b7b9(0x27a)])_0x1f5bd6[_0x53b7b9(0x27a)]=!![];if(_0x4b0960[_0x53b7b9(0x1e1)])_0x1f5bd6['interval']=_0x4b0960[_0x53b7b9(0x1e1)];let _0x404d90;try{_0x404d90=await _0x253218['segment'][_0x53b7b9(0x1e0)](_0x3ab468,_0x1f5bd6),_0x4fdf41[_0x53b7b9(0x250)]();}catch(_0x43957d){_0x4fdf41[_0x53b7b9(0x250)]();throw _0x43957d;}return await this['displayPreviewResults'](_0x404d90,{'master':_0x4b0960[_0x53b7b9(0x24a)],'attribute':typeof _0x4b0960[_0x53b7b9(0x22b)]===_0x53b7b9(0x24b)?_0x4b0960[_0x53b7b9(0x22b)]:undefined,'behavior':typeof _0x4b0960[_0x53b7b9(0x160)]==='string'?_0x4b0960[_0x53b7b9(0x160)]:undefined,'enriched':_0x4b0960['enriched']}),_0x404d90['allValid']?0x0:0x1;}async[a30_0x2d1bab(0x205)](_0x4ce817,_0x4e626f){const _0x11e1c2=a30_0x2d1bab;console[_0x11e1c2(0x24c)]('\x0a'+a30_0xc6b51f['bold'](_0x11e1c2(0x27e))+'\x20'+_0x4ce817['name']),console[_0x11e1c2(0x24c)]('═'[_0x11e1c2(0x221)](0x3c));if(_0x4e626f[_0x11e1c2(0x24a)]&&_0x4ce817[_0x11e1c2(0x17a)]){const _0x572cdd=a30_0xc6b51f[_0x11e1c2(0x203)](_0x11e1c2(0x21f))+'\x20'+a30_0xc6b51f[_0x11e1c2(0x18b)](_0x4ce817['master']['database']+'.'+_0x4ce817['master']['table']);await this[_0x11e1c2(0x106)](_0x572cdd,_0x4ce817['sampleData']);}else{if(_0x4e626f[_0x11e1c2(0x22b)]&&_0x4ce817[_0x11e1c2(0x17a)]){const _0x28bff8=a30_0xc6b51f[_0x11e1c2(0x203)](_0x11e1c2(0x265))+'\x20'+a30_0xc6b51f['bold'](_0x4e626f[_0x11e1c2(0x22b)]);await this[_0x11e1c2(0x106)](_0x28bff8,_0x4ce817[_0x11e1c2(0x17a)]);}else{if(_0x4e626f[_0x11e1c2(0x160)]&&_0x4ce817[_0x11e1c2(0x17a)]){const _0x202940=a30_0xc6b51f[_0x11e1c2(0x203)](_0x11e1c2(0x217))+'\x20'+a30_0xc6b51f[_0x11e1c2(0x18b)](_0x4e626f[_0x11e1c2(0x160)]);await this[_0x11e1c2(0x106)](_0x202940,_0x4ce817[_0x11e1c2(0x17a)]);}else{if(_0x4e626f[_0x11e1c2(0x27a)]&&_0x4ce817[_0x11e1c2(0x17a)]){const _0x10b873=a30_0xc6b51f['dim'](_0x11e1c2(0x132))+'\x20'+a30_0xc6b51f[_0x11e1c2(0x18b)](_0x11e1c2(0x17f));await this['displaySampleData'](_0x10b873,_0x4ce817[_0x11e1c2(0x17a)]);}else!_0x4ce817['sampleData']&&console['error'](_0x11e1c2(0x111));}}}if(_0x4ce817['errors'][_0x11e1c2(0x112)]>0x0){console[_0x11e1c2(0x24c)]('─'[_0x11e1c2(0x221)](0x3c)),console[_0x11e1c2(0x24c)]('\x0a'+a30_0xc6b51f[_0x11e1c2(0x198)](_0x11e1c2(0x177)));for(const _0x104186 of _0x4ce817['errors']){console[_0x11e1c2(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x11e1c2(0x198)]('•')+'\x20'+_0x104186);}}}async[a30_0x2d1bab(0x106)](_0x465a7a,_0x39905f){const _0x204d3c=a30_0x2d1bab;if(_0x39905f[_0x204d3c(0x112)]===0x0){console['error']('\x0a'+_0x465a7a),console[_0x204d3c(0x24c)](_0x204d3c(0x1fc));return;}console[_0x204d3c(0x24c)]('\x0a'+_0x465a7a);const _0x13ddcd=Object[_0x204d3c(0x179)](_0x39905f[0x0])[_0x204d3c(0x173)](_0x3ec147=>({'name':_0x3ec147,'type':typeof _0x39905f[0x0][_0x3ec147]===_0x204d3c(0x26f)?'double':'varchar'})),_0x224e0b={'queryId':_0x204d3c(0x11a),'columns':_0x13ddcd,'data':_0x39905f,'stats':{'state':_0x204d3c(0x259),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x39905f[_0x204d3c(0x112)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3a6141=formatAsTable(_0x224e0b,_0x39905f[_0x204d3c(0x112)],!![]);await writeOutput(_0x3a6141,undefined,_0x204d3c(0x262));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a30_0x2d1bab(0x10d);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x14a);async['execute'](_0x182e5f){const _0x7123f9=a30_0x2d1bab,{options:_0x232de2,args:_0x54caa2,tdx:_0x395b36}=_0x182e5f,_0x58a28a=_0x232de2,_0x19eb36=_0x54caa2[0x0]||_0x232de2[_0x7123f9(0x1c8)];if(!_0x19eb36)return showParentSegmentNotSetError(_0x7123f9(0x150)+_0x7123f9(0x12c)),0x1;const _0x23c965=resolveYamlFile(_0x19eb36);if(existsSync(_0x23c965)){_0x58a28a[_0x7123f9(0xf6)]&&console[_0x7123f9(0x24c)]('Found\x20YAML\x20file:\x20'+_0x23c965);let _0x542119;try{_0x542119=readFileSync(_0x23c965,'utf-8');}catch(_0x3c57d8){const _0x437b05=_0x3c57d8 instanceof Error?_0x3c57d8['message']:String(_0x3c57d8);return console[_0x7123f9(0x24c)](_0x7123f9(0x264)+_0x437b05),0x1;}const _0x421a70=await withSpinner(_0x7123f9(0x15a),()=>_0x395b36[_0x7123f9(0x10a)][_0x7123f9(0x1cc)](_0x542119),{'verbose':_0x58a28a['verbose']}),_0x39a3c7=_0x421a70[_0x7123f9(0x1d8)],{isNew:_0x241f06,name:_0x23f5a0,hasChanges:_0x3453ad,diffFormatted:_0x507c80}=_0x39a3c7;if(_0x3453ad){_0x241f06?console[_0x7123f9(0x24c)](_0x7123f9(0x1a9)+_0x23f5a0+'\x27:'):console[_0x7123f9(0x24c)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x23f5a0+'\x27:');console[_0x7123f9(0x24c)]('─'[_0x7123f9(0x221)](0x3c)),console[_0x7123f9(0x24c)](_0x507c80),console[_0x7123f9(0x24c)]('─'[_0x7123f9(0x221)](0x3c));const _0x5792a3=_0x241f06?_0x7123f9(0x240)+_0x23f5a0+_0x7123f9(0x193):'Apply\x20changes\x20to\x20\x27'+_0x23f5a0+_0x7123f9(0x193);if(!_0x58a28a['yes']){if(!isInteractive())return console[_0x7123f9(0x24c)](a30_0xc6b51f[_0x7123f9(0x198)](_0x7123f9(0x1a0)),_0x7123f9(0x17c)),console['error'](a30_0xc6b51f[_0x7123f9(0x203)](_0x7123f9(0x10e))),0x1;const _0x15f6e=await confirmKey(_0x5792a3);if(!_0x15f6e)return console[_0x7123f9(0x24c)](a30_0xc6b51f[_0x7123f9(0x184)](_0x7123f9(0x131))),0x1;}const _0x3f349d=_0x241f06?_0x7123f9(0x261):_0x7123f9(0x105);await withSpinner(_0x3f349d+_0x7123f9(0x210)+_0x23f5a0+'\x27...',()=>_0x39a3c7[_0x7123f9(0x19d)](),{'verbose':_0x58a28a[_0x7123f9(0xf6)]});const _0x2a23b5=_0x241f06?_0x7123f9(0x144):_0x7123f9(0x10c);console[_0x7123f9(0x24c)]('✔\x20'+_0x2a23b5+_0x7123f9(0x210)+_0x23f5a0+'\x27');}else console['error'](_0x7123f9(0x18d)+_0x23f5a0+_0x7123f9(0x236));}const _0xcb61ff=await withSpinner(_0x7123f9(0x108)+_0x19eb36+_0x7123f9(0x27b),()=>_0x395b36[_0x7123f9(0x10a)]['runParent'](_0x19eb36),{'verbose':_0x58a28a[_0x7123f9(0xf6)]}),_0x27993c=_0xcb61ff[_0x7123f9(0x1d8)],_0x5f4527=getConsoleUrl(_0x58a28a[_0x7123f9(0x12f)],_0x7123f9(0x19e)+_0x27993c['workflowId']+_0x7123f9(0x1f0)+_0x27993c[_0x7123f9(0x1db)]+_0x7123f9(0x155)+_0x27993c[_0x7123f9(0x11f)]);return console[_0x7123f9(0x24c)](_0x7123f9(0x1a8)),console['error']('\x20\x20'+a30_0xc6b51f[_0x7123f9(0x203)]('Audience\x20ID:')+'\x20'+_0x27993c[_0x7123f9(0x18e)]),console[_0x7123f9(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x7123f9(0x203)](_0x7123f9(0x20a))+'\x20'+_0x27993c[_0x7123f9(0x223)]),console[_0x7123f9(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x7123f9(0x203)](_0x7123f9(0x127))+'\x20'+_0x27993c[_0x7123f9(0x1db)]),console[_0x7123f9(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x7123f9(0x203)]('Attempt:')+'\x20'+_0x27993c[_0x7123f9(0x11f)]),console[_0x7123f9(0x24c)]('\x20\x20'+_0x5f4527),console[_0x7123f9(0x24c)]('\x0a'+a30_0xc6b51f[_0x7123f9(0x203)](_0x7123f9(0x27c))+_0x7123f9(0x18f)+_0x27993c[_0x7123f9(0x11f)]+_0x7123f9(0x175)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x133);['description']='List\x20available\x20fields\x20for\x20segmentation';async[a30_0x2d1bab(0x26d)](_0x22f84c){const _0x1ac811=a30_0x2d1bab,{options:_0xc234d4,args:_0x17c753,tdx:_0x184aaf}=_0x22f84c,_0x32194a=_0x17c753[0x0]||_0xc234d4[_0x1ac811(0x1c8)];if(!_0x32194a)return showParentSegmentNotSetError(_0x1ac811(0x23d)+_0x1ac811(0x215)),0x1;_0xc234d4[_0x1ac811(0xf6)]&&(console['error'](_0x1ac811(0x1ce)+_0xc234d4[_0x1ac811(0x12f)]),console[_0x1ac811(0x24c)](_0x1ac811(0x1a6)+_0x32194a));const _0x273ed1=await withSpinner(_0x1ac811(0x1c0)+_0x32194a+_0x1ac811(0x27b),()=>_0x184aaf[_0x1ac811(0x10a)][_0x1ac811(0x17d)](_0x32194a),{'verbose':_0xc234d4[_0x1ac811(0xf6)]}),_0x4ac106=_0x273ed1[_0x1ac811(0x1d8)];console[_0x1ac811(0x24c)]('✔\x20Found\x20'+_0x4ac106[_0x1ac811(0x112)]+_0x1ac811(0x12d)+(_0x4ac106[_0x1ac811(0x112)]!==0x1?'s':''));if(_0xc234d4['json']||_0xc234d4['jsonl'])return await handleSDKOutput(_0x4ac106,_0xc234d4),0x0;return displayFieldsHumanReadable(_0x4ac106,_0x32194a),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a30_0x2d1bab(0x141);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x1aa);async['execute'](_0x53760a){const _0x5f2184=a30_0x2d1bab,{options:_0x5ee9b7,args:_0xd1b75d,tdx:_0x440127}=_0x53760a,_0x4772f7=_0x5ee9b7,_0x149ae7=_0xd1b75d[0x0]||_0x5ee9b7[_0x5f2184(0x1c8)];if(!_0x149ae7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x5f2184(0x15e)+_0x5f2184(0x251)+_0x5f2184(0x181)),0x1;_0x5ee9b7[_0x5f2184(0xf6)]&&(console['error'](_0x5f2184(0x1ce)+_0x5ee9b7[_0x5f2184(0x12f)]),console[_0x5f2184(0x24c)]('Parent\x20segment:\x20'+_0x149ae7));const _0x2efd7a=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x149ae7+_0x5f2184(0x27b),()=>_0x440127[_0x5f2184(0x10a)]['getParentFull'](_0x149ae7),{'verbose':_0x5ee9b7['verbose']}),_0xa58393=_0x2efd7a[_0x5f2184(0x1d8)];if(_0x4772f7[_0x5f2184(0x1ab)]){const _0xc1278a=getConsoleNextUrl(_0x4772f7[_0x5f2184(0x12f)],_0x5f2184(0x20e)+_0xa58393['id']);return console[_0x5f2184(0x24c)](a30_0xc6b51f[_0x5f2184(0x148)]('✔')+'\x20Opening\x20'+a30_0xc6b51f[_0x5f2184(0x102)](_0xc1278a)),openBrowser(_0xc1278a),0x0;}return await handleSingleObjectOutput(_0xa58393,_0x5ee9b7),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]='segment:parent:desc';[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x238);async[a30_0x2d1bab(0x26d)](_0x5f3239){const _0x30ea44=a30_0x2d1bab,{options:_0x1c70cc,args:_0x2dc701,tdx:_0x57d747}=_0x5f3239,_0x1e65b6=_0x1c70cc,_0x12d07a=_0x2dc701[0x0]||_0x1c70cc[_0x30ea44(0x1c8)];if(!_0x12d07a)return showParentSegmentNotSetError(_0x30ea44(0x157)+_0x30ea44(0x1c6)+'Options:\x0a'+_0x30ea44(0x243)),0x1;_0x1c70cc[_0x30ea44(0xf6)]&&(console['error'](_0x30ea44(0x1ce)+_0x1c70cc[_0x30ea44(0x12f)]),console[_0x30ea44(0x24c)](_0x30ea44(0x1a6)+_0x12d07a));const _0x2aaf0f=await withSpinner(_0x30ea44(0x216)+_0x12d07a+'\x27...',()=>_0x57d747['segment']['resolveParentId'](_0x12d07a),{'verbose':_0x1c70cc[_0x30ea44(0xf6)]}),_0x458e18=_0x2aaf0f['data'],_0x22e2b6=_0x57d747['segment'][_0x30ea44(0x280)](_0x458e18);if(_0x1e65b6[_0x30ea44(0x249)]){const _0x1a1621=await this[_0x30ea44(0x272)](_0x5f3239,_0x12d07a,_0x458e18,_0x22e2b6),_0x29a3e5=this['formatSchemaJson'](_0x1a1621);writeFileSync(_0x1e65b6[_0x30ea44(0x249)],_0x29a3e5);const _0x51f515=_0x1a1621['customers'][_0x30ea44(0x1d4)][_0x30ea44(0x112)]+_0x1a1621[_0x30ea44(0x218)][_0x30ea44(0x1ad)]((_0x3f554e,_0x40680c)=>_0x3f554e+_0x40680c[_0x30ea44(0x1d4)]['length'],0x0),_0x1ce3a2=_0x1a1621[_0x30ea44(0x218)]['filter'](_0x537432=>_0x537432['columns']['length']===0x0)[_0x30ea44(0x112)];return console[_0x30ea44(0x23f)](_0x30ea44(0x146)+_0x1e65b6[_0x30ea44(0x249)]),console[_0x30ea44(0x23f)]('\x20\x20Database:\x20'+_0x22e2b6),console[_0x30ea44(0x23f)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x1a1621[_0x30ea44(0x218)]['length']+_0x30ea44(0x248)),console['log'](_0x30ea44(0x255)+_0x51f515+_0x30ea44(0x15f)),_0x1ce3a2>0x0&&console[_0x30ea44(0x23f)]('\x20\x20Note:\x20'+_0x1ce3a2+_0x30ea44(0x224)),0x0;}console['error']('\x0a'+a30_0xc6b51f[_0x30ea44(0x18b)](_0x30ea44(0x1e5))+'\x20'+a30_0xc6b51f[_0x30ea44(0x102)](_0x22e2b6));const _0x5a5a06=await withSpinner(_0x30ea44(0x166),()=>_0x57d747['segment'][_0x30ea44(0x1dd)](_0x458e18),{'verbose':_0x1c70cc[_0x30ea44(0xf6)]});console[_0x30ea44(0x24c)]('\x0a'+a30_0xc6b51f[_0x30ea44(0x18b)](_0x30ea44(0x128))+'\x20'+a30_0xc6b51f[_0x30ea44(0x203)]('('+_0x22e2b6+_0x30ea44(0x11e)));const _0x29966=await executeSchemaQuery(_0x5a5a06[_0x30ea44(0x1d8)],_0x57d747,_0x1c70cc);await handleQueryOutput(_0x29966,_0x1c70cc);const _0x234768=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x57d747['segment'][_0x30ea44(0x247)](_0x458e18),{'verbose':_0x1c70cc[_0x30ea44(0xf6)]});for(const _0x1634a7 of _0x234768['data']){const _0xb57205=_0x30ea44(0x1cb)+_0x1634a7[_0x30ea44(0x220)]()[_0x30ea44(0x1f8)](/\s+/g,'_'),_0x2d59f5='SELECT\x20*\x20FROM\x20'+_0x22e2b6+'.'+_0xb57205;console['error']('\x0a'+a30_0xc6b51f[_0x30ea44(0x18b)](_0x1634a7)+'\x20'+a30_0xc6b51f[_0x30ea44(0x203)]('('+_0x22e2b6+'.'+_0xb57205+')'));try{const _0x29c26a=await executeSchemaQuery(_0x2d59f5,_0x57d747,_0x1c70cc);await handleQueryOutput(_0x29c26a,_0x1c70cc);}catch{console[_0x30ea44(0x24c)](a30_0xc6b51f[_0x30ea44(0x184)](_0x30ea44(0x143)));}}return 0x0;}async['collectSchema'](_0x390c73,_0x52c189,_0x3a39a4,_0x5ea8e6){const _0xb9bcc2=a30_0x2d1bab,{options:_0x302a2c,tdx:_0x64d4b2}=_0x390c73,_0x1289ee=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x64d4b2[_0xb9bcc2(0x10a)]['getParentSQL'](_0x3a39a4),{'verbose':_0x302a2c[_0xb9bcc2(0xf6)]}),_0x36d9ec=await executeSchemaQuery(_0x1289ee['data'],_0x64d4b2,_0x302a2c),_0x3de49d=_0x36d9ec[_0xb9bcc2(0x1d8)][_0xb9bcc2(0x173)](_0x2dba5e=>({'name':_0x2dba5e[_0xb9bcc2(0x163)],'type':_0x2dba5e['column_type']})),_0x52ce6a=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x64d4b2['segment'][_0xb9bcc2(0x247)](_0x3a39a4),{'verbose':_0x302a2c[_0xb9bcc2(0xf6)]}),_0x372204=[];for(const _0x112e10 of _0x52ce6a['data']){const _0x2d9809=_0xb9bcc2(0x1cb)+_0x112e10['toLowerCase']()[_0xb9bcc2(0x1f8)](/\s+/g,'_'),_0x46e71b=_0xb9bcc2(0x222)+_0x5ea8e6+'.'+_0x2d9809;let _0x26aab9=[];try{const _0x39635f=await executeSchemaQuery(_0x46e71b,_0x64d4b2,_0x302a2c);_0x26aab9=_0x39635f['data'][_0xb9bcc2(0x173)](_0x3dbb08=>({'name':_0x3dbb08[_0xb9bcc2(0x163)],'type':_0x3dbb08['column_type']}));}catch{}_0x372204[_0xb9bcc2(0x16f)]({'table':_0x2d9809,'columns':_0x26aab9});}return{'database':_0x5ea8e6,'parent_segment':_0x52c189,'parent_id':_0x3a39a4,'customers':{'table':'customers','columns':_0x3de49d},'behaviors':_0x372204};}['formatSchemaJson'](_0x498c45){const _0x4e2d42=a30_0x2d1bab,_0x1664e7=_0x490fb0=>{const _0x320856=a30_0x5468;if(_0x490fb0[_0x320856(0x112)]===0x0)return'[]';const _0x5a0ee5=_0x490fb0[_0x320856(0x173)](_0x28088f=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x28088f[_0x320856(0xf1)]+_0x320856(0x24e)+_0x28088f['type']+_0x320856(0x191));return'[\x0a'+_0x5a0ee5[_0x320856(0x123)](',\x0a')+_0x320856(0x176);},_0x43e897=_0x498c45[_0x4e2d42(0x218)][_0x4e2d42(0x173)](_0x2df0bb=>{const _0x343290=_0x4e2d42;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x2df0bb[_0x343290(0x262)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x1664e7(_0x2df0bb[_0x343290(0x1d4)])[_0x343290(0x1f8)](/^/gm,'\x20\x20')[_0x343290(0x239)]()+'\x0a\x20\x20\x20\x20}';})[_0x4e2d42(0x123)](',\x0a');return _0x4e2d42(0x192)+_0x498c45[_0x4e2d42(0x13d)]+_0x4e2d42(0x185)+_0x498c45['parent_segment']+_0x4e2d42(0x16b)+_0x498c45[_0x4e2d42(0x117)]+_0x4e2d42(0x200)+_0x498c45['customers'][_0x4e2d42(0x262)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x1664e7(_0x498c45[_0x4e2d42(0x128)]['columns'])[_0x4e2d42(0x1f8)](/^/gm,'\x20\x20')[_0x4e2d42(0x239)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x43e897+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]='segment:parent:sql';['description']=a30_0x2d1bab(0x1b5);async[a30_0x2d1bab(0x26d)](_0x298e1d){const _0x1cfdba=a30_0x2d1bab,{options:_0x475e40,args:_0x4b6ed0,tdx:_0x248f79}=_0x298e1d,_0x4eeaa2=_0x4b6ed0[0x0]||_0x475e40[_0x1cfdba(0x1c8)];if(!_0x4eeaa2)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x1cfdba(0x1d7)),0x1;_0x475e40['verbose']&&(console[_0x1cfdba(0x24c)](_0x1cfdba(0x1ce)+_0x475e40[_0x1cfdba(0x12f)]),console[_0x1cfdba(0x24c)]('Parent\x20segment:\x20'+_0x4eeaa2));const _0x21d07d=await withSpinner(_0x1cfdba(0x216)+_0x4eeaa2+_0x1cfdba(0x27b),()=>_0x248f79[_0x1cfdba(0x10a)][_0x1cfdba(0x186)](_0x4eeaa2),{'verbose':_0x475e40[_0x1cfdba(0xf6)]}),_0xe91c1f=_0x21d07d['data'],_0x1e35fa=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4eeaa2+_0x1cfdba(0x27b),()=>_0x248f79[_0x1cfdba(0x10a)][_0x1cfdba(0x1dd)](_0xe91c1f),{'verbose':_0x475e40[_0x1cfdba(0xf6)]}),_0x585c09=_0x1e35fa[_0x1cfdba(0x1d8)];return _0x475e40['format']===_0x1cfdba(0x113)||_0x475e40[_0x1cfdba(0x107)]==='jsonl'?await handleSDKOutput([{'sql':_0x585c09}],_0x475e40):console['log'](_0x585c09),0x0;}}function a30_0x2faa(){const _0x287157=['2744418thpTei','/\x20directory.\x0a','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x0aChanges\x20to\x20\x27','dirname','Pattern:\x20','\x20Added\x20RT\x202.0\x20template\x20section','/attempt/','behaviorsFile','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','\x20--enriched','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Analyzing\x20changes...','Updating\x20parent\x20segment\x20\x27','win32','Default','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20total','behavior','\x20=\x20','addBehaviors','column_name','✔\x20Created\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Fetching\x20customers\x20schema...','createParent','timezone','unref','filter','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Personalization:','limit','push','`\x20to\x20download\x20the\x20configuration\x20first','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','realtime_enabled','map','\x20--interval\x20','\x20kill','\x0a\x20\x20\x20\x20]','Errors:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','keys','sampleData','ps:pz:list','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','listFields','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Master\x20+\x20Attributes','✔\x20Found\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','ignore','segment:parent:create','yellow','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','resolveParentId','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20to\x20push\x20the\x20configuration','last_page_viewed','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','bold','\x20--behavior\x20\x22','✔\x20No\x20changes\x20-\x20\x27','audienceId','\x20tdx\x20wf\x20attempt\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x22\x20}','{\x0a\x20\x20\x22database\x22:\x20\x22','\x27\x20and\x20run\x20workflow?','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','.yaml','%)\x20','segment:parent:pull','red','parent_segment','No\x20parent\x20segments\x20match\x20pattern:\x20','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Listing\x20RT-enabled\x20parent\x20segments...','apply','/app/workflows/','Name:\x20','\x0aError:','personalizationServices','⚡\x20Enabled','Listing\x20parent\x20segments...','start','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Parent\x20segment:\x20','joinKey','\x0a✔\x20Workflow\x20started','\x0aNew\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20details','web','Creating\x20parent\x20segment\x20\x27','reduce','/{name}.yml\x0a','Validating\x20RT\x20configuration...','\x20--behavior\x20\x22<name>\x22','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','schemaError','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','displayMasterInfo','Get\x20SQL\x20query\x20for\x20parent\x20segment','stats','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','displayBehaviorsStats','SQL\x20query:\x0a','sourceTableError','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','in\x20','6112422RSEaPP','\x20service(s)\x20configured','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Listing\x20fields\x20for\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','segment:parent:show','Error\x20parsing\x20YAML:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','events','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','parentSegment','Overwrite\x20\x27','true','behavior_','pushParentYaml','displayValidateResults','Site:\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','trigger_event','\x20to\x20configure\x20your\x20personalization\x20service','rowCount','\x20is\x20already\x20up\x20to\x20date','columns','yes','tdx\x20ps\x20push\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','data','displayRealtimeInfo','listParents','workflowSessionId','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','getParentSQL','sort','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','previewParentYaml','interval','\x20configured','\x20[Job\x20ID:\x20','jsonl','Output\x20Database:','isDirectory','text','primaryKey','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','xdg-open','platform','\x20rows)','segment:parent:list','✔\x20Query\x20completed:\x20Processed\x20','/sessions/','description','\x20\x202.\x20Run\x20','information_schema','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','5432500UBLrsB','579542tZCZfo','page_view','replace','addAttributesFile','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','4060268oIeQdS','\x20\x20No\x20sample\x20data\x20available','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayPreviewHints','column','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Validating\x20configuration...','enabled','dim','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','displayPreviewResults','label','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','segment:parent:validate','⚡\x20Not\x20enabled','Status:','customersWithEvents','attributes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','/app/dw/parentSegments/','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20parent\x20segment\x20\x27','Columns:','list','\x20--attribute\x20\x22','updateParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Resolving\x20parent\x20segment\x20\x27','Behavior:','behaviors','Rows:','Events:','Validate:','match','displayColumns','realtime','Master:','toLowerCase','repeat','SELECT\x20*\x20FROM\x20','status','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20--attribute\x20\x22<name>\x22','message','toFixed','customerPercent','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','displayAttributesStats','attribute','Error:\x20--attribute\x20requires\x20a\x20name\x0a','using\x20the\x20default\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','population','localeCompare','Next\x20steps:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','ps:rt:list','Coverage:','To\x20view\x20sample\x20data:','\x27\x20is\x20up\x20to\x20date','3134087HIXeMT','Show\x20parent\x20segment\x20schema\x20(column\x20types)','trim','realtime:','sections','personalization_services','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Executing\x20parent\x20segment\x20query...','log','Create\x20parent\x20segment\x20\x27','.yml','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','indexOf','SELECT\x20*\x20FROM\x20(\x0a','\x27\x20is\x20already\x20up\x20to\x20date','getBehaviorNames','\x20behaviors','output','master','string','error','Behaviors','\x22,\x20\x22type\x22:\x20\x22','utf-8','stop','Options:\x0a','addAttributes','3RLMFpE','setJobId','\x20\x20Columns:\x20','/\x20directories\x20exist.','ps:rt:validate','endsWith','FINISHED','14ScXoDg','Master\x20Table','attributesFile','Source:','foreignKey','coveragePercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Creating','table','\x20parent\x20segment','Error\x20reading\x20file:\x20','Attribute:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Personalization\x20service\x20description','scheduleType','820616MmBAhj','sourceTableValid','personalization','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','execute','use','number','\x0a⚠️\x20\x20Both\x20','Fetching\x20parent\x20segment\x20\x27','collectSchema','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','processedRows','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Error:','schemaValid','\x20Added\x20personalization\x20template\x20to\x20','Available\x20attributes:','enriched','\x27...','To\x20cancel:','YAML\x20file:\x20','Preview:','query','getOutputDatabaseName','stitchingKeys','\x20personalization\x20service','name','customerGroupFile','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20rows\x20','\x27\x20with\x20ID:\x20','verbose','\x20\x20\x20\x20','darwin','scheduleOption','Join\x20on:','\x20\x20\x20\x20-\x20','\x5c$&','3UXKfqV','segment:parent:preview','\x20+\x20[','Error:\x20File\x20not\x20found:\x20','\x20\x20\x20','cyan','tdx\x20ps\x20preview\x20','run','Updating','displaySampleData','format','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','-1d','segment','Database:\x20','Updated','segment:parent:run','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','segment:parent:update','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x0aNo\x20sample\x20data\x20available','length','json','all','50hSDqkh','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','parent_id','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','No\x20parent\x20segments\x20found','preview','No\x20personalization\x20services\x20configured','errors','allValid','.customers)','workflowAttemptId','Error:\x20--database\x20and\x20--table\x20are\x20required','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Options\x20(one\x20required):\x0a','join','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','✔\x20Updated\x20parent\x20segment\x20\x27','Session:','customers','session','totalEvents','getParentFull','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20field','elapsedTimeMillis','site','user_id','Aborted.','Enriched:','segment:parent:fields','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Table:\x20','idStitching','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','/\x20and\x20','RT\x202.0:','validateParentYaml','matchedCount','Attributes','database','single','valid','\x20RT-enabled\x20parent\x20segment','segment:parent:view','pullParentYaml','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Created','RT\x202.0\x20Validate:','Schema\x20saved\x20to\x20','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','green','Join:','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Error:\x20Parent\x20segment\x20name\x20is\x20required','test','displaySummary'];a30_0x2faa=function(){return _0x287157;};return a30_0x2faa();}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x1c2);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x19b);async[a30_0x2d1bab(0x26d)](_0xae2bb7){const _0x54d8be=a30_0x2d1bab,{options:_0x315ee7,args:_0x2f84ce,tdx:_0x56f8d1}=_0xae2bb7,_0x27d1af=_0x2f84ce[0x0]||_0x315ee7[_0x54d8be(0x1c8)];if(!_0x27d1af)return showParentSegmentNotSetError(_0x54d8be(0x1ea)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x315ee7[_0x54d8be(0xf6)]&&(console['error'](_0x54d8be(0x1ce)+_0x315ee7[_0x54d8be(0x12f)]),console[_0x54d8be(0x24c)]('Parent\x20segment:\x20'+_0x27d1af));const _0x5cf1d2=await withSpinner(_0x54d8be(0x216)+_0x27d1af+_0x54d8be(0x27b),()=>_0x56f8d1[_0x54d8be(0x10a)][_0x54d8be(0x186)](_0x27d1af),{'verbose':_0x315ee7[_0x54d8be(0xf6)]}),_0x522fb0=_0x5cf1d2[_0x54d8be(0x1d8)],_0x434280=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x27d1af+'\x27...',()=>_0x56f8d1[_0x54d8be(0x10a)]['getParentSQL'](_0x522fb0),{'verbose':_0x315ee7[_0x54d8be(0xf6)]});let _0x267c98=_0x434280[_0x54d8be(0x1d8)];const _0x361994=resolveLimit(_0x315ee7[_0x54d8be(0x16e)],DEFAULT_DISPLAY_LIMIT),_0x5e61fc=/\bLIMIT\s+\d+/i[_0x54d8be(0x14c)](_0x267c98);!_0x5e61fc&&(_0x267c98=_0x267c98[_0x54d8be(0x239)]()['replace'](/;+$/,''),_0x267c98=_0x54d8be(0x245)+_0x267c98+_0x54d8be(0x1bb)+_0x361994);_0x315ee7[_0x54d8be(0xf6)]&&console['error'](_0x54d8be(0x1b9)+_0x267c98);const _0x206baf=await withProgressSpinner(_0x54d8be(0x23e),async _0x2c5ce8=>{const _0xed35e6=_0x54d8be,_0x29c434=await _0x56f8d1[_0xed35e6(0x27f)]['execute'](_0x267c98,{'catalog':'td','schema':_0xed35e6(0x1f3),'onJobId':_0x352fba=>{const _0xa7084=_0xed35e6;_0x2c5ce8[_0xa7084(0x254)](_0x352fba);}});return _0x29c434;},{'verbose':_0x315ee7[_0x54d8be(0xf6)]}),_0x2f9c95=_0x206baf[_0x54d8be(0x1d8)],_0x5ac229=_0x2f9c95['jobId']?_0x54d8be(0x1e3)+_0x2f9c95['jobId']+']':'';return console[_0x54d8be(0x24c)](_0x54d8be(0x1ef)+_0x2f9c95[_0x54d8be(0x1b6)][_0x54d8be(0x274)]['toLocaleString']()+_0x54d8be(0xf4)+(_0x54d8be(0x1bc)+formatElapsed(_0x2f9c95[_0x54d8be(0x1b6)][_0x54d8be(0x12e)])+_0x5ac229)),await handleQueryOutput(_0x2f9c95,_0x315ee7),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x233);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x124);async[a30_0x2d1bab(0x26d)](_0x50d4cd){const _0x537bfe=a30_0x2d1bab,{options:_0x189f4c,args:_0x2d12bc,tdx:_0x5e537e}=_0x50d4cd,_0x2b483c=_0x2d12bc[0x0],_0x2aa2c6=await withSpinner(_0x2b483c?_0x537bfe(0x1f4)+_0x2b483c+_0x537bfe(0x27b):_0x537bfe(0x19c),()=>_0x5e537e[_0x537bfe(0x21e)][_0x537bfe(0x212)](),{'verbose':_0x189f4c[_0x537bfe(0xf6)]});let _0x286c0c=_0x2aa2c6[_0x537bfe(0x1d8)][_0x537bfe(0x16a)](_0x259518=>_0x259518[_0x537bfe(0x172)]);if(_0x2b483c){const _0x22e764=_0x2b483c['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x6ebf37=new RegExp('^'+_0x22e764+'$','i');_0x286c0c=_0x286c0c[_0x537bfe(0x16a)](_0x38f99c=>_0x6ebf37[_0x537bfe(0x14c)](_0x38f99c[_0x537bfe(0xf1)]));}_0x286c0c['sort']((_0x17f76a,_0x5741d4)=>_0x17f76a[_0x537bfe(0xf1)]['localeCompare'](_0x5741d4[_0x537bfe(0xf1)])),console[_0x537bfe(0x24c)](_0x537bfe(0x180)+_0x286c0c[_0x537bfe(0x112)]+_0x537bfe(0x140)+(_0x286c0c[_0x537bfe(0x112)]!==0x1?'s':''));const _0x2f6fa5=_0x24b3c6=>{const _0x1e12fd=_0x537bfe;return getConsoleNextUrl(_0x189f4c[_0x1e12fd(0x12f)],_0x1e12fd(0x20e)+_0x24b3c6);};if(_0x189f4c[_0x537bfe(0x107)]===_0x537bfe(0x113)||_0x189f4c[_0x537bfe(0x107)]===_0x537bfe(0x1e4)){const _0x437ad8=_0x286c0c['map'](_0x11da98=>({..._0x11da98,'url':_0x2f6fa5(_0x11da98['id'])}));await handleSDKOutput(_0x437ad8,_0x189f4c);}else{if(_0x286c0c['length']===0x0)console[_0x537bfe(0x23f)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0xea69aa of _0x286c0c){const _0x327d4c=_0xea69aa[_0x537bfe(0x22f)]?a30_0xc6b51f[_0x537bfe(0x203)]('\x20('+formatRows(_0xea69aa['population'])+')'):'',_0xca04ad=hyperlink(_0xea69aa[_0x537bfe(0xf1)],_0x2f6fa5(_0xea69aa['id']));console['log']('⚡\x20'+_0xca04ad+_0x327d4c);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x2d1bab(0xf1)]=a30_0x2d1bab(0x257);['description']=a30_0x2d1bab(0x207);async['execute'](_0x43c3e3){const _0x5c9854=a30_0x2d1bab,{options:_0x147b10,args:_0x2594a5,tdx:_0x29fd1d}=_0x43c3e3,_0x23892d=_0x2594a5[0x0]||_0x147b10[_0x5c9854(0x1c8)];if(!_0x23892d)return showParentSegmentNotSetError(_0x5c9854(0x18a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x1bee68=resolveYamlFile(_0x23892d);if(!existsSync(_0x1bee68))return showFileNotFoundError(_0x1bee68,_0x23892d),0x1;let _0xc125ac;try{_0xc125ac=readFileSync(_0x1bee68,_0x5c9854(0x24f));}catch(_0x1354bd){const _0x20625e=_0x1354bd instanceof Error?_0x1354bd[_0x5c9854(0x226)]:String(_0x1354bd);return console[_0x5c9854(0x24c)](_0x5c9854(0x264)+_0x20625e),0x1;}const _0x362f37=createCommandSpinner(a30_0xc6b51f[_0x5c9854(0x203)](_0x5c9854(0x1af)),{'verbose':_0x147b10[_0x5c9854(0xf6)]});_0x362f37[_0x5c9854(0x1a4)]();const _0x185a3c={'realtime':!![],'onProgress':_0x3ebac6=>{const _0x4678da=_0x5c9854;_0x362f37[_0x4678da(0x1e7)]=formatProgressMessage(_0x3ebac6);}};let _0x4dc659;try{_0x4dc659=await _0x29fd1d[_0x5c9854(0x10a)][_0x5c9854(0x13a)](_0xc125ac,_0x185a3c),_0x362f37[_0x5c9854(0x250)]();}catch(_0x51e694){_0x362f37[_0x5c9854(0x250)]();throw _0x51e694;}console[_0x5c9854(0x24c)]('\x0a'+a30_0xc6b51f[_0x5c9854(0x18b)](_0x5c9854(0x145))+'\x20'+_0x4dc659[_0x5c9854(0xf1)]),console[_0x5c9854(0x24c)]('═'[_0x5c9854(0x221)](0x3c)),displayRealtimeValidation(_0x4dc659),console['error']('─'[_0x5c9854(0x221)](0x3c));if(_0x4dc659[_0x5c9854(0x11c)]['length']>0x0){console[_0x5c9854(0x24c)]('\x0a'+a30_0xc6b51f['red'](_0x5c9854(0x177)));for(const _0x4e2327 of _0x4dc659[_0x5c9854(0x11c)]){console[_0x5c9854(0x24c)]('\x20\x20'+a30_0xc6b51f[_0x5c9854(0x198)]('•')+'\x20'+_0x4e2327);}}return _0x4dc659[_0x5c9854(0x11d)]&&console[_0x5c9854(0x24c)]('\x0a'+a30_0xc6b51f[_0x5c9854(0x148)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x4dc659['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a30_0x2d1bab(0x17b);[a30_0x2d1bab(0x1f1)]=a30_0x2d1bab(0x1b3);async[a30_0x2d1bab(0x26d)](_0x5850c6){const _0x6a0ee=a30_0x2d1bab,{options:_0x2b4882,args:_0x4ced17,tdx:_0xadbb0b}=_0x5850c6,_0x1ce40b=_0x4ced17[0x0]||_0x2b4882[_0x6a0ee(0x1c8)];if(!_0x1ce40b)return showParentSegmentNotSetError(_0x6a0ee(0x1e9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0xb891c3=await withSpinner(_0x6a0ee(0x216)+_0x1ce40b+_0x6a0ee(0x27b),()=>_0xadbb0b[_0x6a0ee(0x10a)]['resolveParentId'](_0x1ce40b),{'verbose':_0x2b4882[_0x6a0ee(0xf6)]}),_0x1d9cba=_0xb891c3[_0x6a0ee(0x1d8)],_0x4fd301=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x1ce40b+_0x6a0ee(0x27b),()=>_0xadbb0b[_0x6a0ee(0x26b)][_0x6a0ee(0x212)](_0x1d9cba),{'verbose':_0x2b4882['verbose']}),_0x2244ce=_0x4fd301['data'];console[_0x6a0ee(0x24c)](_0x6a0ee(0x180)+_0x2244ce['length']+_0x6a0ee(0xf0)+(_0x2244ce[_0x6a0ee(0x112)]!==0x1?'s':''));if(_0x2b4882['format']===_0x6a0ee(0x113)||_0x2b4882[_0x6a0ee(0x107)]===_0x6a0ee(0x1e4))await handleSDKOutput(_0x2244ce,_0x2b4882);else{if(_0x2244ce[_0x6a0ee(0x112)]===0x0)console[_0x6a0ee(0x23f)](_0x6a0ee(0x11b)),console[_0x6a0ee(0x24c)](a30_0xc6b51f[_0x6a0ee(0x102)](_0x6a0ee(0x1bf)));else for(const _0x57011 of _0x2244ce){const _0x1a4973=_0x57011[_0x6a0ee(0x23b)]?.[_0x6a0ee(0x112)]||0x0,_0x33de71=_0x57011[_0x6a0ee(0x1d0)]?a30_0xc6b51f['dim']('\x20trigger='+_0x57011[_0x6a0ee(0x1d0)]):'',_0x390a78=a30_0xc6b51f[_0x6a0ee(0x203)]('\x20('+_0x1a4973+'\x20section'+(_0x1a4973!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x57011[_0x6a0ee(0xf1)]+_0x33de71+_0x390a78),_0x57011['description']&&console[_0x6a0ee(0x23f)]('\x20\x20\x20\x20'+a30_0xc6b51f[_0x6a0ee(0x203)](_0x57011[_0x6a0ee(0x1f1)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']='ps:pz:init';['description']=a30_0x2d1bab(0x26c);async['execute'](_0x508ee4){const _0x2227ad=a30_0x2d1bab,{options:_0x58c90d,args:_0x153e1d}=_0x508ee4,_0x2ac3a6=_0x153e1d[0x0]||_0x58c90d[_0x2227ad(0x1c8)];if(!_0x2ac3a6)return showParentSegmentNotSetError(_0x2227ad(0x171)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x51af08=resolveYamlFile(_0x2ac3a6);if(!existsSync(_0x51af08))return showFileNotFoundError(_0x51af08,_0x2ac3a6),0x1;let _0x31ad87;try{_0x31ad87=readFileSync(_0x51af08,_0x2227ad(0x24f));}catch(_0x467166){const _0x439790=_0x467166 instanceof Error?_0x467166[_0x2227ad(0x226)]:String(_0x467166);return console['error']('Error\x20reading\x20file:\x20'+_0x439790),0x1;}let _0x523481;try{_0x523481=parseDef(_0x31ad87);}catch(_0x54869e){const _0x1f5ddd=_0x54869e instanceof Error?_0x54869e[_0x2227ad(0x226)]:String(_0x54869e);return console[_0x2227ad(0x24c)](a30_0xc6b51f[_0x2227ad(0x198)](_0x2227ad(0x1c3)+_0x1f5ddd)),0x1;}if(_0x523481['personalization_services']&&_0x523481[_0x2227ad(0x23c)][_0x2227ad(0x112)]>0x0)return console['error'](a30_0xc6b51f[_0x2227ad(0x184)](_0x2227ad(0x159)+_0x51af08)),console['error'](a30_0xc6b51f[_0x2227ad(0x203)](_0x2227ad(0x101)+_0x523481[_0x2227ad(0x23c)][_0x2227ad(0x112)]+_0x2227ad(0x1be))),0x1;!_0x523481[_0x2227ad(0x21e)]&&(_0x523481[_0x2227ad(0x21e)]={'events':[{'name':_0x2227ad(0x1f7),'source_table':'<database>.<table>'}],'attributes':[{'name':_0x2227ad(0x189),'type':_0x2227ad(0x13e)}],'id_stitching':{'primary_key':_0x523481[_0x2227ad(0x24a)][_0x2227ad(0x262)]==='customers'?'td_client_id':_0x2227ad(0x130)}});_0x523481[_0x2227ad(0x23c)]=[{'name':'My\x20Service','description':_0x2227ad(0x267),'trigger_event':'page_view','sections':[{'name':_0x2227ad(0x15d),'criteria':_0x2227ad(0x1ca),'attributes':[_0x2227ad(0x189)]}]}];const _0x299728=serializeDef(_0x523481);return writeFileSync(_0x51af08,_0x299728,_0x2227ad(0x24f)),console[_0x2227ad(0x24c)](a30_0xc6b51f['green']('✔')+_0x2227ad(0x278)+a30_0xc6b51f[_0x2227ad(0x102)](_0x51af08)),(!_0x523481[_0x2227ad(0x21e)]||_0x31ad87[_0x2227ad(0x244)](_0x2227ad(0x23a))===-0x1)&&console[_0x2227ad(0x24c)](a30_0xc6b51f[_0x2227ad(0x148)]('✔')+_0x2227ad(0x154)),console[_0x2227ad(0x24c)]('\x0a'+a30_0xc6b51f[_0x2227ad(0x203)](_0x2227ad(0x231))),console[_0x2227ad(0x24c)]('\x20\x201.\x20Edit\x20'+_0x51af08+_0x2227ad(0x1d1)),console[_0x2227ad(0x24c)](_0x2227ad(0x1f2)+a30_0xc6b51f[_0x2227ad(0x203)](_0x2227ad(0x1d6)+_0x2ac3a6)+_0x2227ad(0x188)),0x0;}}
|
|
1
|
+
const a30_0x11f642=a30_0x9f58;(function(_0x3c6e49,_0x550354){const _0x52ff0f=a30_0x9f58,_0x33a239=_0x3c6e49();while(!![]){try{const _0x31a040=-parseInt(_0x52ff0f(0x146))/0x1*(-parseInt(_0x52ff0f(0x1c5))/0x2)+parseInt(_0x52ff0f(0x185))/0x3+-parseInt(_0x52ff0f(0x168))/0x4*(parseInt(_0x52ff0f(0x209))/0x5)+-parseInt(_0x52ff0f(0x1e3))/0x6*(parseInt(_0x52ff0f(0x17f))/0x7)+-parseInt(_0x52ff0f(0xda))/0x8*(-parseInt(_0x52ff0f(0x10b))/0x9)+-parseInt(_0x52ff0f(0x103))/0xa+parseInt(_0x52ff0f(0x135))/0xb;if(_0x31a040===_0x550354)break;else _0x33a239['push'](_0x33a239['shift']());}catch(_0x4e6eed){_0x33a239['push'](_0x33a239['shift']());}}}(a30_0xfafd,0x9ff16));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x2024cb from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';function a30_0xfafd(){const _0x2cf5d2=['localeCompare','segment:parent:pull','segment:parent:sql','RT\x202.0\x20Validate:','Master\x20Table','11160820tTguUC','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20RT\x20configuration\x20is\x20valid','xdg-open','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','table','green','web','run','<database>.<table>','Errors:','Output\x20file:\x20','displayAttributesStats','format','column_name','runParent','attributes','2gsjWmp','\x20--interval\x20','\x20to\x20configure\x20your\x20personalization\x20service','cyan','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','timezone','joinKey','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','SELECT\x20*\x20FROM\x20(\x0a','dim','Parent\x20segment:\x20','No\x20personalization\x20services\x20configured','\x0a⚠️\x20\x20Both\x20','SELECT\x20*\x20FROM\x20','Options:\x0a','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','ps:rt:validate','getParentFull','\x20Opening\x20','Fetching\x20current\x20configuration\x20for\x20\x27','segment:parent:view','customerPercent','\x0aUsage:\x20tdx\x20ps\x20preview\x20','segment:parent:push','valid','\x0a⚠️\x20\x20Migrating:\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','scheduleType','👥\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','error','Updated','815132mpKYvM','keys','ps:pz:init','\x20\x20\x20','attributesFile','columns','page_view','%)\x20','addBehaviors','listParents','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','Updating\x20parent\x20segment\x20\x27','Join:','displaySampleData','Analyzing\x20changes...','toLowerCase','yellow','Fetching\x20behavior\x20list...','trim','\x0aChanges\x20to\x20apply\x20to\x20\x27','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Attributes','Columns:','429114JCnKHV','⚡\x20Not\x20enabled','createParent','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','repeat','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','1680528JANKhA','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','toFixed','last_page_viewed','Creating\x20parent\x20segment\x20\x27','/app/workflows/','using\x20the\x20default\x20path:\x20','scheduleOption','behaviorsFile','\x20Configuration\x20is\x20valid','segment:parent:validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Fetching\x20parent\x20segment\x20\x27','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','utf-8','segment:parent:list','Creating','\x20service(s)\x20configured','Status:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','No\x20parent\x20segments\x20match\x20pattern:\x20','To\x20cancel:','filter','single','customersWithEvents','parentSegment','Options\x20(one\x20required):\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','yes','all','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','addAttributes','Default','elapsedTimeMillis','\x20[Job\x20ID:\x20','Schema\x20saved\x20to\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','realtime','\x0a✔\x20Workflow\x20started','matchedCount','\x20--enriched','\x20field','SQL\x20query:\x0a','map','Updating','Error:','Preview:','\x0a\x20\x20\x20\x20]','displayBehaviorsStats','stitchingKeys','\x20RT-enabled\x20parent\x20segment','jsonl','\x20\x20Note:\x20','events','varchar','session','site','allValid','red','resolveParentId','\x20is\x20already\x20up\x20to\x20date','1092526MWAGzG','\x27\x20is\x20already\x20up\x20to\x20date','tdx\x20ps\x20push\x20','Options:','Next\x20steps:','column_type','displayMasterInfo','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','addAttributesFile','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','join','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','validateParentYaml','Audience\x20ID:','output','Personalization:','\x20service','\x20trigger=','\x27...','\x22\x20}','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','displayValidateResults','\x20\x20\x20\x20\x20\x20','getOutputDatabaseName','schemaValid','\x20\x20Tables:\x201\x20customers\x20+\x20','log','query','78qWJPSx','ps:pz:list','\x0a\x20\x20]\x0a}\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Error:\x20--attribute\x20requires\x20a\x20name\x0a','endsWith','parent_segment','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','data','Table:\x20','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Executing\x20parent\x20segment\x20query...','bold','Coverage:','/sessions/','\x20tdx\x20wf\x20attempt\x20','✔\x20Query\x20completed:\x20Processed\x20','Master:','behavior','Validating\x20RT\x20configuration...','preview','displayPreviewResults','json','ignore','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','previewParentYaml','getParentSQL','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Error\x20parsing\x20YAML:\x20','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','realtime_enabled','✔\x20Created\x20parent\x20segment\x20\x27','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x20--behavior\x20\x22','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','25wDehDM','behavior_','Rows:','dirname','message','\x20--attribute\x20\x22<name>\x22','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','parent_id','Error\x20reading\x20file:\x20','\x20--behavior\x20\x22<name>\x22','Events:','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','jobId','\x20\x20\x20\x20','\x20rows)','\x27\x20with\x20ID:\x20','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','string','-1d','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Name:\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20Context\x20set:\x20','\x0aError:','test','trigger_event','segment:parent:update','\x20rows\x20','behaviors','Error:\x20Parent\x20segment\x20name\x20is\x20required','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','customers','Overwrite\x20\x27','ID\x20Stitching:','length','\x20section','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x0aNew\x20parent\x20segment\x20\x27','column','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Error:\x20--database\x20and\x20--table\x20are\x20required','indexOf','displayRealtimeInfo','parent_segments','stop','double','realtime:','Personalization\x20service\x20description','setJobId','RT\x202.0:','Listing\x20RT-enabled\x20parent\x20segments...','enriched','start','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','ps:rt:list','Fetching\x20SQL\x20for\x20\x27','Validate:','\x20parent\x20segment\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','interval','push','errors','Create\x20parent\x20segment\x20\x27','Aborted.','personalization_services','\x20parent\x20segment','segment:parent:desc','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20\x20\x20-\x20','/\x20directories\x20exist.','tdx\x20ps\x20preview\x20','attribute','number','foreignKey','sourceTableError','/attempt/','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x27\x20and\x20run\x20workflow?','status','schemaError','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','name','stats','sort','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','verbose','addBehaviorsFile','sourceTableValid','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','Error:\x20File\x20not\x20found:\x20','coveragePercent','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','57368HaLQLH','\x20configured','getBehaviorNames','customerGroup','List\x20available\x20fields\x20for\x20segmentation','\x20=\x20','\x22,\x20\x22type\x22:\x20\x22','darwin','personalizationServices','displayColumns','population','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','Customers:','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','database','replace','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','No\x20RT-enabled\x20parent\x20segments\x20found','FINISHED','totalEvents','Attempt:','/\x20→\x20','.yml','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','rowCount','formatSchemaJson','Output\x20Database:','\x20--attribute\x20\x22','displaySummary','{\x0a\x20\x20\x22database\x22:\x20\x22','Session:','Show\x20parent\x20segment\x20details','text','\x20\x20No\x20sample\x20data\x20available','idStitching','Apply\x20changes\x20to\x20\x27','segment:parent:run','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','12935180RIWQJJ','label','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Master\x20+\x20Attributes','sections','td_client_id','Join\x20on:','Enriched:','1377wrXeqd','pushParentYaml','\x20to\x20push\x20the\x20configuration','description','master','My\x20Service','✔\x20Found\x20','win32','Site:\x20','sampleData','List\x20parent\x20segments','YAML\x20file:\x20','use','segment','reduce','No\x20parent\x20segments\x20found','\x5c$&','Fetching\x20sample\x20data...','workflowSessionId','\x20\x201.\x20Edit\x20','segment:parent:preview','/\x20directory.\x0a','segment:parent:create','Behaviors','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','workflowAttemptId','true','Available\x20behaviors:','\x0a\x20\x20\x20\x20}','segment:parent:show','/app/dw/parentSegments/','\x20\x20Database:\x20','displayPreviewHints','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','execute','Fetching\x20customers\x20schema...','Running\x20parent\x20segment\x20workflow\x20for\x20\x27'];a30_0xfafd=function(){return _0x2cf5d2;};return a30_0xfafd();}import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x2ba769 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x11f642(0xa6),LEGACY_PARENT_SEGMENT_DIR=a30_0x11f642(0x1e9);function openBrowser(_0xafeccd){const _0x414c41=a30_0x11f642,_0x3225f5=process['platform'],_0x22811c=_0x3225f5===_0x414c41(0xe1)?'open':_0x3225f5===_0x414c41(0x112)?_0x414c41(0xaf):_0x414c41(0x138);spawn(_0x22811c,[_0xafeccd],{'detached':!![],'stdio':_0x414c41(0x1fb)})['unref']();}function migrateLegacyDirectory(){const _0xc9ef1=a30_0x11f642;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2b7402=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2b7402['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xc9ef1(0x166)](a30_0x2ba769[_0xc9ef1(0x178)](_0xc9ef1(0x154)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0xc9ef1(0xc1))),console[_0xc9ef1(0x166)](a30_0x2ba769[_0xc9ef1(0x151)](_0xc9ef1(0x202)+LEGACY_PARENT_SEGMENT_DIR+_0xc9ef1(0x120))),![];console[_0xc9ef1(0x166)](a30_0x2ba769[_0xc9ef1(0x178)](_0xc9ef1(0x161)+LEGACY_PARENT_SEGMENT_DIR+_0xc9ef1(0xf0)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x2ba769[_0xc9ef1(0x13b)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4ac7e7){const _0x4c5ad0=_0x4ac7e7 instanceof Error?_0x4ac7e7[_0xc9ef1(0x20d)]:String(_0x4ac7e7);return console[_0xc9ef1(0x166)](a30_0x2ba769[_0xc9ef1(0x1c2)](_0xc9ef1(0x136)+_0x4c5ad0+'\x0a')),![];}}function a30_0x9f58(_0x5792c2,_0xdb4a34){_0x5792c2=_0x5792c2-0x93;const _0xfafdb7=a30_0xfafd();let _0x9f58f=_0xfafdb7[_0x5792c2];return _0x9f58f;}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x11f642(0x13d)](_0x483852){return migrateLegacyDirectory(),super['run'](_0x483852);}}function resolveYamlFile(_0x50b497){const _0x5e8c80=a30_0x11f642;if(_0x50b497[_0x5e8c80(0x1e8)](_0x5e8c80(0xf1))||_0x50b497['endsWith']('.yaml'))return _0x50b497;return a30_0x2024cb['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x50b497)+'.yml');}function formatProgressMessage(_0x3f7914){const _0x4117d8=a30_0x11f642,_0x38d970=_0x3f7914['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x38d970){const [,_0x189af6,_0x3a5936,_0x35cd51='']=_0x38d970;return a30_0x2ba769['dim'](_0x189af6+':')+'\x20'+_0x3a5936+a30_0x2ba769[_0x4117d8(0x151)](_0x35cd51);}return a30_0x2ba769[_0x4117d8(0x151)](_0x3f7914);}function showFileNotFoundError(_0x3d04ab,_0x2dc58e){const _0x235cc0=a30_0x11f642;console[_0x235cc0(0x166)](a30_0x2ba769[_0x235cc0(0x1c2)](_0x235cc0(0xd7)+_0x3d04ab+'\x0a')),console[_0x235cc0(0x166)](a30_0x2ba769[_0x235cc0(0x149)](_0x235cc0(0x17c)+_0x2dc58e+_0x235cc0(0x201)));}function displayRealtimeValidation(_0x1b43b5){const _0x39b094=a30_0x11f642;if(!_0x1b43b5[_0x39b094(0x1ad)])return;const _0x17f67b=_0x1b43b5['realtime'],_0x87b3fc=_0x17f67b['enabled']?a30_0x2ba769['green']('⚡\x20Enabled'):a30_0x2ba769[_0x39b094(0x178)](_0x39b094(0x180));console['error']('\x0a'+a30_0x2ba769[_0x39b094(0x151)](_0x39b094(0xac))+'\x20'+_0x87b3fc);if(_0x17f67b[_0x39b094(0x1bd)]&&_0x17f67b[_0x39b094(0x1bd)][_0x39b094(0x9c)]>0x0){console[_0x39b094(0x166)]('\x20\x20'+a30_0x2ba769[_0x39b094(0x151)](_0x39b094(0x213))+'\x20'+_0x17f67b['events']['length']+_0x39b094(0xdb));for(const _0x18f86f of _0x17f67b[_0x39b094(0x1bd)]){const _0xa1b081=_0x18f86f[_0x39b094(0xd4)]===![]?a30_0x2ba769[_0x39b094(0x1c2)]('✘'):a30_0x2ba769['green']('✔');console['error'](_0x39b094(0x216)+_0xa1b081+'\x20'+_0x18f86f[_0x39b094(0xcd)]),_0x18f86f[_0x39b094(0xc6)]&&console[_0x39b094(0x166)](_0x39b094(0x1dd)+a30_0x2ba769[_0x39b094(0x1c2)](_0x18f86f[_0x39b094(0xc6)]));}}if(_0x17f67b['attributes']&&_0x17f67b['attributes']['length']>0x0){console[_0x39b094(0x166)]('\x20\x20'+a30_0x2ba769['dim']('Attributes:')+'\x20'+_0x17f67b[_0x39b094(0x145)][_0x39b094(0x9c)]+'\x20configured');for(const _0x295bc4 of _0x17f67b[_0x39b094(0x145)]){const _0x35870d=_0x295bc4[_0x39b094(0x160)]?a30_0x2ba769[_0x39b094(0x13b)]('✔'):a30_0x2ba769['red']('✘');console['error'](_0x39b094(0x216)+_0x35870d+'\x20'+_0x295bc4[_0x39b094(0xcd)]+'\x20'+a30_0x2ba769[_0x39b094(0x151)]('('+_0x295bc4['type']+')'));}}if(_0x17f67b[_0x39b094(0xfd)]){const _0x3448f0=_0x17f67b[_0x39b094(0xfd)][_0x39b094(0x1b9)]?.[_0x39b094(0x9c)]?'\x20+\x20['+_0x17f67b[_0x39b094(0xfd)][_0x39b094(0x1b9)][_0x39b094(0x1d1)](',\x20')+']':'';console[_0x39b094(0x166)]('\x20\x20'+a30_0x2ba769[_0x39b094(0x151)](_0x39b094(0x9b))+'\x20'+_0x17f67b[_0x39b094(0xfd)]['primaryKey']+_0x3448f0);}if(_0x17f67b[_0x39b094(0xe2)]&&_0x17f67b['personalizationServices']['length']>0x0){console[_0x39b094(0x166)]('\x20\x20'+a30_0x2ba769[_0x39b094(0x151)](_0x39b094(0x1d6))+'\x20'+_0x17f67b[_0x39b094(0xe2)][_0x39b094(0x9c)]+_0x39b094(0x1d7)+(_0x17f67b[_0x39b094(0xe2)][_0x39b094(0x9c)]!==0x1?'s':''));for(const _0x2b521b of _0x17f67b['personalizationServices']){console[_0x39b094(0x166)](_0x39b094(0xc0)+_0x2b521b['name']);}}}function showParentSegmentNotSetError(_0x50a5e7){const _0x50edab=a30_0x11f642;console[_0x50edab(0x166)](a30_0x2ba769['yellow'](_0x50edab(0xcc))),console['error'](_0x50a5e7);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x196);['description']=a30_0x11f642(0x115);async[a30_0x11f642(0x12d)](_0x1b487d){const _0x4536f0=a30_0x11f642,{options:_0x2c46a1,args:_0x55aff1,tdx:_0x1c465c}=_0x1b487d,_0x442b34=_0x55aff1[0x0];_0x2c46a1['verbose']&&(console[_0x4536f0(0x166)](_0x4536f0(0x113)+_0x2c46a1[_0x4536f0(0x1c0)]),_0x442b34&&console[_0x4536f0(0x166)]('Pattern:\x20'+_0x442b34));const _0x53fdf1=await withSpinner(_0x442b34?_0x4536f0(0xd6)+_0x442b34+_0x4536f0(0x1d9):'Listing\x20parent\x20segments...',()=>_0x1c465c[_0x4536f0(0x118)][_0x4536f0(0x171)](),{'verbose':_0x2c46a1[_0x4536f0(0xd2)]});let _0x647ef0=_0x53fdf1[_0x4536f0(0x1ec)];if(_0x442b34){const _0x9af63c=_0x442b34[_0x4536f0(0xea)](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')[_0x4536f0(0xea)](/\?/g,'.'),_0x598b54=new RegExp('^'+_0x9af63c+'$','i');_0x647ef0=_0x647ef0[_0x4536f0(0x19d)](_0x16f921=>_0x598b54[_0x4536f0(0x221)](_0x16f921[_0x4536f0(0x145)][_0x4536f0(0xcd)]));}_0x647ef0['sort']((_0x2437d6,_0x3121f0)=>_0x2437d6[_0x4536f0(0x145)]['name'][_0x4536f0(0x130)](_0x3121f0[_0x4536f0(0x145)][_0x4536f0(0xcd)])),console[_0x4536f0(0x166)](_0x4536f0(0x111)+_0x647ef0[_0x4536f0(0x9c)]+_0x4536f0(0xbd)+(_0x647ef0[_0x4536f0(0x9c)]!==0x1?'s':''));const _0x79cce9=_0xd0e48c=>{const _0x2076d8=_0x4536f0;return getConsoleNextUrl(_0x2c46a1['site'],_0x2076d8(0x129)+_0xd0e48c);};if(_0x2c46a1['format']===_0x4536f0(0x1fa)||_0x2c46a1[_0x4536f0(0x142)]==='jsonl'){const _0x25f82d=_0x647ef0[_0x4536f0(0x1b3)](_0x5982f1=>({..._0x5982f1,'url':_0x79cce9(_0x5982f1['id'])}));await handleSDKOutput(_0x25f82d,_0x2c46a1);}else{if(_0x647ef0[_0x4536f0(0x9c)]===0x0)_0x442b34?console[_0x4536f0(0x1e1)](_0x4536f0(0x19b)+_0x442b34):console[_0x4536f0(0x1e1)](_0x4536f0(0x11a));else for(const _0x2a8133 of _0x647ef0){const _0x5bd6f6=_0x2a8133[_0x4536f0(0x145)][_0x4536f0(0xe4)]?a30_0x2ba769[_0x4536f0(0x151)]('\x20('+formatRows(_0x2a8133[_0x4536f0(0x145)][_0x4536f0(0xe4)])+')'):'',_0x1a60f1=hyperlink(_0x2a8133[_0x4536f0(0x145)][_0x4536f0(0xcd)],_0x79cce9(_0x2a8133['id']));console[_0x4536f0(0x1e1)](_0x4536f0(0x164)+_0x1a60f1+_0x5bd6f6);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x121);[a30_0x11f642(0x10e)]=a30_0x11f642(0xc8);async[a30_0x11f642(0x12d)](_0x46597f){const _0x55ef39=a30_0x11f642,{options:_0x1ed16f,args:_0x1e6608,tdx:_0x360b7b}=_0x46597f;console[_0x55ef39(0x166)](_0x55ef39(0x182)+_0x55ef39(0xeb)+_0x55ef39(0x1a2));const _0x3e5913=_0x1ed16f;if(_0x1e6608[_0x55ef39(0x9c)]===0x0)return console['error'](a30_0x2ba769[_0x55ef39(0x1c2)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x55ef39(0x166)](_0x55ef39(0x1ff)),0x1;const _0x5a33fe=_0x1e6608[0x0];if(!_0x3e5913[_0x55ef39(0xe9)]||!_0x3e5913[_0x55ef39(0x13a)])return console[_0x55ef39(0x166)](_0x55ef39(0xa3)),console[_0x55ef39(0x166)](_0x55ef39(0x1ff)),0x1;_0x3e5913[_0x55ef39(0xd2)]&&(console['error'](_0x55ef39(0x113)+_0x3e5913[_0x55ef39(0x1c0)]),console['error'](_0x55ef39(0x21d)+_0x5a33fe),console[_0x55ef39(0x166)]('Database:\x20'+_0x3e5913[_0x55ef39(0xe9)]),console[_0x55ef39(0x166)](_0x55ef39(0x1ed)+_0x3e5913['table']));const _0x3a1018=await loadJSONFromOptions(_0x3e5913[_0x55ef39(0x145)],_0x3e5913[_0x55ef39(0x16c)]),_0x530a32=await loadJSONFromOptions(_0x3e5913[_0x55ef39(0x96)],_0x3e5913[_0x55ef39(0x18d)]),_0x978638=await loadJSONFromOptions(_0x3e5913['customerGroup'],_0x3e5913['customerGroupFile']),_0x20b803={'name':_0x5a33fe,'description':_0x3e5913[_0x55ef39(0x10e)],'scheduleType':_0x3e5913[_0x55ef39(0x163)],'scheduleOption':_0x3e5913[_0x55ef39(0x18c)],'timezone':_0x3e5913[_0x55ef39(0x14c)],'master':{'parentDatabaseName':_0x3e5913['database'],'parentTableName':_0x3e5913[_0x55ef39(0x13a)]},'attributes':_0x3a1018,'behaviors':_0x530a32,'customerGroup':_0x978638},_0x20989c=await withSpinner(_0x55ef39(0x189)+_0x5a33fe+'\x27...',()=>_0x360b7b['segment'][_0x55ef39(0x181)](_0x20b803),{'verbose':_0x1ed16f[_0x55ef39(0xd2)]}),_0x4abb83=_0x20989c['data'];return console[_0x55ef39(0x166)](_0x55ef39(0x204)+_0x4abb83[_0x55ef39(0xcd)]+_0x55ef39(0x218)+_0x4abb83['id']),await handleSDKOutput([_0x4abb83],_0x1ed16f),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x94);['description']=a30_0x11f642(0xe5);async[a30_0x11f642(0x12d)](_0x9ecde0){const _0x158dbe=a30_0x11f642,{options:_0x24a122,args:_0x43fea0,tdx:_0x8e864d}=_0x9ecde0;console[_0x158dbe(0x166)](_0x158dbe(0x184)+_0x158dbe(0xeb)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x3cff93=_0x24a122;if(_0x43fea0[_0x158dbe(0x9c)]===0x0)return console['error'](a30_0x2ba769[_0x158dbe(0x1c2)](_0x158dbe(0x97))),console[_0x158dbe(0x166)](_0x158dbe(0x19a)),0x1;const _0x4591f0=_0x43fea0[0x0];_0x3cff93[_0x158dbe(0xd2)]&&(console['error'](_0x158dbe(0x113)+_0x3cff93[_0x158dbe(0x1c0)]),console['error'](_0x158dbe(0x152)+_0x4591f0));const _0x232c67=await withSpinner(_0x158dbe(0x15b)+_0x4591f0+_0x158dbe(0x1d9),()=>_0x8e864d['segment'][_0x158dbe(0x159)](_0x4591f0),{'verbose':_0x3cff93[_0x158dbe(0xd2)]}),_0x4aede1=_0x232c67[_0x158dbe(0x1ec)],_0x42b722=await loadJSONFromOptions(_0x3cff93[_0x158dbe(0x1a7)],_0x3cff93[_0x158dbe(0x1cf)]),_0x4ccfcc=await loadJSONFromOptions(_0x3cff93[_0x158dbe(0x170)],_0x3cff93[_0x158dbe(0xd3)]),_0x1b0ac8={'name':_0x4aede1[_0x158dbe(0xcd)],'description':_0x3cff93[_0x158dbe(0x10e)]!==undefined?_0x3cff93[_0x158dbe(0x10e)]:_0x4aede1[_0x158dbe(0x10e)],'scheduleType':_0x3cff93[_0x158dbe(0x163)]!==undefined?_0x3cff93[_0x158dbe(0x163)]:_0x4aede1[_0x158dbe(0x163)],'scheduleOption':_0x3cff93[_0x158dbe(0x18c)]!==undefined?_0x3cff93[_0x158dbe(0x18c)]:_0x4aede1[_0x158dbe(0x18c)],'timezone':_0x3cff93['timezone']!==undefined?_0x3cff93['timezone']:_0x4aede1[_0x158dbe(0x14c)],'master':_0x4aede1[_0x158dbe(0x10f)],'attributes':_0x42b722?[..._0x4aede1[_0x158dbe(0x145)]||[],..._0x42b722]:_0x4aede1[_0x158dbe(0x145)],'behaviors':_0x4ccfcc?[..._0x4aede1[_0x158dbe(0x96)]||[],..._0x4ccfcc]:_0x4aede1['behaviors'],'customerGroup':_0x4aede1[_0x158dbe(0xdd)]},_0x386a77=await withSpinner(_0x158dbe(0x173)+_0x4591f0+_0x158dbe(0x1d9),()=>_0x8e864d['segment']['updateParent'](_0x4591f0,_0x1b0ac8),{'verbose':_0x3cff93[_0x158dbe(0xd2)]}),_0x42143b=_0x386a77[_0x158dbe(0x1ec)];return console[_0x158dbe(0x166)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x42143b[_0x158dbe(0xcd)]+'\x27'),await handleSDKOutput([_0x42143b],_0x3cff93),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x131);[a30_0x11f642(0x10e)]=a30_0x11f642(0xd9);async[a30_0x11f642(0x12d)](_0x5a2ca3){const _0x29944b=a30_0x11f642,{options:_0x2eb5e3,args:_0x158ac9,tdx:_0x3adeec}=_0x5a2ca3,_0x2b5131=_0x2eb5e3,_0x298968=_0x158ac9[0x0]||_0x2eb5e3['parentSegment'];if(!_0x298968)return showParentSegmentNotSetError(_0x29944b(0x21e)+_0x29944b(0x1ce)),0x1;if(_0x2b5131[_0x29944b(0x117)]&&_0x2b5131['output'])return console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x1c2)](_0x29944b(0x219))),console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x151)](_0x29944b(0x123))),console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x151)](_0x29944b(0x18b)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a30_0x2ba769[_0x29944b(0x149)](_0x29944b(0x1d0))),0x1;const _0x53b18d=_0x2b5131[_0x29944b(0x1d5)]||a30_0x2024cb[_0x29944b(0x1d1)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x298968)+_0x29944b(0xf1));_0x2b5131[_0x29944b(0xd2)]&&(console[_0x29944b(0x166)](_0x29944b(0x113)+_0x2b5131[_0x29944b(0x1c0)]),console[_0x29944b(0x166)](_0x29944b(0x152)+_0x298968),console[_0x29944b(0x166)](_0x29944b(0x140)+_0x53b18d));const _0x4b6a5e=await withSpinner(_0x29944b(0x191)+_0x298968+_0x29944b(0x1d9),()=>_0x3adeec['segment']['pullParentYaml'](_0x298968),{'verbose':_0x2b5131[_0x29944b(0xd2)]}),_0x38ca21=_0x4b6a5e[_0x29944b(0x1ec)];if(existsSync(_0x53b18d)){const _0x405f89=readFileSync(_0x53b18d,'utf-8'),_0x11d56e=generateDiff(_0x405f89,_0x38ca21);if(!hasChanges(_0x11d56e))console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x13b)]('✔')+'\x20No\x20changes\x20-\x20'+a30_0x2ba769[_0x29944b(0x149)](_0x53b18d)+_0x29944b(0x1c4));else{console[_0x29944b(0x166)]('\x0aChanges\x20to\x20\x27'+_0x53b18d+'\x27:'),console[_0x29944b(0x166)]('─'['repeat'](0x3c)),console[_0x29944b(0x166)](formatDiffWithColors(_0x11d56e)),console['error']('─'[_0x29944b(0x183)](0x3c));if(!_0x2b5131[_0x29944b(0x1a3)]){if(!isInteractive())return console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x1c2)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x151)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2641d5=await confirmKey(_0x29944b(0x9a)+_0x53b18d+'\x27?');if(!_0x2641d5)return console['error'](a30_0x2ba769[_0x29944b(0x178)](_0x29944b(0xbb))),0x1;}writeFileSync(_0x53b18d,_0x38ca21,_0x29944b(0x195)),console['error'](a30_0x2ba769[_0x29944b(0x13b)]('✔')+_0x29944b(0xa1)+a30_0x2ba769[_0x29944b(0x149)](_0x53b18d));}}else{const _0x4e9b1c=a30_0x2024cb[_0x29944b(0x20c)](_0x53b18d);!existsSync(_0x4e9b1c)&&mkdirSync(_0x4e9b1c,{'recursive':!![]}),writeFileSync(_0x53b18d,_0x38ca21,'utf-8'),console[_0x29944b(0x166)](a30_0x2ba769['green']('✔')+_0x29944b(0xa1)+a30_0x2ba769[_0x29944b(0x149)](_0x53b18d));}return saveSessionContext({'parent_segment':_0x298968},_0x2b5131[_0x29944b(0x1bf)]),console[_0x29944b(0x166)](a30_0x2ba769[_0x29944b(0x13b)]('✔')+_0x29944b(0x21f)+a30_0x2ba769[_0x29944b(0x151)]('parent_segment')+_0x29944b(0xdf)+a30_0x2ba769[_0x29944b(0x149)](_0x298968)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x15f);[a30_0x11f642(0x10e)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a30_0x11f642(0x12d)](_0xdd2901){const _0x2c3e56=a30_0x11f642,{options:_0x1ab935,args:_0x2cec00,tdx:_0x4a2345}=_0xdd2901,_0x4997fb=_0x1ab935,_0x3fe60a=_0x2cec00[0x0]||_0x1ab935[_0x2c3e56(0x1a0)];if(!_0x3fe60a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2c3e56(0x101)),0x1;const _0x2a9f95=resolveYamlFile(_0x3fe60a);if(!existsSync(_0x2a9f95))return showFileNotFoundError(_0x2a9f95,_0x3fe60a),0x1;_0x4997fb[_0x2c3e56(0xd2)]&&(console['error']('Site:\x20'+_0x4997fb['site']),console[_0x2c3e56(0x166)](_0x2c3e56(0x116)+_0x2a9f95));let _0x468f58;try{_0x468f58=readFileSync(_0x2a9f95,_0x2c3e56(0x195));}catch(_0x346a60){const _0x2bca8f=_0x346a60 instanceof Error?_0x346a60[_0x2c3e56(0x20d)]:String(_0x346a60);return console[_0x2c3e56(0x166)](_0x2c3e56(0x211)+_0x2bca8f),0x1;}const _0x106e7d=await withSpinner(_0x2c3e56(0x176),()=>_0x4a2345[_0x2c3e56(0x118)]['pushParentYaml'](_0x468f58),{'verbose':_0x4997fb[_0x2c3e56(0xd2)]}),_0x58ac4e=_0x106e7d['data'],{isNew:_0x43f08e,name:_0x4625c6,hasChanges:_0x2987be,diffFormatted:_0x489fac}=_0x58ac4e;if(!_0x2987be)return console[_0x2c3e56(0x166)](_0x2c3e56(0x1cd)+_0x4625c6+_0x2c3e56(0x1c6)),0x0;_0x43f08e?console[_0x2c3e56(0x166)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x4625c6+'\x27:'):console['error'](_0x2c3e56(0x17b)+_0x4625c6+'\x27:');console[_0x2c3e56(0x166)]('─'['repeat'](0x3c)),console[_0x2c3e56(0x166)](_0x489fac),console[_0x2c3e56(0x166)]('─'['repeat'](0x3c));const _0x7f1c3a=_0x43f08e?_0x2c3e56(0xba)+_0x4625c6+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x4625c6+'\x27?';if(!_0x4997fb[_0x2c3e56(0x1a3)]){if(!isInteractive())return console[_0x2c3e56(0x166)](a30_0x2ba769[_0x2c3e56(0x1c2)](_0x2c3e56(0x220)),_0x2c3e56(0x165)),console[_0x2c3e56(0x166)](a30_0x2ba769[_0x2c3e56(0x151)](_0x2c3e56(0x14e))),0x1;const _0x7ecb2c=await confirmKey(_0x7f1c3a);if(!_0x7ecb2c)return console['error'](a30_0x2ba769[_0x2c3e56(0x178)]('Aborted.')),0x1;}const _0x26c74b=_0x43f08e?_0x2c3e56(0x197):_0x2c3e56(0x1b4),_0x54c7eb=await withSpinner(_0x26c74b+_0x2c3e56(0xb4)+_0x4625c6+_0x2c3e56(0x1d9),()=>_0x58ac4e['apply'](),{'verbose':_0x4997fb[_0x2c3e56(0xd2)]}),_0x4c435d=_0x54c7eb['data'],_0x2c2ee9=getConsoleNextUrl(_0x4997fb[_0x2c3e56(0x1c0)],'/app/dw/parentSegments/'+_0x4c435d['id']),_0x29958c=_0x43f08e?'Created':_0x2c3e56(0x167);return console[_0x2c3e56(0x166)]('✔\x20'+_0x29958c+_0x2c3e56(0xb4)+_0x4c435d[_0x2c3e56(0xcd)]+'\x27'),console['error']('\x20\x20'+_0x2c2ee9),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a30_0x11f642(0x18f);[a30_0x11f642(0x10e)]=a30_0x11f642(0x162);async['execute'](_0x49c1fd){const _0x3b1578=a30_0x11f642,{options:_0x231344,args:_0x4b494b,tdx:_0x5d1e80}=_0x49c1fd,_0x2608d0=_0x231344,_0x14f68c=_0x4b494b[0x0]||_0x231344[_0x3b1578(0x1a0)];if(!_0x14f68c)return showParentSegmentNotSetError(_0x3b1578(0x214)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x3b1578(0x156)+_0x3b1578(0x12c)+_0x3b1578(0xb6)+_0x3b1578(0x139)),0x1;const _0x29a3a1=resolveYamlFile(_0x14f68c);if(!existsSync(_0x29a3a1))return showFileNotFoundError(_0x29a3a1,_0x14f68c),0x1;_0x2608d0[_0x3b1578(0xd2)]&&(console[_0x3b1578(0x166)]('Site:\x20'+_0x2608d0[_0x3b1578(0x1c0)]),console['error'](_0x3b1578(0x116)+_0x29a3a1));let _0x58530d;try{_0x58530d=readFileSync(_0x29a3a1,_0x3b1578(0x195));}catch(_0x3f623f){const _0x1b1b98=_0x3f623f instanceof Error?_0x3f623f[_0x3b1578(0x20d)]:String(_0x3f623f);return console[_0x3b1578(0x166)]('Error\x20reading\x20file:\x20'+_0x1b1b98),0x1;}const _0x3a5f57=createCommandSpinner(a30_0x2ba769['dim']('Validating\x20configuration...'),{'verbose':_0x2608d0[_0x3b1578(0xd2)]});_0x3a5f57['start']();const _0x4761e1={'onProgress':_0x3dd55f=>{_0x3a5f57['text']=formatProgressMessage(_0x3dd55f);}};if(_0x2608d0[_0x3b1578(0x10f)])_0x4761e1[_0x3b1578(0x10f)]=!![];if(_0x2608d0[_0x3b1578(0xae)])_0x4761e1[_0x3b1578(0xae)]=!![];_0x2608d0[_0x3b1578(0xc3)]&&(_0x4761e1[_0x3b1578(0xc3)]=_0x2608d0[_0x3b1578(0xc3)]);_0x2608d0[_0x3b1578(0x1f6)]&&(_0x4761e1[_0x3b1578(0x1f6)]=_0x2608d0[_0x3b1578(0x1f6)]);if(_0x2608d0[_0x3b1578(0xb7)])_0x4761e1['interval']=_0x2608d0['interval'];let _0x14fc61;try{_0x14fc61=await _0x5d1e80[_0x3b1578(0x118)][_0x3b1578(0x1d3)](_0x58530d,_0x4761e1),_0x3a5f57[_0x3b1578(0xa7)]();}catch(_0x5001d3){_0x3a5f57[_0x3b1578(0xa7)]();throw _0x5001d3;}const _0x1c1cc5=_0x2608d0[_0x3b1578(0xb7)]||_0x3b1578(0x21b);return this[_0x3b1578(0x1dc)](_0x14fc61,_0x4761e1,_0x29a3a1,_0x1c1cc5),_0x14fc61[_0x3b1578(0x1c1)]?0x0:0x1;}[a30_0x11f642(0x1dc)](_0x1f79a1,_0x393b06,_0x1779f7,_0xf9e3e3){const _0x50473a=a30_0x11f642;console[_0x50473a(0x166)]('\x0a'+a30_0x2ba769['bold'](_0x50473a(0xb3))+'\x20'+_0x1f79a1[_0x50473a(0xcd)]),console['error']('═'[_0x50473a(0x183)](0x3c)),this[_0x50473a(0x1cb)](_0x1f79a1);if(typeof _0x393b06['attribute']===_0x50473a(0x21a)){this['displayAttributesStats'](_0x1f79a1),this[_0x50473a(0xf7)](_0x1f79a1),this['displayPreviewHints'](_0x1779f7,_0xf9e3e3,_0x50473a(0xc3),_0x393b06[_0x50473a(0xc3)]);return;}if(_0x393b06[_0x50473a(0xc3)]===!![]){this[_0x50473a(0x141)](_0x1f79a1),this['displaySummary'](_0x1f79a1),this[_0x50473a(0x12b)](_0x1779f7,_0xf9e3e3,'attributes');return;}if(typeof _0x393b06['behavior']===_0x50473a(0x21a)){this[_0x50473a(0x1b8)](_0x1f79a1,_0xf9e3e3),this[_0x50473a(0xf7)](_0x1f79a1),this['displayPreviewHints'](_0x1779f7,_0xf9e3e3,_0x50473a(0x1f6),_0x393b06[_0x50473a(0x1f6)]);return;}if(_0x393b06['behavior']===!![]){this['displayBehaviorsStats'](_0x1f79a1,_0xf9e3e3),this[_0x50473a(0xf7)](_0x1f79a1),this[_0x50473a(0x12b)](_0x1779f7,_0xf9e3e3,_0x50473a(0x96));return;}this['displayAttributesStats'](_0x1f79a1),this[_0x50473a(0x1b8)](_0x1f79a1,_0xf9e3e3),this[_0x50473a(0xa5)](_0x1f79a1),this[_0x50473a(0xf7)](_0x1f79a1),this[_0x50473a(0x12b)](_0x1779f7,_0xf9e3e3,_0x50473a(0x1a4));}['displayRealtimeInfo'](_0x28b2d9){displayRealtimeValidation(_0x28b2d9);}[a30_0x11f642(0x12b)](_0x517cfc,_0x3344eb,_0x1285e9,_0x4d811e){const _0x492492=a30_0x11f642;console[_0x492492(0x166)]('\x0a'+a30_0x2ba769[_0x492492(0x151)]('To\x20view\x20sample\x20data:'));const _0x2930cd=_0x3344eb!==_0x492492(0x21b)?_0x492492(0x147)+_0x3344eb:'';if(_0x1285e9===_0x492492(0xc3)&&_0x4d811e)console[_0x492492(0x166)]('\x20\x20'+a30_0x2ba769['dim'](_0x492492(0xc2)+_0x517cfc+_0x492492(0xf6)+_0x4d811e+'\x22'+_0x2930cd));else{if(_0x1285e9===_0x492492(0x1f6)&&_0x4d811e)console[_0x492492(0x166)]('\x20\x20'+a30_0x2ba769['dim'](_0x492492(0xc2)+_0x517cfc+_0x492492(0x207)+_0x4d811e+'\x22'+_0x2930cd));else(_0x1285e9===_0x492492(0x145)||_0x1285e9==='all')&&console[_0x492492(0x166)]('\x20\x20'+a30_0x2ba769[_0x492492(0x151)](_0x492492(0xc2)+_0x517cfc+_0x492492(0x20e)+_0x2930cd));}(_0x1285e9==='behaviors'||_0x1285e9===_0x492492(0x1a4))&&console[_0x492492(0x166)]('\x20\x20'+a30_0x2ba769[_0x492492(0x151)](_0x492492(0xc2)+_0x517cfc+_0x492492(0x212)+_0x2930cd)),_0x1285e9===_0x492492(0x1a4)&&console['error']('\x20\x20'+a30_0x2ba769[_0x492492(0x151)](_0x492492(0xc2)+_0x517cfc+_0x492492(0x1b0)+_0x2930cd));}['displayMasterInfo'](_0x40a45e){const _0xed6c73=a30_0x11f642,{master:_0x9c18d3}=_0x40a45e,_0x48cf9c=_0x9c18d3[_0xed6c73(0x1df)]?a30_0x2ba769['green']('✔'):a30_0x2ba769[_0xed6c73(0x1c2)]('✘');console[_0xed6c73(0x166)]('\x0a'+a30_0x2ba769['dim'](_0xed6c73(0x134))),console['error'](_0x48cf9c+'\x20'+a30_0x2ba769['bold'](_0x9c18d3[_0xed6c73(0xe9)]+'.'+_0x9c18d3[_0xed6c73(0x13a)])),_0x9c18d3[_0xed6c73(0x1df)]?_0x9c18d3[_0xed6c73(0xf3)]!==undefined&&console[_0xed6c73(0x166)]('\x20\x20'+a30_0x2ba769[_0xed6c73(0x151)](_0xed6c73(0x20b))+'\x20'+a30_0x2ba769['cyan'](formatRows(_0x9c18d3[_0xed6c73(0xf3)]))):console['error']('\x20\x20'+a30_0x2ba769['red'](_0xed6c73(0x1b5))+'\x20'+_0x9c18d3[_0xed6c73(0xcb)]);}[a30_0x11f642(0x141)](_0x3c822e){const _0x4d2f0e=a30_0x11f642;if(_0x3c822e[_0x4d2f0e(0x145)][_0x4d2f0e(0x9c)]===0x0)return;console[_0x4d2f0e(0x166)]('\x0a'+a30_0x2ba769[_0x4d2f0e(0x151)](_0x4d2f0e(0x17d)));for(const _0x9043f0 of _0x3c822e[_0x4d2f0e(0x145)]){const _0x4c5b67=_0x9043f0[_0x4d2f0e(0x1df)]?a30_0x2ba769['green']('✔'):a30_0x2ba769['red']('✘');let _0x51a30b='';if(_0x9043f0['schemaValid']&&_0x9043f0[_0x4d2f0e(0x1af)]!==undefined&&_0x9043f0[_0x4d2f0e(0xd8)]!==undefined){const _0x3e21e4=_0x9043f0[_0x4d2f0e(0xd8)]['toFixed'](0x1),_0x9084e9=_0x9043f0[_0x4d2f0e(0xd8)]>=0x50?a30_0x2ba769['green']:_0x9043f0[_0x4d2f0e(0xd8)]>=0x32?a30_0x2ba769[_0x4d2f0e(0x178)]:a30_0x2ba769['red'];_0x51a30b='\x20'+a30_0x2ba769['dim'](_0x4d2f0e(0x1f1))+'\x20'+_0x9084e9(_0x3e21e4+'%')+'\x20('+formatRows(_0x9043f0['matchedCount'])+_0x4d2f0e(0x217);}console['error'](_0x4c5b67+'\x20'+a30_0x2ba769['bold'](_0x9043f0[_0x4d2f0e(0xcd)])+_0x51a30b),console[_0x4d2f0e(0x166)]('\x20\x20'+a30_0x2ba769['dim']('Source:')+'\x20'+a30_0x2ba769[_0x4d2f0e(0x1f0)](_0x9043f0[_0x4d2f0e(0xe9)]+'.'+_0x9043f0[_0x4d2f0e(0x13a)]));const _0x9cb08a=_0x9043f0[_0x4d2f0e(0x14d)]===_0x9043f0[_0x4d2f0e(0xc5)]?a30_0x2ba769[_0x4d2f0e(0x151)](_0x4d2f0e(0x109))+'\x20'+_0x9043f0[_0x4d2f0e(0x14d)]:a30_0x2ba769[_0x4d2f0e(0x151)]('Join:')+'\x20'+_0x9043f0[_0x4d2f0e(0x14d)]+_0x4d2f0e(0xdf)+_0x9043f0[_0x4d2f0e(0xc5)];console['error']('\x20\x20'+_0x9cb08a),console['error']('\x20\x20'+a30_0x2ba769[_0x4d2f0e(0x151)](_0x4d2f0e(0x17e))),this[_0x4d2f0e(0xe3)](_0x9043f0['columns']),!_0x9043f0[_0x4d2f0e(0x1df)]&&console[_0x4d2f0e(0x166)]('\x20\x20'+a30_0x2ba769['red'](_0x4d2f0e(0x1b5))+'\x20'+_0x9043f0[_0x4d2f0e(0xcb)]);}}['displayBehaviorsStats'](_0x36fccb,_0x30ab02){const _0x1a70d9=a30_0x11f642;if(_0x36fccb[_0x1a70d9(0x96)]['length']===0x0)return;console['error']('\x0a'+a30_0x2ba769[_0x1a70d9(0x151)](_0x1a70d9(0x122))+'\x20'+a30_0x2ba769[_0x1a70d9(0x151)]('('+_0x30ab02+')'));for(const _0xa564bd of _0x36fccb['behaviors']){const _0x186813=_0xa564bd[_0x1a70d9(0x1df)]?a30_0x2ba769[_0x1a70d9(0x13b)]('✔'):a30_0x2ba769[_0x1a70d9(0x1c2)]('✘');let _0x268226='';if(_0xa564bd['schemaValid']&&_0xa564bd[_0x1a70d9(0x19f)]!==undefined&&_0xa564bd[_0x1a70d9(0xee)]!==undefined){const _0x1e25d2=_0xa564bd[_0x1a70d9(0x15d)]?.[_0x1a70d9(0x187)](0x1)||'?',_0x1684d5=(_0xa564bd[_0x1a70d9(0x15d)]??0x0)>=0x32?a30_0x2ba769[_0x1a70d9(0x13b)]:(_0xa564bd[_0x1a70d9(0x15d)]??0x0)>=0x14?a30_0x2ba769['yellow']:a30_0x2ba769[_0x1a70d9(0x1c2)];_0x268226='\x20'+a30_0x2ba769[_0x1a70d9(0x151)](_0x1a70d9(0xe7))+'\x20'+_0x1684d5(formatRows(_0xa564bd[_0x1a70d9(0x19f)]))+'\x20('+_0x1e25d2+_0x1a70d9(0x16f)+a30_0x2ba769[_0x1a70d9(0x151)]('Events:')+'\x20'+a30_0x2ba769[_0x1a70d9(0x149)](formatRows(_0xa564bd['totalEvents']));}console['error'](_0x186813+'\x20'+a30_0x2ba769[_0x1a70d9(0x1f0)](_0xa564bd[_0x1a70d9(0xcd)])+_0x268226),console['error']('\x20\x20'+a30_0x2ba769[_0x1a70d9(0x151)]('Source:')+'\x20'+a30_0x2ba769[_0x1a70d9(0x1f0)](_0xa564bd[_0x1a70d9(0xe9)]+'.'+_0xa564bd[_0x1a70d9(0x13a)]));const _0x4ce388=_0xa564bd[_0x1a70d9(0x14d)]===_0xa564bd[_0x1a70d9(0xc5)]?a30_0x2ba769[_0x1a70d9(0x151)](_0x1a70d9(0x109))+'\x20'+_0xa564bd[_0x1a70d9(0x14d)]:a30_0x2ba769[_0x1a70d9(0x151)](_0x1a70d9(0x174))+'\x20'+_0xa564bd[_0x1a70d9(0x14d)]+_0x1a70d9(0xdf)+_0xa564bd[_0x1a70d9(0xc5)];console[_0x1a70d9(0x166)]('\x20\x20'+_0x4ce388),console['error']('\x20\x20'+a30_0x2ba769[_0x1a70d9(0x151)](_0x1a70d9(0x17e))),this['displayColumns'](_0xa564bd[_0x1a70d9(0x16d)]),!_0xa564bd[_0x1a70d9(0x1df)]&&console[_0x1a70d9(0x166)]('\x20\x20'+a30_0x2ba769[_0x1a70d9(0x1c2)](_0x1a70d9(0x1b5))+'\x20'+_0xa564bd[_0x1a70d9(0xcb)]);}}['displayColumns'](_0x1462f8){const _0x511f2c=a30_0x11f642;for(const _0x336e29 of _0x1462f8){_0x336e29[_0x511f2c(0x104)]===_0x336e29[_0x511f2c(0xa0)]||_0x336e29[_0x511f2c(0xa0)]==='*'?console[_0x511f2c(0x166)]('\x20\x20\x20\x20-\x20'+_0x336e29[_0x511f2c(0x104)]):console[_0x511f2c(0x166)]('\x20\x20\x20\x20-\x20'+_0x336e29[_0x511f2c(0x104)]+'\x20'+a30_0x2ba769[_0x511f2c(0x151)]('('+_0x336e29[_0x511f2c(0xa0)]+')'));}}[a30_0x11f642(0xf7)](_0xd2b8d7){const _0x352d88=a30_0x11f642;console[_0x352d88(0x166)]('─'[_0x352d88(0x183)](0x3c));if(_0xd2b8d7['errors']['length']>0x0){console[_0x352d88(0x166)]('\x0a'+a30_0x2ba769['red'](_0x352d88(0x13f)));for(const _0x25cbea of _0xd2b8d7[_0x352d88(0xb9)]){console[_0x352d88(0x166)]('\x20\x20'+a30_0x2ba769['red']('•')+'\x20'+_0x25cbea);}}_0xd2b8d7[_0x352d88(0x1c1)]&&console[_0x352d88(0x166)]('\x0a'+a30_0x2ba769[_0x352d88(0x13b)]('✔')+_0x352d88(0x18e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x11f);['description']=a30_0x11f642(0xb0);async['execute'](_0x6edf0f){const _0x4d40b6=a30_0x11f642,{options:_0x380fe8,args:_0x1f9d4f,tdx:_0x248982}=_0x6edf0f,_0x424a13=_0x380fe8,_0x4c55cd=_0x1f9d4f[0x0]||_0x380fe8[_0x4d40b6(0x1a0)];if(!_0x4c55cd)return showParentSegmentNotSetError(_0x4d40b6(0x21c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x4d40b6(0x1a1)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4d40b6(0x105)+_0x4d40b6(0x1fc)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x424a13[_0x4d40b6(0x10f)]&&!_0x424a13[_0x4d40b6(0xc3)]&&!_0x424a13[_0x4d40b6(0x1f6)]&&!_0x424a13['enriched'])return console[_0x4d40b6(0x166)](a30_0x2ba769[_0x4d40b6(0x1c2)](_0x4d40b6(0xd5))),console[_0x4d40b6(0x166)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x4d40b6(0x1c8)),console[_0x4d40b6(0x166)](_0x4d40b6(0xb5)),console[_0x4d40b6(0x166)](_0x4d40b6(0x1db)),console[_0x4d40b6(0x166)](_0x4d40b6(0x1a5)),console[_0x4d40b6(0x166)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x175f82=resolveYamlFile(_0x4c55cd);if(!existsSync(_0x175f82))return showFileNotFoundError(_0x175f82,_0x4c55cd),0x1;_0x424a13['verbose']&&(console['error'](_0x4d40b6(0x113)+_0x424a13[_0x4d40b6(0x1c0)]),console[_0x4d40b6(0x166)](_0x4d40b6(0x116)+_0x175f82));let _0x40014a;try{_0x40014a=readFileSync(_0x175f82,_0x4d40b6(0x195));}catch(_0x3ea8a3){const _0x44832f=_0x3ea8a3 instanceof Error?_0x3ea8a3[_0x4d40b6(0x20d)]:String(_0x3ea8a3);return console[_0x4d40b6(0x166)](_0x4d40b6(0x211)+_0x44832f),0x1;}let _0x53951f;try{_0x53951f=parseDef(_0x40014a);}catch(_0x2cdf5f){const _0x2f36cf=_0x2cdf5f instanceof Error?_0x2cdf5f['message']:String(_0x2cdf5f);return console[_0x4d40b6(0x166)](a30_0x2ba769['red'](_0x4d40b6(0x200)+_0x2f36cf)),0x1;}if(_0x424a13['attribute']===!![]||_0x424a13[_0x4d40b6(0xc3)]===''){const _0x65cc49=_0x53951f[_0x4d40b6(0x145)]?.[_0x4d40b6(0x1b3)](_0x23281f=>_0x23281f['name'])||[];if(_0x65cc49[_0x4d40b6(0x9c)]===0x0)console[_0x4d40b6(0x166)](a30_0x2ba769[_0x4d40b6(0x1c2)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x4d40b6(0x166)](a30_0x2ba769[_0x4d40b6(0x1c2)](_0x4d40b6(0x1e7))),console[_0x4d40b6(0x166)]('Available\x20attributes:');for(const _0x131da6 of _0x65cc49){console[_0x4d40b6(0x166)]('\x20\x20'+a30_0x2ba769[_0x4d40b6(0x149)](_0x131da6));}console[_0x4d40b6(0x166)](_0x4d40b6(0x15e)+_0x4c55cd+_0x4d40b6(0xf6)+_0x65cc49[0x0]+'\x22');}return 0x1;}if(_0x424a13['behavior']===!![]||_0x424a13[_0x4d40b6(0x1f6)]===''){const _0x23eed2=_0x53951f['behaviors']?.[_0x4d40b6(0x1b3)](_0x2e3d40=>_0x2e3d40[_0x4d40b6(0xcd)])||[];if(_0x23eed2['length']===0x0)console[_0x4d40b6(0x166)](a30_0x2ba769[_0x4d40b6(0x1c2)](_0x4d40b6(0xbf)));else{console['error'](a30_0x2ba769[_0x4d40b6(0x1c2)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x4d40b6(0x166)](_0x4d40b6(0x126));for(const _0x3ea95 of _0x23eed2){console[_0x4d40b6(0x166)]('\x20\x20'+a30_0x2ba769[_0x4d40b6(0x149)](_0x3ea95));}console[_0x4d40b6(0x166)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x4c55cd+_0x4d40b6(0x207)+_0x23eed2[0x0]+'\x22');}return 0x1;}const _0x565e5b=createCommandSpinner(a30_0x2ba769[_0x4d40b6(0x151)](_0x4d40b6(0x11c)),{'verbose':_0x424a13[_0x4d40b6(0xd2)]});_0x565e5b[_0x4d40b6(0xaf)]();const _0x31e64e={'onProgress':_0x552bee=>{const _0x2d9da7=_0x4d40b6;_0x565e5b[_0x2d9da7(0xfb)]=formatProgressMessage(_0x552bee);}};if(_0x424a13[_0x4d40b6(0x10f)])_0x31e64e['master']=!![];if(_0x424a13[_0x4d40b6(0xc3)]&&typeof _0x424a13[_0x4d40b6(0xc3)]===_0x4d40b6(0x21a))_0x31e64e['attribute']=_0x424a13['attribute'];if(_0x424a13[_0x4d40b6(0x1f6)]&&typeof _0x424a13['behavior']===_0x4d40b6(0x21a))_0x31e64e[_0x4d40b6(0x1f6)]=_0x424a13['behavior'];if(_0x424a13[_0x4d40b6(0xae)])_0x31e64e[_0x4d40b6(0xae)]=!![];if(_0x424a13[_0x4d40b6(0xb7)])_0x31e64e[_0x4d40b6(0xb7)]=_0x424a13[_0x4d40b6(0xb7)];let _0xe371e;try{_0xe371e=await _0x248982[_0x4d40b6(0x118)][_0x4d40b6(0x1fd)](_0x40014a,_0x31e64e),_0x565e5b[_0x4d40b6(0xa7)]();}catch(_0x5a9556){_0x565e5b['stop']();throw _0x5a9556;}return await this[_0x4d40b6(0x1f9)](_0xe371e,{'master':_0x424a13[_0x4d40b6(0x10f)],'attribute':typeof _0x424a13[_0x4d40b6(0xc3)]===_0x4d40b6(0x21a)?_0x424a13['attribute']:undefined,'behavior':typeof _0x424a13[_0x4d40b6(0x1f6)]===_0x4d40b6(0x21a)?_0x424a13[_0x4d40b6(0x1f6)]:undefined,'enriched':_0x424a13[_0x4d40b6(0xae)]}),_0xe371e['allValid']?0x0:0x1;}async[a30_0x11f642(0x1f9)](_0x334baf,_0x4a682e){const _0x8665d7=a30_0x11f642;console[_0x8665d7(0x166)]('\x0a'+a30_0x2ba769[_0x8665d7(0x1f0)](_0x8665d7(0x1b6))+'\x20'+_0x334baf[_0x8665d7(0xcd)]),console['error']('═'[_0x8665d7(0x183)](0x3c));if(_0x4a682e[_0x8665d7(0x10f)]&&_0x334baf['sampleData']){const _0x9bbb2e=a30_0x2ba769['dim'](_0x8665d7(0x1f5))+'\x20'+a30_0x2ba769[_0x8665d7(0x1f0)](_0x334baf[_0x8665d7(0x10f)][_0x8665d7(0xe9)]+'.'+_0x334baf[_0x8665d7(0x10f)][_0x8665d7(0x13a)]);await this[_0x8665d7(0x175)](_0x9bbb2e,_0x334baf[_0x8665d7(0x114)]);}else{if(_0x4a682e[_0x8665d7(0xc3)]&&_0x334baf['sampleData']){const _0x2d45f4=a30_0x2ba769[_0x8665d7(0x151)]('Attribute:')+'\x20'+a30_0x2ba769[_0x8665d7(0x1f0)](_0x4a682e['attribute']);await this['displaySampleData'](_0x2d45f4,_0x334baf[_0x8665d7(0x114)]);}else{if(_0x4a682e['behavior']&&_0x334baf[_0x8665d7(0x114)]){const _0x6927e5=a30_0x2ba769[_0x8665d7(0x151)]('Behavior:')+'\x20'+a30_0x2ba769['bold'](_0x4a682e['behavior']);await this[_0x8665d7(0x175)](_0x6927e5,_0x334baf[_0x8665d7(0x114)]);}else{if(_0x4a682e[_0x8665d7(0xae)]&&_0x334baf['sampleData']){const _0x90c779=a30_0x2ba769[_0x8665d7(0x151)](_0x8665d7(0x10a))+'\x20'+a30_0x2ba769['bold'](_0x8665d7(0x106));await this['displaySampleData'](_0x90c779,_0x334baf[_0x8665d7(0x114)]);}else!_0x334baf[_0x8665d7(0x114)]&&console[_0x8665d7(0x166)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x334baf[_0x8665d7(0xb9)][_0x8665d7(0x9c)]>0x0){console[_0x8665d7(0x166)]('─'['repeat'](0x3c)),console['error']('\x0a'+a30_0x2ba769['red'](_0x8665d7(0x13f)));for(const _0x55a0a9 of _0x334baf[_0x8665d7(0xb9)]){console[_0x8665d7(0x166)]('\x20\x20'+a30_0x2ba769[_0x8665d7(0x1c2)]('•')+'\x20'+_0x55a0a9);}}}async['displaySampleData'](_0xc53c49,_0x11c808){const _0x391097=a30_0x11f642;if(_0x11c808[_0x391097(0x9c)]===0x0){console[_0x391097(0x166)]('\x0a'+_0xc53c49),console[_0x391097(0x166)](_0x391097(0xfc));return;}console['error']('\x0a'+_0xc53c49);const _0x237807=Object[_0x391097(0x169)](_0x11c808[0x0])[_0x391097(0x1b3)](_0x363a2a=>({'name':_0x363a2a,'type':typeof _0x11c808[0x0][_0x363a2a]===_0x391097(0xc4)?_0x391097(0xa8):_0x391097(0x1be)})),_0x324fba={'queryId':_0x391097(0x1f8),'columns':_0x237807,'data':_0x11c808,'stats':{'state':_0x391097(0xed),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x11c808[_0x391097(0x9c)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x456f69=formatAsTable(_0x324fba,_0x11c808[_0x391097(0x9c)],!![]);await writeOutput(_0x456f69,undefined,_0x391097(0x13a));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0xff);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0x25a055){const _0x3b8444=a30_0x11f642,{options:_0x927ef5,args:_0x2152dd,tdx:_0x4d1c3a}=_0x25a055,_0x29a729=_0x927ef5,_0x480556=_0x2152dd[0x0]||_0x927ef5[_0x3b8444(0x1a0)];if(!_0x480556)return showParentSegmentNotSetError(_0x3b8444(0x102)+_0x3b8444(0xd1)),0x1;const _0x42c5ab=resolveYamlFile(_0x480556);if(existsSync(_0x42c5ab)){_0x29a729[_0x3b8444(0xd2)]&&console[_0x3b8444(0x166)]('Found\x20YAML\x20file:\x20'+_0x42c5ab);let _0x3051f6;try{_0x3051f6=readFileSync(_0x42c5ab,'utf-8');}catch(_0x303b6d){const _0x163b3e=_0x303b6d instanceof Error?_0x303b6d['message']:String(_0x303b6d);return console['error'](_0x3b8444(0x211)+_0x163b3e),0x1;}const _0x2bd42a=await withSpinner(_0x3b8444(0x176),()=>_0x4d1c3a['segment'][_0x3b8444(0x10c)](_0x3051f6),{'verbose':_0x29a729[_0x3b8444(0xd2)]}),_0x1d89f3=_0x2bd42a[_0x3b8444(0x1ec)],{isNew:_0x13f95a,name:_0xf02234,hasChanges:_0x1d4c3f,diffFormatted:_0x483166}=_0x1d89f3;if(_0x1d4c3f){_0x13f95a?console[_0x3b8444(0x166)](_0x3b8444(0x9f)+_0xf02234+'\x27:'):console['error'](_0x3b8444(0x17b)+_0xf02234+'\x27:');console[_0x3b8444(0x166)]('─'[_0x3b8444(0x183)](0x3c)),console[_0x3b8444(0x166)](_0x483166),console[_0x3b8444(0x166)]('─'['repeat'](0x3c));const _0x5dbdc5=_0x13f95a?_0x3b8444(0xba)+_0xf02234+_0x3b8444(0xc9):_0x3b8444(0xfe)+_0xf02234+'\x27\x20and\x20run\x20workflow?';if(!_0x29a729['yes']){if(!isInteractive())return console[_0x3b8444(0x166)](a30_0x2ba769[_0x3b8444(0x1c2)]('\x0aError:'),_0x3b8444(0x165)),console[_0x3b8444(0x166)](a30_0x2ba769['dim'](_0x3b8444(0x14e))),0x1;const _0x38c6f7=await confirmKey(_0x5dbdc5);if(!_0x38c6f7)return console[_0x3b8444(0x166)](a30_0x2ba769['yellow']('Aborted.')),0x1;}const _0x549af9=_0x13f95a?_0x3b8444(0x197):'Updating';await withSpinner(_0x549af9+'\x20parent\x20segment\x20\x27'+_0xf02234+_0x3b8444(0x1d9),()=>_0x1d89f3['apply'](),{'verbose':_0x29a729[_0x3b8444(0xd2)]});const _0x37dc65=_0x13f95a?'Created':_0x3b8444(0x167);console[_0x3b8444(0x166)]('✔\x20'+_0x37dc65+'\x20parent\x20segment\x20\x27'+_0xf02234+'\x27');}else console['error'](_0x3b8444(0x1cd)+_0xf02234+'\x27\x20is\x20up\x20to\x20date');}const _0x3b7c16=await withSpinner(_0x3b8444(0x12f)+_0x480556+_0x3b8444(0x1d9),()=>_0x4d1c3a[_0x3b8444(0x118)][_0x3b8444(0x144)](_0x480556),{'verbose':_0x29a729[_0x3b8444(0xd2)]}),_0x5dcf37=_0x3b7c16[_0x3b8444(0x1ec)],_0x3cd0b0=getConsoleUrl(_0x29a729[_0x3b8444(0x1c0)],_0x3b8444(0x18a)+_0x5dcf37['workflowId']+_0x3b8444(0x1f2)+_0x5dcf37['workflowSessionId']+_0x3b8444(0xc7)+_0x5dcf37[_0x3b8444(0x124)]);return console[_0x3b8444(0x166)](_0x3b8444(0x1ae)),console[_0x3b8444(0x166)]('\x20\x20'+a30_0x2ba769[_0x3b8444(0x151)](_0x3b8444(0x1d4))+'\x20'+_0x5dcf37['audienceId']),console['error']('\x20\x20'+a30_0x2ba769[_0x3b8444(0x151)](_0x3b8444(0x199))+'\x20'+_0x5dcf37[_0x3b8444(0xca)]),console[_0x3b8444(0x166)]('\x20\x20'+a30_0x2ba769['dim'](_0x3b8444(0xf9))+'\x20'+_0x5dcf37[_0x3b8444(0x11d)]),console[_0x3b8444(0x166)]('\x20\x20'+a30_0x2ba769['dim'](_0x3b8444(0xef))+'\x20'+_0x5dcf37['workflowAttemptId']),console[_0x3b8444(0x166)]('\x20\x20'+_0x3cd0b0),console['error']('\x0a'+a30_0x2ba769['dim'](_0x3b8444(0x19c))+_0x3b8444(0x1f3)+_0x5dcf37['workflowAttemptId']+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x11f642(0xcd)]='segment:parent:fields';['description']=a30_0x11f642(0xde);async['execute'](_0x5cccd7){const _0x5469=a30_0x11f642,{options:_0xf26e14,args:_0x571d36,tdx:_0x256ef9}=_0x5cccd7,_0x4e7236=_0x571d36[0x0]||_0xf26e14['parentSegment'];if(!_0x4e7236)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x5469(0x1e6)),0x1;_0xf26e14[_0x5469(0xd2)]&&(console[_0x5469(0x166)]('Site:\x20'+_0xf26e14[_0x5469(0x1c0)]),console[_0x5469(0x166)](_0x5469(0x152)+_0x4e7236));const _0x678bf1=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x4e7236+_0x5469(0x1d9),()=>_0x256ef9[_0x5469(0x118)]['listFields'](_0x4e7236),{'verbose':_0xf26e14['verbose']}),_0x2597b1=_0x678bf1[_0x5469(0x1ec)];console[_0x5469(0x166)]('✔\x20Found\x20'+_0x2597b1[_0x5469(0x9c)]+_0x5469(0x1b1)+(_0x2597b1[_0x5469(0x9c)]!==0x1?'s':''));if(_0xf26e14['json']||_0xf26e14[_0x5469(0x1bb)])return await handleSDKOutput(_0x2597b1,_0xf26e14),0x0;return displayFieldsHumanReadable(_0x2597b1,_0x4e7236),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x15c);[a30_0x11f642(0x10e)]=a30_0x11f642(0xfa);async['execute'](_0x4aec9c){const _0x1be39f=a30_0x11f642,{options:_0x5566aa,args:_0x32a199,tdx:_0x37c857}=_0x4aec9c,_0x5a3c5f=_0x5566aa,_0x1c9308=_0x32a199[0x0]||_0x5566aa[_0x1be39f(0x1a0)];if(!_0x1c9308)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x1be39f(0x190)+_0x1be39f(0x156)+_0x1be39f(0x1cc)),0x1;_0x5566aa['verbose']&&(console['error'](_0x1be39f(0x113)+_0x5566aa[_0x1be39f(0x1c0)]),console[_0x1be39f(0x166)](_0x1be39f(0x152)+_0x1c9308));const _0x2acc77=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x1c9308+_0x1be39f(0x1d9),()=>_0x37c857[_0x1be39f(0x118)][_0x1be39f(0x159)](_0x1c9308),{'verbose':_0x5566aa[_0x1be39f(0xd2)]}),_0x48d0fa=_0x2acc77[_0x1be39f(0x1ec)];if(_0x5a3c5f[_0x1be39f(0x13c)]){const _0x46bb6f=getConsoleNextUrl(_0x5a3c5f[_0x1be39f(0x1c0)],'/app/dw/parentSegments/'+_0x48d0fa['id']);return console['error'](a30_0x2ba769[_0x1be39f(0x13b)]('✔')+_0x1be39f(0x15a)+a30_0x2ba769['cyan'](_0x46bb6f)),openBrowser(_0x46bb6f),0x0;}return await handleSingleObjectOutput(_0x48d0fa,_0x5566aa),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0xbe);[a30_0x11f642(0x10e)]=a30_0x11f642(0x100);async['execute'](_0x47f7bf){const _0x38a81f=a30_0x11f642,{options:_0x2edaf1,args:_0x5d13be,tdx:_0x537334}=_0x47f7bf,_0x5d1367=_0x2edaf1,_0x8b0243=_0x5d13be[0x0]||_0x2edaf1[_0x38a81f(0x1a0)];if(!_0x8b0243)return showParentSegmentNotSetError(_0x38a81f(0xf2)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+_0x38a81f(0x156)+_0x38a81f(0x14a)),0x1;_0x2edaf1[_0x38a81f(0xd2)]&&(console[_0x38a81f(0x166)](_0x38a81f(0x113)+_0x2edaf1[_0x38a81f(0x1c0)]),console[_0x38a81f(0x166)]('Parent\x20segment:\x20'+_0x8b0243));const _0x630391=await withSpinner(_0x38a81f(0x1ea)+_0x8b0243+_0x38a81f(0x1d9),()=>_0x537334[_0x38a81f(0x118)][_0x38a81f(0x1c3)](_0x8b0243),{'verbose':_0x2edaf1['verbose']}),_0x57d37d=_0x630391['data'],_0x222904=_0x537334[_0x38a81f(0x118)][_0x38a81f(0x1de)](_0x57d37d);if(_0x5d1367[_0x38a81f(0x1d5)]){const _0x3bdefc=await this['collectSchema'](_0x47f7bf,_0x8b0243,_0x57d37d,_0x222904),_0x516f5c=this[_0x38a81f(0xf4)](_0x3bdefc);writeFileSync(_0x5d1367[_0x38a81f(0x1d5)],_0x516f5c);const _0x3b7e11=_0x3bdefc[_0x38a81f(0x99)][_0x38a81f(0x16d)][_0x38a81f(0x9c)]+_0x3bdefc[_0x38a81f(0x96)][_0x38a81f(0x119)]((_0x1fca9d,_0x191873)=>_0x1fca9d+_0x191873[_0x38a81f(0x16d)]['length'],0x0),_0x10e8b6=_0x3bdefc[_0x38a81f(0x96)][_0x38a81f(0x19d)](_0x45a76c=>_0x45a76c[_0x38a81f(0x16d)][_0x38a81f(0x9c)]===0x0)[_0x38a81f(0x9c)];return console[_0x38a81f(0x1e1)](_0x38a81f(0x1ab)+_0x5d1367[_0x38a81f(0x1d5)]),console[_0x38a81f(0x1e1)](_0x38a81f(0x12a)+_0x222904),console[_0x38a81f(0x1e1)](_0x38a81f(0x1e0)+_0x3bdefc[_0x38a81f(0x96)][_0x38a81f(0x9c)]+'\x20behaviors'),console[_0x38a81f(0x1e1)]('\x20\x20Columns:\x20'+_0x3b7e11+'\x20total'),_0x10e8b6>0x0&&console[_0x38a81f(0x1e1)](_0x38a81f(0x1bc)+_0x10e8b6+_0x38a81f(0x1ee)),0x0;}console[_0x38a81f(0x166)]('\x0a'+a30_0x2ba769[_0x38a81f(0x1f0)](_0x38a81f(0xf5))+'\x20'+a30_0x2ba769[_0x38a81f(0x149)](_0x222904));const _0x4fe848=await withSpinner(_0x38a81f(0x12e),()=>_0x537334[_0x38a81f(0x118)]['getParentSQL'](_0x57d37d),{'verbose':_0x2edaf1[_0x38a81f(0xd2)]});console['error']('\x0a'+a30_0x2ba769[_0x38a81f(0x1f0)](_0x38a81f(0x99))+'\x20'+a30_0x2ba769['dim']('('+_0x222904+'.customers)'));const _0x58cc5c=await executeSchemaQuery(_0x4fe848[_0x38a81f(0x1ec)],_0x537334,_0x2edaf1);await handleQueryOutput(_0x58cc5c,_0x2edaf1);const _0x182620=await withSpinner(_0x38a81f(0x179),()=>_0x537334[_0x38a81f(0x118)]['getBehaviorNames'](_0x57d37d),{'verbose':_0x2edaf1[_0x38a81f(0xd2)]});for(const _0x2a898f of _0x182620['data']){const _0x34a0e5=_0x38a81f(0x20a)+_0x2a898f[_0x38a81f(0x177)]()[_0x38a81f(0xea)](/\s+/g,'_'),_0x23cb27=_0x38a81f(0x155)+_0x222904+'.'+_0x34a0e5;console[_0x38a81f(0x166)]('\x0a'+a30_0x2ba769[_0x38a81f(0x1f0)](_0x2a898f)+'\x20'+a30_0x2ba769[_0x38a81f(0x151)]('('+_0x222904+'.'+_0x34a0e5+')'));try{const _0x27ac64=await executeSchemaQuery(_0x23cb27,_0x537334,_0x2edaf1);await handleQueryOutput(_0x27ac64,_0x2edaf1);}catch{console[_0x38a81f(0x166)](a30_0x2ba769['yellow'](_0x38a81f(0x206)));}}return 0x0;}async['collectSchema'](_0x2ff120,_0x2aa262,_0x3f2e10,_0x1b258a){const _0x5de248=a30_0x11f642,{options:_0x5c4d8c,tdx:_0x599d94}=_0x2ff120,_0x477c33=await withSpinner(_0x5de248(0x12e),()=>_0x599d94[_0x5de248(0x118)]['getParentSQL'](_0x3f2e10),{'verbose':_0x5c4d8c[_0x5de248(0xd2)]}),_0x465303=await executeSchemaQuery(_0x477c33[_0x5de248(0x1ec)],_0x599d94,_0x5c4d8c),_0x12280a=_0x465303[_0x5de248(0x1ec)]['map'](_0x3aa855=>({'name':_0x3aa855[_0x5de248(0x143)],'type':_0x3aa855[_0x5de248(0x1ca)]})),_0x5b5d42=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x599d94[_0x5de248(0x118)][_0x5de248(0xdc)](_0x3f2e10),{'verbose':_0x5c4d8c[_0x5de248(0xd2)]}),_0x52825f=[];for(const _0x41ad92 of _0x5b5d42[_0x5de248(0x1ec)]){const _0x566f4e=_0x5de248(0x20a)+_0x41ad92[_0x5de248(0x177)]()[_0x5de248(0xea)](/\s+/g,'_'),_0x33424d='SELECT\x20*\x20FROM\x20'+_0x1b258a+'.'+_0x566f4e;let _0x5b6d7a=[];try{const _0x5594ee=await executeSchemaQuery(_0x33424d,_0x599d94,_0x5c4d8c);_0x5b6d7a=_0x5594ee[_0x5de248(0x1ec)]['map'](_0xe8856a=>({'name':_0xe8856a[_0x5de248(0x143)],'type':_0xe8856a['column_type']}));}catch{}_0x52825f[_0x5de248(0xb8)]({'table':_0x566f4e,'columns':_0x5b6d7a});}return{'database':_0x1b258a,'parent_segment':_0x2aa262,'parent_id':_0x3f2e10,'customers':{'table':_0x5de248(0x99),'columns':_0x12280a},'behaviors':_0x52825f};}[a30_0x11f642(0xf4)](_0x3b2bdf){const _0x7ead30=a30_0x11f642,_0x3775f7=_0x359027=>{const _0x541bde=a30_0x9f58;if(_0x359027['length']===0x0)return'[]';const _0x3f3e13=_0x359027[_0x541bde(0x1b3)](_0x3fd1e0=>_0x541bde(0x14f)+_0x3fd1e0[_0x541bde(0xcd)]+_0x541bde(0xe0)+_0x3fd1e0['type']+_0x541bde(0x1da));return'[\x0a'+_0x3f3e13[_0x541bde(0x1d1)](',\x0a')+_0x541bde(0x1b7);},_0x3df800=_0x3b2bdf[_0x7ead30(0x96)][_0x7ead30(0x1b3)](_0x34c064=>{const _0x43e76c=_0x7ead30;return _0x43e76c(0x192)+_0x34c064['table']+_0x43e76c(0x186)+_0x3775f7(_0x34c064[_0x43e76c(0x16d)])[_0x43e76c(0xea)](/^/gm,'\x20\x20')['trim']()+_0x43e76c(0x127);})[_0x7ead30(0x1d1)](',\x0a');return _0x7ead30(0xf8)+_0x3b2bdf[_0x7ead30(0xe9)]+_0x7ead30(0x208)+_0x3b2bdf[_0x7ead30(0x1e9)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x3b2bdf[_0x7ead30(0x210)]+_0x7ead30(0xe8)+_0x3b2bdf[_0x7ead30(0x99)][_0x7ead30(0x13a)]+_0x7ead30(0x157)+_0x3775f7(_0x3b2bdf['customers']['columns'])['replace'](/^/gm,'\x20\x20')[_0x7ead30(0x17a)]()+_0x7ead30(0xd0)+_0x3df800+_0x7ead30(0x1e5);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a30_0x11f642(0x132);[a30_0x11f642(0x10e)]=a30_0x11f642(0x205);async['execute'](_0x5b011e){const _0x45e855=a30_0x11f642,{options:_0x1ec911,args:_0x16e1d6,tdx:_0x44fd43}=_0x5b011e,_0x42b006=_0x16e1d6[0x0]||_0x1ec911[_0x45e855(0x1a0)];if(!_0x42b006)return showParentSegmentNotSetError(_0x45e855(0x194)+_0x45e855(0x1a6)),0x1;_0x1ec911['verbose']&&(console[_0x45e855(0x166)](_0x45e855(0x113)+_0x1ec911[_0x45e855(0x1c0)]),console[_0x45e855(0x166)](_0x45e855(0x152)+_0x42b006));const _0x1c63e6=await withSpinner(_0x45e855(0x1ea)+_0x42b006+_0x45e855(0x1d9),()=>_0x44fd43['segment'][_0x45e855(0x1c3)](_0x42b006),{'verbose':_0x1ec911[_0x45e855(0xd2)]}),_0x4178e0=_0x1c63e6['data'],_0x547c2c=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x42b006+_0x45e855(0x1d9),()=>_0x44fd43[_0x45e855(0x118)][_0x45e855(0x1fe)](_0x4178e0),{'verbose':_0x1ec911['verbose']}),_0x2a5639=_0x547c2c[_0x45e855(0x1ec)];return _0x1ec911[_0x45e855(0x142)]===_0x45e855(0x1fa)||_0x1ec911['format']===_0x45e855(0x1bb)?await handleSDKOutput([{'sql':_0x2a5639}],_0x1ec911):console[_0x45e855(0x1e1)](_0x2a5639),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x128);['description']=a30_0x11f642(0x98);async[a30_0x11f642(0x12d)](_0x5a8d59){const _0x28b5a2=a30_0x11f642,{options:_0x3b89eb,args:_0x129beb,tdx:_0x2d0aff}=_0x5a8d59,_0x4a18ed=_0x129beb[0x0]||_0x3b89eb['parentSegment'];if(!_0x4a18ed)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x28b5a2(0x14b)),0x1;_0x3b89eb[_0x28b5a2(0xd2)]&&(console[_0x28b5a2(0x166)](_0x28b5a2(0x113)+_0x3b89eb[_0x28b5a2(0x1c0)]),console['error'](_0x28b5a2(0x152)+_0x4a18ed));const _0x3b052d=await withSpinner(_0x28b5a2(0x1ea)+_0x4a18ed+_0x28b5a2(0x1d9),()=>_0x2d0aff[_0x28b5a2(0x118)][_0x28b5a2(0x1c3)](_0x4a18ed),{'verbose':_0x3b89eb[_0x28b5a2(0xd2)]}),_0x50eb5c=_0x3b052d[_0x28b5a2(0x1ec)],_0x3680be=await withSpinner(_0x28b5a2(0xb2)+_0x4a18ed+'\x27...',()=>_0x2d0aff[_0x28b5a2(0x118)]['getParentSQL'](_0x50eb5c),{'verbose':_0x3b89eb[_0x28b5a2(0xd2)]});let _0x2eb24b=_0x3680be[_0x28b5a2(0x1ec)];const _0x14a163=resolveLimit(_0x3b89eb['limit'],DEFAULT_DISPLAY_LIMIT),_0x27670f=/\bLIMIT\s+\d+/i[_0x28b5a2(0x221)](_0x2eb24b);!_0x27670f&&(_0x2eb24b=_0x2eb24b[_0x28b5a2(0x17a)]()[_0x28b5a2(0xea)](/;+$/,''),_0x2eb24b=_0x28b5a2(0x150)+_0x2eb24b+_0x28b5a2(0x1ac)+_0x14a163);_0x3b89eb['verbose']&&console['error'](_0x28b5a2(0x1b2)+_0x2eb24b);const _0x1fe5e2=await withProgressSpinner(_0x28b5a2(0x1ef),async _0x2efaaa=>{const _0x5d9d23=_0x28b5a2,_0x35b0dd=await _0x2d0aff[_0x5d9d23(0x1e2)][_0x5d9d23(0x12d)](_0x2eb24b,{'catalog':'td','schema':'information_schema','onJobId':_0x5372fc=>{const _0x39a680=_0x5d9d23;_0x2efaaa[_0x39a680(0xab)](_0x5372fc);}});return _0x35b0dd;},{'verbose':_0x3b89eb[_0x28b5a2(0xd2)]}),_0x1602ec=_0x1fe5e2[_0x28b5a2(0x1ec)],_0x441c86=_0x1602ec[_0x28b5a2(0x215)]?_0x28b5a2(0x1aa)+_0x1602ec[_0x28b5a2(0x215)]+']':'';return console[_0x28b5a2(0x166)](_0x28b5a2(0x1f4)+_0x1602ec['stats']['processedRows']['toLocaleString']()+_0x28b5a2(0x95)+('in\x20'+formatElapsed(_0x1602ec[_0x28b5a2(0xce)][_0x28b5a2(0x1a9)])+_0x441c86)),await handleQueryOutput(_0x1602ec,_0x3b89eb),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0xb1);[a30_0x11f642(0x10e)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a30_0x11f642(0x12d)](_0x356176){const _0x17272b=a30_0x11f642,{options:_0x24de81,args:_0x5f30e5,tdx:_0x87c84d}=_0x356176,_0x22ad7e=_0x5f30e5[0x0],_0x10f4ee=await withSpinner(_0x22ad7e?_0x17272b(0xa2)+_0x22ad7e+'\x27...':_0x17272b(0xad),()=>_0x87c84d[_0x17272b(0x1ad)]['list'](),{'verbose':_0x24de81[_0x17272b(0xd2)]});let _0x17ea3d=_0x10f4ee['data'][_0x17272b(0x19d)](_0x31ec80=>_0x31ec80[_0x17272b(0x203)]);if(_0x22ad7e){const _0x3ed294=_0x22ad7e[_0x17272b(0xea)](/[.+^${}()|[\]\\]/g,_0x17272b(0x11b))[_0x17272b(0xea)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x30cdcd=new RegExp('^'+_0x3ed294+'$','i');_0x17ea3d=_0x17ea3d[_0x17272b(0x19d)](_0x16e08f=>_0x30cdcd['test'](_0x16e08f['name']));}_0x17ea3d[_0x17272b(0xcf)]((_0x21a06e,_0x3f3349)=>_0x21a06e[_0x17272b(0xcd)][_0x17272b(0x130)](_0x3f3349['name'])),console['error'](_0x17272b(0x111)+_0x17ea3d[_0x17272b(0x9c)]+_0x17272b(0x1ba)+(_0x17ea3d[_0x17272b(0x9c)]!==0x1?'s':''));const _0x114bad=_0x1286c0=>{const _0x1e6bff=_0x17272b;return getConsoleNextUrl(_0x24de81[_0x1e6bff(0x1c0)],_0x1e6bff(0x129)+_0x1286c0);};if(_0x24de81[_0x17272b(0x142)]===_0x17272b(0x1fa)||_0x24de81[_0x17272b(0x142)]===_0x17272b(0x1bb)){const _0x1ce4a3=_0x17ea3d[_0x17272b(0x1b3)](_0x56f5b8=>({..._0x56f5b8,'url':_0x114bad(_0x56f5b8['id'])}));await handleSDKOutput(_0x1ce4a3,_0x24de81);}else{if(_0x17ea3d[_0x17272b(0x9c)]===0x0)console[_0x17272b(0x1e1)](_0x17272b(0xec));else for(const _0x32019d of _0x17ea3d){const _0x557bb8=_0x32019d['population']?a30_0x2ba769[_0x17272b(0x151)]('\x20('+formatRows(_0x32019d[_0x17272b(0xe4)])+')'):'',_0x524a53=hyperlink(_0x32019d[_0x17272b(0xcd)],_0x114bad(_0x32019d['id']));console[_0x17272b(0x1e1)]('⚡\x20'+_0x524a53+_0x557bb8);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x158);[a30_0x11f642(0x10e)]=a30_0x11f642(0xe6);async[a30_0x11f642(0x12d)](_0x24626a){const _0x3d2812=a30_0x11f642,{options:_0x2fdf3c,args:_0x20f6c0,tdx:_0x51e17a}=_0x24626a,_0x1bc03c=_0x20f6c0[0x0]||_0x2fdf3c[_0x3d2812(0x1a0)];if(!_0x1bc03c)return showParentSegmentNotSetError(_0x3d2812(0x1d2)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x47d4f7=resolveYamlFile(_0x1bc03c);if(!existsSync(_0x47d4f7))return showFileNotFoundError(_0x47d4f7,_0x1bc03c),0x1;let _0x4cf026;try{_0x4cf026=readFileSync(_0x47d4f7,_0x3d2812(0x195));}catch(_0x40b8b6){const _0x559a5e=_0x40b8b6 instanceof Error?_0x40b8b6['message']:String(_0x40b8b6);return console[_0x3d2812(0x166)]('Error\x20reading\x20file:\x20'+_0x559a5e),0x1;}const _0x43eb08=createCommandSpinner(a30_0x2ba769[_0x3d2812(0x151)](_0x3d2812(0x1f7)),{'verbose':_0x2fdf3c['verbose']});_0x43eb08[_0x3d2812(0xaf)]();const _0x19a519={'realtime':!![],'onProgress':_0x148e2d=>{const _0x3ef192=_0x3d2812;_0x43eb08[_0x3ef192(0xfb)]=formatProgressMessage(_0x148e2d);}};let _0x1af152;try{_0x1af152=await _0x51e17a[_0x3d2812(0x118)][_0x3d2812(0x1d3)](_0x4cf026,_0x19a519),_0x43eb08[_0x3d2812(0xa7)]();}catch(_0x86f174){_0x43eb08['stop']();throw _0x86f174;}console[_0x3d2812(0x166)]('\x0a'+a30_0x2ba769[_0x3d2812(0x1f0)](_0x3d2812(0x133))+'\x20'+_0x1af152[_0x3d2812(0xcd)]),console['error']('═'['repeat'](0x3c)),displayRealtimeValidation(_0x1af152),console[_0x3d2812(0x166)]('─'[_0x3d2812(0x183)](0x3c));if(_0x1af152['errors']['length']>0x0){console[_0x3d2812(0x166)]('\x0a'+a30_0x2ba769[_0x3d2812(0x1c2)]('Errors:'));for(const _0x590872 of _0x1af152[_0x3d2812(0xb9)]){console[_0x3d2812(0x166)]('\x20\x20'+a30_0x2ba769['red']('•')+'\x20'+_0x590872);}}return _0x1af152['allValid']&&console[_0x3d2812(0x166)]('\x0a'+a30_0x2ba769['green']('✔')+_0x3d2812(0x137)),_0x1af152[_0x3d2812(0x1c1)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x11f642(0xcd)]=a30_0x11f642(0x1e4);['description']='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async['execute'](_0x130791){const _0x3f9aa0=a30_0x11f642,{options:_0x24a470,args:_0xcb5bc0,tdx:_0x444d3a}=_0x130791,_0x163141=_0xcb5bc0[0x0]||_0x24a470[_0x3f9aa0(0x1a0)];if(!_0x163141)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+_0x3f9aa0(0x1eb)),0x1;const _0x284216=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x163141+_0x3f9aa0(0x1d9),()=>_0x444d3a['segment'][_0x3f9aa0(0x1c3)](_0x163141),{'verbose':_0x24a470['verbose']}),_0x20873f=_0x284216[_0x3f9aa0(0x1ec)],_0x285ffc=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x163141+'\x27...',()=>_0x444d3a['personalization']['list'](_0x20873f),{'verbose':_0x24a470['verbose']}),_0x3a80a3=_0x285ffc[_0x3f9aa0(0x1ec)];console[_0x3f9aa0(0x166)](_0x3f9aa0(0x111)+_0x3a80a3[_0x3f9aa0(0x9c)]+'\x20personalization\x20service'+(_0x3a80a3[_0x3f9aa0(0x9c)]!==0x1?'s':''));if(_0x24a470[_0x3f9aa0(0x142)]===_0x3f9aa0(0x1fa)||_0x24a470['format']===_0x3f9aa0(0x1bb))await handleSDKOutput(_0x3a80a3,_0x24a470);else{if(_0x3a80a3['length']===0x0)console[_0x3f9aa0(0x1e1)](_0x3f9aa0(0x153)),console[_0x3f9aa0(0x166)](a30_0x2ba769[_0x3f9aa0(0x149)](_0x3f9aa0(0x20f)));else for(const _0x1db032 of _0x3a80a3){const _0x5caf8e=_0x1db032[_0x3f9aa0(0x107)]?.['length']||0x0,_0x3dfae4=_0x1db032[_0x3f9aa0(0x93)]?a30_0x2ba769[_0x3f9aa0(0x151)](_0x3f9aa0(0x1d8)+_0x1db032['trigger_event']):'',_0x37c041=a30_0x2ba769[_0x3f9aa0(0x151)]('\x20('+_0x5caf8e+_0x3f9aa0(0x9d)+(_0x5caf8e!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x1db032[_0x3f9aa0(0xcd)]+_0x3dfae4+_0x37c041),_0x1db032['description']&&console[_0x3f9aa0(0x1e1)](_0x3f9aa0(0x216)+a30_0x2ba769[_0x3f9aa0(0x151)](_0x1db032[_0x3f9aa0(0x10e)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x11f642(0x16a);[a30_0x11f642(0x10e)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async[a30_0x11f642(0x12d)](_0x1bcf45){const _0x11366c=a30_0x11f642,{options:_0x375706,args:_0x42cbb7}=_0x1bcf45,_0x2782c8=_0x42cbb7[0x0]||_0x375706[_0x11366c(0x1a0)];if(!_0x2782c8)return showParentSegmentNotSetError(_0x11366c(0x193)+_0x11366c(0x172)),0x1;const _0x43b98b=resolveYamlFile(_0x2782c8);if(!existsSync(_0x43b98b))return showFileNotFoundError(_0x43b98b,_0x2782c8),0x1;let _0x2f98ca;try{_0x2f98ca=readFileSync(_0x43b98b,_0x11366c(0x195));}catch(_0x44cd73){const _0x518257=_0x44cd73 instanceof Error?_0x44cd73[_0x11366c(0x20d)]:String(_0x44cd73);return console['error'](_0x11366c(0x211)+_0x518257),0x1;}let _0x27a4cd;try{_0x27a4cd=parseDef(_0x2f98ca);}catch(_0x103356){const _0x343b5c=_0x103356 instanceof Error?_0x103356[_0x11366c(0x20d)]:String(_0x103356);return console[_0x11366c(0x166)](a30_0x2ba769[_0x11366c(0x1c2)](_0x11366c(0x200)+_0x343b5c)),0x1;}if(_0x27a4cd[_0x11366c(0xbc)]&&_0x27a4cd[_0x11366c(0xbc)][_0x11366c(0x9c)]>0x0)return console[_0x11366c(0x166)](a30_0x2ba769[_0x11366c(0x178)](_0x11366c(0x9e)+_0x43b98b)),console[_0x11366c(0x166)](a30_0x2ba769['dim'](_0x11366c(0x16b)+_0x27a4cd['personalization_services'][_0x11366c(0x9c)]+_0x11366c(0x198))),0x1;!_0x27a4cd['realtime']&&(_0x27a4cd[_0x11366c(0x1ad)]={'events':[{'name':_0x11366c(0x16e),'source_table':_0x11366c(0x13e)}],'attributes':[{'name':_0x11366c(0x188),'type':_0x11366c(0x19e)}],'id_stitching':{'primary_key':_0x27a4cd['master']['table']===_0x11366c(0x99)?_0x11366c(0x108):'user_id'}});_0x27a4cd[_0x11366c(0xbc)]=[{'name':_0x11366c(0x110),'description':_0x11366c(0xaa),'trigger_event':_0x11366c(0x16e),'sections':[{'name':_0x11366c(0x1a8),'criteria':_0x11366c(0x125),'attributes':[_0x11366c(0x188)]}]}];const _0x28412a=serializeDef(_0x27a4cd);return writeFileSync(_0x43b98b,_0x28412a,_0x11366c(0x195)),console[_0x11366c(0x166)](a30_0x2ba769['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a30_0x2ba769[_0x11366c(0x149)](_0x43b98b)),(!_0x27a4cd[_0x11366c(0x1ad)]||_0x2f98ca[_0x11366c(0xa4)](_0x11366c(0xa9))===-0x1)&&console[_0x11366c(0x166)](a30_0x2ba769[_0x11366c(0x13b)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console[_0x11366c(0x166)]('\x0a'+a30_0x2ba769[_0x11366c(0x151)](_0x11366c(0x1c9))),console[_0x11366c(0x166)](_0x11366c(0x11e)+_0x43b98b+_0x11366c(0x148)),console[_0x11366c(0x166)]('\x20\x202.\x20Run\x20'+a30_0x2ba769['dim'](_0x11366c(0x1c7)+_0x2782c8)+_0x11366c(0x10d)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0xa9c454=a31_0x165f;(function(_0x3a9666,_0x21c1d5){const _0x2bf2ec=a31_0x165f,_0x11f95a=_0x3a9666();while(!![]){try{const _0x218fdf=-parseInt(_0x2bf2ec(0xd8))/0x1+parseInt(_0x2bf2ec(0xbe))/0x2+-parseInt(_0x2bf2ec(0xdb))/0x3+-parseInt(_0x2bf2ec(0xaf))/0x4+parseInt(_0x2bf2ec(0xdd))/0x5+parseInt(_0x2bf2ec(0xa7))/0x6*(parseInt(_0x2bf2ec(0xd1))/0x7)+parseInt(_0x2bf2ec(0xb5))/0x8*(parseInt(_0x2bf2ec(0xa2))/0x9);if(_0x218fdf===_0x21c1d5)break;else _0x11f95a['push'](_0x11f95a['shift']());}catch(_0x56bfc4){_0x11f95a['push'](_0x11f95a['shift']());}}}(a31_0x4372,0x825eb));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a31_0x131927 from'chalk';export class PolicyCommand extends BaseCommand{[a31_0xa9c454(0xce)]=a31_0xa9c454(0xc7);['description']=a31_0xa9c454(0xc9);async[a31_0xa9c454(0xb2)](_0x36a59d){const _0x4f1bde=a31_0xa9c454,{options:_0x59e551,tdx:_0x4adec9}=_0x36a59d,_0x2b46e4=await withSpinner(_0x4f1bde(0xad),async()=>{const _0x38c163=_0x4f1bde,[_0xc4e413,_0x2c5d0f]=await Promise['all']([_0x4adec9[_0x38c163(0xa6)][_0x38c163(0xd5)](),_0x4adec9[_0x38c163(0xc7)][_0x38c163(0xbb)]()]);return{'userInfo':_0xc4e413,'permissions':_0x2c5d0f};},{'verbose':_0x59e551['verbose']}),{userInfo:_0x2969a5,permissions:_0xfc1450}=_0x2b46e4['data'];if(isStructuredFormat(_0x59e551))return await handleSingleObjectOutput(_0xfc1450,_0x59e551),0x0;const _0x10e6b4=_0x2969a5['account_owner']?'Account\x20Owner':_0x2969a5['administrator']?_0x4f1bde(0xd7):'Member';console[_0x4f1bde(0xb8)]('\x0a'+a31_0x131927['bold']('👤')+'\x20'+a31_0x131927['bold'](_0x2969a5[_0x4f1bde(0xce)])+'\x20'+a31_0x131927[_0x4f1bde(0xaa)]('('+_0x2969a5['email']+')')+'\x20—\x20'+_0x10e6b4),console[_0x4f1bde(0xb8)](a31_0x131927[_0x4f1bde(0xaa)](_0x4f1bde(0xcf)+_0x4adec9[_0x4f1bde(0xd2)]['site']+':'+_0x2969a5[_0x4f1bde(0xb0)]+_0x4f1bde(0xd9)+_0x2969a5['id']));const _0x2f23fc=_0xfc1450[_0x4f1bde(0xc0)];console[_0x4f1bde(0xb8)]('\x0a'+a31_0x131927[_0x4f1bde(0xa5)](_0x4f1bde(0xb7))+'\x20('+_0x2f23fc[_0x4f1bde(0xbf)]+'):');if(_0x2f23fc[_0x4f1bde(0xbf)]===0x0)console[_0x4f1bde(0xb8)](a31_0x131927[_0x4f1bde(0xaa)](_0x4f1bde(0xb4)));else for(const _0xf857bf of _0x2f23fc){console[_0x4f1bde(0xb8)]('\x20\x20•\x20'+_0xf857bf['name']);}return printPermissionsMap(_0xfc1450[_0x4f1bde(0xba)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a31_0xa9c454(0xce)]=a31_0xa9c454(0xd3);[a31_0xa9c454(0xd0)]=a31_0xa9c454(0xd6);async['execute'](_0x5316c9){const _0x443954=a31_0xa9c454,{options:_0x518039,tdx:_0x4f8674}=_0x5316c9,_0x4939df=await withSpinner(_0x443954(0xae),()=>_0x4f8674['policy']['listPolicies'](),{'verbose':_0x518039[_0x443954(0xa4)]}),_0x32acd1=_0x4939df[_0x443954(0xc3)];console[_0x443954(0xdc)](_0x443954(0xa1)+_0x32acd1[_0x443954(0xbf)]+_0x443954(0xb1)+(_0x32acd1[_0x443954(0xbf)]!==0x1?_0x443954(0xcb):'y'));if(isStructuredFormat(_0x518039))return await handleSDKOutput(_0x32acd1,_0x518039),0x0;if(_0x32acd1[_0x443954(0xbf)]===0x0)console[_0x443954(0xb8)](a31_0x131927[_0x443954(0xaa)](_0x443954(0xd4)));else for(const _0x26cd78 of _0x32acd1){const _0xcdbf50=_0x26cd78[_0x443954(0xd0)]?a31_0x131927[_0x443954(0xaa)](_0x443954(0xc6)+_0x26cd78[_0x443954(0xd0)]):'';console[_0x443954(0xb8)](_0x443954(0xc8)+_0x26cd78['name']+_0xcdbf50);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a31_0xa9c454(0xce)]=a31_0xa9c454(0xcc);[a31_0xa9c454(0xd0)]=a31_0xa9c454(0xda);['validate'](_0x75ec45){const _0x3b24e1=a31_0xa9c454;if(_0x75ec45['args'][_0x3b24e1(0xbf)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a31_0xa9c454(0xb2)](_0x1258a9){const _0x2032b9=a31_0xa9c454,{options:_0x32d3d4,tdx:_0x1a27b6}=_0x1258a9,_0x158f52=_0x1258a9[_0x2032b9(0xb3)][0x0],_0x57c15c=await withSpinner(_0x2032b9(0xca),async()=>{const _0x87dc3a=_0x2032b9,_0x503655=await _0x1a27b6[_0x87dc3a(0xc7)][_0x87dc3a(0xc4)](_0x158f52),[_0x4c81d3,_0x4dc77a]=await Promise[_0x87dc3a(0xcd)]([_0x1a27b6['policy'][_0x87dc3a(0xab)](_0x503655['id']),_0x1a27b6['policy'][_0x87dc3a(0xa8)](_0x503655['id'])]);return{'policy':_0x503655,'perms':_0x4c81d3,'users':_0x4dc77a};},{'verbose':_0x32d3d4[_0x2032b9(0xa4)]}),{policy:_0x465eb2,perms:_0x487498,users:_0x48b9f7}=_0x57c15c['data'];if(isStructuredFormat(_0x32d3d4))return await handleSingleObjectOutput({..._0x465eb2,'permissions':_0x487498[_0x2032b9(0xba)],'users':_0x48b9f7},_0x32d3d4),0x0;console[_0x2032b9(0xb8)]('\x0a'+a31_0x131927[_0x2032b9(0xa5)]('📋')+'\x20'+a31_0x131927['bold'](_0x465eb2[_0x2032b9(0xce)])+'\x20'+a31_0x131927[_0x2032b9(0xaa)](_0x2032b9(0xbd)+_0x465eb2['id']+')'));_0x465eb2[_0x2032b9(0xd0)]&&console['log']('\x20\x20\x20'+a31_0x131927['dim'](_0x465eb2[_0x2032b9(0xd0)]));console[_0x2032b9(0xb8)](_0x2032b9(0xcf)+_0x48b9f7[_0x2032b9(0xbf)]+_0x2032b9(0xc1)+(_0x48b9f7[_0x2032b9(0xbf)]!==0x1?'s':'')+_0x2032b9(0xbc)),printPermissionsMap(_0x487498['permissions']);if(_0x48b9f7[_0x2032b9(0xbf)]>0x0){console['log']('\x0a'+a31_0x131927[_0x2032b9(0xa5)](_0x2032b9(0xc2))+':');for(const _0x2df215 of _0x48b9f7){const _0x38602e=_0x2df215[_0x2032b9(0xa9)]&&_0x2df215[_0x2032b9(0xa9)]!==_0x2df215[_0x2032b9(0xce)]?a31_0x131927[_0x2032b9(0xaa)]('\x20<'+_0x2df215[_0x2032b9(0xa9)]+'>'):'';console[_0x2032b9(0xb8)](_0x2032b9(0xc8)+_0x2df215['name']+_0x38602e);}}return console[_0x2032b9(0xb8)](),0x0;}}function a31_0x165f(_0x2890e3,_0x3cc959){_0x2890e3=_0x2890e3-0xa1;const _0x43723b=a31_0x4372();let _0x165f30=_0x43723b[_0x2890e3];return _0x165f30;}function a31_0x4372(){const _0x3b319d=['description','2527mslbZl','context','policy\x20list','No\x20policies\x20found','getCurrent','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','Administrator','1018603AMksPP',',\x20user_id:','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','814884SWnyjO','error','402475TRAOCo','🔑\x20Effective\x20Permissions','padEnd','✔\x20Found\x20','18uYQCig','join','verbose','bold','user','10482KOPFHV','getPolicyUsers','email','dim','getPolicyPermissions','entries','Fetching\x20permissions...','Listing\x20policies...','107612MrtlTp','account_id','\x20polic','execute','args','\x20\x20No\x20policies\x20assigned','1330904QXtAIg','\x20\x20No\x20permissions','📋\x20Assigned\x20Policies','log','operation','permissions','getMyPermissions','\x20assigned','(ID:\x20','1614482IfjMuz','length','policies','\x20user','👥\x20Assigned\x20Users','data','getPolicy','map','\x20—\x20','policy','\x20\x20•\x20','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Fetching\x20policy...','ies','policy\x20show','all','name','\x20\x20\x20'];a31_0x4372=function(){return _0x3b319d;};return a31_0x4372();}function printPermissionsMap(_0x56438a){const _0x1ef398=a31_0xa9c454,_0xd1167a=Object[_0x1ef398(0xac)](_0x56438a);console[_0x1ef398(0xb8)]('\x0a'+a31_0x131927['bold'](_0x1ef398(0xde))+':');if(_0xd1167a[_0x1ef398(0xbf)]===0x0){console[_0x1ef398(0xb8)](a31_0x131927[_0x1ef398(0xaa)](_0x1ef398(0xb6)));return;}const _0x1c0eda=Math['max'](..._0xd1167a['map'](([_0x4990bb])=>_0x4990bb[_0x1ef398(0xbf)]));for(const [_0x727a6a,_0x3076b5]of _0xd1167a){const _0x599c8e=formatOperations(_0x3076b5);console[_0x1ef398(0xb8)]('\x20\x20'+_0x727a6a[_0x1ef398(0xdf)](_0x1c0eda+0x2)+_0x599c8e);}}function formatOperations(_0x29fade){const _0x262595=a31_0xa9c454,_0xa43cbe=[...new Set(_0x29fade[_0x262595(0xc5)](_0x38a32a=>_0x38a32a[_0x262595(0xb9)]))];return _0xa43cbe[_0x262595(0xa3)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x2eb69e=a32_0x54bf;(function(_0x3007f8,_0x188f72){const _0x59295b=a32_0x54bf,_0x45286f=_0x3007f8();while(!![]){try{const _0xf231d1=-parseInt(_0x59295b(0xac))/0x1+-parseInt(_0x59295b(0xc8))/0x2+-parseInt(_0x59295b(0xbd))/0x3*(-parseInt(_0x59295b(0x92))/0x4)+parseInt(_0x59295b(0xe2))/0x5*(parseInt(_0x59295b(0x8f))/0x6)+parseInt(_0x59295b(0x9f))/0x7*(parseInt(_0x59295b(0xe4))/0x8)+-parseInt(_0x59295b(0xb4))/0x9*(-parseInt(_0x59295b(0x9e))/0xa)+parseInt(_0x59295b(0x9a))/0xb*(-parseInt(_0x59295b(0xb8))/0xc);if(_0xf231d1===_0x188f72)break;else _0x45286f['push'](_0x45286f['shift']());}catch(_0x28796f){_0x45286f['push'](_0x45286f['shift']());}}}(a32_0x2740,0x4df61));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a32_0x2e2c98 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a32_0x2740(){const _0x4bbb28=['84021RPXqDU','confirm','warn','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','join','ERROR','tdx:\x20profile\x20remove','Profile\x20name\x20cannot\x20be\x20empty','3985263TovGYI','apiKey','\x20API\x20key\x20saved\x20to\x20system\x20keychain','method','12lnYaZf','bold','Changing\x20site\x20to\x20\x27','\x20\x20tdx\x20--profile\x20','red','54qmhJud','\x27\x20updated:\x20','session','email','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Session\x20profile\x20set\x20to:\x20','Setup\x20cancelled','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','dim','config','\x0aAvailable\x20profiles:','122128dZWdEH','/app/mp/ak','\x27.\x0a\x0aValid\x20keys:\x20','API\x20key\x20cannot\x20be\x20empty','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x27\x20requires\x20API\x20key\x20validation.','description','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','password','\x0aOperation\x20cancelled','error','\x0aSaved\x20to:\x20','✗\x20Validation\x20failed:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Failed\x20to\x20remove\x20profile:\x20','create','Site\x20was\x20not\x20changed.','\x27\x20created','tdx:\x20profile\x20set','text','message','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','split','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','3875wKePDU','Default\x20profile\x20set\x20to:\x20','118376GSqSCk','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','default','tdx:\x20profile\x20create','test','validate','getUserInfo','profile:set','name','\x27\x20does\x20not\x20exist.','trim','\x20--default\x27\x20to\x20save\x20permanently','\x0aSetup\x20cancelled','VALID_KEYS','log','Validating\x20API\x20key...','apikey','Remove\x20a\x20profile','Set\x20a\x20profile\x20configuration\x20value','Enter\x20your\x20TD\x20API\x20key:','green','\x20API\x20key\x20is\x20valid\x20(User:\x20','select','Operation\x20cancelled','profile','\x20Profile\x20\x27','Unknown\x20key\x20\x27','OAuth\x20(browser\x20login)','status','2952CvglnL','logLevel','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','44284deRnmI','Enter\x20profile\x20name:','execute','profile:create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20\x20(no\x20profiles\x20found)','includes','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','10380623XdCqkD','Profile\x20\x27','jobs','Set\x20session\x20profile','10HaUNzU','182QscYqA','length','site','oauth','profileName','tdx.json','\x20\x20-\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Choose\x20authentication\x20method:','\x27\x20removed\x20from\x20configuration','(cleared)','profile:remove','yellow'];a32_0x2740=function(){return _0x4bbb28;};return a32_0x2740();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';function a32_0x54bf(_0x59e032,_0x265758){_0x59e032=_0x59e032-0x75;const _0x274093=a32_0x2740();let _0x54bf65=_0x274093[_0x59e032];return _0x54bf65;}import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a32_0x4c5c7f from'prompts';import a32_0x10057f from'chalk';function validateProfileName(_0x85a606){const _0x941599=a32_0x54bf;if(!_0x85a606||!_0x85a606['trim']())return _0x941599(0xb3);const _0x214d2f=_0x85a606[_0x941599(0x7c)]();if(!/^[a-zA-Z0-9_-]+$/[_0x941599(0x76)](_0x214d2f))return _0x941599(0xa6);if(profileExists(_0x214d2f))return _0x941599(0x9b)+_0x214d2f+_0x941599(0xcd);return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x2eb69e(0x7a)]=a32_0x2eb69e(0x95);['description']='Create\x20a\x20new\x20profile';async['execute'](_0x5a769a){const _0x4b1cbf=a32_0x2eb69e,{options:_0x38f3d2,args:_0x2183fb}=_0x5a769a;console[_0x4b1cbf(0x80)](a32_0x10057f[_0x4b1cbf(0xb9)](_0x4b1cbf(0x75)));let _0x250f52;if(_0x2183fb[_0x4b1cbf(0xa0)]>0x0&&_0x2183fb[0x0]){const _0x5c896d=_0x2183fb[0x0][_0x4b1cbf(0x7c)](),_0x289824=validateProfileName(_0x5c896d);if(_0x289824!==!![])return console[_0x4b1cbf(0xd4)](a32_0x10057f['red'](_0x289824)),0x1;_0x250f52=_0x5c896d;}else{const _0x621c40=await a32_0x4c5c7f({'type':_0x4b1cbf(0xdd),'name':_0x4b1cbf(0xa3),'message':_0x4b1cbf(0x93),'validate':validateProfileName});if(!_0x621c40['profileName'])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x250f52=_0x621c40[_0x4b1cbf(0xa3)][_0x4b1cbf(0x7c)]();}const _0x1c29d3=await a32_0x4c5c7f({'type':_0x4b1cbf(0xdd),'name':_0x4b1cbf(0xcf),'message':'Enter\x20description\x20(optional):'}),_0x3615bb=_0x1c29d3[_0x4b1cbf(0xcf)]?.[_0x4b1cbf(0x7c)]()||undefined,_0x404fb0=_0x38f3d2[_0x4b1cbf(0xa1)]||'us01',_0x3a2cf9=await promptSiteSelection(_0x404fb0,_0x250f52,_0x4b1cbf(0xc3));if(!_0x3a2cf9)return 0x1;const _0x4495c2=resolveSite(_0x3a2cf9);if(isOAuthSupported(_0x4495c2)){const _0x2ebf72=await a32_0x4c5c7f({'type':_0x4b1cbf(0x88),'name':_0x4b1cbf(0xb7),'message':_0x4b1cbf(0xa7),'choices':[{'title':_0x4b1cbf(0x8d),'value':_0x4b1cbf(0xa2)},{'title':'API\x20Key','value':_0x4b1cbf(0x82)}]});if(!_0x2ebf72[_0x4b1cbf(0xb7)])return console['log'](_0x4b1cbf(0x7e)),0x1;if(_0x2ebf72[_0x4b1cbf(0xb7)]===_0x4b1cbf(0xa2)){if(_0x3615bb){const _0x5c7437={'site':_0x4495c2,'description':_0x3615bb};saveProfileToUserConfig(_0x250f52,_0x5c7437);}return await runOAuthLoginFlow(_0x4495c2,_0x250f52,_0x38f3d2[_0x4b1cbf(0x90)]??LogLevel[_0x4b1cbf(0xb1)]),0x0;}}console[_0x4b1cbf(0x80)](_0x4b1cbf(0xd1)+_0x4495c2),console[_0x4b1cbf(0x80)](_0x4b1cbf(0xd0)),console[_0x4b1cbf(0x80)]('\x20\x20'+getConsoleUrl(_0x4495c2,_0x4b1cbf(0xc9)));const _0x32db55=await a32_0x4c5c7f({'type':'password','name':_0x4b1cbf(0xb5),'message':_0x4b1cbf(0x85),'validate':_0x30f609=>{const _0x23120b=_0x4b1cbf;if(!_0x30f609||!_0x30f609[_0x23120b(0x7c)]())return _0x23120b(0xcb);return!![];}});if(!_0x32db55[_0x4b1cbf(0xb5)])return console['log'](_0x4b1cbf(0x7e)),0x1;const _0x2b6d45=_0x32db55[_0x4b1cbf(0xb5)];console[_0x4b1cbf(0x80)](_0x4b1cbf(0x81));try{const _0x4cdd96=TDX[_0x4b1cbf(0xd9)]({'site':_0x4495c2,'apiKey':_0x2b6d45['trim'](),'logLevel':_0x38f3d2[_0x4b1cbf(0x90)]??LogLevel[_0x4b1cbf(0xb1)]}),_0x444eb5=await _0x4cdd96[_0x4b1cbf(0x9c)][_0x4b1cbf(0x78)]();console['log'](a32_0x10057f[_0x4b1cbf(0x86)]('✓')+_0x4b1cbf(0x87)+_0x444eb5[_0x4b1cbf(0xc0)]+')');const _0x335faa=await isKeychainAvailable();_0x335faa?(await saveAPIKeyAsync(_0x2b6d45['trim'](),_0x4495c2,_0x250f52),console['log'](a32_0x10057f['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x250f52+')')):(console[_0x4b1cbf(0xae)](a32_0x10057f[_0x4b1cbf(0xab)](_0x4b1cbf(0x91))),console[_0x4b1cbf(0xae)](a32_0x10057f[_0x4b1cbf(0xab)](_0x4b1cbf(0xe1))));const _0x8a9d2e={'site':_0x4495c2,..._0x3615bb&&{'description':_0x3615bb}};return saveProfileToUserConfig(_0x250f52,_0x8a9d2e),console[_0x4b1cbf(0x80)](a32_0x10057f[_0x4b1cbf(0x86)]('✓')+_0x4b1cbf(0x8b)+_0x250f52+_0x4b1cbf(0xdb)),console[_0x4b1cbf(0x80)](),console[_0x4b1cbf(0x80)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x4b1cbf(0x80)]('\x20\x20tdx\x20--profile\x20'+_0x250f52+_0x4b1cbf(0xd7)),console[_0x4b1cbf(0x80)](_0x4b1cbf(0xbb)+_0x250f52+_0x4b1cbf(0xc1)),0x0;}catch(_0x124d2c){if(_0x124d2c instanceof HTTPClientError&&_0x124d2c['status']===0x191)return printAuthError(_0x124d2c),0x1;return console[_0x4b1cbf(0xd4)](a32_0x10057f[_0x4b1cbf(0xbc)](_0x4b1cbf(0xd6)+(_0x124d2c instanceof Error?_0x124d2c[_0x4b1cbf(0xde)]:String(_0x124d2c)))),console[_0x4b1cbf(0xd4)](_0x4b1cbf(0xe5)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a32_0x2eb69e(0xaa);[a32_0x2eb69e(0xcf)]=a32_0x2eb69e(0x83);[a32_0x2eb69e(0x77)](_0x4fec88){const _0x3831fc=a32_0x2eb69e,{args:_0x26034e}=_0x4fec88;if(_0x26034e[_0x3831fc(0xa0)]===0x0)return _0x3831fc(0xc4);return undefined;}async[a32_0x2eb69e(0x94)](_0x369eef){const _0x28cb96=a32_0x2eb69e,{args:_0x58c923}=_0x369eef,_0x4fc799=_0x58c923[0x0];console[_0x28cb96(0x80)](a32_0x10057f[_0x28cb96(0xb9)](_0x28cb96(0xb2)));if(!profileExists(_0x4fc799)){console['error'](a32_0x10057f['red'](_0x28cb96(0x9b)+_0x4fc799+_0x28cb96(0x7b))),console['log'](_0x28cb96(0xc7));const _0x5c966d=listProfiles();if(_0x5c966d[_0x28cb96(0xa0)]===0x0)console[_0x28cb96(0x80)](_0x28cb96(0x97));else for(const _0x2bdf9d of _0x5c966d){console[_0x28cb96(0x80)](_0x28cb96(0xa5)+_0x2bdf9d[_0x28cb96(0x7a)]);}return 0x1;}const _0x3e8f77=await a32_0x4c5c7f({'type':_0x28cb96(0xad),'name':_0x28cb96(0xad),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x4fc799+'\x27?','initial':![]});if(!_0x3e8f77[_0x28cb96(0xad)])return console[_0x28cb96(0x80)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x4fc799),console[_0x28cb96(0x80)](a32_0x10057f[_0x28cb96(0x86)]('✓')+_0x28cb96(0x8b)+_0x4fc799+_0x28cb96(0xa8));}catch(_0x32127c){return console[_0x28cb96(0xd4)](a32_0x10057f[_0x28cb96(0xbc)](_0x28cb96(0xd8)+(_0x32127c instanceof Error?_0x32127c[_0x28cb96(0xde)]:String(_0x32127c)))),0x1;}const _0x53eb02=await isKeychainAvailable();if(_0x53eb02){const _0x303549=await deleteKeychainAPIKey(_0x4fc799);_0x303549&&console[_0x28cb96(0x80)](a32_0x10057f[_0x28cb96(0x86)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a32_0x2eb69e(0x7a)]=a32_0x2eb69e(0x79);[a32_0x2eb69e(0xcf)]=a32_0x2eb69e(0x84);static [a32_0x2eb69e(0x7f)]=[a32_0x2eb69e(0xa1),'database','parent_segment','llm_project','llm_agent',a32_0x2eb69e(0xcf)];['validate'](_0x236cf5){const _0x5ba23b=a32_0x2eb69e,{args:_0x37cf72,options:_0x59c22f}=_0x236cf5,_0x5b8fb8=_0x59c22f[_0x5ba23b(0x8a)]||getActiveProfile();if(!_0x5b8fb8)return _0x5ba23b(0xdf);if(_0x37cf72['length']===0x0)return _0x5ba23b(0xcc)+ProfileSetCommand['VALID_KEYS'][_0x5ba23b(0xb0)](',\x20');const _0x30b0b1=_0x37cf72[0x0];if(!_0x30b0b1[_0x5ba23b(0x98)]('='))return _0x5ba23b(0xaf)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x4c70fb]=_0x30b0b1['split']('=',0x2);if(!ProfileSetCommand[_0x5ba23b(0x7f)]['includes'](_0x4c70fb))return _0x5ba23b(0x8c)+_0x4c70fb+_0x5ba23b(0xca)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a32_0x2eb69e(0x94)](_0x4878af){const _0x29157d=a32_0x2eb69e,{args:_0x318c67,options:_0x468e79}=_0x4878af,_0xe78e08=_0x468e79['profile']||getActiveProfile(),[_0x2aa74f,..._0x107e71]=_0x318c67[0x0][_0x29157d(0xe0)]('='),_0x1bf979=_0x107e71[_0x29157d(0xb0)]('=');console[_0x29157d(0x80)](a32_0x10057f[_0x29157d(0xb9)](_0x29157d(0xdc)));if(!profileExists(_0xe78e08)){const _0x1b6d20=await a32_0x4c5c7f({'type':_0x29157d(0xad),'name':_0x29157d(0xd9),'message':_0x29157d(0x9b)+_0xe78e08+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x1b6d20[_0x29157d(0xd9)])return console['log'](_0x29157d(0x89)),0x1;}const _0xc6cf18=loadProfile(_0xe78e08),_0x176074=_0xc6cf18?.[_0x29157d(0xc6)]||{};if(_0x2aa74f===_0x29157d(0xa1)){const _0x134c9b=resolveSite(_0x1bf979);console[_0x29157d(0x80)](_0x29157d(0xba)+_0x134c9b+_0x29157d(0xce)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x29157d(0x80)]('\x20\x20'+getConsoleUrl(_0x134c9b,_0x29157d(0xc9)));const _0x2d8272=await a32_0x4c5c7f({'type':_0x29157d(0xd2),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x2c7571=>{const _0x29f01b=_0x29157d;if(!_0x2c7571||!_0x2c7571[_0x29f01b(0x7c)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2d8272['apiKey'])return console[_0x29157d(0x80)](_0x29157d(0xd3)),0x1;console[_0x29157d(0x80)](_0x29157d(0x81));try{const _0x281b9d=TDX['create']({'site':_0x134c9b,'apiKey':_0x2d8272['apiKey']['trim'](),'logLevel':_0x468e79[_0x29157d(0x90)]??LogLevel['ERROR']}),_0x214a69=await _0x281b9d['jobs']['getUserInfo']();console[_0x29157d(0x80)](a32_0x10057f['green']('✓')+_0x29157d(0x87)+_0x214a69['email']+')');const _0x3fd82b=await isKeychainAvailable();_0x3fd82b?(await saveAPIKeyAsync(_0x2d8272['apiKey']['trim'](),_0x134c9b,_0xe78e08),console[_0x29157d(0x80)](a32_0x10057f[_0x29157d(0x86)]('✓')+_0x29157d(0xb6))):console['warn'](a32_0x10057f[_0x29157d(0xab)](_0x29157d(0x91))),_0x176074[_0x29157d(0xa1)]=_0x134c9b;}catch(_0x3ff95a){if(_0x3ff95a instanceof HTTPClientError&&_0x3ff95a[_0x29157d(0x8e)]===0x191)return printAuthError(_0x3ff95a),0x1;return console[_0x29157d(0xd4)](a32_0x10057f[_0x29157d(0xbc)]('✗\x20Validation\x20failed:\x20'+(_0x3ff95a instanceof Error?_0x3ff95a[_0x29157d(0xde)]:String(_0x3ff95a)))),console[_0x29157d(0xd4)](_0x29157d(0xda)),0x1;}}else _0x176074[_0x2aa74f]=_0x1bf979||undefined;return saveProfileToUserConfig(_0xe78e08,_0x176074),console[_0x29157d(0x80)](a32_0x10057f[_0x29157d(0x86)]('✓')+_0x29157d(0x8b)+_0xe78e08+_0x29157d(0xbe)+_0x2aa74f+'='+(_0x1bf979||_0x29157d(0xa9))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a32_0x2eb69e(0x7a)]='profile:use';[a32_0x2eb69e(0xcf)]=a32_0x2eb69e(0x9d);[a32_0x2eb69e(0x77)](_0x260053){const _0x5e4905=a32_0x2eb69e,{args:_0x152833}=_0x260053;if(_0x152833[_0x5e4905(0xa0)]===0x0)return _0x5e4905(0x99);return undefined;}async[a32_0x2eb69e(0x94)](_0x11e47e){const _0x29adf8=a32_0x2eb69e,{args:_0x1ac15b,options:_0x50a845}=_0x11e47e,_0x2ae0d6=_0x1ac15b[0x0],_0x304c34=_0x50a845[_0x29adf8(0xe6)];cleanExpiredSessions();if(!profileExists(_0x2ae0d6)){console['error'](a32_0x10057f[_0x29adf8(0xbc)](_0x29adf8(0x9b)+_0x2ae0d6+_0x29adf8(0x7b))),console[_0x29adf8(0x80)]('\x0aAvailable\x20profiles:');const _0x5f5642=listProfiles();if(_0x5f5642['length']===0x0)console[_0x29adf8(0x80)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x4d3e9a of _0x5f5642){console['log']('\x20\x20-\x20'+_0x4d3e9a[_0x29adf8(0x7a)]);}return 0x1;}if(_0x304c34){const _0x5b78b0=a32_0x2e2c98[_0x29adf8(0xb0)](getConfigDir(),_0x29adf8(0xa4));return saveActiveProfileToUserConfig(_0x2ae0d6),console[_0x29adf8(0x80)](_0x29adf8(0xe3)+a32_0x10057f['green'](_0x2ae0d6)),console['log'](a32_0x10057f[_0x29adf8(0xc5)](_0x29adf8(0xd5)+_0x5b78b0)),0x0;}const _0x4440ea=getSessionID(_0x50a845[_0x29adf8(0xbf)]);return saveSessionContext({'profile':_0x2ae0d6},_0x50a845[_0x29adf8(0xbf)]),console['log'](_0x29adf8(0xc2)+a32_0x10057f[_0x29adf8(0x86)](_0x2ae0d6)+'\x20'+a32_0x10057f[_0x29adf8(0xc5)]('(session:\x20'+_0x4440ea+')')),console[_0x29adf8(0x80)](a32_0x10057f[_0x29adf8(0xc5)](_0x29adf8(0x96)+_0x2ae0d6+_0x29adf8(0x7d))),0x0;}}
|
|
1
|
+
const a32_0x447a78=a32_0x5625;(function(_0x497c22,_0x4368ea){const _0x87a29e=a32_0x5625,_0xa9799=_0x497c22();while(!![]){try{const _0x27de96=parseInt(_0x87a29e(0x15b))/0x1*(-parseInt(_0x87a29e(0x14b))/0x2)+-parseInt(_0x87a29e(0x133))/0x3+parseInt(_0x87a29e(0x167))/0x4*(parseInt(_0x87a29e(0x130))/0x5)+parseInt(_0x87a29e(0x12e))/0x6*(parseInt(_0x87a29e(0x16c))/0x7)+-parseInt(_0x87a29e(0x156))/0x8+parseInt(_0x87a29e(0x16d))/0x9+parseInt(_0x87a29e(0x164))/0xa;if(_0x27de96===_0x4368ea)break;else _0xa9799['push'](_0xa9799['shift']());}catch(_0x9d81c7){_0xa9799['push'](_0xa9799['shift']());}}}(a32_0x2f33,0xba056));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a32_0x4f0807 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a32_0x5625(_0x2acbad,_0x2a4989){_0x2acbad=_0x2acbad-0x10e;const _0x2f33e8=a32_0x2f33();let _0x5625d2=_0x2f33e8[_0x2acbad];return _0x5625d2;}import a32_0x4cc8b2 from'prompts';import a32_0x2bd5a5 from'chalk';function validateProfileName(_0x4c38fa){const _0x4679f7=a32_0x5625;if(!_0x4c38fa||!_0x4c38fa[_0x4679f7(0x174)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x42d9b9=_0x4c38fa[_0x4679f7(0x174)]();if(!/^[a-zA-Z0-9_-]+$/[_0x4679f7(0x10f)](_0x42d9b9))return _0x4679f7(0x178);if(profileExists(_0x42d9b9))return _0x4679f7(0x135)+_0x42d9b9+_0x4679f7(0x166);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a32_0x447a78(0x111);[a32_0x447a78(0x120)]='Create\x20a\x20new\x20profile';async[a32_0x447a78(0x122)](_0x9c1e33){const _0x4f5acc=a32_0x447a78,{options:_0x15290e,args:_0x8337a4}=_0x9c1e33;console[_0x4f5acc(0x124)](a32_0x2bd5a5['bold'](_0x4f5acc(0x11a)));let _0x198e49;if(_0x8337a4['length']>0x0&&_0x8337a4[0x0]){const _0x332dc2=_0x8337a4[0x0][_0x4f5acc(0x174)](),_0x17b82e=validateProfileName(_0x332dc2);if(_0x17b82e!==!![])return console['error'](a32_0x2bd5a5[_0x4f5acc(0x138)](_0x17b82e)),0x1;_0x198e49=_0x332dc2;}else{const _0xe8ee23=await a32_0x4cc8b2({'type':_0x4f5acc(0x144),'name':_0x4f5acc(0x151),'message':_0x4f5acc(0x14f),'validate':validateProfileName});if(!_0xe8ee23[_0x4f5acc(0x151)])return console['log'](_0x4f5acc(0x16e)),0x1;_0x198e49=_0xe8ee23[_0x4f5acc(0x151)]['trim']();}const _0x30b028=await a32_0x4cc8b2({'type':_0x4f5acc(0x144),'name':'description','message':_0x4f5acc(0x148)}),_0x3258a6=_0x30b028[_0x4f5acc(0x120)]?.[_0x4f5acc(0x174)]()||undefined,_0xd9ad1e=_0x15290e[_0x4f5acc(0x110)]||'us01',_0x38852b=await promptSiteSelection(_0xd9ad1e,_0x198e49,_0x4f5acc(0x171));if(!_0x38852b)return 0x1;const _0x3daa9b=resolveSite(_0x38852b);if(isOAuthSupported(_0x3daa9b)){const _0x57fe4=await a32_0x4cc8b2({'type':_0x4f5acc(0x132),'name':_0x4f5acc(0x179),'message':_0x4f5acc(0x114),'choices':[{'title':_0x4f5acc(0x141),'value':_0x4f5acc(0x145)},{'title':'API\x20Key','value':_0x4f5acc(0x13b)}]});if(!_0x57fe4[_0x4f5acc(0x179)])return console[_0x4f5acc(0x124)](_0x4f5acc(0x16e)),0x1;if(_0x57fe4['method']==='oauth'){if(_0x3258a6){const _0x7aa449={'site':_0x3daa9b,'description':_0x3258a6};saveProfileToUserConfig(_0x198e49,_0x7aa449);}return await runOAuthLoginFlow(_0x3daa9b,_0x198e49,_0x15290e[_0x4f5acc(0x11f)]??LogLevel[_0x4f5acc(0x17b)]),0x0;}}console[_0x4f5acc(0x124)](_0x4f5acc(0x157)+_0x3daa9b),console['log'](_0x4f5acc(0x134)),console[_0x4f5acc(0x124)]('\x20\x20'+getConsoleUrl(_0x3daa9b,_0x4f5acc(0x13d)));const _0x2a1f6e=await a32_0x4cc8b2({'type':_0x4f5acc(0x140),'name':_0x4f5acc(0x16a),'message':_0x4f5acc(0x11c),'validate':_0x4f13e3=>{const _0x6ad4f2=_0x4f5acc;if(!_0x4f13e3||!_0x4f13e3[_0x6ad4f2(0x174)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2a1f6e[_0x4f5acc(0x16a)])return console[_0x4f5acc(0x124)](_0x4f5acc(0x16e)),0x1;const _0x4c72da=_0x2a1f6e[_0x4f5acc(0x16a)];console[_0x4f5acc(0x124)]('Validating\x20API\x20key...');try{const _0x18fd0c=TDX[_0x4f5acc(0x163)]({'site':_0x3daa9b,'apiKey':_0x4c72da[_0x4f5acc(0x174)](),'logLevel':_0x15290e[_0x4f5acc(0x11f)]??LogLevel[_0x4f5acc(0x17b)]}),_0x59f555=await _0x18fd0c['jobs'][_0x4f5acc(0x14a)]();console[_0x4f5acc(0x124)](a32_0x2bd5a5[_0x4f5acc(0x129)]('✓')+_0x4f5acc(0x10e)+_0x59f555['email']+')');const _0x5f18b2=await isKeychainAvailable();_0x5f18b2?(await saveAPIKeyAsync(_0x4c72da[_0x4f5acc(0x174)](),_0x3daa9b,_0x198e49),console[_0x4f5acc(0x124)](a32_0x2bd5a5[_0x4f5acc(0x129)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x198e49+')')):(console[_0x4f5acc(0x13c)](a32_0x2bd5a5['yellow'](_0x4f5acc(0x13f))),console[_0x4f5acc(0x13c)](a32_0x2bd5a5[_0x4f5acc(0x155)](_0x4f5acc(0x12f))));const _0x508083={'site':_0x3daa9b,..._0x3258a6&&{'description':_0x3258a6}};return saveProfileToUserConfig(_0x198e49,_0x508083),console[_0x4f5acc(0x124)](a32_0x2bd5a5['green']('✓')+_0x4f5acc(0x13a)+_0x198e49+_0x4f5acc(0x13e)),console[_0x4f5acc(0x124)](),console[_0x4f5acc(0x124)](_0x4f5acc(0x152)),console[_0x4f5acc(0x124)]('\x20\x20tdx\x20--profile\x20'+_0x198e49+_0x4f5acc(0x121)),console[_0x4f5acc(0x124)](_0x4f5acc(0x128)+_0x198e49+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2346f8){if(_0x2346f8 instanceof HTTPClientError&&_0x2346f8['status']===0x191)return printAuthError(_0x2346f8),0x1;return console[_0x4f5acc(0x12b)](a32_0x2bd5a5[_0x4f5acc(0x138)](_0x4f5acc(0x154)+(_0x2346f8 instanceof Error?_0x2346f8[_0x4f5acc(0x172)]:String(_0x2346f8)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a32_0x447a78(0x143);[a32_0x447a78(0x120)]=a32_0x447a78(0x113);['validate'](_0x2c68c4){const _0x529367=a32_0x447a78,{args:_0x386817}=_0x2c68c4;if(_0x386817[_0x529367(0x147)]===0x0)return _0x529367(0x149);return undefined;}async[a32_0x447a78(0x122)](_0x5e45a7){const _0x4eed47=a32_0x447a78,{args:_0x1e4d34}=_0x5e45a7,_0x28f1f8=_0x1e4d34[0x0];console[_0x4eed47(0x124)](a32_0x2bd5a5['bold'](_0x4eed47(0x165)));if(!profileExists(_0x28f1f8)){console[_0x4eed47(0x12b)](a32_0x2bd5a5['red'](_0x4eed47(0x135)+_0x28f1f8+'\x27\x20does\x20not\x20exist.')),console[_0x4eed47(0x124)](_0x4eed47(0x11d));const _0xd65837=listProfiles();if(_0xd65837[_0x4eed47(0x147)]===0x0)console[_0x4eed47(0x124)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x3e19ca of _0xd65837){console[_0x4eed47(0x124)]('\x20\x20-\x20'+_0x3e19ca[_0x4eed47(0x160)]);}return 0x1;}const _0xe7704d=await a32_0x4cc8b2({'type':_0x4eed47(0x127),'name':_0x4eed47(0x127),'message':_0x4eed47(0x17a)+_0x28f1f8+'\x27?','initial':![]});if(!_0xe7704d[_0x4eed47(0x127)])return console[_0x4eed47(0x124)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x28f1f8),console['log'](a32_0x2bd5a5[_0x4eed47(0x129)]('✓')+_0x4eed47(0x13a)+_0x28f1f8+'\x27\x20removed\x20from\x20configuration');}catch(_0x5a2aa6){return console[_0x4eed47(0x12b)](a32_0x2bd5a5[_0x4eed47(0x138)](_0x4eed47(0x117)+(_0x5a2aa6 instanceof Error?_0x5a2aa6[_0x4eed47(0x172)]:String(_0x5a2aa6)))),0x1;}const _0x4cd067=await isKeychainAvailable();if(_0x4cd067){const _0xaacea7=await deleteKeychainAPIKey(_0x28f1f8);_0xaacea7&&console['log'](a32_0x2bd5a5['green']('✓')+_0x4eed47(0x15a));}return 0x0;}}function a32_0x2f33(){const _0x31ffd5=['email','12iIToeS','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','3818785YAFKil','status','select','2480817YRpLUH','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20--default\x27\x20to\x20save\x20permanently','red','API\x20key\x20cannot\x20be\x20empty','\x20Profile\x20\x27','apikey','warn','/app/mp/ak','\x27\x20created','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','password','OAuth\x20(browser\x20login)','split','profile:remove','text','oauth','profile','length','Enter\x20description\x20(optional):','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','getUserInfo','142cLJMrG','Site\x20was\x20not\x20changed.','(cleared)','\x27\x20requires\x20API\x20key\x20validation.','Enter\x20profile\x20name:','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profileName','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Set\x20session\x20profile','✗\x20Validation\x20failed:\x20','yellow','7051576APiJWT','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Unknown\x20key\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20API\x20key\x20removed\x20from\x20system\x20keychain','21240gVCwDA','parent_segment','bold','validate','dim','name','Session\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist.','create','28121340KqwdrL','tdx:\x20profile\x20remove','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','4XjRxKL','session','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','apiKey','llm_project','1390151jruvKi','47619OREMWb','\x0aSetup\x20cancelled','default','\x20\x20(no\x20profiles\x20found)','Setup\x20cancelled','message','Operation\x20cancelled','trim','llm_agent','Default\x20profile\x20set\x20to:\x20','\x20\x20-\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','method','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','ERROR','\x20API\x20key\x20is\x20valid\x20(User:\x20','test','site','profile:create','VALID_KEYS','Remove\x20a\x20profile','Choose\x20authentication\x20method:','tdx:\x20profile\x20set','config','Failed\x20to\x20remove\x20profile:\x20','Changing\x20site\x20to\x20\x27','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','tdx:\x20profile\x20create','profile:use','Enter\x20your\x20TD\x20API\x20key:','\x0aAvailable\x20profiles:','includes','logLevel','description','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','execute','Set\x20a\x20profile\x20configuration\x20value','log','join','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','confirm','\x20\x20tdx\x20--profile\x20','green','tdx.json','error','\x27\x20updated:\x20'];a32_0x2f33=function(){return _0x31ffd5;};return a32_0x2f33();}export class ProfileSetCommand extends BaseCommand{[a32_0x447a78(0x160)]='profile:set';['description']=a32_0x447a78(0x123);static ['VALID_KEYS']=[a32_0x447a78(0x110),'database',a32_0x447a78(0x15c),a32_0x447a78(0x16b),a32_0x447a78(0x175),a32_0x447a78(0x120)];['validate'](_0x110b65){const _0x45b4d0=a32_0x447a78,{args:_0x41ccb9,options:_0x33011a}=_0x110b65,_0x314339=_0x33011a['profile']||getActiveProfile();if(!_0x314339)return _0x45b4d0(0x119);if(_0x41ccb9[_0x45b4d0(0x147)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x45b4d0(0x112)][_0x45b4d0(0x125)](',\x20');const _0x487d73=_0x41ccb9[0x0];if(!_0x487d73[_0x45b4d0(0x11e)]('='))return _0x45b4d0(0x126)+ProfileSetCommand[_0x45b4d0(0x112)]['join'](',\x20');const [_0x3c228d]=_0x487d73[_0x45b4d0(0x142)]('=',0x2);if(!ProfileSetCommand[_0x45b4d0(0x112)]['includes'](_0x3c228d))return _0x45b4d0(0x158)+_0x3c228d+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x45b4d0(0x112)][_0x45b4d0(0x125)](',\x20');return undefined;}async['execute'](_0xd4b8cc){const _0x112b82=a32_0x447a78,{args:_0x41d269,options:_0x2f8240}=_0xd4b8cc,_0x169563=_0x2f8240[_0x112b82(0x146)]||getActiveProfile(),[_0x398d13,..._0x24eaf4]=_0x41d269[0x0]['split']('='),_0x14001a=_0x24eaf4[_0x112b82(0x125)]('=');console[_0x112b82(0x124)](a32_0x2bd5a5[_0x112b82(0x15d)](_0x112b82(0x115)));if(!profileExists(_0x169563)){const _0x38c33f=await a32_0x4cc8b2({'type':_0x112b82(0x127),'name':_0x112b82(0x163),'message':_0x112b82(0x135)+_0x169563+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x38c33f[_0x112b82(0x163)])return console[_0x112b82(0x124)](_0x112b82(0x173)),0x1;}const _0x4a9663=loadProfile(_0x169563),_0x3719c7=_0x4a9663?.[_0x112b82(0x116)]||{};if(_0x398d13===_0x112b82(0x110)){const _0x32baa2=resolveSite(_0x14001a);console[_0x112b82(0x124)](_0x112b82(0x118)+_0x32baa2+_0x112b82(0x14e)),console['log'](_0x112b82(0x150)),console[_0x112b82(0x124)]('\x20\x20'+getConsoleUrl(_0x32baa2,_0x112b82(0x13d)));const _0x12d038=await a32_0x4cc8b2({'type':_0x112b82(0x140),'name':_0x112b82(0x16a),'message':_0x112b82(0x159),'validate':_0xb324bd=>{const _0xacca8a=_0x112b82;if(!_0xb324bd||!_0xb324bd[_0xacca8a(0x174)]())return _0xacca8a(0x139);return!![];}});if(!_0x12d038['apiKey'])return console[_0x112b82(0x124)]('\x0aOperation\x20cancelled'),0x1;console[_0x112b82(0x124)]('Validating\x20API\x20key...');try{const _0x46a4b5=TDX[_0x112b82(0x163)]({'site':_0x32baa2,'apiKey':_0x12d038[_0x112b82(0x16a)][_0x112b82(0x174)](),'logLevel':_0x2f8240[_0x112b82(0x11f)]??LogLevel['ERROR']}),_0x2789e5=await _0x46a4b5['jobs'][_0x112b82(0x14a)]();console[_0x112b82(0x124)](a32_0x2bd5a5[_0x112b82(0x129)]('✓')+_0x112b82(0x10e)+_0x2789e5[_0x112b82(0x12d)]+')');const _0x34ece2=await isKeychainAvailable();_0x34ece2?(await saveAPIKeyAsync(_0x12d038['apiKey'][_0x112b82(0x174)](),_0x32baa2,_0x169563),console[_0x112b82(0x124)](a32_0x2bd5a5[_0x112b82(0x129)]('✓')+_0x112b82(0x136))):console[_0x112b82(0x13c)](a32_0x2bd5a5[_0x112b82(0x155)](_0x112b82(0x13f))),_0x3719c7[_0x112b82(0x110)]=_0x32baa2;}catch(_0x47ab9e){if(_0x47ab9e instanceof HTTPClientError&&_0x47ab9e[_0x112b82(0x131)]===0x191)return printAuthError(_0x47ab9e),0x1;return console[_0x112b82(0x12b)](a32_0x2bd5a5[_0x112b82(0x138)](_0x112b82(0x154)+(_0x47ab9e instanceof Error?_0x47ab9e['message']:String(_0x47ab9e)))),console[_0x112b82(0x12b)](_0x112b82(0x14c)),0x1;}}else _0x3719c7[_0x398d13]=_0x14001a||undefined;return saveProfileToUserConfig(_0x169563,_0x3719c7),console[_0x112b82(0x124)](a32_0x2bd5a5[_0x112b82(0x129)]('✓')+_0x112b82(0x13a)+_0x169563+_0x112b82(0x12c)+_0x398d13+'='+(_0x14001a||_0x112b82(0x14d))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a32_0x447a78(0x160)]=a32_0x447a78(0x11b);[a32_0x447a78(0x120)]=a32_0x447a78(0x153);[a32_0x447a78(0x15e)](_0x290042){const _0xe75d08=a32_0x447a78,{args:_0x1904c9}=_0x290042;if(_0x1904c9[_0xe75d08(0x147)]===0x0)return _0xe75d08(0x169);return undefined;}async[a32_0x447a78(0x122)](_0x3d67b1){const _0x139548=a32_0x447a78,{args:_0x25d2b7,options:_0x69e53}=_0x3d67b1,_0xb775af=_0x25d2b7[0x0],_0xdc4289=_0x69e53[_0x139548(0x16f)];cleanExpiredSessions();if(!profileExists(_0xb775af)){console[_0x139548(0x12b)](a32_0x2bd5a5[_0x139548(0x138)](_0x139548(0x135)+_0xb775af+_0x139548(0x162))),console[_0x139548(0x124)](_0x139548(0x11d));const _0xca8dec=listProfiles();if(_0xca8dec[_0x139548(0x147)]===0x0)console[_0x139548(0x124)](_0x139548(0x170));else for(const _0x182949 of _0xca8dec){console[_0x139548(0x124)](_0x139548(0x177)+_0x182949[_0x139548(0x160)]);}return 0x1;}if(_0xdc4289){const _0x1cf131=a32_0x4f0807['join'](getConfigDir(),_0x139548(0x12a));return saveActiveProfileToUserConfig(_0xb775af),console['log'](_0x139548(0x176)+a32_0x2bd5a5[_0x139548(0x129)](_0xb775af)),console[_0x139548(0x124)](a32_0x2bd5a5[_0x139548(0x15f)]('\x0aSaved\x20to:\x20'+_0x1cf131)),0x0;}const _0x1856d7=getSessionID(_0x69e53[_0x139548(0x168)]);return saveSessionContext({'profile':_0xb775af},_0x69e53[_0x139548(0x168)]),console[_0x139548(0x124)](_0x139548(0x161)+a32_0x2bd5a5[_0x139548(0x129)](_0xb775af)+'\x20'+a32_0x2bd5a5[_0x139548(0x15f)]('(session:\x20'+_0x1856d7+')')),console[_0x139548(0x124)](a32_0x2bd5a5[_0x139548(0x15f)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0xb775af+_0x139548(0x137))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x475ed4=a33_0x508c;function a33_0xad0a(){const _0x1a9ca6=['Error:\x20','site','description','green','execute','length','1365072SPQRod','\x20\x20Global:\x20~/.config/tdx/tdx.json','1106649FefSka','248538prweQr','config','262882deLfKz','error','dim','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','name','70375BOOMTc','2GpaRcM','map','579537SMHETQ','log','130215hsFGJO','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','20hxcbTm'];a33_0xad0a=function(){return _0x1a9ca6;};return a33_0xad0a();}(function(_0x2535c5,_0x5b2a2a){const _0x1f7324=a33_0x508c,_0x228d52=_0x2535c5();while(!![]){try{const _0x16e3d1=parseInt(_0x1f7324(0x113))/0x1*(parseInt(_0x1f7324(0x119))/0x2)+parseInt(_0x1f7324(0x11d))/0x3+parseInt(_0x1f7324(0x107))/0x4*(-parseInt(_0x1f7324(0x118))/0x5)+parseInt(_0x1f7324(0x111))/0x6+-parseInt(_0x1f7324(0x11b))/0x7+-parseInt(_0x1f7324(0x10e))/0x8+parseInt(_0x1f7324(0x110))/0x9;if(_0x16e3d1===_0x5b2a2a)break;else _0x228d52['push'](_0x228d52['shift']());}catch(_0x11bf44){_0x228d52['push'](_0x228d52['shift']());}}}(a33_0xad0a,0x23db7));function a33_0x508c(_0x4ba8c7,_0x59a66d){_0x4ba8c7=_0x4ba8c7-0x105;const _0xad0a20=a33_0xad0a();let _0x508c4a=_0xad0a20[_0x4ba8c7];return _0x508c4a;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a33_0x1ee076 from'chalk';export class ProfilesCommand extends BaseCommand{[a33_0x475ed4(0x117)]='profiles';[a33_0x475ed4(0x10a)]='List\x20all\x20available\x20profiles';async[a33_0x475ed4(0x10c)](_0x54a870){const _0x48549a=a33_0x475ed4,{options:_0xca0e53}=_0x54a870;try{const _0x37bc60=listProfiles(),_0x3b91af=getActiveProfile();if(_0x37bc60[_0x48549a(0x10d)]===0x0)return console[_0x48549a(0x11c)](_0x48549a(0x116)),console[_0x48549a(0x11c)](_0x48549a(0x106)),console['log'](_0x48549a(0x10f)),0x0;const _0x248ed3=_0x37bc60[_0x48549a(0x11a)](_0x4d4980=>{const _0x8b180d=_0x48549a,_0x125904=_0x4d4980[_0x8b180d(0x117)]===_0x3b91af,_0x5a22de=getProfileParams(_0x4d4980['config']);return{'name':_0x4d4980[_0x8b180d(0x117)],'active':_0x125904,'scope':_0x4d4980[_0x8b180d(0x105)],'description':_0x4d4980[_0x8b180d(0x112)][_0x8b180d(0x10a)]||'','params':_0x5a22de};});if(isStructuredFormat(_0xca0e53))await handleSDKOutput(_0x248ed3,_0xca0e53);else for(const _0x3a2834 of _0x37bc60){const _0x443b45=_0x3a2834[_0x48549a(0x117)]===_0x3b91af?a33_0x1ee076[_0x48549a(0x10b)]('\x20✓'):'',_0x2e7037=_0x3a2834[_0x48549a(0x112)]['site']?a33_0x1ee076[_0x48549a(0x115)]('\x20'+_0x3a2834[_0x48549a(0x112)][_0x48549a(0x109)]):'',_0x4bb1c4=_0x3a2834[_0x48549a(0x112)][_0x48549a(0x10a)]?a33_0x1ee076[_0x48549a(0x115)]('\x20\x20'+_0x3a2834['config'][_0x48549a(0x10a)]):'';console['log']('👤\x20'+_0x3a2834[_0x48549a(0x117)]+_0x443b45+_0x2e7037+_0x4bb1c4);}return 0x0;}catch(_0x5d7624){return _0x5d7624 instanceof Error&&console[_0x48549a(0x114)](_0x48549a(0x108)+_0x5d7624['message']),0x1;}}}
|