@treasuredata/tdx 0.28.1 → 0.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/agent/tool-target-registry.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/delivery-api-client.js +1 -1
  83. package/dist/sdk/client/endpoints.js +1 -1
  84. package/dist/sdk/client/engage-api-client.js +1 -1
  85. package/dist/sdk/client/http-client.js +1 -1
  86. package/dist/sdk/client/llm-api-client.js +1 -1
  87. package/dist/sdk/client/rate-limiter.js +1 -1
  88. package/dist/sdk/client/td-api-client.js +1 -1
  89. package/dist/sdk/client/trino-api-client.js +1 -1
  90. package/dist/sdk/client/workflow-client.js +1 -1
  91. package/dist/sdk/connection-validator.js +1 -1
  92. package/dist/sdk/connection.js +1 -1
  93. package/dist/sdk/delivery.js +1 -1
  94. package/dist/sdk/engage/campaign-pull.js +1 -1
  95. package/dist/sdk/engage/campaign-push.js +1 -1
  96. package/dist/sdk/engage/campaign-validator.js +1 -1
  97. package/dist/sdk/engage/campaign-yaml.js +1 -1
  98. package/dist/sdk/engage/types/campaign-def.js +1 -1
  99. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-factors.js +1 -1
  111. package/dist/sdk/personalization.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/realtime.js +1 -1
  115. package/dist/sdk/schedule.js +1 -1
  116. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  117. package/dist/sdk/segment/fields-display.js +1 -1
  118. package/dist/sdk/segment/file-discovery.js +1 -1
  119. package/dist/sdk/segment/journey-utils.js +1 -1
  120. package/dist/sdk/segment/journey-validator.d.ts.map +1 -1
  121. package/dist/sdk/segment/journey-validator.js +1 -1
  122. package/dist/sdk/segment/journey-validator.js.map +1 -1
  123. package/dist/sdk/segment/journey-yaml.js +1 -1
  124. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  125. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  126. package/dist/sdk/segment/pull-workflow.js +1 -1
  127. package/dist/sdk/segment/push-recovery.js +1 -1
  128. package/dist/sdk/segment/push-workflow.js +1 -1
  129. package/dist/sdk/segment/resolution-context.js +1 -1
  130. package/dist/sdk/segment/segment-path-parser.js +1 -1
  131. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  132. package/dist/sdk/segment/target-resolution.js +1 -1
  133. package/dist/sdk/segment/tdx-config.js +1 -1
  134. package/dist/sdk/segment/validate-files.js +1 -1
  135. package/dist/sdk/segment/yaml-validator.js +1 -1
  136. package/dist/sdk/segment.js +1 -1
  137. package/dist/sdk/types/index.js +1 -1
  138. package/dist/sdk/types/progress.js +1 -1
  139. package/dist/sdk/user.js +1 -1
  140. package/dist/sdk/util/format-detector.js +1 -1
  141. package/dist/sdk/util/formatters.js +1 -1
  142. package/dist/sdk/util/index.js +1 -1
  143. package/dist/sdk/util/tree-formatter.js +1 -1
  144. package/dist/sdk/workflow/archive-validation.js +1 -1
  145. package/dist/sdk/workflow/clone-workflow.js +1 -1
  146. package/dist/sdk/workflow/index.js +1 -1
  147. package/dist/sdk/workflow/pull-workflow.js +1 -1
  148. package/dist/sdk/workflow/push-workflow.js +1 -1
  149. package/dist/sdk/workflow/tdx-config.js +1 -1
  150. package/dist/sdk/workflow/workflow-utils.js +1 -1
  151. package/dist/test-utils/command-runner.js +1 -1
  152. package/dist/test-utils/factories.js +1 -1
  153. package/dist/test-utils/fixtures.js +1 -1
  154. package/dist/test-utils/http-mock.js +1 -1
  155. package/dist/test-utils/index.js +1 -1
  156. package/dist/utils/async.js +1 -1
  157. package/dist/utils/colors.js +1 -1
  158. package/dist/utils/diff.js +1 -1
  159. package/dist/utils/file-permissions.js +1 -1
  160. package/dist/utils/global-cache.js +1 -1
  161. package/dist/utils/json-loader.js +1 -1
  162. package/dist/utils/local-cache.js +1 -1
  163. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  164. package/dist/utils/logger/formatters/index.js +1 -1
  165. package/dist/utils/logger/handlers/console-handler.js +1 -1
  166. package/dist/utils/logger/handlers/file-handler.js +1 -1
  167. package/dist/utils/logger/handlers/index.js +1 -1
  168. package/dist/utils/logger/handlers/null-handler.js +1 -1
  169. package/dist/utils/logger/index.js +1 -1
  170. package/dist/utils/logger/logger.js +1 -1
  171. package/dist/utils/logger/types.js +1 -1
  172. package/dist/utils/option-validation.js +1 -1
  173. package/dist/utils/process.js +1 -1
  174. package/dist/utils/prompt.js +1 -1
  175. package/dist/utils/spinner.js +1 -1
  176. package/dist/utils/sse-parser.js +1 -1
  177. package/dist/utils/string-utils.js +1 -1
  178. package/dist/utils/table-ref-parser.js +1 -1
  179. package/dist/utils/tdx-logger.js +1 -1
  180. package/dist/utils/version-check.js +1 -1
  181. package/package.json +1 -1
