@treasuredata/tdx 0.28.7 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) 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.d.ts.map +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-push-command.js.map +1 -1
  40. package/dist/commands/segment-update-command.js +1 -1
  41. package/dist/commands/segment-use-command.js +1 -1
  42. package/dist/commands/segment-validate-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/status-command.js +1 -1
  46. package/dist/commands/tables.js +1 -1
  47. package/dist/commands/unset-command.js +1 -1
  48. package/dist/commands/upgrade-command.js +1 -1
  49. package/dist/commands/use-command.js +1 -1
  50. package/dist/commands/user-command.js +1 -1
  51. package/dist/commands/workflow-command.js +1 -1
  52. package/dist/core/auth.js +1 -1
  53. package/dist/core/command-output.js +1 -1
  54. package/dist/core/config.js +1 -1
  55. package/dist/core/connection-cache.js +1 -1
  56. package/dist/core/constants.js +1 -1
  57. package/dist/core/credential-cache.js +1 -1
  58. package/dist/core/global-context.js +1 -1
  59. package/dist/core/keychain.js +1 -1
  60. package/dist/core/profile.js +1 -1
  61. package/dist/core/project-config.js +1 -1
  62. package/dist/core/session.js +1 -1
  63. package/dist/core/user-cache.js +1 -1
  64. package/dist/core/version.js +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/mcp/server.js +1 -1
  67. package/dist/mcp/tools/index.js +1 -1
  68. package/dist/mcp/tools/tdx-run.js +1 -1
  69. package/dist/mcp/tools/tdx-search.js +1 -1
  70. package/dist/mcp/utils.js +1 -1
  71. package/dist/proxy/claude-usage-tracker.js +1 -1
  72. package/dist/proxy/passthrough-server.js +1 -1
  73. package/dist/proxy/sse-usage-parser.js +1 -1
  74. package/dist/sdk/agent/agent-config.js +1 -1
  75. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/agent/tool-target-registry.js +1 -1
  83. package/dist/sdk/api.js +1 -1
  84. package/dist/sdk/client/cdp-api-client.js +1 -1
  85. package/dist/sdk/client/delivery-api-client.js +1 -1
  86. package/dist/sdk/client/endpoints.js +1 -1
  87. package/dist/sdk/client/engage-api-client.js +1 -1
  88. package/dist/sdk/client/http-client.js +1 -1
  89. package/dist/sdk/client/llm-api-client.js +1 -1
  90. package/dist/sdk/client/rate-limiter.js +1 -1
  91. package/dist/sdk/client/td-api-client.js +1 -1
  92. package/dist/sdk/client/trino-api-client.js +1 -1
  93. package/dist/sdk/client/workflow-client.js +1 -1
  94. package/dist/sdk/connection-validator.js +1 -1
  95. package/dist/sdk/connection.js +1 -1
  96. package/dist/sdk/delivery.js +1 -1
  97. package/dist/sdk/engage/campaign-pull.js +1 -1
  98. package/dist/sdk/engage/campaign-push.js +1 -1
  99. package/dist/sdk/engage/campaign-validator.d.ts.map +1 -1
  100. package/dist/sdk/engage/campaign-validator.js +1 -1
  101. package/dist/sdk/engage/campaign-validator.js.map +1 -1
  102. package/dist/sdk/engage/campaign-yaml.d.ts.map +1 -1
  103. package/dist/sdk/engage/campaign-yaml.js +1 -1
  104. package/dist/sdk/engage/campaign-yaml.js.map +1 -1
  105. package/dist/sdk/engage/types/campaign-def.js +1 -1
  106. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  107. package/dist/sdk/engage.js +1 -1
  108. package/dist/sdk/errors.js +1 -1
  109. package/dist/sdk/index.js +1 -1
  110. package/dist/sdk/io/index.js +1 -1
  111. package/dist/sdk/io/node-filesystem.js +1 -1
  112. package/dist/sdk/job.js +1 -1
  113. package/dist/sdk/journey.js +1 -1
  114. package/dist/sdk/llm/chat-cache.js +1 -1
  115. package/dist/sdk/llm/index.js +1 -1
  116. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  117. package/dist/sdk/llm/model-factors.js +1 -1
  118. package/dist/sdk/personalization.js +1 -1
  119. package/dist/sdk/query/index.js +1 -1
  120. package/dist/sdk/query/sql-parser.js +1 -1
  121. package/dist/sdk/realtime.js +1 -1
  122. package/dist/sdk/schedule.js +1 -1
  123. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  124. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  125. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  126. package/dist/sdk/segment/fields-display.js +1 -1
  127. package/dist/sdk/segment/file-discovery.js +1 -1
  128. package/dist/sdk/segment/journey-utils.js +1 -1
  129. package/dist/sdk/segment/journey-validator.js +1 -1
  130. package/dist/sdk/segment/journey-yaml.js +1 -1
  131. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  132. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  133. package/dist/sdk/segment/pull-workflow.js +1 -1
  134. package/dist/sdk/segment/push-recovery.js +1 -1
  135. package/dist/sdk/segment/push-workflow.d.ts +1 -1
  136. package/dist/sdk/segment/push-workflow.d.ts.map +1 -1
  137. package/dist/sdk/segment/push-workflow.js +1 -1
  138. package/dist/sdk/segment/push-workflow.js.map +1 -1
  139. package/dist/sdk/segment/resolution-context.js +1 -1
  140. package/dist/sdk/segment/segment-path-parser.js +1 -1
  141. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  142. package/dist/sdk/segment/segment-validator.d.ts +33 -0
  143. package/dist/sdk/segment/segment-validator.d.ts.map +1 -0
  144. package/dist/sdk/segment/segment-validator.js +1 -0
  145. package/dist/sdk/segment/segment-validator.js.map +1 -0
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/segment-def.d.ts +5 -179
  149. package/dist/sdk/segment/types/segment-def.d.ts.map +1 -1
  150. package/dist/sdk/segment/types/segment-def.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js.map +1 -1
  152. package/dist/sdk/segment/types/segment-schema.d.ts +259 -0
  153. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -0
  154. package/dist/sdk/segment/types/segment-schema.js +1 -0
  155. package/dist/sdk/segment/types/segment-schema.js.map +1 -0
  156. package/dist/sdk/segment/validate-files.d.ts.map +1 -1
  157. package/dist/sdk/segment/validate-files.js +1 -1
  158. package/dist/sdk/segment/validate-files.js.map +1 -1
  159. package/dist/sdk/segment/yaml-validator.d.ts +27 -10
  160. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  161. package/dist/sdk/segment/yaml-validator.js +1 -1
  162. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  163. package/dist/sdk/segment.js +1 -1
  164. package/dist/sdk/types/cdp.d.ts +11 -2
  165. package/dist/sdk/types/cdp.d.ts.map +1 -1
  166. package/dist/sdk/types/index.js +1 -1
  167. package/dist/sdk/types/progress.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/tree-formatter.js +1 -1
  173. package/dist/sdk/workflow/archive-validation.js +1 -1
  174. package/dist/sdk/workflow/clone-workflow.js +1 -1
  175. package/dist/sdk/workflow/index.js +1 -1
  176. package/dist/sdk/workflow/pull-workflow.js +1 -1
  177. package/dist/sdk/workflow/push-workflow.js +1 -1
  178. package/dist/sdk/workflow/tdx-config.js +1 -1
  179. package/dist/sdk/workflow/workflow-utils.js +1 -1
  180. package/dist/test-utils/command-runner.js +1 -1
  181. package/dist/test-utils/factories.js +1 -1
  182. package/dist/test-utils/fixtures.js +1 -1
  183. package/dist/test-utils/http-mock.js +1 -1
  184. package/dist/test-utils/index.js +1 -1
  185. package/dist/utils/async.js +1 -1
  186. package/dist/utils/colors.js +1 -1
  187. package/dist/utils/diff.js +1 -1
  188. package/dist/utils/file-permissions.js +1 -1
  189. package/dist/utils/file-reader.js +1 -1
  190. package/dist/utils/global-cache.js +1 -1
  191. package/dist/utils/json-loader.js +1 -1
  192. package/dist/utils/local-cache.js +1 -1
  193. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  194. package/dist/utils/logger/formatters/index.js +1 -1
  195. package/dist/utils/logger/handlers/console-handler.js +1 -1
  196. package/dist/utils/logger/handlers/file-handler.js +1 -1
  197. package/dist/utils/logger/handlers/index.js +1 -1
  198. package/dist/utils/logger/handlers/null-handler.js +1 -1
  199. package/dist/utils/logger/index.js +1 -1
  200. package/dist/utils/logger/logger.js +1 -1
  201. package/dist/utils/logger/types.js +1 -1
  202. package/dist/utils/option-validation.js +1 -1
  203. package/dist/utils/process.js +1 -1
  204. package/dist/utils/prompt.js +1 -1
  205. package/dist/utils/spinner.js +1 -1
  206. package/dist/utils/sse-parser.js +1 -1
  207. package/dist/utils/string-utils.js +1 -1
  208. package/dist/utils/table-ref-parser.js +1 -1
  209. package/dist/utils/tdx-logger.js +1 -1
  210. package/dist/utils/version-check.js +1 -1
  211. package/package.json +1 -1
