@treasuredata/tdx 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-push-command.js.map +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.d.ts +19 -3
- package/dist/sdk/journey.d.ts.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/journey.js.map +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.d.ts.map +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/pull-workflow.js.map +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a19_0x562c89=a19_0xecb9;(function(_0x3692b6,_0x5b2cef){const _0x3e922b=a19_0xecb9,_0xc38e1a=_0x3692b6();while(!![]){try{const _0x824906=-parseInt(_0x3e922b(0x1fc))/0x1+-parseInt(_0x3e922b(0x1de))/0x2+parseInt(_0x3e922b(0x1d3))/0x3*(-parseInt(_0x3e922b(0x199))/0x4)+parseInt(_0x3e922b(0x20e))/0x5*(parseInt(_0x3e922b(0x1ad))/0x6)+-parseInt(_0x3e922b(0x13a))/0x7*(-parseInt(_0x3e922b(0x192))/0x8)+parseInt(_0x3e922b(0x1b3))/0x9*(-parseInt(_0x3e922b(0x191))/0xa)+parseInt(_0x3e922b(0x1a1))/0xb;if(_0x824906===_0x5b2cef)break;else _0xc38e1a['push'](_0xc38e1a['shift']());}catch(_0x3277a6){_0xc38e1a['push'](_0xc38e1a['shift']());}}}(a19_0x1688,0xe9c64));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a19_0x2520aa from'node:fs';function handleSDKError(_0x479121,_0x595665){const _0x16ed2e=a19_0xecb9;if(_0x479121 instanceof SDKError)console[_0x16ed2e(0x177)](_0x16ed2e(0x17b)+_0x479121[_0x16ed2e(0x189)]),_0x595665[_0x16ed2e(0x1d9)]&&(_0x479121['cause']&&console[_0x16ed2e(0x177)](_0x16ed2e(0x1f9)+_0x479121[_0x16ed2e(0x164)]),_0x479121[_0x16ed2e(0x207)]&&(console[_0x16ed2e(0x177)](_0x16ed2e(0x1b1)),console[_0x16ed2e(0x177)](_0x479121[_0x16ed2e(0x207)])));else throw _0x479121;}function formatChatHistoryEntry(_0x584828,_0x4b8e87){const _0x1873e4=a19_0xecb9,_0x313c56=getChalk(_0x4b8e87),_0x5890c1=_0x313c56[_0x1873e4(0x147)](_0x584828['at']);if(_0x1873e4(0x20a)in _0x584828){const _0x1d6ded=_0x313c56[_0x1873e4(0x183)](_0x1873e4(0x17d));return _0x5890c1+'\x20'+_0x1d6ded+':\x20'+_0x584828[_0x1873e4(0x20a)];}if(_0x1873e4(0x175)in _0x584828){const _0x1d8644=_0x313c56[_0x1873e4(0x1e3)]('[content]');return _0x5890c1+'\x20'+_0x1d8644+':\x20'+_0x584828[_0x1873e4(0x175)];}if(_0x1873e4(0x1bb)in _0x584828){const _0x43b141=_0x313c56[_0x1873e4(0x182)](_0x1873e4(0x1ff)),{functionName:_0x2ea96c,functionArguments:_0x58ebeb,targetFunction:_0x227ce1}=_0x584828['tool_call'];let _0x3adeac=_0x5890c1+'\x20'+_0x43b141+':\x20'+_0x313c56[_0x1873e4(0x1f4)](_0x2ea96c);if(_0x58ebeb&&Object[_0x1873e4(0x209)](_0x58ebeb)[_0x1873e4(0x15e)]>0x0){const _0x48a4bd=Object[_0x1873e4(0x1bd)](_0x58ebeb)['map'](([_0xc7423,_0xbbed57])=>_0xc7423+'='+JSON[_0x1873e4(0x15c)](_0xbbed57))[_0x1873e4(0x186)](',\x20');_0x3adeac+='('+_0x48a4bd+')';}_0x227ce1&&(_0x3adeac+=_0x313c56[_0x1873e4(0x147)]('\x20['+_0x227ce1+']'));let _0x4c7393='';if(_0x584828[_0x1873e4(0x1bb)]['targetKnowledgeBase'])_0x4c7393=_0x1873e4(0x1e7)+_0x584828[_0x1873e4(0x1bb)][_0x1873e4(0x14b)][_0x1873e4(0x1c1)];else{if(_0x584828[_0x1873e4(0x1bb)][_0x1873e4(0x1bf)])_0x4c7393=_0x1873e4(0x18c)+_0x584828['tool_call']['targetAgent']['name'];else{if(_0x584828[_0x1873e4(0x1bb)][_0x1873e4(0x1c0)])_0x4c7393=_0x1873e4(0x16a)+_0x584828[_0x1873e4(0x1bb)][_0x1873e4(0x1c0)]['name'];else _0x584828[_0x1873e4(0x1bb)]['targetImageGenerator']&&(_0x4c7393=_0x1873e4(0x136)+_0x584828[_0x1873e4(0x1bb)][_0x1873e4(0x1b4)][_0x1873e4(0x1c1)]);}}return _0x3adeac+_0x4c7393;}if(_0x1873e4(0x206)in _0x584828){const _0x3e1e3c=_0x313c56[_0x1873e4(0x13f)](_0x1873e4(0x1f0)),{functionName:_0x51c2e7,functionArguments:_0x502dda,content:_0x4644c2,newChat:_0x1b48f0}=_0x584828['tool'];let _0x1467c2=_0x5890c1+'\x20'+_0x3e1e3c+':\x20'+_0x313c56[_0x1873e4(0x1f4)](_0x51c2e7);if(_0x502dda){const _0x40fff5=typeof _0x502dda==='string'?_0x502dda:JSON[_0x1873e4(0x15c)](_0x502dda);_0x1467c2+='('+_0x40fff5+')';}return _0x4644c2&&(_0x1467c2+='\x0a'+_0x313c56[_0x1873e4(0x147)](_0x4644c2)),_0x1b48f0&&(_0x1467c2+=_0x313c56[_0x1873e4(0x147)](_0x1873e4(0x197)+_0x1b48f0['id'])),_0x1467c2;}if(_0x1873e4(0x1a9)in _0x584828){const _0x52ae2c=_0x313c56[_0x1873e4(0x166)](_0x1873e4(0x1c4));return _0x5890c1+'\x20'+_0x52ae2c+':\x20'+_0x584828[_0x1873e4(0x1a9)][_0x1873e4(0x1c1)]+'\x20('+_0x584828[_0x1873e4(0x1a9)][_0x1873e4(0x175)][_0x1873e4(0x15e)]+_0x1873e4(0x142);}if('image'in _0x584828){const _0x293f77=_0x313c56[_0x1873e4(0x166)](_0x1873e4(0x1a4)),{width:_0x2c532f,height:_0x2c44a9,headerText:_0x1999d0}=_0x584828['image'],_0x5b223f=_0x1999d0?'\x20-\x20'+_0x1999d0:'';return _0x5890c1+'\x20'+_0x293f77+':\x20'+_0x2c532f+'x'+_0x2c44a9+_0x5b223f;}if(_0x1873e4(0x177)in _0x584828){const _0x431b1f=_0x313c56[_0x1873e4(0x1fd)](_0x1873e4(0x176));return _0x5890c1+'\x20'+_0x431b1f+':\x20'+_0x584828['error'];}return _0x5890c1+'\x20'+_0x313c56['dim'](_0x1873e4(0x181))+':\x20'+JSON[_0x1873e4(0x15c)](_0x584828);}async function executeChatHistoryCommand(_0x3e62b9,_0x6a3b92){const _0x32bf63=a19_0xecb9,{options:_0x28f4e4,args:_0x5a773d,tdx:_0x2a18c3}=_0x3e62b9,_0x451ae1=_0x5a773d[0x0],_0x24a15f=_0x28f4e4,_0x448f29=_0x24a15f[_0x32bf63(0x187)];try{if(_0x448f29&&_0x451ae1)return console[_0x32bf63(0x177)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x32bf63(0x177)](_0x32bf63(0x178)+_0x6a3b92+'\x20--last'),0x1;if(!_0x451ae1&&!_0x448f29&&_0x28f4e4[_0x32bf63(0x1a6)]!==undefined){const _0x45eb1c=resolveLimit(_0x28f4e4[_0x32bf63(0x18a)],DEFAULT_LLM_LIMIT),_0x577119=await withSpinner(_0x32bf63(0x1af),()=>_0x2a18c3['llm'][_0x32bf63(0x196)](_0x45eb1c),{'verbose':_0x28f4e4['verbose']});return await handleSDKOutput(_0x577119[_0x32bf63(0x1f8)],_0x28f4e4),0x0;}const _0x363a4b=await getChatIdOrSelect(_0x2a18c3,_0x28f4e4,_0x448f29,_0x451ae1);if(!_0x363a4b)return 0x0;return await displayChatHistory(_0x363a4b,_0x2a18c3,_0x28f4e4),0x0;}catch(_0x21d21e){return handleSDKError(_0x21d21e,_0x28f4e4),0x1;}}async function displayChatHistory(_0x34f577,_0xa1c4e3,_0x16aed4){const _0x373b37=a19_0xecb9,_0x512822=await withSpinner(_0x373b37(0x1dc)+_0x34f577+_0x373b37(0x1e8),()=>_0xa1c4e3[_0x373b37(0x1e2)][_0x373b37(0x1e6)](_0x34f577),{'verbose':_0x16aed4['verbose']}),_0x3a011c=_0x512822['data'][_0x373b37(0x1f8)]??[];if(_0x3a011c['length']===0x0){console[_0x373b37(0x19f)](_0x373b37(0x1ec));return;}if(_0x16aed4[_0x373b37(0x1a6)]!==undefined)await handleSDKOutput(_0x3a011c,_0x16aed4);else{const _0x5acb97=_0x3a011c[_0x373b37(0x1db)](_0x3ac7ef=>formatChatHistoryEntry(_0x3ac7ef,_0x16aed4)),_0xafcb4d=_0x5acb97[_0x373b37(0x186)]('\x0a');await writeOutput(_0xafcb4d,_0x16aed4[_0x373b37(0x1a9)],'table');}}async function getChatIdOrSelect(_0x2eb62d,_0x14a22f,_0x14d0ff,_0x1bfc3a){const _0x446ffb=a19_0xecb9;if(_0x1bfc3a)return _0x1bfc3a;if(_0x14d0ff){const _0x133a79=await withSpinner(_0x446ffb(0x1a7),()=>_0x2eb62d['llm'][_0x446ffb(0x196)](0x1),{'verbose':_0x14a22f[_0x446ffb(0x1d9)]});if(_0x133a79[_0x446ffb(0x1f8)]['length']===0x0)return console['log']('No\x20chat\x20sessions\x20found.'),undefined;return _0x133a79[_0x446ffb(0x1f8)][0x0]['id'];}const _0x153ed5=await selectChatInteractively(_0x2eb62d,_0x14a22f);if(!_0x153ed5)return console[_0x446ffb(0x19f)](_0x446ffb(0x19c)),undefined;return _0x153ed5;}async function getProjectIdOrDefault(_0xc4aaba){const _0x331d93=await getProjectWithName(_0xc4aaba);return _0x331d93['id'];}async function getProjectWithName(_0x1762d9){const _0x36a673=a19_0xecb9,{tdx:_0x31b2c,options:_0x5caab4}=_0x1762d9,_0x501c77=_0x5caab4['llmProject'];if(_0x501c77){const _0x380283=await withSpinner('Resolving\x20project\x20\x27'+_0x501c77+_0x36a673(0x1e8),()=>_0x31b2c[_0x36a673(0x1e2)][_0x36a673(0x190)](_0x501c77),{'verbose':_0x5caab4[_0x36a673(0x1d9)]});return{'id':_0x380283[_0x36a673(0x1f8)],'name':_0x501c77};}const _0x51e5b0=_0x31b2c[_0x36a673(0x1e2)]['getCurrentProject']();if(_0x51e5b0){const _0x29d4ab=await _0x31b2c[_0x36a673(0x1e2)][_0x36a673(0x201)](),_0xc80bea=_0x29d4ab['find'](_0x219685=>_0x219685['id']===_0x51e5b0);return{'id':_0x51e5b0,'name':_0xc80bea?.[_0x36a673(0x184)][_0x36a673(0x1c1)]||_0x36a673(0x18b)};}const _0xb97e40=await withSpinner(_0x36a673(0x145),()=>_0x31b2c['llm'][_0x36a673(0x1dd)](),{'verbose':_0x5caab4[_0x36a673(0x1d9)]});return{'id':_0xb97e40[_0x36a673(0x1f8)]['id'],'name':_0xb97e40[_0x36a673(0x1f8)][_0x36a673(0x184)][_0x36a673(0x1c1)]};}function toLLMProjectInfo(_0xa0d65c){const _0x3d22d6=a19_0xecb9;return{'name':_0xa0d65c[_0x3d22d6(0x184)]['name'],'description':_0xa0d65c['attributes'][_0x3d22d6(0x20c)],'createdAt':_0xa0d65c[_0x3d22d6(0x184)][_0x3d22d6(0x1c5)],'updatedAt':_0xa0d65c[_0x3d22d6(0x184)]['updatedAt']};}function a19_0x1688(){const _0x81a1ea=['Deleting\x20project\x20\x27','data','\x20\x20Cause:\x20','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','\x20\x20Knowledge\x20Bases:\x20','1345552xPicqX','red','Creating\x20project\x20\x27','[tool_call]','Project\x20created:\x20','projects','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','\x20\x20Agents:\x20','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','LLM_PROJECT_NOT_FOUND','tool','stack','backupProject','keys','input','get','description','llm:use','4535245bQwMXH','lastConversationAt','⚒️\x20','\x20\x20Integrations:\x20','toLowerCase','existsSync','tdx\x20chats','No\x20agents\x20found','agent','site','llm:agent:update','starterMessage','llm:projects','llm:project:restore','\x20->\x20ImageGen:','(no\x20agent)','split','Project\x20context\x20set\x20to:\x20','7LnfJPz','Creating\x20agent\x20\x27','llm:agents','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','No\x20projects\x20found','magenta','knowledgeBases','(no\x20message)','\x20bytes)','.llm','integrations','Getting\x20default\x20project...','json','dim','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Updating\x20agent...','restoreProject','targetKnowledgeBase','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','slice','floor','agents','chatId','llm:agent:delete','\x20project(s)','Load\x20more...','Resolving\x20project\x20\x27','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Project\x20restored:\x20','models','getTime','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','h\x20ago','prompts','stringify','Error:\x20Project\x20name\x20is\x20required','length','Resolving\x20agent\x20\x27','Fetching\x20projects...','llm:agent:show','Agent\x20created:\x20','Show\x20agent\x20details','cause','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','blue','\x20\x20Prompts:\x20','sourceSite','Update\x20an\x20existing\x20agent','\x20->\x20WebSearch:','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','projectName','llm:models','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','model','Create\x20a\x20new\x20LLM\x20project','Error:\x20Agent\x20name\x20is\x20required','counts','Deleting\x20agent...','content','[error]\x20\x20','error','Usage:\x20','__load_more__','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','Error:\x20','rmSync','[input]\x20\x20','Invalid\x20path\x20syntax:\x20','tdx\x20llm\x20history','getBackupMetadata','[unknown]','yellow','cyan','attributes','firstInputContent','join','last','llm:history','message','limit','Unknown','\x20->\x20Agent:','prompt','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','yes','resolveProjectId','660tGBedF','15109624dAtNel','includes','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','chats','\x20→\x20chat:\x20','updateAgent','211616IWrWGJ','List\x20all\x20LLM\x20projects','select','\x0aCancelled','Delete\x20an\x20agent','filter','log','execute','28024073RfKjPV','Error:\x20Backup\x20folder\x20path\x20is\x20required','m\x20ago','[image]\x20\x20','Agent\x20updated:\x20','format','Fetching\x20most\x20recent\x20chat...','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','output','Use\x20format:\x20project-name/agent-name','find','deleteAgent','12GoYfnr','Setting\x20project\x20context\x20to\x20\x27','Fetching\x20chat\x20sessions...','Select\x20a\x20chat\x20session:','\x0aStack\x20trace:','Delete\x20an\x20LLM\x20project','247743eYfSrF','targetImageGenerator','Fetching\x20agent...','deleteProject','INVALID_ARGUMENT','temperature','numeric','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','tool_call','en-US','entries','exportedFrom','targetAgent','targetWebSearchTool','name','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','jsonl','[output]\x20','createdAt','🤖\x20','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','resolveAgentId','Backup\x20cancelled.','tsv','Fetching\x20available\x20models...','just\x20now','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','set','Validating\x20backup\x20from\x20\x27','maxToolIterations','Output\x20directory\x20\x27','setCurrentProject','102WtkdPG','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','A\x20project\x20named\x20\x27','push','agentId','Project\x20deleted:\x20','verbose','Checking\x20for\x20existing\x20projects...','map','Fetching\x20chat\x20history\x20for\x20\x27','getOrCreateDefaultProject','663668DUncID','...','List\x20available\x20LLM\x20models','Restoring\x20project\x20from\x20\x27','llm','green','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','Project\x20not\x20found:\x20','history','\x20->\x20KB:','\x27...','llm:project:backup','toLocaleDateString','dryRun','No\x20messages\x20found\x20in\x20chat\x20history.','\x20\x20\x20Examples:','\x27\x20already\x20exists.\x20Overwrite?','llm:project:create','[tool]\x20\x20\x20','llm:project:delete','sort','table','bold','default','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.'];a19_0x1688=function(){return _0x81a1ea;};return a19_0x1688();}function toAgentInfo(_0x46f47b){const _0x256250=a19_0xecb9;return{'name':_0x46f47b[_0x256250(0x184)][_0x256250(0x1c1)],'description':_0x46f47b[_0x256250(0x184)][_0x256250(0x20c)],'prompt':truncatePrompt(_0x46f47b[_0x256250(0x184)]['prompt']),'createdAt':_0x46f47b[_0x256250(0x184)][_0x256250(0x1c5)],'updatedAt':_0x46f47b['attributes']['updatedAt']};}function truncatePrompt(_0x5da2a5){const _0x560c55=a19_0xecb9;if(!_0x5da2a5)return undefined;const _0x43e037=0x64;if(_0x5da2a5[_0x560c55(0x15e)]<=_0x43e037)return _0x5da2a5;return _0x5da2a5['slice'](0x0,_0x43e037)+_0x560c55(0x1df);}export class LLMModelsCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x16e);[a19_0x562c89(0x20c)]=a19_0x562c89(0x1e0);async[a19_0x562c89(0x1a0)](_0x298aec){const _0x3e166e=a19_0x562c89,{options:_0x2985e9,tdx:_0x3c5026}=_0x298aec;try{const _0x579135=await withSpinner(_0x3e166e(0x1cb),()=>_0x3c5026['llm'][_0x3e166e(0x157)](),{'verbose':_0x2985e9['verbose']});return await handleSDKOutput(_0x579135[_0x3e166e(0x1f8)],_0x2985e9),0x0;}catch(_0xf926ad){return handleSDKError(_0xf926ad,_0x2985e9),0x1;}}}function a19_0xecb9(_0x579249,_0xd11c5e){_0x579249=_0x579249-0x133;const _0x1688ff=a19_0x1688();let _0xecb943=_0x1688ff[_0x579249];return _0xecb943;}export class LLMProjectsCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x134);[a19_0x562c89(0x20c)]=a19_0x562c89(0x19a);async['execute'](_0xa00e4d){const _0xbf85a9=a19_0x562c89,{options:_0x11dcf2,args:_0x411826,tdx:_0x162378}=_0xa00e4d,_0x45dbcc=getChalk(_0x11dcf2),_0x14195d=_0x11dcf2[_0xbf85a9(0x217)];try{const _0x12aa48=_0x411826[0x0],_0x5665c8=resolveLimit(_0x11dcf2[_0xbf85a9(0x18a)],DEFAULT_LLM_LIMIT),_0x23c511=await withSpinner(_0xbf85a9(0x160),()=>_0x162378['llm'][_0xbf85a9(0x201)](_0x5665c8),{'verbose':_0x11dcf2[_0xbf85a9(0x1d9)]});let _0x2719f6=_0x23c511[_0xbf85a9(0x1f8)];_0x12aa48&&(_0x2719f6=_0x23c511[_0xbf85a9(0x1f8)]['filter'](_0x34bd5f=>matchGlobPattern(_0x34bd5f[_0xbf85a9(0x184)][_0xbf85a9(0x1c1)],_0x12aa48)));const _0x2a1b09=_0x11dcf2[_0xbf85a9(0x1a6)]===_0xbf85a9(0x146)||_0x11dcf2['format']===_0xbf85a9(0x1c3)||_0x11dcf2['format']===_0xbf85a9(0x1f3)||_0x11dcf2[_0xbf85a9(0x1a6)]===_0xbf85a9(0x1ca);if(_0x2a1b09){const _0x218235=_0x2719f6[_0xbf85a9(0x1db)](_0xa0b707=>({...toLLMProjectInfo(_0xa0b707),'url':getLLMProjectUrl(_0x14195d,_0xa0b707['id'])}));await handleSDKOutput(_0x218235,_0x11dcf2);}else{const _0x19a3c4=[];if(_0x2719f6[_0xbf85a9(0x15e)]===0x0)_0x19a3c4[_0xbf85a9(0x1d6)](_0x45dbcc['dim'](_0xbf85a9(0x13e)));else{const _0x4eae1f=[..._0x2719f6][_0xbf85a9(0x1f2)]((_0x114edc,_0x303728)=>_0x114edc[_0xbf85a9(0x184)][_0xbf85a9(0x1c1)]['localeCompare'](_0x303728[_0xbf85a9(0x184)][_0xbf85a9(0x1c1)]));for(const _0x5434bb of _0x4eae1f){const _0x4be4e8=getLLMProjectUrl(_0x14195d,_0x5434bb['id']),_0x4add2a=hyperlink(_0x5434bb[_0xbf85a9(0x184)][_0xbf85a9(0x1c1)],_0x4be4e8);_0x19a3c4[_0xbf85a9(0x1d6)](_0xbf85a9(0x210)+_0x4add2a);}_0x19a3c4[_0xbf85a9(0x1d6)](_0x45dbcc[_0xbf85a9(0x147)](_0x2719f6[_0xbf85a9(0x15e)]+_0xbf85a9(0x152)));}await writeOutput(_0x19a3c4['join']('\x0a'),_0x11dcf2[_0xbf85a9(0x1a9)],_0xbf85a9(0x1f3));}return 0x0;}catch(_0x113c4b){return handleSDKError(_0x113c4b,_0x11dcf2),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x13c);['description']='List\x20agents\x20in\x20current\x20project';async[a19_0x562c89(0x1a0)](_0x2a9200){const _0x4be65e=a19_0x562c89,{options:_0x210015,args:_0x2cb44d,tdx:_0x219cba}=_0x2a9200,_0x8e8780=getChalk(_0x210015),_0x1defba=_0x210015[_0x4be65e(0x217)];try{const _0x22ad68=_0x2cb44d[0x0];let _0x5f3e64=_0x22ad68,_0x2ef399,_0x3ac1e9;if(_0x22ad68&&_0x22ad68[_0x4be65e(0x193)]('/')){const _0x472ce3=_0x22ad68[_0x4be65e(0x138)]('/');if(_0x472ce3[_0x4be65e(0x15e)]===0x2){const [_0x169941,_0x581ef8]=_0x472ce3,_0x4e4862=await _0x219cba['llm'][_0x4be65e(0x201)](),_0x256614=_0x4e4862[_0x4be65e(0x1ab)](_0x226354=>_0x226354['attributes'][_0x4be65e(0x1c1)][_0x4be65e(0x212)]()===_0x169941['toLowerCase']());if(!_0x256614)throw new SDKError(ErrorCode[_0x4be65e(0x205)],_0x4be65e(0x1e5)+_0x169941,undefined,{'helpText':_0x4be65e(0x194)});_0x2ef399=_0x256614['id'],_0x3ac1e9=_0x256614[_0x4be65e(0x184)][_0x4be65e(0x1c1)],_0x5f3e64=_0x581ef8;}else throw new SDKError(ErrorCode[_0x4be65e(0x1b7)],'Invalid\x20path\x20syntax:\x20'+_0x22ad68,undefined,{'helpText':_0x4be65e(0x1aa)});}else{const _0x541cdc=await getProjectWithName(_0x2a9200);_0x2ef399=_0x541cdc['id'],_0x3ac1e9=_0x541cdc[_0x4be65e(0x1c1)];}const _0x3912de=await withSpinner('Fetching\x20agents...',()=>_0x219cba[_0x4be65e(0x1e2)][_0x4be65e(0x14f)](_0x2ef399),{'verbose':_0x210015[_0x4be65e(0x1d9)]});let _0x310947=_0x3912de[_0x4be65e(0x1f8)];_0x5f3e64&&(_0x310947=_0x3912de['data']['filter'](_0xfa7414=>matchGlobPattern(_0xfa7414[_0x4be65e(0x184)]['name'],_0x5f3e64)));const _0x3574cb=_0x210015[_0x4be65e(0x1a6)]===_0x4be65e(0x146)||_0x210015[_0x4be65e(0x1a6)]===_0x4be65e(0x1c3)||_0x210015[_0x4be65e(0x1a6)]===_0x4be65e(0x1f3)||_0x210015['format']===_0x4be65e(0x1ca);if(_0x3574cb){const _0x407ab4=_0x310947['map'](_0x46009f=>({...toAgentInfo(_0x46009f),'chatUrl':getLLMAgentChatUrl(_0x1defba,_0x2ef399,_0x46009f['id'])}));await handleSDKOutput(_0x407ab4,_0x210015);}else{const _0x779133=[];_0x779133[_0x4be65e(0x1d6)](_0x8e8780['dim']('['+_0x3ac1e9+']'));if(_0x310947['length']===0x0)_0x779133['push'](_0x8e8780[_0x4be65e(0x147)](_0x4be65e(0x215)));else{const _0x50858e=[..._0x310947][_0x4be65e(0x1f2)]((_0x310cf0,_0xd6985a)=>_0x310cf0[_0x4be65e(0x184)][_0x4be65e(0x1c1)]['localeCompare'](_0xd6985a[_0x4be65e(0x184)]['name']));for(const _0x13067c of _0x50858e){const _0x1ca296=getLLMAgentChatUrl(_0x1defba,_0x2ef399,_0x13067c['id']),_0x4610a8=hyperlink(_0x13067c[_0x4be65e(0x184)][_0x4be65e(0x1c1)],_0x1ca296);_0x779133['push'](_0x4be65e(0x1c6)+_0x4610a8);}_0x779133['push'](_0x8e8780[_0x4be65e(0x147)](_0x310947[_0x4be65e(0x15e)]+'\x20agent(s)'));}await writeOutput(_0x779133['join']('\x0a'),_0x210015[_0x4be65e(0x1a9)],'table');}return 0x0;}catch(_0x37ccb5){return handleSDKError(_0x37ccb5,_0x210015),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a19_0x562c89(0x161);[a19_0x562c89(0x20c)]=a19_0x562c89(0x163);async['execute'](_0x5add9a){const _0x17e504=a19_0x562c89,{options:_0xc60bc1,args:_0x1c1d01,tdx:_0x48d000}=_0x5add9a;if(_0x1c1d01[_0x17e504(0x15e)]===0x0)return console[_0x17e504(0x177)](_0x17e504(0x172)),console[_0x17e504(0x177)]('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x2bc884=_0x1c1d01[0x0];try{const _0x32378d=await getProjectIdOrDefault(_0x5add9a),_0x50db76=await withSpinner(_0x17e504(0x15f)+_0x2bc884+_0x17e504(0x1e8),()=>_0x48d000[_0x17e504(0x1e2)][_0x17e504(0x1c8)](_0x2bc884,_0x32378d),{'verbose':_0xc60bc1[_0x17e504(0x1d9)]}),_0x51a760=await withSpinner(_0x17e504(0x1b5),()=>_0x48d000[_0x17e504(0x1e2)]['agent'](_0x50db76[_0x17e504(0x1f8)]),{'verbose':_0xc60bc1[_0x17e504(0x1d9)]});return await handleSDKOutput([_0x51a760[_0x17e504(0x1f8)]],_0xc60bc1),0x0;}catch(_0x56213){return handleSDKError(_0x56213,_0xc60bc1),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a19_0x562c89(0x1c1)]='llm:agent:create';[a19_0x562c89(0x20c)]=a19_0x562c89(0x155);async[a19_0x562c89(0x1a0)](_0x8bbe69){const _0x43eb09=a19_0x562c89,{options:_0x4e39cc,args:_0x4fe041,tdx:_0x42c4e4}=_0x8bbe69;if(_0x4fe041['length']===0x0)return console[_0x43eb09(0x177)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x43eb09(0x177)](_0x43eb09(0x16f)),console['error'](_0x43eb09(0x1cd)),0x1;const _0x8b0645=_0x4fe041[0x0],_0x166a10=_0x4e39cc,_0x4040e4=_0x166a10['systemPrompt'],_0x4e8887=_0x166a10[_0x43eb09(0x170)]||'claude-4.5-haiku',_0x4d3441=_0x166a10['starterMessage'],_0x1a3762=_0x166a10['maxToolIterations']?Number(_0x166a10[_0x43eb09(0x1d0)]):undefined,_0x2a9c53=_0x166a10['temperature']?Number(_0x166a10[_0x43eb09(0x1b8)]):undefined;try{let _0x459616,_0x4fee65;if(_0x8b0645[_0x43eb09(0x193)]('/')){const _0x15da6c=_0x8b0645[_0x43eb09(0x138)]('/');if(_0x15da6c[_0x43eb09(0x15e)]===0x2){const [_0x567153,_0x27fd9f]=_0x15da6c,_0x63a03e=await withSpinner(_0x43eb09(0x154)+_0x567153+_0x43eb09(0x1e8),()=>_0x42c4e4[_0x43eb09(0x1e2)][_0x43eb09(0x190)](_0x567153),{'verbose':_0x4e39cc[_0x43eb09(0x1d9)]});_0x459616=_0x63a03e[_0x43eb09(0x1f8)],_0x4fee65=_0x27fd9f;}else throw new SDKError(ErrorCode[_0x43eb09(0x1b7)],_0x43eb09(0x17e)+_0x8b0645,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x459616=await getProjectIdOrDefault(_0x8bbe69),_0x4fee65=_0x8b0645;const _0x368378=await withSpinner(_0x43eb09(0x13b)+_0x4fee65+'\x27...',()=>_0x42c4e4[_0x43eb09(0x1e2)]['createAgent']({'name':_0x4fee65,'projectId':_0x459616,'modelType':_0x4e8887,'systemPrompt':_0x4040e4,'starterMessage':_0x4d3441,'maxToolIterations':_0x1a3762,'temperature':_0x2a9c53}),{'verbose':_0x4e39cc[_0x43eb09(0x1d9)]});return console[_0x43eb09(0x19f)](_0x43eb09(0x162)+_0x368378[_0x43eb09(0x1f8)]['id']),await handleSDKOutput([_0x368378['data']],_0x4e39cc),0x0;}catch(_0x1a6fff){return handleSDKError(_0x1a6fff,_0x4e39cc),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x218);[a19_0x562c89(0x20c)]=a19_0x562c89(0x169);async[a19_0x562c89(0x1a0)](_0x4cca20){const _0x1738f5=a19_0x562c89,{options:_0x2f19cf,args:_0x57c713,tdx:_0x3fd21c}=_0x4cca20;if(_0x57c713['length']===0x0)return console[_0x1738f5(0x177)](_0x1738f5(0x172)),console[_0x1738f5(0x177)]('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x41bd6a=_0x57c713[0x0],_0x4dc6c0=_0x2f19cf,_0x47bf5f=_0x4dc6c0[_0x1738f5(0x1c1)],_0x489796=_0x4dc6c0[_0x1738f5(0x18d)],_0x4387e5=_0x4dc6c0[_0x1738f5(0x20c)],_0x19fc16=_0x4dc6c0[_0x1738f5(0x133)];if(!_0x47bf5f&&!_0x489796&&!_0x4387e5&&!_0x19fc16)return console[_0x1738f5(0x177)](_0x1738f5(0x13d)),console['error']('Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message'),0x1;try{const _0x4fe193=await getProjectIdOrDefault(_0x4cca20),_0x150e18=await withSpinner('Resolving\x20agent\x20\x27'+_0x41bd6a+'\x27...',()=>_0x3fd21c[_0x1738f5(0x1e2)][_0x1738f5(0x1c8)](_0x41bd6a,_0x4fe193),{'verbose':_0x2f19cf[_0x1738f5(0x1d9)]}),_0xce4619=_0x150e18[_0x1738f5(0x1f8)],_0x5717b5=await withSpinner(_0x1738f5(0x149),()=>_0x3fd21c[_0x1738f5(0x1e2)][_0x1738f5(0x198)](_0xce4619,{'name':_0x47bf5f,'prompt':_0x489796,'description':_0x4387e5,'starterMessage':_0x19fc16}),{'verbose':_0x2f19cf['verbose']});return console[_0x1738f5(0x19f)](_0x1738f5(0x1a5)+_0x5717b5[_0x1738f5(0x1f8)]['id']),await handleSDKOutput([_0x5717b5[_0x1738f5(0x1f8)]],_0x2f19cf),0x0;}catch(_0x2d487b){return handleSDKError(_0x2d487b,_0x2f19cf),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x151);[a19_0x562c89(0x20c)]=a19_0x562c89(0x19d);async['execute'](_0xc7abbb){const _0x5ed896=a19_0x562c89,{options:_0x40dac6,args:_0x22bac1,tdx:_0x3036b2}=_0xc7abbb;if(_0x22bac1[_0x5ed896(0x15e)]===0x0)return console[_0x5ed896(0x177)](_0x5ed896(0x172)),console[_0x5ed896(0x177)](_0x5ed896(0x14c)),0x1;const _0x1c56b7=_0x22bac1[0x0];try{const _0x4315db=await getProjectIdOrDefault(_0xc7abbb),_0x184812=await withSpinner(_0x5ed896(0x15f)+_0x1c56b7+_0x5ed896(0x1e8),()=>_0x3036b2[_0x5ed896(0x1e2)][_0x5ed896(0x1c8)](_0x1c56b7,_0x4315db),{'verbose':_0x40dac6[_0x5ed896(0x1d9)]}),_0x56098f=_0x184812['data'];return await withSpinner(_0x5ed896(0x174),()=>_0x3036b2[_0x5ed896(0x1e2)][_0x5ed896(0x1ac)](_0x56098f),{'verbose':_0x40dac6[_0x5ed896(0x1d9)]}),console['log']('Agent\x20deleted:\x20'+_0x56098f),0x0;}catch(_0x3b93fd){return handleSDKError(_0x3b93fd,_0x40dac6),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x188);[a19_0x562c89(0x20c)]=a19_0x562c89(0x1d4);async['execute'](_0xc849dd){const _0x2f3149=a19_0x562c89;return executeChatHistoryCommand(_0xc849dd,_0x2f3149(0x17f));}}export class LLMUseCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x20d);['description']='Set\x20current\x20project\x20context';async[a19_0x562c89(0x1a0)](_0x1ea169){const _0x360610=a19_0x562c89,{options:_0x580406,args:_0xd097cf,tdx:_0x57ec18}=_0x1ea169;if(_0xd097cf[_0x360610(0x15e)]===0x0)return console['error'](_0x360610(0x15d)),console[_0x360610(0x177)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x2dcf15=_0xd097cf[0x0];try{return await withSpinner(_0x360610(0x1ae)+_0x2dcf15+_0x360610(0x1e8),()=>_0x57ec18['llm'][_0x360610(0x1d2)](_0x2dcf15),{'verbose':_0x580406[_0x360610(0x1d9)]}),console['log'](_0x360610(0x139)+_0x2dcf15),0x0;}catch(_0x52ab5a){return handleSDKError(_0x52ab5a,_0x580406),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x1ef);[a19_0x562c89(0x20c)]=a19_0x562c89(0x171);async['execute'](_0x451352){const _0x20b743=a19_0x562c89,{options:_0x67849d,args:_0x50cf5b,tdx:_0xcf0467}=_0x451352;if(_0x50cf5b[_0x20b743(0x15e)]===0x0)return console['error'](_0x20b743(0x15d)),console['error']('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x413161=_0x50cf5b[0x0],_0xa4bf24=_0x67849d,_0x402830=_0xa4bf24[_0x20b743(0x20c)];try{const _0x3ce4be=await withSpinner(_0x20b743(0x1fe)+_0x413161+'\x27...',()=>_0xcf0467[_0x20b743(0x1e2)]['createProject']({'name':_0x413161,'description':_0x402830}),{'verbose':_0x67849d[_0x20b743(0x1d9)]});console[_0x20b743(0x19f)](_0x20b743(0x200)+_0x3ce4be[_0x20b743(0x1f8)]['id']);const _0x4a77a4=toLLMProjectInfo(_0x3ce4be[_0x20b743(0x1f8)]);return await handleSDKOutput([_0x4a77a4],_0x67849d),0x0;}catch(_0x4b0f7b){return handleSDKError(_0x4b0f7b,_0x67849d),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x1f1);[a19_0x562c89(0x20c)]=a19_0x562c89(0x1b2);async[a19_0x562c89(0x1a0)](_0x4dbf77){const _0x39543a=a19_0x562c89,{options:_0x1b80aa,args:_0x55cf1c,tdx:_0xd3e90e}=_0x4dbf77;if(_0x55cf1c[_0x39543a(0x15e)]===0x0)return console[_0x39543a(0x177)](_0x39543a(0x15d)),console[_0x39543a(0x177)](_0x39543a(0x159)),0x1;const _0x33e33e=_0x55cf1c[0x0];try{return await withSpinner(_0x39543a(0x1f7)+_0x33e33e+_0x39543a(0x1e8),()=>_0xd3e90e[_0x39543a(0x1e2)][_0x39543a(0x1b6)](_0x33e33e),{'verbose':_0x1b80aa['verbose']}),console['log'](_0x39543a(0x1d8)+_0x33e33e),0x0;}catch(_0x42ea24){return handleSDKError(_0x42ea24,_0x1b80aa),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x1e9);[a19_0x562c89(0x20c)]=a19_0x562c89(0x1c7);async['execute'](_0x5730fa){const _0x2aa070=a19_0x562c89,{options:_0x2cb4d4,args:_0x10f7df,tdx:_0x22ddbe}=_0x5730fa,_0x380e43=getChalk(_0x2cb4d4);console[_0x2aa070(0x19f)](_0x380e43[_0x2aa070(0x182)](_0x2aa070(0x1fa))),console[_0x2aa070(0x19f)](_0x380e43['yellow'](_0x2aa070(0x1c2))),console[_0x2aa070(0x19f)](_0x380e43['dim'](_0x2aa070(0x204))),console[_0x2aa070(0x19f)]();if(_0x10f7df[_0x2aa070(0x15e)]===0x0)return console[_0x2aa070(0x177)](_0x2aa070(0x15d)),console['error'](_0x2aa070(0x17a)),0x1;const _0x964f9f=_0x10f7df[0x0],_0x57e7d8=_0x2cb4d4,_0x5ef3e7=_0x57e7d8[_0x2aa070(0x1a9)],_0x57c344=_0x57e7d8[_0x2aa070(0x1eb)];try{const _0xb6b9f0=_0x5ef3e7||_0x964f9f+_0x2aa070(0x143);if(a19_0x2520aa[_0x2aa070(0x213)](_0xb6b9f0)&&!_0x57c344){if(!_0x2cb4d4['yes']){const _0x5af148=await confirm(_0x2aa070(0x1d1)+_0xb6b9f0+_0x2aa070(0x1ee));if(!_0x5af148)return console[_0x2aa070(0x19f)](_0x2aa070(0x1c9)),0x0;}a19_0x2520aa[_0x2aa070(0x17c)](_0xb6b9f0,{'recursive':!![]});}const _0xfa5d2f=await withSpinner(_0x57c344?'Analyzing\x20project\x20\x27'+_0x964f9f+_0x2aa070(0x1e8):'Backing\x20up\x20project\x20\x27'+_0x964f9f+_0x2aa070(0x1e8),()=>_0x22ddbe[_0x2aa070(0x1e2)][_0x2aa070(0x208)](_0x964f9f,_0x5ef3e7,{'dryRun':_0x57c344}),{'verbose':_0x2cb4d4[_0x2aa070(0x1d9)]}),_0x34322c=_0xfa5d2f['data'];return _0x57c344?console[_0x2aa070(0x19f)](_0x2aa070(0x18e)+_0x34322c['outputDir']):console['log']('Project\x20backed\x20up\x20to:\x20'+_0x34322c['outputDir']),console[_0x2aa070(0x19f)](_0x2aa070(0x203)+_0x34322c[_0x2aa070(0x173)][_0x2aa070(0x14f)]),console['log'](_0x2aa070(0x1fb)+_0x34322c[_0x2aa070(0x173)][_0x2aa070(0x140)]),console['log'](_0x2aa070(0x167)+_0x34322c[_0x2aa070(0x173)][_0x2aa070(0x15b)]),console['log'](_0x2aa070(0x211)+_0x34322c['counts'][_0x2aa070(0x144)]),(_0x2cb4d4[_0x2aa070(0x1a6)]==='json'||_0x2cb4d4[_0x2aa070(0x1a6)]===_0x2aa070(0x1c3))&&await handleSDKOutput([_0x34322c],_0x2cb4d4),0x0;}catch(_0xe6977b){return handleSDKError(_0xe6977b,_0x2cb4d4),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x135);[a19_0x562c89(0x20c)]=a19_0x562c89(0x165);async[a19_0x562c89(0x1a0)](_0x909174){const _0x5a94c9=a19_0x562c89,{options:_0x1d58d7,args:_0x528777,tdx:_0x445ff8}=_0x909174,_0x212ffd=getChalk(_0x1d58d7);console[_0x5a94c9(0x19f)](_0x212ffd['yellow'](_0x5a94c9(0x202))),console[_0x5a94c9(0x19f)](_0x212ffd[_0x5a94c9(0x182)](_0x5a94c9(0x1f6))),console[_0x5a94c9(0x19f)](_0x212ffd['dim'](_0x5a94c9(0x1ed))),console[_0x5a94c9(0x19f)](_0x212ffd[_0x5a94c9(0x147)](_0x5a94c9(0x1a8))),console['log'](_0x212ffd[_0x5a94c9(0x147)](_0x5a94c9(0x1e4))),console[_0x5a94c9(0x19f)]();if(_0x528777[_0x5a94c9(0x15e)]===0x0)return console[_0x5a94c9(0x177)](_0x5a94c9(0x1a2)),console['error'](_0x5a94c9(0x148)),0x1;const _0x5921fd=_0x528777[0x0],_0x101ec6=_0x1d58d7,_0x1b6338=_0x101ec6[_0x5a94c9(0x1c1)],_0x30da22=_0x101ec6[_0x5a94c9(0x1eb)];try{if(!_0x30da22){const _0x549efd=_0x445ff8[_0x5a94c9(0x1e2)][_0x5a94c9(0x180)](_0x5921fd),_0x3d9152=_0x1b6338||_0x549efd[_0x5a94c9(0x1be)][_0x5a94c9(0x16d)],_0x3ea683=await withSpinner(_0x5a94c9(0x1da),()=>_0x445ff8['llm']['projects'](),{'verbose':_0x1d58d7[_0x5a94c9(0x1d9)]}),_0x1077cc=_0x3ea683[_0x5a94c9(0x1f8)][_0x5a94c9(0x1ab)](_0x48c92e=>_0x48c92e['attributes']['name']===_0x3d9152);if(_0x1077cc&&!_0x1d58d7[_0x5a94c9(0x18f)]){const _0x4d94a5=await confirm(_0x5a94c9(0x1d5)+_0x3d9152+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x4d94a5)return console[_0x5a94c9(0x19f)]('Restore\x20cancelled.'),0x0;}}const _0x1448fb=await withSpinner(_0x30da22?_0x5a94c9(0x1cf)+_0x5921fd+'\x27...':_0x5a94c9(0x1e1)+_0x5921fd+_0x5a94c9(0x1e8),()=>_0x445ff8[_0x5a94c9(0x1e2)][_0x5a94c9(0x14a)](_0x5921fd,{'name':_0x1b6338,'dryRun':_0x30da22}),{'verbose':_0x1d58d7[_0x5a94c9(0x1d9)]}),_0x5a98a2=_0x1448fb[_0x5a94c9(0x1f8)];return _0x5a98a2[_0x5a94c9(0x168)]&&console['log'](_0x5a94c9(0x16c)+_0x5a98a2[_0x5a94c9(0x168)]+'\x27'),_0x30da22?console[_0x5a94c9(0x19f)](_0x5a94c9(0x195)+_0x5a98a2[_0x5a94c9(0x16d)]):console['log'](_0x5a94c9(0x156)+_0x5a98a2[_0x5a94c9(0x16d)]+'\x20('+_0x5a98a2['projectId']+')'),console[_0x5a94c9(0x19f)]('\x20\x20Agents:\x20'+_0x5a98a2[_0x5a94c9(0x173)][_0x5a94c9(0x14f)]),console[_0x5a94c9(0x19f)](_0x5a94c9(0x1fb)+_0x5a98a2[_0x5a94c9(0x173)]['knowledgeBases']),console[_0x5a94c9(0x19f)](_0x5a94c9(0x167)+_0x5a98a2['counts'][_0x5a94c9(0x15b)]),console[_0x5a94c9(0x19f)]('\x20\x20Integrations:\x20'+_0x5a98a2['counts'][_0x5a94c9(0x144)]),(_0x1d58d7[_0x5a94c9(0x1a6)]===_0x5a94c9(0x146)||_0x1d58d7[_0x5a94c9(0x1a6)]==='jsonl')&&await handleSDKOutput([_0x5a98a2],_0x1d58d7),0x0;}catch(_0x106c08){return handleSDKError(_0x106c08,_0x1d58d7),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x11d81c,_0x2a3acd){const _0x1f228a=a19_0x562c89,_0x3af24e=_0x2a3acd[_0x1f228a(0x18a)]||CHAT_SELECTOR_PAGE_SIZE;let _0x645217=0x0,_0x572765=[];const _0xd6821a=(await import(_0x1f228a(0x15b)))[_0x1f228a(0x1f5)],_0x127913=getChalk(_0x2a3acd);while(!![]){const _0x5f395c=await withSpinner(_0x1f228a(0x1af),()=>_0x11d81c[_0x1f228a(0x1e2)][_0x1f228a(0x196)](_0x3af24e+_0x645217),{'verbose':_0x2a3acd[_0x1f228a(0x1d9)]});_0x572765=_0x5f395c[_0x1f228a(0x1f8)];const _0x397757=_0x572765[_0x1f228a(0x14d)](_0x645217,_0x645217+_0x3af24e),_0x318ab6=_0x572765['length']>_0x645217+_0x3af24e,_0x88a747=[...new Set(_0x397757[_0x1f228a(0x1db)](_0x23bc1f=>_0x23bc1f[_0x1f228a(0x184)][_0x1f228a(0x1d7)])[_0x1f228a(0x19e)](_0x55b315=>_0x55b315!==undefined))],_0x444571=new Map();await Promise['all'](_0x88a747[_0x1f228a(0x1db)](async _0x286b40=>{const _0x3d68c5=_0x1f228a;try{const _0x163d80=await _0x11d81c['llm'][_0x3d68c5(0x216)](_0x286b40);_0x444571[_0x3d68c5(0x1ce)](_0x286b40,_0x163d80['attributes'][_0x3d68c5(0x1c1)]);}catch{_0x444571[_0x3d68c5(0x1ce)](_0x286b40,_0x286b40);}}));const _0x1618a9=_0x397757[_0x1f228a(0x1db)](_0x47e114=>{const _0x23c779=_0x1f228a,_0x200b86=_0x47e114[_0x23c779(0x184)][_0x23c779(0x185)]||_0x23c779(0x141),_0x2dafd2=_0x200b86[_0x23c779(0x138)]('\x0a')[0x0],_0x2a134f=_0x2dafd2['length']>0x50?_0x2dafd2['substring'](0x0,0x4d)+_0x23c779(0x1df):_0x2dafd2,_0x28b823=_0x47e114[_0x23c779(0x184)][_0x23c779(0x1d7)]?_0x444571[_0x23c779(0x20b)](_0x47e114['attributes']['agentId'])||_0x47e114['attributes'][_0x23c779(0x1d7)]:_0x23c779(0x137),_0x193f15=_0x47e114[_0x23c779(0x184)][_0x23c779(0x20f)]||_0x47e114[_0x23c779(0x184)]['updatedAt'],_0x273cc2=new Date(_0x193f15),_0x62a688=new Date(),_0x45db9c=_0x62a688[_0x23c779(0x158)]()-_0x273cc2['getTime'](),_0x46d378=Math[_0x23c779(0x14e)](_0x45db9c/0xea60),_0x21af7c=Math['floor'](_0x45db9c/0x36ee80),_0x224dd7=Math[_0x23c779(0x14e)](_0x45db9c/0x5265c00);let _0x5a33ae;if(_0x46d378<0x1)_0x5a33ae=_0x23c779(0x1cc);else{if(_0x46d378<0x3c)_0x5a33ae=_0x46d378+_0x23c779(0x1a3);else{if(_0x21af7c<0x18)_0x5a33ae=_0x21af7c+_0x23c779(0x15a);else _0x224dd7<0x7?_0x5a33ae=_0x224dd7+'d\x20ago':_0x5a33ae=_0x273cc2[_0x23c779(0x1ea)](_0x23c779(0x1bc),{'month':'short','day':_0x23c779(0x1b9)});}}return{'title':_0x2a134f+'\x20'+_0x127913[_0x23c779(0x147)]('['+_0x28b823+']\x20'+_0x5a33ae),'value':_0x47e114['id']};});_0x318ab6&&_0x1618a9[_0x1f228a(0x1d6)]({'title':_0x127913[_0x1f228a(0x183)](_0x1f228a(0x153)),'value':'__load_more__'});const _0x4b1054=await _0xd6821a({'type':_0x1f228a(0x19b),'name':_0x1f228a(0x150),'message':_0x1f228a(0x1b0),'choices':_0x1618a9,'hint':_0x1f228a(0x16b)});if(!_0x4b1054[_0x1f228a(0x150)])return undefined;if(_0x4b1054[_0x1f228a(0x150)]===_0x1f228a(0x179)){_0x645217+=_0x3af24e;continue;}return _0x4b1054[_0x1f228a(0x150)];}}export class ChatsCommand extends BaseCommand{[a19_0x562c89(0x1c1)]=a19_0x562c89(0x196);[a19_0x562c89(0x20c)]=a19_0x562c89(0x1ba);async[a19_0x562c89(0x1a0)](_0x1ae73a){const _0x2cbd46=a19_0x562c89;return executeChatHistoryCommand(_0x1ae73a,_0x2cbd46(0x214));}}
|
|
1
|
+
const a19_0x12abb0=a19_0x3d9f;(function(_0x3d3592,_0x434dc2){const _0x40f36a=a19_0x3d9f,_0xb62f77=_0x3d3592();while(!![]){try{const _0x16d394=parseInt(_0x40f36a(0x1ec))/0x1+-parseInt(_0x40f36a(0x204))/0x2+parseInt(_0x40f36a(0x238))/0x3*(-parseInt(_0x40f36a(0x1de))/0x4)+-parseInt(_0x40f36a(0x246))/0x5+-parseInt(_0x40f36a(0x1f4))/0x6+parseInt(_0x40f36a(0x26b))/0x7+parseInt(_0x40f36a(0x206))/0x8;if(_0x16d394===_0x434dc2)break;else _0xb62f77['push'](_0xb62f77['shift']());}catch(_0x1fce77){_0xb62f77['push'](_0xb62f77['shift']());}}}(a19_0x515f,0xb8db6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a19_0x16dab3 from'node:fs';function handleSDKError(_0x479b6a,_0x5a2c77){const _0x52f65f=a19_0x3d9f;if(_0x479b6a instanceof SDKError)console[_0x52f65f(0x26e)]('Error:\x20'+_0x479b6a[_0x52f65f(0x23e)]),_0x5a2c77[_0x52f65f(0x1b6)]&&(_0x479b6a[_0x52f65f(0x231)]&&console[_0x52f65f(0x26e)](_0x52f65f(0x1e4)+_0x479b6a['cause']),_0x479b6a[_0x52f65f(0x1e9)]&&(console[_0x52f65f(0x26e)](_0x52f65f(0x1c1)),console[_0x52f65f(0x26e)](_0x479b6a[_0x52f65f(0x1e9)])));else throw _0x479b6a;}function a19_0x515f(){const _0x4e7ec1=['\x20project(s)','[unknown]','Select\x20a\x20chat\x20session:','cause','all','No\x20agents\x20found','Backing\x20up\x20project\x20\x27','llm','length','Project\x20created:\x20','24iBsiMu','projects','attributes','projectName','log','\x20\x20Knowledge\x20Bases:\x20','message','cyan','input','set','blue','List\x20available\x20LLM\x20models','Project\x20deleted:\x20','models','7220105YvYtVI','Deleting\x20agent...','backupProject','join','temperature','entries','split','localeCompare','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','json','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Analyzing\x20project\x20\x27','[output]\x20','includes','push','[error]\x20\x20','bold','data','just\x20now','h\x20ago','llm:models','No\x20messages\x20found\x20in\x20chat\x20history.','agent','Delete\x20an\x20LLM\x20project','chatId','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','\x27...','Resolving\x20project\x20\x27','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Fetching\x20chat\x20sessions...','Agent\x20created:\x20','Backup\x20cancelled.','agentId','toLocaleDateString','en-US','deleteAgent','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','1711521EHNBvU','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','(no\x20agent)','error','tool','model','prompts','default','\x27\x20already\x20exists.\x20Overwrite?','A\x20project\x20named\x20\x27','Creating\x20project\x20\x27','substring','prompt','outputDir','rmSync','Project\x20context\x20set\x20to:\x20','Setting\x20project\x20context\x20to\x20\x27','INVALID_ARGUMENT','Fetching\x20most\x20recent\x20chat...','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','llm:project:delete','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','Usage:\x20','green','d\x20ago','Project\x20not\x20found:\x20','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','[tool]\x20\x20\x20','llm:agent:show','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','systemPrompt','deleteProject','Error:\x20Project\x20name\x20is\x20required','get','Restoring\x20project\x20from\x20\x27','execute','limit','List\x20all\x20LLM\x20projects','\x20\x20\x20Examples:','m\x20ago','targetKnowledgeBase','Deleting\x20project\x20\x27','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','counts','firstInputContent','targetWebSearchTool','Load\x20more...','verbose','dryRun','updateAgent','llm:agent:delete','name','updatedAt','red','createProject','Error:\x20Agent\x20name\x20is\x20required','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','\x0aStack\x20trace:','integrations','short','Resolving\x20agent\x20\x27','yes','llmProject','Updating\x20agent...','getOrCreateDefaultProject','claude-4.5-haiku','Set\x20current\x20project\x20context','\x20→\x20chat:\x20','numeric','tsv','Usage:\x20tdx\x20llm\x20use\x20<project-name>','\x20\x20Prompts:\x20','No\x20chat\x20sessions\x20found.','Update\x20an\x20existing\x20agent','image','LLM_PROJECT_NOT_FOUND','Create\x20a\x20new\x20LLM\x20project','Create\x20a\x20new\x20agent\x20in\x20current\x20project','llm:agents','content','tdx\x20chats','getCurrentProject','getTime','\x20--last','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','yellow','751372VhRUiz','Agent\x20updated:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','dim','exportedFrom','output','\x20\x20Cause:\x20','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','filter','knowledgeBases','\x20bytes)','stack','slice','sourceSite','1144881FiXzgb','llm:project:backup','\x20\x20Integrations:\x20','history','\x20->\x20KB:','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','(no\x20message)','chats','696000bjSIQl','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','floor','⚒️\x20','description','agents','format','keys','Delete\x20an\x20agent','Checking\x20for\x20existing\x20projects...','...','Agent\x20deleted:\x20','\x20->\x20WebSearch:','resolveAgentId','llm:agent:create','1244344TOBtCH','Fetching\x20projects...','24421816NKWGsA','Fetching\x20chat\x20history\x20for\x20\x27','Use\x20format:\x20project-name/agent-name','map','Error:\x20Backup\x20folder\x20path\x20is\x20required','llm:use','Invalid\x20path\x20syntax:\x20','llm:agent:update','resolveProjectId','Unknown','last','getBackupMetadata','table','site','Restore\x20cancelled.','No\x20projects\x20found','existsSync','toLowerCase','llm:history','setCurrentProject','tool_call','targetImageGenerator','\x20->\x20ImageGen:','sort','targetAgent','\x20agent(s)','createdAt','__load_more__','Project\x20restored:\x20','\x20-\x20','jsonl','maxToolIterations','\x20->\x20Agent:','projectId','createAgent','\x20\x20Agents:\x20','find','stringify','Fetching\x20agents...','Output\x20directory\x20\x27'];a19_0x515f=function(){return _0x4e7ec1;};return a19_0x515f();}function formatChatHistoryEntry(_0x12da80,_0x401719){const _0x15a217=a19_0x3d9f,_0x111fc7=getChalk(_0x401719),_0xfc411=_0x111fc7[_0x15a217(0x1e1)](_0x12da80['at']);if(_0x15a217(0x240)in _0x12da80){const _0x367e46=_0x111fc7[_0x15a217(0x23f)]('[input]\x20\x20');return _0xfc411+'\x20'+_0x367e46+':\x20'+_0x12da80[_0x15a217(0x240)];}if('content'in _0x12da80){const _0x55ed28=_0x111fc7[_0x15a217(0x285)]('[content]');return _0xfc411+'\x20'+_0x55ed28+':\x20'+_0x12da80[_0x15a217(0x1d7)];}if(_0x15a217(0x21a)in _0x12da80){const _0x8b2e79=_0x111fc7[_0x15a217(0x1dd)]('[tool_call]'),{functionName:_0x30b3e7,functionArguments:_0x3ffe53,targetFunction:_0x468a86}=_0x12da80[_0x15a217(0x21a)];let _0x7c94e0=_0xfc411+'\x20'+_0x8b2e79+':\x20'+_0x111fc7[_0x15a217(0x256)](_0x30b3e7);if(_0x3ffe53&&Object[_0x15a217(0x1fc)](_0x3ffe53)[_0x15a217(0x236)]>0x0){const _0x3c4794=Object[_0x15a217(0x24b)](_0x3ffe53)[_0x15a217(0x209)](([_0xcea03e,_0x243cc3])=>_0xcea03e+'='+JSON[_0x15a217(0x22b)](_0x243cc3))[_0x15a217(0x249)](',\x20');_0x7c94e0+='('+_0x3c4794+')';}_0x468a86&&(_0x7c94e0+=_0x111fc7[_0x15a217(0x1e1)]('\x20['+_0x468a86+']'));let _0x3a9fdf='';if(_0x12da80[_0x15a217(0x21a)][_0x15a217(0x1af)])_0x3a9fdf=_0x15a217(0x1f0)+_0x12da80[_0x15a217(0x21a)][_0x15a217(0x1af)][_0x15a217(0x1ba)];else{if(_0x12da80[_0x15a217(0x21a)][_0x15a217(0x21e)])_0x3a9fdf=_0x15a217(0x226)+_0x12da80['tool_call'][_0x15a217(0x21e)][_0x15a217(0x1ba)];else{if(_0x12da80[_0x15a217(0x21a)]['targetWebSearchTool'])_0x3a9fdf=_0x15a217(0x201)+_0x12da80[_0x15a217(0x21a)][_0x15a217(0x1b4)][_0x15a217(0x1ba)];else _0x12da80['tool_call'][_0x15a217(0x21b)]&&(_0x3a9fdf=_0x15a217(0x21c)+_0x12da80[_0x15a217(0x21a)]['targetImageGenerator']['name']);}}return _0x7c94e0+_0x3a9fdf;}if(_0x15a217(0x26f)in _0x12da80){const _0xb0ef1e=_0x111fc7['magenta'](_0x15a217(0x289)),{functionName:_0x5ce2bc,functionArguments:_0x5c53e4,content:_0x26a2f2,newChat:_0x47e150}=_0x12da80[_0x15a217(0x26f)];let _0x35e149=_0xfc411+'\x20'+_0xb0ef1e+':\x20'+_0x111fc7['bold'](_0x5ce2bc);if(_0x5c53e4){const _0x415cf3=typeof _0x5c53e4==='string'?_0x5c53e4:JSON[_0x15a217(0x22b)](_0x5c53e4);_0x35e149+='('+_0x415cf3+')';}return _0x26a2f2&&(_0x35e149+='\x0a'+_0x111fc7[_0x15a217(0x1e1)](_0x26a2f2)),_0x47e150&&(_0x35e149+=_0x111fc7['dim'](_0x15a217(0x1cb)+_0x47e150['id'])),_0x35e149;}if('output'in _0x12da80){const _0x4fedf9=_0x111fc7[_0x15a217(0x242)](_0x15a217(0x252));return _0xfc411+'\x20'+_0x4fedf9+':\x20'+_0x12da80[_0x15a217(0x1e3)]['name']+'\x20('+_0x12da80['output'][_0x15a217(0x1d7)][_0x15a217(0x236)]+_0x15a217(0x1e8);}if(_0x15a217(0x1d2)in _0x12da80){const _0x36ec91=_0x111fc7[_0x15a217(0x242)]('[image]\x20\x20'),{width:_0x2451ab,height:_0x10a04b,headerText:_0x3b17a3}=_0x12da80['image'],_0x38848b=_0x3b17a3?_0x15a217(0x223)+_0x3b17a3:'';return _0xfc411+'\x20'+_0x36ec91+':\x20'+_0x2451ab+'x'+_0x10a04b+_0x38848b;}if(_0x15a217(0x26e)in _0x12da80){const _0x9e892a=_0x111fc7[_0x15a217(0x1bc)](_0x15a217(0x255));return _0xfc411+'\x20'+_0x9e892a+':\x20'+_0x12da80[_0x15a217(0x26e)];}return _0xfc411+'\x20'+_0x111fc7[_0x15a217(0x1e1)](_0x15a217(0x22f))+':\x20'+JSON[_0x15a217(0x22b)](_0x12da80);}function a19_0x3d9f(_0x5e76ba,_0x1e321a){_0x5e76ba=_0x5e76ba-0x1af;const _0x515f77=a19_0x515f();let _0x3d9f48=_0x515f77[_0x5e76ba];return _0x3d9f48;}async function executeChatHistoryCommand(_0x328735,_0x3ea375){const _0x14511d=a19_0x3d9f,{options:_0x5f31cc,args:_0x341ca8,tdx:_0x33715d}=_0x328735,_0x228e57=_0x341ca8[0x0],_0x3cdad4=_0x5f31cc,_0x2caa26=_0x3cdad4[_0x14511d(0x210)];try{if(_0x2caa26&&_0x228e57)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x14511d(0x26e)](_0x14511d(0x284)+_0x3ea375+_0x14511d(0x1db)),0x1;if(!_0x228e57&&!_0x2caa26&&_0x5f31cc[_0x14511d(0x1fb)]!==undefined){const _0x5a883e=resolveLimit(_0x5f31cc[_0x14511d(0x292)],DEFAULT_LLM_LIMIT),_0xe3d929=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x33715d['llm']['chats'](_0x5a883e),{'verbose':_0x5f31cc[_0x14511d(0x1b6)]});return await handleSDKOutput(_0xe3d929[_0x14511d(0x257)],_0x5f31cc),0x0;}const _0x5d8a57=await getChatIdOrSelect(_0x33715d,_0x5f31cc,_0x2caa26,_0x228e57);if(!_0x5d8a57)return 0x0;return await displayChatHistory(_0x5d8a57,_0x33715d,_0x5f31cc),0x0;}catch(_0x48b867){return handleSDKError(_0x48b867,_0x5f31cc),0x1;}}async function displayChatHistory(_0x46db62,_0x1d45c3,_0xa16872){const _0x42a6d0=a19_0x3d9f,_0x5b9ee2=await withSpinner(_0x42a6d0(0x207)+_0x46db62+_0x42a6d0(0x260),()=>_0x1d45c3[_0x42a6d0(0x235)][_0x42a6d0(0x1ef)](_0x46db62),{'verbose':_0xa16872[_0x42a6d0(0x1b6)]}),_0xf84a88=_0x5b9ee2[_0x42a6d0(0x257)]['data']??[];if(_0xf84a88['length']===0x0){console[_0x42a6d0(0x23c)](_0x42a6d0(0x25b));return;}if(_0xa16872[_0x42a6d0(0x1fb)]!==undefined)await handleSDKOutput(_0xf84a88,_0xa16872);else{const _0x33b209=_0xf84a88[_0x42a6d0(0x209)](_0x580361=>formatChatHistoryEntry(_0x580361,_0xa16872)),_0x438892=_0x33b209[_0x42a6d0(0x249)]('\x0a');await writeOutput(_0x438892,_0xa16872['output'],_0x42a6d0(0x212));}}async function getChatIdOrSelect(_0x5103d1,_0x506a82,_0x5e9aa1,_0x521a43){const _0x31ee51=a19_0x3d9f;if(_0x521a43)return _0x521a43;if(_0x5e9aa1){const _0x1a9be0=await withSpinner(_0x31ee51(0x27d),()=>_0x5103d1[_0x31ee51(0x235)][_0x31ee51(0x1f3)](0x1),{'verbose':_0x506a82[_0x31ee51(0x1b6)]});if(_0x1a9be0[_0x31ee51(0x257)][_0x31ee51(0x236)]===0x0)return console[_0x31ee51(0x23c)](_0x31ee51(0x1d0)),undefined;return _0x1a9be0[_0x31ee51(0x257)][0x0]['id'];}const _0x31dead=await selectChatInteractively(_0x5103d1,_0x506a82);if(!_0x31dead)return console[_0x31ee51(0x23c)]('\x0aCancelled'),undefined;return _0x31dead;}async function getProjectIdOrDefault(_0x4c654e){const _0x44c533=await getProjectWithName(_0x4c654e);return _0x44c533['id'];}async function getProjectWithName(_0x4ab3bf){const _0x41e8f5=a19_0x3d9f,{tdx:_0x49af26,options:_0x576053}=_0x4ab3bf,_0x3738e6=_0x576053[_0x41e8f5(0x1c6)];if(_0x3738e6){const _0x2804ad=await withSpinner(_0x41e8f5(0x261)+_0x3738e6+_0x41e8f5(0x260),()=>_0x49af26[_0x41e8f5(0x235)][_0x41e8f5(0x20e)](_0x3738e6),{'verbose':_0x576053['verbose']});return{'id':_0x2804ad['data'],'name':_0x3738e6};}const _0x4b7a8a=_0x49af26[_0x41e8f5(0x235)][_0x41e8f5(0x1d9)]();if(_0x4b7a8a){const _0xca7481=await _0x49af26['llm'][_0x41e8f5(0x239)](),_0x6ec47f=_0xca7481[_0x41e8f5(0x22a)](_0x4d74fd=>_0x4d74fd['id']===_0x4b7a8a);return{'id':_0x4b7a8a,'name':_0x6ec47f?.[_0x41e8f5(0x23a)][_0x41e8f5(0x1ba)]||_0x41e8f5(0x20f)};}const _0x54a305=await withSpinner('Getting\x20default\x20project...',()=>_0x49af26[_0x41e8f5(0x235)][_0x41e8f5(0x1c8)](),{'verbose':_0x576053[_0x41e8f5(0x1b6)]});return{'id':_0x54a305['data']['id'],'name':_0x54a305[_0x41e8f5(0x257)]['attributes']['name']};}function toLLMProjectInfo(_0x550058){const _0x324ec2=a19_0x3d9f;return{'name':_0x550058[_0x324ec2(0x23a)]['name'],'description':_0x550058[_0x324ec2(0x23a)][_0x324ec2(0x1f9)],'createdAt':_0x550058[_0x324ec2(0x23a)][_0x324ec2(0x220)],'updatedAt':_0x550058[_0x324ec2(0x23a)][_0x324ec2(0x1bb)]};}function toAgentInfo(_0x4f3a7b){const _0x48320b=a19_0x3d9f;return{'name':_0x4f3a7b['attributes'][_0x48320b(0x1ba)],'description':_0x4f3a7b[_0x48320b(0x23a)]['description'],'prompt':truncatePrompt(_0x4f3a7b[_0x48320b(0x23a)][_0x48320b(0x277)]),'createdAt':_0x4f3a7b[_0x48320b(0x23a)][_0x48320b(0x220)],'updatedAt':_0x4f3a7b['attributes'][_0x48320b(0x1bb)]};}function truncatePrompt(_0x337467){const _0x59b602=a19_0x3d9f;if(!_0x337467)return undefined;const _0x4f5ca0=0x64;if(_0x337467[_0x59b602(0x236)]<=_0x4f5ca0)return _0x337467;return _0x337467[_0x59b602(0x1ea)](0x0,_0x4f5ca0)+_0x59b602(0x1ff);}export class LLMModelsCommand extends BaseCommand{['name']=a19_0x12abb0(0x25a);[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x243);async[a19_0x12abb0(0x291)](_0x34b502){const _0x1c7678=a19_0x12abb0,{options:_0x55b836,tdx:_0xdbc624}=_0x34b502;try{const _0x2718b8=await withSpinner('Fetching\x20available\x20models...',()=>_0xdbc624[_0x1c7678(0x235)][_0x1c7678(0x245)](),{'verbose':_0x55b836[_0x1c7678(0x1b6)]});return await handleSDKOutput(_0x2718b8[_0x1c7678(0x257)],_0x55b836),0x0;}catch(_0x1038dd){return handleSDKError(_0x1038dd,_0x55b836),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]='llm:projects';[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x293);async['execute'](_0x6d6aa8){const _0x34bcc1=a19_0x12abb0,{options:_0x154708,args:_0x4bbcb3,tdx:_0x560e8e}=_0x6d6aa8,_0x2f1518=getChalk(_0x154708),_0xb5bca9=_0x154708[_0x34bcc1(0x213)];try{const _0x1690d0=_0x4bbcb3[0x0],_0x1b435d=resolveLimit(_0x154708[_0x34bcc1(0x292)],DEFAULT_LLM_LIMIT),_0x3a7c58=await withSpinner(_0x34bcc1(0x205),()=>_0x560e8e[_0x34bcc1(0x235)]['projects'](_0x1b435d),{'verbose':_0x154708[_0x34bcc1(0x1b6)]});let _0x5a1964=_0x3a7c58['data'];_0x1690d0&&(_0x5a1964=_0x3a7c58['data']['filter'](_0x42f2c5=>matchGlobPattern(_0x42f2c5['attributes'][_0x34bcc1(0x1ba)],_0x1690d0)));const _0x2db18f=_0x154708[_0x34bcc1(0x1fb)]===_0x34bcc1(0x24f)||_0x154708[_0x34bcc1(0x1fb)]===_0x34bcc1(0x224)||_0x154708[_0x34bcc1(0x1fb)]===_0x34bcc1(0x212)||_0x154708[_0x34bcc1(0x1fb)]===_0x34bcc1(0x1cd);if(_0x2db18f){const _0x1cacee=_0x5a1964[_0x34bcc1(0x209)](_0x4837cf=>({...toLLMProjectInfo(_0x4837cf),'url':getLLMProjectUrl(_0xb5bca9,_0x4837cf['id'])}));await handleSDKOutput(_0x1cacee,_0x154708);}else{const _0x4ffbc8=[];if(_0x5a1964['length']===0x0)_0x4ffbc8['push'](_0x2f1518[_0x34bcc1(0x1e1)](_0x34bcc1(0x215)));else{const _0x102ab9=[..._0x5a1964]['sort']((_0x26bf97,_0x2bdfe9)=>_0x26bf97['attributes'][_0x34bcc1(0x1ba)][_0x34bcc1(0x24d)](_0x2bdfe9[_0x34bcc1(0x23a)][_0x34bcc1(0x1ba)]));for(const _0x35ecc3 of _0x102ab9){const _0x571c18=getLLMProjectUrl(_0xb5bca9,_0x35ecc3['id']),_0x4efd88=hyperlink(_0x35ecc3[_0x34bcc1(0x23a)]['name'],_0x571c18);_0x4ffbc8['push'](_0x34bcc1(0x1f8)+_0x4efd88);}_0x4ffbc8[_0x34bcc1(0x254)](_0x2f1518[_0x34bcc1(0x1e1)](_0x5a1964[_0x34bcc1(0x236)]+_0x34bcc1(0x22e)));}await writeOutput(_0x4ffbc8['join']('\x0a'),_0x154708[_0x34bcc1(0x1e3)],_0x34bcc1(0x212));}return 0x0;}catch(_0xc64577){return handleSDKError(_0xc64577,_0x154708),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a19_0x12abb0(0x1d6);['description']='List\x20agents\x20in\x20current\x20project';async[a19_0x12abb0(0x291)](_0x27f97c){const _0x419bd2=a19_0x12abb0,{options:_0x200554,args:_0x1be52a,tdx:_0x4933b3}=_0x27f97c,_0x26ccc5=getChalk(_0x200554),_0x93cb85=_0x200554[_0x419bd2(0x213)];try{const _0x602a18=_0x1be52a[0x0];let _0x12238a=_0x602a18,_0x20116d,_0x2b7ca5;if(_0x602a18&&_0x602a18[_0x419bd2(0x253)]('/')){const _0x1d654a=_0x602a18[_0x419bd2(0x24c)]('/');if(_0x1d654a[_0x419bd2(0x236)]===0x2){const [_0x48f69f,_0x107891]=_0x1d654a,_0x24cc8c=await _0x4933b3['llm']['projects'](),_0x2d9210=_0x24cc8c[_0x419bd2(0x22a)](_0x4f2827=>_0x4f2827[_0x419bd2(0x23a)][_0x419bd2(0x1ba)][_0x419bd2(0x217)]()===_0x48f69f[_0x419bd2(0x217)]());if(!_0x2d9210)throw new SDKError(ErrorCode[_0x419bd2(0x1d3)],_0x419bd2(0x287)+_0x48f69f,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x20116d=_0x2d9210['id'],_0x2b7ca5=_0x2d9210[_0x419bd2(0x23a)]['name'],_0x12238a=_0x107891;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x419bd2(0x20c)+_0x602a18,undefined,{'helpText':_0x419bd2(0x208)});}else{const _0x352525=await getProjectWithName(_0x27f97c);_0x20116d=_0x352525['id'],_0x2b7ca5=_0x352525[_0x419bd2(0x1ba)];}const _0x4e171f=await withSpinner(_0x419bd2(0x22c),()=>_0x4933b3[_0x419bd2(0x235)][_0x419bd2(0x1fa)](_0x20116d),{'verbose':_0x200554[_0x419bd2(0x1b6)]});let _0x7cc96d=_0x4e171f['data'];_0x12238a&&(_0x7cc96d=_0x4e171f[_0x419bd2(0x257)][_0x419bd2(0x1e6)](_0x35f0f5=>matchGlobPattern(_0x35f0f5[_0x419bd2(0x23a)][_0x419bd2(0x1ba)],_0x12238a)));const _0xc9e4e5=_0x200554['format']===_0x419bd2(0x24f)||_0x200554['format']===_0x419bd2(0x224)||_0x200554[_0x419bd2(0x1fb)]===_0x419bd2(0x212)||_0x200554[_0x419bd2(0x1fb)]===_0x419bd2(0x1cd);if(_0xc9e4e5){const _0x4a0093=_0x7cc96d['map'](_0x4e7309=>({...toAgentInfo(_0x4e7309),'chatUrl':getLLMAgentChatUrl(_0x93cb85,_0x20116d,_0x4e7309['id'])}));await handleSDKOutput(_0x4a0093,_0x200554);}else{const _0x1fd79a=[];_0x1fd79a[_0x419bd2(0x254)](_0x26ccc5[_0x419bd2(0x1e1)]('['+_0x2b7ca5+']'));if(_0x7cc96d[_0x419bd2(0x236)]===0x0)_0x1fd79a[_0x419bd2(0x254)](_0x26ccc5[_0x419bd2(0x1e1)](_0x419bd2(0x233)));else{const _0x4d787f=[..._0x7cc96d][_0x419bd2(0x21d)]((_0x89a766,_0x373b86)=>_0x89a766[_0x419bd2(0x23a)]['name'][_0x419bd2(0x24d)](_0x373b86[_0x419bd2(0x23a)][_0x419bd2(0x1ba)]));for(const _0x299704 of _0x4d787f){const _0x48b0e3=getLLMAgentChatUrl(_0x93cb85,_0x20116d,_0x299704['id']),_0x26b15b=hyperlink(_0x299704[_0x419bd2(0x23a)][_0x419bd2(0x1ba)],_0x48b0e3);_0x1fd79a[_0x419bd2(0x254)]('🤖\x20'+_0x26b15b);}_0x1fd79a[_0x419bd2(0x254)](_0x26ccc5[_0x419bd2(0x1e1)](_0x7cc96d[_0x419bd2(0x236)]+_0x419bd2(0x21f)));}await writeOutput(_0x1fd79a[_0x419bd2(0x249)]('\x0a'),_0x200554['output'],'table');}return 0x0;}catch(_0x3db023){return handleSDKError(_0x3db023,_0x200554),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a19_0x12abb0(0x28a);['description']='Show\x20agent\x20details';async[a19_0x12abb0(0x291)](_0x43381c){const _0x2e22a2=a19_0x12abb0,{options:_0x3f06a7,args:_0x1c2dfc,tdx:_0xf9bd1d}=_0x43381c;if(_0x1c2dfc['length']===0x0)return console[_0x2e22a2(0x26e)](_0x2e22a2(0x1be)),console[_0x2e22a2(0x26e)](_0x2e22a2(0x27e)),0x1;const _0x4bc989=_0x1c2dfc[0x0];try{const _0x135607=await getProjectIdOrDefault(_0x43381c),_0x48bb9b=await withSpinner(_0x2e22a2(0x1c4)+_0x4bc989+_0x2e22a2(0x260),()=>_0xf9bd1d[_0x2e22a2(0x235)][_0x2e22a2(0x202)](_0x4bc989,_0x135607),{'verbose':_0x3f06a7['verbose']}),_0x1eb89c=await withSpinner('Fetching\x20agent...',()=>_0xf9bd1d[_0x2e22a2(0x235)]['agent'](_0x48bb9b[_0x2e22a2(0x257)]),{'verbose':_0x3f06a7['verbose']});return await handleSDKOutput([_0x1eb89c[_0x2e22a2(0x257)]],_0x3f06a7),0x0;}catch(_0xfbcfb){return handleSDKError(_0xfbcfb,_0x3f06a7),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x203);[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x1d5);async['execute'](_0x2e1667){const _0x4228f9=a19_0x12abb0,{options:_0x3f8013,args:_0x11b48e,tdx:_0x5ee940}=_0x2e1667;if(_0x11b48e[_0x4228f9(0x236)]===0x0)return console[_0x4228f9(0x26e)](_0x4228f9(0x1be)),console[_0x4228f9(0x26e)](_0x4228f9(0x1f6)),console[_0x4228f9(0x26e)](_0x4228f9(0x1e0)),0x1;const _0x247ff4=_0x11b48e[0x0],_0x24947f=_0x3f8013,_0x329e2c=_0x24947f[_0x4228f9(0x28c)],_0x890360=_0x24947f[_0x4228f9(0x270)]||_0x4228f9(0x1c9),_0x5aa1ec=_0x24947f['starterMessage'],_0xd32aee=_0x24947f[_0x4228f9(0x225)]?Number(_0x24947f['maxToolIterations']):undefined,_0x2c7528=_0x24947f[_0x4228f9(0x24a)]?Number(_0x24947f['temperature']):undefined;try{let _0x2e468e,_0x51cd30;if(_0x247ff4[_0x4228f9(0x253)]('/')){const _0x2159bc=_0x247ff4[_0x4228f9(0x24c)]('/');if(_0x2159bc[_0x4228f9(0x236)]===0x2){const [_0x907d0b,_0x4fb90d]=_0x2159bc,_0x582ae6=await withSpinner(_0x4228f9(0x261)+_0x907d0b+_0x4228f9(0x260),()=>_0x5ee940[_0x4228f9(0x235)][_0x4228f9(0x20e)](_0x907d0b),{'verbose':_0x3f8013[_0x4228f9(0x1b6)]});_0x2e468e=_0x582ae6['data'],_0x51cd30=_0x4fb90d;}else throw new SDKError(ErrorCode[_0x4228f9(0x27c)],_0x4228f9(0x20c)+_0x247ff4,undefined,{'helpText':_0x4228f9(0x208)});}else _0x2e468e=await getProjectIdOrDefault(_0x2e1667),_0x51cd30=_0x247ff4;const _0xab8710=await withSpinner('Creating\x20agent\x20\x27'+_0x51cd30+_0x4228f9(0x260),()=>_0x5ee940[_0x4228f9(0x235)][_0x4228f9(0x228)]({'name':_0x51cd30,'projectId':_0x2e468e,'modelType':_0x890360,'systemPrompt':_0x329e2c,'starterMessage':_0x5aa1ec,'maxToolIterations':_0xd32aee,'temperature':_0x2c7528}),{'verbose':_0x3f8013[_0x4228f9(0x1b6)]});return console['log'](_0x4228f9(0x264)+_0xab8710['data']['id']),await handleSDKOutput([_0xab8710['data']],_0x3f8013),0x0;}catch(_0x3a1e43){return handleSDKError(_0x3a1e43,_0x3f8013),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x20d);[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x1d1);async['execute'](_0x177940){const _0x275539=a19_0x12abb0,{options:_0x4c0bae,args:_0x461011,tdx:_0xf38ec5}=_0x177940;if(_0x461011[_0x275539(0x236)]===0x0)return console[_0x275539(0x26e)](_0x275539(0x1be)),console[_0x275539(0x26e)]('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0xc99090=_0x461011[0x0],_0x2ca61b=_0x4c0bae,_0x2b76e1=_0x2ca61b[_0x275539(0x1ba)],_0x286ab6=_0x2ca61b[_0x275539(0x277)],_0x1825eb=_0x2ca61b[_0x275539(0x1f9)],_0x32c4b7=_0x2ca61b['starterMessage'];if(!_0x2b76e1&&!_0x286ab6&&!_0x1825eb&&!_0x32c4b7)return console[_0x275539(0x26e)](_0x275539(0x250)),console[_0x275539(0x26e)](_0x275539(0x1bf)),0x1;try{const _0x1eaf88=await getProjectIdOrDefault(_0x177940),_0x2259df=await withSpinner('Resolving\x20agent\x20\x27'+_0xc99090+'\x27...',()=>_0xf38ec5[_0x275539(0x235)][_0x275539(0x202)](_0xc99090,_0x1eaf88),{'verbose':_0x4c0bae[_0x275539(0x1b6)]}),_0x58c7ee=_0x2259df[_0x275539(0x257)],_0x39e584=await withSpinner(_0x275539(0x1c7),()=>_0xf38ec5[_0x275539(0x235)][_0x275539(0x1b8)](_0x58c7ee,{'name':_0x2b76e1,'prompt':_0x286ab6,'description':_0x1825eb,'starterMessage':_0x32c4b7}),{'verbose':_0x4c0bae[_0x275539(0x1b6)]});return console[_0x275539(0x23c)](_0x275539(0x1df)+_0x39e584[_0x275539(0x257)]['id']),await handleSDKOutput([_0x39e584[_0x275539(0x257)]],_0x4c0bae),0x0;}catch(_0x43ddb3){return handleSDKError(_0x43ddb3,_0x4c0bae),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x1b9);['description']=a19_0x12abb0(0x1fd);async[a19_0x12abb0(0x291)](_0x4ac2c9){const _0x551055=a19_0x12abb0,{options:_0x3c9185,args:_0x100bda,tdx:_0x515f32}=_0x4ac2c9;if(_0x100bda[_0x551055(0x236)]===0x0)return console['error'](_0x551055(0x1be)),console[_0x551055(0x26e)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x535cc0=_0x100bda[0x0];try{const _0x59a59e=await getProjectIdOrDefault(_0x4ac2c9),_0x2c41f3=await withSpinner(_0x551055(0x1c4)+_0x535cc0+_0x551055(0x260),()=>_0x515f32['llm'][_0x551055(0x202)](_0x535cc0,_0x59a59e),{'verbose':_0x3c9185[_0x551055(0x1b6)]}),_0x51e8bc=_0x2c41f3[_0x551055(0x257)];return await withSpinner(_0x551055(0x247),()=>_0x515f32[_0x551055(0x235)][_0x551055(0x269)](_0x51e8bc),{'verbose':_0x3c9185['verbose']}),console[_0x551055(0x23c)](_0x551055(0x200)+_0x51e8bc),0x0;}catch(_0x598734){return handleSDKError(_0x598734,_0x3c9185),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x218);['description']=a19_0x12abb0(0x1dc);async[a19_0x12abb0(0x291)](_0x22cf91){return executeChatHistoryCommand(_0x22cf91,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x20b);[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x1ca);async[a19_0x12abb0(0x291)](_0x3391a6){const _0x5f4703=a19_0x12abb0,{options:_0x1b8279,args:_0x30857e,tdx:_0xcd1d91}=_0x3391a6;if(_0x30857e[_0x5f4703(0x236)]===0x0)return console[_0x5f4703(0x26e)](_0x5f4703(0x28e)),console[_0x5f4703(0x26e)](_0x5f4703(0x1ce)),0x1;const _0x2a0010=_0x30857e[0x0];try{return await withSpinner(_0x5f4703(0x27b)+_0x2a0010+_0x5f4703(0x260),()=>_0xcd1d91[_0x5f4703(0x235)][_0x5f4703(0x219)](_0x2a0010),{'verbose':_0x1b8279[_0x5f4703(0x1b6)]}),console['log'](_0x5f4703(0x27a)+_0x2a0010),0x0;}catch(_0x24a15b){return handleSDKError(_0x24a15b,_0x1b8279),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]='llm:project:create';[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x1d4);async['execute'](_0x4ddacb){const _0x5b159d=a19_0x12abb0,{options:_0x4e94b2,args:_0x5f3e61,tdx:_0x5410a3}=_0x4ddacb;if(_0x5f3e61['length']===0x0)return console[_0x5b159d(0x26e)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x5b159d(0x26e)](_0x5b159d(0x24e)),0x1;const _0x2d661c=_0x5f3e61[0x0],_0x49a742=_0x4e94b2,_0x1bcf6a=_0x49a742[_0x5b159d(0x1f9)];try{const _0x11d81a=await withSpinner(_0x5b159d(0x275)+_0x2d661c+_0x5b159d(0x260),()=>_0x5410a3[_0x5b159d(0x235)][_0x5b159d(0x1bd)]({'name':_0x2d661c,'description':_0x1bcf6a}),{'verbose':_0x4e94b2[_0x5b159d(0x1b6)]});console[_0x5b159d(0x23c)](_0x5b159d(0x237)+_0x11d81a[_0x5b159d(0x257)]['id']);const _0x5564ca=toLLMProjectInfo(_0x11d81a['data']);return await handleSDKOutput([_0x5564ca],_0x4e94b2),0x0;}catch(_0x2dacc1){return handleSDKError(_0x2dacc1,_0x4e94b2),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x282);[a19_0x12abb0(0x1f9)]=a19_0x12abb0(0x25d);async['execute'](_0x30119f){const _0x159a3b=a19_0x12abb0,{options:_0x4105dd,args:_0x47dedc,tdx:_0x173e94}=_0x30119f;if(_0x47dedc[_0x159a3b(0x236)]===0x0)return console[_0x159a3b(0x26e)](_0x159a3b(0x28e)),console[_0x159a3b(0x26e)](_0x159a3b(0x25f)),0x1;const _0x45d546=_0x47dedc[0x0];try{return await withSpinner(_0x159a3b(0x1b0)+_0x45d546+'\x27...',()=>_0x173e94[_0x159a3b(0x235)][_0x159a3b(0x28d)](_0x45d546),{'verbose':_0x4105dd[_0x159a3b(0x1b6)]}),console['log'](_0x159a3b(0x244)+_0x45d546),0x0;}catch(_0x377d8d){return handleSDKError(_0x377d8d,_0x4105dd),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a19_0x12abb0(0x1ba)]=a19_0x12abb0(0x1ed);['description']='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)';async[a19_0x12abb0(0x291)](_0x5d206f){const _0x1b2559=a19_0x12abb0,{options:_0x2d286c,args:_0x1b3c27,tdx:_0x3dbb1b}=_0x5d206f,_0x244dbf=getChalk(_0x2d286c);console[_0x1b2559(0x23c)](_0x244dbf[_0x1b2559(0x1dd)](_0x1b2559(0x1f1))),console['log'](_0x244dbf[_0x1b2559(0x1dd)](_0x1b2559(0x280))),console[_0x1b2559(0x23c)](_0x244dbf[_0x1b2559(0x1e1)](_0x1b2559(0x26c))),console[_0x1b2559(0x23c)]();if(_0x1b3c27[_0x1b2559(0x236)]===0x0)return console[_0x1b2559(0x26e)](_0x1b2559(0x28e)),console[_0x1b2559(0x26e)](_0x1b2559(0x26a)),0x1;const _0x2212cf=_0x1b3c27[0x0],_0x44d2b4=_0x2d286c,_0x5ba7ca=_0x44d2b4[_0x1b2559(0x1e3)],_0x5a01a1=_0x44d2b4[_0x1b2559(0x1b7)];try{const _0x548df2=_0x5ba7ca||_0x2212cf+'.llm';if(a19_0x16dab3[_0x1b2559(0x216)](_0x548df2)&&!_0x5a01a1){if(!_0x2d286c[_0x1b2559(0x1c5)]){const _0x5ab01d=await confirm(_0x1b2559(0x22d)+_0x548df2+_0x1b2559(0x273));if(!_0x5ab01d)return console[_0x1b2559(0x23c)](_0x1b2559(0x265)),0x0;}a19_0x16dab3[_0x1b2559(0x279)](_0x548df2,{'recursive':!![]});}const _0x250168=await withSpinner(_0x5a01a1?_0x1b2559(0x251)+_0x2212cf+_0x1b2559(0x260):_0x1b2559(0x234)+_0x2212cf+_0x1b2559(0x260),()=>_0x3dbb1b[_0x1b2559(0x235)][_0x1b2559(0x248)](_0x2212cf,_0x5ba7ca,{'dryRun':_0x5a01a1}),{'verbose':_0x2d286c[_0x1b2559(0x1b6)]}),_0x45de67=_0x250168['data'];return _0x5a01a1?console[_0x1b2559(0x23c)](_0x1b2559(0x288)+_0x45de67['outputDir']):console[_0x1b2559(0x23c)]('Project\x20backed\x20up\x20to:\x20'+_0x45de67[_0x1b2559(0x278)]),console[_0x1b2559(0x23c)](_0x1b2559(0x229)+_0x45de67[_0x1b2559(0x1b2)][_0x1b2559(0x1fa)]),console['log'](_0x1b2559(0x23d)+_0x45de67[_0x1b2559(0x1b2)]['knowledgeBases']),console['log'](_0x1b2559(0x1cf)+_0x45de67[_0x1b2559(0x1b2)][_0x1b2559(0x271)]),console[_0x1b2559(0x23c)](_0x1b2559(0x1ee)+_0x45de67[_0x1b2559(0x1b2)][_0x1b2559(0x1c2)]),(_0x2d286c[_0x1b2559(0x1fb)]===_0x1b2559(0x24f)||_0x2d286c[_0x1b2559(0x1fb)]===_0x1b2559(0x224))&&await handleSDKOutput([_0x45de67],_0x2d286c),0x0;}catch(_0xa43f09){return handleSDKError(_0xa43f09,_0x2d286c),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']='llm:project:restore';['description']=a19_0x12abb0(0x283);async[a19_0x12abb0(0x291)](_0x4ab52f){const _0x36f292=a19_0x12abb0,{options:_0x3390a2,args:_0x5b8c33,tdx:_0x526a4f}=_0x4ab52f,_0x46b0e2=getChalk(_0x3390a2);console[_0x36f292(0x23c)](_0x46b0e2[_0x36f292(0x1dd)](_0x36f292(0x28b))),console[_0x36f292(0x23c)](_0x46b0e2[_0x36f292(0x1dd)]('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console[_0x36f292(0x23c)](_0x46b0e2[_0x36f292(0x1e1)](_0x36f292(0x294))),console['log'](_0x46b0e2[_0x36f292(0x1e1)](_0x36f292(0x1b1))),console['log'](_0x46b0e2[_0x36f292(0x1e1)](_0x36f292(0x1c0))),console[_0x36f292(0x23c)]();if(_0x5b8c33[_0x36f292(0x236)]===0x0)return console[_0x36f292(0x26e)](_0x36f292(0x20a)),console[_0x36f292(0x26e)](_0x36f292(0x262)),0x1;const _0x5b70bf=_0x5b8c33[0x0],_0x3caf28=_0x3390a2,_0x15a6f1=_0x3caf28[_0x36f292(0x1ba)],_0x5d7e44=_0x3caf28[_0x36f292(0x1b7)];try{if(!_0x5d7e44){const _0x4b3895=_0x526a4f['llm'][_0x36f292(0x211)](_0x5b70bf),_0x29bfcb=_0x15a6f1||_0x4b3895[_0x36f292(0x1e2)][_0x36f292(0x23b)],_0x1f0dde=await withSpinner(_0x36f292(0x1fe),()=>_0x526a4f[_0x36f292(0x235)]['projects'](),{'verbose':_0x3390a2['verbose']}),_0x4e8b0a=_0x1f0dde['data'][_0x36f292(0x22a)](_0x5b92f3=>_0x5b92f3[_0x36f292(0x23a)]['name']===_0x29bfcb);if(_0x4e8b0a&&!_0x3390a2[_0x36f292(0x1c5)]){const _0x2077d3=await confirm(_0x36f292(0x274)+_0x29bfcb+_0x36f292(0x1f5));if(!_0x2077d3)return console[_0x36f292(0x23c)](_0x36f292(0x214)),0x0;}}const _0x74228a=await withSpinner(_0x5d7e44?'Validating\x20backup\x20from\x20\x27'+_0x5b70bf+_0x36f292(0x260):_0x36f292(0x290)+_0x5b70bf+_0x36f292(0x260),()=>_0x526a4f['llm']['restoreProject'](_0x5b70bf,{'name':_0x15a6f1,'dryRun':_0x5d7e44}),{'verbose':_0x3390a2[_0x36f292(0x1b6)]}),_0x4b43de=_0x74228a[_0x36f292(0x257)];return _0x4b43de[_0x36f292(0x1eb)]&&console['log'](_0x36f292(0x281)+_0x4b43de[_0x36f292(0x1eb)]+'\x27'),_0x5d7e44?console[_0x36f292(0x23c)](_0x36f292(0x1e5)+_0x4b43de[_0x36f292(0x23b)]):console['log'](_0x36f292(0x222)+_0x4b43de['projectName']+'\x20('+_0x4b43de[_0x36f292(0x227)]+')'),console['log'](_0x36f292(0x229)+_0x4b43de[_0x36f292(0x1b2)]['agents']),console[_0x36f292(0x23c)](_0x36f292(0x23d)+_0x4b43de[_0x36f292(0x1b2)][_0x36f292(0x1e7)]),console[_0x36f292(0x23c)]('\x20\x20Prompts:\x20'+_0x4b43de[_0x36f292(0x1b2)][_0x36f292(0x271)]),console[_0x36f292(0x23c)](_0x36f292(0x1ee)+_0x4b43de[_0x36f292(0x1b2)]['integrations']),(_0x3390a2[_0x36f292(0x1fb)]==='json'||_0x3390a2[_0x36f292(0x1fb)]==='jsonl')&&await handleSDKOutput([_0x4b43de],_0x3390a2),0x0;}catch(_0x3b3348){return handleSDKError(_0x3b3348,_0x3390a2),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0xda6c9b,_0x4b40af){const _0x4b5e2f=a19_0x12abb0,_0x1083f6=_0x4b40af[_0x4b5e2f(0x292)]||CHAT_SELECTOR_PAGE_SIZE;let _0x504218=0x0,_0x444fd1=[];const _0x22f2e2=(await import('prompts'))[_0x4b5e2f(0x272)],_0x5d7ec4=getChalk(_0x4b40af);while(!![]){const _0x47ba3f=await withSpinner(_0x4b5e2f(0x263),()=>_0xda6c9b[_0x4b5e2f(0x235)][_0x4b5e2f(0x1f3)](_0x1083f6+_0x504218),{'verbose':_0x4b40af['verbose']});_0x444fd1=_0x47ba3f[_0x4b5e2f(0x257)];const _0x485b58=_0x444fd1[_0x4b5e2f(0x1ea)](_0x504218,_0x504218+_0x1083f6),_0x2dcf53=_0x444fd1[_0x4b5e2f(0x236)]>_0x504218+_0x1083f6,_0x2ee6ec=[...new Set(_0x485b58[_0x4b5e2f(0x209)](_0x5dadfe=>_0x5dadfe[_0x4b5e2f(0x23a)][_0x4b5e2f(0x266)])[_0x4b5e2f(0x1e6)](_0x5de7f4=>_0x5de7f4!==undefined))],_0xedd479=new Map();await Promise[_0x4b5e2f(0x232)](_0x2ee6ec[_0x4b5e2f(0x209)](async _0x306f1f=>{const _0x250da2=_0x4b5e2f;try{const _0xa1a491=await _0xda6c9b[_0x250da2(0x235)][_0x250da2(0x25c)](_0x306f1f);_0xedd479[_0x250da2(0x241)](_0x306f1f,_0xa1a491[_0x250da2(0x23a)][_0x250da2(0x1ba)]);}catch{_0xedd479[_0x250da2(0x241)](_0x306f1f,_0x306f1f);}}));const _0x43e0df=_0x485b58[_0x4b5e2f(0x209)](_0x3ec8be=>{const _0x5e23f3=_0x4b5e2f,_0x378049=_0x3ec8be['attributes'][_0x5e23f3(0x1b3)]||_0x5e23f3(0x1f2),_0x7e447c=_0x378049[_0x5e23f3(0x24c)]('\x0a')[0x0],_0x42c1ad=_0x7e447c[_0x5e23f3(0x236)]>0x50?_0x7e447c[_0x5e23f3(0x276)](0x0,0x4d)+'...':_0x7e447c,_0x58b7da=_0x3ec8be[_0x5e23f3(0x23a)]['agentId']?_0xedd479[_0x5e23f3(0x28f)](_0x3ec8be['attributes'][_0x5e23f3(0x266)])||_0x3ec8be['attributes'][_0x5e23f3(0x266)]:_0x5e23f3(0x26d),_0x436226=_0x3ec8be[_0x5e23f3(0x23a)]['lastConversationAt']||_0x3ec8be[_0x5e23f3(0x23a)]['updatedAt'],_0x234bca=new Date(_0x436226),_0x5ca3c6=new Date(),_0x1f5e10=_0x5ca3c6[_0x5e23f3(0x1da)]()-_0x234bca[_0x5e23f3(0x1da)](),_0x59f776=Math[_0x5e23f3(0x1f7)](_0x1f5e10/0xea60),_0x431f15=Math['floor'](_0x1f5e10/0x36ee80),_0x3d3e17=Math[_0x5e23f3(0x1f7)](_0x1f5e10/0x5265c00);let _0x1f9e3a;if(_0x59f776<0x1)_0x1f9e3a=_0x5e23f3(0x258);else{if(_0x59f776<0x3c)_0x1f9e3a=_0x59f776+_0x5e23f3(0x295);else{if(_0x431f15<0x18)_0x1f9e3a=_0x431f15+_0x5e23f3(0x259);else _0x3d3e17<0x7?_0x1f9e3a=_0x3d3e17+_0x5e23f3(0x286):_0x1f9e3a=_0x234bca[_0x5e23f3(0x267)](_0x5e23f3(0x268),{'month':_0x5e23f3(0x1c3),'day':_0x5e23f3(0x1cc)});}}return{'title':_0x42c1ad+'\x20'+_0x5d7ec4[_0x5e23f3(0x1e1)]('['+_0x58b7da+']\x20'+_0x1f9e3a),'value':_0x3ec8be['id']};});_0x2dcf53&&_0x43e0df[_0x4b5e2f(0x254)]({'title':_0x5d7ec4[_0x4b5e2f(0x23f)](_0x4b5e2f(0x1b5)),'value':_0x4b5e2f(0x221)});const _0x3b1733=await _0x22f2e2({'type':'select','name':'chatId','message':_0x4b5e2f(0x230),'choices':_0x43e0df,'hint':_0x4b5e2f(0x27f)});if(!_0x3b1733[_0x4b5e2f(0x25e)])return undefined;if(_0x3b1733['chatId']===_0x4b5e2f(0x221)){_0x504218+=_0x1083f6;continue;}return _0x3b1733[_0x4b5e2f(0x25e)];}}export class ChatsCommand extends BaseCommand{['name']=a19_0x12abb0(0x1f3);[a19_0x12abb0(0x1f9)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a19_0x12abb0(0x291)](_0x50dadb){const _0x4a5ce0=a19_0x12abb0;return executeChatHistoryCommand(_0x50dadb,_0x4a5ce0(0x1d8));}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a20_0x347eae=a20_0x1879;(function(_0x32ff5f,_0x358f28){const _0x4fd548=a20_0x1879,_0x3d670f=_0x32ff5f();while(!![]){try{const _0x32e934=parseInt(_0x4fd548(0x110))/0x1+-parseInt(_0x4fd548(0x118))/0x2*(parseInt(_0x4fd548(0x12c))/0x3)+-parseInt(_0x4fd548(0x116))/0x4*(parseInt(_0x4fd548(0x134))/0x5)+parseInt(_0x4fd548(0x10e))/0x6*(-parseInt(_0x4fd548(0x114))/0x7)+-parseInt(_0x4fd548(0x124))/0x8*(parseInt(_0x4fd548(0x139))/0x9)+parseInt(_0x4fd548(0x13e))/0xa*(-parseInt(_0x4fd548(0x132))/0xb)+parseInt(_0x4fd548(0x127))/0xc*(parseInt(_0x4fd548(0x141))/0xd);if(_0x32e934===_0x358f28)break;else _0x3d670f['push'](_0x3d670f['shift']());}catch(_0x1ff9fd){_0x3d670f['push'](_0x3d670f['shift']());}}}(a20_0x5302,0xc52c2));import a20_0x4be02e from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a20_0x1879(_0x507f16,_0x295082){_0x507f16=_0x507f16-0x10a;const _0x530283=a20_0x5302();let _0x1879d7=_0x530283[_0x507f16];return _0x1879d7;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x2f5c3b,_0x3082c3){const _0x2b4791=a20_0x1879,{tdx:_0x238bbf,options:_0x2ab7dc}=_0x2f5c3b,_0x213b21=_0x3082c3||_0x2ab7dc[_0x2b4791(0x125)];if(_0x213b21){const _0x2db124=await _0x238bbf['llm'][_0x2b4791(0x126)](),_0x1c8393=_0x2db124[_0x2b4791(0x146)](_0x291a20=>_0x291a20[_0x2b4791(0x143)]['name']===_0x213b21);if(!_0x1c8393)throw new SDKError(ErrorCode[_0x2b4791(0x144)],_0x2b4791(0x10a)+_0x213b21+_0x2b4791(0x142),undefined,{'helpText':_0x2b4791(0x137)});return _0x1c8393['id'];}const _0x2219ce=await _0x238bbf['llm'][_0x2b4791(0x120)]();return _0x2219ce['id'];}export class LLMProxyCommand extends BaseCommand{[a20_0x347eae(0x11e)]='llm:proxy';[a20_0x347eae(0x133)]=a20_0x347eae(0x113);[a20_0x347eae(0x12d)];[a20_0x347eae(0x12f)];async[a20_0x347eae(0x12e)](_0x581895){const _0x2f1926=a20_0x347eae,{tdx:_0x3c6588,options:_0x5ba423}=_0x581895;try{const _0x2ceeab=_0x5ba423,_0x2cb123=_0x2ceeab[_0x2f1926(0x128)]||0xfa0,_0x5a3731=_0x2ceeab[_0x2f1926(0x12b)],_0xd5108b=await findAvailablePort(_0x2cb123);console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x140)](_0x2f1926(0x10f)));const _0x12a085=await getProjectIdOrDefault(_0x581895,_0x5a3731),_0x558f38=await _0x3c6588[_0x2f1926(0x13d)][_0x2f1926(0x126)](),_0x597594=_0x558f38['find'](_0x4bd938=>_0x4bd938['id']===_0x12a085);this[_0x2f1926(0x12f)]=new TDXLogger(_0x5ba423[_0x2f1926(0x10b)]),await this[_0x2f1926(0x12f)][_0x2f1926(0x11a)](),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x140)](_0x2f1926(0x11c)));_0xd5108b!==_0x2cb123&&console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x131)](_0x2f1926(0x11b)+_0x2cb123+_0x2f1926(0x112)+_0xd5108b));this['server']=new ProxyServer({'port':_0xd5108b,'projectId':_0x12a085,'tdx':_0x3c6588,'logger':this['logger'],'site':_0x5ba423[_0x2f1926(0x111)]}),await this['server']['start'](),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x131)][_0x2f1926(0x10c)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x131)](_0x2f1926(0x135))),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x131)](_0x2f1926(0x123))),console['log'](a20_0x4be02e['green'][_0x2f1926(0x10c)](_0x2f1926(0x130))),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x136)](_0x2f1926(0x117))),console[_0x2f1926(0x11f)](a20_0x4be02e['dim'](_0x2f1926(0x145)),a20_0x4be02e[_0x2f1926(0x13c)](_0x2f1926(0x119)+_0xd5108b)),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x140)]('\x20\x20Project:'),a20_0x4be02e[_0x2f1926(0x13c)](_0x597594?.[_0x2f1926(0x143)][_0x2f1926(0x11e)]||_0x12a085)),console[_0x2f1926(0x11f)](a20_0x4be02e['dim']('\x20\x20Agents:'),a20_0x4be02e[_0x2f1926(0x13c)](_0x2f1926(0x149))),console['log'](a20_0x4be02e[_0x2f1926(0x140)](_0x2f1926(0x148)),a20_0x4be02e['white'](_0x5ba423[_0x2f1926(0x111)])),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x136)]('\x0aClaude\x20Code\x20Configuration:')),console[_0x2f1926(0x11f)](a20_0x4be02e['dim'](_0x2f1926(0x13b))),console['log'](a20_0x4be02e[_0x2f1926(0x13c)]('\x20\x20{')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x13c)](_0x2f1926(0x147))),console['log'](a20_0x4be02e[_0x2f1926(0x13c)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0xd5108b+'\x22,')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x13c)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x13c)](_0x2f1926(0x10d))),console['log'](a20_0x4be02e[_0x2f1926(0x13c)](_0x2f1926(0x13f))),console[_0x2f1926(0x11f)](a20_0x4be02e['white'](_0x2f1926(0x12a))),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x136)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x140)](_0x2f1926(0x138))),console['log'](a20_0x4be02e[_0x2f1926(0x140)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x140)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x2f1926(0x11f)](a20_0x4be02e[_0x2f1926(0x131)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x4f81c3=async()=>{const _0x545dab=_0x2f1926;console[_0x545dab(0x11f)](a20_0x4be02e[_0x545dab(0x140)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x545dab(0x12d)]&&await this['server'][_0x545dab(0x122)](),this['logger']&&await this[_0x545dab(0x12f)]['close'](),console[_0x545dab(0x11f)](a20_0x4be02e[_0x545dab(0x121)](_0x545dab(0x115))),process[_0x545dab(0x129)](0x0);};return process['on']('SIGINT',_0x4f81c3),process['on'](_0x2f1926(0x11d),_0x4f81c3),await new Promise(()=>{}),0x0;}catch(_0xb2f686){this[_0x2f1926(0x12d)]&&await this[_0x2f1926(0x12d)][_0x2f1926(0x122)]();this[_0x2f1926(0x12f)]&&await this[_0x2f1926(0x12f)][_0x2f1926(0x13a)]();throw _0xb2f686;}}}function a20_0x5302(){const _0x535754=['log','getOrCreateDefaultProject','green','stop','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','8LybqgB','llmProject','projects','52582812fTeUTH','port','exit','\x20\x20}','project','3TMBzXE','server','execute','logger','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','yellow','14067548eyvhCe','description','5jFLbpz','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','cyan','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','10261827CecMvZ','close','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','white','llm','10MQjjOz','\x20\x20\x20\x20}','dim','13MSaVVv','\x27\x20not\x20found','attributes','NOT_FOUND','\x20\x20Address:','find','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20Site:','created\x20on-demand\x20per\x20model','Project\x20\x27','logLevel','bold','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','258YthuNp','Resolving\x20project...','1290437HSUBGO','site','\x20is\x20unavailable,\x20using\x20port\x20','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','219814FmcuPL','✓\x20Proxy\x20server\x20stopped','651836rnXDPD','Server\x20Configuration:','1864808zcordA','http://0.0.0.0:','init','Port\x20','Starting\x20proxy\x20server...','SIGTERM','name'];a20_0x5302=function(){return _0x535754;};return a20_0x5302();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a21_0x32d180=a21_0x5513;(function(_0x2f617f,_0x3a591b){const _0x4d9aab=a21_0x5513,_0x11d76e=_0x2f617f();while(!![]){try{const _0x1c5c35=parseInt(_0x4d9aab(0x1a0))/0x1+-parseInt(_0x4d9aab(0x19e))/0x2+parseInt(_0x4d9aab(0x173))/0x3*(parseInt(_0x4d9aab(0x1a5))/0x4)+parseInt(_0x4d9aab(0x17c))/0x5*(-parseInt(_0x4d9aab(0x15c))/0x6)+-parseInt(_0x4d9aab(0x1d4))/0x7+parseInt(_0x4d9aab(0x1e0))/0x8*(parseInt(_0x4d9aab(0x1f3))/0x9)+-parseInt(_0x4d9aab(0x257))/0xa;if(_0x1c5c35===_0x3a591b)break;else _0x11d76e['push'](_0x11d76e['shift']());}catch(_0x748cca){_0x11d76e['push'](_0x11d76e['shift']());}}}(a21_0x4dd2,0xcc855));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0x1a1201 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}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x210f78 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=a21_0x32d180(0x22a),LEGACY_PARENT_SEGMENT_DIR=a21_0x32d180(0x189);function openBrowser(_0x75a0d2){const _0x52417b=a21_0x32d180,_0xafc285=process['platform'],_0x2b85dc=_0xafc285===_0x52417b(0x1f4)?_0x52417b(0x158):_0xafc285==='win32'?_0x52417b(0x16b):_0x52417b(0x15b);spawn(_0x2b85dc,[_0x75a0d2],{'detached':!![],'stdio':_0x52417b(0x190)})[_0x52417b(0x182)]();}function a21_0x4dd2(){const _0x4ee7d8=['xdg-open','5927106XKjAMJ','\x20\x20No\x20sample\x20data\x20available','Join:','format','timezone','\x20--attribute\x20\x22<name>\x22','customersWithEvents','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','%)\x20','customerPercent','\x20--interval\x20','yellow','joinKey','output','validateParentYaml','start','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20parent\x20segment','Validating\x20configuration...','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','database','Columns:','parentSegment','1806117jFZrJY','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','join','\x20rows\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','elapsedTimeMillis','previewParentYaml','\x20Configuration\x20is\x20valid','5EietxP','addAttributes','Master\x20Table','displayValidateResults','segment:parent:preview','To\x20view\x20sample\x20data:','unref','Database:\x20','\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\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Updating','segment:parent:sql','localeCompare','parent_segment','addAttributesFile','replace','master','To\x20cancel:','column','keys','ignore','Overwrite\x20\x27','Creating\x20parent\x20segment\x20\x27','displayAttributesStats','\x0a✔\x20Workflow\x20started','Site:\x20','\x27...','label','\x20No\x20changes\x20-\x20','\x0a⚠️\x20\x20Both\x20','listParents','Show\x20parent\x20segment\x20details','pushParentYaml','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','2948664RetpNr','getParentFull','1558339YjqgNS','displayBehaviorsStats','Errors:','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','✔\x20Found\x20','4MjvpaP','displayMasterInfo','pullParentYaml','cyan','utf-8','sort','Validate:','Analyzing\x20changes...','YAML\x20file:\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','rowCount','.yaml','Fetching\x20SQL\x20for\x20\x27','Error\x20reading\x20file:\x20','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20Migrating:\x20','allValid','Master:','interval','web','Listing\x20parent\x20segments\x20matching\x20\x27','runParent','\x0aNo\x20sample\x20data\x20available','addBehaviors','schemaValid','Audience\x20ID:','.yml','toLocaleString','✔\x20Updated\x20parent\x20segment\x20\x27','message','displayPreviewHints','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','description','Join\x20on:','attributes','segment:parent:run','👥\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Error\x20parsing\x20YAML:\x20','/\x20directory.\x0a','workflowAttemptId','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','using\x20the\x20default\x20path:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','FINISHED','496636yiPqCS','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20Opening\x20','workflowSessionId','data','Name:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','stop','Created','sampleData','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Session:','10897688wfChpM','behavior','attributesFile','\x20--attribute\x20\x22','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','/app/workflows/','repeat','getParentSQL','scheduleType','segment:parent:push','jobId','setJobId','\x20=\x20','text','segment:parent:list','schemaError','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','addBehaviorsFile','trim','9oyPuHl','darwin','Executing\x20parent\x20segment\x20query...','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','green','apply','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20rows)','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','/\x20→\x20','\x27\x20and\x20run\x20workflow?','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Options:\x0a','dim','errors','segment:parent:show','bold','Output\x20file:\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','displaySummary','/{name}.yml\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','workflowId','run','table','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20[Job\x20ID:\x20','Status:','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','number','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','json','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','execute','/app/dw/parentSegments/','scheduleOption','displayPreviewResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20--enriched','length','matchedCount','displaySampleData','segment:parent:update','Options\x20(one\x20required):\x0a','columns','Parent\x20segment:\x20','jsonl','Error:\x20File\x20not\x20found:\x20','map','Updating\x20parent\x20segment\x20\x27','customerGroup','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Found\x20YAML\x20file:\x20','Aborted.','parent_segments','totalEvents','\x20field','\x20tdx\x20wf\x20attempt\x20','\x20--behavior\x20\x22<name>\x22','limit','SQL\x20query:\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:pull','all','/\x20and\x20','Coverage:','✘\x20Failed\x20to\x20rename\x20directory:\x20','in\x20','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20\x20\x20-\x20','Create\x20parent\x20segment\x20\x27','listFields','Resolving\x20parent\x20segment\x20\x27','-1d','Fetching\x20parent\x20segment\x20\x27','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Attribute:','\x27\x20is\x20already\x20up\x20to\x20date','Source:','segment:parent:validate','match','\x20kill','error','verbose','resolveParentId','Creating','test','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Enriched:','\x20parent\x20segment\x20\x27','stats','behaviors','Error:','Behavior:','Listing\x20parent\x20segments...','enriched','Error:\x20Parent\x20segment\x20name\x20is\x20required','population','Fetching\x20sample\x20data...','1517410CmIGGx','segment:parent:view','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','string','filter','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','SELECT\x20*\x20FROM\x20(\x0a','Preview:','endsWith','Attempt:','✔\x20Query\x20completed:\x20Processed\x20','attribute','yes','\x0aChanges\x20to\x20apply\x20to\x20\x27','red','log','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Apply\x20changes\x20to\x20\x27','No\x20parent\x20segments\x20found','Get\x20SQL\x20query\x20for\x20parent\x20segment','Behaviors','segment:parent:fields','query','coveragePercent','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayColumns','tdx\x20segment\x20parent\x20preview\x20','Pattern:\x20','\x27\x20is\x20up\x20to\x20date','status','\x20--behavior\x20\x22','Table:\x20','\x27\x20with\x20ID:\x20','Events:','\x20Context\x20set:\x20','audienceId','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Rows:','updateParent','`\x20to\x20download\x20the\x20configuration\x20first','name','site','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Updated','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Customers:','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','List\x20available\x20fields\x20for\x20segmentation','foreignKey','open','toFixed','/\x20directories\x20exist.'];a21_0x4dd2=function(){return _0x4ee7d8;};return a21_0x4dd2();}function migrateLegacyDirectory(){const _0x2f9e16=a21_0x32d180;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x343e4d=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x343e4d['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2f9e16(0x246)](a21_0x210f78[_0x2f9e16(0x167)](_0x2f9e16(0x199)+LEGACY_PARENT_SEGMENT_DIR+_0x2f9e16(0x234)+PARENT_SEGMENT_DIR+_0x2f9e16(0x15a))),console[_0x2f9e16(0x246)](a21_0x210f78['dim'](_0x2f9e16(0x1d2)+LEGACY_PARENT_SEGMENT_DIR+_0x2f9e16(0x1cd))),![];console[_0x2f9e16(0x246)](a21_0x210f78[_0x2f9e16(0x167)](_0x2f9e16(0x1b5)+LEGACY_PARENT_SEGMENT_DIR+_0x2f9e16(0x1fc)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2f9e16(0x246)](a21_0x210f78[_0x2f9e16(0x1f7)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2a9fb9){const _0x1284f3=_0x2a9fb9 instanceof Error?_0x2a9fb9['message']:String(_0x2a9fb9);return console[_0x2f9e16(0x246)](a21_0x210f78[_0x2f9e16(0x265)](_0x2f9e16(0x236)+_0x1284f3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x32d180(0x20a)](_0x16e9de){const _0x43d5bc=a21_0x32d180;return migrateLegacyDirectory(),super[_0x43d5bc(0x20a)](_0x16e9de);}}function resolveYamlFile(_0x3217b2){const _0xc01f77=a21_0x32d180;if(_0x3217b2[_0xc01f77(0x25f)](_0xc01f77(0x1c0))||_0x3217b2[_0xc01f77(0x25f)](_0xc01f77(0x1b0)))return _0x3217b2;return a21_0x1a1201['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3217b2)+'.yml');}function formatProgressMessage(_0x5ccc65){const _0x3fa276=a21_0x32d180,_0x18a702=_0x5ccc65[_0x3fa276(0x244)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x18a702){const [,_0x315deb,_0x49f162,_0x1be384='']=_0x18a702;return a21_0x210f78['dim'](_0x315deb+':')+'\x20'+_0x49f162+a21_0x210f78[_0x3fa276(0x200)](_0x1be384);}return a21_0x210f78[_0x3fa276(0x200)](_0x5ccc65);}function showFileNotFoundError(_0x3675a4,_0x5c4d17){const _0x31ccf8=a21_0x32d180;console[_0x31ccf8(0x246)](a21_0x210f78[_0x31ccf8(0x265)](_0x31ccf8(0x222)+_0x3675a4+'\x0a')),console[_0x31ccf8(0x246)](a21_0x210f78[_0x31ccf8(0x1a8)](_0x31ccf8(0x16c)+_0x5c4d17+_0x31ccf8(0x280)));}function showParentSegmentNotSetError(_0x467896){const _0x5b8c26=a21_0x32d180;console[_0x5b8c26(0x246)](a21_0x210f78['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x467896);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x1ee);[a21_0x32d180(0x1c6)]='List\x20parent\x20segments';async[a21_0x32d180(0x214)](_0x4829fd){const _0x248152=a21_0x32d180,{options:_0x4afd5e,args:_0x104865,tdx:_0x324b82}=_0x4829fd,_0x11c38f=_0x104865[0x0];_0x4afd5e[_0x248152(0x247)]&&(console[_0x248152(0x246)]('Site:\x20'+_0x4afd5e['site']),_0x11c38f&&console[_0x248152(0x246)](_0x248152(0x273)+_0x11c38f));const _0x379a87=await withSpinner(_0x11c38f?_0x248152(0x1ba)+_0x11c38f+_0x248152(0x196):_0x248152(0x252),()=>_0x324b82[_0x248152(0x1b3)][_0x248152(0x19a)](),{'verbose':_0x4afd5e[_0x248152(0x247)]});let _0x18e205=_0x379a87[_0x248152(0x1d8)];if(_0x11c38f){const _0x5b7468=_0x11c38f[_0x248152(0x18b)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x248152(0x18b)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3b7ce5=new RegExp('^'+_0x5b7468+'$','i');_0x18e205=_0x18e205[_0x248152(0x25b)](_0x326141=>_0x3b7ce5[_0x248152(0x24a)](_0x326141[_0x248152(0x1c8)][_0x248152(0x14f)]));}_0x18e205[_0x248152(0x1aa)]((_0x417956,_0x599e6f)=>_0x417956[_0x248152(0x1c8)][_0x248152(0x14f)][_0x248152(0x188)](_0x599e6f[_0x248152(0x1c8)][_0x248152(0x14f)])),console[_0x248152(0x246)](_0x248152(0x1a4)+_0x18e205['length']+_0x248152(0x16d)+(_0x18e205[_0x248152(0x21a)]!==0x1?'s':''));const _0x39e3b0=_0x14c8c5=>{const _0x2a5eb3=_0x248152;return getConsoleNextUrl(_0x4afd5e[_0x2a5eb3(0x150)],'/app/dw/parentSegments/'+_0x14c8c5);};if(_0x4afd5e[_0x248152(0x15f)]==='json'||_0x4afd5e[_0x248152(0x15f)]===_0x248152(0x221)){const _0x1c5a27=_0x18e205['map'](_0x32c0fc=>({..._0x32c0fc,'url':_0x39e3b0(_0x32c0fc['id'])}));await handleSDKOutput(_0x1c5a27,_0x4afd5e);}else{if(_0x18e205[_0x248152(0x21a)]===0x0)_0x11c38f?console[_0x248152(0x266)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x11c38f):console['log'](_0x248152(0x26a));else for(const _0x343ec6 of _0x18e205){const _0x16e758=_0x343ec6['attributes']['population']?a21_0x210f78[_0x248152(0x200)]('\x20('+formatRows(_0x343ec6['attributes'][_0x248152(0x255)])+')'):'',_0x3b101d=hyperlink(_0x343ec6[_0x248152(0x1c8)][_0x248152(0x14f)],_0x39e3b0(_0x343ec6['id']));console[_0x248152(0x266)](_0x248152(0x1ca)+_0x3b101d+_0x16e758);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x32d180(0x14f)]='segment:parent:create';[a21_0x32d180(0x1c6)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x3ffb3b){const _0x209c41=a21_0x32d180,{options:_0x29124d,args:_0x2ce222,tdx:_0x42aa9f}=_0x3ffb3b;console[_0x209c41(0x246)](_0x209c41(0x213)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x209c41(0x19d));const _0x54b925=_0x29124d;if(_0x2ce222['length']===0x0)return console[_0x209c41(0x246)](a21_0x210f78[_0x209c41(0x265)](_0x209c41(0x254))),console[_0x209c41(0x246)](_0x209c41(0x1da)),0x1;const _0x3434fa=_0x2ce222[0x0];if(!_0x54b925[_0x209c41(0x170)]||!_0x54b925[_0x209c41(0x20b)])return console[_0x209c41(0x246)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x209c41(0x246)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x54b925[_0x209c41(0x247)]&&(console['error']('Site:\x20'+_0x54b925[_0x209c41(0x150)]),console[_0x209c41(0x246)](_0x209c41(0x1d9)+_0x3434fa),console[_0x209c41(0x246)](_0x209c41(0x183)+_0x54b925[_0x209c41(0x170)]),console['error'](_0x209c41(0x277)+_0x54b925[_0x209c41(0x20b)]));const _0x378f42=await loadJSONFromOptions(_0x54b925[_0x209c41(0x1c8)],_0x54b925[_0x209c41(0x1e2)]),_0xc79a01=await loadJSONFromOptions(_0x54b925[_0x209c41(0x24f)],_0x54b925['behaviorsFile']),_0x5047eb=await loadJSONFromOptions(_0x54b925['customerGroup'],_0x54b925['customerGroupFile']),_0x4509e0={'name':_0x3434fa,'description':_0x54b925[_0x209c41(0x1c6)],'scheduleType':_0x54b925[_0x209c41(0x1e8)],'scheduleOption':_0x54b925[_0x209c41(0x216)],'timezone':_0x54b925[_0x209c41(0x160)],'master':{'parentDatabaseName':_0x54b925[_0x209c41(0x170)],'parentTableName':_0x54b925['table']},'attributes':_0x378f42,'behaviors':_0xc79a01,'customerGroup':_0x5047eb},_0x50d6c9=await withSpinner(_0x209c41(0x192)+_0x3434fa+_0x209c41(0x196),()=>_0x42aa9f['segment']['createParent'](_0x4509e0),{'verbose':_0x29124d[_0x209c41(0x247)]}),_0x220a75=_0x50d6c9[_0x209c41(0x1d8)];return console[_0x209c41(0x246)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x220a75[_0x209c41(0x14f)]+_0x209c41(0x278)+_0x220a75['id']),await handleSDKOutput([_0x220a75],_0x29124d),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x21d);[a21_0x32d180(0x1c6)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a21_0x32d180(0x214)](_0x3e241b){const _0x5edf24=a21_0x32d180,{options:_0x424ba3,args:_0x224e4f,tdx:_0x45709f}=_0x3e241b;console[_0x5edf24(0x246)](_0x5edf24(0x1f9)+_0x5edf24(0x153)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x385eee=_0x424ba3;if(_0x224e4f[_0x5edf24(0x21a)]===0x0)return console['error'](a21_0x210f78[_0x5edf24(0x265)](_0x5edf24(0x254))),console[_0x5edf24(0x246)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x3ab31c=_0x224e4f[0x0];_0x385eee[_0x5edf24(0x247)]&&(console[_0x5edf24(0x246)](_0x5edf24(0x195)+_0x385eee[_0x5edf24(0x150)]),console[_0x5edf24(0x246)](_0x5edf24(0x220)+_0x3ab31c));const _0x5bfae7=await withSpinner(_0x5edf24(0x238)+_0x3ab31c+_0x5edf24(0x196),()=>_0x45709f[_0x5edf24(0x1b3)][_0x5edf24(0x19f)](_0x3ab31c),{'verbose':_0x385eee[_0x5edf24(0x247)]}),_0x6c36cd=_0x5bfae7[_0x5edf24(0x1d8)],_0x5472cf=await loadJSONFromOptions(_0x385eee[_0x5edf24(0x17d)],_0x385eee[_0x5edf24(0x18a)]),_0x366011=await loadJSONFromOptions(_0x385eee[_0x5edf24(0x1bd)],_0x385eee[_0x5edf24(0x1f1)]),_0x49a825={'name':_0x6c36cd[_0x5edf24(0x14f)],'description':_0x385eee[_0x5edf24(0x1c6)]!==undefined?_0x385eee[_0x5edf24(0x1c6)]:_0x6c36cd[_0x5edf24(0x1c6)],'scheduleType':_0x385eee[_0x5edf24(0x1e8)]!==undefined?_0x385eee[_0x5edf24(0x1e8)]:_0x6c36cd[_0x5edf24(0x1e8)],'scheduleOption':_0x385eee[_0x5edf24(0x216)]!==undefined?_0x385eee['scheduleOption']:_0x6c36cd['scheduleOption'],'timezone':_0x385eee[_0x5edf24(0x160)]!==undefined?_0x385eee[_0x5edf24(0x160)]:_0x6c36cd['timezone'],'master':_0x6c36cd['master'],'attributes':_0x5472cf?[..._0x6c36cd[_0x5edf24(0x1c8)]||[],..._0x5472cf]:_0x6c36cd[_0x5edf24(0x1c8)],'behaviors':_0x366011?[..._0x6c36cd[_0x5edf24(0x24f)]||[],..._0x366011]:_0x6c36cd[_0x5edf24(0x24f)],'customerGroup':_0x6c36cd[_0x5edf24(0x225)]},_0x241ac0=await withSpinner(_0x5edf24(0x224)+_0x3ab31c+_0x5edf24(0x196),()=>_0x45709f[_0x5edf24(0x1b3)][_0x5edf24(0x27f)](_0x3ab31c,_0x49a825),{'verbose':_0x385eee['verbose']}),_0x4ec383=_0x241ac0['data'];return console['error'](_0x5edf24(0x1c2)+_0x4ec383[_0x5edf24(0x14f)]+'\x27'),await handleSDKOutput([_0x4ec383],_0x385eee),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x232);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x1a3);async[a21_0x32d180(0x214)](_0xf41879){const _0x1dea20=a21_0x32d180,{options:_0x51f428,args:_0x1ee90b,tdx:_0x2253ee}=_0xf41879,_0x5b06be=_0x51f428,_0x2231a2=_0x1ee90b[0x0]||_0x51f428[_0x1dea20(0x172)];if(!_0x2231a2)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x5b06be['use']&&_0x5b06be[_0x1dea20(0x169)])return console[_0x1dea20(0x246)](a21_0x210f78['red'](_0x1dea20(0x208))),console[_0x1dea20(0x246)](a21_0x210f78['dim'](_0x1dea20(0x1fb))),console['error'](a21_0x210f78['dim'](_0x1dea20(0x1d1)+PARENT_SEGMENT_DIR+_0x1dea20(0x207))),console[_0x1dea20(0x246)](a21_0x210f78[_0x1dea20(0x1a8)](_0x1dea20(0x259))),0x1;const _0x14af75=_0x5b06be['output']||a21_0x1a1201[_0x1dea20(0x176)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2231a2)+_0x1dea20(0x1c0));_0x5b06be[_0x1dea20(0x247)]&&(console[_0x1dea20(0x246)]('Site:\x20'+_0x5b06be[_0x1dea20(0x150)]),console[_0x1dea20(0x246)](_0x1dea20(0x220)+_0x2231a2),console['error'](_0x1dea20(0x204)+_0x14af75));const _0x57dd4f=await withSpinner(_0x1dea20(0x23e)+_0x2231a2+_0x1dea20(0x196),()=>_0x2253ee[_0x1dea20(0x1b3)][_0x1dea20(0x1a7)](_0x2231a2),{'verbose':_0x5b06be[_0x1dea20(0x247)]}),_0x24271d=_0x57dd4f[_0x1dea20(0x1d8)];if(existsSync(_0x14af75)){const _0x37b4f5=readFileSync(_0x14af75,'utf-8'),_0x56cb2c=generateDiff(_0x37b4f5,_0x24271d);if(!hasChanges(_0x56cb2c))console[_0x1dea20(0x246)](a21_0x210f78[_0x1dea20(0x1f7)]('✔')+_0x1dea20(0x198)+a21_0x210f78[_0x1dea20(0x1a8)](_0x14af75)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x1dea20(0x246)]('\x0aChanges\x20to\x20\x27'+_0x14af75+'\x27:'),console[_0x1dea20(0x246)]('─'[_0x1dea20(0x1e6)](0x3c)),console['error'](formatDiffWithColors(_0x56cb2c)),console[_0x1dea20(0x246)]('─'['repeat'](0x3c));if(!_0x5b06be[_0x1dea20(0x263)]){const _0x58c714=await confirmKey(_0x1dea20(0x191)+_0x14af75+'\x27?');if(!_0x58c714)return console[_0x1dea20(0x246)](_0x1dea20(0x229)),0x1;}writeFileSync(_0x14af75,_0x24271d,_0x1dea20(0x1a9)),console[_0x1dea20(0x246)](a21_0x210f78[_0x1dea20(0x1f7)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a21_0x210f78[_0x1dea20(0x1a8)](_0x14af75));}}else{const _0x55dcfa=a21_0x1a1201['dirname'](_0x14af75);!existsSync(_0x55dcfa)&&mkdirSync(_0x55dcfa,{'recursive':!![]}),writeFileSync(_0x14af75,_0x24271d,'utf-8'),console['error'](a21_0x210f78[_0x1dea20(0x1f7)]('✔')+_0x1dea20(0x1f0)+a21_0x210f78[_0x1dea20(0x1a8)](_0x14af75));}return saveSessionContext({'parent_segment':_0x2231a2},_0x5b06be['session']),console[_0x1dea20(0x246)](a21_0x210f78[_0x1dea20(0x1f7)]('✔')+_0x1dea20(0x27a)+a21_0x210f78[_0x1dea20(0x200)]('parent_segment')+_0x1dea20(0x1ec)+a21_0x210f78['cyan'](_0x2231a2)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x1e9);['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a21_0x32d180(0x214)](_0x5c9e9f){const _0x42ee47=a21_0x32d180,{options:_0x248f9f,args:_0x475ed4,tdx:_0x478f48}=_0x5c9e9f,_0x1cc2bb=_0x248f9f,_0x5a41a9=_0x475ed4[0x0]||_0x248f9f[_0x42ee47(0x172)];if(!_0x5a41a9)return showParentSegmentNotSetError(_0x42ee47(0x1e4)+_0x42ee47(0x178)),0x1;const _0x2b9664=resolveYamlFile(_0x5a41a9);if(!existsSync(_0x2b9664))return showFileNotFoundError(_0x2b9664,_0x5a41a9),0x1;_0x1cc2bb[_0x42ee47(0x247)]&&(console[_0x42ee47(0x246)](_0x42ee47(0x195)+_0x1cc2bb[_0x42ee47(0x150)]),console[_0x42ee47(0x246)](_0x42ee47(0x1ad)+_0x2b9664));let _0x2fe919;try{_0x2fe919=readFileSync(_0x2b9664,_0x42ee47(0x1a9));}catch(_0x28bf2d){const _0x26e8a4=_0x28bf2d instanceof Error?_0x28bf2d['message']:String(_0x28bf2d);return console['error'](_0x42ee47(0x1b2)+_0x26e8a4),0x1;}const _0x572b40=await withSpinner('Analyzing\x20changes...',()=>_0x478f48[_0x42ee47(0x1b3)]['pushParentYaml'](_0x2fe919),{'verbose':_0x1cc2bb[_0x42ee47(0x247)]}),_0x1da42d=_0x572b40[_0x42ee47(0x1d8)],{isNew:_0xb71652,name:_0x345246,hasChanges:_0xda5088,diffFormatted:_0x31053b}=_0x1da42d;if(!_0xda5088)return console[_0x42ee47(0x246)]('✔\x20No\x20changes\x20-\x20\x27'+_0x345246+_0x42ee47(0x241)),0x0;_0xb71652?console[_0x42ee47(0x246)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x345246+'\x27:'):console[_0x42ee47(0x246)](_0x42ee47(0x264)+_0x345246+'\x27:');console['error']('─'[_0x42ee47(0x1e6)](0x3c)),console['error'](_0x31053b),console[_0x42ee47(0x246)]('─'['repeat'](0x3c));const _0x50d5e=_0xb71652?_0x42ee47(0x23a)+_0x345246+'\x27?':_0x42ee47(0x269)+_0x345246+'\x27?';if(!_0x1cc2bb[_0x42ee47(0x263)]){const _0x15eebe=await confirmKey(_0x50d5e);if(!_0x15eebe)return console[_0x42ee47(0x246)](_0x42ee47(0x229)),0x1;}const _0x2e6e86=_0xb71652?'Creating':_0x42ee47(0x186),_0x2522f4=await withSpinner(_0x2e6e86+_0x42ee47(0x24d)+_0x345246+_0x42ee47(0x196),()=>_0x1da42d[_0x42ee47(0x1f8)](),{'verbose':_0x1cc2bb[_0x42ee47(0x247)]}),_0x40fb9b=_0x2522f4[_0x42ee47(0x1d8)],_0x514137=getConsoleNextUrl(_0x1cc2bb[_0x42ee47(0x150)],_0x42ee47(0x215)+_0x40fb9b['id']),_0x5ac9eb=_0xb71652?_0x42ee47(0x1dc):_0x42ee47(0x152);return console[_0x42ee47(0x246)]('✔\x20'+_0x5ac9eb+'\x20parent\x20segment\x20\x27'+_0x40fb9b[_0x42ee47(0x14f)]+'\x27'),console[_0x42ee47(0x246)]('\x20\x20'+_0x514137),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x243);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x270);async[a21_0x32d180(0x214)](_0x333238){const _0x5b3681=a21_0x32d180,{options:_0xb3ef54,args:_0x3900bc,tdx:_0x38b68}=_0x333238,_0x3f4bed=_0xb3ef54,_0x5b7a9c=_0x3900bc[0x0]||_0xb3ef54[_0x5b3681(0x172)];if(!_0x5b7a9c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x5b3681(0x174)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x5b3681(0x1d0)),0x1;const _0x5bc0d4=resolveYamlFile(_0x5b7a9c);if(!existsSync(_0x5bc0d4))return showFileNotFoundError(_0x5bc0d4,_0x5b7a9c),0x1;_0x3f4bed[_0x5b3681(0x247)]&&(console[_0x5b3681(0x246)](_0x5b3681(0x195)+_0x3f4bed[_0x5b3681(0x150)]),console[_0x5b3681(0x246)](_0x5b3681(0x1ad)+_0x5bc0d4));let _0x129b93;try{_0x129b93=readFileSync(_0x5bc0d4,'utf-8');}catch(_0x4ccc95){const _0x14b2c9=_0x4ccc95 instanceof Error?_0x4ccc95[_0x5b3681(0x1c3)]:String(_0x4ccc95);return console['error'](_0x5b3681(0x1b2)+_0x14b2c9),0x1;}const _0x185ec5=createCommandSpinner(a21_0x210f78['dim'](_0x5b3681(0x16e)),{'verbose':_0x3f4bed[_0x5b3681(0x247)]});_0x185ec5[_0x5b3681(0x16b)]();const _0xdf07a1={'onProgress':_0x24ac5f=>{const _0x4cd73c=_0x5b3681;_0x185ec5[_0x4cd73c(0x1ed)]=formatProgressMessage(_0x24ac5f);}};if(_0x3f4bed[_0x5b3681(0x18c)])_0xdf07a1['master']=!![];if(_0x3f4bed['enriched'])_0xdf07a1[_0x5b3681(0x253)]=!![];_0x3f4bed[_0x5b3681(0x262)]&&(_0xdf07a1[_0x5b3681(0x262)]=_0x3f4bed[_0x5b3681(0x262)]);_0x3f4bed[_0x5b3681(0x1e1)]&&(_0xdf07a1[_0x5b3681(0x1e1)]=_0x3f4bed['behavior']);if(_0x3f4bed[_0x5b3681(0x1b8)])_0xdf07a1[_0x5b3681(0x1b8)]=_0x3f4bed[_0x5b3681(0x1b8)];let _0x334682;try{_0x334682=await _0x38b68[_0x5b3681(0x1b3)][_0x5b3681(0x16a)](_0x129b93,_0xdf07a1),_0x185ec5[_0x5b3681(0x1db)]();}catch(_0x1f7c3d){_0x185ec5['stop']();throw _0x1f7c3d;}const _0x35ea6b=_0x3f4bed[_0x5b3681(0x1b8)]||_0x5b3681(0x23d);return this[_0x5b3681(0x17f)](_0x334682,_0xdf07a1,_0x5bc0d4,_0x35ea6b),_0x334682[_0x5b3681(0x1b6)]?0x0:0x1;}['displayValidateResults'](_0x98e0f1,_0x441d09,_0x207c48,_0x328a68){const _0x4322d0=a21_0x32d180;console[_0x4322d0(0x246)]('\x0a'+a21_0x210f78['bold'](_0x4322d0(0x1ab))+'\x20'+_0x98e0f1[_0x4322d0(0x14f)]),console[_0x4322d0(0x246)]('═'[_0x4322d0(0x1e6)](0x3c)),this[_0x4322d0(0x1a6)](_0x98e0f1);if(typeof _0x441d09['attribute']===_0x4322d0(0x25a)){this[_0x4322d0(0x193)](_0x98e0f1),this['displaySummary'](_0x98e0f1),this[_0x4322d0(0x1c4)](_0x207c48,_0x328a68,_0x4322d0(0x262),_0x441d09[_0x4322d0(0x262)]);return;}if(_0x441d09[_0x4322d0(0x262)]===!![]){this[_0x4322d0(0x193)](_0x98e0f1),this[_0x4322d0(0x206)](_0x98e0f1),this[_0x4322d0(0x1c4)](_0x207c48,_0x328a68,_0x4322d0(0x1c8));return;}if(typeof _0x441d09[_0x4322d0(0x1e1)]==='string'){this[_0x4322d0(0x1a1)](_0x98e0f1,_0x328a68),this[_0x4322d0(0x206)](_0x98e0f1),this[_0x4322d0(0x1c4)](_0x207c48,_0x328a68,_0x4322d0(0x1e1),_0x441d09['behavior']);return;}if(_0x441d09[_0x4322d0(0x1e1)]===!![]){this[_0x4322d0(0x1a1)](_0x98e0f1,_0x328a68),this[_0x4322d0(0x206)](_0x98e0f1),this[_0x4322d0(0x1c4)](_0x207c48,_0x328a68,_0x4322d0(0x24f));return;}this[_0x4322d0(0x193)](_0x98e0f1),this[_0x4322d0(0x1a1)](_0x98e0f1,_0x328a68),this['displaySummary'](_0x98e0f1),this[_0x4322d0(0x1c4)](_0x207c48,_0x328a68,'all');}[a21_0x32d180(0x1c4)](_0x40c9c2,_0x3edf65,_0x5013e1,_0x1e93a9){const _0x5ee44a=a21_0x32d180;console[_0x5ee44a(0x246)]('\x0a'+a21_0x210f78[_0x5ee44a(0x200)](_0x5ee44a(0x181)));const _0x578bed=_0x3edf65!==_0x5ee44a(0x23d)?_0x5ee44a(0x166)+_0x3edf65:'';if(_0x5013e1===_0x5ee44a(0x262)&&_0x1e93a9)console['error']('\x20\x20'+a21_0x210f78[_0x5ee44a(0x200)]('tdx\x20segment\x20parent\x20preview\x20'+_0x40c9c2+_0x5ee44a(0x1e3)+_0x1e93a9+'\x22'+_0x578bed));else{if(_0x5013e1==='behavior'&&_0x1e93a9)console[_0x5ee44a(0x246)]('\x20\x20'+a21_0x210f78[_0x5ee44a(0x200)](_0x5ee44a(0x272)+_0x40c9c2+'\x20--behavior\x20\x22'+_0x1e93a9+'\x22'+_0x578bed));else(_0x5013e1===_0x5ee44a(0x1c8)||_0x5013e1===_0x5ee44a(0x233))&&console[_0x5ee44a(0x246)]('\x20\x20'+a21_0x210f78['dim'](_0x5ee44a(0x272)+_0x40c9c2+_0x5ee44a(0x161)+_0x578bed));}(_0x5013e1==='behaviors'||_0x5013e1===_0x5ee44a(0x233))&&console['error']('\x20\x20'+a21_0x210f78[_0x5ee44a(0x200)](_0x5ee44a(0x272)+_0x40c9c2+_0x5ee44a(0x22e)+_0x578bed)),_0x5013e1==='all'&&console['error']('\x20\x20'+a21_0x210f78[_0x5ee44a(0x200)](_0x5ee44a(0x272)+_0x40c9c2+_0x5ee44a(0x219)+_0x578bed));}[a21_0x32d180(0x1a6)](_0x2f13b7){const _0x111991=a21_0x32d180,{master:_0xaa0e8d}=_0x2f13b7,_0x138d4a=_0xaa0e8d['schemaValid']?a21_0x210f78[_0x111991(0x1f7)]('✔'):a21_0x210f78[_0x111991(0x265)]('✘');console['error']('\x0a'+a21_0x210f78[_0x111991(0x200)](_0x111991(0x17e))),console[_0x111991(0x246)](_0x138d4a+'\x20'+a21_0x210f78[_0x111991(0x203)](_0xaa0e8d[_0x111991(0x170)]+'.'+_0xaa0e8d['table'])),_0xaa0e8d['schemaValid']?_0xaa0e8d[_0x111991(0x1af)]!==undefined&&console[_0x111991(0x246)]('\x20\x20'+a21_0x210f78[_0x111991(0x200)](_0x111991(0x27e))+'\x20'+a21_0x210f78['cyan'](formatRows(_0xaa0e8d[_0x111991(0x1af)]))):console['error']('\x20\x20'+a21_0x210f78['red']('Error:')+'\x20'+_0xaa0e8d[_0x111991(0x1ef)]);}['displayAttributesStats'](_0x5a466e){const _0x1a5cb4=a21_0x32d180;if(_0x5a466e[_0x1a5cb4(0x1c8)]['length']===0x0)return;console['error']('\x0a'+a21_0x210f78['dim']('Attributes'));for(const _0x130d79 of _0x5a466e[_0x1a5cb4(0x1c8)]){const _0x23f59d=_0x130d79[_0x1a5cb4(0x1be)]?a21_0x210f78[_0x1a5cb4(0x1f7)]('✔'):a21_0x210f78[_0x1a5cb4(0x265)]('✘');let _0x167a93='';if(_0x130d79['schemaValid']&&_0x130d79['matchedCount']!==undefined&&_0x130d79['coveragePercent']!==undefined){const _0x377e40=_0x130d79[_0x1a5cb4(0x26f)][_0x1a5cb4(0x159)](0x1),_0x42ae33=_0x130d79[_0x1a5cb4(0x26f)]>=0x50?a21_0x210f78[_0x1a5cb4(0x1f7)]:_0x130d79[_0x1a5cb4(0x26f)]>=0x32?a21_0x210f78[_0x1a5cb4(0x167)]:a21_0x210f78[_0x1a5cb4(0x265)];_0x167a93='\x20'+a21_0x210f78[_0x1a5cb4(0x200)](_0x1a5cb4(0x235))+'\x20'+_0x42ae33(_0x377e40+'%')+'\x20('+formatRows(_0x130d79[_0x1a5cb4(0x21b)])+_0x1a5cb4(0x1fa);}console[_0x1a5cb4(0x246)](_0x23f59d+'\x20'+a21_0x210f78['bold'](_0x130d79[_0x1a5cb4(0x14f)])+_0x167a93),console[_0x1a5cb4(0x246)]('\x20\x20'+a21_0x210f78['dim'](_0x1a5cb4(0x242))+'\x20'+a21_0x210f78['bold'](_0x130d79[_0x1a5cb4(0x170)]+'.'+_0x130d79['table']));const _0x352ff5=_0x130d79[_0x1a5cb4(0x168)]===_0x130d79[_0x1a5cb4(0x157)]?a21_0x210f78[_0x1a5cb4(0x200)]('Join\x20on:')+'\x20'+_0x130d79[_0x1a5cb4(0x168)]:a21_0x210f78[_0x1a5cb4(0x200)](_0x1a5cb4(0x15e))+'\x20'+_0x130d79['joinKey']+_0x1a5cb4(0x1ec)+_0x130d79['foreignKey'];console[_0x1a5cb4(0x246)]('\x20\x20'+_0x352ff5),console['error']('\x20\x20'+a21_0x210f78[_0x1a5cb4(0x200)](_0x1a5cb4(0x171))),this[_0x1a5cb4(0x271)](_0x130d79[_0x1a5cb4(0x21f)]),!_0x130d79[_0x1a5cb4(0x1be)]&&console[_0x1a5cb4(0x246)]('\x20\x20'+a21_0x210f78[_0x1a5cb4(0x265)](_0x1a5cb4(0x250))+'\x20'+_0x130d79['schemaError']);}}['displayBehaviorsStats'](_0x302ead,_0x205d9e){const _0x1776d8=a21_0x32d180;if(_0x302ead[_0x1776d8(0x24f)]['length']===0x0)return;console['error']('\x0a'+a21_0x210f78[_0x1776d8(0x200)](_0x1776d8(0x26c))+'\x20'+a21_0x210f78['dim']('('+_0x205d9e+')'));for(const _0x299455 of _0x302ead[_0x1776d8(0x24f)]){const _0x370526=_0x299455['schemaValid']?a21_0x210f78[_0x1776d8(0x1f7)]('✔'):a21_0x210f78['red']('✘');let _0x591d9d='';if(_0x299455['schemaValid']&&_0x299455[_0x1776d8(0x162)]!==undefined&&_0x299455['totalEvents']!==undefined){const _0xa14a54=_0x299455[_0x1776d8(0x165)]?.['toFixed'](0x1)||'?',_0x567fca=(_0x299455[_0x1776d8(0x165)]??0x0)>=0x32?a21_0x210f78[_0x1776d8(0x1f7)]:(_0x299455[_0x1776d8(0x165)]??0x0)>=0x14?a21_0x210f78[_0x1776d8(0x167)]:a21_0x210f78[_0x1776d8(0x265)];_0x591d9d='\x20'+a21_0x210f78[_0x1776d8(0x200)](_0x1776d8(0x154))+'\x20'+_0x567fca(formatRows(_0x299455['customersWithEvents']))+'\x20('+_0xa14a54+_0x1776d8(0x164)+a21_0x210f78[_0x1776d8(0x200)](_0x1776d8(0x279))+'\x20'+a21_0x210f78[_0x1776d8(0x1a8)](formatRows(_0x299455[_0x1776d8(0x22b)]));}console[_0x1776d8(0x246)](_0x370526+'\x20'+a21_0x210f78['bold'](_0x299455['name'])+_0x591d9d),console[_0x1776d8(0x246)]('\x20\x20'+a21_0x210f78['dim']('Source:')+'\x20'+a21_0x210f78['bold'](_0x299455[_0x1776d8(0x170)]+'.'+_0x299455[_0x1776d8(0x20b)]));const _0x2bfc53=_0x299455[_0x1776d8(0x168)]===_0x299455['foreignKey']?a21_0x210f78[_0x1776d8(0x200)](_0x1776d8(0x1c7))+'\x20'+_0x299455[_0x1776d8(0x168)]:a21_0x210f78[_0x1776d8(0x200)](_0x1776d8(0x15e))+'\x20'+_0x299455['joinKey']+_0x1776d8(0x1ec)+_0x299455['foreignKey'];console[_0x1776d8(0x246)]('\x20\x20'+_0x2bfc53),console['error']('\x20\x20'+a21_0x210f78[_0x1776d8(0x200)](_0x1776d8(0x171))),this[_0x1776d8(0x271)](_0x299455[_0x1776d8(0x21f)]),!_0x299455[_0x1776d8(0x1be)]&&console[_0x1776d8(0x246)]('\x20\x20'+a21_0x210f78['red']('Error:')+'\x20'+_0x299455[_0x1776d8(0x1ef)]);}}[a21_0x32d180(0x271)](_0x5240e1){const _0x208986=a21_0x32d180;for(const _0x1262fe of _0x5240e1){_0x1262fe[_0x208986(0x197)]===_0x1262fe[_0x208986(0x18e)]||_0x1262fe['column']==='*'?console['error'](_0x208986(0x239)+_0x1262fe[_0x208986(0x197)]):console['error'](_0x208986(0x239)+_0x1262fe[_0x208986(0x197)]+'\x20'+a21_0x210f78['dim']('('+_0x1262fe['column']+')'));}}['displaySummary'](_0x3ef31f){const _0x46ea43=a21_0x32d180;console['error']('─'[_0x46ea43(0x1e6)](0x3c));if(_0x3ef31f[_0x46ea43(0x201)][_0x46ea43(0x21a)]>0x0){console[_0x46ea43(0x246)]('\x0a'+a21_0x210f78[_0x46ea43(0x265)](_0x46ea43(0x1a2)));for(const _0xdc529a of _0x3ef31f['errors']){console[_0x46ea43(0x246)]('\x20\x20'+a21_0x210f78[_0x46ea43(0x265)]('•')+'\x20'+_0xdc529a);}}_0x3ef31f[_0x46ea43(0x1b6)]&&console[_0x46ea43(0x246)]('\x0a'+a21_0x210f78[_0x46ea43(0x1f7)]('✔')+_0x46ea43(0x17b));}}function a21_0x5513(_0x229721,_0x22e398){_0x229721=_0x229721-0x14f;const _0x4dd24e=a21_0x4dd2();let _0x55136a=_0x4dd24e[_0x229721];return _0x55136a;}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x180);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x1f6);async['execute'](_0x4f2979){const _0x11a7f8=a21_0x32d180,{options:_0x427af4,args:_0x544fc0,tdx:_0x18ee1f}=_0x4f2979,_0x38a194=_0x427af4,_0x1dc361=_0x544fc0[0x0]||_0x427af4['parentSegment'];if(!_0x1dc361)return showParentSegmentNotSetError(_0x11a7f8(0x205)+_0x11a7f8(0x20c)+_0x11a7f8(0x21e)+_0x11a7f8(0x226)+_0x11a7f8(0x268)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x11a7f8(0x23f)+_0x11a7f8(0x1d0)),0x1;if(!_0x38a194[_0x11a7f8(0x18c)]&&!_0x38a194['attribute']&&!_0x38a194['behavior']&&!_0x38a194[_0x11a7f8(0x253)])return console['error'](a21_0x210f78[_0x11a7f8(0x265)](_0x11a7f8(0x175))),console[_0x11a7f8(0x246)](_0x11a7f8(0x227)),console[_0x11a7f8(0x246)]('Options:'),console[_0x11a7f8(0x246)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x11a7f8(0x246)](_0x11a7f8(0x1cf)),console['error'](_0x11a7f8(0x163)),console[_0x11a7f8(0x246)](_0x11a7f8(0x24b)),0x1;const _0x18c0ec=resolveYamlFile(_0x1dc361);if(!existsSync(_0x18c0ec))return showFileNotFoundError(_0x18c0ec,_0x1dc361),0x1;_0x38a194['verbose']&&(console['error']('Site:\x20'+_0x38a194[_0x11a7f8(0x150)]),console['error'](_0x11a7f8(0x1ad)+_0x18c0ec));let _0x4520be;try{_0x4520be=readFileSync(_0x18c0ec,_0x11a7f8(0x1a9));}catch(_0x4efc20){const _0x141597=_0x4efc20 instanceof Error?_0x4efc20[_0x11a7f8(0x1c3)]:String(_0x4efc20);return console[_0x11a7f8(0x246)]('Error\x20reading\x20file:\x20'+_0x141597),0x1;}let _0x45e0aa;try{_0x45e0aa=parseDef(_0x4520be);}catch(_0xcf74de){const _0x142328=_0xcf74de instanceof Error?_0xcf74de[_0x11a7f8(0x1c3)]:String(_0xcf74de);return console[_0x11a7f8(0x246)](a21_0x210f78[_0x11a7f8(0x265)](_0x11a7f8(0x1cc)+_0x142328)),0x1;}if(_0x38a194['attribute']===!![]||_0x38a194['attribute']===''){const _0x85d16=_0x45e0aa['attributes']?.[_0x11a7f8(0x223)](_0x4beff4=>_0x4beff4['name'])||[];if(_0x85d16[_0x11a7f8(0x21a)]===0x0)console[_0x11a7f8(0x246)](a21_0x210f78[_0x11a7f8(0x265)](_0x11a7f8(0x27c)));else{console[_0x11a7f8(0x246)](a21_0x210f78[_0x11a7f8(0x265)](_0x11a7f8(0x1ae))),console[_0x11a7f8(0x246)]('Available\x20attributes:');for(const _0x2a3437 of _0x85d16){console[_0x11a7f8(0x246)]('\x20\x20'+a21_0x210f78[_0x11a7f8(0x1a8)](_0x2a3437));}console[_0x11a7f8(0x246)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x1dc361+_0x11a7f8(0x1e3)+_0x85d16[0x0]+'\x22');}return 0x1;}if(_0x38a194[_0x11a7f8(0x1e1)]===!![]||_0x38a194['behavior']===''){const _0x4488ec=_0x45e0aa['behaviors']?.[_0x11a7f8(0x223)](_0x312e0e=>_0x312e0e[_0x11a7f8(0x14f)])||[];if(_0x4488ec['length']===0x0)console[_0x11a7f8(0x246)](a21_0x210f78['red'](_0x11a7f8(0x25c)));else{console[_0x11a7f8(0x246)](a21_0x210f78[_0x11a7f8(0x265)](_0x11a7f8(0x27d))),console[_0x11a7f8(0x246)]('Available\x20behaviors:');for(const _0xffa44f of _0x4488ec){console['error']('\x20\x20'+a21_0x210f78[_0x11a7f8(0x1a8)](_0xffa44f));}console[_0x11a7f8(0x246)](_0x11a7f8(0x1cb)+_0x1dc361+_0x11a7f8(0x276)+_0x4488ec[0x0]+'\x22');}return 0x1;}const _0x175c0f=createCommandSpinner(a21_0x210f78[_0x11a7f8(0x200)](_0x11a7f8(0x256)),{'verbose':_0x38a194[_0x11a7f8(0x247)]});_0x175c0f[_0x11a7f8(0x16b)]();const _0x4a7cf4={'onProgress':_0x7d1f0b=>{const _0x174421=_0x11a7f8;_0x175c0f[_0x174421(0x1ed)]=formatProgressMessage(_0x7d1f0b);}};if(_0x38a194[_0x11a7f8(0x18c)])_0x4a7cf4['master']=!![];if(_0x38a194[_0x11a7f8(0x262)]&&typeof _0x38a194[_0x11a7f8(0x262)]===_0x11a7f8(0x25a))_0x4a7cf4[_0x11a7f8(0x262)]=_0x38a194[_0x11a7f8(0x262)];if(_0x38a194['behavior']&&typeof _0x38a194[_0x11a7f8(0x1e1)]===_0x11a7f8(0x25a))_0x4a7cf4[_0x11a7f8(0x1e1)]=_0x38a194[_0x11a7f8(0x1e1)];if(_0x38a194[_0x11a7f8(0x253)])_0x4a7cf4['enriched']=!![];if(_0x38a194[_0x11a7f8(0x1b8)])_0x4a7cf4[_0x11a7f8(0x1b8)]=_0x38a194[_0x11a7f8(0x1b8)];let _0x260fef;try{_0x260fef=await _0x18ee1f['segment'][_0x11a7f8(0x17a)](_0x4520be,_0x4a7cf4),_0x175c0f['stop']();}catch(_0x12fe7a){_0x175c0f[_0x11a7f8(0x1db)]();throw _0x12fe7a;}return await this['displayPreviewResults'](_0x260fef,{'master':_0x38a194[_0x11a7f8(0x18c)],'attribute':typeof _0x38a194[_0x11a7f8(0x262)]===_0x11a7f8(0x25a)?_0x38a194[_0x11a7f8(0x262)]:undefined,'behavior':typeof _0x38a194[_0x11a7f8(0x1e1)]===_0x11a7f8(0x25a)?_0x38a194['behavior']:undefined,'enriched':_0x38a194[_0x11a7f8(0x253)]}),_0x260fef[_0x11a7f8(0x1b6)]?0x0:0x1;}async[a21_0x32d180(0x217)](_0x34ea26,_0x74c2c0){const _0x2411ff=a21_0x32d180;console[_0x2411ff(0x246)]('\x0a'+a21_0x210f78['bold'](_0x2411ff(0x25e))+'\x20'+_0x34ea26[_0x2411ff(0x14f)]),console['error']('═'[_0x2411ff(0x1e6)](0x3c));if(_0x74c2c0['master']&&_0x34ea26[_0x2411ff(0x1dd)]){const _0x5a245b=a21_0x210f78[_0x2411ff(0x200)](_0x2411ff(0x1b7))+'\x20'+a21_0x210f78[_0x2411ff(0x203)](_0x34ea26[_0x2411ff(0x18c)]['database']+'.'+_0x34ea26[_0x2411ff(0x18c)][_0x2411ff(0x20b)]);await this[_0x2411ff(0x21c)](_0x5a245b,_0x34ea26['sampleData']);}else{if(_0x74c2c0[_0x2411ff(0x262)]&&_0x34ea26['sampleData']){const _0x1ebbbe=a21_0x210f78[_0x2411ff(0x200)](_0x2411ff(0x240))+'\x20'+a21_0x210f78[_0x2411ff(0x203)](_0x74c2c0[_0x2411ff(0x262)]);await this[_0x2411ff(0x21c)](_0x1ebbbe,_0x34ea26['sampleData']);}else{if(_0x74c2c0[_0x2411ff(0x1e1)]&&_0x34ea26[_0x2411ff(0x1dd)]){const _0xbf4047=a21_0x210f78[_0x2411ff(0x200)](_0x2411ff(0x251))+'\x20'+a21_0x210f78[_0x2411ff(0x203)](_0x74c2c0['behavior']);await this[_0x2411ff(0x21c)](_0xbf4047,_0x34ea26[_0x2411ff(0x1dd)]);}else{if(_0x74c2c0[_0x2411ff(0x253)]&&_0x34ea26[_0x2411ff(0x1dd)]){const _0x3f40d0=a21_0x210f78[_0x2411ff(0x200)](_0x2411ff(0x24c))+'\x20'+a21_0x210f78[_0x2411ff(0x203)]('Master\x20+\x20Attributes');await this[_0x2411ff(0x21c)](_0x3f40d0,_0x34ea26[_0x2411ff(0x1dd)]);}else!_0x34ea26[_0x2411ff(0x1dd)]&&console[_0x2411ff(0x246)](_0x2411ff(0x1bc));}}}if(_0x34ea26['errors'][_0x2411ff(0x21a)]>0x0){console['error']('─'[_0x2411ff(0x1e6)](0x3c)),console[_0x2411ff(0x246)]('\x0a'+a21_0x210f78[_0x2411ff(0x265)](_0x2411ff(0x1a2)));for(const _0x228401 of _0x34ea26[_0x2411ff(0x201)]){console[_0x2411ff(0x246)]('\x20\x20'+a21_0x210f78[_0x2411ff(0x265)]('•')+'\x20'+_0x228401);}}}async['displaySampleData'](_0x7c0c96,_0x3f6649){const _0x3779e5=a21_0x32d180;if(_0x3f6649[_0x3779e5(0x21a)]===0x0){console[_0x3779e5(0x246)]('\x0a'+_0x7c0c96),console[_0x3779e5(0x246)](_0x3779e5(0x15d));return;}console[_0x3779e5(0x246)]('\x0a'+_0x7c0c96);const _0x1ff4d1=Object[_0x3779e5(0x18f)](_0x3f6649[0x0])['map'](_0x1ead42=>({'name':_0x1ead42,'type':typeof _0x3f6649[0x0][_0x1ead42]===_0x3779e5(0x210)?'double':'varchar'})),_0x2db632={'queryId':'preview','columns':_0x1ff4d1,'data':_0x3f6649,'stats':{'state':_0x3779e5(0x1d3),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3f6649[_0x3779e5(0x21a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x28a915=formatAsTable(_0x2db632,_0x3f6649[_0x3779e5(0x21a)],!![]);await writeOutput(_0x28a915,undefined,_0x3779e5(0x20b));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a21_0x32d180(0x1c9);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x1fe);async[a21_0x32d180(0x214)](_0x452afa){const _0x1e4206=a21_0x32d180,{options:_0x584411,args:_0x13bc5c,tdx:_0xe1360}=_0x452afa,_0x4e1306=_0x584411,_0x4ebb86=_0x13bc5c[0x0]||_0x584411['parentSegment'];if(!_0x4ebb86)return showParentSegmentNotSetError(_0x1e4206(0x20f)+_0x1e4206(0x151)),0x1;const _0x21e09e=resolveYamlFile(_0x4ebb86);if(existsSync(_0x21e09e)){_0x4e1306[_0x1e4206(0x247)]&&console[_0x1e4206(0x246)](_0x1e4206(0x228)+_0x21e09e);let _0x516590;try{_0x516590=readFileSync(_0x21e09e,_0x1e4206(0x1a9));}catch(_0x251acb){const _0x479ba6=_0x251acb instanceof Error?_0x251acb[_0x1e4206(0x1c3)]:String(_0x251acb);return console['error'](_0x1e4206(0x1b2)+_0x479ba6),0x1;}const _0x3a4dc7=await withSpinner(_0x1e4206(0x1ac),()=>_0xe1360[_0x1e4206(0x1b3)][_0x1e4206(0x19c)](_0x516590),{'verbose':_0x4e1306['verbose']}),_0x5702c9=_0x3a4dc7['data'],{isNew:_0x2e26b3,name:_0x183e1e,hasChanges:_0x507177,diffFormatted:_0x22028a}=_0x5702c9;if(_0x507177){_0x2e26b3?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x183e1e+'\x27:'):console[_0x1e4206(0x246)](_0x1e4206(0x264)+_0x183e1e+'\x27:');console[_0x1e4206(0x246)]('─'[_0x1e4206(0x1e6)](0x3c)),console[_0x1e4206(0x246)](_0x22028a),console[_0x1e4206(0x246)]('─'[_0x1e4206(0x1e6)](0x3c));const _0x23d83b=_0x2e26b3?_0x1e4206(0x23a)+_0x183e1e+_0x1e4206(0x1fd):_0x1e4206(0x269)+_0x183e1e+_0x1e4206(0x1fd);if(!_0x4e1306['yes']){const _0x2a3b82=await confirmKey(_0x23d83b);if(!_0x2a3b82)return console['error']('Aborted.'),0x1;}const _0x3d8fe9=_0x2e26b3?_0x1e4206(0x249):'Updating';await withSpinner(_0x3d8fe9+_0x1e4206(0x24d)+_0x183e1e+_0x1e4206(0x196),()=>_0x5702c9[_0x1e4206(0x1f8)](),{'verbose':_0x4e1306['verbose']});const _0x192a89=_0x2e26b3?_0x1e4206(0x1dc):_0x1e4206(0x152);console[_0x1e4206(0x246)]('✔\x20'+_0x192a89+_0x1e4206(0x24d)+_0x183e1e+'\x27');}else console[_0x1e4206(0x246)]('✔\x20No\x20changes\x20-\x20\x27'+_0x183e1e+_0x1e4206(0x274));}const _0x37c815=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x4ebb86+_0x1e4206(0x196),()=>_0xe1360[_0x1e4206(0x1b3)][_0x1e4206(0x1bb)](_0x4ebb86),{'verbose':_0x4e1306[_0x1e4206(0x247)]}),_0x4efd2e=_0x37c815[_0x1e4206(0x1d8)],_0x2a1322=getConsoleUrl(_0x4e1306[_0x1e4206(0x150)],_0x1e4206(0x1e5)+_0x4efd2e[_0x1e4206(0x209)]+'/sessions/'+_0x4efd2e['workflowSessionId']+'/attempt/'+_0x4efd2e['workflowAttemptId']);return console[_0x1e4206(0x246)](_0x1e4206(0x194)),console[_0x1e4206(0x246)]('\x20\x20'+a21_0x210f78[_0x1e4206(0x200)](_0x1e4206(0x1bf))+'\x20'+_0x4efd2e[_0x1e4206(0x27b)]),console[_0x1e4206(0x246)]('\x20\x20'+a21_0x210f78[_0x1e4206(0x200)](_0x1e4206(0x20e))+'\x20'+_0x4efd2e[_0x1e4206(0x275)]),console[_0x1e4206(0x246)]('\x20\x20'+a21_0x210f78[_0x1e4206(0x200)](_0x1e4206(0x1df))+'\x20'+_0x4efd2e[_0x1e4206(0x1d7)]),console[_0x1e4206(0x246)]('\x20\x20'+a21_0x210f78[_0x1e4206(0x200)](_0x1e4206(0x260))+'\x20'+_0x4efd2e[_0x1e4206(0x1ce)]),console[_0x1e4206(0x246)]('\x20\x20'+_0x2a1322),console[_0x1e4206(0x246)]('\x0a'+a21_0x210f78[_0x1e4206(0x200)](_0x1e4206(0x18d))+_0x1e4206(0x22d)+_0x4efd2e['workflowAttemptId']+_0x1e4206(0x245)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x26d);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x156);async[a21_0x32d180(0x214)](_0x3560d1){const _0x1ec073=a21_0x32d180,{options:_0x328244,args:_0x261e94,tdx:_0x43db13}=_0x3560d1,_0x4cd951=_0x261e94[0x0]||_0x328244['parentSegment'];if(!_0x4cd951)return showParentSegmentNotSetError(_0x1ec073(0x155)+_0x1ec073(0x211)),0x1;_0x328244[_0x1ec073(0x247)]&&(console[_0x1ec073(0x246)](_0x1ec073(0x195)+_0x328244[_0x1ec073(0x150)]),console['error'](_0x1ec073(0x220)+_0x4cd951));const _0x558f58=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x4cd951+'\x27...',()=>_0x43db13[_0x1ec073(0x1b3)][_0x1ec073(0x23b)](_0x4cd951),{'verbose':_0x328244[_0x1ec073(0x247)]}),_0x3d2071=_0x558f58[_0x1ec073(0x1d8)];console[_0x1ec073(0x246)](_0x1ec073(0x1a4)+_0x3d2071[_0x1ec073(0x21a)]+_0x1ec073(0x22c)+(_0x3d2071['length']!==0x1?'s':''));if(_0x328244[_0x1ec073(0x212)]||_0x328244[_0x1ec073(0x221)])return await handleSDKOutput(_0x3d2071,_0x328244),0x0;return displayFieldsHumanReadable(_0x3d2071,_0x4cd951),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x258);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x19b);async[a21_0x32d180(0x214)](_0xb14a95){const _0x5e44cd=a21_0x32d180,{options:_0xcb6534,args:_0x1fcb41,tdx:_0x5613e7}=_0xb14a95,_0x2af8ad=_0xcb6534,_0x947f3c=_0x1fcb41[0x0]||_0xcb6534[_0x5e44cd(0x172)];if(!_0x947f3c)return showParentSegmentNotSetError(_0x5e44cd(0x1de)+_0x5e44cd(0x184)+_0x5e44cd(0x1ff)+_0x5e44cd(0x231)),0x1;_0xcb6534[_0x5e44cd(0x247)]&&(console[_0x5e44cd(0x246)](_0x5e44cd(0x195)+_0xcb6534['site']),console['error']('Parent\x20segment:\x20'+_0x947f3c));const _0x43b3aa=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x947f3c+_0x5e44cd(0x196),()=>_0x5613e7['segment']['getParentFull'](_0x947f3c),{'verbose':_0xcb6534[_0x5e44cd(0x247)]}),_0x5aee6b=_0x43b3aa[_0x5e44cd(0x1d8)];if(_0x2af8ad[_0x5e44cd(0x1b9)]){const _0x5c66b9=getConsoleNextUrl(_0x2af8ad[_0x5e44cd(0x150)],_0x5e44cd(0x215)+_0x5aee6b['id']);return console['error'](a21_0x210f78['green']('✔')+_0x5e44cd(0x1d6)+a21_0x210f78['cyan'](_0x5c66b9)),openBrowser(_0x5c66b9),0x0;}return await handleSingleObjectOutput(_0x5aee6b,_0xcb6534),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x32d180(0x14f)]='segment:parent:desc';[a21_0x32d180(0x1c6)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a21_0x32d180(0x214)](_0x4174a6){const _0xd156d3=a21_0x32d180,{options:_0x532035,args:_0x104a0d,tdx:_0x574f4e}=_0x4174a6,_0x596014=_0x104a0d[0x0]||_0x532035[_0xd156d3(0x172)];if(!_0x596014)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0xd156d3(0x218)),0x1;_0x532035[_0xd156d3(0x247)]&&(console['error'](_0xd156d3(0x195)+_0x532035[_0xd156d3(0x150)]),console['error']('Parent\x20segment:\x20'+_0x596014));const _0xb9b175=await withSpinner(_0xd156d3(0x23c)+_0x596014+_0xd156d3(0x196),()=>_0x574f4e['segment']['resolveParentId'](_0x596014),{'verbose':_0x532035[_0xd156d3(0x247)]}),_0x5255e2=_0xb9b175['data'],_0x28e1ba=await withSpinner(_0xd156d3(0x1b1)+_0x596014+_0xd156d3(0x196),()=>_0x574f4e['segment'][_0xd156d3(0x1e7)](_0x5255e2),{'verbose':_0x532035[_0xd156d3(0x247)]}),_0x2dadab=await executeSchemaQuery(_0x28e1ba[_0xd156d3(0x1d8)],_0x574f4e,_0x532035);return await handleQueryOutput(_0x2dadab,_0x532035),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x32d180(0x14f)]=a21_0x32d180(0x187);[a21_0x32d180(0x1c6)]=a21_0x32d180(0x26b);async[a21_0x32d180(0x214)](_0x5b7914){const _0x529f1e=a21_0x32d180,{options:_0x584037,args:_0x3c9b47,tdx:_0x32071d}=_0x5b7914,_0x2f5b15=_0x3c9b47[0x0]||_0x584037['parentSegment'];if(!_0x2f5b15)return showParentSegmentNotSetError(_0x529f1e(0x16f)+_0x529f1e(0x1b4)),0x1;_0x584037[_0x529f1e(0x247)]&&(console[_0x529f1e(0x246)]('Site:\x20'+_0x584037[_0x529f1e(0x150)]),console['error'](_0x529f1e(0x220)+_0x2f5b15));const _0x367ce6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2f5b15+_0x529f1e(0x196),()=>_0x32071d['segment'][_0x529f1e(0x248)](_0x2f5b15),{'verbose':_0x584037['verbose']}),_0x69f14f=_0x367ce6[_0x529f1e(0x1d8)],_0x433eac=await withSpinner(_0x529f1e(0x1b1)+_0x2f5b15+'\x27...',()=>_0x32071d[_0x529f1e(0x1b3)][_0x529f1e(0x1e7)](_0x69f14f),{'verbose':_0x584037[_0x529f1e(0x247)]}),_0xa97a5c=_0x433eac[_0x529f1e(0x1d8)];return _0x584037['format']==='json'||_0x584037['format']==='jsonl'?await handleSDKOutput([{'sql':_0xa97a5c}],_0x584037):console[_0x529f1e(0x266)](_0xa97a5c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a21_0x32d180(0x202);['description']=a21_0x32d180(0x267);async[a21_0x32d180(0x214)](_0x3f869a){const _0x56aed9=a21_0x32d180,{options:_0x47f98c,args:_0xf0386d,tdx:_0x55628b}=_0x3f869a,_0x4beaae=_0xf0386d[0x0]||_0x47f98c['parentSegment'];if(!_0x4beaae)return showParentSegmentNotSetError(_0x56aed9(0x1c5)+_0x56aed9(0x185)),0x1;_0x47f98c[_0x56aed9(0x247)]&&(console[_0x56aed9(0x246)]('Site:\x20'+_0x47f98c[_0x56aed9(0x150)]),console[_0x56aed9(0x246)](_0x56aed9(0x220)+_0x4beaae));const _0x5e4a77=await withSpinner(_0x56aed9(0x23c)+_0x4beaae+_0x56aed9(0x196),()=>_0x55628b[_0x56aed9(0x1b3)][_0x56aed9(0x248)](_0x4beaae),{'verbose':_0x47f98c[_0x56aed9(0x247)]}),_0x290efe=_0x5e4a77['data'],_0xc5d247=await withSpinner(_0x56aed9(0x1b1)+_0x4beaae+_0x56aed9(0x196),()=>_0x55628b[_0x56aed9(0x1b3)][_0x56aed9(0x1e7)](_0x290efe),{'verbose':_0x47f98c['verbose']});let _0x34eacc=_0xc5d247[_0x56aed9(0x1d8)];const _0x431df7=resolveLimit(_0x47f98c[_0x56aed9(0x22f)],DEFAULT_DISPLAY_LIMIT),_0x4dcfa7=/\bLIMIT\s+\d+/i[_0x56aed9(0x24a)](_0x34eacc);!_0x4dcfa7&&(_0x34eacc=_0x34eacc[_0x56aed9(0x1f2)]()[_0x56aed9(0x18b)](/;+$/,''),_0x34eacc=_0x56aed9(0x25d)+_0x34eacc+_0x56aed9(0x1d5)+_0x431df7);_0x47f98c[_0x56aed9(0x247)]&&console[_0x56aed9(0x246)](_0x56aed9(0x230)+_0x34eacc);const _0x5df071=await withProgressSpinner(_0x56aed9(0x1f5),async _0x3fe0ba=>{const _0xe78b6f=_0x56aed9,_0x1ba86f=await _0x55628b[_0xe78b6f(0x26e)][_0xe78b6f(0x214)](_0x34eacc,{'catalog':'td','schema':'information_schema','onJobId':_0x23894b=>{const _0x26d9ad=_0xe78b6f;_0x3fe0ba[_0x26d9ad(0x1eb)](_0x23894b);}});return _0x1ba86f;},{'verbose':_0x47f98c[_0x56aed9(0x247)]}),_0x330439=_0x5df071[_0x56aed9(0x1d8)],_0x3c5237=_0x330439[_0x56aed9(0x1ea)]?_0x56aed9(0x20d)+_0x330439['jobId']+']':'';return console[_0x56aed9(0x246)](_0x56aed9(0x261)+_0x330439['stats']['processedRows'][_0x56aed9(0x1c1)]()+_0x56aed9(0x177)+(_0x56aed9(0x237)+formatElapsed(_0x330439[_0x56aed9(0x24e)][_0x56aed9(0x179)])+_0x3c5237)),await handleQueryOutput(_0x330439,_0x47f98c),0x0;}}
|
|
1
|
+
const a21_0x36ce6e=a21_0x5277;(function(_0x3cde37,_0x1b6007){const _0x5879db=a21_0x5277,_0x4999a6=_0x3cde37();while(!![]){try{const _0x52302=-parseInt(_0x5879db(0x1c3))/0x1+-parseInt(_0x5879db(0x170))/0x2+-parseInt(_0x5879db(0x1f3))/0x3+parseInt(_0x5879db(0x16f))/0x4+parseInt(_0x5879db(0x139))/0x5+parseInt(_0x5879db(0x176))/0x6+-parseInt(_0x5879db(0x1d5))/0x7*(-parseInt(_0x5879db(0x1e4))/0x8);if(_0x52302===_0x1b6007)break;else _0x4999a6['push'](_0x4999a6['shift']());}catch(_0x45fd80){_0x4999a6['push'](_0x4999a6['shift']());}}}(a21_0x5d1e,0xb27b5));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0x3731ca 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}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x1bbe9b 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=a21_0x36ce6e(0x13f),LEGACY_PARENT_SEGMENT_DIR=a21_0x36ce6e(0x228);function openBrowser(_0x1643f3){const _0x858283=a21_0x36ce6e,_0x1b9350=process[_0x858283(0x1e2)],_0x16f56d=_0x1b9350===_0x858283(0x189)?'open':_0x1b9350===_0x858283(0x1d9)?_0x858283(0x15b):'xdg-open';spawn(_0x16f56d,[_0x1643f3],{'detached':!![],'stdio':'ignore'})[_0x858283(0x1f8)]();}function a21_0x5277(_0x4f73c2,_0x4e3c4f){_0x4f73c2=_0x4f73c2-0x112;const _0x5d1e22=a21_0x5d1e();let _0x5277f3=_0x5d1e22[_0x4f73c2];return _0x5277f3;}function migrateLegacyDirectory(){const _0x1e8a6b=a21_0x36ce6e;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2ca3d6=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2ca3d6[_0x1e8a6b(0x158)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1e8a6b(0x21f)](a21_0x1bbe9b['yellow'](_0x1e8a6b(0x1a3)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x1e8a6b(0x21f)](a21_0x1bbe9b['dim']('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x1e8a6b(0x21f)](a21_0x1bbe9b[_0x1e8a6b(0x1d4)](_0x1e8a6b(0x1b6)+LEGACY_PARENT_SEGMENT_DIR+_0x1e8a6b(0x1dc)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1e8a6b(0x21f)](a21_0x1bbe9b[_0x1e8a6b(0x1f1)](_0x1e8a6b(0x237)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4947){const _0x48fe71=_0x4947 instanceof Error?_0x4947[_0x1e8a6b(0x11a)]:String(_0x4947);return console[_0x1e8a6b(0x21f)](a21_0x1bbe9b[_0x1e8a6b(0x1af)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x48fe71+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x36ce6e(0x172)](_0x5aaa4a){return migrateLegacyDirectory(),super['run'](_0x5aaa4a);}}function resolveYamlFile(_0x4dc111){const _0x32804b=a21_0x36ce6e;if(_0x4dc111[_0x32804b(0x121)](_0x32804b(0x1a2))||_0x4dc111['endsWith'](_0x32804b(0x141)))return _0x4dc111;return a21_0x3731ca['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4dc111)+_0x32804b(0x1a2));}function formatProgressMessage(_0x17734c){const _0x23c8b1=a21_0x36ce6e,_0x4e5db2=_0x17734c[_0x23c8b1(0x220)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4e5db2){const [,_0x565782,_0x350bca,_0x465ba6='']=_0x4e5db2;return a21_0x1bbe9b[_0x23c8b1(0x20f)](_0x565782+':')+'\x20'+_0x350bca+a21_0x1bbe9b[_0x23c8b1(0x20f)](_0x465ba6);}return a21_0x1bbe9b[_0x23c8b1(0x20f)](_0x17734c);}function showFileNotFoundError(_0xd53140,_0x395749){const _0x59897d=a21_0x36ce6e;console[_0x59897d(0x21f)](a21_0x1bbe9b[_0x59897d(0x1af)](_0x59897d(0x231)+_0xd53140+'\x0a')),console['error'](a21_0x1bbe9b[_0x59897d(0x223)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x395749+_0x59897d(0x147)));}function showParentSegmentNotSetError(_0x311aad){const _0x3b2e50=a21_0x36ce6e;console[_0x3b2e50(0x21f)](a21_0x1bbe9b['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3b2e50(0x21f)](_0x311aad);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x1e3);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x1e6);async[a21_0x36ce6e(0x14c)](_0x504615){const _0x52abf1=a21_0x36ce6e,{options:_0x5f0998,args:_0x5c43f6,tdx:_0x22275f}=_0x504615,_0x4e3946=_0x5c43f6[0x0];_0x5f0998[_0x52abf1(0x200)]&&(console[_0x52abf1(0x21f)](_0x52abf1(0x159)+_0x5f0998[_0x52abf1(0x142)]),_0x4e3946&&console[_0x52abf1(0x21f)](_0x52abf1(0x1ac)+_0x4e3946));const _0x31947f=await withSpinner(_0x4e3946?_0x52abf1(0x169)+_0x4e3946+_0x52abf1(0x192):_0x52abf1(0x20d),()=>_0x22275f[_0x52abf1(0x1b4)][_0x52abf1(0x1b9)](),{'verbose':_0x5f0998[_0x52abf1(0x200)]});let _0x2f884a=_0x31947f[_0x52abf1(0x133)];if(_0x4e3946){const _0x5d258f=_0x4e3946[_0x52abf1(0x21a)](/[.+^${}()|[\]\\]/g,_0x52abf1(0x179))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3218c4=new RegExp('^'+_0x5d258f+'$','i');_0x2f884a=_0x2f884a[_0x52abf1(0x18b)](_0x222e9b=>_0x3218c4[_0x52abf1(0x129)](_0x222e9b[_0x52abf1(0x1ea)][_0x52abf1(0x11b)]));}_0x2f884a[_0x52abf1(0x1a0)]((_0x18d083,_0x1fe17c)=>_0x18d083[_0x52abf1(0x1ea)][_0x52abf1(0x11b)][_0x52abf1(0x166)](_0x1fe17c[_0x52abf1(0x1ea)][_0x52abf1(0x11b)])),console[_0x52abf1(0x21f)](_0x52abf1(0x1ce)+_0x2f884a[_0x52abf1(0x1df)]+_0x52abf1(0x235)+(_0x2f884a['length']!==0x1?'s':''));const _0x35c843=_0x2b134f=>{const _0x207523=_0x52abf1;return getConsoleNextUrl(_0x5f0998['site'],_0x207523(0x1c0)+_0x2b134f);};if(_0x5f0998[_0x52abf1(0x13a)]===_0x52abf1(0x218)||_0x5f0998[_0x52abf1(0x13a)]===_0x52abf1(0x17e)){const _0x3de469=_0x2f884a['map'](_0x52fd5b=>({..._0x52fd5b,'url':_0x35c843(_0x52fd5b['id'])}));await handleSDKOutput(_0x3de469,_0x5f0998);}else{if(_0x2f884a[_0x52abf1(0x1df)]===0x0)_0x4e3946?console[_0x52abf1(0x1ff)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x4e3946):console[_0x52abf1(0x1ff)](_0x52abf1(0x1b0));else for(const _0x32e83e of _0x2f884a){const _0x7d61d0=_0x32e83e[_0x52abf1(0x1ea)][_0x52abf1(0x16b)]?a21_0x1bbe9b['dim']('\x20('+formatRows(_0x32e83e['attributes'][_0x52abf1(0x16b)])+')'):'',_0x18bf24=hyperlink(_0x32e83e[_0x52abf1(0x1ea)][_0x52abf1(0x11b)],_0x35c843(_0x32e83e['id']));console[_0x52abf1(0x1ff)](_0x52abf1(0x1ee)+_0x18bf24+_0x7d61d0);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x19d);[a21_0x36ce6e(0x1f2)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a21_0x36ce6e(0x14c)](_0x4742b7){const _0x1519a6=a21_0x36ce6e,{options:_0x40b83c,args:_0x19bea4,tdx:_0x317038}=_0x4742b7;console['error'](_0x1519a6(0x230)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x1519a6(0x221));const _0x5d998d=_0x40b83c;if(_0x19bea4['length']===0x0)return console[_0x1519a6(0x21f)](a21_0x1bbe9b['red'](_0x1519a6(0x119))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x3e7cd8=_0x19bea4[0x0];if(!_0x5d998d['database']||!_0x5d998d[_0x1519a6(0x219)])return console[_0x1519a6(0x21f)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x1519a6(0x21f)](_0x1519a6(0x12f)),0x1;_0x5d998d[_0x1519a6(0x200)]&&(console['error'](_0x1519a6(0x159)+_0x5d998d['site']),console['error'](_0x1519a6(0x21d)+_0x3e7cd8),console[_0x1519a6(0x21f)](_0x1519a6(0x22c)+_0x5d998d[_0x1519a6(0x1cb)]),console['error'](_0x1519a6(0x17f)+_0x5d998d[_0x1519a6(0x219)]));const _0x1d7e29=await loadJSONFromOptions(_0x5d998d[_0x1519a6(0x1ea)],_0x5d998d[_0x1519a6(0x19f)]),_0x27bcf2=await loadJSONFromOptions(_0x5d998d[_0x1519a6(0x165)],_0x5d998d[_0x1519a6(0x1d7)]),_0x226634=await loadJSONFromOptions(_0x5d998d[_0x1519a6(0x238)],_0x5d998d[_0x1519a6(0x1cf)]),_0x2d079e={'name':_0x3e7cd8,'description':_0x5d998d[_0x1519a6(0x1f2)],'scheduleType':_0x5d998d['scheduleType'],'scheduleOption':_0x5d998d['scheduleOption'],'timezone':_0x5d998d[_0x1519a6(0x1bd)],'master':{'parentDatabaseName':_0x5d998d['database'],'parentTableName':_0x5d998d['table']},'attributes':_0x1d7e29,'behaviors':_0x27bcf2,'customerGroup':_0x226634},_0x2bb17f=await withSpinner(_0x1519a6(0x138)+_0x3e7cd8+'\x27...',()=>_0x317038[_0x1519a6(0x1b4)]['createParent'](_0x2d079e),{'verbose':_0x40b83c[_0x1519a6(0x200)]}),_0x1abe27=_0x2bb17f['data'];return console['error'](_0x1519a6(0x1ba)+_0x1abe27[_0x1519a6(0x11b)]+'\x27\x20with\x20ID:\x20'+_0x1abe27['id']),await handleSDKOutput([_0x1abe27],_0x40b83c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]='segment:parent:update';[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x162);async[a21_0x36ce6e(0x14c)](_0x5d81fd){const _0x3ebbce=a21_0x36ce6e,{options:_0x5766c8,args:_0x3c6d81,tdx:_0x52d57a}=_0x5d81fd;console[_0x3ebbce(0x21f)](_0x3ebbce(0x1e7)+_0x3ebbce(0x1fb)+_0x3ebbce(0x221));const _0x4c83c4=_0x5766c8;if(_0x3c6d81[_0x3ebbce(0x1df)]===0x0)return console[_0x3ebbce(0x21f)](a21_0x1bbe9b[_0x3ebbce(0x1af)](_0x3ebbce(0x119))),console[_0x3ebbce(0x21f)](_0x3ebbce(0x1ed)),0x1;const _0x489fee=_0x3c6d81[0x0];_0x4c83c4[_0x3ebbce(0x200)]&&(console[_0x3ebbce(0x21f)](_0x3ebbce(0x159)+_0x4c83c4[_0x3ebbce(0x142)]),console[_0x3ebbce(0x21f)](_0x3ebbce(0x181)+_0x489fee));const _0x1738a9=await withSpinner(_0x3ebbce(0x157)+_0x489fee+_0x3ebbce(0x192),()=>_0x52d57a[_0x3ebbce(0x1b4)][_0x3ebbce(0x1bf)](_0x489fee),{'verbose':_0x4c83c4[_0x3ebbce(0x200)]}),_0x16ed14=_0x1738a9[_0x3ebbce(0x133)],_0x598aac=await loadJSONFromOptions(_0x4c83c4[_0x3ebbce(0x1a7)],_0x4c83c4[_0x3ebbce(0x18c)]),_0x2b5318=await loadJSONFromOptions(_0x4c83c4[_0x3ebbce(0x132)],_0x4c83c4[_0x3ebbce(0x178)]),_0x3bf1ef={'name':_0x16ed14[_0x3ebbce(0x11b)],'description':_0x4c83c4['description']!==undefined?_0x4c83c4['description']:_0x16ed14[_0x3ebbce(0x1f2)],'scheduleType':_0x4c83c4[_0x3ebbce(0x194)]!==undefined?_0x4c83c4['scheduleType']:_0x16ed14['scheduleType'],'scheduleOption':_0x4c83c4[_0x3ebbce(0x156)]!==undefined?_0x4c83c4[_0x3ebbce(0x156)]:_0x16ed14[_0x3ebbce(0x156)],'timezone':_0x4c83c4['timezone']!==undefined?_0x4c83c4['timezone']:_0x16ed14[_0x3ebbce(0x1bd)],'master':_0x16ed14['master'],'attributes':_0x598aac?[..._0x16ed14[_0x3ebbce(0x1ea)]||[],..._0x598aac]:_0x16ed14['attributes'],'behaviors':_0x2b5318?[..._0x16ed14[_0x3ebbce(0x165)]||[],..._0x2b5318]:_0x16ed14['behaviors'],'customerGroup':_0x16ed14[_0x3ebbce(0x238)]},_0xe4ed36=await withSpinner(_0x3ebbce(0x1e1)+_0x489fee+'\x27...',()=>_0x52d57a[_0x3ebbce(0x1b4)][_0x3ebbce(0x232)](_0x489fee,_0x3bf1ef),{'verbose':_0x4c83c4[_0x3ebbce(0x200)]}),_0x175808=_0xe4ed36['data'];return console[_0x3ebbce(0x21f)](_0x3ebbce(0x122)+_0x175808[_0x3ebbce(0x11b)]+'\x27'),await handleSDKOutput([_0x175808],_0x4c83c4),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x1b2);[a21_0x36ce6e(0x1f2)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a21_0x36ce6e(0x14c)](_0x21b464){const _0x2078c0=a21_0x36ce6e,{options:_0x3bc1b6,args:_0x5bb20b,tdx:_0x48c6ab}=_0x21b464,_0x148317=_0x3bc1b6,_0x408a03=_0x5bb20b[0x0]||_0x3bc1b6[_0x2078c0(0x131)];if(!_0x408a03)return showParentSegmentNotSetError(_0x2078c0(0x127)+_0x2078c0(0x15f)),0x1;if(_0x148317[_0x2078c0(0x15d)]&&_0x148317[_0x2078c0(0x152)])return console[_0x2078c0(0x21f)](a21_0x1bbe9b[_0x2078c0(0x1af)](_0x2078c0(0x1b8))),console[_0x2078c0(0x21f)](a21_0x1bbe9b[_0x2078c0(0x20f)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x2078c0(0x21f)](a21_0x1bbe9b['dim'](_0x2078c0(0x180)+PARENT_SEGMENT_DIR+_0x2078c0(0x175))),console[_0x2078c0(0x21f)](a21_0x1bbe9b['cyan'](_0x2078c0(0x1b7))),0x1;const _0x368464=_0x148317[_0x2078c0(0x152)]||a21_0x3731ca['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x408a03)+_0x2078c0(0x1a2));_0x148317[_0x2078c0(0x200)]&&(console[_0x2078c0(0x21f)](_0x2078c0(0x159)+_0x148317[_0x2078c0(0x142)]),console[_0x2078c0(0x21f)](_0x2078c0(0x181)+_0x408a03),console[_0x2078c0(0x21f)](_0x2078c0(0x1ab)+_0x368464));const _0x5e33f8=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x408a03+_0x2078c0(0x192),()=>_0x48c6ab[_0x2078c0(0x1b4)][_0x2078c0(0x20c)](_0x408a03),{'verbose':_0x148317[_0x2078c0(0x200)]}),_0x73aa92=_0x5e33f8['data'];if(existsSync(_0x368464)){const _0x215bb6=readFileSync(_0x368464,_0x2078c0(0x11d)),_0x43aafc=generateDiff(_0x215bb6,_0x73aa92);if(!hasChanges(_0x43aafc))console['error'](a21_0x1bbe9b[_0x2078c0(0x1f1)]('✔')+_0x2078c0(0x11f)+a21_0x1bbe9b[_0x2078c0(0x223)](_0x368464)+_0x2078c0(0x1e5));else{console[_0x2078c0(0x21f)](_0x2078c0(0x1fa)+_0x368464+'\x27:'),console[_0x2078c0(0x21f)]('─'[_0x2078c0(0x140)](0x3c)),console['error'](formatDiffWithColors(_0x43aafc)),console['error']('─'['repeat'](0x3c));if(!_0x148317[_0x2078c0(0x1de)]){const _0x2961c1=await confirmKey(_0x2078c0(0x21c)+_0x368464+'\x27?');if(!_0x2961c1)return console[_0x2078c0(0x21f)](_0x2078c0(0x208)),0x1;}writeFileSync(_0x368464,_0x73aa92,_0x2078c0(0x11d)),console[_0x2078c0(0x21f)](a21_0x1bbe9b['green']('✔')+_0x2078c0(0x124)+a21_0x1bbe9b['cyan'](_0x368464));}}else{const _0xe4eae8=a21_0x3731ca['dirname'](_0x368464);!existsSync(_0xe4eae8)&&mkdirSync(_0xe4eae8,{'recursive':!![]}),writeFileSync(_0x368464,_0x73aa92,_0x2078c0(0x11d)),console['error'](a21_0x1bbe9b[_0x2078c0(0x1f1)]('✔')+_0x2078c0(0x124)+a21_0x1bbe9b[_0x2078c0(0x223)](_0x368464));}return saveSessionContext({'parent_segment':_0x408a03},_0x148317[_0x2078c0(0x20b)]),console['error'](a21_0x1bbe9b[_0x2078c0(0x1f1)]('✔')+_0x2078c0(0x183)+a21_0x1bbe9b['dim'](_0x2078c0(0x228))+'\x20=\x20'+a21_0x1bbe9b[_0x2078c0(0x223)](_0x408a03)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]='segment:parent:push';[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x16c);async[a21_0x36ce6e(0x14c)](_0x591836){const _0x32c538=a21_0x36ce6e,{options:_0x22bd7b,args:_0x585b21,tdx:_0x2149ab}=_0x591836,_0x1e22fe=_0x22bd7b,_0x55491a=_0x585b21[0x0]||_0x22bd7b[_0x32c538(0x131)];if(!_0x55491a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x6356b8=resolveYamlFile(_0x55491a);if(!existsSync(_0x6356b8))return showFileNotFoundError(_0x6356b8,_0x55491a),0x1;_0x1e22fe[_0x32c538(0x200)]&&(console[_0x32c538(0x21f)](_0x32c538(0x159)+_0x1e22fe[_0x32c538(0x142)]),console[_0x32c538(0x21f)](_0x32c538(0x14f)+_0x6356b8));let _0x3ad831;try{_0x3ad831=readFileSync(_0x6356b8,'utf-8');}catch(_0x224eea){const _0x177e2a=_0x224eea instanceof Error?_0x224eea['message']:String(_0x224eea);return console['error']('Error\x20reading\x20file:\x20'+_0x177e2a),0x1;}const _0x252f8f=await withSpinner(_0x32c538(0x20a),()=>_0x2149ab[_0x32c538(0x1b4)]['pushParentYaml'](_0x3ad831),{'verbose':_0x1e22fe[_0x32c538(0x200)]}),_0x447f6b=_0x252f8f[_0x32c538(0x133)],{isNew:_0x3b66d0,name:_0xb8b2fd,hasChanges:_0x20bfc0,diffFormatted:_0x1a133c}=_0x447f6b;if(!_0x20bfc0)return console['error'](_0x32c538(0x239)+_0xb8b2fd+_0x32c538(0x1bb)),0x0;_0x3b66d0?console[_0x32c538(0x21f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xb8b2fd+'\x27:'):console[_0x32c538(0x21f)](_0x32c538(0x209)+_0xb8b2fd+'\x27:');console[_0x32c538(0x21f)]('─'[_0x32c538(0x140)](0x3c)),console[_0x32c538(0x21f)](_0x1a133c),console[_0x32c538(0x21f)]('─'['repeat'](0x3c));const _0x423f1e=_0x3b66d0?'Create\x20parent\x20segment\x20\x27'+_0xb8b2fd+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xb8b2fd+'\x27?';if(!_0x1e22fe[_0x32c538(0x1de)]){const _0xe351ca=await confirmKey(_0x423f1e);if(!_0xe351ca)return console[_0x32c538(0x21f)](_0x32c538(0x208)),0x1;}const _0x4fcdd0=_0x3b66d0?_0x32c538(0x1d3):'Updating',_0x358466=await withSpinner(_0x4fcdd0+'\x20parent\x20segment\x20\x27'+_0xb8b2fd+_0x32c538(0x192),()=>_0x447f6b[_0x32c538(0x1c5)](),{'verbose':_0x1e22fe['verbose']}),_0x2716d5=_0x358466[_0x32c538(0x133)],_0x332f77=getConsoleNextUrl(_0x1e22fe['site'],_0x32c538(0x1c0)+_0x2716d5['id']),_0x213b30=_0x3b66d0?_0x32c538(0x128):'Updated';return console[_0x32c538(0x21f)]('✔\x20'+_0x213b30+_0x32c538(0x234)+_0x2716d5['name']+'\x27'),console[_0x32c538(0x21f)]('\x20\x20'+_0x332f77),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x211);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x1a6);async[a21_0x36ce6e(0x14c)](_0x75feae){const _0x12a6ba=a21_0x36ce6e,{options:_0xce233d,args:_0x1d5457,tdx:_0x198027}=_0x75feae,_0xc17ee3=_0xce233d,_0x45e967=_0x1d5457[0x0]||_0xce233d['parentSegment'];if(!_0x45e967)return showParentSegmentNotSetError(_0x12a6ba(0x1d6)+_0x12a6ba(0x1e9)+_0x12a6ba(0x1db)+_0x12a6ba(0x202)+_0x12a6ba(0x1b5)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x3094cd=resolveYamlFile(_0x45e967);if(!existsSync(_0x3094cd))return showFileNotFoundError(_0x3094cd,_0x45e967),0x1;_0xc17ee3[_0x12a6ba(0x200)]&&(console[_0x12a6ba(0x21f)](_0x12a6ba(0x159)+_0xc17ee3[_0x12a6ba(0x142)]),console[_0x12a6ba(0x21f)]('YAML\x20file:\x20'+_0x3094cd));let _0x41ec43;try{_0x41ec43=readFileSync(_0x3094cd,'utf-8');}catch(_0x4ad2bb){const _0x38271d=_0x4ad2bb instanceof Error?_0x4ad2bb[_0x12a6ba(0x11a)]:String(_0x4ad2bb);return console[_0x12a6ba(0x21f)](_0x12a6ba(0x1a8)+_0x38271d),0x1;}const _0x5797f1=createCommandSpinner(a21_0x1bbe9b[_0x12a6ba(0x20f)]('Validating\x20configuration...'),{'verbose':_0xc17ee3[_0x12a6ba(0x200)]});_0x5797f1[_0x12a6ba(0x15b)]();const _0x2b884f={'onProgress':_0x26c276=>{const _0x439919=_0x12a6ba;_0x5797f1[_0x439919(0x154)]=formatProgressMessage(_0x26c276);}};if(_0xc17ee3[_0x12a6ba(0x1a1)])_0x2b884f[_0x12a6ba(0x1a1)]=!![];if(_0xc17ee3[_0x12a6ba(0x203)])_0x2b884f['enriched']=!![];_0xc17ee3[_0x12a6ba(0x225)]&&(_0x2b884f[_0x12a6ba(0x225)]=_0xc17ee3[_0x12a6ba(0x225)]);_0xc17ee3[_0x12a6ba(0x1c2)]&&(_0x2b884f[_0x12a6ba(0x1c2)]=_0xc17ee3[_0x12a6ba(0x1c2)]);if(_0xc17ee3[_0x12a6ba(0x1e8)])_0x2b884f['interval']=_0xc17ee3[_0x12a6ba(0x1e8)];let _0x153823;try{_0x153823=await _0x198027[_0x12a6ba(0x1b4)][_0x12a6ba(0x1c8)](_0x41ec43,_0x2b884f),_0x5797f1[_0x12a6ba(0x1fe)]();}catch(_0x354082){_0x5797f1[_0x12a6ba(0x1fe)]();throw _0x354082;}const _0x30da6d=_0xc17ee3['interval']||_0x12a6ba(0x21e);return this['displayValidateResults'](_0x153823,_0x2b884f,_0x3094cd,_0x30da6d),_0x153823[_0x12a6ba(0x13e)]?0x0:0x1;}[a21_0x36ce6e(0x1ef)](_0x3a95ba,_0x41d5b2,_0x3592c3,_0x51e2ee){const _0xe5933b=a21_0x36ce6e;console[_0xe5933b(0x21f)]('\x0a'+a21_0x1bbe9b[_0xe5933b(0x227)](_0xe5933b(0x216))+'\x20'+_0x3a95ba['name']),console['error']('═'['repeat'](0x3c)),this[_0xe5933b(0x14a)](_0x3a95ba);if(typeof _0x41d5b2[_0xe5933b(0x225)]==='string'){this['displayAttributesStats'](_0x3a95ba),this['displaySummary'](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,'attribute',_0x41d5b2[_0xe5933b(0x225)]);return;}if(_0x41d5b2[_0xe5933b(0x225)]===!![]){this[_0xe5933b(0x199)](_0x3a95ba),this[_0xe5933b(0x120)](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,_0xe5933b(0x1ea));return;}if(typeof _0x41d5b2[_0xe5933b(0x1c2)]===_0xe5933b(0x1b3)){this[_0xe5933b(0x146)](_0x3a95ba,_0x51e2ee),this[_0xe5933b(0x120)](_0x3a95ba),this['displayPreviewHints'](_0x3592c3,_0x51e2ee,_0xe5933b(0x1c2),_0x41d5b2[_0xe5933b(0x1c2)]);return;}if(_0x41d5b2[_0xe5933b(0x1c2)]===!![]){this[_0xe5933b(0x146)](_0x3a95ba,_0x51e2ee),this[_0xe5933b(0x120)](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,_0xe5933b(0x165));return;}this[_0xe5933b(0x199)](_0x3a95ba),this[_0xe5933b(0x146)](_0x3a95ba,_0x51e2ee),this['displaySummary'](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,'all');}[a21_0x36ce6e(0x12a)](_0x163daf,_0x3ecb83,_0x3132bb,_0x227d6e){const _0x3f4826=a21_0x36ce6e;console[_0x3f4826(0x21f)]('\x0a'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x144)));const _0x2965d9=_0x3ecb83!==_0x3f4826(0x21e)?_0x3f4826(0x19a)+_0x3ecb83:'';if(_0x3132bb==='attribute'&&_0x227d6e)console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--attribute\x20\x22'+_0x227d6e+'\x22'+_0x2965d9));else{if(_0x3132bb===_0x3f4826(0x1c2)&&_0x227d6e)console['error']('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--behavior\x20\x22'+_0x227d6e+'\x22'+_0x2965d9));else(_0x3132bb===_0x3f4826(0x1ea)||_0x3132bb==='all')&&console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+_0x3f4826(0x191)+_0x2965d9));}(_0x3132bb===_0x3f4826(0x165)||_0x3132bb===_0x3f4826(0x1b1))&&console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--behavior\x20\x22<name>\x22'+_0x2965d9)),_0x3132bb===_0x3f4826(0x1b1)&&console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--enriched'+_0x2965d9));}[a21_0x36ce6e(0x14a)](_0xf9a7fc){const _0x4c1772=a21_0x36ce6e,{master:_0x1eab8e}=_0xf9a7fc,_0x539ede=_0x1eab8e[_0x4c1772(0x13b)]?a21_0x1bbe9b['green']('✔'):a21_0x1bbe9b[_0x4c1772(0x1af)]('✘');console[_0x4c1772(0x21f)]('\x0a'+a21_0x1bbe9b['dim'](_0x4c1772(0x12e))),console['error'](_0x539ede+'\x20'+a21_0x1bbe9b[_0x4c1772(0x227)](_0x1eab8e[_0x4c1772(0x1cb)]+'.'+_0x1eab8e[_0x4c1772(0x219)])),_0x1eab8e[_0x4c1772(0x13b)]?_0x1eab8e['rowCount']!==undefined&&console[_0x4c1772(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x4c1772(0x20f)](_0x4c1772(0x207))+'\x20'+a21_0x1bbe9b[_0x4c1772(0x223)](formatRows(_0x1eab8e['rowCount']))):console[_0x4c1772(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x4c1772(0x1af)](_0x4c1772(0x151))+'\x20'+_0x1eab8e[_0x4c1772(0x1aa)]);}[a21_0x36ce6e(0x199)](_0x8dceb8){const _0x5a2fce=a21_0x36ce6e;if(_0x8dceb8[_0x5a2fce(0x1ea)][_0x5a2fce(0x1df)]===0x0)return;console['error']('\x0a'+a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x22a)));for(const _0xb99cbb of _0x8dceb8[_0x5a2fce(0x1ea)]){const _0x164c8d=_0xb99cbb[_0x5a2fce(0x13b)]?a21_0x1bbe9b[_0x5a2fce(0x1f1)]('✔'):a21_0x1bbe9b[_0x5a2fce(0x1af)]('✘');let _0x24a490='';if(_0xb99cbb[_0x5a2fce(0x13b)]&&_0xb99cbb[_0x5a2fce(0x204)]!==undefined&&_0xb99cbb[_0x5a2fce(0x112)]!==undefined){const _0x31c9b9=_0xb99cbb['coveragePercent'][_0x5a2fce(0x186)](0x1),_0x99e382=_0xb99cbb[_0x5a2fce(0x112)]>=0x50?a21_0x1bbe9b['green']:_0xb99cbb[_0x5a2fce(0x112)]>=0x32?a21_0x1bbe9b[_0x5a2fce(0x1d4)]:a21_0x1bbe9b[_0x5a2fce(0x1af)];_0x24a490='\x20'+a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x1fc))+'\x20'+_0x99e382(_0x31c9b9+'%')+'\x20('+formatRows(_0xb99cbb[_0x5a2fce(0x204)])+_0x5a2fce(0x222);}console[_0x5a2fce(0x21f)](_0x164c8d+'\x20'+a21_0x1bbe9b[_0x5a2fce(0x227)](_0xb99cbb[_0x5a2fce(0x11b)])+_0x24a490),console[_0x5a2fce(0x21f)]('\x20\x20'+a21_0x1bbe9b['dim']('Source:')+'\x20'+a21_0x1bbe9b[_0x5a2fce(0x227)](_0xb99cbb[_0x5a2fce(0x1cb)]+'.'+_0xb99cbb[_0x5a2fce(0x219)]));const _0x514a8a=_0xb99cbb[_0x5a2fce(0x217)]===_0xb99cbb[_0x5a2fce(0x17b)]?a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x161))+'\x20'+_0xb99cbb[_0x5a2fce(0x217)]:a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x1d2))+'\x20'+_0xb99cbb[_0x5a2fce(0x217)]+_0x5a2fce(0x137)+_0xb99cbb[_0x5a2fce(0x17b)];console['error']('\x20\x20'+_0x514a8a),console['error']('\x20\x20'+a21_0x1bbe9b['dim'](_0x5a2fce(0x1c4))),this[_0x5a2fce(0x1ca)](_0xb99cbb[_0x5a2fce(0x215)]),!_0xb99cbb[_0x5a2fce(0x13b)]&&console['error']('\x20\x20'+a21_0x1bbe9b['red'](_0x5a2fce(0x151))+'\x20'+_0xb99cbb['schemaError']);}}['displayBehaviorsStats'](_0x1f79c3,_0x50dd75){const _0x335c15=a21_0x36ce6e;if(_0x1f79c3[_0x335c15(0x165)][_0x335c15(0x1df)]===0x0)return;console[_0x335c15(0x21f)]('\x0a'+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x1cd))+'\x20'+a21_0x1bbe9b[_0x335c15(0x20f)]('('+_0x50dd75+')'));for(const _0x4941f9 of _0x1f79c3[_0x335c15(0x165)]){const _0x517a84=_0x4941f9[_0x335c15(0x13b)]?a21_0x1bbe9b['green']('✔'):a21_0x1bbe9b['red']('✘');let _0x390d1f='';if(_0x4941f9[_0x335c15(0x13b)]&&_0x4941f9[_0x335c15(0x1a4)]!==undefined&&_0x4941f9[_0x335c15(0x1d1)]!==undefined){const _0x5a3249=_0x4941f9[_0x335c15(0x22e)]?.[_0x335c15(0x186)](0x1)||'?',_0x420fd8=(_0x4941f9[_0x335c15(0x22e)]??0x0)>=0x32?a21_0x1bbe9b[_0x335c15(0x1f1)]:(_0x4941f9[_0x335c15(0x22e)]??0x0)>=0x14?a21_0x1bbe9b[_0x335c15(0x1d4)]:a21_0x1bbe9b[_0x335c15(0x1af)];_0x390d1f='\x20'+a21_0x1bbe9b[_0x335c15(0x20f)]('Customers:')+'\x20'+_0x420fd8(formatRows(_0x4941f9['customersWithEvents']))+'\x20('+_0x5a3249+_0x335c15(0x113)+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x21b))+'\x20'+a21_0x1bbe9b[_0x335c15(0x223)](formatRows(_0x4941f9[_0x335c15(0x1d1)]));}console['error'](_0x517a84+'\x20'+a21_0x1bbe9b[_0x335c15(0x227)](_0x4941f9[_0x335c15(0x11b)])+_0x390d1f),console[_0x335c15(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x1be))+'\x20'+a21_0x1bbe9b['bold'](_0x4941f9[_0x335c15(0x1cb)]+'.'+_0x4941f9['table']));const _0x2f3cfb=_0x4941f9[_0x335c15(0x217)]===_0x4941f9[_0x335c15(0x17b)]?a21_0x1bbe9b[_0x335c15(0x20f)]('Join\x20on:')+'\x20'+_0x4941f9[_0x335c15(0x217)]:a21_0x1bbe9b[_0x335c15(0x20f)]('Join:')+'\x20'+_0x4941f9[_0x335c15(0x217)]+_0x335c15(0x137)+_0x4941f9[_0x335c15(0x17b)];console[_0x335c15(0x21f)]('\x20\x20'+_0x2f3cfb),console[_0x335c15(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x1c4))),this[_0x335c15(0x1ca)](_0x4941f9['columns']),!_0x4941f9[_0x335c15(0x13b)]&&console['error']('\x20\x20'+a21_0x1bbe9b[_0x335c15(0x1af)]('Error:')+'\x20'+_0x4941f9[_0x335c15(0x1aa)]);}}[a21_0x36ce6e(0x1ca)](_0x4707e1){const _0x4c09d1=a21_0x36ce6e;for(const _0x162fb9 of _0x4707e1){_0x162fb9['label']===_0x162fb9[_0x4c09d1(0x188)]||_0x162fb9[_0x4c09d1(0x188)]==='*'?console[_0x4c09d1(0x21f)](_0x4c09d1(0x1c1)+_0x162fb9[_0x4c09d1(0x187)]):console[_0x4c09d1(0x21f)](_0x4c09d1(0x1c1)+_0x162fb9[_0x4c09d1(0x187)]+'\x20'+a21_0x1bbe9b[_0x4c09d1(0x20f)]('('+_0x162fb9[_0x4c09d1(0x188)]+')'));}}['displaySummary'](_0x39c1ad){const _0x1e8e23=a21_0x36ce6e;console[_0x1e8e23(0x21f)]('─'[_0x1e8e23(0x140)](0x3c));if(_0x39c1ad['errors'][_0x1e8e23(0x1df)]>0x0){console['error']('\x0a'+a21_0x1bbe9b['red'](_0x1e8e23(0x15c)));for(const _0x168619 of _0x39c1ad['errors']){console[_0x1e8e23(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x1e8e23(0x1af)]('•')+'\x20'+_0x168619);}}_0x39c1ad[_0x1e8e23(0x13e)]&&console[_0x1e8e23(0x21f)]('\x0a'+a21_0x1bbe9b[_0x1e8e23(0x1f1)]('✔')+_0x1e8e23(0x11c));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x1c7);[a21_0x36ce6e(0x1f2)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0xbef555){const _0x2f9c3e=a21_0x36ce6e,{options:_0x2f2b58,args:_0x5adb2f,tdx:_0x5c23f5}=_0xbef555,_0x1f285e=_0x2f2b58,_0x1a738e=_0x5adb2f[0x0]||_0x2f2b58[_0x2f9c3e(0x131)];if(!_0x1a738e)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x2f9c3e(0x145)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x2f9c3e(0x123)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x2f9c3e(0x11e)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x1f285e[_0x2f9c3e(0x1a1)]&&!_0x1f285e['attribute']&&!_0x1f285e[_0x2f9c3e(0x1c2)]&&!_0x1f285e[_0x2f9c3e(0x203)])return console['error'](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x1f7))),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x167)),console[_0x2f9c3e(0x21f)]('Options:'),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x206)),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x1f4)),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x12c)),0x1;const _0x244419=resolveYamlFile(_0x1a738e);if(!existsSync(_0x244419))return showFileNotFoundError(_0x244419,_0x1a738e),0x1;_0x1f285e[_0x2f9c3e(0x200)]&&(console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x159)+_0x1f285e[_0x2f9c3e(0x142)]),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x14f)+_0x244419));let _0x44abc6;try{_0x44abc6=readFileSync(_0x244419,_0x2f9c3e(0x11d));}catch(_0x5a1199){const _0x222e45=_0x5a1199 instanceof Error?_0x5a1199[_0x2f9c3e(0x11a)]:String(_0x5a1199);return console[_0x2f9c3e(0x21f)]('Error\x20reading\x20file:\x20'+_0x222e45),0x1;}let _0x4209ee;try{_0x4209ee=parseDef(_0x44abc6);}catch(_0x33bdf1){const _0x4e49ae=_0x33bdf1 instanceof Error?_0x33bdf1[_0x2f9c3e(0x11a)]:String(_0x33bdf1);return console[_0x2f9c3e(0x21f)](a21_0x1bbe9b['red']('Error\x20parsing\x20YAML:\x20'+_0x4e49ae)),0x1;}if(_0x1f285e['attribute']===!![]||_0x1f285e['attribute']===''){const _0x4bb959=_0x4209ee['attributes']?.[_0x2f9c3e(0x1bc)](_0x1d051a=>_0x1d051a[_0x2f9c3e(0x11b)])||[];if(_0x4bb959['length']===0x0)console[_0x2f9c3e(0x21f)](a21_0x1bbe9b[_0x2f9c3e(0x1af)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x2f9c3e(0x21f)](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x126))),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x18a));for(const _0x519d31 of _0x4bb959){console[_0x2f9c3e(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x2f9c3e(0x223)](_0x519d31));}console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x1c6)+_0x1a738e+'\x20--attribute\x20\x22'+_0x4bb959[0x0]+'\x22');}return 0x1;}if(_0x1f285e['behavior']===!![]||_0x1f285e[_0x2f9c3e(0x1c2)]===''){const _0x203244=_0x4209ee['behaviors']?.[_0x2f9c3e(0x1bc)](_0x3552a4=>_0x3552a4[_0x2f9c3e(0x11b)])||[];if(_0x203244['length']===0x0)console['error'](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x143)));else{console[_0x2f9c3e(0x21f)](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x213))),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x125));for(const _0x4dcf22 of _0x203244){console[_0x2f9c3e(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x2f9c3e(0x223)](_0x4dcf22));}console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x1c6)+_0x1a738e+_0x2f9c3e(0x115)+_0x203244[0x0]+'\x22');}return 0x1;}const _0xee5628=createCommandSpinner(a21_0x1bbe9b[_0x2f9c3e(0x20f)]('Fetching\x20sample\x20data...'),{'verbose':_0x1f285e[_0x2f9c3e(0x200)]});_0xee5628[_0x2f9c3e(0x15b)]();const _0x4b67fa={'onProgress':_0x39f670=>{const _0x5733ae=_0x2f9c3e;_0xee5628[_0x5733ae(0x154)]=formatProgressMessage(_0x39f670);}};if(_0x1f285e[_0x2f9c3e(0x1a1)])_0x4b67fa[_0x2f9c3e(0x1a1)]=!![];if(_0x1f285e[_0x2f9c3e(0x225)]&&typeof _0x1f285e['attribute']===_0x2f9c3e(0x1b3))_0x4b67fa['attribute']=_0x1f285e['attribute'];if(_0x1f285e[_0x2f9c3e(0x1c2)]&&typeof _0x1f285e[_0x2f9c3e(0x1c2)]===_0x2f9c3e(0x1b3))_0x4b67fa[_0x2f9c3e(0x1c2)]=_0x1f285e['behavior'];if(_0x1f285e[_0x2f9c3e(0x203)])_0x4b67fa[_0x2f9c3e(0x203)]=!![];if(_0x1f285e[_0x2f9c3e(0x1e8)])_0x4b67fa[_0x2f9c3e(0x1e8)]=_0x1f285e[_0x2f9c3e(0x1e8)];let _0x13f7bf;try{_0x13f7bf=await _0x5c23f5['segment'][_0x2f9c3e(0x149)](_0x44abc6,_0x4b67fa),_0xee5628[_0x2f9c3e(0x1fe)]();}catch(_0x545147){_0xee5628[_0x2f9c3e(0x1fe)]();throw _0x545147;}return await this[_0x2f9c3e(0x14e)](_0x13f7bf,{'master':_0x1f285e[_0x2f9c3e(0x1a1)],'attribute':typeof _0x1f285e[_0x2f9c3e(0x225)]==='string'?_0x1f285e[_0x2f9c3e(0x225)]:undefined,'behavior':typeof _0x1f285e[_0x2f9c3e(0x1c2)]===_0x2f9c3e(0x1b3)?_0x1f285e['behavior']:undefined,'enriched':_0x1f285e[_0x2f9c3e(0x203)]}),_0x13f7bf[_0x2f9c3e(0x13e)]?0x0:0x1;}async[a21_0x36ce6e(0x14e)](_0x4fc200,_0x20bb8f){const _0x42e66f=a21_0x36ce6e;console[_0x42e66f(0x21f)]('\x0a'+a21_0x1bbe9b[_0x42e66f(0x227)](_0x42e66f(0x190))+'\x20'+_0x4fc200[_0x42e66f(0x11b)]),console[_0x42e66f(0x21f)]('═'[_0x42e66f(0x140)](0x3c));if(_0x20bb8f[_0x42e66f(0x1a1)]&&_0x4fc200['sampleData']){const _0x4ef669=a21_0x1bbe9b[_0x42e66f(0x20f)]('Master:')+'\x20'+a21_0x1bbe9b['bold'](_0x4fc200['master']['database']+'.'+_0x4fc200[_0x42e66f(0x1a1)][_0x42e66f(0x219)]);await this[_0x42e66f(0x16a)](_0x4ef669,_0x4fc200[_0x42e66f(0x17c)]);}else{if(_0x20bb8f[_0x42e66f(0x225)]&&_0x4fc200[_0x42e66f(0x17c)]){const _0x409393=a21_0x1bbe9b[_0x42e66f(0x20f)](_0x42e66f(0x116))+'\x20'+a21_0x1bbe9b['bold'](_0x20bb8f[_0x42e66f(0x225)]);await this[_0x42e66f(0x16a)](_0x409393,_0x4fc200[_0x42e66f(0x17c)]);}else{if(_0x20bb8f[_0x42e66f(0x1c2)]&&_0x4fc200[_0x42e66f(0x17c)]){const _0x4c0d6d=a21_0x1bbe9b[_0x42e66f(0x20f)](_0x42e66f(0x17d))+'\x20'+a21_0x1bbe9b[_0x42e66f(0x227)](_0x20bb8f['behavior']);await this[_0x42e66f(0x16a)](_0x4c0d6d,_0x4fc200[_0x42e66f(0x17c)]);}else{if(_0x20bb8f[_0x42e66f(0x203)]&&_0x4fc200[_0x42e66f(0x17c)]){const _0x22857d=a21_0x1bbe9b['dim']('Enriched:')+'\x20'+a21_0x1bbe9b['bold'](_0x42e66f(0x1f0));await this[_0x42e66f(0x16a)](_0x22857d,_0x4fc200[_0x42e66f(0x17c)]);}else!_0x4fc200[_0x42e66f(0x17c)]&&console[_0x42e66f(0x21f)](_0x42e66f(0x168));}}}if(_0x4fc200['errors'][_0x42e66f(0x1df)]>0x0){console[_0x42e66f(0x21f)]('─'['repeat'](0x3c)),console[_0x42e66f(0x21f)]('\x0a'+a21_0x1bbe9b[_0x42e66f(0x1af)]('Errors:'));for(const _0x29fe67 of _0x4fc200['errors']){console[_0x42e66f(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x42e66f(0x1af)]('•')+'\x20'+_0x29fe67);}}}async[a21_0x36ce6e(0x16a)](_0x5d326c,_0x5d5b2e){const _0xa0f933=a21_0x36ce6e;if(_0x5d5b2e[_0xa0f933(0x1df)]===0x0){console[_0xa0f933(0x21f)]('\x0a'+_0x5d326c),console[_0xa0f933(0x21f)](_0xa0f933(0x118));return;}console['error']('\x0a'+_0x5d326c);const _0x3ad42f=Object[_0xa0f933(0x18e)](_0x5d5b2e[0x0])[_0xa0f933(0x1bc)](_0x15698a=>({'name':_0x15698a,'type':typeof _0x5d5b2e[0x0][_0x15698a]===_0xa0f933(0x171)?_0xa0f933(0x173):_0xa0f933(0x197)})),_0x2091a9={'queryId':'preview','columns':_0x3ad42f,'data':_0x5d5b2e,'stats':{'state':_0xa0f933(0x201),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5d5b2e[_0xa0f933(0x1df)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x448dbf=formatAsTable(_0x2091a9,_0x5d5b2e[_0xa0f933(0x1df)],!![]);await writeOutput(_0x448dbf,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]='segment:parent:run';[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x12b);async['execute'](_0x4c0ca1){const _0x6be89c=a21_0x36ce6e,{options:_0x1cdee7,args:_0x476cb5,tdx:_0x1a499e}=_0x4c0ca1,_0x43317e=_0x1cdee7,_0x598abf=_0x476cb5[0x0]||_0x1cdee7[_0x6be89c(0x131)];if(!_0x598abf)return showParentSegmentNotSetError(_0x6be89c(0x160)+_0x6be89c(0x1a9)),0x1;const _0x146eea=resolveYamlFile(_0x598abf);if(existsSync(_0x146eea)){_0x43317e[_0x6be89c(0x200)]&&console['error'](_0x6be89c(0x22f)+_0x146eea);let _0x3a4402;try{_0x3a4402=readFileSync(_0x146eea,_0x6be89c(0x11d));}catch(_0x421375){const _0x2d4795=_0x421375 instanceof Error?_0x421375[_0x6be89c(0x11a)]:String(_0x421375);return console[_0x6be89c(0x21f)]('Error\x20reading\x20file:\x20'+_0x2d4795),0x1;}const _0x44db5e=await withSpinner('Analyzing\x20changes...',()=>_0x1a499e['segment'][_0x6be89c(0x196)](_0x3a4402),{'verbose':_0x43317e[_0x6be89c(0x200)]}),_0x47555c=_0x44db5e['data'],{isNew:_0x517a69,name:_0x3c3347,hasChanges:_0x216773,diffFormatted:_0x1e2eaa}=_0x47555c;if(_0x216773){_0x517a69?console[_0x6be89c(0x21f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x3c3347+'\x27:'):console[_0x6be89c(0x21f)](_0x6be89c(0x209)+_0x3c3347+'\x27:');console[_0x6be89c(0x21f)]('─'[_0x6be89c(0x140)](0x3c)),console[_0x6be89c(0x21f)](_0x1e2eaa),console[_0x6be89c(0x21f)]('─'[_0x6be89c(0x140)](0x3c));const _0x25a6e3=_0x517a69?_0x6be89c(0x163)+_0x3c3347+'\x27\x20and\x20run\x20workflow?':_0x6be89c(0x150)+_0x3c3347+_0x6be89c(0x1fd);if(!_0x43317e[_0x6be89c(0x1de)]){const _0x3f4e14=await confirmKey(_0x25a6e3);if(!_0x3f4e14)return console[_0x6be89c(0x21f)](_0x6be89c(0x208)),0x1;}const _0x435a41=_0x517a69?_0x6be89c(0x1d3):_0x6be89c(0x22b);await withSpinner(_0x435a41+_0x6be89c(0x234)+_0x3c3347+'\x27...',()=>_0x47555c[_0x6be89c(0x1c5)](),{'verbose':_0x43317e[_0x6be89c(0x200)]});const _0x2fd1c7=_0x517a69?'Created':_0x6be89c(0x1f9);console[_0x6be89c(0x21f)]('✔\x20'+_0x2fd1c7+_0x6be89c(0x234)+_0x3c3347+'\x27');}else console[_0x6be89c(0x21f)](_0x6be89c(0x239)+_0x3c3347+'\x27\x20is\x20up\x20to\x20date');}const _0x2ce620=await withSpinner(_0x6be89c(0x1dd)+_0x598abf+'\x27...',()=>_0x1a499e['segment'][_0x6be89c(0x1ec)](_0x598abf),{'verbose':_0x43317e['verbose']}),_0x397581=_0x2ce620[_0x6be89c(0x133)],_0x323468=getConsoleUrl(_0x43317e[_0x6be89c(0x142)],_0x6be89c(0x13d)+_0x397581['workflowId']+_0x6be89c(0x20e)+_0x397581['workflowSessionId']+_0x6be89c(0x15e)+_0x397581[_0x6be89c(0x1ae)]);return console[_0x6be89c(0x21f)](_0x6be89c(0x153)),console[_0x6be89c(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x233))+'\x20'+_0x397581[_0x6be89c(0x185)]),console['error']('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x136))+'\x20'+_0x397581[_0x6be89c(0x19c)]),console['error']('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x1c9))+'\x20'+_0x397581[_0x6be89c(0x184)]),console[_0x6be89c(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x13c))+'\x20'+_0x397581[_0x6be89c(0x1ae)]),console[_0x6be89c(0x21f)]('\x20\x20'+_0x323468),console['error']('\x0a'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x14d))+_0x6be89c(0x1ad)+_0x397581[_0x6be89c(0x1ae)]+_0x6be89c(0x1da)),0x0;}}function a21_0x5d1e(){const _0x5bfdbd=['\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','✔\x20Renamed\x20directory\x20to\x20','customerGroup','✔\x20No\x20changes\x20-\x20\x27','coveragePercent','%)\x20','\x20Opening\x20','\x20--behavior\x20\x22','Attribute:','query','\x20\x20No\x20sample\x20data\x20available','Error:\x20Parent\x20segment\x20name\x20is\x20required','message','name','\x20Configuration\x20is\x20valid','utf-8','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20No\x20changes\x20-\x20','displaySummary','endsWith','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Available\x20behaviors:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Created','test','displayPreviewHints','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Master\x20Table','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Listing\x20fields\x20for\x20\x27','parentSegment','addBehaviors','data','segment:parent:fields','jobId','Status:','\x20=\x20','Creating\x20parent\x20segment\x20\x27','1476615ZkbLcA','format','schemaValid','Attempt:','/app/workflows/','allValid','parent_segments','repeat','.yaml','site','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','To\x20view\x20sample\x20data:','Options\x20(one\x20required):\x0a','displayBehaviorsStats','`\x20to\x20download\x20the\x20configuration\x20first','✔\x20Query\x20completed:\x20Processed\x20','previewParentYaml','displayMasterInfo','segment:parent:desc','execute','To\x20cancel:','displayPreviewResults','YAML\x20file:\x20','Apply\x20changes\x20to\x20\x27','Error:','output','\x0a✔\x20Workflow\x20started','text','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','scheduleOption','Fetching\x20current\x20configuration\x20for\x20\x27','isDirectory','Site:\x20','stats','start','Errors:','use','/attempt/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Join\x20on:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Create\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','behaviors','localeCompare','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x0aNo\x20sample\x20data\x20available','Listing\x20parent\x20segments\x20matching\x20\x27','displaySampleData','population','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Resolving\x20parent\x20segment\x20\x27','2188416tbMGpp','253486Kowcec','number','run','double','limit','/{name}.yml\x0a','4868316ltDevr','tdx\x20segment\x20parent\x20preview\x20','addBehaviorsFile','\x5c$&','web','foreignKey','sampleData','Behavior:','jsonl','Table:\x20','using\x20the\x20default\x20path:\x20','Parent\x20segment:\x20','getParentSQL','\x20Context\x20set:\x20','workflowSessionId','audienceId','toFixed','label','column','darwin','Available\x20attributes:','filter','addAttributesFile','processedRows','keys','SQL\x20query:\x0a','Preview:','\x20--attribute\x20\x22<name>\x22','\x27...','listFields','scheduleType','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','pushParentYaml','varchar','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','displayAttributesStats','\x20--interval\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','status','segment:parent:create','segment:parent:show','attributesFile','sort','master','.yml','\x0a⚠️\x20\x20Both\x20','customersWithEvents','information_schema','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','addAttributes','Error\x20reading\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','schemaError','Output\x20file:\x20','Pattern:\x20','\x20tdx\x20wf\x20attempt\x20','workflowAttemptId','red','No\x20parent\x20segments\x20found','all','segment:parent:pull','string','segment','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x0a⚠️\x20\x20Migrating:\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','listParents','✔\x20Created\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','map','timezone','Source:','getParentFull','/app/dw/parentSegments/','\x20\x20\x20\x20-\x20','behavior','239270uVpPuZ','Columns:','apply','\x0aUsage:\x20tdx\x20ps\x20preview\x20','segment:parent:preview','validateParentYaml','Session:','displayColumns','database','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Behaviors','✔\x20Found\x20','customerGroupFile','setJobId','totalEvents','Join:','Creating','yellow','21tMPhRa','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','behaviorsFile','SELECT\x20*\x20FROM\x20(\x0a','win32','\x20kill','Options:\x0a','/\x20→\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','yes','length','\x20rows\x20','Updating\x20parent\x20segment\x20\x27','platform','segment:parent:list','532152VUHEsV','\x20is\x20already\x20up\x20to\x20date','List\x20parent\x20segments','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','interval','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','attributes','resolveParentId','runParent','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','👥\x20','displayValidateResults','Master\x20+\x20Attributes','green','description','2268888FVJbRE','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Executing\x20parent\x20segment\x20query...','\x20[Job\x20ID:\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','unref','Updated','\x0aChanges\x20to\x20\x27','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Coverage:','\x27\x20and\x20run\x20workflow?','stop','log','verbose','FINISHED','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','enriched','matchedCount','Fetching\x20SQL\x20for\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Rows:','Aborted.','\x0aChanges\x20to\x20apply\x20to\x20\x27','Analyzing\x20changes...','session','pullParentYaml','Listing\x20parent\x20segments...','/sessions/','dim','Show\x20parent\x20segment\x20schema\x20(column\x20types)','segment:parent:validate','List\x20available\x20fields\x20for\x20segmentation','Error:\x20--behavior\x20requires\x20a\x20name\x0a','trim','columns','Validate:','joinKey','json','table','replace','Events:','Overwrite\x20\x27','Name:\x20','-1d','error','match','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20rows)','cyan','\x20field','attribute','Get\x20SQL\x20query\x20for\x20parent\x20segment','bold','parent_segment','elapsedTimeMillis','Attributes','Updating','Database:\x20','segment:parent:sql','customerPercent','Found\x20YAML\x20file:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Error:\x20File\x20not\x20found:\x20','updateParent','Audience\x20ID:','\x20parent\x20segment\x20\x27','\x20parent\x20segment'];a21_0x5d1e=function(){return _0x5bfdbd;};return a21_0x5d1e();}export class ParentSegmentFieldsCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x134);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x212);async[a21_0x36ce6e(0x14c)](_0x53621c){const _0x5e72db=a21_0x36ce6e,{options:_0x5526d1,args:_0x3a1195,tdx:_0x204fcf}=_0x53621c,_0x10f958=_0x3a1195[0x0]||_0x5526d1[_0x5e72db(0x131)];if(!_0x10f958)return showParentSegmentNotSetError(_0x5e72db(0x164)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x5526d1[_0x5e72db(0x200)]&&(console['error'](_0x5e72db(0x159)+_0x5526d1['site']),console[_0x5e72db(0x21f)](_0x5e72db(0x181)+_0x10f958));const _0x1f39c3=await withSpinner(_0x5e72db(0x130)+_0x10f958+_0x5e72db(0x192),()=>_0x204fcf[_0x5e72db(0x1b4)][_0x5e72db(0x193)](_0x10f958),{'verbose':_0x5526d1[_0x5e72db(0x200)]}),_0x1099d6=_0x1f39c3['data'];console['error'](_0x5e72db(0x1ce)+_0x1099d6[_0x5e72db(0x1df)]+_0x5e72db(0x224)+(_0x1099d6[_0x5e72db(0x1df)]!==0x1?'s':''));if(_0x5526d1[_0x5e72db(0x218)]||_0x5526d1['jsonl'])return await handleSDKOutput(_0x1099d6,_0x5526d1),0x0;return displayFieldsHumanReadable(_0x1099d6,_0x10f958),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']='segment:parent:view';[a21_0x36ce6e(0x1f2)]='Show\x20parent\x20segment\x20details';async[a21_0x36ce6e(0x14c)](_0x569d0e){const _0x5e14e8=a21_0x36ce6e,{options:_0x22735d,args:_0x1edf6b,tdx:_0xbed9a2}=_0x569d0e,_0x51c8e3=_0x22735d,_0x53654c=_0x1edf6b[0x0]||_0x22735d['parentSegment'];if(!_0x53654c)return showParentSegmentNotSetError(_0x5e14e8(0x155)+_0x5e14e8(0x12d)+_0x5e14e8(0x1db)+_0x5e14e8(0x1cc)),0x1;_0x22735d[_0x5e14e8(0x200)]&&(console[_0x5e14e8(0x21f)](_0x5e14e8(0x159)+_0x22735d[_0x5e14e8(0x142)]),console[_0x5e14e8(0x21f)](_0x5e14e8(0x181)+_0x53654c));const _0x868689=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x53654c+_0x5e14e8(0x192),()=>_0xbed9a2['segment']['getParentFull'](_0x53654c),{'verbose':_0x22735d[_0x5e14e8(0x200)]}),_0xfa97b0=_0x868689[_0x5e14e8(0x133)];if(_0x51c8e3[_0x5e14e8(0x17a)]){const _0x472d92=getConsoleNextUrl(_0x51c8e3[_0x5e14e8(0x142)],_0x5e14e8(0x1c0)+_0xfa97b0['id']);return console[_0x5e14e8(0x21f)](a21_0x1bbe9b[_0x5e14e8(0x1f1)]('✔')+_0x5e14e8(0x114)+a21_0x1bbe9b[_0x5e14e8(0x223)](_0x472d92)),openBrowser(_0x472d92),0x0;}return await handleSingleObjectOutput(_0xfa97b0,_0x22735d),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x14b);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x210);async[a21_0x36ce6e(0x14c)](_0x19e4b5){const _0x58a979=a21_0x36ce6e,{options:_0x411f04,args:_0x3f4115,tdx:_0x23a18d}=_0x19e4b5,_0x38add8=_0x3f4115[0x0]||_0x411f04[_0x58a979(0x131)];if(!_0x38add8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x58a979(0x236)),0x1;_0x411f04[_0x58a979(0x200)]&&(console[_0x58a979(0x21f)](_0x58a979(0x159)+_0x411f04[_0x58a979(0x142)]),console[_0x58a979(0x21f)](_0x58a979(0x181)+_0x38add8));const _0x22f2e0=await withSpinner(_0x58a979(0x16e)+_0x38add8+_0x58a979(0x192),()=>_0x23a18d['segment'][_0x58a979(0x1eb)](_0x38add8),{'verbose':_0x411f04['verbose']}),_0x4fc03e=_0x22f2e0['data'],_0x113168=await withSpinner(_0x58a979(0x205)+_0x38add8+_0x58a979(0x192),()=>_0x23a18d[_0x58a979(0x1b4)][_0x58a979(0x182)](_0x4fc03e),{'verbose':_0x411f04[_0x58a979(0x200)]}),_0x470d02=await executeSchemaQuery(_0x113168[_0x58a979(0x133)],_0x23a18d,_0x411f04);return await handleQueryOutput(_0x470d02,_0x411f04),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x22d);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x226);async[a21_0x36ce6e(0x14c)](_0x3424d0){const _0x4665dc=a21_0x36ce6e,{options:_0x176432,args:_0xb3ca25,tdx:_0x54840e}=_0x3424d0,_0x114b8f=_0xb3ca25[0x0]||_0x176432[_0x4665dc(0x131)];if(!_0x114b8f)return showParentSegmentNotSetError(_0x4665dc(0x16d)+_0x4665dc(0x195)),0x1;_0x176432[_0x4665dc(0x200)]&&(console[_0x4665dc(0x21f)](_0x4665dc(0x159)+_0x176432[_0x4665dc(0x142)]),console['error'](_0x4665dc(0x181)+_0x114b8f));const _0xb01ee5=await withSpinner(_0x4665dc(0x16e)+_0x114b8f+'\x27...',()=>_0x54840e[_0x4665dc(0x1b4)]['resolveParentId'](_0x114b8f),{'verbose':_0x176432['verbose']}),_0x2a1903=_0xb01ee5[_0x4665dc(0x133)],_0x4668ae=await withSpinner(_0x4665dc(0x205)+_0x114b8f+_0x4665dc(0x192),()=>_0x54840e[_0x4665dc(0x1b4)][_0x4665dc(0x182)](_0x2a1903),{'verbose':_0x176432['verbose']}),_0x13a40f=_0x4668ae[_0x4665dc(0x133)];return _0x176432[_0x4665dc(0x13a)]===_0x4665dc(0x218)||_0x176432[_0x4665dc(0x13a)]===_0x4665dc(0x17e)?await handleSDKOutput([{'sql':_0x13a40f}],_0x176432):console['log'](_0x13a40f),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x19e);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x198);async[a21_0x36ce6e(0x14c)](_0xe1f05d){const _0x5201e6=a21_0x36ce6e,{options:_0x509130,args:_0x4c6648,tdx:_0xcbb678}=_0xe1f05d,_0x5e5660=_0x4c6648[0x0]||_0x509130['parentSegment'];if(!_0x5e5660)return showParentSegmentNotSetError(_0x5201e6(0x19b)+'\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;_0x509130[_0x5201e6(0x200)]&&(console[_0x5201e6(0x21f)](_0x5201e6(0x159)+_0x509130[_0x5201e6(0x142)]),console[_0x5201e6(0x21f)]('Parent\x20segment:\x20'+_0x5e5660));const _0x55b538=await withSpinner(_0x5201e6(0x16e)+_0x5e5660+'\x27...',()=>_0xcbb678[_0x5201e6(0x1b4)][_0x5201e6(0x1eb)](_0x5e5660),{'verbose':_0x509130['verbose']}),_0x354162=_0x55b538[_0x5201e6(0x133)],_0x45a4da=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5e5660+'\x27...',()=>_0xcbb678['segment'][_0x5201e6(0x182)](_0x354162),{'verbose':_0x509130[_0x5201e6(0x200)]});let _0x2a75a5=_0x45a4da[_0x5201e6(0x133)];const _0x5748ff=resolveLimit(_0x509130[_0x5201e6(0x174)],DEFAULT_DISPLAY_LIMIT),_0x13de24=/\bLIMIT\s+\d+/i[_0x5201e6(0x129)](_0x2a75a5);!_0x13de24&&(_0x2a75a5=_0x2a75a5[_0x5201e6(0x214)]()[_0x5201e6(0x21a)](/;+$/,''),_0x2a75a5=_0x5201e6(0x1d8)+_0x2a75a5+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x5748ff);_0x509130[_0x5201e6(0x200)]&&console[_0x5201e6(0x21f)](_0x5201e6(0x18f)+_0x2a75a5);const _0x4f0fee=await withProgressSpinner(_0x5201e6(0x1f5),async _0x179fb8=>{const _0x41d543=_0x5201e6,_0xd2a117=await _0xcbb678[_0x41d543(0x117)][_0x41d543(0x14c)](_0x2a75a5,{'catalog':'td','schema':_0x41d543(0x1a5),'onJobId':_0x5f020c=>{const _0x548b62=_0x41d543;_0x179fb8[_0x548b62(0x1d0)](_0x5f020c);}});return _0xd2a117;},{'verbose':_0x509130[_0x5201e6(0x200)]}),_0x424660=_0x4f0fee[_0x5201e6(0x133)],_0x4c449c=_0x424660[_0x5201e6(0x135)]?_0x5201e6(0x1f6)+_0x424660[_0x5201e6(0x135)]+']':'';return console[_0x5201e6(0x21f)](_0x5201e6(0x148)+_0x424660[_0x5201e6(0x15a)][_0x5201e6(0x18d)]['toLocaleString']()+_0x5201e6(0x1e0)+('in\x20'+formatElapsed(_0x424660[_0x5201e6(0x15a)][_0x5201e6(0x229)])+_0x4c449c)),await handleQueryOutput(_0x424660,_0x509130),0x0;}}
|