@treasuredata/tdx 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/agent-command.js +1 -1
  15. package/dist/commands/api-command.js +1 -1
  16. package/dist/commands/auth-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/context-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/describe.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-proxy.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/config.js +1 -1
  49. package/dist/core/connection-cache.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/proxy/anthropic-adapter.js +1 -1
  59. package/dist/proxy/claude-usage-tracker.js +1 -1
  60. package/dist/proxy/context-signature.js +1 -1
  61. package/dist/proxy/conversation-utils.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/sdk/agent/agent-yaml.d.ts +1 -1
  65. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  66. package/dist/sdk/agent/agent-yaml.js +1 -1
  67. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  68. package/dist/sdk/api.js +1 -1
  69. package/dist/sdk/connection.js +1 -1
  70. package/dist/sdk/engage.js +1 -1
  71. package/dist/sdk/errors.js +1 -1
  72. package/dist/sdk/index.js +1 -1
  73. package/dist/sdk/job.js +1 -1
  74. package/dist/sdk/journey.js +1 -1
  75. package/dist/sdk/llm.js +1 -1
  76. package/dist/sdk/query.js +1 -1
  77. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  78. package/dist/sdk/segment/journey-yaml.js +1 -1
  79. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  80. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  81. package/dist/sdk/segment.js +1 -1
  82. package/dist/sdk/user.js +1 -1
  83. package/dist/sdk/workflow.js +1 -1
  84. package/dist/types/endpoints.js +1 -1
  85. package/dist/types/index.js +1 -1
  86. package/dist/utils/agent-config.js +1 -1
  87. package/dist/utils/agent-ref-parser.js +1 -1
  88. package/dist/utils/async.js +1 -1
  89. package/dist/utils/chat-cache.js +1 -1
  90. package/dist/utils/colors.js +1 -1
  91. package/dist/utils/command-output.js +1 -1
  92. package/dist/utils/constants.js +1 -1
  93. package/dist/utils/diff.js +1 -1
  94. package/dist/utils/fields-display.js +1 -1
  95. package/dist/utils/file-permissions.js +1 -1
  96. package/dist/utils/format-detector.js +1 -1
  97. package/dist/utils/formatters.js +1 -1
  98. package/dist/utils/journey-utils.js +1 -1
  99. package/dist/utils/json-loader.js +1 -1
  100. package/dist/utils/llm-backup-utils.js +1 -1
  101. package/dist/utils/model-aliases.js +1 -1
  102. package/dist/utils/model-factors.js +1 -1
  103. package/dist/utils/option-validation.js +1 -1
  104. package/dist/utils/port.js +1 -1
  105. package/dist/utils/process.js +1 -1
  106. package/dist/utils/prompt.js +1 -1
  107. package/dist/utils/segment-path-parser.js +1 -1
  108. package/dist/utils/segment-ref-parser.js +1 -1
  109. package/dist/utils/spinner.js +1 -1
  110. package/dist/utils/sql-parser.js +1 -1
  111. package/dist/utils/sse-parser.js +1 -1
  112. package/dist/utils/string-utils.js +1 -1
  113. package/dist/utils/table-ref-parser.js +1 -1
  114. package/dist/utils/tdx-config.js +1 -1
  115. package/dist/utils/tdx-logger.js +1 -1
  116. package/dist/utils/tree-formatter.js +1 -1
  117. package/dist/utils/version-check.js +1 -1
  118. package/dist/utils/workflow-utils.js +1 -1
  119. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(_0x1320c0,_0x512531){const _0x46ea2d=a75_0x6946,_0x4744f7=_0x1320c0();while(!![]){try{const _0x2e7321=parseInt(_0x46ea2d(0x195))/0x1*(parseInt(_0x46ea2d(0x15a))/0x2)+-parseInt(_0x46ea2d(0x169))/0x3*(-parseInt(_0x46ea2d(0x194))/0x4)+parseInt(_0x46ea2d(0x143))/0x5+-parseInt(_0x46ea2d(0x14b))/0x6+parseInt(_0x46ea2d(0x186))/0x7+-parseInt(_0x46ea2d(0x191))/0x8+-parseInt(_0x46ea2d(0x147))/0x9*(parseInt(_0x46ea2d(0x190))/0xa);if(_0x2e7321===_0x512531)break;else _0x4744f7['push'](_0x4744f7['shift']());}catch(_0x59bb09){_0x4744f7['push'](_0x4744f7['shift']());}}}(a75_0x1623,0xaf46e));import*as a75_0x273774 from'yaml';function formatScheduleTime(_0x32eb1f){const _0x59be43=a75_0x6946;if(typeof _0x32eb1f===_0x59be43(0x159)){const _0x42b1e7=Math[_0x59be43(0x141)](_0x32eb1f);return String(_0x42b1e7)[_0x59be43(0x15e)](0x2,'0')+_0x59be43(0x15d);}if(typeof _0x32eb1f===_0x59be43(0x144)){if(/^\d{2}:\d{2}:\d{2}$/[_0x59be43(0x178)](_0x32eb1f))return _0x32eb1f;if(/^\d{1,2}:\d{2}$/[_0x59be43(0x178)](_0x32eb1f)){const [_0x6ad2de,_0x4a04e8]=_0x32eb1f[_0x59be43(0x187)](':');return _0x6ad2de['padStart'](0x2,'0')+':'+_0x4a04e8+_0x59be43(0x162);}const _0x552d20=parseInt(_0x32eb1f,0xa);if(!isNaN(_0x552d20)&&_0x32eb1f['match'](/^\d+$/))return String(_0x552d20)[_0x59be43(0x15e)](0x2,'0')+_0x59be43(0x15d);return _0x32eb1f;}return String(_0x32eb1f);}export function apiToYaml(_0x187cd2){const _0x31c662=a75_0x6946,_0x4bbb40={'database':_0x187cd2[_0x31c662(0x16c)]?.['parentDatabaseName']||'','table':_0x187cd2[_0x31c662(0x16c)]?.[_0x31c662(0x153)]||''};_0x187cd2[_0x31c662(0x145)]&&_0x187cd2['audienceFilters'][_0x31c662(0x182)]>0x0&&(_0x4bbb40[_0x31c662(0x197)]=_0x187cd2[_0x31c662(0x145)][_0x31c662(0x18e)](_0x296099=>({'column':_0x296099[_0x31c662(0x13e)],'values':_0x296099[_0x31c662(0x152)]})));let _0x4b481c;_0x187cd2[_0x31c662(0x173)]&&_0x187cd2['scheduleType']!==_0x31c662(0x157)&&(_0x4b481c={'type':_0x187cd2[_0x31c662(0x173)]},_0x187cd2['scheduleOption']&&(_0x4b481c[_0x31c662(0x16d)]=formatScheduleTime(_0x187cd2[_0x31c662(0x177)])),_0x187cd2['timezone']&&(_0x4b481c['timezone']=_0x187cd2[_0x31c662(0x164)]));let _0xb919b2;(_0x187cd2[_0x31c662(0x158)]||_0x187cd2[_0x31c662(0x16b)]||_0x187cd2['prestoPoolName'])&&(_0xb919b2={},_0x187cd2[_0x31c662(0x158)]&&(_0xb919b2[_0x31c662(0x172)]=_0x187cd2[_0x31c662(0x158)]),_0x187cd2[_0x31c662(0x16b)]&&(_0xb919b2[_0x31c662(0x181)]=_0x187cd2[_0x31c662(0x16b)]),_0x187cd2[_0x31c662(0x180)]&&(_0xb919b2[_0x31c662(0x18b)]=_0x187cd2[_0x31c662(0x180)]));const _0x36848d=_0x187cd2[_0x31c662(0x189)]&&_0x187cd2[_0x31c662(0x189)][_0x31c662(0x182)]>0x0?groupAttributesBySource(_0x187cd2[_0x31c662(0x189)]):undefined,_0x454751=_0x187cd2[_0x31c662(0x18c)]&&_0x187cd2[_0x31c662(0x18c)][_0x31c662(0x182)]>0x0?_0x187cd2[_0x31c662(0x18c)][_0x31c662(0x18e)](convertApiBehaviorToYaml):undefined;let _0x59abce;_0x187cd2['customerGroup']&&(_0x59abce={'name':_0x187cd2[_0x31c662(0x185)][_0x31c662(0x149)],'source':{'database':_0x187cd2[_0x31c662(0x185)][_0x31c662(0x192)],'table':_0x187cd2['customerGroup']['parentTableName']},'join':{'parent_key':_0x187cd2['customerGroup'][_0x31c662(0x166)],'child_key':_0x187cd2[_0x31c662(0x185)][_0x31c662(0x17e)]}},_0x187cd2['customerGroup'][_0x31c662(0x16e)]&&_0x187cd2['customerGroup'][_0x31c662(0x16e)][_0x31c662(0x182)]>0x0&&(_0x59abce[_0x31c662(0x189)]=groupAttributesBySource(_0x187cd2['customerGroup']['customerGroupAttributes'])),_0x187cd2[_0x31c662(0x185)]['customerGroupBehaviors']&&_0x187cd2[_0x31c662(0x185)][_0x31c662(0x168)][_0x31c662(0x182)]>0x0&&(_0x59abce['behaviors']=_0x187cd2[_0x31c662(0x185)][_0x31c662(0x168)][_0x31c662(0x18e)](convertApiBehaviorToYaml)));const _0x2bb809={'name':_0x187cd2[_0x31c662(0x149)],..._0x187cd2[_0x31c662(0x142)]&&{'description':_0x187cd2[_0x31c662(0x142)]},'master':_0x4bbb40,..._0x4b481c&&{'schedule':_0x4b481c},..._0xb919b2&&{'engine':_0xb919b2},..._0x36848d&&{'attributes':_0x36848d},..._0x454751&&{'behaviors':_0x454751},..._0x59abce&&{'customer_group':_0x59abce}};return _0x2bb809;}function groupAttributesBySource(_0x173f1b){const _0x471434=a75_0x6946,_0x229e59=new Map();for(const _0x130d71 of _0x173f1b){const _0x4220be=_0x130d71[_0x471434(0x192)]+'.'+_0x130d71[_0x471434(0x153)]+'.'+_0x130d71[_0x471434(0x166)]+'.'+_0x130d71['foreignKey'];!_0x229e59[_0x471434(0x167)](_0x4220be)&&_0x229e59[_0x471434(0x18a)](_0x4220be,[]),_0x229e59[_0x471434(0x163)](_0x4220be)[_0x471434(0x14c)](_0x130d71);}const _0x671fee=[];for(const [,_0x2e7408]of _0x229e59){const _0x1be48e=_0x2e7408[0x0],_0x456998=_0x1be48e[_0x471434(0x175)]||_0x1be48e['parentTableName'];_0x671fee[_0x471434(0x14c)]({'name':_0x456998,'source':{'database':_0x1be48e[_0x471434(0x192)],'table':_0x1be48e[_0x471434(0x153)]},'join':{'parent_key':_0x1be48e[_0x471434(0x166)],'child_key':_0x1be48e['foreignKey']},'columns':_0x2e7408[_0x471434(0x18e)](_0x28a318=>{const _0x4f17ae=_0x471434,_0x329ed2={'column':_0x28a318['parentColumn'],'type':_0x28a318['type']};return _0x28a318[_0x4f17ae(0x149)]!==_0x28a318[_0x4f17ae(0x161)]&&(_0x329ed2[_0x4f17ae(0x148)]=_0x28a318[_0x4f17ae(0x149)]),_0x329ed2;})});}return _0x671fee;}function convertApiBehaviorToYaml(_0x49b263){const _0x2dbedf=a75_0x6946,_0x6e77ab={'name':_0x49b263[_0x2dbedf(0x149)],'source':{'database':_0x49b263[_0x2dbedf(0x192)],'table':_0x49b263[_0x2dbedf(0x153)]},'join':{'parent_key':_0x49b263[_0x2dbedf(0x166)],'child_key':_0x49b263[_0x2dbedf(0x17e)]}};if(_0x49b263['allColumns'])_0x6e77ab[_0x2dbedf(0x155)]=!![];else _0x49b263[_0x2dbedf(0x16f)]&&_0x49b263[_0x2dbedf(0x16f)][_0x2dbedf(0x182)]>0x0&&(_0x6e77ab['columns']=_0x49b263[_0x2dbedf(0x16f)]['map'](_0x5c3fbc=>{const _0x299b9b=_0x2dbedf,_0x5bb8f2={'column':_0x5c3fbc['parentColumn'],'type':_0x5c3fbc[_0x299b9b(0x14f)]};return _0x5c3fbc[_0x299b9b(0x149)]!==_0x5c3fbc['parentColumn']&&(_0x5bb8f2[_0x299b9b(0x148)]=_0x5c3fbc['name']),_0x5bb8f2;}));return _0x49b263[_0x2dbedf(0x13f)]&&(_0x6e77ab['default_time_filter']=_0x49b263[_0x2dbedf(0x13f)]),_0x49b263[_0x2dbedf(0x17c)]&&(_0x6e77ab['realtime']=_0x49b263[_0x2dbedf(0x17c)]),_0x6e77ab;}function a75_0x1623(){const _0x3cc317=['column','customerGroup','8765505xSaxDa','split','03:00','attributes','set','trino_pool','behaviors','realtime','map','stringify','10xyHqXd','5043696osPred','parentDatabaseName','column_name','336368TxywcJ','1143371RcAJUp','master:','filters','engine:','user_id','columnName','defaultTimeFilterEnabled','database','floor','description','4132535kCximO','string','audienceFilters','engine','20819709ZFzDLz','label','name','default_time_filter','2407896KceMzo','push','customer_group','parse','type','replace','Example\x20Attributes','rightValues','parentTableName','YAML\x20config\x20missing\x20required\x20field:\x20master','all_columns','columns','none','workflowHiveOnly','number','2QUDGFS','UTC','Parent\x20segment\x20description',':00:00','padStart','attributes:','source','parentColumn',':00','get','timezone','schedule','parentKey','has','customerGroupBehaviors','30KoYkeK','child_key','hivePoolName','master','time','customerGroupAttributes','schema','join','events_table','hive_only','scheduleType','customer_group:','groupingName','YAML\x20config\x20missing\x20required\x20field:\x20master.table','scheduleOption','test','parent_key','table','customer_id','isRealtime','YAML\x20config\x20missing\x20required\x20field:\x20name','foreignKey','YAML\x20config\x20missing\x20required\x20field:\x20master.database','prestoPoolName','hive_pool','length','values'];a75_0x1623=function(){return _0x3cc317;};return a75_0x1623();}function a75_0x6946(_0xa7cc12,_0x353e1f){_0xa7cc12=_0xa7cc12-0x13d;const _0x16233d=a75_0x1623();let _0x694646=_0x16233d[_0xa7cc12];return _0x694646;}export function yamlToApi(_0x491740){const _0x11d64e=a75_0x6946,_0x33f75e={'name':_0x491740[_0x11d64e(0x149)],'master':{'parentDatabaseName':_0x491740[_0x11d64e(0x16c)]['database'],'parentTableName':_0x491740[_0x11d64e(0x16c)][_0x11d64e(0x17a)]}};_0x491740[_0x11d64e(0x142)]&&(_0x33f75e['description']=_0x491740['description']);_0x491740[_0x11d64e(0x16c)][_0x11d64e(0x197)]&&_0x491740[_0x11d64e(0x16c)][_0x11d64e(0x197)][_0x11d64e(0x182)]>0x0&&(_0x33f75e['audienceFilters']=_0x491740[_0x11d64e(0x16c)][_0x11d64e(0x197)][_0x11d64e(0x18e)](_0x58545e=>({'columnName':_0x58545e['column'],'rightValues':_0x58545e[_0x11d64e(0x183)]})));_0x491740[_0x11d64e(0x165)]&&(_0x33f75e['scheduleType']=_0x491740[_0x11d64e(0x165)]['type'],_0x491740[_0x11d64e(0x165)]['time']&&(_0x33f75e[_0x11d64e(0x177)]=_0x491740[_0x11d64e(0x165)][_0x11d64e(0x16d)]),_0x491740['schedule'][_0x11d64e(0x164)]&&(_0x33f75e[_0x11d64e(0x164)]=_0x491740[_0x11d64e(0x165)]['timezone']));_0x491740[_0x11d64e(0x146)]&&(_0x491740[_0x11d64e(0x146)][_0x11d64e(0x172)]!==undefined&&(_0x33f75e[_0x11d64e(0x158)]=_0x491740['engine'][_0x11d64e(0x172)]),_0x491740[_0x11d64e(0x146)][_0x11d64e(0x181)]!==undefined&&(_0x33f75e[_0x11d64e(0x16b)]=_0x491740[_0x11d64e(0x146)]['hive_pool']),_0x491740[_0x11d64e(0x146)][_0x11d64e(0x18b)]!==undefined&&(_0x33f75e[_0x11d64e(0x180)]=_0x491740[_0x11d64e(0x146)][_0x11d64e(0x18b)]));_0x491740[_0x11d64e(0x189)]&&_0x491740['attributes'][_0x11d64e(0x182)]>0x0&&(_0x33f75e[_0x11d64e(0x189)]=flattenAttributeGroups(_0x491740[_0x11d64e(0x189)]));_0x491740[_0x11d64e(0x18c)]&&_0x491740[_0x11d64e(0x18c)][_0x11d64e(0x182)]>0x0&&(_0x33f75e[_0x11d64e(0x18c)]=_0x491740[_0x11d64e(0x18c)][_0x11d64e(0x18e)](convertYamlBehaviorToApi));if(_0x491740[_0x11d64e(0x14d)]){const _0x25cb8f=_0x491740[_0x11d64e(0x14d)];_0x33f75e[_0x11d64e(0x185)]={'name':_0x25cb8f[_0x11d64e(0x149)],'parentDatabaseName':_0x25cb8f[_0x11d64e(0x160)][_0x11d64e(0x140)],'parentTableName':_0x25cb8f[_0x11d64e(0x160)][_0x11d64e(0x17a)],'parentKey':_0x25cb8f[_0x11d64e(0x170)][_0x11d64e(0x179)],'foreignKey':_0x25cb8f['join'][_0x11d64e(0x16a)]},_0x25cb8f[_0x11d64e(0x189)]&&_0x25cb8f[_0x11d64e(0x189)][_0x11d64e(0x182)]>0x0&&(_0x33f75e[_0x11d64e(0x185)][_0x11d64e(0x16e)]=flattenAttributeGroups(_0x25cb8f[_0x11d64e(0x189)])[_0x11d64e(0x18e)](_0x5ca477=>({'name':_0x5ca477[_0x11d64e(0x149)],'type':_0x5ca477[_0x11d64e(0x14f)],'parentDatabaseName':_0x5ca477[_0x11d64e(0x192)],'parentTableName':_0x5ca477[_0x11d64e(0x153)],'parentColumn':_0x5ca477[_0x11d64e(0x161)],'parentKey':_0x5ca477[_0x11d64e(0x166)],'foreignKey':_0x5ca477[_0x11d64e(0x17e)]}))),_0x25cb8f[_0x11d64e(0x18c)]&&_0x25cb8f['behaviors'][_0x11d64e(0x182)]>0x0&&(_0x33f75e[_0x11d64e(0x185)]['customerGroupBehaviors']=_0x25cb8f[_0x11d64e(0x18c)][_0x11d64e(0x18e)](_0x122511=>({'name':_0x122511[_0x11d64e(0x149)],'parentDatabaseName':_0x122511[_0x11d64e(0x160)][_0x11d64e(0x140)],'parentTableName':_0x122511[_0x11d64e(0x160)]['table'],'parentKey':_0x122511[_0x11d64e(0x170)][_0x11d64e(0x179)],'foreignKey':_0x122511[_0x11d64e(0x170)]['child_key'],'allColumns':_0x122511[_0x11d64e(0x155)],'schema':_0x122511['columns']?.[_0x11d64e(0x18e)](_0x346884=>({'name':_0x346884['label']||_0x346884['column'],'type':_0x346884[_0x11d64e(0x14f)],'parentColumn':_0x346884[_0x11d64e(0x184)]}))})));}return _0x33f75e;}function flattenAttributeGroups(_0x3320c1){const _0x484258=a75_0x6946,_0x4a9a4c=[];for(const _0x2625ed of _0x3320c1){for(const _0x55ccde of _0x2625ed['columns']){_0x4a9a4c[_0x484258(0x14c)]({'name':_0x55ccde[_0x484258(0x148)]||_0x55ccde[_0x484258(0x184)],'type':_0x55ccde[_0x484258(0x14f)],'parentDatabaseName':_0x2625ed['source']['database'],'parentTableName':_0x2625ed[_0x484258(0x160)][_0x484258(0x17a)],'parentColumn':_0x55ccde[_0x484258(0x184)],'parentKey':_0x2625ed[_0x484258(0x170)]['parent_key'],'foreignKey':_0x2625ed[_0x484258(0x170)][_0x484258(0x16a)],'groupingName':_0x2625ed['name']});}}return _0x4a9a4c;}function convertYamlBehaviorToApi(_0x11a1e6){const _0x24d23c=a75_0x6946,_0x468ab4={'name':_0x11a1e6[_0x24d23c(0x149)],'parentDatabaseName':_0x11a1e6[_0x24d23c(0x160)][_0x24d23c(0x140)],'parentTableName':_0x11a1e6[_0x24d23c(0x160)][_0x24d23c(0x17a)],'parentKey':_0x11a1e6['join'][_0x24d23c(0x179)],'foreignKey':_0x11a1e6['join'][_0x24d23c(0x16a)]};if(_0x11a1e6[_0x24d23c(0x155)])_0x468ab4['allColumns']=!![];else _0x11a1e6['columns']&&_0x11a1e6[_0x24d23c(0x156)][_0x24d23c(0x182)]>0x0&&(_0x468ab4[_0x24d23c(0x16f)]=_0x11a1e6[_0x24d23c(0x156)][_0x24d23c(0x18e)](_0x4b32b3=>({'name':_0x4b32b3['label']||_0x4b32b3[_0x24d23c(0x184)],'type':_0x4b32b3['type'],'parentColumn':_0x4b32b3['column']})));return _0x11a1e6[_0x24d23c(0x14a)]!==undefined&&(_0x468ab4[_0x24d23c(0x13f)]=_0x11a1e6[_0x24d23c(0x14a)]),_0x11a1e6[_0x24d23c(0x18d)]!==undefined&&(_0x468ab4[_0x24d23c(0x17c)]=_0x11a1e6[_0x24d23c(0x18d)]),_0x468ab4;}export function toYamlString(_0x2015fe){const _0x1f9485=a75_0x6946,_0x14fb19=JSON[_0x1f9485(0x14e)](JSON[_0x1f9485(0x18f)](_0x2015fe)),_0x46e06c=a75_0x273774[_0x1f9485(0x18f)](_0x14fb19,{'indent':0x2,'lineWidth':0x0,'nullStr':'null'}),_0x5197ca=[_0x1f9485(0x196),'schedule:',_0x1f9485(0x198),_0x1f9485(0x15f),'behaviors:',_0x1f9485(0x174)];let _0x4726d3=_0x46e06c;for(const _0x445026 of _0x5197ca){_0x4726d3=_0x4726d3[_0x1f9485(0x150)](new RegExp('^('+_0x445026+')','m'),(_0x3efaa2,_0x470bcd,_0x29b888)=>{if(_0x29b888===0x0||_0x4726d3[_0x29b888-0x1]==='\x0a'&&_0x4726d3[_0x29b888-0x2]==='\x0a')return _0x470bcd;return'\x0a'+_0x470bcd;});}return _0x4726d3;}export function parseYamlString(_0x161bc2){const _0x2fb0a5=a75_0x6946,_0x32f250=a75_0x273774[_0x2fb0a5(0x14e)](_0x161bc2);if(!_0x32f250[_0x2fb0a5(0x149)])throw new Error(_0x2fb0a5(0x17d));if(!_0x32f250['master'])throw new Error(_0x2fb0a5(0x154));if(!_0x32f250[_0x2fb0a5(0x16c)]['database'])throw new Error(_0x2fb0a5(0x17f));if(!_0x32f250[_0x2fb0a5(0x16c)]['table'])throw new Error(_0x2fb0a5(0x176));return _0x32f250;}export function generateTemplate(_0x131cca,_0x1a09c9,_0x18e54d){const _0x1e3cb6=a75_0x6946,_0x2f8a9b={'name':_0x131cca,'description':_0x1e3cb6(0x15c),'master':{'database':_0x1a09c9,'table':_0x18e54d},'schedule':{'type':'daily','time':_0x1e3cb6(0x188),'timezone':_0x1e3cb6(0x15b)},'attributes':[{'name':_0x1e3cb6(0x151),'source':{'database':_0x1a09c9,'table':'attribute_table'},'join':{'parent_key':'id','child_key':_0x1e3cb6(0x17b)},'columns':[{'column':_0x1e3cb6(0x193),'label':'Display\x20Name','type':_0x1e3cb6(0x144)}]}],'behaviors':[{'name':'Example\x20Events','source':{'database':_0x1a09c9,'table':_0x1e3cb6(0x171)},'join':{'parent_key':_0x1e3cb6(0x13d),'child_key':_0x1e3cb6(0x17b)},'all_columns':!![]}]};return toYamlString(_0x2f8a9b);}
