@profoundlogic/coderflow-server 0.8.5 → 0.8.7
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/base-image/Dockerfile +3 -2
- package/dist/base-image/agent-wrapper.sh +7 -2
- 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/slack-service.js +1 -0
- 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/slack.js +1 -0
- 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.css +60 -0
- package/dist/web-ui/public/admin.html +6 -0
- 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.html +146 -0
- 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-client.transport-warning.js +1 -0
- 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(_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
|
+
function isLogOnlyTaskType(_0x4f0fd3){return _0x4f0fd3==='test'||_0x4f0fd3==='deploy';}export function createApproveDialogHTML(_0x1d23ae='',_0x544cda={}){const _0x22d81a=_0x1d23ae,_0x2b28e0=_0x544cda['useTaskPageStyles']?'modal\x20profound-approve-modal':'profound-feedback-modal\x20profound-approve-modal',_0x52dee0=_0x544cda['useTaskPageStyles']?'modal-warning':'approve-modal-warning',_0x30adf5=_0x544cda['useTaskPageStyles']?'modal-error':'approve-modal-error';return'\x0a\x20\x20\x20\x20<div\x20id=\x22'+_0x22d81a+'approve-modal\x22\x20class=\x22'+_0x2b28e0+'\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'+_0x22d81a+'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'+_0x22d81a+'approve-warning\x22\x20class=\x22'+_0x52dee0+'\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'+_0x22d81a+'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'+_0x22d81a+'approve-error\x22\x20class=\x22'+_0x30adf5+'\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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'commit-message-input\x22>Commit\x20message:</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<textarea\x20id=\x22'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'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'+_0x22d81a+'cancel-approve\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22btn-primary\x22\x20id=\x22'+_0x22d81a+'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(_0xb6e546={}){this['prefix']=_0xb6e546['prefix']||'',this['onApprove']=_0xb6e546['onApprove'],this['onSync']=_0xb6e546['onSync'],this['onSuccess']=_0xb6e546['onSuccess'],this['onError']=_0xb6e546['onError'],this['onCreatePR']=_0xb6e546['onCreatePR'],this['showToast']=_0xb6e546['showToast']||(()=>{}),this['container']=_0xb6e546['container']||document['body'],this['useTaskPageStyles']=_0xb6e546['useTaskPageStyles']||![],this['baseUrl']=_0xb6e546['baseUrl']||'',this['coderflowAttribution']=_0xb6e546['coderflowAttribution'],this['onConflictFollowUp']=_0xb6e546['onConflictFollowUp']||null,this['onSyncToIbmi']=_0xb6e546['onSyncToIbmi']||null,this['onGetSyncFiles']=_0xb6e546['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 _0x48f891=document['createElement']('div');_0x48f891['innerHTML']=createApproveDialogHTML(this['prefix'],{'useTaskPageStyles':this['useTaskPageStyles']}),this['container']['appendChild'](_0x48f891['firstElementChild']),this['_bindEvents'](),this['initialized']=!![];}['_el'](_0x515b84){return document['getElementById'](''+this['prefix']+_0x515b84);}['_bindEvents'](){const _0x55ca48=this['_el']('approve-modal'),_0x2da68c=this['_el']('close-approve-modal'),_0x57c64d=this['_el']('cancel-approve'),_0x311b1a=this['_el']('confirm-approve'),_0x4bb9b3=_0x55ca48?.['querySelector']('.modal-overlay'),_0x33737d=this['_el']('pull-before-commit'),_0x4f302f=this['_el']('create-new-branch'),_0x5a3c10=this['_el']('new-branch-input-container'),_0x3db67e=this['_el']('new-branch-name'),_0x3d5bea=this['_el']('push-after-commit'),_0x34e6df=this['_el']('create-pull-request'),_0x3bfee3=this['_el']('pr-hint'),_0x3a698d=()=>{this['_refreshWarningBanner']();};_0x2da68c?.['addEventListener']('click',()=>this['hide']()),_0x57c64d?.['addEventListener']('click',()=>this['hide']()),_0x4bb9b3?.['addEventListener']('click',()=>this['hide']()),_0x311b1a?.['addEventListener']('click',()=>this['_handleApprove']());_0x4f302f&&_0x4f302f['addEventListener']('change',()=>{_0x5a3c10&&(_0x5a3c10['hidden']=!_0x4f302f['checked']),_0x4f302f['checked']&&_0x3db67e&&_0x3db67e['focus'](),_0x3a698d();});_0x33737d?.['addEventListener']('change',()=>{_0x3a698d();});_0x34e6df&&_0x3d5bea&&_0x4f302f&&(_0x34e6df['addEventListener']('change',()=>{this['_createPR']=_0x34e6df['checked'];if(_0x34e6df['checked']){_0x3d5bea['checked']=!![],_0x3d5bea['disabled']=!![],_0x4f302f['checked']=!![],_0x4f302f['disabled']=!![];_0x5a3c10&&(_0x5a3c10['hidden']=![]);if(_0x3bfee3)_0x3bfee3['hidden']=![];}else{_0x3d5bea['disabled']=![],_0x4f302f['disabled']=![];if(_0x3bfee3)_0x3bfee3['hidden']=!![];}_0x3a698d();}),_0x3d5bea['addEventListener']('change',()=>{if(!_0x3d5bea['checked']&&_0x34e6df['checked']){_0x34e6df['checked']=![],this['_createPR']=![],_0x3d5bea['disabled']=![],_0x4f302f['disabled']=![];if(_0x3bfee3)_0x3bfee3['hidden']=!![];}}));_0x3a698d();const _0x58a23d=this['_el']('sync-to-ibmi');_0x58a23d&&_0x58a23d['addEventListener']('change',async _0x1c6258=>{const _0x3d2f6c=this['_el']('ibmi-sync-fields');if(_0x3d2f6c)_0x3d2f6c['hidden']=!_0x1c6258['target']['checked'];if(_0x1c6258['target']['checked']){const _0xdc6e4=this['_el']('ibmi-sync-library'),_0x540d0e=localStorage['getItem']('coderflow_ibmi_sync_library');_0x540d0e&&_0xdc6e4&&!_0xdc6e4['value']&&(_0xdc6e4['value']=_0x540d0e);const _0xd5da98=this['_el']('ibmi-sync-user');if(_0xd5da98&&!_0xd5da98['value']){const _0xef1a19=localStorage['getItem']('coderflow_ibmi_sync_user');if(_0xef1a19)_0xd5da98['value']=_0xef1a19;}const _0x1c984f=this['_el']('ibmi-sync-password');if(_0x1c984f)_0x1c984f['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 _0x441122=this['_el']('create-new-branch'),_0x504825=this['_el']('new-branch-input-container'),_0x3fb944=this['_el']('new-branch-name');if(_0x441122)_0x441122['checked']=!![];if(_0x504825)_0x504825['hidden']=![];if(_0x3fb944)_0x3fb944['focus']();_0x3a698d();}),this['_el']('conflict-cancel')?.['addEventListener']('click',()=>this['hide']()),document['addEventListener']('keydown',_0x4fa6ea=>{_0x4fa6ea['key']==='Escape'&&_0x55ca48&&!_0x55ca48['hidden']&&this['hide']();});}async['_loadSyncFileTree'](){const _0x10052e=this['_el']('ibmi-sync-file-tree'),_0x26e754=this['_el']('ibmi-sync-files-summary');if(!_0x10052e)return;_0x10052e['innerHTML']='<span\x20style=\x22color:\x20var(--color-text-muted,\x20#888);\x20font-size:\x2013px;\x22>Loading\x20files...</span>';if(_0x26e754)_0x26e754['textContent']='';try{const {files:_0x45ef63,absolutePaths:_0x236ab1}=await this['onGetSyncFiles'](this['taskData']['taskId']);this['_syncRelativeFiles']=_0x45ef63,this['_syncAbsolutePaths']=_0x236ab1;if(_0x45ef63['length']===0x0){_0x10052e['innerHTML']='<span\x20style=\x22color:\x20var(--color-text-muted,\x20#888);\x20font-size:\x2013px;\x22>No\x20changed\x20files\x20found.</span>';return;}const {FileSelectionTree:_0x2a616e}=await import('./file-selection-tree.js'),{validateIbmiFile:_0x42a63c,hasKnownIbmiExtension:_0x11a11f}=await import('./ibmi-file-filter.js');this['_syncFileTree']=new _0x2a616e({'container':_0x10052e,'files':_0x45ef63,'isPreselected':_0x3a275b=>{const {valid:_0x17416f}=_0x42a63c(_0x3a275b);return _0x17416f&&_0x11a11f(_0x3a275b);},'isDisabled':_0x53a3ab=>{const {valid:_0x16b085,reason:_0x13c8d5}=_0x42a63c(_0x53a3ab);return{'disabled':!_0x16b085,'reason':_0x13c8d5};},'isAutoCheckEligible':_0x5c1cd1=>{const {valid:_0x192544}=_0x42a63c(_0x5c1cd1);return _0x192544&&_0x11a11f(_0x5c1cd1);},'onChange':_0x58e713=>{_0x26e754&&(_0x26e754['textContent']=_0x58e713['length']+'\x20of\x20'+_0x45ef63['length']+'\x20file'+(_0x45ef63['length']!==0x1?'s':'')+'\x20selected');}}),this['_syncFileTree']['render']();}catch(_0x6756a6){_0x10052e['innerHTML']='<span\x20style=\x22color:\x20var(--color-danger,\x20#e55368);\x20font-size:\x2013px;\x22>Failed\x20to\x20load\x20files</span>';}}['showError'](_0x3caacb){const _0x3b3190=this['_el']('approve-error'),_0x3959a6=this['_el']('approve-error-text');_0x3b3190&&_0x3959a6&&(_0x3959a6['textContent']=_0x3caacb,_0x3b3190['hidden']=![],_0x3b3190['scrollIntoView']({'behavior':'smooth','block':'nearest'}));}['hideError'](){const _0x39d8a5=this['_el']('approve-error'),_0x4adace=this['_el']('approve-error-text');_0x39d8a5&&_0x4adace&&(_0x39d8a5['hidden']=!![],_0x4adace['textContent']='');}['_displayBranchInfo'](_0x329831,_0x3de5f5={}){const _0x244ef9=this['_el']('approve-branches');if(!_0x244ef9)return;const _0x3e7f0e=[];for(const _0x22c347 of _0x329831){_0x3de5f5[_0x22c347['name']]&&_0x3e7f0e['push']({'repo':_0x22c347['name'],'branch':_0x3de5f5[_0x22c347['name']]});}if(_0x3e7f0e['length']>0x0){_0x244ef9['hidden']=![];if(_0x3e7f0e['length']===0x1)_0x244ef9['innerHTML']='<div\x20class=\x22branch-info\x22>Branch:\x20<code>'+_0x3e7f0e[0x0]['branch']+'</code></div>';else{const _0x2a6938=_0x3e7f0e['map'](_0x3ff173=>'<div\x20class=\x22branch-item\x22><strong>'+_0x3ff173['repo']+':</strong>\x20<code>'+_0x3ff173['branch']+'</code></div>')['join']('');_0x244ef9['innerHTML']='<div\x20class=\x22branch-info\x22>Branches:<div\x20class=\x22branch-list\x22>'+_0x2a6938+'</div></div>';}}else _0x244ef9['hidden']=!![],_0x244ef9['innerHTML']='';}['showWarning'](_0x3469c6){const _0x315cb0=this['_el']('approve-warning'),_0x3aa3eb=this['_el']('approve-warning-text');_0x315cb0&&_0x3aa3eb&&(_0x3aa3eb['textContent']=_0x3469c6,_0x315cb0['hidden']=![]);}['hideWarning'](){const _0x1bd56d=this['_el']('approve-warning'),_0x1e0c3f=this['_el']('approve-warning-text');_0x1bd56d&&_0x1e0c3f&&(_0x1bd56d['hidden']=!![],_0x1e0c3f['textContent']='');}['_showConflictResolution'](){const _0x5add58=this['_el']('conflict-resolution'),_0x754fd2=this['_el']('confirm-approve'),_0x69c23c=this['_el']('cancel-approve'),_0x326617=this['_el']('conflict-agent-resolve');if(_0x5add58)_0x5add58['hidden']=![];if(_0x754fd2)_0x754fd2['hidden']=!![];if(_0x69c23c)_0x69c23c['hidden']=!![];const _0x265902=this['_el']('approve-modal');if(_0x265902){this['_sectionsHiddenBeforeConflict']=new Set();for(const _0x1c0e7b of _0x265902['querySelectorAll']('.modal-section')){_0x1c0e7b['hidden']&&this['_sectionsHiddenBeforeConflict']['add'](_0x1c0e7b),_0x1c0e7b['hidden']=!![];}}if(_0x326617){const _0x3301fd=!!this['onConflictFollowUp'];_0x326617['hidden']=!_0x3301fd,_0x326617['nextElementSibling']?.['classList']['contains']('field-hint')&&(_0x326617['nextElementSibling']['hidden']=!_0x3301fd);}}['_hideConflictResolution'](){const _0x54287c=this['_el']('conflict-resolution'),_0xf2005f=this['_el']('confirm-approve'),_0x251394=this['_el']('cancel-approve');if(_0x54287c)_0x54287c['hidden']=!![];if(_0xf2005f)_0xf2005f['hidden']=![];if(_0x251394)_0x251394['hidden']=![];const _0x299a42=this['_el']('approve-modal');if(_0x299a42){const _0x374306=this['_sectionsHiddenBeforeConflict']||new Set();for(const _0x199522 of _0x299a42['querySelectorAll']('.modal-section')){!_0x374306['has'](_0x199522)&&(_0x199522['hidden']=![]);}this['_sectionsHiddenBeforeConflict']=null;}}['_getRemoteConflictWarning'](){const _0x12440f=this['taskData']?.['reposChanged']||[],_0x462be4=this['_el']('pull-before-commit')?.['checked']??!![],_0x3f8b5d=this['_el']('create-new-branch')?.['checked']||![];if(!_0x462be4||_0x3f8b5d||_0x12440f['length']===0x0)return'';const _0x1c1d48=_0x12440f['filter'](_0xc89c41=>_0xc89c41?.['upstream_status']==='behind'||_0xc89c41?.['upstream_status']==='diverged');if(_0x1c1d48['length']===0x0)return'';const _0x43676b=_0x1c1d48['map'](_0x7e17e3=>{const _0x8adc60=Number(_0x7e17e3?.['upstream_behind'])||0x0,_0x238441=_0x8adc60+'\x20commit'+(_0x8adc60===0x1?'':'s')+'\x20ahead';if(_0x7e17e3['upstream_status']==='diverged')return _0x7e17e3['name']+':\x20remote\x20is\x20'+_0x238441+'\x20and\x20the\x20tracked\x20branch\x20has\x20local\x20commits';return _0x7e17e3['name']+':\x20remote\x20is\x20'+_0x238441;})['join'](';\x20');return'Remote\x20has\x20new\x20changes\x20('+_0x43676b+').\x20If\x20there\x20are\x20conflicts,\x20you\x27ll\x20be\x20given\x20options\x20to\x20resolve\x20them.';}['_refreshWarningBanner'](){const _0x103883=[this['taskData']?.['warning']||'',this['_getRemoteConflictWarning'](),this['_transientWarning']||'']['filter'](Boolean);if(_0x103883['length']>0x0){this['showWarning'](_0x103883['join']('\x20'));return;}this['hideWarning']();}['_stripCoAuthoredByLines'](_0x568474){return _0x568474['replace'](/^Co-Authored-By:.*$/gmi,'')['replace'](/^Learn more: https:\/\/coderflow\.ai\s*$/gm,'')['replace'](/\n{3,}/g,'\x0a\x0a')['trim']();}async['_addAttributionIfEnabled'](_0x48acf3){try{let _0x1bdcbe;try{const _0x180fc8=await fetch(this['baseUrl']+'/settings');if(_0x180fc8['ok']){const _0x3399d1=await _0x180fc8['json']();_0x1bdcbe=_0x3399d1['coderflow_attribution']!==![];}}catch(_0x245a40){}_0x1bdcbe===undefined&&(this['coderflowAttribution']!==undefined?_0x1bdcbe=this['coderflowAttribution']!==![]:_0x1bdcbe=!![]);const _0x1f83fa=this['_stripCoAuthoredByLines'](_0x48acf3);if(!_0x1bdcbe)return _0x1f83fa;const _0x4d7b08='\x0a\x0aCo-Authored-By:\x20CoderFlow\x20<ai@coderflow.ai>\x0aLearn\x20more:\x20https://coderflow.ai';return _0x1f83fa+_0x4d7b08;}catch(_0x4dbfc1){return console['warn']('Failed\x20to\x20add\x20CoderFlow\x20attribution:',_0x4dbfc1),_0x48acf3;}}['show'](_0x2e6c98){!this['initialized']&&this['init']();this['taskData']=_0x2e6c98;const _0x432125=this['_el']('approve-modal'),_0x4beb11=this['_el']('commit-message-input'),_0x249fca=this['_el']('pull-before-commit'),_0x1122a5=this['_el']('push-after-commit'),_0x3b3b49=this['_el']('create-new-branch'),_0x5df372=this['_el']('new-branch-input-container'),_0x327b63=this['_el']('new-branch-name');if(!_0x432125)return;this['hideError'](),this['hideWarning'](),this['_hideConflictResolution'](),this['_transientWarning']='';const _0x2f2117=_0x2e6c98['reposChanged']||[];if(_0x2f2117['length']===0x0&&!_0x2e6c98['syncFirst']){this['showToast']('No\x20changes\x20to\x20approve','error');return;}this['_updateDisplay'](_0x2f2117,_0x2e6c98);const _0x1fd009=_0x2e6c98['commitMessage']||'',_0x1bf4bd=this['_stripCoAuthoredByLines'](_0x1fd009);_0x4beb11['value']=_0x1bf4bd;if(_0x249fca)_0x249fca['checked']=!![];if(_0x1122a5)_0x1122a5['checked']=!![];_0x3b3b49&&(_0x3b3b49['checked']=![]);_0x5df372&&(_0x5df372['hidden']=!![]);_0x327b63&&(_0x327b63['value']='');if(_0x1122a5)_0x1122a5['disabled']=![];if(_0x3b3b49)_0x3b3b49['disabled']=![];this['_refreshWarningBanner'](),this['updatePRSupport'](_0x2e6c98['prSupported']===!![]);const _0x5d6e01=this['_el']('ibmi-sync-section');if(_0x5d6e01){_0x5d6e01['hidden']=!_0x2e6c98['ibmiSyncAvailable'];const _0x15eebc=this['_el']('sync-to-ibmi'),_0x36db8e=this['_el']('ibmi-sync-fields'),_0x2511fe=this['_el']('ibmi-sync-library');if(_0x15eebc)_0x15eebc['checked']=![];if(_0x36db8e)_0x36db8e['hidden']=!![];if(_0x2511fe)_0x2511fe['value']='';const _0x1695cc=this['_el']('ibmi-sync-credentials-row');_0x1695cc&&(_0x1695cc['hidden']=!(_0x2e6c98['ibmiSyncAvailable']&&_0x2e6c98['syncCredentials']==='prompt'));}const _0x943373=this['_el']('confirm-approve');_0x2e6c98['syncFirst']&&this['onSync']?(_0x943373&&(_0x943373['disabled']=!![],_0x943373['textContent']='Syncing...'),this['_performSync']()):_0x943373&&(_0x943373['disabled']=![],_0x943373['textContent']='Commit\x20Changes');_0x432125['hidden']=![];const _0x495966=++this['_attributionRequestId'];void this['_applyAttributionAsync']({'requestId':_0x495966,'taskId':_0x2e6c98['taskId'],'originalCommitMessage':_0x1bf4bd}),setTimeout(()=>{_0x4beb11['focus'](),_0x4beb11['setSelectionRange'](0x0,_0x4beb11['value']['length']);},0x64);}['updatePRSupport'](_0x127bd6){const _0x5e6bd1=this['_el']('pr-option-section'),_0x5de18d=this['_el']('create-pull-request'),_0x1a8c05=this['_el']('pr-hint'),_0xee59e0=this['_el']('push-after-commit'),_0x393926=this['_el']('create-new-branch');if(!_0x5e6bd1)return;if(_0x127bd6){_0x5e6bd1['hidden']=![];_0x5de18d&&!_0x5de18d['disabled']&&(_0x5de18d['checked']=![]);if(_0x1a8c05)_0x1a8c05['hidden']=!![];this['_createPR']=![];return;}_0x5de18d?.['checked']&&(_0x5de18d['checked']=![]);if(_0x1a8c05)_0x1a8c05['hidden']=!![];if(_0xee59e0)_0xee59e0['disabled']=![];if(_0x393926)_0x393926['disabled']=![];this['_createPR']=![],_0x5e6bd1['hidden']=!![];}async['_applyAttributionAsync']({requestId:_0x5ce70f,taskId:_0x46a1c3,originalCommitMessage:_0x59de2f}){const _0x586e52=this['_el']('commit-message-input');if(!_0x586e52)return;const _0x952766=await this['_addAttributionIfEnabled'](_0x59de2f);if(_0x5ce70f!==this['_attributionRequestId'])return;if(!this['taskData']||this['taskData']['taskId']!==_0x46a1c3)return;if(!this['isVisible']())return;const _0x16439e=_0x4aa084=>_0x4aa084['replace'](/\r\n/g,'\x0a')['replace'](/\r/g,'\x0a');if(_0x16439e(_0x586e52['value'])!==_0x16439e(_0x59de2f))return;_0x586e52['value']=_0x952766;}['_updateDisplay'](_0x231840,_0x99306b){const _0x43a241=this['_el']('approve-repo-name'),_0x437065=this['_el']('approve-stats'),_0x2071e4=this['_el']('multi-repo-note');if(_0x231840['length']===0x0){if(_0x43a241)_0x43a241['textContent']='Syncing...';if(_0x437065)_0x437065['textContent']='';if(_0x2071e4)_0x2071e4['hidden']=!![];return;}const _0x1397d9=_0x231840['reduce']((_0x1d4c44,_0x48fe8f)=>_0x1d4c44+(_0x48fe8f['files_changed']||0x0),0x0),_0xd591f5=_0x231840['reduce']((_0x17636a,_0x3ed1a4)=>_0x17636a+(_0x3ed1a4['lines_added']||0x0),0x0),_0xcfb320=_0x231840['reduce']((_0x1a49c1,_0x778983)=>_0x1a49c1+(_0x778983['lines_deleted']||0x0),0x0);if(_0x231840['length']===0x1){if(_0x43a241)_0x43a241['textContent']=_0x231840[0x0]?.['name']||'repository';if(_0x2071e4)_0x2071e4['hidden']=!![];}else{const _0x44f643=_0x231840['map'](_0xbe0346=>_0xbe0346['name'])['join'](',\x20');if(_0x43a241)_0x43a241['textContent']=_0x231840['length']+'\x20repositories:\x20'+_0x44f643;if(_0x2071e4)_0x2071e4['hidden']=![];}_0x437065&&(_0x437065['textContent']=_0x1397d9+'\x20file'+(_0x1397d9===0x1?'':'s')+'\x20changed\x20(+'+_0xd591f5+'\x20-'+_0xcfb320+')'),this['_displayBranchInfo'](_0x231840,_0x99306b?.['branches']||{});}async['_performSync'](){if(!this['onSync']||this['isSyncing'])return;this['isSyncing']=!![];const _0x22d3bc=this['_el']('confirm-approve');try{const _0x201a27=await this['onSync'](this['taskData']['taskId']);if(!this['isVisible']()){this['isSyncing']=![];return;}if(_0x201a27['repos_changed']){const _0x40b72d=this['taskData']['reposChanged']?.['length']||0x0,_0x2f7e9d=this['taskData']['reposChanged']?.['reduce']((_0x8b473f,_0x20e388)=>_0x8b473f+(_0x20e388['files_changed']||0x0),0x0)||0x0;this['taskData']['reposChanged']=_0x201a27['repos_changed'];if(_0x201a27['current_branches']){const _0x34e28e={...this['taskData']['branches']||{}};for(const [_0x2fd470,_0x2d091c]of Object['entries'](_0x201a27['current_branches'])){_0x2d091c?_0x34e28e[_0x2fd470]=_0x2d091c:delete _0x34e28e[_0x2fd470];}this['taskData']['branches']=_0x34e28e;}this['_updateDisplay'](_0x201a27['repos_changed'],this['taskData']);const _0x2bb726=_0x201a27['repos_changed']['length'],_0x2639b3=_0x201a27['repos_changed']['reduce']((_0x4a9e5a,_0x166ba3)=>_0x4a9e5a+(_0x166ba3['files_changed']||0x0),0x0);(_0x2639b3>_0x2f7e9d||_0x2bb726>_0x40b72d)&&(this['_transientWarning']='Additional\x20changes\x20detected\x20since\x20last\x20sync.\x20Review\x20the\x20updated\x20file\x20list.'),this['_refreshWarningBanner']();}_0x22d3bc&&(!this['taskData']['reposChanged']||this['taskData']['reposChanged']['length']===0x0?(_0x22d3bc['disabled']=!![],_0x22d3bc['textContent']='No\x20Changes',this['showError']('No\x20changes\x20to\x20approve\x20after\x20sync')):(_0x22d3bc['disabled']=![],_0x22d3bc['textContent']='Commit\x20Changes'));}catch(_0x4917e8){console['error']('Failed\x20to\x20sync\x20repos\x20before\x20approve:',_0x4917e8);if(!this['isVisible']()){this['isSyncing']=![];return;}this['showError']('Sync\x20failed:\x20'+_0x4917e8['message']+'.\x20You\x20can\x20still\x20commit\x20with\x20existing\x20staged\x20changes.'),_0x22d3bc&&(this['taskData']['reposChanged']&&this['taskData']['reposChanged']['length']>0x0?(_0x22d3bc['disabled']=![],_0x22d3bc['textContent']='Commit\x20Changes'):(_0x22d3bc['disabled']=!![],_0x22d3bc['textContent']='No\x20Changes'));}finally{this['isSyncing']=![];}}['hide'](){const _0x22879d=this['_el']('approve-modal');_0x22879d&&(_0x22879d['hidden']=!![]),this['_syncFileTree']&&(this['_syncFileTree']['destroy'](),this['_syncFileTree']=null),this['_syncRelativeFiles']=null,this['_syncAbsolutePaths']=null;}async['_handleApprove'](){const _0x29d2c8=this['_el']('commit-message-input'),_0x59b6ac=this['_el']('pull-before-commit'),_0x199c7e=this['_el']('push-after-commit'),_0x45c3a3=this['_el']('create-new-branch'),_0x304496=this['_el']('new-branch-name'),_0x45538f=this['_el']('confirm-approve'),_0x3d1e9b=_0x29d2c8['value']['trim'](),_0x5322d0=_0x59b6ac?.['checked']??!![],_0x97004=_0x199c7e?.['checked']??!![],_0x2456a6=_0x45c3a3?.['checked']||![],_0x4737cf=_0x304496?.['value']['trim']()||'';this['hideError']();if(!_0x3d1e9b){this['showError']('Commit\x20message\x20is\x20required'),_0x29d2c8['focus']();return;}if(_0x2456a6&&!_0x4737cf){this['showError']('Branch\x20name\x20is\x20required\x20when\x20creating\x20a\x20new\x20branch'),_0x304496?.['focus']();return;}if(_0x2456a6&&_0x4737cf){const _0x2c3289=/[\s~^:?*\[\\]/;if(_0x2c3289['test'](_0x4737cf)){this['showError']('Invalid\x20branch\x20name.\x20Avoid\x20spaces\x20and\x20special\x20characters\x20like\x20~\x20^\x20:\x20?\x20*\x20[\x20\x5c'),_0x304496?.['focus']();return;}}const _0x51944e=this['_el']('sync-to-ibmi')?.['checked'];if(_0x51944e){const _0x1af36c=this['_el']('ibmi-sync-library')?.['value']?.['trim']();if(!_0x1af36c){this['showError']('IBM\x20i\x20library\x20name\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-library')?.['focus']();return;}if(this['_syncFileTree']){const _0x5c39dc=this['_syncFileTree']['getSelectedFiles']();if(_0x5c39dc['length']===0x0){this['showError']('Select\x20at\x20least\x20one\x20file\x20to\x20sync');return;}}if(this['taskData']?.['syncCredentials']==='prompt'){const _0x1c2846=this['_el']('ibmi-sync-user')?.['value']?.['trim']();if(!_0x1c2846){this['showError']('User\x20profile\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-user')?.['focus']();return;}const _0x1f2ee9=this['_el']('ibmi-sync-password')?.['value'];if(!_0x1f2ee9){this['showError']('Password\x20is\x20required\x20for\x20sync'),this['_el']('ibmi-sync-password')?.['focus']();return;}}}const _0xd64b2f=_0x45538f?.['textContent']||'Commit\x20Changes';_0x45538f&&(_0x45538f['disabled']=!![],_0x2456a6?_0x45538f['textContent']='Creating\x20branch\x20&\x20committing...':_0x45538f['textContent']=_0x5322d0?'Pulling\x20&\x20Committing...':'Committing...');try{const _0x1f64e7={'commit_message':_0x3d1e9b,'pull':_0x5322d0,'push':_0x97004,'conflict_strategy':'rebase'};_0x2456a6&&_0x4737cf&&(_0x1f64e7['new_branch']=_0x4737cf);let _0xd5acb=null;this['onApprove']&&(_0xd5acb=await this['onApprove'](this['taskData']['taskId'],_0x1f64e7));let _0x8738aa='Changes\x20committed';if(_0x2456a6)_0x8738aa='Changes\x20committed\x20to\x20new\x20branch\x20\x27'+_0x4737cf+'\x27',_0x97004&&(_0x8738aa+='\x20and\x20pushed');else{if(_0x5322d0&&_0x97004)_0x8738aa='Changes\x20pulled,\x20committed,\x20and\x20pushed';else{if(_0x5322d0)_0x8738aa='Changes\x20pulled\x20and\x20committed';else _0x97004&&(_0x8738aa='Changes\x20committed\x20and\x20pushed');}}const _0x2e48ff=this['_el']('sync-to-ibmi')?.['checked'];let _0x488dc6=null,_0x3a3bed=null,_0x231886=null,_0xdeca41=null;if(_0x2e48ff&&this['onSyncToIbmi']){_0x488dc6=this['_el']('ibmi-sync-library')?.['value']?.['trim']()?.['toUpperCase'](),_0x3a3bed=this['_el']('ibmi-sync-user')?.['value']?.['trim']()?.['toUpperCase']()||null,_0x231886=this['_el']('ibmi-sync-password')?.['value']||null;if(this['_syncFileTree']&&this['_syncRelativeFiles']&&this['_syncAbsolutePaths']){const _0x186f71=this['_syncFileTree']['getSelectedFiles']();_0xdeca41=_0x186f71['map'](_0x21f8fc=>{const _0x335740=this['_syncRelativeFiles']['indexOf'](_0x21f8fc);return _0x335740>=0x0?this['_syncAbsolutePaths'][_0x335740]:_0x21f8fc;});}}this['showToast'](_0x8738aa,'success'),this['hide']();if(this['_createPR']&&this['onCreatePR'])try{await this['onCreatePR'](this['taskData']['taskId'],_0xd5acb||{});}catch(_0x26c82a){console['warn']('PR\x20creation\x20failed\x20or\x20cancelled:',_0x26c82a);}if(_0x2e48ff&&this['onSyncToIbmi']&&_0x488dc6){localStorage['setItem']('coderflow_ibmi_sync_library',_0x488dc6);if(_0x3a3bed)localStorage['setItem']('coderflow_ibmi_sync_user',_0x3a3bed);try{await this['onSyncToIbmi'](this['taskData']['taskId'],_0x488dc6,_0x3a3bed,_0x231886,_0xdeca41);}catch(_0x4b7b08){this['showToast']('Sync\x20failed:\x20'+_0x4b7b08['message'],'error');}}this['onSuccess']&&this['onSuccess'](this['taskData']);}catch(_0x4ec7e2){console['error']('Failed\x20to\x20approve\x20changes',_0x4ec7e2),_0x4ec7e2['hasConflicts']?this['_showConflictResolution']():this['showError']('Failed\x20to\x20commit:\x20'+_0x4ec7e2['message']),_0x45538f&&(_0x45538f['disabled']=![],_0x45538f['textContent']=_0xd64b2f),this['onError']&&this['onError'](_0x4ec7e2);}}['isVisible'](){const _0x1bbead=this['_el']('approve-modal');return _0x1bbead&&!_0x1bbead['hidden'];}['destroy'](){const _0x52d33d=this['_el']('approve-modal');_0x52d33d&&_0x52d33d['remove'](),this['initialized']=![];}}export function getApproveState(_0x3bb6d2,_0x31cbe1){if(!_0x3bb6d2)return{'canApprove':![],'reason':'No\x20task\x20data'};if(isLogOnlyTaskType(_0x3bb6d2['taskType']))return{'canApprove':![],'reason':(_0x3bb6d2['taskType']==='test'?'Test':'Deploy')+'\x20tasks\x20cannot\x20be\x20approved'};const _0x259df3=_0x31cbe1?.['repos_changed']?.['length']>0x0,_0x2dab75=_0x3bb6d2['status']==='completed'||_0x3bb6d2['status']==='failed'||_0x3bb6d2['status']==='interrupted',_0x1876f9=_0x3bb6d2['containerState']==='running',_0x38aac1=_0x3bb6d2['approvedBy']!==undefined&&_0x3bb6d2['approvedBy']!==null;if(_0x38aac1){const _0x59c75f=_0x3bb6d2['approvedBy']['name']||_0x3bb6d2['approvedBy']['username']||'user';return{'canApprove':![],'reason':'Already\x20approved\x20by\x20'+_0x59c75f};}if(!_0x259df3)return{'canApprove':![],'reason':'No\x20changes\x20to\x20approve'};if(!_0x2dab75)return{'canApprove':![],'reason':'Task\x20must\x20complete\x20first'};if(!_0x3bb6d2['containerId'])return{'canApprove':![],'reason':'Container\x20no\x20longer\x20available'};if(!_0x1876f9)return{'canApprove':![],'reason':'Container\x20is\x20not\x20running'};return{'canApprove':!![],'reason':'Ready\x20to\x20approve'};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function buildAutomationEnvironmentHref(
|
|
1
|
+
export function buildAutomationEnvironmentHref(_0x5ec373,_0x2b32d7){const _0x5dd185=new URLSearchParams();_0x5ec373&&_0x5dd185['set']('env',String(_0x5ec373));_0x5dd185['set']('tab','automations');_0x2b32d7&&_0x5dd185['set']('automation',String(_0x2b32d7));const _0xa0f4ca=_0x5dd185['toString']();return'environments.html'+(_0xa0f4ca?'?'+_0xa0f4ca:'');}export function buildAutomationTaskFilterHref(_0x2b025f){const _0x5bf4c2=new URLSearchParams();_0x2b025f&&_0x5bf4c2['set']('automation',String(_0x2b025f));const _0x54abb0=_0x5bf4c2['toString']();return'index.html'+(_0x54abb0?'?'+_0x54abb0:'');}export function parseAutomationDeepLinkParams(_0x4f5420=''){const _0xf7da58=new URLSearchParams(_0x4f5420||'');return{'env':_0xf7da58['get']('env'),'tab':_0xf7da58['get']('tab'),'automation':_0xf7da58['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(_0x53432c,_0x18bd66,_0x22850e){const _0x17b26e=Number['parseInt'](_0x53432c,0xa);if(!Number['isInteger'](_0x17b26e)||_0x17b26e<_0x18bd66||_0x17b26e>_0x22850e)return null;return _0x17b26e;}function inferRecurringInterval(_0x523960,_0x110b0d){if(_0x523960==='*/15')return'*/15\x20*\x20*\x20*\x20*';if(_0x523960==='*/30')return'*/30\x20*\x20*\x20*\x20*';if(_0x523960!=='0')return'*/30\x20*\x20*\x20*\x20*';if(_0x110b0d==='*'||/^\d{1,2}-\d{1,2}$/['test'](_0x110b0d))return'0\x20*\x20*\x20*\x20*';for(const _0x2ab348 of RECURRING_INTERVAL_STEPS){if(_0x110b0d['startsWith']('*/'+_0x2ab348)||_0x110b0d['includes']('/'+_0x2ab348))return'0\x20*/'+_0x2ab348+'\x20*\x20*\x20*';}return'*/30\x20*\x20*\x20*\x20*';}function parseRecurringHourRange(_0x40cb4e){const _0x20fb05=String(_0x40cb4e||'')['trim']()['match'](/^(\d{1,2})-(\d{1,2})(?:\/\d+)?$/);if(!_0x20fb05)return{'start':'','end':''};const _0x522283=parseBoundedInteger(_0x20fb05[0x1],0x0,0x17),_0x4b150e=parseBoundedInteger(_0x20fb05[0x2],0x0,0x17);if(_0x522283===null||_0x4b150e===null||_0x522283>_0x4b150e)return{'start':'','end':''};return{'start':String(_0x522283),'end':String(_0x4b150e)};}export function parseAutomationScheduleToFormState(_0x9bd553){const _0x51ad4c=String(_0x9bd553||'')['trim'](),_0x436ffd=createDefaultScheduleFormState(),_0x434082=_0x51ad4c['match'](/^(\d{1,2}) (\d{1,2}) \* \* \*$/);if(_0x434082){const _0xa49236=parseBoundedInteger(_0x434082[0x1],0x0,0x3b),_0xff4e25=parseBoundedInteger(_0x434082[0x2],0x0,0x17);if(_0xa49236!==null&&_0xff4e25!==null)return _0x436ffd['frequency']='daily',_0x436ffd['dailyMinute']=String(_0xa49236),_0x436ffd['dailyHour']=String(_0xff4e25),_0x436ffd;}const _0x1a2180=_0x51ad4c['match'](/^(\d{1,2}) (\d{1,2}) \* \* ([0-7])$/);if(_0x1a2180){const _0x20b1f4=parseBoundedInteger(_0x1a2180[0x1],0x0,0x3b),_0x368f63=parseBoundedInteger(_0x1a2180[0x2],0x0,0x17),_0x1892b4=parseBoundedInteger(_0x1a2180[0x3],0x0,0x7);if(_0x20b1f4!==null&&_0x368f63!==null&&_0x1892b4!==null)return _0x436ffd['frequency']='weekly',_0x436ffd['weeklyMinute']=String(_0x20b1f4),_0x436ffd['weeklyHour']=String(_0x368f63),_0x436ffd['weeklyDay']=String(_0x1892b4===0x7?0x0:_0x1892b4),_0x436ffd;}const _0x3bdeb7=_0x51ad4c['match'](/^(\d{1,2}) (\d{1,2}) (\d{1,2}) \* \*$/);if(_0x3bdeb7){const _0x38438a=parseBoundedInteger(_0x3bdeb7[0x1],0x0,0x3b),_0x46b9fe=parseBoundedInteger(_0x3bdeb7[0x2],0x0,0x17),_0x2e0369=parseBoundedInteger(_0x3bdeb7[0x3],AUTOMATION_MONTHLY_DAY_MIN,AUTOMATION_MONTHLY_DAY_MAX);if(_0x38438a!==null&&_0x46b9fe!==null&&_0x2e0369!==null)return _0x436ffd['frequency']='monthly',_0x436ffd['monthlyMinute']=String(_0x38438a),_0x436ffd['monthlyHour']=String(_0x46b9fe),_0x436ffd['monthlyDay']=String(_0x2e0369),_0x436ffd;}const _0x4ddedf=_0x51ad4c['match'](/^(\*\/15|\*\/30|0) ([^\s]+) \* \* ([^\s]+)$/);if(_0x4ddedf){const [,_0x4a53e7,_0x3d7377,_0x10da33]=_0x4ddedf;_0x436ffd['frequency']='recurring',_0x436ffd['recurringInterval']=inferRecurringInterval(_0x4a53e7,_0x3d7377),_0x436ffd['recurringDayToken']=String(_0x10da33||'')['trim']()||'*';const _0x5233e7=parseRecurringHourRange(_0x3d7377);return _0x436ffd['recurringStartHour']=_0x5233e7['start'],_0x436ffd['recurringEndHour']=_0x5233e7['end'],_0x436ffd;}return _0x436ffd['frequency']='custom',_0x436ffd['customCron']=_0x51ad4c,_0x436ffd;}export function buildAutomationCronFromFormState(_0x3c525e={}){const _0x156cac=String(_0x3c525e['frequency']||'daily');if(_0x156cac==='custom')return String(_0x3c525e['customCron']||'')['trim']();if(_0x156cac==='daily'){const _0x48fbcd=String(_0x3c525e['dailyHour']??'2'),_0x32f991=String(_0x3c525e['dailyMinute']??'0');return _0x32f991+'\x20'+_0x48fbcd+'\x20*\x20*\x20*';}if(_0x156cac==='weekly'){const _0x42eefa=String(_0x3c525e['weeklyDay']??'1'),_0x392980=String(_0x3c525e['weeklyHour']??'9'),_0x48a664=String(_0x3c525e['weeklyMinute']??'0');return _0x48a664+'\x20'+_0x392980+'\x20*\x20*\x20'+_0x42eefa;}if(_0x156cac==='monthly'){const _0x1a26a2=String(_0x3c525e['monthlyDay']??'1'),_0x2f0faa=String(_0x3c525e['monthlyHour']??'0'),_0x55a344=String(_0x3c525e['monthlyMinute']??'0');return _0x55a344+'\x20'+_0x2f0faa+'\x20'+_0x1a26a2+'\x20*\x20*';}const _0x1dcb54=String(_0x3c525e['recurringInterval']||'*/30\x20*\x20*\x20*\x20*')['trim'](),[_0x5197c2='*/30',_0x1f3cac='*']=_0x1dcb54['split'](/\s+/);let _0xfa5758=_0x1f3cac;const _0x42eaee=String(_0x3c525e['recurringStartHour']??'')['trim'](),_0x370203=String(_0x3c525e['recurringEndHour']??'')['trim']();if(_0x42eaee!==''&&_0x370203!==''){const _0x4ccb02=Number['parseInt'](_0x42eaee,0xa),_0x40891f=Number['parseInt'](_0x370203,0xa);if(Number['isInteger'](_0x4ccb02)&&Number['isInteger'](_0x40891f)&&_0x4ccb02<=_0x40891f){const _0x209d9=_0x1f3cac['match'](/^\*\/(\d+)$/);_0x209d9?_0xfa5758=_0x4ccb02+'-'+_0x40891f+'/'+_0x209d9[0x1]:_0xfa5758=_0x4ccb02+'-'+_0x40891f;}}const _0xd6b257=String(_0x3c525e['recurringDayToken']??'*')['trim']()||'*';return _0x5197c2+'\x20'+_0xfa5758+'\x20*\x20*\x20'+_0xd6b257;}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
export class CommentsWidget{constructor(_0xf29b08,_0x37aee8={}){this['container']=_0xf29b08,this['options']={'taskId':_0x37aee8['taskId']||null,'currentUserId':_0x37aee8['currentUserId']||null,'compact':_0x37aee8['compact']||![],'skipHeader':_0x37aee8['skipHeader']||![],'onCommentsLoaded':_0x37aee8['onCommentsLoaded']||null,'onCommentsChanged':_0x37aee8['onCommentsChanged']||null,'enableAttachments':_0x37aee8['enableAttachments']||![],'getAPI':_0x37aee8['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 _0x27c329=this['options']['getAPI'](),_0x376387=await _0x27c329['getTaskAttachments'](this['options']['taskId']);this['existingAttachments']=_0x376387['attachments']||[];}catch(_0x15af5c){console['warn']('Failed\x20to\x20load\x20existing\x20attachments:',_0x15af5c),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 _0x41727e=this['header']['querySelector']('.comments-toggle-btn');_0x41727e['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 _0x396784=document['createElement']('div');_0x396784['className']='comments-editor-wrapper',this['toolbar']=document['createElement']('div'),this['toolbar']['className']='comments-toolbar\x20comments-toolbar-hidden',_0x396784['appendChild'](this['toolbar']);const _0xa01176=document['createElement']('div');_0xa01176['className']='comments-editor-placeholder',_0x396784['appendChild'](_0xa01176);const _0x2bb79f=document['createElement']('div');_0x2bb79f['className']='comments-input-actions',_0x2bb79f['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'](_0x396784),this['inputSection']['appendChild'](_0x2bb79f),this['container']['appendChild'](this['inputSection']),this['initEditor'](_0xa01176),this['submitBtn']=_0x2bb79f['querySelector']('.comments-submit-btn'),this['cancelBtn']=_0x2bb79f['querySelector']('.comments-cancel-btn'),this['submitBtn']['addEventListener']('click',()=>this['handleSubmit']()),this['cancelBtn']['addEventListener']('click',()=>this['cancelEdit']());}['initEditor'](_0x43162e){const _0x3ebc58=document['createElement']('textarea');_0x3ebc58['placeholder']='Add\x20a\x20comment...',_0x3ebc58['className']='comments-textarea',_0x43162e['appendChild'](_0x3ebc58);const _0x4fc2a8=window['MarkdownEditor'];if(!_0x4fc2a8){console['error']('MarkdownEditor\x20not\x20loaded');return;}const _0x12030e={'placeholder':'Add\x20a\x20comment...','editable':!![],'toolbar':!![],'minHeight':this['options']['compact']?'60px':'80px','onChange':_0x5208f1=>{const _0x5be247=_0x5208f1&&_0x5208f1['trim']()['length']>0x0||this['pendingAttachments']['length']>0x0;this['submitBtn']['disabled']=!_0x5be247;},'fetchUsers':async()=>{const _0x3b9e5c=this['options']['getAPI']();return _0x3b9e5c['getUsers']();}};this['options']['enableAttachments']&&this['options']['taskId']&&(_0x12030e['onAddAttachments']=_0x5c27cb=>{this['pendingAttachments']['push'](..._0x5c27cb),this['submitBtn']['disabled']=![];},_0x12030e['resolveAttachmentUrl']=_0x5e0b37=>{const _0x263e9c=this['options']['getAPI']();return _0x263e9c['getBaseUrl']()+'/tasks/'+this['options']['taskId']+'/attachments/'+encodeURIComponent(_0x5e0b37);},_0x12030e['isAttachmentNameTaken']=_0x3f0289=>{return this['pendingAttachments']['some'](_0x1de7d5=>_0x1de7d5['name']===_0x3f0289)||this['existingAttachments']['some'](_0x58190f=>_0x58190f['name']===_0x3f0289);});this['editor']=new _0x4fc2a8(_0x3ebc58,_0x12030e);const _0x3d9633=this['editor']['editor'],_0x3aff14=this['editor']['toolbar'];_0x3aff14&&(_0x3aff14['classList']['add']('comments-toolbar-hidden'),_0x3d9633['addEventListener']('focus',()=>{_0x3aff14['classList']['remove']('comments-toolbar-hidden');}),_0x3d9633['addEventListener']('blur',_0x547a08=>{setTimeout(()=>{!this['editor']['container']?.['contains'](document['activeElement'])&&!_0x3aff14['contains'](document['activeElement'])&&(!this['editor']['getValue']()?.['trim']()&&!this['editingCommentId']&&_0x3aff14['classList']['add']('comments-toolbar-hidden'));},0x64);}));}['toggleExpanded'](){this['isExpanded']=!this['isExpanded'],this['commentsListWrapper']['hidden']=!this['isExpanded'],this['inputSection']['hidden']=!this['isExpanded'];const _0x1f0ccb=this['header']['querySelector']('.comments-chevron');_0x1f0ccb&&(_0x1f0ccb['style']['transform']=this['isExpanded']?'rotate(180deg)':''),this['isExpanded']&&this['comments']['length']===0x0&&this['options']['taskId']&&this['loadComments']();}['setTaskId'](_0x3ade6c){this['options']['taskId']=_0x3ade6c,this['comments']=[],this['renderComments'](),_0x3ade6c&&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 _0xdf0701=this['options']['getAPI'](),_0xe6e0e8=await _0xdf0701['getComments'](this['options']['taskId']);this['comments']=_0xe6e0e8['comments']||[],this['renderComments'](),this['updateCount'](),this['options']['onCommentsLoaded']&&this['options']['onCommentsLoaded'](this['comments']);}catch(_0x5ee26f){console['error']('Failed\x20to\x20load\x20comments:',_0x5ee26f),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'](_0x59ff06=>{const _0x45eb69=this['createCommentElement'](_0x59ff06);this['commentsList']['appendChild'](_0x45eb69);});}['createCommentElement'](_0x58543f){const _0x1d13ee=document['createElement']('div');_0x1d13ee['className']='comment-item',_0x1d13ee['dataset']['commentId']=_0x58543f['id'];const _0x565838=this['options']['currentUserId']&&_0x58543f['author']?.['userId']===this['options']['currentUserId'],_0x2c7469=this['formatDate'](_0x58543f['createdAt']),_0xd81d56=_0x58543f['updatedAt']!==_0x58543f['createdAt'],_0x6b72a7=this['resolveAttachmentUrls'](_0x58543f['content']);let _0x3610c2=window['marked']?window['marked']['parse'](_0x6b72a7):_0x6b72a7;_0x3610c2=this['renderMentions'](_0x3610c2),_0x1d13ee['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'](_0x58543f['author']?.['name']||'Anonymous')+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22comment-timestamp\x22\x20title=\x22'+new Date(_0x58543f['createdAt'])['toLocaleString']()+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x2c7469+(_0xd81d56?'\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'+(_0x565838?'\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>'+_0x3610c2+'</div>\x0a\x20\x20\x20\x20';if(_0x565838){const _0x1daabb=_0x1d13ee['querySelector']('.comment-edit-btn'),_0x5f00a6=_0x1d13ee['querySelector']('.comment-delete-btn');_0x1daabb?.['addEventListener']('click',()=>this['startEdit'](_0x58543f)),_0x5f00a6?.['addEventListener']('click',()=>this['deleteComment'](_0x58543f['id']));}return _0x1d13ee;}['formatDate'](_0x452a74){const _0xab90f3=new Date(_0x452a74),_0x2d0b3c=new Date(),_0x411bf1=_0x2d0b3c-_0xab90f3,_0x5d529c=Math['floor'](_0x411bf1/0xea60),_0xd2f5f6=Math['floor'](_0x411bf1/0x36ee80),_0x8ffa4a=Math['floor'](_0x411bf1/0x5265c00);if(_0x5d529c<0x1)return'just\x20now';if(_0x5d529c<0x3c)return _0x5d529c+'m\x20ago';if(_0xd2f5f6<0x18)return _0xd2f5f6+'h\x20ago';if(_0x8ffa4a<0x7)return _0x8ffa4a+'d\x20ago';return _0xab90f3['toLocaleDateString']();}['escapeHtml'](_0x6362d6){const _0x5268bb=document['createElement']('div');return _0x5268bb['textContent']=_0x6362d6,_0x5268bb['innerHTML'];}['resolveAttachmentUrls'](_0x51b028){if(!_0x51b028||!this['options']['taskId'])return _0x51b028;const _0xbf537d=this['options']['getAPI'](),_0x3f0284=_0xbf537d['getBaseUrl']();let _0x2464e4=String(_0x51b028)['replace'](/\]\(attachment:(?:\/\/)?([^)]+)\)/g,(_0x4c27cc,_0x1887ef)=>{const _0x3ac0f6=String(_0x1887ef||'')['trim']();if(!_0x3ac0f6)return _0x4c27cc;let _0x362d17=_0x3ac0f6;try{_0x362d17=decodeURIComponent(_0x3ac0f6);}catch{}return']('+_0x3f0284+'/tasks/'+this['options']['taskId']+'/attachments/'+encodeURIComponent(_0x362d17)+')';});return _0x2464e4;}['renderMentions'](_0x363d24){if(!_0x363d24)return _0x363d24;return String(_0x363d24)['replace'](/@?<a\s+href="mention:([^"]+)"[^>]*>([^<]+)<\/a>/g,(_0x52e562,_0x2f0dd1,_0x3a0394)=>{const _0x1e6c94=this['escapeHtml'](_0x3a0394),_0x47185b=this['escapeHtml'](_0x2f0dd1);return'<span\x20class=\x22mention\x22\x20data-mention-user-id=\x22'+_0x47185b+'\x22>@'+_0x1e6c94+'</span>';});}['startEdit'](_0x2d2be7){this['editingCommentId']=_0x2d2be7['id'],this['editor']['setValue'](_0x2d2be7['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 _0x4bb334=this['editor']['getValue']()?.['trim']();if(!_0x4bb334&&this['pendingAttachments']['length']===0x0||!this['options']['taskId'])return;this['setLoading'](!![]);try{const _0x1a75e1=this['options']['getAPI']();this['pendingAttachments']['length']>0x0&&this['options']['enableAttachments']&&(await _0x1a75e1['uploadAttachments'](this['options']['taskId'],this['pendingAttachments']),this['existingAttachments']['push'](...this['pendingAttachments']['map'](_0x3a4863=>({'name':_0x3a4863['name']}))),this['pendingAttachments']=[]);if(this['editingCommentId']){const _0x4829b7=await _0x1a75e1['updateComment'](this['options']['taskId'],this['editingCommentId'],_0x4bb334),_0x47d05b=this['comments']['findIndex'](_0x5eae49=>_0x5eae49['id']===this['editingCommentId']);_0x47d05b!==-0x1&&(this['comments'][_0x47d05b]=_0x4829b7['comment']);}else{const _0x575ff1=await _0x1a75e1['addComment'](this['options']['taskId'],_0x4bb334);this['comments']['push'](_0x575ff1['comment']);}this['renderComments'](),this['updateCount'](),this['cancelEdit'](),this['editor']['clear']();}catch(_0x4836b4){console['error']('Failed\x20to\x20save\x20comment:',_0x4836b4),alert('Failed\x20to\x20save\x20comment:\x20'+_0x4836b4['message']);}finally{this['setLoading'](![]);}}async['deleteComment'](_0x20280d){const _0x37c4aa=await this['showDeleteConfirmModal']();if(!_0x37c4aa)return;try{const _0x14b3d0=this['options']['getAPI']();await _0x14b3d0['deleteComment'](this['options']['taskId'],_0x20280d),this['comments']=this['comments']['filter'](_0x3b6a7b=>_0x3b6a7b['id']!==_0x20280d),this['renderComments'](),this['updateCount']();}catch(_0x550c99){console['error']('Failed\x20to\x20delete\x20comment:',_0x550c99),alert('Failed\x20to\x20delete\x20comment:\x20'+_0x550c99['message']);}}['showDeleteConfirmModal'](){return new Promise(_0x22ae3=>{const _0x3c422f=document['createElement']('div');_0x3c422f['className']='comments-confirm-modal',_0x3c422f['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'](_0x3c422f);const _0x3a5239=_0x382978=>{document['removeEventListener']('keydown',_0x1a6ee4),_0x3c422f['remove'](),_0x22ae3(_0x382978);},_0x1a6ee4=_0x524684=>{if(_0x524684['key']==='Escape')_0x3a5239(![]);};document['addEventListener']('keydown',_0x1a6ee4),_0x3c422f['querySelector']('.comments-confirm-backdrop')['addEventListener']('click',()=>_0x3a5239(![])),_0x3c422f['querySelector']('.comments-confirm-close')['addEventListener']('click',()=>_0x3a5239(![])),_0x3c422f['querySelector']('.comments-confirm-cancel')['addEventListener']('click',()=>_0x3a5239(![])),_0x3c422f['querySelector']('.comments-confirm-delete')['addEventListener']('click',()=>_0x3a5239(!![])),_0x3c422f['querySelector']('.comments-confirm-cancel')['focus']();});}['setLoading'](_0x413c6f){this['submitBtn']['disabled']=_0x413c6f,this['submitBtn']['querySelector']('.btn-text')['hidden']=_0x413c6f,this['submitBtn']['querySelector']('.btn-loading')['hidden']=!_0x413c6f;}['updateCount'](){const _0x27f471=this['comments']['length'],_0x3fa86f=this['container']['querySelector']('#comments-count-badge');_0x3fa86f&&(_0x3fa86f['textContent']=_0x27f471,_0x3fa86f['hidden']=_0x27f471===0x0);const _0x211123=this['container']['querySelector']('#comments-count');_0x211123&&(_0x211123['textContent']=_0x27f471>0x0?'('+_0x27f471+')':''),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(_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']('');}
|
|
1
|
+
import{Utils}from'./app.js';export function parsePatchContent(_0x2e4d96){const _0x148ff2=[],_0x5a63ea=_0x2e4d96['split']('\x0a');let _0x441822=null,_0x50a74a=null;for(const _0x480fe2 of _0x5a63ea){if(_0x480fe2['startsWith']('diff\x20--git')){_0x441822&&_0x50a74a&&_0x441822['hunks']['push'](_0x50a74a);_0x441822&&_0x148ff2['push'](_0x441822);const _0x324862=_0x480fe2['match'](/diff --git a\/(.+?) b\/(.+)/);_0x441822={'oldPath':_0x324862?_0x324862[0x1]:'','newPath':_0x324862?_0x324862[0x2]:'','hunks':[],'isDeleted':![]},_0x50a74a=null;}else{if(_0x480fe2['startsWith']('deleted\x20file\x20mode')&&_0x441822)_0x441822['isDeleted']=!![];else{if(_0x480fe2['startsWith']('@@'))_0x50a74a&&_0x441822&&_0x441822['hunks']['push'](_0x50a74a),_0x50a74a={'header':_0x480fe2,'lines':[]};else _0x50a74a&&_0x50a74a['lines']['push'](_0x480fe2);}}}return _0x441822&&_0x50a74a&&_0x441822['hunks']['push'](_0x50a74a),_0x441822&&_0x148ff2['push'](_0x441822),_0x148ff2;}export function parseHunkHeader(_0x3c9c0f){const _0x59bfee=_0x3c9c0f['match'](/@@ -(\d+),?\d* \+(\d+),?\d* @@/);if(_0x59bfee)return{'oldStart':parseInt(_0x59bfee[0x1],0xa),'newStart':parseInt(_0x59bfee[0x2],0xa)};return{'oldStart':0x1,'newStart':0x1};}export function highlightDiffLine(_0x4b9bc5,_0x26b215){const _0x22b655=window['hljs']||(typeof hljs!=='undefined'?hljs:null);if(_0x22b655&&_0x26b215)try{const _0x3f2ae4=_0x22b655['getLanguage'](_0x26b215)?_0x26b215:null;if(_0x3f2ae4)return _0x22b655['highlight'](_0x4b9bc5,{'language':_0x3f2ae4})['value'];}catch(_0x51c3fc){console['error']('Diff\x20syntax\x20highlighting\x20error:',_0x51c3fc);}return Utils['escapeHtml'](_0x4b9bc5);}export function getFileLanguage(_0x1056bc){const _0x1a065f=_0x1056bc['split']('.')['pop']()['toLowerCase'](),_0x435770={'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 _0x435770[_0x1a065f]||null;}export function computeWordDiff(_0x22b76b,_0x17576c){const _0x1423e2=_0x16256f=>{const _0x43bee7=[];let _0x32e369='',_0x50f469=![];for(let _0x31757a=0x0;_0x31757a<_0x16256f['length'];_0x31757a++){const _0x593d6b=_0x16256f[_0x31757a],_0xe6927c=/\s/['test'](_0x593d6b);if(_0x32e369==='')_0x32e369=_0x593d6b,_0x50f469=_0xe6927c;else _0xe6927c===_0x50f469?_0x32e369+=_0x593d6b:(_0x43bee7['push'](_0x32e369),_0x32e369=_0x593d6b,_0x50f469=_0xe6927c);}return _0x32e369&&_0x43bee7['push'](_0x32e369),_0x43bee7;},_0xf54268=_0x1423e2(_0x22b76b),_0x472996=_0x1423e2(_0x17576c),_0x118047=_0xf54268['length'],_0x21018e=_0x472996['length'],_0x20f53e=Array(_0x118047+0x1)['fill'](null)['map'](()=>Array(_0x21018e+0x1)['fill'](0x0));for(let _0x1a79c5=0x1;_0x1a79c5<=_0x118047;_0x1a79c5++){for(let _0x17fd99=0x1;_0x17fd99<=_0x21018e;_0x17fd99++){_0xf54268[_0x1a79c5-0x1]===_0x472996[_0x17fd99-0x1]?_0x20f53e[_0x1a79c5][_0x17fd99]=_0x20f53e[_0x1a79c5-0x1][_0x17fd99-0x1]+0x1:_0x20f53e[_0x1a79c5][_0x17fd99]=Math['max'](_0x20f53e[_0x1a79c5-0x1][_0x17fd99],_0x20f53e[_0x1a79c5][_0x17fd99-0x1]);}}const _0x51d6b9={'old':[],'new':[]};let _0xc48ec0=_0x118047,_0x960377=_0x21018e;const _0x49ab55=[],_0x59a707=[];while(_0xc48ec0>0x0||_0x960377>0x0){if(_0xc48ec0>0x0&&_0x960377>0x0&&_0xf54268[_0xc48ec0-0x1]===_0x472996[_0x960377-0x1])_0x49ab55['unshift']({'type':'equal','text':_0xf54268[_0xc48ec0-0x1]}),_0x59a707['unshift']({'type':'equal','text':_0x472996[_0x960377-0x1]}),_0xc48ec0--,_0x960377--;else{if(_0x960377>0x0&&(_0xc48ec0===0x0||_0x20f53e[_0xc48ec0][_0x960377-0x1]>=_0x20f53e[_0xc48ec0-0x1][_0x960377]))_0x59a707['unshift']({'type':'insert','text':_0x472996[_0x960377-0x1]}),_0x960377--;else _0xc48ec0>0x0&&(_0x49ab55['unshift']({'type':'delete','text':_0xf54268[_0xc48ec0-0x1]}),_0xc48ec0--);}}return _0x51d6b9['old']=_0x49ab55,_0x51d6b9['new']=_0x59a707,_0x51d6b9;}export function renderDiffLineWithWordHighlight(_0x2aeaef,_0x33a66a,_0x5669be,_0x112103){if(!_0x33a66a||_0x33a66a['length']===0x0)return highlightDiffLine(_0x2aeaef,_0x112103);let _0xb45600='';const _0x41f42d=_0x5669be==='add'?'diff-word-add':'diff-word-remove',_0x32ea5e=_0x5669be==='add'?'insert':'delete';for(const _0x17ffd5 of _0x33a66a){const _0x3f78f3=Utils['escapeHtml'](_0x17ffd5['text']);_0x17ffd5['type']===_0x32ea5e?_0xb45600+='<span\x20class=\x22'+_0x41f42d+'\x22>'+_0x3f78f3+'</span>':_0xb45600+=_0x3f78f3;}return _0xb45600;}export function calculateDiffStats(_0xe8db8e){let _0x58e6db=0x0,_0x3e6793=0x0,_0x16b03b=0x0;return _0xe8db8e['forEach'](_0xb3c45d=>{let _0x67dc92=0x0,_0x4bb977=0x0;_0xb3c45d['hunks']['forEach'](_0x5cfabe=>{_0x5cfabe['lines']['forEach'](_0x4c4ef1=>{if(_0x4c4ef1['startsWith']('+'))_0x67dc92+=0x1;else{if(_0x4c4ef1['startsWith']('-'))_0x4bb977+=0x1;}});}),(_0x67dc92+_0x4bb977>0x0||_0xb3c45d['isDeleted'])&&(_0x16b03b+=0x1),_0x58e6db+=_0x67dc92,_0x3e6793+=_0x4bb977;}),{'additions':_0x58e6db,'deletions':_0x3e6793,'files':_0x16b03b};}export function getFileStatus(_0xd29ea3,_0x503793,_0xe59016){if(_0xd29ea3['isDeleted'])return'deleted';if(_0x503793>0x0&&_0xe59016===0x0)return'added';return'modified';}export function safeBase64(_0x4fbcbb){try{return btoa(unescape(encodeURIComponent(_0x4fbcbb)));}catch(_0x25f2f7){return btoa(_0x4fbcbb);}}export function getStorageKey(_0x3b4857,_0x2fbc26){return _0x3b4857+'-'+safeBase64(_0x2fbc26);}export function getCollapsedState(_0x947670,_0x2514e0){const _0xed723d=localStorage['getItem'](getStorageKey(_0x947670,_0x2514e0));return _0xed723d==='true';}export function renderUnifiedDiff(_0x192e14,_0x2d0abb){return _0x192e14['map']((_0x190f51,_0x4cd75a)=>{const _0x20173a=_0x190f51['newPath']||_0x190f51['oldPath']||'unknown',_0x9d1021='diff-'+_0x2d0abb+'-'+_0x4cd75a,_0x4beede=getFileLanguage(_0x20173a),{additions:_0x33af69,deletions:_0x29f48b}=calculateDiffStats([_0x190f51]),_0x41e8c8=getCollapsedState(_0x2d0abb,_0x20173a),_0x54c872=getFileStatus(_0x190f51,_0x33af69,_0x29f48b),_0x14cc31=_0x54c872==='added'?'A':_0x54c872==='deleted'?'D':'M',_0x5e1446=_0x190f51['hunks']['map'](_0x2f2890=>{const {oldStart:_0x388479,newStart:_0x1cedf5}=parseHunkHeader(_0x2f2890['header']);let _0xb76183=_0x388479,_0x559669=_0x1cedf5;const _0x30289a=_0x2f2890['lines']['map'](_0x1c8c61=>({'line':_0x1c8c61,'type':_0x1c8c61['startsWith']('+')?'add':_0x1c8c61['startsWith']('-')?'remove':_0x1c8c61['startsWith']('\x5c')?'meta':'context'}));let _0x323252=0x0;while(_0x323252<_0x30289a['length']){if(_0x30289a[_0x323252]['type']==='remove'){let _0x22cbc2=_0x323252,_0x59713d=_0x323252;while(_0x59713d<_0x30289a['length']&&_0x30289a[_0x59713d]['type']==='remove')_0x59713d++;let _0x2829bd=_0x59713d,_0xe66ddd=_0x2829bd;while(_0xe66ddd<_0x30289a['length']&&_0x30289a[_0xe66ddd]['type']==='add')_0xe66ddd++;const _0x5e34c1=_0x59713d-_0x22cbc2,_0x58e25f=_0xe66ddd-_0x2829bd,_0x3f4cc1=Math['min'](_0x5e34c1,_0x58e25f);for(let _0x16d0d8=0x0;_0x16d0d8<_0x3f4cc1;_0x16d0d8++){const _0x285487=_0x30289a[_0x22cbc2+_0x16d0d8]['line']['substring'](0x1),_0x44c427=_0x30289a[_0x2829bd+_0x16d0d8]['line']['substring'](0x1),_0x5651ab=computeWordDiff(_0x285487,_0x44c427);_0x30289a[_0x22cbc2+_0x16d0d8]['wordDiff']=_0x5651ab['old'],_0x30289a[_0x2829bd+_0x16d0d8]['wordDiff']=_0x5651ab['new'];}_0x323252=_0xe66ddd;}else _0x323252++;}const _0x36d9e4=_0x30289a['map'](_0x4ec4da=>{const _0x55b34a=_0x4ec4da['line'];if(_0x55b34a['startsWith']('+')){const _0x5a01c4=_0x55b34a['substring'](0x1),_0x44a2c8=_0x4ec4da['wordDiff']?renderDiffLineWithWordHighlight(_0x5a01c4,_0x4ec4da['wordDiff'],'add',_0x4beede):highlightDiffLine(_0x5a01c4,_0x4beede),_0x328f34='<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>'+_0x559669+'</span><span\x20class=\x22diff-line-content\x22><span\x20class=\x22diff-prefix\x22>+</span>'+_0x44a2c8+'</span></div>';return _0x559669+=0x1,_0x328f34;}if(_0x55b34a['startsWith']('-')){const _0x30dc03=_0x55b34a['substring'](0x1),_0x38ddff=_0x4ec4da['wordDiff']?renderDiffLineWithWordHighlight(_0x30dc03,_0x4ec4da['wordDiff'],'remove',_0x4beede):highlightDiffLine(_0x30dc03,_0x4beede),_0x377d67='<div\x20class=\x22diff-line\x20diff-remove\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22>'+_0xb76183+'</span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22></span><span\x20class=\x22diff-line-content\x22><span\x20class=\x22diff-prefix\x22>-</span>'+_0x38ddff+'</span></div>';return _0xb76183+=0x1,_0x377d67;}if(_0x55b34a['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'](_0x55b34a)+'</span></div>';const _0x147c7b=_0x55b34a['startsWith']('\x20')?_0x55b34a['substring'](0x1):_0x55b34a,_0x689ff2=highlightDiffLine(_0x147c7b,_0x4beede),_0x5574a2='<div\x20class=\x22diff-line\x20diff-context\x22><span\x20class=\x22diff-line-num\x20diff-line-num-old\x22>'+_0xb76183+'</span><span\x20class=\x22diff-line-num\x20diff-line-num-new\x22>'+_0x559669+'</span><span\x20class=\x22diff-line-content\x22>\x20'+_0x689ff2+'</span></div>';return _0xb76183+=0x1,_0x559669+=0x1,_0x5574a2;})['join']('');return'<div\x20class=\x22diff-hunk\x22><div\x20class=\x22diff-hunk-header\x22>'+Utils['escapeHtml'](_0x2f2890['header'])+'</div>'+_0x36d9e4+'</div>';})['join'](''),_0xa2a3f2=_0x5e1446||'<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-'+_0x9d1021+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22file-diff-header\x22\x20data-diff-id=\x22'+_0x9d1021+'\x22\x20data-file-name=\x22'+Utils['escapeHtml'](_0x20173a)+'\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'+_0x54c872+'\x22>'+_0x14cc31+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22file-diff-name\x22>'+Utils['escapeHtml'](_0x20173a)+'</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>+'+_0x33af69+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22diff-del\x22>-'+_0x29f48b+'</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'+_0x9d1021+'\x22\x20data-collapsed=\x22'+_0x41e8c8+'\x22\x20type=\x22button\x22\x20aria-label=\x22'+(_0x41e8c8?'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'+(_0x41e8c8?'collapsed':'')+'\x22\x20id=\x22'+_0x9d1021+'\x22>'+_0xa2a3f2+'</div>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20';})['join']('');}
|