@treasuredata/tdx 0.28.0 → 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 (184) 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.d.ts +6 -0
  111. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  112. package/dist/sdk/llm/model-factors.js +1 -1
  113. package/dist/sdk/llm/model-factors.js.map +1 -1
  114. package/dist/sdk/personalization.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/realtime.js +1 -1
  118. package/dist/sdk/schedule.js +1 -1
  119. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  120. package/dist/sdk/segment/fields-display.js +1 -1
  121. package/dist/sdk/segment/file-discovery.js +1 -1
  122. package/dist/sdk/segment/journey-utils.js +1 -1
  123. package/dist/sdk/segment/journey-validator.d.ts.map +1 -1
  124. package/dist/sdk/segment/journey-validator.js +1 -1
  125. package/dist/sdk/segment/journey-validator.js.map +1 -1
  126. package/dist/sdk/segment/journey-yaml.js +1 -1
  127. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  128. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  129. package/dist/sdk/segment/pull-workflow.js +1 -1
  130. package/dist/sdk/segment/push-recovery.js +1 -1
  131. package/dist/sdk/segment/push-workflow.js +1 -1
  132. package/dist/sdk/segment/resolution-context.js +1 -1
  133. package/dist/sdk/segment/segment-path-parser.js +1 -1
  134. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  135. package/dist/sdk/segment/target-resolution.js +1 -1
  136. package/dist/sdk/segment/tdx-config.js +1 -1
  137. package/dist/sdk/segment/validate-files.js +1 -1
  138. package/dist/sdk/segment/yaml-validator.js +1 -1
  139. package/dist/sdk/segment.js +1 -1
  140. package/dist/sdk/types/index.js +1 -1
  141. package/dist/sdk/types/progress.js +1 -1
  142. package/dist/sdk/user.js +1 -1
  143. package/dist/sdk/util/format-detector.js +1 -1
  144. package/dist/sdk/util/formatters.js +1 -1
  145. package/dist/sdk/util/index.js +1 -1
  146. package/dist/sdk/util/tree-formatter.js +1 -1
  147. package/dist/sdk/workflow/archive-validation.js +1 -1
  148. package/dist/sdk/workflow/clone-workflow.js +1 -1
  149. package/dist/sdk/workflow/index.js +1 -1
  150. package/dist/sdk/workflow/pull-workflow.js +1 -1
  151. package/dist/sdk/workflow/push-workflow.js +1 -1
  152. package/dist/sdk/workflow/tdx-config.js +1 -1
  153. package/dist/sdk/workflow/workflow-utils.js +1 -1
  154. package/dist/test-utils/command-runner.js +1 -1
  155. package/dist/test-utils/factories.js +1 -1
  156. package/dist/test-utils/fixtures.js +1 -1
  157. package/dist/test-utils/http-mock.js +1 -1
  158. package/dist/test-utils/index.js +1 -1
  159. package/dist/utils/async.js +1 -1
  160. package/dist/utils/colors.js +1 -1
  161. package/dist/utils/diff.js +1 -1
  162. package/dist/utils/file-permissions.js +1 -1
  163. package/dist/utils/global-cache.js +1 -1
  164. package/dist/utils/json-loader.js +1 -1
  165. package/dist/utils/local-cache.js +1 -1
  166. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  167. package/dist/utils/logger/formatters/index.js +1 -1
  168. package/dist/utils/logger/handlers/console-handler.js +1 -1
  169. package/dist/utils/logger/handlers/file-handler.js +1 -1
  170. package/dist/utils/logger/handlers/index.js +1 -1
  171. package/dist/utils/logger/handlers/null-handler.js +1 -1
  172. package/dist/utils/logger/index.js +1 -1
  173. package/dist/utils/logger/logger.js +1 -1
  174. package/dist/utils/logger/types.js +1 -1
  175. package/dist/utils/option-validation.js +1 -1
  176. package/dist/utils/process.js +1 -1
  177. package/dist/utils/prompt.js +1 -1
  178. package/dist/utils/spinner.js +1 -1
  179. package/dist/utils/sse-parser.js +1 -1
  180. package/dist/utils/string-utils.js +1 -1
  181. package/dist/utils/table-ref-parser.js +1 -1
  182. package/dist/utils/tdx-logger.js +1 -1
  183. package/dist/utils/version-check.js +1 -1
  184. package/package.json +1 -1