1
+ (function(_0x36e34d,_0x59773d){const _0x5f399a=a75_0x2dbc,_0x362a0e=_0x36e34d();while(!![]){try{const _0x5bb4c9=-parseInt(_0x5f399a(0x1e0))/0x1+parseInt(_0x5f399a(0x1eb))/0x2*(parseInt(_0x5f399a(0x1df))/0x3)+parseInt(_0x5f399a(0x1c8))/0x4*(-parseInt(_0x5f399a(0x1b1))/0x5)+-parseInt(_0x5f399a(0x204))/0x6*(-parseInt(_0x5f399a(0x1af))/0x7)+parseInt(_0x5f399a(0x1fc))/0x8*(parseInt(_0x5f399a(0x1ae))/0x9)+parseInt(_0x5f399a(0x1b4))/0xa+-parseInt(_0x5f399a(0x1ff))/0xb*(-parseInt(_0x5f399a(0x1ce))/0xc);if(_0x5bb4c9===_0x59773d)break;else _0x362a0e['push'](_0x362a0e['shift']());}catch(_0x1670d6){_0x362a0e['push'](_0x362a0e['shift']());}}}(a75_0x292a,0xa5cea));import*as a75_0x523deb from'yaml';function formatScheduleTime(_0x3b3547){const _0x5b53a0=a75_0x2dbc;if(typeof _0x3b3547==='number'){const _0x307de0=Math[_0x5b53a0(0x1ed)](_0x3b3547);return String(_0x307de0)[_0x5b53a0(0x1e3)](0x2,'0')+_0x5b53a0(0x1c4);}if(typeof _0x3b3547===_0x5b53a0(0x1e1)){if(/^\d{2}:\d{2}:\d{2}$/[_0x5b53a0(0x1f5)](_0x3b3547))return _0x3b3547;if(/^\d{1,2}:\d{2}$/['test'](_0x3b3547)){const [_0xea230b,_0x118aa0]=_0x3b3547['split'](':');return _0xea230b['padStart'](0x2,'0')+':'+_0x118aa0+_0x5b53a0(0x1e4);}const _0x2f897c=parseInt(_0x3b3547,0xa);if(!isNaN(_0x2f897c)&&_0x3b3547['match'](/^\d+$/))return String(_0x2f897c)['padStart'](0x2,'0')+_0x5b53a0(0x1c4);return _0x3b3547;}return String(_0x3b3547);}export function apiToYaml(_0x45f694){const _0x435e15=a75_0x2dbc,_0x3401f1={'database':_0x45f694[_0x435e15(0x1f8)]?.[_0x435e15(0x1ef)]||'','table':_0x45f694['master']?.[_0x435e15(0x1c6)]||''};_0x45f694[_0x435e15(0x1d3)]&&_0x45f694['audienceFilters'][_0x435e15(0x1d4)]>0x0&&(_0x3401f1[_0x435e15(0x1c7)]=_0x45f694[_0x435e15(0x1d3)][_0x435e15(0x1d1)](_0x275b31=>({'column':_0x275b31['columnName'],'values':_0x275b31[_0x435e15(0x1c0)]})));let _0x3cb073;_0x45f694[_0x435e15(0x1d5)]&&_0x45f694['scheduleType']!==_0x435e15(0x1d7)&&(_0x3cb073={'type':_0x45f694[_0x435e15(0x1d5)]},_0x45f694['scheduleOption']&&(_0x3cb073[_0x435e15(0x206)]=formatScheduleTime(_0x45f694[_0x435e15(0x1b3)])),_0x45f694['timezone']&&(_0x3cb073[_0x435e15(0x1dd)]=_0x45f694[_0x435e15(0x1dd)]));let _0x5b7c7f;(_0x45f694['workflowHiveOnly']||_0x45f694[_0x435e15(0x1fd)]||_0x45f694[_0x435e15(0x1f6)])&&(_0x5b7c7f={},_0x45f694[_0x435e15(0x1e2)]&&(_0x5b7c7f[_0x435e15(0x1b5)]=_0x45f694['workflowHiveOnly']),_0x45f694[_0x435e15(0x1fd)]&&(_0x5b7c7f[_0x435e15(0x203)]=_0x45f694[_0x435e15(0x1fd)]),_0x45f694['prestoPoolName']&&(_0x5b7c7f[_0x435e15(0x1fe)]=_0x45f694[_0x435e15(0x1f6)]));const _0x647a34=_0x45f694[_0x435e15(0x1ee)]&&_0x45f694[_0x435e15(0x1ee)][_0x435e15(0x1d4)]>0x0?groupAttributesBySource(_0x45f694['attributes']):undefined,_0x28622a=_0x45f694[_0x435e15(0x1ea)]&&_0x45f694[_0x435e15(0x1ea)][_0x435e15(0x1d4)]>0x0?_0x45f694['behaviors']['map'](convertApiBehaviorToYaml):undefined;let _0xffe4f9;_0x45f694[_0x435e15(0x1da)]&&(_0xffe4f9={'name':_0x45f694[_0x435e15(0x1da)]['name'],'source':{'database':_0x45f694[_0x435e15(0x1da)]['parentDatabaseName'],'table':_0x45f694[_0x435e15(0x1da)][_0x435e15(0x1c6)]},'join':{'parent_key':_0x45f694[_0x435e15(0x1da)][_0x435e15(0x207)],'child_key':_0x45f694[_0x435e15(0x1da)][_0x435e15(0x1c9)]}},_0x45f694['customerGroup'][_0x435e15(0x1b6)]&&_0x45f694[_0x435e15(0x1da)][_0x435e15(0x1b6)]['length']>0x0&&(_0xffe4f9[_0x435e15(0x1ee)]=groupAttributesBySource(_0x45f694['customerGroup']['customerGroupAttributes'])),_0x45f694[_0x435e15(0x1da)][_0x435e15(0x1dc)]&&_0x45f694['customerGroup'][_0x435e15(0x1dc)][_0x435e15(0x1d4)]>0x0&&(_0xffe4f9['behaviors']=_0x45f694[_0x435e15(0x1da)][_0x435e15(0x1dc)]['map'](convertApiBehaviorToYaml)));const _0x3a4f80={'name':_0x45f694[_0x435e15(0x1fa)],..._0x45f694[_0x435e15(0x1ca)]&&{'description':_0x45f694[_0x435e15(0x1ca)]},'master':_0x3401f1,..._0x3cb073&&{'schedule':_0x3cb073},..._0x5b7c7f&&{'engine':_0x5b7c7f},..._0x647a34&&{'attributes':_0x647a34},..._0x28622a&&{'behaviors':_0x28622a},..._0xffe4f9&&{'customer_group':_0xffe4f9}};return _0x3a4f80;}function groupAttributesBySource(_0x28d49f){const _0xc4d097=a75_0x2dbc,_0x1e4f55=new Map();for(const _0x466dd2 of _0x28d49f){const _0x13ba00=_0x466dd2[_0xc4d097(0x1ef)]+'.'+_0x466dd2['parentTableName']+'.'+_0x466dd2['parentKey']+'.'+_0x466dd2[_0xc4d097(0x1c9)];!_0x1e4f55[_0xc4d097(0x1e7)](_0x13ba00)&&_0x1e4f55[_0xc4d097(0x1b0)](_0x13ba00,[]),_0x1e4f55[_0xc4d097(0x1f0)](_0x13ba00)[_0xc4d097(0x1c3)](_0x466dd2);}const _0x51f865=[];for(const [,_0x5d61de]of _0x1e4f55){const _0x121125=_0x5d61de[0x0],_0x1e1300=_0x121125[_0xc4d097(0x201)]||_0x121125[_0xc4d097(0x1c6)];_0x51f865[_0xc4d097(0x1c3)]({'name':_0x1e1300,'source':{'database':_0x121125[_0xc4d097(0x1ef)],'table':_0x121125[_0xc4d097(0x1c6)]},'join':{'parent_key':_0x121125[_0xc4d097(0x207)],'child_key':_0x121125[_0xc4d097(0x1c9)]},'columns':_0x5d61de['map'](_0x583753=>{const _0x488486=_0xc4d097,_0x1e355e={'column':_0x583753['parentColumn'],'type':_0x583753[_0x488486(0x1cc)]};return _0x583753['name']!==_0x583753[_0x488486(0x1b8)]&&(_0x1e355e[_0x488486(0x1b2)]=_0x583753[_0x488486(0x1fa)]),_0x1e355e;})});}return _0x51f865;}function convertApiBehaviorToYaml(_0x1bfa4c){const _0x7dbbd8=a75_0x2dbc,_0x274088={'name':_0x1bfa4c[_0x7dbbd8(0x1fa)],'source':{'database':_0x1bfa4c['parentDatabaseName'],'table':_0x1bfa4c[_0x7dbbd8(0x1c6)]},'join':{'parent_key':_0x1bfa4c[_0x7dbbd8(0x207)],'child_key':_0x1bfa4c[_0x7dbbd8(0x1c9)]}};if(_0x1bfa4c[_0x7dbbd8(0x1de)])_0x274088[_0x7dbbd8(0x1bc)]=!![];else _0x1bfa4c[_0x7dbbd8(0x1fb)]&&_0x1bfa4c['schema']['length']>0x0&&(_0x274088[_0x7dbbd8(0x1e9)]=_0x1bfa4c['schema'][_0x7dbbd8(0x1d1)](_0xab86ed=>{const _0x45e417=_0x7dbbd8,_0x497b3a={'column':_0xab86ed[_0x45e417(0x1b8)],'type':_0xab86ed['type']};return _0xab86ed[_0x45e417(0x1fa)]!==_0xab86ed[_0x45e417(0x1b8)]&&(_0x497b3a[_0x45e417(0x1b2)]=_0xab86ed['name']),_0x497b3a;}));return _0x1bfa4c[_0x7dbbd8(0x1f4)]&&(_0x274088[_0x7dbbd8(0x1ac)]=_0x1bfa4c[_0x7dbbd8(0x1f4)]),_0x1bfa4c[_0x7dbbd8(0x1f3)]&&(_0x274088[_0x7dbbd8(0x1d6)]=_0x1bfa4c['isRealtime']),_0x274088;}export function yamlToApi(_0x424b2a){const _0x5407a0=a75_0x2dbc,_0x15d45d={'name':_0x424b2a[_0x5407a0(0x1fa)],'master':{'parentDatabaseName':_0x424b2a[_0x5407a0(0x1f8)][_0x5407a0(0x1ab)],'parentTableName':_0x424b2a[_0x5407a0(0x1f8)]['table']}};_0x424b2a[_0x5407a0(0x1ca)]&&(_0x15d45d['description']=_0x424b2a[_0x5407a0(0x1ca)]);_0x424b2a['master'][_0x5407a0(0x1c7)]&&_0x424b2a['master'][_0x5407a0(0x1c7)][_0x5407a0(0x1d4)]>0x0&&(_0x15d45d['audienceFilters']=_0x424b2a[_0x5407a0(0x1f8)][_0x5407a0(0x1c7)][_0x5407a0(0x1d1)](_0x1af55f=>({'columnName':_0x1af55f[_0x5407a0(0x1e8)],'rightValues':_0x1af55f[_0x5407a0(0x202)]})));_0x424b2a[_0x5407a0(0x1d2)]&&(_0x15d45d[_0x5407a0(0x1d5)]=_0x424b2a[_0x5407a0(0x1d2)][_0x5407a0(0x1cc)],_0x424b2a[_0x5407a0(0x1d2)]['time']&&(_0x15d45d['scheduleOption']=_0x424b2a['schedule'][_0x5407a0(0x206)]),_0x424b2a[_0x5407a0(0x1d2)]['timezone']&&(_0x15d45d[_0x5407a0(0x1dd)]=_0x424b2a['schedule'][_0x5407a0(0x1dd)]));_0x424b2a[_0x5407a0(0x1cd)]&&(_0x424b2a[_0x5407a0(0x1cd)][_0x5407a0(0x1b5)]!==undefined&&(_0x15d45d[_0x5407a0(0x1e2)]=_0x424b2a[_0x5407a0(0x1cd)]['hive_only']),_0x424b2a[_0x5407a0(0x1cd)]['hive_pool']!==undefined&&(_0x15d45d[_0x5407a0(0x1fd)]=_0x424b2a[_0x5407a0(0x1cd)][_0x5407a0(0x203)]),_0x424b2a[_0x5407a0(0x1cd)][_0x5407a0(0x1fe)]!==undefined&&(_0x15d45d[_0x5407a0(0x1f6)]=_0x424b2a['engine'][_0x5407a0(0x1fe)]));_0x424b2a[_0x5407a0(0x1ee)]&&_0x424b2a[_0x5407a0(0x1ee)][_0x5407a0(0x1d4)]>0x0&&(_0x15d45d['attributes']=flattenAttributeGroups(_0x424b2a[_0x5407a0(0x1ee)]));_0x424b2a['behaviors']&&_0x424b2a[_0x5407a0(0x1ea)]['length']>0x0&&(_0x15d45d[_0x5407a0(0x1ea)]=_0x424b2a[_0x5407a0(0x1ea)][_0x5407a0(0x1d1)](convertYamlBehaviorToApi));if(_0x424b2a[_0x5407a0(0x1d0)]){const _0x372ecf=_0x424b2a[_0x5407a0(0x1d0)];_0x15d45d[_0x5407a0(0x1da)]={'name':_0x372ecf[_0x5407a0(0x1fa)],'parentDatabaseName':_0x372ecf['source'][_0x5407a0(0x1ab)],'parentTableName':_0x372ecf[_0x5407a0(0x200)][_0x5407a0(0x1f1)],'parentKey':_0x372ecf['join'][_0x5407a0(0x1ba)],'foreignKey':_0x372ecf['join'][_0x5407a0(0x1e5)]},_0x372ecf[_0x5407a0(0x1ee)]&&_0x372ecf[_0x5407a0(0x1ee)][_0x5407a0(0x1d4)]>0x0&&(_0x15d45d['customerGroup']['customerGroupAttributes']=flattenAttributeGroups(_0x372ecf[_0x5407a0(0x1ee)])[_0x5407a0(0x1d1)](_0x422425=>({'name':_0x422425[_0x5407a0(0x1fa)],'type':_0x422425[_0x5407a0(0x1cc)],'parentDatabaseName':_0x422425[_0x5407a0(0x1ef)],'parentTableName':_0x422425[_0x5407a0(0x1c6)],'parentColumn':_0x422425[_0x5407a0(0x1b8)],'parentKey':_0x422425['parentKey'],'foreignKey':_0x422425[_0x5407a0(0x1c9)]}))),_0x372ecf[_0x5407a0(0x1ea)]&&_0x372ecf[_0x5407a0(0x1ea)][_0x5407a0(0x1d4)]>0x0&&(_0x15d45d[_0x5407a0(0x1da)]['customerGroupBehaviors']=_0x372ecf['behaviors'][_0x5407a0(0x1d1)](_0x27ee7e=>({'name':_0x27ee7e['name'],'parentDatabaseName':_0x27ee7e[_0x5407a0(0x200)][_0x5407a0(0x1ab)],'parentTableName':_0x27ee7e[_0x5407a0(0x200)][_0x5407a0(0x1f1)],'parentKey':_0x27ee7e[_0x5407a0(0x1b7)][_0x5407a0(0x1ba)],'foreignKey':_0x27ee7e[_0x5407a0(0x1b7)]['child_key'],'allColumns':_0x27ee7e[_0x5407a0(0x1bc)],'schema':_0x27ee7e['columns']?.[_0x5407a0(0x1d1)](_0x4ece6e=>({'name':_0x4ece6e[_0x5407a0(0x1b2)]||_0x4ece6e[_0x5407a0(0x1e8)],'type':_0x4ece6e[_0x5407a0(0x1cc)],'parentColumn':_0x4ece6e[_0x5407a0(0x1e8)]}))})));}return _0x15d45d;}function flattenAttributeGroups(_0x396e1b){const _0x37c6e6=a75_0x2dbc,_0x3cc028=[];for(const _0x176467 of _0x396e1b){for(const _0x1aa81e of _0x176467[_0x37c6e6(0x1e9)]){_0x3cc028[_0x37c6e6(0x1c3)]({'name':_0x1aa81e['label']||_0x1aa81e['column'],'type':_0x1aa81e[_0x37c6e6(0x1cc)],'parentDatabaseName':_0x176467[_0x37c6e6(0x200)][_0x37c6e6(0x1ab)],'parentTableName':_0x176467['source'][_0x37c6e6(0x1f1)],'parentColumn':_0x1aa81e[_0x37c6e6(0x1e8)],'parentKey':_0x176467[_0x37c6e6(0x1b7)][_0x37c6e6(0x1ba)],'foreignKey':_0x176467['join']['child_key'],'groupingName':_0x176467[_0x37c6e6(0x1fa)]});}}return _0x3cc028;}function a75_0x2dbc(_0x509459,_0x580125){_0x509459=_0x509459-0x1aa;const _0x292a82=a75_0x292a();let _0x2dbc68=_0x292a82[_0x509459];return _0x2dbc68;}function convertYamlBehaviorToApi(_0x3fd388){const _0x32830f=a75_0x2dbc,_0x3d23bf={'name':_0x3fd388[_0x32830f(0x1fa)],'parentDatabaseName':_0x3fd388[_0x32830f(0x200)]['database'],'parentTableName':_0x3fd388[_0x32830f(0x200)]['table'],'parentKey':_0x3fd388[_0x32830f(0x1b7)][_0x32830f(0x1ba)],'foreignKey':_0x3fd388[_0x32830f(0x1b7)][_0x32830f(0x1e5)]};if(_0x3fd388['all_columns'])_0x3d23bf[_0x32830f(0x1de)]=!![];else _0x3fd388[_0x32830f(0x1e9)]&&_0x3fd388[_0x32830f(0x1e9)][_0x32830f(0x1d4)]>0x0&&(_0x3d23bf[_0x32830f(0x1fb)]=_0x3fd388['columns']['map'](_0x4b6e92=>({'name':_0x4b6e92[_0x32830f(0x1b2)]||_0x4b6e92['column'],'type':_0x4b6e92['type'],'parentColumn':_0x4b6e92[_0x32830f(0x1e8)]})));return _0x3fd388[_0x32830f(0x1ac)]!==undefined&&(_0x3d23bf[_0x32830f(0x1f4)]=_0x3fd388[_0x32830f(0x1ac)]),_0x3fd388[_0x32830f(0x1d6)]!==undefined&&(_0x3d23bf[_0x32830f(0x1f3)]=_0x3fd388[_0x32830f(0x1d6)]),_0x3d23bf;}export function toYamlString(_0x53cc61){const _0x58589c=a75_0x2dbc,_0x21de00=JSON['parse'](JSON['stringify'](_0x53cc61)),_0x39eaf5=a75_0x523deb[_0x58589c(0x1d8)](_0x21de00,{'indent':0x2,'lineWidth':0x0,'nullStr':_0x58589c(0x1bb)}),_0x3ae3cf=[_0x58589c(0x1cb),_0x58589c(0x1c1),_0x58589c(0x1be),_0x58589c(0x1aa),_0x58589c(0x1b9),'customer_group:'];let _0x189663=_0x39eaf5;for(const _0x1d7b81 of _0x3ae3cf){_0x189663=_0x189663[_0x58589c(0x1c2)](new RegExp('^('+_0x1d7b81+')','m'),(_0x31858e,_0x474f47,_0x355935)=>{if(_0x355935===0x0||_0x189663[_0x355935-0x1]==='\x0a'&&_0x189663[_0x355935-0x2]==='\x0a')return _0x474f47;return'\x0a'+_0x474f47;});}return _0x189663;}export function parseYamlString(_0x540bc1){const _0x23dca2=a75_0x2dbc,_0x44cec3=a75_0x523deb[_0x23dca2(0x1f7)](_0x540bc1);if(!_0x44cec3['name'])throw new Error(_0x23dca2(0x1ad));if(!_0x44cec3[_0x23dca2(0x1f8)])throw new Error(_0x23dca2(0x1ec));if(!_0x44cec3['master'][_0x23dca2(0x1ab)])throw new Error(_0x23dca2(0x1cf));if(!_0x44cec3[_0x23dca2(0x1f8)][_0x23dca2(0x1f1)])throw new Error(_0x23dca2(0x1bf));return _0x44cec3;}function a75_0x292a(){const _0x35eddb=['map','schedule','audienceFilters','length','scheduleType','realtime','none','stringify','user_id','customerGroup','03:00','customerGroupBehaviors','timezone','allColumns','834027LQPHtm','610103nGuNqv','string','workflowHiveOnly','padStart',':00','child_key','events_table','has','column','columns','behaviors','2lucFqK','YAML\x20config\x20missing\x20required\x20field:\x20master','floor','attributes','parentDatabaseName','get','table','daily','isRealtime','defaultTimeFilterEnabled','test','prestoPoolName','parse','master','Example\x20Events','name','schema','152RmuuOl','hivePoolName','trino_pool','5148jizRwn','source','groupingName','values','hive_pool','1233270cbpViS','Example\x20Attributes','time','parentKey','attributes:','database','default_time_filter','YAML\x20config\x20missing\x20required\x20field:\x20name','147114OLBtfA','7AVnuTG','set','10KEDewF','label','scheduleOption','5311550UGvwno','hive_only','customerGroupAttributes','join','parentColumn','behaviors:','parent_key','null','all_columns','customer_id','engine:','YAML\x20config\x20missing\x20required\x20field:\x20master.table','rightValues','schedule:','replace','push',':00:00','attribute_table','parentTableName','filters','778748HAmWSa','foreignKey','description','master:','type','engine','9060BhTZec','YAML\x20config\x20missing\x20required\x20field:\x20master.database','customer_group'];a75_0x292a=function(){return _0x35eddb;};return a75_0x292a();}export function generateTemplate(_0x4b812b,_0x8977d,_0xfa3a59){const _0x51a1ab=a75_0x2dbc,_0x2e0d60={'name':_0x4b812b,'description':'Parent\x20segment\x20description','master':{'database':_0x8977d,'table':_0xfa3a59},'schedule':{'type':_0x51a1ab(0x1f2),'time':_0x51a1ab(0x1db),'timezone':'UTC'},'attributes':[{'name':_0x51a1ab(0x205),'source':{'database':_0x8977d,'table':_0x51a1ab(0x1c5)},'join':{'parent_key':'id','child_key':_0x51a1ab(0x1bd)},'columns':[{'column':'column_name','label':'Display\x20Name','type':_0x51a1ab(0x1e1)}]}],'behaviors':[{'name':_0x51a1ab(0x1f9),'source':{'database':_0x8977d,'table':_0x51a1ab(0x1e6)},'join':{'parent_key':_0x51a1ab(0x1d9),'child_key':_0x51a1ab(0x1bd)},'all_columns':!![]}]};return toYamlString(_0x2e0d60);}
@@ -1 +1 @@
1
- const a76_0x2ecb70=a76_0x9066;(function(_0x385b21,_0x5e53dd){const _0x697adc=a76_0x9066,_0x3aa6df=_0x385b21();while(!![]){try{const _0x3539e3=-parseInt(_0x697adc(0xce))/0x1+-parseInt(_0x697adc(0xbb))/0x2+-parseInt(_0x697adc(0x83))/0x3*(-parseInt(_0x697adc(0xb6))/0x4)+parseInt(_0x697adc(0xb8))/0x5*(parseInt(_0x697adc(0xea))/0x6)+-parseInt(_0x697adc(0xe4))/0x7*(-parseInt(_0x697adc(0xbc))/0x8)+parseInt(_0x697adc(0x81))/0x9+parseInt(_0x697adc(0x8f))/0xa*(-parseInt(_0x697adc(0xe2))/0xb);if(_0x3539e3===_0x5e53dd)break;else _0x3aa6df['push'](_0x3aa6df['shift']());}catch(_0x19f993){_0x3aa6df['push'](_0x3aa6df['shift']());}}}(a76_0x5c99,0x99cce));import{CDPApiClient}from'../client/cdp-api-client.js';function a76_0x9066(_0x5be2e4,_0x1d702a){_0x5be2e4=_0x5be2e4-0x81;const _0x5c99f3=a76_0x5c99();let _0x90668a=_0x5c99f3[_0x5be2e4];return _0x90668a;}import{TrinoApiClient}from'../client/trino-api-client.js';import{SDKError,ErrorCode}from'./errors.js';import{parsePath}from'../utils/segment-path-parser.js';import{apiToYaml,yamlToApi,toYamlString,parseYamlString}from'./segment/parent-segment-yaml.js';function a76_0x5c99(){const _0xdbbfd5=['data','getSegmentSQL','createJourneySegment','segmentFolderId','detectResourceTypeInFolder','parentTableName','sampleData','child_key','allValid','listParents','behavior','121QMArtP','updateParentSegment','62027ddSPuO','createSegment','Path\x20must\x20be\x20absolute\x20(cannot\x20start\x20with\x20.\x20or\x20..)','createFolder','matched_count','updateActivation','36xPdEoO','then','getAudienceBehaviors','getParentSQL','error','attributes','map','Validating\x20master\x20table:\x20','getAudienceAttributes','listFolders','message','segments','database','Behavior\x20\x27','executeQuery','getParentSegment','push','Attribute\x20\x27','Calculating\x20statistics\x20for:\x20','master','listParentSegments','trinoClient','Path\x20cannot\x20be\x20empty','find','isAbsolute','listRecursive','Counting\x20master\x20table\x20rows...','listSegments','createdAt','enriched','createActivation','\x27\x20not\x20found','parentDatabaseName','attribute','\x20in\x20parent\x20','logger','Maximum\x20recursion\x20depth\x20(','getParentFull','5327028pxjULZ','description','3nkFTOF','totalEvents','Validating\x20all\x20attributes\x20and\x20behaviors\x20in\x20parallel...','updateParent','parent','traversePath','Folder\x20\x27','segment','resolveParentIdOrName','rootFolderId','INVALID_ARGUMENT',')\x20exceeded','1163060OQFrYE','onProgress','ambiguous','some','resolveSegmentId','previewParentYaml','filter','Validating\x20all\x20attributes\x20in\x20parallel...','schemaValid','test','length','matchedCount','updateSegmentById','\x27\x20not\x20found\x20in\x20path','table','join','client','getSegmentFolder','createParentSegment','folder','updateSegment','parent_key','schema','getActivation','parentColumn','Segment\x20\x27','name','\x27\x20not\x20found\x20in\x20','rowCount','Master\x20table:\x20','deleteSegment','behaviors','customersWithEvents','interval','listUnified','getParentSegmentSQL','total_events','createSegmentFolder','getParentSegmentFull','3873812bkSeFJ','Parent\x20segment\x20not\x20found:\x20','777980wZyfLK','getSegment','updatedAt','70442oaBPFA','136XXBkMD','listActivations','deleteActivation','Resource\x20\x27','pushParentYaml','SEGMENT_NOT_FOUND','resolveFolderId','Validating\x20behavior:\x20','resolveParentId','all','customers_with_events','source','Validating\x20attribute:\x20','isArray','listSegmentFolders','schemaError','groupingName','createParent','700005qZWCsF','Fetching\x20sample\x20data\x20for:\x20','Calculating\x20coverage\x20for:\x20','\x27:\x20','Folder\x20not\x20found:\x20','string','parentFolderId','type','Fetching\x20enriched\x20master\x20data...'];a76_0x5c99=function(){return _0xdbbfd5;};return a76_0x5c99();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{DEFAULT_TIME_RANGE,DEFAULT_SAMPLE_LIMIT,generateSchemaValidationSQL,generateMasterCountSQL,generateMasterSampleSQL,generateAttributeCoverageSQL,generateBehaviorStatsSQL,generateAttributeSampleSQL,generateBehaviorSampleSQL,generateEnrichedSQL,generateAttributeSchemaSQL,generateBehaviorSchemaSQL,findAttributeByName,findBehaviorByName,getAttributeColumns,getBehaviorColumns}from'./segment/parent-segment-preview.js';export class SegmentSDK{[a76_0x2ecb70(0x9f)];['trinoClient'];constructor(_0x27496a){const _0x4d85aa=a76_0x2ecb70;this['client']=new CDPApiClient(_0x27496a,_0x27496a[_0x4d85aa(0x10d)]),this['trinoClient']=new TrinoApiClient(_0x27496a,_0x27496a[_0x4d85aa(0x10d)]);}async[a76_0x2ecb70(0xe0)](){const _0x259c97=a76_0x2ecb70;return await this['client'][_0x259c97(0xfe)]();}async['getParent'](_0x3749fd){const _0x1217ad=a76_0x2ecb70;return await this['client'][_0x1217ad(0xf9)](_0x3749fd);}async[a76_0x2ecb70(0x105)](_0x5a24d5){const _0xb2f4c1=a76_0x2ecb70;return await this[_0xb2f4c1(0x9f)][_0xb2f4c1(0x105)](_0x5a24d5);}async['getSegment'](_0x867aaf,_0x3703be){const _0x4e3bd8=a76_0x2ecb70;return await this[_0x4e3bd8(0x9f)][_0x4e3bd8(0xb9)](_0x867aaf,_0x3703be);}async[a76_0x2ecb70(0xf3)](_0x571d2d){const _0x3f7446=a76_0x2ecb70;return await this['client'][_0x3f7446(0xca)](_0x571d2d);}async['getFolder'](_0x7d775d){const _0x20c1e9=a76_0x2ecb70;return await this[_0x20c1e9(0x9f)][_0x20c1e9(0xa0)](_0x7d775d);}async[a76_0x2ecb70(0xbd)](_0x135951,_0x28422c){const _0xb02e2c=a76_0x2ecb70;return await this[_0xb02e2c(0x9f)][_0xb02e2c(0xbd)](_0x135951,_0x28422c);}async[a76_0x2ecb70(0xa6)](_0x48df32,_0x558f9c,_0x41371c){const _0x3a066b=a76_0x2ecb70;return await this['client'][_0x3a066b(0xa6)](_0x48df32,_0x558f9c,_0x41371c);}async[a76_0x2ecb70(0x108)](_0x46bce9,_0xcdfe76,_0x6576cb){const _0x534f7c=a76_0x2ecb70;return await this['client'][_0x534f7c(0x108)](_0x46bce9,_0xcdfe76,_0x6576cb);}async[a76_0x2ecb70(0xe9)](_0x1cb230,_0xab0020,_0x5767c4,_0x5b1db2){return await this['client']['updateActivation'](_0x1cb230,_0xab0020,_0x5767c4,_0x5b1db2);}async[a76_0x2ecb70(0xbe)](_0x17e4fe,_0x4486bc,_0x56fd61){const _0xf666fb=a76_0x2ecb70;return await this[_0xf666fb(0x9f)][_0xf666fb(0xbe)](_0x17e4fe,_0x4486bc,_0x56fd61);}async[a76_0x2ecb70(0xed)](_0x1c4428){const _0x5119e9=a76_0x2ecb70;return await this[_0x5119e9(0x9f)][_0x5119e9(0xb2)](_0x1c4428);}async[a76_0x2ecb70(0xd8)](_0x3ffb17,_0x193502){const _0x5f4a64=a76_0x2ecb70;return await this[_0x5f4a64(0x9f)][_0x5f4a64(0xd8)](_0x3ffb17,_0x193502);}async['resolveParentId'](_0x5a12c7){const _0x53a67a=a76_0x2ecb70,_0x278723=await this[_0x53a67a(0xe0)](),_0xd71611=_0x278723[_0x53a67a(0x101)](_0x282df2=>_0x282df2[_0x53a67a(0xef)]['name']===_0x5a12c7);if(!_0xd71611)throw new SDKError(ErrorCode[_0x53a67a(0xc1)],_0x53a67a(0xb7)+_0x5a12c7);return _0xd71611['id'];}async['runParent'](_0x5e7b4d){const _0x3e9ec7=a76_0x2ecb70;let _0x3956e2=_0x5e7b4d;return!/^\d+$/[_0x3e9ec7(0x98)](_0x5e7b4d)&&(_0x3956e2=await this[_0x3e9ec7(0xc4)](_0x5e7b4d)),await this[_0x3e9ec7(0x9f)]['runParentSegment'](_0x3956e2);}async['resolveSegmentId'](_0x15b7fb,_0x99202){const _0x4903dd=a76_0x2ecb70,_0x1581d3=await this[_0x4903dd(0x105)](_0x15b7fb),_0x410802=_0x1581d3[_0x4903dd(0x101)](_0x3ea00a=>_0x3ea00a['name']===_0x99202);if(!_0x410802)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Child\x20segment\x20not\x20found:\x20'+_0x99202+_0x4903dd(0x10c)+_0x15b7fb);return _0x410802['id'];}async[a76_0x2ecb70(0xc2)](_0x4604f4,_0x15c027){const _0x4c62a2=a76_0x2ecb70,_0x5e0037=await this[_0x4c62a2(0xf3)](_0x4604f4),_0x33646f=_0x5e0037[_0x4c62a2(0x101)](_0x4b1bfd=>_0x4b1bfd[_0x4c62a2(0xa9)]===_0x15c027);if(!_0x33646f)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4c62a2(0xd2)+_0x15c027+_0x4c62a2(0x10c)+_0x4604f4);return _0x33646f['id'];}async['listFields'](_0x2bbe4c){const _0x487cd6=a76_0x2ecb70,_0x3900a6=await this[_0x487cd6(0x8b)](_0x2bbe4c),[_0x29d516,_0x4409c8]=await Promise['all']([this['client'][_0x487cd6(0xf2)](_0x3900a6),this[_0x487cd6(0x9f)][_0x487cd6(0xec)](_0x3900a6)]),_0x201ddf=[];for(const _0x25fda9 of _0x29d516){_0x201ddf[_0x487cd6(0xfa)]({'name':_0x25fda9[_0x487cd6(0xa9)],'type':_0x25fda9[_0x487cd6(0xd5)],'source':'attribute','parentDatabaseName':_0x25fda9['parentDatabaseName'],'parentTableName':_0x25fda9[_0x487cd6(0xdc)],'parentColumn':_0x25fda9[_0x487cd6(0xa7)],'groupingName':_0x25fda9[_0x487cd6(0xcc)]??undefined});}for(const _0x3eaaf5 of _0x4409c8){const _0x3e8cc2=_0x3eaaf5[_0x487cd6(0xa9)];if(_0x3eaaf5['schema']&&Array[_0x487cd6(0xc9)](_0x3eaaf5[_0x487cd6(0xa5)]))for(const _0x16bd13 of _0x3eaaf5['schema']){_0x16bd13['name']&&_0x16bd13[_0x487cd6(0xd5)]&&_0x201ddf[_0x487cd6(0xfa)]({'name':_0x3e8cc2+'.'+_0x16bd13[_0x487cd6(0xa9)],'type':_0x16bd13['type'],'source':_0x487cd6(0xe1),'behaviorName':_0x3e8cc2,'parentDatabaseName':_0x3eaaf5[_0x487cd6(0x10a)],'parentTableName':_0x3eaaf5[_0x487cd6(0xdc)],'parentColumn':_0x16bd13[_0x487cd6(0xa7)]});}}return _0x201ddf;}async[a76_0x2ecb70(0xcd)](_0x56737e){const _0xd72915=a76_0x2ecb70;return await this[_0xd72915(0x9f)][_0xd72915(0xa1)](_0x56737e);}async[a76_0x2ecb70(0x86)](_0x71a3ed,_0x5f4266){const _0x3a7f3a=a76_0x2ecb70,_0x26b085=await this[_0x3a7f3a(0x8b)](_0x71a3ed);return await this[_0x3a7f3a(0x9f)][_0x3a7f3a(0xe3)](_0x26b085,_0x5f4266);}async['getParentFull'](_0x398b39){const _0x122108=a76_0x2ecb70,_0x4a0f6a=await this[_0x122108(0x8b)](_0x398b39);return await this[_0x122108(0x9f)][_0x122108(0xb5)](_0x4a0f6a);}async['pullParentYaml'](_0x3ee7bf){const _0x26f66f=a76_0x2ecb70,_0x250fe4=await this[_0x26f66f(0x10f)](_0x3ee7bf),_0x313449=apiToYaml(_0x250fe4);return toYamlString(_0x313449);}async[a76_0x2ecb70(0xc0)](_0x142fe5){const _0x3901a8=a76_0x2ecb70,_0x49ea76=typeof _0x142fe5==='string'?parseYamlString(_0x142fe5):_0x142fe5,_0x44bbad=yamlToApi(_0x49ea76);let _0x2531ec=null,_0x337838='';try{_0x2531ec=await this[_0x3901a8(0x10f)](_0x49ea76['name']);const _0x40f65c=apiToYaml(_0x2531ec);_0x337838=toYamlString(_0x40f65c);}catch{}const _0x3f5054=toYamlString(_0x49ea76),_0x5ca532=generateDiff(_0x337838,_0x3f5054),_0x54fbb8=formatDiffWithColors(_0x5ca532),_0x578334=_0x2531ec===null,_0x1163c3=hasChanges(_0x5ca532),_0x4a7027={'isNew':_0x578334,'id':_0x2531ec?.['id']||'','name':_0x49ea76['name'],'diff':_0x5ca532,'diffFormatted':_0x54fbb8,'hasChanges':_0x1163c3},_0x2d2f8f=async()=>{const _0x1c2183=_0x3901a8;return _0x578334?await this[_0x1c2183(0xcd)](_0x44bbad):await this[_0x1c2183(0x86)](_0x2531ec['id'],_0x44bbad);};return{..._0x4a7027,'apply':_0x2d2f8f};}async['validateParentYaml'](_0x16def4,_0x3f5344={}){const _0x226836=a76_0x2ecb70,_0x324e09=typeof _0x16def4===_0x226836(0xd3)?parseYamlString(_0x16def4):_0x16def4,_0x546428=[];let _0xbd6909=!![];const _0x3d16ad=_0x371902=>_0x3f5344[_0x226836(0x90)]?.(_0x371902),_0x4f5e98={'name':_0x324e09['name'],'master':{'database':_0x324e09[_0x226836(0xfd)][_0x226836(0xf6)],'table':_0x324e09[_0x226836(0xfd)][_0x226836(0x9d)],'schemaValid':![]},'attributes':[],'behaviors':[],'errors':_0x546428,'allValid':!![]},_0x543ee2=async _0x82dfb4=>{const _0x20ef8a=_0x226836;try{const _0x82e20d=await this['trinoClient'][_0x20ef8a(0xf8)](_0x82dfb4);return{'data':_0x82e20d['data']};}catch(_0x268e3e){const _0x518db1=_0x268e3e instanceof Error?_0x268e3e[_0x20ef8a(0xf4)]:String(_0x268e3e);return{'data':[],'error':_0x518db1};}};_0x3d16ad(_0x226836(0xf1)+_0x324e09[_0x226836(0xfd)][_0x226836(0xf6)]+'.'+_0x324e09[_0x226836(0xfd)][_0x226836(0x9d)]);const _0x3b811d=generateSchemaValidationSQL(_0x324e09['master'][_0x226836(0xf6)],_0x324e09[_0x226836(0xfd)][_0x226836(0x9d)]),_0x23d51f=await _0x543ee2(_0x3b811d);if(_0x23d51f[_0x226836(0xee)])_0x4f5e98[_0x226836(0xfd)][_0x226836(0x97)]=![],_0x4f5e98[_0x226836(0xfd)][_0x226836(0xcb)]=_0x23d51f[_0x226836(0xee)],_0x546428[_0x226836(0xfa)](_0x226836(0xac)+_0x23d51f[_0x226836(0xee)]),_0xbd6909=![];else{_0x4f5e98[_0x226836(0xfd)][_0x226836(0x97)]=!![],_0x3d16ad(_0x226836(0x104));const _0x479e6b=await _0x543ee2(generateMasterCountSQL(_0x324e09));!_0x479e6b['error']&&_0x479e6b[_0x226836(0xd7)][_0x226836(0x99)]>0x0&&(_0x4f5e98[_0x226836(0xfd)][_0x226836(0xab)]=_0x479e6b[_0x226836(0xd7)][0x0]['row_count']);}if(_0x3f5344[_0x226836(0xfd)])return _0x4f5e98[_0x226836(0xdf)]=_0xbd6909,_0x4f5e98;const _0x4a108b=async _0x313d10=>{const _0x24b561=_0x226836,_0x88bc29={'name':_0x313d10[_0x24b561(0xa9)],'database':_0x313d10['source'][_0x24b561(0xf6)],'table':_0x313d10[_0x24b561(0xc7)][_0x24b561(0x9d)],'joinKey':_0x313d10[_0x24b561(0x9e)][_0x24b561(0xde)],'foreignKey':_0x313d10[_0x24b561(0x9e)][_0x24b561(0xa4)],'columns':getAttributeColumns(_0x313d10),'schemaValid':![]};_0x3d16ad(_0x24b561(0xc8)+_0x313d10['name']);const _0xb25b94=await _0x543ee2(generateAttributeSchemaSQL(_0x324e09,_0x313d10));if(_0xb25b94[_0x24b561(0xee)])_0x88bc29[_0x24b561(0xcb)]=_0xb25b94[_0x24b561(0xee)];else{_0x88bc29['schemaValid']=!![],_0x3d16ad(_0x24b561(0xd0)+_0x313d10['name']);const _0x1e2516=await _0x543ee2(generateAttributeCoverageSQL(_0x324e09,_0x313d10));!_0x1e2516['error']&&_0x1e2516['data'][_0x24b561(0x99)]>0x0&&(_0x88bc29[_0x24b561(0x9a)]=_0x1e2516[_0x24b561(0xd7)][0x0][_0x24b561(0xe8)],_0x4f5e98['master'][_0x24b561(0xab)]&&_0x4f5e98[_0x24b561(0xfd)][_0x24b561(0xab)]>0x0&&(_0x88bc29['coveragePercent']=_0x88bc29[_0x24b561(0x9a)]/_0x4f5e98[_0x24b561(0xfd)][_0x24b561(0xab)]*0x64));}return _0x88bc29;},_0x77021e=async(_0x2ff0da,_0x418ab4)=>{const _0x4098e9=_0x226836,_0x41ab7d={'name':_0x2ff0da[_0x4098e9(0xa9)],'database':_0x2ff0da['source'][_0x4098e9(0xf6)],'table':_0x2ff0da['source'][_0x4098e9(0x9d)],'joinKey':_0x2ff0da[_0x4098e9(0x9e)][_0x4098e9(0xde)],'foreignKey':_0x2ff0da[_0x4098e9(0x9e)][_0x4098e9(0xa4)],'columns':getBehaviorColumns(_0x2ff0da),'schemaValid':![]};_0x3d16ad(_0x4098e9(0xc3)+_0x2ff0da[_0x4098e9(0xa9)]);const _0x34847c=await _0x543ee2(generateBehaviorSchemaSQL(_0x324e09,_0x2ff0da));if(_0x34847c[_0x4098e9(0xee)])_0x41ab7d['schemaError']=_0x34847c[_0x4098e9(0xee)];else{_0x41ab7d[_0x4098e9(0x97)]=!![],_0x3d16ad(_0x4098e9(0xfc)+_0x2ff0da[_0x4098e9(0xa9)]+'\x20('+_0x418ab4+')');const _0x2b7b1d=await _0x543ee2(generateBehaviorStatsSQL(_0x324e09,_0x2ff0da,_0x418ab4));!_0x2b7b1d[_0x4098e9(0xee)]&&_0x2b7b1d[_0x4098e9(0xd7)][_0x4098e9(0x99)]>0x0&&(_0x41ab7d[_0x4098e9(0xaf)]=_0x2b7b1d[_0x4098e9(0xd7)][0x0][_0x4098e9(0xc6)],_0x41ab7d[_0x4098e9(0x84)]=_0x2b7b1d[_0x4098e9(0xd7)][0x0][_0x4098e9(0xb3)],_0x4f5e98['master']['rowCount']&&_0x4f5e98[_0x4098e9(0xfd)]['rowCount']>0x0&&(_0x41ab7d['customerPercent']=_0x41ab7d['customersWithEvents']/_0x4f5e98[_0x4098e9(0xfd)]['rowCount']*0x64));}return _0x41ab7d;},_0x18493f=(_0x459f84,_0x8a8fef)=>{const _0x29fa2a=_0x226836;_0x4f5e98[_0x29fa2a(0xef)]=_0x459f84,_0x4f5e98[_0x29fa2a(0xae)]=_0x8a8fef;for(const _0x45d68a of _0x459f84){!_0x45d68a[_0x29fa2a(0x97)]&&(_0x546428[_0x29fa2a(0xfa)](_0x29fa2a(0xfb)+_0x45d68a[_0x29fa2a(0xa9)]+_0x29fa2a(0xd1)+_0x45d68a[_0x29fa2a(0xcb)]),_0xbd6909=![]);}for(const _0x3f48b1 of _0x8a8fef){!_0x3f48b1['schemaValid']&&(_0x546428[_0x29fa2a(0xfa)](_0x29fa2a(0xf7)+_0x3f48b1[_0x29fa2a(0xa9)]+_0x29fa2a(0xd1)+_0x3f48b1[_0x29fa2a(0xcb)]),_0xbd6909=![]);}},_0x440498=_0x3f5344['interval']||DEFAULT_TIME_RANGE;if(typeof _0x3f5344[_0x226836(0x10b)]===_0x226836(0xd3)){const _0x1d8433=findAttributeByName(_0x324e09,_0x3f5344['attribute']);if(!_0x1d8433)throw new SDKError(ErrorCode[_0x226836(0xc1)],_0x226836(0xfb)+_0x3f5344['attribute']+_0x226836(0x109));const _0x3a76c2=await _0x4a108b(_0x1d8433);return _0x18493f([_0x3a76c2],[]),_0x4f5e98[_0x226836(0xdf)]=_0xbd6909,_0x4f5e98;}if(_0x3f5344['attribute']===!![]){_0x3d16ad(_0x226836(0x96));const _0x46c2d5=await Promise['all']((_0x324e09[_0x226836(0xef)]||[])[_0x226836(0xf0)](_0x395e25=>_0x4a108b(_0x395e25)));return _0x18493f(_0x46c2d5,[]),_0x4f5e98['allValid']=_0xbd6909,_0x4f5e98;}if(typeof _0x3f5344[_0x226836(0xe1)]===_0x226836(0xd3)){const _0x5c7b6f=findBehaviorByName(_0x324e09,_0x3f5344[_0x226836(0xe1)]);if(!_0x5c7b6f)throw new SDKError(ErrorCode[_0x226836(0xc1)],_0x226836(0xf7)+_0x3f5344[_0x226836(0xe1)]+_0x226836(0x109));const _0x3db5e4=await _0x77021e(_0x5c7b6f,_0x440498);return _0x18493f([],[_0x3db5e4]),_0x4f5e98[_0x226836(0xdf)]=_0xbd6909,_0x4f5e98;}if(_0x3f5344[_0x226836(0xe1)]===!![]){_0x3d16ad('Validating\x20all\x20behaviors\x20in\x20parallel...');const _0x3b653c=await Promise[_0x226836(0xc5)]((_0x324e09[_0x226836(0xae)]||[])[_0x226836(0xf0)](_0x36a3cf=>_0x77021e(_0x36a3cf,_0x440498)));return _0x18493f([],_0x3b653c),_0x4f5e98[_0x226836(0xdf)]=_0xbd6909,_0x4f5e98;}if(_0x3f5344['enriched']){_0x3d16ad(_0x226836(0x96));const _0x6014ab=await Promise[_0x226836(0xc5)]((_0x324e09[_0x226836(0xef)]||[])['map'](_0x254117=>_0x4a108b(_0x254117)));return _0x18493f(_0x6014ab,[]),_0x4f5e98[_0x226836(0xdf)]=_0xbd6909,_0x4f5e98;}_0x3d16ad(_0x226836(0x85));const [_0x39fd49,_0x42394e]=await Promise[_0x226836(0xc5)]([Promise[_0x226836(0xc5)]((_0x324e09[_0x226836(0xef)]||[])[_0x226836(0xf0)](_0x345348=>_0x4a108b(_0x345348))),Promise[_0x226836(0xc5)]((_0x324e09['behaviors']||[])[_0x226836(0xf0)](_0x6ff935=>_0x77021e(_0x6ff935,_0x440498)))]);return _0x18493f(_0x39fd49,_0x42394e),_0x4f5e98[_0x226836(0xdf)]=_0xbd6909,_0x4f5e98;}async[a76_0x2ecb70(0x94)](_0x4851bf,_0x18b3a3={}){const _0x3959bf=a76_0x2ecb70,_0x1f741a=typeof _0x4851bf===_0x3959bf(0xd3)?parseYamlString(_0x4851bf):_0x4851bf,_0x5e70f9=[];let _0x1edf46=!![];const _0x2720e5=_0x174c0b=>_0x18b3a3[_0x3959bf(0x90)]?.(_0x174c0b),_0x3cab8e={'name':_0x1f741a['name'],'master':{'database':_0x1f741a[_0x3959bf(0xfd)][_0x3959bf(0xf6)],'table':_0x1f741a[_0x3959bf(0xfd)][_0x3959bf(0x9d)],'schemaValid':!![]},'attributes':[],'behaviors':[],'errors':_0x5e70f9,'allValid':!![]},_0x10e466=async _0x5e92bc=>{const _0xb8bd73=_0x3959bf;try{const _0x3f977d=await this[_0xb8bd73(0xff)][_0xb8bd73(0xf8)](_0x5e92bc);return{'data':_0x3f977d[_0xb8bd73(0xd7)]};}catch(_0xff1472){const _0x38fd48=_0xff1472 instanceof Error?_0xff1472['message']:String(_0xff1472);return{'data':[],'error':_0x38fd48};}};if(_0x18b3a3['master']){_0x2720e5('Fetching\x20master\x20sample\x20data...');const _0x528222=generateMasterSampleSQL(_0x1f741a,DEFAULT_SAMPLE_LIMIT),_0x17082d=await _0x10e466(_0x528222);return!_0x17082d[_0x3959bf(0xee)]?_0x3cab8e[_0x3959bf(0xdd)]=_0x17082d['data']:(_0x5e70f9[_0x3959bf(0xfa)]('Master\x20table:\x20'+_0x17082d[_0x3959bf(0xee)]),_0x1edf46=![]),_0x3cab8e[_0x3959bf(0xdf)]=_0x1edf46,_0x3cab8e;}if(_0x18b3a3[_0x3959bf(0x10b)]){const _0x338218=findAttributeByName(_0x1f741a,_0x18b3a3[_0x3959bf(0x10b)]);if(!_0x338218)throw new SDKError(ErrorCode[_0x3959bf(0xc1)],_0x3959bf(0xfb)+_0x18b3a3['attribute']+'\x27\x20not\x20found');_0x2720e5(_0x3959bf(0xcf)+_0x338218[_0x3959bf(0xa9)]);const _0x4cc3a3=generateAttributeSampleSQL(_0x1f741a,_0x338218,DEFAULT_SAMPLE_LIMIT),_0x140c62=await _0x10e466(_0x4cc3a3);return!_0x140c62[_0x3959bf(0xee)]?_0x3cab8e[_0x3959bf(0xdd)]=_0x140c62['data']:(_0x5e70f9[_0x3959bf(0xfa)](_0x3959bf(0xfb)+_0x338218[_0x3959bf(0xa9)]+'\x27:\x20'+_0x140c62['error']),_0x1edf46=![]),_0x3cab8e['allValid']=_0x1edf46,_0x3cab8e;}if(_0x18b3a3[_0x3959bf(0xe1)]){const _0x3ec3d6=findBehaviorByName(_0x1f741a,_0x18b3a3[_0x3959bf(0xe1)]);if(!_0x3ec3d6)throw new SDKError(ErrorCode[_0x3959bf(0xc1)],_0x3959bf(0xf7)+_0x18b3a3[_0x3959bf(0xe1)]+_0x3959bf(0x109));const _0xb1286c=_0x18b3a3[_0x3959bf(0xb0)]||DEFAULT_TIME_RANGE;_0x2720e5(_0x3959bf(0xcf)+_0x3ec3d6[_0x3959bf(0xa9)]+'\x20('+_0xb1286c+')');const _0x320e44=generateBehaviorSampleSQL(_0x1f741a,_0x3ec3d6,DEFAULT_SAMPLE_LIMIT,_0xb1286c),_0x12e576=await _0x10e466(_0x320e44);return!_0x12e576[_0x3959bf(0xee)]?_0x3cab8e['sampleData']=_0x12e576[_0x3959bf(0xd7)]:(_0x5e70f9[_0x3959bf(0xfa)](_0x3959bf(0xf7)+_0x3ec3d6['name']+'\x27:\x20'+_0x12e576[_0x3959bf(0xee)]),_0x1edf46=![]),_0x3cab8e[_0x3959bf(0xdf)]=_0x1edf46,_0x3cab8e;}if(_0x18b3a3[_0x3959bf(0x107)]){_0x2720e5(_0x3959bf(0xd6));const _0xcc0400=generateEnrichedSQL(_0x1f741a,DEFAULT_SAMPLE_LIMIT),_0x4132e9=await _0x10e466(_0xcc0400);return!_0x4132e9[_0x3959bf(0xee)]?_0x3cab8e[_0x3959bf(0xdd)]=_0x4132e9[_0x3959bf(0xd7)]:(_0x5e70f9[_0x3959bf(0xfa)]('Enriched\x20query:\x20'+_0x4132e9[_0x3959bf(0xee)]),_0x1edf46=![]),_0x3cab8e[_0x3959bf(0xdf)]=_0x1edf46,_0x3cab8e;}return _0x3cab8e[_0x3959bf(0xdf)]=_0x1edf46,_0x3cab8e;}async[a76_0x2ecb70(0xe5)](_0x553cb8,_0x4c3977){const _0x455c66=a76_0x2ecb70;return await this[_0x455c66(0x9f)][_0x455c66(0xe5)](_0x553cb8,_0x4c3977);}async['createJourneySegment'](_0x735af2){const _0x12f8f9=a76_0x2ecb70;return await this['client'][_0x12f8f9(0xd9)](_0x735af2);}async[a76_0x2ecb70(0x9b)](_0x293b9e,_0x557c43,_0x1813a2){const _0x58b28b=a76_0x2ecb70;return await this['client'][_0x58b28b(0xa3)](_0x293b9e,_0x557c43,_0x1813a2);}async[a76_0x2ecb70(0xad)](_0x3ae940){return await this['client']['deleteSegment'](_0x3ae940);}async[a76_0x2ecb70(0xe7)](_0x5008fa,_0x598619){const _0x7f52de=a76_0x2ecb70,_0x333313=await this['resolveParentIdOrName'](_0x5008fa);return await this['client'][_0x7f52de(0xb4)](_0x333313,_0x598619);}async[a76_0x2ecb70(0x8b)](_0x564a21){const _0x37b464=a76_0x2ecb70;if(/^\d+$/[_0x37b464(0x98)](_0x564a21))return _0x564a21;return await this[_0x37b464(0xc4)](_0x564a21);}async['detectResourceType'](_0x7c6169,_0x4673bc){const _0x166d2d=a76_0x2ecb70,[_0x171a3c,_0x2b3322]=await Promise[_0x166d2d(0xc5)]([this['resolveFolderId'](_0x7c6169,_0x4673bc)[_0x166d2d(0xeb)](()=>!![])['catch'](()=>![]),this[_0x166d2d(0x93)](_0x7c6169,_0x4673bc)[_0x166d2d(0xeb)](()=>!![])['catch'](()=>![])]);if(_0x171a3c&&_0x2b3322)return _0x166d2d(0x91);else{if(_0x171a3c)return _0x166d2d(0xa2);else{if(_0x2b3322)return _0x166d2d(0x8a);}}throw new SDKError(ErrorCode[_0x166d2d(0xc1)],_0x166d2d(0xbf)+_0x4673bc+'\x27\x20not\x20found\x20in\x20parent\x20segment');}async[a76_0x2ecb70(0xdb)](_0x47f17f,_0x38b98e,_0x23f5c9){const _0x472869=a76_0x2ecb70,[_0x50cdcc,_0x44715a]=await Promise['all']([this[_0x472869(0xf3)](_0x47f17f),this[_0x472869(0x105)](_0x47f17f)]),_0x1fefec=_0x23f5c9?_0x50cdcc[_0x472869(0x95)](_0x3d3655=>_0x3d3655[_0x472869(0xd4)]===_0x23f5c9):_0x50cdcc[_0x472869(0x95)](_0x2099e3=>!_0x2099e3['parentFolderId']),_0x5b9549=_0x23f5c9?_0x44715a[_0x472869(0x95)](_0x400b42=>_0x400b42[_0x472869(0xda)]===_0x23f5c9):_0x44715a[_0x472869(0x95)](_0xfaccb6=>!_0xfaccb6[_0x472869(0xda)]),_0x3441bb=_0x1fefec[_0x472869(0x92)](_0x2bb2dd=>_0x2bb2dd[_0x472869(0xa9)]===_0x38b98e),_0x92cac5=_0x5b9549[_0x472869(0x92)](_0x179f94=>_0x179f94['name']===_0x38b98e);if(_0x3441bb&&_0x92cac5)return'ambiguous';else{if(_0x3441bb)return _0x472869(0xa2);else{if(_0x92cac5)return _0x472869(0x8a);}}throw new SDKError(ErrorCode[_0x472869(0xc1)],_0x472869(0xbf)+_0x38b98e+_0x472869(0xaa)+(_0x23f5c9?_0x472869(0xa2):'parent\x20segment'));}async[a76_0x2ecb70(0x88)](_0x59ba00){const _0xb0ec9c=a76_0x2ecb70;if(_0x59ba00[_0xb0ec9c(0x99)]===0x0)throw new SDKError(ErrorCode[_0xb0ec9c(0x8d)],_0xb0ec9c(0x100));const _0x4ec4ca=_0x59ba00[0x0],_0x478cf2=await this['resolveParentId'](_0x4ec4ca);if(_0x59ba00['length']===0x1)return{'parentId':_0x478cf2,'parentName':_0x4ec4ca,'type':_0xb0ec9c(0x87),'fullPath':_0x4ec4ca};const _0x1866fe=await this[_0xb0ec9c(0x10f)](_0x478cf2),_0x474b93=_0x1866fe[_0xb0ec9c(0x8c)],_0x101e99=[];let _0x2eebcf=_0x474b93;for(let _0x149bc8=0x1;_0x149bc8<_0x59ba00[_0xb0ec9c(0x99)]-0x1;_0x149bc8++){const _0x5941bc=_0x59ba00[_0x149bc8],_0x4ab6d6=await this[_0xb0ec9c(0xf3)](_0x478cf2),_0x3c6132=_0x2eebcf?_0x4ab6d6[_0xb0ec9c(0x101)](_0x56404c=>_0x56404c['name']===_0x5941bc&&_0x56404c[_0xb0ec9c(0xd4)]===_0x2eebcf):_0x4ab6d6[_0xb0ec9c(0x101)](_0x385247=>_0x385247['name']===_0x5941bc&&!_0x385247[_0xb0ec9c(0xd4)]);if(!_0x3c6132)throw new SDKError(ErrorCode[_0xb0ec9c(0xc1)],'Folder\x20\x27'+_0x5941bc+_0xb0ec9c(0x9c));_0x101e99[_0xb0ec9c(0xfa)](_0x5941bc),_0x2eebcf=_0x3c6132['id'];}const _0x3145fd=_0x59ba00[_0x59ba00[_0xb0ec9c(0x99)]-0x1],_0x723a8e=await this[_0xb0ec9c(0xdb)](_0x478cf2,_0x3145fd,_0x2eebcf);if(_0x723a8e==='ambiguous'||_0x723a8e===_0xb0ec9c(0xa2)){const _0xdaff77=await this[_0xb0ec9c(0xf3)](_0x478cf2),_0x440f11=_0x2eebcf?_0xdaff77[_0xb0ec9c(0x101)](_0x5a1d4d=>_0x5a1d4d[_0xb0ec9c(0xa9)]===_0x3145fd&&_0x5a1d4d[_0xb0ec9c(0xd4)]===_0x2eebcf):_0xdaff77['find'](_0x1a3352=>_0x1a3352[_0xb0ec9c(0xa9)]===_0x3145fd&&!_0x1a3352[_0xb0ec9c(0xd4)]);if(!_0x440f11)throw new SDKError(ErrorCode[_0xb0ec9c(0xc1)],_0xb0ec9c(0x89)+_0x3145fd+'\x27\x20not\x20found');return _0x101e99[_0xb0ec9c(0xfa)](_0x3145fd),{'parentId':_0x478cf2,'parentName':_0x4ec4ca,'folderId':_0x440f11['id'],'folderPath':_0x101e99,'type':'folder','fullPath':_0x59ba00[_0xb0ec9c(0x9e)]('/')};}else{const _0x85228c=await this[_0xb0ec9c(0x105)](_0x478cf2),_0x202e5a=_0x2eebcf?_0x85228c['find'](_0x4cd890=>_0x4cd890[_0xb0ec9c(0xa9)]===_0x3145fd&&_0x4cd890[_0xb0ec9c(0xda)]===_0x2eebcf):_0x85228c[_0xb0ec9c(0x101)](_0x36a8f8=>_0x36a8f8[_0xb0ec9c(0xa9)]===_0x3145fd&&!_0x36a8f8[_0xb0ec9c(0xda)]);if(!_0x202e5a)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xb0ec9c(0xa8)+_0x3145fd+_0xb0ec9c(0x109));return{'parentId':_0x478cf2,'parentName':_0x4ec4ca,'folderId':_0x2eebcf,'folderPath':_0x101e99[_0xb0ec9c(0x99)]>0x0?_0x101e99:undefined,'segmentId':_0x202e5a['id'],'segmentName':_0x3145fd,'type':'segment','fullPath':_0x59ba00[_0xb0ec9c(0x9e)]('/')};}}async['resolvePathToResource'](_0x15a04d){const _0x2952ed=a76_0x2ecb70,_0x36164=parsePath(_0x15a04d);if(!_0x36164[_0x2952ed(0x102)])throw new SDKError(ErrorCode[_0x2952ed(0x8d)],_0x2952ed(0xe6));return await this[_0x2952ed(0x88)](_0x36164[_0x2952ed(0xf5)]);}async[a76_0x2ecb70(0xb1)](_0x5732aa,_0x2e99c6){const _0x1fe6ad=a76_0x2ecb70,[_0x153f02,_0x32911f]=await Promise[_0x1fe6ad(0xc5)]([this[_0x1fe6ad(0xf3)](_0x5732aa),this[_0x1fe6ad(0x105)](_0x5732aa)]);if(_0x2e99c6){const _0x33c2c2=_0x153f02[_0x1fe6ad(0x95)](_0x28c87c=>_0x28c87c[_0x1fe6ad(0xd4)]===_0x2e99c6),_0x57fdd1=_0x32911f[_0x1fe6ad(0x95)](_0x4ddc73=>_0x4ddc73[_0x1fe6ad(0xda)]===_0x2e99c6);return{'folders':_0x33c2c2,'segments':_0x57fdd1};}const _0xf55d9f=await this['getParentFull'](_0x5732aa),_0x1fdc3e=_0xf55d9f['rootFolderId'];if(_0x1fdc3e){const _0x23da04=_0x153f02[_0x1fe6ad(0x95)](_0x5957ce=>_0x5957ce[_0x1fe6ad(0xd4)]===_0x1fdc3e),_0x422d5b=_0x32911f[_0x1fe6ad(0x95)](_0xb3ed1e=>_0xb3ed1e[_0x1fe6ad(0xda)]===_0x1fdc3e);return{'folders':_0x23da04,'segments':_0x422d5b};}const _0x188898=_0x153f02[_0x1fe6ad(0x95)](_0x4656ee=>!_0x4656ee['parentFolderId']),_0x4e2d6c=_0x32911f[_0x1fe6ad(0x95)](_0x575e62=>!_0x575e62['segmentFolderId']);return{'folders':_0x188898,'segments':_0x4e2d6c};}async[a76_0x2ecb70(0x103)](_0x1a61ef,_0x5a516b,_0x1ca933=0x0,_0x24d2f4=0xa){const _0x25cec3=a76_0x2ecb70;if(_0x1ca933>=_0x24d2f4)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x25cec3(0x10e)+_0x24d2f4+_0x25cec3(0x8e));const {folders:_0x4a3d20,segments:_0x290660}=await this[_0x25cec3(0xb1)](_0x1a61ef,_0x5a516b),_0xd3c14b=[];for(const _0x3c3762 of _0x4a3d20){const _0x5c3ad2=await this[_0x25cec3(0x103)](_0x1a61ef,_0x3c3762['id'],_0x1ca933+0x1,_0x24d2f4);_0xd3c14b[_0x25cec3(0xfa)]({'type':_0x25cec3(0xa2),'id':_0x3c3762['id'],'name':_0x3c3762[_0x25cec3(0xa9)],'children':_0x5c3ad2[_0x25cec3(0x99)]>0x0?_0x5c3ad2:undefined,'metadata':{'description':_0x3c3762[_0x25cec3(0x82)]||undefined,'folderCount':_0x5c3ad2[_0x25cec3(0x95)](_0x3e7a46=>_0x3e7a46[_0x25cec3(0xd5)]===_0x25cec3(0xa2))[_0x25cec3(0x99)],'segmentCount':_0x5c3ad2[_0x25cec3(0x95)](_0x3509ab=>_0x3509ab[_0x25cec3(0xd5)]===_0x25cec3(0x8a))['length'],'createdAt':_0x3c3762[_0x25cec3(0x106)],'updatedAt':_0x3c3762[_0x25cec3(0xba)]}});}for(const _0x5ae044 of _0x290660){_0xd3c14b[_0x25cec3(0xfa)]({'type':'segment','id':_0x5ae044['id'],'name':_0x5ae044[_0x25cec3(0xa9)],'population':_0x5ae044['population'],'metadata':{'description':_0x5ae044[_0x25cec3(0x82)],'createdAt':_0x5ae044[_0x25cec3(0x106)],'updatedAt':_0x5ae044[_0x25cec3(0xba)]}});}return _0xd3c14b;}}
1
+ const a76_0x143834=a76_0x2151;(function(_0x1317dd,_0x8cd9b9){const _0x49f00f=a76_0x2151,_0x4b7b31=_0x1317dd();while(!![]){try{const _0x484536=parseInt(_0x49f00f(0x217))/0x1+parseInt(_0x49f00f(0x21f))/0x2*(parseInt(_0x49f00f(0x201))/0x3)+-parseInt(_0x49f00f(0x20c))/0x4*(parseInt(_0x49f00f(0x266))/0x5)+-parseInt(_0x49f00f(0x21c))/0x6+-parseInt(_0x49f00f(0x255))/0x7*(-parseInt(_0x49f00f(0x215))/0x8)+parseInt(_0x49f00f(0x242))/0x9+-parseInt(_0x49f00f(0x264))/0xa;if(_0x484536===_0x8cd9b9)break;else _0x4b7b31['push'](_0x4b7b31['shift']());}catch(_0x1fa176){_0x4b7b31['push'](_0x4b7b31['shift']());}}}(a76_0x5554,0xa0b95));function a76_0x5554(){const _0x4b3cf9=['Validating\x20behavior:\x20','getSegmentSQL','resolvePathToResource','some','SEGMENT_NOT_FOUND','client','rowCount','table','Validating\x20all\x20attributes\x20in\x20parallel...','5247792LBYveS','\x27:\x20','master','parent_key','executeQuery','resolveFolderId','schemaValid','Child\x20segment\x20not\x20found:\x20','groupingName','schema','resolveParentId','customerPercent',')\x20exceeded','validateParentYaml','INVALID_ARGUMENT','getFolder','description','then','find','883547AEuEom','Master\x20table:\x20','behavior','Validating\x20attribute:\x20','getParentSegmentFull','createdAt','message','getParentFull','updateParent','detectResourceType','ambiguous','Behavior\x20\x27','createParent','listFolders','Parent\x20segment\x20not\x20found:\x20','5854290lQpOzS','length','5LfSheG','segmentFolderId','Calculating\x20statistics\x20for:\x20','customersWithEvents','getParent','isArray','createSegmentFolder','deleteSegment','previewParentYaml','totalEvents','createActivation','coveragePercent','getActivation','data','listActivations','Resource\x20\x27','updatedAt','segment','resolveParentIdOrName','name','attribute','string','enriched','attributes','map','listParentSegments','listParents','onProgress','Fetching\x20sample\x20data\x20for:\x20','database','type','listSegmentFolders','source','pullParentYaml','test','traversePath','logger','behaviors','Segment\x20\x27','catch','join','parentColumn','384ACraUQ','runParent','trinoClient','Counting\x20master\x20table\x20rows...','folder','parentFolderId','Enriched\x20query:\x20','all','\x20in\x20parent\x20','filter','Maximum\x20recursion\x20depth\x20(','2649676JnHAEg','Fetching\x20enriched\x20master\x20data...','createSegment','getParentSegmentSQL','resolveSegmentId','parent\x20segment','listRecursive','Path\x20must\x20be\x20absolute\x20(cannot\x20start\x20with\x20.\x20or\x20..)','getSegmentFolder','40zqZfcZ','parentTableName','788475DCTAQe','sampleData','updateSegmentById','Fetching\x20master\x20sample\x20data...','population','5268378OARbva','schemaError','Folder\x20not\x20found:\x20','12212kSKzqP','Calculating\x20coverage\x20for:\x20','\x27\x20not\x20found\x20in\x20','Attribute\x20\x27','runParentSegment','Validating\x20all\x20attributes\x20and\x20behaviors\x20in\x20parallel...','error','Folder\x20\x27','updateParentSegment','createJourneySegment','parent','detectResourceTypeInFolder','\x27\x20not\x20found\x20in\x20path','getAudienceBehaviors','child_key','push','pushParentYaml','allValid','listUnified','listSegments','row_count','getSegment','customers_with_events','\x27\x20not\x20found','Validating\x20master\x20table:\x20','getParentSegment'];a76_0x5554=function(){return _0x4b3cf9;};return a76_0x5554();}import{CDPApiClient}from'../client/cdp-api-client.js';import{TrinoApiClient}from'../client/trino-api-client.js';import{SDKError,ErrorCode}from'./errors.js';function a76_0x2151(_0x293c15,_0x123a01){_0x293c15=_0x293c15-0x1ee;const _0x555433=a76_0x5554();let _0x2151f4=_0x555433[_0x293c15];return _0x2151f4;}import{parsePath}from'../utils/segment-path-parser.js';import{apiToYaml,yamlToApi,toYamlString,parseYamlString}from'./segment/parent-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{DEFAULT_TIME_RANGE,DEFAULT_SAMPLE_LIMIT,generateSchemaValidationSQL,generateMasterCountSQL,generateMasterSampleSQL,generateAttributeCoverageSQL,generateBehaviorStatsSQL,generateAttributeSampleSQL,generateBehaviorSampleSQL,generateEnrichedSQL,generateAttributeSchemaSQL,generateBehaviorSchemaSQL,findAttributeByName,findBehaviorByName,getAttributeColumns,getBehaviorColumns}from'./segment/parent-segment-preview.js';export class SegmentSDK{[a76_0x143834(0x23e)];['trinoClient'];constructor(_0x64b71e){const _0xf95951=a76_0x143834;this[_0xf95951(0x23e)]=new CDPApiClient(_0x64b71e,_0x64b71e['logger']),this[_0xf95951(0x203)]=new TrinoApiClient(_0x64b71e,_0x64b71e[_0xf95951(0x1fb)]);}async[a76_0x143834(0x1f1)](){const _0x14f66f=a76_0x143834;return await this[_0x14f66f(0x23e)][_0x14f66f(0x1f0)]();}async[a76_0x143834(0x26a)](_0x105c5b){const _0x3c2a04=a76_0x143834;return await this[_0x3c2a04(0x23e)][_0x3c2a04(0x238)](_0x105c5b);}async[a76_0x143834(0x232)](_0x98cdf3){const _0x27e566=a76_0x143834;return await this[_0x27e566(0x23e)]['listSegments'](_0x98cdf3);}async[a76_0x143834(0x234)](_0x20c877,_0x4ee88a){return await this['client']['getSegment'](_0x20c877,_0x4ee88a);}async[a76_0x143834(0x262)](_0xe11d60){const _0x387c0f=a76_0x143834;return await this[_0x387c0f(0x23e)][_0x387c0f(0x1f6)](_0xe11d60);}async[a76_0x143834(0x251)](_0x4f3d85){const _0x244be4=a76_0x143834;return await this[_0x244be4(0x23e)][_0x244be4(0x214)](_0x4f3d85);}async[a76_0x143834(0x274)](_0x209d2a,_0x55c86d){const _0x38f90b=a76_0x143834;return await this['client'][_0x38f90b(0x274)](_0x209d2a,_0x55c86d);}async[a76_0x143834(0x272)](_0x1c0788,_0x51dd0f,_0x55b842){return await this['client']['getActivation'](_0x1c0788,_0x51dd0f,_0x55b842);}async[a76_0x143834(0x270)](_0xf2063d,_0x23c9f4,_0x18620f){const _0x2fb0a8=a76_0x143834;return await this['client'][_0x2fb0a8(0x270)](_0xf2063d,_0x23c9f4,_0x18620f);}async['updateActivation'](_0x2ab118,_0x146f44,_0x80208d,_0x7c10a0){const _0x552aea=a76_0x143834;return await this[_0x552aea(0x23e)]['updateActivation'](_0x2ab118,_0x146f44,_0x80208d,_0x7c10a0);}async['deleteActivation'](_0x4d93b6,_0x5943fd,_0x578d96){const _0x2ce831=a76_0x143834;return await this[_0x2ce831(0x23e)]['deleteActivation'](_0x4d93b6,_0x5943fd,_0x578d96);}async['getParentSQL'](_0x2958da){const _0x29d701=a76_0x143834;return await this[_0x29d701(0x23e)][_0x29d701(0x20f)](_0x2958da);}async[a76_0x143834(0x23a)](_0x22f829,_0xccbf88){const _0x121c52=a76_0x143834;return await this[_0x121c52(0x23e)][_0x121c52(0x23a)](_0x22f829,_0xccbf88);}async[a76_0x143834(0x24c)](_0x682100){const _0x464e68=a76_0x143834,_0x41b33f=await this['listParents'](),_0x52f016=_0x41b33f['find'](_0x19738a=>_0x19738a[_0x464e68(0x1ee)][_0x464e68(0x279)]===_0x682100);if(!_0x52f016)throw new SDKError(ErrorCode[_0x464e68(0x23d)],_0x464e68(0x263)+_0x682100);return _0x52f016['id'];}async[a76_0x143834(0x202)](_0x21ffb3){const _0x427181=a76_0x143834;let _0x5db8c7=_0x21ffb3;return!/^\d+$/[_0x427181(0x1f9)](_0x21ffb3)&&(_0x5db8c7=await this['resolveParentId'](_0x21ffb3)),await this[_0x427181(0x23e)][_0x427181(0x223)](_0x5db8c7);}async[a76_0x143834(0x210)](_0x515b8e,_0x578f19){const _0x53f2a7=a76_0x143834,_0x33ec56=await this[_0x53f2a7(0x232)](_0x515b8e),_0x85002e=_0x33ec56['find'](_0x6e921a=>_0x6e921a['name']===_0x578f19);if(!_0x85002e)throw new SDKError(ErrorCode[_0x53f2a7(0x23d)],_0x53f2a7(0x249)+_0x578f19+'\x20in\x20parent\x20'+_0x515b8e);return _0x85002e['id'];}async[a76_0x143834(0x247)](_0x1bcd99,_0x3fedc1){const _0x3fdf91=a76_0x143834,_0x4f6fd9=await this[_0x3fdf91(0x262)](_0x1bcd99),_0x45285d=_0x4f6fd9['find'](_0x44ada6=>_0x44ada6['name']===_0x3fedc1);if(!_0x45285d)throw new SDKError(ErrorCode[_0x3fdf91(0x23d)],_0x3fdf91(0x21e)+_0x3fedc1+_0x3fdf91(0x209)+_0x1bcd99);return _0x45285d['id'];}async['listFields'](_0x462b05){const _0x2ace42=a76_0x143834,_0x164529=await this['resolveParentIdOrName'](_0x462b05),[_0x21562e,_0x2386cb]=await Promise[_0x2ace42(0x208)]([this[_0x2ace42(0x23e)]['getAudienceAttributes'](_0x164529),this[_0x2ace42(0x23e)][_0x2ace42(0x22c)](_0x164529)]),_0x5f3061=[];for(const _0x47ced0 of _0x21562e){_0x5f3061[_0x2ace42(0x22e)]({'name':_0x47ced0[_0x2ace42(0x279)],'type':_0x47ced0[_0x2ace42(0x1f5)],'source':_0x2ace42(0x27a),'parentDatabaseName':_0x47ced0['parentDatabaseName'],'parentTableName':_0x47ced0[_0x2ace42(0x216)],'parentColumn':_0x47ced0[_0x2ace42(0x200)],'groupingName':_0x47ced0[_0x2ace42(0x24a)]??undefined});}for(const _0x1d9098 of _0x2386cb){const _0x54fb49=_0x1d9098[_0x2ace42(0x279)];if(_0x1d9098[_0x2ace42(0x24b)]&&Array[_0x2ace42(0x26b)](_0x1d9098[_0x2ace42(0x24b)]))for(const _0x5dd1ec of _0x1d9098[_0x2ace42(0x24b)]){_0x5dd1ec[_0x2ace42(0x279)]&&_0x5dd1ec[_0x2ace42(0x1f5)]&&_0x5f3061[_0x2ace42(0x22e)]({'name':_0x54fb49+'.'+_0x5dd1ec['name'],'type':_0x5dd1ec[_0x2ace42(0x1f5)],'source':'behavior','behaviorName':_0x54fb49,'parentDatabaseName':_0x1d9098['parentDatabaseName'],'parentTableName':_0x1d9098[_0x2ace42(0x216)],'parentColumn':_0x5dd1ec[_0x2ace42(0x200)]});}}return _0x5f3061;}async[a76_0x143834(0x261)](_0x49e70f){const _0x29c282=a76_0x143834;return await this[_0x29c282(0x23e)]['createParentSegment'](_0x49e70f);}async[a76_0x143834(0x25d)](_0x24fffb,_0x2b98e6){const _0x2bba18=a76_0x143834,_0x15cb0b=await this[_0x2bba18(0x278)](_0x24fffb);return await this[_0x2bba18(0x23e)][_0x2bba18(0x227)](_0x15cb0b,_0x2b98e6);}async[a76_0x143834(0x25c)](_0x3973b0){const _0x3ab0c1=a76_0x143834,_0x33b155=await this[_0x3ab0c1(0x278)](_0x3973b0);return await this[_0x3ab0c1(0x23e)][_0x3ab0c1(0x259)](_0x33b155);}async[a76_0x143834(0x1f8)](_0x554a74){const _0x3f573b=a76_0x143834,_0x5e7daf=await this[_0x3f573b(0x25c)](_0x554a74),_0x393081=apiToYaml(_0x5e7daf);return toYamlString(_0x393081);}async[a76_0x143834(0x22f)](_0x53ad62){const _0x33d389=a76_0x143834,_0x4fe4a1=typeof _0x53ad62==='string'?parseYamlString(_0x53ad62):_0x53ad62,_0x442277=yamlToApi(_0x4fe4a1);let _0x2537cd=null,_0x57e1de='';try{_0x2537cd=await this[_0x33d389(0x25c)](_0x4fe4a1[_0x33d389(0x279)]);const _0x48305b=apiToYaml(_0x2537cd);_0x57e1de=toYamlString(_0x48305b);}catch{}const _0x5aaefc=toYamlString(_0x4fe4a1),_0x2dc0c2=generateDiff(_0x57e1de,_0x5aaefc),_0x32be70=formatDiffWithColors(_0x2dc0c2),_0x1581fe=_0x2537cd===null,_0x2db2d9=hasChanges(_0x2dc0c2),_0x135b07={'isNew':_0x1581fe,'id':_0x2537cd?.['id']||'','name':_0x4fe4a1['name'],'diff':_0x2dc0c2,'diffFormatted':_0x32be70,'hasChanges':_0x2db2d9},_0x13ba8f=async()=>{const _0x5b15bb=_0x33d389;return _0x1581fe?await this['createParent'](_0x442277):await this[_0x5b15bb(0x25d)](_0x2537cd['id'],_0x442277);};return{..._0x135b07,'apply':_0x13ba8f};}async[a76_0x143834(0x24f)](_0x5ea6d7,_0x5ee752={}){const _0x5a5a5e=a76_0x143834,_0x49b01f=typeof _0x5ea6d7===_0x5a5a5e(0x27b)?parseYamlString(_0x5ea6d7):_0x5ea6d7,_0x57d0b8=[];let _0x5c41d1=!![];const _0x564026=_0x171fa1=>_0x5ee752[_0x5a5a5e(0x1f2)]?.(_0x171fa1),_0x4a1b9f={'name':_0x49b01f['name'],'master':{'database':_0x49b01f['master'][_0x5a5a5e(0x1f4)],'table':_0x49b01f['master']['table'],'schemaValid':![]},'attributes':[],'behaviors':[],'errors':_0x57d0b8,'allValid':!![]},_0x15b500=async _0x2bae36=>{const _0x4e393b=_0x5a5a5e;try{const _0x3bd6d9=await this[_0x4e393b(0x203)][_0x4e393b(0x246)](_0x2bae36);return{'data':_0x3bd6d9[_0x4e393b(0x273)]};}catch(_0x4c43e7){const _0x360fea=_0x4c43e7 instanceof Error?_0x4c43e7[_0x4e393b(0x25b)]:String(_0x4c43e7);return{'data':[],'error':_0x360fea};}};_0x564026(_0x5a5a5e(0x237)+_0x49b01f['master'][_0x5a5a5e(0x1f4)]+'.'+_0x49b01f['master'][_0x5a5a5e(0x240)]);const _0x38b905=generateSchemaValidationSQL(_0x49b01f[_0x5a5a5e(0x244)][_0x5a5a5e(0x1f4)],_0x49b01f[_0x5a5a5e(0x244)]['table']),_0x130302=await _0x15b500(_0x38b905);if(_0x130302[_0x5a5a5e(0x225)])_0x4a1b9f[_0x5a5a5e(0x244)][_0x5a5a5e(0x248)]=![],_0x4a1b9f[_0x5a5a5e(0x244)][_0x5a5a5e(0x21d)]=_0x130302[_0x5a5a5e(0x225)],_0x57d0b8[_0x5a5a5e(0x22e)](_0x5a5a5e(0x256)+_0x130302['error']),_0x5c41d1=![];else{_0x4a1b9f[_0x5a5a5e(0x244)][_0x5a5a5e(0x248)]=!![],_0x564026(_0x5a5a5e(0x204));const _0x18d6bf=await _0x15b500(generateMasterCountSQL(_0x49b01f));!_0x18d6bf[_0x5a5a5e(0x225)]&&_0x18d6bf[_0x5a5a5e(0x273)][_0x5a5a5e(0x265)]>0x0&&(_0x4a1b9f['master'][_0x5a5a5e(0x23f)]=_0x18d6bf[_0x5a5a5e(0x273)][0x0][_0x5a5a5e(0x233)]);}if(_0x5ee752[_0x5a5a5e(0x244)])return _0x4a1b9f[_0x5a5a5e(0x230)]=_0x5c41d1,_0x4a1b9f;const _0x51dd4e=async _0x492a05=>{const _0x95be04=_0x5a5a5e,_0x35f136={'name':_0x492a05[_0x95be04(0x279)],'database':_0x492a05[_0x95be04(0x1f7)][_0x95be04(0x1f4)],'table':_0x492a05[_0x95be04(0x1f7)]['table'],'joinKey':_0x492a05[_0x95be04(0x1ff)][_0x95be04(0x22d)],'foreignKey':_0x492a05['join']['parent_key'],'columns':getAttributeColumns(_0x492a05),'schemaValid':![]};_0x564026(_0x95be04(0x258)+_0x492a05['name']);const _0x1b3840=await _0x15b500(generateAttributeSchemaSQL(_0x49b01f,_0x492a05));if(_0x1b3840[_0x95be04(0x225)])_0x35f136[_0x95be04(0x21d)]=_0x1b3840[_0x95be04(0x225)];else{_0x35f136[_0x95be04(0x248)]=!![],_0x564026(_0x95be04(0x220)+_0x492a05[_0x95be04(0x279)]);const _0x456c1d=await _0x15b500(generateAttributeCoverageSQL(_0x49b01f,_0x492a05));!_0x456c1d[_0x95be04(0x225)]&&_0x456c1d['data'][_0x95be04(0x265)]>0x0&&(_0x35f136['matchedCount']=_0x456c1d[_0x95be04(0x273)][0x0]['matched_count'],_0x4a1b9f[_0x95be04(0x244)]['rowCount']&&_0x4a1b9f['master'][_0x95be04(0x23f)]>0x0&&(_0x35f136[_0x95be04(0x271)]=_0x35f136['matchedCount']/_0x4a1b9f[_0x95be04(0x244)][_0x95be04(0x23f)]*0x64));}return _0x35f136;},_0x31c065=async(_0x135498,_0x319406)=>{const _0x5a3f33=_0x5a5a5e,_0x197e72={'name':_0x135498[_0x5a3f33(0x279)],'database':_0x135498['source'][_0x5a3f33(0x1f4)],'table':_0x135498[_0x5a3f33(0x1f7)][_0x5a3f33(0x240)],'joinKey':_0x135498[_0x5a3f33(0x1ff)]['child_key'],'foreignKey':_0x135498[_0x5a3f33(0x1ff)][_0x5a3f33(0x245)],'columns':getBehaviorColumns(_0x135498),'schemaValid':![]};_0x564026(_0x5a3f33(0x239)+_0x135498['name']);const _0x4fcb2f=await _0x15b500(generateBehaviorSchemaSQL(_0x49b01f,_0x135498));if(_0x4fcb2f['error'])_0x197e72[_0x5a3f33(0x21d)]=_0x4fcb2f[_0x5a3f33(0x225)];else{_0x197e72[_0x5a3f33(0x248)]=!![],_0x564026(_0x5a3f33(0x268)+_0x135498[_0x5a3f33(0x279)]+'\x20('+_0x319406+')');const _0x4ea1b9=await _0x15b500(generateBehaviorStatsSQL(_0x49b01f,_0x135498,_0x319406));!_0x4ea1b9[_0x5a3f33(0x225)]&&_0x4ea1b9[_0x5a3f33(0x273)][_0x5a3f33(0x265)]>0x0&&(_0x197e72[_0x5a3f33(0x269)]=_0x4ea1b9['data'][0x0][_0x5a3f33(0x235)],_0x197e72[_0x5a3f33(0x26f)]=_0x4ea1b9[_0x5a3f33(0x273)][0x0]['total_events'],_0x4a1b9f[_0x5a3f33(0x244)]['rowCount']&&_0x4a1b9f['master']['rowCount']>0x0&&(_0x197e72[_0x5a3f33(0x24d)]=_0x197e72[_0x5a3f33(0x269)]/_0x4a1b9f[_0x5a3f33(0x244)]['rowCount']*0x64));}return _0x197e72;},_0x4b8ae=(_0x5b3d4e,_0x287bd1)=>{const _0x404ac8=_0x5a5a5e;_0x4a1b9f[_0x404ac8(0x1ee)]=_0x5b3d4e,_0x4a1b9f['behaviors']=_0x287bd1;for(const _0xba6938 of _0x5b3d4e){!_0xba6938[_0x404ac8(0x248)]&&(_0x57d0b8['push'](_0x404ac8(0x222)+_0xba6938[_0x404ac8(0x279)]+_0x404ac8(0x243)+_0xba6938[_0x404ac8(0x21d)]),_0x5c41d1=![]);}for(const _0xe47da8 of _0x287bd1){!_0xe47da8[_0x404ac8(0x248)]&&(_0x57d0b8['push'](_0x404ac8(0x260)+_0xe47da8[_0x404ac8(0x279)]+_0x404ac8(0x243)+_0xe47da8[_0x404ac8(0x21d)]),_0x5c41d1=![]);}},_0x2a5fbc=_0x5ee752['interval']||DEFAULT_TIME_RANGE;if(typeof _0x5ee752['attribute']==='string'){const _0x4b160f=findAttributeByName(_0x49b01f,_0x5ee752['attribute']);if(!_0x4b160f)throw new SDKError(ErrorCode[_0x5a5a5e(0x23d)],_0x5a5a5e(0x222)+_0x5ee752[_0x5a5a5e(0x27a)]+_0x5a5a5e(0x236));const _0x4d4db6=await _0x51dd4e(_0x4b160f);return _0x4b8ae([_0x4d4db6],[]),_0x4a1b9f[_0x5a5a5e(0x230)]=_0x5c41d1,_0x4a1b9f;}if(_0x5ee752[_0x5a5a5e(0x27a)]===!![]){_0x564026(_0x5a5a5e(0x241));const _0x1d37d8=await Promise['all']((_0x49b01f[_0x5a5a5e(0x1ee)]||[])['map'](_0x5078c9=>_0x51dd4e(_0x5078c9)));return _0x4b8ae(_0x1d37d8,[]),_0x4a1b9f[_0x5a5a5e(0x230)]=_0x5c41d1,_0x4a1b9f;}if(typeof _0x5ee752[_0x5a5a5e(0x257)]===_0x5a5a5e(0x27b)){const _0x44ade1=findBehaviorByName(_0x49b01f,_0x5ee752[_0x5a5a5e(0x257)]);if(!_0x44ade1)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5a5a5e(0x260)+_0x5ee752[_0x5a5a5e(0x257)]+_0x5a5a5e(0x236));const _0x138604=await _0x31c065(_0x44ade1,_0x2a5fbc);return _0x4b8ae([],[_0x138604]),_0x4a1b9f[_0x5a5a5e(0x230)]=_0x5c41d1,_0x4a1b9f;}if(_0x5ee752[_0x5a5a5e(0x257)]===!![]){_0x564026('Validating\x20all\x20behaviors\x20in\x20parallel...');const _0x1f04be=await Promise[_0x5a5a5e(0x208)]((_0x49b01f[_0x5a5a5e(0x1fc)]||[])[_0x5a5a5e(0x1ef)](_0x3e7bc8=>_0x31c065(_0x3e7bc8,_0x2a5fbc)));return _0x4b8ae([],_0x1f04be),_0x4a1b9f['allValid']=_0x5c41d1,_0x4a1b9f;}if(_0x5ee752[_0x5a5a5e(0x27c)]){_0x564026(_0x5a5a5e(0x241));const _0x34ec96=await Promise[_0x5a5a5e(0x208)]((_0x49b01f[_0x5a5a5e(0x1ee)]||[])['map'](_0x3b0c61=>_0x51dd4e(_0x3b0c61)));return _0x4b8ae(_0x34ec96,[]),_0x4a1b9f[_0x5a5a5e(0x230)]=_0x5c41d1,_0x4a1b9f;}_0x564026(_0x5a5a5e(0x224));const [_0x271601,_0x315ec0]=await Promise[_0x5a5a5e(0x208)]([Promise[_0x5a5a5e(0x208)]((_0x49b01f[_0x5a5a5e(0x1ee)]||[])[_0x5a5a5e(0x1ef)](_0x4aecd7=>_0x51dd4e(_0x4aecd7))),Promise[_0x5a5a5e(0x208)]((_0x49b01f[_0x5a5a5e(0x1fc)]||[])[_0x5a5a5e(0x1ef)](_0xb10c1b=>_0x31c065(_0xb10c1b,_0x2a5fbc)))]);return _0x4b8ae(_0x271601,_0x315ec0),_0x4a1b9f[_0x5a5a5e(0x230)]=_0x5c41d1,_0x4a1b9f;}async[a76_0x143834(0x26e)](_0x5f1590,_0x3ae8bf={}){const _0x398188=a76_0x143834,_0x3afe78=typeof _0x5f1590===_0x398188(0x27b)?parseYamlString(_0x5f1590):_0x5f1590,_0x160f59=[];let _0x4298ba=!![];const _0x20df52=_0x18f3e6=>_0x3ae8bf[_0x398188(0x1f2)]?.(_0x18f3e6),_0x43601e={'name':_0x3afe78[_0x398188(0x279)],'master':{'database':_0x3afe78[_0x398188(0x244)][_0x398188(0x1f4)],'table':_0x3afe78['master'][_0x398188(0x240)],'schemaValid':!![]},'attributes':[],'behaviors':[],'errors':_0x160f59,'allValid':!![]},_0x218786=async _0x24470b=>{const _0x289642=_0x398188;try{const _0x5ac0cd=await this[_0x289642(0x203)][_0x289642(0x246)](_0x24470b);return{'data':_0x5ac0cd[_0x289642(0x273)]};}catch(_0x14422c){const _0x3f1d08=_0x14422c instanceof Error?_0x14422c[_0x289642(0x25b)]:String(_0x14422c);return{'data':[],'error':_0x3f1d08};}};if(_0x3ae8bf[_0x398188(0x244)]){_0x20df52(_0x398188(0x21a));const _0x5842f5=generateMasterSampleSQL(_0x3afe78,DEFAULT_SAMPLE_LIMIT),_0x18d6d3=await _0x218786(_0x5842f5);return!_0x18d6d3[_0x398188(0x225)]?_0x43601e[_0x398188(0x218)]=_0x18d6d3[_0x398188(0x273)]:(_0x160f59[_0x398188(0x22e)](_0x398188(0x256)+_0x18d6d3['error']),_0x4298ba=![]),_0x43601e[_0x398188(0x230)]=_0x4298ba,_0x43601e;}if(_0x3ae8bf['attribute']){const _0x63e83a=findAttributeByName(_0x3afe78,_0x3ae8bf[_0x398188(0x27a)]);if(!_0x63e83a)throw new SDKError(ErrorCode[_0x398188(0x23d)],'Attribute\x20\x27'+_0x3ae8bf['attribute']+'\x27\x20not\x20found');_0x20df52(_0x398188(0x1f3)+_0x63e83a[_0x398188(0x279)]);const _0x4fa441=generateAttributeSampleSQL(_0x3afe78,_0x63e83a,DEFAULT_SAMPLE_LIMIT),_0x54f53e=await _0x218786(_0x4fa441);return!_0x54f53e['error']?_0x43601e[_0x398188(0x218)]=_0x54f53e[_0x398188(0x273)]:(_0x160f59[_0x398188(0x22e)](_0x398188(0x222)+_0x63e83a[_0x398188(0x279)]+_0x398188(0x243)+_0x54f53e[_0x398188(0x225)]),_0x4298ba=![]),_0x43601e[_0x398188(0x230)]=_0x4298ba,_0x43601e;}if(_0x3ae8bf[_0x398188(0x257)]){const _0xf3a39c=findBehaviorByName(_0x3afe78,_0x3ae8bf[_0x398188(0x257)]);if(!_0xf3a39c)throw new SDKError(ErrorCode[_0x398188(0x23d)],_0x398188(0x260)+_0x3ae8bf[_0x398188(0x257)]+'\x27\x20not\x20found');const _0x3be64d=_0x3ae8bf['interval']||DEFAULT_TIME_RANGE;_0x20df52(_0x398188(0x1f3)+_0xf3a39c[_0x398188(0x279)]+'\x20('+_0x3be64d+')');const _0x317df1=generateBehaviorSampleSQL(_0x3afe78,_0xf3a39c,DEFAULT_SAMPLE_LIMIT,_0x3be64d),_0x4e5229=await _0x218786(_0x317df1);return!_0x4e5229[_0x398188(0x225)]?_0x43601e[_0x398188(0x218)]=_0x4e5229[_0x398188(0x273)]:(_0x160f59[_0x398188(0x22e)](_0x398188(0x260)+_0xf3a39c[_0x398188(0x279)]+_0x398188(0x243)+_0x4e5229[_0x398188(0x225)]),_0x4298ba=![]),_0x43601e['allValid']=_0x4298ba,_0x43601e;}if(_0x3ae8bf[_0x398188(0x27c)]){_0x20df52(_0x398188(0x20d));const _0x5cd90c=generateEnrichedSQL(_0x3afe78,DEFAULT_SAMPLE_LIMIT),_0x2c01fa=await _0x218786(_0x5cd90c);return!_0x2c01fa[_0x398188(0x225)]?_0x43601e[_0x398188(0x218)]=_0x2c01fa['data']:(_0x160f59[_0x398188(0x22e)](_0x398188(0x207)+_0x2c01fa[_0x398188(0x225)]),_0x4298ba=![]),_0x43601e[_0x398188(0x230)]=_0x4298ba,_0x43601e;}return _0x43601e[_0x398188(0x230)]=_0x4298ba,_0x43601e;}async[a76_0x143834(0x20e)](_0x4a8142,_0x230820){const _0x3727aa=a76_0x143834;return await this[_0x3727aa(0x23e)][_0x3727aa(0x20e)](_0x4a8142,_0x230820);}async['createJourneySegment'](_0x169ac0){const _0x2207e6=a76_0x143834;return await this[_0x2207e6(0x23e)][_0x2207e6(0x228)](_0x169ac0);}async[a76_0x143834(0x219)](_0x1e1025,_0x4f0a4b,_0x2bedcd){const _0x21ed10=a76_0x143834;return await this[_0x21ed10(0x23e)]['updateSegment'](_0x1e1025,_0x4f0a4b,_0x2bedcd);}async[a76_0x143834(0x26d)](_0x5a49dd){const _0x32da91=a76_0x143834;return await this[_0x32da91(0x23e)][_0x32da91(0x26d)](_0x5a49dd);}async['createFolder'](_0x6e3789,_0x5dc34d){const _0x3154d5=a76_0x143834,_0x52d2c5=await this[_0x3154d5(0x278)](_0x6e3789);return await this[_0x3154d5(0x23e)][_0x3154d5(0x26c)](_0x52d2c5,_0x5dc34d);}async[a76_0x143834(0x278)](_0x235f65){if(/^\d+$/['test'](_0x235f65))return _0x235f65;return await this['resolveParentId'](_0x235f65);}async[a76_0x143834(0x25e)](_0x4d545e,_0x4a3605){const _0x2a900e=a76_0x143834,[_0x36b4c0,_0x3df823]=await Promise[_0x2a900e(0x208)]([this[_0x2a900e(0x247)](_0x4d545e,_0x4a3605)[_0x2a900e(0x253)](()=>!![])[_0x2a900e(0x1fe)](()=>![]),this['resolveSegmentId'](_0x4d545e,_0x4a3605)[_0x2a900e(0x253)](()=>!![])[_0x2a900e(0x1fe)](()=>![])]);if(_0x36b4c0&&_0x3df823)return'ambiguous';else{if(_0x36b4c0)return'folder';else{if(_0x3df823)return _0x2a900e(0x277);}}throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2a900e(0x275)+_0x4a3605+'\x27\x20not\x20found\x20in\x20parent\x20segment');}async[a76_0x143834(0x22a)](_0x5a4b04,_0x2cf9a6,_0x25f383){const _0xf1de90=a76_0x143834,[_0x2e0aaf,_0x502dfb]=await Promise[_0xf1de90(0x208)]([this['listFolders'](_0x5a4b04),this[_0xf1de90(0x232)](_0x5a4b04)]),_0x4c347a=_0x25f383?_0x2e0aaf[_0xf1de90(0x20a)](_0x5148df=>_0x5148df[_0xf1de90(0x206)]===_0x25f383):_0x2e0aaf[_0xf1de90(0x20a)](_0xf17549=>!_0xf17549[_0xf1de90(0x206)]),_0x4e3967=_0x25f383?_0x502dfb[_0xf1de90(0x20a)](_0x47e6b4=>_0x47e6b4['segmentFolderId']===_0x25f383):_0x502dfb[_0xf1de90(0x20a)](_0x1ef4e5=>!_0x1ef4e5['segmentFolderId']),_0xbfefd8=_0x4c347a[_0xf1de90(0x23c)](_0x2bf0e9=>_0x2bf0e9[_0xf1de90(0x279)]===_0x2cf9a6),_0x1be018=_0x4e3967['some'](_0x5a2f06=>_0x5a2f06['name']===_0x2cf9a6);if(_0xbfefd8&&_0x1be018)return'ambiguous';else{if(_0xbfefd8)return _0xf1de90(0x205);else{if(_0x1be018)return'segment';}}throw new SDKError(ErrorCode[_0xf1de90(0x23d)],_0xf1de90(0x275)+_0x2cf9a6+_0xf1de90(0x221)+(_0x25f383?'folder':_0xf1de90(0x211)));}async['traversePath'](_0x2c23c3){const _0x1a05cd=a76_0x143834;if(_0x2c23c3[_0x1a05cd(0x265)]===0x0)throw new SDKError(ErrorCode[_0x1a05cd(0x250)],'Path\x20cannot\x20be\x20empty');const _0x1bcbc0=_0x2c23c3[0x0],_0xb97f89=await this[_0x1a05cd(0x24c)](_0x1bcbc0);if(_0x2c23c3[_0x1a05cd(0x265)]===0x1)return{'parentId':_0xb97f89,'parentName':_0x1bcbc0,'type':_0x1a05cd(0x229),'fullPath':_0x1bcbc0};const _0x4a04c1=await this[_0x1a05cd(0x25c)](_0xb97f89),_0xd8d1d1=_0x4a04c1['rootFolderId'],_0x5acc10=[];let _0x148f5d=_0xd8d1d1;for(let _0xcffd9=0x1;_0xcffd9<_0x2c23c3[_0x1a05cd(0x265)]-0x1;_0xcffd9++){const _0x4e1a01=_0x2c23c3[_0xcffd9],_0x1bec32=await this[_0x1a05cd(0x262)](_0xb97f89),_0x419faa=_0x148f5d?_0x1bec32[_0x1a05cd(0x254)](_0x2fde18=>_0x2fde18[_0x1a05cd(0x279)]===_0x4e1a01&&_0x2fde18[_0x1a05cd(0x206)]===_0x148f5d):_0x1bec32['find'](_0x1fb822=>_0x1fb822[_0x1a05cd(0x279)]===_0x4e1a01&&!_0x1fb822[_0x1a05cd(0x206)]);if(!_0x419faa)throw new SDKError(ErrorCode[_0x1a05cd(0x23d)],_0x1a05cd(0x226)+_0x4e1a01+_0x1a05cd(0x22b));_0x5acc10['push'](_0x4e1a01),_0x148f5d=_0x419faa['id'];}const _0x524fb1=_0x2c23c3[_0x2c23c3[_0x1a05cd(0x265)]-0x1],_0x2b9ab2=await this['detectResourceTypeInFolder'](_0xb97f89,_0x524fb1,_0x148f5d);if(_0x2b9ab2===_0x1a05cd(0x25f)||_0x2b9ab2==='folder'){const _0x1f5255=await this['listFolders'](_0xb97f89),_0x2cd0e8=_0x148f5d?_0x1f5255[_0x1a05cd(0x254)](_0x190bed=>_0x190bed['name']===_0x524fb1&&_0x190bed[_0x1a05cd(0x206)]===_0x148f5d):_0x1f5255[_0x1a05cd(0x254)](_0x464e8d=>_0x464e8d[_0x1a05cd(0x279)]===_0x524fb1&&!_0x464e8d['parentFolderId']);if(!_0x2cd0e8)throw new SDKError(ErrorCode[_0x1a05cd(0x23d)],'Folder\x20\x27'+_0x524fb1+'\x27\x20not\x20found');return _0x5acc10[_0x1a05cd(0x22e)](_0x524fb1),{'parentId':_0xb97f89,'parentName':_0x1bcbc0,'folderId':_0x2cd0e8['id'],'folderPath':_0x5acc10,'type':_0x1a05cd(0x205),'fullPath':_0x2c23c3[_0x1a05cd(0x1ff)]('/')};}else{const _0x1c7b3b=await this[_0x1a05cd(0x232)](_0xb97f89),_0xf4bd49=_0x148f5d?_0x1c7b3b[_0x1a05cd(0x254)](_0x1a1c13=>_0x1a1c13['name']===_0x524fb1&&_0x1a1c13[_0x1a05cd(0x267)]===_0x148f5d):_0x1c7b3b[_0x1a05cd(0x254)](_0x8c7783=>_0x8c7783[_0x1a05cd(0x279)]===_0x524fb1&&!_0x8c7783[_0x1a05cd(0x267)]);if(!_0xf4bd49)throw new SDKError(ErrorCode[_0x1a05cd(0x23d)],_0x1a05cd(0x1fd)+_0x524fb1+_0x1a05cd(0x236));return{'parentId':_0xb97f89,'parentName':_0x1bcbc0,'folderId':_0x148f5d,'folderPath':_0x5acc10['length']>0x0?_0x5acc10:undefined,'segmentId':_0xf4bd49['id'],'segmentName':_0x524fb1,'type':_0x1a05cd(0x277),'fullPath':_0x2c23c3['join']('/')};}}async[a76_0x143834(0x23b)](_0x39581b){const _0x3df006=a76_0x143834,_0x47428c=parsePath(_0x39581b);if(!_0x47428c['isAbsolute'])throw new SDKError(ErrorCode[_0x3df006(0x250)],_0x3df006(0x213));return await this[_0x3df006(0x1fa)](_0x47428c['segments']);}async['listUnified'](_0x3ee79a,_0x8cb097){const _0x2b4fb2=a76_0x143834,[_0x20ab50,_0x152bf1]=await Promise[_0x2b4fb2(0x208)]([this['listFolders'](_0x3ee79a),this[_0x2b4fb2(0x232)](_0x3ee79a)]);if(_0x8cb097){const _0x4d5b3e=_0x20ab50[_0x2b4fb2(0x20a)](_0x79b6ae=>_0x79b6ae['parentFolderId']===_0x8cb097),_0x101436=_0x152bf1[_0x2b4fb2(0x20a)](_0x437b7d=>_0x437b7d['segmentFolderId']===_0x8cb097);return{'folders':_0x4d5b3e,'segments':_0x101436};}const _0x2f7b5d=await this[_0x2b4fb2(0x25c)](_0x3ee79a),_0x46be2f=_0x2f7b5d['rootFolderId'];if(_0x46be2f){const _0x27ac0b=_0x20ab50['filter'](_0x5569a7=>_0x5569a7[_0x2b4fb2(0x206)]===_0x46be2f),_0x1548e3=_0x152bf1[_0x2b4fb2(0x20a)](_0x53124a=>_0x53124a[_0x2b4fb2(0x267)]===_0x46be2f);return{'folders':_0x27ac0b,'segments':_0x1548e3};}const _0xa63ff8=_0x20ab50[_0x2b4fb2(0x20a)](_0x1f3e4e=>!_0x1f3e4e[_0x2b4fb2(0x206)]),_0x554b5e=_0x152bf1[_0x2b4fb2(0x20a)](_0x470f13=>!_0x470f13[_0x2b4fb2(0x267)]);return{'folders':_0xa63ff8,'segments':_0x554b5e};}async[a76_0x143834(0x212)](_0x2eb658,_0x42c306,_0x559440=0x0,_0x5720ed=0xa){const _0x33597d=a76_0x143834;if(_0x559440>=_0x5720ed)throw new SDKError(ErrorCode[_0x33597d(0x250)],_0x33597d(0x20b)+_0x5720ed+_0x33597d(0x24e));const {folders:_0x4b93ed,segments:_0x48e2f9}=await this[_0x33597d(0x231)](_0x2eb658,_0x42c306),_0x2f72f2=[];for(const _0xa257d4 of _0x4b93ed){const _0x5b1b77=await this[_0x33597d(0x212)](_0x2eb658,_0xa257d4['id'],_0x559440+0x1,_0x5720ed);_0x2f72f2[_0x33597d(0x22e)]({'type':_0x33597d(0x205),'id':_0xa257d4['id'],'name':_0xa257d4[_0x33597d(0x279)],'children':_0x5b1b77['length']>0x0?_0x5b1b77:undefined,'metadata':{'description':_0xa257d4[_0x33597d(0x252)]||undefined,'folderCount':_0x5b1b77[_0x33597d(0x20a)](_0x17a4f0=>_0x17a4f0[_0x33597d(0x1f5)]===_0x33597d(0x205))[_0x33597d(0x265)],'segmentCount':_0x5b1b77[_0x33597d(0x20a)](_0x100d01=>_0x100d01['type']===_0x33597d(0x277))[_0x33597d(0x265)],'createdAt':_0xa257d4[_0x33597d(0x25a)],'updatedAt':_0xa257d4['updatedAt']}});}for(const _0x5e3136 of _0x48e2f9){_0x2f72f2[_0x33597d(0x22e)]({'type':_0x33597d(0x277),'id':_0x5e3136['id'],'name':_0x5e3136[_0x33597d(0x279)],'population':_0x5e3136[_0x33597d(0x21b)],'metadata':{'description':_0x5e3136[_0x33597d(0x252)],'createdAt':_0x5e3136[_0x33597d(0x25a)],'updatedAt':_0x5e3136[_0x33597d(0x276)]}});}return _0x2f72f2;}}
package/dist/sdk/user.js CHANGED
@@ -1 +1 @@
1
- function a77_0xa561(_0x57719c,_0x2ad41c){_0x57719c=_0x57719c-0x1d3;const _0x50b56f=a77_0x50b5();let _0xa561f6=_0x50b56f[_0x57719c];return _0xa561f6;}const a77_0xb73a90=a77_0xa561;(function(_0x103b03,_0x57800e){const _0x1ff86c=a77_0xa561,_0x481bc6=_0x103b03();while(!![]){try{const _0x46c2bd=parseInt(_0x1ff86c(0x1d4))/0x1+-parseInt(_0x1ff86c(0x1e8))/0x2+parseInt(_0x1ff86c(0x1d9))/0x3*(-parseInt(_0x1ff86c(0x1ec))/0x4)+-parseInt(_0x1ff86c(0x1eb))/0x5*(parseInt(_0x1ff86c(0x1d7))/0x6)+-parseInt(_0x1ff86c(0x1db))/0x7*(-parseInt(_0x1ff86c(0x1dd))/0x8)+parseInt(_0x1ff86c(0x1e1))/0x9*(parseInt(_0x1ff86c(0x1dc))/0xa)+-parseInt(_0x1ff86c(0x1e9))/0xb;if(_0x46c2bd===_0x57800e)break;else _0x481bc6['push'](_0x481bc6['shift']());}catch(_0x2b23f7){_0x481bc6['push'](_0x481bc6['shift']());}}}(a77_0x50b5,0xd807f));import{TDApiClient}from'../client/td-api-client.js';import{loadCachedUsers,saveCachedUsers,clearUserCache}from'../core/user-cache.js';function a77_0x50b5(){const _0x43dbf7=['default','179067AzSAup','buildEmailToIdMap','1648885oxZFja','11627270xtejeG','16ksAPTN','list','logger','findByEmail','9gVerlQ','clearCache','buildIdToEmailMap','find','client','getCurrent','map','307410puNXsZ','4923325qVPeUe','toLowerCase','5iceAes','16BAYaNv','findById','804098JsPGIH','profile','email','4278216jttupB'];a77_0x50b5=function(){return _0x43dbf7;};return a77_0x50b5();}export class UserSDK{[a77_0xb73a90(0x1e5)];[a77_0xb73a90(0x1d5)];constructor(_0x5b0ef5){const _0x475e8a=a77_0xb73a90;this['client']=new TDApiClient(_0x5b0ef5,_0x5b0ef5[_0x475e8a(0x1df)]),this[_0x475e8a(0x1d5)]=_0x5b0ef5[_0x475e8a(0x1d5)]||_0x475e8a(0x1d8);}async[a77_0xb73a90(0x1e6)](){const _0x63473a=a77_0xb73a90;return await this[_0x63473a(0x1e5)]['getUserInfo']();}async['list'](_0xa660ad=![]){const _0x4c9a7f=a77_0xb73a90;if(!_0xa660ad){const _0x57ab1f=loadCachedUsers(this[_0x4c9a7f(0x1d5)]);if(_0x57ab1f)return _0x57ab1f;}const _0x231a2b=await this['client']['listUsers']();return saveCachedUsers(this[_0x4c9a7f(0x1d5)],_0x231a2b),_0x231a2b;}[a77_0xb73a90(0x1e2)](){const _0xba1c7d=a77_0xb73a90;clearUserCache(this[_0xba1c7d(0x1d5)]);}async[a77_0xb73a90(0x1e0)](_0x34f154){const _0x36d7e4=a77_0xb73a90,_0xeacadf=await this['list']();return _0xeacadf[_0x36d7e4(0x1e4)](_0x4d7ba8=>_0x4d7ba8['email'][_0x36d7e4(0x1ea)]()===_0x34f154['toLowerCase']());}async[a77_0xb73a90(0x1d3)](_0x43b1ed){const _0x5440b1=a77_0xb73a90,_0x5ae536=await this[_0x5440b1(0x1de)]();return _0x5ae536[_0x5440b1(0x1e4)](_0x242b12=>_0x242b12['id']===_0x43b1ed);}async[a77_0xb73a90(0x1da)](){const _0xa37278=a77_0xb73a90,_0x334118=await this[_0xa37278(0x1de)]();return new Map(_0x334118[_0xa37278(0x1e7)](_0x3d460a=>[_0x3d460a[_0xa37278(0x1d6)][_0xa37278(0x1ea)](),_0x3d460a['id']]));}async[a77_0xb73a90(0x1e3)](){const _0x17917b=a77_0xb73a90,_0xdc6059=await this[_0x17917b(0x1de)]();return new Map(_0xdc6059[_0x17917b(0x1e7)](_0x743946=>[_0x743946['id'],_0x743946[_0x17917b(0x1d6)]]));}async['buildUserMaps'](){const _0x31c4f8=a77_0xb73a90,_0x170e73=await this['list']();return{'emailToId':new Map(_0x170e73[_0x31c4f8(0x1e7)](_0x1f1ec9=>[_0x1f1ec9[_0x31c4f8(0x1d6)][_0x31c4f8(0x1ea)](),_0x1f1ec9['id']])),'idToEmail':new Map(_0x170e73['map'](_0x591160=>[_0x591160['id'],_0x591160['email']]))};}}
1
+ function a77_0x4cd3(_0x157ca3,_0x3001e1){_0x157ca3=_0x157ca3-0x158;const _0x1f7e16=a77_0x1f7e();let _0x4cd337=_0x1f7e16[_0x157ca3];return _0x4cd337;}const a77_0x58a496=a77_0x4cd3;function a77_0x1f7e(){const _0x3fce14=['buildIdToEmailMap','list','find','default','351202JMNIrZ','3179928QjWoMD','6270030aMSpOl','findByEmail','clearCache','map','39556940QUKwKB','4BdsLKc','3LlWtRx','listUsers','client','profile','2849674jCcgow','logger','4704yKVmUu','toLowerCase','getUserInfo','3012535GQEdyR','9584GPQEja','email'];a77_0x1f7e=function(){return _0x3fce14;};return a77_0x1f7e();}(function(_0x577f0e,_0x29fa86){const _0x426e06=a77_0x4cd3,_0x19f54=_0x577f0e();while(!![]){try{const _0x1fbb7d=-parseInt(_0x426e06(0x161))/0x1+parseInt(_0x426e06(0x16d))/0x2*(-parseInt(_0x426e06(0x169))/0x3)+parseInt(_0x426e06(0x168))/0x4*(-parseInt(_0x426e06(0x15a))/0x5)+-parseInt(_0x426e06(0x162))/0x6+parseInt(_0x426e06(0x16f))/0x7*(-parseInt(_0x426e06(0x15b))/0x8)+parseInt(_0x426e06(0x163))/0x9+parseInt(_0x426e06(0x167))/0xa;if(_0x1fbb7d===_0x29fa86)break;else _0x19f54['push'](_0x19f54['shift']());}catch(_0x489d28){_0x19f54['push'](_0x19f54['shift']());}}}(a77_0x1f7e,0xe5316));import{TDApiClient}from'../client/td-api-client.js';import{loadCachedUsers,saveCachedUsers,clearUserCache}from'../core/user-cache.js';export class UserSDK{['client'];[a77_0x58a496(0x16c)];constructor(_0x7402d5){const _0x1f0064=a77_0x58a496;this[_0x1f0064(0x16b)]=new TDApiClient(_0x7402d5,_0x7402d5[_0x1f0064(0x16e)]),this['profile']=_0x7402d5[_0x1f0064(0x16c)]||_0x1f0064(0x160);}async['getCurrent'](){const _0x17e11d=a77_0x58a496;return await this[_0x17e11d(0x16b)][_0x17e11d(0x159)]();}async[a77_0x58a496(0x15e)](_0x3fb514=![]){const _0x4dc86c=a77_0x58a496;if(!_0x3fb514){const _0x59a9e4=loadCachedUsers(this[_0x4dc86c(0x16c)]);if(_0x59a9e4)return _0x59a9e4;}const _0x1024b2=await this[_0x4dc86c(0x16b)][_0x4dc86c(0x16a)]();return saveCachedUsers(this[_0x4dc86c(0x16c)],_0x1024b2),_0x1024b2;}[a77_0x58a496(0x165)](){const _0x298e86=a77_0x58a496;clearUserCache(this[_0x298e86(0x16c)]);}async[a77_0x58a496(0x164)](_0x28df9d){const _0x2ca8d8=a77_0x58a496,_0x37e6af=await this[_0x2ca8d8(0x15e)]();return _0x37e6af['find'](_0x40a03d=>_0x40a03d['email'][_0x2ca8d8(0x158)]()===_0x28df9d[_0x2ca8d8(0x158)]());}async['findById'](_0x1f4542){const _0x357cb8=a77_0x58a496,_0x581731=await this['list']();return _0x581731[_0x357cb8(0x15f)](_0x1577c2=>_0x1577c2['id']===_0x1f4542);}async['buildEmailToIdMap'](){const _0x1b580e=a77_0x58a496,_0x67f1d5=await this['list']();return new Map(_0x67f1d5['map'](_0xe13e31=>[_0xe13e31['email'][_0x1b580e(0x158)](),_0xe13e31['id']]));}async[a77_0x58a496(0x15d)](){const _0x536672=a77_0x58a496,_0x4daa81=await this['list']();return new Map(_0x4daa81[_0x536672(0x166)](_0x5eb66a=>[_0x5eb66a['id'],_0x5eb66a[_0x536672(0x15c)]]));}async['buildUserMaps'](){const _0x16da1d=a77_0x58a496,_0x496837=await this['list']();return{'emailToId':new Map(_0x496837[_0x16da1d(0x166)](_0x1ac2eb=>[_0x1ac2eb[_0x16da1d(0x15c)]['toLowerCase'](),_0x1ac2eb['id']])),'idToEmail':new Map(_0x496837['map'](_0x7c0df0=>[_0x7c0df0['id'],_0x7c0df0['email']]))};}}
@@ -1 +1 @@
1
- function a78_0x379b(_0x114b4a,_0x4dea3b){_0x114b4a=_0x114b4a-0x171;const _0x4d9dec=a78_0x4d9d();let _0x379b5b=_0x4d9dec[_0x114b4a];return _0x379b5b;}const a78_0x5802ab=a78_0x379b;(function(_0x5b42aa,_0x4d0cb0){const _0x23cbee=a78_0x379b,_0x52df90=_0x5b42aa();while(!![]){try{const _0x28b562=parseInt(_0x23cbee(0x171))/0x1*(parseInt(_0x23cbee(0x1ae))/0x2)+parseInt(_0x23cbee(0x1ce))/0x3*(-parseInt(_0x23cbee(0x1b0))/0x4)+-parseInt(_0x23cbee(0x1ca))/0x5*(-parseInt(_0x23cbee(0x173))/0x6)+parseInt(_0x23cbee(0x1a7))/0x7*(-parseInt(_0x23cbee(0x197))/0x8)+-parseInt(_0x23cbee(0x195))/0x9*(-parseInt(_0x23cbee(0x18e))/0xa)+parseInt(_0x23cbee(0x1d3))/0xb*(-parseInt(_0x23cbee(0x1a6))/0xc)+parseInt(_0x23cbee(0x187))/0xd*(parseInt(_0x23cbee(0x1c9))/0xe);if(_0x28b562===_0x4d0cb0)break;else _0x52df90['push'](_0x52df90['shift']());}catch(_0x365425){_0x52df90['push'](_0x52df90['shift']());}}}(a78_0x4d9d,0xafbb0));import{WorkflowApiClient}from'../client/workflow-client.js';function a78_0x4d9d(){const _0x2c63b8=['workflow','isDirectory','sessionUuid','finishedAt','util','direct','done','killAttempt','now','utf-8','listProjects','substring','sessionTime','latest','uploadProjectArchive','toString','fullName','listSessions','listAttempts','1132482bWFyhm','limit','isGroup','.\x20Expected\x20\x22project.workflow\x22','resolveProjectId','mkdir','tdx-workflow-','5987770sdySXL','timezone','getAttempt','endsWith','index','message','error','9cZoXsv','Project\x20not\x20found:\x20','178856wSMJGr','cancelRequested','skipValidation','parentId','gunzip','attempts','listWorkflows','access','lastAttempt','kill','project','storeParams','filter','workflowName','Failed\x20to\x20download\x20log\x20file:\x20','9813084otRlGb','301oBQcqg','Workflow\x20must\x20be\x20specified\x20as\x20\x22project.workflow\x22\x20format','last_id','basename','find','workflows','logFiles','317838OHAqxl','toTime','4RuabFk','indexOf','params','retryAttemptName','tar','logs','push','revision','download','retrySession','Project\x20directory\x20not\x20found:\x20','startedAt','join','lastId','clearScheduleAll','sessionId','readdir','retryParams','fromTime','path','upstreams','tmpdir','retryAttempt','data','getAttemptTasks','224xlsilg','675505slhfMb','updatedAt','stateParams','replace','2605587iLCbaU','toISOString','map','NUMERIC_ID_PATTERN','length','11PDioFG','unlink','test','projectName','name','isFile','listLogFiles','client','clearSchedule','.tar.gz','retryAt','resumeFrom','success','1DeLdqX','fromTask','54SttEMI'];a78_0x4d9d=function(){return _0x2c63b8;};return a78_0x4d9d();}import{shouldIncludeInArchive,WORKFLOW_FILE_EXTENSION}from'../utils/workflow-utils.js';export class WorkflowSDK{static [a78_0x5802ab(0x1d1)]=/^\d+$/;[a78_0x5802ab(0x1da)];constructor(_0x5c0ece){this['client']=new WorkflowApiClient(_0x5c0ece,_0x5c0ece['logger']);}async[a78_0x5802ab(0x18b)](_0x529e61){const _0x43ceb4=a78_0x5802ab;if(WorkflowSDK[_0x43ceb4(0x1d1)][_0x43ceb4(0x1d5)](_0x529e61))return{'id':_0x529e61,'name':_0x529e61};const _0x4baf5b=await this[_0x43ceb4(0x1da)][_0x43ceb4(0x17e)]({'name_pattern':_0x529e61}),_0x13b028=_0x4baf5b[_0x43ceb4(0x1c7)][_0x43ceb4(0x1ab)](_0x521f70=>_0x521f70['name']===_0x529e61);if(!_0x13b028)throw new Error(_0x43ceb4(0x196)+_0x529e61);return{'id':_0x13b028['id'],'name':_0x13b028[_0x43ceb4(0x1d7)]};}async['projects'](_0x29a3e1,_0xe74b14){const _0x3e5044=a78_0x5802ab,_0x17e169=await this[_0x3e5044(0x1da)][_0x3e5044(0x17e)]({'name_pattern':_0x29a3e1,..._0xe74b14});return _0x17e169['data'][_0x3e5044(0x1d0)](_0x399564=>({..._0x399564,'project_id':_0x399564['id'],'project_name':_0x399564[_0x3e5044(0x1d7)]}));}async[a78_0x5802ab(0x1ac)](_0x1e4bcc,_0x7d8925){const _0x4eaca8=a78_0x5802ab,_0x4e3310=await this['client'][_0x4eaca8(0x19d)]({'project_name':_0x1e4bcc,..._0x7d8925});return _0x4e3310[_0x4eaca8(0x1c7)][_0x4eaca8(0x1d0)](_0xbc020=>({'project_id':_0xbc020['project']?.['id'],'project_name':_0xbc020[_0x4eaca8(0x1a1)]?.[_0x4eaca8(0x1d7)],'workflow_id':_0xbc020['id'],'workflow_name':_0xbc020[_0x4eaca8(0x1d7)],'revision':_0xbc020[_0x4eaca8(0x1b7)],'timezone':_0xbc020[_0x4eaca8(0x18f)],'config':_0xbc020['config'],'id':_0xbc020['id'],'name':_0xbc020[_0x4eaca8(0x1d7)],'project':_0xbc020[_0x4eaca8(0x1a1)]}));}async['sessions'](_0x3fc1cf){const _0x5fd5c0=a78_0x5802ab;let _0x2a8916;if(_0x3fc1cf?.['projectName']){let _0x3ccf6a,_0x2fd187=![];while(!_0x2fd187){const _0x35aabe=await this['client']['listProjects']({'limit':0x64,'last_id':_0x3ccf6a}),_0x2fd1d4=_0x35aabe[_0x5fd5c0(0x1c7)][_0x5fd5c0(0x1ab)](_0x3623db=>_0x3623db['name']===_0x3fc1cf[_0x5fd5c0(0x1d6)]);if(_0x2fd1d4){_0x2a8916=_0x2fd1d4['id'],_0x2fd187=!![];break;}if(!_0x35aabe[_0x5fd5c0(0x1bd)]||_0x35aabe[_0x5fd5c0(0x1c7)][_0x5fd5c0(0x1d2)]===0x0)break;_0x3ccf6a=_0x35aabe[_0x5fd5c0(0x1bd)];}if(!_0x2a8916)throw new Error(_0x5fd5c0(0x196)+_0x3fc1cf[_0x5fd5c0(0x1d6)]);}const _0x1bb793=await this[_0x5fd5c0(0x1da)][_0x5fd5c0(0x185)]({'project_id':_0x2a8916,'project_name':_0x3fc1cf?.[_0x5fd5c0(0x1d6)],'workflow_name':_0x3fc1cf?.[_0x5fd5c0(0x1a4)],'status':_0x3fc1cf?.['status'],'from_time':_0x3fc1cf?.[_0x5fd5c0(0x1c2)],'to_time':_0x3fc1cf?.[_0x5fd5c0(0x1af)],'limit':_0x3fc1cf?.[_0x5fd5c0(0x188)],'last_id':_0x3fc1cf?.[_0x5fd5c0(0x1a9)]});return _0x1bb793[_0x5fd5c0(0x1c7)][_0x5fd5c0(0x1d0)](_0x54eeb5=>({'project_id':_0x54eeb5['project']?.['id'],'project_name':_0x54eeb5[_0x5fd5c0(0x1a1)]?.['name'],'workflow_id':_0x54eeb5[_0x5fd5c0(0x174)]?.['id'],'workflow_name':_0x54eeb5['workflow']?.[_0x5fd5c0(0x1d7)],'session_id':_0x54eeb5['id'],'sessionUuid':_0x54eeb5[_0x5fd5c0(0x176)],'sessionTime':_0x54eeb5['sessionTime'],'lastAttempt':_0x54eeb5[_0x5fd5c0(0x19f)],'id':_0x54eeb5['id'],'project':_0x54eeb5[_0x5fd5c0(0x1a1)],'workflow':_0x54eeb5['workflow']}));}async[a78_0x5802ab(0x19c)](_0x3f7978){const _0x4eee85=a78_0x5802ab,_0x1dfc02=await this[_0x4eee85(0x1da)][_0x4eee85(0x186)]({'project_name':_0x3f7978?.[_0x4eee85(0x1d6)],'workflow_name':_0x3f7978?.[_0x4eee85(0x1a4)],'include_retried':_0x3f7978?.['includeRetried'],'limit':_0x3f7978?.[_0x4eee85(0x188)],'last_id':_0x3f7978?.['last_id']});return _0x1dfc02[_0x4eee85(0x1c7)][_0x4eee85(0x1d0)](_0x5cbd47=>({'project_id':_0x5cbd47[_0x4eee85(0x1a1)]?.['id'],'project_name':_0x5cbd47['project']?.[_0x4eee85(0x1d7)],'workflow_id':_0x5cbd47[_0x4eee85(0x174)]?.['id'],'workflow_name':_0x5cbd47['workflow']?.[_0x4eee85(0x1d7)],'session_id':_0x5cbd47['sessionId'],'sessionUuid':_0x5cbd47[_0x4eee85(0x176)],'sessionTime':_0x5cbd47[_0x4eee85(0x180)],'attempt_id':_0x5cbd47['id'],'attempt_index':_0x5cbd47[_0x4eee85(0x192)],'retryAttemptName':_0x5cbd47[_0x4eee85(0x1b3)],'done':_0x5cbd47[_0x4eee85(0x17a)],'success':_0x5cbd47[_0x4eee85(0x1df)],'cancelRequested':_0x5cbd47[_0x4eee85(0x198)],'params':_0x5cbd47[_0x4eee85(0x1b2)],'createdAt':_0x5cbd47['createdAt'],'finishedAt':_0x5cbd47[_0x4eee85(0x177)],'id':_0x5cbd47['id'],'index':_0x5cbd47[_0x4eee85(0x192)],'project':_0x5cbd47['project'],'workflow':_0x5cbd47['workflow']}));}async['attempt'](_0x27b00c){const _0x2540ef=a78_0x5802ab,_0x505aad=await this['client'][_0x2540ef(0x190)](_0x27b00c);return _0x505aad;}async['tasks'](_0x1c7aba,_0x4d8651=![]){const _0x2498fe=a78_0x5802ab,_0x1f8921=await this[_0x2498fe(0x1da)][_0x2498fe(0x1c8)](_0x1c7aba,_0x4d8651);return _0x1f8921[_0x2498fe(0x1d0)](_0x245031=>({'task_id':_0x245031['id'],'task_name':_0x245031[_0x2498fe(0x184)],'parentId':_0x245031[_0x2498fe(0x19a)],'config':_0x245031['config'],'upstreams':_0x245031[_0x2498fe(0x1c4)],'state':_0x245031['state'],'exportParams':_0x245031['exportParams'],'storeParams':_0x245031[_0x2498fe(0x1a2)],'stateParams':_0x245031[_0x2498fe(0x1cc)],'updatedAt':_0x245031[_0x2498fe(0x1cb)],'retryAt':_0x245031[_0x2498fe(0x1dd)],'startedAt':_0x245031[_0x2498fe(0x1bb)],'error':_0x245031[_0x2498fe(0x194)],'isGroup':_0x245031[_0x2498fe(0x189)],'id':_0x245031['id'],'fullName':_0x245031[_0x2498fe(0x184)]}));}async[a78_0x5802ab(0x1ad)](_0xac77f9,_0x159d8){const _0x179792=a78_0x5802ab;return await this['client'][_0x179792(0x1d9)](_0xac77f9,_0x159d8);}async[a78_0x5802ab(0x1b5)](_0x2da126,_0x4b88e0){const _0x1af613=a78_0x5802ab,_0x3e17e6=await import('zlib'),{promisify:_0x566b17}=await import(_0x1af613(0x178)),_0x43201c=_0x566b17(_0x3e17e6[_0x1af613(0x19b)]),_0x1d8012=await this[_0x1af613(0x1da)][_0x1af613(0x1d9)](_0x2da126,_0x4b88e0);if(_0x1d8012[_0x1af613(0x1d2)]===0x0)return'';const _0xfdfd27=[];for(const _0x360140 of _0x1d8012){if(!_0x360140[_0x1af613(0x179)])continue;const _0x407a18=await fetch(_0x360140[_0x1af613(0x179)]);if(!_0x407a18['ok'])throw new Error(_0x1af613(0x1a5)+_0x407a18['status']);const _0x4ddb3b=Buffer['from'](await _0x407a18['arrayBuffer']()),_0x5e9e08=await _0x43201c(_0x4ddb3b);_0xfdfd27[_0x1af613(0x1b6)](_0x5e9e08[_0x1af613(0x183)](_0x1af613(0x17d)));}return _0xfdfd27[_0x1af613(0x1bc)]('\x0a');}async[a78_0x5802ab(0x1a0)](_0x20c6af,_0xca9b74){const _0x5a157c=a78_0x5802ab,_0x423579=await this[_0x5a157c(0x1da)][_0x5a157c(0x17b)](_0x20c6af,_0xca9b74);return _0x423579?.[_0x5a157c(0x193)]??'Kill\x20request\x20accepted';}async[a78_0x5802ab(0x1b9)](_0x262b1f,_0x380c83){const _0x26f196=a78_0x5802ab,_0x17b0ac=await this[_0x26f196(0x1da)][_0x26f196(0x1b9)](_0x262b1f,{'from_task':_0x380c83?.[_0x26f196(0x172)],'retry_params':_0x380c83?.[_0x26f196(0x1c1)]});return{'attemptId':_0x17b0ac['id'],'sessionId':_0x17b0ac[_0x26f196(0x1bf)]};}async['retryAttempt'](_0x330b38,_0x134d4f){const _0x22c679=a78_0x5802ab,_0x189164=await this[_0x22c679(0x1da)][_0x22c679(0x1c6)](_0x330b38,{'resume_from':_0x134d4f?.[_0x22c679(0x1de)],'retry_params':_0x134d4f?.[_0x22c679(0x1c1)],'force':_0x134d4f?.['force']});return{'attemptId':_0x189164['id'],'sessionId':_0x189164[_0x22c679(0x1bf)]};}async['run'](_0x132b01,_0x25117d={},_0x6dd426){const _0x55e455=a78_0x5802ab,_0x240236=_0x132b01[_0x55e455(0x1b1)]('.');let _0x1cf49e,_0x4dda7c;if(_0x240236===-0x1)throw new Error(_0x55e455(0x1a8));_0x1cf49e=_0x132b01[_0x55e455(0x17f)](0x0,_0x240236),_0x4dda7c=_0x132b01['substring'](_0x240236+0x1);if(!_0x1cf49e||!_0x4dda7c)throw new Error('Invalid\x20workflow\x20format:\x20'+_0x132b01+_0x55e455(0x18a));const _0x385385=_0x6dd426?.[_0x55e455(0x180)]||new Date()['toISOString']();return await this[_0x55e455(0x1da)]['startAttempt']({'projectName':_0x1cf49e,'workflowName':_0x4dda7c,'sessionTime':_0x385385,'params':_0x25117d});}async[a78_0x5802ab(0x1b8)](_0x38a9e4,_0x5a9045,_0x4be8c0){const _0x119d0a=a78_0x5802ab,{promises:_0x4aa6c5}=await import('fs'),_0x247d76=await import(_0x119d0a(0x1c3)),_0x31bdc5=await import('os'),_0x1c0552=await import(_0x119d0a(0x1b4)),{id:_0x35cd6c,name:_0x2e537}=await this['resolveProjectId'](_0x38a9e4),_0x5880f7=_0x31bdc5['tmpdir'](),_0x333ff1=_0x247d76[_0x119d0a(0x1bc)](_0x5880f7,_0x119d0a(0x18d)+_0x35cd6c+'-'+Date['now']()+_0x119d0a(0x1dc));try{await this[_0x119d0a(0x1da)]['downloadProjectArchive'](_0x35cd6c,_0x333ff1,_0x4be8c0?.[_0x119d0a(0x1b7)]);const _0x48f6b0=_0x247d76[_0x119d0a(0x1bc)](_0x5a9045,_0x2e537);await _0x4aa6c5[_0x119d0a(0x18c)](_0x48f6b0,{'recursive':!![]}),await _0x1c0552['extract']({'file':_0x333ff1,'cwd':_0x48f6b0,'gzip':!![]});const _0x8fb3e=async _0x151ea9=>{const _0x5167bd=_0x119d0a;let _0x216553=0x0;const _0x651e62=await _0x4aa6c5[_0x5167bd(0x1c0)](_0x151ea9,{'withFileTypes':!![]});for(const _0x36965d of _0x651e62){const _0x3f61be=_0x247d76[_0x5167bd(0x1bc)](_0x151ea9,_0x36965d[_0x5167bd(0x1d7)]);if(_0x36965d[_0x5167bd(0x1d8)]())_0x216553++;else _0x36965d[_0x5167bd(0x175)]()&&(_0x216553+=await _0x8fb3e(_0x3f61be));}return _0x216553;},_0x1ffed3=await _0x8fb3e(_0x48f6b0);return{'projectName':_0x2e537,'revision':_0x4be8c0?.[_0x119d0a(0x1b7)]||_0x119d0a(0x181),'filesExtracted':_0x1ffed3};}finally{try{await _0x4aa6c5[_0x119d0a(0x1d4)](_0x333ff1);}catch{}}}async['push'](_0x7d04c9,_0x23e9a5){const _0xab66ad=a78_0x5802ab,{promises:_0x47f464}=await import('fs'),_0x10c911=await import('path'),_0x514b13=await import('tar'),_0x349d16=_0x23e9a5?.[_0xab66ad(0x1d6)]||_0x10c911[_0xab66ad(0x1aa)](_0x7d04c9),_0x17fd65=_0x23e9a5?.['revision']||new Date()[_0xab66ad(0x1cf)]()[_0xab66ad(0x1cd)](/[:.]/g,'-');try{await _0x47f464[_0xab66ad(0x19e)](_0x7d04c9);}catch{throw new Error(_0xab66ad(0x1ba)+_0x7d04c9);}if(!_0x23e9a5?.[_0xab66ad(0x199)]){const _0xd37dfd=await _0x47f464['readdir'](_0x7d04c9),_0x34568a=_0xd37dfd[_0xab66ad(0x1a3)](_0x133382=>_0x133382[_0xab66ad(0x191)](WORKFLOW_FILE_EXTENSION));if(_0x34568a[_0xab66ad(0x1d2)]===0x0)throw new Error('No\x20'+WORKFLOW_FILE_EXTENSION+'\x20workflow\x20files\x20found\x20in\x20project\x20directory');for(const _0xe27480 of _0x34568a){const _0x429e44=_0x10c911[_0xab66ad(0x1bc)](_0x7d04c9,_0xe27480);try{await _0x47f464['access'](_0x429e44);}catch{throw new Error('Cannot\x20read\x20workflow\x20file:\x20'+_0xe27480);}}}const _0x2c9f97=async(_0x3fced9,_0x188dfe='')=>{const _0x59c771=_0xab66ad,_0x2ec4bc=await _0x47f464[_0x59c771(0x1c0)](_0x3fced9,{'withFileTypes':!![]}),_0x43b93e=[];for(const _0x40e3cd of _0x2ec4bc){const _0x413a56=_0x10c911['join'](_0x188dfe,_0x40e3cd[_0x59c771(0x1d7)]),_0x21b3f2=_0x10c911['join'](_0x3fced9,_0x40e3cd[_0x59c771(0x1d7)]);if(!shouldIncludeInArchive(_0x40e3cd[_0x59c771(0x1d7)]))continue;_0x40e3cd[_0x59c771(0x175)]()?_0x43b93e[_0x59c771(0x1b6)](...await _0x2c9f97(_0x21b3f2,_0x413a56)):_0x43b93e[_0x59c771(0x1b6)](_0x413a56);}return _0x43b93e;},_0x35e449=await _0x2c9f97(_0x7d04c9),_0x1be4a9=await import('os'),_0xac2003=_0x1be4a9[_0xab66ad(0x1c5)](),_0x5cb593=_0x10c911[_0xab66ad(0x1bc)](_0xac2003,'tdx-workflow-push-'+Date[_0xab66ad(0x17c)]()+'.tar.gz');try{await _0x514b13['create']({'file':_0x5cb593,'gzip':!![],'cwd':_0x7d04c9,'portable':!![]},_0x35e449);const _0x12cb7a=await this[_0xab66ad(0x1da)][_0xab66ad(0x182)](_0x349d16,_0x17fd65,_0x5cb593,{'scheduleFrom':_0x23e9a5?.['scheduleFrom'],'clearSchedule':_0x23e9a5?.[_0xab66ad(0x1db)],'clearScheduleAll':_0x23e9a5?.[_0xab66ad(0x1be)]});return{'projectId':_0x12cb7a['id'],'projectName':_0x12cb7a[_0xab66ad(0x1d7)],'revision':_0x12cb7a[_0xab66ad(0x1b7)]};}finally{try{await _0x47f464[_0xab66ad(0x1d4)](_0x5cb593);}catch{}}}async['delete'](_0x548f08){const _0x40bee1=a78_0x5802ab,{id:_0x1b2962}=await this[_0x40bee1(0x18b)](_0x548f08),_0x2f7908=await this[_0x40bee1(0x1da)]['deleteProject'](_0x1b2962);return{'projectId':_0x2f7908['id'],'projectName':_0x2f7908['name']};}}
1
+ const a78_0x570824=a78_0x2ba8;function a78_0x2ba8(_0x397e5b,_0x27fd27){_0x397e5b=_0x397e5b-0x153;const _0x51fb7e=a78_0x51fb();let _0x2ba88b=_0x51fb7e[_0x397e5b];return _0x2ba88b;}(function(_0x31aa0e,_0x48cbb4){const _0x3095e6=a78_0x2ba8,_0x58664f=_0x31aa0e();while(!![]){try{const _0x254e79=-parseInt(_0x3095e6(0x159))/0x1*(-parseInt(_0x3095e6(0x1a1))/0x2)+parseInt(_0x3095e6(0x183))/0x3*(parseInt(_0x3095e6(0x163))/0x4)+-parseInt(_0x3095e6(0x15c))/0x5+parseInt(_0x3095e6(0x162))/0x6*(parseInt(_0x3095e6(0x1b1))/0x7)+parseInt(_0x3095e6(0x1a4))/0x8*(parseInt(_0x3095e6(0x171))/0x9)+parseInt(_0x3095e6(0x1c0))/0xa*(parseInt(_0x3095e6(0x153))/0xb)+-parseInt(_0x3095e6(0x1c2))/0xc;if(_0x254e79===_0x48cbb4)break;else _0x58664f['push'](_0x58664f['shift']());}catch(_0x3d1c7e){_0x58664f['push'](_0x58664f['shift']());}}}(a78_0x51fb,0xee863));function a78_0x51fb(){const _0x2534bf=['includeRetried','state','clearSchedule','kill','deleteProject','fromTime','Project\x20not\x20found:\x20','map','scheduleFrom','retryParams','workflowName','listWorkflows','delete','force','.\x20Expected\x20\x22project.workflow\x22','attempt','attempts','60oUgxvZ','error','Kill\x20request\x20accepted','status','retrySession','sessionId','project','listLogFiles','basename','cancelRequested','sessionTime','create','finishedAt','listProjects','uploadProjectArchive','Failed\x20to\x20download\x20log\x20file:\x20','startAttempt','toTime','projectName','listAttempts','config','client','sessionUuid','Project\x20directory\x20not\x20found:\x20','revision','last_id','extract','clearScheduleAll','length','exportParams','2iDiIzV','tar','parentId','8oXCPCK','arrayBuffer','replace','logs','logger','Invalid\x20workflow\x20format:\x20','run','skipValidation','util','access','\x20workflow\x20files\x20found\x20in\x20project\x20directory','name','sessions','2720557SvaeBm','killAttempt','push','from','unlink','data','.tar.gz','path','lastAttempt','tmpdir','Cannot\x20read\x20workflow\x20file:\x20','isDirectory','find','gunzip','projects','1231270fvXWEj','NUMERIC_ID_PATTERN','31605480GgKHlU','substring','download','toISOString','isGroup','isFile','121SvctFc','retryAttempt','readdir','toString','test','lastId','518621wUtfID','message','fullName','8222750bODLXX','direct','storeParams','workflows','endsWith','getAttemptTasks','24vuNIog','363016IJIpTE','latest','updatedAt','now','done','resolveProjectId','index','workflow','logFiles','listSessions','join','downloadProjectArchive','fromTask','mkdir','113697VVLdaM'];a78_0x51fb=function(){return _0x2534bf;};return a78_0x51fb();}import{WorkflowApiClient}from'../client/workflow-client.js';import{shouldIncludeInArchive,WORKFLOW_FILE_EXTENSION}from'../utils/workflow-utils.js';export class WorkflowSDK{static [a78_0x570824(0x1c1)]=/^\d+$/;[a78_0x570824(0x198)];constructor(_0x594fe9){const _0xa94c46=a78_0x570824;this['client']=new WorkflowApiClient(_0x594fe9,_0x594fe9[_0xa94c46(0x1a8)]);}async[a78_0x570824(0x168)](_0x4d406c){const _0x112268=a78_0x570824;if(WorkflowSDK['NUMERIC_ID_PATTERN'][_0x112268(0x157)](_0x4d406c))return{'id':_0x4d406c,'name':_0x4d406c};const _0x466588=await this[_0x112268(0x198)]['listProjects']({'name_pattern':_0x4d406c}),_0x1e4928=_0x466588[_0x112268(0x1b6)]['find'](_0x11adbc=>_0x11adbc[_0x112268(0x1af)]===_0x4d406c);if(!_0x1e4928)throw new Error(_0x112268(0x178)+_0x4d406c);return{'id':_0x1e4928['id'],'name':_0x1e4928[_0x112268(0x1af)]};}async[a78_0x570824(0x1bf)](_0x25e9b4,_0x3e8f63){const _0x363d3f=a78_0x570824,_0x593817=await this['client'][_0x363d3f(0x190)]({'name_pattern':_0x25e9b4,..._0x3e8f63});return _0x593817[_0x363d3f(0x1b6)][_0x363d3f(0x179)](_0x429eb5=>({..._0x429eb5,'project_id':_0x429eb5['id'],'project_name':_0x429eb5[_0x363d3f(0x1af)]}));}async[a78_0x570824(0x15f)](_0x4555e5,_0x1c1038){const _0x12a402=a78_0x570824,_0x23fbed=await this[_0x12a402(0x198)][_0x12a402(0x17d)]({'project_name':_0x4555e5,..._0x1c1038});return _0x23fbed[_0x12a402(0x1b6)][_0x12a402(0x179)](_0x28d7c2=>({'project_id':_0x28d7c2['project']?.['id'],'project_name':_0x28d7c2[_0x12a402(0x189)]?.['name'],'workflow_id':_0x28d7c2['id'],'workflow_name':_0x28d7c2['name'],'revision':_0x28d7c2[_0x12a402(0x19b)],'timezone':_0x28d7c2['timezone'],'config':_0x28d7c2[_0x12a402(0x197)],'id':_0x28d7c2['id'],'name':_0x28d7c2[_0x12a402(0x1af)],'project':_0x28d7c2[_0x12a402(0x189)]}));}async[a78_0x570824(0x1b0)](_0x5d4bc7){const _0xc14ab6=a78_0x570824;let _0x7275f0;if(_0x5d4bc7?.[_0xc14ab6(0x195)]){let _0xb54d5a,_0x4684e0=![];while(!_0x4684e0){const _0x272e66=await this[_0xc14ab6(0x198)]['listProjects']({'limit':0x64,'last_id':_0xb54d5a}),_0x21facb=_0x272e66[_0xc14ab6(0x1b6)][_0xc14ab6(0x1bd)](_0x820a08=>_0x820a08[_0xc14ab6(0x1af)]===_0x5d4bc7[_0xc14ab6(0x195)]);if(_0x21facb){_0x7275f0=_0x21facb['id'],_0x4684e0=!![];break;}if(!_0x272e66[_0xc14ab6(0x158)]||_0x272e66[_0xc14ab6(0x1b6)][_0xc14ab6(0x19f)]===0x0)break;_0xb54d5a=_0x272e66['lastId'];}if(!_0x7275f0)throw new Error(_0xc14ab6(0x178)+_0x5d4bc7[_0xc14ab6(0x195)]);}const _0x430fb7=await this[_0xc14ab6(0x198)][_0xc14ab6(0x16c)]({'project_id':_0x7275f0,'project_name':_0x5d4bc7?.[_0xc14ab6(0x195)],'workflow_name':_0x5d4bc7?.[_0xc14ab6(0x17c)],'status':_0x5d4bc7?.['status'],'from_time':_0x5d4bc7?.[_0xc14ab6(0x177)],'to_time':_0x5d4bc7?.[_0xc14ab6(0x194)],'limit':_0x5d4bc7?.['limit'],'last_id':_0x5d4bc7?.[_0xc14ab6(0x19c)]});return _0x430fb7['data'][_0xc14ab6(0x179)](_0x114c8e=>({'project_id':_0x114c8e['project']?.['id'],'project_name':_0x114c8e[_0xc14ab6(0x189)]?.[_0xc14ab6(0x1af)],'workflow_id':_0x114c8e['workflow']?.['id'],'workflow_name':_0x114c8e[_0xc14ab6(0x16a)]?.[_0xc14ab6(0x1af)],'session_id':_0x114c8e['id'],'sessionUuid':_0x114c8e['sessionUuid'],'sessionTime':_0x114c8e[_0xc14ab6(0x18d)],'lastAttempt':_0x114c8e[_0xc14ab6(0x1b9)],'id':_0x114c8e['id'],'project':_0x114c8e[_0xc14ab6(0x189)],'workflow':_0x114c8e['workflow']}));}async[a78_0x570824(0x182)](_0x26058b){const _0xe552a3=a78_0x570824,_0x9f1f24=await this[_0xe552a3(0x198)][_0xe552a3(0x196)]({'project_name':_0x26058b?.[_0xe552a3(0x195)],'workflow_name':_0x26058b?.[_0xe552a3(0x17c)],'include_retried':_0x26058b?.[_0xe552a3(0x172)],'limit':_0x26058b?.['limit'],'last_id':_0x26058b?.[_0xe552a3(0x19c)]});return _0x9f1f24['data'][_0xe552a3(0x179)](_0x33ab03=>({'project_id':_0x33ab03[_0xe552a3(0x189)]?.['id'],'project_name':_0x33ab03[_0xe552a3(0x189)]?.[_0xe552a3(0x1af)],'workflow_id':_0x33ab03[_0xe552a3(0x16a)]?.['id'],'workflow_name':_0x33ab03[_0xe552a3(0x16a)]?.[_0xe552a3(0x1af)],'session_id':_0x33ab03[_0xe552a3(0x188)],'sessionUuid':_0x33ab03[_0xe552a3(0x199)],'sessionTime':_0x33ab03[_0xe552a3(0x18d)],'attempt_id':_0x33ab03['id'],'attempt_index':_0x33ab03[_0xe552a3(0x169)],'retryAttemptName':_0x33ab03['retryAttemptName'],'done':_0x33ab03[_0xe552a3(0x167)],'success':_0x33ab03['success'],'cancelRequested':_0x33ab03[_0xe552a3(0x18c)],'params':_0x33ab03['params'],'createdAt':_0x33ab03['createdAt'],'finishedAt':_0x33ab03[_0xe552a3(0x18f)],'id':_0x33ab03['id'],'index':_0x33ab03[_0xe552a3(0x169)],'project':_0x33ab03[_0xe552a3(0x189)],'workflow':_0x33ab03['workflow']}));}async[a78_0x570824(0x181)](_0x17e9cf){const _0x1226a8=await this['client']['getAttempt'](_0x17e9cf);return _0x1226a8;}async['tasks'](_0x1a850c,_0x14a544=![]){const _0x33cf36=a78_0x570824,_0x37f565=await this['client'][_0x33cf36(0x161)](_0x1a850c,_0x14a544);return _0x37f565[_0x33cf36(0x179)](_0x3cff6d=>({'task_id':_0x3cff6d['id'],'task_name':_0x3cff6d[_0x33cf36(0x15b)],'parentId':_0x3cff6d[_0x33cf36(0x1a3)],'config':_0x3cff6d[_0x33cf36(0x197)],'upstreams':_0x3cff6d['upstreams'],'state':_0x3cff6d[_0x33cf36(0x173)],'exportParams':_0x3cff6d[_0x33cf36(0x1a0)],'storeParams':_0x3cff6d[_0x33cf36(0x15e)],'stateParams':_0x3cff6d['stateParams'],'updatedAt':_0x3cff6d[_0x33cf36(0x165)],'retryAt':_0x3cff6d['retryAt'],'startedAt':_0x3cff6d['startedAt'],'error':_0x3cff6d[_0x33cf36(0x184)],'isGroup':_0x3cff6d[_0x33cf36(0x1c6)],'id':_0x3cff6d['id'],'fullName':_0x3cff6d[_0x33cf36(0x15b)]}));}async[a78_0x570824(0x16b)](_0x2c252b,_0x46d0af){const _0x26301b=a78_0x570824;return await this[_0x26301b(0x198)]['listLogFiles'](_0x2c252b,_0x46d0af);}async[a78_0x570824(0x1a7)](_0x297c91,_0x483e1e){const _0x1079d9=a78_0x570824,_0x83a20c=await import('zlib'),{promisify:_0x463949}=await import(_0x1079d9(0x1ac)),_0x447e56=_0x463949(_0x83a20c[_0x1079d9(0x1be)]),_0x52ffc7=await this['client'][_0x1079d9(0x18a)](_0x297c91,_0x483e1e);if(_0x52ffc7[_0x1079d9(0x19f)]===0x0)return'';const _0x31785b=[];for(const _0x2eaea0 of _0x52ffc7){if(!_0x2eaea0[_0x1079d9(0x15d)])continue;const _0x5134f9=await fetch(_0x2eaea0[_0x1079d9(0x15d)]);if(!_0x5134f9['ok'])throw new Error(_0x1079d9(0x192)+_0x5134f9[_0x1079d9(0x186)]);const _0x1b8d18=Buffer[_0x1079d9(0x1b4)](await _0x5134f9[_0x1079d9(0x1a5)]()),_0xd5f55f=await _0x447e56(_0x1b8d18);_0x31785b[_0x1079d9(0x1b3)](_0xd5f55f[_0x1079d9(0x156)]('utf-8'));}return _0x31785b['join']('\x0a');}async[a78_0x570824(0x175)](_0x5c5d7e,_0x5d313e){const _0x59fce2=a78_0x570824,_0x45f743=await this[_0x59fce2(0x198)][_0x59fce2(0x1b2)](_0x5c5d7e,_0x5d313e);return _0x45f743?.[_0x59fce2(0x15a)]??_0x59fce2(0x185);}async[a78_0x570824(0x187)](_0x2f6182,_0x592fcc){const _0x49ebc3=a78_0x570824,_0x36a484=await this[_0x49ebc3(0x198)][_0x49ebc3(0x187)](_0x2f6182,{'from_task':_0x592fcc?.[_0x49ebc3(0x16f)],'retry_params':_0x592fcc?.[_0x49ebc3(0x17b)]});return{'attemptId':_0x36a484['id'],'sessionId':_0x36a484[_0x49ebc3(0x188)]};}async[a78_0x570824(0x154)](_0x26b6e0,_0x398ef2){const _0x3457b1=a78_0x570824,_0xaa9d76=await this[_0x3457b1(0x198)][_0x3457b1(0x154)](_0x26b6e0,{'resume_from':_0x398ef2?.['resumeFrom'],'retry_params':_0x398ef2?.[_0x3457b1(0x17b)],'force':_0x398ef2?.[_0x3457b1(0x17f)]});return{'attemptId':_0xaa9d76['id'],'sessionId':_0xaa9d76['sessionId']};}async[a78_0x570824(0x1aa)](_0x5886e0,_0x44e7d2={},_0x3c6d96){const _0x6fd4d0=a78_0x570824,_0x5a6100=_0x5886e0['indexOf']('.');let _0x254c45,_0x3e73b1;if(_0x5a6100===-0x1)throw new Error('Workflow\x20must\x20be\x20specified\x20as\x20\x22project.workflow\x22\x20format');_0x254c45=_0x5886e0[_0x6fd4d0(0x1c3)](0x0,_0x5a6100),_0x3e73b1=_0x5886e0[_0x6fd4d0(0x1c3)](_0x5a6100+0x1);if(!_0x254c45||!_0x3e73b1)throw new Error(_0x6fd4d0(0x1a9)+_0x5886e0+_0x6fd4d0(0x180));const _0x5ae325=_0x3c6d96?.[_0x6fd4d0(0x18d)]||new Date()[_0x6fd4d0(0x1c5)]();return await this[_0x6fd4d0(0x198)][_0x6fd4d0(0x193)]({'projectName':_0x254c45,'workflowName':_0x3e73b1,'sessionTime':_0x5ae325,'params':_0x44e7d2});}async[a78_0x570824(0x1c4)](_0x596b9e,_0x3ba536,_0x165041){const _0x1847f5=a78_0x570824,{promises:_0x5490c4}=await import('fs'),_0x1dfd61=await import(_0x1847f5(0x1b8)),_0x425476=await import('os'),_0x49875d=await import(_0x1847f5(0x1a2)),{id:_0x4a51ac,name:_0x39d86a}=await this['resolveProjectId'](_0x596b9e),_0x486ee3=_0x425476[_0x1847f5(0x1ba)](),_0x729959=_0x1dfd61[_0x1847f5(0x16d)](_0x486ee3,'tdx-workflow-'+_0x4a51ac+'-'+Date[_0x1847f5(0x166)]()+_0x1847f5(0x1b7));try{await this[_0x1847f5(0x198)][_0x1847f5(0x16e)](_0x4a51ac,_0x729959,_0x165041?.[_0x1847f5(0x19b)]);const _0x504b79=_0x1dfd61['join'](_0x3ba536,_0x39d86a);await _0x5490c4[_0x1847f5(0x170)](_0x504b79,{'recursive':!![]}),await _0x49875d[_0x1847f5(0x19d)]({'file':_0x729959,'cwd':_0x504b79,'gzip':!![]});const _0x2fdb68=async _0x2f7b0c=>{const _0x48d4bc=_0x1847f5;let _0x4bc6f0=0x0;const _0x423a00=await _0x5490c4[_0x48d4bc(0x155)](_0x2f7b0c,{'withFileTypes':!![]});for(const _0x2033dc of _0x423a00){const _0x368b5f=_0x1dfd61[_0x48d4bc(0x16d)](_0x2f7b0c,_0x2033dc[_0x48d4bc(0x1af)]);if(_0x2033dc[_0x48d4bc(0x1c7)]())_0x4bc6f0++;else _0x2033dc['isDirectory']()&&(_0x4bc6f0+=await _0x2fdb68(_0x368b5f));}return _0x4bc6f0;},_0x5f1b6f=await _0x2fdb68(_0x504b79);return{'projectName':_0x39d86a,'revision':_0x165041?.[_0x1847f5(0x19b)]||_0x1847f5(0x164),'filesExtracted':_0x5f1b6f};}finally{try{await _0x5490c4[_0x1847f5(0x1b5)](_0x729959);}catch{}}}async['push'](_0x3b2151,_0x2d2cb8){const _0x1cfdb9=a78_0x570824,{promises:_0x3173ac}=await import('fs'),_0x74a5f2=await import(_0x1cfdb9(0x1b8)),_0x4436f7=await import(_0x1cfdb9(0x1a2)),_0x216dd9=_0x2d2cb8?.[_0x1cfdb9(0x195)]||_0x74a5f2[_0x1cfdb9(0x18b)](_0x3b2151),_0x56e4c4=_0x2d2cb8?.[_0x1cfdb9(0x19b)]||new Date()[_0x1cfdb9(0x1c5)]()[_0x1cfdb9(0x1a6)](/[:.]/g,'-');try{await _0x3173ac[_0x1cfdb9(0x1ad)](_0x3b2151);}catch{throw new Error(_0x1cfdb9(0x19a)+_0x3b2151);}if(!_0x2d2cb8?.[_0x1cfdb9(0x1ab)]){const _0x5149c4=await _0x3173ac[_0x1cfdb9(0x155)](_0x3b2151),_0x1bac50=_0x5149c4['filter'](_0x274e9b=>_0x274e9b[_0x1cfdb9(0x160)](WORKFLOW_FILE_EXTENSION));if(_0x1bac50[_0x1cfdb9(0x19f)]===0x0)throw new Error('No\x20'+WORKFLOW_FILE_EXTENSION+_0x1cfdb9(0x1ae));for(const _0x4470f6 of _0x1bac50){const _0xbc53c1=_0x74a5f2[_0x1cfdb9(0x16d)](_0x3b2151,_0x4470f6);try{await _0x3173ac[_0x1cfdb9(0x1ad)](_0xbc53c1);}catch{throw new Error(_0x1cfdb9(0x1bb)+_0x4470f6);}}}const _0x55e983=async(_0x34da75,_0x564183='')=>{const _0x5d3696=_0x1cfdb9,_0x31a610=await _0x3173ac[_0x5d3696(0x155)](_0x34da75,{'withFileTypes':!![]}),_0x160c37=[];for(const _0x512997 of _0x31a610){const _0x2e6d6=_0x74a5f2['join'](_0x564183,_0x512997['name']),_0x65d419=_0x74a5f2[_0x5d3696(0x16d)](_0x34da75,_0x512997[_0x5d3696(0x1af)]);if(!shouldIncludeInArchive(_0x512997[_0x5d3696(0x1af)]))continue;_0x512997[_0x5d3696(0x1bc)]()?_0x160c37[_0x5d3696(0x1b3)](...await _0x55e983(_0x65d419,_0x2e6d6)):_0x160c37[_0x5d3696(0x1b3)](_0x2e6d6);}return _0x160c37;},_0x18733b=await _0x55e983(_0x3b2151),_0x2e7639=await import('os'),_0x2cbc5d=_0x2e7639[_0x1cfdb9(0x1ba)](),_0x122d0b=_0x74a5f2['join'](_0x2cbc5d,'tdx-workflow-push-'+Date[_0x1cfdb9(0x166)]()+_0x1cfdb9(0x1b7));try{await _0x4436f7[_0x1cfdb9(0x18e)]({'file':_0x122d0b,'gzip':!![],'cwd':_0x3b2151,'portable':!![]},_0x18733b);const _0x15e85e=await this[_0x1cfdb9(0x198)][_0x1cfdb9(0x191)](_0x216dd9,_0x56e4c4,_0x122d0b,{'scheduleFrom':_0x2d2cb8?.[_0x1cfdb9(0x17a)],'clearSchedule':_0x2d2cb8?.[_0x1cfdb9(0x174)],'clearScheduleAll':_0x2d2cb8?.[_0x1cfdb9(0x19e)]});return{'projectId':_0x15e85e['id'],'projectName':_0x15e85e[_0x1cfdb9(0x1af)],'revision':_0x15e85e[_0x1cfdb9(0x19b)]};}finally{try{await _0x3173ac[_0x1cfdb9(0x1b5)](_0x122d0b);}catch{}}}async[a78_0x570824(0x17e)](_0x1ca695){const _0x2a1eed=a78_0x570824,{id:_0x1af0d6}=await this[_0x2a1eed(0x168)](_0x1ca695),_0x3d8fd2=await this[_0x2a1eed(0x198)][_0x2a1eed(0x176)](_0x1af0d6);return{'projectId':_0x3d8fd2['id'],'projectName':_0x3d8fd2[_0x2a1eed(0x1af)]};}}
@@ -1 +1 @@
1
- function a83_0x2613(){const _0x2e2497=['https://llm-api.treasuredata.co.jp','https://api-staging.us01.treasuredata.com','https://api-cdp.eu01.treasuredata.com','https://llm-api-development.us01.treasuredata.com','https://console-staging-next.us01.treasuredata.com','https://api-cdp.treasuredata.co.jp','174712RUsOBi','.treasuredata.com','14KKYYda','https://engage-api.treasuredata.co.jp','https://llm-api-development.eu01.treasuredata.com','https://engage-api-staging.treasuredata.co.jp','https://api-development-cdp.eu01.treasuredata.com','https://api-presto.treasuredata.co.jp','https://api-staging-workflow.us01.treasuredata.com','https://api-presto.ap02.treasuredata.com','https://api-staging-cdp.treasuredata.co.jp','128475jsTkjY','https://llm-api-staging.us01.treasuredata.com','https://api-presto.treasuredata.com','\x27\x20and\x20site\x20\x27','https://console.ap02.treasuredata.com','https://console.treasuredata.com','https://api-workflow.treasuredata.com','https://llm-api.treasuredata.com','https://engage-api.treasuredata.com','473766kUFcHH','1532WwGhHj','https://console-staging-next.treasuredata.co.jp','736452uXkeyj','https://console-next.ap03.treasuredata.com','https://console-next.us01.treasuredata.com','https://console-next.ap02.treasuredata.com','344bperlM','https://console-development-next.us01.treasuredata.com','https://api-staging-workflow.treasuredata.co.jp','https://engage-api-staging.ap03.treasuredata.com','https://api.ap03.treasuredata.com','https://console-next.eu01.treasuredata.com','https://api-staging-workflow.ap03.treasuredata.com','https://api-development-workflow.eu01.treasuredata.com','https://engage-api-development.eu01.treasuredata.com','https://engage-api.ap02.treasuredata.com','https://api-staging-presto.treasuredata.co.jp','https://api-presto.ap03.treasuredata.com','https://api-development-presto.treasuredata.com','https://api-workflow.ap02.treasuredata.com','https://llm-api.eu01.treasuredata.com','134124SrzXUR','https://api-staging.treasuredata.co.jp','https://console-staging.ap03.treasuredata.com','https://llm-api.ap03.treasuredata.com','https://engage-api-staging.us01.treasuredata.com','https://api-presto.eu01.treasuredata.com','https://console.eu01.treasuredata.com','/tc','https://api-staging.ap03.treasuredata.com','/app/af/','160ptObXy','https://console-next.','https://api.ap02.treasuredata.com','https://llm-api-staging.ap03.treasuredata.com','https://api-development.eu01.treasuredata.com','https://api-staging-presto.ap03.treasuredata.com','https://api-cdp.ap03.treasuredata.com','/ag','https://engage-api.eu01.treasuredata.com','https://llm-api-staging.treasuredata.co.jp','https://api-workflow.ap03.treasuredata.com','https://api-cdp.treasuredata.com','27cRaERC','375386oyLzyZ','https://api-development-workflow.us01.treasuredata.com','https://engage-api.ap03.treasuredata.com'];a83_0x2613=function(){return _0x2e2497;};return a83_0x2613();}const a83_0x12af5=a83_0x4fa9;(function(_0x65c1e6,_0x29ef07){const _0x7c79e6=a83_0x4fa9,_0x431581=_0x65c1e6();while(!![]){try{const _0x5e726b=parseInt(_0x7c79e6(0x100))/0x1*(parseInt(_0x7c79e6(0xfa))/0x2)+parseInt(_0x7c79e6(0x10f))/0x3+parseInt(_0x7c79e6(0xfc))/0x4+-parseInt(_0x7c79e6(0xf0))/0x5+-parseInt(_0x7c79e6(0xf9))/0x6*(-parseInt(_0x7c79e6(0xe7))/0x7)+parseInt(_0x7c79e6(0xe5))/0x8*(parseInt(_0x7c79e6(0xdb))/0x9)+-parseInt(_0x7c79e6(0x119))/0xa*(parseInt(_0x7c79e6(0xdc))/0xb);if(_0x5e726b===_0x29ef07)break;else _0x431581['push'](_0x431581['shift']());}catch(_0x5c59f3){_0x431581['push'](_0x431581['shift']());}}}(a83_0x2613,0x232b5));export const TD_ENDPOINTS={'us01':'https://api.treasuredata.com','jp01':'https://api.treasuredata.co.jp','eu01':'https://api.eu01.treasuredata.com','ap02':a83_0x12af5(0x11b),'ap03':a83_0x12af5(0x104),'dev-us01':'https://api-development.treasuredata.com','dev-eu01':a83_0x12af5(0x11d),'stg-us01':a83_0x12af5(0xe0),'stg-jp01':a83_0x12af5(0x110),'stg-ap03':a83_0x12af5(0x117)};export const CDP_ENDPOINTS={'us01':a83_0x12af5(0xda),'jp01':a83_0x12af5(0xe4),'eu01':a83_0x12af5(0xe1),'ap02':'https://api-cdp.ap02.treasuredata.com','ap03':a83_0x12af5(0x11f),'dev-us01':'https://api-development-cdp.us01.treasuredata.com','dev-eu01':a83_0x12af5(0xeb),'stg-us01':'https://api-staging-cdp.us01.treasuredata.com','stg-jp01':a83_0x12af5(0xef),'stg-ap03':'https://api-staging-cdp.ap03.treasuredata.com'};export const WORKFLOW_ENDPOINTS={'us01':a83_0x12af5(0xf6),'jp01':'https://api-workflow.treasuredata.co.jp','eu01':'https://api-workflow.eu01.treasuredata.com','ap02':a83_0x12af5(0x10d),'ap03':a83_0x12af5(0x123),'dev-us01':a83_0x12af5(0xdd),'dev-eu01':a83_0x12af5(0x107),'stg-us01':a83_0x12af5(0xed),'stg-jp01':a83_0x12af5(0x102),'stg-ap03':a83_0x12af5(0x106)};export const TRINO_ENDPOINTS={'us01':a83_0x12af5(0xf2),'jp01':a83_0x12af5(0xec),'eu01':a83_0x12af5(0x114),'ap02':a83_0x12af5(0xee),'ap03':a83_0x12af5(0x10b),'dev-us01':a83_0x12af5(0x10c),'dev-eu01':'https://api-development-presto.eu01.treasuredata.com','stg-us01':'https://api-staging-presto.treasuredata.com','stg-jp01':a83_0x12af5(0x10a),'stg-ap03':a83_0x12af5(0x11e)};function a83_0x4fa9(_0x401c1f,_0x39abe3){_0x401c1f=_0x401c1f-0xda;const _0x26136e=a83_0x2613();let _0x4fa9b8=_0x26136e[_0x401c1f];return _0x4fa9b8;}export const LLM_ENDPOINTS={'us01':a83_0x12af5(0xf7),'jp01':a83_0x12af5(0xdf),'eu01':a83_0x12af5(0x10e),'ap02':'https://llm-api.ap02.treasuredata.com','ap03':a83_0x12af5(0x112),'dev-us01':a83_0x12af5(0xe2),'dev-eu01':a83_0x12af5(0xe9),'stg-us01':a83_0x12af5(0xf1),'stg-jp01':a83_0x12af5(0x122),'stg-ap03':a83_0x12af5(0x11c)};export const ENGAGE_ENDPOINTS={'us01':a83_0x12af5(0xf8),'jp01':a83_0x12af5(0xe8),'eu01':a83_0x12af5(0x121),'ap02':a83_0x12af5(0x109),'ap03':a83_0x12af5(0xde),'dev-us01':'https://engage-api-development.us01.treasuredata.com','dev-eu01':a83_0x12af5(0x108),'stg-us01':a83_0x12af5(0x113),'stg-jp01':a83_0x12af5(0xea),'stg-ap03':a83_0x12af5(0x103)};export const CONSOLE_ENDPOINTS={'us01':a83_0x12af5(0xf5),'jp01':'https://console.treasuredata.co.jp','eu01':a83_0x12af5(0x115),'ap02':a83_0x12af5(0xf4),'ap03':'https://console.ap03.treasuredata.com','dev-us01':'https://console-development.treasuredata.com','dev-eu01':'https://console-development.eu01.treasuredata.com','stg-us01':'https://console-staging.us01.treasuredata.com','stg-jp01':'https://console-staging.treasuredata.co.jp','stg-ap03':a83_0x12af5(0x111)};export const CONSOLE_NEXT_ENDPOINTS={'us01':a83_0x12af5(0xfe),'jp01':'https://console-next.treasuredata.co.jp','eu01':a83_0x12af5(0x105),'ap02':a83_0x12af5(0xff),'ap03':a83_0x12af5(0xfd),'dev-us01':a83_0x12af5(0x101),'dev-eu01':'https://console-development-next.eu01.treasuredata.com','stg-us01':a83_0x12af5(0xe3),'stg-jp01':a83_0x12af5(0xfb),'stg-ap03':'https://console-staging-next.ap03.treasuredata.com'};export function getConsoleUrl(_0x2da4,_0x59aafb){const _0x33b39b=CONSOLE_ENDPOINTS[_0x2da4]||'https://console.'+_0x2da4+'.treasuredata.com';return _0x59aafb?''+_0x33b39b+_0x59aafb:_0x33b39b;}export function getConsoleNextUrl(_0x3d69b9,_0x2d97af){const _0x36e3a6=a83_0x12af5,_0x5c2c23=CONSOLE_NEXT_ENDPOINTS[_0x3d69b9]||_0x36e3a6(0x11a)+_0x3d69b9+_0x36e3a6(0xe6);return _0x2d97af?''+_0x5c2c23+_0x2d97af:_0x5c2c23;}export function getLLMProjectUrl(_0x33baeb,_0x18e738){const _0x2437b2=a83_0x12af5;return getConsoleNextUrl(_0x33baeb,_0x2437b2(0x118)+_0x18e738+_0x2437b2(0x120));}export function getLLMAgentChatUrl(_0x5873f0,_0x764279,_0x3fe01e){const _0x133322=a83_0x12af5;return getConsoleNextUrl(_0x5873f0,_0x133322(0x118)+_0x764279+'/ag/'+_0x3fe01e+_0x133322(0x116));}export const API_ENDPOINTS={'td':TD_ENDPOINTS,'cdp':CDP_ENDPOINTS,'workflow':WORKFLOW_ENDPOINTS,'trino':TRINO_ENDPOINTS,'llm':LLM_ENDPOINTS,'engage':ENGAGE_ENDPOINTS};export function getEndpoint(_0x2472eb,_0x1b615f='td'){const _0x186b5a=a83_0x12af5,_0x57b249=API_ENDPOINTS[_0x1b615f]?.[_0x2472eb];if(!_0x57b249)throw new Error('No\x20endpoint\x20defined\x20for\x20API\x20type\x20\x27'+_0x1b615f+_0x186b5a(0xf3)+_0x2472eb+'\x27');return _0x57b249;}
1
+ const a83_0x4fb2f1=a83_0x1a9c;(function(_0x4d3fdc,_0x50f48d){const _0x4f2b29=a83_0x1a9c,_0x3aba58=_0x4d3fdc();while(!![]){try{const _0x5e736c=parseInt(_0x4f2b29(0xe7))/0x1+-parseInt(_0x4f2b29(0xfb))/0x2*(-parseInt(_0x4f2b29(0x123))/0x3)+parseInt(_0x4f2b29(0x113))/0x4+parseInt(_0x4f2b29(0xd9))/0x5*(-parseInt(_0x4f2b29(0xd8))/0x6)+-parseInt(_0x4f2b29(0xfe))/0x7*(parseInt(_0x4f2b29(0xd5))/0x8)+-parseInt(_0x4f2b29(0xe8))/0x9+-parseInt(_0x4f2b29(0x11d))/0xa*(-parseInt(_0x4f2b29(0xd6))/0xb);if(_0x5e736c===_0x50f48d)break;else _0x3aba58['push'](_0x3aba58['shift']());}catch(_0x4a7ec0){_0x3aba58['push'](_0x3aba58['shift']());}}}(a83_0x3c25,0x1e46f));export const TD_ENDPOINTS={'us01':a83_0x4fb2f1(0x110),'jp01':'https://api.treasuredata.co.jp','eu01':a83_0x4fb2f1(0x10d),'ap02':a83_0x4fb2f1(0xea),'ap03':a83_0x4fb2f1(0xed),'dev-us01':a83_0x4fb2f1(0xf1),'dev-eu01':a83_0x4fb2f1(0x101),'stg-us01':a83_0x4fb2f1(0xde),'stg-jp01':a83_0x4fb2f1(0x11a),'stg-ap03':'https://api-staging.ap03.treasuredata.com'};export const CDP_ENDPOINTS={'us01':'https://api-cdp.treasuredata.com','jp01':a83_0x4fb2f1(0x116),'eu01':a83_0x4fb2f1(0xe6),'ap02':a83_0x4fb2f1(0x108),'ap03':a83_0x4fb2f1(0x10e),'dev-us01':'https://api-development-cdp.us01.treasuredata.com','dev-eu01':a83_0x4fb2f1(0x10a),'stg-us01':a83_0x4fb2f1(0x109),'stg-jp01':a83_0x4fb2f1(0xff),'stg-ap03':'https://api-staging-cdp.ap03.treasuredata.com'};export const WORKFLOW_ENDPOINTS={'us01':a83_0x4fb2f1(0x115),'jp01':a83_0x4fb2f1(0x118),'eu01':a83_0x4fb2f1(0x10c),'ap02':a83_0x4fb2f1(0x10b),'ap03':'https://api-workflow.ap03.treasuredata.com','dev-us01':a83_0x4fb2f1(0x126),'dev-eu01':a83_0x4fb2f1(0xeb),'stg-us01':a83_0x4fb2f1(0xfd),'stg-jp01':a83_0x4fb2f1(0x120),'stg-ap03':'https://api-staging-workflow.ap03.treasuredata.com'};export const TRINO_ENDPOINTS={'us01':a83_0x4fb2f1(0xdb),'jp01':'https://api-presto.treasuredata.co.jp','eu01':'https://api-presto.eu01.treasuredata.com','ap02':a83_0x4fb2f1(0xe5),'ap03':a83_0x4fb2f1(0xef),'dev-us01':'https://api-development-presto.treasuredata.com','dev-eu01':a83_0x4fb2f1(0x105),'stg-us01':a83_0x4fb2f1(0x11c),'stg-jp01':a83_0x4fb2f1(0xf3),'stg-ap03':a83_0x4fb2f1(0xe4)};export const LLM_ENDPOINTS={'us01':a83_0x4fb2f1(0xec),'jp01':a83_0x4fb2f1(0xe0),'eu01':a83_0x4fb2f1(0xdc),'ap02':a83_0x4fb2f1(0xd4),'ap03':a83_0x4fb2f1(0xee),'dev-us01':a83_0x4fb2f1(0xd7),'dev-eu01':a83_0x4fb2f1(0x106),'stg-us01':a83_0x4fb2f1(0xda),'stg-jp01':a83_0x4fb2f1(0x119),'stg-ap03':a83_0x4fb2f1(0xfc)};export const ENGAGE_ENDPOINTS={'us01':a83_0x4fb2f1(0x125),'jp01':a83_0x4fb2f1(0xf2),'eu01':a83_0x4fb2f1(0x111),'ap02':a83_0x4fb2f1(0x11f),'ap03':'https://engage-api.ap03.treasuredata.com','dev-us01':a83_0x4fb2f1(0x121),'dev-eu01':'https://engage-api-development.eu01.treasuredata.com','stg-us01':a83_0x4fb2f1(0x124),'stg-jp01':'https://engage-api-staging.treasuredata.co.jp','stg-ap03':a83_0x4fb2f1(0x104)};export const CONSOLE_ENDPOINTS={'us01':'https://console.treasuredata.com','jp01':a83_0x4fb2f1(0x117),'eu01':a83_0x4fb2f1(0x114),'ap02':a83_0x4fb2f1(0x11e),'ap03':a83_0x4fb2f1(0xe1),'dev-us01':a83_0x4fb2f1(0xfa),'dev-eu01':a83_0x4fb2f1(0xe9),'stg-us01':a83_0x4fb2f1(0xe2),'stg-jp01':a83_0x4fb2f1(0x100),'stg-ap03':a83_0x4fb2f1(0xf7)};export const CONSOLE_NEXT_ENDPOINTS={'us01':a83_0x4fb2f1(0x10f),'jp01':a83_0x4fb2f1(0x11b),'eu01':'https://console-next.eu01.treasuredata.com','ap02':a83_0x4fb2f1(0xf6),'ap03':a83_0x4fb2f1(0xf4),'dev-us01':'https://console-development-next.us01.treasuredata.com','dev-eu01':a83_0x4fb2f1(0x102),'stg-us01':a83_0x4fb2f1(0x122),'stg-jp01':a83_0x4fb2f1(0xf8),'stg-ap03':a83_0x4fb2f1(0xf9)};function a83_0x1a9c(_0x3e8594,_0x569ae7){_0x3e8594=_0x3e8594-0xd4;const _0x3c2590=a83_0x3c25();let _0x1a9c99=_0x3c2590[_0x3e8594];return _0x1a9c99;}export function getConsoleUrl(_0x201460,_0x8dbcbd){const _0x6a6a26=a83_0x4fb2f1,_0x5b485e=CONSOLE_ENDPOINTS[_0x201460]||_0x6a6a26(0x103)+_0x201460+_0x6a6a26(0xdf);return _0x8dbcbd?''+_0x5b485e+_0x8dbcbd:_0x5b485e;}export function getConsoleNextUrl(_0x5f145f,_0x5cb15e){const _0xe73a4b=a83_0x4fb2f1,_0x1d0e94=CONSOLE_NEXT_ENDPOINTS[_0x5f145f]||_0xe73a4b(0xdd)+_0x5f145f+_0xe73a4b(0xdf);return _0x5cb15e?''+_0x1d0e94+_0x5cb15e:_0x1d0e94;}export function getLLMProjectUrl(_0x464fb3,_0x372068){const _0x35aa0f=a83_0x4fb2f1;return getConsoleNextUrl(_0x464fb3,_0x35aa0f(0xf5)+_0x372068+'/ag');}export function getLLMAgentChatUrl(_0x6ecd4b,_0x45318c,_0x2a775e){const _0x1c98a7=a83_0x4fb2f1;return getConsoleNextUrl(_0x6ecd4b,_0x1c98a7(0xf5)+_0x45318c+_0x1c98a7(0x112)+_0x2a775e+_0x1c98a7(0x107));}export const API_ENDPOINTS={'td':TD_ENDPOINTS,'cdp':CDP_ENDPOINTS,'workflow':WORKFLOW_ENDPOINTS,'trino':TRINO_ENDPOINTS,'llm':LLM_ENDPOINTS,'engage':ENGAGE_ENDPOINTS};export function getEndpoint(_0x5ee9d0,_0x358cc8='td'){const _0x12dab2=a83_0x4fb2f1,_0x57c089=API_ENDPOINTS[_0x358cc8]?.[_0x5ee9d0];if(!_0x57c089)throw new Error(_0x12dab2(0xf0)+_0x358cc8+_0x12dab2(0xe3)+_0x5ee9d0+'\x27');return _0x57c089;}function a83_0x3c25(){const _0x3d66ee=['https://llm-api-development.us01.treasuredata.com','18NJdSJP','19115rrFOwE','https://llm-api-staging.us01.treasuredata.com','https://api-presto.treasuredata.com','https://llm-api.eu01.treasuredata.com','https://console-next.','https://api-staging.us01.treasuredata.com','.treasuredata.com','https://llm-api.treasuredata.co.jp','https://console.ap03.treasuredata.com','https://console-staging.us01.treasuredata.com','\x27\x20and\x20site\x20\x27','https://api-staging-presto.ap03.treasuredata.com','https://api-presto.ap02.treasuredata.com','https://api-cdp.eu01.treasuredata.com','1891vuwnzq','2044971IXmmDz','https://console-development.eu01.treasuredata.com','https://api.ap02.treasuredata.com','https://api-development-workflow.eu01.treasuredata.com','https://llm-api.treasuredata.com','https://api.ap03.treasuredata.com','https://llm-api.ap03.treasuredata.com','https://api-presto.ap03.treasuredata.com','No\x20endpoint\x20defined\x20for\x20API\x20type\x20\x27','https://api-development.treasuredata.com','https://engage-api.treasuredata.co.jp','https://api-staging-presto.treasuredata.co.jp','https://console-next.ap03.treasuredata.com','/app/af/','https://console-next.ap02.treasuredata.com','https://console-staging.ap03.treasuredata.com','https://console-staging-next.treasuredata.co.jp','https://console-staging-next.ap03.treasuredata.com','https://console-development.treasuredata.com','17592mzqNZK','https://llm-api-staging.ap03.treasuredata.com','https://api-staging-workflow.us01.treasuredata.com','7gbDZLQ','https://api-staging-cdp.treasuredata.co.jp','https://console-staging.treasuredata.co.jp','https://api-development.eu01.treasuredata.com','https://console-development-next.eu01.treasuredata.com','https://console.','https://engage-api-staging.ap03.treasuredata.com','https://api-development-presto.eu01.treasuredata.com','https://llm-api-development.eu01.treasuredata.com','/tc','https://api-cdp.ap02.treasuredata.com','https://api-staging-cdp.us01.treasuredata.com','https://api-development-cdp.eu01.treasuredata.com','https://api-workflow.ap02.treasuredata.com','https://api-workflow.eu01.treasuredata.com','https://api.eu01.treasuredata.com','https://api-cdp.ap03.treasuredata.com','https://console-next.us01.treasuredata.com','https://api.treasuredata.com','https://engage-api.eu01.treasuredata.com','/ag/','329228ULJIvb','https://console.eu01.treasuredata.com','https://api-workflow.treasuredata.com','https://api-cdp.treasuredata.co.jp','https://console.treasuredata.co.jp','https://api-workflow.treasuredata.co.jp','https://llm-api-staging.treasuredata.co.jp','https://api-staging.treasuredata.co.jp','https://console-next.treasuredata.co.jp','https://api-staging-presto.treasuredata.com','7600tAYduE','https://console.ap02.treasuredata.com','https://engage-api.ap02.treasuredata.com','https://api-staging-workflow.treasuredata.co.jp','https://engage-api-development.us01.treasuredata.com','https://console-staging-next.us01.treasuredata.com','78sDSBxW','https://engage-api-staging.us01.treasuredata.com','https://engage-api.treasuredata.com','https://api-development-workflow.us01.treasuredata.com','https://llm-api.ap02.treasuredata.com','1237048kNpLZZ','2959tzTufm'];a83_0x3c25=function(){return _0x3d66ee;};return a83_0x3c25();}
@@ -1 +1 @@
1
- function a85_0x4685(){const _0x86d098=['510WEWICp','jp01','5649TQEgFH','stg-us01','607554cZyXHg','2884316njPBER','6574552trOmev','dev-us01','9dOWBdo','5AyfhDz','us01','1090356JsDWcv','4457593YDgjhy','7023560Nedccc'];a85_0x4685=function(){return _0x86d098;};return a85_0x4685();}function a85_0x5c6e(_0x4962af,_0x264662){_0x4962af=_0x4962af-0x19b;const _0x468524=a85_0x4685();let _0x5c6e93=_0x468524[_0x4962af];return _0x5c6e93;}const a85_0x3ddeb2=a85_0x5c6e;(function(_0x2c8b02,_0xc03783){const _0xddd766=a85_0x5c6e,_0x3fa068=_0x2c8b02();while(!![]){try{const _0x5771f9=-parseInt(_0xddd766(0x1a1))/0x1+-parseInt(_0xddd766(0x19d))/0x2*(parseInt(_0xddd766(0x19f))/0x3)+-parseInt(_0xddd766(0x1a2))/0x4*(-parseInt(_0xddd766(0x1a6))/0x5)+parseInt(_0xddd766(0x1a8))/0x6+parseInt(_0xddd766(0x19b))/0x7+-parseInt(_0xddd766(0x1a3))/0x8*(-parseInt(_0xddd766(0x1a5))/0x9)+-parseInt(_0xddd766(0x19c))/0xa;if(_0x5771f9===_0xc03783)break;else _0x3fa068['push'](_0x3fa068['shift']());}catch(_0x54ddfa){_0x3fa068['push'](_0x3fa068['shift']());}}}(a85_0x4685,0x8b7d4));export const SITE_ALIASES={'us':a85_0x3ddeb2(0x1a7),'aws':a85_0x3ddeb2(0x1a7),'jp':a85_0x3ddeb2(0x19e),'aws-tokyo':a85_0x3ddeb2(0x19e),'dev':a85_0x3ddeb2(0x1a4),'stg':a85_0x3ddeb2(0x1a0)};export{getEndpoint,API_ENDPOINTS}from'./endpoints.js';
1
+ const a85_0x4b775d=a85_0xa35b;(function(_0x34b8ad,_0x35ab4e){const _0x579ea9=a85_0xa35b,_0x4c62e1=_0x34b8ad();while(!![]){try{const _0x597bdc=-parseInt(_0x579ea9(0xe0))/0x1+-parseInt(_0x579ea9(0xde))/0x2*(-parseInt(_0x579ea9(0xe1))/0x3)+parseInt(_0x579ea9(0xe2))/0x4*(parseInt(_0x579ea9(0xea))/0x5)+-parseInt(_0x579ea9(0xe6))/0x6*(-parseInt(_0x579ea9(0xe4))/0x7)+-parseInt(_0x579ea9(0xe5))/0x8*(-parseInt(_0x579ea9(0xe7))/0x9)+parseInt(_0x579ea9(0xdf))/0xa+-parseInt(_0x579ea9(0xeb))/0xb*(parseInt(_0x579ea9(0xe9))/0xc);if(_0x597bdc===_0x35ab4e)break;else _0x4c62e1['push'](_0x4c62e1['shift']());}catch(_0x4575b1){_0x4c62e1['push'](_0x4c62e1['shift']());}}}(a85_0x18ae,0xf05ac));export const SITE_ALIASES={'us':'us01','aws':a85_0x4b775d(0xdc),'jp':a85_0x4b775d(0xe8),'aws-tokyo':'jp01','dev':a85_0x4b775d(0xdd),'stg':a85_0x4b775d(0xe3)};function a85_0xa35b(_0x1bf09a,_0x549e4c){_0x1bf09a=_0x1bf09a-0xdc;const _0x18aeae=a85_0x18ae();let _0xa35b11=_0x18aeae[_0x1bf09a];return _0xa35b11;}function a85_0x18ae(){const _0x325fb3=['107592zndnAv','55QsRPdv','2398IBpXkZ','us01','dev-us01','6298JEpnyo','12553000jlmVyO','1808132CLavsV','882THwDBD','405976wWPNei','stg-us01','119LTdZus','9057032WoRMpA','112074xoKoJS','9mDNXXN','jp01'];a85_0x18ae=function(){return _0x325fb3;};return a85_0x18ae();}export{getEndpoint,API_ENDPOINTS}from'./endpoints.js';
@@ -1 +1 @@
1
- const a90_0x1a524b=a90_0x2935;(function(_0x3554fe,_0x39c6c5){const _0x1b67c2=a90_0x2935,_0x5a3dc2=_0x3554fe();while(!![]){try{const _0x294daa=-parseInt(_0x1b67c2(0x149))/0x1*(parseInt(_0x1b67c2(0x14b))/0x2)+-parseInt(_0x1b67c2(0x15e))/0x3+-parseInt(_0x1b67c2(0x14f))/0x4+parseInt(_0x1b67c2(0x160))/0x5*(-parseInt(_0x1b67c2(0x14e))/0x6)+parseInt(_0x1b67c2(0x152))/0x7*(-parseInt(_0x1b67c2(0x15a))/0x8)+-parseInt(_0x1b67c2(0x165))/0x9*(-parseInt(_0x1b67c2(0x155))/0xa)+parseInt(_0x1b67c2(0x164))/0xb*(parseInt(_0x1b67c2(0x14c))/0xc);if(_0x294daa===_0x39c6c5)break;else _0x5a3dc2['push'](_0x5a3dc2['shift']());}catch(_0x4a9fbd){_0x5a3dc2['push'](_0x5a3dc2['shift']());}}}(a90_0x3970,0xdff38));import{existsSync,readFileSync}from'fs';import a90_0x360ef0 from'path';const TDX_CONFIG_FILE='tdx.json',AGENTS_DIR='agents';export function findAgentConfigPath(_0x2239c2=process[a90_0x1a524b(0x162)]()){const _0x1f1643=a90_0x1a524b;let _0x5e3aab=a90_0x360ef0[_0x1f1643(0x147)](_0x2239c2);const _0x5e9f81=a90_0x360ef0['parse'](_0x5e3aab)['root'];while(_0x5e3aab!==_0x5e9f81){const _0x4ab7cc=a90_0x360ef0[_0x1f1643(0x14d)](_0x5e3aab,TDX_CONFIG_FILE);if(existsSync(_0x4ab7cc))try{const _0x1c621b=readFileSync(_0x4ab7cc,_0x1f1643(0x15f)),_0x2ec459=JSON['parse'](_0x1c621b);if(_0x2ec459[_0x1f1643(0x15d)])return _0x4ab7cc;}catch{}_0x5e3aab=a90_0x360ef0[_0x1f1643(0x148)](_0x5e3aab);}return null;}export function loadAgentConfig(_0x427fde){const _0x3bbb05=a90_0x1a524b,_0x4aa05c=readFileSync(_0x427fde,'utf-8');let _0x4b0c1f;try{_0x4b0c1f=JSON[_0x3bbb05(0x159)](_0x4aa05c);}catch{throw new Error(_0x3bbb05(0x158)+_0x427fde);}if(!_0x4b0c1f||typeof _0x4b0c1f!==_0x3bbb05(0x14a))throw new Error(_0x3bbb05(0x153));const _0x58fbd5=_0x4b0c1f;if(!_0x58fbd5['llm_project']||typeof _0x58fbd5[_0x3bbb05(0x15d)]!=='string')throw new Error(_0x3bbb05(0x163));return{'llm_project':_0x58fbd5[_0x3bbb05(0x15d)]};}export function findAgentConfig(_0x11e9e7=process[a90_0x1a524b(0x162)]()){const _0x3c639e=a90_0x1a524b,_0x16a63f=findAgentConfigPath(_0x11e9e7);if(!_0x16a63f)throw new Error(_0x3c639e(0x15c));const _0x45e523=loadAgentConfig(_0x16a63f),_0x57faa7=a90_0x360ef0['dirname'](_0x16a63f);return{'config':_0x45e523,'configPath':_0x16a63f,'configDir':_0x57faa7};}export function getAgentProjectDir(_0x322a7b,_0x20a5ba=process[a90_0x1a524b(0x162)]()){return a90_0x360ef0['join'](_0x20a5ba,AGENTS_DIR,_0x322a7b);}function a90_0x3970(){const _0x504389=['llm_project','4163193cJxJqK','utf-8','1509615JItZUY','agent.yml','cwd','Invalid\x20tdx.json:\x20missing\x20or\x20invalid\x20\x27llm_project\x27\x20field','12516966rZqQyW','567YlGnko','resolve','dirname','37keDihs','object','12302EeSvgx','24NNLpoR','join','6stDoSD','1166408DRYtIf','KNOWLEDGE_BASES','INTEGRATIONS','1196818dCXjUE','Invalid\x20tdx.json:\x20expected\x20object','stringify','216390zTBLzF','PROMPTS','integrations','Invalid\x20JSON\x20in\x20','parse','24bBTFLV','knowledge_bases','No\x20agent\x20tdx.json\x20found.\x20Please\x20run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'];a90_0x3970=function(){return _0x504389;};return a90_0x3970();}function a90_0x2935(_0xf98212,_0x55418b){_0xf98212=_0xf98212-0x147;const _0x397070=a90_0x3970();let _0x2935a=_0x397070[_0xf98212];return _0x2935a;}export function getAgentConfigPath(_0x1056f5,_0x460b36=process[a90_0x1a524b(0x162)]()){const _0x1bc045=a90_0x1a524b;return a90_0x360ef0[_0x1bc045(0x14d)](getAgentProjectDir(_0x1056f5,_0x460b36),TDX_CONFIG_FILE);}export function createAgentConfigContent(_0xe1d10){const _0xcf6df=a90_0x1a524b,_0x39cd7b={'llm_project':_0xe1d10};return JSON[_0xcf6df(0x154)](_0x39cd7b,null,0x2)+'\x0a';}export function isAgentDir(_0x1f142d){const _0x379e2f=a90_0x1a524b;return existsSync(a90_0x360ef0[_0x379e2f(0x14d)](_0x1f142d,_0x379e2f(0x161)));}export function isAgentYamlPath(_0x17bd39){const _0x3236f4=a90_0x1a524b;return a90_0x360ef0['basename'](_0x17bd39)===_0x3236f4(0x161);}export function getAgentDirFromYamlPath(_0x355d8b){const _0x18901a=a90_0x1a524b;return a90_0x360ef0[_0x18901a(0x148)](_0x355d8b);}export const PROJECT_SUBDIRS={'KNOWLEDGE_BASES':a90_0x1a524b(0x15b),'PROMPTS':'prompts','INTEGRATIONS':a90_0x1a524b(0x157)};export function getKnowledgeBasesDir(_0x4fa41f){const _0x4b143a=a90_0x1a524b;return a90_0x360ef0[_0x4b143a(0x14d)](_0x4fa41f,PROJECT_SUBDIRS[_0x4b143a(0x150)]);}export function getPromptsDir(_0x401ff9){const _0x3686aa=a90_0x1a524b;return a90_0x360ef0[_0x3686aa(0x14d)](_0x401ff9,PROJECT_SUBDIRS[_0x3686aa(0x156)]);}export function getIntegrationsDir(_0x18b082){const _0xb0d8de=a90_0x1a524b;return a90_0x360ef0[_0xb0d8de(0x14d)](_0x18b082,PROJECT_SUBDIRS[_0xb0d8de(0x151)]);}
1
+ const a90_0x3d87b6=a90_0x5b34;(function(_0xe5d033,_0x2ee248){const _0x3a56bb=a90_0x5b34,_0xa34ce0=_0xe5d033();while(!![]){try{const _0x3748c4=parseInt(_0x3a56bb(0xa1))/0x1*(-parseInt(_0x3a56bb(0x92))/0x2)+parseInt(_0x3a56bb(0x94))/0x3+parseInt(_0x3a56bb(0xa6))/0x4+-parseInt(_0x3a56bb(0xa4))/0x5+-parseInt(_0x3a56bb(0xa7))/0x6*(-parseInt(_0x3a56bb(0x91))/0x7)+-parseInt(_0x3a56bb(0x9d))/0x8+-parseInt(_0x3a56bb(0xaa))/0x9*(-parseInt(_0x3a56bb(0xae))/0xa);if(_0x3748c4===_0x2ee248)break;else _0xa34ce0['push'](_0xa34ce0['shift']());}catch(_0x41a63f){_0xa34ce0['push'](_0xa34ce0['shift']());}}}(a90_0x9478,0x834b0));function a90_0x5b34(_0x261308,_0x54d36){_0x261308=_0x261308-0x91;const _0x9478de=a90_0x9478();let _0x5b3491=_0x9478de[_0x261308];return _0x5b3491;}import{existsSync,readFileSync}from'fs';import a90_0x13a302 from'path';const TDX_CONFIG_FILE=a90_0x3d87b6(0x9a),AGENTS_DIR=a90_0x3d87b6(0x9f);function a90_0x9478(){const _0x4ff4ec=['1475845GAkBna','2zyzjGu','object','1470108ybxLLS','Invalid\x20JSON\x20in\x20','No\x20agent\x20tdx.json\x20found.\x20Please\x20run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','utf-8','cwd','basename','tdx.json','agent.yml','join','5901688qJApjP','integrations','agents','INTEGRATIONS','275486PgYvSr','KNOWLEDGE_BASES','llm_project','5149555WEcGez','resolve','3684264WDXUWA','6IUpDVr','knowledge_bases','string','784593VtBpYY','parse','dirname','PROMPTS','110JHfeeb'];a90_0x9478=function(){return _0x4ff4ec;};return a90_0x9478();}export function findAgentConfigPath(_0x1bf74f=process['cwd']()){const _0xaf49ed=a90_0x3d87b6;let _0x396e5d=a90_0x13a302[_0xaf49ed(0xa5)](_0x1bf74f);const _0x57dbef=a90_0x13a302['parse'](_0x396e5d)['root'];while(_0x396e5d!==_0x57dbef){const _0x1fcbe1=a90_0x13a302['join'](_0x396e5d,TDX_CONFIG_FILE);if(existsSync(_0x1fcbe1))try{const _0x3c36e3=readFileSync(_0x1fcbe1,_0xaf49ed(0x97)),_0x481516=JSON['parse'](_0x3c36e3);if(_0x481516[_0xaf49ed(0xa3)])return _0x1fcbe1;}catch{}_0x396e5d=a90_0x13a302[_0xaf49ed(0xac)](_0x396e5d);}return null;}export function loadAgentConfig(_0x1b3344){const _0x2870da=a90_0x3d87b6,_0x280e68=readFileSync(_0x1b3344,'utf-8');let _0x1e5a2f;try{_0x1e5a2f=JSON[_0x2870da(0xab)](_0x280e68);}catch{throw new Error(_0x2870da(0x95)+_0x1b3344);}if(!_0x1e5a2f||typeof _0x1e5a2f!==_0x2870da(0x93))throw new Error('Invalid\x20tdx.json:\x20expected\x20object');const _0x5637b8=_0x1e5a2f;if(!_0x5637b8['llm_project']||typeof _0x5637b8[_0x2870da(0xa3)]!==_0x2870da(0xa9))throw new Error('Invalid\x20tdx.json:\x20missing\x20or\x20invalid\x20\x27llm_project\x27\x20field');return{'llm_project':_0x5637b8[_0x2870da(0xa3)]};}export function findAgentConfig(_0xe9be38=process[a90_0x3d87b6(0x98)]()){const _0x335e93=a90_0x3d87b6,_0x557fdb=findAgentConfigPath(_0xe9be38);if(!_0x557fdb)throw new Error(_0x335e93(0x96));const _0xe427a0=loadAgentConfig(_0x557fdb),_0x54375f=a90_0x13a302[_0x335e93(0xac)](_0x557fdb);return{'config':_0xe427a0,'configPath':_0x557fdb,'configDir':_0x54375f};}export function getAgentProjectDir(_0x2845a1,_0x5433d8=process[a90_0x3d87b6(0x98)]()){const _0xb1955=a90_0x3d87b6;return a90_0x13a302[_0xb1955(0x9c)](_0x5433d8,AGENTS_DIR,_0x2845a1);}export function getAgentConfigPath(_0x22884c,_0x6f090d=process[a90_0x3d87b6(0x98)]()){const _0x3df5d4=a90_0x3d87b6;return a90_0x13a302[_0x3df5d4(0x9c)](getAgentProjectDir(_0x22884c,_0x6f090d),TDX_CONFIG_FILE);}export function createAgentConfigContent(_0x535934){const _0xc91b4c={'llm_project':_0x535934};return JSON['stringify'](_0xc91b4c,null,0x2)+'\x0a';}export function isAgentDir(_0x2ff061){const _0x1d26a1=a90_0x3d87b6;return existsSync(a90_0x13a302[_0x1d26a1(0x9c)](_0x2ff061,_0x1d26a1(0x9b)));}export function isAgentYamlPath(_0x3f3c1a){const _0x23475f=a90_0x3d87b6;return a90_0x13a302[_0x23475f(0x99)](_0x3f3c1a)===_0x23475f(0x9b);}export function getAgentDirFromYamlPath(_0x13d8af){const _0x3c5150=a90_0x3d87b6;return a90_0x13a302[_0x3c5150(0xac)](_0x13d8af);}export const PROJECT_SUBDIRS={'KNOWLEDGE_BASES':a90_0x3d87b6(0xa8),'PROMPTS':'prompts','INTEGRATIONS':a90_0x3d87b6(0x9e)};export function getKnowledgeBasesDir(_0x1feba3){const _0x1a7ce0=a90_0x3d87b6;return a90_0x13a302['join'](_0x1feba3,PROJECT_SUBDIRS[_0x1a7ce0(0xa2)]);}export function getPromptsDir(_0x449c94){const _0x2b750a=a90_0x3d87b6;return a90_0x13a302['join'](_0x449c94,PROJECT_SUBDIRS[_0x2b750a(0xad)]);}export function getIntegrationsDir(_0x438287){const _0x183123=a90_0x3d87b6;return a90_0x13a302['join'](_0x438287,PROJECT_SUBDIRS[_0x183123(0xa0)]);}
@@ -1 +1 @@
1
- (function(_0x347087,_0x476fb1){const _0xc9d2b5=a91_0x1ff8,_0x36737c=_0x347087();while(!![]){try{const _0x4c6ab0=-parseInt(_0xc9d2b5(0xc4))/0x1*(-parseInt(_0xc9d2b5(0xc8))/0x2)+parseInt(_0xc9d2b5(0xbb))/0x3*(-parseInt(_0xc9d2b5(0xc3))/0x4)+parseInt(_0xc9d2b5(0xca))/0x5+-parseInt(_0xc9d2b5(0xbc))/0x6*(-parseInt(_0xc9d2b5(0xc6))/0x7)+-parseInt(_0xc9d2b5(0xbf))/0x8+parseInt(_0xc9d2b5(0xc7))/0x9*(parseInt(_0xc9d2b5(0xcb))/0xa)+parseInt(_0xc9d2b5(0xcc))/0xb*(-parseInt(_0xc9d2b5(0xcd))/0xc);if(_0x4c6ab0===_0x476fb1)break;else _0x36737c['push'](_0x36737c['shift']());}catch(_0x3f1cd5){_0x36737c['push'](_0x36737c['shift']());}}}(a91_0x5986,0x9b7f9));export function parseAgentRef(_0x13b316){const _0xbf725=a91_0x1ff8;if(!_0x13b316||_0x13b316[_0xbf725(0xc2)]()==='')throw new Error(_0xbf725(0xbd));const _0x4e5258=_0x13b316['trim'](),_0x296730=_0x4e5258[_0xbf725(0xc9)]('/');if(_0x296730[_0xbf725(0xc5)]===0x1)return{'projectName':_0x296730[0x0],'agentName':undefined};else{if(_0x296730[_0xbf725(0xc5)]===0x2){const [_0x4c4f05,_0xc409b5]=_0x296730;if(!_0x4c4f05||_0x4c4f05['trim']()==='')throw new Error(_0xbf725(0xc1));if(!_0xc409b5||_0xc409b5[_0xbf725(0xc2)]()==='')throw new Error('Agent\x20name\x20cannot\x20be\x20empty');return{'projectName':_0x4c4f05['trim'](),'agentName':_0xc409b5['trim']()};}else throw new Error(_0xbf725(0xc0)+_0x13b316+_0xbf725(0xbe));}}function a91_0x1ff8(_0x58791a,_0x587a1e){_0x58791a=_0x58791a-0xbb;const _0x59862d=a91_0x5986();let _0x1ff8f1=_0x59862d[_0x58791a];return _0x1ff8f1;}function a91_0x5986(){const _0x329a8f=['351246GiahLn','split','1484265AtgyUO','60HQwoqw','11KMOzpO','20719836XGuepk','4869dKrImf','7484292fnJvoA','Agent\x20reference\x20cannot\x20be\x20empty','.\x20Expected\x20\x22project_name\x22\x20or\x20\x22project_name/agent_name\x22','6547512yVkhEN','Invalid\x20agent\x20reference\x20format:\x20','Project\x20name\x20cannot\x20be\x20empty','trim','1052llRdxl','7JaUdIn','length','7QuHjOZ','1252899gUxUFn'];a91_0x5986=function(){return _0x329a8f;};return a91_0x5986();}
1
+ function a91_0x2c0f(){const _0x1c651d=['555agBXki','1532144GYgdyn','419806NAuMqS','length','split','Invalid\x20agent\x20reference\x20format:\x20','91muTMnz','10976kDShwr','Agent\x20reference\x20cannot\x20be\x20empty','117867wENoGK','trim','894165QTQmJO','Project\x20name\x20cannot\x20be\x20empty','2941515fvRXcQ','Agent\x20name\x20cannot\x20be\x20empty','180618oSrrWK'];a91_0x2c0f=function(){return _0x1c651d;};return a91_0x2c0f();}(function(_0x2ad9b7,_0x5bc748){const _0x4e18a4=a91_0x23a6,_0x3f9644=_0x2ad9b7();while(!![]){try{const _0x1b10fb=parseInt(_0x4e18a4(0xa3))/0x1+parseInt(_0x4e18a4(0x9c))/0x2+-parseInt(_0x4e18a4(0xa5))/0x3+parseInt(_0x4e18a4(0xa1))/0x4*(-parseInt(_0x4e18a4(0x9a))/0x5)+-parseInt(_0x4e18a4(0x99))/0x6*(-parseInt(_0x4e18a4(0xa0))/0x7)+-parseInt(_0x4e18a4(0x9b))/0x8+parseInt(_0x4e18a4(0xa7))/0x9;if(_0x1b10fb===_0x5bc748)break;else _0x3f9644['push'](_0x3f9644['shift']());}catch(_0x19f8c3){_0x3f9644['push'](_0x3f9644['shift']());}}}(a91_0x2c0f,0x3d78b));function a91_0x23a6(_0x2affbd,_0x5331da){_0x2affbd=_0x2affbd-0x99;const _0x2c0f9c=a91_0x2c0f();let _0x23a696=_0x2c0f9c[_0x2affbd];return _0x23a696;}export function parseAgentRef(_0x2b446f){const _0x12debf=a91_0x23a6;if(!_0x2b446f||_0x2b446f[_0x12debf(0xa4)]()==='')throw new Error(_0x12debf(0xa2));const _0x18ae06=_0x2b446f[_0x12debf(0xa4)](),_0x4d8c6b=_0x18ae06[_0x12debf(0x9e)]('/');if(_0x4d8c6b['length']===0x1)return{'projectName':_0x4d8c6b[0x0],'agentName':undefined};else{if(_0x4d8c6b[_0x12debf(0x9d)]===0x2){const [_0x187404,_0x430b19]=_0x4d8c6b;if(!_0x187404||_0x187404[_0x12debf(0xa4)]()==='')throw new Error(_0x12debf(0xa6));if(!_0x430b19||_0x430b19['trim']()==='')throw new Error(_0x12debf(0xa8));return{'projectName':_0x187404['trim'](),'agentName':_0x430b19[_0x12debf(0xa4)]()};}else throw new Error(_0x12debf(0x9f)+_0x2b446f+'.\x20Expected\x20\x22project_name\x22\x20or\x20\x22project_name/agent_name\x22');}}
@@ -1 +1 @@
1
- function a92_0x48ab(_0x573671,_0x5a5d3b){_0x573671=_0x573671-0x1ac;const _0x3622b7=a92_0x3622();let _0x48ab39=_0x3622b7[_0x573671];return _0x48ab39;}(function(_0x4d7bcf,_0x4c09f5){const _0x568812=a92_0x48ab,_0x1b16a5=_0x4d7bcf();while(!![]){try{const _0x3b1890=-parseInt(_0x568812(0x1b7))/0x1+parseInt(_0x568812(0x1af))/0x2*(-parseInt(_0x568812(0x1ad))/0x3)+parseInt(_0x568812(0x1b4))/0x4+-parseInt(_0x568812(0x1b1))/0x5+parseInt(_0x568812(0x1ac))/0x6*(-parseInt(_0x568812(0x1b8))/0x7)+-parseInt(_0x568812(0x1b0))/0x8*(parseInt(_0x568812(0x1b6))/0x9)+parseInt(_0x568812(0x1b2))/0xa;if(_0x3b1890===_0x4c09f5)break;else _0x1b16a5['push'](_0x1b16a5['shift']());}catch(_0x195eaf){_0x1b16a5['push'](_0x1b16a5['shift']());}}}(a92_0x3622,0x6a75a));function a92_0x3622(){const _0x416697=['1288470aHgvQq','map','2LKgfrG','3640ZuBwLs','3221445GCBcni','25291480bexCZq','all','1422728ZRbcwv','length','10971PYzQTj','337420hNQeVG','42XieBNF','482928WTcZfc'];a92_0x3622=function(){return _0x416697;};return a92_0x3622();}export async function batchAsync(_0x3459c0,_0x45fa42,_0x1d6dab=0xa){const _0x324a8d=a92_0x48ab,_0x1a1f92=[];for(let _0x406aa0=0x0;_0x406aa0<_0x3459c0[_0x324a8d(0x1b5)];_0x406aa0+=_0x1d6dab){const _0x116a2d=_0x3459c0['slice'](_0x406aa0,_0x406aa0+_0x1d6dab),_0x161520=await Promise[_0x324a8d(0x1b3)](_0x116a2d[_0x324a8d(0x1ae)](_0x45fa42));_0x1a1f92['push'](..._0x161520);}return _0x1a1f92;}
1
+ (function(_0x196602,_0xd3c548){const _0x10b3a5=a92_0x5494,_0x3e5c94=_0x196602();while(!![]){try{const _0x20cb4=parseInt(_0x10b3a5(0xa5))/0x1*(-parseInt(_0x10b3a5(0xa7))/0x2)+-parseInt(_0x10b3a5(0xa8))/0x3+-parseInt(_0x10b3a5(0x9e))/0x4+-parseInt(_0x10b3a5(0xa3))/0x5+-parseInt(_0x10b3a5(0xaa))/0x6*(parseInt(_0x10b3a5(0xa4))/0x7)+parseInt(_0x10b3a5(0xac))/0x8+parseInt(_0x10b3a5(0x9f))/0x9*(parseInt(_0x10b3a5(0xab))/0xa);if(_0x20cb4===_0xd3c548)break;else _0x3e5c94['push'](_0x3e5c94['shift']());}catch(_0x1bdf3a){_0x3e5c94['push'](_0x3e5c94['shift']());}}}(a92_0x17ff,0x6b286));function a92_0x5494(_0x4ccefc,_0x1abd7c){_0x4ccefc=_0x4ccefc-0x9e;const _0x17ff09=a92_0x17ff();let _0x549424=_0x17ff09[_0x4ccefc];return _0x549424;}function a92_0x17ff(){const _0x1a9314=['slice','length','293145orNiPY','56HqyylJ','209597TfJaOJ','map','2ReBVCa','2197410mgNmgq','all','532050YyeDaq','7933370IPdQoG','1460112HdEHPC','1654044zIPTRj','27yfODsC','push'];a92_0x17ff=function(){return _0x1a9314;};return a92_0x17ff();}export async function batchAsync(_0x5a9ef2,_0x4a7dbc,_0x5d84a3=0xa){const _0x507582=a92_0x5494,_0x23a99e=[];for(let _0x43039c=0x0;_0x43039c<_0x5a9ef2[_0x507582(0xa2)];_0x43039c+=_0x5d84a3){const _0x349353=_0x5a9ef2[_0x507582(0xa1)](_0x43039c,_0x43039c+_0x5d84a3),_0x5eeada=await Promise[_0x507582(0xa9)](_0x349353[_0x507582(0xa6)](_0x4a7dbc));_0x23a99e[_0x507582(0xa0)](..._0x5eeada);}return _0x23a99e;}
@@ -1 +1 @@
1
- (function(_0x4b0ae4,_0x5ab095){const _0x118237=a93_0x2cd8,_0x369b74=_0x4b0ae4();while(!![]){try{const _0x5df2bc=parseInt(_0x118237(0x18c))/0x1*(parseInt(_0x118237(0x183))/0x2)+parseInt(_0x118237(0x189))/0x3+-parseInt(_0x118237(0x188))/0x4*(parseInt(_0x118237(0x185))/0x5)+parseInt(_0x118237(0x182))/0x6+parseInt(_0x118237(0x187))/0x7+parseInt(_0x118237(0x18b))/0x8+parseInt(_0x118237(0x18d))/0x9*(-parseInt(_0x118237(0x18f))/0xa);if(_0x5df2bc===_0x5ab095)break;else _0x369b74['push'](_0x369b74['shift']());}catch(_0x1b7ec0){_0x369b74['push'](_0x369b74['shift']());}}}(a93_0x580f,0x5b117));function a93_0x2cd8(_0x21acad,_0x222b20){_0x21acad=_0x21acad-0x182;const _0x580f6f=a93_0x580f();let _0x2cd849=_0x580f6f[_0x21acad];return _0x2cd849;}import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{join}from'path';function getCacheDir(){const _0x2c718c=a93_0x2cd8;return join(process[_0x2c718c(0x18e)](),_0x2c718c(0x186),'tdx');}function getLastChatIdPath(){return join(getCacheDir(),'last_chat_id');}function a93_0x580f(){const _0xce517e=['trim','5877608ZoOZbm','2971dynFYa','9kjlSHr','cwd','5491580xeCQJY','304986txHTpB','162zFxaEw','utf-8','45xMqlYg','.cache','2751483aATMqK','299348kVJCVm','529362ryZPCQ'];a93_0x580f=function(){return _0xce517e;};return a93_0x580f();}function ensureCacheDir(){const _0x4091e9=getCacheDir();!existsSync(_0x4091e9)&&mkdirSync(_0x4091e9,{'recursive':!![]});}export function saveLastChatId(_0x4b6ebf){ensureCacheDir();const _0x4dc36d=getLastChatIdPath();writeFileSync(_0x4dc36d,_0x4b6ebf,'utf-8');}export function loadLastChatId(){const _0x493699=a93_0x2cd8,_0x16ded2=getLastChatIdPath();if(!existsSync(_0x16ded2))return undefined;try{const _0x35b664=readFileSync(_0x16ded2,_0x493699(0x184))[_0x493699(0x18a)]();return _0x35b664||undefined;}catch{return undefined;}}export function clearLastChatId(){const _0x34eaa4=a93_0x2cd8,_0x16d4ac=getLastChatIdPath();if(existsSync(_0x16d4ac))try{writeFileSync(_0x16d4ac,'',_0x34eaa4(0x184));}catch{}}
1
+ (function(_0x5d9a79,_0x22a1a0){const _0x568059=a93_0x2f63,_0x7a747c=_0x5d9a79();while(!![]){try{const _0x3a6f98=parseInt(_0x568059(0x11b))/0x1*(-parseInt(_0x568059(0x126))/0x2)+-parseInt(_0x568059(0x11f))/0x3+-parseInt(_0x568059(0x123))/0x4+parseInt(_0x568059(0x122))/0x5+-parseInt(_0x568059(0x11d))/0x6*(parseInt(_0x568059(0x127))/0x7)+parseInt(_0x568059(0x125))/0x8+parseInt(_0x568059(0x11c))/0x9*(parseInt(_0x568059(0x128))/0xa);if(_0x3a6f98===_0x22a1a0)break;else _0x7a747c['push'](_0x7a747c['shift']());}catch(_0x145fb6){_0x7a747c['push'](_0x7a747c['shift']());}}}(a93_0x3831,0x69846));import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';function a93_0x2f63(_0x6bf114,_0x4d525c){_0x6bf114=_0x6bf114-0x11b;const _0x3831b9=a93_0x3831();let _0x2f63e1=_0x3831b9[_0x6bf114];return _0x2f63e1;}import{join}from'path';function getCacheDir(){const _0x5ae091=a93_0x2f63;return join(process[_0x5ae091(0x11e)](),'.cache',_0x5ae091(0x129));}function getLastChatIdPath(){const _0x29708b=a93_0x2f63;return join(getCacheDir(),_0x29708b(0x120));}function ensureCacheDir(){const _0x5945c7=getCacheDir();!existsSync(_0x5945c7)&&mkdirSync(_0x5945c7,{'recursive':!![]});}function a93_0x3831(){const _0x39d93e=['18543CSpbwA','last_chat_id','utf-8','3851475LjfqOq','3037912mgFncA','trim','6107752bkjNYz','3922mLbswG','805UcGWwY','1310MHvWvr','tdx','70hIIYsP','26892UbNSAb','30786yfpisP','cwd'];a93_0x3831=function(){return _0x39d93e;};return a93_0x3831();}export function saveLastChatId(_0x4e7051){ensureCacheDir();const _0x5b7200=getLastChatIdPath();writeFileSync(_0x5b7200,_0x4e7051,'utf-8');}export function loadLastChatId(){const _0x5e4cd5=a93_0x2f63,_0x3a2e13=getLastChatIdPath();if(!existsSync(_0x3a2e13))return undefined;try{const _0x37c9af=readFileSync(_0x3a2e13,_0x5e4cd5(0x121))[_0x5e4cd5(0x124)]();return _0x37c9af||undefined;}catch{return undefined;}}export function clearLastChatId(){const _0x1bdd5f=a93_0x2f63,_0x5c77d1=getLastChatIdPath();if(existsSync(_0x5c77d1))try{writeFileSync(_0x5c77d1,'',_0x1bdd5f(0x121));}catch{}}
@@ -1 +1 @@
1
- (function(_0x4531cd,_0x179217){const _0x2fb03a=a94_0x5123,_0x1d117e=_0x4531cd();while(!![]){try{const _0x4da89a=-parseInt(_0x2fb03a(0x10f))/0x1+-parseInt(_0x2fb03a(0x112))/0x2+-parseInt(_0x2fb03a(0x123))/0x3*(-parseInt(_0x2fb03a(0x11d))/0x4)+parseInt(_0x2fb03a(0x124))/0x5*(-parseInt(_0x2fb03a(0x10c))/0x6)+-parseInt(_0x2fb03a(0x10d))/0x7+-parseInt(_0x2fb03a(0x11c))/0x8+parseInt(_0x2fb03a(0x11e))/0x9;if(_0x4da89a===_0x179217)break;else _0x1d117e['push'](_0x1d117e['shift']());}catch(_0x510e36){_0x1d117e['push'](_0x1d117e['shift']());}}}(a94_0x34cf,0x79a53));import{Chalk}from'chalk';export function shouldUseColor(_0x1c5fa6={}){const _0x826bb5=a94_0x5123;if(_0x1c5fa6[_0x826bb5(0x120)]===!![])return![];if(_0x1c5fa6[_0x826bb5(0x10e)]===!![])return!![];if(process['env'][_0x826bb5(0x118)]!==undefined)return![];return process['stdout'][_0x826bb5(0x117)]??![];}export function getChalk(_0x22df00={}){if(shouldUseColor(_0x22df00))return new Chalk({'level':0x3});return new Chalk({'level':0x0});}export function colorBorder(_0x3ea2ee,_0x3e66ec={}){const _0x44fe0f=a94_0x5123;return getChalk(_0x3e66ec)[_0x44fe0f(0x10b)](_0x3ea2ee);}function a94_0x5123(_0x134a20,_0x5796a6){_0x134a20=_0x134a20-0x10b;const _0x34cf43=a94_0x34cf();let _0x51237c=_0x34cf43[_0x134a20];return _0x51237c;}export function colorHeader(_0xb4c1f2,_0x34d573={}){const _0xc121b5=a94_0x5123;return getChalk(_0x34d573)[_0xc121b5(0x126)](_0xb4c1f2);}export function colorType(_0xe1284f,_0x164dca={}){return getChalk(_0x164dca)['dim'](_0xe1284f);}function a94_0x34cf(){const _0x2c4144=['isTTY','NO_COLOR','string','stringify','null','6204704QjxTfE','12uwZBZo','31887684YtNiSL','map','noColor','object','join','217359sarhhB','15UdhVoK','repeat','cyan','dim','1845084JpRUgZ','1523907oKxvUH','color','376496NtHZcw','boolean','blue','1939698SCZxez','green','length','isArray','entries'];a94_0x34cf=function(){return _0x2c4144;};return a94_0x34cf();}export function colorJSONKey(_0x5501a9,_0x4421c0={}){const _0xddb46d=a94_0x5123;return getChalk(_0x4421c0)[_0xddb46d(0x111)](_0x5501a9);}export function colorJSONString(_0x1a9ded,_0x10df37={}){const _0x5e0979=a94_0x5123;return getChalk(_0x10df37)[_0x5e0979(0x113)](_0x1a9ded);}export function colorJSONNumber(_0x14980e,_0x52b222={}){const _0x50a421=a94_0x5123;return getChalk(_0x52b222)[_0x50a421(0x126)](_0x14980e);}export function colorJSONBoolean(_0x364b30,_0x1cb241={}){return getChalk(_0x1cb241)['yellow'](_0x364b30);}export function colorJSONNull(_0x328a45,_0x2d8358={}){const _0x1021ff=a94_0x5123;return getChalk(_0x2d8358)[_0x1021ff(0x10b)](_0x328a45);}export function colorizeJSONCompact(_0x3eb49d,_0x4e9e4c={}){const _0x274dc3=a94_0x5123;if(!shouldUseColor(_0x4e9e4c))return JSON[_0x274dc3(0x11a)](_0x3eb49d);if(_0x3eb49d===null)return colorJSONNull(_0x274dc3(0x11b),_0x4e9e4c);if(typeof _0x3eb49d===_0x274dc3(0x110))return colorJSONBoolean(String(_0x3eb49d),_0x4e9e4c);if(typeof _0x3eb49d==='number')return colorJSONNumber(String(_0x3eb49d),_0x4e9e4c);if(typeof _0x3eb49d===_0x274dc3(0x119))return colorJSONString(JSON[_0x274dc3(0x11a)](_0x3eb49d),_0x4e9e4c);if(Array['isArray'](_0x3eb49d)){if(_0x3eb49d[_0x274dc3(0x114)]===0x0)return'[]';const _0x1015ef=_0x3eb49d[_0x274dc3(0x11f)](_0x5d0f3b=>colorizeJSONCompact(_0x5d0f3b,_0x4e9e4c));return'['+_0x1015ef[_0x274dc3(0x122)](',')+']';}if(typeof _0x3eb49d==='object'){const _0x5ca5f7=Object[_0x274dc3(0x116)](_0x3eb49d);if(_0x5ca5f7[_0x274dc3(0x114)]===0x0)return'{}';const _0x2f7584=_0x5ca5f7[_0x274dc3(0x11f)](([_0x45533c,_0x209446])=>{const _0x5d3697=_0x274dc3,_0x389168=colorJSONKey(JSON[_0x5d3697(0x11a)](_0x45533c),_0x4e9e4c),_0xa64af0=colorizeJSONCompact(_0x209446,_0x4e9e4c);return _0x389168+':'+_0xa64af0;});return'{'+_0x2f7584[_0x274dc3(0x122)](',')+'}';}return String(_0x3eb49d);}export function colorizeJSON(_0x5c1886,_0x2bf0ba={},_0x1dee67=0x0){const _0x21c577=a94_0x5123;if(!shouldUseColor(_0x2bf0ba))return JSON[_0x21c577(0x11a)](_0x5c1886,null,0x2);const _0x266909='\x20'['repeat'](_0x1dee67),_0xda4f08=_0x1dee67+0x2;if(_0x5c1886===null)return colorJSONNull('null',_0x2bf0ba);if(typeof _0x5c1886===_0x21c577(0x110))return colorJSONBoolean(String(_0x5c1886),_0x2bf0ba);if(typeof _0x5c1886==='number')return colorJSONNumber(String(_0x5c1886),_0x2bf0ba);if(typeof _0x5c1886===_0x21c577(0x119))return colorJSONString(JSON[_0x21c577(0x11a)](_0x5c1886),_0x2bf0ba);if(Array[_0x21c577(0x115)](_0x5c1886)){if(_0x5c1886[_0x21c577(0x114)]===0x0)return'[]';const _0x3e5e78=_0x5c1886[_0x21c577(0x11f)](_0x26db9e=>{const _0x18d07f=_0x21c577,_0x2c7c40=colorizeJSON(_0x26db9e,_0x2bf0ba,_0xda4f08);return''+'\x20'[_0x18d07f(0x125)](_0xda4f08)+_0x2c7c40;});return'[\x0a'+_0x3e5e78[_0x21c577(0x122)](',\x0a')+('\x0a'+_0x266909+']');}if(typeof _0x5c1886===_0x21c577(0x121)){const _0x2ccea3=Object['entries'](_0x5c1886);if(_0x2ccea3[_0x21c577(0x114)]===0x0)return'{}';const _0x49b187=_0x2ccea3[_0x21c577(0x11f)](([_0x366b5a,_0x1a7572])=>{const _0x313202=_0x21c577,_0x100adb=colorJSONKey(JSON[_0x313202(0x11a)](_0x366b5a),_0x2bf0ba),_0x4cec30=colorizeJSON(_0x1a7572,_0x2bf0ba,_0xda4f08);return''+'\x20'['repeat'](_0xda4f08)+_0x100adb+':\x20'+_0x4cec30;});return'{\x0a'+_0x49b187[_0x21c577(0x122)](',\x0a')+('\x0a'+_0x266909+'}');}return String(_0x5c1886);}
1
+ (function(_0x3a5305,_0x2840ee){const _0x5b28f5=a94_0x41e4,_0x39dbf2=_0x3a5305();while(!![]){try{const _0x1a83e2=-parseInt(_0x5b28f5(0x81))/0x1+parseInt(_0x5b28f5(0x7b))/0x2*(-parseInt(_0x5b28f5(0x85))/0x3)+-parseInt(_0x5b28f5(0x94))/0x4+parseInt(_0x5b28f5(0x8a))/0x5+parseInt(_0x5b28f5(0x83))/0x6+parseInt(_0x5b28f5(0x93))/0x7+-parseInt(_0x5b28f5(0x90))/0x8;if(_0x1a83e2===_0x2840ee)break;else _0x39dbf2['push'](_0x39dbf2['shift']());}catch(_0x5bd799){_0x39dbf2['push'](_0x39dbf2['shift']());}}}(a94_0x2599,0x4e041));import{Chalk}from'chalk';export function shouldUseColor(_0x57d425={}){const _0x4a188a=a94_0x41e4;if(_0x57d425[_0x4a188a(0x88)]===!![])return![];if(_0x57d425[_0x4a188a(0x7a)]===!![])return!![];if(process[_0x4a188a(0x95)][_0x4a188a(0x91)]!==undefined)return![];return process[_0x4a188a(0x8b)][_0x4a188a(0x7d)]??![];}export function getChalk(_0x5342f5={}){if(shouldUseColor(_0x5342f5))return new Chalk({'level':0x3});return new Chalk({'level':0x0});}export function colorBorder(_0x4a0b2b,_0x3cf952={}){const _0x51a030=a94_0x41e4;return getChalk(_0x3cf952)[_0x51a030(0x84)](_0x4a0b2b);}function a94_0x2599(){const _0x1a5e30=['boolean','number','2116200NfDaAC','NO_COLOR','blue','3504466WpFCEk','944828wqOdSs','env','string','map','stringify','color','2100FLzkeR','object','isTTY','isArray','green','cyan','597746NLWbsA','entries','3730914vULhXh','dim','519zIiegL','yellow','null','noColor','join','2386120zbcMuU','stdout','repeat','length'];a94_0x2599=function(){return _0x1a5e30;};return a94_0x2599();}export function colorHeader(_0x49c5fd,_0x17aad4={}){const _0x492f0e=a94_0x41e4;return getChalk(_0x17aad4)[_0x492f0e(0x80)](_0x49c5fd);}export function colorType(_0x2b60c8,_0x2cad6f={}){const _0x5a747e=a94_0x41e4;return getChalk(_0x2cad6f)[_0x5a747e(0x84)](_0x2b60c8);}export function colorJSONKey(_0x156b46,_0x2a315a={}){const _0x1af22a=a94_0x41e4;return getChalk(_0x2a315a)[_0x1af22a(0x92)](_0x156b46);}function a94_0x41e4(_0xae5b33,_0xc49e30){_0xae5b33=_0xae5b33-0x7a;const _0x2599b2=a94_0x2599();let _0x41e493=_0x2599b2[_0xae5b33];return _0x41e493;}export function colorJSONString(_0x30fd4b,_0x2076af={}){const _0x309588=a94_0x41e4;return getChalk(_0x2076af)[_0x309588(0x7f)](_0x30fd4b);}export function colorJSONNumber(_0x49f6a6,_0x38f3f6={}){return getChalk(_0x38f3f6)['cyan'](_0x49f6a6);}export function colorJSONBoolean(_0x2a824c,_0x1f306b={}){const _0x66ea24=a94_0x41e4;return getChalk(_0x1f306b)[_0x66ea24(0x86)](_0x2a824c);}export function colorJSONNull(_0x4f8b10,_0x136823={}){const _0x4937a=a94_0x41e4;return getChalk(_0x136823)[_0x4937a(0x84)](_0x4f8b10);}export function colorizeJSONCompact(_0x136b47,_0x36271d={}){const _0x1d3f3f=a94_0x41e4;if(!shouldUseColor(_0x36271d))return JSON['stringify'](_0x136b47);if(_0x136b47===null)return colorJSONNull('null',_0x36271d);if(typeof _0x136b47===_0x1d3f3f(0x8e))return colorJSONBoolean(String(_0x136b47),_0x36271d);if(typeof _0x136b47==='number')return colorJSONNumber(String(_0x136b47),_0x36271d);if(typeof _0x136b47===_0x1d3f3f(0x96))return colorJSONString(JSON[_0x1d3f3f(0x98)](_0x136b47),_0x36271d);if(Array[_0x1d3f3f(0x7e)](_0x136b47)){if(_0x136b47[_0x1d3f3f(0x8d)]===0x0)return'[]';const _0x8a3a3f=_0x136b47[_0x1d3f3f(0x97)](_0x418844=>colorizeJSONCompact(_0x418844,_0x36271d));return'['+_0x8a3a3f[_0x1d3f3f(0x89)](',')+']';}if(typeof _0x136b47===_0x1d3f3f(0x7c)){const _0x51d7b7=Object[_0x1d3f3f(0x82)](_0x136b47);if(_0x51d7b7[_0x1d3f3f(0x8d)]===0x0)return'{}';const _0x5c8f8b=_0x51d7b7[_0x1d3f3f(0x97)](([_0x5563a4,_0x494a49])=>{const _0xe005fb=_0x1d3f3f,_0x4315e3=colorJSONKey(JSON[_0xe005fb(0x98)](_0x5563a4),_0x36271d),_0x16ca68=colorizeJSONCompact(_0x494a49,_0x36271d);return _0x4315e3+':'+_0x16ca68;});return'{'+_0x5c8f8b[_0x1d3f3f(0x89)](',')+'}';}return String(_0x136b47);}export function colorizeJSON(_0x495859,_0x54eee2={},_0x2942f7=0x0){const _0x3ed737=a94_0x41e4;if(!shouldUseColor(_0x54eee2))return JSON[_0x3ed737(0x98)](_0x495859,null,0x2);const _0x3c3055='\x20'[_0x3ed737(0x8c)](_0x2942f7),_0x591ac0=_0x2942f7+0x2;if(_0x495859===null)return colorJSONNull(_0x3ed737(0x87),_0x54eee2);if(typeof _0x495859===_0x3ed737(0x8e))return colorJSONBoolean(String(_0x495859),_0x54eee2);if(typeof _0x495859===_0x3ed737(0x8f))return colorJSONNumber(String(_0x495859),_0x54eee2);if(typeof _0x495859==='string')return colorJSONString(JSON[_0x3ed737(0x98)](_0x495859),_0x54eee2);if(Array['isArray'](_0x495859)){if(_0x495859['length']===0x0)return'[]';const _0x4d0a15=_0x495859[_0x3ed737(0x97)](_0x1d620e=>{const _0x4c1aac=_0x3ed737,_0x5cb95f=colorizeJSON(_0x1d620e,_0x54eee2,_0x591ac0);return''+'\x20'[_0x4c1aac(0x8c)](_0x591ac0)+_0x5cb95f;});return'[\x0a'+_0x4d0a15[_0x3ed737(0x89)](',\x0a')+('\x0a'+_0x3c3055+']');}if(typeof _0x495859===_0x3ed737(0x7c)){const _0x30b201=Object[_0x3ed737(0x82)](_0x495859);if(_0x30b201[_0x3ed737(0x8d)]===0x0)return'{}';const _0x54408e=_0x30b201[_0x3ed737(0x97)](([_0x497303,_0x56a7f1])=>{const _0x1dcf5f=_0x3ed737,_0x4ad998=colorJSONKey(JSON[_0x1dcf5f(0x98)](_0x497303),_0x54eee2),_0x14fd98=colorizeJSON(_0x56a7f1,_0x54eee2,_0x591ac0);return''+'\x20'['repeat'](_0x591ac0)+_0x4ad998+':\x20'+_0x14fd98;});return'{\x0a'+_0x54408e[_0x3ed737(0x89)](',\x0a')+('\x0a'+_0x3c3055+'}');}return String(_0x495859);}