@@ -1 +1 @@
1
- const a26_0x3ae22d=a26_0x1528;(function(_0x409245,_0x423438){const _0x596f7b=a26_0x1528,_0x2cc36c=_0x409245();while(!![]){try{const _0x1fc963=parseInt(_0x596f7b(0x1e7))/0x1+-parseInt(_0x596f7b(0x25d))/0x2*(parseInt(_0x596f7b(0x21c))/0x3)+-parseInt(_0x596f7b(0x219))/0x4*(-parseInt(_0x596f7b(0x241))/0x5)+-parseInt(_0x596f7b(0xe8))/0x6*(-parseInt(_0x596f7b(0x23c))/0x7)+parseInt(_0x596f7b(0x23d))/0x8*(-parseInt(_0x596f7b(0x17c))/0x9)+-parseInt(_0x596f7b(0x158))/0xa+-parseInt(_0x596f7b(0x191))/0xb;if(_0x1fc963===_0x423438)break;else _0x2cc36c['push'](_0x2cc36c['shift']());}catch(_0x5b2215){_0x2cc36c['push'](_0x2cc36c['shift']());}}}(a26_0x51cc,0x4e8cc));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x218ac3 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a26_0x5d2da8 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a26_0x1528(_0x1395a4,_0x2e4ad2){_0x1395a4=_0x1395a4-0xd5;const _0x51ccba=a26_0x51cc();let _0x1528f4=_0x51ccba[_0x1395a4];return _0x1528f4;}const PARENT_SEGMENT_DIR=a26_0x3ae22d(0x190),LEGACY_PARENT_SEGMENT_DIR=a26_0x3ae22d(0x250);function a26_0x51cc(){const _0x243bfe=['joinKey','localeCompare','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','darwin','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20No\x20changes\x20-\x20','idStitching','Master\x20Table','.yaml','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Attributes','No\x20parent\x20segments\x20match\x20pattern:\x20','Creating\x20parent\x20segment\x20\x27','✘\x20Failed\x20to\x20rename\x20directory:\x20','true','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','preview','⚡\x20Enabled','Updating','-1d','toFixed','displayColumns','✔\x20Created\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','ps:rt:list','trim','353110qBLtJq','in\x20','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Join\x20on:','listParents','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x22,\x20\x22type\x22:\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Listing\x20personalization\x20services\x20for\x20\x27','\x20service','message','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20No\x20changes\x20-\x20\x27','column_name','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','list','dirname','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','keys','scheduleOption','previewParentYaml','Master\x20+\x20Attributes','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','segment:parent:desc','SELECT\x20*\x20FROM\x20','/\x20→\x20','Fetching\x20SQL\x20for\x20\x27','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','coveragePercent','repeat','Listing\x20parent\x20segments...','type','\x20\x20No\x20sample\x20data\x20available','segment:parent:show','attributes','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','477ZEuaTk','displayPreviewResults','realtime_enabled','column_type','behavior','Table:\x20','customerPercent','segment:parent:preview','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Available\x20attributes:','Parent\x20segment:\x20','Errors:','👥\x20','To\x20cancel:','matchedCount','/app/dw/parentSegments/','utf-8','Attributes:','\x20parent\x20segment','Options:\x0a','parent_segments','1984928BwHtNP','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','information_schema','text','No\x20RT-enabled\x20parent\x20segments\x20found','\x0a\x20\x20]\x0a}\x0a','\x0a\x20\x20\x20\x20}','My\x20Service','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','red','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Default','jobId','%)\x20','columns','\x20RT-enabled\x20parent\x20segment','/sessions/','test','\x27...','ps:pz:list','updateParent','getParentFull','description','\x20tdx\x20wf\x20attempt\x20','\x20rows)','Listing\x20parent\x20segments\x20matching\x20\x27','Created','\x0aNo\x20sample\x20data\x20available','Updated','table','using\x20the\x20default\x20path:\x20','realtime','column','error','\x20trigger=','segment:parent:sql','join','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','displayMasterInfo','Resolving\x20parent\x20segment\x20\x27','Source:','RT\x202.0:','\x20--attribute\x20\x22','number','Get\x20SQL\x20query\x20for\x20parent\x20segment','customersWithEvents','ps:pz:init','Customers:','\x0aNew\x20parent\x20segment\x20\x27','getParentSQL','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20=\x20','open','\x20to\x20configure\x20your\x20personalization\x20service','bold','session','workflowSessionId','primaryKey','query','SELECT\x20*\x20FROM\x20(\x0a','displayAttributesStats','resolveParentId','Create\x20parent\x20segment\x20\x27','Pattern:\x20','\x20Configuration\x20is\x20valid','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','stop','processedRows','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','ps:rt:validate','/{name}.yml\x0a','\x20Added\x20RT\x202.0\x20template\x20section','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','audienceId','name','\x0aError:','Audience\x20ID:','\x20\x20\x20\x20','status','\x20to\x20push\x20the\x20configuration','all','Personalization:','realtime:','allValid','Site:\x20','site','572234xXITqN','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','errors','label','Listing\x20RT-enabled\x20parent\x20segments...','stats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','totalEvents','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','personalization','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20[Job\x20ID:\x20','displaySampleData','Fetching\x20behavior\x20list...','Status:','tdx\x20ps\x20preview\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','database','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','toLocaleString','Error:\x20--attribute\x20requires\x20a\x20name\x0a','List\x20parent\x20segments','Fetching\x20customers\x20schema...','pushParentYaml','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Schema\x20saved\x20to\x20','\x20parent\x20segment\x20\x27','\x22\x20}','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x27\x20and\x20run\x20workflow?','interval','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','pullParentYaml','\x20\x201.\x20Edit\x20','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','user_id','\x20rows\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','dim','format','getOutputDatabaseName','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x0aChanges\x20to\x20\x27','Error:\x20--database\x20and\x20--table\x20are\x20required','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','page_view','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','ignore','1510844dUTvaB','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','Columns:','519MWhyaO','✔\x20Found\x20','start','tdx\x20ps\x20push\x20','reduce','filter','toLowerCase','customerGroupFile','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','yes','rowCount','customerGroup','verbose','Database:\x20','master','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','population','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20Added\x20personalization\x20template\x20to\x20','apply','data','displayPreviewHints','Apply\x20changes\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','Fetching\x20sample\x20data...','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20RT\x20configuration\x20is\x20valid','behaviorsFile','win32','Events:','segment:parent:view','td_client_id','1763433cYrdux','91168szbZSy','segment:parent:run','Session:','Options\x20(one\x20required):\x0a','5iMnzuR','/\x20and\x20','map','\x0a⚠️\x20\x20Migrating:\x20','Aborted.','Analyzing\x20changes...','personalizationServices','Validating\x20configuration...','\x20personalization\x20service','setJobId','collectSchema','\x20Context\x20set:\x20','Error\x20reading\x20file:\x20','Preview:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','parent_segment','segment','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','trigger_event','xdg-open','parentSegment','sort','personalization_services','schemaValid','Fetching\x20parent\x20segment\x20\x27','json','enriched','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','698hdBUyM','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','schemaError','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','workflowAttemptId','log','segment:parent:validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','ID\x20Stitching:','scheduleType','elapsedTimeMillis','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','match','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','timezone','behaviors','.yml','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Executing\x20parent\x20segment\x20query...','\x0aChanges\x20to\x20apply\x20to\x20\x27','yellow','green','displayBehaviorsStats','\x20\x20Columns:\x20','\x0a✔\x20Workflow\x20started','Output\x20Database:','addBehaviors','\x27\x20is\x20already\x20up\x20to\x20date','6lJEuet','segment:parent:push','No\x20personalization\x20services\x20configured','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20-\x20','displayRealtimeInfo','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','displaySummary','\x20\x20\x20\x20\x20\x20','\x20field','single','limit','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Attempt:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','varchar','segment:parent:fields','customers','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Output\x20file:\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','stitchingKeys','/\x20directories\x20exist.','Error:','\x20section','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20--interval\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','segment:parent:pull','cyan','getBehaviorNames','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','sourceTableError','valid','segment:parent:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Creating','\x20--behavior\x20\x22','output','platform','unref','displayValidateResults','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','string','addAttributes','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','jsonl','sampleData','Behavior:','RT\x202.0\x20Validate:','push','\x27\x20is\x20up\x20to\x20date','Next\x20steps:','/attempt/','foreignKey','\x20--behavior\x20\x22<name>\x22','replace','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Validate:','attribute','events','\x20configured','\x20+\x20[','execute','\x20is\x20already\x20up\x20to\x20date','validateParentYaml','run','YAML\x20file:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20total','formatSchemaJson','endsWith','Validating\x20RT\x20configuration...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','web','\x5c$&','Found\x20YAML\x20file:\x20','length','behavior_','\x20\x20Tables:\x201\x20customers\x20+\x20','No\x20parent\x20segments\x20found','addBehaviorsFile','\x20\x20\x20','\x0a\x20\x20\x20\x20]'];a26_0x51cc=function(){return _0x243bfe;};return a26_0x51cc();}function openBrowser(_0x3a67aa){const _0x1721af=a26_0x3ae22d,_0xab8b5a=process[_0x1721af(0x10f)],_0x51f98a=_0xab8b5a===_0x1721af(0x141)?_0x1721af(0x1c5):_0xab8b5a===_0x1721af(0x238)?'start':_0x1721af(0x254);spawn(_0x51f98a,[_0x3a67aa],{'detached':!![],'stdio':_0x1721af(0x218)})[_0x1721af(0x110)]();}function migrateLegacyDirectory(){const _0x3e3fb1=a26_0x3ae22d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x405cf7=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x405cf7['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3e3fb1(0x1b2)](a26_0x5d2da8['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3e3fb1(0x242)+PARENT_SEGMENT_DIR+_0x3e3fb1(0xfe))),console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0x20f)](_0x3e3fb1(0x14d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0xe0)](_0x3e3fb1(0x244)+LEGACY_PARENT_SEGMENT_DIR+_0x3e3fb1(0x171)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0xe1)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x439084){const _0x31709e=_0x439084 instanceof Error?_0x439084['message']:String(_0x439084);return console[_0x3e3fb1(0x1b2)](a26_0x5d2da8[_0x3e3fb1(0x19a)](_0x3e3fb1(0x14b)+_0x31709e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x3ae22d(0x12c)](_0xf0fa){const _0x1eda45=a26_0x3ae22d;return migrateLegacyDirectory(),super[_0x1eda45(0x12c)](_0xf0fa);}}function resolveYamlFile(_0x23ca7a){const _0x3f49c6=a26_0x3ae22d;if(_0x23ca7a[_0x3f49c6(0x131)]('.yml')||_0x23ca7a[_0x3f49c6(0x131)](_0x3f49c6(0x146)))return _0x23ca7a;return a26_0x218ac3['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x23ca7a)+_0x3f49c6(0xdc));}function formatProgressMessage(_0x481cc8){const _0x905a99=a26_0x3ae22d,_0x1261fc=_0x481cc8[_0x905a99(0xd8)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1261fc){const [,_0x282607,_0x187a72,_0x2aa10e='']=_0x1261fc;return a26_0x5d2da8[_0x905a99(0x20f)](_0x282607+':')+'\x20'+_0x187a72+a26_0x5d2da8[_0x905a99(0x20f)](_0x2aa10e);}return a26_0x5d2da8[_0x905a99(0x20f)](_0x481cc8);}function showFileNotFoundError(_0x40fd07,_0x221913){const _0x174320=a26_0x3ae22d;console['error'](a26_0x5d2da8[_0x174320(0x19a)]('Error:\x20File\x20not\x20found:\x20'+_0x40fd07+'\x0a')),console['error'](a26_0x5d2da8['cyan'](_0x174320(0x1e9)+_0x221913+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x1d19a5){const _0x4cd797=a26_0x3ae22d;if(!_0x1d19a5[_0x4cd797(0x1b0)])return;const _0xbce70=_0x1d19a5[_0x4cd797(0x1b0)],_0x46eebc=_0xbce70['enabled']?a26_0x5d2da8[_0x4cd797(0xe1)](_0x4cd797(0x14f)):a26_0x5d2da8['yellow']('⚡\x20Not\x20enabled');console[_0x4cd797(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x1ba))+'\x20'+_0x46eebc);if(_0xbce70[_0x4cd797(0x126)]&&_0xbce70[_0x4cd797(0x126)][_0x4cd797(0x137)]>0x0){console['error']('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x239))+'\x20'+_0xbce70[_0x4cd797(0x126)][_0x4cd797(0x137)]+_0x4cd797(0x127));for(const _0x59b20d of _0xbce70['events']){const _0x5da74d=_0x59b20d['sourceTableValid']===![]?a26_0x5d2da8[_0x4cd797(0x19a)]('✘'):a26_0x5d2da8[_0x4cd797(0xe1)]('✔');console[_0x4cd797(0x1b2)](_0x4cd797(0x1de)+_0x5da74d+'\x20'+_0x59b20d[_0x4cd797(0x1db)]),_0x59b20d[_0x4cd797(0x108)]&&console[_0x4cd797(0x1b2)](_0x4cd797(0xf0)+a26_0x5d2da8[_0x4cd797(0x19a)](_0x59b20d[_0x4cd797(0x108)]));}}if(_0xbce70['attributes']&&_0xbce70[_0x4cd797(0x17a)][_0x4cd797(0x137)]>0x0){console[_0x4cd797(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x18d))+'\x20'+_0xbce70[_0x4cd797(0x17a)][_0x4cd797(0x137)]+_0x4cd797(0x127));for(const _0x1a88d0 of _0xbce70[_0x4cd797(0x17a)]){const _0xaadc55=_0x1a88d0[_0x4cd797(0x109)]?a26_0x5d2da8['green']('✔'):a26_0x5d2da8[_0x4cd797(0x19a)]('✘');console[_0x4cd797(0x1b2)](_0x4cd797(0x1de)+_0xaadc55+'\x20'+_0x1a88d0[_0x4cd797(0x1db)]+'\x20'+a26_0x5d2da8['dim']('('+_0x1a88d0[_0x4cd797(0x177)]+')'));}}if(_0xbce70['idStitching']){const _0x16c000=_0xbce70[_0x4cd797(0x144)][_0x4cd797(0xfd)]?.[_0x4cd797(0x137)]?_0x4cd797(0x128)+_0xbce70[_0x4cd797(0x144)][_0x4cd797(0xfd)][_0x4cd797(0x1b5)](',\x20')+']':'';console[_0x4cd797(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x266))+'\x20'+_0xbce70[_0x4cd797(0x144)][_0x4cd797(0x1ca)]+_0x16c000);}if(_0xbce70[_0x4cd797(0x247)]&&_0xbce70[_0x4cd797(0x247)][_0x4cd797(0x137)]>0x0){console[_0x4cd797(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cd797(0x20f)](_0x4cd797(0x1e2))+'\x20'+_0xbce70['personalizationServices'][_0x4cd797(0x137)]+_0x4cd797(0x161)+(_0xbce70[_0x4cd797(0x247)][_0x4cd797(0x137)]!==0x1?'s':''));for(const _0x5351e6 of _0xbce70[_0x4cd797(0x247)]){console['error'](_0x4cd797(0xec)+_0x5351e6[_0x4cd797(0x1db)]);}}}function showParentSegmentNotSetError(_0x2318f9){const _0x49ff61=a26_0x3ae22d;console['error'](a26_0x5d2da8[_0x49ff61(0xe0)](_0x49ff61(0x1b6))),console[_0x49ff61(0x1b2)](_0x2318f9);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x10a);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1fd);async[a26_0x3ae22d(0x129)](_0x5a762e){const _0x207fff=a26_0x3ae22d,{options:_0x2b2bf3,args:_0x1e7042,tdx:_0xf3b6e8}=_0x5a762e,_0x25fa86=_0x1e7042[0x0];_0x2b2bf3[_0x207fff(0x228)]&&(console[_0x207fff(0x1b2)](_0x207fff(0x1e5)+_0x2b2bf3['site']),_0x25fa86&&console[_0x207fff(0x1b2)](_0x207fff(0x1d0)+_0x25fa86));const _0x476504=await withSpinner(_0x25fa86?_0x207fff(0x1aa)+_0x25fa86+_0x207fff(0x1a3):_0x207fff(0x176),()=>_0xf3b6e8[_0x207fff(0x251)][_0x207fff(0x15c)](),{'verbose':_0x2b2bf3[_0x207fff(0x228)]});let _0x3c8559=_0x476504[_0x207fff(0x230)];if(_0x25fa86){const _0x200a9f=_0x25fa86[_0x207fff(0x121)](/[.+^${}()|[\]\\]/g,_0x207fff(0x135))['replace'](/\*/g,'.*')[_0x207fff(0x121)](/\?/g,'.'),_0x368c56=new RegExp('^'+_0x200a9f+'$','i');_0x3c8559=_0x3c8559[_0x207fff(0x221)](_0x1f8c62=>_0x368c56[_0x207fff(0x1a2)](_0x1f8c62[_0x207fff(0x17a)][_0x207fff(0x1db)]));}_0x3c8559[_0x207fff(0x256)]((_0x44caec,_0x5a0f64)=>_0x44caec[_0x207fff(0x17a)][_0x207fff(0x1db)][_0x207fff(0x13f)](_0x5a0f64[_0x207fff(0x17a)][_0x207fff(0x1db)])),console[_0x207fff(0x1b2)](_0x207fff(0x21d)+_0x3c8559[_0x207fff(0x137)]+_0x207fff(0x18e)+(_0x3c8559[_0x207fff(0x137)]!==0x1?'s':''));const _0x448b49=_0x16afa2=>{const _0xc133d7=_0x207fff;return getConsoleNextUrl(_0x2b2bf3[_0xc133d7(0x1e6)],'/app/dw/parentSegments/'+_0x16afa2);};if(_0x2b2bf3[_0x207fff(0x210)]===_0x207fff(0x25a)||_0x2b2bf3[_0x207fff(0x210)]===_0x207fff(0x117)){const _0x42840c=_0x3c8559[_0x207fff(0x243)](_0x3b605c=>({..._0x3b605c,'url':_0x448b49(_0x3b605c['id'])}));await handleSDKOutput(_0x42840c,_0x2b2bf3);}else{if(_0x3c8559[_0x207fff(0x137)]===0x0)_0x25fa86?console[_0x207fff(0x263)](_0x207fff(0x149)+_0x25fa86):console[_0x207fff(0x263)](_0x207fff(0x13a));else for(const _0x20f854 of _0x3c8559){const _0x38cbac=_0x20f854['attributes']['population']?a26_0x5d2da8[_0x207fff(0x20f)]('\x20('+formatRows(_0x20f854[_0x207fff(0x17a)]['population'])+')'):'',_0x192f1a=hyperlink(_0x20f854[_0x207fff(0x17a)][_0x207fff(0x1db)],_0x448b49(_0x20f854['id']));console[_0x207fff(0x263)](_0x207fff(0x188)+_0x192f1a+_0x38cbac);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]='segment:parent:create';[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x15d);async[a26_0x3ae22d(0x129)](_0x100938){const _0x1f4bb2=a26_0x3ae22d,{options:_0x30a557,args:_0x2d250a,tdx:_0x2326ac}=_0x100938;console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x12e)+_0x1f4bb2(0x113)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xc1bd39=_0x30a557;if(_0x2d250a[_0x1f4bb2(0x137)]===0x0)return console[_0x1f4bb2(0x1b2)](a26_0x5d2da8[_0x1f4bb2(0x19a)](_0x1f4bb2(0x163))),console['error'](_0x1f4bb2(0x212)),0x1;const _0x3c8adc=_0x2d250a[0x0];if(!_0xc1bd39[_0x1f4bb2(0x1f9)]||!_0xc1bd39[_0x1f4bb2(0x1ae)])return console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x214)),console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x212)),0x1;_0xc1bd39['verbose']&&(console['error'](_0x1f4bb2(0x1e5)+_0xc1bd39[_0x1f4bb2(0x1e6)]),console[_0x1f4bb2(0x1b2)]('Name:\x20'+_0x3c8adc),console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x229)+_0xc1bd39[_0x1f4bb2(0x1f9)]),console['error'](_0x1f4bb2(0x181)+_0xc1bd39[_0x1f4bb2(0x1ae)]));const _0x13d315=await loadJSONFromOptions(_0xc1bd39['attributes'],_0xc1bd39['attributesFile']),_0x7b769a=await loadJSONFromOptions(_0xc1bd39[_0x1f4bb2(0xdb)],_0xc1bd39[_0x1f4bb2(0x237)]),_0x2d694f=await loadJSONFromOptions(_0xc1bd39[_0x1f4bb2(0x227)],_0xc1bd39[_0x1f4bb2(0x223)]),_0xa5d3dc={'name':_0x3c8adc,'description':_0xc1bd39[_0x1f4bb2(0x1a7)],'scheduleType':_0xc1bd39[_0x1f4bb2(0xd5)],'scheduleOption':_0xc1bd39[_0x1f4bb2(0x16b)],'timezone':_0xc1bd39[_0x1f4bb2(0xda)],'master':{'parentDatabaseName':_0xc1bd39[_0x1f4bb2(0x1f9)],'parentTableName':_0xc1bd39[_0x1f4bb2(0x1ae)]},'attributes':_0x13d315,'behaviors':_0x7b769a,'customerGroup':_0x2d694f},_0x53c9c7=await withSpinner(_0x1f4bb2(0x14a)+_0x3c8adc+_0x1f4bb2(0x1a3),()=>_0x2326ac[_0x1f4bb2(0x251)]['createParent'](_0xa5d3dc),{'verbose':_0x30a557[_0x1f4bb2(0x228)]}),_0x62855d=_0x53c9c7[_0x1f4bb2(0x230)];return console[_0x1f4bb2(0x1b2)](_0x1f4bb2(0x154)+_0x62855d['name']+'\x27\x20with\x20ID:\x20'+_0x62855d['id']),await handleSDKOutput([_0x62855d],_0x30a557),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]='segment:parent:update';[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1f8);async[a26_0x3ae22d(0x129)](_0x17627f){const _0x4f9164=a26_0x3ae22d,{options:_0x5d13cb,args:_0x4e07e6,tdx:_0x2a72b8}=_0x17627f;console[_0x4f9164(0x1b2)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x4f9164(0x113)+_0x4f9164(0x15a));const _0x40bd9e=_0x5d13cb;if(_0x4e07e6['length']===0x0)return console[_0x4f9164(0x1b2)](a26_0x5d2da8[_0x4f9164(0x19a)](_0x4f9164(0x163))),console[_0x4f9164(0x1b2)](_0x4f9164(0xf6)),0x1;const _0xe24465=_0x4e07e6[0x0];_0x40bd9e[_0x4f9164(0x228)]&&(console['error']('Site:\x20'+_0x40bd9e[_0x4f9164(0x1e6)]),console[_0x4f9164(0x1b2)](_0x4f9164(0x186)+_0xe24465));const _0x59aa9e=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0xe24465+_0x4f9164(0x1a3),()=>_0x2a72b8[_0x4f9164(0x251)][_0x4f9164(0x1a6)](_0xe24465),{'verbose':_0x40bd9e['verbose']}),_0x53c4ea=_0x59aa9e['data'],_0x37c3b9=await loadJSONFromOptions(_0x40bd9e[_0x4f9164(0x115)],_0x40bd9e['addAttributesFile']),_0x3bac2e=await loadJSONFromOptions(_0x40bd9e[_0x4f9164(0xe6)],_0x40bd9e[_0x4f9164(0x13b)]),_0x3ee080={'name':_0x53c4ea[_0x4f9164(0x1db)],'description':_0x40bd9e[_0x4f9164(0x1a7)]!==undefined?_0x40bd9e['description']:_0x53c4ea[_0x4f9164(0x1a7)],'scheduleType':_0x40bd9e[_0x4f9164(0xd5)]!==undefined?_0x40bd9e[_0x4f9164(0xd5)]:_0x53c4ea['scheduleType'],'scheduleOption':_0x40bd9e[_0x4f9164(0x16b)]!==undefined?_0x40bd9e['scheduleOption']:_0x53c4ea[_0x4f9164(0x16b)],'timezone':_0x40bd9e['timezone']!==undefined?_0x40bd9e['timezone']:_0x53c4ea['timezone'],'master':_0x53c4ea[_0x4f9164(0x22a)],'attributes':_0x37c3b9?[..._0x53c4ea['attributes']||[],..._0x37c3b9]:_0x53c4ea[_0x4f9164(0x17a)],'behaviors':_0x3bac2e?[..._0x53c4ea[_0x4f9164(0xdb)]||[],..._0x3bac2e]:_0x53c4ea[_0x4f9164(0xdb)],'customerGroup':_0x53c4ea[_0x4f9164(0x227)]},_0x364c33=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0xe24465+_0x4f9164(0x1a3),()=>_0x2a72b8[_0x4f9164(0x251)][_0x4f9164(0x1a5)](_0xe24465,_0x3ee080),{'verbose':_0x40bd9e['verbose']}),_0xbb2dc2=_0x364c33[_0x4f9164(0x230)];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0xbb2dc2[_0x4f9164(0x1db)]+'\x27'),await handleSDKOutput([_0xbb2dc2],_0x40bd9e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x104);[a26_0x3ae22d(0x1a7)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x44dc61){const _0x288f45=a26_0x3ae22d,{options:_0x4776cd,args:_0x28e4ae,tdx:_0xea175e}=_0x44dc61,_0x27c0d6=_0x4776cd,_0x158c51=_0x28e4ae[0x0]||_0x4776cd[_0x288f45(0x255)];if(!_0x158c51)return showParentSegmentNotSetError(_0x288f45(0x25e)+_0x288f45(0x25f)),0x1;if(_0x27c0d6['use']&&_0x27c0d6['output'])return console['error'](a26_0x5d2da8[_0x288f45(0x19a)](_0x288f45(0x116))),console[_0x288f45(0x1b2)](a26_0x5d2da8['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0x20f)](_0x288f45(0x1af)+PARENT_SEGMENT_DIR+_0x288f45(0x1d7))),console[_0x288f45(0x1b2)](a26_0x5d2da8['cyan'](_0x288f45(0x107))),0x1;const _0x3be114=_0x27c0d6[_0x288f45(0x10e)]||a26_0x218ac3['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x158c51)+_0x288f45(0xdc));_0x27c0d6[_0x288f45(0x228)]&&(console[_0x288f45(0x1b2)](_0x288f45(0x1e5)+_0x27c0d6[_0x288f45(0x1e6)]),console[_0x288f45(0x1b2)](_0x288f45(0x186)+_0x158c51),console[_0x288f45(0x1b2)](_0x288f45(0xfb)+_0x3be114));const _0x21368d=await withSpinner(_0x288f45(0x259)+_0x158c51+_0x288f45(0x1a3),()=>_0xea175e[_0x288f45(0x251)][_0x288f45(0x208)](_0x158c51),{'verbose':_0x27c0d6[_0x288f45(0x228)]}),_0x52847c=_0x21368d[_0x288f45(0x230)];if(existsSync(_0x3be114)){const _0x5a243b=readFileSync(_0x3be114,_0x288f45(0x18c)),_0x3d7d27=generateDiff(_0x5a243b,_0x52847c);if(!hasChanges(_0x3d7d27))console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe1)]('✔')+_0x288f45(0x143)+a26_0x5d2da8['cyan'](_0x3be114)+_0x288f45(0x12a));else{console['error'](_0x288f45(0x213)+_0x3be114+'\x27:'),console[_0x288f45(0x1b2)]('─'[_0x288f45(0x175)](0x3c)),console[_0x288f45(0x1b2)](formatDiffWithColors(_0x3d7d27)),console[_0x288f45(0x1b2)]('─'[_0x288f45(0x175)](0x3c));if(!_0x27c0d6[_0x288f45(0x225)]){if(!isInteractive())return console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0x19a)](_0x288f45(0x1dc)),_0x288f45(0x192)),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0x20f)](_0x288f45(0x140))),0x1;const _0x23b188=await confirmKey('Overwrite\x20\x27'+_0x3be114+'\x27?');if(!_0x23b188)return console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe0)](_0x288f45(0x245))),0x1;}writeFileSync(_0x3be114,_0x52847c,'utf-8'),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe1)]('✔')+_0x288f45(0xf4)+a26_0x5d2da8[_0x288f45(0x105)](_0x3be114));}}else{const _0x4bda62=a26_0x218ac3[_0x288f45(0x168)](_0x3be114);!existsSync(_0x4bda62)&&mkdirSync(_0x4bda62,{'recursive':!![]}),writeFileSync(_0x3be114,_0x52847c,_0x288f45(0x18c)),console['error'](a26_0x5d2da8['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x5d2da8['cyan'](_0x3be114));}return saveSessionContext({'parent_segment':_0x158c51},_0x27c0d6[_0x288f45(0x1c8)]),console[_0x288f45(0x1b2)](a26_0x5d2da8[_0x288f45(0xe1)]('✔')+_0x288f45(0x24c)+a26_0x5d2da8[_0x288f45(0x20f)](_0x288f45(0x250))+_0x288f45(0x1c4)+a26_0x5d2da8[_0x288f45(0x105)](_0x158c51)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0xe9);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x25c);async[a26_0x3ae22d(0x129)](_0x1bacec){const _0x583af7=a26_0x3ae22d,{options:_0x260627,args:_0x5d2ed9,tdx:_0x2f306b}=_0x1bacec,_0x29a6f2=_0x260627,_0xd0c05c=_0x5d2ed9[0x0]||_0x260627[_0x583af7(0x255)];if(!_0xd0c05c)return showParentSegmentNotSetError(_0x583af7(0x155)+_0x583af7(0x15f)),0x1;const _0x5b2f13=resolveYamlFile(_0xd0c05c);if(!existsSync(_0x5b2f13))return showFileNotFoundError(_0x5b2f13,_0xd0c05c),0x1;_0x29a6f2[_0x583af7(0x228)]&&(console[_0x583af7(0x1b2)](_0x583af7(0x1e5)+_0x29a6f2[_0x583af7(0x1e6)]),console[_0x583af7(0x1b2)](_0x583af7(0x12d)+_0x5b2f13));let _0x5e5ec2;try{_0x5e5ec2=readFileSync(_0x5b2f13,_0x583af7(0x18c));}catch(_0x32f711){const _0xf4bef7=_0x32f711 instanceof Error?_0x32f711[_0x583af7(0x162)]:String(_0x32f711);return console[_0x583af7(0x1b2)](_0x583af7(0x24d)+_0xf4bef7),0x1;}const _0x24bd41=await withSpinner(_0x583af7(0x246),()=>_0x2f306b[_0x583af7(0x251)][_0x583af7(0x1ff)](_0x5e5ec2),{'verbose':_0x29a6f2['verbose']}),_0x1d43b5=_0x24bd41[_0x583af7(0x230)],{isNew:_0x531385,name:_0x14282d,hasChanges:_0x30eb30,diffFormatted:_0x534c2f}=_0x1d43b5;if(!_0x30eb30)return console[_0x583af7(0x1b2)](_0x583af7(0x164)+_0x14282d+_0x583af7(0xe7)),0x0;_0x531385?console['error'](_0x583af7(0x1c1)+_0x14282d+'\x27:'):console[_0x583af7(0x1b2)](_0x583af7(0xdf)+_0x14282d+'\x27:');console[_0x583af7(0x1b2)]('─'[_0x583af7(0x175)](0x3c)),console[_0x583af7(0x1b2)](_0x534c2f),console[_0x583af7(0x1b2)]('─'[_0x583af7(0x175)](0x3c));const _0x4d38d3=_0x531385?_0x583af7(0x1cf)+_0x14282d+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x14282d+'\x27?';if(!_0x29a6f2[_0x583af7(0x225)]){if(!isInteractive())return console['error'](a26_0x5d2da8['red']('\x0aError:'),_0x583af7(0x192)),console[_0x583af7(0x1b2)](a26_0x5d2da8[_0x583af7(0x20f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xbff716=await confirmKey(_0x4d38d3);if(!_0xbff716)return console['error'](a26_0x5d2da8[_0x583af7(0xe0)](_0x583af7(0x245))),0x1;}const _0x4235f2=_0x531385?_0x583af7(0x10c):_0x583af7(0x150),_0x4282ee=await withSpinner(_0x4235f2+_0x583af7(0x202)+_0x14282d+_0x583af7(0x1a3),()=>_0x1d43b5[_0x583af7(0x22f)](),{'verbose':_0x29a6f2[_0x583af7(0x228)]}),_0x1f406c=_0x4282ee[_0x583af7(0x230)],_0xe63ca5=getConsoleNextUrl(_0x29a6f2[_0x583af7(0x1e6)],'/app/dw/parentSegments/'+_0x1f406c['id']),_0x209be9=_0x531385?'Created':'Updated';return console[_0x583af7(0x1b2)]('✔\x20'+_0x209be9+_0x583af7(0x202)+_0x1f406c[_0x583af7(0x1db)]+'\x27'),console[_0x583af7(0x1b2)]('\x20\x20'+_0xe63ca5),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x264);['description']=a26_0x3ae22d(0x123);async[a26_0x3ae22d(0x129)](_0x37a1cd){const _0x4f2be1=a26_0x3ae22d,{options:_0x1335dc,args:_0x1c3c78,tdx:_0x54121a}=_0x37a1cd,_0x46da8f=_0x1335dc,_0x3e119a=_0x1c3c78[0x0]||_0x1335dc[_0x4f2be1(0x255)];if(!_0x3e119a)return showParentSegmentNotSetError(_0x4f2be1(0x235)+_0x4f2be1(0xee)+_0x4f2be1(0x18f)+_0x4f2be1(0x16e)+_0x4f2be1(0xfa)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1f2bd8=resolveYamlFile(_0x3e119a);if(!existsSync(_0x1f2bd8))return showFileNotFoundError(_0x1f2bd8,_0x3e119a),0x1;_0x46da8f['verbose']&&(console['error'](_0x4f2be1(0x1e5)+_0x46da8f['site']),console[_0x4f2be1(0x1b2)](_0x4f2be1(0x12d)+_0x1f2bd8));let _0x4f4349;try{_0x4f4349=readFileSync(_0x1f2bd8,_0x4f2be1(0x18c));}catch(_0x2dd770){const _0x18f92e=_0x2dd770 instanceof Error?_0x2dd770[_0x4f2be1(0x162)]:String(_0x2dd770);return console[_0x4f2be1(0x1b2)](_0x4f2be1(0x24d)+_0x18f92e),0x1;}const _0x120520=createCommandSpinner(a26_0x5d2da8[_0x4f2be1(0x20f)](_0x4f2be1(0x248)),{'verbose':_0x46da8f[_0x4f2be1(0x228)]});_0x120520[_0x4f2be1(0x21e)]();const _0x4ebd50={'onProgress':_0x12b2ff=>{const _0x18e97e=_0x4f2be1;_0x120520[_0x18e97e(0x194)]=formatProgressMessage(_0x12b2ff);}};if(_0x46da8f['master'])_0x4ebd50[_0x4f2be1(0x22a)]=!![];if(_0x46da8f[_0x4f2be1(0x25b)])_0x4ebd50['enriched']=!![];_0x46da8f[_0x4f2be1(0x125)]&&(_0x4ebd50[_0x4f2be1(0x125)]=_0x46da8f[_0x4f2be1(0x125)]);_0x46da8f[_0x4f2be1(0x180)]&&(_0x4ebd50[_0x4f2be1(0x180)]=_0x46da8f[_0x4f2be1(0x180)]);if(_0x46da8f[_0x4f2be1(0x206)])_0x4ebd50[_0x4f2be1(0x206)]=_0x46da8f[_0x4f2be1(0x206)];let _0x38b263;try{_0x38b263=await _0x54121a[_0x4f2be1(0x251)][_0x4f2be1(0x12b)](_0x4f4349,_0x4ebd50),_0x120520['stop']();}catch(_0x3bdf34){_0x120520[_0x4f2be1(0x1d3)]();throw _0x3bdf34;}const _0x255e90=_0x46da8f[_0x4f2be1(0x206)]||_0x4f2be1(0x151);return this['displayValidateResults'](_0x38b263,_0x4ebd50,_0x1f2bd8,_0x255e90),_0x38b263['allValid']?0x0:0x1;}[a26_0x3ae22d(0x111)](_0x591ac7,_0xc81b26,_0x4583d5,_0x1dfc36){const _0x3670f2=a26_0x3ae22d;console[_0x3670f2(0x1b2)]('\x0a'+a26_0x5d2da8['bold'](_0x3670f2(0x124))+'\x20'+_0x591ac7['name']),console[_0x3670f2(0x1b2)]('═'[_0x3670f2(0x175)](0x3c)),this[_0x3670f2(0x1b7)](_0x591ac7);if(typeof _0xc81b26[_0x3670f2(0x125)]===_0x3670f2(0x114)){this[_0x3670f2(0x1cd)](_0x591ac7),this[_0x3670f2(0xef)](_0x591ac7),this['displayPreviewHints'](_0x4583d5,_0x1dfc36,_0x3670f2(0x125),_0xc81b26[_0x3670f2(0x125)]);return;}if(_0xc81b26[_0x3670f2(0x125)]===!![]){this[_0x3670f2(0x1cd)](_0x591ac7),this[_0x3670f2(0xef)](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,'attributes');return;}if(typeof _0xc81b26[_0x3670f2(0x180)]===_0x3670f2(0x114)){this[_0x3670f2(0xe2)](_0x591ac7,_0x1dfc36),this[_0x3670f2(0xef)](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,'behavior',_0xc81b26[_0x3670f2(0x180)]);return;}if(_0xc81b26['behavior']===!![]){this[_0x3670f2(0xe2)](_0x591ac7,_0x1dfc36),this['displaySummary'](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,_0x3670f2(0xdb));return;}this[_0x3670f2(0x1cd)](_0x591ac7),this['displayBehaviorsStats'](_0x591ac7,_0x1dfc36),this[_0x3670f2(0xed)](_0x591ac7),this['displaySummary'](_0x591ac7),this[_0x3670f2(0x231)](_0x4583d5,_0x1dfc36,_0x3670f2(0x1e1));}[a26_0x3ae22d(0xed)](_0x3818a1){displayRealtimeValidation(_0x3818a1);}[a26_0x3ae22d(0x231)](_0x46f58d,_0x3a557f,_0xa5004e,_0x2dd1a2){const _0x32b934=a26_0x3ae22d;console['error']('\x0a'+a26_0x5d2da8[_0x32b934(0x20f)]('To\x20view\x20sample\x20data:'));const _0x21ad16=_0x3a557f!==_0x32b934(0x151)?_0x32b934(0x102)+_0x3a557f:'';if(_0xa5004e===_0x32b934(0x125)&&_0x2dd1a2)console['error']('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)]('tdx\x20ps\x20preview\x20'+_0x46f58d+'\x20--attribute\x20\x22'+_0x2dd1a2+'\x22'+_0x21ad16));else{if(_0xa5004e==='behavior'&&_0x2dd1a2)console[_0x32b934(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)]('tdx\x20ps\x20preview\x20'+_0x46f58d+_0x32b934(0x10d)+_0x2dd1a2+'\x22'+_0x21ad16));else(_0xa5004e===_0x32b934(0x17a)||_0xa5004e===_0x32b934(0x1e1))&&console[_0x32b934(0x1b2)]('\x20\x20'+a26_0x5d2da8['dim'](_0x32b934(0x1f7)+_0x46f58d+'\x20--attribute\x20\x22<name>\x22'+_0x21ad16));}(_0xa5004e===_0x32b934(0xdb)||_0xa5004e==='all')&&console[_0x32b934(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)](_0x32b934(0x1f7)+_0x46f58d+_0x32b934(0x120)+_0x21ad16)),_0xa5004e===_0x32b934(0x1e1)&&console['error']('\x20\x20'+a26_0x5d2da8[_0x32b934(0x20f)](_0x32b934(0x1f7)+_0x46f58d+'\x20--enriched'+_0x21ad16));}[a26_0x3ae22d(0x1b7)](_0x20a03a){const _0x4cf2ef=a26_0x3ae22d,{master:_0x41d9c5}=_0x20a03a,_0x210a3b=_0x41d9c5[_0x4cf2ef(0x258)]?a26_0x5d2da8['green']('✔'):a26_0x5d2da8[_0x4cf2ef(0x19a)]('✘');console[_0x4cf2ef(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4cf2ef(0x20f)](_0x4cf2ef(0x145))),console[_0x4cf2ef(0x1b2)](_0x210a3b+'\x20'+a26_0x5d2da8[_0x4cf2ef(0x1c7)](_0x41d9c5[_0x4cf2ef(0x1f9)]+'.'+_0x41d9c5[_0x4cf2ef(0x1ae)])),_0x41d9c5[_0x4cf2ef(0x258)]?_0x41d9c5['rowCount']!==undefined&&console['error']('\x20\x20'+a26_0x5d2da8['dim']('Rows:')+'\x20'+a26_0x5d2da8[_0x4cf2ef(0x105)](formatRows(_0x41d9c5[_0x4cf2ef(0x226)]))):console[_0x4cf2ef(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4cf2ef(0x19a)](_0x4cf2ef(0xff))+'\x20'+_0x41d9c5[_0x4cf2ef(0x260)]);}[a26_0x3ae22d(0x1cd)](_0x5e078b){const _0x47ae4c=a26_0x3ae22d;if(_0x5e078b[_0x47ae4c(0x17a)]['length']===0x0)return;console[_0x47ae4c(0x1b2)]('\x0a'+a26_0x5d2da8[_0x47ae4c(0x20f)](_0x47ae4c(0x148)));for(const _0x42a8cd of _0x5e078b[_0x47ae4c(0x17a)]){const _0x2d30f0=_0x42a8cd[_0x47ae4c(0x258)]?a26_0x5d2da8[_0x47ae4c(0xe1)]('✔'):a26_0x5d2da8['red']('✘');let _0x3eef28='';if(_0x42a8cd['schemaValid']&&_0x42a8cd[_0x47ae4c(0x18a)]!==undefined&&_0x42a8cd['coveragePercent']!==undefined){const _0x2762ba=_0x42a8cd[_0x47ae4c(0x174)][_0x47ae4c(0x152)](0x1),_0x13662d=_0x42a8cd['coveragePercent']>=0x50?a26_0x5d2da8[_0x47ae4c(0xe1)]:_0x42a8cd['coveragePercent']>=0x32?a26_0x5d2da8[_0x47ae4c(0xe0)]:a26_0x5d2da8[_0x47ae4c(0x19a)];_0x3eef28='\x20'+a26_0x5d2da8[_0x47ae4c(0x20f)]('Coverage:')+'\x20'+_0x13662d(_0x2762ba+'%')+'\x20('+formatRows(_0x42a8cd[_0x47ae4c(0x18a)])+_0x47ae4c(0x1a9);}console[_0x47ae4c(0x1b2)](_0x2d30f0+'\x20'+a26_0x5d2da8['bold'](_0x42a8cd[_0x47ae4c(0x1db)])+_0x3eef28),console['error']('\x20\x20'+a26_0x5d2da8['dim'](_0x47ae4c(0x1b9))+'\x20'+a26_0x5d2da8[_0x47ae4c(0x1c7)](_0x42a8cd[_0x47ae4c(0x1f9)]+'.'+_0x42a8cd[_0x47ae4c(0x1ae)]));const _0x5de88e=_0x42a8cd[_0x47ae4c(0x13e)]===_0x42a8cd[_0x47ae4c(0x11f)]?a26_0x5d2da8['dim'](_0x47ae4c(0x15b))+'\x20'+_0x42a8cd['joinKey']:a26_0x5d2da8[_0x47ae4c(0x20f)]('Join:')+'\x20'+_0x42a8cd[_0x47ae4c(0x13e)]+_0x47ae4c(0x1c4)+_0x42a8cd[_0x47ae4c(0x11f)];console['error']('\x20\x20'+_0x5de88e),console['error']('\x20\x20'+a26_0x5d2da8[_0x47ae4c(0x20f)](_0x47ae4c(0x21b))),this[_0x47ae4c(0x153)](_0x42a8cd[_0x47ae4c(0x19f)]),!_0x42a8cd[_0x47ae4c(0x258)]&&console[_0x47ae4c(0x1b2)]('\x20\x20'+a26_0x5d2da8['red'](_0x47ae4c(0xff))+'\x20'+_0x42a8cd[_0x47ae4c(0x260)]);}}[a26_0x3ae22d(0xe2)](_0x467f43,_0x13113e){const _0x4a0c59=a26_0x3ae22d;if(_0x467f43[_0x4a0c59(0xdb)][_0x4a0c59(0x137)]===0x0)return;console[_0x4a0c59(0x1b2)]('\x0a'+a26_0x5d2da8['dim']('Behaviors')+'\x20'+a26_0x5d2da8[_0x4a0c59(0x20f)]('('+_0x13113e+')'));for(const _0x549521 of _0x467f43['behaviors']){const _0x296b30=_0x549521[_0x4a0c59(0x258)]?a26_0x5d2da8[_0x4a0c59(0xe1)]('✔'):a26_0x5d2da8[_0x4a0c59(0x19a)]('✘');let _0x348000='';if(_0x549521[_0x4a0c59(0x258)]&&_0x549521[_0x4a0c59(0x1be)]!==undefined&&_0x549521[_0x4a0c59(0x1ef)]!==undefined){const _0xd0310d=_0x549521[_0x4a0c59(0x182)]?.[_0x4a0c59(0x152)](0x1)||'?',_0xd0d845=(_0x549521[_0x4a0c59(0x182)]??0x0)>=0x32?a26_0x5d2da8[_0x4a0c59(0xe1)]:(_0x549521['customerPercent']??0x0)>=0x14?a26_0x5d2da8['yellow']:a26_0x5d2da8[_0x4a0c59(0x19a)];_0x348000='\x20'+a26_0x5d2da8[_0x4a0c59(0x20f)](_0x4a0c59(0x1c0))+'\x20'+_0xd0d845(formatRows(_0x549521['customersWithEvents']))+'\x20('+_0xd0310d+_0x4a0c59(0x19e)+a26_0x5d2da8[_0x4a0c59(0x20f)](_0x4a0c59(0x239))+'\x20'+a26_0x5d2da8[_0x4a0c59(0x105)](formatRows(_0x549521['totalEvents']));}console[_0x4a0c59(0x1b2)](_0x296b30+'\x20'+a26_0x5d2da8['bold'](_0x549521[_0x4a0c59(0x1db)])+_0x348000),console[_0x4a0c59(0x1b2)]('\x20\x20'+a26_0x5d2da8['dim'](_0x4a0c59(0x1b9))+'\x20'+a26_0x5d2da8['bold'](_0x549521[_0x4a0c59(0x1f9)]+'.'+_0x549521[_0x4a0c59(0x1ae)]));const _0x1e7a24=_0x549521[_0x4a0c59(0x13e)]===_0x549521[_0x4a0c59(0x11f)]?a26_0x5d2da8['dim'](_0x4a0c59(0x15b))+'\x20'+_0x549521[_0x4a0c59(0x13e)]:a26_0x5d2da8['dim']('Join:')+'\x20'+_0x549521[_0x4a0c59(0x13e)]+'\x20=\x20'+_0x549521['foreignKey'];console['error']('\x20\x20'+_0x1e7a24),console['error']('\x20\x20'+a26_0x5d2da8[_0x4a0c59(0x20f)](_0x4a0c59(0x21b))),this[_0x4a0c59(0x153)](_0x549521[_0x4a0c59(0x19f)]),!_0x549521[_0x4a0c59(0x258)]&&console[_0x4a0c59(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x4a0c59(0x19a)](_0x4a0c59(0xff))+'\x20'+_0x549521[_0x4a0c59(0x260)]);}}['displayColumns'](_0x368768){const _0xea4a99=a26_0x3ae22d;for(const _0x58f4f2 of _0x368768){_0x58f4f2[_0xea4a99(0x1eb)]===_0x58f4f2[_0xea4a99(0x1b1)]||_0x58f4f2[_0xea4a99(0x1b1)]==='*'?console[_0xea4a99(0x1b2)](_0xea4a99(0xec)+_0x58f4f2['label']):console[_0xea4a99(0x1b2)](_0xea4a99(0xec)+_0x58f4f2[_0xea4a99(0x1eb)]+'\x20'+a26_0x5d2da8[_0xea4a99(0x20f)]('('+_0x58f4f2[_0xea4a99(0x1b1)]+')'));}}[a26_0x3ae22d(0xef)](_0x186d53){const _0x390819=a26_0x3ae22d;console[_0x390819(0x1b2)]('─'[_0x390819(0x175)](0x3c));if(_0x186d53[_0x390819(0x1ea)]['length']>0x0){console[_0x390819(0x1b2)]('\x0a'+a26_0x5d2da8[_0x390819(0x19a)]('Errors:'));for(const _0x54573a of _0x186d53[_0x390819(0x1ea)]){console[_0x390819(0x1b2)]('\x20\x20'+a26_0x5d2da8['red']('•')+'\x20'+_0x54573a);}}_0x186d53[_0x390819(0x1e4)]&&console['error']('\x0a'+a26_0x5d2da8[_0x390819(0xe1)]('✔')+_0x390819(0x1d1));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x183);[a26_0x3ae22d(0x1a7)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x298801){const _0x3ed58a=a26_0x3ae22d,{options:_0x52dab0,args:_0x246460,tdx:_0x13b8e9}=_0x298801,_0x492bfd=_0x52dab0,_0x416203=_0x246460[0x0]||_0x52dab0[_0x3ed58a(0x255)];if(!_0x416203)return showParentSegmentNotSetError(_0x3ed58a(0x20e)+_0x3ed58a(0x261)+_0x3ed58a(0x240)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x3ed58a(0x1c3)+_0x3ed58a(0x20d)+_0x3ed58a(0x103)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x492bfd[_0x3ed58a(0x22a)]&&!_0x492bfd['attribute']&&!_0x492bfd['behavior']&&!_0x492bfd['enriched'])return console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x224)),console[_0x3ed58a(0x1b2)]('Options:'),console[_0x3ed58a(0x1b2)](_0x3ed58a(0xd9)),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x207)),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x1d2)),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x217)),0x1;const _0xe90b32=resolveYamlFile(_0x416203);if(!existsSync(_0xe90b32))return showFileNotFoundError(_0xe90b32,_0x416203),0x1;_0x492bfd['verbose']&&(console[_0x3ed58a(0x1b2)](_0x3ed58a(0x1e5)+_0x492bfd['site']),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x12d)+_0xe90b32));let _0x1edf61;try{_0x1edf61=readFileSync(_0xe90b32,'utf-8');}catch(_0x112d5b){const _0x2b15ce=_0x112d5b instanceof Error?_0x112d5b[_0x3ed58a(0x162)]:String(_0x112d5b);return console[_0x3ed58a(0x1b2)]('Error\x20reading\x20file:\x20'+_0x2b15ce),0x1;}let _0x2167b2;try{_0x2167b2=parseDef(_0x1edf61);}catch(_0x1463b6){const _0x13bee5=_0x1463b6 instanceof Error?_0x1463b6[_0x3ed58a(0x162)]:String(_0x1463b6);return console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)]('Error\x20parsing\x20YAML:\x20'+_0x13bee5)),0x1;}if(_0x492bfd['attribute']===!![]||_0x492bfd[_0x3ed58a(0x125)]===''){const _0x81a8a8=_0x2167b2[_0x3ed58a(0x17a)]?.[_0x3ed58a(0x243)](_0x4e6a66=>_0x4e6a66[_0x3ed58a(0x1db)])||[];if(_0x81a8a8['length']===0x0)console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x3ed58a(0x1b2)](a26_0x5d2da8['red'](_0x3ed58a(0x1fc))),console[_0x3ed58a(0x1b2)](_0x3ed58a(0x185));for(const _0x3cae58 of _0x81a8a8){console[_0x3ed58a(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x3ed58a(0x105)](_0x3cae58));}console[_0x3ed58a(0x1b2)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x416203+_0x3ed58a(0x1bb)+_0x81a8a8[0x0]+'\x22');}return 0x1;}if(_0x492bfd[_0x3ed58a(0x180)]===!![]||_0x492bfd[_0x3ed58a(0x180)]===''){const _0x2efcdc=_0x2167b2[_0x3ed58a(0xdb)]?.[_0x3ed58a(0x243)](_0xfc23ba=>_0xfc23ba[_0x3ed58a(0x1db)])||[];if(_0x2efcdc['length']===0x0)console[_0x3ed58a(0x1b2)](a26_0x5d2da8[_0x3ed58a(0x19a)](_0x3ed58a(0x19b)));else{console[_0x3ed58a(0x1b2)](a26_0x5d2da8['red'](_0x3ed58a(0x1e8))),console[_0x3ed58a(0x1b2)]('Available\x20behaviors:');for(const _0x4b7104 of _0x2efcdc){console[_0x3ed58a(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x3ed58a(0x105)](_0x4b7104));}console[_0x3ed58a(0x1b2)](_0x3ed58a(0x184)+_0x416203+_0x3ed58a(0x10d)+_0x2efcdc[0x0]+'\x22');}return 0x1;}const _0x558bd2=createCommandSpinner(a26_0x5d2da8[_0x3ed58a(0x20f)](_0x3ed58a(0x234)),{'verbose':_0x492bfd['verbose']});_0x558bd2['start']();const _0x199174={'onProgress':_0x48e297=>{_0x558bd2['text']=formatProgressMessage(_0x48e297);}};if(_0x492bfd[_0x3ed58a(0x22a)])_0x199174[_0x3ed58a(0x22a)]=!![];if(_0x492bfd[_0x3ed58a(0x125)]&&typeof _0x492bfd[_0x3ed58a(0x125)]===_0x3ed58a(0x114))_0x199174['attribute']=_0x492bfd[_0x3ed58a(0x125)];if(_0x492bfd['behavior']&&typeof _0x492bfd['behavior']==='string')_0x199174[_0x3ed58a(0x180)]=_0x492bfd[_0x3ed58a(0x180)];if(_0x492bfd[_0x3ed58a(0x25b)])_0x199174[_0x3ed58a(0x25b)]=!![];if(_0x492bfd[_0x3ed58a(0x206)])_0x199174[_0x3ed58a(0x206)]=_0x492bfd[_0x3ed58a(0x206)];let _0x4d8890;try{_0x4d8890=await _0x13b8e9['segment'][_0x3ed58a(0x16c)](_0x1edf61,_0x199174),_0x558bd2[_0x3ed58a(0x1d3)]();}catch(_0x3aa93b){_0x558bd2[_0x3ed58a(0x1d3)]();throw _0x3aa93b;}return await this[_0x3ed58a(0x17d)](_0x4d8890,{'master':_0x492bfd[_0x3ed58a(0x22a)],'attribute':typeof _0x492bfd[_0x3ed58a(0x125)]===_0x3ed58a(0x114)?_0x492bfd[_0x3ed58a(0x125)]:undefined,'behavior':typeof _0x492bfd[_0x3ed58a(0x180)]===_0x3ed58a(0x114)?_0x492bfd[_0x3ed58a(0x180)]:undefined,'enriched':_0x492bfd[_0x3ed58a(0x25b)]}),_0x4d8890[_0x3ed58a(0x1e4)]?0x0:0x1;}async[a26_0x3ae22d(0x17d)](_0x5bd423,_0x3802ce){const _0x36c223=a26_0x3ae22d;console['error']('\x0a'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x36c223(0x24e))+'\x20'+_0x5bd423[_0x36c223(0x1db)]),console[_0x36c223(0x1b2)]('═'[_0x36c223(0x175)](0x3c));if(_0x3802ce[_0x36c223(0x22a)]&&_0x5bd423[_0x36c223(0x118)]){const _0x45ead0=a26_0x5d2da8['dim']('Master:')+'\x20'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x5bd423['master'][_0x36c223(0x1f9)]+'.'+_0x5bd423[_0x36c223(0x22a)]['table']);await this['displaySampleData'](_0x45ead0,_0x5bd423[_0x36c223(0x118)]);}else{if(_0x3802ce['attribute']&&_0x5bd423['sampleData']){const _0x422956=a26_0x5d2da8[_0x36c223(0x20f)]('Attribute:')+'\x20'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x3802ce['attribute']);await this[_0x36c223(0x1f4)](_0x422956,_0x5bd423[_0x36c223(0x118)]);}else{if(_0x3802ce[_0x36c223(0x180)]&&_0x5bd423['sampleData']){const _0x3a5d18=a26_0x5d2da8[_0x36c223(0x20f)](_0x36c223(0x119))+'\x20'+a26_0x5d2da8[_0x36c223(0x1c7)](_0x3802ce[_0x36c223(0x180)]);await this[_0x36c223(0x1f4)](_0x3a5d18,_0x5bd423[_0x36c223(0x118)]);}else{if(_0x3802ce[_0x36c223(0x25b)]&&_0x5bd423['sampleData']){const _0x541933=a26_0x5d2da8[_0x36c223(0x20f)]('Enriched:')+'\x20'+a26_0x5d2da8['bold'](_0x36c223(0x16d));await this['displaySampleData'](_0x541933,_0x5bd423[_0x36c223(0x118)]);}else!_0x5bd423[_0x36c223(0x118)]&&console[_0x36c223(0x1b2)](_0x36c223(0x1ac));}}}if(_0x5bd423[_0x36c223(0x1ea)][_0x36c223(0x137)]>0x0){console['error']('─'[_0x36c223(0x175)](0x3c)),console[_0x36c223(0x1b2)]('\x0a'+a26_0x5d2da8[_0x36c223(0x19a)]('Errors:'));for(const _0x1ba6c8 of _0x5bd423[_0x36c223(0x1ea)]){console['error']('\x20\x20'+a26_0x5d2da8['red']('•')+'\x20'+_0x1ba6c8);}}}async['displaySampleData'](_0x1c9473,_0x1a228a){const _0x59e34f=a26_0x3ae22d;if(_0x1a228a[_0x59e34f(0x137)]===0x0){console[_0x59e34f(0x1b2)]('\x0a'+_0x1c9473),console[_0x59e34f(0x1b2)](_0x59e34f(0x178));return;}console['error']('\x0a'+_0x1c9473);const _0x264eec=Object[_0x59e34f(0x16a)](_0x1a228a[0x0])['map'](_0x59378d=>({'name':_0x59378d,'type':typeof _0x1a228a[0x0][_0x59378d]===_0x59e34f(0x1bc)?'double':_0x59e34f(0xf7)})),_0x183ef0={'queryId':_0x59e34f(0x14e),'columns':_0x264eec,'data':_0x1a228a,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1a228a[_0x59e34f(0x137)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2b3375=formatAsTable(_0x183ef0,_0x1a228a['length'],!![]);await writeOutput(_0x2b3375,undefined,_0x59e34f(0x1ae));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x23e);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x112);async[a26_0x3ae22d(0x129)](_0x12350f){const _0x2f29f9=a26_0x3ae22d,{options:_0x34c0e1,args:_0x46c96a,tdx:_0x21db51}=_0x12350f,_0x4d4591=_0x34c0e1,_0x5a5a9f=_0x46c96a[0x0]||_0x34c0e1[_0x2f29f9(0x255)];if(!_0x5a5a9f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x2f29f9(0x1ee)),0x1;const _0x1e17c1=resolveYamlFile(_0x5a5a9f);if(existsSync(_0x1e17c1)){_0x4d4591['verbose']&&console[_0x2f29f9(0x1b2)](_0x2f29f9(0x136)+_0x1e17c1);let _0x13c7fe;try{_0x13c7fe=readFileSync(_0x1e17c1,'utf-8');}catch(_0x23fbcc){const _0x265b52=_0x23fbcc instanceof Error?_0x23fbcc['message']:String(_0x23fbcc);return console[_0x2f29f9(0x1b2)]('Error\x20reading\x20file:\x20'+_0x265b52),0x1;}const _0x4deb70=await withSpinner(_0x2f29f9(0x246),()=>_0x21db51[_0x2f29f9(0x251)]['pushParentYaml'](_0x13c7fe),{'verbose':_0x4d4591['verbose']}),_0x4287eb=_0x4deb70[_0x2f29f9(0x230)],{isNew:_0x37decc,name:_0x4e323d,hasChanges:_0x32a75f,diffFormatted:_0x34fd5f}=_0x4287eb;if(_0x32a75f){_0x37decc?console['error'](_0x2f29f9(0x1c1)+_0x4e323d+'\x27:'):console[_0x2f29f9(0x1b2)](_0x2f29f9(0xdf)+_0x4e323d+'\x27:');console[_0x2f29f9(0x1b2)]('─'[_0x2f29f9(0x175)](0x3c)),console[_0x2f29f9(0x1b2)](_0x34fd5f),console['error']('─'[_0x2f29f9(0x175)](0x3c));const _0x7e2574=_0x37decc?'Create\x20parent\x20segment\x20\x27'+_0x4e323d+_0x2f29f9(0x205):_0x2f29f9(0x232)+_0x4e323d+'\x27\x20and\x20run\x20workflow?';if(!_0x4d4591[_0x2f29f9(0x225)]){if(!isInteractive())return console[_0x2f29f9(0x1b2)](a26_0x5d2da8[_0x2f29f9(0x19a)]('\x0aError:'),_0x2f29f9(0x192)),console['error'](a26_0x5d2da8[_0x2f29f9(0x20f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x6434b0=await confirmKey(_0x7e2574);if(!_0x6434b0)return console[_0x2f29f9(0x1b2)](a26_0x5d2da8[_0x2f29f9(0xe0)](_0x2f29f9(0x245))),0x1;}const _0x13782a=_0x37decc?_0x2f29f9(0x10c):_0x2f29f9(0x150);await withSpinner(_0x13782a+_0x2f29f9(0x202)+_0x4e323d+'\x27...',()=>_0x4287eb['apply'](),{'verbose':_0x4d4591[_0x2f29f9(0x228)]});const _0xa86343=_0x37decc?_0x2f29f9(0x1ab):_0x2f29f9(0x1ad);console[_0x2f29f9(0x1b2)]('✔\x20'+_0xa86343+_0x2f29f9(0x202)+_0x4e323d+'\x27');}else console['error'](_0x2f29f9(0x164)+_0x4e323d+_0x2f29f9(0x11c));}const _0x329e81=await withSpinner(_0x2f29f9(0xfc)+_0x5a5a9f+_0x2f29f9(0x1a3),()=>_0x21db51[_0x2f29f9(0x251)]['runParent'](_0x5a5a9f),{'verbose':_0x4d4591[_0x2f29f9(0x228)]}),_0x1c68dc=_0x329e81['data'],_0x24d28e=getConsoleUrl(_0x4d4591[_0x2f29f9(0x1e6)],'/app/workflows/'+_0x1c68dc['workflowId']+_0x2f29f9(0x1a1)+_0x1c68dc['workflowSessionId']+_0x2f29f9(0x11e)+_0x1c68dc['workflowAttemptId']);return console[_0x2f29f9(0x1b2)](_0x2f29f9(0xe4)),console[_0x2f29f9(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0x1dd))+'\x20'+_0x1c68dc[_0x2f29f9(0x1da)]),console[_0x2f29f9(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0x1f6))+'\x20'+_0x1c68dc[_0x2f29f9(0x1df)]),console['error']('\x20\x20'+a26_0x5d2da8['dim'](_0x2f29f9(0x23f))+'\x20'+_0x1c68dc[_0x2f29f9(0x1c9)]),console['error']('\x20\x20'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0xf5))+'\x20'+_0x1c68dc['workflowAttemptId']),console[_0x2f29f9(0x1b2)]('\x20\x20'+_0x24d28e),console[_0x2f29f9(0x1b2)]('\x0a'+a26_0x5d2da8[_0x2f29f9(0x20f)](_0x2f29f9(0x189))+_0x2f29f9(0x1a8)+_0x1c68dc[_0x2f29f9(0x262)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0xf8);[a26_0x3ae22d(0x1a7)]='List\x20available\x20fields\x20for\x20segmentation';async[a26_0x3ae22d(0x129)](_0x2c4410){const _0x46d825=a26_0x3ae22d,{options:_0x4895ae,args:_0x241a92,tdx:_0x152737}=_0x2c4410,_0x1cbbd8=_0x241a92[0x0]||_0x4895ae[_0x46d825(0x255)];if(!_0x1cbbd8)return showParentSegmentNotSetError(_0x46d825(0x200)+_0x46d825(0x10b)),0x1;_0x4895ae[_0x46d825(0x228)]&&(console[_0x46d825(0x1b2)]('Site:\x20'+_0x4895ae['site']),console['error'](_0x46d825(0x186)+_0x1cbbd8));const _0x4559ca=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x1cbbd8+_0x46d825(0x1a3),()=>_0x152737[_0x46d825(0x251)]['listFields'](_0x1cbbd8),{'verbose':_0x4895ae[_0x46d825(0x228)]}),_0x29b226=_0x4559ca[_0x46d825(0x230)];console[_0x46d825(0x1b2)](_0x46d825(0x21d)+_0x29b226[_0x46d825(0x137)]+_0x46d825(0xf1)+(_0x29b226[_0x46d825(0x137)]!==0x1?'s':''));if(_0x4895ae[_0x46d825(0x25a)]||_0x4895ae['jsonl'])return await handleSDKOutput(_0x29b226,_0x4895ae),0x0;return displayFieldsHumanReadable(_0x29b226,_0x1cbbd8),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x23a);[a26_0x3ae22d(0x1a7)]='Show\x20parent\x20segment\x20details';async['execute'](_0x3ff969){const _0x4a86c4=a26_0x3ae22d,{options:_0x505aa0,args:_0x250c87,tdx:_0x9128ae}=_0x3ff969,_0x24513f=_0x505aa0,_0x52c888=_0x250c87[0x0]||_0x505aa0[_0x4a86c4(0x255)];if(!_0x52c888)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x4a86c4(0x265)+'Options:\x0a'+_0x4a86c4(0x24f)),0x1;_0x505aa0['verbose']&&(console['error']('Site:\x20'+_0x505aa0[_0x4a86c4(0x1e6)]),console[_0x4a86c4(0x1b2)]('Parent\x20segment:\x20'+_0x52c888));const _0x413fdd=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x52c888+_0x4a86c4(0x1a3),()=>_0x9128ae['segment'][_0x4a86c4(0x1a6)](_0x52c888),{'verbose':_0x505aa0[_0x4a86c4(0x228)]}),_0x24a432=_0x413fdd[_0x4a86c4(0x230)];if(_0x24513f[_0x4a86c4(0x134)]){const _0x1d624a=getConsoleNextUrl(_0x24513f[_0x4a86c4(0x1e6)],'/app/dw/parentSegments/'+_0x24a432['id']);return console[_0x4a86c4(0x1b2)](a26_0x5d2da8[_0x4a86c4(0xe1)]('✔')+'\x20Opening\x20'+a26_0x5d2da8['cyan'](_0x1d624a)),openBrowser(_0x1d624a),0x0;}return await handleSingleObjectOutput(_0x24a432,_0x505aa0),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x16f);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a26_0x3ae22d(0x129)](_0x4bdd7d){const _0x4541d3=a26_0x3ae22d,{options:_0xdb81a3,args:_0x151d24,tdx:_0x3f204f}=_0x4bdd7d,_0x1d1404=_0xdb81a3,_0x425be1=_0x151d24[0x0]||_0xdb81a3[_0x4541d3(0x255)];if(!_0x425be1)return showParentSegmentNotSetError(_0x4541d3(0x122)+_0x4541d3(0x1fa)+'Options:\x0a'+_0x4541d3(0xdd)),0x1;_0xdb81a3[_0x4541d3(0x228)]&&(console['error'](_0x4541d3(0x1e5)+_0xdb81a3['site']),console[_0x4541d3(0x1b2)](_0x4541d3(0x186)+_0x425be1));const _0x7991c6=await withSpinner(_0x4541d3(0x1b8)+_0x425be1+_0x4541d3(0x1a3),()=>_0x3f204f[_0x4541d3(0x251)][_0x4541d3(0x1ce)](_0x425be1),{'verbose':_0xdb81a3['verbose']}),_0x46cfba=_0x7991c6['data'],_0x33dfbc=_0x3f204f[_0x4541d3(0x251)][_0x4541d3(0x211)](_0x46cfba);if(_0x1d1404[_0x4541d3(0x10e)]){const _0xe43200=await this[_0x4541d3(0x24b)](_0x4bdd7d,_0x425be1,_0x46cfba,_0x33dfbc),_0x38d735=this[_0x4541d3(0x130)](_0xe43200);writeFileSync(_0x1d1404['output'],_0x38d735);const _0x2fa3da=_0xe43200['customers'][_0x4541d3(0x19f)][_0x4541d3(0x137)]+_0xe43200['behaviors'][_0x4541d3(0x220)]((_0xf49524,_0x5e5d41)=>_0xf49524+_0x5e5d41[_0x4541d3(0x19f)][_0x4541d3(0x137)],0x0),_0x1aa24c=_0xe43200[_0x4541d3(0xdb)]['filter'](_0x3e7d50=>_0x3e7d50[_0x4541d3(0x19f)]['length']===0x0)[_0x4541d3(0x137)];return console[_0x4541d3(0x263)](_0x4541d3(0x201)+_0x1d1404['output']),console[_0x4541d3(0x263)]('\x20\x20Database:\x20'+_0x33dfbc),console['log'](_0x4541d3(0x139)+_0xe43200[_0x4541d3(0xdb)]['length']+'\x20behaviors'),console[_0x4541d3(0x263)](_0x4541d3(0xe3)+_0x2fa3da+_0x4541d3(0x12f)),_0x1aa24c>0x0&&console[_0x4541d3(0x263)]('\x20\x20Note:\x20'+_0x1aa24c+_0x4541d3(0xd7)),0x0;}console[_0x4541d3(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4541d3(0x1c7)](_0x4541d3(0xe5))+'\x20'+a26_0x5d2da8[_0x4541d3(0x105)](_0x33dfbc));const _0x101a3c=await withSpinner(_0x4541d3(0x1fe),()=>_0x3f204f[_0x4541d3(0x251)]['getParentSQL'](_0x46cfba),{'verbose':_0xdb81a3[_0x4541d3(0x228)]});console[_0x4541d3(0x1b2)]('\x0a'+a26_0x5d2da8[_0x4541d3(0x1c7)](_0x4541d3(0xf9))+'\x20'+a26_0x5d2da8[_0x4541d3(0x20f)]('('+_0x33dfbc+'.customers)'));const _0x131d2f=await executeSchemaQuery(_0x101a3c['data'],_0x3f204f,_0xdb81a3);await handleQueryOutput(_0x131d2f,_0xdb81a3);const _0x44b5da=await withSpinner(_0x4541d3(0x1f5),()=>_0x3f204f['segment'][_0x4541d3(0x106)](_0x46cfba),{'verbose':_0xdb81a3[_0x4541d3(0x228)]});for(const _0x26b03b of _0x44b5da[_0x4541d3(0x230)]){const _0x39faba=_0x4541d3(0x138)+_0x26b03b[_0x4541d3(0x222)]()['replace'](/\s+/g,'_'),_0x1e4678='SELECT\x20*\x20FROM\x20'+_0x33dfbc+'.'+_0x39faba;console[_0x4541d3(0x1b2)]('\x0a'+a26_0x5d2da8['bold'](_0x26b03b)+'\x20'+a26_0x5d2da8[_0x4541d3(0x20f)]('('+_0x33dfbc+'.'+_0x39faba+')'));try{const _0x33d35d=await executeSchemaQuery(_0x1e4678,_0x3f204f,_0xdb81a3);await handleQueryOutput(_0x33d35d,_0xdb81a3);}catch{console[_0x4541d3(0x1b2)](a26_0x5d2da8[_0x4541d3(0xe0)](_0x4541d3(0x173)));}}return 0x0;}async['collectSchema'](_0x498499,_0x3c0153,_0xc8d586,_0x742999){const _0x455db2=a26_0x3ae22d,{options:_0x47e187,tdx:_0x1d28ce}=_0x498499,_0x4705bc=await withSpinner(_0x455db2(0x1fe),()=>_0x1d28ce[_0x455db2(0x251)][_0x455db2(0x1c2)](_0xc8d586),{'verbose':_0x47e187['verbose']}),_0x124f11=await executeSchemaQuery(_0x4705bc[_0x455db2(0x230)],_0x1d28ce,_0x47e187),_0x546cea=_0x124f11[_0x455db2(0x230)]['map'](_0x2524df=>({'name':_0x2524df[_0x455db2(0x165)],'type':_0x2524df['column_type']})),_0x38e38c=await withSpinner(_0x455db2(0x1f5),()=>_0x1d28ce['segment']['getBehaviorNames'](_0xc8d586),{'verbose':_0x47e187[_0x455db2(0x228)]}),_0x4369a5=[];for(const _0x1979f9 of _0x38e38c[_0x455db2(0x230)]){const _0x5378bf='behavior_'+_0x1979f9[_0x455db2(0x222)]()[_0x455db2(0x121)](/\s+/g,'_'),_0x32ef3e=_0x455db2(0x170)+_0x742999+'.'+_0x5378bf;let _0x3f32d2=[];try{const _0x16dbb3=await executeSchemaQuery(_0x32ef3e,_0x1d28ce,_0x47e187);_0x3f32d2=_0x16dbb3['data'][_0x455db2(0x243)](_0x33c5bf=>({'name':_0x33c5bf[_0x455db2(0x165)],'type':_0x33c5bf[_0x455db2(0x17f)]}));}catch{}_0x4369a5[_0x455db2(0x11b)]({'table':_0x5378bf,'columns':_0x3f32d2});}return{'database':_0x742999,'parent_segment':_0x3c0153,'parent_id':_0xc8d586,'customers':{'table':_0x455db2(0xf9),'columns':_0x546cea},'behaviors':_0x4369a5};}[a26_0x3ae22d(0x130)](_0x5dcc80){const _0x4ff01e=a26_0x3ae22d,_0x1dd224=_0x500b90=>{const _0x10bba9=a26_0x1528;if(_0x500b90[_0x10bba9(0x137)]===0x0)return'[]';const _0x4c2a73=_0x500b90[_0x10bba9(0x243)](_0x598033=>_0x10bba9(0x20a)+_0x598033['name']+_0x10bba9(0x15e)+_0x598033['type']+_0x10bba9(0x203));return'[\x0a'+_0x4c2a73[_0x10bba9(0x1b5)](',\x0a')+_0x10bba9(0x13d);},_0xaab6ea=_0x5dcc80['behaviors']['map'](_0x15623d=>{const _0x2d73dd=a26_0x1528;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x15623d[_0x2d73dd(0x1ae)]+_0x2d73dd(0x199)+_0x1dd224(_0x15623d[_0x2d73dd(0x19f)])[_0x2d73dd(0x121)](/^/gm,'\x20\x20')['trim']()+_0x2d73dd(0x197);})[_0x4ff01e(0x1b5)](',\x0a');return _0x4ff01e(0x142)+_0x5dcc80[_0x4ff01e(0x1f9)]+_0x4ff01e(0x166)+_0x5dcc80[_0x4ff01e(0x250)]+_0x4ff01e(0x147)+_0x5dcc80['parent_id']+_0x4ff01e(0x22d)+_0x5dcc80['customers'][_0x4ff01e(0x1ae)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x1dd224(_0x5dcc80[_0x4ff01e(0xf9)]['columns'])['replace'](/^/gm,'\x20\x20')[_0x4ff01e(0x157)]()+_0x4ff01e(0x169)+_0xaab6ea+_0x4ff01e(0x196);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x1b4);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1bd);async[a26_0x3ae22d(0x129)](_0x271396){const _0x184535=a26_0x3ae22d,{options:_0x1f088d,args:_0x2bc9bf,tdx:_0x3f977f}=_0x271396,_0x418801=_0x2bc9bf[0x0]||_0x1f088d[_0x184535(0x255)];if(!_0x418801)return showParentSegmentNotSetError(_0x184535(0x101)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x1f088d[_0x184535(0x228)]&&(console[_0x184535(0x1b2)](_0x184535(0x1e5)+_0x1f088d[_0x184535(0x1e6)]),console[_0x184535(0x1b2)](_0x184535(0x186)+_0x418801));const _0xd944b1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x418801+_0x184535(0x1a3),()=>_0x3f977f[_0x184535(0x251)]['resolveParentId'](_0x418801),{'verbose':_0x1f088d[_0x184535(0x228)]}),_0x4dad97=_0xd944b1[_0x184535(0x230)],_0x591ff4=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x418801+_0x184535(0x1a3),()=>_0x3f977f[_0x184535(0x251)]['getParentSQL'](_0x4dad97),{'verbose':_0x1f088d[_0x184535(0x228)]}),_0x4ed67d=_0x591ff4[_0x184535(0x230)];return _0x1f088d[_0x184535(0x210)]===_0x184535(0x25a)||_0x1f088d[_0x184535(0x210)]===_0x184535(0x117)?await handleSDKOutput([{'sql':_0x4ed67d}],_0x1f088d):console[_0x184535(0x263)](_0x4ed67d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x179);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1d5);async['execute'](_0x511ba1){const _0x2bea35=a26_0x3ae22d,{options:_0x3b91d5,args:_0x28b3b4,tdx:_0x4330c9}=_0x511ba1,_0x30cacb=_0x28b3b4[0x0]||_0x3b91d5[_0x2bea35(0x255)];if(!_0x30cacb)return showParentSegmentNotSetError(_0x2bea35(0x17b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x3b91d5[_0x2bea35(0x228)]&&(console[_0x2bea35(0x1b2)]('Site:\x20'+_0x3b91d5[_0x2bea35(0x1e6)]),console['error']('Parent\x20segment:\x20'+_0x30cacb));const _0x47b6e3=await withSpinner(_0x2bea35(0x1b8)+_0x30cacb+_0x2bea35(0x1a3),()=>_0x4330c9[_0x2bea35(0x251)][_0x2bea35(0x1ce)](_0x30cacb),{'verbose':_0x3b91d5[_0x2bea35(0x228)]}),_0x3aaa7b=_0x47b6e3[_0x2bea35(0x230)],_0x45d873=await withSpinner(_0x2bea35(0x172)+_0x30cacb+_0x2bea35(0x1a3),()=>_0x4330c9[_0x2bea35(0x251)][_0x2bea35(0x1c2)](_0x3aaa7b),{'verbose':_0x3b91d5['verbose']});let _0x458a5d=_0x45d873[_0x2bea35(0x230)];const _0x22a2c6=resolveLimit(_0x3b91d5[_0x2bea35(0xf3)],DEFAULT_DISPLAY_LIMIT),_0x5c69ce=/\bLIMIT\s+\d+/i['test'](_0x458a5d);!_0x5c69ce&&(_0x458a5d=_0x458a5d['trim']()[_0x2bea35(0x121)](/;+$/,''),_0x458a5d=_0x2bea35(0x1cc)+_0x458a5d+_0x2bea35(0x133)+_0x22a2c6);_0x3b91d5[_0x2bea35(0x228)]&&console[_0x2bea35(0x1b2)]('SQL\x20query:\x0a'+_0x458a5d);const _0x2f7295=await withProgressSpinner(_0x2bea35(0xde),async _0x49cb35=>{const _0x2c08a9=_0x2bea35,_0x164490=await _0x4330c9[_0x2c08a9(0x1cb)]['execute'](_0x458a5d,{'catalog':'td','schema':_0x2c08a9(0x193),'onJobId':_0x4d3af7=>{const _0x326cda=_0x2c08a9;_0x49cb35[_0x326cda(0x24a)](_0x4d3af7);}});return _0x164490;},{'verbose':_0x3b91d5['verbose']}),_0x16c1ee=_0x2f7295['data'],_0x68eb87=_0x16c1ee[_0x2bea35(0x19d)]?_0x2bea35(0x1f3)+_0x16c1ee[_0x2bea35(0x19d)]+']':'';return console[_0x2bea35(0x1b2)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x16c1ee[_0x2bea35(0x1ed)][_0x2bea35(0x1d4)][_0x2bea35(0x1fb)]()+_0x2bea35(0x20c)+(_0x2bea35(0x159)+formatElapsed(_0x16c1ee[_0x2bea35(0x1ed)][_0x2bea35(0xd6)])+_0x68eb87)),await handleQueryOutput(_0x16c1ee,_0x3b91d5),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a26_0x3ae22d(0x156);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x204);async[a26_0x3ae22d(0x129)](_0x2b1704){const _0x171083=a26_0x3ae22d,{options:_0x415f52,args:_0x4a02ab,tdx:_0x133bc3}=_0x2b1704,_0x4a2d51=_0x4a02ab[0x0],_0x21899f=await withSpinner(_0x4a2d51?_0x171083(0x1f2)+_0x4a2d51+_0x171083(0x1a3):_0x171083(0x1ec),()=>_0x133bc3[_0x171083(0x1b0)][_0x171083(0x167)](),{'verbose':_0x415f52['verbose']});let _0x2d3494=_0x21899f[_0x171083(0x230)][_0x171083(0x221)](_0x5157e7=>_0x5157e7[_0x171083(0x17e)]);if(_0x4a2d51){const _0x854ccf=_0x4a2d51['replace'](/[.+^${}()|[\]\\]/g,_0x171083(0x135))[_0x171083(0x121)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x46749f=new RegExp('^'+_0x854ccf+'$','i');_0x2d3494=_0x2d3494[_0x171083(0x221)](_0x295685=>_0x46749f[_0x171083(0x1a2)](_0x295685[_0x171083(0x1db)]));}_0x2d3494[_0x171083(0x256)]((_0x23b87b,_0x11e62b)=>_0x23b87b[_0x171083(0x1db)][_0x171083(0x13f)](_0x11e62b[_0x171083(0x1db)])),console[_0x171083(0x1b2)](_0x171083(0x21d)+_0x2d3494[_0x171083(0x137)]+_0x171083(0x1a0)+(_0x2d3494[_0x171083(0x137)]!==0x1?'s':''));const _0x376ea1=_0x688d28=>{const _0x50411a=_0x171083;return getConsoleNextUrl(_0x415f52['site'],_0x50411a(0x18b)+_0x688d28);};if(_0x415f52['format']===_0x171083(0x25a)||_0x415f52[_0x171083(0x210)]===_0x171083(0x117)){const _0x159ff=_0x2d3494['map'](_0x357bdd=>({..._0x357bdd,'url':_0x376ea1(_0x357bdd['id'])}));await handleSDKOutput(_0x159ff,_0x415f52);}else{if(_0x2d3494[_0x171083(0x137)]===0x0)console[_0x171083(0x263)](_0x171083(0x195));else for(const _0x148b1a of _0x2d3494){const _0x248b5a=_0x148b1a[_0x171083(0x22c)]?a26_0x5d2da8[_0x171083(0x20f)]('\x20('+formatRows(_0x148b1a[_0x171083(0x22c)])+')'):'',_0x1e08c3=hyperlink(_0x148b1a[_0x171083(0x1db)],_0x376ea1(_0x148b1a['id']));console[_0x171083(0x263)]('⚡\x20'+_0x1e08c3+_0x248b5a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x1d6);[a26_0x3ae22d(0x1a7)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a26_0x3ae22d(0x129)](_0x1e9cbe){const _0x2c75f2=a26_0x3ae22d,{options:_0x1639e1,args:_0xabb702,tdx:_0x2369eb}=_0x1e9cbe,_0x1fcf5d=_0xabb702[0x0]||_0x1639e1[_0x2c75f2(0x255)];if(!_0x1fcf5d)return showParentSegmentNotSetError(_0x2c75f2(0x215)+_0x2c75f2(0x21a)),0x1;const _0x20051b=resolveYamlFile(_0x1fcf5d);if(!existsSync(_0x20051b))return showFileNotFoundError(_0x20051b,_0x1fcf5d),0x1;let _0x222be9;try{_0x222be9=readFileSync(_0x20051b,_0x2c75f2(0x18c));}catch(_0x4ee3df){const _0xe88cb5=_0x4ee3df instanceof Error?_0x4ee3df[_0x2c75f2(0x162)]:String(_0x4ee3df);return console['error']('Error\x20reading\x20file:\x20'+_0xe88cb5),0x1;}const _0x36eacb=createCommandSpinner(a26_0x5d2da8['dim'](_0x2c75f2(0x132)),{'verbose':_0x1639e1[_0x2c75f2(0x228)]});_0x36eacb[_0x2c75f2(0x21e)]();const _0x4c8d76={'realtime':!![],'onProgress':_0x417c4f=>{const _0x340cb0=_0x2c75f2;_0x36eacb[_0x340cb0(0x194)]=formatProgressMessage(_0x417c4f);}};let _0x416889;try{_0x416889=await _0x2369eb[_0x2c75f2(0x251)]['validateParentYaml'](_0x222be9,_0x4c8d76),_0x36eacb[_0x2c75f2(0x1d3)]();}catch(_0x408d61){_0x36eacb[_0x2c75f2(0x1d3)]();throw _0x408d61;}console[_0x2c75f2(0x1b2)]('\x0a'+a26_0x5d2da8[_0x2c75f2(0x1c7)](_0x2c75f2(0x11a))+'\x20'+_0x416889['name']),console[_0x2c75f2(0x1b2)]('═'[_0x2c75f2(0x175)](0x3c)),displayRealtimeValidation(_0x416889),console['error']('─'['repeat'](0x3c));if(_0x416889[_0x2c75f2(0x1ea)][_0x2c75f2(0x137)]>0x0){console['error']('\x0a'+a26_0x5d2da8[_0x2c75f2(0x19a)](_0x2c75f2(0x187)));for(const _0x9803e7 of _0x416889['errors']){console[_0x2c75f2(0x1b2)]('\x20\x20'+a26_0x5d2da8[_0x2c75f2(0x19a)]('•')+'\x20'+_0x9803e7);}}return _0x416889[_0x2c75f2(0x1e4)]&&console[_0x2c75f2(0x1b2)]('\x0a'+a26_0x5d2da8[_0x2c75f2(0xe1)]('✔')+_0x2c75f2(0x236)),_0x416889[_0x2c75f2(0x1e4)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x3ae22d(0x1db)]=a26_0x3ae22d(0x1a4);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x252);async[a26_0x3ae22d(0x129)](_0x400dc1){const _0x5dbce5=a26_0x3ae22d,{options:_0x468822,args:_0x5d921f,tdx:_0x395047}=_0x400dc1,_0x30df4f=_0x5d921f[0x0]||_0x468822[_0x5dbce5(0x255)];if(!_0x30df4f)return showParentSegmentNotSetError(_0x5dbce5(0x1f0)+_0x5dbce5(0xeb)),0x1;const _0x28ef6a=await withSpinner(_0x5dbce5(0x1b8)+_0x30df4f+_0x5dbce5(0x1a3),()=>_0x395047[_0x5dbce5(0x251)]['resolveParentId'](_0x30df4f),{'verbose':_0x468822[_0x5dbce5(0x228)]}),_0x45c500=_0x28ef6a[_0x5dbce5(0x230)],_0x2104c4=await withSpinner(_0x5dbce5(0x160)+_0x30df4f+_0x5dbce5(0x1a3),()=>_0x395047[_0x5dbce5(0x1f1)][_0x5dbce5(0x167)](_0x45c500),{'verbose':_0x468822[_0x5dbce5(0x228)]}),_0x33b4dc=_0x2104c4[_0x5dbce5(0x230)];console[_0x5dbce5(0x1b2)](_0x5dbce5(0x21d)+_0x33b4dc[_0x5dbce5(0x137)]+_0x5dbce5(0x249)+(_0x33b4dc['length']!==0x1?'s':''));if(_0x468822[_0x5dbce5(0x210)]===_0x5dbce5(0x25a)||_0x468822['format']===_0x5dbce5(0x117))await handleSDKOutput(_0x33b4dc,_0x468822);else{if(_0x33b4dc[_0x5dbce5(0x137)]===0x0)console[_0x5dbce5(0x263)](_0x5dbce5(0xea)),console[_0x5dbce5(0x1b2)](a26_0x5d2da8['cyan']('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x2ec271 of _0x33b4dc){const _0x7278b3=_0x2ec271['sections']?.[_0x5dbce5(0x137)]||0x0,_0xbbc733=_0x2ec271[_0x5dbce5(0x253)]?a26_0x5d2da8[_0x5dbce5(0x20f)](_0x5dbce5(0x1b3)+_0x2ec271[_0x5dbce5(0x253)]):'',_0xb36246=a26_0x5d2da8[_0x5dbce5(0x20f)]('\x20('+_0x7278b3+_0x5dbce5(0x100)+(_0x7278b3!==0x1?'s':'')+')');console[_0x5dbce5(0x263)]('\x20\x20'+_0x2ec271['name']+_0xbbc733+_0xb36246),_0x2ec271[_0x5dbce5(0x1a7)]&&console[_0x5dbce5(0x263)]('\x20\x20\x20\x20'+a26_0x5d2da8['dim'](_0x2ec271['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a26_0x3ae22d(0x1bf);[a26_0x3ae22d(0x1a7)]=a26_0x3ae22d(0x1d9);async['execute'](_0x2d72ea){const _0x215cf8=a26_0x3ae22d,{options:_0x4e06e1,args:_0x4a0983}=_0x2d72ea,_0x231664=_0x4a0983[0x0]||_0x4e06e1['parentSegment'];if(!_0x231664)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a'+_0x215cf8(0x233)),0x1;const _0x49a5fa=resolveYamlFile(_0x231664);if(!existsSync(_0x49a5fa))return showFileNotFoundError(_0x49a5fa,_0x231664),0x1;let _0x4a4342;try{_0x4a4342=readFileSync(_0x49a5fa,_0x215cf8(0x18c));}catch(_0x3c3821){const _0x13d7b8=_0x3c3821 instanceof Error?_0x3c3821[_0x215cf8(0x162)]:String(_0x3c3821);return console[_0x215cf8(0x1b2)]('Error\x20reading\x20file:\x20'+_0x13d7b8),0x1;}let _0x105d4e;try{_0x105d4e=parseDef(_0x4a4342);}catch(_0x17bfcf){const _0x5c8000=_0x17bfcf instanceof Error?_0x17bfcf[_0x215cf8(0x162)]:String(_0x17bfcf);return console['error'](a26_0x5d2da8[_0x215cf8(0x19a)]('Error\x20parsing\x20YAML:\x20'+_0x5c8000)),0x1;}if(_0x105d4e[_0x215cf8(0x257)]&&_0x105d4e[_0x215cf8(0x257)][_0x215cf8(0x137)]>0x0)return console['error'](a26_0x5d2da8[_0x215cf8(0xe0)](_0x215cf8(0x22b)+_0x49a5fa)),console['error'](a26_0x5d2da8[_0x215cf8(0x20f)](_0x215cf8(0x13c)+_0x105d4e[_0x215cf8(0x257)][_0x215cf8(0x137)]+'\x20service(s)\x20configured')),0x1;!_0x105d4e[_0x215cf8(0x1b0)]&&(_0x105d4e['realtime']={'events':[{'name':_0x215cf8(0x216),'source_table':'<database>.<table>'}],'attributes':[{'name':'last_page_viewed','type':_0x215cf8(0xf2)}],'id_stitching':{'primary_key':_0x105d4e[_0x215cf8(0x22a)][_0x215cf8(0x1ae)]===_0x215cf8(0xf9)?_0x215cf8(0x23b):_0x215cf8(0x20b)}});_0x105d4e['personalization_services']=[{'name':_0x215cf8(0x198),'description':'Personalization\x20service\x20description','trigger_event':_0x215cf8(0x216),'sections':[{'name':_0x215cf8(0x19c),'criteria':_0x215cf8(0x14c),'attributes':['last_page_viewed']}]}];const _0x568515=serializeDef(_0x105d4e);return writeFileSync(_0x49a5fa,_0x568515,_0x215cf8(0x18c)),console[_0x215cf8(0x1b2)](a26_0x5d2da8[_0x215cf8(0xe1)]('✔')+_0x215cf8(0x22e)+a26_0x5d2da8[_0x215cf8(0x105)](_0x49a5fa)),(!_0x105d4e[_0x215cf8(0x1b0)]||_0x4a4342['indexOf'](_0x215cf8(0x1e3))===-0x1)&&console[_0x215cf8(0x1b2)](a26_0x5d2da8['green']('✔')+_0x215cf8(0x1d8)),console[_0x215cf8(0x1b2)]('\x0a'+a26_0x5d2da8[_0x215cf8(0x20f)](_0x215cf8(0x11d))),console[_0x215cf8(0x1b2)](_0x215cf8(0x209)+_0x49a5fa+_0x215cf8(0x1c6)),console[_0x215cf8(0x1b2)]('\x20\x202.\x20Run\x20'+a26_0x5d2da8[_0x215cf8(0x20f)](_0x215cf8(0x21f)+_0x231664)+_0x215cf8(0x1e0)),0x0;}}
1
+ const a26_0x1bfad6=a26_0x3af9;(function(_0x41ed82,_0x1be956){const _0x769e40=a26_0x3af9,_0x9c1f81=_0x41ed82();while(!![]){try{const _0x17e9c2=-parseInt(_0x769e40(0x1bb))/0x1*(parseInt(_0x769e40(0x293))/0x2)+-parseInt(_0x769e40(0x14c))/0x3+parseInt(_0x769e40(0x16a))/0x4*(parseInt(_0x769e40(0x1a4))/0x5)+parseInt(_0x769e40(0x14e))/0x6*(-parseInt(_0x769e40(0x25f))/0x7)+-parseInt(_0x769e40(0x13b))/0x8*(-parseInt(_0x769e40(0x12c))/0x9)+-parseInt(_0x769e40(0x258))/0xa+parseInt(_0x769e40(0x284))/0xb;if(_0x17e9c2===_0x1be956)break;else _0x9c1f81['push'](_0x9c1f81['shift']());}catch(_0x49f0d3){_0x9c1f81['push'](_0x9c1f81['shift']());}}}(a26_0x239a,0x37111));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x27b002 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_0x14b5c2 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_0x1bfad6(0x276),LEGACY_PARENT_SEGMENT_DIR=a26_0x1bfad6(0x266);function openBrowser(_0x17be18){const _0x4bdb97=a26_0x1bfad6,_0x170fa2=process[_0x4bdb97(0x24b)],_0x1b4551=_0x170fa2==='darwin'?'open':_0x170fa2==='win32'?'start':'xdg-open';spawn(_0x1b4551,[_0x17be18],{'detached':!![],'stdio':_0x4bdb97(0x1dc)})[_0x4bdb97(0x171)]();}function migrateLegacyDirectory(){const _0x5270bd=a26_0x1bfad6;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4c2d3e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4c2d3e[_0x5270bd(0x1f6)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5270bd(0x280)](a26_0x14b5c2[_0x5270bd(0x1b7)](_0x5270bd(0x279)+LEGACY_PARENT_SEGMENT_DIR+_0x5270bd(0x147)+PARENT_SEGMENT_DIR+_0x5270bd(0x160))),console[_0x5270bd(0x280)](a26_0x14b5c2['dim'](_0x5270bd(0x24c)+LEGACY_PARENT_SEGMENT_DIR+_0x5270bd(0x206))),![];console[_0x5270bd(0x280)](a26_0x14b5c2[_0x5270bd(0x1b7)](_0x5270bd(0x1de)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a26_0x14b5c2[_0x5270bd(0x1ba)](_0x5270bd(0x1eb)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3251ec){const _0x2dfdf4=_0x3251ec instanceof Error?_0x3251ec[_0x5270bd(0x247)]:String(_0x3251ec);return console[_0x5270bd(0x280)](a26_0x14b5c2[_0x5270bd(0x25d)](_0x5270bd(0x21e)+_0x2dfdf4+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x1bfad6(0x28c)](_0x34599e){return migrateLegacyDirectory(),super['run'](_0x34599e);}}function resolveYamlFile(_0x1cf004){const _0x1e3920=a26_0x1bfad6;if(_0x1cf004[_0x1e3920(0x15c)]('.yml')||_0x1cf004[_0x1e3920(0x15c)]('.yaml'))return _0x1cf004;return a26_0x27b002[_0x1e3920(0x11c)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1cf004)+_0x1e3920(0x15a));}function formatProgressMessage(_0x5168a6){const _0x3d142c=a26_0x1bfad6,_0x22038d=_0x5168a6['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x22038d){const [,_0x2f6d0c,_0x992d7a,_0xaaecfc='']=_0x22038d;return a26_0x14b5c2[_0x3d142c(0x22d)](_0x2f6d0c+':')+'\x20'+_0x992d7a+a26_0x14b5c2[_0x3d142c(0x22d)](_0xaaecfc);}return a26_0x14b5c2['dim'](_0x5168a6);}function showFileNotFoundError(_0x23ca9c,_0x3ff64){const _0x50316c=a26_0x1bfad6;console[_0x50316c(0x280)](a26_0x14b5c2['red'](_0x50316c(0x232)+_0x23ca9c+'\x0a')),console[_0x50316c(0x280)](a26_0x14b5c2[_0x50316c(0x260)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x3ff64+_0x50316c(0x167)));}function displayRealtimeValidation(_0x26da00){const _0x35871d=a26_0x1bfad6;if(!_0x26da00[_0x35871d(0x131)])return;const _0x2e4141=_0x26da00[_0x35871d(0x131)],_0x196c03=_0x2e4141[_0x35871d(0x1b1)]?a26_0x14b5c2[_0x35871d(0x1ba)](_0x35871d(0x1d3)):a26_0x14b5c2[_0x35871d(0x1b7)]('⚡\x20Not\x20enabled');console[_0x35871d(0x280)]('\x0a'+a26_0x14b5c2[_0x35871d(0x22d)](_0x35871d(0x200))+'\x20'+_0x196c03);if(_0x2e4141[_0x35871d(0x134)]&&_0x2e4141[_0x35871d(0x134)][_0x35871d(0x153)]>0x0){console[_0x35871d(0x280)]('\x20\x20'+a26_0x14b5c2[_0x35871d(0x22d)](_0x35871d(0x140))+'\x20'+_0x2e4141[_0x35871d(0x134)][_0x35871d(0x153)]+_0x35871d(0x1c8));for(const _0x5c5874 of _0x2e4141[_0x35871d(0x134)]){const _0x38335d=_0x5c5874['sourceTableValid']===![]?a26_0x14b5c2[_0x35871d(0x25d)]('✘'):a26_0x14b5c2['green']('✔');console['error']('\x20\x20\x20\x20'+_0x38335d+'\x20'+_0x5c5874[_0x35871d(0x128)]),_0x5c5874[_0x35871d(0x1bc)]&&console[_0x35871d(0x280)]('\x20\x20\x20\x20\x20\x20'+a26_0x14b5c2[_0x35871d(0x25d)](_0x5c5874[_0x35871d(0x1bc)]));}}if(_0x2e4141[_0x35871d(0x1be)]&&_0x2e4141[_0x35871d(0x1be)][_0x35871d(0x153)]>0x0){console[_0x35871d(0x280)]('\x20\x20'+a26_0x14b5c2[_0x35871d(0x22d)](_0x35871d(0x1b2))+'\x20'+_0x2e4141[_0x35871d(0x1be)][_0x35871d(0x153)]+_0x35871d(0x1c8));for(const _0x3ba167 of _0x2e4141[_0x35871d(0x1be)]){const _0x32e052=_0x3ba167[_0x35871d(0x1fc)]?a26_0x14b5c2[_0x35871d(0x1ba)]('✔'):a26_0x14b5c2[_0x35871d(0x25d)]('✘');console[_0x35871d(0x280)](_0x35871d(0x219)+_0x32e052+'\x20'+_0x3ba167[_0x35871d(0x128)]+'\x20'+a26_0x14b5c2[_0x35871d(0x22d)]('('+_0x3ba167[_0x35871d(0x11f)]+')'));}}if(_0x2e4141[_0x35871d(0x11b)]){const _0x3c4558=_0x2e4141[_0x35871d(0x11b)][_0x35871d(0x1f5)]?.['length']?_0x35871d(0x15e)+_0x2e4141[_0x35871d(0x11b)][_0x35871d(0x1f5)][_0x35871d(0x11c)](',\x20')+']':'';console['error']('\x20\x20'+a26_0x14b5c2[_0x35871d(0x22d)](_0x35871d(0x178))+'\x20'+_0x2e4141[_0x35871d(0x11b)][_0x35871d(0x11d)]+_0x3c4558);}if(_0x2e4141[_0x35871d(0x1e8)]&&_0x2e4141[_0x35871d(0x1e8)][_0x35871d(0x153)]>0x0){console[_0x35871d(0x280)]('\x20\x20'+a26_0x14b5c2[_0x35871d(0x22d)](_0x35871d(0x18d))+'\x20'+_0x2e4141[_0x35871d(0x1e8)][_0x35871d(0x153)]+_0x35871d(0x239)+(_0x2e4141['personalizationServices'][_0x35871d(0x153)]!==0x1?'s':''));for(const _0x25b5a7 of _0x2e4141[_0x35871d(0x1e8)]){console[_0x35871d(0x280)](_0x35871d(0x21f)+_0x25b5a7[_0x35871d(0x128)]);}}}function showParentSegmentNotSetError(_0x407fbe){const _0x212167=a26_0x1bfad6;console['error'](a26_0x14b5c2['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x212167(0x280)](_0x407fbe);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x1bfad6(0x128)]='segment:parent:list';[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x275);async[a26_0x1bfad6(0x16e)](_0x218704){const _0x49d454=a26_0x1bfad6,{options:_0x59cb6e,args:_0x4c8147,tdx:_0x179465}=_0x218704,_0x2768e9=_0x4c8147[0x0];_0x59cb6e[_0x49d454(0x14a)]&&(console[_0x49d454(0x280)](_0x49d454(0x1e1)+_0x59cb6e[_0x49d454(0x141)]),_0x2768e9&&console[_0x49d454(0x280)](_0x49d454(0x18a)+_0x2768e9));const _0x2f1849=await withSpinner(_0x2768e9?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x2768e9+'\x27...':'Listing\x20parent\x20segments...',()=>_0x179465[_0x49d454(0x28e)]['listParents'](),{'verbose':_0x59cb6e[_0x49d454(0x14a)]});let _0x3a299b=_0x2f1849[_0x49d454(0x282)];if(_0x2768e9){const _0x2b135d=_0x2768e9[_0x49d454(0x271)](/[.+^${}()|[\]\\]/g,_0x49d454(0x1fa))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0xea125a=new RegExp('^'+_0x2b135d+'$','i');_0x3a299b=_0x3a299b[_0x49d454(0x117)](_0x1e56c6=>_0xea125a[_0x49d454(0x130)](_0x1e56c6[_0x49d454(0x1be)]['name']));}_0x3a299b[_0x49d454(0x294)]((_0x560529,_0x56c1da)=>_0x560529[_0x49d454(0x1be)]['name']['localeCompare'](_0x56c1da[_0x49d454(0x1be)][_0x49d454(0x128)])),console[_0x49d454(0x280)]('✔\x20Found\x20'+_0x3a299b[_0x49d454(0x153)]+_0x49d454(0x1c2)+(_0x3a299b[_0x49d454(0x153)]!==0x1?'s':''));const _0x2103fb=_0x500698=>{const _0x3628be=_0x49d454;return getConsoleNextUrl(_0x59cb6e[_0x3628be(0x141)],_0x3628be(0x1e7)+_0x500698);};if(_0x59cb6e[_0x49d454(0x13c)]==='json'||_0x59cb6e[_0x49d454(0x13c)]===_0x49d454(0x1df)){const _0x1f63dd=_0x3a299b[_0x49d454(0x257)](_0xb4825d=>({..._0xb4825d,'url':_0x2103fb(_0xb4825d['id'])}));await handleSDKOutput(_0x1f63dd,_0x59cb6e);}else{if(_0x3a299b[_0x49d454(0x153)]===0x0)_0x2768e9?console[_0x49d454(0x1e2)](_0x49d454(0x252)+_0x2768e9):console[_0x49d454(0x1e2)](_0x49d454(0x138));else for(const _0x5893a5 of _0x3a299b){const _0x4d9f53=_0x5893a5[_0x49d454(0x1be)][_0x49d454(0x1f9)]?a26_0x14b5c2['dim']('\x20('+formatRows(_0x5893a5[_0x49d454(0x1be)][_0x49d454(0x1f9)])+')'):'',_0x56995d=hyperlink(_0x5893a5['attributes'][_0x49d454(0x128)],_0x2103fb(_0x5893a5['id']));console[_0x49d454(0x1e2)](_0x49d454(0x27c)+_0x56995d+_0x4d9f53);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a26_0x1bfad6(0x201);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x1e5);async['execute'](_0x86f570){const _0x43dd79=a26_0x1bfad6,{options:_0x21c6b9,args:_0x1dcc30,tdx:_0x3eed6d}=_0x86f570;console['error'](_0x43dd79(0x281)+_0x43dd79(0x157)+_0x43dd79(0x16b));const _0x8e8cbb=_0x21c6b9;if(_0x1dcc30[_0x43dd79(0x153)]===0x0)return console['error'](a26_0x14b5c2['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x43dd79(0x280)](_0x43dd79(0x184)),0x1;const _0x428100=_0x1dcc30[0x0];if(!_0x8e8cbb[_0x43dd79(0x1e4)]||!_0x8e8cbb[_0x43dd79(0x112)])return console[_0x43dd79(0x280)](_0x43dd79(0x17f)),console['error'](_0x43dd79(0x184)),0x1;_0x8e8cbb[_0x43dd79(0x14a)]&&(console[_0x43dd79(0x280)](_0x43dd79(0x1e1)+_0x8e8cbb['site']),console[_0x43dd79(0x280)](_0x43dd79(0x180)+_0x428100),console['error']('Database:\x20'+_0x8e8cbb[_0x43dd79(0x1e4)]),console[_0x43dd79(0x280)](_0x43dd79(0x1e0)+_0x8e8cbb[_0x43dd79(0x112)]));const _0xb38e30=await loadJSONFromOptions(_0x8e8cbb[_0x43dd79(0x1be)],_0x8e8cbb[_0x43dd79(0x240)]),_0x37bf0c=await loadJSONFromOptions(_0x8e8cbb[_0x43dd79(0x1f0)],_0x8e8cbb[_0x43dd79(0x19f)]),_0x4d089f=await loadJSONFromOptions(_0x8e8cbb[_0x43dd79(0x285)],_0x8e8cbb[_0x43dd79(0x255)]),_0x9b6ae={'name':_0x428100,'description':_0x8e8cbb[_0x43dd79(0x26f)],'scheduleType':_0x8e8cbb[_0x43dd79(0x22c)],'scheduleOption':_0x8e8cbb[_0x43dd79(0x21c)],'timezone':_0x8e8cbb[_0x43dd79(0x210)],'master':{'parentDatabaseName':_0x8e8cbb[_0x43dd79(0x1e4)],'parentTableName':_0x8e8cbb['table']},'attributes':_0xb38e30,'behaviors':_0x37bf0c,'customerGroup':_0x4d089f},_0x279959=await withSpinner(_0x43dd79(0x290)+_0x428100+_0x43dd79(0x13a),()=>_0x3eed6d[_0x43dd79(0x28e)]['createParent'](_0x9b6ae),{'verbose':_0x21c6b9[_0x43dd79(0x14a)]}),_0x4f2e5e=_0x279959[_0x43dd79(0x282)];return console[_0x43dd79(0x280)](_0x43dd79(0x1c7)+_0x4f2e5e[_0x43dd79(0x128)]+'\x27\x20with\x20ID:\x20'+_0x4f2e5e['id']),await handleSDKOutput([_0x4f2e5e],_0x21c6b9),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x150);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x132);async[a26_0x1bfad6(0x16e)](_0x47c806){const _0x2ddc8e=a26_0x1bfad6,{options:_0x555787,args:_0x21e188,tdx:_0x13144e}=_0x47c806;console[_0x2ddc8e(0x280)](_0x2ddc8e(0x1aa)+_0x2ddc8e(0x157)+_0x2ddc8e(0x16b));const _0x14d669=_0x555787;if(_0x21e188[_0x2ddc8e(0x153)]===0x0)return console[_0x2ddc8e(0x280)](a26_0x14b5c2['red'](_0x2ddc8e(0x166))),console[_0x2ddc8e(0x280)](_0x2ddc8e(0x21a)),0x1;const _0x1e20bb=_0x21e188[0x0];_0x14d669[_0x2ddc8e(0x14a)]&&(console['error'](_0x2ddc8e(0x1e1)+_0x14d669[_0x2ddc8e(0x141)]),console['error'](_0x2ddc8e(0x18f)+_0x1e20bb));const _0x5f457b=await withSpinner(_0x2ddc8e(0x272)+_0x1e20bb+_0x2ddc8e(0x13a),()=>_0x13144e[_0x2ddc8e(0x28e)][_0x2ddc8e(0x27b)](_0x1e20bb),{'verbose':_0x14d669[_0x2ddc8e(0x14a)]}),_0x52a71a=_0x5f457b['data'],_0x1f1a21=await loadJSONFromOptions(_0x14d669['addAttributes'],_0x14d669[_0x2ddc8e(0x1c3)]),_0x29ce9f=await loadJSONFromOptions(_0x14d669[_0x2ddc8e(0x18e)],_0x14d669[_0x2ddc8e(0x1bd)]),_0x38872d={'name':_0x52a71a[_0x2ddc8e(0x128)],'description':_0x14d669[_0x2ddc8e(0x26f)]!==undefined?_0x14d669['description']:_0x52a71a[_0x2ddc8e(0x26f)],'scheduleType':_0x14d669['scheduleType']!==undefined?_0x14d669[_0x2ddc8e(0x22c)]:_0x52a71a[_0x2ddc8e(0x22c)],'scheduleOption':_0x14d669[_0x2ddc8e(0x21c)]!==undefined?_0x14d669[_0x2ddc8e(0x21c)]:_0x52a71a[_0x2ddc8e(0x21c)],'timezone':_0x14d669['timezone']!==undefined?_0x14d669[_0x2ddc8e(0x210)]:_0x52a71a[_0x2ddc8e(0x210)],'master':_0x52a71a[_0x2ddc8e(0x1da)],'attributes':_0x1f1a21?[..._0x52a71a['attributes']||[],..._0x1f1a21]:_0x52a71a[_0x2ddc8e(0x1be)],'behaviors':_0x29ce9f?[..._0x52a71a[_0x2ddc8e(0x1f0)]||[],..._0x29ce9f]:_0x52a71a[_0x2ddc8e(0x1f0)],'customerGroup':_0x52a71a[_0x2ddc8e(0x285)]},_0x54498e=await withSpinner(_0x2ddc8e(0x26a)+_0x1e20bb+'\x27...',()=>_0x13144e['segment'][_0x2ddc8e(0x193)](_0x1e20bb,_0x38872d),{'verbose':_0x14d669[_0x2ddc8e(0x14a)]}),_0xcccac2=_0x54498e[_0x2ddc8e(0x282)];return console[_0x2ddc8e(0x280)](_0x2ddc8e(0x264)+_0xcccac2[_0x2ddc8e(0x128)]+'\x27'),await handleSDKOutput([_0xcccac2],_0x14d669),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x26e);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x273);async['execute'](_0x94b321){const _0x3cf950=a26_0x1bfad6,{options:_0x3980ca,args:_0x5bc8f8,tdx:_0x5aad76}=_0x94b321,_0x35308e=_0x3980ca,_0xcee48b=_0x5bc8f8[0x0]||_0x3980ca['parentSegment'];if(!_0xcee48b)return showParentSegmentNotSetError(_0x3cf950(0x183)+_0x3cf950(0x261)),0x1;if(_0x35308e['use']&&_0x35308e['output'])return console[_0x3cf950(0x280)](a26_0x14b5c2[_0x3cf950(0x25d)](_0x3cf950(0x155))),console[_0x3cf950(0x280)](a26_0x14b5c2['dim'](_0x3cf950(0x15f))),console['error'](a26_0x14b5c2['dim'](_0x3cf950(0x19d)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a26_0x14b5c2[_0x3cf950(0x260)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x4179c7=_0x35308e[_0x3cf950(0x207)]||a26_0x27b002[_0x3cf950(0x11c)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xcee48b)+_0x3cf950(0x15a));_0x35308e[_0x3cf950(0x14a)]&&(console['error'](_0x3cf950(0x1e1)+_0x35308e[_0x3cf950(0x141)]),console[_0x3cf950(0x280)](_0x3cf950(0x18f)+_0xcee48b),console[_0x3cf950(0x280)](_0x3cf950(0x1d2)+_0x4179c7));const _0x14f905=await withSpinner(_0x3cf950(0x1c0)+_0xcee48b+_0x3cf950(0x13a),()=>_0x5aad76[_0x3cf950(0x28e)][_0x3cf950(0x1ee)](_0xcee48b),{'verbose':_0x35308e[_0x3cf950(0x14a)]}),_0x1407d8=_0x14f905[_0x3cf950(0x282)];if(existsSync(_0x4179c7)){const _0x356e2a=readFileSync(_0x4179c7,_0x3cf950(0x227)),_0x53b5c9=generateDiff(_0x356e2a,_0x1407d8);if(!hasChanges(_0x53b5c9))console[_0x3cf950(0x280)](a26_0x14b5c2['green']('✔')+_0x3cf950(0x211)+a26_0x14b5c2['cyan'](_0x4179c7)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x3cf950(0x234)+_0x4179c7+'\x27:'),console[_0x3cf950(0x280)]('─'['repeat'](0x3c)),console[_0x3cf950(0x280)](formatDiffWithColors(_0x53b5c9)),console[_0x3cf950(0x280)]('─'[_0x3cf950(0x12b)](0x3c));if(!_0x35308e[_0x3cf950(0x265)]){if(!isInteractive())return console['error'](a26_0x14b5c2[_0x3cf950(0x25d)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a26_0x14b5c2[_0x3cf950(0x22d)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x94573c=await confirmKey('Overwrite\x20\x27'+_0x4179c7+'\x27?');if(!_0x94573c)return console[_0x3cf950(0x280)](a26_0x14b5c2[_0x3cf950(0x1b7)]('Aborted.')),0x1;}writeFileSync(_0x4179c7,_0x1407d8,_0x3cf950(0x227)),console['error'](a26_0x14b5c2[_0x3cf950(0x1ba)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x14b5c2[_0x3cf950(0x260)](_0x4179c7));}}else{const _0x152627=a26_0x27b002[_0x3cf950(0x125)](_0x4179c7);!existsSync(_0x152627)&&mkdirSync(_0x152627,{'recursive':!![]}),writeFileSync(_0x4179c7,_0x1407d8,'utf-8'),console[_0x3cf950(0x280)](a26_0x14b5c2[_0x3cf950(0x1ba)]('✔')+_0x3cf950(0x1dd)+a26_0x14b5c2[_0x3cf950(0x260)](_0x4179c7));}return saveSessionContext({'parent_segment':_0xcee48b},_0x35308e[_0x3cf950(0x121)]),console[_0x3cf950(0x280)](a26_0x14b5c2[_0x3cf950(0x1ba)]('✔')+_0x3cf950(0x13f)+a26_0x14b5c2['dim']('parent_segment')+'\x20=\x20'+a26_0x14b5c2['cyan'](_0xcee48b)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a26_0x1bfad6(0x229);[a26_0x1bfad6(0x26f)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x1bfad6(0x16e)](_0x556dfe){const _0x4f9385=a26_0x1bfad6,{options:_0x12f99d,args:_0x5ca95d,tdx:_0x2881a4}=_0x556dfe,_0x4662da=_0x12f99d,_0x409539=_0x5ca95d[0x0]||_0x12f99d[_0x4f9385(0x289)];if(!_0x409539)return showParentSegmentNotSetError(_0x4f9385(0x127)+_0x4f9385(0x21d)),0x1;const _0x5021f6=resolveYamlFile(_0x409539);if(!existsSync(_0x5021f6))return showFileNotFoundError(_0x5021f6,_0x409539),0x1;_0x4662da[_0x4f9385(0x14a)]&&(console['error']('Site:\x20'+_0x4662da[_0x4f9385(0x141)]),console[_0x4f9385(0x280)](_0x4f9385(0x190)+_0x5021f6));let _0x17c51f;try{_0x17c51f=readFileSync(_0x5021f6,_0x4f9385(0x227));}catch(_0x33adf3){const _0x37e9af=_0x33adf3 instanceof Error?_0x33adf3[_0x4f9385(0x247)]:String(_0x33adf3);return console[_0x4f9385(0x280)](_0x4f9385(0x250)+_0x37e9af),0x1;}const _0x24cff2=await withSpinner('Analyzing\x20changes...',()=>_0x2881a4['segment']['pushParentYaml'](_0x17c51f),{'verbose':_0x4662da[_0x4f9385(0x14a)]}),_0x491186=_0x24cff2[_0x4f9385(0x282)],{isNew:_0x336ef0,name:_0x4493aa,hasChanges:_0x2c8391,diffFormatted:_0x33dc55}=_0x491186;if(!_0x2c8391)return console[_0x4f9385(0x280)](_0x4f9385(0x27d)+_0x4493aa+_0x4f9385(0x17d)),0x0;_0x336ef0?console[_0x4f9385(0x280)](_0x4f9385(0x1f1)+_0x4493aa+'\x27:'):console[_0x4f9385(0x280)](_0x4f9385(0x149)+_0x4493aa+'\x27:');console[_0x4f9385(0x280)]('─'[_0x4f9385(0x12b)](0x3c)),console[_0x4f9385(0x280)](_0x33dc55),console[_0x4f9385(0x280)]('─'[_0x4f9385(0x12b)](0x3c));const _0x28fb66=_0x336ef0?_0x4f9385(0x1d5)+_0x4493aa+'\x27?':_0x4f9385(0x231)+_0x4493aa+'\x27?';if(!_0x4662da[_0x4f9385(0x265)]){if(!isInteractive())return console[_0x4f9385(0x280)](a26_0x14b5c2['red']('\x0aError:'),_0x4f9385(0x126)),console['error'](a26_0x14b5c2[_0x4f9385(0x22d)](_0x4f9385(0x23d))),0x1;const _0x363eda=await confirmKey(_0x28fb66);if(!_0x363eda)return console[_0x4f9385(0x280)](a26_0x14b5c2[_0x4f9385(0x1b7)](_0x4f9385(0x254))),0x1;}const _0x195b11=_0x336ef0?_0x4f9385(0x23e):_0x4f9385(0x220),_0x5dec84=await withSpinner(_0x195b11+_0x4f9385(0x12d)+_0x4493aa+_0x4f9385(0x13a),()=>_0x491186['apply'](),{'verbose':_0x4662da[_0x4f9385(0x14a)]}),_0x337cf6=_0x5dec84['data'],_0x5a70d2=getConsoleNextUrl(_0x4662da[_0x4f9385(0x141)],_0x4f9385(0x1e7)+_0x337cf6['id']),_0x2d6ff8=_0x336ef0?_0x4f9385(0x288):'Updated';return console[_0x4f9385(0x280)]('✔\x20'+_0x2d6ff8+_0x4f9385(0x12d)+_0x337cf6[_0x4f9385(0x128)]+'\x27'),console[_0x4f9385(0x280)]('\x20\x20'+_0x5a70d2),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x165);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x204);async[a26_0x1bfad6(0x16e)](_0x12b40b){const _0x3244d2=a26_0x1bfad6,{options:_0x483021,args:_0x681a98,tdx:_0x4ae933}=_0x12b40b,_0x3e85ff=_0x483021,_0x2fcee7=_0x681a98[0x0]||_0x483021[_0x3244d2(0x289)];if(!_0x2fcee7)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'+_0x3244d2(0x1a0)+'Options:\x0a'+_0x3244d2(0x145)+_0x3244d2(0x189)+_0x3244d2(0x1bf)),0x1;const _0x538c0c=resolveYamlFile(_0x2fcee7);if(!existsSync(_0x538c0c))return showFileNotFoundError(_0x538c0c,_0x2fcee7),0x1;_0x3e85ff[_0x3244d2(0x14a)]&&(console[_0x3244d2(0x280)](_0x3244d2(0x1e1)+_0x3e85ff[_0x3244d2(0x141)]),console[_0x3244d2(0x280)](_0x3244d2(0x190)+_0x538c0c));let _0xdea956;try{_0xdea956=readFileSync(_0x538c0c,_0x3244d2(0x227));}catch(_0xce6c20){const _0x5b23a6=_0xce6c20 instanceof Error?_0xce6c20['message']:String(_0xce6c20);return console[_0x3244d2(0x280)](_0x3244d2(0x250)+_0x5b23a6),0x1;}const _0x9b9d67=createCommandSpinner(a26_0x14b5c2[_0x3244d2(0x22d)](_0x3244d2(0x152)),{'verbose':_0x3e85ff[_0x3244d2(0x14a)]});_0x9b9d67[_0x3244d2(0x146)]();const _0x406dc4={'onProgress':_0x4fc90e=>{const _0x8e42ce=_0x3244d2;_0x9b9d67[_0x8e42ce(0x17e)]=formatProgressMessage(_0x4fc90e);}};if(_0x3e85ff[_0x3244d2(0x1da)])_0x406dc4[_0x3244d2(0x1da)]=!![];if(_0x3e85ff['enriched'])_0x406dc4['enriched']=!![];_0x3e85ff[_0x3244d2(0x129)]&&(_0x406dc4['attribute']=_0x3e85ff[_0x3244d2(0x129)]);_0x3e85ff[_0x3244d2(0x23f)]&&(_0x406dc4[_0x3244d2(0x23f)]=_0x3e85ff['behavior']);if(_0x3e85ff['interval'])_0x406dc4[_0x3244d2(0x1ce)]=_0x3e85ff[_0x3244d2(0x1ce)];let _0x3dcf2f;try{_0x3dcf2f=await _0x4ae933['segment'][_0x3244d2(0x1ab)](_0xdea956,_0x406dc4),_0x9b9d67[_0x3244d2(0x1b8)]();}catch(_0x503875){_0x9b9d67[_0x3244d2(0x1b8)]();throw _0x503875;}const _0xb44d7f=_0x3e85ff[_0x3244d2(0x1ce)]||'-1d';return this[_0x3244d2(0x1a9)](_0x3dcf2f,_0x406dc4,_0x538c0c,_0xb44d7f),_0x3dcf2f['allValid']?0x0:0x1;}[a26_0x1bfad6(0x1a9)](_0x28c551,_0x4aa44a,_0x3caa0f,_0x1a6c22){const _0x24a243=a26_0x1bfad6;console['error']('\x0a'+a26_0x14b5c2[_0x24a243(0x274)](_0x24a243(0x159))+'\x20'+_0x28c551['name']),console[_0x24a243(0x280)]('═'[_0x24a243(0x12b)](0x3c)),this[_0x24a243(0x205)](_0x28c551);if(typeof _0x4aa44a[_0x24a243(0x129)]==='string'){this[_0x24a243(0x223)](_0x28c551),this[_0x24a243(0x277)](_0x28c551),this[_0x24a243(0x1ff)](_0x3caa0f,_0x1a6c22,'attribute',_0x4aa44a['attribute']);return;}if(_0x4aa44a['attribute']===!![]){this[_0x24a243(0x223)](_0x28c551),this[_0x24a243(0x277)](_0x28c551),this[_0x24a243(0x1ff)](_0x3caa0f,_0x1a6c22,'attributes');return;}if(typeof _0x4aa44a[_0x24a243(0x23f)]===_0x24a243(0x113)){this[_0x24a243(0x236)](_0x28c551,_0x1a6c22),this[_0x24a243(0x277)](_0x28c551),this[_0x24a243(0x1ff)](_0x3caa0f,_0x1a6c22,_0x24a243(0x23f),_0x4aa44a[_0x24a243(0x23f)]);return;}if(_0x4aa44a['behavior']===!![]){this[_0x24a243(0x236)](_0x28c551,_0x1a6c22),this[_0x24a243(0x277)](_0x28c551),this[_0x24a243(0x1ff)](_0x3caa0f,_0x1a6c22,_0x24a243(0x1f0));return;}this[_0x24a243(0x223)](_0x28c551),this['displayBehaviorsStats'](_0x28c551,_0x1a6c22),this[_0x24a243(0x24a)](_0x28c551),this[_0x24a243(0x277)](_0x28c551),this[_0x24a243(0x1ff)](_0x3caa0f,_0x1a6c22,'all');}[a26_0x1bfad6(0x24a)](_0x17b6b9){displayRealtimeValidation(_0x17b6b9);}[a26_0x1bfad6(0x1ff)](_0x1588e0,_0x1e21bc,_0xd3ada1,_0x23009f){const _0xf3e416=a26_0x1bfad6;console[_0xf3e416(0x280)]('\x0a'+a26_0x14b5c2['dim'](_0xf3e416(0x1a5)));const _0x29d076=_0x1e21bc!==_0xf3e416(0x214)?_0xf3e416(0x1a8)+_0x1e21bc:'';if(_0xd3ada1===_0xf3e416(0x129)&&_0x23009f)console[_0xf3e416(0x280)]('\x20\x20'+a26_0x14b5c2[_0xf3e416(0x22d)](_0xf3e416(0x295)+_0x1588e0+_0xf3e416(0x1ef)+_0x23009f+'\x22'+_0x29d076));else{if(_0xd3ada1===_0xf3e416(0x23f)&&_0x23009f)console[_0xf3e416(0x280)]('\x20\x20'+a26_0x14b5c2[_0xf3e416(0x22d)](_0xf3e416(0x295)+_0x1588e0+_0xf3e416(0x115)+_0x23009f+'\x22'+_0x29d076));else(_0xd3ada1===_0xf3e416(0x1be)||_0xd3ada1===_0xf3e416(0x28a))&&console[_0xf3e416(0x280)]('\x20\x20'+a26_0x14b5c2[_0xf3e416(0x22d)](_0xf3e416(0x295)+_0x1588e0+_0xf3e416(0x1b0)+_0x29d076));}(_0xd3ada1==='behaviors'||_0xd3ada1===_0xf3e416(0x28a))&&console[_0xf3e416(0x280)]('\x20\x20'+a26_0x14b5c2[_0xf3e416(0x22d)](_0xf3e416(0x295)+_0x1588e0+_0xf3e416(0x20f)+_0x29d076)),_0xd3ada1===_0xf3e416(0x28a)&&console[_0xf3e416(0x280)]('\x20\x20'+a26_0x14b5c2['dim'](_0xf3e416(0x295)+_0x1588e0+_0xf3e416(0x15d)+_0x29d076));}[a26_0x1bfad6(0x205)](_0x14aa25){const _0x5d94f3=a26_0x1bfad6,{master:_0xe75c4c}=_0x14aa25,_0x36c6ea=_0xe75c4c[_0x5d94f3(0x173)]?a26_0x14b5c2[_0x5d94f3(0x1ba)]('✔'):a26_0x14b5c2[_0x5d94f3(0x25d)]('✘');console['error']('\x0a'+a26_0x14b5c2['dim']('Master\x20Table')),console[_0x5d94f3(0x280)](_0x36c6ea+'\x20'+a26_0x14b5c2[_0x5d94f3(0x274)](_0xe75c4c[_0x5d94f3(0x1e4)]+'.'+_0xe75c4c['table'])),_0xe75c4c[_0x5d94f3(0x173)]?_0xe75c4c[_0x5d94f3(0x296)]!==undefined&&console[_0x5d94f3(0x280)]('\x20\x20'+a26_0x14b5c2[_0x5d94f3(0x22d)]('Rows:')+'\x20'+a26_0x14b5c2[_0x5d94f3(0x260)](formatRows(_0xe75c4c['rowCount']))):console[_0x5d94f3(0x280)]('\x20\x20'+a26_0x14b5c2['red'](_0x5d94f3(0x144))+'\x20'+_0xe75c4c[_0x5d94f3(0x1a1)]);}[a26_0x1bfad6(0x223)](_0x4dcb2a){const _0x57b6a1=a26_0x1bfad6;if(_0x4dcb2a[_0x57b6a1(0x1be)][_0x57b6a1(0x153)]===0x0)return;console[_0x57b6a1(0x280)]('\x0a'+a26_0x14b5c2[_0x57b6a1(0x22d)](_0x57b6a1(0x248)));for(const _0x511e09 of _0x4dcb2a['attributes']){const _0xf5f8a8=_0x511e09[_0x57b6a1(0x173)]?a26_0x14b5c2[_0x57b6a1(0x1ba)]('✔'):a26_0x14b5c2['red']('✘');let _0x155a66='';if(_0x511e09[_0x57b6a1(0x173)]&&_0x511e09[_0x57b6a1(0x182)]!==undefined&&_0x511e09['coveragePercent']!==undefined){const _0x1b7a2f=_0x511e09[_0x57b6a1(0x1ac)][_0x57b6a1(0x1a3)](0x1),_0x1a1797=_0x511e09['coveragePercent']>=0x50?a26_0x14b5c2[_0x57b6a1(0x1ba)]:_0x511e09[_0x57b6a1(0x1ac)]>=0x32?a26_0x14b5c2[_0x57b6a1(0x1b7)]:a26_0x14b5c2[_0x57b6a1(0x25d)];_0x155a66='\x20'+a26_0x14b5c2[_0x57b6a1(0x22d)](_0x57b6a1(0x19c))+'\x20'+_0x1a1797(_0x1b7a2f+'%')+'\x20('+formatRows(_0x511e09[_0x57b6a1(0x182)])+_0x57b6a1(0x216);}console['error'](_0xf5f8a8+'\x20'+a26_0x14b5c2[_0x57b6a1(0x274)](_0x511e09['name'])+_0x155a66),console[_0x57b6a1(0x280)]('\x20\x20'+a26_0x14b5c2[_0x57b6a1(0x22d)]('Source:')+'\x20'+a26_0x14b5c2[_0x57b6a1(0x274)](_0x511e09[_0x57b6a1(0x1e4)]+'.'+_0x511e09[_0x57b6a1(0x112)]));const _0x3ba08d=_0x511e09[_0x57b6a1(0x20c)]===_0x511e09[_0x57b6a1(0x1d6)]?a26_0x14b5c2[_0x57b6a1(0x22d)](_0x57b6a1(0x199))+'\x20'+_0x511e09[_0x57b6a1(0x20c)]:a26_0x14b5c2[_0x57b6a1(0x22d)](_0x57b6a1(0x123))+'\x20'+_0x511e09[_0x57b6a1(0x20c)]+'\x20=\x20'+_0x511e09[_0x57b6a1(0x1d6)];console[_0x57b6a1(0x280)]('\x20\x20'+_0x3ba08d),console[_0x57b6a1(0x280)]('\x20\x20'+a26_0x14b5c2[_0x57b6a1(0x22d)]('Columns:')),this['displayColumns'](_0x511e09[_0x57b6a1(0x1f8)]),!_0x511e09['schemaValid']&&console[_0x57b6a1(0x280)]('\x20\x20'+a26_0x14b5c2[_0x57b6a1(0x25d)]('Error:')+'\x20'+_0x511e09[_0x57b6a1(0x1a1)]);}}['displayBehaviorsStats'](_0x2890c9,_0x167f8a){const _0x182936=a26_0x1bfad6;if(_0x2890c9[_0x182936(0x1f0)][_0x182936(0x153)]===0x0)return;console[_0x182936(0x280)]('\x0a'+a26_0x14b5c2[_0x182936(0x22d)](_0x182936(0x233))+'\x20'+a26_0x14b5c2[_0x182936(0x22d)]('('+_0x167f8a+')'));for(const _0x442e46 of _0x2890c9['behaviors']){const _0x2b93be=_0x442e46[_0x182936(0x173)]?a26_0x14b5c2['green']('✔'):a26_0x14b5c2['red']('✘');let _0x547133='';if(_0x442e46[_0x182936(0x173)]&&_0x442e46[_0x182936(0x139)]!==undefined&&_0x442e46[_0x182936(0x226)]!==undefined){const _0xf84d76=_0x442e46[_0x182936(0x213)]?.[_0x182936(0x1a3)](0x1)||'?',_0x938464=(_0x442e46[_0x182936(0x213)]??0x0)>=0x32?a26_0x14b5c2[_0x182936(0x1ba)]:(_0x442e46[_0x182936(0x213)]??0x0)>=0x14?a26_0x14b5c2[_0x182936(0x1b7)]:a26_0x14b5c2[_0x182936(0x25d)];_0x547133='\x20'+a26_0x14b5c2[_0x182936(0x22d)](_0x182936(0x198))+'\x20'+_0x938464(formatRows(_0x442e46['customersWithEvents']))+'\x20('+_0xf84d76+'%)\x20'+a26_0x14b5c2[_0x182936(0x22d)](_0x182936(0x140))+'\x20'+a26_0x14b5c2['cyan'](formatRows(_0x442e46['totalEvents']));}console['error'](_0x2b93be+'\x20'+a26_0x14b5c2[_0x182936(0x274)](_0x442e46[_0x182936(0x128)])+_0x547133),console[_0x182936(0x280)]('\x20\x20'+a26_0x14b5c2['dim'](_0x182936(0x1c5))+'\x20'+a26_0x14b5c2[_0x182936(0x274)](_0x442e46[_0x182936(0x1e4)]+'.'+_0x442e46[_0x182936(0x112)]));const _0x471854=_0x442e46[_0x182936(0x20c)]===_0x442e46[_0x182936(0x1d6)]?a26_0x14b5c2[_0x182936(0x22d)](_0x182936(0x199))+'\x20'+_0x442e46[_0x182936(0x20c)]:a26_0x14b5c2[_0x182936(0x22d)](_0x182936(0x123))+'\x20'+_0x442e46[_0x182936(0x20c)]+_0x182936(0x136)+_0x442e46[_0x182936(0x1d6)];console[_0x182936(0x280)]('\x20\x20'+_0x471854),console['error']('\x20\x20'+a26_0x14b5c2[_0x182936(0x22d)](_0x182936(0x225))),this[_0x182936(0x11e)](_0x442e46[_0x182936(0x1f8)]),!_0x442e46['schemaValid']&&console['error']('\x20\x20'+a26_0x14b5c2[_0x182936(0x25d)]('Error:')+'\x20'+_0x442e46[_0x182936(0x1a1)]);}}[a26_0x1bfad6(0x11e)](_0x2dd93b){const _0x412f83=a26_0x1bfad6;for(const _0xe4f76c of _0x2dd93b){_0xe4f76c['label']===_0xe4f76c[_0x412f83(0x21b)]||_0xe4f76c['column']==='*'?console[_0x412f83(0x280)](_0x412f83(0x21f)+_0xe4f76c['label']):console[_0x412f83(0x280)](_0x412f83(0x21f)+_0xe4f76c[_0x412f83(0x1c6)]+'\x20'+a26_0x14b5c2['dim']('('+_0xe4f76c[_0x412f83(0x21b)]+')'));}}[a26_0x1bfad6(0x277)](_0x125342){const _0x50e344=a26_0x1bfad6;console[_0x50e344(0x280)]('─'['repeat'](0x3c));if(_0x125342[_0x50e344(0x217)][_0x50e344(0x153)]>0x0){console[_0x50e344(0x280)]('\x0a'+a26_0x14b5c2[_0x50e344(0x25d)]('Errors:'));for(const _0x5231a0 of _0x125342[_0x50e344(0x217)]){console[_0x50e344(0x280)]('\x20\x20'+a26_0x14b5c2[_0x50e344(0x25d)]('•')+'\x20'+_0x5231a0);}}_0x125342[_0x50e344(0x27e)]&&console[_0x50e344(0x280)]('\x0a'+a26_0x14b5c2['green']('✔')+_0x50e344(0x161));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a26_0x1bfad6(0x25b);['description']=a26_0x1bfad6(0x25a);async[a26_0x1bfad6(0x16e)](_0xde3dea){const _0x1f809d=a26_0x1bfad6,{options:_0x1dfcf1,args:_0xa39ea7,tdx:_0x4efe9d}=_0xde3dea,_0x47641a=_0x1dfcf1,_0x13b9b3=_0xa39ea7[0x0]||_0x1dfcf1[_0x1f809d(0x289)];if(!_0x13b9b3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x1f809d(0x262)+_0x1f809d(0x1ad)+_0x1f809d(0x249)+_0x1f809d(0x197)+_0x1f809d(0x1b6)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x1f809d(0x1bf)),0x1;if(!_0x47641a[_0x1f809d(0x1da)]&&!_0x47641a['attribute']&&!_0x47641a['behavior']&&!_0x47641a[_0x1f809d(0x212)])return console[_0x1f809d(0x280)](a26_0x14b5c2['red'](_0x1f809d(0x22a))),console[_0x1f809d(0x280)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x1f809d(0x280)](_0x1f809d(0x20b)),console[_0x1f809d(0x280)](_0x1f809d(0x1fb)),console[_0x1f809d(0x280)](_0x1f809d(0x143)),console[_0x1f809d(0x280)](_0x1f809d(0x19b)),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3e3921=resolveYamlFile(_0x13b9b3);if(!existsSync(_0x3e3921))return showFileNotFoundError(_0x3e3921,_0x13b9b3),0x1;_0x47641a[_0x1f809d(0x14a)]&&(console[_0x1f809d(0x280)](_0x1f809d(0x1e1)+_0x47641a['site']),console[_0x1f809d(0x280)](_0x1f809d(0x190)+_0x3e3921));let _0x3af986;try{_0x3af986=readFileSync(_0x3e3921,_0x1f809d(0x227));}catch(_0x3502f7){const _0x5a2cc8=_0x3502f7 instanceof Error?_0x3502f7[_0x1f809d(0x247)]:String(_0x3502f7);return console[_0x1f809d(0x280)](_0x1f809d(0x250)+_0x5a2cc8),0x1;}let _0x16c5ab;try{_0x16c5ab=parseDef(_0x3af986);}catch(_0x318777){const _0x26ca04=_0x318777 instanceof Error?_0x318777['message']:String(_0x318777);return console[_0x1f809d(0x280)](a26_0x14b5c2[_0x1f809d(0x25d)](_0x1f809d(0x270)+_0x26ca04)),0x1;}if(_0x47641a[_0x1f809d(0x129)]===!![]||_0x47641a[_0x1f809d(0x129)]===''){const _0x2a1344=_0x16c5ab[_0x1f809d(0x1be)]?.[_0x1f809d(0x257)](_0x4ed495=>_0x4ed495[_0x1f809d(0x128)])||[];if(_0x2a1344[_0x1f809d(0x153)]===0x0)console[_0x1f809d(0x280)](a26_0x14b5c2['red'](_0x1f809d(0x17b)));else{console['error'](a26_0x14b5c2[_0x1f809d(0x25d)](_0x1f809d(0x185))),console['error'](_0x1f809d(0x245));for(const _0x47d032 of _0x2a1344){console[_0x1f809d(0x280)]('\x20\x20'+a26_0x14b5c2[_0x1f809d(0x260)](_0x47d032));}console[_0x1f809d(0x280)](_0x1f809d(0x286)+_0x13b9b3+_0x1f809d(0x1ef)+_0x2a1344[0x0]+'\x22');}return 0x1;}if(_0x47641a[_0x1f809d(0x23f)]===!![]||_0x47641a['behavior']===''){const _0x444c66=_0x16c5ab[_0x1f809d(0x1f0)]?.[_0x1f809d(0x257)](_0x4509cd=>_0x4509cd[_0x1f809d(0x128)])||[];if(_0x444c66[_0x1f809d(0x153)]===0x0)console[_0x1f809d(0x280)](a26_0x14b5c2[_0x1f809d(0x25d)](_0x1f809d(0x11a)));else{console[_0x1f809d(0x280)](a26_0x14b5c2[_0x1f809d(0x25d)](_0x1f809d(0x14d))),console['error'](_0x1f809d(0x114));for(const _0x3fe7c9 of _0x444c66){console[_0x1f809d(0x280)]('\x20\x20'+a26_0x14b5c2[_0x1f809d(0x260)](_0x3fe7c9));}console[_0x1f809d(0x280)](_0x1f809d(0x286)+_0x13b9b3+'\x20--behavior\x20\x22'+_0x444c66[0x0]+'\x22');}return 0x1;}const _0x2df03a=createCommandSpinner(a26_0x14b5c2[_0x1f809d(0x22d)](_0x1f809d(0x135)),{'verbose':_0x47641a[_0x1f809d(0x14a)]});_0x2df03a['start']();const _0x506b44={'onProgress':_0x181b3b=>{const _0x450bcf=_0x1f809d;_0x2df03a[_0x450bcf(0x17e)]=formatProgressMessage(_0x181b3b);}};if(_0x47641a[_0x1f809d(0x1da)])_0x506b44[_0x1f809d(0x1da)]=!![];if(_0x47641a['attribute']&&typeof _0x47641a['attribute']==='string')_0x506b44[_0x1f809d(0x129)]=_0x47641a['attribute'];if(_0x47641a['behavior']&&typeof _0x47641a[_0x1f809d(0x23f)]===_0x1f809d(0x113))_0x506b44[_0x1f809d(0x23f)]=_0x47641a[_0x1f809d(0x23f)];if(_0x47641a['enriched'])_0x506b44[_0x1f809d(0x212)]=!![];if(_0x47641a[_0x1f809d(0x1ce)])_0x506b44[_0x1f809d(0x1ce)]=_0x47641a[_0x1f809d(0x1ce)];let _0x54dbb0;try{_0x54dbb0=await _0x4efe9d[_0x1f809d(0x28e)][_0x1f809d(0x16f)](_0x3af986,_0x506b44),_0x2df03a['stop']();}catch(_0xfa875a){_0x2df03a[_0x1f809d(0x1b8)]();throw _0xfa875a;}return await this[_0x1f809d(0x218)](_0x54dbb0,{'master':_0x47641a[_0x1f809d(0x1da)],'attribute':typeof _0x47641a['attribute']===_0x1f809d(0x113)?_0x47641a[_0x1f809d(0x129)]:undefined,'behavior':typeof _0x47641a['behavior']===_0x1f809d(0x113)?_0x47641a[_0x1f809d(0x23f)]:undefined,'enriched':_0x47641a[_0x1f809d(0x212)]}),_0x54dbb0['allValid']?0x0:0x1;}async['displayPreviewResults'](_0x5b3163,_0x34c2f6){const _0x56cbf9=a26_0x1bfad6;console[_0x56cbf9(0x280)]('\x0a'+a26_0x14b5c2[_0x56cbf9(0x274)]('Preview:')+'\x20'+_0x5b3163[_0x56cbf9(0x128)]),console[_0x56cbf9(0x280)]('═'[_0x56cbf9(0x12b)](0x3c));if(_0x34c2f6[_0x56cbf9(0x1da)]&&_0x5b3163[_0x56cbf9(0x25e)]){const _0x291a8f=a26_0x14b5c2[_0x56cbf9(0x22d)](_0x56cbf9(0x1ca))+'\x20'+a26_0x14b5c2['bold'](_0x5b3163['master'][_0x56cbf9(0x1e4)]+'.'+_0x5b3163['master'][_0x56cbf9(0x112)]);await this[_0x56cbf9(0x17c)](_0x291a8f,_0x5b3163['sampleData']);}else{if(_0x34c2f6[_0x56cbf9(0x129)]&&_0x5b3163[_0x56cbf9(0x25e)]){const _0x3f195d=a26_0x14b5c2[_0x56cbf9(0x22d)](_0x56cbf9(0x20e))+'\x20'+a26_0x14b5c2[_0x56cbf9(0x274)](_0x34c2f6['attribute']);await this[_0x56cbf9(0x17c)](_0x3f195d,_0x5b3163[_0x56cbf9(0x25e)]);}else{if(_0x34c2f6[_0x56cbf9(0x23f)]&&_0x5b3163[_0x56cbf9(0x25e)]){const _0x543051=a26_0x14b5c2[_0x56cbf9(0x22d)]('Behavior:')+'\x20'+a26_0x14b5c2[_0x56cbf9(0x274)](_0x34c2f6[_0x56cbf9(0x23f)]);await this['displaySampleData'](_0x543051,_0x5b3163[_0x56cbf9(0x25e)]);}else{if(_0x34c2f6[_0x56cbf9(0x212)]&&_0x5b3163[_0x56cbf9(0x25e)]){const _0x43f601=a26_0x14b5c2[_0x56cbf9(0x22d)](_0x56cbf9(0x26d))+'\x20'+a26_0x14b5c2[_0x56cbf9(0x274)](_0x56cbf9(0x1d8));await this[_0x56cbf9(0x17c)](_0x43f601,_0x5b3163['sampleData']);}else!_0x5b3163['sampleData']&&console[_0x56cbf9(0x280)](_0x56cbf9(0x14f));}}}if(_0x5b3163[_0x56cbf9(0x217)][_0x56cbf9(0x153)]>0x0){console[_0x56cbf9(0x280)]('─'[_0x56cbf9(0x12b)](0x3c)),console[_0x56cbf9(0x280)]('\x0a'+a26_0x14b5c2[_0x56cbf9(0x25d)](_0x56cbf9(0x1ec)));for(const _0x4d4927 of _0x5b3163[_0x56cbf9(0x217)]){console['error']('\x20\x20'+a26_0x14b5c2[_0x56cbf9(0x25d)]('•')+'\x20'+_0x4d4927);}}}async['displaySampleData'](_0x296d96,_0x91e81d){const _0x106a3e=a26_0x1bfad6;if(_0x91e81d[_0x106a3e(0x153)]===0x0){console[_0x106a3e(0x280)]('\x0a'+_0x296d96),console[_0x106a3e(0x280)](_0x106a3e(0x169));return;}console[_0x106a3e(0x280)]('\x0a'+_0x296d96);const _0xbac5c3=Object['keys'](_0x91e81d[0x0])[_0x106a3e(0x257)](_0x3c6a92=>({'name':_0x3c6a92,'type':typeof _0x91e81d[0x0][_0x3c6a92]==='number'?'double':_0x106a3e(0x1cc)})),_0x1e628d={'queryId':_0x106a3e(0x283),'columns':_0xbac5c3,'data':_0x91e81d,'stats':{'state':_0x106a3e(0x1f3),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x91e81d['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x127a9f=formatAsTable(_0x1e628d,_0x91e81d[_0x106a3e(0x153)],!![]);await writeOutput(_0x127a9f,undefined,_0x106a3e(0x112));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a26_0x1bfad6(0x181);[a26_0x1bfad6(0x26f)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a26_0x1bfad6(0x16e)](_0x25b39b){const _0x147dc0=a26_0x1bfad6,{options:_0x53a775,args:_0x416208,tdx:_0x4b4bfa}=_0x25b39b,_0x5b72ed=_0x53a775,_0x511c9d=_0x416208[0x0]||_0x53a775[_0x147dc0(0x289)];if(!_0x511c9d)return showParentSegmentNotSetError(_0x147dc0(0x1d0)+_0x147dc0(0x151)),0x1;const _0x55b606=resolveYamlFile(_0x511c9d);if(existsSync(_0x55b606)){_0x5b72ed[_0x147dc0(0x14a)]&&console['error'](_0x147dc0(0x29a)+_0x55b606);let _0x3bb626;try{_0x3bb626=readFileSync(_0x55b606,_0x147dc0(0x227));}catch(_0x38e7b4){const _0x29c546=_0x38e7b4 instanceof Error?_0x38e7b4[_0x147dc0(0x247)]:String(_0x38e7b4);return console[_0x147dc0(0x280)](_0x147dc0(0x250)+_0x29c546),0x1;}const _0x4a02a8=await withSpinner(_0x147dc0(0x16c),()=>_0x4b4bfa['segment'][_0x147dc0(0x176)](_0x3bb626),{'verbose':_0x5b72ed['verbose']}),_0x290039=_0x4a02a8[_0x147dc0(0x282)],{isNew:_0x179dc4,name:_0x1d66f9,hasChanges:_0x4b11eb,diffFormatted:_0x3817a6}=_0x290039;if(_0x4b11eb){_0x179dc4?console['error'](_0x147dc0(0x1f1)+_0x1d66f9+'\x27:'):console[_0x147dc0(0x280)](_0x147dc0(0x149)+_0x1d66f9+'\x27:');console[_0x147dc0(0x280)]('─'[_0x147dc0(0x12b)](0x3c)),console[_0x147dc0(0x280)](_0x3817a6),console[_0x147dc0(0x280)]('─'[_0x147dc0(0x12b)](0x3c));const _0x2ba5e2=_0x179dc4?_0x147dc0(0x1d5)+_0x1d66f9+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x1d66f9+_0x147dc0(0x1d1);if(!_0x5b72ed['yes']){if(!isInteractive())return console[_0x147dc0(0x280)](a26_0x14b5c2['red']('\x0aError:'),_0x147dc0(0x126)),console[_0x147dc0(0x280)](a26_0x14b5c2[_0x147dc0(0x22d)](_0x147dc0(0x23d))),0x1;const _0x4076d6=await confirmKey(_0x2ba5e2);if(!_0x4076d6)return console['error'](a26_0x14b5c2[_0x147dc0(0x1b7)](_0x147dc0(0x254))),0x1;}const _0x308ab3=_0x179dc4?'Creating':'Updating';await withSpinner(_0x308ab3+_0x147dc0(0x12d)+_0x1d66f9+_0x147dc0(0x13a),()=>_0x290039[_0x147dc0(0x22f)](),{'verbose':_0x5b72ed['verbose']});const _0x4a2c31=_0x179dc4?'Created':_0x147dc0(0x1ed);console[_0x147dc0(0x280)]('✔\x20'+_0x4a2c31+'\x20parent\x20segment\x20\x27'+_0x1d66f9+'\x27');}else console[_0x147dc0(0x280)](_0x147dc0(0x27d)+_0x1d66f9+_0x147dc0(0x19e));}const _0x234588=await withSpinner(_0x147dc0(0x1d9)+_0x511c9d+_0x147dc0(0x13a),()=>_0x4b4bfa[_0x147dc0(0x28e)]['runParent'](_0x511c9d),{'verbose':_0x5b72ed[_0x147dc0(0x14a)]}),_0x5c2224=_0x234588[_0x147dc0(0x282)],_0x504a8f=getConsoleUrl(_0x5b72ed['site'],'/app/workflows/'+_0x5c2224['workflowId']+_0x147dc0(0x27f)+_0x5c2224[_0x147dc0(0x158)]+_0x147dc0(0x1db)+_0x5c2224[_0x147dc0(0x110)]);return console[_0x147dc0(0x280)]('\x0a✔\x20Workflow\x20started'),console[_0x147dc0(0x280)]('\x20\x20'+a26_0x14b5c2['dim'](_0x147dc0(0x1e9))+'\x20'+_0x5c2224[_0x147dc0(0x24d)]),console[_0x147dc0(0x280)]('\x20\x20'+a26_0x14b5c2[_0x147dc0(0x22d)](_0x147dc0(0x170))+'\x20'+_0x5c2224[_0x147dc0(0x119)]),console['error']('\x20\x20'+a26_0x14b5c2['dim']('Session:')+'\x20'+_0x5c2224[_0x147dc0(0x158)]),console['error']('\x20\x20'+a26_0x14b5c2[_0x147dc0(0x22d)](_0x147dc0(0x1a6))+'\x20'+_0x5c2224[_0x147dc0(0x110)]),console['error']('\x20\x20'+_0x504a8f),console[_0x147dc0(0x280)]('\x0a'+a26_0x14b5c2[_0x147dc0(0x22d)](_0x147dc0(0x237))+_0x147dc0(0x259)+_0x5c2224[_0x147dc0(0x110)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x1a7);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x235);async['execute'](_0x1284c7){const _0x4358b6=a26_0x1bfad6,{options:_0x295292,args:_0x48bc10,tdx:_0x564d98}=_0x1284c7,_0x412358=_0x48bc10[0x0]||_0x295292[_0x4358b6(0x289)];if(!_0x412358)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'+_0x4358b6(0x162)),0x1;_0x295292[_0x4358b6(0x14a)]&&(console[_0x4358b6(0x280)](_0x4358b6(0x1e1)+_0x295292[_0x4358b6(0x141)]),console['error'](_0x4358b6(0x18f)+_0x412358));const _0x419401=await withSpinner(_0x4358b6(0x244)+_0x412358+_0x4358b6(0x13a),()=>_0x564d98[_0x4358b6(0x28e)][_0x4358b6(0x124)](_0x412358),{'verbose':_0x295292['verbose']}),_0xf945fe=_0x419401[_0x4358b6(0x282)];console[_0x4358b6(0x280)](_0x4358b6(0x1b3)+_0xf945fe[_0x4358b6(0x153)]+_0x4358b6(0x175)+(_0xf945fe[_0x4358b6(0x153)]!==0x1?'s':''));if(_0x295292[_0x4358b6(0x187)]||_0x295292[_0x4358b6(0x1df)])return await handleSDKOutput(_0xf945fe,_0x295292),0x0;return displayFieldsHumanReadable(_0xf945fe,_0x412358),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x1bfad6(0x128)]='segment:parent:view';['description']=a26_0x1bfad6(0x278);async['execute'](_0x17eb6f){const _0x47ed2e=a26_0x1bfad6,{options:_0x48a8a3,args:_0x5dfc28,tdx:_0x1ca369}=_0x17eb6f,_0x530b71=_0x48a8a3,_0xbc7e2=_0x5dfc28[0x0]||_0x48a8a3['parentSegment'];if(!_0xbc7e2)return showParentSegmentNotSetError(_0x47ed2e(0x133)+_0x47ed2e(0x196)+_0x47ed2e(0x156)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x48a8a3[_0x47ed2e(0x14a)]&&(console[_0x47ed2e(0x280)](_0x47ed2e(0x1e1)+_0x48a8a3['site']),console['error'](_0x47ed2e(0x18f)+_0xbc7e2));const _0x3033ba=await withSpinner(_0x47ed2e(0x1c0)+_0xbc7e2+'\x27...',()=>_0x1ca369[_0x47ed2e(0x28e)][_0x47ed2e(0x27b)](_0xbc7e2),{'verbose':_0x48a8a3[_0x47ed2e(0x14a)]}),_0x3ec2fd=_0x3033ba['data'];if(_0x530b71[_0x47ed2e(0x1b4)]){const _0x36086c=getConsoleNextUrl(_0x530b71['site'],_0x47ed2e(0x1e7)+_0x3ec2fd['id']);return console[_0x47ed2e(0x280)](a26_0x14b5c2[_0x47ed2e(0x1ba)]('✔')+_0x47ed2e(0x1c1)+a26_0x14b5c2[_0x47ed2e(0x260)](_0x36086c)),openBrowser(_0x36086c),0x0;}return await handleSingleObjectOutput(_0x3ec2fd,_0x48a8a3),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x1bfad6(0x128)]='segment:parent:desc';['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a26_0x1bfad6(0x16e)](_0x6def5a){const _0xa8174=a26_0x1bfad6,{options:_0x5f42a0,args:_0x3ed084,tdx:_0x2ae369}=_0x6def5a,_0x131c5d=_0x5f42a0,_0x25401e=_0x3ed084[0x0]||_0x5f42a0[_0xa8174(0x289)];if(!_0x25401e)return showParentSegmentNotSetError(_0xa8174(0x118)+_0xa8174(0x215)+_0xa8174(0x156)+_0xa8174(0x1cd)),0x1;_0x5f42a0[_0xa8174(0x14a)]&&(console['error']('Site:\x20'+_0x5f42a0[_0xa8174(0x141)]),console[_0xa8174(0x280)](_0xa8174(0x18f)+_0x25401e));const _0x30cab4=await withSpinner(_0xa8174(0x298)+_0x25401e+'\x27...',()=>_0x2ae369[_0xa8174(0x28e)][_0xa8174(0x120)](_0x25401e),{'verbose':_0x5f42a0[_0xa8174(0x14a)]}),_0x1fc6a7=_0x30cab4[_0xa8174(0x282)],_0xe251e9=_0x2ae369[_0xa8174(0x28e)][_0xa8174(0x24e)](_0x1fc6a7);if(_0x131c5d['output']){const _0x248367=await this[_0xa8174(0x238)](_0x6def5a,_0x25401e,_0x1fc6a7,_0xe251e9),_0x562422=this['formatSchemaJson'](_0x248367);writeFileSync(_0x131c5d[_0xa8174(0x207)],_0x562422);const _0x5b4135=_0x248367[_0xa8174(0x287)][_0xa8174(0x1f8)][_0xa8174(0x153)]+_0x248367[_0xa8174(0x1f0)][_0xa8174(0x25c)]((_0x3e2f54,_0xdf6a53)=>_0x3e2f54+_0xdf6a53[_0xa8174(0x1f8)][_0xa8174(0x153)],0x0),_0x2bfaae=_0x248367['behaviors']['filter'](_0x2bdf7c=>_0x2bdf7c['columns'][_0xa8174(0x153)]===0x0)[_0xa8174(0x153)];return console['log'](_0xa8174(0x13e)+_0x131c5d[_0xa8174(0x207)]),console[_0xa8174(0x1e2)]('\x20\x20Database:\x20'+_0xe251e9),console[_0xa8174(0x1e2)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x248367[_0xa8174(0x1f0)][_0xa8174(0x153)]+_0xa8174(0x1c4)),console[_0xa8174(0x1e2)]('\x20\x20Columns:\x20'+_0x5b4135+'\x20total'),_0x2bfaae>0x0&&console[_0xa8174(0x1e2)](_0xa8174(0x291)+_0x2bfaae+_0xa8174(0x1b5)),0x0;}console['error']('\x0a'+a26_0x14b5c2[_0xa8174(0x274)]('Output\x20Database:')+'\x20'+a26_0x14b5c2[_0xa8174(0x260)](_0xe251e9));const _0x4a624f=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x2ae369[_0xa8174(0x28e)][_0xa8174(0x195)](_0x1fc6a7),{'verbose':_0x5f42a0['verbose']});console[_0xa8174(0x280)]('\x0a'+a26_0x14b5c2['bold'](_0xa8174(0x287))+'\x20'+a26_0x14b5c2[_0xa8174(0x22d)]('('+_0xe251e9+_0xa8174(0x253)));const _0x54b9b8=await executeSchemaQuery(_0x4a624f[_0xa8174(0x282)],_0x2ae369,_0x5f42a0);await handleQueryOutput(_0x54b9b8,_0x5f42a0);const _0x345262=await withSpinner(_0xa8174(0x256),()=>_0x2ae369[_0xa8174(0x28e)][_0xa8174(0x224)](_0x1fc6a7),{'verbose':_0x5f42a0['verbose']});for(const _0x425873 of _0x345262[_0xa8174(0x282)]){const _0x4702d8='behavior_'+_0x425873[_0xa8174(0x251)]()[_0xa8174(0x271)](/\s+/g,'_'),_0x3a9ce2=_0xa8174(0x142)+_0xe251e9+'.'+_0x4702d8;console[_0xa8174(0x280)]('\x0a'+a26_0x14b5c2[_0xa8174(0x274)](_0x425873)+'\x20'+a26_0x14b5c2['dim']('('+_0xe251e9+'.'+_0x4702d8+')'));try{const _0x4fb9e7=await executeSchemaQuery(_0x3a9ce2,_0x2ae369,_0x5f42a0);await handleQueryOutput(_0x4fb9e7,_0x5f42a0);}catch{console[_0xa8174(0x280)](a26_0x14b5c2['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a26_0x1bfad6(0x238)](_0x258591,_0x57f4f0,_0x2d580a,_0x5caa53){const _0x3688f9=a26_0x1bfad6,{options:_0x6f4d4a,tdx:_0x32e93c}=_0x258591,_0x544e5c=await withSpinner(_0x3688f9(0x1d7),()=>_0x32e93c[_0x3688f9(0x28e)]['getParentSQL'](_0x2d580a),{'verbose':_0x6f4d4a[_0x3688f9(0x14a)]}),_0x1b69bb=await executeSchemaQuery(_0x544e5c[_0x3688f9(0x282)],_0x32e93c,_0x6f4d4a),_0x3ac922=_0x1b69bb[_0x3688f9(0x282)][_0x3688f9(0x257)](_0x5be9df=>({'name':_0x5be9df['column_name'],'type':_0x5be9df[_0x3688f9(0x20d)]})),_0x41dcfe=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x32e93c[_0x3688f9(0x28e)][_0x3688f9(0x224)](_0x2d580a),{'verbose':_0x6f4d4a['verbose']}),_0x53134f=[];for(const _0x349302 of _0x41dcfe[_0x3688f9(0x282)]){const _0x2d374c=_0x3688f9(0x1a2)+_0x349302[_0x3688f9(0x251)]()[_0x3688f9(0x271)](/\s+/g,'_'),_0x16b839=_0x3688f9(0x142)+_0x5caa53+'.'+_0x2d374c;let _0x1309f9=[];try{const _0x22bded=await executeSchemaQuery(_0x16b839,_0x32e93c,_0x6f4d4a);_0x1309f9=_0x22bded['data'][_0x3688f9(0x257)](_0x423230=>({'name':_0x423230['column_name'],'type':_0x423230[_0x3688f9(0x20d)]}));}catch{}_0x53134f[_0x3688f9(0x1ae)]({'table':_0x2d374c,'columns':_0x1309f9});}return{'database':_0x5caa53,'parent_segment':_0x57f4f0,'parent_id':_0x2d580a,'customers':{'table':_0x3688f9(0x287),'columns':_0x3ac922},'behaviors':_0x53134f};}['formatSchemaJson'](_0x3ad4e4){const _0x1c6952=a26_0x1bfad6,_0x57d1c3=_0x352808=>{const _0x15f94b=a26_0x3af9;if(_0x352808['length']===0x0)return'[]';const _0xc20030=_0x352808[_0x15f94b(0x257)](_0x4d1cd1=>_0x15f94b(0x1f7)+_0x4d1cd1[_0x15f94b(0x128)]+_0x15f94b(0x1e3)+_0x4d1cd1[_0x15f94b(0x11f)]+_0x15f94b(0x20a));return'[\x0a'+_0xc20030['join'](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x5046e9=_0x3ad4e4['behaviors'][_0x1c6952(0x257)](_0x10f2e8=>{const _0x570bf3=_0x1c6952;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x10f2e8[_0x570bf3(0x112)]+_0x570bf3(0x26c)+_0x57d1c3(_0x10f2e8['columns'])[_0x570bf3(0x271)](/^/gm,'\x20\x20')['trim']()+'\x0a\x20\x20\x20\x20}';})[_0x1c6952(0x11c)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x3ad4e4[_0x1c6952(0x1e4)]+_0x1c6952(0x209)+_0x3ad4e4[_0x1c6952(0x266)]+_0x1c6952(0x12f)+_0x3ad4e4[_0x1c6952(0x1c9)]+_0x1c6952(0x28f)+_0x3ad4e4['customers'][_0x1c6952(0x112)]+_0x1c6952(0x1f4)+_0x57d1c3(_0x3ad4e4[_0x1c6952(0x287)]['columns'])[_0x1c6952(0x271)](/^/gm,'\x20\x20')[_0x1c6952(0x148)]()+_0x1c6952(0x27a)+_0x5046e9+_0x1c6952(0x122);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x202);['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a26_0x1bfad6(0x16e)](_0x1ab0cd){const _0x1498a2=a26_0x1bfad6,{options:_0x3d86e3,args:_0x438b5e,tdx:_0x42996a}=_0x1ab0cd,_0x463456=_0x438b5e[0x0]||_0x3d86e3['parentSegment'];if(!_0x463456)return showParentSegmentNotSetError(_0x1498a2(0x172)+_0x1498a2(0x194)),0x1;_0x3d86e3[_0x1498a2(0x14a)]&&(console[_0x1498a2(0x280)](_0x1498a2(0x1e1)+_0x3d86e3['site']),console['error'](_0x1498a2(0x18f)+_0x463456));const _0x2bcc20=await withSpinner(_0x1498a2(0x298)+_0x463456+_0x1498a2(0x13a),()=>_0x42996a[_0x1498a2(0x28e)][_0x1498a2(0x120)](_0x463456),{'verbose':_0x3d86e3[_0x1498a2(0x14a)]}),_0x571f13=_0x2bcc20['data'],_0x606e8f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x463456+'\x27...',()=>_0x42996a[_0x1498a2(0x28e)][_0x1498a2(0x195)](_0x571f13),{'verbose':_0x3d86e3[_0x1498a2(0x14a)]}),_0x49d0e1=_0x606e8f[_0x1498a2(0x282)];return _0x3d86e3['format']===_0x1498a2(0x187)||_0x3d86e3[_0x1498a2(0x13c)]==='jsonl'?await handleSDKOutput([{'sql':_0x49d0e1}],_0x3d86e3):console[_0x1498a2(0x1e2)](_0x49d0e1),0x0;}}function a26_0x239a(){const _0x77e2a8=['To\x20cancel:','collectSchema','\x20service','\x20section','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Creating','behavior','attributesFile','Fetching\x20SQL\x20for\x20\x27','Default','Listing\x20personalization\x20services\x20for\x20\x27','Listing\x20fields\x20for\x20\x27','Available\x20attributes:','in\x20','message','Attributes','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','displayRealtimeInfo','platform','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','audienceId','getOutputDatabaseName','personalization_services','Error\x20reading\x20file:\x20','toLowerCase','No\x20parent\x20segments\x20match\x20pattern:\x20','.customers)','Aborted.','customerGroupFile','Fetching\x20behavior\x20list...','map','137830elATqs','\x20tdx\x20wf\x20attempt\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','segment:parent:preview','reduce','red','sampleData','525035SsxsfJ','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','SQL\x20query:\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','yes','parent_segment','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x20to\x20push\x20the\x20configuration','personalization','Updating\x20parent\x20segment\x20\x27','jobId','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Enriched:','segment:parent:pull','description','Error\x20parsing\x20YAML:\x20','replace','Fetching\x20current\x20configuration\x20for\x20\x27','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','bold','List\x20parent\x20segments','parent_segments','displaySummary','Show\x20parent\x20segment\x20details','\x0a⚠️\x20\x20Both\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','getParentFull','👥\x20','✔\x20No\x20changes\x20-\x20\x27','allValid','/sessions/','error','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','data','preview','6274774qWVHvr','customerGroup','\x0aUsage:\x20tdx\x20ps\x20preview\x20','customers','Created','parentSegment','all','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','run','ps:rt:list','segment','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Creating\x20parent\x20segment\x20\x27','\x20\x20Note:\x20','list','1250EMLPbk','sort','tdx\x20ps\x20preview\x20','rowCount','query','Resolving\x20parent\x20segment\x20\x27','realtime_enabled','Found\x20YAML\x20file:\x20','workflowAttemptId','true','table','string','Available\x20behaviors:','\x20--behavior\x20\x22','setJobId','filter','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','status','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','idStitching','join','primaryKey','displayColumns','type','resolveParentId','session','\x0a\x20\x20]\x0a}\x0a','Join:','listFields','dirname','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','name','attribute','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','repeat','404667rMtpzk','\x20parent\x20segment\x20\x27','tdx\x20ps\x20push\x20','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','test','realtime','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','events','Fetching\x20sample\x20data...','\x20=\x20','\x20Added\x20RT\x202.0\x20template\x20section','No\x20parent\x20segments\x20found','customersWithEvents','\x27...','8yVlkgA','format','\x20\x202.\x20Run\x20','Schema\x20saved\x20to\x20','\x20Context\x20set:\x20','Events:','site','SELECT\x20*\x20FROM\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Error:','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','start','/\x20and\x20','trim','\x0aChanges\x20to\x20apply\x20to\x20\x27','verbose','\x20[Job\x20ID:\x20','871983uIdNrZ','Error:\x20--behavior\x20requires\x20a\x20name\x0a','6WsgSzF','\x0aNo\x20sample\x20data\x20available','segment:parent:update','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Validating\x20configuration...','length','stats','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Options:\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','workflowSessionId','Validate:','.yml','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','endsWith','\x20--enriched','\x20+\x20[','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','/\x20directories\x20exist.','\x20Configuration\x20is\x20valid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','page_view','indexOf','segment:parent:validate','Error:\x20Parent\x20segment\x20name\x20is\x20required','`\x20to\x20download\x20the\x20configuration\x20first','last_page_viewed','\x20\x20No\x20sample\x20data\x20available','19812DWBhTR','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Analyzing\x20changes...','ps:pz:init','execute','previewParentYaml','Status:','unref','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','schemaValid','RT\x202.0\x20Validate:','\x20field','pushParentYaml','Next\x20steps:','ID\x20Stitching:','limit','\x20rows\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displaySampleData','\x27\x20is\x20already\x20up\x20to\x20date','text','Error:\x20--database\x20and\x20--table\x20are\x20required','Name:\x20','segment:parent:run','matchedCount','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Error:\x20--attribute\x20requires\x20a\x20name\x0a','information_schema','json','sections','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Pattern:\x20','My\x20Service','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','Personalization:','addBehaviors','Parent\x20segment:\x20','YAML\x20file:\x20','elapsedTimeMillis','\x20RT-enabled\x20parent\x20segment','updateParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','getParentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Customers:','Join\x20on:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Coverage:','using\x20the\x20default\x20path:\x20','\x27\x20is\x20up\x20to\x20date','behaviorsFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','schemaError','behavior_','toFixed','175WNalGS','To\x20view\x20sample\x20data:','Attempt:','segment:parent:fields','\x20--interval\x20','displayValidateResults','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','validateParentYaml','coveragePercent','Options\x20(one\x20required):\x0a','push','\x20to\x20configure\x20your\x20personalization\x20service','\x20--attribute\x20\x22<name>\x22','enabled','Attributes:','✔\x20Found\x20','web','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','yellow','stop','\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','green','294tgHxWY','sourceTableError','addBehaviorsFile','attributes','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Fetching\x20parent\x20segment\x20\x27','\x20Opening\x20','\x20parent\x20segment','addAttributesFile','\x20behaviors','Source:','label','✔\x20Created\x20parent\x20segment\x20\x27','\x20configured','parent_id','Master:','user_id','varchar','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','interval','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x27\x20and\x20run\x20workflow?','Output\x20file:\x20','⚡\x20Enabled','td_client_id','Create\x20parent\x20segment\x20\x27','foreignKey','Fetching\x20customers\x20schema...','Master\x20+\x20Attributes','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','master','/attempt/','ignore','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x0a⚠️\x20\x20Migrating:\x20','jsonl','Table:\x20','Site:\x20','log','\x22,\x20\x22type\x22:\x20\x22','database','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','ps:pz:list','/app/dw/parentSegments/','personalizationServices','Audience\x20ID:','trigger_event','✔\x20Renamed\x20directory\x20to\x20','Errors:','Updated','pullParentYaml','\x20--attribute\x20\x22','behaviors','\x0aNew\x20parent\x20segment\x20\x27','single','FINISHED','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','stitchingKeys','isDirectory','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','columns','population','\x5c$&','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','valid','Personalization\x20service\x20description','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','displayPreviewHints','RT\x202.0:','segment:parent:create','segment:parent:sql','\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','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayMasterInfo','/\x20directory.\x0a','output','segment:parent:show','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x22\x20}','Options:','joinKey','column_type','Attribute:','\x20--behavior\x20\x22<name>\x22','timezone','\x20No\x20changes\x20-\x20','enriched','customerPercent','-1d','\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','\x20rows)','errors','displayPreviewResults','\x20\x20\x20\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','column','scheduleOption','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20\x20\x20\x20-\x20','Updating','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','toLocaleString','displayAttributesStats','getBehaviorNames','Columns:','totalEvents','utf-8','Executing\x20parent\x20segment\x20query...','segment:parent:push','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Validating\x20RT\x20configuration...','scheduleType','dim','localeCompare','apply','<database>.<table>','Apply\x20changes\x20to\x20\x27','Error:\x20File\x20not\x20found:\x20','Behaviors','\x0aChanges\x20to\x20\x27','List\x20available\x20fields\x20for\x20segmentation','displayBehaviorsStats'];a26_0x239a=function(){return _0x77e2a8;};return a26_0x239a();}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x208);[a26_0x1bfad6(0x26f)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x3d3b27){const _0x2f5f87=a26_0x1bfad6,{options:_0xe8bcf0,args:_0x13811c,tdx:_0x1409b7}=_0x3d3b27,_0x57e652=_0x13811c[0x0]||_0xe8bcf0[_0x2f5f87(0x289)];if(!_0x57e652)return showParentSegmentNotSetError(_0x2f5f87(0x23c)+'\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;_0xe8bcf0[_0x2f5f87(0x14a)]&&(console[_0x2f5f87(0x280)](_0x2f5f87(0x1e1)+_0xe8bcf0[_0x2f5f87(0x141)]),console['error'](_0x2f5f87(0x18f)+_0x57e652));const _0x494296=await withSpinner(_0x2f5f87(0x298)+_0x57e652+'\x27...',()=>_0x1409b7[_0x2f5f87(0x28e)][_0x2f5f87(0x120)](_0x57e652),{'verbose':_0xe8bcf0[_0x2f5f87(0x14a)]}),_0x41fa45=_0x494296[_0x2f5f87(0x282)],_0x197e48=await withSpinner(_0x2f5f87(0x241)+_0x57e652+_0x2f5f87(0x13a),()=>_0x1409b7[_0x2f5f87(0x28e)][_0x2f5f87(0x195)](_0x41fa45),{'verbose':_0xe8bcf0[_0x2f5f87(0x14a)]});let _0x5bfa69=_0x197e48[_0x2f5f87(0x282)];const _0x4c8aa5=resolveLimit(_0xe8bcf0[_0x2f5f87(0x179)],DEFAULT_DISPLAY_LIMIT),_0x4753d0=/\bLIMIT\s+\d+/i[_0x2f5f87(0x130)](_0x5bfa69);!_0x4753d0&&(_0x5bfa69=_0x5bfa69['trim']()['replace'](/;+$/,''),_0x5bfa69='SELECT\x20*\x20FROM\x20(\x0a'+_0x5bfa69+_0x2f5f87(0x19a)+_0x4c8aa5);_0xe8bcf0[_0x2f5f87(0x14a)]&&console['error'](_0x2f5f87(0x263)+_0x5bfa69);const _0x5115da=await withProgressSpinner(_0x2f5f87(0x228),async _0x44f785=>{const _0x4b9574=_0x2f5f87,_0x10e5b5=await _0x1409b7[_0x4b9574(0x297)][_0x4b9574(0x16e)](_0x5bfa69,{'catalog':'td','schema':_0x4b9574(0x186),'onJobId':_0x526a79=>{const _0x6b8f32=_0x4b9574;_0x44f785[_0x6b8f32(0x116)](_0x526a79);}});return _0x10e5b5;},{'verbose':_0xe8bcf0[_0x2f5f87(0x14a)]}),_0x1637c5=_0x5115da[_0x2f5f87(0x282)],_0x1df717=_0x1637c5[_0x2f5f87(0x26b)]?_0x2f5f87(0x14b)+_0x1637c5[_0x2f5f87(0x26b)]+']':'';return console[_0x2f5f87(0x280)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x1637c5[_0x2f5f87(0x154)]['processedRows'][_0x2f5f87(0x222)]()+_0x2f5f87(0x17a)+(_0x2f5f87(0x246)+formatElapsed(_0x1637c5['stats'][_0x2f5f87(0x191)])+_0x1df717)),await handleQueryOutput(_0x1637c5,_0xe8bcf0),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a26_0x1bfad6(0x28d);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x267);async[a26_0x1bfad6(0x16e)](_0xfc8c05){const _0x76e56=a26_0x1bfad6,{options:_0x4a8a1d,args:_0x5d763e,tdx:_0x67c903}=_0xfc8c05,_0x20a918=_0x5d763e[0x0],_0x1b9e0d=await withSpinner(_0x20a918?_0x76e56(0x23b)+_0x20a918+_0x76e56(0x13a):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x67c903[_0x76e56(0x131)][_0x76e56(0x292)](),{'verbose':_0x4a8a1d['verbose']});let _0x5bd95f=_0x1b9e0d['data']['filter'](_0x46b238=>_0x46b238[_0x76e56(0x299)]);if(_0x20a918){const _0x5dee75=_0x20a918[_0x76e56(0x271)](/[.+^${}()|[\]\\]/g,_0x76e56(0x1fa))[_0x76e56(0x271)](/\*/g,'.*')[_0x76e56(0x271)](/\?/g,'.'),_0x37b0cd=new RegExp('^'+_0x5dee75+'$','i');_0x5bd95f=_0x5bd95f['filter'](_0xd211e8=>_0x37b0cd[_0x76e56(0x130)](_0xd211e8[_0x76e56(0x128)]));}_0x5bd95f['sort']((_0x47e901,_0x5c4869)=>_0x47e901[_0x76e56(0x128)][_0x76e56(0x22e)](_0x5c4869[_0x76e56(0x128)])),console[_0x76e56(0x280)]('✔\x20Found\x20'+_0x5bd95f['length']+_0x76e56(0x192)+(_0x5bd95f[_0x76e56(0x153)]!==0x1?'s':''));const _0x78860f=_0x408b6b=>{const _0x153b76=_0x76e56;return getConsoleNextUrl(_0x4a8a1d['site'],_0x153b76(0x1e7)+_0x408b6b);};if(_0x4a8a1d[_0x76e56(0x13c)]===_0x76e56(0x187)||_0x4a8a1d[_0x76e56(0x13c)]===_0x76e56(0x1df)){const _0x2f997c=_0x5bd95f[_0x76e56(0x257)](_0x31d48f=>({..._0x31d48f,'url':_0x78860f(_0x31d48f['id'])}));await handleSDKOutput(_0x2f997c,_0x4a8a1d);}else{if(_0x5bd95f[_0x76e56(0x153)]===0x0)console[_0x76e56(0x1e2)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x4ea8ee of _0x5bd95f){const _0x220b5c=_0x4ea8ee['population']?a26_0x14b5c2[_0x76e56(0x22d)]('\x20('+formatRows(_0x4ea8ee['population'])+')'):'',_0x174dc4=hyperlink(_0x4ea8ee['name'],_0x78860f(_0x4ea8ee['id']));console['log']('⚡\x20'+_0x174dc4+_0x220b5c);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x1bfad6(0x128)]='ps:rt:validate';[a26_0x1bfad6(0x26f)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a26_0x1bfad6(0x16e)](_0x2cc964){const _0x2c0f62=a26_0x1bfad6,{options:_0x14fef5,args:_0x396ead,tdx:_0x4e041a}=_0x2cc964,_0x3a7005=_0x396ead[0x0]||_0x14fef5[_0x2c0f62(0x289)];if(!_0x3a7005)return showParentSegmentNotSetError(_0x2c0f62(0x18c)+'\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 _0x5b17a5=resolveYamlFile(_0x3a7005);if(!existsSync(_0x5b17a5))return showFileNotFoundError(_0x5b17a5,_0x3a7005),0x1;let _0x5475de;try{_0x5475de=readFileSync(_0x5b17a5,_0x2c0f62(0x227));}catch(_0xa9014e){const _0xc597fc=_0xa9014e instanceof Error?_0xa9014e[_0x2c0f62(0x247)]:String(_0xa9014e);return console['error'](_0x2c0f62(0x250)+_0xc597fc),0x1;}const _0x2bcd25=createCommandSpinner(a26_0x14b5c2[_0x2c0f62(0x22d)](_0x2c0f62(0x22b)),{'verbose':_0x14fef5[_0x2c0f62(0x14a)]});_0x2bcd25[_0x2c0f62(0x146)]();const _0x4efdb2={'realtime':!![],'onProgress':_0x438c48=>{const _0x5d64b4=_0x2c0f62;_0x2bcd25[_0x5d64b4(0x17e)]=formatProgressMessage(_0x438c48);}};let _0x5f0967;try{_0x5f0967=await _0x4e041a[_0x2c0f62(0x28e)][_0x2c0f62(0x1ab)](_0x5475de,_0x4efdb2),_0x2bcd25[_0x2c0f62(0x1b8)]();}catch(_0xd065b4){_0x2bcd25[_0x2c0f62(0x1b8)]();throw _0xd065b4;}console[_0x2c0f62(0x280)]('\x0a'+a26_0x14b5c2[_0x2c0f62(0x274)](_0x2c0f62(0x174))+'\x20'+_0x5f0967[_0x2c0f62(0x128)]),console[_0x2c0f62(0x280)]('═'[_0x2c0f62(0x12b)](0x3c)),displayRealtimeValidation(_0x5f0967),console[_0x2c0f62(0x280)]('─'[_0x2c0f62(0x12b)](0x3c));if(_0x5f0967[_0x2c0f62(0x217)]['length']>0x0){console['error']('\x0a'+a26_0x14b5c2[_0x2c0f62(0x25d)]('Errors:'));for(const _0xa9e44a of _0x5f0967[_0x2c0f62(0x217)]){console[_0x2c0f62(0x280)]('\x20\x20'+a26_0x14b5c2[_0x2c0f62(0x25d)]('•')+'\x20'+_0xa9e44a);}}return _0x5f0967[_0x2c0f62(0x27e)]&&console[_0x2c0f62(0x280)]('\x0a'+a26_0x14b5c2[_0x2c0f62(0x1ba)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x5f0967[_0x2c0f62(0x27e)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x1bfad6(0x128)]=a26_0x1bfad6(0x1e6);[a26_0x1bfad6(0x26f)]=a26_0x1bfad6(0x12a);async[a26_0x1bfad6(0x16e)](_0x17f6d1){const _0x232766=a26_0x1bfad6,{options:_0x26caf7,args:_0xfa783f,tdx:_0x1fe77b}=_0x17f6d1,_0x4e1e57=_0xfa783f[0x0]||_0x26caf7[_0x232766(0x289)];if(!_0x4e1e57)return showParentSegmentNotSetError(_0x232766(0x1cf)+_0x232766(0x1b9)),0x1;const _0x1a8a12=await withSpinner(_0x232766(0x298)+_0x4e1e57+_0x232766(0x13a),()=>_0x1fe77b[_0x232766(0x28e)][_0x232766(0x120)](_0x4e1e57),{'verbose':_0x26caf7[_0x232766(0x14a)]}),_0x4ec819=_0x1a8a12['data'],_0x289c22=await withSpinner(_0x232766(0x243)+_0x4e1e57+_0x232766(0x13a),()=>_0x1fe77b[_0x232766(0x269)][_0x232766(0x292)](_0x4ec819),{'verbose':_0x26caf7[_0x232766(0x14a)]}),_0x17dfd2=_0x289c22[_0x232766(0x282)];console['error']('✔\x20Found\x20'+_0x17dfd2['length']+'\x20personalization\x20service'+(_0x17dfd2[_0x232766(0x153)]!==0x1?'s':''));if(_0x26caf7[_0x232766(0x13c)]===_0x232766(0x187)||_0x26caf7[_0x232766(0x13c)]===_0x232766(0x1df))await handleSDKOutput(_0x17dfd2,_0x26caf7);else{if(_0x17dfd2[_0x232766(0x153)]===0x0)console['log']('No\x20personalization\x20services\x20configured'),console[_0x232766(0x280)](a26_0x14b5c2[_0x232766(0x260)](_0x232766(0x28b)));else for(const _0x956c76 of _0x17dfd2){const _0x44df84=_0x956c76[_0x232766(0x188)]?.['length']||0x0,_0x5246b5=_0x956c76[_0x232766(0x1ea)]?a26_0x14b5c2[_0x232766(0x22d)]('\x20trigger='+_0x956c76[_0x232766(0x1ea)]):'',_0x1e4e04=a26_0x14b5c2[_0x232766(0x22d)]('\x20('+_0x44df84+_0x232766(0x23a)+(_0x44df84!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x956c76[_0x232766(0x128)]+_0x5246b5+_0x1e4e04),_0x956c76[_0x232766(0x26f)]&&console[_0x232766(0x1e2)](_0x232766(0x219)+a26_0x14b5c2['dim'](_0x956c76[_0x232766(0x26f)]));}}return 0x0;}}function a26_0x3af9(_0x4caadf,_0x2bd2b3){_0x4caadf=_0x4caadf-0x110;const _0x239acd=a26_0x239a();let _0x3af986=_0x239acd[_0x4caadf];return _0x3af986;}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a26_0x1bfad6(0x16d);['description']=a26_0x1bfad6(0x1fe);async[a26_0x1bfad6(0x16e)](_0x1ff0f6){const _0x55d024=a26_0x1bfad6,{options:_0x26b500,args:_0x227087}=_0x1ff0f6,_0x3287f4=_0x227087[0x0]||_0x26b500[_0x55d024(0x289)];if(!_0x3287f4)return showParentSegmentNotSetError(_0x55d024(0x15b)+_0x55d024(0x203)),0x1;const _0x539e2e=resolveYamlFile(_0x3287f4);if(!existsSync(_0x539e2e))return showFileNotFoundError(_0x539e2e,_0x3287f4),0x1;let _0x2dca90;try{_0x2dca90=readFileSync(_0x539e2e,_0x55d024(0x227));}catch(_0x315e6d){const _0x82f183=_0x315e6d instanceof Error?_0x315e6d[_0x55d024(0x247)]:String(_0x315e6d);return console[_0x55d024(0x280)](_0x55d024(0x250)+_0x82f183),0x1;}let _0x3d7055;try{_0x3d7055=parseDef(_0x2dca90);}catch(_0x5e3602){const _0x20a75c=_0x5e3602 instanceof Error?_0x5e3602['message']:String(_0x5e3602);return console['error'](a26_0x14b5c2[_0x55d024(0x25d)](_0x55d024(0x270)+_0x20a75c)),0x1;}if(_0x3d7055['personalization_services']&&_0x3d7055[_0x55d024(0x24f)]['length']>0x0)return console[_0x55d024(0x280)](a26_0x14b5c2[_0x55d024(0x1b7)](_0x55d024(0x221)+_0x539e2e)),console['error'](a26_0x14b5c2[_0x55d024(0x22d)]('\x20\x20\x20'+_0x3d7055['personalization_services']['length']+'\x20service(s)\x20configured')),0x1;!_0x3d7055[_0x55d024(0x131)]&&(_0x3d7055[_0x55d024(0x131)]={'events':[{'name':_0x55d024(0x163),'source_table':_0x55d024(0x230)}],'attributes':[{'name':_0x55d024(0x168),'type':_0x55d024(0x1f2)}],'id_stitching':{'primary_key':_0x3d7055['master'][_0x55d024(0x112)]===_0x55d024(0x287)?_0x55d024(0x1d4):_0x55d024(0x1cb)}});_0x3d7055[_0x55d024(0x24f)]=[{'name':_0x55d024(0x18b),'description':_0x55d024(0x1fd),'trigger_event':_0x55d024(0x163),'sections':[{'name':_0x55d024(0x242),'criteria':_0x55d024(0x111),'attributes':['last_page_viewed']}]}];const _0xfa5d7c=serializeDef(_0x3d7055);return writeFileSync(_0x539e2e,_0xfa5d7c,_0x55d024(0x227)),console[_0x55d024(0x280)](a26_0x14b5c2[_0x55d024(0x1ba)]('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a26_0x14b5c2[_0x55d024(0x260)](_0x539e2e)),(!_0x3d7055[_0x55d024(0x131)]||_0x2dca90[_0x55d024(0x164)]('realtime:')===-0x1)&&console[_0x55d024(0x280)](a26_0x14b5c2['green']('✔')+_0x55d024(0x137)),console[_0x55d024(0x280)]('\x0a'+a26_0x14b5c2[_0x55d024(0x22d)](_0x55d024(0x177))),console['error']('\x20\x201.\x20Edit\x20'+_0x539e2e+_0x55d024(0x1af)),console['error'](_0x55d024(0x13d)+a26_0x14b5c2['dim'](_0x55d024(0x12e)+_0x3287f4)+_0x55d024(0x268)),0x0;}}
@@ -1 +1 @@
1
- const a27_0x561abc=a27_0x60f2;(function(_0x3a2066,_0x564d93){const _0x17b5ef=a27_0x60f2,_0x30cfb3=_0x3a2066();while(!![]){try{const _0x5fc809=-parseInt(_0x17b5ef(0x190))/0x1+parseInt(_0x17b5ef(0x199))/0x2+-parseInt(_0x17b5ef(0x1bc))/0x3+parseInt(_0x17b5ef(0x17d))/0x4*(-parseInt(_0x17b5ef(0x1a1))/0x5)+-parseInt(_0x17b5ef(0x175))/0x6+-parseInt(_0x17b5ef(0x1be))/0x7+parseInt(_0x17b5ef(0x1a3))/0x8;if(_0x5fc809===_0x564d93)break;else _0x30cfb3['push'](_0x30cfb3['shift']());}catch(_0x4efee1){_0x30cfb3['push'](_0x30cfb3['shift']());}}}(a27_0x4406,0xea7ab));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a27_0x232fe3 from'node:path';function a27_0x60f2(_0x132427,_0x4fa86e){_0x132427=_0x132427-0x15c;const _0x4406f4=a27_0x4406();let _0x60f2e6=_0x4406f4[_0x132427];return _0x60f2e6;}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a27_0x4406(){const _0x25e4ed=['confirm','trim','us01','You\x20can\x20find\x20your\x20API\x20key\x20at:','Validating\x20API\x20key...','profile:remove','profile','length','\x20\x20-\x20','Profile\x20name\x20cannot\x20be\x20empty','VALID_KEYS','\x20Profile\x20\x27','getUserInfo','Failed\x20to\x20remove\x20profile:\x20','\x27\x20does\x20not\x20exist.','Default\x20profile\x20set\x20to:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20tdx\x20--profile\x20','3746049AMhHfS','yellow','7377356bzQwZq','description','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key:','\x20\x20(no\x20profiles\x20found)','Set\x20session\x20profile','includes','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Create\x20a\x20new\x20profile','red','tdx:\x20profile\x20set','\x27\x20removed\x20from\x20configuration','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','ERROR','llm_agent','logLevel','split','\x0aSaved\x20to:\x20','profile:set','\x27.\x0a\x0aValid\x20keys:\x20','Remove\x20a\x20profile','green','customSite','log','text','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','error','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','9352482fFnFYc','execute','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','API\x20key\x20cannot\x20be\x20empty','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Removal\x20cancelled','Session\x20profile\x20set\x20to:\x20','profile:create','2632ZTCcCN','tdx:\x20profile\x20create','\x20API\x20key\x20removed\x20from\x20system\x20keychain','site','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','validate','✗\x20Validation\x20failed:\x20','profileName','profile:use','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','Site\x20was\x20not\x20changed.','tdx.json','status','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Enter\x20profile\x20name:','(cleared)','1796000rAwxba','join','Site\x20name\x20cannot\x20be\x20empty','session','Unknown\x20key\x20\x27','jobs','Enter\x20description\x20(optional):','test','warn','3125548jscIqf','name','\x27\x20updated:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Changing\x20site\x20to\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Enter\x20site\x20name:','14320WCRxSB','apiKey','55516024lsdhNn','message','\x0aSetup\x20cancelled','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'];a27_0x4406=function(){return _0x25e4ed;};return a27_0x4406();}import a27_0x40904d from'prompts';import a27_0x138f8f from'chalk';function validateProfileName(_0x21889d){const _0x384862=a27_0x60f2;if(!_0x21889d||!_0x21889d['trim']())return _0x384862(0x1b0);const _0xbfbd56=_0x21889d[_0x384862(0x1a8)]();if(!/^[a-zA-Z0-9_-]+$/[_0x384862(0x197)](_0xbfbd56))return _0x384862(0x174);if(profileExists(_0xbfbd56))return'Profile\x20\x27'+_0xbfbd56+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a27_0x561abc(0x17c);[a27_0x561abc(0x1bf)]=a27_0x561abc(0x15c);async[a27_0x561abc(0x176)](_0x4c5b1a){const _0x42bd27=a27_0x561abc,{options:_0x30d1b0,args:_0x47d380}=_0x4c5b1a;console[_0x42bd27(0x16d)](a27_0x138f8f['bold'](_0x42bd27(0x17e)));let _0x107bab;if(_0x47d380[_0x42bd27(0x1ae)]>0x0&&_0x47d380[0x0]){const _0x137d75=_0x47d380[0x0][_0x42bd27(0x1a8)](),_0x35413b=validateProfileName(_0x137d75);if(_0x35413b!==!![])return console[_0x42bd27(0x173)](a27_0x138f8f[_0x42bd27(0x15d)](_0x35413b)),0x1;_0x107bab=_0x137d75;}else{const _0x3e38de=await a27_0x40904d({'type':_0x42bd27(0x16e),'name':_0x42bd27(0x186),'message':_0x42bd27(0x18e),'validate':validateProfileName});if(!_0x3e38de[_0x42bd27(0x186)])return console[_0x42bd27(0x16d)](_0x42bd27(0x1a5)),0x1;_0x107bab=_0x3e38de['profileName']['trim']();}const _0x3d68b8=await a27_0x40904d({'type':_0x42bd27(0x16e),'name':_0x42bd27(0x1bf),'message':_0x42bd27(0x196)}),_0x422bfb=_0x3d68b8[_0x42bd27(0x1bf)]?.[_0x42bd27(0x1a8)]()||undefined,_0x50a8d8=_0x30d1b0['site']||'us01',{choices:_0x4e9d99,initialIndex:_0x15ddfd}=buildSiteChoices(_0x50a8d8),_0x17bdf9=await a27_0x40904d({'type':'select','name':'site','message':_0x42bd27(0x172)+_0x107bab+'\x27:','choices':_0x4e9d99,'initial':_0x15ddfd});if(!_0x17bdf9[_0x42bd27(0x180)])return console[_0x42bd27(0x16d)](_0x42bd27(0x1a5)),0x1;let _0x373ea6;if(_0x17bdf9['site']==='other'){const _0x3564a9=await a27_0x40904d({'type':_0x42bd27(0x16e),'name':_0x42bd27(0x16c),'message':_0x42bd27(0x1a0),'initial':_0x42bd27(0x1a9),'validate':_0x4f5dc2=>{const _0x199cbb=_0x42bd27;if(!_0x4f5dc2||!_0x4f5dc2[_0x199cbb(0x1a8)]())return _0x199cbb(0x192);if(!/^[a-z0-9-]+$/['test'](_0x4f5dc2[_0x199cbb(0x1a8)]()))return _0x199cbb(0x177);return!![];}});if(!_0x3564a9[_0x42bd27(0x16c)])return console[_0x42bd27(0x16d)]('\x0aSetup\x20cancelled'),0x1;_0x373ea6=_0x3564a9[_0x42bd27(0x16c)];}else _0x373ea6=_0x17bdf9['site'];const _0x43de12=resolveSite(_0x373ea6);console[_0x42bd27(0x16d)](_0x42bd27(0x1a6)+_0x43de12),console[_0x42bd27(0x16d)](_0x42bd27(0x1aa)),console['log']('\x20\x20'+getConsoleUrl(_0x43de12,_0x42bd27(0x1c0)));const _0x533014=await a27_0x40904d({'type':'password','name':_0x42bd27(0x1a2),'message':_0x42bd27(0x1c1),'validate':_0x401506=>{const _0x27ab45=_0x42bd27;if(!_0x401506||!_0x401506[_0x27ab45(0x1a8)]())return _0x27ab45(0x178);return!![];}});if(!_0x533014[_0x42bd27(0x1a2)])return console[_0x42bd27(0x16d)]('\x0aSetup\x20cancelled'),0x1;const _0x2e7fa4=_0x533014['apiKey'];console[_0x42bd27(0x16d)]('Validating\x20API\x20key...');try{const _0x4b445d=TDX[_0x42bd27(0x1b8)]({'site':_0x43de12,'apiKey':_0x2e7fa4[_0x42bd27(0x1a8)](),'logLevel':_0x30d1b0[_0x42bd27(0x165)]??LogLevel['ERROR']}),_0x13dab9=await _0x4b445d[_0x42bd27(0x195)]['getUserInfo']();console['log'](a27_0x138f8f[_0x42bd27(0x16b)]('✓')+_0x42bd27(0x1ba)+_0x13dab9['email']+')');const _0x10f699=await isKeychainAvailable();_0x10f699?(await saveAPIKeyAsync(_0x2e7fa4[_0x42bd27(0x1a8)](),_0x43de12,_0x107bab),console[_0x42bd27(0x16d)](a27_0x138f8f[_0x42bd27(0x16b)]('✓')+_0x42bd27(0x19f)+_0x107bab+')')):(console[_0x42bd27(0x198)](a27_0x138f8f[_0x42bd27(0x1bd)](_0x42bd27(0x171))),console[_0x42bd27(0x198)](a27_0x138f8f[_0x42bd27(0x1bd)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x2030b1={'site':_0x43de12,..._0x422bfb&&{'description':_0x422bfb}};return saveProfileToUserConfig(_0x107bab,_0x2030b1),console[_0x42bd27(0x16d)](a27_0x138f8f[_0x42bd27(0x16b)]('✓')+_0x42bd27(0x1b2)+_0x107bab+'\x27\x20created'),console[_0x42bd27(0x16d)](),console['log'](_0x42bd27(0x188)),console[_0x42bd27(0x16d)](_0x42bd27(0x1bb)+_0x107bab+_0x42bd27(0x170)),console['log'](_0x42bd27(0x1bb)+_0x107bab+_0x42bd27(0x160)),0x0;}catch(_0xdcd3c3){if(_0xdcd3c3 instanceof HTTPClientError&&_0xdcd3c3[_0x42bd27(0x18c)]===0x191)return printAuthError(_0xdcd3c3),0x1;return console[_0x42bd27(0x173)](a27_0x138f8f[_0x42bd27(0x15d)](_0x42bd27(0x185)+(_0xdcd3c3 instanceof Error?_0xdcd3c3[_0x42bd27(0x1a4)]:String(_0xdcd3c3)))),console['error'](_0x42bd27(0x1c5)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a27_0x561abc(0x1ac);[a27_0x561abc(0x1bf)]=a27_0x561abc(0x16a);['validate'](_0x17e758){const _0x1617d3=a27_0x561abc,{args:_0x4392fc}=_0x17e758;if(_0x4392fc['length']===0x0)return _0x1617d3(0x19e);return undefined;}async[a27_0x561abc(0x176)](_0x55f364){const _0x34d0f7=a27_0x561abc,{args:_0x362554}=_0x55f364,_0x50fb6a=_0x362554[0x0];console[_0x34d0f7(0x16d)](a27_0x138f8f['bold']('tdx:\x20profile\x20remove'));if(!profileExists(_0x50fb6a)){console['error'](a27_0x138f8f['red']('Profile\x20\x27'+_0x50fb6a+'\x27\x20does\x20not\x20exist.')),console[_0x34d0f7(0x16d)](_0x34d0f7(0x182));const _0x24f168=listProfiles();if(_0x24f168[_0x34d0f7(0x1ae)]===0x0)console['log'](_0x34d0f7(0x1c2));else for(const _0x175a29 of _0x24f168){console[_0x34d0f7(0x16d)](_0x34d0f7(0x1af)+_0x175a29[_0x34d0f7(0x19a)]);}return 0x1;}const _0x54ed96=await a27_0x40904d({'type':_0x34d0f7(0x1a7),'name':_0x34d0f7(0x1a7),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x50fb6a+'\x27?','initial':![]});if(!_0x54ed96[_0x34d0f7(0x1a7)])return console['log'](_0x34d0f7(0x17a)),0x0;try{removeProfileFromUserConfig(_0x50fb6a),console[_0x34d0f7(0x16d)](a27_0x138f8f[_0x34d0f7(0x16b)]('✓')+_0x34d0f7(0x1b2)+_0x50fb6a+_0x34d0f7(0x15f));}catch(_0x3e83f2){return console[_0x34d0f7(0x173)](a27_0x138f8f[_0x34d0f7(0x15d)](_0x34d0f7(0x1b4)+(_0x3e83f2 instanceof Error?_0x3e83f2[_0x34d0f7(0x1a4)]:String(_0x3e83f2)))),0x1;}const _0x377ae4=await isKeychainAvailable();if(_0x377ae4){const _0x236f33=await deleteKeychainAPIKey(_0x50fb6a);_0x236f33&&console[_0x34d0f7(0x16d)](a27_0x138f8f['green']('✓')+_0x34d0f7(0x17f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x561abc(0x19a)]=a27_0x561abc(0x168);[a27_0x561abc(0x1bf)]='Set\x20a\x20profile\x20configuration\x20value';static [a27_0x561abc(0x1b1)]=[a27_0x561abc(0x180),a27_0x561abc(0x162),'parent_segment','llm_project',a27_0x561abc(0x164),'description'];[a27_0x561abc(0x184)](_0x5ec9e7){const _0xcf81d7=a27_0x561abc,{args:_0x3561b3,options:_0x470b57}=_0x5ec9e7,_0x12243e=_0x470b57['profile']||getActiveProfile();if(!_0x12243e)return _0xcf81d7(0x189);if(_0x3561b3['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xcf81d7(0x1b1)]['join'](',\x20');const _0x1e484a=_0x3561b3[0x0];if(!_0x1e484a[_0xcf81d7(0x1c4)]('='))return _0xcf81d7(0x161)+ProfileSetCommand[_0xcf81d7(0x1b1)][_0xcf81d7(0x191)](',\x20');const [_0x32bb3c]=_0x1e484a[_0xcf81d7(0x166)]('=',0x2);if(!ProfileSetCommand[_0xcf81d7(0x1b1)][_0xcf81d7(0x1c4)](_0x32bb3c))return _0xcf81d7(0x194)+_0x32bb3c+_0xcf81d7(0x169)+ProfileSetCommand[_0xcf81d7(0x1b1)][_0xcf81d7(0x191)](',\x20');return undefined;}async[a27_0x561abc(0x176)](_0x2a1a7c){const _0x229bf1=a27_0x561abc,{args:_0x1010a6,options:_0x588524}=_0x2a1a7c,_0x5e14e5=_0x588524[_0x229bf1(0x1ad)]||getActiveProfile(),[_0x2dc42f,..._0x7de9d8]=_0x1010a6[0x0]['split']('='),_0x343c81=_0x7de9d8[_0x229bf1(0x191)]('=');console[_0x229bf1(0x16d)](a27_0x138f8f['bold'](_0x229bf1(0x15e)));if(!profileExists(_0x5e14e5)){const _0x312f6c=await a27_0x40904d({'type':_0x229bf1(0x1a7),'name':_0x229bf1(0x1b8),'message':'Profile\x20\x27'+_0x5e14e5+_0x229bf1(0x181),'initial':!![]});if(!_0x312f6c[_0x229bf1(0x1b8)])return console[_0x229bf1(0x16d)]('Operation\x20cancelled'),0x1;}const _0xd5dcea=loadProfile(_0x5e14e5),_0x27cf2f=_0xd5dcea?.['config']||{};if(_0x2dc42f==='site'){const _0x3d44ea=resolveSite(_0x343c81);console['log'](_0x229bf1(0x19d)+_0x3d44ea+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x229bf1(0x16d)](_0x229bf1(0x1b7)),console[_0x229bf1(0x16d)]('\x20\x20'+getConsoleUrl(_0x3d44ea,'/app/mp/ak'));const _0xed1036=await a27_0x40904d({'type':'password','name':_0x229bf1(0x1a2),'message':_0x229bf1(0x18d),'validate':_0x6b9f2c=>{const _0x882443=_0x229bf1;if(!_0x6b9f2c||!_0x6b9f2c[_0x882443(0x1a8)]())return _0x882443(0x178);return!![];}});if(!_0xed1036['apiKey'])return console['log'](_0x229bf1(0x183)),0x1;console['log'](_0x229bf1(0x1ab));try{const _0x39a0b0=TDX[_0x229bf1(0x1b8)]({'site':_0x3d44ea,'apiKey':_0xed1036['apiKey']['trim'](),'logLevel':_0x588524[_0x229bf1(0x165)]??LogLevel[_0x229bf1(0x163)]}),_0x25d135=await _0x39a0b0[_0x229bf1(0x195)][_0x229bf1(0x1b3)]();console[_0x229bf1(0x16d)](a27_0x138f8f[_0x229bf1(0x16b)]('✓')+_0x229bf1(0x1ba)+_0x25d135['email']+')');const _0x4f8087=await isKeychainAvailable();_0x4f8087?(await saveAPIKeyAsync(_0xed1036[_0x229bf1(0x1a2)]['trim'](),_0x3d44ea,_0x5e14e5),console[_0x229bf1(0x16d)](a27_0x138f8f[_0x229bf1(0x16b)]('✓')+_0x229bf1(0x179))):console['warn'](a27_0x138f8f[_0x229bf1(0x1bd)](_0x229bf1(0x171))),_0x27cf2f['site']=_0x3d44ea;}catch(_0x442fd5){if(_0x442fd5 instanceof HTTPClientError&&_0x442fd5[_0x229bf1(0x18c)]===0x191)return printAuthError(_0x442fd5),0x1;return console[_0x229bf1(0x173)](a27_0x138f8f[_0x229bf1(0x15d)](_0x229bf1(0x185)+(_0x442fd5 instanceof Error?_0x442fd5[_0x229bf1(0x1a4)]:String(_0x442fd5)))),console[_0x229bf1(0x173)](_0x229bf1(0x18a)),0x1;}}else _0x27cf2f[_0x2dc42f]=_0x343c81||undefined;return saveProfileToUserConfig(_0x5e14e5,_0x27cf2f),console['log'](a27_0x138f8f['green']('✓')+_0x229bf1(0x1b2)+_0x5e14e5+_0x229bf1(0x19b)+_0x2dc42f+'='+(_0x343c81||_0x229bf1(0x18f))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x561abc(0x19a)]=a27_0x561abc(0x187);['description']=a27_0x561abc(0x1c3);[a27_0x561abc(0x184)](_0x46597a){const _0x37c5a3=a27_0x561abc,{args:_0x19905c}=_0x46597a;if(_0x19905c[_0x37c5a3(0x1ae)]===0x0)return _0x37c5a3(0x19c);return undefined;}async[a27_0x561abc(0x176)](_0x38d9e1){const _0x43bc93=a27_0x561abc,{args:_0x3b9ec2,options:_0x41cf06}=_0x38d9e1,_0x344fca=_0x3b9ec2[0x0],_0x59fe7a=_0x41cf06['default'];cleanExpiredSessions();if(!profileExists(_0x344fca)){console[_0x43bc93(0x173)](a27_0x138f8f['red'](_0x43bc93(0x16f)+_0x344fca+_0x43bc93(0x1b5))),console[_0x43bc93(0x16d)](_0x43bc93(0x182));const _0x1df39e=listProfiles();if(_0x1df39e[_0x43bc93(0x1ae)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x27fdf7 of _0x1df39e){console['log'](_0x43bc93(0x1af)+_0x27fdf7[_0x43bc93(0x19a)]);}return 0x1;}if(_0x59fe7a){const _0x47c27c=a27_0x232fe3[_0x43bc93(0x191)](getConfigDir(),_0x43bc93(0x18b));return saveActiveProfileToUserConfig(_0x344fca),console[_0x43bc93(0x16d)](_0x43bc93(0x1b6)+a27_0x138f8f[_0x43bc93(0x16b)](_0x344fca)),console[_0x43bc93(0x16d)](a27_0x138f8f['dim'](_0x43bc93(0x167)+_0x47c27c)),0x0;}const _0x1b6523=getSessionID(_0x41cf06[_0x43bc93(0x193)]);return saveSessionContext({'profile':_0x344fca},_0x41cf06[_0x43bc93(0x193)]),console[_0x43bc93(0x16d)](_0x43bc93(0x17b)+a27_0x138f8f[_0x43bc93(0x16b)](_0x344fca)+'\x20'+a27_0x138f8f['dim']('(session:\x20'+_0x1b6523+')')),console[_0x43bc93(0x16d)](a27_0x138f8f['dim'](_0x43bc93(0x1b9)+_0x344fca+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a27_0x4c49cd=a27_0x14aa;(function(_0x1ed117,_0x361649){const _0x3d0fa4=a27_0x14aa,_0x3e7f00=_0x1ed117();while(!![]){try{const _0x116b75=parseInt(_0x3d0fa4(0x118))/0x1+parseInt(_0x3d0fa4(0x116))/0x2*(-parseInt(_0x3d0fa4(0x170))/0x3)+parseInt(_0x3d0fa4(0x13e))/0x4*(-parseInt(_0x3d0fa4(0x14b))/0x5)+-parseInt(_0x3d0fa4(0x113))/0x6*(parseInt(_0x3d0fa4(0x139))/0x7)+-parseInt(_0x3d0fa4(0x171))/0x8*(-parseInt(_0x3d0fa4(0x127))/0x9)+parseInt(_0x3d0fa4(0x149))/0xa*(parseInt(_0x3d0fa4(0x144))/0xb)+parseInt(_0x3d0fa4(0x12b))/0xc;if(_0x116b75===_0x361649)break;else _0x3e7f00['push'](_0x3e7f00['shift']());}catch(_0x4c3275){_0x3e7f00['push'](_0x3e7f00['shift']());}}}(a27_0x4edc,0x2dafc));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a27_0x40866c 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';function a27_0x14aa(_0x205e8b,_0x207903){_0x205e8b=_0x205e8b-0xfe;const _0x4edc0f=a27_0x4edc();let _0x14aa6a=_0x4edc0f[_0x205e8b];return _0x14aa6a;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0x1c153f from'prompts';import a27_0x5d77db from'chalk';function a27_0x4edc(){const _0x4a55ba=['Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','480NeJQYn','red','Remove\x20a\x20profile','Operation\x20cancelled','bold','split','33bSnvPk','test','Session\x20profile\x20set\x20to:\x20','\x27\x20requires\x20API\x20key\x20validation.','\x0aAvailable\x20profiles:','684150HkULcK','confirm','12230sRgreb','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Default\x20profile\x20set\x20to:\x20','profile:use','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','database','profile:create','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','error','/app/mp/ak','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','trim','VALID_KEYS','\x27.\x0a\x0aValid\x20keys:\x20','Validating\x20API\x20key...','Site\x20was\x20not\x20changed.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','text','dim','Unknown\x20key\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Removal\x20cancelled','Profile\x20name\x20cannot\x20be\x20empty','warn','llm_agent','customSite','\x20\x20-\x20','parent_segment','\x20\x20(no\x20profiles\x20found)','name','ERROR','profileName','Enter\x20site\x20name:','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x0aSetup\x20cancelled','Create\x20a\x20new\x20profile','51963nfMiJx','24VxdulG','tdx.json','getUserInfo','site','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x20--default\x27\x20to\x20save\x20permanently','jobs','default','\x0aOperation\x20cancelled','\x0aSaved\x20to:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','profile','length','\x20Profile\x20\x27','status','\x27\x20does\x20not\x20exist.','email','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','create','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','18138zFTmeG','Changing\x20site\x20to\x20\x27','\x27\x20removed\x20from\x20configuration','32rmXqqJ','password','68410zeRcJq','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','join','execute','message','logLevel','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx:\x20profile\x20remove','Enter\x20your\x20TD\x20API\x20key:','Profile\x20\x27','profile:remove','Failed\x20to\x20remove\x20profile:\x20','API\x20key\x20cannot\x20be\x20empty','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20tdx\x20--profile\x20','1105911obToUe','(cleared)','includes','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','3925272QMJwRZ','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','green','description','Enter\x20profile\x20name:','yellow','session','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','log','Set\x20a\x20profile\x20configuration\x20value','apiKey','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Enter\x20description\x20(optional):','\x27\x20created','490xZuuEy','Site\x20name\x20cannot\x20be\x20empty','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','validate'];a27_0x4edc=function(){return _0x4a55ba;};return a27_0x4edc();}function validateProfileName(_0x4f9697){const _0x5e4f97=a27_0x14aa;if(!_0x4f9697||!_0x4f9697[_0x5e4f97(0x157)]())return _0x5e4f97(0x162);const _0x1ad677=_0x4f9697['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x5e4f97(0x145)](_0x1ad677))return _0x5e4f97(0x136);if(profileExists(_0x1ad677))return _0x5e4f97(0x121)+_0x1ad677+_0x5e4f97(0x14f);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x4c49cd(0x169)]=a27_0x4c49cd(0x151);[a27_0x4c49cd(0x12e)]=a27_0x4c49cd(0x16f);async['execute'](_0x4ded62){const _0x1afb57=a27_0x4c49cd,{options:_0x29d8f1,args:_0x3735e7}=_0x4ded62;console[_0x1afb57(0x133)](a27_0x5d77db['bold']('tdx:\x20profile\x20create'));let _0xd8d61e;if(_0x3735e7[_0x1afb57(0x10a)]>0x0&&_0x3735e7[0x0]){const _0x2c9762=_0x3735e7[0x0][_0x1afb57(0x157)](),_0xc19800=validateProfileName(_0x2c9762);if(_0xc19800!==!![])return console[_0x1afb57(0x154)](a27_0x5d77db[_0x1afb57(0x13f)](_0xc19800)),0x1;_0xd8d61e=_0x2c9762;}else{const _0x1d62e4=await a27_0x1c153f({'type':'text','name':_0x1afb57(0x16b),'message':_0x1afb57(0x12f),'validate':validateProfileName});if(!_0x1d62e4[_0x1afb57(0x16b)])return console[_0x1afb57(0x133)]('\x0aSetup\x20cancelled'),0x1;_0xd8d61e=_0x1d62e4[_0x1afb57(0x16b)][_0x1afb57(0x157)]();}const _0x3b98db=await a27_0x1c153f({'type':_0x1afb57(0x15d),'name':_0x1afb57(0x12e),'message':_0x1afb57(0x137)}),_0x348e7c=_0x3b98db['description']?.['trim']()||undefined,_0x4d016f=_0x29d8f1[_0x1afb57(0x100)]||'us01',{choices:_0x2646e1,initialIndex:_0x45ca61}=buildSiteChoices(_0x4d016f),_0x14cdee=await a27_0x1c153f({'type':'select','name':_0x1afb57(0x100),'message':_0x1afb57(0x110)+_0xd8d61e+'\x27:','choices':_0x2646e1,'initial':_0x45ca61});if(!_0x14cdee['site'])return console[_0x1afb57(0x133)]('\x0aSetup\x20cancelled'),0x1;let _0x303a27;if(_0x14cdee[_0x1afb57(0x100)]==='other'){const _0x3f3953=await a27_0x1c153f({'type':_0x1afb57(0x15d),'name':_0x1afb57(0x165),'message':_0x1afb57(0x16c),'initial':'us01','validate':_0x1d83d5=>{const _0x2e7716=_0x1afb57;if(!_0x1d83d5||!_0x1d83d5['trim']())return _0x2e7716(0x13a);if(!/^[a-z0-9-]+$/['test'](_0x1d83d5[_0x2e7716(0x157)]()))return _0x2e7716(0x102);return!![];}});if(!_0x3f3953[_0x1afb57(0x165)])return console[_0x1afb57(0x133)](_0x1afb57(0x16e)),0x1;_0x303a27=_0x3f3953[_0x1afb57(0x165)];}else _0x303a27=_0x14cdee[_0x1afb57(0x100)];const _0x2be730=resolveSite(_0x303a27);console[_0x1afb57(0x133)](_0x1afb57(0x160)+_0x2be730),console[_0x1afb57(0x133)](_0x1afb57(0x152)),console['log']('\x20\x20'+getConsoleUrl(_0x2be730,_0x1afb57(0x155)));const _0x1f640d=await a27_0x1c153f({'type':_0x1afb57(0x117),'name':_0x1afb57(0x135),'message':_0x1afb57(0x120),'validate':_0x2fd03b=>{const _0x30c72f=_0x1afb57;if(!_0x2fd03b||!_0x2fd03b[_0x30c72f(0x157)]())return _0x30c72f(0x124);return!![];}});if(!_0x1f640d[_0x1afb57(0x135)])return console['log'](_0x1afb57(0x16e)),0x1;const _0x24abfb=_0x1f640d[_0x1afb57(0x135)];console['log']('Validating\x20API\x20key...');try{const _0x183746=TDX[_0x1afb57(0x111)]({'site':_0x2be730,'apiKey':_0x24abfb['trim'](),'logLevel':_0x29d8f1[_0x1afb57(0x11d)]??LogLevel[_0x1afb57(0x16a)]}),_0x3682a8=await _0x183746['jobs'][_0x1afb57(0xff)]();console[_0x1afb57(0x133)](a27_0x5d77db[_0x1afb57(0x12d)]('✓')+_0x1afb57(0x125)+_0x3682a8[_0x1afb57(0x10e)]+')');const _0x5aa9d0=await isKeychainAvailable();_0x5aa9d0?(await saveAPIKeyAsync(_0x24abfb['trim'](),_0x2be730,_0xd8d61e),console[_0x1afb57(0x133)](a27_0x5d77db[_0x1afb57(0x12d)]('✓')+_0x1afb57(0x156)+_0xd8d61e+')')):(console[_0x1afb57(0x163)](a27_0x5d77db[_0x1afb57(0x130)](_0x1afb57(0x11e))),console[_0x1afb57(0x163)](a27_0x5d77db[_0x1afb57(0x130)](_0x1afb57(0x108))));const _0x5b19c3={'site':_0x2be730,..._0x348e7c&&{'description':_0x348e7c}};return saveProfileToUserConfig(_0xd8d61e,_0x5b19c3),console[_0x1afb57(0x133)](a27_0x5d77db[_0x1afb57(0x12d)]('✓')+_0x1afb57(0x10b)+_0xd8d61e+_0x1afb57(0x138)),console['log'](),console[_0x1afb57(0x133)](_0x1afb57(0x12a)),console[_0x1afb57(0x133)](_0x1afb57(0x126)+_0xd8d61e+_0x1afb57(0x12c)),console[_0x1afb57(0x133)]('\x20\x20tdx\x20--profile\x20'+_0xd8d61e+_0x1afb57(0x14c)),0x0;}catch(_0x2ddc15){if(_0x2ddc15 instanceof HTTPClientError&&_0x2ddc15[_0x1afb57(0x10c)]===0x191)return printAuthError(_0x2ddc15),0x1;return console[_0x1afb57(0x154)](a27_0x5d77db[_0x1afb57(0x13f)]('✗\x20Validation\x20failed:\x20'+(_0x2ddc15 instanceof Error?_0x2ddc15[_0x1afb57(0x11c)]:String(_0x2ddc15)))),console[_0x1afb57(0x154)](_0x1afb57(0x13d)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x4c49cd(0x169)]=a27_0x4c49cd(0x122);['description']=a27_0x4c49cd(0x140);['validate'](_0x1f28fd){const _0x36ac07=a27_0x4c49cd,{args:_0x1821a7}=_0x1f28fd;if(_0x1821a7[_0x36ac07(0x10a)]===0x0)return _0x36ac07(0x119);return undefined;}async[a27_0x4c49cd(0x11b)](_0x108ba5){const _0x58008e=a27_0x4c49cd,{args:_0x19d1fe}=_0x108ba5,_0xb7ae7c=_0x19d1fe[0x0];console[_0x58008e(0x133)](a27_0x5d77db[_0x58008e(0x142)](_0x58008e(0x11f)));if(!profileExists(_0xb7ae7c)){console['error'](a27_0x5d77db[_0x58008e(0x13f)](_0x58008e(0x121)+_0xb7ae7c+'\x27\x20does\x20not\x20exist.')),console['log']('\x0aAvailable\x20profiles:');const _0x27f375=listProfiles();if(_0x27f375[_0x58008e(0x10a)]===0x0)console[_0x58008e(0x133)](_0x58008e(0x168));else for(const _0x17141f of _0x27f375){console['log']('\x20\x20-\x20'+_0x17141f[_0x58008e(0x169)]);}return 0x1;}const _0x537259=await a27_0x1c153f({'type':_0x58008e(0x14a),'name':_0x58008e(0x14a),'message':_0x58008e(0x10f)+_0xb7ae7c+'\x27?','initial':![]});if(!_0x537259[_0x58008e(0x14a)])return console[_0x58008e(0x133)](_0x58008e(0x161)),0x0;try{removeProfileFromUserConfig(_0xb7ae7c),console['log'](a27_0x5d77db['green']('✓')+'\x20Profile\x20\x27'+_0xb7ae7c+_0x58008e(0x115));}catch(_0x4998d9){return console['error'](a27_0x5d77db['red'](_0x58008e(0x123)+(_0x4998d9 instanceof Error?_0x4998d9[_0x58008e(0x11c)]:String(_0x4998d9)))),0x1;}const _0x320910=await isKeychainAvailable();if(_0x320910){const _0x45a53a=await deleteKeychainAPIKey(_0xb7ae7c);_0x45a53a&&console[_0x58008e(0x133)](a27_0x5d77db[_0x58008e(0x12d)]('✓')+_0x58008e(0x16d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x4c49cd(0x169)]='profile:set';['description']=a27_0x4c49cd(0x134);static ['VALID_KEYS']=[a27_0x4c49cd(0x100),a27_0x4c49cd(0x150),a27_0x4c49cd(0x167),'llm_project',a27_0x4c49cd(0x164),a27_0x4c49cd(0x12e)];[a27_0x4c49cd(0x13c)](_0x5cabba){const _0x2b79a8=a27_0x4c49cd,{args:_0x15a672,options:_0x28988a}=_0x5cabba,_0x3bd4fd=_0x28988a[_0x2b79a8(0x109)]||getActiveProfile();if(!_0x3bd4fd)return'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>';if(_0x15a672[_0x2b79a8(0x10a)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x2b79a8(0x158)]['join'](',\x20');const _0x5956c2=_0x15a672[0x0];if(!_0x5956c2[_0x2b79a8(0x129)]('='))return _0x2b79a8(0x112)+ProfileSetCommand[_0x2b79a8(0x158)]['join'](',\x20');const [_0x2eab38]=_0x5956c2[_0x2b79a8(0x143)]('=',0x2);if(!ProfileSetCommand[_0x2b79a8(0x158)][_0x2b79a8(0x129)](_0x2eab38))return _0x2b79a8(0x15f)+_0x2eab38+_0x2b79a8(0x159)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a27_0x4c49cd(0x11b)](_0x3f0465){const _0x28ef2d=a27_0x4c49cd,{args:_0x59ef40,options:_0x500239}=_0x3f0465,_0x438197=_0x500239['profile']||getActiveProfile(),[_0x101e6f,..._0x4609f7]=_0x59ef40[0x0]['split']('='),_0x1a19dc=_0x4609f7[_0x28ef2d(0x11a)]('=');console[_0x28ef2d(0x133)](a27_0x5d77db['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x438197)){const _0x1978dc=await a27_0x1c153f({'type':'confirm','name':_0x28ef2d(0x111),'message':_0x28ef2d(0x121)+_0x438197+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x1978dc[_0x28ef2d(0x111)])return console['log'](_0x28ef2d(0x141)),0x1;}const _0x163920=loadProfile(_0x438197),_0x16b72f=_0x163920?.['config']||{};if(_0x101e6f==='site'){const _0x148887=resolveSite(_0x1a19dc);console['log'](_0x28ef2d(0x114)+_0x148887+_0x28ef2d(0x147)),console[_0x28ef2d(0x133)](_0x28ef2d(0x101)),console['log']('\x20\x20'+getConsoleUrl(_0x148887,'/app/mp/ak'));const _0x8e2f0c=await a27_0x1c153f({'type':'password','name':_0x28ef2d(0x135),'message':_0x28ef2d(0x132),'validate':_0xb458da=>{const _0x31fc5b=_0x28ef2d;if(!_0xb458da||!_0xb458da[_0x31fc5b(0x157)]())return _0x31fc5b(0x124);return!![];}});if(!_0x8e2f0c[_0x28ef2d(0x135)])return console['log'](_0x28ef2d(0x106)),0x1;console[_0x28ef2d(0x133)](_0x28ef2d(0x15a));try{const _0x50da35=TDX[_0x28ef2d(0x111)]({'site':_0x148887,'apiKey':_0x8e2f0c[_0x28ef2d(0x135)][_0x28ef2d(0x157)](),'logLevel':_0x500239['logLevel']??LogLevel[_0x28ef2d(0x16a)]}),_0x4965d1=await _0x50da35[_0x28ef2d(0x104)][_0x28ef2d(0xff)]();console[_0x28ef2d(0x133)](a27_0x5d77db[_0x28ef2d(0x12d)]('✓')+_0x28ef2d(0x125)+_0x4965d1[_0x28ef2d(0x10e)]+')');const _0x4f7060=await isKeychainAvailable();_0x4f7060?(await saveAPIKeyAsync(_0x8e2f0c['apiKey'][_0x28ef2d(0x157)](),_0x148887,_0x438197),console[_0x28ef2d(0x133)](a27_0x5d77db[_0x28ef2d(0x12d)]('✓')+_0x28ef2d(0x15c))):console[_0x28ef2d(0x163)](a27_0x5d77db['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x16b72f['site']=_0x148887;}catch(_0x322085){if(_0x322085 instanceof HTTPClientError&&_0x322085['status']===0x191)return printAuthError(_0x322085),0x1;return console[_0x28ef2d(0x154)](a27_0x5d77db['red']('✗\x20Validation\x20failed:\x20'+(_0x322085 instanceof Error?_0x322085[_0x28ef2d(0x11c)]:String(_0x322085)))),console[_0x28ef2d(0x154)](_0x28ef2d(0x15b)),0x1;}}else _0x16b72f[_0x101e6f]=_0x1a19dc||undefined;return saveProfileToUserConfig(_0x438197,_0x16b72f),console[_0x28ef2d(0x133)](a27_0x5d77db[_0x28ef2d(0x12d)]('✓')+_0x28ef2d(0x10b)+_0x438197+'\x27\x20updated:\x20'+_0x101e6f+'='+(_0x1a19dc||_0x28ef2d(0x128))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x4c49cd(0x169)]=a27_0x4c49cd(0x14e);[a27_0x4c49cd(0x12e)]='Set\x20session\x20profile';[a27_0x4c49cd(0x13c)](_0xb24052){const _0x1eeb12=a27_0x4c49cd,{args:_0x4bdb98}=_0xb24052;if(_0x4bdb98[_0x1eeb12(0x10a)]===0x0)return _0x1eeb12(0x153);return undefined;}async[a27_0x4c49cd(0x11b)](_0x5390a8){const _0x4078ea=a27_0x4c49cd,{args:_0x1429cb,options:_0x2ffc5f}=_0x5390a8,_0x423bad=_0x1429cb[0x0],_0x71da67=_0x2ffc5f[_0x4078ea(0x105)];cleanExpiredSessions();if(!profileExists(_0x423bad)){console[_0x4078ea(0x154)](a27_0x5d77db[_0x4078ea(0x13f)](_0x4078ea(0x121)+_0x423bad+_0x4078ea(0x10d))),console['log'](_0x4078ea(0x148));const _0x17bd96=listProfiles();if(_0x17bd96[_0x4078ea(0x10a)]===0x0)console[_0x4078ea(0x133)](_0x4078ea(0x168));else for(const _0x1c1b88 of _0x17bd96){console[_0x4078ea(0x133)](_0x4078ea(0x166)+_0x1c1b88['name']);}return 0x1;}if(_0x71da67){const _0x488c67=a27_0x40866c['join'](getConfigDir(),_0x4078ea(0xfe));return saveActiveProfileToUserConfig(_0x423bad),console[_0x4078ea(0x133)](_0x4078ea(0x14d)+a27_0x5d77db[_0x4078ea(0x12d)](_0x423bad)),console['log'](a27_0x5d77db[_0x4078ea(0x15e)](_0x4078ea(0x107)+_0x488c67)),0x0;}const _0x18eec7=getSessionID(_0x2ffc5f[_0x4078ea(0x131)]);return saveSessionContext({'profile':_0x423bad},_0x2ffc5f[_0x4078ea(0x131)]),console[_0x4078ea(0x133)](_0x4078ea(0x146)+a27_0x5d77db['green'](_0x423bad)+'\x20'+a27_0x5d77db['dim']('(session:\x20'+_0x18eec7+')')),console[_0x4078ea(0x133)](a27_0x5d77db[_0x4078ea(0x15e)](_0x4078ea(0x13b)+_0x423bad+_0x4078ea(0x103))),0x0;}}
@@ -1 +1 @@
1
- const a28_0x58d7e4=a28_0x3539;(function(_0x442744,_0x18f1b0){const _0x14eb4f=a28_0x3539,_0x4badbb=_0x442744();while(!![]){try{const _0x577f67=-parseInt(_0x14eb4f(0x1b8))/0x1+parseInt(_0x14eb4f(0x1a9))/0x2*(-parseInt(_0x14eb4f(0x1ab))/0x3)+-parseInt(_0x14eb4f(0x1b4))/0x4*(parseInt(_0x14eb4f(0x1b3))/0x5)+parseInt(_0x14eb4f(0x1b1))/0x6*(-parseInt(_0x14eb4f(0x1a3))/0x7)+-parseInt(_0x14eb4f(0x1b5))/0x8*(-parseInt(_0x14eb4f(0x1af))/0x9)+parseInt(_0x14eb4f(0x1aa))/0xa*(-parseInt(_0x14eb4f(0x1a1))/0xb)+parseInt(_0x14eb4f(0x1b9))/0xc;if(_0x577f67===_0x18f1b0)break;else _0x4badbb['push'](_0x4badbb['shift']());}catch(_0x3121cc){_0x4badbb['push'](_0x4badbb['shift']());}}}(a28_0x4c89,0x9c66e));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a28_0x3539(_0x5f1cb0,_0x164df1){_0x5f1cb0=_0x5f1cb0-0x1a1;const _0x4c8974=a28_0x4c89();let _0x3539c3=_0x4c8974[_0x5f1cb0];return _0x3539c3;}export class ProfilesCommand extends BaseCommand{[a28_0x58d7e4(0x1b2)]='profiles';[a28_0x58d7e4(0x1a4)]=a28_0x58d7e4(0x1a5);async[a28_0x58d7e4(0x1b7)](_0x4ce5ff){const _0x35b3af=a28_0x58d7e4,{options:_0x3de534}=_0x4ce5ff;try{const _0x425d7a=listProfiles(),_0x43dee5=getActiveProfile();if(_0x425d7a['length']===0x0)return console[_0x35b3af(0x1ae)](_0x35b3af(0x1ac)),console[_0x35b3af(0x1ae)](_0x35b3af(0x1b6)),console['log'](_0x35b3af(0x1a6)),0x0;const _0x3ce378=_0x425d7a[_0x35b3af(0x1ad)](_0x345403=>{const _0x2cbcfc=_0x35b3af,_0x1f4fc6=_0x345403[_0x2cbcfc(0x1b2)]===_0x43dee5,_0xd6db92=getProfileParams(_0x345403['config']);return{'name':_0x345403[_0x2cbcfc(0x1b2)],'active':_0x1f4fc6,'scope':_0x345403[_0x2cbcfc(0x1a7)],'description':_0x345403['config'][_0x2cbcfc(0x1a4)]||'','params':_0xd6db92};});return await handleSDKOutput(_0x3ce378,_0x3de534),0x0;}catch(_0x2a2847){return _0x2a2847 instanceof Error&&console[_0x35b3af(0x1b0)](_0x35b3af(0x1a8)+_0x2a2847[_0x35b3af(0x1a2)]),0x1;}}}function a28_0x4c89(){const _0x48e56d=['798017PWHDBe','message','91FgiQsD','description','List\x20all\x20available\x20profiles','\x20\x20Global:\x20~/.config/tdx/tdx.json','scope','Error:\x20','10CfheOo','130NLEEqH','609873NyKzqi','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','map','log','153TYawUY','error','39222NlMJqf','name','10aLbEvo','1548368xPYgii','322192GHJGnG','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','945313XjsUsZ','44640096nOnspm'];a28_0x4c89=function(){return _0x48e56d;};return a28_0x4c89();}
1
+ const a28_0x24b3d4=a28_0x2ca5;function a28_0x2ade(){const _0x2ad064=['error','9zCwrpl','name','length','Error:\x20','25012390tgPfbV','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','config','map','607416OdtmzS','log','\x20\x20Global:\x20~/.config/tdx/tdx.json','12OPRSPa','3698695HWMAYv','scope','670888BpSxIA','1039042PoDPrD','36IUvejW','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','description','1813483NnCXfu','551721QgnnUk','List\x20all\x20available\x20profiles'];a28_0x2ade=function(){return _0x2ad064;};return a28_0x2ade();}(function(_0x4a588f,_0x38ed7a){const _0x48f758=a28_0x2ca5,_0x5ac7de=_0x4a588f();while(!![]){try{const _0x226efd=-parseInt(_0x48f758(0x203))/0x1+-parseInt(_0x48f758(0x1fe))/0x2+-parseInt(_0x48f758(0x206))/0x3*(parseInt(_0x48f758(0x1fd))/0x4)+-parseInt(_0x48f758(0x1fb))/0x5+parseInt(_0x48f758(0x1fa))/0x6*(parseInt(_0x48f758(0x202))/0x7)+parseInt(_0x48f758(0x1f7))/0x8*(-parseInt(_0x48f758(0x1ff))/0x9)+parseInt(_0x48f758(0x1f3))/0xa;if(_0x226efd===_0x38ed7a)break;else _0x5ac7de['push'](_0x5ac7de['shift']());}catch(_0x9402f2){_0x5ac7de['push'](_0x5ac7de['shift']());}}}(a28_0x2ade,0x62072));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a28_0x2ca5(_0x5b9849,_0x2c42d2){_0x5b9849=_0x5b9849-0x1f2;const _0x2ade2f=a28_0x2ade();let _0x2ca531=_0x2ade2f[_0x5b9849];return _0x2ca531;}export class ProfilesCommand extends BaseCommand{['name']='profiles';[a28_0x24b3d4(0x201)]=a28_0x24b3d4(0x204);async['execute'](_0x38c560){const _0xcd3d18=a28_0x24b3d4,{options:_0x1e7680}=_0x38c560;try{const _0x37c2c0=listProfiles(),_0x49c817=getActiveProfile();if(_0x37c2c0[_0xcd3d18(0x208)]===0x0)return console['log'](_0xcd3d18(0x1f4)),console[_0xcd3d18(0x1f8)](_0xcd3d18(0x200)),console[_0xcd3d18(0x1f8)](_0xcd3d18(0x1f9)),0x0;const _0x392fcf=_0x37c2c0[_0xcd3d18(0x1f6)](_0x418640=>{const _0x207e16=_0xcd3d18,_0x246bf2=_0x418640[_0x207e16(0x207)]===_0x49c817,_0x46a032=getProfileParams(_0x418640[_0x207e16(0x1f5)]);return{'name':_0x418640['name'],'active':_0x246bf2,'scope':_0x418640[_0x207e16(0x1fc)],'description':_0x418640['config']['description']||'','params':_0x46a032};});return await handleSDKOutput(_0x392fcf,_0x1e7680),0x0;}catch(_0x1c086a){return _0x1c086a instanceof Error&&console[_0xcd3d18(0x205)](_0xcd3d18(0x1f2)+_0x1c086a['message']),0x1;}}}
@@ -1 +1 @@
1
- const a29_0x6a9414=a29_0x140a;(function(_0x5c750d,_0x24b80d){const _0x4b6cae=a29_0x140a,_0xbed93d=_0x5c750d();while(!![]){try{const _0x1eb3a2=-parseInt(_0x4b6cae(0x13b))/0x1+parseInt(_0x4b6cae(0x149))/0x2+-parseInt(_0x4b6cae(0x15a))/0x3+parseInt(_0x4b6cae(0x140))/0x4*(-parseInt(_0x4b6cae(0x14c))/0x5)+parseInt(_0x4b6cae(0x13c))/0x6*(parseInt(_0x4b6cae(0x14d))/0x7)+parseInt(_0x4b6cae(0x167))/0x8+parseInt(_0x4b6cae(0x151))/0x9*(parseInt(_0x4b6cae(0x165))/0xa);if(_0x1eb3a2===_0x24b80d)break;else _0xbed93d['push'](_0xbed93d['shift']());}catch(_0x566fb1){_0xbed93d['push'](_0xbed93d['shift']());}}}(a29_0x1533,0x50dbe));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a29_0x1533(){const _0xa4d09a=['354jssDtH','query','information_schema','name','4cTtIqi','message','file','\x0aAll\x20results\x20saved\x20to\x20','\x20splits','catalog','database','Site:\x20','Run\x20Trino\x20queries\x20(streaming)','187730uXfsLy','execute','Statement\x20','2472860XvZClH','4403ijiemA','output','jobId','Schema:\x20','30267SYrjdc','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','error','totalSplits','\x20[Job\x20ID:\x20','stats','Query\x20completed:\x20Processed\x20','Executing\x20statement\x20','description','306396utoikt','Error:\x20','options','elapsedTimeMillis','Executing\x20query\x20[','No\x20SQL\x20provided','length','SQL:\x20','setExtra','site','\x20-\x20','2830IFMaYG','originalMessage','2582424eKiLfC','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','processedRows','verbose','\x20rows\x20','join','477606qozIxf'];a29_0x1533=function(){return _0xa4d09a;};return a29_0x1533();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a29_0x140a(_0x1464f8,_0x43a443){_0x1464f8=_0x1464f8-0x139;const _0x1533f9=a29_0x1533();let _0x140aaf=_0x1533f9[_0x1464f8];return _0x140aaf;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x6a9414(0x13f)]=a29_0x6a9414(0x13d);[a29_0x6a9414(0x159)]=a29_0x6a9414(0x148);async[a29_0x6a9414(0x14a)](_0x13eac0){const _0x7f28b1=a29_0x6a9414,{options:_0x53d226,args:_0x4b6234,tdx:_0x218965}=_0x13eac0,_0x5e85e7=_0x4b6234[0x0],_0x1dcca4=_0x53d226[_0x7f28b1(0x142)];let _0x5a61b2;try{if(_0x1dcca4)_0x5a61b2=readSqlStatementsFromFile(_0x1dcca4);else{if(_0x5e85e7==='-')_0x5a61b2=await readSqlStatementsFromStdin();else{if(_0x5e85e7&&isSqlFilePath(_0x5e85e7))_0x5a61b2=readSqlStatementsFromFile(_0x5e85e7);else{if(_0x5e85e7)_0x5a61b2=splitSqlStatements(_0x5e85e7);else throw new Error(_0x7f28b1(0x15f));}}}}catch(_0x28a242){return console[_0x7f28b1(0x153)](_0x7f28b1(0x15b)+_0x28a242[_0x7f28b1(0x141)]),0x1;}const _0x4bac20=_0x53d226[_0x7f28b1(0x146)]||_0x7f28b1(0x13e),_0x2e8572=_0x53d226[_0x7f28b1(0x145)];try{const _0x1be8f2=[],_0x15f792=!!_0x53d226[_0x7f28b1(0x14e)];for(let _0x959af4=0x0;_0x959af4<_0x5a61b2[_0x7f28b1(0x160)];_0x959af4++){const _0x102b88=_0x5a61b2[_0x959af4],_0x27c93f=_0x959af4+0x1,_0x212e19=_0x5a61b2['length'],_0xa34f08=_0x212e19>0x1;_0x53d226[_0x7f28b1(0x16a)]&&(console[_0x7f28b1(0x153)]('\x0a'+(_0xa34f08?_0x7f28b1(0x14b)+_0x27c93f+'/'+_0x212e19+':':'')),console[_0x7f28b1(0x153)](_0x7f28b1(0x147)+_0x53d226[_0x7f28b1(0x163)]),console[_0x7f28b1(0x153)]('Catalog:\x20'+(_0x2e8572||'td')),console[_0x7f28b1(0x153)](_0x7f28b1(0x150)+_0x4bac20),console['error'](_0x7f28b1(0x161)+_0x102b88));const _0x1d12f8=_0xa34f08?_0x7f28b1(0x158)+_0x27c93f+'/'+_0x212e19+'...':'Executing\x20query...';try{const _0x3da5b4=await withProgressSpinner(_0x1d12f8,async _0x2bf59f=>{const _0x3d5f50=_0x7f28b1,_0x468afa=await _0x218965[_0x3d5f50(0x13d)][_0x3d5f50(0x14a)](_0x102b88,{'catalog':_0x2e8572,'schema':_0x4bac20,'onJobId':_0x46eaac=>{_0x2bf59f['setJobId'](_0x46eaac);},'onProgress':_0x23b5fe=>{const _0x418f8e=_0x3d5f50;_0x2bf59f['setPhase'](_0x418f8e(0x15e)+_0x23b5fe['state']+']'),_0x2bf59f[_0x418f8e(0x162)](formatRows(_0x23b5fe[_0x418f8e(0x169)])+_0x418f8e(0x139)+_0x23b5fe['completedSplits']+'/'+_0x23b5fe[_0x418f8e(0x154)]+_0x418f8e(0x144));}});return _0x468afa;},{'verbose':_0x53d226['verbose']}),_0x51a28f=_0x3da5b4['data'],_0x423a3f=_0x51a28f['jobId']?_0x7f28b1(0x155)+_0x51a28f[_0x7f28b1(0x14f)]+']':'',_0x5a6c02=_0xa34f08?'Statement\x20'+_0x27c93f+'/'+_0x212e19+_0x7f28b1(0x164):'';console[_0x7f28b1(0x153)]('✔\x20'+_0x5a6c02+_0x7f28b1(0x157)+formatRows(_0x51a28f[_0x7f28b1(0x156)][_0x7f28b1(0x169)])+_0x7f28b1(0x139)+('in\x20'+formatElapsed(_0x51a28f[_0x7f28b1(0x156)][_0x7f28b1(0x15d)])+_0x423a3f));if(_0xa34f08&&_0x15f792){const _0x28484a=resolveOutputOptions(_0x53d226),_0x47c41c=await formatQueryOutput(_0x51a28f,_0x28484a);_0x1be8f2['push'](_0x47c41c);}else await handleQueryOutput(_0x51a28f,_0x53d226);}catch(_0x4edd1c){const _0x2a984a=_0xa34f08?_0x7f28b1(0x14b)+_0x27c93f+'/'+_0x212e19+':\x0a':'',_0x3fabf2=_0x4edd1c instanceof SDKError?_0x4edd1c[_0x7f28b1(0x166)]:_0x4edd1c[_0x7f28b1(0x141)];return console[_0x7f28b1(0x153)](''+_0x2a984a+_0x3fabf2),0x1;}}if(_0x5a61b2[_0x7f28b1(0x160)]>0x1&&_0x15f792&&_0x1be8f2[_0x7f28b1(0x160)]>0x0){const _0x2dd4fc=_0x1be8f2[_0x7f28b1(0x13a)]('\x0a');writeFileSync(_0x53d226[_0x7f28b1(0x14e)],_0x2dd4fc),console['error'](_0x7f28b1(0x143)+_0x53d226['output']);}return 0x0;}catch(_0x12699e){throw _0x12699e;}}['validate'](_0x48d307){const _0x241122=a29_0x6a9414,_0x2963cd=_0x48d307['args'][0x0],_0x45e22a=_0x48d307[_0x241122(0x15c)][_0x241122(0x142)];if(!_0x2963cd&&!_0x45e22a)return _0x241122(0x168);if(_0x2963cd&&_0x45e22a)return _0x241122(0x152);return undefined;}}
1
+ const a29_0x36d409=a29_0x3a74;(function(_0xd7c16f,_0x4aa113){const _0x5458d2=a29_0x3a74,_0x2ae8c4=_0xd7c16f();while(!![]){try{const _0x1eae02=-parseInt(_0x5458d2(0x1e3))/0x1*(-parseInt(_0x5458d2(0x1e6))/0x2)+parseInt(_0x5458d2(0x1c5))/0x3+-parseInt(_0x5458d2(0x1c6))/0x4*(-parseInt(_0x5458d2(0x1e4))/0x5)+parseInt(_0x5458d2(0x1db))/0x6+-parseInt(_0x5458d2(0x1f0))/0x7*(parseInt(_0x5458d2(0x1f3))/0x8)+-parseInt(_0x5458d2(0x1c4))/0x9*(parseInt(_0x5458d2(0x1ce))/0xa)+-parseInt(_0x5458d2(0x1c7))/0xb*(parseInt(_0x5458d2(0x1d1))/0xc);if(_0x1eae02===_0x4aa113)break;else _0x2ae8c4['push'](_0x2ae8c4['shift']());}catch(_0x44a61a){_0x2ae8c4['push'](_0x2ae8c4['shift']());}}}(a29_0x23be,0x4e739));import{BaseCommand}from'./command.js';function a29_0x3a74(_0x99d120,_0x321959){_0x99d120=_0x99d120-0x1c2;const _0x23be96=a29_0x23be();let _0x3a7402=_0x23be96[_0x99d120];return _0x3a7402;}import{SDKError}from'../sdk/index.js';function a29_0x23be(){const _0x5a3b41=['1279092CpUjxw','2836mDXyPj','2328491vsufsJ','...','Error:\x20','database','data','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','processedRows','10nLApqH','message','verbose','36vFALvJ','length','output','join','\x20rows\x20','Statement\x20','setExtra','setJobId','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20[Job\x20ID:\x20','1992030cAuuYl','Run\x20Trino\x20queries\x20(streaming)','execute','No\x20SQL\x20provided','information_schema','\x20-\x20','Query\x20completed:\x20Processed\x20','\x20splits','408953qbIaBO','2815LeiwYg','Catalog:\x20','2vjyrVi','\x0aAll\x20results\x20saved\x20to\x20','error','args','push','name','totalSplits','setPhase','Schema:\x20','Executing\x20query\x20[','2734606MuIQxZ','stats','elapsedTimeMillis','8ZsfjxH','state','site','jobId','file','query','1975059tNzPKV'];a29_0x23be=function(){return _0x5a3b41;};return a29_0x23be();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x36d409(0x1eb)]=a29_0x36d409(0x1c3);['description']=a29_0x36d409(0x1dc);async['execute'](_0x28e391){const _0x209bce=a29_0x36d409,{options:_0x3a3e59,args:_0xed8e68,tdx:_0x414354}=_0x28e391,_0x29bff3=_0xed8e68[0x0],_0x4141ca=_0x3a3e59['file'];let _0x43df86;try{if(_0x4141ca)_0x43df86=readSqlStatementsFromFile(_0x4141ca);else{if(_0x29bff3==='-')_0x43df86=await readSqlStatementsFromStdin();else{if(_0x29bff3&&isSqlFilePath(_0x29bff3))_0x43df86=readSqlStatementsFromFile(_0x29bff3);else{if(_0x29bff3)_0x43df86=splitSqlStatements(_0x29bff3);else throw new Error(_0x209bce(0x1de));}}}}catch(_0x3bdc2b){return console['error'](_0x209bce(0x1c9)+_0x3bdc2b[_0x209bce(0x1cf)]),0x1;}const _0x36f5b4=_0x3a3e59[_0x209bce(0x1ca)]||_0x209bce(0x1df),_0x20885c=_0x3a3e59['catalog'];try{const _0x3316bc=[],_0x58119a=!!_0x3a3e59[_0x209bce(0x1d3)];for(let _0x3fca6d=0x0;_0x3fca6d<_0x43df86[_0x209bce(0x1d2)];_0x3fca6d++){const _0x230734=_0x43df86[_0x3fca6d],_0x5aaa4e=_0x3fca6d+0x1,_0x5b0203=_0x43df86[_0x209bce(0x1d2)],_0x401143=_0x5b0203>0x1;_0x3a3e59['verbose']&&(console[_0x209bce(0x1e8)]('\x0a'+(_0x401143?'Statement\x20'+_0x5aaa4e+'/'+_0x5b0203+':':'')),console[_0x209bce(0x1e8)]('Site:\x20'+_0x3a3e59[_0x209bce(0x1f5)]),console[_0x209bce(0x1e8)](_0x209bce(0x1e5)+(_0x20885c||'td')),console[_0x209bce(0x1e8)](_0x209bce(0x1ee)+_0x36f5b4),console['error']('SQL:\x20'+_0x230734));const _0x8e98b6=_0x401143?'Executing\x20statement\x20'+_0x5aaa4e+'/'+_0x5b0203+_0x209bce(0x1c8):'Executing\x20query...';try{const _0x18cd1f=await withProgressSpinner(_0x8e98b6,async _0x5111fb=>{const _0x1550eb=_0x209bce,_0x3f856f=await _0x414354[_0x1550eb(0x1c3)][_0x1550eb(0x1dd)](_0x230734,{'catalog':_0x20885c,'schema':_0x36f5b4,'onJobId':_0x4092d9=>{const _0x3b6bcd=_0x1550eb;_0x5111fb[_0x3b6bcd(0x1d8)](_0x4092d9);},'onProgress':_0x6e3f1c=>{const _0x4537f5=_0x1550eb;_0x5111fb[_0x4537f5(0x1ed)](_0x4537f5(0x1ef)+_0x6e3f1c[_0x4537f5(0x1f4)]+']'),_0x5111fb[_0x4537f5(0x1d7)](formatRows(_0x6e3f1c[_0x4537f5(0x1cd)])+_0x4537f5(0x1d5)+_0x6e3f1c['completedSplits']+'/'+_0x6e3f1c[_0x4537f5(0x1ec)]+_0x4537f5(0x1e2));}});return _0x3f856f;},{'verbose':_0x3a3e59[_0x209bce(0x1d0)]}),_0x100073=_0x18cd1f[_0x209bce(0x1cb)],_0x22c85a=_0x100073[_0x209bce(0x1f6)]?_0x209bce(0x1da)+_0x100073['jobId']+']':'',_0x1d096b=_0x401143?_0x209bce(0x1d6)+_0x5aaa4e+'/'+_0x5b0203+_0x209bce(0x1e0):'';console[_0x209bce(0x1e8)]('✔\x20'+_0x1d096b+_0x209bce(0x1e1)+formatRows(_0x100073[_0x209bce(0x1f1)][_0x209bce(0x1cd)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x100073[_0x209bce(0x1f1)][_0x209bce(0x1f2)])+_0x22c85a));if(_0x401143&&_0x58119a){const _0x40d86a=resolveOutputOptions(_0x3a3e59),_0x219749=await formatQueryOutput(_0x100073,_0x40d86a);_0x3316bc[_0x209bce(0x1ea)](_0x219749);}else await handleQueryOutput(_0x100073,_0x3a3e59);}catch(_0x37045c){const _0x541ba6=_0x401143?_0x209bce(0x1d6)+_0x5aaa4e+'/'+_0x5b0203+':\x0a':'',_0xf82578=_0x37045c instanceof SDKError?_0x37045c['originalMessage']:_0x37045c[_0x209bce(0x1cf)];return console[_0x209bce(0x1e8)](''+_0x541ba6+_0xf82578),0x1;}}if(_0x43df86[_0x209bce(0x1d2)]>0x1&&_0x58119a&&_0x3316bc['length']>0x0){const _0x54cc3d=_0x3316bc[_0x209bce(0x1d4)]('\x0a');writeFileSync(_0x3a3e59[_0x209bce(0x1d3)],_0x54cc3d),console[_0x209bce(0x1e8)](_0x209bce(0x1e7)+_0x3a3e59[_0x209bce(0x1d3)]);}return 0x0;}catch(_0x58ceb9){throw _0x58ceb9;}}['validate'](_0x3e0e9e){const _0x38a49b=a29_0x36d409,_0x517a61=_0x3e0e9e[_0x38a49b(0x1e9)][0x0],_0x68dee3=_0x3e0e9e['options'][_0x38a49b(0x1c2)];if(!_0x517a61&&!_0x68dee3)return _0x38a49b(0x1cc);if(_0x517a61&&_0x68dee3)return _0x38a49b(0x1d9);return undefined;}}