@treasuredata/tdx 0.28.7 → 0.28.8
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/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/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/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/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/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/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-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/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/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.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.js +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/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/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 a26_0x3ae22d=a26_0x1528;(function(_0x409245,_0x423438){const _0x596f7b=a26_0x1528,_0x2cc36c=_0x409245();while(!![]){try{const _0x1fc963=parseInt(_0x596f7b(0x1e7))/0x1+-parseInt(_0x596f7b(0x25d))/0x2*(parseInt(_0x596f7b(0x21c))/0x3)+-parseInt(_0x596f7b(0x219))/0x4*(-parseInt(_0x596f7b(0x241))/0x5)+-parseInt(_0x596f7b(0xe8))/0x6*(-parseInt(_0x596f7b(0x23c))/0x7)+parseInt(_0x596f7b(0x23d))/0x8*(-parseInt(_0x596f7b(0x17c))/0x9)+-parseInt(_0x596f7b(0x158))/0xa+-parseInt(_0x596f7b(0x191))/0xb;if(_0x1fc963===_0x423438)break;else _0x2cc36c['push'](_0x2cc36c['shift']());}catch(_0x5b2215){_0x2cc36c['push'](_0x2cc36c['shift']());}}}(a26_0x51cc,0x4e8cc));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x218ac3 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 a26_0x5d2da8 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a26_0x1528(_0x1395a4,_0x2e4ad2){_0x1395a4=_0x1395a4-0xd5;const _0x51ccba=a26_0x51cc();let _0x1528f4=_0x51ccba[_0x1395a4];return _0x1528f4;}const PARENT_SEGMENT_DIR=a26_0x3ae22d(0x190),LEGACY_PARENT_SEGMENT_DIR=a26_0x3ae22d(0x250);function a26_0x51cc(){const _0x243bfe=['joinKey','localeCompare','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','darwin','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20No\x20changes\x20-\x20','idStitching','Master\x20Table','.yaml','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Attributes','No\x20parent\x20segments\x20match\x20pattern:\x20','Creating\x20parent\x20segment\x20\x27','✘\x20Failed\x20to\x20rename\x20directory:\x20','true','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','preview','⚡\x20Enabled','Updating','-1d','toFixed','displayColumns','✔\x20Created\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','ps:rt:list','trim','353110qBLtJq','in\x20','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Join\x20on:','listParents','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x22,\x20\x22type\x22:\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Listing\x20personalization\x20services\x20for\x20\x27','\x20service','message','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20No\x20changes\x20-\x20\x27','column_name','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','list','dirname','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','keys','scheduleOption','previewParentYaml','Master\x20+\x20Attributes','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','segment:parent:desc','SELECT\x20*\x20FROM\x20','/\x20→\x20','Fetching\x20SQL\x20for\x20\x27','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','coveragePercent','repeat','Listing\x20parent\x20segments...','type','\x20\x20No\x20sample\x20data\x20available','segment:parent:show','attributes','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','477ZEuaTk','displayPreviewResults','realtime_enabled','column_type','behavior','Table:\x20','customerPercent','segment:parent:preview','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Available\x20attributes:','Parent\x20segment:\x20','Errors:','👥\x20','To\x20cancel:','matchedCount','/app/dw/parentSegments/','utf-8','Attributes:','\x20parent\x20segment','Options:\x0a','parent_segments','1984928BwHtNP','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','information_schema','text','No\x20RT-enabled\x20parent\x20segments\x20found','\x0a\x20\x20]\x0a}\x0a','\x0a\x20\x20\x20\x20}','My\x20Service','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','red','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Default','jobId','%)\x20','columns','\x20RT-enabled\x20parent\x20segment','/sessions/','test','\x27...','ps:pz:list','updateParent','getParentFull','description','\x20tdx\x20wf\x20attempt\x20','\x20rows)','Listing\x20parent\x20segments\x20matching\x20\x27','Created','\x0aNo\x20sample\x20data\x20available','Updated','table','using\x20the\x20default\x20path:\x20','realtime','column','error','\x20trigger=','segment:parent:sql','join','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','displayMasterInfo','Resolving\x20parent\x20segment\x20\x27','Source:','RT\x202.0:','\x20--attribute\x20\x22','number','Get\x20SQL\x20query\x20for\x20parent\x20segment','customersWithEvents','ps:pz:init','Customers:','\x0aNew\x20parent\x20segment\x20\x27','getParentSQL','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20=\x20','open','\x20to\x20configure\x20your\x20personalization\x20service','bold','session','workflowSessionId','primaryKey','query','SELECT\x20*\x20FROM\x20(\x0a','displayAttributesStats','resolveParentId','Create\x20parent\x20segment\x20\x27','Pattern:\x20','\x20Configuration\x20is\x20valid','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','stop','processedRows','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','ps:rt:validate','/{name}.yml\x0a','\x20Added\x20RT\x202.0\x20template\x20section','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','audienceId','name','\x0aError:','Audience\x20ID:','\x20\x20\x20\x20','status','\x20to\x20push\x20the\x20configuration','all','Personalization:','realtime:','allValid','Site:\x20','site','572234xXITqN','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','errors','label','Listing\x20RT-enabled\x20parent\x20segments...','stats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','totalEvents','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','personalization','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20[Job\x20ID:\x20','displaySampleData','Fetching\x20behavior\x20list...','Status:','tdx\x20ps\x20preview\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','database','\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','toLocaleString','Error:\x20--attribute\x20requires\x20a\x20name\x0a','List\x20parent\x20segments','Fetching\x20customers\x20schema...','pushParentYaml','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Schema\x20saved\x20to\x20','\x20parent\x20segment\x20\x27','\x22\x20}','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x27\x20and\x20run\x20workflow?','interval','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','pullParentYaml','\x20\x201.\x20Edit\x20','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','user_id','\x20rows\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','dim','format','getOutputDatabaseName','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x0aChanges\x20to\x20\x27','Error:\x20--database\x20and\x20--table\x20are\x20required','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','page_view','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','ignore','1510844dUTvaB','\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','Columns:','519MWhyaO','✔\x20Found\x20','start','tdx\x20ps\x20push\x20','reduce','filter','toLowerCase','customerGroupFile','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','yes','rowCount','customerGroup','verbose','Database:\x20','master','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','population','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20Added\x20personalization\x20template\x20to\x20','apply','data','displayPreviewHints','Apply\x20changes\x20to\x20\x27','\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','Fetching\x20sample\x20data...','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20RT\x20configuration\x20is\x20valid','behaviorsFile','win32','Events:','segment:parent:view','td_client_id','1763433cYrdux','91168szbZSy','segment:parent:run','Session:','Options\x20(one\x20required):\x0a','5iMnzuR','/\x20and\x20','map','\x0a⚠️\x20\x20Migrating:\x20','Aborted.','Analyzing\x20changes...','personalizationServices','Validating\x20configuration...','\x20personalization\x20service','setJobId','collectSchema','\x20Context\x20set:\x20','Error\x20reading\x20file:\x20','Preview:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','parent_segment','segment','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','trigger_event','xdg-open','parentSegment','sort','personalization_services','schemaValid','Fetching\x20parent\x20segment\x20\x27','json','enriched','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','698hdBUyM','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','schemaError','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','workflowAttemptId','log','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','ID\x20Stitching:','scheduleType','elapsedTimeMillis','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','match','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','timezone','behaviors','.yml','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Executing\x20parent\x20segment\x20query...','\x0aChanges\x20to\x20apply\x20to\x20\x27','yellow','green','displayBehaviorsStats','\x20\x20Columns:\x20','\x0a✔\x20Workflow\x20started','Output\x20Database:','addBehaviors','\x27\x20is\x20already\x20up\x20to\x20date','6lJEuet','segment:parent:push','No\x20personalization\x20services\x20configured','\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','\x20\x20\x20\x20-\x20','displayRealtimeInfo','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','displaySummary','\x20\x20\x20\x20\x20\x20','\x20field','single','limit','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Attempt:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','varchar','segment:parent:fields','customers','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Output\x20file:\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','stitchingKeys','/\x20directories\x20exist.','Error:','\x20section','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20--interval\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','segment:parent:pull','cyan','getBehaviorNames','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','sourceTableError','valid','segment:parent:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Creating','\x20--behavior\x20\x22','output','platform','unref','displayValidateResults','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','string','addAttributes','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','jsonl','sampleData','Behavior:','RT\x202.0\x20Validate:','push','\x27\x20is\x20up\x20to\x20date','Next\x20steps:','/attempt/','foreignKey','\x20--behavior\x20\x22<name>\x22','replace','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','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Validate:','attribute','events','\x20configured','\x20+\x20[','execute','\x20is\x20already\x20up\x20to\x20date','validateParentYaml','run','YAML\x20file:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20total','formatSchemaJson','endsWith','Validating\x20RT\x20configuration...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','web','\x5c$&','Found\x20YAML\x20file:\x20','length','behavior_','\x20\x20Tables:\x201\x20customers\x20+\x20','No\x20parent\x20segments\x20found','addBehaviorsFile','\x20\x20\x20','\x0a\x20\x20\x20\x20]'];a26_0x51cc=function(){return _0x243bfe;};return a26_0x51cc();}function openBrowser(_0x3a67aa){const _0x1721af=a26_0x3ae22d,_0xab8b5a=process[_0x1721af(0x10f)],_0x51f98a=_0xab8b5a===_0x1721af(0x141)?_0x1721af(0x1c5):_0xab8b5a===_0x1721af(0x238)?'start':_0x1721af(0x254);spawn(_0x51f98a,[_0x3a67aa],{'detached':!![],'stdio':_0x1721af(0x218)})[_0x1721af(0x110)]();}function migrateLegacyDirectory(){const _0x3e3fb1=a26_0x3ae22d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x405cf7=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x405cf7['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3e3fb1(0x1b2)](a26_0x5d2da8['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3e3fb1(0x242)+PARENT_SEGMENT_DIR+_0x3e3fb1(0xfe))),console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0x20f)](_0x3e3fb1(0x14d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0xe0)](_0x3e3fb1(0x244)+LEGACY_PARENT_SEGMENT_DIR+_0x3e3fb1(0x171)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0xe1)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x439084){const _0x31709e=_0x439084 instanceof Error?_0x439084['message']:String(_0x439084);return console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0x19a)](_0x3e3fb1(0x14b)+_0x31709e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x3ae22d(0x12c)](_0xf0fa){const _0x1eda45=a26_0x3ae22d;return migrateLegacyDirectory(),super[_0x1eda45(0x12c)](_0xf0fa);}}function resolveYamlFile(_0x23ca7a){const _0x3f49c6=a26_0x3ae22d;if(_0x23ca7a[_0x3f49c6(0x131)]('.yml')||_0x23ca7a[_0x3f49c6(0x131)](_0x3f49c6(0x146)))return _0x23ca7a;return a26_0x218ac3['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x23ca7a)+_0x3f49c6(0xdc));}function formatProgressMessage(_0x481cc8){const _0x905a99=a26_0x3ae22d,_0x1261fc=_0x481cc8[_0x905a99(0xd8)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1261fc){const [,_0x282607,_0x187a72,_0x2aa10e='']=_0x1261fc;return a26_0x5d2da8[_0x905a99(0x20f)](_0x282607+':')+'\x20'+_0x187a72+a26_0x5d2da8[_0x905a99(0x20f)](_0x2aa10e);}return a26_0x5d2da8[_0x905a99(0x20f)](_0x481cc8);}function showFileNotFoundError(_0x40fd07,_0x221913){const _0x174320=a26_0x3ae22d;console['error'](a26_0x5d2da8[_0x174320(0x19a)]('Error:\x20File\x20not\x20found:\x20'+_0x40fd07+'\x0a')),console['error'](a26_0x5d2da8['cyan'](_0x174320(0x1e9)+_0x221913+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x1d19a5){const _0x4cd797=a26_0x3ae22d;if(!_0x1d19a5[_0x4cd797(0x1b0)])return;const _0xbce70=_0x1d19a5[_0x4cd797(0x1b0)],_0x46eebc=_0xbce70['enabled']?a26_0x5d2da8[_0x4cd797(0xe1)](_0x4cd797(0x14f)):a26_0x5d2da8['yellow']('⚡\x20Not\x20enabled');console[_0x4cd797(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x1ba))+'\x20'+_0x46eebc);if(_0xbce70[_0x4cd797(0x126)]&&_0xbce70[_0x4cd797(0x126)][_0x4cd797(0x137)]>0x0){console['error']('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x239))+'\x20'+_0xbce70[_0x4cd797(0x126)][_0x4cd797(0x137)]+_0x4cd797(0x127));for(const _0x59b20d of _0xbce70['events']){const _0x5da74d=_0x59b20d['sourceTableValid']===![]?a26_0x5d2da8[_0x4cd797(0x19a)]('✘'):a26_0x5d2da8[_0x4cd797(0xe1)]('✔');console[_0x4cd797(0x1b2)](_0x4cd797(0x1de)+_0x5da74d+'\x20'+_0x59b20d[_0x4cd797(0x1db)]),_0x59b20d[_0x4cd797(0x108)]&&console[_0x4cd797(0x1b2)](_0x4cd797(0xf0)+a26_0x5d2da8[_0x4cd797(0x19a)](_0x59b20d[_0x4cd797(0x108)]));}}if(_0xbce70['attributes']&&_0xbce70[_0x4cd797(0x17a)][_0x4cd797(0x137)]>0x0){console[_0x4cd797(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x18d))+'\x20'+_0xbce70[_0x4cd797(0x17a)][_0x4cd797(0x137)]+_0x4cd797(0x127));for(const _0x1a88d0 of _0xbce70[_0x4cd797(0x17a)]){const _0xaadc55=_0x1a88d0[_0x4cd797(0x109)]?a26_0x5d2da8['green']('✔'):a26_0x5d2da8[_0x4cd797(0x19a)]('✘');console[_0x4cd797(0x1b2)](_0x4cd797(0x1de)+_0xaadc55+'\x20'+_0x1a88d0[_0x4cd797(0x1db)]+'\x20'+a26_0x5d2da8['dim']('('+_0x1a88d0[_0x4cd797(0x177)]+')'));}}if(_0xbce70['idStitching']){const _0x16c000=_0xbce70[_0x4cd797(0x144)][_0x4cd797(0xfd)]?.[_0x4cd797(0x137)]?_0x4cd797(0x128)+_0xbce70[_0x4cd797(0x144)][_0x4cd797(0xfd)][_0x4cd797(0x1b5)](',\x20')+']':'';console[_0x4cd797(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x266))+'\x20'+_0xbce70[_0x4cd797(0x144)][_0x4cd797(0x1ca)]+_0x16c000);}if(_0xbce70[_0x4cd797(0x247)]&&_0xbce70[_0x4cd797(0x247)][_0x4cd797(0x137)]>0x0){console[_0x4cd797(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x1e2))+'\x20'+_0xbce70['personalizationServices'][_0x4cd797(0x137)]+_0x4cd797(0x161)+(_0xbce70[_0x4cd797(0x247)][_0x4cd797(0x137)]!==0x1?'s':''));for(const _0x5351e6 of _0xbce70[_0x4cd797(0x247)]){console['error'](_0x4cd797(0xec)+_0x5351e6[_0x4cd797(0x1db)]);}}}function showParentSegmentNotSetError(_0x2318f9){const _0x49ff61=a26_0x3ae22d;console['error'](a26_0x5d2da8[_0x49ff61(0xe0)](_0x49ff61(0x1b6))),console[_0x49ff61(0x1b2)](_0x2318f9);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x10a);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1fd);async[a26_0x3ae22d(0x129)](_0x5a762e){const _0x207fff=a26_0x3ae22d,{options:_0x2b2bf3,args:_0x1e7042,tdx:_0xf3b6e8}=_0x5a762e,_0x25fa86=_0x1e7042[0x0];_0x2b2bf3[_0x207fff(0x228)]&&(console[_0x207fff(0x1b2)](_0x207fff(0x1e5)+_0x2b2bf3['site']),_0x25fa86&&console[_0x207fff(0x1b2)](_0x207fff(0x1d0)+_0x25fa86));const _0x476504=await withSpinner(_0x25fa86?_0x207fff(0x1aa)+_0x25fa86+_0x207fff(0x1a3):_0x207fff(0x176),()=>_0xf3b6e8[_0x207fff(0x251)][_0x207fff(0x15c)](),{'verbose':_0x2b2bf3[_0x207fff(0x228)]});let _0x3c8559=_0x476504[_0x207fff(0x230)];if(_0x25fa86){const _0x200a9f=_0x25fa86[_0x207fff(0x121)](/[.+^${}()|[\]\\]/g,_0x207fff(0x135))['replace'](/\*/g,'.*')[_0x207fff(0x121)](/\?/g,'.'),_0x368c56=new RegExp('^'+_0x200a9f+'$','i');_0x3c8559=_0x3c8559[_0x207fff(0x221)](_0x1f8c62=>_0x368c56[_0x207fff(0x1a2)](_0x1f8c62[_0x207fff(0x17a)][_0x207fff(0x1db)]));}_0x3c8559[_0x207fff(0x256)]((_0x44caec,_0x5a0f64)=>_0x44caec[_0x207fff(0x17a)][_0x207fff(0x1db)][_0x207fff(0x13f)](_0x5a0f64[_0x207fff(0x17a)][_0x207fff(0x1db)])),console[_0x207fff(0x1b2)](_0x207fff(0x21d)+_0x3c8559[_0x207fff(0x137)]+_0x207fff(0x18e)+(_0x3c8559[_0x207fff(0x137)]!==0x1?'s':''));const _0x448b49=_0x16afa2=>{const _0xc133d7=_0x207fff;return getConsoleNextUrl(_0x2b2bf3[_0xc133d7(0x1e6)],'/app/dw/parentSegments/'+_0x16afa2);};if(_0x2b2bf3[_0x207fff(0x210)]===_0x207fff(0x25a)||_0x2b2bf3[_0x207fff(0x210)]===_0x207fff(0x117)){const _0x42840c=_0x3c8559[_0x207fff(0x243)](_0x3b605c=>({..._0x3b605c,'url':_0x448b49(_0x3b605c['id'])}));await handleSDKOutput(_0x42840c,_0x2b2bf3);}else{if(_0x3c8559[_0x207fff(0x137)]===0x0)_0x25fa86?console[_0x207fff(0x263)](_0x207fff(0x149)+_0x25fa86):console[_0x207fff(0x263)](_0x207fff(0x13a));else for(const _0x20f854 of _0x3c8559){const _0x38cbac=_0x20f854['attributes']['population']?a26_0x5d2da8[_0x207fff(0x20f)]('\x20('+formatRows(_0x20f854[_0x207fff(0x17a)]['population'])+')'):'',_0x192f1a=hyperlink(_0x20f854[_0x207fff(0x17a)][_0x207fff(0x1db)],_0x448b49(_0x20f854['id']));console[_0x207fff(0x263)](_0x207fff(0x188)+_0x192f1a+_0x38cbac);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]='segment:parent:create';[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x15d);async[a26_0x3ae22d(0x129)](_0x100938){const _0x1f4bb2=a26_0x3ae22d,{options:_0x30a557,args:_0x2d250a,tdx:_0x2326ac}=_0x100938;console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x12e)+_0x1f4bb2(0x113)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xc1bd39=_0x30a557;if(_0x2d250a[_0x1f4bb2(0x137)]===0x0)return console[_0x1f4bb2(0x1b2)](a26_0x5d2da8[_0x1f4bb2(0x19a)](_0x1f4bb2(0x163))),console['error'](_0x1f4bb2(0x212)),0x1;const _0x3c8adc=_0x2d250a[0x0];if(!_0xc1bd39[_0x1f4bb2(0x1f9)]||!_0xc1bd39[_0x1f4bb2(0x1ae)])return console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x214)),console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x212)),0x1;_0xc1bd39['verbose']&&(console['error'](_0x1f4bb2(0x1e5)+_0xc1bd39[_0x1f4bb2(0x1e6)]),console[_0x1f4bb2(0x1b2)]('Name:\x20'+_0x3c8adc),console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x229)+_0xc1bd39[_0x1f4bb2(0x1f9)]),console['error'](_0x1f4bb2(0x181)+_0xc1bd39[_0x1f4bb2(0x1ae)]));const _0x13d315=await loadJSONFromOptions(_0xc1bd39['attributes'],_0xc1bd39['attributesFile']),_0x7b769a=await loadJSONFromOptions(_0xc1bd39[_0x1f4bb2(0xdb)],_0xc1bd39[_0x1f4bb2(0x237)]),_0x2d694f=await loadJSONFromOptions(_0xc1bd39[_0x1f4bb2(0x227)],_0xc1bd39[_0x1f4bb2(0x223)]),_0xa5d3dc={'name':_0x3c8adc,'description':_0xc1bd39[_0x1f4bb2(0x1a7)],'scheduleType':_0xc1bd39[_0x1f4bb2(0xd5)],'scheduleOption':_0xc1bd39[_0x1f4bb2(0x16b)],'timezone':_0xc1bd39[_0x1f4bb2(0xda)],'master':{'parentDatabaseName':_0xc1bd39[_0x1f4bb2(0x1f9)],'parentTableName':_0xc1bd39[_0x1f4bb2(0x1ae)]},'attributes':_0x13d315,'behaviors':_0x7b769a,'customerGroup':_0x2d694f},_0x53c9c7=await withSpinner(_0x1f4bb2(0x14a)+_0x3c8adc+_0x1f4bb2(0x1a3),()=>_0x2326ac[_0x1f4bb2(0x251)]['createParent'](_0xa5d3dc),{'verbose':_0x30a557[_0x1f4bb2(0x228)]}),_0x62855d=_0x53c9c7[_0x1f4bb2(0x230)];return console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x154)+_0x62855d['name']+'\x27\x20with\x20ID:\x20'+_0x62855d['id']),await handleSDKOutput([_0x62855d],_0x30a557),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]='segment:parent:update';[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1f8);async[a26_0x3ae22d(0x129)](_0x17627f){const _0x4f9164=a26_0x3ae22d,{options:_0x5d13cb,args:_0x4e07e6,tdx:_0x2a72b8}=_0x17627f;console[_0x4f9164(0x1b2)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x4f9164(0x113)+_0x4f9164(0x15a));const _0x40bd9e=_0x5d13cb;if(_0x4e07e6['length']===0x0)return console[_0x4f9164(0x1b2)](a26_0x5d2da8[_0x4f9164(0x19a)](_0x4f9164(0x163))),console[_0x4f9164(0x1b2)](_0x4f9164(0xf6)),0x1;const _0xe24465=_0x4e07e6[0x0];_0x40bd9e[_0x4f9164(0x228)]&&(console['error']('Site:\x20'+_0x40bd9e[_0x4f9164(0x1e6)]),console[_0x4f9164(0x1b2)](_0x4f9164(0x186)+_0xe24465));const _0x59aa9e=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0xe24465+_0x4f9164(0x1a3),()=>_0x2a72b8[_0x4f9164(0x251)][_0x4f9164(0x1a6)](_0xe24465),{'verbose':_0x40bd9e['verbose']}),_0x53c4ea=_0x59aa9e['data'],_0x37c3b9=await loadJSONFromOptions(_0x40bd9e[_0x4f9164(0x115)],_0x40bd9e['addAttributesFile']),_0x3bac2e=await loadJSONFromOptions(_0x40bd9e[_0x4f9164(0xe6)],_0x40bd9e[_0x4f9164(0x13b)]),_0x3ee080={'name':_0x53c4ea[_0x4f9164(0x1db)],'description':_0x40bd9e[_0x4f9164(0x1a7)]!==undefined?_0x40bd9e['description']:_0x53c4ea[_0x4f9164(0x1a7)],'scheduleType':_0x40bd9e[_0x4f9164(0xd5)]!==undefined?_0x40bd9e[_0x4f9164(0xd5)]:_0x53c4ea['scheduleType'],'scheduleOption':_0x40bd9e[_0x4f9164(0x16b)]!==undefined?_0x40bd9e['scheduleOption']:_0x53c4ea[_0x4f9164(0x16b)],'timezone':_0x40bd9e['timezone']!==undefined?_0x40bd9e['timezone']:_0x53c4ea['timezone'],'master':_0x53c4ea[_0x4f9164(0x22a)],'attributes':_0x37c3b9?[..._0x53c4ea['attributes']||[],..._0x37c3b9]:_0x53c4ea[_0x4f9164(0x17a)],'behaviors':_0x3bac2e?[..._0x53c4ea[_0x4f9164(0xdb)]||[],..._0x3bac2e]:_0x53c4ea[_0x4f9164(0xdb)],'customerGroup':_0x53c4ea[_0x4f9164(0x227)]},_0x364c33=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0xe24465+_0x4f9164(0x1a3),()=>_0x2a72b8[_0x4f9164(0x251)][_0x4f9164(0x1a5)](_0xe24465,_0x3ee080),{'verbose':_0x40bd9e['verbose']}),_0xbb2dc2=_0x364c33[_0x4f9164(0x230)];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0xbb2dc2[_0x4f9164(0x1db)]+'\x27'),await handleSDKOutput([_0xbb2dc2],_0x40bd9e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x104);[a26_0x3ae22d(0x1a7)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x44dc61){const _0x288f45=a26_0x3ae22d,{options:_0x4776cd,args:_0x28e4ae,tdx:_0xea175e}=_0x44dc61,_0x27c0d6=_0x4776cd,_0x158c51=_0x28e4ae[0x0]||_0x4776cd[_0x288f45(0x255)];if(!_0x158c51)return showParentSegmentNotSetError(_0x288f45(0x25e)+_0x288f45(0x25f)),0x1;if(_0x27c0d6['use']&&_0x27c0d6['output'])return console['error'](a26_0x5d2da8[_0x288f45(0x19a)](_0x288f45(0x116))),console[_0x288f45(0x1b2)](a26_0x5d2da8['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0x20f)](_0x288f45(0x1af)+PARENT_SEGMENT_DIR+_0x288f45(0x1d7))),console[_0x288f45(0x1b2)](a26_0x5d2da8['cyan'](_0x288f45(0x107))),0x1;const _0x3be114=_0x27c0d6[_0x288f45(0x10e)]||a26_0x218ac3['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x158c51)+_0x288f45(0xdc));_0x27c0d6[_0x288f45(0x228)]&&(console[_0x288f45(0x1b2)](_0x288f45(0x1e5)+_0x27c0d6[_0x288f45(0x1e6)]),console[_0x288f45(0x1b2)](_0x288f45(0x186)+_0x158c51),console[_0x288f45(0x1b2)](_0x288f45(0xfb)+_0x3be114));const _0x21368d=await withSpinner(_0x288f45(0x259)+_0x158c51+_0x288f45(0x1a3),()=>_0xea175e[_0x288f45(0x251)][_0x288f45(0x208)](_0x158c51),{'verbose':_0x27c0d6[_0x288f45(0x228)]}),_0x52847c=_0x21368d[_0x288f45(0x230)];if(existsSync(_0x3be114)){const _0x5a243b=readFileSync(_0x3be114,_0x288f45(0x18c)),_0x3d7d27=generateDiff(_0x5a243b,_0x52847c);if(!hasChanges(_0x3d7d27))console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe1)]('✔')+_0x288f45(0x143)+a26_0x5d2da8['cyan'](_0x3be114)+_0x288f45(0x12a));else{console['error'](_0x288f45(0x213)+_0x3be114+'\x27:'),console[_0x288f45(0x1b2)]('─'[_0x288f45(0x175)](0x3c)),console[_0x288f45(0x1b2)](formatDiffWithColors(_0x3d7d27)),console[_0x288f45(0x1b2)]('─'[_0x288f45(0x175)](0x3c));if(!_0x27c0d6[_0x288f45(0x225)]){if(!isInteractive())return console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0x19a)](_0x288f45(0x1dc)),_0x288f45(0x192)),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0x20f)](_0x288f45(0x140))),0x1;const _0x23b188=await confirmKey('Overwrite\x20\x27'+_0x3be114+'\x27?');if(!_0x23b188)return console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe0)](_0x288f45(0x245))),0x1;}writeFileSync(_0x3be114,_0x52847c,'utf-8'),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe1)]('✔')+_0x288f45(0xf4)+a26_0x5d2da8[_0x288f45(0x105)](_0x3be114));}}else{const _0x4bda62=a26_0x218ac3[_0x288f45(0x168)](_0x3be114);!existsSync(_0x4bda62)&&mkdirSync(_0x4bda62,{'recursive':!![]}),writeFileSync(_0x3be114,_0x52847c,_0x288f45(0x18c)),console['error'](a26_0x5d2da8['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x5d2da8['cyan'](_0x3be114));}return saveSessionContext({'parent_segment':_0x158c51},_0x27c0d6[_0x288f45(0x1c8)]),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe1)]('✔')+_0x288f45(0x24c)+a26_0x5d2da8[_0x288f45(0x20f)](_0x288f45(0x250))+_0x288f45(0x1c4)+a26_0x5d2da8[_0x288f45(0x105)](_0x158c51)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0xe9);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x25c);async[a26_0x3ae22d(0x129)](_0x1bacec){const _0x583af7=a26_0x3ae22d,{options:_0x260627,args:_0x5d2ed9,tdx:_0x2f306b}=_0x1bacec,_0x29a6f2=_0x260627,_0xd0c05c=_0x5d2ed9[0x0]||_0x260627[_0x583af7(0x255)];if(!_0xd0c05c)return showParentSegmentNotSetError(_0x583af7(0x155)+_0x583af7(0x15f)),0x1;const _0x5b2f13=resolveYamlFile(_0xd0c05c);if(!existsSync(_0x5b2f13))return showFileNotFoundError(_0x5b2f13,_0xd0c05c),0x1;_0x29a6f2[_0x583af7(0x228)]&&(console[_0x583af7(0x1b2)](_0x583af7(0x1e5)+_0x29a6f2[_0x583af7(0x1e6)]),console[_0x583af7(0x1b2)](_0x583af7(0x12d)+_0x5b2f13));let _0x5e5ec2;try{_0x5e5ec2=readFileSync(_0x5b2f13,_0x583af7(0x18c));}catch(_0x32f711){const _0xf4bef7=_0x32f711 instanceof Error?_0x32f711[_0x583af7(0x162)]:String(_0x32f711);return console[_0x583af7(0x1b2)](_0x583af7(0x24d)+_0xf4bef7),0x1;}const _0x24bd41=await withSpinner(_0x583af7(0x246),()=>_0x2f306b[_0x583af7(0x251)][_0x583af7(0x1ff)](_0x5e5ec2),{'verbose':_0x29a6f2['verbose']}),_0x1d43b5=_0x24bd41[_0x583af7(0x230)],{isNew:_0x531385,name:_0x14282d,hasChanges:_0x30eb30,diffFormatted:_0x534c2f}=_0x1d43b5;if(!_0x30eb30)return console[_0x583af7(0x1b2)](_0x583af7(0x164)+_0x14282d+_0x583af7(0xe7)),0x0;_0x531385?console['error'](_0x583af7(0x1c1)+_0x14282d+'\x27:'):console[_0x583af7(0x1b2)](_0x583af7(0xdf)+_0x14282d+'\x27:');console[_0x583af7(0x1b2)]('─'[_0x583af7(0x175)](0x3c)),console[_0x583af7(0x1b2)](_0x534c2f),console[_0x583af7(0x1b2)]('─'[_0x583af7(0x175)](0x3c));const _0x4d38d3=_0x531385?_0x583af7(0x1cf)+_0x14282d+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x14282d+'\x27?';if(!_0x29a6f2[_0x583af7(0x225)]){if(!isInteractive())return console['error'](a26_0x5d2da8['red']('\x0aError:'),_0x583af7(0x192)),console[_0x583af7(0x1b2)](a26_0x5d2da8[_0x583af7(0x20f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xbff716=await confirmKey(_0x4d38d3);if(!_0xbff716)return console['error'](a26_0x5d2da8[_0x583af7(0xe0)](_0x583af7(0x245))),0x1;}const _0x4235f2=_0x531385?_0x583af7(0x10c):_0x583af7(0x150),_0x4282ee=await withSpinner(_0x4235f2+_0x583af7(0x202)+_0x14282d+_0x583af7(0x1a3),()=>_0x1d43b5[_0x583af7(0x22f)](),{'verbose':_0x29a6f2[_0x583af7(0x228)]}),_0x1f406c=_0x4282ee[_0x583af7(0x230)],_0xe63ca5=getConsoleNextUrl(_0x29a6f2[_0x583af7(0x1e6)],'/app/dw/parentSegments/'+_0x1f406c['id']),_0x209be9=_0x531385?'Created':'Updated';return console[_0x583af7(0x1b2)]('✔\x20'+_0x209be9+_0x583af7(0x202)+_0x1f406c[_0x583af7(0x1db)]+'\x27'),console[_0x583af7(0x1b2)]('\x20\x20'+_0xe63ca5),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x264);['description']=a26_0x3ae22d(0x123);async[a26_0x3ae22d(0x129)](_0x37a1cd){const _0x4f2be1=a26_0x3ae22d,{options:_0x1335dc,args:_0x1c3c78,tdx:_0x54121a}=_0x37a1cd,_0x46da8f=_0x1335dc,_0x3e119a=_0x1c3c78[0x0]||_0x1335dc[_0x4f2be1(0x255)];if(!_0x3e119a)return showParentSegmentNotSetError(_0x4f2be1(0x235)+_0x4f2be1(0xee)+_0x4f2be1(0x18f)+_0x4f2be1(0x16e)+_0x4f2be1(0xfa)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1f2bd8=resolveYamlFile(_0x3e119a);if(!existsSync(_0x1f2bd8))return showFileNotFoundError(_0x1f2bd8,_0x3e119a),0x1;_0x46da8f['verbose']&&(console['error'](_0x4f2be1(0x1e5)+_0x46da8f['site']),console[_0x4f2be1(0x1b2)](_0x4f2be1(0x12d)+_0x1f2bd8));let _0x4f4349;try{_0x4f4349=readFileSync(_0x1f2bd8,_0x4f2be1(0x18c));}catch(_0x2dd770){const _0x18f92e=_0x2dd770 instanceof Error?_0x2dd770[_0x4f2be1(0x162)]:String(_0x2dd770);return console[_0x4f2be1(0x1b2)](_0x4f2be1(0x24d)+_0x18f92e),0x1;}const _0x120520=createCommandSpinner(a26_0x5d2da8[_0x4f2be1(0x20f)](_0x4f2be1(0x248)),{'verbose':_0x46da8f[_0x4f2be1(0x228)]});_0x120520[_0x4f2be1(0x21e)]();const _0x4ebd50={'onProgress':_0x12b2ff=>{const _0x18e97e=_0x4f2be1;_0x120520[_0x18e97e(0x194)]=formatProgressMessage(_0x12b2ff);}};if(_0x46da8f['master'])_0x4ebd50[_0x4f2be1(0x22a)]=!![];if(_0x46da8f[_0x4f2be1(0x25b)])_0x4ebd50['enriched']=!![];_0x46da8f[_0x4f2be1(0x125)]&&(_0x4ebd50[_0x4f2be1(0x125)]=_0x46da8f[_0x4f2be1(0x125)]);_0x46da8f[_0x4f2be1(0x180)]&&(_0x4ebd50[_0x4f2be1(0x180)]=_0x46da8f[_0x4f2be1(0x180)]);if(_0x46da8f[_0x4f2be1(0x206)])_0x4ebd50[_0x4f2be1(0x206)]=_0x46da8f[_0x4f2be1(0x206)];let _0x38b263;try{_0x38b263=await _0x54121a[_0x4f2be1(0x251)][_0x4f2be1(0x12b)](_0x4f4349,_0x4ebd50),_0x120520['stop']();}catch(_0x3bdf34){_0x120520[_0x4f2be1(0x1d3)]();throw _0x3bdf34;}const _0x255e90=_0x46da8f[_0x4f2be1(0x206)]||_0x4f2be1(0x151);return this['displayValidateResults'](_0x38b263,_0x4ebd50,_0x1f2bd8,_0x255e90),_0x38b263['allValid']?0x0:0x1;}[a26_0x3ae22d(0x111)](_0x591ac7,_0xc81b26,_0x4583d5,_0x1dfc36){const _0x3670f2=a26_0x3ae22d;console[_0x3670f2(0x1b2)]('\x0a'+a26_0x5d2da8['bold'](_0x3670f2(0x124))+'\x20'+_0x591ac7['name']),console[_0x3670f2(0x1b2)]('═'[_0x3670f2(0x175)](0x3c)),this[_0x3670f2(0x1b7)](_0x591ac7);if(typeof _0xc81b26[_0x3670f2(0x125)]===_0x3670f2(0x114)){this[_0x3670f2(0x1cd)](_0x591ac7),this[_0x3670f2(0xef)](_0x591ac7),this['displayPreviewHints'](_0x4583d5,_0x1dfc36,_0x3670f2(0x125),_0xc81b26[_0x3670f2(0x125)]);return;}if(_0xc81b26[_0x3670f2(0x125)]===!![]){this[_0x3670f2(0x1cd)](_0x591ac7),this[_0x3670f2(0xef)](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,'attributes');return;}if(typeof _0xc81b26[_0x3670f2(0x180)]===_0x3670f2(0x114)){this[_0x3670f2(0xe2)](_0x591ac7,_0x1dfc36),this[_0x3670f2(0xef)](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,'behavior',_0xc81b26[_0x3670f2(0x180)]);return;}if(_0xc81b26['behavior']===!![]){this[_0x3670f2(0xe2)](_0x591ac7,_0x1dfc36),this['displaySummary'](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,_0x3670f2(0xdb));return;}this[_0x3670f2(0x1cd)](_0x591ac7),this['displayBehaviorsStats'](_0x591ac7,_0x1dfc36),this[_0x3670f2(0xed)](_0x591ac7),this['displaySummary'](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,_0x3670f2(0x1e1));}[a26_0x3ae22d(0xed)](_0x3818a1){displayRealtimeValidation(_0x3818a1);}[a26_0x3ae22d(0x231)](_0x46f58d,_0x3a557f,_0xa5004e,_0x2dd1a2){const _0x32b934=a26_0x3ae22d;console['error']('\x0a'+a26_0x5d2da8[_0x32b934(0x20f)]('To\x20view\x20sample\x20data:'));const _0x21ad16=_0x3a557f!==_0x32b934(0x151)?_0x32b934(0x102)+_0x3a557f:'';if(_0xa5004e===_0x32b934(0x125)&&_0x2dd1a2)console['error']('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)]('tdx\x20ps\x20preview\x20'+_0x46f58d+'\x20--attribute\x20\x22'+_0x2dd1a2+'\x22'+_0x21ad16));else{if(_0xa5004e==='behavior'&&_0x2dd1a2)console[_0x32b934(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)]('tdx\x20ps\x20preview\x20'+_0x46f58d+_0x32b934(0x10d)+_0x2dd1a2+'\x22'+_0x21ad16));else(_0xa5004e===_0x32b934(0x17a)||_0xa5004e===_0x32b934(0x1e1))&&console[_0x32b934(0x1b2)]('\x20\x20'+a26_0x5d2da8['dim'](_0x32b934(0x1f7)+_0x46f58d+'\x20--attribute\x20\x22<name>\x22'+_0x21ad16));}(_0xa5004e===_0x32b934(0xdb)||_0xa5004e==='all')&&console[_0x32b934(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)](_0x32b934(0x1f7)+_0x46f58d+_0x32b934(0x120)+_0x21ad16)),_0xa5004e===_0x32b934(0x1e1)&&console['error']('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)](_0x32b934(0x1f7)+_0x46f58d+'\x20--enriched'+_0x21ad16));}[a26_0x3ae22d(0x1b7)](_0x20a03a){const _0x4cf2ef=a26_0x3ae22d,{master:_0x41d9c5}=_0x20a03a,_0x210a3b=_0x41d9c5[_0x4cf2ef(0x258)]?a26_0x5d2da8['green']('✔'):a26_0x5d2da8[_0x4cf2ef(0x19a)]('✘');console[_0x4cf2ef(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4cf2ef(0x20f)](_0x4cf2ef(0x145))),console[_0x4cf2ef(0x1b2)](_0x210a3b+'\x20'+a26_0x5d2da8[_0x4cf2ef(0x1c7)](_0x41d9c5[_0x4cf2ef(0x1f9)]+'.'+_0x41d9c5[_0x4cf2ef(0x1ae)])),_0x41d9c5[_0x4cf2ef(0x258)]?_0x41d9c5['rowCount']!==undefined&&console['error']('\x20\x20'+a26_0x5d2da8['dim']('Rows:')+'\x20'+a26_0x5d2da8[_0x4cf2ef(0x105)](formatRows(_0x41d9c5[_0x4cf2ef(0x226)]))):console[_0x4cf2ef(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cf2ef(0x19a)](_0x4cf2ef(0xff))+'\x20'+_0x41d9c5[_0x4cf2ef(0x260)]);}[a26_0x3ae22d(0x1cd)](_0x5e078b){const _0x47ae4c=a26_0x3ae22d;if(_0x5e078b[_0x47ae4c(0x17a)]['length']===0x0)return;console[_0x47ae4c(0x1b2)]('\x0a'+a26_0x5d2da8[_0x47ae4c(0x20f)](_0x47ae4c(0x148)));for(const _0x42a8cd of _0x5e078b[_0x47ae4c(0x17a)]){const _0x2d30f0=_0x42a8cd[_0x47ae4c(0x258)]?a26_0x5d2da8[_0x47ae4c(0xe1)]('✔'):a26_0x5d2da8['red']('✘');let _0x3eef28='';if(_0x42a8cd['schemaValid']&&_0x42a8cd[_0x47ae4c(0x18a)]!==undefined&&_0x42a8cd['coveragePercent']!==undefined){const _0x2762ba=_0x42a8cd[_0x47ae4c(0x174)][_0x47ae4c(0x152)](0x1),_0x13662d=_0x42a8cd['coveragePercent']>=0x50?a26_0x5d2da8[_0x47ae4c(0xe1)]:_0x42a8cd['coveragePercent']>=0x32?a26_0x5d2da8[_0x47ae4c(0xe0)]:a26_0x5d2da8[_0x47ae4c(0x19a)];_0x3eef28='\x20'+a26_0x5d2da8[_0x47ae4c(0x20f)]('Coverage:')+'\x20'+_0x13662d(_0x2762ba+'%')+'\x20('+formatRows(_0x42a8cd[_0x47ae4c(0x18a)])+_0x47ae4c(0x1a9);}console[_0x47ae4c(0x1b2)](_0x2d30f0+'\x20'+a26_0x5d2da8['bold'](_0x42a8cd[_0x47ae4c(0x1db)])+_0x3eef28),console['error']('\x20\x20'+a26_0x5d2da8['dim'](_0x47ae4c(0x1b9))+'\x20'+a26_0x5d2da8[_0x47ae4c(0x1c7)](_0x42a8cd[_0x47ae4c(0x1f9)]+'.'+_0x42a8cd[_0x47ae4c(0x1ae)]));const _0x5de88e=_0x42a8cd[_0x47ae4c(0x13e)]===_0x42a8cd[_0x47ae4c(0x11f)]?a26_0x5d2da8['dim'](_0x47ae4c(0x15b))+'\x20'+_0x42a8cd['joinKey']:a26_0x5d2da8[_0x47ae4c(0x20f)]('Join:')+'\x20'+_0x42a8cd[_0x47ae4c(0x13e)]+_0x47ae4c(0x1c4)+_0x42a8cd[_0x47ae4c(0x11f)];console['error']('\x20\x20'+_0x5de88e),console['error']('\x20\x20'+a26_0x5d2da8[_0x47ae4c(0x20f)](_0x47ae4c(0x21b))),this[_0x47ae4c(0x153)](_0x42a8cd[_0x47ae4c(0x19f)]),!_0x42a8cd[_0x47ae4c(0x258)]&&console[_0x47ae4c(0x1b2)]('\x20\x20'+a26_0x5d2da8['red'](_0x47ae4c(0xff))+'\x20'+_0x42a8cd[_0x47ae4c(0x260)]);}}[a26_0x3ae22d(0xe2)](_0x467f43,_0x13113e){const _0x4a0c59=a26_0x3ae22d;if(_0x467f43[_0x4a0c59(0xdb)][_0x4a0c59(0x137)]===0x0)return;console[_0x4a0c59(0x1b2)]('\x0a'+a26_0x5d2da8['dim']('Behaviors')+'\x20'+a26_0x5d2da8[_0x4a0c59(0x20f)]('('+_0x13113e+')'));for(const _0x549521 of _0x467f43['behaviors']){const _0x296b30=_0x549521[_0x4a0c59(0x258)]?a26_0x5d2da8[_0x4a0c59(0xe1)]('✔'):a26_0x5d2da8[_0x4a0c59(0x19a)]('✘');let _0x348000='';if(_0x549521[_0x4a0c59(0x258)]&&_0x549521[_0x4a0c59(0x1be)]!==undefined&&_0x549521[_0x4a0c59(0x1ef)]!==undefined){const _0xd0310d=_0x549521[_0x4a0c59(0x182)]?.[_0x4a0c59(0x152)](0x1)||'?',_0xd0d845=(_0x549521[_0x4a0c59(0x182)]??0x0)>=0x32?a26_0x5d2da8[_0x4a0c59(0xe1)]:(_0x549521['customerPercent']??0x0)>=0x14?a26_0x5d2da8['yellow']:a26_0x5d2da8[_0x4a0c59(0x19a)];_0x348000='\x20'+a26_0x5d2da8[_0x4a0c59(0x20f)](_0x4a0c59(0x1c0))+'\x20'+_0xd0d845(formatRows(_0x549521['customersWithEvents']))+'\x20('+_0xd0310d+_0x4a0c59(0x19e)+a26_0x5d2da8[_0x4a0c59(0x20f)](_0x4a0c59(0x239))+'\x20'+a26_0x5d2da8[_0x4a0c59(0x105)](formatRows(_0x549521['totalEvents']));}console[_0x4a0c59(0x1b2)](_0x296b30+'\x20'+a26_0x5d2da8['bold'](_0x549521[_0x4a0c59(0x1db)])+_0x348000),console[_0x4a0c59(0x1b2)]('\x20\x20'+a26_0x5d2da8['dim'](_0x4a0c59(0x1b9))+'\x20'+a26_0x5d2da8['bold'](_0x549521[_0x4a0c59(0x1f9)]+'.'+_0x549521[_0x4a0c59(0x1ae)]));const _0x1e7a24=_0x549521[_0x4a0c59(0x13e)]===_0x549521[_0x4a0c59(0x11f)]?a26_0x5d2da8['dim'](_0x4a0c59(0x15b))+'\x20'+_0x549521[_0x4a0c59(0x13e)]:a26_0x5d2da8['dim']('Join:')+'\x20'+_0x549521[_0x4a0c59(0x13e)]+'\x20=\x20'+_0x549521['foreignKey'];console['error']('\x20\x20'+_0x1e7a24),console['error']('\x20\x20'+a26_0x5d2da8[_0x4a0c59(0x20f)](_0x4a0c59(0x21b))),this[_0x4a0c59(0x153)](_0x549521[_0x4a0c59(0x19f)]),!_0x549521[_0x4a0c59(0x258)]&&console[_0x4a0c59(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4a0c59(0x19a)](_0x4a0c59(0xff))+'\x20'+_0x549521[_0x4a0c59(0x260)]);}}['displayColumns'](_0x368768){const _0xea4a99=a26_0x3ae22d;for(const _0x58f4f2 of _0x368768){_0x58f4f2[_0xea4a99(0x1eb)]===_0x58f4f2[_0xea4a99(0x1b1)]||_0x58f4f2[_0xea4a99(0x1b1)]==='*'?console[_0xea4a99(0x1b2)](_0xea4a99(0xec)+_0x58f4f2['label']):console[_0xea4a99(0x1b2)](_0xea4a99(0xec)+_0x58f4f2[_0xea4a99(0x1eb)]+'\x20'+a26_0x5d2da8[_0xea4a99(0x20f)]('('+_0x58f4f2[_0xea4a99(0x1b1)]+')'));}}[a26_0x3ae22d(0xef)](_0x186d53){const _0x390819=a26_0x3ae22d;console[_0x390819(0x1b2)]('─'[_0x390819(0x175)](0x3c));if(_0x186d53[_0x390819(0x1ea)]['length']>0x0){console[_0x390819(0x1b2)]('\x0a'+a26_0x5d2da8[_0x390819(0x19a)]('Errors:'));for(const _0x54573a of _0x186d53[_0x390819(0x1ea)]){console[_0x390819(0x1b2)]('\x20\x20'+a26_0x5d2da8['red']('•')+'\x20'+_0x54573a);}}_0x186d53[_0x390819(0x1e4)]&&console['error']('\x0a'+a26_0x5d2da8[_0x390819(0xe1)]('✔')+_0x390819(0x1d1));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x183);[a26_0x3ae22d(0x1a7)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x298801){const _0x3ed58a=a26_0x3ae22d,{options:_0x52dab0,args:_0x246460,tdx:_0x13b8e9}=_0x298801,_0x492bfd=_0x52dab0,_0x416203=_0x246460[0x0]||_0x52dab0[_0x3ed58a(0x255)];if(!_0x416203)return showParentSegmentNotSetError(_0x3ed58a(0x20e)+_0x3ed58a(0x261)+_0x3ed58a(0x240)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x3ed58a(0x1c3)+_0x3ed58a(0x20d)+_0x3ed58a(0x103)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x492bfd[_0x3ed58a(0x22a)]&&!_0x492bfd['attribute']&&!_0x492bfd['behavior']&&!_0x492bfd['enriched'])return console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x224)),console[_0x3ed58a(0x1b2)]('Options:'),console[_0x3ed58a(0x1b2)](_0x3ed58a(0xd9)),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x207)),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x1d2)),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x217)),0x1;const _0xe90b32=resolveYamlFile(_0x416203);if(!existsSync(_0xe90b32))return showFileNotFoundError(_0xe90b32,_0x416203),0x1;_0x492bfd['verbose']&&(console[_0x3ed58a(0x1b2)](_0x3ed58a(0x1e5)+_0x492bfd['site']),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x12d)+_0xe90b32));let _0x1edf61;try{_0x1edf61=readFileSync(_0xe90b32,'utf-8');}catch(_0x112d5b){const _0x2b15ce=_0x112d5b instanceof Error?_0x112d5b[_0x3ed58a(0x162)]:String(_0x112d5b);return console[_0x3ed58a(0x1b2)]('Error\x20reading\x20file:\x20'+_0x2b15ce),0x1;}let _0x2167b2;try{_0x2167b2=parseDef(_0x1edf61);}catch(_0x1463b6){const _0x13bee5=_0x1463b6 instanceof Error?_0x1463b6[_0x3ed58a(0x162)]:String(_0x1463b6);return console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)]('Error\x20parsing\x20YAML:\x20'+_0x13bee5)),0x1;}if(_0x492bfd['attribute']===!![]||_0x492bfd[_0x3ed58a(0x125)]===''){const _0x81a8a8=_0x2167b2[_0x3ed58a(0x17a)]?.[_0x3ed58a(0x243)](_0x4e6a66=>_0x4e6a66[_0x3ed58a(0x1db)])||[];if(_0x81a8a8['length']===0x0)console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x3ed58a(0x1b2)](a26_0x5d2da8['red'](_0x3ed58a(0x1fc))),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x185));for(const _0x3cae58 of _0x81a8a8){console[_0x3ed58a(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x3ed58a(0x105)](_0x3cae58));}console[_0x3ed58a(0x1b2)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x416203+_0x3ed58a(0x1bb)+_0x81a8a8[0x0]+'\x22');}return 0x1;}if(_0x492bfd[_0x3ed58a(0x180)]===!![]||_0x492bfd[_0x3ed58a(0x180)]===''){const _0x2efcdc=_0x2167b2[_0x3ed58a(0xdb)]?.[_0x3ed58a(0x243)](_0xfc23ba=>_0xfc23ba[_0x3ed58a(0x1db)])||[];if(_0x2efcdc['length']===0x0)console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)](_0x3ed58a(0x19b)));else{console[_0x3ed58a(0x1b2)](a26_0x5d2da8['red'](_0x3ed58a(0x1e8))),console[_0x3ed58a(0x1b2)]('Available\x20behaviors:');for(const _0x4b7104 of _0x2efcdc){console[_0x3ed58a(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x3ed58a(0x105)](_0x4b7104));}console[_0x3ed58a(0x1b2)](_0x3ed58a(0x184)+_0x416203+_0x3ed58a(0x10d)+_0x2efcdc[0x0]+'\x22');}return 0x1;}const _0x558bd2=createCommandSpinner(a26_0x5d2da8[_0x3ed58a(0x20f)](_0x3ed58a(0x234)),{'verbose':_0x492bfd['verbose']});_0x558bd2['start']();const _0x199174={'onProgress':_0x48e297=>{_0x558bd2['text']=formatProgressMessage(_0x48e297);}};if(_0x492bfd[_0x3ed58a(0x22a)])_0x199174[_0x3ed58a(0x22a)]=!![];if(_0x492bfd[_0x3ed58a(0x125)]&&typeof _0x492bfd[_0x3ed58a(0x125)]===_0x3ed58a(0x114))_0x199174['attribute']=_0x492bfd[_0x3ed58a(0x125)];if(_0x492bfd['behavior']&&typeof _0x492bfd['behavior']==='string')_0x199174[_0x3ed58a(0x180)]=_0x492bfd[_0x3ed58a(0x180)];if(_0x492bfd[_0x3ed58a(0x25b)])_0x199174[_0x3ed58a(0x25b)]=!![];if(_0x492bfd[_0x3ed58a(0x206)])_0x199174[_0x3ed58a(0x206)]=_0x492bfd[_0x3ed58a(0x206)];let _0x4d8890;try{_0x4d8890=await _0x13b8e9['segment'][_0x3ed58a(0x16c)](_0x1edf61,_0x199174),_0x558bd2[_0x3ed58a(0x1d3)]();}catch(_0x3aa93b){_0x558bd2[_0x3ed58a(0x1d3)]();throw _0x3aa93b;}return await this[_0x3ed58a(0x17d)](_0x4d8890,{'master':_0x492bfd[_0x3ed58a(0x22a)],'attribute':typeof _0x492bfd[_0x3ed58a(0x125)]===_0x3ed58a(0x114)?_0x492bfd[_0x3ed58a(0x125)]:undefined,'behavior':typeof _0x492bfd[_0x3ed58a(0x180)]===_0x3ed58a(0x114)?_0x492bfd[_0x3ed58a(0x180)]:undefined,'enriched':_0x492bfd[_0x3ed58a(0x25b)]}),_0x4d8890[_0x3ed58a(0x1e4)]?0x0:0x1;}async[a26_0x3ae22d(0x17d)](_0x5bd423,_0x3802ce){const _0x36c223=a26_0x3ae22d;console['error']('\x0a'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x36c223(0x24e))+'\x20'+_0x5bd423[_0x36c223(0x1db)]),console[_0x36c223(0x1b2)]('═'[_0x36c223(0x175)](0x3c));if(_0x3802ce[_0x36c223(0x22a)]&&_0x5bd423[_0x36c223(0x118)]){const _0x45ead0=a26_0x5d2da8['dim']('Master:')+'\x20'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x5bd423['master'][_0x36c223(0x1f9)]+'.'+_0x5bd423[_0x36c223(0x22a)]['table']);await this['displaySampleData'](_0x45ead0,_0x5bd423[_0x36c223(0x118)]);}else{if(_0x3802ce['attribute']&&_0x5bd423['sampleData']){const _0x422956=a26_0x5d2da8[_0x36c223(0x20f)]('Attribute:')+'\x20'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x3802ce['attribute']);await this[_0x36c223(0x1f4)](_0x422956,_0x5bd423[_0x36c223(0x118)]);}else{if(_0x3802ce[_0x36c223(0x180)]&&_0x5bd423['sampleData']){const _0x3a5d18=a26_0x5d2da8[_0x36c223(0x20f)](_0x36c223(0x119))+'\x20'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x3802ce[_0x36c223(0x180)]);await this[_0x36c223(0x1f4)](_0x3a5d18,_0x5bd423[_0x36c223(0x118)]);}else{if(_0x3802ce[_0x36c223(0x25b)]&&_0x5bd423['sampleData']){const _0x541933=a26_0x5d2da8[_0x36c223(0x20f)]('Enriched:')+'\x20'+a26_0x5d2da8['bold'](_0x36c223(0x16d));await this['displaySampleData'](_0x541933,_0x5bd423[_0x36c223(0x118)]);}else!_0x5bd423[_0x36c223(0x118)]&&console[_0x36c223(0x1b2)](_0x36c223(0x1ac));}}}if(_0x5bd423[_0x36c223(0x1ea)][_0x36c223(0x137)]>0x0){console['error']('─'[_0x36c223(0x175)](0x3c)),console[_0x36c223(0x1b2)]('\x0a'+a26_0x5d2da8[_0x36c223(0x19a)]('Errors:'));for(const _0x1ba6c8 of _0x5bd423[_0x36c223(0x1ea)]){console['error']('\x20\x20'+a26_0x5d2da8['red']('•')+'\x20'+_0x1ba6c8);}}}async['displaySampleData'](_0x1c9473,_0x1a228a){const _0x59e34f=a26_0x3ae22d;if(_0x1a228a[_0x59e34f(0x137)]===0x0){console[_0x59e34f(0x1b2)]('\x0a'+_0x1c9473),console[_0x59e34f(0x1b2)](_0x59e34f(0x178));return;}console['error']('\x0a'+_0x1c9473);const _0x264eec=Object[_0x59e34f(0x16a)](_0x1a228a[0x0])['map'](_0x59378d=>({'name':_0x59378d,'type':typeof _0x1a228a[0x0][_0x59378d]===_0x59e34f(0x1bc)?'double':_0x59e34f(0xf7)})),_0x183ef0={'queryId':_0x59e34f(0x14e),'columns':_0x264eec,'data':_0x1a228a,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1a228a[_0x59e34f(0x137)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2b3375=formatAsTable(_0x183ef0,_0x1a228a['length'],!![]);await writeOutput(_0x2b3375,undefined,_0x59e34f(0x1ae));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x23e);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x112);async[a26_0x3ae22d(0x129)](_0x12350f){const _0x2f29f9=a26_0x3ae22d,{options:_0x34c0e1,args:_0x46c96a,tdx:_0x21db51}=_0x12350f,_0x4d4591=_0x34c0e1,_0x5a5a9f=_0x46c96a[0x0]||_0x34c0e1[_0x2f29f9(0x255)];if(!_0x5a5a9f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x2f29f9(0x1ee)),0x1;const _0x1e17c1=resolveYamlFile(_0x5a5a9f);if(existsSync(_0x1e17c1)){_0x4d4591['verbose']&&console[_0x2f29f9(0x1b2)](_0x2f29f9(0x136)+_0x1e17c1);let _0x13c7fe;try{_0x13c7fe=readFileSync(_0x1e17c1,'utf-8');}catch(_0x23fbcc){const _0x265b52=_0x23fbcc instanceof Error?_0x23fbcc['message']:String(_0x23fbcc);return console[_0x2f29f9(0x1b2)]('Error\x20reading\x20file:\x20'+_0x265b52),0x1;}const _0x4deb70=await withSpinner(_0x2f29f9(0x246),()=>_0x21db51[_0x2f29f9(0x251)]['pushParentYaml'](_0x13c7fe),{'verbose':_0x4d4591['verbose']}),_0x4287eb=_0x4deb70[_0x2f29f9(0x230)],{isNew:_0x37decc,name:_0x4e323d,hasChanges:_0x32a75f,diffFormatted:_0x34fd5f}=_0x4287eb;if(_0x32a75f){_0x37decc?console['error'](_0x2f29f9(0x1c1)+_0x4e323d+'\x27:'):console[_0x2f29f9(0x1b2)](_0x2f29f9(0xdf)+_0x4e323d+'\x27:');console[_0x2f29f9(0x1b2)]('─'[_0x2f29f9(0x175)](0x3c)),console[_0x2f29f9(0x1b2)](_0x34fd5f),console['error']('─'[_0x2f29f9(0x175)](0x3c));const _0x7e2574=_0x37decc?'Create\x20parent\x20segment\x20\x27'+_0x4e323d+_0x2f29f9(0x205):_0x2f29f9(0x232)+_0x4e323d+'\x27\x20and\x20run\x20workflow?';if(!_0x4d4591[_0x2f29f9(0x225)]){if(!isInteractive())return console[_0x2f29f9(0x1b2)](a26_0x5d2da8[_0x2f29f9(0x19a)]('\x0aError:'),_0x2f29f9(0x192)),console['error'](a26_0x5d2da8[_0x2f29f9(0x20f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x6434b0=await confirmKey(_0x7e2574);if(!_0x6434b0)return console[_0x2f29f9(0x1b2)](a26_0x5d2da8[_0x2f29f9(0xe0)](_0x2f29f9(0x245))),0x1;}const _0x13782a=_0x37decc?_0x2f29f9(0x10c):_0x2f29f9(0x150);await withSpinner(_0x13782a+_0x2f29f9(0x202)+_0x4e323d+'\x27...',()=>_0x4287eb['apply'](),{'verbose':_0x4d4591[_0x2f29f9(0x228)]});const _0xa86343=_0x37decc?_0x2f29f9(0x1ab):_0x2f29f9(0x1ad);console[_0x2f29f9(0x1b2)]('✔\x20'+_0xa86343+_0x2f29f9(0x202)+_0x4e323d+'\x27');}else console['error'](_0x2f29f9(0x164)+_0x4e323d+_0x2f29f9(0x11c));}const _0x329e81=await withSpinner(_0x2f29f9(0xfc)+_0x5a5a9f+_0x2f29f9(0x1a3),()=>_0x21db51[_0x2f29f9(0x251)]['runParent'](_0x5a5a9f),{'verbose':_0x4d4591[_0x2f29f9(0x228)]}),_0x1c68dc=_0x329e81['data'],_0x24d28e=getConsoleUrl(_0x4d4591[_0x2f29f9(0x1e6)],'/app/workflows/'+_0x1c68dc['workflowId']+_0x2f29f9(0x1a1)+_0x1c68dc['workflowSessionId']+_0x2f29f9(0x11e)+_0x1c68dc['workflowAttemptId']);return console[_0x2f29f9(0x1b2)](_0x2f29f9(0xe4)),console[_0x2f29f9(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0x1dd))+'\x20'+_0x1c68dc[_0x2f29f9(0x1da)]),console[_0x2f29f9(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0x1f6))+'\x20'+_0x1c68dc[_0x2f29f9(0x1df)]),console['error']('\x20\x20'+a26_0x5d2da8['dim'](_0x2f29f9(0x23f))+'\x20'+_0x1c68dc[_0x2f29f9(0x1c9)]),console['error']('\x20\x20'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0xf5))+'\x20'+_0x1c68dc['workflowAttemptId']),console[_0x2f29f9(0x1b2)]('\x20\x20'+_0x24d28e),console[_0x2f29f9(0x1b2)]('\x0a'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0x189))+_0x2f29f9(0x1a8)+_0x1c68dc[_0x2f29f9(0x262)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0xf8);[a26_0x3ae22d(0x1a7)]='List\x20available\x20fields\x20for\x20segmentation';async[a26_0x3ae22d(0x129)](_0x2c4410){const _0x46d825=a26_0x3ae22d,{options:_0x4895ae,args:_0x241a92,tdx:_0x152737}=_0x2c4410,_0x1cbbd8=_0x241a92[0x0]||_0x4895ae[_0x46d825(0x255)];if(!_0x1cbbd8)return showParentSegmentNotSetError(_0x46d825(0x200)+_0x46d825(0x10b)),0x1;_0x4895ae[_0x46d825(0x228)]&&(console[_0x46d825(0x1b2)]('Site:\x20'+_0x4895ae['site']),console['error'](_0x46d825(0x186)+_0x1cbbd8));const _0x4559ca=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x1cbbd8+_0x46d825(0x1a3),()=>_0x152737[_0x46d825(0x251)]['listFields'](_0x1cbbd8),{'verbose':_0x4895ae[_0x46d825(0x228)]}),_0x29b226=_0x4559ca[_0x46d825(0x230)];console[_0x46d825(0x1b2)](_0x46d825(0x21d)+_0x29b226[_0x46d825(0x137)]+_0x46d825(0xf1)+(_0x29b226[_0x46d825(0x137)]!==0x1?'s':''));if(_0x4895ae[_0x46d825(0x25a)]||_0x4895ae['jsonl'])return await handleSDKOutput(_0x29b226,_0x4895ae),0x0;return displayFieldsHumanReadable(_0x29b226,_0x1cbbd8),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x23a);[a26_0x3ae22d(0x1a7)]='Show\x20parent\x20segment\x20details';async['execute'](_0x3ff969){const _0x4a86c4=a26_0x3ae22d,{options:_0x505aa0,args:_0x250c87,tdx:_0x9128ae}=_0x3ff969,_0x24513f=_0x505aa0,_0x52c888=_0x250c87[0x0]||_0x505aa0[_0x4a86c4(0x255)];if(!_0x52c888)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'+_0x4a86c4(0x265)+'Options:\x0a'+_0x4a86c4(0x24f)),0x1;_0x505aa0['verbose']&&(console['error']('Site:\x20'+_0x505aa0[_0x4a86c4(0x1e6)]),console[_0x4a86c4(0x1b2)]('Parent\x20segment:\x20'+_0x52c888));const _0x413fdd=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x52c888+_0x4a86c4(0x1a3),()=>_0x9128ae['segment'][_0x4a86c4(0x1a6)](_0x52c888),{'verbose':_0x505aa0[_0x4a86c4(0x228)]}),_0x24a432=_0x413fdd[_0x4a86c4(0x230)];if(_0x24513f[_0x4a86c4(0x134)]){const _0x1d624a=getConsoleNextUrl(_0x24513f[_0x4a86c4(0x1e6)],'/app/dw/parentSegments/'+_0x24a432['id']);return console[_0x4a86c4(0x1b2)](a26_0x5d2da8[_0x4a86c4(0xe1)]('✔')+'\x20Opening\x20'+a26_0x5d2da8['cyan'](_0x1d624a)),openBrowser(_0x1d624a),0x0;}return await handleSingleObjectOutput(_0x24a432,_0x505aa0),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x16f);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a26_0x3ae22d(0x129)](_0x4bdd7d){const _0x4541d3=a26_0x3ae22d,{options:_0xdb81a3,args:_0x151d24,tdx:_0x3f204f}=_0x4bdd7d,_0x1d1404=_0xdb81a3,_0x425be1=_0x151d24[0x0]||_0xdb81a3[_0x4541d3(0x255)];if(!_0x425be1)return showParentSegmentNotSetError(_0x4541d3(0x122)+_0x4541d3(0x1fa)+'Options:\x0a'+_0x4541d3(0xdd)),0x1;_0xdb81a3[_0x4541d3(0x228)]&&(console['error'](_0x4541d3(0x1e5)+_0xdb81a3['site']),console[_0x4541d3(0x1b2)](_0x4541d3(0x186)+_0x425be1));const _0x7991c6=await withSpinner(_0x4541d3(0x1b8)+_0x425be1+_0x4541d3(0x1a3),()=>_0x3f204f[_0x4541d3(0x251)][_0x4541d3(0x1ce)](_0x425be1),{'verbose':_0xdb81a3['verbose']}),_0x46cfba=_0x7991c6['data'],_0x33dfbc=_0x3f204f[_0x4541d3(0x251)][_0x4541d3(0x211)](_0x46cfba);if(_0x1d1404[_0x4541d3(0x10e)]){const _0xe43200=await this[_0x4541d3(0x24b)](_0x4bdd7d,_0x425be1,_0x46cfba,_0x33dfbc),_0x38d735=this[_0x4541d3(0x130)](_0xe43200);writeFileSync(_0x1d1404['output'],_0x38d735);const _0x2fa3da=_0xe43200['customers'][_0x4541d3(0x19f)][_0x4541d3(0x137)]+_0xe43200['behaviors'][_0x4541d3(0x220)]((_0xf49524,_0x5e5d41)=>_0xf49524+_0x5e5d41[_0x4541d3(0x19f)][_0x4541d3(0x137)],0x0),_0x1aa24c=_0xe43200[_0x4541d3(0xdb)]['filter'](_0x3e7d50=>_0x3e7d50[_0x4541d3(0x19f)]['length']===0x0)[_0x4541d3(0x137)];return console[_0x4541d3(0x263)](_0x4541d3(0x201)+_0x1d1404['output']),console[_0x4541d3(0x263)]('\x20\x20Database:\x20'+_0x33dfbc),console['log'](_0x4541d3(0x139)+_0xe43200[_0x4541d3(0xdb)]['length']+'\x20behaviors'),console[_0x4541d3(0x263)](_0x4541d3(0xe3)+_0x2fa3da+_0x4541d3(0x12f)),_0x1aa24c>0x0&&console[_0x4541d3(0x263)]('\x20\x20Note:\x20'+_0x1aa24c+_0x4541d3(0xd7)),0x0;}console[_0x4541d3(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4541d3(0x1c7)](_0x4541d3(0xe5))+'\x20'+a26_0x5d2da8[_0x4541d3(0x105)](_0x33dfbc));const _0x101a3c=await withSpinner(_0x4541d3(0x1fe),()=>_0x3f204f[_0x4541d3(0x251)]['getParentSQL'](_0x46cfba),{'verbose':_0xdb81a3[_0x4541d3(0x228)]});console[_0x4541d3(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4541d3(0x1c7)](_0x4541d3(0xf9))+'\x20'+a26_0x5d2da8[_0x4541d3(0x20f)]('('+_0x33dfbc+'.customers)'));const _0x131d2f=await executeSchemaQuery(_0x101a3c['data'],_0x3f204f,_0xdb81a3);await handleQueryOutput(_0x131d2f,_0xdb81a3);const _0x44b5da=await withSpinner(_0x4541d3(0x1f5),()=>_0x3f204f['segment'][_0x4541d3(0x106)](_0x46cfba),{'verbose':_0xdb81a3[_0x4541d3(0x228)]});for(const _0x26b03b of _0x44b5da[_0x4541d3(0x230)]){const _0x39faba=_0x4541d3(0x138)+_0x26b03b[_0x4541d3(0x222)]()['replace'](/\s+/g,'_'),_0x1e4678='SELECT\x20*\x20FROM\x20'+_0x33dfbc+'.'+_0x39faba;console[_0x4541d3(0x1b2)]('\x0a'+a26_0x5d2da8['bold'](_0x26b03b)+'\x20'+a26_0x5d2da8[_0x4541d3(0x20f)]('('+_0x33dfbc+'.'+_0x39faba+')'));try{const _0x33d35d=await executeSchemaQuery(_0x1e4678,_0x3f204f,_0xdb81a3);await handleQueryOutput(_0x33d35d,_0xdb81a3);}catch{console[_0x4541d3(0x1b2)](a26_0x5d2da8[_0x4541d3(0xe0)](_0x4541d3(0x173)));}}return 0x0;}async['collectSchema'](_0x498499,_0x3c0153,_0xc8d586,_0x742999){const _0x455db2=a26_0x3ae22d,{options:_0x47e187,tdx:_0x1d28ce}=_0x498499,_0x4705bc=await withSpinner(_0x455db2(0x1fe),()=>_0x1d28ce[_0x455db2(0x251)][_0x455db2(0x1c2)](_0xc8d586),{'verbose':_0x47e187['verbose']}),_0x124f11=await executeSchemaQuery(_0x4705bc[_0x455db2(0x230)],_0x1d28ce,_0x47e187),_0x546cea=_0x124f11[_0x455db2(0x230)]['map'](_0x2524df=>({'name':_0x2524df[_0x455db2(0x165)],'type':_0x2524df['column_type']})),_0x38e38c=await withSpinner(_0x455db2(0x1f5),()=>_0x1d28ce['segment']['getBehaviorNames'](_0xc8d586),{'verbose':_0x47e187[_0x455db2(0x228)]}),_0x4369a5=[];for(const _0x1979f9 of _0x38e38c[_0x455db2(0x230)]){const _0x5378bf='behavior_'+_0x1979f9[_0x455db2(0x222)]()[_0x455db2(0x121)](/\s+/g,'_'),_0x32ef3e=_0x455db2(0x170)+_0x742999+'.'+_0x5378bf;let _0x3f32d2=[];try{const _0x16dbb3=await executeSchemaQuery(_0x32ef3e,_0x1d28ce,_0x47e187);_0x3f32d2=_0x16dbb3['data'][_0x455db2(0x243)](_0x33c5bf=>({'name':_0x33c5bf[_0x455db2(0x165)],'type':_0x33c5bf[_0x455db2(0x17f)]}));}catch{}_0x4369a5[_0x455db2(0x11b)]({'table':_0x5378bf,'columns':_0x3f32d2});}return{'database':_0x742999,'parent_segment':_0x3c0153,'parent_id':_0xc8d586,'customers':{'table':_0x455db2(0xf9),'columns':_0x546cea},'behaviors':_0x4369a5};}[a26_0x3ae22d(0x130)](_0x5dcc80){const _0x4ff01e=a26_0x3ae22d,_0x1dd224=_0x500b90=>{const _0x10bba9=a26_0x1528;if(_0x500b90[_0x10bba9(0x137)]===0x0)return'[]';const _0x4c2a73=_0x500b90[_0x10bba9(0x243)](_0x598033=>_0x10bba9(0x20a)+_0x598033['name']+_0x10bba9(0x15e)+_0x598033['type']+_0x10bba9(0x203));return'[\x0a'+_0x4c2a73[_0x10bba9(0x1b5)](',\x0a')+_0x10bba9(0x13d);},_0xaab6ea=_0x5dcc80['behaviors']['map'](_0x15623d=>{const _0x2d73dd=a26_0x1528;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x15623d[_0x2d73dd(0x1ae)]+_0x2d73dd(0x199)+_0x1dd224(_0x15623d[_0x2d73dd(0x19f)])[_0x2d73dd(0x121)](/^/gm,'\x20\x20')['trim']()+_0x2d73dd(0x197);})[_0x4ff01e(0x1b5)](',\x0a');return _0x4ff01e(0x142)+_0x5dcc80[_0x4ff01e(0x1f9)]+_0x4ff01e(0x166)+_0x5dcc80[_0x4ff01e(0x250)]+_0x4ff01e(0x147)+_0x5dcc80['parent_id']+_0x4ff01e(0x22d)+_0x5dcc80['customers'][_0x4ff01e(0x1ae)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x1dd224(_0x5dcc80[_0x4ff01e(0xf9)]['columns'])['replace'](/^/gm,'\x20\x20')[_0x4ff01e(0x157)]()+_0x4ff01e(0x169)+_0xaab6ea+_0x4ff01e(0x196);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x1b4);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1bd);async[a26_0x3ae22d(0x129)](_0x271396){const _0x184535=a26_0x3ae22d,{options:_0x1f088d,args:_0x2bc9bf,tdx:_0x3f977f}=_0x271396,_0x418801=_0x2bc9bf[0x0]||_0x1f088d[_0x184535(0x255)];if(!_0x418801)return showParentSegmentNotSetError(_0x184535(0x101)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x1f088d[_0x184535(0x228)]&&(console[_0x184535(0x1b2)](_0x184535(0x1e5)+_0x1f088d[_0x184535(0x1e6)]),console[_0x184535(0x1b2)](_0x184535(0x186)+_0x418801));const _0xd944b1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x418801+_0x184535(0x1a3),()=>_0x3f977f[_0x184535(0x251)]['resolveParentId'](_0x418801),{'verbose':_0x1f088d[_0x184535(0x228)]}),_0x4dad97=_0xd944b1[_0x184535(0x230)],_0x591ff4=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x418801+_0x184535(0x1a3),()=>_0x3f977f[_0x184535(0x251)]['getParentSQL'](_0x4dad97),{'verbose':_0x1f088d[_0x184535(0x228)]}),_0x4ed67d=_0x591ff4[_0x184535(0x230)];return _0x1f088d[_0x184535(0x210)]===_0x184535(0x25a)||_0x1f088d[_0x184535(0x210)]===_0x184535(0x117)?await handleSDKOutput([{'sql':_0x4ed67d}],_0x1f088d):console[_0x184535(0x263)](_0x4ed67d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x179);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1d5);async['execute'](_0x511ba1){const _0x2bea35=a26_0x3ae22d,{options:_0x3b91d5,args:_0x28b3b4,tdx:_0x4330c9}=_0x511ba1,_0x30cacb=_0x28b3b4[0x0]||_0x3b91d5[_0x2bea35(0x255)];if(!_0x30cacb)return showParentSegmentNotSetError(_0x2bea35(0x17b)+'\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;_0x3b91d5[_0x2bea35(0x228)]&&(console[_0x2bea35(0x1b2)]('Site:\x20'+_0x3b91d5[_0x2bea35(0x1e6)]),console['error']('Parent\x20segment:\x20'+_0x30cacb));const _0x47b6e3=await withSpinner(_0x2bea35(0x1b8)+_0x30cacb+_0x2bea35(0x1a3),()=>_0x4330c9[_0x2bea35(0x251)][_0x2bea35(0x1ce)](_0x30cacb),{'verbose':_0x3b91d5[_0x2bea35(0x228)]}),_0x3aaa7b=_0x47b6e3[_0x2bea35(0x230)],_0x45d873=await withSpinner(_0x2bea35(0x172)+_0x30cacb+_0x2bea35(0x1a3),()=>_0x4330c9[_0x2bea35(0x251)][_0x2bea35(0x1c2)](_0x3aaa7b),{'verbose':_0x3b91d5['verbose']});let _0x458a5d=_0x45d873[_0x2bea35(0x230)];const _0x22a2c6=resolveLimit(_0x3b91d5[_0x2bea35(0xf3)],DEFAULT_DISPLAY_LIMIT),_0x5c69ce=/\bLIMIT\s+\d+/i['test'](_0x458a5d);!_0x5c69ce&&(_0x458a5d=_0x458a5d['trim']()[_0x2bea35(0x121)](/;+$/,''),_0x458a5d=_0x2bea35(0x1cc)+_0x458a5d+_0x2bea35(0x133)+_0x22a2c6);_0x3b91d5[_0x2bea35(0x228)]&&console[_0x2bea35(0x1b2)]('SQL\x20query:\x0a'+_0x458a5d);const _0x2f7295=await withProgressSpinner(_0x2bea35(0xde),async _0x49cb35=>{const _0x2c08a9=_0x2bea35,_0x164490=await _0x4330c9[_0x2c08a9(0x1cb)]['execute'](_0x458a5d,{'catalog':'td','schema':_0x2c08a9(0x193),'onJobId':_0x4d3af7=>{const _0x326cda=_0x2c08a9;_0x49cb35[_0x326cda(0x24a)](_0x4d3af7);}});return _0x164490;},{'verbose':_0x3b91d5['verbose']}),_0x16c1ee=_0x2f7295['data'],_0x68eb87=_0x16c1ee[_0x2bea35(0x19d)]?_0x2bea35(0x1f3)+_0x16c1ee[_0x2bea35(0x19d)]+']':'';return console[_0x2bea35(0x1b2)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x16c1ee[_0x2bea35(0x1ed)][_0x2bea35(0x1d4)][_0x2bea35(0x1fb)]()+_0x2bea35(0x20c)+(_0x2bea35(0x159)+formatElapsed(_0x16c1ee[_0x2bea35(0x1ed)][_0x2bea35(0xd6)])+_0x68eb87)),await handleQueryOutput(_0x16c1ee,_0x3b91d5),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a26_0x3ae22d(0x156);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x204);async[a26_0x3ae22d(0x129)](_0x2b1704){const _0x171083=a26_0x3ae22d,{options:_0x415f52,args:_0x4a02ab,tdx:_0x133bc3}=_0x2b1704,_0x4a2d51=_0x4a02ab[0x0],_0x21899f=await withSpinner(_0x4a2d51?_0x171083(0x1f2)+_0x4a2d51+_0x171083(0x1a3):_0x171083(0x1ec),()=>_0x133bc3[_0x171083(0x1b0)][_0x171083(0x167)](),{'verbose':_0x415f52['verbose']});let _0x2d3494=_0x21899f[_0x171083(0x230)][_0x171083(0x221)](_0x5157e7=>_0x5157e7[_0x171083(0x17e)]);if(_0x4a2d51){const _0x854ccf=_0x4a2d51['replace'](/[.+^${}()|[\]\\]/g,_0x171083(0x135))[_0x171083(0x121)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x46749f=new RegExp('^'+_0x854ccf+'$','i');_0x2d3494=_0x2d3494[_0x171083(0x221)](_0x295685=>_0x46749f[_0x171083(0x1a2)](_0x295685[_0x171083(0x1db)]));}_0x2d3494[_0x171083(0x256)]((_0x23b87b,_0x11e62b)=>_0x23b87b[_0x171083(0x1db)][_0x171083(0x13f)](_0x11e62b[_0x171083(0x1db)])),console[_0x171083(0x1b2)](_0x171083(0x21d)+_0x2d3494[_0x171083(0x137)]+_0x171083(0x1a0)+(_0x2d3494[_0x171083(0x137)]!==0x1?'s':''));const _0x376ea1=_0x688d28=>{const _0x50411a=_0x171083;return getConsoleNextUrl(_0x415f52['site'],_0x50411a(0x18b)+_0x688d28);};if(_0x415f52['format']===_0x171083(0x25a)||_0x415f52[_0x171083(0x210)]===_0x171083(0x117)){const _0x159ff=_0x2d3494['map'](_0x357bdd=>({..._0x357bdd,'url':_0x376ea1(_0x357bdd['id'])}));await handleSDKOutput(_0x159ff,_0x415f52);}else{if(_0x2d3494[_0x171083(0x137)]===0x0)console[_0x171083(0x263)](_0x171083(0x195));else for(const _0x148b1a of _0x2d3494){const _0x248b5a=_0x148b1a[_0x171083(0x22c)]?a26_0x5d2da8[_0x171083(0x20f)]('\x20('+formatRows(_0x148b1a[_0x171083(0x22c)])+')'):'',_0x1e08c3=hyperlink(_0x148b1a[_0x171083(0x1db)],_0x376ea1(_0x148b1a['id']));console[_0x171083(0x263)]('⚡\x20'+_0x1e08c3+_0x248b5a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x1d6);[a26_0x3ae22d(0x1a7)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a26_0x3ae22d(0x129)](_0x1e9cbe){const _0x2c75f2=a26_0x3ae22d,{options:_0x1639e1,args:_0xabb702,tdx:_0x2369eb}=_0x1e9cbe,_0x1fcf5d=_0xabb702[0x0]||_0x1639e1[_0x2c75f2(0x255)];if(!_0x1fcf5d)return showParentSegmentNotSetError(_0x2c75f2(0x215)+_0x2c75f2(0x21a)),0x1;const _0x20051b=resolveYamlFile(_0x1fcf5d);if(!existsSync(_0x20051b))return showFileNotFoundError(_0x20051b,_0x1fcf5d),0x1;let _0x222be9;try{_0x222be9=readFileSync(_0x20051b,_0x2c75f2(0x18c));}catch(_0x4ee3df){const _0xe88cb5=_0x4ee3df instanceof Error?_0x4ee3df[_0x2c75f2(0x162)]:String(_0x4ee3df);return console['error']('Error\x20reading\x20file:\x20'+_0xe88cb5),0x1;}const _0x36eacb=createCommandSpinner(a26_0x5d2da8['dim'](_0x2c75f2(0x132)),{'verbose':_0x1639e1[_0x2c75f2(0x228)]});_0x36eacb[_0x2c75f2(0x21e)]();const _0x4c8d76={'realtime':!![],'onProgress':_0x417c4f=>{const _0x340cb0=_0x2c75f2;_0x36eacb[_0x340cb0(0x194)]=formatProgressMessage(_0x417c4f);}};let _0x416889;try{_0x416889=await _0x2369eb[_0x2c75f2(0x251)]['validateParentYaml'](_0x222be9,_0x4c8d76),_0x36eacb[_0x2c75f2(0x1d3)]();}catch(_0x408d61){_0x36eacb[_0x2c75f2(0x1d3)]();throw _0x408d61;}console[_0x2c75f2(0x1b2)]('\x0a'+a26_0x5d2da8[_0x2c75f2(0x1c7)](_0x2c75f2(0x11a))+'\x20'+_0x416889['name']),console[_0x2c75f2(0x1b2)]('═'[_0x2c75f2(0x175)](0x3c)),displayRealtimeValidation(_0x416889),console['error']('─'['repeat'](0x3c));if(_0x416889[_0x2c75f2(0x1ea)][_0x2c75f2(0x137)]>0x0){console['error']('\x0a'+a26_0x5d2da8[_0x2c75f2(0x19a)](_0x2c75f2(0x187)));for(const _0x9803e7 of _0x416889['errors']){console[_0x2c75f2(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x2c75f2(0x19a)]('•')+'\x20'+_0x9803e7);}}return _0x416889[_0x2c75f2(0x1e4)]&&console[_0x2c75f2(0x1b2)]('\x0a'+a26_0x5d2da8[_0x2c75f2(0xe1)]('✔')+_0x2c75f2(0x236)),_0x416889[_0x2c75f2(0x1e4)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x1a4);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x252);async[a26_0x3ae22d(0x129)](_0x400dc1){const _0x5dbce5=a26_0x3ae22d,{options:_0x468822,args:_0x5d921f,tdx:_0x395047}=_0x400dc1,_0x30df4f=_0x5d921f[0x0]||_0x468822[_0x5dbce5(0x255)];if(!_0x30df4f)return showParentSegmentNotSetError(_0x5dbce5(0x1f0)+_0x5dbce5(0xeb)),0x1;const _0x28ef6a=await withSpinner(_0x5dbce5(0x1b8)+_0x30df4f+_0x5dbce5(0x1a3),()=>_0x395047[_0x5dbce5(0x251)]['resolveParentId'](_0x30df4f),{'verbose':_0x468822[_0x5dbce5(0x228)]}),_0x45c500=_0x28ef6a[_0x5dbce5(0x230)],_0x2104c4=await withSpinner(_0x5dbce5(0x160)+_0x30df4f+_0x5dbce5(0x1a3),()=>_0x395047[_0x5dbce5(0x1f1)][_0x5dbce5(0x167)](_0x45c500),{'verbose':_0x468822[_0x5dbce5(0x228)]}),_0x33b4dc=_0x2104c4[_0x5dbce5(0x230)];console[_0x5dbce5(0x1b2)](_0x5dbce5(0x21d)+_0x33b4dc[_0x5dbce5(0x137)]+_0x5dbce5(0x249)+(_0x33b4dc['length']!==0x1?'s':''));if(_0x468822[_0x5dbce5(0x210)]===_0x5dbce5(0x25a)||_0x468822['format']===_0x5dbce5(0x117))await handleSDKOutput(_0x33b4dc,_0x468822);else{if(_0x33b4dc[_0x5dbce5(0x137)]===0x0)console[_0x5dbce5(0x263)](_0x5dbce5(0xea)),console[_0x5dbce5(0x1b2)](a26_0x5d2da8['cyan']('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x2ec271 of _0x33b4dc){const _0x7278b3=_0x2ec271['sections']?.[_0x5dbce5(0x137)]||0x0,_0xbbc733=_0x2ec271[_0x5dbce5(0x253)]?a26_0x5d2da8[_0x5dbce5(0x20f)](_0x5dbce5(0x1b3)+_0x2ec271[_0x5dbce5(0x253)]):'',_0xb36246=a26_0x5d2da8[_0x5dbce5(0x20f)]('\x20('+_0x7278b3+_0x5dbce5(0x100)+(_0x7278b3!==0x1?'s':'')+')');console[_0x5dbce5(0x263)]('\x20\x20'+_0x2ec271['name']+_0xbbc733+_0xb36246),_0x2ec271[_0x5dbce5(0x1a7)]&&console[_0x5dbce5(0x263)]('\x20\x20\x20\x20'+a26_0x5d2da8['dim'](_0x2ec271['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a26_0x3ae22d(0x1bf);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1d9);async['execute'](_0x2d72ea){const _0x215cf8=a26_0x3ae22d,{options:_0x4e06e1,args:_0x4a0983}=_0x2d72ea,_0x231664=_0x4a0983[0x0]||_0x4e06e1['parentSegment'];if(!_0x231664)return showParentSegmentNotSetError('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'+_0x215cf8(0x233)),0x1;const _0x49a5fa=resolveYamlFile(_0x231664);if(!existsSync(_0x49a5fa))return showFileNotFoundError(_0x49a5fa,_0x231664),0x1;let _0x4a4342;try{_0x4a4342=readFileSync(_0x49a5fa,_0x215cf8(0x18c));}catch(_0x3c3821){const _0x13d7b8=_0x3c3821 instanceof Error?_0x3c3821[_0x215cf8(0x162)]:String(_0x3c3821);return console[_0x215cf8(0x1b2)]('Error\x20reading\x20file:\x20'+_0x13d7b8),0x1;}let _0x105d4e;try{_0x105d4e=parseDef(_0x4a4342);}catch(_0x17bfcf){const _0x5c8000=_0x17bfcf instanceof Error?_0x17bfcf[_0x215cf8(0x162)]:String(_0x17bfcf);return console['error'](a26_0x5d2da8[_0x215cf8(0x19a)]('Error\x20parsing\x20YAML:\x20'+_0x5c8000)),0x1;}if(_0x105d4e[_0x215cf8(0x257)]&&_0x105d4e[_0x215cf8(0x257)][_0x215cf8(0x137)]>0x0)return console['error'](a26_0x5d2da8[_0x215cf8(0xe0)](_0x215cf8(0x22b)+_0x49a5fa)),console['error'](a26_0x5d2da8[_0x215cf8(0x20f)](_0x215cf8(0x13c)+_0x105d4e[_0x215cf8(0x257)][_0x215cf8(0x137)]+'\x20service(s)\x20configured')),0x1;!_0x105d4e[_0x215cf8(0x1b0)]&&(_0x105d4e['realtime']={'events':[{'name':_0x215cf8(0x216),'source_table':'<database>.<table>'}],'attributes':[{'name':'last_page_viewed','type':_0x215cf8(0xf2)}],'id_stitching':{'primary_key':_0x105d4e[_0x215cf8(0x22a)][_0x215cf8(0x1ae)]===_0x215cf8(0xf9)?_0x215cf8(0x23b):_0x215cf8(0x20b)}});_0x105d4e['personalization_services']=[{'name':_0x215cf8(0x198),'description':'Personalization\x20service\x20description','trigger_event':_0x215cf8(0x216),'sections':[{'name':_0x215cf8(0x19c),'criteria':_0x215cf8(0x14c),'attributes':['last_page_viewed']}]}];const _0x568515=serializeDef(_0x105d4e);return writeFileSync(_0x49a5fa,_0x568515,_0x215cf8(0x18c)),console[_0x215cf8(0x1b2)](a26_0x5d2da8[_0x215cf8(0xe1)]('✔')+_0x215cf8(0x22e)+a26_0x5d2da8[_0x215cf8(0x105)](_0x49a5fa)),(!_0x105d4e[_0x215cf8(0x1b0)]||_0x4a4342['indexOf'](_0x215cf8(0x1e3))===-0x1)&&console[_0x215cf8(0x1b2)](a26_0x5d2da8['green']('✔')+_0x215cf8(0x1d8)),console[_0x215cf8(0x1b2)]('\x0a'+a26_0x5d2da8[_0x215cf8(0x20f)](_0x215cf8(0x11d))),console[_0x215cf8(0x1b2)](_0x215cf8(0x209)+_0x49a5fa+_0x215cf8(0x1c6)),console[_0x215cf8(0x1b2)]('\x20\x202.\x20Run\x20'+a26_0x5d2da8[_0x215cf8(0x20f)](_0x215cf8(0x21f)+_0x231664)+_0x215cf8(0x1e0)),0x0;}}
|
|
1
|
+
const a26_0x1d7ac4=a26_0x27f2;(function(_0x3e342b,_0x35c916){const _0x409c32=a26_0x27f2,_0x29f7a6=_0x3e342b();while(!![]){try{const _0x7d58fa=-parseInt(_0x409c32(0x209))/0x1+-parseInt(_0x409c32(0xe3))/0x2+parseInt(_0x409c32(0x1b6))/0x3+-parseInt(_0x409c32(0x1df))/0x4+-parseInt(_0x409c32(0x1a8))/0x5+-parseInt(_0x409c32(0x1b8))/0x6+-parseInt(_0x409c32(0x117))/0x7*(-parseInt(_0x409c32(0x182))/0x8);if(_0x7d58fa===_0x35c916)break;else _0x29f7a6['push'](_0x29f7a6['shift']());}catch(_0x3eb81c){_0x29f7a6['push'](_0x29f7a6['shift']());}}}(a26_0x1087,0xe7312));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x56e348 from'path';import{BaseCommand}from'./command.js';function a26_0x1087(){const _0x3ab5cf=['FINISHED','in\x20','Listing\x20parent\x20segments...','Attribute:','Analyzing\x20changes...','\x20service(s)\x20configured','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Table:\x20','jsonl','map','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','yellow','Updating\x20parent\x20segment\x20\x27','Output\x20file:\x20','realtime:','Fetching\x20behavior\x20list...','\x20[Job\x20ID:\x20','toLocaleString','column_type','idStitching','Listing\x20RT-enabled\x20parent\x20segments...','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20parent\x20segment\x20\x27','`\x20to\x20download\x20the\x20configuration\x20first','displaySampleData','column','Events:','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Fetching\x20parent\x20segment\x20\x27','toLowerCase','joinKey','match','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20\x201.\x20Edit\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','customersWithEvents','audienceId','\x0aChanges\x20to\x20\x27','✔\x20Updated\x20parent\x20segment\x20\x27','population','segment:parent:preview','totalEvents','data','RT\x202.0:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','validateParentYaml','setJobId','\x0a✔\x20Workflow\x20started','\x20\x20Tables:\x201\x20customers\x20+\x20','Updated','replace','segment:parent:desc','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','user_id','Fetching\x20current\x20configuration\x20for\x20\x27','behavior_','Enriched:','page_view','displayPreviewResults','execute','\x20is\x20already\x20up\x20to\x20date','formatSchemaJson','\x5c$&','workflowId','\x27...','addBehaviorsFile','Join:','sourceTableError','output','filter','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','parentSegment','\x20section','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','.yaml','\x20rows\x20','\x20configured','name','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20+\x20[','8664lBwXjR','run','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','ps:pz:list','\x20Opening\x20','\x20\x20Columns:\x20','localeCompare','\x27\x20with\x20ID:\x20','text','behaviors','\x20personalization\x20service','schemaValid','collectSchema','\x20Added\x20RT\x202.0\x20template\x20section','Parent\x20segment:\x20','YAML\x20file:\x20','displayRealtimeInfo','Behavior:','displayBehaviorsStats','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','events','stop','realtime_enabled','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','true','{\x0a\x20\x20\x22database\x22:\x20\x22','interval','columns','To\x20view\x20sample\x20data:','\x0a\x20\x20\x20\x20]','join','scheduleOption','Create\x20parent\x20segment\x20\x27','schemaError','unref','foreignKey','resolveParentId','63760rkPeWg','%)\x20','\x20\x20No\x20sample\x20data\x20available','personalization_services','Options\x20(one\x20required):\x0a','repeat','/{name}.yml\x0a','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','displayAttributesStats','\x22,\x20\x22type\x22:\x20\x22','displayMasterInfo','\x20field','cyan','open','2303805KZEIuj','/app/dw/parentSegments/','3001524BbytgK','segment:parent:update','ID\x20Stitching:','Schema\x20saved\x20to\x20','List\x20parent\x20segments','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20','Fetching\x20SQL\x20for\x20\x27','Preview:','trigger_event','Created','displayPreviewHints','Name:\x20','getBehaviorNames','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','primaryKey','segment','runParent','✔\x20Renamed\x20directory\x20to\x20','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','SELECT\x20*\x20FROM\x20(\x0a','jobId','-1d','xdg-open','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','sections','Output\x20Database:','Validating\x20configuration...','Error:\x20File\x20not\x20found:\x20','segment:parent:push','darwin','\x22\x20}','site','tdx\x20ps\x20preview\x20','Validating\x20RT\x20configuration...','\x20No\x20changes\x20-\x20','double','addBehaviors','5792488bNbfPj','workflowAttemptId','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\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','single','dirname','web','\x0aNew\x20parent\x20segment\x20\x27','⚡\x20Enabled','dim','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20tdx\x20wf\x20attempt\x20','workflowSessionId','ps:rt:validate','getParentFull','all','No\x20personalization\x20services\x20configured','Creating','using\x20the\x20default\x20path:\x20','matchedCount','toFixed','segment:parent:list','Error\x20parsing\x20YAML:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','elapsedTimeMillis','\x20to\x20configure\x20your\x20personalization\x20service','\x20\x202.\x20Run\x20','✔\x20Found\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20RT\x20configuration\x20is\x20valid','.customers)','\x20--behavior\x20\x22','customerGroup','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','No\x20RT-enabled\x20parent\x20segments\x20found','<database>.<table>','\x20\x20\x20','Database:\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','ps:rt:list','/app/workflows/','scheduleType','1180289fAwtwf','attribute','last_page_viewed','behavior','Attempt:','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','No\x20parent\x20segments\x20match\x20pattern:\x20','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20kill','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','trim','bold','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','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Listing\x20personalization\x20services\x20for\x20\x27','Aborted.','\x20trigger=','\x27\x20is\x20already\x20up\x20to\x20date','\x20--enriched','stitchingKeys','coveragePercent','\x0aUsage:\x20tdx\x20ps\x20preview\x20','log','Attributes:','\x20parent\x20segment','SELECT\x20*\x20FROM\x20','\x20behaviors','Site:\x20','Listing\x20fields\x20for\x20\x27','\x20=\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','customerPercent','\x0a⚠️\x20\x20Both\x20','type','.yml','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','parent_segment','To\x20cancel:','Default','Master:','displayValidateResults','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Overwrite\x20\x27','timezone','Rows:','getParentSQL','Errors:','message','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x0aError:','Master\x20Table','parent_segments','\x0a\x20\x20]\x0a}\x0a','\x20Configuration\x20is\x20valid','verbose','\x0aNo\x20sample\x20data\x20available','status','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','/\x20and\x20','yes','segment:parent:fields','Available\x20attributes:','/\x20→\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Audience\x20ID:','column_name','format','displaySummary','Behaviors','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20\x20\x20\x20\x20\x20','Options:\x0a','Attributes','customers','pushParentYaml','rowCount','attributes','Resolving\x20parent\x20segment\x20\x27','segment:parent:create','👥\x20','\x20total','Session:','personalizationServices','List\x20available\x20fields\x20for\x20segmentation','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','length','\x20--attribute\x20\x22','previewParentYaml','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','createParent','label','✘\x20Failed\x20to\x20rename\x20directory:\x20','json','errors','stats','\x20\x20\x20\x20-\x20','red','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Columns:','limit','database','\x20to\x20push\x20the\x20configuration','SQL\x20query:\x0a','3173258PkjGFL','\x20rows)','keys','information_schema','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','listFields','description','utf-8','Status:','td_client_id','master','Apply\x20changes\x20to\x20\x27','Source:','isDirectory','segment:parent:show','realtime','addAttributes','allValid','Pattern:\x20','\x20Added\x20personalization\x20template\x20to\x20','Show\x20parent\x20segment\x20details','valid','varchar','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','green','enriched','segment:parent:validate','\x20\x20Note:\x20','/attempt/','\x20RT-enabled\x20parent\x20segment','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','segment:parent:sql','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','test','sampleData','Error:\x20Parent\x20segment\x20name\x20is\x20required','listParents','Fetching\x20sample\x20data...','Next\x20steps:','/sessions/','Join\x20on:','customerGroupFile','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','pullParentYaml','getOutputDatabaseName','\x20service','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Updating','Master\x20+\x20Attributes','31717cBkEKG','displayColumns','Error:','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','No\x20parent\x20segments\x20found','Customers:','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','string','error','addAttributesFile','\x27\x20is\x20up\x20to\x20date','Fetching\x20customers\x20schema...','✔\x20Query\x20completed:\x20Processed\x20','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','endsWith','✔\x20No\x20changes\x20-\x20\x27','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','start','table','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error\x20reading\x20file:\x20','list','RT\x202.0\x20Validate:'];a26_0x1087=function(){return _0x3ab5cf;};return a26_0x1087();}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 a26_0xa1756e 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=a26_0x1d7ac4(0xaf),LEGACY_PARENT_SEGMENT_DIR=a26_0x1d7ac4(0xa0);function openBrowser(_0x4dd52d){const _0x5cfa25=a26_0x1d7ac4,_0xb29e4=process['platform'],_0x210464=_0xb29e4===_0x5cfa25(0x1d7)?_0x5cfa25(0x1b5):_0xb29e4==='win32'?_0x5cfa25(0x12a):_0x5cfa25(0x1cf);spawn(_0x210464,[_0x4dd52d],{'detached':!![],'stdio':'ignore'})[_0x5cfa25(0x1a5)]();}function migrateLegacyDirectory(){const _0xb19534=a26_0x1d7ac4;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x339882=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x339882[_0xb19534(0xf1)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xb19534(0x11f)](a26_0xa1756e[_0xb19534(0x13b)](_0xb19534(0x9c)+LEGACY_PARENT_SEGMENT_DIR+_0xb19534(0xb6)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0xb19534(0x11f)](a26_0xa1756e['dim']('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0xb19534(0x11f)](a26_0xa1756e[_0xb19534(0x13b)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0xb19534(0xba)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a26_0xa1756e['green'](_0xb19534(0x1ca)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0xcad731){const _0x34d7e3=_0xcad731 instanceof Error?_0xcad731[_0xb19534(0xab)]:String(_0xcad731);return console[_0xb19534(0x11f)](a26_0xa1756e['red'](_0xb19534(0xd7)+_0x34d7e3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x1e7afa){const _0x17e447=a26_0x1d7ac4;return migrateLegacyDirectory(),super[_0x17e447(0x183)](_0x1e7afa);}}function resolveYamlFile(_0x559040){const _0x5bac8e=a26_0x1d7ac4;if(_0x559040[_0x5bac8e(0x126)](_0x5bac8e(0x9e))||_0x559040['endsWith'](_0x5bac8e(0x17b)))return _0x559040;return a26_0x56e348['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x559040)+_0x5bac8e(0x9e));}function formatProgressMessage(_0xd17905){const _0xc5ba72=a26_0x1d7ac4,_0x3e1788=_0xd17905[_0xc5ba72(0x150)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3e1788){const [,_0x591a46,_0x47b114,_0x58e1bc='']=_0x3e1788;return a26_0xa1756e[_0xc5ba72(0x1e8)](_0x591a46+':')+'\x20'+_0x47b114+a26_0xa1756e[_0xc5ba72(0x1e8)](_0x58e1bc);}return a26_0xa1756e[_0xc5ba72(0x1e8)](_0xd17905);}function showFileNotFoundError(_0x416700,_0x3ae809){const _0x168ef4=a26_0x1d7ac4;console['error'](a26_0xa1756e[_0x168ef4(0xdc)](_0x168ef4(0x1d5)+_0x416700+'\x0a')),console['error'](a26_0xa1756e['cyan']('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x3ae809+_0x168ef4(0x148)));}function displayRealtimeValidation(_0x45770d){const _0x476572=a26_0x1d7ac4;if(!_0x45770d[_0x476572(0xf3)])return;const _0x21c5b=_0x45770d[_0x476572(0xf3)],_0x5b1bbe=_0x21c5b['enabled']?a26_0xa1756e[_0x476572(0xfd)](_0x476572(0x1e7)):a26_0xa1756e[_0x476572(0x13b)]('⚡\x20Not\x20enabled');console[_0x476572(0x11f)]('\x0a'+a26_0xa1756e[_0x476572(0x1e8)](_0x476572(0x15c))+'\x20'+_0x5b1bbe);if(_0x21c5b[_0x476572(0x196)]&&_0x21c5b[_0x476572(0x196)]['length']>0x0){console[_0x476572(0x11f)]('\x20\x20'+a26_0xa1756e[_0x476572(0x1e8)](_0x476572(0x14b))+'\x20'+_0x21c5b[_0x476572(0x196)][_0x476572(0xd1)]+_0x476572(0x17d));for(const _0x395f7f of _0x21c5b[_0x476572(0x196)]){const _0x564d21=_0x395f7f['sourceTableValid']===![]?a26_0xa1756e[_0x476572(0xdc)]('✘'):a26_0xa1756e[_0x476572(0xfd)]('✔');console[_0x476572(0x11f)](_0x476572(0x1be)+_0x564d21+'\x20'+_0x395f7f['name']),_0x395f7f[_0x476572(0x174)]&&console[_0x476572(0x11f)](_0x476572(0xc2)+a26_0xa1756e[_0x476572(0xdc)](_0x395f7f[_0x476572(0x174)]));}}if(_0x21c5b[_0x476572(0xc8)]&&_0x21c5b[_0x476572(0xc8)][_0x476572(0xd1)]>0x0){console[_0x476572(0x11f)]('\x20\x20'+a26_0xa1756e[_0x476572(0x1e8)](_0x476572(0x93))+'\x20'+_0x21c5b[_0x476572(0xc8)][_0x476572(0xd1)]+_0x476572(0x17d));for(const _0x2163e2 of _0x21c5b['attributes']){const _0x82547f=_0x2163e2[_0x476572(0xf9)]?a26_0xa1756e['green']('✔'):a26_0xa1756e[_0x476572(0xdc)]('✘');console[_0x476572(0x11f)](_0x476572(0x1be)+_0x82547f+'\x20'+_0x2163e2[_0x476572(0x17e)]+'\x20'+a26_0xa1756e['dim']('('+_0x2163e2[_0x476572(0x9d)]+')'));}}if(_0x21c5b[_0x476572(0x143)]){const _0x57ee7d=_0x21c5b[_0x476572(0x143)][_0x476572(0x8f)]?.['length']?_0x476572(0x181)+_0x21c5b[_0x476572(0x143)][_0x476572(0x8f)][_0x476572(0x1a1)](',\x20')+']':'';console['error']('\x20\x20'+a26_0xa1756e[_0x476572(0x1e8)](_0x476572(0x1ba))+'\x20'+_0x21c5b[_0x476572(0x143)][_0x476572(0x1c7)]+_0x57ee7d);}if(_0x21c5b['personalizationServices']&&_0x21c5b[_0x476572(0xce)][_0x476572(0xd1)]>0x0){console[_0x476572(0x11f)]('\x20\x20'+a26_0xa1756e[_0x476572(0x1e8)]('Personalization:')+'\x20'+_0x21c5b['personalizationServices'][_0x476572(0xd1)]+_0x476572(0x113)+(_0x21c5b['personalizationServices'][_0x476572(0xd1)]!==0x1?'s':''));for(const _0x4e4acc of _0x21c5b[_0x476572(0xce)]){console[_0x476572(0x11f)](_0x476572(0xdb)+_0x4e4acc[_0x476572(0x17e)]);}}}function showParentSegmentNotSetError(_0x442054){const _0x314e3d=a26_0x1d7ac4;console[_0x314e3d(0x11f)](a26_0xa1756e['yellow'](_0x314e3d(0x1c6))),console[_0x314e3d(0x11f)](_0x442054);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x1d7ac4(0x17e)]=a26_0x1d7ac4(0x1f4);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x1bc);async[a26_0x1d7ac4(0x16c)](_0xac2bb1){const _0x35d9a3=a26_0x1d7ac4,{options:_0x99eced,args:_0x3d0152,tdx:_0x1fd6ea}=_0xac2bb1,_0x321ede=_0x3d0152[0x0];_0x99eced[_0x35d9a3(0xb2)]&&(console['error'](_0x35d9a3(0x97)+_0x99eced[_0x35d9a3(0x1d9)]),_0x321ede&&console[_0x35d9a3(0x11f)](_0x35d9a3(0xf6)+_0x321ede));const _0x557e88=await withSpinner(_0x321ede?_0x35d9a3(0x1bd)+_0x321ede+'\x27...':_0x35d9a3(0x132),()=>_0x1fd6ea['segment'][_0x35d9a3(0x109)](),{'verbose':_0x99eced['verbose']});let _0x3c2da4=_0x557e88[_0x35d9a3(0x15b)];if(_0x321ede){const _0x5af197=_0x321ede[_0x35d9a3(0x163)](/[.+^${}()|[\]\\]/g,_0x35d9a3(0x16f))[_0x35d9a3(0x163)](/\*/g,'.*')[_0x35d9a3(0x163)](/\?/g,'.'),_0x3d25ef=new RegExp('^'+_0x5af197+'$','i');_0x3c2da4=_0x3c2da4[_0x35d9a3(0x176)](_0x123599=>_0x3d25ef[_0x35d9a3(0x106)](_0x123599[_0x35d9a3(0xc8)][_0x35d9a3(0x17e)]));}_0x3c2da4['sort']((_0x3a4e89,_0x2f8894)=>_0x3a4e89[_0x35d9a3(0xc8)][_0x35d9a3(0x17e)]['localeCompare'](_0x2f8894[_0x35d9a3(0xc8)][_0x35d9a3(0x17e)])),console[_0x35d9a3(0x11f)](_0x35d9a3(0x1fa)+_0x3c2da4[_0x35d9a3(0xd1)]+_0x35d9a3(0x94)+(_0x3c2da4[_0x35d9a3(0xd1)]!==0x1?'s':''));const _0x9d1a51=_0x2e91ec=>{const _0x16b14a=_0x35d9a3;return getConsoleNextUrl(_0x99eced[_0x16b14a(0x1d9)],_0x16b14a(0x1b7)+_0x2e91ec);};if(_0x99eced['format']===_0x35d9a3(0xd8)||_0x99eced[_0x35d9a3(0xbe)]===_0x35d9a3(0x138)){const _0x13523a=_0x3c2da4[_0x35d9a3(0x139)](_0x26e291=>({..._0x26e291,'url':_0x9d1a51(_0x26e291['id'])}));await handleSDKOutput(_0x13523a,_0x99eced);}else{if(_0x3c2da4['length']===0x0)_0x321ede?console[_0x35d9a3(0x92)](_0x35d9a3(0x211)+_0x321ede):console[_0x35d9a3(0x92)](_0x35d9a3(0x11b));else for(const _0x39b699 of _0x3c2da4){const _0x4e7227=_0x39b699[_0x35d9a3(0xc8)][_0x35d9a3(0x158)]?a26_0xa1756e[_0x35d9a3(0x1e8)]('\x20('+formatRows(_0x39b699[_0x35d9a3(0xc8)]['population'])+')'):'',_0x35ed25=hyperlink(_0x39b699[_0x35d9a3(0xc8)][_0x35d9a3(0x17e)],_0x9d1a51(_0x39b699['id']));console['log'](_0x35d9a3(0xcb)+_0x35ed25+_0x4e7227);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a26_0x1d7ac4(0xca);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x1d1);async[a26_0x1d7ac4(0x16c)](_0x8d7cbe){const _0x28c0b5=a26_0x1d7ac4,{options:_0x421160,args:_0x1c80da,tdx:_0x2a2978}=_0x8d7cbe;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x28c0b5(0x105));const _0x4f5090=_0x421160;if(_0x1c80da[_0x28c0b5(0xd1)]===0x0)return console['error'](a26_0xa1756e[_0x28c0b5(0xdc)](_0x28c0b5(0x108))),console[_0x28c0b5(0x11f)](_0x28c0b5(0x180)),0x1;const _0x2d0221=_0x1c80da[0x0];if(!_0x4f5090['database']||!_0x4f5090[_0x28c0b5(0x12b)])return console[_0x28c0b5(0x11f)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x28c0b5(0x11f)](_0x28c0b5(0x180)),0x1;_0x4f5090['verbose']&&(console['error'](_0x28c0b5(0x97)+_0x4f5090[_0x28c0b5(0x1d9)]),console['error'](_0x28c0b5(0x1c4)+_0x2d0221),console[_0x28c0b5(0x11f)](_0x28c0b5(0x204)+_0x4f5090[_0x28c0b5(0xe0)]),console[_0x28c0b5(0x11f)](_0x28c0b5(0x137)+_0x4f5090[_0x28c0b5(0x12b)]));const _0x25cd09=await loadJSONFromOptions(_0x4f5090[_0x28c0b5(0xc8)],_0x4f5090['attributesFile']),_0x950cbe=await loadJSONFromOptions(_0x4f5090[_0x28c0b5(0x18b)],_0x4f5090['behaviorsFile']),_0x58d368=await loadJSONFromOptions(_0x4f5090[_0x28c0b5(0x1ff)],_0x4f5090[_0x28c0b5(0x10e)]),_0x557318={'name':_0x2d0221,'description':_0x4f5090[_0x28c0b5(0xea)],'scheduleType':_0x4f5090['scheduleType'],'scheduleOption':_0x4f5090[_0x28c0b5(0x1a2)],'timezone':_0x4f5090['timezone'],'master':{'parentDatabaseName':_0x4f5090[_0x28c0b5(0xe0)],'parentTableName':_0x4f5090[_0x28c0b5(0x12b)]},'attributes':_0x25cd09,'behaviors':_0x950cbe,'customerGroup':_0x58d368},_0x2de8dc=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2d0221+_0x28c0b5(0x171),()=>_0x2a2978[_0x28c0b5(0x1c8)][_0x28c0b5(0xd5)](_0x557318),{'verbose':_0x421160[_0x28c0b5(0xb2)]}),_0x266007=_0x2de8dc[_0x28c0b5(0x15b)];return console[_0x28c0b5(0x11f)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x266007['name']+_0x28c0b5(0x189)+_0x266007['id']),await handleSDKOutput([_0x266007],_0x421160),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a26_0x1d7ac4(0x1b9);['description']=a26_0x1d7ac4(0x1fb);async[a26_0x1d7ac4(0x16c)](_0x1dc344){const _0x455957=a26_0x1d7ac4,{options:_0x342a55,args:_0x4e82f7,tdx:_0x1ff99a}=_0x1dc344;console[_0x455957(0x11f)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x455957(0x177)+_0x455957(0x105));const _0x45c8c5=_0x342a55;if(_0x4e82f7[_0x455957(0xd1)]===0x0)return console[_0x455957(0x11f)](a26_0xa1756e[_0x455957(0xdc)](_0x455957(0x108))),console[_0x455957(0x11f)](_0x455957(0x9a)),0x1;const _0x1c0f23=_0x4e82f7[0x0];_0x45c8c5[_0x455957(0xb2)]&&(console[_0x455957(0x11f)](_0x455957(0x97)+_0x45c8c5[_0x455957(0x1d9)]),console[_0x455957(0x11f)](_0x455957(0x190)+_0x1c0f23));const _0x3249c1=await withSpinner(_0x455957(0x167)+_0x1c0f23+'\x27...',()=>_0x1ff99a[_0x455957(0x1c8)][_0x455957(0x1ed)](_0x1c0f23),{'verbose':_0x45c8c5[_0x455957(0xb2)]}),_0x274e87=_0x3249c1[_0x455957(0x15b)],_0x272e7c=await loadJSONFromOptions(_0x45c8c5[_0x455957(0xf4)],_0x45c8c5[_0x455957(0x120)]),_0x4e0e08=await loadJSONFromOptions(_0x45c8c5[_0x455957(0x1de)],_0x45c8c5[_0x455957(0x172)]),_0x12a33f={'name':_0x274e87[_0x455957(0x17e)],'description':_0x45c8c5[_0x455957(0xea)]!==undefined?_0x45c8c5[_0x455957(0xea)]:_0x274e87['description'],'scheduleType':_0x45c8c5[_0x455957(0x208)]!==undefined?_0x45c8c5[_0x455957(0x208)]:_0x274e87[_0x455957(0x208)],'scheduleOption':_0x45c8c5['scheduleOption']!==undefined?_0x45c8c5[_0x455957(0x1a2)]:_0x274e87[_0x455957(0x1a2)],'timezone':_0x45c8c5[_0x455957(0xa7)]!==undefined?_0x45c8c5[_0x455957(0xa7)]:_0x274e87[_0x455957(0xa7)],'master':_0x274e87[_0x455957(0xee)],'attributes':_0x272e7c?[..._0x274e87[_0x455957(0xc8)]||[],..._0x272e7c]:_0x274e87[_0x455957(0xc8)],'behaviors':_0x4e0e08?[..._0x274e87[_0x455957(0x18b)]||[],..._0x4e0e08]:_0x274e87[_0x455957(0x18b)],'customerGroup':_0x274e87[_0x455957(0x1ff)]},_0x272231=await withSpinner(_0x455957(0x13c)+_0x1c0f23+_0x455957(0x171),()=>_0x1ff99a[_0x455957(0x1c8)]['updateParent'](_0x1c0f23,_0x12a33f),{'verbose':_0x45c8c5[_0x455957(0xb2)]}),_0x245277=_0x272231['data'];return console['error'](_0x455957(0x157)+_0x245277[_0x455957(0x17e)]+'\x27'),await handleSDKOutput([_0x245277],_0x45c8c5),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x1d7ac4(0x17e)]='segment:parent:pull';[a26_0x1d7ac4(0xea)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a26_0x1d7ac4(0x16c)](_0x3e10d6){const _0x20fefa=a26_0x1d7ac4,{options:_0x3bef81,args:_0xff496d,tdx:_0x1a931d}=_0x3e10d6,_0x46f0a3=_0x3bef81,_0x4f0ae1=_0xff496d[0x0]||_0x3bef81[_0x20fefa(0x178)];if(!_0x4f0ae1)return showParentSegmentNotSetError(_0x20fefa(0xdd)+_0x20fefa(0x110)),0x1;if(_0x46f0a3['use']&&_0x46f0a3[_0x20fefa(0x175)])return console[_0x20fefa(0x11f)](a26_0xa1756e['red'](_0x20fefa(0xe7))),console[_0x20fefa(0x11f)](a26_0xa1756e[_0x20fefa(0x1e8)](_0x20fefa(0x129))),console['error'](a26_0xa1756e[_0x20fefa(0x1e8)](_0x20fefa(0x1f1)+PARENT_SEGMENT_DIR+_0x20fefa(0x1ae))),console['error'](a26_0xa1756e['cyan']('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x396c00=_0x46f0a3['output']||a26_0x56e348[_0x20fefa(0x1a1)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4f0ae1)+_0x20fefa(0x9e));_0x46f0a3['verbose']&&(console[_0x20fefa(0x11f)](_0x20fefa(0x97)+_0x46f0a3[_0x20fefa(0x1d9)]),console['error'](_0x20fefa(0x190)+_0x4f0ae1),console[_0x20fefa(0x11f)](_0x20fefa(0x13d)+_0x396c00));const _0x55eae3=await withSpinner(_0x20fefa(0x14d)+_0x4f0ae1+_0x20fefa(0x171),()=>_0x1a931d[_0x20fefa(0x1c8)][_0x20fefa(0x111)](_0x4f0ae1),{'verbose':_0x46f0a3['verbose']}),_0x2aa9a9=_0x55eae3[_0x20fefa(0x15b)];if(existsSync(_0x396c00)){const _0x4a575f=readFileSync(_0x396c00,_0x20fefa(0xeb)),_0x17a179=generateDiff(_0x4a575f,_0x2aa9a9);if(!hasChanges(_0x17a179))console['error'](a26_0xa1756e[_0x20fefa(0xfd)]('✔')+_0x20fefa(0x1dc)+a26_0xa1756e[_0x20fefa(0x1b4)](_0x396c00)+_0x20fefa(0x16d));else{console[_0x20fefa(0x11f)](_0x20fefa(0x156)+_0x396c00+'\x27:'),console[_0x20fefa(0x11f)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x17a179)),console['error']('─'[_0x20fefa(0x1ad)](0x3c));if(!_0x46f0a3[_0x20fefa(0xb7)]){if(!isInteractive())return console[_0x20fefa(0x11f)](a26_0xa1756e[_0x20fefa(0xdc)]('\x0aError:'),_0x20fefa(0x214)),console['error'](a26_0xa1756e[_0x20fefa(0x1e8)](_0x20fefa(0xd4))),0x1;const _0x3e0190=await confirmKey(_0x20fefa(0xa6)+_0x396c00+'\x27?');if(!_0x3e0190)return console['error'](a26_0xa1756e['yellow'](_0x20fefa(0x21b))),0x1;}writeFileSync(_0x396c00,_0x2aa9a9,_0x20fefa(0xeb)),console[_0x20fefa(0x11f)](a26_0xa1756e[_0x20fefa(0xfd)]('✔')+_0x20fefa(0x12c)+a26_0xa1756e[_0x20fefa(0x1b4)](_0x396c00));}}else{const _0x43671=a26_0x56e348[_0x20fefa(0x1e4)](_0x396c00);!existsSync(_0x43671)&&mkdirSync(_0x43671,{'recursive':!![]}),writeFileSync(_0x396c00,_0x2aa9a9,_0x20fefa(0xeb)),console[_0x20fefa(0x11f)](a26_0xa1756e['green']('✔')+_0x20fefa(0x12c)+a26_0xa1756e[_0x20fefa(0x1b4)](_0x396c00));}return saveSessionContext({'parent_segment':_0x4f0ae1},_0x46f0a3['session']),console['error'](a26_0xa1756e[_0x20fefa(0xfd)]('✔')+'\x20Context\x20set:\x20'+a26_0xa1756e[_0x20fefa(0x1e8)](_0x20fefa(0xa0))+_0x20fefa(0x99)+a26_0xa1756e[_0x20fefa(0x1b4)](_0x4f0ae1)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x1d7ac4(0x17e)]=a26_0x1d7ac4(0x1d6);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x219);async[a26_0x1d7ac4(0x16c)](_0x15d1a7){const _0x29bb45=a26_0x1d7ac4,{options:_0x66ec10,args:_0x28bb47,tdx:_0xe6489f}=_0x15d1a7,_0x3b23ef=_0x66ec10,_0x324a29=_0x28bb47[0x0]||_0x66ec10[_0x29bb45(0x178)];if(!_0x324a29)return showParentSegmentNotSetError(_0x29bb45(0x103)+_0x29bb45(0x15d)),0x1;const _0x4ee858=resolveYamlFile(_0x324a29);if(!existsSync(_0x4ee858))return showFileNotFoundError(_0x4ee858,_0x324a29),0x1;_0x3b23ef['verbose']&&(console[_0x29bb45(0x11f)]('Site:\x20'+_0x3b23ef['site']),console['error'](_0x29bb45(0x191)+_0x4ee858));let _0x2b79a8;try{_0x2b79a8=readFileSync(_0x4ee858,'utf-8');}catch(_0x6f4385){const _0x220a6c=_0x6f4385 instanceof Error?_0x6f4385[_0x29bb45(0xab)]:String(_0x6f4385);return console['error'](_0x29bb45(0x12d)+_0x220a6c),0x1;}const _0x57f484=await withSpinner(_0x29bb45(0x134),()=>_0xe6489f[_0x29bb45(0x1c8)]['pushParentYaml'](_0x2b79a8),{'verbose':_0x3b23ef[_0x29bb45(0xb2)]}),_0xd48a37=_0x57f484[_0x29bb45(0x15b)],{isNew:_0x47c991,name:_0x1d1243,hasChanges:_0x530a08,diffFormatted:_0x50fe1b}=_0xd48a37;if(!_0x530a08)return console[_0x29bb45(0x11f)](_0x29bb45(0x127)+_0x1d1243+_0x29bb45(0x21d)),0x0;_0x47c991?console[_0x29bb45(0x11f)](_0x29bb45(0x1e6)+_0x1d1243+'\x27:'):console[_0x29bb45(0x11f)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x1d1243+'\x27:');console[_0x29bb45(0x11f)]('─'[_0x29bb45(0x1ad)](0x3c)),console['error'](_0x50fe1b),console[_0x29bb45(0x11f)]('─'['repeat'](0x3c));const _0x5c075c=_0x47c991?'Create\x20parent\x20segment\x20\x27'+_0x1d1243+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x1d1243+'\x27?';if(!_0x3b23ef[_0x29bb45(0xb7)]){if(!isInteractive())return console[_0x29bb45(0x11f)](a26_0xa1756e['red'](_0x29bb45(0xad)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x29bb45(0x11f)](a26_0xa1756e[_0x29bb45(0x1e8)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x3a92ea=await confirmKey(_0x5c075c);if(!_0x3a92ea)return console['error'](a26_0xa1756e[_0x29bb45(0x13b)](_0x29bb45(0x21b))),0x1;}const _0x2f982e=_0x47c991?_0x29bb45(0x1f0):_0x29bb45(0x115),_0x1c4158=await withSpinner(_0x2f982e+'\x20parent\x20segment\x20\x27'+_0x1d1243+'\x27...',()=>_0xd48a37['apply'](),{'verbose':_0x3b23ef[_0x29bb45(0xb2)]}),_0x324395=_0x1c4158[_0x29bb45(0x15b)],_0x5567e0=getConsoleNextUrl(_0x3b23ef[_0x29bb45(0x1d9)],_0x29bb45(0x1b7)+_0x324395['id']),_0x3c7c1e=_0x47c991?_0x29bb45(0x1c2):'Updated';return console[_0x29bb45(0x11f)]('✔\x20'+_0x3c7c1e+_0x29bb45(0x147)+_0x324395[_0x29bb45(0x17e)]+'\x27'),console[_0x29bb45(0x11f)]('\x20\x20'+_0x5567e0),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x1d7ac4(0xff);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x4f3ce2){const _0x4a7573=a26_0x1d7ac4,{options:_0x33e0d1,args:_0x218bdc,tdx:_0x6d5167}=_0x4f3ce2,_0x3363ce=_0x33e0d1,_0x2cb892=_0x218bdc[0x0]||_0x33e0d1[_0x4a7573(0x178)];if(!_0x2cb892)return showParentSegmentNotSetError(_0x4a7573(0x17a)+_0x4a7573(0x20f)+'Options:\x0a'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x4a7573(0x145)),0x1;const _0x410710=resolveYamlFile(_0x2cb892);if(!existsSync(_0x410710))return showFileNotFoundError(_0x410710,_0x2cb892),0x1;_0x3363ce[_0x4a7573(0xb2)]&&(console['error'](_0x4a7573(0x97)+_0x3363ce['site']),console['error']('YAML\x20file:\x20'+_0x410710));let _0x16001f;try{_0x16001f=readFileSync(_0x410710,'utf-8');}catch(_0xe9bae6){const _0x22ca4f=_0xe9bae6 instanceof Error?_0xe9bae6['message']:String(_0xe9bae6);return console['error']('Error\x20reading\x20file:\x20'+_0x22ca4f),0x1;}const _0x149f1b=createCommandSpinner(a26_0xa1756e[_0x4a7573(0x1e8)](_0x4a7573(0x1d4)),{'verbose':_0x3363ce['verbose']});_0x149f1b[_0x4a7573(0x12a)]();const _0x402e76={'onProgress':_0x4fe6d9=>{const _0x567009=_0x4a7573;_0x149f1b[_0x567009(0x18a)]=formatProgressMessage(_0x4fe6d9);}};if(_0x3363ce[_0x4a7573(0xee)])_0x402e76['master']=!![];if(_0x3363ce['enriched'])_0x402e76[_0x4a7573(0xfe)]=!![];_0x3363ce['attribute']&&(_0x402e76['attribute']=_0x3363ce[_0x4a7573(0x20a)]);_0x3363ce[_0x4a7573(0x20c)]&&(_0x402e76[_0x4a7573(0x20c)]=_0x3363ce[_0x4a7573(0x20c)]);if(_0x3363ce[_0x4a7573(0x19d)])_0x402e76['interval']=_0x3363ce[_0x4a7573(0x19d)];let _0x337810;try{_0x337810=await _0x6d5167['segment'][_0x4a7573(0x15e)](_0x16001f,_0x402e76),_0x149f1b['stop']();}catch(_0x2a9f5f){_0x149f1b[_0x4a7573(0x197)]();throw _0x2a9f5f;}const _0xc7f79b=_0x3363ce[_0x4a7573(0x19d)]||_0x4a7573(0x1ce);return this[_0x4a7573(0xa4)](_0x337810,_0x402e76,_0x410710,_0xc7f79b),_0x337810[_0x4a7573(0xf5)]?0x0:0x1;}['displayValidateResults'](_0x36d881,_0x4c8d3c,_0x2e296c,_0x20924c){const _0x31dbb7=a26_0x1d7ac4;console[_0x31dbb7(0x11f)]('\x0a'+a26_0xa1756e['bold']('Validate:')+'\x20'+_0x36d881[_0x31dbb7(0x17e)]),console[_0x31dbb7(0x11f)]('═'[_0x31dbb7(0x1ad)](0x3c)),this[_0x31dbb7(0x1b2)](_0x36d881);if(typeof _0x4c8d3c['attribute']==='string'){this[_0x31dbb7(0x1b0)](_0x36d881),this[_0x31dbb7(0xbf)](_0x36d881),this[_0x31dbb7(0x1c3)](_0x2e296c,_0x20924c,_0x31dbb7(0x20a),_0x4c8d3c[_0x31dbb7(0x20a)]);return;}if(_0x4c8d3c['attribute']===!![]){this[_0x31dbb7(0x1b0)](_0x36d881),this[_0x31dbb7(0xbf)](_0x36d881),this[_0x31dbb7(0x1c3)](_0x2e296c,_0x20924c,_0x31dbb7(0xc8));return;}if(typeof _0x4c8d3c['behavior']===_0x31dbb7(0x11e)){this[_0x31dbb7(0x194)](_0x36d881,_0x20924c),this[_0x31dbb7(0xbf)](_0x36d881),this['displayPreviewHints'](_0x2e296c,_0x20924c,_0x31dbb7(0x20c),_0x4c8d3c['behavior']);return;}if(_0x4c8d3c[_0x31dbb7(0x20c)]===!![]){this['displayBehaviorsStats'](_0x36d881,_0x20924c),this['displaySummary'](_0x36d881),this[_0x31dbb7(0x1c3)](_0x2e296c,_0x20924c,'behaviors');return;}this[_0x31dbb7(0x1b0)](_0x36d881),this[_0x31dbb7(0x194)](_0x36d881,_0x20924c),this['displayRealtimeInfo'](_0x36d881),this['displaySummary'](_0x36d881),this[_0x31dbb7(0x1c3)](_0x2e296c,_0x20924c,_0x31dbb7(0x1ee));}[a26_0x1d7ac4(0x192)](_0x5f2ce5){displayRealtimeValidation(_0x5f2ce5);}['displayPreviewHints'](_0x2da516,_0x810c8e,_0x19fb38,_0x42a8e1){const _0x1e7edd=a26_0x1d7ac4;console['error']('\x0a'+a26_0xa1756e[_0x1e7edd(0x1e8)](_0x1e7edd(0x19f)));const _0x20d6da=_0x810c8e!==_0x1e7edd(0x1ce)?'\x20--interval\x20'+_0x810c8e:'';if(_0x19fb38===_0x1e7edd(0x20a)&&_0x42a8e1)console['error']('\x20\x20'+a26_0xa1756e['dim'](_0x1e7edd(0x1da)+_0x2da516+_0x1e7edd(0xd2)+_0x42a8e1+'\x22'+_0x20d6da));else{if(_0x19fb38===_0x1e7edd(0x20c)&&_0x42a8e1)console[_0x1e7edd(0x11f)]('\x20\x20'+a26_0xa1756e[_0x1e7edd(0x1e8)]('tdx\x20ps\x20preview\x20'+_0x2da516+_0x1e7edd(0x1fe)+_0x42a8e1+'\x22'+_0x20d6da));else(_0x19fb38===_0x1e7edd(0xc8)||_0x19fb38===_0x1e7edd(0x1ee))&&console['error']('\x20\x20'+a26_0xa1756e[_0x1e7edd(0x1e8)](_0x1e7edd(0x1da)+_0x2da516+'\x20--attribute\x20\x22<name>\x22'+_0x20d6da));}(_0x19fb38===_0x1e7edd(0x18b)||_0x19fb38===_0x1e7edd(0x1ee))&&console['error']('\x20\x20'+a26_0xa1756e[_0x1e7edd(0x1e8)](_0x1e7edd(0x1da)+_0x2da516+'\x20--behavior\x20\x22<name>\x22'+_0x20d6da)),_0x19fb38===_0x1e7edd(0x1ee)&&console[_0x1e7edd(0x11f)]('\x20\x20'+a26_0xa1756e[_0x1e7edd(0x1e8)](_0x1e7edd(0x1da)+_0x2da516+_0x1e7edd(0x21e)+_0x20d6da));}[a26_0x1d7ac4(0x1b2)](_0x5dcd9f){const _0x304ba1=a26_0x1d7ac4,{master:_0x4a2a73}=_0x5dcd9f,_0x13d78c=_0x4a2a73['schemaValid']?a26_0xa1756e['green']('✔'):a26_0xa1756e[_0x304ba1(0xdc)]('✘');console['error']('\x0a'+a26_0xa1756e['dim'](_0x304ba1(0xae))),console[_0x304ba1(0x11f)](_0x13d78c+'\x20'+a26_0xa1756e['bold'](_0x4a2a73[_0x304ba1(0xe0)]+'.'+_0x4a2a73['table'])),_0x4a2a73[_0x304ba1(0x18d)]?_0x4a2a73[_0x304ba1(0xc7)]!==undefined&&console[_0x304ba1(0x11f)]('\x20\x20'+a26_0xa1756e[_0x304ba1(0x1e8)](_0x304ba1(0xa8))+'\x20'+a26_0xa1756e['cyan'](formatRows(_0x4a2a73['rowCount']))):console[_0x304ba1(0x11f)]('\x20\x20'+a26_0xa1756e['red'](_0x304ba1(0x119))+'\x20'+_0x4a2a73[_0x304ba1(0x1a4)]);}[a26_0x1d7ac4(0x1b0)](_0x4a7870){const _0x176a41=a26_0x1d7ac4;if(_0x4a7870[_0x176a41(0xc8)][_0x176a41(0xd1)]===0x0)return;console['error']('\x0a'+a26_0xa1756e['dim'](_0x176a41(0xc4)));for(const _0x153bbf of _0x4a7870[_0x176a41(0xc8)]){const _0x4a49d8=_0x153bbf[_0x176a41(0x18d)]?a26_0xa1756e[_0x176a41(0xfd)]('✔'):a26_0xa1756e['red']('✘');let _0x1f48a9='';if(_0x153bbf[_0x176a41(0x18d)]&&_0x153bbf[_0x176a41(0x1f2)]!==undefined&&_0x153bbf[_0x176a41(0x90)]!==undefined){const _0x4f1256=_0x153bbf[_0x176a41(0x90)]['toFixed'](0x1),_0x4a8795=_0x153bbf[_0x176a41(0x90)]>=0x50?a26_0xa1756e['green']:_0x153bbf['coveragePercent']>=0x32?a26_0xa1756e[_0x176a41(0x13b)]:a26_0xa1756e[_0x176a41(0xdc)];_0x1f48a9='\x20'+a26_0xa1756e['dim']('Coverage:')+'\x20'+_0x4a8795(_0x4f1256+'%')+'\x20('+formatRows(_0x153bbf[_0x176a41(0x1f2)])+_0x176a41(0xe4);}console[_0x176a41(0x11f)](_0x4a49d8+'\x20'+a26_0xa1756e[_0x176a41(0x217)](_0x153bbf[_0x176a41(0x17e)])+_0x1f48a9),console[_0x176a41(0x11f)]('\x20\x20'+a26_0xa1756e[_0x176a41(0x1e8)](_0x176a41(0xf0))+'\x20'+a26_0xa1756e[_0x176a41(0x217)](_0x153bbf[_0x176a41(0xe0)]+'.'+_0x153bbf[_0x176a41(0x12b)]));const _0x29757d=_0x153bbf[_0x176a41(0x14f)]===_0x153bbf['foreignKey']?a26_0xa1756e[_0x176a41(0x1e8)](_0x176a41(0x10d))+'\x20'+_0x153bbf['joinKey']:a26_0xa1756e['dim'](_0x176a41(0x173))+'\x20'+_0x153bbf[_0x176a41(0x14f)]+'\x20=\x20'+_0x153bbf[_0x176a41(0x1a6)];console['error']('\x20\x20'+_0x29757d),console['error']('\x20\x20'+a26_0xa1756e[_0x176a41(0x1e8)](_0x176a41(0xde))),this[_0x176a41(0x118)](_0x153bbf[_0x176a41(0x19e)]),!_0x153bbf[_0x176a41(0x18d)]&&console[_0x176a41(0x11f)]('\x20\x20'+a26_0xa1756e[_0x176a41(0xdc)]('Error:')+'\x20'+_0x153bbf[_0x176a41(0x1a4)]);}}[a26_0x1d7ac4(0x194)](_0x1b7abc,_0xbf859b){const _0x732156=a26_0x1d7ac4;if(_0x1b7abc['behaviors'][_0x732156(0xd1)]===0x0)return;console[_0x732156(0x11f)]('\x0a'+a26_0xa1756e[_0x732156(0x1e8)](_0x732156(0xc0))+'\x20'+a26_0xa1756e[_0x732156(0x1e8)]('('+_0xbf859b+')'));for(const _0xda83ba of _0x1b7abc[_0x732156(0x18b)]){const _0x51e355=_0xda83ba[_0x732156(0x18d)]?a26_0xa1756e[_0x732156(0xfd)]('✔'):a26_0xa1756e[_0x732156(0xdc)]('✘');let _0x156c63='';if(_0xda83ba[_0x732156(0x18d)]&&_0xda83ba[_0x732156(0x154)]!==undefined&&_0xda83ba[_0x732156(0x15a)]!==undefined){const _0x150d0f=_0xda83ba['customerPercent']?.[_0x732156(0x1f3)](0x1)||'?',_0x3357e4=(_0xda83ba[_0x732156(0x9b)]??0x0)>=0x32?a26_0xa1756e[_0x732156(0xfd)]:(_0xda83ba['customerPercent']??0x0)>=0x14?a26_0xa1756e[_0x732156(0x13b)]:a26_0xa1756e[_0x732156(0xdc)];_0x156c63='\x20'+a26_0xa1756e[_0x732156(0x1e8)](_0x732156(0x11c))+'\x20'+_0x3357e4(formatRows(_0xda83ba[_0x732156(0x154)]))+'\x20('+_0x150d0f+_0x732156(0x1a9)+a26_0xa1756e[_0x732156(0x1e8)]('Events:')+'\x20'+a26_0xa1756e['cyan'](formatRows(_0xda83ba[_0x732156(0x15a)]));}console[_0x732156(0x11f)](_0x51e355+'\x20'+a26_0xa1756e['bold'](_0xda83ba['name'])+_0x156c63),console[_0x732156(0x11f)]('\x20\x20'+a26_0xa1756e[_0x732156(0x1e8)](_0x732156(0xf0))+'\x20'+a26_0xa1756e[_0x732156(0x217)](_0xda83ba[_0x732156(0xe0)]+'.'+_0xda83ba[_0x732156(0x12b)]));const _0x520d7d=_0xda83ba['joinKey']===_0xda83ba[_0x732156(0x1a6)]?a26_0xa1756e[_0x732156(0x1e8)](_0x732156(0x10d))+'\x20'+_0xda83ba[_0x732156(0x14f)]:a26_0xa1756e[_0x732156(0x1e8)](_0x732156(0x173))+'\x20'+_0xda83ba['joinKey']+_0x732156(0x99)+_0xda83ba[_0x732156(0x1a6)];console['error']('\x20\x20'+_0x520d7d),console[_0x732156(0x11f)]('\x20\x20'+a26_0xa1756e[_0x732156(0x1e8)](_0x732156(0xde))),this[_0x732156(0x118)](_0xda83ba['columns']),!_0xda83ba['schemaValid']&&console['error']('\x20\x20'+a26_0xa1756e[_0x732156(0xdc)](_0x732156(0x119))+'\x20'+_0xda83ba[_0x732156(0x1a4)]);}}[a26_0x1d7ac4(0x118)](_0xa287d5){const _0x16be14=a26_0x1d7ac4;for(const _0x4543a9 of _0xa287d5){_0x4543a9[_0x16be14(0xd6)]===_0x4543a9[_0x16be14(0x14a)]||_0x4543a9[_0x16be14(0x14a)]==='*'?console[_0x16be14(0x11f)](_0x16be14(0xdb)+_0x4543a9[_0x16be14(0xd6)]):console['error'](_0x16be14(0xdb)+_0x4543a9[_0x16be14(0xd6)]+'\x20'+a26_0xa1756e['dim']('('+_0x4543a9[_0x16be14(0x14a)]+')'));}}[a26_0x1d7ac4(0xbf)](_0x1ce58b){const _0x565854=a26_0x1d7ac4;console['error']('─'[_0x565854(0x1ad)](0x3c));if(_0x1ce58b[_0x565854(0xd9)][_0x565854(0xd1)]>0x0){console[_0x565854(0x11f)]('\x0a'+a26_0xa1756e[_0x565854(0xdc)]('Errors:'));for(const _0x26f873 of _0x1ce58b[_0x565854(0xd9)]){console['error']('\x20\x20'+a26_0xa1756e[_0x565854(0xdc)]('•')+'\x20'+_0x26f873);}}_0x1ce58b[_0x565854(0xf5)]&&console[_0x565854(0x11f)]('\x0a'+a26_0xa1756e[_0x565854(0xfd)]('✔')+_0x565854(0xb1));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a26_0x1d7ac4(0x159);[a26_0x1d7ac4(0xea)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a26_0x1d7ac4(0x16c)](_0x33711e){const _0x5d959d=a26_0x1d7ac4,{options:_0x3cd3ed,args:_0x2643cb,tdx:_0x27230d}=_0x33711e,_0x4043cd=_0x3cd3ed,_0x1cfdd2=_0x2643cb[0x0]||_0x3cd3ed[_0x5d959d(0x178)];if(!_0x1cfdd2)return showParentSegmentNotSetError(_0x5d959d(0x17f)+_0x5d959d(0x125)+_0x5d959d(0x1ac)+_0x5d959d(0x9f)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x5d959d(0x145)),0x1;if(!_0x4043cd[_0x5d959d(0xee)]&&!_0x4043cd[_0x5d959d(0x20a)]&&!_0x4043cd['behavior']&&!_0x4043cd[_0x5d959d(0xfe)])return console[_0x5d959d(0x11f)](a26_0xa1756e[_0x5d959d(0xdc)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x5d959d(0x11f)](_0x5d959d(0x195)),console[_0x5d959d(0x11f)]('Options:'),console[_0x5d959d(0x11f)](_0x5d959d(0x1e9)),console[_0x5d959d(0x11f)](_0x5d959d(0x165)),console[_0x5d959d(0x11f)](_0x5d959d(0x19a)),console['error'](_0x5d959d(0xbb)),0x1;const _0x2e7553=resolveYamlFile(_0x1cfdd2);if(!existsSync(_0x2e7553))return showFileNotFoundError(_0x2e7553,_0x1cfdd2),0x1;_0x4043cd[_0x5d959d(0xb2)]&&(console[_0x5d959d(0x11f)](_0x5d959d(0x97)+_0x4043cd['site']),console[_0x5d959d(0x11f)](_0x5d959d(0x191)+_0x2e7553));let _0x3b13b4;try{_0x3b13b4=readFileSync(_0x2e7553,'utf-8');}catch(_0x6f52c8){const _0x5a706e=_0x6f52c8 instanceof Error?_0x6f52c8['message']:String(_0x6f52c8);return console[_0x5d959d(0x11f)](_0x5d959d(0x12d)+_0x5a706e),0x1;}let _0x4e8bd5;try{_0x4e8bd5=parseDef(_0x3b13b4);}catch(_0x3adcfe){const _0x3c3d9a=_0x3adcfe instanceof Error?_0x3adcfe[_0x5d959d(0xab)]:String(_0x3adcfe);return console['error'](a26_0xa1756e[_0x5d959d(0xdc)](_0x5d959d(0x1f5)+_0x3c3d9a)),0x1;}if(_0x4043cd[_0x5d959d(0x20a)]===!![]||_0x4043cd[_0x5d959d(0x20a)]===''){const _0x3f9498=_0x4e8bd5[_0x5d959d(0xc8)]?.[_0x5d959d(0x139)](_0x4d09dc=>_0x4d09dc[_0x5d959d(0x17e)])||[];if(_0x3f9498[_0x5d959d(0xd1)]===0x0)console[_0x5d959d(0x11f)](a26_0xa1756e['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x5d959d(0x11f)](a26_0xa1756e[_0x5d959d(0xdc)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x5d959d(0xb9));for(const _0x22fca4 of _0x3f9498){console[_0x5d959d(0x11f)]('\x20\x20'+a26_0xa1756e[_0x5d959d(0x1b4)](_0x22fca4));}console[_0x5d959d(0x11f)](_0x5d959d(0x91)+_0x1cfdd2+_0x5d959d(0xd2)+_0x3f9498[0x0]+'\x22');}return 0x1;}if(_0x4043cd['behavior']===!![]||_0x4043cd[_0x5d959d(0x20c)]===''){const _0x24e446=_0x4e8bd5[_0x5d959d(0x18b)]?.['map'](_0x18f99d=>_0x18f99d[_0x5d959d(0x17e)])||[];if(_0x24e446[_0x5d959d(0xd1)]===0x0)console[_0x5d959d(0x11f)](a26_0xa1756e[_0x5d959d(0xdc)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x5d959d(0x11f)](a26_0xa1756e[_0x5d959d(0xdc)](_0x5d959d(0x199))),console[_0x5d959d(0x11f)]('Available\x20behaviors:');for(const _0x4019e6 of _0x24e446){console[_0x5d959d(0x11f)]('\x20\x20'+a26_0xa1756e[_0x5d959d(0x1b4)](_0x4019e6));}console[_0x5d959d(0x11f)](_0x5d959d(0x91)+_0x1cfdd2+'\x20--behavior\x20\x22'+_0x24e446[0x0]+'\x22');}return 0x1;}const _0x45c1c2=createCommandSpinner(a26_0xa1756e[_0x5d959d(0x1e8)](_0x5d959d(0x10a)),{'verbose':_0x4043cd[_0x5d959d(0xb2)]});_0x45c1c2[_0x5d959d(0x12a)]();const _0x5f34d9={'onProgress':_0x390bc3=>{const _0x277834=_0x5d959d;_0x45c1c2[_0x277834(0x18a)]=formatProgressMessage(_0x390bc3);}};if(_0x4043cd[_0x5d959d(0xee)])_0x5f34d9[_0x5d959d(0xee)]=!![];if(_0x4043cd['attribute']&&typeof _0x4043cd[_0x5d959d(0x20a)]===_0x5d959d(0x11e))_0x5f34d9['attribute']=_0x4043cd[_0x5d959d(0x20a)];if(_0x4043cd[_0x5d959d(0x20c)]&&typeof _0x4043cd[_0x5d959d(0x20c)]==='string')_0x5f34d9['behavior']=_0x4043cd['behavior'];if(_0x4043cd['enriched'])_0x5f34d9[_0x5d959d(0xfe)]=!![];if(_0x4043cd[_0x5d959d(0x19d)])_0x5f34d9[_0x5d959d(0x19d)]=_0x4043cd[_0x5d959d(0x19d)];let _0x4eaba6;try{_0x4eaba6=await _0x27230d['segment'][_0x5d959d(0xd3)](_0x3b13b4,_0x5f34d9),_0x45c1c2['stop']();}catch(_0x302f78){_0x45c1c2[_0x5d959d(0x197)]();throw _0x302f78;}return await this[_0x5d959d(0x16b)](_0x4eaba6,{'master':_0x4043cd[_0x5d959d(0xee)],'attribute':typeof _0x4043cd[_0x5d959d(0x20a)]==='string'?_0x4043cd[_0x5d959d(0x20a)]:undefined,'behavior':typeof _0x4043cd[_0x5d959d(0x20c)]===_0x5d959d(0x11e)?_0x4043cd[_0x5d959d(0x20c)]:undefined,'enriched':_0x4043cd[_0x5d959d(0xfe)]}),_0x4eaba6[_0x5d959d(0xf5)]?0x0:0x1;}async[a26_0x1d7ac4(0x16b)](_0x54aa11,_0x201f78){const _0x535bdd=a26_0x1d7ac4;console[_0x535bdd(0x11f)]('\x0a'+a26_0xa1756e['bold'](_0x535bdd(0x1c0))+'\x20'+_0x54aa11[_0x535bdd(0x17e)]),console[_0x535bdd(0x11f)]('═'['repeat'](0x3c));if(_0x201f78[_0x535bdd(0xee)]&&_0x54aa11[_0x535bdd(0x107)]){const _0x661d72=a26_0xa1756e[_0x535bdd(0x1e8)](_0x535bdd(0xa3))+'\x20'+a26_0xa1756e['bold'](_0x54aa11[_0x535bdd(0xee)][_0x535bdd(0xe0)]+'.'+_0x54aa11[_0x535bdd(0xee)][_0x535bdd(0x12b)]);await this[_0x535bdd(0x149)](_0x661d72,_0x54aa11['sampleData']);}else{if(_0x201f78[_0x535bdd(0x20a)]&&_0x54aa11[_0x535bdd(0x107)]){const _0x5dc598=a26_0xa1756e['dim'](_0x535bdd(0x133))+'\x20'+a26_0xa1756e[_0x535bdd(0x217)](_0x201f78[_0x535bdd(0x20a)]);await this[_0x535bdd(0x149)](_0x5dc598,_0x54aa11[_0x535bdd(0x107)]);}else{if(_0x201f78[_0x535bdd(0x20c)]&&_0x54aa11['sampleData']){const _0x462b1b=a26_0xa1756e[_0x535bdd(0x1e8)](_0x535bdd(0x193))+'\x20'+a26_0xa1756e[_0x535bdd(0x217)](_0x201f78[_0x535bdd(0x20c)]);await this[_0x535bdd(0x149)](_0x462b1b,_0x54aa11[_0x535bdd(0x107)]);}else{if(_0x201f78[_0x535bdd(0xfe)]&&_0x54aa11['sampleData']){const _0x1b3969=a26_0xa1756e[_0x535bdd(0x1e8)](_0x535bdd(0x169))+'\x20'+a26_0xa1756e[_0x535bdd(0x217)](_0x535bdd(0x116));await this[_0x535bdd(0x149)](_0x1b3969,_0x54aa11[_0x535bdd(0x107)]);}else!_0x54aa11[_0x535bdd(0x107)]&&console['error'](_0x535bdd(0xb3));}}}if(_0x54aa11['errors']['length']>0x0){console['error']('─'['repeat'](0x3c)),console[_0x535bdd(0x11f)]('\x0a'+a26_0xa1756e[_0x535bdd(0xdc)](_0x535bdd(0xaa)));for(const _0x6c3648 of _0x54aa11[_0x535bdd(0xd9)]){console[_0x535bdd(0x11f)]('\x20\x20'+a26_0xa1756e[_0x535bdd(0xdc)]('•')+'\x20'+_0x6c3648);}}}async[a26_0x1d7ac4(0x149)](_0x156310,_0x29de53){const _0x1563fe=a26_0x1d7ac4;if(_0x29de53['length']===0x0){console['error']('\x0a'+_0x156310),console[_0x1563fe(0x11f)](_0x1563fe(0x1aa));return;}console[_0x1563fe(0x11f)]('\x0a'+_0x156310);const _0x198088=Object[_0x1563fe(0xe5)](_0x29de53[0x0])['map'](_0x36690d=>({'name':_0x36690d,'type':typeof _0x29de53[0x0][_0x36690d]==='number'?_0x1563fe(0x1dd):_0x1563fe(0xfa)})),_0x4dd7ed={'queryId':'preview','columns':_0x198088,'data':_0x29de53,'stats':{'state':_0x1563fe(0x130),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x29de53[_0x1563fe(0xd1)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x453e76=formatAsTable(_0x4dd7ed,_0x29de53[_0x1563fe(0xd1)],!![]);await writeOutput(_0x453e76,undefined,_0x1563fe(0x12b));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']='segment:parent:run';[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0xa5);async[a26_0x1d7ac4(0x16c)](_0x4b8dfb){const _0xb7eef9=a26_0x1d7ac4,{options:_0x4e6dde,args:_0x1d5255,tdx:_0x11db75}=_0x4b8dfb,_0x41f770=_0x4e6dde,_0x3b3692=_0x1d5255[0x0]||_0x4e6dde[_0xb7eef9(0x178)];if(!_0x3b3692)return showParentSegmentNotSetError(_0xb7eef9(0x153)+_0xb7eef9(0xd0)),0x1;const _0x3f1a64=resolveYamlFile(_0x3b3692);if(existsSync(_0x3f1a64)){_0x41f770[_0xb7eef9(0xb2)]&&console[_0xb7eef9(0x11f)]('Found\x20YAML\x20file:\x20'+_0x3f1a64);let _0x76cbd4;try{_0x76cbd4=readFileSync(_0x3f1a64,_0xb7eef9(0xeb));}catch(_0x56ccb8){const _0x2ab9cd=_0x56ccb8 instanceof Error?_0x56ccb8[_0xb7eef9(0xab)]:String(_0x56ccb8);return console[_0xb7eef9(0x11f)](_0xb7eef9(0x12d)+_0x2ab9cd),0x1;}const _0x166684=await withSpinner('Analyzing\x20changes...',()=>_0x11db75[_0xb7eef9(0x1c8)][_0xb7eef9(0xc6)](_0x76cbd4),{'verbose':_0x41f770['verbose']}),_0x5388b3=_0x166684[_0xb7eef9(0x15b)],{isNew:_0xa86b28,name:_0x53a280,hasChanges:_0x489844,diffFormatted:_0x5f3fb0}=_0x5388b3;if(_0x489844){_0xa86b28?console['error'](_0xb7eef9(0x1e6)+_0x53a280+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x53a280+'\x27:');console[_0xb7eef9(0x11f)]('─'[_0xb7eef9(0x1ad)](0x3c)),console[_0xb7eef9(0x11f)](_0x5f3fb0),console[_0xb7eef9(0x11f)]('─'[_0xb7eef9(0x1ad)](0x3c));const _0x4b4501=_0xa86b28?_0xb7eef9(0x1a3)+_0x53a280+'\x27\x20and\x20run\x20workflow?':_0xb7eef9(0xef)+_0x53a280+'\x27\x20and\x20run\x20workflow?';if(!_0x41f770[_0xb7eef9(0xb7)]){if(!isInteractive())return console[_0xb7eef9(0x11f)](a26_0xa1756e[_0xb7eef9(0xdc)](_0xb7eef9(0xad)),_0xb7eef9(0x214)),console['error'](a26_0xa1756e['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x45148f=await confirmKey(_0x4b4501);if(!_0x45148f)return console['error'](a26_0xa1756e['yellow'](_0xb7eef9(0x21b))),0x1;}const _0x106d8b=_0xa86b28?_0xb7eef9(0x1f0):'Updating';await withSpinner(_0x106d8b+'\x20parent\x20segment\x20\x27'+_0x53a280+_0xb7eef9(0x171),()=>_0x5388b3['apply'](),{'verbose':_0x41f770[_0xb7eef9(0xb2)]});const _0x44712d=_0xa86b28?_0xb7eef9(0x1c2):_0xb7eef9(0x162);console[_0xb7eef9(0x11f)]('✔\x20'+_0x44712d+_0xb7eef9(0x147)+_0x53a280+'\x27');}else console[_0xb7eef9(0x11f)]('✔\x20No\x20changes\x20-\x20\x27'+_0x53a280+_0xb7eef9(0x121));}const _0x184b65=await withSpinner(_0xb7eef9(0xb5)+_0x3b3692+'\x27...',()=>_0x11db75['segment'][_0xb7eef9(0x1c9)](_0x3b3692),{'verbose':_0x41f770[_0xb7eef9(0xb2)]}),_0x3415f0=_0x184b65[_0xb7eef9(0x15b)],_0xcf2905=getConsoleUrl(_0x41f770[_0xb7eef9(0x1d9)],_0xb7eef9(0x207)+_0x3415f0[_0xb7eef9(0x170)]+_0xb7eef9(0x10c)+_0x3415f0[_0xb7eef9(0x1eb)]+_0xb7eef9(0x101)+_0x3415f0[_0xb7eef9(0x1e0)]);return console[_0xb7eef9(0x11f)](_0xb7eef9(0x160)),console[_0xb7eef9(0x11f)]('\x20\x20'+a26_0xa1756e[_0xb7eef9(0x1e8)](_0xb7eef9(0xbc))+'\x20'+_0x3415f0[_0xb7eef9(0x155)]),console['error']('\x20\x20'+a26_0xa1756e[_0xb7eef9(0x1e8)](_0xb7eef9(0xec))+'\x20'+_0x3415f0[_0xb7eef9(0xb4)]),console[_0xb7eef9(0x11f)]('\x20\x20'+a26_0xa1756e[_0xb7eef9(0x1e8)](_0xb7eef9(0xcd))+'\x20'+_0x3415f0[_0xb7eef9(0x1eb)]),console[_0xb7eef9(0x11f)]('\x20\x20'+a26_0xa1756e[_0xb7eef9(0x1e8)](_0xb7eef9(0x20d))+'\x20'+_0x3415f0[_0xb7eef9(0x1e0)]),console['error']('\x20\x20'+_0xcf2905),console[_0xb7eef9(0x11f)]('\x0a'+a26_0xa1756e[_0xb7eef9(0x1e8)](_0xb7eef9(0xa1))+_0xb7eef9(0x1ea)+_0x3415f0[_0xb7eef9(0x1e0)]+_0xb7eef9(0x213)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x1d7ac4(0x17e)]=a26_0x1d7ac4(0xb8);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0xcf);async[a26_0x1d7ac4(0x16c)](_0x2d5cbb){const _0x328533=a26_0x1d7ac4,{options:_0x39920c,args:_0x478545,tdx:_0x151ea8}=_0x2d5cbb,_0x5cea88=_0x478545[0x0]||_0x39920c['parentSegment'];if(!_0x5cea88)return showParentSegmentNotSetError(_0x328533(0x136)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x39920c[_0x328533(0xb2)]&&(console[_0x328533(0x11f)]('Site:\x20'+_0x39920c[_0x328533(0x1d9)]),console[_0x328533(0x11f)]('Parent\x20segment:\x20'+_0x5cea88));const _0x51390b=await withSpinner(_0x328533(0x98)+_0x5cea88+'\x27...',()=>_0x151ea8['segment'][_0x328533(0xe9)](_0x5cea88),{'verbose':_0x39920c['verbose']}),_0x4c5824=_0x51390b[_0x328533(0x15b)];console[_0x328533(0x11f)](_0x328533(0x1fa)+_0x4c5824['length']+_0x328533(0x1b3)+(_0x4c5824['length']!==0x1?'s':''));if(_0x39920c[_0x328533(0xd8)]||_0x39920c[_0x328533(0x138)])return await handleSDKOutput(_0x4c5824,_0x39920c),0x0;return displayFieldsHumanReadable(_0x4c5824,_0x5cea88),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x1d7ac4(0x17e)]='segment:parent:view';['description']=a26_0x1d7ac4(0xf8);async[a26_0x1d7ac4(0x16c)](_0x4311c2){const _0x1fec59=a26_0x1d7ac4,{options:_0xefc27c,args:_0x9123cb,tdx:_0x3c1ef0}=_0x4311c2,_0x569f6f=_0xefc27c,_0xbfda8a=_0x9123cb[0x0]||_0xefc27c[_0x1fec59(0x178)];if(!_0xbfda8a)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x1fec59(0xc3)+_0x1fec59(0x210)),0x1;_0xefc27c[_0x1fec59(0xb2)]&&(console[_0x1fec59(0x11f)](_0x1fec59(0x97)+_0xefc27c[_0x1fec59(0x1d9)]),console[_0x1fec59(0x11f)](_0x1fec59(0x190)+_0xbfda8a));const _0x3618ee=await withSpinner(_0x1fec59(0x14d)+_0xbfda8a+_0x1fec59(0x171),()=>_0x3c1ef0[_0x1fec59(0x1c8)]['getParentFull'](_0xbfda8a),{'verbose':_0xefc27c[_0x1fec59(0xb2)]}),_0x3e30da=_0x3618ee[_0x1fec59(0x15b)];if(_0x569f6f[_0x1fec59(0x1e5)]){const _0x54cae7=getConsoleNextUrl(_0x569f6f[_0x1fec59(0x1d9)],'/app/dw/parentSegments/'+_0x3e30da['id']);return console[_0x1fec59(0x11f)](a26_0xa1756e['green']('✔')+_0x1fec59(0x186)+a26_0xa1756e[_0x1fec59(0x1b4)](_0x54cae7)),openBrowser(_0x54cae7),0x0;}return await handleSingleObjectOutput(_0x3e30da,_0xefc27c),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a26_0x1d7ac4(0x164);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0xac);async['execute'](_0x14b23b){const _0x5511ac=a26_0x1d7ac4,{options:_0x4e6d7c,args:_0x2f7403,tdx:_0x10a7c3}=_0x14b23b,_0x3fcfbf=_0x4e6d7c,_0x477cce=_0x2f7403[0x0]||_0x4e6d7c[_0x5511ac(0x178)];if(!_0x477cce)return showParentSegmentNotSetError(_0x5511ac(0x1e1)+'\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'+'Options:\x0a'+_0x5511ac(0x114)),0x1;_0x4e6d7c[_0x5511ac(0xb2)]&&(console[_0x5511ac(0x11f)]('Site:\x20'+_0x4e6d7c[_0x5511ac(0x1d9)]),console[_0x5511ac(0x11f)]('Parent\x20segment:\x20'+_0x477cce));const _0x343426=await withSpinner(_0x5511ac(0xc9)+_0x477cce+_0x5511ac(0x171),()=>_0x10a7c3[_0x5511ac(0x1c8)][_0x5511ac(0x1a7)](_0x477cce),{'verbose':_0x4e6d7c[_0x5511ac(0xb2)]}),_0x329c07=_0x343426[_0x5511ac(0x15b)],_0x10db4d=_0x10a7c3['segment'][_0x5511ac(0x112)](_0x329c07);if(_0x3fcfbf[_0x5511ac(0x175)]){const _0x52a4b9=await this[_0x5511ac(0x18e)](_0x14b23b,_0x477cce,_0x329c07,_0x10db4d),_0x592981=this['formatSchemaJson'](_0x52a4b9);writeFileSync(_0x3fcfbf[_0x5511ac(0x175)],_0x592981);const _0x22d6c1=_0x52a4b9[_0x5511ac(0xc5)]['columns'][_0x5511ac(0xd1)]+_0x52a4b9[_0x5511ac(0x18b)]['reduce']((_0x19c242,_0x3df2b7)=>_0x19c242+_0x3df2b7['columns'][_0x5511ac(0xd1)],0x0),_0x2d453a=_0x52a4b9['behaviors'][_0x5511ac(0x176)](_0x7de09=>_0x7de09[_0x5511ac(0x19e)][_0x5511ac(0xd1)]===0x0)[_0x5511ac(0xd1)];return console[_0x5511ac(0x92)](_0x5511ac(0x1bb)+_0x3fcfbf[_0x5511ac(0x175)]),console[_0x5511ac(0x92)]('\x20\x20Database:\x20'+_0x10db4d),console[_0x5511ac(0x92)](_0x5511ac(0x161)+_0x52a4b9[_0x5511ac(0x18b)][_0x5511ac(0xd1)]+_0x5511ac(0x96)),console[_0x5511ac(0x92)](_0x5511ac(0x187)+_0x22d6c1+_0x5511ac(0xcc)),_0x2d453a>0x0&&console[_0x5511ac(0x92)](_0x5511ac(0x100)+_0x2d453a+_0x5511ac(0x11d)),0x0;}console[_0x5511ac(0x11f)]('\x0a'+a26_0xa1756e['bold'](_0x5511ac(0x1d3))+'\x20'+a26_0xa1756e[_0x5511ac(0x1b4)](_0x10db4d));const _0x2c9139=await withSpinner(_0x5511ac(0x122),()=>_0x10a7c3[_0x5511ac(0x1c8)][_0x5511ac(0xa9)](_0x329c07),{'verbose':_0x4e6d7c[_0x5511ac(0xb2)]});console[_0x5511ac(0x11f)]('\x0a'+a26_0xa1756e['bold']('customers')+'\x20'+a26_0xa1756e[_0x5511ac(0x1e8)]('('+_0x10db4d+_0x5511ac(0x1fd)));const _0x2b251a=await executeSchemaQuery(_0x2c9139[_0x5511ac(0x15b)],_0x10a7c3,_0x4e6d7c);await handleQueryOutput(_0x2b251a,_0x4e6d7c);const _0x5e7686=await withSpinner(_0x5511ac(0x13f),()=>_0x10a7c3['segment'][_0x5511ac(0x1c5)](_0x329c07),{'verbose':_0x4e6d7c[_0x5511ac(0xb2)]});for(const _0x2ff8cb of _0x5e7686[_0x5511ac(0x15b)]){const _0x24d596=_0x5511ac(0x168)+_0x2ff8cb[_0x5511ac(0x14e)]()[_0x5511ac(0x163)](/\s+/g,'_'),_0x3113ac='SELECT\x20*\x20FROM\x20'+_0x10db4d+'.'+_0x24d596;console['error']('\x0a'+a26_0xa1756e[_0x5511ac(0x217)](_0x2ff8cb)+'\x20'+a26_0xa1756e[_0x5511ac(0x1e8)]('('+_0x10db4d+'.'+_0x24d596+')'));try{const _0x2b0084=await executeSchemaQuery(_0x3113ac,_0x10a7c3,_0x4e6d7c);await handleQueryOutput(_0x2b0084,_0x4e6d7c);}catch{console[_0x5511ac(0x11f)](a26_0xa1756e[_0x5511ac(0x13b)](_0x5511ac(0x20e)));}}return 0x0;}async[a26_0x1d7ac4(0x18e)](_0xe86545,_0x124725,_0x5ee974,_0x442cc5){const _0x44cd5a=a26_0x1d7ac4,{options:_0x3e1e03,tdx:_0x30312a}=_0xe86545,_0x4c34ad=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x30312a[_0x44cd5a(0x1c8)]['getParentSQL'](_0x5ee974),{'verbose':_0x3e1e03[_0x44cd5a(0xb2)]}),_0x483b62=await executeSchemaQuery(_0x4c34ad[_0x44cd5a(0x15b)],_0x30312a,_0x3e1e03),_0x42fa8d=_0x483b62['data']['map'](_0x8b7f8e=>({'name':_0x8b7f8e[_0x44cd5a(0xbd)],'type':_0x8b7f8e['column_type']})),_0x73b3d1=await withSpinner(_0x44cd5a(0x13f),()=>_0x30312a[_0x44cd5a(0x1c8)]['getBehaviorNames'](_0x5ee974),{'verbose':_0x3e1e03[_0x44cd5a(0xb2)]}),_0x342174=[];for(const _0x8baaef of _0x73b3d1['data']){const _0x1526c0='behavior_'+_0x8baaef[_0x44cd5a(0x14e)]()['replace'](/\s+/g,'_'),_0x4d38c1=_0x44cd5a(0x95)+_0x442cc5+'.'+_0x1526c0;let _0x283e5a=[];try{const _0x802a7d=await executeSchemaQuery(_0x4d38c1,_0x30312a,_0x3e1e03);_0x283e5a=_0x802a7d[_0x44cd5a(0x15b)][_0x44cd5a(0x139)](_0x5b431d=>({'name':_0x5b431d['column_name'],'type':_0x5b431d[_0x44cd5a(0x142)]}));}catch{}_0x342174['push']({'table':_0x1526c0,'columns':_0x283e5a});}return{'database':_0x442cc5,'parent_segment':_0x124725,'parent_id':_0x5ee974,'customers':{'table':_0x44cd5a(0xc5),'columns':_0x42fa8d},'behaviors':_0x342174};}[a26_0x1d7ac4(0x16e)](_0x25062a){const _0x2c7ab2=a26_0x1d7ac4,_0x4f93dc=_0xdc5953=>{const _0x30a3ad=a26_0x27f2;if(_0xdc5953[_0x30a3ad(0xd1)]===0x0)return'[]';const _0x313fce=_0xdc5953[_0x30a3ad(0x139)](_0x1c0af9=>_0x30a3ad(0x200)+_0x1c0af9[_0x30a3ad(0x17e)]+_0x30a3ad(0x1b1)+_0x1c0af9[_0x30a3ad(0x9d)]+_0x30a3ad(0x1d8));return'[\x0a'+_0x313fce[_0x30a3ad(0x1a1)](',\x0a')+_0x30a3ad(0x1a0);},_0x1968c6=_0x25062a[_0x2c7ab2(0x18b)]['map'](_0x1b6d3e=>{const _0x3b5fb0=_0x2c7ab2;return _0x3b5fb0(0x1af)+_0x1b6d3e['table']+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x4f93dc(_0x1b6d3e[_0x3b5fb0(0x19e)])[_0x3b5fb0(0x163)](/^/gm,'\x20\x20')[_0x3b5fb0(0x216)]()+'\x0a\x20\x20\x20\x20}';})[_0x2c7ab2(0x1a1)](',\x0a');return _0x2c7ab2(0x19c)+_0x25062a[_0x2c7ab2(0xe0)]+_0x2c7ab2(0xc1)+_0x25062a['parent_segment']+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x25062a['parent_id']+_0x2c7ab2(0x11a)+_0x25062a[_0x2c7ab2(0xc5)]['table']+_0x2c7ab2(0x14c)+_0x4f93dc(_0x25062a[_0x2c7ab2(0xc5)]['columns'])['replace'](/^/gm,'\x20\x20')['trim']()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x1968c6+_0x2c7ab2(0xb0);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x1d7ac4(0x17e)]=a26_0x1d7ac4(0x104);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x146);async['execute'](_0x598866){const _0x1f98ec=a26_0x1d7ac4,{options:_0x481dec,args:_0x1c0e69,tdx:_0x54f70d}=_0x598866,_0x18916a=_0x1c0e69[0x0]||_0x481dec['parentSegment'];if(!_0x18916a)return showParentSegmentNotSetError(_0x1f98ec(0xfc)+_0x1f98ec(0x205)),0x1;_0x481dec['verbose']&&(console['error'](_0x1f98ec(0x97)+_0x481dec[_0x1f98ec(0x1d9)]),console[_0x1f98ec(0x11f)](_0x1f98ec(0x190)+_0x18916a));const _0x21eed7=await withSpinner(_0x1f98ec(0xc9)+_0x18916a+_0x1f98ec(0x171),()=>_0x54f70d[_0x1f98ec(0x1c8)]['resolveParentId'](_0x18916a),{'verbose':_0x481dec['verbose']}),_0x41ce13=_0x21eed7[_0x1f98ec(0x15b)],_0x3b07e9=await withSpinner(_0x1f98ec(0x1bf)+_0x18916a+'\x27...',()=>_0x54f70d[_0x1f98ec(0x1c8)][_0x1f98ec(0xa9)](_0x41ce13),{'verbose':_0x481dec[_0x1f98ec(0xb2)]}),_0xd14857=_0x3b07e9[_0x1f98ec(0x15b)];return _0x481dec[_0x1f98ec(0xbe)]===_0x1f98ec(0xd8)||_0x481dec[_0x1f98ec(0xbe)]===_0x1f98ec(0x138)?await handleSDKOutput([{'sql':_0xd14857}],_0x481dec):console[_0x1f98ec(0x92)](_0xd14857),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a26_0x1d7ac4(0xf2);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x212);async[a26_0x1d7ac4(0x16c)](_0x4d7513){const _0xb11488=a26_0x1d7ac4,{options:_0x1f7933,args:_0x58bc7e,tdx:_0x1f0aa0}=_0x4d7513,_0x2a59ea=_0x58bc7e[0x0]||_0x1f7933[_0xb11488(0x178)];if(!_0x2a59ea)return showParentSegmentNotSetError(_0xb11488(0x10f)+_0xb11488(0x184)),0x1;_0x1f7933[_0xb11488(0xb2)]&&(console[_0xb11488(0x11f)](_0xb11488(0x97)+_0x1f7933[_0xb11488(0x1d9)]),console[_0xb11488(0x11f)]('Parent\x20segment:\x20'+_0x2a59ea));const _0x465fcd=await withSpinner(_0xb11488(0xc9)+_0x2a59ea+'\x27...',()=>_0x1f0aa0[_0xb11488(0x1c8)]['resolveParentId'](_0x2a59ea),{'verbose':_0x1f7933[_0xb11488(0xb2)]}),_0x151916=_0x465fcd[_0xb11488(0x15b)],_0x5668c3=await withSpinner(_0xb11488(0x1bf)+_0x2a59ea+_0xb11488(0x171),()=>_0x1f0aa0['segment'][_0xb11488(0xa9)](_0x151916),{'verbose':_0x1f7933[_0xb11488(0xb2)]});let _0x27151e=_0x5668c3[_0xb11488(0x15b)];const _0x39ee9f=resolveLimit(_0x1f7933[_0xb11488(0xdf)],DEFAULT_DISPLAY_LIMIT),_0x12b579=/\bLIMIT\s+\d+/i['test'](_0x27151e);!_0x12b579&&(_0x27151e=_0x27151e[_0xb11488(0x216)]()[_0xb11488(0x163)](/;+$/,''),_0x27151e=_0xb11488(0x1cc)+_0x27151e+_0xb11488(0x1f6)+_0x39ee9f);_0x1f7933[_0xb11488(0xb2)]&&console[_0xb11488(0x11f)](_0xb11488(0xe2)+_0x27151e);const _0x55b180=await withProgressSpinner(_0xb11488(0x124),async _0x52e4a3=>{const _0x2cac7e=_0xb11488,_0x19bfec=await _0x1f0aa0['query'][_0x2cac7e(0x16c)](_0x27151e,{'catalog':'td','schema':_0x2cac7e(0xe6),'onJobId':_0x4bb09e=>{const _0x5a044c=_0x2cac7e;_0x52e4a3[_0x5a044c(0x15f)](_0x4bb09e);}});return _0x19bfec;},{'verbose':_0x1f7933[_0xb11488(0xb2)]}),_0x26ee50=_0x55b180[_0xb11488(0x15b)],_0x17b69e=_0x26ee50[_0xb11488(0x1cd)]?_0xb11488(0x140)+_0x26ee50[_0xb11488(0x1cd)]+']':'';return console[_0xb11488(0x11f)](_0xb11488(0x123)+_0x26ee50[_0xb11488(0xda)]['processedRows'][_0xb11488(0x141)]()+_0xb11488(0x17c)+(_0xb11488(0x131)+formatElapsed(_0x26ee50[_0xb11488(0xda)][_0xb11488(0x1f7)])+_0x17b69e)),await handleQueryOutput(_0x26ee50,_0x1f7933),0x0;}}function a26_0x27f2(_0x1117a9,_0x280d59){_0x1117a9=_0x1117a9-0x8f;const _0x108752=a26_0x1087();let _0x27f276=_0x108752[_0x1117a9];return _0x27f276;}export class PSRtListCommand extends BaseCommand{['name']=a26_0x1d7ac4(0x206);[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x1cb);async[a26_0x1d7ac4(0x16c)](_0x2640a1){const _0x2b8826=a26_0x1d7ac4,{options:_0x2b5133,args:_0xa63a38,tdx:_0x483164}=_0x2640a1,_0x57b689=_0xa63a38[0x0],_0x2982d4=await withSpinner(_0x57b689?_0x2b8826(0xe8)+_0x57b689+_0x2b8826(0x171):_0x2b8826(0x144),()=>_0x483164['realtime'][_0x2b8826(0x12e)](),{'verbose':_0x2b5133[_0x2b8826(0xb2)]});let _0x85248d=_0x2982d4[_0x2b8826(0x15b)][_0x2b8826(0x176)](_0x3a0ed2=>_0x3a0ed2[_0x2b8826(0x198)]);if(_0x57b689){const _0x3701cd=_0x57b689['replace'](/[.+^${}()|[\]\\]/g,_0x2b8826(0x16f))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x1bc19f=new RegExp('^'+_0x3701cd+'$','i');_0x85248d=_0x85248d[_0x2b8826(0x176)](_0x53caa6=>_0x1bc19f[_0x2b8826(0x106)](_0x53caa6['name']));}_0x85248d['sort']((_0x334e9e,_0x1281c0)=>_0x334e9e[_0x2b8826(0x17e)][_0x2b8826(0x188)](_0x1281c0['name'])),console[_0x2b8826(0x11f)](_0x2b8826(0x1fa)+_0x85248d['length']+_0x2b8826(0x102)+(_0x85248d['length']!==0x1?'s':''));const _0x29ad21=_0x371971=>{return getConsoleNextUrl(_0x2b5133['site'],'/app/dw/parentSegments/'+_0x371971);};if(_0x2b5133[_0x2b8826(0xbe)]==='json'||_0x2b5133['format']===_0x2b8826(0x138)){const _0x46a024=_0x85248d['map'](_0x37e178=>({..._0x37e178,'url':_0x29ad21(_0x37e178['id'])}));await handleSDKOutput(_0x46a024,_0x2b5133);}else{if(_0x85248d[_0x2b8826(0xd1)]===0x0)console['log'](_0x2b8826(0x201));else for(const _0x4bbc02 of _0x85248d){const _0x4b9403=_0x4bbc02['population']?a26_0xa1756e[_0x2b8826(0x1e8)]('\x20('+formatRows(_0x4bbc02[_0x2b8826(0x158)])+')'):'',_0x55272e=hyperlink(_0x4bbc02[_0x2b8826(0x17e)],_0x29ad21(_0x4bbc02['id']));console[_0x2b8826(0x92)]('⚡\x20'+_0x55272e+_0x4b9403);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x1d7ac4(0x17e)]=a26_0x1d7ac4(0x1ec);[a26_0x1d7ac4(0xea)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a26_0x1d7ac4(0x16c)](_0x22e78a){const _0x4c41a0=a26_0x1d7ac4,{options:_0x4703da,args:_0x44546d,tdx:_0x289628}=_0x22e78a,_0x627026=_0x44546d[0x0]||_0x4703da[_0x4c41a0(0x178)];if(!_0x627026)return showParentSegmentNotSetError(_0x4c41a0(0x218)+'\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 _0x2af08d=resolveYamlFile(_0x627026);if(!existsSync(_0x2af08d))return showFileNotFoundError(_0x2af08d,_0x627026),0x1;let _0x5d5ac9;try{_0x5d5ac9=readFileSync(_0x2af08d,_0x4c41a0(0xeb));}catch(_0x3b72d1){const _0x574f56=_0x3b72d1 instanceof Error?_0x3b72d1[_0x4c41a0(0xab)]:String(_0x3b72d1);return console['error'](_0x4c41a0(0x12d)+_0x574f56),0x1;}const _0x2ffd5a=createCommandSpinner(a26_0xa1756e['dim'](_0x4c41a0(0x1db)),{'verbose':_0x4703da[_0x4c41a0(0xb2)]});_0x2ffd5a[_0x4c41a0(0x12a)]();const _0x58bf0b={'realtime':!![],'onProgress':_0x2a8a99=>{_0x2ffd5a['text']=formatProgressMessage(_0x2a8a99);}};let _0x12fb87;try{_0x12fb87=await _0x289628[_0x4c41a0(0x1c8)]['validateParentYaml'](_0x5d5ac9,_0x58bf0b),_0x2ffd5a['stop']();}catch(_0x33b6d3){_0x2ffd5a[_0x4c41a0(0x197)]();throw _0x33b6d3;}console[_0x4c41a0(0x11f)]('\x0a'+a26_0xa1756e['bold'](_0x4c41a0(0x12f))+'\x20'+_0x12fb87['name']),console[_0x4c41a0(0x11f)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x12fb87),console[_0x4c41a0(0x11f)]('─'['repeat'](0x3c));if(_0x12fb87[_0x4c41a0(0xd9)][_0x4c41a0(0xd1)]>0x0){console[_0x4c41a0(0x11f)]('\x0a'+a26_0xa1756e[_0x4c41a0(0xdc)](_0x4c41a0(0xaa)));for(const _0x463ba9 of _0x12fb87['errors']){console[_0x4c41a0(0x11f)]('\x20\x20'+a26_0xa1756e['red']('•')+'\x20'+_0x463ba9);}}return _0x12fb87[_0x4c41a0(0xf5)]&&console['error']('\x0a'+a26_0xa1756e[_0x4c41a0(0xfd)]('✔')+_0x4c41a0(0x1fc)),_0x12fb87[_0x4c41a0(0xf5)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x1d7ac4(0x17e)]=a26_0x1d7ac4(0x185);['description']=a26_0x1d7ac4(0x215);async[a26_0x1d7ac4(0x16c)](_0x5bc00){const _0x2375e7=a26_0x1d7ac4,{options:_0x4ce109,args:_0x3196b6,tdx:_0x28f452}=_0x5bc00,_0x46a3d0=_0x3196b6[0x0]||_0x4ce109[_0x2375e7(0x178)];if(!_0x46a3d0)return showParentSegmentNotSetError(_0x2375e7(0x13a)+'\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 _0x1488fe=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x46a3d0+_0x2375e7(0x171),()=>_0x28f452['segment'][_0x2375e7(0x1a7)](_0x46a3d0),{'verbose':_0x4ce109[_0x2375e7(0xb2)]}),_0x3897e5=_0x1488fe[_0x2375e7(0x15b)],_0x53aa79=await withSpinner(_0x2375e7(0x21a)+_0x46a3d0+'\x27...',()=>_0x28f452['personalization'][_0x2375e7(0x12e)](_0x3897e5),{'verbose':_0x4ce109['verbose']}),_0x4d6558=_0x53aa79['data'];console['error']('✔\x20Found\x20'+_0x4d6558[_0x2375e7(0xd1)]+_0x2375e7(0x18c)+(_0x4d6558['length']!==0x1?'s':''));if(_0x4ce109[_0x2375e7(0xbe)]===_0x2375e7(0xd8)||_0x4ce109[_0x2375e7(0xbe)]===_0x2375e7(0x138))await handleSDKOutput(_0x4d6558,_0x4ce109);else{if(_0x4d6558['length']===0x0)console[_0x2375e7(0x92)](_0x2375e7(0x1ef)),console[_0x2375e7(0x11f)](a26_0xa1756e[_0x2375e7(0x1b4)](_0x2375e7(0x1d0)));else for(const _0x4031df of _0x4d6558){const _0x1c984a=_0x4031df[_0x2375e7(0x1d2)]?.[_0x2375e7(0xd1)]||0x0,_0x6255a8=_0x4031df[_0x2375e7(0x1c1)]?a26_0xa1756e[_0x2375e7(0x1e8)](_0x2375e7(0x21c)+_0x4031df[_0x2375e7(0x1c1)]):'',_0x415d17=a26_0xa1756e[_0x2375e7(0x1e8)]('\x20('+_0x1c984a+_0x2375e7(0x179)+(_0x1c984a!==0x1?'s':'')+')');console[_0x2375e7(0x92)]('\x20\x20'+_0x4031df['name']+_0x6255a8+_0x415d17),_0x4031df[_0x2375e7(0xea)]&&console[_0x2375e7(0x92)]('\x20\x20\x20\x20'+a26_0xa1756e['dim'](_0x4031df[_0x2375e7(0xea)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']='ps:pz:init';[a26_0x1d7ac4(0xea)]=a26_0x1d7ac4(0x128);async[a26_0x1d7ac4(0x16c)](_0x5503ae){const _0x28a42a=a26_0x1d7ac4,{options:_0x34d80f,args:_0x264cb8}=_0x5503ae,_0x12d856=_0x264cb8[0x0]||_0x34d80f[_0x28a42a(0x178)];if(!_0x12d856)return showParentSegmentNotSetError(_0x28a42a(0xfb)+_0x28a42a(0x1e2)),0x1;const _0x223f44=resolveYamlFile(_0x12d856);if(!existsSync(_0x223f44))return showFileNotFoundError(_0x223f44,_0x12d856),0x1;let _0x388676;try{_0x388676=readFileSync(_0x223f44,'utf-8');}catch(_0x1fcee8){const _0x423749=_0x1fcee8 instanceof Error?_0x1fcee8[_0x28a42a(0xab)]:String(_0x1fcee8);return console[_0x28a42a(0x11f)](_0x28a42a(0x12d)+_0x423749),0x1;}let _0x4d5168;try{_0x4d5168=parseDef(_0x388676);}catch(_0x2fdb08){const _0x4f2873=_0x2fdb08 instanceof Error?_0x2fdb08['message']:String(_0x2fdb08);return console[_0x28a42a(0x11f)](a26_0xa1756e[_0x28a42a(0xdc)](_0x28a42a(0x1f5)+_0x4f2873)),0x1;}if(_0x4d5168['personalization_services']&&_0x4d5168[_0x28a42a(0x1ab)]['length']>0x0)return console[_0x28a42a(0x11f)](a26_0xa1756e[_0x28a42a(0x13b)](_0x28a42a(0x151)+_0x223f44)),console[_0x28a42a(0x11f)](a26_0xa1756e[_0x28a42a(0x1e8)](_0x28a42a(0x203)+_0x4d5168[_0x28a42a(0x1ab)][_0x28a42a(0xd1)]+_0x28a42a(0x135))),0x1;!_0x4d5168[_0x28a42a(0xf3)]&&(_0x4d5168['realtime']={'events':[{'name':_0x28a42a(0x16a),'source_table':_0x28a42a(0x202)}],'attributes':[{'name':_0x28a42a(0x20b),'type':_0x28a42a(0x1e3)}],'id_stitching':{'primary_key':_0x4d5168[_0x28a42a(0xee)][_0x28a42a(0x12b)]===_0x28a42a(0xc5)?_0x28a42a(0xed):_0x28a42a(0x166)}});_0x4d5168[_0x28a42a(0x1ab)]=[{'name':'My\x20Service','description':'Personalization\x20service\x20description','trigger_event':_0x28a42a(0x16a),'sections':[{'name':_0x28a42a(0xa2),'criteria':_0x28a42a(0x19b),'attributes':[_0x28a42a(0x20b)]}]}];const _0x3e3e0c=serializeDef(_0x4d5168);return writeFileSync(_0x223f44,_0x3e3e0c,_0x28a42a(0xeb)),console[_0x28a42a(0x11f)](a26_0xa1756e[_0x28a42a(0xfd)]('✔')+_0x28a42a(0xf7)+a26_0xa1756e['cyan'](_0x223f44)),(!_0x4d5168[_0x28a42a(0xf3)]||_0x388676['indexOf'](_0x28a42a(0x13e))===-0x1)&&console[_0x28a42a(0x11f)](a26_0xa1756e[_0x28a42a(0xfd)]('✔')+_0x28a42a(0x18f)),console['error']('\x0a'+a26_0xa1756e[_0x28a42a(0x1e8)](_0x28a42a(0x10b))),console[_0x28a42a(0x11f)](_0x28a42a(0x152)+_0x223f44+_0x28a42a(0x1f8)),console[_0x28a42a(0x11f)](_0x28a42a(0x1f9)+a26_0xa1756e[_0x28a42a(0x1e8)]('tdx\x20ps\x20push\x20'+_0x12d856)+_0x28a42a(0xe1)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x561abc=a27_0x60f2;(function(_0x3a2066,_0x564d93){const _0x17b5ef=a27_0x60f2,_0x30cfb3=_0x3a2066();while(!![]){try{const _0x5fc809=-parseInt(_0x17b5ef(0x190))/0x1+parseInt(_0x17b5ef(0x199))/0x2+-parseInt(_0x17b5ef(0x1bc))/0x3+parseInt(_0x17b5ef(0x17d))/0x4*(-parseInt(_0x17b5ef(0x1a1))/0x5)+-parseInt(_0x17b5ef(0x175))/0x6+-parseInt(_0x17b5ef(0x1be))/0x7+parseInt(_0x17b5ef(0x1a3))/0x8;if(_0x5fc809===_0x564d93)break;else _0x30cfb3['push'](_0x30cfb3['shift']());}catch(_0x4efee1){_0x30cfb3['push'](_0x30cfb3['shift']());}}}(a27_0x4406,0xea7ab));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 a27_0x232fe3 from'node:path';function a27_0x60f2(_0x132427,_0x4fa86e){_0x132427=_0x132427-0x15c;const _0x4406f4=a27_0x4406();let _0x60f2e6=_0x4406f4[_0x132427];return _0x60f2e6;}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{buildSiteChoices}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 a27_0x4406(){const _0x25e4ed=['confirm','trim','us01','You\x20can\x20find\x20your\x20API\x20key\x20at:','Validating\x20API\x20key...','profile:remove','profile','length','\x20\x20-\x20','Profile\x20name\x20cannot\x20be\x20empty','VALID_KEYS','\x20Profile\x20\x27','getUserInfo','Failed\x20to\x20remove\x20profile:\x20','\x27\x20does\x20not\x20exist.','Default\x20profile\x20set\x20to:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20tdx\x20--profile\x20','3746049AMhHfS','yellow','7377356bzQwZq','description','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key:','\x20\x20(no\x20profiles\x20found)','Set\x20session\x20profile','includes','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Create\x20a\x20new\x20profile','red','tdx:\x20profile\x20set','\x27\x20removed\x20from\x20configuration','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','ERROR','llm_agent','logLevel','split','\x0aSaved\x20to:\x20','profile:set','\x27.\x0a\x0aValid\x20keys:\x20','Remove\x20a\x20profile','green','customSite','log','text','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','error','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','9352482fFnFYc','execute','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','API\x20key\x20cannot\x20be\x20empty','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Removal\x20cancelled','Session\x20profile\x20set\x20to:\x20','profile:create','2632ZTCcCN','tdx:\x20profile\x20create','\x20API\x20key\x20removed\x20from\x20system\x20keychain','site','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','validate','✗\x20Validation\x20failed:\x20','profileName','profile:use','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','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>','Site\x20was\x20not\x20changed.','tdx.json','status','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Enter\x20profile\x20name:','(cleared)','1796000rAwxba','join','Site\x20name\x20cannot\x20be\x20empty','session','Unknown\x20key\x20\x27','jobs','Enter\x20description\x20(optional):','test','warn','3125548jscIqf','name','\x27\x20updated:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Changing\x20site\x20to\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Enter\x20site\x20name:','14320WCRxSB','apiKey','55516024lsdhNn','message','\x0aSetup\x20cancelled','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'];a27_0x4406=function(){return _0x25e4ed;};return a27_0x4406();}import a27_0x40904d from'prompts';import a27_0x138f8f from'chalk';function validateProfileName(_0x21889d){const _0x384862=a27_0x60f2;if(!_0x21889d||!_0x21889d['trim']())return _0x384862(0x1b0);const _0xbfbd56=_0x21889d[_0x384862(0x1a8)]();if(!/^[a-zA-Z0-9_-]+$/[_0x384862(0x197)](_0xbfbd56))return _0x384862(0x174);if(profileExists(_0xbfbd56))return'Profile\x20\x27'+_0xbfbd56+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a27_0x561abc(0x17c);[a27_0x561abc(0x1bf)]=a27_0x561abc(0x15c);async[a27_0x561abc(0x176)](_0x4c5b1a){const _0x42bd27=a27_0x561abc,{options:_0x30d1b0,args:_0x47d380}=_0x4c5b1a;console[_0x42bd27(0x16d)](a27_0x138f8f['bold'](_0x42bd27(0x17e)));let _0x107bab;if(_0x47d380[_0x42bd27(0x1ae)]>0x0&&_0x47d380[0x0]){const _0x137d75=_0x47d380[0x0][_0x42bd27(0x1a8)](),_0x35413b=validateProfileName(_0x137d75);if(_0x35413b!==!![])return console[_0x42bd27(0x173)](a27_0x138f8f[_0x42bd27(0x15d)](_0x35413b)),0x1;_0x107bab=_0x137d75;}else{const _0x3e38de=await a27_0x40904d({'type':_0x42bd27(0x16e),'name':_0x42bd27(0x186),'message':_0x42bd27(0x18e),'validate':validateProfileName});if(!_0x3e38de[_0x42bd27(0x186)])return console[_0x42bd27(0x16d)](_0x42bd27(0x1a5)),0x1;_0x107bab=_0x3e38de['profileName']['trim']();}const _0x3d68b8=await a27_0x40904d({'type':_0x42bd27(0x16e),'name':_0x42bd27(0x1bf),'message':_0x42bd27(0x196)}),_0x422bfb=_0x3d68b8[_0x42bd27(0x1bf)]?.[_0x42bd27(0x1a8)]()||undefined,_0x50a8d8=_0x30d1b0['site']||'us01',{choices:_0x4e9d99,initialIndex:_0x15ddfd}=buildSiteChoices(_0x50a8d8),_0x17bdf9=await a27_0x40904d({'type':'select','name':'site','message':_0x42bd27(0x172)+_0x107bab+'\x27:','choices':_0x4e9d99,'initial':_0x15ddfd});if(!_0x17bdf9[_0x42bd27(0x180)])return console[_0x42bd27(0x16d)](_0x42bd27(0x1a5)),0x1;let _0x373ea6;if(_0x17bdf9['site']==='other'){const _0x3564a9=await a27_0x40904d({'type':_0x42bd27(0x16e),'name':_0x42bd27(0x16c),'message':_0x42bd27(0x1a0),'initial':_0x42bd27(0x1a9),'validate':_0x4f5dc2=>{const _0x199cbb=_0x42bd27;if(!_0x4f5dc2||!_0x4f5dc2[_0x199cbb(0x1a8)]())return _0x199cbb(0x192);if(!/^[a-z0-9-]+$/['test'](_0x4f5dc2[_0x199cbb(0x1a8)]()))return _0x199cbb(0x177);return!![];}});if(!_0x3564a9[_0x42bd27(0x16c)])return console[_0x42bd27(0x16d)]('\x0aSetup\x20cancelled'),0x1;_0x373ea6=_0x3564a9[_0x42bd27(0x16c)];}else _0x373ea6=_0x17bdf9['site'];const _0x43de12=resolveSite(_0x373ea6);console[_0x42bd27(0x16d)](_0x42bd27(0x1a6)+_0x43de12),console[_0x42bd27(0x16d)](_0x42bd27(0x1aa)),console['log']('\x20\x20'+getConsoleUrl(_0x43de12,_0x42bd27(0x1c0)));const _0x533014=await a27_0x40904d({'type':'password','name':_0x42bd27(0x1a2),'message':_0x42bd27(0x1c1),'validate':_0x401506=>{const _0x27ab45=_0x42bd27;if(!_0x401506||!_0x401506[_0x27ab45(0x1a8)]())return _0x27ab45(0x178);return!![];}});if(!_0x533014[_0x42bd27(0x1a2)])return console[_0x42bd27(0x16d)]('\x0aSetup\x20cancelled'),0x1;const _0x2e7fa4=_0x533014['apiKey'];console[_0x42bd27(0x16d)]('Validating\x20API\x20key...');try{const _0x4b445d=TDX[_0x42bd27(0x1b8)]({'site':_0x43de12,'apiKey':_0x2e7fa4[_0x42bd27(0x1a8)](),'logLevel':_0x30d1b0[_0x42bd27(0x165)]??LogLevel['ERROR']}),_0x13dab9=await _0x4b445d[_0x42bd27(0x195)]['getUserInfo']();console['log'](a27_0x138f8f[_0x42bd27(0x16b)]('✓')+_0x42bd27(0x1ba)+_0x13dab9['email']+')');const _0x10f699=await isKeychainAvailable();_0x10f699?(await saveAPIKeyAsync(_0x2e7fa4[_0x42bd27(0x1a8)](),_0x43de12,_0x107bab),console[_0x42bd27(0x16d)](a27_0x138f8f[_0x42bd27(0x16b)]('✓')+_0x42bd27(0x19f)+_0x107bab+')')):(console[_0x42bd27(0x198)](a27_0x138f8f[_0x42bd27(0x1bd)](_0x42bd27(0x171))),console[_0x42bd27(0x198)](a27_0x138f8f[_0x42bd27(0x1bd)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x2030b1={'site':_0x43de12,..._0x422bfb&&{'description':_0x422bfb}};return saveProfileToUserConfig(_0x107bab,_0x2030b1),console[_0x42bd27(0x16d)](a27_0x138f8f[_0x42bd27(0x16b)]('✓')+_0x42bd27(0x1b2)+_0x107bab+'\x27\x20created'),console[_0x42bd27(0x16d)](),console['log'](_0x42bd27(0x188)),console[_0x42bd27(0x16d)](_0x42bd27(0x1bb)+_0x107bab+_0x42bd27(0x170)),console['log'](_0x42bd27(0x1bb)+_0x107bab+_0x42bd27(0x160)),0x0;}catch(_0xdcd3c3){if(_0xdcd3c3 instanceof HTTPClientError&&_0xdcd3c3[_0x42bd27(0x18c)]===0x191)return printAuthError(_0xdcd3c3),0x1;return console[_0x42bd27(0x173)](a27_0x138f8f[_0x42bd27(0x15d)](_0x42bd27(0x185)+(_0xdcd3c3 instanceof Error?_0xdcd3c3[_0x42bd27(0x1a4)]:String(_0xdcd3c3)))),console['error'](_0x42bd27(0x1c5)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a27_0x561abc(0x1ac);[a27_0x561abc(0x1bf)]=a27_0x561abc(0x16a);['validate'](_0x17e758){const _0x1617d3=a27_0x561abc,{args:_0x4392fc}=_0x17e758;if(_0x4392fc['length']===0x0)return _0x1617d3(0x19e);return undefined;}async[a27_0x561abc(0x176)](_0x55f364){const _0x34d0f7=a27_0x561abc,{args:_0x362554}=_0x55f364,_0x50fb6a=_0x362554[0x0];console[_0x34d0f7(0x16d)](a27_0x138f8f['bold']('tdx:\x20profile\x20remove'));if(!profileExists(_0x50fb6a)){console['error'](a27_0x138f8f['red']('Profile\x20\x27'+_0x50fb6a+'\x27\x20does\x20not\x20exist.')),console[_0x34d0f7(0x16d)](_0x34d0f7(0x182));const _0x24f168=listProfiles();if(_0x24f168[_0x34d0f7(0x1ae)]===0x0)console['log'](_0x34d0f7(0x1c2));else for(const _0x175a29 of _0x24f168){console[_0x34d0f7(0x16d)](_0x34d0f7(0x1af)+_0x175a29[_0x34d0f7(0x19a)]);}return 0x1;}const _0x54ed96=await a27_0x40904d({'type':_0x34d0f7(0x1a7),'name':_0x34d0f7(0x1a7),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x50fb6a+'\x27?','initial':![]});if(!_0x54ed96[_0x34d0f7(0x1a7)])return console['log'](_0x34d0f7(0x17a)),0x0;try{removeProfileFromUserConfig(_0x50fb6a),console[_0x34d0f7(0x16d)](a27_0x138f8f[_0x34d0f7(0x16b)]('✓')+_0x34d0f7(0x1b2)+_0x50fb6a+_0x34d0f7(0x15f));}catch(_0x3e83f2){return console[_0x34d0f7(0x173)](a27_0x138f8f[_0x34d0f7(0x15d)](_0x34d0f7(0x1b4)+(_0x3e83f2 instanceof Error?_0x3e83f2[_0x34d0f7(0x1a4)]:String(_0x3e83f2)))),0x1;}const _0x377ae4=await isKeychainAvailable();if(_0x377ae4){const _0x236f33=await deleteKeychainAPIKey(_0x50fb6a);_0x236f33&&console[_0x34d0f7(0x16d)](a27_0x138f8f['green']('✓')+_0x34d0f7(0x17f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x561abc(0x19a)]=a27_0x561abc(0x168);[a27_0x561abc(0x1bf)]='Set\x20a\x20profile\x20configuration\x20value';static [a27_0x561abc(0x1b1)]=[a27_0x561abc(0x180),a27_0x561abc(0x162),'parent_segment','llm_project',a27_0x561abc(0x164),'description'];[a27_0x561abc(0x184)](_0x5ec9e7){const _0xcf81d7=a27_0x561abc,{args:_0x3561b3,options:_0x470b57}=_0x5ec9e7,_0x12243e=_0x470b57['profile']||getActiveProfile();if(!_0x12243e)return _0xcf81d7(0x189);if(_0x3561b3['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xcf81d7(0x1b1)]['join'](',\x20');const _0x1e484a=_0x3561b3[0x0];if(!_0x1e484a[_0xcf81d7(0x1c4)]('='))return _0xcf81d7(0x161)+ProfileSetCommand[_0xcf81d7(0x1b1)][_0xcf81d7(0x191)](',\x20');const [_0x32bb3c]=_0x1e484a[_0xcf81d7(0x166)]('=',0x2);if(!ProfileSetCommand[_0xcf81d7(0x1b1)][_0xcf81d7(0x1c4)](_0x32bb3c))return _0xcf81d7(0x194)+_0x32bb3c+_0xcf81d7(0x169)+ProfileSetCommand[_0xcf81d7(0x1b1)][_0xcf81d7(0x191)](',\x20');return undefined;}async[a27_0x561abc(0x176)](_0x2a1a7c){const _0x229bf1=a27_0x561abc,{args:_0x1010a6,options:_0x588524}=_0x2a1a7c,_0x5e14e5=_0x588524[_0x229bf1(0x1ad)]||getActiveProfile(),[_0x2dc42f,..._0x7de9d8]=_0x1010a6[0x0]['split']('='),_0x343c81=_0x7de9d8[_0x229bf1(0x191)]('=');console[_0x229bf1(0x16d)](a27_0x138f8f['bold'](_0x229bf1(0x15e)));if(!profileExists(_0x5e14e5)){const _0x312f6c=await a27_0x40904d({'type':_0x229bf1(0x1a7),'name':_0x229bf1(0x1b8),'message':'Profile\x20\x27'+_0x5e14e5+_0x229bf1(0x181),'initial':!![]});if(!_0x312f6c[_0x229bf1(0x1b8)])return console[_0x229bf1(0x16d)]('Operation\x20cancelled'),0x1;}const _0xd5dcea=loadProfile(_0x5e14e5),_0x27cf2f=_0xd5dcea?.['config']||{};if(_0x2dc42f==='site'){const _0x3d44ea=resolveSite(_0x343c81);console['log'](_0x229bf1(0x19d)+_0x3d44ea+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x229bf1(0x16d)](_0x229bf1(0x1b7)),console[_0x229bf1(0x16d)]('\x20\x20'+getConsoleUrl(_0x3d44ea,'/app/mp/ak'));const _0xed1036=await a27_0x40904d({'type':'password','name':_0x229bf1(0x1a2),'message':_0x229bf1(0x18d),'validate':_0x6b9f2c=>{const _0x882443=_0x229bf1;if(!_0x6b9f2c||!_0x6b9f2c[_0x882443(0x1a8)]())return _0x882443(0x178);return!![];}});if(!_0xed1036['apiKey'])return console['log'](_0x229bf1(0x183)),0x1;console['log'](_0x229bf1(0x1ab));try{const _0x39a0b0=TDX[_0x229bf1(0x1b8)]({'site':_0x3d44ea,'apiKey':_0xed1036['apiKey']['trim'](),'logLevel':_0x588524[_0x229bf1(0x165)]??LogLevel[_0x229bf1(0x163)]}),_0x25d135=await _0x39a0b0[_0x229bf1(0x195)][_0x229bf1(0x1b3)]();console[_0x229bf1(0x16d)](a27_0x138f8f[_0x229bf1(0x16b)]('✓')+_0x229bf1(0x1ba)+_0x25d135['email']+')');const _0x4f8087=await isKeychainAvailable();_0x4f8087?(await saveAPIKeyAsync(_0xed1036[_0x229bf1(0x1a2)]['trim'](),_0x3d44ea,_0x5e14e5),console[_0x229bf1(0x16d)](a27_0x138f8f[_0x229bf1(0x16b)]('✓')+_0x229bf1(0x179))):console['warn'](a27_0x138f8f[_0x229bf1(0x1bd)](_0x229bf1(0x171))),_0x27cf2f['site']=_0x3d44ea;}catch(_0x442fd5){if(_0x442fd5 instanceof HTTPClientError&&_0x442fd5[_0x229bf1(0x18c)]===0x191)return printAuthError(_0x442fd5),0x1;return console[_0x229bf1(0x173)](a27_0x138f8f[_0x229bf1(0x15d)](_0x229bf1(0x185)+(_0x442fd5 instanceof Error?_0x442fd5[_0x229bf1(0x1a4)]:String(_0x442fd5)))),console[_0x229bf1(0x173)](_0x229bf1(0x18a)),0x1;}}else _0x27cf2f[_0x2dc42f]=_0x343c81||undefined;return saveProfileToUserConfig(_0x5e14e5,_0x27cf2f),console['log'](a27_0x138f8f['green']('✓')+_0x229bf1(0x1b2)+_0x5e14e5+_0x229bf1(0x19b)+_0x2dc42f+'='+(_0x343c81||_0x229bf1(0x18f))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x561abc(0x19a)]=a27_0x561abc(0x187);['description']=a27_0x561abc(0x1c3);[a27_0x561abc(0x184)](_0x46597a){const _0x37c5a3=a27_0x561abc,{args:_0x19905c}=_0x46597a;if(_0x19905c[_0x37c5a3(0x1ae)]===0x0)return _0x37c5a3(0x19c);return undefined;}async[a27_0x561abc(0x176)](_0x38d9e1){const _0x43bc93=a27_0x561abc,{args:_0x3b9ec2,options:_0x41cf06}=_0x38d9e1,_0x344fca=_0x3b9ec2[0x0],_0x59fe7a=_0x41cf06['default'];cleanExpiredSessions();if(!profileExists(_0x344fca)){console[_0x43bc93(0x173)](a27_0x138f8f['red'](_0x43bc93(0x16f)+_0x344fca+_0x43bc93(0x1b5))),console[_0x43bc93(0x16d)](_0x43bc93(0x182));const _0x1df39e=listProfiles();if(_0x1df39e[_0x43bc93(0x1ae)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x27fdf7 of _0x1df39e){console['log'](_0x43bc93(0x1af)+_0x27fdf7[_0x43bc93(0x19a)]);}return 0x1;}if(_0x59fe7a){const _0x47c27c=a27_0x232fe3[_0x43bc93(0x191)](getConfigDir(),_0x43bc93(0x18b));return saveActiveProfileToUserConfig(_0x344fca),console[_0x43bc93(0x16d)](_0x43bc93(0x1b6)+a27_0x138f8f[_0x43bc93(0x16b)](_0x344fca)),console[_0x43bc93(0x16d)](a27_0x138f8f['dim'](_0x43bc93(0x167)+_0x47c27c)),0x0;}const _0x1b6523=getSessionID(_0x41cf06[_0x43bc93(0x193)]);return saveSessionContext({'profile':_0x344fca},_0x41cf06[_0x43bc93(0x193)]),console[_0x43bc93(0x16d)](_0x43bc93(0x17b)+a27_0x138f8f[_0x43bc93(0x16b)](_0x344fca)+'\x20'+a27_0x138f8f['dim']('(session:\x20'+_0x1b6523+')')),console[_0x43bc93(0x16d)](a27_0x138f8f['dim'](_0x43bc93(0x1b9)+_0x344fca+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
1
|
+
const a27_0x2bffa7=a27_0x515d;(function(_0x47beb3,_0x117a16){const _0x5de47f=a27_0x515d,_0x54aa53=_0x47beb3();while(!![]){try{const _0xfd3cbc=-parseInt(_0x5de47f(0x95))/0x1*(-parseInt(_0x5de47f(0x86))/0x2)+-parseInt(_0x5de47f(0x79))/0x3*(-parseInt(_0x5de47f(0xce))/0x4)+parseInt(_0x5de47f(0xd7))/0x5*(parseInt(_0x5de47f(0xbf))/0x6)+-parseInt(_0x5de47f(0xb1))/0x7*(-parseInt(_0x5de47f(0xa9))/0x8)+parseInt(_0x5de47f(0xad))/0x9+parseInt(_0x5de47f(0x94))/0xa+-parseInt(_0x5de47f(0xcf))/0xb*(parseInt(_0x5de47f(0xd3))/0xc);if(_0xfd3cbc===_0x117a16)break;else _0x54aa53['push'](_0x54aa53['shift']());}catch(_0xc42b93){_0x54aa53['push'](_0x54aa53['shift']());}}}(a27_0x5143,0xcc00e));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 a27_0x267fff 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{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a27_0x5143(){const _0x572acc=['select','apiKey','length','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>','✗\x20Validation\x20failed:\x20','Removal\x20cancelled','Enter\x20site\x20name:','message','profile','name','\x27\x20updated:\x20','VALID_KEYS','dim','6496bSlycY','warn','/app/mp/ak','red','2706867BzsilM','password','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','6727ThMQXk','status','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Changing\x20site\x20to\x20\x27','\x27\x20does\x20not\x20exist.','getUserInfo','\x20Profile\x20\x27','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Site\x20name\x20cannot\x20be\x20empty','Enter\x20your\x20TD\x20API\x20key:','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Enter\x20description\x20(optional):','yellow','Set\x20session\x20profile','8868OWHMfm','confirm','Profile\x20\x27','bold','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','parent_segment','trim','create','\x27.\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','config','includes','\x20API\x20key\x20is\x20valid\x20(User:\x20','Remove\x20a\x20profile','\x27\x20removed\x20from\x20configuration','3560YjItcG','44737OQPnqo','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20set','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','7908fXcwEO','description','site','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','2170pecuDy','\x0aAvailable\x20profiles:','profile:create','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','email','profile:use','test','join','profileName','\x0aSetup\x20cancelled','\x20\x20-\x20','session','customSite','\x0aOperation\x20cancelled','profile:remove','3696FaDnyp','llm_project','logLevel','text','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Create\x20a\x20new\x20profile','log','tdx:\x20profile\x20create','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','validate','Profile\x20name\x20cannot\x20be\x20empty','2bXlXLh','ERROR','green','\x20\x20tdx\x20--profile\x20','split','profile:set','\x20\x20(no\x20profiles\x20found)','Unknown\x20key\x20\x27','database','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','error','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Session\x20profile\x20set\x20to:\x20','2686900rjdDET','428034AERFcA','execute','us01','Validating\x20API\x20key...','tdx:\x20profile\x20remove','tdx.json','Enter\x20profile\x20name:'];a27_0x5143=function(){return _0x572acc;};return a27_0x5143();}import{LogLevel}from'../utils/tdx-logger.js';import a27_0xf7f219 from'prompts';import a27_0x9b83f6 from'chalk';function validateProfileName(_0xbf723c){const _0x58c9ad=a27_0x515d;if(!_0xbf723c||!_0xbf723c[_0x58c9ad(0xc5)]())return _0x58c9ad(0x85);const _0x241654=_0xbf723c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x58c9ad(0x70)](_0x241654))return _0x58c9ad(0xb3);if(profileExists(_0x241654))return'Profile\x20\x27'+_0x241654+_0x58c9ad(0xbb);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x2bffa7(0xa5)]=a27_0x2bffa7(0x6c);[a27_0x2bffa7(0xd4)]=a27_0x2bffa7(0x7e);async['execute'](_0x395e83){const _0x453ce7=a27_0x2bffa7,{options:_0x27d91c,args:_0x497e36}=_0x395e83;console[_0x453ce7(0x7f)](a27_0x9b83f6[_0x453ce7(0xc2)](_0x453ce7(0x80)));let _0x44d34b;if(_0x497e36[_0x453ce7(0x9e)]>0x0&&_0x497e36[0x0]){const _0x233d1a=_0x497e36[0x0][_0x453ce7(0xc5)](),_0x8f48e6=validateProfileName(_0x233d1a);if(_0x8f48e6!==!![])return console[_0x453ce7(0x91)](a27_0x9b83f6[_0x453ce7(0xac)](_0x8f48e6)),0x1;_0x44d34b=_0x233d1a;}else{const _0x10cf4f=await a27_0xf7f219({'type':_0x453ce7(0x7c),'name':_0x453ce7(0x72),'message':_0x453ce7(0x9b),'validate':validateProfileName});if(!_0x10cf4f[_0x453ce7(0x72)])return console[_0x453ce7(0x7f)](_0x453ce7(0x73)),0x1;_0x44d34b=_0x10cf4f[_0x453ce7(0x72)][_0x453ce7(0xc5)]();}const _0x540657=await a27_0xf7f219({'type':'text','name':_0x453ce7(0xd4),'message':_0x453ce7(0xbc)}),_0x4fc29f=_0x540657['description']?.[_0x453ce7(0xc5)]()||undefined,_0x344f19=_0x27d91c['site']||'us01',{choices:_0x1f5014,initialIndex:_0x3ec2f9}=buildSiteChoices(_0x344f19),_0x24b1cb=await a27_0xf7f219({'type':_0x453ce7(0x9c),'name':'site','message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x44d34b+'\x27:','choices':_0x1f5014,'initial':_0x3ec2f9});if(!_0x24b1cb[_0x453ce7(0xd5)])return console[_0x453ce7(0x7f)](_0x453ce7(0x73)),0x1;let _0x4a8e7c;if(_0x24b1cb[_0x453ce7(0xd5)]==='other'){const _0x173314=await a27_0xf7f219({'type':_0x453ce7(0x7c),'name':'customSite','message':_0x453ce7(0xa2),'initial':_0x453ce7(0x97),'validate':_0x3c0416=>{const _0x39d7fd=_0x453ce7;if(!_0x3c0416||!_0x3c0416['trim']())return _0x39d7fd(0xb9);if(!/^[a-z0-9-]+$/['test'](_0x3c0416['trim']()))return _0x39d7fd(0x90);return!![];}});if(!_0x173314[_0x453ce7(0x76)])return console[_0x453ce7(0x7f)](_0x453ce7(0x73)),0x1;_0x4a8e7c=_0x173314['customSite'];}else _0x4a8e7c=_0x24b1cb[_0x453ce7(0xd5)];const _0x575054=resolveSite(_0x4a8e7c);console[_0x453ce7(0x7f)](_0x453ce7(0xb0)+_0x575054),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x575054,_0x453ce7(0xab)));const _0x46c2d4=await a27_0xf7f219({'type':_0x453ce7(0xae),'name':'apiKey','message':_0x453ce7(0xba),'validate':_0x17c6ea=>{const _0xf26b51=_0x453ce7;if(!_0x17c6ea||!_0x17c6ea[_0xf26b51(0xc5)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x46c2d4[_0x453ce7(0x9d)])return console[_0x453ce7(0x7f)](_0x453ce7(0x73)),0x1;const _0x3d3f56=_0x46c2d4[_0x453ce7(0x9d)];console[_0x453ce7(0x7f)](_0x453ce7(0x98));try{const _0x1b1966=TDX['create']({'site':_0x575054,'apiKey':_0x3d3f56[_0x453ce7(0xc5)](),'logLevel':_0x27d91c[_0x453ce7(0x7b)]??LogLevel[_0x453ce7(0x87)]}),_0x531075=await _0x1b1966['jobs'][_0x453ce7(0xb6)]();console[_0x453ce7(0x7f)](a27_0x9b83f6[_0x453ce7(0x88)]('✓')+_0x453ce7(0xcb)+_0x531075[_0x453ce7(0x6e)]+')');const _0x7e1a4b=await isKeychainAvailable();_0x7e1a4b?(await saveAPIKeyAsync(_0x3d3f56[_0x453ce7(0xc5)](),_0x575054,_0x44d34b),console[_0x453ce7(0x7f)](a27_0x9b83f6[_0x453ce7(0x88)]('✓')+_0x453ce7(0xd6)+_0x44d34b+')')):(console[_0x453ce7(0xaa)](a27_0x9b83f6[_0x453ce7(0xbd)](_0x453ce7(0xc8))),console[_0x453ce7(0xaa)](a27_0x9b83f6[_0x453ce7(0xbd)](_0x453ce7(0x6d))));const _0xd2d77f={'site':_0x575054,..._0x4fc29f&&{'description':_0x4fc29f}};return saveProfileToUserConfig(_0x44d34b,_0xd2d77f),console[_0x453ce7(0x7f)](a27_0x9b83f6[_0x453ce7(0x88)]('✓')+_0x453ce7(0xb7)+_0x44d34b+'\x27\x20created'),console[_0x453ce7(0x7f)](),console[_0x453ce7(0x7f)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x453ce7(0x7f)]('\x20\x20tdx\x20--profile\x20'+_0x44d34b+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x453ce7(0x89)+_0x44d34b+_0x453ce7(0xd0)),0x0;}catch(_0x285319){if(_0x285319 instanceof HTTPClientError&&_0x285319[_0x453ce7(0xb2)]===0x191)return printAuthError(_0x285319),0x1;return console[_0x453ce7(0x91)](a27_0x9b83f6[_0x453ce7(0xac)](_0x453ce7(0xa0)+(_0x285319 instanceof Error?_0x285319[_0x453ce7(0xa3)]:String(_0x285319)))),console[_0x453ce7(0x91)](_0x453ce7(0xd2)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a27_0x2bffa7(0x78);[a27_0x2bffa7(0xd4)]=a27_0x2bffa7(0xcc);[a27_0x2bffa7(0x84)](_0x46c3a4){const {args:_0x5bc616}=_0x46c3a4;if(_0x5bc616['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a27_0x2bffa7(0x96)](_0x2e114c){const _0xc38d90=a27_0x2bffa7,{args:_0xd1f485}=_0x2e114c,_0x1f69e6=_0xd1f485[0x0];console[_0xc38d90(0x7f)](a27_0x9b83f6['bold'](_0xc38d90(0x99)));if(!profileExists(_0x1f69e6)){console[_0xc38d90(0x91)](a27_0x9b83f6[_0xc38d90(0xac)](_0xc38d90(0xc1)+_0x1f69e6+_0xc38d90(0xb5))),console[_0xc38d90(0x7f)]('\x0aAvailable\x20profiles:');const _0x14f920=listProfiles();if(_0x14f920[_0xc38d90(0x9e)]===0x0)console[_0xc38d90(0x7f)](_0xc38d90(0x8c));else for(const _0x3c7be6 of _0x14f920){console[_0xc38d90(0x7f)](_0xc38d90(0x74)+_0x3c7be6[_0xc38d90(0xa5)]);}return 0x1;}const _0x34516c=await a27_0xf7f219({'type':_0xc38d90(0xc0),'name':_0xc38d90(0xc0),'message':_0xc38d90(0x7d)+_0x1f69e6+'\x27?','initial':![]});if(!_0x34516c[_0xc38d90(0xc0)])return console[_0xc38d90(0x7f)](_0xc38d90(0xa1)),0x0;try{removeProfileFromUserConfig(_0x1f69e6),console['log'](a27_0x9b83f6['green']('✓')+_0xc38d90(0xb7)+_0x1f69e6+_0xc38d90(0xcd));}catch(_0xe72016){return console['error'](a27_0x9b83f6[_0xc38d90(0xac)]('Failed\x20to\x20remove\x20profile:\x20'+(_0xe72016 instanceof Error?_0xe72016[_0xc38d90(0xa3)]:String(_0xe72016)))),0x1;}const _0x37267a=await isKeychainAvailable();if(_0x37267a){const _0x190a80=await deleteKeychainAPIKey(_0x1f69e6);_0x190a80&&console[_0xc38d90(0x7f)](a27_0x9b83f6['green']('✓')+_0xc38d90(0x81));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x2bffa7(0xa5)]=a27_0x2bffa7(0x8b);['description']='Set\x20a\x20profile\x20configuration\x20value';static [a27_0x2bffa7(0xa7)]=[a27_0x2bffa7(0xd5),a27_0x2bffa7(0x8e),a27_0x2bffa7(0xc4),a27_0x2bffa7(0x7a),'llm_agent',a27_0x2bffa7(0xd4)];[a27_0x2bffa7(0x84)](_0x37116d){const _0x2456cd=a27_0x2bffa7,{args:_0x3d9c2b,options:_0x54ab6c}=_0x37116d,_0x565e1c=_0x54ab6c[_0x2456cd(0xa4)]||getActiveProfile();if(!_0x565e1c)return _0x2456cd(0x9f);if(_0x3d9c2b[_0x2456cd(0x9e)]===0x0)return _0x2456cd(0x83)+ProfileSetCommand[_0x2456cd(0xa7)][_0x2456cd(0x71)](',\x20');const _0x141e89=_0x3d9c2b[0x0];if(!_0x141e89[_0x2456cd(0xca)]('='))return _0x2456cd(0x8f)+ProfileSetCommand[_0x2456cd(0xa7)]['join'](',\x20');const [_0x4f0a18]=_0x141e89[_0x2456cd(0x8a)]('=',0x2);if(!ProfileSetCommand[_0x2456cd(0xa7)]['includes'](_0x4f0a18))return _0x2456cd(0x8d)+_0x4f0a18+_0x2456cd(0xc7)+ProfileSetCommand[_0x2456cd(0xa7)][_0x2456cd(0x71)](',\x20');return undefined;}async[a27_0x2bffa7(0x96)](_0x314d01){const _0x2b69a4=a27_0x2bffa7,{args:_0x54a8b3,options:_0x58445b}=_0x314d01,_0x487589=_0x58445b[_0x2b69a4(0xa4)]||getActiveProfile(),[_0x1a50fa,..._0x4960ff]=_0x54a8b3[0x0]['split']('='),_0x19f76d=_0x4960ff[_0x2b69a4(0x71)]('=');console[_0x2b69a4(0x7f)](a27_0x9b83f6[_0x2b69a4(0xc2)](_0x2b69a4(0xd1)));if(!profileExists(_0x487589)){const _0x2632a9=await a27_0xf7f219({'type':_0x2b69a4(0xc0),'name':'create','message':_0x2b69a4(0xc1)+_0x487589+_0x2b69a4(0xb8),'initial':!![]});if(!_0x2632a9[_0x2b69a4(0xc6)])return console[_0x2b69a4(0x7f)]('Operation\x20cancelled'),0x1;}const _0xe3cd2=loadProfile(_0x487589),_0xf8ac43=_0xe3cd2?.[_0x2b69a4(0xc9)]||{};if(_0x1a50fa===_0x2b69a4(0xd5)){const _0x16dc80=resolveSite(_0x19f76d);console[_0x2b69a4(0x7f)](_0x2b69a4(0xb4)+_0x16dc80+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0x2b69a4(0xc3)),console[_0x2b69a4(0x7f)]('\x20\x20'+getConsoleUrl(_0x16dc80,_0x2b69a4(0xab)));const _0x54e736=await a27_0xf7f219({'type':'password','name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x570ad2=>{const _0x59c724=_0x2b69a4;if(!_0x570ad2||!_0x570ad2[_0x59c724(0xc5)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x54e736['apiKey'])return console[_0x2b69a4(0x7f)](_0x2b69a4(0x77)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x4c43dc=TDX['create']({'site':_0x16dc80,'apiKey':_0x54e736[_0x2b69a4(0x9d)][_0x2b69a4(0xc5)](),'logLevel':_0x58445b[_0x2b69a4(0x7b)]??LogLevel[_0x2b69a4(0x87)]}),_0x21d4ab=await _0x4c43dc['jobs'][_0x2b69a4(0xb6)]();console[_0x2b69a4(0x7f)](a27_0x9b83f6[_0x2b69a4(0x88)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x21d4ab['email']+')');const _0x5209f7=await isKeychainAvailable();_0x5209f7?(await saveAPIKeyAsync(_0x54e736[_0x2b69a4(0x9d)][_0x2b69a4(0xc5)](),_0x16dc80,_0x487589),console[_0x2b69a4(0x7f)](a27_0x9b83f6[_0x2b69a4(0x88)]('✓')+_0x2b69a4(0x92))):console['warn'](a27_0x9b83f6[_0x2b69a4(0xbd)](_0x2b69a4(0xc8))),_0xf8ac43[_0x2b69a4(0xd5)]=_0x16dc80;}catch(_0x3a25be){if(_0x3a25be instanceof HTTPClientError&&_0x3a25be[_0x2b69a4(0xb2)]===0x191)return printAuthError(_0x3a25be),0x1;return console[_0x2b69a4(0x91)](a27_0x9b83f6[_0x2b69a4(0xac)](_0x2b69a4(0xa0)+(_0x3a25be instanceof Error?_0x3a25be[_0x2b69a4(0xa3)]:String(_0x3a25be)))),console[_0x2b69a4(0x91)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0xf8ac43[_0x1a50fa]=_0x19f76d||undefined;return saveProfileToUserConfig(_0x487589,_0xf8ac43),console[_0x2b69a4(0x7f)](a27_0x9b83f6['green']('✓')+_0x2b69a4(0xb7)+_0x487589+_0x2b69a4(0xa6)+_0x1a50fa+'='+(_0x19f76d||'(cleared)')),0x0;}}function a27_0x515d(_0x2c09be,_0x19d16a){_0x2c09be=_0x2c09be-0x6c;const _0x51433b=a27_0x5143();let _0x515d91=_0x51433b[_0x2c09be];return _0x515d91;}export class ProfileUseCommand extends BaseCommand{[a27_0x2bffa7(0xa5)]=a27_0x2bffa7(0x6f);[a27_0x2bffa7(0xd4)]=a27_0x2bffa7(0xbe);[a27_0x2bffa7(0x84)](_0x2e6409){const _0x370904=a27_0x2bffa7,{args:_0x24602b}=_0x2e6409;if(_0x24602b[_0x370904(0x9e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0xa2300e){const _0x3ee808=a27_0x2bffa7,{args:_0x29ab58,options:_0x648843}=_0xa2300e,_0x2fc602=_0x29ab58[0x0],_0x123cb3=_0x648843['default'];cleanExpiredSessions();if(!profileExists(_0x2fc602)){console['error'](a27_0x9b83f6[_0x3ee808(0xac)]('Profile\x20\x27'+_0x2fc602+_0x3ee808(0xb5))),console[_0x3ee808(0x7f)](_0x3ee808(0xd8));const _0x32ea87=listProfiles();if(_0x32ea87['length']===0x0)console[_0x3ee808(0x7f)](_0x3ee808(0x8c));else for(const _0x212177 of _0x32ea87){console['log'](_0x3ee808(0x74)+_0x212177['name']);}return 0x1;}if(_0x123cb3){const _0x40b671=a27_0x267fff[_0x3ee808(0x71)](getConfigDir(),_0x3ee808(0x9a));return saveActiveProfileToUserConfig(_0x2fc602),console[_0x3ee808(0x7f)](_0x3ee808(0x82)+a27_0x9b83f6[_0x3ee808(0x88)](_0x2fc602)),console[_0x3ee808(0x7f)](a27_0x9b83f6[_0x3ee808(0xa8)]('\x0aSaved\x20to:\x20'+_0x40b671)),0x0;}const _0x3e5dd1=getSessionID(_0x648843[_0x3ee808(0x75)]);return saveSessionContext({'profile':_0x2fc602},_0x648843[_0x3ee808(0x75)]),console[_0x3ee808(0x7f)](_0x3ee808(0x93)+a27_0x9b83f6[_0x3ee808(0x88)](_0x2fc602)+'\x20'+a27_0x9b83f6[_0x3ee808(0xa8)]('(session:\x20'+_0x3e5dd1+')')),console[_0x3ee808(0x7f)](a27_0x9b83f6[_0x3ee808(0xa8)](_0x3ee808(0xaf)+_0x2fc602+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x3df87d=a28_0x2803;(function(_0x3c4dcc,_0x1985dd){const _0x1e52e2=a28_0x2803,_0x44784e=_0x3c4dcc();while(!![]){try{const _0x1a9e6d=parseInt(_0x1e52e2(0xf7))/0x1*(parseInt(_0x1e52e2(0xef))/0x2)+-parseInt(_0x1e52e2(0xf6))/0x3*(-parseInt(_0x1e52e2(0xf5))/0x4)+-parseInt(_0x1e52e2(0xfb))/0x5*(parseInt(_0x1e52e2(0xfe))/0x6)+parseInt(_0x1e52e2(0xf8))/0x7+parseInt(_0x1e52e2(0x100))/0x8+-parseInt(_0x1e52e2(0xf9))/0x9*(-parseInt(_0x1e52e2(0xf1))/0xa)+-parseInt(_0x1e52e2(0xf4))/0xb;if(_0x1a9e6d===_0x1985dd)break;else _0x44784e['push'](_0x44784e['shift']());}catch(_0x36f064){_0x44784e['push'](_0x44784e['shift']());}}}(a28_0x4a7a,0xd0f1a));function a28_0x4a7a(){const _0x454b43=['execute','List\x20all\x20available\x20profiles','18YAHBmc','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','7294168EsZDmD','scope','message','profiles','log','description','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','18EBZzzU','config','330NbiBYC','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','8608644qPjRHa','8kQFxTT','658083KfsuUM','14675XOOlDB','749504DqaheE','291987sFXhMq','name','1703035EqwXzj'];a28_0x4a7a=function(){return _0x454b43;};return a28_0x4a7a();}import{BaseCommand}from'./command.js';function a28_0x2803(_0xaf7d5b,_0x265715){_0xaf7d5b=_0xaf7d5b-0xea;const _0x4a7a73=a28_0x4a7a();let _0x280359=_0x4a7a73[_0xaf7d5b];return _0x280359;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x3df87d(0xfa)]=a28_0x3df87d(0xeb);[a28_0x3df87d(0xed)]=a28_0x3df87d(0xfd);async[a28_0x3df87d(0xfc)](_0x5873fe){const _0x2e7a33=a28_0x3df87d,{options:_0x3f263a}=_0x5873fe;try{const _0x1313d4=listProfiles(),_0x465739=getActiveProfile();if(_0x1313d4['length']===0x0)return console[_0x2e7a33(0xec)](_0x2e7a33(0xee)),console[_0x2e7a33(0xec)](_0x2e7a33(0xff)),console['log'](_0x2e7a33(0xf3)),0x0;const _0x5e1895=_0x1313d4[_0x2e7a33(0xf2)](_0x4a9230=>{const _0x55e799=_0x2e7a33,_0x423bd1=_0x4a9230[_0x55e799(0xfa)]===_0x465739,_0x898fdc=getProfileParams(_0x4a9230['config']);return{'name':_0x4a9230[_0x55e799(0xfa)],'active':_0x423bd1,'scope':_0x4a9230[_0x55e799(0x101)],'description':_0x4a9230[_0x55e799(0xf0)][_0x55e799(0xed)]||'','params':_0x898fdc};});return await handleSDKOutput(_0x5e1895,_0x3f263a),0x0;}catch(_0x2f2988){return _0x2f2988 instanceof Error&&console['error']('Error:\x20'+_0x2f2988[_0x2e7a33(0xea)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x499667=a29_0x229e;function a29_0x229e(_0x2ef778,_0x27a404){_0x2ef778=_0x2ef778-0xf7;const _0x41b16b=a29_0x41b1();let _0x229ecb=_0x41b16b[_0x2ef778];return _0x229ecb;}(function(_0x5166f7,_0x264971){const _0x6f3f86=a29_0x229e,_0x5b1fe4=_0x5166f7();while(!![]){try{const _0x1c2960=parseInt(_0x6f3f86(0x10a))/0x1+-parseInt(_0x6f3f86(0x101))/0x2*(parseInt(_0x6f3f86(0x104))/0x3)+parseInt(_0x6f3f86(0x122))/0x4+-parseInt(_0x6f3f86(0xf9))/0x5+parseInt(_0x6f3f86(0x105))/0x6+parseInt(_0x6f3f86(0xff))/0x7*(parseInt(_0x6f3f86(0x100))/0x8)+-parseInt(_0x6f3f86(0xfa))/0x9;if(_0x1c2960===_0x264971)break;else _0x5b1fe4['push'](_0x5b1fe4['shift']());}catch(_0x189247){_0x5b1fe4['push'](_0x5b1fe4['shift']());}}}(a29_0x41b1,0xdbc6d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a29_0x41b1(){const _0x55d2b2=['setExtra','state','Executing\x20query...','Error:\x20','287iZRxli','343072CqdtHA','62XLkuat','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','121827SqyYMT','3377064kHSXwr','No\x20SQL\x20provided','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','validate','message','96493mSHRbO','database','Schema:\x20','...','query','jobId','catalog','data','completedSplits','setPhase','file','\x20-\x20','name','error','originalMessage','Executing\x20statement\x20','Query\x20completed:\x20Processed\x20','length','information_schema','output','execute','Statement\x20','\x20rows\x20','push','3002316cXqrwb','Run\x20Trino\x20queries\x20(streaming)','setJobId','site','stats','2963565oYJpNd','3747267KrRwdQ'];a29_0x41b1=function(){return _0x55d2b2;};return a29_0x41b1();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x499667(0x116)]='query';['description']=a29_0x499667(0x123);async[a29_0x499667(0x11e)](_0x1084e1){const _0x13bb63=a29_0x499667,{options:_0x175d50,args:_0x2cd69f,tdx:_0x1afe63}=_0x1084e1,_0x3d5058=_0x2cd69f[0x0],_0x112fb7=_0x175d50[_0x13bb63(0x114)];let _0x56db19;try{if(_0x112fb7)_0x56db19=readSqlStatementsFromFile(_0x112fb7);else{if(_0x3d5058==='-')_0x56db19=await readSqlStatementsFromStdin();else{if(_0x3d5058&&isSqlFilePath(_0x3d5058))_0x56db19=readSqlStatementsFromFile(_0x3d5058);else{if(_0x3d5058)_0x56db19=splitSqlStatements(_0x3d5058);else throw new Error(_0x13bb63(0x106));}}}}catch(_0x40683f){return console[_0x13bb63(0x117)](_0x13bb63(0xfe)+_0x40683f[_0x13bb63(0x109)]),0x1;}const _0x119215=_0x175d50[_0x13bb63(0x10b)]||_0x13bb63(0x11c),_0x28ae9a=_0x175d50[_0x13bb63(0x110)];try{const _0x128a2c=[],_0x2eef90=!!_0x175d50[_0x13bb63(0x11d)];for(let _0x4e659a=0x0;_0x4e659a<_0x56db19['length'];_0x4e659a++){const _0x1c0973=_0x56db19[_0x4e659a],_0x2e5672=_0x4e659a+0x1,_0x5263c6=_0x56db19[_0x13bb63(0x11b)],_0x1aa36a=_0x5263c6>0x1;_0x175d50['verbose']&&(console[_0x13bb63(0x117)]('\x0a'+(_0x1aa36a?_0x13bb63(0x11f)+_0x2e5672+'/'+_0x5263c6+':':'')),console[_0x13bb63(0x117)]('Site:\x20'+_0x175d50[_0x13bb63(0xf7)]),console[_0x13bb63(0x117)]('Catalog:\x20'+(_0x28ae9a||'td')),console[_0x13bb63(0x117)](_0x13bb63(0x10c)+_0x119215),console['error']('SQL:\x20'+_0x1c0973));const _0xf8e8b0=_0x1aa36a?_0x13bb63(0x119)+_0x2e5672+'/'+_0x5263c6+_0x13bb63(0x10d):_0x13bb63(0xfd);try{const _0x56f195=await withProgressSpinner(_0xf8e8b0,async _0x4ddab0=>{const _0x24215a=_0x13bb63,_0x1f7332=await _0x1afe63[_0x24215a(0x10e)][_0x24215a(0x11e)](_0x1c0973,{'catalog':_0x28ae9a,'schema':_0x119215,'onJobId':_0x4f17fb=>{const _0x1edc9d=_0x24215a;_0x4ddab0[_0x1edc9d(0x124)](_0x4f17fb);},'onProgress':_0x457667=>{const _0x3fbbe1=_0x24215a;_0x4ddab0[_0x3fbbe1(0x113)](_0x3fbbe1(0x102)+_0x457667[_0x3fbbe1(0xfc)]+']'),_0x4ddab0[_0x3fbbe1(0xfb)](formatRows(_0x457667['processedRows'])+_0x3fbbe1(0x120)+_0x457667[_0x3fbbe1(0x112)]+'/'+_0x457667['totalSplits']+'\x20splits');}});return _0x1f7332;},{'verbose':_0x175d50['verbose']}),_0x2fe294=_0x56f195[_0x13bb63(0x111)],_0x3a189a=_0x2fe294[_0x13bb63(0x10f)]?'\x20[Job\x20ID:\x20'+_0x2fe294[_0x13bb63(0x10f)]+']':'',_0xaa34a0=_0x1aa36a?_0x13bb63(0x11f)+_0x2e5672+'/'+_0x5263c6+_0x13bb63(0x115):'';console[_0x13bb63(0x117)]('✔\x20'+_0xaa34a0+_0x13bb63(0x11a)+formatRows(_0x2fe294[_0x13bb63(0xf8)]['processedRows'])+_0x13bb63(0x120)+('in\x20'+formatElapsed(_0x2fe294[_0x13bb63(0xf8)]['elapsedTimeMillis'])+_0x3a189a));if(_0x1aa36a&&_0x2eef90){const _0xc589b6=resolveOutputOptions(_0x175d50),_0x130ae5=await formatQueryOutput(_0x2fe294,_0xc589b6);_0x128a2c[_0x13bb63(0x121)](_0x130ae5);}else await handleQueryOutput(_0x2fe294,_0x175d50);}catch(_0xcc4d83){const _0x32b98a=_0x1aa36a?_0x13bb63(0x11f)+_0x2e5672+'/'+_0x5263c6+':\x0a':'',_0x2b345c=_0xcc4d83 instanceof SDKError?_0xcc4d83[_0x13bb63(0x118)]:_0xcc4d83[_0x13bb63(0x109)];return console['error'](''+_0x32b98a+_0x2b345c),0x1;}}if(_0x56db19[_0x13bb63(0x11b)]>0x1&&_0x2eef90&&_0x128a2c[_0x13bb63(0x11b)]>0x0){const _0x3a98d8=_0x128a2c['join']('\x0a');writeFileSync(_0x175d50['output'],_0x3a98d8),console[_0x13bb63(0x117)](_0x13bb63(0x103)+_0x175d50[_0x13bb63(0x11d)]);}return 0x0;}catch(_0x1535dd){throw _0x1535dd;}}[a29_0x499667(0x108)](_0x764e5c){const _0x3b9fd4=a29_0x499667,_0x56a545=_0x764e5c['args'][0x0],_0x57b2ab=_0x764e5c['options'][_0x3b9fd4(0x114)];if(!_0x56a545&&!_0x57b2ab)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x56a545&&_0x57b2ab)return _0x3b9fd4(0x107);return undefined;}}
|