@treasuredata/tdx 0.7.2 → 0.7.4
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 +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-api-client.d.ts +20 -1
- package/dist/client/cdp-api-client.d.ts.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/cdp-api-client.js.map +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.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/context-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/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.d.ts +5 -4
- package/dist/commands/parent-segment-command.d.ts.map +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/parent-segment-command.js.map +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-pwd-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/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/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.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/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/api.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/job.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.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.d.ts.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/segment.js.map +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/cdp.d.ts +59 -0
- package/dist/types/cdp.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.d.ts +1 -0
- package/dist/utils/fields-display.d.ts.map +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/fields-display.js.map +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.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/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.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/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x2a2e16=a24_0x3728;(function(_0x1af4c0,_0x1079f3){const _0x26f47f=a24_0x3728,_0x1678b2=_0x1af4c0();while(!![]){try{const _0x37bce3=parseInt(_0x26f47f(0x1b8))/0x1+-parseInt(_0x26f47f(0x1b3))/0x2+-parseInt(_0x26f47f(0x186))/0x3*(-parseInt(_0x26f47f(0x169))/0x4)+parseInt(_0x26f47f(0x146))/0x5+-parseInt(_0x26f47f(0x1c4))/0x6*(-parseInt(_0x26f47f(0x1c1))/0x7)+parseInt(_0x26f47f(0x15c))/0x8*(-parseInt(_0x26f47f(0x176))/0x9)+-parseInt(_0x26f47f(0xfd))/0xa;if(_0x37bce3===_0x1079f3)break;else _0x1678b2['push'](_0x1678b2['shift']());}catch(_0x95e1a){_0x1678b2['push'](_0x1678b2['shift']());}}}(a24_0x50dc,0x9529f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/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'../utils/constants.js';import{confirm}from'../utils/prompt.js';function a24_0x50dc(){const _0x5d19c4=['name','llm:history','targetWebSearchTool','output','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','[content]','error','llm:projects','targetKnowledgeBase','\x20->\x20KB:','Backing\x20up\x20project\x20\x27','jsonl','llm:project:delete','table','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','map','Analyzing\x20project\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','List\x20available\x20LLM\x20models','[tool_call]','...','[unknown]','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','bold','llmProject','\x0aCancelled','createdAt','tdx\x20chats','systemPrompt','numeric','\x27...','filter','log','temperature','toLocaleDateString','Resolving\x20project\x20\x27','prompt','projectName','data','entries','floor','yellow','Getting\x20default\x20project...','json','Deleting\x20project\x20\x27','history','chatId','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','h\x20ago','Fetching\x20available\x20models...','Fetching\x20agent...','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','Resolving\x20agent\x20\x27','verbose','Agent\x20deleted:\x20','input','Output\x20directory\x20\x27','createAgent','existsSync','Project\x20backed\x20up\x20to:\x20','3318355XJhXJp','prompts','agent','stringify','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','INVALID_ARGUMENT','\x20\x20Agents:\x20','chats','just\x20now','join','d\x20ago','magenta','image','attributes','getOrCreateDefaultProject','Select\x20a\x20chat\x20session:','sourceSite','Backup\x20cancelled.','setCurrentProject','Creating\x20project\x20\x27','cause','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','8qjEVIY','message','\x20-\x20','keys','Fetching\x20chat\x20sessions...','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','\x20->\x20ImageGen:','select','Project\x20context\x20set\x20to:\x20','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','Project\x20deleted:\x20','\x20\x20Prompts:\x20','4vNyady','Set\x20current\x20project\x20context','llm:agent:show','deleteProject','[error]\x20\x20','starterMessage','last','Error:\x20Project\x20name\x20is\x20required','Fetching\x20most\x20recent\x20chat...','models','(no\x20agent)','targetAgent','No\x20messages\x20found\x20in\x20chat\x20history.','6990615nRYacz','agentId','Show\x20agent\x20details','LLM_PROJECT_NOT_FOUND','m\x20ago','execute','tool_call','default','stack','Agent\x20updated:\x20','A\x20project\x20named\x20\x27','format','tdx\x20llm\x20history','Restore\x20cancelled.','string','llm:project:create','1312347RaIccV','limit','Project\x20not\x20found:\x20','Error:\x20Agent\x20name\x20is\x20required','dryRun','backupProject','projectId','Invalid\x20path\x20syntax:\x20','resolveAgentId','llm:agent:create','getTime','updatedAt','integrations','getCurrentProject','all','description','[input]\x20\x20','\x20\x20Integrations:\x20','toLowerCase','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','counts','\x27\x20already\x20exists.\x20Overwrite?','targetImageGenerator','llm:agent:update','Delete\x20an\x20LLM\x20project','resolveProjectId','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','restoreProject','llm:agent:delete','set','outputDir','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','\x20bytes)','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','No\x20chat\x20sessions\x20found.','__load_more__','push','knowledgeBases','Checking\x20for\x20existing\x20projects...','blue','Fetching\x20chat\x20history\x20for\x20\x27','Agent\x20created:\x20','exportedFrom','[output]\x20','1039468uikJvz','Project\x20created:\x20','content','length','split','874545obrHFW','List\x20all\x20LLM\x20projects','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','dim','model','Setting\x20project\x20context\x20to\x20\x27','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','yes','\x20\x20Cause:\x20','29813rOZCwI','\x20\x20Knowledge\x20Bases:\x20','Fetching\x20projects...','1386YATJoS','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','List\x20agents\x20in\x20current\x20project','Creating\x20agent\x20\x27','Update\x20an\x20existing\x20agent','\x0aStack\x20trace:','Use\x20format:\x20project-name/agent-name','10520500ZsZZhO','Create\x20a\x20new\x20LLM\x20project','tool','Validating\x20backup\x20from\x20\x27','maxToolIterations','\x20--last','agents','includes','slice','Project\x20restored:\x20','llm:models','llm','projects'];a24_0x50dc=function(){return _0x5d19c4;};return a24_0x50dc();}import*as a24_0x16efc0 from'node:fs';function handleSDKError(_0x43e233,_0x2171f9){const _0x499f3e=a24_0x3728;if(_0x43e233 instanceof SDKError)console['error']('Error:\x20'+_0x43e233[_0x499f3e(0x15d)]),_0x2171f9[_0x499f3e(0x13f)]&&(_0x43e233[_0x499f3e(0x15a)]&&console[_0x499f3e(0x110)](_0x499f3e(0x1c0)+_0x43e233['cause']),_0x43e233[_0x499f3e(0x17e)]&&(console['error'](_0x499f3e(0xfb)),console['error'](_0x43e233[_0x499f3e(0x17e)])));else throw _0x43e233;}function formatChatHistoryEntry(_0x5a47d4,_0x189cd9){const _0x490a6c=a24_0x3728,_0x293cf2=getChalk(_0x189cd9),_0x56fca1=_0x293cf2[_0x490a6c(0x1bb)](_0x5a47d4['at']);if(_0x490a6c(0x141)in _0x5a47d4){const _0x48f6dc=_0x293cf2['cyan'](_0x490a6c(0x196));return _0x56fca1+'\x20'+_0x48f6dc+':\x20'+_0x5a47d4[_0x490a6c(0x141)];}if('content'in _0x5a47d4){const _0x5c3e03=_0x293cf2['green'](_0x490a6c(0x10f));return _0x56fca1+'\x20'+_0x5c3e03+':\x20'+_0x5a47d4[_0x490a6c(0x1b5)];}if(_0x490a6c(0x17c)in _0x5a47d4){const _0x26fa4d=_0x293cf2[_0x490a6c(0x133)](_0x490a6c(0x11d)),{functionName:_0x49ba6a,functionArguments:_0x5b00be,targetFunction:_0x5e66b2}=_0x5a47d4[_0x490a6c(0x17c)];let _0x6c6cc=_0x56fca1+'\x20'+_0x26fa4d+':\x20'+_0x293cf2[_0x490a6c(0x121)](_0x49ba6a);if(_0x5b00be&&Object[_0x490a6c(0x15f)](_0x5b00be)[_0x490a6c(0x1b6)]>0x0){const _0x547c36=Object[_0x490a6c(0x131)](_0x5b00be)[_0x490a6c(0x119)](([_0x410709,_0x265017])=>_0x410709+'='+JSON[_0x490a6c(0x149)](_0x265017))[_0x490a6c(0x14f)](',\x20');_0x6c6cc+='('+_0x547c36+')';}_0x5e66b2&&(_0x6c6cc+=_0x293cf2[_0x490a6c(0x1bb)]('\x20['+_0x5e66b2+']'));let _0x1e50c3='';if(_0x5a47d4[_0x490a6c(0x17c)][_0x490a6c(0x112)])_0x1e50c3=_0x490a6c(0x113)+_0x5a47d4[_0x490a6c(0x17c)]['targetKnowledgeBase'][_0x490a6c(0x10a)];else{if(_0x5a47d4[_0x490a6c(0x17c)][_0x490a6c(0x174)])_0x1e50c3='\x20->\x20Agent:'+_0x5a47d4[_0x490a6c(0x17c)][_0x490a6c(0x174)][_0x490a6c(0x10a)];else{if(_0x5a47d4['tool_call'][_0x490a6c(0x10c)])_0x1e50c3='\x20->\x20WebSearch:'+_0x5a47d4[_0x490a6c(0x17c)]['targetWebSearchTool']['name'];else _0x5a47d4[_0x490a6c(0x17c)][_0x490a6c(0x19d)]&&(_0x1e50c3=_0x490a6c(0x162)+_0x5a47d4['tool_call']['targetImageGenerator']['name']);}}return _0x6c6cc+_0x1e50c3;}if('tool'in _0x5a47d4){const _0x4c6112=_0x293cf2[_0x490a6c(0x151)]('[tool]\x20\x20\x20'),{functionName:_0x46cbcb,functionArguments:_0x297c27,content:_0x23ced1,newChat:_0x3ea3b2}=_0x5a47d4[_0x490a6c(0xff)];let _0x19b3e5=_0x56fca1+'\x20'+_0x4c6112+':\x20'+_0x293cf2[_0x490a6c(0x121)](_0x46cbcb);if(_0x297c27){const _0x26a8d6=typeof _0x297c27===_0x490a6c(0x184)?_0x297c27:JSON[_0x490a6c(0x149)](_0x297c27);_0x19b3e5+='('+_0x26a8d6+')';}return _0x23ced1&&(_0x19b3e5+='\x0a'+_0x293cf2[_0x490a6c(0x1bb)](_0x23ced1)),_0x3ea3b2&&(_0x19b3e5+=_0x293cf2['dim']('\x20→\x20chat:\x20'+_0x3ea3b2['id'])),_0x19b3e5;}if('output'in _0x5a47d4){const _0x2d6813=_0x293cf2['blue'](_0x490a6c(0x1b2));return _0x56fca1+'\x20'+_0x2d6813+':\x20'+_0x5a47d4[_0x490a6c(0x10d)][_0x490a6c(0x10a)]+'\x20('+_0x5a47d4[_0x490a6c(0x10d)][_0x490a6c(0x1b5)]['length']+_0x490a6c(0x1a7);}if(_0x490a6c(0x152)in _0x5a47d4){const _0x1a52b6=_0x293cf2[_0x490a6c(0x1ae)]('[image]\x20\x20'),{width:_0x4d6b34,height:_0x55ef81,headerText:_0x229a54}=_0x5a47d4['image'],_0x4ffbee=_0x229a54?_0x490a6c(0x15e)+_0x229a54:'';return _0x56fca1+'\x20'+_0x1a52b6+':\x20'+_0x4d6b34+'x'+_0x55ef81+_0x4ffbee;}if(_0x490a6c(0x110)in _0x5a47d4){const _0xafaf2b=_0x293cf2['red'](_0x490a6c(0x16d));return _0x56fca1+'\x20'+_0xafaf2b+':\x20'+_0x5a47d4[_0x490a6c(0x110)];}return _0x56fca1+'\x20'+_0x293cf2[_0x490a6c(0x1bb)](_0x490a6c(0x11f))+':\x20'+JSON[_0x490a6c(0x149)](_0x5a47d4);}async function executeChatHistoryCommand(_0x1ef2cf,_0x34ac04){const _0x85f1de=a24_0x3728,{options:_0x414704,args:_0x1294ba,tdx:_0x11d027}=_0x1ef2cf,_0x2b4aac=_0x1294ba[0x0],_0x4a11db=_0x414704,_0x49125e=_0x4a11db[_0x85f1de(0x16f)];try{if(_0x49125e&&_0x2b4aac)return console[_0x85f1de(0x110)](_0x85f1de(0x10e)),console['error']('Usage:\x20'+_0x34ac04+_0x85f1de(0x102)),0x1;if(!_0x2b4aac&&!_0x49125e&&_0x414704[_0x85f1de(0x181)]!==undefined){const _0x5332b1=resolveLimit(_0x414704[_0x85f1de(0x187)],DEFAULT_LLM_LIMIT),_0x4fecba=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x11d027[_0x85f1de(0x108)][_0x85f1de(0x14d)](_0x5332b1),{'verbose':_0x414704['verbose']});return await handleSDKOutput(_0x4fecba['data'],_0x414704),0x0;}const _0x5d6241=await getChatIdOrSelect(_0x11d027,_0x414704,_0x49125e,_0x2b4aac);if(!_0x5d6241)return 0x0;return await displayChatHistory(_0x5d6241,_0x11d027,_0x414704),0x0;}catch(_0x58aabb){return handleSDKError(_0x58aabb,_0x414704),0x1;}}async function displayChatHistory(_0x50b06a,_0x1e982f,_0x4658d6){const _0x33778c=a24_0x3728,_0x255d45=await withSpinner(_0x33778c(0x1af)+_0x50b06a+'\x27...',()=>_0x1e982f[_0x33778c(0x108)][_0x33778c(0x137)](_0x50b06a),{'verbose':_0x4658d6[_0x33778c(0x13f)]}),_0x51a3fd=_0x255d45[_0x33778c(0x130)]['data']??[];if(_0x51a3fd[_0x33778c(0x1b6)]===0x0){console[_0x33778c(0x12a)](_0x33778c(0x175));return;}if(_0x4658d6[_0x33778c(0x181)]!==undefined)await handleSDKOutput(_0x51a3fd,_0x4658d6);else{const _0x2aec53=_0x51a3fd[_0x33778c(0x119)](_0x4b4fef=>formatChatHistoryEntry(_0x4b4fef,_0x4658d6)),_0x48eb6b=_0x2aec53[_0x33778c(0x14f)]('\x0a');await writeOutput(_0x48eb6b,_0x4658d6[_0x33778c(0x10d)],_0x33778c(0x117));}}async function getChatIdOrSelect(_0x497545,_0x39273b,_0x5896aa,_0x1b15bf){const _0x49ea62=a24_0x3728;if(_0x1b15bf)return _0x1b15bf;if(_0x5896aa){const _0x3fb3e0=await withSpinner(_0x49ea62(0x171),()=>_0x497545[_0x49ea62(0x108)]['chats'](0x1),{'verbose':_0x39273b[_0x49ea62(0x13f)]});if(_0x3fb3e0['data']['length']===0x0)return console[_0x49ea62(0x12a)](_0x49ea62(0x1a9)),undefined;return _0x3fb3e0[_0x49ea62(0x130)][0x0]['id'];}const _0x2aee2b=await selectChatInteractively(_0x497545,_0x39273b);if(!_0x2aee2b)return console[_0x49ea62(0x12a)](_0x49ea62(0x123)),undefined;return _0x2aee2b;}async function getProjectIdOrDefault(_0x1a9a6b){const _0x42cec6=a24_0x3728,{tdx:_0x240b92,options:_0x13978e}=_0x1a9a6b,_0x56e77d=_0x13978e[_0x42cec6(0x122)];if(_0x56e77d){const _0x377fa4=await withSpinner(_0x42cec6(0x12d)+_0x56e77d+_0x42cec6(0x128),()=>_0x240b92['llm']['resolveProjectId'](_0x56e77d),{'verbose':_0x13978e[_0x42cec6(0x13f)]});return _0x377fa4['data'];}let _0x5d1bbf=_0x240b92[_0x42cec6(0x108)][_0x42cec6(0x193)]();if(_0x5d1bbf)return _0x5d1bbf;const _0xd414b=await withSpinner(_0x42cec6(0x134),()=>_0x240b92[_0x42cec6(0x108)][_0x42cec6(0x154)](),{'verbose':_0x13978e[_0x42cec6(0x13f)]});return _0xd414b['data']['id'];}function toLLMProjectInfo(_0x52ecfc){const _0x3905b2=a24_0x3728;return{'name':_0x52ecfc[_0x3905b2(0x153)][_0x3905b2(0x10a)],'description':_0x52ecfc[_0x3905b2(0x153)][_0x3905b2(0x195)],'createdAt':_0x52ecfc[_0x3905b2(0x153)][_0x3905b2(0x124)],'updatedAt':_0x52ecfc[_0x3905b2(0x153)][_0x3905b2(0x191)]};}function toAgentInfo(_0xc0e292){const _0x15e4de=a24_0x3728;return{'name':_0xc0e292[_0x15e4de(0x153)][_0x15e4de(0x10a)],'description':_0xc0e292['attributes']['description'],'prompt':truncatePrompt(_0xc0e292[_0x15e4de(0x153)][_0x15e4de(0x12e)]),'createdAt':_0xc0e292[_0x15e4de(0x153)][_0x15e4de(0x124)],'updatedAt':_0xc0e292['attributes'][_0x15e4de(0x191)]};}function truncatePrompt(_0x1809ca){const _0x4ec399=a24_0x3728;if(!_0x1809ca)return undefined;const _0x2512ac=0x64;if(_0x1809ca['length']<=_0x2512ac)return _0x1809ca;return _0x1809ca[_0x4ec399(0x105)](0x0,_0x2512ac)+_0x4ec399(0x11e);}export class LLMModelsCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x107);['description']=a24_0x2a2e16(0x11c);async[a24_0x2a2e16(0x17b)](_0x53b023){const _0x3eac85=a24_0x2a2e16,{options:_0xbe732b,tdx:_0x4a56a8}=_0x53b023;try{const _0x4f38ed=await withSpinner(_0x3eac85(0x13b),()=>_0x4a56a8[_0x3eac85(0x108)][_0x3eac85(0x172)](),{'verbose':_0xbe732b['verbose']});return await handleSDKOutput(_0x4f38ed[_0x3eac85(0x130)],_0xbe732b),0x0;}catch(_0x16dc7){return handleSDKError(_0x16dc7,_0xbe732b),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x111);[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0x1b9);async[a24_0x2a2e16(0x17b)](_0x5b928e){const _0x37ffe9=a24_0x2a2e16,{options:_0x4ae1e1,args:_0x440700,tdx:_0x4cd166}=_0x5b928e;try{const _0x42ff1f=_0x440700[0x0],_0x485571=resolveLimit(_0x4ae1e1[_0x37ffe9(0x187)],DEFAULT_LLM_LIMIT),_0x21b8ce=await withSpinner(_0x37ffe9(0x1c3),()=>_0x4cd166['llm']['projects'](_0x485571),{'verbose':_0x4ae1e1[_0x37ffe9(0x13f)]});let _0x1193ff=_0x21b8ce[_0x37ffe9(0x130)];_0x42ff1f&&(_0x1193ff=_0x21b8ce[_0x37ffe9(0x130)][_0x37ffe9(0x129)](_0x2fe39a=>matchGlobPattern(_0x2fe39a['attributes']['name'],_0x42ff1f)));const _0x3e8298=_0x1193ff[_0x37ffe9(0x119)](toLLMProjectInfo);return await handleSDKOutput(_0x3e8298,_0x4ae1e1),0x0;}catch(_0x2794e){return handleSDKError(_0x2794e,_0x4ae1e1),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]='llm:agents';['description']=a24_0x2a2e16(0xf8);async[a24_0x2a2e16(0x17b)](_0x3e7467){const _0x59a491=a24_0x2a2e16,{options:_0x5eb0f3,args:_0x477427,tdx:_0x365946}=_0x3e7467;try{const _0x47a1c6=_0x477427[0x0];let _0xf0504a,_0x2b89a5=_0x47a1c6;if(_0x47a1c6&&_0x47a1c6[_0x59a491(0x104)]('/')){const _0xf79605=_0x47a1c6[_0x59a491(0x1b7)]('/');if(_0xf79605[_0x59a491(0x1b6)]===0x2){const [_0x2baee0,_0x48fdaf]=_0xf79605,_0x3f840c=await _0x365946['llm'][_0x59a491(0x109)](),_0x28888f=_0x3f840c['find'](_0x335555=>_0x335555[_0x59a491(0x153)]['name'][_0x59a491(0x198)]()===_0x2baee0[_0x59a491(0x198)]());if(!_0x28888f)throw new SDKError(ErrorCode[_0x59a491(0x179)],_0x59a491(0x188)+_0x2baee0,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0xf0504a=_0x28888f['id'],_0x2b89a5=_0x48fdaf;}else throw new SDKError(ErrorCode[_0x59a491(0x14b)],_0x59a491(0x18d)+_0x47a1c6,undefined,{'helpText':_0x59a491(0xfc)});}else _0xf0504a=await getProjectIdOrDefault(_0x3e7467);const _0x1af581=await withSpinner('Fetching\x20agents...',()=>_0x365946[_0x59a491(0x108)][_0x59a491(0x103)](_0xf0504a),{'verbose':_0x5eb0f3[_0x59a491(0x13f)]});let _0x23c5e1=_0x1af581[_0x59a491(0x130)];_0x2b89a5&&(_0x23c5e1=_0x1af581[_0x59a491(0x130)][_0x59a491(0x129)](_0x426d02=>matchGlobPattern(_0x426d02[_0x59a491(0x153)][_0x59a491(0x10a)],_0x2b89a5)));const _0x3057fb=_0x23c5e1['map'](toAgentInfo);return await handleSDKOutput(_0x3057fb,_0x5eb0f3),0x0;}catch(_0x54a217){return handleSDKError(_0x54a217,_0x5eb0f3),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x16b);['description']=a24_0x2a2e16(0x178);async[a24_0x2a2e16(0x17b)](_0x3fc33c){const _0x526543=a24_0x2a2e16,{options:_0x5f13a2,args:_0x4b7086,tdx:_0x3f585c}=_0x3fc33c;if(_0x4b7086[_0x526543(0x1b6)]===0x0)return console['error'](_0x526543(0x189)),console['error'](_0x526543(0x11b)),0x1;const _0x5d6a70=_0x4b7086[0x0];try{const _0x4deab1=await getProjectIdOrDefault(_0x3fc33c),_0xa0a58e=await withSpinner(_0x526543(0x13e)+_0x5d6a70+_0x526543(0x128),()=>_0x3f585c['llm'][_0x526543(0x18e)](_0x5d6a70,_0x4deab1),{'verbose':_0x5f13a2['verbose']}),_0x211ec5=await withSpinner(_0x526543(0x13c),()=>_0x3f585c['llm'][_0x526543(0x148)](_0xa0a58e[_0x526543(0x130)]),{'verbose':_0x5f13a2[_0x526543(0x13f)]});return await handleSDKOutput([_0x211ec5[_0x526543(0x130)]],_0x5f13a2),0x0;}catch(_0x30e2fb){return handleSDKError(_0x30e2fb,_0x5f13a2),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']=a24_0x2a2e16(0x18f);['description']=a24_0x2a2e16(0x165);async[a24_0x2a2e16(0x17b)](_0x428131){const _0x20fb60=a24_0x2a2e16,{options:_0x52685d,args:_0x35d399,tdx:_0x2939cf}=_0x428131;if(_0x35d399['length']===0x0)return console[_0x20fb60(0x110)](_0x20fb60(0x189)),console['error'](_0x20fb60(0x139)),console[_0x20fb60(0x110)](_0x20fb60(0xf7)),0x1;const _0x3ca2af=_0x35d399[0x0],_0x6039d1=_0x52685d,_0x2aa7f9=_0x6039d1[_0x20fb60(0x126)],_0x24b13f=_0x6039d1[_0x20fb60(0x1bc)]||'claude-4.5-haiku',_0x43bd45=_0x6039d1[_0x20fb60(0x16e)],_0x302ee5=_0x6039d1[_0x20fb60(0x101)]?Number(_0x6039d1['maxToolIterations']):undefined,_0x16edb6=_0x6039d1['temperature']?Number(_0x6039d1[_0x20fb60(0x12b)]):undefined;try{let _0x28b94e,_0x848a3a;if(_0x3ca2af['includes']('/')){const _0x3fe06d=_0x3ca2af[_0x20fb60(0x1b7)]('/');if(_0x3fe06d[_0x20fb60(0x1b6)]===0x2){const [_0x76ce0b,_0x3683ed]=_0x3fe06d,_0x525e72=await withSpinner(_0x20fb60(0x12d)+_0x76ce0b+'\x27...',()=>_0x2939cf[_0x20fb60(0x108)][_0x20fb60(0x1a0)](_0x76ce0b),{'verbose':_0x52685d[_0x20fb60(0x13f)]});_0x28b94e=_0x525e72[_0x20fb60(0x130)],_0x848a3a=_0x3683ed;}else throw new SDKError(ErrorCode[_0x20fb60(0x14b)],_0x20fb60(0x18d)+_0x3ca2af,undefined,{'helpText':_0x20fb60(0xfc)});}else _0x28b94e=await getProjectIdOrDefault(_0x428131),_0x848a3a=_0x3ca2af;const _0x521855=await withSpinner(_0x20fb60(0xf9)+_0x848a3a+_0x20fb60(0x128),()=>_0x2939cf[_0x20fb60(0x108)][_0x20fb60(0x143)]({'name':_0x848a3a,'projectId':_0x28b94e,'modelType':_0x24b13f,'systemPrompt':_0x2aa7f9,'starterMessage':_0x43bd45,'maxToolIterations':_0x302ee5,'temperature':_0x16edb6}),{'verbose':_0x52685d[_0x20fb60(0x13f)]});return console['log'](_0x20fb60(0x1b0)+_0x521855[_0x20fb60(0x130)]['id']),await handleSDKOutput([_0x521855[_0x20fb60(0x130)]],_0x52685d),0x0;}catch(_0x34377a){return handleSDKError(_0x34377a,_0x52685d),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x19e);[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0xfa);async[a24_0x2a2e16(0x17b)](_0xf25aca){const _0x588169=a24_0x2a2e16,{options:_0x92c6d,args:_0x551af4,tdx:_0x18d7b8}=_0xf25aca;if(_0x551af4[_0x588169(0x1b6)]===0x0)return console[_0x588169(0x110)](_0x588169(0x189)),console['error'](_0x588169(0x118)),0x1;const _0x5088ba=_0x551af4[0x0],_0x2e8fe9=_0x92c6d,_0xd0c9bd=_0x2e8fe9[_0x588169(0x10a)],_0xae0437=_0x2e8fe9[_0x588169(0x12e)],_0x3c2dbc=_0x2e8fe9['description'],_0x5f86d=_0x2e8fe9['starterMessage'];if(!_0xd0c9bd&&!_0xae0437&&!_0x3c2dbc&&!_0x5f86d)return console[_0x588169(0x110)](_0x588169(0x120)),console[_0x588169(0x110)](_0x588169(0x14a)),0x1;try{const _0x1a53d4=await getProjectIdOrDefault(_0xf25aca),_0x33bb3c=await withSpinner(_0x588169(0x13e)+_0x5088ba+_0x588169(0x128),()=>_0x18d7b8[_0x588169(0x108)][_0x588169(0x18e)](_0x5088ba,_0x1a53d4),{'verbose':_0x92c6d['verbose']}),_0xef14f9=_0x33bb3c[_0x588169(0x130)],_0x5ab229=await withSpinner('Updating\x20agent...',()=>_0x18d7b8[_0x588169(0x108)]['updateAgent'](_0xef14f9,{'name':_0xd0c9bd,'prompt':_0xae0437,'description':_0x3c2dbc,'starterMessage':_0x5f86d}),{'verbose':_0x92c6d['verbose']});return console['log'](_0x588169(0x17f)+_0x5ab229[_0x588169(0x130)]['id']),await handleSDKOutput([_0x5ab229['data']],_0x92c6d),0x0;}catch(_0x5aa617){return handleSDKError(_0x5aa617,_0x92c6d),0x1;}}}function a24_0x3728(_0x6d2909,_0x191d89){const _0x50dc85=a24_0x50dc();return a24_0x3728=function(_0x372850,_0xcaf2b0){_0x372850=_0x372850-0xf7;let _0x1dd59c=_0x50dc85[_0x372850];return _0x1dd59c;},a24_0x3728(_0x6d2909,_0x191d89);}export class LLMAgentDeleteCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x1a3);[a24_0x2a2e16(0x195)]='Delete\x20an\x20agent';async[a24_0x2a2e16(0x17b)](_0x3aaf7b){const _0x72be28=a24_0x2a2e16,{options:_0x14ba34,args:_0x7e3dd8,tdx:_0xedc6d5}=_0x3aaf7b;if(_0x7e3dd8[_0x72be28(0x1b6)]===0x0)return console[_0x72be28(0x110)](_0x72be28(0x189)),console[_0x72be28(0x110)](_0x72be28(0x1a6)),0x1;const _0x5617ea=_0x7e3dd8[0x0];try{const _0x1459b3=await getProjectIdOrDefault(_0x3aaf7b),_0x576aec=await withSpinner('Resolving\x20agent\x20\x27'+_0x5617ea+'\x27...',()=>_0xedc6d5['llm'][_0x72be28(0x18e)](_0x5617ea,_0x1459b3),{'verbose':_0x14ba34['verbose']}),_0x345d6f=_0x576aec[_0x72be28(0x130)];return await withSpinner('Deleting\x20agent...',()=>_0xedc6d5[_0x72be28(0x108)]['deleteAgent'](_0x345d6f),{'verbose':_0x14ba34[_0x72be28(0x13f)]}),console[_0x72be28(0x12a)](_0x72be28(0x140)+_0x345d6f),0x0;}catch(_0x1c3af8){return handleSDKError(_0x1c3af8,_0x14ba34),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x10b);[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0x1a8);async[a24_0x2a2e16(0x17b)](_0x298ee9){const _0x4a0cfb=a24_0x2a2e16;return executeChatHistoryCommand(_0x298ee9,_0x4a0cfb(0x182));}}export class LLMUseCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]='llm:use';['description']=a24_0x2a2e16(0x16a);async[a24_0x2a2e16(0x17b)](_0x49bb2b){const _0x5d311e=a24_0x2a2e16,{options:_0x5353e9,args:_0x33ef24,tdx:_0x551902}=_0x49bb2b;if(_0x33ef24['length']===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x5d311e(0x110)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x23f861=_0x33ef24[0x0];try{return await withSpinner(_0x5d311e(0x1bd)+_0x23f861+_0x5d311e(0x128),()=>_0x551902['llm'][_0x5d311e(0x158)](_0x23f861),{'verbose':_0x5353e9['verbose']}),console[_0x5d311e(0x12a)](_0x5d311e(0x164)+_0x23f861),0x0;}catch(_0x50826c){return handleSDKError(_0x50826c,_0x5353e9),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{['name']=a24_0x2a2e16(0x185);['description']=a24_0x2a2e16(0xfe);async[a24_0x2a2e16(0x17b)](_0x18998d){const _0x3957e1=a24_0x2a2e16,{options:_0x43924b,args:_0x1fb1cd,tdx:_0x3da6a7}=_0x18998d;if(_0x1fb1cd[_0x3957e1(0x1b6)]===0x0)return console[_0x3957e1(0x110)](_0x3957e1(0x170)),console['error'](_0x3957e1(0x1a1)),0x1;const _0xbe3219=_0x1fb1cd[0x0],_0x319fcc=_0x43924b,_0x1c1db9=_0x319fcc['description'];try{const _0x2f7f59=await withSpinner(_0x3957e1(0x159)+_0xbe3219+'\x27...',()=>_0x3da6a7[_0x3957e1(0x108)]['createProject']({'name':_0xbe3219,'description':_0x1c1db9}),{'verbose':_0x43924b['verbose']});console[_0x3957e1(0x12a)](_0x3957e1(0x1b4)+_0x2f7f59[_0x3957e1(0x130)]['id']);const _0x129799=toLLMProjectInfo(_0x2f7f59[_0x3957e1(0x130)]);return await handleSDKOutput([_0x129799],_0x43924b),0x0;}catch(_0x1d7257){return handleSDKError(_0x1d7257,_0x43924b),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x116);[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0x19f);async[a24_0x2a2e16(0x17b)](_0x2f2f50){const _0x3c8291=a24_0x2a2e16,{options:_0x4c1689,args:_0x414fa5,tdx:_0x2a8c82}=_0x2f2f50;if(_0x414fa5[_0x3c8291(0x1b6)]===0x0)return console[_0x3c8291(0x110)](_0x3c8291(0x170)),console[_0x3c8291(0x110)](_0x3c8291(0x166)),0x1;const _0x51ea0a=_0x414fa5[0x0];try{return await withSpinner(_0x3c8291(0x136)+_0x51ea0a+'\x27...',()=>_0x2a8c82[_0x3c8291(0x108)][_0x3c8291(0x16c)](_0x51ea0a),{'verbose':_0x4c1689[_0x3c8291(0x13f)]}),console[_0x3c8291(0x12a)](_0x3c8291(0x167)+_0x51ea0a),0x0;}catch(_0x2009bf){return handleSDKError(_0x2009bf,_0x4c1689),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]='llm:project:backup';[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0x13d);async[a24_0x2a2e16(0x17b)](_0x369d9c){const _0x54d73b=a24_0x2a2e16,{options:_0x284f12,args:_0x31334a,tdx:_0x163567}=_0x369d9c;if(_0x31334a['length']===0x0)return console[_0x54d73b(0x110)](_0x54d73b(0x170)),console[_0x54d73b(0x110)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x2641d2=_0x31334a[0x0],_0xf24323=_0x284f12,_0x4eb1a8=_0xf24323[_0x54d73b(0x10d)],_0x249213=_0xf24323['dryRun'];try{const _0x583837=_0x4eb1a8||_0x2641d2+'.llm';if(a24_0x16efc0[_0x54d73b(0x144)](_0x583837)&&!_0x249213){if(!_0x284f12[_0x54d73b(0x1bf)]){const _0x1b4259=await confirm(_0x54d73b(0x142)+_0x583837+_0x54d73b(0x19c));if(!_0x1b4259)return console[_0x54d73b(0x12a)](_0x54d73b(0x157)),0x0;}a24_0x16efc0['rmSync'](_0x583837,{'recursive':!![]});}const _0x18aa81=await withSpinner(_0x249213?_0x54d73b(0x11a)+_0x2641d2+'\x27...':_0x54d73b(0x114)+_0x2641d2+_0x54d73b(0x128),()=>_0x163567[_0x54d73b(0x108)][_0x54d73b(0x18b)](_0x2641d2,_0x4eb1a8,{'dryRun':_0x249213}),{'verbose':_0x284f12[_0x54d73b(0x13f)]}),_0x5b82b0=_0x18aa81['data'];return _0x249213?console['log']('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x5b82b0['outputDir']):console[_0x54d73b(0x12a)](_0x54d73b(0x145)+_0x5b82b0[_0x54d73b(0x1a5)]),console[_0x54d73b(0x12a)](_0x54d73b(0x14c)+_0x5b82b0[_0x54d73b(0x19b)][_0x54d73b(0x103)]),console[_0x54d73b(0x12a)](_0x54d73b(0x1c2)+_0x5b82b0[_0x54d73b(0x19b)]['knowledgeBases']),console[_0x54d73b(0x12a)](_0x54d73b(0x168)+_0x5b82b0['counts'][_0x54d73b(0x147)]),console['log'](_0x54d73b(0x197)+_0x5b82b0[_0x54d73b(0x19b)][_0x54d73b(0x192)]),(_0x284f12[_0x54d73b(0x181)]===_0x54d73b(0x135)||_0x284f12['format']==='jsonl')&&await handleSDKOutput([_0x5b82b0],_0x284f12),0x0;}catch(_0x20fc1c){return handleSDKError(_0x20fc1c,_0x284f12),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]='llm:project:restore';[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0x199);async[a24_0x2a2e16(0x17b)](_0x491dfe){const _0x32a6ee=a24_0x2a2e16,{options:_0x4b07bd,args:_0x420946,tdx:_0x8da3ba}=_0x491dfe;if(_0x420946[_0x32a6ee(0x1b6)]===0x0)return console['error']('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x32a6ee(0x110)](_0x32a6ee(0x1be)),0x1;const _0x24dbed=_0x420946[0x0],_0x2a9731=_0x4b07bd,_0x39c155=_0x2a9731[_0x32a6ee(0x10a)],_0x22fcf0=_0x2a9731[_0x32a6ee(0x18a)];try{if(!_0x22fcf0){const _0x323c61=_0x8da3ba['llm']['getBackupMetadata'](_0x24dbed),_0x3e7469=_0x39c155||_0x323c61[_0x32a6ee(0x1b1)][_0x32a6ee(0x12f)],_0xd54561=await withSpinner(_0x32a6ee(0x1ad),()=>_0x8da3ba['llm'][_0x32a6ee(0x109)](),{'verbose':_0x4b07bd[_0x32a6ee(0x13f)]}),_0xf7cc0c=_0xd54561['data']['find'](_0x1b44d2=>_0x1b44d2[_0x32a6ee(0x153)][_0x32a6ee(0x10a)]===_0x3e7469);if(_0xf7cc0c&&!_0x4b07bd[_0x32a6ee(0x1bf)]){const _0x385d6d=await confirm(_0x32a6ee(0x180)+_0x3e7469+_0x32a6ee(0x19a));if(!_0x385d6d)return console['log'](_0x32a6ee(0x183)),0x0;}}const _0x2180ae=await withSpinner(_0x22fcf0?_0x32a6ee(0x100)+_0x24dbed+_0x32a6ee(0x128):'Restoring\x20project\x20from\x20\x27'+_0x24dbed+_0x32a6ee(0x128),()=>_0x8da3ba['llm'][_0x32a6ee(0x1a2)](_0x24dbed,{'name':_0x39c155,'dryRun':_0x22fcf0}),{'verbose':_0x4b07bd[_0x32a6ee(0x13f)]}),_0x3c04aa=_0x2180ae[_0x32a6ee(0x130)];return _0x3c04aa[_0x32a6ee(0x156)]&&console[_0x32a6ee(0x12a)]('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x3c04aa[_0x32a6ee(0x156)]+'\x27'),_0x22fcf0?console[_0x32a6ee(0x12a)](_0x32a6ee(0x1ba)+_0x3c04aa[_0x32a6ee(0x12f)]):console[_0x32a6ee(0x12a)](_0x32a6ee(0x106)+_0x3c04aa[_0x32a6ee(0x12f)]+'\x20('+_0x3c04aa[_0x32a6ee(0x18c)]+')'),console[_0x32a6ee(0x12a)](_0x32a6ee(0x14c)+_0x3c04aa['counts'][_0x32a6ee(0x103)]),console[_0x32a6ee(0x12a)](_0x32a6ee(0x1c2)+_0x3c04aa[_0x32a6ee(0x19b)][_0x32a6ee(0x1ac)]),console['log'](_0x32a6ee(0x168)+_0x3c04aa[_0x32a6ee(0x19b)][_0x32a6ee(0x147)]),console[_0x32a6ee(0x12a)](_0x32a6ee(0x197)+_0x3c04aa['counts']['integrations']),(_0x4b07bd['format']===_0x32a6ee(0x135)||_0x4b07bd[_0x32a6ee(0x181)]===_0x32a6ee(0x115))&&await handleSDKOutput([_0x3c04aa],_0x4b07bd),0x0;}catch(_0x4f7229){return handleSDKError(_0x4f7229,_0x4b07bd),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x3ead37,_0x51af86){const _0x532435=a24_0x2a2e16,_0x19a308=_0x51af86[_0x532435(0x187)]||CHAT_SELECTOR_PAGE_SIZE;let _0xde1b3=0x0,_0x59a35c=[];const _0x52ccef=(await import('prompts'))[_0x532435(0x17d)],_0x4e146c=getChalk(_0x51af86);while(!![]){const _0x1ee913=await withSpinner(_0x532435(0x160),()=>_0x3ead37[_0x532435(0x108)][_0x532435(0x14d)](_0x19a308+_0xde1b3),{'verbose':_0x51af86[_0x532435(0x13f)]});_0x59a35c=_0x1ee913[_0x532435(0x130)];const _0x1bc3a1=_0x59a35c[_0x532435(0x105)](_0xde1b3,_0xde1b3+_0x19a308),_0x2badb1=_0x59a35c[_0x532435(0x1b6)]>_0xde1b3+_0x19a308,_0x4d0ad1=[...new Set(_0x1bc3a1[_0x532435(0x119)](_0x4213bc=>_0x4213bc[_0x532435(0x153)][_0x532435(0x177)])[_0x532435(0x129)](_0xe1ab9=>_0xe1ab9!==undefined))],_0xc7b441=new Map();await Promise[_0x532435(0x194)](_0x4d0ad1[_0x532435(0x119)](async _0x46d077=>{const _0x4366f5=_0x532435;try{const _0x438fc5=await _0x3ead37[_0x4366f5(0x108)][_0x4366f5(0x148)](_0x46d077);_0xc7b441[_0x4366f5(0x1a4)](_0x46d077,_0x438fc5[_0x4366f5(0x153)]['name']);}catch{_0xc7b441['set'](_0x46d077,_0x46d077);}}));const _0x435519=_0x1bc3a1['map'](_0x414234=>{const _0x582e8c=_0x532435,_0x4cab81=_0x414234[_0x582e8c(0x153)]['firstInputContent']||'(no\x20message)',_0x576144=_0x4cab81[_0x582e8c(0x1b7)]('\x0a')[0x0],_0xccdc6f=_0x576144['length']>0x50?_0x576144['substring'](0x0,0x4d)+_0x582e8c(0x11e):_0x576144,_0x2a51d0=_0x414234[_0x582e8c(0x153)][_0x582e8c(0x177)]?_0xc7b441['get'](_0x414234['attributes'][_0x582e8c(0x177)])||_0x414234[_0x582e8c(0x153)][_0x582e8c(0x177)]:_0x582e8c(0x173),_0x52da09=_0x414234[_0x582e8c(0x153)]['lastConversationAt']||_0x414234[_0x582e8c(0x153)][_0x582e8c(0x191)],_0x17f588=new Date(_0x52da09),_0x1a9a63=new Date(),_0xca00d5=_0x1a9a63['getTime']()-_0x17f588[_0x582e8c(0x190)](),_0x405ad6=Math[_0x582e8c(0x132)](_0xca00d5/0xea60),_0x1606c6=Math['floor'](_0xca00d5/0x36ee80),_0x259efe=Math['floor'](_0xca00d5/0x5265c00);let _0x27ccc1;if(_0x405ad6<0x1)_0x27ccc1=_0x582e8c(0x14e);else{if(_0x405ad6<0x3c)_0x27ccc1=_0x405ad6+_0x582e8c(0x17a);else{if(_0x1606c6<0x18)_0x27ccc1=_0x1606c6+_0x582e8c(0x13a);else _0x259efe<0x7?_0x27ccc1=_0x259efe+_0x582e8c(0x150):_0x27ccc1=_0x17f588[_0x582e8c(0x12c)]('en-US',{'month':'short','day':_0x582e8c(0x127)});}}return{'title':_0xccdc6f+'\x20'+_0x4e146c[_0x582e8c(0x1bb)]('['+_0x2a51d0+']\x20'+_0x27ccc1),'value':_0x414234['id']};});_0x2badb1&&_0x435519[_0x532435(0x1ab)]({'title':_0x4e146c['cyan']('Load\x20more...'),'value':'__load_more__'});const _0x2edc0e=await _0x52ccef({'type':_0x532435(0x163),'name':_0x532435(0x138),'message':_0x532435(0x155),'choices':_0x435519,'hint':_0x532435(0x161)});if(!_0x2edc0e[_0x532435(0x138)])return undefined;if(_0x2edc0e[_0x532435(0x138)]===_0x532435(0x1aa)){_0xde1b3+=_0x19a308;continue;}return _0x2edc0e[_0x532435(0x138)];}}export class ChatsCommand extends BaseCommand{[a24_0x2a2e16(0x10a)]=a24_0x2a2e16(0x14d);[a24_0x2a2e16(0x195)]=a24_0x2a2e16(0x15b);async[a24_0x2a2e16(0x17b)](_0x4def81){const _0x4c7a53=a24_0x2a2e16;return executeChatHistoryCommand(_0x4def81,_0x4c7a53(0x125));}}
|
|
1
|
+
const a24_0x1b217f=a24_0x4fc4;(function(_0x542413,_0x400d32){const _0x239a4a=a24_0x4fc4,_0xb4f427=_0x542413();while(!![]){try{const _0x46b4ad=parseInt(_0x239a4a(0x178))/0x1+parseInt(_0x239a4a(0x1bf))/0x2*(-parseInt(_0x239a4a(0x14e))/0x3)+parseInt(_0x239a4a(0x13b))/0x4*(parseInt(_0x239a4a(0x162))/0x5)+-parseInt(_0x239a4a(0x136))/0x6*(-parseInt(_0x239a4a(0x147))/0x7)+parseInt(_0x239a4a(0x1b6))/0x8*(-parseInt(_0x239a4a(0x181))/0x9)+-parseInt(_0x239a4a(0x1d1))/0xa+parseInt(_0x239a4a(0x1ac))/0xb*(parseInt(_0x239a4a(0x16e))/0xc);if(_0x46b4ad===_0x400d32)break;else _0xb4f427['push'](_0xb4f427['shift']());}catch(_0x285d24){_0xb4f427['push'](_0xb4f427['shift']());}}}(a24_0x3761,0x9e113));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a24_0x3761(){const _0x1a5e1c=['stack','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','\x20bytes)','all','\x20\x20Agents:\x20','\x20\x20Knowledge\x20Bases:\x20','\x20-\x20','format','m\x20ago','llm:project:delete','targetAgent','Agent\x20created:\x20','agent','[output]\x20','cause','agentId','verbose','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','cyan','[tool_call]','.llm','chatId','knowledgeBases','find','deleteProject','Creating\x20agent\x20\x27','Fetching\x20most\x20recent\x20chat...','[image]\x20\x20','short','llm:agent:create','red','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Output\x20directory\x20\x27','toLowerCase','jsonl','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','llm:agent:update','[input]\x20\x20','Backup\x20cancelled.','Project\x20not\x20found:\x20','tdx\x20llm\x20history','bold','outputDir','Update\x20an\x20existing\x20agent','Deleting\x20project\x20\x27','tool','Project\x20created:\x20','toLocaleDateString','Delete\x20an\x20agent','\x0aCancelled','1782606TVvmIm','Backing\x20up\x20project\x20\x27','stringify','description','join','4UXkaLu','split','blue','claude-4.5-haiku','magenta','Project\x20restored:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Load\x20more...','data','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','projects','7JfAgsr','tool_call','updateAgent','[unknown]','input','starterMessage','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','15ZhdKZQ','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','llm:agents','floor','Getting\x20default\x20project...','\x20\x20Prompts:\x20','length','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','targetKnowledgeBase','numeric','\x20\x20Integrations:\x20','Agent\x20deleted:\x20','INVALID_ARGUMENT','targetImageGenerator','slice','set','integrations','Error:\x20Agent\x20name\x20is\x20required','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','getTime','5006915oButXx','createdAt','dim','message','\x20→\x20chat:\x20','\x20->\x20KB:','Use\x20format:\x20project-name/agent-name','llm:models','Restoring\x20project\x20from\x20\x27','Restore\x20cancelled.','prompt','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','11078808HClcFd','List\x20all\x20LLM\x20projects','llm:projects','includes','get','tdx\x20chats','__load_more__','restoreProject','List\x20available\x20LLM\x20models','Fetching\x20agents...','598868tryEFK','Show\x20agent\x20details','Fetching\x20chat\x20sessions...','limit','systemPrompt','name','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','resolveAgentId','No\x20chat\x20sessions\x20found.','9gwiTgF','json','yellow','llm:project:restore','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','d\x20ago','projectName','just\x20now','Error:\x20','getOrCreateDefaultProject','[tool]\x20\x20\x20','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Error:\x20Project\x20name\x20is\x20required','image','attributes','resolveProjectId','Fetching\x20available\x20models...','content','history','Invalid\x20path\x20syntax:\x20','map','Fetching\x20projects...','createProject','deleteAgent','Resolving\x20agent\x20\x27','sourceSite','llm','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Select\x20a\x20chat\x20session:','\x20->\x20WebSearch:','\x20->\x20Agent:','Updating\x20agent...','error','List\x20agents\x20in\x20current\x20project','counts','Resolving\x20project\x20\x27','dryRun','Fetching\x20agent...','exportedFrom','existsSync','Project\x20context\x20set\x20to:\x20','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','11sEynQk','createAgent','projectId','yes','maxToolIterations','substring','filter','Usage:\x20','log','Validating\x20backup\x20from\x20\x27','7906504chbZBn','Create\x20a\x20new\x20LLM\x20project','...','prompts','updatedAt','targetWebSearchTool','\x20->\x20ImageGen:','Analyzing\x20project\x20\x27','llm:history','4444GjeFnN','[content]','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','temperature','Creating\x20project\x20\x27','rmSync','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','output','getBackupMetadata','chats','h\x20ago','(no\x20message)','getCurrentProject','[error]\x20\x20','\x27...','en-US','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','\x20--last','11737200abYUIq','Agent\x20updated:\x20','agents','execute'];a24_0x3761=function(){return _0x1a5e1c;};return a24_0x3761();}import{handleSDKOutput,writeOutput}from'../utils/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'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a24_0x1cf23b from'node:fs';function handleSDKError(_0x3c3f9c,_0x1e8b77){const _0x2e0950=a24_0x4fc4;if(_0x3c3f9c instanceof SDKError)console['error'](_0x2e0950(0x189)+_0x3c3f9c[_0x2e0950(0x165)]),_0x1e8b77[_0x2e0950(0x114)]&&(_0x3c3f9c[_0x2e0950(0x112)]&&console[_0x2e0950(0x1a2)]('\x20\x20Cause:\x20'+_0x3c3f9c[_0x2e0950(0x112)]),_0x3c3f9c[_0x2e0950(0x1d5)]&&(console[_0x2e0950(0x1a2)]('\x0aStack\x20trace:'),console[_0x2e0950(0x1a2)](_0x3c3f9c['stack'])));else throw _0x3c3f9c;}function formatChatHistoryEntry(_0x5f46a5,_0x3a4112){const _0x25415f=a24_0x4fc4,_0x55b61c=getChalk(_0x3a4112),_0x1778a8=_0x55b61c[_0x25415f(0x164)](_0x5f46a5['at']);if(_0x25415f(0x14b)in _0x5f46a5){const _0x2f48e0=_0x55b61c[_0x25415f(0x116)](_0x25415f(0x129));return _0x1778a8+'\x20'+_0x2f48e0+':\x20'+_0x5f46a5[_0x25415f(0x14b)];}if('content'in _0x5f46a5){const _0xe6e3bc=_0x55b61c['green'](_0x25415f(0x1c0));return _0x1778a8+'\x20'+_0xe6e3bc+':\x20'+_0x5f46a5['content'];}if(_0x25415f(0x148)in _0x5f46a5){const _0x4c0d28=_0x55b61c[_0x25415f(0x183)](_0x25415f(0x117)),{functionName:_0x48cbd5,functionArguments:_0x2cdac6,targetFunction:_0x5062ea}=_0x5f46a5[_0x25415f(0x148)];let _0x4c0218=_0x1778a8+'\x20'+_0x4c0d28+':\x20'+_0x55b61c[_0x25415f(0x12d)](_0x48cbd5);if(_0x2cdac6&&Object['keys'](_0x2cdac6)[_0x25415f(0x154)]>0x0){const _0x427110=Object['entries'](_0x2cdac6)[_0x25415f(0x196)](([_0x16f118,_0x11d8d9])=>_0x16f118+'='+JSON['stringify'](_0x11d8d9))[_0x25415f(0x13a)](',\x20');_0x4c0218+='('+_0x427110+')';}_0x5062ea&&(_0x4c0218+=_0x55b61c[_0x25415f(0x164)]('\x20['+_0x5062ea+']'));let _0x44ce1d='';if(_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x156)])_0x44ce1d=_0x25415f(0x167)+_0x5f46a5['tool_call'][_0x25415f(0x156)]['name'];else{if(_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x10e)])_0x44ce1d=_0x25415f(0x1a0)+_0x5f46a5[_0x25415f(0x148)]['targetAgent'][_0x25415f(0x17d)];else{if(_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x1bb)])_0x44ce1d=_0x25415f(0x19f)+_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x1bb)][_0x25415f(0x17d)];else _0x5f46a5[_0x25415f(0x148)][_0x25415f(0x15b)]&&(_0x44ce1d=_0x25415f(0x1bc)+_0x5f46a5[_0x25415f(0x148)][_0x25415f(0x15b)]['name']);}}return _0x4c0218+_0x44ce1d;}if(_0x25415f(0x131)in _0x5f46a5){const _0x505e52=_0x55b61c[_0x25415f(0x13f)](_0x25415f(0x18b)),{functionName:_0x545ec4,functionArguments:_0x1b54d4,content:_0x4218c8,newChat:_0x177ca0}=_0x5f46a5['tool'];let _0x36ee2=_0x1778a8+'\x20'+_0x505e52+':\x20'+_0x55b61c[_0x25415f(0x12d)](_0x545ec4);if(_0x1b54d4){const _0x27825a=typeof _0x1b54d4==='string'?_0x1b54d4:JSON[_0x25415f(0x138)](_0x1b54d4);_0x36ee2+='('+_0x27825a+')';}return _0x4218c8&&(_0x36ee2+='\x0a'+_0x55b61c['dim'](_0x4218c8)),_0x177ca0&&(_0x36ee2+=_0x55b61c[_0x25415f(0x164)](_0x25415f(0x166)+_0x177ca0['id'])),_0x36ee2;}if(_0x25415f(0x1c6)in _0x5f46a5){const _0x4bdb8d=_0x55b61c[_0x25415f(0x13d)](_0x25415f(0x111));return _0x1778a8+'\x20'+_0x4bdb8d+':\x20'+_0x5f46a5[_0x25415f(0x1c6)][_0x25415f(0x17d)]+'\x20('+_0x5f46a5[_0x25415f(0x1c6)][_0x25415f(0x193)][_0x25415f(0x154)]+_0x25415f(0x1d7);}if(_0x25415f(0x18f)in _0x5f46a5){const _0x58fecc=_0x55b61c[_0x25415f(0x13d)](_0x25415f(0x11f)),{width:_0x16d09d,height:_0x1be4ac,headerText:_0x10cd89}=_0x5f46a5['image'],_0x4c2c4f=_0x10cd89?_0x25415f(0x1db)+_0x10cd89:'';return _0x1778a8+'\x20'+_0x58fecc+':\x20'+_0x16d09d+'x'+_0x1be4ac+_0x4c2c4f;}if(_0x25415f(0x1a2)in _0x5f46a5){const _0x59208f=_0x55b61c[_0x25415f(0x122)](_0x25415f(0x1cc));return _0x1778a8+'\x20'+_0x59208f+':\x20'+_0x5f46a5[_0x25415f(0x1a2)];}return _0x1778a8+'\x20'+_0x55b61c[_0x25415f(0x164)](_0x25415f(0x14a))+':\x20'+JSON['stringify'](_0x5f46a5);}async function executeChatHistoryCommand(_0x57a11d,_0x5bb847){const _0x548e0b=a24_0x4fc4,{options:_0x2c95be,args:_0x442adc,tdx:_0x1b0ccb}=_0x57a11d,_0xd91b7a=_0x442adc[0x0],_0x1a896c=_0x2c95be,_0x6c425c=_0x1a896c['last'];try{if(_0x6c425c&&_0xd91b7a)return console[_0x548e0b(0x1a2)](_0x548e0b(0x1d6)),console[_0x548e0b(0x1a2)](_0x548e0b(0x1b3)+_0x5bb847+_0x548e0b(0x1d0)),0x1;if(!_0xd91b7a&&!_0x6c425c&&_0x2c95be[_0x548e0b(0x1dc)]!==undefined){const _0x598f0a=resolveLimit(_0x2c95be[_0x548e0b(0x17b)],DEFAULT_LLM_LIMIT),_0x1937b8=await withSpinner(_0x548e0b(0x17a),()=>_0x1b0ccb[_0x548e0b(0x19c)]['chats'](_0x598f0a),{'verbose':_0x2c95be[_0x548e0b(0x114)]});return await handleSDKOutput(_0x1937b8[_0x548e0b(0x143)],_0x2c95be),0x0;}const _0x200ecd=await getChatIdOrSelect(_0x1b0ccb,_0x2c95be,_0x6c425c,_0xd91b7a);if(!_0x200ecd)return 0x0;return await displayChatHistory(_0x200ecd,_0x1b0ccb,_0x2c95be),0x0;}catch(_0x22032f){return handleSDKError(_0x22032f,_0x2c95be),0x1;}}async function displayChatHistory(_0x1f8627,_0x3d9584,_0x513812){const _0x14298d=a24_0x4fc4,_0x2f7551=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x1f8627+_0x14298d(0x1cd),()=>_0x3d9584['llm'][_0x14298d(0x194)](_0x1f8627),{'verbose':_0x513812[_0x14298d(0x114)]}),_0x43d498=_0x2f7551[_0x14298d(0x143)]['data']??[];if(_0x43d498[_0x14298d(0x154)]===0x0){console[_0x14298d(0x1b4)]('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x513812[_0x14298d(0x1dc)]!==undefined)await handleSDKOutput(_0x43d498,_0x513812);else{const _0x24a89e=_0x43d498[_0x14298d(0x196)](_0x2729d6=>formatChatHistoryEntry(_0x2729d6,_0x513812)),_0x423eb5=_0x24a89e[_0x14298d(0x13a)]('\x0a');await writeOutput(_0x423eb5,_0x513812[_0x14298d(0x1c6)],'table');}}async function getChatIdOrSelect(_0x4821f1,_0x3c3056,_0x31ba16,_0xc99b4a){const _0x1c3065=a24_0x4fc4;if(_0xc99b4a)return _0xc99b4a;if(_0x31ba16){const _0x3ae94b=await withSpinner(_0x1c3065(0x11e),()=>_0x4821f1[_0x1c3065(0x19c)][_0x1c3065(0x1c8)](0x1),{'verbose':_0x3c3056[_0x1c3065(0x114)]});if(_0x3ae94b[_0x1c3065(0x143)][_0x1c3065(0x154)]===0x0)return console[_0x1c3065(0x1b4)](_0x1c3065(0x180)),undefined;return _0x3ae94b[_0x1c3065(0x143)][0x0]['id'];}const _0x1a3a9d=await selectChatInteractively(_0x4821f1,_0x3c3056);if(!_0x1a3a9d)return console[_0x1c3065(0x1b4)](_0x1c3065(0x135)),undefined;return _0x1a3a9d;}async function getProjectIdOrDefault(_0x5c6661){const _0x32fe8a=a24_0x4fc4,{tdx:_0x16cee6,options:_0x5c07c5}=_0x5c6661,_0x788273=_0x5c07c5['llmProject'];if(_0x788273){const _0x38c81d=await withSpinner(_0x32fe8a(0x1a5)+_0x788273+_0x32fe8a(0x1cd),()=>_0x16cee6['llm'][_0x32fe8a(0x191)](_0x788273),{'verbose':_0x5c07c5['verbose']});return _0x38c81d[_0x32fe8a(0x143)];}let _0x431f0e=_0x16cee6['llm'][_0x32fe8a(0x1cb)]();if(_0x431f0e)return _0x431f0e;const _0x43a274=await withSpinner(_0x32fe8a(0x152),()=>_0x16cee6['llm'][_0x32fe8a(0x18a)](),{'verbose':_0x5c07c5[_0x32fe8a(0x114)]});return _0x43a274['data']['id'];}function toLLMProjectInfo(_0xbb63a1){const _0x290094=a24_0x4fc4;return{'name':_0xbb63a1[_0x290094(0x190)]['name'],'description':_0xbb63a1[_0x290094(0x190)][_0x290094(0x139)],'createdAt':_0xbb63a1[_0x290094(0x190)][_0x290094(0x163)],'updatedAt':_0xbb63a1['attributes'][_0x290094(0x1ba)]};}function toAgentInfo(_0x209a7a){const _0x4659ec=a24_0x4fc4;return{'name':_0x209a7a[_0x4659ec(0x190)]['name'],'description':_0x209a7a[_0x4659ec(0x190)][_0x4659ec(0x139)],'prompt':truncatePrompt(_0x209a7a[_0x4659ec(0x190)][_0x4659ec(0x16c)]),'createdAt':_0x209a7a[_0x4659ec(0x190)]['createdAt'],'updatedAt':_0x209a7a[_0x4659ec(0x190)][_0x4659ec(0x1ba)]};}function truncatePrompt(_0x507f18){const _0x3fe45e=a24_0x4fc4;if(!_0x507f18)return undefined;const _0x10164a=0x64;if(_0x507f18['length']<=_0x10164a)return _0x507f18;return _0x507f18[_0x3fe45e(0x15c)](0x0,_0x10164a)+_0x3fe45e(0x1b8);}export class LLMModelsCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x169);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x176);async[a24_0x1b217f(0x1d4)](_0x17bbe0){const _0x298d25=a24_0x1b217f,{options:_0x1a0442,tdx:_0x79713}=_0x17bbe0;try{const _0x14dda7=await withSpinner(_0x298d25(0x192),()=>_0x79713[_0x298d25(0x19c)]['models'](),{'verbose':_0x1a0442[_0x298d25(0x114)]});return await handleSDKOutput(_0x14dda7[_0x298d25(0x143)],_0x1a0442),0x0;}catch(_0x1c1142){return handleSDKError(_0x1c1142,_0x1a0442),0x1;}}}function a24_0x4fc4(_0xe396d,_0x5a7335){const _0x3761e4=a24_0x3761();return a24_0x4fc4=function(_0x4fc424,_0x1abdcf){_0x4fc424=_0x4fc424-0x10d;let _0x4056bf=_0x3761e4[_0x4fc424];return _0x4056bf;},a24_0x4fc4(_0xe396d,_0x5a7335);}export class LLMProjectsCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x170);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x16f);async['execute'](_0x17ebe1){const _0x51fd75=a24_0x1b217f,{options:_0x32b841,args:_0x23365d,tdx:_0xae3c1a}=_0x17ebe1;try{const _0x15f276=_0x23365d[0x0],_0x1bf0f3=resolveLimit(_0x32b841[_0x51fd75(0x17b)],DEFAULT_LLM_LIMIT),_0x140af4=await withSpinner(_0x51fd75(0x197),()=>_0xae3c1a[_0x51fd75(0x19c)][_0x51fd75(0x146)](_0x1bf0f3),{'verbose':_0x32b841[_0x51fd75(0x114)]});let _0x6cd745=_0x140af4[_0x51fd75(0x143)];_0x15f276&&(_0x6cd745=_0x140af4['data'][_0x51fd75(0x1b2)](_0x28aa73=>matchGlobPattern(_0x28aa73['attributes'][_0x51fd75(0x17d)],_0x15f276)));const _0x28e97e=_0x6cd745['map'](toLLMProjectInfo);return await handleSDKOutput(_0x28e97e,_0x32b841),0x0;}catch(_0x256ec9){return handleSDKError(_0x256ec9,_0x32b841),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a24_0x1b217f(0x150);['description']=a24_0x1b217f(0x1a3);async[a24_0x1b217f(0x1d4)](_0x46673d){const _0x37c370=a24_0x1b217f,{options:_0x3beae3,args:_0x50aaf0,tdx:_0x54f62e}=_0x46673d;try{const _0x2a9676=_0x50aaf0[0x0];let _0x5513f3,_0x388608=_0x2a9676;if(_0x2a9676&&_0x2a9676[_0x37c370(0x171)]('/')){const _0x29b298=_0x2a9676[_0x37c370(0x13c)]('/');if(_0x29b298[_0x37c370(0x154)]===0x2){const [_0x9ab593,_0x46e28e]=_0x29b298,_0xce5382=await _0x54f62e[_0x37c370(0x19c)][_0x37c370(0x146)](),_0x25eb0f=_0xce5382['find'](_0x276811=>_0x276811[_0x37c370(0x190)][_0x37c370(0x17d)][_0x37c370(0x125)]()===_0x9ab593[_0x37c370(0x125)]());if(!_0x25eb0f)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x37c370(0x12b)+_0x9ab593,undefined,{'helpText':_0x37c370(0x141)});_0x5513f3=_0x25eb0f['id'],_0x388608=_0x46e28e;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0x2a9676,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x5513f3=await getProjectIdOrDefault(_0x46673d);const _0x2b13b0=await withSpinner(_0x37c370(0x177),()=>_0x54f62e[_0x37c370(0x19c)]['agents'](_0x5513f3),{'verbose':_0x3beae3['verbose']});let _0x1ede30=_0x2b13b0[_0x37c370(0x143)];_0x388608&&(_0x1ede30=_0x2b13b0[_0x37c370(0x143)][_0x37c370(0x1b2)](_0x4ba450=>matchGlobPattern(_0x4ba450[_0x37c370(0x190)][_0x37c370(0x17d)],_0x388608)));const _0xb0d878=_0x1ede30['map'](toAgentInfo);return await handleSDKOutput(_0xb0d878,_0x3beae3),0x0;}catch(_0x15474c){return handleSDKError(_0x15474c,_0x3beae3),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:agent:show';['description']=a24_0x1b217f(0x179);async[a24_0x1b217f(0x1d4)](_0x492330){const _0x500b09=a24_0x1b217f,{options:_0x5c11d0,args:_0x1db428,tdx:_0x357c5c}=_0x492330;if(_0x1db428[_0x500b09(0x154)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x500b09(0x155)),0x1;const _0x6b5f=_0x1db428[0x0];try{const _0x1ac130=await getProjectIdOrDefault(_0x492330),_0x4adad7=await withSpinner(_0x500b09(0x19a)+_0x6b5f+_0x500b09(0x1cd),()=>_0x357c5c['llm'][_0x500b09(0x17f)](_0x6b5f,_0x1ac130),{'verbose':_0x5c11d0[_0x500b09(0x114)]}),_0x3e320f=await withSpinner(_0x500b09(0x1a7),()=>_0x357c5c[_0x500b09(0x19c)][_0x500b09(0x110)](_0x4adad7['data']),{'verbose':_0x5c11d0[_0x500b09(0x114)]});return await handleSDKOutput([_0x3e320f[_0x500b09(0x143)]],_0x5c11d0),0x0;}catch(_0x330964){return handleSDKError(_0x330964,_0x5c11d0),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x121);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x123);async[a24_0x1b217f(0x1d4)](_0x2d2fe0){const _0x555217=a24_0x1b217f,{options:_0x4497d7,args:_0x7c888,tdx:_0x34181f}=_0x2d2fe0;if(_0x7c888[_0x555217(0x154)]===0x0)return console['error'](_0x555217(0x15f)),console[_0x555217(0x1a2)](_0x555217(0x1ab)),console['error'](_0x555217(0x18d)),0x1;const _0x657158=_0x7c888[0x0],_0x54e39e=_0x4497d7,_0x3debbb=_0x54e39e[_0x555217(0x17c)],_0x4ae12c=_0x54e39e['model']||_0x555217(0x13e),_0x246efa=_0x54e39e[_0x555217(0x14c)],_0x324fd4=_0x54e39e['maxToolIterations']?Number(_0x54e39e[_0x555217(0x1b0)]):undefined,_0x14abd3=_0x54e39e[_0x555217(0x1c2)]?Number(_0x54e39e[_0x555217(0x1c2)]):undefined;try{let _0x21d902,_0x5a2258;if(_0x657158[_0x555217(0x171)]('/')){const _0xabf671=_0x657158[_0x555217(0x13c)]('/');if(_0xabf671[_0x555217(0x154)]===0x2){const [_0x552b6d,_0x21e2de]=_0xabf671,_0x3253ac=await withSpinner(_0x555217(0x1a5)+_0x552b6d+_0x555217(0x1cd),()=>_0x34181f[_0x555217(0x19c)][_0x555217(0x191)](_0x552b6d),{'verbose':_0x4497d7['verbose']});_0x21d902=_0x3253ac[_0x555217(0x143)],_0x5a2258=_0x21e2de;}else throw new SDKError(ErrorCode[_0x555217(0x15a)],_0x555217(0x195)+_0x657158,undefined,{'helpText':_0x555217(0x168)});}else _0x21d902=await getProjectIdOrDefault(_0x2d2fe0),_0x5a2258=_0x657158;const _0x45f7f1=await withSpinner(_0x555217(0x11d)+_0x5a2258+'\x27...',()=>_0x34181f['llm'][_0x555217(0x1ad)]({'name':_0x5a2258,'projectId':_0x21d902,'modelType':_0x4ae12c,'systemPrompt':_0x3debbb,'starterMessage':_0x246efa,'maxToolIterations':_0x324fd4,'temperature':_0x14abd3}),{'verbose':_0x4497d7[_0x555217(0x114)]});return console[_0x555217(0x1b4)](_0x555217(0x10f)+_0x45f7f1[_0x555217(0x143)]['id']),await handleSDKOutput([_0x45f7f1[_0x555217(0x143)]],_0x4497d7),0x0;}catch(_0x573eef){return handleSDKError(_0x573eef,_0x4497d7),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x128);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x12f);async[a24_0x1b217f(0x1d4)](_0x524bfe){const _0x14dcff=a24_0x1b217f,{options:_0x440bf0,args:_0x5f17a0,tdx:_0x393d9f}=_0x524bfe;if(_0x5f17a0[_0x14dcff(0x154)]===0x0)return console[_0x14dcff(0x1a2)](_0x14dcff(0x15f)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'),0x1;const _0x388795=_0x5f17a0[0x0],_0x53ae99=_0x440bf0,_0x2d1c30=_0x53ae99[_0x14dcff(0x17d)],_0x26ad8b=_0x53ae99[_0x14dcff(0x16c)],_0x382822=_0x53ae99[_0x14dcff(0x139)],_0x324eaa=_0x53ae99[_0x14dcff(0x14c)];if(!_0x2d1c30&&!_0x26ad8b&&!_0x382822&&!_0x324eaa)return console[_0x14dcff(0x1a2)](_0x14dcff(0x1c1)),console[_0x14dcff(0x1a2)](_0x14dcff(0x16d)),0x1;try{const _0x5b9fa2=await getProjectIdOrDefault(_0x524bfe),_0x47a0e2=await withSpinner(_0x14dcff(0x19a)+_0x388795+'\x27...',()=>_0x393d9f[_0x14dcff(0x19c)]['resolveAgentId'](_0x388795,_0x5b9fa2),{'verbose':_0x440bf0[_0x14dcff(0x114)]}),_0x2295a2=_0x47a0e2[_0x14dcff(0x143)],_0x4998f3=await withSpinner(_0x14dcff(0x1a1),()=>_0x393d9f[_0x14dcff(0x19c)][_0x14dcff(0x149)](_0x2295a2,{'name':_0x2d1c30,'prompt':_0x26ad8b,'description':_0x382822,'starterMessage':_0x324eaa}),{'verbose':_0x440bf0[_0x14dcff(0x114)]});return console[_0x14dcff(0x1b4)](_0x14dcff(0x1d2)+_0x4998f3[_0x14dcff(0x143)]['id']),await handleSDKOutput([_0x4998f3[_0x14dcff(0x143)]],_0x440bf0),0x0;}catch(_0x408b47){return handleSDKError(_0x408b47,_0x440bf0),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:agent:delete';[a24_0x1b217f(0x139)]=a24_0x1b217f(0x134);async[a24_0x1b217f(0x1d4)](_0x156b08){const _0x6b9ea3=a24_0x1b217f,{options:_0x189044,args:_0x6ce1e6,tdx:_0x36a168}=_0x156b08;if(_0x6ce1e6['length']===0x0)return console[_0x6b9ea3(0x1a2)](_0x6b9ea3(0x15f)),console[_0x6b9ea3(0x1a2)](_0x6b9ea3(0x14d)),0x1;const _0xf9aebd=_0x6ce1e6[0x0];try{const _0x49cb76=await getProjectIdOrDefault(_0x156b08),_0xcf52e=await withSpinner('Resolving\x20agent\x20\x27'+_0xf9aebd+_0x6b9ea3(0x1cd),()=>_0x36a168[_0x6b9ea3(0x19c)][_0x6b9ea3(0x17f)](_0xf9aebd,_0x49cb76),{'verbose':_0x189044[_0x6b9ea3(0x114)]}),_0x475159=_0xcf52e['data'];return await withSpinner('Deleting\x20agent...',()=>_0x36a168['llm'][_0x6b9ea3(0x199)](_0x475159),{'verbose':_0x189044[_0x6b9ea3(0x114)]}),console['log'](_0x6b9ea3(0x159)+_0x475159),0x0;}catch(_0x2796b9){return handleSDKError(_0x2796b9,_0x189044),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a24_0x1b217f(0x1be);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x1c5);async[a24_0x1b217f(0x1d4)](_0x493a79){const _0x436965=a24_0x1b217f;return executeChatHistoryCommand(_0x493a79,_0x436965(0x12c));}}export class LLMUseCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:use';[a24_0x1b217f(0x139)]='Set\x20current\x20project\x20context';async[a24_0x1b217f(0x1d4)](_0x1b8a5c){const _0xc23493=a24_0x1b217f,{options:_0x5ba032,args:_0x1f0350,tdx:_0xea41cc}=_0x1b8a5c;if(_0x1f0350[_0xc23493(0x154)]===0x0)return console['error'](_0xc23493(0x18e)),console[_0xc23493(0x1a2)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x86877b=_0x1f0350[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x86877b+_0xc23493(0x1cd),()=>_0xea41cc[_0xc23493(0x19c)]['setCurrentProject'](_0x86877b),{'verbose':_0x5ba032['verbose']}),console['log'](_0xc23493(0x1aa)+_0x86877b),0x0;}catch(_0x345fde){return handleSDKError(_0x345fde,_0x5ba032),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:project:create';[a24_0x1b217f(0x139)]=a24_0x1b217f(0x1b7);async[a24_0x1b217f(0x1d4)](_0x178df4){const _0x12cd3a=a24_0x1b217f,{options:_0x4c40fc,args:_0x3e31fc,tdx:_0x3c2757}=_0x178df4;if(_0x3e31fc[_0x12cd3a(0x154)]===0x0)return console[_0x12cd3a(0x1a2)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x12cd3a(0x1a2)](_0x12cd3a(0x144)),0x1;const _0x3e7365=_0x3e31fc[0x0],_0x1c526b=_0x4c40fc,_0x256a92=_0x1c526b[_0x12cd3a(0x139)];try{const _0x5221f0=await withSpinner(_0x12cd3a(0x1c3)+_0x3e7365+_0x12cd3a(0x1cd),()=>_0x3c2757[_0x12cd3a(0x19c)][_0x12cd3a(0x198)]({'name':_0x3e7365,'description':_0x256a92}),{'verbose':_0x4c40fc[_0x12cd3a(0x114)]});console[_0x12cd3a(0x1b4)](_0x12cd3a(0x132)+_0x5221f0[_0x12cd3a(0x143)]['id']);const _0x358428=toLLMProjectInfo(_0x5221f0[_0x12cd3a(0x143)]);return await handleSDKOutput([_0x358428],_0x4c40fc),0x0;}catch(_0x52d980){return handleSDKError(_0x52d980,_0x4c40fc),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x10d);[a24_0x1b217f(0x139)]='Delete\x20an\x20LLM\x20project';async[a24_0x1b217f(0x1d4)](_0x18c92d){const _0x383a0e=a24_0x1b217f,{options:_0x55ad12,args:_0x427c70,tdx:_0x15512b}=_0x18c92d;if(_0x427c70[_0x383a0e(0x154)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x383a0e(0x1a2)](_0x383a0e(0x1cf)),0x1;const _0x24fed7=_0x427c70[0x0];try{return await withSpinner(_0x383a0e(0x130)+_0x24fed7+'\x27...',()=>_0x15512b[_0x383a0e(0x19c)][_0x383a0e(0x11c)](_0x24fed7),{'verbose':_0x55ad12[_0x383a0e(0x114)]}),console[_0x383a0e(0x1b4)]('Project\x20deleted:\x20'+_0x24fed7),0x0;}catch(_0x2a3680){return handleSDKError(_0x2a3680,_0x55ad12),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a24_0x1b217f(0x17d)]='llm:project:backup';[a24_0x1b217f(0x139)]=a24_0x1b217f(0x160);async['execute'](_0x330bf9){const _0x2d690e=a24_0x1b217f,{options:_0x5b5496,args:_0x32f1ec,tdx:_0x2543a0}=_0x330bf9;if(_0x32f1ec[_0x2d690e(0x154)]===0x0)return console['error'](_0x2d690e(0x18e)),console['error'](_0x2d690e(0x14f)),0x1;const _0x34d69d=_0x32f1ec[0x0],_0x3806c9=_0x5b5496,_0x11b5e0=_0x3806c9[_0x2d690e(0x1c6)],_0x49b956=_0x3806c9['dryRun'];try{const _0x2b0691=_0x11b5e0||_0x34d69d+_0x2d690e(0x118);if(a24_0x1cf23b[_0x2d690e(0x1a9)](_0x2b0691)&&!_0x49b956){if(!_0x5b5496[_0x2d690e(0x1af)]){const _0x2d047a=await confirm(_0x2d690e(0x124)+_0x2b0691+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x2d047a)return console[_0x2d690e(0x1b4)](_0x2d690e(0x12a)),0x0;}a24_0x1cf23b[_0x2d690e(0x1c4)](_0x2b0691,{'recursive':!![]});}const _0x22446d=await withSpinner(_0x49b956?_0x2d690e(0x1bd)+_0x34d69d+_0x2d690e(0x1cd):_0x2d690e(0x137)+_0x34d69d+'\x27...',()=>_0x2543a0['llm']['backupProject'](_0x34d69d,_0x11b5e0,{'dryRun':_0x49b956}),{'verbose':_0x5b5496['verbose']}),_0x5e40ed=_0x22446d[_0x2d690e(0x143)];return _0x49b956?console['log'](_0x2d690e(0x145)+_0x5e40ed['outputDir']):console[_0x2d690e(0x1b4)]('Project\x20backed\x20up\x20to:\x20'+_0x5e40ed[_0x2d690e(0x12e)]),console[_0x2d690e(0x1b4)](_0x2d690e(0x1d9)+_0x5e40ed['counts'][_0x2d690e(0x1d3)]),console[_0x2d690e(0x1b4)]('\x20\x20Knowledge\x20Bases:\x20'+_0x5e40ed[_0x2d690e(0x1a4)][_0x2d690e(0x11a)]),console[_0x2d690e(0x1b4)]('\x20\x20Prompts:\x20'+_0x5e40ed[_0x2d690e(0x1a4)][_0x2d690e(0x1b9)]),console['log'](_0x2d690e(0x158)+_0x5e40ed['counts'][_0x2d690e(0x15e)]),(_0x5b5496[_0x2d690e(0x1dc)]==='json'||_0x5b5496[_0x2d690e(0x1dc)]===_0x2d690e(0x126))&&await handleSDKOutput([_0x5e40ed],_0x5b5496),0x0;}catch(_0x421172){return handleSDKError(_0x421172,_0x5b5496),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x184);[a24_0x1b217f(0x139)]=a24_0x1b217f(0x127);async[a24_0x1b217f(0x1d4)](_0x23e057){const _0x1fbd4d=a24_0x1b217f,{options:_0x1d9cd5,args:_0x3831d4,tdx:_0x3cac6d}=_0x23e057;if(_0x3831d4[_0x1fbd4d(0x154)]===0x0)return console[_0x1fbd4d(0x1a2)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x1fbd4d(0x1a2)](_0x1fbd4d(0x185)),0x1;const _0x1aa623=_0x3831d4[0x0],_0x1df271=_0x1d9cd5,_0x1d1b28=_0x1df271[_0x1fbd4d(0x17d)],_0x344d7f=_0x1df271[_0x1fbd4d(0x1a6)];try{if(!_0x344d7f){const _0x54ae11=_0x3cac6d[_0x1fbd4d(0x19c)][_0x1fbd4d(0x1c7)](_0x1aa623),_0x441f1d=_0x1d1b28||_0x54ae11[_0x1fbd4d(0x1a8)][_0x1fbd4d(0x187)],_0x410649=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x3cac6d[_0x1fbd4d(0x19c)][_0x1fbd4d(0x146)](),{'verbose':_0x1d9cd5[_0x1fbd4d(0x114)]}),_0x2389ba=_0x410649[_0x1fbd4d(0x143)][_0x1fbd4d(0x11b)](_0x240d30=>_0x240d30['attributes'][_0x1fbd4d(0x17d)]===_0x441f1d);if(_0x2389ba&&!_0x1d9cd5[_0x1fbd4d(0x1af)]){const _0x10c53c=await confirm('A\x20project\x20named\x20\x27'+_0x441f1d+_0x1fbd4d(0x19d));if(!_0x10c53c)return console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x16b)),0x0;}}const _0x31c951=await withSpinner(_0x344d7f?_0x1fbd4d(0x1b5)+_0x1aa623+_0x1fbd4d(0x1cd):_0x1fbd4d(0x16a)+_0x1aa623+_0x1fbd4d(0x1cd),()=>_0x3cac6d[_0x1fbd4d(0x19c)][_0x1fbd4d(0x175)](_0x1aa623,{'name':_0x1d1b28,'dryRun':_0x344d7f}),{'verbose':_0x1d9cd5[_0x1fbd4d(0x114)]}),_0x457058=_0x31c951['data'];return _0x457058[_0x1fbd4d(0x19b)]&&console['log'](_0x1fbd4d(0x17e)+_0x457058[_0x1fbd4d(0x19b)]+'\x27'),_0x344d7f?console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x18c)+_0x457058['projectName']):console['log'](_0x1fbd4d(0x140)+_0x457058[_0x1fbd4d(0x187)]+'\x20('+_0x457058[_0x1fbd4d(0x1ae)]+')'),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x1d9)+_0x457058[_0x1fbd4d(0x1a4)][_0x1fbd4d(0x1d3)]),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x1da)+_0x457058[_0x1fbd4d(0x1a4)][_0x1fbd4d(0x11a)]),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x153)+_0x457058[_0x1fbd4d(0x1a4)][_0x1fbd4d(0x1b9)]),console[_0x1fbd4d(0x1b4)](_0x1fbd4d(0x158)+_0x457058[_0x1fbd4d(0x1a4)]['integrations']),(_0x1d9cd5[_0x1fbd4d(0x1dc)]===_0x1fbd4d(0x182)||_0x1d9cd5[_0x1fbd4d(0x1dc)]==='jsonl')&&await handleSDKOutput([_0x457058],_0x1d9cd5),0x0;}catch(_0x54839e){return handleSDKError(_0x54839e,_0x1d9cd5),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x3bf3a9,_0xdfcb3){const _0x25d6f8=a24_0x1b217f,_0x385e2a=_0xdfcb3[_0x25d6f8(0x17b)]||CHAT_SELECTOR_PAGE_SIZE;let _0x1ce115=0x0,_0x2542e8=[];const _0x591125=(await import('prompts'))['default'],_0x438c9d=getChalk(_0xdfcb3);while(!![]){const _0x3e4682=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x3bf3a9[_0x25d6f8(0x19c)][_0x25d6f8(0x1c8)](_0x385e2a+_0x1ce115),{'verbose':_0xdfcb3['verbose']});_0x2542e8=_0x3e4682[_0x25d6f8(0x143)];const _0x35b408=_0x2542e8[_0x25d6f8(0x15c)](_0x1ce115,_0x1ce115+_0x385e2a),_0x5271c7=_0x2542e8[_0x25d6f8(0x154)]>_0x1ce115+_0x385e2a,_0x275b9d=[...new Set(_0x35b408['map'](_0x1dff23=>_0x1dff23['attributes'][_0x25d6f8(0x113)])[_0x25d6f8(0x1b2)](_0x361e95=>_0x361e95!==undefined))],_0xf81af4=new Map();await Promise[_0x25d6f8(0x1d8)](_0x275b9d['map'](async _0x27f129=>{const _0xe7bec0=_0x25d6f8;try{const _0x576ad7=await _0x3bf3a9[_0xe7bec0(0x19c)]['agent'](_0x27f129);_0xf81af4['set'](_0x27f129,_0x576ad7[_0xe7bec0(0x190)][_0xe7bec0(0x17d)]);}catch{_0xf81af4[_0xe7bec0(0x15d)](_0x27f129,_0x27f129);}}));const _0x37c8f2=_0x35b408['map'](_0xd413d6=>{const _0x5c5636=_0x25d6f8,_0x28716d=_0xd413d6['attributes']['firstInputContent']||_0x5c5636(0x1ca),_0x2519d9=_0x28716d[_0x5c5636(0x13c)]('\x0a')[0x0],_0x1a6fd7=_0x2519d9[_0x5c5636(0x154)]>0x50?_0x2519d9[_0x5c5636(0x1b1)](0x0,0x4d)+_0x5c5636(0x1b8):_0x2519d9,_0x12bc2b=_0xd413d6[_0x5c5636(0x190)][_0x5c5636(0x113)]?_0xf81af4[_0x5c5636(0x172)](_0xd413d6['attributes'][_0x5c5636(0x113)])||_0xd413d6[_0x5c5636(0x190)]['agentId']:'(no\x20agent)',_0x4abbdf=_0xd413d6[_0x5c5636(0x190)]['lastConversationAt']||_0xd413d6[_0x5c5636(0x190)][_0x5c5636(0x1ba)],_0x2e05ac=new Date(_0x4abbdf),_0x2cef03=new Date(),_0x2152d8=_0x2cef03[_0x5c5636(0x161)]()-_0x2e05ac[_0x5c5636(0x161)](),_0x20c114=Math[_0x5c5636(0x151)](_0x2152d8/0xea60),_0x13ba45=Math['floor'](_0x2152d8/0x36ee80),_0x506309=Math['floor'](_0x2152d8/0x5265c00);let _0x443674;if(_0x20c114<0x1)_0x443674=_0x5c5636(0x188);else{if(_0x20c114<0x3c)_0x443674=_0x20c114+_0x5c5636(0x1dd);else{if(_0x13ba45<0x18)_0x443674=_0x13ba45+_0x5c5636(0x1c9);else _0x506309<0x7?_0x443674=_0x506309+_0x5c5636(0x186):_0x443674=_0x2e05ac[_0x5c5636(0x133)](_0x5c5636(0x1ce),{'month':_0x5c5636(0x120),'day':_0x5c5636(0x157)});}}return{'title':_0x1a6fd7+'\x20'+_0x438c9d['dim']('['+_0x12bc2b+']\x20'+_0x443674),'value':_0xd413d6['id']};});_0x5271c7&&_0x37c8f2['push']({'title':_0x438c9d[_0x25d6f8(0x116)](_0x25d6f8(0x142)),'value':'__load_more__'});const _0x335593=await _0x591125({'type':'select','name':_0x25d6f8(0x119),'message':_0x25d6f8(0x19e),'choices':_0x37c8f2,'hint':_0x25d6f8(0x115)});if(!_0x335593['chatId'])return undefined;if(_0x335593[_0x25d6f8(0x119)]===_0x25d6f8(0x174)){_0x1ce115+=_0x385e2a;continue;}return _0x335593[_0x25d6f8(0x119)];}}export class ChatsCommand extends BaseCommand{[a24_0x1b217f(0x17d)]=a24_0x1b217f(0x1c8);[a24_0x1b217f(0x139)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a24_0x1b217f(0x1d4)](_0x2d669c){const _0x30abdd=a24_0x1b217f;return executeChatHistoryCommand(_0x2d669c,_0x30abdd(0x173));}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x14ac7=a25_0x5e1a;function a25_0x5e1a(_0x3dde25,_0x4db083){const _0x345e3c=a25_0x345e();return a25_0x5e1a=function(_0x5e1a8e,_0x5b5e43){_0x5e1a8e=_0x5e1a8e-0xf9;let _0x41f22c=_0x345e3c[_0x5e1a8e];return _0x41f22c;},a25_0x5e1a(_0x3dde25,_0x4db083);}(function(_0x2d4aa8,_0x12569a){const _0x46bfb0=a25_0x5e1a,_0x39c431=_0x2d4aa8();while(!![]){try{const _0x56747b=-parseInt(_0x46bfb0(0x118))/0x1+parseInt(_0x46bfb0(0x12c))/0x2*(parseInt(_0x46bfb0(0x124))/0x3)+parseInt(_0x46bfb0(0xff))/0x4+parseInt(_0x46bfb0(0x12f))/0x5*(parseInt(_0x46bfb0(0x11b))/0x6)+parseInt(_0x46bfb0(0x12b))/0x7*(parseInt(_0x46bfb0(0x100))/0x8)+parseInt(_0x46bfb0(0x133))/0x9*(-parseInt(_0x46bfb0(0x109))/0xa)+-parseInt(_0x46bfb0(0x115))/0xb;if(_0x56747b===_0x12569a)break;else _0x39c431['push'](_0x39c431['shift']());}catch(_0x3c5c56){_0x39c431['push'](_0x39c431['shift']());}}}(a25_0x345e,0xd3673));import a25_0x2f3ad9 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';function a25_0x345e(){const _0x1d5c9a=['[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','attributes','logger','NOT_FOUND','init','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','server','14243427vqNBzj','\x0aTesting\x20with\x20Agent\x20SDK:','execute','161977zeoaSP','\x20\x20Project:','Starting\x20proxy\x20server...','7038114sRZGgm','bold','llm:proxy','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','name','getOrCreateDefaultProject','\x20\x20\x20\x20\x22env\x22:\x20{','yellow','756261zEObun','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22','✓\x20Proxy\x20server\x20stopped','\x0a\x0aShutting\x20down\x20proxy\x20server...','llmProject','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','site','682717igFpCr','4QxWFOH','\x20\x20Agents:','dim','5nWYwpx','close','\x20\x20Address:','cyan','1953jqzxVU','\x20\x20{','Server\x20Configuration:','SIGINT','log','stop','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x0aClaude\x20Code\x20Configuration:','\x27\x20not\x20found','green','llm','2969908hhPsfX','112igKKYD','white','logLevel','http://0.0.0.0:','port','\x20is\x20unavailable,\x20using\x20port\x20','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20}','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','67390oEHKzU','description','SIGTERM','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','find'];a25_0x345e=function(){return _0x1d5c9a;};return a25_0x345e();}async function getProjectIdOrDefault(_0x1426bb,_0x5ecb5f){const _0x2cac4c=a25_0x5e1a,{tdx:_0x3aeaba,options:_0xdd971}=_0x1426bb,_0x665db2=_0x5ecb5f||_0xdd971[_0x2cac4c(0x128)];if(_0x665db2){const _0x90014d=await _0x3aeaba[_0x2cac4c(0xfe)]['projects'](),_0xa8f860=_0x90014d[_0x2cac4c(0x10d)](_0x31031e=>_0x31031e[_0x2cac4c(0x10f)][_0x2cac4c(0x120)]===_0x665db2);if(!_0xa8f860)throw new SDKError(ErrorCode[_0x2cac4c(0x111)],'Project\x20\x27'+_0x665db2+_0x2cac4c(0xfc),undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0xa8f860['id'];}const _0x58b9c3=await _0x3aeaba[_0x2cac4c(0xfe)][_0x2cac4c(0x121)]();return _0x58b9c3['id'];}export class LLMProxyCommand extends BaseCommand{[a25_0x14ac7(0x120)]=a25_0x14ac7(0x11d);[a25_0x14ac7(0x10a)]=a25_0x14ac7(0x10e);[a25_0x14ac7(0x114)];['logger'];async[a25_0x14ac7(0x117)](_0x57fe53){const _0x1fceba=a25_0x14ac7,{tdx:_0x2e5815,options:_0x3ebafd}=_0x57fe53;try{const _0x2b9e6e=_0x3ebafd,_0x34c598=_0x2b9e6e[_0x1fceba(0x104)]||0xfa0,_0x18ddd1=_0x2b9e6e['project'],_0x2b00cd=await findAvailablePort(_0x34c598);console['log'](a25_0x2f3ad9[_0x1fceba(0x12e)]('Resolving\x20project...'));const _0x5944a0=await getProjectIdOrDefault(_0x57fe53,_0x18ddd1),_0x84dec3=await _0x2e5815['llm']['projects'](),_0x22dd53=_0x84dec3[_0x1fceba(0x10d)](_0xd5fe72=>_0xd5fe72['id']===_0x5944a0);this[_0x1fceba(0x110)]=new TDXLogger(_0x3ebafd[_0x1fceba(0x102)]),await this[_0x1fceba(0x110)][_0x1fceba(0x112)](),console['log'](a25_0x2f3ad9['dim'](_0x1fceba(0x11a)));_0x2b00cd!==_0x34c598&&console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)]('Port\x20'+_0x34c598+_0x1fceba(0x105)+_0x2b00cd));this[_0x1fceba(0x114)]=new ProxyServer({'port':_0x2b00cd,'projectId':_0x5944a0,'tdx':_0x2e5815,'logger':this[_0x1fceba(0x110)],'site':_0x3ebafd[_0x1fceba(0x12a)]}),await this[_0x1fceba(0x114)]['start'](),console['log'](a25_0x2f3ad9[_0x1fceba(0x123)][_0x1fceba(0x11c)](_0x1fceba(0x106))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)](_0x1fceba(0x113))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)](_0x1fceba(0xfa))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0xfd)][_0x1fceba(0x11c)](_0x1fceba(0x129))),console['log'](a25_0x2f3ad9[_0x1fceba(0x132)](_0x1fceba(0x135))),console['log'](a25_0x2f3ad9['dim'](_0x1fceba(0x131)),a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x103)+_0x2b00cd)),console['log'](a25_0x2f3ad9['dim'](_0x1fceba(0x119)),a25_0x2f3ad9['white'](_0x22dd53?.[_0x1fceba(0x10f)][_0x1fceba(0x120)]||_0x5944a0)),console[_0x1fceba(0x137)](a25_0x2f3ad9['dim'](_0x1fceba(0x12d)),a25_0x2f3ad9[_0x1fceba(0x101)]('created\x20on-demand\x20per\x20model')),console['log'](a25_0x2f3ad9[_0x1fceba(0x12e)]('\x20\x20Site:'),a25_0x2f3ad9[_0x1fceba(0x101)](_0x3ebafd[_0x1fceba(0x12a)])),console['log'](a25_0x2f3ad9[_0x1fceba(0x132)](_0x1fceba(0xfb))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x12e)](_0x1fceba(0x108))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x134))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x122))),console[_0x1fceba(0x137)](a25_0x2f3ad9['white'](_0x1fceba(0x11f)+_0x2b00cd+'\x22,')),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x125))),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)]('\x20\x20\x20\x20}')),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x101)](_0x1fceba(0x107))),console[_0x1fceba(0x137)](a25_0x2f3ad9['cyan'](_0x1fceba(0x116))),console[_0x1fceba(0x137)](a25_0x2f3ad9['dim'](_0x1fceba(0x10c))),console[_0x1fceba(0x137)](a25_0x2f3ad9['dim']('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console['log'](a25_0x2f3ad9[_0x1fceba(0x12e)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x1fceba(0x137)](a25_0x2f3ad9[_0x1fceba(0x123)](_0x1fceba(0x11e)));const _0x16ac63=async()=>{const _0x30dbba=_0x1fceba;console[_0x30dbba(0x137)](a25_0x2f3ad9[_0x30dbba(0x12e)](_0x30dbba(0x127))),this[_0x30dbba(0x114)]&&await this['server'][_0x30dbba(0xf9)](),this['logger']&&await this[_0x30dbba(0x110)][_0x30dbba(0x130)](),console[_0x30dbba(0x137)](a25_0x2f3ad9['green'](_0x30dbba(0x126))),process['exit'](0x0);};return process['on'](_0x1fceba(0x136),_0x16ac63),process['on'](_0x1fceba(0x10b),_0x16ac63),await new Promise(()=>{}),0x0;}catch(_0x153a36){this[_0x1fceba(0x114)]&&await this['server'][_0x1fceba(0xf9)]();this['logger']&&await this[_0x1fceba(0x110)][_0x1fceba(0x130)]();throw _0x153a36;}}}
|
|
@@ -128,12 +128,13 @@ export declare class ParentSegmentFieldsCommand extends BaseCommand {
|
|
|
128
128
|
execute(context: CommandContext): Promise<number>;
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
|
-
* Parent segment
|
|
131
|
+
* Parent segment view command - Show parent segment details
|
|
132
132
|
* Usage:
|
|
133
|
-
* tdx ps
|
|
133
|
+
* tdx ps view [name] - Show details (uses context if name omitted)
|
|
134
|
+
* tdx ps view [name] -w - Open in web browser
|
|
134
135
|
*/
|
|
135
|
-
export declare class
|
|
136
|
-
readonly name = "segment:parent:
|
|
136
|
+
export declare class ParentSegmentViewCommand extends BaseCommand {
|
|
137
|
+
readonly name = "segment:parent:view";
|
|
137
138
|
readonly description = "Show parent segment details";
|
|
138
139
|
execute(context: CommandContext): Promise<number>;
|
|
139
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent-segment-command.d.ts","sourceRoot":"","sources":["../../src/commands/parent-segment-command.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"parent-segment-command.d.ts","sourceRoot":"","sources":["../../src/commands/parent-segment-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AA8EhE;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,0BAA0B;IAExC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA6DxD;AAED;;;;;;;GAOG;AACH,qBAAa,0BAA2B,SAAQ,WAAW;IACzD,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,WAAW,uDAAuD;IAErE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA4FxD;AAED;;;;;;;GAOG;AACH,qBAAa,0BAA2B,SAAQ,WAAW;IACzD,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,WAAW,4DAA4D;IAE1E,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAwFxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,oDAAoD;IAElE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA0FxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,sDAAsD;IAEpE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA2FxD;AAED;;;;;;;GAOG;AAEH,qBAAa,4BAA6B,SAAQ,WAAW;IAC3D,QAAQ,CAAC,IAAI,6BAA6B;IAC1C,QAAQ,CAAC,WAAW,oEAAoE;IAElF,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAsFvD;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoD9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,sBAAsB;IAoC9B,OAAO,CAAC,qBAAqB;IAoC7B,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,cAAc;CAcvB;AAED;;;;;;;GAOG;AACH,qBAAa,2BAA4B,SAAQ,WAAW;IAC1D,QAAQ,CAAC,IAAI,4BAA4B;IACzC,QAAQ,CAAC,WAAW,gEAAgE;IAE9E,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IA0IvD;;OAEG;YACW,qBAAqB;IAoCnC;;;OAGG;YACW,iBAAiB;CA4ChC;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,WAAW,yDAAyD;IAEvE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAwGxD;AAED;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,WAAW;IACzD,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,WAAW,4CAA4C;IAE1D,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAsCxD;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,iCAAiC;IAE/C,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA2CxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,+CAA+C;IAE7D,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAsCxD;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,WAAW,sCAAsC;IAEpD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA4CxD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,uDAAuD;IAErE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CA6ExD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0x22f2c4=a26_0x21d5;(function(_0x2eaac1,_0x795c2f){const _0x4f1a8f=a26_0x21d5,_0x372cde=_0x2eaac1();while(!![]){try{const _0x473086=-parseInt(_0x4f1a8f(0x1a0))/0x1+parseInt(_0x4f1a8f(0x1b9))/0x2*(parseInt(_0x4f1a8f(0x1c9))/0x3)+parseInt(_0x4f1a8f(0x18a))/0x4*(-parseInt(_0x4f1a8f(0x111))/0x5)+parseInt(_0x4f1a8f(0x105))/0x6*(parseInt(_0x4f1a8f(0x120))/0x7)+parseInt(_0x4f1a8f(0x1bd))/0x8*(parseInt(_0x4f1a8f(0x138))/0x9)+parseInt(_0x4f1a8f(0x1ed))/0xa+parseInt(_0x4f1a8f(0x11c))/0xb*(-parseInt(_0x4f1a8f(0x12a))/0xc);if(_0x473086===_0x795c2f)break;else _0x372cde['push'](_0x372cde['shift']());}catch(_0x33f25b){_0x372cde['push'](_0x372cde['shift']());}}}(a26_0x3625,0xb7d69));import{writeFileSync,readFileSync,existsSync,mkdirSync}from'fs';function a26_0x3625(){const _0x74575e=['Source:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x27\x20is\x20already\x20up\x20to\x20date','/sessions/','\x20\x20No\x20sample\x20data\x20available','\x20parent\x20segment','Fetching\x20parent\x20segment\x20\x27','Enriched:','keys','sort','segment:parent:pull','customerPercent','createParent','1440IkQWhy','repeat','/attempt/','verbose','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','To\x20cancel:','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','apply','Found\x20YAML\x20file:\x20','runParent','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20--attribute\x20\x22<name>\x22','segment','master','test','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','SQL\x20query:\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','listFields','Session:','green','all','Usage:\x20tdx\x20parent-segment\x20run\x20<name>\x20[-y]\x0a','Attribute:','pushParentYaml','status','processedRows','\x0aNew\x20parent\x20segment\x20\x27','displayAttributesStats','behavior','To\x20view\x20sample\x20data:','displayValidateResults','Get\x20SQL\x20query\x20for\x20parent\x20segment','Audience\x20ID:','setJobId','Usage:\x20tdx\x20ps\x20push\x20[name]\x20[-y]\x0a','endsWith','allValid','Error:','No\x20parent\x20segments\x20found','Options\x20(one\x20required):','timezone','Updated','\x20=\x20','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20use\x20`tdx\x20ps\x20pull`\x20to\x20get\x20a\x20YAML\x20file\x20first','segment:parent:info','attributes','Fetching\x20sample\x20data...','\x20Context\x20set:\x20','Overwrite\x20\x27','-1d','Validate:','query','error','displaySampleData','elapsedTimeMillis','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Listing\x20parent\x20segments...','scheduleType','sampleData','✔\x20No\x20changes\x20-\x20\x27','Events:','interval','List\x20parent\x20segments','%)\x20','\x20--attribute\x20\x22','preview','stop','totalEvents','Errors:','number','jsonl','scheduleOption','execute','segment:parent:list','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Site:\x20','segment:parent:desc','\x0aNo\x20sample\x20data\x20available','session','\x20--behavior\x20\x22','24eeCgNU','✔\x20Created\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20show\x20[name]\x0a','👥\x20','length','column','Error:\x20File\x20not\x20found:\x20','workflowId','Parent\x20segment:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displayPreviewResults','yellow','✔\x20Query\x20completed:\x20Processed\x20','Updating','customerGroup','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Customers:','Usage:\x20tdx\x20ps\x20info\x20[name]\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Aborted.','Usage:\x20tdx\x20ps\x20sql\x20[name]\x0a','previewParentYaml','252867dwpkPh','segment:parent:fields','data','filter','Updating\x20parent\x20segment\x20\x27','Status:','Coverage:','message','site','\x20[Job\x20ID:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Join:','Listing\x20fields\x20for\x20\x27','description','errors','joinKey','displayBehaviorsStats','Usage:\x20tdx\x20ps\x20desc\x20[name]\x0a','displaySummary','displayPreviewHints','workflowSessionId','segment:parent:show','cyan','behaviors','152qZhLzk','\x20rows)','Resolving\x20parent\x20segment\x20\x27','label','2008wvTMqx','\x20field','customersWithEvents','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','segment:parent:create','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0a✔\x20Workflow\x20started','displayColumns','Analyzing\x20changes...','jobId','behaviorsFile','Executing\x20parent\x20segment\x20query...','15411GqUZdz','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','\x0aChanges\x20to\x20\x27','✔\x20Updated\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','toLocaleString','limit','\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','attribute','Available\x20behaviors:','/app/dw/parentSegments/','Master\x20Table','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','information_schema','segment:parent:validate','Apply\x20changes\x20to\x20\x27','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x27\x20and\x20run\x20workflow?','tdx\x20segment\x20parent\x20preview\x20','Created','Attributes','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','getParentFull','Fetching\x20SQL\x20for\x20\x27','Table:\x20','matchedCount','Usage:\x20tdx\x20ps\x20fields\x20[name]\x0a','toFixed','coveragePercent','log','.yml','\x27\x20is\x20up\x20to\x20date','format','Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a','\x27\x20with\x20ID:\x20','2266690yopBYu','parent_segment','getParentSQL','dirname','\x20--behavior\x20\x22<name>\x22','\x20\x20\x20\x20-\x20','\x20No\x20changes\x20-\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Fetching\x20current\x20configuration\x20for\x20\x27','red','segment:parent:run','addBehaviors','audienceId','yes','text','Pattern:\x20','YAML\x20file:\x20','json','table','\x27...','parentSegment','map','displayMasterInfo','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Columns:','schemaValid','workflowAttemptId','dim','segment:parent:update','use','\x20kill','resolveParentId','\x20tdx\x20wf\x20attempt\x20','Creating','Master:','158976QhmqmY','addBehaviorsFile','stats','\x0aChanges\x20to\x20apply\x20to\x20\x27','Options:','foreignKey','Validating\x20configuration...','columns','Error:\x20--database\x20and\x20--table\x20are\x20required','✔\x20Found\x20','replace','population','162920fqgAGn','localeCompare','Master\x20+\x20Attributes','database','Error\x20reading\x20file:\x20','Attempt:','updateParent','SELECT\x20*\x20FROM\x20(\x0a','name','varchar','enriched','597927FVBrQB','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)','\x5c$&','string','273ktqUsi','\x20parent\x20segment\x20\x27','utf-8','bold','schemaError','Join\x20on:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','match','Output\x20file:\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','108FVrGIL'];a26_0x3625=function(){return _0x74575e;};return a26_0x3625();}import a26_0x336003 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a26_0x147063 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';const PARENT_SEGMENT_DIR=a26_0x22f2c4(0x1ee);function resolveYamlFile(_0x5bb922){const _0x214c9b=a26_0x22f2c4;if(_0x5bb922['endsWith'](_0x214c9b(0x1e8))||_0x5bb922[_0x214c9b(0x15c)]('.yaml'))return _0x5bb922;return a26_0x336003['join'](PARENT_SEGMENT_DIR,_0x5bb922+_0x214c9b(0x1e8));}function formatProgressMessage(_0xb25211){const _0x287d23=a26_0x22f2c4,_0x2dbca3=_0xb25211[_0x287d23(0x127)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2dbca3){const [,_0x803256,_0x3f3d59,_0x5e2bc9='']=_0x2dbca3;return a26_0x147063['dim'](_0x803256+':')+'\x20'+_0x3f3d59+a26_0x147063[_0x287d23(0x208)](_0x5e2bc9);}return a26_0x147063[_0x287d23(0x208)](_0xb25211);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x183);[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x178);async['execute'](_0x170233){const _0x51e6ea=a26_0x22f2c4,{options:_0x54f1f6,args:_0xe97a16,tdx:_0x278f88}=_0x170233,_0x2fc418=_0xe97a16[0x0];_0x54f1f6[_0x51e6ea(0x13b)]&&(console[_0x51e6ea(0x16d)](_0x51e6ea(0x185)+_0x54f1f6['site']),_0x2fc418&&console[_0x51e6ea(0x16d)](_0x51e6ea(0x1fc)+_0x2fc418));const _0xbaf4b8=await withSpinner(_0x2fc418?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x2fc418+_0x51e6ea(0x200):_0x51e6ea(0x172),()=>_0x278f88[_0x51e6ea(0x144)]['listParents'](),{'verbose':_0x54f1f6[_0x51e6ea(0x13b)]});let _0x343b80=_0xbaf4b8[_0x51e6ea(0x1a2)];if(_0x2fc418){const _0x548034=_0x2fc418['replace'](/[.+^${}()|[\]\\]/g,_0x51e6ea(0x11e))['replace'](/\*/g,'.*')[_0x51e6ea(0x10f)](/\?/g,'.'),_0x289834=new RegExp('^'+_0x548034+'$','i');_0x343b80=_0x343b80[_0x51e6ea(0x1a3)](_0x4a7dba=>_0x289834[_0x51e6ea(0x146)](_0x4a7dba[_0x51e6ea(0x166)][_0x51e6ea(0x119)]));}_0x343b80[_0x51e6ea(0x134)]((_0x55b21b,_0x33d931)=>_0x55b21b['attributes'][_0x51e6ea(0x119)][_0x51e6ea(0x112)](_0x33d931[_0x51e6ea(0x166)][_0x51e6ea(0x119)])),console['error'](_0x51e6ea(0x10e)+_0x343b80['length']+_0x51e6ea(0x130)+(_0x343b80[_0x51e6ea(0x18e)]!==0x1?'s':''));if(_0x54f1f6[_0x51e6ea(0x1ea)]===_0x51e6ea(0x1fe)||_0x54f1f6[_0x51e6ea(0x1ea)]===_0x51e6ea(0x180))await handleSDKOutput(_0x343b80,_0x54f1f6);else{if(_0x343b80['length']===0x0)_0x2fc418?console[_0x51e6ea(0x1e7)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2fc418):console[_0x51e6ea(0x1e7)](_0x51e6ea(0x15f));else for(const _0x45b069 of _0x343b80){const _0x13b373=_0x45b069['attributes']['population']?a26_0x147063[_0x51e6ea(0x208)]('\x20('+formatRows(_0x45b069[_0x51e6ea(0x166)][_0x51e6ea(0x110)])+')'):'';console[_0x51e6ea(0x1e7)](_0x51e6ea(0x18d)+_0x45b069['attributes'][_0x51e6ea(0x119)]+_0x13b373);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x1c1);[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x1aa);async[a26_0x22f2c4(0x182)](_0x71eb36){const _0xda3159=a26_0x22f2c4,{options:_0x254daf,args:_0x1cfdf4,tdx:_0x456e1d}=_0x71eb36;console[_0xda3159(0x16d)](_0xda3159(0x184)+_0xda3159(0x204)+_0xda3159(0x13c));const _0x4a054a=_0x254daf;if(_0x1cfdf4[_0xda3159(0x18e)]===0x0)return console[_0xda3159(0x16d)](_0xda3159(0x149)),console[_0xda3159(0x16d)](_0xda3159(0x171)),0x1;const _0x1b5fc7=_0x1cfdf4[0x0];if(!_0x4a054a[_0xda3159(0x114)]||!_0x4a054a[_0xda3159(0x1ff)])return console[_0xda3159(0x16d)](_0xda3159(0x10d)),console[_0xda3159(0x16d)](_0xda3159(0x171)),0x1;_0x4a054a['verbose']&&(console[_0xda3159(0x16d)](_0xda3159(0x185)+_0x4a054a[_0xda3159(0x1a8)]),console[_0xda3159(0x16d)]('Name:\x20'+_0x1b5fc7),console['error']('Database:\x20'+_0x4a054a['database']),console[_0xda3159(0x16d)](_0xda3159(0x1e2)+_0x4a054a[_0xda3159(0x1ff)]));const _0x22f9e7=await loadJSONFromOptions(_0x4a054a[_0xda3159(0x166)],_0x4a054a['attributesFile']),_0x15749a=await loadJSONFromOptions(_0x4a054a['behaviors'],_0x4a054a[_0xda3159(0x1c7)]),_0x1ab253=await loadJSONFromOptions(_0x4a054a['customerGroup'],_0x4a054a['customerGroupFile']),_0x11ed29={'name':_0x1b5fc7,'description':_0x4a054a[_0xda3159(0x1ae)],'scheduleType':_0x4a054a[_0xda3159(0x173)],'scheduleOption':_0x4a054a[_0xda3159(0x181)],'timezone':_0x4a054a[_0xda3159(0x161)],'master':{'parentDatabaseName':_0x4a054a['database'],'parentTableName':_0x4a054a[_0xda3159(0x1ff)]},'attributes':_0x22f9e7,'behaviors':_0x15749a,'customerGroup':_0x1ab253},_0x2a4292=await withSpinner(_0xda3159(0x1cd)+_0x1b5fc7+_0xda3159(0x200),()=>_0x456e1d[_0xda3159(0x144)][_0xda3159(0x137)](_0x11ed29),{'verbose':_0x254daf[_0xda3159(0x13b)]}),_0x21d3d7=_0x2a4292[_0xda3159(0x1a2)];return console[_0xda3159(0x16d)](_0xda3159(0x18b)+_0x21d3d7[_0xda3159(0x119)]+_0xda3159(0x1ec)+_0x21d3d7['id']),await handleSDKOutput([_0x21d3d7],_0x254daf),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x209);[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x12c);async['execute'](_0x1a0bba){const _0x423431=a26_0x22f2c4,{options:_0x3e990a,args:_0x5ebecb,tdx:_0x2f9aff}=_0x1a0bba;console[_0x423431(0x16d)](_0x423431(0x142)+_0x423431(0x204)+_0x423431(0x13c));const _0x3b628e=_0x3e990a;if(_0x5ebecb['length']===0x0)return console['error'](_0x423431(0x149)),console[_0x423431(0x16d)](_0x423431(0x147)),0x1;const _0x32c01f=_0x5ebecb[0x0];_0x3b628e[_0x423431(0x13b)]&&(console[_0x423431(0x16d)](_0x423431(0x185)+_0x3b628e[_0x423431(0x1a8)]),console[_0x423431(0x16d)](_0x423431(0x192)+_0x32c01f));const _0x3e19b6=await withSpinner(_0x423431(0x1f5)+_0x32c01f+_0x423431(0x200),()=>_0x2f9aff[_0x423431(0x144)][_0x423431(0x1e0)](_0x32c01f),{'verbose':_0x3b628e[_0x423431(0x13b)]}),_0x44db8b=_0x3e19b6[_0x423431(0x1a2)],_0x1a310a=await loadJSONFromOptions(_0x3b628e['addAttributes'],_0x3b628e['addAttributesFile']),_0x17a0ae=await loadJSONFromOptions(_0x3b628e[_0x423431(0x1f8)],_0x3b628e[_0x423431(0x106)]),_0x6c7197={'name':_0x44db8b[_0x423431(0x119)],'description':_0x3b628e[_0x423431(0x1ae)]!==undefined?_0x3b628e['description']:_0x44db8b[_0x423431(0x1ae)],'scheduleType':_0x3b628e[_0x423431(0x173)]!==undefined?_0x3b628e[_0x423431(0x173)]:_0x44db8b['scheduleType'],'scheduleOption':_0x3b628e[_0x423431(0x181)]!==undefined?_0x3b628e[_0x423431(0x181)]:_0x44db8b['scheduleOption'],'timezone':_0x3b628e['timezone']!==undefined?_0x3b628e[_0x423431(0x161)]:_0x44db8b[_0x423431(0x161)],'master':_0x44db8b[_0x423431(0x145)],'attributes':_0x1a310a?[..._0x44db8b['attributes']||[],..._0x1a310a]:_0x44db8b['attributes'],'behaviors':_0x17a0ae?[..._0x44db8b[_0x423431(0x1b8)]||[],..._0x17a0ae]:_0x44db8b[_0x423431(0x1b8)],'customerGroup':_0x44db8b[_0x423431(0x198)]},_0x1b947a=await withSpinner(_0x423431(0x1a4)+_0x32c01f+'\x27...',()=>_0x2f9aff[_0x423431(0x144)][_0x423431(0x117)](_0x32c01f,_0x6c7197),{'verbose':_0x3b628e['verbose']}),_0x15add9=_0x1b947a['data'];return console[_0x423431(0x16d)](_0x423431(0x1cc)+_0x15add9[_0x423431(0x119)]+'\x27'),await handleSDKOutput([_0x15add9],_0x3b628e),0x0;}}export class ParentSegmentPullCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x135);[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x1df);async[a26_0x22f2c4(0x182)](_0x301d0d){const _0x3fa3eb=a26_0x22f2c4,{options:_0x2be27d,args:_0x19acdb,tdx:_0x23d104}=_0x301d0d,_0xb4ba34=_0x2be27d,_0x592d41=_0x19acdb[0x0]||_0x2be27d['parentSegment'];if(!_0x592d41)return console[_0x3fa3eb(0x16d)](a26_0x147063[_0x3fa3eb(0x1f6)](_0x3fa3eb(0x1eb))),console[_0x3fa3eb(0x16d)]('Usage:\x20tdx\x20ps\x20pull\x20[name]\x20[-o\x20output.yml]\x20[-y]\x0a'),console[_0x3fa3eb(0x16d)](a26_0x147063[_0x3fa3eb(0x1b7)](_0x3fa3eb(0x1ca))),0x1;const _0x16d198=_0xb4ba34['output']||a26_0x336003['join'](PARENT_SEGMENT_DIR,_0x592d41+_0x3fa3eb(0x1e8));_0xb4ba34['verbose']&&(console[_0x3fa3eb(0x16d)](_0x3fa3eb(0x185)+_0xb4ba34[_0x3fa3eb(0x1a8)]),console[_0x3fa3eb(0x16d)]('Parent\x20segment:\x20'+_0x592d41),console[_0x3fa3eb(0x16d)](_0x3fa3eb(0x128)+_0x16d198));const _0x85e4e8=await withSpinner(_0x3fa3eb(0x131)+_0x592d41+_0x3fa3eb(0x200),()=>_0x23d104[_0x3fa3eb(0x144)]['pullParentYaml'](_0x592d41),{'verbose':_0xb4ba34['verbose']}),_0xdd3957=_0x85e4e8['data'];if(existsSync(_0x16d198)){const _0x48e0df=readFileSync(_0x16d198,'utf-8'),_0x2837e0=generateDiff(_0x48e0df,_0xdd3957);if(!hasChanges(_0x2837e0))console[_0x3fa3eb(0x16d)](a26_0x147063['green']('✔')+_0x3fa3eb(0x1f3)+a26_0x147063[_0x3fa3eb(0x1b7)](_0x16d198)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x3fa3eb(0x16d)](_0x3fa3eb(0x1cb)+_0x16d198+'\x27:'),console[_0x3fa3eb(0x16d)]('─'['repeat'](0x3c)),console[_0x3fa3eb(0x16d)](formatDiffWithColors(_0x2837e0)),console['error']('─'[_0x3fa3eb(0x139)](0x3c));if(!_0xb4ba34[_0x3fa3eb(0x1fa)]){const _0x43d3c2=await confirmKey(_0x3fa3eb(0x169)+_0x16d198+'\x27?');if(!_0x43d3c2)return console[_0x3fa3eb(0x16d)](_0x3fa3eb(0x19d)),0x1;}writeFileSync(_0x16d198,_0xdd3957,'utf-8'),console[_0x3fa3eb(0x16d)](a26_0x147063['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x147063[_0x3fa3eb(0x1b7)](_0x16d198));}}else{const _0x4dac12=a26_0x336003[_0x3fa3eb(0x1f0)](_0x16d198);!existsSync(_0x4dac12)&&mkdirSync(_0x4dac12,{'recursive':!![]}),writeFileSync(_0x16d198,_0xdd3957,_0x3fa3eb(0x122)),console['error'](a26_0x147063['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x147063[_0x3fa3eb(0x1b7)](_0x16d198));}return _0xb4ba34[_0x3fa3eb(0x20a)]&&(saveSessionContext({'parent_segment':_0x592d41},_0xb4ba34[_0x3fa3eb(0x188)]),console[_0x3fa3eb(0x16d)](a26_0x147063[_0x3fa3eb(0x14c)]('✔')+_0x3fa3eb(0x168)+a26_0x147063[_0x3fa3eb(0x208)]('parent_segment')+_0x3fa3eb(0x163)+a26_0x147063[_0x3fa3eb(0x1b7)](_0x592d41))),0x0;}}export class ParentSegmentPushCommand extends BaseCommand{[a26_0x22f2c4(0x119)]='segment:parent:push';[a26_0x22f2c4(0x1ae)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x22f2c4(0x182)](_0x1f351e){const _0x8a135e=a26_0x22f2c4,{options:_0x2f6fe6,args:_0x2a6fc1,tdx:_0x2e32b7}=_0x1f351e,_0xce7806=_0x2f6fe6,_0x1551f5=_0x2a6fc1[0x0]||_0x2f6fe6['parentSegment'];if(!_0x1551f5)return console[_0x8a135e(0x16d)](a26_0x147063[_0x8a135e(0x1f6)](_0x8a135e(0x1eb))),console['error'](_0x8a135e(0x15b)),console[_0x8a135e(0x16d)](a26_0x147063[_0x8a135e(0x1b7)](_0x8a135e(0x164))),0x1;const _0x2e6b3a=resolveYamlFile(_0x1551f5);if(!existsSync(_0x2e6b3a))return console[_0x8a135e(0x16d)](_0x8a135e(0x190)+_0x2e6b3a),0x1;_0xce7806[_0x8a135e(0x13b)]&&(console['error'](_0x8a135e(0x185)+_0xce7806['site']),console[_0x8a135e(0x16d)](_0x8a135e(0x1fd)+_0x2e6b3a));let _0x14572f;try{_0x14572f=readFileSync(_0x2e6b3a,_0x8a135e(0x122));}catch(_0x2dd54f){const _0x29d93d=_0x2dd54f instanceof Error?_0x2dd54f[_0x8a135e(0x1a7)]:String(_0x2dd54f);return console['error'](_0x8a135e(0x115)+_0x29d93d),0x1;}const _0x586879=await withSpinner(_0x8a135e(0x1c5),()=>_0x2e32b7[_0x8a135e(0x144)][_0x8a135e(0x150)](_0x14572f),{'verbose':_0xce7806[_0x8a135e(0x13b)]}),_0x4ce70a=_0x586879[_0x8a135e(0x1a2)],{isNew:_0x48a042,name:_0x20edda,hasChanges:_0x5d9549,diffFormatted:_0x3f2b1b}=_0x4ce70a;if(!_0x5d9549)return console[_0x8a135e(0x16d)](_0x8a135e(0x175)+_0x20edda+_0x8a135e(0x12d)),0x0;_0x48a042?console[_0x8a135e(0x16d)](_0x8a135e(0x153)+_0x20edda+'\x27:'):console['error'](_0x8a135e(0x108)+_0x20edda+'\x27:');console[_0x8a135e(0x16d)]('─'[_0x8a135e(0x139)](0x3c)),console[_0x8a135e(0x16d)](_0x3f2b1b),console['error']('─'['repeat'](0x3c));const _0xc558e=_0x48a042?_0x8a135e(0x1ce)+_0x20edda+'\x27?':_0x8a135e(0x1d9)+_0x20edda+'\x27?';if(!_0xce7806[_0x8a135e(0x1fa)]){const _0x326d51=await confirmKey(_0xc558e);if(!_0x326d51)return console[_0x8a135e(0x16d)](_0x8a135e(0x19d)),0x1;}const _0x89f802=_0x48a042?_0x8a135e(0x103):'Updating',_0x1ccfca=await withSpinner(_0x89f802+_0x8a135e(0x121)+_0x20edda+_0x8a135e(0x200),()=>_0x4ce70a['apply'](),{'verbose':_0xce7806[_0x8a135e(0x13b)]}),_0x56ac02=_0x1ccfca['data'],_0x334d46=getConsoleNextUrl(_0xce7806[_0x8a135e(0x1a8)],_0x8a135e(0x1d4)+_0x56ac02['id']),_0x2030ea=_0x48a042?'Created':_0x8a135e(0x162);return console[_0x8a135e(0x16d)]('✔\x20'+_0x2030ea+'\x20parent\x20segment\x20\x27'+_0x56ac02[_0x8a135e(0x119)]+'\x27'),console[_0x8a135e(0x16d)]('\x20\x20'+_0x334d46),0x0;}}export class ParentSegmentValidateCommand extends BaseCommand{['name']=a26_0x22f2c4(0x1d8);[a26_0x22f2c4(0x1ae)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a26_0x22f2c4(0x182)](_0x5f11ff){const _0xc9c3fd=a26_0x22f2c4,{options:_0x2fd4f2,args:_0xe949d2,tdx:_0xf0b681}=_0x5f11ff,_0xca536d=_0x2fd4f2,_0x464d6b=_0xe949d2[0x0]||_0x2fd4f2[_0xc9c3fd(0x201)];if(!_0x464d6b)return console[_0xc9c3fd(0x16d)](a26_0x147063['red'](_0xc9c3fd(0x1eb))),console['error']('Usage:\x20tdx\x20parent-segment\x20validate\x20<name>\x20[options]\x0a'),console[_0xc9c3fd(0x16d)](_0xc9c3fd(0x109)),console[_0xc9c3fd(0x16d)]('\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)'),console[_0xc9c3fd(0x16d)](_0xc9c3fd(0x11d)),console[_0xc9c3fd(0x16d)](_0xc9c3fd(0x1d6)),console[_0xc9c3fd(0x16d)](a26_0x147063[_0xc9c3fd(0x1b7)](_0xc9c3fd(0x1d1))),0x1;const _0x3b49c5=resolveYamlFile(_0x464d6b);if(!existsSync(_0x3b49c5))return console[_0xc9c3fd(0x16d)](_0xc9c3fd(0x190)+_0x3b49c5),0x1;_0xca536d[_0xc9c3fd(0x13b)]&&(console['error']('Site:\x20'+_0xca536d[_0xc9c3fd(0x1a8)]),console[_0xc9c3fd(0x16d)](_0xc9c3fd(0x1fd)+_0x3b49c5));let _0x492125;try{_0x492125=readFileSync(_0x3b49c5,_0xc9c3fd(0x122));}catch(_0x1438d0){const _0x3fed20=_0x1438d0 instanceof Error?_0x1438d0[_0xc9c3fd(0x1a7)]:String(_0x1438d0);return console[_0xc9c3fd(0x16d)](_0xc9c3fd(0x115)+_0x3fed20),0x1;}const _0x3411f2=createCommandSpinner(a26_0x147063[_0xc9c3fd(0x208)](_0xc9c3fd(0x10b)),{'verbose':_0xca536d['verbose']});_0x3411f2['start']();const _0x44f3eb={'onProgress':_0x2a1942=>{const _0x1d8814=_0xc9c3fd;_0x3411f2[_0x1d8814(0x1fb)]=formatProgressMessage(_0x2a1942);}};if(_0xca536d['master'])_0x44f3eb[_0xc9c3fd(0x145)]=!![];if(_0xca536d[_0xc9c3fd(0x11b)])_0x44f3eb[_0xc9c3fd(0x11b)]=!![];_0xca536d[_0xc9c3fd(0x1d2)]&&(_0x44f3eb[_0xc9c3fd(0x1d2)]=_0xca536d['attribute']);_0xca536d[_0xc9c3fd(0x155)]&&(_0x44f3eb['behavior']=_0xca536d[_0xc9c3fd(0x155)]);if(_0xca536d[_0xc9c3fd(0x177)])_0x44f3eb[_0xc9c3fd(0x177)]=_0xca536d[_0xc9c3fd(0x177)];let _0x440385;try{_0x440385=await _0xf0b681[_0xc9c3fd(0x144)]['validateParentYaml'](_0x492125,_0x44f3eb),_0x3411f2[_0xc9c3fd(0x17c)]();}catch(_0x437fdf){_0x3411f2[_0xc9c3fd(0x17c)]();throw _0x437fdf;}const _0x59b74a=_0xca536d[_0xc9c3fd(0x177)]||_0xc9c3fd(0x16a);return this[_0xc9c3fd(0x157)](_0x440385,_0x44f3eb,_0x3b49c5,_0x59b74a),_0x440385[_0xc9c3fd(0x15d)]?0x0:0x1;}[a26_0x22f2c4(0x157)](_0x209f2b,_0x40c8f7,_0x830444,_0x1d8e37){const _0x4792a3=a26_0x22f2c4;console['error']('\x0a'+a26_0x147063[_0x4792a3(0x123)](_0x4792a3(0x16b))+'\x20'+_0x209f2b['name']),console['error']('═'[_0x4792a3(0x139)](0x3c)),this[_0x4792a3(0x203)](_0x209f2b);if(typeof _0x40c8f7['attribute']===_0x4792a3(0x11f)){this['displayAttributesStats'](_0x209f2b),this[_0x4792a3(0x1b3)](_0x209f2b),this['displayPreviewHints'](_0x830444,_0x1d8e37,'attribute',_0x40c8f7['attribute']);return;}if(_0x40c8f7['attribute']===!![]){this[_0x4792a3(0x154)](_0x209f2b),this[_0x4792a3(0x1b3)](_0x209f2b),this[_0x4792a3(0x1b4)](_0x830444,_0x1d8e37,_0x4792a3(0x166));return;}if(typeof _0x40c8f7[_0x4792a3(0x155)]===_0x4792a3(0x11f)){this[_0x4792a3(0x1b1)](_0x209f2b,_0x1d8e37),this[_0x4792a3(0x1b3)](_0x209f2b),this[_0x4792a3(0x1b4)](_0x830444,_0x1d8e37,_0x4792a3(0x155),_0x40c8f7[_0x4792a3(0x155)]);return;}if(_0x40c8f7[_0x4792a3(0x155)]===!![]){this['displayBehaviorsStats'](_0x209f2b,_0x1d8e37),this[_0x4792a3(0x1b3)](_0x209f2b),this[_0x4792a3(0x1b4)](_0x830444,_0x1d8e37,_0x4792a3(0x1b8));return;}this[_0x4792a3(0x154)](_0x209f2b),this[_0x4792a3(0x1b1)](_0x209f2b,_0x1d8e37),this[_0x4792a3(0x1b3)](_0x209f2b),this[_0x4792a3(0x1b4)](_0x830444,_0x1d8e37,_0x4792a3(0x14d));}[a26_0x22f2c4(0x1b4)](_0x2bb01a,_0x4d274a,_0x5dacdb,_0x3d2082){const _0xfa092d=a26_0x22f2c4;console[_0xfa092d(0x16d)]('\x0a'+a26_0x147063[_0xfa092d(0x208)](_0xfa092d(0x156)));const _0x5a1aff=_0x4d274a!==_0xfa092d(0x16a)?'\x20--interval\x20'+_0x4d274a:'';if(_0x5dacdb==='attribute'&&_0x3d2082)console[_0xfa092d(0x16d)]('\x20\x20'+a26_0x147063['dim'](_0xfa092d(0x1dc)+_0x2bb01a+_0xfa092d(0x17a)+_0x3d2082+'\x22'+_0x5a1aff));else{if(_0x5dacdb===_0xfa092d(0x155)&&_0x3d2082)console[_0xfa092d(0x16d)]('\x20\x20'+a26_0x147063[_0xfa092d(0x208)](_0xfa092d(0x1dc)+_0x2bb01a+_0xfa092d(0x189)+_0x3d2082+'\x22'+_0x5a1aff));else(_0x5dacdb==='attributes'||_0x5dacdb===_0xfa092d(0x14d))&&console['error']('\x20\x20'+a26_0x147063[_0xfa092d(0x208)](_0xfa092d(0x1dc)+_0x2bb01a+_0xfa092d(0x143)+_0x5a1aff));}(_0x5dacdb===_0xfa092d(0x1b8)||_0x5dacdb===_0xfa092d(0x14d))&&console[_0xfa092d(0x16d)]('\x20\x20'+a26_0x147063[_0xfa092d(0x208)](_0xfa092d(0x1dc)+_0x2bb01a+_0xfa092d(0x1f1)+_0x5a1aff)),_0x5dacdb===_0xfa092d(0x14d)&&console['error']('\x20\x20'+a26_0x147063[_0xfa092d(0x208)](_0xfa092d(0x1dc)+_0x2bb01a+'\x20--enriched'+_0x5a1aff));}[a26_0x22f2c4(0x203)](_0x167a86){const _0x183526=a26_0x22f2c4,{master:_0x270b4d}=_0x167a86,_0x2648e9=_0x270b4d[_0x183526(0x206)]?a26_0x147063[_0x183526(0x14c)]('✔'):a26_0x147063[_0x183526(0x1f6)]('✘');console[_0x183526(0x16d)]('\x0a'+a26_0x147063[_0x183526(0x208)](_0x183526(0x1d5))),console[_0x183526(0x16d)](_0x2648e9+'\x20'+a26_0x147063[_0x183526(0x123)](_0x270b4d['database']+'.'+_0x270b4d[_0x183526(0x1ff)])),_0x270b4d[_0x183526(0x206)]?_0x270b4d['rowCount']!==undefined&&console[_0x183526(0x16d)]('\x20\x20'+a26_0x147063[_0x183526(0x208)]('Rows:')+'\x20'+a26_0x147063[_0x183526(0x1b7)](formatRows(_0x270b4d['rowCount']))):console['error']('\x20\x20'+a26_0x147063['red']('Error:')+'\x20'+_0x270b4d[_0x183526(0x124)]);}[a26_0x22f2c4(0x154)](_0x292d6b){const _0xbbd5b6=a26_0x22f2c4;if(_0x292d6b[_0xbbd5b6(0x166)][_0xbbd5b6(0x18e)]===0x0)return;console[_0xbbd5b6(0x16d)]('\x0a'+a26_0x147063[_0xbbd5b6(0x208)](_0xbbd5b6(0x1de)));for(const _0x796282 of _0x292d6b[_0xbbd5b6(0x166)]){const _0x5a3f18=_0x796282[_0xbbd5b6(0x206)]?a26_0x147063[_0xbbd5b6(0x14c)]('✔'):a26_0x147063[_0xbbd5b6(0x1f6)]('✘');let _0x1fa2b8='';if(_0x796282['schemaValid']&&_0x796282[_0xbbd5b6(0x1e3)]!==undefined&&_0x796282['coveragePercent']!==undefined){const _0x580093=_0x796282['coveragePercent'][_0xbbd5b6(0x1e5)](0x1),_0x33b240=_0x796282[_0xbbd5b6(0x1e6)]>=0x50?a26_0x147063[_0xbbd5b6(0x14c)]:_0x796282['coveragePercent']>=0x32?a26_0x147063[_0xbbd5b6(0x195)]:a26_0x147063['red'];_0x1fa2b8='\x20'+a26_0x147063[_0xbbd5b6(0x208)](_0xbbd5b6(0x1a6))+'\x20'+_0x33b240(_0x580093+'%')+'\x20('+formatRows(_0x796282[_0xbbd5b6(0x1e3)])+_0xbbd5b6(0x1ba);}console[_0xbbd5b6(0x16d)](_0x5a3f18+'\x20'+a26_0x147063[_0xbbd5b6(0x123)](_0x796282[_0xbbd5b6(0x119)])+_0x1fa2b8),console['error']('\x20\x20'+a26_0x147063[_0xbbd5b6(0x208)]('Source:')+'\x20'+a26_0x147063[_0xbbd5b6(0x123)](_0x796282[_0xbbd5b6(0x114)]+'.'+_0x796282[_0xbbd5b6(0x1ff)]));const _0x24ec38=_0x796282[_0xbbd5b6(0x1b0)]===_0x796282[_0xbbd5b6(0x10a)]?a26_0x147063[_0xbbd5b6(0x208)]('Join\x20on:')+'\x20'+_0x796282[_0xbbd5b6(0x1b0)]:a26_0x147063[_0xbbd5b6(0x208)](_0xbbd5b6(0x1ac))+'\x20'+_0x796282[_0xbbd5b6(0x1b0)]+'\x20=\x20'+_0x796282[_0xbbd5b6(0x10a)];console[_0xbbd5b6(0x16d)]('\x20\x20'+_0x24ec38),console['error']('\x20\x20'+a26_0x147063['dim']('Columns:')),this['displayColumns'](_0x796282[_0xbbd5b6(0x10c)]),!_0x796282['schemaValid']&&console[_0xbbd5b6(0x16d)]('\x20\x20'+a26_0x147063[_0xbbd5b6(0x1f6)](_0xbbd5b6(0x15e))+'\x20'+_0x796282[_0xbbd5b6(0x124)]);}}['displayBehaviorsStats'](_0x353f53,_0x2bb76d){const _0x226c34=a26_0x22f2c4;if(_0x353f53['behaviors'][_0x226c34(0x18e)]===0x0)return;console[_0x226c34(0x16d)]('\x0a'+a26_0x147063[_0x226c34(0x208)]('Behaviors')+'\x20'+a26_0x147063[_0x226c34(0x208)]('('+_0x2bb76d+')'));for(const _0x3f4d2f of _0x353f53['behaviors']){const _0x35a45c=_0x3f4d2f[_0x226c34(0x206)]?a26_0x147063['green']('✔'):a26_0x147063[_0x226c34(0x1f6)]('✘');let _0x45fe7d='';if(_0x3f4d2f[_0x226c34(0x206)]&&_0x3f4d2f[_0x226c34(0x1bf)]!==undefined&&_0x3f4d2f[_0x226c34(0x17d)]!==undefined){const _0xbfb87e=_0x3f4d2f['customerPercent']?.[_0x226c34(0x1e5)](0x1)||'?',_0x4e4929=(_0x3f4d2f[_0x226c34(0x136)]??0x0)>=0x32?a26_0x147063[_0x226c34(0x14c)]:(_0x3f4d2f[_0x226c34(0x136)]??0x0)>=0x14?a26_0x147063['yellow']:a26_0x147063[_0x226c34(0x1f6)];_0x45fe7d='\x20'+a26_0x147063[_0x226c34(0x208)](_0x226c34(0x19a))+'\x20'+_0x4e4929(formatRows(_0x3f4d2f[_0x226c34(0x1bf)]))+'\x20('+_0xbfb87e+_0x226c34(0x179)+a26_0x147063[_0x226c34(0x208)](_0x226c34(0x176))+'\x20'+a26_0x147063['cyan'](formatRows(_0x3f4d2f['totalEvents']));}console['error'](_0x35a45c+'\x20'+a26_0x147063[_0x226c34(0x123)](_0x3f4d2f[_0x226c34(0x119)])+_0x45fe7d),console[_0x226c34(0x16d)]('\x20\x20'+a26_0x147063[_0x226c34(0x208)](_0x226c34(0x12b))+'\x20'+a26_0x147063[_0x226c34(0x123)](_0x3f4d2f[_0x226c34(0x114)]+'.'+_0x3f4d2f[_0x226c34(0x1ff)]));const _0x475a92=_0x3f4d2f[_0x226c34(0x1b0)]===_0x3f4d2f[_0x226c34(0x10a)]?a26_0x147063[_0x226c34(0x208)](_0x226c34(0x125))+'\x20'+_0x3f4d2f[_0x226c34(0x1b0)]:a26_0x147063['dim'](_0x226c34(0x1ac))+'\x20'+_0x3f4d2f[_0x226c34(0x1b0)]+_0x226c34(0x163)+_0x3f4d2f[_0x226c34(0x10a)];console['error']('\x20\x20'+_0x475a92),console[_0x226c34(0x16d)]('\x20\x20'+a26_0x147063['dim'](_0x226c34(0x205))),this[_0x226c34(0x1c4)](_0x3f4d2f[_0x226c34(0x10c)]),!_0x3f4d2f[_0x226c34(0x206)]&&console[_0x226c34(0x16d)]('\x20\x20'+a26_0x147063['red'](_0x226c34(0x15e))+'\x20'+_0x3f4d2f[_0x226c34(0x124)]);}}[a26_0x22f2c4(0x1c4)](_0x5925a7){const _0x366980=a26_0x22f2c4;for(const _0x30d45f of _0x5925a7){_0x30d45f['label']===_0x30d45f[_0x366980(0x18f)]||_0x30d45f[_0x366980(0x18f)]==='*'?console[_0x366980(0x16d)](_0x366980(0x1f2)+_0x30d45f[_0x366980(0x1bc)]):console[_0x366980(0x16d)](_0x366980(0x1f2)+_0x30d45f[_0x366980(0x1bc)]+'\x20'+a26_0x147063[_0x366980(0x208)]('('+_0x30d45f[_0x366980(0x18f)]+')'));}}['displaySummary'](_0x4c6119){const _0x33e666=a26_0x22f2c4;console[_0x33e666(0x16d)]('─'[_0x33e666(0x139)](0x3c));if(_0x4c6119[_0x33e666(0x1af)][_0x33e666(0x18e)]>0x0){console[_0x33e666(0x16d)]('\x0a'+a26_0x147063[_0x33e666(0x1f6)](_0x33e666(0x17e)));for(const _0x5ccedb of _0x4c6119['errors']){console['error']('\x20\x20'+a26_0x147063['red']('•')+'\x20'+_0x5ccedb);}}_0x4c6119['allValid']&&console['error']('\x0a'+a26_0x147063[_0x33e666(0x14c)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseCommand{[a26_0x22f2c4(0x119)]='segment:parent:preview';[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x1c2);async[a26_0x22f2c4(0x182)](_0xa7a51f){const _0x2ae2b4=a26_0x22f2c4,{options:_0x3382ba,args:_0x8bc0e4,tdx:_0x4f70f1}=_0xa7a51f,_0x3283e6=_0x3382ba,_0x21e61e=_0x8bc0e4[0x0]||_0x3382ba[_0x2ae2b4(0x201)];if(!_0x21e61e)return console[_0x2ae2b4(0x16d)](a26_0x147063[_0x2ae2b4(0x1f6)](_0x2ae2b4(0x1eb))),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x129)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x160)),console['error'](_0x2ae2b4(0x1ab)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x1c0)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x19c)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x199)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x1d6)),console[_0x2ae2b4(0x16d)](a26_0x147063['cyan'](_0x2ae2b4(0x1d1))),0x1;if(!_0x3283e6[_0x2ae2b4(0x145)]&&!_0x3283e6['attribute']&&!_0x3283e6['behavior']&&!_0x3283e6[_0x2ae2b4(0x11b)])return console[_0x2ae2b4(0x16d)](a26_0x147063['red']('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x2ae2b4(0x16d)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x109)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x1ab)),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x1c0)),console[_0x2ae2b4(0x16d)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x2ae2b4(0x199)),0x1;const _0x586c82=resolveYamlFile(_0x21e61e);if(!existsSync(_0x586c82))return console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x190)+_0x586c82),0x1;_0x3283e6[_0x2ae2b4(0x13b)]&&(console['error']('Site:\x20'+_0x3283e6[_0x2ae2b4(0x1a8)]),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x1fd)+_0x586c82));let _0x2b4eda;try{_0x2b4eda=readFileSync(_0x586c82,'utf-8');}catch(_0x5c7b15){const _0x187f03=_0x5c7b15 instanceof Error?_0x5c7b15[_0x2ae2b4(0x1a7)]:String(_0x5c7b15);return console['error'](_0x2ae2b4(0x115)+_0x187f03),0x1;}let _0x3dfeec;try{_0x3dfeec=parseYamlString(_0x2b4eda);}catch(_0x4c273d){const _0x20d063=_0x4c273d instanceof Error?_0x4c273d[_0x2ae2b4(0x1a7)]:String(_0x4c273d);return console['error'](a26_0x147063[_0x2ae2b4(0x1f6)]('Error\x20parsing\x20YAML:\x20'+_0x20d063)),0x1;}if(_0x3283e6[_0x2ae2b4(0x1d2)]===!![]||_0x3283e6['attribute']===''){const _0x253118=_0x3dfeec[_0x2ae2b4(0x166)]?.[_0x2ae2b4(0x202)](_0x2b4971=>_0x2b4971[_0x2ae2b4(0x119)])||[];if(_0x253118[_0x2ae2b4(0x18e)]===0x0)console[_0x2ae2b4(0x16d)](a26_0x147063[_0x2ae2b4(0x1f6)](_0x2ae2b4(0x193)));else{console[_0x2ae2b4(0x16d)](a26_0x147063[_0x2ae2b4(0x1f6)](_0x2ae2b4(0x126))),console[_0x2ae2b4(0x16d)]('Available\x20attributes:');for(const _0x1cef1f of _0x253118){console[_0x2ae2b4(0x16d)]('\x20\x20'+a26_0x147063[_0x2ae2b4(0x1b7)](_0x1cef1f));}console[_0x2ae2b4(0x16d)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x21e61e+_0x2ae2b4(0x17a)+_0x253118[0x0]+'\x22');}return 0x1;}if(_0x3283e6[_0x2ae2b4(0x155)]===!![]||_0x3283e6['behavior']===''){const _0x1cca00=_0x3dfeec[_0x2ae2b4(0x1b8)]?.['map'](_0x59e2ef=>_0x59e2ef[_0x2ae2b4(0x119)])||[];if(_0x1cca00['length']===0x0)console[_0x2ae2b4(0x16d)](a26_0x147063[_0x2ae2b4(0x1f6)](_0x2ae2b4(0x13e)));else{console[_0x2ae2b4(0x16d)](a26_0x147063[_0x2ae2b4(0x1f6)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x1d3));for(const _0x3c405f of _0x1cca00){console['error']('\x20\x20'+a26_0x147063[_0x2ae2b4(0x1b7)](_0x3c405f));}console[_0x2ae2b4(0x16d)](_0x2ae2b4(0x170)+_0x21e61e+_0x2ae2b4(0x189)+_0x1cca00[0x0]+'\x22');}return 0x1;}const _0x24c350=createCommandSpinner(a26_0x147063[_0x2ae2b4(0x208)](_0x2ae2b4(0x167)),{'verbose':_0x3283e6[_0x2ae2b4(0x13b)]});_0x24c350['start']();const _0x5d4b43={'onProgress':_0x5b1c59=>{const _0x5c127d=_0x2ae2b4;_0x24c350[_0x5c127d(0x1fb)]=formatProgressMessage(_0x5b1c59);}};if(_0x3283e6['master'])_0x5d4b43[_0x2ae2b4(0x145)]=!![];if(_0x3283e6[_0x2ae2b4(0x1d2)]&&typeof _0x3283e6[_0x2ae2b4(0x1d2)]==='string')_0x5d4b43[_0x2ae2b4(0x1d2)]=_0x3283e6[_0x2ae2b4(0x1d2)];if(_0x3283e6['behavior']&&typeof _0x3283e6[_0x2ae2b4(0x155)]===_0x2ae2b4(0x11f))_0x5d4b43[_0x2ae2b4(0x155)]=_0x3283e6[_0x2ae2b4(0x155)];if(_0x3283e6['enriched'])_0x5d4b43[_0x2ae2b4(0x11b)]=!![];if(_0x3283e6[_0x2ae2b4(0x177)])_0x5d4b43[_0x2ae2b4(0x177)]=_0x3283e6[_0x2ae2b4(0x177)];let _0x51843e;try{_0x51843e=await _0x4f70f1[_0x2ae2b4(0x144)][_0x2ae2b4(0x19f)](_0x2b4eda,_0x5d4b43),_0x24c350[_0x2ae2b4(0x17c)]();}catch(_0x240405){_0x24c350[_0x2ae2b4(0x17c)]();throw _0x240405;}return await this['displayPreviewResults'](_0x51843e,{'master':_0x3283e6[_0x2ae2b4(0x145)],'attribute':typeof _0x3283e6[_0x2ae2b4(0x1d2)]===_0x2ae2b4(0x11f)?_0x3283e6[_0x2ae2b4(0x1d2)]:undefined,'behavior':typeof _0x3283e6[_0x2ae2b4(0x155)]===_0x2ae2b4(0x11f)?_0x3283e6[_0x2ae2b4(0x155)]:undefined,'enriched':_0x3283e6[_0x2ae2b4(0x11b)]}),_0x51843e[_0x2ae2b4(0x15d)]?0x0:0x1;}async[a26_0x22f2c4(0x194)](_0x36a855,_0x24da7a){const _0x49ea19=a26_0x22f2c4;console['error']('\x0a'+a26_0x147063[_0x49ea19(0x123)]('Preview:')+'\x20'+_0x36a855[_0x49ea19(0x119)]),console[_0x49ea19(0x16d)]('═'[_0x49ea19(0x139)](0x3c));if(_0x24da7a['master']&&_0x36a855[_0x49ea19(0x174)]){const _0x59b9e2=a26_0x147063['dim'](_0x49ea19(0x104))+'\x20'+a26_0x147063[_0x49ea19(0x123)](_0x36a855[_0x49ea19(0x145)][_0x49ea19(0x114)]+'.'+_0x36a855[_0x49ea19(0x145)][_0x49ea19(0x1ff)]);await this[_0x49ea19(0x16e)](_0x59b9e2,_0x36a855[_0x49ea19(0x174)]);}else{if(_0x24da7a[_0x49ea19(0x1d2)]&&_0x36a855[_0x49ea19(0x174)]){const _0xc44331=a26_0x147063['dim'](_0x49ea19(0x14f))+'\x20'+a26_0x147063[_0x49ea19(0x123)](_0x24da7a['attribute']);await this['displaySampleData'](_0xc44331,_0x36a855['sampleData']);}else{if(_0x24da7a[_0x49ea19(0x155)]&&_0x36a855['sampleData']){const _0x22f5d1=a26_0x147063['dim']('Behavior:')+'\x20'+a26_0x147063['bold'](_0x24da7a[_0x49ea19(0x155)]);await this[_0x49ea19(0x16e)](_0x22f5d1,_0x36a855['sampleData']);}else{if(_0x24da7a[_0x49ea19(0x11b)]&&_0x36a855[_0x49ea19(0x174)]){const _0x210e89=a26_0x147063['dim'](_0x49ea19(0x132))+'\x20'+a26_0x147063[_0x49ea19(0x123)](_0x49ea19(0x113));await this[_0x49ea19(0x16e)](_0x210e89,_0x36a855[_0x49ea19(0x174)]);}else!_0x36a855[_0x49ea19(0x174)]&&console['error'](_0x49ea19(0x187));}}}if(_0x36a855[_0x49ea19(0x1af)][_0x49ea19(0x18e)]>0x0){console[_0x49ea19(0x16d)]('─'[_0x49ea19(0x139)](0x3c)),console[_0x49ea19(0x16d)]('\x0a'+a26_0x147063[_0x49ea19(0x1f6)](_0x49ea19(0x17e)));for(const _0x5ec46e of _0x36a855['errors']){console['error']('\x20\x20'+a26_0x147063[_0x49ea19(0x1f6)]('•')+'\x20'+_0x5ec46e);}}}async[a26_0x22f2c4(0x16e)](_0x5e5f4f,_0x28902b){const _0x3c88c0=a26_0x22f2c4;if(_0x28902b[_0x3c88c0(0x18e)]===0x0){console[_0x3c88c0(0x16d)]('\x0a'+_0x5e5f4f),console[_0x3c88c0(0x16d)](_0x3c88c0(0x12f));return;}console[_0x3c88c0(0x16d)]('\x0a'+_0x5e5f4f);const _0xeb9a74=Object[_0x3c88c0(0x133)](_0x28902b[0x0])[_0x3c88c0(0x202)](_0x21ca63=>({'name':_0x21ca63,'type':typeof _0x28902b[0x0][_0x21ca63]===_0x3c88c0(0x17f)?'double':_0x3c88c0(0x11a)})),_0x26a75e={'queryId':_0x3c88c0(0x17b),'columns':_0xeb9a74,'data':_0x28902b,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x28902b[_0x3c88c0(0x18e)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2b2e02=formatAsTable(_0x26a75e,_0x28902b[_0x3c88c0(0x18e)],!![]);await writeOutput(_0x2b2e02,undefined,_0x3c88c0(0x1ff));}}export class ParentSegmentRunCommand extends BaseCommand{['name']=a26_0x22f2c4(0x1f7);[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x1f4);async[a26_0x22f2c4(0x182)](_0x71b4ad){const _0x506b7e=a26_0x22f2c4,{options:_0x834740,args:_0x4aca23,tdx:_0x4f9b5b}=_0x71b4ad,_0x233670=_0x834740,_0x2b409f=_0x4aca23[0x0]||_0x834740[_0x506b7e(0x201)];if(!_0x2b409f)return console['error'](a26_0x147063[_0x506b7e(0x1f6)](_0x506b7e(0x1eb))),console[_0x506b7e(0x16d)](_0x506b7e(0x14e)),console[_0x506b7e(0x16d)](a26_0x147063[_0x506b7e(0x1b7)](_0x506b7e(0x1ca))),0x1;const _0x106ff1=resolveYamlFile(_0x2b409f);if(existsSync(_0x106ff1)){_0x233670[_0x506b7e(0x13b)]&&console[_0x506b7e(0x16d)](_0x506b7e(0x140)+_0x106ff1);let _0x23b727;try{_0x23b727=readFileSync(_0x106ff1,_0x506b7e(0x122));}catch(_0x48c260){const _0x5a6f34=_0x48c260 instanceof Error?_0x48c260[_0x506b7e(0x1a7)]:String(_0x48c260);return console[_0x506b7e(0x16d)](_0x506b7e(0x115)+_0x5a6f34),0x1;}const _0x2fb591=await withSpinner('Analyzing\x20changes...',()=>_0x4f9b5b[_0x506b7e(0x144)][_0x506b7e(0x150)](_0x23b727),{'verbose':_0x233670[_0x506b7e(0x13b)]}),_0x57a5b8=_0x2fb591[_0x506b7e(0x1a2)],{isNew:_0x360c46,name:_0xc66d72,hasChanges:_0xec7051,diffFormatted:_0x485000}=_0x57a5b8;if(_0xec7051){_0x360c46?console[_0x506b7e(0x16d)](_0x506b7e(0x153)+_0xc66d72+'\x27:'):console['error'](_0x506b7e(0x108)+_0xc66d72+'\x27:');console[_0x506b7e(0x16d)]('─'[_0x506b7e(0x139)](0x3c)),console[_0x506b7e(0x16d)](_0x485000),console['error']('─'[_0x506b7e(0x139)](0x3c));const _0x53b55f=_0x360c46?'Create\x20parent\x20segment\x20\x27'+_0xc66d72+_0x506b7e(0x1db):_0x506b7e(0x1d9)+_0xc66d72+'\x27\x20and\x20run\x20workflow?';if(!_0x233670[_0x506b7e(0x1fa)]){const _0x5915eb=await confirmKey(_0x53b55f);if(!_0x5915eb)return console['error'](_0x506b7e(0x19d)),0x1;}const _0x153654=_0x360c46?_0x506b7e(0x103):_0x506b7e(0x197);await withSpinner(_0x153654+'\x20parent\x20segment\x20\x27'+_0xc66d72+_0x506b7e(0x200),()=>_0x57a5b8[_0x506b7e(0x13f)](),{'verbose':_0x233670[_0x506b7e(0x13b)]});const _0x191c65=_0x360c46?_0x506b7e(0x1dd):_0x506b7e(0x162);console[_0x506b7e(0x16d)]('✔\x20'+_0x191c65+_0x506b7e(0x121)+_0xc66d72+'\x27');}else console[_0x506b7e(0x16d)](_0x506b7e(0x175)+_0xc66d72+_0x506b7e(0x1e9));}const _0x293c14=await withSpinner(_0x506b7e(0x1da)+_0x2b409f+_0x506b7e(0x200),()=>_0x4f9b5b[_0x506b7e(0x144)][_0x506b7e(0x141)](_0x2b409f),{'verbose':_0x233670['verbose']}),_0x139b06=_0x293c14[_0x506b7e(0x1a2)],_0x5ef81c=getConsoleUrl(_0x233670[_0x506b7e(0x1a8)],'/app/workflows/'+_0x139b06[_0x506b7e(0x191)]+_0x506b7e(0x12e)+_0x139b06['workflowSessionId']+_0x506b7e(0x13a)+_0x139b06['workflowAttemptId']);return console[_0x506b7e(0x16d)](_0x506b7e(0x1c3)),console[_0x506b7e(0x16d)]('\x20\x20'+a26_0x147063[_0x506b7e(0x208)](_0x506b7e(0x159))+'\x20'+_0x139b06[_0x506b7e(0x1f9)]),console[_0x506b7e(0x16d)]('\x20\x20'+a26_0x147063[_0x506b7e(0x208)](_0x506b7e(0x1a5))+'\x20'+_0x139b06[_0x506b7e(0x151)]),console[_0x506b7e(0x16d)]('\x20\x20'+a26_0x147063[_0x506b7e(0x208)](_0x506b7e(0x14b))+'\x20'+_0x139b06[_0x506b7e(0x1b5)]),console['error']('\x20\x20'+a26_0x147063[_0x506b7e(0x208)](_0x506b7e(0x116))+'\x20'+_0x139b06[_0x506b7e(0x207)]),console[_0x506b7e(0x16d)]('\x20\x20'+_0x5ef81c),console[_0x506b7e(0x16d)]('\x0a'+a26_0x147063['dim'](_0x506b7e(0x13d))+_0x506b7e(0x102)+_0x139b06[_0x506b7e(0x207)]+_0x506b7e(0x20b)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x1a1);[a26_0x22f2c4(0x1ae)]='List\x20available\x20fields\x20for\x20segmentation';async[a26_0x22f2c4(0x182)](_0x5125d9){const _0x394e48=a26_0x22f2c4,{options:_0x8b0cc8,args:_0x17a9c1,tdx:_0x12d082}=_0x5125d9,_0x4b9832=_0x17a9c1[0x0]||_0x8b0cc8[_0x394e48(0x201)];if(!_0x4b9832)return console[_0x394e48(0x16d)](a26_0x147063[_0x394e48(0x1f6)](_0x394e48(0x1eb))),console[_0x394e48(0x16d)](_0x394e48(0x1e4)),console[_0x394e48(0x16d)](a26_0x147063['cyan'](_0x394e48(0x1ca))),0x1;_0x8b0cc8[_0x394e48(0x13b)]&&(console['error'](_0x394e48(0x185)+_0x8b0cc8[_0x394e48(0x1a8)]),console[_0x394e48(0x16d)](_0x394e48(0x192)+_0x4b9832));const _0x377ce7=await withSpinner(_0x394e48(0x1ad)+_0x4b9832+_0x394e48(0x200),()=>_0x12d082[_0x394e48(0x144)][_0x394e48(0x14a)](_0x4b9832),{'verbose':_0x8b0cc8[_0x394e48(0x13b)]}),_0x2e78d2=_0x377ce7[_0x394e48(0x1a2)];console[_0x394e48(0x16d)](_0x394e48(0x10e)+_0x2e78d2['length']+_0x394e48(0x1be)+(_0x2e78d2[_0x394e48(0x18e)]!==0x1?'s':''));if(_0x8b0cc8[_0x394e48(0x1fe)]||_0x8b0cc8['jsonl'])return await handleSDKOutput(_0x2e78d2,_0x8b0cc8),0x0;return displayFieldsHumanReadable(_0x2e78d2,_0x4b9832),0x0;}}export class ParentSegmentInfoCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x165);[a26_0x22f2c4(0x1ae)]='Show\x20parent\x20segment\x20details';async[a26_0x22f2c4(0x182)](_0x5b33c5){const _0x224f91=a26_0x22f2c4,{options:_0x2bfa5f,args:_0x18a145,tdx:_0x307b29}=_0x5b33c5,_0x58f700=_0x18a145[0x0]||_0x2bfa5f[_0x224f91(0x201)];if(!_0x58f700)return console['error'](a26_0x147063[_0x224f91(0x1f6)](_0x224f91(0x1eb))),console[_0x224f91(0x16d)](_0x224f91(0x19b)),console[_0x224f91(0x16d)](a26_0x147063[_0x224f91(0x1b7)](_0x224f91(0x1ca))),0x1;_0x2bfa5f[_0x224f91(0x13b)]&&(console[_0x224f91(0x16d)](_0x224f91(0x185)+_0x2bfa5f[_0x224f91(0x1a8)]),console['error'](_0x224f91(0x192)+_0x58f700));const _0x4f6ca6=await withSpinner(_0x224f91(0x131)+_0x58f700+_0x224f91(0x200),()=>_0x307b29[_0x224f91(0x144)][_0x224f91(0x1e0)](_0x58f700),{'verbose':_0x2bfa5f[_0x224f91(0x13b)]});return await handleSingleObjectOutput(_0x4f6ca6[_0x224f91(0x1a2)],_0x2bfa5f),0x0;}}function a26_0x21d5(_0x1f399b,_0x308f28){const _0x3625ba=a26_0x3625();return a26_0x21d5=function(_0x21d5ad,_0x31a34c){_0x21d5ad=_0x21d5ad-0x102;let _0xf4b403=_0x3625ba[_0x21d5ad];return _0xf4b403;},a26_0x21d5(_0x1f399b,_0x308f28);}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x186);[a26_0x22f2c4(0x1ae)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x517366){const _0x40a6f0=a26_0x22f2c4,{options:_0x4e3ade,args:_0x1510d3,tdx:_0x13f9db}=_0x517366,_0x2cad16=_0x1510d3[0x0]||_0x4e3ade[_0x40a6f0(0x201)];if(!_0x2cad16)return console['error'](a26_0x147063[_0x40a6f0(0x1f6)](_0x40a6f0(0x1eb))),console[_0x40a6f0(0x16d)](_0x40a6f0(0x1b2)),console[_0x40a6f0(0x16d)](a26_0x147063['cyan'](_0x40a6f0(0x1ca))),0x1;_0x4e3ade[_0x40a6f0(0x13b)]&&(console['error'](_0x40a6f0(0x185)+_0x4e3ade[_0x40a6f0(0x1a8)]),console[_0x40a6f0(0x16d)]('Parent\x20segment:\x20'+_0x2cad16));const _0x124c49=await withSpinner(_0x40a6f0(0x1bb)+_0x2cad16+'\x27...',()=>_0x13f9db[_0x40a6f0(0x144)][_0x40a6f0(0x20c)](_0x2cad16),{'verbose':_0x4e3ade[_0x40a6f0(0x13b)]}),_0x2f2991=_0x124c49['data'],_0x21f5ec=await withSpinner(_0x40a6f0(0x1e1)+_0x2cad16+_0x40a6f0(0x200),()=>_0x13f9db['segment'][_0x40a6f0(0x1ef)](_0x2f2991),{'verbose':_0x4e3ade[_0x40a6f0(0x13b)]}),_0x54fe73=await executeSchemaQuery(_0x21f5ec[_0x40a6f0(0x1a2)],_0x13f9db,_0x4e3ade);return await handleQueryOutput(_0x54fe73,_0x4e3ade),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x22f2c4(0x119)]='segment:parent:sql';[a26_0x22f2c4(0x1ae)]=a26_0x22f2c4(0x158);async[a26_0x22f2c4(0x182)](_0x970629){const _0x568306=a26_0x22f2c4,{options:_0x55c01f,args:_0xb8c5c6,tdx:_0x1b88bb}=_0x970629,_0x4cdf96=_0xb8c5c6[0x0]||_0x55c01f['parentSegment'];if(!_0x4cdf96)return console[_0x568306(0x16d)](a26_0x147063[_0x568306(0x1f6)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x568306(0x16d)](_0x568306(0x19e)),console['error'](a26_0x147063['cyan'](_0x568306(0x1ca))),0x1;_0x55c01f['verbose']&&(console['error'](_0x568306(0x185)+_0x55c01f['site']),console[_0x568306(0x16d)](_0x568306(0x192)+_0x4cdf96));const _0x170209=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4cdf96+_0x568306(0x200),()=>_0x1b88bb[_0x568306(0x144)][_0x568306(0x20c)](_0x4cdf96),{'verbose':_0x55c01f[_0x568306(0x13b)]}),_0x45d67c=_0x170209[_0x568306(0x1a2)],_0x552b6e=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4cdf96+'\x27...',()=>_0x1b88bb['segment'][_0x568306(0x1ef)](_0x45d67c),{'verbose':_0x55c01f['verbose']}),_0x2e1e46=_0x552b6e['data'];return _0x55c01f['format']===_0x568306(0x1fe)||_0x55c01f['format']==='jsonl'?await handleSDKOutput([{'sql':_0x2e1e46}],_0x55c01f):console[_0x568306(0x1e7)](_0x2e1e46),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x22f2c4(0x119)]=a26_0x22f2c4(0x1b6);[a26_0x22f2c4(0x1ae)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a26_0x22f2c4(0x182)](_0x25e67d){const _0x55028d=a26_0x22f2c4,{options:_0x44b47b,args:_0x5ce524,tdx:_0x1ca686}=_0x25e67d,_0x3f70c4=_0x5ce524[0x0]||_0x44b47b[_0x55028d(0x201)];if(!_0x3f70c4)return console['error'](a26_0x147063[_0x55028d(0x1f6)](_0x55028d(0x1eb))),console[_0x55028d(0x16d)](_0x55028d(0x18c)),console[_0x55028d(0x16d)](a26_0x147063[_0x55028d(0x1b7)](_0x55028d(0x1ca))),0x1;_0x44b47b[_0x55028d(0x13b)]&&(console[_0x55028d(0x16d)](_0x55028d(0x185)+_0x44b47b['site']),console[_0x55028d(0x16d)](_0x55028d(0x192)+_0x3f70c4));const _0x814b7=await withSpinner(_0x55028d(0x1bb)+_0x3f70c4+_0x55028d(0x200),()=>_0x1ca686['segment'][_0x55028d(0x20c)](_0x3f70c4),{'verbose':_0x44b47b[_0x55028d(0x13b)]}),_0x20fa36=_0x814b7[_0x55028d(0x1a2)],_0x122640=await withSpinner(_0x55028d(0x1e1)+_0x3f70c4+_0x55028d(0x200),()=>_0x1ca686[_0x55028d(0x144)][_0x55028d(0x1ef)](_0x20fa36),{'verbose':_0x44b47b[_0x55028d(0x13b)]});let _0x1c17a9=_0x122640[_0x55028d(0x1a2)];const _0x202a02=resolveLimit(_0x44b47b[_0x55028d(0x1d0)],DEFAULT_DISPLAY_LIMIT),_0x1a5f7c=/\bLIMIT\s+\d+/i[_0x55028d(0x146)](_0x1c17a9);!_0x1a5f7c&&(_0x1c17a9=_0x1c17a9['trim']()['replace'](/;+$/,''),_0x1c17a9=_0x55028d(0x118)+_0x1c17a9+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x202a02);_0x44b47b[_0x55028d(0x13b)]&&console[_0x55028d(0x16d)](_0x55028d(0x148)+_0x1c17a9);const _0x3867f1=await withQuerySpinner(_0x55028d(0x1c8),async _0x1e68fc=>{const _0x43001a=_0x55028d,_0x25f9e6=await _0x1ca686[_0x43001a(0x16c)][_0x43001a(0x182)](_0x1c17a9,{'catalog':'td','schema':_0x43001a(0x1d7),'onJobId':_0x249ad8=>{const _0x16ed97=_0x43001a;_0x1e68fc[_0x16ed97(0x15a)](_0x249ad8);}});return _0x25f9e6;},{'verbose':_0x44b47b[_0x55028d(0x13b)]}),_0x56f861=_0x3867f1[_0x55028d(0x1a2)],_0x194158=_0x56f861['jobId']?_0x55028d(0x1a9)+_0x56f861[_0x55028d(0x1c6)]+']':'';return console[_0x55028d(0x16d)](_0x55028d(0x196)+_0x56f861[_0x55028d(0x107)][_0x55028d(0x152)][_0x55028d(0x1cf)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x56f861[_0x55028d(0x107)][_0x55028d(0x16f)])+_0x194158)),await handleQueryOutput(_0x56f861,_0x44b47b),0x0;}}
|
|
1
|
+
const a26_0x3760a6=a26_0x2dd7;(function(_0xa12450,_0x3b83ee){const _0x41eec0=a26_0x2dd7,_0x3f3f14=_0xa12450();while(!![]){try{const _0xbf59f7=-parseInt(_0x41eec0(0x1c5))/0x1+-parseInt(_0x41eec0(0x1a9))/0x2+-parseInt(_0x41eec0(0x1d5))/0x3*(parseInt(_0x41eec0(0x198))/0x4)+parseInt(_0x41eec0(0x17e))/0x5*(parseInt(_0x41eec0(0x169))/0x6)+-parseInt(_0x41eec0(0x243))/0x7+-parseInt(_0x41eec0(0x1ce))/0x8*(-parseInt(_0x41eec0(0x206))/0x9)+parseInt(_0x41eec0(0x1fe))/0xa;if(_0xbf59f7===_0x3b83ee)break;else _0x3f3f14['push'](_0x3f3f14['shift']());}catch(_0x556e13){_0x3f3f14['push'](_0x3f3f14['shift']());}}}(a26_0x177b,0x2f12d));import{writeFileSync,readFileSync,existsSync,mkdirSync}from'fs';import{spawn}from'child_process';import a26_0x5a0120 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a26_0x177b(){const _0x35d5fd=['Overwrite\x20\x27','column','length','Master\x20Table','addBehaviors','pullParentYaml','name','\x20parent\x20segment','match','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Listing\x20parent\x20segments...','%)\x20','yellow','\x0a✔\x20Workflow\x20started','yes','tdx\x20segment\x20parent\x20preview\x20','To\x20cancel:','behavior','\x20parent\x20segment\x20\x27','information_schema','Apply\x20changes\x20to\x20\x27','darwin','matchedCount','Audience\x20ID:','verbose','Session:','/app/workflows/','toFixed','\x27\x20and\x20run\x20workflow?','7089610RQgpvz','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Available\x20behaviors:','json','Errors:','keys','Usage:\x20tdx\x20ps\x20sql\x20[name]\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','8163bIOjQu','site','Master\x20+\x20Attributes','text','Created','displayAttributesStats','Error\x20parsing\x20YAML:\x20','Usage:\x20tdx\x20ps\x20pull\x20[name]\x20[-o\x20output.yml]\x20[-y]\x0a','scheduleOption','customersWithEvents','Updating\x20parent\x20segment\x20\x27','trim','Validating\x20configuration...','output','Behavior:','schemaError','pushParentYaml','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)','\x0aUsage:\x20tdx\x20ps\x20preview\x20','No\x20parent\x20segments\x20found','platform','Join\x20on:','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','.yml','\x20rows\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','customerGroup','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','addAttributes','segment:parent:list','format','test','stop','Usage:\x20tdx\x20ps\x20view\x20[name]\x20[-w]\x0a','varchar','Create\x20parent\x20segment\x20\x27','Parent\x20segment:\x20','YAML\x20file:\x20','displaySummary','label','No\x20parent\x20segments\x20match\x20pattern:\x20','cyan','Attribute:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displayValidateResults','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Usage:\x20tdx\x20parent-segment\x20run\x20<name>\x20[-y]\x0a','attributes','all','dirname','filter','getParentSQL','Creating','customerPercent','Master:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','sort','localeCompare','\x20tdx\x20wf\x20attempt\x20','SELECT\x20*\x20FROM\x20(\x0a','324695jIUmmn','ignore','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Analyzing\x20changes...','web','data','displayMasterInfo','\x20\x20\x20\x20-\x20','\x20Opening\x20','resolveParentId','workflowId','Fetching\x20SQL\x20for\x20\x27','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','red','\x20--behavior\x20\x22<name>\x22','.yaml','segment:parent:create','Aborted.','schemaValid','Status:','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','map','Attributes','population','displayPreviewResults','open','Source:','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','Behaviors','getParentFull','stats','Preview:','Executing\x20parent\x20segment\x20query...','preview','joinKey','\x20No\x20changes\x20-\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','endsWith','enriched','Events:','addBehaviorsFile','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','utf-8','segment:parent:fields','Listing\x20parent\x20segments\x20matching\x20\x27','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Listing\x20fields\x20for\x20\x27','segment:parent:desc','status','replace','processedRows','Error\x20reading\x20file:\x20','\x5c$&','Columns:','segment:parent:run','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','List\x20available\x20fields\x20for\x20segmentation','timezone','displayColumns','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Validate:','Error:\x20File\x20not\x20found:\x20','Usage:\x20tdx\x20ps\x20fields\x20[name]\x0a','coveragePercent','36ArQLTI','\x20--attribute\x20\x22','error','\x20--interval\x20','Usage:\x20tdx\x20ps\x20show\x20[name]\x0a','toLocaleString','behaviorsFile','win32','validateParentYaml','\x20[Job\x20ID:\x20','execute','jobId','✔\x20Updated\x20parent\x20segment\x20\x27','👥\x20','start','Error:','jsonl','apply','parent_segment','use','string','168860ACylni','bold','/app/dw/parentSegments/','Usage:\x20tdx\x20ps\x20push\x20[name]\x20[-y]\x0a','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','unref','Attempt:','behaviors','\x0aNew\x20parent\x20segment\x20\x27','\x27\x20with\x20ID:\x20','attributesFile','green','interval','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','attribute','foreignKey','repeat','displaySampleData','query','join','workflowSessionId','Options\x20(one\x20required):','double','log','sampleData','\x27\x20is\x20already\x20up\x20to\x20date','671756CisKyh','in\x20','✔\x20No\x20changes\x20-\x20\x27','columns','segment:parent:push','\x0aChanges\x20to\x20apply\x20to\x20\x27','Fetching\x20sample\x20data...','scheduleType','database','totalEvents','List\x20parent\x20segments','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','✔\x20Created\x20parent\x20segment\x20\x27','Site:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x27...','699480VGkJsI','\x0aChanges\x20to\x20\x27','displayPreviewHints','Resolving\x20parent\x20segment\x20\x27','parentSegment','workflowAttemptId','Creating\x20parent\x20segment\x20\x27','elapsedTimeMillis','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Options:','Database:\x20','allValid','-1d','Name:\x20','displayBehaviorsStats','Show\x20parent\x20segment\x20schema\x20(column\x20types)','description','Enriched:','customerGroupFile','To\x20view\x20sample\x20data:','segment','\x20\x20No\x20sample\x20data\x20available','segment:parent:pull','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Updated','Found\x20YAML\x20file:\x20','segment:parent:update','listFields','286994kIcQuP','message','Updating','table','`\x20to\x20download\x20the\x20configuration\x20first','\x20--behavior\x20\x22','dim','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','2648zdhsUR','master','rowCount','addAttributesFile','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Join:','/attempt/','6rQvatF','✔\x20Found\x20','errors','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20is\x20already\x20up\x20to\x20date','\x20--enriched','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Customers:','previewParentYaml','setJobId','listParents','Pattern:\x20'];a26_0x177b=function(){return _0x35d5fd;};return a26_0x177b();}import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a26_0x1a6673 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';const PARENT_SEGMENT_DIR=a26_0x3760a6(0x17b);function openBrowser(_0x188cee){const _0x2f36c0=a26_0x3760a6,_0x17da86=process[_0x2f36c0(0x21a)],_0x25474b=_0x17da86===_0x2f36c0(0x1f6)?_0x2f36c0(0x25d):_0x17da86===_0x2f36c0(0x170)?'start':'xdg-open';spawn(_0x25474b,[_0x188cee],{'detached':!![],'stdio':_0x2f36c0(0x244)})[_0x2f36c0(0x183)]();}function resolveYamlFile(_0x407ab1){const _0x4383b4=a26_0x3760a6;if(_0x407ab1[_0x4383b4(0x26b)](_0x4383b4(0x21d))||_0x407ab1['endsWith'](_0x4383b4(0x253)))return _0x407ab1;return a26_0x5a0120[_0x4383b4(0x191)](PARENT_SEGMENT_DIR,_0x407ab1+_0x4383b4(0x21d));}function formatProgressMessage(_0x186ce0){const _0x33c6d1=a26_0x3760a6,_0x1bdcca=_0x186ce0[_0x33c6d1(0x1e9)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1bdcca){const [,_0x1549a0,_0xf252ed,_0x24a988='']=_0x1bdcca;return a26_0x1a6673[_0x33c6d1(0x1cb)](_0x1549a0+':')+'\x20'+_0xf252ed+a26_0x1a6673[_0x33c6d1(0x1cb)](_0x24a988);}return a26_0x1a6673['dim'](_0x186ce0);}function showFileNotFoundError(_0xa9c618,_0x364002){const _0x246e6d=a26_0x3760a6;console[_0x246e6d(0x16b)](a26_0x1a6673[_0x246e6d(0x251)](_0x246e6d(0x166)+_0xa9c618+'\x0a')),console[_0x246e6d(0x16b)](a26_0x1a6673['cyan']('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x364002+_0x246e6d(0x1c9)));}export class ParentSegmentListCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]=a26_0x3760a6(0x223);['description']=a26_0x3760a6(0x1a2);async[a26_0x3760a6(0x173)](_0x2ec4a5){const _0x5a118f=a26_0x3760a6,{options:_0x49f8a9,args:_0x1af72f,tdx:_0x9359d1}=_0x2ec4a5,_0x3b7190=_0x1af72f[0x0];_0x49f8a9[_0x5a118f(0x1f9)]&&(console[_0x5a118f(0x16b)]('Site:\x20'+_0x49f8a9[_0x5a118f(0x207)]),_0x3b7190&&console[_0x5a118f(0x16b)](_0x5a118f(0x1e0)+_0x3b7190));const _0x1abb8a=await withSpinner(_0x3b7190?_0x5a118f(0x272)+_0x3b7190+'\x27...':_0x5a118f(0x1eb),()=>_0x9359d1[_0x5a118f(0x1bd)][_0x5a118f(0x1df)](),{'verbose':_0x49f8a9['verbose']});let _0x301a4d=_0x1abb8a[_0x5a118f(0x248)];if(_0x3b7190){const _0x5a5275=_0x3b7190['replace'](/[.+^${}()|[\]\\]/g,_0x5a118f(0x27a))[_0x5a118f(0x277)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x319778=new RegExp('^'+_0x5a5275+'$','i');_0x301a4d=_0x301a4d[_0x5a118f(0x239)](_0x341d67=>_0x319778['test'](_0x341d67[_0x5a118f(0x236)]['name']));}_0x301a4d[_0x5a118f(0x23f)]((_0x3a1707,_0x2c401e)=>_0x3a1707[_0x5a118f(0x236)][_0x5a118f(0x1e7)][_0x5a118f(0x240)](_0x2c401e[_0x5a118f(0x236)][_0x5a118f(0x1e7)])),console[_0x5a118f(0x16b)](_0x5a118f(0x1d6)+_0x301a4d[_0x5a118f(0x1e3)]+_0x5a118f(0x1e8)+(_0x301a4d[_0x5a118f(0x1e3)]!==0x1?'s':''));if(_0x49f8a9[_0x5a118f(0x224)]===_0x5a118f(0x201)||_0x49f8a9[_0x5a118f(0x224)]===_0x5a118f(0x179))await handleSDKOutput(_0x301a4d,_0x49f8a9);else{if(_0x301a4d[_0x5a118f(0x1e3)]===0x0)_0x3b7190?console[_0x5a118f(0x195)](_0x5a118f(0x22e)+_0x3b7190):console[_0x5a118f(0x195)](_0x5a118f(0x219));else for(const _0x159c39 of _0x301a4d){const _0x37bf09=_0x159c39[_0x5a118f(0x236)][_0x5a118f(0x25b)]?a26_0x1a6673[_0x5a118f(0x1cb)]('\x20('+formatRows(_0x159c39['attributes'][_0x5a118f(0x25b)])+')'):'';console[_0x5a118f(0x195)](_0x5a118f(0x176)+_0x159c39[_0x5a118f(0x236)][_0x5a118f(0x1e7)]+_0x37bf09);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]=a26_0x3760a6(0x254);[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x1db);async[a26_0x3760a6(0x173)](_0xbfb628){const _0x1b6265=a26_0x3760a6,{options:_0x877d1e,args:_0x5139c1,tdx:_0x2c6b09}=_0xbfb628;console[_0x1b6265(0x16b)](_0x1b6265(0x21f)+_0x1b6265(0x258)+_0x1b6265(0x1ff));const _0x513e98=_0x877d1e;if(_0x5139c1[_0x1b6265(0x1e3)]===0x0)return console['error'](_0x1b6265(0x26a)),console[_0x1b6265(0x16b)](_0x1b6265(0x1d2)),0x1;const _0x3c1536=_0x5139c1[0x0];if(!_0x513e98['database']||!_0x513e98[_0x1b6265(0x1c8)])return console[_0x1b6265(0x16b)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0x1b6265(0x1d2)),0x1;_0x513e98[_0x1b6265(0x1f9)]&&(console[_0x1b6265(0x16b)](_0x1b6265(0x1a5)+_0x513e98[_0x1b6265(0x207)]),console[_0x1b6265(0x16b)](_0x1b6265(0x1b6)+_0x3c1536),console['error'](_0x1b6265(0x1b3)+_0x513e98[_0x1b6265(0x1a0)]),console['error']('Table:\x20'+_0x513e98[_0x1b6265(0x1c8)]));const _0x93a912=await loadJSONFromOptions(_0x513e98['attributes'],_0x513e98[_0x1b6265(0x188)]),_0x49185a=await loadJSONFromOptions(_0x513e98[_0x1b6265(0x185)],_0x513e98[_0x1b6265(0x16f)]),_0x1cd1b3=await loadJSONFromOptions(_0x513e98[_0x1b6265(0x220)],_0x513e98[_0x1b6265(0x1bb)]),_0x1859cb={'name':_0x3c1536,'description':_0x513e98[_0x1b6265(0x1b9)],'scheduleType':_0x513e98['scheduleType'],'scheduleOption':_0x513e98['scheduleOption'],'timezone':_0x513e98['timezone'],'master':{'parentDatabaseName':_0x513e98[_0x1b6265(0x1a0)],'parentTableName':_0x513e98[_0x1b6265(0x1c8)]},'attributes':_0x93a912,'behaviors':_0x49185a,'customerGroup':_0x1cd1b3},_0x4b2576=await withSpinner(_0x1b6265(0x1af)+_0x3c1536+'\x27...',()=>_0x2c6b09[_0x1b6265(0x1bd)]['createParent'](_0x1859cb),{'verbose':_0x877d1e['verbose']}),_0x13eb35=_0x4b2576[_0x1b6265(0x248)];return console[_0x1b6265(0x16b)](_0x1b6265(0x1a4)+_0x13eb35[_0x1b6265(0x1e7)]+_0x1b6265(0x187)+_0x13eb35['id']),await handleSDKOutput([_0x13eb35],_0x877d1e),0x0;}}function a26_0x2dd7(_0x4f9be4,_0x45eaef){const _0x177bf0=a26_0x177b();return a26_0x2dd7=function(_0x2dd757,_0xdf82d8){_0x2dd757=_0x2dd757-0x15e;let _0x17d785=_0x177bf0[_0x2dd757];return _0x17d785;},a26_0x2dd7(_0x4f9be4,_0x45eaef);}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a26_0x3760a6(0x1c3);['description']=a26_0x3760a6(0x245);async[a26_0x3760a6(0x173)](_0x3e5a60){const _0x2eb30b=a26_0x3760a6,{options:_0x145cf8,args:_0x21d1af,tdx:_0x49d05f}=_0x3e5a60;console['error'](_0x2eb30b(0x1cd)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2eb30b(0x1ff));const _0x4d4e47=_0x145cf8;if(_0x21d1af[_0x2eb30b(0x1e3)]===0x0)return console[_0x2eb30b(0x16b)](_0x2eb30b(0x26a)),console['error']('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x572f18=_0x21d1af[0x0];_0x4d4e47[_0x2eb30b(0x1f9)]&&(console['error'](_0x2eb30b(0x1a5)+_0x4d4e47[_0x2eb30b(0x207)]),console['error'](_0x2eb30b(0x22a)+_0x572f18));const _0x87bf4f=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x572f18+_0x2eb30b(0x1a8),()=>_0x49d05f[_0x2eb30b(0x1bd)][_0x2eb30b(0x262)](_0x572f18),{'verbose':_0x4d4e47[_0x2eb30b(0x1f9)]}),_0x505995=_0x87bf4f['data'],_0x504a8f=await loadJSONFromOptions(_0x4d4e47[_0x2eb30b(0x222)],_0x4d4e47[_0x2eb30b(0x1d1)]),_0x36924c=await loadJSONFromOptions(_0x4d4e47[_0x2eb30b(0x1e5)],_0x4d4e47[_0x2eb30b(0x26e)]),_0x42bc5d={'name':_0x505995[_0x2eb30b(0x1e7)],'description':_0x4d4e47[_0x2eb30b(0x1b9)]!==undefined?_0x4d4e47[_0x2eb30b(0x1b9)]:_0x505995[_0x2eb30b(0x1b9)],'scheduleType':_0x4d4e47[_0x2eb30b(0x19f)]!==undefined?_0x4d4e47[_0x2eb30b(0x19f)]:_0x505995[_0x2eb30b(0x19f)],'scheduleOption':_0x4d4e47[_0x2eb30b(0x20e)]!==undefined?_0x4d4e47[_0x2eb30b(0x20e)]:_0x505995[_0x2eb30b(0x20e)],'timezone':_0x4d4e47[_0x2eb30b(0x162)]!==undefined?_0x4d4e47[_0x2eb30b(0x162)]:_0x505995[_0x2eb30b(0x162)],'master':_0x505995['master'],'attributes':_0x504a8f?[..._0x505995['attributes']||[],..._0x504a8f]:_0x505995['attributes'],'behaviors':_0x36924c?[..._0x505995[_0x2eb30b(0x185)]||[],..._0x36924c]:_0x505995[_0x2eb30b(0x185)],'customerGroup':_0x505995[_0x2eb30b(0x220)]},_0xcd8097=await withSpinner(_0x2eb30b(0x210)+_0x572f18+_0x2eb30b(0x1a8),()=>_0x49d05f[_0x2eb30b(0x1bd)]['updateParent'](_0x572f18,_0x42bc5d),{'verbose':_0x4d4e47[_0x2eb30b(0x1f9)]}),_0x21696a=_0xcd8097['data'];return console[_0x2eb30b(0x16b)](_0x2eb30b(0x175)+_0x21696a[_0x2eb30b(0x1e7)]+'\x27'),await handleSDKOutput([_0x21696a],_0x4d4e47),0x0;}}export class ParentSegmentPullCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]=a26_0x3760a6(0x1bf);[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x1a7);async[a26_0x3760a6(0x173)](_0x4248ee){const _0x5719ab=a26_0x3760a6,{options:_0x4c2bb2,args:_0x3ccc87,tdx:_0x21a537}=_0x4248ee,_0x58eed3=_0x4c2bb2,_0x234ca2=_0x3ccc87[0x0]||_0x4c2bb2[_0x5719ab(0x1ad)];if(!_0x234ca2)return console[_0x5719ab(0x16b)](a26_0x1a6673[_0x5719ab(0x251)](_0x5719ab(0x1a6))),console[_0x5719ab(0x16b)](_0x5719ab(0x20d)),console[_0x5719ab(0x16b)](a26_0x1a6673['cyan'](_0x5719ab(0x21c))),0x1;if(_0x58eed3[_0x5719ab(0x17c)]&&_0x58eed3['output'])return console['error'](a26_0x1a6673[_0x5719ab(0x251)](_0x5719ab(0x205))),console['error'](a26_0x1a6673[_0x5719ab(0x1cb)](_0x5719ab(0x1ea))),console['error'](a26_0x1a6673[_0x5719ab(0x1cb)]('using\x20the\x20default\x20path:\x20parent_segment/{name}.yml\x0a')),console['error'](a26_0x1a6673[_0x5719ab(0x22f)](_0x5719ab(0x232))),0x1;const _0x1779b4=_0x58eed3[_0x5719ab(0x213)]||a26_0x5a0120['join'](PARENT_SEGMENT_DIR,_0x234ca2+'.yml');_0x58eed3[_0x5719ab(0x1f9)]&&(console['error'](_0x5719ab(0x1a5)+_0x58eed3[_0x5719ab(0x207)]),console[_0x5719ab(0x16b)](_0x5719ab(0x22a)+_0x234ca2),console[_0x5719ab(0x16b)]('Output\x20file:\x20'+_0x1779b4));const _0x11794d=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x234ca2+_0x5719ab(0x1a8),()=>_0x21a537['segment'][_0x5719ab(0x1e6)](_0x234ca2),{'verbose':_0x58eed3[_0x5719ab(0x1f9)]}),_0x3fd806=_0x11794d[_0x5719ab(0x248)];if(existsSync(_0x1779b4)){const _0xb3e74c=readFileSync(_0x1779b4,_0x5719ab(0x270)),_0x4a7e3f=generateDiff(_0xb3e74c,_0x3fd806);if(!hasChanges(_0x4a7e3f))console[_0x5719ab(0x16b)](a26_0x1a6673[_0x5719ab(0x189)]('✔')+_0x5719ab(0x268)+a26_0x1a6673[_0x5719ab(0x22f)](_0x1779b4)+_0x5719ab(0x1d9));else{console[_0x5719ab(0x16b)](_0x5719ab(0x1aa)+_0x1779b4+'\x27:'),console[_0x5719ab(0x16b)]('─'[_0x5719ab(0x18e)](0x3c)),console[_0x5719ab(0x16b)](formatDiffWithColors(_0x4a7e3f)),console[_0x5719ab(0x16b)]('─'['repeat'](0x3c));if(!_0x58eed3[_0x5719ab(0x1ef)]){const _0x55afc7=await confirmKey(_0x5719ab(0x1e1)+_0x1779b4+'\x27?');if(!_0x55afc7)return console[_0x5719ab(0x16b)](_0x5719ab(0x255)),0x1;}writeFileSync(_0x1779b4,_0x3fd806,_0x5719ab(0x270)),console[_0x5719ab(0x16b)](a26_0x1a6673[_0x5719ab(0x189)]('✔')+_0x5719ab(0x269)+a26_0x1a6673[_0x5719ab(0x22f)](_0x1779b4));}}else{const _0x302a82=a26_0x5a0120[_0x5719ab(0x238)](_0x1779b4);!existsSync(_0x302a82)&&mkdirSync(_0x302a82,{'recursive':!![]}),writeFileSync(_0x1779b4,_0x3fd806,_0x5719ab(0x270)),console[_0x5719ab(0x16b)](a26_0x1a6673[_0x5719ab(0x189)]('✔')+_0x5719ab(0x269)+a26_0x1a6673[_0x5719ab(0x22f)](_0x1779b4));}return _0x58eed3[_0x5719ab(0x17c)]&&(saveSessionContext({'parent_segment':_0x234ca2},_0x58eed3['session']),console[_0x5719ab(0x16b)](a26_0x1a6673[_0x5719ab(0x189)]('✔')+'\x20Context\x20set:\x20'+a26_0x1a6673['dim']('parent_segment')+'\x20=\x20'+a26_0x1a6673[_0x5719ab(0x22f)](_0x234ca2))),0x0;}}export class ParentSegmentPushCommand extends BaseCommand{['name']=a26_0x3760a6(0x19c);[a26_0x3760a6(0x1b9)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x3760a6(0x173)](_0x45b75f){const _0x175f2a=a26_0x3760a6,{options:_0x27b2a7,args:_0x3c6f76,tdx:_0x50df64}=_0x45b75f,_0x9c55eb=_0x27b2a7,_0x508482=_0x3c6f76[0x0]||_0x27b2a7[_0x175f2a(0x1ad)];if(!_0x508482)return console['error'](a26_0x1a6673['red'](_0x175f2a(0x1a6))),console[_0x175f2a(0x16b)](_0x175f2a(0x181)),console[_0x175f2a(0x16b)](a26_0x1a6673[_0x175f2a(0x22f)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20use\x20`tdx\x20ps\x20pull`\x20to\x20get\x20a\x20YAML\x20file\x20first')),0x1;const _0x40f28a=resolveYamlFile(_0x508482);if(!existsSync(_0x40f28a))return showFileNotFoundError(_0x40f28a,_0x508482),0x1;_0x9c55eb[_0x175f2a(0x1f9)]&&(console[_0x175f2a(0x16b)](_0x175f2a(0x1a5)+_0x9c55eb['site']),console[_0x175f2a(0x16b)]('YAML\x20file:\x20'+_0x40f28a));let _0xafaa01;try{_0xafaa01=readFileSync(_0x40f28a,_0x175f2a(0x270));}catch(_0xf23e36){const _0x845014=_0xf23e36 instanceof Error?_0xf23e36[_0x175f2a(0x1c6)]:String(_0xf23e36);return console[_0x175f2a(0x16b)](_0x175f2a(0x279)+_0x845014),0x1;}const _0x48e185=await withSpinner('Analyzing\x20changes...',()=>_0x50df64[_0x175f2a(0x1bd)][_0x175f2a(0x216)](_0xafaa01),{'verbose':_0x9c55eb[_0x175f2a(0x1f9)]}),_0x15ab9a=_0x48e185[_0x175f2a(0x248)],{isNew:_0x3a8979,name:_0xed48ce,hasChanges:_0x247265,diffFormatted:_0x36b770}=_0x15ab9a;if(!_0x247265)return console[_0x175f2a(0x16b)](_0x175f2a(0x19a)+_0xed48ce+_0x175f2a(0x197)),0x0;_0x3a8979?console[_0x175f2a(0x16b)](_0x175f2a(0x186)+_0xed48ce+'\x27:'):console['error'](_0x175f2a(0x19d)+_0xed48ce+'\x27:');console[_0x175f2a(0x16b)]('─'['repeat'](0x3c)),console[_0x175f2a(0x16b)](_0x36b770),console[_0x175f2a(0x16b)]('─'[_0x175f2a(0x18e)](0x3c));const _0x87009b=_0x3a8979?_0x175f2a(0x229)+_0xed48ce+'\x27?':_0x175f2a(0x1f5)+_0xed48ce+'\x27?';if(!_0x9c55eb[_0x175f2a(0x1ef)]){const _0x5901e3=await confirmKey(_0x87009b);if(!_0x5901e3)return console[_0x175f2a(0x16b)](_0x175f2a(0x255)),0x1;}const _0x1dc1b3=_0x3a8979?_0x175f2a(0x23b):'Updating',_0x397e53=await withSpinner(_0x1dc1b3+'\x20parent\x20segment\x20\x27'+_0xed48ce+'\x27...',()=>_0x15ab9a[_0x175f2a(0x17a)](),{'verbose':_0x9c55eb[_0x175f2a(0x1f9)]}),_0x7e7967=_0x397e53[_0x175f2a(0x248)],_0x1d802c=getConsoleNextUrl(_0x9c55eb[_0x175f2a(0x207)],_0x175f2a(0x180)+_0x7e7967['id']),_0x2377d7=_0x3a8979?_0x175f2a(0x20a):_0x175f2a(0x1c1);return console[_0x175f2a(0x16b)]('✔\x20'+_0x2377d7+_0x175f2a(0x1f3)+_0x7e7967[_0x175f2a(0x1e7)]+'\x27'),console['error']('\x20\x20'+_0x1d802c),0x0;}}export class ParentSegmentValidateCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]='segment:parent:validate';[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x25f);async[a26_0x3760a6(0x173)](_0x44fa52){const _0x4776bc=a26_0x3760a6,{options:_0x596361,args:_0x4665d6,tdx:_0x42c33a}=_0x44fa52,_0x28544e=_0x596361,_0x1c4cc1=_0x4665d6[0x0]||_0x596361[_0x4776bc(0x1ad)];if(!_0x1c4cc1)return console[_0x4776bc(0x16b)](a26_0x1a6673[_0x4776bc(0x251)](_0x4776bc(0x1a6))),console[_0x4776bc(0x16b)]('Usage:\x20tdx\x20parent-segment\x20validate\x20<name>\x20[options]\x0a'),console[_0x4776bc(0x16b)](_0x4776bc(0x1b2)),console[_0x4776bc(0x16b)](_0x4776bc(0x217)),console[_0x4776bc(0x16b)]('\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)'),console[_0x4776bc(0x16b)](_0x4776bc(0x18b)),console[_0x4776bc(0x16b)](a26_0x1a6673[_0x4776bc(0x22f)](_0x4776bc(0x260))),0x1;const _0x1704e7=resolveYamlFile(_0x1c4cc1);if(!existsSync(_0x1704e7))return showFileNotFoundError(_0x1704e7,_0x1c4cc1),0x1;_0x28544e['verbose']&&(console['error']('Site:\x20'+_0x28544e[_0x4776bc(0x207)]),console[_0x4776bc(0x16b)](_0x4776bc(0x22b)+_0x1704e7));let _0x20b27b;try{_0x20b27b=readFileSync(_0x1704e7,_0x4776bc(0x270));}catch(_0x993cc3){const _0x2cd5af=_0x993cc3 instanceof Error?_0x993cc3[_0x4776bc(0x1c6)]:String(_0x993cc3);return console[_0x4776bc(0x16b)]('Error\x20reading\x20file:\x20'+_0x2cd5af),0x1;}const _0x48fcc6=createCommandSpinner(a26_0x1a6673['dim'](_0x4776bc(0x212)),{'verbose':_0x28544e[_0x4776bc(0x1f9)]});_0x48fcc6[_0x4776bc(0x177)]();const _0x2ae7c1={'onProgress':_0x2af4cb=>{const _0x449781=_0x4776bc;_0x48fcc6[_0x449781(0x209)]=formatProgressMessage(_0x2af4cb);}};if(_0x28544e['master'])_0x2ae7c1[_0x4776bc(0x1cf)]=!![];if(_0x28544e['enriched'])_0x2ae7c1['enriched']=!![];_0x28544e['attribute']&&(_0x2ae7c1[_0x4776bc(0x18c)]=_0x28544e[_0x4776bc(0x18c)]);_0x28544e[_0x4776bc(0x1f2)]&&(_0x2ae7c1[_0x4776bc(0x1f2)]=_0x28544e[_0x4776bc(0x1f2)]);if(_0x28544e['interval'])_0x2ae7c1[_0x4776bc(0x18a)]=_0x28544e[_0x4776bc(0x18a)];let _0x34c678;try{_0x34c678=await _0x42c33a['segment'][_0x4776bc(0x171)](_0x20b27b,_0x2ae7c1),_0x48fcc6[_0x4776bc(0x226)]();}catch(_0x496202){_0x48fcc6['stop']();throw _0x496202;}const _0x523ef8=_0x28544e[_0x4776bc(0x18a)]||_0x4776bc(0x1b5);return this[_0x4776bc(0x233)](_0x34c678,_0x2ae7c1,_0x1704e7,_0x523ef8),_0x34c678['allValid']?0x0:0x1;}[a26_0x3760a6(0x233)](_0x5b7428,_0x20b62a,_0x396fd6,_0x260afc){const _0x3777fa=a26_0x3760a6;console[_0x3777fa(0x16b)]('\x0a'+a26_0x1a6673[_0x3777fa(0x17f)](_0x3777fa(0x165))+'\x20'+_0x5b7428[_0x3777fa(0x1e7)]),console['error']('═'[_0x3777fa(0x18e)](0x3c)),this[_0x3777fa(0x249)](_0x5b7428);if(typeof _0x20b62a[_0x3777fa(0x18c)]===_0x3777fa(0x17d)){this[_0x3777fa(0x20b)](_0x5b7428),this[_0x3777fa(0x22c)](_0x5b7428),this[_0x3777fa(0x1ab)](_0x396fd6,_0x260afc,_0x3777fa(0x18c),_0x20b62a[_0x3777fa(0x18c)]);return;}if(_0x20b62a['attribute']===!![]){this[_0x3777fa(0x20b)](_0x5b7428),this[_0x3777fa(0x22c)](_0x5b7428),this['displayPreviewHints'](_0x396fd6,_0x260afc,_0x3777fa(0x236));return;}if(typeof _0x20b62a[_0x3777fa(0x1f2)]==='string'){this[_0x3777fa(0x1b7)](_0x5b7428,_0x260afc),this[_0x3777fa(0x22c)](_0x5b7428),this[_0x3777fa(0x1ab)](_0x396fd6,_0x260afc,_0x3777fa(0x1f2),_0x20b62a['behavior']);return;}if(_0x20b62a[_0x3777fa(0x1f2)]===!![]){this[_0x3777fa(0x1b7)](_0x5b7428,_0x260afc),this[_0x3777fa(0x22c)](_0x5b7428),this[_0x3777fa(0x1ab)](_0x396fd6,_0x260afc,_0x3777fa(0x185));return;}this[_0x3777fa(0x20b)](_0x5b7428),this[_0x3777fa(0x1b7)](_0x5b7428,_0x260afc),this[_0x3777fa(0x22c)](_0x5b7428),this[_0x3777fa(0x1ab)](_0x396fd6,_0x260afc,_0x3777fa(0x237));}[a26_0x3760a6(0x1ab)](_0x2ad835,_0x73424d,_0x1e17ba,_0x145c63){const _0x58bd5b=a26_0x3760a6;console[_0x58bd5b(0x16b)]('\x0a'+a26_0x1a6673[_0x58bd5b(0x1cb)](_0x58bd5b(0x1bc)));const _0x41c355=_0x73424d!==_0x58bd5b(0x1b5)?_0x58bd5b(0x16c)+_0x73424d:'';if(_0x1e17ba==='attribute'&&_0x145c63)console[_0x58bd5b(0x16b)]('\x20\x20'+a26_0x1a6673['dim'](_0x58bd5b(0x1f0)+_0x2ad835+_0x58bd5b(0x16a)+_0x145c63+'\x22'+_0x41c355));else{if(_0x1e17ba===_0x58bd5b(0x1f2)&&_0x145c63)console['error']('\x20\x20'+a26_0x1a6673[_0x58bd5b(0x1cb)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2ad835+_0x58bd5b(0x1ca)+_0x145c63+'\x22'+_0x41c355));else(_0x1e17ba===_0x58bd5b(0x236)||_0x1e17ba===_0x58bd5b(0x237))&&console[_0x58bd5b(0x16b)]('\x20\x20'+a26_0x1a6673[_0x58bd5b(0x1cb)](_0x58bd5b(0x1f0)+_0x2ad835+'\x20--attribute\x20\x22<name>\x22'+_0x41c355));}(_0x1e17ba===_0x58bd5b(0x185)||_0x1e17ba==='all')&&console[_0x58bd5b(0x16b)]('\x20\x20'+a26_0x1a6673['dim'](_0x58bd5b(0x1f0)+_0x2ad835+_0x58bd5b(0x252)+_0x41c355)),_0x1e17ba===_0x58bd5b(0x237)&&console['error']('\x20\x20'+a26_0x1a6673[_0x58bd5b(0x1cb)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2ad835+_0x58bd5b(0x1da)+_0x41c355));}['displayMasterInfo'](_0x44360c){const _0x5de74b=a26_0x3760a6,{master:_0x1f7924}=_0x44360c,_0x294fb5=_0x1f7924[_0x5de74b(0x256)]?a26_0x1a6673[_0x5de74b(0x189)]('✔'):a26_0x1a6673['red']('✘');console[_0x5de74b(0x16b)]('\x0a'+a26_0x1a6673[_0x5de74b(0x1cb)](_0x5de74b(0x1e4))),console[_0x5de74b(0x16b)](_0x294fb5+'\x20'+a26_0x1a6673[_0x5de74b(0x17f)](_0x1f7924[_0x5de74b(0x1a0)]+'.'+_0x1f7924[_0x5de74b(0x1c8)])),_0x1f7924[_0x5de74b(0x256)]?_0x1f7924[_0x5de74b(0x1d0)]!==undefined&&console[_0x5de74b(0x16b)]('\x20\x20'+a26_0x1a6673['dim']('Rows:')+'\x20'+a26_0x1a6673[_0x5de74b(0x22f)](formatRows(_0x1f7924['rowCount']))):console[_0x5de74b(0x16b)]('\x20\x20'+a26_0x1a6673['red'](_0x5de74b(0x178))+'\x20'+_0x1f7924[_0x5de74b(0x215)]);}['displayAttributesStats'](_0xa14317){const _0x420ba9=a26_0x3760a6;if(_0xa14317[_0x420ba9(0x236)]['length']===0x0)return;console[_0x420ba9(0x16b)]('\x0a'+a26_0x1a6673[_0x420ba9(0x1cb)](_0x420ba9(0x25a)));for(const _0x12178d of _0xa14317['attributes']){const _0x2924d2=_0x12178d[_0x420ba9(0x256)]?a26_0x1a6673[_0x420ba9(0x189)]('✔'):a26_0x1a6673[_0x420ba9(0x251)]('✘');let _0x3fb349='';if(_0x12178d[_0x420ba9(0x256)]&&_0x12178d[_0x420ba9(0x1f7)]!==undefined&&_0x12178d[_0x420ba9(0x168)]!==undefined){const _0x589873=_0x12178d['coveragePercent'][_0x420ba9(0x1fc)](0x1),_0x577a0a=_0x12178d[_0x420ba9(0x168)]>=0x50?a26_0x1a6673[_0x420ba9(0x189)]:_0x12178d[_0x420ba9(0x168)]>=0x32?a26_0x1a6673['yellow']:a26_0x1a6673['red'];_0x3fb349='\x20'+a26_0x1a6673[_0x420ba9(0x1cb)]('Coverage:')+'\x20'+_0x577a0a(_0x589873+'%')+'\x20('+formatRows(_0x12178d['matchedCount'])+'\x20rows)';}console['error'](_0x2924d2+'\x20'+a26_0x1a6673[_0x420ba9(0x17f)](_0x12178d[_0x420ba9(0x1e7)])+_0x3fb349),console[_0x420ba9(0x16b)]('\x20\x20'+a26_0x1a6673[_0x420ba9(0x1cb)](_0x420ba9(0x25e))+'\x20'+a26_0x1a6673[_0x420ba9(0x17f)](_0x12178d[_0x420ba9(0x1a0)]+'.'+_0x12178d['table']));const _0x3df6b9=_0x12178d[_0x420ba9(0x267)]===_0x12178d[_0x420ba9(0x18d)]?a26_0x1a6673[_0x420ba9(0x1cb)](_0x420ba9(0x21b))+'\x20'+_0x12178d['joinKey']:a26_0x1a6673[_0x420ba9(0x1cb)](_0x420ba9(0x1d3))+'\x20'+_0x12178d[_0x420ba9(0x267)]+'\x20=\x20'+_0x12178d['foreignKey'];console[_0x420ba9(0x16b)]('\x20\x20'+_0x3df6b9),console[_0x420ba9(0x16b)]('\x20\x20'+a26_0x1a6673['dim'](_0x420ba9(0x15e))),this[_0x420ba9(0x163)](_0x12178d[_0x420ba9(0x19b)]),!_0x12178d[_0x420ba9(0x256)]&&console[_0x420ba9(0x16b)]('\x20\x20'+a26_0x1a6673[_0x420ba9(0x251)](_0x420ba9(0x178))+'\x20'+_0x12178d[_0x420ba9(0x215)]);}}['displayBehaviorsStats'](_0x5bdef5,_0x235b16){const _0x5162a8=a26_0x3760a6;if(_0x5bdef5[_0x5162a8(0x185)]['length']===0x0)return;console[_0x5162a8(0x16b)]('\x0a'+a26_0x1a6673[_0x5162a8(0x1cb)](_0x5162a8(0x261))+'\x20'+a26_0x1a6673[_0x5162a8(0x1cb)]('('+_0x235b16+')'));for(const _0x46f33d of _0x5bdef5[_0x5162a8(0x185)]){const _0x26cdc2=_0x46f33d[_0x5162a8(0x256)]?a26_0x1a6673[_0x5162a8(0x189)]('✔'):a26_0x1a6673[_0x5162a8(0x251)]('✘');let _0x498e22='';if(_0x46f33d[_0x5162a8(0x256)]&&_0x46f33d['customersWithEvents']!==undefined&&_0x46f33d[_0x5162a8(0x1a1)]!==undefined){const _0x59cb08=_0x46f33d[_0x5162a8(0x23c)]?.[_0x5162a8(0x1fc)](0x1)||'?',_0x59d2b7=(_0x46f33d[_0x5162a8(0x23c)]??0x0)>=0x32?a26_0x1a6673[_0x5162a8(0x189)]:(_0x46f33d[_0x5162a8(0x23c)]??0x0)>=0x14?a26_0x1a6673[_0x5162a8(0x1ed)]:a26_0x1a6673['red'];_0x498e22='\x20'+a26_0x1a6673[_0x5162a8(0x1cb)](_0x5162a8(0x1dc))+'\x20'+_0x59d2b7(formatRows(_0x46f33d[_0x5162a8(0x20f)]))+'\x20('+_0x59cb08+_0x5162a8(0x1ec)+a26_0x1a6673[_0x5162a8(0x1cb)](_0x5162a8(0x26d))+'\x20'+a26_0x1a6673[_0x5162a8(0x22f)](formatRows(_0x46f33d[_0x5162a8(0x1a1)]));}console[_0x5162a8(0x16b)](_0x26cdc2+'\x20'+a26_0x1a6673[_0x5162a8(0x17f)](_0x46f33d[_0x5162a8(0x1e7)])+_0x498e22),console['error']('\x20\x20'+a26_0x1a6673[_0x5162a8(0x1cb)]('Source:')+'\x20'+a26_0x1a6673[_0x5162a8(0x17f)](_0x46f33d[_0x5162a8(0x1a0)]+'.'+_0x46f33d[_0x5162a8(0x1c8)]));const _0x399d58=_0x46f33d['joinKey']===_0x46f33d[_0x5162a8(0x18d)]?a26_0x1a6673[_0x5162a8(0x1cb)](_0x5162a8(0x21b))+'\x20'+_0x46f33d[_0x5162a8(0x267)]:a26_0x1a6673['dim'](_0x5162a8(0x1d3))+'\x20'+_0x46f33d[_0x5162a8(0x267)]+'\x20=\x20'+_0x46f33d['foreignKey'];console['error']('\x20\x20'+_0x399d58),console[_0x5162a8(0x16b)]('\x20\x20'+a26_0x1a6673['dim']('Columns:')),this[_0x5162a8(0x163)](_0x46f33d['columns']),!_0x46f33d[_0x5162a8(0x256)]&&console[_0x5162a8(0x16b)]('\x20\x20'+a26_0x1a6673[_0x5162a8(0x251)](_0x5162a8(0x178))+'\x20'+_0x46f33d[_0x5162a8(0x215)]);}}['displayColumns'](_0x3d0cc7){const _0xdb3f9b=a26_0x3760a6;for(const _0x11e439 of _0x3d0cc7){_0x11e439[_0xdb3f9b(0x22d)]===_0x11e439[_0xdb3f9b(0x1e2)]||_0x11e439[_0xdb3f9b(0x1e2)]==='*'?console[_0xdb3f9b(0x16b)](_0xdb3f9b(0x24a)+_0x11e439[_0xdb3f9b(0x22d)]):console[_0xdb3f9b(0x16b)]('\x20\x20\x20\x20-\x20'+_0x11e439[_0xdb3f9b(0x22d)]+'\x20'+a26_0x1a6673[_0xdb3f9b(0x1cb)]('('+_0x11e439[_0xdb3f9b(0x1e2)]+')'));}}['displaySummary'](_0x5c0fc6){const _0x8cabbf=a26_0x3760a6;console[_0x8cabbf(0x16b)]('─'[_0x8cabbf(0x18e)](0x3c));if(_0x5c0fc6[_0x8cabbf(0x1d7)][_0x8cabbf(0x1e3)]>0x0){console[_0x8cabbf(0x16b)]('\x0a'+a26_0x1a6673['red'](_0x8cabbf(0x202)));for(const _0x146d53 of _0x5c0fc6[_0x8cabbf(0x1d7)]){console['error']('\x20\x20'+a26_0x1a6673['red']('•')+'\x20'+_0x146d53);}}_0x5c0fc6[_0x8cabbf(0x1b4)]&&console[_0x8cabbf(0x16b)]('\x0a'+a26_0x1a6673[_0x8cabbf(0x189)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]='segment:parent:preview';[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x1cc);async[a26_0x3760a6(0x173)](_0x34860f){const _0x3ccc6f=a26_0x3760a6,{options:_0x1e6e0a,args:_0x490416,tdx:_0x10a8e2}=_0x34860f,_0x125d38=_0x1e6e0a,_0x47dd2e=_0x490416[0x0]||_0x1e6e0a['parentSegment'];if(!_0x47dd2e)return console[_0x3ccc6f(0x16b)](a26_0x1a6673[_0x3ccc6f(0x251)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console['error'](_0x3ccc6f(0x273)),console['error'](_0x3ccc6f(0x193)),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x250)),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x1d8)),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x23e)),console['error'](_0x3ccc6f(0x1a3)),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x18b)),console[_0x3ccc6f(0x16b)](a26_0x1a6673[_0x3ccc6f(0x22f)]('\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;if(!_0x125d38[_0x3ccc6f(0x1cf)]&&!_0x125d38['attribute']&&!_0x125d38['behavior']&&!_0x125d38[_0x3ccc6f(0x26c)])return console[_0x3ccc6f(0x16b)](a26_0x1a6673[_0x3ccc6f(0x251)](_0x3ccc6f(0x164))),console['error'](_0x3ccc6f(0x273)),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x1b2)),console[_0x3ccc6f(0x16b)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x1d8)),console[_0x3ccc6f(0x16b)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x1a3)),0x1;const _0xe92719=resolveYamlFile(_0x47dd2e);if(!existsSync(_0xe92719))return showFileNotFoundError(_0xe92719,_0x47dd2e),0x1;_0x125d38['verbose']&&(console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x1a5)+_0x125d38[_0x3ccc6f(0x207)]),console['error'](_0x3ccc6f(0x22b)+_0xe92719));let _0x435cbc;try{_0x435cbc=readFileSync(_0xe92719,_0x3ccc6f(0x270));}catch(_0x4edc74){const _0x44d24e=_0x4edc74 instanceof Error?_0x4edc74[_0x3ccc6f(0x1c6)]:String(_0x4edc74);return console['error']('Error\x20reading\x20file:\x20'+_0x44d24e),0x1;}let _0x3f2a88;try{_0x3f2a88=parseYamlString(_0x435cbc);}catch(_0x4c649e){const _0x179abc=_0x4c649e instanceof Error?_0x4c649e[_0x3ccc6f(0x1c6)]:String(_0x4c649e);return console['error'](a26_0x1a6673[_0x3ccc6f(0x251)](_0x3ccc6f(0x20c)+_0x179abc)),0x1;}if(_0x125d38[_0x3ccc6f(0x18c)]===!![]||_0x125d38[_0x3ccc6f(0x18c)]===''){const _0x337b2a=_0x3f2a88['attributes']?.['map'](_0x3488f1=>_0x3488f1[_0x3ccc6f(0x1e7)])||[];if(_0x337b2a[_0x3ccc6f(0x1e3)]===0x0)console[_0x3ccc6f(0x16b)](a26_0x1a6673['red'](_0x3ccc6f(0x221)));else{console['error'](a26_0x1a6673[_0x3ccc6f(0x251)](_0x3ccc6f(0x234))),console[_0x3ccc6f(0x16b)]('Available\x20attributes:');for(const _0xcf90d5 of _0x337b2a){console['error']('\x20\x20'+a26_0x1a6673[_0x3ccc6f(0x22f)](_0xcf90d5));}console[_0x3ccc6f(0x16b)](_0x3ccc6f(0x218)+_0x47dd2e+'\x20--attribute\x20\x22'+_0x337b2a[0x0]+'\x22');}return 0x1;}if(_0x125d38['behavior']===!![]||_0x125d38['behavior']===''){const _0x8ee578=_0x3f2a88[_0x3ccc6f(0x185)]?.[_0x3ccc6f(0x259)](_0x13871f=>_0x13871f[_0x3ccc6f(0x1e7)])||[];if(_0x8ee578[_0x3ccc6f(0x1e3)]===0x0)console[_0x3ccc6f(0x16b)](a26_0x1a6673[_0x3ccc6f(0x251)](_0x3ccc6f(0x1c0)));else{console[_0x3ccc6f(0x16b)](a26_0x1a6673[_0x3ccc6f(0x251)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console['error'](_0x3ccc6f(0x200));for(const _0x3967c0 of _0x8ee578){console['error']('\x20\x20'+a26_0x1a6673['cyan'](_0x3967c0));}console[_0x3ccc6f(0x16b)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x47dd2e+_0x3ccc6f(0x1ca)+_0x8ee578[0x0]+'\x22');}return 0x1;}const _0x170b3a=createCommandSpinner(a26_0x1a6673[_0x3ccc6f(0x1cb)](_0x3ccc6f(0x19e)),{'verbose':_0x125d38[_0x3ccc6f(0x1f9)]});_0x170b3a[_0x3ccc6f(0x177)]();const _0x519ca8={'onProgress':_0x23440e=>{const _0x50ee94=_0x3ccc6f;_0x170b3a[_0x50ee94(0x209)]=formatProgressMessage(_0x23440e);}};if(_0x125d38[_0x3ccc6f(0x1cf)])_0x519ca8[_0x3ccc6f(0x1cf)]=!![];if(_0x125d38[_0x3ccc6f(0x18c)]&&typeof _0x125d38[_0x3ccc6f(0x18c)]===_0x3ccc6f(0x17d))_0x519ca8[_0x3ccc6f(0x18c)]=_0x125d38[_0x3ccc6f(0x18c)];if(_0x125d38[_0x3ccc6f(0x1f2)]&&typeof _0x125d38['behavior']===_0x3ccc6f(0x17d))_0x519ca8[_0x3ccc6f(0x1f2)]=_0x125d38['behavior'];if(_0x125d38[_0x3ccc6f(0x26c)])_0x519ca8['enriched']=!![];if(_0x125d38['interval'])_0x519ca8[_0x3ccc6f(0x18a)]=_0x125d38['interval'];let _0x1e60de;try{_0x1e60de=await _0x10a8e2['segment'][_0x3ccc6f(0x1dd)](_0x435cbc,_0x519ca8),_0x170b3a['stop']();}catch(_0x4b4ad1){_0x170b3a['stop']();throw _0x4b4ad1;}return await this['displayPreviewResults'](_0x1e60de,{'master':_0x125d38[_0x3ccc6f(0x1cf)],'attribute':typeof _0x125d38[_0x3ccc6f(0x18c)]===_0x3ccc6f(0x17d)?_0x125d38[_0x3ccc6f(0x18c)]:undefined,'behavior':typeof _0x125d38[_0x3ccc6f(0x1f2)]===_0x3ccc6f(0x17d)?_0x125d38[_0x3ccc6f(0x1f2)]:undefined,'enriched':_0x125d38['enriched']}),_0x1e60de[_0x3ccc6f(0x1b4)]?0x0:0x1;}async[a26_0x3760a6(0x25c)](_0xcf2e86,_0x1b0c5d){const _0x577112=a26_0x3760a6;console[_0x577112(0x16b)]('\x0a'+a26_0x1a6673['bold'](_0x577112(0x264))+'\x20'+_0xcf2e86['name']),console['error']('═'['repeat'](0x3c));if(_0x1b0c5d[_0x577112(0x1cf)]&&_0xcf2e86[_0x577112(0x196)]){const _0x547641=a26_0x1a6673[_0x577112(0x1cb)](_0x577112(0x23d))+'\x20'+a26_0x1a6673[_0x577112(0x17f)](_0xcf2e86[_0x577112(0x1cf)]['database']+'.'+_0xcf2e86[_0x577112(0x1cf)]['table']);await this['displaySampleData'](_0x547641,_0xcf2e86['sampleData']);}else{if(_0x1b0c5d[_0x577112(0x18c)]&&_0xcf2e86[_0x577112(0x196)]){const _0x26a28b=a26_0x1a6673[_0x577112(0x1cb)](_0x577112(0x230))+'\x20'+a26_0x1a6673[_0x577112(0x17f)](_0x1b0c5d[_0x577112(0x18c)]);await this['displaySampleData'](_0x26a28b,_0xcf2e86[_0x577112(0x196)]);}else{if(_0x1b0c5d[_0x577112(0x1f2)]&&_0xcf2e86[_0x577112(0x196)]){const _0x454388=a26_0x1a6673['dim'](_0x577112(0x214))+'\x20'+a26_0x1a6673[_0x577112(0x17f)](_0x1b0c5d[_0x577112(0x1f2)]);await this['displaySampleData'](_0x454388,_0xcf2e86[_0x577112(0x196)]);}else{if(_0x1b0c5d[_0x577112(0x26c)]&&_0xcf2e86['sampleData']){const _0x5165d3=a26_0x1a6673[_0x577112(0x1cb)](_0x577112(0x1ba))+'\x20'+a26_0x1a6673['bold'](_0x577112(0x208));await this[_0x577112(0x18f)](_0x5165d3,_0xcf2e86[_0x577112(0x196)]);}else!_0xcf2e86[_0x577112(0x196)]&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0xcf2e86[_0x577112(0x1d7)][_0x577112(0x1e3)]>0x0){console[_0x577112(0x16b)]('─'['repeat'](0x3c)),console['error']('\x0a'+a26_0x1a6673[_0x577112(0x251)](_0x577112(0x202)));for(const _0x23fe58 of _0xcf2e86['errors']){console[_0x577112(0x16b)]('\x20\x20'+a26_0x1a6673[_0x577112(0x251)]('•')+'\x20'+_0x23fe58);}}}async['displaySampleData'](_0x350612,_0x1d2604){const _0x46cdad=a26_0x3760a6;if(_0x1d2604[_0x46cdad(0x1e3)]===0x0){console[_0x46cdad(0x16b)]('\x0a'+_0x350612),console[_0x46cdad(0x16b)](_0x46cdad(0x1be));return;}console[_0x46cdad(0x16b)]('\x0a'+_0x350612);const _0x4c3929=Object[_0x46cdad(0x203)](_0x1d2604[0x0])['map'](_0xb118e1=>({'name':_0xb118e1,'type':typeof _0x1d2604[0x0][_0xb118e1]==='number'?_0x46cdad(0x194):_0x46cdad(0x228)})),_0xa24a5c={'queryId':_0x46cdad(0x266),'columns':_0x4c3929,'data':_0x1d2604,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1d2604[_0x46cdad(0x1e3)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4fb317=formatAsTable(_0xa24a5c,_0x1d2604[_0x46cdad(0x1e3)],!![]);await writeOutput(_0x4fb317,undefined,_0x46cdad(0x1c8));}}export class ParentSegmentRunCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]=a26_0x3760a6(0x15f);[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x1b1);async[a26_0x3760a6(0x173)](_0x36f8de){const _0x243b6e=a26_0x3760a6,{options:_0x3d1e1b,args:_0x29649e,tdx:_0x4a3887}=_0x36f8de,_0x33ec90=_0x3d1e1b,_0x2ae850=_0x29649e[0x0]||_0x3d1e1b['parentSegment'];if(!_0x2ae850)return console[_0x243b6e(0x16b)](a26_0x1a6673[_0x243b6e(0x251)](_0x243b6e(0x1a6))),console[_0x243b6e(0x16b)](_0x243b6e(0x235)),console[_0x243b6e(0x16b)](a26_0x1a6673[_0x243b6e(0x22f)](_0x243b6e(0x21c))),0x1;const _0x386b49=resolveYamlFile(_0x2ae850);if(existsSync(_0x386b49)){_0x33ec90[_0x243b6e(0x1f9)]&&console['error'](_0x243b6e(0x1c2)+_0x386b49);let _0x4fb87e;try{_0x4fb87e=readFileSync(_0x386b49,_0x243b6e(0x270));}catch(_0x1e7070){const _0x4d5a3a=_0x1e7070 instanceof Error?_0x1e7070[_0x243b6e(0x1c6)]:String(_0x1e7070);return console[_0x243b6e(0x16b)](_0x243b6e(0x279)+_0x4d5a3a),0x1;}const _0x5c2155=await withSpinner(_0x243b6e(0x246),()=>_0x4a3887[_0x243b6e(0x1bd)]['pushParentYaml'](_0x4fb87e),{'verbose':_0x33ec90[_0x243b6e(0x1f9)]}),_0x59755a=_0x5c2155[_0x243b6e(0x248)],{isNew:_0x454361,name:_0xa07cf8,hasChanges:_0x4d62ff,diffFormatted:_0xa47c18}=_0x59755a;if(_0x4d62ff){_0x454361?console[_0x243b6e(0x16b)](_0x243b6e(0x186)+_0xa07cf8+'\x27:'):console[_0x243b6e(0x16b)](_0x243b6e(0x19d)+_0xa07cf8+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x243b6e(0x16b)](_0xa47c18),console[_0x243b6e(0x16b)]('─'['repeat'](0x3c));const _0x3ef29f=_0x454361?_0x243b6e(0x229)+_0xa07cf8+_0x243b6e(0x1fd):_0x243b6e(0x1f5)+_0xa07cf8+_0x243b6e(0x1fd);if(!_0x33ec90[_0x243b6e(0x1ef)]){const _0x51c84d=await confirmKey(_0x3ef29f);if(!_0x51c84d)return console[_0x243b6e(0x16b)](_0x243b6e(0x255)),0x1;}const _0x32d630=_0x454361?'Creating':_0x243b6e(0x1c7);await withSpinner(_0x32d630+_0x243b6e(0x1f3)+_0xa07cf8+'\x27...',()=>_0x59755a['apply'](),{'verbose':_0x33ec90[_0x243b6e(0x1f9)]});const _0x33e542=_0x454361?_0x243b6e(0x20a):_0x243b6e(0x1c1);console[_0x243b6e(0x16b)]('✔\x20'+_0x33e542+_0x243b6e(0x1f3)+_0xa07cf8+'\x27');}else console[_0x243b6e(0x16b)](_0x243b6e(0x19a)+_0xa07cf8+'\x27\x20is\x20up\x20to\x20date');}const _0x214e54=await withSpinner(_0x243b6e(0x182)+_0x2ae850+'\x27...',()=>_0x4a3887['segment']['runParent'](_0x2ae850),{'verbose':_0x33ec90[_0x243b6e(0x1f9)]}),_0x30c571=_0x214e54[_0x243b6e(0x248)],_0x1d6ebf=getConsoleUrl(_0x33ec90['site'],_0x243b6e(0x1fb)+_0x30c571[_0x243b6e(0x24d)]+'/sessions/'+_0x30c571[_0x243b6e(0x192)]+_0x243b6e(0x1d4)+_0x30c571[_0x243b6e(0x1ae)]);return console[_0x243b6e(0x16b)](_0x243b6e(0x1ee)),console['error']('\x20\x20'+a26_0x1a6673[_0x243b6e(0x1cb)](_0x243b6e(0x1f8))+'\x20'+_0x30c571['audienceId']),console['error']('\x20\x20'+a26_0x1a6673[_0x243b6e(0x1cb)](_0x243b6e(0x257))+'\x20'+_0x30c571[_0x243b6e(0x276)]),console[_0x243b6e(0x16b)]('\x20\x20'+a26_0x1a6673['dim'](_0x243b6e(0x1fa))+'\x20'+_0x30c571[_0x243b6e(0x192)]),console[_0x243b6e(0x16b)]('\x20\x20'+a26_0x1a6673[_0x243b6e(0x1cb)](_0x243b6e(0x184))+'\x20'+_0x30c571['workflowAttemptId']),console[_0x243b6e(0x16b)]('\x20\x20'+_0x1d6ebf),console[_0x243b6e(0x16b)]('\x0a'+a26_0x1a6673[_0x243b6e(0x1cb)](_0x243b6e(0x1f1))+_0x243b6e(0x241)+_0x30c571['workflowAttemptId']+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a26_0x3760a6(0x271);['description']=a26_0x3760a6(0x161);async[a26_0x3760a6(0x173)](_0x37ce97){const _0x3ebb8d=a26_0x3760a6,{options:_0x2d3abb,args:_0x90bc16,tdx:_0x37200f}=_0x37ce97,_0x2d3aba=_0x90bc16[0x0]||_0x2d3abb[_0x3ebb8d(0x1ad)];if(!_0x2d3aba)return console['error'](a26_0x1a6673[_0x3ebb8d(0x251)](_0x3ebb8d(0x1a6))),console[_0x3ebb8d(0x16b)](_0x3ebb8d(0x167)),console[_0x3ebb8d(0x16b)](a26_0x1a6673['cyan'](_0x3ebb8d(0x21c))),0x1;_0x2d3abb[_0x3ebb8d(0x1f9)]&&(console[_0x3ebb8d(0x16b)](_0x3ebb8d(0x1a5)+_0x2d3abb[_0x3ebb8d(0x207)]),console[_0x3ebb8d(0x16b)](_0x3ebb8d(0x22a)+_0x2d3aba));const _0x284d9a=await withSpinner(_0x3ebb8d(0x274)+_0x2d3aba+_0x3ebb8d(0x1a8),()=>_0x37200f[_0x3ebb8d(0x1bd)][_0x3ebb8d(0x1c4)](_0x2d3aba),{'verbose':_0x2d3abb[_0x3ebb8d(0x1f9)]}),_0x390acf=_0x284d9a[_0x3ebb8d(0x248)];console[_0x3ebb8d(0x16b)](_0x3ebb8d(0x1d6)+_0x390acf[_0x3ebb8d(0x1e3)]+'\x20field'+(_0x390acf[_0x3ebb8d(0x1e3)]!==0x1?'s':''));if(_0x2d3abb[_0x3ebb8d(0x201)]||_0x2d3abb[_0x3ebb8d(0x179)])return await handleSDKOutput(_0x390acf,_0x2d3abb),0x0;return displayFieldsHumanReadable(_0x390acf,_0x2d3aba),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]='segment:parent:view';['description']='Show\x20parent\x20segment\x20details';async['execute'](_0x19ec0f){const _0x4c53df=a26_0x3760a6,{options:_0x5abdec,args:_0x206949,tdx:_0x29b81e}=_0x19ec0f,_0x2b98f7=_0x5abdec,_0xb38b99=_0x206949[0x0]||_0x5abdec[_0x4c53df(0x1ad)];if(!_0xb38b99)return console[_0x4c53df(0x16b)](a26_0x1a6673['red'](_0x4c53df(0x1a6))),console[_0x4c53df(0x16b)](_0x4c53df(0x227)),console[_0x4c53df(0x16b)](_0x4c53df(0x1b2)),console[_0x4c53df(0x16b)](_0x4c53df(0x160)),console[_0x4c53df(0x16b)](a26_0x1a6673[_0x4c53df(0x22f)](_0x4c53df(0x260))),0x1;_0x5abdec[_0x4c53df(0x1f9)]&&(console[_0x4c53df(0x16b)](_0x4c53df(0x1a5)+_0x5abdec[_0x4c53df(0x207)]),console[_0x4c53df(0x16b)]('Parent\x20segment:\x20'+_0xb38b99));const _0x4b348d=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xb38b99+_0x4c53df(0x1a8),()=>_0x29b81e[_0x4c53df(0x1bd)][_0x4c53df(0x262)](_0xb38b99),{'verbose':_0x5abdec[_0x4c53df(0x1f9)]}),_0x5a3eb8=_0x4b348d[_0x4c53df(0x248)];if(_0x2b98f7[_0x4c53df(0x247)]){const _0x23d641=getConsoleNextUrl(_0x2b98f7[_0x4c53df(0x207)],_0x4c53df(0x180)+_0x5a3eb8['id']);return console['error'](a26_0x1a6673[_0x4c53df(0x189)]('✔')+_0x4c53df(0x24b)+a26_0x1a6673['cyan'](_0x23d641)),openBrowser(_0x23d641),0x0;}return await handleSingleObjectOutput(_0x5a3eb8,_0x5abdec),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]=a26_0x3760a6(0x275);[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x1b8);async['execute'](_0x1a974c){const _0x610404=a26_0x3760a6,{options:_0x4cce5a,args:_0x480a33,tdx:_0x52efad}=_0x1a974c,_0x3177b9=_0x480a33[0x0]||_0x4cce5a[_0x610404(0x1ad)];if(!_0x3177b9)return console[_0x610404(0x16b)](a26_0x1a6673[_0x610404(0x251)](_0x610404(0x1a6))),console[_0x610404(0x16b)]('Usage:\x20tdx\x20ps\x20desc\x20[name]\x0a'),console[_0x610404(0x16b)](a26_0x1a6673['cyan'](_0x610404(0x21c))),0x1;_0x4cce5a[_0x610404(0x1f9)]&&(console[_0x610404(0x16b)]('Site:\x20'+_0x4cce5a[_0x610404(0x207)]),console[_0x610404(0x16b)]('Parent\x20segment:\x20'+_0x3177b9));const _0x3129a3=await withSpinner(_0x610404(0x1ac)+_0x3177b9+_0x610404(0x1a8),()=>_0x52efad[_0x610404(0x1bd)][_0x610404(0x24c)](_0x3177b9),{'verbose':_0x4cce5a[_0x610404(0x1f9)]}),_0x233f74=_0x3129a3[_0x610404(0x248)],_0x6fd946=await withSpinner(_0x610404(0x24e)+_0x3177b9+_0x610404(0x1a8),()=>_0x52efad[_0x610404(0x1bd)][_0x610404(0x23a)](_0x233f74),{'verbose':_0x4cce5a[_0x610404(0x1f9)]}),_0x5c4cf3=await executeSchemaQuery(_0x6fd946['data'],_0x52efad,_0x4cce5a);return await handleQueryOutput(_0x5c4cf3,_0x4cce5a),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]='segment:parent:sql';[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x24f);async['execute'](_0x3a712e){const _0x48ec78=a26_0x3760a6,{options:_0x5e9083,args:_0x3011c7,tdx:_0x587e3e}=_0x3a712e,_0x2adedd=_0x3011c7[0x0]||_0x5e9083[_0x48ec78(0x1ad)];if(!_0x2adedd)return console[_0x48ec78(0x16b)](a26_0x1a6673['red'](_0x48ec78(0x1a6))),console['error'](_0x48ec78(0x204)),console[_0x48ec78(0x16b)](a26_0x1a6673[_0x48ec78(0x22f)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x5e9083[_0x48ec78(0x1f9)]&&(console['error']('Site:\x20'+_0x5e9083[_0x48ec78(0x207)]),console[_0x48ec78(0x16b)](_0x48ec78(0x22a)+_0x2adedd));const _0x23069f=await withSpinner(_0x48ec78(0x1ac)+_0x2adedd+_0x48ec78(0x1a8),()=>_0x587e3e[_0x48ec78(0x1bd)]['resolveParentId'](_0x2adedd),{'verbose':_0x5e9083[_0x48ec78(0x1f9)]}),_0x1da704=_0x23069f['data'],_0x30cb39=await withSpinner(_0x48ec78(0x24e)+_0x2adedd+'\x27...',()=>_0x587e3e['segment'][_0x48ec78(0x23a)](_0x1da704),{'verbose':_0x5e9083['verbose']}),_0x44a890=_0x30cb39[_0x48ec78(0x248)];return _0x5e9083[_0x48ec78(0x224)]===_0x48ec78(0x201)||_0x5e9083[_0x48ec78(0x224)]===_0x48ec78(0x179)?await handleSDKOutput([{'sql':_0x44a890}],_0x5e9083):console[_0x48ec78(0x195)](_0x44a890),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x3760a6(0x1e7)]='segment:parent:show';[a26_0x3760a6(0x1b9)]=a26_0x3760a6(0x231);async['execute'](_0x5c8041){const _0x1a642e=a26_0x3760a6,{options:_0x50a5bb,args:_0x286f8e,tdx:_0x3c4c1b}=_0x5c8041,_0x1fc4f8=_0x286f8e[0x0]||_0x50a5bb['parentSegment'];if(!_0x1fc4f8)return console[_0x1a642e(0x16b)](a26_0x1a6673[_0x1a642e(0x251)](_0x1a642e(0x1a6))),console[_0x1a642e(0x16b)](_0x1a642e(0x16d)),console['error'](a26_0x1a6673['cyan'](_0x1a642e(0x21c))),0x1;_0x50a5bb[_0x1a642e(0x1f9)]&&(console['error']('Site:\x20'+_0x50a5bb[_0x1a642e(0x207)]),console['error'](_0x1a642e(0x22a)+_0x1fc4f8));const _0x4e0934=await withSpinner(_0x1a642e(0x1ac)+_0x1fc4f8+_0x1a642e(0x1a8),()=>_0x3c4c1b['segment'][_0x1a642e(0x24c)](_0x1fc4f8),{'verbose':_0x50a5bb[_0x1a642e(0x1f9)]}),_0x4c3009=_0x4e0934[_0x1a642e(0x248)],_0x40a9ea=await withSpinner(_0x1a642e(0x24e)+_0x1fc4f8+_0x1a642e(0x1a8),()=>_0x3c4c1b[_0x1a642e(0x1bd)]['getParentSQL'](_0x4c3009),{'verbose':_0x50a5bb[_0x1a642e(0x1f9)]});let _0x16d0f6=_0x40a9ea['data'];const _0xec1cf=resolveLimit(_0x50a5bb['limit'],DEFAULT_DISPLAY_LIMIT),_0x2b1e8f=/\bLIMIT\s+\d+/i[_0x1a642e(0x225)](_0x16d0f6);!_0x2b1e8f&&(_0x16d0f6=_0x16d0f6[_0x1a642e(0x211)]()[_0x1a642e(0x277)](/;+$/,''),_0x16d0f6=_0x1a642e(0x242)+_0x16d0f6+_0x1a642e(0x26f)+_0xec1cf);_0x50a5bb[_0x1a642e(0x1f9)]&&console['error']('SQL\x20query:\x0a'+_0x16d0f6);const _0x3af427=await withQuerySpinner(_0x1a642e(0x265),async _0x417afe=>{const _0x35c5ea=_0x1a642e,_0x4ded51=await _0x3c4c1b[_0x35c5ea(0x190)][_0x35c5ea(0x173)](_0x16d0f6,{'catalog':'td','schema':_0x35c5ea(0x1f4),'onJobId':_0x1c2c93=>{const _0x444f75=_0x35c5ea;_0x417afe[_0x444f75(0x1de)](_0x1c2c93);}});return _0x4ded51;},{'verbose':_0x50a5bb['verbose']}),_0x45065b=_0x3af427[_0x1a642e(0x248)],_0x4812f3=_0x45065b[_0x1a642e(0x174)]?_0x1a642e(0x172)+_0x45065b[_0x1a642e(0x174)]+']':'';return console[_0x1a642e(0x16b)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x45065b['stats'][_0x1a642e(0x278)][_0x1a642e(0x16e)]()+_0x1a642e(0x21e)+(_0x1a642e(0x199)+formatElapsed(_0x45065b[_0x1a642e(0x263)][_0x1a642e(0x1b0)])+_0x4812f3)),await handleQueryOutput(_0x45065b,_0x50a5bb),0x0;}}
|