@@ -1 +1 @@
1
- const a26_0x1c8851=a26_0x17d9;(function(_0xeb210d,_0x155dd5){const _0x4b67d6=a26_0x17d9,_0x524c93=_0xeb210d();while(!![]){try{const _0x1fd8dd=-parseInt(_0x4b67d6(0x201))/0x1*(parseInt(_0x4b67d6(0x1f8))/0x2)+-parseInt(_0x4b67d6(0x223))/0x3*(-parseInt(_0x4b67d6(0x1cd))/0x4)+parseInt(_0x4b67d6(0x30f))/0x5+parseInt(_0x4b67d6(0x232))/0x6+-parseInt(_0x4b67d6(0x2f0))/0x7*(-parseInt(_0x4b67d6(0x1e9))/0x8)+-parseInt(_0x4b67d6(0x273))/0x9*(parseInt(_0x4b67d6(0x2d3))/0xa)+-parseInt(_0x4b67d6(0x2f6))/0xb*(-parseInt(_0x4b67d6(0x321))/0xc);if(_0x1fd8dd===_0x155dd5)break;else _0x524c93['push'](_0x524c93['shift']());}catch(_0x12d2f0){_0x524c93['push'](_0x524c93['shift']());}}}(a26_0x4aff,0xe0786));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x1dfb54 from'path';function a26_0x4aff(){const _0x16c154=['Fetching\x20sample\x20data...','using\x20the\x20default\x20path:\x20','RT\x202.0:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','double','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20parent\x20segment','yellow','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','addBehaviors','trim','stats','tdx\x20ps\x20preview\x20','reduce','\x20behaviors','/\x20directory.\x0a','⚡\x20Enabled','\x20\x20Note:\x20','81lkiWtM','\x20section','toLowerCase','jobId','column_name','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20Opening\x20','displayValidateResults','audienceId','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Behaviors','\x20rows)','personalizationServices','interval','database','No\x20parent\x20segments\x20found','valid','information_schema','formatSchemaJson','`\x20to\x20download\x20the\x20configuration\x20first','dim','Table:\x20','Fetching\x20customers\x20schema...','Fetching\x20behavior\x20list...','behavior_','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','displayPreviewHints','segment:parent:sql','population','pushParentYaml','/\x20directories\x20exist.','coveragePercent','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20\x201.\x20Edit\x20','Error:','\x0aNew\x20parent\x20segment\x20\x27','setJobId','message','FINISHED','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','segment:parent:push','SELECT\x20*\x20FROM\x20','Join\x20on:','matchedCount','\x20trigger=','\x20Configuration\x20is\x20valid','list','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','attributes','segment:parent:preview','Create\x20parent\x20segment\x20\x27','realtime','column_type','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20Added\x20personalization\x20template\x20to\x20','addAttributes','Apply\x20changes\x20to\x20\x27','Resolving\x20parent\x20segment\x20\x27','personalization_services','Preview:','displayMasterInfo','\x27...','displayColumns','\x20personalization\x20service','workflowAttemptId','stitchingKeys','\x0aNo\x20sample\x20data\x20available','Personalization\x20service\x20description','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','log','getBehaviorNames','realtime:','query','xdg-open','Personalization:','Error:\x20--behavior\x20requires\x20a\x20name\x0a','match','Errors:','red','label','table','ID\x20Stitching:','varchar','string','page_view','attribute','sections','-1d','addAttributesFile','Executing\x20parent\x20segment\x20query...','behavior','ps:rt:validate','Get\x20SQL\x20query\x20for\x20parent\x20segment','1671130gsmBpA','apply','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','/app/workflows/','run','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','name','execute','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20No\x20changes\x20-\x20','Session:','bold','Events:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','ps:rt:list','No\x20RT-enabled\x20parent\x20segments\x20found','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','customers','platform','/\x20→\x20','Created','scheduleOption','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','dirname','\x20rows\x20','Error:\x20File\x20not\x20found:\x20','displayRealtimeInfo','Error\x20parsing\x20YAML:\x20','personalization','959XGBbPz','\x20\x20\x20\x20-\x20','displayPreviewResults','getParentFull','errors','Analyzing\x20changes...','110297UwyJvG','Options\x20(one\x20required):\x0a','\x20tdx\x20wf\x20attempt\x20','Default','totalEvents','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','workflowSessionId','Site:\x20','Creating\x20parent\x20segment\x20\x27','ignore','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','format','data','parent_segment','Master\x20+\x20Attributes','jsonl','columns','workflowId','Error:\x20Parent\x20segment\x20name\x20is\x20required','Output\x20Database:','✔\x20Found\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Listing\x20parent\x20segments...','✔\x20Renamed\x20directory\x20to\x20','8537210YSrmsg','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','.yml','description','Customers:','Coverage:','✔\x20Updated\x20parent\x20segment\x20\x27','RT\x202.0\x20Validate:','Attributes:','SELECT\x20*\x20FROM\x20(\x0a','\x0aChanges\x20to\x20\x27','Show\x20parent\x20segment\x20details','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','open','\x20\x20\x20\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','780QxWGey','site','Rows:','\x20parent\x20segment\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','last_page_viewed','\x22,\x20\x22type\x22:\x20\x22','SQL\x20query:\x0a','segment:parent:desc','<database>.<table>','parentSegment','\x0aError:','scheduleType','/sessions/','⚡\x20Not\x20enabled','To\x20cancel:','ps:pz:init','timezone','/\x20and\x20','schemaValid','indexOf','Found\x20YAML\x20file:\x20','validateParentYaml','customerPercent','\x20Added\x20RT\x202.0\x20template\x20section','Listing\x20parent\x20segments\x20matching\x20\x27','\x20RT\x20configuration\x20is\x20valid','Error\x20reading\x20file:\x20','text','No\x20personalization\x20services\x20configured','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20--attribute\x20\x22','\x20configured','processedRows','all','Overwrite\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Fetching\x20parent\x20segment\x20\x27','Options:\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Options:','utf-8','user_id','Pattern:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','master','Listing\x20fields\x20for\x20\x27','sort','Status:','createParent','Creating','\x20to\x20configure\x20your\x20personalization\x20service','sampleData','json','/app/dw/parentSegments/','error','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','column','unref','/attempt/','120PqNaKS','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','endsWith','Audience\x20ID:','\x0a\x20\x20\x20\x20]','events','preview','push','in\x20','\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','cyan','getParentSQL','\x20\x20\x20','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','rowCount','Updating\x20parent\x20segment\x20\x27','filter','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','idStitching','behaviors','td_client_id','✔\x20No\x20changes\x20-\x20\x27','\x20is\x20already\x20up\x20to\x20date','join','\x22\x20}','getOutputDatabaseName','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','segment:parent:list','35800juoIzZ','\x20--interval\x20','tdx\x20ps\x20push\x20','\x20--behavior\x20\x22','List\x20parent\x20segments','\x20total','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x27\x20is\x20up\x20to\x20date','segment:parent:run','Aborted.','primaryKey','\x0aChanges\x20to\x20apply\x20to\x20\x27','Parent\x20segment:\x20','Source:','✘\x20Failed\x20to\x20rename\x20directory:\x20','68UZEoxL','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','keys','✔\x20Query\x20completed:\x20Processed\x20','test','output','green','\x20kill','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','40477EUZreK','segment:parent:update','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x0aUsage:\x20tdx\x20ps\x20preview\x20','YAML\x20file:\x20','List\x20available\x20fields\x20for\x20segmentation','.customers)','elapsedTimeMillis','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','single','schemaError','number','joinKey','toFixed','segment','type','status','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','customerGroup','listFields','listParents','yes','Attributes','segment:parent:show','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Join:','Behavior:','map','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','displaySummary','allValid','verbose','repeat','\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','23487OLVfKY','length','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Listing\x20RT-enabled\x20parent\x20segments...','pullParentYaml','Validating\x20configuration...','%)\x20','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20[Job\x20ID:\x20','updateParent','segment:parent:validate','No\x20parent\x20segments\x20match\x20pattern:\x20','3555138wgQbYY','replace','sourceTableError','attributesFile','Attribute:','To\x20view\x20sample\x20data:','\x20\x20Tables:\x201\x20customers\x20+\x20','Master:','stop','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','displayAttributesStats','Updating','resolveParentId','Columns:','enriched','foreignKey','\x5c$&','start','addBehaviorsFile','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20=\x20','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','trigger_event','limit','displayBehaviorsStats','\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','Database:\x20','segment:parent:pull','segment:parent:view','enabled','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Available\x20behaviors:','localeCompare','\x20to\x20push\x20the\x20configuration','customerGroupFile','\x27\x20and\x20run\x20workflow?','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','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x0a⚠️\x20\x20Migrating:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20\x20Database:\x20','collectSchema','Master\x20Table','realtime_enabled','Updated','displaySampleData'];a26_0x4aff=function(){return _0x16c154;};return a26_0x4aff();}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_0x46f1ae from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a26_0x1c8851(0x303);function openBrowser(_0x14fdf6){const _0x2a2f09=a26_0x1c8851,_0x5109fd=process[_0x2a2f09(0x2e5)],_0x5ac40a=_0x5109fd==='darwin'?_0x2a2f09(0x31c):_0x5109fd==='win32'?_0x2a2f09(0x243):_0x2a2f09(0x2bf);spawn(_0x5ac40a,[_0x14fdf6],{'detached':!![],'stdio':_0x2a2f09(0x2ff)})[_0x2a2f09(0x1cb)]();}function migrateLegacyDirectory(){const _0x3a6746=a26_0x1c8851;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x180e22=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x180e22['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3a6746(0x1c8)](a26_0x46f1ae['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3a6746(0x333)+PARENT_SEGMENT_DIR+_0x3a6746(0x292))),console['error'](a26_0x46f1ae[_0x3a6746(0x288)](_0x3a6746(0x300)+LEGACY_PARENT_SEGMENT_DIR+_0x3a6746(0x270))),![];console[_0x3a6746(0x1c8)](a26_0x46f1ae[_0x3a6746(0x268)](_0x3a6746(0x259)+LEGACY_PARENT_SEGMENT_DIR+_0x3a6746(0x2e6)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3a6746(0x1c8)](a26_0x46f1ae[_0x3a6746(0x1fe)](_0x3a6746(0x30e)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x29b3c4){const _0x58ea64=_0x29b3c4 instanceof Error?_0x29b3c4[_0x3a6746(0x29b)]:String(_0x29b3c4);return console[_0x3a6746(0x1c8)](a26_0x46f1ae[_0x3a6746(0x2c4)](_0x3a6746(0x1f7)+_0x58ea64+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x1c8851(0x2d7)](_0x42eba6){return migrateLegacyDirectory(),super['run'](_0x42eba6);}}function resolveYamlFile(_0x53371b){const _0x1fa177=a26_0x1c8851;if(_0x53371b[_0x1fa177(0x1cf)](_0x1fa177(0x311))||_0x53371b[_0x1fa177(0x1cf)]('.yaml'))return _0x53371b;return a26_0x1dfb54[_0x1fa177(0x1e4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x53371b)+'.yml');}function formatProgressMessage(_0x15529e){const _0x54c229=a26_0x1c8851,_0x3e46de=_0x15529e[_0x54c229(0x2c2)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3e46de){const [,_0x5e5ad5,_0x48d980,_0x224d3d='']=_0x3e46de;return a26_0x46f1ae[_0x54c229(0x288)](_0x5e5ad5+':')+'\x20'+_0x48d980+a26_0x46f1ae[_0x54c229(0x288)](_0x224d3d);}return a26_0x46f1ae[_0x54c229(0x288)](_0x15529e);}function showFileNotFoundError(_0x3d7882,_0x24d891){const _0x10e401=a26_0x1c8851;console[_0x10e401(0x1c8)](a26_0x46f1ae['red'](_0x10e401(0x2ec)+_0x3d7882+'\x0a')),console['error'](a26_0x46f1ae['cyan']('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x24d891+_0x10e401(0x287)));}function displayRealtimeValidation(_0x31572f){const _0x21c5f4=a26_0x1c8851;if(!_0x31572f[_0x21c5f4(0x2a9)])return;const _0x2ed030=_0x31572f[_0x21c5f4(0x2a9)],_0x54bb8c=_0x2ed030[_0x21c5f4(0x250)]?a26_0x46f1ae['green'](_0x21c5f4(0x271)):a26_0x46f1ae['yellow'](_0x21c5f4(0x32f));console[_0x21c5f4(0x1c8)]('\x0a'+a26_0x46f1ae[_0x21c5f4(0x288)](_0x21c5f4(0x263))+'\x20'+_0x54bb8c);if(_0x2ed030[_0x21c5f4(0x1d2)]&&_0x2ed030[_0x21c5f4(0x1d2)][_0x21c5f4(0x224)]>0x0){console[_0x21c5f4(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x21c5f4(0x288)](_0x21c5f4(0x2df))+'\x20'+_0x2ed030[_0x21c5f4(0x1d2)][_0x21c5f4(0x224)]+_0x21c5f4(0x341));for(const _0x2707c6 of _0x2ed030['events']){const _0x3c1f7d=_0x2707c6['sourceTableValid']===![]?a26_0x46f1ae['red']('✘'):a26_0x46f1ae['green']('✔');console[_0x21c5f4(0x1c8)](_0x21c5f4(0x31d)+_0x3c1f7d+'\x20'+_0x2707c6[_0x21c5f4(0x2d9)]),_0x2707c6[_0x21c5f4(0x234)]&&console[_0x21c5f4(0x1c8)]('\x20\x20\x20\x20\x20\x20'+a26_0x46f1ae[_0x21c5f4(0x2c4)](_0x2707c6[_0x21c5f4(0x234)]));}}if(_0x2ed030[_0x21c5f4(0x2a6)]&&_0x2ed030[_0x21c5f4(0x2a6)][_0x21c5f4(0x224)]>0x0){console[_0x21c5f4(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x21c5f4(0x288)](_0x21c5f4(0x317))+'\x20'+_0x2ed030[_0x21c5f4(0x2a6)][_0x21c5f4(0x224)]+'\x20configured');for(const _0x5bd729 of _0x2ed030[_0x21c5f4(0x2a6)]){const _0x3bc123=_0x5bd729[_0x21c5f4(0x284)]?a26_0x46f1ae[_0x21c5f4(0x1fe)]('✔'):a26_0x46f1ae[_0x21c5f4(0x2c4)]('✘');console[_0x21c5f4(0x1c8)](_0x21c5f4(0x31d)+_0x3bc123+'\x20'+_0x5bd729[_0x21c5f4(0x2d9)]+'\x20'+a26_0x46f1ae[_0x21c5f4(0x288)]('('+_0x5bd729[_0x21c5f4(0x210)]+')'));}}if(_0x2ed030[_0x21c5f4(0x1df)]){const _0x3ab080=_0x2ed030[_0x21c5f4(0x1df)]['stitchingKeys']?.[_0x21c5f4(0x224)]?'\x20+\x20['+_0x2ed030[_0x21c5f4(0x1df)][_0x21c5f4(0x2b7)][_0x21c5f4(0x1e4)](',\x20')+']':'';console['error']('\x20\x20'+a26_0x46f1ae[_0x21c5f4(0x288)](_0x21c5f4(0x2c7))+'\x20'+_0x2ed030[_0x21c5f4(0x1df)][_0x21c5f4(0x1f3)]+_0x3ab080);}if(_0x2ed030[_0x21c5f4(0x280)]&&_0x2ed030[_0x21c5f4(0x280)][_0x21c5f4(0x224)]>0x0){console[_0x21c5f4(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x21c5f4(0x288)](_0x21c5f4(0x2c0))+'\x20'+_0x2ed030[_0x21c5f4(0x280)][_0x21c5f4(0x224)]+'\x20service'+(_0x2ed030[_0x21c5f4(0x280)][_0x21c5f4(0x224)]!==0x1?'s':''));for(const _0x3c0110 of _0x2ed030[_0x21c5f4(0x280)]){console[_0x21c5f4(0x1c8)](_0x21c5f4(0x2f1)+_0x3c0110[_0x21c5f4(0x2d9)]);}}}function showParentSegmentNotSetError(_0x5e2a51){const _0x3e8ee7=a26_0x1c8851;console[_0x3e8ee7(0x1c8)](a26_0x46f1ae[_0x3e8ee7(0x268)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3e8ee7(0x1c8)](_0x5e2a51);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x1e8);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x1ed);async[a26_0x1c8851(0x2da)](_0x3ffe5d){const _0xec41b2=a26_0x1c8851,{options:_0x370e01,args:_0x452705,tdx:_0x5bcb9e}=_0x3ffe5d,_0x2078dd=_0x452705[0x0];_0x370e01[_0xec41b2(0x220)]&&(console[_0xec41b2(0x1c8)]('Site:\x20'+_0x370e01['site']),_0x2078dd&&console[_0xec41b2(0x1c8)](_0xec41b2(0x1bc)+_0x2078dd));const _0x2cff04=await withSpinner(_0x2078dd?_0xec41b2(0x33a)+_0x2078dd+_0xec41b2(0x2b3):_0xec41b2(0x30d),()=>_0x5bcb9e[_0xec41b2(0x20f)][_0xec41b2(0x215)](),{'verbose':_0x370e01['verbose']});let _0x573793=_0x2cff04['data'];if(_0x2078dd){const _0x1d37a7=_0x2078dd[_0xec41b2(0x233)](/[.+^${}()|[\]\\]/g,_0xec41b2(0x242))[_0xec41b2(0x233)](/\*/g,'.*')[_0xec41b2(0x233)](/\?/g,'.'),_0x5d7e06=new RegExp('^'+_0x1d37a7+'$','i');_0x573793=_0x573793[_0xec41b2(0x1dd)](_0x223da1=>_0x5d7e06[_0xec41b2(0x1fc)](_0x223da1['attributes'][_0xec41b2(0x2d9)]));}_0x573793['sort']((_0x16ee7a,_0x45deaa)=>_0x16ee7a[_0xec41b2(0x2a6)]['name'][_0xec41b2(0x253)](_0x45deaa['attributes'][_0xec41b2(0x2d9)])),console['error']('✔\x20Found\x20'+_0x573793[_0xec41b2(0x224)]+_0xec41b2(0x267)+(_0x573793[_0xec41b2(0x224)]!==0x1?'s':''));const _0x3db8c4=_0x3bf7d3=>{return getConsoleNextUrl(_0x370e01['site'],'/app/dw/parentSegments/'+_0x3bf7d3);};if(_0x370e01[_0xec41b2(0x301)]===_0xec41b2(0x1c6)||_0x370e01[_0xec41b2(0x301)]===_0xec41b2(0x305)){const _0x48afc0=_0x573793['map'](_0x54121c=>({..._0x54121c,'url':_0x3db8c4(_0x54121c['id'])}));await handleSDKOutput(_0x48afc0,_0x370e01);}else{if(_0x573793['length']===0x0)_0x2078dd?console['log'](_0xec41b2(0x231)+_0x2078dd):console['log'](_0xec41b2(0x283));else for(const _0x1a814a of _0x573793){const _0x497ce1=_0x1a814a[_0xec41b2(0x2a6)][_0xec41b2(0x290)]?a26_0x46f1ae[_0xec41b2(0x288)]('\x20('+formatRows(_0x1a814a[_0xec41b2(0x2a6)][_0xec41b2(0x290)])+')'):'',_0x47ec1b=hyperlink(_0x1a814a[_0xec41b2(0x2a6)][_0xec41b2(0x2d9)],_0x3db8c4(_0x1a814a['id']));console['log']('👥\x20'+_0x47ec1b+_0x497ce1);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x1c8851(0x2d9)]='segment:parent:create';[a26_0x1c8851(0x312)]=a26_0x1c8851(0x2a5);async[a26_0x1c8851(0x2da)](_0x18b150){const _0x3190cf=a26_0x1c8851,{options:_0x34ceab,args:_0x2e1dd7,tdx:_0x5acfe5}=_0x18b150;console[_0x3190cf(0x1c8)](_0x3190cf(0x2ba)+_0x3190cf(0x27c)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x22f92c=_0x34ceab;if(_0x2e1dd7[_0x3190cf(0x224)]===0x0)return console[_0x3190cf(0x1c8)](a26_0x46f1ae[_0x3190cf(0x2c4)](_0x3190cf(0x308))),console[_0x3190cf(0x1c8)](_0x3190cf(0x225)),0x1;const _0x340d70=_0x2e1dd7[0x0];if(!_0x22f92c[_0x3190cf(0x282)]||!_0x22f92c['table'])return console[_0x3190cf(0x1c8)](_0x3190cf(0x1bd)),console[_0x3190cf(0x1c8)](_0x3190cf(0x225)),0x1;_0x22f92c[_0x3190cf(0x220)]&&(console[_0x3190cf(0x1c8)]('Site:\x20'+_0x22f92c[_0x3190cf(0x322)]),console[_0x3190cf(0x1c8)]('Name:\x20'+_0x340d70),console['error'](_0x3190cf(0x24d)+_0x22f92c[_0x3190cf(0x282)]),console[_0x3190cf(0x1c8)](_0x3190cf(0x289)+_0x22f92c[_0x3190cf(0x2c6)]));const _0x11d8e8=await loadJSONFromOptions(_0x22f92c['attributes'],_0x22f92c[_0x3190cf(0x235)]),_0x1fca92=await loadJSONFromOptions(_0x22f92c[_0x3190cf(0x1e0)],_0x22f92c['behaviorsFile']),_0x12c222=await loadJSONFromOptions(_0x22f92c['customerGroup'],_0x22f92c[_0x3190cf(0x255)]),_0xcf277={'name':_0x340d70,'description':_0x22f92c[_0x3190cf(0x312)],'scheduleType':_0x22f92c[_0x3190cf(0x32d)],'scheduleOption':_0x22f92c[_0x3190cf(0x2e8)],'timezone':_0x22f92c[_0x3190cf(0x332)],'master':{'parentDatabaseName':_0x22f92c[_0x3190cf(0x282)],'parentTableName':_0x22f92c['table']},'attributes':_0x11d8e8,'behaviors':_0x1fca92,'customerGroup':_0x12c222},_0x37ef29=await withSpinner(_0x3190cf(0x2fe)+_0x340d70+_0x3190cf(0x2b3),()=>_0x5acfe5[_0x3190cf(0x20f)][_0x3190cf(0x1c2)](_0xcf277),{'verbose':_0x34ceab[_0x3190cf(0x220)]}),_0x33c694=_0x37ef29[_0x3190cf(0x302)];return console['error']('✔\x20Created\x20parent\x20segment\x20\x27'+_0x33c694[_0x3190cf(0x2d9)]+'\x27\x20with\x20ID:\x20'+_0x33c694['id']),await handleSDKOutput([_0x33c694],_0x34ceab),0x0;}}function a26_0x17d9(_0x306e8d,_0x2b6317){_0x306e8d=_0x306e8d-0x1ba;const _0x4aff00=a26_0x4aff();let _0x17d931=_0x4aff00[_0x306e8d];return _0x17d931;}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a26_0x1c8851(0x202);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x348);async[a26_0x1c8851(0x2da)](_0x3eab5f){const _0x290926=a26_0x1c8851,{options:_0x37f5bc,args:_0x3f0cd8,tdx:_0x49c2d5}=_0x3eab5f;console[_0x290926(0x1c8)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x290926(0x27c)+_0x290926(0x278));const _0x2aee63=_0x37f5bc;if(_0x3f0cd8[_0x290926(0x224)]===0x0)return console['error'](a26_0x46f1ae['red'](_0x290926(0x308))),console[_0x290926(0x1c8)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x200b82=_0x3f0cd8[0x0];_0x2aee63[_0x290926(0x220)]&&(console[_0x290926(0x1c8)](_0x290926(0x2fd)+_0x2aee63[_0x290926(0x322)]),console[_0x290926(0x1c8)](_0x290926(0x1f5)+_0x200b82));const _0x45eaf1=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x200b82+_0x290926(0x2b3),()=>_0x49c2d5['segment'][_0x290926(0x2f3)](_0x200b82),{'verbose':_0x2aee63[_0x290926(0x220)]}),_0x21cbc6=_0x45eaf1[_0x290926(0x302)],_0x4e9137=await loadJSONFromOptions(_0x2aee63[_0x290926(0x2ad)],_0x2aee63[_0x290926(0x2ce)]),_0x81865e=await loadJSONFromOptions(_0x2aee63[_0x290926(0x26a)],_0x2aee63[_0x290926(0x244)]),_0x19e6c0={'name':_0x21cbc6[_0x290926(0x2d9)],'description':_0x2aee63[_0x290926(0x312)]!==undefined?_0x2aee63['description']:_0x21cbc6[_0x290926(0x312)],'scheduleType':_0x2aee63[_0x290926(0x32d)]!==undefined?_0x2aee63['scheduleType']:_0x21cbc6['scheduleType'],'scheduleOption':_0x2aee63[_0x290926(0x2e8)]!==undefined?_0x2aee63[_0x290926(0x2e8)]:_0x21cbc6[_0x290926(0x2e8)],'timezone':_0x2aee63[_0x290926(0x332)]!==undefined?_0x2aee63[_0x290926(0x332)]:_0x21cbc6[_0x290926(0x332)],'master':_0x21cbc6['master'],'attributes':_0x4e9137?[..._0x21cbc6[_0x290926(0x2a6)]||[],..._0x4e9137]:_0x21cbc6['attributes'],'behaviors':_0x81865e?[..._0x21cbc6['behaviors']||[],..._0x81865e]:_0x21cbc6[_0x290926(0x1e0)],'customerGroup':_0x21cbc6[_0x290926(0x213)]},_0x5a00ed=await withSpinner(_0x290926(0x1dc)+_0x200b82+_0x290926(0x2b3),()=>_0x49c2d5[_0x290926(0x20f)][_0x290926(0x22f)](_0x200b82,_0x19e6c0),{'verbose':_0x2aee63[_0x290926(0x220)]}),_0x10a722=_0x5a00ed[_0x290926(0x302)];return console[_0x290926(0x1c8)](_0x290926(0x315)+_0x10a722[_0x290926(0x2d9)]+'\x27'),await handleSDKOutput([_0x10a722],_0x2aee63),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x24e);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x882b6a){const _0x2a5a16=a26_0x1c8851,{options:_0x4f678f,args:_0xf568f9,tdx:_0x46e1c2}=_0x882b6a,_0x1f4024=_0x4f678f,_0x34bc2a=_0xf568f9[0x0]||_0x4f678f[_0x2a5a16(0x32b)];if(!_0x34bc2a)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x1f4024['use']&&_0x1f4024[_0x2a5a16(0x1fd)])return console[_0x2a5a16(0x1c8)](a26_0x46f1ae[_0x2a5a16(0x2c4)](_0x2a5a16(0x219))),console[_0x2a5a16(0x1c8)](a26_0x46f1ae[_0x2a5a16(0x288)](_0x2a5a16(0x266))),console[_0x2a5a16(0x1c8)](a26_0x46f1ae[_0x2a5a16(0x288)](_0x2a5a16(0x262)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x2a5a16(0x1c8)](a26_0x46f1ae[_0x2a5a16(0x1d7)](_0x2a5a16(0x30b))),0x1;const _0x546b57=_0x1f4024['output']||a26_0x1dfb54['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x34bc2a)+_0x2a5a16(0x311));_0x1f4024[_0x2a5a16(0x220)]&&(console[_0x2a5a16(0x1c8)](_0x2a5a16(0x2fd)+_0x1f4024[_0x2a5a16(0x322)]),console[_0x2a5a16(0x1c8)]('Parent\x20segment:\x20'+_0x34bc2a),console['error']('Output\x20file:\x20'+_0x546b57));const _0x723868=await withSpinner(_0x2a5a16(0x346)+_0x34bc2a+_0x2a5a16(0x2b3),()=>_0x46e1c2[_0x2a5a16(0x20f)][_0x2a5a16(0x22a)](_0x34bc2a),{'verbose':_0x1f4024['verbose']}),_0x24befd=_0x723868[_0x2a5a16(0x302)];if(existsSync(_0x546b57)){const _0xc7d37d=readFileSync(_0x546b57,_0x2a5a16(0x1ba)),_0x26c6c1=generateDiff(_0xc7d37d,_0x24befd);if(!hasChanges(_0x26c6c1))console['error'](a26_0x46f1ae[_0x2a5a16(0x1fe)]('✔')+_0x2a5a16(0x2dc)+a26_0x46f1ae[_0x2a5a16(0x1d7)](_0x546b57)+_0x2a5a16(0x1e3));else{console[_0x2a5a16(0x1c8)](_0x2a5a16(0x319)+_0x546b57+'\x27:'),console['error']('─'[_0x2a5a16(0x221)](0x3c)),console['error'](formatDiffWithColors(_0x26c6c1)),console[_0x2a5a16(0x1c8)]('─'[_0x2a5a16(0x221)](0x3c));if(!_0x1f4024[_0x2a5a16(0x216)]){if(!isInteractive())return console[_0x2a5a16(0x1c8)](a26_0x46f1ae['red'](_0x2a5a16(0x32c)),_0x2a5a16(0x264)),console[_0x2a5a16(0x1c8)](a26_0x46f1ae['dim'](_0x2a5a16(0x258))),0x1;const _0x54048b=await confirmKey(_0x2a5a16(0x344)+_0x546b57+'\x27?');if(!_0x54048b)return console['error'](a26_0x46f1ae['yellow'](_0x2a5a16(0x1f2))),0x1;}writeFileSync(_0x546b57,_0x24befd,'utf-8'),console[_0x2a5a16(0x1c8)](a26_0x46f1ae[_0x2a5a16(0x1fe)]('✔')+_0x2a5a16(0x294)+a26_0x46f1ae['cyan'](_0x546b57));}}else{const _0x48b10b=a26_0x1dfb54[_0x2a5a16(0x2ea)](_0x546b57);!existsSync(_0x48b10b)&&mkdirSync(_0x48b10b,{'recursive':!![]}),writeFileSync(_0x546b57,_0x24befd,_0x2a5a16(0x1ba)),console[_0x2a5a16(0x1c8)](a26_0x46f1ae[_0x2a5a16(0x1fe)]('✔')+_0x2a5a16(0x294)+a26_0x46f1ae[_0x2a5a16(0x1d7)](_0x546b57));}return saveSessionContext({'parent_segment':_0x34bc2a},_0x1f4024['session']),console['error'](a26_0x46f1ae[_0x2a5a16(0x1fe)]('✔')+'\x20Context\x20set:\x20'+a26_0x46f1ae[_0x2a5a16(0x288)]('parent_segment')+_0x2a5a16(0x247)+a26_0x46f1ae[_0x2a5a16(0x1d7)](_0x34bc2a)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x29e);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x1c9);async[a26_0x1c8851(0x2da)](_0x49e64d){const _0x3d64f4=a26_0x1c8851,{options:_0x49b95c,args:_0x58d627,tdx:_0x457d51}=_0x49e64d,_0x2cb060=_0x49b95c,_0x144fac=_0x58d627[0x0]||_0x49b95c['parentSegment'];if(!_0x144fac)return showParentSegmentNotSetError(_0x3d64f4(0x245)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x5d4a3c=resolveYamlFile(_0x144fac);if(!existsSync(_0x5d4a3c))return showFileNotFoundError(_0x5d4a3c,_0x144fac),0x1;_0x2cb060[_0x3d64f4(0x220)]&&(console['error'](_0x3d64f4(0x2fd)+_0x2cb060[_0x3d64f4(0x322)]),console[_0x3d64f4(0x1c8)](_0x3d64f4(0x205)+_0x5d4a3c));let _0x55e946;try{_0x55e946=readFileSync(_0x5d4a3c,'utf-8');}catch(_0x22f77b){const _0x485cde=_0x22f77b instanceof Error?_0x22f77b[_0x3d64f4(0x29b)]:String(_0x22f77b);return console[_0x3d64f4(0x1c8)]('Error\x20reading\x20file:\x20'+_0x485cde),0x1;}const _0x24039d=await withSpinner(_0x3d64f4(0x2f5),()=>_0x457d51['segment'][_0x3d64f4(0x291)](_0x55e946),{'verbose':_0x2cb060[_0x3d64f4(0x220)]}),_0x4106dd=_0x24039d[_0x3d64f4(0x302)],{isNew:_0x327042,name:_0x205cc8,hasChanges:_0x2e6760,diffFormatted:_0x330de4}=_0x4106dd;if(!_0x2e6760)return console[_0x3d64f4(0x1c8)](_0x3d64f4(0x1e2)+_0x205cc8+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x327042?console['error'](_0x3d64f4(0x299)+_0x205cc8+'\x27:'):console[_0x3d64f4(0x1c8)](_0x3d64f4(0x1f4)+_0x205cc8+'\x27:');console[_0x3d64f4(0x1c8)]('─'['repeat'](0x3c)),console[_0x3d64f4(0x1c8)](_0x330de4),console[_0x3d64f4(0x1c8)]('─'[_0x3d64f4(0x221)](0x3c));const _0xaeddb0=_0x327042?_0x3d64f4(0x2a8)+_0x205cc8+'\x27?':_0x3d64f4(0x2ae)+_0x205cc8+'\x27?';if(!_0x2cb060['yes']){if(!isInteractive())return console['error'](a26_0x46f1ae[_0x3d64f4(0x2c4)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x3d64f4(0x1c8)](a26_0x46f1ae[_0x3d64f4(0x288)](_0x3d64f4(0x258))),0x1;const _0x3a96d4=await confirmKey(_0xaeddb0);if(!_0x3a96d4)return console[_0x3d64f4(0x1c8)](a26_0x46f1ae[_0x3d64f4(0x268)](_0x3d64f4(0x1f2))),0x1;}const _0x22b777=_0x327042?'Creating':_0x3d64f4(0x23d),_0x5b80b9=await withSpinner(_0x22b777+'\x20parent\x20segment\x20\x27'+_0x205cc8+_0x3d64f4(0x2b3),()=>_0x4106dd[_0x3d64f4(0x2d4)](),{'verbose':_0x2cb060['verbose']}),_0xc801b4=_0x5b80b9[_0x3d64f4(0x302)],_0x4dddc0=getConsoleNextUrl(_0x2cb060[_0x3d64f4(0x322)],_0x3d64f4(0x1c7)+_0xc801b4['id']),_0x5b6632=_0x327042?_0x3d64f4(0x2e7):_0x3d64f4(0x25f);return console['error']('✔\x20'+_0x5b6632+_0x3d64f4(0x324)+_0xc801b4['name']+'\x27'),console[_0x3d64f4(0x1c8)]('\x20\x20'+_0x4dddc0),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x230);['description']=a26_0x1c8851(0x226);async[a26_0x1c8851(0x2da)](_0x2cf302){const _0xcb996e=a26_0x1c8851,{options:_0x4cd5f0,args:_0x473ff3,tdx:_0x4b4590}=_0x2cf302,_0x8b4bd1=_0x4cd5f0,_0x2848ad=_0x473ff3[0x0]||_0x4cd5f0[_0xcb996e(0x32b)];if(!_0x2848ad)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'+_0xcb996e(0x33f)+_0xcb996e(0x347)+_0xcb996e(0x2ab)+_0xcb996e(0x2e0)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x5992d1=resolveYamlFile(_0x2848ad);if(!existsSync(_0x5992d1))return showFileNotFoundError(_0x5992d1,_0x2848ad),0x1;_0x8b4bd1[_0xcb996e(0x220)]&&(console[_0xcb996e(0x1c8)](_0xcb996e(0x2fd)+_0x8b4bd1[_0xcb996e(0x322)]),console[_0xcb996e(0x1c8)]('YAML\x20file:\x20'+_0x5992d1));let _0x2b7d93;try{_0x2b7d93=readFileSync(_0x5992d1,_0xcb996e(0x1ba));}catch(_0x235872){const _0x61ce6f=_0x235872 instanceof Error?_0x235872[_0xcb996e(0x29b)]:String(_0x235872);return console['error'](_0xcb996e(0x33c)+_0x61ce6f),0x1;}const _0x3818e5=createCommandSpinner(a26_0x46f1ae['dim'](_0xcb996e(0x22b)),{'verbose':_0x8b4bd1[_0xcb996e(0x220)]});_0x3818e5[_0xcb996e(0x243)]();const _0x4c0ee0={'onProgress':_0x9369c9=>{const _0x233353=_0xcb996e;_0x3818e5[_0x233353(0x33d)]=formatProgressMessage(_0x9369c9);}};if(_0x8b4bd1['master'])_0x4c0ee0[_0xcb996e(0x1be)]=!![];if(_0x8b4bd1[_0xcb996e(0x240)])_0x4c0ee0[_0xcb996e(0x240)]=!![];_0x8b4bd1[_0xcb996e(0x2cb)]&&(_0x4c0ee0['attribute']=_0x8b4bd1[_0xcb996e(0x2cb)]);_0x8b4bd1[_0xcb996e(0x2d0)]&&(_0x4c0ee0[_0xcb996e(0x2d0)]=_0x8b4bd1[_0xcb996e(0x2d0)]);if(_0x8b4bd1[_0xcb996e(0x281)])_0x4c0ee0[_0xcb996e(0x281)]=_0x8b4bd1['interval'];let _0x56b510;try{_0x56b510=await _0x4b4590[_0xcb996e(0x20f)][_0xcb996e(0x337)](_0x2b7d93,_0x4c0ee0),_0x3818e5[_0xcb996e(0x23a)]();}catch(_0x5442d8){_0x3818e5[_0xcb996e(0x23a)]();throw _0x5442d8;}const _0x4c9ac0=_0x8b4bd1[_0xcb996e(0x281)]||_0xcb996e(0x2cd);return this[_0xcb996e(0x27a)](_0x56b510,_0x4c0ee0,_0x5992d1,_0x4c9ac0),_0x56b510[_0xcb996e(0x21f)]?0x0:0x1;}['displayValidateResults'](_0x284d26,_0x4a97f5,_0x27f6b8,_0x73dcba){const _0x55b86a=a26_0x1c8851;console[_0x55b86a(0x1c8)]('\x0a'+a26_0x46f1ae['bold']('Validate:')+'\x20'+_0x284d26[_0x55b86a(0x2d9)]),console[_0x55b86a(0x1c8)]('═'['repeat'](0x3c)),this[_0x55b86a(0x2b2)](_0x284d26);if(typeof _0x4a97f5[_0x55b86a(0x2cb)]===_0x55b86a(0x2c9)){this[_0x55b86a(0x23c)](_0x284d26),this[_0x55b86a(0x21e)](_0x284d26),this[_0x55b86a(0x28e)](_0x27f6b8,_0x73dcba,_0x55b86a(0x2cb),_0x4a97f5['attribute']);return;}if(_0x4a97f5['attribute']===!![]){this[_0x55b86a(0x23c)](_0x284d26),this[_0x55b86a(0x21e)](_0x284d26),this['displayPreviewHints'](_0x27f6b8,_0x73dcba,'attributes');return;}if(typeof _0x4a97f5[_0x55b86a(0x2d0)]===_0x55b86a(0x2c9)){this[_0x55b86a(0x24b)](_0x284d26,_0x73dcba),this[_0x55b86a(0x21e)](_0x284d26),this[_0x55b86a(0x28e)](_0x27f6b8,_0x73dcba,_0x55b86a(0x2d0),_0x4a97f5[_0x55b86a(0x2d0)]);return;}if(_0x4a97f5[_0x55b86a(0x2d0)]===!![]){this['displayBehaviorsStats'](_0x284d26,_0x73dcba),this[_0x55b86a(0x21e)](_0x284d26),this[_0x55b86a(0x28e)](_0x27f6b8,_0x73dcba,_0x55b86a(0x1e0));return;}this[_0x55b86a(0x23c)](_0x284d26),this[_0x55b86a(0x24b)](_0x284d26,_0x73dcba),this[_0x55b86a(0x2ed)](_0x284d26),this[_0x55b86a(0x21e)](_0x284d26),this[_0x55b86a(0x28e)](_0x27f6b8,_0x73dcba,_0x55b86a(0x343));}[a26_0x1c8851(0x2ed)](_0x5cd541){displayRealtimeValidation(_0x5cd541);}['displayPreviewHints'](_0x31e8a8,_0x18a80e,_0x4fb257,_0x689cb1){const _0x3326a1=a26_0x1c8851;console[_0x3326a1(0x1c8)]('\x0a'+a26_0x46f1ae[_0x3326a1(0x288)](_0x3326a1(0x237)));const _0x348f37=_0x18a80e!==_0x3326a1(0x2cd)?_0x3326a1(0x1ea)+_0x18a80e:'';if(_0x4fb257===_0x3326a1(0x2cb)&&_0x689cb1)console[_0x3326a1(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x3326a1(0x288)]('tdx\x20ps\x20preview\x20'+_0x31e8a8+_0x3326a1(0x340)+_0x689cb1+'\x22'+_0x348f37));else{if(_0x4fb257===_0x3326a1(0x2d0)&&_0x689cb1)console[_0x3326a1(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x3326a1(0x288)](_0x3326a1(0x26d)+_0x31e8a8+_0x3326a1(0x1ec)+_0x689cb1+'\x22'+_0x348f37));else(_0x4fb257===_0x3326a1(0x2a6)||_0x4fb257===_0x3326a1(0x343))&&console['error']('\x20\x20'+a26_0x46f1ae[_0x3326a1(0x288)](_0x3326a1(0x26d)+_0x31e8a8+'\x20--attribute\x20\x22<name>\x22'+_0x348f37));}(_0x4fb257===_0x3326a1(0x1e0)||_0x4fb257===_0x3326a1(0x343))&&console[_0x3326a1(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x3326a1(0x288)](_0x3326a1(0x26d)+_0x31e8a8+'\x20--behavior\x20\x22<name>\x22'+_0x348f37)),_0x4fb257===_0x3326a1(0x343)&&console[_0x3326a1(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x3326a1(0x288)](_0x3326a1(0x26d)+_0x31e8a8+'\x20--enriched'+_0x348f37));}[a26_0x1c8851(0x2b2)](_0x12c23c){const _0x3bcd31=a26_0x1c8851,{master:_0x1be208}=_0x12c23c,_0x3b09dd=_0x1be208[_0x3bcd31(0x334)]?a26_0x46f1ae['green']('✔'):a26_0x46f1ae[_0x3bcd31(0x2c4)]('✘');console[_0x3bcd31(0x1c8)]('\x0a'+a26_0x46f1ae[_0x3bcd31(0x288)](_0x3bcd31(0x25d))),console[_0x3bcd31(0x1c8)](_0x3b09dd+'\x20'+a26_0x46f1ae[_0x3bcd31(0x2de)](_0x1be208[_0x3bcd31(0x282)]+'.'+_0x1be208[_0x3bcd31(0x2c6)])),_0x1be208['schemaValid']?_0x1be208['rowCount']!==undefined&&console['error']('\x20\x20'+a26_0x46f1ae[_0x3bcd31(0x288)](_0x3bcd31(0x323))+'\x20'+a26_0x46f1ae['cyan'](formatRows(_0x1be208[_0x3bcd31(0x1db)]))):console['error']('\x20\x20'+a26_0x46f1ae[_0x3bcd31(0x2c4)](_0x3bcd31(0x298))+'\x20'+_0x1be208['schemaError']);}[a26_0x1c8851(0x23c)](_0x28435b){const _0x4cf5cb=a26_0x1c8851;if(_0x28435b[_0x4cf5cb(0x2a6)][_0x4cf5cb(0x224)]===0x0)return;console['error']('\x0a'+a26_0x46f1ae['dim'](_0x4cf5cb(0x217)));for(const _0x29e189 of _0x28435b[_0x4cf5cb(0x2a6)]){const _0x27805e=_0x29e189[_0x4cf5cb(0x334)]?a26_0x46f1ae['green']('✔'):a26_0x46f1ae[_0x4cf5cb(0x2c4)]('✘');let _0x3790ba='';if(_0x29e189['schemaValid']&&_0x29e189['matchedCount']!==undefined&&_0x29e189[_0x4cf5cb(0x293)]!==undefined){const _0x3c93ab=_0x29e189[_0x4cf5cb(0x293)]['toFixed'](0x1),_0x159745=_0x29e189[_0x4cf5cb(0x293)]>=0x50?a26_0x46f1ae['green']:_0x29e189['coveragePercent']>=0x32?a26_0x46f1ae[_0x4cf5cb(0x268)]:a26_0x46f1ae[_0x4cf5cb(0x2c4)];_0x3790ba='\x20'+a26_0x46f1ae[_0x4cf5cb(0x288)](_0x4cf5cb(0x314))+'\x20'+_0x159745(_0x3c93ab+'%')+'\x20('+formatRows(_0x29e189[_0x4cf5cb(0x2a1)])+_0x4cf5cb(0x27f);}console[_0x4cf5cb(0x1c8)](_0x27805e+'\x20'+a26_0x46f1ae[_0x4cf5cb(0x2de)](_0x29e189[_0x4cf5cb(0x2d9)])+_0x3790ba),console[_0x4cf5cb(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x4cf5cb(0x288)](_0x4cf5cb(0x1f6))+'\x20'+a26_0x46f1ae[_0x4cf5cb(0x2de)](_0x29e189[_0x4cf5cb(0x282)]+'.'+_0x29e189[_0x4cf5cb(0x2c6)]));const _0x4683d4=_0x29e189[_0x4cf5cb(0x20d)]===_0x29e189[_0x4cf5cb(0x241)]?a26_0x46f1ae[_0x4cf5cb(0x288)](_0x4cf5cb(0x2a0))+'\x20'+_0x29e189[_0x4cf5cb(0x20d)]:a26_0x46f1ae['dim']('Join:')+'\x20'+_0x29e189[_0x4cf5cb(0x20d)]+'\x20=\x20'+_0x29e189[_0x4cf5cb(0x241)];console['error']('\x20\x20'+_0x4683d4),console[_0x4cf5cb(0x1c8)]('\x20\x20'+a26_0x46f1ae['dim']('Columns:')),this['displayColumns'](_0x29e189[_0x4cf5cb(0x306)]),!_0x29e189[_0x4cf5cb(0x334)]&&console[_0x4cf5cb(0x1c8)]('\x20\x20'+a26_0x46f1ae['red'](_0x4cf5cb(0x298))+'\x20'+_0x29e189['schemaError']);}}[a26_0x1c8851(0x24b)](_0x281497,_0x395d58){const _0x11411f=a26_0x1c8851;if(_0x281497[_0x11411f(0x1e0)][_0x11411f(0x224)]===0x0)return;console[_0x11411f(0x1c8)]('\x0a'+a26_0x46f1ae[_0x11411f(0x288)](_0x11411f(0x27e))+'\x20'+a26_0x46f1ae[_0x11411f(0x288)]('('+_0x395d58+')'));for(const _0x1ea95d of _0x281497[_0x11411f(0x1e0)]){const _0x3fcd88=_0x1ea95d['schemaValid']?a26_0x46f1ae[_0x11411f(0x1fe)]('✔'):a26_0x46f1ae[_0x11411f(0x2c4)]('✘');let _0x2e8818='';if(_0x1ea95d[_0x11411f(0x334)]&&_0x1ea95d['customersWithEvents']!==undefined&&_0x1ea95d[_0x11411f(0x2fa)]!==undefined){const _0x111f11=_0x1ea95d[_0x11411f(0x338)]?.[_0x11411f(0x20e)](0x1)||'?',_0x532de4=(_0x1ea95d[_0x11411f(0x338)]??0x0)>=0x32?a26_0x46f1ae['green']:(_0x1ea95d[_0x11411f(0x338)]??0x0)>=0x14?a26_0x46f1ae[_0x11411f(0x268)]:a26_0x46f1ae[_0x11411f(0x2c4)];_0x2e8818='\x20'+a26_0x46f1ae[_0x11411f(0x288)](_0x11411f(0x313))+'\x20'+_0x532de4(formatRows(_0x1ea95d['customersWithEvents']))+'\x20('+_0x111f11+_0x11411f(0x22c)+a26_0x46f1ae['dim'](_0x11411f(0x2df))+'\x20'+a26_0x46f1ae[_0x11411f(0x1d7)](formatRows(_0x1ea95d[_0x11411f(0x2fa)]));}console[_0x11411f(0x1c8)](_0x3fcd88+'\x20'+a26_0x46f1ae[_0x11411f(0x2de)](_0x1ea95d[_0x11411f(0x2d9)])+_0x2e8818),console[_0x11411f(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x11411f(0x288)]('Source:')+'\x20'+a26_0x46f1ae['bold'](_0x1ea95d[_0x11411f(0x282)]+'.'+_0x1ea95d[_0x11411f(0x2c6)]));const _0x5d6c25=_0x1ea95d[_0x11411f(0x20d)]===_0x1ea95d[_0x11411f(0x241)]?a26_0x46f1ae['dim'](_0x11411f(0x2a0))+'\x20'+_0x1ea95d[_0x11411f(0x20d)]:a26_0x46f1ae['dim'](_0x11411f(0x21a))+'\x20'+_0x1ea95d['joinKey']+_0x11411f(0x247)+_0x1ea95d[_0x11411f(0x241)];console[_0x11411f(0x1c8)]('\x20\x20'+_0x5d6c25),console[_0x11411f(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x11411f(0x288)](_0x11411f(0x23f))),this[_0x11411f(0x2b4)](_0x1ea95d[_0x11411f(0x306)]),!_0x1ea95d[_0x11411f(0x334)]&&console[_0x11411f(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x11411f(0x2c4)]('Error:')+'\x20'+_0x1ea95d[_0x11411f(0x20b)]);}}[a26_0x1c8851(0x2b4)](_0x51431a){const _0x2b9f69=a26_0x1c8851;for(const _0x6b0b6 of _0x51431a){_0x6b0b6[_0x2b9f69(0x2c5)]===_0x6b0b6[_0x2b9f69(0x1ca)]||_0x6b0b6[_0x2b9f69(0x1ca)]==='*'?console['error'](_0x2b9f69(0x2f1)+_0x6b0b6[_0x2b9f69(0x2c5)]):console[_0x2b9f69(0x1c8)](_0x2b9f69(0x2f1)+_0x6b0b6[_0x2b9f69(0x2c5)]+'\x20'+a26_0x46f1ae[_0x2b9f69(0x288)]('('+_0x6b0b6[_0x2b9f69(0x1ca)]+')'));}}[a26_0x1c8851(0x21e)](_0x1a93e7){const _0x19dfa2=a26_0x1c8851;console[_0x19dfa2(0x1c8)]('─'['repeat'](0x3c));if(_0x1a93e7['errors']['length']>0x0){console[_0x19dfa2(0x1c8)]('\x0a'+a26_0x46f1ae[_0x19dfa2(0x2c4)](_0x19dfa2(0x2c3)));for(const _0x459b37 of _0x1a93e7[_0x19dfa2(0x2f4)]){console[_0x19dfa2(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x19dfa2(0x2c4)]('•')+'\x20'+_0x459b37);}}_0x1a93e7[_0x19dfa2(0x21f)]&&console[_0x19dfa2(0x1c8)]('\x0a'+a26_0x46f1ae[_0x19dfa2(0x1fe)]('✔')+_0x19dfa2(0x2a3));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x2a7);[a26_0x1c8851(0x312)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a26_0x1c8851(0x2da)](_0x202468){const _0x4ad95f=a26_0x1c8851,{options:_0xc63505,args:_0x5416b6,tdx:_0x471ae0}=_0x202468,_0x402269=_0xc63505,_0x4eaa66=_0x5416b6[0x0]||_0xc63505[_0x4ad95f(0x32b)];if(!_0x4eaa66)return showParentSegmentNotSetError(_0x4ad95f(0x31e)+_0x4ad95f(0x2d5)+_0x4ad95f(0x2f7)+_0x4ad95f(0x25a)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x4ad95f(0x2e9)+_0x4ad95f(0x310)),0x1;if(!_0x402269[_0x4ad95f(0x1be)]&&!_0x402269[_0x4ad95f(0x2cb)]&&!_0x402269[_0x4ad95f(0x2d0)]&&!_0x402269[_0x4ad95f(0x240)])return console[_0x4ad95f(0x1c8)](a26_0x46f1ae['red'](_0x4ad95f(0x31b))),console[_0x4ad95f(0x1c8)](_0x4ad95f(0x2e3)),console[_0x4ad95f(0x1c8)](_0x4ad95f(0x349)),console['error'](_0x4ad95f(0x1e7)),console[_0x4ad95f(0x1c8)](_0x4ad95f(0x320)),console[_0x4ad95f(0x1c8)](_0x4ad95f(0x1de)),console[_0x4ad95f(0x1c8)](_0x4ad95f(0x2db)),0x1;const _0x2d86a5=resolveYamlFile(_0x4eaa66);if(!existsSync(_0x2d86a5))return showFileNotFoundError(_0x2d86a5,_0x4eaa66),0x1;_0x402269[_0x4ad95f(0x220)]&&(console[_0x4ad95f(0x1c8)](_0x4ad95f(0x2fd)+_0x402269[_0x4ad95f(0x322)]),console['error'](_0x4ad95f(0x205)+_0x2d86a5));let _0x3b79e8;try{_0x3b79e8=readFileSync(_0x2d86a5,_0x4ad95f(0x1ba));}catch(_0x3fb0a6){const _0x50f2b0=_0x3fb0a6 instanceof Error?_0x3fb0a6[_0x4ad95f(0x29b)]:String(_0x3fb0a6);return console[_0x4ad95f(0x1c8)](_0x4ad95f(0x33c)+_0x50f2b0),0x1;}let _0x432364;try{_0x432364=parseDef(_0x3b79e8);}catch(_0x37c7b8){const _0x1ab8ea=_0x37c7b8 instanceof Error?_0x37c7b8[_0x4ad95f(0x29b)]:String(_0x37c7b8);return console[_0x4ad95f(0x1c8)](a26_0x46f1ae[_0x4ad95f(0x2c4)](_0x4ad95f(0x2ee)+_0x1ab8ea)),0x1;}if(_0x402269[_0x4ad95f(0x2cb)]===!![]||_0x402269['attribute']===''){const _0xe8df7c=_0x432364[_0x4ad95f(0x2a6)]?.[_0x4ad95f(0x21c)](_0x5b5596=>_0x5b5596['name'])||[];if(_0xe8df7c[_0x4ad95f(0x224)]===0x0)console[_0x4ad95f(0x1c8)](a26_0x46f1ae[_0x4ad95f(0x2c4)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x4ad95f(0x1c8)](a26_0x46f1ae[_0x4ad95f(0x2c4)](_0x4ad95f(0x227))),console[_0x4ad95f(0x1c8)]('Available\x20attributes:');for(const _0x2dfbc8 of _0xe8df7c){console['error']('\x20\x20'+a26_0x46f1ae[_0x4ad95f(0x1d7)](_0x2dfbc8));}console[_0x4ad95f(0x1c8)](_0x4ad95f(0x204)+_0x4eaa66+'\x20--attribute\x20\x22'+_0xe8df7c[0x0]+'\x22');}return 0x1;}if(_0x402269['behavior']===!![]||_0x402269[_0x4ad95f(0x2d0)]===''){const _0x230bbc=_0x432364[_0x4ad95f(0x1e0)]?.[_0x4ad95f(0x21c)](_0x2b2b14=>_0x2b2b14[_0x4ad95f(0x2d9)])||[];if(_0x230bbc[_0x4ad95f(0x224)]===0x0)console['error'](a26_0x46f1ae[_0x4ad95f(0x2c4)](_0x4ad95f(0x1ef)));else{console[_0x4ad95f(0x1c8)](a26_0x46f1ae[_0x4ad95f(0x2c4)](_0x4ad95f(0x2c1))),console[_0x4ad95f(0x1c8)](_0x4ad95f(0x252));for(const _0x223cc6 of _0x230bbc){console[_0x4ad95f(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x4ad95f(0x1d7)](_0x223cc6));}console[_0x4ad95f(0x1c8)](_0x4ad95f(0x204)+_0x4eaa66+_0x4ad95f(0x1ec)+_0x230bbc[0x0]+'\x22');}return 0x1;}const _0x21bd72=createCommandSpinner(a26_0x46f1ae[_0x4ad95f(0x288)](_0x4ad95f(0x261)),{'verbose':_0x402269[_0x4ad95f(0x220)]});_0x21bd72[_0x4ad95f(0x243)]();const _0x32b2ca={'onProgress':_0x21e138=>{const _0x52e9c8=_0x4ad95f;_0x21bd72[_0x52e9c8(0x33d)]=formatProgressMessage(_0x21e138);}};if(_0x402269[_0x4ad95f(0x1be)])_0x32b2ca[_0x4ad95f(0x1be)]=!![];if(_0x402269['attribute']&&typeof _0x402269[_0x4ad95f(0x2cb)]==='string')_0x32b2ca[_0x4ad95f(0x2cb)]=_0x402269[_0x4ad95f(0x2cb)];if(_0x402269[_0x4ad95f(0x2d0)]&&typeof _0x402269['behavior']===_0x4ad95f(0x2c9))_0x32b2ca[_0x4ad95f(0x2d0)]=_0x402269[_0x4ad95f(0x2d0)];if(_0x402269[_0x4ad95f(0x240)])_0x32b2ca[_0x4ad95f(0x240)]=!![];if(_0x402269['interval'])_0x32b2ca[_0x4ad95f(0x281)]=_0x402269[_0x4ad95f(0x281)];let _0x46ab4f;try{_0x46ab4f=await _0x471ae0[_0x4ad95f(0x20f)]['previewParentYaml'](_0x3b79e8,_0x32b2ca),_0x21bd72[_0x4ad95f(0x23a)]();}catch(_0x1024f0){_0x21bd72[_0x4ad95f(0x23a)]();throw _0x1024f0;}return await this[_0x4ad95f(0x2f2)](_0x46ab4f,{'master':_0x402269[_0x4ad95f(0x1be)],'attribute':typeof _0x402269['attribute']===_0x4ad95f(0x2c9)?_0x402269['attribute']:undefined,'behavior':typeof _0x402269[_0x4ad95f(0x2d0)]==='string'?_0x402269[_0x4ad95f(0x2d0)]:undefined,'enriched':_0x402269['enriched']}),_0x46ab4f[_0x4ad95f(0x21f)]?0x0:0x1;}async[a26_0x1c8851(0x2f2)](_0x144a10,_0xf34765){const _0x4881b4=a26_0x1c8851;console['error']('\x0a'+a26_0x46f1ae['bold'](_0x4881b4(0x2b1))+'\x20'+_0x144a10[_0x4881b4(0x2d9)]),console[_0x4881b4(0x1c8)]('═'['repeat'](0x3c));if(_0xf34765[_0x4881b4(0x1be)]&&_0x144a10['sampleData']){const _0x5ac598=a26_0x46f1ae[_0x4881b4(0x288)](_0x4881b4(0x239))+'\x20'+a26_0x46f1ae['bold'](_0x144a10[_0x4881b4(0x1be)]['database']+'.'+_0x144a10[_0x4881b4(0x1be)][_0x4881b4(0x2c6)]);await this[_0x4881b4(0x260)](_0x5ac598,_0x144a10[_0x4881b4(0x1c5)]);}else{if(_0xf34765[_0x4881b4(0x2cb)]&&_0x144a10[_0x4881b4(0x1c5)]){const _0x29334f=a26_0x46f1ae['dim'](_0x4881b4(0x236))+'\x20'+a26_0x46f1ae[_0x4881b4(0x2de)](_0xf34765[_0x4881b4(0x2cb)]);await this[_0x4881b4(0x260)](_0x29334f,_0x144a10['sampleData']);}else{if(_0xf34765[_0x4881b4(0x2d0)]&&_0x144a10[_0x4881b4(0x1c5)]){const _0x4a8c24=a26_0x46f1ae['dim'](_0x4881b4(0x21b))+'\x20'+a26_0x46f1ae[_0x4881b4(0x2de)](_0xf34765[_0x4881b4(0x2d0)]);await this[_0x4881b4(0x260)](_0x4a8c24,_0x144a10[_0x4881b4(0x1c5)]);}else{if(_0xf34765[_0x4881b4(0x240)]&&_0x144a10[_0x4881b4(0x1c5)]){const _0x3a82dc=a26_0x46f1ae[_0x4881b4(0x288)]('Enriched:')+'\x20'+a26_0x46f1ae['bold'](_0x4881b4(0x304));await this[_0x4881b4(0x260)](_0x3a82dc,_0x144a10[_0x4881b4(0x1c5)]);}else!_0x144a10[_0x4881b4(0x1c5)]&&console[_0x4881b4(0x1c8)](_0x4881b4(0x2b8));}}}if(_0x144a10[_0x4881b4(0x2f4)][_0x4881b4(0x224)]>0x0){console[_0x4881b4(0x1c8)]('─'['repeat'](0x3c)),console[_0x4881b4(0x1c8)]('\x0a'+a26_0x46f1ae[_0x4881b4(0x2c4)](_0x4881b4(0x2c3)));for(const _0x156885 of _0x144a10[_0x4881b4(0x2f4)]){console[_0x4881b4(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x4881b4(0x2c4)]('•')+'\x20'+_0x156885);}}}async['displaySampleData'](_0x40703a,_0x499dca){const _0x5e7108=a26_0x1c8851;if(_0x499dca[_0x5e7108(0x224)]===0x0){console['error']('\x0a'+_0x40703a),console[_0x5e7108(0x1c8)]('\x20\x20No\x20sample\x20data\x20available');return;}console['error']('\x0a'+_0x40703a);const _0x576498=Object[_0x5e7108(0x1fa)](_0x499dca[0x0])[_0x5e7108(0x21c)](_0x10b900=>({'name':_0x10b900,'type':typeof _0x499dca[0x0][_0x10b900]===_0x5e7108(0x20c)?_0x5e7108(0x265):_0x5e7108(0x2c8)})),_0x3b3259={'queryId':_0x5e7108(0x1d3),'columns':_0x576498,'data':_0x499dca,'stats':{'state':_0x5e7108(0x29c),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x499dca[_0x5e7108(0x224)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x572649=formatAsTable(_0x3b3259,_0x499dca[_0x5e7108(0x224)],!![]);await writeOutput(_0x572649,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a26_0x1c8851(0x1f1);[a26_0x1c8851(0x312)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a26_0x1c8851(0x2da)](_0x26cd6e){const _0x292502=a26_0x1c8851,{options:_0x254b50,args:_0x28223b,tdx:_0x33fdf0}=_0x26cd6e,_0x533297=_0x254b50,_0xcae527=_0x28223b[0x0]||_0x254b50[_0x292502(0x32b)];if(!_0xcae527)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x292502(0x228)),0x1;const _0x43ce43=resolveYamlFile(_0xcae527);if(existsSync(_0x43ce43)){_0x533297[_0x292502(0x220)]&&console['error'](_0x292502(0x336)+_0x43ce43);let _0x42008c;try{_0x42008c=readFileSync(_0x43ce43,'utf-8');}catch(_0x446ea4){const _0x1ac782=_0x446ea4 instanceof Error?_0x446ea4[_0x292502(0x29b)]:String(_0x446ea4);return console[_0x292502(0x1c8)](_0x292502(0x33c)+_0x1ac782),0x1;}const _0x1dcddd=await withSpinner(_0x292502(0x2f5),()=>_0x33fdf0[_0x292502(0x20f)][_0x292502(0x291)](_0x42008c),{'verbose':_0x533297[_0x292502(0x220)]}),_0x3c0c4a=_0x1dcddd['data'],{isNew:_0x3d5cb0,name:_0x34c7ca,hasChanges:_0xda1aa1,diffFormatted:_0x276a07}=_0x3c0c4a;if(_0xda1aa1){_0x3d5cb0?console[_0x292502(0x1c8)](_0x292502(0x299)+_0x34c7ca+'\x27:'):console[_0x292502(0x1c8)](_0x292502(0x1f4)+_0x34c7ca+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x276a07),console['error']('─'[_0x292502(0x221)](0x3c));const _0x5e7c2b=_0x3d5cb0?_0x292502(0x2a8)+_0x34c7ca+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x34c7ca+_0x292502(0x256);if(!_0x533297[_0x292502(0x216)]){if(!isInteractive())return console['error'](a26_0x46f1ae[_0x292502(0x2c4)]('\x0aError:'),_0x292502(0x264)),console[_0x292502(0x1c8)](a26_0x46f1ae[_0x292502(0x288)](_0x292502(0x258))),0x1;const _0x4002f7=await confirmKey(_0x5e7c2b);if(!_0x4002f7)return console[_0x292502(0x1c8)](a26_0x46f1ae[_0x292502(0x268)]('Aborted.')),0x1;}const _0x24f58b=_0x3d5cb0?_0x292502(0x1c3):_0x292502(0x23d);await withSpinner(_0x24f58b+_0x292502(0x324)+_0x34c7ca+_0x292502(0x2b3),()=>_0x3c0c4a[_0x292502(0x2d4)](),{'verbose':_0x533297[_0x292502(0x220)]});const _0x3d6931=_0x3d5cb0?_0x292502(0x2e7):_0x292502(0x25f);console[_0x292502(0x1c8)]('✔\x20'+_0x3d6931+'\x20parent\x20segment\x20\x27'+_0x34c7ca+'\x27');}else console[_0x292502(0x1c8)](_0x292502(0x1e2)+_0x34c7ca+_0x292502(0x1f0));}const _0x3094a8=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0xcae527+_0x292502(0x2b3),()=>_0x33fdf0[_0x292502(0x20f)]['runParent'](_0xcae527),{'verbose':_0x533297[_0x292502(0x220)]}),_0x176c3f=_0x3094a8[_0x292502(0x302)],_0x1bd5c3=getConsoleUrl(_0x533297['site'],_0x292502(0x2d6)+_0x176c3f[_0x292502(0x307)]+_0x292502(0x32e)+_0x176c3f[_0x292502(0x2fc)]+_0x292502(0x1cc)+_0x176c3f['workflowAttemptId']);return console[_0x292502(0x1c8)]('\x0a✔\x20Workflow\x20started'),console[_0x292502(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x292502(0x288)](_0x292502(0x1d0))+'\x20'+_0x176c3f[_0x292502(0x27b)]),console[_0x292502(0x1c8)]('\x20\x20'+a26_0x46f1ae['dim'](_0x292502(0x1c1))+'\x20'+_0x176c3f[_0x292502(0x211)]),console[_0x292502(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x292502(0x288)](_0x292502(0x2dd))+'\x20'+_0x176c3f[_0x292502(0x2fc)]),console[_0x292502(0x1c8)]('\x20\x20'+a26_0x46f1ae[_0x292502(0x288)]('Attempt:')+'\x20'+_0x176c3f[_0x292502(0x2b6)]),console['error']('\x20\x20'+_0x1bd5c3),console[_0x292502(0x1c8)]('\x0a'+a26_0x46f1ae[_0x292502(0x288)](_0x292502(0x330))+_0x292502(0x2f8)+_0x176c3f['workflowAttemptId']+_0x292502(0x1ff)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a26_0x1c8851(0x312)]=a26_0x1c8851(0x206);async[a26_0x1c8851(0x2da)](_0x237a22){const _0x4831c4=a26_0x1c8851,{options:_0x6b215c,args:_0x549232,tdx:_0x3e6867}=_0x237a22,_0x4396d1=_0x549232[0x0]||_0x6b215c[_0x4831c4(0x32b)];if(!_0x4396d1)return showParentSegmentNotSetError(_0x4831c4(0x27d)+_0x4831c4(0x1f9)),0x1;_0x6b215c[_0x4831c4(0x220)]&&(console[_0x4831c4(0x1c8)](_0x4831c4(0x2fd)+_0x6b215c[_0x4831c4(0x322)]),console['error'](_0x4831c4(0x1f5)+_0x4396d1));const _0x2e9fbd=await withSpinner(_0x4831c4(0x1bf)+_0x4396d1+_0x4831c4(0x2b3),()=>_0x3e6867[_0x4831c4(0x20f)][_0x4831c4(0x214)](_0x4396d1),{'verbose':_0x6b215c[_0x4831c4(0x220)]}),_0x3a00b5=_0x2e9fbd[_0x4831c4(0x302)];console[_0x4831c4(0x1c8)](_0x4831c4(0x30a)+_0x3a00b5['length']+'\x20field'+(_0x3a00b5[_0x4831c4(0x224)]!==0x1?'s':''));if(_0x6b215c[_0x4831c4(0x1c6)]||_0x6b215c['jsonl'])return await handleSDKOutput(_0x3a00b5,_0x6b215c),0x0;return displayFieldsHumanReadable(_0x3a00b5,_0x4396d1),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x24f);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x31a);async[a26_0x1c8851(0x2da)](_0x33b00d){const _0x274013=a26_0x1c8851,{options:_0x11ef66,args:_0x42866e,tdx:_0x124d4a}=_0x33b00d,_0x3e3c79=_0x11ef66,_0x14aa3c=_0x42866e[0x0]||_0x11ef66['parentSegment'];if(!_0x14aa3c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x274013(0x347)+_0x274013(0x325)),0x1;_0x11ef66[_0x274013(0x220)]&&(console[_0x274013(0x1c8)](_0x274013(0x2fd)+_0x11ef66[_0x274013(0x322)]),console[_0x274013(0x1c8)](_0x274013(0x1f5)+_0x14aa3c));const _0x4534f3=await withSpinner(_0x274013(0x346)+_0x14aa3c+_0x274013(0x2b3),()=>_0x124d4a[_0x274013(0x20f)][_0x274013(0x2f3)](_0x14aa3c),{'verbose':_0x11ef66['verbose']}),_0x27c967=_0x4534f3[_0x274013(0x302)];if(_0x3e3c79['web']){const _0x14dfb8=getConsoleNextUrl(_0x3e3c79[_0x274013(0x322)],_0x274013(0x1c7)+_0x27c967['id']);return console[_0x274013(0x1c8)](a26_0x46f1ae[_0x274013(0x1fe)]('✔')+_0x274013(0x279)+a26_0x46f1ae['cyan'](_0x14dfb8)),openBrowser(_0x14dfb8),0x0;}return await handleSingleObjectOutput(_0x27c967,_0x11ef66),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a26_0x1c8851(0x329);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x345);async[a26_0x1c8851(0x2da)](_0x2ad65d){const _0x51c3a9=a26_0x1c8851,{options:_0x36d818,args:_0x200f5f,tdx:_0x21bfcc}=_0x2ad65d,_0x27efdf=_0x36d818,_0x410027=_0x200f5f[0x0]||_0x36d818[_0x51c3a9(0x32b)];if(!_0x410027)return showParentSegmentNotSetError(_0x51c3a9(0x23b)+_0x51c3a9(0x222)+_0x51c3a9(0x347)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x36d818['verbose']&&(console[_0x51c3a9(0x1c8)]('Site:\x20'+_0x36d818['site']),console[_0x51c3a9(0x1c8)]('Parent\x20segment:\x20'+_0x410027));const _0x1c9b3d=await withSpinner(_0x51c3a9(0x2af)+_0x410027+'\x27...',()=>_0x21bfcc[_0x51c3a9(0x20f)]['resolveParentId'](_0x410027),{'verbose':_0x36d818[_0x51c3a9(0x220)]}),_0x6652e1=_0x1c9b3d['data'],_0x18c35c=_0x21bfcc[_0x51c3a9(0x20f)][_0x51c3a9(0x1e6)](_0x6652e1);if(_0x27efdf['output']){const _0x42d443=await this[_0x51c3a9(0x25c)](_0x2ad65d,_0x410027,_0x6652e1,_0x18c35c),_0x153144=this[_0x51c3a9(0x286)](_0x42d443);writeFileSync(_0x27efdf[_0x51c3a9(0x1fd)],_0x153144);const _0x19bacc=_0x42d443[_0x51c3a9(0x2e4)][_0x51c3a9(0x306)][_0x51c3a9(0x224)]+_0x42d443[_0x51c3a9(0x1e0)][_0x51c3a9(0x26e)]((_0x451f08,_0x465c7e)=>_0x451f08+_0x465c7e[_0x51c3a9(0x306)][_0x51c3a9(0x224)],0x0),_0x28e3fb=_0x42d443[_0x51c3a9(0x1e0)]['filter'](_0x1acaee=>_0x1acaee[_0x51c3a9(0x306)][_0x51c3a9(0x224)]===0x0)[_0x51c3a9(0x224)];return console[_0x51c3a9(0x2bb)]('Schema\x20saved\x20to\x20'+_0x27efdf['output']),console['log'](_0x51c3a9(0x25b)+_0x18c35c),console[_0x51c3a9(0x2bb)](_0x51c3a9(0x238)+_0x42d443['behaviors'][_0x51c3a9(0x224)]+_0x51c3a9(0x26f)),console[_0x51c3a9(0x2bb)]('\x20\x20Columns:\x20'+_0x19bacc+_0x51c3a9(0x1ee)),_0x28e3fb>0x0&&console[_0x51c3a9(0x2bb)](_0x51c3a9(0x272)+_0x28e3fb+_0x51c3a9(0x31f)),0x0;}console['error']('\x0a'+a26_0x46f1ae['bold'](_0x51c3a9(0x309))+'\x20'+a26_0x46f1ae['cyan'](_0x18c35c));const _0xc8f3aa=await withSpinner(_0x51c3a9(0x28a),()=>_0x21bfcc[_0x51c3a9(0x20f)][_0x51c3a9(0x1d8)](_0x6652e1),{'verbose':_0x36d818['verbose']});console[_0x51c3a9(0x1c8)]('\x0a'+a26_0x46f1ae[_0x51c3a9(0x2de)](_0x51c3a9(0x2e4))+'\x20'+a26_0x46f1ae[_0x51c3a9(0x288)]('('+_0x18c35c+_0x51c3a9(0x207)));const _0x279f8c=await executeSchemaQuery(_0xc8f3aa[_0x51c3a9(0x302)],_0x21bfcc,_0x36d818);await handleQueryOutput(_0x279f8c,_0x36d818);const _0x3e0951=await withSpinner(_0x51c3a9(0x28b),()=>_0x21bfcc['segment']['getBehaviorNames'](_0x6652e1),{'verbose':_0x36d818[_0x51c3a9(0x220)]});for(const _0x52edf3 of _0x3e0951[_0x51c3a9(0x302)]){const _0x3d0a77=_0x51c3a9(0x28c)+_0x52edf3[_0x51c3a9(0x275)]()[_0x51c3a9(0x233)](/\s+/g,'_'),_0x3baa50=_0x51c3a9(0x29f)+_0x18c35c+'.'+_0x3d0a77;console[_0x51c3a9(0x1c8)]('\x0a'+a26_0x46f1ae[_0x51c3a9(0x2de)](_0x52edf3)+'\x20'+a26_0x46f1ae[_0x51c3a9(0x288)]('('+_0x18c35c+'.'+_0x3d0a77+')'));try{const _0x3b09a8=await executeSchemaQuery(_0x3baa50,_0x21bfcc,_0x36d818);await handleQueryOutput(_0x3b09a8,_0x36d818);}catch{console[_0x51c3a9(0x1c8)](a26_0x46f1ae['yellow'](_0x51c3a9(0x1ce)));}}return 0x0;}async[a26_0x1c8851(0x25c)](_0x5f40ad,_0x4ab595,_0x1861e9,_0x2b5461){const _0x249d63=a26_0x1c8851,{options:_0x603d8a,tdx:_0x47b9c1}=_0x5f40ad,_0x1db664=await withSpinner(_0x249d63(0x28a),()=>_0x47b9c1[_0x249d63(0x20f)][_0x249d63(0x1d8)](_0x1861e9),{'verbose':_0x603d8a[_0x249d63(0x220)]}),_0x51c5c6=await executeSchemaQuery(_0x1db664['data'],_0x47b9c1,_0x603d8a),_0x285172=_0x51c5c6[_0x249d63(0x302)][_0x249d63(0x21c)](_0x4b7b48=>({'name':_0x4b7b48['column_name'],'type':_0x4b7b48[_0x249d63(0x2aa)]})),_0x2c282e=await withSpinner(_0x249d63(0x28b),()=>_0x47b9c1['segment'][_0x249d63(0x2bc)](_0x1861e9),{'verbose':_0x603d8a[_0x249d63(0x220)]}),_0x409adf=[];for(const _0x35c91a of _0x2c282e[_0x249d63(0x302)]){const _0x20fea0=_0x249d63(0x28c)+_0x35c91a['toLowerCase']()[_0x249d63(0x233)](/\s+/g,'_'),_0x41e86b='SELECT\x20*\x20FROM\x20'+_0x2b5461+'.'+_0x20fea0;let _0x171500=[];try{const _0x43664c=await executeSchemaQuery(_0x41e86b,_0x47b9c1,_0x603d8a);_0x171500=_0x43664c[_0x249d63(0x302)][_0x249d63(0x21c)](_0x287aeb=>({'name':_0x287aeb[_0x249d63(0x277)],'type':_0x287aeb[_0x249d63(0x2aa)]}));}catch{}_0x409adf[_0x249d63(0x1d4)]({'table':_0x20fea0,'columns':_0x171500});}return{'database':_0x2b5461,'parent_segment':_0x4ab595,'parent_id':_0x1861e9,'customers':{'table':'customers','columns':_0x285172},'behaviors':_0x409adf};}[a26_0x1c8851(0x286)](_0x23df55){const _0x5e310f=a26_0x1c8851,_0x50a898=_0x73c74=>{const _0x1ee2b6=a26_0x17d9;if(_0x73c74[_0x1ee2b6(0x224)]===0x0)return'[]';const _0x2aa43a=_0x73c74[_0x1ee2b6(0x21c)](_0x804bbd=>_0x1ee2b6(0x296)+_0x804bbd[_0x1ee2b6(0x2d9)]+_0x1ee2b6(0x327)+_0x804bbd[_0x1ee2b6(0x210)]+_0x1ee2b6(0x1e5));return'[\x0a'+_0x2aa43a[_0x1ee2b6(0x1e4)](',\x0a')+_0x1ee2b6(0x1d1);},_0x2ed4c7=_0x23df55['behaviors']['map'](_0x4e3218=>{const _0x5065bc=a26_0x17d9;return _0x5065bc(0x22d)+_0x4e3218[_0x5065bc(0x2c6)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x50a898(_0x4e3218[_0x5065bc(0x306)])[_0x5065bc(0x233)](/^/gm,'\x20\x20')[_0x5065bc(0x26b)]()+'\x0a\x20\x20\x20\x20}';})[_0x5e310f(0x1e4)](',\x0a');return _0x5e310f(0x246)+_0x23df55[_0x5e310f(0x282)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x23df55[_0x5e310f(0x303)]+_0x5e310f(0x2fb)+_0x23df55['parent_id']+_0x5e310f(0x2d8)+_0x23df55['customers'][_0x5e310f(0x2c6)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x50a898(_0x23df55[_0x5e310f(0x2e4)][_0x5e310f(0x306)])['replace'](/^/gm,'\x20\x20')[_0x5e310f(0x26b)]()+_0x5e310f(0x212)+_0x2ed4c7+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a26_0x1c8851(0x28f);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x2d2);async[a26_0x1c8851(0x2da)](_0x28379d){const _0x599d14=a26_0x1c8851,{options:_0x18f4c9,args:_0x458f05,tdx:_0x5afc79}=_0x28379d,_0x518f47=_0x458f05[0x0]||_0x18f4c9[_0x599d14(0x32b)];if(!_0x518f47)return showParentSegmentNotSetError(_0x599d14(0x209)+_0x599d14(0x200)),0x1;_0x18f4c9[_0x599d14(0x220)]&&(console[_0x599d14(0x1c8)]('Site:\x20'+_0x18f4c9['site']),console[_0x599d14(0x1c8)](_0x599d14(0x1f5)+_0x518f47));const _0x462ee3=await withSpinner(_0x599d14(0x2af)+_0x518f47+'\x27...',()=>_0x5afc79['segment'][_0x599d14(0x23e)](_0x518f47),{'verbose':_0x18f4c9['verbose']}),_0x4f42df=_0x462ee3[_0x599d14(0x302)],_0x342cf2=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x518f47+_0x599d14(0x2b3),()=>_0x5afc79[_0x599d14(0x20f)][_0x599d14(0x1d8)](_0x4f42df),{'verbose':_0x18f4c9[_0x599d14(0x220)]}),_0x6534e7=_0x342cf2['data'];return _0x18f4c9[_0x599d14(0x301)]===_0x599d14(0x1c6)||_0x18f4c9['format']===_0x599d14(0x305)?await handleSDKOutput([{'sql':_0x6534e7}],_0x18f4c9):console[_0x599d14(0x2bb)](_0x6534e7),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x218);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x28d);async[a26_0x1c8851(0x2da)](_0x4fa70d){const _0x151675=a26_0x1c8851,{options:_0x246f35,args:_0x22ea68,tdx:_0x61d4bf}=_0x4fa70d,_0x5d7a7d=_0x22ea68[0x0]||_0x246f35[_0x151675(0x32b)];if(!_0x5d7a7d)return showParentSegmentNotSetError(_0x151675(0x269)+_0x151675(0x30c)),0x1;_0x246f35['verbose']&&(console[_0x151675(0x1c8)]('Site:\x20'+_0x246f35[_0x151675(0x322)]),console[_0x151675(0x1c8)]('Parent\x20segment:\x20'+_0x5d7a7d));const _0x5c6e3e=await withSpinner(_0x151675(0x2af)+_0x5d7a7d+_0x151675(0x2b3),()=>_0x61d4bf[_0x151675(0x20f)][_0x151675(0x23e)](_0x5d7a7d),{'verbose':_0x246f35['verbose']}),_0x360e42=_0x5c6e3e[_0x151675(0x302)],_0x255b09=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5d7a7d+_0x151675(0x2b3),()=>_0x61d4bf[_0x151675(0x20f)]['getParentSQL'](_0x360e42),{'verbose':_0x246f35['verbose']});let _0x3be42f=_0x255b09[_0x151675(0x302)];const _0x1508a6=resolveLimit(_0x246f35[_0x151675(0x24a)],DEFAULT_DISPLAY_LIMIT),_0xb6da9f=/\bLIMIT\s+\d+/i['test'](_0x3be42f);!_0xb6da9f&&(_0x3be42f=_0x3be42f[_0x151675(0x26b)]()[_0x151675(0x233)](/;+$/,''),_0x3be42f=_0x151675(0x318)+_0x3be42f+_0x151675(0x21d)+_0x1508a6);_0x246f35['verbose']&&console[_0x151675(0x1c8)](_0x151675(0x328)+_0x3be42f);const _0x413d45=await withProgressSpinner(_0x151675(0x2cf),async _0x59ea33=>{const _0x5c2a90=_0x151675,_0x1788bd=await _0x61d4bf[_0x5c2a90(0x2be)][_0x5c2a90(0x2da)](_0x3be42f,{'catalog':'td','schema':_0x5c2a90(0x285),'onJobId':_0x73627=>{const _0xc71743=_0x5c2a90;_0x59ea33[_0xc71743(0x29a)](_0x73627);}});return _0x1788bd;},{'verbose':_0x246f35[_0x151675(0x220)]}),_0x470240=_0x413d45[_0x151675(0x302)],_0x55ccef=_0x470240[_0x151675(0x276)]?_0x151675(0x22e)+_0x470240[_0x151675(0x276)]+']':'';return console[_0x151675(0x1c8)](_0x151675(0x1fb)+_0x470240[_0x151675(0x26c)][_0x151675(0x342)]['toLocaleString']()+_0x151675(0x2eb)+(_0x151675(0x1d5)+formatElapsed(_0x470240[_0x151675(0x26c)][_0x151675(0x208)])+_0x55ccef)),await handleQueryOutput(_0x470240,_0x246f35),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a26_0x1c8851(0x2e1);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x251);async[a26_0x1c8851(0x2da)](_0x1e9735){const _0x5ba205=a26_0x1c8851,{options:_0x540365,args:_0x7bdaf3,tdx:_0xac56d}=_0x1e9735,_0x7b2c0e=_0x7bdaf3[0x0],_0x935e0f=await withSpinner(_0x7b2c0e?_0x5ba205(0x295)+_0x7b2c0e+_0x5ba205(0x2b3):_0x5ba205(0x229),()=>_0xac56d[_0x5ba205(0x2a9)][_0x5ba205(0x2a4)](),{'verbose':_0x540365[_0x5ba205(0x220)]});let _0x5e9be3=_0x935e0f['data'][_0x5ba205(0x1dd)](_0x458596=>_0x458596[_0x5ba205(0x25e)]);if(_0x7b2c0e){const _0x42062d=_0x7b2c0e[_0x5ba205(0x233)](/[.+^${}()|[\]\\]/g,_0x5ba205(0x242))['replace'](/\*/g,'.*')[_0x5ba205(0x233)](/\?/g,'.'),_0x5d65e4=new RegExp('^'+_0x42062d+'$','i');_0x5e9be3=_0x5e9be3[_0x5ba205(0x1dd)](_0x4c7883=>_0x5d65e4[_0x5ba205(0x1fc)](_0x4c7883[_0x5ba205(0x2d9)]));}_0x5e9be3[_0x5ba205(0x1c0)]((_0x339f11,_0x3de6b3)=>_0x339f11[_0x5ba205(0x2d9)][_0x5ba205(0x253)](_0x3de6b3['name'])),console['error'](_0x5ba205(0x30a)+_0x5e9be3[_0x5ba205(0x224)]+'\x20RT-enabled\x20parent\x20segment'+(_0x5e9be3[_0x5ba205(0x224)]!==0x1?'s':''));const _0x1f950f=_0x2bfc5f=>{const _0x85e011=_0x5ba205;return getConsoleNextUrl(_0x540365[_0x85e011(0x322)],_0x85e011(0x1c7)+_0x2bfc5f);};if(_0x540365[_0x5ba205(0x301)]===_0x5ba205(0x1c6)||_0x540365[_0x5ba205(0x301)]===_0x5ba205(0x305)){const _0x350d34=_0x5e9be3[_0x5ba205(0x21c)](_0x170a08=>({..._0x170a08,'url':_0x1f950f(_0x170a08['id'])}));await handleSDKOutput(_0x350d34,_0x540365);}else{if(_0x5e9be3[_0x5ba205(0x224)]===0x0)console[_0x5ba205(0x2bb)](_0x5ba205(0x2e2));else for(const _0x2b4513 of _0x5e9be3){const _0x4ce618=_0x2b4513['population']?a26_0x46f1ae['dim']('\x20('+formatRows(_0x2b4513[_0x5ba205(0x290)])+')'):'',_0x4bfd29=hyperlink(_0x2b4513[_0x5ba205(0x2d9)],_0x1f950f(_0x2b4513['id']));console[_0x5ba205(0x2bb)]('⚡\x20'+_0x4bfd29+_0x4ce618);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x1c8851(0x2d9)]=a26_0x1c8851(0x2d1);[a26_0x1c8851(0x312)]=a26_0x1c8851(0x1da);async['execute'](_0x1fd27d){const _0x2c461d=a26_0x1c8851,{options:_0xf49b06,args:_0x3fb653,tdx:_0x40a153}=_0x1fd27d,_0x25471d=_0x3fb653[0x0]||_0xf49b06['parentSegment'];if(!_0x25471d)return showParentSegmentNotSetError(_0x2c461d(0x248)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x17acdf=resolveYamlFile(_0x25471d);if(!existsSync(_0x17acdf))return showFileNotFoundError(_0x17acdf,_0x25471d),0x1;let _0x1feaa8;try{_0x1feaa8=readFileSync(_0x17acdf,_0x2c461d(0x1ba));}catch(_0x3e21df){const _0x75a990=_0x3e21df instanceof Error?_0x3e21df[_0x2c461d(0x29b)]:String(_0x3e21df);return console[_0x2c461d(0x1c8)]('Error\x20reading\x20file:\x20'+_0x75a990),0x1;}const _0x43ba2b=createCommandSpinner(a26_0x46f1ae[_0x2c461d(0x288)]('Validating\x20RT\x20configuration...'),{'verbose':_0xf49b06[_0x2c461d(0x220)]});_0x43ba2b[_0x2c461d(0x243)]();const _0x4a92f5={'realtime':!![],'onProgress':_0x2435f7=>{const _0x1bbd68=_0x2c461d;_0x43ba2b[_0x1bbd68(0x33d)]=formatProgressMessage(_0x2435f7);}};let _0x3eafa1;try{_0x3eafa1=await _0x40a153[_0x2c461d(0x20f)][_0x2c461d(0x337)](_0x1feaa8,_0x4a92f5),_0x43ba2b[_0x2c461d(0x23a)]();}catch(_0x1f0448){_0x43ba2b[_0x2c461d(0x23a)]();throw _0x1f0448;}console[_0x2c461d(0x1c8)]('\x0a'+a26_0x46f1ae[_0x2c461d(0x2de)](_0x2c461d(0x316))+'\x20'+_0x3eafa1['name']),console[_0x2c461d(0x1c8)]('═'[_0x2c461d(0x221)](0x3c)),displayRealtimeValidation(_0x3eafa1),console['error']('─'[_0x2c461d(0x221)](0x3c));if(_0x3eafa1['errors'][_0x2c461d(0x224)]>0x0){console['error']('\x0a'+a26_0x46f1ae['red'](_0x2c461d(0x2c3)));for(const _0x52a896 of _0x3eafa1['errors']){console['error']('\x20\x20'+a26_0x46f1ae[_0x2c461d(0x2c4)]('•')+'\x20'+_0x52a896);}}return _0x3eafa1[_0x2c461d(0x21f)]&&console['error']('\x0a'+a26_0x46f1ae[_0x2c461d(0x1fe)]('✔')+_0x2c461d(0x33b)),_0x3eafa1[_0x2c461d(0x21f)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x1c8851(0x2d9)]='ps:pz:list';['description']='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a26_0x1c8851(0x2da)](_0x441df6){const _0x24552b=a26_0x1c8851,{options:_0x41cae4,args:_0x81a1f3,tdx:_0x11bee2}=_0x441df6,_0x172f47=_0x81a1f3[0x0]||_0x41cae4[_0x24552b(0x32b)];if(!_0x172f47)return showParentSegmentNotSetError(_0x24552b(0x257)+_0x24552b(0x24c)),0x1;const _0x428f8f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x172f47+_0x24552b(0x2b3),()=>_0x11bee2[_0x24552b(0x20f)][_0x24552b(0x23e)](_0x172f47),{'verbose':_0x41cae4[_0x24552b(0x220)]}),_0x2db7b4=_0x428f8f[_0x24552b(0x302)],_0x309a94=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x172f47+_0x24552b(0x2b3),()=>_0x11bee2[_0x24552b(0x2ef)][_0x24552b(0x2a4)](_0x2db7b4),{'verbose':_0x41cae4['verbose']}),_0x15a283=_0x309a94[_0x24552b(0x302)];console['error'](_0x24552b(0x30a)+_0x15a283[_0x24552b(0x224)]+_0x24552b(0x2b5)+(_0x15a283[_0x24552b(0x224)]!==0x1?'s':''));if(_0x41cae4[_0x24552b(0x301)]==='json'||_0x41cae4['format']===_0x24552b(0x305))await handleSDKOutput(_0x15a283,_0x41cae4);else{if(_0x15a283[_0x24552b(0x224)]===0x0)console[_0x24552b(0x2bb)](_0x24552b(0x33e)),console[_0x24552b(0x1c8)](a26_0x46f1ae[_0x24552b(0x1d7)](_0x24552b(0x203)));else for(const _0x16dfd8 of _0x15a283){const _0x49323e=_0x16dfd8[_0x24552b(0x2cc)]?.[_0x24552b(0x224)]||0x0,_0x1bd450=_0x16dfd8[_0x24552b(0x249)]?a26_0x46f1ae[_0x24552b(0x288)](_0x24552b(0x2a2)+_0x16dfd8[_0x24552b(0x249)]):'',_0x1895ed=a26_0x46f1ae[_0x24552b(0x288)]('\x20('+_0x49323e+_0x24552b(0x274)+(_0x49323e!==0x1?'s':'')+')');console[_0x24552b(0x2bb)]('\x20\x20'+_0x16dfd8[_0x24552b(0x2d9)]+_0x1bd450+_0x1895ed),_0x16dfd8[_0x24552b(0x312)]&&console[_0x24552b(0x2bb)](_0x24552b(0x31d)+a26_0x46f1ae[_0x24552b(0x288)](_0x16dfd8['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a26_0x1c8851(0x331);['description']='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async[a26_0x1c8851(0x2da)](_0x53fcca){const _0x15a82a=a26_0x1c8851,{options:_0x5dccee,args:_0x2bcd21}=_0x53fcca,_0x4b3bb4=_0x2bcd21[0x0]||_0x5dccee[_0x15a82a(0x32b)];if(!_0x4b3bb4)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a'+_0x15a82a(0x1d6)),0x1;const _0x297a61=resolveYamlFile(_0x4b3bb4);if(!existsSync(_0x297a61))return showFileNotFoundError(_0x297a61,_0x4b3bb4),0x1;let _0x21178c;try{_0x21178c=readFileSync(_0x297a61,_0x15a82a(0x1ba));}catch(_0x5ddeac){const _0x3be70f=_0x5ddeac instanceof Error?_0x5ddeac[_0x15a82a(0x29b)]:String(_0x5ddeac);return console[_0x15a82a(0x1c8)](_0x15a82a(0x33c)+_0x3be70f),0x1;}let _0xc5bf2a;try{_0xc5bf2a=parseDef(_0x21178c);}catch(_0x48e602){const _0x1c2302=_0x48e602 instanceof Error?_0x48e602[_0x15a82a(0x29b)]:String(_0x48e602);return console[_0x15a82a(0x1c8)](a26_0x46f1ae[_0x15a82a(0x2c4)](_0x15a82a(0x2ee)+_0x1c2302)),0x1;}if(_0xc5bf2a[_0x15a82a(0x2b0)]&&_0xc5bf2a[_0x15a82a(0x2b0)][_0x15a82a(0x224)]>0x0)return console[_0x15a82a(0x1c8)](a26_0x46f1ae[_0x15a82a(0x268)](_0x15a82a(0x29d)+_0x297a61)),console[_0x15a82a(0x1c8)](a26_0x46f1ae[_0x15a82a(0x288)](_0x15a82a(0x1d9)+_0xc5bf2a[_0x15a82a(0x2b0)][_0x15a82a(0x224)]+'\x20service(s)\x20configured')),0x1;!_0xc5bf2a[_0x15a82a(0x2a9)]&&(_0xc5bf2a['realtime']={'events':[{'name':_0x15a82a(0x2ca),'source_table':_0x15a82a(0x32a)}],'attributes':[{'name':_0x15a82a(0x326),'type':_0x15a82a(0x20a)}],'id_stitching':{'primary_key':_0xc5bf2a[_0x15a82a(0x1be)][_0x15a82a(0x2c6)]===_0x15a82a(0x2e4)?_0x15a82a(0x1e1):_0x15a82a(0x1bb)}});_0xc5bf2a[_0x15a82a(0x2b0)]=[{'name':'My\x20Service','description':_0x15a82a(0x2b9),'trigger_event':_0x15a82a(0x2ca),'sections':[{'name':_0x15a82a(0x2f9),'criteria':'true','attributes':[_0x15a82a(0x326)]}]}];const _0x45ebd1=serializeDef(_0xc5bf2a);return writeFileSync(_0x297a61,_0x45ebd1,_0x15a82a(0x1ba)),console[_0x15a82a(0x1c8)](a26_0x46f1ae[_0x15a82a(0x1fe)]('✔')+_0x15a82a(0x2ac)+a26_0x46f1ae['cyan'](_0x297a61)),(!_0xc5bf2a[_0x15a82a(0x2a9)]||_0x21178c[_0x15a82a(0x335)](_0x15a82a(0x2bd))===-0x1)&&console[_0x15a82a(0x1c8)](a26_0x46f1ae['green']('✔')+_0x15a82a(0x339)),console[_0x15a82a(0x1c8)]('\x0a'+a26_0x46f1ae[_0x15a82a(0x288)]('Next\x20steps:')),console[_0x15a82a(0x1c8)](_0x15a82a(0x297)+_0x297a61+_0x15a82a(0x1c4)),console[_0x15a82a(0x1c8)]('\x20\x202.\x20Run\x20'+a26_0x46f1ae[_0x15a82a(0x288)](_0x15a82a(0x1eb)+_0x4b3bb4)+_0x15a82a(0x254)),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_0x2f68cf=a27_0x34ef;(function(_0x5e6c6a,_0x4db62d){const _0x7c232e=a27_0x34ef,_0x37d73d=_0x5e6c6a();while(!![]){try{const _0xf7fbf0=parseInt(_0x7c232e(0x1da))/0x1+-parseInt(_0x7c232e(0x1f4))/0x2*(parseInt(_0x7c232e(0x23c))/0x3)+-parseInt(_0x7c232e(0x22f))/0x4*(parseInt(_0x7c232e(0x22e))/0x5)+parseInt(_0x7c232e(0x1e7))/0x6+-parseInt(_0x7c232e(0x1e0))/0x7*(parseInt(_0x7c232e(0x1cd))/0x8)+parseInt(_0x7c232e(0x208))/0x9*(parseInt(_0x7c232e(0x1d5))/0xa)+parseInt(_0x7c232e(0x23b))/0xb;if(_0xf7fbf0===_0x4db62d)break;else _0x37d73d['push'](_0x37d73d['shift']());}catch(_0x55c5a0){_0x37d73d['push'](_0x37d73d['shift']());}}}(a27_0x4fe3,0x9fa77));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a27_0x34ef(_0x19abbd,_0x42ea22){_0x19abbd=_0x19abbd-0x1ca;const _0x4fe31b=a27_0x4fe3();let _0x34ef0c=_0x4fe31b[_0x19abbd];return _0x34ef0c;}import{getConfigDir}from'../core/config.js';import*as a27_0x109e64 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0xc68f7d from'prompts';import a27_0x10431f from'chalk';function a27_0x4fe3(){const _0x1a123a=['llm_agent','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>','confirm','/app/mp/ak','validate','status','email','Profile\x20name\x20cannot\x20be\x20empty','split','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x0aSetup\x20cancelled','\x27\x20updated:\x20','Failed\x20to\x20remove\x20profile:\x20','\x20\x20tdx\x20--profile\x20','Set\x20session\x20profile','warn','test','\x27.\x0a\x0aValid\x20keys:\x20','Enter\x20your\x20TD\x20API\x20key:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','API\x20key\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','text','customSite','415MdiUFO','13472jOIsZZ','profile:set','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.','\x20Profile\x20\x27','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Session\x20profile\x20set\x20to:\x20','parent_segment','yellow','profileName','44715GKpXIE','153CJyFBl','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Site\x20name\x20cannot\x20be\x20empty','Set\x20a\x20profile\x20configuration\x20value','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','105064zSAFYU','join','password','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Default\x20profile\x20set\x20to:\x20','session','✗\x20Validation\x20failed:\x20','30990PYmakA','(cleared)','\x20\x20-\x20','us01','message','743248YEpCeY','Validating\x20API\x20key...','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Remove\x20a\x20profile','getUserInfo','tdx:\x20profile\x20set','553taFlGR','\x0aOperation\x20cancelled','length','apiKey','bold','Enter\x20profile\x20name:','trim','7245030SsnFQy','description','\x0aSaved\x20to:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','(session:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20removed\x20from\x20configuration','Site\x20was\x20not\x20changed.','logLevel','default','Operation\x20cancelled','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','7022TKhVAB','red','\x0aAvailable\x20profiles:','\x20--default\x27\x20to\x20save\x20permanently','\x20\x20(no\x20profiles\x20found)','profile:remove','Profile\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','tdx:\x20profile\x20create','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','log','site','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','VALID_KEYS','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','execute','llm_project','tdx.json','jobs','create','567KiuRuK','config','green','includes','\x27\x20created','database','Enter\x20site\x20name:','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','name','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','error','Create\x20a\x20new\x20profile','profile','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'];a27_0x4fe3=function(){return _0x1a123a;};return a27_0x4fe3();}function validateProfileName(_0x4339d1){const _0x25987d=a27_0x34ef;if(!_0x4339d1||!_0x4339d1[_0x25987d(0x1e6)]())return _0x25987d(0x21d);const _0x2e1cb9=_0x4339d1[_0x25987d(0x1e6)]();if(!/^[a-zA-Z0-9_-]+$/[_0x25987d(0x226)](_0x2e1cb9))return _0x25987d(0x200);if(profileExists(_0x2e1cb9))return _0x25987d(0x1fa)+_0x2e1cb9+_0x25987d(0x202);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a27_0x2f68cf(0x1e8)]=a27_0x2f68cf(0x213);async[a27_0x2f68cf(0x203)](_0x8d93b5){const _0x48b2a0=a27_0x2f68cf,{options:_0xd626aa,args:_0x36bdbc}=_0x8d93b5;console['log'](a27_0x10431f[_0x48b2a0(0x1e4)](_0x48b2a0(0x1fc)));let _0x182e0e;if(_0x36bdbc[_0x48b2a0(0x1e2)]>0x0&&_0x36bdbc[0x0]){const _0x53c96f=_0x36bdbc[0x0][_0x48b2a0(0x1e6)](),_0x40f524=validateProfileName(_0x53c96f);if(_0x40f524!==!![])return console[_0x48b2a0(0x212)](a27_0x10431f[_0x48b2a0(0x1f5)](_0x40f524)),0x1;_0x182e0e=_0x53c96f;}else{const _0x14d37e=await a27_0xc68f7d({'type':_0x48b2a0(0x22c),'name':_0x48b2a0(0x23a),'message':_0x48b2a0(0x1e5),'validate':validateProfileName});if(!_0x14d37e['profileName'])return console[_0x48b2a0(0x1fe)](_0x48b2a0(0x220)),0x1;_0x182e0e=_0x14d37e[_0x48b2a0(0x23a)][_0x48b2a0(0x1e6)]();}const _0x4240b2=await a27_0xc68f7d({'type':'text','name':_0x48b2a0(0x1e8),'message':'Enter\x20description\x20(optional):'}),_0x35539c=_0x4240b2['description']?.[_0x48b2a0(0x1e6)]()||undefined,_0x35f088=_0xd626aa['site']||_0x48b2a0(0x1d8),{choices:_0x360d29,initialIndex:_0x5a3897}=buildSiteChoices(_0x35f088),_0x1559df=await a27_0xc68f7d({'type':'select','name':_0x48b2a0(0x1ff),'message':_0x48b2a0(0x1d0)+_0x182e0e+'\x27:','choices':_0x360d29,'initial':_0x5a3897});if(!_0x1559df[_0x48b2a0(0x1ff)])return console[_0x48b2a0(0x1fe)](_0x48b2a0(0x220)),0x1;let _0x5583bd;if(_0x1559df[_0x48b2a0(0x1ff)]==='other'){const _0x3fd0ce=await a27_0xc68f7d({'type':_0x48b2a0(0x22c),'name':_0x48b2a0(0x22d),'message':_0x48b2a0(0x20e),'initial':'us01','validate':_0x23e9fe=>{const _0x1ae4a0=_0x48b2a0;if(!_0x23e9fe||!_0x23e9fe[_0x1ae4a0(0x1e6)]())return _0x1ae4a0(0x1ca);if(!/^[a-z0-9-]+$/[_0x1ae4a0(0x226)](_0x23e9fe[_0x1ae4a0(0x1e6)]()))return _0x1ae4a0(0x20f);return!![];}});if(!_0x3fd0ce[_0x48b2a0(0x22d)])return console[_0x48b2a0(0x1fe)]('\x0aSetup\x20cancelled'),0x1;_0x5583bd=_0x3fd0ce[_0x48b2a0(0x22d)];}else _0x5583bd=_0x1559df['site'];const _0x24f65f=resolveSite(_0x5583bd);console['log'](_0x48b2a0(0x21f)+_0x24f65f),console[_0x48b2a0(0x1fe)](_0x48b2a0(0x231)),console['log']('\x20\x20'+getConsoleUrl(_0x24f65f,_0x48b2a0(0x219)));const _0x253df2=await a27_0xc68f7d({'type':_0x48b2a0(0x1cf),'name':'apiKey','message':_0x48b2a0(0x228),'validate':_0x448973=>{const _0x266829=_0x48b2a0;if(!_0x448973||!_0x448973[_0x266829(0x1e6)]())return _0x266829(0x22a);return!![];}});if(!_0x253df2['apiKey'])return console[_0x48b2a0(0x1fe)](_0x48b2a0(0x220)),0x1;const _0x401962=_0x253df2[_0x48b2a0(0x1e3)];console['log'](_0x48b2a0(0x1db));try{const _0xb1c9db=TDX['create']({'site':_0x24f65f,'apiKey':_0x401962[_0x48b2a0(0x1e6)](),'logLevel':_0xd626aa[_0x48b2a0(0x1f0)]??LogLevel['ERROR']}),_0x39d81a=await _0xb1c9db['jobs'][_0x48b2a0(0x1de)]();console['log'](a27_0x10431f['green']('✓')+_0x48b2a0(0x1ed)+_0x39d81a['email']+')');const _0x1cca43=await isKeychainAvailable();_0x1cca43?(await saveAPIKeyAsync(_0x401962[_0x48b2a0(0x1e6)](),_0x24f65f,_0x182e0e),console[_0x48b2a0(0x1fe)](a27_0x10431f[_0x48b2a0(0x20a)]('✓')+_0x48b2a0(0x23e)+_0x182e0e+')')):(console[_0x48b2a0(0x225)](a27_0x10431f[_0x48b2a0(0x239)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a27_0x10431f[_0x48b2a0(0x239)](_0x48b2a0(0x1f3))));const _0x171033={'site':_0x24f65f,..._0x35539c&&{'description':_0x35539c}};return saveProfileToUserConfig(_0x182e0e,_0x171033),console[_0x48b2a0(0x1fe)](a27_0x10431f[_0x48b2a0(0x20a)]('✓')+_0x48b2a0(0x233)+_0x182e0e+_0x48b2a0(0x20c)),console['log'](),console[_0x48b2a0(0x1fe)](_0x48b2a0(0x215)),console[_0x48b2a0(0x1fe)](_0x48b2a0(0x223)+_0x182e0e+_0x48b2a0(0x1fd)),console[_0x48b2a0(0x1fe)](_0x48b2a0(0x223)+_0x182e0e+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0xc71f26){if(_0xc71f26 instanceof HTTPClientError&&_0xc71f26[_0x48b2a0(0x21b)]===0x191)return printAuthError(_0xc71f26),0x1;return console[_0x48b2a0(0x212)](a27_0x10431f[_0x48b2a0(0x1f5)](_0x48b2a0(0x1d4)+(_0xc71f26 instanceof Error?_0xc71f26[_0x48b2a0(0x1d9)]:String(_0xc71f26)))),console['error'](_0x48b2a0(0x211)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x2f68cf(0x210)]=a27_0x2f68cf(0x1f9);[a27_0x2f68cf(0x1e8)]=a27_0x2f68cf(0x1dd);[a27_0x2f68cf(0x21a)](_0x5d499e){const _0x184d79=a27_0x2f68cf,{args:_0x5a0d33}=_0x5d499e;if(_0x5a0d33[_0x184d79(0x1e2)]===0x0)return _0x184d79(0x1ec);return undefined;}async[a27_0x2f68cf(0x203)](_0x22a0ff){const _0x1310f8=a27_0x2f68cf,{args:_0x12dc24}=_0x22a0ff,_0x3349bc=_0x12dc24[0x0];console[_0x1310f8(0x1fe)](a27_0x10431f[_0x1310f8(0x1e4)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x3349bc)){console[_0x1310f8(0x212)](a27_0x10431f['red'](_0x1310f8(0x1fa)+_0x3349bc+_0x1310f8(0x232))),console[_0x1310f8(0x1fe)](_0x1310f8(0x1f6));const _0xfdb626=listProfiles();if(_0xfdb626['length']===0x0)console[_0x1310f8(0x1fe)](_0x1310f8(0x1f8));else for(const _0x426926 of _0xfdb626){console[_0x1310f8(0x1fe)](_0x1310f8(0x1d7)+_0x426926['name']);}return 0x1;}const _0x56f84e=await a27_0xc68f7d({'type':_0x1310f8(0x218),'name':_0x1310f8(0x218),'message':_0x1310f8(0x1fb)+_0x3349bc+'\x27?','initial':![]});if(!_0x56f84e['confirm'])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x3349bc),console[_0x1310f8(0x1fe)](a27_0x10431f[_0x1310f8(0x20a)]('✓')+_0x1310f8(0x233)+_0x3349bc+_0x1310f8(0x1ee));}catch(_0x1e5fc8){return console[_0x1310f8(0x212)](a27_0x10431f[_0x1310f8(0x1f5)](_0x1310f8(0x222)+(_0x1e5fc8 instanceof Error?_0x1e5fc8['message']:String(_0x1e5fc8)))),0x1;}const _0x2f6fa6=await isKeychainAvailable();if(_0x2f6fa6){const _0x31281b=await deleteKeychainAPIKey(_0x3349bc);_0x31281b&&console['log'](a27_0x10431f[_0x1310f8(0x20a)]('✓')+_0x1310f8(0x236));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x2f68cf(0x210)]=a27_0x2f68cf(0x230);[a27_0x2f68cf(0x1e8)]=a27_0x2f68cf(0x1cb);static [a27_0x2f68cf(0x201)]=[a27_0x2f68cf(0x1ff),a27_0x2f68cf(0x20d),a27_0x2f68cf(0x238),a27_0x2f68cf(0x204),a27_0x2f68cf(0x216),a27_0x2f68cf(0x1e8)];[a27_0x2f68cf(0x21a)](_0x5ae41e){const _0x1d1d4c=a27_0x2f68cf,{args:_0x2d950a,options:_0x550e02}=_0x5ae41e,_0x134fac=_0x550e02[_0x1d1d4c(0x214)]||getActiveProfile();if(!_0x134fac)return _0x1d1d4c(0x217);if(_0x2d950a[_0x1d1d4c(0x1e2)]===0x0)return _0x1d1d4c(0x23d)+ProfileSetCommand[_0x1d1d4c(0x201)][_0x1d1d4c(0x1ce)](',\x20');const _0x6f1a7c=_0x2d950a[0x0];if(!_0x6f1a7c['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1d1d4c(0x201)][_0x1d1d4c(0x1ce)](',\x20');const [_0x4e322a]=_0x6f1a7c[_0x1d1d4c(0x21e)]('=',0x2);if(!ProfileSetCommand[_0x1d1d4c(0x201)][_0x1d1d4c(0x20b)](_0x4e322a))return'Unknown\x20key\x20\x27'+_0x4e322a+_0x1d1d4c(0x227)+ProfileSetCommand['VALID_KEYS'][_0x1d1d4c(0x1ce)](',\x20');return undefined;}async[a27_0x2f68cf(0x203)](_0x52c58a){const _0xad8fb4=a27_0x2f68cf,{args:_0x525ebb,options:_0x3970bb}=_0x52c58a,_0x28d267=_0x3970bb[_0xad8fb4(0x214)]||getActiveProfile(),[_0x1be421,..._0x3ae4b2]=_0x525ebb[0x0][_0xad8fb4(0x21e)]('='),_0x1246e8=_0x3ae4b2[_0xad8fb4(0x1ce)]('=');console[_0xad8fb4(0x1fe)](a27_0x10431f[_0xad8fb4(0x1e4)](_0xad8fb4(0x1df)));if(!profileExists(_0x28d267)){const _0x2b7185=await a27_0xc68f7d({'type':_0xad8fb4(0x218),'name':_0xad8fb4(0x207),'message':_0xad8fb4(0x1fa)+_0x28d267+_0xad8fb4(0x229),'initial':!![]});if(!_0x2b7185['create'])return console[_0xad8fb4(0x1fe)](_0xad8fb4(0x1f2)),0x1;}const _0xf0739f=loadProfile(_0x28d267),_0x338e63=_0xf0739f?.[_0xad8fb4(0x209)]||{};if(_0x1be421==='site'){const _0x4369d6=resolveSite(_0x1246e8);console[_0xad8fb4(0x1fe)]('Changing\x20site\x20to\x20\x27'+_0x4369d6+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0xad8fb4(0x1dc)),console[_0xad8fb4(0x1fe)]('\x20\x20'+getConsoleUrl(_0x4369d6,_0xad8fb4(0x219)));const _0x2cb413=await a27_0xc68f7d({'type':_0xad8fb4(0x1cf),'name':_0xad8fb4(0x1e3),'message':_0xad8fb4(0x1cc),'validate':_0x492a84=>{const _0x164e61=_0xad8fb4;if(!_0x492a84||!_0x492a84[_0x164e61(0x1e6)]())return _0x164e61(0x22a);return!![];}});if(!_0x2cb413[_0xad8fb4(0x1e3)])return console['log'](_0xad8fb4(0x1e1)),0x1;console[_0xad8fb4(0x1fe)](_0xad8fb4(0x1db));try{const _0x3911ac=TDX[_0xad8fb4(0x207)]({'site':_0x4369d6,'apiKey':_0x2cb413['apiKey']['trim'](),'logLevel':_0x3970bb[_0xad8fb4(0x1f0)]??LogLevel['ERROR']}),_0x5bb9d3=await _0x3911ac[_0xad8fb4(0x206)][_0xad8fb4(0x1de)]();console['log'](a27_0x10431f[_0xad8fb4(0x20a)]('✓')+_0xad8fb4(0x1ed)+_0x5bb9d3[_0xad8fb4(0x21c)]+')');const _0xb9ab7f=await isKeychainAvailable();_0xb9ab7f?(await saveAPIKeyAsync(_0x2cb413[_0xad8fb4(0x1e3)][_0xad8fb4(0x1e6)](),_0x4369d6,_0x28d267),console[_0xad8fb4(0x1fe)](a27_0x10431f[_0xad8fb4(0x20a)]('✓')+_0xad8fb4(0x235))):console[_0xad8fb4(0x225)](a27_0x10431f[_0xad8fb4(0x239)](_0xad8fb4(0x22b))),_0x338e63[_0xad8fb4(0x1ff)]=_0x4369d6;}catch(_0x3bcd8a){if(_0x3bcd8a instanceof HTTPClientError&&_0x3bcd8a[_0xad8fb4(0x21b)]===0x191)return printAuthError(_0x3bcd8a),0x1;return console[_0xad8fb4(0x212)](a27_0x10431f['red']('✗\x20Validation\x20failed:\x20'+(_0x3bcd8a instanceof Error?_0x3bcd8a['message']:String(_0x3bcd8a)))),console[_0xad8fb4(0x212)](_0xad8fb4(0x1ef)),0x1;}}else _0x338e63[_0x1be421]=_0x1246e8||undefined;return saveProfileToUserConfig(_0x28d267,_0x338e63),console[_0xad8fb4(0x1fe)](a27_0x10431f[_0xad8fb4(0x20a)]('✓')+_0xad8fb4(0x233)+_0x28d267+_0xad8fb4(0x221)+_0x1be421+'='+(_0x1246e8||_0xad8fb4(0x1d6))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x2f68cf(0x210)]='profile:use';[a27_0x2f68cf(0x1e8)]=a27_0x2f68cf(0x224);[a27_0x2f68cf(0x21a)](_0x223f21){const _0x497fdc=a27_0x2f68cf,{args:_0x13be01}=_0x223f21;if(_0x13be01[_0x497fdc(0x1e2)]===0x0)return _0x497fdc(0x1d1);return undefined;}async[a27_0x2f68cf(0x203)](_0x22e713){const _0x5737d7=a27_0x2f68cf,{args:_0x551999,options:_0x12d277}=_0x22e713,_0x322c4d=_0x551999[0x0],_0x4f4a58=_0x12d277[_0x5737d7(0x1f1)];cleanExpiredSessions();if(!profileExists(_0x322c4d)){console['error'](a27_0x10431f[_0x5737d7(0x1f5)](_0x5737d7(0x1fa)+_0x322c4d+_0x5737d7(0x232))),console[_0x5737d7(0x1fe)](_0x5737d7(0x1f6));const _0x651dd1=listProfiles();if(_0x651dd1['length']===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x4da689 of _0x651dd1){console[_0x5737d7(0x1fe)](_0x5737d7(0x1d7)+_0x4da689[_0x5737d7(0x210)]);}return 0x1;}if(_0x4f4a58){const _0x50baf6=a27_0x109e64['join'](getConfigDir(),_0x5737d7(0x205));return saveActiveProfileToUserConfig(_0x322c4d),console[_0x5737d7(0x1fe)](_0x5737d7(0x1d2)+a27_0x10431f[_0x5737d7(0x20a)](_0x322c4d)),console[_0x5737d7(0x1fe)](a27_0x10431f[_0x5737d7(0x234)](_0x5737d7(0x1e9)+_0x50baf6)),0x0;}const _0x285ea3=getSessionID(_0x12d277[_0x5737d7(0x1d3)]);return saveSessionContext({'profile':_0x322c4d},_0x12d277[_0x5737d7(0x1d3)]),console[_0x5737d7(0x1fe)](_0x5737d7(0x237)+a27_0x10431f[_0x5737d7(0x20a)](_0x322c4d)+'\x20'+a27_0x10431f['dim'](_0x5737d7(0x1eb)+_0x285ea3+')')),console[_0x5737d7(0x1fe)](a27_0x10431f[_0x5737d7(0x234)](_0x5737d7(0x1ea)+_0x322c4d+_0x5737d7(0x1f7))),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_0x411f7f=a28_0x2645;(function(_0x13f27f,_0x30a810){const _0x4191b4=a28_0x2645,_0x3b747c=_0x13f27f();while(!![]){try{const _0x489bc3=parseInt(_0x4191b4(0x1b3))/0x1*(-parseInt(_0x4191b4(0x1b8))/0x2)+parseInt(_0x4191b4(0x1af))/0x3*(parseInt(_0x4191b4(0x1be))/0x4)+parseInt(_0x4191b4(0x1b2))/0x5*(-parseInt(_0x4191b4(0x1b9))/0x6)+-parseInt(_0x4191b4(0x1b6))/0x7+parseInt(_0x4191b4(0x1bf))/0x8+parseInt(_0x4191b4(0x1b1))/0x9+parseInt(_0x4191b4(0x1c3))/0xa;if(_0x489bc3===_0x30a810)break;else _0x3b747c['push'](_0x3b747c['shift']());}catch(_0x19ef9f){_0x3b747c['push'](_0x3b747c['shift']());}}}(a28_0x3178,0x394a6));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x411f7f(0x1c0)]='profiles';['description']=a28_0x411f7f(0x1b7);async[a28_0x411f7f(0x1bc)](_0x395b72){const _0x4d97ea=a28_0x411f7f,{options:_0xe885a5}=_0x395b72;try{const _0x340e8b=listProfiles(),_0x1c9dfb=getActiveProfile();if(_0x340e8b[_0x4d97ea(0x1ba)]===0x0)return console['log'](_0x4d97ea(0x1b5)),console[_0x4d97ea(0x1c2)](_0x4d97ea(0x1b4)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x27ae33=_0x340e8b[_0x4d97ea(0x1c1)](_0x1424fc=>{const _0x4f236d=_0x4d97ea,_0x954b5=_0x1424fc[_0x4f236d(0x1c0)]===_0x1c9dfb,_0xc66805=getProfileParams(_0x1424fc[_0x4f236d(0x1b0)]);return{'name':_0x1424fc[_0x4f236d(0x1c0)],'active':_0x954b5,'scope':_0x1424fc[_0x4f236d(0x1bb)],'description':_0x1424fc[_0x4f236d(0x1b0)][_0x4f236d(0x1ad)]||'','params':_0xc66805};});return await handleSDKOutput(_0x27ae33,_0xe885a5),0x0;}catch(_0x5c2708){return _0x5c2708 instanceof Error&&console[_0x4d97ea(0x1bd)]('Error:\x20'+_0x5c2708[_0x4d97ea(0x1ae)]),0x1;}}}function a28_0x2645(_0x3634d5,_0x26752f){_0x3634d5=_0x3634d5-0x1ad;const _0x3178a9=a28_0x3178();let _0x2645f4=_0x3178a9[_0x3634d5];return _0x2645f4;}function a28_0x3178(){const _0x12d9a0=['List\x20all\x20available\x20profiles','6488CNDUaI','2121318JHjJwP','length','scope','execute','error','1356704tyLOtX','2681168Axlefy','name','map','log','2456880lsAudu','description','message','3pTvaLM','config','2174364lGoimp','5XGJusr','126RXLkzt','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','1152529fTcbhG'];a28_0x3178=function(){return _0x12d9a0;};return a28_0x3178();}
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_0x484e2d=a29_0x33cc;(function(_0x541979,_0x32ebfb){const _0x291daa=a29_0x33cc,_0x497d0e=_0x541979();while(!![]){try{const _0x420f33=parseInt(_0x291daa(0xf9))/0x1+-parseInt(_0x291daa(0xdf))/0x2*(-parseInt(_0x291daa(0xdb))/0x3)+parseInt(_0x291daa(0xcb))/0x4*(-parseInt(_0x291daa(0xdd))/0x5)+-parseInt(_0x291daa(0xf2))/0x6+parseInt(_0x291daa(0xe6))/0x7+parseInt(_0x291daa(0xe0))/0x8+parseInt(_0x291daa(0xef))/0x9*(parseInt(_0x291daa(0xe9))/0xa);if(_0x420f33===_0x32ebfb)break;else _0x497d0e['push'](_0x497d0e['shift']());}catch(_0x380a9c){_0x497d0e['push'](_0x497d0e['shift']());}}}(a29_0x4388,0x4feef));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_0x4388(){const _0x2a4feb=['message','2360778jXkvrM','Catalog:\x20','\x0aAll\x20results\x20saved\x20to\x20','catalog','Site:\x20','setPhase','...','54004XPxpqJ','file','setJobId','Error:\x20','elapsedTimeMillis','1206532noMGrC','query','SQL:\x20','Statement\x20','completedSplits','\x20splits','options','args','push','error','Schema:\x20','Executing\x20statement\x20','execute','Run\x20Trino\x20queries\x20(streaming)','in\x20','output','30KDVHdP','verbose','5TOFraM','name','8850zmqNsF','2279632MPDmBr','Executing\x20query...','jobId','Executing\x20query\x20[','totalSplits','state','3824926ZOaLSa','originalMessage','\x20[Job\x20ID:\x20','10ImmraN','\x20-\x20','stats','setExtra','length','\x20rows\x20','835893aXZeCa','database'];a29_0x4388=function(){return _0x2a4feb;};return a29_0x4388();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a29_0x33cc(_0x58b7f9,_0x3de4f5){_0x58b7f9=_0x58b7f9-0xcb;const _0x43884b=a29_0x4388();let _0x33ccf4=_0x43884b[_0x58b7f9];return _0x33ccf4;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x484e2d(0xde)]=a29_0x484e2d(0xcc);['description']=a29_0x484e2d(0xd8);async[a29_0x484e2d(0xd7)](_0x345772){const _0x5416c1=a29_0x484e2d,{options:_0x2c3e72,args:_0x4a2c63,tdx:_0x48d0c3}=_0x345772,_0x58142c=_0x4a2c63[0x0],_0x460956=_0x2c3e72[_0x5416c1(0xfa)];let _0x23d416;try{if(_0x460956)_0x23d416=readSqlStatementsFromFile(_0x460956);else{if(_0x58142c==='-')_0x23d416=await readSqlStatementsFromStdin();else{if(_0x58142c&&isSqlFilePath(_0x58142c))_0x23d416=readSqlStatementsFromFile(_0x58142c);else{if(_0x58142c)_0x23d416=splitSqlStatements(_0x58142c);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x2060f7){return console[_0x5416c1(0xd4)](_0x5416c1(0xfc)+_0x2060f7[_0x5416c1(0xf1)]),0x1;}const _0x5b8f4c=_0x2c3e72[_0x5416c1(0xf0)]||'information_schema',_0x8ed3b5=_0x2c3e72[_0x5416c1(0xf5)];try{const _0x444ef6=[],_0x59de7f=!!_0x2c3e72[_0x5416c1(0xda)];for(let _0x445ddb=0x0;_0x445ddb<_0x23d416[_0x5416c1(0xed)];_0x445ddb++){const _0x5bc6a8=_0x23d416[_0x445ddb],_0x3d78df=_0x445ddb+0x1,_0x37110e=_0x23d416['length'],_0x1855e8=_0x37110e>0x1;_0x2c3e72[_0x5416c1(0xdc)]&&(console[_0x5416c1(0xd4)]('\x0a'+(_0x1855e8?_0x5416c1(0xce)+_0x3d78df+'/'+_0x37110e+':':'')),console[_0x5416c1(0xd4)](_0x5416c1(0xf6)+_0x2c3e72['site']),console[_0x5416c1(0xd4)](_0x5416c1(0xf3)+(_0x8ed3b5||'td')),console['error'](_0x5416c1(0xd5)+_0x5b8f4c),console[_0x5416c1(0xd4)](_0x5416c1(0xcd)+_0x5bc6a8));const _0x12a35a=_0x1855e8?_0x5416c1(0xd6)+_0x3d78df+'/'+_0x37110e+_0x5416c1(0xf8):_0x5416c1(0xe1);try{const _0x548f11=await withProgressSpinner(_0x12a35a,async _0xbbf91d=>{const _0x2372ba=_0x5416c1,_0x362a2f=await _0x48d0c3[_0x2372ba(0xcc)][_0x2372ba(0xd7)](_0x5bc6a8,{'catalog':_0x8ed3b5,'schema':_0x5b8f4c,'onJobId':_0x28c017=>{const _0x585ffd=_0x2372ba;_0xbbf91d[_0x585ffd(0xfb)](_0x28c017);},'onProgress':_0x542e99=>{const _0xea7b15=_0x2372ba;_0xbbf91d[_0xea7b15(0xf7)](_0xea7b15(0xe3)+_0x542e99[_0xea7b15(0xe5)]+']'),_0xbbf91d[_0xea7b15(0xec)](formatRows(_0x542e99['processedRows'])+_0xea7b15(0xee)+_0x542e99[_0xea7b15(0xcf)]+'/'+_0x542e99[_0xea7b15(0xe4)]+_0xea7b15(0xd0));}});return _0x362a2f;},{'verbose':_0x2c3e72[_0x5416c1(0xdc)]}),_0x26ab7f=_0x548f11['data'],_0x22c046=_0x26ab7f[_0x5416c1(0xe2)]?_0x5416c1(0xe8)+_0x26ab7f[_0x5416c1(0xe2)]+']':'',_0x49be21=_0x1855e8?_0x5416c1(0xce)+_0x3d78df+'/'+_0x37110e+_0x5416c1(0xea):'';console[_0x5416c1(0xd4)]('✔\x20'+_0x49be21+'Query\x20completed:\x20Processed\x20'+formatRows(_0x26ab7f[_0x5416c1(0xeb)]['processedRows'])+_0x5416c1(0xee)+(_0x5416c1(0xd9)+formatElapsed(_0x26ab7f[_0x5416c1(0xeb)][_0x5416c1(0xfd)])+_0x22c046));if(_0x1855e8&&_0x59de7f){const _0x808dd3=resolveOutputOptions(_0x2c3e72),_0x559e61=await formatQueryOutput(_0x26ab7f,_0x808dd3);_0x444ef6[_0x5416c1(0xd3)](_0x559e61);}else await handleQueryOutput(_0x26ab7f,_0x2c3e72);}catch(_0x1479a6){const _0x49b4a8=_0x1855e8?_0x5416c1(0xce)+_0x3d78df+'/'+_0x37110e+':\x0a':'',_0x2894b2=_0x1479a6 instanceof SDKError?_0x1479a6[_0x5416c1(0xe7)]:_0x1479a6[_0x5416c1(0xf1)];return console[_0x5416c1(0xd4)](''+_0x49b4a8+_0x2894b2),0x1;}}if(_0x23d416['length']>0x1&&_0x59de7f&&_0x444ef6['length']>0x0){const _0x5054e0=_0x444ef6['join']('\x0a');writeFileSync(_0x2c3e72[_0x5416c1(0xda)],_0x5054e0),console[_0x5416c1(0xd4)](_0x5416c1(0xf4)+_0x2c3e72[_0x5416c1(0xda)]);}return 0x0;}catch(_0x2b9de2){throw _0x2b9de2;}}['validate'](_0x97c512){const _0xce7765=a29_0x484e2d,_0x2ceff1=_0x97c512[_0xce7765(0xd2)][0x0],_0x46ae89=_0x97c512[_0xce7765(0xd1)][_0xce7765(0xfa)];if(!_0x2ceff1&&!_0x46ae89)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x2ceff1&&_0x46ae89)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';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;}}