@@ -1 +1 @@
1
- const a26_0xfc1857=a26_0x163a;(function(_0x1f2beb,_0x18e680){const _0x3827e0=a26_0x163a,_0x205f46=_0x1f2beb();while(!![]){try{const _0x35c7c8=-parseInt(_0x3827e0(0x289))/0x1*(-parseInt(_0x3827e0(0x153))/0x2)+-parseInt(_0x3827e0(0x1e4))/0x3+-parseInt(_0x3827e0(0x1bb))/0x4*(parseInt(_0x3827e0(0x1e8))/0x5)+-parseInt(_0x3827e0(0x192))/0x6*(parseInt(_0x3827e0(0x1fc))/0x7)+parseInt(_0x3827e0(0x274))/0x8*(parseInt(_0x3827e0(0x11a))/0x9)+-parseInt(_0x3827e0(0x275))/0xa+parseInt(_0x3827e0(0x10a))/0xb;if(_0x35c7c8===_0x18e680)break;else _0x205f46['push'](_0x205f46['shift']());}catch(_0x33f8f8){_0x205f46['push'](_0x205f46['shift']());}}}(a26_0x345d,0xa845d));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x12fa7a 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';function a26_0x345d(){const _0x3b0bc5=['\x20--enriched','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','keys','columns','Attributes','customerGroup','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Attribute:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20--behavior\x20\x22','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Master\x20+\x20Attributes','listFields','Error:\x20--attribute\x20requires\x20a\x20name\x0a','attributesFile','Master:','Listing\x20fields\x20for\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','\x0aChanges\x20to\x20apply\x20to\x20\x27','listParents','segment','/\x20directories\x20exist.','SELECT\x20*\x20FROM\x20','\x20\x20\x20\x20\x20\x20','\x20--attribute\x20\x22','green','events','Next\x20steps:','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','scheduleType','totalEvents','attributes','segment:parent:sql','workflowSessionId','Error:','enriched','Personalization\x20service\x20description','label','/app/dw/parentSegments/','FINISHED','behavior','124VxHFnB','Join:','jobId','schemaValid','in\x20','Source:','interval','segment:parent:desc','My\x20Service','population','\x0a⚠️\x20\x20Both\x20','behavior_','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','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','column_name','use','matchedCount','Options:','pushParentYaml','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','cyan','-1d','Fetching\x20customers\x20schema...','valid','endsWith','localeCompare','primaryKey','limit','Options\x20(one\x20required):\x0a','segment:parent:view','tdx\x20ps\x20preview\x20','\x22,\x20\x22type\x22:\x20\x22','\x20--interval\x20','list','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','data','getParentFull','👥\x20','RT\x202.0:','json','getBehaviorNames','\x20Added\x20RT\x202.0\x20template\x20section','Output\x20file:\x20','No\x20personalization\x20services\x20configured','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','unref','\x20trigger=','⚡\x20Enabled','dirname','addBehaviors','\x20=\x20','\x0aChanges\x20to\x20\x27','text','scheduleOption','ps:rt:validate','\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','indexOf','Error:\x20File\x20not\x20found:\x20','length','Schema\x20saved\x20to\x20','run','idStitching','customerGroupFile','5776044aBilfD','ps:rt:list','stats','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x5c$&','\x20\x202.\x20Run\x20','Creating','resolveParentId','format','setJobId','\x20rows)','execute','column','map','segment:parent:fields','Validating\x20configuration...','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Updating\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Analyzing\x20changes...','personalization_services','/sessions/','sampleData','displaySummary','\x27\x20is\x20up\x20to\x20date','Apply\x20changes\x20to\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','.customers)','sections','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Fetching\x20behavior\x20list...','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','test','\x20parent\x20segment','sort','sourceTableValid','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','master','4wpeaqH','Errors:','audienceId','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','bold','✔\x20No\x20changes\x20-\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','toFixed','.yml','SQL\x20query:\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20to\x20push\x20the\x20configuration','\x20parent\x20segment\x20\x27','parentSegment','displayBehaviorsStats','Error\x20parsing\x20YAML:\x20','addAttributes','segment:parent:update','\x20\x20Columns:\x20','joinKey','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20field','✔\x20Renamed\x20directory\x20to\x20','ps:pz:init','Updated','collectSchema','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20\x20\x20\x20','pullParentYaml','name','segment:parent:list','✔\x20Created\x20parent\x20segment\x20\x27','Database:\x20','Rows:','\x27\x20and\x20run\x20workflow?','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x20\x20No\x20sample\x20data\x20available','formatSchemaJson','ID\x20Stitching:','rowCount','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','3546894AhtOpJ','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0a⚠️\x20\x20Migrating:\x20','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','4356845bnOeru','getOutputDatabaseName','segment:parent:show','single','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','realtime:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','apply','Join\x20on:','all','stop','Available\x20attributes:','xdg-open','user_id','errors','session','behaviors','7qrZRDg','Aborted.','To\x20view\x20sample\x20data:','reduce','match','\x20kill','customerPercent','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x22\x20}','segment:parent:run','customers','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','getParentSQL','\x20configured','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x0a\x20\x20\x20\x20]','information_schema','coveragePercent','yellow','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','enabled','error','Executing\x20parent\x20segment\x20query...','behaviorsFile','\x27\x20is\x20already\x20up\x20to\x20date','addAttributesFile','\x20total','attribute','varchar','realtime','Output\x20Database:','Coverage:','createParent','segment:parent:validate','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','✔\x20Found\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Listing\x20personalization\x20services\x20for\x20\x27','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','/\x20→\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20RT-enabled\x20parent\x20segment','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20service','\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','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','join','timezone','site','addBehaviorsFile','\x0aUsage:\x20tdx\x20ps\x20preview\x20','type','No\x20parent\x20segments\x20match\x20pattern:\x20','Validating\x20RT\x20configuration...','\x27...','\x20Configuration\x20is\x20valid','Events:','segment:parent:preview','\x0a\x20\x20]\x0a}\x0a','RT\x202.0\x20Validate:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','personalizationServices','displayColumns','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','parent_segment','\x20Added\x20personalization\x20template\x20to\x20','filter','Available\x20behaviors:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','allValid','Listing\x20parent\x20segments...','Creating\x20parent\x20segment\x20\x27','start','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','/{name}.yml\x0a','database','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','isDirectory','Overwrite\x20\x27','status','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','displayRealtimeInfo','{\x0a\x20\x20\x22database\x22:\x20\x22','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','/app/workflows/','Customers:','Listing\x20RT-enabled\x20parent\x20segments...','displayMasterInfo','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','workflowAttemptId','Found\x20YAML\x20file:\x20','number','verbose','No\x20RT-enabled\x20parent\x20segments\x20found','push','yes','Enriched:','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Parent\x20segment:\x20','dim','using\x20the\x20default\x20path:\x20','parent_segments','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','description','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','schemaError','displaySampleData','Updating','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','workflowId','\x20is\x20already\x20up\x20to\x20date','parent_id','Site:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Behavior:','td_client_id','8dIQLFS','10303920rOOCbj','Fetching\x20parent\x20segment\x20\x27','/\x20directory.\x0a','Columns:','string','displayAttributesStats','\x20\x20Tables:\x201\x20customers\x20+\x20','true','runParent','\x0a\x20\x20\x20\x20}','column_type','stitchingKeys','message','\x20section','jsonl','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20\x20\x20-\x20','Error\x20reading\x20file:\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','13666CHLGcX','replace','Created','previewParentYaml','\x0aError:','Pattern:\x20','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','foreignKey','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20\x20','toLocaleString','✘\x20Failed\x20to\x20rename\x20directory:\x20','Status:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','page_view','segment:parent:create','✔\x20Updated\x20parent\x20segment\x20\x27','YAML\x20file:\x20','red','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','processedRows','List\x20parent\x20segments','utf-8','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Options:\x0a','29736047gzRnqY','log','displayPreviewHints','\x20behaviors','trigger_event','open','Error:\x20--database\x20and\x20--table\x20are\x20required','displayValidateResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Error:\x20Parent\x20segment\x20name\x20is\x20required','Default','.yaml','repeat','sourceTableError','10668681XaJyHX','\x20--behavior\x20\x22<name>\x22','platform','last_page_viewed','segment:parent:pull','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','Get\x20SQL\x20query\x20for\x20parent\x20segment','personalization','trim','toLowerCase','\x27\x20with\x20ID:\x20','output','⚡\x20Not\x20enabled','Fetching\x20SQL\x20for\x20\x27','table'];a26_0x345d=function(){return _0x3b0bc5;};return a26_0x345d();}import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';function a26_0x163a(_0x56918c,_0x188e4f){_0x56918c=_0x56918c-0x106;const _0x345dd7=a26_0x345d();let _0x163a4a=_0x345dd7[_0x56918c];return _0x163a4a;}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_0x220b9c 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_0xfc1857(0x265),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0xe81bf){const _0x3023ad=a26_0xfc1857,_0x10573c=process[_0x3023ad(0x11c)],_0xa3452c=_0x10573c==='darwin'?_0x3023ad(0x10f):_0x10573c==='win32'?_0x3023ad(0x246):_0x3023ad(0x1f7);spawn(_0xa3452c,[_0xe81bf],{'detached':!![],'stdio':'ignore'})[_0x3023ad(0x180)]();}function migrateLegacyDirectory(){const _0x29c3a6=a26_0xfc1857;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x585a1d=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x585a1d[_0x29c3a6(0x24c)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x29c3a6(0x211)](a26_0x220b9c[_0x29c3a6(0x20e)](_0x29c3a6(0x15d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x29c3a6(0x13f))),console[_0x29c3a6(0x211)](a26_0x220b9c['dim'](_0x29c3a6(0x20a)+LEGACY_PARENT_SEGMENT_DIR+_0x29c3a6(0x277))),![];console[_0x29c3a6(0x211)](a26_0x220b9c[_0x29c3a6(0x20e)](_0x29c3a6(0x1e6)+LEGACY_PARENT_SEGMENT_DIR+_0x29c3a6(0x224)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a26_0x220b9c[_0x29c3a6(0x143)](_0x29c3a6(0x1d1)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2d79f6){const _0x226227=_0x2d79f6 instanceof Error?_0x2d79f6['message']:String(_0x2d79f6);return console[_0x29c3a6(0x211)](a26_0x220b9c[_0x29c3a6(0x29b)](_0x29c3a6(0x294)+_0x226227+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0xfc1857(0x18f)](_0x5275d4){const _0x1b5a3f=a26_0xfc1857;return migrateLegacyDirectory(),super[_0x1b5a3f(0x18f)](_0x5275d4);}}function resolveYamlFile(_0x456be0){const _0x131963=a26_0xfc1857;if(_0x456be0[_0x131963(0x16b)](_0x131963(0x1c3))||_0x456be0['endsWith'](_0x131963(0x117)))return _0x456be0;return a26_0x12fa7a['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x456be0)+_0x131963(0x1c3));}function formatProgressMessage(_0x5cd585){const _0x46a60e=a26_0xfc1857,_0x25f154=_0x5cd585[_0x46a60e(0x200)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x25f154){const [,_0x19cf5e,_0x51adb4,_0x294b5c='']=_0x25f154;return a26_0x220b9c[_0x46a60e(0x263)](_0x19cf5e+':')+'\x20'+_0x51adb4+a26_0x220b9c[_0x46a60e(0x263)](_0x294b5c);}return a26_0x220b9c[_0x46a60e(0x263)](_0x5cd585);}function showFileNotFoundError(_0x1ef5f3,_0x28bf67){const _0x13ace0=a26_0xfc1857;console[_0x13ace0(0x211)](a26_0x220b9c['red'](_0x13ace0(0x18c)+_0x1ef5f3+'\x0a')),console[_0x13ace0(0x211)](a26_0x220b9c['cyan'](_0x13ace0(0x146)+_0x28bf67+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x4f3b9c){const _0x558746=a26_0xfc1857;if(!_0x4f3b9c[_0x558746(0x219)])return;const _0x268067=_0x4f3b9c[_0x558746(0x219)],_0x2a42e5=_0x268067[_0x558746(0x210)]?a26_0x220b9c[_0x558746(0x143)](_0x558746(0x182)):a26_0x220b9c['yellow'](_0x558746(0x126));console[_0x558746(0x211)]('\x0a'+a26_0x220b9c[_0x558746(0x263)](_0x558746(0x179))+'\x20'+_0x2a42e5);if(_0x268067['events']&&_0x268067[_0x558746(0x144)][_0x558746(0x18d)]>0x0){console[_0x558746(0x211)]('\x20\x20'+a26_0x220b9c[_0x558746(0x263)](_0x558746(0x236))+'\x20'+_0x268067[_0x558746(0x144)][_0x558746(0x18d)]+_0x558746(0x209));for(const _0x15e20b of _0x268067['events']){const _0x22e962=_0x15e20b[_0x558746(0x1b7)]===![]?a26_0x220b9c[_0x558746(0x29b)]('✘'):a26_0x220b9c['green']('✔');console[_0x558746(0x211)](_0x558746(0x1d6)+_0x22e962+'\x20'+_0x15e20b[_0x558746(0x1d8)]),_0x15e20b[_0x558746(0x119)]&&console[_0x558746(0x211)](_0x558746(0x141)+a26_0x220b9c[_0x558746(0x29b)](_0x15e20b['sourceTableError']));}}if(_0x268067[_0x558746(0x149)]&&_0x268067[_0x558746(0x149)][_0x558746(0x18d)]>0x0){console[_0x558746(0x211)]('\x20\x20'+a26_0x220b9c[_0x558746(0x263)](_0x558746(0x1b8))+'\x20'+_0x268067[_0x558746(0x149)][_0x558746(0x18d)]+'\x20configured');for(const _0x17e122 of _0x268067[_0x558746(0x149)]){const _0x365de5=_0x17e122[_0x558746(0x16a)]?a26_0x220b9c[_0x558746(0x143)]('✔'):a26_0x220b9c[_0x558746(0x29b)]('✘');console[_0x558746(0x211)](_0x558746(0x1d6)+_0x365de5+'\x20'+_0x17e122['name']+'\x20'+a26_0x220b9c[_0x558746(0x263)]('('+_0x17e122['type']+')'));}}if(_0x268067[_0x558746(0x190)]){const _0x55aabd=_0x268067[_0x558746(0x190)][_0x558746(0x280)]?.['length']?'\x20+\x20['+_0x268067[_0x558746(0x190)][_0x558746(0x280)][_0x558746(0x22c)](',\x20')+']':'';console[_0x558746(0x211)]('\x20\x20'+a26_0x220b9c[_0x558746(0x263)](_0x558746(0x1e1))+'\x20'+_0x268067[_0x558746(0x190)][_0x558746(0x16d)]+_0x55aabd);}if(_0x268067['personalizationServices']&&_0x268067[_0x558746(0x23b)][_0x558746(0x18d)]>0x0){console[_0x558746(0x211)]('\x20\x20'+a26_0x220b9c[_0x558746(0x263)]('Personalization:')+'\x20'+_0x268067['personalizationServices'][_0x558746(0x18d)]+_0x558746(0x228)+(_0x268067['personalizationServices']['length']!==0x1?'s':''));for(const _0x20dce8 of _0x268067[_0x558746(0x23b)]){console['error'](_0x558746(0x285)+_0x20dce8[_0x558746(0x1d8)]);}}}function showParentSegmentNotSetError(_0x39a33c){const _0x554de0=a26_0xfc1857;console[_0x554de0(0x211)](a26_0x220b9c['yellow'](_0x554de0(0x221))),console[_0x554de0(0x211)](_0x39a33c);}export class ParentSegmentListCommand extends BaseCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x1d9);[a26_0xfc1857(0x267)]=a26_0xfc1857(0x106);async[a26_0xfc1857(0x19d)](_0x2f1160){const _0x1066a6=a26_0xfc1857,{options:_0x21d487,args:_0x532bc4,tdx:_0x2be106}=_0x2f1160,_0x1ad6e2=_0x532bc4[0x0];_0x21d487['verbose']&&(console[_0x1066a6(0x211)](_0x1066a6(0x270)+_0x21d487['site']),_0x1ad6e2&&console[_0x1066a6(0x211)](_0x1066a6(0x28e)+_0x1ad6e2));const _0x4e0f0c=await withSpinner(_0x1ad6e2?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x1ad6e2+_0x1066a6(0x234):_0x1066a6(0x244),()=>_0x2be106[_0x1066a6(0x13e)][_0x1066a6(0x13d)](),{'verbose':_0x21d487[_0x1066a6(0x25c)]});let _0x1a60d0=_0x4e0f0c[_0x1066a6(0x176)];if(_0x1ad6e2){const _0x1b4132=_0x1ad6e2[_0x1066a6(0x28a)](/[.+^${}()|[\]\\]/g,_0x1066a6(0x196))[_0x1066a6(0x28a)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x373a24=new RegExp('^'+_0x1b4132+'$','i');_0x1a60d0=_0x1a60d0[_0x1066a6(0x240)](_0x56758d=>_0x373a24[_0x1066a6(0x1b4)](_0x56758d[_0x1066a6(0x149)][_0x1066a6(0x1d8)]));}_0x1a60d0[_0x1066a6(0x1b6)]((_0x4fb2a3,_0x2a5d4e)=>_0x4fb2a3[_0x1066a6(0x149)][_0x1066a6(0x1d8)][_0x1066a6(0x16c)](_0x2a5d4e[_0x1066a6(0x149)][_0x1066a6(0x1d8)])),console[_0x1066a6(0x211)](_0x1066a6(0x21f)+_0x1a60d0['length']+_0x1066a6(0x1b5)+(_0x1a60d0[_0x1066a6(0x18d)]!==0x1?'s':''));const _0x295c78=_0x5b0549=>{const _0x52f0eb=_0x1066a6;return getConsoleNextUrl(_0x21d487[_0x52f0eb(0x22e)],_0x52f0eb(0x150)+_0x5b0549);};if(_0x21d487[_0x1066a6(0x19a)]==='json'||_0x21d487['format']===_0x1066a6(0x283)){const _0x3cf3a4=_0x1a60d0[_0x1066a6(0x19f)](_0x52b1f2=>({..._0x52b1f2,'url':_0x295c78(_0x52b1f2['id'])}));await handleSDKOutput(_0x3cf3a4,_0x21d487);}else{if(_0x1a60d0[_0x1066a6(0x18d)]===0x0)_0x1ad6e2?console[_0x1066a6(0x10b)](_0x1066a6(0x232)+_0x1ad6e2):console[_0x1066a6(0x10b)]('No\x20parent\x20segments\x20found');else for(const _0x1e057a of _0x1a60d0){const _0xc6879=_0x1e057a[_0x1066a6(0x149)][_0x1066a6(0x15c)]?a26_0x220b9c[_0x1066a6(0x263)]('\x20('+formatRows(_0x1e057a[_0x1066a6(0x149)][_0x1066a6(0x15c)])+')'):'',_0x549c37=hyperlink(_0x1e057a[_0x1066a6(0x149)][_0x1066a6(0x1d8)],_0x295c78(_0x1e057a['id']));console['log'](_0x1066a6(0x178)+_0x549c37+_0xc6879);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x298);['description']='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x54eae9){const _0x373a15=a26_0xfc1857,{options:_0x2bbdf1,args:_0x4c7118,tdx:_0x209ab6}=_0x54eae9;console['error'](_0x373a15(0x195)+_0x373a15(0x24f)+_0x373a15(0x1ee));const _0x34a8b1=_0x2bbdf1;if(_0x4c7118[_0x373a15(0x18d)]===0x0)return console['error'](a26_0x220b9c['red'](_0x373a15(0x115))),console[_0x373a15(0x211)](_0x373a15(0x1ef)),0x1;const _0x4071a0=_0x4c7118[0x0];if(!_0x34a8b1[_0x373a15(0x249)]||!_0x34a8b1[_0x373a15(0x128)])return console[_0x373a15(0x211)](_0x373a15(0x110)),console[_0x373a15(0x211)](_0x373a15(0x1ef)),0x1;_0x34a8b1['verbose']&&(console[_0x373a15(0x211)]('Site:\x20'+_0x34a8b1['site']),console['error']('Name:\x20'+_0x4071a0),console[_0x373a15(0x211)](_0x373a15(0x1db)+_0x34a8b1[_0x373a15(0x249)]),console[_0x373a15(0x211)]('Table:\x20'+_0x34a8b1[_0x373a15(0x128)]));const _0x37f5d2=await loadJSONFromOptions(_0x34a8b1[_0x373a15(0x149)],_0x34a8b1[_0x373a15(0x138)]),_0x472b5e=await loadJSONFromOptions(_0x34a8b1[_0x373a15(0x1fb)],_0x34a8b1[_0x373a15(0x213)]),_0x365031=await loadJSONFromOptions(_0x34a8b1[_0x373a15(0x12e)],_0x34a8b1[_0x373a15(0x191)]),_0x4788cb={'name':_0x4071a0,'description':_0x34a8b1[_0x373a15(0x267)],'scheduleType':_0x34a8b1[_0x373a15(0x147)],'scheduleOption':_0x34a8b1[_0x373a15(0x188)],'timezone':_0x34a8b1['timezone'],'master':{'parentDatabaseName':_0x34a8b1[_0x373a15(0x249)],'parentTableName':_0x34a8b1[_0x373a15(0x128)]},'attributes':_0x37f5d2,'behaviors':_0x472b5e,'customerGroup':_0x365031},_0x42ebda=await withSpinner(_0x373a15(0x245)+_0x4071a0+_0x373a15(0x234),()=>_0x209ab6[_0x373a15(0x13e)][_0x373a15(0x21c)](_0x4788cb),{'verbose':_0x2bbdf1[_0x373a15(0x25c)]}),_0xa36117=_0x42ebda['data'];return console[_0x373a15(0x211)](_0x373a15(0x1da)+_0xa36117[_0x373a15(0x1d8)]+_0x373a15(0x124)+_0xa36117['id']),await handleSDKOutput([_0xa36117],_0x2bbdf1),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x1cc);[a26_0xfc1857(0x267)]=a26_0xfc1857(0x21e);async[a26_0xfc1857(0x19d)](_0x3c320b){const _0x3ec870=a26_0xfc1857,{options:_0x20358c,args:_0x183bcf,tdx:_0x1e1fa2}=_0x3c320b;console[_0x3ec870(0x211)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x3ec870(0x24f)+_0x3ec870(0x1ee));const _0x4ffc20=_0x20358c;if(_0x183bcf['length']===0x0)return console[_0x3ec870(0x211)](a26_0x220b9c['red'](_0x3ec870(0x115))),console[_0x3ec870(0x211)](_0x3ec870(0x23d)),0x1;const _0x256e9e=_0x183bcf[0x0];_0x4ffc20[_0x3ec870(0x25c)]&&(console[_0x3ec870(0x211)](_0x3ec870(0x270)+_0x4ffc20[_0x3ec870(0x22e)]),console['error'](_0x3ec870(0x262)+_0x256e9e));const _0x26804=await withSpinner(_0x3ec870(0x1c1)+_0x256e9e+'\x27...',()=>_0x1e1fa2['segment'][_0x3ec870(0x177)](_0x256e9e),{'verbose':_0x4ffc20[_0x3ec870(0x25c)]}),_0x1f512e=_0x26804['data'],_0x341c7a=await loadJSONFromOptions(_0x4ffc20[_0x3ec870(0x1cb)],_0x4ffc20[_0x3ec870(0x215)]),_0x42d1d9=await loadJSONFromOptions(_0x4ffc20[_0x3ec870(0x184)],_0x4ffc20[_0x3ec870(0x22f)]),_0xa50bb={'name':_0x1f512e['name'],'description':_0x4ffc20[_0x3ec870(0x267)]!==undefined?_0x4ffc20['description']:_0x1f512e[_0x3ec870(0x267)],'scheduleType':_0x4ffc20['scheduleType']!==undefined?_0x4ffc20[_0x3ec870(0x147)]:_0x1f512e['scheduleType'],'scheduleOption':_0x4ffc20['scheduleOption']!==undefined?_0x4ffc20[_0x3ec870(0x188)]:_0x1f512e[_0x3ec870(0x188)],'timezone':_0x4ffc20[_0x3ec870(0x22d)]!==undefined?_0x4ffc20[_0x3ec870(0x22d)]:_0x1f512e[_0x3ec870(0x22d)],'master':_0x1f512e[_0x3ec870(0x1ba)],'attributes':_0x341c7a?[..._0x1f512e[_0x3ec870(0x149)]||[],..._0x341c7a]:_0x1f512e['attributes'],'behaviors':_0x42d1d9?[..._0x1f512e['behaviors']||[],..._0x42d1d9]:_0x1f512e[_0x3ec870(0x1fb)],'customerGroup':_0x1f512e['customerGroup']},_0x77c79f=await withSpinner(_0x3ec870(0x1a3)+_0x256e9e+_0x3ec870(0x234),()=>_0x1e1fa2[_0x3ec870(0x13e)]['updateParent'](_0x256e9e,_0xa50bb),{'verbose':_0x4ffc20[_0x3ec870(0x25c)]}),_0x3d13c0=_0x77c79f[_0x3ec870(0x176)];return console[_0x3ec870(0x211)](_0x3ec870(0x299)+_0x3d13c0[_0x3ec870(0x1d8)]+'\x27'),await handleSDKOutput([_0x3d13c0],_0x4ffc20),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x11e);[a26_0xfc1857(0x267)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a26_0xfc1857(0x19d)](_0x4e3445){const _0x17878d=a26_0xfc1857,{options:_0xa2ad58,args:_0x3dcb6b,tdx:_0x50ea6e}=_0x4e3445,_0x527491=_0xa2ad58,_0x230d29=_0x3dcb6b[0x0]||_0xa2ad58[_0x17878d(0x1c8)];if(!_0x230d29)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x17878d(0x288)),0x1;if(_0x527491[_0x17878d(0x162)]&&_0x527491['output'])return console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x29b)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x263)](_0x17878d(0x207))),console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x263)](_0x17878d(0x264)+PARENT_SEGMENT_DIR+_0x17878d(0x248))),console['error'](a26_0x220b9c[_0x17878d(0x167)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x36c0fb=_0x527491[_0x17878d(0x125)]||a26_0x12fa7a['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x230d29)+_0x17878d(0x1c3));_0x527491[_0x17878d(0x25c)]&&(console[_0x17878d(0x211)](_0x17878d(0x270)+_0x527491[_0x17878d(0x22e)]),console[_0x17878d(0x211)](_0x17878d(0x262)+_0x230d29),console['error'](_0x17878d(0x17d)+_0x36c0fb));const _0x2d6004=await withSpinner(_0x17878d(0x276)+_0x230d29+'\x27...',()=>_0x50ea6e['segment'][_0x17878d(0x1d7)](_0x230d29),{'verbose':_0x527491['verbose']}),_0x4c477c=_0x2d6004[_0x17878d(0x176)];if(existsSync(_0x36c0fb)){const _0x797717=readFileSync(_0x36c0fb,'utf-8'),_0x2ce0a3=generateDiff(_0x797717,_0x4c477c);if(!hasChanges(_0x2ce0a3))console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x143)]('✔')+'\x20No\x20changes\x20-\x20'+a26_0x220b9c[_0x17878d(0x167)](_0x36c0fb)+_0x17878d(0x26e));else{console[_0x17878d(0x211)](_0x17878d(0x186)+_0x36c0fb+'\x27:'),console[_0x17878d(0x211)]('─'[_0x17878d(0x118)](0x3c)),console[_0x17878d(0x211)](formatDiffWithColors(_0x2ce0a3)),console['error']('─'[_0x17878d(0x118)](0x3c));if(!_0x527491['yes']){if(!isInteractive())return console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x29b)](_0x17878d(0x28d)),_0x17878d(0x160)),console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x263)](_0x17878d(0x291))),0x1;const _0x102b90=await confirmKey(_0x17878d(0x24d)+_0x36c0fb+'\x27?');if(!_0x102b90)return console['error'](a26_0x220b9c[_0x17878d(0x20e)](_0x17878d(0x1fd))),0x1;}writeFileSync(_0x36c0fb,_0x4c477c,_0x17878d(0x107)),console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x143)]('✔')+_0x17878d(0x23a)+a26_0x220b9c[_0x17878d(0x167)](_0x36c0fb));}}else{const _0x603408=a26_0x12fa7a[_0x17878d(0x183)](_0x36c0fb);!existsSync(_0x603408)&&mkdirSync(_0x603408,{'recursive':!![]}),writeFileSync(_0x36c0fb,_0x4c477c,_0x17878d(0x107)),console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x143)]('✔')+_0x17878d(0x23a)+a26_0x220b9c[_0x17878d(0x167)](_0x36c0fb));}return saveSessionContext({'parent_segment':_0x230d29},_0x527491[_0x17878d(0x1fa)]),console[_0x17878d(0x211)](a26_0x220b9c[_0x17878d(0x143)]('✔')+'\x20Context\x20set:\x20'+a26_0x220b9c['dim'](_0x17878d(0x23e))+_0x17878d(0x185)+a26_0x220b9c['cyan'](_0x230d29)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]='segment:parent:push';[a26_0xfc1857(0x267)]=a26_0xfc1857(0x242);async[a26_0xfc1857(0x19d)](_0x5f3f96){const _0xca0bef=a26_0xfc1857,{options:_0xfcd861,args:_0x12cfe6,tdx:_0x4cd15d}=_0x5f3f96,_0x3618b5=_0xfcd861,_0x568171=_0x12cfe6[0x0]||_0xfcd861[_0xca0bef(0x1c8)];if(!_0x568171)return showParentSegmentNotSetError(_0xca0bef(0x1c5)+_0xca0bef(0x130)),0x1;const _0x592c04=resolveYamlFile(_0x568171);if(!existsSync(_0x592c04))return showFileNotFoundError(_0x592c04,_0x568171),0x1;_0x3618b5[_0xca0bef(0x25c)]&&(console[_0xca0bef(0x211)]('Site:\x20'+_0x3618b5[_0xca0bef(0x22e)]),console['error'](_0xca0bef(0x29a)+_0x592c04));let _0x17fe14;try{_0x17fe14=readFileSync(_0x592c04,_0xca0bef(0x107));}catch(_0x11546a){const _0x5214be=_0x11546a instanceof Error?_0x11546a[_0xca0bef(0x281)]:String(_0x11546a);return console[_0xca0bef(0x211)](_0xca0bef(0x286)+_0x5214be),0x1;}const _0x53da20=await withSpinner(_0xca0bef(0x1a6),()=>_0x4cd15d['segment'][_0xca0bef(0x165)](_0x17fe14),{'verbose':_0x3618b5[_0xca0bef(0x25c)]}),_0x5b8079=_0x53da20[_0xca0bef(0x176)],{isNew:_0x5410d3,name:_0x4b9a34,hasChanges:_0x58b128,diffFormatted:_0x21eac1}=_0x5b8079;if(!_0x58b128)return console[_0xca0bef(0x211)](_0xca0bef(0x1c0)+_0x4b9a34+_0xca0bef(0x214)),0x0;_0x5410d3?console[_0xca0bef(0x211)](_0xca0bef(0x13b)+_0x4b9a34+'\x27:'):console[_0xca0bef(0x211)](_0xca0bef(0x13c)+_0x4b9a34+'\x27:');console['error']('─'[_0xca0bef(0x118)](0x3c)),console[_0xca0bef(0x211)](_0x21eac1),console[_0xca0bef(0x211)]('─'[_0xca0bef(0x118)](0x3c));const _0x5a24a9=_0x5410d3?_0xca0bef(0x1a4)+_0x4b9a34+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x4b9a34+'\x27?';if(!_0x3618b5[_0xca0bef(0x25f)]){if(!isInteractive())return console['error'](a26_0x220b9c['red']('\x0aError:'),_0xca0bef(0x160)),console[_0xca0bef(0x211)](a26_0x220b9c[_0xca0bef(0x263)](_0xca0bef(0x291))),0x1;const _0x29cf25=await confirmKey(_0x5a24a9);if(!_0x29cf25)return console['error'](a26_0x220b9c['yellow'](_0xca0bef(0x1fd))),0x1;}const _0x44cf99=_0x5410d3?_0xca0bef(0x198):_0xca0bef(0x26b),_0x46fd89=await withSpinner(_0x44cf99+_0xca0bef(0x1c7)+_0x4b9a34+_0xca0bef(0x234),()=>_0x5b8079[_0xca0bef(0x1f2)](),{'verbose':_0x3618b5[_0xca0bef(0x25c)]}),_0x3f109d=_0x46fd89[_0xca0bef(0x176)],_0x380fc7=getConsoleNextUrl(_0x3618b5[_0xca0bef(0x22e)],_0xca0bef(0x150)+_0x3f109d['id']),_0x5223d=_0x5410d3?_0xca0bef(0x28b):_0xca0bef(0x1d3);return console['error']('✔\x20'+_0x5223d+_0xca0bef(0x1c7)+_0x3f109d[_0xca0bef(0x1d8)]+'\x27'),console[_0xca0bef(0x211)]('\x20\x20'+_0x380fc7),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x21d);[a26_0xfc1857(0x267)]=a26_0xfc1857(0x203);async[a26_0xfc1857(0x19d)](_0x27c7e0){const _0x3afe48=a26_0xfc1857,{options:_0xf03357,args:_0x5377ad,tdx:_0xc2ec3}=_0x27c7e0,_0x201d6c=_0xf03357,_0x470efc=_0x5377ad[0x0]||_0xf03357[_0x3afe48(0x1c8)];if(!_0x470efc)return showParentSegmentNotSetError(_0x3afe48(0x227)+_0x3afe48(0x112)+'Options:\x0a'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x3afe48(0x225)+_0x3afe48(0x1be)),0x1;const _0x25caa6=resolveYamlFile(_0x470efc);if(!existsSync(_0x25caa6))return showFileNotFoundError(_0x25caa6,_0x470efc),0x1;_0x201d6c[_0x3afe48(0x25c)]&&(console[_0x3afe48(0x211)](_0x3afe48(0x270)+_0x201d6c[_0x3afe48(0x22e)]),console[_0x3afe48(0x211)](_0x3afe48(0x29a)+_0x25caa6));let _0xbb1a17;try{_0xbb1a17=readFileSync(_0x25caa6,_0x3afe48(0x107));}catch(_0x536cb3){const _0x146618=_0x536cb3 instanceof Error?_0x536cb3[_0x3afe48(0x281)]:String(_0x536cb3);return console[_0x3afe48(0x211)](_0x3afe48(0x286)+_0x146618),0x1;}const _0x3e42f3=createCommandSpinner(a26_0x220b9c[_0x3afe48(0x263)](_0x3afe48(0x1a1)),{'verbose':_0x201d6c[_0x3afe48(0x25c)]});_0x3e42f3[_0x3afe48(0x246)]();const _0x4cf9c4={'onProgress':_0x6886de=>{_0x3e42f3['text']=formatProgressMessage(_0x6886de);}};if(_0x201d6c[_0x3afe48(0x1ba)])_0x4cf9c4['master']=!![];if(_0x201d6c['enriched'])_0x4cf9c4['enriched']=!![];_0x201d6c[_0x3afe48(0x217)]&&(_0x4cf9c4[_0x3afe48(0x217)]=_0x201d6c['attribute']);_0x201d6c[_0x3afe48(0x152)]&&(_0x4cf9c4[_0x3afe48(0x152)]=_0x201d6c[_0x3afe48(0x152)]);if(_0x201d6c['interval'])_0x4cf9c4['interval']=_0x201d6c[_0x3afe48(0x159)];let _0xf98038;try{_0xf98038=await _0xc2ec3[_0x3afe48(0x13e)]['validateParentYaml'](_0xbb1a17,_0x4cf9c4),_0x3e42f3['stop']();}catch(_0x5d1936){_0x3e42f3[_0x3afe48(0x1f5)]();throw _0x5d1936;}const _0x2612b5=_0x201d6c[_0x3afe48(0x159)]||_0x3afe48(0x168);return this[_0x3afe48(0x111)](_0xf98038,_0x4cf9c4,_0x25caa6,_0x2612b5),_0xf98038[_0x3afe48(0x243)]?0x0:0x1;}[a26_0xfc1857(0x111)](_0x29073d,_0x450bdc,_0xe791be,_0x529757){const _0x1cdcfb=a26_0xfc1857;console[_0x1cdcfb(0x211)]('\x0a'+a26_0x220b9c['bold']('Validate:')+'\x20'+_0x29073d['name']),console[_0x1cdcfb(0x211)]('═'[_0x1cdcfb(0x118)](0x3c)),this['displayMasterInfo'](_0x29073d);if(typeof _0x450bdc[_0x1cdcfb(0x217)]===_0x1cdcfb(0x279)){this['displayAttributesStats'](_0x29073d),this[_0x1cdcfb(0x1aa)](_0x29073d),this['displayPreviewHints'](_0xe791be,_0x529757,_0x1cdcfb(0x217),_0x450bdc[_0x1cdcfb(0x217)]);return;}if(_0x450bdc[_0x1cdcfb(0x217)]===!![]){this[_0x1cdcfb(0x27a)](_0x29073d),this[_0x1cdcfb(0x1aa)](_0x29073d),this[_0x1cdcfb(0x10c)](_0xe791be,_0x529757,_0x1cdcfb(0x149));return;}if(typeof _0x450bdc['behavior']===_0x1cdcfb(0x279)){this[_0x1cdcfb(0x1c9)](_0x29073d,_0x529757),this['displaySummary'](_0x29073d),this[_0x1cdcfb(0x10c)](_0xe791be,_0x529757,_0x1cdcfb(0x152),_0x450bdc[_0x1cdcfb(0x152)]);return;}if(_0x450bdc[_0x1cdcfb(0x152)]===!![]){this[_0x1cdcfb(0x1c9)](_0x29073d,_0x529757),this[_0x1cdcfb(0x1aa)](_0x29073d),this[_0x1cdcfb(0x10c)](_0xe791be,_0x529757,_0x1cdcfb(0x1fb));return;}this[_0x1cdcfb(0x27a)](_0x29073d),this[_0x1cdcfb(0x1c9)](_0x29073d,_0x529757),this['displayRealtimeInfo'](_0x29073d),this[_0x1cdcfb(0x1aa)](_0x29073d),this['displayPreviewHints'](_0xe791be,_0x529757,_0x1cdcfb(0x1f4));}[a26_0xfc1857(0x250)](_0x2a581a){displayRealtimeValidation(_0x2a581a);}['displayPreviewHints'](_0x17c378,_0x161e00,_0x573923,_0x18b8ee){const _0x3940f9=a26_0xfc1857;console[_0x3940f9(0x211)]('\x0a'+a26_0x220b9c[_0x3940f9(0x263)](_0x3940f9(0x1fe)));const _0x5aabdc=_0x161e00!=='-1d'?_0x3940f9(0x173)+_0x161e00:'';if(_0x573923===_0x3940f9(0x217)&&_0x18b8ee)console['error']('\x20\x20'+a26_0x220b9c[_0x3940f9(0x263)]('tdx\x20ps\x20preview\x20'+_0x17c378+_0x3940f9(0x142)+_0x18b8ee+'\x22'+_0x5aabdc));else{if(_0x573923===_0x3940f9(0x152)&&_0x18b8ee)console[_0x3940f9(0x211)]('\x20\x20'+a26_0x220b9c[_0x3940f9(0x263)](_0x3940f9(0x171)+_0x17c378+'\x20--behavior\x20\x22'+_0x18b8ee+'\x22'+_0x5aabdc));else(_0x573923==='attributes'||_0x573923===_0x3940f9(0x1f4))&&console[_0x3940f9(0x211)]('\x20\x20'+a26_0x220b9c[_0x3940f9(0x263)](_0x3940f9(0x171)+_0x17c378+'\x20--attribute\x20\x22<name>\x22'+_0x5aabdc));}(_0x573923===_0x3940f9(0x1fb)||_0x573923===_0x3940f9(0x1f4))&&console[_0x3940f9(0x211)]('\x20\x20'+a26_0x220b9c['dim']('tdx\x20ps\x20preview\x20'+_0x17c378+_0x3940f9(0x11b)+_0x5aabdc)),_0x573923==='all'&&console[_0x3940f9(0x211)]('\x20\x20'+a26_0x220b9c[_0x3940f9(0x263)](_0x3940f9(0x171)+_0x17c378+_0x3940f9(0x129)+_0x5aabdc));}[a26_0xfc1857(0x257)](_0x3ca4cf){const _0xdb1c6b=a26_0xfc1857,{master:_0x4491b8}=_0x3ca4cf,_0x3ac4f0=_0x4491b8[_0xdb1c6b(0x156)]?a26_0x220b9c[_0xdb1c6b(0x143)]('✔'):a26_0x220b9c[_0xdb1c6b(0x29b)]('✘');console[_0xdb1c6b(0x211)]('\x0a'+a26_0x220b9c['dim']('Master\x20Table')),console['error'](_0x3ac4f0+'\x20'+a26_0x220b9c[_0xdb1c6b(0x1bf)](_0x4491b8[_0xdb1c6b(0x249)]+'.'+_0x4491b8[_0xdb1c6b(0x128)])),_0x4491b8[_0xdb1c6b(0x156)]?_0x4491b8['rowCount']!==undefined&&console['error']('\x20\x20'+a26_0x220b9c[_0xdb1c6b(0x263)](_0xdb1c6b(0x1dc))+'\x20'+a26_0x220b9c[_0xdb1c6b(0x167)](formatRows(_0x4491b8[_0xdb1c6b(0x1e2)]))):console[_0xdb1c6b(0x211)]('\x20\x20'+a26_0x220b9c['red']('Error:')+'\x20'+_0x4491b8[_0xdb1c6b(0x269)]);}[a26_0xfc1857(0x27a)](_0x47f7ef){const _0x274db4=a26_0xfc1857;if(_0x47f7ef['attributes']['length']===0x0)return;console[_0x274db4(0x211)]('\x0a'+a26_0x220b9c[_0x274db4(0x263)](_0x274db4(0x12d)));for(const _0x29475c of _0x47f7ef[_0x274db4(0x149)]){const _0x1f4e44=_0x29475c['schemaValid']?a26_0x220b9c[_0x274db4(0x143)]('✔'):a26_0x220b9c['red']('✘');let _0x5147c0='';if(_0x29475c['schemaValid']&&_0x29475c[_0x274db4(0x163)]!==undefined&&_0x29475c[_0x274db4(0x20d)]!==undefined){const _0x349b83=_0x29475c['coveragePercent'][_0x274db4(0x1c2)](0x1),_0x2b01cd=_0x29475c[_0x274db4(0x20d)]>=0x50?a26_0x220b9c[_0x274db4(0x143)]:_0x29475c[_0x274db4(0x20d)]>=0x32?a26_0x220b9c[_0x274db4(0x20e)]:a26_0x220b9c[_0x274db4(0x29b)];_0x5147c0='\x20'+a26_0x220b9c['dim'](_0x274db4(0x21b))+'\x20'+_0x2b01cd(_0x349b83+'%')+'\x20('+formatRows(_0x29475c['matchedCount'])+_0x274db4(0x19c);}console[_0x274db4(0x211)](_0x1f4e44+'\x20'+a26_0x220b9c['bold'](_0x29475c[_0x274db4(0x1d8)])+_0x5147c0),console[_0x274db4(0x211)]('\x20\x20'+a26_0x220b9c['dim'](_0x274db4(0x158))+'\x20'+a26_0x220b9c[_0x274db4(0x1bf)](_0x29475c[_0x274db4(0x249)]+'.'+_0x29475c[_0x274db4(0x128)]));const _0x11025a=_0x29475c[_0x274db4(0x1ce)]===_0x29475c[_0x274db4(0x290)]?a26_0x220b9c[_0x274db4(0x263)](_0x274db4(0x1f3))+'\x20'+_0x29475c['joinKey']:a26_0x220b9c['dim']('Join:')+'\x20'+_0x29475c['joinKey']+_0x274db4(0x185)+_0x29475c['foreignKey'];console[_0x274db4(0x211)]('\x20\x20'+_0x11025a),console['error']('\x20\x20'+a26_0x220b9c[_0x274db4(0x263)](_0x274db4(0x278))),this['displayColumns'](_0x29475c[_0x274db4(0x12c)]),!_0x29475c[_0x274db4(0x156)]&&console[_0x274db4(0x211)]('\x20\x20'+a26_0x220b9c[_0x274db4(0x29b)](_0x274db4(0x14c))+'\x20'+_0x29475c['schemaError']);}}[a26_0xfc1857(0x1c9)](_0x190fd9,_0x3cbd8e){const _0x4e973d=a26_0xfc1857;if(_0x190fd9[_0x4e973d(0x1fb)][_0x4e973d(0x18d)]===0x0)return;console[_0x4e973d(0x211)]('\x0a'+a26_0x220b9c[_0x4e973d(0x263)]('Behaviors')+'\x20'+a26_0x220b9c[_0x4e973d(0x263)]('('+_0x3cbd8e+')'));for(const _0x102318 of _0x190fd9[_0x4e973d(0x1fb)]){const _0x143ae3=_0x102318['schemaValid']?a26_0x220b9c[_0x4e973d(0x143)]('✔'):a26_0x220b9c[_0x4e973d(0x29b)]('✘');let _0x48eea3='';if(_0x102318[_0x4e973d(0x156)]&&_0x102318['customersWithEvents']!==undefined&&_0x102318[_0x4e973d(0x148)]!==undefined){const _0x3fd408=_0x102318[_0x4e973d(0x202)]?.['toFixed'](0x1)||'?',_0x3c831d=(_0x102318[_0x4e973d(0x202)]??0x0)>=0x32?a26_0x220b9c[_0x4e973d(0x143)]:(_0x102318[_0x4e973d(0x202)]??0x0)>=0x14?a26_0x220b9c[_0x4e973d(0x20e)]:a26_0x220b9c['red'];_0x48eea3='\x20'+a26_0x220b9c[_0x4e973d(0x263)](_0x4e973d(0x255))+'\x20'+_0x3c831d(formatRows(_0x102318['customersWithEvents']))+'\x20('+_0x3fd408+'%)\x20'+a26_0x220b9c[_0x4e973d(0x263)](_0x4e973d(0x236))+'\x20'+a26_0x220b9c[_0x4e973d(0x167)](formatRows(_0x102318[_0x4e973d(0x148)]));}console[_0x4e973d(0x211)](_0x143ae3+'\x20'+a26_0x220b9c[_0x4e973d(0x1bf)](_0x102318[_0x4e973d(0x1d8)])+_0x48eea3),console[_0x4e973d(0x211)]('\x20\x20'+a26_0x220b9c[_0x4e973d(0x263)](_0x4e973d(0x158))+'\x20'+a26_0x220b9c[_0x4e973d(0x1bf)](_0x102318[_0x4e973d(0x249)]+'.'+_0x102318['table']));const _0x744a56=_0x102318[_0x4e973d(0x1ce)]===_0x102318[_0x4e973d(0x290)]?a26_0x220b9c['dim'](_0x4e973d(0x1f3))+'\x20'+_0x102318[_0x4e973d(0x1ce)]:a26_0x220b9c[_0x4e973d(0x263)](_0x4e973d(0x154))+'\x20'+_0x102318['joinKey']+'\x20=\x20'+_0x102318[_0x4e973d(0x290)];console[_0x4e973d(0x211)]('\x20\x20'+_0x744a56),console[_0x4e973d(0x211)]('\x20\x20'+a26_0x220b9c[_0x4e973d(0x263)](_0x4e973d(0x278))),this[_0x4e973d(0x23c)](_0x102318[_0x4e973d(0x12c)]),!_0x102318[_0x4e973d(0x156)]&&console[_0x4e973d(0x211)]('\x20\x20'+a26_0x220b9c[_0x4e973d(0x29b)](_0x4e973d(0x14c))+'\x20'+_0x102318[_0x4e973d(0x269)]);}}[a26_0xfc1857(0x23c)](_0x3eb1de){const _0x289642=a26_0xfc1857;for(const _0x4fe7ae of _0x3eb1de){_0x4fe7ae[_0x289642(0x14f)]===_0x4fe7ae[_0x289642(0x19e)]||_0x4fe7ae[_0x289642(0x19e)]==='*'?console[_0x289642(0x211)](_0x289642(0x285)+_0x4fe7ae[_0x289642(0x14f)]):console[_0x289642(0x211)]('\x20\x20\x20\x20-\x20'+_0x4fe7ae['label']+'\x20'+a26_0x220b9c['dim']('('+_0x4fe7ae['column']+')'));}}[a26_0xfc1857(0x1aa)](_0x2d0c1b){const _0x11b6d1=a26_0xfc1857;console['error']('─'[_0x11b6d1(0x118)](0x3c));if(_0x2d0c1b[_0x11b6d1(0x1f9)][_0x11b6d1(0x18d)]>0x0){console[_0x11b6d1(0x211)]('\x0a'+a26_0x220b9c['red'](_0x11b6d1(0x1bc)));for(const _0x5702fa of _0x2d0c1b[_0x11b6d1(0x1f9)]){console[_0x11b6d1(0x211)]('\x20\x20'+a26_0x220b9c[_0x11b6d1(0x29b)]('•')+'\x20'+_0x5702fa);}}_0x2d0c1b[_0x11b6d1(0x243)]&&console['error']('\x0a'+a26_0x220b9c[_0x11b6d1(0x143)]('✔')+_0x11b6d1(0x235));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x237);[a26_0xfc1857(0x267)]=a26_0xfc1857(0x284);async[a26_0xfc1857(0x19d)](_0x1ac9ae){const _0x588bee=a26_0xfc1857,{options:_0x556ae2,args:_0x3b5f0f,tdx:_0x113a29}=_0x1ac9ae,_0x265845=_0x556ae2,_0x5f1652=_0x3b5f0f[0x0]||_0x556ae2[_0x588bee(0x1c8)];if(!_0x5f1652)return showParentSegmentNotSetError(_0x588bee(0x17f)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x588bee(0x16f)+_0x588bee(0x24b)+_0x588bee(0x26c)+_0x588bee(0x271)+_0x588bee(0x268)+_0x588bee(0x1be)),0x1;if(!_0x265845[_0x588bee(0x1ba)]&&!_0x265845[_0x588bee(0x217)]&&!_0x265845[_0x588bee(0x152)]&&!_0x265845['enriched'])return console[_0x588bee(0x211)](a26_0x220b9c[_0x588bee(0x29b)](_0x588bee(0x1b1))),console[_0x588bee(0x211)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x588bee(0x164)),console[_0x588bee(0x211)](_0x588bee(0x258)),console[_0x588bee(0x211)](_0x588bee(0x114)),console[_0x588bee(0x211)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x588bee(0x211)](_0x588bee(0x1ec)),0x1;const _0x5cd423=resolveYamlFile(_0x5f1652);if(!existsSync(_0x5cd423))return showFileNotFoundError(_0x5cd423,_0x5f1652),0x1;_0x265845[_0x588bee(0x25c)]&&(console[_0x588bee(0x211)](_0x588bee(0x270)+_0x265845[_0x588bee(0x22e)]),console[_0x588bee(0x211)](_0x588bee(0x29a)+_0x5cd423));let _0xcc250f;try{_0xcc250f=readFileSync(_0x5cd423,_0x588bee(0x107));}catch(_0x297690){const _0x2e023c=_0x297690 instanceof Error?_0x297690[_0x588bee(0x281)]:String(_0x297690);return console[_0x588bee(0x211)]('Error\x20reading\x20file:\x20'+_0x2e023c),0x1;}let _0x557655;try{_0x557655=parseDef(_0xcc250f);}catch(_0x2d6728){const _0x243059=_0x2d6728 instanceof Error?_0x2d6728[_0x588bee(0x281)]:String(_0x2d6728);return console[_0x588bee(0x211)](a26_0x220b9c[_0x588bee(0x29b)](_0x588bee(0x1ca)+_0x243059)),0x1;}if(_0x265845[_0x588bee(0x217)]===!![]||_0x265845['attribute']===''){const _0x2a292c=_0x557655[_0x588bee(0x149)]?.[_0x588bee(0x19f)](_0x2af0c7=>_0x2af0c7[_0x588bee(0x1d8)])||[];if(_0x2a292c[_0x588bee(0x18d)]===0x0)console[_0x588bee(0x211)](a26_0x220b9c[_0x588bee(0x29b)](_0x588bee(0x1ed)));else{console[_0x588bee(0x211)](a26_0x220b9c['red'](_0x588bee(0x137))),console['error'](_0x588bee(0x1f6));for(const _0x5d9ca6 of _0x2a292c){console[_0x588bee(0x211)]('\x20\x20'+a26_0x220b9c[_0x588bee(0x167)](_0x5d9ca6));}console[_0x588bee(0x211)](_0x588bee(0x230)+_0x5f1652+_0x588bee(0x142)+_0x2a292c[0x0]+'\x22');}return 0x1;}if(_0x265845[_0x588bee(0x152)]===!![]||_0x265845['behavior']===''){const _0x32da0a=_0x557655[_0x588bee(0x1fb)]?.[_0x588bee(0x19f)](_0x4405d8=>_0x4405d8[_0x588bee(0x1d8)])||[];if(_0x32da0a['length']===0x0)console[_0x588bee(0x211)](a26_0x220b9c[_0x588bee(0x29b)](_0x588bee(0x1b3)));else{console['error'](a26_0x220b9c['red'](_0x588bee(0x1cf))),console[_0x588bee(0x211)](_0x588bee(0x241));for(const _0x5d7e17 of _0x32da0a){console['error']('\x20\x20'+a26_0x220b9c[_0x588bee(0x167)](_0x5d7e17));}console[_0x588bee(0x211)](_0x588bee(0x230)+_0x5f1652+_0x588bee(0x133)+_0x32da0a[0x0]+'\x22');}return 0x1;}const _0x45f049=createCommandSpinner(a26_0x220b9c[_0x588bee(0x263)]('Fetching\x20sample\x20data...'),{'verbose':_0x265845[_0x588bee(0x25c)]});_0x45f049['start']();const _0x392341={'onProgress':_0x3620ad=>{const _0x23c010=_0x588bee;_0x45f049[_0x23c010(0x187)]=formatProgressMessage(_0x3620ad);}};if(_0x265845[_0x588bee(0x1ba)])_0x392341[_0x588bee(0x1ba)]=!![];if(_0x265845[_0x588bee(0x217)]&&typeof _0x265845[_0x588bee(0x217)]==='string')_0x392341[_0x588bee(0x217)]=_0x265845[_0x588bee(0x217)];if(_0x265845[_0x588bee(0x152)]&&typeof _0x265845[_0x588bee(0x152)]===_0x588bee(0x279))_0x392341[_0x588bee(0x152)]=_0x265845['behavior'];if(_0x265845[_0x588bee(0x14d)])_0x392341[_0x588bee(0x14d)]=!![];if(_0x265845[_0x588bee(0x159)])_0x392341[_0x588bee(0x159)]=_0x265845['interval'];let _0x44961e;try{_0x44961e=await _0x113a29[_0x588bee(0x13e)][_0x588bee(0x28c)](_0xcc250f,_0x392341),_0x45f049['stop']();}catch(_0x34bd36){_0x45f049[_0x588bee(0x1f5)]();throw _0x34bd36;}return await this['displayPreviewResults'](_0x44961e,{'master':_0x265845[_0x588bee(0x1ba)],'attribute':typeof _0x265845[_0x588bee(0x217)]==='string'?_0x265845[_0x588bee(0x217)]:undefined,'behavior':typeof _0x265845[_0x588bee(0x152)]==='string'?_0x265845[_0x588bee(0x152)]:undefined,'enriched':_0x265845[_0x588bee(0x14d)]}),_0x44961e[_0x588bee(0x243)]?0x0:0x1;}async['displayPreviewResults'](_0x203b5f,_0x5043af){const _0x566d25=a26_0xfc1857;console[_0x566d25(0x211)]('\x0a'+a26_0x220b9c[_0x566d25(0x1bf)]('Preview:')+'\x20'+_0x203b5f[_0x566d25(0x1d8)]),console[_0x566d25(0x211)]('═'[_0x566d25(0x118)](0x3c));if(_0x5043af[_0x566d25(0x1ba)]&&_0x203b5f[_0x566d25(0x1a9)]){const _0x358a56=a26_0x220b9c[_0x566d25(0x263)](_0x566d25(0x139))+'\x20'+a26_0x220b9c[_0x566d25(0x1bf)](_0x203b5f['master']['database']+'.'+_0x203b5f['master']['table']);await this[_0x566d25(0x26a)](_0x358a56,_0x203b5f[_0x566d25(0x1a9)]);}else{if(_0x5043af['attribute']&&_0x203b5f[_0x566d25(0x1a9)]){const _0x37bdc1=a26_0x220b9c[_0x566d25(0x263)](_0x566d25(0x131))+'\x20'+a26_0x220b9c['bold'](_0x5043af[_0x566d25(0x217)]);await this[_0x566d25(0x26a)](_0x37bdc1,_0x203b5f[_0x566d25(0x1a9)]);}else{if(_0x5043af[_0x566d25(0x152)]&&_0x203b5f[_0x566d25(0x1a9)]){const _0x480d1c=a26_0x220b9c[_0x566d25(0x263)](_0x566d25(0x272))+'\x20'+a26_0x220b9c[_0x566d25(0x1bf)](_0x5043af[_0x566d25(0x152)]);await this[_0x566d25(0x26a)](_0x480d1c,_0x203b5f['sampleData']);}else{if(_0x5043af['enriched']&&_0x203b5f['sampleData']){const _0x368214=a26_0x220b9c[_0x566d25(0x263)](_0x566d25(0x260))+'\x20'+a26_0x220b9c[_0x566d25(0x1bf)](_0x566d25(0x135));await this[_0x566d25(0x26a)](_0x368214,_0x203b5f[_0x566d25(0x1a9)]);}else!_0x203b5f['sampleData']&&console[_0x566d25(0x211)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x203b5f[_0x566d25(0x1f9)][_0x566d25(0x18d)]>0x0){console[_0x566d25(0x211)]('─'[_0x566d25(0x118)](0x3c)),console[_0x566d25(0x211)]('\x0a'+a26_0x220b9c['red'](_0x566d25(0x1bc)));for(const _0x31d133 of _0x203b5f[_0x566d25(0x1f9)]){console[_0x566d25(0x211)]('\x20\x20'+a26_0x220b9c[_0x566d25(0x29b)]('•')+'\x20'+_0x31d133);}}}async[a26_0xfc1857(0x26a)](_0x482494,_0x145a6c){const _0x29269c=a26_0xfc1857;if(_0x145a6c[_0x29269c(0x18d)]===0x0){console[_0x29269c(0x211)]('\x0a'+_0x482494),console[_0x29269c(0x211)](_0x29269c(0x1df));return;}console[_0x29269c(0x211)]('\x0a'+_0x482494);const _0x20a232=Object[_0x29269c(0x12b)](_0x145a6c[0x0])[_0x29269c(0x19f)](_0x26b0f1=>({'name':_0x26b0f1,'type':typeof _0x145a6c[0x0][_0x26b0f1]===_0x29269c(0x25b)?'double':_0x29269c(0x218)})),_0x5c15a3={'queryId':'preview','columns':_0x20a232,'data':_0x145a6c,'stats':{'state':_0x29269c(0x151),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x145a6c['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x45ae4d=formatAsTable(_0x5c15a3,_0x145a6c[_0x29269c(0x18d)],!![]);await writeOutput(_0x45ae4d,undefined,_0x29269c(0x128));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x205);[a26_0xfc1857(0x267)]=a26_0xfc1857(0x261);async[a26_0xfc1857(0x19d)](_0xa46a28){const _0x13405e=a26_0xfc1857,{options:_0x235974,args:_0x5cfc70,tdx:_0xa4a0c5}=_0xa46a28,_0x2f5178=_0x235974,_0x437419=_0x5cfc70[0x0]||_0x235974['parentSegment'];if(!_0x437419)return showParentSegmentNotSetError(_0x13405e(0x247)+_0x13405e(0x175)),0x1;const _0x5643e9=resolveYamlFile(_0x437419);if(existsSync(_0x5643e9)){_0x2f5178[_0x13405e(0x25c)]&&console[_0x13405e(0x211)](_0x13405e(0x25a)+_0x5643e9);let _0x288808;try{_0x288808=readFileSync(_0x5643e9,'utf-8');}catch(_0x5b20f5){const _0x3073af=_0x5b20f5 instanceof Error?_0x5b20f5[_0x13405e(0x281)]:String(_0x5b20f5);return console[_0x13405e(0x211)](_0x13405e(0x286)+_0x3073af),0x1;}const _0x4f805e=await withSpinner(_0x13405e(0x1a6),()=>_0xa4a0c5[_0x13405e(0x13e)]['pushParentYaml'](_0x288808),{'verbose':_0x2f5178[_0x13405e(0x25c)]}),_0x50af0d=_0x4f805e[_0x13405e(0x176)],{isNew:_0x4242b7,name:_0x5c85d6,hasChanges:_0x57f1cb,diffFormatted:_0x141169}=_0x50af0d;if(_0x57f1cb){_0x4242b7?console[_0x13405e(0x211)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x5c85d6+'\x27:'):console[_0x13405e(0x211)](_0x13405e(0x13c)+_0x5c85d6+'\x27:');console[_0x13405e(0x211)]('─'[_0x13405e(0x118)](0x3c)),console[_0x13405e(0x211)](_0x141169),console['error']('─'['repeat'](0x3c));const _0x573191=_0x4242b7?_0x13405e(0x1a4)+_0x5c85d6+'\x27\x20and\x20run\x20workflow?':_0x13405e(0x1ac)+_0x5c85d6+_0x13405e(0x1dd);if(!_0x2f5178['yes']){if(!isInteractive())return console[_0x13405e(0x211)](a26_0x220b9c[_0x13405e(0x29b)](_0x13405e(0x28d)),_0x13405e(0x160)),console[_0x13405e(0x211)](a26_0x220b9c['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x38dcf9=await confirmKey(_0x573191);if(!_0x38dcf9)return console[_0x13405e(0x211)](a26_0x220b9c[_0x13405e(0x20e)](_0x13405e(0x1fd))),0x1;}const _0x58e0b1=_0x4242b7?'Creating':_0x13405e(0x26b);await withSpinner(_0x58e0b1+_0x13405e(0x1c7)+_0x5c85d6+_0x13405e(0x234),()=>_0x50af0d[_0x13405e(0x1f2)](),{'verbose':_0x2f5178[_0x13405e(0x25c)]});const _0x3d5a15=_0x4242b7?'Created':'Updated';console['error']('✔\x20'+_0x3d5a15+_0x13405e(0x1c7)+_0x5c85d6+'\x27');}else console[_0x13405e(0x211)](_0x13405e(0x1c0)+_0x5c85d6+_0x13405e(0x1ab));}const _0x311866=await withSpinner(_0x13405e(0x12a)+_0x437419+_0x13405e(0x234),()=>_0xa4a0c5[_0x13405e(0x13e)][_0x13405e(0x27d)](_0x437419),{'verbose':_0x2f5178[_0x13405e(0x25c)]}),_0xf709bd=_0x311866[_0x13405e(0x176)],_0x4c1ce8=getConsoleUrl(_0x2f5178[_0x13405e(0x22e)],_0x13405e(0x254)+_0xf709bd[_0x13405e(0x26d)]+_0x13405e(0x1a8)+_0xf709bd[_0x13405e(0x14b)]+'/attempt/'+_0xf709bd[_0x13405e(0x259)]);return console[_0x13405e(0x211)]('\x0a✔\x20Workflow\x20started'),console[_0x13405e(0x211)]('\x20\x20'+a26_0x220b9c[_0x13405e(0x263)]('Audience\x20ID:')+'\x20'+_0xf709bd[_0x13405e(0x1bd)]),console[_0x13405e(0x211)]('\x20\x20'+a26_0x220b9c[_0x13405e(0x263)](_0x13405e(0x295))+'\x20'+_0xf709bd[_0x13405e(0x24e)]),console[_0x13405e(0x211)]('\x20\x20'+a26_0x220b9c[_0x13405e(0x263)]('Session:')+'\x20'+_0xf709bd[_0x13405e(0x14b)]),console[_0x13405e(0x211)]('\x20\x20'+a26_0x220b9c[_0x13405e(0x263)]('Attempt:')+'\x20'+_0xf709bd[_0x13405e(0x259)]),console[_0x13405e(0x211)]('\x20\x20'+_0x4c1ce8),console[_0x13405e(0x211)]('\x0a'+a26_0x220b9c['dim']('To\x20cancel:')+'\x20tdx\x20wf\x20attempt\x20'+_0xf709bd['workflowAttemptId']+_0x13405e(0x201)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a26_0xfc1857(0x1a0);[a26_0xfc1857(0x267)]='List\x20available\x20fields\x20for\x20segmentation';async[a26_0xfc1857(0x19d)](_0x2f35d0){const _0x315b62=a26_0xfc1857,{options:_0x13b4ca,args:_0x6dd86c,tdx:_0x504c3e}=_0x2f35d0,_0x1c7a37=_0x6dd86c[0x0]||_0x13b4ca[_0x315b62(0x1c8)];if(!_0x1c7a37)return showParentSegmentNotSetError(_0x315b62(0x22a)+_0x315b62(0x296)),0x1;_0x13b4ca[_0x315b62(0x25c)]&&(console[_0x315b62(0x211)](_0x315b62(0x270)+_0x13b4ca[_0x315b62(0x22e)]),console['error'](_0x315b62(0x262)+_0x1c7a37));const _0x5c78ce=await withSpinner(_0x315b62(0x13a)+_0x1c7a37+_0x315b62(0x234),()=>_0x504c3e[_0x315b62(0x13e)][_0x315b62(0x136)](_0x1c7a37),{'verbose':_0x13b4ca[_0x315b62(0x25c)]}),_0x170f71=_0x5c78ce[_0x315b62(0x176)];console[_0x315b62(0x211)](_0x315b62(0x21f)+_0x170f71['length']+_0x315b62(0x1d0)+(_0x170f71[_0x315b62(0x18d)]!==0x1?'s':''));if(_0x13b4ca[_0x315b62(0x17a)]||_0x13b4ca[_0x315b62(0x283)])return await handleSDKOutput(_0x170f71,_0x13b4ca),0x0;return displayFieldsHumanReadable(_0x170f71,_0x1c7a37),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a26_0xfc1857(0x170);[a26_0xfc1857(0x267)]='Show\x20parent\x20segment\x20details';async[a26_0xfc1857(0x19d)](_0x3ea734){const _0xadc8b7=a26_0xfc1857,{options:_0x22b80e,args:_0x3917f2,tdx:_0x23cdb3}=_0x3ea734,_0x19ffd2=_0x22b80e,_0x1b36e9=_0x3917f2[0x0]||_0x22b80e[_0xadc8b7(0x1c8)];if(!_0x1b36e9)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'+_0xadc8b7(0x1f1)+_0xadc8b7(0x109)+_0xadc8b7(0x132)),0x1;_0x22b80e[_0xadc8b7(0x25c)]&&(console[_0xadc8b7(0x211)](_0xadc8b7(0x270)+_0x22b80e[_0xadc8b7(0x22e)]),console[_0xadc8b7(0x211)](_0xadc8b7(0x262)+_0x1b36e9));const _0x4b1881=await withSpinner(_0xadc8b7(0x276)+_0x1b36e9+_0xadc8b7(0x234),()=>_0x23cdb3[_0xadc8b7(0x13e)][_0xadc8b7(0x177)](_0x1b36e9),{'verbose':_0x22b80e[_0xadc8b7(0x25c)]}),_0x1e5fc8=_0x4b1881[_0xadc8b7(0x176)];if(_0x19ffd2['web']){const _0x8648e4=getConsoleNextUrl(_0x19ffd2[_0xadc8b7(0x22e)],_0xadc8b7(0x150)+_0x1e5fc8['id']);return console[_0xadc8b7(0x211)](a26_0x220b9c[_0xadc8b7(0x143)]('✔')+'\x20Opening\x20'+a26_0x220b9c['cyan'](_0x8648e4)),openBrowser(_0x8648e4),0x0;}return await handleSingleObjectOutput(_0x1e5fc8,_0x22b80e),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a26_0xfc1857(0x15a);[a26_0xfc1857(0x267)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a26_0xfc1857(0x19d)](_0x45e895){const _0x1b2490=a26_0xfc1857,{options:_0x404550,args:_0x2996f7,tdx:_0x52545d}=_0x45e895,_0x1c0bcf=_0x404550,_0x442edb=_0x2996f7[0x0]||_0x404550[_0x1b2490(0x1c8)];if(!_0x442edb)return showParentSegmentNotSetError(_0x1b2490(0x266)+_0x1b2490(0x12f)+_0x1b2490(0x109)+_0x1b2490(0x1d5)),0x1;_0x404550['verbose']&&(console['error'](_0x1b2490(0x270)+_0x404550['site']),console[_0x1b2490(0x211)](_0x1b2490(0x262)+_0x442edb));const _0x1d78e7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x442edb+_0x1b2490(0x234),()=>_0x52545d['segment'][_0x1b2490(0x199)](_0x442edb),{'verbose':_0x404550['verbose']}),_0x2cd82a=_0x1d78e7[_0x1b2490(0x176)],_0x3b3531=_0x52545d[_0x1b2490(0x13e)][_0x1b2490(0x1e9)](_0x2cd82a);if(_0x1c0bcf[_0x1b2490(0x125)]){const _0x432196=await this[_0x1b2490(0x1d4)](_0x45e895,_0x442edb,_0x2cd82a,_0x3b3531),_0x56bf8c=this[_0x1b2490(0x1e0)](_0x432196);writeFileSync(_0x1c0bcf['output'],_0x56bf8c);const _0x2b902e=_0x432196[_0x1b2490(0x206)][_0x1b2490(0x12c)]['length']+_0x432196[_0x1b2490(0x1fb)][_0x1b2490(0x1ff)]((_0x309fcc,_0xc010cb)=>_0x309fcc+_0xc010cb[_0x1b2490(0x12c)][_0x1b2490(0x18d)],0x0),_0x1436e0=_0x432196[_0x1b2490(0x1fb)][_0x1b2490(0x240)](_0xb47128=>_0xb47128[_0x1b2490(0x12c)][_0x1b2490(0x18d)]===0x0)['length'];return console[_0x1b2490(0x10b)](_0x1b2490(0x18e)+_0x1c0bcf[_0x1b2490(0x125)]),console[_0x1b2490(0x10b)]('\x20\x20Database:\x20'+_0x3b3531),console[_0x1b2490(0x10b)](_0x1b2490(0x27b)+_0x432196['behaviors'][_0x1b2490(0x18d)]+_0x1b2490(0x10d)),console[_0x1b2490(0x10b)](_0x1b2490(0x1cd)+_0x2b902e+_0x1b2490(0x216)),_0x1436e0>0x0&&console['log']('\x20\x20Note:\x20'+_0x1436e0+_0x1b2490(0x1b0)),0x0;}console[_0x1b2490(0x211)]('\x0a'+a26_0x220b9c[_0x1b2490(0x1bf)](_0x1b2490(0x21a))+'\x20'+a26_0x220b9c[_0x1b2490(0x167)](_0x3b3531));const _0x560e7e=await withSpinner(_0x1b2490(0x169),()=>_0x52545d['segment'][_0x1b2490(0x208)](_0x2cd82a),{'verbose':_0x404550[_0x1b2490(0x25c)]});console[_0x1b2490(0x211)]('\x0a'+a26_0x220b9c[_0x1b2490(0x1bf)]('customers')+'\x20'+a26_0x220b9c[_0x1b2490(0x263)]('('+_0x3b3531+_0x1b2490(0x1ae)));const _0x10694=await executeSchemaQuery(_0x560e7e['data'],_0x52545d,_0x404550);await handleQueryOutput(_0x10694,_0x404550);const _0x1d8752=await withSpinner(_0x1b2490(0x1b2),()=>_0x52545d[_0x1b2490(0x13e)][_0x1b2490(0x17b)](_0x2cd82a),{'verbose':_0x404550[_0x1b2490(0x25c)]});for(const _0x4a858a of _0x1d8752[_0x1b2490(0x176)]){const _0x45e9cf='behavior_'+_0x4a858a['toLowerCase']()[_0x1b2490(0x28a)](/\s+/g,'_'),_0x49f339=_0x1b2490(0x140)+_0x3b3531+'.'+_0x45e9cf;console[_0x1b2490(0x211)]('\x0a'+a26_0x220b9c['bold'](_0x4a858a)+'\x20'+a26_0x220b9c[_0x1b2490(0x263)]('('+_0x3b3531+'.'+_0x45e9cf+')'));try{const _0x30317a=await executeSchemaQuery(_0x49f339,_0x52545d,_0x404550);await handleQueryOutput(_0x30317a,_0x404550);}catch{console['error'](a26_0x220b9c[_0x1b2490(0x20e)](_0x1b2490(0x22b)));}}return 0x0;}async['collectSchema'](_0x39a8f4,_0x57eb91,_0x42f123,_0x5c4e73){const _0x458887=a26_0xfc1857,{options:_0x1cc05c,tdx:_0x289277}=_0x39a8f4,_0x52df85=await withSpinner(_0x458887(0x169),()=>_0x289277['segment'][_0x458887(0x208)](_0x42f123),{'verbose':_0x1cc05c[_0x458887(0x25c)]}),_0x2823d3=await executeSchemaQuery(_0x52df85['data'],_0x289277,_0x1cc05c),_0x1dbe7b=_0x2823d3['data']['map'](_0x464446=>({'name':_0x464446[_0x458887(0x161)],'type':_0x464446['column_type']})),_0x5b2aa9=await withSpinner(_0x458887(0x1b2),()=>_0x289277[_0x458887(0x13e)]['getBehaviorNames'](_0x42f123),{'verbose':_0x1cc05c[_0x458887(0x25c)]}),_0x147bfd=[];for(const _0x3619ea of _0x5b2aa9['data']){const _0xcd9258=_0x458887(0x15e)+_0x3619ea[_0x458887(0x123)]()[_0x458887(0x28a)](/\s+/g,'_'),_0x5b601e=_0x458887(0x140)+_0x5c4e73+'.'+_0xcd9258;let _0x2e45f9=[];try{const _0x3ad328=await executeSchemaQuery(_0x5b601e,_0x289277,_0x1cc05c);_0x2e45f9=_0x3ad328['data'][_0x458887(0x19f)](_0x8dec2f=>({'name':_0x8dec2f[_0x458887(0x161)],'type':_0x8dec2f[_0x458887(0x27f)]}));}catch{}_0x147bfd[_0x458887(0x25e)]({'table':_0xcd9258,'columns':_0x2e45f9});}return{'database':_0x5c4e73,'parent_segment':_0x57eb91,'parent_id':_0x42f123,'customers':{'table':_0x458887(0x206),'columns':_0x1dbe7b},'behaviors':_0x147bfd};}['formatSchemaJson'](_0x2274a7){const _0x2976a9=a26_0xfc1857,_0x2e7c6c=_0x56c6dc=>{const _0x3819c7=a26_0x163a;if(_0x56c6dc[_0x3819c7(0x18d)]===0x0)return'[]';const _0x5acf07=_0x56c6dc[_0x3819c7(0x19f)](_0x677f8f=>_0x3819c7(0x29c)+_0x677f8f[_0x3819c7(0x1d8)]+_0x3819c7(0x172)+_0x677f8f[_0x3819c7(0x231)]+_0x3819c7(0x204));return'[\x0a'+_0x5acf07['join'](',\x0a')+_0x3819c7(0x20b);},_0x10623d=_0x2274a7[_0x2976a9(0x1fb)][_0x2976a9(0x19f)](_0x1c28a9=>{const _0x202573=_0x2976a9;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1c28a9['table']+_0x202573(0x220)+_0x2e7c6c(_0x1c28a9[_0x202573(0x12c)])['replace'](/^/gm,'\x20\x20')[_0x202573(0x122)]()+_0x202573(0x27e);})[_0x2976a9(0x22c)](',\x0a');return _0x2976a9(0x251)+_0x2274a7[_0x2976a9(0x249)]+_0x2976a9(0x24a)+_0x2274a7[_0x2976a9(0x23e)]+_0x2976a9(0x1e3)+_0x2274a7[_0x2976a9(0x26f)]+_0x2976a9(0x223)+_0x2274a7[_0x2976a9(0x206)]['table']+_0x2976a9(0x108)+_0x2e7c6c(_0x2274a7['customers'][_0x2976a9(0x12c)])[_0x2976a9(0x28a)](/^/gm,'\x20\x20')[_0x2976a9(0x122)]()+_0x2976a9(0x252)+_0x10623d+_0x2976a9(0x238);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a26_0xfc1857(0x14a);[a26_0xfc1857(0x267)]=a26_0xfc1857(0x120);async[a26_0xfc1857(0x19d)](_0x313723){const _0x1a483b=a26_0xfc1857,{options:_0x176733,args:_0x43bde0,tdx:_0x3584a2}=_0x313723,_0x55725a=_0x43bde0[0x0]||_0x176733[_0x1a483b(0x1c8)];if(!_0x55725a)return showParentSegmentNotSetError(_0x1a483b(0x20f)+_0x1a483b(0x253)),0x1;_0x176733['verbose']&&(console[_0x1a483b(0x211)](_0x1a483b(0x270)+_0x176733[_0x1a483b(0x22e)]),console[_0x1a483b(0x211)](_0x1a483b(0x262)+_0x55725a));const _0x1b25ce=await withSpinner(_0x1a483b(0x287)+_0x55725a+_0x1a483b(0x234),()=>_0x3584a2[_0x1a483b(0x13e)][_0x1a483b(0x199)](_0x55725a),{'verbose':_0x176733[_0x1a483b(0x25c)]}),_0x5d0800=_0x1b25ce[_0x1a483b(0x176)],_0x4a6457=await withSpinner(_0x1a483b(0x127)+_0x55725a+_0x1a483b(0x234),()=>_0x3584a2['segment'][_0x1a483b(0x208)](_0x5d0800),{'verbose':_0x176733['verbose']}),_0xe4e374=_0x4a6457[_0x1a483b(0x176)];return _0x176733['format']==='json'||_0x176733['format']===_0x1a483b(0x283)?await handleSDKOutput([{'sql':_0xe4e374}],_0x176733):console[_0x1a483b(0x10b)](_0xe4e374),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x1ea);['description']=a26_0xfc1857(0x1e5);async[a26_0xfc1857(0x19d)](_0x2f4d09){const _0x106536=a26_0xfc1857,{options:_0x2c0c8a,args:_0x343424,tdx:_0x25ae1b}=_0x2f4d09,_0x2671cd=_0x343424[0x0]||_0x2c0c8a[_0x106536(0x1c8)];if(!_0x2671cd)return showParentSegmentNotSetError(_0x106536(0x1b9)+_0x106536(0x1a5)),0x1;_0x2c0c8a[_0x106536(0x25c)]&&(console[_0x106536(0x211)](_0x106536(0x270)+_0x2c0c8a['site']),console['error'](_0x106536(0x262)+_0x2671cd));const _0x52c612=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2671cd+_0x106536(0x234),()=>_0x25ae1b['segment'][_0x106536(0x199)](_0x2671cd),{'verbose':_0x2c0c8a[_0x106536(0x25c)]}),_0x33ef65=_0x52c612['data'],_0x286d57=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2671cd+_0x106536(0x234),()=>_0x25ae1b['segment'][_0x106536(0x208)](_0x33ef65),{'verbose':_0x2c0c8a[_0x106536(0x25c)]});let _0x4e654d=_0x286d57[_0x106536(0x176)];const _0x5a49d5=resolveLimit(_0x2c0c8a[_0x106536(0x16e)],DEFAULT_DISPLAY_LIMIT),_0x3a597c=/\bLIMIT\s+\d+/i[_0x106536(0x1b4)](_0x4e654d);!_0x3a597c&&(_0x4e654d=_0x4e654d[_0x106536(0x122)]()[_0x106536(0x28a)](/;+$/,''),_0x4e654d=_0x106536(0x1ad)+_0x4e654d+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x5a49d5);_0x2c0c8a[_0x106536(0x25c)]&&console[_0x106536(0x211)](_0x106536(0x1c4)+_0x4e654d);const _0x366517=await withProgressSpinner(_0x106536(0x212),async _0x4a5cb5=>{const _0x5aff90=_0x106536,_0x4cc9e2=await _0x25ae1b['query'][_0x5aff90(0x19d)](_0x4e654d,{'catalog':'td','schema':_0x5aff90(0x20c),'onJobId':_0x33d73a=>{const _0x497e2b=_0x5aff90;_0x4a5cb5[_0x497e2b(0x19b)](_0x33d73a);}});return _0x4cc9e2;},{'verbose':_0x2c0c8a['verbose']}),_0x36e9c9=_0x366517[_0x106536(0x176)],_0x2910d3=_0x36e9c9[_0x106536(0x155)]?'\x20[Job\x20ID:\x20'+_0x36e9c9['jobId']+']':'';return console[_0x106536(0x211)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x36e9c9[_0x106536(0x194)][_0x106536(0x29d)][_0x106536(0x293)]()+'\x20rows\x20'+(_0x106536(0x157)+formatElapsed(_0x36e9c9[_0x106536(0x194)]['elapsedTimeMillis'])+_0x2910d3)),await handleQueryOutput(_0x36e9c9,_0x2c0c8a),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x193);[a26_0xfc1857(0x267)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async['execute'](_0x29b89c){const _0x1fbaf1=a26_0xfc1857,{options:_0x45ab65,args:_0x39afb6,tdx:_0x52ce81}=_0x29b89c,_0x4c7221=_0x39afb6[0x0],_0x13a2d2=await withSpinner(_0x4c7221?_0x1fbaf1(0x134)+_0x4c7221+_0x1fbaf1(0x234):_0x1fbaf1(0x256),()=>_0x52ce81[_0x1fbaf1(0x219)][_0x1fbaf1(0x174)](),{'verbose':_0x45ab65[_0x1fbaf1(0x25c)]});let _0x4fa683=_0x13a2d2[_0x1fbaf1(0x176)]['filter'](_0x372f2b=>_0x372f2b['realtime_enabled']);if(_0x4c7221){const _0x10527c=_0x4c7221['replace'](/[.+^${}()|[\]\\]/g,_0x1fbaf1(0x196))[_0x1fbaf1(0x28a)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x5593c2=new RegExp('^'+_0x10527c+'$','i');_0x4fa683=_0x4fa683['filter'](_0x18b9d4=>_0x5593c2[_0x1fbaf1(0x1b4)](_0x18b9d4[_0x1fbaf1(0x1d8)]));}_0x4fa683[_0x1fbaf1(0x1b6)]((_0x3203e9,_0x4d53b2)=>_0x3203e9[_0x1fbaf1(0x1d8)][_0x1fbaf1(0x16c)](_0x4d53b2[_0x1fbaf1(0x1d8)])),console[_0x1fbaf1(0x211)]('✔\x20Found\x20'+_0x4fa683[_0x1fbaf1(0x18d)]+_0x1fbaf1(0x226)+(_0x4fa683[_0x1fbaf1(0x18d)]!==0x1?'s':''));const _0x229a93=_0x5c50fc=>{const _0x475213=_0x1fbaf1;return getConsoleNextUrl(_0x45ab65['site'],_0x475213(0x150)+_0x5c50fc);};if(_0x45ab65['format']===_0x1fbaf1(0x17a)||_0x45ab65[_0x1fbaf1(0x19a)]===_0x1fbaf1(0x283)){const _0x57e974=_0x4fa683[_0x1fbaf1(0x19f)](_0x31124b=>({..._0x31124b,'url':_0x229a93(_0x31124b['id'])}));await handleSDKOutput(_0x57e974,_0x45ab65);}else{if(_0x4fa683[_0x1fbaf1(0x18d)]===0x0)console[_0x1fbaf1(0x10b)](_0x1fbaf1(0x25d));else for(const _0x1bec32 of _0x4fa683){const _0x1acdbe=_0x1bec32[_0x1fbaf1(0x15c)]?a26_0x220b9c[_0x1fbaf1(0x263)]('\x20('+formatRows(_0x1bec32[_0x1fbaf1(0x15c)])+')'):'',_0x5ae7fa=hyperlink(_0x1bec32[_0x1fbaf1(0x1d8)],_0x229a93(_0x1bec32['id']));console[_0x1fbaf1(0x10b)]('⚡\x20'+_0x5ae7fa+_0x1acdbe);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x189);['description']=a26_0xfc1857(0x113);async['execute'](_0x23c95e){const _0x238ffa=a26_0xfc1857,{options:_0x3d046b,args:_0xa8cbba,tdx:_0xa5353}=_0x23c95e,_0x50a529=_0xa8cbba[0x0]||_0x3d046b[_0x238ffa(0x1c8)];if(!_0x50a529)return showParentSegmentNotSetError(_0x238ffa(0x11f)+_0x238ffa(0x18a)),0x1;const _0x2448ef=resolveYamlFile(_0x50a529);if(!existsSync(_0x2448ef))return showFileNotFoundError(_0x2448ef,_0x50a529),0x1;let _0x4c9d83;try{_0x4c9d83=readFileSync(_0x2448ef,_0x238ffa(0x107));}catch(_0xb5c707){const _0x2146d9=_0xb5c707 instanceof Error?_0xb5c707['message']:String(_0xb5c707);return console['error'](_0x238ffa(0x286)+_0x2146d9),0x1;}const _0x1ac4f5=createCommandSpinner(a26_0x220b9c[_0x238ffa(0x263)](_0x238ffa(0x233)),{'verbose':_0x3d046b[_0x238ffa(0x25c)]});_0x1ac4f5[_0x238ffa(0x246)]();const _0x3b0eba={'realtime':!![],'onProgress':_0x1dc478=>{const _0x121fa4=_0x238ffa;_0x1ac4f5[_0x121fa4(0x187)]=formatProgressMessage(_0x1dc478);}};let _0x44c9d6;try{_0x44c9d6=await _0xa5353['segment']['validateParentYaml'](_0x4c9d83,_0x3b0eba),_0x1ac4f5[_0x238ffa(0x1f5)]();}catch(_0x45a4d8){_0x1ac4f5['stop']();throw _0x45a4d8;}console['error']('\x0a'+a26_0x220b9c[_0x238ffa(0x1bf)](_0x238ffa(0x239))+'\x20'+_0x44c9d6[_0x238ffa(0x1d8)]),console[_0x238ffa(0x211)]('═'[_0x238ffa(0x118)](0x3c)),displayRealtimeValidation(_0x44c9d6),console[_0x238ffa(0x211)]('─'[_0x238ffa(0x118)](0x3c));if(_0x44c9d6[_0x238ffa(0x1f9)][_0x238ffa(0x18d)]>0x0){console[_0x238ffa(0x211)]('\x0a'+a26_0x220b9c['red'](_0x238ffa(0x1bc)));for(const _0x29a03e of _0x44c9d6[_0x238ffa(0x1f9)]){console[_0x238ffa(0x211)]('\x20\x20'+a26_0x220b9c[_0x238ffa(0x29b)]('•')+'\x20'+_0x29a03e);}}return _0x44c9d6[_0x238ffa(0x243)]&&console[_0x238ffa(0x211)]('\x0a'+a26_0x220b9c[_0x238ffa(0x143)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x44c9d6[_0x238ffa(0x243)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']='ps:pz:list';[a26_0xfc1857(0x267)]=a26_0xfc1857(0x1de);async['execute'](_0x48e88f){const _0x3a3304=a26_0xfc1857,{options:_0x1fdcb6,args:_0x20611c,tdx:_0x59825c}=_0x48e88f,_0x2ec3e7=_0x20611c[0x0]||_0x1fdcb6[_0x3a3304(0x1c8)];if(!_0x2ec3e7)return showParentSegmentNotSetError(_0x3a3304(0x15f)+'\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 _0x4b8f0e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2ec3e7+'\x27...',()=>_0x59825c[_0x3a3304(0x13e)]['resolveParentId'](_0x2ec3e7),{'verbose':_0x1fdcb6[_0x3a3304(0x25c)]}),_0x5cc66e=_0x4b8f0e['data'],_0x4dac91=await withSpinner(_0x3a3304(0x222)+_0x2ec3e7+'\x27...',()=>_0x59825c[_0x3a3304(0x121)][_0x3a3304(0x174)](_0x5cc66e),{'verbose':_0x1fdcb6[_0x3a3304(0x25c)]}),_0x5080ce=_0x4dac91[_0x3a3304(0x176)];console[_0x3a3304(0x211)](_0x3a3304(0x21f)+_0x5080ce[_0x3a3304(0x18d)]+'\x20personalization\x20service'+(_0x5080ce['length']!==0x1?'s':''));if(_0x1fdcb6[_0x3a3304(0x19a)]==='json'||_0x1fdcb6['format']===_0x3a3304(0x283))await handleSDKOutput(_0x5080ce,_0x1fdcb6);else{if(_0x5080ce['length']===0x0)console[_0x3a3304(0x10b)](_0x3a3304(0x17e)),console[_0x3a3304(0x211)](a26_0x220b9c[_0x3a3304(0x167)](_0x3a3304(0x1a2)));else for(const _0x4d714b of _0x5080ce){const _0x2d8621=_0x4d714b[_0x3a3304(0x1af)]?.[_0x3a3304(0x18d)]||0x0,_0x52cd5c=_0x4d714b[_0x3a3304(0x10e)]?a26_0x220b9c[_0x3a3304(0x263)](_0x3a3304(0x181)+_0x4d714b[_0x3a3304(0x10e)]):'',_0x2d09aa=a26_0x220b9c[_0x3a3304(0x263)]('\x20('+_0x2d8621+_0x3a3304(0x282)+(_0x2d8621!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x4d714b[_0x3a3304(0x1d8)]+_0x52cd5c+_0x2d09aa),_0x4d714b[_0x3a3304(0x267)]&&console['log'](_0x3a3304(0x1d6)+a26_0x220b9c[_0x3a3304(0x263)](_0x4d714b['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0xfc1857(0x1d8)]=a26_0xfc1857(0x1d2);['description']=a26_0xfc1857(0x166);async[a26_0xfc1857(0x19d)](_0x12dc94){const _0x1613b8=a26_0xfc1857,{options:_0x91ccb1,args:_0x4e0fc6}=_0x12dc94,_0x3d1808=_0x4e0fc6[0x0]||_0x91ccb1[_0x1613b8(0x1c8)];if(!_0x3d1808)return showParentSegmentNotSetError(_0x1613b8(0x1e7)+_0x1613b8(0x229)),0x1;const _0x345c8c=resolveYamlFile(_0x3d1808);if(!existsSync(_0x345c8c))return showFileNotFoundError(_0x345c8c,_0x3d1808),0x1;let _0x2c46fd;try{_0x2c46fd=readFileSync(_0x345c8c,'utf-8');}catch(_0x25187b){const _0x4d9976=_0x25187b instanceof Error?_0x25187b[_0x1613b8(0x281)]:String(_0x25187b);return console[_0x1613b8(0x211)](_0x1613b8(0x286)+_0x4d9976),0x1;}let _0x482efb;try{_0x482efb=parseDef(_0x2c46fd);}catch(_0x2f1e26){const _0x2526fa=_0x2f1e26 instanceof Error?_0x2f1e26[_0x1613b8(0x281)]:String(_0x2f1e26);return console[_0x1613b8(0x211)](a26_0x220b9c[_0x1613b8(0x29b)](_0x1613b8(0x1ca)+_0x2526fa)),0x1;}if(_0x482efb[_0x1613b8(0x1a7)]&&_0x482efb[_0x1613b8(0x1a7)][_0x1613b8(0x18d)]>0x0)return console[_0x1613b8(0x211)](a26_0x220b9c['yellow'](_0x1613b8(0x28f)+_0x345c8c)),console[_0x1613b8(0x211)](a26_0x220b9c[_0x1613b8(0x263)](_0x1613b8(0x292)+_0x482efb['personalization_services']['length']+'\x20service(s)\x20configured')),0x1;!_0x482efb['realtime']&&(_0x482efb[_0x1613b8(0x219)]={'events':[{'name':_0x1613b8(0x297),'source_table':'<database>.<table>'}],'attributes':[{'name':_0x1613b8(0x11d),'type':_0x1613b8(0x1eb)}],'id_stitching':{'primary_key':_0x482efb[_0x1613b8(0x1ba)]['table']===_0x1613b8(0x206)?_0x1613b8(0x273):_0x1613b8(0x1f8)}});_0x482efb[_0x1613b8(0x1a7)]=[{'name':_0x1613b8(0x15b),'description':_0x1613b8(0x14e),'trigger_event':_0x1613b8(0x297),'sections':[{'name':_0x1613b8(0x116),'criteria':_0x1613b8(0x27c),'attributes':[_0x1613b8(0x11d)]}]}];const _0x1d7ff5=serializeDef(_0x482efb);return writeFileSync(_0x345c8c,_0x1d7ff5,'utf-8'),console[_0x1613b8(0x211)](a26_0x220b9c['green']('✔')+_0x1613b8(0x23f)+a26_0x220b9c['cyan'](_0x345c8c)),(!_0x482efb[_0x1613b8(0x219)]||_0x2c46fd[_0x1613b8(0x18b)](_0x1613b8(0x1f0))===-0x1)&&console['error'](a26_0x220b9c[_0x1613b8(0x143)]('✔')+_0x1613b8(0x17c)),console['error']('\x0a'+a26_0x220b9c[_0x1613b8(0x263)](_0x1613b8(0x145))),console[_0x1613b8(0x211)]('\x20\x201.\x20Edit\x20'+_0x345c8c+'\x20to\x20configure\x20your\x20personalization\x20service'),console['error'](_0x1613b8(0x197)+a26_0x220b9c['dim']('tdx\x20ps\x20push\x20'+_0x3d1808)+_0x1613b8(0x1c6)),0x0;}}
1
+ const a26_0x3e1dba=a26_0x241c;(function(_0x1b70a2,_0x5f59ff){const _0x4e359c=a26_0x241c,_0x530b8f=_0x1b70a2();while(!![]){try{const _0xe81b65=parseInt(_0x4e359c(0x222))/0x1*(-parseInt(_0x4e359c(0x1ba))/0x2)+parseInt(_0x4e359c(0x289))/0x3+parseInt(_0x4e359c(0x1d2))/0x4+-parseInt(_0x4e359c(0x1ac))/0x5*(parseInt(_0x4e359c(0x2ad))/0x6)+-parseInt(_0x4e359c(0x20c))/0x7+-parseInt(_0x4e359c(0x28b))/0x8+parseInt(_0x4e359c(0x255))/0x9;if(_0xe81b65===_0x5f59ff)break;else _0x530b8f['push'](_0x530b8f['shift']());}catch(_0x115bb0){_0x530b8f['push'](_0x530b8f['shift']());}}}(a26_0x50f9,0x94a8b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x151967 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_0x4d135b 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_0x3e1dba(0x1b2),LEGACY_PARENT_SEGMENT_DIR=a26_0x3e1dba(0x249);function a26_0x241c(_0x3d53ec,_0x3d74fb){_0x3d53ec=_0x3d53ec-0x171;const _0x50f912=a26_0x50f9();let _0x241ca8=_0x50f912[_0x3d53ec];return _0x241ca8;}function openBrowser(_0x381ec5){const _0x11be3e=a26_0x3e1dba,_0x15732f=process[_0x11be3e(0x2d7)],_0x267cc1=_0x15732f===_0x11be3e(0x2a0)?'open':_0x15732f===_0x11be3e(0x28f)?_0x11be3e(0x1e7):_0x11be3e(0x1e9);spawn(_0x267cc1,[_0x381ec5],{'detached':!![],'stdio':'ignore'})[_0x11be3e(0x2a2)]();}function a26_0x50f9(){const _0x5502d0=['\x20Opening\x20','\x20rows)','✔\x20Found\x20','To\x20cancel:','text','Events:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','YAML\x20file:\x20','displayAttributesStats','👥\x20','setJobId','label','matchedCount','Personalization\x20service\x20description','\x20\x20Database:\x20','\x20=\x20','schemaValid','/\x20→\x20','Customers:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','segment:parent:fields','apply','displaySummary','workflowAttemptId','Overwrite\x20\x27','getParentSQL','sourceTableValid','Status:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','behavior','column_name','segment:parent:preview','platform','Error\x20reading\x20file:\x20','Error\x20parsing\x20YAML:\x20','true','endsWith','\x20\x20Columns:\x20','Pattern:\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','personalizationServices','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','repeat','description','use','FINISHED','interval','cyan','Apply\x20changes\x20to\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','allValid','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','No\x20RT-enabled\x20parent\x20segments\x20found','utf-8','/app/dw/parentSegments/','Behaviors','customerPercent','run','table','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x22,\x20\x22type\x22:\x20\x22','single','\x5c$&','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Output\x20Database:','addBehaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','status','Master\x20Table','sort','valid','\x0a\x20\x20\x20\x20]','Attempt:','To\x20view\x20sample\x20data:','.yml','\x20rows\x20','Validate:','stats','personalization_services','verbose','schemaError','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','enabled','displayPreviewHints','timezone','\x20behaviors','varchar','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20sample\x20data...','\x27\x20and\x20run\x20workflow?','\x20to\x20push\x20the\x20configuration','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20[Job\x20ID:\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','displayBehaviorsStats','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\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','segment:parent:view','pushParentYaml','\x22\x20}','join','realtime','\x20Configuration\x20is\x20valid','Available\x20attributes:','\x0aChanges\x20to\x20apply\x20to\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Attributes','/app/workflows/','realtime:','Fetching\x20customers\x20schema...','getParentFull','\x20\x20Tables:\x201\x20customers\x20+\x20','Validating\x20configuration...','joinKey','collectSchema','Updating','\x20RT-enabled\x20parent\x20segment','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20configured','displayColumns','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','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','/{name}.yml\x0a','\x20--behavior\x20\x22','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Updating\x20parent\x20segment\x20\x27','\x20Added\x20RT\x202.0\x20template\x20section','dirname','audienceId','Error:','-1d','all','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','415bhygRm','master','name','\x20\x201.\x20Edit\x20','attributesFile','`\x20to\x20download\x20the\x20configuration\x20first','parent_segments','Output\x20file:\x20','behaviors','listParents','push','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Create\x20parent\x20segment\x20\x27','green','16BOEoSS','string','toFixed','dim','stitchingKeys','displayValidateResults','last_page_viewed','sampleData','site','yes','\x20parent\x20segment\x20\x27','No\x20parent\x20segments\x20found','foreignKey','\x20No\x20changes\x20-\x20','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','message','Error:\x20File\x20not\x20found:\x20','validateParentYaml','errors','\x20tdx\x20wf\x20attempt\x20','keys','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Personalization:','\x20service(s)\x20configured','1156308QCLsCE','format','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Source:','length','No\x20parent\x20segments\x20match\x20pattern:\x20','%)\x20','formatSchemaJson','/attempt/','isDirectory','SELECT\x20*\x20FROM\x20','Creating','Resolving\x20parent\x20segment\x20\x27','\x27...','listFields','Error:\x20Parent\x20segment\x20name\x20is\x20required','Show\x20parent\x20segment\x20schema\x20(column\x20types)','segment:parent:desc','output','double','start','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','xdg-open','data','segment','customerGroup','Next\x20steps:','\x20--attribute\x20\x22','Coverage:','population','Fetching\x20SQL\x20for\x20\x27','database','tdx\x20ps\x20preview\x20','\x27\x20is\x20already\x20up\x20to\x20date','ID\x20Stitching:','Name:\x20','segment:parent:show','\x20\x20\x20\x20-\x20','yellow','\x0aNew\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','/\x20directories\x20exist.','list','tdx\x20ps\x20push\x20','My\x20Service','rowCount','columns','\x20parent\x20segment','Attribute:','Listing\x20personalization\x20services\x20for\x20\x27','runParent','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','RT\x202.0\x20Validate:','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20RT\x20configuration\x20is\x20valid','enriched','Get\x20SQL\x20query\x20for\x20parent\x20segment','29120HfvcBX','customerGroupFile','toLowerCase','previewParentYaml','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','in\x20','addAttributes','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Created','SQL\x20query:\x0a','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','reduce','primaryKey','jobId','\x20total','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0aNo\x20sample\x20data\x20available','user_id','Fetching\x20parent\x20segment\x20\x27','displayRealtimeInfo','112289dgCadi','\x20\x20\x20\x20','Aborted.','stop','column_type','Error:\x20--database\x20and\x20--table\x20are\x20required','behavior_','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20--enriched','Schema\x20saved\x20to\x20','List\x20available\x20fields\x20for\x20segmentation','\x27\x20is\x20up\x20to\x20date','attribute','segment:parent:push','Behavior:','getOutputDatabaseName','toLocaleString','idStitching','map','displayPreviewResults','red','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x0aUsage:\x20tdx\x20ps\x20preview\x20','customersWithEvents','segment:parent:list','\x20--attribute\x20\x22<name>\x22','events','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Session:','Show\x20parent\x20segment\x20details','customers','realtime_enabled','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','trim','/\x20directory.\x0a','Columns:','sourceTableError','parent_segment','session','RT\x202.0:','/sessions/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','getBehaviorNames','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Listing\x20fields\x20for\x20\x27','Master:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Context\x20set:\x20','15212376bQoPeK','List\x20parent\x20segments','test','coveragePercent','totalEvents','.customers)','sections','Table:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','type','Master\x20+\x20Attributes','Analyzing\x20changes...','Join\x20on:','\x20\x202.\x20Run\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Parent\x20segment:\x20','match','web','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','parentSegment','error','Site:\x20','Updated','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x20field','log','segment:parent:create','bold','/\x20and\x20','SELECT\x20*\x20FROM\x20(\x0a','personalization','Listing\x20parent\x20segments...','Errors:','resolveParentId','{\x0a\x20\x20\x22database\x22:\x20\x22','createParent','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','limit','\x20--behavior\x20\x22<name>\x22','addAttributesFile','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','replace','execute','workflowSessionId','✔\x20No\x20changes\x20-\x20\x27','<database>.<table>','Preview:','.yaml','\x0a✔\x20Workflow\x20started','segment:parent:run','\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','552510hdmQJk','Available\x20behaviors:','4833928bnbZEZ','attributes','Rows:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','win32','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20personalization\x20service','filter','\x0a⚠️\x20\x20Both\x20','behaviorsFile','Fetching\x20behavior\x20list...','parent_id','✔\x20Renamed\x20directory\x20to\x20','\x20\x20Note:\x20','localeCompare','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','updateParent','Found\x20YAML\x20file:\x20','pullParentYaml','using\x20the\x20default\x20path:\x20','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','darwin','Join:','unref','Default','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20is\x20already\x20up\x20to\x20date','Attributes:','displayMasterInfo','displaySampleData','\x20section','jsonl','scheduleType','\x20\x20\x20','3462xWSxoq','\x20kill','preview','column','segment:parent:pull','\x0aError:','Options:\x0a','\x20\x20No\x20sample\x20data\x20available','json','scheduleOption'];a26_0x50f9=function(){return _0x5502d0;};return a26_0x50f9();}function migrateLegacyDirectory(){const _0x5bc3ab=a26_0x3e1dba;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4e531c=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4e531c[_0x5bc3ab(0x1dc)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x1f9)](_0x5bc3ab(0x293)+LEGACY_PARENT_SEGMENT_DIR+_0x5bc3ab(0x271)+PARENT_SEGMENT_DIR+_0x5bc3ab(0x1fc))),console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x1bd)](_0x5bc3ab(0x238)+LEGACY_PARENT_SEGMENT_DIR+_0x5bc3ab(0x246))),![];console[_0x5bc3ab(0x269)](a26_0x4d135b['yellow']('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5bc3ab(0x2c8)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x1b9)](_0x5bc3ab(0x297)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2ebbd1){const _0x46b711=_0x2ebbd1 instanceof Error?_0x2ebbd1['message']:String(_0x2ebbd1);return console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x237)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x46b711+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x3e1dba(0x2f0)](_0x352d46){return migrateLegacyDirectory(),super['run'](_0x352d46);}}function resolveYamlFile(_0x225f20){const _0x56add1=a26_0x3e1dba;if(_0x225f20[_0x56add1(0x2db)]('.yml')||_0x225f20[_0x56add1(0x2db)](_0x56add1(0x285)))return _0x225f20;return a26_0x151967[_0x56add1(0x189)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x225f20)+_0x56add1(0x304));}function formatProgressMessage(_0x5ac2bf){const _0x3e4b79=a26_0x3e1dba,_0x320e54=_0x5ac2bf[_0x3e4b79(0x265)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x320e54){const [,_0x44e678,_0x521519,_0x16a590='']=_0x320e54;return a26_0x4d135b[_0x3e4b79(0x1bd)](_0x44e678+':')+'\x20'+_0x521519+a26_0x4d135b[_0x3e4b79(0x1bd)](_0x16a590);}return a26_0x4d135b[_0x3e4b79(0x1bd)](_0x5ac2bf);}function showFileNotFoundError(_0x56e69e,_0x438afa){const _0x49a928=a26_0x3e1dba;console['error'](a26_0x4d135b[_0x49a928(0x237)](_0x49a928(0x1ca)+_0x56e69e+'\x0a')),console[_0x49a928(0x269)](a26_0x4d135b[_0x49a928(0x2e6)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x438afa+_0x49a928(0x1b1)));}function displayRealtimeValidation(_0x20917c){const _0x79c225=a26_0x3e1dba;if(!_0x20917c['realtime'])return;const _0x5dea7f=_0x20917c['realtime'],_0x39daf2=_0x5dea7f[_0x79c225(0x176)]?a26_0x4d135b['green']('⚡\x20Enabled'):a26_0x4d135b[_0x79c225(0x1f9)]('⚡\x20Not\x20enabled');console[_0x79c225(0x269)]('\x0a'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x24b))+'\x20'+_0x39daf2);if(_0x5dea7f[_0x79c225(0x23e)]&&_0x5dea7f[_0x79c225(0x23e)][_0x79c225(0x1d7)]>0x0){console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b['dim'](_0x79c225(0x2bc))+'\x20'+_0x5dea7f[_0x79c225(0x23e)][_0x79c225(0x1d7)]+_0x79c225(0x19c));for(const _0x4fca72 of _0x5dea7f['events']){const _0x4dd9f8=_0x4fca72[_0x79c225(0x2d1)]===![]?a26_0x4d135b[_0x79c225(0x237)]('✘'):a26_0x4d135b[_0x79c225(0x1b9)]('✔');console[_0x79c225(0x269)](_0x79c225(0x223)+_0x4dd9f8+'\x20'+_0x4fca72[_0x79c225(0x1ae)]),_0x4fca72[_0x79c225(0x248)]&&console['error']('\x20\x20\x20\x20\x20\x20'+a26_0x4d135b['red'](_0x4fca72[_0x79c225(0x248)]));}}if(_0x5dea7f[_0x79c225(0x28c)]&&_0x5dea7f[_0x79c225(0x28c)]['length']>0x0){console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x2a6))+'\x20'+_0x5dea7f['attributes'][_0x79c225(0x1d7)]+_0x79c225(0x19c));for(const _0x328f28 of _0x5dea7f[_0x79c225(0x28c)]){const _0x395b5b=_0x328f28[_0x79c225(0x300)]?a26_0x4d135b[_0x79c225(0x1b9)]('✔'):a26_0x4d135b[_0x79c225(0x237)]('✘');console[_0x79c225(0x269)]('\x20\x20\x20\x20'+_0x395b5b+'\x20'+_0x328f28[_0x79c225(0x1ae)]+'\x20'+a26_0x4d135b['dim']('('+_0x328f28[_0x79c225(0x25e)]+')'));}}if(_0x5dea7f['idStitching']){const _0x563e23=_0x5dea7f['idStitching'][_0x79c225(0x1be)]?.[_0x79c225(0x1d7)]?'\x20+\x20['+_0x5dea7f[_0x79c225(0x234)]['stitchingKeys'][_0x79c225(0x189)](',\x20')+']':'';console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x1f5))+'\x20'+_0x5dea7f[_0x79c225(0x234)][_0x79c225(0x219)]+_0x563e23);}if(_0x5dea7f['personalizationServices']&&_0x5dea7f[_0x79c225(0x2df)][_0x79c225(0x1d7)]>0x0){console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x1d0))+'\x20'+_0x5dea7f['personalizationServices'][_0x79c225(0x1d7)]+'\x20service'+(_0x5dea7f[_0x79c225(0x2df)][_0x79c225(0x1d7)]!==0x1?'s':''));for(const _0x148ae7 of _0x5dea7f[_0x79c225(0x2df)]){console['error'](_0x79c225(0x1f8)+_0x148ae7[_0x79c225(0x1ae)]);}}}function showParentSegmentNotSetError(_0x35d67d){const _0x389efd=a26_0x3e1dba;console[_0x389efd(0x269)](a26_0x4d135b[_0x389efd(0x1f9)](_0x389efd(0x2ca))),console[_0x389efd(0x269)](_0x35d67d);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x23c);['description']=a26_0x3e1dba(0x256);async[a26_0x3e1dba(0x280)](_0x1e3aa9){const _0x103fc6=a26_0x3e1dba,{options:_0x23f71a,args:_0x2040fe,tdx:_0x39c4a3}=_0x1e3aa9,_0x53b499=_0x2040fe[0x0];_0x23f71a[_0x103fc6(0x173)]&&(console[_0x103fc6(0x269)](_0x103fc6(0x26a)+_0x23f71a[_0x103fc6(0x1c2)]),_0x53b499&&console[_0x103fc6(0x269)](_0x103fc6(0x2dd)+_0x53b499));const _0x4732d5=await withSpinner(_0x53b499?_0x103fc6(0x229)+_0x53b499+_0x103fc6(0x1e0):_0x103fc6(0x274),()=>_0x39c4a3[_0x103fc6(0x1eb)][_0x103fc6(0x1b5)](),{'verbose':_0x23f71a[_0x103fc6(0x173)]});let _0x333ad6=_0x4732d5['data'];if(_0x53b499){const _0x1c2c93=_0x53b499[_0x103fc6(0x27f)](/[.+^${}()|[\]\\]/g,_0x103fc6(0x2f6))['replace'](/\*/g,'.*')[_0x103fc6(0x27f)](/\?/g,'.'),_0x3a4672=new RegExp('^'+_0x1c2c93+'$','i');_0x333ad6=_0x333ad6[_0x103fc6(0x292)](_0x5ad211=>_0x3a4672['test'](_0x5ad211[_0x103fc6(0x28c)][_0x103fc6(0x1ae)]));}_0x333ad6[_0x103fc6(0x2ff)]((_0x549002,_0x3da814)=>_0x549002[_0x103fc6(0x28c)][_0x103fc6(0x1ae)][_0x103fc6(0x299)](_0x3da814[_0x103fc6(0x28c)][_0x103fc6(0x1ae)])),console['error'](_0x103fc6(0x2b9)+_0x333ad6[_0x103fc6(0x1d7)]+_0x103fc6(0x202)+(_0x333ad6[_0x103fc6(0x1d7)]!==0x1?'s':''));const _0x41174a=_0x395a74=>{const _0x464e42=_0x103fc6;return getConsoleNextUrl(_0x23f71a[_0x464e42(0x1c2)],_0x464e42(0x2ed)+_0x395a74);};if(_0x23f71a[_0x103fc6(0x1d3)]==='json'||_0x23f71a[_0x103fc6(0x1d3)]===_0x103fc6(0x2aa)){const _0xd371f5=_0x333ad6[_0x103fc6(0x235)](_0x2e2a0f=>({..._0x2e2a0f,'url':_0x41174a(_0x2e2a0f['id'])}));await handleSDKOutput(_0xd371f5,_0x23f71a);}else{if(_0x333ad6['length']===0x0)_0x53b499?console[_0x103fc6(0x26e)](_0x103fc6(0x1d8)+_0x53b499):console[_0x103fc6(0x26e)](_0x103fc6(0x1c5));else for(const _0x21c13a of _0x333ad6){const _0x2bb0ac=_0x21c13a['attributes'][_0x103fc6(0x1f0)]?a26_0x4d135b[_0x103fc6(0x1bd)]('\x20('+formatRows(_0x21c13a[_0x103fc6(0x28c)][_0x103fc6(0x1f0)])+')'):'',_0x2a92da=hyperlink(_0x21c13a['attributes'][_0x103fc6(0x1ae)],_0x41174a(_0x21c13a['id']));console[_0x103fc6(0x26e)](_0x103fc6(0x2c0)+_0x2a92da+_0x2bb0ac);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x26f);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x1b7);async[a26_0x3e1dba(0x280)](_0x1cc63f){const _0x4d2a51=a26_0x3e1dba,{options:_0x186557,args:_0x562332,tdx:_0x2b9a76}=_0x1cc63f;console[_0x4d2a51(0x269)](_0x4d2a51(0x290)+_0x4d2a51(0x24e)+_0x4d2a51(0x2f8));const _0x49db19=_0x186557;if(_0x562332[_0x4d2a51(0x1d7)]===0x0)return console[_0x4d2a51(0x269)](a26_0x4d135b[_0x4d2a51(0x237)](_0x4d2a51(0x1e2))),console['error'](_0x4d2a51(0x214)),0x1;const _0x8aeefb=_0x562332[0x0];if(!_0x49db19[_0x4d2a51(0x1f2)]||!_0x49db19[_0x4d2a51(0x2f1)])return console[_0x4d2a51(0x269)](_0x4d2a51(0x227)),console['error'](_0x4d2a51(0x214)),0x1;_0x49db19[_0x4d2a51(0x173)]&&(console['error'](_0x4d2a51(0x26a)+_0x49db19[_0x4d2a51(0x1c2)]),console[_0x4d2a51(0x269)](_0x4d2a51(0x1f6)+_0x8aeefb),console[_0x4d2a51(0x269)]('Database:\x20'+_0x49db19[_0x4d2a51(0x1f2)]),console[_0x4d2a51(0x269)](_0x4d2a51(0x25c)+_0x49db19['table']));const _0xacfb3d=await loadJSONFromOptions(_0x49db19['attributes'],_0x49db19[_0x4d2a51(0x1b0)]),_0x4aaeb2=await loadJSONFromOptions(_0x49db19[_0x4d2a51(0x1b4)],_0x49db19[_0x4d2a51(0x294)]),_0x3eb1b2=await loadJSONFromOptions(_0x49db19[_0x4d2a51(0x1ec)],_0x49db19[_0x4d2a51(0x20d)]),_0x40ecbe={'name':_0x8aeefb,'description':_0x49db19['description'],'scheduleType':_0x49db19[_0x4d2a51(0x2ab)],'scheduleOption':_0x49db19[_0x4d2a51(0x2b6)],'timezone':_0x49db19[_0x4d2a51(0x178)],'master':{'parentDatabaseName':_0x49db19[_0x4d2a51(0x1f2)],'parentTableName':_0x49db19['table']},'attributes':_0xacfb3d,'behaviors':_0x4aaeb2,'customerGroup':_0x3eb1b2},_0x4900ec=await withSpinner(_0x4d2a51(0x1fb)+_0x8aeefb+_0x4d2a51(0x1e0),()=>_0x2b9a76[_0x4d2a51(0x1eb)][_0x4d2a51(0x278)](_0x40ecbe),{'verbose':_0x186557[_0x4d2a51(0x173)]}),_0x5943d7=_0x4900ec[_0x4d2a51(0x1ea)];return console[_0x4d2a51(0x269)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x5943d7['name']+'\x27\x20with\x20ID:\x20'+_0x5943d7['id']),await handleSDKOutput([_0x5943d7],_0x186557),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']='segment:parent:update';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x21d);async['execute'](_0x231654){const _0x36fef2=a26_0x3e1dba,{options:_0x33ecac,args:_0x19df17,tdx:_0x39bcd7}=_0x231654;console[_0x36fef2(0x269)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x36fef2(0x24e)+_0x36fef2(0x2f8));const _0x194b61=_0x33ecac;if(_0x19df17[_0x36fef2(0x1d7)]===0x0)return console[_0x36fef2(0x269)](a26_0x4d135b['red'](_0x36fef2(0x1e2))),console[_0x36fef2(0x269)](_0x36fef2(0x250)),0x1;const _0x2a3c40=_0x19df17[0x0];_0x194b61[_0x36fef2(0x173)]&&(console[_0x36fef2(0x269)](_0x36fef2(0x26a)+_0x194b61[_0x36fef2(0x1c2)]),console[_0x36fef2(0x269)](_0x36fef2(0x264)+_0x2a3c40));const _0x398981=await withSpinner(_0x36fef2(0x263)+_0x2a3c40+_0x36fef2(0x1e0),()=>_0x39bcd7[_0x36fef2(0x1eb)][_0x36fef2(0x193)](_0x2a3c40),{'verbose':_0x194b61[_0x36fef2(0x173)]}),_0x12b54e=_0x398981['data'],_0x2c1fb4=await loadJSONFromOptions(_0x194b61[_0x36fef2(0x213)],_0x194b61[_0x36fef2(0x27d)]),_0x4bfabb=await loadJSONFromOptions(_0x194b61[_0x36fef2(0x2fb)],_0x194b61['addBehaviorsFile']),_0x312552={'name':_0x12b54e[_0x36fef2(0x1ae)],'description':_0x194b61[_0x36fef2(0x2e2)]!==undefined?_0x194b61['description']:_0x12b54e[_0x36fef2(0x2e2)],'scheduleType':_0x194b61[_0x36fef2(0x2ab)]!==undefined?_0x194b61[_0x36fef2(0x2ab)]:_0x12b54e[_0x36fef2(0x2ab)],'scheduleOption':_0x194b61[_0x36fef2(0x2b6)]!==undefined?_0x194b61['scheduleOption']:_0x12b54e[_0x36fef2(0x2b6)],'timezone':_0x194b61[_0x36fef2(0x178)]!==undefined?_0x194b61['timezone']:_0x12b54e[_0x36fef2(0x178)],'master':_0x12b54e[_0x36fef2(0x1ad)],'attributes':_0x2c1fb4?[..._0x12b54e[_0x36fef2(0x28c)]||[],..._0x2c1fb4]:_0x12b54e[_0x36fef2(0x28c)],'behaviors':_0x4bfabb?[..._0x12b54e[_0x36fef2(0x1b4)]||[],..._0x4bfabb]:_0x12b54e[_0x36fef2(0x1b4)],'customerGroup':_0x12b54e[_0x36fef2(0x1ec)]},_0x5bb416=await withSpinner(_0x36fef2(0x1a4)+_0x2a3c40+_0x36fef2(0x1e0),()=>_0x39bcd7[_0x36fef2(0x1eb)][_0x36fef2(0x29b)](_0x2a3c40,_0x312552),{'verbose':_0x194b61[_0x36fef2(0x173)]}),_0x2b6e0a=_0x5bb416['data'];return console[_0x36fef2(0x269)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x2b6e0a['name']+'\x27'),await handleSDKOutput([_0x2b6e0a],_0x194b61),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x2b1);[a26_0x3e1dba(0x2e2)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a26_0x3e1dba(0x280)](_0x470a2c){const _0x2464b8=a26_0x3e1dba,{options:_0x5aa22e,args:_0x186f68,tdx:_0x5bd157}=_0x470a2c,_0x28e1cb=_0x5aa22e,_0x50e5e4=_0x186f68[0x0]||_0x5aa22e[_0x2464b8(0x268)];if(!_0x50e5e4)return showParentSegmentNotSetError(_0x2464b8(0x211)+_0x2464b8(0x24d)),0x1;if(_0x28e1cb[_0x2464b8(0x2e3)]&&_0x28e1cb[_0x2464b8(0x1e5)])return console['error'](a26_0x4d135b[_0x2464b8(0x237)](_0x2464b8(0x1d4))),console['error'](a26_0x4d135b['dim'](_0x2464b8(0x184))),console['error'](a26_0x4d135b[_0x2464b8(0x1bd)](_0x2464b8(0x29e)+PARENT_SEGMENT_DIR+_0x2464b8(0x1a1))),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x2e6)](_0x2464b8(0x27e))),0x1;const _0x210717=_0x28e1cb['output']||a26_0x151967[_0x2464b8(0x189)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x50e5e4)+_0x2464b8(0x304));_0x28e1cb[_0x2464b8(0x173)]&&(console[_0x2464b8(0x269)](_0x2464b8(0x26a)+_0x28e1cb[_0x2464b8(0x1c2)]),console['error'](_0x2464b8(0x264)+_0x50e5e4),console[_0x2464b8(0x269)](_0x2464b8(0x1b3)+_0x210717));const _0x52db54=await withSpinner(_0x2464b8(0x220)+_0x50e5e4+_0x2464b8(0x1e0),()=>_0x5bd157[_0x2464b8(0x1eb)][_0x2464b8(0x29d)](_0x50e5e4),{'verbose':_0x28e1cb[_0x2464b8(0x173)]}),_0x22066b=_0x52db54[_0x2464b8(0x1ea)];if(existsSync(_0x210717)){const _0xddc9a5=readFileSync(_0x210717,'utf-8'),_0x198727=generateDiff(_0xddc9a5,_0x22066b);if(!hasChanges(_0x198727))console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+_0x2464b8(0x1c7)+a26_0x4d135b['cyan'](_0x210717)+_0x2464b8(0x2a5));else{console[_0x2464b8(0x269)]('\x0aChanges\x20to\x20\x27'+_0x210717+'\x27:'),console[_0x2464b8(0x269)]('─'['repeat'](0x3c)),console[_0x2464b8(0x269)](formatDiffWithColors(_0x198727)),console[_0x2464b8(0x269)]('─'[_0x2464b8(0x2e1)](0x3c));if(!_0x28e1cb[_0x2464b8(0x1c3)]){if(!isInteractive())return console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x237)](_0x2464b8(0x2b2)),_0x2464b8(0x2e8)),console[_0x2464b8(0x269)](a26_0x4d135b['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x247ad2=await confirmKey(_0x2464b8(0x2cf)+_0x210717+'\x27?');if(!_0x247ad2)return console[_0x2464b8(0x269)](a26_0x4d135b['yellow']('Aborted.')),0x1;}writeFileSync(_0x210717,_0x22066b,_0x2464b8(0x2ec)),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+_0x2464b8(0x1cf)+a26_0x4d135b['cyan'](_0x210717));}}else{const _0x123dd8=a26_0x151967[_0x2464b8(0x1a6)](_0x210717);!existsSync(_0x123dd8)&&mkdirSync(_0x123dd8,{'recursive':!![]}),writeFileSync(_0x210717,_0x22066b,_0x2464b8(0x2ec)),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x4d135b[_0x2464b8(0x2e6)](_0x210717));}return saveSessionContext({'parent_segment':_0x50e5e4},_0x28e1cb[_0x2464b8(0x24a)]),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+_0x2464b8(0x254)+a26_0x4d135b[_0x2464b8(0x1bd)](_0x2464b8(0x249))+_0x2464b8(0x2c6)+a26_0x4d135b[_0x2464b8(0x2e6)](_0x50e5e4)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x230);[a26_0x3e1dba(0x2e2)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x3e1dba(0x280)](_0x21db49){const _0x2aebaf=a26_0x3e1dba,{options:_0x37fad4,args:_0x145ac3,tdx:_0xabb668}=_0x21db49,_0x35891a=_0x37fad4,_0x21ae78=_0x145ac3[0x0]||_0x37fad4[_0x2aebaf(0x268)];if(!_0x21ae78)return showParentSegmentNotSetError(_0x2aebaf(0x244)+_0x2aebaf(0x2fc)),0x1;const _0x2e903e=resolveYamlFile(_0x21ae78);if(!existsSync(_0x2e903e))return showFileNotFoundError(_0x2e903e,_0x21ae78),0x1;_0x35891a[_0x2aebaf(0x173)]&&(console['error'](_0x2aebaf(0x26a)+_0x35891a[_0x2aebaf(0x1c2)]),console[_0x2aebaf(0x269)](_0x2aebaf(0x2be)+_0x2e903e));let _0x1278da;try{_0x1278da=readFileSync(_0x2e903e,_0x2aebaf(0x2ec));}catch(_0x28ae3f){const _0x5ae95b=_0x28ae3f instanceof Error?_0x28ae3f[_0x2aebaf(0x1c9)]:String(_0x28ae3f);return console[_0x2aebaf(0x269)](_0x2aebaf(0x2d8)+_0x5ae95b),0x1;}const _0x5abd6f=await withSpinner(_0x2aebaf(0x260),()=>_0xabb668[_0x2aebaf(0x1eb)]['pushParentYaml'](_0x1278da),{'verbose':_0x35891a['verbose']}),_0x130c85=_0x5abd6f['data'],{isNew:_0x5ca9d7,name:_0x108a07,hasChanges:_0x407fbb,diffFormatted:_0x3d7bff}=_0x130c85;if(!_0x407fbb)return console[_0x2aebaf(0x269)](_0x2aebaf(0x282)+_0x108a07+_0x2aebaf(0x1f4)),0x0;_0x5ca9d7?console[_0x2aebaf(0x269)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x108a07+'\x27:'):console[_0x2aebaf(0x269)](_0x2aebaf(0x18d)+_0x108a07+'\x27:');console[_0x2aebaf(0x269)]('─'[_0x2aebaf(0x2e1)](0x3c)),console['error'](_0x3d7bff),console[_0x2aebaf(0x269)]('─'['repeat'](0x3c));const _0x2ca3fd=_0x5ca9d7?_0x2aebaf(0x1b8)+_0x108a07+'\x27?':_0x2aebaf(0x2e7)+_0x108a07+'\x27?';if(!_0x35891a[_0x2aebaf(0x1c3)]){if(!isInteractive())return console[_0x2aebaf(0x269)](a26_0x4d135b[_0x2aebaf(0x237)](_0x2aebaf(0x2b2)),_0x2aebaf(0x2e8)),console[_0x2aebaf(0x269)](a26_0x4d135b[_0x2aebaf(0x1bd)](_0x2aebaf(0x17f))),0x1;const _0x525974=await confirmKey(_0x2ca3fd);if(!_0x525974)return console[_0x2aebaf(0x269)](a26_0x4d135b['yellow'](_0x2aebaf(0x224))),0x1;}const _0x3e87f1=_0x5ca9d7?_0x2aebaf(0x1de):_0x2aebaf(0x198),_0x224dcc=await withSpinner(_0x3e87f1+_0x2aebaf(0x1c4)+_0x108a07+_0x2aebaf(0x1e0),()=>_0x130c85[_0x2aebaf(0x2cc)](),{'verbose':_0x35891a[_0x2aebaf(0x173)]}),_0x32a154=_0x224dcc['data'],_0x515f60=getConsoleNextUrl(_0x35891a['site'],'/app/dw/parentSegments/'+_0x32a154['id']),_0x254d1=_0x5ca9d7?'Created':'Updated';return console[_0x2aebaf(0x269)]('✔\x20'+_0x254d1+_0x2aebaf(0x1c4)+_0x32a154[_0x2aebaf(0x1ae)]+'\x27'),console[_0x2aebaf(0x269)]('\x20\x20'+_0x515f60),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']='segment:parent:validate';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x18e);async['execute'](_0x1ed134){const _0x37a77f=a26_0x3e1dba,{options:_0x4306fd,args:_0x108944,tdx:_0x5980f4}=_0x1ed134,_0x385868=_0x4306fd,_0x29b44d=_0x108944[0x0]||_0x4306fd['parentSegment'];if(!_0x29b44d)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x37a77f(0x2b3)+_0x37a77f(0x175)+_0x37a77f(0x28e)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0xc0409=resolveYamlFile(_0x29b44d);if(!existsSync(_0xc0409))return showFileNotFoundError(_0xc0409,_0x29b44d),0x1;_0x385868[_0x37a77f(0x173)]&&(console['error'](_0x37a77f(0x26a)+_0x385868[_0x37a77f(0x1c2)]),console[_0x37a77f(0x269)](_0x37a77f(0x2be)+_0xc0409));let _0x2e4492;try{_0x2e4492=readFileSync(_0xc0409,_0x37a77f(0x2ec));}catch(_0x1484dd){const _0x41786e=_0x1484dd instanceof Error?_0x1484dd[_0x37a77f(0x1c9)]:String(_0x1484dd);return console[_0x37a77f(0x269)](_0x37a77f(0x2d8)+_0x41786e),0x1;}const _0x1584f0=createCommandSpinner(a26_0x4d135b[_0x37a77f(0x1bd)](_0x37a77f(0x195)),{'verbose':_0x385868[_0x37a77f(0x173)]});_0x1584f0[_0x37a77f(0x1e7)]();const _0xae4255={'onProgress':_0x450bc3=>{const _0xa8c910=_0x37a77f;_0x1584f0[_0xa8c910(0x2bb)]=formatProgressMessage(_0x450bc3);}};if(_0x385868['master'])_0xae4255[_0x37a77f(0x1ad)]=!![];if(_0x385868[_0x37a77f(0x20a)])_0xae4255['enriched']=!![];_0x385868[_0x37a77f(0x22f)]&&(_0xae4255[_0x37a77f(0x22f)]=_0x385868[_0x37a77f(0x22f)]);_0x385868[_0x37a77f(0x2d4)]&&(_0xae4255[_0x37a77f(0x2d4)]=_0x385868[_0x37a77f(0x2d4)]);if(_0x385868[_0x37a77f(0x2e5)])_0xae4255[_0x37a77f(0x2e5)]=_0x385868['interval'];let _0x4bae6c;try{_0x4bae6c=await _0x5980f4[_0x37a77f(0x1eb)][_0x37a77f(0x1cb)](_0x2e4492,_0xae4255),_0x1584f0[_0x37a77f(0x225)]();}catch(_0x3941de){_0x1584f0[_0x37a77f(0x225)]();throw _0x3941de;}const _0x55d3fa=_0x385868[_0x37a77f(0x2e5)]||'-1d';return this[_0x37a77f(0x1bf)](_0x4bae6c,_0xae4255,_0xc0409,_0x55d3fa),_0x4bae6c['allValid']?0x0:0x1;}[a26_0x3e1dba(0x1bf)](_0x209e81,_0x4c0c4b,_0x35347f,_0x340ebb){const _0x2311ab=a26_0x3e1dba;console['error']('\x0a'+a26_0x4d135b[_0x2311ab(0x270)](_0x2311ab(0x306))+'\x20'+_0x209e81[_0x2311ab(0x1ae)]),console[_0x2311ab(0x269)]('═'[_0x2311ab(0x2e1)](0x3c)),this[_0x2311ab(0x2a7)](_0x209e81);if(typeof _0x4c0c4b[_0x2311ab(0x22f)]===_0x2311ab(0x1bb)){this[_0x2311ab(0x2bf)](_0x209e81),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,'attribute',_0x4c0c4b[_0x2311ab(0x22f)]);return;}if(_0x4c0c4b['attribute']===!![]){this[_0x2311ab(0x2bf)](_0x209e81),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,_0x2311ab(0x28c));return;}if(typeof _0x4c0c4b[_0x2311ab(0x2d4)]===_0x2311ab(0x1bb)){this['displayBehaviorsStats'](_0x209e81,_0x340ebb),this[_0x2311ab(0x2cd)](_0x209e81),this['displayPreviewHints'](_0x35347f,_0x340ebb,'behavior',_0x4c0c4b[_0x2311ab(0x2d4)]);return;}if(_0x4c0c4b[_0x2311ab(0x2d4)]===!![]){this['displayBehaviorsStats'](_0x209e81,_0x340ebb),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,_0x2311ab(0x1b4));return;}this[_0x2311ab(0x2bf)](_0x209e81),this['displayBehaviorsStats'](_0x209e81,_0x340ebb),this[_0x2311ab(0x221)](_0x209e81),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,_0x2311ab(0x1aa));}[a26_0x3e1dba(0x221)](_0x35e295){displayRealtimeValidation(_0x35e295);}[a26_0x3e1dba(0x177)](_0x2c15dc,_0x41d1d2,_0x24cdeb,_0x2edbae){const _0x29c164=a26_0x3e1dba;console['error']('\x0a'+a26_0x4d135b[_0x29c164(0x1bd)](_0x29c164(0x303)));const _0x54c7fc=_0x41d1d2!==_0x29c164(0x1a9)?'\x20--interval\x20'+_0x41d1d2:'';if(_0x24cdeb==='attribute'&&_0x2edbae)console['error']('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)]('tdx\x20ps\x20preview\x20'+_0x2c15dc+_0x29c164(0x1ee)+_0x2edbae+'\x22'+_0x54c7fc));else{if(_0x24cdeb===_0x29c164(0x2d4)&&_0x2edbae)console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)](_0x29c164(0x1f3)+_0x2c15dc+_0x29c164(0x1a2)+_0x2edbae+'\x22'+_0x54c7fc));else(_0x24cdeb===_0x29c164(0x28c)||_0x24cdeb===_0x29c164(0x1aa))&&console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b['dim'](_0x29c164(0x1f3)+_0x2c15dc+_0x29c164(0x23d)+_0x54c7fc));}(_0x24cdeb==='behaviors'||_0x24cdeb===_0x29c164(0x1aa))&&console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)](_0x29c164(0x1f3)+_0x2c15dc+_0x29c164(0x27c)+_0x54c7fc)),_0x24cdeb===_0x29c164(0x1aa)&&console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)]('tdx\x20ps\x20preview\x20'+_0x2c15dc+_0x29c164(0x22b)+_0x54c7fc));}[a26_0x3e1dba(0x2a7)](_0x496ac6){const _0x13b5cf=a26_0x3e1dba,{master:_0x57cd42}=_0x496ac6,_0x28a31b=_0x57cd42[_0x13b5cf(0x2c7)]?a26_0x4d135b[_0x13b5cf(0x1b9)]('✔'):a26_0x4d135b[_0x13b5cf(0x237)]('✘');console['error']('\x0a'+a26_0x4d135b[_0x13b5cf(0x1bd)](_0x13b5cf(0x2fe))),console[_0x13b5cf(0x269)](_0x28a31b+'\x20'+a26_0x4d135b['bold'](_0x57cd42[_0x13b5cf(0x1f2)]+'.'+_0x57cd42['table'])),_0x57cd42[_0x13b5cf(0x2c7)]?_0x57cd42[_0x13b5cf(0x200)]!==undefined&&console[_0x13b5cf(0x269)]('\x20\x20'+a26_0x4d135b[_0x13b5cf(0x1bd)](_0x13b5cf(0x28d))+'\x20'+a26_0x4d135b[_0x13b5cf(0x2e6)](formatRows(_0x57cd42['rowCount']))):console[_0x13b5cf(0x269)]('\x20\x20'+a26_0x4d135b['red'](_0x13b5cf(0x1a8))+'\x20'+_0x57cd42[_0x13b5cf(0x174)]);}[a26_0x3e1dba(0x2bf)](_0x57d981){const _0x57d719=a26_0x3e1dba;if(_0x57d981[_0x57d719(0x28c)][_0x57d719(0x1d7)]===0x0)return;console[_0x57d719(0x269)]('\x0a'+a26_0x4d135b['dim'](_0x57d719(0x18f)));for(const _0x3aa996 of _0x57d981[_0x57d719(0x28c)]){const _0x21ecf1=_0x3aa996[_0x57d719(0x2c7)]?a26_0x4d135b[_0x57d719(0x1b9)]('✔'):a26_0x4d135b[_0x57d719(0x237)]('✘');let _0x3d113d='';if(_0x3aa996[_0x57d719(0x2c7)]&&_0x3aa996[_0x57d719(0x2c3)]!==undefined&&_0x3aa996[_0x57d719(0x258)]!==undefined){const _0x47796c=_0x3aa996[_0x57d719(0x258)][_0x57d719(0x1bc)](0x1),_0x122532=_0x3aa996[_0x57d719(0x258)]>=0x50?a26_0x4d135b[_0x57d719(0x1b9)]:_0x3aa996[_0x57d719(0x258)]>=0x32?a26_0x4d135b['yellow']:a26_0x4d135b['red'];_0x3d113d='\x20'+a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x1ef))+'\x20'+_0x122532(_0x47796c+'%')+'\x20('+formatRows(_0x3aa996['matchedCount'])+_0x57d719(0x2b8);}console[_0x57d719(0x269)](_0x21ecf1+'\x20'+a26_0x4d135b[_0x57d719(0x270)](_0x3aa996[_0x57d719(0x1ae)])+_0x3d113d),console[_0x57d719(0x269)]('\x20\x20'+a26_0x4d135b['dim'](_0x57d719(0x1d6))+'\x20'+a26_0x4d135b[_0x57d719(0x270)](_0x3aa996[_0x57d719(0x1f2)]+'.'+_0x3aa996[_0x57d719(0x2f1)]));const _0x15af0c=_0x3aa996['joinKey']===_0x3aa996[_0x57d719(0x1c6)]?a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x261))+'\x20'+_0x3aa996[_0x57d719(0x196)]:a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x2a1))+'\x20'+_0x3aa996[_0x57d719(0x196)]+'\x20=\x20'+_0x3aa996[_0x57d719(0x1c6)];console[_0x57d719(0x269)]('\x20\x20'+_0x15af0c),console[_0x57d719(0x269)]('\x20\x20'+a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x247))),this[_0x57d719(0x19d)](_0x3aa996[_0x57d719(0x201)]),!_0x3aa996['schemaValid']&&console[_0x57d719(0x269)]('\x20\x20'+a26_0x4d135b[_0x57d719(0x237)](_0x57d719(0x1a8))+'\x20'+_0x3aa996[_0x57d719(0x174)]);}}[a26_0x3e1dba(0x183)](_0x223435,_0x46078f){const _0x548d30=a26_0x3e1dba;if(_0x223435[_0x548d30(0x1b4)][_0x548d30(0x1d7)]===0x0)return;console[_0x548d30(0x269)]('\x0a'+a26_0x4d135b['dim'](_0x548d30(0x2ee))+'\x20'+a26_0x4d135b['dim']('('+_0x46078f+')'));for(const _0x331033 of _0x223435[_0x548d30(0x1b4)]){const _0x241b8a=_0x331033[_0x548d30(0x2c7)]?a26_0x4d135b[_0x548d30(0x1b9)]('✔'):a26_0x4d135b['red']('✘');let _0x17ce1b='';if(_0x331033[_0x548d30(0x2c7)]&&_0x331033[_0x548d30(0x23b)]!==undefined&&_0x331033[_0x548d30(0x259)]!==undefined){const _0x1a9f31=_0x331033['customerPercent']?.[_0x548d30(0x1bc)](0x1)||'?',_0x434574=(_0x331033[_0x548d30(0x2ef)]??0x0)>=0x32?a26_0x4d135b['green']:(_0x331033[_0x548d30(0x2ef)]??0x0)>=0x14?a26_0x4d135b[_0x548d30(0x1f9)]:a26_0x4d135b['red'];_0x17ce1b='\x20'+a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x2c9))+'\x20'+_0x434574(formatRows(_0x331033[_0x548d30(0x23b)]))+'\x20('+_0x1a9f31+_0x548d30(0x1d9)+a26_0x4d135b['dim'](_0x548d30(0x2bc))+'\x20'+a26_0x4d135b['cyan'](formatRows(_0x331033['totalEvents']));}console[_0x548d30(0x269)](_0x241b8a+'\x20'+a26_0x4d135b[_0x548d30(0x270)](_0x331033[_0x548d30(0x1ae)])+_0x17ce1b),console[_0x548d30(0x269)]('\x20\x20'+a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x1d6))+'\x20'+a26_0x4d135b[_0x548d30(0x270)](_0x331033[_0x548d30(0x1f2)]+'.'+_0x331033[_0x548d30(0x2f1)]));const _0xf6983=_0x331033[_0x548d30(0x196)]===_0x331033[_0x548d30(0x1c6)]?a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x261))+'\x20'+_0x331033[_0x548d30(0x196)]:a26_0x4d135b['dim']('Join:')+'\x20'+_0x331033[_0x548d30(0x196)]+_0x548d30(0x2c6)+_0x331033[_0x548d30(0x1c6)];console[_0x548d30(0x269)]('\x20\x20'+_0xf6983),console[_0x548d30(0x269)]('\x20\x20'+a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x247))),this[_0x548d30(0x19d)](_0x331033[_0x548d30(0x201)]),!_0x331033[_0x548d30(0x2c7)]&&console[_0x548d30(0x269)]('\x20\x20'+a26_0x4d135b[_0x548d30(0x237)](_0x548d30(0x1a8))+'\x20'+_0x331033[_0x548d30(0x174)]);}}[a26_0x3e1dba(0x19d)](_0x5e34b8){const _0x3a7bcd=a26_0x3e1dba;for(const _0x33e37e of _0x5e34b8){_0x33e37e['label']===_0x33e37e[_0x3a7bcd(0x2b0)]||_0x33e37e[_0x3a7bcd(0x2b0)]==='*'?console[_0x3a7bcd(0x269)](_0x3a7bcd(0x1f8)+_0x33e37e[_0x3a7bcd(0x2c2)]):console[_0x3a7bcd(0x269)](_0x3a7bcd(0x1f8)+_0x33e37e[_0x3a7bcd(0x2c2)]+'\x20'+a26_0x4d135b[_0x3a7bcd(0x1bd)]('('+_0x33e37e[_0x3a7bcd(0x2b0)]+')'));}}[a26_0x3e1dba(0x2cd)](_0x4e50cb){const _0x4a27a7=a26_0x3e1dba;console['error']('─'[_0x4a27a7(0x2e1)](0x3c));if(_0x4e50cb[_0x4a27a7(0x1cc)][_0x4a27a7(0x1d7)]>0x0){console[_0x4a27a7(0x269)]('\x0a'+a26_0x4d135b[_0x4a27a7(0x237)](_0x4a27a7(0x275)));for(const _0x52a1e1 of _0x4e50cb[_0x4a27a7(0x1cc)]){console[_0x4a27a7(0x269)]('\x20\x20'+a26_0x4d135b[_0x4a27a7(0x237)]('•')+'\x20'+_0x52a1e1);}}_0x4e50cb[_0x4a27a7(0x2e9)]&&console[_0x4a27a7(0x269)]('\x0a'+a26_0x4d135b[_0x4a27a7(0x1b9)]('✔')+_0x4a27a7(0x18b));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x2d6);[a26_0x3e1dba(0x2e2)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x1fcd5c){const _0x3b4223=a26_0x3e1dba,{options:_0x17c226,args:_0x2cd8f1,tdx:_0x58c271}=_0x1fcd5c,_0xaeca30=_0x17c226,_0x166223=_0x2cd8f1[0x0]||_0x17c226[_0x3b4223(0x268)];if(!_0x166223)return showParentSegmentNotSetError(_0x3b4223(0x1ab)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x3b4223(0x2f7)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x3b4223(0x180)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x3b4223(0x25d)),0x1;if(!_0xaeca30[_0x3b4223(0x1ad)]&&!_0xaeca30[_0x3b4223(0x22f)]&&!_0xaeca30[_0x3b4223(0x2d4)]&&!_0xaeca30[_0x3b4223(0x20a)])return console['error'](a26_0x4d135b[_0x3b4223(0x237)](_0x3b4223(0x2f9))),console[_0x3b4223(0x269)](_0x3b4223(0x267)),console[_0x3b4223(0x269)]('Options:'),console[_0x3b4223(0x269)](_0x3b4223(0x19f)),console['error'](_0x3b4223(0x182)),console[_0x3b4223(0x269)](_0x3b4223(0x2a4)),console[_0x3b4223(0x269)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3fe59d=resolveYamlFile(_0x166223);if(!existsSync(_0x3fe59d))return showFileNotFoundError(_0x3fe59d,_0x166223),0x1;_0xaeca30[_0x3b4223(0x173)]&&(console[_0x3b4223(0x269)](_0x3b4223(0x26a)+_0xaeca30[_0x3b4223(0x1c2)]),console[_0x3b4223(0x269)](_0x3b4223(0x2be)+_0x3fe59d));let _0x2ea1fe;try{_0x2ea1fe=readFileSync(_0x3fe59d,'utf-8');}catch(_0x4a1976){const _0x31ebf8=_0x4a1976 instanceof Error?_0x4a1976[_0x3b4223(0x1c9)]:String(_0x4a1976);return console[_0x3b4223(0x269)]('Error\x20reading\x20file:\x20'+_0x31ebf8),0x1;}let _0x257995;try{_0x257995=parseDef(_0x2ea1fe);}catch(_0x287635){const _0x520e44=_0x287635 instanceof Error?_0x287635[_0x3b4223(0x1c9)]:String(_0x287635);return console[_0x3b4223(0x269)](a26_0x4d135b[_0x3b4223(0x237)]('Error\x20parsing\x20YAML:\x20'+_0x520e44)),0x1;}if(_0xaeca30[_0x3b4223(0x22f)]===!![]||_0xaeca30[_0x3b4223(0x22f)]===''){const _0x71427e=_0x257995[_0x3b4223(0x28c)]?.[_0x3b4223(0x235)](_0x3b7597=>_0x3b7597['name'])||[];if(_0x71427e[_0x3b4223(0x1d7)]===0x0)console['error'](a26_0x4d135b['red'](_0x3b4223(0x19e)));else{console[_0x3b4223(0x269)](a26_0x4d135b[_0x3b4223(0x237)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x3b4223(0x18c));for(const _0x2983c2 of _0x71427e){console[_0x3b4223(0x269)]('\x20\x20'+a26_0x4d135b[_0x3b4223(0x2e6)](_0x2983c2));}console[_0x3b4223(0x269)](_0x3b4223(0x23a)+_0x166223+'\x20--attribute\x20\x22'+_0x71427e[0x0]+'\x22');}return 0x1;}if(_0xaeca30[_0x3b4223(0x2d4)]===!![]||_0xaeca30[_0x3b4223(0x2d4)]===''){const _0x3cfd27=_0x257995['behaviors']?.[_0x3b4223(0x235)](_0x47026d=>_0x47026d[_0x3b4223(0x1ae)])||[];if(_0x3cfd27['length']===0x0)console['error'](a26_0x4d135b[_0x3b4223(0x237)](_0x3b4223(0x19b)));else{console[_0x3b4223(0x269)](a26_0x4d135b[_0x3b4223(0x237)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x3b4223(0x269)](_0x3b4223(0x28a));for(const _0x4aa98d of _0x3cfd27){console['error']('\x20\x20'+a26_0x4d135b[_0x3b4223(0x2e6)](_0x4aa98d));}console[_0x3b4223(0x269)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x166223+_0x3b4223(0x1a2)+_0x3cfd27[0x0]+'\x22');}return 0x1;}const _0x35fef2=createCommandSpinner(a26_0x4d135b['dim'](_0x3b4223(0x17c)),{'verbose':_0xaeca30[_0x3b4223(0x173)]});_0x35fef2[_0x3b4223(0x1e7)]();const _0x2c5eb2={'onProgress':_0x168eda=>{const _0x2d41e3=_0x3b4223;_0x35fef2[_0x2d41e3(0x2bb)]=formatProgressMessage(_0x168eda);}};if(_0xaeca30[_0x3b4223(0x1ad)])_0x2c5eb2['master']=!![];if(_0xaeca30[_0x3b4223(0x22f)]&&typeof _0xaeca30[_0x3b4223(0x22f)]===_0x3b4223(0x1bb))_0x2c5eb2['attribute']=_0xaeca30[_0x3b4223(0x22f)];if(_0xaeca30[_0x3b4223(0x2d4)]&&typeof _0xaeca30[_0x3b4223(0x2d4)]===_0x3b4223(0x1bb))_0x2c5eb2[_0x3b4223(0x2d4)]=_0xaeca30[_0x3b4223(0x2d4)];if(_0xaeca30['enriched'])_0x2c5eb2['enriched']=!![];if(_0xaeca30['interval'])_0x2c5eb2[_0x3b4223(0x2e5)]=_0xaeca30['interval'];let _0x278f90;try{_0x278f90=await _0x58c271[_0x3b4223(0x1eb)][_0x3b4223(0x20f)](_0x2ea1fe,_0x2c5eb2),_0x35fef2[_0x3b4223(0x225)]();}catch(_0x50493c){_0x35fef2[_0x3b4223(0x225)]();throw _0x50493c;}return await this[_0x3b4223(0x236)](_0x278f90,{'master':_0xaeca30[_0x3b4223(0x1ad)],'attribute':typeof _0xaeca30[_0x3b4223(0x22f)]==='string'?_0xaeca30[_0x3b4223(0x22f)]:undefined,'behavior':typeof _0xaeca30[_0x3b4223(0x2d4)]==='string'?_0xaeca30[_0x3b4223(0x2d4)]:undefined,'enriched':_0xaeca30[_0x3b4223(0x20a)]}),_0x278f90['allValid']?0x0:0x1;}async[a26_0x3e1dba(0x236)](_0x5189d8,_0x4fa508){const _0x59b86c=a26_0x3e1dba;console['error']('\x0a'+a26_0x4d135b['bold'](_0x59b86c(0x284))+'\x20'+_0x5189d8['name']),console[_0x59b86c(0x269)]('═'[_0x59b86c(0x2e1)](0x3c));if(_0x4fa508['master']&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x2ea278=a26_0x4d135b['dim'](_0x59b86c(0x252))+'\x20'+a26_0x4d135b[_0x59b86c(0x270)](_0x5189d8[_0x59b86c(0x1ad)][_0x59b86c(0x1f2)]+'.'+_0x5189d8['master'][_0x59b86c(0x2f1)]);await this[_0x59b86c(0x2a8)](_0x2ea278,_0x5189d8[_0x59b86c(0x1c1)]);}else{if(_0x4fa508['attribute']&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x46ee22=a26_0x4d135b[_0x59b86c(0x1bd)](_0x59b86c(0x203))+'\x20'+a26_0x4d135b['bold'](_0x4fa508['attribute']);await this[_0x59b86c(0x2a8)](_0x46ee22,_0x5189d8['sampleData']);}else{if(_0x4fa508[_0x59b86c(0x2d4)]&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x47a337=a26_0x4d135b[_0x59b86c(0x1bd)](_0x59b86c(0x231))+'\x20'+a26_0x4d135b[_0x59b86c(0x270)](_0x4fa508[_0x59b86c(0x2d4)]);await this[_0x59b86c(0x2a8)](_0x47a337,_0x5189d8[_0x59b86c(0x1c1)]);}else{if(_0x4fa508[_0x59b86c(0x20a)]&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x244db9=a26_0x4d135b[_0x59b86c(0x1bd)]('Enriched:')+'\x20'+a26_0x4d135b[_0x59b86c(0x270)](_0x59b86c(0x25f));await this[_0x59b86c(0x2a8)](_0x244db9,_0x5189d8[_0x59b86c(0x1c1)]);}else!_0x5189d8[_0x59b86c(0x1c1)]&&console[_0x59b86c(0x269)](_0x59b86c(0x21e));}}}if(_0x5189d8[_0x59b86c(0x1cc)]['length']>0x0){console[_0x59b86c(0x269)]('─'[_0x59b86c(0x2e1)](0x3c)),console[_0x59b86c(0x269)]('\x0a'+a26_0x4d135b['red'](_0x59b86c(0x275)));for(const _0x167563 of _0x5189d8[_0x59b86c(0x1cc)]){console[_0x59b86c(0x269)]('\x20\x20'+a26_0x4d135b[_0x59b86c(0x237)]('•')+'\x20'+_0x167563);}}}async[a26_0x3e1dba(0x2a8)](_0x6fae60,_0x20a7b2){const _0x365bc8=a26_0x3e1dba;if(_0x20a7b2['length']===0x0){console['error']('\x0a'+_0x6fae60),console[_0x365bc8(0x269)](_0x365bc8(0x2b4));return;}console[_0x365bc8(0x269)]('\x0a'+_0x6fae60);const _0x5b5a3c=Object[_0x365bc8(0x1ce)](_0x20a7b2[0x0])[_0x365bc8(0x235)](_0x163317=>({'name':_0x163317,'type':typeof _0x20a7b2[0x0][_0x163317]==='number'?_0x365bc8(0x1e6):_0x365bc8(0x17a)})),_0x411752={'queryId':_0x365bc8(0x2af),'columns':_0x5b5a3c,'data':_0x20a7b2,'stats':{'state':_0x365bc8(0x2e4),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x20a7b2['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1428e7=formatAsTable(_0x411752,_0x20a7b2[_0x365bc8(0x1d7)],!![]);await writeOutput(_0x1428e7,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a26_0x3e1dba(0x287);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x279);async[a26_0x3e1dba(0x280)](_0x24ef76){const _0x97c0d8=a26_0x3e1dba,{options:_0xa69d68,args:_0x5131bf,tdx:_0xfd705e}=_0x24ef76,_0x3ac880=_0xa69d68,_0x27190e=_0x5131bf[0x0]||_0xa69d68['parentSegment'];if(!_0x27190e)return showParentSegmentNotSetError(_0x97c0d8(0x1e8)+_0x97c0d8(0x1d5)),0x1;const _0x30f428=resolveYamlFile(_0x27190e);if(existsSync(_0x30f428)){_0x3ac880[_0x97c0d8(0x173)]&&console[_0x97c0d8(0x269)](_0x97c0d8(0x29c)+_0x30f428);let _0x7d2cbb;try{_0x7d2cbb=readFileSync(_0x30f428,'utf-8');}catch(_0x261251){const _0x50acf1=_0x261251 instanceof Error?_0x261251[_0x97c0d8(0x1c9)]:String(_0x261251);return console[_0x97c0d8(0x269)]('Error\x20reading\x20file:\x20'+_0x50acf1),0x1;}const _0x4f971f=await withSpinner(_0x97c0d8(0x260),()=>_0xfd705e[_0x97c0d8(0x1eb)][_0x97c0d8(0x187)](_0x7d2cbb),{'verbose':_0x3ac880[_0x97c0d8(0x173)]}),_0x495cd1=_0x4f971f[_0x97c0d8(0x1ea)],{isNew:_0x38498a,name:_0x2cc166,hasChanges:_0x58cec3,diffFormatted:_0x38e538}=_0x495cd1;if(_0x58cec3){_0x38498a?console[_0x97c0d8(0x269)](_0x97c0d8(0x1fa)+_0x2cc166+'\x27:'):console[_0x97c0d8(0x269)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x2cc166+'\x27:');console['error']('─'[_0x97c0d8(0x2e1)](0x3c)),console[_0x97c0d8(0x269)](_0x38e538),console[_0x97c0d8(0x269)]('─'[_0x97c0d8(0x2e1)](0x3c));const _0x2109a6=_0x38498a?_0x97c0d8(0x1b8)+_0x2cc166+_0x97c0d8(0x17d):_0x97c0d8(0x2e7)+_0x2cc166+_0x97c0d8(0x17d);if(!_0x3ac880['yes']){if(!isInteractive())return console[_0x97c0d8(0x269)](a26_0x4d135b[_0x97c0d8(0x237)](_0x97c0d8(0x2b2)),_0x97c0d8(0x2e8)),console[_0x97c0d8(0x269)](a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x17f))),0x1;const _0x590089=await confirmKey(_0x2109a6);if(!_0x590089)return console[_0x97c0d8(0x269)](a26_0x4d135b[_0x97c0d8(0x1f9)]('Aborted.')),0x1;}const _0x3e1185=_0x38498a?_0x97c0d8(0x1de):_0x97c0d8(0x198);await withSpinner(_0x3e1185+_0x97c0d8(0x1c4)+_0x2cc166+_0x97c0d8(0x1e0),()=>_0x495cd1['apply'](),{'verbose':_0x3ac880[_0x97c0d8(0x173)]});const _0xa1c854=_0x38498a?_0x97c0d8(0x215):_0x97c0d8(0x26b);console[_0x97c0d8(0x269)]('✔\x20'+_0xa1c854+_0x97c0d8(0x1c4)+_0x2cc166+'\x27');}else console[_0x97c0d8(0x269)]('✔\x20No\x20changes\x20-\x20\x27'+_0x2cc166+_0x97c0d8(0x22e));}const _0x389e76=await withSpinner(_0x97c0d8(0x2de)+_0x27190e+_0x97c0d8(0x1e0),()=>_0xfd705e[_0x97c0d8(0x1eb)][_0x97c0d8(0x205)](_0x27190e),{'verbose':_0x3ac880['verbose']}),_0x4c5594=_0x389e76[_0x97c0d8(0x1ea)],_0x120499=getConsoleUrl(_0x3ac880[_0x97c0d8(0x1c2)],_0x97c0d8(0x190)+_0x4c5594['workflowId']+_0x97c0d8(0x24c)+_0x4c5594[_0x97c0d8(0x281)]+_0x97c0d8(0x1db)+_0x4c5594[_0x97c0d8(0x2ce)]);return console['error'](_0x97c0d8(0x286)),console[_0x97c0d8(0x269)]('\x20\x20'+a26_0x4d135b[_0x97c0d8(0x1bd)]('Audience\x20ID:')+'\x20'+_0x4c5594[_0x97c0d8(0x1a7)]),console[_0x97c0d8(0x269)]('\x20\x20'+a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x2d2))+'\x20'+_0x4c5594[_0x97c0d8(0x2fd)]),console['error']('\x20\x20'+a26_0x4d135b['dim'](_0x97c0d8(0x240))+'\x20'+_0x4c5594[_0x97c0d8(0x281)]),console[_0x97c0d8(0x269)]('\x20\x20'+a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x302))+'\x20'+_0x4c5594[_0x97c0d8(0x2ce)]),console[_0x97c0d8(0x269)]('\x20\x20'+_0x120499),console['error']('\x0a'+a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x2ba))+_0x97c0d8(0x1cd)+_0x4c5594[_0x97c0d8(0x2ce)]+_0x97c0d8(0x2ae)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x2cb);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x22d);async[a26_0x3e1dba(0x280)](_0x2c54dc){const _0x193520=a26_0x3e1dba,{options:_0x1c2a45,args:_0x293fec,tdx:_0x524f3b}=_0x2c54dc,_0x1ec463=_0x293fec[0x0]||_0x1c2a45[_0x193520(0x268)];if(!_0x1ec463)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x193520(0x2f2)),0x1;_0x1c2a45['verbose']&&(console[_0x193520(0x269)](_0x193520(0x26a)+_0x1c2a45[_0x193520(0x1c2)]),console[_0x193520(0x269)](_0x193520(0x264)+_0x1ec463));const _0x1da029=await withSpinner(_0x193520(0x251)+_0x1ec463+_0x193520(0x1e0),()=>_0x524f3b['segment'][_0x193520(0x1e1)](_0x1ec463),{'verbose':_0x1c2a45[_0x193520(0x173)]}),_0x1fa44a=_0x1da029[_0x193520(0x1ea)];console[_0x193520(0x269)](_0x193520(0x2b9)+_0x1fa44a[_0x193520(0x1d7)]+_0x193520(0x26d)+(_0x1fa44a['length']!==0x1?'s':''));if(_0x1c2a45[_0x193520(0x2b5)]||_0x1c2a45[_0x193520(0x2aa)])return await handleSDKOutput(_0x1fa44a,_0x1c2a45),0x0;return displayFieldsHumanReadable(_0x1fa44a,_0x1ec463),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x186);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x241);async[a26_0x3e1dba(0x280)](_0x4b046a){const _0x4cecce=a26_0x3e1dba,{options:_0x6f3e22,args:_0xef4c70,tdx:_0x536cb5}=_0x4b046a,_0x4c4787=_0x6f3e22,_0xc66606=_0xef4c70[0x0]||_0x6f3e22['parentSegment'];if(!_0xc66606)return showParentSegmentNotSetError(_0x4cecce(0x2f3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x4cecce(0x2b3)+_0x4cecce(0x23f)),0x1;_0x6f3e22[_0x4cecce(0x173)]&&(console[_0x4cecce(0x269)](_0x4cecce(0x26a)+_0x6f3e22['site']),console[_0x4cecce(0x269)](_0x4cecce(0x264)+_0xc66606));const _0x4d9178=await withSpinner(_0x4cecce(0x220)+_0xc66606+_0x4cecce(0x1e0),()=>_0x536cb5[_0x4cecce(0x1eb)]['getParentFull'](_0xc66606),{'verbose':_0x6f3e22[_0x4cecce(0x173)]}),_0x39d0bf=_0x4d9178[_0x4cecce(0x1ea)];if(_0x4c4787[_0x4cecce(0x266)]){const _0x1bba2a=getConsoleNextUrl(_0x4c4787[_0x4cecce(0x1c2)],'/app/dw/parentSegments/'+_0x39d0bf['id']);return console['error'](a26_0x4d135b[_0x4cecce(0x1b9)]('✔')+_0x4cecce(0x2b7)+a26_0x4d135b[_0x4cecce(0x2e6)](_0x1bba2a)),openBrowser(_0x1bba2a),0x0;}return await handleSingleObjectOutput(_0x39d0bf,_0x6f3e22),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x1e4);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x1e3);async[a26_0x3e1dba(0x280)](_0x607ad5){const _0x766005=a26_0x3e1dba,{options:_0x4b6e57,args:_0x9f6a5e,tdx:_0x50f380}=_0x607ad5,_0x399d07=_0x4b6e57,_0x576f19=_0x9f6a5e[0x0]||_0x4b6e57[_0x766005(0x268)];if(!_0x576f19)return showParentSegmentNotSetError('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\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x766005(0x2e0)),0x1;_0x4b6e57[_0x766005(0x173)]&&(console[_0x766005(0x269)](_0x766005(0x26a)+_0x4b6e57['site']),console['error'](_0x766005(0x264)+_0x576f19));const _0x2538d2=await withSpinner(_0x766005(0x1df)+_0x576f19+_0x766005(0x1e0),()=>_0x50f380[_0x766005(0x1eb)]['resolveParentId'](_0x576f19),{'verbose':_0x4b6e57[_0x766005(0x173)]}),_0x446b5f=_0x2538d2[_0x766005(0x1ea)],_0x2a8b09=_0x50f380[_0x766005(0x1eb)][_0x766005(0x232)](_0x446b5f);if(_0x399d07[_0x766005(0x1e5)]){const _0x235a71=await this[_0x766005(0x197)](_0x607ad5,_0x576f19,_0x446b5f,_0x2a8b09),_0x80eeb=this[_0x766005(0x1da)](_0x235a71);writeFileSync(_0x399d07[_0x766005(0x1e5)],_0x80eeb);const _0xfd102f=_0x235a71[_0x766005(0x242)][_0x766005(0x201)][_0x766005(0x1d7)]+_0x235a71[_0x766005(0x1b4)][_0x766005(0x218)]((_0x1881c8,_0x12b5f3)=>_0x1881c8+_0x12b5f3[_0x766005(0x201)][_0x766005(0x1d7)],0x0),_0xce9af6=_0x235a71[_0x766005(0x1b4)]['filter'](_0xfce6b=>_0xfce6b[_0x766005(0x201)]['length']===0x0)['length'];return console[_0x766005(0x26e)](_0x766005(0x22c)+_0x399d07[_0x766005(0x1e5)]),console['log'](_0x766005(0x2c5)+_0x2a8b09),console[_0x766005(0x26e)](_0x766005(0x194)+_0x235a71[_0x766005(0x1b4)]['length']+_0x766005(0x179)),console[_0x766005(0x26e)](_0x766005(0x2dc)+_0xfd102f+_0x766005(0x21b)),_0xce9af6>0x0&&console[_0x766005(0x26e)](_0x766005(0x298)+_0xce9af6+_0x766005(0x210)),0x0;}console[_0x766005(0x269)]('\x0a'+a26_0x4d135b[_0x766005(0x270)](_0x766005(0x2fa))+'\x20'+a26_0x4d135b[_0x766005(0x2e6)](_0x2a8b09));const _0x2da719=await withSpinner(_0x766005(0x192),()=>_0x50f380[_0x766005(0x1eb)][_0x766005(0x2d0)](_0x446b5f),{'verbose':_0x4b6e57[_0x766005(0x173)]});console[_0x766005(0x269)]('\x0a'+a26_0x4d135b[_0x766005(0x270)](_0x766005(0x242))+'\x20'+a26_0x4d135b[_0x766005(0x1bd)]('('+_0x2a8b09+_0x766005(0x25a)));const _0x21035e=await executeSchemaQuery(_0x2da719[_0x766005(0x1ea)],_0x50f380,_0x4b6e57);await handleQueryOutput(_0x21035e,_0x4b6e57);const _0x1f7d06=await withSpinner(_0x766005(0x295),()=>_0x50f380[_0x766005(0x1eb)]['getBehaviorNames'](_0x446b5f),{'verbose':_0x4b6e57['verbose']});for(const _0x54f16e of _0x1f7d06[_0x766005(0x1ea)]){const _0x57c0aa=_0x766005(0x228)+_0x54f16e[_0x766005(0x20e)]()[_0x766005(0x27f)](/\s+/g,'_'),_0x2f57a5=_0x766005(0x1dd)+_0x2a8b09+'.'+_0x57c0aa;console[_0x766005(0x269)]('\x0a'+a26_0x4d135b['bold'](_0x54f16e)+'\x20'+a26_0x4d135b[_0x766005(0x1bd)]('('+_0x2a8b09+'.'+_0x57c0aa+')'));try{const _0x25a9f7=await executeSchemaQuery(_0x2f57a5,_0x50f380,_0x4b6e57);await handleQueryOutput(_0x25a9f7,_0x4b6e57);}catch{console['error'](a26_0x4d135b[_0x766005(0x1f9)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a26_0x3e1dba(0x197)](_0x5e93f6,_0x4e16df,_0x1836ec,_0x39b278){const _0x2d7588=a26_0x3e1dba,{options:_0x30b9ca,tdx:_0x4fd214}=_0x5e93f6,_0x4c2ea2=await withSpinner(_0x2d7588(0x192),()=>_0x4fd214['segment'][_0x2d7588(0x2d0)](_0x1836ec),{'verbose':_0x30b9ca['verbose']}),_0x575c83=await executeSchemaQuery(_0x4c2ea2[_0x2d7588(0x1ea)],_0x4fd214,_0x30b9ca),_0x263699=_0x575c83[_0x2d7588(0x1ea)][_0x2d7588(0x235)](_0x37028d=>({'name':_0x37028d[_0x2d7588(0x2d5)],'type':_0x37028d[_0x2d7588(0x226)]})),_0x2017b5=await withSpinner(_0x2d7588(0x295),()=>_0x4fd214[_0x2d7588(0x1eb)][_0x2d7588(0x24f)](_0x1836ec),{'verbose':_0x30b9ca['verbose']}),_0x13b72c=[];for(const _0x101773 of _0x2017b5[_0x2d7588(0x1ea)]){const _0x5a3ae9='behavior_'+_0x101773['toLowerCase']()['replace'](/\s+/g,'_'),_0x4a7edf=_0x2d7588(0x1dd)+_0x39b278+'.'+_0x5a3ae9;let _0x2a3ed9=[];try{const _0x3edd28=await executeSchemaQuery(_0x4a7edf,_0x4fd214,_0x30b9ca);_0x2a3ed9=_0x3edd28[_0x2d7588(0x1ea)][_0x2d7588(0x235)](_0xe3fbc6=>({'name':_0xe3fbc6[_0x2d7588(0x2d5)],'type':_0xe3fbc6[_0x2d7588(0x226)]}));}catch{}_0x13b72c[_0x2d7588(0x1b6)]({'table':_0x5a3ae9,'columns':_0x2a3ed9});}return{'database':_0x39b278,'parent_segment':_0x4e16df,'parent_id':_0x1836ec,'customers':{'table':_0x2d7588(0x242),'columns':_0x263699},'behaviors':_0x13b72c};}[a26_0x3e1dba(0x1da)](_0x480ca8){const _0x50fc64=a26_0x3e1dba,_0x3c8579=_0x1b2d9d=>{const _0x4bfd54=a26_0x241c;if(_0x1b2d9d[_0x4bfd54(0x1d7)]===0x0)return'[]';const _0x5d75d5=_0x1b2d9d[_0x4bfd54(0x235)](_0x3a518f=>_0x4bfd54(0x22a)+_0x3a518f[_0x4bfd54(0x1ae)]+_0x4bfd54(0x2f4)+_0x3a518f[_0x4bfd54(0x25e)]+_0x4bfd54(0x188));return'[\x0a'+_0x5d75d5[_0x4bfd54(0x189)](',\x0a')+_0x4bfd54(0x301);},_0x331f5e=_0x480ca8[_0x50fc64(0x1b4)][_0x50fc64(0x235)](_0x32fd6b=>{const _0x4c1619=_0x50fc64;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x32fd6b[_0x4c1619(0x2f1)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x3c8579(_0x32fd6b['columns'])[_0x4c1619(0x27f)](/^/gm,'\x20\x20')[_0x4c1619(0x245)]()+'\x0a\x20\x20\x20\x20}';})[_0x50fc64(0x189)](',\x0a');return _0x50fc64(0x277)+_0x480ca8[_0x50fc64(0x1f2)]+_0x50fc64(0x206)+_0x480ca8[_0x50fc64(0x249)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x480ca8[_0x50fc64(0x296)]+_0x50fc64(0x1a3)+_0x480ca8[_0x50fc64(0x242)][_0x50fc64(0x2f1)]+_0x50fc64(0x208)+_0x3c8579(_0x480ca8[_0x50fc64(0x242)][_0x50fc64(0x201)])[_0x50fc64(0x27f)](/^/gm,'\x20\x20')[_0x50fc64(0x245)]()+_0x50fc64(0x27a)+_0x331f5e+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]='segment:parent:sql';['description']=a26_0x3e1dba(0x20b);async['execute'](_0x383e20){const _0x4e4c5f=a26_0x3e1dba,{options:_0xe75af6,args:_0x2c1dc1,tdx:_0x40d3c5}=_0x383e20,_0x7d799a=_0x2c1dc1[0x0]||_0xe75af6[_0x4e4c5f(0x268)];if(!_0x7d799a)return showParentSegmentNotSetError(_0x4e4c5f(0x2bd)+_0x4e4c5f(0x253)),0x1;_0xe75af6[_0x4e4c5f(0x173)]&&(console[_0x4e4c5f(0x269)](_0x4e4c5f(0x26a)+_0xe75af6[_0x4e4c5f(0x1c2)]),console[_0x4e4c5f(0x269)]('Parent\x20segment:\x20'+_0x7d799a));const _0x539a30=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x7d799a+_0x4e4c5f(0x1e0),()=>_0x40d3c5['segment']['resolveParentId'](_0x7d799a),{'verbose':_0xe75af6[_0x4e4c5f(0x173)]}),_0x12a1e1=_0x539a30['data'],_0x3184a2=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x7d799a+_0x4e4c5f(0x1e0),()=>_0x40d3c5[_0x4e4c5f(0x1eb)]['getParentSQL'](_0x12a1e1),{'verbose':_0xe75af6[_0x4e4c5f(0x173)]}),_0x3fbbc1=_0x3184a2[_0x4e4c5f(0x1ea)];return _0xe75af6['format']===_0x4e4c5f(0x2b5)||_0xe75af6[_0x4e4c5f(0x1d3)]===_0x4e4c5f(0x2aa)?await handleSDKOutput([{'sql':_0x3fbbc1}],_0xe75af6):console['log'](_0x3fbbc1),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x1f7);['description']=a26_0x3e1dba(0x2d3);async[a26_0x3e1dba(0x280)](_0x3947bd){const _0x3ee091=a26_0x3e1dba,{options:_0x3f71c5,args:_0x3756f5,tdx:_0x5cc711}=_0x3947bd,_0x249f34=_0x3756f5[0x0]||_0x3f71c5[_0x3ee091(0x268)];if(!_0x249f34)return showParentSegmentNotSetError(_0x3ee091(0x19a)+'\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;_0x3f71c5[_0x3ee091(0x173)]&&(console['error'](_0x3ee091(0x26a)+_0x3f71c5[_0x3ee091(0x1c2)]),console[_0x3ee091(0x269)]('Parent\x20segment:\x20'+_0x249f34));const _0x5a2d85=await withSpinner(_0x3ee091(0x1df)+_0x249f34+_0x3ee091(0x1e0),()=>_0x5cc711[_0x3ee091(0x1eb)][_0x3ee091(0x276)](_0x249f34),{'verbose':_0x3f71c5[_0x3ee091(0x173)]}),_0x96c2fb=_0x5a2d85[_0x3ee091(0x1ea)],_0x1432a1=await withSpinner(_0x3ee091(0x1f1)+_0x249f34+_0x3ee091(0x1e0),()=>_0x5cc711[_0x3ee091(0x1eb)]['getParentSQL'](_0x96c2fb),{'verbose':_0x3f71c5[_0x3ee091(0x173)]});let _0x84cbfe=_0x1432a1[_0x3ee091(0x1ea)];const _0x1d98a4=resolveLimit(_0x3f71c5[_0x3ee091(0x27b)],DEFAULT_DISPLAY_LIMIT),_0x2becde=/\bLIMIT\s+\d+/i[_0x3ee091(0x257)](_0x84cbfe);!_0x2becde&&(_0x84cbfe=_0x84cbfe['trim']()['replace'](/;+$/,''),_0x84cbfe=_0x3ee091(0x272)+_0x84cbfe+_0x3ee091(0x29a)+_0x1d98a4);_0x3f71c5[_0x3ee091(0x173)]&&console[_0x3ee091(0x269)](_0x3ee091(0x216)+_0x84cbfe);const _0x59a3a4=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x3e6ab7=>{const _0x122457=_0x3ee091,_0x459a29=await _0x5cc711['query'][_0x122457(0x280)](_0x84cbfe,{'catalog':'td','schema':'information_schema','onJobId':_0x161032=>{const _0x3a49a9=_0x122457;_0x3e6ab7[_0x3a49a9(0x2c1)](_0x161032);}});return _0x459a29;},{'verbose':_0x3f71c5['verbose']}),_0x57ce4f=_0x59a3a4['data'],_0x1bc3a0=_0x57ce4f['jobId']?_0x3ee091(0x181)+_0x57ce4f[_0x3ee091(0x21a)]+']':'';return console[_0x3ee091(0x269)](_0x3ee091(0x17b)+_0x57ce4f[_0x3ee091(0x171)]['processedRows'][_0x3ee091(0x233)]()+_0x3ee091(0x305)+(_0x3ee091(0x212)+formatElapsed(_0x57ce4f[_0x3ee091(0x171)]['elapsedTimeMillis'])+_0x1bc3a0)),await handleQueryOutput(_0x57ce4f,_0x3f71c5),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]='ps:rt:list';[a26_0x3e1dba(0x2e2)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a26_0x3e1dba(0x280)](_0x472114){const _0x14eb78=a26_0x3e1dba,{options:_0x476f44,args:_0x4d9b30,tdx:_0x36d195}=_0x472114,_0xce9c84=_0x4d9b30[0x0],_0x4bd92c=await withSpinner(_0xce9c84?_0x14eb78(0x239)+_0xce9c84+_0x14eb78(0x1e0):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x36d195['realtime'][_0x14eb78(0x1fd)](),{'verbose':_0x476f44[_0x14eb78(0x173)]});let _0x5a81dd=_0x4bd92c[_0x14eb78(0x1ea)]['filter'](_0x39325c=>_0x39325c[_0x14eb78(0x243)]);if(_0xce9c84){const _0x3abe22=_0xce9c84[_0x14eb78(0x27f)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x14eb78(0x27f)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x1888a6=new RegExp('^'+_0x3abe22+'$','i');_0x5a81dd=_0x5a81dd[_0x14eb78(0x292)](_0x23d4f0=>_0x1888a6[_0x14eb78(0x257)](_0x23d4f0[_0x14eb78(0x1ae)]));}_0x5a81dd['sort']((_0x4cdd13,_0x220be9)=>_0x4cdd13['name']['localeCompare'](_0x220be9['name'])),console[_0x14eb78(0x269)](_0x14eb78(0x2b9)+_0x5a81dd[_0x14eb78(0x1d7)]+_0x14eb78(0x199)+(_0x5a81dd[_0x14eb78(0x1d7)]!==0x1?'s':''));const _0x2a5b8d=_0x52e448=>{const _0x54c1f1=_0x14eb78;return getConsoleNextUrl(_0x476f44['site'],_0x54c1f1(0x2ed)+_0x52e448);};if(_0x476f44[_0x14eb78(0x1d3)]==='json'||_0x476f44['format']===_0x14eb78(0x2aa)){const _0x18daa1=_0x5a81dd[_0x14eb78(0x235)](_0x2a159d=>({..._0x2a159d,'url':_0x2a5b8d(_0x2a159d['id'])}));await handleSDKOutput(_0x18daa1,_0x476f44);}else{if(_0x5a81dd[_0x14eb78(0x1d7)]===0x0)console[_0x14eb78(0x26e)](_0x14eb78(0x2eb));else for(const _0x6fc1d of _0x5a81dd){const _0x49218d=_0x6fc1d['population']?a26_0x4d135b[_0x14eb78(0x1bd)]('\x20('+formatRows(_0x6fc1d['population'])+')'):'',_0x161677=hyperlink(_0x6fc1d['name'],_0x2a5b8d(_0x6fc1d['id']));console[_0x14eb78(0x26e)]('⚡\x20'+_0x161677+_0x49218d);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]='ps:rt:validate';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x217);async[a26_0x3e1dba(0x280)](_0x24057f){const _0x1fb417=a26_0x3e1dba,{options:_0x533781,args:_0x2c5f8c,tdx:_0x4a02bb}=_0x24057f,_0x146fca=_0x2c5f8c[0x0]||_0x533781[_0x1fb417(0x268)];if(!_0x146fca)return showParentSegmentNotSetError(_0x1fb417(0x1a0)+_0x1fb417(0x288)),0x1;const _0x33a409=resolveYamlFile(_0x146fca);if(!existsSync(_0x33a409))return showFileNotFoundError(_0x33a409,_0x146fca),0x1;let _0x8bc976;try{_0x8bc976=readFileSync(_0x33a409,_0x1fb417(0x2ec));}catch(_0x3e6d5f){const _0x23f288=_0x3e6d5f instanceof Error?_0x3e6d5f[_0x1fb417(0x1c9)]:String(_0x3e6d5f);return console[_0x1fb417(0x269)]('Error\x20reading\x20file:\x20'+_0x23f288),0x1;}const _0x5a2e19=createCommandSpinner(a26_0x4d135b[_0x1fb417(0x1bd)]('Validating\x20RT\x20configuration...'),{'verbose':_0x533781['verbose']});_0x5a2e19[_0x1fb417(0x1e7)]();const _0x48ef13={'realtime':!![],'onProgress':_0x5eee3e=>{_0x5a2e19['text']=formatProgressMessage(_0x5eee3e);}};let _0x230ca7;try{_0x230ca7=await _0x4a02bb[_0x1fb417(0x1eb)][_0x1fb417(0x1cb)](_0x8bc976,_0x48ef13),_0x5a2e19[_0x1fb417(0x225)]();}catch(_0x17700f){_0x5a2e19[_0x1fb417(0x225)]();throw _0x17700f;}console[_0x1fb417(0x269)]('\x0a'+a26_0x4d135b[_0x1fb417(0x270)](_0x1fb417(0x207))+'\x20'+_0x230ca7[_0x1fb417(0x1ae)]),console[_0x1fb417(0x269)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x230ca7),console[_0x1fb417(0x269)]('─'['repeat'](0x3c));if(_0x230ca7[_0x1fb417(0x1cc)][_0x1fb417(0x1d7)]>0x0){console[_0x1fb417(0x269)]('\x0a'+a26_0x4d135b[_0x1fb417(0x237)](_0x1fb417(0x275)));for(const _0x4f5874 of _0x230ca7[_0x1fb417(0x1cc)]){console[_0x1fb417(0x269)]('\x20\x20'+a26_0x4d135b[_0x1fb417(0x237)]('•')+'\x20'+_0x4f5874);}}return _0x230ca7[_0x1fb417(0x2e9)]&&console[_0x1fb417(0x269)]('\x0a'+a26_0x4d135b['green']('✔')+_0x1fb417(0x209)),_0x230ca7[_0x1fb417(0x2e9)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]='ps:pz:list';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x26c);async[a26_0x3e1dba(0x280)](_0x470425){const _0x21ca28=a26_0x3e1dba,{options:_0xc0350c,args:_0x48b6d0,tdx:_0x585f67}=_0x470425,_0x24fa10=_0x48b6d0[0x0]||_0xc0350c[_0x21ca28(0x268)];if(!_0x24fa10)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+'\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 _0x280ead=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x24fa10+_0x21ca28(0x1e0),()=>_0x585f67[_0x21ca28(0x1eb)]['resolveParentId'](_0x24fa10),{'verbose':_0xc0350c[_0x21ca28(0x173)]}),_0x4049ef=_0x280ead['data'],_0x358bf5=await withSpinner(_0x21ca28(0x204)+_0x24fa10+_0x21ca28(0x1e0),()=>_0x585f67[_0x21ca28(0x273)][_0x21ca28(0x1fd)](_0x4049ef),{'verbose':_0xc0350c[_0x21ca28(0x173)]}),_0x8ab2e7=_0x358bf5[_0x21ca28(0x1ea)];console['error']('✔\x20Found\x20'+_0x8ab2e7[_0x21ca28(0x1d7)]+_0x21ca28(0x291)+(_0x8ab2e7[_0x21ca28(0x1d7)]!==0x1?'s':''));if(_0xc0350c['format']===_0x21ca28(0x2b5)||_0xc0350c[_0x21ca28(0x1d3)]===_0x21ca28(0x2aa))await handleSDKOutput(_0x8ab2e7,_0xc0350c);else{if(_0x8ab2e7['length']===0x0)console[_0x21ca28(0x26e)]('No\x20personalization\x20services\x20configured'),console[_0x21ca28(0x269)](a26_0x4d135b['cyan'](_0x21ca28(0x29f)));else for(const _0x13e45b of _0x8ab2e7){const _0x400b5a=_0x13e45b[_0x21ca28(0x25b)]?.['length']||0x0,_0xda8591=_0x13e45b['trigger_event']?a26_0x4d135b[_0x21ca28(0x1bd)]('\x20trigger='+_0x13e45b['trigger_event']):'',_0x13f7a7=a26_0x4d135b['dim']('\x20('+_0x400b5a+_0x21ca28(0x2a9)+(_0x400b5a!==0x1?'s':'')+')');console[_0x21ca28(0x26e)]('\x20\x20'+_0x13e45b[_0x21ca28(0x1ae)]+_0xda8591+_0x13f7a7),_0x13e45b[_0x21ca28(0x2e2)]&&console['log'](_0x21ca28(0x223)+a26_0x4d135b[_0x21ca28(0x1bd)](_0x13e45b[_0x21ca28(0x2e2)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]='ps:pz:init';['description']=a26_0x3e1dba(0x21c);async[a26_0x3e1dba(0x280)](_0x149ba5){const _0x23a2fd=a26_0x3e1dba,{options:_0xcc69d6,args:_0x3b003a}=_0x149ba5,_0x32a75e=_0x3b003a[0x0]||_0xcc69d6['parentSegment'];if(!_0x32a75e)return showParentSegmentNotSetError(_0x23a2fd(0x1c8)+_0x23a2fd(0x185)),0x1;const _0x2294d9=resolveYamlFile(_0x32a75e);if(!existsSync(_0x2294d9))return showFileNotFoundError(_0x2294d9,_0x32a75e),0x1;let _0x5e2e87;try{_0x5e2e87=readFileSync(_0x2294d9,'utf-8');}catch(_0x1060ef){const _0x2bac6d=_0x1060ef instanceof Error?_0x1060ef[_0x23a2fd(0x1c9)]:String(_0x1060ef);return console[_0x23a2fd(0x269)]('Error\x20reading\x20file:\x20'+_0x2bac6d),0x1;}let _0x4dbe97;try{_0x4dbe97=parseDef(_0x5e2e87);}catch(_0x172d1a){const _0x268309=_0x172d1a instanceof Error?_0x172d1a[_0x23a2fd(0x1c9)]:String(_0x172d1a);return console[_0x23a2fd(0x269)](a26_0x4d135b[_0x23a2fd(0x237)](_0x23a2fd(0x2d9)+_0x268309)),0x1;}if(_0x4dbe97[_0x23a2fd(0x172)]&&_0x4dbe97['personalization_services'][_0x23a2fd(0x1d7)]>0x0)return console[_0x23a2fd(0x269)](a26_0x4d135b['yellow'](_0x23a2fd(0x2ea)+_0x2294d9)),console[_0x23a2fd(0x269)](a26_0x4d135b[_0x23a2fd(0x1bd)](_0x23a2fd(0x2ac)+_0x4dbe97[_0x23a2fd(0x172)][_0x23a2fd(0x1d7)]+_0x23a2fd(0x1d1))),0x1;!_0x4dbe97[_0x23a2fd(0x18a)]&&(_0x4dbe97['realtime']={'events':[{'name':'page_view','source_table':_0x23a2fd(0x283)}],'attributes':[{'name':'last_page_viewed','type':_0x23a2fd(0x2f5)}],'id_stitching':{'primary_key':_0x4dbe97[_0x23a2fd(0x1ad)][_0x23a2fd(0x2f1)]===_0x23a2fd(0x242)?'td_client_id':_0x23a2fd(0x21f)}});_0x4dbe97['personalization_services']=[{'name':_0x23a2fd(0x1ff),'description':_0x23a2fd(0x2c4),'trigger_event':'page_view','sections':[{'name':_0x23a2fd(0x2a3),'criteria':_0x23a2fd(0x2da),'attributes':[_0x23a2fd(0x1c0)]}]}];const _0x375e9b=serializeDef(_0x4dbe97);return writeFileSync(_0x2294d9,_0x375e9b,_0x23a2fd(0x2ec)),console[_0x23a2fd(0x269)](a26_0x4d135b['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a26_0x4d135b['cyan'](_0x2294d9)),(!_0x4dbe97[_0x23a2fd(0x18a)]||_0x5e2e87['indexOf'](_0x23a2fd(0x191))===-0x1)&&console[_0x23a2fd(0x269)](a26_0x4d135b['green']('✔')+_0x23a2fd(0x1a5)),console[_0x23a2fd(0x269)]('\x0a'+a26_0x4d135b[_0x23a2fd(0x1bd)](_0x23a2fd(0x1ed))),console[_0x23a2fd(0x269)](_0x23a2fd(0x1af)+_0x2294d9+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x23a2fd(0x269)](_0x23a2fd(0x262)+a26_0x4d135b[_0x23a2fd(0x1bd)](_0x23a2fd(0x1fe)+_0x32a75e)+_0x23a2fd(0x17e)),0x0;}}
@@ -1 +1 @@
1
- const a27_0x6d17f6=a27_0x6dd0;(function(_0x217c88,_0x36e57f){const _0x2e7b07=a27_0x6dd0,_0x330526=_0x217c88();while(!![]){try{const _0xdf1884=parseInt(_0x2e7b07(0xa8))/0x1*(-parseInt(_0x2e7b07(0xa0))/0x2)+parseInt(_0x2e7b07(0xc4))/0x3*(-parseInt(_0x2e7b07(0x106))/0x4)+-parseInt(_0x2e7b07(0xaf))/0x5+-parseInt(_0x2e7b07(0xda))/0x6*(-parseInt(_0x2e7b07(0xa1))/0x7)+-parseInt(_0x2e7b07(0xfe))/0x8+-parseInt(_0x2e7b07(0xc7))/0x9+parseInt(_0x2e7b07(0xe0))/0xa*(parseInt(_0x2e7b07(0xf0))/0xb);if(_0xdf1884===_0x36e57f)break;else _0x330526['push'](_0x330526['shift']());}catch(_0x6a5df5){_0x330526['push'](_0x330526['shift']());}}}(a27_0x50f0,0x9dd15));function a27_0x6dd0(_0xd8564e,_0x3b53cc){_0xd8564e=_0xd8564e-0x9f;const _0x50f098=a27_0x50f0();let _0x6dd00c=_0x50f098[_0xd8564e];return _0x6dd00c;}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_0x4e3894 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a27_0x50f0(){const _0x169c9c=['\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','llm_project','66oFkfib','Default\x20profile\x20set\x20to:\x20','test','VALID_KEYS','\x20--default\x27\x20to\x20save\x20permanently','validate','40yIFNOX','\x27\x20removed\x20from\x20configuration','\x20\x20tdx\x20--profile\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','API\x20key\x20cannot\x20be\x20empty','Enter\x20your\x20TD\x20API\x20key:','jobs','description','\x0aOperation\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','log','yellow','name','\x20\x20(no\x20profiles\x20found)','profile:remove','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','13218557LwwaRq','email','Unknown\x20key\x20\x27','getUserInfo','\x0aAvailable\x20profiles:','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','(cleared)','site','error','profile:set','Profile\x20name\x20cannot\x20be\x20empty','dim','parent_segment','bold','5775192NWepWX','message','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Validating\x20API\x20key...','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','You\x20can\x20find\x20your\x20API\x20key\x20at:','length','1587608CYQYmB','(session:\x20','\x20\x20-\x20','apiKey','5902NmFbkx','176533hwdeBZ','split','\x20API\x20key\x20saved\x20to\x20system\x20keychain','profile:use','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>','\x27\x20does\x20not\x20exist.','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','407HyDCQp','join','us01','tdx:\x20profile\x20set','Enter\x20description\x20(optional):','warn','text','4245805mUkbhQ','\x20API\x20key\x20is\x20valid\x20(User:\x20','logLevel','includes','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','database','status','Enter\x20site\x20name:','profileName','customSite','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','create','Session\x20profile\x20set\x20to:\x20','Set\x20a\x20profile\x20configuration\x20value','✗\x20Validation\x20failed:\x20','session','Remove\x20a\x20profile','\x0aSetup\x20cancelled','tdx:\x20profile\x20remove','Profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','3cPaaOp','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','default','11418453jRsHDb','green','profile','profile:create','password','red','execute','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Changing\x20site\x20to\x20\x27','\x20Profile\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','confirm','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20created','\x27\x20requires\x20API\x20key\x20validation.','Site\x20name\x20cannot\x20be\x20empty','trim'];a27_0x50f0=function(){return _0x169c9c;};return a27_0x50f0();}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';import a27_0x410b27 from'prompts';import a27_0x42bdae from'chalk';function validateProfileName(_0x11ddaf){const _0x477391=a27_0x6dd0;if(!_0x11ddaf||!_0x11ddaf['trim']())return _0x477391(0xfa);const _0x5478ca=_0x11ddaf[_0x477391(0xd7)]();if(!/^[a-zA-Z0-9_-]+$/[_0x477391(0xdc)](_0x5478ca))return _0x477391(0xe3);if(profileExists(_0x5478ca))return _0x477391(0xc2)+_0x5478ca+_0x477391(0xb3);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a27_0x6d17f6(0xca);['description']='Create\x20a\x20new\x20profile';async[a27_0x6d17f6(0xcd)](_0x17d828){const _0x303dec=a27_0x6d17f6,{options:_0x371760,args:_0x362433}=_0x17d828;console['log'](a27_0x42bdae[_0x303dec(0xfd)]('tdx:\x20profile\x20create'));let _0x1be879;if(_0x362433[_0x303dec(0x105)]>0x0&&_0x362433[0x0]){const _0x34aecf=_0x362433[0x0][_0x303dec(0xd7)](),_0x58ba95=validateProfileName(_0x34aecf);if(_0x58ba95!==!![])return console[_0x303dec(0xf8)](a27_0x42bdae[_0x303dec(0xcc)](_0x58ba95)),0x1;_0x1be879=_0x34aecf;}else{const _0x1f32ee=await a27_0x410b27({'type':_0x303dec(0xae),'name':_0x303dec(0xb7),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x1f32ee[_0x303dec(0xb7)])return console[_0x303dec(0xea)]('\x0aSetup\x20cancelled'),0x1;_0x1be879=_0x1f32ee[_0x303dec(0xb7)][_0x303dec(0xd7)]();}const _0x4513dc=await a27_0x410b27({'type':_0x303dec(0xae),'name':_0x303dec(0xe7),'message':_0x303dec(0xac)}),_0x2b48be=_0x4513dc[_0x303dec(0xe7)]?.[_0x303dec(0xd7)]()||undefined,_0x4af80b=_0x371760['site']||_0x303dec(0xaa),{choices:_0x466482,initialIndex:_0x512eb9}=buildSiteChoices(_0x4af80b),_0x24c779=await a27_0x410b27({'type':'select','name':_0x303dec(0xf7),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x1be879+'\x27:','choices':_0x466482,'initial':_0x512eb9});if(!_0x24c779[_0x303dec(0xf7)])return console[_0x303dec(0xea)]('\x0aSetup\x20cancelled'),0x1;let _0x3983ad;if(_0x24c779['site']==='other'){const _0x30cf22=await a27_0x410b27({'type':_0x303dec(0xae),'name':_0x303dec(0xb8),'message':_0x303dec(0xb6),'initial':_0x303dec(0xaa),'validate':_0x50eca=>{const _0x134ea6=_0x303dec;if(!_0x50eca||!_0x50eca[_0x134ea6(0xd7)]())return _0x134ea6(0xd6);if(!/^[a-z0-9-]+$/[_0x134ea6(0xdc)](_0x50eca[_0x134ea6(0xd7)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x30cf22[_0x303dec(0xb8)])return console[_0x303dec(0xea)](_0x303dec(0xc0)),0x1;_0x3983ad=_0x30cf22[_0x303dec(0xb8)];}else _0x3983ad=_0x24c779[_0x303dec(0xf7)];const _0x5a52d4=resolveSite(_0x3983ad);console[_0x303dec(0xea)](_0x303dec(0xef)+_0x5a52d4),console[_0x303dec(0xea)](_0x303dec(0x104)),console[_0x303dec(0xea)]('\x20\x20'+getConsoleUrl(_0x5a52d4,'/app/mp/ak'));const _0x399778=await a27_0x410b27({'type':_0x303dec(0xcb),'name':_0x303dec(0x9f),'message':_0x303dec(0xe5),'validate':_0x304af4=>{const _0x2eaa67=_0x303dec;if(!_0x304af4||!_0x304af4[_0x2eaa67(0xd7)]())return _0x2eaa67(0xe4);return!![];}});if(!_0x399778[_0x303dec(0x9f)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x8e545a=_0x399778[_0x303dec(0x9f)];console[_0x303dec(0xea)](_0x303dec(0x102));try{const _0x10dcbb=TDX[_0x303dec(0xba)]({'site':_0x5a52d4,'apiKey':_0x8e545a['trim'](),'logLevel':_0x371760['logLevel']??LogLevel['ERROR']}),_0x551c26=await _0x10dcbb[_0x303dec(0xe6)][_0x303dec(0xf3)]();console[_0x303dec(0xea)](a27_0x42bdae[_0x303dec(0xc8)]('✓')+_0x303dec(0xb0)+_0x551c26[_0x303dec(0xf1)]+')');const _0x7286da=await isKeychainAvailable();_0x7286da?(await saveAPIKeyAsync(_0x8e545a[_0x303dec(0xd7)](),_0x5a52d4,_0x1be879),console[_0x303dec(0xea)](a27_0x42bdae['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x1be879+')')):(console['warn'](a27_0x42bdae['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x303dec(0xad)](a27_0x42bdae[_0x303dec(0xeb)](_0x303dec(0xce))));const _0x44508e={'site':_0x5a52d4,..._0x2b48be&&{'description':_0x2b48be}};return saveProfileToUserConfig(_0x1be879,_0x44508e),console[_0x303dec(0xea)](a27_0x42bdae['green']('✓')+'\x20Profile\x20\x27'+_0x1be879+_0x303dec(0xd4)),console[_0x303dec(0xea)](),console['log'](_0x303dec(0xf5)),console[_0x303dec(0xea)]('\x20\x20tdx\x20--profile\x20'+_0x1be879+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x303dec(0xea)](_0x303dec(0xe2)+_0x1be879+_0x303dec(0xd8)),0x0;}catch(_0x7f2a6){if(_0x7f2a6 instanceof HTTPClientError&&_0x7f2a6[_0x303dec(0xb5)]===0x191)return printAuthError(_0x7f2a6),0x1;return console[_0x303dec(0xf8)](a27_0x42bdae[_0x303dec(0xcc)](_0x303dec(0xbd)+(_0x7f2a6 instanceof Error?_0x7f2a6[_0x303dec(0xff)]:String(_0x7f2a6)))),console[_0x303dec(0xf8)](_0x303dec(0xc3)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a27_0x6d17f6(0xee);[a27_0x6d17f6(0xe7)]=a27_0x6d17f6(0xbf);[a27_0x6d17f6(0xdf)](_0x584d69){const _0x3d577a=a27_0x6d17f6,{args:_0x4e0086}=_0x584d69;if(_0x4e0086['length']===0x0)return _0x3d577a(0xc5);return undefined;}async['execute'](_0x3a4afd){const _0x2666d4=a27_0x6d17f6,{args:_0x55a06a}=_0x3a4afd,_0x2d7612=_0x55a06a[0x0];console['log'](a27_0x42bdae[_0x2666d4(0xfd)](_0x2666d4(0xc1)));if(!profileExists(_0x2d7612)){console['error'](a27_0x42bdae['red'](_0x2666d4(0xc2)+_0x2d7612+_0x2666d4(0xa6))),console[_0x2666d4(0xea)](_0x2666d4(0xf4));const _0x11464c=listProfiles();if(_0x11464c[_0x2666d4(0x105)]===0x0)console['log'](_0x2666d4(0xed));else for(const _0x1da93f of _0x11464c){console[_0x2666d4(0xea)](_0x2666d4(0x108)+_0x1da93f[_0x2666d4(0xec)]);}return 0x1;}const _0xd7e337=await a27_0x410b27({'type':'confirm','name':'confirm','message':_0x2666d4(0xa7)+_0x2d7612+'\x27?','initial':![]});if(!_0xd7e337[_0x2666d4(0xd2)])return console[_0x2666d4(0xea)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2d7612),console[_0x2666d4(0xea)](a27_0x42bdae[_0x2666d4(0xc8)]('✓')+'\x20Profile\x20\x27'+_0x2d7612+_0x2666d4(0xe1));}catch(_0x3189ff){return console[_0x2666d4(0xf8)](a27_0x42bdae[_0x2666d4(0xcc)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x3189ff instanceof Error?_0x3189ff[_0x2666d4(0xff)]:String(_0x3189ff)))),0x1;}const _0x18f399=await isKeychainAvailable();if(_0x18f399){const _0x168431=await deleteKeychainAPIKey(_0x2d7612);_0x168431&&console[_0x2666d4(0xea)](a27_0x42bdae[_0x2666d4(0xc8)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x6d17f6(0xec)]=a27_0x6d17f6(0xf9);['description']=a27_0x6d17f6(0xbc);static [a27_0x6d17f6(0xdd)]=['site',a27_0x6d17f6(0xb4),a27_0x6d17f6(0xfc),a27_0x6d17f6(0xd9),'llm_agent',a27_0x6d17f6(0xe7)];['validate'](_0x109261){const _0x529c75=a27_0x6d17f6,{args:_0x63687e,options:_0x2757aa}=_0x109261,_0x2e79b8=_0x2757aa['profile']||getActiveProfile();if(!_0x2e79b8)return _0x529c75(0xa5);if(_0x63687e[_0x529c75(0x105)]===0x0)return _0x529c75(0xd1)+ProfileSetCommand['VALID_KEYS'][_0x529c75(0xa9)](',\x20');const _0x48eebd=_0x63687e[0x0];if(!_0x48eebd[_0x529c75(0xb2)]('='))return _0x529c75(0xb9)+ProfileSetCommand[_0x529c75(0xdd)][_0x529c75(0xa9)](',\x20');const [_0x45078d]=_0x48eebd[_0x529c75(0xa2)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x529c75(0xb2)](_0x45078d))return _0x529c75(0xf2)+_0x45078d+_0x529c75(0xd3)+ProfileSetCommand[_0x529c75(0xdd)][_0x529c75(0xa9)](',\x20');return undefined;}async[a27_0x6d17f6(0xcd)](_0x2f4d34){const _0xf82483=a27_0x6d17f6,{args:_0x44a645,options:_0x2851e2}=_0x2f4d34,_0x5eb7a4=_0x2851e2[_0xf82483(0xc9)]||getActiveProfile(),[_0x12bcdc,..._0x33e9ed]=_0x44a645[0x0][_0xf82483(0xa2)]('='),_0x2ea157=_0x33e9ed[_0xf82483(0xa9)]('=');console[_0xf82483(0xea)](a27_0x42bdae[_0xf82483(0xfd)](_0xf82483(0xab)));if(!profileExists(_0x5eb7a4)){const _0x482498=await a27_0x410b27({'type':_0xf82483(0xd2),'name':_0xf82483(0xba),'message':'Profile\x20\x27'+_0x5eb7a4+_0xf82483(0x101),'initial':!![]});if(!_0x482498[_0xf82483(0xba)])return console[_0xf82483(0xea)]('Operation\x20cancelled'),0x1;}const _0x3d0122=loadProfile(_0x5eb7a4),_0x320e5=_0x3d0122?.['config']||{};if(_0x12bcdc===_0xf82483(0xf7)){const _0x50bc00=resolveSite(_0x2ea157);console[_0xf82483(0xea)](_0xf82483(0xcf)+_0x50bc00+_0xf82483(0xd5)),console[_0xf82483(0xea)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x50bc00,'/app/mp/ak'));const _0x58751a=await a27_0x410b27({'type':_0xf82483(0xcb),'name':_0xf82483(0x9f),'message':_0xf82483(0x103),'validate':_0x15ea2b=>{const _0x477117=_0xf82483;if(!_0x15ea2b||!_0x15ea2b[_0x477117(0xd7)]())return _0x477117(0xe4);return!![];}});if(!_0x58751a[_0xf82483(0x9f)])return console['log'](_0xf82483(0xe8)),0x1;console[_0xf82483(0xea)]('Validating\x20API\x20key...');try{const _0x36819a=TDX[_0xf82483(0xba)]({'site':_0x50bc00,'apiKey':_0x58751a[_0xf82483(0x9f)][_0xf82483(0xd7)](),'logLevel':_0x2851e2[_0xf82483(0xb1)]??LogLevel['ERROR']}),_0x20ddab=await _0x36819a[_0xf82483(0xe6)]['getUserInfo']();console['log'](a27_0x42bdae[_0xf82483(0xc8)]('✓')+_0xf82483(0xb0)+_0x20ddab[_0xf82483(0xf1)]+')');const _0xd17c2f=await isKeychainAvailable();_0xd17c2f?(await saveAPIKeyAsync(_0x58751a[_0xf82483(0x9f)][_0xf82483(0xd7)](),_0x50bc00,_0x5eb7a4),console['log'](a27_0x42bdae[_0xf82483(0xc8)]('✓')+_0xf82483(0xa3))):console[_0xf82483(0xad)](a27_0x42bdae[_0xf82483(0xeb)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x320e5[_0xf82483(0xf7)]=_0x50bc00;}catch(_0x29b183){if(_0x29b183 instanceof HTTPClientError&&_0x29b183[_0xf82483(0xb5)]===0x191)return printAuthError(_0x29b183),0x1;return console['error'](a27_0x42bdae[_0xf82483(0xcc)](_0xf82483(0xbd)+(_0x29b183 instanceof Error?_0x29b183[_0xf82483(0xff)]:String(_0x29b183)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x320e5[_0x12bcdc]=_0x2ea157||undefined;return saveProfileToUserConfig(_0x5eb7a4,_0x320e5),console[_0xf82483(0xea)](a27_0x42bdae[_0xf82483(0xc8)]('✓')+_0xf82483(0xd0)+_0x5eb7a4+'\x27\x20updated:\x20'+_0x12bcdc+'='+(_0x2ea157||_0xf82483(0xf6))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x6d17f6(0xec)]=a27_0x6d17f6(0xa4);[a27_0x6d17f6(0xe7)]='Set\x20session\x20profile';[a27_0x6d17f6(0xdf)](_0x490733){const _0x365032=a27_0x6d17f6,{args:_0x22c77c}=_0x490733;if(_0x22c77c[_0x365032(0x105)]===0x0)return _0x365032(0x100);return undefined;}async['execute'](_0x28d4df){const _0x1dcda0=a27_0x6d17f6,{args:_0x5e2c12,options:_0x5b62d7}=_0x28d4df,_0x48f936=_0x5e2c12[0x0],_0x409c04=_0x5b62d7[_0x1dcda0(0xc6)];cleanExpiredSessions();if(!profileExists(_0x48f936)){console[_0x1dcda0(0xf8)](a27_0x42bdae[_0x1dcda0(0xcc)]('Profile\x20\x27'+_0x48f936+_0x1dcda0(0xa6))),console[_0x1dcda0(0xea)]('\x0aAvailable\x20profiles:');const _0x3b8758=listProfiles();if(_0x3b8758['length']===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x2109c3 of _0x3b8758){console['log'](_0x1dcda0(0x108)+_0x2109c3[_0x1dcda0(0xec)]);}return 0x1;}if(_0x409c04){const _0x96b64b=a27_0x4e3894[_0x1dcda0(0xa9)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x48f936),console[_0x1dcda0(0xea)](_0x1dcda0(0xdb)+a27_0x42bdae['green'](_0x48f936)),console[_0x1dcda0(0xea)](a27_0x42bdae[_0x1dcda0(0xfb)]('\x0aSaved\x20to:\x20'+_0x96b64b)),0x0;}const _0x15bfc1=getSessionID(_0x5b62d7['session']);return saveSessionContext({'profile':_0x48f936},_0x5b62d7[_0x1dcda0(0xbe)]),console[_0x1dcda0(0xea)](_0x1dcda0(0xbb)+a27_0x42bdae[_0x1dcda0(0xc8)](_0x48f936)+'\x20'+a27_0x42bdae['dim'](_0x1dcda0(0x107)+_0x15bfc1+')')),console[_0x1dcda0(0xea)](a27_0x42bdae[_0x1dcda0(0xfb)](_0x1dcda0(0xe9)+_0x48f936+_0x1dcda0(0xde))),0x0;}}
1
+ const a27_0x3d1276=a27_0x173a;(function(_0x1dfce8,_0x895c7e){const _0x449c1d=a27_0x173a,_0x3554af=_0x1dfce8();while(!![]){try{const _0x570a22=parseInt(_0x449c1d(0x16c))/0x1*(-parseInt(_0x449c1d(0x199))/0x2)+-parseInt(_0x449c1d(0x17a))/0x3*(parseInt(_0x449c1d(0x16b))/0x4)+-parseInt(_0x449c1d(0x170))/0x5+parseInt(_0x449c1d(0x1b1))/0x6*(-parseInt(_0x449c1d(0x1bc))/0x7)+parseInt(_0x449c1d(0x15d))/0x8+-parseInt(_0x449c1d(0x162))/0x9*(-parseInt(_0x449c1d(0x1b4))/0xa)+parseInt(_0x449c1d(0x18d))/0xb*(parseInt(_0x449c1d(0x1a5))/0xc);if(_0x570a22===_0x895c7e)break;else _0x3554af['push'](_0x3554af['shift']());}catch(_0x64c450){_0x3554af['push'](_0x3554af['shift']());}}}(a27_0x5c36,0x4711f));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a27_0x5c36(){const _0xce877a=['database','Enter\x20site\x20name:','site','Default\x20profile\x20set\x20to:\x20','\x27\x20requires\x20API\x20key\x20validation.','parent_segment','password','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Removal\x20cancelled','logLevel','Set\x20a\x20profile\x20configuration\x20value','tdx.json','confirm','Profile\x20name\x20cannot\x20be\x20empty','50039vUKnVE','log','profileName','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>','us01','Changing\x20site\x20to\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','default','\x20Profile\x20\x27','Site\x20was\x20not\x20changed.','llm_agent','other','88980wIqEcO','\x20API\x20key\x20is\x20valid\x20(User:\x20','jobs','\x0aAvailable\x20profiles:','join','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Enter\x20profile\x20name:','create','select','\x27\x20created','Remove\x20a\x20profile','warn','1548VayNsp','test','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','session','trim','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20\x20-\x20','name','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20description\x20(optional):','split','12cyqMTF','green','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','10IseWfp','ERROR','text','\x0aOperation\x20cancelled','llm_project','length','tdx:\x20profile\x20remove','\x20--default\x27\x20to\x20save\x20permanently','219604KuxSkE','yellow','VALID_KEYS','Profile\x20\x27','dim','bold','\x27\x20removed\x20from\x20configuration','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','validate','Set\x20session\x20profile','/app/mp/ak','\x20\x20tdx\x20--profile\x20','customSite','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Validating\x20API\x20key...','2016352NwhQQy','You\x20can\x20find\x20your\x20API\x20key\x20at:','✗\x20Validation\x20failed:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','API\x20key\x20cannot\x20be\x20empty','3678507pECQFE','red','\x20\x20(no\x20profiles\x20found)','\x0aSetup\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x27\x20does\x20not\x20exist.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Session\x20profile\x20set\x20to:\x20','apiKey','12dtIOOz','6klLZFq','status','description','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','525970CftWey','error','Enter\x20your\x20TD\x20API\x20key:','Create\x20a\x20new\x20profile','profile','profile:remove','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','message','execute','tdx:\x20profile\x20create','521607EbYoFA','getUserInfo','Site\x20name\x20cannot\x20be\x20empty','tdx:\x20profile\x20set','Failed\x20to\x20remove\x20profile:\x20'];a27_0x5c36=function(){return _0xce877a;};return a27_0x5c36();}import{getConfigDir}from'../core/config.js';import*as a27_0x3c8cfe from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a27_0x173a(_0x1c8bae,_0xdcb550){_0x1c8bae=_0x1c8bae-0x152;const _0x5c3677=a27_0x5c36();let _0x173aaf=_0x5c3677[_0x1c8bae];return _0x173aaf;}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';import a27_0x49a13a from'prompts';import a27_0xe88ae3 from'chalk';function validateProfileName(_0xae6ed){const _0x48c339=a27_0x173a;if(!_0xae6ed||!_0xae6ed[_0x48c339(0x1a9)]())return _0x48c339(0x18c);const _0x4e9a69=_0xae6ed[_0x48c339(0x1a9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x48c339(0x1a6)](_0x4e9a69))return _0x48c339(0x1b3);if(profileExists(_0x4e9a69))return _0x48c339(0x1bf)+_0x4e9a69+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x173);async[a27_0x3d1276(0x178)](_0x495a9a){const _0x35c64d=a27_0x3d1276,{options:_0x1cfea7,args:_0x2c8196}=_0x495a9a;console[_0x35c64d(0x18e)](a27_0xe88ae3['bold'](_0x35c64d(0x179)));let _0x370a62;if(_0x2c8196[_0x35c64d(0x1b9)]>0x0&&_0x2c8196[0x0]){const _0x702131=_0x2c8196[0x0]['trim'](),_0x575b09=validateProfileName(_0x702131);if(_0x575b09!==!![])return console[_0x35c64d(0x171)](a27_0xe88ae3['red'](_0x575b09)),0x1;_0x370a62=_0x702131;}else{const _0x4bf925=await a27_0x49a13a({'type':'text','name':'profileName','message':_0x35c64d(0x19f),'validate':validateProfileName});if(!_0x4bf925[_0x35c64d(0x18f)])return console[_0x35c64d(0x18e)](_0x35c64d(0x165)),0x1;_0x370a62=_0x4bf925[_0x35c64d(0x18f)]['trim']();}const _0x15bb44=await a27_0x49a13a({'type':_0x35c64d(0x1b6),'name':_0x35c64d(0x16e),'message':_0x35c64d(0x1af)}),_0x32add7=_0x15bb44[_0x35c64d(0x16e)]?.[_0x35c64d(0x1a9)]()||undefined,_0x1c9abd=_0x1cfea7[_0x35c64d(0x181)]||_0x35c64d(0x191),{choices:_0x4abfdf,initialIndex:_0x3a0b60}=buildSiteChoices(_0x1c9abd),_0x22952c=await a27_0x49a13a({'type':_0x35c64d(0x1a1),'name':_0x35c64d(0x181),'message':_0x35c64d(0x19e)+_0x370a62+'\x27:','choices':_0x4abfdf,'initial':_0x3a0b60});if(!_0x22952c['site'])return console['log']('\x0aSetup\x20cancelled'),0x1;let _0x579ded;if(_0x22952c[_0x35c64d(0x181)]===_0x35c64d(0x198)){const _0x5121e8=await a27_0x49a13a({'type':'text','name':'customSite','message':_0x35c64d(0x180),'initial':_0x35c64d(0x191),'validate':_0x1b0266=>{const _0x46a1d9=_0x35c64d;if(!_0x1b0266||!_0x1b0266[_0x46a1d9(0x1a9)]())return _0x46a1d9(0x17c);if(!/^[a-z0-9-]+$/[_0x46a1d9(0x1a6)](_0x1b0266['trim']()))return _0x46a1d9(0x166);return!![];}});if(!_0x5121e8['customSite'])return console[_0x35c64d(0x18e)](_0x35c64d(0x165)),0x1;_0x579ded=_0x5121e8[_0x35c64d(0x15a)];}else _0x579ded=_0x22952c[_0x35c64d(0x181)];const _0x31163f=resolveSite(_0x579ded);console[_0x35c64d(0x18e)](_0x35c64d(0x155)+_0x31163f),console[_0x35c64d(0x18e)](_0x35c64d(0x15e)),console[_0x35c64d(0x18e)]('\x20\x20'+getConsoleUrl(_0x31163f,_0x35c64d(0x158)));const _0x282b55=await a27_0x49a13a({'type':_0x35c64d(0x185),'name':_0x35c64d(0x16a),'message':_0x35c64d(0x172),'validate':_0x2b3853=>{if(!_0x2b3853||!_0x2b3853['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x282b55[_0x35c64d(0x16a)])return console[_0x35c64d(0x18e)](_0x35c64d(0x165)),0x1;const _0x4127cd=_0x282b55[_0x35c64d(0x16a)];console[_0x35c64d(0x18e)](_0x35c64d(0x15c));try{const _0x3e88b8=TDX['create']({'site':_0x31163f,'apiKey':_0x4127cd[_0x35c64d(0x1a9)](),'logLevel':_0x1cfea7[_0x35c64d(0x188)]??LogLevel[_0x35c64d(0x1b5)]}),_0x28319b=await _0x3e88b8[_0x35c64d(0x19b)][_0x35c64d(0x17b)]();console['log'](a27_0xe88ae3[_0x35c64d(0x1b2)]('✓')+_0x35c64d(0x19a)+_0x28319b['email']+')');const _0x342d56=await isKeychainAvailable();_0x342d56?(await saveAPIKeyAsync(_0x4127cd[_0x35c64d(0x1a9)](),_0x31163f,_0x370a62),console[_0x35c64d(0x18e)](a27_0xe88ae3['green']('✓')+_0x35c64d(0x1a7)+_0x370a62+')')):(console['warn'](a27_0xe88ae3[_0x35c64d(0x1bd)](_0x35c64d(0x168))),console['warn'](a27_0xe88ae3[_0x35c64d(0x1bd)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x2cc4ef={'site':_0x31163f,..._0x32add7&&{'description':_0x32add7}};return saveProfileToUserConfig(_0x370a62,_0x2cc4ef),console[_0x35c64d(0x18e)](a27_0xe88ae3['green']('✓')+'\x20Profile\x20\x27'+_0x370a62+_0x35c64d(0x1a2)),console['log'](),console[_0x35c64d(0x18e)](_0x35c64d(0x193)),console[_0x35c64d(0x18e)](_0x35c64d(0x159)+_0x370a62+_0x35c64d(0x1aa)),console[_0x35c64d(0x18e)](_0x35c64d(0x159)+_0x370a62+_0x35c64d(0x186)),0x0;}catch(_0x42303c){if(_0x42303c instanceof HTTPClientError&&_0x42303c['status']===0x191)return printAuthError(_0x42303c),0x1;return console[_0x35c64d(0x171)](a27_0xe88ae3['red'](_0x35c64d(0x15f)+(_0x42303c instanceof Error?_0x42303c[_0x35c64d(0x177)]:String(_0x42303c)))),console['error'](_0x35c64d(0x15b)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x3d1276(0x1ac)]=a27_0x3d1276(0x175);[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x1a3);[a27_0x3d1276(0x156)](_0x4eef08){const _0x35f674=a27_0x3d1276,{args:_0x2ea0b1}=_0x4eef08;if(_0x2ea0b1[_0x35f674(0x1b9)]===0x0)return _0x35f674(0x176);return undefined;}async['execute'](_0x30aed9){const _0x5008ab=a27_0x3d1276,{args:_0x32c1b9}=_0x30aed9,_0x521d49=_0x32c1b9[0x0];console['log'](a27_0xe88ae3[_0x5008ab(0x153)](_0x5008ab(0x1ba)));if(!profileExists(_0x521d49)){console[_0x5008ab(0x171)](a27_0xe88ae3[_0x5008ab(0x163)](_0x5008ab(0x1bf)+_0x521d49+_0x5008ab(0x167))),console[_0x5008ab(0x18e)](_0x5008ab(0x19c));const _0x1566b1=listProfiles();if(_0x1566b1['length']===0x0)console['log'](_0x5008ab(0x164));else for(const _0x559ba0 of _0x1566b1){console[_0x5008ab(0x18e)](_0x5008ab(0x1ab)+_0x559ba0[_0x5008ab(0x1ac)]);}return 0x1;}const _0x16eee5=await a27_0x49a13a({'type':_0x5008ab(0x18b),'name':_0x5008ab(0x18b),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x521d49+'\x27?','initial':![]});if(!_0x16eee5[_0x5008ab(0x18b)])return console[_0x5008ab(0x18e)](_0x5008ab(0x187)),0x0;try{removeProfileFromUserConfig(_0x521d49),console[_0x5008ab(0x18e)](a27_0xe88ae3[_0x5008ab(0x1b2)]('✓')+_0x5008ab(0x195)+_0x521d49+_0x5008ab(0x154));}catch(_0x404921){return console[_0x5008ab(0x171)](a27_0xe88ae3['red'](_0x5008ab(0x17e)+(_0x404921 instanceof Error?_0x404921[_0x5008ab(0x177)]:String(_0x404921)))),0x1;}const _0x17196a=await isKeychainAvailable();if(_0x17196a){const _0x4c29cf=await deleteKeychainAPIKey(_0x521d49);_0x4c29cf&&console[_0x5008ab(0x18e)](a27_0xe88ae3[_0x5008ab(0x1b2)]('✓')+_0x5008ab(0x1ad));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x3d1276(0x1ac)]='profile:set';[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x189);static [a27_0x3d1276(0x1be)]=[a27_0x3d1276(0x181),a27_0x3d1276(0x17f),a27_0x3d1276(0x184),a27_0x3d1276(0x1b8),a27_0x3d1276(0x197),'description'];['validate'](_0x3f8888){const _0x4f29e9=a27_0x3d1276,{args:_0x282e09,options:_0x4f2b2c}=_0x3f8888,_0x1141f9=_0x4f2b2c['profile']||getActiveProfile();if(!_0x1141f9)return _0x4f29e9(0x190);if(_0x282e09[_0x4f29e9(0x1b9)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4f29e9(0x1be)][_0x4f29e9(0x19d)](',\x20');const _0x1731bc=_0x282e09[0x0];if(!_0x1731bc['includes']('='))return _0x4f29e9(0x160)+ProfileSetCommand[_0x4f29e9(0x1be)][_0x4f29e9(0x19d)](',\x20');const [_0x309df2]=_0x1731bc[_0x4f29e9(0x1b0)]('=',0x2);if(!ProfileSetCommand[_0x4f29e9(0x1be)]['includes'](_0x309df2))return'Unknown\x20key\x20\x27'+_0x309df2+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4f29e9(0x1be)][_0x4f29e9(0x19d)](',\x20');return undefined;}async[a27_0x3d1276(0x178)](_0x30f050){const _0x16c9c7=a27_0x3d1276,{args:_0x314559,options:_0x434e02}=_0x30f050,_0x526cd7=_0x434e02[_0x16c9c7(0x174)]||getActiveProfile(),[_0x149131,..._0x55d75c]=_0x314559[0x0]['split']('='),_0x1e298e=_0x55d75c['join']('=');console['log'](a27_0xe88ae3[_0x16c9c7(0x153)](_0x16c9c7(0x17d)));if(!profileExists(_0x526cd7)){const _0x24d83c=await a27_0x49a13a({'type':_0x16c9c7(0x18b),'name':'create','message':'Profile\x20\x27'+_0x526cd7+_0x16c9c7(0x1ae),'initial':!![]});if(!_0x24d83c[_0x16c9c7(0x1a0)])return console['log']('Operation\x20cancelled'),0x1;}const _0x5d33fd=loadProfile(_0x526cd7),_0x5a7129=_0x5d33fd?.['config']||{};if(_0x149131===_0x16c9c7(0x181)){const _0x5b6097=resolveSite(_0x1e298e);console[_0x16c9c7(0x18e)](_0x16c9c7(0x192)+_0x5b6097+_0x16c9c7(0x183)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x5b6097,_0x16c9c7(0x158)));const _0x53c92e=await a27_0x49a13a({'type':'password','name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x378ebf=>{const _0x30f136=_0x16c9c7;if(!_0x378ebf||!_0x378ebf['trim']())return _0x30f136(0x161);return!![];}});if(!_0x53c92e[_0x16c9c7(0x16a)])return console[_0x16c9c7(0x18e)](_0x16c9c7(0x1b7)),0x1;console[_0x16c9c7(0x18e)](_0x16c9c7(0x15c));try{const _0x18e3de=TDX[_0x16c9c7(0x1a0)]({'site':_0x5b6097,'apiKey':_0x53c92e['apiKey'][_0x16c9c7(0x1a9)](),'logLevel':_0x434e02[_0x16c9c7(0x188)]??LogLevel[_0x16c9c7(0x1b5)]}),_0x1f7f1a=await _0x18e3de[_0x16c9c7(0x19b)][_0x16c9c7(0x17b)]();console[_0x16c9c7(0x18e)](a27_0xe88ae3[_0x16c9c7(0x1b2)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x1f7f1a['email']+')');const _0x4138f2=await isKeychainAvailable();_0x4138f2?(await saveAPIKeyAsync(_0x53c92e[_0x16c9c7(0x16a)][_0x16c9c7(0x1a9)](),_0x5b6097,_0x526cd7),console['log'](a27_0xe88ae3[_0x16c9c7(0x1b2)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x16c9c7(0x1a4)](a27_0xe88ae3[_0x16c9c7(0x1bd)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5a7129[_0x16c9c7(0x181)]=_0x5b6097;}catch(_0xe2d599){if(_0xe2d599 instanceof HTTPClientError&&_0xe2d599[_0x16c9c7(0x16d)]===0x191)return printAuthError(_0xe2d599),0x1;return console[_0x16c9c7(0x171)](a27_0xe88ae3[_0x16c9c7(0x163)]('✗\x20Validation\x20failed:\x20'+(_0xe2d599 instanceof Error?_0xe2d599[_0x16c9c7(0x177)]:String(_0xe2d599)))),console['error'](_0x16c9c7(0x196)),0x1;}}else _0x5a7129[_0x149131]=_0x1e298e||undefined;return saveProfileToUserConfig(_0x526cd7,_0x5a7129),console[_0x16c9c7(0x18e)](a27_0xe88ae3['green']('✓')+'\x20Profile\x20\x27'+_0x526cd7+'\x27\x20updated:\x20'+_0x149131+'='+(_0x1e298e||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x3d1276(0x1ac)]='profile:use';[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x157);['validate'](_0x216000){const _0x13fc18=a27_0x3d1276,{args:_0x307aeb}=_0x216000;if(_0x307aeb[_0x13fc18(0x1b9)]===0x0)return _0x13fc18(0x16f);return undefined;}async[a27_0x3d1276(0x178)](_0x5d18fc){const _0x3b7456=a27_0x3d1276,{args:_0x16581c,options:_0x35d9a3}=_0x5d18fc,_0x3d3698=_0x16581c[0x0],_0x6b39ef=_0x35d9a3[_0x3b7456(0x194)];cleanExpiredSessions();if(!profileExists(_0x3d3698)){console['error'](a27_0xe88ae3[_0x3b7456(0x163)]('Profile\x20\x27'+_0x3d3698+_0x3b7456(0x167))),console[_0x3b7456(0x18e)](_0x3b7456(0x19c));const _0x1d8ef6=listProfiles();if(_0x1d8ef6[_0x3b7456(0x1b9)]===0x0)console[_0x3b7456(0x18e)](_0x3b7456(0x164));else for(const _0x223643 of _0x1d8ef6){console[_0x3b7456(0x18e)]('\x20\x20-\x20'+_0x223643[_0x3b7456(0x1ac)]);}return 0x1;}if(_0x6b39ef){const _0x3bf4e6=a27_0x3c8cfe[_0x3b7456(0x19d)](getConfigDir(),_0x3b7456(0x18a));return saveActiveProfileToUserConfig(_0x3d3698),console[_0x3b7456(0x18e)](_0x3b7456(0x182)+a27_0xe88ae3['green'](_0x3d3698)),console[_0x3b7456(0x18e)](a27_0xe88ae3['dim']('\x0aSaved\x20to:\x20'+_0x3bf4e6)),0x0;}const _0x17940a=getSessionID(_0x35d9a3[_0x3b7456(0x1a8)]);return saveSessionContext({'profile':_0x3d3698},_0x35d9a3[_0x3b7456(0x1a8)]),console[_0x3b7456(0x18e)](_0x3b7456(0x169)+a27_0xe88ae3[_0x3b7456(0x1b2)](_0x3d3698)+'\x20'+a27_0xe88ae3[_0x3b7456(0x152)]('(session:\x20'+_0x17940a+')')),console[_0x3b7456(0x18e)](a27_0xe88ae3['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3d3698+_0x3b7456(0x1bb))),0x0;}}
@@ -1 +1 @@
1
- const a28_0x571852=a28_0x40d8;(function(_0x3ed734,_0x33aef6){const _0x2b9c3d=a28_0x40d8,_0x3a4cf0=_0x3ed734();while(!![]){try{const _0x1a6280=parseInt(_0x2b9c3d(0x1cf))/0x1*(-parseInt(_0x2b9c3d(0x1d3))/0x2)+parseInt(_0x2b9c3d(0x1ca))/0x3+parseInt(_0x2b9c3d(0x1d2))/0x4+-parseInt(_0x2b9c3d(0x1cb))/0x5*(parseInt(_0x2b9c3d(0x1da))/0x6)+-parseInt(_0x2b9c3d(0x1cd))/0x7*(-parseInt(_0x2b9c3d(0x1d1))/0x8)+-parseInt(_0x2b9c3d(0x1d7))/0x9+-parseInt(_0x2b9c3d(0x1dc))/0xa*(-parseInt(_0x2b9c3d(0x1ce))/0xb);if(_0x1a6280===_0x33aef6)break;else _0x3a4cf0['push'](_0x3a4cf0['shift']());}catch(_0x1ec4ab){_0x3a4cf0['push'](_0x3a4cf0['shift']());}}}(a28_0xe5da,0x8f697));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0xe5da(){const _0x2a3144=['error','150980RvFzzM','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','description','List\x20all\x20available\x20profiles','log','2597124DrJcfA','1339375oCZCdi','\x20\x20Global:\x20~/.config/tdx/tdx.json','3189291DpCpLo','407PpBAyC','7321uFNMfP','map','8gZQxCM','4134032cwsXpa','244dKnrPP','execute','Error:\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','8074152IpdEma','config','scope','12IvRBPq'];a28_0xe5da=function(){return _0x2a3144;};return a28_0xe5da();}import{handleSDKOutput}from'../core/command-output.js';function a28_0x40d8(_0x38ef9b,_0x30c4bf){_0x38ef9b=_0x38ef9b-0x1c9;const _0xe5da75=a28_0xe5da();let _0x40d898=_0xe5da75[_0x38ef9b];return _0x40d898;}export class ProfilesCommand extends BaseCommand{[a28_0x571852(0x1dd)]='profiles';[a28_0x571852(0x1df)]=a28_0x571852(0x1e0);async[a28_0x571852(0x1d4)](_0x54f720){const _0x445a01=a28_0x571852,{options:_0x2ec981}=_0x54f720;try{const _0x13955d=listProfiles(),_0x244b8c=getActiveProfile();if(_0x13955d['length']===0x0)return console[_0x445a01(0x1c9)](_0x445a01(0x1d6)),console[_0x445a01(0x1c9)](_0x445a01(0x1de)),console[_0x445a01(0x1c9)](_0x445a01(0x1cc)),0x0;const _0x2604c8=_0x13955d[_0x445a01(0x1d0)](_0x10eb5e=>{const _0x2d7b1a=_0x445a01,_0x5ccd90=_0x10eb5e[_0x2d7b1a(0x1dd)]===_0x244b8c,_0x5f5b4a=getProfileParams(_0x10eb5e[_0x2d7b1a(0x1d8)]);return{'name':_0x10eb5e[_0x2d7b1a(0x1dd)],'active':_0x5ccd90,'scope':_0x10eb5e[_0x2d7b1a(0x1d9)],'description':_0x10eb5e[_0x2d7b1a(0x1d8)][_0x2d7b1a(0x1df)]||'','params':_0x5f5b4a};});return await handleSDKOutput(_0x2604c8,_0x2ec981),0x0;}catch(_0x1c50ae){return _0x1c50ae instanceof Error&&console[_0x445a01(0x1db)](_0x445a01(0x1d5)+_0x1c50ae['message']),0x1;}}}
1
+ const a28_0x46971f=a28_0x504f;(function(_0x244c27,_0x55bea3){const _0x4f86cb=a28_0x504f,_0x209741=_0x244c27();while(!![]){try{const _0x392786=parseInt(_0x4f86cb(0x12e))/0x1*(-parseInt(_0x4f86cb(0x133))/0x2)+-parseInt(_0x4f86cb(0x12f))/0x3+-parseInt(_0x4f86cb(0x13a))/0x4+-parseInt(_0x4f86cb(0x13f))/0x5*(-parseInt(_0x4f86cb(0x132))/0x6)+-parseInt(_0x4f86cb(0x139))/0x7*(parseInt(_0x4f86cb(0x13e))/0x8)+parseInt(_0x4f86cb(0x131))/0x9+parseInt(_0x4f86cb(0x12a))/0xa*(parseInt(_0x4f86cb(0x12d))/0xb);if(_0x392786===_0x55bea3)break;else _0x209741['push'](_0x209741['shift']());}catch(_0x114740){_0x209741['push'](_0x209741['shift']());}}}(a28_0x2405,0xdbcba));import{BaseCommand}from'./command.js';function a28_0x504f(_0x2ed73b,_0x1b8bb5){_0x2ed73b=_0x2ed73b-0x129;const _0x24059c=a28_0x2405();let _0x504fd3=_0x24059c[_0x2ed73b];return _0x504fd3;}function a28_0x2405(){const _0x55eb51=['log','config','scope','name','List\x20all\x20available\x20profiles','6979gipvWs','3172456RiQvvY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','error','profiles','8688QljxUl','265kIsiCU','message','\x20\x20Global:\x20~/.config/tdx/tdx.json','map','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','248790VbTHwG','execute','Error:\x20','946UWhmOD','9sYumQq','2434410FjGmSN','description','9570654OPYhyN','190446ELWLrx','288370BezmPT'];a28_0x2405=function(){return _0x55eb51;};return a28_0x2405();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x46971f(0x137)]=a28_0x46971f(0x13d);[a28_0x46971f(0x130)]=a28_0x46971f(0x138);async[a28_0x46971f(0x12b)](_0x5f3e65){const _0x4f9792=a28_0x46971f,{options:_0x10a5f9}=_0x5f3e65;try{const _0x22bd6a=listProfiles(),_0x44fe47=getActiveProfile();if(_0x22bd6a['length']===0x0)return console[_0x4f9792(0x134)](_0x4f9792(0x13b)),console[_0x4f9792(0x134)](_0x4f9792(0x129)),console[_0x4f9792(0x134)](_0x4f9792(0x141)),0x0;const _0x8e2a11=_0x22bd6a[_0x4f9792(0x142)](_0x3415d1=>{const _0x4b798b=_0x4f9792,_0xa6be02=_0x3415d1[_0x4b798b(0x137)]===_0x44fe47,_0x321bf7=getProfileParams(_0x3415d1[_0x4b798b(0x135)]);return{'name':_0x3415d1[_0x4b798b(0x137)],'active':_0xa6be02,'scope':_0x3415d1[_0x4b798b(0x136)],'description':_0x3415d1[_0x4b798b(0x135)][_0x4b798b(0x130)]||'','params':_0x321bf7};});return await handleSDKOutput(_0x8e2a11,_0x10a5f9),0x0;}catch(_0x413435){return _0x413435 instanceof Error&&console[_0x4f9792(0x13c)](_0x4f9792(0x12c)+_0x413435[_0x4f9792(0x140)]),0x1;}}}
@@ -1 +1 @@
1
- const a29_0x1ed3e0=a29_0x54df;(function(_0x18586c,_0x577e57){const _0x4f4720=a29_0x54df,_0x358451=_0x18586c();while(!![]){try{const _0x2541c6=-parseInt(_0x4f4720(0xba))/0x1+parseInt(_0x4f4720(0xc9))/0x2+-parseInt(_0x4f4720(0xc7))/0x3+-parseInt(_0x4f4720(0xc4))/0x4+-parseInt(_0x4f4720(0xc5))/0x5*(-parseInt(_0x4f4720(0xbb))/0x6)+parseInt(_0x4f4720(0xc6))/0x7+-parseInt(_0x4f4720(0xc3))/0x8;if(_0x2541c6===_0x577e57)break;else _0x358451['push'](_0x358451['shift']());}catch(_0x773a92){_0x358451['push'](_0x358451['shift']());}}}(a29_0x4dfb,0x8a12a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a29_0x4dfb(){const _0x5b8836=['completedSplits','validate','\x20splits','join','length','options','verbose','Schema:\x20','594889fkpHvZ','18eOtrCR','Site:\x20','message','setPhase','Executing\x20statement\x20','\x20rows\x20','processedRows','originalMessage','3482448JhVAYo','497032xgSsuJ','1711755cwkxuy','2777173YRwcRV','1104303YFtrKZ','Error:\x20','1328616syStMM','error','site','Executing\x20query\x20[','output','information_schema','Query\x20completed:\x20Processed\x20','setExtra','catalog','setJobId','elapsedTimeMillis','Run\x20Trino\x20queries\x20(streaming)','name','file','...','totalSplits','Catalog:\x20','Executing\x20query...','Statement\x20','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','jobId','execute','query','No\x20SQL\x20provided','stats','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option'];a29_0x4dfb=function(){return _0x5b8836;};return a29_0x4dfb();}function a29_0x54df(_0x4e5a2b,_0x52e570){_0x4e5a2b=_0x4e5a2b-0xa1;const _0x4dfba2=a29_0x4dfb();let _0x54df5c=_0x4dfba2[_0x4e5a2b];return _0x54df5c;}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x1ed3e0(0xa4)]=a29_0x1ed3e0(0xae);['description']=a29_0x1ed3e0(0xa3);async[a29_0x1ed3e0(0xad)](_0x57a502){const _0x5312a9=a29_0x1ed3e0,{options:_0x4611b5,args:_0x330f57,tdx:_0x3bb985}=_0x57a502,_0x524102=_0x330f57[0x0],_0x1843da=_0x4611b5[_0x5312a9(0xa5)];let _0x458c22;try{if(_0x1843da)_0x458c22=readSqlStatementsFromFile(_0x1843da);else{if(_0x524102==='-')_0x458c22=await readSqlStatementsFromStdin();else{if(_0x524102&&isSqlFilePath(_0x524102))_0x458c22=readSqlStatementsFromFile(_0x524102);else{if(_0x524102)_0x458c22=splitSqlStatements(_0x524102);else throw new Error(_0x5312a9(0xaf));}}}}catch(_0x399ee6){return console[_0x5312a9(0xca)](_0x5312a9(0xc8)+_0x399ee6['message']),0x1;}const _0x1ffd91=_0x4611b5['database']||_0x5312a9(0xce),_0x1bb572=_0x4611b5[_0x5312a9(0xd1)];try{const _0x467568=[],_0x27374a=!!_0x4611b5[_0x5312a9(0xcd)];for(let _0x40b8d0=0x0;_0x40b8d0<_0x458c22[_0x5312a9(0xb6)];_0x40b8d0++){const _0x4f25ad=_0x458c22[_0x40b8d0],_0x41a8ff=_0x40b8d0+0x1,_0x4026d2=_0x458c22[_0x5312a9(0xb6)],_0x53609f=_0x4026d2>0x1;_0x4611b5[_0x5312a9(0xb8)]&&(console['error']('\x0a'+(_0x53609f?_0x5312a9(0xaa)+_0x41a8ff+'/'+_0x4026d2+':':'')),console[_0x5312a9(0xca)](_0x5312a9(0xbc)+_0x4611b5[_0x5312a9(0xcb)]),console[_0x5312a9(0xca)](_0x5312a9(0xa8)+(_0x1bb572||'td')),console[_0x5312a9(0xca)](_0x5312a9(0xb9)+_0x1ffd91),console[_0x5312a9(0xca)]('SQL:\x20'+_0x4f25ad));const _0x3833e8=_0x53609f?_0x5312a9(0xbf)+_0x41a8ff+'/'+_0x4026d2+_0x5312a9(0xa6):_0x5312a9(0xa9);try{const _0x54782c=await withProgressSpinner(_0x3833e8,async _0x163018=>{const _0xce6c9b=_0x5312a9,_0x9aee51=await _0x3bb985['query'][_0xce6c9b(0xad)](_0x4f25ad,{'catalog':_0x1bb572,'schema':_0x1ffd91,'onJobId':_0xc23949=>{const _0x3aa3ad=_0xce6c9b;_0x163018[_0x3aa3ad(0xa1)](_0xc23949);},'onProgress':_0x3b9116=>{const _0x177fc3=_0xce6c9b;_0x163018[_0x177fc3(0xbe)](_0x177fc3(0xcc)+_0x3b9116['state']+']'),_0x163018[_0x177fc3(0xd0)](formatRows(_0x3b9116[_0x177fc3(0xc1)])+_0x177fc3(0xc0)+_0x3b9116[_0x177fc3(0xb2)]+'/'+_0x3b9116[_0x177fc3(0xa7)]+_0x177fc3(0xb4));}});return _0x9aee51;},{'verbose':_0x4611b5[_0x5312a9(0xb8)]}),_0x4e30a0=_0x54782c['data'],_0x18bfcc=_0x4e30a0[_0x5312a9(0xac)]?'\x20[Job\x20ID:\x20'+_0x4e30a0[_0x5312a9(0xac)]+']':'',_0x3d7411=_0x53609f?'Statement\x20'+_0x41a8ff+'/'+_0x4026d2+'\x20-\x20':'';console[_0x5312a9(0xca)]('✔\x20'+_0x3d7411+_0x5312a9(0xcf)+formatRows(_0x4e30a0[_0x5312a9(0xb0)]['processedRows'])+_0x5312a9(0xc0)+('in\x20'+formatElapsed(_0x4e30a0[_0x5312a9(0xb0)][_0x5312a9(0xa2)])+_0x18bfcc));if(_0x53609f&&_0x27374a){const _0xe2e13e=resolveOutputOptions(_0x4611b5),_0x4f824a=await formatQueryOutput(_0x4e30a0,_0xe2e13e);_0x467568['push'](_0x4f824a);}else await handleQueryOutput(_0x4e30a0,_0x4611b5);}catch(_0x3ef730){const _0x40bac1=_0x53609f?_0x5312a9(0xaa)+_0x41a8ff+'/'+_0x4026d2+':\x0a':'',_0x3d619c=_0x3ef730 instanceof SDKError?_0x3ef730[_0x5312a9(0xc2)]:_0x3ef730[_0x5312a9(0xbd)];return console[_0x5312a9(0xca)](''+_0x40bac1+_0x3d619c),0x1;}}if(_0x458c22[_0x5312a9(0xb6)]>0x1&&_0x27374a&&_0x467568[_0x5312a9(0xb6)]>0x0){const _0x53d757=_0x467568[_0x5312a9(0xb5)]('\x0a');writeFileSync(_0x4611b5[_0x5312a9(0xcd)],_0x53d757),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x4611b5[_0x5312a9(0xcd)]);}return 0x0;}catch(_0x324f85){throw _0x324f85;}}[a29_0x1ed3e0(0xb3)](_0x515df2){const _0x2dedc9=a29_0x1ed3e0,_0x44d646=_0x515df2['args'][0x0],_0x172570=_0x515df2[_0x2dedc9(0xb7)][_0x2dedc9(0xa5)];if(!_0x44d646&&!_0x172570)return _0x2dedc9(0xab);if(_0x44d646&&_0x172570)return _0x2dedc9(0xb1);return undefined;}}
1
+ const a29_0x2430ae=a29_0x4b9f;function a29_0x3f6d(){const _0x524e76=['length','5692juAWLn','setJobId','options','join','No\x20SQL\x20provided','push','1558071odBEUR','Query\x20completed:\x20Processed\x20','5199318tlWOGt','Schema:\x20','error','Site:\x20','name','30YUzwoa','totalSplits','processedRows','jobId','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','completedSplits','file','Statement\x20','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','information_schema','query','\x20[Job\x20ID:\x20','Executing\x20query...','output','setPhase','SQL:\x20','Catalog:\x20','validate','10277652vULpVa','database','stats','Executing\x20query\x20[','description','Executing\x20statement\x20','execute','Run\x20Trino\x20queries\x20(streaming)','12324136TZKcsr','catalog','\x20-\x20','1224731sHnPHm','in\x20','11310858deDmbx','message','4330jsppPV','6uXRajg','verbose','setExtra','site','Error:\x20','data','\x20rows\x20','elapsedTimeMillis'];a29_0x3f6d=function(){return _0x524e76;};return a29_0x3f6d();}(function(_0x5bb623,_0xd6e325){const _0x46a947=a29_0x4b9f,_0xb34709=_0x5bb623();while(!![]){try{const _0x1ef66f=-parseInt(_0x46a947(0x1dc))/0x1+-parseInt(_0x46a947(0x1e1))/0x2*(-parseInt(_0x46a947(0x1f0))/0x3)+-parseInt(_0x46a947(0x1ea))/0x4*(-parseInt(_0x46a947(0x1e0))/0x5)+-parseInt(_0x46a947(0x1de))/0x6+parseInt(_0x46a947(0x1d1))/0x7+parseInt(_0x46a947(0x1d9))/0x8+-parseInt(_0x46a947(0x1f2))/0x9*(parseInt(_0x46a947(0x1f7))/0xa);if(_0x1ef66f===_0xd6e325)break;else _0xb34709['push'](_0xb34709['shift']());}catch(_0x1c8a02){_0xb34709['push'](_0xb34709['shift']());}}}(a29_0x3f6d,0xe9702));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a29_0x4b9f(_0x470290,_0x2bdbaa){_0x470290=_0x470290-0x1c2;const _0x3f6d9e=a29_0x3f6d();let _0x4b9fac=_0x3f6d9e[_0x470290];return _0x4b9fac;}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x2430ae(0x1f6)]=a29_0x2430ae(0x1c9);[a29_0x2430ae(0x1d5)]=a29_0x2430ae(0x1d8);async['execute'](_0x3807ce){const _0x365c08=a29_0x2430ae,{options:_0x10fb35,args:_0xba231d,tdx:_0x26db32}=_0x3807ce,_0x13ca6a=_0xba231d[0x0],_0x425c0d=_0x10fb35[_0x365c08(0x1c5)];let _0x1a30e9;try{if(_0x425c0d)_0x1a30e9=readSqlStatementsFromFile(_0x425c0d);else{if(_0x13ca6a==='-')_0x1a30e9=await readSqlStatementsFromStdin();else{if(_0x13ca6a&&isSqlFilePath(_0x13ca6a))_0x1a30e9=readSqlStatementsFromFile(_0x13ca6a);else{if(_0x13ca6a)_0x1a30e9=splitSqlStatements(_0x13ca6a);else throw new Error(_0x365c08(0x1ee));}}}}catch(_0x6b5ec){return console[_0x365c08(0x1f4)](_0x365c08(0x1e5)+_0x6b5ec[_0x365c08(0x1df)]),0x1;}const _0x4bb121=_0x10fb35[_0x365c08(0x1d2)]||_0x365c08(0x1c8),_0x3eabdb=_0x10fb35[_0x365c08(0x1da)];try{const _0x492996=[],_0x50b459=!!_0x10fb35[_0x365c08(0x1cc)];for(let _0x531019=0x0;_0x531019<_0x1a30e9[_0x365c08(0x1e9)];_0x531019++){const _0x2a18dd=_0x1a30e9[_0x531019],_0x13d056=_0x531019+0x1,_0x34e0b0=_0x1a30e9[_0x365c08(0x1e9)],_0x3d6379=_0x34e0b0>0x1;_0x10fb35[_0x365c08(0x1e2)]&&(console[_0x365c08(0x1f4)]('\x0a'+(_0x3d6379?'Statement\x20'+_0x13d056+'/'+_0x34e0b0+':':'')),console[_0x365c08(0x1f4)](_0x365c08(0x1f5)+_0x10fb35[_0x365c08(0x1e4)]),console['error'](_0x365c08(0x1cf)+(_0x3eabdb||'td')),console['error'](_0x365c08(0x1f3)+_0x4bb121),console[_0x365c08(0x1f4)](_0x365c08(0x1ce)+_0x2a18dd));const _0x4b064c=_0x3d6379?_0x365c08(0x1d6)+_0x13d056+'/'+_0x34e0b0+'...':_0x365c08(0x1cb);try{const _0x434ba7=await withProgressSpinner(_0x4b064c,async _0x26e2c0=>{const _0x2a27ac=_0x365c08,_0x4e3eed=await _0x26db32[_0x2a27ac(0x1c9)][_0x2a27ac(0x1d7)](_0x2a18dd,{'catalog':_0x3eabdb,'schema':_0x4bb121,'onJobId':_0x493ac4=>{const _0x4bf609=_0x2a27ac;_0x26e2c0[_0x4bf609(0x1eb)](_0x493ac4);},'onProgress':_0x1c9e94=>{const _0x1c6434=_0x2a27ac;_0x26e2c0[_0x1c6434(0x1cd)](_0x1c6434(0x1d4)+_0x1c9e94['state']+']'),_0x26e2c0[_0x1c6434(0x1e3)](formatRows(_0x1c9e94[_0x1c6434(0x1f9)])+'\x20rows\x20'+_0x1c9e94[_0x1c6434(0x1c4)]+'/'+_0x1c9e94[_0x1c6434(0x1f8)]+'\x20splits');}});return _0x4e3eed;},{'verbose':_0x10fb35[_0x365c08(0x1e2)]}),_0x5a3026=_0x434ba7[_0x365c08(0x1e6)],_0x3309cf=_0x5a3026['jobId']?_0x365c08(0x1ca)+_0x5a3026[_0x365c08(0x1c2)]+']':'',_0xe051d7=_0x3d6379?_0x365c08(0x1c6)+_0x13d056+'/'+_0x34e0b0+_0x365c08(0x1db):'';console['error']('✔\x20'+_0xe051d7+_0x365c08(0x1f1)+formatRows(_0x5a3026[_0x365c08(0x1d3)][_0x365c08(0x1f9)])+_0x365c08(0x1e7)+(_0x365c08(0x1dd)+formatElapsed(_0x5a3026[_0x365c08(0x1d3)][_0x365c08(0x1e8)])+_0x3309cf));if(_0x3d6379&&_0x50b459){const _0x55ce7e=resolveOutputOptions(_0x10fb35),_0x44cd22=await formatQueryOutput(_0x5a3026,_0x55ce7e);_0x492996[_0x365c08(0x1ef)](_0x44cd22);}else await handleQueryOutput(_0x5a3026,_0x10fb35);}catch(_0x1d72a2){const _0x17ef71=_0x3d6379?'Statement\x20'+_0x13d056+'/'+_0x34e0b0+':\x0a':'',_0x3df0d9=_0x1d72a2 instanceof SDKError?_0x1d72a2['originalMessage']:_0x1d72a2[_0x365c08(0x1df)];return console['error'](''+_0x17ef71+_0x3df0d9),0x1;}}if(_0x1a30e9[_0x365c08(0x1e9)]>0x1&&_0x50b459&&_0x492996[_0x365c08(0x1e9)]>0x0){const _0x2ef12d=_0x492996[_0x365c08(0x1ed)]('\x0a');writeFileSync(_0x10fb35['output'],_0x2ef12d),console[_0x365c08(0x1f4)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x10fb35[_0x365c08(0x1cc)]);}return 0x0;}catch(_0x44d4ca){throw _0x44d4ca;}}[a29_0x2430ae(0x1d0)](_0xbe94f4){const _0x12d823=a29_0x2430ae,_0x4d05ad=_0xbe94f4['args'][0x0],_0x4e7513=_0xbe94f4[_0x12d823(0x1ec)][_0x12d823(0x1c5)];if(!_0x4d05ad&&!_0x4e7513)return _0x12d823(0x1c7);if(_0x4d05ad&&_0x4e7513)return _0x12d823(0x1c3);return undefined;}}