@profoundlogic/coderflow-server 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coder-server.js +1 -1
- package/dist/config.js +1 -1
- package/dist/lib/agent-keepalive.js +1 -1
- package/dist/lib/agent-models.js +1 -1
- package/dist/lib/api-keys.js +1 -1
- package/dist/lib/apiKeys.js +1 -1
- package/dist/lib/app-server-ports.js +1 -1
- package/dist/lib/auto-judge.js +1 -1
- package/dist/lib/automation-service.js +1 -1
- package/dist/lib/basic-auth.js +1 -1
- package/dist/lib/bindings.js +1 -1
- package/dist/lib/build-history.js +1 -1
- package/dist/lib/build-output-service.js +1 -1
- package/dist/lib/build-scheduler.js +1 -1
- package/dist/lib/build-service.js +1 -1
- package/dist/lib/ca-certificates.js +1 -1
- package/dist/lib/claude-oauth-refresh.js +1 -1
- package/dist/lib/cli/build.js +1 -1
- package/dist/lib/cli/cleanup-users.js +1 -1
- package/dist/lib/cli/config-command.js +1 -1
- package/dist/lib/cli/config.js +1 -1
- package/dist/lib/cli/create-user.js +1 -1
- package/dist/lib/cli/grant-admin.js +1 -1
- package/dist/lib/cli/init.js +1 -1
- package/dist/lib/cli/jira.js +1 -1
- package/dist/lib/cli/license.js +1 -1
- package/dist/lib/cli/list-roles.js +1 -1
- package/dist/lib/cli/list-users.js +1 -1
- package/dist/lib/cli/server-manager.js +1 -1
- package/dist/lib/cli/set-password.js +1 -1
- package/dist/lib/compression-filter.js +1 -1
- package/dist/lib/config-migration.js +1 -1
- package/dist/lib/container-credential-sync.js +1 -1
- package/dist/lib/container-tokens.js +1 -1
- package/dist/lib/data-dir.js +1 -1
- package/dist/lib/deployment-history.js +1 -1
- package/dist/lib/deployment-service.js +1 -1
- package/dist/lib/docker-utils.js +1 -1
- package/dist/lib/email.js +1 -1
- package/dist/lib/emailTemplates.js +1 -1
- package/dist/lib/entitlement.js +1 -1
- package/dist/lib/external-connections.js +1 -1
- package/dist/lib/fetch-utils.js +1 -1
- package/dist/lib/git-commit-details-route.js +1 -1
- package/dist/lib/git-history-diff-guardrails.js +1 -1
- package/dist/lib/git-provider-service.js +1 -1
- package/dist/lib/git-provider-setup/github-setup-handler.js +1 -1
- package/dist/lib/git-provider-setup/index.js +1 -1
- package/dist/lib/git-provider-setup/setup-factory.js +1 -1
- package/dist/lib/git-provider-setup/setup-interface.js +1 -1
- package/dist/lib/git-providers/azure-devops-provider.js +1 -1
- package/dist/lib/git-providers/github-app-provider.js +1 -1
- package/dist/lib/git-providers/index.js +1 -1
- package/dist/lib/git-providers/provider-factory.js +1 -1
- package/dist/lib/git-providers/provider-interface.js +1 -1
- package/dist/lib/github-urls.js +1 -1
- package/dist/lib/group-objective-linking.js +1 -1
- package/dist/lib/ibmi-sync.js +1 -1
- package/dist/lib/jira-client.js +1 -1
- package/dist/lib/judge-blinding.js +1 -1
- package/dist/lib/logger.js +1 -1
- package/dist/lib/memory-utils.js +1 -1
- package/dist/lib/migration-to-scoped-rbac.js +1 -1
- package/dist/lib/model-fetcher.js +1 -1
- package/dist/lib/notifications.js +1 -1
- package/dist/lib/objective-context.js +1 -1
- package/dist/lib/oidc-auth.js +1 -1
- package/dist/lib/oidc-device-flow.js +1 -1
- package/dist/lib/passwordTokens.js +1 -1
- package/dist/lib/permission-resolver.js +1 -1
- package/dist/lib/pin-cascade.js +1 -1
- package/dist/lib/provider-accounts.js +1 -1
- package/dist/lib/provider-oauth.js +1 -1
- package/dist/lib/provider-profile.js +1 -1
- package/dist/lib/provider-token-refresh.js +1 -1
- package/dist/lib/rbac-user-state.js +1 -1
- package/dist/lib/request-url.js +1 -1
- package/dist/lib/rewind.js +1 -1
- package/dist/lib/role-definitions.js +1 -1
- package/dist/lib/roles.js +1 -1
- package/dist/lib/secrets.js +1 -1
- package/dist/lib/setup-repo-git-auth.js +1 -1
- package/dist/lib/state-capture.js +1 -1
- package/dist/lib/static-files.js +1 -1
- package/dist/lib/task-aliases.js +1 -1
- package/dist/lib/task-container-init.js +1 -1
- package/dist/lib/task-context-usage.js +1 -1
- package/dist/lib/task-name-format.js +1 -1
- package/dist/lib/task-name-generator.js +1 -1
- package/dist/lib/task-source-metadata.js +1 -1
- package/dist/lib/teams.js +1 -1
- package/dist/lib/user-git-oauth.js +1 -1
- package/dist/lib/user-git-tokens.js +1 -1
- package/dist/lib/users.js +1 -1
- package/dist/middleware/requireAuth.js +1 -1
- package/dist/middleware/requireInit.js +1 -1
- package/dist/middleware/requirePermission.js +1 -1
- package/dist/package.json +1 -1
- package/dist/playwright.config.js +1 -1
- package/dist/playwright.task-terminal.config.js +1 -1
- package/dist/routes/apiKeys.js +1 -1
- package/dist/routes/auth-oidc.js +1 -1
- package/dist/routes/auth.js +1 -1
- package/dist/routes/automations.js +1 -1
- package/dist/routes/bindings.js +1 -1
- package/dist/routes/build.js +1 -1
- package/dist/routes/containers.js +1 -1
- package/dist/routes/deploy-task.js +1 -1
- package/dist/routes/environment-management.js +1 -1
- package/dist/routes/environments.js +1 -1
- package/dist/routes/external-skills.js +1 -1
- package/dist/routes/git-credentials.js +1 -1
- package/dist/routes/git-oauth.js +1 -1
- package/dist/routes/git-provider-setup.js +1 -1
- package/dist/routes/health.js +1 -1
- package/dist/routes/jira.js +1 -1
- package/dist/routes/logs.js +1 -1
- package/dist/routes/objective-management.js +1 -1
- package/dist/routes/password.js +1 -1
- package/dist/routes/prompt.js +1 -1
- package/dist/routes/provider-auth.js +1 -1
- package/dist/routes/qa.js +1 -1
- package/dist/routes/roles.js +1 -1
- package/dist/routes/settings.js +1 -1
- package/dist/routes/skill-management.js +1 -1
- package/dist/routes/skills.js +1 -1
- package/dist/routes/stats.js +1 -1
- package/dist/routes/tasks.js +1 -1
- package/dist/routes/teams.js +1 -1
- package/dist/routes/templates.js +1 -1
- package/dist/routes/test-task.js +1 -1
- package/dist/routes/test.js +1 -1
- package/dist/routes/users.js +1 -1
- package/dist/routes/visualizations.js +1 -1
- package/dist/scripts/create-user.js +1 -1
- package/dist/scripts/migrate-config-to-data-dir.js +1 -1
- package/dist/start.js +1 -1
- package/dist/web-ui/public/activity-detail-modal.js +1 -1
- package/dist/web-ui/public/activity-feed.js +1 -1
- package/dist/web-ui/public/activity-formatters.js +1 -1
- package/dist/web-ui/public/admin.js +1 -1
- package/dist/web-ui/public/agent-event-parser.js +1 -1
- package/dist/web-ui/public/app.js +1 -1
- package/dist/web-ui/public/approve-dialog.js +1 -1
- package/dist/web-ui/public/automation-links.js +1 -1
- package/dist/web-ui/public/automation-schedule.js +1 -1
- package/dist/web-ui/public/comments-widget.js +1 -1
- package/dist/web-ui/public/diff-utils.js +1 -1
- package/dist/web-ui/public/environments.js +1 -1
- package/dist/web-ui/public/feedback-widget.js +1 -1
- package/dist/web-ui/public/file-selection-tree.js +1 -1
- package/dist/web-ui/public/git-history-lazy-utils.js +1 -1
- package/dist/web-ui/public/git-history.js +1 -1
- package/dist/web-ui/public/git-status.js +1 -1
- package/dist/web-ui/public/ibmi-file-filter.js +1 -1
- package/dist/web-ui/public/index.js +1 -1
- package/dist/web-ui/public/login.js +1 -1
- package/dist/web-ui/public/markdown-editor.js +1 -1
- package/dist/web-ui/public/markdown-file-editor.js +1 -1
- package/dist/web-ui/public/modal-maximize.js +1 -1
- package/dist/web-ui/public/notifications.js +1 -1
- package/dist/web-ui/public/permissions.js +1 -1
- package/dist/web-ui/public/pr-dialog.js +1 -1
- package/dist/web-ui/public/roles.js +1 -1
- package/dist/web-ui/public/settings.js +1 -1
- package/dist/web-ui/public/setup-password.js +1 -1
- package/dist/web-ui/public/skills.js +1 -1
- package/dist/web-ui/public/sse-client.js +1 -1
- package/dist/web-ui/public/sse-shared-worker.js +1 -1
- package/dist/web-ui/public/task-judging-helpers.js +1 -1
- package/dist/web-ui/public/task.js +1 -1
- package/dist/web-ui/public/teams.js +1 -1
- package/dist/web-ui/public/terminal.js +1 -1
- package/dist/web-ui/public/theme.js +1 -1
- package/dist/web-ui/public/users.js +1 -1
- package/dist/web-ui/public/variant-grouping.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function isLogOnlyTaskType(_0x2f4cb3){return _0x2f4cb3==='test'||_0x2f4cb3==='deploy';}export function createApproveDialogHTML(_0x461183='',_0x2b2095={}){const _0xcd8756=_0x461183,_0x4a7ce6=_0x2b2095['useTaskPageStyles']?'modal\x20profound-approve-modal':'profound-feedback-modal\x20profound-approve-modal',_0x4e4b4c=_0x2b2095['useTaskPageStyles']?'modal-warning':'approve-modal-warning',_0x254bfc=_0x2b2095['useTaskPageStyles']?'modal-error':'approve-modal-error';return'\x0a\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'approve-modal\x22\x20class=\x22'+_0x4a7ce6+'\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-overlay\x22></div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-content\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h2>Approve\x20Changes</h2>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22modal-close\x22\x20id=\x22'+_0xcd8756+'close-approve-modal\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-body\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'approve-warning\x22\x20class=\x22'+_0x4e4b4c+'\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22warning-icon\x22>!</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0xcd8756+'approve-warning-text\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'approve-error\x22\x20class=\x22'+_0x254bfc+'\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22error-icon\x22>!</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0xcd8756+'approve-error-text\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'conflict-resolution\x22\x20class=\x22conflict-resolution-panel\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22conflict-resolution-message\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22warning-icon\x22>!</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Remote\x20has\x20conflicting\x20changes\x20that\x20couldn\x27t\x20be\x20merged\x20automatically.</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22conflict-resolution-options\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-primary\x20btn-small\x22\x20id=\x22'+_0xcd8756+'conflict-agent-resolve\x22>Let\x20the\x20agent\x20resolve\x20conflicts</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22>The\x20agent\x20will\x20pull\x20remote\x20changes,\x20resolve\x20conflicts,\x20and\x20prepare\x20for\x20re-approval.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-secondary\x20btn-small\x22\x20id=\x22'+_0xcd8756+'conflict-new-branch\x22>Create\x20a\x20new\x20branch\x20instead</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22>Avoids\x20the\x20conflict\x20by\x20committing\x20to\x20a\x20separate\x20branch.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-secondary\x20btn-small\x22\x20id=\x22'+_0xcd8756+'conflict-cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-info\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0xcd8756+'approve-repo-name\x22\x20class=\x22modal-repo\x22>Repository</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0xcd8756+'approve-stats\x22\x20class=\x22modal-stats\x22>0\x20files\x20changed</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'approve-branches\x22\x20class=\x22modal-branches\x22\x20hidden></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0xcd8756+'commit-message-input\x22>Commit\x20message:</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<textarea\x20id=\x22'+_0xcd8756+'commit-message-input\x22\x20class=\x22commit-message-input\x22\x20rows=\x226\x22\x20placeholder=\x22Enter\x20commit\x20message...\x22></textarea>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20id=\x22'+_0xcd8756+'multi-repo-note\x22\x20class=\x22field-hint\x22\x20hidden>This\x20commit\x20message\x20will\x20be\x20used\x20for\x20all\x20repositories\x20listed\x20above.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0xcd8756+'pull-before-commit\x22\x20checked>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Pull\x20from\x20remote\x20after\x20commit</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0xcd8756+'push-after-commit\x22\x20checked>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Push\x20to\x20remote\x20after\x20commit</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0xcd8756+'create-new-branch\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Create\x20new\x20branch</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'new-branch-input-container\x22\x20class=\x22new-branch-container\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20id=\x22'+_0xcd8756+'new-branch-name\x22\x20class=\x22new-branch-input\x22\x20placeholder=\x22Enter\x20new\x20branch\x20name...\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22>A\x20new\x20branch\x20will\x20be\x20created\x20from\x20the\x20current\x20branch\x20before\x20committing.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'pr-option-section\x22\x20class=\x22modal-section\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0xcd8756+'create-pull-request\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Create\x20pull\x20request</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22\x20id=\x22'+_0xcd8756+'pr-hint\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20A\x20new\x20branch\x20will\x20be\x20created,\x20pushed,\x20and\x20a\x20pull\x20request\x20opened.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'ibmi-sync-section\x22\x20class=\x22modal-section\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22approve-divider\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0xcd8756+'sync-to-ibmi\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Sync\x20to\x20IBM\x20i</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'ibmi-sync-fields\x22\x20class=\x22new-branch-container\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0xcd8756+'ibmi-sync-library\x22>Library\x20name</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20id=\x22'+_0xcd8756+'ibmi-sync-library\x22\x20class=\x22new-branch-input\x20code-font\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20maxlength=\x2210\x22\x20placeholder=\x22e.g.,\x20MYLIB\x22\x20style=\x22width:\x20160px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'ibmi-sync-credentials-row\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0xcd8756+'ibmi-sync-user\x22\x20style=\x22margin-top:\x208px;\x20display:\x20block;\x22>User\x20profile</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20id=\x22'+_0xcd8756+'ibmi-sync-user\x22\x20class=\x22new-branch-input\x20code-font\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20maxlength=\x2210\x22\x20placeholder=\x22e.g.,\x20MYUSER\x22\x20style=\x22width:\x20160px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0xcd8756+'ibmi-sync-password\x22\x20style=\x22margin-top:\x208px;\x20display:\x20block;\x22>Password</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22password\x22\x20id=\x22'+_0xcd8756+'ibmi-sync-password\x22\x20class=\x22new-branch-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22Enter\x20password\x22\x20style=\x22width:\x20160px;\x22\x20autocomplete=\x22off\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'ibmi-sync-files-section\x22\x20style=\x22margin-top:\x2010px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20style=\x22display:\x20block;\x20margin-bottom:\x204px;\x22>Files\x20to\x20sync</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0xcd8756+'ibmi-sync-file-tree\x22\x20class=\x22file-selection-tree-container\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20style=\x22max-height:\x20250px;\x20overflow-y:\x20auto;\x20border:\x201px\x20solid\x20var(--border-color,\x20var(--color-border));\x20border-radius:\x204px;\x20padding:\x208px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-selection-summary\x22\x20id=\x22'+_0xcd8756+'ibmi-sync-files-summary\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-footer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-ghost\x22\x20id=\x22'+_0xcd8756+'cancel-approve\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-primary\x22\x20id=\x22'+_0xcd8756+'confirm-approve\x22>Commit\x20Changes</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20';}export class ApproveDialog{constructor(_0x3b8d2f={}){this['prefix']=_0x3b8d2f['prefix']||'',this['onApprove']=_0x3b8d2f['onApprove'],this['onSync']=_0x3b8d2f['onSync'],this['onSuccess']=_0x3b8d2f['onSuccess'],this['onError']=_0x3b8d2f['onError'],this['onCreatePR']=_0x3b8d2f['onCreatePR'],this['showToast']=_0x3b8d2f['showToast']||(()=>{}),this['container']=_0x3b8d2f['container']||document['body'],this['useTaskPageStyles']=_0x3b8d2f['useTaskPageStyles']||![],this['baseUrl']=_0x3b8d2f['baseUrl']||'',this['coderflowAttribution']=_0x3b8d2f['coderflowAttribution'],this['onConflictFollowUp']=_0x3b8d2f['onConflictFollowUp']||null,this['onSyncToIbmi']=_0x3b8d2f['onSyncToIbmi']||null,this['onGetSyncFiles']=_0x3b8d2f['onGetSyncFiles']||null,this['taskData']=null,this['initialized']=![],this['isSyncing']=![],this['_createPR']=![],this['_attributionRequestId']=0x0,this['_syncFileTree']=null,this['_syncRelativeFiles']=null,this['_syncAbsolutePaths']=null,this['_transientWarning']='';}['init'](){if(this['initialized'])return;const _0x5b0ef3=document['createElement']('div');_0x5b0ef3['innerHTML']=createApproveDialogHTML(this['prefix'],{'useTaskPageStyles':this['useTaskPageStyles']}),this['container']['appendChild'](_0x5b0ef3['firstElementChild']),this['_bindEvents'](),this['initialized']=!![];}['_el'](_0x34708f){return document['getElementById'](''+this['prefix']+_0x34708f);}['_bindEvents'](){const _0x183d87=this['_el']('approve-modal'),_0x36a758=this['_el']('close-approve-modal'),_0x11c255=this['_el']('cancel-approve'),_0x1fff13=this['_el']('confirm-approve'),_0x2c1996=_0x183d87?.['querySelector']('.modal-overlay'),_0xfbbfa7=this['_el']('pull-before-commit'),_0x1624bd=this['_el']('create-new-branch'),_0x24ec43=this['_el']('new-branch-input-container'),_0x17541a=this['_el']('new-branch-name'),_0x3f1a3f=this['_el']('push-after-commit'),_0x1e3599=this['_el']('create-pull-request'),_0x8c13e0=this['_el']('pr-hint'),_0x4aa49a=()=>{this['_refreshWarningBanner']();};_0x36a758?.['addEventListener']('click',()=>this['hide']()),_0x11c255?.['addEventListener']('click',()=>this['hide']()),_0x2c1996?.['addEventListener']('click',()=>this['hide']()),_0x1fff13?.['addEventListener']('click',()=>this['_handleApprove']());_0x1624bd&&_0x1624bd['addEventListener']('change',()=>{_0x24ec43&&(_0x24ec43['hidden']=!_0x1624bd['checked']),_0x1624bd['checked']&&_0x17541a&&_0x17541a['focus'](),_0x4aa49a();});_0xfbbfa7?.['addEventListener']('change',()=>{_0x4aa49a();});_0x1e3599&&_0x3f1a3f&&_0x1624bd&&(_0x1e3599['addEventListener']('change',()=>{this['_createPR']=_0x1e3599['checked'];if(_0x1e3599['checked']){_0x3f1a3f['checked']=!![],_0x3f1a3f['disabled']=!![],_0x1624bd['checked']=!![],_0x1624bd['disabled']=!![];_0x24ec43&&(_0x24ec43['hidden']=![]);if(_0x8c13e0)_0x8c13e0['hidden']=![];}else{_0x3f1a3f['disabled']=![],_0x1624bd['disabled']=![];if(_0x8c13e0)_0x8c13e0['hidden']=!![];}_0x4aa49a();}),_0x3f1a3f['addEventListener']('change',()=>{if(!_0x3f1a3f['checked']&&_0x1e3599['checked']){_0x1e3599['checked']=![],this['_createPR']=![],_0x3f1a3f['disabled']=![],_0x1624bd['disabled']=![];if(_0x8c13e0)_0x8c13e0['hidden']=!![];}}));_0x4aa49a();const _0x5c29e1=this['_el']('sync-to-ibmi');_0x5c29e1&&_0x5c29e1['addEventListener']('change',async _0x48c0e8=>{const _0x53ea7e=this['_el']('ibmi-sync-fields');if(_0x53ea7e)_0x53ea7e['hidden']=!_0x48c0e8['target']['checked'];if(_0x48c0e8['target']['checked']){const _0x280bb3=this['_el']('ibmi-sync-library'),_0x250d2e=localStorage['getItem']('coderflow_ibmi_sync_library');_0x250d2e&&_0x280bb3&&!_0x280bb3['value']&&(_0x280bb3['value']=_0x250d2e);const _0x29045c=this['_el']('ibmi-sync-user');if(_0x29045c&&!_0x29045c['value']){const _0x4ab4f6=localStorage['getItem']('coderflow_ibmi_sync_user');if(_0x4ab4f6)_0x29045c['value']=_0x4ab4f6;}const _0x471237=this['_el']('ibmi-sync-password');if(_0x471237)_0x471237['value']='';!this['_syncFileTree']&&this['onGetSyncFiles']&&this['taskData']?.['taskId']&&await this['_loadSyncFileTree']();}}),this['_el']('conflict-agent-resolve')?.['addEventListener']('click',()=>{this['onConflictFollowUp']&&this['onConflictFollowUp'](this['taskData']['taskId']),this['hide'](),this['showToast']('Agent\x20is\x20resolving\x20conflicts.\x20Re-approve\x20when\x20it\x20finishes.','info');}),this['_el']('conflict-new-branch')?.['addEventListener']('click',()=>{this['_hideConflictResolution']();const _0x352999=this['_el']('create-new-branch'),_0x3a543c=this['_el']('new-branch-input-container'),_0x21b55d=this['_el']('new-branch-name');if(_0x352999)_0x352999['checked']=!![];if(_0x3a543c)_0x3a543c['hidden']=![];if(_0x21b55d)_0x21b55d['focus']();_0x4aa49a();}),this['_el']('conflict-cancel')?.['addEventListener']('click',()=>this['hide']()),document['addEventListener']('keydown',_0x449372=>{_0x449372['key']==='Escape'&&_0x183d87&&!_0x183d87['hidden']&&this['hide']();});}async['_loadSyncFileTree'](){const _0x228eef=this['_el']('ibmi-sync-file-tree'),_0x1c3bba=this['_el']('ibmi-sync-files-summary');if(!_0x228eef)return;_0x228eef['innerHTML']='<span\x20style=\x22color:\x20var(--color-text-muted,\x20#888);\x20font-size:\x2013px;\x22>Loading\x20files...</span>';if(_0x1c3bba)_0x1c3bba['textContent']='';try{const {files:_0x103eaf,absolutePaths:_0x576584}=await this['onGetSyncFiles'](this['taskData']['taskId']);this['_syncRelativeFiles']=_0x103eaf,this['_syncAbsolutePaths']=_0x576584;if(_0x103eaf['length']===0x0){_0x228eef['innerHTML']='<span\x20style=\x22color:\x20var(--color-text-muted,\x20#888);\x20font-size:\x2013px;\x22>No\x20changed\x20files\x20found.</span>';return;}const {FileSelectionTree:_0x263dc6}=await import('./file-selection-tree.js'),{validateIbmiFile:_0x51a937,hasKnownIbmiExtension:_0xae536c}=await import('./ibmi-file-filter.js');this['_syncFileTree']=new _0x263dc6({'container':_0x228eef,'files':_0x103eaf,'isPreselected':_0x127e94=>{const {valid:_0x258bd2}=_0x51a937(_0x127e94);return _0x258bd2&&_0xae536c(_0x127e94);},'isDisabled':_0x52de76=>{const {valid:_0xfe8b2d,reason:_0x47be8c}=_0x51a937(_0x52de76);return{'disabled':!_0xfe8b2d,'reason':_0x47be8c};},'isAutoCheckEligible':_0x36689f=>{const {valid:_0xd743e0}=_0x51a937(_0x36689f);return _0xd743e0&&_0xae536c(_0x36689f);},'onChange':_0x490019=>{_0x1c3bba&&(_0x1c3bba['textContent']=_0x490019['length']+'\x20of\x20'+_0x103eaf['length']+'\x20file'+(_0x103eaf['length']!==0x1?'s':'')+'\x20selected');}}),this['_syncFileTree']['render']();}catch(_0x11d722){_0x228eef['innerHTML']='<span\x20style=\x22color:\x20var(--color-danger,\x20#e55368);\x20font-size:\x2013px;\x22>Failed\x20to\x20load\x20files</span>';}}['showError'](_0x59ce07){const _0x515044=this['_el']('approve-error'),_0xa4a643=this['_el']('approve-error-text');_0x515044&&_0xa4a643&&(_0xa4a643['textContent']=_0x59ce07,_0x515044['hidden']=![],_0x515044['scrollIntoView']({'behavior':'smooth','block':'nearest'}));}['hideError'](){const _0x3eec09=this['_el']('approve-error'),_0x4a871e=this['_el']('approve-error-text');_0x3eec09&&_0x4a871e&&(_0x3eec09['hidden']=!![],_0x4a871e['textContent']='');}['_displayBranchInfo'](_0x25bc54,_0x4b46c3={}){const _0x361bdc=this['_el']('approve-branches');if(!_0x361bdc)return;const _0x493928=[];for(const _0xc709ed of _0x25bc54){_0x4b46c3[_0xc709ed['name']]&&_0x493928['push']({'repo':_0xc709ed['name'],'branch':_0x4b46c3[_0xc709ed['name']]});}if(_0x493928['length']>0x0){_0x361bdc['hidden']=![];if(_0x493928['length']===0x1)_0x361bdc['innerHTML']='<div\x20class=\x22branch-info\x22>Branch:\x20<code>'+_0x493928[0x0]['branch']+'</code></div>';else{const _0x1e9845=_0x493928['map'](_0xf35ffe=>'<div\x20class=\x22branch-item\x22><strong>'+_0xf35ffe['repo']+':</strong>\x20<code>'+_0xf35ffe['branch']+'</code></div>')['join']('');_0x361bdc['innerHTML']='<div\x20class=\x22branch-info\x22>Branches:<div\x20class=\x22branch-list\x22>'+_0x1e9845+'</div></div>';}}else _0x361bdc['hidden']=!![],_0x361bdc['innerHTML']='';}['showWarning'](_0x582ff7){const _0x1f1a8a=this['_el']('approve-warning'),_0x120148=this['_el']('approve-warning-text');_0x1f1a8a&&_0x120148&&(_0x120148['textContent']=_0x582ff7,_0x1f1a8a['hidden']=![]);}['hideWarning'](){const _0x3cc3fa=this['_el']('approve-warning'),_0x332ccf=this['_el']('approve-warning-text');_0x3cc3fa&&_0x332ccf&&(_0x3cc3fa['hidden']=!![],_0x332ccf['textContent']='');}['_showConflictResolution'](){const _0xcb1f4f=this['_el']('conflict-resolution'),_0x18a017=this['_el']('confirm-approve'),_0x46ab1c=this['_el']('cancel-approve'),_0x483037=this['_el']('conflict-agent-resolve');if(_0xcb1f4f)_0xcb1f4f['hidden']=![];if(_0x18a017)_0x18a017['hidden']=!![];if(_0x46ab1c)_0x46ab1c['hidden']=!![];const _0x3d8076=this['_el']('approve-modal');if(_0x3d8076){this['_sectionsHiddenBeforeConflict']=new Set();for(const _0x2063e0 of _0x3d8076['querySelectorAll']('.modal-section')){_0x2063e0['hidden']&&this['_sectionsHiddenBeforeConflict']['add'](_0x2063e0),_0x2063e0['hidden']=!![];}}if(_0x483037){const _0x32c85a=!!this['onConflictFollowUp'];_0x483037['hidden']=!_0x32c85a,_0x483037['nextElementSibling']?.['classList']['contains']('field-hint')&&(_0x483037['nextElementSibling']['hidden']=!_0x32c85a);}}['_hideConflictResolution'](){const _0x4bfd4d=this['_el']('conflict-resolution'),_0x30f202=this['_el']('confirm-approve'),_0x2870d0=this['_el']('cancel-approve');if(_0x4bfd4d)_0x4bfd4d['hidden']=!![];if(_0x30f202)_0x30f202['hidden']=![];if(_0x2870d0)_0x2870d0['hidden']=![];const _0x4ca10c=this['_el']('approve-modal');if(_0x4ca10c){const _0xb46837=this['_sectionsHiddenBeforeConflict']||new Set();for(const _0x64c6a4 of _0x4ca10c['querySelectorAll']('.modal-section')){!_0xb46837['has'](_0x64c6a4)&&(_0x64c6a4['hidden']=![]);}this['_sectionsHiddenBeforeConflict']=null;}}['_getRemoteConflictWarning'](){const _0x5341d4=this['taskData']?.['reposChanged']||[],_0x134e36=this['_el']('pull-before-commit')?.['checked']??!![],_0x19222a=this['_el']('create-new-branch')?.['checked']||![];if(!_0x134e36||_0x19222a||_0x5341d4['length']===0x0)return'';const _0xb83f4e=_0x5341d4['filter'](_0x11adc8=>_0x11adc8?.['upstream_status']==='behind'||_0x11adc8?.['upstream_status']==='diverged');if(_0xb83f4e['length']===0x0)return'';const _0x5c60e7=_0xb83f4e['map'](_0x29d9be=>{const _0x3b3898=Number(_0x29d9be?.['upstream_behind'])||0x0,_0x34f439=_0x3b3898+'\x20commit'+(_0x3b3898===0x1?'':'s')+'\x20ahead';if(_0x29d9be['upstream_status']==='diverged')return _0x29d9be['name']+':\x20remote\x20is\x20'+_0x34f439+'\x20and\x20the\x20tracked\x20branch\x20has\x20local\x20commits';return _0x29d9be['name']+':\x20remote\x20is\x20'+_0x34f439;})['join'](';\x20');return'Remote\x20has\x20new\x20changes\x20('+_0x5c60e7+').\x20If\x20there\x20are\x20conflicts,\x20you\x27ll\x20be\x20given\x20options\x20to\x20resolve\x20them.';}['_refreshWarningBanner'](){const _0x310c7c=[this['taskData']?.['warning']||'',this['_getRemoteConflictWarning'](),this['_transientWarning']||'']['filter'](Boolean);if(_0x310c7c['length']>0x0){this['showWarning'](_0x310c7c['join']('\x20'));return;}this['hideWarning']();}['_stripCoAuthoredByLines'](_0x3e3400){return _0x3e3400['replace'](/^Co-Authored-By:.*$/gmi,'')['replace'](/^Learn more: https:\/\/coderflow\.ai\s*$/gm,'')['replace'](/\n{3,}/g,'\x0a\x0a')['trim']();}async['_addAttributionIfEnabled'](_0x5a4d3f){try{let _0x95ebcc;try{const _0x5b38d7=await fetch(this['baseUrl']+'/settings');if(_0x5b38d7['ok']){const _0x9e5f54=await _0x5b38d7['json']();_0x95ebcc=_0x9e5f54['coderflow_attribution']!==![];}}catch(_0x30119f){}_0x95ebcc===undefined&&(this['coderflowAttribution']!==undefined?_0x95ebcc=this['coderflowAttribution']!==![]:_0x95ebcc=!![]);const _0x3978fd=this['_stripCoAuthoredByLines'](_0x5a4d3f);if(!_0x95ebcc)return _0x3978fd;const _0x42fc7c='\x0a\x0aCo-Authored-By:\x20CoderFlow\x20<ai@coderflow.ai>\x0aLearn\x20more:\x20https://coderflow.ai';return _0x3978fd+_0x42fc7c;}catch(_0x5b70ac){return console['warn']('Failed\x20to\x20add\x20CoderFlow\x20attribution:',_0x5b70ac),_0x5a4d3f;}}['show'](_0x31e331){!this['initialized']&&this['init']();this['taskData']=_0x31e331;const _0x4e06a4=this['_el']('approve-modal'),_0x361ae3=this['_el']('commit-message-input'),_0x114d68=this['_el']('pull-before-commit'),_0x3e0949=this['_el']('push-after-commit'),_0x4d6db0=this['_el']('create-new-branch'),_0x3dc46b=this['_el']('new-branch-input-container'),_0x54a0aa=this['_el']('new-branch-name');if(!_0x4e06a4)return;this['hideError'](),this['hideWarning'](),this['_hideConflictResolution'](),this['_transientWarning']='';const _0x5624a0=_0x31e331['reposChanged']||[];if(_0x5624a0['length']===0x0&&!_0x31e331['syncFirst']){this['showToast']('No\x20changes\x20to\x20approve','error');return;}this['_updateDisplay'](_0x5624a0,_0x31e331);const _0xefde2c=_0x31e331['commitMessage']||'',_0x4b62ba=this['_stripCoAuthoredByLines'](_0xefde2c);_0x361ae3['value']=_0x4b62ba;if(_0x114d68)_0x114d68['checked']=!![];if(_0x3e0949)_0x3e0949['checked']=!![];_0x4d6db0&&(_0x4d6db0['checked']=![]);_0x3dc46b&&(_0x3dc46b['hidden']=!![]);_0x54a0aa&&(_0x54a0aa['value']='');if(_0x3e0949)_0x3e0949['disabled']=![];if(_0x4d6db0)_0x4d6db0['disabled']=![];this['_refreshWarningBanner'](),this['updatePRSupport'](_0x31e331['prSupported']===!![]);const _0x58ce34=this['_el']('ibmi-sync-section');if(_0x58ce34){_0x58ce34['hidden']=!_0x31e331['ibmiSyncAvailable'];const _0x29c6d5=this['_el']('sync-to-ibmi'),_0x27a2ce=this['_el']('ibmi-sync-fields'),_0x58dfe4=this['_el']('ibmi-sync-library');if(_0x29c6d5)_0x29c6d5['checked']=![];if(_0x27a2ce)_0x27a2ce['hidden']=!![];if(_0x58dfe4)_0x58dfe4['value']='';const _0x231a06=this['_el']('ibmi-sync-credentials-row');_0x231a06&&(_0x231a06['hidden']=!(_0x31e331['ibmiSyncAvailable']&&_0x31e331['syncCredentials']==='prompt'));}const _0x12ba03=this['_el']('confirm-approve');_0x31e331['syncFirst']&&this['onSync']?(_0x12ba03&&(_0x12ba03['disabled']=!![],_0x12ba03['textContent']='Syncing...'),this['_performSync']()):_0x12ba03&&(_0x12ba03['disabled']=![],_0x12ba03['textContent']='Commit\x20Changes');_0x4e06a4['hidden']=![];const _0x3e4935=++this['_attributionRequestId'];void this['_applyAttributionAsync']({'requestId':_0x3e4935,'taskId':_0x31e331['taskId'],'originalCommitMessage':_0x4b62ba}),setTimeout(()=>{_0x361ae3['focus'](),_0x361ae3['setSelectionRange'](0x0,_0x361ae3['value']['length']);},0x64);}['updatePRSupport'](_0x532056){const _0x5705ab=this['_el']('pr-option-section'),_0x31b3a6=this['_el']('create-pull-request'),_0x47383d=this['_el']('pr-hint'),_0x579a77=this['_el']('push-after-commit'),_0xbbaca3=this['_el']('create-new-branch');if(!_0x5705ab)return;if(_0x532056){_0x5705ab['hidden']=![];_0x31b3a6&&!_0x31b3a6['disabled']&&(_0x31b3a6['checked']=![]);if(_0x47383d)_0x47383d['hidden']=!![];this['_createPR']=![];return;}_0x31b3a6?.['checked']&&(_0x31b3a6['checked']=![]);if(_0x47383d)_0x47383d['hidden']=!![];if(_0x579a77)_0x579a77['disabled']=![];if(_0xbbaca3)_0xbbaca3['disabled']=![];this['_createPR']=![],_0x5705ab['hidden']=!![];}async['_applyAttributionAsync']({requestId:_0x33a7ae,taskId:_0x147175,originalCommitMessage:_0x45089c}){const _0x3c9fcc=this['_el']('commit-message-input');if(!_0x3c9fcc)return;const _0x19e6e1=await this['_addAttributionIfEnabled'](_0x45089c);if(_0x33a7ae!==this['_attributionRequestId'])return;if(!this['taskData']||this['taskData']['taskId']!==_0x147175)return;if(!this['isVisible']())return;const _0x443569=_0x37efb1=>_0x37efb1['replace'](/\r\n/g,'\x0a')['replace'](/\r/g,'\x0a');if(_0x443569(_0x3c9fcc['value'])!==_0x443569(_0x45089c))return;_0x3c9fcc['value']=_0x19e6e1;}['_updateDisplay'](_0x11df77,_0xb30cfa){const _0x3ef3e3=this['_el']('approve-repo-name'),_0x203548=this['_el']('approve-stats'),_0x3b5fa0=this['_el']('multi-repo-note');if(_0x11df77['length']===0x0){if(_0x3ef3e3)_0x3ef3e3['textContent']='Syncing...';if(_0x203548)_0x203548['textContent']='';if(_0x3b5fa0)_0x3b5fa0['hidden']=!![];return;}const _0x27e7b8=_0x11df77['reduce']((_0x3dbda0,_0x380a4b)=>_0x3dbda0+(_0x380a4b['files_changed']||0x0),0x0),_0x4de2bb=_0x11df77['reduce']((_0xa8166d,_0x105338)=>_0xa8166d+(_0x105338['lines_added']||0x0),0x0),_0x583c86=_0x11df77['reduce']((_0xa9bb4,_0x3cf86c)=>_0xa9bb4+(_0x3cf86c['lines_deleted']||0x0),0x0);if(_0x11df77['length']===0x1){if(_0x3ef3e3)_0x3ef3e3['textContent']=_0x11df77[0x0]?.['name']||'repository';if(_0x3b5fa0)_0x3b5fa0['hidden']=!![];}else{const _0x4097ed=_0x11df77['map'](_0x5114d5=>_0x5114d5['name'])['join'](',\x20');if(_0x3ef3e3)_0x3ef3e3['textContent']=_0x11df77['length']+'\x20repositories:\x20'+_0x4097ed;if(_0x3b5fa0)_0x3b5fa0['hidden']=![];}_0x203548&&(_0x203548['textContent']=_0x27e7b8+'\x20file'+(_0x27e7b8===0x1?'':'s')+'\x20changed\x20(+'+_0x4de2bb+'\x20-'+_0x583c86+')'),this['_displayBranchInfo'](_0x11df77,_0xb30cfa?.['branches']||{});}async['_performSync'](){if(!this['onSync']||this['isSyncing'])return;this['isSyncing']=!![];const _0x174e86=this['_el']('confirm-approve');try{const _0xb7c51e=await this['onSync'](this['taskData']['taskId']);if(!this['isVisible']()){this['isSyncing']=![];return;}if(_0xb7c51e['repos_changed']){const _0x13b76e=this['taskData']['reposChanged']?.['length']||0x0,_0x2ac4d8=this['taskData']['reposChanged']?.['reduce']((_0x35b1dd,_0x568bf6)=>_0x35b1dd+(_0x568bf6['files_changed']||0x0),0x0)||0x0;this['taskData']['reposChanged']=_0xb7c51e['repos_changed'];if(_0xb7c51e['current_branches']){const _0x51931f={...this['taskData']['branches']||{}};for(const [_0x48cfb0,_0xe02111]of Object['entries'](_0xb7c51e['current_branches'])){_0xe02111?_0x51931f[_0x48cfb0]=_0xe02111:delete _0x51931f[_0x48cfb0];}this['taskData']['branches']=_0x51931f;}this['_updateDisplay'](_0xb7c51e['repos_changed'],this['taskData']);const _0x40cda8=_0xb7c51e['repos_changed']['length'],_0x27f3eb=_0xb7c51e['repos_changed']['reduce']((_0x58bfa4,_0x5a960a)=>_0x58bfa4+(_0x5a960a['files_changed']||0x0),0x0);(_0x27f3eb>_0x2ac4d8||_0x40cda8>_0x13b76e)&&(this['_transientWarning']='Additional\x20changes\x20detected\x20since\x20last\x20sync.\x20Review\x20the\x20updated\x20file\x20list.'),this['_refreshWarningBanner']();}_0x174e86&&(!this['taskData']['reposChanged']||this['taskData']['reposChanged']['length']===0x0?(_0x174e86['disabled']=!![],_0x174e86['textContent']='No\x20Changes',this['showError']('No\x20changes\x20to\x20approve\x20after\x20sync')):(_0x174e86['disabled']=![],_0x174e86['textContent']='Commit\x20Changes'));}catch(_0x53c24d){console['error']('Failed\x20to\x20sync\x20repos\x20before\x20approve:',_0x53c24d);if(!this['isVisible']()){this['isSyncing']=![];return;}this['showError']('Sync\x20failed:\x20'+_0x53c24d['message']+'.\x20You\x20can\x20still\x20commit\x20with\x20existing\x20staged\x20changes.'),_0x174e86&&(this['taskData']['reposChanged']&&this['taskData']['reposChanged']['length']>0x0?(_0x174e86['disabled']=![],_0x174e86['textContent']='Commit\x20Changes'):(_0x174e86['disabled']=!![],_0x174e86['textContent']='No\x20Changes'));}finally{this['isSyncing']=![];}}['hide'](){const _0x10e133=this['_el']('approve-modal');_0x10e133&&(_0x10e133['hidden']=!![]),this['_syncFileTree']&&(this['_syncFileTree']['destroy'](),this['_syncFileTree']=null),this['_syncRelativeFiles']=null,this['_syncAbsolutePaths']=null;}async['_handleApprove'](){const _0x526308=this['_el']('commit-message-input'),_0x1ffa4c=this['_el']('pull-before-commit'),_0x41b368=this['_el']('push-after-commit'),_0x555e7e=this['_el']('create-new-branch'),_0x557dc9=this['_el']('new-branch-name'),_0x17c48f=this['_el']('confirm-approve'),_0x323a7c=_0x526308['value']['trim'](),_0x2990ad=_0x1ffa4c?.['checked']??!![],_0xda7c63=_0x41b368?.['checked']??!![],_0x54192d=_0x555e7e?.['checked']||![],_0x21b87f=_0x557dc9?.['value']['trim']()||'';this['hideError']();if(!_0x323a7c){this['showError']('Commit\x20message\x20is\x20required'),_0x526308['focus']();return;}if(_0x54192d&&!_0x21b87f){this['showError']('Branch\x20name\x20is\x20required\x20when\x20creating\x20a\x20new\x20branch'),_0x557dc9?.['focus']();return;}if(_0x54192d&&_0x21b87f){const _0x41d2e4=/[\s~^:?*\[\\]/;if(_0x41d2e4['test'](_0x21b87f)){this['showError']('Invalid\x20branch\x20name.\x20Avoid\x20spaces\x20and\x20special\x20characters\x20like\x20~\x20^\x20:\x20?\x20*\x20[\x20\x5c'),_0x557dc9?.['focus']();return;}}const _0xdf1a5=this['_el']('sync-to-ibmi')?.['checked'];if(_0xdf1a5){const _0x4d7b30=this['_el']('ibmi-sync-library')?.['value']?.['trim']();if(!_0x4d7b30){this['showError']('IBM\x20i\x20library\x20name\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-library')?.['focus']();return;}if(this['_syncFileTree']){const _0x1651c6=this['_syncFileTree']['getSelectedFiles']();if(_0x1651c6['length']===0x0){this['showError']('Select\x20at\x20least\x20one\x20file\x20to\x20sync');return;}}if(this['taskData']?.['syncCredentials']==='prompt'){const _0x96a6e9=this['_el']('ibmi-sync-user')?.['value']?.['trim']();if(!_0x96a6e9){this['showError']('User\x20profile\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-user')?.['focus']();return;}const _0x375669=this['_el']('ibmi-sync-password')?.['value'];if(!_0x375669){this['showError']('Password\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-password')?.['focus']();return;}}}const _0x4e6562=_0x17c48f?.['textContent']||'Commit\x20Changes';_0x17c48f&&(_0x17c48f['disabled']=!![],_0x54192d?_0x17c48f['textContent']='Creating\x20branch\x20&\x20committing...':_0x17c48f['textContent']=_0x2990ad?'Pulling\x20&\x20Committing...':'Committing...');try{const _0x5e0cc8={'commit_message':_0x323a7c,'pull':_0x2990ad,'push':_0xda7c63,'conflict_strategy':'rebase'};_0x54192d&&_0x21b87f&&(_0x5e0cc8['new_branch']=_0x21b87f);let _0x4ec729=null;this['onApprove']&&(_0x4ec729=await this['onApprove'](this['taskData']['taskId'],_0x5e0cc8));let _0x289ff3='Changes\x20committed';if(_0x54192d)_0x289ff3='Changes\x20committed\x20to\x20new\x20branch\x20\x27'+_0x21b87f+'\x27',_0xda7c63&&(_0x289ff3+='\x20and\x20pushed');else{if(_0x2990ad&&_0xda7c63)_0x289ff3='Changes\x20pulled,\x20committed,\x20and\x20pushed';else{if(_0x2990ad)_0x289ff3='Changes\x20pulled\x20and\x20committed';else _0xda7c63&&(_0x289ff3='Changes\x20committed\x20and\x20pushed');}}const _0x16a634=this['_el']('sync-to-ibmi')?.['checked'];let _0x58764a=null,_0x466ab4=null,_0x4ca86c=null,_0xdc9955=null;if(_0x16a634&&this['onSyncToIbmi']){_0x58764a=this['_el']('ibmi-sync-library')?.['value']?.['trim']()?.['toUpperCase'](),_0x466ab4=this['_el']('ibmi-sync-user')?.['value']?.['trim']()?.['toUpperCase']()||null,_0x4ca86c=this['_el']('ibmi-sync-password')?.['value']||null;if(this['_syncFileTree']&&this['_syncRelativeFiles']&&this['_syncAbsolutePaths']){const _0x3b9a6b=this['_syncFileTree']['getSelectedFiles']();_0xdc9955=_0x3b9a6b['map'](_0x6c8c69=>{const _0x5d0911=this['_syncRelativeFiles']['indexOf'](_0x6c8c69);return _0x5d0911>=0x0?this['_syncAbsolutePaths'][_0x5d0911]:_0x6c8c69;});}}this['showToast'](_0x289ff3,'success'),this['hide']();if(this['_createPR']&&this['onCreatePR'])try{await this['onCreatePR'](this['taskData']['taskId'],_0x4ec729||{});}catch(_0x2eb64c){console['warn']('PR\x20creation\x20failed\x20or\x20cancelled:',_0x2eb64c);}if(_0x16a634&&this['onSyncToIbmi']&&_0x58764a){localStorage['setItem']('coderflow_ibmi_sync_library',_0x58764a);if(_0x466ab4)localStorage['setItem']('coderflow_ibmi_sync_user',_0x466ab4);try{await this['onSyncToIbmi'](this['taskData']['taskId'],_0x58764a,_0x466ab4,_0x4ca86c,_0xdc9955);}catch(_0x2b1c5a){this['showToast']('Sync\x20failed:\x20'+_0x2b1c5a['message'],'error');}}this['onSuccess']&&this['onSuccess'](this['taskData']);}catch(_0xa994e0){console['error']('Failed\x20to\x20approve\x20changes',_0xa994e0),_0xa994e0['hasConflicts']?this['_showConflictResolution']():this['showError']('Failed\x20to\x20commit:\x20'+_0xa994e0['message']),_0x17c48f&&(_0x17c48f['disabled']=![],_0x17c48f['textContent']=_0x4e6562),this['onError']&&this['onError'](_0xa994e0);}}['isVisible'](){const _0x204cb6=this['_el']('approve-modal');return _0x204cb6&&!_0x204cb6['hidden'];}['destroy'](){const _0x1be49e=this['_el']('approve-modal');_0x1be49e&&_0x1be49e['remove'](),this['initialized']=![];}}export function getApproveState(_0x1411f3,_0x2f7b3c){if(!_0x1411f3)return{'canApprove':![],'reason':'No\x20task\x20data'};if(isLogOnlyTaskType(_0x1411f3['taskType']))return{'canApprove':![],'reason':(_0x1411f3['taskType']==='test'?'Test':'Deploy')+'\x20tasks\x20cannot\x20be\x20approved'};const _0x126885=_0x2f7b3c?.['repos_changed']?.['length']>0x0,_0x48a040=_0x1411f3['status']==='completed'||_0x1411f3['status']==='failed'||_0x1411f3['status']==='interrupted',_0x172da7=_0x1411f3['containerState']==='running',_0x1e6d3c=_0x1411f3['approvedBy']!==undefined&&_0x1411f3['approvedBy']!==null;if(_0x1e6d3c){const _0x178e95=_0x1411f3['approvedBy']['name']||_0x1411f3['approvedBy']['username']||'user';return{'canApprove':![],'reason':'Already\x20approved\x20by\x20'+_0x178e95};}if(!_0x126885)return{'canApprove':![],'reason':'No\x20changes\x20to\x20approve'};if(!_0x48a040)return{'canApprove':![],'reason':'Task\x20must\x20complete\x20first'};if(!_0x1411f3['containerId'])return{'canApprove':![],'reason':'Container\x20no\x20longer\x20available'};if(!_0x172da7)return{'canApprove':![],'reason':'Container\x20is\x20not\x20running'};return{'canApprove':!![],'reason':'Ready\x20to\x20approve'};}
|
|
1
|
+
function isLogOnlyTaskType(_0xdb6c0d){return _0xdb6c0d==='test'||_0xdb6c0d==='deploy';}export function createApproveDialogHTML(_0x2b5095='',_0x140a8f={}){const _0x2b7937=_0x2b5095,_0x934f3b=_0x140a8f['useTaskPageStyles']?'modal\x20profound-approve-modal':'profound-feedback-modal\x20profound-approve-modal',_0x345c20=_0x140a8f['useTaskPageStyles']?'modal-warning':'approve-modal-warning',_0x14fb67=_0x140a8f['useTaskPageStyles']?'modal-error':'approve-modal-error';return'\x0a\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'approve-modal\x22\x20class=\x22'+_0x934f3b+'\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-overlay\x22></div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-content\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h2>Approve\x20Changes</h2>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22modal-close\x22\x20id=\x22'+_0x2b7937+'close-approve-modal\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-body\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'approve-warning\x22\x20class=\x22'+_0x345c20+'\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22warning-icon\x22>!</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0x2b7937+'approve-warning-text\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'approve-error\x22\x20class=\x22'+_0x14fb67+'\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22error-icon\x22>!</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0x2b7937+'approve-error-text\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'conflict-resolution\x22\x20class=\x22conflict-resolution-panel\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22conflict-resolution-message\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22warning-icon\x22>!</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Remote\x20has\x20conflicting\x20changes\x20that\x20couldn\x27t\x20be\x20merged\x20automatically.</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22conflict-resolution-options\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-primary\x20btn-small\x22\x20id=\x22'+_0x2b7937+'conflict-agent-resolve\x22>Let\x20the\x20agent\x20resolve\x20conflicts</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22>The\x20agent\x20will\x20pull\x20remote\x20changes,\x20resolve\x20conflicts,\x20and\x20prepare\x20for\x20re-approval.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-secondary\x20btn-small\x22\x20id=\x22'+_0x2b7937+'conflict-new-branch\x22>Create\x20a\x20new\x20branch\x20instead</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22>Avoids\x20the\x20conflict\x20by\x20committing\x20to\x20a\x20separate\x20branch.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-secondary\x20btn-small\x22\x20id=\x22'+_0x2b7937+'conflict-cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-info\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0x2b7937+'approve-repo-name\x22\x20class=\x22modal-repo\x22>Repository</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20id=\x22'+_0x2b7937+'approve-stats\x22\x20class=\x22modal-stats\x22>0\x20files\x20changed</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'approve-branches\x22\x20class=\x22modal-branches\x22\x20hidden></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0x2b7937+'commit-message-input\x22>Commit\x20message:</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<textarea\x20id=\x22'+_0x2b7937+'commit-message-input\x22\x20class=\x22commit-message-input\x22\x20rows=\x226\x22\x20placeholder=\x22Enter\x20commit\x20message...\x22></textarea>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20id=\x22'+_0x2b7937+'multi-repo-note\x22\x20class=\x22field-hint\x22\x20hidden>This\x20commit\x20message\x20will\x20be\x20used\x20for\x20all\x20repositories\x20listed\x20above.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0x2b7937+'pull-before-commit\x22\x20checked>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Pull\x20from\x20remote\x20after\x20commit</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0x2b7937+'push-after-commit\x22\x20checked>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Push\x20to\x20remote\x20after\x20commit</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-section\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0x2b7937+'create-new-branch\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Create\x20new\x20branch</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'new-branch-input-container\x22\x20class=\x22new-branch-container\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20id=\x22'+_0x2b7937+'new-branch-name\x22\x20class=\x22new-branch-input\x22\x20placeholder=\x22Enter\x20new\x20branch\x20name...\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22>A\x20new\x20branch\x20will\x20be\x20created\x20from\x20the\x20current\x20branch\x20before\x20committing.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'pr-option-section\x22\x20class=\x22modal-section\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0x2b7937+'create-pull-request\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Create\x20pull\x20request</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22field-hint\x22\x20id=\x22'+_0x2b7937+'pr-hint\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20A\x20new\x20branch\x20will\x20be\x20created,\x20pushed,\x20and\x20a\x20pull\x20request\x20opened.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'ibmi-sync-section\x22\x20class=\x22modal-section\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22approve-divider\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22checkbox-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22'+_0x2b7937+'sync-to-ibmi\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>Sync\x20to\x20IBM\x20i</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'ibmi-sync-fields\x22\x20class=\x22new-branch-container\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0x2b7937+'ibmi-sync-library\x22>Library\x20name</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20id=\x22'+_0x2b7937+'ibmi-sync-library\x22\x20class=\x22new-branch-input\x20code-font\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20maxlength=\x2210\x22\x20placeholder=\x22e.g.,\x20MYLIB\x22\x20style=\x22width:\x20160px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'ibmi-sync-credentials-row\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0x2b7937+'ibmi-sync-user\x22\x20style=\x22margin-top:\x208px;\x20display:\x20block;\x22>User\x20profile</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20id=\x22'+_0x2b7937+'ibmi-sync-user\x22\x20class=\x22new-branch-input\x20code-font\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20maxlength=\x2210\x22\x20placeholder=\x22e.g.,\x20MYUSER\x22\x20style=\x22width:\x20160px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22'+_0x2b7937+'ibmi-sync-password\x22\x20style=\x22margin-top:\x208px;\x20display:\x20block;\x22>Password</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22password\x22\x20id=\x22'+_0x2b7937+'ibmi-sync-password\x22\x20class=\x22new-branch-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22Enter\x20password\x22\x20style=\x22width:\x20160px;\x22\x20autocomplete=\x22off\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'ibmi-sync-files-section\x22\x20style=\x22margin-top:\x2010px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20style=\x22display:\x20block;\x20margin-bottom:\x204px;\x22>Files\x20to\x20sync</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22'+_0x2b7937+'ibmi-sync-file-tree\x22\x20class=\x22file-selection-tree-container\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20style=\x22max-height:\x20250px;\x20overflow-y:\x20auto;\x20border:\x201px\x20solid\x20var(--border-color,\x20var(--color-border));\x20border-radius:\x204px;\x20padding:\x208px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-selection-summary\x22\x20id=\x22'+_0x2b7937+'ibmi-sync-files-summary\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22modal-footer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-ghost\x22\x20id=\x22'+_0x2b7937+'cancel-approve\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-primary\x22\x20id=\x22'+_0x2b7937+'confirm-approve\x22>Commit\x20Changes</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20';}export class ApproveDialog{constructor(_0x27b1ff={}){this['prefix']=_0x27b1ff['prefix']||'',this['onApprove']=_0x27b1ff['onApprove'],this['onSync']=_0x27b1ff['onSync'],this['onSuccess']=_0x27b1ff['onSuccess'],this['onError']=_0x27b1ff['onError'],this['onCreatePR']=_0x27b1ff['onCreatePR'],this['showToast']=_0x27b1ff['showToast']||(()=>{}),this['container']=_0x27b1ff['container']||document['body'],this['useTaskPageStyles']=_0x27b1ff['useTaskPageStyles']||![],this['baseUrl']=_0x27b1ff['baseUrl']||'',this['coderflowAttribution']=_0x27b1ff['coderflowAttribution'],this['onConflictFollowUp']=_0x27b1ff['onConflictFollowUp']||null,this['onSyncToIbmi']=_0x27b1ff['onSyncToIbmi']||null,this['onGetSyncFiles']=_0x27b1ff['onGetSyncFiles']||null,this['taskData']=null,this['initialized']=![],this['isSyncing']=![],this['_createPR']=![],this['_attributionRequestId']=0x0,this['_syncFileTree']=null,this['_syncRelativeFiles']=null,this['_syncAbsolutePaths']=null,this['_transientWarning']='';}['init'](){if(this['initialized'])return;const _0x5c8b2e=document['createElement']('div');_0x5c8b2e['innerHTML']=createApproveDialogHTML(this['prefix'],{'useTaskPageStyles':this['useTaskPageStyles']}),this['container']['appendChild'](_0x5c8b2e['firstElementChild']),this['_bindEvents'](),this['initialized']=!![];}['_el'](_0x135753){return document['getElementById'](''+this['prefix']+_0x135753);}['_bindEvents'](){const _0xa500fc=this['_el']('approve-modal'),_0x4a6530=this['_el']('close-approve-modal'),_0x364daf=this['_el']('cancel-approve'),_0x56c644=this['_el']('confirm-approve'),_0x4d1a98=_0xa500fc?.['querySelector']('.modal-overlay'),_0x434229=this['_el']('pull-before-commit'),_0xe4c7db=this['_el']('create-new-branch'),_0x14a084=this['_el']('new-branch-input-container'),_0x478464=this['_el']('new-branch-name'),_0x348641=this['_el']('push-after-commit'),_0x30b0c5=this['_el']('create-pull-request'),_0x40429b=this['_el']('pr-hint'),_0x2325ba=()=>{this['_refreshWarningBanner']();};_0x4a6530?.['addEventListener']('click',()=>this['hide']()),_0x364daf?.['addEventListener']('click',()=>this['hide']()),_0x4d1a98?.['addEventListener']('click',()=>this['hide']()),_0x56c644?.['addEventListener']('click',()=>this['_handleApprove']());_0xe4c7db&&_0xe4c7db['addEventListener']('change',()=>{_0x14a084&&(_0x14a084['hidden']=!_0xe4c7db['checked']),_0xe4c7db['checked']&&_0x478464&&_0x478464['focus'](),_0x2325ba();});_0x434229?.['addEventListener']('change',()=>{_0x2325ba();});_0x30b0c5&&_0x348641&&_0xe4c7db&&(_0x30b0c5['addEventListener']('change',()=>{this['_createPR']=_0x30b0c5['checked'];if(_0x30b0c5['checked']){_0x348641['checked']=!![],_0x348641['disabled']=!![],_0xe4c7db['checked']=!![],_0xe4c7db['disabled']=!![];_0x14a084&&(_0x14a084['hidden']=![]);if(_0x40429b)_0x40429b['hidden']=![];}else{_0x348641['disabled']=![],_0xe4c7db['disabled']=![];if(_0x40429b)_0x40429b['hidden']=!![];}_0x2325ba();}),_0x348641['addEventListener']('change',()=>{if(!_0x348641['checked']&&_0x30b0c5['checked']){_0x30b0c5['checked']=![],this['_createPR']=![],_0x348641['disabled']=![],_0xe4c7db['disabled']=![];if(_0x40429b)_0x40429b['hidden']=!![];}}));_0x2325ba();const _0x4e464f=this['_el']('sync-to-ibmi');_0x4e464f&&_0x4e464f['addEventListener']('change',async _0x6b5610=>{const _0x5e2121=this['_el']('ibmi-sync-fields');if(_0x5e2121)_0x5e2121['hidden']=!_0x6b5610['target']['checked'];if(_0x6b5610['target']['checked']){const _0xced38e=this['_el']('ibmi-sync-library'),_0x3b9155=localStorage['getItem']('coderflow_ibmi_sync_library');_0x3b9155&&_0xced38e&&!_0xced38e['value']&&(_0xced38e['value']=_0x3b9155);const _0x4de376=this['_el']('ibmi-sync-user');if(_0x4de376&&!_0x4de376['value']){const _0x7faa2a=localStorage['getItem']('coderflow_ibmi_sync_user');if(_0x7faa2a)_0x4de376['value']=_0x7faa2a;}const _0x12e654=this['_el']('ibmi-sync-password');if(_0x12e654)_0x12e654['value']='';!this['_syncFileTree']&&this['onGetSyncFiles']&&this['taskData']?.['taskId']&&await this['_loadSyncFileTree']();}}),this['_el']('conflict-agent-resolve')?.['addEventListener']('click',()=>{this['onConflictFollowUp']&&this['onConflictFollowUp'](this['taskData']['taskId']),this['hide'](),this['showToast']('Agent\x20is\x20resolving\x20conflicts.\x20Re-approve\x20when\x20it\x20finishes.','info');}),this['_el']('conflict-new-branch')?.['addEventListener']('click',()=>{this['_hideConflictResolution']();const _0x5cc1bb=this['_el']('create-new-branch'),_0x521c53=this['_el']('new-branch-input-container'),_0x5ee61f=this['_el']('new-branch-name');if(_0x5cc1bb)_0x5cc1bb['checked']=!![];if(_0x521c53)_0x521c53['hidden']=![];if(_0x5ee61f)_0x5ee61f['focus']();_0x2325ba();}),this['_el']('conflict-cancel')?.['addEventListener']('click',()=>this['hide']()),document['addEventListener']('keydown',_0x4e5a29=>{_0x4e5a29['key']==='Escape'&&_0xa500fc&&!_0xa500fc['hidden']&&this['hide']();});}async['_loadSyncFileTree'](){const _0x17b8af=this['_el']('ibmi-sync-file-tree'),_0xa8fafc=this['_el']('ibmi-sync-files-summary');if(!_0x17b8af)return;_0x17b8af['innerHTML']='<span\x20style=\x22color:\x20var(--color-text-muted,\x20#888);\x20font-size:\x2013px;\x22>Loading\x20files...</span>';if(_0xa8fafc)_0xa8fafc['textContent']='';try{const {files:_0x55d039,absolutePaths:_0x41962d}=await this['onGetSyncFiles'](this['taskData']['taskId']);this['_syncRelativeFiles']=_0x55d039,this['_syncAbsolutePaths']=_0x41962d;if(_0x55d039['length']===0x0){_0x17b8af['innerHTML']='<span\x20style=\x22color:\x20var(--color-text-muted,\x20#888);\x20font-size:\x2013px;\x22>No\x20changed\x20files\x20found.</span>';return;}const {FileSelectionTree:_0x626151}=await import('./file-selection-tree.js'),{validateIbmiFile:_0x396bdb,hasKnownIbmiExtension:_0x223985}=await import('./ibmi-file-filter.js');this['_syncFileTree']=new _0x626151({'container':_0x17b8af,'files':_0x55d039,'isPreselected':_0x5d6422=>{const {valid:_0xacb1bf}=_0x396bdb(_0x5d6422);return _0xacb1bf&&_0x223985(_0x5d6422);},'isDisabled':_0xe56021=>{const {valid:_0x12876c,reason:_0x20be01}=_0x396bdb(_0xe56021);return{'disabled':!_0x12876c,'reason':_0x20be01};},'isAutoCheckEligible':_0xf796c4=>{const {valid:_0xe819fc}=_0x396bdb(_0xf796c4);return _0xe819fc&&_0x223985(_0xf796c4);},'onChange':_0xcff647=>{_0xa8fafc&&(_0xa8fafc['textContent']=_0xcff647['length']+'\x20of\x20'+_0x55d039['length']+'\x20file'+(_0x55d039['length']!==0x1?'s':'')+'\x20selected');}}),this['_syncFileTree']['render']();}catch(_0x7b936){_0x17b8af['innerHTML']='<span\x20style=\x22color:\x20var(--color-danger,\x20#e55368);\x20font-size:\x2013px;\x22>Failed\x20to\x20load\x20files</span>';}}['showError'](_0x2c91c5){const _0x5ce84e=this['_el']('approve-error'),_0x2aa584=this['_el']('approve-error-text');_0x5ce84e&&_0x2aa584&&(_0x2aa584['textContent']=_0x2c91c5,_0x5ce84e['hidden']=![],_0x5ce84e['scrollIntoView']({'behavior':'smooth','block':'nearest'}));}['hideError'](){const _0x1a2f1e=this['_el']('approve-error'),_0x1cc0f2=this['_el']('approve-error-text');_0x1a2f1e&&_0x1cc0f2&&(_0x1a2f1e['hidden']=!![],_0x1cc0f2['textContent']='');}['_displayBranchInfo'](_0x2917d6,_0x3a7dc6={}){const _0x486894=this['_el']('approve-branches');if(!_0x486894)return;const _0x3b0d4d=[];for(const _0x21fe99 of _0x2917d6){_0x3a7dc6[_0x21fe99['name']]&&_0x3b0d4d['push']({'repo':_0x21fe99['name'],'branch':_0x3a7dc6[_0x21fe99['name']]});}if(_0x3b0d4d['length']>0x0){_0x486894['hidden']=![];if(_0x3b0d4d['length']===0x1)_0x486894['innerHTML']='<div\x20class=\x22branch-info\x22>Branch:\x20<code>'+_0x3b0d4d[0x0]['branch']+'</code></div>';else{const _0x23a5a5=_0x3b0d4d['map'](_0x20c259=>'<div\x20class=\x22branch-item\x22><strong>'+_0x20c259['repo']+':</strong>\x20<code>'+_0x20c259['branch']+'</code></div>')['join']('');_0x486894['innerHTML']='<div\x20class=\x22branch-info\x22>Branches:<div\x20class=\x22branch-list\x22>'+_0x23a5a5+'</div></div>';}}else _0x486894['hidden']=!![],_0x486894['innerHTML']='';}['showWarning'](_0x4b481d){const _0x1817aa=this['_el']('approve-warning'),_0xe3aa59=this['_el']('approve-warning-text');_0x1817aa&&_0xe3aa59&&(_0xe3aa59['textContent']=_0x4b481d,_0x1817aa['hidden']=![]);}['hideWarning'](){const _0x434101=this['_el']('approve-warning'),_0x3e4fe2=this['_el']('approve-warning-text');_0x434101&&_0x3e4fe2&&(_0x434101['hidden']=!![],_0x3e4fe2['textContent']='');}['_showConflictResolution'](){const _0x227f85=this['_el']('conflict-resolution'),_0x3e594b=this['_el']('confirm-approve'),_0x2ccef3=this['_el']('cancel-approve'),_0x2d155f=this['_el']('conflict-agent-resolve');if(_0x227f85)_0x227f85['hidden']=![];if(_0x3e594b)_0x3e594b['hidden']=!![];if(_0x2ccef3)_0x2ccef3['hidden']=!![];const _0x11cd23=this['_el']('approve-modal');if(_0x11cd23){this['_sectionsHiddenBeforeConflict']=new Set();for(const _0x4c7b8d of _0x11cd23['querySelectorAll']('.modal-section')){_0x4c7b8d['hidden']&&this['_sectionsHiddenBeforeConflict']['add'](_0x4c7b8d),_0x4c7b8d['hidden']=!![];}}if(_0x2d155f){const _0x28e817=!!this['onConflictFollowUp'];_0x2d155f['hidden']=!_0x28e817,_0x2d155f['nextElementSibling']?.['classList']['contains']('field-hint')&&(_0x2d155f['nextElementSibling']['hidden']=!_0x28e817);}}['_hideConflictResolution'](){const _0xc2cad8=this['_el']('conflict-resolution'),_0x2a3a2a=this['_el']('confirm-approve'),_0x35ea05=this['_el']('cancel-approve');if(_0xc2cad8)_0xc2cad8['hidden']=!![];if(_0x2a3a2a)_0x2a3a2a['hidden']=![];if(_0x35ea05)_0x35ea05['hidden']=![];const _0x5cf2c8=this['_el']('approve-modal');if(_0x5cf2c8){const _0x135948=this['_sectionsHiddenBeforeConflict']||new Set();for(const _0x5c5dae of _0x5cf2c8['querySelectorAll']('.modal-section')){!_0x135948['has'](_0x5c5dae)&&(_0x5c5dae['hidden']=![]);}this['_sectionsHiddenBeforeConflict']=null;}}['_getRemoteConflictWarning'](){const _0x12da98=this['taskData']?.['reposChanged']||[],_0x287eee=this['_el']('pull-before-commit')?.['checked']??!![],_0x440119=this['_el']('create-new-branch')?.['checked']||![];if(!_0x287eee||_0x440119||_0x12da98['length']===0x0)return'';const _0x4ab247=_0x12da98['filter'](_0x357d1a=>_0x357d1a?.['upstream_status']==='behind'||_0x357d1a?.['upstream_status']==='diverged');if(_0x4ab247['length']===0x0)return'';const _0x4fc742=_0x4ab247['map'](_0x45552c=>{const _0x3f8589=Number(_0x45552c?.['upstream_behind'])||0x0,_0x29256b=_0x3f8589+'\x20commit'+(_0x3f8589===0x1?'':'s')+'\x20ahead';if(_0x45552c['upstream_status']==='diverged')return _0x45552c['name']+':\x20remote\x20is\x20'+_0x29256b+'\x20and\x20the\x20tracked\x20branch\x20has\x20local\x20commits';return _0x45552c['name']+':\x20remote\x20is\x20'+_0x29256b;})['join'](';\x20');return'Remote\x20has\x20new\x20changes\x20('+_0x4fc742+').\x20If\x20there\x20are\x20conflicts,\x20you\x27ll\x20be\x20given\x20options\x20to\x20resolve\x20them.';}['_refreshWarningBanner'](){const _0x42d879=[this['taskData']?.['warning']||'',this['_getRemoteConflictWarning'](),this['_transientWarning']||'']['filter'](Boolean);if(_0x42d879['length']>0x0){this['showWarning'](_0x42d879['join']('\x20'));return;}this['hideWarning']();}['_stripCoAuthoredByLines'](_0x2a616a){return _0x2a616a['replace'](/^Co-Authored-By:.*$/gmi,'')['replace'](/^Learn more: https:\/\/coderflow\.ai\s*$/gm,'')['replace'](/\n{3,}/g,'\x0a\x0a')['trim']();}async['_addAttributionIfEnabled'](_0x175a00){try{let _0x583f7f;try{const _0x39436c=await fetch(this['baseUrl']+'/settings');if(_0x39436c['ok']){const _0x24a84c=await _0x39436c['json']();_0x583f7f=_0x24a84c['coderflow_attribution']!==![];}}catch(_0x5a6864){}_0x583f7f===undefined&&(this['coderflowAttribution']!==undefined?_0x583f7f=this['coderflowAttribution']!==![]:_0x583f7f=!![]);const _0x2b9f8f=this['_stripCoAuthoredByLines'](_0x175a00);if(!_0x583f7f)return _0x2b9f8f;const _0x5e1ca4='\x0a\x0aCo-Authored-By:\x20CoderFlow\x20<ai@coderflow.ai>\x0aLearn\x20more:\x20https://coderflow.ai';return _0x2b9f8f+_0x5e1ca4;}catch(_0x4b5c10){return console['warn']('Failed\x20to\x20add\x20CoderFlow\x20attribution:',_0x4b5c10),_0x175a00;}}['show'](_0x4e719d){!this['initialized']&&this['init']();this['taskData']=_0x4e719d;const _0x3661c0=this['_el']('approve-modal'),_0xa3553c=this['_el']('commit-message-input'),_0x52e401=this['_el']('pull-before-commit'),_0x4e12e3=this['_el']('push-after-commit'),_0x3e58d4=this['_el']('create-new-branch'),_0xf80a51=this['_el']('new-branch-input-container'),_0x27590c=this['_el']('new-branch-name');if(!_0x3661c0)return;this['hideError'](),this['hideWarning'](),this['_hideConflictResolution'](),this['_transientWarning']='';const _0xbd8678=_0x4e719d['reposChanged']||[];if(_0xbd8678['length']===0x0&&!_0x4e719d['syncFirst']){this['showToast']('No\x20changes\x20to\x20approve','error');return;}this['_updateDisplay'](_0xbd8678,_0x4e719d);const _0x792c9f=_0x4e719d['commitMessage']||'',_0x263203=this['_stripCoAuthoredByLines'](_0x792c9f);_0xa3553c['value']=_0x263203;if(_0x52e401)_0x52e401['checked']=!![];if(_0x4e12e3)_0x4e12e3['checked']=!![];_0x3e58d4&&(_0x3e58d4['checked']=![]);_0xf80a51&&(_0xf80a51['hidden']=!![]);_0x27590c&&(_0x27590c['value']='');if(_0x4e12e3)_0x4e12e3['disabled']=![];if(_0x3e58d4)_0x3e58d4['disabled']=![];this['_refreshWarningBanner'](),this['updatePRSupport'](_0x4e719d['prSupported']===!![]);const _0x5faed0=this['_el']('ibmi-sync-section');if(_0x5faed0){_0x5faed0['hidden']=!_0x4e719d['ibmiSyncAvailable'];const _0x1d10f1=this['_el']('sync-to-ibmi'),_0x314279=this['_el']('ibmi-sync-fields'),_0x2b62ca=this['_el']('ibmi-sync-library');if(_0x1d10f1)_0x1d10f1['checked']=![];if(_0x314279)_0x314279['hidden']=!![];if(_0x2b62ca)_0x2b62ca['value']='';const _0x53cb47=this['_el']('ibmi-sync-credentials-row');_0x53cb47&&(_0x53cb47['hidden']=!(_0x4e719d['ibmiSyncAvailable']&&_0x4e719d['syncCredentials']==='prompt'));}const _0x29cc8d=this['_el']('confirm-approve');_0x4e719d['syncFirst']&&this['onSync']?(_0x29cc8d&&(_0x29cc8d['disabled']=!![],_0x29cc8d['textContent']='Syncing...'),this['_performSync']()):_0x29cc8d&&(_0x29cc8d['disabled']=![],_0x29cc8d['textContent']='Commit\x20Changes');_0x3661c0['hidden']=![];const _0x780703=++this['_attributionRequestId'];void this['_applyAttributionAsync']({'requestId':_0x780703,'taskId':_0x4e719d['taskId'],'originalCommitMessage':_0x263203}),setTimeout(()=>{_0xa3553c['focus'](),_0xa3553c['setSelectionRange'](0x0,_0xa3553c['value']['length']);},0x64);}['updatePRSupport'](_0x1dcd56){const _0x2f111b=this['_el']('pr-option-section'),_0x1ea910=this['_el']('create-pull-request'),_0x40ad8d=this['_el']('pr-hint'),_0x4cbd6b=this['_el']('push-after-commit'),_0x49f24b=this['_el']('create-new-branch');if(!_0x2f111b)return;if(_0x1dcd56){_0x2f111b['hidden']=![];_0x1ea910&&!_0x1ea910['disabled']&&(_0x1ea910['checked']=![]);if(_0x40ad8d)_0x40ad8d['hidden']=!![];this['_createPR']=![];return;}_0x1ea910?.['checked']&&(_0x1ea910['checked']=![]);if(_0x40ad8d)_0x40ad8d['hidden']=!![];if(_0x4cbd6b)_0x4cbd6b['disabled']=![];if(_0x49f24b)_0x49f24b['disabled']=![];this['_createPR']=![],_0x2f111b['hidden']=!![];}async['_applyAttributionAsync']({requestId:_0x44addd,taskId:_0x2acdee,originalCommitMessage:_0x4bc699}){const _0x51fb48=this['_el']('commit-message-input');if(!_0x51fb48)return;const _0x2a5a6f=await this['_addAttributionIfEnabled'](_0x4bc699);if(_0x44addd!==this['_attributionRequestId'])return;if(!this['taskData']||this['taskData']['taskId']!==_0x2acdee)return;if(!this['isVisible']())return;const _0x123338=_0xa6bd4=>_0xa6bd4['replace'](/\r\n/g,'\x0a')['replace'](/\r/g,'\x0a');if(_0x123338(_0x51fb48['value'])!==_0x123338(_0x4bc699))return;_0x51fb48['value']=_0x2a5a6f;}['_updateDisplay'](_0x35d410,_0x87a951){const _0x5a00a0=this['_el']('approve-repo-name'),_0x48f351=this['_el']('approve-stats'),_0x5016ce=this['_el']('multi-repo-note');if(_0x35d410['length']===0x0){if(_0x5a00a0)_0x5a00a0['textContent']='Syncing...';if(_0x48f351)_0x48f351['textContent']='';if(_0x5016ce)_0x5016ce['hidden']=!![];return;}const _0x79f8b=_0x35d410['reduce']((_0x3082df,_0x13c3ff)=>_0x3082df+(_0x13c3ff['files_changed']||0x0),0x0),_0x1a3078=_0x35d410['reduce']((_0x1486e6,_0x114e30)=>_0x1486e6+(_0x114e30['lines_added']||0x0),0x0),_0x1db4f5=_0x35d410['reduce']((_0x59f772,_0x582951)=>_0x59f772+(_0x582951['lines_deleted']||0x0),0x0);if(_0x35d410['length']===0x1){if(_0x5a00a0)_0x5a00a0['textContent']=_0x35d410[0x0]?.['name']||'repository';if(_0x5016ce)_0x5016ce['hidden']=!![];}else{const _0x49507b=_0x35d410['map'](_0xf5972f=>_0xf5972f['name'])['join'](',\x20');if(_0x5a00a0)_0x5a00a0['textContent']=_0x35d410['length']+'\x20repositories:\x20'+_0x49507b;if(_0x5016ce)_0x5016ce['hidden']=![];}_0x48f351&&(_0x48f351['textContent']=_0x79f8b+'\x20file'+(_0x79f8b===0x1?'':'s')+'\x20changed\x20(+'+_0x1a3078+'\x20-'+_0x1db4f5+')'),this['_displayBranchInfo'](_0x35d410,_0x87a951?.['branches']||{});}async['_performSync'](){if(!this['onSync']||this['isSyncing'])return;this['isSyncing']=!![];const _0x3b648c=this['_el']('confirm-approve');try{const _0x33f922=await this['onSync'](this['taskData']['taskId']);if(!this['isVisible']()){this['isSyncing']=![];return;}if(_0x33f922['repos_changed']){const _0x14f776=this['taskData']['reposChanged']?.['length']||0x0,_0x5f1837=this['taskData']['reposChanged']?.['reduce']((_0x565b14,_0x5b1d43)=>_0x565b14+(_0x5b1d43['files_changed']||0x0),0x0)||0x0;this['taskData']['reposChanged']=_0x33f922['repos_changed'];if(_0x33f922['current_branches']){const _0x3b1566={...this['taskData']['branches']||{}};for(const [_0x40830f,_0x38b523]of Object['entries'](_0x33f922['current_branches'])){_0x38b523?_0x3b1566[_0x40830f]=_0x38b523:delete _0x3b1566[_0x40830f];}this['taskData']['branches']=_0x3b1566;}this['_updateDisplay'](_0x33f922['repos_changed'],this['taskData']);const _0x1059b7=_0x33f922['repos_changed']['length'],_0x26eef2=_0x33f922['repos_changed']['reduce']((_0x555bc2,_0x5455ef)=>_0x555bc2+(_0x5455ef['files_changed']||0x0),0x0);(_0x26eef2>_0x5f1837||_0x1059b7>_0x14f776)&&(this['_transientWarning']='Additional\x20changes\x20detected\x20since\x20last\x20sync.\x20Review\x20the\x20updated\x20file\x20list.'),this['_refreshWarningBanner']();}_0x3b648c&&(!this['taskData']['reposChanged']||this['taskData']['reposChanged']['length']===0x0?(_0x3b648c['disabled']=!![],_0x3b648c['textContent']='No\x20Changes',this['showError']('No\x20changes\x20to\x20approve\x20after\x20sync')):(_0x3b648c['disabled']=![],_0x3b648c['textContent']='Commit\x20Changes'));}catch(_0x44756e){console['error']('Failed\x20to\x20sync\x20repos\x20before\x20approve:',_0x44756e);if(!this['isVisible']()){this['isSyncing']=![];return;}this['showError']('Sync\x20failed:\x20'+_0x44756e['message']+'.\x20You\x20can\x20still\x20commit\x20with\x20existing\x20staged\x20changes.'),_0x3b648c&&(this['taskData']['reposChanged']&&this['taskData']['reposChanged']['length']>0x0?(_0x3b648c['disabled']=![],_0x3b648c['textContent']='Commit\x20Changes'):(_0x3b648c['disabled']=!![],_0x3b648c['textContent']='No\x20Changes'));}finally{this['isSyncing']=![];}}['hide'](){const _0x5ae6b6=this['_el']('approve-modal');_0x5ae6b6&&(_0x5ae6b6['hidden']=!![]),this['_syncFileTree']&&(this['_syncFileTree']['destroy'](),this['_syncFileTree']=null),this['_syncRelativeFiles']=null,this['_syncAbsolutePaths']=null;}async['_handleApprove'](){const _0x1ab76e=this['_el']('commit-message-input'),_0x249a43=this['_el']('pull-before-commit'),_0x2c7b1f=this['_el']('push-after-commit'),_0x203124=this['_el']('create-new-branch'),_0x194125=this['_el']('new-branch-name'),_0x3cf503=this['_el']('confirm-approve'),_0x13fc69=_0x1ab76e['value']['trim'](),_0x4426c0=_0x249a43?.['checked']??!![],_0xf74b8a=_0x2c7b1f?.['checked']??!![],_0x1ec4da=_0x203124?.['checked']||![],_0x9828ba=_0x194125?.['value']['trim']()||'';this['hideError']();if(!_0x13fc69){this['showError']('Commit\x20message\x20is\x20required'),_0x1ab76e['focus']();return;}if(_0x1ec4da&&!_0x9828ba){this['showError']('Branch\x20name\x20is\x20required\x20when\x20creating\x20a\x20new\x20branch'),_0x194125?.['focus']();return;}if(_0x1ec4da&&_0x9828ba){const _0xa77858=/[\s~^:?*\[\\]/;if(_0xa77858['test'](_0x9828ba)){this['showError']('Invalid\x20branch\x20name.\x20Avoid\x20spaces\x20and\x20special\x20characters\x20like\x20~\x20^\x20:\x20?\x20*\x20[\x20\x5c'),_0x194125?.['focus']();return;}}const _0x11fd99=this['_el']('sync-to-ibmi')?.['checked'];if(_0x11fd99){const _0x15d47e=this['_el']('ibmi-sync-library')?.['value']?.['trim']();if(!_0x15d47e){this['showError']('IBM\x20i\x20library\x20name\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-library')?.['focus']();return;}if(this['_syncFileTree']){const _0x492d93=this['_syncFileTree']['getSelectedFiles']();if(_0x492d93['length']===0x0){this['showError']('Select\x20at\x20least\x20one\x20file\x20to\x20sync');return;}}if(this['taskData']?.['syncCredentials']==='prompt'){const _0x576b4b=this['_el']('ibmi-sync-user')?.['value']?.['trim']();if(!_0x576b4b){this['showError']('User\x20profile\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-user')?.['focus']();return;}const _0x266ac0=this['_el']('ibmi-sync-password')?.['value'];if(!_0x266ac0){this['showError']('Password\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-password')?.['focus']();return;}}}const _0x273bc6=_0x3cf503?.['textContent']||'Commit\x20Changes';_0x3cf503&&(_0x3cf503['disabled']=!![],_0x1ec4da?_0x3cf503['textContent']='Creating\x20branch\x20&\x20committing...':_0x3cf503['textContent']=_0x4426c0?'Pulling\x20&\x20Committing...':'Committing...');try{const _0x3b254b={'commit_message':_0x13fc69,'pull':_0x4426c0,'push':_0xf74b8a,'conflict_strategy':'rebase'};_0x1ec4da&&_0x9828ba&&(_0x3b254b['new_branch']=_0x9828ba);let _0x38829a=null;this['onApprove']&&(_0x38829a=await this['onApprove'](this['taskData']['taskId'],_0x3b254b));let _0x48422d='Changes\x20committed';if(_0x1ec4da)_0x48422d='Changes\x20committed\x20to\x20new\x20branch\x20\x27'+_0x9828ba+'\x27',_0xf74b8a&&(_0x48422d+='\x20and\x20pushed');else{if(_0x4426c0&&_0xf74b8a)_0x48422d='Changes\x20pulled,\x20committed,\x20and\x20pushed';else{if(_0x4426c0)_0x48422d='Changes\x20pulled\x20and\x20committed';else _0xf74b8a&&(_0x48422d='Changes\x20committed\x20and\x20pushed');}}const _0x205b86=this['_el']('sync-to-ibmi')?.['checked'];let _0x162dce=null,_0x398063=null,_0x2b034d=null,_0x2b7d9a=null;if(_0x205b86&&this['onSyncToIbmi']){_0x162dce=this['_el']('ibmi-sync-library')?.['value']?.['trim']()?.['toUpperCase'](),_0x398063=this['_el']('ibmi-sync-user')?.['value']?.['trim']()?.['toUpperCase']()||null,_0x2b034d=this['_el']('ibmi-sync-password')?.['value']||null;if(this['_syncFileTree']&&this['_syncRelativeFiles']&&this['_syncAbsolutePaths']){const _0x52717b=this['_syncFileTree']['getSelectedFiles']();_0x2b7d9a=_0x52717b['map'](_0x162d0b=>{const _0x107734=this['_syncRelativeFiles']['indexOf'](_0x162d0b);return _0x107734>=0x0?this['_syncAbsolutePaths'][_0x107734]:_0x162d0b;});}}this['showToast'](_0x48422d,'success'),this['hide']();if(this['_createPR']&&this['onCreatePR'])try{await this['onCreatePR'](this['taskData']['taskId'],_0x38829a||{});}catch(_0x323337){console['warn']('PR\x20creation\x20failed\x20or\x20cancelled:',_0x323337);}if(_0x205b86&&this['onSyncToIbmi']&&_0x162dce){localStorage['setItem']('coderflow_ibmi_sync_library',_0x162dce);if(_0x398063)localStorage['setItem']('coderflow_ibmi_sync_user',_0x398063);try{await this['onSyncToIbmi'](this['taskData']['taskId'],_0x162dce,_0x398063,_0x2b034d,_0x2b7d9a);}catch(_0x40c68b){this['showToast']('Sync\x20failed:\x20'+_0x40c68b['message'],'error');}}this['onSuccess']&&this['onSuccess'](this['taskData']);}catch(_0x392976){console['error']('Failed\x20to\x20approve\x20changes',_0x392976),_0x392976['hasConflicts']?this['_showConflictResolution']():this['showError']('Failed\x20to\x20commit:\x20'+_0x392976['message']),_0x3cf503&&(_0x3cf503['disabled']=![],_0x3cf503['textContent']=_0x273bc6),this['onError']&&this['onError'](_0x392976);}}['isVisible'](){const _0x517370=this['_el']('approve-modal');return _0x517370&&!_0x517370['hidden'];}['destroy'](){const _0x2a04dd=this['_el']('approve-modal');_0x2a04dd&&_0x2a04dd['remove'](),this['initialized']=![];}}export function getApproveState(_0x2a1520,_0x655615){if(!_0x2a1520)return{'canApprove':![],'reason':'No\x20task\x20data'};if(isLogOnlyTaskType(_0x2a1520['taskType']))return{'canApprove':![],'reason':(_0x2a1520['taskType']==='test'?'Test':'Deploy')+'\x20tasks\x20cannot\x20be\x20approved'};const _0x15af4f=_0x655615?.['repos_changed']?.['length']>0x0,_0x4a00ae=_0x2a1520['status']==='completed'||_0x2a1520['status']==='failed'||_0x2a1520['status']==='interrupted',_0x364fc2=_0x2a1520['containerState']==='running',_0x45f8f9=_0x2a1520['approvedBy']!==undefined&&_0x2a1520['approvedBy']!==null;if(_0x45f8f9){const _0x57db5e=_0x2a1520['approvedBy']['name']||_0x2a1520['approvedBy']['username']||'user';return{'canApprove':![],'reason':'Already\x20approved\x20by\x20'+_0x57db5e};}if(!_0x15af4f)return{'canApprove':![],'reason':'No\x20changes\x20to\x20approve'};if(!_0x4a00ae)return{'canApprove':![],'reason':'Task\x20must\x20complete\x20first'};if(!_0x2a1520['containerId'])return{'canApprove':![],'reason':'Container\x20no\x20longer\x20available'};if(!_0x364fc2)return{'canApprove':![],'reason':'Container\x20is\x20not\x20running'};return{'canApprove':!![],'reason':'Ready\x20to\x20approve'};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function buildAutomationEnvironmentHref(
|
|
1
|
+
export function buildAutomationEnvironmentHref(_0x55a99e,_0x2a7842){const _0x54038f=new URLSearchParams();_0x55a99e&&_0x54038f['set']('env',String(_0x55a99e));_0x54038f['set']('tab','automations');_0x2a7842&&_0x54038f['set']('automation',String(_0x2a7842));const _0xb55b2e=_0x54038f['toString']();return'environments.html'+(_0xb55b2e?'?'+_0xb55b2e:'');}export function buildAutomationTaskFilterHref(_0x5ba80e){const _0x14e97a=new URLSearchParams();_0x5ba80e&&_0x14e97a['set']('automation',String(_0x5ba80e));const _0x236682=_0x14e97a['toString']();return'index.html'+(_0x236682?'?'+_0x236682:'');}export function parseAutomationDeepLinkParams(_0x324d59=''){const _0x5421d6=new URLSearchParams(_0x324d59||'');return{'env':_0x5421d6['get']('env'),'tab':_0x5421d6['get']('tab'),'automation':_0x5421d6['get']('automation')};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AUTOMATION_MONTHLY_DAY_MIN=0x1;export const AUTOMATION_MONTHLY_DAY_MAX=0x1c;const DEFAULT_SCHEDULE_FORM_STATE=Object['freeze']({'frequency':'daily','dailyHour':'2','dailyMinute':'0','weeklyDay':'1','weeklyHour':'9','weeklyMinute':'0','monthlyDay':'1','monthlyHour':'0','monthlyMinute':'0','recurringInterval':'*/30\x20*\x20*\x20*\x20*','recurringStartHour':'','recurringEndHour':'','recurringDayToken':'*','customCron':''}),RECURRING_INTERVAL_STEPS=['2','4','6','8','12'];function createDefaultScheduleFormState(){return{...DEFAULT_SCHEDULE_FORM_STATE};}function parseBoundedInteger(
|
|
1
|
+
export const AUTOMATION_MONTHLY_DAY_MIN=0x1;export const AUTOMATION_MONTHLY_DAY_MAX=0x1c;const DEFAULT_SCHEDULE_FORM_STATE=Object['freeze']({'frequency':'daily','dailyHour':'2','dailyMinute':'0','weeklyDay':'1','weeklyHour':'9','weeklyMinute':'0','monthlyDay':'1','monthlyHour':'0','monthlyMinute':'0','recurringInterval':'*/30\x20*\x20*\x20*\x20*','recurringStartHour':'','recurringEndHour':'','recurringDayToken':'*','customCron':''}),RECURRING_INTERVAL_STEPS=['2','4','6','8','12'];function createDefaultScheduleFormState(){return{...DEFAULT_SCHEDULE_FORM_STATE};}function parseBoundedInteger(_0x4207dc,_0xf28d8f,_0x1750ea){const _0x27de06=Number['parseInt'](_0x4207dc,0xa);if(!Number['isInteger'](_0x27de06)||_0x27de06<_0xf28d8f||_0x27de06>_0x1750ea)return null;return _0x27de06;}function inferRecurringInterval(_0x9f11a0,_0x27f94c){if(_0x9f11a0==='*/15')return'*/15\x20*\x20*\x20*\x20*';if(_0x9f11a0==='*/30')return'*/30\x20*\x20*\x20*\x20*';if(_0x9f11a0!=='0')return'*/30\x20*\x20*\x20*\x20*';if(_0x27f94c==='*'||/^\d{1,2}-\d{1,2}$/['test'](_0x27f94c))return'0\x20*\x20*\x20*\x20*';for(const _0x2762b6 of RECURRING_INTERVAL_STEPS){if(_0x27f94c['startsWith']('*/'+_0x2762b6)||_0x27f94c['includes']('/'+_0x2762b6))return'0\x20*/'+_0x2762b6+'\x20*\x20*\x20*';}return'*/30\x20*\x20*\x20*\x20*';}function parseRecurringHourRange(_0x3f2f64){const _0x15debf=String(_0x3f2f64||'')['trim']()['match'](/^(\d{1,2})-(\d{1,2})(?:\/\d+)?$/);if(!_0x15debf)return{'start':'','end':''};const _0x3011b8=parseBoundedInteger(_0x15debf[0x1],0x0,0x17),_0x280c93=parseBoundedInteger(_0x15debf[0x2],0x0,0x17);if(_0x3011b8===null||_0x280c93===null||_0x3011b8>_0x280c93)return{'start':'','end':''};return{'start':String(_0x3011b8),'end':String(_0x280c93)};}export function parseAutomationScheduleToFormState(_0xcf8837){const _0x239ad3=String(_0xcf8837||'')['trim'](),_0xe86421=createDefaultScheduleFormState(),_0x45c1d2=_0x239ad3['match'](/^(\d{1,2}) (\d{1,2}) \* \* \*$/);if(_0x45c1d2){const _0x18f1d2=parseBoundedInteger(_0x45c1d2[0x1],0x0,0x3b),_0x2cef3f=parseBoundedInteger(_0x45c1d2[0x2],0x0,0x17);if(_0x18f1d2!==null&&_0x2cef3f!==null)return _0xe86421['frequency']='daily',_0xe86421['dailyMinute']=String(_0x18f1d2),_0xe86421['dailyHour']=String(_0x2cef3f),_0xe86421;}const _0x5b5c76=_0x239ad3['match'](/^(\d{1,2}) (\d{1,2}) \* \* ([0-7])$/);if(_0x5b5c76){const _0x5cc694=parseBoundedInteger(_0x5b5c76[0x1],0x0,0x3b),_0x3e420c=parseBoundedInteger(_0x5b5c76[0x2],0x0,0x17),_0x9446b3=parseBoundedInteger(_0x5b5c76[0x3],0x0,0x7);if(_0x5cc694!==null&&_0x3e420c!==null&&_0x9446b3!==null)return _0xe86421['frequency']='weekly',_0xe86421['weeklyMinute']=String(_0x5cc694),_0xe86421['weeklyHour']=String(_0x3e420c),_0xe86421['weeklyDay']=String(_0x9446b3===0x7?0x0:_0x9446b3),_0xe86421;}const _0x5584a4=_0x239ad3['match'](/^(\d{1,2}) (\d{1,2}) (\d{1,2}) \* \*$/);if(_0x5584a4){const _0x399271=parseBoundedInteger(_0x5584a4[0x1],0x0,0x3b),_0x204b6f=parseBoundedInteger(_0x5584a4[0x2],0x0,0x17),_0x18604a=parseBoundedInteger(_0x5584a4[0x3],AUTOMATION_MONTHLY_DAY_MIN,AUTOMATION_MONTHLY_DAY_MAX);if(_0x399271!==null&&_0x204b6f!==null&&_0x18604a!==null)return _0xe86421['frequency']='monthly',_0xe86421['monthlyMinute']=String(_0x399271),_0xe86421['monthlyHour']=String(_0x204b6f),_0xe86421['monthlyDay']=String(_0x18604a),_0xe86421;}const _0x5e229b=_0x239ad3['match'](/^(\*\/15|\*\/30|0) ([^\s]+) \* \* ([^\s]+)$/);if(_0x5e229b){const [,_0x1415dc,_0x835d1f,_0x2c963c]=_0x5e229b;_0xe86421['frequency']='recurring',_0xe86421['recurringInterval']=inferRecurringInterval(_0x1415dc,_0x835d1f),_0xe86421['recurringDayToken']=String(_0x2c963c||'')['trim']()||'*';const _0x19b0c1=parseRecurringHourRange(_0x835d1f);return _0xe86421['recurringStartHour']=_0x19b0c1['start'],_0xe86421['recurringEndHour']=_0x19b0c1['end'],_0xe86421;}return _0xe86421['frequency']='custom',_0xe86421['customCron']=_0x239ad3,_0xe86421;}export function buildAutomationCronFromFormState(_0x28c3e7={}){const _0x290c25=String(_0x28c3e7['frequency']||'daily');if(_0x290c25==='custom')return String(_0x28c3e7['customCron']||'')['trim']();if(_0x290c25==='daily'){const _0x1e396b=String(_0x28c3e7['dailyHour']??'2'),_0x37522c=String(_0x28c3e7['dailyMinute']??'0');return _0x37522c+'\x20'+_0x1e396b+'\x20*\x20*\x20*';}if(_0x290c25==='weekly'){const _0xe14f01=String(_0x28c3e7['weeklyDay']??'1'),_0x4b1829=String(_0x28c3e7['weeklyHour']??'9'),_0x417d36=String(_0x28c3e7['weeklyMinute']??'0');return _0x417d36+'\x20'+_0x4b1829+'\x20*\x20*\x20'+_0xe14f01;}if(_0x290c25==='monthly'){const _0x3d01cd=String(_0x28c3e7['monthlyDay']??'1'),_0x593ebe=String(_0x28c3e7['monthlyHour']??'0'),_0x1f5de4=String(_0x28c3e7['monthlyMinute']??'0');return _0x1f5de4+'\x20'+_0x593ebe+'\x20'+_0x3d01cd+'\x20*\x20*';}const _0x40ad02=String(_0x28c3e7['recurringInterval']||'*/30\x20*\x20*\x20*\x20*')['trim'](),[_0x497424='*/30',_0x245425='*']=_0x40ad02['split'](/\s+/);let _0x502330=_0x245425;const _0x217785=String(_0x28c3e7['recurringStartHour']??'')['trim'](),_0x7defc4=String(_0x28c3e7['recurringEndHour']??'')['trim']();if(_0x217785!==''&&_0x7defc4!==''){const _0x16c3e8=Number['parseInt'](_0x217785,0xa),_0x2d64a6=Number['parseInt'](_0x7defc4,0xa);if(Number['isInteger'](_0x16c3e8)&&Number['isInteger'](_0x2d64a6)&&_0x16c3e8<=_0x2d64a6){const _0x517c34=_0x245425['match'](/^\*\/(\d+)$/);_0x517c34?_0x502330=_0x16c3e8+'-'+_0x2d64a6+'/'+_0x517c34[0x1]:_0x502330=_0x16c3e8+'-'+_0x2d64a6;}}const _0x2ee7bd=String(_0x28c3e7['recurringDayToken']??'*')['trim']()||'*';return _0x497424+'\x20'+_0x502330+'\x20*\x20*\x20'+_0x2ee7bd;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export class CommentsWidget{constructor(_0x58382f,_0xcd9b56={}){this['container']=_0x58382f,this['options']={'taskId':_0xcd9b56['taskId']||null,'currentUserId':_0xcd9b56['currentUserId']||null,'compact':_0xcd9b56['compact']||![],'skipHeader':_0xcd9b56['skipHeader']||![],'onCommentsLoaded':_0xcd9b56['onCommentsLoaded']||null,'onCommentsChanged':_0xcd9b56['onCommentsChanged']||null,'enableAttachments':_0xcd9b56['enableAttachments']||![],'getAPI':_0xcd9b56['getAPI']||(()=>window['API'])},this['comments']=[],this['editor']=null,this['editingCommentId']=null,this['isLoading']=![],this['pendingAttachments']=[],this['existingAttachments']=[],this['init']();}['init'](){this['container']['innerHTML']='',this['container']['className']='comments-widget\x20'+(this['options']['compact']?'comments-widget-compact':''),this['createHeader'](),this['createCommentsList'](),this['createInputSection'](),this['options']['taskId']&&(this['loadComments'](),this['options']['enableAttachments']&&this['loadExistingAttachments']());}async['loadExistingAttachments'](){try{const _0x185a61=this['options']['getAPI'](),_0x2a3ff3=await _0x185a61['getTaskAttachments'](this['options']['taskId']);this['existingAttachments']=_0x2a3ff3['attachments']||[];}catch(_0x324b2d){console['warn']('Failed\x20to\x20load\x20existing\x20attachments:',_0x324b2d),this['existingAttachments']=[];}}['createHeader'](){if(this['options']['skipHeader']){this['header']=null,this['isExpanded']=!![];return;}if(this['options']['compact']){this['header']=document['createElement']('div'),this['header']['className']='comments-header\x20comments-header-compact',this['header']['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22comments-toggle-btn\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20class=\x22comments-toggle-icon\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M21\x2015a2\x202\x200\x200\x201-2\x202H7l-4\x204V5a2\x202\x200\x200\x201\x202-2h14a2\x202\x200\x200\x201\x202\x202z\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comments-count-label\x22>Comments</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comments-count-badge\x22\x20id=\x22comments-count-badge\x22>0</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20class=\x22comments-chevron\x22\x20width=\x2212\x22\x20height=\x2212\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<polyline\x20points=\x226\x209\x2012\x2015\x2018\x209\x22></polyline>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20',this['container']['appendChild'](this['header']);const _0x52672a=this['header']['querySelector']('.comments-toggle-btn');_0x52672a['addEventListener']('click',()=>this['toggleExpanded']()),this['isExpanded']=![];}else this['header']=document['createElement']('div'),this['header']['className']='comments-header',this['header']['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<h3\x20class=\x22comments-title\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20width=\x2218\x22\x20height=\x2218\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M21\x2015a2\x202\x200\x200\x201-2\x202H7l-4\x204V5a2\x202\x200\x200\x201\x202-2h14a2\x202\x200\x200\x201\x202\x202z\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Comments\x20<span\x20class=\x22comments-count\x22\x20id=\x22comments-count\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</h3>\x0a\x20\x20\x20\x20\x20\x20',this['container']['appendChild'](this['header']),this['isExpanded']=!![];}['createCommentsList'](){this['commentsListWrapper']=document['createElement']('div'),this['commentsListWrapper']['className']='comments-list-wrapper',this['options']['compact']&&!this['isExpanded']&&(this['commentsListWrapper']['hidden']=!![]),this['commentsList']=document['createElement']('div'),this['commentsList']['className']='comments-list',this['commentsListWrapper']['appendChild'](this['commentsList']),this['container']['appendChild'](this['commentsListWrapper']);}['createInputSection'](){this['inputSection']=document['createElement']('div'),this['inputSection']['className']='comments-input-section';this['options']['compact']&&!this['isExpanded']&&(this['inputSection']['hidden']=!![]);const _0x252d6a=document['createElement']('div');_0x252d6a['className']='comments-editor-wrapper',this['toolbar']=document['createElement']('div'),this['toolbar']['className']='comments-toolbar\x20comments-toolbar-hidden',_0x252d6a['appendChild'](this['toolbar']);const _0x15a624=document['createElement']('div');_0x15a624['className']='comments-editor-placeholder',_0x252d6a['appendChild'](_0x15a624);const _0x54ae48=document['createElement']('div');_0x54ae48['className']='comments-input-actions',_0x54ae48['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-ghost\x20btn-small\x20comments-cancel-btn\x22\x20hidden>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-primary\x20btn-small\x20comments-submit-btn\x22\x20disabled>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22btn-text\x22>Add\x20Comment</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22btn-loading\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20class=\x22spinner\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<circle\x20cx=\x2212\x22\x20cy=\x2212\x22\x20r=\x2210\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x223\x22\x20stroke-dasharray=\x2231.4\x2031.4\x22\x20stroke-linecap=\x22round\x22/>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</span>\x0a\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20',this['inputSection']['appendChild'](_0x252d6a),this['inputSection']['appendChild'](_0x54ae48),this['container']['appendChild'](this['inputSection']),this['initEditor'](_0x15a624),this['submitBtn']=_0x54ae48['querySelector']('.comments-submit-btn'),this['cancelBtn']=_0x54ae48['querySelector']('.comments-cancel-btn'),this['submitBtn']['addEventListener']('click',()=>this['handleSubmit']()),this['cancelBtn']['addEventListener']('click',()=>this['cancelEdit']());}['initEditor'](_0x3885e4){const _0x398c85=document['createElement']('textarea');_0x398c85['placeholder']='Add\x20a\x20comment...',_0x398c85['className']='comments-textarea',_0x3885e4['appendChild'](_0x398c85);const _0x59c67e=window['MarkdownEditor'];if(!_0x59c67e){console['error']('MarkdownEditor\x20not\x20loaded');return;}const _0x38ecff={'placeholder':'Add\x20a\x20comment...','editable':!![],'toolbar':!![],'minHeight':this['options']['compact']?'60px':'80px','onChange':_0x40a3f1=>{const _0x5f1d31=_0x40a3f1&&_0x40a3f1['trim']()['length']>0x0||this['pendingAttachments']['length']>0x0;this['submitBtn']['disabled']=!_0x5f1d31;},'fetchUsers':async()=>{const _0x37715a=this['options']['getAPI']();return _0x37715a['getUsers']();}};this['options']['enableAttachments']&&this['options']['taskId']&&(_0x38ecff['onAddAttachments']=_0x5718d7=>{this['pendingAttachments']['push'](..._0x5718d7),this['submitBtn']['disabled']=![];},_0x38ecff['resolveAttachmentUrl']=_0x4ebace=>{const _0x2d1cdd=this['options']['getAPI']();return _0x2d1cdd['getBaseUrl']()+'/tasks/'+this['options']['taskId']+'/attachments/'+encodeURIComponent(_0x4ebace);},_0x38ecff['isAttachmentNameTaken']=_0x1d2830=>{return this['pendingAttachments']['some'](_0x11a783=>_0x11a783['name']===_0x1d2830)||this['existingAttachments']['some'](_0x4e33d9=>_0x4e33d9['name']===_0x1d2830);});this['editor']=new _0x59c67e(_0x398c85,_0x38ecff);const _0x4e49e3=this['editor']['editor'],_0x5ceca6=this['editor']['toolbar'];_0x5ceca6&&(_0x5ceca6['classList']['add']('comments-toolbar-hidden'),_0x4e49e3['addEventListener']('focus',()=>{_0x5ceca6['classList']['remove']('comments-toolbar-hidden');}),_0x4e49e3['addEventListener']('blur',_0x44b12f=>{setTimeout(()=>{!this['editor']['container']?.['contains'](document['activeElement'])&&!_0x5ceca6['contains'](document['activeElement'])&&(!this['editor']['getValue']()?.['trim']()&&!this['editingCommentId']&&_0x5ceca6['classList']['add']('comments-toolbar-hidden'));},0x64);}));}['toggleExpanded'](){this['isExpanded']=!this['isExpanded'],this['commentsListWrapper']['hidden']=!this['isExpanded'],this['inputSection']['hidden']=!this['isExpanded'];const _0x3ecb37=this['header']['querySelector']('.comments-chevron');_0x3ecb37&&(_0x3ecb37['style']['transform']=this['isExpanded']?'rotate(180deg)':''),this['isExpanded']&&this['comments']['length']===0x0&&this['options']['taskId']&&this['loadComments']();}['setTaskId'](_0x2a93cc){this['options']['taskId']=_0x2a93cc,this['comments']=[],this['renderComments'](),_0x2a93cc&&this['loadComments']();}async['loadComments'](){if(!this['options']['taskId']||this['isLoading'])return;this['isLoading']=!![],this['commentsList']['innerHTML']='<div\x20class=\x22comments-loading\x22>Loading\x20comments...</div>';try{const _0x205411=this['options']['getAPI'](),_0xcd2700=await _0x205411['getComments'](this['options']['taskId']);this['comments']=_0xcd2700['comments']||[],this['renderComments'](),this['updateCount'](),this['options']['onCommentsLoaded']&&this['options']['onCommentsLoaded'](this['comments']);}catch(_0x3a01e5){console['error']('Failed\x20to\x20load\x20comments:',_0x3a01e5),this['commentsList']['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-error\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Failed\x20to\x20load\x20comments\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-ghost\x20btn-small\x22\x20onclick=\x22this.parentElement.parentElement.closest(\x27.comments-widget\x27).__widget.loadComments()\x22>Retry</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20';}finally{this['isLoading']=![];}}['renderComments'](){if(this['comments']['length']===0x0){this['commentsList']['innerHTML']='<div\x20class=\x22comments-empty\x22>No\x20comments\x20yet</div>';return;}this['commentsList']['innerHTML']='',this['comments']['forEach'](_0x4dc6ff=>{const _0x3fe342=this['createCommentElement'](_0x4dc6ff);this['commentsList']['appendChild'](_0x3fe342);});}['createCommentElement'](_0x5e1074){const _0x1fdb05=document['createElement']('div');_0x1fdb05['className']='comment-item',_0x1fdb05['dataset']['commentId']=_0x5e1074['id'];const _0x39addf=this['options']['currentUserId']&&_0x5e1074['author']?.['userId']===this['options']['currentUserId'],_0x4e205e=this['formatDate'](_0x5e1074['createdAt']),_0x29aa4b=_0x5e1074['updatedAt']!==_0x5e1074['createdAt'],_0x4a5d86=this['resolveAttachmentUrls'](_0x5e1074['content']);let _0x17c4ff=window['marked']?window['marked']['parse'](_0x4a5d86):_0x4a5d86;_0x17c4ff=this['renderMentions'](_0x17c4ff),_0x1fdb05['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-author\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comment-author-name\x22>'+this['escapeHtml'](_0x5e1074['author']?.['name']||'Anonymous')+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comment-timestamp\x22\x20title=\x22'+new Date(_0x5e1074['createdAt'])['toLocaleString']()+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x4e205e+(_0x29aa4b?'\x20(edited)':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x39addf?'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-icon-mini\x20comment-edit-btn\x22\x20title=\x22Edit\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20width=\x2212\x22\x20height=\x2212\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M11\x204H4a2\x202\x200\x200\x200-2\x202v14a2\x202\x200\x200\x200\x202\x202h14a2\x202\x200\x200\x200\x202-2v-7\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M18.5\x202.5a2.121\x202.121\x200\x200\x201\x203\x203L12\x2015l-4\x201\x201-4\x209.5-9.5z\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-icon-mini\x20comment-delete-btn\x22\x20title=\x22Delete\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20width=\x2212\x22\x20height=\x2212\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<polyline\x20points=\x223\x206\x205\x206\x2021\x206\x22></polyline>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M19\x206v14a2\x202\x200\x200\x201-2\x202H7a2\x202\x200\x200\x201-2-2V6m3\x200V4a2\x202\x200\x200\x201\x202-2h4a2\x202\x200\x200\x201\x202\x202v2\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20':'')+'\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-content\x22>'+_0x17c4ff+'</div>\x0a\x20\x20\x20\x20';if(_0x39addf){const _0x1f6da7=_0x1fdb05['querySelector']('.comment-edit-btn'),_0x184670=_0x1fdb05['querySelector']('.comment-delete-btn');_0x1f6da7?.['addEventListener']('click',()=>this['startEdit'](_0x5e1074)),_0x184670?.['addEventListener']('click',()=>this['deleteComment'](_0x5e1074['id']));}return _0x1fdb05;}['formatDate'](_0x530fbe){const _0x11fde5=new Date(_0x530fbe),_0x4ad5be=new Date(),_0x204f22=_0x4ad5be-_0x11fde5,_0x2d7ee1=Math['floor'](_0x204f22/0xea60),_0x5b2704=Math['floor'](_0x204f22/0x36ee80),_0x3a1cea=Math['floor'](_0x204f22/0x5265c00);if(_0x2d7ee1<0x1)return'just\x20now';if(_0x2d7ee1<0x3c)return _0x2d7ee1+'m\x20ago';if(_0x5b2704<0x18)return _0x5b2704+'h\x20ago';if(_0x3a1cea<0x7)return _0x3a1cea+'d\x20ago';return _0x11fde5['toLocaleDateString']();}['escapeHtml'](_0x347890){const _0x10c961=document['createElement']('div');return _0x10c961['textContent']=_0x347890,_0x10c961['innerHTML'];}['resolveAttachmentUrls'](_0x2d0325){if(!_0x2d0325||!this['options']['taskId'])return _0x2d0325;const _0x3e4644=this['options']['getAPI'](),_0xca6957=_0x3e4644['getBaseUrl']();let _0x473c96=String(_0x2d0325)['replace'](/\]\(attachment:(?:\/\/)?([^)]+)\)/g,(_0x49ab92,_0x51399e)=>{const _0x26c831=String(_0x51399e||'')['trim']();if(!_0x26c831)return _0x49ab92;let _0x1914d5=_0x26c831;try{_0x1914d5=decodeURIComponent(_0x26c831);}catch{}return']('+_0xca6957+'/tasks/'+this['options']['taskId']+'/attachments/'+encodeURIComponent(_0x1914d5)+')';});return _0x473c96;}['renderMentions'](_0x3bc011){if(!_0x3bc011)return _0x3bc011;return String(_0x3bc011)['replace'](/@?<a\s+href="mention:([^"]+)"[^>]*>([^<]+)<\/a>/g,(_0x168d9f,_0x28cea2,_0x411dfa)=>{const _0x2843c1=this['escapeHtml'](_0x411dfa),_0x7310fc=this['escapeHtml'](_0x28cea2);return'<span\x20class=\x22mention\x22\x20data-mention-user-id=\x22'+_0x7310fc+'\x22>@'+_0x2843c1+'</span>';});}['startEdit'](_0x35540b){this['editingCommentId']=_0x35540b['id'],this['editor']['setValue'](_0x35540b['content']),this['editor']['focus'](),this['cancelBtn']['hidden']=![],this['submitBtn']['querySelector']('.btn-text')['textContent']='Save',this['editor']['toolbar']&&this['editor']['toolbar']['classList']['remove']('comments-toolbar-hidden'),this['inputSection']['scrollIntoView']({'behavior':'smooth','block':'nearest'});}['cancelEdit'](){this['editingCommentId']=null,this['editor']['clear'](),this['cancelBtn']['hidden']=!![],this['submitBtn']['querySelector']('.btn-text')['textContent']='Add\x20Comment',this['submitBtn']['disabled']=!![],this['editor']['toolbar']&&!this['editor']['getValue']()?.['trim']()&&this['editor']['toolbar']['classList']['add']('comments-toolbar-hidden');}async['handleSubmit'](){const _0x4c13a7=this['editor']['getValue']()?.['trim']();if(!_0x4c13a7&&this['pendingAttachments']['length']===0x0||!this['options']['taskId'])return;this['setLoading'](!![]);try{const _0x5beedc=this['options']['getAPI']();this['pendingAttachments']['length']>0x0&&this['options']['enableAttachments']&&(await _0x5beedc['uploadAttachments'](this['options']['taskId'],this['pendingAttachments']),this['existingAttachments']['push'](...this['pendingAttachments']['map'](_0x59128a=>({'name':_0x59128a['name']}))),this['pendingAttachments']=[]);if(this['editingCommentId']){const _0x5c8ee5=await _0x5beedc['updateComment'](this['options']['taskId'],this['editingCommentId'],_0x4c13a7),_0xc615ae=this['comments']['findIndex'](_0x430345=>_0x430345['id']===this['editingCommentId']);_0xc615ae!==-0x1&&(this['comments'][_0xc615ae]=_0x5c8ee5['comment']);}else{const _0x245904=await _0x5beedc['addComment'](this['options']['taskId'],_0x4c13a7);this['comments']['push'](_0x245904['comment']);}this['renderComments'](),this['updateCount'](),this['cancelEdit'](),this['editor']['clear']();}catch(_0x42d161){console['error']('Failed\x20to\x20save\x20comment:',_0x42d161),alert('Failed\x20to\x20save\x20comment:\x20'+_0x42d161['message']);}finally{this['setLoading'](![]);}}async['deleteComment'](_0x506140){const _0x293c7d=await this['showDeleteConfirmModal']();if(!_0x293c7d)return;try{const _0x298799=this['options']['getAPI']();await _0x298799['deleteComment'](this['options']['taskId'],_0x506140),this['comments']=this['comments']['filter'](_0x195cf0=>_0x195cf0['id']!==_0x506140),this['renderComments'](),this['updateCount']();}catch(_0x687483){console['error']('Failed\x20to\x20delete\x20comment:',_0x687483),alert('Failed\x20to\x20delete\x20comment:\x20'+_0x687483['message']);}}['showDeleteConfirmModal'](){return new Promise(_0x3a74f4=>{const _0x3717aa=document['createElement']('div');_0x3717aa['className']='comments-confirm-modal',_0x3717aa['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-backdrop\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-dialog\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h3>Delete\x20Comment</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-icon\x20comments-confirm-close\x22\x20title=\x22Close\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-body\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p>Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20this\x20comment?\x20This\x20action\x20cannot\x20be\x20undone.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-footer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-ghost\x20btn-small\x20comments-confirm-cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-danger\x20btn-small\x20comments-confirm-delete\x22>Delete</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20',document['body']['appendChild'](_0x3717aa);const _0x38bb05=_0x5bc4d1=>{document['removeEventListener']('keydown',_0x8924dd),_0x3717aa['remove'](),_0x3a74f4(_0x5bc4d1);},_0x8924dd=_0x58bc3b=>{if(_0x58bc3b['key']==='Escape')_0x38bb05(![]);};document['addEventListener']('keydown',_0x8924dd),_0x3717aa['querySelector']('.comments-confirm-backdrop')['addEventListener']('click',()=>_0x38bb05(![])),_0x3717aa['querySelector']('.comments-confirm-close')['addEventListener']('click',()=>_0x38bb05(![])),_0x3717aa['querySelector']('.comments-confirm-cancel')['addEventListener']('click',()=>_0x38bb05(![])),_0x3717aa['querySelector']('.comments-confirm-delete')['addEventListener']('click',()=>_0x38bb05(!![])),_0x3717aa['querySelector']('.comments-confirm-cancel')['focus']();});}['setLoading'](_0x2c0e6b){this['submitBtn']['disabled']=_0x2c0e6b,this['submitBtn']['querySelector']('.btn-text')['hidden']=_0x2c0e6b,this['submitBtn']['querySelector']('.btn-loading')['hidden']=!_0x2c0e6b;}['updateCount'](){const _0xbc264d=this['comments']['length'],_0x367cfc=this['container']['querySelector']('#comments-count-badge');_0x367cfc&&(_0x367cfc['textContent']=_0xbc264d,_0x367cfc['hidden']=_0xbc264d===0x0);const _0x80aa4=this['container']['querySelector']('#comments-count');_0x80aa4&&(_0x80aa4['textContent']=_0xbc264d>0x0?'('+_0xbc264d+')':''),this['options']['onCommentsChanged']&&this['options']['onCommentsChanged'](this['comments']);}['getCommentCount'](){return this['comments']['length'];}['destroy'](){this['editor']&&this['editor']['destroy'](),this['container']['innerHTML']='';}}CommentsWidget['prototype']['_attachToContainer']=function(){this['container']['__widget']=this;};typeof window!=='undefined'&&(window['CommentsWidget']=CommentsWidget);
|
|
1
|
+
export class CommentsWidget{constructor(_0xa38b05,_0x8b0844={}){this['container']=_0xa38b05,this['options']={'taskId':_0x8b0844['taskId']||null,'currentUserId':_0x8b0844['currentUserId']||null,'compact':_0x8b0844['compact']||![],'skipHeader':_0x8b0844['skipHeader']||![],'onCommentsLoaded':_0x8b0844['onCommentsLoaded']||null,'onCommentsChanged':_0x8b0844['onCommentsChanged']||null,'enableAttachments':_0x8b0844['enableAttachments']||![],'getAPI':_0x8b0844['getAPI']||(()=>window['API'])},this['comments']=[],this['editor']=null,this['editingCommentId']=null,this['isLoading']=![],this['pendingAttachments']=[],this['existingAttachments']=[],this['init']();}['init'](){this['container']['innerHTML']='',this['container']['className']='comments-widget\x20'+(this['options']['compact']?'comments-widget-compact':''),this['createHeader'](),this['createCommentsList'](),this['createInputSection'](),this['options']['taskId']&&(this['loadComments'](),this['options']['enableAttachments']&&this['loadExistingAttachments']());}async['loadExistingAttachments'](){try{const _0x506b4e=this['options']['getAPI'](),_0x4c956d=await _0x506b4e['getTaskAttachments'](this['options']['taskId']);this['existingAttachments']=_0x4c956d['attachments']||[];}catch(_0xa36bb1){console['warn']('Failed\x20to\x20load\x20existing\x20attachments:',_0xa36bb1),this['existingAttachments']=[];}}['createHeader'](){if(this['options']['skipHeader']){this['header']=null,this['isExpanded']=!![];return;}if(this['options']['compact']){this['header']=document['createElement']('div'),this['header']['className']='comments-header\x20comments-header-compact',this['header']['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22comments-toggle-btn\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20class=\x22comments-toggle-icon\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M21\x2015a2\x202\x200\x200\x201-2\x202H7l-4\x204V5a2\x202\x200\x200\x201\x202-2h14a2\x202\x200\x200\x201\x202\x202z\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comments-count-label\x22>Comments</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comments-count-badge\x22\x20id=\x22comments-count-badge\x22>0</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20class=\x22comments-chevron\x22\x20width=\x2212\x22\x20height=\x2212\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<polyline\x20points=\x226\x209\x2012\x2015\x2018\x209\x22></polyline>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20',this['container']['appendChild'](this['header']);const _0x2428fa=this['header']['querySelector']('.comments-toggle-btn');_0x2428fa['addEventListener']('click',()=>this['toggleExpanded']()),this['isExpanded']=![];}else this['header']=document['createElement']('div'),this['header']['className']='comments-header',this['header']['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<h3\x20class=\x22comments-title\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20width=\x2218\x22\x20height=\x2218\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M21\x2015a2\x202\x200\x200\x201-2\x202H7l-4\x204V5a2\x202\x200\x200\x201\x202-2h14a2\x202\x200\x200\x201\x202\x202z\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Comments\x20<span\x20class=\x22comments-count\x22\x20id=\x22comments-count\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</h3>\x0a\x20\x20\x20\x20\x20\x20',this['container']['appendChild'](this['header']),this['isExpanded']=!![];}['createCommentsList'](){this['commentsListWrapper']=document['createElement']('div'),this['commentsListWrapper']['className']='comments-list-wrapper',this['options']['compact']&&!this['isExpanded']&&(this['commentsListWrapper']['hidden']=!![]),this['commentsList']=document['createElement']('div'),this['commentsList']['className']='comments-list',this['commentsListWrapper']['appendChild'](this['commentsList']),this['container']['appendChild'](this['commentsListWrapper']);}['createInputSection'](){this['inputSection']=document['createElement']('div'),this['inputSection']['className']='comments-input-section';this['options']['compact']&&!this['isExpanded']&&(this['inputSection']['hidden']=!![]);const _0x57e622=document['createElement']('div');_0x57e622['className']='comments-editor-wrapper',this['toolbar']=document['createElement']('div'),this['toolbar']['className']='comments-toolbar\x20comments-toolbar-hidden',_0x57e622['appendChild'](this['toolbar']);const _0x3506ad=document['createElement']('div');_0x3506ad['className']='comments-editor-placeholder',_0x57e622['appendChild'](_0x3506ad);const _0x5bef74=document['createElement']('div');_0x5bef74['className']='comments-input-actions',_0x5bef74['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-ghost\x20btn-small\x20comments-cancel-btn\x22\x20hidden>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-primary\x20btn-small\x20comments-submit-btn\x22\x20disabled>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22btn-text\x22>Add\x20Comment</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22btn-loading\x22\x20hidden>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20class=\x22spinner\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<circle\x20cx=\x2212\x22\x20cy=\x2212\x22\x20r=\x2210\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x223\x22\x20stroke-dasharray=\x2231.4\x2031.4\x22\x20stroke-linecap=\x22round\x22/>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</span>\x0a\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20',this['inputSection']['appendChild'](_0x57e622),this['inputSection']['appendChild'](_0x5bef74),this['container']['appendChild'](this['inputSection']),this['initEditor'](_0x3506ad),this['submitBtn']=_0x5bef74['querySelector']('.comments-submit-btn'),this['cancelBtn']=_0x5bef74['querySelector']('.comments-cancel-btn'),this['submitBtn']['addEventListener']('click',()=>this['handleSubmit']()),this['cancelBtn']['addEventListener']('click',()=>this['cancelEdit']());}['initEditor'](_0x3e9ca6){const _0x249bc2=document['createElement']('textarea');_0x249bc2['placeholder']='Add\x20a\x20comment...',_0x249bc2['className']='comments-textarea',_0x3e9ca6['appendChild'](_0x249bc2);const _0xf36220=window['MarkdownEditor'];if(!_0xf36220){console['error']('MarkdownEditor\x20not\x20loaded');return;}const _0x152454={'placeholder':'Add\x20a\x20comment...','editable':!![],'toolbar':!![],'minHeight':this['options']['compact']?'60px':'80px','onChange':_0x370139=>{const _0x327037=_0x370139&&_0x370139['trim']()['length']>0x0||this['pendingAttachments']['length']>0x0;this['submitBtn']['disabled']=!_0x327037;},'fetchUsers':async()=>{const _0x4325c7=this['options']['getAPI']();return _0x4325c7['getUsers']();}};this['options']['enableAttachments']&&this['options']['taskId']&&(_0x152454['onAddAttachments']=_0x1cd3ec=>{this['pendingAttachments']['push'](..._0x1cd3ec),this['submitBtn']['disabled']=![];},_0x152454['resolveAttachmentUrl']=_0x2c75ad=>{const _0x1c2332=this['options']['getAPI']();return _0x1c2332['getBaseUrl']()+'/tasks/'+this['options']['taskId']+'/attachments/'+encodeURIComponent(_0x2c75ad);},_0x152454['isAttachmentNameTaken']=_0x4d264b=>{return this['pendingAttachments']['some'](_0x7a19b8=>_0x7a19b8['name']===_0x4d264b)||this['existingAttachments']['some'](_0x55144d=>_0x55144d['name']===_0x4d264b);});this['editor']=new _0xf36220(_0x249bc2,_0x152454);const _0xe66e52=this['editor']['editor'],_0x609e09=this['editor']['toolbar'];_0x609e09&&(_0x609e09['classList']['add']('comments-toolbar-hidden'),_0xe66e52['addEventListener']('focus',()=>{_0x609e09['classList']['remove']('comments-toolbar-hidden');}),_0xe66e52['addEventListener']('blur',_0x12e8c2=>{setTimeout(()=>{!this['editor']['container']?.['contains'](document['activeElement'])&&!_0x609e09['contains'](document['activeElement'])&&(!this['editor']['getValue']()?.['trim']()&&!this['editingCommentId']&&_0x609e09['classList']['add']('comments-toolbar-hidden'));},0x64);}));}['toggleExpanded'](){this['isExpanded']=!this['isExpanded'],this['commentsListWrapper']['hidden']=!this['isExpanded'],this['inputSection']['hidden']=!this['isExpanded'];const _0x50fcbe=this['header']['querySelector']('.comments-chevron');_0x50fcbe&&(_0x50fcbe['style']['transform']=this['isExpanded']?'rotate(180deg)':''),this['isExpanded']&&this['comments']['length']===0x0&&this['options']['taskId']&&this['loadComments']();}['setTaskId'](_0x4a8afd){this['options']['taskId']=_0x4a8afd,this['comments']=[],this['renderComments'](),_0x4a8afd&&this['loadComments']();}async['loadComments'](){if(!this['options']['taskId']||this['isLoading'])return;this['isLoading']=!![],this['commentsList']['innerHTML']='<div\x20class=\x22comments-loading\x22>Loading\x20comments...</div>';try{const _0x16aca3=this['options']['getAPI'](),_0x230fe7=await _0x16aca3['getComments'](this['options']['taskId']);this['comments']=_0x230fe7['comments']||[],this['renderComments'](),this['updateCount'](),this['options']['onCommentsLoaded']&&this['options']['onCommentsLoaded'](this['comments']);}catch(_0x42284a){console['error']('Failed\x20to\x20load\x20comments:',_0x42284a),this['commentsList']['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-error\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Failed\x20to\x20load\x20comments\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-ghost\x20btn-small\x22\x20onclick=\x22this.parentElement.parentElement.closest(\x27.comments-widget\x27).__widget.loadComments()\x22>Retry</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20';}finally{this['isLoading']=![];}}['renderComments'](){if(this['comments']['length']===0x0){this['commentsList']['innerHTML']='<div\x20class=\x22comments-empty\x22>No\x20comments\x20yet</div>';return;}this['commentsList']['innerHTML']='',this['comments']['forEach'](_0x275e7a=>{const _0x2d4378=this['createCommentElement'](_0x275e7a);this['commentsList']['appendChild'](_0x2d4378);});}['createCommentElement'](_0x9fc588){const _0x2d0e29=document['createElement']('div');_0x2d0e29['className']='comment-item',_0x2d0e29['dataset']['commentId']=_0x9fc588['id'];const _0x2dfa2a=this['options']['currentUserId']&&_0x9fc588['author']?.['userId']===this['options']['currentUserId'],_0x59c777=this['formatDate'](_0x9fc588['createdAt']),_0xf7f173=_0x9fc588['updatedAt']!==_0x9fc588['createdAt'],_0x319b22=this['resolveAttachmentUrls'](_0x9fc588['content']);let _0x3c701f=window['marked']?window['marked']['parse'](_0x319b22):_0x319b22;_0x3c701f=this['renderMentions'](_0x3c701f),_0x2d0e29['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-author\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comment-author-name\x22>'+this['escapeHtml'](_0x9fc588['author']?.['name']||'Anonymous')+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comment-timestamp\x22\x20title=\x22'+new Date(_0x9fc588['createdAt'])['toLocaleString']()+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x59c777+(_0xf7f173?'\x20(edited)':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x2dfa2a?'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-icon-mini\x20comment-edit-btn\x22\x20title=\x22Edit\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20width=\x2212\x22\x20height=\x2212\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M11\x204H4a2\x202\x200\x200\x200-2\x202v14a2\x202\x200\x200\x200\x202\x202h14a2\x202\x200\x200\x200\x202-2v-7\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M18.5\x202.5a2.121\x202.121\x200\x200\x201\x203\x203L12\x2015l-4\x201\x201-4\x209.5-9.5z\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-icon-mini\x20comment-delete-btn\x22\x20title=\x22Delete\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<svg\x20width=\x2212\x22\x20height=\x2212\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20fill=\x22none\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<polyline\x20points=\x223\x206\x205\x206\x2021\x206\x22></polyline>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<path\x20d=\x22M19\x206v14a2\x202\x200\x200\x201-2\x202H7a2\x202\x200\x200\x201-2-2V6m3\x200V4a2\x202\x200\x200\x201\x202-2h4a2\x202\x200\x200\x201\x202\x202v2\x22></path>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20':'')+'\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22comment-content\x22>'+_0x3c701f+'</div>\x0a\x20\x20\x20\x20';if(_0x2dfa2a){const _0x11f496=_0x2d0e29['querySelector']('.comment-edit-btn'),_0x126880=_0x2d0e29['querySelector']('.comment-delete-btn');_0x11f496?.['addEventListener']('click',()=>this['startEdit'](_0x9fc588)),_0x126880?.['addEventListener']('click',()=>this['deleteComment'](_0x9fc588['id']));}return _0x2d0e29;}['formatDate'](_0x278e01){const _0x36d488=new Date(_0x278e01),_0x59a35e=new Date(),_0x9d650b=_0x59a35e-_0x36d488,_0x564590=Math['floor'](_0x9d650b/0xea60),_0x4e546d=Math['floor'](_0x9d650b/0x36ee80),_0x33d69a=Math['floor'](_0x9d650b/0x5265c00);if(_0x564590<0x1)return'just\x20now';if(_0x564590<0x3c)return _0x564590+'m\x20ago';if(_0x4e546d<0x18)return _0x4e546d+'h\x20ago';if(_0x33d69a<0x7)return _0x33d69a+'d\x20ago';return _0x36d488['toLocaleDateString']();}['escapeHtml'](_0x478ead){const _0x22ee4b=document['createElement']('div');return _0x22ee4b['textContent']=_0x478ead,_0x22ee4b['innerHTML'];}['resolveAttachmentUrls'](_0xa54d3){if(!_0xa54d3||!this['options']['taskId'])return _0xa54d3;const _0x19ca08=this['options']['getAPI'](),_0x43bc85=_0x19ca08['getBaseUrl']();let _0x36cec3=String(_0xa54d3)['replace'](/\]\(attachment:(?:\/\/)?([^)]+)\)/g,(_0x31fd47,_0x32f234)=>{const _0x4ee437=String(_0x32f234||'')['trim']();if(!_0x4ee437)return _0x31fd47;let _0x34472e=_0x4ee437;try{_0x34472e=decodeURIComponent(_0x4ee437);}catch{}return']('+_0x43bc85+'/tasks/'+this['options']['taskId']+'/attachments/'+encodeURIComponent(_0x34472e)+')';});return _0x36cec3;}['renderMentions'](_0x1d547b){if(!_0x1d547b)return _0x1d547b;return String(_0x1d547b)['replace'](/@?<a\s+href="mention:([^"]+)"[^>]*>([^<]+)<\/a>/g,(_0x5dbbc1,_0xe4f69e,_0x1c7fcb)=>{const _0x4fb9d8=this['escapeHtml'](_0x1c7fcb),_0x165421=this['escapeHtml'](_0xe4f69e);return'<span\x20class=\x22mention\x22\x20data-mention-user-id=\x22'+_0x165421+'\x22>@'+_0x4fb9d8+'</span>';});}['startEdit'](_0x2032e8){this['editingCommentId']=_0x2032e8['id'],this['editor']['setValue'](_0x2032e8['content']),this['editor']['focus'](),this['cancelBtn']['hidden']=![],this['submitBtn']['querySelector']('.btn-text')['textContent']='Save',this['editor']['toolbar']&&this['editor']['toolbar']['classList']['remove']('comments-toolbar-hidden'),this['inputSection']['scrollIntoView']({'behavior':'smooth','block':'nearest'});}['cancelEdit'](){this['editingCommentId']=null,this['editor']['clear'](),this['cancelBtn']['hidden']=!![],this['submitBtn']['querySelector']('.btn-text')['textContent']='Add\x20Comment',this['submitBtn']['disabled']=!![],this['editor']['toolbar']&&!this['editor']['getValue']()?.['trim']()&&this['editor']['toolbar']['classList']['add']('comments-toolbar-hidden');}async['handleSubmit'](){const _0x3af18c=this['editor']['getValue']()?.['trim']();if(!_0x3af18c&&this['pendingAttachments']['length']===0x0||!this['options']['taskId'])return;this['setLoading'](!![]);try{const _0x16f240=this['options']['getAPI']();this['pendingAttachments']['length']>0x0&&this['options']['enableAttachments']&&(await _0x16f240['uploadAttachments'](this['options']['taskId'],this['pendingAttachments']),this['existingAttachments']['push'](...this['pendingAttachments']['map'](_0x1742ee=>({'name':_0x1742ee['name']}))),this['pendingAttachments']=[]);if(this['editingCommentId']){const _0x5bd697=await _0x16f240['updateComment'](this['options']['taskId'],this['editingCommentId'],_0x3af18c),_0x5ef5b5=this['comments']['findIndex'](_0x47a108=>_0x47a108['id']===this['editingCommentId']);_0x5ef5b5!==-0x1&&(this['comments'][_0x5ef5b5]=_0x5bd697['comment']);}else{const _0x5bcd02=await _0x16f240['addComment'](this['options']['taskId'],_0x3af18c);this['comments']['push'](_0x5bcd02['comment']);}this['renderComments'](),this['updateCount'](),this['cancelEdit'](),this['editor']['clear']();}catch(_0xde5175){console['error']('Failed\x20to\x20save\x20comment:',_0xde5175),alert('Failed\x20to\x20save\x20comment:\x20'+_0xde5175['message']);}finally{this['setLoading'](![]);}}async['deleteComment'](_0x56f7f0){const _0x5edb0f=await this['showDeleteConfirmModal']();if(!_0x5edb0f)return;try{const _0x3d714a=this['options']['getAPI']();await _0x3d714a['deleteComment'](this['options']['taskId'],_0x56f7f0),this['comments']=this['comments']['filter'](_0x1c77f1=>_0x1c77f1['id']!==_0x56f7f0),this['renderComments'](),this['updateCount']();}catch(_0x18af91){console['error']('Failed\x20to\x20delete\x20comment:',_0x18af91),alert('Failed\x20to\x20delete\x20comment:\x20'+_0x18af91['message']);}}['showDeleteConfirmModal'](){return new Promise(_0x133ff9=>{const _0x3bd729=document['createElement']('div');_0x3bd729['className']='comments-confirm-modal',_0x3bd729['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-backdrop\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-dialog\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h3>Delete\x20Comment</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-icon\x20comments-confirm-close\x22\x20title=\x22Close\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-body\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p>Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20this\x20comment?\x20This\x20action\x20cannot\x20be\x20undone.</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22comments-confirm-footer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-ghost\x20btn-small\x20comments-confirm-cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22btn-danger\x20btn-small\x20comments-confirm-delete\x22>Delete</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20',document['body']['appendChild'](_0x3bd729);const _0x2bfc1d=_0x55aada=>{document['removeEventListener']('keydown',_0x43205e),_0x3bd729['remove'](),_0x133ff9(_0x55aada);},_0x43205e=_0x233534=>{if(_0x233534['key']==='Escape')_0x2bfc1d(![]);};document['addEventListener']('keydown',_0x43205e),_0x3bd729['querySelector']('.comments-confirm-backdrop')['addEventListener']('click',()=>_0x2bfc1d(![])),_0x3bd729['querySelector']('.comments-confirm-close')['addEventListener']('click',()=>_0x2bfc1d(![])),_0x3bd729['querySelector']('.comments-confirm-cancel')['addEventListener']('click',()=>_0x2bfc1d(![])),_0x3bd729['querySelector']('.comments-confirm-delete')['addEventListener']('click',()=>_0x2bfc1d(!![])),_0x3bd729['querySelector']('.comments-confirm-cancel')['focus']();});}['setLoading'](_0x3ad89a){this['submitBtn']['disabled']=_0x3ad89a,this['submitBtn']['querySelector']('.btn-text')['hidden']=_0x3ad89a,this['submitBtn']['querySelector']('.btn-loading')['hidden']=!_0x3ad89a;}['updateCount'](){const _0x1ec9c3=this['comments']['length'],_0x1736fe=this['container']['querySelector']('#comments-count-badge');_0x1736fe&&(_0x1736fe['textContent']=_0x1ec9c3,_0x1736fe['hidden']=_0x1ec9c3===0x0);const _0x5344ea=this['container']['querySelector']('#comments-count');_0x5344ea&&(_0x5344ea['textContent']=_0x1ec9c3>0x0?'('+_0x1ec9c3+')':''),this['options']['onCommentsChanged']&&this['options']['onCommentsChanged'](this['comments']);}['getCommentCount'](){return this['comments']['length'];}['destroy'](){this['editor']&&this['editor']['destroy'](),this['container']['innerHTML']='';}}CommentsWidget['prototype']['_attachToContainer']=function(){this['container']['__widget']=this;};typeof window!=='undefined'&&(window['CommentsWidget']=CommentsWidget);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Utils}from'./app.js';export function parsePatchContent(_0x4d0d31){const _0x83fb36=[],_0x154ad1=_0x4d0d31['split']('\x0a');let _0x1572a4=null,_0x11de94=null;for(const _0x5599ea of _0x154ad1){if(_0x5599ea['startsWith']('diff\x20--git')){_0x1572a4&&_0x11de94&&_0x1572a4['hunks']['push'](_0x11de94);_0x1572a4&&_0x83fb36['push'](_0x1572a4);const _0x16deb9=_0x5599ea['match'](/diff --git a\/(.+?) b\/(.+)/);_0x1572a4={'oldPath':_0x16deb9?_0x16deb9[0x1]:'','newPath':_0x16deb9?_0x16deb9[0x2]:'','hunks':[],'isDeleted':![]},_0x11de94=null;}else{if(_0x5599ea['startsWith']('deleted\x20file\x20mode')&&_0x1572a4)_0x1572a4['isDeleted']=!![];else{if(_0x5599ea['startsWith']('@@'))_0x11de94&&_0x1572a4&&_0x1572a4['hunks']['push'](_0x11de94),_0x11de94={'header':_0x5599ea,'lines':[]};else _0x11de94&&_0x11de94['lines']['push'](_0x5599ea);}}}return _0x1572a4&&_0x11de94&&_0x1572a4['hunks']['push'](_0x11de94),_0x1572a4&&_0x83fb36['push'](_0x1572a4),_0x83fb36;}export function parseHunkHeader(_0xe0dc3c){const _0xd06258=_0xe0dc3c['match'](/@@ -(\d+),?\d* \+(\d+),?\d* @@/);if(_0xd06258)return{'oldStart':parseInt(_0xd06258[0x1],0xa),'newStart':parseInt(_0xd06258[0x2],0xa)};return{'oldStart':0x1,'newStart':0x1};}export function highlightDiffLine(_0x4966f3,_0x2be076){const _0x5c58af=window['hljs']||(typeof hljs!=='undefined'?hljs:null);if(_0x5c58af&&_0x2be076)try{const _0x541fae=_0x5c58af['getLanguage'](_0x2be076)?_0x2be076:null;if(_0x541fae)return _0x5c58af['highlight'](_0x4966f3,{'language':_0x541fae})['value'];}catch(_0x470fcc){console['error']('Diff\x20syntax\x20highlighting\x20error:',_0x470fcc);}return Utils['escapeHtml'](_0x4966f3);}export function getFileLanguage(_0x39b50b){const _0x1bfc66=_0x39b50b['split']('.')['pop']()['toLowerCase'](),_0x13ae1a={'js':'javascript','jsx':'javascript','ts':'typescript','tsx':'typescript','py':'python','java':'java','c':'c','cpp':'cpp','cs':'csharp','go':'go','rs':'rust','php':'php','rb':'ruby','html':'xml','css':'css','json':'json','yml':'yaml','yaml':'yaml','md':'markdown','sh':'bash','bash':'bash'};return _0x13ae1a[_0x1bfc66]||null;}export function computeWordDiff(_0x919f10,_0xa412a6){const _0x136580=_0x559641=>{const _0x30550e=[];let _0x56a0c3='',_0x59aeaf=![];for(let _0x1aa5dc=0x0;_0x1aa5dc<_0x559641['length'];_0x1aa5dc++){const _0xeb3ff8=_0x559641[_0x1aa5dc],_0x2820ba=/\s/['test'](_0xeb3ff8);if(_0x56a0c3==='')_0x56a0c3=_0xeb3ff8,_0x59aeaf=_0x2820ba;else _0x2820ba===_0x59aeaf?_0x56a0c3+=_0xeb3ff8:(_0x30550e['push'](_0x56a0c3),_0x56a0c3=_0xeb3ff8,_0x59aeaf=_0x2820ba);}return _0x56a0c3&&_0x30550e['push'](_0x56a0c3),_0x30550e;},_0x5d8074=_0x136580(_0x919f10),_0x5c5d57=_0x136580(_0xa412a6),_0x65f4d0=_0x5d8074['length'],_0x2fd6fe=_0x5c5d57['length'],_0x544ee4=Array(_0x65f4d0+0x1)['fill'](null)['map'](()=>Array(_0x2fd6fe+0x1)['fill'](0x0));for(let _0xe27884=0x1;_0xe27884<=_0x65f4d0;_0xe27884++){for(let _0x191fd6=0x1;_0x191fd6<=_0x2fd6fe;_0x191fd6++){_0x5d8074[_0xe27884-0x1]===_0x5c5d57[_0x191fd6-0x1]?_0x544ee4[_0xe27884][_0x191fd6]=_0x544ee4[_0xe27884-0x1][_0x191fd6-0x1]+0x1:_0x544ee4[_0xe27884][_0x191fd6]=Math['max'](_0x544ee4[_0xe27884-0x1][_0x191fd6],_0x544ee4[_0xe27884][_0x191fd6-0x1]);}}const _0x15db0f={'old':[],'new':[]};let _0x5ddf6e=_0x65f4d0,_0xd3711a=_0x2fd6fe;const _0x1036b7=[],_0x33c04a=[];while(_0x5ddf6e>0x0||_0xd3711a>0x0){if(_0x5ddf6e>0x0&&_0xd3711a>0x0&&_0x5d8074[_0x5ddf6e-0x1]===_0x5c5d57[_0xd3711a-0x1])_0x1036b7['unshift']({'type':'equal','text':_0x5d8074[_0x5ddf6e-0x1]}),_0x33c04a['unshift']({'type':'equal','text':_0x5c5d57[_0xd3711a-0x1]}),_0x5ddf6e--,_0xd3711a--;else{if(_0xd3711a>0x0&&(_0x5ddf6e===0x0||_0x544ee4[_0x5ddf6e][_0xd3711a-0x1]>=_0x544ee4[_0x5ddf6e-0x1][_0xd3711a]))_0x33c04a['unshift']({'type':'insert','text':_0x5c5d57[_0xd3711a-0x1]}),_0xd3711a--;else _0x5ddf6e>0x0&&(_0x1036b7['unshift']({'type':'delete','text':_0x5d8074[_0x5ddf6e-0x1]}),_0x5ddf6e--);}}return _0x15db0f['old']=_0x1036b7,_0x15db0f['new']=_0x33c04a,_0x15db0f;}export function renderDiffLineWithWordHighlight(_0x239630,_0x1785d6,_0x5c4f09,_0xac7fe2){if(!_0x1785d6||_0x1785d6['length']===0x0)return highlightDiffLine(_0x239630,_0xac7fe2);let _0x234770='';const _0x1bbcef=_0x5c4f09==='add'?'diff-word-add':'diff-word-remove',_0x4c86f6=_0x5c4f09==='add'?'insert':'delete';for(const _0x1671af of _0x1785d6){const _0x3b7972=Utils['escapeHtml'](_0x1671af['text']);_0x1671af['type']===_0x4c86f6?_0x234770+='<span\x20class=\x22'+_0x1bbcef+'\x22>'+_0x3b7972+'</span>':_0x234770+=_0x3b7972;}return _0x234770;}export function calculateDiffStats(_0x31ca97){let _0x45bc4f=0x0,_0xa3d32d=0x0,_0x2ba32c=0x0;return _0x31ca97['forEach'](_0x26ad5e=>{let _0x10634e=0x0,_0x441015=0x0;_0x26ad5e['hunks']['forEach'](_0x25e841=>{_0x25e841['lines']['forEach'](_0x1b1051=>{if(_0x1b1051['startsWith']('+'))_0x10634e+=0x1;else{if(_0x1b1051['startsWith']('-'))_0x441015+=0x1;}});}),(_0x10634e+_0x441015>0x0||_0x26ad5e['isDeleted'])&&(_0x2ba32c+=0x1),_0x45bc4f+=_0x10634e,_0xa3d32d+=_0x441015;}),{'additions':_0x45bc4f,'deletions':_0xa3d32d,'files':_0x2ba32c};}export function getFileStatus(_0x5e6980,_0x315fdc,_0xec3436){if(_0x5e6980['isDeleted'])return'deleted';if(_0x315fdc>0x0&&_0xec3436===0x0)return'added';return'modified';}export function safeBase64(_0x339107){try{return btoa(unescape(encodeURIComponent(_0x339107)));}catch(_0x574573){return btoa(_0x339107);}}export function getStorageKey(_0x25b411,_0x2736b8){return _0x25b411+'-'+safeBase64(_0x2736b8);}export function getCollapsedState(_0x257cb8,_0x3712ad){const _0x2db540=localStorage['getItem'](getStorageKey(_0x257cb8,_0x3712ad));return _0x2db540==='true';}export function renderUnifiedDiff(_0xd82391,_0x27ab53){return _0xd82391['map']((_0x40962d,_0x5310b1)=>{const _0x3483db=_0x40962d['newPath']||_0x40962d['oldPath']||'unknown',_0x4d5eb3='diff-'+_0x27ab53+'-'+_0x5310b1,_0x5066cf=getFileLanguage(_0x3483db),{additions:_0x59cc63,deletions:_0x31360a}=calculateDiffStats([_0x40962d]),_0x536fc9=getCollapsedState(_0x27ab53,_0x3483db),_0x5918bd=getFileStatus(_0x40962d,_0x59cc63,_0x31360a),_0x106d95=_0x5918bd==='added'?'A':_0x5918bd==='deleted'?'D':'M',_0x289fa7=_0x40962d['hunks']['map'](_0x5857d9=>{const {oldStart:_0x55a662,newStart:_0x31c2fe}=parseHunkHeader(_0x5857d9['header']);let _0xbc53db=_0x55a662,_0x521a00=_0x31c2fe;const _0x1ba6e2=_0x5857d9['lines']['map'](_0x456549=>({'line':_0x456549,'type':_0x456549['startsWith']('+')?'add':_0x456549['startsWith']('-')?'remove':_0x456549['startsWith']('\x5c')?'meta':'context'}));let _0x424db9=0x0;while(_0x424db9<_0x1ba6e2['length']){if(_0x1ba6e2[_0x424db9]['type']==='remove'){let _0xa30f42=_0x424db9,_0x1433eb=_0x424db9;while(_0x1433eb<_0x1ba6e2['length']&&_0x1ba6e2[_0x1433eb]['type']==='remove')_0x1433eb++;let _0x4195fb=_0x1433eb,_0x260bfc=_0x4195fb;while(_0x260bfc<_0x1ba6e2['length']&&_0x1ba6e2[_0x260bfc]['type']==='add')_0x260bfc++;const _0x2a7c9b=_0x1433eb-_0xa30f42,_0x28d54f=_0x260bfc-_0x4195fb,_0x4e183e=Math['min'](_0x2a7c9b,_0x28d54f);for(let _0x14b04f=0x0;_0x14b04f<_0x4e183e;_0x14b04f++){const _0x40dd39=_0x1ba6e2[_0xa30f42+_0x14b04f]['line']['substring'](0x1),_0x5338c7=_0x1ba6e2[_0x4195fb+_0x14b04f]['line']['substring'](0x1),_0x3d8a2b=computeWordDiff(_0x40dd39,_0x5338c7);_0x1ba6e2[_0xa30f42+_0x14b04f]['wordDiff']=_0x3d8a2b['old'],_0x1ba6e2[_0x4195fb+_0x14b04f]['wordDiff']=_0x3d8a2b['new'];}_0x424db9=_0x260bfc;}else _0x424db9++;}const _0x2fd72f=_0x1ba6e2['map'](_0x76bbf1=>{const _0x7e11e3=_0x76bbf1['line'];if(_0x7e11e3['startsWith']('+')){const _0x1b5114=_0x7e11e3['substring'](0x1),_0x3fec08=_0x76bbf1['wordDiff']?renderDiffLineWithWordHighlight(_0x1b5114,_0x76bbf1['wordDiff'],'add',_0x5066cf):highlightDiffLine(_0x1b5114,_0x5066cf),_0x420e25='<div\x20class=\x22diff-line\x20diff-add\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22></span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22>'+_0x521a00+'</span><span\x20class=\x22diff-line-content\x22><span\x20class=\x22diff-prefix\x22>+</span>'+_0x3fec08+'</span></div>';return _0x521a00+=0x1,_0x420e25;}if(_0x7e11e3['startsWith']('-')){const _0x597b7c=_0x7e11e3['substring'](0x1),_0x142a9e=_0x76bbf1['wordDiff']?renderDiffLineWithWordHighlight(_0x597b7c,_0x76bbf1['wordDiff'],'remove',_0x5066cf):highlightDiffLine(_0x597b7c,_0x5066cf),_0x25da62='<div\x20class=\x22diff-line\x20diff-remove\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22>'+_0xbc53db+'</span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22></span><span\x20class=\x22diff-line-content\x22><span\x20class=\x22diff-prefix\x22>-</span>'+_0x142a9e+'</span></div>';return _0xbc53db+=0x1,_0x25da62;}if(_0x7e11e3['startsWith']('\x5c'))return'<div\x20class=\x22diff-line\x20diff-meta\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22></span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22></span><span\x20class=\x22diff-line-content\x22>'+Utils['escapeHtml'](_0x7e11e3)+'</span></div>';const _0x4e0c14=_0x7e11e3['startsWith']('\x20')?_0x7e11e3['substring'](0x1):_0x7e11e3,_0x4e646f=highlightDiffLine(_0x4e0c14,_0x5066cf),_0x2ebb7f='<div\x20class=\x22diff-line\x20diff-context\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22>'+_0xbc53db+'</span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22>'+_0x521a00+'</span><span\x20class=\x22diff-line-content\x22>\x20'+_0x4e646f+'</span></div>';return _0xbc53db+=0x1,_0x521a00+=0x1,_0x2ebb7f;})['join']('');return'<div\x20class=\x22diff-hunk\x22><div\x20class=\x22diff-hunk-header\x22>'+Utils['escapeHtml'](_0x5857d9['header'])+'</div>'+_0x2fd72f+'</div>';})['join'](''),_0x5e0932=_0x289fa7||'<div\x20class=\x22diff-hunk\x22><div\x20class=\x22diff-hunk-header\x22>No\x20textual\x20diff\x20available</div></div>';return'\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff\x22\x20id=\x22file-'+_0x4d5eb3+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-header\x22\x20data-diff-id=\x22'+_0x4d5eb3+'\x22\x20data-file-name=\x22'+Utils['escapeHtml'](_0x3483db)+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-title\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-status-badge\x20'+_0x5918bd+'\x22>'+_0x106d95+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-diff-name\x22>'+Utils['escapeHtml'](_0x3483db)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-diff-stat\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22diff-add\x22>+'+_0x59cc63+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22diff-del\x22>-'+_0x31360a+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22file-diff-toggle-btn\x22\x20data-diff-id=\x22'+_0x4d5eb3+'\x22\x20data-collapsed=\x22'+_0x536fc9+'\x22\x20type=\x22button\x22\x20aria-label=\x22'+(_0x536fc9?'Expand':'Collapse')+'\x22></button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-content\x20'+(_0x536fc9?'collapsed':'')+'\x22\x20id=\x22'+_0x4d5eb3+'\x22>'+_0x5e0932+'</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20';})['join']('');}
|
|
1
|
+
import{Utils}from'./app.js';export function parsePatchContent(_0x37aa3a){const _0x2abcc8=[],_0x5e1fdc=_0x37aa3a['split']('\x0a');let _0x395f87=null,_0x138b4a=null;for(const _0x3b579d of _0x5e1fdc){if(_0x3b579d['startsWith']('diff\x20--git')){_0x395f87&&_0x138b4a&&_0x395f87['hunks']['push'](_0x138b4a);_0x395f87&&_0x2abcc8['push'](_0x395f87);const _0x2764fc=_0x3b579d['match'](/diff --git a\/(.+?) b\/(.+)/);_0x395f87={'oldPath':_0x2764fc?_0x2764fc[0x1]:'','newPath':_0x2764fc?_0x2764fc[0x2]:'','hunks':[],'isDeleted':![]},_0x138b4a=null;}else{if(_0x3b579d['startsWith']('deleted\x20file\x20mode')&&_0x395f87)_0x395f87['isDeleted']=!![];else{if(_0x3b579d['startsWith']('@@'))_0x138b4a&&_0x395f87&&_0x395f87['hunks']['push'](_0x138b4a),_0x138b4a={'header':_0x3b579d,'lines':[]};else _0x138b4a&&_0x138b4a['lines']['push'](_0x3b579d);}}}return _0x395f87&&_0x138b4a&&_0x395f87['hunks']['push'](_0x138b4a),_0x395f87&&_0x2abcc8['push'](_0x395f87),_0x2abcc8;}export function parseHunkHeader(_0x10c0a1){const _0x3aea85=_0x10c0a1['match'](/@@ -(\d+),?\d* \+(\d+),?\d* @@/);if(_0x3aea85)return{'oldStart':parseInt(_0x3aea85[0x1],0xa),'newStart':parseInt(_0x3aea85[0x2],0xa)};return{'oldStart':0x1,'newStart':0x1};}export function highlightDiffLine(_0x31987c,_0x11dc8b){const _0x18f7a3=window['hljs']||(typeof hljs!=='undefined'?hljs:null);if(_0x18f7a3&&_0x11dc8b)try{const _0x30752=_0x18f7a3['getLanguage'](_0x11dc8b)?_0x11dc8b:null;if(_0x30752)return _0x18f7a3['highlight'](_0x31987c,{'language':_0x30752})['value'];}catch(_0x44b0d6){console['error']('Diff\x20syntax\x20highlighting\x20error:',_0x44b0d6);}return Utils['escapeHtml'](_0x31987c);}export function getFileLanguage(_0x46a14b){const _0x203592=_0x46a14b['split']('.')['pop']()['toLowerCase'](),_0x312994={'js':'javascript','jsx':'javascript','ts':'typescript','tsx':'typescript','py':'python','java':'java','c':'c','cpp':'cpp','cs':'csharp','go':'go','rs':'rust','php':'php','rb':'ruby','html':'xml','css':'css','json':'json','yml':'yaml','yaml':'yaml','md':'markdown','sh':'bash','bash':'bash'};return _0x312994[_0x203592]||null;}export function computeWordDiff(_0xdf61e,_0x6b7b5a){const _0x58fb09=_0x162919=>{const _0x3390f3=[];let _0x3a0f27='',_0x34d170=![];for(let _0x5d345c=0x0;_0x5d345c<_0x162919['length'];_0x5d345c++){const _0x46289a=_0x162919[_0x5d345c],_0x29135b=/\s/['test'](_0x46289a);if(_0x3a0f27==='')_0x3a0f27=_0x46289a,_0x34d170=_0x29135b;else _0x29135b===_0x34d170?_0x3a0f27+=_0x46289a:(_0x3390f3['push'](_0x3a0f27),_0x3a0f27=_0x46289a,_0x34d170=_0x29135b);}return _0x3a0f27&&_0x3390f3['push'](_0x3a0f27),_0x3390f3;},_0x94a2e7=_0x58fb09(_0xdf61e),_0x1c6b0b=_0x58fb09(_0x6b7b5a),_0x22abbd=_0x94a2e7['length'],_0x26f2b0=_0x1c6b0b['length'],_0x1b4694=Array(_0x22abbd+0x1)['fill'](null)['map'](()=>Array(_0x26f2b0+0x1)['fill'](0x0));for(let _0x330cbc=0x1;_0x330cbc<=_0x22abbd;_0x330cbc++){for(let _0x495a02=0x1;_0x495a02<=_0x26f2b0;_0x495a02++){_0x94a2e7[_0x330cbc-0x1]===_0x1c6b0b[_0x495a02-0x1]?_0x1b4694[_0x330cbc][_0x495a02]=_0x1b4694[_0x330cbc-0x1][_0x495a02-0x1]+0x1:_0x1b4694[_0x330cbc][_0x495a02]=Math['max'](_0x1b4694[_0x330cbc-0x1][_0x495a02],_0x1b4694[_0x330cbc][_0x495a02-0x1]);}}const _0x170645={'old':[],'new':[]};let _0x112765=_0x22abbd,_0x1dcba8=_0x26f2b0;const _0x677c6=[],_0x4324cf=[];while(_0x112765>0x0||_0x1dcba8>0x0){if(_0x112765>0x0&&_0x1dcba8>0x0&&_0x94a2e7[_0x112765-0x1]===_0x1c6b0b[_0x1dcba8-0x1])_0x677c6['unshift']({'type':'equal','text':_0x94a2e7[_0x112765-0x1]}),_0x4324cf['unshift']({'type':'equal','text':_0x1c6b0b[_0x1dcba8-0x1]}),_0x112765--,_0x1dcba8--;else{if(_0x1dcba8>0x0&&(_0x112765===0x0||_0x1b4694[_0x112765][_0x1dcba8-0x1]>=_0x1b4694[_0x112765-0x1][_0x1dcba8]))_0x4324cf['unshift']({'type':'insert','text':_0x1c6b0b[_0x1dcba8-0x1]}),_0x1dcba8--;else _0x112765>0x0&&(_0x677c6['unshift']({'type':'delete','text':_0x94a2e7[_0x112765-0x1]}),_0x112765--);}}return _0x170645['old']=_0x677c6,_0x170645['new']=_0x4324cf,_0x170645;}export function renderDiffLineWithWordHighlight(_0x3eebf4,_0x1475f0,_0x21e7d9,_0x14550e){if(!_0x1475f0||_0x1475f0['length']===0x0)return highlightDiffLine(_0x3eebf4,_0x14550e);let _0x50f627='';const _0x595c58=_0x21e7d9==='add'?'diff-word-add':'diff-word-remove',_0x47fbea=_0x21e7d9==='add'?'insert':'delete';for(const _0x53178b of _0x1475f0){const _0x96f2a2=Utils['escapeHtml'](_0x53178b['text']);_0x53178b['type']===_0x47fbea?_0x50f627+='<span\x20class=\x22'+_0x595c58+'\x22>'+_0x96f2a2+'</span>':_0x50f627+=_0x96f2a2;}return _0x50f627;}export function calculateDiffStats(_0x3b0306){let _0x5bb602=0x0,_0x310307=0x0,_0x14225c=0x0;return _0x3b0306['forEach'](_0x4f4039=>{let _0x2a2303=0x0,_0x309183=0x0;_0x4f4039['hunks']['forEach'](_0x2e7484=>{_0x2e7484['lines']['forEach'](_0x1d6fad=>{if(_0x1d6fad['startsWith']('+'))_0x2a2303+=0x1;else{if(_0x1d6fad['startsWith']('-'))_0x309183+=0x1;}});}),(_0x2a2303+_0x309183>0x0||_0x4f4039['isDeleted'])&&(_0x14225c+=0x1),_0x5bb602+=_0x2a2303,_0x310307+=_0x309183;}),{'additions':_0x5bb602,'deletions':_0x310307,'files':_0x14225c};}export function getFileStatus(_0x406f0c,_0x33f758,_0x1c3d7d){if(_0x406f0c['isDeleted'])return'deleted';if(_0x33f758>0x0&&_0x1c3d7d===0x0)return'added';return'modified';}export function safeBase64(_0x375904){try{return btoa(unescape(encodeURIComponent(_0x375904)));}catch(_0x50eb3f){return btoa(_0x375904);}}export function getStorageKey(_0x777985,_0x43c362){return _0x777985+'-'+safeBase64(_0x43c362);}export function getCollapsedState(_0xb9949f,_0x4607fe){const _0x2ee7e2=localStorage['getItem'](getStorageKey(_0xb9949f,_0x4607fe));return _0x2ee7e2==='true';}export function renderUnifiedDiff(_0x186169,_0x5b34a4){return _0x186169['map']((_0x3bc8bf,_0x5e841f)=>{const _0x3d0a45=_0x3bc8bf['newPath']||_0x3bc8bf['oldPath']||'unknown',_0x540058='diff-'+_0x5b34a4+'-'+_0x5e841f,_0xa5e66d=getFileLanguage(_0x3d0a45),{additions:_0x4dcc73,deletions:_0x50238c}=calculateDiffStats([_0x3bc8bf]),_0xf16fde=getCollapsedState(_0x5b34a4,_0x3d0a45),_0x5e0e7f=getFileStatus(_0x3bc8bf,_0x4dcc73,_0x50238c),_0x50a53f=_0x5e0e7f==='added'?'A':_0x5e0e7f==='deleted'?'D':'M',_0x541ff5=_0x3bc8bf['hunks']['map'](_0x4bc905=>{const {oldStart:_0x542cc7,newStart:_0x3a8b7a}=parseHunkHeader(_0x4bc905['header']);let _0x58eaa4=_0x542cc7,_0x333269=_0x3a8b7a;const _0x3fa3c3=_0x4bc905['lines']['map'](_0x20e397=>({'line':_0x20e397,'type':_0x20e397['startsWith']('+')?'add':_0x20e397['startsWith']('-')?'remove':_0x20e397['startsWith']('\x5c')?'meta':'context'}));let _0x1bc9b6=0x0;while(_0x1bc9b6<_0x3fa3c3['length']){if(_0x3fa3c3[_0x1bc9b6]['type']==='remove'){let _0x1e871e=_0x1bc9b6,_0x16972e=_0x1bc9b6;while(_0x16972e<_0x3fa3c3['length']&&_0x3fa3c3[_0x16972e]['type']==='remove')_0x16972e++;let _0x596ae9=_0x16972e,_0x3c8d87=_0x596ae9;while(_0x3c8d87<_0x3fa3c3['length']&&_0x3fa3c3[_0x3c8d87]['type']==='add')_0x3c8d87++;const _0x25da2c=_0x16972e-_0x1e871e,_0x2b3ef2=_0x3c8d87-_0x596ae9,_0xe7f5ee=Math['min'](_0x25da2c,_0x2b3ef2);for(let _0x2abca8=0x0;_0x2abca8<_0xe7f5ee;_0x2abca8++){const _0x4d0f10=_0x3fa3c3[_0x1e871e+_0x2abca8]['line']['substring'](0x1),_0x59f46b=_0x3fa3c3[_0x596ae9+_0x2abca8]['line']['substring'](0x1),_0x31db18=computeWordDiff(_0x4d0f10,_0x59f46b);_0x3fa3c3[_0x1e871e+_0x2abca8]['wordDiff']=_0x31db18['old'],_0x3fa3c3[_0x596ae9+_0x2abca8]['wordDiff']=_0x31db18['new'];}_0x1bc9b6=_0x3c8d87;}else _0x1bc9b6++;}const _0x283a4e=_0x3fa3c3['map'](_0x1b66e0=>{const _0x3784da=_0x1b66e0['line'];if(_0x3784da['startsWith']('+')){const _0x231831=_0x3784da['substring'](0x1),_0x5aed6b=_0x1b66e0['wordDiff']?renderDiffLineWithWordHighlight(_0x231831,_0x1b66e0['wordDiff'],'add',_0xa5e66d):highlightDiffLine(_0x231831,_0xa5e66d),_0xef091d='<div\x20class=\x22diff-line\x20diff-add\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22></span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22>'+_0x333269+'</span><span\x20class=\x22diff-line-content\x22><span\x20class=\x22diff-prefix\x22>+</span>'+_0x5aed6b+'</span></div>';return _0x333269+=0x1,_0xef091d;}if(_0x3784da['startsWith']('-')){const _0x2d3559=_0x3784da['substring'](0x1),_0xc39c32=_0x1b66e0['wordDiff']?renderDiffLineWithWordHighlight(_0x2d3559,_0x1b66e0['wordDiff'],'remove',_0xa5e66d):highlightDiffLine(_0x2d3559,_0xa5e66d),_0x4685ae='<div\x20class=\x22diff-line\x20diff-remove\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22>'+_0x58eaa4+'</span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22></span><span\x20class=\x22diff-line-content\x22><span\x20class=\x22diff-prefix\x22>-</span>'+_0xc39c32+'</span></div>';return _0x58eaa4+=0x1,_0x4685ae;}if(_0x3784da['startsWith']('\x5c'))return'<div\x20class=\x22diff-line\x20diff-meta\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22></span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22></span><span\x20class=\x22diff-line-content\x22>'+Utils['escapeHtml'](_0x3784da)+'</span></div>';const _0x10bb66=_0x3784da['startsWith']('\x20')?_0x3784da['substring'](0x1):_0x3784da,_0x4a998f=highlightDiffLine(_0x10bb66,_0xa5e66d),_0x2498df='<div\x20class=\x22diff-line\x20diff-context\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22>'+_0x58eaa4+'</span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22>'+_0x333269+'</span><span\x20class=\x22diff-line-content\x22>\x20'+_0x4a998f+'</span></div>';return _0x58eaa4+=0x1,_0x333269+=0x1,_0x2498df;})['join']('');return'<div\x20class=\x22diff-hunk\x22><div\x20class=\x22diff-hunk-header\x22>'+Utils['escapeHtml'](_0x4bc905['header'])+'</div>'+_0x283a4e+'</div>';})['join'](''),_0x54a686=_0x541ff5||'<div\x20class=\x22diff-hunk\x22><div\x20class=\x22diff-hunk-header\x22>No\x20textual\x20diff\x20available</div></div>';return'\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff\x22\x20id=\x22file-'+_0x540058+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-header\x22\x20data-diff-id=\x22'+_0x540058+'\x22\x20data-file-name=\x22'+Utils['escapeHtml'](_0x3d0a45)+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-title\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-status-badge\x20'+_0x5e0e7f+'\x22>'+_0x50a53f+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-diff-name\x22>'+Utils['escapeHtml'](_0x3d0a45)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-diff-stat\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22diff-add\x22>+'+_0x4dcc73+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22diff-del\x22>-'+_0x50238c+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22file-diff-toggle-btn\x22\x20data-diff-id=\x22'+_0x540058+'\x22\x20data-collapsed=\x22'+_0xf16fde+'\x22\x20type=\x22button\x22\x20aria-label=\x22'+(_0xf16fde?'Expand':'Collapse')+'\x22></button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-content\x20'+(_0xf16fde?'collapsed':'')+'\x22\x20id=\x22'+_0x540058+'\x22>'+_0x54a686+'</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20';})['join']('');}
|